From: support Date: Wed, 23 Nov 2022 15:45:24 +0000 (+0000) Subject: Built motion from commit 6db1674d.|2.6.23 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=f20807ded8ccaaa40ac72e6260b3b9f4e240c65e;p=motion2.git Built motion from commit 6db1674d.|2.6.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f7a2402..216e92a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.23", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-21T11:37:33.824Z", + "time": "2022-11-23T15:37:55.404Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5ee2ef9..acba906 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.23", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-21T11:37:33.824Z", + "time": "2022-11-23T15:37:55.404Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e40c91e..b9ad350 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.23", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 2279703..da326f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.23", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 564866b..b6cb4ad 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 _0x4939=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x57cd47,_0x519a1c){var _0x149651=function(_0x433212){while(--_0x433212){_0x57cd47['push'](_0x57cd47['shift']());}};_0x149651(++_0x519a1c);}(_0x4939,0x1a9));var _0x9493=function(_0x2df2a9,_0x123913){_0x2df2a9=_0x2df2a9-0x0;var _0x1aad13=_0x4939[_0x2df2a9];return _0x1aad13;};'use strict';var Sequelize=require(_0x9493('0x0'));module[_0x9493('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x10662a){return this['getDataValue'](_0x9493('0x2'));}},'action':{'type':Sequelize[_0x9493('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9493('0x4'),_0x9493('0x5'),_0x9493('0x6'),_0x9493('0x7'),_0x9493('0x8'),_0x9493('0x9'),_0x9493('0xa'),_0x9493('0xb')]],'msg':_0x9493('0xc')}},'comment':_0x9493('0xc')},'data1':{'type':Sequelize[_0x9493('0x3')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x9493('0x3')](0x1000),'comment':_0x9493('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x9493('0xe')},'data4':{'type':Sequelize[_0x9493('0x3')](0x1000),'comments':_0x9493('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x9493('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x9493('0x11')},'data7':{'type':Sequelize[_0x9493('0x12')],'comments':_0x9493('0x13')}}; \ No newline at end of file +var _0x2ce9=['STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2ce9,0x86));var _0x92ce=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0x2ce9[_0x55cc58];return _0x26062e;};'use strict';var Sequelize=require(_0x92ce('0x0'));module[_0x92ce('0x1')]={'name':{'type':Sequelize[_0x92ce('0x2')],'get':function(_0x5c18b3){return this[_0x92ce('0x3')](_0x92ce('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x92ce('0x5'),_0x92ce('0x6'),_0x92ce('0x7'),_0x92ce('0x8'),_0x92ce('0x9'),'browser',_0x92ce('0xa'),'script']],'msg':_0x92ce('0xb')}},'comment':_0x92ce('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x92ce('0xc')},'data2':{'type':Sequelize[_0x92ce('0xd')](0x1000),'comment':_0x92ce('0xe')},'data3':{'type':Sequelize[_0x92ce('0xd')](0x1000),'comment':_0x92ce('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x92ce('0x10')},'data5':{'type':Sequelize[_0x92ce('0xd')](0x1000),'comments':_0x92ce('0x11')},'data6':{'type':Sequelize[_0x92ce('0xd')],'comments':_0x92ce('0x12')},'data7':{'type':Sequelize[_0x92ce('0x13')],'comments':_0x92ce('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2d1e443..5557efe 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 _0xeebc=['json','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','name','body','Action','find','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0xeebc,0x69));var _0xceeb=function(_0xff1c9e,_0x721237){_0xff1c9e=_0xff1c9e-0x0;var _0x554603=_0xeebc[_0xff1c9e];return _0x554603;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xceeb('0x0'));var zipdir=require(_0xceeb('0x1'));var jsonpatch=require(_0xceeb('0x2'));var rp=require(_0xceeb('0x3'));var moment=require(_0xceeb('0x4'));var BPromise=require(_0xceeb('0x5'));var Mustache=require(_0xceeb('0x6'));var util=require('util');var path=require(_0xceeb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xceeb('0x8'));var _=require(_0xceeb('0x9'));var squel=require(_0xceeb('0xa'));var crypto=require(_0xceeb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xceeb('0xc'));var toCsv=require(_0xceeb('0xd'));var querystring=require(_0xceeb('0xe'));var Papa=require(_0xceeb('0xf'));var Redis=require(_0xceeb('0x10'));var authService=require(_0xceeb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xceeb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xceeb('0x13'))(_0xceeb('0x14'));var utils=require(_0xceeb('0x15'));var config=require(_0xceeb('0x16'));var licenseUtil=require(_0xceeb('0x17'));var db=require(_0xceeb('0x18'))['db'];function respondWithStatusCode(_0x4a4c09,_0x4125e1){_0x4125e1=_0x4125e1||0xcc;return function(_0x2a86e6){if(_0x2a86e6){return _0x4a4c09[_0xceeb('0x19')](_0x4125e1);}return _0x4a4c09['status'](_0x4125e1)['end']();};}function respondWithResult(_0x14fd11,_0x43abe7){_0x43abe7=_0x43abe7||0xc8;return function(_0x49e5a4){if(_0x49e5a4){return _0x14fd11[_0xceeb('0x1a')](_0x43abe7)[_0xceeb('0x1b')](_0x49e5a4);}};}function respondWithFilteredResult(_0x1f9595,_0x3937ad){return function(_0x12e52d){if(_0x12e52d){var _0x4b1173=typeof _0x3937ad['offset']==='undefined'&&typeof _0x3937ad['limit']===_0xceeb('0x1c');var _0xd34b9=_0x12e52d['count'];var _0x129045=_0x4b1173?0x0:_0x3937ad['offset'];var _0x5180b6=_0x4b1173?_0x12e52d[_0xceeb('0x1d')]:_0x3937ad[_0xceeb('0x1e')]+_0x3937ad['limit'];var _0x3d6333;if(_0x5180b6>=_0xd34b9){_0x5180b6=_0xd34b9;_0x3d6333=0xc8;}else{_0x3d6333=0xce;}_0x1f9595[_0xceeb('0x1a')](_0x3d6333);return _0x1f9595[_0xceeb('0x1f')](_0xceeb('0x20'),_0x129045+'-'+_0x5180b6+'/'+_0xd34b9)[_0xceeb('0x1b')](_0x12e52d);}return null;};}function patchUpdates(_0xd73799){return function(_0x5465dd){try{jsonpatch['apply'](_0x5465dd,_0xd73799,!![]);}catch(_0x46bbea){return BPromise['reject'](_0x46bbea);}return _0x5465dd[_0xceeb('0x21')]();};}function saveUpdates(_0x25e3c5,_0x3c2fc5){return function(_0x5246ab){if(_0x5246ab){return _0x5246ab[_0xceeb('0x22')](_0x25e3c5)[_0xceeb('0x23')](function(_0x40d12e){return _0x40d12e;});}return null;};}function removeEntity(_0x4408d1,_0x2cac8e){return function(_0x27d76f){if(_0x27d76f){return _0x27d76f[_0xceeb('0x24')]()[_0xceeb('0x23')](function(){_0x4408d1[_0xceeb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351e50,_0x2d0c29){return function(_0x3c2316){if(!_0x3c2316){_0x351e50[_0xceeb('0x19')](0x194);}return _0x3c2316;};}function handleError(_0x49484d,_0x3c1575){_0x3c1575=_0x3c1575||0x1f4;return function(_0x155950){logger[_0xceeb('0x25')](_0x155950['stack']);if(_0x155950[_0xceeb('0x26')]){delete _0x155950[_0xceeb('0x26')];}_0x49484d[_0xceeb('0x1a')](_0x3c1575)['send'](_0x155950);};}exports[_0xceeb('0x22')]=function(_0x5ff6a7,_0x32aad8){if(_0x5ff6a7[_0xceeb('0x27')]['id']){delete _0x5ff6a7[_0xceeb('0x27')]['id'];}return db[_0xceeb('0x28')][_0xceeb('0x29')]({'where':{'id':_0x5ff6a7['params']['id']}})['then'](handleEntityNotFound(_0x32aad8,null))[_0xceeb('0x23')](saveUpdates(_0x5ff6a7['body'],null))[_0xceeb('0x23')](respondWithResult(_0x32aad8,null))[_0xceeb('0x2a')](handleError(_0x32aad8,null));};exports['destroy']=function(_0x30db21,_0x46b616){return db[_0xceeb('0x28')]['find']({'where':{'id':_0x30db21[_0xceeb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x46b616,null))[_0xceeb('0x23')](removeEntity(_0x46b616,null))[_0xceeb('0x2a')](handleError(_0x46b616,null));}; \ No newline at end of file +var _0x90c6=['save','update','then','destroy','end','sendStatus','error','stack','name','send','body','Action','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','offset','limit','undefined','Content-Range','apply'];(function(_0x512229,_0x1a7208){var _0x50aad6=function(_0x20dcdb){while(--_0x20dcdb){_0x512229['push'](_0x512229['shift']());}};_0x50aad6(++_0x1a7208);}(_0x90c6,0xbe));var _0x690c=function(_0x47c049,_0xb5c0ca){_0x47c049=_0x47c049-0x0;var _0x5556f4=_0x90c6[_0x47c049];return _0x5556f4;};'use strict';var emlformat=require(_0x690c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x690c('0x1'));var jsonpatch=require(_0x690c('0x2'));var rp=require(_0x690c('0x3'));var moment=require(_0x690c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x690c('0x5'));var util=require(_0x690c('0x6'));var path=require('path');var sox=require(_0x690c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x690c('0x8'));var _=require(_0x690c('0x9'));var squel=require(_0x690c('0xa'));var crypto=require(_0x690c('0xb'));var jsforce=require(_0x690c('0xc'));var deskjs=require(_0x690c('0xd'));var toCsv=require(_0x690c('0xe'));var querystring=require(_0x690c('0xf'));var Papa=require('papaparse');var Redis=require(_0x690c('0x10'));var authService=require(_0x690c('0x11'));var qs=require(_0x690c('0x12'));var as=require(_0x690c('0x13'));var hardwareService=require(_0x690c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x690c('0x15'));var config=require(_0x690c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1881,_0x3bcdc6){_0x3bcdc6=_0x3bcdc6||0xcc;return function(_0x11aaf3){if(_0x11aaf3){return _0x1b1881['sendStatus'](_0x3bcdc6);}return _0x1b1881['status'](_0x3bcdc6)['end']();};}function respondWithResult(_0x1b2a37,_0x3f71c3){_0x3f71c3=_0x3f71c3||0xc8;return function(_0x5b8f20){if(_0x5b8f20){return _0x1b2a37[_0x690c('0x17')](_0x3f71c3)[_0x690c('0x18')](_0x5b8f20);}};}function respondWithFilteredResult(_0x54806a,_0x1ab518){return function(_0x4ae039){if(_0x4ae039){var _0x56c2e5=typeof _0x1ab518[_0x690c('0x19')]==='undefined'&&typeof _0x1ab518[_0x690c('0x1a')]===_0x690c('0x1b');var _0x10dd36=_0x4ae039['count'];var _0x555695=_0x56c2e5?0x0:_0x1ab518[_0x690c('0x19')];var _0x2de8d5=_0x56c2e5?_0x4ae039['count']:_0x1ab518['offset']+_0x1ab518[_0x690c('0x1a')];var _0x469f23;if(_0x2de8d5>=_0x10dd36){_0x2de8d5=_0x10dd36;_0x469f23=0xc8;}else{_0x469f23=0xce;}_0x54806a[_0x690c('0x17')](_0x469f23);return _0x54806a['set'](_0x690c('0x1c'),_0x555695+'-'+_0x2de8d5+'/'+_0x10dd36)['json'](_0x4ae039);}return null;};}function patchUpdates(_0xc2783c){return function(_0x4c1ed5){try{jsonpatch[_0x690c('0x1d')](_0x4c1ed5,_0xc2783c,!![]);}catch(_0x59a638){return BPromise['reject'](_0x59a638);}return _0x4c1ed5[_0x690c('0x1e')]();};}function saveUpdates(_0x42ec02,_0x546e64){return function(_0xca454a){if(_0xca454a){return _0xca454a[_0x690c('0x1f')](_0x42ec02)[_0x690c('0x20')](function(_0x3f4ce7){return _0x3f4ce7;});}return null;};}function removeEntity(_0x3a3b39,_0x48f4b4){return function(_0x588cd6){if(_0x588cd6){return _0x588cd6[_0x690c('0x21')]()[_0x690c('0x20')](function(){_0x3a3b39[_0x690c('0x17')](0xcc)[_0x690c('0x22')]();});}};}function handleEntityNotFound(_0x186cb6,_0x2ab825){return function(_0x3fd18b){if(!_0x3fd18b){_0x186cb6[_0x690c('0x23')](0x194);}return _0x3fd18b;};}function handleError(_0x3b14c2,_0x592324){_0x592324=_0x592324||0x1f4;return function(_0x2c6c6b){logger[_0x690c('0x24')](_0x2c6c6b[_0x690c('0x25')]);if(_0x2c6c6b[_0x690c('0x26')]){delete _0x2c6c6b[_0x690c('0x26')];}_0x3b14c2[_0x690c('0x17')](_0x592324)[_0x690c('0x27')](_0x2c6c6b);};}exports['update']=function(_0xa74c41,_0x164dcf){if(_0xa74c41[_0x690c('0x28')]['id']){delete _0xa74c41[_0x690c('0x28')]['id'];}return db[_0x690c('0x29')][_0x690c('0x2a')]({'where':{'id':_0xa74c41[_0x690c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x164dcf,null))['then'](saveUpdates(_0xa74c41[_0x690c('0x28')],null))['then'](respondWithResult(_0x164dcf,null))['catch'](handleError(_0x164dcf,null));};exports[_0x690c('0x21')]=function(_0x1de1b9,_0x4e7b4c){return db[_0x690c('0x29')][_0x690c('0x2a')]({'where':{'id':_0x1de1b9[_0x690c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4e7b4c,null))['then'](removeEntity(_0x4e7b4c,null))['catch'](handleError(_0x4e7b4c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 324da09..23e0935 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 _0x021f=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','lodash','util','../../config/logger','moment'];(function(_0x517ef4,_0x41d450){var _0x570bdc=function(_0x2d467a){while(--_0x2d467a){_0x517ef4['push'](_0x517ef4['shift']());}};_0x570bdc(++_0x41d450);}(_0x021f,0x74));var _0xf021=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x021f[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf021('0x0'));var util=require(_0xf021('0x1'));var logger=require(_0xf021('0x2'))('api');var moment=require(_0xf021('0x3'));var BPromise=require(_0xf021('0x4'));var rp=require(_0xf021('0x5'));var fs=require('fs');var path=require(_0xf021('0x6'));var rimraf=require(_0xf021('0x7'));var config=require(_0xf021('0x8'));var attributes=require(_0xf021('0x9'));module['exports']=function(_0x539136,_0x1da81b){return _0x539136[_0xf021('0xa')](_0xf021('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7775=['define','Action','tools_actions','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x391dbc,_0x2a83d8){var _0x571a2d=function(_0x442855){while(--_0x442855){_0x391dbc['push'](_0x391dbc['shift']());}};_0x571a2d(++_0x2a83d8);}(_0x7775,0x1d7));var _0x5777=function(_0x29f7bd,_0x496352){_0x29f7bd=_0x29f7bd-0x0;var _0xb15494=_0x7775[_0x29f7bd];return _0xb15494;};'use strict';var _=require(_0x5777('0x0'));var util=require(_0x5777('0x1'));var logger=require(_0x5777('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5777('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5777('0x4'));var rimraf=require(_0x5777('0x5'));var config=require(_0x5777('0x6'));var attributes=require(_0x5777('0x7'));module[_0x5777('0x8')]=function(_0x36cd1e,_0x1356f4){return _0x36cd1e[_0x5777('0x9')](_0x5777('0xa'),attributes,{'tableName':_0x5777('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index f756e89..0b2e711 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20661f,_0x51b7e4){_0x20661f=_0x20661f-0x0;var _0x2a7431=_0x1cb9[_0x20661f];return _0x2a7431;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x58d399,_0x484bb5){var _0x2d73e0=function(_0x58d07e){while(--_0x58d07e){_0x58d399['push'](_0x58d399['shift']());}};_0x2d73e0(++_0x484bb5);}(_0x326f,0xd1));var _0xf326=function(_0x1f957c,_0x2ede7d){_0x1f957c=_0x1f957c-0x0;var _0x4a9bfe=_0x326f[_0x1f957c];return _0x4a9bfe;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b4350cc..dc8e17e 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 _0x165d=['../../config/environment','./action.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0x165d,0xd7));var _0xd165=function(_0x4ceb7a,_0x189208){_0x4ceb7a=_0x4ceb7a-0x0;var _0x59462c=_0x165d[_0x4ceb7a];return _0x59462c;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require('express');var router=express[_0xd165('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd165('0x5'));var config=require(_0xd165('0x6'));var controller=require(_0xd165('0x7'));router['put'](_0xd165('0x8'),auth[_0xd165('0x9')](),controller[_0xd165('0xa')]);router['delete'](_0xd165('0x8'),auth['isAuthenticated'](),controller[_0xd165('0xb')]);module[_0xd165('0xc')]=router; \ No newline at end of file +var _0x4dd4=['../../config/environment','./action.controller','put','/:id','delete','isAuthenticated','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x41b3f2,_0x16e546){var _0x543373=function(_0x1d4412){while(--_0x1d4412){_0x41b3f2['push'](_0x41b3f2['shift']());}};_0x543373(++_0x16e546);}(_0x4dd4,0x96));var _0x44dd=function(_0x31d48f,_0xd94978){_0x31d48f=_0x31d48f-0x0;var _0x3f6874=_0x4dd4[_0x31d48f];return _0x3f6874;};'use strict';var multer=require(_0x44dd('0x0'));var util=require(_0x44dd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44dd('0x2'));var router=express[_0x44dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x44dd('0x4'));var interaction=require(_0x44dd('0x5'));var config=require(_0x44dd('0x6'));var controller=require(_0x44dd('0x7'));router[_0x44dd('0x8')](_0x44dd('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x44dd('0xa')](_0x44dd('0x9'),auth[_0x44dd('0xb')](),controller[_0x44dd('0xc')]);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 cea97f7..7497046 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x4b5772,_0x53c19f){var _0x453006=function(_0x4c582c){while(--_0x4c582c){_0x4b5772['push'](_0x4b5772['shift']());}};_0x453006(++_0x53c19f);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x437808,_0x558212){_0x437808=_0x437808-0x0;var _0x2ff4e0=_0x8ef6[_0x437808];return _0x2ff4e0;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'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 49fa269..5db16df 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 _0x297d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','foreignKey','conditions','debug','toString','sequelize','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','condition','metric','groupBy','table','clone','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','child_process','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20NULL','%s.%s\x20=\x20%s.%s','Limited\x20Query:'];(function(_0x876e8c,_0x43e702){var _0xd49611=function(_0x111609){while(--_0x111609){_0x876e8c['push'](_0x876e8c['shift']());}};_0xd49611(++_0x43e702);}(_0x297d,0x14e));var _0xd297=function(_0x754d56,_0x30aa62){_0x754d56=_0x754d56-0x0;var _0xfdc03e=_0x297d[_0x754d56];return _0xfdc03e;};'use strict';var emlformat=require(_0xd297('0x0'));var rimraf=require(_0xd297('0x1'));var zipdir=require(_0xd297('0x2'));var jsonpatch=require(_0xd297('0x3'));var rp=require('request-promise');var moment=require(_0xd297('0x4'));var BPromise=require(_0xd297('0x5'));var Mustache=require(_0xd297('0x6'));var util=require(_0xd297('0x7'));var path=require(_0xd297('0x8'));var sox=require(_0xd297('0x9'));var csv=require('to-csv');var ejs=require(_0xd297('0xa'));var fs=require('fs');var fs_extra=require(_0xd297('0xb'));var _=require(_0xd297('0xc'));var squel=require('squel');var crypto=require(_0xd297('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd297('0xe'));var querystring=require(_0xd297('0xf'));var Papa=require('papaparse');var Redis=require(_0xd297('0x10'));var authService=require(_0xd297('0x11'));var qs=require(_0xd297('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd297('0x13'));var logger=require(_0xd297('0x14'))(_0xd297('0x15'));var utils=require(_0xd297('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd297('0x17'));var db=require(_0xd297('0x18'))['db'];var dbH=require(_0xd297('0x18'))[_0xd297('0x19')];function respondWithStatusCode(_0x4498b2,_0x2c99aa){_0x2c99aa=_0x2c99aa||0xcc;return function(_0x5c2412){if(_0x5c2412){return _0x4498b2[_0xd297('0x1a')](_0x2c99aa);}return _0x4498b2[_0xd297('0x1b')](_0x2c99aa)['end']();};}function respondWithResult(_0x397cd0,_0x2d537a){_0x2d537a=_0x2d537a||0xc8;return function(_0x1c9b1c){if(_0x1c9b1c){return _0x397cd0[_0xd297('0x1b')](_0x2d537a)[_0xd297('0x1c')](_0x1c9b1c);}};}function respondWithFilteredResult(_0x1c1750,_0x1d86d6){return function(_0x4c77fe){if(_0x4c77fe){var _0x14f7cb=typeof _0x1d86d6[_0xd297('0x1d')]===_0xd297('0x1e')&&typeof _0x1d86d6['limit']===_0xd297('0x1e');var _0x13cc85=_0x4c77fe[_0xd297('0x1f')];var _0x591867=_0x14f7cb?0x0:_0x1d86d6[_0xd297('0x1d')];var _0x400789=_0x14f7cb?_0x4c77fe['count']:_0x1d86d6[_0xd297('0x1d')]+_0x1d86d6[_0xd297('0x20')];var _0x38a66e;if(_0x400789>=_0x13cc85){_0x400789=_0x13cc85;_0x38a66e=0xc8;}else{_0x38a66e=0xce;}_0x1c1750[_0xd297('0x1b')](_0x38a66e);return _0x1c1750[_0xd297('0x21')]('Content-Range',_0x591867+'-'+_0x400789+'/'+_0x13cc85)['json'](_0x4c77fe);}return null;};}function patchUpdates(_0x320901){return function(_0x438cb8){try{jsonpatch[_0xd297('0x22')](_0x438cb8,_0x320901,!![]);}catch(_0x34af92){return BPromise[_0xd297('0x23')](_0x34af92);}return _0x438cb8[_0xd297('0x24')]();};}function saveUpdates(_0x4994e5,_0x3208cb){return function(_0x43a5f7){if(_0x43a5f7){return _0x43a5f7['update'](_0x4994e5)[_0xd297('0x25')](function(_0x51c9c9){return _0x51c9c9;});}return null;};}function removeEntity(_0x5e7917,_0x33e186){return function(_0x40c0d5){if(_0x40c0d5){return _0x40c0d5[_0xd297('0x26')]()[_0xd297('0x25')](function(){var _0x5b843a=_0x40c0d5[_0xd297('0x27')]({'plain':!![]});var _0x262867=_0xd297('0x28');return db[_0xd297('0x29')][_0xd297('0x26')]({'where':{'type':_0x262867,'resourceId':_0x5b843a['id']}})[_0xd297('0x25')](function(){return _0x40c0d5;});})['then'](function(){_0x5e7917[_0xd297('0x1b')](0xcc)[_0xd297('0x2a')]();});}};}function handleEntityNotFound(_0x4c7ec6,_0x199a46){return function(_0x52d0c4){if(!_0x52d0c4){_0x4c7ec6[_0xd297('0x1a')](0x194);}return _0x52d0c4;};}function handleError(_0x58e06e,_0x4b8b7b){_0x4b8b7b=_0x4b8b7b||0x1f4;return function(_0x32aea7){logger[_0xd297('0x2b')](_0x32aea7[_0xd297('0x2c')]);if(_0x32aea7[_0xd297('0x2d')]){delete _0x32aea7[_0xd297('0x2d')];}_0x58e06e[_0xd297('0x1b')](_0x4b8b7b)[_0xd297('0x2e')](_0x32aea7);};}exports[_0xd297('0x2f')]=function(_0x3a5e6b,_0x1cd038){var _0x229c1d={},_0x22d206={},_0x344646={'count':0x0,'rows':[]};var _0x49edd2=_[_0xd297('0x30')](db['AnalyticCustomReport'][_0xd297('0x31')],function(_0x425966){return{'name':_0x425966[_0xd297('0x32')],'type':_0x425966[_0xd297('0x33')]['key']};});_0x22d206['model']=_[_0xd297('0x30')](_0x49edd2,_0xd297('0x2d'));_0x22d206['query']=_[_0xd297('0x34')](_0x3a5e6b[_0xd297('0x35')]);_0x22d206[_0xd297('0x36')]=_[_0xd297('0x37')](_0x22d206[_0xd297('0x38')],_0x22d206['query']);_0x229c1d[_0xd297('0x39')]=_[_0xd297('0x37')](_0x22d206[_0xd297('0x38')],qs[_0xd297('0x3a')](_0x3a5e6b[_0xd297('0x35')][_0xd297('0x3a')]));_0x229c1d[_0xd297('0x39')]=_0x229c1d[_0xd297('0x39')][_0xd297('0x3b')]?_0x229c1d[_0xd297('0x39')]:_0x22d206[_0xd297('0x38')];if(!_0x3a5e6b[_0xd297('0x35')][_0xd297('0x3c')]('nolimit')){_0x229c1d[_0xd297('0x20')]=qs[_0xd297('0x20')](_0x3a5e6b[_0xd297('0x35')]['limit']);_0x229c1d[_0xd297('0x1d')]=qs[_0xd297('0x1d')](_0x3a5e6b['query'][_0xd297('0x1d')]);}_0x229c1d[_0xd297('0x3d')]=qs[_0xd297('0x3e')](_0x3a5e6b[_0xd297('0x35')][_0xd297('0x3e')]);_0x229c1d[_0xd297('0x3f')]=qs[_0xd297('0x36')](_[_0xd297('0x40')](_0x3a5e6b[_0xd297('0x35')],_0x22d206[_0xd297('0x36')]),_0x49edd2);if(_0x3a5e6b[_0xd297('0x35')][_0xd297('0x41')]){_0x229c1d[_0xd297('0x3f')]=_[_0xd297('0x42')](_0x229c1d[_0xd297('0x3f')],{'$or':_['map'](_0x49edd2,function(_0x22d854){if(_0x22d854[_0xd297('0x33')]!==_0xd297('0x43')){var _0x11b89c={};_0x11b89c[_0x22d854['name']]={'$like':'%'+_0x3a5e6b[_0xd297('0x35')]['filter']+'%'};return _0x11b89c;}})});}_0x229c1d=_[_0xd297('0x42')]({},_0x229c1d,_0x3a5e6b[_0xd297('0x44')]);var _0x364918={'where':_0x229c1d[_0xd297('0x3f')]};return db[_0xd297('0x45')][_0xd297('0x1f')](_0x364918)[_0xd297('0x25')](function(_0x38f0d4){_0x344646[_0xd297('0x1f')]=_0x38f0d4;if(_0x3a5e6b[_0xd297('0x35')]['includeAll']){_0x229c1d[_0xd297('0x46')]=[{'all':!![]}];}return db[_0xd297('0x45')][_0xd297('0x47')](_0x229c1d);})[_0xd297('0x25')](function(_0x12672d){_0x344646[_0xd297('0x48')]=_0x12672d;return _0x344646;})[_0xd297('0x25')](respondWithFilteredResult(_0x1cd038,_0x229c1d))[_0xd297('0x49')](handleError(_0x1cd038,null));};exports['show']=function(_0x2a8c14,_0x49b969){var _0x41e3ec={'raw':![],'where':{'id':_0x2a8c14[_0xd297('0x4a')]['id']}},_0x176a86={};_0x176a86[_0xd297('0x38')]=_[_0xd297('0x34')](db[_0xd297('0x45')]['rawAttributes']);_0x176a86['query']=_['keys'](_0x2a8c14['query']);_0x176a86[_0xd297('0x36')]=_[_0xd297('0x37')](_0x176a86['model'],_0x176a86[_0xd297('0x35')]);_0x41e3ec[_0xd297('0x39')]=_[_0xd297('0x37')](_0x176a86['model'],qs['fields'](_0x2a8c14['query'][_0xd297('0x3a')]));_0x41e3ec[_0xd297('0x39')]=_0x41e3ec[_0xd297('0x39')]['length']?_0x41e3ec[_0xd297('0x39')]:_0x176a86[_0xd297('0x38')];if(_0x2a8c14[_0xd297('0x35')][_0xd297('0x4b')]){_0x41e3ec[_0xd297('0x46')]=[{'all':!![]}];}_0x41e3ec=_[_0xd297('0x42')]({},_0x41e3ec,_0x2a8c14[_0xd297('0x44')]);return db[_0xd297('0x45')][_0xd297('0x4c')](_0x41e3ec)[_0xd297('0x25')](handleEntityNotFound(_0x49b969,null))[_0xd297('0x25')](respondWithResult(_0x49b969,null))[_0xd297('0x49')](handleError(_0x49b969,null));};exports[_0xd297('0x4d')]=function(_0x3e217f,_0x423e67){return db[_0xd297('0x45')][_0xd297('0x4d')](_0x3e217f[_0xd297('0x4e')],{})[_0xd297('0x25')](function(_0x110ddf){var _0x35d1cf=_0x3e217f[_0xd297('0x4f')][_0xd297('0x27')]({'plain':!![]});if(!_0x35d1cf)throw new Error(_0xd297('0x50'));if(_0x35d1cf[_0xd297('0x51')]===_0xd297('0x4f')){var _0x19310d=_0x110ddf[_0xd297('0x27')]({'plain':!![]});var _0x541e37=_0xd297('0x52');return db[_0xd297('0x53')][_0xd297('0x4c')]({'where':{'name':_0x541e37,'userProfileId':_0x35d1cf['userProfileId']},'raw':!![]})[_0xd297('0x25')](function(_0x567ac7){if(_0x567ac7&&_0x567ac7[_0xd297('0x54')]===0x0){return db['UserProfileResource'][_0xd297('0x4d')]({'name':_0x19310d[_0xd297('0x2d')],'resourceId':_0x19310d['id'],'type':'CustomReports','sectionId':_0x567ac7['id']},{})[_0xd297('0x25')](function(){return _0x110ddf;});}else{return _0x110ddf;}})[_0xd297('0x49')](function(_0x553496){logger[_0xd297('0x2b')](_0xd297('0x55'),_0x553496);throw _0x553496;});}return _0x110ddf;})[_0xd297('0x25')](respondWithResult(_0x423e67,0xc9))['catch'](handleError(_0x423e67,null));};exports[_0xd297('0x56')]=function(_0x3e9e70,_0x1a607e){if(_0x3e9e70[_0xd297('0x4e')]['id']){delete _0x3e9e70['body']['id'];}return db[_0xd297('0x45')][_0xd297('0x4c')]({'where':{'id':_0x3e9e70[_0xd297('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a607e,null))[_0xd297('0x25')](saveUpdates(_0x3e9e70[_0xd297('0x4e')],null))[_0xd297('0x25')](respondWithResult(_0x1a607e,null))[_0xd297('0x49')](handleError(_0x1a607e,null));};exports['destroy']=function(_0x1f92e3,_0x30c7bc){return db[_0xd297('0x45')][_0xd297('0x4c')]({'where':{'id':_0x1f92e3[_0xd297('0x4a')]['id']}})[_0xd297('0x25')](handleEntityNotFound(_0x30c7bc,null))[_0xd297('0x25')](removeEntity(_0x30c7bc,null))[_0xd297('0x49')](handleError(_0x30c7bc,null));};exports[_0xd297('0x57')]=function(_0x1cc278,_0x18fcb){var _0x2a5a34=0xa;var _0x16e344=[_0xd297('0x58'),'left_join',_0xd297('0x59'),_0xd297('0x5a')];var _0xc91725={'SUM':_0xd297('0x5b'),'COUNT':_0xd297('0x5c'),'COUNT DISTINCT':_0xd297('0x5d'),'MAX':_0xd297('0x5e'),'MIN':_0xd297('0x5f'),'AVG':_0xd297('0x60'),'GROUP_CONCAT':_0xd297('0x61'),'GROUP_CONCAT ASC':_0xd297('0x62'),'GROUP_CONCAT DESC':_0xd297('0x63')};var _0x1226fc={'SEC_TO_TIME':_0xd297('0x64'),'DATE':_0xd297('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xd297('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34a617=function(_0x329504){return!_[_0xd297('0x67')]([_0xd297('0x68'),'IS\x20NOT\x20NULL',_0xd297('0x69'),_0xd297('0x6a')],_0x329504);};var _0x2b13ed=function(_0x202f0b){if(!_0x202f0b||!_0x202f0b[_0xd297('0x6b')][_0xd297('0x3b')]){return'';}for(var _0x52b4e0='(',_0x24ad9b=0x0;_0x24ad9b<_0x202f0b[_0xd297('0x6b')]['length'];_0x24ad9b+=0x1){_0x24ad9b>0x0&&(_0x52b4e0+='\x20'+_0x202f0b[_0xd297('0x6c')]+'\x20');_0x52b4e0+=_0x202f0b[_0xd297('0x6b')][_0x24ad9b][_0xd297('0x6d')]?_0x2b13ed(_0x202f0b[_0xd297('0x6b')][_0x24ad9b][_0xd297('0x6d')]):_0x202f0b[_0xd297('0x6b')][_0x24ad9b][_0xd297('0x6e')]+'\x20'+_0x202f0b['rules'][_0x24ad9b]['condition']+(_0x34a617(_0x202f0b[_0xd297('0x6b')][_0x24ad9b]['condition'])?'\x20'+_0x202f0b[_0xd297('0x6b')][_0x24ad9b][_0xd297('0x6f')]:'');}return _0x52b4e0+')';};var _0x26ddf6={'where':{'id':_0x1cc278[_0xd297('0x4a')]['id']}},_0x3be49d,_0x392425,_0x19f742,_0x1defc5,_0x3faea1;_0x26ddf6=_[_0xd297('0x42')]({},_0x26ddf6,_0x1cc278['options']);return db[_0xd297('0x45')][_0xd297('0x4c')](_0x26ddf6)['then'](function(_0x55ffb4){if(_0x55ffb4){_0x3be49d=_0x55ffb4;return _0x55ffb4[_0xd297('0x70')]();}return null;})['then'](function(_0x479abb){if(_0x479abb){if(!_0x479abb[_0xd297('0x3b')]){throw new db[(_0xd297('0x71'))][(_0xd297('0x72'))](_0xd297('0x73'),0x193);}_0x392425=_0x479abb;return db[_0xd297('0x74')][_0xd297('0x47')]({'raw':!![]});}return null;})['then'](function(_0x40ae47){if(_0x40ae47){_0x19f742=_[_0xd297('0x75')](_0x40ae47,'id');var _0x4ad5ec;var _0x43f9bc=squel[_0xd297('0x76')]();_0x43f9bc[_0xd297('0x77')](_0x3be49d['table']);for(var _0x25987d=0x0;_0x25987d<_0x392425[_0xd297('0x3b')];_0x25987d+=0x1){_0x4ad5ec=_0x392425[_0x25987d][_0xd297('0x78')]?_0x19f742[_0x392425[_0x25987d][_0xd297('0x78')]]['metric']:_0x392425[_0x25987d][_0xd297('0x6e')];_0x4ad5ec=_0x392425[_0x25987d][_0xd297('0x79')]?_[_0xd297('0x7a')](_0xc91725[_0x392425[_0x25987d][_0xd297('0x79')]],'%s',_0x4ad5ec):_0x4ad5ec;_0x4ad5ec=_0x392425[_0x25987d][_0xd297('0x7b')]?_[_0xd297('0x7a')](_0x1226fc[_0x392425[_0x25987d][_0xd297('0x7b')]],'%s',_0x4ad5ec):_0x4ad5ec;if(_0x392425[_0x25987d]['groupBy']){_0x43f9bc[_0xd297('0x6d')](_0x4ad5ec);}_0x392425[_0x25987d]['orderBy']&&_0x43f9bc['order'](_0x4ad5ec,_0x392425[_0x25987d][_0xd297('0x7c')]===_0xd297('0x7d')?![]:!![]);_0x43f9bc[_0xd297('0x6e')](_0x4ad5ec,_0x392425[_0x25987d][_0xd297('0x7e')]||_0x4ad5ec);}if(_0x3be49d['joins']){_0x3be49d['joins']=JSON[_0xd297('0x7f')](_0x3be49d[_0xd297('0x80')]);for(var _0x193f4a=0x0;_0x193f4a<_0x3be49d[_0xd297('0x80')][_0xd297('0x3b')];_0x193f4a+=0x1){if(_0x3be49d[_0xd297('0x80')][_0x193f4a][_0xd297('0x33')]&&_[_0xd297('0x67')](_0x16e344,_0x3be49d[_0xd297('0x80')][_0x193f4a][_0xd297('0x33')])&&_0x3be49d['joins'][_0x193f4a][_0xd297('0x81')]&&_0x3be49d['joins'][_0x193f4a][_0xd297('0x82')]&&_0x3be49d[_0xd297('0x80')][_0x193f4a][_0xd297('0x83')]){_0x43f9bc[_0x3be49d[_0xd297('0x80')][_0x193f4a]['type']](_0x3be49d[_0xd297('0x80')][_0x193f4a][_0xd297('0x82')],null,util[_0xd297('0x7b')]('%s.%s\x20=\x20%s.%s',_0x3be49d['table'],_0x3be49d['joins'][_0x193f4a][_0xd297('0x81')],_0x3be49d[_0xd297('0x80')][_0x193f4a][_0xd297('0x82')],_0x3be49d[_0xd297('0x80')][_0x193f4a]['foreignKey']));}}}if(_0x3be49d[_0xd297('0x84')]){_0x3be49d[_0xd297('0x84')]=JSON[_0xd297('0x7f')](_0x3be49d[_0xd297('0x84')]);_0x43f9bc['where'](_0x2b13ed(_0x3be49d[_0xd297('0x84')][_0xd297('0x6d')]));}_0x3faea1=_0x43f9bc['clone']();_0x43f9bc[_0xd297('0x20')](_0x2a5a34);_0x43f9bc[_0xd297('0x1d')](0x0);logger[_0xd297('0x85')]('Limited\x20Query:',_0x43f9bc[_0xd297('0x86')]());return dbH[_0xd297('0x87')]['query'](_0x43f9bc[_0xd297('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0xd297('0x88')]});}})[_0xd297('0x25')](respondWithResult(_0x18fcb,null))[_0xd297('0x49')](handleError(_0x18fcb,null));};function runReport(_0x8f20dd,_0x219d11,_0xddffec){var _0x4fdb9c=_0x219d11[_0xd297('0x2d')];var _0x4fc936=0xa;var _0x582ee4=[_0xd297('0x58'),_0xd297('0x89'),_0xd297('0x59'),_0xd297('0x5a')];var _0xfd378d={'SUM':_0xd297('0x5b'),'COUNT':_0xd297('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd297('0x5e'),'MIN':_0xd297('0x5f'),'AVG':_0xd297('0x60'),'GROUP_CONCAT':_0xd297('0x61'),'GROUP_CONCAT ASC':_0xd297('0x62'),'GROUP_CONCAT DESC':_0xd297('0x63')};var _0x5023a2={'SEC_TO_TIME':_0xd297('0x64'),'DATE':_0xd297('0x65'),'HOUR':_0xd297('0x8a'),'ROUND':_0xd297('0x66'),'UNIX_TIMESTAMP':_0xd297('0x8b')};var _0x5dbd44=function(_0x2d6790){return!_[_0xd297('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xd297('0x69'),_0xd297('0x6a')],_0x2d6790);};var _0x101fba=function(_0x46de6b){if(!_0x46de6b||!_0x46de6b[_0xd297('0x6b')]['length']){return'';}for(var _0x4a0e8c='(',_0x5df5b1=0x0;_0x5df5b1<_0x46de6b['rules'][_0xd297('0x3b')];_0x5df5b1+=0x1){_0x5df5b1>0x0&&(_0x4a0e8c+='\x20'+_0x46de6b[_0xd297('0x6c')]+'\x20');_0x4a0e8c+=_0x46de6b[_0xd297('0x6b')][_0x5df5b1]['group']?_0x101fba(_0x46de6b[_0xd297('0x6b')][_0x5df5b1]['group']):_0x46de6b[_0xd297('0x6b')][_0x5df5b1][_0xd297('0x6e')]+'\x20'+_0x46de6b[_0xd297('0x6b')][_0x5df5b1]['condition']+(_0x5dbd44(_0x46de6b[_0xd297('0x6b')][_0x5df5b1][_0xd297('0x8c')])?'\x20'+_0x46de6b[_0xd297('0x6b')][_0x5df5b1][_0xd297('0x6f')]:'');}return _0x4a0e8c+')';};var _0xdf8e95={'where':{'id':_0x8f20dd['id']}},_0x1037d5,_0xf7f559,_0x371d1a,_0x24f882,_0x1d5240;_0xdf8e95=_['merge']({},_0xdf8e95,_0xddffec);return db['AnalyticCustomReport'][_0xd297('0x4c')](_0xdf8e95)['then'](function(_0x16bbf5){if(_0x16bbf5){_0x1037d5=_0x16bbf5;return _0x16bbf5[_0xd297('0x70')]();}return null;})['then'](function(_0x4b805b){if(_0x4b805b){if(!_0x4b805b[_0xd297('0x3b')]){throw new db[(_0xd297('0x71'))][(_0xd297('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf7f559=_0x4b805b;return db[_0xd297('0x74')][_0xd297('0x47')]({'raw':!![]});}return null;})[_0xd297('0x25')](function(_0x40937f){if(_0x40937f){_0x371d1a=_['keyBy'](_0x40937f,'id');var _0x21920e;var _0x2f8cdb=squel[_0xd297('0x76')]();_0x2f8cdb['from'](_0x1037d5['table']);for(var _0x15aace=0x0;_0x15aace<_0xf7f559[_0xd297('0x3b')];_0x15aace+=0x1){_0x21920e=_0xf7f559[_0x15aace][_0xd297('0x78')]?_0x371d1a[_0xf7f559[_0x15aace][_0xd297('0x78')]][_0xd297('0x8d')]:_0xf7f559[_0x15aace][_0xd297('0x6e')];_0x21920e=_0xf7f559[_0x15aace][_0xd297('0x79')]?_[_0xd297('0x7a')](_0xfd378d[_0xf7f559[_0x15aace][_0xd297('0x79')]],'%s',_0x21920e):_0x21920e;_0x21920e=_0xf7f559[_0x15aace][_0xd297('0x7b')]?_['replace'](_0x5023a2[_0xf7f559[_0x15aace][_0xd297('0x7b')]],'%s',_0x21920e):_0x21920e;if(_0xf7f559[_0x15aace][_0xd297('0x8e')]){_0x2f8cdb[_0xd297('0x6d')](_0x21920e);}_0xf7f559[_0x15aace][_0xd297('0x7c')]&&_0x2f8cdb[_0xd297('0x3d')](_0x21920e,_0xf7f559[_0x15aace]['orderBy']===_0xd297('0x7d')?![]:!![]);_0x2f8cdb['field'](_0x21920e,_0xf7f559[_0x15aace][_0xd297('0x7e')]||_0x21920e);}if(_0x1037d5[_0xd297('0x80')]){_0x1037d5[_0xd297('0x80')]=JSON[_0xd297('0x7f')](_0x1037d5[_0xd297('0x80')]);for(var _0x549a74=0x0;_0x549a74<_0x1037d5[_0xd297('0x80')][_0xd297('0x3b')];_0x549a74+=0x1){if(_0x1037d5[_0xd297('0x80')][_0x549a74][_0xd297('0x33')]&&_['includes'](_0x582ee4,_0x1037d5['joins'][_0x549a74][_0xd297('0x33')])&&_0x1037d5[_0xd297('0x80')][_0x549a74]['parentKey']&&_0x1037d5['joins'][_0x549a74][_0xd297('0x82')]&&_0x1037d5[_0xd297('0x80')][_0x549a74]['foreignKey']){_0x2f8cdb[_0x1037d5[_0xd297('0x80')][_0x549a74][_0xd297('0x33')]](_0x1037d5['joins'][_0x549a74][_0xd297('0x82')],null,util[_0xd297('0x7b')]('%s.%s\x20=\x20%s.%s',_0x1037d5[_0xd297('0x8f')],_0x1037d5[_0xd297('0x80')][_0x549a74][_0xd297('0x81')],_0x1037d5['joins'][_0x549a74][_0xd297('0x82')],_0x1037d5[_0xd297('0x80')][_0x549a74][_0xd297('0x83')]));}}}if(_0x1037d5[_0xd297('0x84')]){_0x1037d5[_0xd297('0x84')]=JSON[_0xd297('0x7f')](_0x1037d5[_0xd297('0x84')]);_0x2f8cdb['where'](_0x101fba(_0x1037d5[_0xd297('0x84')]['group']));}_0x1d5240=_0x2f8cdb[_0xd297('0x90')]();_0x2f8cdb[_0xd297('0x20')](_0x4fc936);_0x2f8cdb[_0xd297('0x1d')](0x0);return;}})['then'](function(){if(_0x219d11['output']===_0xd297('0x91')){return null;}var _0x27ab3d=_['merge'](_0x219d11,{'name':_0x219d11['fullPath']||_0x219d11[_0xd297('0x2d')]||_0x1037d5[_0xd297('0x2d')],'basename':_0x4fdb9c,'savename':util[_0xd297('0x7b')](_0xd297('0x92'),_0x219d11['name']||_0x1037d5['name'],require(_0xd297('0x93'))[_0xd297('0x94')](0x4),_0x219d11[_0xd297('0x95')]||_0xd297('0x96')),'reportId':_0x1037d5['id'],'reportType':_0xd297('0x97')});return db[_0xd297('0x98')][_0xd297('0x4d')](_0x27ab3d,{'raw':!![]});})['then'](function(_0x29f561){if(_0x1037d5[_0xd297('0x8f')]===_0xd297('0x99')){_0x1d5240[_0xd297('0x3f')](_0x1037d5[_0xd297('0x8f')]+_0xd297('0x9a'),_0x219d11[_0xd297('0x9b')],_0x219d11[_0xd297('0x9c')]);}else{_0x1d5240[_0xd297('0x3f')](_0x1037d5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x219d11[_0xd297('0x9b')],_0x219d11[_0xd297('0x9c')]);}if(_0x29f561){logger['info']('Run\x20Query:',_0x1d5240['toString']());require(_0xd297('0x9d'))['fork'](path['join'](__dirname,'../../components/export/',_0x29f561[_0xd297('0x95')]),[_0x29f561['id'],_0x1d5240['toString'](),path[_0xd297('0x58')](__dirname,_0xd297('0x9e'),_0x29f561['savename']),_0x4fdb9c]);return _0x29f561;}else{var _0x5bd561=squel[_0xd297('0x76')]();_0x5bd561[_0xd297('0x77')]('('+_0x1d5240[_0xd297('0x86')]()+')',_0xd297('0x9f'));_0x5bd561[_0xd297('0x6e')](_0xd297('0xa0'),'count');_0x1d5240[_0xd297('0x20')](_0x219d11['limit']||_0x4fc936);_0x1d5240[_0xd297('0x1d')](_0x219d11[_0xd297('0x1d')]||0x0);return dbH['sequelize'][_0xd297('0x35')](_0x5bd561[_0xd297('0x86')](),{'type':dbH[_0xd297('0x87')][_0xd297('0xa1')][_0xd297('0x88')]})[_0xd297('0x25')](function(_0x20d406){if(!_0x20d406['length']){_0x24f882=0x0;}else{_0x24f882=_0x20d406[0x0][_0xd297('0x1f')]||0x0;}return dbH[_0xd297('0x87')][_0xd297('0x35')](_0x1d5240[_0xd297('0x86')](),{'type':dbH[_0xd297('0x87')][_0xd297('0xa1')][_0xd297('0x88')]});})[_0xd297('0x25')](function(_0x8fcb0b){return{'rows':_0x8fcb0b||[],'count':_0x24f882};});}});}exports[_0xd297('0xa2')]=function(_0x4ee855,_0x33688e){return runReport(_0x4ee855[_0xd297('0x4a')],_0x4ee855['query'],_0x4ee855[_0xd297('0x44')])[_0xd297('0x25')](respondWithResult(_0x33688e,null))[_0xd297('0x49')](handleError(_0x33688e,null));};exports[_0xd297('0xa3')]=runReport;exports[_0xd297('0x35')]=function(_0x247be4,_0x2b7646){var _0x3f69f3=0xa;var _0x2232db=[_0xd297('0x58'),_0xd297('0x89'),_0xd297('0x59'),_0xd297('0x5a')];var _0x5824b7={'SUM':_0xd297('0x5b'),'COUNT':_0xd297('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xd297('0x5f'),'AVG':_0xd297('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd297('0x62'),'GROUP_CONCAT DESC':_0xd297('0x63')};var _0x376286={'SEC_TO_TIME':_0xd297('0x64'),'DATE':_0xd297('0x65'),'HOUR':_0xd297('0x8a'),'ROUND':_0xd297('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1f4204=function(_0x4e6050){return!_[_0xd297('0x67')]([_0xd297('0x68'),_0xd297('0xa4'),_0xd297('0x69'),_0xd297('0x6a')],_0x4e6050);};var _0x35e175=function(_0x1bc287){if(!_0x1bc287||!_0x1bc287['rules'][_0xd297('0x3b')]){return'';}for(var _0x5a009d='(',_0x4a898d=0x0;_0x4a898d<_0x1bc287[_0xd297('0x6b')]['length'];_0x4a898d+=0x1){_0x4a898d>0x0&&(_0x5a009d+='\x20'+_0x1bc287[_0xd297('0x6c')]+'\x20');_0x5a009d+=_0x1bc287[_0xd297('0x6b')][_0x4a898d][_0xd297('0x6d')]?_0x35e175(_0x1bc287['rules'][_0x4a898d]['group']):_0x1bc287[_0xd297('0x6b')][_0x4a898d]['field']+'\x20'+_0x1bc287[_0xd297('0x6b')][_0x4a898d]['condition']+(_0x1f4204(_0x1bc287[_0xd297('0x6b')][_0x4a898d][_0xd297('0x8c')])?'\x20'+_0x1bc287[_0xd297('0x6b')][_0x4a898d][_0xd297('0x6f')]:'');}return _0x5a009d+')';};var _0x233985={'where':{'id':_0x247be4[_0xd297('0x4a')]['id']}},_0x3ffda1,_0x2cc939,_0x265537,_0x102535,_0x33849f;_0x233985=_[_0xd297('0x42')]({},_0x233985,_0x247be4[_0xd297('0x44')]);return db[_0xd297('0x45')]['find'](_0x233985)[_0xd297('0x25')](function(_0x2704f6){if(_0x2704f6){_0x3ffda1=_0x2704f6;return _0x2704f6[_0xd297('0x70')]();}return null;})[_0xd297('0x25')](function(_0x547682){if(_0x547682){if(!_0x547682[_0xd297('0x3b')]){throw new db[(_0xd297('0x71'))][(_0xd297('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2cc939=_0x547682;return db[_0xd297('0x74')][_0xd297('0x47')]({'raw':!![]});}return null;})['then'](function(_0x163ea5){if(_0x163ea5){_0x265537=_[_0xd297('0x75')](_0x163ea5,'id');var _0x3c08b9;var _0x5bc15f=squel[_0xd297('0x76')]();_0x5bc15f[_0xd297('0x77')](_0x3ffda1[_0xd297('0x8f')]);for(var _0x3e340d=0x0;_0x3e340d<_0x2cc939[_0xd297('0x3b')];_0x3e340d+=0x1){_0x3c08b9=_0x2cc939[_0x3e340d][_0xd297('0x78')]?_0x265537[_0x2cc939[_0x3e340d][_0xd297('0x78')]][_0xd297('0x8d')]:_0x2cc939[_0x3e340d][_0xd297('0x6e')];_0x3c08b9=_0x2cc939[_0x3e340d][_0xd297('0x79')]?_[_0xd297('0x7a')](_0x5824b7[_0x2cc939[_0x3e340d][_0xd297('0x79')]],'%s',_0x3c08b9):_0x3c08b9;_0x3c08b9=_0x2cc939[_0x3e340d][_0xd297('0x7b')]?_[_0xd297('0x7a')](_0x376286[_0x2cc939[_0x3e340d][_0xd297('0x7b')]],'%s',_0x3c08b9):_0x3c08b9;if(_0x2cc939[_0x3e340d][_0xd297('0x8e')]){_0x5bc15f[_0xd297('0x6d')](_0x3c08b9);}_0x2cc939[_0x3e340d][_0xd297('0x7c')]&&_0x5bc15f[_0xd297('0x3d')](_0x3c08b9,_0x2cc939[_0x3e340d][_0xd297('0x7c')]==='DESC'?![]:!![]);_0x5bc15f[_0xd297('0x6e')](_0x3c08b9,_0x2cc939[_0x3e340d][_0xd297('0x7e')]||_0x3c08b9);}if(_0x3ffda1[_0xd297('0x80')]){_0x3ffda1['joins']=JSON[_0xd297('0x7f')](_0x3ffda1[_0xd297('0x80')]);for(var _0xec0771=0x0;_0xec0771<_0x3ffda1[_0xd297('0x80')]['length'];_0xec0771+=0x1){if(_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x33')]&&_['includes'](_0x2232db,_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x33')])&&_0x3ffda1['joins'][_0xec0771][_0xd297('0x81')]&&_0x3ffda1['joins'][_0xec0771][_0xd297('0x82')]&&_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x83')]){_0x5bc15f[_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x33')]](_0x3ffda1['joins'][_0xec0771][_0xd297('0x82')],null,util[_0xd297('0x7b')](_0xd297('0xa5'),_0x3ffda1[_0xd297('0x8f')],_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x81')],_0x3ffda1[_0xd297('0x80')][_0xec0771][_0xd297('0x82')],_0x3ffda1['joins'][_0xec0771][_0xd297('0x83')]));}}}if(_0x3ffda1[_0xd297('0x84')]){_0x3ffda1[_0xd297('0x84')]=JSON[_0xd297('0x7f')](_0x3ffda1[_0xd297('0x84')]);_0x5bc15f[_0xd297('0x3f')](_0x35e175(_0x3ffda1[_0xd297('0x84')][_0xd297('0x6d')]));}_0x33849f=_0x5bc15f[_0xd297('0x90')]();_0x5bc15f[_0xd297('0x20')](_0x3f69f3);_0x5bc15f['offset'](0x0);logger[_0xd297('0x85')](_0xd297('0xa6'),_0x5bc15f[_0xd297('0x86')]());return dbH[_0xd297('0x87')][_0xd297('0x35')](_0x5bc15f[_0xd297('0x86')](),{'type':dbH[_0xd297('0x87')]['QueryTypes'][_0xd297('0x88')]});}})['then'](function(){return{'sql':_0x33849f[_0xd297('0x86')]()};})[_0xd297('0x25')](respondWithResult(_0x2b7646,null))[_0xd297('0x49')](handleError(_0x2b7646,null));}; \ No newline at end of file +var _0x0a19=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','orderBy','order','output','fullPath','%s-%s.%s','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','alias','eml-format','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/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','undefined','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','pick','filters','where','merge','filter','AnalyticCustomReport','count','includeAll','findAll','rows','catch','keys','include','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','body','params','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x0a19,0xf2));var _0x90a1=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x0a19[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0x90a1('0x0'));var rimraf=require(_0x90a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90a1('0x2'));var rp=require(_0x90a1('0x3'));var moment=require(_0x90a1('0x4'));var BPromise=require(_0x90a1('0x5'));var Mustache=require('mustache');var util=require(_0x90a1('0x6'));var path=require(_0x90a1('0x7'));var sox=require(_0x90a1('0x8'));var csv=require(_0x90a1('0x9'));var ejs=require(_0x90a1('0xa'));var fs=require('fs');var fs_extra=require(_0x90a1('0xb'));var _=require(_0x90a1('0xc'));var squel=require(_0x90a1('0xd'));var crypto=require(_0x90a1('0xe'));var jsforce=require(_0x90a1('0xf'));var deskjs=require(_0x90a1('0x10'));var toCsv=require(_0x90a1('0x9'));var querystring=require(_0x90a1('0x11'));var Papa=require(_0x90a1('0x12'));var Redis=require(_0x90a1('0x13'));var authService=require(_0x90a1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x90a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90a1('0x16'))(_0x90a1('0x17'));var utils=require(_0x90a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x90a1('0x19'));var db=require(_0x90a1('0x1a'))['db'];var dbH=require(_0x90a1('0x1a'))[_0x90a1('0x1b')];function respondWithStatusCode(_0x1d0cc3,_0x1441a3){_0x1441a3=_0x1441a3||0xcc;return function(_0xcd86c8){if(_0xcd86c8){return _0x1d0cc3[_0x90a1('0x1c')](_0x1441a3);}return _0x1d0cc3[_0x90a1('0x1d')](_0x1441a3)[_0x90a1('0x1e')]();};}function respondWithResult(_0x32ed15,_0x1307d4){_0x1307d4=_0x1307d4||0xc8;return function(_0x27bd91){if(_0x27bd91){return _0x32ed15[_0x90a1('0x1d')](_0x1307d4)['json'](_0x27bd91);}};}function respondWithFilteredResult(_0xe5450,_0x1690c0){return function(_0x22d7cd){if(_0x22d7cd){var _0x50fd5f=typeof _0x1690c0['offset']===_0x90a1('0x1f')&&typeof _0x1690c0['limit']==='undefined';var _0x2757a4=_0x22d7cd['count'];var _0x308eb7=_0x50fd5f?0x0:_0x1690c0[_0x90a1('0x20')];var _0x6ce4c0=_0x50fd5f?_0x22d7cd['count']:_0x1690c0[_0x90a1('0x20')]+_0x1690c0[_0x90a1('0x21')];var _0x3454a3;if(_0x6ce4c0>=_0x2757a4){_0x6ce4c0=_0x2757a4;_0x3454a3=0xc8;}else{_0x3454a3=0xce;}_0xe5450[_0x90a1('0x1d')](_0x3454a3);return _0xe5450[_0x90a1('0x22')](_0x90a1('0x23'),_0x308eb7+'-'+_0x6ce4c0+'/'+_0x2757a4)[_0x90a1('0x24')](_0x22d7cd);}return null;};}function patchUpdates(_0x5a80c5){return function(_0x362c0c){try{jsonpatch[_0x90a1('0x25')](_0x362c0c,_0x5a80c5,!![]);}catch(_0x38c885){return BPromise[_0x90a1('0x26')](_0x38c885);}return _0x362c0c[_0x90a1('0x27')]();};}function saveUpdates(_0x5139cf,_0x59ba0f){return function(_0x5b2f43){if(_0x5b2f43){return _0x5b2f43[_0x90a1('0x28')](_0x5139cf)[_0x90a1('0x29')](function(_0x318549){return _0x318549;});}return null;};}function removeEntity(_0x48bb9b,_0x15727d){return function(_0x59ef85){if(_0x59ef85){return _0x59ef85[_0x90a1('0x2a')]()[_0x90a1('0x29')](function(){var _0xd84fd2=_0x59ef85[_0x90a1('0x2b')]({'plain':!![]});var _0x1cff6a=_0x90a1('0x2c');return db[_0x90a1('0x2d')][_0x90a1('0x2a')]({'where':{'type':_0x1cff6a,'resourceId':_0xd84fd2['id']}})[_0x90a1('0x29')](function(){return _0x59ef85;});})[_0x90a1('0x29')](function(){_0x48bb9b[_0x90a1('0x1d')](0xcc)[_0x90a1('0x1e')]();});}};}function handleEntityNotFound(_0x291728,_0x181487){return function(_0x8ab594){if(!_0x8ab594){_0x291728['sendStatus'](0x194);}return _0x8ab594;};}function handleError(_0x1a7119,_0x2aecf2){_0x2aecf2=_0x2aecf2||0x1f4;return function(_0x1468dc){logger[_0x90a1('0x2e')](_0x1468dc[_0x90a1('0x2f')]);if(_0x1468dc['name']){delete _0x1468dc[_0x90a1('0x30')];}_0x1a7119[_0x90a1('0x1d')](_0x2aecf2)[_0x90a1('0x31')](_0x1468dc);};}exports[_0x90a1('0x32')]=function(_0x21ad33,_0x161858){var _0x2b6f9a={},_0x11d6a9={},_0x31075d={'count':0x0,'rows':[]};var _0x132b25=_[_0x90a1('0x33')](db['AnalyticCustomReport']['rawAttributes'],function(_0x343618){return{'name':_0x343618[_0x90a1('0x34')],'type':_0x343618[_0x90a1('0x35')][_0x90a1('0x36')]};});_0x11d6a9['model']=_[_0x90a1('0x33')](_0x132b25,_0x90a1('0x30'));_0x11d6a9[_0x90a1('0x37')]=_['keys'](_0x21ad33[_0x90a1('0x37')]);_0x11d6a9['filters']=_[_0x90a1('0x38')](_0x11d6a9[_0x90a1('0x39')],_0x11d6a9[_0x90a1('0x37')]);_0x2b6f9a[_0x90a1('0x3a')]=_['intersection'](_0x11d6a9[_0x90a1('0x39')],qs[_0x90a1('0x3b')](_0x21ad33[_0x90a1('0x37')][_0x90a1('0x3b')]));_0x2b6f9a[_0x90a1('0x3a')]=_0x2b6f9a[_0x90a1('0x3a')][_0x90a1('0x3c')]?_0x2b6f9a[_0x90a1('0x3a')]:_0x11d6a9[_0x90a1('0x39')];if(!_0x21ad33[_0x90a1('0x37')]['hasOwnProperty'](_0x90a1('0x3d'))){_0x2b6f9a['limit']=qs[_0x90a1('0x21')](_0x21ad33[_0x90a1('0x37')]['limit']);_0x2b6f9a['offset']=qs[_0x90a1('0x20')](_0x21ad33[_0x90a1('0x37')][_0x90a1('0x20')]);}_0x2b6f9a['order']=qs[_0x90a1('0x3e')](_0x21ad33['query']['sort']);_0x2b6f9a['where']=qs['filters'](_[_0x90a1('0x3f')](_0x21ad33[_0x90a1('0x37')],_0x11d6a9[_0x90a1('0x40')]),_0x132b25);if(_0x21ad33[_0x90a1('0x37')]['filter']){_0x2b6f9a[_0x90a1('0x41')]=_[_0x90a1('0x42')](_0x2b6f9a['where'],{'$or':_['map'](_0x132b25,function(_0x37e0da){if(_0x37e0da[_0x90a1('0x35')]!=='VIRTUAL'){var _0x5d88ce={};_0x5d88ce[_0x37e0da[_0x90a1('0x30')]]={'$like':'%'+_0x21ad33['query'][_0x90a1('0x43')]+'%'};return _0x5d88ce;}})});}_0x2b6f9a=_[_0x90a1('0x42')]({},_0x2b6f9a,_0x21ad33['options']);var _0x35379e={'where':_0x2b6f9a['where']};return db[_0x90a1('0x44')][_0x90a1('0x45')](_0x35379e)['then'](function(_0x5c2ff7){_0x31075d[_0x90a1('0x45')]=_0x5c2ff7;if(_0x21ad33['query'][_0x90a1('0x46')]){_0x2b6f9a['include']=[{'all':!![]}];}return db[_0x90a1('0x44')][_0x90a1('0x47')](_0x2b6f9a);})[_0x90a1('0x29')](function(_0x50c117){_0x31075d[_0x90a1('0x48')]=_0x50c117;return _0x31075d;})[_0x90a1('0x29')](respondWithFilteredResult(_0x161858,_0x2b6f9a))[_0x90a1('0x49')](handleError(_0x161858,null));};exports['show']=function(_0x178796,_0x449db4){var _0x5c6c13={'raw':![],'where':{'id':_0x178796['params']['id']}},_0x2cb328={};_0x2cb328[_0x90a1('0x39')]=_[_0x90a1('0x4a')](db[_0x90a1('0x44')]['rawAttributes']);_0x2cb328[_0x90a1('0x37')]=_[_0x90a1('0x4a')](_0x178796[_0x90a1('0x37')]);_0x2cb328['filters']=_[_0x90a1('0x38')](_0x2cb328[_0x90a1('0x39')],_0x2cb328[_0x90a1('0x37')]);_0x5c6c13['attributes']=_[_0x90a1('0x38')](_0x2cb328[_0x90a1('0x39')],qs['fields'](_0x178796[_0x90a1('0x37')]['fields']));_0x5c6c13[_0x90a1('0x3a')]=_0x5c6c13['attributes'][_0x90a1('0x3c')]?_0x5c6c13['attributes']:_0x2cb328[_0x90a1('0x39')];if(_0x178796[_0x90a1('0x37')][_0x90a1('0x46')]){_0x5c6c13[_0x90a1('0x4b')]=[{'all':!![]}];}_0x5c6c13=_[_0x90a1('0x42')]({},_0x5c6c13,_0x178796[_0x90a1('0x4c')]);return db[_0x90a1('0x44')]['find'](_0x5c6c13)[_0x90a1('0x29')](handleEntityNotFound(_0x449db4,null))[_0x90a1('0x29')](respondWithResult(_0x449db4,null))[_0x90a1('0x49')](handleError(_0x449db4,null));};exports['create']=function(_0x179bf5,_0x4eeeb1){return db[_0x90a1('0x44')]['create'](_0x179bf5['body'],{})[_0x90a1('0x29')](function(_0x16de43){var _0x333ee6=_0x179bf5[_0x90a1('0x4d')][_0x90a1('0x2b')]({'plain':!![]});if(!_0x333ee6)throw new Error(_0x90a1('0x4e'));if(_0x333ee6[_0x90a1('0x4f')]===_0x90a1('0x4d')){var _0x41ceec=_0x16de43[_0x90a1('0x2b')]({'plain':!![]});var _0x369f2b=_0x90a1('0x50');return db[_0x90a1('0x51')][_0x90a1('0x52')]({'where':{'name':_0x369f2b,'userProfileId':_0x333ee6[_0x90a1('0x53')]},'raw':!![]})[_0x90a1('0x29')](function(_0x678f00){if(_0x678f00&&_0x678f00[_0x90a1('0x54')]===0x0){return db[_0x90a1('0x2d')]['create']({'name':_0x41ceec['name'],'resourceId':_0x41ceec['id'],'type':_0x90a1('0x2c'),'sectionId':_0x678f00['id']},{})[_0x90a1('0x29')](function(){return _0x16de43;});}else{return _0x16de43;}})[_0x90a1('0x49')](function(_0x510067){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x510067);throw _0x510067;});}return _0x16de43;})[_0x90a1('0x29')](respondWithResult(_0x4eeeb1,0xc9))['catch'](handleError(_0x4eeeb1,null));};exports[_0x90a1('0x28')]=function(_0x1130af,_0x488f2a){if(_0x1130af[_0x90a1('0x55')]['id']){delete _0x1130af[_0x90a1('0x55')]['id'];}return db[_0x90a1('0x44')][_0x90a1('0x52')]({'where':{'id':_0x1130af['params']['id']}})[_0x90a1('0x29')](handleEntityNotFound(_0x488f2a,null))[_0x90a1('0x29')](saveUpdates(_0x1130af[_0x90a1('0x55')],null))[_0x90a1('0x29')](respondWithResult(_0x488f2a,null))[_0x90a1('0x49')](handleError(_0x488f2a,null));};exports[_0x90a1('0x2a')]=function(_0x5a26e5,_0xf164bc){return db['AnalyticCustomReport'][_0x90a1('0x52')]({'where':{'id':_0x5a26e5[_0x90a1('0x56')]['id']}})[_0x90a1('0x29')](handleEntityNotFound(_0xf164bc,null))[_0x90a1('0x29')](removeEntity(_0xf164bc,null))[_0x90a1('0x49')](handleError(_0xf164bc,null));};exports[_0x90a1('0x57')]=function(_0x5939c4,_0x51cc1b){var _0x201a24=0xa;var _0x4beae0=['join',_0x90a1('0x58'),_0x90a1('0x59'),_0x90a1('0x5a')];var _0x2f0e94={'SUM':_0x90a1('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x90a1('0x5c'),'MIN':_0x90a1('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x90a1('0x5e'),'GROUP_CONCAT DESC':_0x90a1('0x5f')};var _0x310750={'SEC_TO_TIME':_0x90a1('0x60'),'DATE':_0x90a1('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x90a1('0x62')};var _0x224d4a=function(_0x5cf544){return!_[_0x90a1('0x63')]([_0x90a1('0x64'),_0x90a1('0x65'),_0x90a1('0x66'),_0x90a1('0x67')],_0x5cf544);};var _0x4fd883=function(_0x580239){if(!_0x580239||!_0x580239[_0x90a1('0x68')][_0x90a1('0x3c')]){return'';}for(var _0x8e4d0='(',_0x30e67a=0x0;_0x30e67a<_0x580239['rules']['length'];_0x30e67a+=0x1){_0x30e67a>0x0&&(_0x8e4d0+='\x20'+_0x580239[_0x90a1('0x69')]+'\x20');_0x8e4d0+=_0x580239[_0x90a1('0x68')][_0x30e67a]['group']?_0x4fd883(_0x580239[_0x90a1('0x68')][_0x30e67a][_0x90a1('0x6a')]):_0x580239[_0x90a1('0x68')][_0x30e67a][_0x90a1('0x6b')]+'\x20'+_0x580239[_0x90a1('0x68')][_0x30e67a][_0x90a1('0x6c')]+(_0x224d4a(_0x580239[_0x90a1('0x68')][_0x30e67a][_0x90a1('0x6c')])?'\x20'+_0x580239[_0x90a1('0x68')][_0x30e67a][_0x90a1('0x6d')]:'');}return _0x8e4d0+')';};var _0x46f01d={'where':{'id':_0x5939c4['params']['id']}},_0x1625f0,_0x5d2c41,_0x54654a,_0x467403,_0x53376e;_0x46f01d=_[_0x90a1('0x42')]({},_0x46f01d,_0x5939c4[_0x90a1('0x4c')]);return db['AnalyticCustomReport'][_0x90a1('0x52')](_0x46f01d)[_0x90a1('0x29')](function(_0x2fee6f){if(_0x2fee6f){_0x1625f0=_0x2fee6f;return _0x2fee6f[_0x90a1('0x6e')]();}return null;})[_0x90a1('0x29')](function(_0x370ec4){if(_0x370ec4){if(!_0x370ec4['length']){throw new db[(_0x90a1('0x6f'))][(_0x90a1('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5d2c41=_0x370ec4;return db[_0x90a1('0x71')][_0x90a1('0x47')]({'raw':!![]});}return null;})['then'](function(_0x4bbb70){if(_0x4bbb70){_0x54654a=_[_0x90a1('0x72')](_0x4bbb70,'id');var _0x14de59;var _0x2af42b=squel[_0x90a1('0x73')]();_0x2af42b[_0x90a1('0x74')](_0x1625f0[_0x90a1('0x75')]);for(var _0x357e7e=0x0;_0x357e7e<_0x5d2c41[_0x90a1('0x3c')];_0x357e7e+=0x1){_0x14de59=_0x5d2c41[_0x357e7e][_0x90a1('0x76')]?_0x54654a[_0x5d2c41[_0x357e7e][_0x90a1('0x76')]][_0x90a1('0x77')]:_0x5d2c41[_0x357e7e][_0x90a1('0x6b')];_0x14de59=_0x5d2c41[_0x357e7e][_0x90a1('0x78')]?_[_0x90a1('0x79')](_0x2f0e94[_0x5d2c41[_0x357e7e][_0x90a1('0x78')]],'%s',_0x14de59):_0x14de59;_0x14de59=_0x5d2c41[_0x357e7e]['format']?_[_0x90a1('0x79')](_0x310750[_0x5d2c41[_0x357e7e]['format']],'%s',_0x14de59):_0x14de59;if(_0x5d2c41[_0x357e7e][_0x90a1('0x7a')]){_0x2af42b[_0x90a1('0x6a')](_0x14de59);}_0x5d2c41[_0x357e7e]['orderBy']&&_0x2af42b['order'](_0x14de59,_0x5d2c41[_0x357e7e]['orderBy']===_0x90a1('0x7b')?![]:!![]);_0x2af42b[_0x90a1('0x6b')](_0x14de59,_0x5d2c41[_0x357e7e]['alias']||_0x14de59);}if(_0x1625f0[_0x90a1('0x7c')]){_0x1625f0['joins']=JSON[_0x90a1('0x7d')](_0x1625f0[_0x90a1('0x7c')]);for(var _0x90ec9a=0x0;_0x90ec9a<_0x1625f0['joins'][_0x90a1('0x3c')];_0x90ec9a+=0x1){if(_0x1625f0['joins'][_0x90ec9a][_0x90a1('0x35')]&&_['includes'](_0x4beae0,_0x1625f0[_0x90a1('0x7c')][_0x90ec9a]['type'])&&_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x7e')]&&_0x1625f0[_0x90a1('0x7c')][_0x90ec9a]['foreignTable']&&_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x7f')]){_0x2af42b[_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x35')]](_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x80')],null,util[_0x90a1('0x81')](_0x90a1('0x82'),_0x1625f0[_0x90a1('0x75')],_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x7e')],_0x1625f0[_0x90a1('0x7c')][_0x90ec9a][_0x90a1('0x80')],_0x1625f0['joins'][_0x90ec9a]['foreignKey']));}}}if(_0x1625f0['conditions']){_0x1625f0[_0x90a1('0x83')]=JSON[_0x90a1('0x7d')](_0x1625f0[_0x90a1('0x83')]);_0x2af42b[_0x90a1('0x41')](_0x4fd883(_0x1625f0[_0x90a1('0x83')][_0x90a1('0x6a')]));}_0x53376e=_0x2af42b[_0x90a1('0x84')]();_0x2af42b[_0x90a1('0x21')](_0x201a24);_0x2af42b[_0x90a1('0x20')](0x0);logger[_0x90a1('0x85')](_0x90a1('0x86'),_0x2af42b['toString']());return dbH[_0x90a1('0x87')]['query'](_0x2af42b[_0x90a1('0x88')](),{'type':dbH[_0x90a1('0x87')][_0x90a1('0x89')][_0x90a1('0x8a')]});}})['then'](respondWithResult(_0x51cc1b,null))[_0x90a1('0x49')](handleError(_0x51cc1b,null));};function runReport(_0xbe3f77,_0x4afcd9,_0xf1d998){var _0x396a47=_0x4afcd9[_0x90a1('0x30')];var _0x52c597=0xa;var _0x2c6cac=[_0x90a1('0x8b'),'left_join',_0x90a1('0x59'),_0x90a1('0x5a')];var _0x52c2e1={'SUM':'SUM(%s)','COUNT':_0x90a1('0x8c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x90a1('0x5c'),'MIN':'MIN(%s)','AVG':_0x90a1('0x8d'),'GROUP_CONCAT':_0x90a1('0x8e'),'GROUP_CONCAT ASC':_0x90a1('0x5e'),'GROUP_CONCAT DESC':_0x90a1('0x5f')};var _0xc7390f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x90a1('0x61'),'HOUR':_0x90a1('0x8f'),'ROUND':_0x90a1('0x90'),'UNIX_TIMESTAMP':_0x90a1('0x62')};var _0x8350d5=function(_0x1edb37){return!_[_0x90a1('0x63')]([_0x90a1('0x64'),_0x90a1('0x65'),_0x90a1('0x66'),_0x90a1('0x67')],_0x1edb37);};var _0x1c6f68=function(_0x429623){if(!_0x429623||!_0x429623[_0x90a1('0x68')]['length']){return'';}for(var _0xf9938f='(',_0x413aad=0x0;_0x413aad<_0x429623[_0x90a1('0x68')][_0x90a1('0x3c')];_0x413aad+=0x1){_0x413aad>0x0&&(_0xf9938f+='\x20'+_0x429623[_0x90a1('0x69')]+'\x20');_0xf9938f+=_0x429623['rules'][_0x413aad][_0x90a1('0x6a')]?_0x1c6f68(_0x429623['rules'][_0x413aad][_0x90a1('0x6a')]):_0x429623['rules'][_0x413aad]['field']+'\x20'+_0x429623['rules'][_0x413aad]['condition']+(_0x8350d5(_0x429623[_0x90a1('0x68')][_0x413aad][_0x90a1('0x6c')])?'\x20'+_0x429623[_0x90a1('0x68')][_0x413aad][_0x90a1('0x6d')]:'');}return _0xf9938f+')';};var _0x270bc3={'where':{'id':_0xbe3f77['id']}},_0x36e7d4,_0x552526,_0x2ec9b7,_0x337655,_0x403824;_0x270bc3=_[_0x90a1('0x42')]({},_0x270bc3,_0xf1d998);return db['AnalyticCustomReport'][_0x90a1('0x52')](_0x270bc3)[_0x90a1('0x29')](function(_0x5365){if(_0x5365){_0x36e7d4=_0x5365;return _0x5365[_0x90a1('0x6e')]();}return null;})[_0x90a1('0x29')](function(_0x4dc873){if(_0x4dc873){if(!_0x4dc873[_0x90a1('0x3c')]){throw new db[(_0x90a1('0x6f'))][(_0x90a1('0x70'))](_0x90a1('0x91'),0x193);}_0x552526=_0x4dc873;return db[_0x90a1('0x71')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5ecb42){if(_0x5ecb42){_0x2ec9b7=_['keyBy'](_0x5ecb42,'id');var _0xbce4a8;var _0x2c4923=squel['select']();_0x2c4923['from'](_0x36e7d4[_0x90a1('0x75')]);for(var _0x3301e2=0x0;_0x3301e2<_0x552526[_0x90a1('0x3c')];_0x3301e2+=0x1){_0xbce4a8=_0x552526[_0x3301e2][_0x90a1('0x76')]?_0x2ec9b7[_0x552526[_0x3301e2][_0x90a1('0x76')]][_0x90a1('0x77')]:_0x552526[_0x3301e2][_0x90a1('0x6b')];_0xbce4a8=_0x552526[_0x3301e2][_0x90a1('0x78')]?_[_0x90a1('0x79')](_0x52c2e1[_0x552526[_0x3301e2]['function']],'%s',_0xbce4a8):_0xbce4a8;_0xbce4a8=_0x552526[_0x3301e2][_0x90a1('0x81')]?_['replace'](_0xc7390f[_0x552526[_0x3301e2][_0x90a1('0x81')]],'%s',_0xbce4a8):_0xbce4a8;if(_0x552526[_0x3301e2][_0x90a1('0x7a')]){_0x2c4923['group'](_0xbce4a8);}_0x552526[_0x3301e2][_0x90a1('0x92')]&&_0x2c4923[_0x90a1('0x93')](_0xbce4a8,_0x552526[_0x3301e2]['orderBy']==='DESC'?![]:!![]);_0x2c4923[_0x90a1('0x6b')](_0xbce4a8,_0x552526[_0x3301e2]['alias']||_0xbce4a8);}if(_0x36e7d4[_0x90a1('0x7c')]){_0x36e7d4[_0x90a1('0x7c')]=JSON[_0x90a1('0x7d')](_0x36e7d4[_0x90a1('0x7c')]);for(var _0x42ab7b=0x0;_0x42ab7b<_0x36e7d4[_0x90a1('0x7c')]['length'];_0x42ab7b+=0x1){if(_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x35')]&&_[_0x90a1('0x63')](_0x2c6cac,_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x35')])&&_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x7e')]&&_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x80')]&&_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x7f')]){_0x2c4923[_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b]['type']](_0x36e7d4['joins'][_0x42ab7b][_0x90a1('0x80')],null,util[_0x90a1('0x81')]('%s.%s\x20=\x20%s.%s',_0x36e7d4[_0x90a1('0x75')],_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x7e')],_0x36e7d4['joins'][_0x42ab7b][_0x90a1('0x80')],_0x36e7d4[_0x90a1('0x7c')][_0x42ab7b][_0x90a1('0x7f')]));}}}if(_0x36e7d4[_0x90a1('0x83')]){_0x36e7d4[_0x90a1('0x83')]=JSON['parse'](_0x36e7d4[_0x90a1('0x83')]);_0x2c4923[_0x90a1('0x41')](_0x1c6f68(_0x36e7d4[_0x90a1('0x83')][_0x90a1('0x6a')]));}_0x403824=_0x2c4923[_0x90a1('0x84')]();_0x2c4923[_0x90a1('0x21')](_0x52c597);_0x2c4923['offset'](0x0);return;}})[_0x90a1('0x29')](function(){if(_0x4afcd9[_0x90a1('0x94')]==='web'){return null;}var _0x395e87=_['merge'](_0x4afcd9,{'name':_0x4afcd9[_0x90a1('0x95')]||_0x4afcd9[_0x90a1('0x30')]||_0x36e7d4[_0x90a1('0x30')],'basename':_0x396a47,'savename':util[_0x90a1('0x81')](_0x90a1('0x96'),_0x4afcd9[_0x90a1('0x30')]||_0x36e7d4[_0x90a1('0x30')],require('randomstring')['generate'](0x4),_0x4afcd9[_0x90a1('0x94')]||'csv'),'reportId':_0x36e7d4['id'],'reportType':_0x90a1('0x97')});return db[_0x90a1('0x98')]['create'](_0x395e87,{'raw':!![]});})[_0x90a1('0x29')](function(_0x565640){if(_0x36e7d4[_0x90a1('0x75')]===_0x90a1('0x99')){_0x403824[_0x90a1('0x41')](_0x36e7d4[_0x90a1('0x75')]+_0x90a1('0x9a'),_0x4afcd9['startDate'],_0x4afcd9[_0x90a1('0x9b')]);}else{_0x403824[_0x90a1('0x41')](_0x36e7d4[_0x90a1('0x75')]+_0x90a1('0x9c'),_0x4afcd9[_0x90a1('0x9d')],_0x4afcd9[_0x90a1('0x9b')]);}if(_0x565640){logger[_0x90a1('0x9e')](_0x90a1('0x9f'),_0x403824[_0x90a1('0x88')]());require(_0x90a1('0xa0'))[_0x90a1('0xa1')](path[_0x90a1('0x8b')](__dirname,_0x90a1('0xa2'),_0x565640[_0x90a1('0x94')]),[_0x565640['id'],_0x403824[_0x90a1('0x88')](),path['join'](__dirname,_0x90a1('0xa3'),_0x565640[_0x90a1('0xa4')]),_0x396a47]);return _0x565640;}else{var _0xcecf76=squel[_0x90a1('0x73')]();_0xcecf76[_0x90a1('0x74')]('('+_0x403824[_0x90a1('0x88')]()+')','countTable');_0xcecf76[_0x90a1('0x6b')](_0x90a1('0xa5'),_0x90a1('0x45'));_0x403824[_0x90a1('0x21')](_0x4afcd9['limit']||_0x52c597);_0x403824[_0x90a1('0x20')](_0x4afcd9[_0x90a1('0x20')]||0x0);return dbH[_0x90a1('0x87')][_0x90a1('0x37')](_0xcecf76[_0x90a1('0x88')](),{'type':dbH['sequelize'][_0x90a1('0x89')][_0x90a1('0x8a')]})[_0x90a1('0x29')](function(_0x3f21db){if(!_0x3f21db['length']){_0x337655=0x0;}else{_0x337655=_0x3f21db[0x0][_0x90a1('0x45')]||0x0;}return dbH[_0x90a1('0x87')][_0x90a1('0x37')](_0x403824[_0x90a1('0x88')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x90a1('0x29')](function(_0x1a23d9){return{'rows':_0x1a23d9||[],'count':_0x337655};});}});}exports[_0x90a1('0xa6')]=function(_0x50f915,_0x542bb4){return runReport(_0x50f915[_0x90a1('0x56')],_0x50f915[_0x90a1('0x37')],_0x50f915[_0x90a1('0x4c')])[_0x90a1('0x29')](respondWithResult(_0x542bb4,null))[_0x90a1('0x49')](handleError(_0x542bb4,null));};exports[_0x90a1('0xa7')]=runReport;exports[_0x90a1('0x37')]=function(_0x4a81ca,_0x3f7aec){var _0x1f91d1=0xa;var _0x4abf96=[_0x90a1('0x8b'),_0x90a1('0x58'),_0x90a1('0x59'),_0x90a1('0x5a')];var _0x4cc02d={'SUM':_0x90a1('0x5b'),'COUNT':_0x90a1('0x8c'),'COUNT DISTINCT':_0x90a1('0xa8'),'MAX':'MAX(%s)','MIN':_0x90a1('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x90a1('0x8e'),'GROUP_CONCAT ASC':_0x90a1('0x5e'),'GROUP_CONCAT DESC':_0x90a1('0x5f')};var _0x5b1b42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x90a1('0x90'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xe9a407=function(_0x21de28){return!_[_0x90a1('0x63')]([_0x90a1('0x64'),_0x90a1('0x65'),_0x90a1('0x66'),'IS\x20NOT\x20EMPTY'],_0x21de28);};var _0x2b2f34=function(_0x91369){if(!_0x91369||!_0x91369[_0x90a1('0x68')][_0x90a1('0x3c')]){return'';}for(var _0x139b7a='(',_0x2cd9f1=0x0;_0x2cd9f1<_0x91369[_0x90a1('0x68')]['length'];_0x2cd9f1+=0x1){_0x2cd9f1>0x0&&(_0x139b7a+='\x20'+_0x91369['operator']+'\x20');_0x139b7a+=_0x91369[_0x90a1('0x68')][_0x2cd9f1]['group']?_0x2b2f34(_0x91369['rules'][_0x2cd9f1][_0x90a1('0x6a')]):_0x91369[_0x90a1('0x68')][_0x2cd9f1][_0x90a1('0x6b')]+'\x20'+_0x91369['rules'][_0x2cd9f1]['condition']+(_0xe9a407(_0x91369[_0x90a1('0x68')][_0x2cd9f1]['condition'])?'\x20'+_0x91369[_0x90a1('0x68')][_0x2cd9f1][_0x90a1('0x6d')]:'');}return _0x139b7a+')';};var _0x1dc7e7={'where':{'id':_0x4a81ca['params']['id']}},_0x5054e8,_0x5a0095,_0x39f7f7,_0x26f903,_0x19caac;_0x1dc7e7=_[_0x90a1('0x42')]({},_0x1dc7e7,_0x4a81ca[_0x90a1('0x4c')]);return db[_0x90a1('0x44')][_0x90a1('0x52')](_0x1dc7e7)[_0x90a1('0x29')](function(_0x163b29){if(_0x163b29){_0x5054e8=_0x163b29;return _0x163b29[_0x90a1('0x6e')]();}return null;})[_0x90a1('0x29')](function(_0x236447){if(_0x236447){if(!_0x236447[_0x90a1('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x90a1('0x91'),0x193);}_0x5a0095=_0x236447;return db[_0x90a1('0x71')]['findAll']({'raw':!![]});}return null;})[_0x90a1('0x29')](function(_0x2cd258){if(_0x2cd258){_0x39f7f7=_[_0x90a1('0x72')](_0x2cd258,'id');var _0x4ce2fd;var _0x149e26=squel['select']();_0x149e26[_0x90a1('0x74')](_0x5054e8[_0x90a1('0x75')]);for(var _0x247cae=0x0;_0x247cae<_0x5a0095['length'];_0x247cae+=0x1){_0x4ce2fd=_0x5a0095[_0x247cae][_0x90a1('0x76')]?_0x39f7f7[_0x5a0095[_0x247cae][_0x90a1('0x76')]][_0x90a1('0x77')]:_0x5a0095[_0x247cae][_0x90a1('0x6b')];_0x4ce2fd=_0x5a0095[_0x247cae][_0x90a1('0x78')]?_[_0x90a1('0x79')](_0x4cc02d[_0x5a0095[_0x247cae][_0x90a1('0x78')]],'%s',_0x4ce2fd):_0x4ce2fd;_0x4ce2fd=_0x5a0095[_0x247cae][_0x90a1('0x81')]?_[_0x90a1('0x79')](_0x5b1b42[_0x5a0095[_0x247cae][_0x90a1('0x81')]],'%s',_0x4ce2fd):_0x4ce2fd;if(_0x5a0095[_0x247cae][_0x90a1('0x7a')]){_0x149e26[_0x90a1('0x6a')](_0x4ce2fd);}_0x5a0095[_0x247cae][_0x90a1('0x92')]&&_0x149e26[_0x90a1('0x93')](_0x4ce2fd,_0x5a0095[_0x247cae][_0x90a1('0x92')]===_0x90a1('0x7b')?![]:!![]);_0x149e26[_0x90a1('0x6b')](_0x4ce2fd,_0x5a0095[_0x247cae][_0x90a1('0xa9')]||_0x4ce2fd);}if(_0x5054e8[_0x90a1('0x7c')]){_0x5054e8[_0x90a1('0x7c')]=JSON[_0x90a1('0x7d')](_0x5054e8[_0x90a1('0x7c')]);for(var _0x5699cc=0x0;_0x5699cc<_0x5054e8['joins']['length'];_0x5699cc+=0x1){if(_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x35')]&&_[_0x90a1('0x63')](_0x4abf96,_0x5054e8[_0x90a1('0x7c')][_0x5699cc]['type'])&&_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x7e')]&&_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x80')]&&_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x7f')]){_0x149e26[_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x35')]](_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x80')],null,util[_0x90a1('0x81')](_0x90a1('0x82'),_0x5054e8[_0x90a1('0x75')],_0x5054e8[_0x90a1('0x7c')][_0x5699cc][_0x90a1('0x7e')],_0x5054e8['joins'][_0x5699cc][_0x90a1('0x80')],_0x5054e8['joins'][_0x5699cc][_0x90a1('0x7f')]));}}}if(_0x5054e8[_0x90a1('0x83')]){_0x5054e8[_0x90a1('0x83')]=JSON[_0x90a1('0x7d')](_0x5054e8[_0x90a1('0x83')]);_0x149e26[_0x90a1('0x41')](_0x2b2f34(_0x5054e8[_0x90a1('0x83')][_0x90a1('0x6a')]));}_0x19caac=_0x149e26[_0x90a1('0x84')]();_0x149e26[_0x90a1('0x21')](_0x1f91d1);_0x149e26[_0x90a1('0x20')](0x0);logger[_0x90a1('0x85')]('Limited\x20Query:',_0x149e26[_0x90a1('0x88')]());return dbH['sequelize'][_0x90a1('0x37')](_0x149e26[_0x90a1('0x88')](),{'type':dbH['sequelize'][_0x90a1('0x89')][_0x90a1('0x8a')]});}})['then'](function(){return{'sql':_0x19caac['toString']()};})['then'](respondWithResult(_0x3f7aec,null))[_0x90a1('0x49')](handleError(_0x3f7aec,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 85fcaa1..5daccd5 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 _0x6e24=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x4a18f0,_0x903c50){var _0x158316=function(_0x3cf39c){while(--_0x3cf39c){_0x4a18f0['push'](_0x4a18f0['shift']());}};_0x158316(++_0x903c50);}(_0x6e24,0x151));var _0x46e2=function(_0x5b8e8e,_0x30d89b){_0x5b8e8e=_0x5b8e8e-0x0;var _0x5d321d=_0x6e24[_0x5b8e8e];return _0x5d321d;};'use strict';var _=require(_0x46e2('0x0'));var util=require(_0x46e2('0x1'));var logger=require(_0x46e2('0x2'))(_0x46e2('0x3'));var moment=require(_0x46e2('0x4'));var BPromise=require(_0x46e2('0x5'));var rp=require(_0x46e2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x46e2('0x7'));var attributes=require(_0x46e2('0x8'));module[_0x46e2('0x9')]=function(_0xa7d823,_0x47481d){return _0xa7d823[_0x46e2('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x46e2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a41=['AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6a41,0x13a));var _0x16a4=function(_0x260e3d,_0x389dd5){_0x260e3d=_0x260e3d-0x0;var _0x12895e=_0x6a41[_0x260e3d];return _0x12895e;};'use strict';var _=require(_0x16a4('0x0'));var util=require(_0x16a4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x16a4('0x2'));var BPromise=require(_0x16a4('0x3'));var rp=require(_0x16a4('0x4'));var fs=require('fs');var path=require(_0x16a4('0x5'));var rimraf=require(_0x16a4('0x6'));var config=require(_0x16a4('0x7'));var attributes=require(_0x16a4('0x8'));module[_0x16a4('0x9')]=function(_0x4f5edd,_0x2854aa){return _0x4f5edd['define'](_0x16a4('0xa'),attributes,{'tableName':_0x16a4('0xb'),'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 2ad72fc..e0af812 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 _0x5789=['code','error','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x583f88,_0xc5c39){var _0x5e48ba=function(_0x394362){while(--_0x394362){_0x583f88['push'](_0x583f88['shift']());}};_0x5e48ba(++_0xc5c39);}(_0x5789,0x1e9));var _0x9578=function(_0x5546ce,_0x211c72){_0x5546ce=_0x5546ce-0x0;var _0x36e91b=_0x5789[_0x5546ce];return _0x36e91b;};'use strict';var _=require(_0x9578('0x0'));var util=require(_0x9578('0x1'));var moment=require(_0x9578('0x2'));var BPromise=require('bluebird');var rs=require(_0x9578('0x3'));var fs=require('fs');var Redis=require(_0x9578('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9578('0x5'));var logger=require('../../config/logger')(_0x9578('0x6'));var config=require(_0x9578('0x7'));var jayson=require(_0x9578('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b6795,_0x1ee669,_0x22cc40){return new BPromise(function(_0x5ba74e,_0x23c4a5){return client['request'](_0x4b6795,_0x22cc40)[_0x9578('0x9')](function(_0x1139fd){logger[_0x9578('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ee669,_0x9578('0xb'));logger[_0x9578('0xc')](_0x9578('0xd'),_0x1ee669,_0x9578('0xb'),JSON[_0x9578('0xe')](_0x1139fd));if(_0x1139fd['error']){if(_0x1139fd['error'][_0x9578('0xf')]===0x1f4){logger[_0x9578('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ee669,_0x1139fd[_0x9578('0x10')][_0x9578('0x11')]);return _0x23c4a5(_0x1139fd[_0x9578('0x10')][_0x9578('0x11')]);}logger[_0x9578('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ee669,_0x1139fd[_0x9578('0x10')]['message']);return _0x5ba74e(_0x1139fd[_0x9578('0x10')][_0x9578('0x11')]);}else{logger[_0x9578('0xa')](_0x9578('0x12'),_0x1ee669,_0x9578('0xb'));_0x5ba74e(_0x1139fd[_0x9578('0x13')]['message']);}})[_0x9578('0x14')](function(_0x5f4a57){logger[_0x9578('0x10')](_0x9578('0x12'),_0x1ee669,_0x5f4a57);_0x23c4a5(_0x5f4a57);});});} \ No newline at end of file +var _0xc539=['request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3a5a8d,_0x22dac9){var _0x1b94b7=function(_0x2529ea){while(--_0x2529ea){_0x3a5a8d['push'](_0x3a5a8d['shift']());}};_0x1b94b7(++_0x22dac9);}(_0xc539,0x165));var _0x9c53=function(_0x2b3eb5,_0x1588fc){_0x2b3eb5=_0x2b3eb5-0x0;var _0x1264c3=_0xc539[_0x2b3eb5];return _0x1264c3;};'use strict';var _=require(_0x9c53('0x0'));var util=require(_0x9c53('0x1'));var moment=require(_0x9c53('0x2'));var BPromise=require(_0x9c53('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c53('0x4'));var db=require(_0x9c53('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c53('0x6'))('rpc');var config=require(_0x9c53('0x7'));var jayson=require(_0x9c53('0x8'));var client=jayson[_0x9c53('0x9')][_0x9c53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe0296,_0x351165,_0x168373){return new BPromise(function(_0x35305a,_0x51a601){return client[_0x9c53('0xb')](_0xfe0296,_0x168373)['then'](function(_0x1a575e){logger['info'](_0x9c53('0xc'),_0x351165,_0x9c53('0xd'));logger[_0x9c53('0xe')](_0x9c53('0xf'),_0x351165,'request\x20sent',JSON[_0x9c53('0x10')](_0x1a575e));if(_0x1a575e[_0x9c53('0x11')]){if(_0x1a575e[_0x9c53('0x11')][_0x9c53('0x12')]===0x1f4){logger[_0x9c53('0x11')](_0x9c53('0xc'),_0x351165,_0x1a575e[_0x9c53('0x11')][_0x9c53('0x13')]);return _0x51a601(_0x1a575e[_0x9c53('0x11')]['message']);}logger[_0x9c53('0x11')](_0x9c53('0xc'),_0x351165,_0x1a575e['error'][_0x9c53('0x13')]);return _0x35305a(_0x1a575e[_0x9c53('0x11')]['message']);}else{logger[_0x9c53('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x351165,'request\x20sent');_0x35305a(_0x1a575e[_0x9c53('0x15')][_0x9c53('0x13')]);}})[_0x9c53('0x16')](function(_0x50d4c7){logger[_0x9c53('0x11')](_0x9c53('0xc'),_0x351165,_0x50d4c7);_0x51a601(_0x50d4c7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 16e9ca9..73807f0 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 _0x4c76=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x8dbd8,_0xac3b0f){var _0x58ae1b=function(_0x277d92){while(--_0x277d92){_0x8dbd8['push'](_0x8dbd8['shift']());}};_0x58ae1b(++_0xac3b0f);}(_0x4c76,0x141));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x64c7('0x0'));var util=require(_0x64c7('0x1'));var path=require(_0x64c7('0x2'));var timeout=require(_0x64c7('0x3'));var express=require(_0x64c7('0x4'));var router=express[_0x64c7('0x5')]();var fs_extra=require(_0x64c7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x64c7('0x7'));var config=require(_0x64c7('0x8'));var controller=require(_0x64c7('0x9'));router['get']('/',auth[_0x64c7('0xa')](),controller['index']);router[_0x64c7('0xb')](_0x64c7('0xc'),auth[_0x64c7('0xa')](),controller['show']);router[_0x64c7('0xb')](_0x64c7('0xd'),auth[_0x64c7('0xa')](),controller[_0x64c7('0xe')]);router[_0x64c7('0xb')]('/:id/run',auth['isAuthenticated'](),controller[_0x64c7('0xf')]);router[_0x64c7('0xb')](_0x64c7('0x10'),auth['isAuthenticated'](),controller[_0x64c7('0x11')]);router[_0x64c7('0x12')]('/',auth['isAuthenticated'](),controller[_0x64c7('0x13')]);router[_0x64c7('0x14')](_0x64c7('0xc'),auth[_0x64c7('0xa')](),controller[_0x64c7('0x15')]);router[_0x64c7('0x16')](_0x64c7('0xc'),auth['isAuthenticated'](),controller[_0x64c7('0x17')]);module[_0x64c7('0x18')]=router; \ No newline at end of file +var _0x3645=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','run','post','create','update','delete','destroy'];(function(_0x5589c3,_0x3047cf){var _0xbd37d3=function(_0x1f681e){while(--_0x1f681e){_0x5589c3['push'](_0x5589c3['shift']());}};_0xbd37d3(++_0x3047cf);}(_0x3645,0x143));var _0x5364=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x3645[_0x4de877];return _0xb2cfeb;};'use strict';var multer=require(_0x5364('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5364('0x1'));var express=require(_0x5364('0x2'));var router=express['Router']();var fs_extra=require(_0x5364('0x3'));var auth=require(_0x5364('0x4'));var interaction=require(_0x5364('0x5'));var config=require('../../config/environment');var controller=require(_0x5364('0x6'));router[_0x5364('0x7')]('/',auth[_0x5364('0x8')](),controller[_0x5364('0x9')]);router[_0x5364('0x7')](_0x5364('0xa'),auth[_0x5364('0x8')](),controller['show']);router[_0x5364('0x7')](_0x5364('0xb'),auth[_0x5364('0x8')](),controller[_0x5364('0xc')]);router[_0x5364('0x7')]('/:id/run',auth[_0x5364('0x8')](),controller[_0x5364('0xd')]);router['get']('/:id/query',auth[_0x5364('0x8')](),controller['query']);router[_0x5364('0xe')]('/',auth[_0x5364('0x8')](),controller[_0x5364('0xf')]);router['put'](_0x5364('0xa'),auth[_0x5364('0x8')](),controller[_0x5364('0x10')]);router[_0x5364('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5364('0x12')]);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 f1b5cb7..b6a0050 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 _0xbd51=['sequelize','STRING'];(function(_0x4171bf,_0x4322f3){var _0x18a433=function(_0x41c545){while(--_0x41c545){_0x4171bf['push'](_0x4171bf['shift']());}};_0x18a433(++_0x4322f3);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x576743,_0x1fa8c9){_0x576743=_0x576743-0x0;var _0x5a5c71=_0xbd51[_0x576743];return _0x5a5c71;};'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 +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1bb121,_0x5d4138){var _0x5dbb01=function(_0x3c9fa1){while(--_0x3c9fa1){_0x1bb121['push'](_0x1bb121['shift']());}};_0x5dbb01(++_0x5d4138);}(_0xac9d,0x14d));var _0xdac9=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0xac9d[_0x46a671];return _0x526d75;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f69c72d..45471e2 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 _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x1fddf6,_0x593b84){var _0x2c49b6=function(_0x4acc62){while(--_0x4acc62){_0x1fddf6['push'](_0x1fddf6['shift']());}};_0x2c49b6(++_0x593b84);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file +var _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x1d0456,_0x353c0b){var _0x1f4fbf=function(_0x21c62c){while(--_0x21c62c){_0x1d0456['push'](_0x1d0456['shift']());}};_0x1f4fbf(++_0x353c0b);}(_0x814b,0x1a2));var _0xb814=function(_0x2423d7,_0xe6ec57){_0x2423d7=_0x2423d7-0x0;var _0x151d17=_0x814b[_0x2423d7];return _0x151d17;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 616aa05..9987100 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 _0x47fd=['define','AnalyticDefaultReport','analytics_default_reports','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x47fd,0xdf));var _0xd47f=function(_0x9e6e8c,_0x6ed498){_0x9e6e8c=_0x9e6e8c-0x0;var _0x120e48=_0x47fd[_0x9e6e8c];return _0x120e48;};'use strict';var _=require(_0xd47f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd47f('0x1'));var moment=require('moment');var BPromise=require(_0xd47f('0x2'));var rp=require(_0xd47f('0x3'));var fs=require('fs');var path=require(_0xd47f('0x4'));var rimraf=require(_0xd47f('0x5'));var config=require(_0xd47f('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0xd47f('0x7')]=function(_0x1f12a0,_0x594f6e){return _0x1f12a0[_0xd47f('0x8')](_0xd47f('0x9'),attributes,{'tableName':_0xd47f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2415=['../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x134ec7,_0xc61b74){var _0x2b2bf6=function(_0x573e0a){while(--_0x573e0a){_0x134ec7['push'](_0x134ec7['shift']());}};_0x2b2bf6(++_0xc61b74);}(_0x2415,0xb8));var _0x5241=function(_0x1d5270,_0x461f18){_0x1d5270=_0x1d5270-0x0;var _0x3fbe67=_0x2415[_0x1d5270];return _0x3fbe67;};'use strict';var _=require(_0x5241('0x0'));var util=require(_0x5241('0x1'));var logger=require(_0x5241('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5241('0x3'));var fs=require('fs');var path=require(_0x5241('0x4'));var rimraf=require(_0x5241('0x5'));var config=require(_0x5241('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x5241('0x7')]=function(_0x4da609,_0x402d8d){return _0x4da609['define'](_0x5241('0x8'),attributes,{'tableName':_0x5241('0x9'),'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 c57edf9..c7fc061 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 _0xe485=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x277dff,_0x1bdc8d){var _0x3e584a=function(_0x5eb9a9){while(--_0x5eb9a9){_0x277dff['push'](_0x277dff['shift']());}};_0x3e584a(++_0x1bdc8d);}(_0xe485,0x17f));var _0x5e48=function(_0x3708d2,_0x1b557d){_0x3708d2=_0x3708d2-0x0;var _0x34a5ff=_0xe485[_0x3708d2];return _0x34a5ff;};'use strict';var _=require(_0x5e48('0x0'));var util=require('util');var moment=require(_0x5e48('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e48('0x2'));var fs=require('fs');var Redis=require(_0x5e48('0x3'));var db=require(_0x5e48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e48('0x5'))(_0x5e48('0x6'));var config=require('../../config/environment');var jayson=require(_0x5e48('0x7'));var client=jayson[_0x5e48('0x8')][_0x5e48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe1ce11,_0x14e828,_0x1de64b){return new BPromise(function(_0x36ea74,_0x425863){return client[_0x5e48('0xa')](_0xe1ce11,_0x1de64b)[_0x5e48('0xb')](function(_0x1b6600){logger[_0x5e48('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x14e828,_0x5e48('0xd'));logger[_0x5e48('0xe')](_0x5e48('0xf'),_0x14e828,_0x5e48('0xd'),JSON[_0x5e48('0x10')](_0x1b6600));if(_0x1b6600['error']){if(_0x1b6600[_0x5e48('0x11')]['code']===0x1f4){logger[_0x5e48('0x11')](_0x5e48('0x12'),_0x14e828,_0x1b6600[_0x5e48('0x11')][_0x5e48('0x13')]);return _0x425863(_0x1b6600['error'][_0x5e48('0x13')]);}logger['error'](_0x5e48('0x12'),_0x14e828,_0x1b6600[_0x5e48('0x11')][_0x5e48('0x13')]);return _0x36ea74(_0x1b6600[_0x5e48('0x11')][_0x5e48('0x13')]);}else{logger['info'](_0x5e48('0x12'),_0x14e828,'request\x20sent');_0x36ea74(_0x1b6600[_0x5e48('0x14')][_0x5e48('0x13')]);}})[_0x5e48('0x15')](function(_0x902d85){logger[_0x5e48('0x11')](_0x5e48('0x12'),_0x14e828,_0x902d85);_0x425863(_0x902d85);});});} \ No newline at end of file +var _0x17d3=['catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x17d3,0x86));var _0x317d=function(_0x3c8a73,_0x30842f){_0x3c8a73=_0x3c8a73-0x0;var _0x512361=_0x17d3[_0x3c8a73];return _0x512361;};'use strict';var _=require('lodash');var util=require(_0x317d('0x0'));var moment=require(_0x317d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x317d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x317d('0x3'));var logger=require(_0x317d('0x4'))(_0x317d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x317d('0x6')][_0x317d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x299ce7,_0x4da5ba,_0x1b79d5){return new BPromise(function(_0x2c413f,_0x5e9f9a){return client[_0x317d('0x8')](_0x299ce7,_0x1b79d5)[_0x317d('0x9')](function(_0x29d43b){logger[_0x317d('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4da5ba,'request\x20sent');logger[_0x317d('0xb')](_0x317d('0xc'),_0x4da5ba,'request\x20sent',JSON[_0x317d('0xd')](_0x29d43b));if(_0x29d43b[_0x317d('0xe')]){if(_0x29d43b[_0x317d('0xe')]['code']===0x1f4){logger['error'](_0x317d('0xf'),_0x4da5ba,_0x29d43b[_0x317d('0xe')][_0x317d('0x10')]);return _0x5e9f9a(_0x29d43b[_0x317d('0xe')]['message']);}logger[_0x317d('0xe')](_0x317d('0xf'),_0x4da5ba,_0x29d43b[_0x317d('0xe')]['message']);return _0x2c413f(_0x29d43b['error']['message']);}else{logger[_0x317d('0xa')](_0x317d('0xf'),_0x4da5ba,_0x317d('0x11'));_0x2c413f(_0x29d43b['result'][_0x317d('0x10')]);}})[_0x317d('0x12')](function(_0x262098){logger[_0x317d('0xe')](_0x317d('0xf'),_0x4da5ba,_0x262098);_0x5e9f9a(_0x262098);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8bec9cf..129357c 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 _0x0799=['get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0x0799,0x151));var _0x9079=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x0799[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var path=require(_0x9079('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9079('0x3')]();var fs_extra=require(_0x9079('0x4'));var auth=require(_0x9079('0x5'));var interaction=require(_0x9079('0x6'));var config=require('../../config/environment');var controller=require(_0x9079('0x7'));router[_0x9079('0x8')]('/',auth[_0x9079('0x9')](),controller[_0x9079('0xa')]);router[_0x9079('0x8')](_0x9079('0xb'),auth[_0x9079('0x9')](),controller[_0x9079('0xc')]);router[_0x9079('0x8')]('/:id/preview',auth[_0x9079('0x9')](),controller[_0x9079('0xd')]);router['get'](_0x9079('0xe'),auth[_0x9079('0x9')](),controller[_0x9079('0xf')]);router['get'](_0x9079('0x10'),auth['isAuthenticated'](),controller[_0x9079('0x11')]);router[_0x9079('0x12')]('/',auth[_0x9079('0x9')](),controller[_0x9079('0x13')]);router['put'](_0x9079('0xb'),auth[_0x9079('0x9')](),controller[_0x9079('0x14')]);router[_0x9079('0x15')]('/:id',auth[_0x9079('0x9')](),controller['destroy']);module[_0x9079('0x16')]=router; \ No newline at end of file +var _0xd2c5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0xd2c5,0x1ab));var _0x5d2c=function(_0x201df3,_0x3eb7aa){_0x201df3=_0x201df3-0x0;var _0xe9e417=_0xd2c5[_0x201df3];return _0xe9e417;};'use strict';var multer=require(_0x5d2c('0x0'));var util=require(_0x5d2c('0x1'));var path=require(_0x5d2c('0x2'));var timeout=require(_0x5d2c('0x3'));var express=require('express');var router=express[_0x5d2c('0x4')]();var fs_extra=require(_0x5d2c('0x5'));var auth=require(_0x5d2c('0x6'));var interaction=require(_0x5d2c('0x7'));var config=require(_0x5d2c('0x8'));var controller=require(_0x5d2c('0x9'));router[_0x5d2c('0xa')]('/',auth['isAuthenticated'](),controller[_0x5d2c('0xb')]);router[_0x5d2c('0xa')](_0x5d2c('0xc'),auth[_0x5d2c('0xd')](),controller[_0x5d2c('0xe')]);router[_0x5d2c('0xa')](_0x5d2c('0xf'),auth[_0x5d2c('0xd')](),controller[_0x5d2c('0x10')]);router['get'](_0x5d2c('0x11'),auth[_0x5d2c('0xd')](),controller[_0x5d2c('0x12')]);router[_0x5d2c('0xa')](_0x5d2c('0x13'),auth[_0x5d2c('0xd')](),controller['query']);router[_0x5d2c('0x14')]('/',auth[_0x5d2c('0xd')](),controller[_0x5d2c('0x15')]);router[_0x5d2c('0x16')](_0x5d2c('0xc'),auth['isAuthenticated'](),controller[_0x5d2c('0x17')]);router[_0x5d2c('0x18')](_0x5d2c('0xc'),auth[_0x5d2c('0xd')](),controller[_0x5d2c('0x19')]);module[_0x5d2c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6887fd0..ece7425 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 _0xf789=['scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual'];(function(_0x4bccd7,_0x213c94){var _0x196ceb=function(_0x2accb0){while(--_0x2accb0){_0x4bccd7['push'](_0x4bccd7['shift']());}};_0x196ceb(++_0x213c94);}(_0xf789,0x78));var _0x9f78=function(_0x1c1e0f,_0x1cf8a4){_0x1c1e0f=_0x1c1e0f-0x0;var _0x5272ac=_0xf789[_0x1c1e0f];return _0x5272ac;};'use strict';var Sequelize=require(_0x9f78('0x0'));var moment=require(_0x9f78('0x1'));module[_0x9f78('0x2')]={'name':{'type':Sequelize[_0x9f78('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9f78('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x9f78('0x4')](_0x9f78('0x5'),_0x9f78('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x9f78('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9f78('0x7')]},'endDate':{'type':Sequelize[_0x9f78('0x7')]},'status':{'type':Sequelize[_0x9f78('0x3')],'defaultValue':_0x9f78('0x8')},'type':{'type':Sequelize['ENUM'](_0x9f78('0x9'),_0x9f78('0xa')),'allowNull':![],'defaultValue':_0x9f78('0x9')},'reportId':{'type':Sequelize[_0x9f78('0xb')](0xb)[_0x9f78('0xc')]},'reportType':{'type':Sequelize[_0x9f78('0x3')]}}; \ No newline at end of file +var _0x3958=['ENUM','csv','DATE','Loading','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x3958,0x1d5));var _0x8395=function(_0x2f2b37,_0x5a545b){_0x2f2b37=_0x2f2b37-0x0;var _0x170f0b=_0x3958[_0x2f2b37];return _0x170f0b;};'use strict';var Sequelize=require(_0x8395('0x0'));var moment=require(_0x8395('0x1'));module[_0x8395('0x2')]={'name':{'type':Sequelize[_0x8395('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8395('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8395('0x4')](_0x8395('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8395('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8395('0x6')]},'endDate':{'type':Sequelize[_0x8395('0x6')]},'status':{'type':Sequelize[_0x8395('0x3')],'defaultValue':_0x8395('0x7')},'type':{'type':Sequelize[_0x8395('0x4')]('manual',_0x8395('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8395('0x9')](0xb)[_0x8395('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 721de6b..597892e 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 _0x00ae=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','server/files/reports','ValidationError','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation'];(function(_0x27a9b8,_0x3d89a4){var _0x2d7f09=function(_0x5d43e8){while(--_0x5d43e8){_0x27a9b8['push'](_0x27a9b8['shift']());}};_0x2d7f09(++_0x3d89a4);}(_0x00ae,0xca));var _0xe00a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x00ae[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require(_0xe00a('0x0'));var rimraf=require(_0xe00a('0x1'));var zipdir=require(_0xe00a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe00a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe00a('0x4'));var util=require(_0xe00a('0x5'));var path=require(_0xe00a('0x6'));var sox=require(_0xe00a('0x7'));var csv=require('to-csv');var ejs=require(_0xe00a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe00a('0x9'));var squel=require(_0xe00a('0xa'));var crypto=require('crypto');var jsforce=require(_0xe00a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe00a('0xc'));var querystring=require(_0xe00a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe00a('0xe'));var qs=require(_0xe00a('0xf'));var as=require(_0xe00a('0x10'));var hardwareService=require(_0xe00a('0x11'));var logger=require(_0xe00a('0x12'))(_0xe00a('0x13'));var utils=require(_0xe00a('0x14'));var config=require(_0xe00a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe00a('0x16'))['db'];function respondWithStatusCode(_0x1e2f40,_0x1fe269){_0x1fe269=_0x1fe269||0xcc;return function(_0x11c194){if(_0x11c194){return _0x1e2f40[_0xe00a('0x17')](_0x1fe269);}return _0x1e2f40['status'](_0x1fe269)[_0xe00a('0x18')]();};}function respondWithResult(_0x10a197,_0x27f6b9){_0x27f6b9=_0x27f6b9||0xc8;return function(_0x54768c){if(_0x54768c){return _0x10a197[_0xe00a('0x19')](_0x27f6b9)[_0xe00a('0x1a')](_0x54768c);}};}function respondWithFilteredResult(_0x3d5220,_0x38cb27){return function(_0x22d36c){if(_0x22d36c){var _0x4d244e=typeof _0x38cb27['offset']===_0xe00a('0x1b')&&typeof _0x38cb27[_0xe00a('0x1c')]===_0xe00a('0x1b');var _0x58e203=_0x22d36c[_0xe00a('0x1d')];var _0x5c19c5=_0x4d244e?0x0:_0x38cb27[_0xe00a('0x1e')];var _0x51a039=_0x4d244e?_0x22d36c[_0xe00a('0x1d')]:_0x38cb27['offset']+_0x38cb27['limit'];var _0x3f5f42;if(_0x51a039>=_0x58e203){_0x51a039=_0x58e203;_0x3f5f42=0xc8;}else{_0x3f5f42=0xce;}_0x3d5220[_0xe00a('0x19')](_0x3f5f42);return _0x3d5220[_0xe00a('0x1f')]('Content-Range',_0x5c19c5+'-'+_0x51a039+'/'+_0x58e203)['json'](_0x22d36c);}return null;};}function patchUpdates(_0x47bffa){return function(_0x36da3b){try{jsonpatch[_0xe00a('0x20')](_0x36da3b,_0x47bffa,!![]);}catch(_0x491363){return BPromise['reject'](_0x491363);}return _0x36da3b['save']();};}function saveUpdates(_0x35940a,_0x9f52a9){return function(_0x74e187){if(_0x74e187){return _0x74e187[_0xe00a('0x21')](_0x35940a)[_0xe00a('0x22')](function(_0x26290d){return _0x26290d;});}return null;};}function removeEntity(_0x33fb81,_0x14d57f){return function(_0x694586){if(_0x694586){return _0x694586[_0xe00a('0x23')]()['then'](function(){var _0x1968c7=_0x694586[_0xe00a('0x24')]({'plain':!![]});var _0x14325f=_0xe00a('0x25');return db[_0xe00a('0x26')][_0xe00a('0x23')]({'where':{'type':_0x14325f,'resourceId':_0x1968c7['id']}})[_0xe00a('0x22')](function(){return _0x694586;});})[_0xe00a('0x22')](function(){_0x33fb81[_0xe00a('0x19')](0xcc)[_0xe00a('0x18')]();});}};}function handleEntityNotFound(_0x2db74d,_0x111d6c){return function(_0x4537a7){if(!_0x4537a7){_0x2db74d[_0xe00a('0x17')](0x194);}return _0x4537a7;};}function handleError(_0x2e1a5b,_0x7abace){_0x7abace=_0x7abace||0x1f4;return function(_0x3dfa50){logger[_0xe00a('0x27')](_0x3dfa50[_0xe00a('0x28')]);if(_0x3dfa50[_0xe00a('0x29')]){delete _0x3dfa50['name'];}_0x2e1a5b[_0xe00a('0x19')](_0x7abace)['send'](_0x3dfa50);};}exports[_0xe00a('0x2a')]=function(_0x20efd2,_0x19e47f){var _0x344c5c={},_0x5514b5={},_0x1b3dc1={'count':0x0,'rows':[]};var _0x158de7=_[_0xe00a('0x2b')](db[_0xe00a('0x2c')][_0xe00a('0x2d')],function(_0xc9f012){return{'name':_0xc9f012[_0xe00a('0x2e')],'type':_0xc9f012[_0xe00a('0x2f')][_0xe00a('0x30')]};});_0x5514b5[_0xe00a('0x31')]=_[_0xe00a('0x2b')](_0x158de7,'name');_0x5514b5['query']=_[_0xe00a('0x32')](_0x20efd2['query']);_0x5514b5[_0xe00a('0x33')]=_[_0xe00a('0x34')](_0x5514b5[_0xe00a('0x31')],_0x5514b5[_0xe00a('0x35')]);_0x344c5c['attributes']=_[_0xe00a('0x34')](_0x5514b5[_0xe00a('0x31')],qs[_0xe00a('0x36')](_0x20efd2[_0xe00a('0x35')][_0xe00a('0x36')]));_0x344c5c[_0xe00a('0x37')]=_0x344c5c[_0xe00a('0x37')][_0xe00a('0x38')]?_0x344c5c['attributes']:_0x5514b5['model'];if(!_0x20efd2['query'][_0xe00a('0x39')](_0xe00a('0x3a'))){_0x344c5c[_0xe00a('0x1c')]=qs[_0xe00a('0x1c')](_0x20efd2[_0xe00a('0x35')][_0xe00a('0x1c')]);_0x344c5c[_0xe00a('0x1e')]=qs[_0xe00a('0x1e')](_0x20efd2[_0xe00a('0x35')][_0xe00a('0x1e')]);}_0x344c5c[_0xe00a('0x3b')]=qs[_0xe00a('0x3c')](_0x20efd2[_0xe00a('0x35')][_0xe00a('0x3c')]);_0x344c5c[_0xe00a('0x3d')]=qs[_0xe00a('0x33')](_[_0xe00a('0x3e')](_0x20efd2[_0xe00a('0x35')],_0x5514b5[_0xe00a('0x33')]),_0x158de7);if(_0x20efd2[_0xe00a('0x35')][_0xe00a('0x3f')]){_0x344c5c[_0xe00a('0x3d')]=_['merge'](_0x344c5c[_0xe00a('0x3d')],{'$or':_['map'](_0x158de7,function(_0x4edb57){if(_0x4edb57[_0xe00a('0x2f')]!==_0xe00a('0x40')){var _0x1bbd6f={};_0x1bbd6f[_0x4edb57[_0xe00a('0x29')]]={'$like':'%'+_0x20efd2[_0xe00a('0x35')]['filter']+'%'};return _0x1bbd6f;}})});}_0x344c5c=_[_0xe00a('0x41')]({},_0x344c5c,_0x20efd2[_0xe00a('0x42')]);var _0x30c177={'where':_0x344c5c[_0xe00a('0x3d')]};return db[_0xe00a('0x2c')][_0xe00a('0x1d')](_0x30c177)['then'](function(_0x3d1fef){_0x1b3dc1[_0xe00a('0x1d')]=_0x3d1fef;if(_0x20efd2[_0xe00a('0x35')]['includeAll']){_0x344c5c[_0xe00a('0x43')]=[{'all':!![]}];}return db[_0xe00a('0x2c')]['findAll'](_0x344c5c);})[_0xe00a('0x22')](function(_0x57a8f3){_0x1b3dc1[_0xe00a('0x44')]=_0x57a8f3;return _0x1b3dc1;})['then'](respondWithFilteredResult(_0x19e47f,_0x344c5c))[_0xe00a('0x45')](handleError(_0x19e47f,null));};exports['show']=function(_0x2f35c6,_0x2326c2){var _0x3b46a9={'raw':!![],'where':{'id':_0x2f35c6[_0xe00a('0x46')]['id']}},_0x41985a={};_0x41985a['model']=_[_0xe00a('0x32')](db['AnalyticExtractedReport'][_0xe00a('0x2d')]);_0x41985a[_0xe00a('0x35')]=_['keys'](_0x2f35c6['query']);_0x41985a[_0xe00a('0x33')]=_['intersection'](_0x41985a[_0xe00a('0x31')],_0x41985a[_0xe00a('0x35')]);_0x3b46a9[_0xe00a('0x37')]=_['intersection'](_0x41985a[_0xe00a('0x31')],qs['fields'](_0x2f35c6[_0xe00a('0x35')][_0xe00a('0x36')]));_0x3b46a9[_0xe00a('0x37')]=_0x3b46a9[_0xe00a('0x37')][_0xe00a('0x38')]?_0x3b46a9[_0xe00a('0x37')]:_0x41985a[_0xe00a('0x31')];if(_0x2f35c6[_0xe00a('0x35')][_0xe00a('0x47')]){_0x3b46a9[_0xe00a('0x43')]=[{'all':!![]}];}_0x3b46a9=_[_0xe00a('0x41')]({},_0x3b46a9,_0x2f35c6[_0xe00a('0x42')]);return db[_0xe00a('0x2c')][_0xe00a('0x48')](_0x3b46a9)[_0xe00a('0x22')](handleEntityNotFound(_0x2326c2,null))[_0xe00a('0x22')](respondWithResult(_0x2326c2,null))['catch'](handleError(_0x2326c2,null));};exports[_0xe00a('0x49')]=function(_0x4d57ef,_0x250af6){return db[_0xe00a('0x2c')][_0xe00a('0x49')](_0x4d57ef[_0xe00a('0x4a')],{})[_0xe00a('0x22')](function(_0x191af9){var _0x20e29e=_0x4d57ef[_0xe00a('0x4b')][_0xe00a('0x24')]({'plain':!![]});if(!_0x20e29e)throw new Error(_0xe00a('0x4c'));if(_0x20e29e[_0xe00a('0x4d')]===_0xe00a('0x4b')){var _0x1db961=_0x191af9[_0xe00a('0x24')]({'plain':!![]});var _0x3d5002=_0xe00a('0x25');return db['UserProfileSection'][_0xe00a('0x48')]({'where':{'name':_0x3d5002,'userProfileId':_0x20e29e[_0xe00a('0x4e')]},'raw':!![]})[_0xe00a('0x22')](function(_0x2a9831){if(_0x2a9831&&_0x2a9831[_0xe00a('0x4f')]===0x0){return db['UserProfileResource'][_0xe00a('0x49')]({'name':_0x1db961[_0xe00a('0x29')],'resourceId':_0x1db961['id'],'type':_0x2a9831[_0xe00a('0x29')],'sectionId':_0x2a9831['id']},{})[_0xe00a('0x22')](function(){return _0x191af9;});}else{return _0x191af9;}})[_0xe00a('0x45')](function(_0x1f9168){logger[_0xe00a('0x27')](_0xe00a('0x50'),_0x1f9168);throw _0x1f9168;});}return _0x191af9;})['then'](respondWithResult(_0x250af6,0xc9))[_0xe00a('0x45')](handleError(_0x250af6,null));};exports['update']=function(_0x51cf62,_0x1ae8c8){if(_0x51cf62['body']['id']){delete _0x51cf62[_0xe00a('0x4a')]['id'];}return db[_0xe00a('0x2c')][_0xe00a('0x48')]({'where':{'id':_0x51cf62[_0xe00a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ae8c8,null))[_0xe00a('0x22')](saveUpdates(_0x51cf62[_0xe00a('0x4a')],null))['then'](respondWithResult(_0x1ae8c8,null))[_0xe00a('0x45')](handleError(_0x1ae8c8,null));};exports[_0xe00a('0x23')]=function(_0x40abe6,_0x535b90){return db[_0xe00a('0x2c')][_0xe00a('0x48')]({'where':{'id':_0x40abe6['params']['id']}})['then'](handleEntityNotFound(_0x535b90,null))[_0xe00a('0x22')](removeEntity(_0x535b90,null))[_0xe00a('0x45')](handleError(_0x535b90,null));};exports[_0xe00a('0x51')]=function(_0x1a84dd,_0x1e5c69,_0x218dbe){return db[_0xe00a('0x2c')]['find']({'where':{'id':_0x1a84dd['params']['id']},'attributes':[_0xe00a('0x29'),'basename',_0xe00a('0x52'),_0xe00a('0x53')],'raw':!![]})[_0xe00a('0x22')](handleEntityNotFound(_0x1e5c69,null))[_0xe00a('0x22')](function(_0xb11d28){if(_0xb11d28){if(!fs[_0xe00a('0x54')](path[_0xe00a('0x55')](config[_0xe00a('0x56')],_0xe00a('0x57'),_0xb11d28['savename']))){throw new db['Sequelize'][(_0xe00a('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1a84dd[_0xe00a('0x35')][_0xe00a('0x59')]){return _0x1e5c69['sendStatus'](0xc8);}return _0x1e5c69['download'](path[_0xe00a('0x55')](config[_0xe00a('0x56')],'server/files/reports',_0xb11d28[_0xe00a('0x52')]),util[_0xe00a('0x5a')](_0xe00a('0x5b'),_0xb11d28[_0xe00a('0x5c')]||_0xb11d28['name'],_0xb11d28[_0xe00a('0x53')][_0xe00a('0x5d')]()));}})['catch'](handleError(_0x1e5c69,null));}; \ No newline at end of file +var _0xa0c6=['to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','then','get','ExtractedReports','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','limit','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','format','%s.%s','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3125da,_0x307f47){var _0x1b5cc6=function(_0x233e03){while(--_0x233e03){_0x3125da['push'](_0x3125da['shift']());}};_0x1b5cc6(++_0x307f47);}(_0xa0c6,0x11b));var _0x6a0c=function(_0x2d91a3,_0x427cd9){_0x2d91a3=_0x2d91a3-0x0;var _0x27b807=_0xa0c6[_0x2d91a3];return _0x27b807;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a0c('0x0'));var zipdir=require(_0x6a0c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a0c('0x2'));var moment=require(_0x6a0c('0x3'));var BPromise=require(_0x6a0c('0x4'));var Mustache=require(_0x6a0c('0x5'));var util=require(_0x6a0c('0x6'));var path=require(_0x6a0c('0x7'));var sox=require('sox');var csv=require(_0x6a0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a0c('0x9'));var _=require(_0x6a0c('0xa'));var squel=require(_0x6a0c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a0c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a0c('0xd'));var Redis=require('ioredis');var authService=require(_0x6a0c('0xe'));var qs=require(_0x6a0c('0xf'));var as=require(_0x6a0c('0x10'));var hardwareService=require(_0x6a0c('0x11'));var logger=require(_0x6a0c('0x12'))(_0x6a0c('0x13'));var utils=require(_0x6a0c('0x14'));var config=require(_0x6a0c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a0c('0x16'))['db'];function respondWithStatusCode(_0x3b415b,_0x37fa31){_0x37fa31=_0x37fa31||0xcc;return function(_0x2adb8d){if(_0x2adb8d){return _0x3b415b[_0x6a0c('0x17')](_0x37fa31);}return _0x3b415b[_0x6a0c('0x18')](_0x37fa31)[_0x6a0c('0x19')]();};}function respondWithResult(_0x4cfb7e,_0x44ca64){_0x44ca64=_0x44ca64||0xc8;return function(_0x598682){if(_0x598682){return _0x4cfb7e[_0x6a0c('0x18')](_0x44ca64)[_0x6a0c('0x1a')](_0x598682);}};}function respondWithFilteredResult(_0x297d16,_0x57ec9c){return function(_0x537ff9){if(_0x537ff9){var _0x54fbd9=typeof _0x57ec9c['offset']===_0x6a0c('0x1b')&&typeof _0x57ec9c['limit']===_0x6a0c('0x1b');var _0x430e2f=_0x537ff9[_0x6a0c('0x1c')];var _0x34b194=_0x54fbd9?0x0:_0x57ec9c['offset'];var _0x2093a8=_0x54fbd9?_0x537ff9['count']:_0x57ec9c[_0x6a0c('0x1d')]+_0x57ec9c['limit'];var _0x330673;if(_0x2093a8>=_0x430e2f){_0x2093a8=_0x430e2f;_0x330673=0xc8;}else{_0x330673=0xce;}_0x297d16[_0x6a0c('0x18')](_0x330673);return _0x297d16[_0x6a0c('0x1e')](_0x6a0c('0x1f'),_0x34b194+'-'+_0x2093a8+'/'+_0x430e2f)['json'](_0x537ff9);}return null;};}function patchUpdates(_0x4b237b){return function(_0x55b95a){try{jsonpatch['apply'](_0x55b95a,_0x4b237b,!![]);}catch(_0x93b27f){return BPromise[_0x6a0c('0x20')](_0x93b27f);}return _0x55b95a[_0x6a0c('0x21')]();};}function saveUpdates(_0x354997,_0x48455e){return function(_0x4cf6da){if(_0x4cf6da){return _0x4cf6da['update'](_0x354997)[_0x6a0c('0x22')](function(_0x23ff03){return _0x23ff03;});}return null;};}function removeEntity(_0xe96ea5,_0x30d01f){return function(_0x194bb9){if(_0x194bb9){return _0x194bb9['destroy']()[_0x6a0c('0x22')](function(){var _0x52848b=_0x194bb9[_0x6a0c('0x23')]({'plain':!![]});var _0x41dae3=_0x6a0c('0x24');return db['UserProfileResource'][_0x6a0c('0x25')]({'where':{'type':_0x41dae3,'resourceId':_0x52848b['id']}})[_0x6a0c('0x22')](function(){return _0x194bb9;});})[_0x6a0c('0x22')](function(){_0xe96ea5[_0x6a0c('0x18')](0xcc)[_0x6a0c('0x19')]();});}};}function handleEntityNotFound(_0x212cd8,_0x42e264){return function(_0x17aa04){if(!_0x17aa04){_0x212cd8[_0x6a0c('0x17')](0x194);}return _0x17aa04;};}function handleError(_0x1af624,_0x599aa7){_0x599aa7=_0x599aa7||0x1f4;return function(_0x181459){logger[_0x6a0c('0x26')](_0x181459[_0x6a0c('0x27')]);if(_0x181459[_0x6a0c('0x28')]){delete _0x181459[_0x6a0c('0x28')];}_0x1af624['status'](_0x599aa7)[_0x6a0c('0x29')](_0x181459);};}exports[_0x6a0c('0x2a')]=function(_0x6a11c3,_0x3dd971){var _0x5e9cca={},_0x4c8579={},_0x364c69={'count':0x0,'rows':[]};var _0x3cfe83=_[_0x6a0c('0x2b')](db[_0x6a0c('0x2c')][_0x6a0c('0x2d')],function(_0x4f497b){return{'name':_0x4f497b[_0x6a0c('0x2e')],'type':_0x4f497b[_0x6a0c('0x2f')][_0x6a0c('0x30')]};});_0x4c8579[_0x6a0c('0x31')]=_[_0x6a0c('0x2b')](_0x3cfe83,_0x6a0c('0x28'));_0x4c8579['query']=_[_0x6a0c('0x32')](_0x6a11c3[_0x6a0c('0x33')]);_0x4c8579[_0x6a0c('0x34')]=_['intersection'](_0x4c8579[_0x6a0c('0x31')],_0x4c8579[_0x6a0c('0x33')]);_0x5e9cca[_0x6a0c('0x35')]=_[_0x6a0c('0x36')](_0x4c8579[_0x6a0c('0x31')],qs[_0x6a0c('0x37')](_0x6a11c3[_0x6a0c('0x33')][_0x6a0c('0x37')]));_0x5e9cca['attributes']=_0x5e9cca[_0x6a0c('0x35')]['length']?_0x5e9cca[_0x6a0c('0x35')]:_0x4c8579['model'];if(!_0x6a11c3['query']['hasOwnProperty'](_0x6a0c('0x38'))){_0x5e9cca['limit']=qs[_0x6a0c('0x39')](_0x6a11c3[_0x6a0c('0x33')]['limit']);_0x5e9cca[_0x6a0c('0x1d')]=qs[_0x6a0c('0x1d')](_0x6a11c3['query']['offset']);}_0x5e9cca['order']=qs[_0x6a0c('0x3a')](_0x6a11c3[_0x6a0c('0x33')][_0x6a0c('0x3a')]);_0x5e9cca['where']=qs['filters'](_[_0x6a0c('0x3b')](_0x6a11c3[_0x6a0c('0x33')],_0x4c8579['filters']),_0x3cfe83);if(_0x6a11c3[_0x6a0c('0x33')]['filter']){_0x5e9cca['where']=_[_0x6a0c('0x3c')](_0x5e9cca[_0x6a0c('0x3d')],{'$or':_['map'](_0x3cfe83,function(_0x5a766c){if(_0x5a766c[_0x6a0c('0x2f')]!==_0x6a0c('0x3e')){var _0x5a5f50={};_0x5a5f50[_0x5a766c[_0x6a0c('0x28')]]={'$like':'%'+_0x6a11c3[_0x6a0c('0x33')][_0x6a0c('0x3f')]+'%'};return _0x5a5f50;}})});}_0x5e9cca=_[_0x6a0c('0x3c')]({},_0x5e9cca,_0x6a11c3[_0x6a0c('0x40')]);var _0xa86bc4={'where':_0x5e9cca[_0x6a0c('0x3d')]};return db[_0x6a0c('0x2c')]['count'](_0xa86bc4)[_0x6a0c('0x22')](function(_0x551fae){_0x364c69['count']=_0x551fae;if(_0x6a11c3[_0x6a0c('0x33')]['includeAll']){_0x5e9cca[_0x6a0c('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x6a0c('0x42')](_0x5e9cca);})['then'](function(_0x20765a){_0x364c69[_0x6a0c('0x43')]=_0x20765a;return _0x364c69;})['then'](respondWithFilteredResult(_0x3dd971,_0x5e9cca))[_0x6a0c('0x44')](handleError(_0x3dd971,null));};exports[_0x6a0c('0x45')]=function(_0x1e0fea,_0x4654b0){var _0x307b0b={'raw':!![],'where':{'id':_0x1e0fea[_0x6a0c('0x46')]['id']}},_0x63ffb8={};_0x63ffb8[_0x6a0c('0x31')]=_['keys'](db[_0x6a0c('0x2c')][_0x6a0c('0x2d')]);_0x63ffb8[_0x6a0c('0x33')]=_[_0x6a0c('0x32')](_0x1e0fea[_0x6a0c('0x33')]);_0x63ffb8[_0x6a0c('0x34')]=_[_0x6a0c('0x36')](_0x63ffb8['model'],_0x63ffb8[_0x6a0c('0x33')]);_0x307b0b[_0x6a0c('0x35')]=_[_0x6a0c('0x36')](_0x63ffb8['model'],qs['fields'](_0x1e0fea[_0x6a0c('0x33')]['fields']));_0x307b0b[_0x6a0c('0x35')]=_0x307b0b['attributes'][_0x6a0c('0x47')]?_0x307b0b[_0x6a0c('0x35')]:_0x63ffb8[_0x6a0c('0x31')];if(_0x1e0fea[_0x6a0c('0x33')][_0x6a0c('0x48')]){_0x307b0b[_0x6a0c('0x41')]=[{'all':!![]}];}_0x307b0b=_[_0x6a0c('0x3c')]({},_0x307b0b,_0x1e0fea[_0x6a0c('0x40')]);return db[_0x6a0c('0x2c')][_0x6a0c('0x49')](_0x307b0b)[_0x6a0c('0x22')](handleEntityNotFound(_0x4654b0,null))[_0x6a0c('0x22')](respondWithResult(_0x4654b0,null))[_0x6a0c('0x44')](handleError(_0x4654b0,null));};exports[_0x6a0c('0x4a')]=function(_0x2f16f0,_0x41769d){return db[_0x6a0c('0x2c')][_0x6a0c('0x4a')](_0x2f16f0['body'],{})[_0x6a0c('0x22')](function(_0x114894){var _0x512307=_0x2f16f0[_0x6a0c('0x4b')]['get']({'plain':!![]});if(!_0x512307)throw new Error(_0x6a0c('0x4c'));if(_0x512307['role']===_0x6a0c('0x4b')){var _0x137143=_0x114894[_0x6a0c('0x23')]({'plain':!![]});var _0x39be05=_0x6a0c('0x24');return db['UserProfileSection'][_0x6a0c('0x49')]({'where':{'name':_0x39be05,'userProfileId':_0x512307[_0x6a0c('0x4d')]},'raw':!![]})['then'](function(_0x84840f){if(_0x84840f&&_0x84840f[_0x6a0c('0x4e')]===0x0){return db[_0x6a0c('0x4f')]['create']({'name':_0x137143[_0x6a0c('0x28')],'resourceId':_0x137143['id'],'type':_0x84840f[_0x6a0c('0x28')],'sectionId':_0x84840f['id']},{})[_0x6a0c('0x22')](function(){return _0x114894;});}else{return _0x114894;}})[_0x6a0c('0x44')](function(_0x497198){logger[_0x6a0c('0x26')](_0x6a0c('0x50'),_0x497198);throw _0x497198;});}return _0x114894;})[_0x6a0c('0x22')](respondWithResult(_0x41769d,0xc9))[_0x6a0c('0x44')](handleError(_0x41769d,null));};exports[_0x6a0c('0x51')]=function(_0x59ca99,_0x498431){if(_0x59ca99[_0x6a0c('0x52')]['id']){delete _0x59ca99[_0x6a0c('0x52')]['id'];}return db['AnalyticExtractedReport'][_0x6a0c('0x49')]({'where':{'id':_0x59ca99['params']['id']}})['then'](handleEntityNotFound(_0x498431,null))[_0x6a0c('0x22')](saveUpdates(_0x59ca99[_0x6a0c('0x52')],null))[_0x6a0c('0x22')](respondWithResult(_0x498431,null))[_0x6a0c('0x44')](handleError(_0x498431,null));};exports[_0x6a0c('0x25')]=function(_0x24170e,_0x3df7a7){return db[_0x6a0c('0x2c')]['find']({'where':{'id':_0x24170e[_0x6a0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3df7a7,null))[_0x6a0c('0x22')](removeEntity(_0x3df7a7,null))[_0x6a0c('0x44')](handleError(_0x3df7a7,null));};exports[_0x6a0c('0x53')]=function(_0x20f81c,_0x102c37,_0x2bcf7c){return db[_0x6a0c('0x2c')][_0x6a0c('0x49')]({'where':{'id':_0x20f81c[_0x6a0c('0x46')]['id']},'attributes':['name',_0x6a0c('0x54'),_0x6a0c('0x55'),_0x6a0c('0x56')],'raw':!![]})[_0x6a0c('0x22')](handleEntityNotFound(_0x102c37,null))[_0x6a0c('0x22')](function(_0x529a8a){if(_0x529a8a){if(!fs[_0x6a0c('0x57')](path[_0x6a0c('0x58')](config['root'],_0x6a0c('0x59'),_0x529a8a['savename']))){throw new db[(_0x6a0c('0x5a'))][(_0x6a0c('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x20f81c['query'][_0x6a0c('0x5c')]){return _0x102c37['sendStatus'](0xc8);}return _0x102c37[_0x6a0c('0x53')](path['join'](config[_0x6a0c('0x5d')],_0x6a0c('0x59'),_0x529a8a[_0x6a0c('0x55')]),util[_0x6a0c('0x5e')](_0x6a0c('0x5f'),_0x529a8a['basename']||_0x529a8a[_0x6a0c('0x28')],_0x529a8a[_0x6a0c('0x56')][_0x6a0c('0x60')]()));}})['catch'](handleError(_0x102c37,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f97e88d..f0eeaaf 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 _0x8c15=['path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4fdb06,_0x3d9655){var _0x562eaa=function(_0x429448){while(--_0x429448){_0x4fdb06['push'](_0x4fdb06['shift']());}};_0x562eaa(++_0x3d9655);}(_0x8c15,0x14c));var _0x58c1=function(_0x309330,_0x128d66){_0x309330=_0x309330-0x0;var _0x54727f=_0x8c15[_0x309330];return _0x54727f;};'use strict';var _=require(_0x58c1('0x0'));var util=require(_0x58c1('0x1'));var logger=require(_0x58c1('0x2'))(_0x58c1('0x3'));var moment=require(_0x58c1('0x4'));var BPromise=require(_0x58c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58c1('0x6'));var rimraf=require(_0x58c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x58c1('0x8'));module[_0x58c1('0x9')]=function(_0x3eed03,_0x345229){return _0x3eed03[_0x58c1('0xa')](_0x58c1('0xb'),attributes,{'tableName':_0x58c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46b7=['rimraf','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46b7,0x89));var _0x746b=function(_0x433075,_0x1108b8){_0x433075=_0x433075-0x0;var _0x541de4=_0x46b7[_0x433075];return _0x541de4;};'use strict';var _=require('lodash');var util=require(_0x746b('0x0'));var logger=require(_0x746b('0x1'))('api');var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rp=require(_0x746b('0x4'));var fs=require('fs');var path=require(_0x746b('0x5'));var rimraf=require(_0x746b('0x6'));var config=require(_0x746b('0x7'));var attributes=require(_0x746b('0x8'));module['exports']=function(_0x48ca1c,_0x1941ae){return _0x48ca1c[_0x746b('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x746b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 24c5aa5..d4cfa39 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 _0x0072=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x27cc17,_0x5655a5){var _0xa0d0f8=function(_0x16a969){while(--_0x16a969){_0x27cc17['push'](_0x27cc17['shift']());}};_0xa0d0f8(++_0x5655a5);}(_0x0072,0x1b8));var _0x2007=function(_0x208c57,_0x3182e5){_0x208c57=_0x208c57-0x0;var _0x1dda31=_0x0072[_0x208c57];return _0x1dda31;};'use strict';var _=require(_0x2007('0x0'));var util=require(_0x2007('0x1'));var moment=require('moment');var BPromise=require(_0x2007('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2007('0x3'));var db=require(_0x2007('0x4'))['db'];var utils=require(_0x2007('0x5'));var logger=require(_0x2007('0x6'))('rpc');var config=require(_0x2007('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2007('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3087a3,_0x13aaa2,_0x3fbf26){return new BPromise(function(_0x4a179a,_0x4037c3){return client[_0x2007('0x9')](_0x3087a3,_0x3fbf26)[_0x2007('0xa')](function(_0x3f11fe){logger[_0x2007('0xb')](_0x2007('0xc'),_0x13aaa2,_0x2007('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x13aaa2,_0x2007('0xd'),JSON['stringify'](_0x3f11fe));if(_0x3f11fe['error']){if(_0x3f11fe[_0x2007('0xe')][_0x2007('0xf')]===0x1f4){logger[_0x2007('0xe')](_0x2007('0xc'),_0x13aaa2,_0x3f11fe[_0x2007('0xe')][_0x2007('0x10')]);return _0x4037c3(_0x3f11fe['error'][_0x2007('0x10')]);}logger[_0x2007('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x13aaa2,_0x3f11fe[_0x2007('0xe')][_0x2007('0x10')]);return _0x4a179a(_0x3f11fe[_0x2007('0xe')]['message']);}else{logger[_0x2007('0xb')](_0x2007('0xc'),_0x13aaa2,_0x2007('0xd'));_0x4a179a(_0x3f11fe[_0x2007('0x11')][_0x2007('0x10')]);}})[_0x2007('0x12')](function(_0x37e246){logger[_0x2007('0xe')](_0x2007('0xc'),_0x13aaa2,_0x37e246);_0x4037c3(_0x37e246);});});} \ No newline at end of file +var _0x7513=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x73adff,_0x3aa322){var _0x1e96f6=function(_0x3ec272){while(--_0x3ec272){_0x73adff['push'](_0x73adff['shift']());}};_0x1e96f6(++_0x3aa322);}(_0x7513,0x1b1));var _0x3751=function(_0x1022f8,_0x5e1757){_0x1022f8=_0x1022f8-0x0;var _0x5fbcc=_0x7513[_0x1022f8];return _0x5fbcc;};'use strict';var _=require('lodash');var util=require(_0x3751('0x0'));var moment=require(_0x3751('0x1'));var BPromise=require(_0x3751('0x2'));var rs=require(_0x3751('0x3'));var fs=require('fs');var Redis=require(_0x3751('0x4'));var db=require(_0x3751('0x5'))['db'];var utils=require(_0x3751('0x6'));var logger=require(_0x3751('0x7'))(_0x3751('0x8'));var config=require(_0x3751('0x9'));var jayson=require(_0x3751('0xa'));var client=jayson[_0x3751('0xb')][_0x3751('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2751f3,_0x433de4,_0x159898){return new BPromise(function(_0x443cc2,_0x2de475){return client[_0x3751('0xd')](_0x2751f3,_0x159898)[_0x3751('0xe')](function(_0x599a3e){logger[_0x3751('0xf')](_0x3751('0x10'),_0x433de4,_0x3751('0x11'));logger[_0x3751('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x433de4,_0x3751('0x11'),JSON[_0x3751('0x13')](_0x599a3e));if(_0x599a3e[_0x3751('0x14')]){if(_0x599a3e[_0x3751('0x14')]['code']===0x1f4){logger[_0x3751('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x433de4,_0x599a3e['error'][_0x3751('0x15')]);return _0x2de475(_0x599a3e[_0x3751('0x14')][_0x3751('0x15')]);}logger[_0x3751('0x14')](_0x3751('0x10'),_0x433de4,_0x599a3e[_0x3751('0x14')][_0x3751('0x15')]);return _0x443cc2(_0x599a3e[_0x3751('0x14')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x433de4,_0x3751('0x11'));_0x443cc2(_0x599a3e[_0x3751('0x16')][_0x3751('0x15')]);}})[_0x3751('0x17')](function(_0x1c07cd){logger[_0x3751('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x433de4,_0x1c07cd);_0x2de475(_0x1c07cd);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 60ff89d..8bab4f0 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 _0xc528=['create','delete','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','post'];(function(_0x51ee2c,_0x24ce75){var _0x5d76c2=function(_0x4f13f1){while(--_0x4f13f1){_0x51ee2c['push'](_0x51ee2c['shift']());}};_0x5d76c2(++_0x24ce75);}(_0xc528,0x80));var _0x8c52=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc528[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x8c52('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c52('0x1')]();var fs_extra=require(_0x8c52('0x2'));var auth=require(_0x8c52('0x3'));var interaction=require(_0x8c52('0x4'));var config=require(_0x8c52('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0x8c52('0x6')]('/',auth[_0x8c52('0x7')](),controller[_0x8c52('0x8')]);router[_0x8c52('0x6')](_0x8c52('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8c52('0x6')](_0x8c52('0xa'),auth[_0x8c52('0x7')](),controller['download']);router[_0x8c52('0xb')]('/',auth[_0x8c52('0x7')](),controller[_0x8c52('0xc')]);router['put']('/:id',auth[_0x8c52('0x7')](),controller['update']);router[_0x8c52('0xd')](_0x8c52('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x72fa=['index','/:id','download','post','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x72fa,0x13a));var _0xa72f=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x72fa[_0x4c7b20];return _0x4872bd;};'use strict';var multer=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var path=require(_0xa72f('0x2'));var timeout=require(_0xa72f('0x3'));var express=require(_0xa72f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa72f('0x5'));var interaction=require(_0xa72f('0x6'));var config=require(_0xa72f('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xa72f('0x8')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0xa')]);router[_0xa72f('0x8')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller['show']);router[_0xa72f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xa72f('0xc')]);router[_0xa72f('0xd')]('/',auth[_0xa72f('0x9')](),controller[_0xa72f('0xe')]);router[_0xa72f('0xf')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller['update']);router[_0xa72f('0x10')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller['destroy']);module[_0xa72f('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 b0a05f0..9438083 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 _0x8a0e=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3aeb72,_0x3b871d){var _0x386c52=function(_0x13c587){while(--_0x13c587){_0x3aeb72['push'](_0x3aeb72['shift']());}};_0x386c52(++_0x3b871d);}(_0x8a0e,0x6f));var _0xe8a0=function(_0x24dd7f,_0x33ccb1){_0x24dd7f=_0x24dd7f-0x0;var _0x50b26b=_0x8a0e[_0x24dd7f];return _0x50b26b;};'use strict';var Sequelize=require(_0xe8a0('0x0'));module[_0xe8a0('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xe8a0('0x2')]},'function':{'type':Sequelize[_0xe8a0('0x2')]},'format':{'type':Sequelize[_0xe8a0('0x2')]},'groupBy':{'type':Sequelize[_0xe8a0('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe8a0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbb34=['STRING','BOOLEAN','TEXT'];(function(_0x134979,_0xdb9496){var _0x60ff15=function(_0x46fb31){while(--_0x46fb31){_0x134979['push'](_0x134979['shift']());}};_0x60ff15(++_0xdb9496);}(_0xbb34,0x68));var _0x4bb3=function(_0x37c97d,_0x3205f0){_0x37c97d=_0x37c97d-0x0;var _0x3add5c=_0xbb34[_0x37c97d];return _0x3add5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x4bb3('0x0')]},'alias':{'type':Sequelize[_0x4bb3('0x1')]},'function':{'type':Sequelize[_0x4bb3('0x1')]},'format':{'type':Sequelize[_0x4bb3('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4bb3('0x1')]},'custom':{'type':Sequelize[_0x4bb3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e07c441..04f095c 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 _0x07a2=['filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','destroy','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick'];(function(_0xdae8e6,_0x34854a){var _0x24c7a7=function(_0x5492a3){while(--_0x5492a3){_0xdae8e6['push'](_0xdae8e6['shift']());}};_0x24c7a7(++_0x34854a);}(_0x07a2,0x105));var _0x207a=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x07a2[_0x21aec3];return _0x288bbc;};'use strict';var emlformat=require(_0x207a('0x0'));var rimraf=require(_0x207a('0x1'));var zipdir=require(_0x207a('0x2'));var jsonpatch=require(_0x207a('0x3'));var rp=require(_0x207a('0x4'));var moment=require(_0x207a('0x5'));var BPromise=require(_0x207a('0x6'));var Mustache=require(_0x207a('0x7'));var util=require(_0x207a('0x8'));var path=require(_0x207a('0x9'));var sox=require(_0x207a('0xa'));var csv=require(_0x207a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x207a('0xc'));var jsforce=require(_0x207a('0xd'));var deskjs=require(_0x207a('0xe'));var toCsv=require(_0x207a('0xb'));var querystring=require(_0x207a('0xf'));var Papa=require(_0x207a('0x10'));var Redis=require('ioredis');var authService=require(_0x207a('0x11'));var qs=require(_0x207a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x207a('0x13'));var logger=require(_0x207a('0x14'))(_0x207a('0x15'));var utils=require(_0x207a('0x16'));var config=require(_0x207a('0x17'));var licenseUtil=require(_0x207a('0x18'));var db=require(_0x207a('0x19'))['db'];function respondWithStatusCode(_0x21d0a5,_0x89260c){_0x89260c=_0x89260c||0xcc;return function(_0x32901f){if(_0x32901f){return _0x21d0a5['sendStatus'](_0x89260c);}return _0x21d0a5['status'](_0x89260c)[_0x207a('0x1a')]();};}function respondWithResult(_0x4e3c47,_0x2559dd){_0x2559dd=_0x2559dd||0xc8;return function(_0x4497f1){if(_0x4497f1){return _0x4e3c47[_0x207a('0x1b')](_0x2559dd)[_0x207a('0x1c')](_0x4497f1);}};}function respondWithFilteredResult(_0x2e88f7,_0x2bfbf1){return function(_0x4207c2){if(_0x4207c2){var _0x1633bf=typeof _0x2bfbf1[_0x207a('0x1d')]===_0x207a('0x1e')&&typeof _0x2bfbf1[_0x207a('0x1f')]===_0x207a('0x1e');var _0x1ebbc6=_0x4207c2['count'];var _0x13a96c=_0x1633bf?0x0:_0x2bfbf1['offset'];var _0x4a9ce4=_0x1633bf?_0x4207c2[_0x207a('0x20')]:_0x2bfbf1[_0x207a('0x1d')]+_0x2bfbf1[_0x207a('0x1f')];var _0x16488a;if(_0x4a9ce4>=_0x1ebbc6){_0x4a9ce4=_0x1ebbc6;_0x16488a=0xc8;}else{_0x16488a=0xce;}_0x2e88f7[_0x207a('0x1b')](_0x16488a);return _0x2e88f7[_0x207a('0x21')]('Content-Range',_0x13a96c+'-'+_0x4a9ce4+'/'+_0x1ebbc6)['json'](_0x4207c2);}return null;};}function patchUpdates(_0x284c53){return function(_0x677ad6){try{jsonpatch[_0x207a('0x22')](_0x677ad6,_0x284c53,!![]);}catch(_0x98c3f8){return BPromise[_0x207a('0x23')](_0x98c3f8);}return _0x677ad6['save']();};}function saveUpdates(_0x38cf2c,_0x4ccab2){return function(_0x334494){if(_0x334494){return _0x334494[_0x207a('0x24')](_0x38cf2c)['then'](function(_0x2dedc5){return _0x2dedc5;});}return null;};}function removeEntity(_0x434887,_0x361483){return function(_0x5a1559){if(_0x5a1559){return _0x5a1559['destroy']()[_0x207a('0x25')](function(){_0x434887[_0x207a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d2ca,_0x50f059){return function(_0x2f70a1){if(!_0x2f70a1){_0x29d2ca[_0x207a('0x26')](0x194);}return _0x2f70a1;};}function handleError(_0x5763c2,_0x58e897){_0x58e897=_0x58e897||0x1f4;return function(_0x28eb5e){logger['error'](_0x28eb5e[_0x207a('0x27')]);if(_0x28eb5e[_0x207a('0x28')]){delete _0x28eb5e[_0x207a('0x28')];}_0x5763c2['status'](_0x58e897)['send'](_0x28eb5e);};}exports['index']=function(_0x4b069f,_0x2fc8a1){var _0x24cfb2={},_0x26ac36={},_0x3fedfe={'count':0x0,'rows':[]};var _0x1602de=_[_0x207a('0x29')](db[_0x207a('0x2a')][_0x207a('0x2b')],function(_0x4d4c47){return{'name':_0x4d4c47[_0x207a('0x2c')],'type':_0x4d4c47['type'][_0x207a('0x2d')]};});_0x26ac36[_0x207a('0x2e')]=_[_0x207a('0x29')](_0x1602de,'name');_0x26ac36[_0x207a('0x2f')]=_[_0x207a('0x30')](_0x4b069f[_0x207a('0x2f')]);_0x26ac36[_0x207a('0x31')]=_[_0x207a('0x32')](_0x26ac36[_0x207a('0x2e')],_0x26ac36[_0x207a('0x2f')]);_0x24cfb2[_0x207a('0x33')]=_[_0x207a('0x32')](_0x26ac36[_0x207a('0x2e')],qs[_0x207a('0x34')](_0x4b069f[_0x207a('0x2f')][_0x207a('0x34')]));_0x24cfb2[_0x207a('0x33')]=_0x24cfb2[_0x207a('0x33')][_0x207a('0x35')]?_0x24cfb2[_0x207a('0x33')]:_0x26ac36[_0x207a('0x2e')];if(!_0x4b069f[_0x207a('0x2f')][_0x207a('0x36')](_0x207a('0x37'))){_0x24cfb2['limit']=qs['limit'](_0x4b069f[_0x207a('0x2f')][_0x207a('0x1f')]);_0x24cfb2[_0x207a('0x1d')]=qs[_0x207a('0x1d')](_0x4b069f[_0x207a('0x2f')]['offset']);}_0x24cfb2[_0x207a('0x38')]=qs['sort'](_0x4b069f['query']['sort']);_0x24cfb2[_0x207a('0x39')]=qs[_0x207a('0x31')](_[_0x207a('0x3a')](_0x4b069f['query'],_0x26ac36['filters']),_0x1602de);if(_0x4b069f[_0x207a('0x2f')][_0x207a('0x3b')]){_0x24cfb2[_0x207a('0x39')]=_[_0x207a('0x3c')](_0x24cfb2[_0x207a('0x39')],{'$or':_['map'](_0x1602de,function(_0x160185){if(_0x160185['type']!==_0x207a('0x3d')){var _0x3d726a={};_0x3d726a[_0x160185[_0x207a('0x28')]]={'$like':'%'+_0x4b069f[_0x207a('0x2f')]['filter']+'%'};return _0x3d726a;}})});}_0x24cfb2=_[_0x207a('0x3c')]({},_0x24cfb2,_0x4b069f['options']);var _0x7c3646={'where':_0x24cfb2[_0x207a('0x39')]};return db[_0x207a('0x2a')][_0x207a('0x20')](_0x7c3646)[_0x207a('0x25')](function(_0x8884a2){_0x3fedfe[_0x207a('0x20')]=_0x8884a2;if(_0x4b069f['query']['includeAll']){_0x24cfb2[_0x207a('0x3e')]=[{'all':!![]}];}return db[_0x207a('0x2a')][_0x207a('0x3f')](_0x24cfb2);})['then'](function(_0x5f19ea){_0x3fedfe['rows']=_0x5f19ea;return _0x3fedfe;})[_0x207a('0x25')](respondWithFilteredResult(_0x2fc8a1,_0x24cfb2))[_0x207a('0x40')](handleError(_0x2fc8a1,null));};exports[_0x207a('0x41')]=function(_0x52fea0,_0x53dbc3){var _0x40d5c0={'raw':![],'where':{'id':_0x52fea0[_0x207a('0x42')]['id']}},_0x508b75={};_0x508b75[_0x207a('0x2e')]=_['keys'](db[_0x207a('0x2a')]['rawAttributes']);_0x508b75['query']=_['keys'](_0x52fea0['query']);_0x508b75[_0x207a('0x31')]=_[_0x207a('0x32')](_0x508b75[_0x207a('0x2e')],_0x508b75['query']);_0x40d5c0[_0x207a('0x33')]=_[_0x207a('0x32')](_0x508b75['model'],qs[_0x207a('0x34')](_0x52fea0[_0x207a('0x2f')][_0x207a('0x34')]));_0x40d5c0[_0x207a('0x33')]=_0x40d5c0['attributes']['length']?_0x40d5c0['attributes']:_0x508b75[_0x207a('0x2e')];if(_0x52fea0[_0x207a('0x2f')][_0x207a('0x43')]){_0x40d5c0[_0x207a('0x3e')]=[{'all':!![]}];}_0x40d5c0=_[_0x207a('0x3c')]({},_0x40d5c0,_0x52fea0['options']);return db[_0x207a('0x2a')][_0x207a('0x44')](_0x40d5c0)[_0x207a('0x25')](handleEntityNotFound(_0x53dbc3,null))['then'](respondWithResult(_0x53dbc3,null))['catch'](handleError(_0x53dbc3,null));};exports['create']=function(_0x315152,_0xc59999){return db[_0x207a('0x2a')][_0x207a('0x45')](_0x315152[_0x207a('0x46')],{})[_0x207a('0x25')](respondWithResult(_0xc59999,0xc9))['catch'](handleError(_0xc59999,null));};exports['bulkCreate']=function(_0x63ae9f,_0x5a9fef){return db[_0x207a('0x2a')][_0x207a('0x47')](_0x63ae9f[_0x207a('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5a9fef,0xc9))[_0x207a('0x40')](handleError(_0x5a9fef,null));};exports[_0x207a('0x24')]=function(_0x4994b7,_0x33e3c0){if(_0x4994b7[_0x207a('0x46')]['id']){delete _0x4994b7[_0x207a('0x46')]['id'];}return db[_0x207a('0x2a')][_0x207a('0x44')]({'where':{'id':_0x4994b7['params']['id']}})[_0x207a('0x25')](handleEntityNotFound(_0x33e3c0,null))[_0x207a('0x25')](saveUpdates(_0x4994b7['body'],null))[_0x207a('0x25')](respondWithResult(_0x33e3c0,null))[_0x207a('0x40')](handleError(_0x33e3c0,null));};exports['destroy']=function(_0xfc9422,_0x17ba61){return db['AnalyticFieldReport'][_0x207a('0x44')]({'where':{'id':_0xfc9422[_0x207a('0x42')]['id']}})['then'](handleEntityNotFound(_0x17ba61,null))[_0x207a('0x25')](removeEntity(_0x17ba61,null))[_0x207a('0x40')](handleError(_0x17ba61,null));};exports[_0x207a('0x48')]=function(_0x5336d2,_0x1ad507){return db[_0x207a('0x2a')]['destroy']({'where':{'id':_0x5336d2[_0x207a('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x207a('0x25')](respondWithResult(_0x1ad507,0xcc))['catch'](handleError(_0x1ad507,null));};exports[_0x207a('0x49')]=function(_0x24aeef,_0x4ed5a7,_0x347c95){return db[_0x207a('0x4a')][_0x207a('0x4b')]({'where':{'id':_0x24aeef[_0x207a('0x42')]['id']}})[_0x207a('0x25')](handleEntityNotFound(_0x4ed5a7,null))[_0x207a('0x25')](function(_0x13b2db){if(_0x13b2db){return db[_0x207a('0x4c')][_0x207a('0x4d')](function(_0x4b5936){return db[_0x207a('0x2a')][_0x207a('0x4e')]({'where':{'CustomReportId':_0x24aeef[_0x207a('0x42')]['id']},'transaction':_0x4b5936})[_0x207a('0x25')](function(_0x500d22){var _0x25ab7c=_['map'](_0x24aeef[_0x207a('0x46')],function(_0x3f07ec){delete _0x3f07ec['id'];_0x3f07ec[_0x207a('0x4f')]=_0x24aeef[_0x207a('0x42')]['id'];return _0x3f07ec;});return db[_0x207a('0x2a')][_0x207a('0x47')](_0x25ab7c,{'transaction':_0x4b5936});});})['then'](function(){return db[_0x207a('0x2a')][_0x207a('0x3f')]({'where':{'CustomReportId':_0x24aeef[_0x207a('0x42')]['id']}});});}})[_0x207a('0x25')](respondWithResult(_0x4ed5a7,null))['catch'](handleError(_0x4ed5a7,null));}; \ No newline at end of file +var _0xf25a=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','body','destroy','bulkDestroy','ids','addFields','sequelize','CustomReportId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','end','error','name','send','AnalyticFieldReport','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields'];(function(_0x455802,_0x55399e){var _0x42061e=function(_0x3dcaf9){while(--_0x3dcaf9){_0x455802['push'](_0x455802['shift']());}};_0x42061e(++_0x55399e);}(_0xf25a,0x195));var _0xaf25=function(_0x1beb0e,_0x1c3775){_0x1beb0e=_0x1beb0e-0x0;var _0x55a574=_0xf25a[_0x1beb0e];return _0x55a574;};'use strict';var emlformat=require(_0xaf25('0x0'));var rimraf=require(_0xaf25('0x1'));var zipdir=require(_0xaf25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf25('0x3'));var moment=require(_0xaf25('0x4'));var BPromise=require(_0xaf25('0x5'));var Mustache=require('mustache');var util=require(_0xaf25('0x6'));var path=require(_0xaf25('0x7'));var sox=require(_0xaf25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf25('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf25('0xa'));var jsforce=require(_0xaf25('0xb'));var deskjs=require(_0xaf25('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaf25('0xd'));var Papa=require(_0xaf25('0xe'));var Redis=require(_0xaf25('0xf'));var authService=require(_0xaf25('0x10'));var qs=require(_0xaf25('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf25('0x12'));var logger=require(_0xaf25('0x13'))(_0xaf25('0x14'));var utils=require(_0xaf25('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf25('0x16'))['db'];function respondWithStatusCode(_0x19967b,_0x2503a3){_0x2503a3=_0x2503a3||0xcc;return function(_0x2fc5cd){if(_0x2fc5cd){return _0x19967b[_0xaf25('0x17')](_0x2503a3);}return _0x19967b['status'](_0x2503a3)['end']();};}function respondWithResult(_0x41a29a,_0x47bc60){_0x47bc60=_0x47bc60||0xc8;return function(_0x180b43){if(_0x180b43){return _0x41a29a[_0xaf25('0x18')](_0x47bc60)[_0xaf25('0x19')](_0x180b43);}};}function respondWithFilteredResult(_0x8939d5,_0x4a07b0){return function(_0x281dfb){if(_0x281dfb){var _0x59e267=typeof _0x4a07b0['offset']===_0xaf25('0x1a')&&typeof _0x4a07b0['limit']===_0xaf25('0x1a');var _0x3e8378=_0x281dfb[_0xaf25('0x1b')];var _0x2c815a=_0x59e267?0x0:_0x4a07b0[_0xaf25('0x1c')];var _0x10ed9a=_0x59e267?_0x281dfb[_0xaf25('0x1b')]:_0x4a07b0[_0xaf25('0x1c')]+_0x4a07b0[_0xaf25('0x1d')];var _0x396210;if(_0x10ed9a>=_0x3e8378){_0x10ed9a=_0x3e8378;_0x396210=0xc8;}else{_0x396210=0xce;}_0x8939d5['status'](_0x396210);return _0x8939d5[_0xaf25('0x1e')]('Content-Range',_0x2c815a+'-'+_0x10ed9a+'/'+_0x3e8378)[_0xaf25('0x19')](_0x281dfb);}return null;};}function patchUpdates(_0x396af4){return function(_0x1359d4){try{jsonpatch[_0xaf25('0x1f')](_0x1359d4,_0x396af4,!![]);}catch(_0x35e9e8){return BPromise[_0xaf25('0x20')](_0x35e9e8);}return _0x1359d4[_0xaf25('0x21')]();};}function saveUpdates(_0x468ff6,_0x2d8b66){return function(_0x29f08c){if(_0x29f08c){return _0x29f08c[_0xaf25('0x22')](_0x468ff6)[_0xaf25('0x23')](function(_0x34fd8f){return _0x34fd8f;});}return null;};}function removeEntity(_0x1e07ab,_0x3389be){return function(_0xb72350){if(_0xb72350){return _0xb72350['destroy']()[_0xaf25('0x23')](function(){_0x1e07ab[_0xaf25('0x18')](0xcc)[_0xaf25('0x24')]();});}};}function handleEntityNotFound(_0x362e22,_0x47382b){return function(_0x41c32a){if(!_0x41c32a){_0x362e22['sendStatus'](0x194);}return _0x41c32a;};}function handleError(_0x55ee96,_0x14dc53){_0x14dc53=_0x14dc53||0x1f4;return function(_0x12de62){logger[_0xaf25('0x25')](_0x12de62['stack']);if(_0x12de62['name']){delete _0x12de62[_0xaf25('0x26')];}_0x55ee96['status'](_0x14dc53)[_0xaf25('0x27')](_0x12de62);};}exports['index']=function(_0x15c970,_0x2db561){var _0x253254={},_0x50cb67={},_0x1d7c2d={'count':0x0,'rows':[]};var _0x12ef43=_['map'](db[_0xaf25('0x28')][_0xaf25('0x29')],function(_0x53ad4f){return{'name':_0x53ad4f['fieldName'],'type':_0x53ad4f['type'][_0xaf25('0x2a')]};});_0x50cb67[_0xaf25('0x2b')]=_[_0xaf25('0x2c')](_0x12ef43,_0xaf25('0x26'));_0x50cb67[_0xaf25('0x2d')]=_[_0xaf25('0x2e')](_0x15c970[_0xaf25('0x2d')]);_0x50cb67[_0xaf25('0x2f')]=_['intersection'](_0x50cb67[_0xaf25('0x2b')],_0x50cb67[_0xaf25('0x2d')]);_0x253254[_0xaf25('0x30')]=_[_0xaf25('0x31')](_0x50cb67[_0xaf25('0x2b')],qs[_0xaf25('0x32')](_0x15c970['query'][_0xaf25('0x32')]));_0x253254[_0xaf25('0x30')]=_0x253254['attributes']['length']?_0x253254[_0xaf25('0x30')]:_0x50cb67['model'];if(!_0x15c970[_0xaf25('0x2d')]['hasOwnProperty'](_0xaf25('0x33'))){_0x253254[_0xaf25('0x1d')]=qs[_0xaf25('0x1d')](_0x15c970[_0xaf25('0x2d')][_0xaf25('0x1d')]);_0x253254[_0xaf25('0x1c')]=qs[_0xaf25('0x1c')](_0x15c970[_0xaf25('0x2d')]['offset']);}_0x253254[_0xaf25('0x34')]=qs[_0xaf25('0x35')](_0x15c970[_0xaf25('0x2d')]['sort']);_0x253254[_0xaf25('0x36')]=qs[_0xaf25('0x2f')](_[_0xaf25('0x37')](_0x15c970[_0xaf25('0x2d')],_0x50cb67[_0xaf25('0x2f')]),_0x12ef43);if(_0x15c970[_0xaf25('0x2d')][_0xaf25('0x38')]){_0x253254[_0xaf25('0x36')]=_[_0xaf25('0x39')](_0x253254[_0xaf25('0x36')],{'$or':_['map'](_0x12ef43,function(_0x268511){if(_0x268511['type']!=='VIRTUAL'){var _0x1747af={};_0x1747af[_0x268511[_0xaf25('0x26')]]={'$like':'%'+_0x15c970['query'][_0xaf25('0x38')]+'%'};return _0x1747af;}})});}_0x253254=_[_0xaf25('0x39')]({},_0x253254,_0x15c970[_0xaf25('0x3a')]);var _0x29270b={'where':_0x253254['where']};return db[_0xaf25('0x28')]['count'](_0x29270b)['then'](function(_0x56c171){_0x1d7c2d[_0xaf25('0x1b')]=_0x56c171;if(_0x15c970[_0xaf25('0x2d')][_0xaf25('0x3b')]){_0x253254['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xaf25('0x3c')](_0x253254);})[_0xaf25('0x23')](function(_0x5dd55b){_0x1d7c2d[_0xaf25('0x3d')]=_0x5dd55b;return _0x1d7c2d;})[_0xaf25('0x23')](respondWithFilteredResult(_0x2db561,_0x253254))[_0xaf25('0x3e')](handleError(_0x2db561,null));};exports[_0xaf25('0x3f')]=function(_0x12ca9b,_0x4a9642){var _0x496dfa={'raw':![],'where':{'id':_0x12ca9b[_0xaf25('0x40')]['id']}},_0x42c7cc={};_0x42c7cc[_0xaf25('0x2b')]=_[_0xaf25('0x2e')](db[_0xaf25('0x28')][_0xaf25('0x29')]);_0x42c7cc['query']=_[_0xaf25('0x2e')](_0x12ca9b[_0xaf25('0x2d')]);_0x42c7cc[_0xaf25('0x2f')]=_['intersection'](_0x42c7cc[_0xaf25('0x2b')],_0x42c7cc[_0xaf25('0x2d')]);_0x496dfa[_0xaf25('0x30')]=_[_0xaf25('0x31')](_0x42c7cc[_0xaf25('0x2b')],qs[_0xaf25('0x32')](_0x12ca9b[_0xaf25('0x2d')][_0xaf25('0x32')]));_0x496dfa[_0xaf25('0x30')]=_0x496dfa[_0xaf25('0x30')][_0xaf25('0x41')]?_0x496dfa[_0xaf25('0x30')]:_0x42c7cc[_0xaf25('0x2b')];if(_0x12ca9b['query'][_0xaf25('0x3b')]){_0x496dfa[_0xaf25('0x42')]=[{'all':!![]}];}_0x496dfa=_[_0xaf25('0x39')]({},_0x496dfa,_0x12ca9b[_0xaf25('0x3a')]);return db['AnalyticFieldReport'][_0xaf25('0x43')](_0x496dfa)['then'](handleEntityNotFound(_0x4a9642,null))[_0xaf25('0x23')](respondWithResult(_0x4a9642,null))[_0xaf25('0x3e')](handleError(_0x4a9642,null));};exports['create']=function(_0x2e954d,_0x482d0f){return db['AnalyticFieldReport']['create'](_0x2e954d['body'],{})['then'](respondWithResult(_0x482d0f,0xc9))[_0xaf25('0x3e')](handleError(_0x482d0f,null));};exports['bulkCreate']=function(_0xc7508d,_0x534e9d){return db[_0xaf25('0x28')]['bulkCreate'](_0xc7508d[_0xaf25('0x44')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x534e9d,0xc9))[_0xaf25('0x3e')](handleError(_0x534e9d,null));};exports['update']=function(_0x606583,_0x548abc){if(_0x606583[_0xaf25('0x44')]['id']){delete _0x606583['body']['id'];}return db[_0xaf25('0x28')][_0xaf25('0x43')]({'where':{'id':_0x606583[_0xaf25('0x40')]['id']}})[_0xaf25('0x23')](handleEntityNotFound(_0x548abc,null))['then'](saveUpdates(_0x606583['body'],null))[_0xaf25('0x23')](respondWithResult(_0x548abc,null))[_0xaf25('0x3e')](handleError(_0x548abc,null));};exports[_0xaf25('0x45')]=function(_0x54a5b8,_0x50e45c){return db[_0xaf25('0x28')]['find']({'where':{'id':_0x54a5b8[_0xaf25('0x40')]['id']}})[_0xaf25('0x23')](handleEntityNotFound(_0x50e45c,null))[_0xaf25('0x23')](removeEntity(_0x50e45c,null))[_0xaf25('0x3e')](handleError(_0x50e45c,null));};exports[_0xaf25('0x46')]=function(_0xb4f638,_0x3282c8){return db[_0xaf25('0x28')][_0xaf25('0x45')]({'where':{'id':_0xb4f638['query'][_0xaf25('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0xaf25('0x23')](respondWithResult(_0x3282c8,0xcc))[_0xaf25('0x3e')](handleError(_0x3282c8,null));};exports[_0xaf25('0x48')]=function(_0x327d84,_0x444685,_0x332312){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x327d84['params']['id']}})['then'](handleEntityNotFound(_0x444685,null))[_0xaf25('0x23')](function(_0x3aed68){if(_0x3aed68){return db[_0xaf25('0x49')]['transaction'](function(_0xc2e346){return db[_0xaf25('0x28')][_0xaf25('0x45')]({'where':{'CustomReportId':_0x327d84[_0xaf25('0x40')]['id']},'transaction':_0xc2e346})[_0xaf25('0x23')](function(_0x131042){var _0x52c5c1=_[_0xaf25('0x2c')](_0x327d84[_0xaf25('0x44')],function(_0x577157){delete _0x577157['id'];_0x577157[_0xaf25('0x4a')]=_0x327d84[_0xaf25('0x40')]['id'];return _0x577157;});return db[_0xaf25('0x28')][_0xaf25('0x4b')](_0x52c5c1,{'transaction':_0xc2e346});});})[_0xaf25('0x23')](function(){return db[_0xaf25('0x28')][_0xaf25('0x3c')]({'where':{'CustomReportId':_0x327d84[_0xaf25('0x40')]['id']}});});}})[_0xaf25('0x23')](respondWithResult(_0x444685,null))[_0xaf25('0x3e')](handleError(_0x444685,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e3a2d19..10dc58d 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 _0xc0a7=['analytics_report_fields','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0x1a9eb4,_0x472580){var _0x46be6f=function(_0x139239){while(--_0x139239){_0x1a9eb4['push'](_0x1a9eb4['shift']());}};_0x46be6f(++_0x472580);}(_0xc0a7,0xaf));var _0x7c0a=function(_0x53962f,_0x7d10d4){_0x53962f=_0x53962f-0x0;var _0x4c559d=_0xc0a7[_0x53962f];return _0x4c559d;};'use strict';var _=require('lodash');var util=require(_0x7c0a('0x0'));var logger=require(_0x7c0a('0x1'))(_0x7c0a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c0a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7c0a('0x4'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x2dc02d,_0x538422){return _0x2dc02d['define']('AnalyticFieldReport',attributes,{'tableName':_0x7c0a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5750=['exports','define','analytics_report_fields','api','moment','request-promise','path','rimraf','./analyticFieldReport.attributes'];(function(_0x3a6b28,_0x52e414){var _0x56ac74=function(_0x2c87eb){while(--_0x2c87eb){_0x3a6b28['push'](_0x3a6b28['shift']());}};_0x56ac74(++_0x52e414);}(_0x5750,0x108));var _0x0575=function(_0x318cb9,_0x3ea74b){_0x318cb9=_0x318cb9-0x0;var _0x154fea=_0x5750[_0x318cb9];return _0x154fea;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0575('0x0'));var moment=require(_0x0575('0x1'));var BPromise=require('bluebird');var rp=require(_0x0575('0x2'));var fs=require('fs');var path=require(_0x0575('0x3'));var rimraf=require(_0x0575('0x4'));var config=require('../../config/environment');var attributes=require(_0x0575('0x5'));module[_0x0575('0x6')]=function(_0x19e9ba,_0x2e6ce7){return _0x19e9ba[_0x0575('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x0575('0x8'),'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 9481b5e..a658861 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 _0xc458=['client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xafceaf,_0x5c65ad){var _0x3684e4=function(_0x1aaf86){while(--_0x1aaf86){_0xafceaf['push'](_0xafceaf['shift']());}};_0x3684e4(++_0x5c65ad);}(_0xc458,0x1d8));var _0x8c45=function(_0x3eb969,_0x11c187){_0x3eb969=_0x3eb969-0x0;var _0x5e62e0=_0xc458[_0x3eb969];return _0x5e62e0;};'use strict';var _=require(_0x8c45('0x0'));var util=require(_0x8c45('0x1'));var moment=require(_0x8c45('0x2'));var BPromise=require(_0x8c45('0x3'));var rs=require(_0x8c45('0x4'));var fs=require('fs');var Redis=require(_0x8c45('0x5'));var db=require(_0x8c45('0x6'))['db'];var utils=require(_0x8c45('0x7'));var logger=require(_0x8c45('0x8'))('rpc');var config=require(_0x8c45('0x9'));var jayson=require(_0x8c45('0xa'));var client=jayson[_0x8c45('0xb')][_0x8c45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c9667,_0x156359,_0x31793a){return new BPromise(function(_0x4a5dce,_0x1e4879){return client[_0x8c45('0xd')](_0x1c9667,_0x31793a)['then'](function(_0x51b7f7){logger[_0x8c45('0xe')](_0x8c45('0xf'),_0x156359,'request\x20sent');logger['debug'](_0x8c45('0x10'),_0x156359,_0x8c45('0x11'),JSON[_0x8c45('0x12')](_0x51b7f7));if(_0x51b7f7['error']){if(_0x51b7f7[_0x8c45('0x13')][_0x8c45('0x14')]===0x1f4){logger[_0x8c45('0x13')](_0x8c45('0xf'),_0x156359,_0x51b7f7[_0x8c45('0x13')][_0x8c45('0x15')]);return _0x1e4879(_0x51b7f7[_0x8c45('0x13')][_0x8c45('0x15')]);}logger['error'](_0x8c45('0xf'),_0x156359,_0x51b7f7[_0x8c45('0x13')][_0x8c45('0x15')]);return _0x4a5dce(_0x51b7f7[_0x8c45('0x13')][_0x8c45('0x15')]);}else{logger[_0x8c45('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x156359,'request\x20sent');_0x4a5dce(_0x51b7f7[_0x8c45('0x16')][_0x8c45('0x15')]);}})['catch'](function(_0x4df54c){logger[_0x8c45('0x13')](_0x8c45('0xf'),_0x156359,_0x4df54c);_0x1e4879(_0x4df54c);});});} \ No newline at end of file +var _0x024f=['debug','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x327059,_0x4641d9){var _0x23e828=function(_0x4dd823){while(--_0x4dd823){_0x327059['push'](_0x327059['shift']());}};_0x23e828(++_0x4641d9);}(_0x024f,0x16e));var _0xf024=function(_0x109312,_0x4e1fa3){_0x109312=_0x109312-0x0;var _0x3c29d5=_0x024f[_0x109312];return _0x3c29d5;};'use strict';var _=require(_0xf024('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf024('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf024('0x2'));var db=require(_0xf024('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf024('0x4'));var jayson=require(_0xf024('0x5'));var client=jayson[_0xf024('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea42b,_0x24f71b,_0xb36316){return new BPromise(function(_0xc8860a,_0x2a723a){return client[_0xf024('0x7')](_0x3ea42b,_0xb36316)[_0xf024('0x8')](function(_0x3f18bd){logger[_0xf024('0x9')](_0xf024('0xa'),_0x24f71b,_0xf024('0xb'));logger[_0xf024('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x24f71b,_0xf024('0xb'),JSON[_0xf024('0xd')](_0x3f18bd));if(_0x3f18bd[_0xf024('0xe')]){if(_0x3f18bd[_0xf024('0xe')]['code']===0x1f4){logger['error'](_0xf024('0xa'),_0x24f71b,_0x3f18bd[_0xf024('0xe')][_0xf024('0xf')]);return _0x2a723a(_0x3f18bd['error']['message']);}logger[_0xf024('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x24f71b,_0x3f18bd['error'][_0xf024('0xf')]);return _0xc8860a(_0x3f18bd[_0xf024('0xe')]['message']);}else{logger[_0xf024('0x9')](_0xf024('0xa'),_0x24f71b,_0xf024('0xb'));_0xc8860a(_0x3f18bd[_0xf024('0x10')][_0xf024('0xf')]);}})[_0xf024('0x11')](function(_0x378111){logger[_0xf024('0xe')](_0xf024('0xa'),_0x24f71b,_0x378111);_0x2a723a(_0x378111);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7138ec3..03f7e28 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(_0x4e7dd5,_0x2e4692){var _0x35d3dc=function(_0x848892){while(--_0x848892){_0x4e7dd5['push'](_0x4e7dd5['shift']());}};_0x35d3dc(++_0x2e4692);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0xad452b,_0x1489ee){var _0x30ed74=function(_0x3a2b1d){while(--_0x3a2b1d){_0xad452b['push'](_0xad452b['shift']());}};_0x30ed74(++_0x1489ee);}(_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'));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 42bdbb9..1957324 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 _0x7427=['STRING','name','TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7427,0x111));var _0x7742=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x7427[_0x37a7c6];return _0x539905;};'use strict';var Sequelize=require(_0x7742('0x0'));module[_0x7742('0x1')]={'name':{'type':Sequelize[_0x7742('0x2')],'allowNull':![],'unique':_0x7742('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7742('0x4')]},'description':{'type':Sequelize[_0x7742('0x2')]}}; \ No newline at end of file +var _0xadcc=['name','TEXT','sequelize','STRING'];(function(_0x48a8d4,_0x3f35bd){var _0x277106=function(_0x5b44ab){while(--_0x5b44ab){_0x48a8d4['push'](_0x48a8d4['shift']());}};_0x277106(++_0x3f35bd);}(_0xadcc,0x76));var _0xcadc=function(_0x209d96,_0x3202dd){_0x209d96=_0x209d96-0x0;var _0x426632=_0xadcc[_0x209d96];return _0x426632;};'use strict';var Sequelize=require(_0xcadc('0x0'));module['exports']={'name':{'type':Sequelize[_0xcadc('0x1')],'allowNull':![],'unique':_0xcadc('0x2')},'table':{'type':Sequelize[_0xcadc('0x1')]},'metric':{'type':Sequelize[_0xcadc('0x3')]},'description':{'type':Sequelize[_0xcadc('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index f385db4..657ec6e 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1cce40,_0x2773c1){var _0x444893=function(_0x21dc75){while(--_0x21dc75){_0x1cce40['push'](_0x1cce40['shift']());}};_0x444893(++_0x2773c1);}(_0x008c,0x188));var _0xc008=function(_0x5deb0a,_0xc192bb){_0x5deb0a=_0x5deb0a-0x0;var _0x33d0ce=_0x008c[_0x5deb0a];return _0x33d0ce;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x52784b,_0x35e2f0){var _0x3e90ec=function(_0x1d507f){while(--_0x1d507f){_0x52784b['push'](_0x52784b['shift']());}};_0x3e90ec(++_0x35e2f0);}(_0x81bd,0x7c));var _0xd81b=function(_0x111ee6,_0xd8a3ea){_0x111ee6=_0x111ee6-0x0;var _0x8bbb51=_0x81bd[_0x111ee6];return _0x8bbb51;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 864d958..2c54b2c 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 _0x15c6=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','AnalyticMetric','analytics_metrics','lodash'];(function(_0x434189,_0x165604){var _0x414ffb=function(_0x4135f2){while(--_0x4135f2){_0x434189['push'](_0x434189['shift']());}};_0x414ffb(++_0x165604);}(_0x15c6,0x1cd));var _0x615c=function(_0xca41dc,_0x22936e){_0xca41dc=_0xca41dc-0x0;var _0x3e125c=_0x15c6[_0xca41dc];return _0x3e125c;};'use strict';var _=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var logger=require(_0x615c('0x2'))(_0x615c('0x3'));var moment=require(_0x615c('0x4'));var BPromise=require(_0x615c('0x5'));var rp=require(_0x615c('0x6'));var fs=require('fs');var path=require(_0x615c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x615c('0x8')]=function(_0x29de56,_0x15eee5){return _0x29de56['define'](_0x615c('0x9'),attributes,{'tableName':_0x615c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b69=['../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x267abc,_0x5ca4e6){var _0x92bb4c=function(_0x482bd6){while(--_0x482bd6){_0x267abc['push'](_0x267abc['shift']());}};_0x92bb4c(++_0x5ca4e6);}(_0x9b69,0xa3));var _0x99b6=function(_0x14143f,_0x1dd3bd){_0x14143f=_0x14143f-0x0;var _0x42485d=_0x9b69[_0x14143f];return _0x42485d;};'use strict';var _=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var logger=require(_0x99b6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x99b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b6('0x4'));var rimraf=require(_0x99b6('0x5'));var config=require(_0x99b6('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x99b6('0x7')]=function(_0x5c4062,_0xbcd357){return _0x5c4062[_0x99b6('0x8')](_0x99b6('0x9'),attributes,{'tableName':_0x99b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0904129..2ddbcc1 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 _0xbd77=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd77,0x138));var _0x7bd7=function(_0x1cefd3,_0x56fd96){_0x1cefd3=_0x1cefd3-0x0;var _0x578975=_0xbd77[_0x1cefd3];return _0x578975;};'use strict';var _=require(_0x7bd7('0x0'));var util=require(_0x7bd7('0x1'));var moment=require('moment');var BPromise=require(_0x7bd7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7bd7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x7bd7('0x4'));var jayson=require(_0x7bd7('0x5'));var client=jayson[_0x7bd7('0x6')][_0x7bd7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e22a8,_0x13ab7e,_0x474be6){return new BPromise(function(_0x1054e5,_0x54fdee){return client[_0x7bd7('0x8')](_0x4e22a8,_0x474be6)['then'](function(_0x20ae37){logger['info'](_0x7bd7('0x9'),_0x13ab7e,'request\x20sent');logger[_0x7bd7('0xa')](_0x7bd7('0xb'),_0x13ab7e,'request\x20sent',JSON[_0x7bd7('0xc')](_0x20ae37));if(_0x20ae37[_0x7bd7('0xd')]){if(_0x20ae37[_0x7bd7('0xd')][_0x7bd7('0xe')]===0x1f4){logger['error'](_0x7bd7('0x9'),_0x13ab7e,_0x20ae37[_0x7bd7('0xd')][_0x7bd7('0xf')]);return _0x54fdee(_0x20ae37[_0x7bd7('0xd')][_0x7bd7('0xf')]);}logger[_0x7bd7('0xd')](_0x7bd7('0x9'),_0x13ab7e,_0x20ae37[_0x7bd7('0xd')][_0x7bd7('0xf')]);return _0x1054e5(_0x20ae37[_0x7bd7('0xd')][_0x7bd7('0xf')]);}else{logger['info'](_0x7bd7('0x9'),_0x13ab7e,_0x7bd7('0x10'));_0x1054e5(_0x20ae37[_0x7bd7('0x11')][_0x7bd7('0xf')]);}})[_0x7bd7('0x12')](function(_0x14a8c2){logger['error'](_0x7bd7('0x9'),_0x13ab7e,_0x14a8c2);_0x54fdee(_0x14a8c2);});});} \ No newline at end of file +var _0x4206=['rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x230363,_0x3cf815){var _0xa88131=function(_0x2016b8){while(--_0x2016b8){_0x230363['push'](_0x230363['shift']());}};_0xa88131(++_0x3cf815);}(_0x4206,0x1ad));var _0x6420=function(_0x24af5d,_0x368251){_0x24af5d=_0x24af5d-0x0;var _0x3137f0=_0x4206[_0x24af5d];return _0x3137f0;};'use strict';var _=require(_0x6420('0x0'));var util=require('util');var moment=require(_0x6420('0x1'));var BPromise=require(_0x6420('0x2'));var rs=require(_0x6420('0x3'));var fs=require('fs');var Redis=require(_0x6420('0x4'));var db=require(_0x6420('0x5'))['db'];var utils=require(_0x6420('0x6'));var logger=require(_0x6420('0x7'))(_0x6420('0x8'));var config=require(_0x6420('0x9'));var jayson=require(_0x6420('0xa'));var client=jayson[_0x6420('0xb')][_0x6420('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x388e82,_0x328dc8,_0x355d18){return new BPromise(function(_0x518c00,_0x3ca2fa){return client[_0x6420('0xd')](_0x388e82,_0x355d18)[_0x6420('0xe')](function(_0x56052a){logger['info'](_0x6420('0xf'),_0x328dc8,'request\x20sent');logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x328dc8,_0x6420('0x10'),JSON[_0x6420('0x11')](_0x56052a));if(_0x56052a[_0x6420('0x12')]){if(_0x56052a[_0x6420('0x12')][_0x6420('0x13')]===0x1f4){logger[_0x6420('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x328dc8,_0x56052a['error'][_0x6420('0x14')]);return _0x3ca2fa(_0x56052a['error'][_0x6420('0x14')]);}logger['error'](_0x6420('0xf'),_0x328dc8,_0x56052a[_0x6420('0x12')][_0x6420('0x14')]);return _0x518c00(_0x56052a['error'][_0x6420('0x14')]);}else{logger[_0x6420('0x15')](_0x6420('0xf'),_0x328dc8,'request\x20sent');_0x518c00(_0x56052a['result'][_0x6420('0x14')]);}})[_0x6420('0x16')](function(_0x2c0864){logger[_0x6420('0x12')](_0x6420('0xf'),_0x328dc8,_0x2c0864);_0x3ca2fa(_0x2c0864);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index bdfbeb6..1845238 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 _0xaa5c=['delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x13657e,_0x581269){var _0x11053c=function(_0x4d77eb){while(--_0x4d77eb){_0x13657e['push'](_0x13657e['shift']());}};_0x11053c(++_0x581269);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x4975cc,_0x2f506f){_0x4975cc=_0x4975cc-0x0;var _0x117c7c=_0xaa5c[_0x4975cc];return _0x117c7c;};'use strict';var multer=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var path=require(_0xcaa5('0x2'));var timeout=require(_0xcaa5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaa5('0x4'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xcaa5('0x5')]('/',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x7')]);router['get'](_0xcaa5('0x8'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x9')]);router[_0xcaa5('0xa')]('/',auth['isAuthenticated'](),controller[_0xcaa5('0xb')]);router[_0xcaa5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcaa5('0xd')]);router[_0xcaa5('0xe')](_0xcaa5('0x8'),auth['isAuthenticated'](),controller[_0xcaa5('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbbbd=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xbbbd,0x86));var _0xdbbb=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbbbd[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var path=require(_0xdbbb('0x2'));var timeout=require(_0xdbbb('0x3'));var express=require(_0xdbbb('0x4'));var router=express[_0xdbbb('0x5')]();var fs_extra=require(_0xdbbb('0x6'));var auth=require(_0xdbbb('0x7'));var interaction=require(_0xdbbb('0x8'));var config=require(_0xdbbb('0x9'));var controller=require(_0xdbbb('0xa'));router[_0xdbbb('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbbb('0xc')]);router[_0xdbbb('0xb')](_0xdbbb('0xd'),auth[_0xdbbb('0xe')](),controller[_0xdbbb('0xf')]);router[_0xdbbb('0x10')]('/',auth[_0xdbbb('0xe')](),controller[_0xdbbb('0x11')]);router[_0xdbbb('0x12')](_0xdbbb('0xd'),auth['isAuthenticated'](),controller[_0xdbbb('0x13')]);router['delete'](_0xdbbb('0xd'),auth['isAuthenticated'](),controller[_0xdbbb('0x14')]);module[_0xdbbb('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b5272ea..7bacb2a 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 _0xff09=['sequelize','TEXT'];(function(_0x5d212e,_0x3626de){var _0x48d3ff=function(_0x17e0dc){while(--_0x17e0dc){_0x5d212e['push'](_0x5d212e['shift']());}};_0x48d3ff(++_0x3626de);}(_0xff09,0x1e6));var _0x9ff0=function(_0x52ae64,_0x2af083){_0x52ae64=_0x52ae64-0x0;var _0x58fc1b=_0xff09[_0x52ae64];return _0x58fc1b;};'use strict';var Sequelize=require(_0x9ff0('0x0'));module['exports']={'tree':{'type':Sequelize[_0x9ff0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5f08=['exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5f08,0x138));var _0x85f0=function(_0x89fea7,_0x27bba7){_0x89fea7=_0x89fea7-0x0;var _0x2d1ba9=_0x5f08[_0x89fea7];return _0x2d1ba9;};'use strict';var Sequelize=require('sequelize');module[_0x85f0('0x0')]={'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 4aeaa01..d097341 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 _0x5ba8=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','sendStatus','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','then','includeAll','findAll','catch','show','params','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox'];(function(_0x50c68b,_0x3ae765){var _0x794966=function(_0x292040){while(--_0x292040){_0x50c68b['push'](_0x50c68b['shift']());}};_0x794966(++_0x3ae765);}(_0x5ba8,0x1ae));var _0x85ba=function(_0xabf99b,_0x3d24d5){_0xabf99b=_0xabf99b-0x0;var _0x50c847=_0x5ba8[_0xabf99b];return _0x50c847;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85ba('0x0'));var zipdir=require(_0x85ba('0x1'));var jsonpatch=require(_0x85ba('0x2'));var rp=require(_0x85ba('0x3'));var moment=require(_0x85ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x85ba('0x5'));var util=require(_0x85ba('0x6'));var path=require('path');var sox=require(_0x85ba('0x7'));var csv=require(_0x85ba('0x8'));var ejs=require(_0x85ba('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ba('0xa'));var squel=require(_0x85ba('0xb'));var crypto=require(_0x85ba('0xc'));var jsforce=require(_0x85ba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x85ba('0x8'));var querystring=require(_0x85ba('0xe'));var Papa=require(_0x85ba('0xf'));var Redis=require(_0x85ba('0x10'));var authService=require(_0x85ba('0x11'));var qs=require(_0x85ba('0x12'));var as=require(_0x85ba('0x13'));var hardwareService=require(_0x85ba('0x14'));var logger=require(_0x85ba('0x15'))('api');var utils=require(_0x85ba('0x16'));var config=require(_0x85ba('0x17'));var licenseUtil=require(_0x85ba('0x18'));var db=require(_0x85ba('0x19'))['db'];function respondWithStatusCode(_0x13587f,_0x1719b9){_0x1719b9=_0x1719b9||0xcc;return function(_0x5b47c4){if(_0x5b47c4){return _0x13587f['sendStatus'](_0x1719b9);}return _0x13587f['status'](_0x1719b9)['end']();};}function respondWithResult(_0x39be2f,_0xc2a60a){_0xc2a60a=_0xc2a60a||0xc8;return function(_0x34c6cf){if(_0x34c6cf){return _0x39be2f[_0x85ba('0x1a')](_0xc2a60a)[_0x85ba('0x1b')](_0x34c6cf);}};}function respondWithFilteredResult(_0x19fef7,_0x4e8737){return function(_0x5ed61d){if(_0x5ed61d){var _0x2252b0=typeof _0x4e8737['offset']===_0x85ba('0x1c')&&typeof _0x4e8737[_0x85ba('0x1d')]===_0x85ba('0x1c');var _0x29e003=_0x5ed61d[_0x85ba('0x1e')];var _0x53c0eb=_0x2252b0?0x0:_0x4e8737[_0x85ba('0x1f')];var _0x525238=_0x2252b0?_0x5ed61d[_0x85ba('0x1e')]:_0x4e8737['offset']+_0x4e8737[_0x85ba('0x1d')];var _0x119753;if(_0x525238>=_0x29e003){_0x525238=_0x29e003;_0x119753=0xc8;}else{_0x119753=0xce;}_0x19fef7['status'](_0x119753);return _0x19fef7[_0x85ba('0x20')]('Content-Range',_0x53c0eb+'-'+_0x525238+'/'+_0x29e003)['json'](_0x5ed61d);}return null;};}function patchUpdates(_0x393463){return function(_0x2140f1){try{jsonpatch[_0x85ba('0x21')](_0x2140f1,_0x393463,!![]);}catch(_0x2ba3b){return BPromise[_0x85ba('0x22')](_0x2ba3b);}return _0x2140f1[_0x85ba('0x23')]();};}function saveUpdates(_0x3f0240,_0x52aefb){return function(_0x158a3c){if(_0x158a3c){return _0x158a3c['update'](_0x3f0240)['then'](function(_0x1d3c2a){return _0x1d3c2a;});}return null;};}function removeEntity(_0x596d19,_0x366984){return function(_0x5f563a){if(_0x5f563a){return _0x5f563a['destroy']()['then'](function(){_0x596d19[_0x85ba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a80b2,_0x584824){return function(_0x937755){if(!_0x937755){_0x5a80b2[_0x85ba('0x24')](0x194);}return _0x937755;};}function handleError(_0x15bd77,_0x5cf7ef){_0x5cf7ef=_0x5cf7ef||0x1f4;return function(_0x12618e){logger['error'](_0x12618e[_0x85ba('0x25')]);if(_0x12618e['name']){delete _0x12618e[_0x85ba('0x26')];}_0x15bd77[_0x85ba('0x1a')](_0x5cf7ef)['send'](_0x12618e);};}exports[_0x85ba('0x27')]=function(_0x5c19eb,_0x234f19){var _0x4688b4={},_0x3f358a={},_0x32e14c={'count':0x0,'rows':[]};var _0x409c3f=_[_0x85ba('0x28')](db[_0x85ba('0x29')][_0x85ba('0x2a')],function(_0x8730eb){return{'name':_0x8730eb[_0x85ba('0x2b')],'type':_0x8730eb[_0x85ba('0x2c')][_0x85ba('0x2d')]};});_0x3f358a['model']=_[_0x85ba('0x28')](_0x409c3f,_0x85ba('0x26'));_0x3f358a['query']=_[_0x85ba('0x2e')](_0x5c19eb[_0x85ba('0x2f')]);_0x3f358a[_0x85ba('0x30')]=_['intersection'](_0x3f358a['model'],_0x3f358a[_0x85ba('0x2f')]);_0x4688b4[_0x85ba('0x31')]=_[_0x85ba('0x32')](_0x3f358a[_0x85ba('0x33')],qs[_0x85ba('0x34')](_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x34')]));_0x4688b4[_0x85ba('0x31')]=_0x4688b4['attributes']['length']?_0x4688b4[_0x85ba('0x31')]:_0x3f358a[_0x85ba('0x33')];if(!_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x35')](_0x85ba('0x36'))){_0x4688b4['limit']=qs[_0x85ba('0x1d')](_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x1d')]);_0x4688b4[_0x85ba('0x1f')]=qs[_0x85ba('0x1f')](_0x5c19eb['query']['offset']);}_0x4688b4[_0x85ba('0x37')]=qs[_0x85ba('0x38')](_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x38')]);_0x4688b4[_0x85ba('0x39')]=qs[_0x85ba('0x30')](_[_0x85ba('0x3a')](_0x5c19eb[_0x85ba('0x2f')],_0x3f358a['filters']),_0x409c3f);if(_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x3b')]){_0x4688b4[_0x85ba('0x39')]=_['merge'](_0x4688b4['where'],{'$or':_['map'](_0x409c3f,function(_0x487770){if(_0x487770['type']!==_0x85ba('0x3c')){var _0xff337b={};_0xff337b[_0x487770[_0x85ba('0x26')]]={'$like':'%'+_0x5c19eb['query'][_0x85ba('0x3b')]+'%'};return _0xff337b;}})});}_0x4688b4=_[_0x85ba('0x3d')]({},_0x4688b4,_0x5c19eb['options']);var _0x4d89ca={'where':_0x4688b4[_0x85ba('0x39')]};return db[_0x85ba('0x29')]['count'](_0x4d89ca)[_0x85ba('0x3e')](function(_0x4c2a12){_0x32e14c[_0x85ba('0x1e')]=_0x4c2a12;if(_0x5c19eb[_0x85ba('0x2f')][_0x85ba('0x3f')]){_0x4688b4['include']=[{'all':!![]}];}return db[_0x85ba('0x29')][_0x85ba('0x40')](_0x4688b4);})[_0x85ba('0x3e')](function(_0x306713){_0x32e14c['rows']=_0x306713;return _0x32e14c;})[_0x85ba('0x3e')](respondWithFilteredResult(_0x234f19,_0x4688b4))[_0x85ba('0x41')](handleError(_0x234f19,null));};exports[_0x85ba('0x42')]=function(_0x54e3d0,_0x301aa0){var _0x28ee0b={'raw':!![],'where':{'id':_0x54e3d0[_0x85ba('0x43')]['id']}},_0x102eed={};_0x102eed[_0x85ba('0x33')]=_[_0x85ba('0x2e')](db[_0x85ba('0x29')]['rawAttributes']);_0x102eed['query']=_[_0x85ba('0x2e')](_0x54e3d0[_0x85ba('0x2f')]);_0x102eed[_0x85ba('0x30')]=_[_0x85ba('0x32')](_0x102eed[_0x85ba('0x33')],_0x102eed['query']);_0x28ee0b[_0x85ba('0x31')]=_[_0x85ba('0x32')](_0x102eed[_0x85ba('0x33')],qs[_0x85ba('0x34')](_0x54e3d0[_0x85ba('0x2f')][_0x85ba('0x34')]));_0x28ee0b['attributes']=_0x28ee0b[_0x85ba('0x31')]['length']?_0x28ee0b[_0x85ba('0x31')]:_0x102eed['model'];if(_0x54e3d0[_0x85ba('0x2f')]['includeAll']){_0x28ee0b['include']=[{'all':!![]}];}_0x28ee0b=_['merge']({},_0x28ee0b,_0x54e3d0[_0x85ba('0x44')]);return db[_0x85ba('0x29')][_0x85ba('0x45')](_0x28ee0b)[_0x85ba('0x3e')](handleEntityNotFound(_0x301aa0,null))['then'](respondWithResult(_0x301aa0,null))[_0x85ba('0x41')](handleError(_0x301aa0,null));};exports[_0x85ba('0x46')]=function(_0x5a64b0,_0x4a929b){return db[_0x85ba('0x29')]['create'](_0x5a64b0['body'],{})[_0x85ba('0x3e')](respondWithResult(_0x4a929b,0xc9))[_0x85ba('0x41')](handleError(_0x4a929b,null));};exports['update']=function(_0x26ac5e,_0x1ad39a){if(_0x26ac5e[_0x85ba('0x47')]['id']){delete _0x26ac5e['body']['id'];}return db[_0x85ba('0x29')][_0x85ba('0x45')]({'where':{'id':_0x26ac5e[_0x85ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ad39a,null))[_0x85ba('0x3e')](saveUpdates(_0x26ac5e[_0x85ba('0x47')],null))[_0x85ba('0x3e')](respondWithResult(_0x1ad39a,null))[_0x85ba('0x41')](handleError(_0x1ad39a,null));};exports[_0x85ba('0x48')]=function(_0x56613a,_0x1e512c){return db['AnalyticTreeReport']['find']({'where':{'id':_0x56613a[_0x85ba('0x43')]['id']}})[_0x85ba('0x3e')](handleEntityNotFound(_0x1e512c,null))[_0x85ba('0x3e')](removeEntity(_0x1e512c,null))['catch'](handleError(_0x1e512c,null));}; \ No newline at end of file +var _0x7cd3=['send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','findAll','catch','show','params','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7cd3,0x1ac));var _0x37cd=function(_0x20d0a1,_0x1846ba){_0x20d0a1=_0x20d0a1-0x0;var _0x180faa=_0x7cd3[_0x20d0a1];return _0x180faa;};'use strict';var emlformat=require(_0x37cd('0x0'));var rimraf=require(_0x37cd('0x1'));var zipdir=require(_0x37cd('0x2'));var jsonpatch=require(_0x37cd('0x3'));var rp=require(_0x37cd('0x4'));var moment=require(_0x37cd('0x5'));var BPromise=require(_0x37cd('0x6'));var Mustache=require(_0x37cd('0x7'));var util=require(_0x37cd('0x8'));var path=require(_0x37cd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x37cd('0xa'));var fs=require('fs');var fs_extra=require(_0x37cd('0xb'));var _=require(_0x37cd('0xc'));var squel=require(_0x37cd('0xd'));var crypto=require(_0x37cd('0xe'));var jsforce=require(_0x37cd('0xf'));var deskjs=require(_0x37cd('0x10'));var toCsv=require(_0x37cd('0x11'));var querystring=require(_0x37cd('0x12'));var Papa=require(_0x37cd('0x13'));var Redis=require(_0x37cd('0x14'));var authService=require(_0x37cd('0x15'));var qs=require(_0x37cd('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37cd('0x17'));var logger=require(_0x37cd('0x18'))(_0x37cd('0x19'));var utils=require(_0x37cd('0x1a'));var config=require(_0x37cd('0x1b'));var licenseUtil=require(_0x37cd('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x344dba,_0x52bdc7){_0x52bdc7=_0x52bdc7||0xcc;return function(_0x4a9e24){if(_0x4a9e24){return _0x344dba['sendStatus'](_0x52bdc7);}return _0x344dba[_0x37cd('0x1d')](_0x52bdc7)[_0x37cd('0x1e')]();};}function respondWithResult(_0x30b024,_0x473583){_0x473583=_0x473583||0xc8;return function(_0x833fe2){if(_0x833fe2){return _0x30b024[_0x37cd('0x1d')](_0x473583)[_0x37cd('0x1f')](_0x833fe2);}};}function respondWithFilteredResult(_0x28b62e,_0x59a3c0){return function(_0xc0046e){if(_0xc0046e){var _0x4eadd3=typeof _0x59a3c0[_0x37cd('0x20')]===_0x37cd('0x21')&&typeof _0x59a3c0[_0x37cd('0x22')]===_0x37cd('0x21');var _0xba44ec=_0xc0046e['count'];var _0x3e6c07=_0x4eadd3?0x0:_0x59a3c0['offset'];var _0x4fa984=_0x4eadd3?_0xc0046e['count']:_0x59a3c0[_0x37cd('0x20')]+_0x59a3c0['limit'];var _0x1bf1e0;if(_0x4fa984>=_0xba44ec){_0x4fa984=_0xba44ec;_0x1bf1e0=0xc8;}else{_0x1bf1e0=0xce;}_0x28b62e[_0x37cd('0x1d')](_0x1bf1e0);return _0x28b62e[_0x37cd('0x23')]('Content-Range',_0x3e6c07+'-'+_0x4fa984+'/'+_0xba44ec)[_0x37cd('0x1f')](_0xc0046e);}return null;};}function patchUpdates(_0x33bc50){return function(_0xf5f019){try{jsonpatch[_0x37cd('0x24')](_0xf5f019,_0x33bc50,!![]);}catch(_0xc28402){return BPromise[_0x37cd('0x25')](_0xc28402);}return _0xf5f019[_0x37cd('0x26')]();};}function saveUpdates(_0x309336,_0x335be2){return function(_0x28f3d8){if(_0x28f3d8){return _0x28f3d8[_0x37cd('0x27')](_0x309336)[_0x37cd('0x28')](function(_0x4c0a9b){return _0x4c0a9b;});}return null;};}function removeEntity(_0x211e6b,_0x35a151){return function(_0x327d1c){if(_0x327d1c){return _0x327d1c[_0x37cd('0x29')]()[_0x37cd('0x28')](function(){_0x211e6b[_0x37cd('0x1d')](0xcc)[_0x37cd('0x1e')]();});}};}function handleEntityNotFound(_0x387252,_0xf03156){return function(_0x18bd00){if(!_0x18bd00){_0x387252[_0x37cd('0x2a')](0x194);}return _0x18bd00;};}function handleError(_0x15d873,_0x3363ba){_0x3363ba=_0x3363ba||0x1f4;return function(_0x530b82){logger[_0x37cd('0x2b')](_0x530b82[_0x37cd('0x2c')]);if(_0x530b82[_0x37cd('0x2d')]){delete _0x530b82['name'];}_0x15d873[_0x37cd('0x1d')](_0x3363ba)[_0x37cd('0x2e')](_0x530b82);};}exports['index']=function(_0x24e57e,_0x1188e7){var _0x3381d1={},_0x3cbc0e={},_0x15ff09={'count':0x0,'rows':[]};var _0x39e943=_[_0x37cd('0x2f')](db[_0x37cd('0x30')][_0x37cd('0x31')],function(_0x4bf0d3){return{'name':_0x4bf0d3[_0x37cd('0x32')],'type':_0x4bf0d3[_0x37cd('0x33')][_0x37cd('0x34')]};});_0x3cbc0e[_0x37cd('0x35')]=_[_0x37cd('0x2f')](_0x39e943,_0x37cd('0x2d'));_0x3cbc0e[_0x37cd('0x36')]=_[_0x37cd('0x37')](_0x24e57e[_0x37cd('0x36')]);_0x3cbc0e[_0x37cd('0x38')]=_[_0x37cd('0x39')](_0x3cbc0e[_0x37cd('0x35')],_0x3cbc0e[_0x37cd('0x36')]);_0x3381d1[_0x37cd('0x3a')]=_[_0x37cd('0x39')](_0x3cbc0e[_0x37cd('0x35')],qs['fields'](_0x24e57e[_0x37cd('0x36')][_0x37cd('0x3b')]));_0x3381d1[_0x37cd('0x3a')]=_0x3381d1['attributes'][_0x37cd('0x3c')]?_0x3381d1[_0x37cd('0x3a')]:_0x3cbc0e[_0x37cd('0x35')];if(!_0x24e57e[_0x37cd('0x36')][_0x37cd('0x3d')](_0x37cd('0x3e'))){_0x3381d1['limit']=qs[_0x37cd('0x22')](_0x24e57e[_0x37cd('0x36')][_0x37cd('0x22')]);_0x3381d1[_0x37cd('0x20')]=qs[_0x37cd('0x20')](_0x24e57e['query'][_0x37cd('0x20')]);}_0x3381d1[_0x37cd('0x3f')]=qs[_0x37cd('0x40')](_0x24e57e['query'][_0x37cd('0x40')]);_0x3381d1[_0x37cd('0x41')]=qs[_0x37cd('0x38')](_['pick'](_0x24e57e[_0x37cd('0x36')],_0x3cbc0e[_0x37cd('0x38')]),_0x39e943);if(_0x24e57e[_0x37cd('0x36')][_0x37cd('0x42')]){_0x3381d1[_0x37cd('0x41')]=_[_0x37cd('0x43')](_0x3381d1['where'],{'$or':_[_0x37cd('0x2f')](_0x39e943,function(_0x1c3c9f){if(_0x1c3c9f['type']!=='VIRTUAL'){var _0x6752e5={};_0x6752e5[_0x1c3c9f[_0x37cd('0x2d')]]={'$like':'%'+_0x24e57e[_0x37cd('0x36')]['filter']+'%'};return _0x6752e5;}})});}_0x3381d1=_[_0x37cd('0x43')]({},_0x3381d1,_0x24e57e['options']);var _0x2658ed={'where':_0x3381d1[_0x37cd('0x41')]};return db[_0x37cd('0x30')][_0x37cd('0x44')](_0x2658ed)['then'](function(_0x126b0b){_0x15ff09[_0x37cd('0x44')]=_0x126b0b;if(_0x24e57e['query'][_0x37cd('0x45')]){_0x3381d1['include']=[{'all':!![]}];}return db[_0x37cd('0x30')][_0x37cd('0x46')](_0x3381d1);})[_0x37cd('0x28')](function(_0x4aec38){_0x15ff09['rows']=_0x4aec38;return _0x15ff09;})[_0x37cd('0x28')](respondWithFilteredResult(_0x1188e7,_0x3381d1))[_0x37cd('0x47')](handleError(_0x1188e7,null));};exports[_0x37cd('0x48')]=function(_0x23bb02,_0x4dbea5){var _0x48698b={'raw':!![],'where':{'id':_0x23bb02[_0x37cd('0x49')]['id']}},_0xc7d8e0={};_0xc7d8e0['model']=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0xc7d8e0[_0x37cd('0x36')]=_[_0x37cd('0x37')](_0x23bb02[_0x37cd('0x36')]);_0xc7d8e0[_0x37cd('0x38')]=_['intersection'](_0xc7d8e0[_0x37cd('0x35')],_0xc7d8e0['query']);_0x48698b[_0x37cd('0x3a')]=_[_0x37cd('0x39')](_0xc7d8e0[_0x37cd('0x35')],qs[_0x37cd('0x3b')](_0x23bb02[_0x37cd('0x36')][_0x37cd('0x3b')]));_0x48698b[_0x37cd('0x3a')]=_0x48698b[_0x37cd('0x3a')][_0x37cd('0x3c')]?_0x48698b[_0x37cd('0x3a')]:_0xc7d8e0[_0x37cd('0x35')];if(_0x23bb02[_0x37cd('0x36')]['includeAll']){_0x48698b[_0x37cd('0x4a')]=[{'all':!![]}];}_0x48698b=_['merge']({},_0x48698b,_0x23bb02[_0x37cd('0x4b')]);return db[_0x37cd('0x30')]['find'](_0x48698b)[_0x37cd('0x28')](handleEntityNotFound(_0x4dbea5,null))[_0x37cd('0x28')](respondWithResult(_0x4dbea5,null))[_0x37cd('0x47')](handleError(_0x4dbea5,null));};exports['create']=function(_0x5f3d4e,_0x25f60f){return db[_0x37cd('0x30')][_0x37cd('0x4c')](_0x5f3d4e[_0x37cd('0x4d')],{})['then'](respondWithResult(_0x25f60f,0xc9))[_0x37cd('0x47')](handleError(_0x25f60f,null));};exports[_0x37cd('0x27')]=function(_0x29f525,_0x32bb8b){if(_0x29f525[_0x37cd('0x4d')]['id']){delete _0x29f525[_0x37cd('0x4d')]['id'];}return db[_0x37cd('0x30')]['find']({'where':{'id':_0x29f525[_0x37cd('0x49')]['id']}})[_0x37cd('0x28')](handleEntityNotFound(_0x32bb8b,null))[_0x37cd('0x28')](saveUpdates(_0x29f525['body'],null))[_0x37cd('0x28')](respondWithResult(_0x32bb8b,null))[_0x37cd('0x47')](handleError(_0x32bb8b,null));};exports[_0x37cd('0x29')]=function(_0x2f07d2,_0x1164f6){return db[_0x37cd('0x30')][_0x37cd('0x4e')]({'where':{'id':_0x2f07d2['params']['id']}})[_0x37cd('0x28')](handleEntityNotFound(_0x1164f6,null))[_0x37cd('0x28')](removeEntity(_0x1164f6,null))[_0x37cd('0x47')](handleError(_0x1164f6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ff4e3ac..19c29f2 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 _0x541b=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x19291a,_0x142464){var _0x56b8c3=function(_0x2cc1e8){while(--_0x2cc1e8){_0x19291a['push'](_0x19291a['shift']());}};_0x56b8c3(++_0x142464);}(_0x541b,0x8f));var _0xb541=function(_0xe779,_0x1a1b29){_0xe779=_0xe779-0x0;var _0x5201de=_0x541b[_0xe779];return _0x5201de;};'use strict';var _=require(_0xb541('0x0'));var util=require(_0xb541('0x1'));var logger=require(_0xb541('0x2'))(_0xb541('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb541('0x4'));var fs=require('fs');var path=require(_0xb541('0x5'));var rimraf=require('rimraf');var config=require(_0xb541('0x6'));var attributes=require(_0xb541('0x7'));module['exports']=function(_0x167dc3,_0x1ab34a){return _0x167dc3[_0xb541('0x8')](_0xb541('0x9'),attributes,{'tableName':_0xb541('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a0=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x5de86f,_0x585c8f){var _0x584db2=function(_0xcf180e){while(--_0xcf180e){_0x5de86f['push'](_0x5de86f['shift']());}};_0x584db2(++_0x585c8f);}(_0x50a0,0x181));var _0x050a=function(_0xac82f7,_0x184031){_0xac82f7=_0xac82f7-0x0;var _0x26ca68=_0x50a0[_0xac82f7];return _0x26ca68;};'use strict';var _=require(_0x050a('0x0'));var util=require(_0x050a('0x1'));var logger=require(_0x050a('0x2'))(_0x050a('0x3'));var moment=require('moment');var BPromise=require(_0x050a('0x4'));var rp=require(_0x050a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x050a('0x6'));var config=require(_0x050a('0x7'));var attributes=require(_0x050a('0x8'));module[_0x050a('0x9')]=function(_0x39d4d3,_0x253a83){return _0x39d4d3['define'](_0x050a('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index cbf4c2e..2d0914d 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1829dc,_0x3ce228){var _0x2c18f6=function(_0x2efd15){while(--_0x2efd15){_0x1829dc['push'](_0x1829dc['shift']());}};_0x2c18f6(++_0x3ce228);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e3d16,_0x463b62){_0x5e3d16=_0x5e3d16-0x0;var _0x46e453=_0x2ef3[_0x5e3d16];return _0x46e453;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2e8b38,_0x1a1f10){_0x2e8b38=_0x2e8b38-0x0;var _0x58f52a=_0x7a54[_0x2e8b38];return _0x58f52a;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 60029a5..48e4c27 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 _0x8814=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','create','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x359bd0,_0x1a42cf){var _0x309aac=function(_0x59cfa4){while(--_0x59cfa4){_0x359bd0['push'](_0x359bd0['shift']());}};_0x309aac(++_0x1a42cf);}(_0x8814,0xfb));var _0x4881=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8814[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x4881('0x0'));var path=require(_0x4881('0x1'));var timeout=require(_0x4881('0x2'));var express=require(_0x4881('0x3'));var router=express[_0x4881('0x4')]();var fs_extra=require(_0x4881('0x5'));var auth=require(_0x4881('0x6'));var interaction=require(_0x4881('0x7'));var config=require('../../config/environment');var controller=require(_0x4881('0x8'));router[_0x4881('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4881('0x9')](_0x4881('0xa'),auth[_0x4881('0xb')](),controller[_0x4881('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4881('0xd')]);router['put']('/:id',auth[_0x4881('0xb')](),controller['update']);router['delete'](_0x4881('0xa'),auth['isAuthenticated'](),controller[_0x4881('0xe')]);module[_0x4881('0xf')]=router; \ No newline at end of file +var _0xfcc0=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id'];(function(_0x625c64,_0x53869a){var _0x262d13=function(_0x8fa361){while(--_0x8fa361){_0x625c64['push'](_0x625c64['shift']());}};_0x262d13(++_0x53869a);}(_0xfcc0,0x11e));var _0x0fcc=function(_0x3f7e42,_0x47fafe){_0x3f7e42=_0x3f7e42-0x0;var _0x3bfbe8=_0xfcc0[_0x3f7e42];return _0x3bfbe8;};'use strict';var multer=require(_0x0fcc('0x0'));var util=require(_0x0fcc('0x1'));var path=require(_0x0fcc('0x2'));var timeout=require(_0x0fcc('0x3'));var express=require(_0x0fcc('0x4'));var router=express[_0x0fcc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0fcc('0x6'));var interaction=require(_0x0fcc('0x7'));var config=require(_0x0fcc('0x8'));var controller=require(_0x0fcc('0x9'));router['get']('/',auth[_0x0fcc('0xa')](),controller[_0x0fcc('0xb')]);router[_0x0fcc('0xc')](_0x0fcc('0xd'),auth[_0x0fcc('0xa')](),controller[_0x0fcc('0xe')]);router[_0x0fcc('0xf')]('/',auth[_0x0fcc('0xa')](),controller[_0x0fcc('0x10')]);router['put']('/:id',auth[_0x0fcc('0xa')](),controller[_0x0fcc('0x11')]);router['delete'](_0x0fcc('0xd'),auth[_0x0fcc('0xa')](),controller[_0x0fcc('0x12')]);module[_0x0fcc('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c3980fa..8026864 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 _0x8255=['exports','STRING','sequelize'];(function(_0x446a7c,_0xa71cb9){var _0x308cde=function(_0x5e6314){while(--_0x5e6314){_0x446a7c['push'](_0x446a7c['shift']());}};_0x308cde(++_0xa71cb9);}(_0x8255,0x176));var _0x5825=function(_0x517675,_0x54b403){_0x517675=_0x517675-0x0;var _0x32a5d0=_0x8255[_0x517675];return _0x32a5d0;};'use strict';var Sequelize=require(_0x5825('0x0'));module[_0x5825('0x1')]={'name':{'type':Sequelize[_0x5825('0x2')]},'basename':{'type':Sequelize[_0x5825('0x2')]},'type':{'type':Sequelize[_0x5825('0x2')]}}; \ No newline at end of file +var _0x0e9f=['exports','STRING','sequelize'];(function(_0x1734f1,_0x72c758){var _0x5aca73=function(_0x3ced7e){while(--_0x3ced7e){_0x1734f1['push'](_0x1734f1['shift']());}};_0x5aca73(++_0x72c758);}(_0x0e9f,0x116));var _0xf0e9=function(_0x17c1d8,_0x283c65){_0x17c1d8=_0x17c1d8-0x0;var _0x56cef1=_0x0e9f[_0x17c1d8];return _0x56cef1;};'use strict';var Sequelize=require(_0xf0e9('0x0'));module[_0xf0e9('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf0e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8f8e971..838844a 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 _0x6a16=['where','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','merge','clone','params','length','find','get','updatedAt','omit','body','createdAt','create','update','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','map','Attachment','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter'];(function(_0x436684,_0x4207cb){var _0x136af5=function(_0x150670){while(--_0x150670){_0x436684['push'](_0x436684['shift']());}};_0x136af5(++_0x4207cb);}(_0x6a16,0x7a));var _0x66a1=function(_0x3664df,_0x59e75a){_0x3664df=_0x3664df-0x0;var _0x544090=_0x6a16[_0x3664df];return _0x544090;};'use strict';var emlformat=require(_0x66a1('0x0'));var rimraf=require(_0x66a1('0x1'));var zipdir=require(_0x66a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66a1('0x3'));var moment=require(_0x66a1('0x4'));var BPromise=require(_0x66a1('0x5'));var Mustache=require(_0x66a1('0x6'));var util=require('util');var path=require(_0x66a1('0x7'));var sox=require(_0x66a1('0x8'));var csv=require(_0x66a1('0x9'));var ejs=require(_0x66a1('0xa'));var fs=require('fs');var fs_extra=require(_0x66a1('0xb'));var _=require('lodash');var squel=require(_0x66a1('0xc'));var crypto=require('crypto');var jsforce=require(_0x66a1('0xd'));var deskjs=require(_0x66a1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66a1('0xf'));var Papa=require(_0x66a1('0x10'));var Redis=require(_0x66a1('0x11'));var authService=require(_0x66a1('0x12'));var qs=require(_0x66a1('0x13'));var as=require(_0x66a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66a1('0x15'))(_0x66a1('0x16'));var utils=require(_0x66a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x66a1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5af5f6,_0x4a1e9a){_0x4a1e9a=_0x4a1e9a||0xcc;return function(_0x1e3071){if(_0x1e3071){return _0x5af5f6[_0x66a1('0x19')](_0x4a1e9a);}return _0x5af5f6[_0x66a1('0x1a')](_0x4a1e9a)[_0x66a1('0x1b')]();};}function respondWithResult(_0x1b6f72,_0x28842a){_0x28842a=_0x28842a||0xc8;return function(_0x26cb1f){if(_0x26cb1f){return _0x1b6f72[_0x66a1('0x1a')](_0x28842a)[_0x66a1('0x1c')](_0x26cb1f);}};}function respondWithFilteredResult(_0x5a1e00,_0x2550bd){return function(_0x28f46d){if(_0x28f46d){var _0x4e987b=typeof _0x2550bd[_0x66a1('0x1d')]===_0x66a1('0x1e')&&typeof _0x2550bd[_0x66a1('0x1f')]===_0x66a1('0x1e');var _0x3d87ea=_0x28f46d[_0x66a1('0x20')];var _0x5269ec=_0x4e987b?0x0:_0x2550bd[_0x66a1('0x1d')];var _0x347ae7=_0x4e987b?_0x28f46d[_0x66a1('0x20')]:_0x2550bd[_0x66a1('0x1d')]+_0x2550bd[_0x66a1('0x1f')];var _0x8847d4;if(_0x347ae7>=_0x3d87ea){_0x347ae7=_0x3d87ea;_0x8847d4=0xc8;}else{_0x8847d4=0xce;}_0x5a1e00[_0x66a1('0x1a')](_0x8847d4);return _0x5a1e00[_0x66a1('0x21')](_0x66a1('0x22'),_0x5269ec+'-'+_0x347ae7+'/'+_0x3d87ea)[_0x66a1('0x1c')](_0x28f46d);}return null;};}function patchUpdates(_0x3ab550){return function(_0x3d8d64){try{jsonpatch[_0x66a1('0x23')](_0x3d8d64,_0x3ab550,!![]);}catch(_0x9fe7c4){return BPromise[_0x66a1('0x24')](_0x9fe7c4);}return _0x3d8d64['save']();};}function saveUpdates(_0x22ac1b,_0x37a525){return function(_0x2fc609){if(_0x2fc609){return _0x2fc609['update'](_0x22ac1b)[_0x66a1('0x25')](function(_0x44a9f0){return _0x44a9f0;});}return null;};}function removeEntity(_0x3e5004,_0x2c45bd){return function(_0x3a37b6){if(_0x3a37b6){return _0x3a37b6[_0x66a1('0x26')]()[_0x66a1('0x25')](function(){_0x3e5004[_0x66a1('0x1a')](0xcc)[_0x66a1('0x1b')]();});}};}function handleEntityNotFound(_0x48a055,_0x5323b4){return function(_0x4f20da){if(!_0x4f20da){_0x48a055[_0x66a1('0x19')](0x194);}return _0x4f20da;};}function handleError(_0x13dfd8,_0x4d889b){_0x4d889b=_0x4d889b||0x1f4;return function(_0x139918){logger[_0x66a1('0x27')](_0x139918['stack']);if(_0x139918['name']){delete _0x139918[_0x66a1('0x28')];}_0x13dfd8['status'](_0x4d889b)['send'](_0x139918);};}exports['index']=function(_0x108855,_0x17a97c){var _0x4146e0={},_0x50bd2a={},_0x42cfbb={'count':0x0,'rows':[]};var _0x442e44=_[_0x66a1('0x29')](db[_0x66a1('0x2a')]['rawAttributes'],function(_0xfcc7b8){return{'name':_0xfcc7b8['fieldName'],'type':_0xfcc7b8[_0x66a1('0x2b')]['key']};});_0x50bd2a[_0x66a1('0x2c')]=_[_0x66a1('0x29')](_0x442e44,_0x66a1('0x28'));_0x50bd2a[_0x66a1('0x2d')]=_[_0x66a1('0x2e')](_0x108855[_0x66a1('0x2d')]);_0x50bd2a[_0x66a1('0x2f')]=_[_0x66a1('0x30')](_0x50bd2a[_0x66a1('0x2c')],_0x50bd2a['query']);_0x4146e0[_0x66a1('0x31')]=_[_0x66a1('0x30')](_0x50bd2a['model'],qs[_0x66a1('0x32')](_0x108855[_0x66a1('0x2d')][_0x66a1('0x32')]));_0x4146e0[_0x66a1('0x31')]=_0x4146e0[_0x66a1('0x31')]['length']?_0x4146e0[_0x66a1('0x31')]:_0x50bd2a['model'];if(!_0x108855[_0x66a1('0x2d')][_0x66a1('0x33')](_0x66a1('0x34'))){_0x4146e0['limit']=qs[_0x66a1('0x1f')](_0x108855[_0x66a1('0x2d')]['limit']);_0x4146e0[_0x66a1('0x1d')]=qs[_0x66a1('0x1d')](_0x108855[_0x66a1('0x2d')][_0x66a1('0x1d')]);}_0x4146e0[_0x66a1('0x35')]=qs['sort'](_0x108855[_0x66a1('0x2d')]['sort']);_0x4146e0['where']=qs['filters'](_[_0x66a1('0x36')](_0x108855[_0x66a1('0x2d')],_0x50bd2a['filters']),_0x442e44);if(_0x108855[_0x66a1('0x2d')][_0x66a1('0x37')]){_0x4146e0[_0x66a1('0x38')]=_['merge'](_0x4146e0['where'],{'$or':_[_0x66a1('0x29')](_0x442e44,function(_0x5c6c14){if(_0x5c6c14['type']!==_0x66a1('0x39')){var _0x38e75c={};_0x38e75c[_0x5c6c14[_0x66a1('0x28')]]={'$like':'%'+_0x108855[_0x66a1('0x2d')][_0x66a1('0x37')]+'%'};return _0x38e75c;}})});}_0x4146e0=_['merge']({},_0x4146e0,_0x108855[_0x66a1('0x3a')]);var _0x22dbe6={'where':_0x4146e0[_0x66a1('0x38')]};return db['Attachment']['count'](_0x22dbe6)[_0x66a1('0x25')](function(_0x4ce1ef){_0x42cfbb[_0x66a1('0x20')]=_0x4ce1ef;if(_0x108855[_0x66a1('0x2d')]['includeAll']){_0x4146e0[_0x66a1('0x3b')]=[{'all':!![]}];}return db[_0x66a1('0x2a')][_0x66a1('0x3c')](_0x4146e0);})[_0x66a1('0x25')](function(_0x366d4e){_0x42cfbb[_0x66a1('0x3d')]=_0x366d4e;return _0x42cfbb;})[_0x66a1('0x25')](respondWithFilteredResult(_0x17a97c,_0x4146e0))[_0x66a1('0x3e')](handleError(_0x17a97c,null));};exports[_0x66a1('0x3f')]=function(_0x5c4219,_0x49eb0a){var _0x3614b2={'raw':!![],'where':{'id':_0x5c4219['params']['id']}},_0xb5b9a9={};_0xb5b9a9[_0x66a1('0x2c')]=_[_0x66a1('0x2e')](db[_0x66a1('0x2a')][_0x66a1('0x40')]);_0xb5b9a9[_0x66a1('0x2d')]=_[_0x66a1('0x2e')](_0x5c4219['query']);_0xb5b9a9[_0x66a1('0x2f')]=_[_0x66a1('0x30')](_0xb5b9a9[_0x66a1('0x2c')],_0xb5b9a9[_0x66a1('0x2d')]);_0x3614b2[_0x66a1('0x31')]=_['intersection'](_0xb5b9a9[_0x66a1('0x2c')],qs[_0x66a1('0x32')](_0x5c4219[_0x66a1('0x2d')]['fields']));_0x3614b2[_0x66a1('0x31')]=_0x3614b2[_0x66a1('0x31')]['length']?_0x3614b2['attributes']:_0xb5b9a9[_0x66a1('0x2c')];if(_0x5c4219[_0x66a1('0x2d')][_0x66a1('0x41')]){_0x3614b2[_0x66a1('0x3b')]=[{'all':!![]}];}_0x3614b2=_[_0x66a1('0x42')]({},_0x3614b2,_0x5c4219[_0x66a1('0x3a')]);return db[_0x66a1('0x2a')]['find'](_0x3614b2)[_0x66a1('0x25')](handleEntityNotFound(_0x49eb0a,null))[_0x66a1('0x25')](respondWithResult(_0x49eb0a,null))[_0x66a1('0x3e')](handleError(_0x49eb0a,null));};exports[_0x66a1('0x43')]=function(_0x4d1e07,_0x4a662b){var _0x1389da={'where':{'id':_0x4d1e07[_0x66a1('0x44')]['id']}},_0x49cfe8={};_0x49cfe8[_0x66a1('0x2c')]=_[_0x66a1('0x2e')](db[_0x66a1('0x2a')][_0x66a1('0x40')]);_0x1389da[_0x66a1('0x31')]=_[_0x66a1('0x30')](_0x49cfe8[_0x66a1('0x2c')],qs[_0x66a1('0x32')](_0x4d1e07['query'][_0x66a1('0x32')]));_0x1389da['attributes']=_0x1389da[_0x66a1('0x31')][_0x66a1('0x45')]?_0x1389da['attributes']:_0x49cfe8[_0x66a1('0x2c')];if(_0x4d1e07[_0x66a1('0x2d')][_0x66a1('0x41')]){_0x1389da['include']=[{'all':!![]}];}_0x1389da=_['merge']({},_0x1389da,_0x4d1e07[_0x66a1('0x3a')]);return db['Attachment'][_0x66a1('0x46')](_0x1389da)[_0x66a1('0x25')](handleEntityNotFound(_0x4a662b,null))['then'](function(_0x5a4fda){if(_0x5a4fda){var _0x1c7e7=_0x5a4fda[_0x66a1('0x47')]({'plain':!![]});_0x1c7e7=qs['omit'](_0x1c7e7,['id','createdAt',_0x66a1('0x48')]);_0x4d1e07['body']=_[_0x66a1('0x49')](_0x4d1e07[_0x66a1('0x4a')],['id',_0x66a1('0x4b'),_0x66a1('0x48')]);return db[_0x66a1('0x2a')][_0x66a1('0x4c')](_[_0x66a1('0x42')](_0x1c7e7,_0x4d1e07[_0x66a1('0x4a')]),{'include':_0x4d1e07[_0x66a1('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x66a1('0x25')](respondWithResult(_0x4a662b,0xc9))[_0x66a1('0x3e')](handleError(_0x4a662b,null));};exports[_0x66a1('0x4d')]=function(_0x3becc4,_0x47043a){if(_0x3becc4[_0x66a1('0x4a')]['id']){delete _0x3becc4[_0x66a1('0x4a')]['id'];}return db['Attachment'][_0x66a1('0x46')]({'where':{'id':_0x3becc4['params']['id']}})[_0x66a1('0x25')](handleEntityNotFound(_0x47043a,null))[_0x66a1('0x25')](saveUpdates(_0x3becc4[_0x66a1('0x4a')],null))['then'](respondWithResult(_0x47043a,null))[_0x66a1('0x3e')](handleError(_0x47043a,null));};exports[_0x66a1('0x26')]=function(_0x23efed,_0x248310){return db['Attachment'][_0x66a1('0x46')]({'where':{'id':_0x23efed[_0x66a1('0x44')]['id']}})[_0x66a1('0x25')](handleEntityNotFound(_0x248310,null))['then'](removeEntity(_0x248310,null))[_0x66a1('0x3e')](handleError(_0x248310,null));};exports[_0x66a1('0x4c')]=function(_0x2b9cce,_0x449fe9,_0x4fb61f){_0x2b9cce['body']['name']=_0x2b9cce[_0x66a1('0x4e')][_0x66a1('0x4f')];_0x2b9cce[_0x66a1('0x4a')][_0x66a1('0x50')]=_0x2b9cce[_0x66a1('0x4e')][_0x66a1('0x51')];_0x2b9cce[_0x66a1('0x4a')][_0x66a1('0x2b')]=_0x2b9cce[_0x66a1('0x4e')][_0x66a1('0x52')];return db[_0x66a1('0x2a')]['create'](_0x2b9cce[_0x66a1('0x4a')])[_0x66a1('0x25')](respondWithResult(_0x449fe9,0xc9))[_0x66a1('0x3e')](handleError(_0x449fe9,null));};exports[_0x66a1('0x53')]=function(_0x2b7162,_0x306f38,_0x13f501){return db[_0x66a1('0x2a')]['findOne']({'where':{'id':_0x2b7162[_0x66a1('0x44')]['id']},'raw':!![]})[_0x66a1('0x25')](handleEntityNotFound(_0x306f38,null))[_0x66a1('0x25')](function(_0x2ffc19){if(_0x2ffc19){var _0x3ef54f=_0x2ffc19[_0x66a1('0x54')]!==null;var _0x345ea7=path[_0x66a1('0x55')](config[_0x66a1('0x56')],_0x66a1('0x57'));if(_0x3ef54f){_0x345ea7=path['join'](_0x345ea7,_0x66a1('0x58'));}var _0x43e33e=path[_0x66a1('0x55')](_0x345ea7,_0x2ffc19[_0x66a1('0x50')]);return _0x306f38[_0x66a1('0x53')](_0x43e33e);}})[_0x66a1('0x3e')](handleError(_0x306f38,null));}; \ No newline at end of file +var _0x849d=['ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','Attachment','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','get','omit','createdAt','updatedAt','body','create','basename','filename','file','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x519fdf,_0x37210d){var _0x260e1b=function(_0x5c3e26){while(--_0x5c3e26){_0x519fdf['push'](_0x519fdf['shift']());}};_0x260e1b(++_0x37210d);}(_0x849d,0xfc));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd849('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd849('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd849('0x2'));var moment=require(_0xd849('0x3'));var BPromise=require(_0xd849('0x4'));var Mustache=require('mustache');var util=require(_0xd849('0x5'));var path=require(_0xd849('0x6'));var sox=require(_0xd849('0x7'));var csv=require(_0xd849('0x8'));var ejs=require(_0xd849('0x9'));var fs=require('fs');var fs_extra=require(_0xd849('0xa'));var _=require('lodash');var squel=require(_0xd849('0xb'));var crypto=require('crypto');var jsforce=require(_0xd849('0xc'));var deskjs=require(_0xd849('0xd'));var toCsv=require(_0xd849('0x8'));var querystring=require(_0xd849('0xe'));var Papa=require(_0xd849('0xf'));var Redis=require(_0xd849('0x10'));var authService=require(_0xd849('0x11'));var qs=require(_0xd849('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd849('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd849('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd849('0x15'))['db'];function respondWithStatusCode(_0x21f875,_0x3ea258){_0x3ea258=_0x3ea258||0xcc;return function(_0x4356f3){if(_0x4356f3){return _0x21f875[_0xd849('0x16')](_0x3ea258);}return _0x21f875['status'](_0x3ea258)[_0xd849('0x17')]();};}function respondWithResult(_0x28e7cb,_0x7f9aea){_0x7f9aea=_0x7f9aea||0xc8;return function(_0x3303ff){if(_0x3303ff){return _0x28e7cb['status'](_0x7f9aea)[_0xd849('0x18')](_0x3303ff);}};}function respondWithFilteredResult(_0x3f8f7d,_0x2da972){return function(_0x1b5976){if(_0x1b5976){var _0x5ea7d5=typeof _0x2da972[_0xd849('0x19')]===_0xd849('0x1a')&&typeof _0x2da972[_0xd849('0x1b')]==='undefined';var _0x29b8d7=_0x1b5976[_0xd849('0x1c')];var _0x66e835=_0x5ea7d5?0x0:_0x2da972[_0xd849('0x19')];var _0x143959=_0x5ea7d5?_0x1b5976[_0xd849('0x1c')]:_0x2da972[_0xd849('0x19')]+_0x2da972[_0xd849('0x1b')];var _0x41d760;if(_0x143959>=_0x29b8d7){_0x143959=_0x29b8d7;_0x41d760=0xc8;}else{_0x41d760=0xce;}_0x3f8f7d[_0xd849('0x1d')](_0x41d760);return _0x3f8f7d[_0xd849('0x1e')](_0xd849('0x1f'),_0x66e835+'-'+_0x143959+'/'+_0x29b8d7)['json'](_0x1b5976);}return null;};}function patchUpdates(_0x58210d){return function(_0x1774d4){try{jsonpatch[_0xd849('0x20')](_0x1774d4,_0x58210d,!![]);}catch(_0x2137e7){return BPromise[_0xd849('0x21')](_0x2137e7);}return _0x1774d4[_0xd849('0x22')]();};}function saveUpdates(_0x5b0889,_0x18dde7){return function(_0x15d292){if(_0x15d292){return _0x15d292[_0xd849('0x23')](_0x5b0889)[_0xd849('0x24')](function(_0x5f3c98){return _0x5f3c98;});}return null;};}function removeEntity(_0x55d571,_0x2fa4df){return function(_0x19b982){if(_0x19b982){return _0x19b982[_0xd849('0x25')]()[_0xd849('0x24')](function(){_0x55d571[_0xd849('0x1d')](0xcc)[_0xd849('0x17')]();});}};}function handleEntityNotFound(_0x48eab6,_0x3ffdc9){return function(_0x55da65){if(!_0x55da65){_0x48eab6[_0xd849('0x16')](0x194);}return _0x55da65;};}function handleError(_0x23d089,_0x374722){_0x374722=_0x374722||0x1f4;return function(_0xdbc96d){logger['error'](_0xdbc96d[_0xd849('0x26')]);if(_0xdbc96d[_0xd849('0x27')]){delete _0xdbc96d[_0xd849('0x27')];}_0x23d089[_0xd849('0x1d')](_0x374722)['send'](_0xdbc96d);};}exports['index']=function(_0x3ed066,_0x5ae154){var _0x4e6425={},_0x224952={},_0x1f6f99={'count':0x0,'rows':[]};var _0x233319=_[_0xd849('0x28')](db[_0xd849('0x29')]['rawAttributes'],function(_0x3d7ef4){return{'name':_0x3d7ef4[_0xd849('0x2a')],'type':_0x3d7ef4['type'][_0xd849('0x2b')]};});_0x224952[_0xd849('0x2c')]=_['map'](_0x233319,_0xd849('0x27'));_0x224952[_0xd849('0x2d')]=_[_0xd849('0x2e')](_0x3ed066[_0xd849('0x2d')]);_0x224952['filters']=_[_0xd849('0x2f')](_0x224952[_0xd849('0x2c')],_0x224952[_0xd849('0x2d')]);_0x4e6425[_0xd849('0x30')]=_[_0xd849('0x2f')](_0x224952[_0xd849('0x2c')],qs[_0xd849('0x31')](_0x3ed066[_0xd849('0x2d')]['fields']));_0x4e6425[_0xd849('0x30')]=_0x4e6425[_0xd849('0x30')]['length']?_0x4e6425['attributes']:_0x224952[_0xd849('0x2c')];if(!_0x3ed066[_0xd849('0x2d')][_0xd849('0x32')](_0xd849('0x33'))){_0x4e6425[_0xd849('0x1b')]=qs[_0xd849('0x1b')](_0x3ed066['query'][_0xd849('0x1b')]);_0x4e6425[_0xd849('0x19')]=qs[_0xd849('0x19')](_0x3ed066[_0xd849('0x2d')][_0xd849('0x19')]);}_0x4e6425[_0xd849('0x34')]=qs[_0xd849('0x35')](_0x3ed066[_0xd849('0x2d')]['sort']);_0x4e6425[_0xd849('0x36')]=qs[_0xd849('0x37')](_[_0xd849('0x38')](_0x3ed066[_0xd849('0x2d')],_0x224952[_0xd849('0x37')]),_0x233319);if(_0x3ed066[_0xd849('0x2d')][_0xd849('0x39')]){_0x4e6425['where']=_[_0xd849('0x3a')](_0x4e6425[_0xd849('0x36')],{'$or':_['map'](_0x233319,function(_0x2c9325){if(_0x2c9325[_0xd849('0x3b')]!==_0xd849('0x3c')){var _0x79b1b6={};_0x79b1b6[_0x2c9325[_0xd849('0x27')]]={'$like':'%'+_0x3ed066[_0xd849('0x2d')]['filter']+'%'};return _0x79b1b6;}})});}_0x4e6425=_['merge']({},_0x4e6425,_0x3ed066['options']);var _0x37046f={'where':_0x4e6425['where']};return db['Attachment']['count'](_0x37046f)[_0xd849('0x24')](function(_0x4c5196){_0x1f6f99['count']=_0x4c5196;if(_0x3ed066['query'][_0xd849('0x3d')]){_0x4e6425[_0xd849('0x3e')]=[{'all':!![]}];}return db[_0xd849('0x29')][_0xd849('0x3f')](_0x4e6425);})['then'](function(_0x23eb41){_0x1f6f99[_0xd849('0x40')]=_0x23eb41;return _0x1f6f99;})['then'](respondWithFilteredResult(_0x5ae154,_0x4e6425))[_0xd849('0x41')](handleError(_0x5ae154,null));};exports[_0xd849('0x42')]=function(_0x1028a4,_0x2212cb){var _0x6159b2={'raw':!![],'where':{'id':_0x1028a4[_0xd849('0x43')]['id']}},_0x17ca01={};_0x17ca01[_0xd849('0x2c')]=_[_0xd849('0x2e')](db[_0xd849('0x29')][_0xd849('0x44')]);_0x17ca01['query']=_[_0xd849('0x2e')](_0x1028a4[_0xd849('0x2d')]);_0x17ca01[_0xd849('0x37')]=_[_0xd849('0x2f')](_0x17ca01['model'],_0x17ca01['query']);_0x6159b2[_0xd849('0x30')]=_[_0xd849('0x2f')](_0x17ca01[_0xd849('0x2c')],qs[_0xd849('0x31')](_0x1028a4[_0xd849('0x2d')][_0xd849('0x31')]));_0x6159b2[_0xd849('0x30')]=_0x6159b2[_0xd849('0x30')][_0xd849('0x45')]?_0x6159b2[_0xd849('0x30')]:_0x17ca01[_0xd849('0x2c')];if(_0x1028a4[_0xd849('0x2d')][_0xd849('0x3d')]){_0x6159b2[_0xd849('0x3e')]=[{'all':!![]}];}_0x6159b2=_[_0xd849('0x3a')]({},_0x6159b2,_0x1028a4['options']);return db[_0xd849('0x29')]['find'](_0x6159b2)[_0xd849('0x24')](handleEntityNotFound(_0x2212cb,null))['then'](respondWithResult(_0x2212cb,null))[_0xd849('0x41')](handleError(_0x2212cb,null));};exports['clone']=function(_0x3d58bd,_0x2f9a0f){var _0x578b07={'where':{'id':_0x3d58bd['params']['id']}},_0x3f5a05={};_0x3f5a05[_0xd849('0x2c')]=_[_0xd849('0x2e')](db[_0xd849('0x29')][_0xd849('0x44')]);_0x578b07['attributes']=_[_0xd849('0x2f')](_0x3f5a05['model'],qs[_0xd849('0x31')](_0x3d58bd[_0xd849('0x2d')][_0xd849('0x31')]));_0x578b07['attributes']=_0x578b07[_0xd849('0x30')][_0xd849('0x45')]?_0x578b07[_0xd849('0x30')]:_0x3f5a05[_0xd849('0x2c')];if(_0x3d58bd[_0xd849('0x2d')][_0xd849('0x3d')]){_0x578b07[_0xd849('0x3e')]=[{'all':!![]}];}_0x578b07=_['merge']({},_0x578b07,_0x3d58bd['options']);return db['Attachment'][_0xd849('0x46')](_0x578b07)[_0xd849('0x24')](handleEntityNotFound(_0x2f9a0f,null))[_0xd849('0x24')](function(_0x58e7c1){if(_0x58e7c1){var _0x274a95=_0x58e7c1[_0xd849('0x47')]({'plain':!![]});_0x274a95=qs[_0xd849('0x48')](_0x274a95,['id',_0xd849('0x49'),_0xd849('0x4a')]);_0x3d58bd['body']=_[_0xd849('0x48')](_0x3d58bd[_0xd849('0x4b')],['id',_0xd849('0x49'),_0xd849('0x4a')]);return db['Attachment'][_0xd849('0x4c')](_[_0xd849('0x3a')](_0x274a95,_0x3d58bd['body']),{'include':_0x3d58bd[_0xd849('0x2d')][_0xd849('0x3d')]?[{'all':!![]}]:undefined});}})[_0xd849('0x24')](respondWithResult(_0x2f9a0f,0xc9))[_0xd849('0x41')](handleError(_0x2f9a0f,null));};exports[_0xd849('0x23')]=function(_0x242001,_0x4f3cf8){if(_0x242001[_0xd849('0x4b')]['id']){delete _0x242001[_0xd849('0x4b')]['id'];}return db[_0xd849('0x29')][_0xd849('0x46')]({'where':{'id':_0x242001[_0xd849('0x43')]['id']}})[_0xd849('0x24')](handleEntityNotFound(_0x4f3cf8,null))['then'](saveUpdates(_0x242001[_0xd849('0x4b')],null))['then'](respondWithResult(_0x4f3cf8,null))['catch'](handleError(_0x4f3cf8,null));};exports[_0xd849('0x25')]=function(_0x1bfb8c,_0x5a1929){return db[_0xd849('0x29')][_0xd849('0x46')]({'where':{'id':_0x1bfb8c[_0xd849('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a1929,null))[_0xd849('0x24')](removeEntity(_0x5a1929,null))['catch'](handleError(_0x5a1929,null));};exports['create']=function(_0xf8ecd9,_0x231f2e,_0x2909b7){_0xf8ecd9[_0xd849('0x4b')][_0xd849('0x27')]=_0xf8ecd9['file']['originalname'];_0xf8ecd9['body'][_0xd849('0x4d')]=_0xf8ecd9['file'][_0xd849('0x4e')];_0xf8ecd9[_0xd849('0x4b')][_0xd849('0x3b')]=_0xf8ecd9[_0xd849('0x4f')]['mimetype'];return db[_0xd849('0x29')]['create'](_0xf8ecd9[_0xd849('0x4b')])[_0xd849('0x24')](respondWithResult(_0x231f2e,0xc9))['catch'](handleError(_0x231f2e,null));};exports[_0xd849('0x50')]=function(_0x5731af,_0xfa48e9,_0x106459){return db['Attachment'][_0xd849('0x51')]({'where':{'id':_0x5731af[_0xd849('0x43')]['id']},'raw':!![]})[_0xd849('0x24')](handleEntityNotFound(_0xfa48e9,null))[_0xd849('0x24')](function(_0x5114a9){if(_0x5114a9){var _0x3ede1d=_0x5114a9[_0xd849('0x52')]!==null;var _0x2a1bd3=path[_0xd849('0x53')](config[_0xd849('0x54')],_0xd849('0x55'));if(_0x3ede1d){_0x2a1bd3=path[_0xd849('0x53')](_0x2a1bd3,_0xd849('0x56'));}var _0x3341a5=path[_0xd849('0x53')](_0x2a1bd3,_0x5114a9[_0xd849('0x4d')]);return _0xfa48e9[_0xd849('0x50')](_0x3341a5);}})['catch'](handleError(_0xfa48e9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 14fac53..2e825af 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40ac=['util','../../config/logger','moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0xb1650,_0x5691cd){var _0x51bbc5=function(_0x27d2de){while(--_0x27d2de){_0xb1650['push'](_0xb1650['shift']());}};_0x51bbc5(++_0x5691cd);}(_0x40ac,0x6e));var _0xc40a=function(_0x388e27,_0x276fd5){_0x388e27=_0x388e27-0x0;var _0x19613d=_0x40ac[_0x388e27];return _0x19613d;};'use strict';var _=require('lodash');var util=require(_0xc40a('0x0'));var logger=require(_0xc40a('0x1'))('api');var moment=require(_0xc40a('0x2'));var BPromise=require(_0xc40a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc40a('0x4'));var rimraf=require('rimraf');var config=require(_0xc40a('0x5'));var attributes=require(_0xc40a('0x6'));module[_0xc40a('0x7')]=function(_0x2db1ea,_0x567650){return _0x2db1ea[_0xc40a('0x8')](_0xc40a('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca34=['./attachment.attributes','exports','define','Attachment','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x583cf0,_0x5a6871){var _0x23727e=function(_0x161a47){while(--_0x161a47){_0x583cf0['push'](_0x583cf0['shift']());}};_0x23727e(++_0x5a6871);}(_0xca34,0xa4));var _0x4ca3=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xca34[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ca3('0x0'))(_0x4ca3('0x1'));var moment=require(_0x4ca3('0x2'));var BPromise=require(_0x4ca3('0x3'));var rp=require(_0x4ca3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ca3('0x5'));var attributes=require(_0x4ca3('0x6'));module[_0x4ca3('0x7')]=function(_0xd19e0e,_0x1055b9){return _0xd19e0e[_0x4ca3('0x8')](_0x4ca3('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 326478e..7e24cd9 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 _0xe87e=['raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','options'];(function(_0x3638f7,_0xe7afda){var _0x1f37b6=function(_0x3e8420){while(--_0x3e8420){_0x3638f7['push'](_0x3638f7['shift']());}};_0x1f37b6(++_0xe7afda);}(_0xe87e,0x17d));var _0xee87=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xe87e[_0xd511d];return _0x3f148e;};'use strict';var _=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var moment=require(_0xee87('0x2'));var BPromise=require(_0xee87('0x3'));var rs=require(_0xee87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee87('0x5'))['db'];var utils=require(_0xee87('0x6'));var logger=require(_0xee87('0x7'))(_0xee87('0x8'));var config=require(_0xee87('0x9'));var jayson=require(_0xee87('0xa'));var client=jayson[_0xee87('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589c36,_0x2bde4c,_0x2ee165){return new BPromise(function(_0x2fda67,_0x71d659){return client[_0xee87('0xc')](_0x589c36,_0x2ee165)['then'](function(_0x2ed8e9){logger[_0xee87('0xd')](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));logger['debug'](_0xee87('0x10'),_0x2bde4c,_0xee87('0xf'),JSON['stringify'](_0x2ed8e9));if(_0x2ed8e9[_0xee87('0x11')]){if(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x12')]===0x1f4){logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);return _0x71d659(_0x2ed8e9[_0xee87('0x11')]['message']);}logger[_0xee87('0x11')](_0xee87('0xe'),_0x2bde4c,_0x2ed8e9['error']['message']);return _0x2fda67(_0x2ed8e9[_0xee87('0x11')][_0xee87('0x13')]);}else{logger['info'](_0xee87('0xe'),_0x2bde4c,_0xee87('0xf'));_0x2fda67(_0x2ed8e9[_0xee87('0x14')][_0xee87('0x13')]);}})['catch'](function(_0x290968){logger['error'](_0xee87('0xe'),_0x2bde4c,_0x290968);_0x71d659(_0x290968);});});}exports[_0xee87('0x15')]=function(_0x1fa2be){var _0x5f378c=this;return new Promise(function(_0x48a330,_0x2a1feb){return db[_0xee87('0x16')][_0xee87('0x17')](_0x1fa2be['body'],{'raw':_0x1fa2be[_0xee87('0x18')]?_0x1fa2be[_0xee87('0x18')][_0xee87('0x19')]===undefined?!![]:![]:!![]})[_0xee87('0x1a')](function(_0x42ba7a){logger[_0xee87('0xd')](_0xee87('0x15'),_0x1fa2be);logger['debug'](_0xee87('0x15'),_0x1fa2be,JSON[_0xee87('0x1b')](_0x42ba7a));_0x48a330(_0x42ba7a);})[_0xee87('0x1c')](function(_0x35e7cf){logger[_0xee87('0x11')](_0xee87('0x15'),_0x35e7cf[_0xee87('0x13')],_0x1fa2be);_0x2a1feb(_0x5f378c[_0xee87('0x11')](0x1f4,_0x35e7cf[_0xee87('0x13')]));});});}; \ No newline at end of file +var _0xb4e6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','moment','bluebird','randomstring'];(function(_0x9e10f3,_0x1cd071){var _0x2266e3=function(_0x26aa8e){while(--_0x26aa8e){_0x9e10f3['push'](_0x9e10f3['shift']());}};_0x2266e3(++_0x1cd071);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xb4e6[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});}exports[_0x6b4e('0x17')]=function(_0x10d2b1){var _0x39c1b8=this;return new Promise(function(_0x101d0a,_0x1a585d){return db[_0x6b4e('0x18')][_0x6b4e('0x19')](_0x10d2b1[_0x6b4e('0x1a')],{'raw':_0x10d2b1[_0x6b4e('0x1b')]?_0x10d2b1[_0x6b4e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6b4e('0xb')](function(_0x248fea){logger[_0x6b4e('0xc')](_0x6b4e('0x17'),_0x10d2b1);logger['debug'](_0x6b4e('0x17'),_0x10d2b1,JSON['stringify'](_0x248fea));_0x101d0a(_0x248fea);})[_0x6b4e('0x16')](function(_0x163dea){logger[_0x6b4e('0x12')](_0x6b4e('0x17'),_0x163dea[_0x6b4e('0x14')],_0x10d2b1);_0x1a585d(_0x39c1b8[_0x6b4e('0x12')](0x1f4,_0x163dea[_0x6b4e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7a57f27..61028a7 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0x0b0e[_0x2338fa];return _0x42df9b;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x1e33d2,_0x3ff63e){var _0x14493f=function(_0x2dda9d){while(--_0x2dda9d){_0x1e33d2['push'](_0x1e33d2['shift']());}};_0x14493f(++_0x3ff63e);}(_0x757a,0xde));var _0xa757=function(_0x460139,_0x2be9b3){_0x460139=_0x460139-0x0;var _0x46cdbb=_0x757a[_0x460139];return _0x46cdbb;};'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('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9652d6b..dd8c7fd 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 _0x9466=['ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','blocked','online','admin','user','agent','domain','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login'];(function(_0x3eab9f,_0x3097f1){var _0x124831=function(_0x3a6b93){while(--_0x3a6b93){_0x3eab9f['push'](_0x3eab9f['shift']());}};_0x124831(++_0x3097f1);}(_0x9466,0xa2));var _0x6946=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9466[_0x46e363];return _0x3fb059;};'use strict';var passport=require(_0x6946('0x0'));var LocalStrategy=require(_0x6946('0x1'))[_0x6946('0x2')];var moment=require(_0x6946('0x3'));var ActiveDirectory=require(_0x6946('0x4'));var BPromise=require(_0x6946('0x5'));var util=require('util');var db=require(_0x6946('0x6'))['db'];var authService=require(_0x6946('0x7'));var utils=require(_0x6946('0x8'));var config=require(_0x6946('0x9'));var logger=require(_0x6946('0xa'))(_0x6946('0xb'));function isActiveDirectoryConfigured(_0xbc2c69){var _0x44ba8d=![];if(typeof _0xbc2c69['activedirectory']!=='undefined'){_0x44ba8d=_0xbc2c69[_0x6946('0xc')][_0x6946('0xd')]&&_0xbc2c69[_0x6946('0xc')]['url']&&_0xbc2c69['activedirectory']['domain'];}return _0x44ba8d;}function adAuthenticate(_0x439c94,_0x72ea1a,_0x4e0cdb){return new BPromise(function(_0x52d094,_0x4c8846){try{var _0x11f73f=new ActiveDirectory(_0x439c94);_0x11f73f[_0x6946('0xe')](_0x72ea1a,_0x4e0cdb,function(_0x2247e0,_0x55fb25){if(_0x2247e0){logger['error'](_0x6946('0xf'),_0x72ea1a,util[_0x6946('0x10')](_0x2247e0,{'showHidden':![],'depth':null}));_0x4c8846(_0x6946('0x11'));}else if(!_0x55fb25){logger[_0x6946('0x12')](_0x6946('0x13'),_0x72ea1a);_0x4c8846(_0x6946('0x11'));}else{_0x52d094(_0x55fb25);}});}catch(_0xfb2291){_0x4c8846(_0xfb2291);}});}function ActiveDirectoryAuthenticate(_0x1d0bb2,_0x16734a,_0x40e0b3,_0x1a76f2){var _0x1cc005,_0x22b53c;if(!isActiveDirectoryConfigured(config)){logger[_0x6946('0x12')](_0x6946('0x14'),_0x16734a);return _0x1a76f2(null,![],{'message':_0x6946('0x11')});}return db[_0x6946('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x6946('0x16'),_0x6946('0x17')],'raw':!![]})[_0x6946('0x18')](function(_0x1fc709){_0x1cc005=_0x1fc709;if(!_0x1cc005['adSsoEnabled']){logger[_0x6946('0x12')](_0x6946('0x19'),_0x16734a);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1d0bb2[_0x6946('0x1a')]({'attributes':['id',_0x6946('0x1b'),_0x6946('0x1c'),_0x6946('0x1d'),_0x6946('0x1e'),'disabled',_0x6946('0x1f'),'blockedAt',_0x6946('0x20')],'where':{'name':_0x16734a,'role':{'$or':[_0x6946('0x21'),_0x6946('0x22'),_0x6946('0x23')]},'adSsoEnabled':!![]}});})[_0x6946('0x18')](function(_0x262238){if(!_0x262238||_0x262238&&_0x262238[_0x6946('0x1b')]!==_0x16734a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x22b53c=_0x262238;var _0x4742f1=_0x22b53c[_0x6946('0x1b')]+'@'+config[_0x6946('0xc')][_0x6946('0x24')];return adAuthenticate(config[_0x6946('0xc')],_0x4742f1,_0x40e0b3);})['then'](function(_0x446f52){if(_0x22b53c['disabled']){throw new Error(_0x6946('0x11'));}if(_0x1cc005[_0x6946('0x17')]>0x0){if(_0x22b53c['blocked']){if(moment(_0x22b53c['blockedAt'])[_0x6946('0x25')](_0x1cc005[_0x6946('0x17')],_0x6946('0x26'))>moment()){throw new Error(_0x6946('0x11'));}return utils[_0x6946('0x27')](_0x22b53c,0x0,![],null)[_0x6946('0x18')](function(){return utils[_0x6946('0x28')](_0x22b53c);})[_0x6946('0x18')](function(){return _0x1a76f2(null,_0x22b53c);});}else{return utils[_0x6946('0x28')](_0x22b53c)[_0x6946('0x18')](function(){return _0x1a76f2(null,_0x22b53c);});}}else{return utils[_0x6946('0x28')](_0x22b53c)['then'](function(){return _0x1a76f2(null,_0x22b53c);});}})[_0x6946('0x29')](function(_0x508834){return _0x1a76f2(null,![],_0x508834);});}function handleError(_0x1b0e21,_0x17fd30,_0x45feda){return _0x1b0e21[_0x6946('0x2a')](_0x17fd30||0x1f4)[_0x6946('0x2b')]({'message':_0x45feda?_0x45feda[_0x6946('0x2c')]||_0x45feda:''});}exports[_0x6946('0x2d')]=function(_0x1606c5,_0x4ce193,_0x2cf9fc){passport['authenticate'](_0x6946('0x2e'),function(_0x434b6a,_0x4250b8,_0x5eff98){var _0xc7a294=_0x434b6a||_0x5eff98;if(_0xc7a294){return handleError(_0x4ce193,0x191,_0xc7a294);}if(!_0x4250b8){return handleError(_0x4ce193,0x194,{'message':_0x6946('0x2f')});}else{var _0xb19214={'payload':{'id':_0x4250b8['id'],'role':_0x4250b8['role']},'options':{'expiresIn':0x15180}};return authService[_0x6946('0x30')](_0xb19214)[_0x6946('0x18')](function(_0x4ed8e8){_0x4ce193[_0x6946('0x31')]({'id':_0x4250b8['id'],'token':_0x4ed8e8,'statusCall':'','isAlreadyLogged':_0x4250b8['online']});});}})(_0x1606c5,_0x4ce193,_0x2cf9fc);};passport[_0x6946('0x32')](_0x6946('0x2e'),new LocalStrategy({'usernameField':_0x6946('0x1b'),'passwordField':'password'},function(_0xc023bc,_0x599616,_0x6279e7){return ActiveDirectoryAuthenticate(db[_0x6946('0x33')],_0xc023bc,_0x599616,_0x6279e7);})); \ No newline at end of file +var _0x3302=['online','admin','user','agent','then','add','minutes','clearBlockUser','getLicense','catch','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','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','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt'];(function(_0x3bd369,_0xb8bdc7){var _0x5af0d6=function(_0x595d13){while(--_0x595d13){_0x3bd369['push'](_0x3bd369['shift']());}};_0x5af0d6(++_0xb8bdc7);}(_0x3302,0xff));var _0x2330=function(_0xfed9a5,_0x52ed9e){_0xfed9a5=_0xfed9a5-0x0;var _0x40d40d=_0x3302[_0xfed9a5];return _0x40d40d;};'use strict';var passport=require(_0x2330('0x0'));var LocalStrategy=require(_0x2330('0x1'))['Strategy'];var moment=require(_0x2330('0x2'));var ActiveDirectory=require(_0x2330('0x3'));var BPromise=require(_0x2330('0x4'));var util=require('util');var db=require(_0x2330('0x5'))['db'];var authService=require(_0x2330('0x6'));var utils=require(_0x2330('0x7'));var config=require(_0x2330('0x8'));var logger=require(_0x2330('0x9'))(_0x2330('0xa'));function isActiveDirectoryConfigured(_0x29d838){var _0x30a083=![];if(typeof _0x29d838[_0x2330('0xb')]!==_0x2330('0xc')){_0x30a083=_0x29d838['activedirectory'][_0x2330('0xd')]&&_0x29d838[_0x2330('0xb')][_0x2330('0xe')]&&_0x29d838['activedirectory'][_0x2330('0xf')];}return _0x30a083;}function adAuthenticate(_0x335583,_0x60e630,_0x32b081){return new BPromise(function(_0x4f7ced,_0x54b2ea){try{var _0x17bdc7=new ActiveDirectory(_0x335583);_0x17bdc7['authenticate'](_0x60e630,_0x32b081,function(_0x24908c,_0x11bc06){if(_0x24908c){logger[_0x2330('0x10')](_0x2330('0x11'),_0x60e630,util[_0x2330('0x12')](_0x24908c,{'showHidden':![],'depth':null}));_0x54b2ea('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x11bc06){logger['error'](_0x2330('0x13'),_0x60e630);_0x54b2ea(_0x2330('0x14'));}else{_0x4f7ced(_0x11bc06);}});}catch(_0x1e101c){_0x54b2ea(_0x1e101c);}});}function ActiveDirectoryAuthenticate(_0x368a4b,_0x1f011e,_0x14adae,_0xf0cff5){var _0x333a9d,_0x12ab0e;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x2330('0x15'),_0x1f011e);return _0xf0cff5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x2330('0x16')][_0x2330('0x17')]({'where':{'id':0x1},'attributes':[_0x2330('0x18'),_0x2330('0x19')],'raw':!![]})['then'](function(_0x4a1093){_0x333a9d=_0x4a1093;if(!_0x333a9d[_0x2330('0x18')]){logger[_0x2330('0x10')](_0x2330('0x1a'),_0x1f011e);throw new Error(_0x2330('0x14'));}return _0x368a4b['findOne']({'attributes':['id',_0x2330('0x1b'),_0x2330('0x1c'),_0x2330('0x1d'),'role',_0x2330('0x1e'),_0x2330('0x1f'),_0x2330('0x20'),_0x2330('0x21')],'where':{'name':_0x1f011e,'role':{'$or':[_0x2330('0x22'),_0x2330('0x23'),_0x2330('0x24')]},'adSsoEnabled':!![]}});})[_0x2330('0x25')](function(_0x1ba173){if(!_0x1ba173||_0x1ba173&&_0x1ba173['name']!==_0x1f011e){throw new Error(_0x2330('0x14'));}_0x12ab0e=_0x1ba173;var _0xd1bfa5=_0x12ab0e[_0x2330('0x1b')]+'@'+config[_0x2330('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0xd1bfa5,_0x14adae);})[_0x2330('0x25')](function(_0x4143e0){if(_0x12ab0e[_0x2330('0x1e')]){throw new Error(_0x2330('0x14'));}if(_0x333a9d[_0x2330('0x19')]>0x0){if(_0x12ab0e[_0x2330('0x1f')]){if(moment(_0x12ab0e[_0x2330('0x20')])[_0x2330('0x26')](_0x333a9d[_0x2330('0x19')],_0x2330('0x27'))>moment()){throw new Error(_0x2330('0x14'));}return utils[_0x2330('0x28')](_0x12ab0e,0x0,![],null)[_0x2330('0x25')](function(){return utils[_0x2330('0x29')](_0x12ab0e);})['then'](function(){return _0xf0cff5(null,_0x12ab0e);});}else{return utils[_0x2330('0x29')](_0x12ab0e)[_0x2330('0x25')](function(){return _0xf0cff5(null,_0x12ab0e);});}}else{return utils[_0x2330('0x29')](_0x12ab0e)[_0x2330('0x25')](function(){return _0xf0cff5(null,_0x12ab0e);});}})[_0x2330('0x2a')](function(_0xbb4157){return _0xf0cff5(null,![],_0xbb4157);});}function handleError(_0x36e2c4,_0x38d592,_0x2181b0){return _0x36e2c4[_0x2330('0x2b')](_0x38d592||0x1f4)[_0x2330('0x2c')]({'message':_0x2181b0?_0x2181b0['message']||_0x2181b0:''});}exports[_0x2330('0x2d')]=function(_0x40338b,_0x43431e,_0x4d4947){passport['authenticate']('ad-login',function(_0x1916f5,_0x2184de,_0x274031){var _0x396585=_0x1916f5||_0x274031;if(_0x396585){return handleError(_0x43431e,0x191,_0x396585);}if(!_0x2184de){return handleError(_0x43431e,0x194,{'message':_0x2330('0x2e')});}else{var _0x4349af={'payload':{'id':_0x2184de['id'],'role':_0x2184de['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4349af)[_0x2330('0x25')](function(_0x19c0de){_0x43431e['json']({'id':_0x2184de['id'],'token':_0x19c0de,'statusCall':'','isAlreadyLogged':_0x2184de[_0x2330('0x21')]});});}})(_0x40338b,_0x43431e,_0x4d4947);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x2330('0x1b'),'passwordField':'password'},function(_0x4f306f,_0x56ec0b,_0x4425f5){return ActiveDirectoryAuthenticate(db[_0x2330('0x2f')],_0x4f306f,_0x56ec0b,_0x4425f5);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index c374cf3..8bd7144 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 _0x1c17=['express','./authActiveDirectory.controller','post','login','exports'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x1c17,0x12c));var _0x71c1=function(_0x39d12a,_0x261ee2){_0x39d12a=_0x39d12a-0x0;var _0x42076e=_0x1c17[_0x39d12a];return _0x42076e;};'use strict';var express=require(_0x71c1('0x0'));var router=express['Router']();var controller=require(_0x71c1('0x1'));router[_0x71c1('0x2')]('/',controller[_0x71c1('0x3')]);module[_0x71c1('0x4')]=router; \ No newline at end of file +var _0x1ee9=['express','Router','./authActiveDirectory.controller','post','exports'];(function(_0x81bbe2,_0x42fb65){var _0x3c1f3b=function(_0x12f034){while(--_0x12f034){_0x81bbe2['push'](_0x81bbe2['shift']());}};_0x3c1f3b(++_0x42fb65);}(_0x1ee9,0x122));var _0x91ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1ee9[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x91ee('0x0'));var router=express[_0x91ee('0x1')]();var controller=require(_0x91ee('0x2'));router[_0x91ee('0x3')]('/',controller['login']);module[_0x91ee('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 016f11e..665b53a 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x3c9eef,_0x2ade23){var _0x48662d=function(_0xa634b7){while(--_0xa634b7){_0x3c9eef['push'](_0x3c9eef['shift']());}};_0x48662d(++_0x2ade23);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x30bd2a,_0x401cb){var _0x17c7af=function(_0x49ccba){while(--_0x49ccba){_0x30bd2a['push'](_0x30bd2a['shift']());}};_0x17c7af(++_0x401cb);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1058696..8c274b0 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 _0xeed7=['../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller'];(function(_0x64e527,_0x5f8b11){var _0x3784df=function(_0x304320){while(--_0x304320){_0x64e527['push'](_0x64e527['shift']());}};_0x3784df(++_0x5f8b11);}(_0xeed7,0xdf));var _0x7eed=function(_0x2ccc14,_0x186bd4){_0x2ccc14=_0x2ccc14-0x0;var _0x8b7dd7=_0xeed7[_0x2ccc14];return _0x8b7dd7;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x7eed('0x0')]();var controller=require(_0x7eed('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x7eed('0x2'));router[_0x7eed('0x3')]('/',controller[_0x7eed('0x4')]);router[_0x7eed('0x3')]('/callback',controller[_0x7eed('0x5')],authService[_0x7eed('0x6')],userController['login'],authService[_0x7eed('0x7')]);module[_0x7eed('0x8')]=router; \ No newline at end of file +var _0xb4cd=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie','exports','express','passport','Router'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xb4cd,0x11b));var _0xdb4c=function(_0xcdd38b,_0x20b8ae){_0xcdd38b=_0xcdd38b-0x0;var _0xf5e99=_0xb4cd[_0xcdd38b];return _0xf5e99;};'use strict';var express=require(_0xdb4c('0x0'));var passport=require(_0xdb4c('0x1'));var router=express[_0xdb4c('0x2')]();var controller=require(_0xdb4c('0x3'));var userController=require(_0xdb4c('0x4'));var authService=require(_0xdb4c('0x5'));router[_0xdb4c('0x6')]('/',controller[_0xdb4c('0x7')]);router[_0xdb4c('0x6')]('/callback',controller[_0xdb4c('0x8')],authService['isMiddleware'],userController[_0xdb4c('0x7')],authService[_0xdb4c('0x9')]);module[_0xdb4c('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2f77b92..8898908 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 _0xfbc8=['body','trim','toLowerCase','findOne','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','Password\x20reset!','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','blockedAt','getLicense','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','Smtp','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','generate'];(function(_0x3fa2c6,_0x2352b4){var _0x3c0256=function(_0x599ccf){while(--_0x599ccf){_0x3fa2c6['push'](_0x3fa2c6['shift']());}};_0x3c0256(++_0x2352b4);}(_0xfbc8,0x160));var _0x8fbc=function(_0x151d64,_0x360f73){_0x151d64=_0x151d64-0x0;var _0x409cfd=_0xfbc8[_0x151d64];return _0x409cfd;};'use strict';var util=require('util');var passport=require(_0x8fbc('0x0'));var LocalStrategy=require(_0x8fbc('0x1'))['Strategy'];var jayson=require(_0x8fbc('0x2'));var _=require('lodash');var rs=require(_0x8fbc('0x3'));var moment=require(_0x8fbc('0x4'));var db=require(_0x8fbc('0x5'))['db'];var authService=require(_0x8fbc('0x6'));var utils=require(_0x8fbc('0x7'));var client=jayson[_0x8fbc('0x8')][_0x8fbc('0x9')]({'port':0x232b});function localAuthenticate(_0x1052e4,_0x9e16e0,_0x5931e3,_0x261f33){var _0x18882b,_0x3e4fcb;return db[_0x8fbc('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x8fbc('0xb'),_0x8fbc('0xc')],'raw':!![]})[_0x8fbc('0xd')](function(_0x265aa0){_0x18882b=_0x265aa0;return _0x1052e4['findOne']({'attributes':['id',_0x8fbc('0xe'),_0x8fbc('0xf'),'salt',_0x8fbc('0x10'),'disabled',_0x8fbc('0x11'),'blockedAt',_0x8fbc('0x12')],'where':{'name':_0x9e16e0,'role':{'$or':[_0x8fbc('0x13'),_0x8fbc('0x14'),_0x8fbc('0x15')]}}});})[_0x8fbc('0xd')](function(_0x1e30ec){if(!_0x1e30ec||_0x1e30ec&&_0x1e30ec[_0x8fbc('0xe')]!==_0x9e16e0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3e4fcb=_0x1e30ec;return _0x3e4fcb;}})[_0x8fbc('0xd')](function(){_0x3e4fcb[_0x8fbc('0x16')](_0x5931e3,function(_0x2a7525,_0x29e351){var _0x1a9bee=_0x3e4fcb['loginAttempts']+0x1;if(_0x2a7525){return _0x261f33(_0x2a7525);}else if(!_0x29e351){if(_0x3e4fcb[_0x8fbc('0x17')]){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}else if(_0x18882b[_0x8fbc('0xb')]>0x0){if(_0x3e4fcb['blocked']){if(_0x18882b['blockDuration']>0x0){if(moment(_0x3e4fcb['blockedAt'])[_0x8fbc('0x19')](_0x18882b[_0x8fbc('0xc')],_0x8fbc('0x1a'))>moment()){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}else{return utils[_0x8fbc('0x1b')](_0x3e4fcb,_0x1a9bee,![],null)[_0x8fbc('0xd')](function(){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});});}}else{return _0x261f33(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1a9bee>=_0x18882b['allowedLoginAttempts']){return utils[_0x8fbc('0x1b')](_0x3e4fcb,0x0,!![],moment())['then'](function(){return _0x261f33(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x3e4fcb,_0x1a9bee,![],null)[_0x8fbc('0xd')](function(){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});});}}}else{return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}}else{if(_0x3e4fcb[_0x8fbc('0x17')]){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}else if(_0x18882b[_0x8fbc('0xb')]>0x0){if(_0x3e4fcb[_0x8fbc('0x11')]){if(_0x18882b['blockDuration']>0x0){if(moment(_0x3e4fcb[_0x8fbc('0x1c')])['add'](_0x18882b[_0x8fbc('0xc')],_0x8fbc('0x1a'))>moment()){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}else{return utils['clearBlockUser'](_0x3e4fcb,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3e4fcb);})['then'](function(){return _0x261f33(null,_0x3e4fcb);});}}else{return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}}else{return utils[_0x8fbc('0x1b')](_0x3e4fcb,0x0,![],null)[_0x8fbc('0xd')](function(){return utils[_0x8fbc('0x1d')](_0x3e4fcb);})[_0x8fbc('0xd')](function(){return _0x261f33(null,_0x3e4fcb);})['catch'](function(_0x484f95){return _0x261f33(null,![],_0x484f95);});}}else{if(_0x3e4fcb[_0x8fbc('0x11')]){return _0x261f33(null,![],{'message':_0x8fbc('0x18')});}else{return utils[_0x8fbc('0x1d')](_0x3e4fcb)[_0x8fbc('0xd')](function(){return _0x261f33(null,_0x3e4fcb);});}}}});})['catch'](function(_0x5326d0){return _0x261f33(null,![],_0x5326d0);});}function sendServiceMail(_0x56418e){return db[_0x8fbc('0x1e')][_0x8fbc('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x8fbc('0xe'),_0x8fbc('0x20')],'include':[{'model':db[_0x8fbc('0x21')],'as':'Smtp','include':[{'model':db[_0x8fbc('0x22')],'as':'CloudProvider'}]}]})[_0x8fbc('0xd')](function(_0x5d37d8){if(!_0x5d37d8){throw new Error(_0x8fbc('0x23'));}var _0x1e6dfb=_0x5d37d8['getSmtpOptions']();var _0xf941d6={'account':_0x1e6dfb,'message':_[_0x8fbc('0x24')]({'from':util[_0x8fbc('0x25')]('\x22%s\x22\x20<%s>',_0x5d37d8['name'],_0x5d37d8[_0x8fbc('0x20')]||_0x5d37d8[_0x8fbc('0x26')][_0x8fbc('0x14')])},_0x56418e)};return client[_0x8fbc('0x27')]('SendMail',_0xf941d6);})[_0x8fbc('0xd')](function(_0x127b04){if(_0x127b04[_0x8fbc('0x28')]){throw new Error(util[_0x8fbc('0x25')](_0x8fbc('0x29'),_0x127b04[_0x8fbc('0x28')][_0x8fbc('0x2a')]||JSON['stringify'](_0x127b04[_0x8fbc('0x28')])));}return!![];});}function handleError(_0x1d37ed,_0x148faf,_0x282226){return _0x1d37ed[_0x8fbc('0x2b')](_0x148faf||0x1f4)[_0x8fbc('0x2c')]({'message':_0x282226?_0x282226[_0x8fbc('0x2a')]||_0x282226:''});}exports[_0x8fbc('0x2d')]=function(_0x2945de,_0x2496bb,_0x190cf3){passport[_0x8fbc('0x16')](_0x8fbc('0x2e'),function(_0x30f4a8,_0xa86a43,_0x429883){var _0xd7c877=_0x30f4a8||_0x429883;if(_0xd7c877){return handleError(_0x2496bb,0x191,_0xd7c877);}if(!_0xa86a43){return handleError(_0x2496bb,0x194,{'message':_0x8fbc('0x2f')});}else{var _0x162527={'payload':{'id':_0xa86a43['id'],'role':_0xa86a43['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x162527)[_0x8fbc('0xd')](function(_0x4b52d5){_0x2496bb[_0x8fbc('0x30')]({'id':_0xa86a43['id'],'token':_0x4b52d5,'statusCall':'','isAlreadyLogged':_0xa86a43[_0x8fbc('0x31')]});});}})(_0x2945de,_0x2496bb,_0x190cf3);};exports[_0x8fbc('0x32')]=function(_0x138e36,_0x30e9c1){if(!_0x138e36['body'][_0x8fbc('0x20')]){return handleError(_0x30e9c1,0x1f4,{'message':_0x8fbc('0x33')});}var _0x289bb3=rs[_0x8fbc('0x34')]();_0x138e36[_0x8fbc('0x35')][_0x8fbc('0x20')]=_0x138e36[_0x8fbc('0x35')][_0x8fbc('0x20')][_0x8fbc('0x36')]()[_0x8fbc('0x37')]();var _0x190240;return db[_0x8fbc('0xa')][_0x8fbc('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x8fbc('0xd')](function(_0x91c3ce){_0x190240=_0x91c3ce;return db['User']['find']({'where':{'email':_0x138e36[_0x8fbc('0x35')][_0x8fbc('0x20')]}});})[_0x8fbc('0xd')](function(_0x46416a){if(!_0x46416a){throw new Error(_0x8fbc('0x39'));}if(_0x46416a[_0x8fbc('0x17')]){throw new Error(_0x8fbc('0x3a'));}if(_0x46416a[_0x8fbc('0x11')]){if(moment(_0x46416a['blockedAt'])['add'](_0x190240['blockDuration'],'minutes')>moment()){throw new Error(_0x8fbc('0x3b'));}else{_0x46416a[_0x8fbc('0x11')]=![];_0x46416a[_0x8fbc('0x1c')]=null;}}_0x46416a['resetPasswordToken']=_0x289bb3;_0x46416a[_0x8fbc('0x3c')]=Date['now']()+0x36ee80;return _0x46416a[_0x8fbc('0x3d')]();})[_0x8fbc('0xd')](function(){return sendServiceMail({'to':_0x138e36[_0x8fbc('0x35')][_0x8fbc('0x20')],'subject':_0x8fbc('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8fbc('0x3f')+_0x8fbc('0x40')+_0x138e36[_0x8fbc('0x41')]['host']+_0x8fbc('0x42')+_0x289bb3+'\x0a\x0a'+_0x8fbc('0x43')});})[_0x8fbc('0xd')](function(){_0x30e9c1[_0x8fbc('0x2b')](0xc8)[_0x8fbc('0x2c')]({'message':'Reset\x20Email\x20sent!'});})[_0x8fbc('0x44')](function(_0xfc29f6){return handleError(_0x30e9c1,0x1f4,_0xfc29f6);});};exports[_0x8fbc('0x45')]=function(_0x43f667,_0x191c34){return db[_0x8fbc('0x46')][_0x8fbc('0x1f')]({'where':{'resetPasswordToken':_0x43f667[_0x8fbc('0x47')][_0x8fbc('0x48')],'resetPasswordExpires':{'$gt':Date[_0x8fbc('0x49')]()}}})['then'](function(_0x5659ff){if(!_0x5659ff){throw new Error(_0x8fbc('0x4a'));}return db[_0x8fbc('0xa')][_0x8fbc('0x38')]({'attributes':['id','securePassword',_0x8fbc('0x4b'),_0x8fbc('0x4c')]})['then'](function(_0x2dadbd){if(_0x2dadbd[_0x8fbc('0x4d')])authService['validatePasswordPattern'](_0x43f667['body'][_0x8fbc('0xf')]);if(!_0x2dadbd[_0x8fbc('0x4b')]||!_0x5659ff[_0x8fbc('0x4e')])return _0x5659ff;authService[_0x8fbc('0x4f')](_0x43f667['body']['password'],_0x5659ff[_0x8fbc('0x4e')],_0x2dadbd[_0x8fbc('0x4c')]);return _0x5659ff;})[_0x8fbc('0xd')](function(){_0x5659ff[_0x8fbc('0xf')]=_0x43f667[_0x8fbc('0x35')]['password'];_0x5659ff['resetPasswordToken']=null;_0x5659ff[_0x8fbc('0x3c')]=null;return _0x5659ff['save']();});})[_0x8fbc('0xd')](function(){_0x191c34[_0x8fbc('0x2b')](0xc8)[_0x8fbc('0x2c')]({'message':_0x8fbc('0x50')});})[_0x8fbc('0x44')](function(_0x6b6ef1){return handleError(_0x191c34,0x1f4,_0x6b6ef1);});};passport['use'](_0x8fbc('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x8fbc('0xf')},function(_0x4e672b,_0x32f603,_0xff7fad){return localAuthenticate(db[_0x8fbc('0x46')],_0x4e672b,_0x32f603,_0xff7fad);})); \ No newline at end of file +var _0x5eae=['disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','message','stringify','status','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','send','Reset\x20Email\x20sent!','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role'];(function(_0x2668b8,_0x289515){var _0x275164=function(_0x36ca75){while(--_0x36ca75){_0x2668b8['push'](_0x2668b8['shift']());}};_0x275164(++_0x289515);}(_0x5eae,0xf4));var _0xe5ea=function(_0x593790,_0x201148){_0x593790=_0x593790-0x0;var _0x3c4ac8=_0x5eae[_0x593790];return _0x3c4ac8;};'use strict';var util=require(_0xe5ea('0x0'));var passport=require(_0xe5ea('0x1'));var LocalStrategy=require(_0xe5ea('0x2'))[_0xe5ea('0x3')];var jayson=require(_0xe5ea('0x4'));var _=require(_0xe5ea('0x5'));var rs=require(_0xe5ea('0x6'));var moment=require(_0xe5ea('0x7'));var db=require(_0xe5ea('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xe5ea('0x9'));var client=jayson[_0xe5ea('0xa')][_0xe5ea('0xb')]({'port':0x232b});function localAuthenticate(_0x5d5048,_0x221e82,_0x5d5678,_0x181d92){var _0x7209a,_0x1b1b03;return db[_0xe5ea('0xc')][_0xe5ea('0xd')]({'where':{'id':0x1},'attributes':[_0xe5ea('0xe'),'blockDuration'],'raw':!![]})[_0xe5ea('0xf')](function(_0x9c8d7d){_0x7209a=_0x9c8d7d;return _0x5d5048[_0xe5ea('0xd')]({'attributes':['id',_0xe5ea('0x10'),_0xe5ea('0x11'),_0xe5ea('0x12'),_0xe5ea('0x13'),_0xe5ea('0x14'),'blocked',_0xe5ea('0x15'),_0xe5ea('0x16')],'where':{'name':_0x221e82,'role':{'$or':[_0xe5ea('0x17'),_0xe5ea('0x18'),_0xe5ea('0x19')]}}});})[_0xe5ea('0xf')](function(_0x3b5437){if(!_0x3b5437||_0x3b5437&&_0x3b5437['name']!==_0x221e82){throw new Error(_0xe5ea('0x1a'));}else{_0x1b1b03=_0x3b5437;return _0x1b1b03;}})[_0xe5ea('0xf')](function(){_0x1b1b03['authenticate'](_0x5d5678,function(_0x27e95d,_0x1008c5){var _0x1bb800=_0x1b1b03['loginAttempts']+0x1;if(_0x27e95d){return _0x181d92(_0x27e95d);}else if(!_0x1008c5){if(_0x1b1b03[_0xe5ea('0x14')]){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}else if(_0x7209a['allowedLoginAttempts']>0x0){if(_0x1b1b03[_0xe5ea('0x1b')]){if(_0x7209a[_0xe5ea('0x1c')]>0x0){if(moment(_0x1b1b03[_0xe5ea('0x15')])[_0xe5ea('0x1d')](_0x7209a[_0xe5ea('0x1c')],'minutes')>moment()){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}else{return utils[_0xe5ea('0x1e')](_0x1b1b03,_0x1bb800,![],null)[_0xe5ea('0xf')](function(){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});});}}else{return _0x181d92(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1bb800>=_0x7209a[_0xe5ea('0xe')]){return utils[_0xe5ea('0x1e')](_0x1b1b03,0x0,!![],moment())[_0xe5ea('0xf')](function(){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});});}else{return utils['clearBlockUser'](_0x1b1b03,_0x1bb800,![],null)[_0xe5ea('0xf')](function(){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});});}}}else{return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}}else{if(_0x1b1b03[_0xe5ea('0x14')]){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}else if(_0x7209a[_0xe5ea('0xe')]>0x0){if(_0x1b1b03['blocked']){if(_0x7209a[_0xe5ea('0x1c')]>0x0){if(moment(_0x1b1b03['blockedAt'])[_0xe5ea('0x1d')](_0x7209a[_0xe5ea('0x1c')],_0xe5ea('0x1f'))>moment()){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}else{return utils[_0xe5ea('0x1e')](_0x1b1b03,0x0,![],null)[_0xe5ea('0xf')](function(){return utils[_0xe5ea('0x20')](_0x1b1b03);})[_0xe5ea('0xf')](function(){return _0x181d92(null,_0x1b1b03);});}}else{return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}}else{return utils[_0xe5ea('0x1e')](_0x1b1b03,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1b1b03);})[_0xe5ea('0xf')](function(){return _0x181d92(null,_0x1b1b03);})[_0xe5ea('0x21')](function(_0x46dab5){return _0x181d92(null,![],_0x46dab5);});}}else{if(_0x1b1b03[_0xe5ea('0x1b')]){return _0x181d92(null,![],{'message':_0xe5ea('0x1a')});}else{return utils[_0xe5ea('0x20')](_0x1b1b03)[_0xe5ea('0xf')](function(){return _0x181d92(null,_0x1b1b03);});}}}});})['catch'](function(_0x48c0f3){return _0x181d92(null,![],_0x48c0f3);});}function sendServiceMail(_0x16ed29){return db[_0xe5ea('0x22')][_0xe5ea('0x23')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xe5ea('0x24')],'as':_0xe5ea('0x25'),'include':[{'model':db[_0xe5ea('0x26')],'as':_0xe5ea('0x26')}]}]})['then'](function(_0x517a2b){if(!_0x517a2b){throw new Error(_0xe5ea('0x27'));}var _0x112419=_0x517a2b[_0xe5ea('0x28')]();var _0x1ea20e={'account':_0x112419,'message':_[_0xe5ea('0x29')]({'from':util[_0xe5ea('0x2a')](_0xe5ea('0x2b'),_0x517a2b[_0xe5ea('0x10')],_0x517a2b[_0xe5ea('0x2c')]||_0x517a2b[_0xe5ea('0x25')][_0xe5ea('0x18')])},_0x16ed29)};return client[_0xe5ea('0x2d')](_0xe5ea('0x2e'),_0x1ea20e);})[_0xe5ea('0xf')](function(_0x57b93a){if(_0x57b93a[_0xe5ea('0x2f')]){throw new Error(util[_0xe5ea('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x57b93a[_0xe5ea('0x2f')][_0xe5ea('0x30')]||JSON[_0xe5ea('0x31')](_0x57b93a['error'])));}return!![];});}function handleError(_0x50ca2d,_0x1f732a,_0x43784b){return _0x50ca2d[_0xe5ea('0x32')](_0x1f732a||0x1f4)['send']({'message':_0x43784b?_0x43784b[_0xe5ea('0x30')]||_0x43784b:''});}exports['login']=function(_0x186edc,_0x5987b7,_0x597d65){passport[_0xe5ea('0x33')](_0xe5ea('0x34'),function(_0x205bff,_0x374d67,_0x4f6be1){var _0x8b0ea1=_0x205bff||_0x4f6be1;if(_0x8b0ea1){return handleError(_0x5987b7,0x191,_0x8b0ea1);}if(!_0x374d67){return handleError(_0x5987b7,0x194,{'message':_0xe5ea('0x35')});}else{var _0x45b1b0={'payload':{'id':_0x374d67['id'],'role':_0x374d67[_0xe5ea('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xe5ea('0x36')](_0x45b1b0)[_0xe5ea('0xf')](function(_0x7edb7c){_0x5987b7[_0xe5ea('0x37')]({'id':_0x374d67['id'],'token':_0x7edb7c,'statusCall':'','isAlreadyLogged':_0x374d67[_0xe5ea('0x38')]});});}})(_0x186edc,_0x5987b7,_0x597d65);};exports[_0xe5ea('0x39')]=function(_0x136acd,_0x9dd7bd){if(!_0x136acd[_0xe5ea('0x3a')][_0xe5ea('0x2c')]){return handleError(_0x9dd7bd,0x1f4,{'message':_0xe5ea('0x3b')});}var _0x3da701=rs[_0xe5ea('0x3c')]();_0x136acd[_0xe5ea('0x3a')][_0xe5ea('0x2c')]=_0x136acd['body'][_0xe5ea('0x2c')][_0xe5ea('0x3d')]()[_0xe5ea('0x3e')]();var _0x26773c;return db[_0xe5ea('0xc')][_0xe5ea('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xe5ea('0xf')](function(_0x542700){_0x26773c=_0x542700;return db['User']['find']({'where':{'email':_0x136acd[_0xe5ea('0x3a')][_0xe5ea('0x2c')]}});})[_0xe5ea('0xf')](function(_0x4e1749){if(!_0x4e1749){throw new Error(_0xe5ea('0x3f'));}if(_0x4e1749['disabled']){throw new Error(_0xe5ea('0x40'));}if(_0x4e1749[_0xe5ea('0x1b')]){if(moment(_0x4e1749['blockedAt'])[_0xe5ea('0x1d')](_0x26773c[_0xe5ea('0x1c')],_0xe5ea('0x1f'))>moment()){throw new Error(_0xe5ea('0x41'));}else{_0x4e1749[_0xe5ea('0x1b')]=![];_0x4e1749[_0xe5ea('0x15')]=null;}}_0x4e1749[_0xe5ea('0x42')]=_0x3da701;_0x4e1749[_0xe5ea('0x43')]=Date['now']()+0x36ee80;return _0x4e1749['save']();})[_0xe5ea('0xf')](function(){return sendServiceMail({'to':_0x136acd[_0xe5ea('0x3a')][_0xe5ea('0x2c')],'subject':_0xe5ea('0x44'),'text':_0xe5ea('0x45')+_0xe5ea('0x46')+_0xe5ea('0x47')+_0x136acd[_0xe5ea('0x48')]['host']+_0xe5ea('0x49')+_0x3da701+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xe5ea('0xf')](function(){_0x9dd7bd['status'](0xc8)[_0xe5ea('0x4a')]({'message':_0xe5ea('0x4b')});})['catch'](function(_0xdf9686){return handleError(_0x9dd7bd,0x1f4,_0xdf9686);});};exports[_0xe5ea('0x4c')]=function(_0x46314d,_0xd4588c){return db[_0xe5ea('0x4d')][_0xe5ea('0x23')]({'where':{'resetPasswordToken':_0x46314d[_0xe5ea('0x4e')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x248eaf){if(!_0x248eaf){throw new Error(_0xe5ea('0x4f'));}return db[_0xe5ea('0xc')]['findOne']({'attributes':['id','securePassword',_0xe5ea('0x50'),_0xe5ea('0x51')]})[_0xe5ea('0xf')](function(_0x10bd9d){if(_0x10bd9d[_0xe5ea('0x52')])authService[_0xe5ea('0x53')](_0x46314d[_0xe5ea('0x3a')]['password']);if(!_0x10bd9d[_0xe5ea('0x50')]||!_0x248eaf[_0xe5ea('0x54')])return _0x248eaf;authService[_0xe5ea('0x55')](_0x46314d[_0xe5ea('0x3a')]['password'],_0x248eaf['previousPasswords'],_0x10bd9d[_0xe5ea('0x51')]);return _0x248eaf;})['then'](function(){_0x248eaf[_0xe5ea('0x11')]=_0x46314d[_0xe5ea('0x3a')][_0xe5ea('0x11')];_0x248eaf[_0xe5ea('0x42')]=null;_0x248eaf['resetPasswordExpires']=null;return _0x248eaf[_0xe5ea('0x56')]();});})[_0xe5ea('0xf')](function(){_0xd4588c[_0xe5ea('0x32')](0xc8)[_0xe5ea('0x4a')]({'message':_0xe5ea('0x57')});})['catch'](function(_0x1fefed){return handleError(_0xd4588c,0x1f4,_0x1fefed);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0xe5ea('0x10'),'passwordField':_0xe5ea('0x11')},function(_0x25d6ae,_0xf739f2,_0x230175){return localAuthenticate(db[_0xe5ea('0x4d')],_0x25d6ae,_0xf739f2,_0x230175);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 01b69bf..8a6ffc6 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 _0x6c8b=['/reset/:token','exports','./authLocal.controller','login','post','/forgot','forgot'];(function(_0x461aa5,_0x137853){var _0x44a4e7=function(_0x3a6d7d){while(--_0x3a6d7d){_0x461aa5['push'](_0x461aa5['shift']());}};_0x44a4e7(++_0x137853);}(_0x6c8b,0xf0));var _0xb6c8=function(_0x8fb387,_0x22858d){_0x8fb387=_0x8fb387-0x0;var _0xea5772=_0x6c8b[_0x8fb387];return _0xea5772;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xb6c8('0x0'));router['post']('/',controller[_0xb6c8('0x1')]);router[_0xb6c8('0x2')](_0xb6c8('0x3'),controller[_0xb6c8('0x4')]);router[_0xb6c8('0x2')](_0xb6c8('0x5'),controller['reset']);module[_0xb6c8('0x6')]=router; \ No newline at end of file +var _0xbea1=['/forgot','forgot','/reset/:token','reset','./authLocal.controller','post','login'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0xbea1,0x100));var _0x1bea=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0xbea1[_0x5a3ee9];return _0x45032c;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x1bea('0x0'));router[_0x1bea('0x1')]('/',controller[_0x1bea('0x2')]);router[_0x1bea('0x1')](_0x1bea('0x3'),controller[_0x1bea('0x4')]);router[_0x1bea('0x1')](_0x1bea('0x5'),controller[_0x1bea('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index da53f19..4686638 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 _0x25d6=['STRING','INTEGER','exports'];(function(_0x4f4e83,_0x46034c){var _0x2ad9ab=function(_0x369539){while(--_0x369539){_0x4f4e83['push'](_0x4f4e83['shift']());}};_0x2ad9ab(++_0x46034c);}(_0x25d6,0x173));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x625d('0x0')]={'name':{'type':Sequelize[_0x625d('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x625d('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x625d('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x145f=['BOOLEAN','sequelize','STRING'];(function(_0x5838fe,_0x57be64){var _0x13a477=function(_0x50edf1){while(--_0x50edf1){_0x5838fe['push'](_0x5838fe['shift']());}};_0x13a477(++_0x57be64);}(_0x145f,0x1bd));var _0xf145=function(_0x5185e1,_0x2c68d2){_0x5185e1=_0x5185e1-0x0;var _0x55b3a4=_0x145f[_0x5185e1];return _0x55b3a4;};'use strict';var Sequelize=require(_0xf145('0x0'));module['exports']={'name':{'type':Sequelize[_0xf145('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xf145('0x1')]},'description':{'type':Sequelize[_0xf145('0x1')]},'status':{'type':Sequelize[_0xf145('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index b2c816c..a4fcb23 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 _0x7f4a=['end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','name','send','index','Automation','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','addConditions','Condition','ids','omit','findOne','order','getConditions','nolimit','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status'];(function(_0x4717a8,_0x2bc51b){var _0x4cd496=function(_0x5b2da4){while(--_0x5b2da4){_0x4717a8['push'](_0x4717a8['shift']());}};_0x4cd496(++_0x2bc51b);}(_0x7f4a,0x8d));var _0xa7f4=function(_0x4dd0a7,_0xb4399f){_0x4dd0a7=_0x4dd0a7-0x0;var _0x487e9b=_0x7f4a[_0x4dd0a7];return _0x487e9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7f4('0x0'));var zipdir=require(_0xa7f4('0x1'));var jsonpatch=require(_0xa7f4('0x2'));var rp=require(_0xa7f4('0x3'));var moment=require(_0xa7f4('0x4'));var BPromise=require(_0xa7f4('0x5'));var Mustache=require(_0xa7f4('0x6'));var util=require('util');var path=require(_0xa7f4('0x7'));var sox=require(_0xa7f4('0x8'));var csv=require(_0xa7f4('0x9'));var ejs=require(_0xa7f4('0xa'));var fs=require('fs');var fs_extra=require(_0xa7f4('0xb'));var _=require(_0xa7f4('0xc'));var squel=require('squel');var crypto=require(_0xa7f4('0xd'));var jsforce=require(_0xa7f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa7f4('0x9'));var querystring=require('querystring');var Papa=require(_0xa7f4('0xf'));var Redis=require(_0xa7f4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa7f4('0x11'));var hardwareService=require(_0xa7f4('0x12'));var logger=require('../../config/logger')(_0xa7f4('0x13'));var utils=require('../../config/utils');var config=require(_0xa7f4('0x14'));var licenseUtil=require(_0xa7f4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4082ff,_0x1d74d6){_0x1d74d6=_0x1d74d6||0xcc;return function(_0x484052){if(_0x484052){return _0x4082ff['sendStatus'](_0x1d74d6);}return _0x4082ff[_0xa7f4('0x16')](_0x1d74d6)[_0xa7f4('0x17')]();};}function respondWithResult(_0x31c45e,_0x1db2bc){_0x1db2bc=_0x1db2bc||0xc8;return function(_0x377956){if(_0x377956){return _0x31c45e[_0xa7f4('0x16')](_0x1db2bc)[_0xa7f4('0x18')](_0x377956);}};}function respondWithFilteredResult(_0x587d44,_0x2d3ced){return function(_0x4c6b4b){if(_0x4c6b4b){var _0x4d85e0=typeof _0x2d3ced['offset']===_0xa7f4('0x19')&&typeof _0x2d3ced[_0xa7f4('0x1a')]==='undefined';var _0x37ba16=_0x4c6b4b[_0xa7f4('0x1b')];var _0x1cf967=_0x4d85e0?0x0:_0x2d3ced[_0xa7f4('0x1c')];var _0x164a3f=_0x4d85e0?_0x4c6b4b[_0xa7f4('0x1b')]:_0x2d3ced['offset']+_0x2d3ced['limit'];var _0x5e71d6;if(_0x164a3f>=_0x37ba16){_0x164a3f=_0x37ba16;_0x5e71d6=0xc8;}else{_0x5e71d6=0xce;}_0x587d44['status'](_0x5e71d6);return _0x587d44[_0xa7f4('0x1d')](_0xa7f4('0x1e'),_0x1cf967+'-'+_0x164a3f+'/'+_0x37ba16)['json'](_0x4c6b4b);}return null;};}function patchUpdates(_0x194451){return function(_0x5ae431){try{jsonpatch['apply'](_0x5ae431,_0x194451,!![]);}catch(_0x9cc72b){return BPromise[_0xa7f4('0x1f')](_0x9cc72b);}return _0x5ae431[_0xa7f4('0x20')]();};}function saveUpdates(_0x300c3c,_0x176df1){return function(_0x3e0375){if(_0x3e0375){return _0x3e0375['update'](_0x300c3c)[_0xa7f4('0x21')](function(_0x226052){return _0x226052;});}return null;};}function removeEntity(_0x1d2a45,_0x40b3d3){return function(_0x1fe22a){if(_0x1fe22a){return _0x1fe22a[_0xa7f4('0x22')]()[_0xa7f4('0x21')](function(){_0x1d2a45['status'](0xcc)[_0xa7f4('0x17')]();});}};}function handleEntityNotFound(_0x3eafc2,_0x41ebd1){return function(_0x449c76){if(!_0x449c76){_0x3eafc2['sendStatus'](0x194);}return _0x449c76;};}function handleError(_0x20edd6,_0x1e209d){_0x1e209d=_0x1e209d||0x1f4;return function(_0x2e6361){logger[_0xa7f4('0x23')](_0x2e6361['stack']);if(_0x2e6361[_0xa7f4('0x24')]){delete _0x2e6361[_0xa7f4('0x24')];}_0x20edd6[_0xa7f4('0x16')](_0x1e209d)[_0xa7f4('0x25')](_0x2e6361);};}exports[_0xa7f4('0x26')]=function(_0x3c0de9,_0x4ee712){var _0x370c00={},_0x5ef663={},_0x1293f8={'count':0x0,'rows':[]};var _0x436a53=_['map'](db[_0xa7f4('0x27')][_0xa7f4('0x28')],function(_0x5f4543){return{'name':_0x5f4543[_0xa7f4('0x29')],'type':_0x5f4543[_0xa7f4('0x2a')]['key']};});_0x5ef663[_0xa7f4('0x2b')]=_[_0xa7f4('0x2c')](_0x436a53,_0xa7f4('0x24'));_0x5ef663[_0xa7f4('0x2d')]=_[_0xa7f4('0x2e')](_0x3c0de9[_0xa7f4('0x2d')]);_0x5ef663[_0xa7f4('0x2f')]=_[_0xa7f4('0x30')](_0x5ef663[_0xa7f4('0x2b')],_0x5ef663[_0xa7f4('0x2d')]);_0x370c00[_0xa7f4('0x31')]=_['intersection'](_0x5ef663[_0xa7f4('0x2b')],qs[_0xa7f4('0x32')](_0x3c0de9[_0xa7f4('0x2d')]['fields']));_0x370c00[_0xa7f4('0x31')]=_0x370c00[_0xa7f4('0x31')][_0xa7f4('0x33')]?_0x370c00['attributes']:_0x5ef663[_0xa7f4('0x2b')];if(!_0x3c0de9[_0xa7f4('0x2d')][_0xa7f4('0x34')]('nolimit')){_0x370c00[_0xa7f4('0x1a')]=qs[_0xa7f4('0x1a')](_0x3c0de9[_0xa7f4('0x2d')][_0xa7f4('0x1a')]);_0x370c00['offset']=qs[_0xa7f4('0x1c')](_0x3c0de9['query'][_0xa7f4('0x1c')]);}_0x370c00['order']=qs['sort'](_0x3c0de9['query'][_0xa7f4('0x35')]);_0x370c00['where']=qs[_0xa7f4('0x2f')](_[_0xa7f4('0x36')](_0x3c0de9[_0xa7f4('0x2d')],_0x5ef663[_0xa7f4('0x2f')]),_0x436a53);if(_0x3c0de9['query'][_0xa7f4('0x37')]){_0x370c00[_0xa7f4('0x38')]=_[_0xa7f4('0x39')](_0x370c00[_0xa7f4('0x38')],{'$or':_['map'](_0x436a53,function(_0x4dd27b){if(_0x4dd27b[_0xa7f4('0x2a')]!==_0xa7f4('0x3a')){var _0x135ce7={};_0x135ce7[_0x4dd27b[_0xa7f4('0x24')]]={'$like':'%'+_0x3c0de9[_0xa7f4('0x2d')][_0xa7f4('0x37')]+'%'};return _0x135ce7;}})});}_0x370c00=_['merge']({},_0x370c00,_0x3c0de9[_0xa7f4('0x3b')]);var _0x21dcf8={'where':_0x370c00[_0xa7f4('0x38')]};return db[_0xa7f4('0x27')][_0xa7f4('0x1b')](_0x21dcf8)[_0xa7f4('0x21')](function(_0x543e20){_0x1293f8[_0xa7f4('0x1b')]=_0x543e20;if(_0x3c0de9[_0xa7f4('0x2d')][_0xa7f4('0x3c')]){_0x370c00['include']=[{'all':!![]}];}return db[_0xa7f4('0x27')][_0xa7f4('0x3d')](_0x370c00);})[_0xa7f4('0x21')](function(_0x4c9592){_0x1293f8[_0xa7f4('0x3e')]=_0x4c9592;return _0x1293f8;})[_0xa7f4('0x21')](respondWithFilteredResult(_0x4ee712,_0x370c00))['catch'](handleError(_0x4ee712,null));};exports[_0xa7f4('0x3f')]=function(_0x16e92b,_0x447c37){var _0x4eaea6={'raw':![],'where':{'id':_0x16e92b[_0xa7f4('0x40')]['id']}},_0x36c9c3={};_0x36c9c3[_0xa7f4('0x2b')]=_[_0xa7f4('0x2e')](db[_0xa7f4('0x27')]['rawAttributes']);_0x36c9c3['query']=_['keys'](_0x16e92b[_0xa7f4('0x2d')]);_0x36c9c3[_0xa7f4('0x2f')]=_['intersection'](_0x36c9c3['model'],_0x36c9c3['query']);_0x4eaea6[_0xa7f4('0x31')]=_['intersection'](_0x36c9c3[_0xa7f4('0x2b')],qs['fields'](_0x16e92b['query'][_0xa7f4('0x32')]));_0x4eaea6[_0xa7f4('0x31')]=_0x4eaea6[_0xa7f4('0x31')]['length']?_0x4eaea6[_0xa7f4('0x31')]:_0x36c9c3[_0xa7f4('0x2b')];if(_0x16e92b['query'][_0xa7f4('0x3c')]){_0x4eaea6[_0xa7f4('0x41')]=[{'all':!![]}];}_0x4eaea6=_[_0xa7f4('0x39')]({},_0x4eaea6,_0x16e92b[_0xa7f4('0x3b')]);return db[_0xa7f4('0x27')][_0xa7f4('0x42')](_0x4eaea6)[_0xa7f4('0x21')](handleEntityNotFound(_0x447c37,null))['then'](respondWithResult(_0x447c37,null))[_0xa7f4('0x43')](handleError(_0x447c37,null));};exports['create']=function(_0x5197e2,_0x1b0a89){return db[_0xa7f4('0x27')][_0xa7f4('0x44')](_0x5197e2[_0xa7f4('0x45')],{})[_0xa7f4('0x21')](respondWithResult(_0x1b0a89,0xc9))[_0xa7f4('0x43')](handleError(_0x1b0a89,null));};exports[_0xa7f4('0x46')]=function(_0x20ac45,_0x55cfff){if(_0x20ac45[_0xa7f4('0x45')]['id']){delete _0x20ac45[_0xa7f4('0x45')]['id'];}return db['Automation'][_0xa7f4('0x42')]({'where':{'id':_0x20ac45[_0xa7f4('0x40')]['id']}})['then'](handleEntityNotFound(_0x55cfff,null))[_0xa7f4('0x21')](saveUpdates(_0x20ac45[_0xa7f4('0x45')],null))[_0xa7f4('0x21')](respondWithResult(_0x55cfff,null))['catch'](handleError(_0x55cfff,null));};exports[_0xa7f4('0x22')]=function(_0x31b1d5,_0x53547d){return db[_0xa7f4('0x27')][_0xa7f4('0x42')]({'where':{'id':_0x31b1d5[_0xa7f4('0x40')]['id']}})[_0xa7f4('0x21')](handleEntityNotFound(_0x53547d,null))[_0xa7f4('0x21')](removeEntity(_0x53547d,null))['catch'](handleError(_0x53547d,null));};exports[_0xa7f4('0x47')]=function(_0x5467b2,_0x557080,_0x5259a1){return db[_0xa7f4('0x48')][_0xa7f4('0x42')]({'where':{'id':_0x5467b2['params']['id']}})[_0xa7f4('0x21')](handleEntityNotFound(_0x557080,null))['then'](function(_0x55d078){if(_0x55d078){return _0x55d078[_0xa7f4('0x47')](_0x5467b2['body'][_0xa7f4('0x49')],_[_0xa7f4('0x4a')](_0x5467b2['body'],['ids','id'])||{});}})[_0xa7f4('0x21')](respondWithResult(_0x557080,null))['catch'](handleError(_0x557080,null));};exports['getConditions']=function(_0x1dc313,_0x17f916,_0x1f25c5){var _0xe6c2fa={};var _0x343967={};var _0x29db60;var _0xaa694c;return db[_0xa7f4('0x27')][_0xa7f4('0x4b')]({'where':{'id':_0x1dc313[_0xa7f4('0x40')]['id']}})[_0xa7f4('0x21')](handleEntityNotFound(_0x17f916,null))[_0xa7f4('0x21')](function(_0x28441f){if(_0x28441f){_0x29db60=_0x28441f;_0x343967['model']=_['keys'](db[_0xa7f4('0x48')][_0xa7f4('0x28')]);_0x343967[_0xa7f4('0x2d')]=_['keys'](_0x1dc313['query']);_0x343967[_0xa7f4('0x2f')]=_['intersection'](_0x343967[_0xa7f4('0x2b')],_0x343967[_0xa7f4('0x2d')]);_0xe6c2fa['attributes']=_[_0xa7f4('0x30')](_0x343967[_0xa7f4('0x2b')],qs[_0xa7f4('0x32')](_0x1dc313[_0xa7f4('0x2d')]['fields']));_0xe6c2fa[_0xa7f4('0x31')]=_0xe6c2fa[_0xa7f4('0x31')][_0xa7f4('0x33')]?_0xe6c2fa[_0xa7f4('0x31')]:_0x343967[_0xa7f4('0x2b')];_0xe6c2fa[_0xa7f4('0x4c')]=qs[_0xa7f4('0x35')](_0x1dc313[_0xa7f4('0x2d')]['sort']);_0xe6c2fa[_0xa7f4('0x38')]=qs[_0xa7f4('0x2f')](_[_0xa7f4('0x36')](_0x1dc313[_0xa7f4('0x2d')],_0x343967[_0xa7f4('0x2f')]));if(_0x1dc313['query'][_0xa7f4('0x37')]){_0xe6c2fa[_0xa7f4('0x38')]=_[_0xa7f4('0x39')](_0xe6c2fa[_0xa7f4('0x38')],{'$or':_[_0xa7f4('0x2c')](_0xe6c2fa[_0xa7f4('0x31')],function(_0x1459b7){var _0x52c7f9={};_0x52c7f9[_0x1459b7]={'$like':'%'+_0x1dc313[_0xa7f4('0x2d')][_0xa7f4('0x37')]+'%'};return _0x52c7f9;})});}_0xe6c2fa=_[_0xa7f4('0x39')]({},_0xe6c2fa,_0x1dc313[_0xa7f4('0x3b')]);return _0x29db60[_0xa7f4('0x4d')](_0xe6c2fa);}})[_0xa7f4('0x21')](function(_0x1048c3){if(_0x1048c3){_0xaa694c=_0x1048c3[_0xa7f4('0x33')];if(!_0x1dc313[_0xa7f4('0x2d')][_0xa7f4('0x34')](_0xa7f4('0x4e'))){_0xe6c2fa['limit']=qs[_0xa7f4('0x1a')](_0x1dc313[_0xa7f4('0x2d')][_0xa7f4('0x1a')]);_0xe6c2fa[_0xa7f4('0x1c')]=qs['offset'](_0x1dc313[_0xa7f4('0x2d')]['offset']);}return _0x29db60[_0xa7f4('0x4d')](_0xe6c2fa);}})[_0xa7f4('0x21')](function(_0x257e51){if(_0x257e51){return _0x257e51?{'count':_0xaa694c,'rows':_0x257e51}:null;}})[_0xa7f4('0x21')](respondWithResult(_0x17f916,null))['catch'](handleError(_0x17f916,null));};exports[_0xa7f4('0x4f')]=function(_0x1cfc10,_0x31c84f,_0x2d9f7d){return db[_0xa7f4('0x50')][_0xa7f4('0x42')]({'where':{'id':_0x1cfc10[_0xa7f4('0x40')]['id']}})[_0xa7f4('0x21')](handleEntityNotFound(_0x31c84f,null))['then'](function(_0x4e849c){if(_0x4e849c){return _0x4e849c[_0xa7f4('0x4f')](_0x1cfc10[_0xa7f4('0x45')][_0xa7f4('0x49')],_[_0xa7f4('0x4a')](_0x1cfc10[_0xa7f4('0x45')],[_0xa7f4('0x49'),'id'])||{});}})[_0xa7f4('0x21')](respondWithResult(_0x31c84f,null))[_0xa7f4('0x43')](handleError(_0x31c84f,null));};exports[_0xa7f4('0x51')]=function(_0x4331b8,_0x515dd4,_0x103c9a){var _0x327aba={};var _0x5005e2={};var _0xb0aec7;var _0x1881d4;return db[_0xa7f4('0x27')][_0xa7f4('0x4b')]({'where':{'id':_0x4331b8[_0xa7f4('0x40')]['id']}})[_0xa7f4('0x21')](handleEntityNotFound(_0x515dd4,null))['then'](function(_0x35a85f){if(_0x35a85f){_0xb0aec7=_0x35a85f;_0x5005e2[_0xa7f4('0x2b')]=_['keys'](db[_0xa7f4('0x50')][_0xa7f4('0x28')]);_0x5005e2['query']=_['keys'](_0x4331b8[_0xa7f4('0x2d')]);_0x5005e2[_0xa7f4('0x2f')]=_[_0xa7f4('0x30')](_0x5005e2[_0xa7f4('0x2b')],_0x5005e2[_0xa7f4('0x2d')]);_0x327aba['attributes']=_[_0xa7f4('0x30')](_0x5005e2[_0xa7f4('0x2b')],qs[_0xa7f4('0x32')](_0x4331b8[_0xa7f4('0x2d')][_0xa7f4('0x32')]));_0x327aba[_0xa7f4('0x31')]=_0x327aba[_0xa7f4('0x31')][_0xa7f4('0x33')]?_0x327aba[_0xa7f4('0x31')]:_0x5005e2['model'];_0x327aba[_0xa7f4('0x4c')]=qs[_0xa7f4('0x35')](_0x4331b8[_0xa7f4('0x2d')]['sort']);_0x327aba[_0xa7f4('0x38')]=qs['filters'](_['pick'](_0x4331b8['query'],_0x5005e2[_0xa7f4('0x2f')]));if(_0x4331b8['query']['filter']){_0x327aba[_0xa7f4('0x38')]=_[_0xa7f4('0x39')](_0x327aba[_0xa7f4('0x38')],{'$or':_['map'](_0x327aba[_0xa7f4('0x31')],function(_0x12588c){var _0x1fd2db={};_0x1fd2db[_0x12588c]={'$like':'%'+_0x4331b8[_0xa7f4('0x2d')]['filter']+'%'};return _0x1fd2db;})});}_0x327aba=_[_0xa7f4('0x39')]({},_0x327aba,_0x4331b8['options']);return _0xb0aec7[_0xa7f4('0x51')](_0x327aba);}})[_0xa7f4('0x21')](function(_0x152203){if(_0x152203){_0x1881d4=_0x152203[_0xa7f4('0x33')];if(!_0x4331b8[_0xa7f4('0x2d')][_0xa7f4('0x34')]('nolimit')){_0x327aba[_0xa7f4('0x1a')]=qs['limit'](_0x4331b8[_0xa7f4('0x2d')]['limit']);_0x327aba[_0xa7f4('0x1c')]=qs[_0xa7f4('0x1c')](_0x4331b8[_0xa7f4('0x2d')][_0xa7f4('0x1c')]);}return _0xb0aec7[_0xa7f4('0x51')](_0x327aba);}})[_0xa7f4('0x21')](function(_0x4d6782){if(_0x4d6782){return _0x4d6782?{'count':_0x1881d4,'rows':_0x4d6782}:null;}})['then'](respondWithResult(_0x515dd4,null))['catch'](handleError(_0x515dd4,null));}; \ No newline at end of file +var _0xfa0e=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','Automation','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','create','update','body','addConditions','Condition','find','ids','omit','findOne','getConditions','addActions','getActions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x3f37fb,_0x14d440){var _0x59cacc=function(_0xf484ad){while(--_0xf484ad){_0x3f37fb['push'](_0x3f37fb['shift']());}};_0x59cacc(++_0x14d440);}(_0xfa0e,0x91));var _0xefa0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa0e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xefa0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefa0('0x1'));var jsonpatch=require(_0xefa0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xefa0('0x3'));var Mustache=require(_0xefa0('0x4'));var util=require(_0xefa0('0x5'));var path=require(_0xefa0('0x6'));var sox=require(_0xefa0('0x7'));var csv=require('to-csv');var ejs=require(_0xefa0('0x8'));var fs=require('fs');var fs_extra=require(_0xefa0('0x9'));var _=require('lodash');var squel=require(_0xefa0('0xa'));var crypto=require('crypto');var jsforce=require(_0xefa0('0xb'));var deskjs=require(_0xefa0('0xc'));var toCsv=require(_0xefa0('0xd'));var querystring=require(_0xefa0('0xe'));var Papa=require(_0xefa0('0xf'));var Redis=require(_0xefa0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xefa0('0x11'));var as=require(_0xefa0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xefa0('0x13'));var utils=require(_0xefa0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xefa0('0x15'));var db=require(_0xefa0('0x16'))['db'];function respondWithStatusCode(_0x509946,_0x16b502){_0x16b502=_0x16b502||0xcc;return function(_0xd52145){if(_0xd52145){return _0x509946[_0xefa0('0x17')](_0x16b502);}return _0x509946['status'](_0x16b502)[_0xefa0('0x18')]();};}function respondWithResult(_0x3df712,_0x35eddd){_0x35eddd=_0x35eddd||0xc8;return function(_0x44797d){if(_0x44797d){return _0x3df712[_0xefa0('0x19')](_0x35eddd)[_0xefa0('0x1a')](_0x44797d);}};}function respondWithFilteredResult(_0x2e1d23,_0x529624){return function(_0x34e447){if(_0x34e447){var _0x2c5af5=typeof _0x529624[_0xefa0('0x1b')]==='undefined'&&typeof _0x529624[_0xefa0('0x1c')]===_0xefa0('0x1d');var _0x23e34d=_0x34e447[_0xefa0('0x1e')];var _0x4ea081=_0x2c5af5?0x0:_0x529624['offset'];var _0x24a25d=_0x2c5af5?_0x34e447[_0xefa0('0x1e')]:_0x529624[_0xefa0('0x1b')]+_0x529624[_0xefa0('0x1c')];var _0x3eea2f;if(_0x24a25d>=_0x23e34d){_0x24a25d=_0x23e34d;_0x3eea2f=0xc8;}else{_0x3eea2f=0xce;}_0x2e1d23[_0xefa0('0x19')](_0x3eea2f);return _0x2e1d23[_0xefa0('0x1f')](_0xefa0('0x20'),_0x4ea081+'-'+_0x24a25d+'/'+_0x23e34d)[_0xefa0('0x1a')](_0x34e447);}return null;};}function patchUpdates(_0x262322){return function(_0x3eef4e){try{jsonpatch[_0xefa0('0x21')](_0x3eef4e,_0x262322,!![]);}catch(_0x1b3c47){return BPromise['reject'](_0x1b3c47);}return _0x3eef4e[_0xefa0('0x22')]();};}function saveUpdates(_0x403cf3,_0x4cf205){return function(_0x3a7a47){if(_0x3a7a47){return _0x3a7a47['update'](_0x403cf3)[_0xefa0('0x23')](function(_0x1493c0){return _0x1493c0;});}return null;};}function removeEntity(_0x5248b4,_0x4e3eef){return function(_0x518b7c){if(_0x518b7c){return _0x518b7c[_0xefa0('0x24')]()['then'](function(){_0x5248b4[_0xefa0('0x19')](0xcc)[_0xefa0('0x18')]();});}};}function handleEntityNotFound(_0xe0d56e,_0xaf10fb){return function(_0x4a20c3){if(!_0x4a20c3){_0xe0d56e[_0xefa0('0x17')](0x194);}return _0x4a20c3;};}function handleError(_0x5c5285,_0x115f75){_0x115f75=_0x115f75||0x1f4;return function(_0xe6f936){logger[_0xefa0('0x25')](_0xe6f936[_0xefa0('0x26')]);if(_0xe6f936[_0xefa0('0x27')]){delete _0xe6f936['name'];}_0x5c5285['status'](_0x115f75)[_0xefa0('0x28')](_0xe6f936);};}exports['index']=function(_0x70f03e,_0x158315){var _0x1f49cb={},_0x338ad2={},_0x3871a3={'count':0x0,'rows':[]};var _0x7a497b=_[_0xefa0('0x29')](db[_0xefa0('0x2a')][_0xefa0('0x2b')],function(_0x4b6109){return{'name':_0x4b6109[_0xefa0('0x2c')],'type':_0x4b6109['type'][_0xefa0('0x2d')]};});_0x338ad2[_0xefa0('0x2e')]=_['map'](_0x7a497b,_0xefa0('0x27'));_0x338ad2[_0xefa0('0x2f')]=_[_0xefa0('0x30')](_0x70f03e[_0xefa0('0x2f')]);_0x338ad2['filters']=_[_0xefa0('0x31')](_0x338ad2[_0xefa0('0x2e')],_0x338ad2[_0xefa0('0x2f')]);_0x1f49cb['attributes']=_[_0xefa0('0x31')](_0x338ad2[_0xefa0('0x2e')],qs[_0xefa0('0x32')](_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x32')]));_0x1f49cb[_0xefa0('0x33')]=_0x1f49cb[_0xefa0('0x33')]['length']?_0x1f49cb['attributes']:_0x338ad2[_0xefa0('0x2e')];if(!_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x34')](_0xefa0('0x35'))){_0x1f49cb[_0xefa0('0x1c')]=qs[_0xefa0('0x1c')](_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x1c')]);_0x1f49cb[_0xefa0('0x1b')]=qs[_0xefa0('0x1b')](_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x1b')]);}_0x1f49cb[_0xefa0('0x36')]=qs[_0xefa0('0x37')](_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x37')]);_0x1f49cb[_0xefa0('0x38')]=qs[_0xefa0('0x39')](_[_0xefa0('0x3a')](_0x70f03e[_0xefa0('0x2f')],_0x338ad2['filters']),_0x7a497b);if(_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x3b')]){_0x1f49cb[_0xefa0('0x38')]=_['merge'](_0x1f49cb[_0xefa0('0x38')],{'$or':_[_0xefa0('0x29')](_0x7a497b,function(_0x747327){if(_0x747327[_0xefa0('0x3c')]!==_0xefa0('0x3d')){var _0x4ee6b3={};_0x4ee6b3[_0x747327['name']]={'$like':'%'+_0x70f03e[_0xefa0('0x2f')][_0xefa0('0x3b')]+'%'};return _0x4ee6b3;}})});}_0x1f49cb=_[_0xefa0('0x3e')]({},_0x1f49cb,_0x70f03e[_0xefa0('0x3f')]);var _0x344909={'where':_0x1f49cb[_0xefa0('0x38')]};return db[_0xefa0('0x2a')]['count'](_0x344909)[_0xefa0('0x23')](function(_0x286993){_0x3871a3['count']=_0x286993;if(_0x70f03e['query'][_0xefa0('0x40')]){_0x1f49cb[_0xefa0('0x41')]=[{'all':!![]}];}return db[_0xefa0('0x2a')][_0xefa0('0x42')](_0x1f49cb);})[_0xefa0('0x23')](function(_0x170792){_0x3871a3[_0xefa0('0x43')]=_0x170792;return _0x3871a3;})[_0xefa0('0x23')](respondWithFilteredResult(_0x158315,_0x1f49cb))[_0xefa0('0x44')](handleError(_0x158315,null));};exports['show']=function(_0x220f0c,_0x10cf19){var _0x499fa3={'raw':![],'where':{'id':_0x220f0c[_0xefa0('0x45')]['id']}},_0x45a82f={};_0x45a82f[_0xefa0('0x2e')]=_[_0xefa0('0x30')](db[_0xefa0('0x2a')][_0xefa0('0x2b')]);_0x45a82f[_0xefa0('0x2f')]=_['keys'](_0x220f0c[_0xefa0('0x2f')]);_0x45a82f[_0xefa0('0x39')]=_[_0xefa0('0x31')](_0x45a82f['model'],_0x45a82f['query']);_0x499fa3[_0xefa0('0x33')]=_[_0xefa0('0x31')](_0x45a82f[_0xefa0('0x2e')],qs['fields'](_0x220f0c[_0xefa0('0x2f')]['fields']));_0x499fa3['attributes']=_0x499fa3[_0xefa0('0x33')][_0xefa0('0x46')]?_0x499fa3[_0xefa0('0x33')]:_0x45a82f['model'];if(_0x220f0c[_0xefa0('0x2f')][_0xefa0('0x40')]){_0x499fa3['include']=[{'all':!![]}];}_0x499fa3=_[_0xefa0('0x3e')]({},_0x499fa3,_0x220f0c[_0xefa0('0x3f')]);return db['Automation']['find'](_0x499fa3)[_0xefa0('0x23')](handleEntityNotFound(_0x10cf19,null))['then'](respondWithResult(_0x10cf19,null))[_0xefa0('0x44')](handleError(_0x10cf19,null));};exports['create']=function(_0x3af5a9,_0x323a1b){return db[_0xefa0('0x2a')][_0xefa0('0x47')](_0x3af5a9['body'],{})[_0xefa0('0x23')](respondWithResult(_0x323a1b,0xc9))['catch'](handleError(_0x323a1b,null));};exports[_0xefa0('0x48')]=function(_0x235d7b,_0x598055){if(_0x235d7b[_0xefa0('0x49')]['id']){delete _0x235d7b[_0xefa0('0x49')]['id'];}return db[_0xefa0('0x2a')]['find']({'where':{'id':_0x235d7b[_0xefa0('0x45')]['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0x598055,null))[_0xefa0('0x23')](saveUpdates(_0x235d7b['body'],null))[_0xefa0('0x23')](respondWithResult(_0x598055,null))[_0xefa0('0x44')](handleError(_0x598055,null));};exports[_0xefa0('0x24')]=function(_0x201ede,_0xb0d74a){return db[_0xefa0('0x2a')]['find']({'where':{'id':_0x201ede[_0xefa0('0x45')]['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0xb0d74a,null))[_0xefa0('0x23')](removeEntity(_0xb0d74a,null))[_0xefa0('0x44')](handleError(_0xb0d74a,null));};exports[_0xefa0('0x4a')]=function(_0x3a2ad5,_0x693133,_0x3f1924){return db[_0xefa0('0x4b')][_0xefa0('0x4c')]({'where':{'id':_0x3a2ad5['params']['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0x693133,null))[_0xefa0('0x23')](function(_0x734f60){if(_0x734f60){return _0x734f60['addConditions'](_0x3a2ad5[_0xefa0('0x49')][_0xefa0('0x4d')],_[_0xefa0('0x4e')](_0x3a2ad5[_0xefa0('0x49')],[_0xefa0('0x4d'),'id'])||{});}})[_0xefa0('0x23')](respondWithResult(_0x693133,null))[_0xefa0('0x44')](handleError(_0x693133,null));};exports['getConditions']=function(_0x9867e1,_0x43626e,_0x2ced4c){var _0x13634b={};var _0x161962={};var _0x189037;var _0x49be75;return db[_0xefa0('0x2a')][_0xefa0('0x4f')]({'where':{'id':_0x9867e1[_0xefa0('0x45')]['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0x43626e,null))['then'](function(_0x8725fa){if(_0x8725fa){_0x189037=_0x8725fa;_0x161962[_0xefa0('0x2e')]=_[_0xefa0('0x30')](db[_0xefa0('0x4b')][_0xefa0('0x2b')]);_0x161962[_0xefa0('0x2f')]=_[_0xefa0('0x30')](_0x9867e1['query']);_0x161962[_0xefa0('0x39')]=_[_0xefa0('0x31')](_0x161962[_0xefa0('0x2e')],_0x161962[_0xefa0('0x2f')]);_0x13634b[_0xefa0('0x33')]=_['intersection'](_0x161962[_0xefa0('0x2e')],qs[_0xefa0('0x32')](_0x9867e1['query'][_0xefa0('0x32')]));_0x13634b[_0xefa0('0x33')]=_0x13634b[_0xefa0('0x33')][_0xefa0('0x46')]?_0x13634b[_0xefa0('0x33')]:_0x161962[_0xefa0('0x2e')];_0x13634b[_0xefa0('0x36')]=qs[_0xefa0('0x37')](_0x9867e1[_0xefa0('0x2f')][_0xefa0('0x37')]);_0x13634b[_0xefa0('0x38')]=qs[_0xefa0('0x39')](_[_0xefa0('0x3a')](_0x9867e1[_0xefa0('0x2f')],_0x161962[_0xefa0('0x39')]));if(_0x9867e1[_0xefa0('0x2f')][_0xefa0('0x3b')]){_0x13634b[_0xefa0('0x38')]=_['merge'](_0x13634b[_0xefa0('0x38')],{'$or':_[_0xefa0('0x29')](_0x13634b[_0xefa0('0x33')],function(_0xf5c78d){var _0x3abf2c={};_0x3abf2c[_0xf5c78d]={'$like':'%'+_0x9867e1[_0xefa0('0x2f')][_0xefa0('0x3b')]+'%'};return _0x3abf2c;})});}_0x13634b=_[_0xefa0('0x3e')]({},_0x13634b,_0x9867e1[_0xefa0('0x3f')]);return _0x189037[_0xefa0('0x50')](_0x13634b);}})[_0xefa0('0x23')](function(_0x443d75){if(_0x443d75){_0x49be75=_0x443d75[_0xefa0('0x46')];if(!_0x9867e1['query'][_0xefa0('0x34')](_0xefa0('0x35'))){_0x13634b[_0xefa0('0x1c')]=qs[_0xefa0('0x1c')](_0x9867e1[_0xefa0('0x2f')][_0xefa0('0x1c')]);_0x13634b[_0xefa0('0x1b')]=qs[_0xefa0('0x1b')](_0x9867e1[_0xefa0('0x2f')]['offset']);}return _0x189037[_0xefa0('0x50')](_0x13634b);}})['then'](function(_0x2604ee){if(_0x2604ee){return _0x2604ee?{'count':_0x49be75,'rows':_0x2604ee}:null;}})['then'](respondWithResult(_0x43626e,null))['catch'](handleError(_0x43626e,null));};exports[_0xefa0('0x51')]=function(_0x30d3d5,_0x483879,_0x424b6e){return db['Action'][_0xefa0('0x4c')]({'where':{'id':_0x30d3d5[_0xefa0('0x45')]['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0x483879,null))[_0xefa0('0x23')](function(_0x458355){if(_0x458355){return _0x458355[_0xefa0('0x51')](_0x30d3d5['body'][_0xefa0('0x4d')],_['omit'](_0x30d3d5[_0xefa0('0x49')],[_0xefa0('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x483879,null))[_0xefa0('0x44')](handleError(_0x483879,null));};exports[_0xefa0('0x52')]=function(_0x1924e7,_0x4b46b2,_0x67b37a){var _0x12f40a={};var _0x546dbe={};var _0x5110dc;var _0x1c4bfe;return db[_0xefa0('0x2a')][_0xefa0('0x4f')]({'where':{'id':_0x1924e7['params']['id']}})[_0xefa0('0x23')](handleEntityNotFound(_0x4b46b2,null))[_0xefa0('0x23')](function(_0x4b0d51){if(_0x4b0d51){_0x5110dc=_0x4b0d51;_0x546dbe[_0xefa0('0x2e')]=_[_0xefa0('0x30')](db['Action'][_0xefa0('0x2b')]);_0x546dbe['query']=_[_0xefa0('0x30')](_0x1924e7['query']);_0x546dbe[_0xefa0('0x39')]=_[_0xefa0('0x31')](_0x546dbe[_0xefa0('0x2e')],_0x546dbe[_0xefa0('0x2f')]);_0x12f40a[_0xefa0('0x33')]=_[_0xefa0('0x31')](_0x546dbe[_0xefa0('0x2e')],qs[_0xefa0('0x32')](_0x1924e7['query'][_0xefa0('0x32')]));_0x12f40a['attributes']=_0x12f40a[_0xefa0('0x33')][_0xefa0('0x46')]?_0x12f40a[_0xefa0('0x33')]:_0x546dbe['model'];_0x12f40a[_0xefa0('0x36')]=qs[_0xefa0('0x37')](_0x1924e7[_0xefa0('0x2f')][_0xefa0('0x37')]);_0x12f40a['where']=qs[_0xefa0('0x39')](_[_0xefa0('0x3a')](_0x1924e7[_0xefa0('0x2f')],_0x546dbe[_0xefa0('0x39')]));if(_0x1924e7[_0xefa0('0x2f')]['filter']){_0x12f40a['where']=_[_0xefa0('0x3e')](_0x12f40a[_0xefa0('0x38')],{'$or':_['map'](_0x12f40a[_0xefa0('0x33')],function(_0x48f045){var _0x1af48f={};_0x1af48f[_0x48f045]={'$like':'%'+_0x1924e7[_0xefa0('0x2f')][_0xefa0('0x3b')]+'%'};return _0x1af48f;})});}_0x12f40a=_['merge']({},_0x12f40a,_0x1924e7['options']);return _0x5110dc[_0xefa0('0x52')](_0x12f40a);}})['then'](function(_0x3f17a2){if(_0x3f17a2){_0x1c4bfe=_0x3f17a2[_0xefa0('0x46')];if(!_0x1924e7[_0xefa0('0x2f')]['hasOwnProperty'](_0xefa0('0x35'))){_0x12f40a['limit']=qs[_0xefa0('0x1c')](_0x1924e7['query'][_0xefa0('0x1c')]);_0x12f40a['offset']=qs[_0xefa0('0x1b')](_0x1924e7['query'][_0xefa0('0x1b')]);}return _0x5110dc[_0xefa0('0x52')](_0x12f40a);}})[_0xefa0('0x23')](function(_0xe367bf){if(_0xe367bf){return _0xe367bf?{'count':_0x1c4bfe,'rows':_0xe367bf}:null;}})['then'](respondWithResult(_0x4b46b2,null))[_0xefa0('0x44')](handleError(_0x4b46b2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ae0a829..e535243 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 _0xa6f8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Automation','lodash','util'];(function(_0xf6f081,_0x415cee){var _0x5a06ee=function(_0x1f7302){while(--_0x1f7302){_0xf6f081['push'](_0xf6f081['shift']());}};_0x5a06ee(++_0x415cee);}(_0xa6f8,0x1c1));var _0x8a6f=function(_0x3655e5,_0x469eae){_0x3655e5=_0x3655e5-0x0;var _0x37dfac=_0xa6f8[_0x3655e5];return _0x37dfac;};'use strict';var _=require(_0x8a6f('0x0'));var util=require(_0x8a6f('0x1'));var logger=require(_0x8a6f('0x2'))(_0x8a6f('0x3'));var moment=require('moment');var BPromise=require(_0x8a6f('0x4'));var rp=require(_0x8a6f('0x5'));var fs=require('fs');var path=require(_0x8a6f('0x6'));var rimraf=require(_0x8a6f('0x7'));var config=require(_0x8a6f('0x8'));var attributes=require('./automation.attributes');module[_0x8a6f('0x9')]=function(_0x3c72f8,_0x1fdde5){return _0x3c72f8['define'](_0x8a6f('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25a0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','lodash','../../config/logger'];(function(_0x39cb92,_0x226cde){var _0x1c392b=function(_0xea860b){while(--_0xea860b){_0x39cb92['push'](_0x39cb92['shift']());}};_0x1c392b(++_0x226cde);}(_0x25a0,0x106));var _0x025a=function(_0x523b92,_0x25d6b8){_0x523b92=_0x523b92-0x0;var _0x1a5e3b=_0x25a0[_0x523b92];return _0x1a5e3b;};'use strict';var _=require(_0x025a('0x0'));var util=require('util');var logger=require(_0x025a('0x1'))(_0x025a('0x2'));var moment=require(_0x025a('0x3'));var BPromise=require(_0x025a('0x4'));var rp=require(_0x025a('0x5'));var fs=require('fs');var path=require(_0x025a('0x6'));var rimraf=require(_0x025a('0x7'));var config=require(_0x025a('0x8'));var attributes=require('./automation.attributes');module[_0x025a('0x9')]=function(_0x5f1186,_0x18bd1b){return _0x5f1186[_0x025a('0xa')](_0x025a('0xb'),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 4b085e0..4b150bd 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 _0xde46=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3b67,_0x13118f){var _0x2da9b7=function(_0x46a200){while(--_0x46a200){_0x1c3b67['push'](_0x1c3b67['shift']());}};_0x2da9b7(++_0x13118f);}(_0xde46,0x14e));var _0x6de4=function(_0x3213aa,_0x4e6680){_0x3213aa=_0x3213aa-0x0;var _0x5cf46b=_0xde46[_0x3213aa];return _0x5cf46b;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de4('0x5'))(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var jayson=require(_0x6de4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17f7ae,_0x507ca0,_0xb20ddf){return new BPromise(function(_0x12d3bb,_0x503d50){return client[_0x6de4('0x9')](_0x17f7ae,_0xb20ddf)[_0x6de4('0xa')](function(_0xe81ab9){logger[_0x6de4('0xb')](_0x6de4('0xc'),_0x507ca0,_0x6de4('0xd'));logger[_0x6de4('0xe')](_0x6de4('0xf'),_0x507ca0,_0x6de4('0xd'),JSON[_0x6de4('0x10')](_0xe81ab9));if(_0xe81ab9[_0x6de4('0x11')]){if(_0xe81ab9['error'][_0x6de4('0x12')]===0x1f4){logger[_0x6de4('0x11')](_0x6de4('0xc'),_0x507ca0,_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);return _0x503d50(_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);}logger[_0x6de4('0x11')]('Automation,\x20%s,\x20%s',_0x507ca0,_0xe81ab9[_0x6de4('0x11')]['message']);return _0x12d3bb(_0xe81ab9[_0x6de4('0x11')][_0x6de4('0x13')]);}else{logger[_0x6de4('0xb')]('Automation,\x20%s,\x20%s',_0x507ca0,_0x6de4('0xd'));_0x12d3bb(_0xe81ab9[_0x6de4('0x14')][_0x6de4('0x13')]);}})[_0x6de4('0x15')](function(_0x4b1584){logger[_0x6de4('0x11')]('Automation,\x20%s,\x20%s',_0x507ca0,_0x4b1584);_0x503d50(_0x4b1584);});});} \ No newline at end of file +var _0xbdfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xbdfb[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('Automation,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4336548..7ae1ca6 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 _0x149c=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','destroy'];(function(_0x488890,_0xf5f0dc){var _0x350300=function(_0x5b884f){while(--_0x5b884f){_0x488890['push'](_0x488890['shift']());}};_0x350300(++_0xf5f0dc);}(_0x149c,0x143));var _0xc149=function(_0x221378,_0x2b4b3b){_0x221378=_0x221378-0x0;var _0x382860=_0x149c[_0x221378];return _0x382860;};'use strict';var multer=require(_0xc149('0x0'));var util=require('util');var path=require(_0xc149('0x1'));var timeout=require(_0xc149('0x2'));var express=require(_0xc149('0x3'));var router=express['Router']();var fs_extra=require(_0xc149('0x4'));var auth=require(_0xc149('0x5'));var interaction=require(_0xc149('0x6'));var config=require(_0xc149('0x7'));var controller=require(_0xc149('0x8'));router[_0xc149('0x9')]('/',auth[_0xc149('0xa')](),controller['index']);router['get'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0xc')]);router[_0xc149('0x9')](_0xc149('0xd'),auth[_0xc149('0xa')](),controller[_0xc149('0xe')]);router[_0xc149('0x9')](_0xc149('0xf'),auth[_0xc149('0xa')](),controller[_0xc149('0x10')]);router[_0xc149('0x11')]('/',auth[_0xc149('0xa')](),controller[_0xc149('0x12')]);router[_0xc149('0x11')](_0xc149('0xd'),auth[_0xc149('0xa')](),controller[_0xc149('0x13')]);router['post'](_0xc149('0xf'),auth['isAuthenticated'](),controller[_0xc149('0x14')]);router['put'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller['update']);router['delete'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0x15')]);module[_0xc149('0x16')]=router; \ No newline at end of file +var _0xac55=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','/:id/actions','post','addConditions','addActions','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xac55,0x1c8));var _0x5ac5=function(_0x5115ee,_0x4c94bc){_0x5115ee=_0x5115ee-0x0;var _0x3d953c=_0xac55[_0x5115ee];return _0x3d953c;};'use strict';var multer=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var timeout=require(_0x5ac5('0x3'));var express=require('express');var router=express[_0x5ac5('0x4')]();var fs_extra=require(_0x5ac5('0x5'));var auth=require(_0x5ac5('0x6'));var interaction=require(_0x5ac5('0x7'));var config=require(_0x5ac5('0x8'));var controller=require(_0x5ac5('0x9'));router[_0x5ac5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ac5('0xa')](_0x5ac5('0xb'),auth[_0x5ac5('0xc')](),controller[_0x5ac5('0xd')]);router[_0x5ac5('0xa')](_0x5ac5('0xe'),auth[_0x5ac5('0xc')](),controller['getConditions']);router['get'](_0x5ac5('0xf'),auth[_0x5ac5('0xc')](),controller['getActions']);router[_0x5ac5('0x10')]('/',auth[_0x5ac5('0xc')](),controller['create']);router[_0x5ac5('0x10')](_0x5ac5('0xe'),auth['isAuthenticated'](),controller[_0x5ac5('0x11')]);router[_0x5ac5('0x10')](_0x5ac5('0xf'),auth[_0x5ac5('0xc')](),controller[_0x5ac5('0x12')]);router['put'](_0x5ac5('0xb'),auth['isAuthenticated'](),controller[_0x5ac5('0x13')]);router[_0x5ac5('0x14')]('/:id',auth[_0x5ac5('0xc')](),controller['destroy']);module[_0x5ac5('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 f84e60e..9938723 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 _0xa16d=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x2d6e0e,_0xf37e2d){var _0x4977c6=function(_0x35994e){while(--_0x35994e){_0x2d6e0e['push'](_0x2d6e0e['shift']());}};_0x4977c6(++_0xf37e2d);}(_0xa16d,0xaa));var _0xda16=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0xa16d[_0x4e4061];return _0x371dbd;};'use strict';var Sequelize=require(_0xda16('0x0'));module[_0xda16('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xda16('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xda16('0x3')](_0xda16('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xda16('0x5')]},'active':{'type':Sequelize[_0xda16('0x6')],'defaultValue':0x0,'comment':_0xda16('0x7')},'limitCalls':{'type':Sequelize[_0xda16('0x8')](0x4)[_0xda16('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xda16('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xda16('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xda16('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xda16('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda16('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x3,'comment':_0xda16('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xda16('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xda16('0xe'),_0xda16('0xf'),_0xda16('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xda16('0x6')],'defaultValue':0x0,'comment':_0xda16('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xda16('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xda16('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xda16('0x8')](0x9)[_0xda16('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xda16('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xda16('0x8')](0x9)[_0xda16('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xda16('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xda16('0x8')](0x9)[_0xda16('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xda16('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xda16('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xda16('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xda16('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xda16('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xda16('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xda16('0x8')](0x9)[_0xda16('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xda16('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xda16('0x19'),_0xda16('0x1a')),'defaultValue':_0xda16('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda16('0x1b')},'dialCutDigit':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda16('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda16('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xda16('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda16('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xda16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xda16('0x8')](0x5)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda16('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)[_0xda16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda16('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xda16('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda16('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda16('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x10c0=['BOOLEAN','Active/Disactive\x20Campaign','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x57e1ce,_0x5a2f82){var _0x2f1072=function(_0x5ca306){while(--_0x5ca306){_0x57e1ce['push'](_0x57e1ce['shift']());}};_0x2f1072(++_0x5a2f82);}(_0x10c0,0x19c));var _0x010c=function(_0x595a21,_0x24790f){_0x595a21=_0x595a21-0x0;var _0x50df84=_0x10c0[_0x595a21];return _0x50df84;};'use strict';var Sequelize=require(_0x010c('0x0'));module[_0x010c('0x1')]={'name':{'type':Sequelize[_0x010c('0x2')],'unique':_0x010c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x010c('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x010c('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x010c('0x6')],'defaultValue':0x0,'comment':_0x010c('0x7')},'limitCalls':{'type':Sequelize[_0x010c('0x8')](0x4)[_0x010c('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x010c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x010c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)[_0x010c('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)[_0x010c('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'comment':_0x010c('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)[_0x010c('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x010c('0x2')],'defaultValue':_0x010c('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x010c('0x12'),_0x010c('0x13'),_0x010c('0x14')),'defaultValue':_0x010c('0x12')},'dialAMDActive':{'type':Sequelize[_0x010c('0x6')],'defaultValue':0x0,'comment':_0x010c('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x010c('0x8')](0x9)[_0x010c('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x010c('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x010c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x010c('0x8')](0x9)[_0x010c('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x010c('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x010c('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x010c('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x010c('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x010c('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x010c('0x8')](0x9)[_0x010c('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x010c('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x010c('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x010c('0x8')](0x5)[_0x010c('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x010c('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x010c('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x010c('0x4')](_0x010c('0x1c'),'ASC'),'defaultValue':_0x010c('0x1c')},'dialPrefix':{'type':Sequelize[_0x010c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x010c('0x1d')},'dialCutDigit':{'type':Sequelize[_0x010c('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)[_0x010c('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x010c('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x010c('0x8')](0x3)[_0x010c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x010c('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x010c('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x010c('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3f8a3a5..bd4db78 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 _0xefe2=['show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','CampaignId','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','ci.item','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xefe2,0xd9));var _0x2efe=function(_0x27503f,_0xd9e4a9){_0x27503f=_0x27503f-0x0;var _0x22a062=_0xefe2[_0x27503f];return _0x22a062;};'use strict';var emlformat=require(_0x2efe('0x0'));var rimraf=require(_0x2efe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2efe('0x2'));var rp=require(_0x2efe('0x3'));var moment=require('moment');var BPromise=require(_0x2efe('0x4'));var Mustache=require('mustache');var util=require(_0x2efe('0x5'));var path=require(_0x2efe('0x6'));var sox=require(_0x2efe('0x7'));var csv=require(_0x2efe('0x8'));var ejs=require(_0x2efe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2efe('0xa'));var squel=require(_0x2efe('0xb'));var crypto=require(_0x2efe('0xc'));var jsforce=require(_0x2efe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2efe('0x8'));var querystring=require(_0x2efe('0xe'));var Papa=require(_0x2efe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2efe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2efe('0x11'))(_0x2efe('0x12'));var utils=require(_0x2efe('0x13'));var config=require(_0x2efe('0x14'));var licenseUtil=require(_0x2efe('0x15'));var db=require(_0x2efe('0x16'))['db'];function respondWithStatusCode(_0x39a93b,_0x250023){_0x250023=_0x250023||0xcc;return function(_0x41039a){if(_0x41039a){return _0x39a93b[_0x2efe('0x17')](_0x250023);}return _0x39a93b['status'](_0x250023)['end']();};}function respondWithResult(_0x28681f,_0x1d9e5c){_0x1d9e5c=_0x1d9e5c||0xc8;return function(_0x562753){if(_0x562753){return _0x28681f['status'](_0x1d9e5c)[_0x2efe('0x18')](_0x562753);}};}function respondWithFilteredResult(_0x5195c8,_0x235af3){return function(_0x3b8b31){if(_0x3b8b31){var _0x51cbf3=typeof _0x235af3[_0x2efe('0x19')]===_0x2efe('0x1a')&&typeof _0x235af3['limit']===_0x2efe('0x1a');var _0x499c70=_0x3b8b31['count'];var _0xefd47=_0x51cbf3?0x0:_0x235af3[_0x2efe('0x19')];var _0x16acde=_0x51cbf3?_0x3b8b31[_0x2efe('0x1b')]:_0x235af3[_0x2efe('0x19')]+_0x235af3[_0x2efe('0x1c')];var _0x3017a7;if(_0x16acde>=_0x499c70){_0x16acde=_0x499c70;_0x3017a7=0xc8;}else{_0x3017a7=0xce;}_0x5195c8[_0x2efe('0x1d')](_0x3017a7);return _0x5195c8[_0x2efe('0x1e')](_0x2efe('0x1f'),_0xefd47+'-'+_0x16acde+'/'+_0x499c70)[_0x2efe('0x18')](_0x3b8b31);}return null;};}function patchUpdates(_0x6962df){return function(_0x491958){try{jsonpatch[_0x2efe('0x20')](_0x491958,_0x6962df,!![]);}catch(_0x538f39){return BPromise[_0x2efe('0x21')](_0x538f39);}return _0x491958[_0x2efe('0x22')]();};}function saveUpdates(_0x30ed16,_0x4ebeb6){return function(_0x131169){if(_0x131169){return _0x131169[_0x2efe('0x23')](_0x30ed16)['then'](function(_0x1c4a8d){return _0x1c4a8d;});}return null;};}function removeEntity(_0x368d08,_0xc24859){return function(_0x319b7f){if(_0x319b7f){return _0x319b7f[_0x2efe('0x24')]()[_0x2efe('0x25')](function(){var _0x2a9b20=_0x319b7f[_0x2efe('0x26')]({'plain':!![]});var _0x3d4449=_0x2efe('0x27');return db[_0x2efe('0x28')][_0x2efe('0x24')]({'where':{'type':_0x3d4449,'resourceId':_0x2a9b20['id']}})[_0x2efe('0x25')](function(){return _0x319b7f;});})[_0x2efe('0x25')](function(){_0x368d08['status'](0xcc)[_0x2efe('0x29')]();});}};}function handleEntityNotFound(_0x5e18d3,_0x3283c2){return function(_0x1c6c74){if(!_0x1c6c74){_0x5e18d3[_0x2efe('0x17')](0x194);}return _0x1c6c74;};}function handleError(_0x431394,_0x3b61d1){_0x3b61d1=_0x3b61d1||0x1f4;return function(_0xa11a23){logger[_0x2efe('0x2a')](_0xa11a23[_0x2efe('0x2b')]);if(_0xa11a23['name']){delete _0xa11a23[_0x2efe('0x2c')];}_0x431394[_0x2efe('0x1d')](_0x3b61d1)[_0x2efe('0x2d')](_0xa11a23);};}exports[_0x2efe('0x2e')]=function(_0x1bed7f,_0x49ef94){var _0x122d35={},_0x1ce936={},_0x1108eb={'count':0x0,'rows':[]};var _0x54e707=_[_0x2efe('0x2f')](db[_0x2efe('0x30')][_0x2efe('0x31')],function(_0x232c72){return{'name':_0x232c72[_0x2efe('0x32')],'type':_0x232c72[_0x2efe('0x33')]['key']};});_0x1ce936[_0x2efe('0x34')]=_[_0x2efe('0x2f')](_0x54e707,_0x2efe('0x2c'));_0x1ce936[_0x2efe('0x35')]=_[_0x2efe('0x36')](_0x1bed7f[_0x2efe('0x35')]);_0x1ce936[_0x2efe('0x37')]=_[_0x2efe('0x38')](_0x1ce936[_0x2efe('0x34')],_0x1ce936['query']);_0x122d35[_0x2efe('0x39')]=_[_0x2efe('0x38')](_0x1ce936['model'],qs['fields'](_0x1bed7f['query'][_0x2efe('0x3a')]));_0x122d35[_0x2efe('0x39')]=_0x122d35[_0x2efe('0x39')]['length']?_0x122d35[_0x2efe('0x39')]:_0x1ce936[_0x2efe('0x34')];if(!_0x1bed7f[_0x2efe('0x35')]['hasOwnProperty']('nolimit')){_0x122d35[_0x2efe('0x1c')]=qs['limit'](_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x1c')]);_0x122d35[_0x2efe('0x19')]=qs['offset'](_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x19')]);}_0x122d35[_0x2efe('0x3b')]=qs[_0x2efe('0x3c')](_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x3c')]);_0x122d35[_0x2efe('0x3d')]=qs['filters'](_[_0x2efe('0x3e')](_0x1bed7f['query'],_0x1ce936[_0x2efe('0x37')]),_0x54e707);if(_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x3f')]){_0x122d35[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x122d35['where'],{'$or':_[_0x2efe('0x2f')](_0x54e707,function(_0x45409f){if(_0x45409f['type']!==_0x2efe('0x41')){var _0x27a877={};_0x27a877[_0x45409f['name']]={'$like':'%'+_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x3f')]+'%'};return _0x27a877;}})});}_0x122d35=_[_0x2efe('0x40')]({},_0x122d35,_0x1bed7f[_0x2efe('0x42')]);var _0x3356ec={'where':_0x122d35[_0x2efe('0x3d')]};return db[_0x2efe('0x30')][_0x2efe('0x1b')](_0x3356ec)[_0x2efe('0x25')](function(_0xd4948f){_0x1108eb[_0x2efe('0x1b')]=_0xd4948f;if(_0x1bed7f[_0x2efe('0x35')][_0x2efe('0x43')]){_0x122d35[_0x2efe('0x44')]=[{'all':!![]}];}return db[_0x2efe('0x30')]['findAll'](_0x122d35);})[_0x2efe('0x25')](function(_0x84d98b){_0x1108eb[_0x2efe('0x45')]=_0x84d98b;return _0x1108eb;})[_0x2efe('0x25')](respondWithFilteredResult(_0x49ef94,_0x122d35))[_0x2efe('0x46')](handleError(_0x49ef94,null));};exports[_0x2efe('0x47')]=function(_0x45c1ee,_0x5a9d2d){var _0x1c99b2={'raw':![],'where':{'id':_0x45c1ee[_0x2efe('0x48')]['id']}},_0x1ddfdf={};_0x1ddfdf[_0x2efe('0x34')]=_[_0x2efe('0x36')](db['Campaign'][_0x2efe('0x31')]);_0x1ddfdf[_0x2efe('0x35')]=_[_0x2efe('0x36')](_0x45c1ee[_0x2efe('0x35')]);_0x1ddfdf[_0x2efe('0x37')]=_[_0x2efe('0x38')](_0x1ddfdf[_0x2efe('0x34')],_0x1ddfdf[_0x2efe('0x35')]);_0x1c99b2[_0x2efe('0x39')]=_['intersection'](_0x1ddfdf['model'],qs['fields'](_0x45c1ee[_0x2efe('0x35')][_0x2efe('0x3a')]));_0x1c99b2['attributes']=_0x1c99b2[_0x2efe('0x39')]['length']?_0x1c99b2['attributes']:_0x1ddfdf[_0x2efe('0x34')];if(_0x45c1ee['query'][_0x2efe('0x43')]){_0x1c99b2[_0x2efe('0x44')]=[{'all':!![]}];}_0x1c99b2=_[_0x2efe('0x40')]({},_0x1c99b2,_0x45c1ee['options']);return db[_0x2efe('0x30')][_0x2efe('0x49')](_0x1c99b2)[_0x2efe('0x25')](handleEntityNotFound(_0x5a9d2d,null))[_0x2efe('0x25')](respondWithResult(_0x5a9d2d,null))['catch'](handleError(_0x5a9d2d,null));};exports[_0x2efe('0x4a')]=function(_0x9a5118,_0x5abdaf){return db[_0x2efe('0x30')][_0x2efe('0x4a')](_0x9a5118[_0x2efe('0x4b')],{})[_0x2efe('0x25')](function(_0x1cda82){var _0x5725e4=_0x9a5118[_0x2efe('0x4c')][_0x2efe('0x26')]({'plain':!![]});if(!_0x5725e4)throw new Error(_0x2efe('0x4d'));if(_0x5725e4['role']===_0x2efe('0x4c')){var _0x3fe2c0=_0x1cda82[_0x2efe('0x26')]({'plain':!![]});var _0x3abb50='IvrCampaigns';return db[_0x2efe('0x4e')]['find']({'where':{'name':_0x3abb50,'userProfileId':_0x5725e4[_0x2efe('0x4f')]},'raw':!![]})[_0x2efe('0x25')](function(_0x33eb03){if(_0x33eb03&&_0x33eb03['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3fe2c0[_0x2efe('0x2c')],'resourceId':_0x3fe2c0['id'],'type':_0x33eb03['name'],'sectionId':_0x33eb03['id']},{})[_0x2efe('0x25')](function(){return _0x1cda82;});}else{return _0x1cda82;}})['catch'](function(_0x327a10){logger[_0x2efe('0x2a')](_0x2efe('0x50'),_0x327a10);throw _0x327a10;});}return _0x1cda82;})[_0x2efe('0x25')](respondWithResult(_0x5abdaf,0xc9))[_0x2efe('0x46')](handleError(_0x5abdaf,null));};exports[_0x2efe('0x51')]=function(_0x2fa3b0,_0x53c173){var _0x3bc319={'where':{'id':_0x2fa3b0[_0x2efe('0x48')]['id']}},_0x3b1da4={};_0x3b1da4[_0x2efe('0x34')]=_[_0x2efe('0x36')](db[_0x2efe('0x30')]['rawAttributes']);_0x3bc319[_0x2efe('0x39')]=_[_0x2efe('0x38')](_0x3b1da4[_0x2efe('0x34')],qs[_0x2efe('0x3a')](_0x2fa3b0[_0x2efe('0x35')]['fields']));_0x3bc319[_0x2efe('0x39')]=_0x3bc319[_0x2efe('0x39')][_0x2efe('0x52')]?_0x3bc319[_0x2efe('0x39')]:_0x3b1da4['model'];if(_0x2fa3b0[_0x2efe('0x35')][_0x2efe('0x43')]){_0x3bc319[_0x2efe('0x44')]=[{'all':!![]}];}_0x3bc319=_['merge']({},_0x3bc319,_0x2fa3b0[_0x2efe('0x42')]);return db['Campaign'][_0x2efe('0x49')](_0x3bc319)[_0x2efe('0x25')](handleEntityNotFound(_0x53c173,null))[_0x2efe('0x25')](function(_0x245693){if(_0x245693){var _0x4a2754=_0x245693[_0x2efe('0x26')]({'plain':!![]});_0x4a2754=qs[_0x2efe('0x53')](_0x4a2754,['id',_0x2efe('0x54'),_0x2efe('0x55')]);_0x2fa3b0['body']=_[_0x2efe('0x53')](_0x2fa3b0[_0x2efe('0x4b')],['id',_0x2efe('0x54'),_0x2efe('0x55')]);return db[_0x2efe('0x30')][_0x2efe('0x4a')](_[_0x2efe('0x40')](_0x4a2754,_0x2fa3b0['body']),{'include':_0x2fa3b0[_0x2efe('0x35')][_0x2efe('0x43')]?[{'all':!![]}]:undefined})[_0x2efe('0x25')](function(_0x2dfa90){var _0x4545c4=_0x2fa3b0[_0x2efe('0x4c')][_0x2efe('0x26')]({'plain':!![]});if(!_0x4545c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4545c4['role']===_0x2efe('0x4c')){var _0x4d2a94=_0x2dfa90[_0x2efe('0x26')]({'plain':!![]});var _0x1168dc=_0x2efe('0x27');return db[_0x2efe('0x4e')][_0x2efe('0x49')]({'where':{'name':_0x1168dc,'userProfileId':_0x4545c4['userProfileId']},'raw':!![]})[_0x2efe('0x25')](function(_0x110379){if(_0x110379&&_0x110379[_0x2efe('0x56')]===0x0){return db['UserProfileResource'][_0x2efe('0x4a')]({'name':_0x4d2a94[_0x2efe('0x2c')],'resourceId':_0x4d2a94['id'],'type':_0x110379[_0x2efe('0x2c')],'sectionId':_0x110379['id']},{})[_0x2efe('0x25')](function(){return _0x2dfa90;});}else{return _0x2dfa90;}})[_0x2efe('0x46')](function(_0x22caae){logger[_0x2efe('0x2a')](_0x2efe('0x50'),_0x22caae);throw _0x22caae;});}return _0x2dfa90;});}})[_0x2efe('0x25')](respondWithResult(_0x53c173,0xc9))['catch'](handleError(_0x53c173,null));};exports['update']=function(_0x44af9b,_0x303bc0){if(_0x44af9b[_0x2efe('0x4b')]['id']){delete _0x44af9b[_0x2efe('0x4b')]['id'];}return db[_0x2efe('0x30')][_0x2efe('0x49')]({'where':{'id':_0x44af9b[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x303bc0,null))['then'](saveUpdates(_0x44af9b[_0x2efe('0x4b')],null))['then'](respondWithResult(_0x303bc0,null))[_0x2efe('0x46')](handleError(_0x303bc0,null));};exports[_0x2efe('0x24')]=function(_0x367633,_0xb2c6e2){return db[_0x2efe('0x30')][_0x2efe('0x49')]({'where':{'id':_0x367633[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0xb2c6e2,null))[_0x2efe('0x25')](removeEntity(_0xb2c6e2,null))[_0x2efe('0x46')](handleError(_0xb2c6e2,null));};exports[_0x2efe('0x57')]=function(_0x440a15,_0x442339,_0xb58004){var _0x58c149={'raw':!![],'where':{}};var _0x490d1c={};var _0x1548c2={'count':0x0,'rows':[]};return db['Campaign'][_0x2efe('0x58')]({'where':{'id':_0x440a15[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x442339,null))[_0x2efe('0x25')](function(_0x1f16d1){if(_0x1f16d1){_0x490d1c[_0x2efe('0x34')]=_[_0x2efe('0x36')](db[_0x2efe('0x59')][_0x2efe('0x31')]);_0x490d1c['query']=_[_0x2efe('0x36')](_0x440a15['query']);_0x490d1c[_0x2efe('0x37')]=_[_0x2efe('0x38')](_0x490d1c['model'],_0x490d1c[_0x2efe('0x35')]);_0x58c149[_0x2efe('0x39')]=_['intersection'](_0x490d1c[_0x2efe('0x34')],qs['fields'](_0x440a15['query'][_0x2efe('0x3a')]));_0x58c149[_0x2efe('0x39')]=_0x58c149[_0x2efe('0x39')]['length']?_0x58c149[_0x2efe('0x39')]:_0x490d1c[_0x2efe('0x34')];if(!_0x440a15[_0x2efe('0x35')][_0x2efe('0x5a')](_0x2efe('0x5b'))){_0x58c149[_0x2efe('0x1c')]=qs[_0x2efe('0x1c')](_0x440a15['query'][_0x2efe('0x1c')]);_0x58c149['offset']=qs[_0x2efe('0x19')](_0x440a15[_0x2efe('0x35')]['offset']);}_0x58c149[_0x2efe('0x3b')]=qs['sort'](_0x440a15[_0x2efe('0x35')][_0x2efe('0x3c')]);_0x58c149[_0x2efe('0x3d')]=qs[_0x2efe('0x37')](_[_0x2efe('0x3e')](_0x440a15[_0x2efe('0x35')],_0x490d1c[_0x2efe('0x37')]));_0x58c149[_0x2efe('0x3d')][_0x2efe('0x5c')]=_0x1f16d1['id'];if(_0x440a15[_0x2efe('0x35')]['filter']){_0x58c149[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x58c149[_0x2efe('0x3d')],{'$or':_[_0x2efe('0x2f')](_0x58c149['attributes'],function(_0x47dd7e){var _0x372b66={};_0x372b66[_0x47dd7e]={'$like':'%'+_0x440a15['query'][_0x2efe('0x3f')]+'%'};return _0x372b66;})});}_0x58c149=_[_0x2efe('0x40')]({},_0x58c149,_0x440a15['options']);return db[_0x2efe('0x59')][_0x2efe('0x1b')]({'where':_0x58c149[_0x2efe('0x3d')]})[_0x2efe('0x25')](function(_0xa76d4b){_0x1548c2[_0x2efe('0x1b')]=_0xa76d4b;if(_0x440a15[_0x2efe('0x35')][_0x2efe('0x43')]){_0x58c149['include']=[{'all':!![]}];}return db[_0x2efe('0x59')][_0x2efe('0x5d')](_0x58c149);})[_0x2efe('0x25')](function(_0x17911d){_0x1548c2[_0x2efe('0x45')]=_0x17911d;return _0x1548c2;});}})['then'](respondWithFilteredResult(_0x442339,_0x58c149))[_0x2efe('0x46')](handleError(_0x442339,null));};exports['getHopperHistories']=function(_0xc9bae9,_0x24c4d8,_0x25b240){var _0x58e7b1={'raw':!![],'where':{}};var _0x656caf={};var _0x5910c6={'count':0x0,'rows':[]};return db['Campaign'][_0x2efe('0x58')]({'where':{'id':_0xc9bae9[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x24c4d8,null))[_0x2efe('0x25')](function(_0x1e4c79){if(_0x1e4c79){_0x656caf['model']=_[_0x2efe('0x36')](db['CmHopperHistory'][_0x2efe('0x31')]);_0x656caf[_0x2efe('0x35')]=_[_0x2efe('0x36')](_0xc9bae9[_0x2efe('0x35')]);_0x656caf['filters']=_[_0x2efe('0x38')](_0x656caf[_0x2efe('0x34')],_0x656caf[_0x2efe('0x35')]);_0x58e7b1[_0x2efe('0x39')]=_['intersection'](_0x656caf[_0x2efe('0x34')],qs[_0x2efe('0x3a')](_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x3a')]));_0x58e7b1[_0x2efe('0x39')]=_0x58e7b1[_0x2efe('0x39')][_0x2efe('0x52')]?_0x58e7b1['attributes']:_0x656caf[_0x2efe('0x34')];if(!_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x5a')]('nolimit')){_0x58e7b1[_0x2efe('0x1c')]=qs[_0x2efe('0x1c')](_0xc9bae9[_0x2efe('0x35')]['limit']);_0x58e7b1[_0x2efe('0x19')]=qs[_0x2efe('0x19')](_0xc9bae9['query']['offset']);}_0x58e7b1[_0x2efe('0x3b')]=qs[_0x2efe('0x3c')](_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x3c')]);_0x58e7b1[_0x2efe('0x3d')]=qs[_0x2efe('0x37')](_[_0x2efe('0x3e')](_0xc9bae9['query'],_0x656caf[_0x2efe('0x37')]));_0x58e7b1[_0x2efe('0x3d')]['CampaignId']=_0x1e4c79['id'];if(_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x3f')]){_0x58e7b1[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x58e7b1['where'],{'$or':_[_0x2efe('0x2f')](_0x58e7b1['attributes'],function(_0x591eb0){var _0x3eafcf={};_0x3eafcf[_0x591eb0]={'$like':'%'+_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x3f')]+'%'};return _0x3eafcf;})});}_0x58e7b1=_[_0x2efe('0x40')]({},_0x58e7b1,_0xc9bae9['options']);return db['CmHopperHistory'][_0x2efe('0x1b')]({'where':_0x58e7b1[_0x2efe('0x3d')]})[_0x2efe('0x25')](function(_0x50eec2){_0x5910c6[_0x2efe('0x1b')]=_0x50eec2;if(_0xc9bae9[_0x2efe('0x35')][_0x2efe('0x43')]){_0x58e7b1[_0x2efe('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2efe('0x5d')](_0x58e7b1);})['then'](function(_0x102870){_0x5910c6[_0x2efe('0x45')]=_0x102870;return _0x5910c6;});}})[_0x2efe('0x25')](respondWithFilteredResult(_0x24c4d8,_0x58e7b1))[_0x2efe('0x46')](handleError(_0x24c4d8,null));};exports[_0x2efe('0x5e')]=function(_0x585607,_0x416cfc,_0x1dc255){var _0x4f745a={'raw':!![],'where':{}};var _0x3d9965={};var _0x1b1145={'count':0x0,'rows':[]};return db['Campaign'][_0x2efe('0x58')]({'where':{'id':_0x585607['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x416cfc,null))[_0x2efe('0x25')](function(_0x298a8f){if(_0x298a8f){_0x3d9965[_0x2efe('0x34')]=_[_0x2efe('0x36')](db[_0x2efe('0x5f')]['rawAttributes']);_0x3d9965[_0x2efe('0x35')]=_[_0x2efe('0x36')](_0x585607['query']);_0x3d9965[_0x2efe('0x37')]=_['intersection'](_0x3d9965[_0x2efe('0x34')],_0x3d9965[_0x2efe('0x35')]);_0x4f745a['attributes']=_[_0x2efe('0x38')](_0x3d9965[_0x2efe('0x34')],qs[_0x2efe('0x3a')](_0x585607[_0x2efe('0x35')]['fields']));_0x4f745a[_0x2efe('0x39')]=_0x4f745a[_0x2efe('0x39')][_0x2efe('0x52')]?_0x4f745a[_0x2efe('0x39')]:_0x3d9965[_0x2efe('0x34')];if(!_0x585607[_0x2efe('0x35')][_0x2efe('0x5a')](_0x2efe('0x5b'))){_0x4f745a['limit']=qs[_0x2efe('0x1c')](_0x585607[_0x2efe('0x35')][_0x2efe('0x1c')]);_0x4f745a['offset']=qs['offset'](_0x585607[_0x2efe('0x35')][_0x2efe('0x19')]);}_0x4f745a[_0x2efe('0x3b')]=qs['sort'](_0x585607['query'][_0x2efe('0x3c')]);_0x4f745a[_0x2efe('0x3d')]=qs[_0x2efe('0x37')](_[_0x2efe('0x3e')](_0x585607[_0x2efe('0x35')],_0x3d9965[_0x2efe('0x37')]));_0x4f745a['where'][_0x2efe('0x5c')]=_0x298a8f['id'];if(_0x585607[_0x2efe('0x35')]['filter']){_0x4f745a[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x4f745a[_0x2efe('0x3d')],{'$or':_['map'](_0x4f745a[_0x2efe('0x39')],function(_0x103346){var _0x4c1b8d={};_0x4c1b8d[_0x103346]={'$like':'%'+_0x585607[_0x2efe('0x35')][_0x2efe('0x3f')]+'%'};return _0x4c1b8d;})});}_0x4f745a=_[_0x2efe('0x40')]({},_0x4f745a,_0x585607['options']);return db[_0x2efe('0x5f')][_0x2efe('0x1b')]({'where':_0x4f745a[_0x2efe('0x3d')]})[_0x2efe('0x25')](function(_0x608c26){_0x1b1145[_0x2efe('0x1b')]=_0x608c26;if(_0x585607['query'][_0x2efe('0x43')]){_0x4f745a[_0x2efe('0x44')]=[{'all':!![]}];}return db[_0x2efe('0x5f')][_0x2efe('0x5d')](_0x4f745a);})[_0x2efe('0x25')](function(_0x15a4ed){_0x1b1145[_0x2efe('0x45')]=_0x15a4ed;return _0x1b1145;});}})[_0x2efe('0x25')](respondWithFilteredResult(_0x416cfc,_0x4f745a))['catch'](handleError(_0x416cfc,null));};exports['getHopperBlacks']=function(_0x28c6cb,_0xc2042b,_0x5ae62e){var _0x44c587={'raw':!![],'where':{}};var _0x17b4dc={};var _0x2a004d={'count':0x0,'rows':[]};return db[_0x2efe('0x30')]['findOne']({'where':{'id':_0x28c6cb[_0x2efe('0x48')]['id']}})['then'](handleEntityNotFound(_0xc2042b,null))[_0x2efe('0x25')](function(_0x26f4b1){if(_0x26f4b1){_0x17b4dc[_0x2efe('0x34')]=_[_0x2efe('0x36')](db[_0x2efe('0x60')]['rawAttributes']);_0x17b4dc[_0x2efe('0x35')]=_['keys'](_0x28c6cb[_0x2efe('0x35')]);_0x17b4dc[_0x2efe('0x37')]=_['intersection'](_0x17b4dc[_0x2efe('0x34')],_0x17b4dc[_0x2efe('0x35')]);_0x44c587[_0x2efe('0x39')]=_[_0x2efe('0x38')](_0x17b4dc[_0x2efe('0x34')],qs[_0x2efe('0x3a')](_0x28c6cb['query'][_0x2efe('0x3a')]));_0x44c587[_0x2efe('0x39')]=_0x44c587[_0x2efe('0x39')][_0x2efe('0x52')]?_0x44c587[_0x2efe('0x39')]:_0x17b4dc[_0x2efe('0x34')];if(!_0x28c6cb[_0x2efe('0x35')][_0x2efe('0x5a')](_0x2efe('0x5b'))){_0x44c587[_0x2efe('0x1c')]=qs[_0x2efe('0x1c')](_0x28c6cb[_0x2efe('0x35')]['limit']);_0x44c587[_0x2efe('0x19')]=qs[_0x2efe('0x19')](_0x28c6cb[_0x2efe('0x35')]['offset']);}_0x44c587[_0x2efe('0x3b')]=qs[_0x2efe('0x3c')](_0x28c6cb[_0x2efe('0x35')][_0x2efe('0x3c')]);_0x44c587[_0x2efe('0x3d')]=qs[_0x2efe('0x37')](_[_0x2efe('0x3e')](_0x28c6cb[_0x2efe('0x35')],_0x17b4dc['filters']));_0x44c587[_0x2efe('0x3d')][_0x2efe('0x5c')]=_0x26f4b1['id'];if(_0x28c6cb[_0x2efe('0x35')][_0x2efe('0x3f')]){_0x44c587['where']=_[_0x2efe('0x40')](_0x44c587[_0x2efe('0x3d')],{'$or':_[_0x2efe('0x2f')](_0x44c587[_0x2efe('0x39')],function(_0x441b12){var _0x458faa={};_0x458faa[_0x441b12]={'$like':'%'+_0x28c6cb[_0x2efe('0x35')][_0x2efe('0x3f')]+'%'};return _0x458faa;})});}_0x44c587=_[_0x2efe('0x40')]({},_0x44c587,_0x28c6cb[_0x2efe('0x42')]);return db[_0x2efe('0x60')][_0x2efe('0x1b')]({'where':_0x44c587[_0x2efe('0x3d')]})[_0x2efe('0x25')](function(_0x4980a6){_0x2a004d['count']=_0x4980a6;if(_0x28c6cb[_0x2efe('0x35')][_0x2efe('0x43')]){_0x44c587[_0x2efe('0x44')]=[{'all':!![]}];}return db[_0x2efe('0x60')][_0x2efe('0x5d')](_0x44c587);})['then'](function(_0x29c0fa){_0x2a004d[_0x2efe('0x45')]=_0x29c0fa;return _0x2a004d;});}})[_0x2efe('0x25')](respondWithFilteredResult(_0xc2042b,_0x44c587))[_0x2efe('0x46')](handleError(_0xc2042b,null));};exports['getLists']=function(_0x44ce40,_0x2ff365,_0x2f3f5f){var _0x585f59={};var _0x1e1c9d={};var _0x27f6b7;var _0x898f8b;return db[_0x2efe('0x30')][_0x2efe('0x58')]({'where':{'id':_0x44ce40[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x2ff365,null))[_0x2efe('0x25')](function(_0x34210d){if(_0x34210d){_0x27f6b7=_0x34210d;_0x1e1c9d[_0x2efe('0x34')]=_[_0x2efe('0x36')](db[_0x2efe('0x61')]['rawAttributes']);_0x1e1c9d[_0x2efe('0x35')]=_['keys'](_0x44ce40[_0x2efe('0x35')]);_0x1e1c9d['filters']=_[_0x2efe('0x38')](_0x1e1c9d[_0x2efe('0x34')],_0x1e1c9d['query']);_0x585f59[_0x2efe('0x39')]=_['intersection'](_0x1e1c9d[_0x2efe('0x34')],qs[_0x2efe('0x3a')](_0x44ce40[_0x2efe('0x35')]['fields']));_0x585f59[_0x2efe('0x39')]=_0x585f59[_0x2efe('0x39')][_0x2efe('0x52')]?_0x585f59['attributes']:_0x1e1c9d['model'];_0x585f59[_0x2efe('0x3b')]=qs[_0x2efe('0x3c')](_0x44ce40['query'][_0x2efe('0x3c')]);_0x585f59['where']=qs[_0x2efe('0x37')](_['pick'](_0x44ce40[_0x2efe('0x35')],_0x1e1c9d[_0x2efe('0x37')]));if(_0x44ce40[_0x2efe('0x35')][_0x2efe('0x3f')]){_0x585f59[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x585f59[_0x2efe('0x3d')],{'$or':_[_0x2efe('0x2f')](_0x585f59['attributes'],function(_0x5cbeb3){var _0x1bcdca={};_0x1bcdca[_0x5cbeb3]={'$like':'%'+_0x44ce40[_0x2efe('0x35')][_0x2efe('0x3f')]+'%'};return _0x1bcdca;})});}_0x585f59=_[_0x2efe('0x40')]({},_0x585f59,_0x44ce40['options']);return _0x27f6b7[_0x2efe('0x62')](_0x585f59);}})[_0x2efe('0x25')](function(_0x5bec18){if(_0x5bec18){_0x898f8b=_0x5bec18['length'];if(!_0x44ce40[_0x2efe('0x35')][_0x2efe('0x5a')](_0x2efe('0x5b'))){_0x585f59[_0x2efe('0x1c')]=qs[_0x2efe('0x1c')](_0x44ce40[_0x2efe('0x35')][_0x2efe('0x1c')]);_0x585f59[_0x2efe('0x19')]=qs[_0x2efe('0x19')](_0x44ce40['query'][_0x2efe('0x19')]);}return _0x27f6b7[_0x2efe('0x62')](_0x585f59);}})[_0x2efe('0x25')](function(_0xb69ba7){if(_0xb69ba7){return _0xb69ba7?{'count':_0x898f8b,'rows':_0xb69ba7}:null;}})[_0x2efe('0x25')](respondWithResult(_0x2ff365,null))[_0x2efe('0x46')](handleError(_0x2ff365,null));};exports[_0x2efe('0x63')]=function(_0x1cea02,_0xfca5a5,_0x890713){var _0xb25617,_0x3b1291;var _0x5a75b0=[];var _0x122975=moment()['format'](_0x2efe('0x64'));return db[_0x2efe('0x30')]['find']({'where':{'id':_0x1cea02['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0xfca5a5,null))[_0x2efe('0x25')](function(_0x394270){if(_0x394270){_0x3b1291=_0x394270;return _0x394270[_0x2efe('0x63')](_0x1cea02[_0x2efe('0x4b')][_0x2efe('0x65')],_[_0x2efe('0x53')](_0x1cea02[_0x2efe('0x4b')],[_0x2efe('0x65'),'id'])||{});}return null;})[_0x2efe('0x66')](function(_0x542184){var _0x5a5403;var _0x41398c;_0xb25617=_0x542184||[];var _0x5df9d4=[];if(_0x542184){for(var _0x545a3b=0x0;_0x545a3b<_0x542184[_0x2efe('0x52')];_0x545a3b+=0x1){var _0x298dc9=_0x542184[_0x545a3b]['get']({'plain':!![]});_0x3b1291[_0x2efe('0x67')]=_0x1cea02[_0x2efe('0x4b')][_0x2efe('0x67')]?_0x1cea02['body'][_0x2efe('0x67')]:_0x3b1291[_0x2efe('0x67')];switch(_0x3b1291[_0x2efe('0x67')]){case _0x2efe('0x68'):_0x5a5403=squel[_0x2efe('0x69')]()[_0x2efe('0x6a')](_0x2efe('0x6b'))['fromQuery']([_0x2efe('0x6c'),_0x2efe('0x6d'),_0x2efe('0x6e'),_0x2efe('0x6f'),_0x2efe('0x5c'),'createdAt','updatedAt'],squel[_0x2efe('0x70')]()['field'](_0x2efe('0x6c'),_0x2efe('0x6c'))[_0x2efe('0x71')](_0x2efe('0x72'),_0x2efe('0x6d'))['field']('id',_0x2efe('0x6e'))[_0x2efe('0x71')](_0x298dc9[_0x2efe('0x73')][_0x2efe('0x74')](),_0x2efe('0x6f'))['field'](_0x1cea02[_0x2efe('0x48')]['id'][_0x2efe('0x74')](),_0x2efe('0x5c'))[_0x2efe('0x71')]('\x27'+_0x122975+'\x27',_0x2efe('0x54'))[_0x2efe('0x71')]('\x27'+_0x122975+'\x27','updatedAt')[_0x2efe('0x75')]('cm_contacts')[_0x2efe('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x298dc9[_0x2efe('0x73')]['toString']())[_0x2efe('0x3d')](_0x2efe('0x76'))[_0x2efe('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2efe('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x2efe('0x75')]('cm_hopper_final')[_0x2efe('0x3d')](_0x2efe('0x77'),_0x1cea02['params']['id'][_0x2efe('0x74')]()))[_0x2efe('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2efe('0x70')]()[_0x2efe('0x71')](_0x2efe('0x78'))[_0x2efe('0x75')](_0x2efe('0x6b'))[_0x2efe('0x3d')]('CampaignId\x20=\x20?',_0x1cea02['params']['id']['toString']())))[_0x2efe('0x74')]();break;case _0x2efe('0x79'):_0x5a5403=squel['insert']()[_0x2efe('0x6a')]('cm_hopper')[_0x2efe('0x7a')](['phone',_0x2efe('0x6d'),_0x2efe('0x6e'),_0x2efe('0x6f'),_0x2efe('0x5c'),_0x2efe('0x54'),_0x2efe('0x55')],squel[_0x2efe('0x70')]()['field'](_0x2efe('0x6c'),_0x2efe('0x6c'))['field'](_0x2efe('0x72'),_0x2efe('0x6d'))[_0x2efe('0x71')]('id','ContactId')[_0x2efe('0x71')](_0x298dc9['CmListId']['toString'](),_0x2efe('0x6f'))[_0x2efe('0x71')](_0x1cea02[_0x2efe('0x48')]['id'][_0x2efe('0x74')](),_0x2efe('0x5c'))['field']('\x27'+_0x122975+'\x27',_0x2efe('0x54'))[_0x2efe('0x71')]('\x27'+_0x122975+'\x27',_0x2efe('0x55'))[_0x2efe('0x75')](_0x2efe('0x7b'))[_0x2efe('0x3d')]('deletedAt\x20IS\x20NULL')[_0x2efe('0x3d')](_0x2efe('0x7c'),_0x298dc9['CmListId'][_0x2efe('0x74')]())[_0x2efe('0x3d')](_0x2efe('0x76'))[_0x2efe('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2efe('0x70')]()[_0x2efe('0x71')]('COALESCE(phone,\x27\x27)')[_0x2efe('0x75')](_0x2efe('0x6b'))[_0x2efe('0x3d')](_0x2efe('0x77'),_0x1cea02[_0x2efe('0x48')]['id'][_0x2efe('0x74')]())))['toString']();break;default:_0x5a5403=squel[_0x2efe('0x69')]()[_0x2efe('0x6a')](_0x2efe('0x6b'))['fromQuery'](['phone','scheduledAt',_0x2efe('0x6e'),'ListId','CampaignId',_0x2efe('0x54'),_0x2efe('0x55')],squel[_0x2efe('0x70')]()['field'](_0x2efe('0x6c'),_0x2efe('0x6c'))[_0x2efe('0x71')]('NOW()',_0x2efe('0x6d'))[_0x2efe('0x71')]('id','ContactId')['field'](_0x298dc9[_0x2efe('0x73')][_0x2efe('0x74')](),_0x2efe('0x6f'))[_0x2efe('0x71')](_0x1cea02[_0x2efe('0x48')]['id']['toString'](),_0x2efe('0x5c'))[_0x2efe('0x71')]('\x27'+_0x122975+'\x27','createdAt')[_0x2efe('0x71')]('\x27'+_0x122975+'\x27','updatedAt')[_0x2efe('0x75')](_0x2efe('0x7b'))['where'](_0x2efe('0x7d'))[_0x2efe('0x3d')](_0x2efe('0x7c'),_0x298dc9['CmListId'][_0x2efe('0x74')]())[_0x2efe('0x3d')](_0x2efe('0x76')))[_0x2efe('0x74')]();}_0x41398c=squel[_0x2efe('0x69')]()['into'](_0x2efe('0x7e'))[_0x2efe('0x7a')]([_0x2efe('0x7f'),_0x2efe('0x6d'),_0x2efe('0x6c'),'OrderBy',_0x2efe('0x54'),_0x2efe('0x55')],squel[_0x2efe('0x70')]()[_0x2efe('0x71')]('h.id','id')[_0x2efe('0x71')](_0x2efe('0x72'),_0x2efe('0x6d'))[_0x2efe('0x71')](_0x2efe('0x80'),_0x2efe('0x6c'))['field']('ci.OrderBY',_0x2efe('0x81'))['field']('\x27'+_0x122975+'\x27',_0x2efe('0x54'))['field']('\x27'+_0x122975+'\x27',_0x2efe('0x55'))['from'](_0x2efe('0x82'),'ci')[_0x2efe('0x83')](_0x2efe('0x6b'),'h',_0x2efe('0x84'))[_0x2efe('0x3d')]('h.ListId\x20=\x20?',_0x298dc9[_0x2efe('0x73')][_0x2efe('0x74')]())['where'](_0x2efe('0x85'),_0x1cea02['params']['id'][_0x2efe('0x74')]())[_0x2efe('0x3d')](_0x2efe('0x86'),_0x122975))[_0x2efe('0x74')]();_0x5df9d4[_0x2efe('0x87')](db[_0x2efe('0x88')][_0x2efe('0x35')](_0x5a5403));_0x5a75b0[_0x2efe('0x87')](db[_0x2efe('0x88')][_0x2efe('0x35')](_0x41398c));}return BPromise[_0x2efe('0x89')](_0x5df9d4);}})[_0x2efe('0x25')](function(){return BPromise[_0x2efe('0x89')](_0x5a75b0);})[_0x2efe('0x25')](function(){return _0xb25617;})[_0x2efe('0x25')](respondWithResult(_0xfca5a5,null))['catch'](handleError(_0xfca5a5,null));};exports[_0x2efe('0x8a')]=function(_0x5e75bc,_0x2c1853,_0x5b42a1){return db['Campaign'][_0x2efe('0x49')]({'where':{'id':_0x5e75bc['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x2c1853,null))[_0x2efe('0x25')](function(_0x254142){if(_0x254142){return _0x254142[_0x2efe('0x8a')](_0x5e75bc[_0x2efe('0x35')][_0x2efe('0x65')]);}})[_0x2efe('0x25')](function(_0x117d6c){if(_0x117d6c){return db[_0x2efe('0x59')][_0x2efe('0x24')]({'where':{'ListId':_0x5e75bc[_0x2efe('0x35')][_0x2efe('0x65')],'CampaignId':_0x5e75bc[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](function(){return _0x117d6c;});}})['then'](respondWithStatusCode(_0x2c1853,null))[_0x2efe('0x46')](handleError(_0x2c1853,null));};exports[_0x2efe('0x8b')]=function(_0x4619fd,_0x12da9f,_0x48886b){var _0x5bd62a={};var _0x4c7276={};var _0x3ecd84;var _0xe0f2a1;return db[_0x2efe('0x30')]['findOne']({'where':{'id':_0x4619fd['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x12da9f,null))[_0x2efe('0x25')](function(_0x512665){if(_0x512665){_0x3ecd84=_0x512665;_0x4c7276[_0x2efe('0x34')]=_['keys'](db['CmList'][_0x2efe('0x31')]);_0x4c7276['query']=_['keys'](_0x4619fd['query']);_0x4c7276['filters']=_[_0x2efe('0x38')](_0x4c7276[_0x2efe('0x34')],_0x4c7276[_0x2efe('0x35')]);_0x5bd62a[_0x2efe('0x39')]=_['intersection'](_0x4c7276[_0x2efe('0x34')],qs['fields'](_0x4619fd[_0x2efe('0x35')][_0x2efe('0x3a')]));_0x5bd62a[_0x2efe('0x39')]=_0x5bd62a[_0x2efe('0x39')][_0x2efe('0x52')]?_0x5bd62a['attributes']:_0x4c7276[_0x2efe('0x34')];_0x5bd62a[_0x2efe('0x3b')]=qs[_0x2efe('0x3c')](_0x4619fd['query'][_0x2efe('0x3c')]);_0x5bd62a['where']=qs['filters'](_[_0x2efe('0x3e')](_0x4619fd['query'],_0x4c7276[_0x2efe('0x37')]));if(_0x4619fd[_0x2efe('0x35')][_0x2efe('0x3f')]){_0x5bd62a[_0x2efe('0x3d')]=_[_0x2efe('0x40')](_0x5bd62a[_0x2efe('0x3d')],{'$or':_['map'](_0x5bd62a[_0x2efe('0x39')],function(_0x19e204){var _0x1a9a30={};_0x1a9a30[_0x19e204]={'$like':'%'+_0x4619fd['query'][_0x2efe('0x3f')]+'%'};return _0x1a9a30;})});}_0x5bd62a=_[_0x2efe('0x40')]({},_0x5bd62a,_0x4619fd[_0x2efe('0x42')]);return _0x3ecd84[_0x2efe('0x8b')](_0x5bd62a);}})[_0x2efe('0x25')](function(_0xea8423){if(_0xea8423){_0xe0f2a1=_0xea8423[_0x2efe('0x52')];if(!_0x4619fd['query'][_0x2efe('0x5a')](_0x2efe('0x5b'))){_0x5bd62a['limit']=qs[_0x2efe('0x1c')](_0x4619fd[_0x2efe('0x35')]['limit']);_0x5bd62a[_0x2efe('0x19')]=qs[_0x2efe('0x19')](_0x4619fd['query'][_0x2efe('0x19')]);}return _0x3ecd84[_0x2efe('0x8b')](_0x5bd62a);}})[_0x2efe('0x25')](function(_0x1c155f){if(_0x1c155f){return _0x1c155f?{'count':_0xe0f2a1,'rows':_0x1c155f}:null;}})['then'](respondWithResult(_0x12da9f,null))[_0x2efe('0x46')](handleError(_0x12da9f,null));};exports[_0x2efe('0x8c')]=function(_0x22c6a7,_0x28119a,_0x45bfb4){var _0x3bbdc8,_0x9768d3;var _0x38fab0=[];var _0x100a74=moment()[_0x2efe('0x8d')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x2efe('0x49')]({'where':{'id':_0x22c6a7[_0x2efe('0x48')]['id']}})['then'](handleEntityNotFound(_0x28119a,null))[_0x2efe('0x25')](function(_0x4db3f0){if(_0x4db3f0){_0x9768d3=_0x4db3f0;return _0x4db3f0[_0x2efe('0x8c')](_0x22c6a7['body'][_0x2efe('0x65')],_[_0x2efe('0x53')](_0x22c6a7[_0x2efe('0x4b')],['ids','id'])||{});}return null;})[_0x2efe('0x66')](function(_0x42319b){var _0x39b5d5;var _0x54a60e;_0x3bbdc8=_0x42319b||[];var _0x291376=[];if(_0x42319b){for(var _0x1a3a83=0x0;_0x1a3a83<_0x42319b[_0x2efe('0x52')];_0x1a3a83+=0x1){var _0x3bc91e=_0x42319b[_0x1a3a83]['get']({'plain':!![]});_0x39b5d5=squel[_0x2efe('0x69')]()['into'](_0x2efe('0x8e'))[_0x2efe('0x7a')](['phone',_0x2efe('0x6e'),_0x2efe('0x6f'),_0x2efe('0x5c'),_0x2efe('0x54'),_0x2efe('0x55')],squel[_0x2efe('0x70')]()[_0x2efe('0x71')](_0x2efe('0x6c'),_0x2efe('0x6c'))[_0x2efe('0x71')]('id',_0x2efe('0x6e'))[_0x2efe('0x71')](_0x3bc91e[_0x2efe('0x73')][_0x2efe('0x74')](),_0x2efe('0x6f'))[_0x2efe('0x71')](_0x22c6a7[_0x2efe('0x48')]['id'][_0x2efe('0x74')](),_0x2efe('0x5c'))[_0x2efe('0x71')](_0x2efe('0x72'),_0x2efe('0x54'))[_0x2efe('0x71')](_0x2efe('0x72'),_0x2efe('0x55'))[_0x2efe('0x75')](_0x2efe('0x7b'))[_0x2efe('0x3d')](_0x2efe('0x7d'))[_0x2efe('0x3d')](_0x2efe('0x7c'),_0x3bc91e['CmListId'][_0x2efe('0x74')]())['where'](_0x2efe('0x76')))[_0x2efe('0x74')]();_0x291376[_0x2efe('0x87')](db[_0x2efe('0x88')]['query'](_0x39b5d5));}return BPromise[_0x2efe('0x89')](_0x291376);}})[_0x2efe('0x25')](function(){return _0x3bbdc8;})[_0x2efe('0x25')](respondWithResult(_0x28119a,null))[_0x2efe('0x46')](handleError(_0x28119a,null));};exports[_0x2efe('0x8f')]=function(_0x1d9865,_0x28db4e,_0x2df464){return db[_0x2efe('0x30')]['find']({'where':{'id':_0x1d9865[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x28db4e,null))[_0x2efe('0x25')](function(_0xe047ea){if(_0xe047ea){return _0xe047ea['removeBlackLists'](_0x1d9865['query'][_0x2efe('0x65')]);}})[_0x2efe('0x25')](function(_0xb9188e){if(_0xb9188e){return db[_0x2efe('0x60')]['destroy']({'where':{'ListId':_0x1d9865[_0x2efe('0x35')][_0x2efe('0x65')],'CampaignId':_0x1d9865[_0x2efe('0x48')]['id']}})[_0x2efe('0x25')](function(){return _0xb9188e;});}})['then'](respondWithStatusCode(_0x28db4e,null))['catch'](handleError(_0x28db4e,null));}; \ No newline at end of file +var _0xf69c=['from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId','cm_hopper_additional_phones','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','body','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString'];(function(_0xffa654,_0x4c734){var _0x5dd847=function(_0x64173a){while(--_0x64173a){_0xffa654['push'](_0xffa654['shift']());}};_0x5dd847(++_0x4c734);}(_0xf69c,0x1e2));var _0xcf69=function(_0x46b8aa,_0x246d21){_0x46b8aa=_0x46b8aa-0x0;var _0x5a3d61=_0xf69c[_0x46b8aa];return _0x5a3d61;};'use strict';var emlformat=require(_0xcf69('0x0'));var rimraf=require(_0xcf69('0x1'));var zipdir=require(_0xcf69('0x2'));var jsonpatch=require(_0xcf69('0x3'));var rp=require('request-promise');var moment=require(_0xcf69('0x4'));var BPromise=require(_0xcf69('0x5'));var Mustache=require(_0xcf69('0x6'));var util=require('util');var path=require(_0xcf69('0x7'));var sox=require(_0xcf69('0x8'));var csv=require(_0xcf69('0x9'));var ejs=require(_0xcf69('0xa'));var fs=require('fs');var fs_extra=require(_0xcf69('0xb'));var _=require(_0xcf69('0xc'));var squel=require(_0xcf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xe'));var deskjs=require(_0xcf69('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf69('0x10'));var Papa=require(_0xcf69('0x11'));var Redis=require(_0xcf69('0x12'));var authService=require(_0xcf69('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf69('0x14'));var hardwareService=require(_0xcf69('0x15'));var logger=require(_0xcf69('0x16'))('api');var utils=require(_0xcf69('0x17'));var config=require(_0xcf69('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf69('0x19'))['db'];function respondWithStatusCode(_0x25640b,_0x1055f2){_0x1055f2=_0x1055f2||0xcc;return function(_0x339c87){if(_0x339c87){return _0x25640b[_0xcf69('0x1a')](_0x1055f2);}return _0x25640b[_0xcf69('0x1b')](_0x1055f2)[_0xcf69('0x1c')]();};}function respondWithResult(_0x36b3c9,_0x5965d5){_0x5965d5=_0x5965d5||0xc8;return function(_0x32d71f){if(_0x32d71f){return _0x36b3c9['status'](_0x5965d5)[_0xcf69('0x1d')](_0x32d71f);}};}function respondWithFilteredResult(_0x4e32b0,_0x6b4f8e){return function(_0x1d2212){if(_0x1d2212){var _0x5e01be=typeof _0x6b4f8e['offset']===_0xcf69('0x1e')&&typeof _0x6b4f8e['limit']===_0xcf69('0x1e');var _0x561ce4=_0x1d2212[_0xcf69('0x1f')];var _0x50b557=_0x5e01be?0x0:_0x6b4f8e[_0xcf69('0x20')];var _0x5ea276=_0x5e01be?_0x1d2212[_0xcf69('0x1f')]:_0x6b4f8e[_0xcf69('0x20')]+_0x6b4f8e[_0xcf69('0x21')];var _0x5ef249;if(_0x5ea276>=_0x561ce4){_0x5ea276=_0x561ce4;_0x5ef249=0xc8;}else{_0x5ef249=0xce;}_0x4e32b0[_0xcf69('0x1b')](_0x5ef249);return _0x4e32b0[_0xcf69('0x22')](_0xcf69('0x23'),_0x50b557+'-'+_0x5ea276+'/'+_0x561ce4)[_0xcf69('0x1d')](_0x1d2212);}return null;};}function patchUpdates(_0x14b779){return function(_0x10c747){try{jsonpatch[_0xcf69('0x24')](_0x10c747,_0x14b779,!![]);}catch(_0x4a7409){return BPromise[_0xcf69('0x25')](_0x4a7409);}return _0x10c747[_0xcf69('0x26')]();};}function saveUpdates(_0x278c1a,_0x142283){return function(_0xa2031d){if(_0xa2031d){return _0xa2031d['update'](_0x278c1a)[_0xcf69('0x27')](function(_0x5a7e85){return _0x5a7e85;});}return null;};}function removeEntity(_0x1f8d99,_0xe28ca){return function(_0x48a1be){if(_0x48a1be){return _0x48a1be[_0xcf69('0x28')]()['then'](function(){var _0x3255cb=_0x48a1be[_0xcf69('0x29')]({'plain':!![]});var _0x597275='IvrCampaigns';return db[_0xcf69('0x2a')][_0xcf69('0x28')]({'where':{'type':_0x597275,'resourceId':_0x3255cb['id']}})[_0xcf69('0x27')](function(){return _0x48a1be;});})[_0xcf69('0x27')](function(){_0x1f8d99['status'](0xcc)[_0xcf69('0x1c')]();});}};}function handleEntityNotFound(_0x4756b4,_0x1f8881){return function(_0x2c97be){if(!_0x2c97be){_0x4756b4[_0xcf69('0x1a')](0x194);}return _0x2c97be;};}function handleError(_0x5e2374,_0x3b64ae){_0x3b64ae=_0x3b64ae||0x1f4;return function(_0x1e7e77){logger[_0xcf69('0x2b')](_0x1e7e77[_0xcf69('0x2c')]);if(_0x1e7e77[_0xcf69('0x2d')]){delete _0x1e7e77[_0xcf69('0x2d')];}_0x5e2374[_0xcf69('0x1b')](_0x3b64ae)[_0xcf69('0x2e')](_0x1e7e77);};}exports['index']=function(_0x3abf64,_0x463733){var _0x3562c1={},_0x1991c5={},_0x3a423b={'count':0x0,'rows':[]};var _0x270b63=_[_0xcf69('0x2f')](db[_0xcf69('0x30')][_0xcf69('0x31')],function(_0x421304){return{'name':_0x421304[_0xcf69('0x32')],'type':_0x421304[_0xcf69('0x33')][_0xcf69('0x34')]};});_0x1991c5['model']=_['map'](_0x270b63,_0xcf69('0x2d'));_0x1991c5[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x3abf64[_0xcf69('0x35')]);_0x1991c5[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x1991c5[_0xcf69('0x39')],_0x1991c5[_0xcf69('0x35')]);_0x3562c1[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x1991c5[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x3abf64['query'][_0xcf69('0x3b')]));_0x3562c1[_0xcf69('0x3a')]=_0x3562c1[_0xcf69('0x3a')]['length']?_0x3562c1[_0xcf69('0x3a')]:_0x1991c5['model'];if(!_0x3abf64[_0xcf69('0x35')]['hasOwnProperty'](_0xcf69('0x3c'))){_0x3562c1[_0xcf69('0x21')]=qs['limit'](_0x3abf64['query']['limit']);_0x3562c1[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x3abf64[_0xcf69('0x35')]['offset']);}_0x3562c1[_0xcf69('0x3d')]=qs[_0xcf69('0x3e')](_0x3abf64[_0xcf69('0x35')][_0xcf69('0x3e')]);_0x3562c1[_0xcf69('0x3f')]=qs[_0xcf69('0x37')](_[_0xcf69('0x40')](_0x3abf64[_0xcf69('0x35')],_0x1991c5[_0xcf69('0x37')]),_0x270b63);if(_0x3abf64[_0xcf69('0x35')][_0xcf69('0x41')]){_0x3562c1[_0xcf69('0x3f')]=_['merge'](_0x3562c1[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0x270b63,function(_0x4a0162){if(_0x4a0162[_0xcf69('0x33')]!==_0xcf69('0x42')){var _0x413bf9={};_0x413bf9[_0x4a0162[_0xcf69('0x2d')]]={'$like':'%'+_0x3abf64[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0x413bf9;}})});}_0x3562c1=_[_0xcf69('0x43')]({},_0x3562c1,_0x3abf64['options']);var _0x3eadd7={'where':_0x3562c1[_0xcf69('0x3f')]};return db[_0xcf69('0x30')][_0xcf69('0x1f')](_0x3eadd7)[_0xcf69('0x27')](function(_0x2a14e9){_0x3a423b['count']=_0x2a14e9;if(_0x3abf64[_0xcf69('0x35')][_0xcf69('0x44')]){_0x3562c1[_0xcf69('0x45')]=[{'all':!![]}];}return db[_0xcf69('0x30')][_0xcf69('0x46')](_0x3562c1);})[_0xcf69('0x27')](function(_0x2e0cb5){_0x3a423b[_0xcf69('0x47')]=_0x2e0cb5;return _0x3a423b;})[_0xcf69('0x27')](respondWithFilteredResult(_0x463733,_0x3562c1))['catch'](handleError(_0x463733,null));};exports[_0xcf69('0x48')]=function(_0x27fd8f,_0x3acd00){var _0x1b671f={'raw':![],'where':{'id':_0x27fd8f[_0xcf69('0x49')]['id']}},_0x39c879={};_0x39c879[_0xcf69('0x39')]=_[_0xcf69('0x36')](db['Campaign'][_0xcf69('0x31')]);_0x39c879[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x27fd8f[_0xcf69('0x35')]);_0x39c879[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x39c879[_0xcf69('0x39')],_0x39c879[_0xcf69('0x35')]);_0x1b671f[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x39c879[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x27fd8f['query'][_0xcf69('0x3b')]));_0x1b671f['attributes']=_0x1b671f['attributes'][_0xcf69('0x4a')]?_0x1b671f[_0xcf69('0x3a')]:_0x39c879[_0xcf69('0x39')];if(_0x27fd8f[_0xcf69('0x35')][_0xcf69('0x44')]){_0x1b671f[_0xcf69('0x45')]=[{'all':!![]}];}_0x1b671f=_[_0xcf69('0x43')]({},_0x1b671f,_0x27fd8f[_0xcf69('0x4b')]);return db[_0xcf69('0x30')][_0xcf69('0x4c')](_0x1b671f)[_0xcf69('0x27')](handleEntityNotFound(_0x3acd00,null))[_0xcf69('0x27')](respondWithResult(_0x3acd00,null))[_0xcf69('0x4d')](handleError(_0x3acd00,null));};exports[_0xcf69('0x4e')]=function(_0x2b63e1,_0x524c08){return db[_0xcf69('0x30')][_0xcf69('0x4e')](_0x2b63e1['body'],{})[_0xcf69('0x27')](function(_0xce6e6f){var _0xaa9b46=_0x2b63e1[_0xcf69('0x4f')]['get']({'plain':!![]});if(!_0xaa9b46)throw new Error(_0xcf69('0x50'));if(_0xaa9b46[_0xcf69('0x51')]==='user'){var _0xac5f90=_0xce6e6f[_0xcf69('0x29')]({'plain':!![]});var _0x57e2c3=_0xcf69('0x52');return db[_0xcf69('0x53')][_0xcf69('0x4c')]({'where':{'name':_0x57e2c3,'userProfileId':_0xaa9b46['userProfileId']},'raw':!![]})[_0xcf69('0x27')](function(_0xfd0b8a){if(_0xfd0b8a&&_0xfd0b8a['autoAssociation']===0x0){return db[_0xcf69('0x2a')]['create']({'name':_0xac5f90['name'],'resourceId':_0xac5f90['id'],'type':_0xfd0b8a['name'],'sectionId':_0xfd0b8a['id']},{})[_0xcf69('0x27')](function(){return _0xce6e6f;});}else{return _0xce6e6f;}})[_0xcf69('0x4d')](function(_0x1018fe){logger[_0xcf69('0x2b')](_0xcf69('0x54'),_0x1018fe);throw _0x1018fe;});}return _0xce6e6f;})[_0xcf69('0x27')](respondWithResult(_0x524c08,0xc9))[_0xcf69('0x4d')](handleError(_0x524c08,null));};exports[_0xcf69('0x55')]=function(_0x2c9c06,_0x4f75e7){var _0x182b70={'where':{'id':_0x2c9c06[_0xcf69('0x49')]['id']}},_0x3ace61={};_0x3ace61[_0xcf69('0x39')]=_[_0xcf69('0x36')](db['Campaign'][_0xcf69('0x31')]);_0x182b70[_0xcf69('0x3a')]=_['intersection'](_0x3ace61[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x2c9c06['query'][_0xcf69('0x3b')]));_0x182b70[_0xcf69('0x3a')]=_0x182b70[_0xcf69('0x3a')][_0xcf69('0x4a')]?_0x182b70[_0xcf69('0x3a')]:_0x3ace61['model'];if(_0x2c9c06[_0xcf69('0x35')][_0xcf69('0x44')]){_0x182b70[_0xcf69('0x45')]=[{'all':!![]}];}_0x182b70=_['merge']({},_0x182b70,_0x2c9c06['options']);return db[_0xcf69('0x30')][_0xcf69('0x4c')](_0x182b70)[_0xcf69('0x27')](handleEntityNotFound(_0x4f75e7,null))[_0xcf69('0x27')](function(_0x1af814){if(_0x1af814){var _0x5cc0ac=_0x1af814[_0xcf69('0x29')]({'plain':!![]});_0x5cc0ac=qs['omit'](_0x5cc0ac,['id',_0xcf69('0x56'),_0xcf69('0x57')]);_0x2c9c06['body']=_[_0xcf69('0x58')](_0x2c9c06[_0xcf69('0x59')],['id',_0xcf69('0x56'),_0xcf69('0x57')]);return db[_0xcf69('0x30')][_0xcf69('0x4e')](_[_0xcf69('0x43')](_0x5cc0ac,_0x2c9c06[_0xcf69('0x59')]),{'include':_0x2c9c06[_0xcf69('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xcf69('0x27')](function(_0x2fc5d1){var _0x300b35=_0x2c9c06[_0xcf69('0x4f')]['get']({'plain':!![]});if(!_0x300b35)throw new Error(_0xcf69('0x50'));if(_0x300b35['role']==='user'){var _0x408850=_0x2fc5d1[_0xcf69('0x29')]({'plain':!![]});var _0x18ae09=_0xcf69('0x52');return db['UserProfileSection'][_0xcf69('0x4c')]({'where':{'name':_0x18ae09,'userProfileId':_0x300b35[_0xcf69('0x5a')]},'raw':!![]})[_0xcf69('0x27')](function(_0x25d2c2){if(_0x25d2c2&&_0x25d2c2[_0xcf69('0x5b')]===0x0){return db[_0xcf69('0x2a')][_0xcf69('0x4e')]({'name':_0x408850['name'],'resourceId':_0x408850['id'],'type':_0x25d2c2[_0xcf69('0x2d')],'sectionId':_0x25d2c2['id']},{})[_0xcf69('0x27')](function(){return _0x2fc5d1;});}else{return _0x2fc5d1;}})[_0xcf69('0x4d')](function(_0x161174){logger[_0xcf69('0x2b')](_0xcf69('0x54'),_0x161174);throw _0x161174;});}return _0x2fc5d1;});}})[_0xcf69('0x27')](respondWithResult(_0x4f75e7,0xc9))['catch'](handleError(_0x4f75e7,null));};exports['update']=function(_0x2b04a9,_0x199e88){if(_0x2b04a9[_0xcf69('0x59')]['id']){delete _0x2b04a9['body']['id'];}return db[_0xcf69('0x30')]['find']({'where':{'id':_0x2b04a9['params']['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x199e88,null))[_0xcf69('0x27')](saveUpdates(_0x2b04a9[_0xcf69('0x59')],null))[_0xcf69('0x27')](respondWithResult(_0x199e88,null))[_0xcf69('0x4d')](handleError(_0x199e88,null));};exports[_0xcf69('0x28')]=function(_0x3c81cc,_0x1336d6){return db[_0xcf69('0x30')]['find']({'where':{'id':_0x3c81cc['params']['id']}})['then'](handleEntityNotFound(_0x1336d6,null))[_0xcf69('0x27')](removeEntity(_0x1336d6,null))[_0xcf69('0x4d')](handleError(_0x1336d6,null));};exports[_0xcf69('0x5c')]=function(_0x3989bc,_0x218769,_0xa9be50){var _0x2251d1={'raw':!![],'where':{}};var _0x2e2d63={};var _0x43a42a={'count':0x0,'rows':[]};return db[_0xcf69('0x30')][_0xcf69('0x5d')]({'where':{'id':_0x3989bc[_0xcf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x218769,null))[_0xcf69('0x27')](function(_0x43eebc){if(_0x43eebc){_0x2e2d63[_0xcf69('0x39')]=_[_0xcf69('0x36')](db[_0xcf69('0x5e')]['rawAttributes']);_0x2e2d63[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x3989bc['query']);_0x2e2d63[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x2e2d63[_0xcf69('0x39')],_0x2e2d63[_0xcf69('0x35')]);_0x2251d1[_0xcf69('0x3a')]=_['intersection'](_0x2e2d63[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x3989bc['query']['fields']));_0x2251d1[_0xcf69('0x3a')]=_0x2251d1[_0xcf69('0x3a')]['length']?_0x2251d1[_0xcf69('0x3a')]:_0x2e2d63[_0xcf69('0x39')];if(!_0x3989bc[_0xcf69('0x35')][_0xcf69('0x5f')](_0xcf69('0x3c'))){_0x2251d1[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x3989bc['query'][_0xcf69('0x21')]);_0x2251d1[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x3989bc['query']['offset']);}_0x2251d1[_0xcf69('0x3d')]=qs[_0xcf69('0x3e')](_0x3989bc[_0xcf69('0x35')]['sort']);_0x2251d1[_0xcf69('0x3f')]=qs['filters'](_[_0xcf69('0x40')](_0x3989bc[_0xcf69('0x35')],_0x2e2d63[_0xcf69('0x37')]));_0x2251d1['where'][_0xcf69('0x60')]=_0x43eebc['id'];if(_0x3989bc['query'][_0xcf69('0x41')]){_0x2251d1['where']=_[_0xcf69('0x43')](_0x2251d1[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0x2251d1[_0xcf69('0x3a')],function(_0xed121e){var _0x34831c={};_0x34831c[_0xed121e]={'$like':'%'+_0x3989bc[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0x34831c;})});}_0x2251d1=_[_0xcf69('0x43')]({},_0x2251d1,_0x3989bc['options']);return db[_0xcf69('0x5e')]['count']({'where':_0x2251d1['where']})[_0xcf69('0x27')](function(_0x401377){_0x43a42a[_0xcf69('0x1f')]=_0x401377;if(_0x3989bc[_0xcf69('0x35')][_0xcf69('0x44')]){_0x2251d1[_0xcf69('0x45')]=[{'all':!![]}];}return db[_0xcf69('0x5e')][_0xcf69('0x46')](_0x2251d1);})['then'](function(_0xd3afe6){_0x43a42a[_0xcf69('0x47')]=_0xd3afe6;return _0x43a42a;});}})[_0xcf69('0x27')](respondWithFilteredResult(_0x218769,_0x2251d1))[_0xcf69('0x4d')](handleError(_0x218769,null));};exports[_0xcf69('0x61')]=function(_0x53b43c,_0x3fdecb,_0x17a336){var _0xe6d80e={'raw':!![],'where':{}};var _0x455da0={};var _0x1bc3bc={'count':0x0,'rows':[]};return db['Campaign'][_0xcf69('0x5d')]({'where':{'id':_0x53b43c[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x3fdecb,null))[_0xcf69('0x27')](function(_0xacd644){if(_0xacd644){_0x455da0['model']=_['keys'](db[_0xcf69('0x62')]['rawAttributes']);_0x455da0[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x53b43c['query']);_0x455da0[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x455da0['model'],_0x455da0[_0xcf69('0x35')]);_0xe6d80e[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x455da0[_0xcf69('0x39')],qs['fields'](_0x53b43c[_0xcf69('0x35')]['fields']));_0xe6d80e[_0xcf69('0x3a')]=_0xe6d80e[_0xcf69('0x3a')]['length']?_0xe6d80e[_0xcf69('0x3a')]:_0x455da0[_0xcf69('0x39')];if(!_0x53b43c[_0xcf69('0x35')][_0xcf69('0x5f')](_0xcf69('0x3c'))){_0xe6d80e[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x53b43c[_0xcf69('0x35')][_0xcf69('0x21')]);_0xe6d80e[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x53b43c['query'][_0xcf69('0x20')]);}_0xe6d80e[_0xcf69('0x3d')]=qs[_0xcf69('0x3e')](_0x53b43c[_0xcf69('0x35')][_0xcf69('0x3e')]);_0xe6d80e['where']=qs['filters'](_[_0xcf69('0x40')](_0x53b43c['query'],_0x455da0['filters']));_0xe6d80e['where'][_0xcf69('0x60')]=_0xacd644['id'];if(_0x53b43c['query']['filter']){_0xe6d80e['where']=_[_0xcf69('0x43')](_0xe6d80e[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0xe6d80e[_0xcf69('0x3a')],function(_0x4c25ba){var _0x29f3da={};_0x29f3da[_0x4c25ba]={'$like':'%'+_0x53b43c['query'][_0xcf69('0x41')]+'%'};return _0x29f3da;})});}_0xe6d80e=_[_0xcf69('0x43')]({},_0xe6d80e,_0x53b43c[_0xcf69('0x4b')]);return db[_0xcf69('0x62')][_0xcf69('0x1f')]({'where':_0xe6d80e[_0xcf69('0x3f')]})['then'](function(_0x18f320){_0x1bc3bc[_0xcf69('0x1f')]=_0x18f320;if(_0x53b43c[_0xcf69('0x35')]['includeAll']){_0xe6d80e[_0xcf69('0x45')]=[{'all':!![]}];}return db[_0xcf69('0x62')][_0xcf69('0x46')](_0xe6d80e);})[_0xcf69('0x27')](function(_0x49c812){_0x1bc3bc[_0xcf69('0x47')]=_0x49c812;return _0x1bc3bc;});}})[_0xcf69('0x27')](respondWithFilteredResult(_0x3fdecb,_0xe6d80e))['catch'](handleError(_0x3fdecb,null));};exports[_0xcf69('0x63')]=function(_0x489dec,_0x30f402,_0x23708a){var _0x55c8dd={'raw':!![],'where':{}};var _0x1501b1={};var _0x1fc262={'count':0x0,'rows':[]};return db['Campaign'][_0xcf69('0x5d')]({'where':{'id':_0x489dec[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x30f402,null))[_0xcf69('0x27')](function(_0x3fa5a6){if(_0x3fa5a6){_0x1501b1['model']=_[_0xcf69('0x36')](db[_0xcf69('0x64')][_0xcf69('0x31')]);_0x1501b1[_0xcf69('0x35')]=_[_0xcf69('0x36')](_0x489dec[_0xcf69('0x35')]);_0x1501b1['filters']=_[_0xcf69('0x38')](_0x1501b1['model'],_0x1501b1[_0xcf69('0x35')]);_0x55c8dd[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x1501b1[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x489dec[_0xcf69('0x35')][_0xcf69('0x3b')]));_0x55c8dd[_0xcf69('0x3a')]=_0x55c8dd[_0xcf69('0x3a')]['length']?_0x55c8dd[_0xcf69('0x3a')]:_0x1501b1[_0xcf69('0x39')];if(!_0x489dec[_0xcf69('0x35')][_0xcf69('0x5f')](_0xcf69('0x3c'))){_0x55c8dd[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x489dec['query'][_0xcf69('0x21')]);_0x55c8dd[_0xcf69('0x20')]=qs['offset'](_0x489dec[_0xcf69('0x35')][_0xcf69('0x20')]);}_0x55c8dd[_0xcf69('0x3d')]=qs['sort'](_0x489dec[_0xcf69('0x35')][_0xcf69('0x3e')]);_0x55c8dd[_0xcf69('0x3f')]=qs[_0xcf69('0x37')](_[_0xcf69('0x40')](_0x489dec['query'],_0x1501b1['filters']));_0x55c8dd[_0xcf69('0x3f')][_0xcf69('0x60')]=_0x3fa5a6['id'];if(_0x489dec[_0xcf69('0x35')][_0xcf69('0x41')]){_0x55c8dd[_0xcf69('0x3f')]=_['merge'](_0x55c8dd['where'],{'$or':_[_0xcf69('0x2f')](_0x55c8dd[_0xcf69('0x3a')],function(_0x51398a){var _0x3911cd={};_0x3911cd[_0x51398a]={'$like':'%'+_0x489dec[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0x3911cd;})});}_0x55c8dd=_[_0xcf69('0x43')]({},_0x55c8dd,_0x489dec[_0xcf69('0x4b')]);return db['CmHopperFinal'][_0xcf69('0x1f')]({'where':_0x55c8dd[_0xcf69('0x3f')]})[_0xcf69('0x27')](function(_0x52cab4){_0x1fc262['count']=_0x52cab4;if(_0x489dec[_0xcf69('0x35')][_0xcf69('0x44')]){_0x55c8dd[_0xcf69('0x45')]=[{'all':!![]}];}return db[_0xcf69('0x64')][_0xcf69('0x46')](_0x55c8dd);})[_0xcf69('0x27')](function(_0x1fe8cb){_0x1fc262[_0xcf69('0x47')]=_0x1fe8cb;return _0x1fc262;});}})[_0xcf69('0x27')](respondWithFilteredResult(_0x30f402,_0x55c8dd))[_0xcf69('0x4d')](handleError(_0x30f402,null));};exports['getHopperBlacks']=function(_0x4e6c96,_0x1663a3,_0x31c724){var _0x13fb88={'raw':!![],'where':{}};var _0x364cab={};var _0x5243e6={'count':0x0,'rows':[]};return db[_0xcf69('0x30')][_0xcf69('0x5d')]({'where':{'id':_0x4e6c96['params']['id']}})['then'](handleEntityNotFound(_0x1663a3,null))[_0xcf69('0x27')](function(_0x1cae33){if(_0x1cae33){_0x364cab[_0xcf69('0x39')]=_[_0xcf69('0x36')](db[_0xcf69('0x65')][_0xcf69('0x31')]);_0x364cab[_0xcf69('0x35')]=_['keys'](_0x4e6c96[_0xcf69('0x35')]);_0x364cab[_0xcf69('0x37')]=_['intersection'](_0x364cab['model'],_0x364cab[_0xcf69('0x35')]);_0x13fb88[_0xcf69('0x3a')]=_['intersection'](_0x364cab[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x4e6c96['query'][_0xcf69('0x3b')]));_0x13fb88[_0xcf69('0x3a')]=_0x13fb88[_0xcf69('0x3a')][_0xcf69('0x4a')]?_0x13fb88[_0xcf69('0x3a')]:_0x364cab[_0xcf69('0x39')];if(!_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x5f')](_0xcf69('0x3c'))){_0x13fb88[_0xcf69('0x21')]=qs[_0xcf69('0x21')](_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x21')]);_0x13fb88[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x4e6c96['query'][_0xcf69('0x20')]);}_0x13fb88['order']=qs[_0xcf69('0x3e')](_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x3e')]);_0x13fb88['where']=qs['filters'](_[_0xcf69('0x40')](_0x4e6c96[_0xcf69('0x35')],_0x364cab[_0xcf69('0x37')]));_0x13fb88[_0xcf69('0x3f')]['CampaignId']=_0x1cae33['id'];if(_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x41')]){_0x13fb88[_0xcf69('0x3f')]=_[_0xcf69('0x43')](_0x13fb88[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0x13fb88[_0xcf69('0x3a')],function(_0x53a803){var _0x13c5e5={};_0x13c5e5[_0x53a803]={'$like':'%'+_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0x13c5e5;})});}_0x13fb88=_['merge']({},_0x13fb88,_0x4e6c96[_0xcf69('0x4b')]);return db[_0xcf69('0x65')][_0xcf69('0x1f')]({'where':_0x13fb88['where']})[_0xcf69('0x27')](function(_0x41a71e){_0x5243e6[_0xcf69('0x1f')]=_0x41a71e;if(_0x4e6c96[_0xcf69('0x35')][_0xcf69('0x44')]){_0x13fb88[_0xcf69('0x45')]=[{'all':!![]}];}return db[_0xcf69('0x65')][_0xcf69('0x46')](_0x13fb88);})[_0xcf69('0x27')](function(_0x5b1286){_0x5243e6['rows']=_0x5b1286;return _0x5243e6;});}})[_0xcf69('0x27')](respondWithFilteredResult(_0x1663a3,_0x13fb88))[_0xcf69('0x4d')](handleError(_0x1663a3,null));};exports[_0xcf69('0x66')]=function(_0x458242,_0x23c665,_0x2a0a65){var _0x840829={};var _0x145edc={};var _0x32e11d;var _0x48721b;return db[_0xcf69('0x30')][_0xcf69('0x5d')]({'where':{'id':_0x458242['params']['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x23c665,null))[_0xcf69('0x27')](function(_0x2f9fd5){if(_0x2f9fd5){_0x32e11d=_0x2f9fd5;_0x145edc[_0xcf69('0x39')]=_[_0xcf69('0x36')](db['CmList'][_0xcf69('0x31')]);_0x145edc['query']=_['keys'](_0x458242['query']);_0x145edc[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x145edc[_0xcf69('0x39')],_0x145edc['query']);_0x840829[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x145edc[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x458242[_0xcf69('0x35')]['fields']));_0x840829[_0xcf69('0x3a')]=_0x840829[_0xcf69('0x3a')][_0xcf69('0x4a')]?_0x840829['attributes']:_0x145edc[_0xcf69('0x39')];_0x840829['order']=qs[_0xcf69('0x3e')](_0x458242['query'][_0xcf69('0x3e')]);_0x840829[_0xcf69('0x3f')]=qs[_0xcf69('0x37')](_[_0xcf69('0x40')](_0x458242['query'],_0x145edc[_0xcf69('0x37')]));if(_0x458242[_0xcf69('0x35')]['filter']){_0x840829[_0xcf69('0x3f')]=_['merge'](_0x840829[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0x840829['attributes'],function(_0x1ba9f8){var _0x192feb={};_0x192feb[_0x1ba9f8]={'$like':'%'+_0x458242[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0x192feb;})});}_0x840829=_[_0xcf69('0x43')]({},_0x840829,_0x458242[_0xcf69('0x4b')]);return _0x32e11d['getLists'](_0x840829);}})[_0xcf69('0x27')](function(_0x57859b){if(_0x57859b){_0x48721b=_0x57859b[_0xcf69('0x4a')];if(!_0x458242[_0xcf69('0x35')][_0xcf69('0x5f')](_0xcf69('0x3c'))){_0x840829[_0xcf69('0x21')]=qs['limit'](_0x458242[_0xcf69('0x35')]['limit']);_0x840829['offset']=qs['offset'](_0x458242[_0xcf69('0x35')][_0xcf69('0x20')]);}return _0x32e11d[_0xcf69('0x66')](_0x840829);}})['then'](function(_0x1511c2){if(_0x1511c2){return _0x1511c2?{'count':_0x48721b,'rows':_0x1511c2}:null;}})[_0xcf69('0x27')](respondWithResult(_0x23c665,null))[_0xcf69('0x4d')](handleError(_0x23c665,null));};exports['addLists']=function(_0x2df9e4,_0x3220df,_0x466d79){var _0x3998d2,_0x4de882;var _0x249c37=[];var _0x2f44ce=moment()[_0xcf69('0x67')](_0xcf69('0x68'));return db[_0xcf69('0x30')]['find']({'where':{'id':_0x2df9e4[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x3220df,null))[_0xcf69('0x27')](function(_0x50a4e8){if(_0x50a4e8){_0x4de882=_0x50a4e8;return _0x50a4e8[_0xcf69('0x69')](_0x2df9e4[_0xcf69('0x59')]['ids'],_[_0xcf69('0x58')](_0x2df9e4[_0xcf69('0x59')],[_0xcf69('0x6a'),'id'])||{});}return null;})[_0xcf69('0x6b')](function(_0x3c9c87){var _0x1a8b58;var _0x31bc71;_0x3998d2=_0x3c9c87||[];var _0x4d7452=[];if(_0x3c9c87){for(var _0x32553e=0x0;_0x32553e<_0x3c9c87[_0xcf69('0x4a')];_0x32553e+=0x1){var _0x4641b0=_0x3c9c87[_0x32553e][_0xcf69('0x29')]({'plain':!![]});_0x4de882[_0xcf69('0x6c')]=_0x2df9e4[_0xcf69('0x59')][_0xcf69('0x6c')]?_0x2df9e4[_0xcf69('0x59')][_0xcf69('0x6c')]:_0x4de882['dialCheckDuplicateType'];switch(_0x4de882[_0xcf69('0x6c')]){case _0xcf69('0x6d'):_0x1a8b58=squel[_0xcf69('0x6e')]()[_0xcf69('0x6f')](_0xcf69('0x70'))[_0xcf69('0x71')](['phone',_0xcf69('0x72'),_0xcf69('0x73'),'ListId',_0xcf69('0x60'),'createdAt',_0xcf69('0x57')],squel[_0xcf69('0x74')]()[_0xcf69('0x75')]('phone',_0xcf69('0x76'))['field'](_0xcf69('0x77'),_0xcf69('0x72'))[_0xcf69('0x75')]('id',_0xcf69('0x73'))[_0xcf69('0x75')](_0x4641b0[_0xcf69('0x78')][_0xcf69('0x79')](),'ListId')['field'](_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')](),_0xcf69('0x60'))['field']('\x27'+_0x2f44ce+'\x27',_0xcf69('0x56'))['field']('\x27'+_0x2f44ce+'\x27',_0xcf69('0x57'))[_0xcf69('0x7a')](_0xcf69('0x7b'))[_0xcf69('0x3f')]('deletedAt\x20IS\x20NULL')[_0xcf69('0x3f')](_0xcf69('0x7c'),_0x4641b0[_0xcf69('0x78')]['toString']())[_0xcf69('0x3f')](_0xcf69('0x7d'))[_0xcf69('0x3f')](_0xcf69('0x7e'),squel[_0xcf69('0x74')]()[_0xcf69('0x75')](_0xcf69('0x7f'))[_0xcf69('0x7a')](_0xcf69('0x80'))[_0xcf69('0x3f')](_0xcf69('0x81'),_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')]()))[_0xcf69('0x3f')](_0xcf69('0x7e'),squel['select']()[_0xcf69('0x75')](_0xcf69('0x82'))[_0xcf69('0x7a')]('cm_hopper')[_0xcf69('0x3f')](_0xcf69('0x81'),_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')]())))[_0xcf69('0x79')]();break;case _0xcf69('0x83'):_0x1a8b58=squel[_0xcf69('0x6e')]()[_0xcf69('0x6f')]('cm_hopper')[_0xcf69('0x71')](['phone',_0xcf69('0x72'),_0xcf69('0x73'),'ListId',_0xcf69('0x60'),_0xcf69('0x56'),'updatedAt'],squel[_0xcf69('0x74')]()['field'](_0xcf69('0x76'),_0xcf69('0x76'))[_0xcf69('0x75')]('NOW()',_0xcf69('0x72'))[_0xcf69('0x75')]('id',_0xcf69('0x73'))[_0xcf69('0x75')](_0x4641b0[_0xcf69('0x78')]['toString'](),'ListId')[_0xcf69('0x75')](_0x2df9e4['params']['id'][_0xcf69('0x79')](),_0xcf69('0x60'))[_0xcf69('0x75')]('\x27'+_0x2f44ce+'\x27','createdAt')[_0xcf69('0x75')]('\x27'+_0x2f44ce+'\x27','updatedAt')[_0xcf69('0x7a')]('cm_contacts')[_0xcf69('0x3f')](_0xcf69('0x84'))['where'](_0xcf69('0x7c'),_0x4641b0[_0xcf69('0x78')][_0xcf69('0x79')]())[_0xcf69('0x3f')](_0xcf69('0x7d'))[_0xcf69('0x3f')](_0xcf69('0x7e'),squel[_0xcf69('0x74')]()[_0xcf69('0x75')](_0xcf69('0x82'))['from'](_0xcf69('0x70'))['where'](_0xcf69('0x81'),_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')]())))[_0xcf69('0x79')]();break;default:_0x1a8b58=squel[_0xcf69('0x6e')]()[_0xcf69('0x6f')](_0xcf69('0x70'))[_0xcf69('0x71')]([_0xcf69('0x76'),_0xcf69('0x72'),_0xcf69('0x73'),_0xcf69('0x85'),_0xcf69('0x60'),_0xcf69('0x56'),'updatedAt'],squel[_0xcf69('0x74')]()['field'](_0xcf69('0x76'),'phone')[_0xcf69('0x75')]('NOW()',_0xcf69('0x72'))['field']('id','ContactId')['field'](_0x4641b0['CmListId'][_0xcf69('0x79')](),_0xcf69('0x85'))[_0xcf69('0x75')](_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')](),_0xcf69('0x60'))['field']('\x27'+_0x2f44ce+'\x27','createdAt')[_0xcf69('0x75')]('\x27'+_0x2f44ce+'\x27','updatedAt')['from']('cm_contacts')['where'](_0xcf69('0x84'))[_0xcf69('0x3f')](_0xcf69('0x7c'),_0x4641b0[_0xcf69('0x78')][_0xcf69('0x79')]())[_0xcf69('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xcf69('0x79')]();}_0x31bc71=squel[_0xcf69('0x6e')]()[_0xcf69('0x6f')](_0xcf69('0x86'))[_0xcf69('0x71')](['cmHopperId',_0xcf69('0x72'),'phone',_0xcf69('0x87'),'createdAt','updatedAt'],squel[_0xcf69('0x74')]()[_0xcf69('0x75')]('h.id','id')[_0xcf69('0x75')](_0xcf69('0x77'),_0xcf69('0x72'))[_0xcf69('0x75')](_0xcf69('0x88'),_0xcf69('0x76'))[_0xcf69('0x75')](_0xcf69('0x89'),'OrderBy')[_0xcf69('0x75')]('\x27'+_0x2f44ce+'\x27',_0xcf69('0x56'))[_0xcf69('0x75')]('\x27'+_0x2f44ce+'\x27','updatedAt')[_0xcf69('0x7a')](_0xcf69('0x8a'),'ci')[_0xcf69('0x8b')]('cm_hopper','h',_0xcf69('0x8c'))['where']('h.ListId\x20=\x20?',_0x4641b0[_0xcf69('0x78')][_0xcf69('0x79')]())[_0xcf69('0x3f')](_0xcf69('0x8d'),_0x2df9e4[_0xcf69('0x49')]['id'][_0xcf69('0x79')]())[_0xcf69('0x3f')](_0xcf69('0x8e'),_0x2f44ce))[_0xcf69('0x79')]();_0x4d7452[_0xcf69('0x8f')](db[_0xcf69('0x90')]['query'](_0x1a8b58));_0x249c37[_0xcf69('0x8f')](db[_0xcf69('0x90')][_0xcf69('0x35')](_0x31bc71));}return BPromise['all'](_0x4d7452);}})[_0xcf69('0x27')](function(){return BPromise[_0xcf69('0x91')](_0x249c37);})[_0xcf69('0x27')](function(){return _0x3998d2;})[_0xcf69('0x27')](respondWithResult(_0x3220df,null))[_0xcf69('0x4d')](handleError(_0x3220df,null));};exports['removeLists']=function(_0x521683,_0x1c1fd5,_0x28e2e5){return db[_0xcf69('0x30')][_0xcf69('0x4c')]({'where':{'id':_0x521683[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x1c1fd5,null))[_0xcf69('0x27')](function(_0x31afc6){if(_0x31afc6){return _0x31afc6[_0xcf69('0x92')](_0x521683[_0xcf69('0x35')][_0xcf69('0x6a')]);}})[_0xcf69('0x27')](function(_0x5542e8){if(_0x5542e8){return db['CmHopper'][_0xcf69('0x28')]({'where':{'ListId':_0x521683[_0xcf69('0x35')][_0xcf69('0x6a')],'CampaignId':_0x521683[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](function(){return _0x5542e8;});}})['then'](respondWithStatusCode(_0x1c1fd5,null))['catch'](handleError(_0x1c1fd5,null));};exports[_0xcf69('0x93')]=function(_0x4ae1d0,_0x20c933,_0x98f46e){var _0x2039da={};var _0x29712e={};var _0x2e71e3;var _0x17e727;return db[_0xcf69('0x30')]['findOne']({'where':{'id':_0x4ae1d0[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x20c933,null))[_0xcf69('0x27')](function(_0x29fb43){if(_0x29fb43){_0x2e71e3=_0x29fb43;_0x29712e[_0xcf69('0x39')]=_[_0xcf69('0x36')](db[_0xcf69('0x94')][_0xcf69('0x31')]);_0x29712e['query']=_['keys'](_0x4ae1d0[_0xcf69('0x35')]);_0x29712e[_0xcf69('0x37')]=_[_0xcf69('0x38')](_0x29712e[_0xcf69('0x39')],_0x29712e[_0xcf69('0x35')]);_0x2039da[_0xcf69('0x3a')]=_[_0xcf69('0x38')](_0x29712e[_0xcf69('0x39')],qs[_0xcf69('0x3b')](_0x4ae1d0[_0xcf69('0x35')][_0xcf69('0x3b')]));_0x2039da[_0xcf69('0x3a')]=_0x2039da['attributes'][_0xcf69('0x4a')]?_0x2039da[_0xcf69('0x3a')]:_0x29712e[_0xcf69('0x39')];_0x2039da[_0xcf69('0x3d')]=qs[_0xcf69('0x3e')](_0x4ae1d0[_0xcf69('0x35')][_0xcf69('0x3e')]);_0x2039da['where']=qs[_0xcf69('0x37')](_[_0xcf69('0x40')](_0x4ae1d0[_0xcf69('0x35')],_0x29712e[_0xcf69('0x37')]));if(_0x4ae1d0['query'][_0xcf69('0x41')]){_0x2039da[_0xcf69('0x3f')]=_[_0xcf69('0x43')](_0x2039da[_0xcf69('0x3f')],{'$or':_[_0xcf69('0x2f')](_0x2039da[_0xcf69('0x3a')],function(_0x4ba9ea){var _0xb441ab={};_0xb441ab[_0x4ba9ea]={'$like':'%'+_0x4ae1d0[_0xcf69('0x35')][_0xcf69('0x41')]+'%'};return _0xb441ab;})});}_0x2039da=_[_0xcf69('0x43')]({},_0x2039da,_0x4ae1d0[_0xcf69('0x4b')]);return _0x2e71e3['getBlackLists'](_0x2039da);}})['then'](function(_0x15b53a){if(_0x15b53a){_0x17e727=_0x15b53a['length'];if(!_0x4ae1d0[_0xcf69('0x35')][_0xcf69('0x5f')]('nolimit')){_0x2039da['limit']=qs[_0xcf69('0x21')](_0x4ae1d0[_0xcf69('0x35')]['limit']);_0x2039da[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x4ae1d0[_0xcf69('0x35')][_0xcf69('0x20')]);}return _0x2e71e3['getBlackLists'](_0x2039da);}})[_0xcf69('0x27')](function(_0x58b208){if(_0x58b208){return _0x58b208?{'count':_0x17e727,'rows':_0x58b208}:null;}})[_0xcf69('0x27')](respondWithResult(_0x20c933,null))[_0xcf69('0x4d')](handleError(_0x20c933,null));};exports[_0xcf69('0x95')]=function(_0x3d0d0e,_0x3f2f5d,_0x58d894){var _0x18c8ed,_0x492b3c;var _0x48ed03=[];var _0x556da8=moment()[_0xcf69('0x67')](_0xcf69('0x68'));return db[_0xcf69('0x30')][_0xcf69('0x4c')]({'where':{'id':_0x3d0d0e[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](handleEntityNotFound(_0x3f2f5d,null))[_0xcf69('0x27')](function(_0x5d0077){if(_0x5d0077){_0x492b3c=_0x5d0077;return _0x5d0077['addBlackLists'](_0x3d0d0e[_0xcf69('0x59')][_0xcf69('0x6a')],_[_0xcf69('0x58')](_0x3d0d0e['body'],[_0xcf69('0x6a'),'id'])||{});}return null;})[_0xcf69('0x6b')](function(_0x2870d0){var _0x117e7e;var _0x48b710;_0x18c8ed=_0x2870d0||[];var _0x5ac6c4=[];if(_0x2870d0){for(var _0x35bc4d=0x0;_0x35bc4d<_0x2870d0[_0xcf69('0x4a')];_0x35bc4d+=0x1){var _0x30c589=_0x2870d0[_0x35bc4d][_0xcf69('0x29')]({'plain':!![]});_0x117e7e=squel[_0xcf69('0x6e')]()[_0xcf69('0x6f')](_0xcf69('0x96'))[_0xcf69('0x71')]([_0xcf69('0x76'),_0xcf69('0x73'),_0xcf69('0x85'),_0xcf69('0x60'),_0xcf69('0x56'),_0xcf69('0x57')],squel[_0xcf69('0x74')]()[_0xcf69('0x75')]('phone',_0xcf69('0x76'))[_0xcf69('0x75')]('id',_0xcf69('0x73'))[_0xcf69('0x75')](_0x30c589[_0xcf69('0x78')]['toString'](),'ListId')['field'](_0x3d0d0e['params']['id'][_0xcf69('0x79')](),_0xcf69('0x60'))[_0xcf69('0x75')]('NOW()','createdAt')[_0xcf69('0x75')](_0xcf69('0x77'),_0xcf69('0x57'))[_0xcf69('0x7a')]('cm_contacts')[_0xcf69('0x3f')]('deletedAt\x20IS\x20NULL')[_0xcf69('0x3f')](_0xcf69('0x7c'),_0x30c589[_0xcf69('0x78')]['toString']())[_0xcf69('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xcf69('0x79')]();_0x5ac6c4[_0xcf69('0x8f')](db[_0xcf69('0x90')][_0xcf69('0x35')](_0x117e7e));}return BPromise[_0xcf69('0x91')](_0x5ac6c4);}})[_0xcf69('0x27')](function(){return _0x18c8ed;})[_0xcf69('0x27')](respondWithResult(_0x3f2f5d,null))[_0xcf69('0x4d')](handleError(_0x3f2f5d,null));};exports['removeBlackLists']=function(_0x253469,_0x4f7d4c,_0x17ef4c){return db['Campaign'][_0xcf69('0x4c')]({'where':{'id':_0x253469[_0xcf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f7d4c,null))[_0xcf69('0x27')](function(_0x4f43cb){if(_0x4f43cb){return _0x4f43cb['removeBlackLists'](_0x253469[_0xcf69('0x35')][_0xcf69('0x6a')]);}})[_0xcf69('0x27')](function(_0x3f8552){if(_0x3f8552){return db[_0xcf69('0x65')][_0xcf69('0x28')]({'where':{'ListId':_0x253469[_0xcf69('0x35')]['ids'],'CampaignId':_0x253469[_0xcf69('0x49')]['id']}})[_0xcf69('0x27')](function(){return _0x3f8552;});}})[_0xcf69('0x27')](respondWithStatusCode(_0x4f7d4c,null))[_0xcf69('0x4d')](handleError(_0x4f7d4c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 120f678..a88f78c 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5bc3fc,_0x54db61){var _0x1253d0=function(_0x4163c8){while(--_0x4163c8){_0x5bc3fc['push'](_0x5bc3fc['shift']());}};_0x1253d0(++_0x54db61);}(_0x7a54,0x106));var _0x47a5=function(_0x1c2da0,_0x141ad0){_0x1c2da0=_0x1c2da0-0x0;var _0x1e6345=_0x7a54[_0x1c2da0];return _0x1e6345;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0x7a54,0x106));var _0x47a5=function(_0x314afe,_0x230021){_0x314afe=_0x314afe-0x0;var _0x11b59a=_0x7a54[_0x314afe];return _0x11b59a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ab10390..ce236a4 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 _0xe920=['../../config/logger','rpc','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','Campaign,\x20%s,\x20%s','result','GetCampaign','Campaign','options','raw','attributes','limit','include','model','map','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe920,0xbe));var _0x0e92=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xe920[_0x4551f6];return _0x581dc2;};'use strict';var _=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var moment=require(_0x0e92('0x2'));var BPromise=require(_0x0e92('0x3'));var rs=require(_0x0e92('0x4'));var fs=require('fs');var Redis=require(_0x0e92('0x5'));var db=require(_0x0e92('0x6'))['db'];var utils=require(_0x0e92('0x7'));var logger=require(_0x0e92('0x8'))(_0x0e92('0x9'));var config=require('../../config/environment');var jayson=require(_0x0e92('0xa'));var client=jayson['client'][_0x0e92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a315,_0x2d921f,_0x176c3b){return new BPromise(function(_0x5662dc,_0x3dbc96){return client[_0x0e92('0xc')](_0x33a315,_0x176c3b)[_0x0e92('0xd')](function(_0x129376){logger[_0x0e92('0xe')]('Campaign,\x20%s,\x20%s',_0x2d921f,'request\x20sent');logger['debug'](_0x0e92('0xf'),_0x2d921f,_0x0e92('0x10'),JSON['stringify'](_0x129376));if(_0x129376['error']){if(_0x129376['error'][_0x0e92('0x11')]===0x1f4){logger[_0x0e92('0x12')]('Campaign,\x20%s,\x20%s',_0x2d921f,_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);return _0x3dbc96(_0x129376['error'][_0x0e92('0x13')]);}logger[_0x0e92('0x12')](_0x0e92('0x14'),_0x2d921f,_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);return _0x5662dc(_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x2d921f,_0x0e92('0x10'));_0x5662dc(_0x129376[_0x0e92('0x15')]['message']);}})['catch'](function(_0x424c3a){logger['error'](_0x0e92('0x14'),_0x2d921f,_0x424c3a);_0x3dbc96(_0x424c3a);});});}exports[_0x0e92('0x16')]=function(_0x3316a5){var _0x46aa84=this;return new Promise(function(_0x153002,_0x8f7626){return db[_0x0e92('0x17')]['findAll']({'raw':_0x3316a5[_0x0e92('0x18')]?_0x3316a5['options'][_0x0e92('0x19')]===undefined?!![]:![]:!![],'where':_0x3316a5['options']?_0x3316a5['options']['where']||null:null,'attributes':_0x3316a5[_0x0e92('0x18')]?_0x3316a5['options'][_0x0e92('0x1a')]||null:null,'limit':_0x3316a5['options']?_0x3316a5[_0x0e92('0x18')][_0x0e92('0x1b')]||null:null,'include':_0x3316a5['options']?_0x3316a5[_0x0e92('0x18')][_0x0e92('0x1c')]?_['map'](_0x3316a5[_0x0e92('0x18')]['include'],function(_0x43c54c){return{'model':db[_0x43c54c[_0x0e92('0x1d')]],'as':_0x43c54c['as'],'attributes':_0x43c54c[_0x0e92('0x1a')],'include':_0x43c54c[_0x0e92('0x1c')]?_[_0x0e92('0x1e')](_0x43c54c[_0x0e92('0x1c')],function(_0xc34ae4){return{'model':db[_0xc34ae4[_0x0e92('0x1d')]],'as':_0xc34ae4['as'],'attributes':_0xc34ae4[_0x0e92('0x1a')],'include':_0xc34ae4[_0x0e92('0x1c')]?_['map'](_0xc34ae4[_0x0e92('0x1c')],function(_0x47f156){return{'model':db[_0x47f156['model']],'as':_0x47f156['as'],'attributes':_0x47f156[_0x0e92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0e92('0xd')](function(_0x5c5cef){logger['info'](_0x0e92('0x16'),_0x3316a5);logger[_0x0e92('0x1f')]('GetCampaign',_0x3316a5,JSON['stringify'](_0x5c5cef));_0x153002(_0x5c5cef);})[_0x0e92('0x20')](function(_0x329c5f){logger[_0x0e92('0x12')](_0x0e92('0x16'),_0x329c5f[_0x0e92('0x13')],_0x3316a5);_0x8f7626(_0x46aa84[_0x0e92('0x12')](0x1f4,_0x329c5f[_0x0e92('0x13')]));});});}; \ No newline at end of file +var _0x2750=['Campaign','options','raw','where','attributes','include','model','map','GetCampaign','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x2750,0x13b));var _0x0275=function(_0x3b8a89,_0x3704d5){_0x3b8a89=_0x3b8a89-0x0;var _0x8cdc9d=_0x2750[_0x3b8a89];return _0x8cdc9d;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('Campaign,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('Campaign,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});}exports['GetCampaign']=function(_0x591d27){var _0x5b8746=this;return new Promise(function(_0x566ad6,_0x44f7b0){return db[_0x0275('0x19')]['findAll']({'raw':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')][_0x0275('0x1b')]===undefined?!![]:![]:!![],'where':_0x591d27['options']?_0x591d27[_0x0275('0x1a')][_0x0275('0x1c')]||null:null,'attributes':_0x591d27['options']?_0x591d27['options'][_0x0275('0x1d')]||null:null,'limit':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')]['limit']||null:null,'include':_0x591d27[_0x0275('0x1a')]?_0x591d27['options'][_0x0275('0x1e')]?_['map'](_0x591d27[_0x0275('0x1a')][_0x0275('0x1e')],function(_0x594321){return{'model':db[_0x594321[_0x0275('0x1f')]],'as':_0x594321['as'],'attributes':_0x594321[_0x0275('0x1d')],'include':_0x594321[_0x0275('0x1e')]?_['map'](_0x594321[_0x0275('0x1e')],function(_0x44bbf8){return{'model':db[_0x44bbf8[_0x0275('0x1f')]],'as':_0x44bbf8['as'],'attributes':_0x44bbf8[_0x0275('0x1d')],'include':_0x44bbf8[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x44bbf8['include'],function(_0x35343c){return{'model':db[_0x35343c[_0x0275('0x1f')]],'as':_0x35343c['as'],'attributes':_0x35343c[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0xd')](function(_0x4689a3){logger['info'](_0x0275('0x21'),_0x591d27);logger[_0x0275('0xf')](_0x0275('0x21'),_0x591d27,JSON[_0x0275('0x12')](_0x4689a3));_0x566ad6(_0x4689a3);})[_0x0275('0x18')](function(_0x49e645){logger[_0x0275('0x13')](_0x0275('0x21'),_0x49e645[_0x0275('0x15')],_0x591d27);_0x44f7b0(_0x5b8746['error'](0x1f4,_0x49e645['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 46f5dc5..45c4db7 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 _0x75e0=['/:id/blacklists','getBlackLists','create','/:id/clone','clone','post','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0xd0e774,_0x569128){var _0x19b5a1=function(_0x5b572a){while(--_0x5b572a){_0xd0e774['push'](_0xd0e774['shift']());}};_0x19b5a1(++_0x569128);}(_0x75e0,0x1c8));var _0x075e=function(_0x29c460,_0x2c441d){_0x29c460=_0x29c460-0x0;var _0x555aad=_0x75e0[_0x29c460];return _0x555aad;};'use strict';var multer=require(_0x075e('0x0'));var util=require(_0x075e('0x1'));var path=require(_0x075e('0x2'));var timeout=require('connect-timeout');var express=require(_0x075e('0x3'));var router=express[_0x075e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x075e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x075e('0x6'));var controller=require(_0x075e('0x7'));router[_0x075e('0x8')]('/',auth[_0x075e('0x9')](),controller[_0x075e('0xa')]);router[_0x075e('0x8')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller[_0x075e('0xc')]);router[_0x075e('0x8')](_0x075e('0xd'),auth[_0x075e('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x075e('0x9')](),controller[_0x075e('0xe')]);router[_0x075e('0x8')](_0x075e('0xf'),auth['isAuthenticated'](),controller[_0x075e('0x10')]);router[_0x075e('0x8')](_0x075e('0x11'),auth['isAuthenticated'](),controller[_0x075e('0x12')]);router[_0x075e('0x8')](_0x075e('0x13'),auth[_0x075e('0x9')](),controller['getLists']);router[_0x075e('0x8')](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x15')]);router['post']('/',auth[_0x075e('0x9')](),controller[_0x075e('0x16')]);router['post'](_0x075e('0x17'),auth[_0x075e('0x9')](),controller[_0x075e('0x18')]);router[_0x075e('0x19')](_0x075e('0x13'),auth['isAuthenticated'](),controller[_0x075e('0x1a')]);router[_0x075e('0x19')](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x1b')]);router[_0x075e('0x1c')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller['update']);router[_0x075e('0x1d')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller[_0x075e('0x1e')]);router[_0x075e('0x1d')](_0x075e('0x13'),auth[_0x075e('0x9')](),controller[_0x075e('0x1f')]);router['delete'](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x20')]);module[_0x075e('0x21')]=router; \ No newline at end of file +var _0x4ace=['removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists'];(function(_0x4ccf77,_0x42442c){var _0xc1e66d=function(_0x465f33){while(--_0x465f33){_0x4ccf77['push'](_0x4ccf77['shift']());}};_0xc1e66d(++_0x42442c);}(_0x4ace,0x160));var _0xe4ac=function(_0x584619,_0x151e44){_0x584619=_0x584619-0x0;var _0x4392c1=_0x4ace[_0x584619];return _0x4392c1;};'use strict';var multer=require(_0xe4ac('0x0'));var util=require(_0xe4ac('0x1'));var path=require(_0xe4ac('0x2'));var timeout=require(_0xe4ac('0x3'));var express=require(_0xe4ac('0x4'));var router=express[_0xe4ac('0x5')]();var fs_extra=require(_0xe4ac('0x6'));var auth=require(_0xe4ac('0x7'));var interaction=require(_0xe4ac('0x8'));var config=require(_0xe4ac('0x9'));var controller=require(_0xe4ac('0xa'));router[_0xe4ac('0xb')]('/',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0xd')]);router['get'](_0xe4ac('0xe'),auth[_0xe4ac('0xc')](),controller['show']);router[_0xe4ac('0xb')]('/:id/hoppers',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0xf')]);router['get'](_0xe4ac('0x10'),auth[_0xe4ac('0xc')](),controller['getHopperHistories']);router[_0xe4ac('0xb')](_0xe4ac('0x11'),auth[_0xe4ac('0xc')](),controller['getHopperFinals']);router['get'](_0xe4ac('0x12'),auth[_0xe4ac('0xc')](),controller['getHopperBlacks']);router[_0xe4ac('0xb')](_0xe4ac('0x13'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x14')]);router[_0xe4ac('0xb')](_0xe4ac('0x15'),auth['isAuthenticated'](),controller[_0xe4ac('0x16')]);router[_0xe4ac('0x17')]('/',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x18')]);router[_0xe4ac('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0xe4ac('0x19')]);router[_0xe4ac('0x17')]('/:id/lists',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x1a')]);router[_0xe4ac('0x17')](_0xe4ac('0x15'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x1b')]);router[_0xe4ac('0x1c')]('/:id',auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x1d')]);router[_0xe4ac('0x1e')](_0xe4ac('0xe'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x1f')]);router[_0xe4ac('0x1e')](_0xe4ac('0x13'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x20')]);router[_0xe4ac('0x1e')](_0xe4ac('0x15'),auth[_0xe4ac('0xc')](),controller[_0xe4ac('0x21')]);module[_0xe4ac('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index cadeed4..160ef10 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 _0xbd36=['sequelize','exports','TEXT','medium','STRING','getDataValue','key'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xbd36,0xcb));var _0x6bd3=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xbd36[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x6bd3('0x0'));module[_0x6bd3('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6bd3('0x2')],'length':_0x6bd3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6bd3('0x4')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6bd3('0x5')](_0x6bd3('0x6'));}}}; \ No newline at end of file +var _0x3d52=['STRING','TEXT','medium','getDataValue','key','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3d52,0x163));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x23d5('0x0'));module[_0x23d5('0x1')]={'key':{'type':Sequelize[_0x23d5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x23d5('0x3')],'length':_0x23d5('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x23d5('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x23d5('0x5')](_0x23d5('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ebc0243..aac8fcb 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 _0xe6f8=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','CannedAnswer','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2c8b3b,_0x13b400){var _0x3ba72b=function(_0x115784){while(--_0x115784){_0x2c8b3b['push'](_0x2c8b3b['shift']());}};_0x3ba72b(++_0x13b400);}(_0xe6f8,0x153));var _0x8e6f=function(_0x397a71,_0x46ee33){_0x397a71=_0x397a71-0x0;var _0x2bd7ed=_0xe6f8[_0x397a71];return _0x2bd7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e6f('0x0'));var zipdir=require(_0x8e6f('0x1'));var jsonpatch=require(_0x8e6f('0x2'));var rp=require(_0x8e6f('0x3'));var moment=require(_0x8e6f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8e6f('0x5'));var util=require(_0x8e6f('0x6'));var path=require(_0x8e6f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e6f('0x8'));var _=require(_0x8e6f('0x9'));var squel=require(_0x8e6f('0xa'));var crypto=require(_0x8e6f('0xb'));var jsforce=require(_0x8e6f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e6f('0xd'));var Papa=require(_0x8e6f('0xe'));var Redis=require(_0x8e6f('0xf'));var authService=require(_0x8e6f('0x10'));var qs=require(_0x8e6f('0x11'));var as=require(_0x8e6f('0x12'));var hardwareService=require(_0x8e6f('0x13'));var logger=require(_0x8e6f('0x14'))(_0x8e6f('0x15'));var utils=require(_0x8e6f('0x16'));var config=require(_0x8e6f('0x17'));var licenseUtil=require(_0x8e6f('0x18'));var db=require(_0x8e6f('0x19'))['db'];function respondWithStatusCode(_0x2f985b,_0x40dc02){_0x40dc02=_0x40dc02||0xcc;return function(_0x2fe97f){if(_0x2fe97f){return _0x2f985b['sendStatus'](_0x40dc02);}return _0x2f985b['status'](_0x40dc02)[_0x8e6f('0x1a')]();};}function respondWithResult(_0x13c1f0,_0x2418f0){_0x2418f0=_0x2418f0||0xc8;return function(_0x101211){if(_0x101211){return _0x13c1f0[_0x8e6f('0x1b')](_0x2418f0)[_0x8e6f('0x1c')](_0x101211);}};}function respondWithFilteredResult(_0x2f6642,_0x164934){return function(_0x22afb1){if(_0x22afb1){var _0x114803=typeof _0x164934[_0x8e6f('0x1d')]===_0x8e6f('0x1e')&&typeof _0x164934[_0x8e6f('0x1f')]===_0x8e6f('0x1e');var _0x152067=_0x22afb1[_0x8e6f('0x20')];var _0x4fbcda=_0x114803?0x0:_0x164934[_0x8e6f('0x1d')];var _0x43fc2f=_0x114803?_0x22afb1[_0x8e6f('0x20')]:_0x164934['offset']+_0x164934[_0x8e6f('0x1f')];var _0x25f0b1;if(_0x43fc2f>=_0x152067){_0x43fc2f=_0x152067;_0x25f0b1=0xc8;}else{_0x25f0b1=0xce;}_0x2f6642['status'](_0x25f0b1);return _0x2f6642[_0x8e6f('0x21')](_0x8e6f('0x22'),_0x4fbcda+'-'+_0x43fc2f+'/'+_0x152067)[_0x8e6f('0x1c')](_0x22afb1);}return null;};}function patchUpdates(_0x4182a0){return function(_0x191a4c){try{jsonpatch[_0x8e6f('0x23')](_0x191a4c,_0x4182a0,!![]);}catch(_0xc12919){return BPromise[_0x8e6f('0x24')](_0xc12919);}return _0x191a4c[_0x8e6f('0x25')]();};}function saveUpdates(_0x3ec8c1,_0x1aabcf){return function(_0x34eb31){if(_0x34eb31){return _0x34eb31[_0x8e6f('0x26')](_0x3ec8c1)[_0x8e6f('0x27')](function(_0x18843d){return _0x18843d;});}return null;};}function removeEntity(_0x3124ca,_0x347adf){return function(_0x2b4dce){if(_0x2b4dce){return _0x2b4dce[_0x8e6f('0x28')]()['then'](function(){var _0x17e183=_0x2b4dce[_0x8e6f('0x29')]({'plain':!![]});var _0x130cc2=_0x8e6f('0x2a');return db[_0x8e6f('0x2b')]['destroy']({'where':{'type':_0x130cc2,'resourceId':_0x17e183['id']}})['then'](function(){return _0x2b4dce;});})[_0x8e6f('0x27')](function(){_0x3124ca[_0x8e6f('0x1b')](0xcc)[_0x8e6f('0x1a')]();});}};}function handleEntityNotFound(_0x4f9e68,_0x5c2d72){return function(_0x4bc100){if(!_0x4bc100){_0x4f9e68['sendStatus'](0x194);}return _0x4bc100;};}function handleError(_0x4511ac,_0x45facb){_0x45facb=_0x45facb||0x1f4;return function(_0x6ecc05){logger[_0x8e6f('0x2c')](_0x6ecc05[_0x8e6f('0x2d')]);if(_0x6ecc05[_0x8e6f('0x2e')]){delete _0x6ecc05[_0x8e6f('0x2e')];}_0x4511ac[_0x8e6f('0x1b')](_0x45facb)[_0x8e6f('0x2f')](_0x6ecc05);};}exports['index']=function(_0x2e626d,_0x1a39b7){var _0x51d24e={},_0x29faae={},_0x41e201={'count':0x0,'rows':[]};var _0x8a38d9=_[_0x8e6f('0x30')](db[_0x8e6f('0x31')][_0x8e6f('0x32')],function(_0x1e180e){return{'name':_0x1e180e['fieldName'],'type':_0x1e180e[_0x8e6f('0x33')]['key']};});_0x29faae[_0x8e6f('0x34')]=_[_0x8e6f('0x30')](_0x8a38d9,_0x8e6f('0x2e'));_0x29faae[_0x8e6f('0x35')]=_[_0x8e6f('0x36')](_0x2e626d['query']);_0x29faae[_0x8e6f('0x37')]=_[_0x8e6f('0x38')](_0x29faae[_0x8e6f('0x34')],_0x29faae['query']);_0x51d24e[_0x8e6f('0x39')]=_['intersection'](_0x29faae['model'],qs[_0x8e6f('0x3a')](_0x2e626d[_0x8e6f('0x35')]['fields']));_0x51d24e['attributes']=_0x51d24e['attributes'][_0x8e6f('0x3b')]?_0x51d24e[_0x8e6f('0x39')]:_0x29faae[_0x8e6f('0x34')];if(!_0x2e626d[_0x8e6f('0x35')][_0x8e6f('0x3c')]('nolimit')){_0x51d24e['limit']=qs['limit'](_0x2e626d[_0x8e6f('0x35')][_0x8e6f('0x1f')]);_0x51d24e['offset']=qs['offset'](_0x2e626d[_0x8e6f('0x35')][_0x8e6f('0x1d')]);}_0x51d24e[_0x8e6f('0x3d')]=qs[_0x8e6f('0x3e')](_0x2e626d[_0x8e6f('0x35')][_0x8e6f('0x3e')]);_0x51d24e['where']=qs[_0x8e6f('0x37')](_['pick'](_0x2e626d[_0x8e6f('0x35')],_0x29faae['filters']),_0x8a38d9);if(_0x2e626d[_0x8e6f('0x35')][_0x8e6f('0x3f')]){_0x51d24e[_0x8e6f('0x40')]=_[_0x8e6f('0x41')](_0x51d24e[_0x8e6f('0x40')],{'$or':[{'key':{'$like':'%'+_0x2e626d['query'][_0x8e6f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x2e626d['query']['filter']+'%'}}]});}_0x51d24e=_[_0x8e6f('0x41')]({},_0x51d24e,_0x2e626d['options']);var _0x28c0ec={'where':_0x51d24e[_0x8e6f('0x40')]};return db['CannedAnswer'][_0x8e6f('0x20')](_0x28c0ec)[_0x8e6f('0x27')](function(_0x284082){_0x41e201['count']=_0x284082;if(_0x2e626d[_0x8e6f('0x35')]['includeAll']){_0x51d24e[_0x8e6f('0x42')]=[{'all':!![]}];}return db[_0x8e6f('0x31')][_0x8e6f('0x43')](_0x51d24e);})[_0x8e6f('0x27')](function(_0x4af7a0){_0x41e201[_0x8e6f('0x44')]=_0x4af7a0;return _0x41e201;})[_0x8e6f('0x27')](respondWithFilteredResult(_0x1a39b7,_0x51d24e))[_0x8e6f('0x45')](handleError(_0x1a39b7,null));};exports[_0x8e6f('0x46')]=function(_0x1c6e33,_0x373a60){var _0x1da7ab={'raw':!![],'where':{'id':_0x1c6e33[_0x8e6f('0x47')]['id']}},_0xf80810={};_0xf80810['model']=_[_0x8e6f('0x36')](db[_0x8e6f('0x31')][_0x8e6f('0x32')]);_0xf80810[_0x8e6f('0x35')]=_[_0x8e6f('0x36')](_0x1c6e33['query']);_0xf80810['filters']=_['intersection'](_0xf80810[_0x8e6f('0x34')],_0xf80810[_0x8e6f('0x35')]);_0x1da7ab[_0x8e6f('0x39')]=_['intersection'](_0xf80810[_0x8e6f('0x34')],qs['fields'](_0x1c6e33[_0x8e6f('0x35')]['fields']));_0x1da7ab[_0x8e6f('0x39')]=_0x1da7ab[_0x8e6f('0x39')][_0x8e6f('0x3b')]?_0x1da7ab[_0x8e6f('0x39')]:_0xf80810[_0x8e6f('0x34')];if(_0x1c6e33[_0x8e6f('0x35')][_0x8e6f('0x48')]){_0x1da7ab[_0x8e6f('0x42')]=[{'all':!![]}];}_0x1da7ab=_['merge']({},_0x1da7ab,_0x1c6e33[_0x8e6f('0x49')]);return db[_0x8e6f('0x31')][_0x8e6f('0x4a')](_0x1da7ab)[_0x8e6f('0x27')](handleEntityNotFound(_0x373a60,null))['then'](respondWithResult(_0x373a60,null))['catch'](handleError(_0x373a60,null));};exports[_0x8e6f('0x26')]=function(_0x211f7d,_0x3819ff){if(_0x211f7d[_0x8e6f('0x4b')]['id']){delete _0x211f7d[_0x8e6f('0x4b')]['id'];}return db[_0x8e6f('0x31')][_0x8e6f('0x4a')]({'where':{'id':_0x211f7d[_0x8e6f('0x47')]['id']}})[_0x8e6f('0x27')](handleEntityNotFound(_0x3819ff,null))[_0x8e6f('0x27')](saveUpdates(_0x211f7d[_0x8e6f('0x4b')],null))['then'](respondWithResult(_0x3819ff,null))[_0x8e6f('0x45')](handleError(_0x3819ff,null));};exports['destroy']=function(_0x1aec29,_0x4009bb){return db[_0x8e6f('0x31')][_0x8e6f('0x4a')]({'where':{'id':_0x1aec29[_0x8e6f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4009bb,null))[_0x8e6f('0x27')](removeEntity(_0x4009bb,null))[_0x8e6f('0x45')](handleError(_0x4009bb,null));};exports[_0x8e6f('0x4c')]=function(_0x12990b,_0x4567b6){var _0x448bec={'key':_0x12990b['body'][_0x8e6f('0x4d')]};if(_0x12990b['body'][_0x8e6f('0x4e')]){_0x448bec[_0x8e6f('0x4e')]=_0x12990b['body'][_0x8e6f('0x4e')];}else if(_0x12990b[_0x8e6f('0x4b')][_0x8e6f('0x4f')]){_0x448bec[_0x8e6f('0x4f')]=_0x12990b[_0x8e6f('0x4b')][_0x8e6f('0x4f')];}else if(_0x12990b[_0x8e6f('0x4b')][_0x8e6f('0x50')]){_0x448bec[_0x8e6f('0x50')]=_0x12990b[_0x8e6f('0x4b')][_0x8e6f('0x50')];}else if(_0x12990b[_0x8e6f('0x4b')]['ChatWebsiteId']){_0x448bec[_0x8e6f('0x51')]=_0x12990b[_0x8e6f('0x4b')][_0x8e6f('0x51')];}return db['CannedAnswer'][_0x8e6f('0x4a')]({'where':_0x448bec})[_0x8e6f('0x27')](function(_0x2276b2){if(_0x2276b2){throw new db[(_0x8e6f('0x52'))][(_0x8e6f('0x53'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x8e6f('0x31')][_0x8e6f('0x4c')](_0x12990b[_0x8e6f('0x4b')]);})['then'](function(_0x37269b){var _0x15f885=_0x12990b[_0x8e6f('0x54')][_0x8e6f('0x29')]({'plain':!![]});if(!_0x15f885)throw new Error(_0x8e6f('0x55'));if(_0x15f885[_0x8e6f('0x56')]===_0x8e6f('0x54')){var _0x78ea6a=_0x37269b[_0x8e6f('0x29')]({'plain':!![]});return db[_0x8e6f('0x57')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x15f885[_0x8e6f('0x58')]},'raw':!![]})[_0x8e6f('0x27')](function(_0x1029e4){if(_0x1029e4&&_0x1029e4['autoAssociation']===0x0){return db[_0x8e6f('0x2b')]['create']({'name':_0x78ea6a[_0x8e6f('0x2e')],'resourceId':_0x78ea6a['id'],'type':_0x1029e4[_0x8e6f('0x2e')],'sectionId':_0x1029e4['id']},{})[_0x8e6f('0x27')](function(){return _0x37269b;});}else{return _0x37269b;}})[_0x8e6f('0x45')](function(_0x2a652c){logger[_0x8e6f('0x2c')](_0x8e6f('0x59'),_0x2a652c);throw _0x2a652c;});}return _0x37269b;})[_0x8e6f('0x27')](respondWithResult(_0x4567b6,0xc9))[_0x8e6f('0x45')](handleError(_0x4567b6,null));}; \ No newline at end of file +var _0x1954=['model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CannedAnswer','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','fieldName'];(function(_0x35d887,_0x249fb0){var _0x19a3f5=function(_0x411fc8){while(--_0x411fc8){_0x35d887['push'](_0x35d887['shift']());}};_0x19a3f5(++_0x249fb0);}(_0x1954,0x86));var _0x4195=function(_0x32eca7,_0x145c87){_0x32eca7=_0x32eca7-0x0;var _0x2f4a6d=_0x1954[_0x32eca7];return _0x2f4a6d;};'use strict';var emlformat=require(_0x4195('0x0'));var rimraf=require(_0x4195('0x1'));var zipdir=require(_0x4195('0x2'));var jsonpatch=require(_0x4195('0x3'));var rp=require(_0x4195('0x4'));var moment=require(_0x4195('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4195('0x6'));var util=require('util');var path=require(_0x4195('0x7'));var sox=require(_0x4195('0x8'));var csv=require(_0x4195('0x9'));var ejs=require(_0x4195('0xa'));var fs=require('fs');var fs_extra=require(_0x4195('0xb'));var _=require(_0x4195('0xc'));var squel=require('squel');var crypto=require(_0x4195('0xd'));var jsforce=require(_0x4195('0xe'));var deskjs=require(_0x4195('0xf'));var toCsv=require(_0x4195('0x9'));var querystring=require(_0x4195('0x10'));var Papa=require('papaparse');var Redis=require(_0x4195('0x11'));var authService=require(_0x4195('0x12'));var qs=require(_0x4195('0x13'));var as=require(_0x4195('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4195('0x15'))(_0x4195('0x16'));var utils=require(_0x4195('0x17'));var config=require(_0x4195('0x18'));var licenseUtil=require(_0x4195('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x400913,_0x59911b){_0x59911b=_0x59911b||0xcc;return function(_0x19b6e5){if(_0x19b6e5){return _0x400913[_0x4195('0x1a')](_0x59911b);}return _0x400913[_0x4195('0x1b')](_0x59911b)[_0x4195('0x1c')]();};}function respondWithResult(_0x4da702,_0x5267a9){_0x5267a9=_0x5267a9||0xc8;return function(_0x42fe8a){if(_0x42fe8a){return _0x4da702[_0x4195('0x1b')](_0x5267a9)[_0x4195('0x1d')](_0x42fe8a);}};}function respondWithFilteredResult(_0x1ddf5a,_0x23a419){return function(_0x1bfdee){if(_0x1bfdee){var _0x4d31e3=typeof _0x23a419['offset']===_0x4195('0x1e')&&typeof _0x23a419['limit']==='undefined';var _0x216ab3=_0x1bfdee['count'];var _0x2e6c66=_0x4d31e3?0x0:_0x23a419[_0x4195('0x1f')];var _0x54ee1d=_0x4d31e3?_0x1bfdee['count']:_0x23a419[_0x4195('0x1f')]+_0x23a419[_0x4195('0x20')];var _0x4ec8c8;if(_0x54ee1d>=_0x216ab3){_0x54ee1d=_0x216ab3;_0x4ec8c8=0xc8;}else{_0x4ec8c8=0xce;}_0x1ddf5a[_0x4195('0x1b')](_0x4ec8c8);return _0x1ddf5a[_0x4195('0x21')](_0x4195('0x22'),_0x2e6c66+'-'+_0x54ee1d+'/'+_0x216ab3)[_0x4195('0x1d')](_0x1bfdee);}return null;};}function patchUpdates(_0x399d1c){return function(_0x6ce83e){try{jsonpatch[_0x4195('0x23')](_0x6ce83e,_0x399d1c,!![]);}catch(_0x128dc8){return BPromise[_0x4195('0x24')](_0x128dc8);}return _0x6ce83e[_0x4195('0x25')]();};}function saveUpdates(_0xf0fcef,_0x365897){return function(_0xe9f62b){if(_0xe9f62b){return _0xe9f62b[_0x4195('0x26')](_0xf0fcef)[_0x4195('0x27')](function(_0x587cea){return _0x587cea;});}return null;};}function removeEntity(_0x1e6dd8,_0x1baa93){return function(_0x103a67){if(_0x103a67){return _0x103a67[_0x4195('0x28')]()['then'](function(){var _0x204872=_0x103a67[_0x4195('0x29')]({'plain':!![]});var _0x376755='CannedAnswers';return db['UserProfileResource'][_0x4195('0x28')]({'where':{'type':_0x376755,'resourceId':_0x204872['id']}})[_0x4195('0x27')](function(){return _0x103a67;});})[_0x4195('0x27')](function(){_0x1e6dd8['status'](0xcc)[_0x4195('0x1c')]();});}};}function handleEntityNotFound(_0x133cad,_0x2f7ea1){return function(_0x3b25ab){if(!_0x3b25ab){_0x133cad[_0x4195('0x1a')](0x194);}return _0x3b25ab;};}function handleError(_0x548058,_0x92ddcf){_0x92ddcf=_0x92ddcf||0x1f4;return function(_0x4e61b9){logger[_0x4195('0x2a')](_0x4e61b9[_0x4195('0x2b')]);if(_0x4e61b9[_0x4195('0x2c')]){delete _0x4e61b9[_0x4195('0x2c')];}_0x548058[_0x4195('0x1b')](_0x92ddcf)[_0x4195('0x2d')](_0x4e61b9);};}exports[_0x4195('0x2e')]=function(_0x1b0905,_0x56c404){var _0xa084db={},_0x765de6={},_0x113f48={'count':0x0,'rows':[]};var _0x15fb10=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x583208){return{'name':_0x583208[_0x4195('0x2f')],'type':_0x583208['type']['key']};});_0x765de6[_0x4195('0x30')]=_[_0x4195('0x31')](_0x15fb10,'name');_0x765de6[_0x4195('0x32')]=_['keys'](_0x1b0905['query']);_0x765de6[_0x4195('0x33')]=_[_0x4195('0x34')](_0x765de6[_0x4195('0x30')],_0x765de6[_0x4195('0x32')]);_0xa084db[_0x4195('0x35')]=_[_0x4195('0x34')](_0x765de6['model'],qs['fields'](_0x1b0905[_0x4195('0x32')][_0x4195('0x36')]));_0xa084db[_0x4195('0x35')]=_0xa084db[_0x4195('0x35')]['length']?_0xa084db[_0x4195('0x35')]:_0x765de6[_0x4195('0x30')];if(!_0x1b0905['query'][_0x4195('0x37')](_0x4195('0x38'))){_0xa084db[_0x4195('0x20')]=qs['limit'](_0x1b0905[_0x4195('0x32')]['limit']);_0xa084db['offset']=qs[_0x4195('0x1f')](_0x1b0905[_0x4195('0x32')][_0x4195('0x1f')]);}_0xa084db[_0x4195('0x39')]=qs[_0x4195('0x3a')](_0x1b0905[_0x4195('0x32')][_0x4195('0x3a')]);_0xa084db[_0x4195('0x3b')]=qs[_0x4195('0x33')](_[_0x4195('0x3c')](_0x1b0905[_0x4195('0x32')],_0x765de6[_0x4195('0x33')]),_0x15fb10);if(_0x1b0905[_0x4195('0x32')][_0x4195('0x3d')]){_0xa084db['where']=_['merge'](_0xa084db[_0x4195('0x3b')],{'$or':[{'key':{'$like':'%'+_0x1b0905['query'][_0x4195('0x3d')]+'%'}},{'value':{'$like':'%'+_0x1b0905['query'][_0x4195('0x3d')]+'%'}}]});}_0xa084db=_[_0x4195('0x3e')]({},_0xa084db,_0x1b0905['options']);var _0x2ec26d={'where':_0xa084db[_0x4195('0x3b')]};return db[_0x4195('0x3f')]['count'](_0x2ec26d)['then'](function(_0xe58617){_0x113f48[_0x4195('0x40')]=_0xe58617;if(_0x1b0905[_0x4195('0x32')][_0x4195('0x41')]){_0xa084db[_0x4195('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4195('0x43')](_0xa084db);})[_0x4195('0x27')](function(_0x4a699c){_0x113f48[_0x4195('0x44')]=_0x4a699c;return _0x113f48;})[_0x4195('0x27')](respondWithFilteredResult(_0x56c404,_0xa084db))[_0x4195('0x45')](handleError(_0x56c404,null));};exports[_0x4195('0x46')]=function(_0x39c120,_0x396dbb){var _0x2395f9={'raw':!![],'where':{'id':_0x39c120[_0x4195('0x47')]['id']}},_0x58668d={};_0x58668d[_0x4195('0x30')]=_[_0x4195('0x48')](db[_0x4195('0x3f')][_0x4195('0x49')]);_0x58668d[_0x4195('0x32')]=_[_0x4195('0x48')](_0x39c120[_0x4195('0x32')]);_0x58668d[_0x4195('0x33')]=_[_0x4195('0x34')](_0x58668d[_0x4195('0x30')],_0x58668d[_0x4195('0x32')]);_0x2395f9[_0x4195('0x35')]=_[_0x4195('0x34')](_0x58668d[_0x4195('0x30')],qs['fields'](_0x39c120[_0x4195('0x32')][_0x4195('0x36')]));_0x2395f9[_0x4195('0x35')]=_0x2395f9[_0x4195('0x35')]['length']?_0x2395f9[_0x4195('0x35')]:_0x58668d[_0x4195('0x30')];if(_0x39c120['query'][_0x4195('0x41')]){_0x2395f9[_0x4195('0x42')]=[{'all':!![]}];}_0x2395f9=_[_0x4195('0x3e')]({},_0x2395f9,_0x39c120[_0x4195('0x4a')]);return db[_0x4195('0x3f')][_0x4195('0x4b')](_0x2395f9)[_0x4195('0x27')](handleEntityNotFound(_0x396dbb,null))['then'](respondWithResult(_0x396dbb,null))[_0x4195('0x45')](handleError(_0x396dbb,null));};exports['update']=function(_0x275e5a,_0x4e888a){if(_0x275e5a['body']['id']){delete _0x275e5a[_0x4195('0x4c')]['id'];}return db[_0x4195('0x3f')][_0x4195('0x4b')]({'where':{'id':_0x275e5a[_0x4195('0x47')]['id']}})[_0x4195('0x27')](handleEntityNotFound(_0x4e888a,null))[_0x4195('0x27')](saveUpdates(_0x275e5a[_0x4195('0x4c')],null))[_0x4195('0x27')](respondWithResult(_0x4e888a,null))['catch'](handleError(_0x4e888a,null));};exports[_0x4195('0x28')]=function(_0x3ba28c,_0x354f23){return db['CannedAnswer']['find']({'where':{'id':_0x3ba28c[_0x4195('0x47')]['id']}})[_0x4195('0x27')](handleEntityNotFound(_0x354f23,null))[_0x4195('0x27')](removeEntity(_0x354f23,null))[_0x4195('0x45')](handleError(_0x354f23,null));};exports['create']=function(_0x3efb25,_0x4d161d){var _0xd4b6ea={'key':_0x3efb25[_0x4195('0x4c')]['key']};if(_0x3efb25[_0x4195('0x4c')][_0x4195('0x4d')]){_0xd4b6ea[_0x4195('0x4d')]=_0x3efb25[_0x4195('0x4c')][_0x4195('0x4d')];}else if(_0x3efb25[_0x4195('0x4c')][_0x4195('0x4e')]){_0xd4b6ea[_0x4195('0x4e')]=_0x3efb25['body'][_0x4195('0x4e')];}else if(_0x3efb25[_0x4195('0x4c')][_0x4195('0x4f')]){_0xd4b6ea[_0x4195('0x4f')]=_0x3efb25['body'][_0x4195('0x4f')];}else if(_0x3efb25[_0x4195('0x4c')][_0x4195('0x50')]){_0xd4b6ea[_0x4195('0x50')]=_0x3efb25[_0x4195('0x4c')][_0x4195('0x50')];}return db[_0x4195('0x3f')][_0x4195('0x4b')]({'where':_0xd4b6ea})['then'](function(_0x3d8093){if(_0x3d8093){throw new db['Sequelize']['ValidationError'](_0x4195('0x51'));}return db[_0x4195('0x3f')]['create'](_0x3efb25[_0x4195('0x4c')]);})[_0x4195('0x27')](function(_0x309e46){var _0x277940=_0x3efb25[_0x4195('0x52')][_0x4195('0x29')]({'plain':!![]});if(!_0x277940)throw new Error(_0x4195('0x53'));if(_0x277940['role']===_0x4195('0x52')){var _0x4b36f3=_0x309e46[_0x4195('0x29')]({'plain':!![]});return db[_0x4195('0x54')][_0x4195('0x4b')]({'where':{'name':_0x4195('0x55'),'userProfileId':_0x277940[_0x4195('0x56')]},'raw':!![]})[_0x4195('0x27')](function(_0x20c703){if(_0x20c703&&_0x20c703[_0x4195('0x57')]===0x0){return db[_0x4195('0x58')][_0x4195('0x59')]({'name':_0x4b36f3[_0x4195('0x2c')],'resourceId':_0x4b36f3['id'],'type':_0x20c703['name'],'sectionId':_0x20c703['id']},{})[_0x4195('0x27')](function(){return _0x309e46;});}else{return _0x309e46;}})[_0x4195('0x45')](function(_0x35510a){logger['error'](_0x4195('0x5a'),_0x35510a);throw _0x35510a;});}return _0x309e46;})[_0x4195('0x27')](respondWithResult(_0x4d161d,0xc9))[_0x4195('0x45')](handleError(_0x4d161d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3d42e42..ba82b46 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 _0x76d3=['api','moment','bluebird','request-promise','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x1b8fd3,_0x3b485a){var _0x4eff6f=function(_0x33a0e8){while(--_0x33a0e8){_0x1b8fd3['push'](_0x1b8fd3['shift']());}};_0x4eff6f(++_0x3b485a);}(_0x76d3,0xf5));var _0x376d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x76d3[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x376d('0x0'));var util=require('util');var logger=require(_0x376d('0x1'))(_0x376d('0x2'));var moment=require(_0x376d('0x3'));var BPromise=require(_0x376d('0x4'));var rp=require(_0x376d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x376d('0x6'));var attributes=require(_0x376d('0x7'));module[_0x376d('0x8')]=function(_0x1a2972,_0x1e01bc){return _0x1a2972[_0x376d('0x9')](_0x376d('0xa'),attributes,{'tableName':_0x376d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x376d('0xc')});}; \ No newline at end of file +var _0xd02a=['CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','exports'];(function(_0x253dad,_0x3bfafa){var _0x6c42df=function(_0x32fd1c){while(--_0x32fd1c){_0x253dad['push'](_0x253dad['shift']());}};_0x6c42df(++_0x3bfafa);}(_0xd02a,0x85));var _0xad02=function(_0x27006,_0x194c78){_0x27006=_0x27006-0x0;var _0x3d45ce=_0xd02a[_0x27006];return _0x3d45ce;};'use strict';var _=require(_0xad02('0x0'));var util=require(_0xad02('0x1'));var logger=require(_0xad02('0x2'))(_0xad02('0x3'));var moment=require('moment');var BPromise=require(_0xad02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad02('0x5'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0xad02('0x6')]=function(_0x26149d,_0x10e20e){return _0x26149d['define'](_0xad02('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad02('0x8'),'collate':_0xad02('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2dccfd7..d812ed1 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(_0x349f9d,_0x400a1d){var _0x41b842=function(_0xcbd334){while(--_0xcbd334){_0x349f9d['push'](_0x349f9d['shift']());}};_0x41b842(++_0x400a1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x3261b1,_0x130683){var _0x59790f=function(_0xddaafe){while(--_0xddaafe){_0x3261b1['push'](_0x3261b1['shift']());}};_0x59790f(++_0x130683);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 afe8f98..1de8cae 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 _0xea3f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','connect-timeout','express'];(function(_0x36152f,_0xc49443){var _0x229a8c=function(_0x5bc971){while(--_0x5bc971){_0x36152f['push'](_0x36152f['shift']());}};_0x229a8c(++_0xc49443);}(_0xea3f,0xf9));var _0xfea3=function(_0x1bc42d,_0x1b8a92){_0x1bc42d=_0x1bc42d-0x0;var _0x2a4351=_0xea3f[_0x1bc42d];return _0x2a4351;};'use strict';var multer=require(_0xfea3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfea3('0x1'));var express=require(_0xfea3('0x2'));var router=express[_0xfea3('0x3')]();var fs_extra=require(_0xfea3('0x4'));var auth=require(_0xfea3('0x5'));var interaction=require(_0xfea3('0x6'));var config=require(_0xfea3('0x7'));var controller=require(_0xfea3('0x8'));router[_0xfea3('0x9')]('/',auth[_0xfea3('0xa')](),controller[_0xfea3('0xb')]);router[_0xfea3('0x9')](_0xfea3('0xc'),auth[_0xfea3('0xa')](),controller[_0xfea3('0xd')]);router[_0xfea3('0xe')]('/',auth[_0xfea3('0xa')](),controller['create']);router[_0xfea3('0xf')](_0xfea3('0xc'),auth[_0xfea3('0xa')](),controller['update']);router[_0xfea3('0x10')](_0xfea3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfea3('0x11')]=router; \ No newline at end of file +var _0x3400=['Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x4fc684,_0x13dd50){var _0x27a8ab=function(_0x4a231a){while(--_0x4a231a){_0x4fc684['push'](_0x4fc684['shift']());}};_0x27a8ab(++_0x13dd50);}(_0x3400,0x12f));var _0x0340=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x3400[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x0340('0x0'));var util=require(_0x0340('0x1'));var path=require('path');var timeout=require(_0x0340('0x2'));var express=require('express');var router=express[_0x0340('0x3')]();var fs_extra=require(_0x0340('0x4'));var auth=require(_0x0340('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0340('0x6'));var controller=require(_0x0340('0x7'));router[_0x0340('0x8')]('/',auth['isAuthenticated'](),controller[_0x0340('0x9')]);router[_0x0340('0x8')](_0x0340('0xa'),auth[_0x0340('0xb')](),controller[_0x0340('0xc')]);router[_0x0340('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0340('0xe')](_0x0340('0xa'),auth[_0x0340('0xb')](),controller[_0x0340('0xf')]);router[_0x0340('0x10')](_0x0340('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0340('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8e5fc5a..1af4b74 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 _0xa4e9=['STRING','INTEGER','sequelize','exports'];(function(_0x2b8365,_0x49907b){var _0x3e8478=function(_0x2ec128){while(--_0x2ec128){_0x2b8365['push'](_0x2b8365['shift']());}};_0x3e8478(++_0x49907b);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x217ecd,_0x5b35da){_0x217ecd=_0x217ecd-0x0;var _0x50b480=_0xa4e9[_0x217ecd];return _0x50b480;};'use strict';var Sequelize=require(_0x9a4e('0x0'));module[_0x9a4e('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x9a4e('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x9a4e('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x9a4e('0x2')]},'lastapp':{'type':Sequelize[_0x9a4e('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9a4e('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9a4e('0x2')]},'uniqueid':{'type':Sequelize[_0x9a4e('0x2')]},'linkedid':{'type':Sequelize[_0x9a4e('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9a4e('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9a4e('0x2')]}}; \ No newline at end of file +var _0x6cd2=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x38f665,_0xbea3d0){var _0x5b99ff=function(_0x5e23dd){while(--_0x5e23dd){_0x38f665['push'](_0x38f665['shift']());}};_0x5b99ff(++_0xbea3d0);}(_0x6cd2,0x147));var _0x26cd=function(_0x2c7908,_0x40da0a){_0x2c7908=_0x2c7908-0x0;var _0x39557b=_0x6cd2[_0x2c7908];return _0x39557b;};'use strict';var Sequelize=require(_0x26cd('0x0'));module[_0x26cd('0x1')]={'calldate':{'type':Sequelize[_0x26cd('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x26cd('0x3')]},'dst':{'type':Sequelize[_0x26cd('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x26cd('0x3')]},'dstchannel':{'type':Sequelize[_0x26cd('0x3')]},'lastapp':{'type':Sequelize[_0x26cd('0x3')]},'lastdata':{'type':Sequelize[_0x26cd('0x3')]},'duration':{'type':Sequelize[_0x26cd('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x26cd('0x3')]},'amaflags':{'type':Sequelize[_0x26cd('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x26cd('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x26cd('0x3')]},'linkedid':{'type':Sequelize[_0x26cd('0x3')]},'sequence':{'type':Sequelize[_0x26cd('0x3')]},'peeraccount':{'type':Sequelize[_0x26cd('0x3')]},'type':{'type':Sequelize[_0x26cd('0x3')]},'tag':{'type':Sequelize[_0x26cd('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 54f371b..ab47f8b 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 _0x5334=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x42fc8e,_0x26620d){var _0x4ad7b5=function(_0x4b217b){while(--_0x4b217b){_0x42fc8e['push'](_0x42fc8e['shift']());}};_0x4ad7b5(++_0x26620d);}(_0x5334,0x84));var _0x4533=function(_0x31456b,_0x1609a8){_0x31456b=_0x31456b-0x0;var _0xcc072b=_0x5334[_0x31456b];return _0xcc072b;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];function respondWithStatusCode(_0x439210,_0x45ba67){_0x45ba67=_0x45ba67||0xcc;return function(_0x19b74e){if(_0x19b74e){return _0x439210['sendStatus'](_0x45ba67);}return _0x439210[_0x4533('0x16')](_0x45ba67)[_0x4533('0x17')]();};}function respondWithResult(_0x187f05,_0x18d4f0){_0x18d4f0=_0x18d4f0||0xc8;return function(_0x533a26){if(_0x533a26){return _0x187f05[_0x4533('0x16')](_0x18d4f0)['json'](_0x533a26);}};}function respondWithFilteredResult(_0x4c703c,_0x466545){return function(_0x34dea9){if(_0x34dea9){var _0x5da8b8=typeof _0x466545[_0x4533('0x18')]===_0x4533('0x19')&&typeof _0x466545[_0x4533('0x1a')]==='undefined';var _0x3ed873=_0x34dea9['count'];var _0x3ddb36=_0x5da8b8?0x0:_0x466545[_0x4533('0x18')];var _0x56ab4f=_0x5da8b8?_0x34dea9[_0x4533('0x1b')]:_0x466545['offset']+_0x466545['limit'];var _0x1c5cdd;if(_0x56ab4f>=_0x3ed873){_0x56ab4f=_0x3ed873;_0x1c5cdd=0xc8;}else{_0x1c5cdd=0xce;}_0x4c703c[_0x4533('0x16')](_0x1c5cdd);return _0x4c703c['set']('Content-Range',_0x3ddb36+'-'+_0x56ab4f+'/'+_0x3ed873)[_0x4533('0x1c')](_0x34dea9);}return null;};}function patchUpdates(_0x3b18c1){return function(_0x3467ba){try{jsonpatch[_0x4533('0x1d')](_0x3467ba,_0x3b18c1,!![]);}catch(_0x6766eb){return BPromise[_0x4533('0x1e')](_0x6766eb);}return _0x3467ba[_0x4533('0x1f')]();};}function saveUpdates(_0x5c3abb,_0x231bae){return function(_0xd55c04){if(_0xd55c04){return _0xd55c04[_0x4533('0x20')](_0x5c3abb)['then'](function(_0x513011){return _0x513011;});}return null;};}function removeEntity(_0x138fd9,_0x11e93a){return function(_0x4c640c){if(_0x4c640c){return _0x4c640c['destroy']()[_0x4533('0x21')](function(){_0x138fd9[_0x4533('0x16')](0xcc)[_0x4533('0x17')]();});}};}function handleEntityNotFound(_0x4d8189,_0x44786f){return function(_0x39b261){if(!_0x39b261){_0x4d8189[_0x4533('0x22')](0x194);}return _0x39b261;};}function handleError(_0x3fba67,_0x19ab4d){_0x19ab4d=_0x19ab4d||0x1f4;return function(_0x3fc5b0){logger[_0x4533('0x23')](_0x3fc5b0[_0x4533('0x24')]);if(_0x3fc5b0[_0x4533('0x25')]){delete _0x3fc5b0['name'];}_0x3fba67['status'](_0x19ab4d)[_0x4533('0x26')](_0x3fc5b0);};}exports['index']=function(_0x3fd76a,_0x4e2b80){var _0x159fea={},_0x42ba2d={},_0x38706b={'count':0x0,'rows':[]};var _0x4300c1=_[_0x4533('0x27')](db[_0x4533('0x28')][_0x4533('0x29')],function(_0xa58dd1){return{'name':_0xa58dd1[_0x4533('0x2a')],'type':_0xa58dd1[_0x4533('0x2b')][_0x4533('0x2c')]};});_0x42ba2d[_0x4533('0x2d')]=_[_0x4533('0x27')](_0x4300c1,'name');_0x42ba2d[_0x4533('0x2e')]=_['keys'](_0x3fd76a[_0x4533('0x2e')]);_0x42ba2d[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],_0x42ba2d[_0x4533('0x2e')]);_0x159fea[_0x4533('0x31')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],qs[_0x4533('0x32')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x32')]));_0x159fea[_0x4533('0x31')]=_0x159fea['attributes'][_0x4533('0x33')]?_0x159fea[_0x4533('0x31')]:_0x42ba2d[_0x4533('0x2d')];if(!_0x3fd76a[_0x4533('0x2e')][_0x4533('0x34')]('nolimit')){_0x159fea[_0x4533('0x1a')]=qs[_0x4533('0x1a')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x1a')]);_0x159fea[_0x4533('0x18')]=qs[_0x4533('0x18')](_0x3fd76a['query'][_0x4533('0x18')]);}_0x159fea[_0x4533('0x35')]=qs['sort'](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x36')]);_0x159fea[_0x4533('0x37')]=qs[_0x4533('0x2f')](_[_0x4533('0x38')](_0x3fd76a[_0x4533('0x2e')],_0x42ba2d[_0x4533('0x2f')]),_0x4300c1);if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]){_0x159fea[_0x4533('0x37')]=_['merge'](_0x159fea[_0x4533('0x37')],{'$or':_[_0x4533('0x27')](_0x4300c1,function(_0x296d31){if(_0x296d31[_0x4533('0x2b')]!==_0x4533('0x3a')){var _0x17af88={};_0x17af88[_0x296d31[_0x4533('0x25')]]={'$like':'%'+_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x17af88;}})});}_0x159fea=_[_0x4533('0x3b')]({},_0x159fea,_0x3fd76a[_0x4533('0x3c')]);var _0x2e49a1={'where':_0x159fea['where']};return db['Cdr'][_0x4533('0x1b')](_0x2e49a1)['then'](function(_0x4260e6){_0x38706b[_0x4533('0x1b')]=_0x4260e6;if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x3d')]){_0x159fea[_0x4533('0x3e')]=[{'all':!![]}];}return db[_0x4533('0x28')][_0x4533('0x3f')](_0x159fea);})[_0x4533('0x21')](function(_0x11bc6b){_0x38706b[_0x4533('0x40')]=_0x11bc6b;return _0x38706b;})[_0x4533('0x21')](respondWithFilteredResult(_0x4e2b80,_0x159fea))[_0x4533('0x41')](handleError(_0x4e2b80,null));};exports[_0x4533('0x42')]=function(_0x5c4a04,_0x1aaedc){var _0x556dd9={'raw':!![],'where':{'id':_0x5c4a04['params']['id']}},_0x57d7c3={};_0x57d7c3['model']=_[_0x4533('0x43')](db[_0x4533('0x28')][_0x4533('0x29')]);_0x57d7c3[_0x4533('0x2e')]=_['keys'](_0x5c4a04[_0x4533('0x2e')]);_0x57d7c3[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x57d7c3[_0x4533('0x2d')],_0x57d7c3[_0x4533('0x2e')]);_0x556dd9[_0x4533('0x31')]=_[_0x4533('0x30')](_0x57d7c3['model'],qs[_0x4533('0x32')](_0x5c4a04['query']['fields']));_0x556dd9[_0x4533('0x31')]=_0x556dd9[_0x4533('0x31')][_0x4533('0x33')]?_0x556dd9[_0x4533('0x31')]:_0x57d7c3['model'];if(_0x5c4a04['query'][_0x4533('0x3d')]){_0x556dd9['include']=[{'all':!![]}];}_0x556dd9=_[_0x4533('0x3b')]({},_0x556dd9,_0x5c4a04[_0x4533('0x3c')]);return db['Cdr']['find'](_0x556dd9)['then'](handleEntityNotFound(_0x1aaedc,null))['then'](respondWithResult(_0x1aaedc,null))['catch'](handleError(_0x1aaedc,null));};exports[_0x4533('0x44')]=function(_0x4797a3,_0x429447){return db['Cdr'][_0x4533('0x44')](_0x4797a3['body'],{})['then'](respondWithResult(_0x429447,0xc9))[_0x4533('0x41')](handleError(_0x429447,null));};exports['update']=function(_0x1394cb,_0x59e358){if(_0x1394cb[_0x4533('0x45')]['id']){delete _0x1394cb[_0x4533('0x45')]['id'];}return db['Cdr'][_0x4533('0x46')]({'where':{'id':_0x1394cb[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x59e358,null))[_0x4533('0x21')](saveUpdates(_0x1394cb[_0x4533('0x45')],null))['then'](respondWithResult(_0x59e358,null))[_0x4533('0x41')](handleError(_0x59e358,null));};exports[_0x4533('0x48')]=function(_0x5260e9,_0x2454ed){return db[_0x4533('0x28')][_0x4533('0x46')]({'where':{'id':_0x5260e9[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x2454ed,null))[_0x4533('0x21')](removeEntity(_0x2454ed,null))[_0x4533('0x41')](handleError(_0x2454ed,null));};exports[_0x4533('0x49')]=function(_0x717187,_0xc55ddf){return db[_0x4533('0x28')][_0x4533('0x49')]()[_0x4533('0x21')](respondWithResult(_0xc55ddf,null))[_0x4533('0x41')](handleError(_0xc55ddf,null));}; \ No newline at end of file +var _0xed1f=['key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','Cdr','rawAttributes','fieldName','type'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xed1f,0x6a));var _0xfed1=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xed1f[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_0x2d334e,_0xfed1('0x2a'));_0x1cec64['query']=_['keys'](_0x3106ee[_0xfed1('0x32')]);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x1cec64[_0xfed1('0x35')],_0x1cec64[_0xfed1('0x32')]);_0x53b0c9['attributes']=_[_0xfed1('0x34')](_0x1cec64[_0xfed1('0x35')],qs[_0xfed1('0x36')](_0x3106ee[_0xfed1('0x32')][_0xfed1('0x36')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')]['length']?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x35')];if(!_0x3106ee[_0xfed1('0x32')][_0xfed1('0x38')](_0xfed1('0x39'))){_0x53b0c9[_0xfed1('0x1e')]=qs[_0xfed1('0x1e')](_0x3106ee[_0xfed1('0x32')]['limit']);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee[_0xfed1('0x32')][_0xfed1('0x1d')]);}_0x53b0c9['order']=qs['sort'](_0x3106ee[_0xfed1('0x32')][_0xfed1('0x3a')]);_0x53b0c9[_0xfed1('0x3b')]=qs[_0xfed1('0x33')](_[_0xfed1('0x3c')](_0x3106ee[_0xfed1('0x32')],_0x1cec64[_0xfed1('0x33')]),_0x2d334e);if(_0x3106ee[_0xfed1('0x32')]['filter']){_0x53b0c9['where']=_[_0xfed1('0x3d')](_0x53b0c9[_0xfed1('0x3b')],{'$or':_['map'](_0x2d334e,function(_0x1dae7c){if(_0x1dae7c[_0xfed1('0x2f')]!==_0xfed1('0x3e')){var _0x421620={};_0x421620[_0x1dae7c[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x32')][_0xfed1('0x3f')]+'%'};return _0x421620;}})});}_0x53b0c9=_[_0xfed1('0x3d')]({},_0x53b0c9,_0x3106ee[_0xfed1('0x40')]);var _0x5f3e1f={'where':_0x53b0c9['where']};return db['Cdr'][_0xfed1('0x20')](_0x5f3e1f)[_0xfed1('0x25')](function(_0x2f8f08){_0x42c950['count']=_0x2f8f08;if(_0x3106ee[_0xfed1('0x32')]['includeAll']){_0x53b0c9[_0xfed1('0x41')]=[{'all':!![]}];}return db[_0xfed1('0x2c')][_0xfed1('0x42')](_0x53b0c9);})['then'](function(_0x20bdae){_0x42c950[_0xfed1('0x43')]=_0x20bdae;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x44')]=function(_0x545f22,_0x256b1d){var _0xf1f739={'raw':!![],'where':{'id':_0x545f22[_0xfed1('0x45')]['id']}},_0x229fc7={};_0x229fc7[_0xfed1('0x35')]=_[_0xfed1('0x46')](db[_0xfed1('0x2c')][_0xfed1('0x2d')]);_0x229fc7[_0xfed1('0x32')]=_['keys'](_0x545f22[_0xfed1('0x32')]);_0x229fc7[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x229fc7['model'],_0x229fc7['query']);_0xf1f739[_0xfed1('0x37')]=_[_0xfed1('0x34')](_0x229fc7[_0xfed1('0x35')],qs[_0xfed1('0x36')](_0x545f22[_0xfed1('0x32')][_0xfed1('0x36')]));_0xf1f739[_0xfed1('0x37')]=_0xf1f739[_0xfed1('0x37')][_0xfed1('0x47')]?_0xf1f739[_0xfed1('0x37')]:_0x229fc7[_0xfed1('0x35')];if(_0x545f22[_0xfed1('0x32')]['includeAll']){_0xf1f739[_0xfed1('0x41')]=[{'all':!![]}];}_0xf1f739=_[_0xfed1('0x3d')]({},_0xf1f739,_0x545f22[_0xfed1('0x40')]);return db[_0xfed1('0x2c')][_0xfed1('0x48')](_0xf1f739)[_0xfed1('0x25')](handleEntityNotFound(_0x256b1d,null))['then'](respondWithResult(_0x256b1d,null))[_0xfed1('0x49')](handleError(_0x256b1d,null));};exports[_0xfed1('0x4a')]=function(_0x35e83d,_0x4afcc1){return db[_0xfed1('0x2c')][_0xfed1('0x4a')](_0x35e83d[_0xfed1('0x4b')],{})[_0xfed1('0x25')](respondWithResult(_0x4afcc1,0xc9))['catch'](handleError(_0x4afcc1,null));};exports[_0xfed1('0x24')]=function(_0x2a346e,_0x2c32af){if(_0x2a346e[_0xfed1('0x4b')]['id']){delete _0x2a346e[_0xfed1('0x4b')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x48')]({'where':{'id':_0x2a346e[_0xfed1('0x45')]['id']}})[_0xfed1('0x25')](handleEntityNotFound(_0x2c32af,null))[_0xfed1('0x25')](saveUpdates(_0x2a346e[_0xfed1('0x4b')],null))[_0xfed1('0x25')](respondWithResult(_0x2c32af,null))[_0xfed1('0x49')](handleError(_0x2c32af,null));};exports[_0xfed1('0x26')]=function(_0x33c77a,_0x37418b){return db[_0xfed1('0x2c')][_0xfed1('0x48')]({'where':{'id':_0x33c77a['params']['id']}})['then'](handleEntityNotFound(_0x37418b,null))[_0xfed1('0x25')](removeEntity(_0x37418b,null))[_0xfed1('0x49')](handleError(_0x37418b,null));};exports[_0xfed1('0x4c')]=function(_0x1358c1,_0x5da599){return db[_0xfed1('0x2c')][_0xfed1('0x4c')]()['then'](respondWithResult(_0x5da599,null))['catch'](handleError(_0x5da599,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c95018b..c5d0c04 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x135161,_0x568a03){var _0x217277=function(_0x12194d){while(--_0x12194d){_0x135161['push'](_0x135161['shift']());}};_0x217277(++_0x568a03);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1f9fce,_0x2885d1){var _0xf8f0d=function(_0x1e1893){while(--_0x1e1893){_0x1f9fce['push'](_0x1f9fce['shift']());}};_0xf8f0d(++_0x2885d1);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 0674938..208aac9 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 _0x4876=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3dd863,_0x71a1a5){var _0x265acc=function(_0x3a2be3){while(--_0x3a2be3){_0x3dd863['push'](_0x3dd863['shift']());}};_0x265acc(++_0x71a1a5);}(_0x4876,0xa6));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6487('0x0'));var util=require(_0x6487('0x1'));var moment=require(_0x6487('0x2'));var BPromise=require(_0x6487('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6487('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6487('0x5'));var logger=require(_0x6487('0x6'))('rpc');var config=require(_0x6487('0x7'));var jayson=require(_0x6487('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4bc7,_0x5e3460,_0x45f4d4){return new BPromise(function(_0x2a3040,_0x5c64d6){return client[_0x6487('0x9')](_0x4d4bc7,_0x45f4d4)['then'](function(_0x30a061){logger[_0x6487('0xa')](_0x6487('0xb'),_0x5e3460,'request\x20sent');logger[_0x6487('0xc')](_0x6487('0xd'),_0x5e3460,_0x6487('0xe'),JSON['stringify'](_0x30a061));if(_0x30a061[_0x6487('0xf')]){if(_0x30a061[_0x6487('0xf')]['code']===0x1f4){logger[_0x6487('0xf')](_0x6487('0xb'),_0x5e3460,_0x30a061[_0x6487('0xf')][_0x6487('0x10')]);return _0x5c64d6(_0x30a061[_0x6487('0xf')]['message']);}logger[_0x6487('0xf')](_0x6487('0xb'),_0x5e3460,_0x30a061[_0x6487('0xf')][_0x6487('0x10')]);return _0x2a3040(_0x30a061[_0x6487('0xf')][_0x6487('0x10')]);}else{logger[_0x6487('0xa')](_0x6487('0xb'),_0x5e3460,_0x6487('0xe'));_0x2a3040(_0x30a061[_0x6487('0x11')][_0x6487('0x10')]);}})[_0x6487('0x12')](function(_0x2ea3d0){logger['error'](_0x6487('0xb'),_0x5e3460,_0x2ea3d0);_0x5c64d6(_0x2ea3d0);});});} \ No newline at end of file +var _0x4474=['error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x46b101,_0x5bde7f){var _0x1f267a=function(_0x254bc1){while(--_0x254bc1){_0x46b101['push'](_0x46b101['shift']());}};_0x1f267a(++_0x5bde7f);}(_0x4474,0x1a1));var _0x4447=function(_0x40b7fc,_0x51c685){_0x40b7fc=_0x40b7fc-0x0;var _0xe7387a=_0x4474[_0x40b7fc];return _0xe7387a;};'use strict';var _=require(_0x4447('0x0'));var util=require(_0x4447('0x1'));var moment=require(_0x4447('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4447('0x3'));var db=require(_0x4447('0x4'))['db'];var utils=require(_0x4447('0x5'));var logger=require(_0x4447('0x6'))(_0x4447('0x7'));var config=require(_0x4447('0x8'));var jayson=require(_0x4447('0x9'));var client=jayson[_0x4447('0xa')][_0x4447('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b499b,_0xedac73,_0x2e7ad6){return new BPromise(function(_0x471672,_0x73ce61){return client['request'](_0x5b499b,_0x2e7ad6)[_0x4447('0xc')](function(_0x16430d){logger[_0x4447('0xd')](_0x4447('0xe'),_0xedac73,_0x4447('0xf'));logger[_0x4447('0x10')](_0x4447('0x11'),_0xedac73,'request\x20sent',JSON[_0x4447('0x12')](_0x16430d));if(_0x16430d['error']){if(_0x16430d['error'][_0x4447('0x13')]===0x1f4){logger[_0x4447('0x14')](_0x4447('0xe'),_0xedac73,_0x16430d['error'][_0x4447('0x15')]);return _0x73ce61(_0x16430d['error'][_0x4447('0x15')]);}logger[_0x4447('0x14')](_0x4447('0xe'),_0xedac73,_0x16430d[_0x4447('0x14')]['message']);return _0x471672(_0x16430d[_0x4447('0x14')][_0x4447('0x15')]);}else{logger[_0x4447('0xd')]('Cdr,\x20%s,\x20%s',_0xedac73,'request\x20sent');_0x471672(_0x16430d['result'][_0x4447('0x15')]);}})[_0x4447('0x16')](function(_0x51add9){logger[_0x4447('0x14')](_0x4447('0xe'),_0xedac73,_0x51add9);_0x73ce61(_0x51add9);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ea4b5fc..db7bdc3 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x12dc2b,_0x884fe0){var _0x495e38=function(_0x1b9bd6){while(--_0x1b9bd6){_0x12dc2b['push'](_0x12dc2b['shift']());}};_0x495e38(++_0x884fe0);}(_0xb10b,0x12a));var _0xbb10=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xb10b[_0x2af053];return _0x4b4001;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x231d86,_0x5ecbdb){var _0x1669d1=function(_0x34b273){while(--_0x34b273){_0x231d86['push'](_0x231d86['shift']());}};_0x1669d1(++_0x5ecbdb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0xb10b[_0x3ba566];return _0x480317;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 978d92d..2061c68 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 _0xefad=['*,*,*,*','exports','TEXT','STRING'];(function(_0x48ef0b,_0x1b44d6){var _0x57ec68=function(_0xf76492){while(--_0xf76492){_0x48ef0b['push'](_0x48ef0b['shift']());}};_0x57ec68(++_0x1b44d6);}(_0xefad,0x1ed));var _0xdefa=function(_0xef4c2,_0x29f60e){_0xef4c2=_0xef4c2-0x0;var _0x34f86c=_0xefad[_0xef4c2];return _0x34f86c;};'use strict';var Sequelize=require('sequelize');module[_0xdefa('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdefa('0x1')]()},'description':{'type':Sequelize[_0xdefa('0x2')]},'interval':{'type':Sequelize[_0xdefa('0x2')],'defaultValue':_0xdefa('0x3')}}; \ No newline at end of file +var _0x2eca=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2eca,0xc5));var _0xa2ec=function(_0x4145a8,_0x55e817){_0x4145a8=_0x4145a8-0x0;var _0x155db0=_0x2eca[_0x4145a8];return _0x155db0;};'use strict';var Sequelize=require('sequelize');module[_0xa2ec('0x0')]={'priority':{'type':Sequelize[_0xa2ec('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa2ec('0x2')],'allowNull':![],'defaultValue':_0xa2ec('0x3')},'appdata':{'type':Sequelize[_0xa2ec('0x4')]()},'description':{'type':Sequelize[_0xa2ec('0x2')]},'interval':{'type':Sequelize[_0xa2ec('0x2')],'defaultValue':_0xa2ec('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a45e2a0..b62a800 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 _0xa5fa=['update','then','destroy','error','name','show','params','rawAttributes','keys','query','model','attributes','intersection','fields','length','include','merge','options','ChatApplication','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x5438e3,_0x5d5c92){var _0x2af655=function(_0x25f6bb){while(--_0x25f6bb){_0x5438e3['push'](_0x5438e3['shift']());}};_0x2af655(++_0x5d5c92);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x2f8cb4,_0x2958d5){_0x2f8cb4=_0x2f8cb4-0x0;var _0x16dd55=_0xa5fa[_0x2f8cb4];return _0x16dd55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x1f66c0,_0xacbded){return function(_0x3d7bca){if(!_0x3d7bca){_0x1f66c0[_0xaa5f('0x17')](0x194);}return _0x3d7bca;};}function handleError(_0x51eb55,_0x2445a6){_0x2445a6=_0x2445a6||0x1f4;return function(_0x3a66e8){logger[_0xaa5f('0x27')](_0x3a66e8['stack']);if(_0x3a66e8[_0xaa5f('0x28')]){delete _0x3a66e8[_0xaa5f('0x28')];}_0x51eb55[_0xaa5f('0x19')](_0x2445a6)['send'](_0x3a66e8);};}exports[_0xaa5f('0x29')]=function(_0x479f29,_0x5990d2){var _0x27d1a4={'raw':!![],'where':{'id':_0x479f29[_0xaa5f('0x2a')]['id']}},_0x50998f={};_0x50998f['model']=_['keys'](db['ChatApplication'][_0xaa5f('0x2b')]);_0x50998f['query']=_[_0xaa5f('0x2c')](_0x479f29[_0xaa5f('0x2d')]);_0x50998f['filters']=_['intersection'](_0x50998f[_0xaa5f('0x2e')],_0x50998f['query']);_0x27d1a4[_0xaa5f('0x2f')]=_[_0xaa5f('0x30')](_0x50998f['model'],qs[_0xaa5f('0x31')](_0x479f29[_0xaa5f('0x2d')][_0xaa5f('0x31')]));_0x27d1a4['attributes']=_0x27d1a4[_0xaa5f('0x2f')][_0xaa5f('0x32')]?_0x27d1a4['attributes']:_0x50998f['model'];if(_0x479f29['query']['includeAll']){_0x27d1a4[_0xaa5f('0x33')]=[{'all':!![]}];}_0x27d1a4=_[_0xaa5f('0x34')]({},_0x27d1a4,_0x479f29[_0xaa5f('0x35')]);return db[_0xaa5f('0x36')][_0xaa5f('0x37')](_0x27d1a4)[_0xaa5f('0x25')](handleEntityNotFound(_0x5990d2,null))[_0xaa5f('0x25')](respondWithResult(_0x5990d2,null))['catch'](handleError(_0x5990d2,null));};exports[_0xaa5f('0x24')]=function(_0x32a678,_0x440845){if(_0x32a678[_0xaa5f('0x38')]['id']){delete _0x32a678[_0xaa5f('0x38')]['id'];}return db[_0xaa5f('0x36')]['find']({'where':{'id':_0x32a678[_0xaa5f('0x2a')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x440845,null))[_0xaa5f('0x25')](saveUpdates(_0x32a678[_0xaa5f('0x38')],null))[_0xaa5f('0x25')](respondWithResult(_0x440845,null))['catch'](handleError(_0x440845,null));};exports['destroy']=function(_0x43126e,_0x40bc33){return db[_0xaa5f('0x36')][_0xaa5f('0x37')]({'where':{'id':_0x43126e['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x40bc33,null))[_0xaa5f('0x25')](removeEntity(_0x40bc33,null))[_0xaa5f('0x39')](handleError(_0x40bc33,null));}; \ No newline at end of file +var _0xb48d=['stack','name','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error'];(function(_0x2b0a08,_0x322d00){var _0x412dcf=function(_0x3c9969){while(--_0x3c9969){_0x2b0a08['push'](_0x2b0a08['shift']());}};_0x412dcf(++_0x322d00);}(_0xb48d,0x194));var _0xdb48=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb48d[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xdb48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb48('0x2'));var moment=require(_0xdb48('0x3'));var BPromise=require(_0xdb48('0x4'));var Mustache=require(_0xdb48('0x5'));var util=require('util');var path=require(_0xdb48('0x6'));var sox=require('sox');var csv=require(_0xdb48('0x7'));var ejs=require(_0xdb48('0x8'));var fs=require('fs');var fs_extra=require(_0xdb48('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb48('0xa'));var jsforce=require(_0xdb48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb48('0x7'));var querystring=require(_0xdb48('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb48('0xd'));var authService=require(_0xdb48('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb48('0xf'));var logger=require(_0xdb48('0x10'))(_0xdb48('0x11'));var utils=require('../../config/utils');var config=require(_0xdb48('0x12'));var licenseUtil=require(_0xdb48('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa4906,_0x3cbfee){_0x3cbfee=_0x3cbfee||0xcc;return function(_0x41e006){if(_0x41e006){return _0xaa4906[_0xdb48('0x14')](_0x3cbfee);}return _0xaa4906[_0xdb48('0x15')](_0x3cbfee)[_0xdb48('0x16')]();};}function respondWithResult(_0x5ebbdd,_0x43df86){_0x43df86=_0x43df86||0xc8;return function(_0x142eaf){if(_0x142eaf){return _0x5ebbdd[_0xdb48('0x15')](_0x43df86)['json'](_0x142eaf);}};}function respondWithFilteredResult(_0x28412d,_0x518dac){return function(_0x453d6b){if(_0x453d6b){var _0x3180d7=typeof _0x518dac[_0xdb48('0x17')]===_0xdb48('0x18')&&typeof _0x518dac[_0xdb48('0x19')]==='undefined';var _0x488997=_0x453d6b[_0xdb48('0x1a')];var _0x38099a=_0x3180d7?0x0:_0x518dac['offset'];var _0x3f98b0=_0x3180d7?_0x453d6b[_0xdb48('0x1a')]:_0x518dac['offset']+_0x518dac['limit'];var _0x1432a9;if(_0x3f98b0>=_0x488997){_0x3f98b0=_0x488997;_0x1432a9=0xc8;}else{_0x1432a9=0xce;}_0x28412d[_0xdb48('0x15')](_0x1432a9);return _0x28412d[_0xdb48('0x1b')]('Content-Range',_0x38099a+'-'+_0x3f98b0+'/'+_0x488997)[_0xdb48('0x1c')](_0x453d6b);}return null;};}function patchUpdates(_0x3d1b69){return function(_0x58604e){try{jsonpatch[_0xdb48('0x1d')](_0x58604e,_0x3d1b69,!![]);}catch(_0x3fb75a){return BPromise[_0xdb48('0x1e')](_0x3fb75a);}return _0x58604e[_0xdb48('0x1f')]();};}function saveUpdates(_0x3921d8,_0x5e63b3){return function(_0x2746c4){if(_0x2746c4){return _0x2746c4[_0xdb48('0x20')](_0x3921d8)[_0xdb48('0x21')](function(_0x5a33a0){return _0x5a33a0;});}return null;};}function removeEntity(_0x5aedc1,_0x52c046){return function(_0x3ad23a){if(_0x3ad23a){return _0x3ad23a[_0xdb48('0x22')]()[_0xdb48('0x21')](function(){_0x5aedc1['status'](0xcc)[_0xdb48('0x16')]();});}};}function handleEntityNotFound(_0x4d29d1,_0x3b3344){return function(_0x3a5bdd){if(!_0x3a5bdd){_0x4d29d1[_0xdb48('0x14')](0x194);}return _0x3a5bdd;};}function handleError(_0x531a2a,_0x483940){_0x483940=_0x483940||0x1f4;return function(_0x139139){logger[_0xdb48('0x23')](_0x139139[_0xdb48('0x24')]);if(_0x139139['name']){delete _0x139139[_0xdb48('0x25')];}_0x531a2a[_0xdb48('0x15')](_0x483940)['send'](_0x139139);};}exports['show']=function(_0x31edb6,_0x2cdfa4){var _0x2adb1e={'raw':!![],'where':{'id':_0x31edb6['params']['id']}},_0x2f55c6={};_0x2f55c6[_0xdb48('0x26')]=_[_0xdb48('0x27')](db[_0xdb48('0x28')]['rawAttributes']);_0x2f55c6[_0xdb48('0x29')]=_[_0xdb48('0x27')](_0x31edb6[_0xdb48('0x29')]);_0x2f55c6[_0xdb48('0x2a')]=_[_0xdb48('0x2b')](_0x2f55c6[_0xdb48('0x26')],_0x2f55c6['query']);_0x2adb1e[_0xdb48('0x2c')]=_[_0xdb48('0x2b')](_0x2f55c6[_0xdb48('0x26')],qs[_0xdb48('0x2d')](_0x31edb6[_0xdb48('0x29')][_0xdb48('0x2d')]));_0x2adb1e['attributes']=_0x2adb1e['attributes'][_0xdb48('0x2e')]?_0x2adb1e[_0xdb48('0x2c')]:_0x2f55c6[_0xdb48('0x26')];if(_0x31edb6[_0xdb48('0x29')][_0xdb48('0x2f')]){_0x2adb1e[_0xdb48('0x30')]=[{'all':!![]}];}_0x2adb1e=_[_0xdb48('0x31')]({},_0x2adb1e,_0x31edb6[_0xdb48('0x32')]);return db[_0xdb48('0x28')]['find'](_0x2adb1e)[_0xdb48('0x21')](handleEntityNotFound(_0x2cdfa4,null))[_0xdb48('0x21')](respondWithResult(_0x2cdfa4,null))[_0xdb48('0x33')](handleError(_0x2cdfa4,null));};exports[_0xdb48('0x20')]=function(_0x4cddf2,_0x4d05d0){if(_0x4cddf2[_0xdb48('0x34')]['id']){delete _0x4cddf2[_0xdb48('0x34')]['id'];}return db[_0xdb48('0x28')][_0xdb48('0x35')]({'where':{'id':_0x4cddf2[_0xdb48('0x36')]['id']}})[_0xdb48('0x21')](handleEntityNotFound(_0x4d05d0,null))[_0xdb48('0x21')](saveUpdates(_0x4cddf2[_0xdb48('0x34')],null))['then'](respondWithResult(_0x4d05d0,null))['catch'](handleError(_0x4d05d0,null));};exports[_0xdb48('0x22')]=function(_0x484cb2,_0x17e3d9){return db[_0xdb48('0x28')][_0xdb48('0x35')]({'where':{'id':_0x484cb2[_0xdb48('0x36')]['id']}})[_0xdb48('0x21')](handleEntityNotFound(_0x17e3d9,null))[_0xdb48('0x21')](removeEntity(_0x17e3d9,null))[_0xdb48('0x33')](handleError(_0x17e3d9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f430947..dcb30a4 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 _0x19b3=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','path'];(function(_0xfb8ccf,_0x564bec){var _0x48859e=function(_0x3d3755){while(--_0x3d3755){_0xfb8ccf['push'](_0xfb8ccf['shift']());}};_0x48859e(++_0x564bec);}(_0x19b3,0x194));var _0x319b=function(_0x5a1d97,_0x265b5a){_0x5a1d97=_0x5a1d97-0x0;var _0x401646=_0x19b3[_0x5a1d97];return _0x401646;};'use strict';var _=require('lodash');var util=require(_0x319b('0x0'));var logger=require(_0x319b('0x1'))('api');var moment=require(_0x319b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x319b('0x3'));var rimraf=require(_0x319b('0x4'));var config=require(_0x319b('0x5'));var attributes=require(_0x319b('0x6'));module[_0x319b('0x7')]=function(_0x23d053,_0x1afe5d){return _0x23d053[_0x319b('0x8')](_0x319b('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x319b('0xa'),'collate':_0x319b('0xb')});}; \ No newline at end of file +var _0xa921=['request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xa921,0x181));var _0x1a92=function(_0x27f596,_0xf08e3d){_0x27f596=_0x27f596-0x0;var _0x54047a=_0xa921[_0x27f596];return _0x54047a;};'use strict';var _=require(_0x1a92('0x0'));var util=require('util');var logger=require(_0x1a92('0x1'))(_0x1a92('0x2'));var moment=require(_0x1a92('0x3'));var BPromise=require(_0x1a92('0x4'));var rp=require(_0x1a92('0x5'));var fs=require('fs');var path=require(_0x1a92('0x6'));var rimraf=require(_0x1a92('0x7'));var config=require(_0x1a92('0x8'));var attributes=require('./chatApplication.attributes');module[_0x1a92('0x9')]=function(_0x5bc85d,_0x47b1fe){return _0x5bc85d[_0x1a92('0xa')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a92('0xb'),'collate':_0x1a92('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0a042bc..117d642 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 _0xad08=['client','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x171f3c,_0x2ebf36){var _0xf71494=function(_0x5e2304){while(--_0x5e2304){_0x171f3c['push'](_0x171f3c['shift']());}};_0xf71494(++_0x2ebf36);}(_0xad08,0x100));var _0x8ad0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xad08[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ad0('0x2'));var db=require(_0x8ad0('0x3'))['db'];var utils=require(_0x8ad0('0x4'));var logger=require(_0x8ad0('0x5'))(_0x8ad0('0x6'));var config=require('../../config/environment');var jayson=require(_0x8ad0('0x7'));var client=jayson[_0x8ad0('0x8')][_0x8ad0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e2df,_0x305f10,_0x291eff){return new BPromise(function(_0x333459,_0x535e97){return client[_0x8ad0('0xa')](_0x37e2df,_0x291eff)['then'](function(_0x221a23){logger[_0x8ad0('0xb')](_0x8ad0('0xc'),_0x305f10,'request\x20sent');logger[_0x8ad0('0xd')](_0x8ad0('0xe'),_0x305f10,_0x8ad0('0xf'),JSON[_0x8ad0('0x10')](_0x221a23));if(_0x221a23[_0x8ad0('0x11')]){if(_0x221a23['error'][_0x8ad0('0x12')]===0x1f4){logger[_0x8ad0('0x11')](_0x8ad0('0xc'),_0x305f10,_0x221a23[_0x8ad0('0x11')][_0x8ad0('0x13')]);return _0x535e97(_0x221a23[_0x8ad0('0x11')][_0x8ad0('0x13')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x305f10,_0x221a23[_0x8ad0('0x11')][_0x8ad0('0x13')]);return _0x333459(_0x221a23[_0x8ad0('0x11')][_0x8ad0('0x13')]);}else{logger['info'](_0x8ad0('0xc'),_0x305f10,'request\x20sent');_0x333459(_0x221a23[_0x8ad0('0x14')][_0x8ad0('0x13')]);}})[_0x8ad0('0x15')](function(_0x13a28c){logger[_0x8ad0('0x11')](_0x8ad0('0xc'),_0x305f10,_0x13a28c);_0x535e97(_0x13a28c);});});} \ No newline at end of file +var _0x880f=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x880f,0x14b));var _0xf880=function(_0x1bd087,_0x25ed41){_0x1bd087=_0x1bd087-0x0;var _0x4a23a9=_0x880f[_0x1bd087];return _0x4a23a9;};'use strict';var _=require('lodash');var util=require(_0xf880('0x0'));var moment=require('moment');var BPromise=require(_0xf880('0x1'));var rs=require(_0xf880('0x2'));var fs=require('fs');var Redis=require(_0xf880('0x3'));var db=require(_0xf880('0x4'))['db'];var utils=require(_0xf880('0x5'));var logger=require(_0xf880('0x6'))('rpc');var config=require(_0xf880('0x7'));var jayson=require(_0xf880('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32ecb8,_0x3ff0c9,_0x50e7cb){return new BPromise(function(_0x369a4b,_0x11da9d){return client[_0xf880('0x9')](_0x32ecb8,_0x50e7cb)[_0xf880('0xa')](function(_0x1cc94b){logger['info']('ChatApplication,\x20%s,\x20%s',_0x3ff0c9,_0xf880('0xb'));logger[_0xf880('0xc')](_0xf880('0xd'),_0x3ff0c9,_0xf880('0xb'),JSON[_0xf880('0xe')](_0x1cc94b));if(_0x1cc94b[_0xf880('0xf')]){if(_0x1cc94b[_0xf880('0xf')][_0xf880('0x10')]===0x1f4){logger['error'](_0xf880('0x11'),_0x3ff0c9,_0x1cc94b['error'][_0xf880('0x12')]);return _0x11da9d(_0x1cc94b['error'][_0xf880('0x12')]);}logger[_0xf880('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3ff0c9,_0x1cc94b[_0xf880('0xf')]['message']);return _0x369a4b(_0x1cc94b[_0xf880('0xf')]['message']);}else{logger[_0xf880('0x13')]('ChatApplication,\x20%s,\x20%s',_0x3ff0c9,_0xf880('0xb'));_0x369a4b(_0x1cc94b[_0xf880('0x14')][_0xf880('0x12')]);}})[_0xf880('0x15')](function(_0x152fee){logger[_0xf880('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3ff0c9,_0x152fee);_0x11da9d(_0x152fee);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 712e0ed..447e4eb 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 _0x555e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','delete','isAuthenticated','destroy','exports','multer','util','express','Router'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x555e,0x12c));var _0xe555=function(_0x20a021,_0x22dee9){_0x20a021=_0x20a021-0x0;var _0x3c9bc8=_0x555e[_0x20a021];return _0x3c9bc8;};'use strict';var multer=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe555('0x2'));var router=express[_0xe555('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe555('0x4'));var interaction=require(_0xe555('0x5'));var config=require(_0xe555('0x6'));var controller=require(_0xe555('0x7'));router[_0xe555('0x8')](_0xe555('0x9'),auth['isAuthenticated'](),controller[_0xe555('0xa')]);router[_0xe555('0xb')](_0xe555('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xe555('0xc')](_0xe555('0x9'),auth[_0xe555('0xd')](),controller[_0xe555('0xe')]);module[_0xe555('0xf')]=router; \ No newline at end of file +var _0xb697=['../../config/environment','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x36a3ad,_0x3f3b31){var _0x170b20=function(_0x4fc6b5){while(--_0x4fc6b5){_0x36a3ad['push'](_0x36a3ad['shift']());}};_0x170b20(++_0x3f3b31);}(_0xb697,0x1b2));var _0x7b69=function(_0xe27ec6,_0x342218){_0xe27ec6=_0xe27ec6-0x0;var _0x810801=_0xb697[_0xe27ec6];return _0x810801;};'use strict';var multer=require(_0x7b69('0x0'));var util=require(_0x7b69('0x1'));var path=require(_0x7b69('0x2'));var timeout=require(_0x7b69('0x3'));var express=require(_0x7b69('0x4'));var router=express[_0x7b69('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7b69('0x6'));var interaction=require(_0x7b69('0x7'));var config=require(_0x7b69('0x8'));var controller=require('./chatApplication.controller');router[_0x7b69('0x9')]('/:id',auth[_0x7b69('0xa')](),controller[_0x7b69('0xb')]);router[_0x7b69('0xc')](_0x7b69('0xd'),auth[_0x7b69('0xa')](),controller[_0x7b69('0xe')]);router['delete'](_0x7b69('0xd'),auth['isAuthenticated'](),controller[_0x7b69('0xf')]);module[_0x7b69('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 953fa15..ffcb87a 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 _0xd600=['STRING','BOOLEAN','exports'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0xd600,0x1d6));var _0x0d60=function(_0x44eef4,_0x4961a2){_0x44eef4=_0x44eef4-0x0;var _0x378228=_0xd600[_0x44eef4];return _0x378228;};'use strict';var Sequelize=require('sequelize');module[_0x0d60('0x0')]={'name':{'type':Sequelize[_0x0d60('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0d60('0x1')]},'write':{'type':Sequelize[_0x0d60('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x20b6=['exports','STRING','BOOLEAN','sequelize'];(function(_0x11dc5c,_0x50a40c){var _0x80bf74=function(_0x126649){while(--_0x126649){_0x11dc5c['push'](_0x11dc5c['shift']());}};_0x80bf74(++_0x50a40c);}(_0x20b6,0x1ab));var _0x620b=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x20b6[_0x2aee2f];return _0x19337f;};'use strict';var Sequelize=require(_0x620b('0x0'));module[_0x620b('0x1')]={'name':{'type':Sequelize[_0x620b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x620b('0x2')]},'write':{'type':Sequelize[_0x620b('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 bfa9cba..5ba5670 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 _0x74a0=['../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','map','ChatGroup','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','getMembers','addMessage','getMessages','$gte','split','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x74a0,0xa9));var _0x074a=function(_0x558686,_0x48c7b9){_0x558686=_0x558686-0x0;var _0x539645=_0x74a0[_0x558686];return _0x539645;};'use strict';var emlformat=require(_0x074a('0x0'));var rimraf=require(_0x074a('0x1'));var zipdir=require(_0x074a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x074a('0x3'));var moment=require(_0x074a('0x4'));var BPromise=require(_0x074a('0x5'));var Mustache=require(_0x074a('0x6'));var util=require(_0x074a('0x7'));var path=require(_0x074a('0x8'));var sox=require(_0x074a('0x9'));var csv=require(_0x074a('0xa'));var ejs=require(_0x074a('0xb'));var fs=require('fs');var fs_extra=require(_0x074a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x074a('0xd'));var jsforce=require(_0x074a('0xe'));var deskjs=require(_0x074a('0xf'));var toCsv=require(_0x074a('0xa'));var querystring=require(_0x074a('0x10'));var Papa=require(_0x074a('0x11'));var Redis=require('ioredis');var authService=require(_0x074a('0x12'));var qs=require(_0x074a('0x13'));var as=require(_0x074a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x074a('0x15'))(_0x074a('0x16'));var utils=require(_0x074a('0x17'));var config=require(_0x074a('0x18'));var licenseUtil=require(_0x074a('0x19'));var db=require(_0x074a('0x1a'))['db'];config[_0x074a('0x1b')]=_[_0x074a('0x1c')](config[_0x074a('0x1b')],{'host':_0x074a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x074a('0x1b')]));require(_0x074a('0x1e'))[_0x074a('0x1f')](socket);function respondWithStatusCode(_0x1b6cd4,_0x420d34){_0x420d34=_0x420d34||0xcc;return function(_0x4202be){if(_0x4202be){return _0x1b6cd4[_0x074a('0x20')](_0x420d34);}return _0x1b6cd4[_0x074a('0x21')](_0x420d34)[_0x074a('0x22')]();};}function respondWithResult(_0x3de880,_0x27b805){_0x27b805=_0x27b805||0xc8;return function(_0x1cd8d8){if(_0x1cd8d8){return _0x3de880[_0x074a('0x21')](_0x27b805)['json'](_0x1cd8d8);}};}function respondWithFilteredResult(_0x3dd104,_0x59ce13){return function(_0x1df16e){if(_0x1df16e){var _0x13de8c=typeof _0x59ce13['offset']===_0x074a('0x23')&&typeof _0x59ce13['limit']===_0x074a('0x23');var _0xae9118=_0x1df16e['count'];var _0x159f30=_0x13de8c?0x0:_0x59ce13[_0x074a('0x24')];var _0x51ada4=_0x13de8c?_0x1df16e[_0x074a('0x25')]:_0x59ce13[_0x074a('0x24')]+_0x59ce13[_0x074a('0x26')];var _0x59dd29;if(_0x51ada4>=_0xae9118){_0x51ada4=_0xae9118;_0x59dd29=0xc8;}else{_0x59dd29=0xce;}_0x3dd104[_0x074a('0x21')](_0x59dd29);return _0x3dd104[_0x074a('0x27')](_0x074a('0x28'),_0x159f30+'-'+_0x51ada4+'/'+_0xae9118)[_0x074a('0x29')](_0x1df16e);}return null;};}function patchUpdates(_0x5b9f40){return function(_0x181632){try{jsonpatch[_0x074a('0x2a')](_0x181632,_0x5b9f40,!![]);}catch(_0x508e51){return BPromise[_0x074a('0x2b')](_0x508e51);}return _0x181632[_0x074a('0x2c')]();};}function saveUpdates(_0x8d96d5,_0x122461){return function(_0x2ffd1e){if(_0x2ffd1e){return _0x2ffd1e[_0x074a('0x2d')](_0x8d96d5)[_0x074a('0x2e')](function(_0x3696e0){return _0x3696e0;});}return null;};}function removeEntity(_0x5518b1,_0x3a2ecc){return function(_0x349d0d){if(_0x349d0d){return _0x349d0d[_0x074a('0x2f')]()[_0x074a('0x2e')](function(){_0x5518b1[_0x074a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x337f65,_0x1c693c){return function(_0xe18477){if(!_0xe18477){_0x337f65[_0x074a('0x20')](0x194);}return _0xe18477;};}function handleError(_0x182500,_0x96d39e){_0x96d39e=_0x96d39e||0x1f4;return function(_0x3fe3e9){logger[_0x074a('0x30')](_0x3fe3e9[_0x074a('0x31')]);if(_0x3fe3e9['name']){delete _0x3fe3e9['name'];}_0x182500[_0x074a('0x21')](_0x96d39e)[_0x074a('0x32')](_0x3fe3e9);};}exports['index']=function(_0x3b8e6e,_0x99b86a){var _0x458c5f={},_0x2ea4b0={},_0x423c3a={'count':0x0,'rows':[]};var _0xb2229b=_[_0x074a('0x33')](db[_0x074a('0x34')][_0x074a('0x35')],function(_0x3a1009){return{'name':_0x3a1009['fieldName'],'type':_0x3a1009['type']['key']};});_0x2ea4b0[_0x074a('0x36')]=_[_0x074a('0x33')](_0xb2229b,'name');_0x2ea4b0[_0x074a('0x37')]=_[_0x074a('0x38')](_0x3b8e6e[_0x074a('0x37')]);_0x2ea4b0[_0x074a('0x39')]=_[_0x074a('0x3a')](_0x2ea4b0['model'],_0x2ea4b0[_0x074a('0x37')]);_0x458c5f[_0x074a('0x3b')]=_['intersection'](_0x2ea4b0[_0x074a('0x36')],qs[_0x074a('0x3c')](_0x3b8e6e[_0x074a('0x37')][_0x074a('0x3c')]));_0x458c5f['attributes']=_0x458c5f[_0x074a('0x3b')][_0x074a('0x3d')]?_0x458c5f[_0x074a('0x3b')]:_0x2ea4b0[_0x074a('0x36')];if(!_0x3b8e6e[_0x074a('0x37')][_0x074a('0x3e')](_0x074a('0x3f'))){_0x458c5f[_0x074a('0x26')]=qs[_0x074a('0x26')](_0x3b8e6e[_0x074a('0x37')]['limit']);_0x458c5f[_0x074a('0x24')]=qs[_0x074a('0x24')](_0x3b8e6e[_0x074a('0x37')][_0x074a('0x24')]);}_0x458c5f[_0x074a('0x40')]=qs[_0x074a('0x41')](_0x3b8e6e[_0x074a('0x37')][_0x074a('0x41')]);_0x458c5f[_0x074a('0x42')]=qs[_0x074a('0x39')](_[_0x074a('0x43')](_0x3b8e6e[_0x074a('0x37')],_0x2ea4b0[_0x074a('0x39')]),_0xb2229b);if(_0x3b8e6e['query'][_0x074a('0x44')]){_0x458c5f['where']=_[_0x074a('0x45')](_0x458c5f[_0x074a('0x42')],{'$or':_[_0x074a('0x33')](_0xb2229b,function(_0x212cd4){if(_0x212cd4[_0x074a('0x46')]!==_0x074a('0x47')){var _0x1ba608={};_0x1ba608[_0x212cd4[_0x074a('0x48')]]={'$like':'%'+_0x3b8e6e[_0x074a('0x37')][_0x074a('0x44')]+'%'};return _0x1ba608;}})});}_0x458c5f=_[_0x074a('0x45')]({},_0x458c5f,_0x3b8e6e[_0x074a('0x49')]);var _0x47bc6c={'where':_0x458c5f[_0x074a('0x42')]};return db[_0x074a('0x34')][_0x074a('0x25')](_0x47bc6c)[_0x074a('0x2e')](function(_0x19d51a){_0x423c3a[_0x074a('0x25')]=_0x19d51a;if(_0x3b8e6e[_0x074a('0x37')][_0x074a('0x4a')]){_0x458c5f[_0x074a('0x4b')]=[{'all':!![]}];}return db['ChatGroup'][_0x074a('0x4c')](_0x458c5f);})[_0x074a('0x2e')](function(_0x38f235){_0x423c3a[_0x074a('0x4d')]=_0x38f235;return _0x423c3a;})['then'](respondWithFilteredResult(_0x99b86a,_0x458c5f))['catch'](handleError(_0x99b86a,null));};exports[_0x074a('0x4e')]=function(_0x35cacf,_0x5be782){var _0x1efc31={'raw':!![],'where':{'id':_0x35cacf['params']['id']}},_0x42fe44={};_0x42fe44[_0x074a('0x36')]=_[_0x074a('0x38')](db[_0x074a('0x34')][_0x074a('0x35')]);_0x42fe44[_0x074a('0x37')]=_[_0x074a('0x38')](_0x35cacf[_0x074a('0x37')]);_0x42fe44[_0x074a('0x39')]=_['intersection'](_0x42fe44['model'],_0x42fe44[_0x074a('0x37')]);_0x1efc31['attributes']=_[_0x074a('0x3a')](_0x42fe44[_0x074a('0x36')],qs['fields'](_0x35cacf[_0x074a('0x37')][_0x074a('0x3c')]));_0x1efc31[_0x074a('0x3b')]=_0x1efc31[_0x074a('0x3b')]['length']?_0x1efc31[_0x074a('0x3b')]:_0x42fe44[_0x074a('0x36')];if(_0x35cacf[_0x074a('0x37')][_0x074a('0x4a')]){_0x1efc31[_0x074a('0x4b')]=[{'all':!![]}];}_0x1efc31=_['merge']({},_0x1efc31,_0x35cacf[_0x074a('0x49')]);return db[_0x074a('0x34')][_0x074a('0x4f')](_0x1efc31)[_0x074a('0x2e')](handleEntityNotFound(_0x5be782,null))[_0x074a('0x2e')](respondWithResult(_0x5be782,null))[_0x074a('0x50')](handleError(_0x5be782,null));};exports[_0x074a('0x51')]=function(_0x3209d1,_0x5bceab){return db[_0x074a('0x34')][_0x074a('0x51')](_0x3209d1['body'],{})['then'](respondWithResult(_0x5bceab,0xc9))[_0x074a('0x50')](handleError(_0x5bceab,null));};exports['update']=function(_0x38212f,_0x27e58b){if(_0x38212f[_0x074a('0x52')]['id']){delete _0x38212f['body']['id'];}return db['ChatGroup'][_0x074a('0x4f')]({'where':{'id':_0x38212f[_0x074a('0x53')]['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x27e58b,null))[_0x074a('0x2e')](saveUpdates(_0x38212f[_0x074a('0x52')],null))[_0x074a('0x2e')](respondWithResult(_0x27e58b,null))[_0x074a('0x50')](handleError(_0x27e58b,null));};exports['destroy']=function(_0xfb3cd5,_0x5c57ee){return db['ChatGroup'][_0x074a('0x4f')]({'where':{'id':_0xfb3cd5[_0x074a('0x53')]['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x5c57ee,null))[_0x074a('0x2e')](removeEntity(_0x5c57ee,null))[_0x074a('0x50')](handleError(_0x5c57ee,null));};exports['describe']=function(_0x595ab3,_0x296e77){return db[_0x074a('0x34')]['describe']()[_0x074a('0x2e')](respondWithResult(_0x296e77,null))[_0x074a('0x50')](handleError(_0x296e77,null));};exports[_0x074a('0x54')]=function(_0x234203,_0x9ba1cc,_0x48a5fa){return db[_0x074a('0x55')][_0x074a('0x25')]({'where':{'ChatGroupId':_0x234203[_0x074a('0x53')]['id'],'ToId':_0x234203['user']['id'],'read':![]}})[_0x074a('0x2e')](function(_0x4bec41){return{'id':_[_0x074a('0x56')](_0x234203['params']['id']),'count':_0x4bec41};})[_0x074a('0x2e')](respondWithResult(_0x9ba1cc,null))[_0x074a('0x50')](handleError(_0x9ba1cc,null));};exports['addMembers']=function(_0x9767e0,_0x14c9cb,_0x3c3bca){return db[_0x074a('0x34')][_0x074a('0x4f')]({'where':{'id':_0x9767e0['params']['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x14c9cb,null))['then'](function(_0x49e7ae){if(_0x49e7ae){return _0x49e7ae[_0x074a('0x57')](_0x9767e0[_0x074a('0x52')][_0x074a('0x58')],_[_0x074a('0x59')](_0x9767e0['body'],[_0x074a('0x58'),'id'])||{});}})[_0x074a('0x2e')](respondWithResult(_0x14c9cb,null))[_0x074a('0x50')](handleError(_0x14c9cb,null));};exports['getMembers']=function(_0xe8c037,_0x26420e,_0x2bed53){var _0x23a641={};var _0x179725={};var _0x2cd903;var _0x261070;return db[_0x074a('0x34')][_0x074a('0x5a')]({'where':{'id':_0xe8c037[_0x074a('0x53')]['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x26420e,null))['then'](function(_0x8d53a7){if(_0x8d53a7){_0x2cd903=_0x8d53a7;_0x179725[_0x074a('0x36')]=_[_0x074a('0x38')](db[_0x074a('0x5b')][_0x074a('0x35')]);_0x179725[_0x074a('0x37')]=_[_0x074a('0x38')](_0xe8c037['query']);_0x179725[_0x074a('0x39')]=_[_0x074a('0x3a')](_0x179725[_0x074a('0x36')],_0x179725[_0x074a('0x37')]);_0x23a641['attributes']=_['intersection'](_0x179725[_0x074a('0x36')],qs[_0x074a('0x3c')](_0xe8c037[_0x074a('0x37')][_0x074a('0x3c')]));_0x23a641[_0x074a('0x3b')]=_0x23a641['attributes'][_0x074a('0x3d')]?_0x23a641['attributes']:_0x179725[_0x074a('0x36')];_0x23a641['order']=qs[_0x074a('0x41')](_0xe8c037[_0x074a('0x37')]['sort']);_0x23a641[_0x074a('0x42')]=qs[_0x074a('0x39')](_['pick'](_0xe8c037['query'],_0x179725[_0x074a('0x39')]));if(_0xe8c037[_0x074a('0x37')][_0x074a('0x44')]){_0x23a641['where']=_[_0x074a('0x45')](_0x23a641[_0x074a('0x42')],{'$or':_[_0x074a('0x33')](_0x23a641[_0x074a('0x3b')],function(_0x290e57){var _0x38f23b={};_0x38f23b[_0x290e57]={'$like':'%'+_0xe8c037[_0x074a('0x37')][_0x074a('0x44')]+'%'};return _0x38f23b;})});}_0x23a641=_[_0x074a('0x45')]({},_0x23a641,_0xe8c037[_0x074a('0x49')]);return _0x2cd903[_0x074a('0x5c')](_0x23a641);}})['then'](function(_0x1f2288){if(_0x1f2288){_0x261070=_0x1f2288[_0x074a('0x3d')];if(!_0xe8c037[_0x074a('0x37')]['hasOwnProperty'](_0x074a('0x3f'))){_0x23a641[_0x074a('0x26')]=qs[_0x074a('0x26')](_0xe8c037[_0x074a('0x37')]['limit']);_0x23a641[_0x074a('0x24')]=qs[_0x074a('0x24')](_0xe8c037[_0x074a('0x37')][_0x074a('0x24')]);}return _0x2cd903[_0x074a('0x5c')](_0x23a641);}})[_0x074a('0x2e')](function(_0x421a3b){if(_0x421a3b){return _0x421a3b?{'count':_0x261070,'rows':_0x421a3b}:null;}})[_0x074a('0x2e')](respondWithResult(_0x26420e,null))[_0x074a('0x50')](handleError(_0x26420e,null));};exports['removeMembers']=function(_0x39839d,_0x412ea4,_0x3c3304){return db[_0x074a('0x34')][_0x074a('0x4f')]({'where':{'id':_0x39839d[_0x074a('0x53')]['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x412ea4,null))['then'](function(_0x12a0cc){if(_0x12a0cc){return _0x12a0cc['removeMembers'](_0x39839d[_0x074a('0x37')][_0x074a('0x58')]);}})[_0x074a('0x2e')](respondWithStatusCode(_0x412ea4,null))[_0x074a('0x50')](handleError(_0x412ea4,null));};exports[_0x074a('0x5d')]=function(_0x4ca524,_0x3305e4,_0x1de051){if(_0x4ca524[_0x074a('0x52')]['id']){delete _0x4ca524[_0x074a('0x52')]['id'];}return db[_0x074a('0x34')]['find']({'where':{'id':_0x4ca524[_0x074a('0x53')]['id']}})[_0x074a('0x2e')](handleEntityNotFound(_0x3305e4,null))['then'](function(_0xcc74a1){if(_0xcc74a1){_0x4ca524[_0x074a('0x52')]['ChatGroupId']=_0xcc74a1['id'];return db[_0x074a('0x55')][_0x074a('0x51')](_0x4ca524[_0x074a('0x52')]);}})[_0x074a('0x2e')](respondWithResult(_0x3305e4,null))[_0x074a('0x50')](handleError(_0x3305e4,null));};exports[_0x074a('0x5e')]=function(_0x4b3504,_0x3882e7,_0x2a4431){var _0x509cce={};var _0x41d1ce={};var _0x22f356;var _0x208592;return db[_0x074a('0x34')]['findOne']({'where':{'id':_0x4b3504[_0x074a('0x53')]['id']}})['then'](handleEntityNotFound(_0x3882e7,null))[_0x074a('0x2e')](function(_0x3f3c56){if(_0x3f3c56){_0x22f356=_0x3f3c56;_0x41d1ce['model']=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x41d1ce[_0x074a('0x37')]=_[_0x074a('0x38')](_0x4b3504[_0x074a('0x37')]);_0x41d1ce[_0x074a('0x39')]=_[_0x074a('0x3a')](_0x41d1ce[_0x074a('0x36')],_0x41d1ce[_0x074a('0x37')]);_0x509cce[_0x074a('0x3b')]=_[_0x074a('0x3a')](_0x41d1ce['model'],qs[_0x074a('0x3c')](_0x4b3504[_0x074a('0x37')][_0x074a('0x3c')]));_0x509cce['attributes']=_0x509cce[_0x074a('0x3b')][_0x074a('0x3d')]?_0x509cce[_0x074a('0x3b')]:_0x41d1ce[_0x074a('0x36')];_0x509cce[_0x074a('0x40')]=qs['sort'](_0x4b3504['query'][_0x074a('0x41')]);_0x509cce[_0x074a('0x42')]=qs[_0x074a('0x39')](_[_0x074a('0x43')](_0x4b3504[_0x074a('0x37')],_0x41d1ce[_0x074a('0x39')]));if(_0x4b3504['query']['filter']){_0x509cce['where']=_[_0x074a('0x45')](_0x509cce[_0x074a('0x42')],{'$or':_[_0x074a('0x33')](_0x509cce[_0x074a('0x3b')],function(_0x5879a3){var _0x9b2940={};_0x9b2940[_0x5879a3]={'$like':'%'+_0x4b3504[_0x074a('0x37')][_0x074a('0x44')]+'%'};return _0x9b2940;})});}if(_0x4b3504[_0x074a('0x37')][_0x074a('0x5f')]){var _0x1f11e4=_0x4b3504[_0x074a('0x37')][_0x074a('0x5f')][_0x074a('0x60')](',');var _0x530556={};_0x530556[_0x1f11e4[0x0]]={'$gte':moment(_0x1f11e4[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x509cce[_0x074a('0x42')]=_[_0x074a('0x45')](_0x509cce[_0x074a('0x42')],_0x530556);}_0x509cce=_['merge']({},_0x509cce,_0x4b3504[_0x074a('0x49')]);return _0x22f356[_0x074a('0x5e')](_0x509cce);}})[_0x074a('0x2e')](function(_0x2fbc64){if(_0x2fbc64){_0x208592=_0x2fbc64[_0x074a('0x3d')];if(!_0x4b3504[_0x074a('0x37')]['hasOwnProperty'](_0x074a('0x3f'))){_0x509cce[_0x074a('0x26')]=qs[_0x074a('0x26')](_0x4b3504[_0x074a('0x37')][_0x074a('0x26')]);_0x509cce[_0x074a('0x24')]=qs[_0x074a('0x24')](_0x4b3504[_0x074a('0x37')]['offset']);}return _0x22f356[_0x074a('0x5e')](_0x509cce);}})[_0x074a('0x2e')](function(_0x311089){if(_0x311089){return _0x311089?{'count':_0x208592,'rows':_0x311089}:null;}})['then'](respondWithResult(_0x3882e7,null))[_0x074a('0x50')](handleError(_0x3882e7,null));}; \ No newline at end of file +var _0x45d5=['nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','fields','create','body','describe','getUnread','toInteger','addMembers','ids','omit','findOne','User','getMembers','find','addMessage','ChatInternalMessage','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','map','ChatGroup','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','length','hasOwnProperty'];(function(_0x368113,_0x244119){var _0x475e26=function(_0x301a02){while(--_0x301a02){_0x368113['push'](_0x368113['shift']());}};_0x475e26(++_0x244119);}(_0x45d5,0x80));var _0x545d=function(_0x43b669,_0x3c95f3){_0x43b669=_0x43b669-0x0;var _0x593aab=_0x45d5[_0x43b669];return _0x593aab;};'use strict';var emlformat=require(_0x545d('0x0'));var rimraf=require(_0x545d('0x1'));var zipdir=require(_0x545d('0x2'));var jsonpatch=require(_0x545d('0x3'));var rp=require('request-promise');var moment=require(_0x545d('0x4'));var BPromise=require(_0x545d('0x5'));var Mustache=require(_0x545d('0x6'));var util=require('util');var path=require(_0x545d('0x7'));var sox=require(_0x545d('0x8'));var csv=require(_0x545d('0x9'));var ejs=require(_0x545d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x545d('0xb'));var squel=require(_0x545d('0xc'));var crypto=require(_0x545d('0xd'));var jsforce=require(_0x545d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x545d('0xf'));var authService=require(_0x545d('0x10'));var qs=require(_0x545d('0x11'));var as=require(_0x545d('0x12'));var hardwareService=require(_0x545d('0x13'));var logger=require(_0x545d('0x14'))(_0x545d('0x15'));var utils=require('../../config/utils');var config=require(_0x545d('0x16'));var licenseUtil=require(_0x545d('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x545d('0x18')](config[_0x545d('0x19')],{'host':_0x545d('0x1a'),'port':0x18eb});var socket=require(_0x545d('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x1529e8,_0x5747b8){_0x5747b8=_0x5747b8||0xcc;return function(_0x14fa11){if(_0x14fa11){return _0x1529e8['sendStatus'](_0x5747b8);}return _0x1529e8[_0x545d('0x1c')](_0x5747b8)[_0x545d('0x1d')]();};}function respondWithResult(_0x8cf65d,_0x2da8ab){_0x2da8ab=_0x2da8ab||0xc8;return function(_0x53c1d3){if(_0x53c1d3){return _0x8cf65d[_0x545d('0x1c')](_0x2da8ab)[_0x545d('0x1e')](_0x53c1d3);}};}function respondWithFilteredResult(_0x3e2844,_0x2f20fa){return function(_0x3b3789){if(_0x3b3789){var _0xcc4fe1=typeof _0x2f20fa[_0x545d('0x1f')]===_0x545d('0x20')&&typeof _0x2f20fa['limit']===_0x545d('0x20');var _0x1d70de=_0x3b3789[_0x545d('0x21')];var _0x45bdc4=_0xcc4fe1?0x0:_0x2f20fa[_0x545d('0x1f')];var _0x1d3862=_0xcc4fe1?_0x3b3789['count']:_0x2f20fa[_0x545d('0x1f')]+_0x2f20fa[_0x545d('0x22')];var _0x162c46;if(_0x1d3862>=_0x1d70de){_0x1d3862=_0x1d70de;_0x162c46=0xc8;}else{_0x162c46=0xce;}_0x3e2844[_0x545d('0x1c')](_0x162c46);return _0x3e2844[_0x545d('0x23')]('Content-Range',_0x45bdc4+'-'+_0x1d3862+'/'+_0x1d70de)['json'](_0x3b3789);}return null;};}function patchUpdates(_0x42d62e){return function(_0x1c6915){try{jsonpatch[_0x545d('0x24')](_0x1c6915,_0x42d62e,!![]);}catch(_0x3472aa){return BPromise[_0x545d('0x25')](_0x3472aa);}return _0x1c6915[_0x545d('0x26')]();};}function saveUpdates(_0x4b2b06,_0x227034){return function(_0xb1ed4){if(_0xb1ed4){return _0xb1ed4[_0x545d('0x27')](_0x4b2b06)['then'](function(_0x3f09a0){return _0x3f09a0;});}return null;};}function removeEntity(_0x59aa68,_0x10e185){return function(_0x2be3e3){if(_0x2be3e3){return _0x2be3e3[_0x545d('0x28')]()[_0x545d('0x29')](function(){_0x59aa68[_0x545d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d9fa,_0x5aa5d7){return function(_0xbca06d){if(!_0xbca06d){_0x22d9fa[_0x545d('0x2a')](0x194);}return _0xbca06d;};}function handleError(_0xb1b28f,_0xaa1355){_0xaa1355=_0xaa1355||0x1f4;return function(_0x47a450){logger[_0x545d('0x2b')](_0x47a450[_0x545d('0x2c')]);if(_0x47a450[_0x545d('0x2d')]){delete _0x47a450[_0x545d('0x2d')];}_0xb1b28f['status'](_0xaa1355)['send'](_0x47a450);};}exports['index']=function(_0x91cca6,_0x2242b4){var _0x542a76={},_0x418c58={},_0x3503f7={'count':0x0,'rows':[]};var _0x2e58ba=_[_0x545d('0x2e')](db[_0x545d('0x2f')][_0x545d('0x30')],function(_0x16bcd5){return{'name':_0x16bcd5[_0x545d('0x31')],'type':_0x16bcd5['type'][_0x545d('0x32')]};});_0x418c58['model']=_[_0x545d('0x2e')](_0x2e58ba,_0x545d('0x2d'));_0x418c58[_0x545d('0x33')]=_[_0x545d('0x34')](_0x91cca6['query']);_0x418c58['filters']=_['intersection'](_0x418c58[_0x545d('0x35')],_0x418c58[_0x545d('0x33')]);_0x542a76[_0x545d('0x36')]=_[_0x545d('0x37')](_0x418c58[_0x545d('0x35')],qs['fields'](_0x91cca6['query']['fields']));_0x542a76[_0x545d('0x36')]=_0x542a76['attributes'][_0x545d('0x38')]?_0x542a76[_0x545d('0x36')]:_0x418c58[_0x545d('0x35')];if(!_0x91cca6[_0x545d('0x33')][_0x545d('0x39')](_0x545d('0x3a'))){_0x542a76[_0x545d('0x22')]=qs[_0x545d('0x22')](_0x91cca6[_0x545d('0x33')][_0x545d('0x22')]);_0x542a76[_0x545d('0x1f')]=qs[_0x545d('0x1f')](_0x91cca6[_0x545d('0x33')]['offset']);}_0x542a76[_0x545d('0x3b')]=qs['sort'](_0x91cca6[_0x545d('0x33')][_0x545d('0x3c')]);_0x542a76[_0x545d('0x3d')]=qs[_0x545d('0x3e')](_['pick'](_0x91cca6[_0x545d('0x33')],_0x418c58['filters']),_0x2e58ba);if(_0x91cca6[_0x545d('0x33')]['filter']){_0x542a76['where']=_[_0x545d('0x3f')](_0x542a76[_0x545d('0x3d')],{'$or':_['map'](_0x2e58ba,function(_0x5c4bdd){if(_0x5c4bdd['type']!==_0x545d('0x40')){var _0x50a2be={};_0x50a2be[_0x5c4bdd['name']]={'$like':'%'+_0x91cca6[_0x545d('0x33')][_0x545d('0x41')]+'%'};return _0x50a2be;}})});}_0x542a76=_[_0x545d('0x3f')]({},_0x542a76,_0x91cca6[_0x545d('0x42')]);var _0x342adb={'where':_0x542a76['where']};return db[_0x545d('0x2f')][_0x545d('0x21')](_0x342adb)['then'](function(_0x2c57d6){_0x3503f7[_0x545d('0x21')]=_0x2c57d6;if(_0x91cca6[_0x545d('0x33')][_0x545d('0x43')]){_0x542a76['include']=[{'all':!![]}];}return db['ChatGroup'][_0x545d('0x44')](_0x542a76);})[_0x545d('0x29')](function(_0x2d4752){_0x3503f7[_0x545d('0x45')]=_0x2d4752;return _0x3503f7;})[_0x545d('0x29')](respondWithFilteredResult(_0x2242b4,_0x542a76))[_0x545d('0x46')](handleError(_0x2242b4,null));};exports['show']=function(_0x35df60,_0x83602a){var _0x236968={'raw':!![],'where':{'id':_0x35df60[_0x545d('0x47')]['id']}},_0xf6edc4={};_0xf6edc4['model']=_['keys'](db[_0x545d('0x2f')]['rawAttributes']);_0xf6edc4['query']=_[_0x545d('0x34')](_0x35df60[_0x545d('0x33')]);_0xf6edc4['filters']=_[_0x545d('0x37')](_0xf6edc4[_0x545d('0x35')],_0xf6edc4[_0x545d('0x33')]);_0x236968[_0x545d('0x36')]=_['intersection'](_0xf6edc4['model'],qs[_0x545d('0x48')](_0x35df60['query']['fields']));_0x236968[_0x545d('0x36')]=_0x236968[_0x545d('0x36')][_0x545d('0x38')]?_0x236968[_0x545d('0x36')]:_0xf6edc4[_0x545d('0x35')];if(_0x35df60[_0x545d('0x33')]['includeAll']){_0x236968['include']=[{'all':!![]}];}_0x236968=_[_0x545d('0x3f')]({},_0x236968,_0x35df60['options']);return db[_0x545d('0x2f')]['find'](_0x236968)['then'](handleEntityNotFound(_0x83602a,null))[_0x545d('0x29')](respondWithResult(_0x83602a,null))[_0x545d('0x46')](handleError(_0x83602a,null));};exports['create']=function(_0x247f67,_0xf3d7ab){return db['ChatGroup'][_0x545d('0x49')](_0x247f67[_0x545d('0x4a')],{})[_0x545d('0x29')](respondWithResult(_0xf3d7ab,0xc9))[_0x545d('0x46')](handleError(_0xf3d7ab,null));};exports['update']=function(_0x2fcf1c,_0x4ae863){if(_0x2fcf1c[_0x545d('0x4a')]['id']){delete _0x2fcf1c[_0x545d('0x4a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2fcf1c[_0x545d('0x47')]['id']}})[_0x545d('0x29')](handleEntityNotFound(_0x4ae863,null))[_0x545d('0x29')](saveUpdates(_0x2fcf1c[_0x545d('0x4a')],null))[_0x545d('0x29')](respondWithResult(_0x4ae863,null))[_0x545d('0x46')](handleError(_0x4ae863,null));};exports[_0x545d('0x28')]=function(_0x64a429,_0x416fbd){return db[_0x545d('0x2f')]['find']({'where':{'id':_0x64a429[_0x545d('0x47')]['id']}})['then'](handleEntityNotFound(_0x416fbd,null))[_0x545d('0x29')](removeEntity(_0x416fbd,null))['catch'](handleError(_0x416fbd,null));};exports[_0x545d('0x4b')]=function(_0x59f0c7,_0x5e1ad7){return db[_0x545d('0x2f')]['describe']()[_0x545d('0x29')](respondWithResult(_0x5e1ad7,null))[_0x545d('0x46')](handleError(_0x5e1ad7,null));};exports[_0x545d('0x4c')]=function(_0x5b5dd1,_0x5d5174,_0x147468){return db['ChatInternalMessage'][_0x545d('0x21')]({'where':{'ChatGroupId':_0x5b5dd1['params']['id'],'ToId':_0x5b5dd1['user']['id'],'read':![]}})[_0x545d('0x29')](function(_0x2a4ca9){return{'id':_[_0x545d('0x4d')](_0x5b5dd1[_0x545d('0x47')]['id']),'count':_0x2a4ca9};})[_0x545d('0x29')](respondWithResult(_0x5d5174,null))[_0x545d('0x46')](handleError(_0x5d5174,null));};exports['addMembers']=function(_0x1392f2,_0x5dce24,_0x4dd9e6){return db[_0x545d('0x2f')]['find']({'where':{'id':_0x1392f2[_0x545d('0x47')]['id']}})[_0x545d('0x29')](handleEntityNotFound(_0x5dce24,null))[_0x545d('0x29')](function(_0x209a1b){if(_0x209a1b){return _0x209a1b[_0x545d('0x4e')](_0x1392f2['body'][_0x545d('0x4f')],_[_0x545d('0x50')](_0x1392f2[_0x545d('0x4a')],[_0x545d('0x4f'),'id'])||{});}})[_0x545d('0x29')](respondWithResult(_0x5dce24,null))['catch'](handleError(_0x5dce24,null));};exports['getMembers']=function(_0x2f43e8,_0x30a6dc,_0x1cc0e5){var _0x58c878={};var _0x23acc4={};var _0x57ceb2;var _0x4ef72e;return db[_0x545d('0x2f')][_0x545d('0x51')]({'where':{'id':_0x2f43e8[_0x545d('0x47')]['id']}})['then'](handleEntityNotFound(_0x30a6dc,null))['then'](function(_0x200439){if(_0x200439){_0x57ceb2=_0x200439;_0x23acc4[_0x545d('0x35')]=_[_0x545d('0x34')](db[_0x545d('0x52')][_0x545d('0x30')]);_0x23acc4[_0x545d('0x33')]=_[_0x545d('0x34')](_0x2f43e8[_0x545d('0x33')]);_0x23acc4[_0x545d('0x3e')]=_[_0x545d('0x37')](_0x23acc4[_0x545d('0x35')],_0x23acc4[_0x545d('0x33')]);_0x58c878['attributes']=_['intersection'](_0x23acc4[_0x545d('0x35')],qs[_0x545d('0x48')](_0x2f43e8['query'][_0x545d('0x48')]));_0x58c878[_0x545d('0x36')]=_0x58c878['attributes'][_0x545d('0x38')]?_0x58c878[_0x545d('0x36')]:_0x23acc4[_0x545d('0x35')];_0x58c878[_0x545d('0x3b')]=qs[_0x545d('0x3c')](_0x2f43e8[_0x545d('0x33')]['sort']);_0x58c878['where']=qs[_0x545d('0x3e')](_['pick'](_0x2f43e8[_0x545d('0x33')],_0x23acc4['filters']));if(_0x2f43e8[_0x545d('0x33')][_0x545d('0x41')]){_0x58c878[_0x545d('0x3d')]=_['merge'](_0x58c878[_0x545d('0x3d')],{'$or':_[_0x545d('0x2e')](_0x58c878[_0x545d('0x36')],function(_0x4cb861){var _0x818395={};_0x818395[_0x4cb861]={'$like':'%'+_0x2f43e8[_0x545d('0x33')][_0x545d('0x41')]+'%'};return _0x818395;})});}_0x58c878=_[_0x545d('0x3f')]({},_0x58c878,_0x2f43e8[_0x545d('0x42')]);return _0x57ceb2['getMembers'](_0x58c878);}})[_0x545d('0x29')](function(_0x571422){if(_0x571422){_0x4ef72e=_0x571422['length'];if(!_0x2f43e8[_0x545d('0x33')]['hasOwnProperty'](_0x545d('0x3a'))){_0x58c878[_0x545d('0x22')]=qs['limit'](_0x2f43e8[_0x545d('0x33')][_0x545d('0x22')]);_0x58c878['offset']=qs[_0x545d('0x1f')](_0x2f43e8[_0x545d('0x33')]['offset']);}return _0x57ceb2[_0x545d('0x53')](_0x58c878);}})[_0x545d('0x29')](function(_0x38980c){if(_0x38980c){return _0x38980c?{'count':_0x4ef72e,'rows':_0x38980c}:null;}})['then'](respondWithResult(_0x30a6dc,null))['catch'](handleError(_0x30a6dc,null));};exports['removeMembers']=function(_0x58f29d,_0x4a3fc6,_0x129cc1){return db[_0x545d('0x2f')][_0x545d('0x54')]({'where':{'id':_0x58f29d[_0x545d('0x47')]['id']}})[_0x545d('0x29')](handleEntityNotFound(_0x4a3fc6,null))[_0x545d('0x29')](function(_0x48255b){if(_0x48255b){return _0x48255b['removeMembers'](_0x58f29d[_0x545d('0x33')][_0x545d('0x4f')]);}})[_0x545d('0x29')](respondWithStatusCode(_0x4a3fc6,null))[_0x545d('0x46')](handleError(_0x4a3fc6,null));};exports[_0x545d('0x55')]=function(_0x130e5a,_0x36e2fc,_0x351f99){if(_0x130e5a[_0x545d('0x4a')]['id']){delete _0x130e5a[_0x545d('0x4a')]['id'];}return db[_0x545d('0x2f')][_0x545d('0x54')]({'where':{'id':_0x130e5a[_0x545d('0x47')]['id']}})['then'](handleEntityNotFound(_0x36e2fc,null))['then'](function(_0x30ab5f){if(_0x30ab5f){_0x130e5a[_0x545d('0x4a')]['ChatGroupId']=_0x30ab5f['id'];return db[_0x545d('0x56')][_0x545d('0x49')](_0x130e5a[_0x545d('0x4a')]);}})[_0x545d('0x29')](respondWithResult(_0x36e2fc,null))[_0x545d('0x46')](handleError(_0x36e2fc,null));};exports['getMessages']=function(_0x5a065c,_0x5214d0,_0x4d8d9b){var _0x4aec6a={};var _0x26e231={};var _0x193366;var _0x419648;return db['ChatGroup']['findOne']({'where':{'id':_0x5a065c[_0x545d('0x47')]['id']}})[_0x545d('0x29')](handleEntityNotFound(_0x5214d0,null))['then'](function(_0x38a44d){if(_0x38a44d){_0x193366=_0x38a44d;_0x26e231['model']=_[_0x545d('0x34')](db['ChatInternalMessage'][_0x545d('0x30')]);_0x26e231[_0x545d('0x33')]=_['keys'](_0x5a065c[_0x545d('0x33')]);_0x26e231[_0x545d('0x3e')]=_[_0x545d('0x37')](_0x26e231[_0x545d('0x35')],_0x26e231[_0x545d('0x33')]);_0x4aec6a[_0x545d('0x36')]=_[_0x545d('0x37')](_0x26e231[_0x545d('0x35')],qs['fields'](_0x5a065c[_0x545d('0x33')][_0x545d('0x48')]));_0x4aec6a['attributes']=_0x4aec6a[_0x545d('0x36')][_0x545d('0x38')]?_0x4aec6a[_0x545d('0x36')]:_0x26e231[_0x545d('0x35')];_0x4aec6a[_0x545d('0x3b')]=qs[_0x545d('0x3c')](_0x5a065c[_0x545d('0x33')][_0x545d('0x3c')]);_0x4aec6a['where']=qs[_0x545d('0x3e')](_[_0x545d('0x57')](_0x5a065c['query'],_0x26e231['filters']));if(_0x5a065c[_0x545d('0x33')]['filter']){_0x4aec6a[_0x545d('0x3d')]=_[_0x545d('0x3f')](_0x4aec6a[_0x545d('0x3d')],{'$or':_[_0x545d('0x2e')](_0x4aec6a['attributes'],function(_0x31e1a1){var _0x37a7fb={};_0x37a7fb[_0x31e1a1]={'$like':'%'+_0x5a065c['query']['filter']+'%'};return _0x37a7fb;})});}if(_0x5a065c[_0x545d('0x33')]['$gte']){var _0x2d34cb=_0x5a065c[_0x545d('0x33')][_0x545d('0x58')][_0x545d('0x59')](',');var _0xc7014e={};_0xc7014e[_0x2d34cb[0x0]]={'$gte':moment(_0x2d34cb[0x1])[_0x545d('0x5a')](_0x545d('0x5b'))};_0x4aec6a[_0x545d('0x3d')]=_[_0x545d('0x3f')](_0x4aec6a[_0x545d('0x3d')],_0xc7014e);}_0x4aec6a=_[_0x545d('0x3f')]({},_0x4aec6a,_0x5a065c[_0x545d('0x42')]);return _0x193366[_0x545d('0x5c')](_0x4aec6a);}})['then'](function(_0x4d9a7a){if(_0x4d9a7a){_0x419648=_0x4d9a7a[_0x545d('0x38')];if(!_0x5a065c[_0x545d('0x33')][_0x545d('0x39')](_0x545d('0x3a'))){_0x4aec6a[_0x545d('0x22')]=qs['limit'](_0x5a065c['query'][_0x545d('0x22')]);_0x4aec6a[_0x545d('0x1f')]=qs[_0x545d('0x1f')](_0x5a065c['query'][_0x545d('0x1f')]);}return _0x193366[_0x545d('0x5c')](_0x4aec6a);}})[_0x545d('0x29')](function(_0x3b8299){if(_0x3b8299){return _0x3b8299?{'count':_0x419648,'rows':_0x3b8299}:null;}})[_0x545d('0x29')](respondWithResult(_0x5214d0,null))[_0x545d('0x46')](handleError(_0x5214d0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 99bded1..85da417 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 _0xc6ef=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x5bd38e,_0x4ba215){var _0x5f13a3=function(_0x4be1c0){while(--_0x4be1c0){_0x5bd38e['push'](_0x5bd38e['shift']());}};_0x5f13a3(++_0x4ba215);}(_0xc6ef,0x81));var _0xfc6e=function(_0x4b3012,_0x18e5e4){_0x4b3012=_0x4b3012-0x0;var _0x53b2f2=_0xc6ef[_0x4b3012];return _0x53b2f2;};'use strict';var EventEmitter=require(_0xfc6e('0x0'));var ChatGroup=require(_0xfc6e('0x1'))['db'][_0xfc6e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfc6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfc6e('0x4'),'afterDestroy':_0xfc6e('0x5')};function emitEvent(_0x263069){return function(_0x328958,_0x5212d9,_0x50f11f){ChatGroupEvents[_0xfc6e('0x6')](_0x263069+':'+_0x328958['id'],_0x328958);ChatGroupEvents[_0xfc6e('0x6')](_0x263069,_0x328958);_0x50f11f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xfc6e('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x7a02=['exports','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x7a02,0x1ba));var _0x27a0=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x7a02[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x27a0('0x0'))['db'][_0x27a0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x27a0('0x2')](0x0);var events={'afterCreate':_0x27a0('0x3'),'afterUpdate':_0x27a0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x939042){return function(_0x2b3fe8,_0x380a04,_0x46d249){ChatGroupEvents[_0x27a0('0x5')](_0x939042+':'+_0x2b3fe8['id'],_0x2b3fe8);ChatGroupEvents[_0x27a0('0x5')](_0x939042,_0x2b3fe8);_0x46d249(null);};}for(var e in events){if(events[_0x27a0('0x6')](e)){var event=events[e];ChatGroup[_0x27a0('0x7')](e,emitEvent(event));}}module[_0x27a0('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 00607f1..ae721c1 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 _0x25a9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','ChatGroup','lodash','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x25a9,0x131));var _0x925a=function(_0xe1b102,_0x542a72){_0xe1b102=_0xe1b102-0x0;var _0xed6dcc=_0x25a9[_0xe1b102];return _0xed6dcc;};'use strict';var _=require(_0x925a('0x0'));var util=require(_0x925a('0x1'));var logger=require('../../config/logger')(_0x925a('0x2'));var moment=require(_0x925a('0x3'));var BPromise=require(_0x925a('0x4'));var rp=require(_0x925a('0x5'));var fs=require('fs');var path=require(_0x925a('0x6'));var rimraf=require(_0x925a('0x7'));var config=require(_0x925a('0x8'));var attributes=require(_0x925a('0x9'));module['exports']=function(_0x46d060,_0x280a5c){return _0x46d060['define'](_0x925a('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d57=['../../config/logger','api','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x2aab5f,_0x303085){var _0x583d38=function(_0x4cbaa4){while(--_0x4cbaa4){_0x2aab5f['push'](_0x2aab5f['shift']());}};_0x583d38(++_0x303085);}(_0x3d57,0x11c));var _0x73d5=function(_0x2c1e15,_0x33e7c7){_0x2c1e15=_0x2c1e15-0x0;var _0x36be2e=_0x3d57[_0x2c1e15];return _0x36be2e;};'use strict';var _=require(_0x73d5('0x0'));var util=require(_0x73d5('0x1'));var logger=require(_0x73d5('0x2'))(_0x73d5('0x3'));var moment=require(_0x73d5('0x4'));var BPromise=require(_0x73d5('0x5'));var rp=require(_0x73d5('0x6'));var fs=require('fs');var path=require(_0x73d5('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x73d5('0x8'));module[_0x73d5('0x9')]=function(_0x14ffaa,_0x42350d){return _0x14ffaa[_0x73d5('0xa')](_0x73d5('0xb'),attributes,{'tableName':_0x73d5('0xc'),'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 cc2b057..51a2b17 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 _0x85d8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x85d8,0x1b0));var _0x885d=function(_0x583375,_0x1d99ee){_0x583375=_0x583375-0x0;var _0x2dd80a=_0x85d8[_0x583375];return _0x2dd80a;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var moment=require(_0x885d('0x2'));var BPromise=require(_0x885d('0x3'));var rs=require(_0x885d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x885d('0x5'))['db'];var utils=require(_0x885d('0x6'));var logger=require(_0x885d('0x7'))(_0x885d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x885d('0x9')][_0x885d('0xa')]({'port':0x232a});config[_0x885d('0xb')]=_[_0x885d('0xc')](config[_0x885d('0xb')],{'host':_0x885d('0xd'),'port':0x18eb});var socket=require(_0x885d('0xe'))(new Redis(config[_0x885d('0xb')]));require(_0x885d('0xf'))[_0x885d('0x10')](socket);function respondWithRpcPromise(_0x11e4e7,_0x125db6,_0x3ce28f){return new BPromise(function(_0x1e5761,_0x19c903){return client[_0x885d('0x11')](_0x11e4e7,_0x3ce28f)[_0x885d('0x12')](function(_0x2c680b){logger[_0x885d('0x13')]('ChatGroup,\x20%s,\x20%s',_0x125db6,'request\x20sent');logger[_0x885d('0x14')](_0x885d('0x15'),_0x125db6,'request\x20sent',JSON[_0x885d('0x16')](_0x2c680b));if(_0x2c680b[_0x885d('0x17')]){if(_0x2c680b['error']['code']===0x1f4){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x19c903(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x1e5761(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}else{logger[_0x885d('0x13')](_0x885d('0x18'),_0x125db6,_0x885d('0x1a'));_0x1e5761(_0x2c680b[_0x885d('0x1b')]['message']);}})[_0x885d('0x1c')](function(_0x35dfcc){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x35dfcc);_0x19c903(_0x35dfcc);});});} \ No newline at end of file +var _0xf4d9=['redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x38605e,_0x410cc3){var _0x59a8cd=function(_0x5470a4){while(--_0x5470a4){_0x38605e['push'](_0x38605e['shift']());}};_0x59a8cd(++_0x410cc3);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x33c23d,_0x104e90){_0x33c23d=_0x33c23d-0x0;var _0x29efdf=_0xf4d9[_0x33c23d];return _0x29efdf;};'use strict';var _=require(_0x9f4d('0x0'));var util=require('util');var moment=require(_0x9f4d('0x1'));var BPromise=require(_0x9f4d('0x2'));var rs=require(_0x9f4d('0x3'));var fs=require('fs');var Redis=require(_0x9f4d('0x4'));var db=require(_0x9f4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f4d('0x6'))(_0x9f4d('0x7'));var config=require(_0x9f4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f4d('0x9')][_0x9f4d('0xa')]({'port':0x232a});config[_0x9f4d('0xb')]=_['defaults'](config[_0x9f4d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f4d('0xc'))(new Redis(config['redis']));require(_0x9f4d('0xd'))[_0x9f4d('0xe')](socket);function respondWithRpcPromise(_0x40ddba,_0x4311f4,_0x5e33b7){return new BPromise(function(_0x3f4851,_0x5ec1f0){return client[_0x9f4d('0xf')](_0x40ddba,_0x5e33b7)[_0x9f4d('0x10')](function(_0x3159a1){logger[_0x9f4d('0x11')](_0x9f4d('0x12'),_0x4311f4,_0x9f4d('0x13'));logger[_0x9f4d('0x14')](_0x9f4d('0x15'),_0x4311f4,_0x9f4d('0x13'),JSON['stringify'](_0x3159a1));if(_0x3159a1[_0x9f4d('0x16')]){if(_0x3159a1[_0x9f4d('0x16')][_0x9f4d('0x17')]===0x1f4){logger['error'](_0x9f4d('0x12'),_0x4311f4,_0x3159a1[_0x9f4d('0x16')][_0x9f4d('0x18')]);return _0x5ec1f0(_0x3159a1[_0x9f4d('0x16')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4311f4,_0x3159a1[_0x9f4d('0x16')][_0x9f4d('0x18')]);return _0x3f4851(_0x3159a1[_0x9f4d('0x16')][_0x9f4d('0x18')]);}else{logger[_0x9f4d('0x11')](_0x9f4d('0x12'),_0x4311f4,'request\x20sent');_0x3f4851(_0x3159a1[_0x9f4d('0x19')][_0x9f4d('0x18')]);}})[_0x9f4d('0x1a')](function(_0x40fdca){logger[_0x9f4d('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4311f4,_0x40fdca);_0x5ec1f0(_0x40fdca);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 555bfa4..d60a178 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 _0xc98c=['register','length','chatGroup:','save','remove','update','emit','removeListener'];(function(_0x4036d4,_0x5994ab){var _0x3bc2a4=function(_0x4303f7){while(--_0x4303f7){_0x4036d4['push'](_0x4036d4['shift']());}};_0x3bc2a4(++_0x5994ab);}(_0xc98c,0x1db));var _0xcc98=function(_0x1387b5,_0x26da78){_0x1387b5=_0x1387b5-0x0;var _0x5e6b89=_0xc98c[_0x1387b5];return _0x5e6b89;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcc98('0x0'),_0xcc98('0x1'),_0xcc98('0x2')];function createListener(_0x3d2a2b,_0x292be9){return function(_0x3abef9){_0x292be9[_0xcc98('0x3')](_0x3d2a2b,_0x3abef9);};}function removeListener(_0x3bb9d8,_0x44f156){return function(){ChatGroupEvents[_0xcc98('0x4')](_0x3bb9d8,_0x44f156);};}exports[_0xcc98('0x5')]=function(_0x568d1b){for(var _0x3b6809=0x0,_0x19b420=events[_0xcc98('0x6')];_0x3b6809<_0x19b420;_0x3b6809++){var _0x14d6d7=events[_0x3b6809];var _0x1ff422=createListener(_0xcc98('0x7')+_0x14d6d7,_0x568d1b);ChatGroupEvents['on'](_0x14d6d7,_0x1ff422);}}; \ No newline at end of file +var _0x76c4=['chatGroup:','./chatGroup.events','save','remove','emit','removeListener','register','length'];(function(_0x287813,_0x4c8469){var _0x39bfa3=function(_0x50942b){while(--_0x50942b){_0x287813['push'](_0x287813['shift']());}};_0x39bfa3(++_0x4c8469);}(_0x76c4,0x79));var _0x476c=function(_0x3a022a,_0x4511bc){_0x3a022a=_0x3a022a-0x0;var _0x18a9e4=_0x76c4[_0x3a022a];return _0x18a9e4;};'use strict';var ChatGroupEvents=require(_0x476c('0x0'));var events=[_0x476c('0x1'),_0x476c('0x2'),'update'];function createListener(_0x5ac302,_0x3d3836){return function(_0x608ba3){_0x3d3836[_0x476c('0x3')](_0x5ac302,_0x608ba3);};}function removeListener(_0x1cc54c,_0x2cb669){return function(){ChatGroupEvents[_0x476c('0x4')](_0x1cc54c,_0x2cb669);};}exports[_0x476c('0x5')]=function(_0x2890cc){for(var _0x4e70ed=0x0,_0x5b6a70=events[_0x476c('0x6')];_0x4e70ed<_0x5b6a70;_0x4e70ed++){var _0x56c5f3=events[_0x4e70ed];var _0x1996e4=createListener(_0x476c('0x7')+_0x56c5f3,_0x2890cc);ChatGroupEvents['on'](_0x56c5f3,_0x1996e4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8cee5b2..4fcdd19 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 _0x4e85=['post','create','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','/:id/messages','getMessages'];(function(_0x29186d,_0x4743c9){var _0x157360=function(_0x5d909c){while(--_0x5d909c){_0x29186d['push'](_0x29186d['shift']());}};_0x157360(++_0x4743c9);}(_0x4e85,0x1d9));var _0x54e8=function(_0x295d71,_0x245520){_0x295d71=_0x295d71-0x0;var _0x499fd1=_0x4e85[_0x295d71];return _0x499fd1;};'use strict';var multer=require(_0x54e8('0x0'));var util=require(_0x54e8('0x1'));var path=require(_0x54e8('0x2'));var timeout=require(_0x54e8('0x3'));var express=require(_0x54e8('0x4'));var router=express[_0x54e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x54e8('0x6'));var interaction=require(_0x54e8('0x7'));var config=require(_0x54e8('0x8'));var controller=require('./chatGroup.controller');router[_0x54e8('0x9')]('/',auth[_0x54e8('0xa')](),controller[_0x54e8('0xb')]);router[_0x54e8('0x9')](_0x54e8('0xc'),auth['isAuthenticated'](),controller[_0x54e8('0xd')]);router[_0x54e8('0x9')](_0x54e8('0xe'),auth['isAuthenticated'](),controller[_0x54e8('0xf')]);router[_0x54e8('0x9')]('/:id/unread',auth[_0x54e8('0xa')](),controller[_0x54e8('0x10')]);router[_0x54e8('0x9')](_0x54e8('0x11'),auth[_0x54e8('0xa')](),controller['getMembers']);router[_0x54e8('0x9')](_0x54e8('0x12'),auth[_0x54e8('0xa')](),controller[_0x54e8('0x13')]);router[_0x54e8('0x14')]('/',auth['isAuthenticated'](),controller[_0x54e8('0x15')]);router['post'](_0x54e8('0x11'),auth['isAuthenticated'](),controller[_0x54e8('0x16')]);router[_0x54e8('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0x54e8('0x17')]);router[_0x54e8('0x18')](_0x54e8('0xe'),auth[_0x54e8('0xa')](),controller[_0x54e8('0x19')]);router[_0x54e8('0x1a')]('/:id',auth[_0x54e8('0xa')](),controller['destroy']);router[_0x54e8('0x1a')](_0x54e8('0x11'),auth[_0x54e8('0xa')](),controller[_0x54e8('0x1b')]);module[_0x54e8('0x1c')]=router; \ No newline at end of file +var _0x137b=['../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','show','/:id/unread','/:id/members','getMembers','getMessages','post','addMembers','addMessage','put','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x137b,0x1cc));var _0xb137=function(_0x4976eb,_0x4b09d1){_0x4976eb=_0x4976eb-0x0;var _0x5dd7b2=_0x137b[_0x4976eb];return _0x5dd7b2;};'use strict';var multer=require(_0xb137('0x0'));var util=require(_0xb137('0x1'));var path=require(_0xb137('0x2'));var timeout=require(_0xb137('0x3'));var express=require(_0xb137('0x4'));var router=express['Router']();var fs_extra=require(_0xb137('0x5'));var auth=require(_0xb137('0x6'));var interaction=require(_0xb137('0x7'));var config=require(_0xb137('0x8'));var controller=require(_0xb137('0x9'));router[_0xb137('0xa')]('/',auth[_0xb137('0xb')](),controller['index']);router['get'](_0xb137('0xc'),auth[_0xb137('0xb')](),controller['describe']);router[_0xb137('0xa')](_0xb137('0xd'),auth['isAuthenticated'](),controller[_0xb137('0xe')]);router[_0xb137('0xa')](_0xb137('0xf'),auth['isAuthenticated'](),controller['getUnread']);router['get'](_0xb137('0x10'),auth[_0xb137('0xb')](),controller[_0xb137('0x11')]);router[_0xb137('0xa')]('/:id/messages',auth[_0xb137('0xb')](),controller[_0xb137('0x12')]);router[_0xb137('0x13')]('/',auth[_0xb137('0xb')](),controller['create']);router[_0xb137('0x13')]('/:id/members',auth[_0xb137('0xb')](),controller[_0xb137('0x14')]);router[_0xb137('0x13')]('/:id/messages',auth[_0xb137('0xb')](),controller[_0xb137('0x15')]);router[_0xb137('0x16')](_0xb137('0xd'),auth[_0xb137('0xb')](),controller['update']);router['delete'](_0xb137('0xd'),auth['isAuthenticated'](),controller[_0xb137('0x17')]);router[_0xb137('0x18')](_0xb137('0x10'),auth[_0xb137('0xb')](),controller['removeMembers']);module[_0xb137('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8a6fec7..ce451c7 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 _0xbf69=['TEXT','STRING','DATE','long','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x2ad8ca,_0x460f25){var _0xd69040=function(_0x24e7a4){while(--_0x24e7a4){_0x2ad8ca['push'](_0x2ad8ca['shift']());}};_0xd69040(++_0x460f25);}(_0xbf69,0x94));var _0x9bf6=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xbf69[_0x4fdcc0];return _0xc0ce94;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x9bf6('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9bf6('0x1')]},'ratingType':{'type':Sequelize[_0x9bf6('0x2')](_0x9bf6('0x3'),_0x9bf6('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9bf6('0x5')]},'pathTranscript':{'type':Sequelize[_0x9bf6('0x5')]},'mailTranscript':{'type':Sequelize[_0x9bf6('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9bf6('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9bf6('0x6')]},'thirdDisposition':{'type':Sequelize[_0x9bf6('0x6')]},'note':{'type':Sequelize[_0x9bf6('0x6')]},'browserName':{'type':Sequelize[_0x9bf6('0x6')]},'browserVersion':{'type':Sequelize[_0x9bf6('0x6')]},'osName':{'type':Sequelize[_0x9bf6('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x9bf6('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9bf6('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x9bf6('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x9bf6('0x8'))},'read1stAt':{'type':Sequelize[_0x9bf6('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9bf6('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9bf6('0x6')]},'customerPort':{'type':Sequelize[_0x9bf6('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x9bf6('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x9bf6('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9bf6('0x1')]}}; \ No newline at end of file +var _0x948e=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','long','out'];(function(_0x168786,_0x332bc9){var _0xaf9c95=function(_0x7a4553){while(--_0x7a4553){_0x168786['push'](_0x168786['shift']());}};_0xaf9c95(++_0x332bc9);}(_0x948e,0xf2));var _0xe948=function(_0x1cc8ba,_0x576e90){_0x1cc8ba=_0x1cc8ba-0x0;var _0x29ead1=_0x948e[_0x1cc8ba];return _0x29ead1;};'use strict';var Sequelize=require('sequelize');module[_0xe948('0x0')]={'closed':{'type':Sequelize[_0xe948('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe948('0x2')]},'ratingType':{'type':Sequelize[_0xe948('0x3')](_0xe948('0x4'),_0xe948('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xe948('0x6')]},'pathTranscript':{'type':Sequelize[_0xe948('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe948('0x7')]},'disposition':{'type':Sequelize[_0xe948('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe948('0x8')]},'note':{'type':Sequelize[_0xe948('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xe948('0x8')]},'osName':{'type':Sequelize[_0xe948('0x8')]},'osVersion':{'type':Sequelize[_0xe948('0x8')]},'deviceModel':{'type':Sequelize[_0xe948('0x8')]},'deviceVendor':{'type':Sequelize[_0xe948('0x8')]},'deviceType':{'type':Sequelize[_0xe948('0x8')]},'referer':{'type':Sequelize[_0xe948('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe948('0x6')](_0xe948('0x9'))},'read1stAt':{'type':Sequelize[_0xe948('0x7')]},'lastMsgAt':{'type':Sequelize[_0xe948('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xe948('0x3')]('in',_0xe948('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe948('0x8')]},'customerPort':{'type':Sequelize[_0xe948('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xe948('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe948('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index eecac2f..d543af6 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 _0x1549=['push','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','firstName','lastName','direction','read','Account','Owner','get','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','count','json','destroy','sendStatus','stack','name','send','render','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','key','chat','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','include','find','create','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','UserId','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','merge','options','findAll','rows','getMyMessages','secret','includeAgent'];(function(_0x65afaa,_0x5a23fe){var _0x59c446=function(_0x78618e){while(--_0x78618e){_0x65afaa['push'](_0x65afaa['shift']());}};_0x59c446(++_0x5a23fe);}(_0x1549,0x1cb));var _0x9154=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x1549[_0x54ea7a];return _0x65a10d;};'use strict';var rimraf=require(_0x9154('0x0'));var zipdir=require(_0x9154('0x1'));var rp=require(_0x9154('0x2'));var moment=require(_0x9154('0x3'));var BPromise=require(_0x9154('0x4'));var Mustache=require(_0x9154('0x5'));var util=require(_0x9154('0x6'));var path=require(_0x9154('0x7'));var ejs=require(_0x9154('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x9154('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x9154('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x9154('0xb'))('api');var config=require(_0x9154('0xc'));var db=require(_0x9154('0xd'))['db'];config[_0x9154('0xe')]=_[_0x9154('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9154('0x10'))(new Redis(config[_0x9154('0xe')]));require('./chatInteraction.socket')[_0x9154('0x11')](socket);var jayson=require(_0x9154('0x12'));var client=jayson['client'][_0x9154('0x13')]({'port':0x232b});var client9004=jayson[_0x9154('0x14')][_0x9154('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x12e727,_0x480d02,_0x3926fb,_0x58d08c){return new BPromise(function(_0x1122e1,_0x990a68){var _0x199521=_0x58d08c||client;return _0x199521[_0x9154('0x15')](_0x12e727,_0x3926fb)[_0x9154('0x16')](function(_0x5da1b2){logger[_0x9154('0x17')](_0x9154('0x18'),_0x480d02,_0x9154('0x19'));logger[_0x9154('0x1a')](_0x9154('0x1b'),_0x480d02,_0x9154('0x19'),JSON[_0x9154('0x1c')](_0x5da1b2));if(_0x5da1b2[_0x9154('0x1d')]){if(_0x5da1b2['error'][_0x9154('0x1e')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x480d02,_0x5da1b2[_0x9154('0x1d')]['message']);return _0x990a68(_0x5da1b2[_0x9154('0x1d')][_0x9154('0x1f')]);}logger[_0x9154('0x1d')](_0x9154('0x18'),_0x480d02,_0x5da1b2[_0x9154('0x1d')][_0x9154('0x1f')]);return _0x1122e1(_0x5da1b2[_0x9154('0x1d')][_0x9154('0x1f')]);}else{logger['info'](_0x9154('0x18'),_0x480d02,_0x9154('0x19'));_0x1122e1(_0x5da1b2[_0x9154('0x20')][_0x9154('0x1f')]);}})[_0x9154('0x21')](function(_0x27aa70){logger[_0x9154('0x1d')](_0x9154('0x18'),_0x480d02,_0x27aa70);_0x990a68(_0x27aa70);});});}function respondWithStatusCode(_0x1415a4,_0xcf570b){_0xcf570b=_0xcf570b||0xcc;return function(_0x3ba803){if(_0x3ba803){return _0x1415a4['sendStatus'](_0xcf570b);}return _0x1415a4[_0x9154('0x22')](_0xcf570b)[_0x9154('0x23')]();};}function respondWithResult(_0xa18d8,_0x3e4d68){_0x3e4d68=_0x3e4d68||0xc8;return function(_0x409b0b){if(_0x409b0b){return _0xa18d8[_0x9154('0x22')](_0x3e4d68)['json'](_0x409b0b);}};}function respondWithFilteredResult(_0x1d3c58,_0x5b381c){return function(_0x277996){if(_0x277996){var _0x2bb37f=typeof _0x5b381c[_0x9154('0x24')]==='undefined'&&typeof _0x5b381c[_0x9154('0x25')]==='undefined';var _0x1a2f56=_0x277996['count'];var _0xe30931=_0x2bb37f?0x0:_0x5b381c['offset'];var _0x241b67=_0x2bb37f?_0x277996[_0x9154('0x26')]:_0x5b381c['offset']+_0x5b381c[_0x9154('0x25')];var _0x34f5c5;if(_0x241b67>=_0x1a2f56){_0x241b67=_0x1a2f56;_0x34f5c5=0xc8;}else{_0x34f5c5=0xce;}_0x1d3c58[_0x9154('0x22')](_0x34f5c5);return _0x1d3c58['set']('Content-Range',_0xe30931+'-'+_0x241b67+'/'+_0x1a2f56)[_0x9154('0x27')](_0x277996);}return null;};}function saveUpdates(_0x238941){return function(_0xc64388){if(_0xc64388){return _0xc64388['update'](_0x238941)[_0x9154('0x16')](function(_0x8708c4){return _0x8708c4;});}return null;};}function removeEntity(_0x17e5e2){return function(_0x1fcfca){if(_0x1fcfca){return _0x1fcfca[_0x9154('0x28')]()[_0x9154('0x16')](function(){_0x17e5e2[_0x9154('0x22')](0xcc)[_0x9154('0x23')]();});}};}function handleEntityNotFound(_0x3c71b7){return function(_0x48e0c4){if(!_0x48e0c4){_0x3c71b7[_0x9154('0x29')](0x194);}return _0x48e0c4;};}function handleError(_0x43f372,_0x5db49c){_0x5db49c=_0x5db49c||0x1f4;return function(_0x521da1){logger[_0x9154('0x1d')](_0x521da1[_0x9154('0x2a')]);if(_0x521da1[_0x9154('0x2b')]){delete _0x521da1['name'];}_0x43f372[_0x9154('0x22')](_0x5db49c)[_0x9154('0x2c')](_0x521da1);};}function getMustacheRender(_0x559eb6,_0x395f35){return Mustache[_0x9154('0x2d')](_0x559eb6,_['merge'](_0x395f35[_0x9154('0x2e')],{'contact':_0x395f35[_0x9154('0x2f')],'message':_0x395f35[_0x9154('0x1f')],'agent':_0x395f35[_0x9154('0x30')],'interaction':_0x395f35[_0x9154('0x31')],'account':_0x395f35[_0x9154('0x32')]}))||'';}exports[_0x9154('0x33')]=function(_0xd426d4,_0x53e3a3){var _0x10508f={};var _0x5e921a=_[_0x9154('0x34')](db[_0x9154('0x35')]['rawAttributes'],function(_0xc2d4f9){return{'name':_0xc2d4f9[_0x9154('0x36')],'type':_0xc2d4f9['type'][_0x9154('0x37')]};});_0x10508f=qs['getOptions'](_0x5e921a,_0xd426d4);return interaction['findAll'](_0x9154('0x38'),_0xd426d4['query'],_0xd426d4['user'],_0x10508f,_0x5e921a)[_0x9154('0x16')](respondWithFilteredResult(_0x53e3a3,_0x10508f))[_0x9154('0x21')](handleError(_0x53e3a3,null));};exports['show']=function(_0x463d35,_0x5b56d3){var _0x30233c={'raw':![],'where':{'id':_0x463d35[_0x9154('0x39')]['id']}},_0x1057c2={};_0x1057c2[_0x9154('0x3a')]=_[_0x9154('0x3b')](db[_0x9154('0x35')][_0x9154('0x3c')]);_0x1057c2[_0x9154('0x3d')]=_['keys'](_0x463d35[_0x9154('0x3d')]);_0x1057c2[_0x9154('0x3e')]=_['intersection'](_0x1057c2[_0x9154('0x3a')],_0x1057c2['query']);_0x30233c[_0x9154('0x3f')]=_['intersection'](_0x1057c2[_0x9154('0x3a')],qs[_0x9154('0x40')](_0x463d35[_0x9154('0x3d')][_0x9154('0x40')]));_0x30233c[_0x9154('0x3f')]=_0x30233c[_0x9154('0x3f')][_0x9154('0x41')]?_0x30233c[_0x9154('0x3f')]:_0x1057c2[_0x9154('0x3a')];if(_0x463d35[_0x9154('0x3d')][_0x9154('0x42')]){_0x30233c[_0x9154('0x43')]=[{'all':!![]}];}_0x30233c=_['merge']({},_0x30233c,_0x463d35['options']);return db[_0x9154('0x35')][_0x9154('0x44')](_0x30233c)[_0x9154('0x16')](handleEntityNotFound(_0x5b56d3,null))[_0x9154('0x16')](respondWithResult(_0x5b56d3,null))[_0x9154('0x21')](handleError(_0x5b56d3,null));};exports[_0x9154('0x45')]=function(_0x190db8,_0x480dc2){return db[_0x9154('0x35')][_0x9154('0x45')](_0x190db8[_0x9154('0x2e')],{})['then'](respondWithResult(_0x480dc2,0xc9))[_0x9154('0x21')](handleError(_0x480dc2,null));};exports['update']=function(_0x47c6a7,_0x38382c){if(_0x47c6a7[_0x9154('0x2e')]['id']){delete _0x47c6a7['body']['id'];}return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x47c6a7[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x38382c,null))[_0x9154('0x16')](saveUpdates(_0x47c6a7[_0x9154('0x2e')],null))[_0x9154('0x16')](respondWithResult(_0x38382c,null))[_0x9154('0x21')](handleError(_0x38382c,null));};exports[_0x9154('0x28')]=function(_0x115e6f,_0x18eab5){return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x115e6f[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x18eab5,null))[_0x9154('0x16')](removeEntity(_0x18eab5,null))[_0x9154('0x21')](handleError(_0x18eab5,null));};exports[_0x9154('0x46')]=function(_0x5d0b54,_0x1d366c){return db[_0x9154('0x35')]['describe']()[_0x9154('0x16')](respondWithResult(_0x1d366c,null))[_0x9154('0x21')](handleError(_0x1d366c,null));};exports[_0x9154('0x47')]=function(_0x4986ac,_0x15dee7){var _0x40dcb2=_0x4986ac[_0x9154('0x39')]['id'];var _0x240e3b;var _0x4da43c;var _0x5b5592;return db[_0x9154('0x35')]['findOne']({'where':{'id':_0x40dcb2}})[_0x9154('0x16')](function(_0x2bd06f){_0x240e3b=_0x2bd06f;return db[_0x9154('0x48')]['findOne']({'where':{'id':_0x2bd06f[_0x9154('0x49')]},'attributes':['id',_0x9154('0x4a'),_0x9154('0x4b'),_0x9154('0x4c'),_0x9154('0x4d'),'vidaooMetadata'],'raw':!![]});})[_0x9154('0x16')](function(_0xd0ab9f){if(_0xd0ab9f&&_0xd0ab9f[_0x9154('0x4a')]&&_0xd0ab9f[_0x9154('0x4b')]){_0x4da43c=_0xd0ab9f;var _0x4c9940={'interaction':{'id':_0x40dcb2},'agent':{'id':_0x4986ac[_0x9154('0x4e')]['id'],'name':_0x4986ac[_0x9154('0x4e')][_0x9154('0x2b')],'fullname':_0x4986ac[_0x9154('0x4e')]['fullname'],'email':_0x4986ac['user'][_0x9154('0x4f')]},'contact':_0x4986ac[_0x9154('0x2e')]['contact'],'account':_0x4986ac[_0x9154('0x2e')]['account']};var _0x1b83fb={'rejectUnauthorized':![],'method':_0x9154('0x50'),'url':_0x9154('0x51'),'headers':{'X-APIKEY':_0xd0ab9f[_0x9154('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4986ac[_0x9154('0x4e')][_0x9154('0x4f')]],'buttons':null,'topic':_0x4da43c[_0x9154('0x4c')],'note':_[_0x9154('0x52')](_0x4da43c[_0x9154('0x4d')])?null:getMustacheRender(_0x4da43c['vidaooNote'],_0x4c9940),'metadata':null},'redirect':_0x9154('0x53'),'json':!![]};try{if(!_[_0x9154('0x52')](_0x4da43c[_0x9154('0x54')])){var _0x5b8e85=getMustacheRender(_0x4da43c['vidaooMetadata'],_0x4c9940);var _0x2dbd59=JSON[_0x9154('0x55')](_0x5b8e85);_0x1b83fb[_0x9154('0x2e')][_0x9154('0x56')]=_0x2dbd59;}}catch(_0x1bc72f){throw new db[(_0x9154('0x57'))][(_0x9154('0x58'))](_0x9154('0x59'));}return rp(_0x1b83fb);}else{throw new db['Sequelize'][(_0x9154('0x58'))](_0x9154('0x5a'));}})[_0x9154('0x16')](function(_0x29003e){_0x5b5592=_0x29003e;if(_0x5b5592['id']){var _0x3cbb2d={'body':_0x5b5592['join_url'],'ChatWebsiteId':_0x4da43c['id'],'ChatInteractionId':_0x240e3b['id'],'direction':_0x9154('0x5b'),'UserId':_0x4986ac[_0x9154('0x4e')]['id']};return db[_0x9154('0x5c')]['create'](_0x3cbb2d,{});}else{throw new db[(_0x9154('0x57'))][(_0x9154('0x58'))](_0x9154('0x5d'));}})[_0x9154('0x16')](function(){return _0x240e3b[_0x9154('0x5e')]({'vidaooSessionId':_0x5b5592['id']});})[_0x9154('0x16')](respondWithResult(_0x15dee7,null))['catch'](handleError(_0x15dee7,null));};exports[_0x9154('0x5f')]=function(_0x190400,_0x1a15b4){if(_0x190400[_0x9154('0x2e')]['id']){delete _0x190400[_0x9154('0x2e')]['id'];}return db['ChatInteraction'][_0x9154('0x44')]({'where':{'id':_0x190400[_0x9154('0x39')]['id']},'include':[{'model':db[_0x9154('0x60')],'as':_0x9154('0x61')}]})[_0x9154('0x16')](handleEntityNotFound(_0x1a15b4,null))['then'](saveUpdates(_0x190400[_0x9154('0x2e')],null))[_0x9154('0x16')](respondWithResult(_0x1a15b4,null))[_0x9154('0x21')](handleError(_0x1a15b4,null));};exports[_0x9154('0x62')]=function(_0x581172,_0x2f1c4b){if(_0x581172['body']['id']){delete _0x581172['body']['id'];}return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x581172[_0x9154('0x39')]['id']}})['then'](function(_0x3168b0){if(!_0x3168b0){logger[_0x9154('0x1d')](_0x9154('0x63'),_0x9154('0x62'),0x194,_0x9154('0x64'));_0x2f1c4b['sendStatus'](0x194);}else{if(_0x3168b0['UserId']){throw new db[(_0x9154('0x57'))][(_0x9154('0x58'))](_0x9154('0x65'));}}return _0x3168b0;})['then'](function(_0x4bae65){if(_0x4bae65){return _0x4bae65[_0x9154('0x66')]({'closed':_0x581172[_0x9154('0x2e')][_0x9154('0x67')],'disposition':_0x581172['body'][_0x9154('0x68')]})[_0x9154('0x16')](function(_0x3bcff3){return _0x3bcff3;});}})['then'](function(){return respondWithRpcPromise(_0x9154('0x69'),_0x9154('0x62'),_0x581172[_0x9154('0x2e')],client9004);})['then'](respondWithResult(_0x2f1c4b,null))['catch'](handleError(_0x2f1c4b,null));};exports[_0x9154('0x6a')]=function(_0x1734d2,_0x367bf4){_0x1734d2[_0x9154('0x2e')][_0x9154('0x2b')]=_0x1734d2[_0x9154('0x6b')][_0x9154('0x6c')];_0x1734d2[_0x9154('0x2e')][_0x9154('0x6d')]=_0x1734d2[_0x9154('0x6b')]['filename'];_0x1734d2[_0x9154('0x2e')]['type']=_0x1734d2[_0x9154('0x6b')][_0x9154('0x6e')];return db[_0x9154('0x6f')]['create'](_0x1734d2[_0x9154('0x2e')])[_0x9154('0x16')](respondWithResult(_0x367bf4,0xc9))[_0x9154('0x21')](handleError(_0x367bf4,null));};exports[_0x9154('0x70')]=function(_0x1c1ac9,_0x395798){return db[_0x9154('0x35')][_0x9154('0x71')]({'where':{'id':_0x1c1ac9[_0x9154('0x39')]['id']},'raw':!![]})[_0x9154('0x16')](handleEntityNotFound(_0x395798,null))[_0x9154('0x16')](function(_0x23b208){if(_0x23b208){if(_0x23b208['closed']){return _0x395798[_0x9154('0x22')](0x193)['json']({'status':0x193,'message':_0x9154('0x72')});}return db[_0x9154('0x6f')][_0x9154('0x71')]({'where':{'id':_0x1c1ac9[_0x9154('0x3d')][_0x9154('0x73')]},'raw':!![]})[_0x9154('0x16')](handleEntityNotFound(_0x395798,null));}})[_0x9154('0x16')](function(_0x3508dd){if(_0x3508dd){var _0x38d1fe=_0x3508dd[_0x9154('0x74')]!==null;var _0xb61a90=path[_0x9154('0x75')](config[_0x9154('0x76')],_0x9154('0x77'));if(_0x38d1fe){_0xb61a90=path[_0x9154('0x75')](_0xb61a90,_0x9154('0x78'));}var _0x44f717=path['join'](_0xb61a90,_0x3508dd[_0x9154('0x6d')]);return _0x395798[_0x9154('0x79')](_0x44f717);}})[_0x9154('0x21')](handleError(_0x395798,null));};exports['close']=function(_0x33d971,_0x5c1097){var _0x7a5d0a=null;var _0x76e37c=null;var _0x45c155=null;if(_0x33d971['body']['id']){delete _0x33d971[_0x9154('0x2e')]['id'];}if(_0x33d971['body'][_0x9154('0x7a')]){_0x45c155=path[_0x9154('0x75')](config[_0x9154('0x76')],_0x9154('0x7b'),util[_0x9154('0x7c')](_0x9154('0x7d'),Date[_0x9154('0x7e')]()));_0x33d971[_0x9154('0x2e')][_0x9154('0x7f')]=_0x45c155;}return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x33d971['params']['id']},'include':[{'model':db[_0x9154('0x5c')],'as':_0x9154('0x80'),'include':[{'model':db['User'],'as':_0x9154('0x81')}]}]})['then'](handleEntityNotFound(_0x5c1097,null))[_0x9154('0x16')](saveUpdates(_0x33d971[_0x9154('0x2e')],null))['then'](function(_0x263fdf){if(_0x263fdf){_0x7a5d0a=_0x263fdf;return db[_0x9154('0x48')][_0x9154('0x44')]({'where':{'id':_0x7a5d0a[_0x9154('0x49')]}});}})[_0x9154('0x16')](function(_0x1ee947){if(_0x1ee947){_0x76e37c=_0x1ee947;return db[_0x9154('0x60')][_0x9154('0x44')]({'where':{'id':_0x7a5d0a[_0x9154('0x82')]}});}})[_0x9154('0x16')](function(_0x233ca3){if(_0x233ca3){if(_0x45c155){var _0x1692eb=null;for(var _0x288ac3=0x1;_0x288ac3<_0x7a5d0a[_0x9154('0x80')][_0x9154('0x41')];++_0x288ac3){_0x1692eb=_0x7a5d0a[_0x9154('0x80')][_0x288ac3];var _0x374a2e=_0x1692eb[_0x9154('0x83')]?util['format'](_0x9154('0x84'),_0x76e37c[_0x9154('0x85')],_0x1692eb['UserId']):'System';var _0x7ba787=_0x33d971['body'][_0x9154('0x86')]||util[_0x9154('0x7c')](_0x9154('0x84'),_0x9154('0x87'),_0x1692eb[_0x9154('0x82')]);switch(_0x76e37c[_0x9154('0x88')]){case _0x9154('0x89'):_0x374a2e=_0x1692eb['UserId']?util[_0x9154('0x7c')](_0x9154('0x84'),_0x76e37c[_0x9154('0x85')],_0x1692eb[_0x9154('0x83')]):_0x9154('0x8a');break;case _0x9154('0x8b'):_0x374a2e=_0x1692eb[_0x9154('0x83')]?_0x1692eb['User'][_0x9154('0x8c')]||_0x1692eb[_0x9154('0x81')][_0x9154('0x8d')]:_0x9154('0x8a');break;case'agent_fullname':_0x374a2e=_0x1692eb['UserId']?_0x1692eb[_0x9154('0x81')][_0x9154('0x8d')]:_0x9154('0x8a');break;default:_0x374a2e=_0x1692eb[_0x9154('0x83')]?util['format'](_0x9154('0x84'),_0x76e37c[_0x9154('0x85')],_0x1692eb['UserId']):_0x9154('0x8a');}var _0x45a956=util[_0x9154('0x7c')](_0x9154('0x8e'),moment(_0x1692eb[_0x9154('0x8f')])['format'](_0x9154('0x90')),_0x1692eb['direction']==='in'?_0x7ba787:_0x374a2e,_0x1692eb[_0x9154('0x2e')]);if(!_0x1692eb['secret']){fs['appendFileSync'](_0x45c155,_0x45a956);}}return db['MailAccount'][_0x9154('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0x9154('0x91')],'as':_0x9154('0x92'),'raw':!![],'include':[{'model':db[_0x9154('0x93')],'as':_0x9154('0x93'),'raw':!![]}]}]});}}})[_0x9154('0x16')](function(_0x2a3e13){if(!_0x2a3e13||!_0x2a3e13[_0x9154('0x92')]||!_0x33d971[_0x9154('0x2e')])return _0x7a5d0a;var _0x128de2=_0x2a3e13['getSmtpOptions']();return respondWithRpcPromise(_0x9154('0x94'),_0x9154('0x95'),{'account':_0x128de2,'message':{'from':util[_0x9154('0x7c')]('\x22%s\x22\x20<%s>',_0x2a3e13[_0x9154('0x2b')],_0x2a3e13['email']||_0x2a3e13['Smtp'][_0x9154('0x4e')]),'to':_0x33d971['body'][_0x9154('0x7a')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x33d971[_0x9154('0x2e')]['mailTranscript']),'attachments':[{'path':_0x45c155}]}})[_0x9154('0x16')](function(){return _0x7a5d0a;})[_0x9154('0x21')](function(_0x13ce4a){logger[_0x9154('0x1d')](_0x13ce4a);});})[_0x9154('0x16')](respondWithStatusCode(_0x5c1097,0xc8))[_0x9154('0x21')](handleError(_0x5c1097,null));};exports[_0x9154('0x96')]=function(_0x35a1d3,_0x13c65a){return db[_0x9154('0x5c')][_0x9154('0x44')]({'where':{'id':_0x35a1d3[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x13c65a,null))[_0x9154('0x16')](function(_0x12fb49){if(_0x12fb49){return _0x12fb49['addMessage'](_0x35a1d3[_0x9154('0x2e')][_0x9154('0x97')],_[_0x9154('0x98')](_0x35a1d3[_0x9154('0x2e')],['ids','id'])||{});}})['then'](respondWithResult(_0x13c65a,null))['catch'](handleError(_0x13c65a,null));};exports[_0x9154('0x99')]=function(_0x20d81b,_0x25cf1f){var _0x5e1780={'raw':![],'where':{}};var _0x2a400f={};var _0x5a4fb2={'count':0x0,'rows':[]};return db[_0x9154('0x35')][_0x9154('0x71')]({'where':{'id':_0x20d81b[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x25cf1f,null))[_0x9154('0x16')](function(_0x379b45){if(_0x379b45){_0x2a400f[_0x9154('0x3a')]=_[_0x9154('0x3b')](db[_0x9154('0x5c')][_0x9154('0x3c')]);_0x2a400f[_0x9154('0x3d')]=_[_0x9154('0x3b')](_0x20d81b[_0x9154('0x3d')]);_0x2a400f[_0x9154('0x3e')]=_['intersection'](_0x2a400f[_0x9154('0x3a')],_0x2a400f[_0x9154('0x3d')]);_0x5e1780[_0x9154('0x3f')]=_[_0x9154('0x9a')](_0x2a400f[_0x9154('0x3a')],qs[_0x9154('0x40')](_0x20d81b[_0x9154('0x3d')][_0x9154('0x40')]));_0x5e1780['attributes']=_0x5e1780[_0x9154('0x3f')]['length']?_0x5e1780['attributes']:_0x2a400f[_0x9154('0x3a')];if(!_0x20d81b['query'][_0x9154('0x9b')](_0x9154('0x9c'))){_0x5e1780[_0x9154('0x25')]=qs[_0x9154('0x25')](_0x20d81b[_0x9154('0x3d')]['limit']);_0x5e1780['offset']=qs['offset'](_0x20d81b[_0x9154('0x3d')][_0x9154('0x24')]);}_0x5e1780[_0x9154('0x9d')]=qs[_0x9154('0x9e')](_0x20d81b[_0x9154('0x3d')][_0x9154('0x9e')]);_0x5e1780[_0x9154('0x9f')]=qs[_0x9154('0x3e')](_[_0x9154('0xa0')](_0x20d81b[_0x9154('0x3d')],_0x2a400f[_0x9154('0x3e')]));_0x5e1780[_0x9154('0x9f')][_0x9154('0xa1')]=_0x379b45['id'];if(_0x20d81b['query'][_0x9154('0xa2')]){_0x5e1780[_0x9154('0x9f')]=_['merge'](_0x5e1780[_0x9154('0x9f')],{'$or':_[_0x9154('0x34')](_0x5e1780['attributes'],function(_0x307288){var _0x4126d0={};_0x4126d0[_0x307288]={'$like':'%'+_0x20d81b['query'][_0x9154('0xa2')]+'%'};return _0x4126d0;})});}if(_0x20d81b[_0x9154('0x3d')][_0x9154('0xa3')]){var _0x352790=_0x20d81b[_0x9154('0x3d')]['$gte']['split'](',');var _0x1d8cad={};_0x1d8cad[_0x352790[0x0]]={'$gte':moment(_0x352790[0x1])[_0x9154('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e1780[_0x9154('0x9f')]=_[_0x9154('0xa4')](_0x5e1780[_0x9154('0x9f')],_0x1d8cad);}_0x5e1780=_['merge']({},_0x5e1780,_0x20d81b[_0x9154('0xa5')]);return db[_0x9154('0x5c')][_0x9154('0x26')]({'where':_0x5e1780['where']})[_0x9154('0x16')](function(_0x105c29){_0x5a4fb2['count']=_0x105c29;if(_0x20d81b[_0x9154('0x3d')]['includeAll']){_0x5e1780[_0x9154('0x43')]=[{'all':!![]}];}return db[_0x9154('0x5c')][_0x9154('0xa6')](_0x5e1780);})[_0x9154('0x16')](function(_0x57ba33){_0x5a4fb2[_0x9154('0xa7')]=_0x57ba33;return _0x5a4fb2;});}})[_0x9154('0x16')](respondWithFilteredResult(_0x25cf1f,_0x5e1780))['catch'](handleError(_0x25cf1f,null));};exports[_0x9154('0xa8')]=function(_0x5d7486,_0x61c59){var _0x5e1e26={'where':{}},_0x3cefee={},_0x4bc8f={'count':0x0,'rows':[]};return db[_0x9154('0x35')][_0x9154('0x71')]({'where':{'id':_0x5d7486[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x61c59,null))[_0x9154('0x16')](function(_0x565115){if(_0x565115){_0x3cefee[_0x9154('0x3a')]=_[_0x9154('0x3b')](db['ChatMessage'][_0x9154('0x3c')]);_0x3cefee['query']=_[_0x9154('0x3b')](_0x5d7486[_0x9154('0x3d')]);_0x3cefee[_0x9154('0x3e')]=_['intersection'](_0x3cefee[_0x9154('0x3a')],_0x3cefee['query']);_0x5e1e26[_0x9154('0x3f')]=_[_0x9154('0x9a')](_0x3cefee[_0x9154('0x3a')],qs[_0x9154('0x40')](_0x5d7486[_0x9154('0x3d')][_0x9154('0x40')]));_0x5e1e26[_0x9154('0x3f')]=_0x5e1e26[_0x9154('0x3f')][_0x9154('0x41')]?_0x5e1e26[_0x9154('0x3f')]:_0x3cefee['model'];if(!_0x5d7486['query'][_0x9154('0x9b')]('nolimit')){_0x5e1e26[_0x9154('0x25')]=qs[_0x9154('0x25')](_0x5d7486['query'][_0x9154('0x25')]);_0x5e1e26['offset']=qs[_0x9154('0x24')](_0x5d7486[_0x9154('0x3d')][_0x9154('0x24')]);}_0x5e1e26['order']=qs[_0x9154('0x9e')](_0x5d7486[_0x9154('0x3d')]['sort']);_0x5e1e26[_0x9154('0x9f')]=qs[_0x9154('0x3e')](_[_0x9154('0xa0')](_0x5d7486[_0x9154('0x3d')],_0x3cefee['filters']));_0x5e1e26[_0x9154('0x9f')]['ChatInteractionId']=_0x565115['id'];if(_0x5d7486[_0x9154('0x3d')][_0x9154('0xa2')]){_0x5e1e26['where']=_[_0x9154('0xa4')](_0x5e1e26[_0x9154('0x9f')],{'$or':_[_0x9154('0x34')](_0x5e1e26[_0x9154('0x3f')],function(_0x4b7af8){var _0x2f8d08={};_0x2f8d08[_0x4b7af8]={'$like':'%'+_0x5d7486['query'][_0x9154('0xa2')]+'%'};return _0x2f8d08;})});}_0x5e1e26[_0x9154('0x9f')][_0x9154('0xa9')]=![];if(_0x5d7486[_0x9154('0x3d')]['id']){_0x5e1e26['where']['id']={'$gt':_0x5d7486[_0x9154('0x3d')]['id']};}_0x5e1e26=_[_0x9154('0xa4')]({},_0x5e1e26,_0x5d7486[_0x9154('0xa5')]);return db['ChatMessage']['count']({'where':_0x5e1e26[_0x9154('0x9f')]})[_0x9154('0x16')](function(_0x537b42){_0x4bc8f[_0x9154('0x26')]=_0x537b42;_0x5e1e26[_0x9154('0x43')]=[];if(_0x5d7486[_0x9154('0x3d')][_0x9154('0xaa')]){_0x5e1e26[_0x9154('0x43')][_0x9154('0xab')]({'model':db[_0x9154('0x81')],'as':_0x9154('0x81'),'attributes':['id','fullname',_0x9154('0x8c')]});}if(_0x5d7486[_0x9154('0x3d')][_0x9154('0x42')]){_0x5e1e26[_0x9154('0x43')]=[{'all':!![]}];}return db[_0x9154('0x5c')]['findAll'](_0x5e1e26);})[_0x9154('0x16')](function(_0x315d4f){_0x4bc8f[_0x9154('0xa7')]=_0x315d4f;return _0x4bc8f;});}})[_0x9154('0x16')](respondWithFilteredResult(_0x61c59,_0x5e1e26))[_0x9154('0x21')](handleError(_0x61c59,null));};exports[_0x9154('0xac')]=function(_0x83b945,_0x795992){return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x83b945[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x795992,null))[_0x9154('0x16')](function(_0x1cebb7){if(_0x1cebb7){return _0x1cebb7[_0x9154('0xad')](_0x83b945[_0x9154('0x2e')][_0x9154('0x97')],_[_0x9154('0x98')](_0x83b945[_0x9154('0x2e')],['ids','id'])||{})[_0x9154('0xae')](function(){return db['Tag']['findAll']({'attributes':['id',_0x9154('0x2b'),'color'],'where':{'id':_0x83b945[_0x9154('0x2e')]['ids']}});})[_0x9154('0x16')](function(_0x1742ae){socket[_0x9154('0xaf')](_0x9154('0xb0'),{'id':Number(_0x83b945[_0x9154('0x39')]['id']),'tags':_0x1742ae||[]});return{'id':Number(_0x83b945[_0x9154('0x39')]['id']),'tags':_0x1742ae||[]};});}})['then'](respondWithResult(_0x795992,null))[_0x9154('0x21')](handleError(_0x795992,null));};exports[_0x9154('0xb1')]=function(_0xdd6dea,_0x5c81e5){return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0xdd6dea[_0x9154('0x39')]['id']}})[_0x9154('0x16')](handleEntityNotFound(_0x5c81e5,null))['then'](function(_0x31bf25){if(_0x31bf25){return _0x31bf25[_0x9154('0xb1')](_0xdd6dea[_0x9154('0x3d')][_0x9154('0x97')]);}})['then'](respondWithStatusCode(_0x5c81e5,null))[_0x9154('0x21')](handleError(_0x5c81e5,null));};exports[_0x9154('0x79')]=function(_0x524ec3,_0x3b7920){var _0x29684c=moment()['unix']()[_0x9154('0xb2')]();var _0x24977e=path['join'](config[_0x9154('0x76')],_0x9154('0xb3'),_0x9154('0xb4'),_0x9154('0xb5'));var _0x30771e=path[_0x9154('0x75')](config[_0x9154('0x76')],'server',_0x9154('0xb4'),_0x9154('0xb6'));var _0x832ca1=path[_0x9154('0x75')](_0x24977e,_0x29684c);var _0x66ecf7=util[_0x9154('0x7c')]('transcript-%d-%s.zip',_0x524ec3[_0x9154('0x39')]['id'],_0x29684c);var _0x11082d=path['join'](_0x24977e,_0x66ecf7);var _0x1cf06a=[];_0x1cf06a['push']({'model':db[_0x9154('0x81')],'as':'User','attributes':['id',_0x9154('0x8d')],'raw':!![]});_0x1cf06a[_0x9154('0xab')]({'model':db['CmContact'],'as':_0x9154('0x61'),'attributes':['id',_0x9154('0xb7'),_0x9154('0xb8')],'raw':!![]});if(_0x524ec3[_0x9154('0x3d')][_0x9154('0xb6')]){_0x1cf06a['push']({'model':db[_0x9154('0x6f')],'as':_0x9154('0x6f'),'raw':!![]});}var _0x14bb58=[{'model':db[_0x9154('0x5c')],'as':'Messages','attributes':['id','body',_0x9154('0x8f'),_0x9154('0xb9'),_0x9154('0xa9'),_0x9154('0xba')],'include':_0x1cf06a}];_0x14bb58[_0x9154('0xab')]({'model':db[_0x9154('0x48')],'as':_0x9154('0xbb'),'attributes':['id',_0x9154('0x2b')]});_0x14bb58['push']({'model':db[_0x9154('0x81')],'as':_0x9154('0xbc'),'attributes':['id',_0x9154('0x8d')]});return db[_0x9154('0x35')][_0x9154('0x44')]({'where':{'id':_0x524ec3[_0x9154('0x39')]['id']},'include':_0x14bb58})[_0x9154('0x16')](handleEntityNotFound(_0x3b7920,null))[_0x9154('0x16')](function(_0x3acada){if(_0x3acada){var _0x4b6d98=_0x3acada[_0x9154('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x832ca1);var _0xd52451={'channel':_0x9154('0xbe'),'account':_0x4b6d98[_0x9154('0xbb')][_0x9154('0x2b')],'agent':_0x4b6d98[_0x9154('0xbc')]?_0x4b6d98[_0x9154('0xbc')][_0x9154('0x8d')]:_0x9154('0xbf'),'createdAt':moment(_0x4b6d98[_0x9154('0x8f')])[_0x9154('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9154('0xb2')](),'closedAt':_0x4b6d98['closed']?moment(_0x4b6d98[_0x9154('0xc0')])[_0x9154('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9154('0xb2')]():'','disposition':_0x4b6d98[_0x9154('0x68')],'chatInfo':{'browser':_0x4b6d98[_0x9154('0xc1')],'os':_0x4b6d98[_0x9154('0xc2')],'referer':_0x4b6d98[_0x9154('0xc3')],'customerIp':_0x4b6d98[_0x9154('0xc4')],'customerPort':_0x4b6d98[_0x9154('0xc5')]?_0x4b6d98[_0x9154('0xc5')]:_0x9154('0xbf')},'messages':_(_0x4b6d98[_0x9154('0x80')])[_0x9154('0xc6')]()[_0x9154('0xa2')]({'secret':![]})['map'](function(_0x526c43){if(_0x526c43['Attachment']){var _0x48da45=path[_0x9154('0x75')](_0x30771e,_0x526c43[_0x9154('0x6f')]['basename']);if(fs[_0x9154('0xc7')](_0x48da45)){fs['createReadStream'](_0x48da45)[_0x9154('0xc8')](fs[_0x9154('0xc9')](path[_0x9154('0x75')](_0x832ca1,_0x526c43['Attachment'][_0x9154('0x6d')])));}}return{'date':moment(_0x526c43[_0x9154('0x8f')])[_0x9154('0x7c')](_0x9154('0xca'))[_0x9154('0xb2')](),'sender':_0x526c43[_0x9154('0xb9')]==='out'?_0x526c43[_0x9154('0x81')]?_0x526c43[_0x9154('0x81')][_0x9154('0x8d')]:_0x9154('0x8a'):_0x526c43[_0x9154('0x61')][_0x9154('0xb7')]+(_0x526c43[_0x9154('0x61')][_0x9154('0xb8')]?'\x20'+_0x526c43[_0x9154('0x61')][_0x9154('0xb8')]:''),'body':_0x526c43['Attachment']?_0x526c43['Attachment'][_0x9154('0x6d')]:_0x526c43[_0x9154('0x2e')],'direction':_0x526c43[_0x9154('0xb9')]==='out'?'A':'C','secret':_0x526c43[_0x9154('0xa9')],'read':_0x526c43[_0x9154('0xba')],'attachment':_0x526c43[_0x9154('0x6f')]};})[_0x9154('0xcb')]()};return ejs['renderFile'](path[_0x9154('0x75')](config[_0x9154('0x76')],_0x9154('0xb3'),_0x9154('0xcc'),_0x9154('0xcd')),{'interaction':_0xd52451})[_0x9154('0x16')](function(_0x3d8e48){var _0x572381=path[_0x9154('0x75')](_0x832ca1,_0x9154('0xce')+_0x4b6d98['id']+'-'+_0x29684c+'.pdf');var _0x542ab0={'path':_0x572381,'channel':_0x9154('0xbe'),'interactionId':_0x4b6d98['id']};return pdf[_0x9154('0xcf')](_0x3d8e48,_0x542ab0);})[_0x9154('0x16')](function(){return new Promise(function(_0xeee78b,_0x368968){zipdir(_0x832ca1,{'saveTo':_0x11082d},function(_0xc0e77,_0x26aeae){if(_0xc0e77)return _0x368968(_0xc0e77);return _0xeee78b(_0x26aeae);});})[_0x9154('0x16')](function(){return new BPromise(function(_0x20e865,_0x73115f){rimraf(_0x832ca1,function(_0x1e616b){if(_0x1e616b)_0x73115f(_0x1e616b);return _0x20e865();});});})[_0x9154('0x16')](function(){return _0x3b7920[_0x9154('0x79')](_0x11082d,_0x66ecf7,function(_0xa0685a){if(_0xa0685a){logger[_0x9154('0x1d')](_0x9154('0xd0'),_0xa0685a);}else{fs[_0x9154('0xd1')](_0x11082d);}});});});}else{return _0x3b7920['sendStatus'](0xc8);}})[_0x9154('0x21')](handleError(_0x3b7920,null));}; \ No newline at end of file +var _0xc573=['Attachment','Unauthorized','attachId','ChatOfflineMessageId','root','join','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','filter','$gte','where','rows','keys','map','includeAgent','push','alias','findAll','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','direction','read','Account','Owner','get','closedAt','browserName','referer','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','firstName','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','unlinkSync','rimraf','moment','bluebird','mustache','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','jayson/promise','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','undefined','offset','count','limit','Content-Range','json','update','destroy','end','name','send','render','merge','body','interaction','account','ChatInteraction','rawAttributes','fieldName','type','key','query','show','params','model','filters','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooMetadata','user','fullname','email','contact','POST','isNull','vidaooNote','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','mimetype'];(function(_0x341aaa,_0x206a30){var _0x68b88b=function(_0x500ea2){while(--_0x500ea2){_0x341aaa['push'](_0x341aaa['shift']());}};_0x68b88b(++_0x206a30);}(_0xc573,0x65));var _0x3c57=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xc573[_0x5f0089];return _0x193892;};'use strict';var rimraf=require(_0x3c57('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require(_0x3c57('0x1'));var BPromise=require(_0x3c57('0x2'));var Mustache=require(_0x3c57('0x3'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c57('0x4'));var Redis=require(_0x3c57('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x3c57('0x6'));var pdf=require(_0x3c57('0x7'));var logger=require(_0x3c57('0x8'))(_0x3c57('0x9'));var config=require(_0x3c57('0xa'));var db=require(_0x3c57('0xb'))['db'];config['redis']=_[_0x3c57('0xc')](config[_0x3c57('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x3c57('0xe'));var client=jayson[_0x3c57('0xf')]['http']({'port':0x232b});var client9004=jayson[_0x3c57('0xf')]['http']({'port':0x232c});function respondWithRpcPromise(_0x515c54,_0x288de8,_0x5d7326,_0x43d66d){return new BPromise(function(_0x4cdaf2,_0x2efe1b){var _0x2564b9=_0x43d66d||client;return _0x2564b9[_0x3c57('0x10')](_0x515c54,_0x5d7326)[_0x3c57('0x11')](function(_0x596931){logger[_0x3c57('0x12')](_0x3c57('0x13'),_0x288de8,'request\x20sent');logger[_0x3c57('0x14')](_0x3c57('0x15'),_0x288de8,_0x3c57('0x16'),JSON[_0x3c57('0x17')](_0x596931));if(_0x596931[_0x3c57('0x18')]){if(_0x596931[_0x3c57('0x18')]['code']===0x1f4){logger[_0x3c57('0x18')](_0x3c57('0x13'),_0x288de8,_0x596931['error']['message']);return _0x2efe1b(_0x596931[_0x3c57('0x18')][_0x3c57('0x19')]);}logger[_0x3c57('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x288de8,_0x596931[_0x3c57('0x18')][_0x3c57('0x19')]);return _0x4cdaf2(_0x596931[_0x3c57('0x18')][_0x3c57('0x19')]);}else{logger[_0x3c57('0x12')](_0x3c57('0x13'),_0x288de8,_0x3c57('0x16'));_0x4cdaf2(_0x596931[_0x3c57('0x1a')][_0x3c57('0x19')]);}})[_0x3c57('0x1b')](function(_0x71656e){logger[_0x3c57('0x18')](_0x3c57('0x13'),_0x288de8,_0x71656e);_0x2efe1b(_0x71656e);});});}function respondWithStatusCode(_0x3f98ed,_0xcbb985){_0xcbb985=_0xcbb985||0xcc;return function(_0x1c3bd6){if(_0x1c3bd6){return _0x3f98ed[_0x3c57('0x1c')](_0xcbb985);}return _0x3f98ed[_0x3c57('0x1d')](_0xcbb985)['end']();};}function respondWithResult(_0x18808a,_0x285af9){_0x285af9=_0x285af9||0xc8;return function(_0x281086){if(_0x281086){return _0x18808a[_0x3c57('0x1d')](_0x285af9)['json'](_0x281086);}};}function respondWithFilteredResult(_0x23c0c0,_0x1b71b4){return function(_0x7a416){if(_0x7a416){var _0x1bde06=typeof _0x1b71b4['offset']===_0x3c57('0x1e')&&typeof _0x1b71b4['limit']===_0x3c57('0x1e');var _0x30d79b=_0x7a416['count'];var _0x445ed6=_0x1bde06?0x0:_0x1b71b4[_0x3c57('0x1f')];var _0x15639e=_0x1bde06?_0x7a416[_0x3c57('0x20')]:_0x1b71b4['offset']+_0x1b71b4[_0x3c57('0x21')];var _0x30a5ba;if(_0x15639e>=_0x30d79b){_0x15639e=_0x30d79b;_0x30a5ba=0xc8;}else{_0x30a5ba=0xce;}_0x23c0c0[_0x3c57('0x1d')](_0x30a5ba);return _0x23c0c0['set'](_0x3c57('0x22'),_0x445ed6+'-'+_0x15639e+'/'+_0x30d79b)[_0x3c57('0x23')](_0x7a416);}return null;};}function saveUpdates(_0x2cde8c){return function(_0x29bf56){if(_0x29bf56){return _0x29bf56[_0x3c57('0x24')](_0x2cde8c)[_0x3c57('0x11')](function(_0x41546d){return _0x41546d;});}return null;};}function removeEntity(_0x4f2f58){return function(_0x5d585f){if(_0x5d585f){return _0x5d585f[_0x3c57('0x25')]()[_0x3c57('0x11')](function(){_0x4f2f58[_0x3c57('0x1d')](0xcc)[_0x3c57('0x26')]();});}};}function handleEntityNotFound(_0x2b48c8){return function(_0x4cf157){if(!_0x4cf157){_0x2b48c8[_0x3c57('0x1c')](0x194);}return _0x4cf157;};}function handleError(_0x2de1e5,_0x7e0f48){_0x7e0f48=_0x7e0f48||0x1f4;return function(_0x5cd90a){logger[_0x3c57('0x18')](_0x5cd90a['stack']);if(_0x5cd90a[_0x3c57('0x27')]){delete _0x5cd90a[_0x3c57('0x27')];}_0x2de1e5[_0x3c57('0x1d')](_0x7e0f48)[_0x3c57('0x28')](_0x5cd90a);};}function getMustacheRender(_0xab2645,_0x337e3e){return Mustache[_0x3c57('0x29')](_0xab2645,_[_0x3c57('0x2a')](_0x337e3e[_0x3c57('0x2b')],{'contact':_0x337e3e['contact'],'message':_0x337e3e['message'],'agent':_0x337e3e['agent'],'interaction':_0x337e3e[_0x3c57('0x2c')],'account':_0x337e3e[_0x3c57('0x2d')]}))||'';}exports['index']=function(_0x252d7a,_0x18f8c8){var _0x4f2993={};var _0x28e1dd=_['map'](db[_0x3c57('0x2e')][_0x3c57('0x2f')],function(_0x5678c8){return{'name':_0x5678c8[_0x3c57('0x30')],'type':_0x5678c8[_0x3c57('0x31')][_0x3c57('0x32')]};});_0x4f2993=qs['getOptions'](_0x28e1dd,_0x252d7a);return interaction['findAll']('chat',_0x252d7a[_0x3c57('0x33')],_0x252d7a['user'],_0x4f2993,_0x28e1dd)[_0x3c57('0x11')](respondWithFilteredResult(_0x18f8c8,_0x4f2993))[_0x3c57('0x1b')](handleError(_0x18f8c8,null));};exports[_0x3c57('0x34')]=function(_0x174143,_0x32c5cc){var _0x3c21e3={'raw':![],'where':{'id':_0x174143[_0x3c57('0x35')]['id']}},_0x46aa3c={};_0x46aa3c[_0x3c57('0x36')]=_['keys'](db[_0x3c57('0x2e')][_0x3c57('0x2f')]);_0x46aa3c[_0x3c57('0x33')]=_['keys'](_0x174143[_0x3c57('0x33')]);_0x46aa3c[_0x3c57('0x37')]=_['intersection'](_0x46aa3c[_0x3c57('0x36')],_0x46aa3c['query']);_0x3c21e3[_0x3c57('0x38')]=_['intersection'](_0x46aa3c[_0x3c57('0x36')],qs['fields'](_0x174143[_0x3c57('0x33')][_0x3c57('0x39')]));_0x3c21e3[_0x3c57('0x38')]=_0x3c21e3[_0x3c57('0x38')][_0x3c57('0x3a')]?_0x3c21e3[_0x3c57('0x38')]:_0x46aa3c[_0x3c57('0x36')];if(_0x174143[_0x3c57('0x33')][_0x3c57('0x3b')]){_0x3c21e3[_0x3c57('0x3c')]=[{'all':!![]}];}_0x3c21e3=_[_0x3c57('0x2a')]({},_0x3c21e3,_0x174143[_0x3c57('0x3d')]);return db[_0x3c57('0x2e')][_0x3c57('0x3e')](_0x3c21e3)[_0x3c57('0x11')](handleEntityNotFound(_0x32c5cc,null))['then'](respondWithResult(_0x32c5cc,null))[_0x3c57('0x1b')](handleError(_0x32c5cc,null));};exports[_0x3c57('0x3f')]=function(_0x5e8b93,_0x5dcff5){return db[_0x3c57('0x2e')][_0x3c57('0x3f')](_0x5e8b93['body'],{})[_0x3c57('0x11')](respondWithResult(_0x5dcff5,0xc9))[_0x3c57('0x1b')](handleError(_0x5dcff5,null));};exports[_0x3c57('0x24')]=function(_0x15c831,_0x213966){if(_0x15c831[_0x3c57('0x2b')]['id']){delete _0x15c831[_0x3c57('0x2b')]['id'];}return db[_0x3c57('0x2e')][_0x3c57('0x3e')]({'where':{'id':_0x15c831[_0x3c57('0x35')]['id']}})[_0x3c57('0x11')](handleEntityNotFound(_0x213966,null))[_0x3c57('0x11')](saveUpdates(_0x15c831['body'],null))[_0x3c57('0x11')](respondWithResult(_0x213966,null))[_0x3c57('0x1b')](handleError(_0x213966,null));};exports[_0x3c57('0x25')]=function(_0x14d039,_0x543d91){return db[_0x3c57('0x2e')][_0x3c57('0x3e')]({'where':{'id':_0x14d039[_0x3c57('0x35')]['id']}})['then'](handleEntityNotFound(_0x543d91,null))['then'](removeEntity(_0x543d91,null))[_0x3c57('0x1b')](handleError(_0x543d91,null));};exports['describe']=function(_0x52c00f,_0xd8c41f){return db[_0x3c57('0x2e')][_0x3c57('0x40')]()[_0x3c57('0x11')](respondWithResult(_0xd8c41f,null))['catch'](handleError(_0xd8c41f,null));};exports[_0x3c57('0x41')]=function(_0x232599,_0x3aa734){var _0x10cd5b=_0x232599[_0x3c57('0x35')]['id'];var _0x51ab02;var _0x18d0d9;var _0x53d9d6;return db['ChatInteraction'][_0x3c57('0x42')]({'where':{'id':_0x10cd5b}})[_0x3c57('0x11')](function(_0x283593){_0x51ab02=_0x283593;return db[_0x3c57('0x43')][_0x3c57('0x42')]({'where':{'id':_0x283593[_0x3c57('0x44')]},'attributes':['id',_0x3c57('0x45'),_0x3c57('0x46'),'vidaooTopic','vidaooNote',_0x3c57('0x47')],'raw':!![]});})['then'](function(_0xc9ac34){if(_0xc9ac34&&_0xc9ac34[_0x3c57('0x45')]&&_0xc9ac34[_0x3c57('0x46')]){_0x18d0d9=_0xc9ac34;var _0x1c92d3={'interaction':{'id':_0x10cd5b},'agent':{'id':_0x232599['user']['id'],'name':_0x232599[_0x3c57('0x48')][_0x3c57('0x27')],'fullname':_0x232599[_0x3c57('0x48')][_0x3c57('0x49')],'email':_0x232599[_0x3c57('0x48')][_0x3c57('0x4a')]},'contact':_0x232599[_0x3c57('0x2b')][_0x3c57('0x4b')],'account':_0x232599[_0x3c57('0x2b')][_0x3c57('0x2d')]};var _0x26d001={'rejectUnauthorized':![],'method':_0x3c57('0x4c'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xc9ac34[_0x3c57('0x45')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x232599[_0x3c57('0x48')][_0x3c57('0x4a')]],'buttons':null,'topic':_0x18d0d9['vidaooTopic'],'note':_[_0x3c57('0x4d')](_0x18d0d9['vidaooNote'])?null:getMustacheRender(_0x18d0d9[_0x3c57('0x4e')],_0x1c92d3),'metadata':null},'redirect':_0x3c57('0x4f'),'json':!![]};try{if(!_[_0x3c57('0x4d')](_0x18d0d9[_0x3c57('0x47')])){var _0x23869b=getMustacheRender(_0x18d0d9[_0x3c57('0x47')],_0x1c92d3);var _0x3ccf3d=JSON[_0x3c57('0x50')](_0x23869b);_0x26d001[_0x3c57('0x2b')][_0x3c57('0x51')]=_0x3ccf3d;}}catch(_0x3d7062){throw new db[(_0x3c57('0x52'))]['ValidationError'](_0x3c57('0x53'));}return rp(_0x26d001);}else{throw new db['Sequelize'][(_0x3c57('0x54'))](_0x3c57('0x55'));}})[_0x3c57('0x11')](function(_0x412ca4){_0x53d9d6=_0x412ca4;if(_0x53d9d6['id']){var _0x25d2c6={'body':_0x53d9d6[_0x3c57('0x56')],'ChatWebsiteId':_0x18d0d9['id'],'ChatInteractionId':_0x51ab02['id'],'direction':_0x3c57('0x57'),'UserId':_0x232599['user']['id']};return db[_0x3c57('0x58')][_0x3c57('0x3f')](_0x25d2c6,{});}else{throw new db[(_0x3c57('0x52'))][(_0x3c57('0x54'))](_0x3c57('0x59'));}})[_0x3c57('0x11')](function(){return _0x51ab02[_0x3c57('0x5a')]({'vidaooSessionId':_0x53d9d6['id']});})[_0x3c57('0x11')](respondWithResult(_0x3aa734,null))[_0x3c57('0x1b')](handleError(_0x3aa734,null));};exports['customUpdate']=function(_0xfdd75b,_0x1db6c5){if(_0xfdd75b[_0x3c57('0x2b')]['id']){delete _0xfdd75b[_0x3c57('0x2b')]['id'];}return db[_0x3c57('0x2e')][_0x3c57('0x3e')]({'where':{'id':_0xfdd75b[_0x3c57('0x35')]['id']},'include':[{'model':db['CmContact'],'as':_0x3c57('0x5b')}]})[_0x3c57('0x11')](handleEntityNotFound(_0x1db6c5,null))[_0x3c57('0x11')](saveUpdates(_0xfdd75b[_0x3c57('0x2b')],null))[_0x3c57('0x11')](respondWithResult(_0x1db6c5,null))[_0x3c57('0x1b')](handleError(_0x1db6c5,null));};exports[_0x3c57('0x5c')]=function(_0x2b21f3,_0x308bfd){if(_0x2b21f3[_0x3c57('0x2b')]['id']){delete _0x2b21f3[_0x3c57('0x2b')]['id'];}return db[_0x3c57('0x2e')][_0x3c57('0x3e')]({'where':{'id':_0x2b21f3[_0x3c57('0x35')]['id']}})[_0x3c57('0x11')](function(_0x278486){if(!_0x278486){logger[_0x3c57('0x18')](_0x3c57('0x5d'),'abandon',0x194,'entity\x20not\x20found');_0x308bfd['sendStatus'](0x194);}else{if(_0x278486[_0x3c57('0x5e')]){throw new db[(_0x3c57('0x52'))][(_0x3c57('0x54'))](_0x3c57('0x5f'));}}return _0x278486;})[_0x3c57('0x11')](function(_0x5899be){if(_0x5899be){return _0x5899be[_0x3c57('0x24')]({'closed':_0x2b21f3[_0x3c57('0x2b')][_0x3c57('0x60')],'disposition':_0x2b21f3[_0x3c57('0x2b')][_0x3c57('0x61')]})[_0x3c57('0x11')](function(_0x480bfa){return _0x480bfa;});}})[_0x3c57('0x11')](function(){return respondWithRpcPromise(_0x3c57('0x62'),'abandon',_0x2b21f3[_0x3c57('0x2b')],client9004);})[_0x3c57('0x11')](respondWithResult(_0x308bfd,null))[_0x3c57('0x1b')](handleError(_0x308bfd,null));};exports[_0x3c57('0x63')]=function(_0xa0103c,_0x20c238){_0xa0103c['body'][_0x3c57('0x27')]=_0xa0103c['file']['originalname'];_0xa0103c['body']['basename']=_0xa0103c[_0x3c57('0x64')]['filename'];_0xa0103c[_0x3c57('0x2b')][_0x3c57('0x31')]=_0xa0103c[_0x3c57('0x64')][_0x3c57('0x65')];return db[_0x3c57('0x66')]['create'](_0xa0103c['body'])[_0x3c57('0x11')](respondWithResult(_0x20c238,0xc9))[_0x3c57('0x1b')](handleError(_0x20c238,null));};exports['attachmentDownload']=function(_0x49abf6,_0x56d987){return db['ChatInteraction'][_0x3c57('0x42')]({'where':{'id':_0x49abf6[_0x3c57('0x35')]['id']},'raw':!![]})[_0x3c57('0x11')](handleEntityNotFound(_0x56d987,null))[_0x3c57('0x11')](function(_0xb9269c){if(_0xb9269c){if(_0xb9269c['closed']){return _0x56d987[_0x3c57('0x1d')](0x193)[_0x3c57('0x23')]({'status':0x193,'message':_0x3c57('0x67')});}return db[_0x3c57('0x66')][_0x3c57('0x42')]({'where':{'id':_0x49abf6['query'][_0x3c57('0x68')]},'raw':!![]})[_0x3c57('0x11')](handleEntityNotFound(_0x56d987,null));}})[_0x3c57('0x11')](function(_0x8d24ab){if(_0x8d24ab){var _0x584970=_0x8d24ab[_0x3c57('0x69')]!==null;var _0x4c9ab5=path['join'](config[_0x3c57('0x6a')],'server/files/attachments/');if(_0x584970){_0x4c9ab5=path[_0x3c57('0x6b')](_0x4c9ab5,_0x3c57('0x6c'));}var _0x2f9a0a=path[_0x3c57('0x6b')](_0x4c9ab5,_0x8d24ab[_0x3c57('0x6d')]);return _0x56d987[_0x3c57('0x6e')](_0x2f9a0a);}})[_0x3c57('0x1b')](handleError(_0x56d987,null));};exports[_0x3c57('0x6f')]=function(_0x4675e7,_0x36e195){var _0x42cc23=null;var _0x557f0d=null;var _0x4028e2=null;if(_0x4675e7[_0x3c57('0x2b')]['id']){delete _0x4675e7['body']['id'];}if(_0x4675e7['body'][_0x3c57('0x70')]){_0x4028e2=path['join'](config['root'],_0x3c57('0x71'),util[_0x3c57('0x72')](_0x3c57('0x73'),Date[_0x3c57('0x74')]()));_0x4675e7[_0x3c57('0x2b')][_0x3c57('0x75')]=_0x4028e2;}return db['ChatInteraction'][_0x3c57('0x3e')]({'where':{'id':_0x4675e7[_0x3c57('0x35')]['id']},'include':[{'model':db[_0x3c57('0x58')],'as':_0x3c57('0x76'),'include':[{'model':db[_0x3c57('0x77')],'as':_0x3c57('0x77')}]}]})['then'](handleEntityNotFound(_0x36e195,null))[_0x3c57('0x11')](saveUpdates(_0x4675e7[_0x3c57('0x2b')],null))[_0x3c57('0x11')](function(_0x376deb){if(_0x376deb){_0x42cc23=_0x376deb;return db['ChatWebsite']['find']({'where':{'id':_0x42cc23[_0x3c57('0x44')]}});}})[_0x3c57('0x11')](function(_0x54d452){if(_0x54d452){_0x557f0d=_0x54d452;return db[_0x3c57('0x78')][_0x3c57('0x3e')]({'where':{'id':_0x42cc23[_0x3c57('0x79')]}});}})[_0x3c57('0x11')](function(_0x5f16de){if(_0x5f16de){if(_0x4028e2){var _0x5df70e=null;for(var _0x17b6fc=0x1;_0x17b6fc<_0x42cc23[_0x3c57('0x76')][_0x3c57('0x3a')];++_0x17b6fc){_0x5df70e=_0x42cc23[_0x3c57('0x76')][_0x17b6fc];var _0x34ee28=_0x5df70e[_0x3c57('0x5e')]?util[_0x3c57('0x72')]('%s%d',_0x557f0d[_0x3c57('0x7a')],_0x5df70e[_0x3c57('0x5e')]):_0x3c57('0x7b');var _0x1d0a64=_0x4675e7['body'][_0x3c57('0x7c')]||util[_0x3c57('0x72')](_0x3c57('0x7d'),_0x3c57('0x7e'),_0x5df70e[_0x3c57('0x79')]);switch(_0x557f0d['agentIdentifier']){case _0x3c57('0x7f'):_0x34ee28=_0x5df70e[_0x3c57('0x5e')]?util[_0x3c57('0x72')](_0x3c57('0x7d'),_0x557f0d[_0x3c57('0x7a')],_0x5df70e[_0x3c57('0x5e')]):_0x3c57('0x7b');break;case _0x3c57('0x80'):_0x34ee28=_0x5df70e[_0x3c57('0x5e')]?_0x5df70e[_0x3c57('0x77')]['alias']||_0x5df70e[_0x3c57('0x77')][_0x3c57('0x49')]:_0x3c57('0x7b');break;case _0x3c57('0x81'):_0x34ee28=_0x5df70e['UserId']?_0x5df70e[_0x3c57('0x77')]['fullname']:_0x3c57('0x7b');break;default:_0x34ee28=_0x5df70e['UserId']?util[_0x3c57('0x72')](_0x3c57('0x7d'),_0x557f0d[_0x3c57('0x7a')],_0x5df70e[_0x3c57('0x5e')]):_0x3c57('0x7b');}var _0x1eea55=util[_0x3c57('0x72')]('[%s]\x20%s:\x20%s\x0a',moment(_0x5df70e[_0x3c57('0x82')])[_0x3c57('0x72')](_0x3c57('0x83')),_0x5df70e['direction']==='in'?_0x1d0a64:_0x34ee28,_0x5df70e[_0x3c57('0x2b')]);if(!_0x5df70e[_0x3c57('0x84')]){fs[_0x3c57('0x85')](_0x4028e2,_0x1eea55);}}return db[_0x3c57('0x86')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3c57('0x87'),'raw':!![],'include':[{'model':db[_0x3c57('0x88')],'as':_0x3c57('0x88'),'raw':!![]}]}]});}}})[_0x3c57('0x11')](function(_0x21fae0){if(!_0x21fae0||!_0x21fae0[_0x3c57('0x87')]||!_0x4675e7[_0x3c57('0x2b')])return _0x42cc23;var _0x4e6150=_0x21fae0[_0x3c57('0x89')]();return respondWithRpcPromise('SendMail',_0x3c57('0x8a'),{'account':_0x4e6150,'message':{'from':util[_0x3c57('0x72')](_0x3c57('0x8b'),_0x21fae0['name'],_0x21fae0['email']||_0x21fae0[_0x3c57('0x87')][_0x3c57('0x48')]),'to':_0x4675e7[_0x3c57('0x2b')][_0x3c57('0x70')],'subject':_0x3c57('0x8c'),'text':util[_0x3c57('0x72')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4675e7['body'][_0x3c57('0x70')]),'attachments':[{'path':_0x4028e2}]}})[_0x3c57('0x11')](function(){return _0x42cc23;})[_0x3c57('0x1b')](function(_0xfe1b4b){logger['error'](_0xfe1b4b);});})[_0x3c57('0x11')](respondWithStatusCode(_0x36e195,0xc8))[_0x3c57('0x1b')](handleError(_0x36e195,null));};exports[_0x3c57('0x8d')]=function(_0x4021b3,_0x489dbe){return db[_0x3c57('0x58')]['find']({'where':{'id':_0x4021b3[_0x3c57('0x35')]['id']}})[_0x3c57('0x11')](handleEntityNotFound(_0x489dbe,null))[_0x3c57('0x11')](function(_0x5702fe){if(_0x5702fe){return _0x5702fe[_0x3c57('0x8d')](_0x4021b3[_0x3c57('0x2b')][_0x3c57('0x8e')],_[_0x3c57('0x8f')](_0x4021b3['body'],[_0x3c57('0x8e'),'id'])||{});}})[_0x3c57('0x11')](respondWithResult(_0x489dbe,null))[_0x3c57('0x1b')](handleError(_0x489dbe,null));};exports[_0x3c57('0x90')]=function(_0x21b4b4,_0x12a933){var _0x2bf86b={'raw':![],'where':{}};var _0x42cbf6={};var _0x3be245={'count':0x0,'rows':[]};return db[_0x3c57('0x2e')][_0x3c57('0x42')]({'where':{'id':_0x21b4b4['params']['id']}})['then'](handleEntityNotFound(_0x12a933,null))[_0x3c57('0x11')](function(_0x4505e0){if(_0x4505e0){_0x42cbf6[_0x3c57('0x36')]=_['keys'](db['ChatMessage'][_0x3c57('0x2f')]);_0x42cbf6[_0x3c57('0x33')]=_['keys'](_0x21b4b4[_0x3c57('0x33')]);_0x42cbf6[_0x3c57('0x37')]=_[_0x3c57('0x91')](_0x42cbf6[_0x3c57('0x36')],_0x42cbf6[_0x3c57('0x33')]);_0x2bf86b[_0x3c57('0x38')]=_['intersection'](_0x42cbf6[_0x3c57('0x36')],qs[_0x3c57('0x39')](_0x21b4b4['query'][_0x3c57('0x39')]));_0x2bf86b['attributes']=_0x2bf86b['attributes']['length']?_0x2bf86b['attributes']:_0x42cbf6['model'];if(!_0x21b4b4[_0x3c57('0x33')][_0x3c57('0x92')](_0x3c57('0x93'))){_0x2bf86b[_0x3c57('0x21')]=qs[_0x3c57('0x21')](_0x21b4b4['query'][_0x3c57('0x21')]);_0x2bf86b[_0x3c57('0x1f')]=qs[_0x3c57('0x1f')](_0x21b4b4[_0x3c57('0x33')][_0x3c57('0x1f')]);}_0x2bf86b[_0x3c57('0x94')]=qs[_0x3c57('0x95')](_0x21b4b4[_0x3c57('0x33')]['sort']);_0x2bf86b['where']=qs[_0x3c57('0x37')](_[_0x3c57('0x96')](_0x21b4b4[_0x3c57('0x33')],_0x42cbf6[_0x3c57('0x37')]));_0x2bf86b['where'][_0x3c57('0x97')]=_0x4505e0['id'];if(_0x21b4b4[_0x3c57('0x33')][_0x3c57('0x98')]){_0x2bf86b['where']=_[_0x3c57('0x2a')](_0x2bf86b['where'],{'$or':_['map'](_0x2bf86b[_0x3c57('0x38')],function(_0x38a279){var _0x518953={};_0x518953[_0x38a279]={'$like':'%'+_0x21b4b4[_0x3c57('0x33')][_0x3c57('0x98')]+'%'};return _0x518953;})});}if(_0x21b4b4['query'][_0x3c57('0x99')]){var _0x1596c3=_0x21b4b4[_0x3c57('0x33')][_0x3c57('0x99')]['split'](',');var _0xec3cb={};_0xec3cb[_0x1596c3[0x0]]={'$gte':moment(_0x1596c3[0x1])[_0x3c57('0x72')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2bf86b['where']=_[_0x3c57('0x2a')](_0x2bf86b['where'],_0xec3cb);}_0x2bf86b=_[_0x3c57('0x2a')]({},_0x2bf86b,_0x21b4b4[_0x3c57('0x3d')]);return db[_0x3c57('0x58')][_0x3c57('0x20')]({'where':_0x2bf86b[_0x3c57('0x9a')]})['then'](function(_0x2098c1){_0x3be245[_0x3c57('0x20')]=_0x2098c1;if(_0x21b4b4['query']['includeAll']){_0x2bf86b[_0x3c57('0x3c')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x2bf86b);})[_0x3c57('0x11')](function(_0x25082e){_0x3be245[_0x3c57('0x9b')]=_0x25082e;return _0x3be245;});}})[_0x3c57('0x11')](respondWithFilteredResult(_0x12a933,_0x2bf86b))[_0x3c57('0x1b')](handleError(_0x12a933,null));};exports['getMyMessages']=function(_0x73285d,_0x170c12){var _0x2e806d={'where':{}},_0x3ba836={},_0xf840fd={'count':0x0,'rows':[]};return db[_0x3c57('0x2e')][_0x3c57('0x42')]({'where':{'id':_0x73285d[_0x3c57('0x35')]['id']}})[_0x3c57('0x11')](handleEntityNotFound(_0x170c12,null))[_0x3c57('0x11')](function(_0x9a01e){if(_0x9a01e){_0x3ba836[_0x3c57('0x36')]=_[_0x3c57('0x9c')](db[_0x3c57('0x58')][_0x3c57('0x2f')]);_0x3ba836['query']=_[_0x3c57('0x9c')](_0x73285d[_0x3c57('0x33')]);_0x3ba836['filters']=_[_0x3c57('0x91')](_0x3ba836[_0x3c57('0x36')],_0x3ba836['query']);_0x2e806d[_0x3c57('0x38')]=_['intersection'](_0x3ba836[_0x3c57('0x36')],qs[_0x3c57('0x39')](_0x73285d[_0x3c57('0x33')][_0x3c57('0x39')]));_0x2e806d[_0x3c57('0x38')]=_0x2e806d['attributes'][_0x3c57('0x3a')]?_0x2e806d['attributes']:_0x3ba836['model'];if(!_0x73285d[_0x3c57('0x33')][_0x3c57('0x92')]('nolimit')){_0x2e806d[_0x3c57('0x21')]=qs[_0x3c57('0x21')](_0x73285d['query'][_0x3c57('0x21')]);_0x2e806d[_0x3c57('0x1f')]=qs['offset'](_0x73285d[_0x3c57('0x33')][_0x3c57('0x1f')]);}_0x2e806d[_0x3c57('0x94')]=qs[_0x3c57('0x95')](_0x73285d[_0x3c57('0x33')][_0x3c57('0x95')]);_0x2e806d[_0x3c57('0x9a')]=qs['filters'](_[_0x3c57('0x96')](_0x73285d['query'],_0x3ba836[_0x3c57('0x37')]));_0x2e806d[_0x3c57('0x9a')][_0x3c57('0x97')]=_0x9a01e['id'];if(_0x73285d['query'][_0x3c57('0x98')]){_0x2e806d[_0x3c57('0x9a')]=_[_0x3c57('0x2a')](_0x2e806d['where'],{'$or':_[_0x3c57('0x9d')](_0x2e806d['attributes'],function(_0x255392){var _0x3906b3={};_0x3906b3[_0x255392]={'$like':'%'+_0x73285d[_0x3c57('0x33')][_0x3c57('0x98')]+'%'};return _0x3906b3;})});}_0x2e806d[_0x3c57('0x9a')][_0x3c57('0x84')]=![];if(_0x73285d['query']['id']){_0x2e806d['where']['id']={'$gt':_0x73285d[_0x3c57('0x33')]['id']};}_0x2e806d=_[_0x3c57('0x2a')]({},_0x2e806d,_0x73285d[_0x3c57('0x3d')]);return db[_0x3c57('0x58')][_0x3c57('0x20')]({'where':_0x2e806d['where']})[_0x3c57('0x11')](function(_0x8908a3){_0xf840fd[_0x3c57('0x20')]=_0x8908a3;_0x2e806d[_0x3c57('0x3c')]=[];if(_0x73285d[_0x3c57('0x33')][_0x3c57('0x9e')]){_0x2e806d['include'][_0x3c57('0x9f')]({'model':db['User'],'as':'User','attributes':['id',_0x3c57('0x49'),_0x3c57('0xa0')]});}if(_0x73285d[_0x3c57('0x33')]['includeAll']){_0x2e806d[_0x3c57('0x3c')]=[{'all':!![]}];}return db[_0x3c57('0x58')][_0x3c57('0xa1')](_0x2e806d);})[_0x3c57('0x11')](function(_0x375bcf){_0xf840fd[_0x3c57('0x9b')]=_0x375bcf;return _0xf840fd;});}})[_0x3c57('0x11')](respondWithFilteredResult(_0x170c12,_0x2e806d))[_0x3c57('0x1b')](handleError(_0x170c12,null));};exports[_0x3c57('0xa2')]=function(_0x5e84af,_0x48f7cd){return db['ChatInteraction'][_0x3c57('0x3e')]({'where':{'id':_0x5e84af[_0x3c57('0x35')]['id']}})['then'](handleEntityNotFound(_0x48f7cd,null))['then'](function(_0x46c857){if(_0x46c857){return _0x46c857[_0x3c57('0xa3')](_0x5e84af[_0x3c57('0x2b')]['ids'],_[_0x3c57('0x8f')](_0x5e84af[_0x3c57('0x2b')],[_0x3c57('0x8e'),'id'])||{})[_0x3c57('0xa4')](function(){return db[_0x3c57('0xa5')][_0x3c57('0xa1')]({'attributes':['id',_0x3c57('0x27'),_0x3c57('0xa6')],'where':{'id':_0x5e84af['body'][_0x3c57('0x8e')]}});})[_0x3c57('0x11')](function(_0xce028){socket['emit'](_0x3c57('0xa7'),{'id':Number(_0x5e84af['params']['id']),'tags':_0xce028||[]});return{'id':Number(_0x5e84af['params']['id']),'tags':_0xce028||[]};});}})['then'](respondWithResult(_0x48f7cd,null))['catch'](handleError(_0x48f7cd,null));};exports[_0x3c57('0xa8')]=function(_0x504f60,_0x44d06e){return db[_0x3c57('0x2e')]['find']({'where':{'id':_0x504f60[_0x3c57('0x35')]['id']}})[_0x3c57('0x11')](handleEntityNotFound(_0x44d06e,null))['then'](function(_0x1ffb58){if(_0x1ffb58){return _0x1ffb58[_0x3c57('0xa8')](_0x504f60['query']['ids']);}})[_0x3c57('0x11')](respondWithStatusCode(_0x44d06e,null))[_0x3c57('0x1b')](handleError(_0x44d06e,null));};exports[_0x3c57('0x6e')]=function(_0x1f8e5f,_0x2188e0){var _0x496cde=moment()[_0x3c57('0xa9')]()[_0x3c57('0xaa')]();var _0x9c8e13=path[_0x3c57('0x6b')](config[_0x3c57('0x6a')],_0x3c57('0xab'),_0x3c57('0xac'),_0x3c57('0xad'));var _0x47a0da=path[_0x3c57('0x6b')](config['root'],'server',_0x3c57('0xac'),_0x3c57('0xae'));var _0x2a6051=path['join'](_0x9c8e13,_0x496cde);var _0x182129=util[_0x3c57('0x72')](_0x3c57('0xaf'),_0x1f8e5f[_0x3c57('0x35')]['id'],_0x496cde);var _0x27f777=path[_0x3c57('0x6b')](_0x9c8e13,_0x182129);var _0x110664=[];_0x110664['push']({'model':db['User'],'as':_0x3c57('0x77'),'attributes':['id',_0x3c57('0x49')],'raw':!![]});_0x110664[_0x3c57('0x9f')]({'model':db[_0x3c57('0x78')],'as':_0x3c57('0x5b'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1f8e5f[_0x3c57('0x33')][_0x3c57('0xae')]){_0x110664[_0x3c57('0x9f')]({'model':db['Attachment'],'as':_0x3c57('0x66'),'raw':!![]});}var _0x78dfe5=[{'model':db[_0x3c57('0x58')],'as':_0x3c57('0x76'),'attributes':['id','body',_0x3c57('0x82'),_0x3c57('0xb0'),_0x3c57('0x84'),_0x3c57('0xb1')],'include':_0x110664}];_0x78dfe5['push']({'model':db['ChatWebsite'],'as':_0x3c57('0xb2'),'attributes':['id','name']});_0x78dfe5[_0x3c57('0x9f')]({'model':db['User'],'as':_0x3c57('0xb3'),'attributes':['id',_0x3c57('0x49')]});return db[_0x3c57('0x2e')][_0x3c57('0x3e')]({'where':{'id':_0x1f8e5f[_0x3c57('0x35')]['id']},'include':_0x78dfe5})[_0x3c57('0x11')](handleEntityNotFound(_0x2188e0,null))['then'](function(_0x4c62ac){if(_0x4c62ac){var _0x1c653d=_0x4c62ac[_0x3c57('0xb4')]({'plain':!![]});fs['mkdirSync'](_0x2a6051);var _0x423d64={'channel':'Chat','account':_0x1c653d['Account'][_0x3c57('0x27')],'agent':_0x1c653d[_0x3c57('0xb3')]?_0x1c653d[_0x3c57('0xb3')]['fullname']:'N.A.','createdAt':moment(_0x1c653d[_0x3c57('0x82')])[_0x3c57('0x72')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1c653d[_0x3c57('0x60')]?moment(_0x1c653d[_0x3c57('0xb5')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3c57('0xaa')]():'','disposition':_0x1c653d[_0x3c57('0x61')],'chatInfo':{'browser':_0x1c653d[_0x3c57('0xb6')],'os':_0x1c653d['osName'],'referer':_0x1c653d[_0x3c57('0xb7')],'customerIp':_0x1c653d['customerIp'],'customerPort':_0x1c653d[_0x3c57('0xb8')]?_0x1c653d['customerPort']:_0x3c57('0xb9')},'messages':_(_0x1c653d['Messages'])[_0x3c57('0xba')]()[_0x3c57('0x98')]({'secret':![]})['map'](function(_0x26889c){if(_0x26889c[_0x3c57('0x66')]){var _0xc6c718=path['join'](_0x47a0da,_0x26889c[_0x3c57('0x66')][_0x3c57('0x6d')]);if(fs[_0x3c57('0xbb')](_0xc6c718)){fs[_0x3c57('0xbc')](_0xc6c718)[_0x3c57('0xbd')](fs[_0x3c57('0xbe')](path[_0x3c57('0x6b')](_0x2a6051,_0x26889c['Attachment'][_0x3c57('0x6d')])));}}return{'date':moment(_0x26889c['createdAt'])[_0x3c57('0x72')](_0x3c57('0xbf'))[_0x3c57('0xaa')](),'sender':_0x26889c[_0x3c57('0xb0')]===_0x3c57('0x57')?_0x26889c[_0x3c57('0x77')]?_0x26889c[_0x3c57('0x77')]['fullname']:'System':_0x26889c[_0x3c57('0x5b')][_0x3c57('0xc0')]+(_0x26889c[_0x3c57('0x5b')][_0x3c57('0xc1')]?'\x20'+_0x26889c[_0x3c57('0x5b')][_0x3c57('0xc1')]:''),'body':_0x26889c[_0x3c57('0x66')]?_0x26889c[_0x3c57('0x66')][_0x3c57('0x6d')]:_0x26889c[_0x3c57('0x2b')],'direction':_0x26889c[_0x3c57('0xb0')]===_0x3c57('0x57')?'A':'C','secret':_0x26889c['secret'],'read':_0x26889c[_0x3c57('0xb1')],'attachment':_0x26889c[_0x3c57('0x66')]};})[_0x3c57('0xc2')]()};return ejs[_0x3c57('0xc3')](path['join'](config[_0x3c57('0x6a')],_0x3c57('0xab'),_0x3c57('0xc4'),_0x3c57('0xc5')),{'interaction':_0x423d64})['then'](function(_0x182e7b){var _0x1e9319=path[_0x3c57('0x6b')](_0x2a6051,_0x3c57('0xc6')+_0x1c653d['id']+'-'+_0x496cde+_0x3c57('0xc7'));var _0x4e83cc={'path':_0x1e9319,'channel':_0x3c57('0xc8'),'interactionId':_0x1c653d['id']};return pdf[_0x3c57('0xc9')](_0x182e7b,_0x4e83cc);})[_0x3c57('0x11')](function(){return new Promise(function(_0x5d731b,_0x5288a7){zipdir(_0x2a6051,{'saveTo':_0x27f777},function(_0x4fcb14,_0x56fa0f){if(_0x4fcb14)return _0x5288a7(_0x4fcb14);return _0x5d731b(_0x56fa0f);});})[_0x3c57('0x11')](function(){return new BPromise(function(_0xc3347e,_0x4d2707){rimraf(_0x2a6051,function(_0x2a6532){if(_0x2a6532)_0x4d2707(_0x2a6532);return _0xc3347e();});});})[_0x3c57('0x11')](function(){return _0x2188e0[_0x3c57('0x6e')](_0x27f777,_0x182129,function(_0x5caff3){if(_0x5caff3){logger[_0x3c57('0x18')]('err',_0x5caff3);}else{fs[_0x3c57('0xca')](_0x27f777);}});});});}else{return _0x2188e0[_0x3c57('0x1c')](0xc8);}})[_0x3c57('0x1b')](handleError(_0x2188e0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 4e8cfae..b562c8f 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 _0x4de2=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4de2,0x114));var _0x24de=function(_0x469ce9,_0x4a9239){_0x469ce9=_0x469ce9-0x0;var _0x180ebe=_0x4de2[_0x469ce9];return _0x180ebe;};'use strict';var EventEmitter=require(_0x24de('0x0'));var ChatInteraction=require(_0x24de('0x1'))['db'][_0x24de('0x2')];var ChatMessage=require(_0x24de('0x1'))['db'][_0x24de('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x24de('0x4')](0x0);var events={'afterCreate':_0x24de('0x5'),'afterUpdate':_0x24de('0x6'),'afterDestroy':_0x24de('0x7')};function emitEvent(_0x41388e){return function(_0xcad6d2,_0x59b7ba,_0x5d4265){_0xcad6d2[_0x24de('0x8')]({'attributes':['id'],'raw':!![]})[_0x24de('0x9')](function(_0x54f634){_0xcad6d2[_0x24de('0xa')](_0x24de('0xb'),_0x54f634[_0x24de('0xc')](function(_0x3a590a){return{'id':_0x3a590a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xcad6d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x24de('0x9')](function(_0x15ffa1){_0xcad6d2['setDataValue'](_0x24de('0xd'),_0x15ffa1[_0x24de('0xe')]);ChatInteractionEvents[_0x24de('0xf')](_0x41388e+':'+_0xcad6d2['id'],_0xcad6d2);ChatInteractionEvents[_0x24de('0xf')](_0x41388e,_0xcad6d2);_0x5d4265(null);})[_0x24de('0x10')](_0x5d4265(null));};}for(var e in events){if(events[_0x24de('0x11')](e)){var event=events[e];ChatInteraction[_0x24de('0x12')](e,emitEvent(event));}}module[_0x24de('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x04b1=['findAll','setDataValue','length','emit','catch','hasOwnProperty','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','Users','map'];(function(_0x382894,_0x2f9213){var _0x4c657f=function(_0x1e9801){while(--_0x1e9801){_0x382894['push'](_0x382894['shift']());}};_0x4c657f(++_0x2f9213);}(_0x04b1,0x15a));var _0x104b=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x04b1[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require(_0x104b('0x0'));var ChatInteraction=require(_0x104b('0x1'))['db'][_0x104b('0x2')];var ChatMessage=require(_0x104b('0x1'))['db'][_0x104b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x104b('0x4')](0x0);var events={'afterCreate':_0x104b('0x5'),'afterUpdate':'update','afterDestroy':_0x104b('0x6')};function emitEvent(_0x735eff){return function(_0x25b4d8,_0x172665,_0x3f2a4d){_0x25b4d8[_0x104b('0x7')]({'attributes':['id'],'raw':!![]})[_0x104b('0x8')](function(_0x540330){_0x25b4d8['setDataValue'](_0x104b('0x9'),_0x540330[_0x104b('0xa')](function(_0x511354){return{'id':_0x511354['id']};}));return ChatMessage[_0x104b('0xb')]({'where':{'ChatInteractionId':_0x25b4d8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x53983c){_0x25b4d8[_0x104b('0xc')]('unreadMessages',_0x53983c[_0x104b('0xd')]);ChatInteractionEvents[_0x104b('0xe')](_0x735eff+':'+_0x25b4d8['id'],_0x25b4d8);ChatInteractionEvents[_0x104b('0xe')](_0x735eff,_0x25b4d8);_0x3f2a4d(null);})[_0x104b('0xf')](_0x3f2a4d(null));};}for(var e in events){if(events[_0x104b('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c44887b..98bcc61 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 _0xc573=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xc573,0x15e));var _0x3c57=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xc573[_0x369151];return _0x4292d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c57('0x0'))('api');var moment=require(_0x3c57('0x1'));var BPromise=require(_0x3c57('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3c57('0x3'));var attributes=require(_0x3c57('0x4'));module['exports']=function(_0x5c34ef,_0x29d477){return _0x5c34ef[_0x3c57('0x5')](_0x3c57('0x6'),attributes,{'tableName':_0x3c57('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37da5f,_0x151573,_0x4d9f35){if(_0x37da5f[_0x3c57('0x8')](_0x3c57('0x9'))){_0x37da5f[_0x3c57('0xa')]=moment()[_0x3c57('0xb')](_0x3c57('0xc'));}_0x4d9f35(null,_0x37da5f);}},'charset':_0x3c57('0xd'),'collate':_0x3c57('0xe')});}; \ No newline at end of file +var _0x7a41=['util','../../config/logger','api','moment','bluebird','request-promise','path','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash'];(function(_0x366903,_0x333b63){var _0x13f7eb=function(_0x52f840){while(--_0x52f840){_0x366903['push'](_0x366903['shift']());}};_0x13f7eb(++_0x333b63);}(_0x7a41,0x120));var _0x17a4=function(_0x373bf8,_0x1e94c8){_0x373bf8=_0x373bf8-0x0;var _0x23e51e=_0x7a41[_0x373bf8];return _0x23e51e;};'use strict';var _=require(_0x17a4('0x0'));var util=require(_0x17a4('0x1'));var logger=require(_0x17a4('0x2'))(_0x17a4('0x3'));var moment=require(_0x17a4('0x4'));var BPromise=require(_0x17a4('0x5'));var rp=require(_0x17a4('0x6'));var fs=require('fs');var path=require(_0x17a4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17a4('0x8'));module[_0x17a4('0x9')]=function(_0x1dfdf9,_0x3373ba){return _0x1dfdf9['define'](_0x17a4('0xa'),attributes,{'tableName':_0x17a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3754bf,_0x2d02ae,_0x106341){if(_0x3754bf[_0x17a4('0xc')](_0x17a4('0xd'))){_0x3754bf[_0x17a4('0xe')]=moment()['format'](_0x17a4('0xf'));}_0x106341(null,_0x3754bf);}},'charset':'utf8mb4','collate':_0x17a4('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2f6381f..6f5d231 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 _0xf658=['ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction'];(function(_0x7fb85a,_0x4dec8c){var _0xa6b438=function(_0x4ef9cc){while(--_0x4ef9cc){_0x7fb85a['push'](_0x7fb85a['shift']());}};_0xa6b438(++_0x4dec8c);}(_0xf658,0x167));var _0x8f65=function(_0xeb8d,_0x389cfd){_0xeb8d=_0xeb8d-0x0;var _0x427d99=_0xf658[_0xeb8d];return _0x427d99;};'use strict';var _=require(_0x8f65('0x0'));var util=require('util');var moment=require(_0x8f65('0x1'));var BPromise=require(_0x8f65('0x2'));var rs=require(_0x8f65('0x3'));var fs=require('fs');var Redis=require(_0x8f65('0x4'));var db=require(_0x8f65('0x5'))['db'];var utils=require(_0x8f65('0x6'));var logger=require(_0x8f65('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f65('0x8'));var client=jayson[_0x8f65('0x9')]['http']({'port':0x232a});config[_0x8f65('0xa')]=_[_0x8f65('0xb')](config[_0x8f65('0xa')],{'host':_0x8f65('0xc'),'port':0x18eb});var socket=require(_0x8f65('0xd'))(new Redis(config['redis']));require(_0x8f65('0xe'))[_0x8f65('0xf')](socket);function respondWithRpcPromise(_0x31ad57,_0x4fcb20,_0x1e398b){return new BPromise(function(_0x5c5efb,_0x38db63){return client[_0x8f65('0x10')](_0x31ad57,_0x1e398b)[_0x8f65('0x11')](function(_0x42446b){logger[_0x8f65('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4fcb20,_0x8f65('0x13'));logger[_0x8f65('0x14')](_0x8f65('0x15'),_0x4fcb20,_0x8f65('0x13'),JSON[_0x8f65('0x16')](_0x42446b));if(_0x42446b['error']){if(_0x42446b[_0x8f65('0x17')]['code']===0x1f4){logger[_0x8f65('0x17')](_0x8f65('0x18'),_0x4fcb20,_0x42446b['error'][_0x8f65('0x19')]);return _0x38db63(_0x42446b['error'][_0x8f65('0x19')]);}logger[_0x8f65('0x17')](_0x8f65('0x18'),_0x4fcb20,_0x42446b['error'][_0x8f65('0x19')]);return _0x5c5efb(_0x42446b[_0x8f65('0x17')]['message']);}else{logger[_0x8f65('0x12')](_0x8f65('0x18'),_0x4fcb20,_0x8f65('0x13'));_0x5c5efb(_0x42446b[_0x8f65('0x1a')][_0x8f65('0x19')]);}})['catch'](function(_0x42cfa1){logger[_0x8f65('0x17')](_0x8f65('0x18'),_0x4fcb20,_0x42cfa1);_0x38db63(_0x42cfa1);});});}exports[_0x8f65('0x1b')]=function(_0x5cb369){var _0x2452f4=this;return new Promise(function(_0x329e53,_0x50c491){return db[_0x8f65('0x1c')][_0x8f65('0x1d')](_0x5cb369[_0x8f65('0x1e')],{'raw':_0x5cb369['options']?_0x5cb369[_0x8f65('0x1f')][_0x8f65('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cb369['options']?_0x5cb369[_0x8f65('0x1f')][_0x8f65('0x21')]||null:null,'attributes':_0x5cb369[_0x8f65('0x1f')]?_0x5cb369[_0x8f65('0x1f')][_0x8f65('0x22')]||null:null,'limit':_0x5cb369[_0x8f65('0x1f')]?_0x5cb369[_0x8f65('0x1f')][_0x8f65('0x23')]||null:null})[_0x8f65('0x11')](function(_0x47f2be){logger['info'](_0x8f65('0x1b'),_0x5cb369);logger[_0x8f65('0x14')](_0x8f65('0x1b'),_0x5cb369,JSON['stringify'](_0x47f2be));_0x329e53(_0x47f2be);})[_0x8f65('0x24')](function(_0x1cfd71){logger[_0x8f65('0x17')]('UpdateChatInteraction',_0x1cfd71[_0x8f65('0x19')],_0x5cb369);_0x50c491(_0x2452f4[_0x8f65('0x17')](0x1f4,_0x1cfd71[_0x8f65('0x19')]));});});};exports[_0x8f65('0x25')]=function(_0x4631a4){return new Promise(function(_0xcde157,_0x5b4d96){return db[_0x8f65('0x1c')][_0x8f65('0x26')]({'where':_0x4631a4[_0x8f65('0x1f')]?_0x4631a4[_0x8f65('0x1f')][_0x8f65('0x21')]||null:null})[_0x8f65('0x11')](function(_0x13b6cd){if(_0x13b6cd){return _0x13b6cd[_0x8f65('0x27')](_0x4631a4['body'][_0x8f65('0x28')],_['omit'](_0x4631a4[_0x8f65('0x1e')],['ids','id'])||{});}})[_0x8f65('0x29')](function(_0x3291c6){logger[_0x8f65('0x12')](_0x8f65('0x2a'),_0x4631a4);logger['debug'](_0x8f65('0x2a'),_0x4631a4,JSON[_0x8f65('0x16')](_0x3291c6));_0xcde157(_0x3291c6);})['catch'](function(_0x2fea4a){logger[_0x8f65('0x17')](_0x8f65('0x2a'),_0x2fea4a[_0x8f65('0x19')],_0x4631a4);_0x5b4d96(_this[_0x8f65('0x17')](0x1f4,_0x2fea4a[_0x8f65('0x19')]));});});}; \ No newline at end of file +var _0x5268=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','stringify','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x22f830,_0x35b858){var _0x183390=function(_0x1bf154){while(--_0x1bf154){_0x22f830['push'](_0x22f830['shift']());}};_0x183390(++_0x35b858);}(_0x5268,0x1e7));var _0x8526=function(_0x1a8692,_0x20b1b5){_0x1a8692=_0x1a8692-0x0;var _0x5c1667=_0x5268[_0x1a8692];return _0x5c1667;};'use strict';var _=require(_0x8526('0x0'));var util=require('util');var moment=require(_0x8526('0x1'));var BPromise=require(_0x8526('0x2'));var rs=require(_0x8526('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8526('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8526('0x5'))(_0x8526('0x6'));var config=require(_0x8526('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8526('0x8')][_0x8526('0x9')]({'port':0x232a});config['redis']=_[_0x8526('0xa')](config[_0x8526('0xb')],{'host':_0x8526('0xc'),'port':0x18eb});var socket=require(_0x8526('0xd'))(new Redis(config[_0x8526('0xb')]));require(_0x8526('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c6f57,_0x1c6c14,_0x315ef8){return new BPromise(function(_0x209aa9,_0x8926fb){return client[_0x8526('0xf')](_0x3c6f57,_0x315ef8)[_0x8526('0x10')](function(_0x5bf549){logger[_0x8526('0x11')](_0x8526('0x12'),_0x1c6c14,_0x8526('0x13'));logger[_0x8526('0x14')](_0x8526('0x15'),_0x1c6c14,'request\x20sent',JSON['stringify'](_0x5bf549));if(_0x5bf549[_0x8526('0x16')]){if(_0x5bf549[_0x8526('0x16')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1c6c14,_0x5bf549[_0x8526('0x16')][_0x8526('0x17')]);return _0x8926fb(_0x5bf549[_0x8526('0x16')][_0x8526('0x17')]);}logger['error'](_0x8526('0x12'),_0x1c6c14,_0x5bf549[_0x8526('0x16')][_0x8526('0x17')]);return _0x209aa9(_0x5bf549[_0x8526('0x16')][_0x8526('0x17')]);}else{logger[_0x8526('0x11')](_0x8526('0x12'),_0x1c6c14,_0x8526('0x13'));_0x209aa9(_0x5bf549[_0x8526('0x18')][_0x8526('0x17')]);}})[_0x8526('0x19')](function(_0x2b01c3){logger[_0x8526('0x16')](_0x8526('0x12'),_0x1c6c14,_0x2b01c3);_0x8926fb(_0x2b01c3);});});}exports[_0x8526('0x1a')]=function(_0x230b5f){var _0x4b9015=this;return new Promise(function(_0x54091c,_0x32236d){return db[_0x8526('0x1b')]['update'](_0x230b5f[_0x8526('0x1c')],{'raw':_0x230b5f[_0x8526('0x1d')]?_0x230b5f[_0x8526('0x1d')][_0x8526('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x230b5f['options']?_0x230b5f['options'][_0x8526('0x1f')]||null:null,'attributes':_0x230b5f[_0x8526('0x1d')]?_0x230b5f[_0x8526('0x1d')][_0x8526('0x20')]||null:null,'limit':_0x230b5f[_0x8526('0x1d')]?_0x230b5f['options']['limit']||null:null})[_0x8526('0x10')](function(_0x14fe04){logger[_0x8526('0x11')](_0x8526('0x1a'),_0x230b5f);logger[_0x8526('0x14')](_0x8526('0x1a'),_0x230b5f,JSON[_0x8526('0x21')](_0x14fe04));_0x54091c(_0x14fe04);})[_0x8526('0x19')](function(_0x29bffe){logger[_0x8526('0x16')](_0x8526('0x1a'),_0x29bffe[_0x8526('0x17')],_0x230b5f);_0x32236d(_0x4b9015[_0x8526('0x16')](0x1f4,_0x29bffe['message']));});});};exports[_0x8526('0x22')]=function(_0x2f7b4a){return new Promise(function(_0xf7fac5,_0x3c6dd3){return db[_0x8526('0x1b')][_0x8526('0x23')]({'where':_0x2f7b4a[_0x8526('0x1d')]?_0x2f7b4a[_0x8526('0x1d')][_0x8526('0x1f')]||null:null})['then'](function(_0x90155c){if(_0x90155c){return _0x90155c[_0x8526('0x24')](_0x2f7b4a[_0x8526('0x1c')][_0x8526('0x25')],_['omit'](_0x2f7b4a[_0x8526('0x1c')],[_0x8526('0x25'),'id'])||{});}})['spread'](function(_0x21fce3){logger[_0x8526('0x11')]('AddTags',_0x2f7b4a);logger['debug'](_0x8526('0x26'),_0x2f7b4a,JSON[_0x8526('0x21')](_0x21fce3));_0xf7fac5(_0x21fce3);})[_0x8526('0x19')](function(_0x111052){logger['error']('AddTags',_0x111052[_0x8526('0x17')],_0x2f7b4a);_0x3c6dd3(_this['error'](0x1f4,_0x111052[_0x8526('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4fa9cab..6bdccf8 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 _0x3785=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x5573ab,_0x8908e9){var _0x5a6663=function(_0x5730e7){while(--_0x5730e7){_0x5573ab['push'](_0x5573ab['shift']());}};_0x5a6663(++_0x8908e9);}(_0x3785,0x139));var _0x5378=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x3785[_0x311909];return _0x8d3163;};'use strict';var ChatInteractionEvents=require(_0x5378('0x0'));var events=[_0x5378('0x1'),_0x5378('0x2'),_0x5378('0x3')];function createListener(_0x413499,_0x389175){return function(_0x169ff0){_0x389175[_0x5378('0x4')](_0x413499,_0x169ff0);};}function removeListener(_0x1f0edf,_0x25e917){return function(){ChatInteractionEvents[_0x5378('0x5')](_0x1f0edf,_0x25e917);};}exports[_0x5378('0x6')]=function(_0x2f7abd){for(var _0x24a869=0x0,_0x8271f2=events[_0x5378('0x7')];_0x24a869<_0x8271f2;_0x24a869++){var _0x106fd7=events[_0x24a869];var _0x664ec4=createListener('chatInteraction:'+_0x106fd7,_0x2f7abd);ChatInteractionEvents['on'](_0x106fd7,_0x664ec4);}}; \ No newline at end of file +var _0x8f60=['emit','removeListener','register','./chatInteraction.events','remove','update'];(function(_0xbefcf5,_0x14d885){var _0x9ea24f=function(_0x921d8e){while(--_0x921d8e){_0xbefcf5['push'](_0xbefcf5['shift']());}};_0x9ea24f(++_0x14d885);}(_0x8f60,0x117));var _0x08f6=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x8f60[_0x819464];return _0x49dcc0;};'use strict';var ChatInteractionEvents=require(_0x08f6('0x0'));var events=['save',_0x08f6('0x1'),_0x08f6('0x2')];function createListener(_0x2debae,_0xd7d37e){return function(_0x193e8e){_0xd7d37e[_0x08f6('0x3')](_0x2debae,_0x193e8e);};}function removeListener(_0x27e77a,_0x1e6d7a){return function(){ChatInteractionEvents[_0x08f6('0x4')](_0x27e77a,_0x1e6d7a);};}exports[_0x08f6('0x5')]=function(_0x1544e6){for(var _0x28373f=0x0,_0x30ae8f=events['length'];_0x28373f<_0x30ae8f;_0x28373f++){var _0x19aa6c=events[_0x28373f];var _0x4e059e=createListener('chatInteraction:'+_0x19aa6c,_0x1544e6);ChatInteractionEvents['on'](_0x19aa6c,_0x4e059e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3858424..052e63e 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 _0x8927=['diskStorage','format','originalname','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','isAuthenticated','download','post','create','/:id/vidaoo','createVidaooSession'];(function(_0x504fe4,_0x43a12a){var _0x5ce10e=function(_0x43f3db){while(--_0x43f3db){_0x504fe4['push'](_0x504fe4['shift']());}};_0x5ce10e(++_0x43a12a);}(_0x8927,0x151));var _0x7892=function(_0x44d863,_0x4acb21){_0x44d863=_0x44d863-0x0;var _0x111824=_0x8927[_0x44d863];return _0x111824;};'use strict';var multer=require(_0x7892('0x0'));var util=require(_0x7892('0x1'));var path=require(_0x7892('0x2'));var timeout=require(_0x7892('0x3'));var express=require(_0x7892('0x4'));var router=express['Router']();var fs_extra=require(_0x7892('0x5'));var auth=require(_0x7892('0x6'));var interaction=require(_0x7892('0x7'));var config=require(_0x7892('0x8'));var controller=require('./chatInteraction.controller');router[_0x7892('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7892('0x9')](_0x7892('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7892('0x9')](_0x7892('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x7892('0x9')](_0x7892('0xc'),auth[_0x7892('0xd')](),controller[_0x7892('0xe')]);router['get'](_0x7892('0xf'),auth['isAuthenticated'](),controller[_0x7892('0x10')]);router['get']('/:id/my_messages',auth[_0x7892('0xd')](),controller['getMyMessages']);router[_0x7892('0x9')]('/:id/download',auth[_0x7892('0x11')](),controller[_0x7892('0x12')]);router[_0x7892('0x13')]('/',auth[_0x7892('0x11')](),controller[_0x7892('0x14')]);router[_0x7892('0x13')](_0x7892('0x15'),auth[_0x7892('0x11')](),controller[_0x7892('0x16')]);var upload=multer({'storage':multer[_0x7892('0x17')]({'destination':function(_0x110a30,_0x347839,_0x1f36a8){_0x1f36a8(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x59c3c7,_0x1423e4,_0x53696d){_0x53696d(null,util[_0x7892('0x18')]('%s-%s',Date['now'](),_0x1423e4[_0x7892('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x7892('0x1a')]('file'),controller[_0x7892('0x1b')]);router[_0x7892('0x13')]('/:id/messages',auth[_0x7892('0xd')](),controller[_0x7892('0x1c')]);router['post'](_0x7892('0x1d'),auth['isAuthenticated'](),interaction['tracked'](_0x7892('0x1e'),_0x7892('0x1f')),controller[_0x7892('0x20')]);router[_0x7892('0x21')](_0x7892('0xb'),auth[_0x7892('0x11')](),interaction[_0x7892('0x22')]('chat',_0x7892('0x23')),controller[_0x7892('0x24')]);router[_0x7892('0x21')](_0x7892('0x25'),controller[_0x7892('0x26')]);router[_0x7892('0x21')](_0x7892('0x27'),auth[_0x7892('0xd')](),controller['abandon']);router['put'](_0x7892('0x28'),controller['close']);router['delete'](_0x7892('0xb'),auth['isAuthenticated'](),interaction[_0x7892('0x22')](_0x7892('0x1e'),_0x7892('0x29')),controller[_0x7892('0x2a')]);router['delete'](_0x7892('0x1d'),auth[_0x7892('0x11')](),controller[_0x7892('0x2b')]);module[_0x7892('0x2c')]=router; \ No newline at end of file +var _0x22cc=['addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags'];(function(_0x40434e,_0x42b9da){var _0x3e8476=function(_0x54f4db){while(--_0x54f4db){_0x40434e['push'](_0x40434e['shift']());}};_0x3e8476(++_0x42b9da);}(_0x22cc,0x1c7));var _0xc22c=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0x22cc[_0x5c956b];return _0xaff46a;};'use strict';var multer=require('multer');var util=require(_0xc22c('0x0'));var path=require(_0xc22c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc22c('0x2'));var router=express['Router']();var fs_extra=require(_0xc22c('0x3'));var auth=require(_0xc22c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc22c('0x5'));var controller=require(_0xc22c('0x6'));router[_0xc22c('0x7')]('/',auth[_0xc22c('0x8')](),controller[_0xc22c('0x9')]);router[_0xc22c('0x7')](_0xc22c('0xa'),auth[_0xc22c('0x8')](),controller['describe']);router[_0xc22c('0x7')](_0xc22c('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router['get'](_0xc22c('0xc'),auth[_0xc22c('0xd')](),controller['attachmentDownload']);router[_0xc22c('0x7')]('/:id/messages',auth[_0xc22c('0x8')](),controller[_0xc22c('0xe')]);router[_0xc22c('0x7')](_0xc22c('0xf'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xc22c('0x7')](_0xc22c('0x10'),auth[_0xc22c('0x8')](),controller[_0xc22c('0x11')]);router[_0xc22c('0x12')]('/',auth[_0xc22c('0x8')](),controller[_0xc22c('0x13')]);router[_0xc22c('0x12')](_0xc22c('0x14'),auth[_0xc22c('0x8')](),controller[_0xc22c('0x15')]);var upload=multer({'storage':multer[_0xc22c('0x16')]({'destination':function(_0x4613ba,_0x32fe33,_0x574e9b){_0x574e9b(null,path['join'](config[_0xc22c('0x17')],_0xc22c('0x18')));},'filename':function(_0x39c141,_0x39e75a,_0x467df8){_0x467df8(null,util['format'](_0xc22c('0x19'),Date[_0xc22c('0x1a')](),_0x39e75a[_0xc22c('0x1b')][_0xc22c('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc22c('0x12')]('/:id/attachment_upload',upload[_0xc22c('0x1d')](_0xc22c('0x1e')),controller[_0xc22c('0x1f')]);router['post']('/:id/messages',auth[_0xc22c('0xd')](),controller['addMessage']);router['post'](_0xc22c('0x20'),auth[_0xc22c('0x8')](),interaction[_0xc22c('0x21')]('chat',_0xc22c('0x22')),controller[_0xc22c('0x23')]);router[_0xc22c('0x24')](_0xc22c('0xb'),auth[_0xc22c('0x8')](),interaction[_0xc22c('0x21')](_0xc22c('0x25'),_0xc22c('0x26')),controller[_0xc22c('0x27')]);router[_0xc22c('0x24')](_0xc22c('0x28'),controller[_0xc22c('0x29')]);router[_0xc22c('0x24')](_0xc22c('0x2a'),auth[_0xc22c('0xd')](),controller['abandon']);router['put'](_0xc22c('0x2b'),controller[_0xc22c('0x2c')]);router[_0xc22c('0x2d')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xc22c('0x25'),'chatinteraction:destroy'),controller[_0xc22c('0x2e')]);router[_0xc22c('0x2d')]('/:id/tags',auth['isAuthenticated'](),controller[_0xc22c('0x2f')]);module[_0xc22c('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 0d21a9b..72596f9 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 _0x1b3a=['exports','BOOLEAN','INTEGER','sequelize'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1b3a,0x1db));var _0xa1b3=function(_0x30e1b9,_0x298f15){_0x30e1b9=_0x30e1b9-0x0;var _0xad4a1f=_0x1b3a[_0x30e1b9];return _0xad4a1f;};'use strict';var Sequelize=require(_0xa1b3('0x0'));module[_0xa1b3('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa1b3('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa1b3('0x3')]}}; \ No newline at end of file +var _0x765a=['BOOLEAN','sequelize','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x765a,0x6a));var _0xa765=function(_0x322456,_0x35cca0){_0x322456=_0x322456-0x0;var _0x48d2e7=_0x765a[_0x322456];return _0x48d2e7;};'use strict';var Sequelize=require(_0xa765('0x0'));module[_0xa765('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa765('0x2')],'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 89db6e2..8d73592 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 _0x2b5e=['count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatInternalMessage','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','merge','find','catch','create','body','describe','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','FromId','read','sort','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x2b5e,0xbf));var _0xe2b5=function(_0x4cddd1,_0x3b49c8){_0x4cddd1=_0x4cddd1-0x0;var _0x3edb96=_0x2b5e[_0x4cddd1];return _0x3edb96;};'use strict';var emlformat=require(_0xe2b5('0x0'));var rimraf=require(_0xe2b5('0x1'));var zipdir=require(_0xe2b5('0x2'));var jsonpatch=require(_0xe2b5('0x3'));var rp=require(_0xe2b5('0x4'));var moment=require(_0xe2b5('0x5'));var BPromise=require(_0xe2b5('0x6'));var Mustache=require(_0xe2b5('0x7'));var util=require(_0xe2b5('0x8'));var path=require(_0xe2b5('0x9'));var sox=require(_0xe2b5('0xa'));var csv=require(_0xe2b5('0xb'));var ejs=require(_0xe2b5('0xc'));var fs=require('fs');var fs_extra=require(_0xe2b5('0xd'));var _=require(_0xe2b5('0xe'));var squel=require(_0xe2b5('0xf'));var crypto=require('crypto');var jsforce=require(_0xe2b5('0x10'));var deskjs=require(_0xe2b5('0x11'));var toCsv=require(_0xe2b5('0xb'));var querystring=require('querystring');var Papa=require(_0xe2b5('0x12'));var Redis=require(_0xe2b5('0x13'));var authService=require(_0xe2b5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe2b5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2b5('0x16'))(_0xe2b5('0x17'));var utils=require(_0xe2b5('0x18'));var config=require(_0xe2b5('0x19'));var licenseUtil=require(_0xe2b5('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe2b5('0x1b')]=_[_0xe2b5('0x1c')](config[_0xe2b5('0x1b')],{'host':_0xe2b5('0x1d'),'port':0x18eb});var socket=require(_0xe2b5('0x1e'))(new Redis(config[_0xe2b5('0x1b')]));require(_0xe2b5('0x1f'))[_0xe2b5('0x20')](socket);function respondWithStatusCode(_0x11ee0e,_0x2f6b8b){_0x2f6b8b=_0x2f6b8b||0xcc;return function(_0x1a8586){if(_0x1a8586){return _0x11ee0e[_0xe2b5('0x21')](_0x2f6b8b);}return _0x11ee0e[_0xe2b5('0x22')](_0x2f6b8b)[_0xe2b5('0x23')]();};}function respondWithResult(_0x4344e7,_0x39337b){_0x39337b=_0x39337b||0xc8;return function(_0x1ce4c1){if(_0x1ce4c1){return _0x4344e7[_0xe2b5('0x22')](_0x39337b)[_0xe2b5('0x24')](_0x1ce4c1);}};}function respondWithFilteredResult(_0x4d7867,_0xb560ab){return function(_0x24d5cf){if(_0x24d5cf){var _0x13df0e=typeof _0xb560ab[_0xe2b5('0x25')]===_0xe2b5('0x26')&&typeof _0xb560ab['limit']===_0xe2b5('0x26');var _0x55b094=_0x24d5cf[_0xe2b5('0x27')];var _0x48eb77=_0x13df0e?0x0:_0xb560ab[_0xe2b5('0x25')];var _0x879b71=_0x13df0e?_0x24d5cf[_0xe2b5('0x27')]:_0xb560ab[_0xe2b5('0x25')]+_0xb560ab[_0xe2b5('0x28')];var _0x2bbc92;if(_0x879b71>=_0x55b094){_0x879b71=_0x55b094;_0x2bbc92=0xc8;}else{_0x2bbc92=0xce;}_0x4d7867['status'](_0x2bbc92);return _0x4d7867['set'](_0xe2b5('0x29'),_0x48eb77+'-'+_0x879b71+'/'+_0x55b094)['json'](_0x24d5cf);}return null;};}function patchUpdates(_0x3d0fe4){return function(_0x325eb1){try{jsonpatch[_0xe2b5('0x2a')](_0x325eb1,_0x3d0fe4,!![]);}catch(_0x522d32){return BPromise[_0xe2b5('0x2b')](_0x522d32);}return _0x325eb1[_0xe2b5('0x2c')]();};}function saveUpdates(_0x2a8088,_0x4f361b){return function(_0x1bb373){if(_0x1bb373){return _0x1bb373[_0xe2b5('0x2d')](_0x2a8088)[_0xe2b5('0x2e')](function(_0x1009a0){return _0x1009a0;});}return null;};}function removeEntity(_0x3f6092,_0x5c7875){return function(_0x424bf6){if(_0x424bf6){return _0x424bf6[_0xe2b5('0x2f')]()[_0xe2b5('0x2e')](function(){_0x3f6092['status'](0xcc)[_0xe2b5('0x23')]();});}};}function handleEntityNotFound(_0x27db7e,_0x1454ad){return function(_0x1ac718){if(!_0x1ac718){_0x27db7e[_0xe2b5('0x21')](0x194);}return _0x1ac718;};}function handleError(_0x2a3ae6,_0x2c76ce){_0x2c76ce=_0x2c76ce||0x1f4;return function(_0x30ff47){logger[_0xe2b5('0x30')](_0x30ff47[_0xe2b5('0x31')]);if(_0x30ff47[_0xe2b5('0x32')]){delete _0x30ff47[_0xe2b5('0x32')];}_0x2a3ae6[_0xe2b5('0x22')](_0x2c76ce)['send'](_0x30ff47);};}exports[_0xe2b5('0x33')]=function(_0x1cc57b,_0x828058){var _0x3f7fb3={},_0x34fcec={},_0x32f7d3={'count':0x0,'rows':[]};var _0x315428=_[_0xe2b5('0x34')](db[_0xe2b5('0x35')]['rawAttributes'],function(_0x2a856f){return{'name':_0x2a856f['fieldName'],'type':_0x2a856f['type']['key']};});_0x34fcec[_0xe2b5('0x36')]=_[_0xe2b5('0x34')](_0x315428,_0xe2b5('0x32'));_0x34fcec['query']=_[_0xe2b5('0x37')](_0x1cc57b[_0xe2b5('0x38')]);_0x34fcec[_0xe2b5('0x39')]=_[_0xe2b5('0x3a')](_0x34fcec['model'],_0x34fcec[_0xe2b5('0x38')]);_0x3f7fb3[_0xe2b5('0x3b')]=_['intersection'](_0x34fcec[_0xe2b5('0x36')],qs[_0xe2b5('0x3c')](_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x3c')]));_0x3f7fb3['attributes']=_0x3f7fb3[_0xe2b5('0x3b')][_0xe2b5('0x3d')]?_0x3f7fb3[_0xe2b5('0x3b')]:_0x34fcec['model'];if(!_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x3e')](_0xe2b5('0x3f'))){_0x3f7fb3[_0xe2b5('0x28')]=qs[_0xe2b5('0x28')](_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x28')]);_0x3f7fb3['offset']=qs['offset'](_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x25')]);}_0x3f7fb3[_0xe2b5('0x40')]=qs['sort'](_0x1cc57b[_0xe2b5('0x38')]['sort']);_0x3f7fb3[_0xe2b5('0x41')]=qs['filters'](_[_0xe2b5('0x42')](_0x1cc57b[_0xe2b5('0x38')],_0x34fcec['filters']),_0x315428);if(_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x43')]){_0x3f7fb3[_0xe2b5('0x41')]=_['merge'](_0x3f7fb3['where'],{'$or':_[_0xe2b5('0x34')](_0x315428,function(_0x44e1b3){if(_0x44e1b3[_0xe2b5('0x44')]!==_0xe2b5('0x45')){var _0x3ba4d2={};_0x3ba4d2[_0x44e1b3['name']]={'$like':'%'+_0x1cc57b[_0xe2b5('0x38')][_0xe2b5('0x43')]+'%'};return _0x3ba4d2;}})});}_0x3f7fb3=_['merge']({},_0x3f7fb3,_0x1cc57b[_0xe2b5('0x46')]);var _0x38a8ee={'where':_0x3f7fb3[_0xe2b5('0x41')]};return db['ChatInternalMessage'][_0xe2b5('0x27')](_0x38a8ee)[_0xe2b5('0x2e')](function(_0x36ffe8){_0x32f7d3[_0xe2b5('0x27')]=_0x36ffe8;if(_0x1cc57b[_0xe2b5('0x38')]['includeAll']){_0x3f7fb3[_0xe2b5('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xe2b5('0x48')](_0x3f7fb3);})[_0xe2b5('0x2e')](function(_0x40dbff){_0x32f7d3[_0xe2b5('0x49')]=_0x40dbff;return _0x32f7d3;})[_0xe2b5('0x2e')](respondWithFilteredResult(_0x828058,_0x3f7fb3))['catch'](handleError(_0x828058,null));};exports[_0xe2b5('0x4a')]=function(_0x3740b2,_0x132212){var _0x22580e={'raw':!![],'where':{'id':_0x3740b2[_0xe2b5('0x4b')]['id']}},_0x18c3ca={};_0x18c3ca[_0xe2b5('0x36')]=_[_0xe2b5('0x37')](db[_0xe2b5('0x35')][_0xe2b5('0x4c')]);_0x18c3ca[_0xe2b5('0x38')]=_['keys'](_0x3740b2['query']);_0x18c3ca[_0xe2b5('0x39')]=_['intersection'](_0x18c3ca['model'],_0x18c3ca[_0xe2b5('0x38')]);_0x22580e['attributes']=_[_0xe2b5('0x3a')](_0x18c3ca['model'],qs['fields'](_0x3740b2[_0xe2b5('0x38')][_0xe2b5('0x3c')]));_0x22580e[_0xe2b5('0x3b')]=_0x22580e[_0xe2b5('0x3b')][_0xe2b5('0x3d')]?_0x22580e['attributes']:_0x18c3ca[_0xe2b5('0x36')];if(_0x3740b2['query'][_0xe2b5('0x4d')]){_0x22580e[_0xe2b5('0x47')]=[{'all':!![]}];}_0x22580e=_[_0xe2b5('0x4e')]({},_0x22580e,_0x3740b2[_0xe2b5('0x46')]);return db[_0xe2b5('0x35')][_0xe2b5('0x4f')](_0x22580e)[_0xe2b5('0x2e')](handleEntityNotFound(_0x132212,null))[_0xe2b5('0x2e')](respondWithResult(_0x132212,null))[_0xe2b5('0x50')](handleError(_0x132212,null));};exports['create']=function(_0x5f0ed2,_0x1bca52){return db[_0xe2b5('0x35')][_0xe2b5('0x51')](_0x5f0ed2[_0xe2b5('0x52')],{})['then'](respondWithResult(_0x1bca52,0xc9))[_0xe2b5('0x50')](handleError(_0x1bca52,null));};exports[_0xe2b5('0x2d')]=function(_0x46e4b9,_0x3245a4){if(_0x46e4b9[_0xe2b5('0x52')]['id']){delete _0x46e4b9[_0xe2b5('0x52')]['id'];}return db[_0xe2b5('0x35')][_0xe2b5('0x4f')]({'where':{'id':_0x46e4b9[_0xe2b5('0x4b')]['id']}})[_0xe2b5('0x2e')](handleEntityNotFound(_0x3245a4,null))[_0xe2b5('0x2e')](saveUpdates(_0x46e4b9['body'],null))[_0xe2b5('0x2e')](respondWithResult(_0x3245a4,null))[_0xe2b5('0x50')](handleError(_0x3245a4,null));};exports[_0xe2b5('0x2f')]=function(_0x51f873,_0x30759b){return db[_0xe2b5('0x35')]['find']({'where':{'id':_0x51f873[_0xe2b5('0x4b')]['id']}})[_0xe2b5('0x2e')](handleEntityNotFound(_0x30759b,null))[_0xe2b5('0x2e')](removeEntity(_0x30759b,null))[_0xe2b5('0x50')](handleError(_0x30759b,null));};exports[_0xe2b5('0x53')]=function(_0x545206,_0x4b5de4){return db[_0xe2b5('0x35')]['describe']()['then'](respondWithResult(_0x4b5de4,null))[_0xe2b5('0x50')](handleError(_0x4b5de4,null));};function wrapUser(_0xeefd37){return function(_0x14af9a){var _0x1c35db=_0xeefd37['get']({'plain':!![]});_0x1c35db[_0xe2b5('0x54')]=[];if(_0x14af9a){_0x1c35db['lastMessageAt']=_0x14af9a[_0xe2b5('0x55')];_0x1c35db[_0xe2b5('0x56')]=_0x14af9a;}else{_0x1c35db[_0xe2b5('0x57')]=moment(0x0)[_0xe2b5('0x58')](_0xe2b5('0x59'));_0x1c35db[_0xe2b5('0x56')]={};}return _0x1c35db;};}exports['getUsers']=function(_0x2122dd,_0x16a4c7,_0x2ae610){var _0x4a5a8e=[];return db['User'][_0xe2b5('0x48')]({'where':{'role':[_0xe2b5('0x5a'),_0xe2b5('0x5b'),'user']},'attributes':['id',_0xe2b5('0x5c'),_0xe2b5('0x32'),_0xe2b5('0x5d'),_0xe2b5('0x5e'),_0xe2b5('0x5f'),'online',_0xe2b5('0x60'),_0xe2b5('0x61'),_0xe2b5('0x62')],'order':qs['sort'](_0xe2b5('0x63')),'include':[{'model':db['VoiceQueue'],'as':_0xe2b5('0x64'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xe2b5('0x2e')](function(_0x2a2c9f){if(_0x2a2c9f){var _0x1cc17d=_0x2122dd[_0xe2b5('0x65')][_0xe2b5('0x66')]({'plain':!![]});if(!_0x1cc17d)throw new Error(_0xe2b5('0x67'));if(_0x1cc17d['role']===_0xe2b5('0x65')){return db[_0xe2b5('0x68')]['find']({'where':{'name':_0xe2b5('0x69'),'userProfileId':_0x1cc17d[_0xe2b5('0x6a')]},'raw':!![]})[_0xe2b5('0x2e')](function(_0x4c18eb){if(_0x4c18eb){if(_0x4c18eb[_0xe2b5('0x6b')]===0x0){return db['UserProfileResource'][_0xe2b5('0x48')]({'where':{'sectionId':_0x4c18eb['id']},'raw':!![]})['then'](function(_0x1533e1){var _0x222f9c=[];if(_[_0xe2b5('0x6c')](_0x1533e1)){_0x222f9c=_['filter'](_0x2a2c9f,function(_0x132b65){if(_0x132b65[_0xe2b5('0x5d')]!==_0xe2b5('0x5a')){return _0x132b65;}});return _0x222f9c;}else{for(var _0x4e3ea6=0x0;_0x4e3ea6<_0x2a2c9f[_0xe2b5('0x3d')];_0x4e3ea6++){var _0x33aa87=_0x2a2c9f[_0x4e3ea6];if(_0x33aa87['role']===_0xe2b5('0x5a')){var _0x5a7d67=_[_0xe2b5('0x4f')](_0x1533e1,function(_0xccb984){return _0xccb984['resourceId']===_0x33aa87['id'];});if(_0x5a7d67)_0x222f9c[_0xe2b5('0x6d')](_0x33aa87);}else{_0x222f9c['push'](_0x33aa87);}}return _0x222f9c;}});}else{return _0x2a2c9f;}}else{var _0x3b30c6=_[_0xe2b5('0x43')](_0x2a2c9f,function(_0x18ba70){if(_0x18ba70[_0xe2b5('0x5d')]!==_0xe2b5('0x5a')){return _0x18ba70;}});return _0x3b30c6;}});}else{return _0x2a2c9f;}}})[_0xe2b5('0x2e')](function(_0x3abff8){var _0x16ee94=[];if(_0x3abff8){_0x4a5a8e=_0x3abff8;for(var _0x52d920=0x0;_0x52d920<_0x3abff8['length'];_0x52d920+=0x1){_0x4a5a8e[_0x52d920][_0xe2b5('0x54')]=[];_0x16ee94['push'](db[_0xe2b5('0x35')][_0xe2b5('0x4f')]({'where':{'FromId':[_0x2122dd['user']['id'],_0x3abff8[_0x52d920]['id']],'ToId':[_0x2122dd[_0xe2b5('0x65')]['id'],_0x3abff8[_0x52d920]['id']],'ChatGroupId':null},'attributes':['id',_0xe2b5('0x55'),_0xe2b5('0x6e'),'ToId',_0xe2b5('0x6f'),_0xe2b5('0x52')],'order':qs[_0xe2b5('0x70')](_0xe2b5('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe2b5('0x2e')](wrapUser(_0x3abff8[_0x52d920])));}return BPromise[_0xe2b5('0x72')](_0x16ee94);}return[];})[_0xe2b5('0x2e')](function(_0x315626){return{'rows':_0x315626,'count':_0x315626['length']};})['then'](respondWithResult(_0x16a4c7,null))['catch'](handleError(_0x16a4c7,null));}; \ No newline at end of file +var _0xf012=['show','keys','includeAll','find','create','body','params','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','admin','user','role','userpic','internal','lastLoginAt','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x24092c,_0x171263){var _0x5f2cfc=function(_0x1fe393){while(--_0x1fe393){_0x24092c['push'](_0x24092c['shift']());}};_0x5f2cfc(++_0x171263);}(_0xf012,0x94));var _0x2f01=function(_0x2c9427,_0x331c7b){_0x2c9427=_0x2c9427-0x0;var _0x1b6dc8=_0xf012[_0x2c9427];return _0x1b6dc8;};'use strict';var emlformat=require(_0x2f01('0x0'));var rimraf=require(_0x2f01('0x1'));var zipdir=require(_0x2f01('0x2'));var jsonpatch=require(_0x2f01('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f01('0x4'));var Mustache=require(_0x2f01('0x5'));var util=require(_0x2f01('0x6'));var path=require(_0x2f01('0x7'));var sox=require(_0x2f01('0x8'));var csv=require('to-csv');var ejs=require(_0x2f01('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f01('0xa'));var squel=require(_0x2f01('0xb'));var crypto=require(_0x2f01('0xc'));var jsforce=require(_0x2f01('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2f01('0xe'));var querystring=require(_0x2f01('0xf'));var Papa=require(_0x2f01('0x10'));var Redis=require(_0x2f01('0x11'));var authService=require(_0x2f01('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2f01('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2f01('0x14'));var config=require(_0x2f01('0x15'));var licenseUtil=require(_0x2f01('0x16'));var db=require(_0x2f01('0x17'))['db'];config[_0x2f01('0x18')]=_['defaults'](config['redis'],{'host':_0x2f01('0x19'),'port':0x18eb});var socket=require(_0x2f01('0x1a'))(new Redis(config[_0x2f01('0x18')]));require(_0x2f01('0x1b'))[_0x2f01('0x1c')](socket);function respondWithStatusCode(_0x2e7594,_0x5e81c5){_0x5e81c5=_0x5e81c5||0xcc;return function(_0x9dbba0){if(_0x9dbba0){return _0x2e7594['sendStatus'](_0x5e81c5);}return _0x2e7594[_0x2f01('0x1d')](_0x5e81c5)[_0x2f01('0x1e')]();};}function respondWithResult(_0x25f2c6,_0x22b131){_0x22b131=_0x22b131||0xc8;return function(_0x34b2a4){if(_0x34b2a4){return _0x25f2c6[_0x2f01('0x1d')](_0x22b131)['json'](_0x34b2a4);}};}function respondWithFilteredResult(_0x158315,_0x24f19b){return function(_0x5584d9){if(_0x5584d9){var _0x474fec=typeof _0x24f19b['offset']==='undefined'&&typeof _0x24f19b[_0x2f01('0x1f')]===_0x2f01('0x20');var _0x4ea2e3=_0x5584d9[_0x2f01('0x21')];var _0x24be7d=_0x474fec?0x0:_0x24f19b[_0x2f01('0x22')];var _0x3191ba=_0x474fec?_0x5584d9[_0x2f01('0x21')]:_0x24f19b[_0x2f01('0x22')]+_0x24f19b[_0x2f01('0x1f')];var _0x1182c7;if(_0x3191ba>=_0x4ea2e3){_0x3191ba=_0x4ea2e3;_0x1182c7=0xc8;}else{_0x1182c7=0xce;}_0x158315[_0x2f01('0x1d')](_0x1182c7);return _0x158315[_0x2f01('0x23')](_0x2f01('0x24'),_0x24be7d+'-'+_0x3191ba+'/'+_0x4ea2e3)[_0x2f01('0x25')](_0x5584d9);}return null;};}function patchUpdates(_0x30b873){return function(_0x56f45a){try{jsonpatch[_0x2f01('0x26')](_0x56f45a,_0x30b873,!![]);}catch(_0x851f38){return BPromise[_0x2f01('0x27')](_0x851f38);}return _0x56f45a[_0x2f01('0x28')]();};}function saveUpdates(_0x6c78b7,_0x3ef2db){return function(_0x1b7ce1){if(_0x1b7ce1){return _0x1b7ce1[_0x2f01('0x29')](_0x6c78b7)[_0x2f01('0x2a')](function(_0x5f4783){return _0x5f4783;});}return null;};}function removeEntity(_0x3c8b58,_0x4f9b05){return function(_0x3b84ba){if(_0x3b84ba){return _0x3b84ba[_0x2f01('0x2b')]()['then'](function(){_0x3c8b58[_0x2f01('0x1d')](0xcc)[_0x2f01('0x1e')]();});}};}function handleEntityNotFound(_0x45bea6,_0x4f4312){return function(_0x516cdd){if(!_0x516cdd){_0x45bea6['sendStatus'](0x194);}return _0x516cdd;};}function handleError(_0x3d4f8d,_0x594bcb){_0x594bcb=_0x594bcb||0x1f4;return function(_0x46539d){logger['error'](_0x46539d[_0x2f01('0x2c')]);if(_0x46539d[_0x2f01('0x2d')]){delete _0x46539d['name'];}_0x3d4f8d['status'](_0x594bcb)['send'](_0x46539d);};}exports[_0x2f01('0x2e')]=function(_0x4370f8,_0x5c7ea7){var _0x43bcc5={},_0x31f9c0={},_0x53b7c7={'count':0x0,'rows':[]};var _0x416919=_[_0x2f01('0x2f')](db[_0x2f01('0x30')][_0x2f01('0x31')],function(_0x3eafea){return{'name':_0x3eafea[_0x2f01('0x32')],'type':_0x3eafea[_0x2f01('0x33')]['key']};});_0x31f9c0['model']=_['map'](_0x416919,_0x2f01('0x2d'));_0x31f9c0[_0x2f01('0x34')]=_['keys'](_0x4370f8[_0x2f01('0x34')]);_0x31f9c0[_0x2f01('0x35')]=_[_0x2f01('0x36')](_0x31f9c0[_0x2f01('0x37')],_0x31f9c0[_0x2f01('0x34')]);_0x43bcc5['attributes']=_[_0x2f01('0x36')](_0x31f9c0[_0x2f01('0x37')],qs[_0x2f01('0x38')](_0x4370f8['query']['fields']));_0x43bcc5[_0x2f01('0x39')]=_0x43bcc5[_0x2f01('0x39')][_0x2f01('0x3a')]?_0x43bcc5[_0x2f01('0x39')]:_0x31f9c0[_0x2f01('0x37')];if(!_0x4370f8[_0x2f01('0x34')][_0x2f01('0x3b')]('nolimit')){_0x43bcc5['limit']=qs[_0x2f01('0x1f')](_0x4370f8['query'][_0x2f01('0x1f')]);_0x43bcc5[_0x2f01('0x22')]=qs['offset'](_0x4370f8[_0x2f01('0x34')][_0x2f01('0x22')]);}_0x43bcc5[_0x2f01('0x3c')]=qs[_0x2f01('0x3d')](_0x4370f8[_0x2f01('0x34')][_0x2f01('0x3d')]);_0x43bcc5['where']=qs[_0x2f01('0x35')](_[_0x2f01('0x3e')](_0x4370f8[_0x2f01('0x34')],_0x31f9c0[_0x2f01('0x35')]),_0x416919);if(_0x4370f8[_0x2f01('0x34')][_0x2f01('0x3f')]){_0x43bcc5[_0x2f01('0x40')]=_[_0x2f01('0x41')](_0x43bcc5[_0x2f01('0x40')],{'$or':_[_0x2f01('0x2f')](_0x416919,function(_0x592424){if(_0x592424[_0x2f01('0x33')]!==_0x2f01('0x42')){var _0x5aa623={};_0x5aa623[_0x592424[_0x2f01('0x2d')]]={'$like':'%'+_0x4370f8[_0x2f01('0x34')]['filter']+'%'};return _0x5aa623;}})});}_0x43bcc5=_[_0x2f01('0x41')]({},_0x43bcc5,_0x4370f8[_0x2f01('0x43')]);var _0x6f6dab={'where':_0x43bcc5[_0x2f01('0x40')]};return db[_0x2f01('0x30')][_0x2f01('0x21')](_0x6f6dab)[_0x2f01('0x2a')](function(_0x21eeb4){_0x53b7c7['count']=_0x21eeb4;if(_0x4370f8['query']['includeAll']){_0x43bcc5[_0x2f01('0x44')]=[{'all':!![]}];}return db[_0x2f01('0x30')][_0x2f01('0x45')](_0x43bcc5);})[_0x2f01('0x2a')](function(_0x58cddf){_0x53b7c7[_0x2f01('0x46')]=_0x58cddf;return _0x53b7c7;})[_0x2f01('0x2a')](respondWithFilteredResult(_0x5c7ea7,_0x43bcc5))[_0x2f01('0x47')](handleError(_0x5c7ea7,null));};exports[_0x2f01('0x48')]=function(_0x56dbd9,_0x236857){var _0x56b872={'raw':!![],'where':{'id':_0x56dbd9['params']['id']}},_0x2dd0f6={};_0x2dd0f6[_0x2f01('0x37')]=_[_0x2f01('0x49')](db[_0x2f01('0x30')][_0x2f01('0x31')]);_0x2dd0f6['query']=_['keys'](_0x56dbd9[_0x2f01('0x34')]);_0x2dd0f6[_0x2f01('0x35')]=_[_0x2f01('0x36')](_0x2dd0f6[_0x2f01('0x37')],_0x2dd0f6['query']);_0x56b872[_0x2f01('0x39')]=_[_0x2f01('0x36')](_0x2dd0f6[_0x2f01('0x37')],qs[_0x2f01('0x38')](_0x56dbd9[_0x2f01('0x34')][_0x2f01('0x38')]));_0x56b872[_0x2f01('0x39')]=_0x56b872[_0x2f01('0x39')]['length']?_0x56b872[_0x2f01('0x39')]:_0x2dd0f6[_0x2f01('0x37')];if(_0x56dbd9[_0x2f01('0x34')][_0x2f01('0x4a')]){_0x56b872[_0x2f01('0x44')]=[{'all':!![]}];}_0x56b872=_[_0x2f01('0x41')]({},_0x56b872,_0x56dbd9[_0x2f01('0x43')]);return db[_0x2f01('0x30')][_0x2f01('0x4b')](_0x56b872)[_0x2f01('0x2a')](handleEntityNotFound(_0x236857,null))[_0x2f01('0x2a')](respondWithResult(_0x236857,null))[_0x2f01('0x47')](handleError(_0x236857,null));};exports[_0x2f01('0x4c')]=function(_0x426ece,_0x2568e4){return db['ChatInternalMessage'][_0x2f01('0x4c')](_0x426ece[_0x2f01('0x4d')],{})[_0x2f01('0x2a')](respondWithResult(_0x2568e4,0xc9))['catch'](handleError(_0x2568e4,null));};exports[_0x2f01('0x29')]=function(_0x442cb9,_0x259b76){if(_0x442cb9[_0x2f01('0x4d')]['id']){delete _0x442cb9['body']['id'];}return db[_0x2f01('0x30')][_0x2f01('0x4b')]({'where':{'id':_0x442cb9[_0x2f01('0x4e')]['id']}})['then'](handleEntityNotFound(_0x259b76,null))['then'](saveUpdates(_0x442cb9['body'],null))[_0x2f01('0x2a')](respondWithResult(_0x259b76,null))[_0x2f01('0x47')](handleError(_0x259b76,null));};exports[_0x2f01('0x2b')]=function(_0x532cd1,_0x231a97){return db[_0x2f01('0x30')][_0x2f01('0x4b')]({'where':{'id':_0x532cd1[_0x2f01('0x4e')]['id']}})[_0x2f01('0x2a')](handleEntityNotFound(_0x231a97,null))['then'](removeEntity(_0x231a97,null))[_0x2f01('0x47')](handleError(_0x231a97,null));};exports[_0x2f01('0x4f')]=function(_0x4e79f9,_0x727123){return db['ChatInternalMessage']['describe']()[_0x2f01('0x2a')](respondWithResult(_0x727123,null))['catch'](handleError(_0x727123,null));};function wrapUser(_0x290265){return function(_0x5c952c){var _0x2ac322=_0x290265[_0x2f01('0x50')]({'plain':!![]});_0x2ac322[_0x2f01('0x51')]=[];if(_0x5c952c){_0x2ac322['lastMessageAt']=_0x5c952c[_0x2f01('0x52')];_0x2ac322['lastMessage']=_0x5c952c;}else{_0x2ac322[_0x2f01('0x53')]=moment(0x0)[_0x2f01('0x54')](_0x2f01('0x55'));_0x2ac322[_0x2f01('0x56')]={};}return _0x2ac322;};}exports[_0x2f01('0x57')]=function(_0x4bde2e,_0x58f76d,_0x5402fd){var _0xce73a8=[];return db[_0x2f01('0x58')]['findAll']({'where':{'role':['agent',_0x2f01('0x59'),_0x2f01('0x5a')]},'attributes':['id','fullname',_0x2f01('0x2d'),_0x2f01('0x5b'),_0x2f01('0x5c'),_0x2f01('0x5d'),'online',_0x2f01('0x5e'),'allowmessenger','showWebBar'],'order':qs[_0x2f01('0x3d')]('-online'),'include':[{'model':db[_0x2f01('0x5f')],'as':_0x2f01('0x60'),'attributes':['id',_0x2f01('0x2d'),_0x2f01('0x33')],'through':{'attributes':[]}}]})[_0x2f01('0x2a')](function(_0xdc407e){if(_0xdc407e){var _0x472883=_0x4bde2e[_0x2f01('0x5a')][_0x2f01('0x50')]({'plain':!![]});if(!_0x472883)throw new Error(_0x2f01('0x61'));if(_0x472883[_0x2f01('0x5b')]===_0x2f01('0x5a')){return db['UserProfileSection'][_0x2f01('0x4b')]({'where':{'name':_0x2f01('0x62'),'userProfileId':_0x472883[_0x2f01('0x63')]},'raw':!![]})[_0x2f01('0x2a')](function(_0x9eb78a){if(_0x9eb78a){if(_0x9eb78a['autoAssociation']===0x0){return db[_0x2f01('0x64')][_0x2f01('0x45')]({'where':{'sectionId':_0x9eb78a['id']},'raw':!![]})[_0x2f01('0x2a')](function(_0xd5a05e){var _0x2a23e9=[];if(_[_0x2f01('0x65')](_0xd5a05e)){_0x2a23e9=_['filter'](_0xdc407e,function(_0x1c2616){if(_0x1c2616['role']!=='agent'){return _0x1c2616;}});return _0x2a23e9;}else{for(var _0x5d42a7=0x0;_0x5d42a7<_0xdc407e[_0x2f01('0x3a')];_0x5d42a7++){var _0x54ca1d=_0xdc407e[_0x5d42a7];if(_0x54ca1d[_0x2f01('0x5b')]===_0x2f01('0x66')){var _0x25bf37=_[_0x2f01('0x4b')](_0xd5a05e,function(_0x4340ea){return _0x4340ea[_0x2f01('0x67')]===_0x54ca1d['id'];});if(_0x25bf37)_0x2a23e9[_0x2f01('0x68')](_0x54ca1d);}else{_0x2a23e9[_0x2f01('0x68')](_0x54ca1d);}}return _0x2a23e9;}});}else{return _0xdc407e;}}else{var _0x103097=_[_0x2f01('0x3f')](_0xdc407e,function(_0x513fbf){if(_0x513fbf[_0x2f01('0x5b')]!==_0x2f01('0x66')){return _0x513fbf;}});return _0x103097;}});}else{return _0xdc407e;}}})[_0x2f01('0x2a')](function(_0x24fa3c){var _0x4cce40=[];if(_0x24fa3c){_0xce73a8=_0x24fa3c;for(var _0x1ab507=0x0;_0x1ab507<_0x24fa3c['length'];_0x1ab507+=0x1){_0xce73a8[_0x1ab507][_0x2f01('0x51')]=[];_0x4cce40['push'](db[_0x2f01('0x30')]['find']({'where':{'FromId':[_0x4bde2e[_0x2f01('0x5a')]['id'],_0x24fa3c[_0x1ab507]['id']],'ToId':[_0x4bde2e[_0x2f01('0x5a')]['id'],_0x24fa3c[_0x1ab507]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2f01('0x69'),_0x2f01('0x6a'),_0x2f01('0x6b'),_0x2f01('0x4d')],'order':qs[_0x2f01('0x3d')](_0x2f01('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2f01('0x2a')](wrapUser(_0x24fa3c[_0x1ab507])));}return BPromise[_0x2f01('0x6d')](_0x4cce40);}return[];})[_0x2f01('0x2a')](function(_0x429dac){return{'rows':_0x429dac,'count':_0x429dac[_0x2f01('0x3a')]};})[_0x2f01('0x2a')](respondWithResult(_0x58f76d,null))[_0x2f01('0x47')](handleError(_0x58f76d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1c2b0bd..b8145f0 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 _0x6b36=['ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x6b36,0x1c9));var _0x66b3=function(_0x1ece58,_0x4f79b1){_0x1ece58=_0x1ece58-0x0;var _0x96e2c3=_0x6b36[_0x1ece58];return _0x96e2c3;};'use strict';var EventEmitter=require(_0x66b3('0x0'));var ChatInternalMessage=require(_0x66b3('0x1'))['db'][_0x66b3('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66b3('0x3'),'afterUpdate':_0x66b3('0x4'),'afterDestroy':_0x66b3('0x5')};function emitEvent(_0x575aad){return function(_0x467cee,_0x411c16,_0x12841a){ChatInternalMessageEvents[_0x66b3('0x6')](_0x575aad+':'+_0x467cee['id'],_0x467cee);ChatInternalMessageEvents[_0x66b3('0x6')](_0x575aad,_0x467cee);_0x12841a(null);};}for(var e in events){if(events[_0x66b3('0x7')](e)){var event=events[e];ChatInternalMessage[_0x66b3('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x342c=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2556df,_0x422249){var _0x4a47c3=function(_0x56c791){while(--_0x56c791){_0x2556df['push'](_0x2556df['shift']());}};_0x4a47c3(++_0x422249);}(_0x342c,0x149));var _0xc342=function(_0x2e4bbf,_0x4e7cca){_0x2e4bbf=_0x2e4bbf-0x0;var _0x2e237c=_0x342c[_0x2e4bbf];return _0x2e237c;};'use strict';var EventEmitter=require(_0xc342('0x0'));var ChatInternalMessage=require(_0xc342('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc342('0x2')](0x0);var events={'afterCreate':_0xc342('0x3'),'afterUpdate':_0xc342('0x4'),'afterDestroy':_0xc342('0x5')};function emitEvent(_0x795b47){return function(_0x5553d2,_0x34c579,_0x22480a){ChatInternalMessageEvents[_0xc342('0x6')](_0x795b47+':'+_0x5553d2['id'],_0x5553d2);ChatInternalMessageEvents[_0xc342('0x6')](_0x795b47,_0x5553d2);_0x22480a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xc342('0x7')](e,emitEvent(event));}}module[_0xc342('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 e871291..66c7ab2 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 _0x877a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x436832,_0x36cfd1){var _0x588859=function(_0x10cae0){while(--_0x10cae0){_0x436832['push'](_0x436832['shift']());}};_0x588859(++_0x36cfd1);}(_0x877a,0x1d4));var _0xa877=function(_0xa89bc4,_0x3fb5f0){_0xa89bc4=_0xa89bc4-0x0;var _0x8ab9be=_0x877a[_0xa89bc4];return _0x8ab9be;};'use strict';var _=require(_0xa877('0x0'));var util=require('util');var logger=require(_0xa877('0x1'))(_0xa877('0x2'));var moment=require(_0xa877('0x3'));var BPromise=require(_0xa877('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa877('0x5'));var rimraf=require(_0xa877('0x6'));var config=require(_0xa877('0x7'));var attributes=require(_0xa877('0x8'));module['exports']=function(_0x5f2dc6,_0x3e321a){return _0x5f2dc6[_0xa877('0x9')](_0xa877('0xa'),attributes,{'tableName':_0xa877('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa877('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x818f=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_internal_messages','utf8mb4_unicode_ci'];(function(_0x2fa834,_0xf01998){var _0x2cb36c=function(_0x39c16a){while(--_0x39c16a){_0x2fa834['push'](_0x2fa834['shift']());}};_0x2cb36c(++_0xf01998);}(_0x818f,0x180));var _0xf818=function(_0x1c44cf,_0x323aba){_0x1c44cf=_0x1c44cf-0x0;var _0x5d3283=_0x818f[_0x1c44cf];return _0x5d3283;};'use strict';var _=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf818('0x2'));var BPromise=require(_0xf818('0x3'));var rp=require(_0xf818('0x4'));var fs=require('fs');var path=require(_0xf818('0x5'));var rimraf=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xf818('0x8')]=function(_0x3096a2,_0x388c4d){return _0x3096a2[_0xf818('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xf818('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf818('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c450934..77f4745 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 _0xb1ed=['catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatInternalMessage.socket','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4dc474,_0x45e3de){var _0x3e5f68=function(_0x55693a){while(--_0x55693a){_0x4dc474['push'](_0x4dc474['shift']());}};_0x3e5f68(++_0x45e3de);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x3e1ccd,_0x3d3880){_0x3e1ccd=_0x3e1ccd-0x0;var _0x3e02ed=_0xb1ed[_0x3e1ccd];return _0x3e02ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb1e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb1e('0x1'));var db=require(_0xdb1e('0x2'))['db'];var utils=require(_0xdb1e('0x3'));var logger=require(_0xdb1e('0x4'))(_0xdb1e('0x5'));var config=require(_0xdb1e('0x6'));var jayson=require(_0xdb1e('0x7'));var client=jayson['client'][_0xdb1e('0x8')]({'port':0x232a});config[_0xdb1e('0x9')]=_['defaults'](config[_0xdb1e('0x9')],{'host':_0xdb1e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb1e('0x9')]));require(_0xdb1e('0xb'))[_0xdb1e('0xc')](socket);function respondWithRpcPromise(_0x224cb8,_0x5f44ff,_0xc4fb3){return new BPromise(function(_0x408845,_0x284044){return client[_0xdb1e('0xd')](_0x224cb8,_0xc4fb3)['then'](function(_0x2d948f){logger['info'](_0xdb1e('0xe'),_0x5f44ff,_0xdb1e('0xf'));logger[_0xdb1e('0x10')](_0xdb1e('0x11'),_0x5f44ff,_0xdb1e('0xf'),JSON['stringify'](_0x2d948f));if(_0x2d948f[_0xdb1e('0x12')]){if(_0x2d948f[_0xdb1e('0x12')][_0xdb1e('0x13')]===0x1f4){logger[_0xdb1e('0x12')](_0xdb1e('0xe'),_0x5f44ff,_0x2d948f[_0xdb1e('0x12')][_0xdb1e('0x14')]);return _0x284044(_0x2d948f[_0xdb1e('0x12')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x5f44ff,_0x2d948f[_0xdb1e('0x12')][_0xdb1e('0x14')]);return _0x408845(_0x2d948f[_0xdb1e('0x12')]['message']);}else{logger['info'](_0xdb1e('0xe'),_0x5f44ff,_0xdb1e('0xf'));_0x408845(_0x2d948f[_0xdb1e('0x15')]['message']);}})[_0xdb1e('0x16')](function(_0x25312a){logger[_0xdb1e('0x12')](_0xdb1e('0xe'),_0x5f44ff,_0x25312a);_0x284044(_0x25312a);});});} \ No newline at end of file +var _0x819d=['stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51e530,_0x3edab0){var _0x41058f=function(_0x1ac98a){while(--_0x1ac98a){_0x51e530['push'](_0x51e530['shift']());}};_0x41058f(++_0x3edab0);}(_0x819d,0xc2));var _0xd819=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x819d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd819('0x0'));var util=require('util');var moment=require(_0xd819('0x1'));var BPromise=require(_0xd819('0x2'));var rs=require(_0xd819('0x3'));var fs=require('fs');var Redis=require(_0xd819('0x4'));var db=require(_0xd819('0x5'))['db'];var utils=require(_0xd819('0x6'));var logger=require(_0xd819('0x7'))(_0xd819('0x8'));var config=require(_0xd819('0x9'));var jayson=require(_0xd819('0xa'));var client=jayson['client'][_0xd819('0xb')]({'port':0x232a});config[_0xd819('0xc')]=_[_0xd819('0xd')](config[_0xd819('0xc')],{'host':_0xd819('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd819('0xc')]));require(_0xd819('0xf'))[_0xd819('0x10')](socket);function respondWithRpcPromise(_0x4d7181,_0x142dd5,_0x2baccf){return new BPromise(function(_0x36658e,_0x22b980){return client[_0xd819('0x11')](_0x4d7181,_0x2baccf)['then'](function(_0x4600ab){logger[_0xd819('0x12')](_0xd819('0x13'),_0x142dd5,_0xd819('0x14'));logger[_0xd819('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x142dd5,_0xd819('0x14'),JSON[_0xd819('0x16')](_0x4600ab));if(_0x4600ab[_0xd819('0x17')]){if(_0x4600ab['error']['code']===0x1f4){logger[_0xd819('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x142dd5,_0x4600ab['error'][_0xd819('0x18')]);return _0x22b980(_0x4600ab[_0xd819('0x17')][_0xd819('0x18')]);}logger[_0xd819('0x17')](_0xd819('0x13'),_0x142dd5,_0x4600ab[_0xd819('0x17')][_0xd819('0x18')]);return _0x36658e(_0x4600ab[_0xd819('0x17')]['message']);}else{logger[_0xd819('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x142dd5,_0xd819('0x14'));_0x36658e(_0x4600ab[_0xd819('0x19')]['message']);}})[_0xd819('0x1a')](function(_0x5ccc59){logger[_0xd819('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x142dd5,_0x5ccc59);_0x22b980(_0x5ccc59);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d3e2721..9fd1f8d 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 _0x7822=['save','remove','emit','register','length','./chatInternalMessage.events'];(function(_0x14a5fe,_0x396e5f){var _0x4c7887=function(_0x274cdf){while(--_0x274cdf){_0x14a5fe['push'](_0x14a5fe['shift']());}};_0x4c7887(++_0x396e5f);}(_0x7822,0x179));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0x2782('0x0'));var events=[_0x2782('0x1'),_0x2782('0x2'),'update'];function createListener(_0x5e84d6,_0x46b2f6){return function(_0x5c8492){_0x46b2f6[_0x2782('0x3')](_0x5e84d6,_0x5c8492);};}function removeListener(_0x1281b9,_0x3b35f9){return function(){ChatInternalMessageEvents['removeListener'](_0x1281b9,_0x3b35f9);};}exports[_0x2782('0x4')]=function(_0x49ea0e){for(var _0x21f7e1=0x0,_0x325de8=events[_0x2782('0x5')];_0x21f7e1<_0x325de8;_0x21f7e1++){var _0x516e45=events[_0x21f7e1];var _0x427074=createListener('chatInternalMessage:'+_0x516e45,_0x49ea0e);ChatInternalMessageEvents['on'](_0x516e45,_0x427074);}}; \ No newline at end of file +var _0xc5dd=['length','chatInternalMessage:','save','remove','emit','register'];(function(_0x48ad8e,_0x53b414){var _0x45c9ec=function(_0x3d6deb){while(--_0x3d6deb){_0x48ad8e['push'](_0x48ad8e['shift']());}};_0x45c9ec(++_0x53b414);}(_0xc5dd,0x104));var _0xdc5d=function(_0x11aa24,_0x6fb204){_0x11aa24=_0x11aa24-0x0;var _0x158562=_0xc5dd[_0x11aa24];return _0x158562;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xdc5d('0x0'),_0xdc5d('0x1'),'update'];function createListener(_0x233ea3,_0x55affa){return function(_0x1d01c7){_0x55affa[_0xdc5d('0x2')](_0x233ea3,_0x1d01c7);};}function removeListener(_0x266803,_0xdf141d){return function(){ChatInternalMessageEvents['removeListener'](_0x266803,_0xdf141d);};}exports[_0xdc5d('0x3')]=function(_0x3d4028){for(var _0x2a6852=0x0,_0x9fd372=events[_0xdc5d('0x4')];_0x2a6852<_0x9fd372;_0x2a6852++){var _0x289c9d=events[_0x2a6852];var _0x1095e7=createListener(_0xdc5d('0x5')+_0x289c9d,_0x3d4028);ChatInternalMessageEvents['on'](_0x289c9d,_0x1095e7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0105d7e..8c02919 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 _0x75c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1e3103,_0x19e1e8){var _0x1771ea=function(_0x49f246){while(--_0x49f246){_0x1e3103['push'](_0x1e3103['shift']());}};_0x1771ea(++_0x19e1e8);}(_0x75c8,0x17a));var _0x875c=function(_0x460c41,_0x10df8e){_0x460c41=_0x460c41-0x0;var _0x19b931=_0x75c8[_0x460c41];return _0x19b931;};'use strict';var multer=require('multer');var util=require(_0x875c('0x0'));var path=require(_0x875c('0x1'));var timeout=require(_0x875c('0x2'));var express=require(_0x875c('0x3'));var router=express[_0x875c('0x4')]();var fs_extra=require(_0x875c('0x5'));var auth=require(_0x875c('0x6'));var interaction=require(_0x875c('0x7'));var config=require(_0x875c('0x8'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x875c('0x9')]);router[_0x875c('0xa')](_0x875c('0xb'),auth['isAuthenticated'](),controller[_0x875c('0xc')]);router[_0x875c('0xa')](_0x875c('0xd'),auth[_0x875c('0xe')](),controller[_0x875c('0xf')]);router['get'](_0x875c('0x10'),auth[_0x875c('0xe')](),controller[_0x875c('0x11')]);router[_0x875c('0x12')]('/',auth[_0x875c('0xe')](),controller[_0x875c('0x13')]);router[_0x875c('0x14')](_0x875c('0x10'),controller[_0x875c('0x15')]);router[_0x875c('0x16')](_0x875c('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x875c('0x17')]=router; \ No newline at end of file +var _0x4318=['create','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4318,0x1eb));var _0x8431=function(_0x3cfa65,_0x306409){_0x3cfa65=_0x3cfa65-0x0;var _0x842757=_0x4318[_0x3cfa65];return _0x842757;};'use strict';var multer=require('multer');var util=require(_0x8431('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8431('0x1'));var router=express[_0x8431('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8431('0x3'));var interaction=require(_0x8431('0x4'));var config=require(_0x8431('0x5'));var controller=require(_0x8431('0x6'));router[_0x8431('0x7')]('/',auth[_0x8431('0x8')](),controller[_0x8431('0x9')]);router[_0x8431('0x7')](_0x8431('0xa'),auth[_0x8431('0x8')](),controller['describe']);router[_0x8431('0x7')]('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x8431('0x7')](_0x8431('0xb'),auth['isAuthenticated'](),controller[_0x8431('0xc')]);router['post']('/',auth[_0x8431('0x8')](),controller[_0x8431('0xd')]);router[_0x8431('0xe')]('/:id',controller['update']);router[_0x8431('0xf')](_0x8431('0xb'),auth[_0x8431('0x8')](),controller[_0x8431('0x10')]);module[_0x8431('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d02f8a6..628c7f3 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 _0x6ea9=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5c4eba,_0x5dbfce){var _0x17bf3e=function(_0x58ff68){while(--_0x58ff68){_0x5c4eba['push'](_0x5c4eba['shift']());}};_0x17bf3e(++_0x5dbfce);}(_0x6ea9,0x89));var _0x96ea=function(_0x3f41ec,_0x13b195){_0x3f41ec=_0x3f41ec-0x0;var _0x551686=_0x6ea9[_0x3f41ec];return _0x551686;};'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 _0x1cc3=['out','DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x163555,_0x27ce78){var _0x250307=function(_0x27c529){while(--_0x27c529){_0x163555['push'](_0x163555['shift']());}};_0x250307(++_0x27ce78);}(_0x1cc3,0x11b));var _0x31cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1cc3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'body':{'type':Sequelize['TEXT'](_0x31cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x31cc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31cc('0x4')]('in',_0x31cc('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x31cc('0x6')]},'providerName':{'type':Sequelize[_0x31cc('0x7')]},'providerResponse':{'type':Sequelize[_0x31cc('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 68697dd..4f6d02f 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 _0xdc8f=['attributes','fields','nolimit','order','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','params','body','find','describe','chat-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','email','manual','interface','format','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SELECT','User','internal','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x378a48,_0x5b012f){var _0x1538c5=function(_0x372bcc){while(--_0x372bcc){_0x378a48['push'](_0x378a48['shift']());}};_0x1538c5(++_0x5b012f);}(_0xdc8f,0x140));var _0xfdc8=function(_0x1b62b8,_0x3e78d9){_0x1b62b8=_0x1b62b8-0x0;var _0x47a5a0=_0xdc8f[_0x1b62b8];return _0x47a5a0;};'use strict';var emlformat=require(_0xfdc8('0x0'));var rimraf=require(_0xfdc8('0x1'));var zipdir=require(_0xfdc8('0x2'));var jsonpatch=require(_0xfdc8('0x3'));var rp=require(_0xfdc8('0x4'));var moment=require(_0xfdc8('0x5'));var BPromise=require(_0xfdc8('0x6'));var Mustache=require(_0xfdc8('0x7'));var util=require(_0xfdc8('0x8'));var path=require(_0xfdc8('0x9'));var sox=require('sox');var csv=require(_0xfdc8('0xa'));var ejs=require(_0xfdc8('0xb'));var fs=require('fs');var fs_extra=require(_0xfdc8('0xc'));var _=require(_0xfdc8('0xd'));var squel=require(_0xfdc8('0xe'));var crypto=require('crypto');var jsforce=require(_0xfdc8('0xf'));var deskjs=require(_0xfdc8('0x10'));var toCsv=require(_0xfdc8('0xa'));var querystring=require(_0xfdc8('0x11'));var Papa=require('papaparse');var Redis=require(_0xfdc8('0x12'));var authService=require(_0xfdc8('0x13'));var qs=require(_0xfdc8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdc8('0x15'));var logger=require(_0xfdc8('0x16'))(_0xfdc8('0x17'));var utils=require(_0xfdc8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfdc8('0x19'));var db=require('../../mysqldb')['db'];config[_0xfdc8('0x1a')]=_[_0xfdc8('0x1b')](config[_0xfdc8('0x1a')],{'host':_0xfdc8('0x1c'),'port':0x18eb});var socket=require(_0xfdc8('0x1d'))(new Redis(config[_0xfdc8('0x1a')]));require(_0xfdc8('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfdc8('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xfdc8('0x1f')][_0xfdc8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46acd4,_0x4d12ce,_0x374db2,_0xce8cb4){return new BPromise(function(_0x3a9902,_0x5126a4){var _0x359fb7=_0xce8cb4||client;return _0x359fb7[_0xfdc8('0x21')](_0x46acd4,_0x374db2)[_0xfdc8('0x22')](function(_0x1e792b){logger[_0xfdc8('0x23')](_0xfdc8('0x24'),_0x4d12ce,_0xfdc8('0x25'));logger[_0xfdc8('0x26')](_0xfdc8('0x27'),_0x4d12ce,'request\x20sent',JSON[_0xfdc8('0x28')](_0x1e792b));if(_0x1e792b['error']){if(_0x1e792b[_0xfdc8('0x29')][_0xfdc8('0x2a')]===0x1f4){logger[_0xfdc8('0x29')](_0xfdc8('0x24'),_0x4d12ce,_0x1e792b['error']['message']);return _0x5126a4(_0x1e792b[_0xfdc8('0x29')][_0xfdc8('0x2b')]);}logger[_0xfdc8('0x29')]('ChatMessage,\x20%s,\x20%s',_0x4d12ce,_0x1e792b[_0xfdc8('0x29')][_0xfdc8('0x2b')]);return _0x3a9902(_0x1e792b['error'][_0xfdc8('0x2b')]);}else{logger[_0xfdc8('0x23')](_0xfdc8('0x24'),_0x4d12ce,_0xfdc8('0x25'));_0x3a9902(_0x1e792b[_0xfdc8('0x2c')][_0xfdc8('0x2b')]);}})[_0xfdc8('0x2d')](function(_0x34e28a){logger[_0xfdc8('0x29')](_0xfdc8('0x24'),_0x4d12ce,_0x34e28a);_0x5126a4(_0x34e28a);});});}function respondWithStatusCode(_0x105abf,_0x59e46e){_0x59e46e=_0x59e46e||0xcc;return function(_0x289188){if(_0x289188){return _0x105abf[_0xfdc8('0x2e')](_0x59e46e);}return _0x105abf[_0xfdc8('0x2f')](_0x59e46e)['end']();};}function respondWithResult(_0x4c140f,_0x1a7cec){_0x1a7cec=_0x1a7cec||0xc8;return function(_0x4541cb){if(_0x4541cb){return _0x4c140f[_0xfdc8('0x2f')](_0x1a7cec)[_0xfdc8('0x30')](_0x4541cb);}};}function respondWithFilteredResult(_0x137071,_0x16e4ac){return function(_0x4eb5ec){if(_0x4eb5ec){var _0x2d0136=typeof _0x16e4ac['offset']===_0xfdc8('0x31')&&typeof _0x16e4ac[_0xfdc8('0x32')]===_0xfdc8('0x31');var _0x2cbe1b=_0x4eb5ec['count'];var _0x5a6af1=_0x2d0136?0x0:_0x16e4ac[_0xfdc8('0x33')];var _0x1aca0c=_0x2d0136?_0x4eb5ec[_0xfdc8('0x34')]:_0x16e4ac[_0xfdc8('0x33')]+_0x16e4ac['limit'];var _0x10c82a;if(_0x1aca0c>=_0x2cbe1b){_0x1aca0c=_0x2cbe1b;_0x10c82a=0xc8;}else{_0x10c82a=0xce;}_0x137071['status'](_0x10c82a);return _0x137071['set'](_0xfdc8('0x35'),_0x5a6af1+'-'+_0x1aca0c+'/'+_0x2cbe1b)[_0xfdc8('0x30')](_0x4eb5ec);}return null;};}function patchUpdates(_0x139a33){return function(_0x576e3f){try{jsonpatch[_0xfdc8('0x36')](_0x576e3f,_0x139a33,!![]);}catch(_0x518836){return BPromise[_0xfdc8('0x37')](_0x518836);}return _0x576e3f['save']();};}function saveUpdates(_0x4a6b11,_0x43ce13){return function(_0x2a2ad5){if(_0x2a2ad5){return _0x2a2ad5[_0xfdc8('0x38')](_0x4a6b11)['then'](function(_0x5ec95e){return _0x5ec95e;});}return null;};}function removeEntity(_0x3b9e71,_0x19c1e5){return function(_0x16b46f){if(_0x16b46f){return _0x16b46f[_0xfdc8('0x39')]()['then'](function(){_0x3b9e71[_0xfdc8('0x2f')](0xcc)[_0xfdc8('0x3a')]();});}};}function handleEntityNotFound(_0x3c271c,_0x229d4f){return function(_0x2425b2){if(!_0x2425b2){_0x3c271c['sendStatus'](0x194);}return _0x2425b2;};}function handleError(_0x169f55,_0x536365){_0x536365=_0x536365||0x1f4;return function(_0x4c7bba){logger[_0xfdc8('0x29')](_0x4c7bba[_0xfdc8('0x3b')]);if(_0x4c7bba['name']){delete _0x4c7bba[_0xfdc8('0x3c')];}_0x169f55[_0xfdc8('0x2f')](_0x536365)[_0xfdc8('0x3d')](_0x4c7bba);};}exports[_0xfdc8('0x3e')]=function(_0x1dcb5c,_0x48aaff){var _0x3917fd={},_0x4a584b={},_0x23ec61={'count':0x0,'rows':[]};var _0x5e1fe2=_[_0xfdc8('0x3f')](db[_0xfdc8('0x40')][_0xfdc8('0x41')],function(_0x1deb6a){return{'name':_0x1deb6a['fieldName'],'type':_0x1deb6a[_0xfdc8('0x42')][_0xfdc8('0x43')]};});_0x4a584b[_0xfdc8('0x44')]=_[_0xfdc8('0x3f')](_0x5e1fe2,_0xfdc8('0x3c'));_0x4a584b[_0xfdc8('0x45')]=_[_0xfdc8('0x46')](_0x1dcb5c['query']);_0x4a584b[_0xfdc8('0x47')]=_[_0xfdc8('0x48')](_0x4a584b[_0xfdc8('0x44')],_0x4a584b[_0xfdc8('0x45')]);_0x3917fd[_0xfdc8('0x49')]=_[_0xfdc8('0x48')](_0x4a584b[_0xfdc8('0x44')],qs[_0xfdc8('0x4a')](_0x1dcb5c['query'][_0xfdc8('0x4a')]));_0x3917fd['attributes']=_0x3917fd['attributes']['length']?_0x3917fd['attributes']:_0x4a584b[_0xfdc8('0x44')];if(!_0x1dcb5c[_0xfdc8('0x45')]['hasOwnProperty'](_0xfdc8('0x4b'))){_0x3917fd['limit']=qs[_0xfdc8('0x32')](_0x1dcb5c[_0xfdc8('0x45')]['limit']);_0x3917fd['offset']=qs['offset'](_0x1dcb5c[_0xfdc8('0x45')][_0xfdc8('0x33')]);}_0x3917fd[_0xfdc8('0x4c')]=qs['sort'](_0x1dcb5c[_0xfdc8('0x45')]['sort']);_0x3917fd[_0xfdc8('0x4d')]=qs[_0xfdc8('0x47')](_[_0xfdc8('0x4e')](_0x1dcb5c[_0xfdc8('0x45')],_0x4a584b['filters']),_0x5e1fe2);if(_0x1dcb5c[_0xfdc8('0x45')]['filter']){_0x3917fd[_0xfdc8('0x4d')]=_['merge'](_0x3917fd[_0xfdc8('0x4d')],{'$or':_[_0xfdc8('0x3f')](_0x5e1fe2,function(_0x2dfb32){if(_0x2dfb32['type']!==_0xfdc8('0x4f')){var _0x2bd3b6={};_0x2bd3b6[_0x2dfb32[_0xfdc8('0x3c')]]={'$like':'%'+_0x1dcb5c[_0xfdc8('0x45')][_0xfdc8('0x50')]+'%'};return _0x2bd3b6;}})});}_0x3917fd=_[_0xfdc8('0x51')]({},_0x3917fd,_0x1dcb5c['options']);var _0x38bad4={'where':_0x3917fd[_0xfdc8('0x4d')]};return db[_0xfdc8('0x40')]['count'](_0x38bad4)['then'](function(_0x51c110){_0x23ec61[_0xfdc8('0x34')]=_0x51c110;if(_0x1dcb5c[_0xfdc8('0x45')]['includeAll']){_0x3917fd[_0xfdc8('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0xfdc8('0x53')](_0x3917fd);})[_0xfdc8('0x22')](function(_0x4de4bb){_0x23ec61[_0xfdc8('0x54')]=_0x4de4bb;return _0x23ec61;})['then'](respondWithFilteredResult(_0x48aaff,_0x3917fd))['catch'](handleError(_0x48aaff,null));};exports[_0xfdc8('0x55')]=function(_0x39c361,_0x1e6159){var _0x29a270={'raw':!![],'where':{'id':_0x39c361[_0xfdc8('0x56')]['id']}},_0x44ce1c={};_0x44ce1c[_0xfdc8('0x44')]=_[_0xfdc8('0x46')](db[_0xfdc8('0x40')][_0xfdc8('0x41')]);_0x44ce1c[_0xfdc8('0x45')]=_[_0xfdc8('0x46')](_0x39c361[_0xfdc8('0x45')]);_0x44ce1c[_0xfdc8('0x47')]=_[_0xfdc8('0x48')](_0x44ce1c[_0xfdc8('0x44')],_0x44ce1c[_0xfdc8('0x45')]);_0x29a270[_0xfdc8('0x49')]=_[_0xfdc8('0x48')](_0x44ce1c[_0xfdc8('0x44')],qs[_0xfdc8('0x4a')](_0x39c361[_0xfdc8('0x45')][_0xfdc8('0x4a')]));_0x29a270[_0xfdc8('0x49')]=_0x29a270['attributes']['length']?_0x29a270[_0xfdc8('0x49')]:_0x44ce1c[_0xfdc8('0x44')];if(_0x39c361[_0xfdc8('0x45')]['includeAll']){_0x29a270['include']=[{'all':!![]}];}_0x29a270=_[_0xfdc8('0x51')]({},_0x29a270,_0x39c361['options']);return db['ChatMessage']['find'](_0x29a270)[_0xfdc8('0x22')](handleEntityNotFound(_0x1e6159,null))[_0xfdc8('0x22')](respondWithResult(_0x1e6159,null))[_0xfdc8('0x2d')](handleError(_0x1e6159,null));};exports['create']=function(_0x4ecac4,_0x2557f3){return db['ChatMessage']['create'](_0x4ecac4[_0xfdc8('0x57')],{})[_0xfdc8('0x22')](respondWithResult(_0x2557f3,0xc9))[_0xfdc8('0x2d')](handleError(_0x2557f3,null));};exports[_0xfdc8('0x38')]=function(_0x13a83d,_0x2daf7a){if(_0x13a83d[_0xfdc8('0x57')]['id']){delete _0x13a83d[_0xfdc8('0x57')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x13a83d[_0xfdc8('0x56')]['id']}})[_0xfdc8('0x22')](handleEntityNotFound(_0x2daf7a,null))['then'](saveUpdates(_0x13a83d[_0xfdc8('0x57')],null))['then'](respondWithResult(_0x2daf7a,null))[_0xfdc8('0x2d')](handleError(_0x2daf7a,null));};exports[_0xfdc8('0x39')]=function(_0x1132dd,_0x248526){return db[_0xfdc8('0x40')][_0xfdc8('0x58')]({'where':{'id':_0x1132dd[_0xfdc8('0x56')]['id']}})['then'](handleEntityNotFound(_0x248526,null))[_0xfdc8('0x22')](removeEntity(_0x248526,null))['catch'](handleError(_0x248526,null));};exports[_0xfdc8('0x59')]=function(_0x2af36b,_0x22e4b6){return db[_0xfdc8('0x40')][_0xfdc8('0x59')]()[_0xfdc8('0x22')](respondWithResult(_0x22e4b6,null))['catch'](handleError(_0x22e4b6,null));};var interaction_log=require(_0xfdc8('0x16'))(_0xfdc8('0x5a'));exports['accept']=function(_0xff9696,_0x3d1849,_0x136548){var _0x47ca85={'agent':{},'channel':'chat'};if(_0xff9696[_0xfdc8('0x57')]['id']){delete _0xff9696[_0xfdc8('0x57')]['id'];}_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5b')]=!![];_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5c')]=moment()['format'](_0xfdc8('0x5d'));_0xff9696['body'][_0xfdc8('0x5e')]=_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5e')]||_0xff9696[_0xfdc8('0x5f')]['id'];_0x47ca85[_0xfdc8('0x60')]['id']=_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5e')];return db[_0xfdc8('0x40')][_0xfdc8('0x58')]({'where':{'id':_0xff9696[_0xfdc8('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d1849,null))[_0xfdc8('0x22')](saveUpdates(_0xff9696['body'],null))['then'](function(_0x12078f){if(_0x12078f){_0x47ca85[_0xfdc8('0x2b')]=_0x12078f[_0xfdc8('0x61')]({'plain':!![]});return db[_0xfdc8('0x62')][_0xfdc8('0x58')]({'where':{'id':_0x12078f[_0xfdc8('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3d1849,null))[_0xfdc8('0x22')](function(_0x466ad8){if(_0x466ad8){return _0x466ad8[_0xfdc8('0x38')]({'UserId':_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5e')],'read1stAt':_['isNil'](_0x466ad8[_0xfdc8('0x64')])?moment()['format'](_0xfdc8('0x5d')):undefined});}return null;})[_0xfdc8('0x22')](function(_0x35e24e){if(_0x35e24e){_0x47ca85[_0xfdc8('0x65')]=_0x35e24e[_0xfdc8('0x61')]({'plain':!![]});interaction_log[_0xfdc8('0x23')](_0xfdc8('0x66'),_0xff9696[_0xfdc8('0x5f')]['id'],_0xff9696['user'][_0xfdc8('0x3c')],_0xff9696[_0xfdc8('0x5f')][_0xfdc8('0x67')],_0x47ca85[_0xfdc8('0x65')]['id'],_0xff9696[_0xfdc8('0x57')]?JSON[_0xfdc8('0x28')](_0xff9696[_0xfdc8('0x57')]):'null');return respondWithRpcPromise(_0xfdc8('0x68'),_0xfdc8('0x69'),_0x47ca85);}return null;})[_0xfdc8('0x22')](function(_0x1268d1){var _0x27ed15=_0xfdc8('0x6a')+_0x1268d1['message'][_0xfdc8('0x6b')];return db[_0xfdc8('0x6c')][_0xfdc8('0x45')](_0x27ed15,{'type':db['Sequelize'][_0xfdc8('0x6d')]['SELECT'],'raw':!![]})[_0xfdc8('0x22')](function(_0x28e8fe){return _0x28e8fe;});})[_0xfdc8('0x22')](function(_0x36920b){if(_0x36920b){_0x47ca85[_0xfdc8('0x2b')]['contact']=_0x36920b[0x0];if(!_0xff9696['body']['UserId'])return;return db['User']['find']({'where':{'id':_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x5e')],'role':_0xfdc8('0x60')},'attributes':['id',_0xfdc8('0x3c'),'fullname',_0xfdc8('0x6e'),'internal'],'raw':!![]});}return null;})[_0xfdc8('0x22')](function(_0x1e81a8){if(!_0x1e81a8)return null;_0x47ca85['message'][_0xfdc8('0x60')]=_0x1e81a8;return _0x47ca85;})[_0xfdc8('0x22')](function(_0x53c6af){if(_0x53c6af){if(_0xff9696[_0xfdc8('0x57')][_0xfdc8('0x6f')]){_0x47ca85[_0xfdc8('0x2b')][_0xfdc8('0x70')]=util[_0xfdc8('0x71')](_0xfdc8('0x72'),_0xff9696[_0xfdc8('0x5f')][_0xfdc8('0x3c')]);_0x47ca85[_0xfdc8('0x2b')][_0xfdc8('0x73')]=_0x47ca85[_0xfdc8('0x73')];_0x47ca85['message']['motionChannel']=_0x47ca85[_0xfdc8('0x73')];_0x47ca85[_0xfdc8('0x2b')][_0xfdc8('0x74')]=_0xfdc8('0x75');return respondWithRpcPromise(_0xfdc8('0x76'),_0xfdc8('0x76'),{'event':_0xfdc8('0x77'),'message':_[_0xfdc8('0x51')](_0x47ca85[_0xfdc8('0x2b')],JSON[_0xfdc8('0x78')](_0x47ca85['interaction']['formData']))},client9002)[_0xfdc8('0x22')](function(){return _0x47ca85;});}return _0x47ca85;}return null;})[_0xfdc8('0x22')](respondWithResult(_0x3d1849,null))[_0xfdc8('0x2d')](handleError(_0x3d1849,null));};var interaction_log=require(_0xfdc8('0x16'))(_0xfdc8('0x5a'));exports[_0xfdc8('0x37')]=function(_0x3b8bcc,_0x152d35,_0x3e629b){var _0x9950aa={'agent':{},'channel':_0xfdc8('0x79')};if(_0x3b8bcc[_0xfdc8('0x57')]['id']){delete _0x3b8bcc[_0xfdc8('0x57')]['id'];}_0x3b8bcc['body'][_0xfdc8('0x5e')]=_0x3b8bcc[_0xfdc8('0x57')][_0xfdc8('0x5e')]||_0x3b8bcc[_0xfdc8('0x5f')]['id'];_0x9950aa[_0xfdc8('0x60')]['id']=_0x3b8bcc[_0xfdc8('0x57')][_0xfdc8('0x5e')];return db[_0xfdc8('0x40')][_0xfdc8('0x58')]({'where':{'id':_0x3b8bcc[_0xfdc8('0x56')]['id'],'UserId':null}})[_0xfdc8('0x22')](handleEntityNotFound(_0x152d35,null))[_0xfdc8('0x22')](function(_0x2040e9){if(_0x2040e9){_0x9950aa[_0xfdc8('0x2b')]=_0x2040e9[_0xfdc8('0x61')]({'plain':!![]});return db[_0xfdc8('0x62')][_0xfdc8('0x58')]({'where':{'id':_0x2040e9[_0xfdc8('0x63')]}});}return null;})[_0xfdc8('0x22')](handleEntityNotFound(_0x152d35,null))[_0xfdc8('0x22')](function(_0x573b49){if(_0x573b49){_0x9950aa[_0xfdc8('0x65')]=_0x573b49['get']({'plain':!![]});interaction_log['info'](_0xfdc8('0x7a'),_0x3b8bcc[_0xfdc8('0x5f')]['id'],_0x3b8bcc[_0xfdc8('0x5f')][_0xfdc8('0x3c')],_0x3b8bcc['user'][_0xfdc8('0x67')],_0x9950aa[_0xfdc8('0x65')]['id'],_0x3b8bcc[_0xfdc8('0x57')]?JSON[_0xfdc8('0x28')](_0x3b8bcc[_0xfdc8('0x57')]):'null');return respondWithRpcPromise(_0xfdc8('0x7b'),_0xfdc8('0x7c'),_0x9950aa);}return null;})[_0xfdc8('0x22')](function(_0x7f591d){var _0x356061=_0xfdc8('0x6a')+_0x7f591d[_0xfdc8('0x2b')]['ContactId'];return db['sequelize'][_0xfdc8('0x45')](_0x356061,{'type':db[_0xfdc8('0x7d')][_0xfdc8('0x6d')][_0xfdc8('0x7e')],'raw':!![]})[_0xfdc8('0x22')](function(_0x1ab147){return _0x1ab147;});})[_0xfdc8('0x22')](function(_0x42a549){if(_0x42a549){_0x9950aa['message']['contact']=_0x42a549[0x0];if(!_0x3b8bcc[_0xfdc8('0x57')]['UserId'])return;return db[_0xfdc8('0x7f')][_0xfdc8('0x58')]({'where':{'id':_0x3b8bcc[_0xfdc8('0x57')]['UserId'],'role':_0xfdc8('0x60')},'attributes':['id',_0xfdc8('0x3c'),'fullname','email',_0xfdc8('0x80')],'raw':!![]});}return null;})[_0xfdc8('0x22')](function(_0xce55f9){if(!_0xce55f9)return null;_0x9950aa['message'][_0xfdc8('0x60')]=_0xce55f9;return _0x9950aa;})[_0xfdc8('0x22')](function(_0x32f647){if(_0x32f647){_0x32f647[_0xfdc8('0x2b')]['interface']=util[_0xfdc8('0x71')](_0xfdc8('0x72'),_0x3b8bcc[_0xfdc8('0x5f')][_0xfdc8('0x3c')]);_0x32f647[_0xfdc8('0x2b')][_0xfdc8('0x73')]=_0x9950aa[_0xfdc8('0x73')];_0x32f647[_0xfdc8('0x2b')][_0xfdc8('0x81')]=_0x9950aa['channel'];_0x32f647[_0xfdc8('0x2b')]['event']=_0xfdc8('0x37');respondWithRpcPromise(_0xfdc8('0x76'),'EventManager',{'event':_0xfdc8('0x82'),'message':_[_0xfdc8('0x51')](_0x9950aa[_0xfdc8('0x2b')],JSON['parse'](_0x9950aa[_0xfdc8('0x65')]['formData']))},client9002);return _0x9950aa;}return null;})[_0xfdc8('0x22')](respondWithResult(_0x152d35,null))[_0xfdc8('0x2d')](handleError(_0x152d35,null));}; \ No newline at end of file +var _0x87a1=['socket.io-emitter','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','include','ChatMessage','findAll','rows','catch','params','includeAll','create','body','find','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','reject','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','contact','User','email','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x87a1,0x171));var _0x187a=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x87a1[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x187a('0x0'));var rimraf=require(_0x187a('0x1'));var zipdir=require(_0x187a('0x2'));var jsonpatch=require(_0x187a('0x3'));var rp=require('request-promise');var moment=require(_0x187a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x187a('0x5'));var util=require(_0x187a('0x6'));var path=require(_0x187a('0x7'));var sox=require('sox');var csv=require(_0x187a('0x8'));var ejs=require(_0x187a('0x9'));var fs=require('fs');var fs_extra=require(_0x187a('0xa'));var _=require('lodash');var squel=require(_0x187a('0xb'));var crypto=require(_0x187a('0xc'));var jsforce=require(_0x187a('0xd'));var deskjs=require(_0x187a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x187a('0xf'));var Redis=require(_0x187a('0x10'));var authService=require(_0x187a('0x11'));var qs=require(_0x187a('0x12'));var as=require(_0x187a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x187a('0x14'))(_0x187a('0x15'));var utils=require(_0x187a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x187a('0x17'))['db'];config['redis']=_[_0x187a('0x18')](config[_0x187a('0x19')],{'host':_0x187a('0x1a'),'port':0x18eb});var socket=require(_0x187a('0x1b'))(new Redis(config['redis']));require(_0x187a('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x187a('0x1d')][_0x187a('0x1e')]({'port':0x232c});var client9002=jayson[_0x187a('0x1d')][_0x187a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x341789,_0x4a97f8,_0x3d86ee,_0x19375c){return new BPromise(function(_0x607e30,_0x233e1a){var _0x11d5b2=_0x19375c||client;return _0x11d5b2[_0x187a('0x1f')](_0x341789,_0x3d86ee)[_0x187a('0x20')](function(_0xc8c737){logger[_0x187a('0x21')](_0x187a('0x22'),_0x4a97f8,_0x187a('0x23'));logger['debug'](_0x187a('0x24'),_0x4a97f8,_0x187a('0x23'),JSON[_0x187a('0x25')](_0xc8c737));if(_0xc8c737[_0x187a('0x26')]){if(_0xc8c737['error'][_0x187a('0x27')]===0x1f4){logger[_0x187a('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4a97f8,_0xc8c737['error']['message']);return _0x233e1a(_0xc8c737[_0x187a('0x26')][_0x187a('0x28')]);}logger[_0x187a('0x26')](_0x187a('0x22'),_0x4a97f8,_0xc8c737['error']['message']);return _0x607e30(_0xc8c737['error'][_0x187a('0x28')]);}else{logger[_0x187a('0x21')](_0x187a('0x22'),_0x4a97f8,_0x187a('0x23'));_0x607e30(_0xc8c737[_0x187a('0x29')][_0x187a('0x28')]);}})['catch'](function(_0x43c702){logger[_0x187a('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4a97f8,_0x43c702);_0x233e1a(_0x43c702);});});}function respondWithStatusCode(_0x18efd0,_0x5d7478){_0x5d7478=_0x5d7478||0xcc;return function(_0x1aa7e7){if(_0x1aa7e7){return _0x18efd0[_0x187a('0x2a')](_0x5d7478);}return _0x18efd0[_0x187a('0x2b')](_0x5d7478)[_0x187a('0x2c')]();};}function respondWithResult(_0x2a484f,_0x4bd8f5){_0x4bd8f5=_0x4bd8f5||0xc8;return function(_0x50c81c){if(_0x50c81c){return _0x2a484f[_0x187a('0x2b')](_0x4bd8f5)[_0x187a('0x2d')](_0x50c81c);}};}function respondWithFilteredResult(_0x4c9a27,_0x4782ee){return function(_0x8cccbd){if(_0x8cccbd){var _0xefd9e3=typeof _0x4782ee[_0x187a('0x2e')]===_0x187a('0x2f')&&typeof _0x4782ee[_0x187a('0x30')]===_0x187a('0x2f');var _0x2e44fe=_0x8cccbd[_0x187a('0x31')];var _0x290aa8=_0xefd9e3?0x0:_0x4782ee['offset'];var _0x25d086=_0xefd9e3?_0x8cccbd[_0x187a('0x31')]:_0x4782ee[_0x187a('0x2e')]+_0x4782ee[_0x187a('0x30')];var _0xe85a1c;if(_0x25d086>=_0x2e44fe){_0x25d086=_0x2e44fe;_0xe85a1c=0xc8;}else{_0xe85a1c=0xce;}_0x4c9a27['status'](_0xe85a1c);return _0x4c9a27[_0x187a('0x32')]('Content-Range',_0x290aa8+'-'+_0x25d086+'/'+_0x2e44fe)[_0x187a('0x2d')](_0x8cccbd);}return null;};}function patchUpdates(_0x54ae45){return function(_0x109d4d){try{jsonpatch[_0x187a('0x33')](_0x109d4d,_0x54ae45,!![]);}catch(_0x5d0b44){return BPromise['reject'](_0x5d0b44);}return _0x109d4d['save']();};}function saveUpdates(_0x1c9782,_0x40e9b8){return function(_0x4e2c1f){if(_0x4e2c1f){return _0x4e2c1f[_0x187a('0x34')](_0x1c9782)[_0x187a('0x20')](function(_0xce89fc){return _0xce89fc;});}return null;};}function removeEntity(_0xefe1c4,_0x519b14){return function(_0x4ac0b0){if(_0x4ac0b0){return _0x4ac0b0[_0x187a('0x35')]()['then'](function(){_0xefe1c4[_0x187a('0x2b')](0xcc)[_0x187a('0x2c')]();});}};}function handleEntityNotFound(_0x7ec120,_0x161d80){return function(_0x2d00be){if(!_0x2d00be){_0x7ec120['sendStatus'](0x194);}return _0x2d00be;};}function handleError(_0x4ff562,_0x4af8bc){_0x4af8bc=_0x4af8bc||0x1f4;return function(_0x55c3d5){logger[_0x187a('0x26')](_0x55c3d5[_0x187a('0x36')]);if(_0x55c3d5[_0x187a('0x37')]){delete _0x55c3d5[_0x187a('0x37')];}_0x4ff562[_0x187a('0x2b')](_0x4af8bc)[_0x187a('0x38')](_0x55c3d5);};}exports[_0x187a('0x39')]=function(_0x3d07b1,_0x1d0696){var _0x5c6488={},_0x48515f={},_0x1025cf={'count':0x0,'rows':[]};var _0x419804=_[_0x187a('0x3a')](db['ChatMessage'][_0x187a('0x3b')],function(_0x1153f7){return{'name':_0x1153f7['fieldName'],'type':_0x1153f7[_0x187a('0x3c')]['key']};});_0x48515f[_0x187a('0x3d')]=_[_0x187a('0x3a')](_0x419804,_0x187a('0x37'));_0x48515f[_0x187a('0x3e')]=_[_0x187a('0x3f')](_0x3d07b1['query']);_0x48515f[_0x187a('0x40')]=_[_0x187a('0x41')](_0x48515f[_0x187a('0x3d')],_0x48515f[_0x187a('0x3e')]);_0x5c6488[_0x187a('0x42')]=_[_0x187a('0x41')](_0x48515f[_0x187a('0x3d')],qs[_0x187a('0x43')](_0x3d07b1[_0x187a('0x3e')][_0x187a('0x43')]));_0x5c6488['attributes']=_0x5c6488[_0x187a('0x42')][_0x187a('0x44')]?_0x5c6488[_0x187a('0x42')]:_0x48515f['model'];if(!_0x3d07b1[_0x187a('0x3e')][_0x187a('0x45')](_0x187a('0x46'))){_0x5c6488[_0x187a('0x30')]=qs['limit'](_0x3d07b1[_0x187a('0x3e')][_0x187a('0x30')]);_0x5c6488[_0x187a('0x2e')]=qs[_0x187a('0x2e')](_0x3d07b1[_0x187a('0x3e')][_0x187a('0x2e')]);}_0x5c6488['order']=qs['sort'](_0x3d07b1[_0x187a('0x3e')]['sort']);_0x5c6488[_0x187a('0x47')]=qs[_0x187a('0x40')](_[_0x187a('0x48')](_0x3d07b1[_0x187a('0x3e')],_0x48515f[_0x187a('0x40')]),_0x419804);if(_0x3d07b1[_0x187a('0x3e')][_0x187a('0x49')]){_0x5c6488['where']=_[_0x187a('0x4a')](_0x5c6488['where'],{'$or':_[_0x187a('0x3a')](_0x419804,function(_0xe1b4d8){if(_0xe1b4d8[_0x187a('0x3c')]!==_0x187a('0x4b')){var _0x252c27={};_0x252c27[_0xe1b4d8[_0x187a('0x37')]]={'$like':'%'+_0x3d07b1['query']['filter']+'%'};return _0x252c27;}})});}_0x5c6488=_['merge']({},_0x5c6488,_0x3d07b1[_0x187a('0x4c')]);var _0x18d0fd={'where':_0x5c6488['where']};return db['ChatMessage'][_0x187a('0x31')](_0x18d0fd)['then'](function(_0x3cc906){_0x1025cf[_0x187a('0x31')]=_0x3cc906;if(_0x3d07b1[_0x187a('0x3e')]['includeAll']){_0x5c6488[_0x187a('0x4d')]=[{'all':!![]}];}return db[_0x187a('0x4e')][_0x187a('0x4f')](_0x5c6488);})[_0x187a('0x20')](function(_0x5951a4){_0x1025cf[_0x187a('0x50')]=_0x5951a4;return _0x1025cf;})[_0x187a('0x20')](respondWithFilteredResult(_0x1d0696,_0x5c6488))[_0x187a('0x51')](handleError(_0x1d0696,null));};exports['show']=function(_0x4cc514,_0x50965f){var _0x56b528={'raw':!![],'where':{'id':_0x4cc514[_0x187a('0x52')]['id']}},_0x51db35={};_0x51db35[_0x187a('0x3d')]=_['keys'](db[_0x187a('0x4e')]['rawAttributes']);_0x51db35[_0x187a('0x3e')]=_['keys'](_0x4cc514[_0x187a('0x3e')]);_0x51db35[_0x187a('0x40')]=_[_0x187a('0x41')](_0x51db35[_0x187a('0x3d')],_0x51db35[_0x187a('0x3e')]);_0x56b528[_0x187a('0x42')]=_['intersection'](_0x51db35['model'],qs[_0x187a('0x43')](_0x4cc514[_0x187a('0x3e')][_0x187a('0x43')]));_0x56b528[_0x187a('0x42')]=_0x56b528['attributes']['length']?_0x56b528[_0x187a('0x42')]:_0x51db35[_0x187a('0x3d')];if(_0x4cc514[_0x187a('0x3e')][_0x187a('0x53')]){_0x56b528[_0x187a('0x4d')]=[{'all':!![]}];}_0x56b528=_[_0x187a('0x4a')]({},_0x56b528,_0x4cc514[_0x187a('0x4c')]);return db[_0x187a('0x4e')]['find'](_0x56b528)[_0x187a('0x20')](handleEntityNotFound(_0x50965f,null))[_0x187a('0x20')](respondWithResult(_0x50965f,null))[_0x187a('0x51')](handleError(_0x50965f,null));};exports[_0x187a('0x54')]=function(_0x447995,_0x37f91b){return db[_0x187a('0x4e')][_0x187a('0x54')](_0x447995[_0x187a('0x55')],{})['then'](respondWithResult(_0x37f91b,0xc9))['catch'](handleError(_0x37f91b,null));};exports[_0x187a('0x34')]=function(_0x33fb1a,_0x4d5309){if(_0x33fb1a['body']['id']){delete _0x33fb1a[_0x187a('0x55')]['id'];}return db[_0x187a('0x4e')][_0x187a('0x56')]({'where':{'id':_0x33fb1a[_0x187a('0x52')]['id']}})[_0x187a('0x20')](handleEntityNotFound(_0x4d5309,null))[_0x187a('0x20')](saveUpdates(_0x33fb1a['body'],null))[_0x187a('0x20')](respondWithResult(_0x4d5309,null))[_0x187a('0x51')](handleError(_0x4d5309,null));};exports[_0x187a('0x35')]=function(_0x21c50c,_0x2cb01a){return db[_0x187a('0x4e')][_0x187a('0x56')]({'where':{'id':_0x21c50c['params']['id']}})[_0x187a('0x20')](handleEntityNotFound(_0x2cb01a,null))[_0x187a('0x20')](removeEntity(_0x2cb01a,null))[_0x187a('0x51')](handleError(_0x2cb01a,null));};exports['describe']=function(_0x45cfb2,_0x3091bc){return db[_0x187a('0x4e')]['describe']()[_0x187a('0x20')](respondWithResult(_0x3091bc,null))['catch'](handleError(_0x3091bc,null));};var interaction_log=require(_0x187a('0x14'))('chat-interactions');exports['accept']=function(_0x7f94f,_0x7fd651,_0x1903a9){var _0x2847cf={'agent':{},'channel':_0x187a('0x57')};if(_0x7f94f[_0x187a('0x55')]['id']){delete _0x7f94f[_0x187a('0x55')]['id'];}_0x7f94f[_0x187a('0x55')][_0x187a('0x58')]=!![];_0x7f94f['body'][_0x187a('0x59')]=moment()[_0x187a('0x5a')](_0x187a('0x5b'));_0x7f94f['body'][_0x187a('0x5c')]=_0x7f94f[_0x187a('0x55')][_0x187a('0x5c')]||_0x7f94f[_0x187a('0x5d')]['id'];_0x2847cf[_0x187a('0x5e')]['id']=_0x7f94f[_0x187a('0x55')][_0x187a('0x5c')];return db[_0x187a('0x4e')][_0x187a('0x56')]({'where':{'id':_0x7f94f[_0x187a('0x52')]['id'],'UserId':null}})[_0x187a('0x20')](handleEntityNotFound(_0x7fd651,null))[_0x187a('0x20')](saveUpdates(_0x7f94f[_0x187a('0x55')],null))[_0x187a('0x20')](function(_0x492990){if(_0x492990){_0x2847cf[_0x187a('0x28')]=_0x492990['get']({'plain':!![]});return db[_0x187a('0x5f')][_0x187a('0x56')]({'where':{'id':_0x492990[_0x187a('0x60')]}});}return null;})[_0x187a('0x20')](handleEntityNotFound(_0x7fd651,null))['then'](function(_0x6565a6){if(_0x6565a6){return _0x6565a6[_0x187a('0x34')]({'UserId':_0x7f94f[_0x187a('0x55')][_0x187a('0x5c')],'read1stAt':_[_0x187a('0x61')](_0x6565a6['read1stAt'])?moment()['format'](_0x187a('0x5b')):undefined});}return null;})[_0x187a('0x20')](function(_0x3655e8){if(_0x3655e8){_0x2847cf[_0x187a('0x62')]=_0x3655e8['get']({'plain':!![]});interaction_log[_0x187a('0x21')](_0x187a('0x63'),_0x7f94f['user']['id'],_0x7f94f[_0x187a('0x5d')][_0x187a('0x37')],_0x7f94f[_0x187a('0x5d')][_0x187a('0x64')],_0x2847cf[_0x187a('0x62')]['id'],_0x7f94f[_0x187a('0x55')]?JSON[_0x187a('0x25')](_0x7f94f[_0x187a('0x55')]):'null');return respondWithRpcPromise(_0x187a('0x65'),'acceptMessage',_0x2847cf);}return null;})[_0x187a('0x20')](function(_0x5a5e33){var _0x74b843=_0x187a('0x66')+_0x5a5e33[_0x187a('0x28')][_0x187a('0x67')];return db[_0x187a('0x68')][_0x187a('0x3e')](_0x74b843,{'type':db[_0x187a('0x69')][_0x187a('0x6a')][_0x187a('0x6b')],'raw':!![]})[_0x187a('0x20')](function(_0x1a61d8){return _0x1a61d8;});})[_0x187a('0x20')](function(_0xd5347a){if(_0xd5347a){_0x2847cf['message']['contact']=_0xd5347a[0x0];if(!_0x7f94f[_0x187a('0x55')][_0x187a('0x5c')])return;return db['User']['find']({'where':{'id':_0x7f94f[_0x187a('0x55')][_0x187a('0x5c')],'role':'agent'},'attributes':['id','name',_0x187a('0x6c'),'email','internal'],'raw':!![]});}return null;})[_0x187a('0x20')](function(_0x210ccd){if(!_0x210ccd)return null;_0x2847cf['message'][_0x187a('0x5e')]=_0x210ccd;return _0x2847cf;})['then'](function(_0x59d4ed){if(_0x59d4ed){if(_0x7f94f[_0x187a('0x55')][_0x187a('0x6d')]){_0x2847cf['message'][_0x187a('0x6e')]=util['format'](_0x187a('0x6f'),_0x7f94f[_0x187a('0x5d')][_0x187a('0x37')]);_0x2847cf[_0x187a('0x28')][_0x187a('0x70')]=_0x2847cf[_0x187a('0x70')];_0x2847cf[_0x187a('0x28')][_0x187a('0x71')]=_0x2847cf[_0x187a('0x70')];_0x2847cf[_0x187a('0x28')][_0x187a('0x72')]=_0x187a('0x73');return respondWithRpcPromise(_0x187a('0x74'),'EventManager',{'event':_0x187a('0x75'),'message':_[_0x187a('0x4a')](_0x2847cf[_0x187a('0x28')],JSON[_0x187a('0x76')](_0x2847cf[_0x187a('0x62')][_0x187a('0x77')]))},client9002)[_0x187a('0x20')](function(){return _0x2847cf;});}return _0x2847cf;}return null;})[_0x187a('0x20')](respondWithResult(_0x7fd651,null))[_0x187a('0x51')](handleError(_0x7fd651,null));};var interaction_log=require(_0x187a('0x14'))(_0x187a('0x78'));exports[_0x187a('0x79')]=function(_0x22ffcc,_0x291ed1,_0x4c3b59){var _0x5ea98e={'agent':{},'channel':'chat'};if(_0x22ffcc['body']['id']){delete _0x22ffcc[_0x187a('0x55')]['id'];}_0x22ffcc[_0x187a('0x55')][_0x187a('0x5c')]=_0x22ffcc[_0x187a('0x55')][_0x187a('0x5c')]||_0x22ffcc['user']['id'];_0x5ea98e['agent']['id']=_0x22ffcc[_0x187a('0x55')]['UserId'];return db[_0x187a('0x4e')]['find']({'where':{'id':_0x22ffcc[_0x187a('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x291ed1,null))[_0x187a('0x20')](function(_0x3400bb){if(_0x3400bb){_0x5ea98e[_0x187a('0x28')]=_0x3400bb[_0x187a('0x7a')]({'plain':!![]});return db['ChatInteraction'][_0x187a('0x56')]({'where':{'id':_0x3400bb[_0x187a('0x60')]}});}return null;})[_0x187a('0x20')](handleEntityNotFound(_0x291ed1,null))['then'](function(_0x3478db){if(_0x3478db){_0x5ea98e['interaction']=_0x3478db[_0x187a('0x7a')]({'plain':!![]});interaction_log[_0x187a('0x21')](_0x187a('0x7b'),_0x22ffcc[_0x187a('0x5d')]['id'],_0x22ffcc[_0x187a('0x5d')][_0x187a('0x37')],_0x22ffcc[_0x187a('0x5d')]['role'],_0x5ea98e['interaction']['id'],_0x22ffcc[_0x187a('0x55')]?JSON[_0x187a('0x25')](_0x22ffcc[_0x187a('0x55')]):_0x187a('0x7c'));return respondWithRpcPromise(_0x187a('0x7d'),_0x187a('0x7e'),_0x5ea98e);}return null;})[_0x187a('0x20')](function(_0x5de6fa){var _0x50708a=_0x187a('0x66')+_0x5de6fa['message']['ContactId'];return db[_0x187a('0x68')][_0x187a('0x3e')](_0x50708a,{'type':db['Sequelize'][_0x187a('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x520ed6){return _0x520ed6;});})[_0x187a('0x20')](function(_0x7fa8f8){if(_0x7fa8f8){_0x5ea98e[_0x187a('0x28')][_0x187a('0x7f')]=_0x7fa8f8[0x0];if(!_0x22ffcc[_0x187a('0x55')][_0x187a('0x5c')])return;return db[_0x187a('0x80')][_0x187a('0x56')]({'where':{'id':_0x22ffcc[_0x187a('0x55')][_0x187a('0x5c')],'role':_0x187a('0x5e')},'attributes':['id',_0x187a('0x37'),'fullname',_0x187a('0x81'),_0x187a('0x82')],'raw':!![]});}return null;})[_0x187a('0x20')](function(_0x496661){if(!_0x496661)return null;_0x5ea98e[_0x187a('0x28')][_0x187a('0x5e')]=_0x496661;return _0x5ea98e;})[_0x187a('0x20')](function(_0x4473cc){if(_0x4473cc){_0x4473cc['message'][_0x187a('0x6e')]=util[_0x187a('0x5a')](_0x187a('0x6f'),_0x22ffcc[_0x187a('0x5d')]['name']);_0x4473cc['message'][_0x187a('0x70')]=_0x5ea98e[_0x187a('0x70')];_0x4473cc[_0x187a('0x28')][_0x187a('0x71')]=_0x5ea98e[_0x187a('0x70')];_0x4473cc['message']['event']=_0x187a('0x79');respondWithRpcPromise(_0x187a('0x74'),_0x187a('0x74'),{'event':_0x187a('0x83'),'message':_['merge'](_0x5ea98e[_0x187a('0x28')],JSON[_0x187a('0x76')](_0x5ea98e['interaction'][_0x187a('0x77')]))},client9002);return _0x5ea98e;}return null;})[_0x187a('0x20')](respondWithResult(_0x291ed1,null))[_0x187a('0x51')](handleError(_0x291ed1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e3d0034..336076a 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 _0xd014=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd014,0x8e));var _0x4d01=function(_0x51e633,_0xcd23bd){_0x51e633=_0x51e633-0x0;var _0x1ba3d7=_0xd014[_0x51e633];return _0x1ba3d7;};'use strict';var EventEmitter=require(_0x4d01('0x0'));var ChatMessage=require(_0x4d01('0x1'))['db'][_0x4d01('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4d01('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d01('0x4'),'afterDestroy':_0x4d01('0x5')};function emitEvent(_0x12f718){return function(_0x19af0a,_0x15002b,_0x465453){ChatMessageEvents['emit'](_0x12f718+':'+_0x19af0a['id'],_0x19af0a);ChatMessageEvents[_0x4d01('0x6')](_0x12f718,_0x19af0a);_0x465453(null);};}for(var e in events){if(events[_0x4d01('0x7')](e)){var event=events[e];ChatMessage[_0x4d01('0x8')](e,emitEvent(event));}}module[_0x4d01('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xbd4e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x398bb2,_0x5cfc1b){var _0x3136b9=function(_0x849673){while(--_0x849673){_0x398bb2['push'](_0x398bb2['shift']());}};_0x3136b9(++_0x5cfc1b);}(_0xbd4e,0x19f));var _0xebd4=function(_0x80290,_0x86a349){_0x80290=_0x80290-0x0;var _0x261633=_0xbd4e[_0x80290];return _0x261633;};'use strict';var EventEmitter=require(_0xebd4('0x0'));var ChatMessage=require(_0xebd4('0x1'))['db'][_0xebd4('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xebd4('0x3')](0x0);var events={'afterCreate':_0xebd4('0x4'),'afterUpdate':_0xebd4('0x5'),'afterDestroy':_0xebd4('0x6')};function emitEvent(_0xdf1f10){return function(_0x351bdb,_0x5825bc,_0x1381e4){ChatMessageEvents[_0xebd4('0x7')](_0xdf1f10+':'+_0x351bdb['id'],_0x351bdb);ChatMessageEvents[_0xebd4('0x7')](_0xdf1f10,_0x351bdb);_0x1381e4(null);};}for(var e in events){if(events[_0xebd4('0x8')](e)){var event=events[e];ChatMessage[_0xebd4('0x9')](e,emitEvent(event));}}module[_0xebd4('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 554b7cf..87a1700 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 _0x17c6=['findOne','ChatInteractionId','then','update','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','secret','isNil','ChatInteraction'];(function(_0x8ab285,_0x525553){var _0x1d0339=function(_0x10216b){while(--_0x10216b){_0x8ab285['push'](_0x8ab285['shift']());}};_0x1d0339(++_0x525553);}(_0x17c6,0x19b));var _0x617c=function(_0x2fb0e8,_0x5ea66a){_0x2fb0e8=_0x2fb0e8-0x0;var _0x5d3a9b=_0x17c6[_0x2fb0e8];return _0x5d3a9b;};'use strict';var _=require(_0x617c('0x0'));var util=require(_0x617c('0x1'));var logger=require('../../config/logger')(_0x617c('0x2'));var moment=require(_0x617c('0x3'));var BPromise=require(_0x617c('0x4'));var rp=require(_0x617c('0x5'));var fs=require('fs');var path=require(_0x617c('0x6'));var rimraf=require(_0x617c('0x7'));var config=require(_0x617c('0x8'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x38500e,_0x1f6738){return _0x38500e[_0x617c('0x9')](_0x617c('0xa'),attributes,{'tableName':_0x617c('0xb'),'paranoid':![],'indexes':[{'name':_0x617c('0xc'),'fields':[_0x617c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b7ed2,_0x12f884,_0x539504){var _0x2fa606=_0x38500e['models'];var _0x55e0c2=_0x5b7ed2[_0x617c('0xe')]({'plain':!![]});if(_0x55e0c2[_0x617c('0xf')]['toLowerCase']()==='in'||_0x55e0c2['direction'][_0x617c('0x10')]()===_0x617c('0x11')&&!_0x55e0c2[_0x617c('0x12')]&&!_[_0x617c('0x13')](_0x55e0c2['UserId'])){_0x2fa606[_0x617c('0x14')][_0x617c('0x15')]({'where':{'id':_0x55e0c2[_0x617c('0x16')]}})[_0x617c('0x17')](function(_0x4bd04d){if(_0x4bd04d){_0x4bd04d[_0x617c('0x18')]({'lastMsgAt':_0x55e0c2['createdAt'],'lastMsgDirection':_0x55e0c2[_0x617c('0xf')]['toLowerCase']()});}})['catch'](function(_0x34b39f){console[_0x617c('0x19')](_0x34b39f);});}_0x539504();}},'charset':'utf8mb4','collate':_0x617c('0x1a')});}; \ No newline at end of file +var _0xf8ae=['UserId','ChatInteraction','findOne','ChatInteractionId','then','update','error','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','body','FULLTEXT','models','get','direction','toLowerCase','secret'];(function(_0x4c2f11,_0x860e5){var _0x2b5a3c=function(_0x3d77de){while(--_0x3d77de){_0x4c2f11['push'](_0x4c2f11['shift']());}};_0x2b5a3c(++_0x860e5);}(_0xf8ae,0x1c9));var _0xef8a=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xf8ae[_0x1d87fc];return _0x492b56;};'use strict';var _=require('lodash');var util=require(_0xef8a('0x0'));var logger=require('../../config/logger')(_0xef8a('0x1'));var moment=require(_0xef8a('0x2'));var BPromise=require('bluebird');var rp=require(_0xef8a('0x3'));var fs=require('fs');var path=require(_0xef8a('0x4'));var rimraf=require(_0xef8a('0x5'));var config=require(_0xef8a('0x6'));var attributes=require(_0xef8a('0x7'));module[_0xef8a('0x8')]=function(_0x2a3496,_0x42ca8e){return _0x2a3496[_0xef8a('0x9')](_0xef8a('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xef8a('0xb')],'type':_0xef8a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x236876,_0x1120d4,_0x14df2f){var _0x46ddbd=_0x2a3496[_0xef8a('0xd')];var _0x25dfef=_0x236876[_0xef8a('0xe')]({'plain':!![]});if(_0x25dfef[_0xef8a('0xf')]['toLowerCase']()==='in'||_0x25dfef[_0xef8a('0xf')][_0xef8a('0x10')]()==='out'&&!_0x25dfef[_0xef8a('0x11')]&&!_['isNil'](_0x25dfef[_0xef8a('0x12')])){_0x46ddbd[_0xef8a('0x13')][_0xef8a('0x14')]({'where':{'id':_0x25dfef[_0xef8a('0x15')]}})[_0xef8a('0x16')](function(_0x3291d1){if(_0x3291d1){_0x3291d1[_0xef8a('0x17')]({'lastMsgAt':_0x25dfef['createdAt'],'lastMsgDirection':_0x25dfef[_0xef8a('0xf')]['toLowerCase']()});}})['catch'](function(_0x576201){console[_0xef8a('0x18')](_0x576201);});}_0x14df2f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 354d0a6..c3bb06f 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 _0xba56=['ChatMessage','body','options','CreateChatMessage','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x46fa5e,_0x3973d7){var _0x2a9360=function(_0x5673eb){while(--_0x5673eb){_0x46fa5e['push'](_0x46fa5e['shift']());}};_0x2a9360(++_0x3973d7);}(_0xba56,0x1d6));var _0x6ba5=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xba56[_0x2e78e9];return _0x35aad4;};'use strict';var _=require(_0x6ba5('0x0'));var util=require(_0x6ba5('0x1'));var moment=require('moment');var BPromise=require(_0x6ba5('0x2'));var rs=require(_0x6ba5('0x3'));var fs=require('fs');var Redis=require(_0x6ba5('0x4'));var db=require(_0x6ba5('0x5'))['db'];var utils=require(_0x6ba5('0x6'));var logger=require(_0x6ba5('0x7'))('rpc');var config=require(_0x6ba5('0x8'));var jayson=require(_0x6ba5('0x9'));var client=jayson['client'][_0x6ba5('0xa')]({'port':0x232a});config[_0x6ba5('0xb')]=_['defaults'](config['redis'],{'host':_0x6ba5('0xc'),'port':0x18eb});var socket=require(_0x6ba5('0xd'))(new Redis(config[_0x6ba5('0xb')]));require(_0x6ba5('0xe'))[_0x6ba5('0xf')](socket);function respondWithRpcPromise(_0x4aa1ba,_0x3a93d3,_0x5ef441){return new BPromise(function(_0x38bb2c,_0x59d47a){return client['request'](_0x4aa1ba,_0x5ef441)[_0x6ba5('0x10')](function(_0x1ac19a){logger[_0x6ba5('0x11')](_0x6ba5('0x12'),_0x3a93d3,'request\x20sent');logger[_0x6ba5('0x13')](_0x6ba5('0x14'),_0x3a93d3,_0x6ba5('0x15'),JSON['stringify'](_0x1ac19a));if(_0x1ac19a[_0x6ba5('0x16')]){if(_0x1ac19a['error']['code']===0x1f4){logger[_0x6ba5('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3a93d3,_0x1ac19a['error'][_0x6ba5('0x17')]);return _0x59d47a(_0x1ac19a[_0x6ba5('0x16')]['message']);}logger[_0x6ba5('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3a93d3,_0x1ac19a['error'][_0x6ba5('0x17')]);return _0x38bb2c(_0x1ac19a[_0x6ba5('0x16')][_0x6ba5('0x17')]);}else{logger[_0x6ba5('0x11')](_0x6ba5('0x12'),_0x3a93d3,_0x6ba5('0x15'));_0x38bb2c(_0x1ac19a[_0x6ba5('0x18')][_0x6ba5('0x17')]);}})[_0x6ba5('0x19')](function(_0x1d1dc3){logger[_0x6ba5('0x16')](_0x6ba5('0x12'),_0x3a93d3,_0x1d1dc3);_0x59d47a(_0x1d1dc3);});});}exports['CreateChatMessage']=function(_0xe8bee9){var _0x443883=this;return new Promise(function(_0x487ae1,_0x316d13){return db[_0x6ba5('0x1a')]['create'](_0xe8bee9[_0x6ba5('0x1b')],{'raw':_0xe8bee9[_0x6ba5('0x1c')]?_0xe8bee9[_0x6ba5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x6ba5('0x10')](function(_0x5b1cff){logger[_0x6ba5('0x11')](_0x6ba5('0x1d'),_0xe8bee9);logger['debug'](_0x6ba5('0x1d'),_0xe8bee9,JSON[_0x6ba5('0x1e')](_0x5b1cff));_0x487ae1(_0x5b1cff);})[_0x6ba5('0x19')](function(_0x1c12bc){logger[_0x6ba5('0x16')](_0x6ba5('0x1d'),_0x1c12bc[_0x6ba5('0x17')],_0xe8bee9);_0x316d13(_0x443883[_0x6ba5('0x16')](0x1f4,_0x1c12bc['message']));});});}; \ No newline at end of file +var _0x21dc=['ChatMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x21dc,0x170));var _0xc21d=function(_0x3bb470,_0x1b8532){_0x3bb470=_0x3bb470-0x0;var _0x1adf1c=_0x21dc[_0x3bb470];return _0x1adf1c;};'use strict';var _=require(_0xc21d('0x0'));var util=require(_0xc21d('0x1'));var moment=require(_0xc21d('0x2'));var BPromise=require(_0xc21d('0x3'));var rs=require(_0xc21d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc21d('0x5'))['db'];var utils=require(_0xc21d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc21d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc21d('0x8')]({'port':0x232a});config[_0xc21d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc21d('0xa'))(new Redis(config[_0xc21d('0x9')]));require(_0xc21d('0xb'))[_0xc21d('0xc')](socket);function respondWithRpcPromise(_0x593b58,_0x1d9c11,_0x2c63f7){return new BPromise(function(_0x13bdb2,_0x3dfbdb){return client[_0xc21d('0xd')](_0x593b58,_0x2c63f7)[_0xc21d('0xe')](function(_0x35db72){logger[_0xc21d('0xf')]('ChatMessage,\x20%s,\x20%s',_0x1d9c11,_0xc21d('0x10'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1d9c11,_0xc21d('0x10'),JSON['stringify'](_0x35db72));if(_0x35db72[_0xc21d('0x11')]){if(_0x35db72['error'][_0xc21d('0x12')]===0x1f4){logger[_0xc21d('0x11')](_0xc21d('0x13'),_0x1d9c11,_0x35db72['error']['message']);return _0x3dfbdb(_0x35db72[_0xc21d('0x11')][_0xc21d('0x14')]);}logger[_0xc21d('0x11')](_0xc21d('0x13'),_0x1d9c11,_0x35db72[_0xc21d('0x11')][_0xc21d('0x14')]);return _0x13bdb2(_0x35db72['error'][_0xc21d('0x14')]);}else{logger[_0xc21d('0xf')](_0xc21d('0x13'),_0x1d9c11,_0xc21d('0x10'));_0x13bdb2(_0x35db72[_0xc21d('0x15')][_0xc21d('0x14')]);}})[_0xc21d('0x16')](function(_0x56309b){logger[_0xc21d('0x11')](_0xc21d('0x13'),_0x1d9c11,_0x56309b);_0x3dfbdb(_0x56309b);});});}exports[_0xc21d('0x17')]=function(_0x8f3630){var _0x538fc0=this;return new Promise(function(_0x1699b1,_0x2654ad){return db[_0xc21d('0x18')][_0xc21d('0x19')](_0x8f3630['body'],{'raw':_0x8f3630[_0xc21d('0x1a')]?_0x8f3630[_0xc21d('0x1a')][_0xc21d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2688d4){logger['info'](_0xc21d('0x17'),_0x8f3630);logger['debug'](_0xc21d('0x17'),_0x8f3630,JSON['stringify'](_0x2688d4));_0x1699b1(_0x2688d4);})[_0xc21d('0x16')](function(_0x3c9daa){logger[_0xc21d('0x11')](_0xc21d('0x17'),_0x3c9daa['message'],_0x8f3630);_0x2654ad(_0x538fc0[_0xc21d('0x11')](0x1f4,_0x3c9daa[_0xc21d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 51e2bb1..bd01fe2 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 _0xc492=['./chatMessage.events','save','remove','register','chatMessage:'];(function(_0x568954,_0x6b38b5){var _0x3d423b=function(_0x562908){while(--_0x562908){_0x568954['push'](_0x568954['shift']());}};_0x3d423b(++_0x6b38b5);}(_0xc492,0xd7));var _0x2c49=function(_0x54ab29,_0x4367fc){_0x54ab29=_0x54ab29-0x0;var _0x2149db=_0xc492[_0x54ab29];return _0x2149db;};'use strict';var ChatMessageEvents=require(_0x2c49('0x0'));var events=[_0x2c49('0x1'),_0x2c49('0x2'),'update'];function createListener(_0x57cde2,_0x37eda4){return function(_0x5bab73){_0x37eda4['emit'](_0x57cde2,_0x5bab73);};}function removeListener(_0x555cba,_0x1de940){return function(){ChatMessageEvents['removeListener'](_0x555cba,_0x1de940);};}exports[_0x2c49('0x3')]=function(_0x499c4e){for(var _0x3ad911=0x0,_0x9c10f7=events['length'];_0x3ad911<_0x9c10f7;_0x3ad911++){var _0xe7b4cb=events[_0x3ad911];var _0x17f596=createListener(_0x2c49('0x4')+_0xe7b4cb,_0x499c4e);ChatMessageEvents['on'](_0xe7b4cb,_0x17f596);}}; \ No newline at end of file +var _0x943c=['./chatMessage.events','save','remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0x28a1f6,_0x1d3905){var _0x1cd028=function(_0x4b0afb){while(--_0x4b0afb){_0x28a1f6['push'](_0x28a1f6['shift']());}};_0x1cd028(++_0x1d3905);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require(_0xc943('0x0'));var events=[_0xc943('0x1'),_0xc943('0x2'),_0xc943('0x3')];function createListener(_0x55a907,_0x5067dc){return function(_0x32ff2c){_0x5067dc[_0xc943('0x4')](_0x55a907,_0x32ff2c);};}function removeListener(_0xa24827,_0x5b7d1d){return function(){ChatMessageEvents[_0xc943('0x5')](_0xa24827,_0x5b7d1d);};}exports[_0xc943('0x6')]=function(_0x3307ef){for(var _0xaff37f=0x0,_0x1b73ad=events[_0xc943('0x7')];_0xaff37f<_0x1b73ad;_0xaff37f++){var _0x3f718f=events[_0xaff37f];var _0x56e665=createListener(_0xc943('0x8')+_0x3f718f,_0x3307ef);ChatMessageEvents['on'](_0x3f718f,_0x56e665);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 591f50e..45cedbf 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 _0x65ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','path','connect-timeout','express'];(function(_0x33af65,_0x399b35){var _0x361c8f=function(_0x39faf0){while(--_0x39faf0){_0x33af65['push'](_0x33af65['shift']());}};_0x361c8f(++_0x399b35);}(_0x65ba,0xcc));var _0xa65b=function(_0x501e67,_0x2e6643){_0x501e67=_0x501e67-0x0;var _0x16b255=_0x65ba[_0x501e67];return _0x16b255;};'use strict';var multer=require(_0xa65b('0x0'));var util=require('util');var path=require(_0xa65b('0x1'));var timeout=require(_0xa65b('0x2'));var express=require(_0xa65b('0x3'));var router=express[_0xa65b('0x4')]();var fs_extra=require(_0xa65b('0x5'));var auth=require(_0xa65b('0x6'));var interaction=require(_0xa65b('0x7'));var config=require('../../config/environment');var controller=require(_0xa65b('0x8'));router['get']('/',auth[_0xa65b('0x9')](),controller['index']);router[_0xa65b('0xa')](_0xa65b('0xb'),auth[_0xa65b('0x9')](),controller[_0xa65b('0xc')]);router[_0xa65b('0xa')](_0xa65b('0xd'),auth[_0xa65b('0x9')](),controller[_0xa65b('0xe')]);router[_0xa65b('0xf')]('/',auth[_0xa65b('0x9')](),interaction[_0xa65b('0x10')](_0xa65b('0x11'),'chatmessage:create'),controller[_0xa65b('0x12')]);router[_0xa65b('0x13')]('/:id',controller[_0xa65b('0x14')]);router[_0xa65b('0x13')](_0xa65b('0x15'),auth[_0xa65b('0x9')](),controller[_0xa65b('0x16')]);router[_0xa65b('0x13')](_0xa65b('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xa65b('0x18')](_0xa65b('0xd'),auth[_0xa65b('0x9')](),controller['destroy']);module[_0xa65b('0x19')]=router; \ No newline at end of file +var _0xedec=['isAuthenticated','index','get','/describe','describe','post','chatmessage:create','create','put','update','/:id/accept','accept','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49f2d2,_0x2460c8){var _0x2deea6=function(_0x3f5865){while(--_0x3f5865){_0x49f2d2['push'](_0x49f2d2['shift']());}};_0x2deea6(++_0x2460c8);}(_0xedec,0x19b));var _0xcede=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xedec[_0x2d344f];return _0x2e796b;};'use strict';var multer=require(_0xcede('0x0'));var util=require(_0xcede('0x1'));var path=require(_0xcede('0x2'));var timeout=require(_0xcede('0x3'));var express=require('express');var router=express[_0xcede('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcede('0x5'));var interaction=require(_0xcede('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0xcede('0x7')](),controller[_0xcede('0x8')]);router[_0xcede('0x9')](_0xcede('0xa'),auth[_0xcede('0x7')](),controller[_0xcede('0xb')]);router[_0xcede('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcede('0xc')]('/',auth[_0xcede('0x7')](),interaction['tracked']('chat',_0xcede('0xd')),controller[_0xcede('0xe')]);router[_0xcede('0xf')]('/:id',controller[_0xcede('0x10')]);router['put'](_0xcede('0x11'),auth[_0xcede('0x7')](),controller[_0xcede('0x12')]);router['put']('/:id/reject',auth[_0xcede('0x7')](),controller['reject']);router[_0xcede('0x13')](_0xcede('0x14'),auth[_0xcede('0x7')](),controller[_0xcede('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f9006b1..8dee04c 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0xabbf8,_0x29430f){var _0x24b8d1=function(_0x1f1e7a){while(--_0x1f1e7a){_0xabbf8['push'](_0xabbf8['shift']());}};_0x24b8d1(++_0x29430f);}(_0xdb28,0x106));var _0x8db2=function(_0x5304b2,_0x46b9e6){_0x5304b2=_0x5304b2-0x0;var _0x2d1c8a=_0xdb28[_0x5304b2];return _0x2d1c8a;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x48ebe4,_0x53cbe2){var _0x48a385=function(_0x11078f){while(--_0x11078f){_0x48ebe4['push'](_0x48ebe4['shift']());}};_0x48a385(++_0x53cbe2);}(_0xadb5,0xad));var _0x5adb=function(_0x1425b8,_0x4f0392){_0x1425b8=_0x1425b8-0x0;var _0x2333ac=_0xadb5[_0x1425b8];return _0x2333ac;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2c7e3c3..63b3d25 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(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x7a54,0x106));var _0x47a5=function(_0x1205d3,_0xb80fa2){_0x1205d3=_0x1205d3-0x0;var _0x41b289=_0x7a54[_0x1205d3];return _0x41b289;};'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(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x7a54,0x106));var _0x47a5=function(_0x14defa,_0x1482f6){_0x14defa=_0x14defa-0x0;var _0x2ee3a3=_0x7a54[_0x14defa];return _0x2ee3a3;};'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 cfca391..c89f1b8 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 _0x0f4b=['events','ChatOfflineMessage','setMaxListeners','emit','hook','exports'];(function(_0x5dfed8,_0x2574db){var _0x37d3d1=function(_0x38c154){while(--_0x38c154){_0x5dfed8['push'](_0x5dfed8['shift']());}};_0x37d3d1(++_0x2574db);}(_0x0f4b,0x168));var _0xb0f4=function(_0x39abbe,_0x5d1559){_0x39abbe=_0x39abbe-0x0;var _0xb69a8f=_0x0f4b[_0x39abbe];return _0xb69a8f;};'use strict';var EventEmitter=require(_0xb0f4('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xb0f4('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb0f4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10de1e){return function(_0x5ec747,_0xfeda40,_0x4e29dd){ChatOfflineMessageEvents[_0xb0f4('0x3')](_0x10de1e+':'+_0x5ec747['id'],_0x5ec747);ChatOfflineMessageEvents[_0xb0f4('0x3')](_0x10de1e,_0x5ec747);_0x4e29dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xb0f4('0x4')](e,emitEvent(event));}}module[_0xb0f4('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7a8a=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a8a,0x173));var _0xa7a8=function(_0x2683ae,_0x1f2af7){_0x2683ae=_0x2683ae-0x0;var _0x23daa3=_0x7a8a[_0x2683ae];return _0x23daa3;};'use strict';var EventEmitter=require(_0xa7a8('0x0'));var ChatOfflineMessage=require(_0xa7a8('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa7a8('0x2')](0x0);var events={'afterCreate':_0xa7a8('0x3'),'afterUpdate':'update','afterDestroy':_0xa7a8('0x4')};function emitEvent(_0x4b4485){return function(_0x205017,_0x450531,_0x236a3f){ChatOfflineMessageEvents[_0xa7a8('0x5')](_0x4b4485+':'+_0x205017['id'],_0x205017);ChatOfflineMessageEvents[_0xa7a8('0x5')](_0x4b4485,_0x205017);_0x236a3f(null);};}for(var e in events){if(events[_0xa7a8('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xa7a8('0x7')](e,emitEvent(event));}}module[_0xa7a8('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index cf6bc5c..3ad590a 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 _0x5683=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5683,0x1b3));var _0x3568=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5683[_0x138adb];return _0x1b27f2;};'use strict';var attributes=require(_0x3568('0x0'));module[_0x3568('0x1')]=function(_0x5dce18){return _0x5dce18[_0x3568('0x2')](_0x3568('0x3'),attributes,{'tableName':_0x3568('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3568('0x5'),'collate':_0x3568('0x6')});}; \ No newline at end of file +var _0x4ade=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x2cac78,_0x299304){var _0x4edc2e=function(_0x5b3f4c){while(--_0x5b3f4c){_0x2cac78['push'](_0x2cac78['shift']());}};_0x4edc2e(++_0x299304);}(_0x4ade,0x174));var _0xe4ad=function(_0x19aeaf,_0xe42128){_0x19aeaf=_0x19aeaf-0x0;var _0x4e3f7c=_0x4ade[_0x19aeaf];return _0x4e3f7c;};'use strict';var attributes=require(_0xe4ad('0x0'));module[_0xe4ad('0x1')]=function(_0xd87060){return _0xd87060[_0xe4ad('0x2')](_0xe4ad('0x3'),attributes,{'tableName':_0xe4ad('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4ad('0x5'),'collate':_0xe4ad('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 678ac38..6b3a815 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 _0x08f6=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x357116,_0x54b693){var _0x3f01e8=function(_0x3e711c){while(--_0x3e711c){_0x357116['push'](_0x357116['shift']());}};_0x3f01e8(++_0x54b693);}(_0x08f6,0x110));var _0x608f=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0x08f6[_0x328b1c];return _0x4dbeaa;};'use strict';var _=require(_0x608f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x608f('0x1'));var fs=require('fs');var Redis=require(_0x608f('0x2'));var db=require(_0x608f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x608f('0x4'))('rpc');var config=require(_0x608f('0x5'));var jayson=require(_0x608f('0x6'));var client=jayson[_0x608f('0x7')][_0x608f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5619bc,_0xc0faf3,_0x5141ef){return new BPromise(function(_0x186ce5,_0x21dd21){return client[_0x608f('0x9')](_0x5619bc,_0x5141ef)[_0x608f('0xa')](function(_0x18dc25){logger[_0x608f('0xb')](_0x608f('0xc'),_0xc0faf3,'request\x20sent');logger[_0x608f('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0xc0faf3,_0x608f('0xe'),JSON['stringify'](_0x18dc25));if(_0x18dc25['error']){if(_0x18dc25[_0x608f('0xf')][_0x608f('0x10')]===0x1f4){logger[_0x608f('0xf')](_0x608f('0xc'),_0xc0faf3,_0x18dc25['error'][_0x608f('0x11')]);return _0x21dd21(_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);}logger[_0x608f('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0xc0faf3,_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);return _0x186ce5(_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);}else{logger['info'](_0x608f('0xc'),_0xc0faf3,'request\x20sent');_0x186ce5(_0x18dc25[_0x608f('0x12')][_0x608f('0x11')]);}})[_0x608f('0x13')](function(_0x454ee4){logger[_0x608f('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0xc0faf3,_0x454ee4);_0x21dd21(_0x454ee4);});});} \ No newline at end of file +var _0x7527=['request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x2bacd0,_0x4a300a){var _0x4e0fc5=function(_0x1797d8){while(--_0x1797d8){_0x2bacd0['push'](_0x2bacd0['shift']());}};_0x4e0fc5(++_0x4a300a);}(_0x7527,0x1a9));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7752('0x0'));var moment=require(_0x7752('0x1'));var BPromise=require(_0x7752('0x2'));var rs=require(_0x7752('0x3'));var fs=require('fs');var Redis=require(_0x7752('0x4'));var db=require(_0x7752('0x5'))['db'];var utils=require(_0x7752('0x6'));var logger=require(_0x7752('0x7'))(_0x7752('0x8'));var config=require(_0x7752('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7752('0xa')][_0x7752('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4af8e8,_0xdec6ea,_0x2426fb){return new BPromise(function(_0x107776,_0xf9dab2){return client[_0x7752('0xc')](_0x4af8e8,_0x2426fb)['then'](function(_0x31eec7){logger[_0x7752('0xd')](_0x7752('0xe'),_0xdec6ea,_0x7752('0xf'));logger[_0x7752('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0xdec6ea,_0x7752('0xf'),JSON[_0x7752('0x11')](_0x31eec7));if(_0x31eec7[_0x7752('0x12')]){if(_0x31eec7['error']['code']===0x1f4){logger[_0x7752('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0xdec6ea,_0x31eec7[_0x7752('0x12')][_0x7752('0x13')]);return _0xf9dab2(_0x31eec7[_0x7752('0x12')][_0x7752('0x13')]);}logger[_0x7752('0x12')](_0x7752('0xe'),_0xdec6ea,_0x31eec7[_0x7752('0x12')][_0x7752('0x13')]);return _0x107776(_0x31eec7[_0x7752('0x12')][_0x7752('0x13')]);}else{logger[_0x7752('0xd')](_0x7752('0xe'),_0xdec6ea,_0x7752('0xf'));_0x107776(_0x31eec7[_0x7752('0x14')][_0x7752('0x13')]);}})[_0x7752('0x15')](function(_0x383c3a){logger[_0x7752('0x12')](_0x7752('0xe'),_0xdec6ea,_0x383c3a);_0xf9dab2(_0x383c3a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c04a38c..b56f656 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 _0xbc77=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','/describe','isAuthenticated','get','/:id','post','create','put','update','delete'];(function(_0x53468a,_0x286986){var _0x205efd=function(_0x5eb1e9){while(--_0x5eb1e9){_0x53468a['push'](_0x53468a['shift']());}};_0x205efd(++_0x286986);}(_0xbc77,0x87));var _0x7bc7=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xbc77[_0x1a595a];return _0x33f008;};'use strict';var multer=require(_0x7bc7('0x0'));var util=require(_0x7bc7('0x1'));var path=require(_0x7bc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bc7('0x3'));var router=express[_0x7bc7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7bc7('0x5'));var interaction=require(_0x7bc7('0x6'));var config=require('../../config/environment');var controller=require(_0x7bc7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7bc7('0x8'),auth[_0x7bc7('0x9')](),controller['describe']);router[_0x7bc7('0xa')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller['show']);router[_0x7bc7('0xc')]('/',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xd')]);router[_0x7bc7('0xe')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xf')]);router[_0x7bc7('0x10')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x11')]);module[_0x7bc7('0x12')]=router; \ No newline at end of file +var _0xf829=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf829,0x94));var _0x9f82=function(_0x2efd1d,_0x44f696){_0x2efd1d=_0x2efd1d-0x0;var _0x1ef3f6=_0xf829[_0x2efd1d];return _0x1ef3f6;};'use strict';var multer=require(_0x9f82('0x0'));var util=require(_0x9f82('0x1'));var path=require(_0x9f82('0x2'));var timeout=require(_0x9f82('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f82('0x4'));var interaction=require(_0x9f82('0x5'));var config=require('../../config/environment');var controller=require(_0x9f82('0x6'));router[_0x9f82('0x7')]('/',auth[_0x9f82('0x8')](),controller['index']);router['get'](_0x9f82('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x9f82('0x7')](_0x9f82('0xa'),auth[_0x9f82('0x8')](),controller['show']);router['post']('/',auth[_0x9f82('0x8')](),controller['create']);router['put'](_0x9f82('0xa'),auth[_0x9f82('0x8')](),controller[_0x9f82('0xb')]);router[_0x9f82('0xc')](_0x9f82('0xa'),auth[_0x9f82('0x8')](),controller[_0x9f82('0xd')]);module[_0x9f82('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index bb05ecc..e008329 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 _0x7f69=['INTEGER','sequelize','STRING','ENUM','mouseOver'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x7f69,0x1f0));var _0x97f6=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7f69[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require(_0x97f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x97f6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x97f6('0x2')]('mouseOver','timeout'),'defaultValue':_0x97f6('0x3')},'selector':{'type':Sequelize[_0x97f6('0x1')]},'timeout':{'type':Sequelize[_0x97f6('0x4')]}}; \ No newline at end of file +var _0xbee3=['STRING','mouseOver','timeout','INTEGER','exports'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xbee3,0x68));var _0x3bee=function(_0x241cf4,_0x3c2f10){_0x241cf4=_0x241cf4-0x0;var _0x1a8b6d=_0xbee3[_0x241cf4];return _0x1a8b6d;};'use strict';var Sequelize=require('sequelize');module[_0x3bee('0x0')]={'name':{'type':Sequelize[_0x3bee('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3bee('0x2'),_0x3bee('0x3')),'defaultValue':_0x3bee('0x2')},'selector':{'type':Sequelize[_0x3bee('0x1')]},'timeout':{'type':Sequelize[_0x3bee('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d927cd9..e89f7e7 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 _0x8c52=['intersection','attributes','model','fields','length','merge','ChatProactiveAction','catch','body','update','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','stack','name','send','show','params','keys','rawAttributes','query'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x8c52,0x7e));var _0x28c5=function(_0x42f2a7,_0x5917c6){_0x42f2a7=_0x42f2a7-0x0;var _0x999180=_0x8c52[_0x42f2a7];return _0x999180;};'use strict';var emlformat=require(_0x28c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28c5('0x1'));var jsonpatch=require(_0x28c5('0x2'));var rp=require(_0x28c5('0x3'));var moment=require(_0x28c5('0x4'));var BPromise=require(_0x28c5('0x5'));var Mustache=require(_0x28c5('0x6'));var util=require(_0x28c5('0x7'));var path=require(_0x28c5('0x8'));var sox=require(_0x28c5('0x9'));var csv=require(_0x28c5('0xa'));var ejs=require(_0x28c5('0xb'));var fs=require('fs');var fs_extra=require(_0x28c5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x28c5('0xd'));var toCsv=require(_0x28c5('0xa'));var querystring=require(_0x28c5('0xe'));var Papa=require('papaparse');var Redis=require(_0x28c5('0xf'));var authService=require(_0x28c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x28c5('0x11'));var hardwareService=require(_0x28c5('0x12'));var logger=require(_0x28c5('0x13'))(_0x28c5('0x14'));var utils=require(_0x28c5('0x15'));var config=require(_0x28c5('0x16'));var licenseUtil=require(_0x28c5('0x17'));var db=require(_0x28c5('0x18'))['db'];function respondWithStatusCode(_0x7873ef,_0x477fe1){_0x477fe1=_0x477fe1||0xcc;return function(_0x55f5af){if(_0x55f5af){return _0x7873ef[_0x28c5('0x19')](_0x477fe1);}return _0x7873ef[_0x28c5('0x1a')](_0x477fe1)[_0x28c5('0x1b')]();};}function respondWithResult(_0x9b5a83,_0x57cfde){_0x57cfde=_0x57cfde||0xc8;return function(_0x4520ea){if(_0x4520ea){return _0x9b5a83[_0x28c5('0x1a')](_0x57cfde)[_0x28c5('0x1c')](_0x4520ea);}};}function respondWithFilteredResult(_0x20f186,_0x477f2e){return function(_0x33cd69){if(_0x33cd69){var _0x199b0e=typeof _0x477f2e[_0x28c5('0x1d')]==='undefined'&&typeof _0x477f2e[_0x28c5('0x1e')]===_0x28c5('0x1f');var _0x19fc7f=_0x33cd69[_0x28c5('0x20')];var _0x47195d=_0x199b0e?0x0:_0x477f2e['offset'];var _0x5d6edd=_0x199b0e?_0x33cd69[_0x28c5('0x20')]:_0x477f2e[_0x28c5('0x1d')]+_0x477f2e['limit'];var _0x12b55e;if(_0x5d6edd>=_0x19fc7f){_0x5d6edd=_0x19fc7f;_0x12b55e=0xc8;}else{_0x12b55e=0xce;}_0x20f186[_0x28c5('0x1a')](_0x12b55e);return _0x20f186['set']('Content-Range',_0x47195d+'-'+_0x5d6edd+'/'+_0x19fc7f)['json'](_0x33cd69);}return null;};}function patchUpdates(_0x170667){return function(_0x21ffab){try{jsonpatch[_0x28c5('0x21')](_0x21ffab,_0x170667,!![]);}catch(_0x345e4a){return BPromise[_0x28c5('0x22')](_0x345e4a);}return _0x21ffab[_0x28c5('0x23')]();};}function saveUpdates(_0x162060,_0xd74d86){return function(_0x37a3fe){if(_0x37a3fe){return _0x37a3fe['update'](_0x162060)[_0x28c5('0x24')](function(_0x33464f){return _0x33464f;});}return null;};}function removeEntity(_0x3b1f32,_0x43ecd0){return function(_0x91d866){if(_0x91d866){return _0x91d866['destroy']()['then'](function(){_0x3b1f32['status'](0xcc)[_0x28c5('0x1b')]();});}};}function handleEntityNotFound(_0x320a79,_0x253625){return function(_0x3486e7){if(!_0x3486e7){_0x320a79[_0x28c5('0x19')](0x194);}return _0x3486e7;};}function handleError(_0x23cfaf,_0x477cc2){_0x477cc2=_0x477cc2||0x1f4;return function(_0x2e0cd8){logger['error'](_0x2e0cd8[_0x28c5('0x25')]);if(_0x2e0cd8[_0x28c5('0x26')]){delete _0x2e0cd8[_0x28c5('0x26')];}_0x23cfaf['status'](_0x477cc2)[_0x28c5('0x27')](_0x2e0cd8);};}exports[_0x28c5('0x28')]=function(_0x489e2a,_0x4784c3){var _0x1aa359={'raw':!![],'where':{'id':_0x489e2a[_0x28c5('0x29')]['id']}},_0x87e4d4={};_0x87e4d4['model']=_[_0x28c5('0x2a')](db['ChatProactiveAction'][_0x28c5('0x2b')]);_0x87e4d4[_0x28c5('0x2c')]=_[_0x28c5('0x2a')](_0x489e2a[_0x28c5('0x2c')]);_0x87e4d4['filters']=_[_0x28c5('0x2d')](_0x87e4d4['model'],_0x87e4d4[_0x28c5('0x2c')]);_0x1aa359[_0x28c5('0x2e')]=_[_0x28c5('0x2d')](_0x87e4d4[_0x28c5('0x2f')],qs['fields'](_0x489e2a[_0x28c5('0x2c')][_0x28c5('0x30')]));_0x1aa359['attributes']=_0x1aa359[_0x28c5('0x2e')][_0x28c5('0x31')]?_0x1aa359[_0x28c5('0x2e')]:_0x87e4d4['model'];if(_0x489e2a[_0x28c5('0x2c')]['includeAll']){_0x1aa359['include']=[{'all':!![]}];}_0x1aa359=_[_0x28c5('0x32')]({},_0x1aa359,_0x489e2a['options']);return db[_0x28c5('0x33')]['find'](_0x1aa359)['then'](handleEntityNotFound(_0x4784c3,null))['then'](respondWithResult(_0x4784c3,null))[_0x28c5('0x34')](handleError(_0x4784c3,null));};exports['create']=function(_0x2c4387,_0x1d7fdc){return db[_0x28c5('0x33')]['create'](_0x2c4387[_0x28c5('0x35')],{})[_0x28c5('0x24')](respondWithResult(_0x1d7fdc,0xc9))[_0x28c5('0x34')](handleError(_0x1d7fdc,null));};exports[_0x28c5('0x36')]=function(_0x51842c,_0x4765b1){if(_0x51842c[_0x28c5('0x35')]['id']){delete _0x51842c[_0x28c5('0x35')]['id'];}return db[_0x28c5('0x33')]['find']({'where':{'id':_0x51842c[_0x28c5('0x29')]['id']}})[_0x28c5('0x24')](handleEntityNotFound(_0x4765b1,null))[_0x28c5('0x24')](saveUpdates(_0x51842c[_0x28c5('0x35')],null))['then'](respondWithResult(_0x4765b1,null))['catch'](handleError(_0x4765b1,null));};exports[_0x28c5('0x37')]=function(_0xda45c1,_0x1a26c2){return db[_0x28c5('0x33')][_0x28c5('0x38')]({'where':{'id':_0xda45c1[_0x28c5('0x29')]['id']}})['then'](handleEntityNotFound(_0x1a26c2,null))[_0x28c5('0x24')](removeEntity(_0x1a26c2,null))['catch'](handleError(_0x1a26c2,null));}; \ No newline at end of file +var _0x3eea=['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','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2a14f6,_0x324591){_0x2a14f6=_0x2a14f6-0x0;var _0x11118c=_0x3eea[_0x2a14f6];return _0x11118c;};'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={'raw':!![],'where':{'id':_0x59c6f9['params']['id']}},_0x78e581={};_0x78e581[_0xa3ee('0x2a')]=_[_0xa3ee('0x2b')](db[_0xa3ee('0x2c')][_0xa3ee('0x2d')]);_0x78e581[_0xa3ee('0x2e')]=_[_0xa3ee('0x2b')](_0x59c6f9[_0xa3ee('0x2e')]);_0x78e581[_0xa3ee('0x2f')]=_[_0xa3ee('0x30')](_0x78e581[_0xa3ee('0x2a')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x31')]=_['intersection'](_0x78e581[_0xa3ee('0x2a')],qs[_0xa3ee('0x32')](_0x59c6f9['query'][_0xa3ee('0x32')]));_0x4abf49['attributes']=_0x4abf49[_0xa3ee('0x31')]['length']?_0x4abf49[_0xa3ee('0x31')]:_0x78e581[_0xa3ee('0x2a')];if(_0x59c6f9[_0xa3ee('0x2e')][_0xa3ee('0x33')]){_0x4abf49[_0xa3ee('0x34')]=[{'all':!![]}];}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x35')]);return db[_0xa3ee('0x2c')][_0xa3ee('0x36')](_0x4abf49)['then'](handleEntityNotFound(_0x5ba571,null))[_0xa3ee('0x23')](respondWithResult(_0x5ba571,null))['catch'](handleError(_0x5ba571,null));};exports[_0xa3ee('0x37')]=function(_0x49a1ee,_0x44bc25){return db['ChatProactiveAction'][_0xa3ee('0x37')](_0x49a1ee[_0xa3ee('0x38')],{})[_0xa3ee('0x23')](respondWithResult(_0x44bc25,0xc9))[_0xa3ee('0x39')](handleError(_0x44bc25,null));};exports[_0xa3ee('0x22')]=function(_0x1193b1,_0xcc8e71){if(_0x1193b1[_0xa3ee('0x38')]['id']){delete _0x1193b1[_0xa3ee('0x38')]['id'];}return db[_0xa3ee('0x2c')][_0xa3ee('0x36')]({'where':{'id':_0x1193b1[_0xa3ee('0x3a')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0xcc8e71,null))['then'](saveUpdates(_0x1193b1[_0xa3ee('0x38')],null))[_0xa3ee('0x23')](respondWithResult(_0xcc8e71,null))[_0xa3ee('0x39')](handleError(_0xcc8e71,null));};exports[_0xa3ee('0x24')]=function(_0x5a782f,_0x257627){return db[_0xa3ee('0x2c')][_0xa3ee('0x36')]({'where':{'id':_0x5a782f['params']['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x257627,null))[_0xa3ee('0x23')](removeEntity(_0x257627,null))['catch'](handleError(_0x257627,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 579418e..58f8730 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 _0xf08b=['define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x582ac8,_0x10bdef){var _0x5d8ec2=function(_0x69c05a){while(--_0x69c05a){_0x582ac8['push'](_0x582ac8['shift']());}};_0x5d8ec2(++_0x10bdef);}(_0xf08b,0x183));var _0xbf08=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf08b[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xbf08('0x0'));var logger=require(_0xbf08('0x1'))(_0xbf08('0x2'));var moment=require(_0xbf08('0x3'));var BPromise=require(_0xbf08('0x4'));var rp=require(_0xbf08('0x5'));var fs=require('fs');var path=require(_0xbf08('0x6'));var rimraf=require(_0xbf08('0x7'));var config=require(_0xbf08('0x8'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x4a99f9,_0x1936e7){return _0x4a99f9[_0xbf08('0x9')](_0xbf08('0xa'),attributes,{'tableName':_0xbf08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x776c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x56e8c1,_0x4315d9){var _0x17e2fb=function(_0x190276){while(--_0x190276){_0x56e8c1['push'](_0x56e8c1['shift']());}};_0x17e2fb(++_0x4315d9);}(_0x776c,0x68));var _0xc776=function(_0x4adbd3,_0x3eb9f3){_0x4adbd3=_0x4adbd3-0x0;var _0x52ddc9=_0x776c[_0x4adbd3];return _0x52ddc9;};'use strict';var _=require(_0xc776('0x0'));var util=require(_0xc776('0x1'));var logger=require(_0xc776('0x2'))(_0xc776('0x3'));var moment=require(_0xc776('0x4'));var BPromise=require(_0xc776('0x5'));var rp=require(_0xc776('0x6'));var fs=require('fs');var path=require(_0xc776('0x7'));var rimraf=require(_0xc776('0x8'));var config=require(_0xc776('0x9'));var attributes=require(_0xc776('0xa'));module[_0xc776('0xb')]=function(_0x5183e2,_0x1751ee){return _0x5183e2['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8cafe48..6a8deb0 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 _0x2cbe=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0xa0ba6a,_0x4094dd){var _0x4450ed=function(_0x54ff8c){while(--_0x54ff8c){_0xa0ba6a['push'](_0xa0ba6a['shift']());}};_0x4450ed(++_0x4094dd);}(_0x2cbe,0x135));var _0xe2cb=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x2cbe[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0xe2cb('0x0'));var util=require(_0xe2cb('0x1'));var moment=require(_0xe2cb('0x2'));var BPromise=require(_0xe2cb('0x3'));var rs=require(_0xe2cb('0x4'));var fs=require('fs');var Redis=require(_0xe2cb('0x5'));var db=require(_0xe2cb('0x6'))['db'];var utils=require(_0xe2cb('0x7'));var logger=require(_0xe2cb('0x8'))(_0xe2cb('0x9'));var config=require(_0xe2cb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe2cb('0xb')][_0xe2cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x79968f,_0x265cf1,_0x3d55e6){return new BPromise(function(_0x3f3b44,_0x207ccd){return client[_0xe2cb('0xd')](_0x79968f,_0x3d55e6)[_0xe2cb('0xe')](function(_0x4ae2ea){logger[_0xe2cb('0xf')](_0xe2cb('0x10'),_0x265cf1,_0xe2cb('0x11'));logger[_0xe2cb('0x12')](_0xe2cb('0x13'),_0x265cf1,_0xe2cb('0x11'),JSON[_0xe2cb('0x14')](_0x4ae2ea));if(_0x4ae2ea[_0xe2cb('0x15')]){if(_0x4ae2ea['error']['code']===0x1f4){logger[_0xe2cb('0x15')](_0xe2cb('0x10'),_0x265cf1,_0x4ae2ea[_0xe2cb('0x15')][_0xe2cb('0x16')]);return _0x207ccd(_0x4ae2ea[_0xe2cb('0x15')]['message']);}logger[_0xe2cb('0x15')](_0xe2cb('0x10'),_0x265cf1,_0x4ae2ea[_0xe2cb('0x15')][_0xe2cb('0x16')]);return _0x3f3b44(_0x4ae2ea[_0xe2cb('0x15')][_0xe2cb('0x16')]);}else{logger['info'](_0xe2cb('0x10'),_0x265cf1,_0xe2cb('0x11'));_0x3f3b44(_0x4ae2ea[_0xe2cb('0x17')][_0xe2cb('0x16')]);}})[_0xe2cb('0x18')](function(_0x152e13){logger['error'](_0xe2cb('0x10'),_0x265cf1,_0x152e13);_0x207ccd(_0x152e13);});});} \ No newline at end of file +var _0x8377=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x149872,_0x24d88f){var _0x1143df=function(_0x226ba6){while(--_0x226ba6){_0x149872['push'](_0x149872['shift']());}};_0x1143df(++_0x24d88f);}(_0x8377,0x1aa));var _0x7837=function(_0x25096c,_0x4b39ad){_0x25096c=_0x25096c-0x0;var _0x20319d=_0x8377[_0x25096c];return _0x20319d;};'use strict';var _=require(_0x7837('0x0'));var util=require(_0x7837('0x1'));var moment=require(_0x7837('0x2'));var BPromise=require(_0x7837('0x3'));var rs=require(_0x7837('0x4'));var fs=require('fs');var Redis=require(_0x7837('0x5'));var db=require(_0x7837('0x6'))['db'];var utils=require(_0x7837('0x7'));var logger=require(_0x7837('0x8'))(_0x7837('0x9'));var config=require(_0x7837('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7837('0xb')][_0x7837('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xec2b51,_0x2f5eee,_0x1269ae){return new BPromise(function(_0x4cf4ca,_0xb4b133){return client[_0x7837('0xd')](_0xec2b51,_0x1269ae)['then'](function(_0x142974){logger[_0x7837('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,'request\x20sent');logger[_0x7837('0xf')](_0x7837('0x10'),_0x2f5eee,_0x7837('0x11'),JSON[_0x7837('0x12')](_0x142974));if(_0x142974[_0x7837('0x13')]){if(_0x142974['error']['code']===0x1f4){logger[_0x7837('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x142974[_0x7837('0x13')][_0x7837('0x14')]);return _0xb4b133(_0x142974['error'][_0x7837('0x14')]);}logger[_0x7837('0x13')](_0x7837('0x15'),_0x2f5eee,_0x142974[_0x7837('0x13')][_0x7837('0x14')]);return _0x4cf4ca(_0x142974[_0x7837('0x13')][_0x7837('0x14')]);}else{logger[_0x7837('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x7837('0x11'));_0x4cf4ca(_0x142974[_0x7837('0x16')][_0x7837('0x14')]);}})[_0x7837('0x17')](function(_0x4e8ff3){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x4e8ff3);_0xb4b133(_0x4e8ff3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 38bca00..d86f5f3 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x446acf,_0x24b0bf){_0x446acf=_0x446acf-0x0;var _0xb41227=_0x8d0e[_0x446acf];return _0xb41227;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 07ae72d..9bd6c05 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 _0x29a9=['sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x383552,_0x5db2de){var _0x338ff7=function(_0x1b6d90){while(--_0x1b6d90){_0x383552['push'](_0x383552['shift']());}};_0x338ff7(++_0x5db2de);}(_0x29a9,0x130));var _0x929a=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x29a9[_0x52c4e9];return _0x252a03;};'use strict';var Sequelize=require(_0x929a('0x0'));module[_0x929a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x929a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x929a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x929a('0x4')](_0x929a('0x5'),_0x929a('0x6'),_0x929a('0x7'))}}; \ No newline at end of file +var _0xeb40=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x5bcea2,_0x6fe99f){var _0x2f5363=function(_0x26303a){while(--_0x26303a){_0x5bcea2['push'](_0x5bcea2['shift']());}};_0x2f5363(++_0x6fe99f);}(_0xeb40,0x1ab));var _0x0eb4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xeb40[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x0eb4('0x0'));module[_0x0eb4('0x1')]={'name':{'type':Sequelize[_0x0eb4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0eb4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0eb4('0x4'),'beepall',_0x0eb4('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ac88f69..842e2e6 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 _0x8d86=['spread','isArray','userChatQueue:remove','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','fieldName','type','getOptions','include','query','findAll','rows','show','params','model','keys','attributes','intersection','fields','length','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserChatQueue','rawAttributes','hasOwnProperty','order','sort','filters','pick','where','ChatQueueId','filter','merge','User','findAndCountAll','agent','chatPause','createdAt','format','%s/%s','SIP','getTeams','nolimit','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','value','isEmpty','removeAgents','addAgents'];(function(_0x32b380,_0x36a47c){var _0xbec69b=function(_0x17d538){while(--_0x17d538){_0x32b380['push'](_0x32b380['shift']());}};_0xbec69b(++_0x36a47c);}(_0x8d86,0x84));var _0x68d8=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8d86[_0x2ec461];return _0x28603d;};'use strict';var BPromise=require('bluebird');var util=require(_0x68d8('0x0'));var _=require(_0x68d8('0x1'));var squel=require(_0x68d8('0x2'));var Redis=require(_0x68d8('0x3'));var qs=require(_0x68d8('0x4'));var logger=require(_0x68d8('0x5'))(_0x68d8('0x6'));var config=require(_0x68d8('0x7'));var db=require(_0x68d8('0x8'))['db'];config[_0x68d8('0x9')]=_[_0x68d8('0xa')](config[_0x68d8('0x9')],{'host':_0x68d8('0xb'),'port':0x18eb});var socket=require(_0x68d8('0xc'))(new Redis(config[_0x68d8('0x9')]));require(_0x68d8('0xd'))[_0x68d8('0xe')](socket);function respondWithStatusCode(_0x4cd624,_0x3dc1b8){_0x3dc1b8=_0x3dc1b8||0xcc;return function(_0x1653ab){if(_0x1653ab){return _0x4cd624[_0x68d8('0xf')](_0x3dc1b8);}return _0x4cd624[_0x68d8('0x10')](_0x3dc1b8)[_0x68d8('0x11')]();};}function respondWithResult(_0x453078,_0x35b67d){_0x35b67d=_0x35b67d||0xc8;return function(_0x47eb72){if(_0x47eb72){return _0x453078[_0x68d8('0x10')](_0x35b67d)[_0x68d8('0x12')](_0x47eb72);}};}function respondWithFilteredResult(_0x151054,_0x3ec2f1){return function(_0x27d01c){if(_0x27d01c){var _0x39d63b=typeof _0x3ec2f1[_0x68d8('0x13')]==='undefined'&&typeof _0x3ec2f1[_0x68d8('0x14')]===_0x68d8('0x15');var _0x4fa120=_0x27d01c[_0x68d8('0x16')];var _0x439044=_0x39d63b?0x0:_0x3ec2f1[_0x68d8('0x13')];var _0x4857ee=_0x39d63b?_0x27d01c[_0x68d8('0x16')]:_0x3ec2f1[_0x68d8('0x13')]+_0x3ec2f1[_0x68d8('0x14')];var _0x37a17f;if(_0x4857ee>=_0x4fa120){_0x4857ee=_0x4fa120;_0x37a17f=0xc8;}else{_0x37a17f=0xce;}_0x151054[_0x68d8('0x10')](_0x37a17f);return _0x151054['set'](_0x68d8('0x17'),_0x439044+'-'+_0x4857ee+'/'+_0x4fa120)[_0x68d8('0x12')](_0x27d01c);}return null;};}function saveUpdates(_0x171f9f){return function(_0x180385){if(_0x180385){return _0x180385[_0x68d8('0x18')](_0x171f9f)[_0x68d8('0x19')](function(_0x325826){return _0x325826;});}return null;};}function removeEntity(_0x1d385a){return function(_0x1fa28a){if(_0x1fa28a){return _0x1fa28a[_0x68d8('0x1a')]()[_0x68d8('0x19')](function(){var _0x4a3c15=_0x1fa28a['get']({'plain':!![]});var _0x17c891=_0x68d8('0x1b');return db[_0x68d8('0x1c')]['destroy']({'where':{'type':_0x17c891,'resourceId':_0x4a3c15['id']}})['then'](function(){return _0x1fa28a;});})['then'](function(){_0x1d385a[_0x68d8('0x10')](0xcc)[_0x68d8('0x11')]();});}};}function handleEntityNotFound(_0x49af09){return function(_0x550830){if(!_0x550830){_0x49af09[_0x68d8('0xf')](0x194);}return _0x550830;};}function handleError(_0x4fc0f0,_0x340106){_0x340106=_0x340106||0x1f4;return function(_0x81a035){logger['error'](_0x81a035[_0x68d8('0x1d')]);if(_0x81a035['name']){delete _0x81a035[_0x68d8('0x1e')];}_0x4fc0f0[_0x68d8('0x10')](_0x340106)[_0x68d8('0x1f')](_0x81a035);};}exports[_0x68d8('0x20')]=function(_0x31b4cc,_0x29a27a){var _0x145a89={};var _0x39a340={'count':0x0,'rows':[]};var _0x4843e7=_[_0x68d8('0x21')](db[_0x68d8('0x22')]['rawAttributes'],function(_0x28bbe2){return{'name':_0x28bbe2[_0x68d8('0x23')],'type':_0x28bbe2[_0x68d8('0x24')]['key']};});_0x145a89=qs[_0x68d8('0x25')](_0x4843e7,_0x31b4cc);var _0x94e22={'where':_0x145a89['where']};return db['ChatQueue']['count'](_0x94e22)[_0x68d8('0x19')](function(_0x293154){_0x39a340['count']=_0x293154;_0x145a89[_0x68d8('0x26')]=qs[_0x68d8('0x26')](_0x31b4cc[_0x68d8('0x27')]);return db['ChatQueue'][_0x68d8('0x28')](_0x145a89);})[_0x68d8('0x19')](function(_0x4730e5){_0x39a340[_0x68d8('0x29')]=_0x4730e5;return _0x39a340;})['then'](respondWithFilteredResult(_0x29a27a,_0x145a89))['catch'](handleError(_0x29a27a,null));};exports[_0x68d8('0x2a')]=function(_0x28c106,_0x1ea7ad){var _0x3f485f={'raw':!![],'where':{'id':_0x28c106[_0x68d8('0x2b')]['id']}},_0x40d072={};_0x40d072[_0x68d8('0x2c')]=_[_0x68d8('0x2d')](db[_0x68d8('0x22')]['rawAttributes']);_0x40d072[_0x68d8('0x27')]=_['keys'](_0x28c106[_0x68d8('0x27')]);_0x40d072['filters']=_['intersection'](_0x40d072[_0x68d8('0x2c')],_0x40d072[_0x68d8('0x27')]);_0x3f485f[_0x68d8('0x2e')]=_[_0x68d8('0x2f')](_0x40d072[_0x68d8('0x2c')],qs[_0x68d8('0x30')](_0x28c106[_0x68d8('0x27')][_0x68d8('0x30')]));_0x3f485f['attributes']=_0x3f485f[_0x68d8('0x2e')][_0x68d8('0x31')]?_0x3f485f[_0x68d8('0x2e')]:_0x40d072[_0x68d8('0x2c')];if(_0x28c106[_0x68d8('0x27')][_0x68d8('0x32')]){_0x3f485f['include']=[{'all':!![]}];}_0x3f485f=_['merge']({},_0x3f485f,_0x28c106[_0x68d8('0x33')]);return db['ChatQueue'][_0x68d8('0x34')](_0x3f485f)['then'](handleEntityNotFound(_0x1ea7ad,null))[_0x68d8('0x19')](respondWithResult(_0x1ea7ad,null))[_0x68d8('0x35')](handleError(_0x1ea7ad,null));};exports[_0x68d8('0x36')]=function(_0x3080fd,_0x467686){return db[_0x68d8('0x22')][_0x68d8('0x36')](_0x3080fd[_0x68d8('0x37')],{})[_0x68d8('0x19')](function(_0x1a212e){var _0x2987a8=_0x3080fd[_0x68d8('0x38')]['get']({'plain':!![]});if(!_0x2987a8)throw new Error(_0x68d8('0x39'));if(_0x2987a8[_0x68d8('0x3a')]==='user'){var _0x47520c=_0x1a212e[_0x68d8('0x3b')]({'plain':!![]});var _0x443fbd=_0x68d8('0x1b');return db[_0x68d8('0x3c')]['find']({'where':{'name':_0x443fbd,'userProfileId':_0x2987a8[_0x68d8('0x3d')]},'raw':!![]})[_0x68d8('0x19')](function(_0x8d79ab){if(_0x8d79ab&&_0x8d79ab[_0x68d8('0x3e')]===0x0){return db[_0x68d8('0x1c')][_0x68d8('0x36')]({'name':_0x47520c[_0x68d8('0x1e')],'resourceId':_0x47520c['id'],'type':_0x8d79ab[_0x68d8('0x1e')],'sectionId':_0x8d79ab['id']},{})[_0x68d8('0x19')](function(){return _0x1a212e;});}else{return _0x1a212e;}})[_0x68d8('0x35')](function(_0x3fc10c){logger[_0x68d8('0x3f')](_0x68d8('0x40'),_0x3fc10c);throw _0x3fc10c;});}return _0x1a212e;})[_0x68d8('0x19')](respondWithResult(_0x467686,0xc9))['catch'](handleError(_0x467686,null));};exports[_0x68d8('0x18')]=function(_0xf72978,_0x4967b3){if(_0xf72978[_0x68d8('0x37')]['id']){delete _0xf72978['body']['id'];}return db[_0x68d8('0x22')][_0x68d8('0x34')]({'where':{'id':_0xf72978[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x4967b3,null))[_0x68d8('0x19')](saveUpdates(_0xf72978['body'],null))['then'](respondWithResult(_0x4967b3,null))[_0x68d8('0x35')](handleError(_0x4967b3,null));};exports[_0x68d8('0x1a')]=function(_0x172e9b,_0x6d44c9){return db['ChatQueue']['find']({'where':{'id':_0x172e9b[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x6d44c9,null))[_0x68d8('0x19')](removeEntity(_0x6d44c9,null))['catch'](handleError(_0x6d44c9,null));};exports['describe']=function(_0x46068d,_0x30258){return db[_0x68d8('0x22')]['describe']()[_0x68d8('0x19')](respondWithResult(_0x30258,null))['catch'](handleError(_0x30258,null));};exports[_0x68d8('0x41')]=function(_0xd57a3e,_0x29212f){var _0x43612b={'raw':!![],'where':{}},_0x1b7181={},_0x58fb97;return db['ChatQueue'][_0x68d8('0x42')]({'where':{'id':_0xd57a3e['params']['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x29212f,null))[_0x68d8('0x19')](function(_0x399e8f){if(_0x399e8f){_0x58fb97=_0x399e8f[_0x68d8('0x3b')]({'plain':!![]});_0x1b7181[_0x68d8('0x2c')]=_[_0x68d8('0x2d')](db[_0x68d8('0x43')][_0x68d8('0x44')]);_0x1b7181[_0x68d8('0x27')]=_[_0x68d8('0x2d')](_0xd57a3e['query']);_0x1b7181['filters']=_[_0x68d8('0x2f')](_0x1b7181[_0x68d8('0x2c')],_0x1b7181[_0x68d8('0x27')]);_0x43612b[_0x68d8('0x2e')]=_[_0x68d8('0x2f')](_0x1b7181[_0x68d8('0x2c')],qs[_0x68d8('0x30')](_0xd57a3e['query'][_0x68d8('0x30')]));_0x43612b[_0x68d8('0x2e')]=_0x43612b[_0x68d8('0x2e')][_0x68d8('0x31')]?_0x43612b[_0x68d8('0x2e')]:_0x1b7181['model'];if(!_0xd57a3e[_0x68d8('0x27')][_0x68d8('0x45')]('nolimit')){_0x43612b[_0x68d8('0x14')]=qs['limit'](_0xd57a3e[_0x68d8('0x27')][_0x68d8('0x14')]);_0x43612b['offset']=qs[_0x68d8('0x13')](_0xd57a3e[_0x68d8('0x27')]['offset']);}_0x43612b[_0x68d8('0x46')]=qs['sort'](_0xd57a3e[_0x68d8('0x27')][_0x68d8('0x47')]);_0x43612b['where']=qs[_0x68d8('0x48')](_[_0x68d8('0x49')](_0xd57a3e[_0x68d8('0x27')],_0x1b7181[_0x68d8('0x48')]));_0x43612b[_0x68d8('0x4a')][_0x68d8('0x4b')]=_0x399e8f['id'];if(_0xd57a3e[_0x68d8('0x27')][_0x68d8('0x4c')]){_0x43612b['where']=_['merge'](_0x43612b['where'],{'$or':_['map'](_0x43612b[_0x68d8('0x2e')],function(_0xe16e0f){var _0x45d34a={};_0x45d34a[_0xe16e0f]={'$like':'%'+_0xd57a3e[_0x68d8('0x27')][_0x68d8('0x4c')]+'%'};return _0x45d34a;})});}_0x43612b=_[_0x68d8('0x4d')]({},_0x43612b,_0xd57a3e[_0x68d8('0x33')]);return db[_0x68d8('0x43')][_0x68d8('0x28')](_0x43612b);}})['then'](function(_0x38faff){if(_0x38faff){return db[_0x68d8('0x4e')][_0x68d8('0x4f')]({'where':{'id':_['map'](_0x38faff,'UserId'),'role':_0x68d8('0x50')},'attributes':['id','name',_0x68d8('0x51'),'updatedAt',_0x68d8('0x52')]});}})[_0x68d8('0x19')](function(_0x2a5e89){if(_0x2a5e89){return{'count':_0x2a5e89[_0x68d8('0x16')],'rows':_[_0x68d8('0x21')](_0x2a5e89[_0x68d8('0x29')],function(_0x19d756){return{'membername':_0x19d756[_0x68d8('0x1e')],'UserId':_0x19d756['id'],'queue_name':_0x58fb97[_0x68d8('0x1e')],'ChatQueueId':_0x58fb97['id'],'interface':util[_0x68d8('0x53')](_0x68d8('0x54'),_0x68d8('0x55'),_0x19d756[_0x68d8('0x1e')]),'penalty':0x0,'paused':_0x19d756['chatPause'],'createdAt':_0x19d756[_0x68d8('0x52')],'updatedAt':_0x19d756['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x29212f,_0x43612b))[_0x68d8('0x35')](handleError(_0x29212f,null));};exports['getTeams']=function(_0x26181a,_0x3d2c1b){var _0x2c46ec={};var _0x5abe45={};var _0x117c94;var _0x392b4a;return db[_0x68d8('0x22')][_0x68d8('0x42')]({'where':{'id':_0x26181a['params']['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x3d2c1b,null))[_0x68d8('0x19')](function(_0x2761b3){if(_0x2761b3){_0x117c94=_0x2761b3;_0x5abe45['model']=_[_0x68d8('0x2d')](db['Team'][_0x68d8('0x44')]);_0x5abe45[_0x68d8('0x27')]=_[_0x68d8('0x2d')](_0x26181a[_0x68d8('0x27')]);_0x5abe45[_0x68d8('0x48')]=_['intersection'](_0x5abe45[_0x68d8('0x2c')],_0x5abe45[_0x68d8('0x27')]);_0x2c46ec['attributes']=_['intersection'](_0x5abe45['model'],qs[_0x68d8('0x30')](_0x26181a['query'][_0x68d8('0x30')]));_0x2c46ec['attributes']=_0x2c46ec[_0x68d8('0x2e')][_0x68d8('0x31')]?_0x2c46ec[_0x68d8('0x2e')]:_0x5abe45[_0x68d8('0x2c')];_0x2c46ec[_0x68d8('0x46')]=qs['sort'](_0x26181a[_0x68d8('0x27')][_0x68d8('0x47')]);_0x2c46ec[_0x68d8('0x4a')]=qs[_0x68d8('0x48')](_[_0x68d8('0x49')](_0x26181a[_0x68d8('0x27')],_0x5abe45['filters']));if(_0x26181a[_0x68d8('0x27')]['filter']){_0x2c46ec['where']=_[_0x68d8('0x4d')](_0x2c46ec[_0x68d8('0x4a')],{'$or':_[_0x68d8('0x21')](_0x2c46ec[_0x68d8('0x2e')],function(_0x39fe2c){var _0x2f1d8b={};_0x2f1d8b[_0x39fe2c]={'$like':'%'+_0x26181a[_0x68d8('0x27')][_0x68d8('0x4c')]+'%'};return _0x2f1d8b;})});}_0x2c46ec=_[_0x68d8('0x4d')]({},_0x2c46ec,_0x26181a[_0x68d8('0x33')]);return _0x117c94[_0x68d8('0x56')](_0x2c46ec);}})['then'](function(_0x19e2bf){if(_0x19e2bf){_0x392b4a=_0x19e2bf[_0x68d8('0x31')];if(!_0x26181a[_0x68d8('0x27')][_0x68d8('0x45')](_0x68d8('0x57'))){_0x2c46ec[_0x68d8('0x14')]=qs[_0x68d8('0x14')](_0x26181a['query'][_0x68d8('0x14')]);_0x2c46ec[_0x68d8('0x13')]=qs[_0x68d8('0x13')](_0x26181a[_0x68d8('0x27')][_0x68d8('0x13')]);}return _0x117c94['getTeams'](_0x2c46ec);}})[_0x68d8('0x19')](function(_0x324348){if(_0x324348){return _0x324348?{'count':_0x392b4a,'rows':_0x324348}:null;}})[_0x68d8('0x19')](respondWithResult(_0x3d2c1b,null))[_0x68d8('0x35')](handleError(_0x3d2c1b,null));};exports['addTeams']=function(_0x5b42fb,_0x5b3d60){var _0x2a8b3e=_0x5b42fb['body'][_0x68d8('0x58')];return db[_0x68d8('0x59')][_0x68d8('0x28')]({'where':{'id':_0x2a8b3e},'attributes':['id'],'include':[{'model':db[_0x68d8('0x4e')],'as':_0x68d8('0x5a'),'attributes':['id',_0x68d8('0x1e'),'online',_0x68d8('0x5b'),'interface'],'raw':!![]}]})[_0x68d8('0x19')](function(_0x411474){if(_0x411474){var _0x32b8e2=_[_0x68d8('0x5c')](_0x411474,function(_0x47502e){var _0x2ef098=_0x47502e[_0x68d8('0x3b')]({'plain':!![]});return _0x2ef098['Agents'];});return db['ChatQueue'][_0x68d8('0x34')]({'where':{'id':_0x5b42fb[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](function(_0x1150a7){return db[_0x68d8('0x5d')][_0x68d8('0x5e')](function(_0x121cf9){return _0x1150a7[_0x68d8('0x5f')](_0x2a8b3e,{'transaction':_0x121cf9})[_0x68d8('0x19')](function(){return BPromise[_0x68d8('0x60')](_0x32b8e2,function(_0x4f8b8d){return db['UserChatQueue'][_0x68d8('0x61')]({'where':{'UserId':_0x4f8b8d['id'],'ChatQueueId':_0x5b42fb['params']['id']},'transaction':_0x121cf9});});})['then'](function(){_0x32b8e2[_0x68d8('0x62')](function(_0x583339){socket[_0x68d8('0x63')](_0x68d8('0x64'),{'UserId':_0x583339['id'],'ChatQueueId':_0x1150a7['id']});});});});});}})[_0x68d8('0x19')](respondWithStatusCode(_0x5b3d60,null))[_0x68d8('0x35')](handleError(_0x5b3d60,null));};exports[_0x68d8('0x65')]=function(_0x181098,_0x16b9df){return db['Team'][_0x68d8('0x28')]({'where':{'id':_0x181098[_0x68d8('0x27')][_0x68d8('0x58')]},'attributes':['id'],'include':[{'model':db[_0x68d8('0x4e')],'as':_0x68d8('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x68d8('0x19')](handleEntityNotFound(_0x16b9df,null))[_0x68d8('0x19')](function(_0x11b8c5){var _0x3bb35b=_['map'](_0x11b8c5,'id');var _0x22c41c=[];var _0x1d452c=[];var _0xce342=squel[_0x68d8('0x66')]();_0xce342[_0x68d8('0x67')](_0x68d8('0x68'))[_0x68d8('0x69')](_0x68d8('0x6a'),'tq')[_0x68d8('0x6b')](_0x68d8('0x6c'),'ut',_0x68d8('0x6d'))['where'](_0x68d8('0x6e'),_0x181098[_0x68d8('0x2b')]['id']);for(var _0x2c5311=0x0;_0x2c5311<_0x11b8c5['length'];_0x2c5311+=0x1){let _0x2f9b10=_0x11b8c5[_0x2c5311];for(var _0x2102ef=0x0;_0x2102ef<_0x2f9b10['Agents'][_0x68d8('0x31')];_0x2102ef+=0x1){let _0x3b5226=_0x2f9b10[_0x68d8('0x5a')][_0x2102ef];var _0x4da9a0=_0xce342[_0x68d8('0x6f')]();_0x4da9a0['where'](_0x68d8('0x70'),_0x3b5226['id']);_0x1d452c[_0x68d8('0x71')](db['sequelize'][_0x68d8('0x27')](_0x4da9a0[_0x68d8('0x72')](),{'type':db['sequelize']['QueryTypes'][_0x68d8('0x73')]})[_0x68d8('0x19')](function(_0x3f2dbf){if(_0x3f2dbf[_0x68d8('0x31')]===0x1){return _0x3b5226['id'];}else{var _0x5ac1ec=_[_0x68d8('0x74')](_['map'](_0x3f2dbf,_0x68d8('0x75')),function(_0x5a12e7){return _['includes'](_0x3bb35b,_0x5a12e7);});if(_0x5ac1ec){return _0x3b5226['id'];}}}));}}return BPromise[_0x68d8('0x76')](_0x1d452c)[_0x68d8('0x19')](function(_0x2ee98c){_0x22c41c=_(_0x22c41c)[_0x68d8('0x77')](_0x2ee98c)['compact']()[_0x68d8('0x78')]();return db[_0x68d8('0x22')]['find']({'where':{'id':_0x181098[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](function(_0x2747bb){return db[_0x68d8('0x5d')][_0x68d8('0x5e')](function(_0x5bda9b){return _0x2747bb[_0x68d8('0x65')](_0x181098['query']['ids'],{'transaction':_0x5bda9b})[_0x68d8('0x19')](function(){if(!_[_0x68d8('0x79')](_0x22c41c)){return _0x2747bb[_0x68d8('0x7a')](_0x22c41c,{'transaction':_0x5bda9b});}})[_0x68d8('0x19')](function(){_0x22c41c[_0x68d8('0x62')](function(_0x4a2516){socket['emit']('userChatQueue:remove',{'UserId':_0x4a2516,'ChatQueueId':_0x2747bb['id']});});});});});});})['then'](respondWithStatusCode(_0x16b9df,null))[_0x68d8('0x35')](handleError(_0x16b9df,null));};exports[_0x68d8('0x7b')]=function(_0x2bb1e1,_0x4a0faa){return db['ChatQueue'][_0x68d8('0x34')]({'where':{'id':_0x2bb1e1[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x4a0faa,null))[_0x68d8('0x19')](function(_0x320206){if(_0x320206){return _0x320206[_0x68d8('0x7b')](_0x2bb1e1['body']['ids'],_['omit'](_0x2bb1e1[_0x68d8('0x37')],[_0x68d8('0x58'),'id'])||{})[_0x68d8('0x7c')](function(_0x2206e3){for(var _0x4e8877=0x0;_0x4e8877<_0x2bb1e1[_0x68d8('0x37')][_0x68d8('0x58')][_0x68d8('0x31')];_0x4e8877+=0x1){socket[_0x68d8('0x63')]('userChatQueue:save',{'UserId':Number(_0x2bb1e1[_0x68d8('0x37')][_0x68d8('0x58')][_0x4e8877]),'ChatQueueId':Number(_0x2bb1e1[_0x68d8('0x2b')]['id'])});}return _0x2206e3;});}})[_0x68d8('0x19')](respondWithResult(_0x4a0faa,null))['catch'](handleError(_0x4a0faa,null));};exports[_0x68d8('0x7a')]=function(_0x59f49c,_0x42a500){return db[_0x68d8('0x22')][_0x68d8('0x34')]({'where':{'id':_0x59f49c[_0x68d8('0x2b')]['id']}})[_0x68d8('0x19')](handleEntityNotFound(_0x42a500,null))['then'](function(_0x2fff1a){if(_0x2fff1a){return _0x2fff1a[_0x68d8('0x7a')](_0x59f49c[_0x68d8('0x27')][_0x68d8('0x58')])[_0x68d8('0x19')](function(){if(_[_0x68d8('0x7d')](_0x59f49c[_0x68d8('0x27')][_0x68d8('0x58')])){for(var _0xd3da24=0x0;_0xd3da24<_0x59f49c[_0x68d8('0x27')][_0x68d8('0x58')]['length'];_0xd3da24+=0x1){socket[_0x68d8('0x63')](_0x68d8('0x7e'),{'UserId':Number(_0x59f49c[_0x68d8('0x27')][_0x68d8('0x58')][_0xd3da24]),'ChatQueueId':Number(_0x59f49c[_0x68d8('0x2b')]['id'])});}}else{socket[_0x68d8('0x63')]('userChatQueue:remove',{'UserId':Number(_0x59f49c[_0x68d8('0x27')]['ids']),'ChatQueueId':Number(_0x59f49c[_0x68d8('0x2b')]['id'])});}});}})[_0x68d8('0x19')](respondWithStatusCode(_0x42a500,null))[_0x68d8('0x35')](handleError(_0x42a500,null));};exports['getAgents']=function(_0x5edf6c,_0x3151d2){var _0x328fee={};var _0x1defdc={};var _0x17686b;var _0x5bdc34;return db[_0x68d8('0x22')][_0x68d8('0x42')]({'where':{'id':_0x5edf6c[_0x68d8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3151d2,null))['then'](function(_0x22e4c4){if(_0x22e4c4){_0x17686b=_0x22e4c4;_0x1defdc['model']=_[_0x68d8('0x2d')](db[_0x68d8('0x4e')][_0x68d8('0x44')]);_0x1defdc[_0x68d8('0x27')]=_[_0x68d8('0x2d')](_0x5edf6c['query']);_0x1defdc['filters']=_[_0x68d8('0x2f')](_0x1defdc['model'],_0x1defdc['query']);_0x328fee[_0x68d8('0x2e')]=_[_0x68d8('0x2f')](_0x1defdc['model'],qs[_0x68d8('0x30')](_0x5edf6c['query'][_0x68d8('0x30')]));_0x328fee[_0x68d8('0x2e')]=_0x328fee[_0x68d8('0x2e')][_0x68d8('0x31')]?_0x328fee[_0x68d8('0x2e')]:_0x1defdc[_0x68d8('0x2c')];_0x328fee[_0x68d8('0x46')]=qs[_0x68d8('0x47')](_0x5edf6c[_0x68d8('0x27')]['sort']);_0x328fee[_0x68d8('0x4a')]=qs[_0x68d8('0x48')](_[_0x68d8('0x49')](_0x5edf6c[_0x68d8('0x27')],_0x1defdc[_0x68d8('0x48')]));if(_0x5edf6c[_0x68d8('0x27')][_0x68d8('0x4c')]){_0x328fee[_0x68d8('0x4a')]=_[_0x68d8('0x4d')](_0x328fee[_0x68d8('0x4a')],{'$or':_[_0x68d8('0x21')](_0x328fee[_0x68d8('0x2e')],function(_0xdbcc6b){var _0x3556a8={};_0x3556a8[_0xdbcc6b]={'$like':'%'+_0x5edf6c[_0x68d8('0x27')][_0x68d8('0x4c')]+'%'};return _0x3556a8;})});}_0x328fee=_['merge']({},_0x328fee,_0x5edf6c[_0x68d8('0x33')]);return _0x17686b['getAgents'](_0x328fee);}})[_0x68d8('0x19')](function(_0x15bdeb){if(_0x15bdeb){_0x5bdc34=_0x15bdeb[_0x68d8('0x31')];if(!_0x5edf6c[_0x68d8('0x27')][_0x68d8('0x45')](_0x68d8('0x57'))){_0x328fee[_0x68d8('0x14')]=qs[_0x68d8('0x14')](_0x5edf6c['query']['limit']);_0x328fee[_0x68d8('0x13')]=qs['offset'](_0x5edf6c[_0x68d8('0x27')]['offset']);}return _0x17686b[_0x68d8('0x7f')](_0x328fee);}})['then'](function(_0x1a96e6){if(_0x1a96e6){return _0x1a96e6?{'count':_0x5bdc34,'rows':_0x1a96e6}:null;}})[_0x68d8('0x19')](respondWithResult(_0x3151d2,null))[_0x68d8('0x35')](handleError(_0x3151d2,null));}; \ No newline at end of file +var _0x99a5=['filter','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','get','ChatQueues','UserProfileResource','destroy','error','stack','name','send','index','map','ChatQueue','rawAttributes','getOptions','include','query','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','order','sort','pick','ChatQueueId','where','findAll','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','Team','nolimit','Agents','online','voicePause','interface','flatMap','each','emit','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','sequelize','toString','SELECT','includes','all','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents'];(function(_0x464b39,_0x19d526){var _0x1fc015=function(_0x461291){while(--_0x461291){_0x464b39['push'](_0x464b39['shift']());}};_0x1fc015(++_0x19d526);}(_0x99a5,0xee));var _0x599a=function(_0x45ec67,_0x3e56d4){_0x45ec67=_0x45ec67-0x0;var _0x50747d=_0x99a5[_0x45ec67];return _0x50747d;};'use strict';var BPromise=require(_0x599a('0x0'));var util=require(_0x599a('0x1'));var _=require(_0x599a('0x2'));var squel=require(_0x599a('0x3'));var Redis=require(_0x599a('0x4'));var qs=require(_0x599a('0x5'));var logger=require(_0x599a('0x6'))(_0x599a('0x7'));var config=require(_0x599a('0x8'));var db=require(_0x599a('0x9'))['db'];config[_0x599a('0xa')]=_['defaults'](config[_0x599a('0xa')],{'host':_0x599a('0xb'),'port':0x18eb});var socket=require(_0x599a('0xc'))(new Redis(config[_0x599a('0xa')]));require(_0x599a('0xd'))[_0x599a('0xe')](socket);function respondWithStatusCode(_0x36b043,_0x412ded){_0x412ded=_0x412ded||0xcc;return function(_0x32af42){if(_0x32af42){return _0x36b043[_0x599a('0xf')](_0x412ded);}return _0x36b043[_0x599a('0x10')](_0x412ded)[_0x599a('0x11')]();};}function respondWithResult(_0x564dc4,_0x176a82){_0x176a82=_0x176a82||0xc8;return function(_0x36dd50){if(_0x36dd50){return _0x564dc4[_0x599a('0x10')](_0x176a82)['json'](_0x36dd50);}};}function respondWithFilteredResult(_0x589d6f,_0x124e95){return function(_0x14769b){if(_0x14769b){var _0x1bb7d1=typeof _0x124e95[_0x599a('0x12')]===_0x599a('0x13')&&typeof _0x124e95[_0x599a('0x14')]===_0x599a('0x13');var _0x4a6bf9=_0x14769b[_0x599a('0x15')];var _0x95dc0b=_0x1bb7d1?0x0:_0x124e95[_0x599a('0x12')];var _0x1acf0c=_0x1bb7d1?_0x14769b[_0x599a('0x15')]:_0x124e95[_0x599a('0x12')]+_0x124e95['limit'];var _0x44098a;if(_0x1acf0c>=_0x4a6bf9){_0x1acf0c=_0x4a6bf9;_0x44098a=0xc8;}else{_0x44098a=0xce;}_0x589d6f[_0x599a('0x10')](_0x44098a);return _0x589d6f[_0x599a('0x16')](_0x599a('0x17'),_0x95dc0b+'-'+_0x1acf0c+'/'+_0x4a6bf9)[_0x599a('0x18')](_0x14769b);}return null;};}function saveUpdates(_0x493855){return function(_0x345d93){if(_0x345d93){return _0x345d93['update'](_0x493855)[_0x599a('0x19')](function(_0x311af3){return _0x311af3;});}return null;};}function removeEntity(_0x473650){return function(_0x56abf5){if(_0x56abf5){return _0x56abf5['destroy']()[_0x599a('0x19')](function(){var _0x3b1e07=_0x56abf5[_0x599a('0x1a')]({'plain':!![]});var _0x56cddf=_0x599a('0x1b');return db[_0x599a('0x1c')][_0x599a('0x1d')]({'where':{'type':_0x56cddf,'resourceId':_0x3b1e07['id']}})['then'](function(){return _0x56abf5;});})[_0x599a('0x19')](function(){_0x473650[_0x599a('0x10')](0xcc)[_0x599a('0x11')]();});}};}function handleEntityNotFound(_0x3a3a51){return function(_0x269663){if(!_0x269663){_0x3a3a51[_0x599a('0xf')](0x194);}return _0x269663;};}function handleError(_0x38e1bc,_0x1ae622){_0x1ae622=_0x1ae622||0x1f4;return function(_0x45bc1f){logger[_0x599a('0x1e')](_0x45bc1f[_0x599a('0x1f')]);if(_0x45bc1f[_0x599a('0x20')]){delete _0x45bc1f[_0x599a('0x20')];}_0x38e1bc['status'](_0x1ae622)[_0x599a('0x21')](_0x45bc1f);};}exports[_0x599a('0x22')]=function(_0x23e5df,_0x52993f){var _0x32b239={};var _0x5e4117={'count':0x0,'rows':[]};var _0x55a5b8=_[_0x599a('0x23')](db[_0x599a('0x24')][_0x599a('0x25')],function(_0x1248b5){return{'name':_0x1248b5['fieldName'],'type':_0x1248b5['type']['key']};});_0x32b239=qs[_0x599a('0x26')](_0x55a5b8,_0x23e5df);var _0x2080c5={'where':_0x32b239['where']};return db[_0x599a('0x24')]['count'](_0x2080c5)[_0x599a('0x19')](function(_0x20474c){_0x5e4117[_0x599a('0x15')]=_0x20474c;_0x32b239['include']=qs[_0x599a('0x27')](_0x23e5df[_0x599a('0x28')]);return db[_0x599a('0x24')]['findAll'](_0x32b239);})[_0x599a('0x19')](function(_0x164453){_0x5e4117['rows']=_0x164453;return _0x5e4117;})[_0x599a('0x19')](respondWithFilteredResult(_0x52993f,_0x32b239))['catch'](handleError(_0x52993f,null));};exports['show']=function(_0x2ff839,_0x808392){var _0x4b9b67={'raw':!![],'where':{'id':_0x2ff839[_0x599a('0x29')]['id']}},_0x430b70={};_0x430b70[_0x599a('0x2a')]=_[_0x599a('0x2b')](db['ChatQueue'][_0x599a('0x25')]);_0x430b70[_0x599a('0x28')]=_[_0x599a('0x2b')](_0x2ff839['query']);_0x430b70[_0x599a('0x2c')]=_['intersection'](_0x430b70['model'],_0x430b70[_0x599a('0x28')]);_0x4b9b67['attributes']=_[_0x599a('0x2d')](_0x430b70[_0x599a('0x2a')],qs[_0x599a('0x2e')](_0x2ff839[_0x599a('0x28')][_0x599a('0x2e')]));_0x4b9b67[_0x599a('0x2f')]=_0x4b9b67['attributes'][_0x599a('0x30')]?_0x4b9b67[_0x599a('0x2f')]:_0x430b70[_0x599a('0x2a')];if(_0x2ff839[_0x599a('0x28')][_0x599a('0x31')]){_0x4b9b67['include']=[{'all':!![]}];}_0x4b9b67=_[_0x599a('0x32')]({},_0x4b9b67,_0x2ff839[_0x599a('0x33')]);return db['ChatQueue'][_0x599a('0x34')](_0x4b9b67)[_0x599a('0x19')](handleEntityNotFound(_0x808392,null))[_0x599a('0x19')](respondWithResult(_0x808392,null))[_0x599a('0x35')](handleError(_0x808392,null));};exports[_0x599a('0x36')]=function(_0x5784dd,_0x5abd50){return db[_0x599a('0x24')][_0x599a('0x36')](_0x5784dd[_0x599a('0x37')],{})['then'](function(_0x3edf73){var _0x2af47b=_0x5784dd['user']['get']({'plain':!![]});if(!_0x2af47b)throw new Error(_0x599a('0x38'));if(_0x2af47b[_0x599a('0x39')]===_0x599a('0x3a')){var _0x4108f5=_0x3edf73['get']({'plain':!![]});var _0x10cb44=_0x599a('0x1b');return db[_0x599a('0x3b')]['find']({'where':{'name':_0x10cb44,'userProfileId':_0x2af47b[_0x599a('0x3c')]},'raw':!![]})[_0x599a('0x19')](function(_0x4be504){if(_0x4be504&&_0x4be504[_0x599a('0x3d')]===0x0){return db[_0x599a('0x1c')][_0x599a('0x36')]({'name':_0x4108f5['name'],'resourceId':_0x4108f5['id'],'type':_0x4be504['name'],'sectionId':_0x4be504['id']},{})['then'](function(){return _0x3edf73;});}else{return _0x3edf73;}})[_0x599a('0x35')](function(_0x58bad5){logger[_0x599a('0x1e')](_0x599a('0x3e'),_0x58bad5);throw _0x58bad5;});}return _0x3edf73;})[_0x599a('0x19')](respondWithResult(_0x5abd50,0xc9))['catch'](handleError(_0x5abd50,null));};exports[_0x599a('0x3f')]=function(_0x27d2c3,_0x10c08c){if(_0x27d2c3[_0x599a('0x37')]['id']){delete _0x27d2c3[_0x599a('0x37')]['id'];}return db[_0x599a('0x24')][_0x599a('0x34')]({'where':{'id':_0x27d2c3[_0x599a('0x29')]['id']}})[_0x599a('0x19')](handleEntityNotFound(_0x10c08c,null))[_0x599a('0x19')](saveUpdates(_0x27d2c3[_0x599a('0x37')],null))[_0x599a('0x19')](respondWithResult(_0x10c08c,null))['catch'](handleError(_0x10c08c,null));};exports[_0x599a('0x1d')]=function(_0x58ba15,_0x31f427){return db['ChatQueue'][_0x599a('0x34')]({'where':{'id':_0x58ba15['params']['id']}})[_0x599a('0x19')](handleEntityNotFound(_0x31f427,null))[_0x599a('0x19')](removeEntity(_0x31f427,null))[_0x599a('0x35')](handleError(_0x31f427,null));};exports[_0x599a('0x40')]=function(_0x5a679e,_0x252844){return db[_0x599a('0x24')][_0x599a('0x40')]()[_0x599a('0x19')](respondWithResult(_0x252844,null))[_0x599a('0x35')](handleError(_0x252844,null));};exports[_0x599a('0x41')]=function(_0x5a6ed3,_0x40b362){var _0x5124d5={'raw':!![],'where':{}},_0x15aad4={},_0x52e78f;return db[_0x599a('0x24')][_0x599a('0x42')]({'where':{'id':_0x5a6ed3[_0x599a('0x29')]['id']}})[_0x599a('0x19')](handleEntityNotFound(_0x40b362,null))[_0x599a('0x19')](function(_0x5d34a1){if(_0x5d34a1){_0x52e78f=_0x5d34a1[_0x599a('0x1a')]({'plain':!![]});_0x15aad4[_0x599a('0x2a')]=_['keys'](db[_0x599a('0x43')][_0x599a('0x25')]);_0x15aad4[_0x599a('0x28')]=_[_0x599a('0x2b')](_0x5a6ed3[_0x599a('0x28')]);_0x15aad4['filters']=_[_0x599a('0x2d')](_0x15aad4[_0x599a('0x2a')],_0x15aad4[_0x599a('0x28')]);_0x5124d5['attributes']=_[_0x599a('0x2d')](_0x15aad4[_0x599a('0x2a')],qs[_0x599a('0x2e')](_0x5a6ed3[_0x599a('0x28')][_0x599a('0x2e')]));_0x5124d5['attributes']=_0x5124d5[_0x599a('0x2f')][_0x599a('0x30')]?_0x5124d5[_0x599a('0x2f')]:_0x15aad4['model'];if(!_0x5a6ed3[_0x599a('0x28')]['hasOwnProperty']('nolimit')){_0x5124d5['limit']=qs[_0x599a('0x14')](_0x5a6ed3[_0x599a('0x28')][_0x599a('0x14')]);_0x5124d5[_0x599a('0x12')]=qs[_0x599a('0x12')](_0x5a6ed3[_0x599a('0x28')]['offset']);}_0x5124d5[_0x599a('0x44')]=qs[_0x599a('0x45')](_0x5a6ed3[_0x599a('0x28')]['sort']);_0x5124d5['where']=qs[_0x599a('0x2c')](_[_0x599a('0x46')](_0x5a6ed3[_0x599a('0x28')],_0x15aad4[_0x599a('0x2c')]));_0x5124d5['where'][_0x599a('0x47')]=_0x5d34a1['id'];if(_0x5a6ed3[_0x599a('0x28')]['filter']){_0x5124d5[_0x599a('0x48')]=_['merge'](_0x5124d5['where'],{'$or':_[_0x599a('0x23')](_0x5124d5[_0x599a('0x2f')],function(_0x5510b3){var _0x2f58c1={};_0x2f58c1[_0x5510b3]={'$like':'%'+_0x5a6ed3['query']['filter']+'%'};return _0x2f58c1;})});}_0x5124d5=_[_0x599a('0x32')]({},_0x5124d5,_0x5a6ed3[_0x599a('0x33')]);return db[_0x599a('0x43')][_0x599a('0x49')](_0x5124d5);}})['then'](function(_0x597387){if(_0x597387){return db[_0x599a('0x4a')][_0x599a('0x4b')]({'where':{'id':_[_0x599a('0x23')](_0x597387,'UserId'),'role':_0x599a('0x4c')},'attributes':['id',_0x599a('0x20'),'chatPause',_0x599a('0x4d'),_0x599a('0x4e')]});}})['then'](function(_0x4980bb){if(_0x4980bb){return{'count':_0x4980bb[_0x599a('0x15')],'rows':_[_0x599a('0x23')](_0x4980bb['rows'],function(_0x54d649){return{'membername':_0x54d649['name'],'UserId':_0x54d649['id'],'queue_name':_0x52e78f['name'],'ChatQueueId':_0x52e78f['id'],'interface':util['format'](_0x599a('0x4f'),_0x599a('0x50'),_0x54d649[_0x599a('0x20')]),'penalty':0x0,'paused':_0x54d649[_0x599a('0x51')],'createdAt':_0x54d649['createdAt'],'updatedAt':_0x54d649[_0x599a('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x599a('0x19')](respondWithFilteredResult(_0x40b362,_0x5124d5))[_0x599a('0x35')](handleError(_0x40b362,null));};exports[_0x599a('0x52')]=function(_0x5caf61,_0x4286d3){var _0x476ead={};var _0x2317fe={};var _0x2f2c59;var _0x1f4737;return db['ChatQueue'][_0x599a('0x42')]({'where':{'id':_0x5caf61[_0x599a('0x29')]['id']}})[_0x599a('0x19')](handleEntityNotFound(_0x4286d3,null))['then'](function(_0x259464){if(_0x259464){_0x2f2c59=_0x259464;_0x2317fe[_0x599a('0x2a')]=_[_0x599a('0x2b')](db[_0x599a('0x53')][_0x599a('0x25')]);_0x2317fe['query']=_[_0x599a('0x2b')](_0x5caf61[_0x599a('0x28')]);_0x2317fe[_0x599a('0x2c')]=_['intersection'](_0x2317fe[_0x599a('0x2a')],_0x2317fe[_0x599a('0x28')]);_0x476ead[_0x599a('0x2f')]=_[_0x599a('0x2d')](_0x2317fe[_0x599a('0x2a')],qs[_0x599a('0x2e')](_0x5caf61[_0x599a('0x28')][_0x599a('0x2e')]));_0x476ead[_0x599a('0x2f')]=_0x476ead[_0x599a('0x2f')][_0x599a('0x30')]?_0x476ead[_0x599a('0x2f')]:_0x2317fe[_0x599a('0x2a')];_0x476ead['order']=qs[_0x599a('0x45')](_0x5caf61[_0x599a('0x28')]['sort']);_0x476ead['where']=qs['filters'](_['pick'](_0x5caf61[_0x599a('0x28')],_0x2317fe[_0x599a('0x2c')]));if(_0x5caf61[_0x599a('0x28')]['filter']){_0x476ead[_0x599a('0x48')]=_[_0x599a('0x32')](_0x476ead[_0x599a('0x48')],{'$or':_[_0x599a('0x23')](_0x476ead['attributes'],function(_0x56008b){var _0x35b7af={};_0x35b7af[_0x56008b]={'$like':'%'+_0x5caf61[_0x599a('0x28')]['filter']+'%'};return _0x35b7af;})});}_0x476ead=_[_0x599a('0x32')]({},_0x476ead,_0x5caf61[_0x599a('0x33')]);return _0x2f2c59[_0x599a('0x52')](_0x476ead);}})[_0x599a('0x19')](function(_0xad26fb){if(_0xad26fb){_0x1f4737=_0xad26fb[_0x599a('0x30')];if(!_0x5caf61[_0x599a('0x28')]['hasOwnProperty'](_0x599a('0x54'))){_0x476ead[_0x599a('0x14')]=qs[_0x599a('0x14')](_0x5caf61[_0x599a('0x28')][_0x599a('0x14')]);_0x476ead[_0x599a('0x12')]=qs[_0x599a('0x12')](_0x5caf61[_0x599a('0x28')]['offset']);}return _0x2f2c59[_0x599a('0x52')](_0x476ead);}})['then'](function(_0x36c726){if(_0x36c726){return _0x36c726?{'count':_0x1f4737,'rows':_0x36c726}:null;}})[_0x599a('0x19')](respondWithResult(_0x4286d3,null))[_0x599a('0x35')](handleError(_0x4286d3,null));};exports['addTeams']=function(_0x16b239,_0x9cc376){var _0x45e8e5=_0x16b239[_0x599a('0x37')]['ids'];return db['Team'][_0x599a('0x49')]({'where':{'id':_0x45e8e5},'attributes':['id'],'include':[{'model':db[_0x599a('0x4a')],'as':_0x599a('0x55'),'attributes':['id',_0x599a('0x20'),_0x599a('0x56'),_0x599a('0x57'),_0x599a('0x58')],'raw':!![]}]})[_0x599a('0x19')](function(_0x2f9fa5){if(_0x2f9fa5){var _0x5859f3=_[_0x599a('0x59')](_0x2f9fa5,function(_0x164fa1){var _0x4692ef=_0x164fa1['get']({'plain':!![]});return _0x4692ef['Agents'];});return db[_0x599a('0x24')][_0x599a('0x34')]({'where':{'id':_0x16b239[_0x599a('0x29')]['id']}})['then'](function(_0x575d74){return db['sequelize']['transaction'](function(_0x43565e){return _0x575d74['addTeams'](_0x45e8e5,{'transaction':_0x43565e})[_0x599a('0x19')](function(){return BPromise[_0x599a('0x5a')](_0x5859f3,function(_0x399091){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x399091['id'],'ChatQueueId':_0x16b239[_0x599a('0x29')]['id']},'transaction':_0x43565e});});})[_0x599a('0x19')](function(){_0x5859f3['forEach'](function(_0x137e15){socket[_0x599a('0x5b')]('userChatQueue:save',{'UserId':_0x137e15['id'],'ChatQueueId':_0x575d74['id']});});});});});}})['then'](respondWithStatusCode(_0x9cc376,null))[_0x599a('0x35')](handleError(_0x9cc376,null));};exports[_0x599a('0x5c')]=function(_0x3f8c8b,_0x36a618){return db[_0x599a('0x53')]['findAll']({'where':{'id':_0x3f8c8b['query'][_0x599a('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x599a('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x599a('0x19')](handleEntityNotFound(_0x36a618,null))[_0x599a('0x19')](function(_0x2ae8e5){var _0x44e33f=_['map'](_0x2ae8e5,'id');var _0x267ba0=[];var _0x16be72=[];var _0x54b747=squel[_0x599a('0x5e')]();_0x54b747[_0x599a('0x5f')](_0x599a('0x60'))['from']('team_has_chat_queues','tq')[_0x599a('0x61')](_0x599a('0x62'),'ut',_0x599a('0x63'))[_0x599a('0x48')](_0x599a('0x64'),_0x3f8c8b[_0x599a('0x29')]['id']);for(var _0x43e351=0x0;_0x43e351<_0x2ae8e5[_0x599a('0x30')];_0x43e351+=0x1){let _0x279ea7=_0x2ae8e5[_0x43e351];for(var _0x1526f3=0x0;_0x1526f3<_0x279ea7['Agents'][_0x599a('0x30')];_0x1526f3+=0x1){let _0x4640bf=_0x279ea7[_0x599a('0x55')][_0x1526f3];var _0x1fda42=_0x54b747[_0x599a('0x65')]();_0x1fda42[_0x599a('0x48')]('ut.UserId\x20=\x20?',_0x4640bf['id']);_0x16be72['push'](db[_0x599a('0x66')]['query'](_0x1fda42[_0x599a('0x67')](),{'type':db['sequelize']['QueryTypes'][_0x599a('0x68')]})[_0x599a('0x19')](function(_0x5e5763){if(_0x5e5763[_0x599a('0x30')]===0x1){return _0x4640bf['id'];}else{var _0xc1f102=_['every'](_[_0x599a('0x23')](_0x5e5763,'TeamId'),function(_0x3e7ed0){return _[_0x599a('0x69')](_0x44e33f,_0x3e7ed0);});if(_0xc1f102){return _0x4640bf['id'];}}}));}}return BPromise[_0x599a('0x6a')](_0x16be72)[_0x599a('0x19')](function(_0x2e2639){_0x267ba0=_(_0x267ba0)['union'](_0x2e2639)[_0x599a('0x6b')]()[_0x599a('0x6c')]();return db[_0x599a('0x24')][_0x599a('0x34')]({'where':{'id':_0x3f8c8b[_0x599a('0x29')]['id']}})[_0x599a('0x19')](function(_0x5ed539){return db[_0x599a('0x66')][_0x599a('0x6d')](function(_0x208f3a){return _0x5ed539[_0x599a('0x5c')](_0x3f8c8b[_0x599a('0x28')][_0x599a('0x5d')],{'transaction':_0x208f3a})[_0x599a('0x19')](function(){if(!_[_0x599a('0x6e')](_0x267ba0)){return _0x5ed539[_0x599a('0x6f')](_0x267ba0,{'transaction':_0x208f3a});}})[_0x599a('0x19')](function(){_0x267ba0['forEach'](function(_0x451d5e){socket[_0x599a('0x5b')](_0x599a('0x70'),{'UserId':_0x451d5e,'ChatQueueId':_0x5ed539['id']});});});});});});})['then'](respondWithStatusCode(_0x36a618,null))[_0x599a('0x35')](handleError(_0x36a618,null));};exports[_0x599a('0x71')]=function(_0x17e679,_0x428845){return db[_0x599a('0x24')][_0x599a('0x34')]({'where':{'id':_0x17e679[_0x599a('0x29')]['id']}})['then'](handleEntityNotFound(_0x428845,null))[_0x599a('0x19')](function(_0x1338a0){if(_0x1338a0){return _0x1338a0[_0x599a('0x71')](_0x17e679[_0x599a('0x37')][_0x599a('0x5d')],_[_0x599a('0x72')](_0x17e679[_0x599a('0x37')],['ids','id'])||{})['spread'](function(_0xbdc8cf){for(var _0x38cb84=0x0;_0x38cb84<_0x17e679['body']['ids']['length'];_0x38cb84+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x17e679[_0x599a('0x37')][_0x599a('0x5d')][_0x38cb84]),'ChatQueueId':Number(_0x17e679['params']['id'])});}return _0xbdc8cf;});}})[_0x599a('0x19')](respondWithResult(_0x428845,null))['catch'](handleError(_0x428845,null));};exports[_0x599a('0x6f')]=function(_0x37aebf,_0x2700a8){return db['ChatQueue'][_0x599a('0x34')]({'where':{'id':_0x37aebf[_0x599a('0x29')]['id']}})[_0x599a('0x19')](handleEntityNotFound(_0x2700a8,null))['then'](function(_0x297549){if(_0x297549){return _0x297549[_0x599a('0x6f')](_0x37aebf[_0x599a('0x28')][_0x599a('0x5d')])[_0x599a('0x19')](function(){if(_['isArray'](_0x37aebf[_0x599a('0x28')][_0x599a('0x5d')])){for(var _0xa1cb00=0x0;_0xa1cb00<_0x37aebf[_0x599a('0x28')][_0x599a('0x5d')][_0x599a('0x30')];_0xa1cb00+=0x1){socket[_0x599a('0x5b')](_0x599a('0x70'),{'UserId':Number(_0x37aebf[_0x599a('0x28')][_0x599a('0x5d')][_0xa1cb00]),'ChatQueueId':Number(_0x37aebf[_0x599a('0x29')]['id'])});}}else{socket[_0x599a('0x5b')](_0x599a('0x70'),{'UserId':Number(_0x37aebf[_0x599a('0x28')]['ids']),'ChatQueueId':Number(_0x37aebf[_0x599a('0x29')]['id'])});}});}})[_0x599a('0x19')](respondWithStatusCode(_0x2700a8,null))[_0x599a('0x35')](handleError(_0x2700a8,null));};exports[_0x599a('0x73')]=function(_0x285477,_0x308926){var _0x585867={};var _0x1aa2a9={};var _0xc4ac41;var _0x84fa30;return db['ChatQueue']['findOne']({'where':{'id':_0x285477[_0x599a('0x29')]['id']}})['then'](handleEntityNotFound(_0x308926,null))['then'](function(_0x51fee1){if(_0x51fee1){_0xc4ac41=_0x51fee1;_0x1aa2a9[_0x599a('0x2a')]=_['keys'](db[_0x599a('0x4a')][_0x599a('0x25')]);_0x1aa2a9[_0x599a('0x28')]=_[_0x599a('0x2b')](_0x285477[_0x599a('0x28')]);_0x1aa2a9[_0x599a('0x2c')]=_['intersection'](_0x1aa2a9['model'],_0x1aa2a9[_0x599a('0x28')]);_0x585867[_0x599a('0x2f')]=_['intersection'](_0x1aa2a9[_0x599a('0x2a')],qs[_0x599a('0x2e')](_0x285477[_0x599a('0x28')][_0x599a('0x2e')]));_0x585867[_0x599a('0x2f')]=_0x585867[_0x599a('0x2f')][_0x599a('0x30')]?_0x585867[_0x599a('0x2f')]:_0x1aa2a9['model'];_0x585867[_0x599a('0x44')]=qs[_0x599a('0x45')](_0x285477[_0x599a('0x28')][_0x599a('0x45')]);_0x585867[_0x599a('0x48')]=qs[_0x599a('0x2c')](_[_0x599a('0x46')](_0x285477['query'],_0x1aa2a9[_0x599a('0x2c')]));if(_0x285477['query'][_0x599a('0x74')]){_0x585867['where']=_[_0x599a('0x32')](_0x585867['where'],{'$or':_[_0x599a('0x23')](_0x585867[_0x599a('0x2f')],function(_0x3dd61c){var _0x2f2b8e={};_0x2f2b8e[_0x3dd61c]={'$like':'%'+_0x285477['query'][_0x599a('0x74')]+'%'};return _0x2f2b8e;})});}_0x585867=_[_0x599a('0x32')]({},_0x585867,_0x285477[_0x599a('0x33')]);return _0xc4ac41['getAgents'](_0x585867);}})[_0x599a('0x19')](function(_0x29724a){if(_0x29724a){_0x84fa30=_0x29724a[_0x599a('0x30')];if(!_0x285477['query'][_0x599a('0x75')](_0x599a('0x54'))){_0x585867['limit']=qs[_0x599a('0x14')](_0x285477['query'][_0x599a('0x14')]);_0x585867[_0x599a('0x12')]=qs['offset'](_0x285477['query'][_0x599a('0x12')]);}return _0xc4ac41[_0x599a('0x73')](_0x585867);}})[_0x599a('0x19')](function(_0x3dd45d){if(_0x3dd45d){return _0x3dd45d?{'count':_0x84fa30,'rows':_0x3dd45d}:null;}})[_0x599a('0x19')](respondWithResult(_0x308926,null))[_0x599a('0x35')](handleError(_0x308926,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5e85035..4d75556 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 _0x7d56=['../../mysqldb','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x7d56,0x156));var _0x67d5=function(_0x1ce8ed,_0x3843e9){_0x1ce8ed=_0x1ce8ed-0x0;var _0x33c193=_0x7d56[_0x1ce8ed];return _0x33c193;};'use strict';var EventEmitter=require(_0x67d5('0x0'));var ChatQueue=require(_0x67d5('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x67d5('0x2'),'afterDestroy':_0x67d5('0x3')};function emitEvent(_0x46fb7b){return function(_0x5a57c7,_0x3385a4,_0xd47b5a){ChatQueueEvents[_0x67d5('0x4')](_0x46fb7b+':'+_0x5a57c7['id'],_0x5a57c7);ChatQueueEvents[_0x67d5('0x4')](_0x46fb7b,_0x5a57c7);_0xd47b5a(null);};}for(var e in events){if(events[_0x67d5('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x67d5('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xd1e4=['ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x881659,_0x5b5d3a){var _0x22d605=function(_0x4ff939){while(--_0x4ff939){_0x881659['push'](_0x881659['shift']());}};_0x22d605(++_0x5b5d3a);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd1e4[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require(_0x4d1e('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4d1e('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4d1e('0x2')](0x0);var events={'afterCreate':_0x4d1e('0x3'),'afterUpdate':_0x4d1e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a6acc){return function(_0x288112,_0x288cae,_0x527fdd){ChatQueueEvents[_0x4d1e('0x5')](_0x5a6acc+':'+_0x288112['id'],_0x288112);ChatQueueEvents[_0x4d1e('0x5')](_0x5a6acc,_0x288112);_0x527fdd(null);};}for(var e in events){if(events[_0x4d1e('0x6')](e)){var event=events[e];ChatQueue[_0x4d1e('0x7')](e,emitEvent(event));}}module[_0x4d1e('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1b60e3f..0b80543 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 _0x48d2=['chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x4909cd,_0x5f1c09){var _0x12f93a=function(_0x304425){while(--_0x304425){_0x4909cd['push'](_0x4909cd['shift']());}};_0x12f93a(++_0x5f1c09);}(_0x48d2,0x11e));var _0x248d=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x48d2[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x248d('0x0'));var util=require(_0x248d('0x1'));var logger=require(_0x248d('0x2'))(_0x248d('0x3'));var moment=require(_0x248d('0x4'));var BPromise=require(_0x248d('0x5'));var rp=require(_0x248d('0x6'));var fs=require('fs');var path=require(_0x248d('0x7'));var rimraf=require(_0x248d('0x8'));var config=require(_0x248d('0x9'));var attributes=require(_0x248d('0xa'));module[_0x248d('0xb')]=function(_0x5236cb,_0x3c7fea){return _0x5236cb[_0x248d('0xc')](_0x248d('0xd'),attributes,{'tableName':_0x248d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x939e=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','util','../../config/logger','bluebird','path'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x939e,0xc4));var _0xe939=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x939e[_0x4d8789];return _0x404e41;};'use strict';var _=require('lodash');var util=require(_0xe939('0x0'));var logger=require(_0xe939('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe939('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe939('0x3'));var rimraf=require(_0xe939('0x4'));var config=require(_0xe939('0x5'));var attributes=require(_0xe939('0x6'));module[_0xe939('0x7')]=function(_0x2ff979,_0x4fb83a){return _0x2ff979[_0xe939('0x8')]('ChatQueue',attributes,{'tableName':_0xe939('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 7dcc60e..13399a1 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 _0x5a1c=['raw','where','attributes','limit','include','model','map','ShowChatQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x5dd105,_0x2b0b78){var _0x42a1aa=function(_0x246606){while(--_0x246606){_0x5dd105['push'](_0x5dd105['shift']());}};_0x42a1aa(++_0x2b0b78);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x612267,_0x363a1f){_0x612267=_0x612267-0x0;var _0x46b502=_0x5a1c[_0x612267];return _0x46b502;};'use strict';var _=require(_0xc5a1('0x0'));var util=require(_0xc5a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc5a1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5a1('0x3'))['db'];var utils=require(_0xc5a1('0x4'));var logger=require(_0xc5a1('0x5'))(_0xc5a1('0x6'));var config=require('../../config/environment');var jayson=require(_0xc5a1('0x7'));var client=jayson[_0xc5a1('0x8')][_0xc5a1('0x9')]({'port':0x232a});config['redis']=_[_0xc5a1('0xa')](config[_0xc5a1('0xb')],{'host':_0xc5a1('0xc'),'port':0x18eb});var socket=require(_0xc5a1('0xd'))(new Redis(config[_0xc5a1('0xb')]));require(_0xc5a1('0xe'))[_0xc5a1('0xf')](socket);function respondWithRpcPromise(_0x45c8b8,_0x2fb166,_0x364ef4){return new BPromise(function(_0x363a3e,_0x501d85){return client[_0xc5a1('0x10')](_0x45c8b8,_0x364ef4)[_0xc5a1('0x11')](function(_0x507b2d){logger['info'](_0xc5a1('0x12'),_0x2fb166,'request\x20sent');logger[_0xc5a1('0x13')](_0xc5a1('0x14'),_0x2fb166,_0xc5a1('0x15'),JSON[_0xc5a1('0x16')](_0x507b2d));if(_0x507b2d['error']){if(_0x507b2d[_0xc5a1('0x17')]['code']===0x1f4){logger[_0xc5a1('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2fb166,_0x507b2d[_0xc5a1('0x17')][_0xc5a1('0x18')]);return _0x501d85(_0x507b2d[_0xc5a1('0x17')][_0xc5a1('0x18')]);}logger[_0xc5a1('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2fb166,_0x507b2d[_0xc5a1('0x17')][_0xc5a1('0x18')]);return _0x363a3e(_0x507b2d[_0xc5a1('0x17')][_0xc5a1('0x18')]);}else{logger[_0xc5a1('0x19')](_0xc5a1('0x12'),_0x2fb166,_0xc5a1('0x15'));_0x363a3e(_0x507b2d['result'][_0xc5a1('0x18')]);}})[_0xc5a1('0x1a')](function(_0x3b7e90){logger[_0xc5a1('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2fb166,_0x3b7e90);_0x501d85(_0x3b7e90);});});}exports[_0xc5a1('0x1b')]=function(_0x2d8cc4){var _0x26dca5=this;return new Promise(function(_0x434656,_0x13d8e6){return db[_0xc5a1('0x1c')][_0xc5a1('0x1d')]({'raw':_0x2d8cc4[_0xc5a1('0x1e')]?_0x2d8cc4['options'][_0xc5a1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d8cc4['options']?_0x2d8cc4[_0xc5a1('0x1e')][_0xc5a1('0x20')]||null:null,'attributes':_0x2d8cc4['options']?_0x2d8cc4[_0xc5a1('0x1e')][_0xc5a1('0x21')]||null:null,'limit':_0x2d8cc4['options']?_0x2d8cc4['options'][_0xc5a1('0x22')]||null:null,'include':_0x2d8cc4[_0xc5a1('0x1e')]?_0x2d8cc4['options'][_0xc5a1('0x23')]?_['map'](_0x2d8cc4[_0xc5a1('0x1e')][_0xc5a1('0x23')],function(_0x34de5a){return{'model':db[_0x34de5a[_0xc5a1('0x24')]],'as':_0x34de5a['as'],'attributes':_0x34de5a[_0xc5a1('0x21')],'include':_0x34de5a[_0xc5a1('0x23')]?_[_0xc5a1('0x25')](_0x34de5a[_0xc5a1('0x23')],function(_0xafb20e){return{'model':db[_0xafb20e[_0xc5a1('0x24')]],'as':_0xafb20e['as'],'attributes':_0xafb20e[_0xc5a1('0x21')],'include':_0xafb20e['include']?_[_0xc5a1('0x25')](_0xafb20e[_0xc5a1('0x23')],function(_0x5ea691){return{'model':db[_0x5ea691[_0xc5a1('0x24')]],'as':_0x5ea691['as'],'attributes':_0x5ea691['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5a1('0x11')](function(_0x580488){logger[_0xc5a1('0x19')](_0xc5a1('0x1b'),_0x2d8cc4);logger[_0xc5a1('0x13')](_0xc5a1('0x1b'),_0x2d8cc4,JSON[_0xc5a1('0x16')](_0x580488));_0x434656(_0x580488);})[_0xc5a1('0x1a')](function(_0x5c4ae2){logger[_0xc5a1('0x17')]('GetChatQueue',_0x5c4ae2['message'],_0x2d8cc4);_0x13d8e6(_0x26dca5[_0xc5a1('0x17')](0x1f4,_0x5c4ae2[_0xc5a1('0x18')]));});});};exports[_0xc5a1('0x26')]=function(_0x153ab1){var _0x517200=this;return new Promise(function(_0x371b25,_0x4908c0){return db[_0xc5a1('0x1c')]['find']({'raw':_0x153ab1[_0xc5a1('0x1e')]?_0x153ab1[_0xc5a1('0x1e')][_0xc5a1('0x1f')]===undefined?!![]:![]:!![],'where':_0x153ab1['options']?_0x153ab1[_0xc5a1('0x1e')][_0xc5a1('0x20')]||null:null,'attributes':_0x153ab1[_0xc5a1('0x1e')]?_0x153ab1['options'][_0xc5a1('0x21')]||null:null,'include':_0x153ab1['options']?_0x153ab1[_0xc5a1('0x1e')]['include']?_[_0xc5a1('0x25')](_0x153ab1[_0xc5a1('0x1e')][_0xc5a1('0x23')],function(_0x313959){return{'model':db[_0x313959[_0xc5a1('0x24')]],'as':_0x313959['as'],'attributes':_0x313959[_0xc5a1('0x21')],'include':_0x313959[_0xc5a1('0x23')]?_[_0xc5a1('0x25')](_0x313959['include'],function(_0x57a3a9){return{'model':db[_0x57a3a9[_0xc5a1('0x24')]],'as':_0x57a3a9['as'],'attributes':_0x57a3a9[_0xc5a1('0x21')],'include':_0x57a3a9[_0xc5a1('0x23')]?_[_0xc5a1('0x25')](_0x57a3a9['include'],function(_0x27c25d){return{'model':db[_0x27c25d[_0xc5a1('0x24')]],'as':_0x27c25d['as'],'attributes':_0x27c25d[_0xc5a1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc5a1('0x11')](function(_0x4e3db1){logger['info'](_0xc5a1('0x26'),_0x153ab1);logger['debug']('ShowChatQueue',_0x153ab1,JSON[_0xc5a1('0x16')](_0x4e3db1));_0x371b25(_0x4e3db1);})[_0xc5a1('0x1a')](function(_0x13a63c){logger[_0xc5a1('0x17')](_0xc5a1('0x26'),_0x13a63c[_0xc5a1('0x18')],_0x153ab1);_0x4908c0(_0x517200['error'](0x1f4,_0x13a63c[_0xc5a1('0x18')]));});});}; \ No newline at end of file +var _0x1184=['ChatQueue,\x20%s,\x20%s','message','request\x20sent','catch','ChatQueue','findAll','options','raw','where','attributes','map','include','model','GetChatQueue','ShowChatQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatQueue.socket','then','info','debug','stringify','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1184,0xa0));var _0x4118=function(_0x5b6a55,_0xd81f6b){_0x5b6a55=_0x5b6a55-0x0;var _0x362e73=_0x1184[_0x5b6a55];return _0x362e73;};'use strict';var _=require(_0x4118('0x0'));var util=require('util');var moment=require(_0x4118('0x1'));var BPromise=require(_0x4118('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4118('0x3'));var db=require(_0x4118('0x4'))['db'];var utils=require(_0x4118('0x5'));var logger=require(_0x4118('0x6'))('rpc');var config=require(_0x4118('0x7'));var jayson=require(_0x4118('0x8'));var client=jayson[_0x4118('0x9')][_0x4118('0xa')]({'port':0x232a});config['redis']=_[_0x4118('0xb')](config[_0x4118('0xc')],{'host':_0x4118('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4118('0xe'))['register'](socket);function respondWithRpcPromise(_0x4aa562,_0x27529d,_0x15e4a7){return new BPromise(function(_0x541be4,_0x5cc339){return client['request'](_0x4aa562,_0x15e4a7)[_0x4118('0xf')](function(_0x59a9a6){logger[_0x4118('0x10')]('ChatQueue,\x20%s,\x20%s',_0x27529d,'request\x20sent');logger[_0x4118('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x27529d,'request\x20sent',JSON[_0x4118('0x12')](_0x59a9a6));if(_0x59a9a6[_0x4118('0x13')]){if(_0x59a9a6[_0x4118('0x13')]['code']===0x1f4){logger[_0x4118('0x13')](_0x4118('0x14'),_0x27529d,_0x59a9a6[_0x4118('0x13')]['message']);return _0x5cc339(_0x59a9a6[_0x4118('0x13')]['message']);}logger[_0x4118('0x13')](_0x4118('0x14'),_0x27529d,_0x59a9a6[_0x4118('0x13')]['message']);return _0x541be4(_0x59a9a6[_0x4118('0x13')][_0x4118('0x15')]);}else{logger[_0x4118('0x10')](_0x4118('0x14'),_0x27529d,_0x4118('0x16'));_0x541be4(_0x59a9a6['result'][_0x4118('0x15')]);}})[_0x4118('0x17')](function(_0x310afc){logger[_0x4118('0x13')](_0x4118('0x14'),_0x27529d,_0x310afc);_0x5cc339(_0x310afc);});});}exports['GetChatQueue']=function(_0x255e11){var _0x375741=this;return new Promise(function(_0x2b2894,_0x545bc9){return db[_0x4118('0x18')][_0x4118('0x19')]({'raw':_0x255e11[_0x4118('0x1a')]?_0x255e11[_0x4118('0x1a')][_0x4118('0x1b')]===undefined?!![]:![]:!![],'where':_0x255e11[_0x4118('0x1a')]?_0x255e11['options'][_0x4118('0x1c')]||null:null,'attributes':_0x255e11[_0x4118('0x1a')]?_0x255e11[_0x4118('0x1a')][_0x4118('0x1d')]||null:null,'limit':_0x255e11[_0x4118('0x1a')]?_0x255e11['options']['limit']||null:null,'include':_0x255e11['options']?_0x255e11['options']['include']?_[_0x4118('0x1e')](_0x255e11[_0x4118('0x1a')][_0x4118('0x1f')],function(_0x5f819a){return{'model':db[_0x5f819a['model']],'as':_0x5f819a['as'],'attributes':_0x5f819a[_0x4118('0x1d')],'include':_0x5f819a['include']?_[_0x4118('0x1e')](_0x5f819a[_0x4118('0x1f')],function(_0x8e261e){return{'model':db[_0x8e261e[_0x4118('0x20')]],'as':_0x8e261e['as'],'attributes':_0x8e261e[_0x4118('0x1d')],'include':_0x8e261e[_0x4118('0x1f')]?_['map'](_0x8e261e[_0x4118('0x1f')],function(_0x170a67){return{'model':db[_0x170a67[_0x4118('0x20')]],'as':_0x170a67['as'],'attributes':_0x170a67[_0x4118('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49fee6){logger[_0x4118('0x10')](_0x4118('0x21'),_0x255e11);logger[_0x4118('0x11')](_0x4118('0x21'),_0x255e11,JSON[_0x4118('0x12')](_0x49fee6));_0x2b2894(_0x49fee6);})['catch'](function(_0x5f115e){logger[_0x4118('0x13')](_0x4118('0x21'),_0x5f115e[_0x4118('0x15')],_0x255e11);_0x545bc9(_0x375741[_0x4118('0x13')](0x1f4,_0x5f115e[_0x4118('0x15')]));});});};exports[_0x4118('0x22')]=function(_0x194dfa){var _0x1999c0=this;return new Promise(function(_0x2ccc27,_0x3d39ec){return db[_0x4118('0x18')][_0x4118('0x23')]({'raw':_0x194dfa[_0x4118('0x1a')]?_0x194dfa[_0x4118('0x1a')][_0x4118('0x1b')]===undefined?!![]:![]:!![],'where':_0x194dfa[_0x4118('0x1a')]?_0x194dfa[_0x4118('0x1a')][_0x4118('0x1c')]||null:null,'attributes':_0x194dfa[_0x4118('0x1a')]?_0x194dfa['options'][_0x4118('0x1d')]||null:null,'include':_0x194dfa[_0x4118('0x1a')]?_0x194dfa[_0x4118('0x1a')][_0x4118('0x1f')]?_[_0x4118('0x1e')](_0x194dfa[_0x4118('0x1a')]['include'],function(_0x42d35e){return{'model':db[_0x42d35e['model']],'as':_0x42d35e['as'],'attributes':_0x42d35e['attributes'],'include':_0x42d35e[_0x4118('0x1f')]?_[_0x4118('0x1e')](_0x42d35e['include'],function(_0x458dd5){return{'model':db[_0x458dd5[_0x4118('0x20')]],'as':_0x458dd5['as'],'attributes':_0x458dd5[_0x4118('0x1d')],'include':_0x458dd5['include']?_[_0x4118('0x1e')](_0x458dd5[_0x4118('0x1f')],function(_0x3ad64d){return{'model':db[_0x3ad64d['model']],'as':_0x3ad64d['as'],'attributes':_0x3ad64d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4118('0xf')](function(_0x33412d){logger[_0x4118('0x10')](_0x4118('0x22'),_0x194dfa);logger[_0x4118('0x11')](_0x4118('0x22'),_0x194dfa,JSON['stringify'](_0x33412d));_0x2ccc27(_0x33412d);})[_0x4118('0x17')](function(_0x493f7d){logger['error'](_0x4118('0x22'),_0x493f7d['message'],_0x194dfa);_0x3d39ec(_0x1999c0[_0x4118('0x13')](0x1f4,_0x493f7d[_0x4118('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5f46571..b81fc34 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x72b1,0x16e));var _0x172b=function(_0x1df383,_0x71e83){_0x1df383=_0x1df383-0x0;var _0x54de6a=_0x72b1[_0x1df383];return _0x54de6a;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0x4c6d=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update'];(function(_0x4cb7a6,_0x32c7ae){var _0xbec3ee=function(_0x501674){while(--_0x501674){_0x4cb7a6['push'](_0x4cb7a6['shift']());}};_0xbec3ee(++_0x32c7ae);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2f1402,_0x2cbf98){_0x2f1402=_0x2f1402-0x0;var _0x360cbe=_0x4c6d[_0x2f1402];return _0x360cbe;};'use strict';var ChatQueueEvents=require(_0xd4c6('0x0'));var events=[_0xd4c6('0x1'),_0xd4c6('0x2'),_0xd4c6('0x3')];function createListener(_0x350cc0,_0x5448bc){return function(_0x209f99){_0x5448bc[_0xd4c6('0x4')](_0x350cc0,_0x209f99);};}function removeListener(_0x306766,_0x4b2d75){return function(){ChatQueueEvents[_0xd4c6('0x5')](_0x306766,_0x4b2d75);};}exports[_0xd4c6('0x6')]=function(_0x56279c){for(var _0x182671=0x0,_0x316314=events[_0xd4c6('0x7')];_0x182671<_0x316314;_0x182671++){var _0x5d4fce=events[_0x182671];var _0x440ee3=createListener(_0xd4c6('0x8')+_0x5d4fce,_0x56279c);ChatQueueEvents['on'](_0x5d4fce,_0x440ee3);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b33a6b8..4b0fb08 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(_0x3e9eb2,_0x300701){var _0x1b03ba=function(_0x25bdde){while(--_0x25bdde){_0x3e9eb2['push'](_0x3e9eb2['shift']());}};_0x1b03ba(++_0x300701);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'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(_0x3247c7,_0x164d1d){var _0x454622=function(_0x13d14c){while(--_0x13d14c){_0x3247c7['push'](_0x3247c7['shift']());}};_0x454622(++_0x164d1d);}(_0x814b,0x1a2));var _0xb814=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0x814b[_0x7767c3];return _0x1f22a1;};'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 4098623..8096933 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 _0x41e0=['moment','sequelize','exports','STRING','DATE'];(function(_0x27ddfb,_0x2ae31f){var _0x3a3efd=function(_0x5c5385){while(--_0x5c5385){_0x27ddfb['push'](_0x27ddfb['shift']());}};_0x3a3efd(++_0x2ae31f);}(_0x41e0,0x69));var _0x041e=function(_0x414cec,_0x3b0bd8){_0x414cec=_0x414cec-0x0;var _0x457fca=_0x41e0[_0x414cec];return _0x457fca;};'use strict';var moment=require(_0x041e('0x0'));var Sequelize=require(_0x041e('0x1'));module[_0x041e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x041e('0x3')]},'joinAt':{'type':Sequelize[_0x041e('0x4')]},'leaveAt':{'type':Sequelize[_0x041e('0x4')]},'acceptAt':{'type':Sequelize[_0x041e('0x4')]},'exitAt':{'type':Sequelize[_0x041e('0x4')]},'reason':{'type':Sequelize[_0x041e('0x3')]}}; \ No newline at end of file +var _0xa388=['DATE','moment','sequelize','STRING'];(function(_0xdbfe3,_0x4ebddd){var _0x3454b0=function(_0x5a2487){while(--_0x5a2487){_0xdbfe3['push'](_0xdbfe3['shift']());}};_0x3454b0(++_0x4ebddd);}(_0xa388,0x189));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8a38('0x0'));var Sequelize=require(_0x8a38('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8a38('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8a38('0x3')]},'acceptAt':{'type':Sequelize[_0x8a38('0x3')]},'exitAt':{'type':Sequelize[_0x8a38('0x3')]},'reason':{'type':Sequelize[_0x8a38('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9facdf2..7e3f7c4 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 _0x8fd4=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','ChatQueueReport','include','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x595c1d,_0x48e097){var _0x4c65b9=function(_0x45db78){while(--_0x45db78){_0x595c1d['push'](_0x595c1d['shift']());}};_0x4c65b9(++_0x48e097);}(_0x8fd4,0x178));var _0x48fd=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8fd4[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48fd('0x0'));var zipdir=require(_0x48fd('0x1'));var jsonpatch=require(_0x48fd('0x2'));var rp=require(_0x48fd('0x3'));var moment=require(_0x48fd('0x4'));var BPromise=require(_0x48fd('0x5'));var Mustache=require(_0x48fd('0x6'));var util=require('util');var path=require(_0x48fd('0x7'));var sox=require(_0x48fd('0x8'));var csv=require('to-csv');var ejs=require(_0x48fd('0x9'));var fs=require('fs');var fs_extra=require(_0x48fd('0xa'));var _=require(_0x48fd('0xb'));var squel=require(_0x48fd('0xc'));var crypto=require(_0x48fd('0xd'));var jsforce=require(_0x48fd('0xe'));var deskjs=require(_0x48fd('0xf'));var toCsv=require(_0x48fd('0x10'));var querystring=require(_0x48fd('0x11'));var Papa=require(_0x48fd('0x12'));var Redis=require(_0x48fd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x48fd('0x14'));var as=require(_0x48fd('0x15'));var hardwareService=require(_0x48fd('0x16'));var logger=require(_0x48fd('0x17'))(_0x48fd('0x18'));var utils=require(_0x48fd('0x19'));var config=require(_0x48fd('0x1a'));var licenseUtil=require(_0x48fd('0x1b'));var db=require(_0x48fd('0x1c'))['db'];function respondWithStatusCode(_0x43508f,_0x48b65d){_0x48b65d=_0x48b65d||0xcc;return function(_0x39f6cb){if(_0x39f6cb){return _0x43508f[_0x48fd('0x1d')](_0x48b65d);}return _0x43508f[_0x48fd('0x1e')](_0x48b65d)[_0x48fd('0x1f')]();};}function respondWithResult(_0x349483,_0x33ad2f){_0x33ad2f=_0x33ad2f||0xc8;return function(_0x3df49b){if(_0x3df49b){return _0x349483[_0x48fd('0x1e')](_0x33ad2f)[_0x48fd('0x20')](_0x3df49b);}};}function respondWithFilteredResult(_0x2b0cdf,_0x52ce33){return function(_0x5a0abe){if(_0x5a0abe){var _0x4d0040=typeof _0x52ce33[_0x48fd('0x21')]===_0x48fd('0x22')&&typeof _0x52ce33[_0x48fd('0x23')]===_0x48fd('0x22');var _0x1e515a=_0x5a0abe[_0x48fd('0x24')];var _0x476fb0=_0x4d0040?0x0:_0x52ce33[_0x48fd('0x21')];var _0x18fc29=_0x4d0040?_0x5a0abe[_0x48fd('0x24')]:_0x52ce33[_0x48fd('0x21')]+_0x52ce33[_0x48fd('0x23')];var _0x1a34c2;if(_0x18fc29>=_0x1e515a){_0x18fc29=_0x1e515a;_0x1a34c2=0xc8;}else{_0x1a34c2=0xce;}_0x2b0cdf[_0x48fd('0x1e')](_0x1a34c2);return _0x2b0cdf[_0x48fd('0x25')](_0x48fd('0x26'),_0x476fb0+'-'+_0x18fc29+'/'+_0x1e515a)['json'](_0x5a0abe);}return null;};}function patchUpdates(_0x708152){return function(_0x55968f){try{jsonpatch[_0x48fd('0x27')](_0x55968f,_0x708152,!![]);}catch(_0x26175e){return BPromise[_0x48fd('0x28')](_0x26175e);}return _0x55968f[_0x48fd('0x29')]();};}function saveUpdates(_0x36740a,_0x23abc0){return function(_0x5e0d8b){if(_0x5e0d8b){return _0x5e0d8b[_0x48fd('0x2a')](_0x36740a)[_0x48fd('0x2b')](function(_0x2ca93b){return _0x2ca93b;});}return null;};}function removeEntity(_0x2a4860,_0x44bbb3){return function(_0x270364){if(_0x270364){return _0x270364[_0x48fd('0x2c')]()['then'](function(){_0x2a4860['status'](0xcc)[_0x48fd('0x1f')]();});}};}function handleEntityNotFound(_0x2e3d6c,_0x1bf56c){return function(_0x17a654){if(!_0x17a654){_0x2e3d6c[_0x48fd('0x1d')](0x194);}return _0x17a654;};}function handleError(_0x4f3b1b,_0x513a5a){_0x513a5a=_0x513a5a||0x1f4;return function(_0x5e3947){logger[_0x48fd('0x2d')](_0x5e3947[_0x48fd('0x2e')]);if(_0x5e3947[_0x48fd('0x2f')]){delete _0x5e3947[_0x48fd('0x2f')];}_0x4f3b1b[_0x48fd('0x1e')](_0x513a5a)[_0x48fd('0x30')](_0x5e3947);};}exports['index']=function(_0xe8e4e9,_0x415979){var _0x3b9ba8={},_0x5b16d0={},_0x143e87={'count':0x0,'rows':[]};var _0x3149cc=_[_0x48fd('0x31')](db['ChatQueueReport'][_0x48fd('0x32')],function(_0x14f560){return{'name':_0x14f560[_0x48fd('0x33')],'type':_0x14f560[_0x48fd('0x34')][_0x48fd('0x35')]};});_0x5b16d0[_0x48fd('0x36')]=_[_0x48fd('0x31')](_0x3149cc,_0x48fd('0x2f'));_0x5b16d0[_0x48fd('0x37')]=_[_0x48fd('0x38')](_0xe8e4e9[_0x48fd('0x37')]);_0x5b16d0[_0x48fd('0x39')]=_[_0x48fd('0x3a')](_0x5b16d0[_0x48fd('0x36')],_0x5b16d0[_0x48fd('0x37')]);_0x3b9ba8['attributes']=_['intersection'](_0x5b16d0[_0x48fd('0x36')],qs[_0x48fd('0x3b')](_0xe8e4e9[_0x48fd('0x37')][_0x48fd('0x3b')]));_0x3b9ba8[_0x48fd('0x3c')]=_0x3b9ba8[_0x48fd('0x3c')][_0x48fd('0x3d')]?_0x3b9ba8[_0x48fd('0x3c')]:_0x5b16d0['model'];if(!_0xe8e4e9[_0x48fd('0x37')][_0x48fd('0x3e')](_0x48fd('0x3f'))){_0x3b9ba8[_0x48fd('0x23')]=qs[_0x48fd('0x23')](_0xe8e4e9[_0x48fd('0x37')][_0x48fd('0x23')]);_0x3b9ba8[_0x48fd('0x21')]=qs[_0x48fd('0x21')](_0xe8e4e9['query']['offset']);}_0x3b9ba8[_0x48fd('0x40')]=qs[_0x48fd('0x41')](_0xe8e4e9[_0x48fd('0x37')]['sort']);_0x3b9ba8[_0x48fd('0x42')]=qs[_0x48fd('0x39')](_['pick'](_0xe8e4e9['query'],_0x5b16d0[_0x48fd('0x39')]),_0x3149cc);if(_0xe8e4e9['query']['filter']){_0x3b9ba8[_0x48fd('0x42')]=_['merge'](_0x3b9ba8['where'],{'$or':_[_0x48fd('0x31')](_0x3149cc,function(_0x47aeae){if(_0x47aeae[_0x48fd('0x34')]!=='VIRTUAL'){var _0x13f11d={};_0x13f11d[_0x47aeae[_0x48fd('0x2f')]]={'$like':'%'+_0xe8e4e9[_0x48fd('0x37')]['filter']+'%'};return _0x13f11d;}})});}_0x3b9ba8=_[_0x48fd('0x43')]({},_0x3b9ba8,_0xe8e4e9['options']);var _0x241241={'where':_0x3b9ba8[_0x48fd('0x42')]};return db[_0x48fd('0x44')][_0x48fd('0x24')](_0x241241)[_0x48fd('0x2b')](function(_0x382e3d){_0x143e87[_0x48fd('0x24')]=_0x382e3d;if(_0xe8e4e9[_0x48fd('0x37')]['includeAll']){_0x3b9ba8[_0x48fd('0x45')]=[{'all':!![]}];}return db[_0x48fd('0x44')]['findAll'](_0x3b9ba8);})[_0x48fd('0x2b')](function(_0x2e451f){_0x143e87['rows']=_0x2e451f;return _0x143e87;})[_0x48fd('0x2b')](respondWithFilteredResult(_0x415979,_0x3b9ba8))[_0x48fd('0x46')](handleError(_0x415979,null));};exports[_0x48fd('0x47')]=function(_0x12f002,_0x510141){var _0x2a66f5={'raw':!![],'where':{'id':_0x12f002[_0x48fd('0x48')]['id']}},_0x349b5c={};_0x349b5c[_0x48fd('0x36')]=_[_0x48fd('0x38')](db['ChatQueueReport'][_0x48fd('0x32')]);_0x349b5c[_0x48fd('0x37')]=_['keys'](_0x12f002['query']);_0x349b5c[_0x48fd('0x39')]=_[_0x48fd('0x3a')](_0x349b5c[_0x48fd('0x36')],_0x349b5c['query']);_0x2a66f5[_0x48fd('0x3c')]=_[_0x48fd('0x3a')](_0x349b5c[_0x48fd('0x36')],qs[_0x48fd('0x3b')](_0x12f002[_0x48fd('0x37')]['fields']));_0x2a66f5['attributes']=_0x2a66f5[_0x48fd('0x3c')]['length']?_0x2a66f5[_0x48fd('0x3c')]:_0x349b5c[_0x48fd('0x36')];if(_0x12f002['query']['includeAll']){_0x2a66f5[_0x48fd('0x45')]=[{'all':!![]}];}_0x2a66f5=_[_0x48fd('0x43')]({},_0x2a66f5,_0x12f002['options']);return db[_0x48fd('0x44')][_0x48fd('0x49')](_0x2a66f5)[_0x48fd('0x2b')](handleEntityNotFound(_0x510141,null))[_0x48fd('0x2b')](respondWithResult(_0x510141,null))['catch'](handleError(_0x510141,null));};exports[_0x48fd('0x4a')]=function(_0x270b2c,_0x136ff3){return db[_0x48fd('0x44')][_0x48fd('0x4a')](_0x270b2c[_0x48fd('0x4b')],{})[_0x48fd('0x2b')](respondWithResult(_0x136ff3,0xc9))[_0x48fd('0x46')](handleError(_0x136ff3,null));};exports[_0x48fd('0x2a')]=function(_0x1ce2d9,_0x4cfc52){if(_0x1ce2d9[_0x48fd('0x4b')]['id']){delete _0x1ce2d9[_0x48fd('0x4b')]['id'];}return db[_0x48fd('0x44')][_0x48fd('0x49')]({'where':{'id':_0x1ce2d9[_0x48fd('0x48')]['id']}})[_0x48fd('0x2b')](handleEntityNotFound(_0x4cfc52,null))[_0x48fd('0x2b')](saveUpdates(_0x1ce2d9[_0x48fd('0x4b')],null))[_0x48fd('0x2b')](respondWithResult(_0x4cfc52,null))['catch'](handleError(_0x4cfc52,null));};exports[_0x48fd('0x2c')]=function(_0x3fe24b,_0x244ab5){return db[_0x48fd('0x44')][_0x48fd('0x49')]({'where':{'id':_0x3fe24b[_0x48fd('0x48')]['id']}})[_0x48fd('0x2b')](handleEntityNotFound(_0x244ab5,null))[_0x48fd('0x2b')](removeEntity(_0x244ab5,null))['catch'](handleError(_0x244ab5,null));};exports[_0x48fd('0x4c')]=function(_0x2b0122,_0x16fb64){return db[_0x48fd('0x44')][_0x48fd('0x4c')]()[_0x48fd('0x2b')](respondWithResult(_0x16fb64,null))[_0x48fd('0x46')](handleError(_0x16fb64,null));}; \ No newline at end of file +var _0xab00=['body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab00,0x1b9));var _0x0ab0=function(_0x53f208,_0x1fdcc7){_0x53f208=_0x53f208-0x0;var _0x14059e=_0xab00[_0x53f208];return _0x14059e;};'use strict';var emlformat=require(_0x0ab0('0x0'));var rimraf=require(_0x0ab0('0x1'));var zipdir=require(_0x0ab0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab0('0x3'));var moment=require(_0x0ab0('0x4'));var BPromise=require(_0x0ab0('0x5'));var Mustache=require('mustache');var util=require(_0x0ab0('0x6'));var path=require('path');var sox=require(_0x0ab0('0x7'));var csv=require(_0x0ab0('0x8'));var ejs=require(_0x0ab0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ab0('0xa'));var _=require(_0x0ab0('0xb'));var squel=require(_0x0ab0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0ab0('0xd'));var deskjs=require(_0x0ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ab0('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ab0('0x10'));var authService=require(_0x0ab0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ab0('0x12'));var utils=require('../../config/utils');var config=require(_0x0ab0('0x13'));var licenseUtil=require(_0x0ab0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bf478,_0xfa9b2c){_0xfa9b2c=_0xfa9b2c||0xcc;return function(_0x332370){if(_0x332370){return _0x2bf478[_0x0ab0('0x15')](_0xfa9b2c);}return _0x2bf478[_0x0ab0('0x16')](_0xfa9b2c)[_0x0ab0('0x17')]();};}function respondWithResult(_0x906db9,_0x297262){_0x297262=_0x297262||0xc8;return function(_0x2dfcd3){if(_0x2dfcd3){return _0x906db9[_0x0ab0('0x16')](_0x297262)[_0x0ab0('0x18')](_0x2dfcd3);}};}function respondWithFilteredResult(_0x3c39b6,_0x55a322){return function(_0x5cf1cd){if(_0x5cf1cd){var _0x5f4a41=typeof _0x55a322[_0x0ab0('0x19')]===_0x0ab0('0x1a')&&typeof _0x55a322[_0x0ab0('0x1b')]==='undefined';var _0x49df08=_0x5cf1cd['count'];var _0x5b3bef=_0x5f4a41?0x0:_0x55a322['offset'];var _0x171341=_0x5f4a41?_0x5cf1cd[_0x0ab0('0x1c')]:_0x55a322[_0x0ab0('0x19')]+_0x55a322[_0x0ab0('0x1b')];var _0x454eb3;if(_0x171341>=_0x49df08){_0x171341=_0x49df08;_0x454eb3=0xc8;}else{_0x454eb3=0xce;}_0x3c39b6[_0x0ab0('0x16')](_0x454eb3);return _0x3c39b6[_0x0ab0('0x1d')]('Content-Range',_0x5b3bef+'-'+_0x171341+'/'+_0x49df08)['json'](_0x5cf1cd);}return null;};}function patchUpdates(_0x2cda33){return function(_0x1a87a2){try{jsonpatch[_0x0ab0('0x1e')](_0x1a87a2,_0x2cda33,!![]);}catch(_0x5c3382){return BPromise[_0x0ab0('0x1f')](_0x5c3382);}return _0x1a87a2['save']();};}function saveUpdates(_0x2691c7,_0x2ccb3e){return function(_0x20cd95){if(_0x20cd95){return _0x20cd95[_0x0ab0('0x20')](_0x2691c7)[_0x0ab0('0x21')](function(_0xc51b90){return _0xc51b90;});}return null;};}function removeEntity(_0x1bec79,_0x5795f0){return function(_0x2a4629){if(_0x2a4629){return _0x2a4629[_0x0ab0('0x22')]()[_0x0ab0('0x21')](function(){_0x1bec79['status'](0xcc)[_0x0ab0('0x17')]();});}};}function handleEntityNotFound(_0xd7c564,_0x3e9afd){return function(_0x5add07){if(!_0x5add07){_0xd7c564[_0x0ab0('0x15')](0x194);}return _0x5add07;};}function handleError(_0x34c9e6,_0x113386){_0x113386=_0x113386||0x1f4;return function(_0x2a4f7c){logger[_0x0ab0('0x23')](_0x2a4f7c['stack']);if(_0x2a4f7c[_0x0ab0('0x24')]){delete _0x2a4f7c['name'];}_0x34c9e6[_0x0ab0('0x16')](_0x113386)[_0x0ab0('0x25')](_0x2a4f7c);};}exports[_0x0ab0('0x26')]=function(_0x29e200,_0x5ae993){var _0x4764fc={},_0x5e7e2b={},_0x2c29c0={'count':0x0,'rows':[]};var _0x34f67e=_[_0x0ab0('0x27')](db[_0x0ab0('0x28')][_0x0ab0('0x29')],function(_0xa9cb4f){return{'name':_0xa9cb4f[_0x0ab0('0x2a')],'type':_0xa9cb4f[_0x0ab0('0x2b')][_0x0ab0('0x2c')]};});_0x5e7e2b[_0x0ab0('0x2d')]=_[_0x0ab0('0x27')](_0x34f67e,_0x0ab0('0x24'));_0x5e7e2b['query']=_[_0x0ab0('0x2e')](_0x29e200[_0x0ab0('0x2f')]);_0x5e7e2b[_0x0ab0('0x30')]=_[_0x0ab0('0x31')](_0x5e7e2b[_0x0ab0('0x2d')],_0x5e7e2b[_0x0ab0('0x2f')]);_0x4764fc['attributes']=_['intersection'](_0x5e7e2b[_0x0ab0('0x2d')],qs[_0x0ab0('0x32')](_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x32')]));_0x4764fc[_0x0ab0('0x33')]=_0x4764fc[_0x0ab0('0x33')][_0x0ab0('0x34')]?_0x4764fc['attributes']:_0x5e7e2b[_0x0ab0('0x2d')];if(!_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x35')](_0x0ab0('0x36'))){_0x4764fc['limit']=qs[_0x0ab0('0x1b')](_0x29e200['query'][_0x0ab0('0x1b')]);_0x4764fc['offset']=qs['offset'](_0x29e200[_0x0ab0('0x2f')]['offset']);}_0x4764fc[_0x0ab0('0x37')]=qs[_0x0ab0('0x38')](_0x29e200[_0x0ab0('0x2f')][_0x0ab0('0x38')]);_0x4764fc[_0x0ab0('0x39')]=qs[_0x0ab0('0x30')](_[_0x0ab0('0x3a')](_0x29e200['query'],_0x5e7e2b['filters']),_0x34f67e);if(_0x29e200['query'][_0x0ab0('0x3b')]){_0x4764fc[_0x0ab0('0x39')]=_[_0x0ab0('0x3c')](_0x4764fc['where'],{'$or':_['map'](_0x34f67e,function(_0x7585c4){if(_0x7585c4[_0x0ab0('0x2b')]!==_0x0ab0('0x3d')){var _0x1438ff={};_0x1438ff[_0x7585c4[_0x0ab0('0x24')]]={'$like':'%'+_0x29e200[_0x0ab0('0x2f')]['filter']+'%'};return _0x1438ff;}})});}_0x4764fc=_[_0x0ab0('0x3c')]({},_0x4764fc,_0x29e200['options']);var _0x542c44={'where':_0x4764fc[_0x0ab0('0x39')]};return db['ChatQueueReport'][_0x0ab0('0x1c')](_0x542c44)[_0x0ab0('0x21')](function(_0x5be95a){_0x2c29c0['count']=_0x5be95a;if(_0x29e200['query'][_0x0ab0('0x3e')]){_0x4764fc[_0x0ab0('0x3f')]=[{'all':!![]}];}return db[_0x0ab0('0x28')]['findAll'](_0x4764fc);})[_0x0ab0('0x21')](function(_0x3db8a6){_0x2c29c0[_0x0ab0('0x40')]=_0x3db8a6;return _0x2c29c0;})['then'](respondWithFilteredResult(_0x5ae993,_0x4764fc))[_0x0ab0('0x41')](handleError(_0x5ae993,null));};exports[_0x0ab0('0x42')]=function(_0x3b30e8,_0x1e21f2){var _0x18b5f5={'raw':!![],'where':{'id':_0x3b30e8['params']['id']}},_0x51cf3f={};_0x51cf3f[_0x0ab0('0x2d')]=_[_0x0ab0('0x2e')](db[_0x0ab0('0x28')][_0x0ab0('0x29')]);_0x51cf3f[_0x0ab0('0x2f')]=_[_0x0ab0('0x2e')](_0x3b30e8['query']);_0x51cf3f[_0x0ab0('0x30')]=_[_0x0ab0('0x31')](_0x51cf3f[_0x0ab0('0x2d')],_0x51cf3f[_0x0ab0('0x2f')]);_0x18b5f5['attributes']=_['intersection'](_0x51cf3f[_0x0ab0('0x2d')],qs[_0x0ab0('0x32')](_0x3b30e8[_0x0ab0('0x2f')][_0x0ab0('0x32')]));_0x18b5f5[_0x0ab0('0x33')]=_0x18b5f5[_0x0ab0('0x33')][_0x0ab0('0x34')]?_0x18b5f5['attributes']:_0x51cf3f['model'];if(_0x3b30e8['query'][_0x0ab0('0x3e')]){_0x18b5f5[_0x0ab0('0x3f')]=[{'all':!![]}];}_0x18b5f5=_[_0x0ab0('0x3c')]({},_0x18b5f5,_0x3b30e8[_0x0ab0('0x43')]);return db[_0x0ab0('0x28')][_0x0ab0('0x44')](_0x18b5f5)[_0x0ab0('0x21')](handleEntityNotFound(_0x1e21f2,null))['then'](respondWithResult(_0x1e21f2,null))[_0x0ab0('0x41')](handleError(_0x1e21f2,null));};exports[_0x0ab0('0x45')]=function(_0x39519e,_0x30d400){return db[_0x0ab0('0x28')][_0x0ab0('0x45')](_0x39519e[_0x0ab0('0x46')],{})[_0x0ab0('0x21')](respondWithResult(_0x30d400,0xc9))['catch'](handleError(_0x30d400,null));};exports['update']=function(_0x37e688,_0x318301){if(_0x37e688[_0x0ab0('0x46')]['id']){delete _0x37e688[_0x0ab0('0x46')]['id'];}return db[_0x0ab0('0x28')][_0x0ab0('0x44')]({'where':{'id':_0x37e688['params']['id']}})[_0x0ab0('0x21')](handleEntityNotFound(_0x318301,null))[_0x0ab0('0x21')](saveUpdates(_0x37e688[_0x0ab0('0x46')],null))[_0x0ab0('0x21')](respondWithResult(_0x318301,null))[_0x0ab0('0x41')](handleError(_0x318301,null));};exports[_0x0ab0('0x22')]=function(_0x35f269,_0xcd971a){return db[_0x0ab0('0x28')][_0x0ab0('0x44')]({'where':{'id':_0x35f269[_0x0ab0('0x47')]['id']}})[_0x0ab0('0x21')](handleEntityNotFound(_0xcd971a,null))[_0x0ab0('0x21')](removeEntity(_0xcd971a,null))[_0x0ab0('0x41')](handleError(_0xcd971a,null));};exports[_0x0ab0('0x48')]=function(_0x571ded,_0x5d4019){return db['ChatQueueReport'][_0x0ab0('0x48')]()[_0x0ab0('0x21')](respondWithResult(_0x5d4019,null))['catch'](handleError(_0x5d4019,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fff72a3..29c4372 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2ea20d,_0x5e8e3c){var _0x3ba66a=function(_0x164ca6){while(--_0x164ca6){_0x2ea20d['push'](_0x2ea20d['shift']());}};_0x3ba66a(++_0x5e8e3c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b7ffe,_0x3129be){_0x2b7ffe=_0x2b7ffe-0x0;var _0x1a009a=_0xb10b[_0x2b7ffe];return _0x1a009a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x1c3331,_0x49ecd7){var _0x4a2b9f=function(_0x3e2c70){while(--_0x3e2c70){_0x1c3331['push'](_0x1c3331['shift']());}};_0x4a2b9f(++_0x49ecd7);}(_0xe706,0xa3));var _0x6e70=function(_0x62acd5,_0x4ddb49){_0x62acd5=_0x62acd5-0x0;var _0x227ab4=_0xe706[_0x62acd5];return _0x227ab4;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3588514..37fad95 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 _0x64e5=['ChatQueueReport','create','options','raw','stringify','UpdateChatQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport'];(function(_0x4bf591,_0x48b450){var _0x18f0df=function(_0x4754ea){while(--_0x4754ea){_0x4bf591['push'](_0x4bf591['shift']());}};_0x18f0df(++_0x48b450);}(_0x64e5,0x10a));var _0x564e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x64e5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x564e('0x0'));var util=require(_0x564e('0x1'));var moment=require(_0x564e('0x2'));var BPromise=require(_0x564e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x564e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x564e('0x5'));var config=require(_0x564e('0x6'));var jayson=require(_0x564e('0x7'));var client=jayson[_0x564e('0x8')][_0x564e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aec24,_0x144be8,_0x4a04e6){return new BPromise(function(_0x1b051b,_0x2a6d74){return client[_0x564e('0xa')](_0x1aec24,_0x4a04e6)[_0x564e('0xb')](function(_0x25b289){logger[_0x564e('0xc')](_0x564e('0xd'),_0x144be8,_0x564e('0xe'));logger[_0x564e('0xf')](_0x564e('0x10'),_0x144be8,_0x564e('0xe'),JSON['stringify'](_0x25b289));if(_0x25b289[_0x564e('0x11')]){if(_0x25b289[_0x564e('0x11')]['code']===0x1f4){logger['error'](_0x564e('0xd'),_0x144be8,_0x25b289[_0x564e('0x11')][_0x564e('0x12')]);return _0x2a6d74(_0x25b289[_0x564e('0x11')][_0x564e('0x12')]);}logger[_0x564e('0x11')](_0x564e('0xd'),_0x144be8,_0x25b289['error']['message']);return _0x1b051b(_0x25b289[_0x564e('0x11')][_0x564e('0x12')]);}else{logger[_0x564e('0xc')](_0x564e('0xd'),_0x144be8,_0x564e('0xe'));_0x1b051b(_0x25b289[_0x564e('0x13')][_0x564e('0x12')]);}})[_0x564e('0x14')](function(_0x20aacf){logger[_0x564e('0x11')](_0x564e('0xd'),_0x144be8,_0x20aacf);_0x2a6d74(_0x20aacf);});});}exports[_0x564e('0x15')]=function(_0x431dcf){var _0x1b2486=this;return new Promise(function(_0x5141cb,_0x17c43e){return db[_0x564e('0x16')][_0x564e('0x17')](_0x431dcf['body'],{'raw':_0x431dcf[_0x564e('0x18')]?_0x431dcf['options'][_0x564e('0x19')]===undefined?!![]:![]:!![]})[_0x564e('0xb')](function(_0x33e75c){logger[_0x564e('0xc')](_0x564e('0x15'),_0x431dcf);logger[_0x564e('0xf')](_0x564e('0x15'),_0x431dcf,JSON[_0x564e('0x1a')](_0x33e75c));_0x5141cb(_0x33e75c);})['catch'](function(_0x33dfaf){logger['error'](_0x564e('0x15'),_0x33dfaf['message'],_0x431dcf);_0x17c43e(_0x1b2486[_0x564e('0x11')](0x1f4,_0x33dfaf[_0x564e('0x12')]));});});};exports[_0x564e('0x1b')]=function(_0x57f498){var _0x40a5d9=this;return new Promise(function(_0x435771,_0x45d0c9){return db[_0x564e('0x16')][_0x564e('0x1c')](_0x57f498[_0x564e('0x1d')],{'raw':_0x57f498['options']?_0x57f498[_0x564e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57f498[_0x564e('0x18')]?_0x57f498[_0x564e('0x18')][_0x564e('0x1e')]||null:null,'attributes':_0x57f498['options']?_0x57f498[_0x564e('0x18')][_0x564e('0x1f')]||null:null,'limit':_0x57f498[_0x564e('0x18')]?_0x57f498[_0x564e('0x18')]['limit']||null:null})[_0x564e('0xb')](function(_0x249bb8){logger['info'](_0x564e('0x1b'),_0x57f498);logger[_0x564e('0xf')](_0x564e('0x1b'),_0x57f498,JSON[_0x564e('0x1a')](_0x249bb8));_0x435771(_0x249bb8);})[_0x564e('0x14')](function(_0x5454a3){logger[_0x564e('0x11')]('UpdateChatQueueReport',_0x5454a3[_0x564e('0x12')],_0x57f498);_0x45d0c9(_0x40a5d9[_0x564e('0x11')](0x1f4,_0x5454a3[_0x564e('0x12')]));});});}; \ No newline at end of file +var _0xc4dd=['request\x20sent','result','CreateChatQueueReport','ChatQueueReport','create','body','options','catch','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x13f6c4,_0x3971c9){var _0x1cadbb=function(_0x427c13){while(--_0x427c13){_0x13f6c4['push'](_0x13f6c4['shift']());}};_0x1cadbb(++_0x3971c9);}(_0xc4dd,0xad));var _0xdc4d=function(_0x2b92eb,_0x6bdd2a){_0x2b92eb=_0x2b92eb-0x0;var _0x55cf36=_0xc4dd[_0x2b92eb];return _0x55cf36;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var moment=require(_0xdc4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc4d('0x3'));var fs=require('fs');var Redis=require(_0xdc4d('0x4'));var db=require(_0xdc4d('0x5'))['db'];var utils=require(_0xdc4d('0x6'));var logger=require(_0xdc4d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc4d('0x8'));var client=jayson[_0xdc4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4ce7,_0x2a2a14,_0x566564){return new BPromise(function(_0x1c2e51,_0x1db67d){return client[_0xdc4d('0xa')](_0x3c4ce7,_0x566564)[_0xdc4d('0xb')](function(_0x1f3a6d){logger[_0xdc4d('0xc')](_0xdc4d('0xd'),_0x2a2a14,'request\x20sent');logger[_0xdc4d('0xe')](_0xdc4d('0xf'),_0x2a2a14,'request\x20sent',JSON[_0xdc4d('0x10')](_0x1f3a6d));if(_0x1f3a6d['error']){if(_0x1f3a6d[_0xdc4d('0x11')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x2a2a14,_0x1f3a6d[_0xdc4d('0x11')][_0xdc4d('0x12')]);return _0x1db67d(_0x1f3a6d[_0xdc4d('0x11')]['message']);}logger[_0xdc4d('0x11')](_0xdc4d('0xd'),_0x2a2a14,_0x1f3a6d[_0xdc4d('0x11')]['message']);return _0x1c2e51(_0x1f3a6d[_0xdc4d('0x11')]['message']);}else{logger['info'](_0xdc4d('0xd'),_0x2a2a14,_0xdc4d('0x13'));_0x1c2e51(_0x1f3a6d[_0xdc4d('0x14')][_0xdc4d('0x12')]);}})['catch'](function(_0x7b1093){logger[_0xdc4d('0x11')](_0xdc4d('0xd'),_0x2a2a14,_0x7b1093);_0x1db67d(_0x7b1093);});});}exports[_0xdc4d('0x15')]=function(_0x504aa3){var _0x3a2490=this;return new Promise(function(_0x3203c1,_0x1d7490){return db[_0xdc4d('0x16')][_0xdc4d('0x17')](_0x504aa3[_0xdc4d('0x18')],{'raw':_0x504aa3[_0xdc4d('0x19')]?_0x504aa3[_0xdc4d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdc4d('0xb')](function(_0x273af8){logger[_0xdc4d('0xc')](_0xdc4d('0x15'),_0x504aa3);logger[_0xdc4d('0xe')]('CreateChatQueueReport',_0x504aa3,JSON['stringify'](_0x273af8));_0x3203c1(_0x273af8);})[_0xdc4d('0x1a')](function(_0xa97815){logger[_0xdc4d('0x11')]('CreateChatQueueReport',_0xa97815[_0xdc4d('0x12')],_0x504aa3);_0x1d7490(_0x3a2490['error'](0x1f4,_0xa97815[_0xdc4d('0x12')]));});});};exports[_0xdc4d('0x1b')]=function(_0x84132e){var _0x419367=this;return new Promise(function(_0xa90577,_0x509711){return db[_0xdc4d('0x16')][_0xdc4d('0x1c')](_0x84132e[_0xdc4d('0x18')],{'raw':_0x84132e[_0xdc4d('0x19')]?_0x84132e[_0xdc4d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x84132e[_0xdc4d('0x19')]?_0x84132e[_0xdc4d('0x19')][_0xdc4d('0x1d')]||null:null,'attributes':_0x84132e[_0xdc4d('0x19')]?_0x84132e[_0xdc4d('0x19')][_0xdc4d('0x1e')]||null:null,'limit':_0x84132e[_0xdc4d('0x19')]?_0x84132e[_0xdc4d('0x19')][_0xdc4d('0x1f')]||null:null})['then'](function(_0x1c7270){logger[_0xdc4d('0xc')](_0xdc4d('0x1b'),_0x84132e);logger['debug']('UpdateChatQueueReport',_0x84132e,JSON[_0xdc4d('0x10')](_0x1c7270));_0xa90577(_0x1c7270);})[_0xdc4d('0x1a')](function(_0x3fbb1c){logger[_0xdc4d('0x11')]('UpdateChatQueueReport',_0x3fbb1c[_0xdc4d('0x12')],_0x84132e);_0x509711(_0x419367[_0xdc4d('0x11')](0x1f4,_0x3fbb1c[_0xdc4d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4b227e4..b798803 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 _0x8b37=['destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','delete'];(function(_0x2283a4,_0x242590){var _0x17456f=function(_0x4d7dce){while(--_0x4d7dce){_0x2283a4['push'](_0x2283a4['shift']());}};_0x17456f(++_0x242590);}(_0x8b37,0x10f));var _0x78b3=function(_0xdb9a83,_0xa25f7e){_0xdb9a83=_0xdb9a83-0x0;var _0x5a2df6=_0x8b37[_0xdb9a83];return _0x5a2df6;};'use strict';var multer=require('multer');var util=require(_0x78b3('0x0'));var path=require('path');var timeout=require(_0x78b3('0x1'));var express=require('express');var router=express[_0x78b3('0x2')]();var fs_extra=require(_0x78b3('0x3'));var auth=require(_0x78b3('0x4'));var interaction=require(_0x78b3('0x5'));var config=require(_0x78b3('0x6'));var controller=require(_0x78b3('0x7'));router[_0x78b3('0x8')]('/',auth[_0x78b3('0x9')](),controller['index']);router[_0x78b3('0x8')](_0x78b3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x78b3('0x8')](_0x78b3('0xb'),auth['isAuthenticated'](),controller[_0x78b3('0xc')]);router['post']('/',auth[_0x78b3('0x9')](),controller[_0x78b3('0xd')]);router[_0x78b3('0xe')]('/:id',auth[_0x78b3('0x9')](),controller[_0x78b3('0xf')]);router[_0x78b3('0x10')](_0x78b3('0xb'),auth[_0x78b3('0x9')](),controller[_0x78b3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x85d5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x1ab782,_0x22ade){var _0x5d0157=function(_0x334c2e){while(--_0x334c2e){_0x1ab782['push'](_0x1ab782['shift']());}};_0x5d0157(++_0x22ade);}(_0x85d5,0x11d));var _0x585d=function(_0x52e945,_0x488200){_0x52e945=_0x52e945-0x0;var _0x259d4f=_0x85d5[_0x52e945];return _0x259d4f;};'use strict';var multer=require(_0x585d('0x0'));var util=require(_0x585d('0x1'));var path=require(_0x585d('0x2'));var timeout=require(_0x585d('0x3'));var express=require(_0x585d('0x4'));var router=express[_0x585d('0x5')]();var fs_extra=require(_0x585d('0x6'));var auth=require(_0x585d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x585d('0x8'));var controller=require(_0x585d('0x9'));router[_0x585d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x585d('0xa')](_0x585d('0xb'),auth[_0x585d('0xc')](),controller[_0x585d('0xd')]);router['get'](_0x585d('0xe'),auth['isAuthenticated'](),controller[_0x585d('0xf')]);router[_0x585d('0x10')]('/',auth[_0x585d('0xc')](),controller[_0x585d('0x11')]);router[_0x585d('0x12')]('/:id',auth[_0x585d('0xc')](),controller['update']);router['delete'](_0x585d('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 376022c..b0bca5f 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x43c07f,_0x23a5d8){var _0x159b5f=function(_0x8fe2b8){while(--_0x8fe2b8){_0x43c07f['push'](_0x43c07f['shift']());}};_0x159b5f(++_0x23a5d8);}(_0xaa88,0x137));var _0x8aa8=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xaa88[_0x4b7b62];return _0x2280df;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3183a8,_0x2a149a){_0x3183a8=_0x3183a8-0x0;var _0x288a1a=_0x9bde[_0x3183a8];return _0x288a1a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5082eaf..e91e945 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 _0xbdcb=['merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','intersection','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','then','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where'];(function(_0x43e854,_0x3daa61){var _0x52409b=function(_0x46e66c){while(--_0x46e66c){_0x43e854['push'](_0x43e854['shift']());}};_0x52409b(++_0x3daa61);}(_0xbdcb,0x9e));var _0xbbdc=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xbdcb[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xbbdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbdc('0x1'));var jsonpatch=require(_0xbbdc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbdc('0x3'));var Mustache=require(_0xbbdc('0x4'));var util=require(_0xbbdc('0x5'));var path=require('path');var sox=require(_0xbbdc('0x6'));var csv=require(_0xbbdc('0x7'));var ejs=require(_0xbbdc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbdc('0x9'));var squel=require(_0xbbdc('0xa'));var crypto=require(_0xbbdc('0xb'));var jsforce=require(_0xbbdc('0xc'));var deskjs=require(_0xbbdc('0xd'));var toCsv=require(_0xbbdc('0x7'));var querystring=require(_0xbbdc('0xe'));var Papa=require(_0xbbdc('0xf'));var Redis=require(_0xbbdc('0x10'));var authService=require(_0xbbdc('0x11'));var qs=require(_0xbbdc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbdc('0x13'));var logger=require('../../config/logger')(_0xbbdc('0x14'));var utils=require(_0xbbdc('0x15'));var config=require(_0xbbdc('0x16'));var licenseUtil=require(_0xbbdc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5188c4,_0x1fa461){_0x1fa461=_0x1fa461||0xcc;return function(_0x4d9db8){if(_0x4d9db8){return _0x5188c4[_0xbbdc('0x18')](_0x1fa461);}return _0x5188c4[_0xbbdc('0x19')](_0x1fa461)[_0xbbdc('0x1a')]();};}function respondWithResult(_0x461874,_0x2e95f2){_0x2e95f2=_0x2e95f2||0xc8;return function(_0x10025f){if(_0x10025f){return _0x461874['status'](_0x2e95f2)[_0xbbdc('0x1b')](_0x10025f);}};}function respondWithFilteredResult(_0x5e757b,_0x2ded7f){return function(_0x470540){if(_0x470540){var _0x44dfa3=typeof _0x2ded7f[_0xbbdc('0x1c')]==='undefined'&&typeof _0x2ded7f['limit']==='undefined';var _0x512a16=_0x470540['count'];var _0x246aa8=_0x44dfa3?0x0:_0x2ded7f[_0xbbdc('0x1c')];var _0x28d0fe=_0x44dfa3?_0x470540[_0xbbdc('0x1d')]:_0x2ded7f[_0xbbdc('0x1c')]+_0x2ded7f['limit'];var _0x3f4653;if(_0x28d0fe>=_0x512a16){_0x28d0fe=_0x512a16;_0x3f4653=0xc8;}else{_0x3f4653=0xce;}_0x5e757b[_0xbbdc('0x19')](_0x3f4653);return _0x5e757b['set'](_0xbbdc('0x1e'),_0x246aa8+'-'+_0x28d0fe+'/'+_0x512a16)[_0xbbdc('0x1b')](_0x470540);}return null;};}function patchUpdates(_0x466cf3){return function(_0xefd4bc){try{jsonpatch[_0xbbdc('0x1f')](_0xefd4bc,_0x466cf3,!![]);}catch(_0x441d70){return BPromise[_0xbbdc('0x20')](_0x441d70);}return _0xefd4bc[_0xbbdc('0x21')]();};}function saveUpdates(_0x34337d,_0x775685){return function(_0x8baf19){if(_0x8baf19){return _0x8baf19['update'](_0x34337d)[_0xbbdc('0x22')](function(_0x2ce552){return _0x2ce552;});}return null;};}function removeEntity(_0x38e254,_0x2f53bb){return function(_0x4c8edf){if(_0x4c8edf){return _0x4c8edf['destroy']()[_0xbbdc('0x22')](function(){_0x38e254[_0xbbdc('0x19')](0xcc)[_0xbbdc('0x1a')]();});}};}function handleEntityNotFound(_0x4cbcf6,_0x693c9){return function(_0x1d624c){if(!_0x1d624c){_0x4cbcf6['sendStatus'](0x194);}return _0x1d624c;};}function handleError(_0x594288,_0xf72321){_0xf72321=_0xf72321||0x1f4;return function(_0x57f6ca){logger[_0xbbdc('0x23')](_0x57f6ca['stack']);if(_0x57f6ca[_0xbbdc('0x24')]){delete _0x57f6ca[_0xbbdc('0x24')];}_0x594288['status'](_0xf72321)[_0xbbdc('0x25')](_0x57f6ca);};}exports[_0xbbdc('0x26')]=function(_0x52307b,_0x1d1586){var _0x466fe0={},_0x392ab4={},_0x48b492={'count':0x0,'rows':[]};var _0x595228=_['map'](db[_0xbbdc('0x27')][_0xbbdc('0x28')],function(_0x491a0d){return{'name':_0x491a0d[_0xbbdc('0x29')],'type':_0x491a0d[_0xbbdc('0x2a')]['key']};});_0x392ab4[_0xbbdc('0x2b')]=_[_0xbbdc('0x2c')](_0x595228,'name');_0x392ab4[_0xbbdc('0x2d')]=_['keys'](_0x52307b[_0xbbdc('0x2d')]);_0x392ab4[_0xbbdc('0x2e')]=_['intersection'](_0x392ab4[_0xbbdc('0x2b')],_0x392ab4[_0xbbdc('0x2d')]);_0x466fe0[_0xbbdc('0x2f')]=_['intersection'](_0x392ab4[_0xbbdc('0x2b')],qs[_0xbbdc('0x30')](_0x52307b['query']['fields']));_0x466fe0[_0xbbdc('0x2f')]=_0x466fe0['attributes'][_0xbbdc('0x31')]?_0x466fe0[_0xbbdc('0x2f')]:_0x392ab4[_0xbbdc('0x2b')];if(!_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x32')](_0xbbdc('0x33'))){_0x466fe0[_0xbbdc('0x34')]=qs[_0xbbdc('0x34')](_0x52307b['query'][_0xbbdc('0x34')]);_0x466fe0['offset']=qs['offset'](_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x1c')]);}_0x466fe0[_0xbbdc('0x35')]=qs[_0xbbdc('0x36')](_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x36')]);_0x466fe0['where']=qs[_0xbbdc('0x2e')](_[_0xbbdc('0x37')](_0x52307b['query'],_0x392ab4[_0xbbdc('0x2e')]),_0x595228);if(_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x38')]){_0x466fe0[_0xbbdc('0x39')]=_[_0xbbdc('0x3a')](_0x466fe0[_0xbbdc('0x39')],{'$or':_[_0xbbdc('0x2c')](_0x595228,function(_0x52d3f0){if(_0x52d3f0[_0xbbdc('0x2a')]!==_0xbbdc('0x3b')){var _0x3fd823={};_0x3fd823[_0x52d3f0['name']]={'$like':'%'+_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x38')]+'%'};return _0x3fd823;}})});}_0x466fe0=_[_0xbbdc('0x3a')]({},_0x466fe0,_0x52307b[_0xbbdc('0x3c')]);var _0x9cc6fc={'where':_0x466fe0['where']};return db[_0xbbdc('0x27')][_0xbbdc('0x1d')](_0x9cc6fc)[_0xbbdc('0x22')](function(_0x57333b){_0x48b492[_0xbbdc('0x1d')]=_0x57333b;if(_0x52307b[_0xbbdc('0x2d')][_0xbbdc('0x3d')]){_0x466fe0[_0xbbdc('0x3e')]=[{'all':!![]}];}return db[_0xbbdc('0x27')]['findAll'](_0x466fe0);})['then'](function(_0x3bc319){_0x48b492[_0xbbdc('0x3f')]=_0x3bc319;return _0x48b492;})[_0xbbdc('0x22')](respondWithFilteredResult(_0x1d1586,_0x466fe0))[_0xbbdc('0x40')](handleError(_0x1d1586,null));};exports['show']=function(_0x1275c0,_0x2e3e4d){var _0x246bd2={'raw':!![],'where':{'id':_0x1275c0[_0xbbdc('0x41')]['id']}},_0x64c1a5={};_0x64c1a5['model']=_[_0xbbdc('0x42')](db['ChatTransferReport'][_0xbbdc('0x28')]);_0x64c1a5[_0xbbdc('0x2d')]=_[_0xbbdc('0x42')](_0x1275c0[_0xbbdc('0x2d')]);_0x64c1a5['filters']=_['intersection'](_0x64c1a5[_0xbbdc('0x2b')],_0x64c1a5['query']);_0x246bd2['attributes']=_[_0xbbdc('0x43')](_0x64c1a5['model'],qs['fields'](_0x1275c0['query'][_0xbbdc('0x30')]));_0x246bd2[_0xbbdc('0x2f')]=_0x246bd2[_0xbbdc('0x2f')]['length']?_0x246bd2[_0xbbdc('0x2f')]:_0x64c1a5[_0xbbdc('0x2b')];if(_0x1275c0[_0xbbdc('0x2d')][_0xbbdc('0x3d')]){_0x246bd2[_0xbbdc('0x3e')]=[{'all':!![]}];}_0x246bd2=_[_0xbbdc('0x3a')]({},_0x246bd2,_0x1275c0[_0xbbdc('0x3c')]);return db['ChatTransferReport']['find'](_0x246bd2)[_0xbbdc('0x22')](handleEntityNotFound(_0x2e3e4d,null))[_0xbbdc('0x22')](respondWithResult(_0x2e3e4d,null))[_0xbbdc('0x40')](handleError(_0x2e3e4d,null));};exports[_0xbbdc('0x44')]=function(_0x3a1e47,_0x33328b){return db['ChatTransferReport'][_0xbbdc('0x44')](_0x3a1e47[_0xbbdc('0x45')],{})['then'](respondWithResult(_0x33328b,0xc9))[_0xbbdc('0x40')](handleError(_0x33328b,null));};exports['update']=function(_0x4168a3,_0x59ca71){if(_0x4168a3[_0xbbdc('0x45')]['id']){delete _0x4168a3[_0xbbdc('0x45')]['id'];}return db[_0xbbdc('0x27')]['find']({'where':{'id':_0x4168a3[_0xbbdc('0x41')]['id']}})[_0xbbdc('0x22')](handleEntityNotFound(_0x59ca71,null))[_0xbbdc('0x22')](saveUpdates(_0x4168a3[_0xbbdc('0x45')],null))[_0xbbdc('0x22')](respondWithResult(_0x59ca71,null))[_0xbbdc('0x40')](handleError(_0x59ca71,null));};exports['destroy']=function(_0x521184,_0x5e5795){return db['ChatTransferReport'][_0xbbdc('0x46')]({'where':{'id':_0x521184[_0xbbdc('0x41')]['id']}})[_0xbbdc('0x22')](handleEntityNotFound(_0x5e5795,null))[_0xbbdc('0x22')](removeEntity(_0x5e5795,null))['catch'](handleError(_0x5e5795,null));};exports[_0xbbdc('0x47')]=function(_0x21903a,_0x5f5d94){return db[_0xbbdc('0x27')]['describe']()[_0xbbdc('0x22')](respondWithResult(_0x5f5d94,null))[_0xbbdc('0x40')](handleError(_0x5f5d94,null));}; \ No newline at end of file +var _0xa3f8=['filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','includeAll','include','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys'];(function(_0x39788b,_0x4cc59c){var _0x3f58b4=function(_0x252eb8){while(--_0x252eb8){_0x39788b['push'](_0x39788b['shift']());}};_0x3f58b4(++_0x4cc59c);}(_0xa3f8,0x1f4));var _0x8a3f=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0xa3f8[_0x37a9d7];return _0x1343d3;};'use strict';var emlformat=require(_0x8a3f('0x0'));var rimraf=require(_0x8a3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a3f('0x2'));var rp=require(_0x8a3f('0x3'));var moment=require(_0x8a3f('0x4'));var BPromise=require(_0x8a3f('0x5'));var Mustache=require('mustache');var util=require(_0x8a3f('0x6'));var path=require(_0x8a3f('0x7'));var sox=require(_0x8a3f('0x8'));var csv=require(_0x8a3f('0x9'));var ejs=require(_0x8a3f('0xa'));var fs=require('fs');var fs_extra=require(_0x8a3f('0xb'));var _=require(_0x8a3f('0xc'));var squel=require(_0x8a3f('0xd'));var crypto=require(_0x8a3f('0xe'));var jsforce=require(_0x8a3f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a3f('0x9'));var querystring=require(_0x8a3f('0x10'));var Papa=require(_0x8a3f('0x11'));var Redis=require(_0x8a3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a3f('0x13'));var as=require(_0x8a3f('0x14'));var hardwareService=require(_0x8a3f('0x15'));var logger=require(_0x8a3f('0x16'))(_0x8a3f('0x17'));var utils=require('../../config/utils');var config=require(_0x8a3f('0x18'));var licenseUtil=require(_0x8a3f('0x19'));var db=require(_0x8a3f('0x1a'))['db'];function respondWithStatusCode(_0x202eb3,_0x9b343){_0x9b343=_0x9b343||0xcc;return function(_0xd81892){if(_0xd81892){return _0x202eb3[_0x8a3f('0x1b')](_0x9b343);}return _0x202eb3[_0x8a3f('0x1c')](_0x9b343)[_0x8a3f('0x1d')]();};}function respondWithResult(_0x54224a,_0x594475){_0x594475=_0x594475||0xc8;return function(_0xed4225){if(_0xed4225){return _0x54224a[_0x8a3f('0x1c')](_0x594475)[_0x8a3f('0x1e')](_0xed4225);}};}function respondWithFilteredResult(_0x48b17a,_0x3110bc){return function(_0x422af8){if(_0x422af8){var _0x4e7c73=typeof _0x3110bc['offset']===_0x8a3f('0x1f')&&typeof _0x3110bc[_0x8a3f('0x20')]===_0x8a3f('0x1f');var _0x1eb0e7=_0x422af8[_0x8a3f('0x21')];var _0x134eeb=_0x4e7c73?0x0:_0x3110bc[_0x8a3f('0x22')];var _0x1463b4=_0x4e7c73?_0x422af8[_0x8a3f('0x21')]:_0x3110bc[_0x8a3f('0x22')]+_0x3110bc[_0x8a3f('0x20')];var _0x4a9032;if(_0x1463b4>=_0x1eb0e7){_0x1463b4=_0x1eb0e7;_0x4a9032=0xc8;}else{_0x4a9032=0xce;}_0x48b17a['status'](_0x4a9032);return _0x48b17a[_0x8a3f('0x23')](_0x8a3f('0x24'),_0x134eeb+'-'+_0x1463b4+'/'+_0x1eb0e7)[_0x8a3f('0x1e')](_0x422af8);}return null;};}function patchUpdates(_0x3101c0){return function(_0x39da3d){try{jsonpatch['apply'](_0x39da3d,_0x3101c0,!![]);}catch(_0x1c64d2){return BPromise['reject'](_0x1c64d2);}return _0x39da3d[_0x8a3f('0x25')]();};}function saveUpdates(_0x529b38,_0x5b04f2){return function(_0x1dfed6){if(_0x1dfed6){return _0x1dfed6[_0x8a3f('0x26')](_0x529b38)[_0x8a3f('0x27')](function(_0x28a145){return _0x28a145;});}return null;};}function removeEntity(_0x46fdc6,_0x4d96e3){return function(_0xa9a557){if(_0xa9a557){return _0xa9a557[_0x8a3f('0x28')]()[_0x8a3f('0x27')](function(){_0x46fdc6[_0x8a3f('0x1c')](0xcc)[_0x8a3f('0x1d')]();});}};}function handleEntityNotFound(_0x2c7c6f,_0x2d7b66){return function(_0x914b37){if(!_0x914b37){_0x2c7c6f[_0x8a3f('0x1b')](0x194);}return _0x914b37;};}function handleError(_0x19ec2f,_0x360fbf){_0x360fbf=_0x360fbf||0x1f4;return function(_0x323634){logger[_0x8a3f('0x29')](_0x323634['stack']);if(_0x323634[_0x8a3f('0x2a')]){delete _0x323634[_0x8a3f('0x2a')];}_0x19ec2f[_0x8a3f('0x1c')](_0x360fbf)[_0x8a3f('0x2b')](_0x323634);};}exports[_0x8a3f('0x2c')]=function(_0x4955f8,_0x120004){var _0x43dc77={},_0x3e1968={},_0xa0146f={'count':0x0,'rows':[]};var _0x43ff10=_[_0x8a3f('0x2d')](db[_0x8a3f('0x2e')][_0x8a3f('0x2f')],function(_0x515954){return{'name':_0x515954[_0x8a3f('0x30')],'type':_0x515954[_0x8a3f('0x31')][_0x8a3f('0x32')]};});_0x3e1968['model']=_[_0x8a3f('0x2d')](_0x43ff10,_0x8a3f('0x2a'));_0x3e1968[_0x8a3f('0x33')]=_[_0x8a3f('0x34')](_0x4955f8[_0x8a3f('0x33')]);_0x3e1968[_0x8a3f('0x35')]=_[_0x8a3f('0x36')](_0x3e1968['model'],_0x3e1968[_0x8a3f('0x33')]);_0x43dc77[_0x8a3f('0x37')]=_['intersection'](_0x3e1968['model'],qs['fields'](_0x4955f8[_0x8a3f('0x33')][_0x8a3f('0x38')]));_0x43dc77[_0x8a3f('0x37')]=_0x43dc77[_0x8a3f('0x37')][_0x8a3f('0x39')]?_0x43dc77['attributes']:_0x3e1968[_0x8a3f('0x3a')];if(!_0x4955f8['query'][_0x8a3f('0x3b')](_0x8a3f('0x3c'))){_0x43dc77[_0x8a3f('0x20')]=qs['limit'](_0x4955f8[_0x8a3f('0x33')][_0x8a3f('0x20')]);_0x43dc77[_0x8a3f('0x22')]=qs[_0x8a3f('0x22')](_0x4955f8[_0x8a3f('0x33')][_0x8a3f('0x22')]);}_0x43dc77['order']=qs[_0x8a3f('0x3d')](_0x4955f8[_0x8a3f('0x33')][_0x8a3f('0x3d')]);_0x43dc77[_0x8a3f('0x3e')]=qs['filters'](_[_0x8a3f('0x3f')](_0x4955f8[_0x8a3f('0x33')],_0x3e1968[_0x8a3f('0x35')]),_0x43ff10);if(_0x4955f8['query'][_0x8a3f('0x40')]){_0x43dc77[_0x8a3f('0x3e')]=_[_0x8a3f('0x41')](_0x43dc77['where'],{'$or':_['map'](_0x43ff10,function(_0x26a4ba){if(_0x26a4ba['type']!==_0x8a3f('0x42')){var _0x36a6f9={};_0x36a6f9[_0x26a4ba['name']]={'$like':'%'+_0x4955f8[_0x8a3f('0x33')][_0x8a3f('0x40')]+'%'};return _0x36a6f9;}})});}_0x43dc77=_['merge']({},_0x43dc77,_0x4955f8[_0x8a3f('0x43')]);var _0x1f3398={'where':_0x43dc77['where']};return db[_0x8a3f('0x2e')]['count'](_0x1f3398)['then'](function(_0x1e3af8){_0xa0146f['count']=_0x1e3af8;if(_0x4955f8[_0x8a3f('0x33')]['includeAll']){_0x43dc77['include']=[{'all':!![]}];}return db[_0x8a3f('0x2e')][_0x8a3f('0x44')](_0x43dc77);})[_0x8a3f('0x27')](function(_0x3e2111){_0xa0146f[_0x8a3f('0x45')]=_0x3e2111;return _0xa0146f;})[_0x8a3f('0x27')](respondWithFilteredResult(_0x120004,_0x43dc77))['catch'](handleError(_0x120004,null));};exports[_0x8a3f('0x46')]=function(_0x4ccfeb,_0x217746){var _0xec71ab={'raw':!![],'where':{'id':_0x4ccfeb['params']['id']}},_0x227153={};_0x227153[_0x8a3f('0x3a')]=_[_0x8a3f('0x34')](db[_0x8a3f('0x2e')]['rawAttributes']);_0x227153[_0x8a3f('0x33')]=_['keys'](_0x4ccfeb[_0x8a3f('0x33')]);_0x227153[_0x8a3f('0x35')]=_[_0x8a3f('0x36')](_0x227153[_0x8a3f('0x3a')],_0x227153['query']);_0xec71ab[_0x8a3f('0x37')]=_['intersection'](_0x227153['model'],qs[_0x8a3f('0x38')](_0x4ccfeb['query'][_0x8a3f('0x38')]));_0xec71ab[_0x8a3f('0x37')]=_0xec71ab[_0x8a3f('0x37')][_0x8a3f('0x39')]?_0xec71ab[_0x8a3f('0x37')]:_0x227153['model'];if(_0x4ccfeb[_0x8a3f('0x33')][_0x8a3f('0x47')]){_0xec71ab[_0x8a3f('0x48')]=[{'all':!![]}];}_0xec71ab=_[_0x8a3f('0x41')]({},_0xec71ab,_0x4ccfeb[_0x8a3f('0x43')]);return db['ChatTransferReport'][_0x8a3f('0x49')](_0xec71ab)[_0x8a3f('0x27')](handleEntityNotFound(_0x217746,null))[_0x8a3f('0x27')](respondWithResult(_0x217746,null))[_0x8a3f('0x4a')](handleError(_0x217746,null));};exports[_0x8a3f('0x4b')]=function(_0x2560d9,_0x3b4e59){return db[_0x8a3f('0x2e')]['create'](_0x2560d9[_0x8a3f('0x4c')],{})[_0x8a3f('0x27')](respondWithResult(_0x3b4e59,0xc9))['catch'](handleError(_0x3b4e59,null));};exports['update']=function(_0x509a0b,_0x1a933f){if(_0x509a0b[_0x8a3f('0x4c')]['id']){delete _0x509a0b[_0x8a3f('0x4c')]['id'];}return db[_0x8a3f('0x2e')][_0x8a3f('0x49')]({'where':{'id':_0x509a0b[_0x8a3f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a933f,null))['then'](saveUpdates(_0x509a0b['body'],null))['then'](respondWithResult(_0x1a933f,null))[_0x8a3f('0x4a')](handleError(_0x1a933f,null));};exports['destroy']=function(_0x2c42ff,_0x21ef68){return db[_0x8a3f('0x2e')][_0x8a3f('0x49')]({'where':{'id':_0x2c42ff[_0x8a3f('0x4d')]['id']}})[_0x8a3f('0x27')](handleEntityNotFound(_0x21ef68,null))['then'](removeEntity(_0x21ef68,null))[_0x8a3f('0x4a')](handleError(_0x21ef68,null));};exports[_0x8a3f('0x4e')]=function(_0x137b5b,_0x8ad8f6){return db[_0x8a3f('0x2e')][_0x8a3f('0x4e')]()[_0x8a3f('0x27')](respondWithResult(_0x8ad8f6,null))[_0x8a3f('0x4a')](handleError(_0x8ad8f6,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d4abc6e..2a5fb15 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 _0x1d48=['moment','request-promise','path','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','../../config/logger','api'];(function(_0x2d9ebc,_0x31fec0){var _0x1623ec=function(_0x1cfd82){while(--_0x1cfd82){_0x2d9ebc['push'](_0x2d9ebc['shift']());}};_0x1623ec(++_0x31fec0);}(_0x1d48,0x127));var _0x81d4=function(_0x27a1d9,_0x2f4efd){_0x27a1d9=_0x27a1d9-0x0;var _0x54f3ea=_0x1d48[_0x27a1d9];return _0x54f3ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81d4('0x0'))(_0x81d4('0x1'));var moment=require(_0x81d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x81d4('0x3'));var fs=require('fs');var path=require(_0x81d4('0x4'));var rimraf=require(_0x81d4('0x5'));var config=require(_0x81d4('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x81d4('0x7')]=function(_0x21fc5f,_0x5e85cd){return _0x21fc5f[_0x81d4('0x8')]('ChatTransferReport',attributes,{'tableName':_0x81d4('0x9'),'paranoid':![],'indexes':[{'name':_0x81d4('0xa'),'fields':[_0x81d4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8595=['ChatTransferReport','report_chat_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8595,0x1d0));var _0x5859=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8595[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x5859('0x0'));var util=require('util');var logger=require(_0x5859('0x1'))(_0x5859('0x2'));var moment=require(_0x5859('0x3'));var BPromise=require(_0x5859('0x4'));var rp=require(_0x5859('0x5'));var fs=require('fs');var path=require(_0x5859('0x6'));var rimraf=require(_0x5859('0x7'));var config=require(_0x5859('0x8'));var attributes=require(_0x5859('0x9'));module[_0x5859('0xa')]=function(_0x544ef9,_0x20a892){return _0x544ef9[_0x5859('0xb')](_0x5859('0xc'),attributes,{'tableName':_0x5859('0xd'),'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 9f36a3d..08f5206 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 _0xef1d=['http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xef1d,0xa0));var _0xdef1=function(_0x1ef6e3,_0x2a2df5){_0x1ef6e3=_0x1ef6e3-0x0;var _0x21cf56=_0xef1d[_0x1ef6e3];return _0x21cf56;};'use strict';var _=require('lodash');var util=require(_0xdef1('0x0'));var moment=require(_0xdef1('0x1'));var BPromise=require(_0xdef1('0x2'));var rs=require(_0xdef1('0x3'));var fs=require('fs');var Redis=require(_0xdef1('0x4'));var db=require(_0xdef1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdef1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdef1('0x7')][_0xdef1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34c6d8,_0x3a3369,_0x11b9c1){return new BPromise(function(_0x5732cc,_0x578f53){return client[_0xdef1('0x9')](_0x34c6d8,_0x11b9c1)[_0xdef1('0xa')](function(_0x33ce24){logger['info'](_0xdef1('0xb'),_0x3a3369,_0xdef1('0xc'));logger[_0xdef1('0xd')](_0xdef1('0xe'),_0x3a3369,'request\x20sent',JSON['stringify'](_0x33ce24));if(_0x33ce24[_0xdef1('0xf')]){if(_0x33ce24[_0xdef1('0xf')][_0xdef1('0x10')]===0x1f4){logger[_0xdef1('0xf')](_0xdef1('0xb'),_0x3a3369,_0x33ce24['error']['message']);return _0x578f53(_0x33ce24[_0xdef1('0xf')][_0xdef1('0x11')]);}logger[_0xdef1('0xf')](_0xdef1('0xb'),_0x3a3369,_0x33ce24[_0xdef1('0xf')][_0xdef1('0x11')]);return _0x5732cc(_0x33ce24['error']['message']);}else{logger[_0xdef1('0x12')](_0xdef1('0xb'),_0x3a3369,_0xdef1('0xc'));_0x5732cc(_0x33ce24[_0xdef1('0x13')]['message']);}})[_0xdef1('0x14')](function(_0x476d6b){logger[_0xdef1('0xf')](_0xdef1('0xb'),_0x3a3369,_0x476d6b);_0x578f53(_0x476d6b);});});} \ No newline at end of file +var _0x876a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x3d2ec9,_0x46db50){var _0x333e0a=function(_0xe37674){while(--_0xe37674){_0x3d2ec9['push'](_0x3d2ec9['shift']());}};_0x333e0a(++_0x46db50);}(_0x876a,0x1ae));var _0xa876=function(_0x54a9b1,_0x435f9f){_0x54a9b1=_0x54a9b1-0x0;var _0x55ebab=_0x876a[_0x54a9b1];return _0x55ebab;};'use strict';var _=require('lodash');var util=require(_0xa876('0x0'));var moment=require(_0xa876('0x1'));var BPromise=require(_0xa876('0x2'));var rs=require(_0xa876('0x3'));var fs=require('fs');var Redis=require(_0xa876('0x4'));var db=require(_0xa876('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa876('0x6'))(_0xa876('0x7'));var config=require(_0xa876('0x8'));var jayson=require(_0xa876('0x9'));var client=jayson[_0xa876('0xa')][_0xa876('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ba099,_0x4c4593,_0x4558d2){return new BPromise(function(_0x46c1c2,_0xd18228){return client[_0xa876('0xc')](_0x2ba099,_0x4558d2)[_0xa876('0xd')](function(_0x2bc535){logger[_0xa876('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x4c4593,_0xa876('0xf'));logger['debug'](_0xa876('0x10'),_0x4c4593,'request\x20sent',JSON[_0xa876('0x11')](_0x2bc535));if(_0x2bc535[_0xa876('0x12')]){if(_0x2bc535[_0xa876('0x12')][_0xa876('0x13')]===0x1f4){logger[_0xa876('0x12')](_0xa876('0x14'),_0x4c4593,_0x2bc535[_0xa876('0x12')][_0xa876('0x15')]);return _0xd18228(_0x2bc535[_0xa876('0x12')][_0xa876('0x15')]);}logger[_0xa876('0x12')](_0xa876('0x14'),_0x4c4593,_0x2bc535['error']['message']);return _0x46c1c2(_0x2bc535[_0xa876('0x12')][_0xa876('0x15')]);}else{logger['info'](_0xa876('0x14'),_0x4c4593,_0xa876('0xf'));_0x46c1c2(_0x2bc535[_0xa876('0x16')][_0xa876('0x15')]);}})[_0xa876('0x17')](function(_0x2996b5){logger['error'](_0xa876('0x14'),_0x4c4593,_0x2996b5);_0xd18228(_0x2996b5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 48e1df9..cc4e837 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 _0x5e0b=['get','describe','/:id','show','post','create','update','destroy','multer','express','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x2f653f,_0x1cef4e){var _0x479836=function(_0x4182c2){while(--_0x4182c2){_0x2f653f['push'](_0x2f653f['shift']());}};_0x479836(++_0x1cef4e);}(_0x5e0b,0x178));var _0xb5e0=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x5e0b[_0x469ac7];return _0x22f3b0;};'use strict';var multer=require(_0xb5e0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5e0('0x1'));var router=express['Router']();var fs_extra=require(_0xb5e0('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb5e0('0x3'));var config=require(_0xb5e0('0x4'));var controller=require(_0xb5e0('0x5'));router['get']('/',auth[_0xb5e0('0x6')](),controller[_0xb5e0('0x7')]);router[_0xb5e0('0x8')]('/describe',auth[_0xb5e0('0x6')](),controller[_0xb5e0('0x9')]);router['get'](_0xb5e0('0xa'),auth[_0xb5e0('0x6')](),controller[_0xb5e0('0xb')]);router[_0xb5e0('0xc')]('/',auth[_0xb5e0('0x6')](),controller[_0xb5e0('0xd')]);router['put'](_0xb5e0('0xa'),auth['isAuthenticated'](),controller[_0xb5e0('0xe')]);router['delete'](_0xb5e0('0xa'),auth['isAuthenticated'](),controller[_0xb5e0('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2775=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2a27bb,_0x29dbc8){var _0x1d0c8a=function(_0x4ac073){while(--_0x4ac073){_0x2a27bb['push'](_0x2a27bb['shift']());}};_0x1d0c8a(++_0x29dbc8);}(_0x2775,0xc0));var _0x5277=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x2775[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x5277('0x0'));var util=require(_0x5277('0x1'));var path=require(_0x5277('0x2'));var timeout=require(_0x5277('0x3'));var express=require(_0x5277('0x4'));var router=express[_0x5277('0x5')]();var fs_extra=require(_0x5277('0x6'));var auth=require(_0x5277('0x7'));var interaction=require(_0x5277('0x8'));var config=require(_0x5277('0x9'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5277('0xa')]);router[_0x5277('0xb')](_0x5277('0xc'),auth[_0x5277('0xd')](),controller[_0x5277('0xe')]);router[_0x5277('0xb')](_0x5277('0xf'),auth[_0x5277('0xd')](),controller[_0x5277('0x10')]);router['post']('/',auth[_0x5277('0xd')](),controller[_0x5277('0x11')]);router[_0x5277('0x12')](_0x5277('0xf'),auth[_0x5277('0xd')](),controller[_0x5277('0x13')]);router['delete'](_0x5277('0xf'),auth[_0x5277('0xd')](),controller[_0x5277('0x14')]);module[_0x5277('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3581d7c..a18351f 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 _0xdf88=['#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent'];(function(_0xd83c77,_0x343752){var _0x392ee8=function(_0x576335){while(--_0x576335){_0xd83c77['push'](_0xd83c77['shift']());}};_0x392ee8(++_0x343752);}(_0xdf88,0x199));var _0x8df8=function(_0x215b58,_0x4e8dd0){_0x215b58=_0x215b58-0x0;var _0x29208d=_0xdf88[_0x215b58];return _0x29208d;};'use strict';var Sequelize=require(_0x8df8('0x0'));var rs=require(_0x8df8('0x1'));module[_0x8df8('0x2')]={'name':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![],'unique':_0x8df8('0x4')},'description':{'type':Sequelize[_0x8df8('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x5')},'mapKeyOffline':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x5')},'key':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x6')},'customerAlias':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8df8('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![],'defaultValue':_0x8df8('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8df8('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8df8('0x3')]},'animation':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8df8('0xb')](_0x8df8('0xc'),_0x8df8('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0xe')},'start_chat_button':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0xf')},'offline_chat_button':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x10')},'header_offline':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8df8('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8df8('0x12')]},'closingQuestion':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x14')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x15')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x16')},'closingMessage':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x10')},'skipMessageButton':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x18')},'conditionAgreement':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x19')},'ratingType':{'type':Sequelize[_0x8df8('0xb')](_0x8df8('0x1a'),_0x8df8('0x1b')),'defaultValue':_0x8df8('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x8df8('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8df8('0x1c')]({'items':[{'type':_0x8df8('0x1d'),'variable':null,'config':{'placeholder':_0x8df8('0x1e'),'type':_0x8df8('0x1f'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8df8('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8df8('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8df8('0x20'))?JSON[_0x8df8('0x21')](this[_0x8df8('0x22')]('onlineForm')):{};},'set':function(_0x311652){return this[_0x8df8('0x23')](_0x8df8('0x20'),JSON[_0x8df8('0x1c')](_0x311652));}},'offlineForm':{'type':Sequelize[_0x8df8('0x12')],'defaultValue':function(){return JSON[_0x8df8('0x1c')]({'items':[{'type':_0x8df8('0x1d'),'props':{'title':_0x8df8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x8df8('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x8df8('0x24')},'props':{'title':_0x8df8('0x24'),'helpText':_0x8df8('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x8df8('0x22')](_0x8df8('0x26'))?JSON[_0x8df8('0x21')](this['getDataValue'](_0x8df8('0x26'))):{};},'set':function(_0x31540a){return this[_0x8df8('0x23')](_0x8df8('0x26'),JSON[_0x8df8('0x1c')](_0x31540a));}},'token':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':function(){return rs[_0x8df8('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8df8('0x3')]},'forwardOffline':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x28')},'waitingMessage':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x29')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8df8('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8df8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8df8('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8df8('0x2d')},'verticalAlignment':{'type':Sequelize[_0x8df8('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x2e')},'messagesAlignment':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x8df8('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8df8('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8df8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8df8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8df8('0x3')],'defaultValue':_0x8df8('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8df8('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![],'comment':_0x8df8('0x30'),'set':function(_0x44b530){if(!_0x44b530)this[_0x8df8('0x23')](_0x8df8('0x31'),null);this[_0x8df8('0x23')](_0x8df8('0x32'),_0x44b530);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x8df8('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8df8('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x8df8('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8df8('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8df8('0x12')]}}; \ No newline at end of file +var _0x445f=['Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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','CHAT','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat'];(function(_0xe6d242,_0x48fdec){var _0xc462d3=function(_0xc60708){while(--_0xc60708){_0xe6d242['push'](_0xe6d242['shift']());}};_0xc462d3(++_0x48fdec);}(_0x445f,0x1be));var _0xf445=function(_0x372922,_0x42883c){_0x372922=_0x372922-0x0;var _0x4e20d6=_0x445f[_0x372922];return _0x4e20d6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf445('0x0')]={'name':{'type':Sequelize[_0xf445('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xf445('0x1')],'allowNull':![],'unique':_0xf445('0x2')},'description':{'type':Sequelize[_0xf445('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x3')},'mapKeyOffline':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x3')},'key':{'type':Sequelize[_0xf445('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x4')},'customerAlias':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf445('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf445('0x1')],'allowNull':![],'defaultValue':_0xf445('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf445('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf445('0x1')],'allowNull':![],'defaultValue':_0xf445('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf445('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf445('0x1')]},'animation':{'type':Sequelize[_0xf445('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf445('0x9'),_0xf445('0xa')),'defaultValue':_0xf445('0x9')},'header_online':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0xb')},'start_chat_button':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0xc')},'offline_chat_button':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0xd')},'header_offline':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf445('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf445('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf445('0xf')]},'closingQuestion':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x13')},'closingMessage':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0xd')},'skipMessageButton':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x14')},'conditionAgreement':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x15')},'ratingType':{'type':Sequelize[_0xf445('0x16')](_0xf445('0x17'),_0xf445('0x18')),'defaultValue':_0xf445('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf445('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf445('0xf')],'defaultValue':function(){return JSON[_0xf445('0x19')]({'items':[{'type':_0xf445('0x1a'),'variable':null,'config':{'placeholder':_0xf445('0x1b'),'type':_0xf445('0x1c'),'required':!![]},'props':{'title':_0xf445('0x1b'),'helpText':''}},{'type':_0xf445('0x1a'),'props':{'title':_0xf445('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf445('0x3'),'type':_0xf445('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf445('0x1d')]('onlineForm')?JSON[_0xf445('0x1e')](this[_0xf445('0x1d')](_0xf445('0x1f'))):{};},'set':function(_0x5ac421){return this['setDataValue'](_0xf445('0x1f'),JSON[_0xf445('0x19')](_0x5ac421));}},'offlineForm':{'type':Sequelize[_0xf445('0xf')],'defaultValue':function(){return JSON[_0xf445('0x19')]({'items':[{'type':_0xf445('0x1a'),'props':{'title':_0xf445('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf445('0x3'),'type':'email'},'variable':null},{'type':_0xf445('0x20'),'config':{'placeholder':_0xf445('0x21')},'props':{'title':'Comments','helpText':_0xf445('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xf445('0x1d')](_0xf445('0x23'))?JSON[_0xf445('0x1e')](this[_0xf445('0x1d')]('offlineForm')):{};},'set':function(_0x561944){return this[_0xf445('0x24')](_0xf445('0x23'),JSON[_0xf445('0x19')](_0x561944));}},'token':{'type':Sequelize[_0xf445('0x1')],'defaultValue':function(){return rs[_0xf445('0x25')]();}},'autoclose':{'type':Sequelize[_0xf445('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf445('0x1')]},'forwardOffline':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x26')},'waitingMessage':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x27')},'offlineMessageBody':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xf445('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x14')},'sendUnmanaged':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf445('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf445('0xf')],'defaultValue':function(){return _0xf445('0x2a');}},'notificationSound':{'type':Sequelize[_0xf445('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf445('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf445('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf445('0x2c')},'verticalAlignment':{'type':Sequelize[_0xf445('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x2d')},'messagesAlignment':{'type':Sequelize[_0xf445('0x1')],'defaultValue':_0xf445('0x2e')},'defaultTitle':{'type':Sequelize[_0xf445('0x1')]},'customerAvatar':{'type':Sequelize[_0xf445('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf445('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf445('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf445('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf445('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf445('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf445('0x7')],'comment':_0xf445('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5d966f){if(!_0x5d966f)this[_0xf445('0x24')]('mandatoryDispositionPauseId',null);this[_0xf445('0x24')](_0xf445('0x30'),_0x5d966f);}},'vidaooEscalation':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf445('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf445('0x31')},'vidaooNote':{'type':Sequelize[_0xf445('0x1')],'defaultValue':function(){return _0xf445('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xf445('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf445('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf445('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 70addb5..bd8d7e2 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 _0x29e7=['ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','CompanyId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','firstName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tags','tag','getProactiveActions','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','origin','remote','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','querystring','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','Command','getSnippet','timezone','format','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','catch','inspect','map','Interval','Intervals','all','user-agent-parser','setUA','user-agent','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','model','vendor','%s\x20%s\x20%s','mandatoryDispositionPause','ChatWebsite','type','key','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','show','params','Pause','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','autoAssociation','body','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','includeAll','rows','removeDispositions','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','account','list','applications','orderBy','priority','Applications','contact','headers','ChatInteraction','threadId','externalUrl','ContactId','interaction','messageId','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','forcedOwnership','queueId'];(function(_0x5dd923,_0x1369e6){var _0x3b5667=function(_0x10695b){while(--_0x10695b){_0x5dd923['push'](_0x5dd923['shift']());}};_0x3b5667(++_0x1369e6);}(_0x29e7,0x64));var _0x729e=function(_0x57a8e7,_0x1e576d){_0x57a8e7=_0x57a8e7-0x0;var _0x4ee93a=_0x29e7[_0x57a8e7];return _0x4ee93a;};'use strict';var Mustache=require('mustache');var util=require(_0x729e('0x0'));var path=require(_0x729e('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x729e('0x2'));var htmlToText=require('html-to-text');var Redis=require(_0x729e('0x3'));var jayson=require(_0x729e('0x4'));var url=require(_0x729e('0x5'));var qs=require(_0x729e('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x729e('0x7'));var APIOutOfIntervalError=require(_0x729e('0x8'))[_0x729e('0x9')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0x729e('0xa')];var db=require(_0x729e('0xb'))['db'];config[_0x729e('0xc')]=_[_0x729e('0xd')](config[_0x729e('0xc')],{'host':_0x729e('0xe'),'port':0x18eb});var socket=require(_0x729e('0xf'))(new Redis(config[_0x729e('0xc')]));require(_0x729e('0x10'))[_0x729e('0x11')](socket);var client=jayson[_0x729e('0x12')]['http']({'port':0x232c});var client9002=jayson[_0x729e('0x12')][_0x729e('0x13')]({'port':0x232a});var client9003=jayson['client'][_0x729e('0x13')]({'port':0x232b});var client9001=jayson[_0x729e('0x12')][_0x729e('0x13')]({'port':0x2329});function respondWithRpcPromise(_0xf80d3e,_0x572643,_0x5cf8ad,_0x49fd0b){return new Promise(function(_0x19b8ae,_0x26cc0b){var _0x514bdf=_0x49fd0b||client;return _0x514bdf[_0x729e('0x14')](_0xf80d3e,_0x5cf8ad)[_0x729e('0x15')](function(_0x119bab){logger[_0x729e('0x16')](_0x729e('0x17'),_0x572643,'request\x20sent');logger[_0x729e('0x18')](_0x729e('0x19'),_0x572643,_0x729e('0x1a'),JSON[_0x729e('0x1b')](_0x119bab));if(_0x119bab[_0x729e('0x1c')]){if(_0x119bab[_0x729e('0x1c')][_0x729e('0x1d')]===0x1f4){logger[_0x729e('0x1c')](_0x729e('0x17'),_0x572643,_0x119bab[_0x729e('0x1c')][_0x729e('0x1e')]);return _0x26cc0b(_0x119bab[_0x729e('0x1c')][_0x729e('0x1e')]);}logger[_0x729e('0x1c')](_0x729e('0x17'),_0x572643,_0x119bab[_0x729e('0x1c')]['message']);return _0x19b8ae(_0x119bab[_0x729e('0x1c')]['message']);}else{logger['info'](_0x729e('0x17'),_0x572643,_0x729e('0x1a'));_0x19b8ae(_0x119bab[_0x729e('0x1f')][_0x729e('0x1e')]);}})['catch'](function(_0x3bc40d){logger[_0x729e('0x1c')](_0x729e('0x17'),_0x572643,_0x3bc40d);_0x26cc0b(_0x3bc40d);});});}function respondWithStatusCode(_0x5a2240,_0x188674){_0x188674=_0x188674||0xcc;return function(_0x2d2936){if(_0x2d2936){return _0x5a2240[_0x729e('0x20')](_0x188674);}return _0x5a2240[_0x729e('0x21')](_0x188674)[_0x729e('0x22')]();};}function respondWithResult(_0x3c61aa,_0x209a3a){_0x209a3a=_0x209a3a||0xc8;return function(_0x50d9d7){if(_0x50d9d7){return _0x3c61aa[_0x729e('0x21')](_0x209a3a)['json'](_0x50d9d7);}};}function respondWithFilteredResult(_0x5049f8,_0x4f2948){return function(_0x1160e6){if(_0x1160e6){var _0x21a5a8=typeof _0x4f2948[_0x729e('0x23')]==='undefined'&&typeof _0x4f2948[_0x729e('0x24')]===_0x729e('0x25');var _0x52df89=_0x1160e6[_0x729e('0x26')];var _0x93aa7b=_0x21a5a8?0x0:_0x4f2948[_0x729e('0x23')];var _0x4720bb=_0x21a5a8?_0x1160e6[_0x729e('0x26')]:_0x4f2948[_0x729e('0x23')]+_0x4f2948[_0x729e('0x24')];var _0x3a1fbf;if(_0x4720bb>=_0x52df89){_0x4720bb=_0x52df89;_0x3a1fbf=0xc8;}else{_0x3a1fbf=0xce;}_0x5049f8['status'](_0x3a1fbf);return _0x5049f8[_0x729e('0x27')](_0x729e('0x28'),_0x93aa7b+'-'+_0x4720bb+'/'+_0x52df89)['json'](_0x1160e6);}return null;};}function saveUpdates(_0x1df139){return function(_0x172e3c){if(_0x172e3c){return _0x172e3c[_0x729e('0x29')](_0x1df139)[_0x729e('0x15')](function(_0x5152e6){return _0x5152e6;});}return null;};}function removeEntity(_0x1dd4b1){return function(_0x12d792){if(_0x12d792){return _0x12d792[_0x729e('0x2a')]()['then'](function(){var _0x2d14dd=_0x12d792[_0x729e('0x2b')]({'plain':!![]});var _0x2d1f87='ChatWebsites';return db[_0x729e('0x2c')][_0x729e('0x2a')]({'where':{'type':_0x2d1f87,'resourceId':_0x2d14dd['id']}})[_0x729e('0x15')](function(){return _0x12d792;});})['then'](function(){_0x1dd4b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3330){return function(_0x3658e){if(!_0x3658e){_0x1f3330[_0x729e('0x20')](0x194);}return _0x3658e;};}function handleError(_0x42670c,_0x472cda){_0x472cda=_0x472cda||0x1f4;return function(_0xdfa50b){logger[_0x729e('0x1c')](_0xdfa50b[_0x729e('0x2d')]);if(_0xdfa50b[_0x729e('0x2e')]){delete _0xdfa50b[_0x729e('0x2e')];}_0x42670c['status'](_0x472cda)[_0x729e('0x2f')](_0xdfa50b);};}function iftimePromise(_0x569ac7,_0x4f9249){return respondWithRpcPromise(_0x729e('0x30'),_0x729e('0x31'),{'command':_0x4f9249[_0x729e('0x32')]?util[_0x729e('0x33')]('iftime\x20%s,%s',_0x569ac7[_0x729e('0x34')],_0x4f9249[_0x729e('0x32')]):util[_0x729e('0x33')](_0x729e('0x35'),_0x569ac7['interval'])},client9002)[_0x729e('0x15')](function(_0x437f05){var _0x217f8a=_0x437f05&&_0x437f05['indexOf'](_0x729e('0x36'))>=0x0?!![]:![];logger[_0x729e('0x16')](_0x729e('0x37'),_0x4f9249['id'],_0x569ac7['id'],_0x569ac7[_0x729e('0x34')],_0x217f8a?_0x729e('0x38'):'OFFLINE',_0x4f9249['timezone']?_0x4f9249['timezone']:_0x729e('0x39'));return _0x217f8a;})[_0x729e('0x3a')](function(_0x288ee7){logger[_0x729e('0x1c')](_0x729e('0x37'),_0x4f9249['id'],_0x569ac7['id'],_0x569ac7[_0x729e('0x34')],util[_0x729e('0x3b')](_0x288ee7,{'showHidden':![],'depth':null}),_0x4f9249['timezone']?_0x4f9249[_0x729e('0x32')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x50effd){var _0x9ec9bb=_[_0x729e('0x3c')](_0x50effd[_0x729e('0x3d')][_0x729e('0x3e')],function(_0x347f33){var _0xad1677=_0x347f33[_0x729e('0x2b')]({'plain':!![]});return iftimePromise(_0xad1677,_0x50effd);});return Promise[_0x729e('0x3f')](_0x9ec9bb)[_0x729e('0x15')](function(_0x363f26){return _['some'](_0x363f26);});}function createInteractionObject(_0x7b14ad,_0x151ca4,_0x116aaf,_0x22ba87){var _0x1eef23=require(_0x729e('0x40'));var _0x14fdcd=new _0x1eef23();var _0x2439ac=_0x14fdcd[_0x729e('0x41')](_0x116aaf[_0x729e('0x42')])['getResult']();var _0x5c0e5f=_0x151ca4['customerIp'];if(_0x116aaf[_0x729e('0x43')]){_0x5c0e5f=_0x116aaf[_0x729e('0x43')];}else if(_0x116aaf['x-forwarded-for']){_0x5c0e5f=_['first'](_0x116aaf[_0x729e('0x44')][_0x729e('0x45')](','));}return{'ContactId':_0x22ba87['id'],'ChatWebsiteId':_0x7b14ad,'from':(_0x22ba87['firstName']||'')+'\x20'+(_0x22ba87[_0x729e('0x46')]||''),'customerIp':_0x5c0e5f,'customerPort':_0x116aaf[_0x729e('0x47')]?_0x116aaf[_0x729e('0x47')]:null,'referer':_0x151ca4[_0x729e('0x48')],'browserName':_0x2439ac[_0x729e('0x49')]['name']&&_0x2439ac[_0x729e('0x49')]['version']?util[_0x729e('0x33')](_0x729e('0x4a'),_0x2439ac[_0x729e('0x49')][_0x729e('0x2e')],_0x2439ac[_0x729e('0x49')][_0x729e('0x4b')]):_0x729e('0x4c'),'browserVersion':_0x2439ac[_0x729e('0x49')]['version']||_0x729e('0x4c'),'osName':util[_0x729e('0x33')](_0x729e('0x4a'),_0x2439ac['os']['name'],_0x2439ac['os'][_0x729e('0x4b')]),'osVersion':_0x2439ac['os'][_0x729e('0x4b')],'deviceModel':_0x2439ac[_0x729e('0x4d')][_0x729e('0x4e')]&&_0x2439ac['device'][_0x729e('0x4f')]?util['format'](_0x729e('0x50'),_0x2439ac[_0x729e('0x4d')][_0x729e('0x4e')],_0x2439ac['device']['vendor'],_0x2439ac[_0x729e('0x4d')]['type']):null,'deviceVendor':_0x2439ac['device'][_0x729e('0x4f')],'deviceType':_0x2439ac[_0x729e('0x4d')]['type'],'formData':JSON['stringify'](_0x151ca4)};}exports['index']=function(_0x114088,_0x4fc991){var _0xcaf0dd={'include':[{'model':db['Pause'],'as':_0x729e('0x51')}]},_0x480a7d={},_0x42204c={'count':0x0,'rows':[]};var _0xc89dbf=_[_0x729e('0x3c')](db[_0x729e('0x52')]['rawAttributes'],function(_0x23f5ef){return{'name':_0x23f5ef['fieldName'],'type':_0x23f5ef[_0x729e('0x53')][_0x729e('0x54')]};});_0x480a7d[_0x729e('0x4e')]=_[_0x729e('0x3c')](_0xc89dbf,'name');_0x480a7d[_0x729e('0x55')]=_[_0x729e('0x56')](_0x114088[_0x729e('0x55')]);_0x480a7d[_0x729e('0x57')]=_[_0x729e('0x58')](_0x480a7d['model'],_0x480a7d[_0x729e('0x55')]);_0xcaf0dd['attributes']=_['intersection'](_0x480a7d[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x114088[_0x729e('0x55')][_0x729e('0x59')]));_0xcaf0dd['attributes']=_0xcaf0dd['attributes'][_0x729e('0x5a')]?_0xcaf0dd[_0x729e('0x5b')]:_0x480a7d[_0x729e('0x4e')];if(!_0x114088[_0x729e('0x55')]['hasOwnProperty'](_0x729e('0x5c'))){_0xcaf0dd['limit']=qs[_0x729e('0x24')](_0x114088[_0x729e('0x55')][_0x729e('0x24')]);_0xcaf0dd['offset']=qs[_0x729e('0x23')](_0x114088[_0x729e('0x55')]['offset']);}_0xcaf0dd[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x114088[_0x729e('0x55')][_0x729e('0x5e')]);_0xcaf0dd[_0x729e('0x5f')]=qs[_0x729e('0x57')](_[_0x729e('0x60')](_0x114088[_0x729e('0x55')],_0x480a7d[_0x729e('0x57')]),_0xc89dbf);if(_0x114088[_0x729e('0x55')]['filter']){_0xcaf0dd['where']=_[_0x729e('0x61')](_0xcaf0dd[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0xc89dbf,function(_0x208299){if(_0x208299['type']!==_0x729e('0x62')){var _0x40a5e2={};_0x40a5e2[_0x208299['name']]={'$like':'%'+_0x114088[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x40a5e2;}})});}_0xcaf0dd=_[_0x729e('0x61')]({},_0xcaf0dd,_0x114088[_0x729e('0x64')]);var _0x55bc83={'where':_0xcaf0dd['where']};return db[_0x729e('0x52')]['count'](_0x55bc83)['then'](function(_0x58171d){_0x42204c[_0x729e('0x26')]=_0x58171d;if(_0x114088['query']['includeAll']){_0xcaf0dd['include']=[{'all':!![]}];}return db[_0x729e('0x52')][_0x729e('0x65')](_0xcaf0dd);})[_0x729e('0x15')](function(_0x563a4a){_0x42204c['rows']=_0x563a4a;return _0x42204c;})[_0x729e('0x15')](respondWithFilteredResult(_0x4fc991,_0xcaf0dd))[_0x729e('0x3a')](handleError(_0x4fc991,null));};exports[_0x729e('0x66')]=function(_0x57eea5,_0x5c455e){var _0x5062ff={'raw':![],'where':{'id':_0x57eea5[_0x729e('0x67')]['id']},'include':[{'model':db[_0x729e('0x68')],'as':'mandatoryDispositionPause'}]},_0x4f51dd={};_0x4f51dd[_0x729e('0x4e')]=_[_0x729e('0x56')](db[_0x729e('0x52')]['rawAttributes']);_0x4f51dd[_0x729e('0x55')]=_[_0x729e('0x56')](_0x57eea5[_0x729e('0x55')]);_0x4f51dd[_0x729e('0x57')]=_[_0x729e('0x58')](_0x4f51dd[_0x729e('0x4e')],_0x4f51dd[_0x729e('0x55')]);_0x5062ff['attributes']=_[_0x729e('0x58')](_0x4f51dd[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x57eea5[_0x729e('0x55')]['fields']));_0x5062ff[_0x729e('0x5b')]=_0x5062ff[_0x729e('0x5b')]['length']?_0x5062ff[_0x729e('0x5b')]:_0x4f51dd[_0x729e('0x4e')];if(_0x57eea5[_0x729e('0x55')]['includeAll']){_0x5062ff[_0x729e('0x69')]=[{'all':!![]}];}_0x5062ff=_['merge']({},_0x5062ff,_0x57eea5[_0x729e('0x64')]);return db[_0x729e('0x52')][_0x729e('0x6a')](_0x5062ff)['then'](handleEntityNotFound(_0x5c455e,null))[_0x729e('0x15')](respondWithResult(_0x5c455e,null))['catch'](handleError(_0x5c455e,null));};exports[_0x729e('0x6b')]=function(_0x2280b6,_0x4f6697){return db['ChatWebsite'][_0x729e('0x6b')](_0x2280b6['body'],{})[_0x729e('0x15')](function(_0x522c0d){var _0x4904fb=_0x2280b6[_0x729e('0x6c')][_0x729e('0x2b')]({'plain':!![]});if(!_0x4904fb)throw new Error(_0x729e('0x6d'));if(_0x4904fb['role']==='user'){var _0x23eca6=_0x522c0d[_0x729e('0x2b')]({'plain':!![]});var _0x191770=_0x729e('0x6e');return db[_0x729e('0x6f')]['find']({'where':{'name':_0x191770,'userProfileId':_0x4904fb['userProfileId']},'raw':!![]})[_0x729e('0x15')](function(_0x3f58d2){if(_0x3f58d2&&_0x3f58d2[_0x729e('0x70')]===0x0){return db[_0x729e('0x2c')][_0x729e('0x6b')]({'name':_0x23eca6[_0x729e('0x2e')],'resourceId':_0x23eca6['id'],'type':_0x3f58d2[_0x729e('0x2e')],'sectionId':_0x3f58d2['id']},{})[_0x729e('0x15')](function(){return _0x522c0d;});}else{return _0x522c0d;}})[_0x729e('0x3a')](function(_0x3fca19){logger[_0x729e('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fca19);throw _0x3fca19;});}return _0x522c0d;})[_0x729e('0x15')](respondWithResult(_0x4f6697,0xc9))[_0x729e('0x3a')](handleError(_0x4f6697,null));};exports[_0x729e('0x29')]=function(_0x37e2a8,_0x49f740){if(_0x37e2a8[_0x729e('0x71')]['id']){delete _0x37e2a8[_0x729e('0x71')]['id'];}return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x37e2a8[_0x729e('0x67')]['id']},'include':[{'model':db[_0x729e('0x68')],'as':'mandatoryDispositionPause'}]})[_0x729e('0x15')](handleEntityNotFound(_0x49f740,null))[_0x729e('0x15')](saveUpdates(_0x37e2a8[_0x729e('0x71')],null))[_0x729e('0x15')](respondWithResult(_0x49f740,null))['catch'](handleError(_0x49f740,null));};exports[_0x729e('0x2a')]=function(_0x2a7b38,_0x148785){return db[_0x729e('0x52')]['find']({'where':{'id':_0x2a7b38[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x148785,null))[_0x729e('0x15')](removeEntity(_0x148785,null))[_0x729e('0x3a')](handleError(_0x148785,null));};exports['describe']=function(_0x6c7397,_0x3df6da){return db[_0x729e('0x52')][_0x729e('0x72')]()['then'](respondWithResult(_0x3df6da,null))[_0x729e('0x3a')](handleError(_0x3df6da,null));};exports['addDisposition']=function(_0x152b87,_0xfd10f6){if(_0x152b87['body']['id']){delete _0x152b87[_0x729e('0x71')]['id'];}return db['ChatWebsite'][_0x729e('0x6a')]({'where':{'id':_0x152b87['params']['id']}})[_0x729e('0x15')](handleEntityNotFound(_0xfd10f6,null))[_0x729e('0x15')](function(_0x547139){if(_0x547139){_0x152b87['body'][_0x729e('0x73')]=_0x547139['id'];return db[_0x729e('0x74')]['create'](_0x152b87[_0x729e('0x71')]);}})[_0x729e('0x15')](respondWithResult(_0xfd10f6,null))[_0x729e('0x3a')](handleError(_0xfd10f6,null));};exports[_0x729e('0x75')]=function(_0x23b0fd,_0x287f41){var _0x3810ae={'raw':![],'where':{}};var _0x45f6f9={};var _0x3a2a10={'count':0x0,'rows':[]};return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0x23b0fd[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x287f41,null))[_0x729e('0x15')](function(_0x465f76){if(_0x465f76){_0x45f6f9['model']=_[_0x729e('0x56')](db['Disposition'][_0x729e('0x77')]);_0x45f6f9[_0x729e('0x55')]=_['keys'](_0x23b0fd[_0x729e('0x55')]);_0x45f6f9[_0x729e('0x57')]=_[_0x729e('0x58')](_0x45f6f9[_0x729e('0x4e')],_0x45f6f9[_0x729e('0x55')]);_0x3810ae[_0x729e('0x5b')]=_[_0x729e('0x58')](_0x45f6f9[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x23b0fd[_0x729e('0x55')]['fields']));_0x3810ae[_0x729e('0x5b')]=_0x3810ae[_0x729e('0x5b')]['length']?_0x3810ae[_0x729e('0x5b')]:_0x45f6f9[_0x729e('0x4e')];if(!_0x23b0fd[_0x729e('0x55')]['hasOwnProperty']('nolimit')){_0x3810ae[_0x729e('0x24')]=qs[_0x729e('0x24')](_0x23b0fd[_0x729e('0x55')][_0x729e('0x24')]);_0x3810ae['offset']=qs['offset'](_0x23b0fd[_0x729e('0x55')]['offset']);}_0x3810ae[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x23b0fd['query'][_0x729e('0x5e')]);_0x3810ae['where']=qs['filters'](_[_0x729e('0x60')](_0x23b0fd['query'],_0x45f6f9[_0x729e('0x57')]));_0x3810ae[_0x729e('0x5f')][_0x729e('0x73')]=_0x465f76['id'];if(_0x23b0fd[_0x729e('0x55')]['filter']){_0x3810ae[_0x729e('0x5f')]=_[_0x729e('0x61')](_0x3810ae[_0x729e('0x5f')],{'$or':_['map'](_0x3810ae[_0x729e('0x5b')],function(_0x3c80c7){var _0x30994d={};_0x30994d[_0x3c80c7]={'$like':'%'+_0x23b0fd[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x30994d;})});}_0x3810ae=_['merge']({},_0x3810ae,_0x23b0fd[_0x729e('0x64')]);return db[_0x729e('0x74')][_0x729e('0x26')]({'where':_0x3810ae[_0x729e('0x5f')]})['then'](function(_0x21b783){_0x3a2a10[_0x729e('0x26')]=_0x21b783;if(_0x23b0fd['query'][_0x729e('0x78')]){_0x3810ae[_0x729e('0x69')]=[{'all':!![]}];}return db['Disposition'][_0x729e('0x65')](_0x3810ae);})[_0x729e('0x15')](function(_0x549b07){_0x3a2a10[_0x729e('0x79')]=_0x549b07;return _0x3a2a10;});}})[_0x729e('0x15')](respondWithFilteredResult(_0x287f41,_0x3810ae))[_0x729e('0x3a')](handleError(_0x287f41,null));};exports[_0x729e('0x7a')]=function(_0x48b570,_0x380f9e){return db['ChatWebsite'][_0x729e('0x6a')]({'where':{'id':_0x48b570[_0x729e('0x67')]['id']}})['then'](handleEntityNotFound(_0x380f9e,null))['then'](function(_0x2aa30a){if(_0x2aa30a){return _0x2aa30a['removeDispositions'](_0x48b570[_0x729e('0x55')]['ids']);}})[_0x729e('0x15')](respondWithStatusCode(_0x380f9e,null))[_0x729e('0x3a')](handleError(_0x380f9e,null));};exports[_0x729e('0x7b')]=function(_0x17aae4,_0x4832ba){if(_0x17aae4['body']['id']){delete _0x17aae4['body']['id'];}return db['ChatWebsite'][_0x729e('0x6a')]({'where':{'id':_0x17aae4[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x4832ba,null))[_0x729e('0x15')](function(_0x22f92a){if(_0x22f92a){_0x17aae4[_0x729e('0x71')][_0x729e('0x73')]=_0x22f92a['id'];return db[_0x729e('0x7c')][_0x729e('0x6b')](_0x17aae4[_0x729e('0x71')]);}})[_0x729e('0x15')](respondWithResult(_0x4832ba,null))[_0x729e('0x3a')](handleError(_0x4832ba,null));};exports['getAnswers']=function(_0x59c9c9,_0x2a08f0){var _0x220916={'raw':![],'where':{}};var _0x5a5312={};var _0x5bc0a3={'count':0x0,'rows':[]};return db[_0x729e('0x52')]['findOne']({'where':{'id':_0x59c9c9[_0x729e('0x67')]['id']}})['then'](handleEntityNotFound(_0x2a08f0,null))[_0x729e('0x15')](function(_0x2054f2){if(_0x2054f2){_0x5a5312[_0x729e('0x4e')]=_[_0x729e('0x56')](db['CannedAnswer'][_0x729e('0x77')]);_0x5a5312[_0x729e('0x55')]=_['keys'](_0x59c9c9[_0x729e('0x55')]);_0x5a5312['filters']=_[_0x729e('0x58')](_0x5a5312[_0x729e('0x4e')],_0x5a5312['query']);_0x220916['attributes']=_[_0x729e('0x58')](_0x5a5312[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x59c9c9[_0x729e('0x55')][_0x729e('0x59')]));_0x220916[_0x729e('0x5b')]=_0x220916[_0x729e('0x5b')]['length']?_0x220916[_0x729e('0x5b')]:_0x5a5312[_0x729e('0x4e')];if(!_0x59c9c9[_0x729e('0x55')][_0x729e('0x7d')](_0x729e('0x5c'))){_0x220916[_0x729e('0x24')]=qs['limit'](_0x59c9c9[_0x729e('0x55')][_0x729e('0x24')]);_0x220916[_0x729e('0x23')]=qs[_0x729e('0x23')](_0x59c9c9[_0x729e('0x55')][_0x729e('0x23')]);}_0x220916[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x59c9c9[_0x729e('0x55')][_0x729e('0x5e')]);_0x220916[_0x729e('0x5f')]=qs[_0x729e('0x57')](_[_0x729e('0x60')](_0x59c9c9[_0x729e('0x55')],_0x5a5312['filters']));_0x220916[_0x729e('0x5f')][_0x729e('0x73')]=_0x2054f2['id'];if(_0x59c9c9[_0x729e('0x55')]['filter']){_0x220916[_0x729e('0x5f')]=_[_0x729e('0x61')](_0x220916[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0x220916[_0x729e('0x5b')],function(_0x277465){var _0x5e47b1={};_0x5e47b1[_0x277465]={'$like':'%'+_0x59c9c9['query'][_0x729e('0x63')]+'%'};return _0x5e47b1;})});}_0x220916=_[_0x729e('0x61')]({},_0x220916,_0x59c9c9[_0x729e('0x64')]);return db['CannedAnswer']['count']({'where':_0x220916[_0x729e('0x5f')]})[_0x729e('0x15')](function(_0x3914c6){_0x5bc0a3['count']=_0x3914c6;if(_0x59c9c9[_0x729e('0x55')][_0x729e('0x78')]){_0x220916['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x220916);})[_0x729e('0x15')](function(_0x2071a9){_0x5bc0a3['rows']=_0x2071a9;return _0x5bc0a3;});}})['then'](respondWithFilteredResult(_0x2a08f0,_0x220916))[_0x729e('0x3a')](handleError(_0x2a08f0,null));};exports['removeAnswers']=function(_0xb25802,_0x362ab7){return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0xb25802[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x362ab7,null))[_0x729e('0x15')](function(_0x58bbc6){if(_0x58bbc6){return _0x58bbc6[_0x729e('0x7e')](_0xb25802[_0x729e('0x55')][_0x729e('0x7f')]);}})[_0x729e('0x15')](respondWithStatusCode(_0x362ab7,null))['catch'](handleError(_0x362ab7,null));};exports[_0x729e('0x80')]=function(_0x173974,_0x413a56){_0x173974[_0x729e('0x71')][_0x729e('0x81')]=_0x173974[_0x729e('0x82')][_0x729e('0x83')];return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x173974['params']['id']}})['then'](handleEntityNotFound(_0x413a56,null))[_0x729e('0x15')](saveUpdates(_0x173974[_0x729e('0x71')],null))[_0x729e('0x15')](respondWithResult(_0x413a56,null))[_0x729e('0x3a')](handleError(_0x413a56,null));};exports[_0x729e('0x84')]=function(_0x9ac046,_0x17d526){_0x9ac046[_0x729e('0x71')][_0x729e('0x85')]=_0x9ac046[_0x729e('0x82')][_0x729e('0x83')];return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x9ac046[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x17d526,null))[_0x729e('0x15')](saveUpdates(_0x9ac046[_0x729e('0x71')],null))[_0x729e('0x15')](respondWithResult(_0x17d526,null))[_0x729e('0x3a')](handleError(_0x17d526,null));};exports[_0x729e('0x86')]=function(_0x16cd4d,_0x17890d){_0x16cd4d[_0x729e('0x71')][_0x729e('0x87')]=_0x16cd4d[_0x729e('0x82')][_0x729e('0x83')];return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x16cd4d[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x17890d,null))[_0x729e('0x15')](saveUpdates(_0x16cd4d[_0x729e('0x71')],null))[_0x729e('0x15')](respondWithResult(_0x17890d,null))[_0x729e('0x3a')](handleError(_0x17890d,null));};exports[_0x729e('0x88')]=function(_0x58f92f,_0x2dee8c){_0x58f92f['body'][_0x729e('0x89')]=_0x58f92f['file'][_0x729e('0x83')];return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x58f92f[_0x729e('0x67')]['id']}})['then'](handleEntityNotFound(_0x2dee8c,null))[_0x729e('0x15')](saveUpdates(_0x58f92f['body'],null))['then'](respondWithResult(_0x2dee8c,null))[_0x729e('0x3a')](handleError(_0x2dee8c,null));};exports['getLogo']=function(_0x84eb29,_0x39f62d){var _0x444cbd=path['join'](config[_0x729e('0x8a')],_0x729e('0x8b'));var _0x559afb={'where':{'id':_0x84eb29[_0x729e('0x67')]['id']},'attributes':['id',_0x729e('0x81')],'raw':!![]};var _0x1e6a44=![];return require(_0x729e('0x8c'))[_0x729e('0x8d')]()['then'](function(_0x512c6f){if(_0x512c6f){_0x1e6a44=_0x512c6f[_0x729e('0x8e')];}})[_0x729e('0x15')](function(){return db[_0x729e('0x52')]['find'](_0x559afb);})[_0x729e('0x15')](handleEntityNotFound(_0x39f62d,null))[_0x729e('0x15')](function(_0x24c57f){if(_0x24c57f){if(!_[_0x729e('0x8f')](_0x24c57f['sitepic'])){if(fs[_0x729e('0x90')](path[_0x729e('0x91')](config[_0x729e('0x8a')],'server/files/images/logos/',_0x24c57f['sitepic']))&&_0x1e6a44){_0x444cbd=path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x92'),_0x24c57f[_0x729e('0x81')]);}}return _0x39f62d[_0x729e('0x93')](_0x444cbd);}})['catch'](handleError(_0x39f62d,null));};exports[_0x729e('0x94')]=function(_0x5acb41,_0x57bd91){var _0x3b4ce3=path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x95'));var _0x4b5e01={'where':{'id':_0x5acb41[_0x729e('0x67')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x729e('0x52')][_0x729e('0x6a')](_0x4b5e01)[_0x729e('0x15')](handleEntityNotFound(_0x57bd91,null))['then'](function(_0x582c62){if(_0x582c62){if(!_[_0x729e('0x8f')](_0x582c62[_0x729e('0x85')])){if(fs['existsSync'](path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x96'),_0x582c62[_0x729e('0x85')]))){_0x3b4ce3=path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x96'),_0x582c62[_0x729e('0x85')]);}}return _0x57bd91['download'](_0x3b4ce3);}})[_0x729e('0x3a')](handleError(_0x57bd91,null));};exports[_0x729e('0x97')]=function(_0x2ff2fd,_0x567e5c){var _0x3083f7=path[_0x729e('0x91')](config[_0x729e('0x8a')],'server/files/images/avatars/customer_avatar.png');var _0x2d5409={'where':{'id':_0x2ff2fd[_0x729e('0x67')]['id']},'attributes':['id',_0x729e('0x87'),_0x729e('0x98')],'raw':!![]};return db[_0x729e('0x52')][_0x729e('0x6a')](_0x2d5409)[_0x729e('0x15')](handleEntityNotFound(_0x567e5c,null))[_0x729e('0x15')](function(_0x2fd11a){if(_0x2fd11a){if(!_[_0x729e('0x8f')](_0x2fd11a[_0x729e('0x87')])){if(fs[_0x729e('0x90')](path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x96'),_0x2fd11a[_0x729e('0x87')]))&&_0x2fd11a[_0x729e('0x98')]){_0x3083f7=path[_0x729e('0x91')](config['root'],_0x729e('0x96'),_0x2fd11a[_0x729e('0x87')]);}}return _0x567e5c[_0x729e('0x93')](_0x3083f7);}})[_0x729e('0x3a')](handleError(_0x567e5c,null));};exports['getSystemAvatar']=function(_0x3f85e4,_0x76f5f6){var _0x58830c=path[_0x729e('0x91')](config['root'],_0x729e('0x99'));var _0x161ce6={'where':{'id':_0x3f85e4[_0x729e('0x67')]['id']},'attributes':['id',_0x729e('0x89')],'raw':!![]};return db[_0x729e('0x52')][_0x729e('0x6a')](_0x161ce6)[_0x729e('0x15')](handleEntityNotFound(_0x76f5f6,null))[_0x729e('0x15')](function(_0x1c0bdf){if(_0x1c0bdf){if(!_[_0x729e('0x8f')](_0x1c0bdf['systemAvatar'])){if(fs[_0x729e('0x90')](path['join'](config[_0x729e('0x8a')],_0x729e('0x96'),_0x1c0bdf[_0x729e('0x89')]))){_0x58830c=path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0x96'),_0x1c0bdf['systemAvatar']);}}return _0x76f5f6[_0x729e('0x93')](_0x58830c);}})['catch'](handleError(_0x76f5f6,null));};exports[_0x729e('0x9a')]=function(_0x371166,_0x1ae26a){var _0x455cf6={'body':_0x371166[_0x729e('0x71')],'channel':_0x729e('0x9b')};var _0x3942c1=[];var _0x1ffade=[];var _0x56c7c1={};var _0x247885=![];return db['CmContact'][_0x729e('0x72')]()[_0x729e('0x15')](function(_0x3b11a8){if(!_0x3b11a8){throw new db['Sequelize']['ValidationError'](_0x729e('0x9c'));}_0x3942c1=_[_0x729e('0x9d')](_['keys'](_0x3b11a8),[_0x729e('0x9e'),'updatedAt']);_0x1ffade=_[_0x729e('0x9d')](_[_0x729e('0x56')](_0x3b11a8),[_0x729e('0x9e'),_0x729e('0x9f'),'CompanyId',_0x729e('0xa0')]);if(_0x371166['body']['id']){delete _0x371166['body']['id'];}if(_[_0x729e('0x8f')](_0x371166['body'][_0x729e('0xa1')])){throw new db[(_0x729e('0xa2'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x729e('0x8f')](_0x371166[_0x729e('0x71')]['body'])||_0x371166[_0x729e('0x71')][_0x729e('0x71')]===''){throw new db[(_0x729e('0xa2'))][(_0x729e('0xa3'))](_0x729e('0xa4'));}if(_[_0x729e('0x8f')](_0x371166['body'][_0x729e('0xa5')])){throw new db[(_0x729e('0xa2'))][(_0x729e('0xa3'))](_0x729e('0xa6')+_0x1ffade);}if(!_[_0x729e('0xa7')](_0x1ffade,_0x371166[_0x729e('0x71')][_0x729e('0xa5')])){throw new db[(_0x729e('0xa2'))][(_0x729e('0xa3'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ffade);}_0x56c7c1[_0x371166['body'][_0x729e('0xa5')]]=_0x371166[_0x729e('0x71')]['from'];})[_0x729e('0x15')](function(){return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x371166[_0x729e('0x67')]['id']},'include':[{'model':db[_0x729e('0xa8')],'as':'List','include':[{'model':db[_0x729e('0xa9')],'as':_0x729e('0xaa'),'where':_0x56c7c1,'limit':0x1,'order':[[_0x729e('0x9f'),_0x729e('0xab')]]}]},{'model':db[_0x729e('0xac')],'as':'Applications'},{'model':db[_0x729e('0x3d')],'as':_0x729e('0x3d'),'include':[{'model':db[_0x729e('0x3d')],'as':'Intervals','attributes':['id',_0x729e('0x34')],'raw':!![]}]}]});})[_0x729e('0x15')](function(_0x1c3d5a){if(!_0x1c3d5a)throw new APINotFoundError(util[_0x729e('0x33')](_0x729e('0xad'),_0x371166[_0x729e('0x67')]['id']));if(!_0x1c3d5a[_0x729e('0x3d')]||!_0x1c3d5a[_0x729e('0x3d')]['Intervals'])return[_0x1c3d5a,!![]];return[_0x1c3d5a,checkWebsiteIntervals(_0x1c3d5a)];})[_0x729e('0xae')](function(_0xb5eb5b,_0x1634d0){if(!_0x1634d0)throw new APIOutOfIntervalError();if(!_0xb5eb5b[_0x729e('0xaf')])return;_0x455cf6[_0x729e('0xb0')]=_0xb5eb5b;_0x455cf6[_0x729e('0xb1')]=_0xb5eb5b['List'];_0x455cf6[_0x729e('0xb2')]=_[_0x729e('0xb3')](_0xb5eb5b['Applications'],[_0x729e('0xb4')],['asc']);if(_0x455cf6['account']['Applications']){delete _0x455cf6[_0x729e('0xb0')][_0x729e('0xb5')];}if(_0x455cf6[_0x729e('0xb0')][_0x729e('0xaf')]&&_0x455cf6[_0x729e('0xb0')][_0x729e('0xaf')][_0x729e('0xaa')][_0x729e('0x5a')]){return _0x455cf6[_0x729e('0xb0')]['List'][_0x729e('0xaa')][0x0];}var _0x476685=_[_0x729e('0xd')](_0x371166[_0x729e('0x71')],{'firstName':_0x371166[_0x729e('0x71')][_0x729e('0xa1')],'ListId':_0xb5eb5b['ListId']});_0x476685[_0x371166[_0x729e('0x71')]['mapKey']]=_0x371166['body'][_0x729e('0xa1')];return db[_0x729e('0xa9')][_0x729e('0x6b')](_0x476685,{'fields':_0x3942c1,'raw':!![]});})[_0x729e('0x15')](function(_0x28129d){_0x455cf6[_0x729e('0xb6')]=_0x28129d;var _0x27b658=createInteractionObject(_0x371166[_0x729e('0x67')]['id'],_0x371166[_0x729e('0x71')],_0x371166[_0x729e('0xb7')],_0x28129d);var _0x24fe63={'ChatWebsiteId':_0x371166[_0x729e('0x67')]['id'],'closed':![]};if(_0x371166[_0x729e('0x71')]['threadId']){_0x24fe63['threadId']=_0x371166[_0x729e('0x71')]['threadId'];return db[_0x729e('0xb8')][_0x729e('0x6a')]({'where':_0x24fe63})[_0x729e('0x15')](function(_0x3ecbce){if(_0x3ecbce){_0x247885=!![];return _0x3ecbce;}_0x27b658[_0x729e('0xb9')]=_0x371166['body'][_0x729e('0xb9')];_0x27b658[_0x729e('0xba')]=_0x371166['body']['externalUrl'];return db[_0x729e('0xb8')]['create'](_0x27b658);});}_0x24fe63[_0x729e('0xbb')]=_0x28129d['id'];if(_0x371166[_0x729e('0x71')][_0x729e('0xbc')]&&_0x371166[_0x729e('0x71')][_0x729e('0xbc')]['id']){_0x24fe63['id']=_0x371166[_0x729e('0x71')][_0x729e('0xbc')]['id'];return db[_0x729e('0xb8')][_0x729e('0x6a')]({'where':_0x24fe63})[_0x729e('0x15')](function(_0x19192c){if(_0x19192c){_0x247885=!![];return _0x19192c;}return db[_0x729e('0xb8')][_0x729e('0x6b')](_0x27b658);});}return db['ChatInteraction'][_0x729e('0x6b')](_0x27b658);})['then'](function(_0x17b5ee){if(!_0x247885)return _0x17b5ee;var _0x3a8e49={'from':(_0x455cf6[_0x729e('0xb6')]['firstName']||'')+'\x20'+(_0x455cf6[_0x729e('0xb6')][_0x729e('0x46')]||'')};if(_0x371166['body']['threadId']&&_0x371166[_0x729e('0x71')][_0x729e('0xbd')]&&_0x371166['body'][_0x729e('0xb9')]!=_0x371166[_0x729e('0x71')]['messageId']){_0x3a8e49[_0x729e('0xb9')]=_0x371166[_0x729e('0x71')]['messageId'];}return _0x17b5ee[_0x729e('0x29')](_0x3a8e49);})[_0x729e('0x15')](function(_0x45d152){_0x455cf6['interaction']=_0x45d152[_0x729e('0x2b')]({'plain':!![]});_0x455cf6[_0x729e('0xbc')]['created']=!_0x247885;if(_0x455cf6[_0x729e('0xbc')]['created']){if(_0x455cf6[_0x729e('0xb0')]['autoclose']){_0x455cf6[_0x729e('0xb2')][_0x729e('0xbe')]({'id':0x0,'priority':_0x455cf6[_0x729e('0xb2')][_0x729e('0x5a')]+0x1,'app':_0x729e('0xbf'),'appdata':_0x729e('0xc0'),'interval':_0x729e('0xc1')});}}return db['ChatMessage'][_0x729e('0x6b')]({'body':_0x371166[_0x729e('0x71')][_0x729e('0x71')],'ChatWebsiteId':_0x371166['params']['id'],'ChatInteractionId':_0x45d152['id'],'direction':'in','ContactId':_0x455cf6[_0x729e('0xb6')]['id'],'AttachmentId':_0x371166[_0x729e('0x71')][_0x729e('0xc2')]});})[_0x729e('0x15')](function(_0x399c64){_0x455cf6[_0x729e('0x1e')]=_0x399c64;if(!_0x455cf6[_0x729e('0xbc')][_0x729e('0xc3')]){return;}return db[_0x729e('0xc4')][_0x729e('0x6a')]({'attributes':['id',_0x729e('0x2e')],'where':{'id':_0x455cf6[_0x729e('0xbc')][_0x729e('0xc3')]}});})[_0x729e('0x15')](function(_0x36c609){if(_0x36c609){_0x455cf6[_0x729e('0xb2')][_0x729e('0xc5')]({'id':0x0,'priority':0x0,'app':_0x729e('0xc6'),'appdata':_0x36c609[_0x729e('0x2e')]+','+(_0x455cf6['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x455cf6[_0x729e('0xc7')]=!![];}if(!_0x455cf6[_0x729e('0xbc')][_0x729e('0xc8')]){return;}return db[_0x729e('0xc9')][_0x729e('0x6a')]({'attributes':['id','name'],'where':{'id':_0x455cf6[_0x729e('0xbc')]['queueId']}});})[_0x729e('0x15')](function(_0x338cd4){if(_0x338cd4){_0x455cf6['applications'][_0x729e('0xc5')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x338cd4[_0x729e('0x2e')]+','+(_0x455cf6[_0x729e('0xb0')][_0x729e('0xca')]||0x12c),'interval':_0x729e('0xc1')});}return respondWithRpcPromise(_0x729e('0xcb'),_0x729e('0xcc'),_0x455cf6);})[_0x729e('0x15')](function(_0x16ffe6){respondWithRpcPromise(_0x729e('0xcd'),_0x729e('0xcd'),{'event':_0x729e('0x9a'),'message':_0x16ffe6},client9002);return _0x16ffe6;})[_0x729e('0x15')](respondWithResult(_0x1ae26a,null))[_0x729e('0x3a')](APIHandleError(_0x1ae26a));};exports[_0x729e('0xce')]=function(_0xbcadc,_0xf647a4){var _0x277fb4,_0x59ee54,_0x550db3;var _0x471b65=[];var _0x497ee7={};var _0x25a976=_0xbcadc['files']||[];var _0x18ed32=[];var _0x1d22a8;return db[_0x729e('0xa9')][_0x729e('0x72')]()[_0x729e('0x15')](function(_0x29c3a6){if(!_0x29c3a6){throw new db[(_0x729e('0xa2'))][(_0x729e('0xa3'))]('no\x20available\x20attributes');}_0x471b65=_['difference'](_[_0x729e('0x56')](_0x29c3a6),[_0x729e('0x9e'),_0x729e('0x9f'),_0x729e('0xcf'),'ListId']);if(_0xbcadc[_0x729e('0x71')]['id']){delete _0xbcadc[_0x729e('0x71')]['id'];}if(_[_0x729e('0x8f')](_0xbcadc[_0x729e('0x71')][_0x729e('0xa1')])){throw _0xf647a4[_0x729e('0x21')](0x1f4)[_0x729e('0x2f')](new db['Sequelize'][(_0x729e('0xa3'))](_0x729e('0xd0')));}if(_['isNil'](_0xbcadc[_0x729e('0x71')][_0x729e('0x71')])||_0xbcadc[_0x729e('0x71')][_0x729e('0x71')]===''){throw _0xf647a4[_0x729e('0x21')](0x1f4)[_0x729e('0x2f')](new db[(_0x729e('0xa2'))]['ValidationError'](_0x729e('0xa4')));}if(_[_0x729e('0x8f')](_0xbcadc[_0x729e('0x71')][_0x729e('0xd1')])){throw _0xf647a4[_0x729e('0x21')](0x1f4)[_0x729e('0x2f')](new db[(_0x729e('0xa2'))][(_0x729e('0xa3'))](_0x729e('0xd2')+_0x471b65));}if(!_[_0x729e('0xa7')](_0x471b65,_0xbcadc[_0x729e('0x71')][_0x729e('0xd1')])){throw _0xf647a4[_0x729e('0x21')](0x1f4)[_0x729e('0x2f')](new db['Sequelize'][(_0x729e('0xa3'))](_0x729e('0xd3')+_0x471b65));}_0x497ee7[_0xbcadc[_0x729e('0x71')]['mapKeyOffline']]=_0xbcadc[_0x729e('0x71')][_0x729e('0xa1')];})[_0x729e('0x15')](function(){return db[_0x729e('0x52')]['find']({'where':{'id':_0xbcadc[_0x729e('0x67')]['id']},'include':[{'model':db[_0x729e('0xa8')],'as':_0x729e('0xaf')},{'model':db[_0x729e('0xd4')],'as':_0x729e('0xd4')}]});})['then'](handleEntityNotFound(_0xf647a4,null))[_0x729e('0x15')](function(_0x365bce){if(_0x365bce&&_0x365bce[_0x729e('0xaf')]){_0x59ee54=_0x365bce;var _0x21cf6a=_[_0x729e('0xd')](_0xbcadc[_0x729e('0x71')],{'firstName':_0xbcadc[_0x729e('0x71')][_0x729e('0xa1')],'phone':_0xbcadc[_0x729e('0x71')]['from'],'ListId':_0x365bce[_0x729e('0xa0')]});_0x21cf6a[_0xbcadc[_0x729e('0x71')][_0x729e('0xd1')]]=_0xbcadc[_0x729e('0x71')][_0x729e('0xa1')];return db[_0x729e('0xa9')][_0x729e('0xd5')]({'where':_0x497ee7,'defaults':_0x21cf6a});}})['spread'](function(_0x3a4c09){if(_0x3a4c09){_0x550db3=_0x3a4c09;var _0x3910e2=fs[_0x729e('0xd6')](path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0xd7')),'utf8');var _0xc13dd5=ejs[_0x729e('0xd8')](_0x3910e2,{'body':_['toPairs'](_0xbcadc['body'][_0x729e('0x71')]),'bodyTitle':_0x59ee54[_0x729e('0xd9')]});return db['ChatOfflineMessage'][_0x729e('0x6b')]({'body':_0xc13dd5,'plainBody':htmlToText['fromString'](_0xc13dd5),'ContactId':_0x3a4c09['id'],'ChatWebsiteId':_0x59ee54['id']});}})[_0x729e('0x15')](function(_0x14cc38){_0x1d22a8=_0x14cc38;if(_0x25a976[_0x729e('0x5a')]){var _0x4dfd47=_0x25a976[_0x729e('0x3c')](function(_0x1d79b8){return{'name':_0x1d79b8['originalname'],'basename':_0x1d79b8[_0x729e('0x83')],'type':_0x1d79b8[_0x729e('0xda')],'ChatOfflineMessageId':_0x14cc38['id']};});_0x18ed32=_0x4dfd47[_0x729e('0x3c')](_0x574607=>{var _0x4b46b8={'filename':_0x574607[_0x729e('0x2e')],'path':path['join'](config[_0x729e('0x8a')],_0x729e('0xdb'),_0x729e('0xdc'),_0x729e('0xdd'),_0x729e('0xde'),_0x574607['basename'])};return _0x4b46b8;});if(!_0x59ee54[_0x729e('0xdf')]){return db[_0x729e('0xe0')][_0x729e('0xe1')](function(_0x5e00e1){return db[_0x729e('0xe2')][_0x729e('0xe3')](_0x4dfd47,{'transaction':_0x5e00e1});});}}})['then'](function(){if(_0x1d22a8){_0x277fb4=_0x1d22a8;return db[_0x729e('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x729e('0xe4')],'as':_0x729e('0xe5'),'raw':!![],'include':[{'model':db[_0x729e('0xe6')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x729e('0x15')](function(_0x3c04a9){if(_0x3c04a9&&_0x3c04a9[_0x729e('0xe5')]&&_0x59ee54[_0x729e('0xe7')]&&_0x59ee54['forwardOfflineAddress']){var _0x25ee83=_0x3c04a9[_0x729e('0xe8')]();return respondWithRpcPromise(_0x729e('0xe9'),'sendMail',{'account':_0x25ee83,'message':{'from':util[_0x729e('0x33')](_0x729e('0xea'),_0x3c04a9['name'],_0x3c04a9[_0x729e('0xeb')]||_0x3c04a9[_0x729e('0xe5')]['user']),'to':_0x59ee54[_0x729e('0xec')],'subject':_0x59ee54['offlineMessageSubject'],'html':_0x277fb4[_0x729e('0x71')],'attachments':_0x18ed32}},client9003)['then'](function(){return _0x277fb4;})[_0x729e('0x3a')](function(_0x25ea58){logger[_0x729e('0x1c')](_0x25ea58);});}})[_0x729e('0x15')](function(){if(_0x59ee54&&_0x59ee54['openNewInteraction']&&_0x59ee54[_0x729e('0xed')]){var _0x5bae9a=[];if(_0x25a976['length']){_0x5bae9a=_0x25a976[_0x729e('0x3c')](function(_0xd681ad){return{'name':_0xd681ad[_0x729e('0xee')],'basename':_0xd681ad['filename'],'type':_0xd681ad[_0x729e('0xda')],'ChatOfflineMessageId':_0x1d22a8['id']};});}var _0xee97c0;if(!_[_0x729e('0x8f')](_0x59ee54[_0x729e('0xef')])){var _0x1cf2ef=_[_0x729e('0x3c')](_0xbcadc[_0x729e('0x71')],function(_0x2ad60e){return _0x2ad60e;});var _0x4e9555=_[_0x729e('0xf0')](_0x1cf2ef)[0x0];var _0x5b7332=_[_0x729e('0xf1')](_0x4e9555,function(_0x9b9fa6){return _0x9b9fa6;});_0xee97c0=_0x5b7332[0x1][_0x59ee54[_0x729e('0xef')]];}var _0x2a4785={'from':_0x550db3[_0x729e('0xeb')],'firstName':_0x550db3[_0x729e('0xf2')],'lastName':_0x550db3[_0x729e('0x46')],'mapKey':_0x729e('0xeb'),'message':{'from':_0x550db3[_0x729e('0xeb')],'to':_0x59ee54['MailAccount']['email'],'cc':'','subject':_[_0x729e('0x8f')](_0xee97c0)?_0x59ee54[_0x729e('0xf3')]:_0xee97c0,'messageId':'','sentAt':new Date(),'attach':_0x5bae9a['length'],'attachments':_0x5bae9a,'originChannel':_0x729e('0xf4'),'ChatWebsiteId':_0x59ee54['id'],'ChatOfflineMessageId':_0x277fb4['id'],'originTo':_0x59ee54[_0x729e('0xd4')][_0x729e('0xeb')]},'body':_0x277fb4[_0x729e('0x71')]};var _0x5cc813={'account':{'id':_0x59ee54[_0x729e('0xed')]},'body':_0x2a4785,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x729e('0xf5'),_0x729e('0xf6'),_0x5cc813,client9001)[_0x729e('0x15')](function(){return _0x277fb4;})[_0x729e('0x3a')](function(_0x24fa1a){logger['error'](_0x24fa1a);});}return;})[_0x729e('0x15')](function(){if(_0x277fb4){return _0x277fb4;}})[_0x729e('0x15')](respondWithResult(_0xf647a4,null))[_0x729e('0x3a')](function(){for(var _0x3bd0f9 of _0x25a976){var _0x45be5d=path[_0x729e('0x91')](config[_0x729e('0x8a')],_0x729e('0xdb'),_0x729e('0xdc'),'attachments','offline-chat',_0x3bd0f9[_0x729e('0x83')]);fs_extra[_0x729e('0xf7')](_0x45be5d)[_0x729e('0x3a')](function(_0x33000f){logger[_0x729e('0x1c')](_0x729e('0xf8'),_0x45be5d,_0x33000f);});}});};exports[_0x729e('0xf9')]=function(_0x129b05,_0x41b58e){return db[_0x729e('0xb8')][_0x729e('0x6a')]({'where':{'id':_0x129b05[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x41b58e,null))[_0x729e('0x15')](function(_0x5bccd5){if(_0x5bccd5){return _0x5bccd5[_0x729e('0xf9')](_0x129b05[_0x729e('0x71')][_0x729e('0x7f')],_[_0x729e('0xfa')](_0x129b05[_0x729e('0x71')],['ids','id'])||{});}})['then'](respondWithResult(_0x41b58e,null))[_0x729e('0x3a')](handleError(_0x41b58e,null));};exports[_0x729e('0xfb')]=function(_0x422899,_0x4b9812){var _0x276ca7={'raw':![],'where':{}};var _0x176581={};var _0x59d415={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x729e('0x76')]({'where':{'id':_0x422899[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x4b9812,null))[_0x729e('0x15')](function(_0xd3c875){if(_0xd3c875){_0x176581[_0x729e('0x4e')]=_['keys'](db[_0x729e('0xb8')]['rawAttributes']);_0x176581[_0x729e('0x55')]=_[_0x729e('0x56')](_0x422899['query']);_0x176581[_0x729e('0x57')]=_[_0x729e('0x58')](_0x176581[_0x729e('0x4e')],_0x176581[_0x729e('0x55')]);_0x276ca7['attributes']=_['intersection'](_0x176581[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x422899[_0x729e('0x55')][_0x729e('0x59')]));_0x276ca7['attributes']=_0x276ca7['attributes'][_0x729e('0x5a')]?_0x276ca7[_0x729e('0x5b')]:_0x176581[_0x729e('0x4e')];if(!_0x422899[_0x729e('0x55')][_0x729e('0x7d')]('nolimit')){_0x276ca7[_0x729e('0x24')]=qs[_0x729e('0x24')](_0x422899[_0x729e('0x55')][_0x729e('0x24')]);_0x276ca7[_0x729e('0x23')]=qs[_0x729e('0x23')](_0x422899['query'][_0x729e('0x23')]);}_0x276ca7[_0x729e('0x5d')]=qs['sort'](_0x422899[_0x729e('0x55')]['sort']);_0x276ca7[_0x729e('0x5f')]=qs[_0x729e('0x57')](_[_0x729e('0x60')](_0x422899['query'],_0x176581[_0x729e('0x57')]));_0x276ca7['where'][_0x729e('0x73')]=_0xd3c875['id'];if(_0x422899[_0x729e('0x55')][_0x729e('0x63')]){_0x276ca7[_0x729e('0x5f')]=_['merge'](_0x276ca7[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0x276ca7[_0x729e('0x5b')],function(_0x1c8dfe){var _0x1535f7={};_0x1535f7[_0x1c8dfe]={'$like':'%'+_0x422899[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x1535f7;})});}_0x276ca7=_[_0x729e('0x61')]({},_0x276ca7,_0x422899[_0x729e('0x64')]);return db['ChatInteraction']['count']({'where':_0x276ca7['where']})[_0x729e('0x15')](function(_0x3848aa){_0x59d415['count']=_0x3848aa;if(_0x422899['query'][_0x729e('0x78')]){_0x276ca7[_0x729e('0x69')]=[{'model':db[_0x729e('0xa9')],'as':_0x729e('0xfc'),'required':![]},{'model':db[_0x729e('0xc4')],'as':'Owner','attributes':[_0x729e('0x2e'),_0x729e('0xfd'),_0x729e('0xfe')],'required':![]},{'model':db['Tag'],'as':_0x729e('0xff'),'attributes':['id',_0x729e('0x2e'),'color'],'where':_0x422899[_0x729e('0x55')][_0x729e('0x100')]?{'id':_0x422899[_0x729e('0x55')][_0x729e('0x100')]}:undefined,'required':_0x422899[_0x729e('0x55')][_0x729e('0x100')]?!![]:![]}];}return db[_0x729e('0xb8')][_0x729e('0x65')](_0x276ca7);})[_0x729e('0x15')](function(_0x266cbc){_0x59d415['rows']=_0x266cbc;return _0x59d415;});}})[_0x729e('0x15')](respondWithFilteredResult(_0x4b9812,_0x276ca7))['catch'](handleError(_0x4b9812,null));};exports[_0x729e('0x31')]=function(_0x24e710,_0x3dd5f5){var _0x24607b=0x0;var _0x25b142=0x0;var _0x1b27bc=![];var _0x5d50cc;var _0x529e0d;return db[_0x729e('0x52')][_0x729e('0x6a')]({'where':{'id':_0x24e710[_0x729e('0x67')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x729e('0x3d')],'as':_0x729e('0x3e'),'attributes':['id','interval']}]}]})[_0x729e('0x15')](handleEntityNotFound(_0x3dd5f5,null))['then'](function(_0x5b8514){if(_0x5b8514){_0x5d50cc=_0x5b8514;return _0x5b8514[_0x729e('0x101')]({'raw':!![]});}})[_0x729e('0x15')](function(_0x3fa58e){if(_0x5d50cc){if(_0x3fa58e){_0x529e0d=_0x3fa58e;}}return require(_0x729e('0x8c'))[_0x729e('0x8d')]();})[_0x729e('0x15')](function(_0x2ea1fc){if(_0x2ea1fc){_0x25b142=_0x2ea1fc[_0x729e('0x102')];_0x1b27bc=_0x2ea1fc['custom'];}})['then'](function(){return db['ChatInteraction'][_0x729e('0x26')]({'where':{'closed':![]}});})['then'](function(_0x381310){_0x24607b=_0x381310;if(_0x25b142&&_0x381310>_0x25b142){return db[_0x729e('0x103')][_0x729e('0x76')]({'where':{'id':0x1}})['then'](function(_0x4354a2){if(_0x4354a2){_0x4354a2['increment'](_0x729e('0x104'));}});}})[_0x729e('0x15')](function(){if(!_0x5d50cc[_0x729e('0x3d')]||!_0x5d50cc[_0x729e('0x3d')]['Intervals'])return!![];return checkWebsiteIntervals(_0x5d50cc);})[_0x729e('0x15')](function(_0x24634a){var _0x38c0bf=fs[_0x729e('0xd6')](path['join'](config['root'],_0x729e('0x105')),_0x729e('0x106'));var _0x254a3c=new url[(_0x729e('0x107'))](_0x5d50cc['address'])[_0x729e('0x108')];var _0x51a786='3.5.0';var _0x2c656e=![];var _0x49be77={'chatVersion':_0x51a786,'chatWebsiteAddressOrigin':_0x254a3c,'remote':_0x5d50cc[_0x729e('0x109')],'query':querystring[_0x729e('0x1b')](_[_0x729e('0x61')](_0x5d50cc[_0x729e('0x2b')]({'plain':!![]}),{'customerIp':_0x24e710['headers'][_0x729e('0x44')]||_0x24e710[_0x729e('0xb7')]['x-real-ip']||_0x24e710[_0x729e('0x10a')][_0x729e('0x10b')]||_0x24e710['ip'],'referer':_0x24e710[_0x729e('0xb7')][_0x729e('0x48')],'openedInteractions':_0x24607b,'maxInteractions':_0x25b142,'virtual':_0x1b27bc[_0x729e('0x102')],'online':_0x24634a,'custom':_0x1b27bc}))[_0x729e('0x10c')](/'/g,'\x5c\x27')};_0x3dd5f5[_0x729e('0x2f')](ejs[_0x729e('0xd8')](Mustache['render'](_0x38c0bf,_0x49be77),{'proactiveActions':_0x529e0d,'alignment':_0x5d50cc[_0x729e('0x10d')],'verticalAlignment':_0x5d50cc[_0x729e('0x10e')],'div_color':_0x5d50cc['color'],'labelText':_0x5d50cc[_0x729e('0x10f')],'text_color':_0x5d50cc['textColor'],'text_button_color':_0x5d50cc[_0x729e('0x110')],'button_color':_0x5d50cc[_0x729e('0x111')],'background_color':_0x5d50cc[_0x729e('0x112')],'hideWhenOffline':_0x5d50cc[_0x729e('0x113')],'intervalId':_0x5d50cc[_0x729e('0x114')],'isDevelopment':_0x2c656e,'chatVersion':_0x51a786}));})[_0x729e('0x3a')](handleError(_0x3dd5f5,null));};exports[_0x729e('0x115')]=function(_0x51efdf,_0x47f3c5){var _0x419d1e=_0x51efdf[_0x729e('0x67')]['id'];var _0x12e11e=_0x51efdf['body'];var _0x3afe2c=0xc8;var _0x44f826=null;return db[_0x729e('0xe0')][_0x729e('0xe1')]({'isolationLevel':db['sequelize']['Transaction'][_0x729e('0x116')]['READ_COMMITTED']},function(_0xfe0e9e){return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0x419d1e},'transaction':_0xfe0e9e})[_0x729e('0x15')](function(_0x3ffd28){if(_0x3ffd28){return db[_0x729e('0xac')][_0x729e('0x2a')]({'where':{'ChatWebsiteId':_0x419d1e},'transaction':_0xfe0e9e})['then'](function(){var _0x1aab39=_[_0x729e('0x3c')](_0x12e11e,function(_0x4dcc7f){_0x4dcc7f['ChatWebsiteId']=_0x419d1e;return _0x4dcc7f;});return db[_0x729e('0xac')][_0x729e('0xe3')](_0x1aab39,{'transaction':_0xfe0e9e});});}else{_0x3afe2c=0x194;_0x44f826=[];}});})[_0x729e('0x15')](function(){if(_0x3afe2c!==0x194){return db['ChatApplication'][_0x729e('0x117')]({'where':{'ChatWebsiteId':_0x419d1e},'order':_0x729e('0xb4')})['then'](function(_0x293400){_0x44f826=_0x293400;});}})[_0x729e('0x3a')](function(_0x483461){_0x3afe2c=0x1f4;logger[_0x729e('0x1c')](_0x483461[_0x729e('0x2d')]);if(_0x483461['name']){delete _0x483461[_0x729e('0x2e')];}_0x44f826=_0x483461;})[_0x729e('0x118')](function(){if(_0x44f826===null){_0x47f3c5[_0x729e('0x20')](_0x3afe2c);}else{if(_0x3afe2c===0x1f4){_0x47f3c5[_0x729e('0x21')](_0x3afe2c)[_0x729e('0x2f')](_0x44f826);}else{_0x47f3c5[_0x729e('0x21')](_0x3afe2c)['json'](_0x44f826);}}});};exports[_0x729e('0x119')]=function(_0x468b5b,_0x4be91f){var _0x5cf9b2={};var _0x16e2f0={};var _0x2ea040;var _0x31e908;return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0x468b5b[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x4be91f,null))['then'](function(_0x459544){if(_0x459544){_0x2ea040=_0x459544;_0x16e2f0[_0x729e('0x4e')]=_[_0x729e('0x56')](db[_0x729e('0xac')][_0x729e('0x77')]);_0x16e2f0[_0x729e('0x55')]=_['keys'](_0x468b5b['query']);_0x16e2f0[_0x729e('0x57')]=_[_0x729e('0x58')](_0x16e2f0[_0x729e('0x4e')],_0x16e2f0['query']);_0x5cf9b2[_0x729e('0x5b')]=_['intersection'](_0x16e2f0[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x468b5b['query'][_0x729e('0x59')]));_0x5cf9b2[_0x729e('0x5b')]=_0x5cf9b2[_0x729e('0x5b')][_0x729e('0x5a')]?_0x5cf9b2['attributes']:_0x16e2f0['model'];_0x5cf9b2[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x468b5b[_0x729e('0x55')]['sort']);_0x5cf9b2[_0x729e('0x5f')]=qs[_0x729e('0x57')](_[_0x729e('0x60')](_0x468b5b[_0x729e('0x55')],_0x16e2f0[_0x729e('0x57')]));if(_0x468b5b['query'][_0x729e('0x63')]){_0x5cf9b2['where']=_[_0x729e('0x61')](_0x5cf9b2[_0x729e('0x5f')],{'$or':_['map'](_0x5cf9b2[_0x729e('0x5b')],function(_0x3a5924){var _0x53bca6={};_0x53bca6[_0x3a5924]={'$like':'%'+_0x468b5b[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x53bca6;})});}_0x5cf9b2=_[_0x729e('0x61')]({},_0x5cf9b2,_0x468b5b[_0x729e('0x64')]);return _0x2ea040[_0x729e('0x119')](_0x5cf9b2);}})[_0x729e('0x15')](function(_0x2f3e98){if(_0x2f3e98){_0x31e908=_0x2f3e98[_0x729e('0x5a')];if(!_0x468b5b[_0x729e('0x55')][_0x729e('0x7d')](_0x729e('0x5c'))){_0x5cf9b2[_0x729e('0x24')]=qs[_0x729e('0x24')](_0x468b5b[_0x729e('0x55')][_0x729e('0x24')]);_0x5cf9b2[_0x729e('0x23')]=qs['offset'](_0x468b5b[_0x729e('0x55')][_0x729e('0x23')]);}return _0x2ea040[_0x729e('0x119')](_0x5cf9b2);}})['then'](function(_0x296b06){if(_0x296b06){return _0x296b06?{'count':_0x31e908,'rows':_0x296b06}:null;}})['then'](respondWithResult(_0x4be91f,null))['catch'](handleError(_0x4be91f,null));};exports['addProactiveActions']=function(_0x275543,_0x26d07a){return db[_0x729e('0x11a')][_0x729e('0x6a')]({'where':{'id':_0x275543[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x26d07a,null))[_0x729e('0x15')](function(_0x1ee90d){if(_0x1ee90d){return _0x1ee90d[_0x729e('0x11b')](_0x275543[_0x729e('0x71')]['ids'],_[_0x729e('0xfa')](_0x275543[_0x729e('0x71')],['ids','id'])||{});}})[_0x729e('0x15')](respondWithResult(_0x26d07a,null))[_0x729e('0x3a')](handleError(_0x26d07a,null));};exports[_0x729e('0x101')]=function(_0x5140a7,_0x3c3105){var _0x1ee87d={};var _0x3d5f0a={};var _0x2ec969;var _0x12d469;return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0x5140a7[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x3c3105,null))[_0x729e('0x15')](function(_0x381366){if(_0x381366){_0x2ec969=_0x381366;_0x3d5f0a[_0x729e('0x4e')]=_['keys'](db[_0x729e('0x11c')][_0x729e('0x77')]);_0x3d5f0a['query']=_[_0x729e('0x56')](_0x5140a7[_0x729e('0x55')]);_0x3d5f0a['filters']=_['intersection'](_0x3d5f0a[_0x729e('0x4e')],_0x3d5f0a['query']);_0x1ee87d['attributes']=_[_0x729e('0x58')](_0x3d5f0a[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x5140a7[_0x729e('0x55')][_0x729e('0x59')]));_0x1ee87d[_0x729e('0x5b')]=_0x1ee87d[_0x729e('0x5b')][_0x729e('0x5a')]?_0x1ee87d['attributes']:_0x3d5f0a['model'];_0x1ee87d[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x5140a7[_0x729e('0x55')][_0x729e('0x5e')]);_0x1ee87d[_0x729e('0x5f')]=qs['filters'](_[_0x729e('0x60')](_0x5140a7[_0x729e('0x55')],_0x3d5f0a[_0x729e('0x57')]));if(_0x5140a7[_0x729e('0x55')][_0x729e('0x63')]){_0x1ee87d['where']=_[_0x729e('0x61')](_0x1ee87d[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0x1ee87d[_0x729e('0x5b')],function(_0x1bf802){var _0x109605={};_0x109605[_0x1bf802]={'$like':'%'+_0x5140a7[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x109605;})});}_0x1ee87d=_[_0x729e('0x61')]({},_0x1ee87d,_0x5140a7[_0x729e('0x64')]);return _0x2ec969['getProactiveActions'](_0x1ee87d);}})[_0x729e('0x15')](function(_0x1a1670){if(_0x1a1670){_0x12d469=_0x1a1670['length'];if(!_0x5140a7[_0x729e('0x55')][_0x729e('0x7d')](_0x729e('0x5c'))){_0x1ee87d[_0x729e('0x24')]=qs['limit'](_0x5140a7['query'][_0x729e('0x24')]);_0x1ee87d[_0x729e('0x23')]=qs['offset'](_0x5140a7[_0x729e('0x55')][_0x729e('0x23')]);}return _0x2ec969[_0x729e('0x101')](_0x1ee87d);}})[_0x729e('0x15')](function(_0x1fbf7e){if(_0x1fbf7e){return _0x1fbf7e?{'count':_0x12d469,'rows':_0x1fbf7e}:null;}})[_0x729e('0x15')](respondWithResult(_0x3c3105,null))[_0x729e('0x3a')](handleError(_0x3c3105,null));};exports[_0x729e('0x11d')]=function(_0x5ec0ab,_0x3b69ec){var _0x26e502=_0x5ec0ab[_0x729e('0x55')][_0x729e('0x11e')]===_0x729e('0x11f')?'offlineForm':_0x729e('0x120');return db[_0x729e('0x52')][_0x729e('0x6a')]({'attributes':['id',_0x26e502],'where':{'id':_0x5ec0ab[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x3b69ec,null))['then'](function(_0x5d5e7d){if(_0x5d5e7d){var _0x1edcf0=_0x5d5e7d[_0x26e502];var _0x3d4c73=_0x1edcf0&&_0x1edcf0[_0x729e('0x121')]?_0x1edcf0[_0x729e('0x121')]:[];_0x3b69ec['send']({'fromKey':_[_0x729e('0x8f')](_0x1edcf0[_0x729e('0x122')])?undefined:_0x1edcf0[_0x729e('0x122')],'count':_0x3d4c73['length'],'rows':_0x3d4c73});}})[_0x729e('0x3a')](handleError(_0x3b69ec,null));};exports[_0x729e('0x123')]=function(_0x183926,_0x28d2c8){var _0x190c24={'raw':![],'where':{}};var _0x84096d={};var _0xb2acc1={'count':0x0,'rows':[]};return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0x183926[_0x729e('0x67')]['id']}})['then'](handleEntityNotFound(_0x28d2c8,null))['then'](function(_0x338a68){if(_0x338a68){_0x84096d['model']=_[_0x729e('0x56')](db[_0x729e('0x124')][_0x729e('0x77')]);_0x84096d[_0x729e('0x55')]=_[_0x729e('0x56')](_0x183926[_0x729e('0x55')]);_0x84096d[_0x729e('0x57')]=_[_0x729e('0x58')](_0x84096d['model'],_0x84096d['query']);_0x190c24['attributes']=_[_0x729e('0x58')](_0x84096d[_0x729e('0x4e')],qs[_0x729e('0x59')](_0x183926[_0x729e('0x55')][_0x729e('0x59')]));_0x190c24[_0x729e('0x5b')]=_0x190c24['attributes'][_0x729e('0x5a')]?_0x190c24[_0x729e('0x5b')]:_0x84096d[_0x729e('0x4e')];if(!_0x183926['query'][_0x729e('0x7d')]('nolimit')){_0x190c24[_0x729e('0x24')]=qs[_0x729e('0x24')](_0x183926[_0x729e('0x55')][_0x729e('0x24')]);_0x190c24[_0x729e('0x23')]=qs[_0x729e('0x23')](_0x183926['query'][_0x729e('0x23')]);}_0x190c24[_0x729e('0x5d')]=qs[_0x729e('0x5e')](_0x183926['query']['sort']);_0x190c24[_0x729e('0x5f')]=qs['filters'](_['pick'](_0x183926[_0x729e('0x55')],_0x84096d['filters']));_0x190c24[_0x729e('0x5f')]['ChatWebsiteId']=_0x338a68['id'];if(_0x183926[_0x729e('0x55')][_0x729e('0x63')]){_0x190c24['where']=_[_0x729e('0x61')](_0x190c24[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0x190c24['attributes'],function(_0x3e3844){var _0x22654e={};_0x22654e[_0x3e3844]={'$like':'%'+_0x183926['query'][_0x729e('0x63')]+'%'};return _0x22654e;})});}_0x190c24=_[_0x729e('0x61')]({},_0x190c24,_0x183926[_0x729e('0x64')]);return db[_0x729e('0x124')][_0x729e('0x26')]({'where':_0x190c24['where']})['then'](function(_0x525418){_0xb2acc1[_0x729e('0x26')]=_0x525418;if(_0x183926[_0x729e('0x55')]['includeAll']){_0x190c24[_0x729e('0x69')]=[{'all':!![]}];}else{_0x190c24[_0x729e('0x69')]=[{'model':db['CmContact'],'as':_0x729e('0xfc'),'required':![]},{'model':db['Attachment'],'as':_0x729e('0x125'),'required':![]}];}return db[_0x729e('0x124')][_0x729e('0x65')](_0x190c24);})[_0x729e('0x15')](function(_0x1d2dba){_0xb2acc1['rows']=_0x1d2dba;return _0xb2acc1;});}})['then'](respondWithFilteredResult(_0x28d2c8,_0x190c24))[_0x729e('0x3a')](handleError(_0x28d2c8,null));};exports[_0x729e('0x126')]=function(_0xc6f2dd,_0x52d62a){return db[_0x729e('0x52')]['find']({'where':{'id':_0xc6f2dd[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x52d62a,null))['then'](function(_0x53ce8e){if(_0x53ce8e){return _0x53ce8e['addAgents'](_0xc6f2dd['body'][_0x729e('0x7f')],_[_0x729e('0xfa')](_0xc6f2dd[_0x729e('0x71')],['ids','id'])||{})[_0x729e('0xae')](function(_0x32e99f){for(var _0x2b5403=0x0;_0x2b5403<_0xc6f2dd['body']['ids'][_0x729e('0x5a')];_0x2b5403+=0x1){socket[_0x729e('0x127')](_0x729e('0x128'),{'UserId':Number(_0xc6f2dd['body'][_0x729e('0x7f')][_0x2b5403]),'ChatWebsiteId':Number(_0xc6f2dd['params']['id'])});}return _0x32e99f;});}})[_0x729e('0x15')](respondWithResult(_0x52d62a,null))[_0x729e('0x3a')](handleError(_0x52d62a,null));};exports[_0x729e('0x129')]=function(_0x17faf6,_0x17d638){return db['ChatWebsite']['find']({'where':{'id':_0x17faf6[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x17d638,null))[_0x729e('0x15')](function(_0x74147c){if(_0x74147c){return _0x74147c[_0x729e('0x129')](_0x17faf6[_0x729e('0x55')][_0x729e('0x7f')])[_0x729e('0x15')](function(){if(_[_0x729e('0x12a')](_0x17faf6[_0x729e('0x55')][_0x729e('0x7f')])){for(var _0x29fa72=0x0;_0x29fa72<_0x17faf6[_0x729e('0x55')][_0x729e('0x7f')][_0x729e('0x5a')];_0x29fa72+=0x1){socket[_0x729e('0x127')](_0x729e('0x12b'),{'UserId':Number(_0x17faf6[_0x729e('0x55')]['ids'][_0x29fa72]),'ChatWebsiteId':Number(_0x17faf6[_0x729e('0x67')]['id'])});}}else{socket['emit'](_0x729e('0x12b'),{'UserId':Number(_0x17faf6[_0x729e('0x55')][_0x729e('0x7f')]),'ChatWebsiteId':Number(_0x17faf6[_0x729e('0x67')]['id'])});}});}})[_0x729e('0x15')](respondWithStatusCode(_0x17d638,null))[_0x729e('0x3a')](handleError(_0x17d638,null));};exports[_0x729e('0x12c')]=function(_0xdddfb9,_0x4d03dc){var _0x104805={};var _0x1198f0={};var _0x3d9404;var _0x229bff;return db[_0x729e('0x52')][_0x729e('0x76')]({'where':{'id':_0xdddfb9[_0x729e('0x67')]['id']}})[_0x729e('0x15')](handleEntityNotFound(_0x4d03dc,null))['then'](function(_0x84da26){if(_0x84da26){_0x3d9404=_0x84da26;_0x1198f0[_0x729e('0x4e')]=_[_0x729e('0x56')](db[_0x729e('0xc4')][_0x729e('0x77')]);_0x1198f0[_0x729e('0x55')]=_[_0x729e('0x56')](_0xdddfb9[_0x729e('0x55')]);_0x1198f0[_0x729e('0x57')]=_[_0x729e('0x58')](_0x1198f0['model'],_0x1198f0[_0x729e('0x55')]);_0x104805[_0x729e('0x5b')]=_[_0x729e('0x58')](_0x1198f0[_0x729e('0x4e')],qs[_0x729e('0x59')](_0xdddfb9[_0x729e('0x55')]['fields']));_0x104805[_0x729e('0x5b')]=_0x104805[_0x729e('0x5b')][_0x729e('0x5a')]?_0x104805[_0x729e('0x5b')]:_0x1198f0[_0x729e('0x4e')];_0x104805['order']=qs[_0x729e('0x5e')](_0xdddfb9[_0x729e('0x55')][_0x729e('0x5e')]);_0x104805[_0x729e('0x5f')]=qs[_0x729e('0x57')](_['pick'](_0xdddfb9[_0x729e('0x55')],_0x1198f0[_0x729e('0x57')]));if(_0xdddfb9[_0x729e('0x55')]['filter']){_0x104805[_0x729e('0x5f')]=_[_0x729e('0x61')](_0x104805[_0x729e('0x5f')],{'$or':_[_0x729e('0x3c')](_0x104805[_0x729e('0x5b')],function(_0x264bab){var _0x1f1cf7={};_0x1f1cf7[_0x264bab]={'$like':'%'+_0xdddfb9[_0x729e('0x55')][_0x729e('0x63')]+'%'};return _0x1f1cf7;})});}_0x104805=_[_0x729e('0x61')]({},_0x104805,_0xdddfb9[_0x729e('0x64')]);return _0x3d9404[_0x729e('0x12c')](_0x104805);}})[_0x729e('0x15')](function(_0x20a5a5){if(_0x20a5a5){_0x229bff=_0x20a5a5[_0x729e('0x5a')];if(!_0xdddfb9[_0x729e('0x55')][_0x729e('0x7d')](_0x729e('0x5c'))){_0x104805[_0x729e('0x24')]=qs[_0x729e('0x24')](_0xdddfb9[_0x729e('0x55')][_0x729e('0x24')]);_0x104805[_0x729e('0x23')]=qs[_0x729e('0x23')](_0xdddfb9['query'][_0x729e('0x23')]);}return _0x3d9404['getAgents'](_0x104805);}})[_0x729e('0x15')](function(_0x357656){if(_0x357656){return _0x357656?{'count':_0x229bff,'rows':_0x357656}:null;}})[_0x729e('0x15')](respondWithResult(_0x4d03dc,null))[_0x729e('0x3a')](handleError(_0x4d03dc,null));}; \ No newline at end of file +var _0xa3f1=['addLogo','sitepic','file','addAvatar','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','notify','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','updatedAt','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','applications','orderBy','priority','asc','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','tag','virtual','License','increment','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','remoteAddress','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Attachments','emit','userChatWebsite:save','removeAgents','isArray','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','Command','getSnippet','timezone','format','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','map','Interval','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','sort','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids'];(function(_0x1d9915,_0x5b22c5){var _0x513fb8=function(_0x4c8e1b){while(--_0x4c8e1b){_0x1d9915['push'](_0x1d9915['shift']());}};_0x513fb8(++_0x5b22c5);}(_0xa3f1,0xa8));var _0x1a3f=function(_0x50f792,_0x441510){_0x50f792=_0x50f792-0x0;var _0x42e18a=_0xa3f1[_0x50f792];return _0x42e18a;};'use strict';var Mustache=require(_0x1a3f('0x0'));var util=require(_0x1a3f('0x1'));var path=require(_0x1a3f('0x2'));var ejs=require(_0x1a3f('0x3'));var fs=require('fs');var fs_extra=require(_0x1a3f('0x4'));var _=require(_0x1a3f('0x5'));var querystring=require(_0x1a3f('0x6'));var htmlToText=require(_0x1a3f('0x7'));var Redis=require('ioredis');var jayson=require(_0x1a3f('0x8'));var url=require(_0x1a3f('0x9'));var qs=require(_0x1a3f('0xa'));var logger=require(_0x1a3f('0xb'))('api');var config=require(_0x1a3f('0xc'));var APIOutOfIntervalError=require(_0x1a3f('0xd'))[_0x1a3f('0xe')];var APINotFoundError=require(_0x1a3f('0xd'))[_0x1a3f('0xf')];var APIHandleError=require(_0x1a3f('0xd'))[_0x1a3f('0x10')];var db=require(_0x1a3f('0x11'))['db'];config[_0x1a3f('0x12')]=_[_0x1a3f('0x13')](config['redis'],{'host':_0x1a3f('0x14'),'port':0x18eb});var socket=require(_0x1a3f('0x15'))(new Redis(config[_0x1a3f('0x12')]));require(_0x1a3f('0x16'))[_0x1a3f('0x17')](socket);var client=jayson['client'][_0x1a3f('0x18')]({'port':0x232c});var client9002=jayson[_0x1a3f('0x19')]['http']({'port':0x232a});var client9003=jayson[_0x1a3f('0x19')][_0x1a3f('0x18')]({'port':0x232b});var client9001=jayson[_0x1a3f('0x19')][_0x1a3f('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x268157,_0x1f30be,_0x53c208,_0x353ec8){return new Promise(function(_0x21e7f8,_0x95ceb3){var _0x660514=_0x353ec8||client;return _0x660514['request'](_0x268157,_0x53c208)[_0x1a3f('0x1a')](function(_0x428534){logger['info'](_0x1a3f('0x1b'),_0x1f30be,_0x1a3f('0x1c'));logger[_0x1a3f('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1f30be,'request\x20sent',JSON[_0x1a3f('0x1e')](_0x428534));if(_0x428534[_0x1a3f('0x1f')]){if(_0x428534[_0x1a3f('0x1f')][_0x1a3f('0x20')]===0x1f4){logger['error'](_0x1a3f('0x1b'),_0x1f30be,_0x428534[_0x1a3f('0x1f')][_0x1a3f('0x21')]);return _0x95ceb3(_0x428534[_0x1a3f('0x1f')][_0x1a3f('0x21')]);}logger[_0x1a3f('0x1f')](_0x1a3f('0x1b'),_0x1f30be,_0x428534[_0x1a3f('0x1f')]['message']);return _0x21e7f8(_0x428534['error'][_0x1a3f('0x21')]);}else{logger[_0x1a3f('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x1f30be,'request\x20sent');_0x21e7f8(_0x428534[_0x1a3f('0x23')]['message']);}})[_0x1a3f('0x24')](function(_0x4b1b90){logger[_0x1a3f('0x1f')](_0x1a3f('0x1b'),_0x1f30be,_0x4b1b90);_0x95ceb3(_0x4b1b90);});});}function respondWithStatusCode(_0x504d8f,_0x412070){_0x412070=_0x412070||0xcc;return function(_0x57c696){if(_0x57c696){return _0x504d8f[_0x1a3f('0x25')](_0x412070);}return _0x504d8f[_0x1a3f('0x26')](_0x412070)[_0x1a3f('0x27')]();};}function respondWithResult(_0x5baaa7,_0x3eadb0){_0x3eadb0=_0x3eadb0||0xc8;return function(_0xc5e575){if(_0xc5e575){return _0x5baaa7['status'](_0x3eadb0)['json'](_0xc5e575);}};}function respondWithFilteredResult(_0x428162,_0x3e90eb){return function(_0x5a6abb){if(_0x5a6abb){var _0x30b4b4=typeof _0x3e90eb[_0x1a3f('0x28')]===_0x1a3f('0x29')&&typeof _0x3e90eb[_0x1a3f('0x2a')]==='undefined';var _0x174bc6=_0x5a6abb[_0x1a3f('0x2b')];var _0x4d3f11=_0x30b4b4?0x0:_0x3e90eb[_0x1a3f('0x28')];var _0x216ba3=_0x30b4b4?_0x5a6abb[_0x1a3f('0x2b')]:_0x3e90eb[_0x1a3f('0x28')]+_0x3e90eb[_0x1a3f('0x2a')];var _0x4705c6;if(_0x216ba3>=_0x174bc6){_0x216ba3=_0x174bc6;_0x4705c6=0xc8;}else{_0x4705c6=0xce;}_0x428162[_0x1a3f('0x26')](_0x4705c6);return _0x428162[_0x1a3f('0x2c')](_0x1a3f('0x2d'),_0x4d3f11+'-'+_0x216ba3+'/'+_0x174bc6)[_0x1a3f('0x2e')](_0x5a6abb);}return null;};}function saveUpdates(_0x3f4b28){return function(_0xd036f5){if(_0xd036f5){return _0xd036f5[_0x1a3f('0x2f')](_0x3f4b28)[_0x1a3f('0x1a')](function(_0x30ec03){return _0x30ec03;});}return null;};}function removeEntity(_0x2d011e){return function(_0x2337ee){if(_0x2337ee){return _0x2337ee['destroy']()[_0x1a3f('0x1a')](function(){var _0x3cbcc0=_0x2337ee[_0x1a3f('0x30')]({'plain':!![]});var _0x1ab00e=_0x1a3f('0x31');return db[_0x1a3f('0x32')][_0x1a3f('0x33')]({'where':{'type':_0x1ab00e,'resourceId':_0x3cbcc0['id']}})[_0x1a3f('0x1a')](function(){return _0x2337ee;});})['then'](function(){_0x2d011e[_0x1a3f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aacc5){return function(_0x5bcc2a){if(!_0x5bcc2a){_0x1aacc5[_0x1a3f('0x25')](0x194);}return _0x5bcc2a;};}function handleError(_0x67ec0c,_0x299a29){_0x299a29=_0x299a29||0x1f4;return function(_0x5ac471){logger[_0x1a3f('0x1f')](_0x5ac471[_0x1a3f('0x34')]);if(_0x5ac471[_0x1a3f('0x35')]){delete _0x5ac471[_0x1a3f('0x35')];}_0x67ec0c[_0x1a3f('0x26')](_0x299a29)[_0x1a3f('0x36')](_0x5ac471);};}function iftimePromise(_0x12b024,_0x20e694){return respondWithRpcPromise(_0x1a3f('0x37'),_0x1a3f('0x38'),{'command':_0x20e694[_0x1a3f('0x39')]?util[_0x1a3f('0x3a')]('iftime\x20%s,%s',_0x12b024[_0x1a3f('0x3b')],_0x20e694[_0x1a3f('0x39')]):util[_0x1a3f('0x3a')]('iftime\x20%s',_0x12b024[_0x1a3f('0x3b')])},client9002)[_0x1a3f('0x1a')](function(_0x5e73cb){var _0x19db3d=_0x5e73cb&&_0x5e73cb[_0x1a3f('0x3c')](_0x1a3f('0x3d'))>=0x0?!![]:![];logger[_0x1a3f('0x22')](_0x1a3f('0x3e'),_0x20e694['id'],_0x12b024['id'],_0x12b024['interval'],_0x19db3d?_0x1a3f('0x3f'):_0x1a3f('0x40'),_0x20e694[_0x1a3f('0x39')]?_0x20e694[_0x1a3f('0x39')]:'No\x20timezone');return _0x19db3d;})['catch'](function(_0x3d15cc){logger[_0x1a3f('0x1f')](_0x1a3f('0x3e'),_0x20e694['id'],_0x12b024['id'],_0x12b024[_0x1a3f('0x3b')],util[_0x1a3f('0x41')](_0x3d15cc,{'showHidden':![],'depth':null}),_0x20e694[_0x1a3f('0x39')]?_0x20e694[_0x1a3f('0x39')]:_0x1a3f('0x42'));return![];});}function checkWebsiteIntervals(_0x2a569a){var _0x46b1e1=_[_0x1a3f('0x43')](_0x2a569a[_0x1a3f('0x44')]['Intervals'],function(_0x1aaea5){var _0x5afbe4=_0x1aaea5[_0x1a3f('0x30')]({'plain':!![]});return iftimePromise(_0x5afbe4,_0x2a569a);});return Promise[_0x1a3f('0x45')](_0x46b1e1)[_0x1a3f('0x1a')](function(_0x323238){return _[_0x1a3f('0x46')](_0x323238);});}function createInteractionObject(_0x45cdab,_0x3ccf8b,_0x76bb87,_0x5bd33e){var _0x183bfa=require(_0x1a3f('0x47'));var _0x30d735=new _0x183bfa();var _0xc08d21=_0x30d735[_0x1a3f('0x48')](_0x76bb87[_0x1a3f('0x49')])[_0x1a3f('0x4a')]();var _0x318ed5=_0x3ccf8b[_0x1a3f('0x4b')];if(_0x76bb87[_0x1a3f('0x4c')]){_0x318ed5=_0x76bb87[_0x1a3f('0x4c')];}else if(_0x76bb87[_0x1a3f('0x4d')]){_0x318ed5=_['first'](_0x76bb87[_0x1a3f('0x4d')][_0x1a3f('0x4e')](','));}return{'ContactId':_0x5bd33e['id'],'ChatWebsiteId':_0x45cdab,'from':(_0x5bd33e[_0x1a3f('0x4f')]||'')+'\x20'+(_0x5bd33e[_0x1a3f('0x50')]||''),'customerIp':_0x318ed5,'customerPort':_0x76bb87[_0x1a3f('0x51')]?_0x76bb87[_0x1a3f('0x51')]:null,'referer':_0x3ccf8b[_0x1a3f('0x52')],'browserName':_0xc08d21[_0x1a3f('0x53')][_0x1a3f('0x35')]&&_0xc08d21[_0x1a3f('0x53')][_0x1a3f('0x54')]?util[_0x1a3f('0x3a')](_0x1a3f('0x55'),_0xc08d21['browser'][_0x1a3f('0x35')],_0xc08d21[_0x1a3f('0x53')][_0x1a3f('0x54')]):'unknown','browserVersion':_0xc08d21[_0x1a3f('0x53')][_0x1a3f('0x54')]||_0x1a3f('0x56'),'osName':util[_0x1a3f('0x3a')]('%s\x20%s',_0xc08d21['os'][_0x1a3f('0x35')],_0xc08d21['os'][_0x1a3f('0x54')]),'osVersion':_0xc08d21['os'][_0x1a3f('0x54')],'deviceModel':_0xc08d21[_0x1a3f('0x57')][_0x1a3f('0x58')]&&_0xc08d21[_0x1a3f('0x57')]['vendor']?util[_0x1a3f('0x3a')](_0x1a3f('0x59'),_0xc08d21['device']['model'],_0xc08d21[_0x1a3f('0x57')][_0x1a3f('0x5a')],_0xc08d21[_0x1a3f('0x57')][_0x1a3f('0x5b')]):null,'deviceVendor':_0xc08d21['device'][_0x1a3f('0x5a')],'deviceType':_0xc08d21[_0x1a3f('0x57')][_0x1a3f('0x5b')],'formData':JSON[_0x1a3f('0x1e')](_0x3ccf8b)};}exports[_0x1a3f('0x5c')]=function(_0x2c4861,_0x3f3bac){var _0x2bc94d={'include':[{'model':db[_0x1a3f('0x5d')],'as':_0x1a3f('0x5e')}]},_0x4cb036={},_0x138d43={'count':0x0,'rows':[]};var _0x5d6adb=_['map'](db[_0x1a3f('0x5f')][_0x1a3f('0x60')],function(_0x40dc76){return{'name':_0x40dc76[_0x1a3f('0x61')],'type':_0x40dc76['type'][_0x1a3f('0x62')]};});_0x4cb036['model']=_[_0x1a3f('0x43')](_0x5d6adb,'name');_0x4cb036[_0x1a3f('0x63')]=_[_0x1a3f('0x64')](_0x2c4861[_0x1a3f('0x63')]);_0x4cb036[_0x1a3f('0x65')]=_[_0x1a3f('0x66')](_0x4cb036[_0x1a3f('0x58')],_0x4cb036[_0x1a3f('0x63')]);_0x2bc94d[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x4cb036[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0x2c4861[_0x1a3f('0x63')][_0x1a3f('0x68')]));_0x2bc94d[_0x1a3f('0x67')]=_0x2bc94d[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x2bc94d[_0x1a3f('0x67')]:_0x4cb036['model'];if(!_0x2c4861[_0x1a3f('0x63')]['hasOwnProperty'](_0x1a3f('0x6a'))){_0x2bc94d['limit']=qs[_0x1a3f('0x2a')](_0x2c4861['query']['limit']);_0x2bc94d[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x2c4861[_0x1a3f('0x63')][_0x1a3f('0x28')]);}_0x2bc94d[_0x1a3f('0x6b')]=qs['sort'](_0x2c4861[_0x1a3f('0x63')]['sort']);_0x2bc94d[_0x1a3f('0x6c')]=qs[_0x1a3f('0x65')](_[_0x1a3f('0x6d')](_0x2c4861[_0x1a3f('0x63')],_0x4cb036[_0x1a3f('0x65')]),_0x5d6adb);if(_0x2c4861['query'][_0x1a3f('0x6e')]){_0x2bc94d[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x2bc94d[_0x1a3f('0x6c')],{'$or':_['map'](_0x5d6adb,function(_0x244184){if(_0x244184[_0x1a3f('0x5b')]!=='VIRTUAL'){var _0x4334d6={};_0x4334d6[_0x244184[_0x1a3f('0x35')]]={'$like':'%'+_0x2c4861[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x4334d6;}})});}_0x2bc94d=_['merge']({},_0x2bc94d,_0x2c4861[_0x1a3f('0x70')]);var _0x34d299={'where':_0x2bc94d[_0x1a3f('0x6c')]};return db['ChatWebsite'][_0x1a3f('0x2b')](_0x34d299)['then'](function(_0x13df33){_0x138d43[_0x1a3f('0x2b')]=_0x13df33;if(_0x2c4861[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x2bc94d[_0x1a3f('0x72')]=[{'all':!![]}];}return db[_0x1a3f('0x5f')][_0x1a3f('0x73')](_0x2bc94d);})[_0x1a3f('0x1a')](function(_0x5602b2){_0x138d43[_0x1a3f('0x74')]=_0x5602b2;return _0x138d43;})[_0x1a3f('0x1a')](respondWithFilteredResult(_0x3f3bac,_0x2bc94d))[_0x1a3f('0x24')](handleError(_0x3f3bac,null));};exports[_0x1a3f('0x75')]=function(_0x515389,_0x14b02a){var _0x31ee94={'raw':![],'where':{'id':_0x515389[_0x1a3f('0x76')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x51e336={};_0x51e336[_0x1a3f('0x58')]=_['keys'](db[_0x1a3f('0x5f')][_0x1a3f('0x60')]);_0x51e336[_0x1a3f('0x63')]=_[_0x1a3f('0x64')](_0x515389['query']);_0x51e336[_0x1a3f('0x65')]=_[_0x1a3f('0x66')](_0x51e336[_0x1a3f('0x58')],_0x51e336[_0x1a3f('0x63')]);_0x31ee94[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x51e336[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0x515389['query']['fields']));_0x31ee94[_0x1a3f('0x67')]=_0x31ee94[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x31ee94[_0x1a3f('0x67')]:_0x51e336[_0x1a3f('0x58')];if(_0x515389[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x31ee94[_0x1a3f('0x72')]=[{'all':!![]}];}_0x31ee94=_['merge']({},_0x31ee94,_0x515389['options']);return db['ChatWebsite'][_0x1a3f('0x77')](_0x31ee94)['then'](handleEntityNotFound(_0x14b02a,null))[_0x1a3f('0x1a')](respondWithResult(_0x14b02a,null))[_0x1a3f('0x24')](handleError(_0x14b02a,null));};exports[_0x1a3f('0x78')]=function(_0x1fbe7d,_0x3c5057){return db['ChatWebsite']['create'](_0x1fbe7d[_0x1a3f('0x79')],{})['then'](function(_0x5bf48f){var _0x409cb3=_0x1fbe7d[_0x1a3f('0x7a')][_0x1a3f('0x30')]({'plain':!![]});if(!_0x409cb3)throw new Error(_0x1a3f('0x7b'));if(_0x409cb3['role']===_0x1a3f('0x7a')){var _0x326e38=_0x5bf48f['get']({'plain':!![]});var _0x33737f=_0x1a3f('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x33737f,'userProfileId':_0x409cb3['userProfileId']},'raw':!![]})['then'](function(_0x3eb599){if(_0x3eb599&&_0x3eb599[_0x1a3f('0x7c')]===0x0){return db[_0x1a3f('0x32')]['create']({'name':_0x326e38['name'],'resourceId':_0x326e38['id'],'type':_0x3eb599['name'],'sectionId':_0x3eb599['id']},{})['then'](function(){return _0x5bf48f;});}else{return _0x5bf48f;}})[_0x1a3f('0x24')](function(_0x150e56){logger[_0x1a3f('0x1f')](_0x1a3f('0x7d'),_0x150e56);throw _0x150e56;});}return _0x5bf48f;})[_0x1a3f('0x1a')](respondWithResult(_0x3c5057,0xc9))['catch'](handleError(_0x3c5057,null));};exports['update']=function(_0x204b6b,_0xca3dd6){if(_0x204b6b[_0x1a3f('0x79')]['id']){delete _0x204b6b[_0x1a3f('0x79')]['id'];}return db['ChatWebsite'][_0x1a3f('0x77')]({'where':{'id':_0x204b6b[_0x1a3f('0x76')]['id']},'include':[{'model':db['Pause'],'as':_0x1a3f('0x5e')}]})[_0x1a3f('0x1a')](handleEntityNotFound(_0xca3dd6,null))[_0x1a3f('0x1a')](saveUpdates(_0x204b6b['body'],null))[_0x1a3f('0x1a')](respondWithResult(_0xca3dd6,null))[_0x1a3f('0x24')](handleError(_0xca3dd6,null));};exports[_0x1a3f('0x33')]=function(_0xb7a211,_0x289494){return db[_0x1a3f('0x5f')][_0x1a3f('0x77')]({'where':{'id':_0xb7a211['params']['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x289494,null))[_0x1a3f('0x1a')](removeEntity(_0x289494,null))[_0x1a3f('0x24')](handleError(_0x289494,null));};exports[_0x1a3f('0x7e')]=function(_0x365817,_0x5192a2){return db['ChatWebsite'][_0x1a3f('0x7e')]()['then'](respondWithResult(_0x5192a2,null))[_0x1a3f('0x24')](handleError(_0x5192a2,null));};exports['addDisposition']=function(_0x520612,_0xe3620){if(_0x520612['body']['id']){delete _0x520612[_0x1a3f('0x79')]['id'];}return db[_0x1a3f('0x5f')][_0x1a3f('0x77')]({'where':{'id':_0x520612[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0xe3620,null))[_0x1a3f('0x1a')](function(_0x5d51c1){if(_0x5d51c1){_0x520612[_0x1a3f('0x79')][_0x1a3f('0x7f')]=_0x5d51c1['id'];return db[_0x1a3f('0x80')][_0x1a3f('0x78')](_0x520612[_0x1a3f('0x79')]);}})[_0x1a3f('0x1a')](respondWithResult(_0xe3620,null))[_0x1a3f('0x24')](handleError(_0xe3620,null));};exports[_0x1a3f('0x81')]=function(_0x453a91,_0x3b27e6){var _0x415923={'raw':![],'where':{}};var _0x37c448={};var _0x4114af={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1a3f('0x82')]({'where':{'id':_0x453a91[_0x1a3f('0x76')]['id']}})['then'](handleEntityNotFound(_0x3b27e6,null))[_0x1a3f('0x1a')](function(_0x431198){if(_0x431198){_0x37c448['model']=_[_0x1a3f('0x64')](db['Disposition'][_0x1a3f('0x60')]);_0x37c448['query']=_[_0x1a3f('0x64')](_0x453a91[_0x1a3f('0x63')]);_0x37c448[_0x1a3f('0x65')]=_[_0x1a3f('0x66')](_0x37c448[_0x1a3f('0x58')],_0x37c448['query']);_0x415923['attributes']=_['intersection'](_0x37c448['model'],qs[_0x1a3f('0x68')](_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x68')]));_0x415923[_0x1a3f('0x67')]=_0x415923[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x415923['attributes']:_0x37c448[_0x1a3f('0x58')];if(!_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x83')](_0x1a3f('0x6a'))){_0x415923['limit']=qs[_0x1a3f('0x2a')](_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x2a')]);_0x415923[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x28')]);}_0x415923[_0x1a3f('0x6b')]=qs[_0x1a3f('0x84')](_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x415923[_0x1a3f('0x6c')]=qs['filters'](_[_0x1a3f('0x6d')](_0x453a91[_0x1a3f('0x63')],_0x37c448['filters']));_0x415923['where']['ChatWebsiteId']=_0x431198['id'];if(_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x6e')]){_0x415923[_0x1a3f('0x6c')]=_['merge'](_0x415923[_0x1a3f('0x6c')],{'$or':_[_0x1a3f('0x43')](_0x415923[_0x1a3f('0x67')],function(_0x43b769){var _0x40d1bd={};_0x40d1bd[_0x43b769]={'$like':'%'+_0x453a91['query'][_0x1a3f('0x6e')]+'%'};return _0x40d1bd;})});}_0x415923=_['merge']({},_0x415923,_0x453a91[_0x1a3f('0x70')]);return db[_0x1a3f('0x80')][_0x1a3f('0x2b')]({'where':_0x415923[_0x1a3f('0x6c')]})['then'](function(_0x3df12f){_0x4114af[_0x1a3f('0x2b')]=_0x3df12f;if(_0x453a91[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x415923['include']=[{'all':!![]}];}return db[_0x1a3f('0x80')][_0x1a3f('0x73')](_0x415923);})[_0x1a3f('0x1a')](function(_0xb3ae07){_0x4114af[_0x1a3f('0x74')]=_0xb3ae07;return _0x4114af;});}})[_0x1a3f('0x1a')](respondWithFilteredResult(_0x3b27e6,_0x415923))[_0x1a3f('0x24')](handleError(_0x3b27e6,null));};exports['removeDispositions']=function(_0x49e94e,_0x44a1f5){return db[_0x1a3f('0x5f')]['find']({'where':{'id':_0x49e94e['params']['id']}})['then'](handleEntityNotFound(_0x44a1f5,null))['then'](function(_0x5160c6){if(_0x5160c6){return _0x5160c6['removeDispositions'](_0x49e94e[_0x1a3f('0x63')]['ids']);}})[_0x1a3f('0x1a')](respondWithStatusCode(_0x44a1f5,null))[_0x1a3f('0x24')](handleError(_0x44a1f5,null));};exports[_0x1a3f('0x85')]=function(_0x3ec7d8,_0xc18685){if(_0x3ec7d8[_0x1a3f('0x79')]['id']){delete _0x3ec7d8[_0x1a3f('0x79')]['id'];}return db['ChatWebsite'][_0x1a3f('0x77')]({'where':{'id':_0x3ec7d8[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0xc18685,null))['then'](function(_0x254a76){if(_0x254a76){_0x3ec7d8[_0x1a3f('0x79')][_0x1a3f('0x7f')]=_0x254a76['id'];return db[_0x1a3f('0x86')][_0x1a3f('0x78')](_0x3ec7d8[_0x1a3f('0x79')]);}})[_0x1a3f('0x1a')](respondWithResult(_0xc18685,null))[_0x1a3f('0x24')](handleError(_0xc18685,null));};exports[_0x1a3f('0x87')]=function(_0x155763,_0x33e8fb){var _0x1365c7={'raw':![],'where':{}};var _0x571c2c={};var _0x52166b={'count':0x0,'rows':[]};return db[_0x1a3f('0x5f')][_0x1a3f('0x82')]({'where':{'id':_0x155763[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x33e8fb,null))['then'](function(_0x31894d){if(_0x31894d){_0x571c2c['model']=_[_0x1a3f('0x64')](db[_0x1a3f('0x86')][_0x1a3f('0x60')]);_0x571c2c[_0x1a3f('0x63')]=_[_0x1a3f('0x64')](_0x155763[_0x1a3f('0x63')]);_0x571c2c['filters']=_[_0x1a3f('0x66')](_0x571c2c[_0x1a3f('0x58')],_0x571c2c[_0x1a3f('0x63')]);_0x1365c7[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x571c2c[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0x155763['query'][_0x1a3f('0x68')]));_0x1365c7['attributes']=_0x1365c7['attributes']['length']?_0x1365c7[_0x1a3f('0x67')]:_0x571c2c[_0x1a3f('0x58')];if(!_0x155763['query']['hasOwnProperty']('nolimit')){_0x1365c7[_0x1a3f('0x2a')]=qs[_0x1a3f('0x2a')](_0x155763[_0x1a3f('0x63')]['limit']);_0x1365c7[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x155763[_0x1a3f('0x63')]['offset']);}_0x1365c7['order']=qs[_0x1a3f('0x84')](_0x155763[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x1365c7['where']=qs[_0x1a3f('0x65')](_[_0x1a3f('0x6d')](_0x155763[_0x1a3f('0x63')],_0x571c2c[_0x1a3f('0x65')]));_0x1365c7[_0x1a3f('0x6c')][_0x1a3f('0x7f')]=_0x31894d['id'];if(_0x155763[_0x1a3f('0x63')][_0x1a3f('0x6e')]){_0x1365c7[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x1365c7[_0x1a3f('0x6c')],{'$or':_[_0x1a3f('0x43')](_0x1365c7[_0x1a3f('0x67')],function(_0x1f3c8d){var _0x4de6d8={};_0x4de6d8[_0x1f3c8d]={'$like':'%'+_0x155763[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x4de6d8;})});}_0x1365c7=_[_0x1a3f('0x6f')]({},_0x1365c7,_0x155763[_0x1a3f('0x70')]);return db[_0x1a3f('0x86')][_0x1a3f('0x2b')]({'where':_0x1365c7[_0x1a3f('0x6c')]})[_0x1a3f('0x1a')](function(_0x8a3fe4){_0x52166b[_0x1a3f('0x2b')]=_0x8a3fe4;if(_0x155763[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x1365c7[_0x1a3f('0x72')]=[{'all':!![]}];}return db[_0x1a3f('0x86')][_0x1a3f('0x73')](_0x1365c7);})[_0x1a3f('0x1a')](function(_0x2aee86){_0x52166b[_0x1a3f('0x74')]=_0x2aee86;return _0x52166b;});}})[_0x1a3f('0x1a')](respondWithFilteredResult(_0x33e8fb,_0x1365c7))[_0x1a3f('0x24')](handleError(_0x33e8fb,null));};exports[_0x1a3f('0x88')]=function(_0x379ff7,_0x35b6b6){return db[_0x1a3f('0x5f')][_0x1a3f('0x77')]({'where':{'id':_0x379ff7['params']['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x35b6b6,null))[_0x1a3f('0x1a')](function(_0x59187e){if(_0x59187e){return _0x59187e[_0x1a3f('0x88')](_0x379ff7[_0x1a3f('0x63')][_0x1a3f('0x89')]);}})[_0x1a3f('0x1a')](respondWithStatusCode(_0x35b6b6,null))[_0x1a3f('0x24')](handleError(_0x35b6b6,null));};exports[_0x1a3f('0x8a')]=function(_0x54a632,_0x45af03){_0x54a632['body'][_0x1a3f('0x8b')]=_0x54a632[_0x1a3f('0x8c')]['filename'];return db[_0x1a3f('0x5f')]['find']({'where':{'id':_0x54a632[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x45af03,null))['then'](saveUpdates(_0x54a632[_0x1a3f('0x79')],null))[_0x1a3f('0x1a')](respondWithResult(_0x45af03,null))['catch'](handleError(_0x45af03,null));};exports[_0x1a3f('0x8d')]=function(_0x445175,_0xd81c55){_0x445175[_0x1a3f('0x79')]['agentAvatar']=_0x445175[_0x1a3f('0x8c')][_0x1a3f('0x8e')];return db[_0x1a3f('0x5f')][_0x1a3f('0x77')]({'where':{'id':_0x445175[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0xd81c55,null))['then'](saveUpdates(_0x445175[_0x1a3f('0x79')],null))[_0x1a3f('0x1a')](respondWithResult(_0xd81c55,null))['catch'](handleError(_0xd81c55,null));};exports[_0x1a3f('0x8f')]=function(_0x25c768,_0x3823e5){_0x25c768['body']['customerAvatar']=_0x25c768[_0x1a3f('0x8c')][_0x1a3f('0x8e')];return db[_0x1a3f('0x5f')]['find']({'where':{'id':_0x25c768['params']['id']}})['then'](handleEntityNotFound(_0x3823e5,null))['then'](saveUpdates(_0x25c768[_0x1a3f('0x79')],null))[_0x1a3f('0x1a')](respondWithResult(_0x3823e5,null))[_0x1a3f('0x24')](handleError(_0x3823e5,null));};exports[_0x1a3f('0x90')]=function(_0x400c3c,_0x5d016c){_0x400c3c[_0x1a3f('0x79')][_0x1a3f('0x91')]=_0x400c3c[_0x1a3f('0x8c')][_0x1a3f('0x8e')];return db[_0x1a3f('0x5f')]['find']({'where':{'id':_0x400c3c[_0x1a3f('0x76')]['id']}})['then'](handleEntityNotFound(_0x5d016c,null))['then'](saveUpdates(_0x400c3c[_0x1a3f('0x79')],null))[_0x1a3f('0x1a')](respondWithResult(_0x5d016c,null))['catch'](handleError(_0x5d016c,null));};exports[_0x1a3f('0x92')]=function(_0x4aab24,_0x5dd636){var _0x2d0ab7=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x95'));var _0x259d1d={'where':{'id':_0x4aab24[_0x1a3f('0x76')]['id']},'attributes':['id',_0x1a3f('0x8b')],'raw':!![]};var _0x599858=![];return require(_0x1a3f('0x96'))[_0x1a3f('0x97')]()['then'](function(_0x39fda2){if(_0x39fda2){_0x599858=_0x39fda2[_0x1a3f('0x98')];}})[_0x1a3f('0x1a')](function(){return db[_0x1a3f('0x5f')][_0x1a3f('0x77')](_0x259d1d);})[_0x1a3f('0x1a')](handleEntityNotFound(_0x5dd636,null))[_0x1a3f('0x1a')](function(_0x3fbe07){if(_0x3fbe07){if(!_[_0x1a3f('0x99')](_0x3fbe07[_0x1a3f('0x8b')])){if(fs['existsSync'](path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],'server/files/images/logos/',_0x3fbe07['sitepic']))&&_0x599858){_0x2d0ab7=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],'server/files/images/logos/',_0x3fbe07[_0x1a3f('0x8b')]);}}return _0x5dd636['download'](_0x2d0ab7);}})['catch'](handleError(_0x5dd636,null));};exports[_0x1a3f('0x9a')]=function(_0x1d2fa5,_0x390132){var _0x2307bd=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9b'));var _0x4f1f84={'where':{'id':_0x1d2fa5[_0x1a3f('0x76')]['id']},'attributes':['id',_0x1a3f('0x9c')],'raw':!![]};return db['ChatWebsite']['find'](_0x4f1f84)[_0x1a3f('0x1a')](handleEntityNotFound(_0x390132,null))[_0x1a3f('0x1a')](function(_0x5e8ebd){if(_0x5e8ebd){if(!_[_0x1a3f('0x99')](_0x5e8ebd[_0x1a3f('0x9c')])){if(fs[_0x1a3f('0x9d')](path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x5e8ebd[_0x1a3f('0x9c')]))){_0x2307bd=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x5e8ebd['agentAvatar']);}}return _0x390132[_0x1a3f('0x9f')](_0x2307bd);}})[_0x1a3f('0x24')](handleError(_0x390132,null));};exports[_0x1a3f('0xa0')]=function(_0x306ad8,_0x4cbc36){var _0x27b3dd=path['join'](config[_0x1a3f('0x94')],_0x1a3f('0xa1'));var _0x19f7cd={'where':{'id':_0x306ad8['params']['id']},'attributes':['id','customerAvatar',_0x1a3f('0xa2')],'raw':!![]};return db['ChatWebsite'][_0x1a3f('0x77')](_0x19f7cd)[_0x1a3f('0x1a')](handleEntityNotFound(_0x4cbc36,null))[_0x1a3f('0x1a')](function(_0x546a6d){if(_0x546a6d){if(!_[_0x1a3f('0x99')](_0x546a6d[_0x1a3f('0xa3')])){if(fs[_0x1a3f('0x9d')](path['join'](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x546a6d[_0x1a3f('0xa3')]))&&_0x546a6d[_0x1a3f('0xa2')]){_0x27b3dd=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x546a6d[_0x1a3f('0xa3')]);}}return _0x4cbc36[_0x1a3f('0x9f')](_0x27b3dd);}})[_0x1a3f('0x24')](handleError(_0x4cbc36,null));};exports[_0x1a3f('0xa4')]=function(_0x2a5232,_0x1693e6){var _0x54f98c=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],'server/files/images/avatars/system_avatar.png');var _0x1a624f={'where':{'id':_0x2a5232[_0x1a3f('0x76')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1a3f('0x5f')]['find'](_0x1a624f)[_0x1a3f('0x1a')](handleEntityNotFound(_0x1693e6,null))[_0x1a3f('0x1a')](function(_0x467797){if(_0x467797){if(!_[_0x1a3f('0x99')](_0x467797[_0x1a3f('0x91')])){if(fs['existsSync'](path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x467797['systemAvatar']))){_0x54f98c=path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x9e'),_0x467797[_0x1a3f('0x91')]);}}return _0x1693e6[_0x1a3f('0x9f')](_0x54f98c);}})[_0x1a3f('0x24')](handleError(_0x1693e6,null));};exports[_0x1a3f('0xa5')]=function(_0x4bb3fc,_0x2e5ec0){var _0x1717e5={'body':_0x4bb3fc[_0x1a3f('0x79')],'channel':'chat'};var _0x573031=[];var _0x49451b=[];var _0x44b801={};var _0x5d0a1c=![];return db['CmContact'][_0x1a3f('0x7e')]()[_0x1a3f('0x1a')](function(_0x1b16a7){if(!_0x1b16a7){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xa8'));}_0x573031=_['difference'](_[_0x1a3f('0x64')](_0x1b16a7),[_0x1a3f('0xa9'),'updatedAt']);_0x49451b=_['difference'](_[_0x1a3f('0x64')](_0x1b16a7),[_0x1a3f('0xa9'),'updatedAt','CompanyId',_0x1a3f('0xaa')]);if(_0x4bb3fc[_0x1a3f('0x79')]['id']){delete _0x4bb3fc['body']['id'];}if(_['isNil'](_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xab')])){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xac'));}if(_[_0x1a3f('0x99')](_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0x79')])||_0x4bb3fc[_0x1a3f('0x79')]['body']===''){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xad'));}if(_[_0x1a3f('0x99')](_0x4bb3fc[_0x1a3f('0x79')]['mapKey'])){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xae')+_0x49451b);}if(!_[_0x1a3f('0xaf')](_0x49451b,_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xb0')])){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xb1')+_0x49451b);}_0x44b801[_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xb0')]]=_0x4bb3fc['body'][_0x1a3f('0xab')];})['then'](function(){return db['ChatWebsite'][_0x1a3f('0x77')]({'where':{'id':_0x4bb3fc[_0x1a3f('0x76')]['id']},'include':[{'model':db[_0x1a3f('0xb2')],'as':_0x1a3f('0xb3'),'include':[{'model':db[_0x1a3f('0xb4')],'as':_0x1a3f('0xb5'),'where':_0x44b801,'limit':0x1,'order':[[_0x1a3f('0xb6'),'DESC']]}]},{'model':db[_0x1a3f('0xb7')],'as':_0x1a3f('0xb8')},{'model':db['Interval'],'as':_0x1a3f('0x44'),'include':[{'model':db[_0x1a3f('0x44')],'as':_0x1a3f('0xb9'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x1a3f('0x1a')](function(_0x265d4a){if(!_0x265d4a)throw new APINotFoundError(util[_0x1a3f('0x3a')](_0x1a3f('0xba'),_0x4bb3fc[_0x1a3f('0x76')]['id']));if(!_0x265d4a['Interval']||!_0x265d4a[_0x1a3f('0x44')][_0x1a3f('0xb9')])return[_0x265d4a,!![]];return[_0x265d4a,checkWebsiteIntervals(_0x265d4a)];})['spread'](function(_0xe0f764,_0x370b8a){if(!_0x370b8a)throw new APIOutOfIntervalError();if(!_0xe0f764[_0x1a3f('0xb3')])return;_0x1717e5[_0x1a3f('0xbb')]=_0xe0f764;_0x1717e5[_0x1a3f('0xbc')]=_0xe0f764[_0x1a3f('0xb3')];_0x1717e5[_0x1a3f('0xbd')]=_[_0x1a3f('0xbe')](_0xe0f764[_0x1a3f('0xb8')],[_0x1a3f('0xbf')],[_0x1a3f('0xc0')]);if(_0x1717e5[_0x1a3f('0xbb')][_0x1a3f('0xb8')]){delete _0x1717e5[_0x1a3f('0xbb')]['Applications'];}if(_0x1717e5[_0x1a3f('0xbb')][_0x1a3f('0xb3')]&&_0x1717e5['account'][_0x1a3f('0xb3')]['Contacts'][_0x1a3f('0x69')]){return _0x1717e5[_0x1a3f('0xbb')][_0x1a3f('0xb3')][_0x1a3f('0xb5')][0x0];}var _0x13226c=_['defaults'](_0x4bb3fc[_0x1a3f('0x79')],{'firstName':_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xab')],'ListId':_0xe0f764[_0x1a3f('0xaa')]});_0x13226c[_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xb0')]]=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xab')];return db[_0x1a3f('0xb4')][_0x1a3f('0x78')](_0x13226c,{'fields':_0x573031,'raw':!![]});})[_0x1a3f('0x1a')](function(_0x4ef5fa){_0x1717e5[_0x1a3f('0xc1')]=_0x4ef5fa;var _0x2eacd8=createInteractionObject(_0x4bb3fc['params']['id'],_0x4bb3fc[_0x1a3f('0x79')],_0x4bb3fc[_0x1a3f('0xc2')],_0x4ef5fa);var _0x348a46={'ChatWebsiteId':_0x4bb3fc[_0x1a3f('0x76')]['id'],'closed':![]};if(_0x4bb3fc['body'][_0x1a3f('0xc3')]){_0x348a46[_0x1a3f('0xc3')]=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc3')];return db[_0x1a3f('0xc4')]['find']({'where':_0x348a46})['then'](function(_0x2fe571){if(_0x2fe571){_0x5d0a1c=!![];return _0x2fe571;}_0x2eacd8[_0x1a3f('0xc3')]=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc3')];_0x2eacd8[_0x1a3f('0xc5')]=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc5')];return db[_0x1a3f('0xc4')]['create'](_0x2eacd8);});}_0x348a46[_0x1a3f('0xc6')]=_0x4ef5fa['id'];if(_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc7')]&&_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc7')]['id']){_0x348a46['id']=_0x4bb3fc['body']['interaction']['id'];return db[_0x1a3f('0xc4')][_0x1a3f('0x77')]({'where':_0x348a46})[_0x1a3f('0x1a')](function(_0x53a29e){if(_0x53a29e){_0x5d0a1c=!![];return _0x53a29e;}return db[_0x1a3f('0xc4')][_0x1a3f('0x78')](_0x2eacd8);});}return db[_0x1a3f('0xc4')][_0x1a3f('0x78')](_0x2eacd8);})[_0x1a3f('0x1a')](function(_0x23f458){if(!_0x5d0a1c)return _0x23f458;var _0x50447a={'from':(_0x1717e5[_0x1a3f('0xc1')]['firstName']||'')+'\x20'+(_0x1717e5[_0x1a3f('0xc1')][_0x1a3f('0x50')]||'')};if(_0x4bb3fc[_0x1a3f('0x79')]['threadId']&&_0x4bb3fc['body'][_0x1a3f('0xc8')]&&_0x4bb3fc[_0x1a3f('0x79')]['threadId']!=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc8')]){_0x50447a[_0x1a3f('0xc3')]=_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xc8')];}return _0x23f458['update'](_0x50447a);})[_0x1a3f('0x1a')](function(_0x178eac){_0x1717e5[_0x1a3f('0xc7')]=_0x178eac['get']({'plain':!![]});_0x1717e5[_0x1a3f('0xc7')]['created']=!_0x5d0a1c;if(_0x1717e5[_0x1a3f('0xc7')][_0x1a3f('0xc9')]){if(_0x1717e5['account']['autoclose']){_0x1717e5[_0x1a3f('0xbd')]['push']({'id':0x0,'priority':_0x1717e5['applications'][_0x1a3f('0x69')]+0x1,'app':'close','appdata':_0x1a3f('0xca'),'interval':_0x1a3f('0xcb')});}}return db['ChatMessage'][_0x1a3f('0x78')]({'body':_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0x79')],'ChatWebsiteId':_0x4bb3fc[_0x1a3f('0x76')]['id'],'ChatInteractionId':_0x178eac['id'],'direction':'in','ContactId':_0x1717e5['contact']['id'],'AttachmentId':_0x4bb3fc[_0x1a3f('0x79')][_0x1a3f('0xcc')]});})['then'](function(_0x497717){_0x1717e5[_0x1a3f('0x21')]=_0x497717;if(!_0x1717e5[_0x1a3f('0xc7')]['UserId']){return;}return db['User'][_0x1a3f('0x77')]({'attributes':['id','name'],'where':{'id':_0x1717e5[_0x1a3f('0xc7')][_0x1a3f('0xcd')]}});})[_0x1a3f('0x1a')](function(_0x3a412a){if(_0x3a412a){_0x1717e5[_0x1a3f('0xbd')][_0x1a3f('0xce')]({'id':0x0,'priority':0x0,'app':_0x1a3f('0xcf'),'appdata':_0x3a412a['name']+','+(_0x1717e5[_0x1a3f('0xbb')]['waitForTheAssignedAgent']||0xa),'interval':_0x1a3f('0xcb')});_0x1717e5[_0x1a3f('0xd0')]=!![];}if(!_0x1717e5['interaction'][_0x1a3f('0xd1')]){return;}return db[_0x1a3f('0xd2')][_0x1a3f('0x77')]({'attributes':['id','name'],'where':{'id':_0x1717e5['interaction'][_0x1a3f('0xd1')]}});})[_0x1a3f('0x1a')](function(_0x57febb){if(_0x57febb){_0x1717e5['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x1a3f('0xd3'),'appdata':_0x57febb[_0x1a3f('0x35')]+','+(_0x1717e5['account'][_0x1a3f('0xd4')]||0x12c),'interval':_0x1a3f('0xcb')});}return respondWithRpcPromise(_0x1a3f('0xd5'),'startRouting',_0x1717e5);})['then'](function(_0x262821){respondWithRpcPromise('EventManager',_0x1a3f('0xd6'),{'event':_0x1a3f('0xa5'),'message':_0x262821},client9002);return _0x262821;})[_0x1a3f('0x1a')](respondWithResult(_0x2e5ec0,null))[_0x1a3f('0x24')](APIHandleError(_0x2e5ec0));};exports[_0x1a3f('0xd7')]=function(_0x4d8c2a,_0x4f0382){var _0x308d7d,_0x4e61b5,_0x104588;var _0x834e02=[];var _0x50aef9={};var _0x316445=_0x4d8c2a[_0x1a3f('0xd8')]||[];var _0x2e3cd2=[];var _0x2fb5e8;return db[_0x1a3f('0xb4')]['describe']()['then'](function(_0x41e031){if(!_0x41e031){throw new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xa8'));}_0x834e02=_['difference'](_[_0x1a3f('0x64')](_0x41e031),[_0x1a3f('0xa9'),_0x1a3f('0xb6'),'CompanyId',_0x1a3f('0xaa')]);if(_0x4d8c2a[_0x1a3f('0x79')]['id']){delete _0x4d8c2a[_0x1a3f('0x79')]['id'];}if(_['isNil'](_0x4d8c2a['body'][_0x1a3f('0xab')])){throw _0x4f0382[_0x1a3f('0x26')](0x1f4)[_0x1a3f('0x36')](new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xac')));}if(_[_0x1a3f('0x99')](_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0x79')])||_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0x79')]===''){throw _0x4f0382['status'](0x1f4)[_0x1a3f('0x36')](new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xad')));}if(_[_0x1a3f('0x99')](_0x4d8c2a['body'][_0x1a3f('0xd9')])){throw _0x4f0382[_0x1a3f('0x26')](0x1f4)['send'](new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))](_0x1a3f('0xda')+_0x834e02));}if(!_[_0x1a3f('0xaf')](_0x834e02,_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0xd9')])){throw _0x4f0382[_0x1a3f('0x26')](0x1f4)[_0x1a3f('0x36')](new db[(_0x1a3f('0xa6'))][(_0x1a3f('0xa7'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x834e02));}_0x50aef9[_0x4d8c2a[_0x1a3f('0x79')]['mapKeyOffline']]=_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0xab')];})[_0x1a3f('0x1a')](function(){return db['ChatWebsite'][_0x1a3f('0x77')]({'where':{'id':_0x4d8c2a[_0x1a3f('0x76')]['id']},'include':[{'model':db[_0x1a3f('0xb2')],'as':'List'},{'model':db['MailAccount'],'as':_0x1a3f('0xdb')}]});})[_0x1a3f('0x1a')](handleEntityNotFound(_0x4f0382,null))['then'](function(_0x74d945){if(_0x74d945&&_0x74d945[_0x1a3f('0xb3')]){_0x4e61b5=_0x74d945;var _0x204962=_['defaults'](_0x4d8c2a[_0x1a3f('0x79')],{'firstName':_0x4d8c2a['body'][_0x1a3f('0xab')],'phone':_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0xab')],'ListId':_0x74d945[_0x1a3f('0xaa')]});_0x204962[_0x4d8c2a['body'][_0x1a3f('0xd9')]]=_0x4d8c2a[_0x1a3f('0x79')][_0x1a3f('0xab')];return db[_0x1a3f('0xb4')][_0x1a3f('0xdc')]({'where':_0x50aef9,'defaults':_0x204962});}})[_0x1a3f('0xdd')](function(_0x2dff72){if(_0x2dff72){_0x104588=_0x2dff72;var _0x476a05=fs['readFileSync'](path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0xde')),_0x1a3f('0xdf'));var _0xee852d=ejs[_0x1a3f('0xe0')](_0x476a05,{'body':_[_0x1a3f('0xe1')](_0x4d8c2a[_0x1a3f('0x79')]['body']),'bodyTitle':_0x4e61b5[_0x1a3f('0xe2')]});return db[_0x1a3f('0xe3')][_0x1a3f('0x78')]({'body':_0xee852d,'plainBody':htmlToText[_0x1a3f('0xe4')](_0xee852d),'ContactId':_0x2dff72['id'],'ChatWebsiteId':_0x4e61b5['id']});}})[_0x1a3f('0x1a')](function(_0x60d61){_0x2fb5e8=_0x60d61;if(_0x316445[_0x1a3f('0x69')]){var _0x5d2360=_0x316445['map'](function(_0x34a0ac){return{'name':_0x34a0ac[_0x1a3f('0xe5')],'basename':_0x34a0ac[_0x1a3f('0x8e')],'type':_0x34a0ac[_0x1a3f('0xe6')],'ChatOfflineMessageId':_0x60d61['id']};});_0x2e3cd2=_0x5d2360[_0x1a3f('0x43')](_0xc6487b=>{var _0x42c24b={'filename':_0xc6487b[_0x1a3f('0x35')],'path':path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0xe7'),_0x1a3f('0xd8'),_0x1a3f('0xe8'),_0x1a3f('0xe9'),_0xc6487b[_0x1a3f('0xea')])};return _0x42c24b;});if(!_0x4e61b5[_0x1a3f('0xeb')]){return db['sequelize'][_0x1a3f('0xec')](function(_0x293e31){return db[_0x1a3f('0xed')][_0x1a3f('0xee')](_0x5d2360,{'transaction':_0x293e31});});}}})['then'](function(){if(_0x2fb5e8){_0x308d7d=_0x2fb5e8;return db[_0x1a3f('0xdb')][_0x1a3f('0x82')]({'where':{'service':!![]},'include':[{'model':db[_0x1a3f('0xef')],'as':_0x1a3f('0xf0'),'raw':!![],'include':[{'model':db[_0x1a3f('0xf1')],'as':_0x1a3f('0xf1'),'raw':!![]}]}]});}})[_0x1a3f('0x1a')](function(_0x4cb046){if(_0x4cb046&&_0x4cb046[_0x1a3f('0xf0')]&&_0x4e61b5['forwardOffline']&&_0x4e61b5['forwardOfflineAddress']){var _0x32a2d4=_0x4cb046[_0x1a3f('0xf2')]();return respondWithRpcPromise(_0x1a3f('0xf3'),_0x1a3f('0xf4'),{'account':_0x32a2d4,'message':{'from':util['format'](_0x1a3f('0xf5'),_0x4cb046[_0x1a3f('0x35')],_0x4cb046[_0x1a3f('0xf6')]||_0x4cb046[_0x1a3f('0xf0')][_0x1a3f('0x7a')]),'to':_0x4e61b5[_0x1a3f('0xf7')],'subject':_0x4e61b5[_0x1a3f('0xf8')],'html':_0x308d7d['body'],'attachments':_0x2e3cd2}},client9003)['then'](function(){return _0x308d7d;})['catch'](function(_0x570bc1){logger[_0x1a3f('0x1f')](_0x570bc1);});}})[_0x1a3f('0x1a')](function(){if(_0x4e61b5&&_0x4e61b5[_0x1a3f('0xeb')]&&_0x4e61b5[_0x1a3f('0xf9')]){var _0x72a65c=[];if(_0x316445[_0x1a3f('0x69')]){_0x72a65c=_0x316445[_0x1a3f('0x43')](function(_0x3235d4){return{'name':_0x3235d4[_0x1a3f('0xe5')],'basename':_0x3235d4['filename'],'type':_0x3235d4['mimetype'],'ChatOfflineMessageId':_0x2fb5e8['id']};});}var _0x342661;if(!_[_0x1a3f('0x99')](_0x4e61b5[_0x1a3f('0xfa')])){var _0x3b02bc=_[_0x1a3f('0x43')](_0x4d8c2a[_0x1a3f('0x79')],function(_0x14ad6e){return _0x14ad6e;});var _0x33e1ff=_['toPairsIn'](_0x3b02bc)[0x0];var _0x5bfda7=_[_0x1a3f('0xfb')](_0x33e1ff,function(_0x1f4622){return _0x1f4622;});_0x342661=_0x5bfda7[0x1][_0x4e61b5[_0x1a3f('0xfa')]];}var _0x4a06f2={'from':_0x104588['email'],'firstName':_0x104588[_0x1a3f('0x4f')],'lastName':_0x104588[_0x1a3f('0x50')],'mapKey':_0x1a3f('0xf6'),'message':{'from':_0x104588[_0x1a3f('0xf6')],'to':_0x4e61b5[_0x1a3f('0xdb')][_0x1a3f('0xf6')],'cc':'','subject':_[_0x1a3f('0x99')](_0x342661)?_0x4e61b5['offlineMessageSubject']:_0x342661,'messageId':'','sentAt':new Date(),'attach':_0x72a65c[_0x1a3f('0x69')],'attachments':_0x72a65c,'originChannel':'Chat','ChatWebsiteId':_0x4e61b5['id'],'ChatOfflineMessageId':_0x308d7d['id'],'originTo':_0x4e61b5[_0x1a3f('0xdb')][_0x1a3f('0xf6')]},'body':_0x308d7d[_0x1a3f('0x79')]};var _0x36a3a3={'account':{'id':_0x4e61b5[_0x1a3f('0xf9')]},'body':_0x4a06f2,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x1a3f('0xfc'),_0x36a3a3,client9001)['then'](function(){return _0x308d7d;})['catch'](function(_0x53c210){logger['error'](_0x53c210);});}return;})[_0x1a3f('0x1a')](function(){if(_0x308d7d){return _0x308d7d;}})[_0x1a3f('0x1a')](respondWithResult(_0x4f0382,null))[_0x1a3f('0x24')](function(){for(var _0x10dddc of _0x316445){var _0x2ee5ab=path['join'](config[_0x1a3f('0x94')],'server',_0x1a3f('0xd8'),_0x1a3f('0xe8'),_0x1a3f('0xe9'),_0x10dddc['filename']);fs_extra['remove'](_0x2ee5ab)['catch'](function(_0x43b9e4){logger[_0x1a3f('0x1f')](_0x1a3f('0xfd'),_0x2ee5ab,_0x43b9e4);});}});};exports['addInteraction']=function(_0x1a8626,_0x28bea0){return db[_0x1a3f('0xc4')][_0x1a3f('0x77')]({'where':{'id':_0x1a8626[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x28bea0,null))[_0x1a3f('0x1a')](function(_0xec928b){if(_0xec928b){return _0xec928b[_0x1a3f('0xfe')](_0x1a8626[_0x1a3f('0x79')]['ids'],_[_0x1a3f('0xff')](_0x1a8626[_0x1a3f('0x79')],['ids','id'])||{});}})[_0x1a3f('0x1a')](respondWithResult(_0x28bea0,null))[_0x1a3f('0x24')](handleError(_0x28bea0,null));};exports['getInteractions']=function(_0x38f01f,_0x5dd51d){var _0x5da05f={'raw':![],'where':{}};var _0x55bbc8={};var _0x48f910={'count':0x0,'rows':[]};return db[_0x1a3f('0x5f')][_0x1a3f('0x82')]({'where':{'id':_0x38f01f[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x5dd51d,null))[_0x1a3f('0x1a')](function(_0x52d77e){if(_0x52d77e){_0x55bbc8[_0x1a3f('0x58')]=_[_0x1a3f('0x64')](db[_0x1a3f('0xc4')][_0x1a3f('0x60')]);_0x55bbc8['query']=_[_0x1a3f('0x64')](_0x38f01f['query']);_0x55bbc8['filters']=_[_0x1a3f('0x66')](_0x55bbc8[_0x1a3f('0x58')],_0x55bbc8['query']);_0x5da05f[_0x1a3f('0x67')]=_['intersection'](_0x55bbc8[_0x1a3f('0x58')],qs['fields'](_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x68')]));_0x5da05f[_0x1a3f('0x67')]=_0x5da05f[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x5da05f[_0x1a3f('0x67')]:_0x55bbc8['model'];if(!_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x83')](_0x1a3f('0x6a'))){_0x5da05f[_0x1a3f('0x2a')]=qs[_0x1a3f('0x2a')](_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x2a')]);_0x5da05f['offset']=qs[_0x1a3f('0x28')](_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x28')]);}_0x5da05f['order']=qs[_0x1a3f('0x84')](_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x5da05f[_0x1a3f('0x6c')]=qs['filters'](_[_0x1a3f('0x6d')](_0x38f01f[_0x1a3f('0x63')],_0x55bbc8[_0x1a3f('0x65')]));_0x5da05f[_0x1a3f('0x6c')][_0x1a3f('0x7f')]=_0x52d77e['id'];if(_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x6e')]){_0x5da05f[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x5da05f[_0x1a3f('0x6c')],{'$or':_['map'](_0x5da05f[_0x1a3f('0x67')],function(_0x10c85a){var _0x47877e={};_0x47877e[_0x10c85a]={'$like':'%'+_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x47877e;})});}_0x5da05f=_[_0x1a3f('0x6f')]({},_0x5da05f,_0x38f01f['options']);return db[_0x1a3f('0xc4')][_0x1a3f('0x2b')]({'where':_0x5da05f[_0x1a3f('0x6c')]})[_0x1a3f('0x1a')](function(_0x1183ac){_0x48f910[_0x1a3f('0x2b')]=_0x1183ac;if(_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x5da05f['include']=[{'model':db[_0x1a3f('0xb4')],'as':_0x1a3f('0x100'),'required':![]},{'model':db[_0x1a3f('0x101')],'as':_0x1a3f('0x102'),'attributes':[_0x1a3f('0x35'),_0x1a3f('0x103'),_0x1a3f('0x104')],'required':![]},{'model':db[_0x1a3f('0x105')],'as':_0x1a3f('0x106'),'attributes':['id',_0x1a3f('0x35'),'color'],'where':_0x38f01f['query'][_0x1a3f('0x107')]?{'id':_0x38f01f[_0x1a3f('0x63')][_0x1a3f('0x107')]}:undefined,'required':_0x38f01f[_0x1a3f('0x63')]['tag']?!![]:![]}];}return db[_0x1a3f('0xc4')][_0x1a3f('0x73')](_0x5da05f);})[_0x1a3f('0x1a')](function(_0x324288){_0x48f910[_0x1a3f('0x74')]=_0x324288;return _0x48f910;});}})['then'](respondWithFilteredResult(_0x5dd51d,_0x5da05f))['catch'](handleError(_0x5dd51d,null));};exports[_0x1a3f('0x38')]=function(_0x5308d3,_0x209d12){var _0x3ab40f=0x0;var _0x493bba=0x0;var _0x35923a=![];var _0x8863af;var _0x196290;return db[_0x1a3f('0x5f')][_0x1a3f('0x77')]({'where':{'id':_0x5308d3[_0x1a3f('0x76')]['id']},'include':[{'model':db[_0x1a3f('0x44')],'as':'Interval','include':[{'model':db[_0x1a3f('0x44')],'as':_0x1a3f('0xb9'),'attributes':['id',_0x1a3f('0x3b')]}]}]})[_0x1a3f('0x1a')](handleEntityNotFound(_0x209d12,null))[_0x1a3f('0x1a')](function(_0x4fdeee){if(_0x4fdeee){_0x8863af=_0x4fdeee;return _0x4fdeee['getProactiveActions']({'raw':!![]});}})[_0x1a3f('0x1a')](function(_0x4ded93){if(_0x8863af){if(_0x4ded93){_0x196290=_0x4ded93;}}return require(_0x1a3f('0x96'))[_0x1a3f('0x97')]();})[_0x1a3f('0x1a')](function(_0x5713e4){if(_0x5713e4){_0x493bba=_0x5713e4[_0x1a3f('0x108')];_0x35923a=_0x5713e4[_0x1a3f('0x98')];}})[_0x1a3f('0x1a')](function(){return db[_0x1a3f('0xc4')][_0x1a3f('0x2b')]({'where':{'closed':![]}});})[_0x1a3f('0x1a')](function(_0x40740a){_0x3ab40f=_0x40740a;if(_0x493bba&&_0x40740a>_0x493bba){return db[_0x1a3f('0x109')][_0x1a3f('0x82')]({'where':{'id':0x1}})[_0x1a3f('0x1a')](function(_0x22634f){if(_0x22634f){_0x22634f[_0x1a3f('0x10a')]('chatLicenseExceeded');}});}})[_0x1a3f('0x1a')](function(){if(!_0x8863af['Interval']||!_0x8863af[_0x1a3f('0x44')][_0x1a3f('0xb9')])return!![];return checkWebsiteIntervals(_0x8863af);})['then'](function(_0x3233dc){var _0x2b0c0c=fs[_0x1a3f('0x10b')](path[_0x1a3f('0x93')](config[_0x1a3f('0x94')],_0x1a3f('0x10c')),_0x1a3f('0xdf'));var _0x1f120c=new url[(_0x1a3f('0x10d'))](_0x8863af[_0x1a3f('0x10e')])[_0x1a3f('0x10f')];var _0x8b1e8a=_0x1a3f('0x110');var _0x4f6950=![];var _0x4e3f03={'chatVersion':_0x8b1e8a,'chatWebsiteAddressOrigin':_0x1f120c,'remote':_0x8863af[_0x1a3f('0x111')],'query':querystring[_0x1a3f('0x1e')](_['merge'](_0x8863af['get']({'plain':!![]}),{'customerIp':_0x5308d3[_0x1a3f('0xc2')]['x-forwarded-for']||_0x5308d3['headers']['x-real-ip']||_0x5308d3['connection'][_0x1a3f('0x112')]||_0x5308d3['ip'],'referer':_0x5308d3[_0x1a3f('0xc2')][_0x1a3f('0x52')],'openedInteractions':_0x3ab40f,'maxInteractions':_0x493bba,'virtual':_0x35923a[_0x1a3f('0x108')],'online':_0x3233dc,'custom':_0x35923a}))['replace'](/'/g,'\x5c\x27')};_0x209d12[_0x1a3f('0x36')](ejs['render'](Mustache[_0x1a3f('0xe0')](_0x2b0c0c,_0x4e3f03),{'proactiveActions':_0x196290,'alignment':_0x8863af['alignment'],'verticalAlignment':_0x8863af[_0x1a3f('0x113')],'div_color':_0x8863af[_0x1a3f('0x114')],'labelText':_0x8863af[_0x1a3f('0x115')],'text_color':_0x8863af[_0x1a3f('0x116')],'text_button_color':_0x8863af[_0x1a3f('0x117')],'button_color':_0x8863af[_0x1a3f('0x118')],'background_color':_0x8863af['backgroundColor'],'hideWhenOffline':_0x8863af[_0x1a3f('0x119')],'intervalId':_0x8863af['IntervalId'],'isDevelopment':_0x4f6950,'chatVersion':_0x8b1e8a}));})[_0x1a3f('0x24')](handleError(_0x209d12,null));};exports[_0x1a3f('0x11a')]=function(_0x4e4d22,_0x4a2d83){var _0x53ed93=_0x4e4d22[_0x1a3f('0x76')]['id'];var _0x3859dc=_0x4e4d22[_0x1a3f('0x79')];var _0x4ba42d=0xc8;var _0x375ffa=null;return db[_0x1a3f('0x11b')][_0x1a3f('0xec')]({'isolationLevel':db['sequelize'][_0x1a3f('0x11c')][_0x1a3f('0x11d')][_0x1a3f('0x11e')]},function(_0xef859f){return db['ChatWebsite']['findOne']({'where':{'id':_0x53ed93},'transaction':_0xef859f})[_0x1a3f('0x1a')](function(_0xdfea87){if(_0xdfea87){return db[_0x1a3f('0xb7')][_0x1a3f('0x33')]({'where':{'ChatWebsiteId':_0x53ed93},'transaction':_0xef859f})['then'](function(){var _0x484bf1=_[_0x1a3f('0x43')](_0x3859dc,function(_0x49010d){_0x49010d[_0x1a3f('0x7f')]=_0x53ed93;return _0x49010d;});return db[_0x1a3f('0xb7')]['bulkCreate'](_0x484bf1,{'transaction':_0xef859f});});}else{_0x4ba42d=0x194;_0x375ffa=[];}});})[_0x1a3f('0x1a')](function(){if(_0x4ba42d!==0x194){return db['ChatApplication'][_0x1a3f('0x11f')]({'where':{'ChatWebsiteId':_0x53ed93},'order':_0x1a3f('0xbf')})['then'](function(_0x4d1913){_0x375ffa=_0x4d1913;});}})[_0x1a3f('0x24')](function(_0xa62064){_0x4ba42d=0x1f4;logger[_0x1a3f('0x1f')](_0xa62064[_0x1a3f('0x34')]);if(_0xa62064[_0x1a3f('0x35')]){delete _0xa62064[_0x1a3f('0x35')];}_0x375ffa=_0xa62064;})[_0x1a3f('0x120')](function(){if(_0x375ffa===null){_0x4a2d83[_0x1a3f('0x25')](_0x4ba42d);}else{if(_0x4ba42d===0x1f4){_0x4a2d83[_0x1a3f('0x26')](_0x4ba42d)[_0x1a3f('0x36')](_0x375ffa);}else{_0x4a2d83[_0x1a3f('0x26')](_0x4ba42d)[_0x1a3f('0x2e')](_0x375ffa);}}});};exports[_0x1a3f('0x121')]=function(_0x1cd91a,_0x1d9cb5){var _0x2fc7a0={};var _0x35953b={};var _0xa76a6d;var _0x116d65;return db[_0x1a3f('0x5f')][_0x1a3f('0x82')]({'where':{'id':_0x1cd91a[_0x1a3f('0x76')]['id']}})['then'](handleEntityNotFound(_0x1d9cb5,null))[_0x1a3f('0x1a')](function(_0x23e2c3){if(_0x23e2c3){_0xa76a6d=_0x23e2c3;_0x35953b[_0x1a3f('0x58')]=_[_0x1a3f('0x64')](db[_0x1a3f('0xb7')]['rawAttributes']);_0x35953b[_0x1a3f('0x63')]=_[_0x1a3f('0x64')](_0x1cd91a[_0x1a3f('0x63')]);_0x35953b[_0x1a3f('0x65')]=_[_0x1a3f('0x66')](_0x35953b[_0x1a3f('0x58')],_0x35953b[_0x1a3f('0x63')]);_0x2fc7a0[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x35953b[_0x1a3f('0x58')],qs['fields'](_0x1cd91a[_0x1a3f('0x63')]['fields']));_0x2fc7a0[_0x1a3f('0x67')]=_0x2fc7a0['attributes'][_0x1a3f('0x69')]?_0x2fc7a0['attributes']:_0x35953b[_0x1a3f('0x58')];_0x2fc7a0[_0x1a3f('0x6b')]=qs[_0x1a3f('0x84')](_0x1cd91a[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x2fc7a0[_0x1a3f('0x6c')]=qs[_0x1a3f('0x65')](_[_0x1a3f('0x6d')](_0x1cd91a[_0x1a3f('0x63')],_0x35953b[_0x1a3f('0x65')]));if(_0x1cd91a[_0x1a3f('0x63')]['filter']){_0x2fc7a0['where']=_['merge'](_0x2fc7a0[_0x1a3f('0x6c')],{'$or':_[_0x1a3f('0x43')](_0x2fc7a0[_0x1a3f('0x67')],function(_0x145381){var _0x221e73={};_0x221e73[_0x145381]={'$like':'%'+_0x1cd91a[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x221e73;})});}_0x2fc7a0=_['merge']({},_0x2fc7a0,_0x1cd91a[_0x1a3f('0x70')]);return _0xa76a6d[_0x1a3f('0x121')](_0x2fc7a0);}})['then'](function(_0x5233ed){if(_0x5233ed){_0x116d65=_0x5233ed[_0x1a3f('0x69')];if(!_0x1cd91a['query'][_0x1a3f('0x83')](_0x1a3f('0x6a'))){_0x2fc7a0[_0x1a3f('0x2a')]=qs[_0x1a3f('0x2a')](_0x1cd91a['query'][_0x1a3f('0x2a')]);_0x2fc7a0[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x1cd91a[_0x1a3f('0x63')]['offset']);}return _0xa76a6d[_0x1a3f('0x121')](_0x2fc7a0);}})[_0x1a3f('0x1a')](function(_0x17dd51){if(_0x17dd51){return _0x17dd51?{'count':_0x116d65,'rows':_0x17dd51}:null;}})[_0x1a3f('0x1a')](respondWithResult(_0x1d9cb5,null))[_0x1a3f('0x24')](handleError(_0x1d9cb5,null));};exports[_0x1a3f('0x122')]=function(_0x58a2dc,_0x4b1fe5){return db[_0x1a3f('0x123')]['find']({'where':{'id':_0x58a2dc[_0x1a3f('0x76')]['id']}})['then'](handleEntityNotFound(_0x4b1fe5,null))[_0x1a3f('0x1a')](function(_0x57092b){if(_0x57092b){return _0x57092b[_0x1a3f('0x122')](_0x58a2dc[_0x1a3f('0x79')][_0x1a3f('0x89')],_[_0x1a3f('0xff')](_0x58a2dc[_0x1a3f('0x79')],[_0x1a3f('0x89'),'id'])||{});}})[_0x1a3f('0x1a')](respondWithResult(_0x4b1fe5,null))['catch'](handleError(_0x4b1fe5,null));};exports['getProactiveActions']=function(_0xb008cc,_0x43b591){var _0x14ecaf={};var _0x1837f6={};var _0xe5594a;var _0xadf3a3;return db[_0x1a3f('0x5f')][_0x1a3f('0x82')]({'where':{'id':_0xb008cc[_0x1a3f('0x76')]['id']}})['then'](handleEntityNotFound(_0x43b591,null))['then'](function(_0x1a7423){if(_0x1a7423){_0xe5594a=_0x1a7423;_0x1837f6[_0x1a3f('0x58')]=_[_0x1a3f('0x64')](db[_0x1a3f('0x124')]['rawAttributes']);_0x1837f6[_0x1a3f('0x63')]=_[_0x1a3f('0x64')](_0xb008cc[_0x1a3f('0x63')]);_0x1837f6['filters']=_[_0x1a3f('0x66')](_0x1837f6[_0x1a3f('0x58')],_0x1837f6[_0x1a3f('0x63')]);_0x14ecaf[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x1837f6[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0xb008cc[_0x1a3f('0x63')]['fields']));_0x14ecaf['attributes']=_0x14ecaf[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x14ecaf[_0x1a3f('0x67')]:_0x1837f6[_0x1a3f('0x58')];_0x14ecaf[_0x1a3f('0x6b')]=qs[_0x1a3f('0x84')](_0xb008cc[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x14ecaf[_0x1a3f('0x6c')]=qs[_0x1a3f('0x65')](_['pick'](_0xb008cc[_0x1a3f('0x63')],_0x1837f6[_0x1a3f('0x65')]));if(_0xb008cc[_0x1a3f('0x63')][_0x1a3f('0x6e')]){_0x14ecaf[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x14ecaf['where'],{'$or':_[_0x1a3f('0x43')](_0x14ecaf[_0x1a3f('0x67')],function(_0xeac137){var _0x22642f={};_0x22642f[_0xeac137]={'$like':'%'+_0xb008cc['query']['filter']+'%'};return _0x22642f;})});}_0x14ecaf=_[_0x1a3f('0x6f')]({},_0x14ecaf,_0xb008cc[_0x1a3f('0x70')]);return _0xe5594a[_0x1a3f('0x125')](_0x14ecaf);}})['then'](function(_0x25f94e){if(_0x25f94e){_0xadf3a3=_0x25f94e[_0x1a3f('0x69')];if(!_0xb008cc[_0x1a3f('0x63')][_0x1a3f('0x83')](_0x1a3f('0x6a'))){_0x14ecaf[_0x1a3f('0x2a')]=qs[_0x1a3f('0x2a')](_0xb008cc[_0x1a3f('0x63')][_0x1a3f('0x2a')]);_0x14ecaf[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0xb008cc[_0x1a3f('0x63')]['offset']);}return _0xe5594a[_0x1a3f('0x125')](_0x14ecaf);}})[_0x1a3f('0x1a')](function(_0x408fee){if(_0x408fee){return _0x408fee?{'count':_0xadf3a3,'rows':_0x408fee}:null;}})[_0x1a3f('0x1a')](respondWithResult(_0x43b591,null))[_0x1a3f('0x24')](handleError(_0x43b591,null));};exports[_0x1a3f('0x126')]=function(_0x59add8,_0x1c6356){var _0x383c6c=_0x59add8['query'][_0x1a3f('0x127')]==='false'?'offlineForm':_0x1a3f('0x128');return db['ChatWebsite'][_0x1a3f('0x77')]({'attributes':['id',_0x383c6c],'where':{'id':_0x59add8['params']['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x1c6356,null))[_0x1a3f('0x1a')](function(_0x33a655){if(_0x33a655){var _0x5818d9=_0x33a655[_0x383c6c];var _0x69ccb6=_0x5818d9&&_0x5818d9['items']?_0x5818d9[_0x1a3f('0x129')]:[];_0x1c6356[_0x1a3f('0x36')]({'fromKey':_[_0x1a3f('0x99')](_0x5818d9[_0x1a3f('0x12a')])?undefined:_0x5818d9['fromKey'],'count':_0x69ccb6['length'],'rows':_0x69ccb6});}})['catch'](handleError(_0x1c6356,null));};exports[_0x1a3f('0x12b')]=function(_0x504430,_0x5dbc07){var _0x3834d2={'raw':![],'where':{}};var _0x2b951f={};var _0x2a811a={'count':0x0,'rows':[]};return db[_0x1a3f('0x5f')]['findOne']({'where':{'id':_0x504430['params']['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x5dbc07,null))['then'](function(_0x5acb68){if(_0x5acb68){_0x2b951f[_0x1a3f('0x58')]=_[_0x1a3f('0x64')](db['ChatOfflineMessage']['rawAttributes']);_0x2b951f[_0x1a3f('0x63')]=_['keys'](_0x504430['query']);_0x2b951f[_0x1a3f('0x65')]=_[_0x1a3f('0x66')](_0x2b951f[_0x1a3f('0x58')],_0x2b951f[_0x1a3f('0x63')]);_0x3834d2[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x2b951f[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0x504430['query'][_0x1a3f('0x68')]));_0x3834d2['attributes']=_0x3834d2[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x3834d2[_0x1a3f('0x67')]:_0x2b951f[_0x1a3f('0x58')];if(!_0x504430[_0x1a3f('0x63')][_0x1a3f('0x83')]('nolimit')){_0x3834d2[_0x1a3f('0x2a')]=qs['limit'](_0x504430['query'][_0x1a3f('0x2a')]);_0x3834d2[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x504430[_0x1a3f('0x63')]['offset']);}_0x3834d2[_0x1a3f('0x6b')]=qs[_0x1a3f('0x84')](_0x504430[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x3834d2[_0x1a3f('0x6c')]=qs[_0x1a3f('0x65')](_[_0x1a3f('0x6d')](_0x504430[_0x1a3f('0x63')],_0x2b951f['filters']));_0x3834d2[_0x1a3f('0x6c')][_0x1a3f('0x7f')]=_0x5acb68['id'];if(_0x504430[_0x1a3f('0x63')][_0x1a3f('0x6e')]){_0x3834d2[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x3834d2[_0x1a3f('0x6c')],{'$or':_[_0x1a3f('0x43')](_0x3834d2[_0x1a3f('0x67')],function(_0x1be1bd){var _0x190341={};_0x190341[_0x1be1bd]={'$like':'%'+_0x504430[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x190341;})});}_0x3834d2=_[_0x1a3f('0x6f')]({},_0x3834d2,_0x504430[_0x1a3f('0x70')]);return db['ChatOfflineMessage'][_0x1a3f('0x2b')]({'where':_0x3834d2[_0x1a3f('0x6c')]})[_0x1a3f('0x1a')](function(_0x15b3dc){_0x2a811a[_0x1a3f('0x2b')]=_0x15b3dc;if(_0x504430[_0x1a3f('0x63')][_0x1a3f('0x71')]){_0x3834d2[_0x1a3f('0x72')]=[{'all':!![]}];}else{_0x3834d2[_0x1a3f('0x72')]=[{'model':db['CmContact'],'as':_0x1a3f('0x100'),'required':![]},{'model':db[_0x1a3f('0xed')],'as':_0x1a3f('0x12c'),'required':![]}];}return db[_0x1a3f('0xe3')]['findAll'](_0x3834d2);})['then'](function(_0x479034){_0x2a811a[_0x1a3f('0x74')]=_0x479034;return _0x2a811a;});}})[_0x1a3f('0x1a')](respondWithFilteredResult(_0x5dbc07,_0x3834d2))[_0x1a3f('0x24')](handleError(_0x5dbc07,null));};exports['addAgents']=function(_0x2f82f0,_0x5789b3){return db['ChatWebsite']['find']({'where':{'id':_0x2f82f0['params']['id']}})['then'](handleEntityNotFound(_0x5789b3,null))[_0x1a3f('0x1a')](function(_0x4eecc6){if(_0x4eecc6){return _0x4eecc6['addAgents'](_0x2f82f0[_0x1a3f('0x79')][_0x1a3f('0x89')],_[_0x1a3f('0xff')](_0x2f82f0['body'],['ids','id'])||{})[_0x1a3f('0xdd')](function(_0x47a73d){for(var _0xd7427c=0x0;_0xd7427c<_0x2f82f0[_0x1a3f('0x79')][_0x1a3f('0x89')][_0x1a3f('0x69')];_0xd7427c+=0x1){socket[_0x1a3f('0x12d')](_0x1a3f('0x12e'),{'UserId':Number(_0x2f82f0[_0x1a3f('0x79')][_0x1a3f('0x89')][_0xd7427c]),'ChatWebsiteId':Number(_0x2f82f0['params']['id'])});}return _0x47a73d;});}})[_0x1a3f('0x1a')](respondWithResult(_0x5789b3,null))[_0x1a3f('0x24')](handleError(_0x5789b3,null));};exports['removeAgents']=function(_0x382a94,_0x17bd4){return db[_0x1a3f('0x5f')]['find']({'where':{'id':_0x382a94[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x17bd4,null))['then'](function(_0x2b53c2){if(_0x2b53c2){return _0x2b53c2[_0x1a3f('0x12f')](_0x382a94[_0x1a3f('0x63')][_0x1a3f('0x89')])[_0x1a3f('0x1a')](function(){if(_[_0x1a3f('0x130')](_0x382a94['query'][_0x1a3f('0x89')])){for(var _0x3f8f70=0x0;_0x3f8f70<_0x382a94[_0x1a3f('0x63')][_0x1a3f('0x89')][_0x1a3f('0x69')];_0x3f8f70+=0x1){socket[_0x1a3f('0x12d')]('userChatWebsite:remove',{'UserId':Number(_0x382a94[_0x1a3f('0x63')]['ids'][_0x3f8f70]),'ChatWebsiteId':Number(_0x382a94[_0x1a3f('0x76')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x382a94[_0x1a3f('0x63')][_0x1a3f('0x89')]),'ChatWebsiteId':Number(_0x382a94[_0x1a3f('0x76')]['id'])});}});}})[_0x1a3f('0x1a')](respondWithStatusCode(_0x17bd4,null))[_0x1a3f('0x24')](handleError(_0x17bd4,null));};exports[_0x1a3f('0x131')]=function(_0x258b52,_0x13dd57){var _0x3fdb0d={};var _0x2e9dc2={};var _0x41de71;var _0x3a1048;return db[_0x1a3f('0x5f')][_0x1a3f('0x82')]({'where':{'id':_0x258b52[_0x1a3f('0x76')]['id']}})[_0x1a3f('0x1a')](handleEntityNotFound(_0x13dd57,null))[_0x1a3f('0x1a')](function(_0x4f6551){if(_0x4f6551){_0x41de71=_0x4f6551;_0x2e9dc2[_0x1a3f('0x58')]=_[_0x1a3f('0x64')](db[_0x1a3f('0x101')][_0x1a3f('0x60')]);_0x2e9dc2['query']=_[_0x1a3f('0x64')](_0x258b52[_0x1a3f('0x63')]);_0x2e9dc2['filters']=_[_0x1a3f('0x66')](_0x2e9dc2[_0x1a3f('0x58')],_0x2e9dc2[_0x1a3f('0x63')]);_0x3fdb0d[_0x1a3f('0x67')]=_[_0x1a3f('0x66')](_0x2e9dc2[_0x1a3f('0x58')],qs[_0x1a3f('0x68')](_0x258b52[_0x1a3f('0x63')]['fields']));_0x3fdb0d[_0x1a3f('0x67')]=_0x3fdb0d[_0x1a3f('0x67')][_0x1a3f('0x69')]?_0x3fdb0d[_0x1a3f('0x67')]:_0x2e9dc2[_0x1a3f('0x58')];_0x3fdb0d[_0x1a3f('0x6b')]=qs[_0x1a3f('0x84')](_0x258b52[_0x1a3f('0x63')][_0x1a3f('0x84')]);_0x3fdb0d['where']=qs[_0x1a3f('0x65')](_['pick'](_0x258b52['query'],_0x2e9dc2[_0x1a3f('0x65')]));if(_0x258b52[_0x1a3f('0x63')]['filter']){_0x3fdb0d[_0x1a3f('0x6c')]=_[_0x1a3f('0x6f')](_0x3fdb0d[_0x1a3f('0x6c')],{'$or':_[_0x1a3f('0x43')](_0x3fdb0d[_0x1a3f('0x67')],function(_0xd2f412){var _0x53b9e6={};_0x53b9e6[_0xd2f412]={'$like':'%'+_0x258b52[_0x1a3f('0x63')][_0x1a3f('0x6e')]+'%'};return _0x53b9e6;})});}_0x3fdb0d=_[_0x1a3f('0x6f')]({},_0x3fdb0d,_0x258b52[_0x1a3f('0x70')]);return _0x41de71['getAgents'](_0x3fdb0d);}})[_0x1a3f('0x1a')](function(_0x40f7c9){if(_0x40f7c9){_0x3a1048=_0x40f7c9[_0x1a3f('0x69')];if(!_0x258b52['query']['hasOwnProperty'](_0x1a3f('0x6a'))){_0x3fdb0d['limit']=qs['limit'](_0x258b52[_0x1a3f('0x63')]['limit']);_0x3fdb0d[_0x1a3f('0x28')]=qs[_0x1a3f('0x28')](_0x258b52[_0x1a3f('0x63')]['offset']);}return _0x41de71[_0x1a3f('0x131')](_0x3fdb0d);}})[_0x1a3f('0x1a')](function(_0x4eee61){if(_0x4eee61){return _0x4eee61?{'count':_0x3a1048,'rows':_0x4eee61}:null;}})[_0x1a3f('0x1a')](respondWithResult(_0x13dd57,null))[_0x1a3f('0x24')](handleError(_0x13dd57,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 05561d7..2d59961 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 _0x7fbe=['update','remove','emit','hasOwnProperty','hook','exports','ChatWebsite','setMaxListeners','save'];(function(_0x3f5f86,_0x5bce99){var _0x46a54b=function(_0x582bf2){while(--_0x582bf2){_0x3f5f86['push'](_0x3f5f86['shift']());}};_0x46a54b(++_0x5bce99);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x50e89b,_0x4bded8){_0x50e89b=_0x50e89b-0x0;var _0x4b9202=_0x7fbe[_0x50e89b];return _0x4b9202;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xe7fb('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe7fb('0x1')](0x0);var events={'afterCreate':_0xe7fb('0x2'),'afterUpdate':_0xe7fb('0x3'),'afterDestroy':_0xe7fb('0x4')};function emitEvent(_0x47625b){return function(_0x11d2c4,_0x4524ff,_0x36ab90){ChatWebsiteEvents[_0xe7fb('0x5')](_0x47625b+':'+_0x11d2c4['id'],_0x11d2c4);ChatWebsiteEvents[_0xe7fb('0x5')](_0x47625b,_0x11d2c4);_0x36ab90(null);};}for(var e in events){if(events[_0xe7fb('0x6')](e)){var event=events[e];ChatWebsite[_0xe7fb('0x7')](e,emitEvent(event));}}module[_0xe7fb('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xeea0=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','hook'];(function(_0x14e96d,_0x2f570e){var _0x501bde=function(_0x31a892){while(--_0x31a892){_0x14e96d['push'](_0x14e96d['shift']());}};_0x501bde(++_0x2f570e);}(_0xeea0,0x91));var _0x0eea=function(_0x5ceee4,_0x1cffab){_0x5ceee4=_0x5ceee4-0x0;var _0x9e3de9=_0xeea0[_0x5ceee4];return _0x9e3de9;};'use strict';var EventEmitter=require(_0x0eea('0x0'));var ChatWebsite=require(_0x0eea('0x1'))['db'][_0x0eea('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0eea('0x3')](0x0);var events={'afterCreate':_0x0eea('0x4'),'afterUpdate':'update','afterDestroy':_0x0eea('0x5')};function emitEvent(_0x2ffc52){return function(_0x14e0ec,_0x12e52e,_0x41117c){ChatWebsiteEvents[_0x0eea('0x6')](_0x2ffc52+':'+_0x14e0ec['id'],_0x14e0ec);ChatWebsiteEvents[_0x0eea('0x6')](_0x2ffc52,_0x14e0ec);_0x41117c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0eea('0x7')](e,emitEvent(event));}}module[_0x0eea('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 81141f7..31283fb 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 _0xe8ae=['ChatWebsite','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatWebsite.attributes','exports'];(function(_0x176ea7,_0x4d64cf){var _0x10c256=function(_0x395a5b){while(--_0x395a5b){_0x176ea7['push'](_0x176ea7['shift']());}};_0x10c256(++_0x4d64cf);}(_0xe8ae,0x12a));var _0xee8a=function(_0x4b8ee6,_0x48036e){_0x4b8ee6=_0x4b8ee6-0x0;var _0x42d020=_0xe8ae[_0x4b8ee6];return _0x42d020;};'use strict';var _=require(_0xee8a('0x0'));var util=require(_0xee8a('0x1'));var logger=require(_0xee8a('0x2'))(_0xee8a('0x3'));var moment=require(_0xee8a('0x4'));var BPromise=require('bluebird');var rp=require(_0xee8a('0x5'));var fs=require('fs');var path=require(_0xee8a('0x6'));var rimraf=require(_0xee8a('0x7'));var config=require('../../config/environment');var attributes=require(_0xee8a('0x8'));module[_0xee8a('0x9')]=function(_0x3a7694,_0x5cf105){return _0x3a7694['define'](_0xee8a('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8cc=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define'];(function(_0x38ddbd,_0x1835ee){var _0x2451e7=function(_0x110e57){while(--_0x110e57){_0x38ddbd['push'](_0x38ddbd['shift']());}};_0x2451e7(++_0x1835ee);}(_0xa8cc,0x1b8));var _0xca8c=function(_0xd8fd6c,_0x58270f){_0xd8fd6c=_0xd8fd6c-0x0;var _0x1ffac8=_0xa8cc[_0xd8fd6c];return _0x1ffac8;};'use strict';var _=require(_0xca8c('0x0'));var util=require(_0xca8c('0x1'));var logger=require('../../config/logger')(_0xca8c('0x2'));var moment=require('moment');var BPromise=require(_0xca8c('0x3'));var rp=require(_0xca8c('0x4'));var fs=require('fs');var path=require(_0xca8c('0x5'));var rimraf=require(_0xca8c('0x6'));var config=require(_0xca8c('0x7'));var attributes=require(_0xca8c('0x8'));module['exports']=function(_0x225110,_0x11d3a0){return _0x225110[_0xca8c('0x9')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index e512f89..db6fb3a 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 _0xeef3=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1206d4,_0x2c5019){var _0x115190=function(_0x41fd66){while(--_0x41fd66){_0x1206d4['push'](_0x1206d4['shift']());}};_0x115190(++_0x2c5019);}(_0xeef3,0x1ab));var _0x3eef=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0xeef3[_0x13b330];return _0x1f666c;};'use strict';var _=require('lodash');var util=require(_0x3eef('0x0'));var moment=require(_0x3eef('0x1'));var BPromise=require(_0x3eef('0x2'));var rs=require(_0x3eef('0x3'));var fs=require('fs');var Redis=require(_0x3eef('0x4'));var db=require(_0x3eef('0x5'))['db'];var utils=require(_0x3eef('0x6'));var logger=require('../../config/logger')(_0x3eef('0x7'));var config=require(_0x3eef('0x8'));var jayson=require(_0x3eef('0x9'));var client=jayson[_0x3eef('0xa')][_0x3eef('0xb')]({'port':0x232a});config['redis']=_[_0x3eef('0xc')](config[_0x3eef('0xd')],{'host':_0x3eef('0xe'),'port':0x18eb});var socket=require(_0x3eef('0xf'))(new Redis(config[_0x3eef('0xd')]));require(_0x3eef('0x10'))[_0x3eef('0x11')](socket);function respondWithRpcPromise(_0x474a74,_0x32f1c1,_0x30324f){return new BPromise(function(_0x1f4806,_0x392075){return client[_0x3eef('0x12')](_0x474a74,_0x30324f)['then'](function(_0x32e713){logger[_0x3eef('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x32f1c1,'request\x20sent');logger['debug'](_0x3eef('0x14'),_0x32f1c1,'request\x20sent',JSON[_0x3eef('0x15')](_0x32e713));if(_0x32e713[_0x3eef('0x16')]){if(_0x32e713[_0x3eef('0x16')][_0x3eef('0x17')]===0x1f4){logger[_0x3eef('0x16')](_0x3eef('0x18'),_0x32f1c1,_0x32e713[_0x3eef('0x16')][_0x3eef('0x19')]);return _0x392075(_0x32e713[_0x3eef('0x16')]['message']);}logger[_0x3eef('0x16')](_0x3eef('0x18'),_0x32f1c1,_0x32e713[_0x3eef('0x16')]['message']);return _0x1f4806(_0x32e713[_0x3eef('0x16')][_0x3eef('0x19')]);}else{logger[_0x3eef('0x13')](_0x3eef('0x18'),_0x32f1c1,_0x3eef('0x1a'));_0x1f4806(_0x32e713[_0x3eef('0x1b')][_0x3eef('0x19')]);}})[_0x3eef('0x1c')](function(_0x4db568){logger[_0x3eef('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x32f1c1,_0x4db568);_0x392075(_0x4db568);});});} \ No newline at end of file +var _0x757d=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x13d190,_0x3ee8c3){var _0x2f3492=function(_0x4e9fa7){while(--_0x4e9fa7){_0x13d190['push'](_0x13d190['shift']());}};_0x2f3492(++_0x3ee8c3);}(_0x757d,0x156));var _0xd757=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0x757d[_0xf46bd9];return _0x2763c3;};'use strict';var _=require(_0xd757('0x0'));var util=require(_0xd757('0x1'));var moment=require(_0xd757('0x2'));var BPromise=require(_0xd757('0x3'));var rs=require(_0xd757('0x4'));var fs=require('fs');var Redis=require(_0xd757('0x5'));var db=require(_0xd757('0x6'))['db'];var utils=require(_0xd757('0x7'));var logger=require('../../config/logger')(_0xd757('0x8'));var config=require(_0xd757('0x9'));var jayson=require(_0xd757('0xa'));var client=jayson['client'][_0xd757('0xb')]({'port':0x232a});config[_0xd757('0xc')]=_['defaults'](config[_0xd757('0xc')],{'host':_0xd757('0xd'),'port':0x18eb});var socket=require(_0xd757('0xe'))(new Redis(config['redis']));require(_0xd757('0xf'))[_0xd757('0x10')](socket);function respondWithRpcPromise(_0x451168,_0x574c3f,_0x2ab5c8){return new BPromise(function(_0x1cf911,_0x382a2f){return client[_0xd757('0x11')](_0x451168,_0x2ab5c8)[_0xd757('0x12')](function(_0x399a61){logger[_0xd757('0x13')](_0xd757('0x14'),_0x574c3f,_0xd757('0x15'));logger[_0xd757('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x574c3f,_0xd757('0x15'),JSON[_0xd757('0x17')](_0x399a61));if(_0x399a61[_0xd757('0x18')]){if(_0x399a61[_0xd757('0x18')][_0xd757('0x19')]===0x1f4){logger['error'](_0xd757('0x14'),_0x574c3f,_0x399a61[_0xd757('0x18')]['message']);return _0x382a2f(_0x399a61[_0xd757('0x18')][_0xd757('0x1a')]);}logger[_0xd757('0x18')](_0xd757('0x14'),_0x574c3f,_0x399a61[_0xd757('0x18')][_0xd757('0x1a')]);return _0x1cf911(_0x399a61[_0xd757('0x18')][_0xd757('0x1a')]);}else{logger['info'](_0xd757('0x14'),_0x574c3f,_0xd757('0x15'));_0x1cf911(_0x399a61[_0xd757('0x1b')][_0xd757('0x1a')]);}})['catch'](function(_0x57cf34){logger['error'](_0xd757('0x14'),_0x574c3f,_0x57cf34);_0x382a2f(_0x57cf34);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index daf06e9..5db5bf7 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 _0xa510=['save','remove','update','removeListener','register','length','./chatWebsite.events'];(function(_0x42ff3e,_0x5be1cf){var _0x5869c2=function(_0x5e375e){while(--_0x5e375e){_0x42ff3e['push'](_0x42ff3e['shift']());}};_0x5869c2(++_0x5be1cf);}(_0xa510,0x141));var _0x0a51=function(_0x327c33,_0x1f87dd){_0x327c33=_0x327c33-0x0;var _0x2a244f=_0xa510[_0x327c33];return _0x2a244f;};'use strict';var ChatWebsiteEvents=require(_0x0a51('0x0'));var events=[_0x0a51('0x1'),_0x0a51('0x2'),_0x0a51('0x3')];function createListener(_0x100ecc,_0x47446b){return function(_0x2fce49){_0x47446b['emit'](_0x100ecc,_0x2fce49);};}function removeListener(_0x412555,_0x1f0191){return function(){ChatWebsiteEvents[_0x0a51('0x4')](_0x412555,_0x1f0191);};}exports[_0x0a51('0x5')]=function(_0xa2c68d){for(var _0x24f259=0x0,_0x1709a7=events[_0x0a51('0x6')];_0x24f259<_0x1709a7;_0x24f259++){var _0x200457=events[_0x24f259];var _0x2367b1=createListener('chatWebsite:'+_0x200457,_0xa2c68d);ChatWebsiteEvents['on'](_0x200457,_0x2367b1);}}; \ No newline at end of file +var _0xb949=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','emit'];(function(_0x369a49,_0x397650){var _0x376b72=function(_0x5cb1e8){while(--_0x5cb1e8){_0x369a49['push'](_0x369a49['shift']());}};_0x376b72(++_0x397650);}(_0xb949,0x14c));var _0x9b94=function(_0x2f275d,_0x2e3b1d){_0x2f275d=_0x2f275d-0x0;var _0x44a8d8=_0xb949[_0x2f275d];return _0x44a8d8;};'use strict';var ChatWebsiteEvents=require(_0x9b94('0x0'));var events=[_0x9b94('0x1'),_0x9b94('0x2'),'update'];function createListener(_0x517b93,_0x2ed60b){return function(_0x1c64ad){_0x2ed60b[_0x9b94('0x3')](_0x517b93,_0x1c64ad);};}function removeListener(_0x2fa323,_0xe709e2){return function(){ChatWebsiteEvents[_0x9b94('0x4')](_0x2fa323,_0xe709e2);};}exports[_0x9b94('0x5')]=function(_0x4bbaa0){for(var _0x171c15=0x0,_0x2997fb=events[_0x9b94('0x6')];_0x171c15<_0x2997fb;_0x171c15++){var _0x31ac62=events[_0x171c15];var _0x1e6fa7=createListener(_0x9b94('0x7')+_0x31ac62,_0x4bbaa0);ChatWebsiteEvents['on'](_0x31ac62,_0x1e6fa7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cba8d53..f013b2b 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 _0x2387=['originalname','single','addAvatar','addCustomerAvatar','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','create','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','/:id/logo','file','addLogo','server/files/images/avatars/'];(function(_0x9a7b80,_0x3f017c){var _0x578621=function(_0x595cd4){while(--_0x595cd4){_0x9a7b80['push'](_0x9a7b80['shift']());}};_0x578621(++_0x3f017c);}(_0x2387,0x1eb));var _0x7238=function(_0x54fb02,_0x44ab3c){_0x54fb02=_0x54fb02-0x0;var _0x4fe5b9=_0x2387[_0x54fb02];return _0x4fe5b9;};'use strict';var multer=require(_0x7238('0x0'));var util=require(_0x7238('0x1'));var path=require('path');var timeout=require(_0x7238('0x2'));var express=require('express');var router=express[_0x7238('0x3')]();var fs_extra=require(_0x7238('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7238('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x7238('0x6')]('/',auth['isAuthenticated'](),controller[_0x7238('0x7')]);router[_0x7238('0x6')](_0x7238('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x7238('0x6')](_0x7238('0x9'),auth['isAuthenticated'](),controller[_0x7238('0xa')]);router[_0x7238('0x6')](_0x7238('0xb'),auth[_0x7238('0xc')](),controller[_0x7238('0xd')]);router[_0x7238('0x6')](_0x7238('0xe'),auth[_0x7238('0xc')](),controller[_0x7238('0xf')]);router[_0x7238('0x6')]('/:id/logo',controller[_0x7238('0x10')]);router[_0x7238('0x6')](_0x7238('0x11'),controller[_0x7238('0x12')]);router['get'](_0x7238('0x13'),controller['getCustomerAvatar']);router['get'](_0x7238('0x14'),controller[_0x7238('0x15')]);router[_0x7238('0x6')](_0x7238('0x16'),auth['isAuthenticated'](),controller[_0x7238('0x17')]);router[_0x7238('0x6')](_0x7238('0x18'),controller[_0x7238('0x19')]);router[_0x7238('0x6')]('/:id/applications',auth[_0x7238('0xc')](),controller[_0x7238('0x1a')]);router['get'](_0x7238('0x1b'),auth[_0x7238('0xc')](),controller['getProactiveActions']);router[_0x7238('0x6')]('/:id/fields',controller[_0x7238('0x1c')]);router['get'](_0x7238('0x1d'),auth[_0x7238('0xc')](),controller['getOfflineMessages']);router[_0x7238('0x6')](_0x7238('0x1e'),auth[_0x7238('0xc')](),controller['getAgents']);router['post']('/',auth[_0x7238('0xc')](),controller[_0x7238('0x1f')]);router[_0x7238('0x20')](_0x7238('0xb'),auth[_0x7238('0xc')](),controller['addDisposition']);router[_0x7238('0x20')](_0x7238('0xe'),auth['isAuthenticated'](),controller[_0x7238('0x21')]);var upload=multer({'storage':multer[_0x7238('0x22')]({'destination':function(_0x19ccd1,_0x4e2815,_0x161d55){_0x161d55(null,path[_0x7238('0x23')](config[_0x7238('0x24')],_0x7238('0x25')));},'filename':function(_0x24fb80,_0x59059d,_0x531094){_0x531094(null,util[_0x7238('0x26')](_0x7238('0x27'),Date[_0x7238('0x28')](),_0x59059d['originalname']));}})});router[_0x7238('0x20')](_0x7238('0x29'),upload['single'](_0x7238('0x2a')),controller[_0x7238('0x2b')]);var upload=multer({'storage':multer[_0x7238('0x22')]({'destination':function(_0x3bdc16,_0xf9ef2e,_0x1dd6fb){_0x1dd6fb(null,path[_0x7238('0x23')](config[_0x7238('0x24')],_0x7238('0x2c')));},'filename':function(_0x1885bb,_0x4355dd,_0x36ec46){_0x36ec46(null,util[_0x7238('0x26')](_0x7238('0x27'),Date[_0x7238('0x28')](),_0x4355dd[_0x7238('0x2d')]));}})});router['post'](_0x7238('0x11'),upload[_0x7238('0x2e')](_0x7238('0x2a')),controller[_0x7238('0x2f')]);var upload=multer({'storage':multer[_0x7238('0x22')]({'destination':function(_0x3171e0,_0x10f6d4,_0x962503){_0x962503(null,path[_0x7238('0x23')](config[_0x7238('0x24')],_0x7238('0x2c')));},'filename':function(_0x2f8be6,_0x475046,_0x2ee8c3){_0x2ee8c3(null,util[_0x7238('0x26')]('%s-%s',Date['now'](),_0x475046[_0x7238('0x2d')]));}})});router[_0x7238('0x20')](_0x7238('0x13'),upload[_0x7238('0x2e')]('file'),controller[_0x7238('0x30')]);var upload=multer({'storage':multer[_0x7238('0x22')]({'destination':function(_0x420b20,_0x188cb8,_0x52babe){_0x52babe(null,path[_0x7238('0x23')](config[_0x7238('0x24')],_0x7238('0x2c')));},'filename':function(_0x23c4c0,_0x1e4449,_0x390649){_0x390649(null,util[_0x7238('0x26')]('%s-%s',Date[_0x7238('0x28')](),_0x1e4449[_0x7238('0x2d')]));}})});router[_0x7238('0x20')](_0x7238('0x14'),upload[_0x7238('0x2e')](_0x7238('0x2a')),controller['addSystemAvatar']);router[_0x7238('0x20')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x7238('0x22')]({'destination':function(_0x5e0324,_0x1fcba9,_0x425f02){const _0x33c265=path[_0x7238('0x23')](config[_0x7238('0x24')],'server/files',_0x7238('0x31'),_0x7238('0x32'));fs_extra[_0x7238('0x33')](_0x33c265,function(){_0x425f02(null,_0x33c265);});},'filename':function(_0x2d55de,_0x1c3e76,_0x528aa9){const _0xeba64a=_0x1c3e76['originalname'][_0x7238('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x276ad3=path[_0x7238('0x35')](_0xeba64a);const _0x25bf13=Date[_0x7238('0x28')]()+'-'+_0xeba64a[_0x7238('0x34')](_0x276ad3,'')+_0x276ad3;_0x528aa9(null,_0x25bf13);}})});router[_0x7238('0x20')](_0x7238('0x36'),offlineUploadMulter[_0x7238('0x37')](),controller[_0x7238('0x38')]);router[_0x7238('0x20')](_0x7238('0x16'),auth[_0x7238('0xc')](),controller[_0x7238('0x39')]);router[_0x7238('0x20')](_0x7238('0x3a'),auth['isAuthenticated'](),controller[_0x7238('0x3b')]);router['post'](_0x7238('0x1b'),auth[_0x7238('0xc')](),controller[_0x7238('0x3c')]);router[_0x7238('0x20')](_0x7238('0x1e'),auth[_0x7238('0xc')](),controller[_0x7238('0x3d')]);router[_0x7238('0x3e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7238('0x3f')](_0x7238('0x9'),auth[_0x7238('0xc')](),controller[_0x7238('0x40')]);router['delete'](_0x7238('0xb'),auth[_0x7238('0xc')](),controller['removeDispositions']);router[_0x7238('0x3f')]('/:id/canned_answers',auth[_0x7238('0xc')](),controller[_0x7238('0x41')]);router[_0x7238('0x3f')](_0x7238('0x1e'),auth[_0x7238('0xc')](),controller['removeAgents']);module[_0x7238('0x42')]=router; \ No newline at end of file +var _0x8462=['getDispositions','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','/:id/avatar','addAvatar','diskStorage','server/files/images/avatars/','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','server/files','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions'];(function(_0x215eca,_0x4d571d){var _0x10c48f=function(_0x1ab040){while(--_0x1ab040){_0x215eca['push'](_0x215eca['shift']());}};_0x10c48f(++_0x4d571d);}(_0x8462,0x1b9));var _0x2846=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x8462[_0x5ecadc];return _0x565037;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2846('0x0'));var timeout=require(_0x2846('0x1'));var express=require(_0x2846('0x2'));var router=express[_0x2846('0x3')]();var fs_extra=require(_0x2846('0x4'));var auth=require(_0x2846('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2846('0x6'));var controller=require(_0x2846('0x7'));router[_0x2846('0x8')]('/',auth[_0x2846('0x9')](),controller[_0x2846('0xa')]);router[_0x2846('0x8')](_0x2846('0xb'),auth[_0x2846('0x9')](),controller[_0x2846('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2846('0xd')]);router[_0x2846('0x8')](_0x2846('0xe'),auth[_0x2846('0x9')](),controller[_0x2846('0xf')]);router[_0x2846('0x8')]('/:id/canned_answers',auth[_0x2846('0x9')](),controller[_0x2846('0x10')]);router[_0x2846('0x8')](_0x2846('0x11'),controller[_0x2846('0x12')]);router[_0x2846('0x8')]('/:id/avatar',controller[_0x2846('0x13')]);router[_0x2846('0x8')](_0x2846('0x14'),controller[_0x2846('0x15')]);router['get']('/:id/system_avatar',controller[_0x2846('0x16')]);router[_0x2846('0x8')](_0x2846('0x17'),auth[_0x2846('0x9')](),controller[_0x2846('0x18')]);router[_0x2846('0x8')](_0x2846('0x19'),controller['getSnippet']);router[_0x2846('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x2846('0x1a')]);router[_0x2846('0x8')](_0x2846('0x1b'),auth['isAuthenticated'](),controller[_0x2846('0x1c')]);router[_0x2846('0x8')](_0x2846('0x1d'),controller[_0x2846('0x1e')]);router[_0x2846('0x8')](_0x2846('0x1f'),auth[_0x2846('0x9')](),controller[_0x2846('0x20')]);router[_0x2846('0x8')](_0x2846('0x21'),auth[_0x2846('0x9')](),controller[_0x2846('0x22')]);router[_0x2846('0x23')]('/',auth['isAuthenticated'](),controller[_0x2846('0x24')]);router['post'](_0x2846('0xe'),auth[_0x2846('0x9')](),controller[_0x2846('0x25')]);router[_0x2846('0x23')](_0x2846('0x26'),auth['isAuthenticated'](),controller[_0x2846('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x537a12,_0x591a7e,_0x498671){_0x498671(null,path[_0x2846('0x28')](config[_0x2846('0x29')],_0x2846('0x2a')));},'filename':function(_0x5161ba,_0x5c6b38,_0x2bed3a){_0x2bed3a(null,util[_0x2846('0x2b')](_0x2846('0x2c'),Date[_0x2846('0x2d')](),_0x5c6b38[_0x2846('0x2e')]));}})});router[_0x2846('0x23')](_0x2846('0x11'),upload[_0x2846('0x2f')](_0x2846('0x30')),controller[_0x2846('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3229c3,_0x39d4e1,_0xbb2bd4){_0xbb2bd4(null,path[_0x2846('0x28')](config[_0x2846('0x29')],'server/files/images/avatars/'));},'filename':function(_0xae9dcb,_0x5815f1,_0x3f3cc7){_0x3f3cc7(null,util['format'](_0x2846('0x2c'),Date[_0x2846('0x2d')](),_0x5815f1[_0x2846('0x2e')]));}})});router[_0x2846('0x23')](_0x2846('0x32'),upload[_0x2846('0x2f')]('file'),controller[_0x2846('0x33')]);var upload=multer({'storage':multer[_0x2846('0x34')]({'destination':function(_0x526cbd,_0x1e4b12,_0x690585){_0x690585(null,path[_0x2846('0x28')](config[_0x2846('0x29')],_0x2846('0x35')));},'filename':function(_0x28c951,_0x26bead,_0x3b0ea8){_0x3b0ea8(null,util[_0x2846('0x2b')](_0x2846('0x2c'),Date[_0x2846('0x2d')](),_0x26bead[_0x2846('0x2e')]));}})});router[_0x2846('0x23')](_0x2846('0x14'),upload[_0x2846('0x2f')](_0x2846('0x30')),controller[_0x2846('0x36')]);var upload=multer({'storage':multer[_0x2846('0x34')]({'destination':function(_0x459775,_0x534fcd,_0x3fc029){_0x3fc029(null,path[_0x2846('0x28')](config[_0x2846('0x29')],_0x2846('0x35')));},'filename':function(_0x562b3b,_0x444929,_0x50cef0){_0x50cef0(null,util[_0x2846('0x2b')](_0x2846('0x2c'),Date[_0x2846('0x2d')](),_0x444929[_0x2846('0x2e')]));}})});router[_0x2846('0x23')](_0x2846('0x37'),upload['single']('file'),controller['addSystemAvatar']);router['post'](_0x2846('0x38'),controller[_0x2846('0x39')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1755f3,_0x58ca5c,_0x209c85){const _0x5179b2=path['join'](config[_0x2846('0x29')],_0x2846('0x3a'),'attachments','offline-chat');fs_extra[_0x2846('0x3b')](_0x5179b2,function(){_0x209c85(null,_0x5179b2);});},'filename':function(_0x5bbcce,_0x57ba8d,_0x3feb81){const _0x2cc9bc=_0x57ba8d[_0x2846('0x2e')][_0x2846('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3bb85d=path[_0x2846('0x3d')](_0x2cc9bc);const _0x4deca4=Date[_0x2846('0x2d')]()+'-'+_0x2cc9bc['replace'](_0x3bb85d,'')+_0x3bb85d;_0x3feb81(null,_0x4deca4);}})});router[_0x2846('0x23')](_0x2846('0x3e'),offlineUploadMulter[_0x2846('0x3f')](),controller[_0x2846('0x40')]);router[_0x2846('0x23')](_0x2846('0x17'),auth[_0x2846('0x9')](),controller[_0x2846('0x41')]);router[_0x2846('0x23')](_0x2846('0x42'),auth['isAuthenticated'](),controller[_0x2846('0x43')]);router[_0x2846('0x23')](_0x2846('0x1b'),auth[_0x2846('0x9')](),controller[_0x2846('0x44')]);router[_0x2846('0x23')]('/:id/users',auth[_0x2846('0x9')](),controller[_0x2846('0x45')]);router[_0x2846('0x46')](_0x2846('0x47'),auth[_0x2846('0x9')](),controller[_0x2846('0x48')]);router[_0x2846('0x49')]('/:id',auth[_0x2846('0x9')](),controller['destroy']);router[_0x2846('0x49')](_0x2846('0xe'),auth['isAuthenticated'](),controller[_0x2846('0x4a')]);router[_0x2846('0x49')](_0x2846('0x26'),auth[_0x2846('0x9')](),controller['removeAnswers']);router[_0x2846('0x49')](_0x2846('0x21'),auth[_0x2846('0x9')](),controller[_0x2846('0x4b')]);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 252e800..6ca4f2a 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 _0x2936=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated','exports','../config/environment','Router','env','production','app'];(function(_0x1c9aba,_0x2bafd7){var _0x5cc061=function(_0x1a2035){while(--_0x1a2035){_0x1c9aba['push'](_0x1c9aba['shift']());}};_0x5cc061(++_0x2bafd7);}(_0x2936,0x1df));var _0x6293=function(_0x13b2e4,_0x430a95){_0x13b2e4=_0x13b2e4-0x0;var _0x55d86d=_0x2936[_0x13b2e4];return _0x55d86d;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require(_0x6293('0x0'));var router=express[_0x6293('0x1')]();var isProduction=config[_0x6293('0x2')]===_0x6293('0x3')||![];function clientSideLogs(_0x213db7,_0x5257d8,_0x17bec9){var _0x296081=_0x213db7[_0x6293('0x4')][_0x6293('0x5')](_0x6293('0x6'));if(!_0x296081){throw new Error(_0x6293('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x6293('0x8'),'logger':_0x296081,'enableCors':!isProduction})(_0x213db7,_0x5257d8,_0x17bec9);}router['use'](auth[_0x6293('0x9')](),clientSideLogs);module[_0x6293('0xa')]=router; \ No newline at end of file +var _0xa8de=['../components/auth/service','../config/environment','Router','env','production','app','client-side-logger','/client-logs','use','exports','beaver-logger/server','express'];(function(_0x13568e,_0xf027a3){var _0x23e0f4=function(_0x4ef9ad){while(--_0x4ef9ad){_0x13568e['push'](_0x13568e['shift']());}};_0x23e0f4(++_0xf027a3);}(_0xa8de,0x17e));var _0xea8d=function(_0x4e1723,_0xcec37b){_0x4e1723=_0x4e1723-0x0;var _0x1266c3=_0xa8de[_0x4e1723];return _0x1266c3;};var beaverLogger=require(_0xea8d('0x0'));var express=require(_0xea8d('0x1'));var auth=require(_0xea8d('0x2'));var config=require(_0xea8d('0x3'));var router=express[_0xea8d('0x4')]();var isProduction=config[_0xea8d('0x5')]===_0xea8d('0x6')||![];function clientSideLogs(_0x5b2a2a,_0x3598d5,_0x13383e){var _0x59171a=_0x5b2a2a[_0xea8d('0x7')]['get'](_0xea8d('0x8'));if(!_0x59171a){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0xea8d('0x9'),'logger':_0x59171a,'enableCors':!isProduction})(_0x5b2a2a,_0x3598d5,_0x13383e);}router[_0xea8d('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0xea8d('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3cba4b3..0141834 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 _0xc26f=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xc26f,0x1f4));var _0xfc26=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xc26f[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0xfc26('0x0'));module[_0xfc26('0x1')]={'name':{'type':Sequelize[_0xfc26('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfc26('0x3')](_0xfc26('0x4'),_0xfc26('0x5'),_0xfc26('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfc26('0x7'),_0xfc26('0x8'))},'data1':{'type':Sequelize[_0xfc26('0x2')],'comment':_0xfc26('0x9')},'data2':{'type':Sequelize[_0xfc26('0x2')],'comment':_0xfc26('0xa')},'data3':{'type':Sequelize[_0xfc26('0x2')],'comment':_0xfc26('0xb')},'data4':{'type':Sequelize[_0xfc26('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xfc26('0xc')],'comment':_0xfc26('0xd')},'data6':{'type':Sequelize[_0xfc26('0xc')],'comment':_0xfc26('0xe')},'data7':{'type':Sequelize[_0xfc26('0xc')],'comment':_0xfc26('0xf')}}; \ No newline at end of file +var _0x5946=['exports','STRING','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','sequelize'];(function(_0x5587c5,_0x3392b9){var _0x503dff=function(_0xff2ba9){while(--_0xff2ba9){_0x5587c5['push'](_0x5587c5['shift']());}};_0x503dff(++_0x3392b9);}(_0x5946,0xa9));var _0x6594=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x5946[_0x56f7e2];return _0x36240b;};'use strict';var Sequelize=require(_0x6594('0x0'));module[_0x6594('0x1')]={'name':{'type':Sequelize[_0x6594('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6594('0x3')]('AmazonAWS','Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6594('0x4'),_0x6594('0x5'))},'data1':{'type':Sequelize[_0x6594('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x6594('0x6')},'data3':{'type':Sequelize[_0x6594('0x2')],'comment':_0x6594('0x7')},'data4':{'type':Sequelize[_0x6594('0x2')],'comment':_0x6594('0x8')},'data5':{'type':Sequelize[_0x6594('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x6594('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1736fc2..e48fb45 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 _0xd5d5=['then','destroy','error','stack','name','send','slice','CloudProvider','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','service','MicrosoftAzure','data3','catch','show','params','options','find','decryptString','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update'];(function(_0x565051,_0x41e6ad){var _0x4a937c=function(_0x36ddc5){while(--_0x36ddc5){_0x565051['push'](_0x565051['shift']());}};_0x4a937c(++_0x41e6ad);}(_0xd5d5,0x16c));var _0x5d5d=function(_0x1bf301,_0xda5c4c){_0x1bf301=_0x1bf301-0x0;var _0x51c947=_0xd5d5[_0x1bf301];return _0x51c947;};'use strict';var _=require(_0x5d5d('0x0'));var Redis=require(_0x5d5d('0x1'));var qs=require(_0x5d5d('0x2'));var encryptor=require(_0x5d5d('0x3'));var config=require('../../config/environment');var logger=require(_0x5d5d('0x4'))('api');var db=require(_0x5d5d('0x5'))['db'];var oauth=require(_0x5d5d('0x6'));config[_0x5d5d('0x7')]=_['defaults'](config[_0x5d5d('0x7')],{'host':_0x5d5d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d5d('0x7')]));var redis=new Redis(config[_0x5d5d('0x7')]);function respondWithStatusCode(_0x5940b4,_0x3812cf){_0x3812cf=_0x3812cf||0xcc;return function(_0x1472e9){if(_0x1472e9){return _0x5940b4[_0x5d5d('0x9')](_0x3812cf);}return _0x5940b4[_0x5d5d('0xa')](_0x3812cf)[_0x5d5d('0xb')]();};}function respondWithResult(_0x2db3bc,_0x49322a){_0x49322a=_0x49322a||0xc8;return function(_0x46f186){if(_0x46f186){return _0x2db3bc['status'](_0x49322a)[_0x5d5d('0xc')](_0x46f186);}};}function respondWithFilteredResult(_0x133585,_0x180e0b){return function(_0x1b2f5d){if(_0x1b2f5d){var _0x4061f5=typeof _0x180e0b[_0x5d5d('0xd')]===_0x5d5d('0xe')&&typeof _0x180e0b[_0x5d5d('0xf')]==='undefined';var _0x170319=_0x1b2f5d['count'];var _0x16b35e=_0x4061f5?0x0:_0x180e0b[_0x5d5d('0xd')];var _0xb33c12=_0x4061f5?_0x1b2f5d[_0x5d5d('0x10')]:_0x180e0b[_0x5d5d('0xd')]+_0x180e0b['limit'];var _0xdd323a;if(_0xb33c12>=_0x170319){_0xb33c12=_0x170319;_0xdd323a=0xc8;}else{_0xdd323a=0xce;}_0x133585[_0x5d5d('0xa')](_0xdd323a);return _0x133585[_0x5d5d('0x11')](_0x5d5d('0x12'),_0x16b35e+'-'+_0xb33c12+'/'+_0x170319)['json'](_0x1b2f5d);}return null;};}function saveUpdates(_0x53f8de){return function(_0x535fb7){if(_0x535fb7){return _0x535fb7[_0x5d5d('0x13')](_0x53f8de)[_0x5d5d('0x14')](function(_0x1ab61a){return _0x1ab61a;});}return null;};}function removeEntity(_0x47f00c){return function(_0x63d8de){if(_0x63d8de){return _0x63d8de[_0x5d5d('0x15')]()[_0x5d5d('0x14')](function(){_0x47f00c[_0x5d5d('0xa')](0xcc)[_0x5d5d('0xb')]();});}};}function handleEntityNotFound(_0x1865d5){return function(_0x5633dc){if(!_0x5633dc){_0x1865d5[_0x5d5d('0x9')](0x194);}return _0x5633dc;};}function handleError(_0x5c93b3,_0x2d1b36){_0x2d1b36=_0x2d1b36||0x1f4;return function(_0x5696c3){logger[_0x5d5d('0x16')](_0x5696c3[_0x5d5d('0x17')]);if(_0x5696c3[_0x5d5d('0x18')]){delete _0x5696c3[_0x5d5d('0x18')];}_0x5c93b3[_0x5d5d('0xa')](_0x2d1b36)[_0x5d5d('0x19')](_0x5696c3);};}function maskClientSecret(_0x1b1c6e){return _['padEnd'](_0x1b1c6e[_0x5d5d('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x5e7f2b,_0x16bafa){var _0x3ee9a4={},_0xb705e1={},_0xd4c0af={'count':0x0,'rows':[]};var _0x188a8e=_['map'](db[_0x5d5d('0x1b')][_0x5d5d('0x1c')],function(_0x23d7ce){return{'name':_0x23d7ce[_0x5d5d('0x1d')],'type':_0x23d7ce['type'][_0x5d5d('0x1e')]};});_0xb705e1[_0x5d5d('0x1f')]=_[_0x5d5d('0x20')](_0x188a8e,_0x5d5d('0x18'));_0xb705e1[_0x5d5d('0x21')]=_[_0x5d5d('0x22')](_0x5e7f2b[_0x5d5d('0x21')]);_0xb705e1['filters']=_[_0x5d5d('0x23')](_0xb705e1[_0x5d5d('0x1f')],_0xb705e1['query']);_0x3ee9a4[_0x5d5d('0x24')]=_[_0x5d5d('0x23')](_0xb705e1[_0x5d5d('0x1f')],qs[_0x5d5d('0x25')](_0x5e7f2b[_0x5d5d('0x21')][_0x5d5d('0x25')]));_0x3ee9a4['attributes']=_0x3ee9a4[_0x5d5d('0x24')][_0x5d5d('0x26')]?_0x3ee9a4[_0x5d5d('0x24')]:_0xb705e1[_0x5d5d('0x1f')];if(!_0x5e7f2b[_0x5d5d('0x21')][_0x5d5d('0x27')](_0x5d5d('0x28'))){_0x3ee9a4[_0x5d5d('0xf')]=qs[_0x5d5d('0xf')](_0x5e7f2b[_0x5d5d('0x21')][_0x5d5d('0xf')]);_0x3ee9a4[_0x5d5d('0xd')]=qs[_0x5d5d('0xd')](_0x5e7f2b[_0x5d5d('0x21')]['offset']);}_0x3ee9a4[_0x5d5d('0x29')]=qs[_0x5d5d('0x2a')](_0x5e7f2b['query']['sort']);_0x3ee9a4[_0x5d5d('0x2b')]=qs[_0x5d5d('0x2c')](_[_0x5d5d('0x2d')](_0x5e7f2b[_0x5d5d('0x21')],_0xb705e1['filters']),_0x188a8e);if(_0x5e7f2b[_0x5d5d('0x21')]['filter']){_0x3ee9a4[_0x5d5d('0x2b')]=_[_0x5d5d('0x2e')](_0x3ee9a4[_0x5d5d('0x2b')],{'$or':_[_0x5d5d('0x20')](_0x188a8e,function(_0x34ba89){if(_0x34ba89[_0x5d5d('0x2f')]!==_0x5d5d('0x30')){var _0x1fd1fb={};_0x1fd1fb[_0x34ba89[_0x5d5d('0x18')]]={'$like':'%'+_0x5e7f2b[_0x5d5d('0x21')][_0x5d5d('0x31')]+'%'};return _0x1fd1fb;}})});}_0x3ee9a4=_['merge']({},_0x3ee9a4,_0x5e7f2b['options']);var _0x43032f={'where':_0x3ee9a4[_0x5d5d('0x2b')]};return db[_0x5d5d('0x1b')][_0x5d5d('0x10')](_0x43032f)[_0x5d5d('0x14')](function(_0x95dcb9){_0xd4c0af[_0x5d5d('0x10')]=_0x95dcb9;if(_0x5e7f2b[_0x5d5d('0x21')][_0x5d5d('0x32')]){_0x3ee9a4[_0x5d5d('0x33')]=[{'all':!![]}];}return db[_0x5d5d('0x1b')]['findAll'](_0x3ee9a4);})[_0x5d5d('0x14')](function(_0x3c16a3){_0xd4c0af[_0x5d5d('0x34')]=_[_0x5d5d('0x20')](_0x3c16a3,function(_0x13715f){if(_0x13715f[_0x5d5d('0x35')]===_0x5d5d('0x36')){var _0x12ba69=encryptor['decryptString'](_0x13715f[_0x5d5d('0x37')]);_0x13715f[_0x5d5d('0x37')]=maskClientSecret(_0x12ba69);}return _0x13715f;});return _0xd4c0af;})[_0x5d5d('0x14')](respondWithFilteredResult(_0x16bafa,_0x3ee9a4))[_0x5d5d('0x38')](handleError(_0x16bafa,null));};exports[_0x5d5d('0x39')]=function(_0x154e47,_0x49a74d){var _0xd2287={'raw':!![],'where':{'id':_0x154e47[_0x5d5d('0x3a')]['id']}},_0x234a4d={};_0x234a4d[_0x5d5d('0x1f')]=_[_0x5d5d('0x22')](db[_0x5d5d('0x1b')]['rawAttributes']);_0x234a4d[_0x5d5d('0x21')]=_['keys'](_0x154e47[_0x5d5d('0x21')]);_0x234a4d[_0x5d5d('0x2c')]=_[_0x5d5d('0x23')](_0x234a4d['model'],_0x234a4d[_0x5d5d('0x21')]);_0xd2287['attributes']=_[_0x5d5d('0x23')](_0x234a4d[_0x5d5d('0x1f')],qs[_0x5d5d('0x25')](_0x154e47[_0x5d5d('0x21')][_0x5d5d('0x25')]));_0xd2287[_0x5d5d('0x24')]=_0xd2287['attributes'][_0x5d5d('0x26')]?_0xd2287['attributes']:_0x234a4d[_0x5d5d('0x1f')];if(_0x154e47[_0x5d5d('0x21')]['includeAll']){_0xd2287[_0x5d5d('0x33')]=[{'all':!![]}];}_0xd2287=_[_0x5d5d('0x2e')]({},_0xd2287,_0x154e47[_0x5d5d('0x3b')]);return db['CloudProvider'][_0x5d5d('0x3c')](_0xd2287)[_0x5d5d('0x14')](handleEntityNotFound(_0x49a74d,null))['then'](function(_0x39ebaa){if(_0x39ebaa[_0x5d5d('0x35')]===_0x5d5d('0x36')){var _0x33ba8d=encryptor[_0x5d5d('0x3d')](_0x39ebaa[_0x5d5d('0x37')]);_0x39ebaa[_0x5d5d('0x37')]=maskClientSecret(_0x33ba8d);}return _0x39ebaa;})[_0x5d5d('0x14')](respondWithResult(_0x49a74d,null))[_0x5d5d('0x38')](handleError(_0x49a74d,null));};exports['create']=function(_0x4ed3a9,_0xe02091){if(!_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x18')])throw new Error(_0x5d5d('0x3f'));if(!_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x35')])throw new Error(_0x5d5d('0x40'));var _0x4fe756=db[_0x5d5d('0x1b')][_0x5d5d('0x1c')][_0x5d5d('0x35')][_0x5d5d('0x41')];if(!_0x4fe756[_0x5d5d('0x42')](_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x35')]))throw new Error(_0x5d5d('0x43')+_0x4fe756[_0x5d5d('0x44')](',\x20'));if(_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x35')]===_0x5d5d('0x36')&&_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x37')]){_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x37')]=encryptor[_0x5d5d('0x45')](_0x4ed3a9[_0x5d5d('0x3e')][_0x5d5d('0x37')]);}return db[_0x5d5d('0x1b')]['create'](_0x4ed3a9[_0x5d5d('0x3e')],{})['then'](respondWithResult(_0xe02091,0xc9))[_0x5d5d('0x38')](handleError(_0xe02091,null));};exports['update']=function(_0x35c489,_0x4c75ff){if(_0x35c489[_0x5d5d('0x3e')]['id']){delete _0x35c489['body']['id'];}return db[_0x5d5d('0x1b')]['find']({'where':{'id':_0x35c489[_0x5d5d('0x3a')]['id']}})[_0x5d5d('0x14')](handleEntityNotFound(_0x4c75ff,null))[_0x5d5d('0x14')](function(_0x37d53d){if(_0x37d53d[_0x5d5d('0x35')]===_0x5d5d('0x36')&&_0x35c489[_0x5d5d('0x3e')][_0x5d5d('0x37')]){_0x35c489[_0x5d5d('0x3e')][_0x5d5d('0x37')]=encryptor[_0x5d5d('0x45')](_0x35c489[_0x5d5d('0x3e')][_0x5d5d('0x37')]);}return _0x37d53d;})[_0x5d5d('0x14')](saveUpdates(_0x35c489[_0x5d5d('0x3e')],null))[_0x5d5d('0x14')](respondWithResult(_0x4c75ff,null))[_0x5d5d('0x38')](handleError(_0x4c75ff,null));};exports[_0x5d5d('0x15')]=function(_0x49ed9b,_0x5b42f2){return db['CloudProvider']['find']({'where':{'id':_0x49ed9b['params']['id']}})[_0x5d5d('0x14')](handleEntityNotFound(_0x5b42f2,null))[_0x5d5d('0x14')](removeEntity(_0x5b42f2,null))[_0x5d5d('0x38')](handleError(_0x5b42f2,null));};exports[_0x5d5d('0x46')]=function(_0x3d22f0,_0x4c82d4){return db[_0x5d5d('0x1b')][_0x5d5d('0x47')]({'where':{'id':_0x3d22f0[_0x5d5d('0x3a')]['id']},'raw':!![]})[_0x5d5d('0x14')](function(_0x366ae4){if(!_0x366ae4)return _0x4c82d4[_0x5d5d('0x9')](0x194);return{'url':oauth[_0x5d5d('0x48')](_0x366ae4,_0x3d22f0[_0x5d5d('0x49')]['id'])};})[_0x5d5d('0x14')](respondWithResult(_0x4c82d4,null))['catch'](handleError(_0x4c82d4,null));};exports[_0x5d5d('0x4a')]=function(_0x35a96e,_0x49b5c6){var _0x3845d4=_0x35a96e[_0x5d5d('0x3e')];var _0xf024ca;var _0x10cdda;if(_0x3845d4[_0x5d5d('0x16')])throw _0x3845d4;redis[_0x5d5d('0x4b')](_0x3845d4[_0x5d5d('0x4c')])[_0x5d5d('0x14')](function(_0x36f1d8){if(!_0x36f1d8)throw new Error(_0x5d5d('0x4d'));_0xf024ca=JSON[_0x5d5d('0x4e')](_0x36f1d8);var _0x96efc9=Buffer[_0x5d5d('0x4f')](_0x3845d4[_0x5d5d('0x4c')],_0x5d5d('0x50'))['toString'](_0x5d5d('0x51'));_0x10cdda=JSON[_0x5d5d('0x4e')](_0x96efc9);if(!oauth[_0x5d5d('0x52')](_0x3845d4['id_token'],_0xf024ca[_0x5d5d('0x53')]))throw new Error(_0x5d5d('0x54'));redis[_0x5d5d('0x55')](_0x3845d4[_0x5d5d('0x4c')]);return oauth[_0x5d5d('0x56')](_0x3845d4['code'],_0xf024ca);})[_0x5d5d('0x14')](function(_0x238673){_0xf024ca[_0x5d5d('0x57')]=_0x238673[_0x5d5d('0x58')];_0xf024ca[_0x5d5d('0x59')]=_0x238673['refresh_token'];return db[_0x5d5d('0x1b')][_0x5d5d('0x13')]({'data5':_0xf024ca['data5'],'data6':_0xf024ca[_0x5d5d('0x59')]},{'where':{'id':_0xf024ca['id']}});})['then'](function(){oauth[_0x5d5d('0x5a')](_0xf024ca);socket[_0x5d5d('0x5b')](_0x5d5d('0x5c'),{'id':_0x10cdda['id']});return;})[_0x5d5d('0x14')](respondWithStatusCode(_0x49b5c6,null))[_0x5d5d('0x38')](function(_0x12b009){if(_0x10cdda){socket[_0x5d5d('0x5b')](_0x5d5d('0x5d'),{'id':_0x10cdda['id']});}if(!_0xf024ca){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x12b009);return _0x49b5c6['status'](0x1f4)[_0x5d5d('0x19')](_0x12b009[_0x5d5d('0x5e')]);}logger['error'](_0x5d5d('0x5f'),_0xf024ca['id'],JSON['stringify'](_0x12b009));});}; \ No newline at end of file +var _0xf234=['limit','count','offset','set','Content-Range','json','update','destroy','then','end','error','stack','send','padEnd','slice','index','map','rawAttributes','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','find','create','Name\x20parameter\x20not\x20specified','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined'];(function(_0xd62ce5,_0x5e82b9){var _0x4a56d5=function(_0x51d1fb){while(--_0x51d1fb){_0xd62ce5['push'](_0xd62ce5['shift']());}};_0x4a56d5(++_0x5e82b9);}(_0xf234,0xb8));var _0x4f23=function(_0x5216d1,_0x3f9ae9){_0x5216d1=_0x5216d1-0x0;var _0x13865a=_0xf234[_0x5216d1];return _0x13865a;};'use strict';var _=require(_0x4f23('0x0'));var Redis=require(_0x4f23('0x1'));var qs=require(_0x4f23('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x4f23('0x3'));var logger=require(_0x4f23('0x4'))('api');var db=require(_0x4f23('0x5'))['db'];var oauth=require(_0x4f23('0x6'));config[_0x4f23('0x7')]=_[_0x4f23('0x8')](config[_0x4f23('0x7')],{'host':_0x4f23('0x9'),'port':0x18eb});var socket=require(_0x4f23('0xa'))(new Redis(config[_0x4f23('0x7')]));var redis=new Redis(config[_0x4f23('0x7')]);function respondWithStatusCode(_0x2a0933,_0x48a7ca){_0x48a7ca=_0x48a7ca||0xcc;return function(_0x13a546){if(_0x13a546){return _0x2a0933[_0x4f23('0xb')](_0x48a7ca);}return _0x2a0933[_0x4f23('0xc')](_0x48a7ca)['end']();};}function respondWithResult(_0x182fa5,_0x4303c8){_0x4303c8=_0x4303c8||0xc8;return function(_0x1761ba){if(_0x1761ba){return _0x182fa5[_0x4f23('0xc')](_0x4303c8)['json'](_0x1761ba);}};}function respondWithFilteredResult(_0x2dbb3e,_0x193c19){return function(_0x5794a9){if(_0x5794a9){var _0x271133=typeof _0x193c19['offset']===_0x4f23('0xd')&&typeof _0x193c19[_0x4f23('0xe')]===_0x4f23('0xd');var _0x36468b=_0x5794a9[_0x4f23('0xf')];var _0x494d78=_0x271133?0x0:_0x193c19[_0x4f23('0x10')];var _0x42dbb7=_0x271133?_0x5794a9[_0x4f23('0xf')]:_0x193c19[_0x4f23('0x10')]+_0x193c19[_0x4f23('0xe')];var _0x51db44;if(_0x42dbb7>=_0x36468b){_0x42dbb7=_0x36468b;_0x51db44=0xc8;}else{_0x51db44=0xce;}_0x2dbb3e[_0x4f23('0xc')](_0x51db44);return _0x2dbb3e[_0x4f23('0x11')](_0x4f23('0x12'),_0x494d78+'-'+_0x42dbb7+'/'+_0x36468b)[_0x4f23('0x13')](_0x5794a9);}return null;};}function saveUpdates(_0x2e20e1){return function(_0x39b83e){if(_0x39b83e){return _0x39b83e[_0x4f23('0x14')](_0x2e20e1)['then'](function(_0x2e38c7){return _0x2e38c7;});}return null;};}function removeEntity(_0x5d6926){return function(_0x304eba){if(_0x304eba){return _0x304eba[_0x4f23('0x15')]()[_0x4f23('0x16')](function(){_0x5d6926[_0x4f23('0xc')](0xcc)[_0x4f23('0x17')]();});}};}function handleEntityNotFound(_0x59a29a){return function(_0x30326d){if(!_0x30326d){_0x59a29a[_0x4f23('0xb')](0x194);}return _0x30326d;};}function handleError(_0x4285b1,_0x139f6f){_0x139f6f=_0x139f6f||0x1f4;return function(_0x24b4f3){logger[_0x4f23('0x18')](_0x24b4f3[_0x4f23('0x19')]);if(_0x24b4f3['name']){delete _0x24b4f3['name'];}_0x4285b1[_0x4f23('0xc')](_0x139f6f)[_0x4f23('0x1a')](_0x24b4f3);};}function maskClientSecret(_0x20ea65){return _[_0x4f23('0x1b')](_0x20ea65[_0x4f23('0x1c')](0x0,0x3),0x14,'*');}exports[_0x4f23('0x1d')]=function(_0x113411,_0x3137ae){var _0xc6e6ad={},_0x51dc10={},_0x2eeb39={'count':0x0,'rows':[]};var _0x537def=_[_0x4f23('0x1e')](db['CloudProvider'][_0x4f23('0x1f')],function(_0x309b18){return{'name':_0x309b18['fieldName'],'type':_0x309b18[_0x4f23('0x20')]['key']};});_0x51dc10[_0x4f23('0x21')]=_[_0x4f23('0x1e')](_0x537def,_0x4f23('0x22'));_0x51dc10[_0x4f23('0x23')]=_['keys'](_0x113411['query']);_0x51dc10[_0x4f23('0x24')]=_[_0x4f23('0x25')](_0x51dc10[_0x4f23('0x21')],_0x51dc10[_0x4f23('0x23')]);_0xc6e6ad[_0x4f23('0x26')]=_['intersection'](_0x51dc10['model'],qs[_0x4f23('0x27')](_0x113411[_0x4f23('0x23')][_0x4f23('0x27')]));_0xc6e6ad[_0x4f23('0x26')]=_0xc6e6ad['attributes'][_0x4f23('0x28')]?_0xc6e6ad['attributes']:_0x51dc10[_0x4f23('0x21')];if(!_0x113411[_0x4f23('0x23')][_0x4f23('0x29')](_0x4f23('0x2a'))){_0xc6e6ad[_0x4f23('0xe')]=qs['limit'](_0x113411[_0x4f23('0x23')][_0x4f23('0xe')]);_0xc6e6ad['offset']=qs['offset'](_0x113411[_0x4f23('0x23')][_0x4f23('0x10')]);}_0xc6e6ad[_0x4f23('0x2b')]=qs['sort'](_0x113411[_0x4f23('0x23')][_0x4f23('0x2c')]);_0xc6e6ad[_0x4f23('0x2d')]=qs['filters'](_[_0x4f23('0x2e')](_0x113411['query'],_0x51dc10[_0x4f23('0x24')]),_0x537def);if(_0x113411[_0x4f23('0x23')][_0x4f23('0x2f')]){_0xc6e6ad[_0x4f23('0x2d')]=_[_0x4f23('0x30')](_0xc6e6ad[_0x4f23('0x2d')],{'$or':_[_0x4f23('0x1e')](_0x537def,function(_0x139e43){if(_0x139e43['type']!==_0x4f23('0x31')){var _0x1411fe={};_0x1411fe[_0x139e43[_0x4f23('0x22')]]={'$like':'%'+_0x113411[_0x4f23('0x23')][_0x4f23('0x2f')]+'%'};return _0x1411fe;}})});}_0xc6e6ad=_[_0x4f23('0x30')]({},_0xc6e6ad,_0x113411[_0x4f23('0x32')]);var _0xb09787={'where':_0xc6e6ad[_0x4f23('0x2d')]};return db[_0x4f23('0x33')][_0x4f23('0xf')](_0xb09787)[_0x4f23('0x16')](function(_0xb53907){_0x2eeb39[_0x4f23('0xf')]=_0xb53907;if(_0x113411[_0x4f23('0x23')][_0x4f23('0x34')]){_0xc6e6ad[_0x4f23('0x35')]=[{'all':!![]}];}return db[_0x4f23('0x33')][_0x4f23('0x36')](_0xc6e6ad);})[_0x4f23('0x16')](function(_0x315573){_0x2eeb39[_0x4f23('0x37')]=_['map'](_0x315573,function(_0xb86d26){if(_0xb86d26[_0x4f23('0x38')]===_0x4f23('0x39')){var _0x3bb1c7=encryptor[_0x4f23('0x3a')](_0xb86d26[_0x4f23('0x3b')]);_0xb86d26[_0x4f23('0x3b')]=maskClientSecret(_0x3bb1c7);}return _0xb86d26;});return _0x2eeb39;})[_0x4f23('0x16')](respondWithFilteredResult(_0x3137ae,_0xc6e6ad))[_0x4f23('0x3c')](handleError(_0x3137ae,null));};exports[_0x4f23('0x3d')]=function(_0x682148,_0x31b612){var _0x187282={'raw':!![],'where':{'id':_0x682148[_0x4f23('0x3e')]['id']}},_0x900097={};_0x900097[_0x4f23('0x21')]=_['keys'](db[_0x4f23('0x33')]['rawAttributes']);_0x900097[_0x4f23('0x23')]=_[_0x4f23('0x3f')](_0x682148[_0x4f23('0x23')]);_0x900097[_0x4f23('0x24')]=_['intersection'](_0x900097['model'],_0x900097[_0x4f23('0x23')]);_0x187282['attributes']=_[_0x4f23('0x25')](_0x900097['model'],qs['fields'](_0x682148['query'][_0x4f23('0x27')]));_0x187282[_0x4f23('0x26')]=_0x187282[_0x4f23('0x26')][_0x4f23('0x28')]?_0x187282['attributes']:_0x900097[_0x4f23('0x21')];if(_0x682148[_0x4f23('0x23')]['includeAll']){_0x187282[_0x4f23('0x35')]=[{'all':!![]}];}_0x187282=_[_0x4f23('0x30')]({},_0x187282,_0x682148[_0x4f23('0x32')]);return db['CloudProvider'][_0x4f23('0x40')](_0x187282)[_0x4f23('0x16')](handleEntityNotFound(_0x31b612,null))[_0x4f23('0x16')](function(_0x586840){if(_0x586840['service']===_0x4f23('0x39')){var _0x337db3=encryptor[_0x4f23('0x3a')](_0x586840[_0x4f23('0x3b')]);_0x586840[_0x4f23('0x3b')]=maskClientSecret(_0x337db3);}return _0x586840;})[_0x4f23('0x16')](respondWithResult(_0x31b612,null))[_0x4f23('0x3c')](handleError(_0x31b612,null));};exports[_0x4f23('0x41')]=function(_0x2cb88e,_0x2e7f4f){if(!_0x2cb88e['body']['name'])throw new Error(_0x4f23('0x42'));if(!_0x2cb88e['body'][_0x4f23('0x38')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x14e9eb=db[_0x4f23('0x33')][_0x4f23('0x1f')][_0x4f23('0x38')][_0x4f23('0x43')];if(!_0x14e9eb[_0x4f23('0x44')](_0x2cb88e[_0x4f23('0x45')]['service']))throw new Error(_0x4f23('0x46')+_0x14e9eb[_0x4f23('0x47')](',\x20'));if(_0x2cb88e['body'][_0x4f23('0x38')]===_0x4f23('0x39')&&_0x2cb88e[_0x4f23('0x45')][_0x4f23('0x3b')]){_0x2cb88e[_0x4f23('0x45')][_0x4f23('0x3b')]=encryptor[_0x4f23('0x48')](_0x2cb88e[_0x4f23('0x45')][_0x4f23('0x3b')]);}return db[_0x4f23('0x33')][_0x4f23('0x41')](_0x2cb88e[_0x4f23('0x45')],{})[_0x4f23('0x16')](respondWithResult(_0x2e7f4f,0xc9))[_0x4f23('0x3c')](handleError(_0x2e7f4f,null));};exports['update']=function(_0x5e6e38,_0x559e1b){if(_0x5e6e38[_0x4f23('0x45')]['id']){delete _0x5e6e38['body']['id'];}return db[_0x4f23('0x33')][_0x4f23('0x40')]({'where':{'id':_0x5e6e38[_0x4f23('0x3e')]['id']}})['then'](handleEntityNotFound(_0x559e1b,null))['then'](function(_0xac1076){if(_0xac1076[_0x4f23('0x38')]===_0x4f23('0x39')&&_0x5e6e38[_0x4f23('0x45')][_0x4f23('0x3b')]){_0x5e6e38[_0x4f23('0x45')][_0x4f23('0x3b')]=encryptor[_0x4f23('0x48')](_0x5e6e38[_0x4f23('0x45')][_0x4f23('0x3b')]);}return _0xac1076;})[_0x4f23('0x16')](saveUpdates(_0x5e6e38['body'],null))['then'](respondWithResult(_0x559e1b,null))[_0x4f23('0x3c')](handleError(_0x559e1b,null));};exports['destroy']=function(_0x1d96a7,_0x4da109){return db['CloudProvider'][_0x4f23('0x40')]({'where':{'id':_0x1d96a7[_0x4f23('0x3e')]['id']}})[_0x4f23('0x16')](handleEntityNotFound(_0x4da109,null))[_0x4f23('0x16')](removeEntity(_0x4da109,null))['catch'](handleError(_0x4da109,null));};exports[_0x4f23('0x49')]=function(_0x34767c,_0x56456d){return db[_0x4f23('0x33')]['findOne']({'where':{'id':_0x34767c['params']['id']},'raw':!![]})[_0x4f23('0x16')](function(_0x8d44d1){if(!_0x8d44d1)return _0x56456d['sendStatus'](0x194);return{'url':oauth[_0x4f23('0x4a')](_0x8d44d1,_0x34767c[_0x4f23('0x4b')]['id'])};})[_0x4f23('0x16')](respondWithResult(_0x56456d,null))[_0x4f23('0x3c')](handleError(_0x56456d,null));};exports[_0x4f23('0x4c')]=function(_0x7d1b28,_0x58023d){var _0x154c69=_0x7d1b28[_0x4f23('0x45')];var _0x428bb6;var _0x52c843;if(_0x154c69[_0x4f23('0x18')])throw _0x154c69;redis[_0x4f23('0x4d')](_0x154c69[_0x4f23('0x4e')])[_0x4f23('0x16')](function(_0x5bac14){if(!_0x5bac14)throw new Error(_0x4f23('0x4f'));_0x428bb6=JSON[_0x4f23('0x50')](_0x5bac14);var _0x2fa6c0=Buffer[_0x4f23('0x51')](_0x154c69['state'],'base64')[_0x4f23('0x52')](_0x4f23('0x53'));_0x52c843=JSON[_0x4f23('0x50')](_0x2fa6c0);if(!oauth[_0x4f23('0x54')](_0x154c69[_0x4f23('0x55')],_0x428bb6['oauth2Claims']))throw new Error(_0x4f23('0x56'));redis[_0x4f23('0x57')](_0x154c69['state']);return oauth[_0x4f23('0x58')](_0x154c69[_0x4f23('0x59')],_0x428bb6);})[_0x4f23('0x16')](function(_0x2d849c){_0x428bb6[_0x4f23('0x5a')]=_0x2d849c['access_token'];_0x428bb6[_0x4f23('0x5b')]=_0x2d849c[_0x4f23('0x5c')];return db['CloudProvider']['update']({'data5':_0x428bb6[_0x4f23('0x5a')],'data6':_0x428bb6[_0x4f23('0x5b')]},{'where':{'id':_0x428bb6['id']}});})[_0x4f23('0x16')](function(){oauth[_0x4f23('0x5d')](_0x428bb6);socket['emit'](_0x4f23('0x5e'),{'id':_0x52c843['id']});return;})['then'](respondWithStatusCode(_0x58023d,null))[_0x4f23('0x3c')](function(_0x1911b1){if(_0x52c843){socket[_0x4f23('0x5f')](_0x4f23('0x60'),{'id':_0x52c843['id']});}if(!_0x428bb6){logger[_0x4f23('0x18')]('Invalid\x20authentication\x20state\x20parameter',_0x1911b1);return _0x58023d['status'](0x1f4)[_0x4f23('0x1a')](_0x1911b1[_0x4f23('0x61')]);}logger['error'](_0x4f23('0x62'),_0x428bb6['id'],JSON['stringify'](_0x1911b1));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d927fef..e9cd8e9 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 _0x0445=['request-promise','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1aeda1,_0x1a9d5a){var _0x17329e=function(_0x3d03fd){while(--_0x3d03fd){_0x1aeda1['push'](_0x1aeda1['shift']());}};_0x17329e(++_0x1a9d5a);}(_0x0445,0x97));var _0x5044=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0x0445[_0x590381];return _0xe300df;};'use strict';var _=require(_0x5044('0x0'));var util=require('util');var logger=require(_0x5044('0x1'))(_0x5044('0x2'));var moment=require(_0x5044('0x3'));var BPromise=require(_0x5044('0x4'));var rp=require(_0x5044('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5044('0x6'));var attributes=require(_0x5044('0x7'));module[_0x5044('0x8')]=function(_0x534b4d,_0x4c3adf){return _0x534b4d[_0x5044('0x9')](_0x5044('0xa'),attributes,{'tableName':_0x5044('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d0c=['request-promise','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d0c,0xca));var _0xc1d0=function(_0xa3e9ae,_0x38687f){_0xa3e9ae=_0xa3e9ae-0x0;var _0x1b094f=_0x1d0c[_0xa3e9ae];return _0x1b094f;};'use strict';var _=require(_0xc1d0('0x0'));var util=require(_0xc1d0('0x1'));var logger=require(_0xc1d0('0x2'))(_0xc1d0('0x3'));var moment=require(_0xc1d0('0x4'));var BPromise=require(_0xc1d0('0x5'));var rp=require(_0xc1d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d0('0x7'));var config=require(_0xc1d0('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xc1d0('0x9')]=function(_0x2be5ae,_0xd98c73){return _0x2be5ae[_0xc1d0('0xa')](_0xc1d0('0xb'),attributes,{'tableName':_0xc1d0('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 0ef503c..79cfd16 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 _0x7d16=['data5','access_token','catch','error','authorization_code','{TENANT_ID}','intervals','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','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','push','data7','/.default','join','Outlook365','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','form_post','prompt','login','map','key','value','oauth2Claims','replace','oauth2/','decode','iss','aud','audience','nonce','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x7d16,0xf0));var _0x67d1=function(_0x76ea0,_0x482970){_0x76ea0=_0x76ea0-0x0;var _0x40fcdf=_0x7d16[_0x76ea0];return _0x40fcdf;};'use strict';var _=require(_0x67d1('0x0'));var crypto=require('crypto');var jwt=require(_0x67d1('0x1'));var moment=require(_0x67d1('0x2'));var Redis=require(_0x67d1('0x3'));var rp=require(_0x67d1('0x4'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x67d1('0x5'));var schedule=require(_0x67d1('0x6'));var db=require(_0x67d1('0x7'))['db'];config[_0x67d1('0x8')]=_['defaults'](config[_0x67d1('0x8')],{'host':_0x67d1('0x9'),'port':0x18eb});var redis=new Redis(config[_0x67d1('0x8')]);var MICROSOFT_AUTH_URL=_0x67d1('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x67d1('0xb'),_0x67d1('0xc'),'email',_0x67d1('0xd'),_0x67d1('0xe'),_0x67d1('0xf'),_0x67d1('0x10')],'Dynamics365':[_0x67d1('0xb'),_0x67d1('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x67d1('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4962d7){var _0x58bcc0=_['map'](AZURE_AUTH_SCOPES[_0x4962d7['type']]);if(_0x4962d7[_0x67d1('0x12')]===_0x67d1('0x13'))_0x58bcc0[_0x67d1('0x14')](_0x4962d7[_0x67d1('0x15')]+_0x67d1('0x16'));return _0x58bcc0[_0x67d1('0x17')]('\x20');}function getAccessTokenScope(_0x253a0c){if(_0x253a0c['type']===_0x67d1('0x18'))return _0x67d1('0xe');if(_0x253a0c[_0x67d1('0x12')]===_0x67d1('0x13'))return _0x253a0c[_0x67d1('0x15')]+_0x67d1('0x16');}function generateMicrosoftAuthorizationUrl(_0x39bb10,_0x258901){var _0x3c3db9=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x39bb10[_0x67d1('0x19')]);var _0x51fee9=[_0x67d1('0x1a'),_0x67d1('0x1b')];var _0x48e584=Buffer[_0x67d1('0x1c')](JSON[_0x67d1('0x1d')]({'id':_0x258901}))[_0x67d1('0x1e')](_0x67d1('0x1f'));var _0xc6b0d0=crypto[_0x67d1('0x20')](0x10)[_0x67d1('0x1e')](_0x67d1('0x21'));var _0x1a60e2=getAuthorizationScopes(_0x39bb10);var _0x115e03=[{'key':_0x67d1('0x22'),'value':_0x39bb10[_0x67d1('0x23')]},{'key':_0x67d1('0x24'),'value':encodeURIComponent(_0x51fee9['join']('\x20'))},{'key':_0x67d1('0x25'),'value':_0x39bb10[_0x67d1('0x26')]},{'key':'response_mode','value':_0x67d1('0x27')},{'key':'scope','value':encodeURIComponent(_0x1a60e2)},{'key':'state','value':_0x48e584},{'key':'nonce','value':_0xc6b0d0},{'key':_0x67d1('0x28'),'value':_0x67d1('0x29')}];var _0x29c9a9=_0x3c3db9+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x67d1('0x2a')](_0x115e03,function(_0x370333){return _0x370333[_0x67d1('0x2b')]+'='+_0x370333[_0x67d1('0x2c')];})[_0x67d1('0x17')]('&');_0x39bb10[_0x67d1('0x2d')]={'issuer':_0x3c3db9[_0x67d1('0x2e')](_0x67d1('0x2f'),''),'audience':_0x39bb10['data1'],'state':_0x48e584,'nonce':_0xc6b0d0};redis['set'](_0x48e584,JSON[_0x67d1('0x1d')](_0x39bb10));return _0x29c9a9;}function isValidIdToken(_0x52118f,_0x3fa961){try{var _0x77f815=jwt[_0x67d1('0x30')](_0x52118f,{'complete':!![]});var _0x51d87c=_0x77f815['payload'];if(_0x51d87c[_0x67d1('0x31')]!==_0x3fa961['issuer'])return![];if(_0x51d87c[_0x67d1('0x32')]!==_0x3fa961[_0x67d1('0x33')])return![];if(_0x51d87c[_0x67d1('0x34')]!==_0x3fa961[_0x67d1('0x34')])return![];if(moment()[_0x67d1('0x35')](moment[_0x67d1('0x36')](_0x51d87c[_0x67d1('0x37')])))return![];return!![];}catch(_0x52e688){throw _0x52e688;}}function refreshOauth2MicrosoftAccessToken(_0x4ce307){return Promise[_0x67d1('0x38')]()[_0x67d1('0x39')](function(){if(_0x4ce307[_0x67d1('0x3a')])return _0x4ce307;return db[_0x67d1('0x3b')][_0x67d1('0x3c')]({'where':{'id':_0x4ce307['id']},'raw':!![]});})[_0x67d1('0x39')](function(_0x34d147){var _0x36a29b={'grant_type':_0x67d1('0x3d'),'refresh_token':_0x34d147[_0x67d1('0x3e')],'scope':getAccessTokenScope(_0x34d147),'redirect_uri':_0x34d147['data4'],'client_id':_0x34d147['data1'],'client_secret':encryptor[_0x67d1('0x3f')](_0x34d147[_0x67d1('0x3a')])};var _0x2c0507={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x67d1('0x2e')]('{TENANT_ID}',_0x34d147[_0x67d1('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x36a29b,'json':!![]};return rp(_0x2c0507);})[_0x67d1('0x39')](function(_0x5f4465){_0x4ce307[_0x67d1('0x40')]=_0x5f4465[_0x67d1('0x41')];_0x4ce307['data6']=_0x5f4465[_0x67d1('0x3d')];return db[_0x67d1('0x3b')]['update']({'data5':_0x4ce307[_0x67d1('0x40')],'data6':_0x4ce307[_0x67d1('0x3e')]},{'where':{'id':_0x4ce307['id']}});})[_0x67d1('0x39')](function(){return _0x4ce307;})[_0x67d1('0x42')](function(_0x231170){logger[_0x67d1('0x43')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x4ce307['id'],_0x231170);});}function getOauth2MicrosoftAccessToken(_0x2b03fb,_0x40e543){var _0x307638={'grant_type':_0x67d1('0x44'),'code':_0x2b03fb,'scope':getAccessTokenScope(_0x40e543),'redirect_uri':_0x40e543[_0x67d1('0x26')],'client_id':_0x40e543[_0x67d1('0x23')],'client_secret':encryptor[_0x67d1('0x3f')](_0x40e543[_0x67d1('0x3a')])};var _0x209511={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x67d1('0x45'),_0x40e543[_0x67d1('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x307638,'json':!![]};return rp(_0x209511);}function startRefreshInterval(_0x54a7ef){var _0x3c49b3=schedule[_0x67d1('0x46')];if(_0x3c49b3[_0x54a7ef['id']])clearInterval(_0x3c49b3[_0x54a7ef['id']]);_0x3c49b3[_0x54a7ef['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x67d1('0x47')](this,{'id':_0x54a7ef['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3c49b3;}function startAllRefreshIntervals(){return db[_0x67d1('0x3b')][_0x67d1('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x67d1('0x39')](function(_0x102271){var _0x5d9456=_0x102271['map'](function(_0x209677){return refreshOauth2MicrosoftAccessToken(_0x209677)[_0x67d1('0x39')](function(_0x33ceb9){startRefreshInterval(_0x33ceb9);});});return Promise['all'](_0x5d9456);})['catch'](function(_0x1d21fc){var _0x684b4c=_0x1d21fc?util[_0x67d1('0x49')](_0x1d21fc,{'showHidden':![],'depth':null}):'';logger[_0x67d1('0x43')](_0x67d1('0x4a'),_0x684b4c);});}module[_0x67d1('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8999=['refresh_token','data6','decryptString','POST','access_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','{TENANT_ID}','intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','api','../../mysqldb','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','Dynamics365','push','data7','/.default','Outlook365','replace','data2','code','id_token','from','stringify','toString','base64','hex','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','aud','unix','resolve','then','data3','findOne'];(function(_0x126a92,_0x34a4d5){var _0x1e2fde=function(_0x1b3e6d){while(--_0x1b3e6d){_0x126a92['push'](_0x126a92['shift']());}};_0x1e2fde(++_0x34a4d5);}(_0x8999,0xef));var _0x9899=function(_0x152aad,_0x45310e){_0x152aad=_0x152aad-0x0;var _0x10e985=_0x8999[_0x152aad];return _0x10e985;};'use strict';var _=require(_0x9899('0x0'));var crypto=require('crypto');var jwt=require(_0x9899('0x1'));var moment=require(_0x9899('0x2'));var Redis=require(_0x9899('0x3'));var rp=require('request-promise');var util=require(_0x9899('0x4'));var encryptor=require(_0x9899('0x5'));var config=require(_0x9899('0x6'));var logger=require('../../config/logger')(_0x9899('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x9899('0x8'))['db'];config['redis']=_[_0x9899('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x9899('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9899('0xb'),_0x9899('0xc'),'email',_0x9899('0xd'),_0x9899('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x9899('0xf')],'Dynamics365':[_0x9899('0xb'),_0x9899('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1d795a){var _0x299b8a=_[_0x9899('0x10')](AZURE_AUTH_SCOPES[_0x1d795a['type']]);if(_0x1d795a[_0x9899('0x11')]===_0x9899('0x12'))_0x299b8a[_0x9899('0x13')](_0x1d795a[_0x9899('0x14')]+_0x9899('0x15'));return _0x299b8a['join']('\x20');}function getAccessTokenScope(_0x7462e){if(_0x7462e[_0x9899('0x11')]===_0x9899('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x7462e[_0x9899('0x11')]===_0x9899('0x12'))return _0x7462e['data7']+_0x9899('0x15');}function generateMicrosoftAuthorizationUrl(_0x278dda,_0x19bd9e){var _0x35abac=MICROSOFT_AUTH_URL[_0x9899('0x17')]('{TENANT_ID}',_0x278dda[_0x9899('0x18')]);var _0xeda3d5=[_0x9899('0x19'),_0x9899('0x1a')];var _0x4be2dc=Buffer[_0x9899('0x1b')](JSON[_0x9899('0x1c')]({'id':_0x19bd9e}))[_0x9899('0x1d')](_0x9899('0x1e'));var _0x11442d=crypto['randomBytes'](0x10)[_0x9899('0x1d')](_0x9899('0x1f'));var _0x3a193f=getAuthorizationScopes(_0x278dda);var _0x4606e9=[{'key':'client_id','value':_0x278dda[_0x9899('0x20')]},{'key':_0x9899('0x21'),'value':encodeURIComponent(_0xeda3d5[_0x9899('0x22')]('\x20'))},{'key':_0x9899('0x23'),'value':_0x278dda[_0x9899('0x24')]},{'key':_0x9899('0x25'),'value':_0x9899('0x26')},{'key':_0x9899('0x27'),'value':encodeURIComponent(_0x3a193f)},{'key':'state','value':_0x4be2dc},{'key':_0x9899('0x28'),'value':_0x11442d},{'key':_0x9899('0x29'),'value':_0x9899('0x2a')}];var _0x3ffbc6=_0x35abac+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9899('0x10')](_0x4606e9,function(_0x15d6df){return _0x15d6df[_0x9899('0x2b')]+'='+_0x15d6df[_0x9899('0x2c')];})[_0x9899('0x22')]('&');_0x278dda[_0x9899('0x2d')]={'issuer':_0x35abac[_0x9899('0x17')](_0x9899('0x2e'),''),'audience':_0x278dda[_0x9899('0x20')],'state':_0x4be2dc,'nonce':_0x11442d};redis[_0x9899('0x2f')](_0x4be2dc,JSON['stringify'](_0x278dda));return _0x3ffbc6;}function isValidIdToken(_0x58fea5,_0x14df29){try{var _0x52cb5e=jwt[_0x9899('0x30')](_0x58fea5,{'complete':!![]});var _0x33337f=_0x52cb5e[_0x9899('0x31')];if(_0x33337f[_0x9899('0x32')]!==_0x14df29['issuer'])return![];if(_0x33337f[_0x9899('0x33')]!==_0x14df29['audience'])return![];if(_0x33337f[_0x9899('0x28')]!==_0x14df29[_0x9899('0x28')])return![];if(moment()['isAfter'](moment[_0x9899('0x34')](_0x33337f['exp'])))return![];return!![];}catch(_0x603edb){throw _0x603edb;}}function refreshOauth2MicrosoftAccessToken(_0xa497ec){return Promise[_0x9899('0x35')]()[_0x9899('0x36')](function(){if(_0xa497ec[_0x9899('0x37')])return _0xa497ec;return db['CloudProvider'][_0x9899('0x38')]({'where':{'id':_0xa497ec['id']},'raw':!![]});})[_0x9899('0x36')](function(_0x51be2c){var _0x375d9d={'grant_type':_0x9899('0x39'),'refresh_token':_0x51be2c[_0x9899('0x3a')],'scope':getAccessTokenScope(_0x51be2c),'redirect_uri':_0x51be2c[_0x9899('0x24')],'client_id':_0x51be2c[_0x9899('0x20')],'client_secret':encryptor[_0x9899('0x3b')](_0x51be2c[_0x9899('0x37')])};var _0x29a464={'method':_0x9899('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9899('0x17')]('{TENANT_ID}',_0x51be2c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x375d9d,'json':!![]};return rp(_0x29a464);})[_0x9899('0x36')](function(_0x407f00){_0xa497ec['data5']=_0x407f00[_0x9899('0x3d')];_0xa497ec[_0x9899('0x3a')]=_0x407f00['refresh_token'];return db[_0x9899('0x3e')][_0x9899('0x3f')]({'data5':_0xa497ec['data5'],'data6':_0xa497ec['data6']},{'where':{'id':_0xa497ec['id']}});})[_0x9899('0x36')](function(){return _0xa497ec;})[_0x9899('0x40')](function(_0x206776){logger[_0x9899('0x41')](_0x9899('0x42'),_0xa497ec['id'],_0x206776);});}function getOauth2MicrosoftAccessToken(_0x4935de,_0x1d55dd){var _0x12f6d2={'grant_type':_0x9899('0x43'),'code':_0x4935de,'scope':getAccessTokenScope(_0x1d55dd),'redirect_uri':_0x1d55dd['data4'],'client_id':_0x1d55dd['data1'],'client_secret':encryptor['decryptString'](_0x1d55dd[_0x9899('0x37')])};var _0x3f58db={'method':_0x9899('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x9899('0x17')](_0x9899('0x44'),_0x1d55dd[_0x9899('0x18')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12f6d2,'json':!![]};return rp(_0x3f58db);}function startRefreshInterval(_0x1a4f24){var _0x3dbba0=schedule[_0x9899('0x45')];if(_0x3dbba0[_0x1a4f24['id']])clearInterval(_0x3dbba0[_0x1a4f24['id']]);_0x3dbba0[_0x1a4f24['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9899('0x46')](this,{'id':_0x1a4f24['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9899('0x45')]=_0x3dbba0;}function startAllRefreshIntervals(){return db[_0x9899('0x3e')][_0x9899('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9899('0x36')](function(_0x165de1){var _0x5d3aa9=_0x165de1['map'](function(_0x464885){return refreshOauth2MicrosoftAccessToken(_0x464885)[_0x9899('0x36')](function(_0x46c1ec){startRefreshInterval(_0x46c1ec);});});return Promise[_0x9899('0x48')](_0x5d3aa9);})[_0x9899('0x40')](function(_0x34286f){var _0x17c441=_0x34286f?util['inspect'](_0x34286f,{'showHidden':![],'depth':null}):'';logger['error'](_0x9899('0x49'),_0x17c441);});}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 97138dc..7ad76ba 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 _0xc5c0=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x17bb7d,_0x456b4f){var _0x28caa4=function(_0x5babf1){while(--_0x5babf1){_0x17bb7d['push'](_0x17bb7d['shift']());}};_0x28caa4(++_0x456b4f);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x5c4057,_0x471e6a){_0x5c4057=_0x5c4057-0x0;var _0x347005=_0xc5c0[_0x5c4057];return _0x347005;};'use strict';var _=require(_0x0c5c('0x0'));var util=require(_0x0c5c('0x1'));var moment=require(_0x0c5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c5c('0x3'));var db=require(_0x0c5c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c5c('0x5'))(_0x0c5c('0x6'));var config=require(_0x0c5c('0x7'));var jayson=require(_0x0c5c('0x8'));var client=jayson[_0x0c5c('0x9')][_0x0c5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465ff0,_0x58e41c,_0x1709fd){return new BPromise(function(_0x1d1386,_0x52592e){return client[_0x0c5c('0xb')](_0x465ff0,_0x1709fd)[_0x0c5c('0xc')](function(_0x4145aa){logger[_0x0c5c('0xd')]('CloudProvider,\x20%s,\x20%s',_0x58e41c,_0x0c5c('0xe'));logger[_0x0c5c('0xf')](_0x0c5c('0x10'),_0x58e41c,_0x0c5c('0xe'),JSON[_0x0c5c('0x11')](_0x4145aa));if(_0x4145aa['error']){if(_0x4145aa[_0x0c5c('0x12')]['code']===0x1f4){logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);return _0x52592e(_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);}logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);return _0x1d1386(_0x4145aa['error'][_0x0c5c('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x58e41c,_0x0c5c('0xe'));_0x1d1386(_0x4145aa[_0x0c5c('0x15')]['message']);}})[_0x0c5c('0x16')](function(_0x5c0be8){logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x5c0be8);_0x52592e(_0x5c0be8);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x380016,_0x178dd6){var _0x5c7ac0=function(_0xa8ddca){while(--_0xa8ddca){_0x380016['push'](_0x380016['shift']());}};_0x5c7ac0(++_0x178dd6);}(_0xadb5,0xad));var _0x5adb=function(_0x547e31,_0xcfff3b){_0x547e31=_0x547e31-0x0;var _0x59f790=_0xadb5[_0x547e31];return _0x59f790;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index fe13464..6d65a1d 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x43f504,_0x36825f){var _0x1cbda7=function(_0xe7163){while(--_0xe7163){_0x43f504['push'](_0x43f504['shift']());}};_0x1cbda7(++_0x36825f);}(_0x2ef3,0xba));var _0x32ef=function(_0x345810,_0x61cdad){_0x345810=_0x345810-0x0;var _0xc027f8=_0x2ef3[_0x345810];return _0xc027f8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x567b7c,_0x1fcfb5){_0x567b7c=_0x567b7c-0x0;var _0x16362a=_0x5f2f[_0x567b7c];return _0x16362a;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 390721d..75b9fd7 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 _0xb6c5=['STRING','exports','name'];(function(_0x1796b8,_0x2cd38c){var _0xd798fc=function(_0x2a96dd){while(--_0x2a96dd){_0x1796b8['push'](_0x1796b8['shift']());}};_0xd798fc(++_0x2cd38c);}(_0xb6c5,0x1e1));var _0x5b6c=function(_0x9bc95b,_0x1ed403){_0x9bc95b=_0x9bc95b-0x0;var _0x270b58=_0xb6c5[_0x9bc95b];return _0x270b58;};'use strict';var Sequelize=require('sequelize');module[_0x5b6c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b6c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5b6c('0x2')]},'website':{'type':Sequelize[_0x5b6c('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x5b6c('0x2')]},'type':{'type':Sequelize[_0x5b6c('0x2')]},'street':{'type':Sequelize[_0x5b6c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5b6c('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5b6c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5b6c('0x2')]},'sStreet':{'type':Sequelize[_0x5b6c('0x2')]},'sPostalCode':{'type':Sequelize[_0x5b6c('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x5b6c('0x2')]},'description':{'type':Sequelize[_0x5b6c('0x2')]}}; \ No newline at end of file +var _0x7605=['exports','STRING','name','sequelize'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7605,0xc7));var _0x5760=function(_0x559dd8,_0x5877d6){_0x559dd8=_0x559dd8-0x0;var _0x53f450=_0x7605[_0x559dd8];return _0x53f450;};'use strict';var Sequelize=require(_0x5760('0x0'));module[_0x5760('0x1')]={'name':{'type':Sequelize[_0x5760('0x2')],'unique':_0x5760('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5760('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5760('0x2')]},'phone':{'type':Sequelize[_0x5760('0x2')]},'fax':{'type':Sequelize[_0x5760('0x2')]},'type':{'type':Sequelize[_0x5760('0x2')]},'street':{'type':Sequelize[_0x5760('0x2')]},'postalCode':{'type':Sequelize[_0x5760('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x5760('0x2')]},'email':{'type':Sequelize[_0x5760('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5760('0x2')]},'sStreet':{'type':Sequelize[_0x5760('0x2')]},'sPostalCode':{'type':Sequelize[_0x5760('0x2')]},'sCity':{'type':Sequelize[_0x5760('0x2')]},'sCountry':{'type':Sequelize[_0x5760('0x2')]},'description':{'type':Sequelize[_0x5760('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b755826..633ac6a 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 _0x31f5=['length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addContacts','ids','omit','findOne','CmContact','getContacts','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','Companies','UserProfileResource','error','name','index','CmCompany','model','keys','filters','intersection','attributes','fields'];(function(_0x192e56,_0x523539){var _0x3d594c=function(_0x11ad1b){while(--_0x11ad1b){_0x192e56['push'](_0x192e56['shift']());}};_0x3d594c(++_0x523539);}(_0x31f5,0x80));var _0x531f=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0x31f5[_0x279095];return _0x5a5cdb;};'use strict';var emlformat=require(_0x531f('0x0'));var rimraf=require(_0x531f('0x1'));var zipdir=require(_0x531f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x531f('0x3'));var Mustache=require(_0x531f('0x4'));var util=require(_0x531f('0x5'));var path=require(_0x531f('0x6'));var sox=require(_0x531f('0x7'));var csv=require(_0x531f('0x8'));var ejs=require(_0x531f('0x9'));var fs=require('fs');var fs_extra=require(_0x531f('0xa'));var _=require('lodash');var squel=require(_0x531f('0xb'));var crypto=require(_0x531f('0xc'));var jsforce=require(_0x531f('0xd'));var deskjs=require(_0x531f('0xe'));var toCsv=require(_0x531f('0x8'));var querystring=require(_0x531f('0xf'));var Papa=require('papaparse');var Redis=require(_0x531f('0x10'));var authService=require(_0x531f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x531f('0x12'));var hardwareService=require(_0x531f('0x13'));var logger=require(_0x531f('0x14'))('api');var utils=require(_0x531f('0x15'));var config=require(_0x531f('0x16'));var licenseUtil=require(_0x531f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548800,_0x5f145c){_0x5f145c=_0x5f145c||0xcc;return function(_0x384574){if(_0x384574){return _0x548800[_0x531f('0x18')](_0x5f145c);}return _0x548800[_0x531f('0x19')](_0x5f145c)[_0x531f('0x1a')]();};}function respondWithResult(_0xd1b334,_0x1ded0c){_0x1ded0c=_0x1ded0c||0xc8;return function(_0x514570){if(_0x514570){return _0xd1b334['status'](_0x1ded0c)[_0x531f('0x1b')](_0x514570);}};}function respondWithFilteredResult(_0x3c0bf3,_0x45cf14){return function(_0xab0e4d){if(_0xab0e4d){var _0x507657=typeof _0x45cf14[_0x531f('0x1c')]===_0x531f('0x1d')&&typeof _0x45cf14[_0x531f('0x1e')]==='undefined';var _0x3b273f=_0xab0e4d[_0x531f('0x1f')];var _0x320e65=_0x507657?0x0:_0x45cf14[_0x531f('0x1c')];var _0x25e711=_0x507657?_0xab0e4d[_0x531f('0x1f')]:_0x45cf14[_0x531f('0x1c')]+_0x45cf14[_0x531f('0x1e')];var _0xf38d7f;if(_0x25e711>=_0x3b273f){_0x25e711=_0x3b273f;_0xf38d7f=0xc8;}else{_0xf38d7f=0xce;}_0x3c0bf3[_0x531f('0x19')](_0xf38d7f);return _0x3c0bf3[_0x531f('0x20')](_0x531f('0x21'),_0x320e65+'-'+_0x25e711+'/'+_0x3b273f)[_0x531f('0x1b')](_0xab0e4d);}return null;};}function patchUpdates(_0x1e2bac){return function(_0x3b3df){try{jsonpatch[_0x531f('0x22')](_0x3b3df,_0x1e2bac,!![]);}catch(_0x4ebd41){return BPromise['reject'](_0x4ebd41);}return _0x3b3df[_0x531f('0x23')]();};}function saveUpdates(_0x1243bc,_0x3c0342){return function(_0x2c09a0){if(_0x2c09a0){return _0x2c09a0['update'](_0x1243bc)[_0x531f('0x24')](function(_0x5cc702){return _0x5cc702;});}return null;};}function removeEntity(_0x1de01e,_0xdad4ff){return function(_0x449699){if(_0x449699){return _0x449699['destroy']()[_0x531f('0x24')](function(){var _0x1ad90a=_0x449699[_0x531f('0x25')]({'plain':!![]});var _0x2c32ea=_0x531f('0x26');return db[_0x531f('0x27')]['destroy']({'where':{'type':_0x2c32ea,'resourceId':_0x1ad90a['id']}})[_0x531f('0x24')](function(){return _0x449699;});})[_0x531f('0x24')](function(){_0x1de01e[_0x531f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31a411,_0x4780bb){return function(_0x4d68b1){if(!_0x4d68b1){_0x31a411['sendStatus'](0x194);}return _0x4d68b1;};}function handleError(_0x427ea7,_0x582878){_0x582878=_0x582878||0x1f4;return function(_0x14bc18){logger[_0x531f('0x28')](_0x14bc18['stack']);if(_0x14bc18[_0x531f('0x29')]){delete _0x14bc18[_0x531f('0x29')];}_0x427ea7['status'](_0x582878)['send'](_0x14bc18);};}exports[_0x531f('0x2a')]=function(_0x52bca2,_0xa32540){var _0x3b4c7a={},_0x37ddfd={},_0x12bc63={'count':0x0,'rows':[]};return db[_0x531f('0x2b')]['describe']()[_0x531f('0x24')](function(_0x4c9880){_0x37ddfd[_0x531f('0x2c')]=_[_0x531f('0x2d')](_0x4c9880);_0x37ddfd['query']=_[_0x531f('0x2d')](_0x52bca2['query']);_0x37ddfd[_0x531f('0x2e')]=_[_0x531f('0x2f')](_0x37ddfd[_0x531f('0x2c')],_0x37ddfd['query']);_0x3b4c7a[_0x531f('0x30')]=_['intersection'](_0x37ddfd[_0x531f('0x2c')],qs['fields'](_0x52bca2['query'][_0x531f('0x31')]));_0x3b4c7a[_0x531f('0x30')]=_0x3b4c7a[_0x531f('0x30')][_0x531f('0x32')]?_0x3b4c7a['attributes']:_0x37ddfd[_0x531f('0x2c')];if(!_0x52bca2[_0x531f('0x33')][_0x531f('0x34')](_0x531f('0x35'))){_0x3b4c7a[_0x531f('0x1e')]=qs[_0x531f('0x1e')](_0x52bca2[_0x531f('0x33')]['limit']);_0x3b4c7a['offset']=qs[_0x531f('0x1c')](_0x52bca2[_0x531f('0x33')][_0x531f('0x1c')]);}_0x3b4c7a[_0x531f('0x36')]=qs[_0x531f('0x37')](_0x52bca2[_0x531f('0x33')][_0x531f('0x37')]);_0x3b4c7a[_0x531f('0x38')]=qs[_0x531f('0x2e')](_[_0x531f('0x39')](_0x52bca2[_0x531f('0x33')],_0x37ddfd[_0x531f('0x2e')]),_0x4c9880);if(_0x52bca2[_0x531f('0x33')][_0x531f('0x3a')]){_0x3b4c7a[_0x531f('0x38')]=_[_0x531f('0x3b')](_0x3b4c7a['where'],{'$or':_[_0x531f('0x3c')](_0x3b4c7a['attributes'],function(_0x3da6c3){var _0x30cebe={};_0x30cebe[_0x3da6c3]={'$like':'%'+_0x52bca2[_0x531f('0x33')][_0x531f('0x3a')]+'%'};return _0x30cebe;})});}_0x3b4c7a=_[_0x531f('0x3b')]({},_0x3b4c7a,_0x52bca2[_0x531f('0x3d')]);var _0x35e497={'where':_0x3b4c7a[_0x531f('0x38')]};return db[_0x531f('0x2b')]['count'](_0x35e497)[_0x531f('0x24')](function(_0x32c867){_0x12bc63[_0x531f('0x1f')]=_0x32c867;if(_0x52bca2[_0x531f('0x33')][_0x531f('0x3e')]){_0x3b4c7a['include']=[{'all':!![]}];}return db[_0x531f('0x2b')][_0x531f('0x3f')](_0x3b4c7a);})[_0x531f('0x24')](function(_0x636310){_0x12bc63[_0x531f('0x40')]=_0x636310;return _0x12bc63;})[_0x531f('0x24')](respondWithFilteredResult(_0xa32540,_0x3b4c7a))[_0x531f('0x41')](handleError(_0xa32540,null));})[_0x531f('0x41')](handleError(_0xa32540,null));};exports[_0x531f('0x42')]=function(_0x578d82,_0x40e1e6){var _0x5cbc38={'raw':![],'where':{'id':_0x578d82[_0x531f('0x43')]['id']}},_0x4e8c20={};_0x4e8c20[_0x531f('0x2c')]=_['keys'](db[_0x531f('0x2b')][_0x531f('0x44')]);_0x4e8c20['query']=_['keys'](_0x578d82[_0x531f('0x33')]);_0x4e8c20[_0x531f('0x2e')]=_[_0x531f('0x2f')](_0x4e8c20[_0x531f('0x2c')],_0x4e8c20[_0x531f('0x33')]);_0x5cbc38['attributes']=_[_0x531f('0x2f')](_0x4e8c20[_0x531f('0x2c')],qs[_0x531f('0x31')](_0x578d82[_0x531f('0x33')][_0x531f('0x31')]));_0x5cbc38['attributes']=_0x5cbc38[_0x531f('0x30')][_0x531f('0x32')]?_0x5cbc38[_0x531f('0x30')]:_0x4e8c20[_0x531f('0x2c')];if(_0x578d82[_0x531f('0x33')][_0x531f('0x3e')]){_0x5cbc38[_0x531f('0x45')]=[{'all':!![]}];}_0x5cbc38=_[_0x531f('0x3b')]({},_0x5cbc38,_0x578d82[_0x531f('0x3d')]);return db[_0x531f('0x2b')][_0x531f('0x46')](_0x5cbc38)[_0x531f('0x24')](handleEntityNotFound(_0x40e1e6,null))['then'](respondWithResult(_0x40e1e6,null))[_0x531f('0x41')](handleError(_0x40e1e6,null));};exports['create']=function(_0x479640,_0x312558){return db[_0x531f('0x2b')][_0x531f('0x47')](_0x479640['body'],{})[_0x531f('0x24')](function(_0xa906a7){var _0x14a601=_0x479640[_0x531f('0x48')]['get']({'plain':!![]});if(!_0x14a601)throw new Error(_0x531f('0x49'));if(_0x14a601[_0x531f('0x4a')]===_0x531f('0x48')){var _0x29c3f3=_0xa906a7[_0x531f('0x25')]({'plain':!![]});var _0x5cf887=_0x531f('0x26');return db[_0x531f('0x4b')][_0x531f('0x46')]({'where':{'name':_0x5cf887,'userProfileId':_0x14a601[_0x531f('0x4c')]},'raw':!![]})[_0x531f('0x24')](function(_0x11a55e){if(_0x11a55e&&_0x11a55e[_0x531f('0x4d')]===0x0){return db[_0x531f('0x27')][_0x531f('0x47')]({'name':_0x29c3f3['name'],'resourceId':_0x29c3f3['id'],'type':_0x11a55e['name'],'sectionId':_0x11a55e['id']},{})[_0x531f('0x24')](function(){return _0xa906a7;});}else{return _0xa906a7;}})[_0x531f('0x41')](function(_0x395666){logger[_0x531f('0x28')](_0x531f('0x4e'),_0x395666);throw _0x395666;});}return _0xa906a7;})[_0x531f('0x24')](respondWithResult(_0x312558,0xc9))[_0x531f('0x41')](handleError(_0x312558,null));};exports[_0x531f('0x4f')]=function(_0x4f7902,_0x387282){if(_0x4f7902['body']['id']){delete _0x4f7902[_0x531f('0x50')]['id'];}return db[_0x531f('0x2b')][_0x531f('0x46')]({'where':{'id':_0x4f7902[_0x531f('0x43')]['id']}})[_0x531f('0x24')](handleEntityNotFound(_0x387282,null))[_0x531f('0x24')](saveUpdates(_0x4f7902['body'],null))[_0x531f('0x24')](respondWithResult(_0x387282,null))[_0x531f('0x41')](handleError(_0x387282,null));};exports[_0x531f('0x51')]=function(_0x395813,_0x1e64cc){return db[_0x531f('0x2b')][_0x531f('0x46')]({'where':{'id':_0x395813['params']['id']}})[_0x531f('0x24')](handleEntityNotFound(_0x1e64cc,null))[_0x531f('0x24')](removeEntity(_0x1e64cc,null))[_0x531f('0x41')](handleError(_0x1e64cc,null));};exports[_0x531f('0x52')]=function(_0x45d912,_0x53e0c2){return db[_0x531f('0x2b')][_0x531f('0x52')]()['then'](respondWithResult(_0x53e0c2,null))[_0x531f('0x41')](handleError(_0x53e0c2,null));};exports[_0x531f('0x53')]=function(_0x1217e8,_0x1575f9,_0x4bb033){return db['CmContact'][_0x531f('0x46')]({'where':{'id':_0x1217e8[_0x531f('0x43')]['id']}})[_0x531f('0x24')](handleEntityNotFound(_0x1575f9,null))['then'](function(_0x176c6b){if(_0x176c6b){return _0x176c6b[_0x531f('0x53')](_0x1217e8['body'][_0x531f('0x54')],_[_0x531f('0x55')](_0x1217e8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1575f9,null))[_0x531f('0x41')](handleError(_0x1575f9,null));};exports['getContacts']=function(_0x7413c6,_0x2563a4,_0x942b97){var _0x3812d1={};var _0x2282db={};var _0x55a537;var _0x1f317c;return db['CmCompany'][_0x531f('0x56')]({'where':{'id':_0x7413c6[_0x531f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2563a4,null))[_0x531f('0x24')](function(_0xe9bbea){if(_0xe9bbea){_0x55a537=_0xe9bbea;_0x2282db[_0x531f('0x2c')]=_[_0x531f('0x2d')](db[_0x531f('0x57')][_0x531f('0x44')]);_0x2282db[_0x531f('0x33')]=_[_0x531f('0x2d')](_0x7413c6['query']);_0x2282db['filters']=_[_0x531f('0x2f')](_0x2282db[_0x531f('0x2c')],_0x2282db[_0x531f('0x33')]);_0x3812d1[_0x531f('0x30')]=_['intersection'](_0x2282db[_0x531f('0x2c')],qs[_0x531f('0x31')](_0x7413c6[_0x531f('0x33')][_0x531f('0x31')]));_0x3812d1['attributes']=_0x3812d1[_0x531f('0x30')][_0x531f('0x32')]?_0x3812d1[_0x531f('0x30')]:_0x2282db[_0x531f('0x2c')];_0x3812d1['order']=qs[_0x531f('0x37')](_0x7413c6[_0x531f('0x33')][_0x531f('0x37')]);_0x3812d1[_0x531f('0x38')]=qs[_0x531f('0x2e')](_[_0x531f('0x39')](_0x7413c6[_0x531f('0x33')],_0x2282db['filters']));if(_0x7413c6[_0x531f('0x33')][_0x531f('0x3a')]){_0x3812d1[_0x531f('0x38')]=_[_0x531f('0x3b')](_0x3812d1[_0x531f('0x38')],{'$or':_[_0x531f('0x3c')](_0x3812d1[_0x531f('0x30')],function(_0x5e8f9b){var _0x5bbc51={};_0x5bbc51[_0x5e8f9b]={'$like':'%'+_0x7413c6['query']['filter']+'%'};return _0x5bbc51;})});}_0x3812d1=_[_0x531f('0x3b')]({},_0x3812d1,_0x7413c6[_0x531f('0x3d')]);return _0x55a537[_0x531f('0x58')](_0x3812d1);}})[_0x531f('0x24')](function(_0x52f283){if(_0x52f283){_0x1f317c=_0x52f283[_0x531f('0x32')];if(!_0x7413c6[_0x531f('0x33')]['hasOwnProperty']('nolimit')){_0x3812d1['limit']=qs[_0x531f('0x1e')](_0x7413c6[_0x531f('0x33')][_0x531f('0x1e')]);_0x3812d1[_0x531f('0x1c')]=qs[_0x531f('0x1c')](_0x7413c6[_0x531f('0x33')]['offset']);}return _0x55a537[_0x531f('0x58')](_0x3812d1);}})[_0x531f('0x24')](function(_0x568c30){if(_0x568c30){return _0x568c30?{'count':_0x1f317c,'rows':_0x568c30}:null;}})[_0x531f('0x24')](respondWithResult(_0x2563a4,null))[_0x531f('0x41')](handleError(_0x2563a4,null));}; \ No newline at end of file +var _0x5caf=['reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','addContacts','CmContact','ids','findOne','length','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x259a91,_0x562ef4){var _0x58c63f=function(_0x41adf5){while(--_0x41adf5){_0x259a91['push'](_0x259a91['shift']());}};_0x58c63f(++_0x562ef4);}(_0x5caf,0x1db));var _0xf5ca=function(_0x4d1190,_0x4bb13c){_0x4d1190=_0x4d1190-0x0;var _0x125f28=_0x5caf[_0x4d1190];return _0x125f28;};'use strict';var emlformat=require(_0xf5ca('0x0'));var rimraf=require(_0xf5ca('0x1'));var zipdir=require(_0xf5ca('0x2'));var jsonpatch=require(_0xf5ca('0x3'));var rp=require('request-promise');var moment=require(_0xf5ca('0x4'));var BPromise=require(_0xf5ca('0x5'));var Mustache=require('mustache');var util=require(_0xf5ca('0x6'));var path=require(_0xf5ca('0x7'));var sox=require('sox');var csv=require(_0xf5ca('0x8'));var ejs=require(_0xf5ca('0x9'));var fs=require('fs');var fs_extra=require(_0xf5ca('0xa'));var _=require(_0xf5ca('0xb'));var squel=require(_0xf5ca('0xc'));var crypto=require(_0xf5ca('0xd'));var jsforce=require(_0xf5ca('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf5ca('0xf'));var Papa=require('papaparse');var Redis=require(_0xf5ca('0x10'));var authService=require(_0xf5ca('0x11'));var qs=require(_0xf5ca('0x12'));var as=require(_0xf5ca('0x13'));var hardwareService=require(_0xf5ca('0x14'));var logger=require(_0xf5ca('0x15'))(_0xf5ca('0x16'));var utils=require(_0xf5ca('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf5ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x486300,_0x31ddbe){_0x31ddbe=_0x31ddbe||0xcc;return function(_0x432ea4){if(_0x432ea4){return _0x486300[_0xf5ca('0x19')](_0x31ddbe);}return _0x486300[_0xf5ca('0x1a')](_0x31ddbe)[_0xf5ca('0x1b')]();};}function respondWithResult(_0x5dbfe3,_0x5bf0e5){_0x5bf0e5=_0x5bf0e5||0xc8;return function(_0x4fc188){if(_0x4fc188){return _0x5dbfe3['status'](_0x5bf0e5)[_0xf5ca('0x1c')](_0x4fc188);}};}function respondWithFilteredResult(_0x58eac5,_0x275b5c){return function(_0x3c0b96){if(_0x3c0b96){var _0x330c8f=typeof _0x275b5c[_0xf5ca('0x1d')]===_0xf5ca('0x1e')&&typeof _0x275b5c[_0xf5ca('0x1f')]===_0xf5ca('0x1e');var _0x3c988f=_0x3c0b96[_0xf5ca('0x20')];var _0x59408f=_0x330c8f?0x0:_0x275b5c['offset'];var _0x324141=_0x330c8f?_0x3c0b96[_0xf5ca('0x20')]:_0x275b5c[_0xf5ca('0x1d')]+_0x275b5c[_0xf5ca('0x1f')];var _0x5e3eda;if(_0x324141>=_0x3c988f){_0x324141=_0x3c988f;_0x5e3eda=0xc8;}else{_0x5e3eda=0xce;}_0x58eac5['status'](_0x5e3eda);return _0x58eac5[_0xf5ca('0x21')]('Content-Range',_0x59408f+'-'+_0x324141+'/'+_0x3c988f)[_0xf5ca('0x1c')](_0x3c0b96);}return null;};}function patchUpdates(_0xfa6ea0){return function(_0x5c1610){try{jsonpatch[_0xf5ca('0x22')](_0x5c1610,_0xfa6ea0,!![]);}catch(_0x3ad449){return BPromise[_0xf5ca('0x23')](_0x3ad449);}return _0x5c1610[_0xf5ca('0x24')]();};}function saveUpdates(_0x3633fc,_0x21039e){return function(_0x109ccb){if(_0x109ccb){return _0x109ccb[_0xf5ca('0x25')](_0x3633fc)[_0xf5ca('0x26')](function(_0x2d9ff2){return _0x2d9ff2;});}return null;};}function removeEntity(_0x52d0c4,_0x389d9a){return function(_0x519dde){if(_0x519dde){return _0x519dde[_0xf5ca('0x27')]()[_0xf5ca('0x26')](function(){var _0x26fb0d=_0x519dde[_0xf5ca('0x28')]({'plain':!![]});var _0x3e9204=_0xf5ca('0x29');return db[_0xf5ca('0x2a')][_0xf5ca('0x27')]({'where':{'type':_0x3e9204,'resourceId':_0x26fb0d['id']}})[_0xf5ca('0x26')](function(){return _0x519dde;});})[_0xf5ca('0x26')](function(){_0x52d0c4[_0xf5ca('0x1a')](0xcc)[_0xf5ca('0x1b')]();});}};}function handleEntityNotFound(_0x72675e,_0x23a744){return function(_0x10ee65){if(!_0x10ee65){_0x72675e[_0xf5ca('0x19')](0x194);}return _0x10ee65;};}function handleError(_0x5539b7,_0x1877fc){_0x1877fc=_0x1877fc||0x1f4;return function(_0x47a7fc){logger[_0xf5ca('0x2b')](_0x47a7fc['stack']);if(_0x47a7fc[_0xf5ca('0x2c')]){delete _0x47a7fc[_0xf5ca('0x2c')];}_0x5539b7[_0xf5ca('0x1a')](_0x1877fc)[_0xf5ca('0x2d')](_0x47a7fc);};}exports[_0xf5ca('0x2e')]=function(_0x529d9e,_0x4d448d){var _0x154c34={},_0x32274f={},_0x4fc38f={'count':0x0,'rows':[]};return db[_0xf5ca('0x2f')][_0xf5ca('0x30')]()['then'](function(_0x25c110){_0x32274f['model']=_['keys'](_0x25c110);_0x32274f[_0xf5ca('0x31')]=_[_0xf5ca('0x32')](_0x529d9e['query']);_0x32274f[_0xf5ca('0x33')]=_[_0xf5ca('0x34')](_0x32274f[_0xf5ca('0x35')],_0x32274f[_0xf5ca('0x31')]);_0x154c34[_0xf5ca('0x36')]=_[_0xf5ca('0x34')](_0x32274f['model'],qs[_0xf5ca('0x37')](_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x37')]));_0x154c34[_0xf5ca('0x36')]=_0x154c34['attributes']['length']?_0x154c34[_0xf5ca('0x36')]:_0x32274f['model'];if(!_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x38')](_0xf5ca('0x39'))){_0x154c34[_0xf5ca('0x1f')]=qs[_0xf5ca('0x1f')](_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x1f')]);_0x154c34[_0xf5ca('0x1d')]=qs['offset'](_0x529d9e[_0xf5ca('0x31')]['offset']);}_0x154c34['order']=qs[_0xf5ca('0x3a')](_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x3a')]);_0x154c34[_0xf5ca('0x3b')]=qs[_0xf5ca('0x33')](_[_0xf5ca('0x3c')](_0x529d9e['query'],_0x32274f[_0xf5ca('0x33')]),_0x25c110);if(_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x3d')]){_0x154c34[_0xf5ca('0x3b')]=_[_0xf5ca('0x3e')](_0x154c34[_0xf5ca('0x3b')],{'$or':_[_0xf5ca('0x3f')](_0x154c34[_0xf5ca('0x36')],function(_0x22c8ef){var _0x41d8e3={};_0x41d8e3[_0x22c8ef]={'$like':'%'+_0x529d9e['query'][_0xf5ca('0x3d')]+'%'};return _0x41d8e3;})});}_0x154c34=_[_0xf5ca('0x3e')]({},_0x154c34,_0x529d9e[_0xf5ca('0x40')]);var _0x4df1f3={'where':_0x154c34[_0xf5ca('0x3b')]};return db['CmCompany']['count'](_0x4df1f3)[_0xf5ca('0x26')](function(_0x1a6630){_0x4fc38f[_0xf5ca('0x20')]=_0x1a6630;if(_0x529d9e[_0xf5ca('0x31')][_0xf5ca('0x41')]){_0x154c34[_0xf5ca('0x42')]=[{'all':!![]}];}return db[_0xf5ca('0x2f')][_0xf5ca('0x43')](_0x154c34);})[_0xf5ca('0x26')](function(_0x2471c8){_0x4fc38f[_0xf5ca('0x44')]=_0x2471c8;return _0x4fc38f;})[_0xf5ca('0x26')](respondWithFilteredResult(_0x4d448d,_0x154c34))[_0xf5ca('0x45')](handleError(_0x4d448d,null));})[_0xf5ca('0x45')](handleError(_0x4d448d,null));};exports['show']=function(_0x42a7bf,_0x282820){var _0x2990e6={'raw':![],'where':{'id':_0x42a7bf[_0xf5ca('0x46')]['id']}},_0x36842f={};_0x36842f[_0xf5ca('0x35')]=_['keys'](db[_0xf5ca('0x2f')]['rawAttributes']);_0x36842f[_0xf5ca('0x31')]=_[_0xf5ca('0x32')](_0x42a7bf[_0xf5ca('0x31')]);_0x36842f[_0xf5ca('0x33')]=_[_0xf5ca('0x34')](_0x36842f[_0xf5ca('0x35')],_0x36842f[_0xf5ca('0x31')]);_0x2990e6[_0xf5ca('0x36')]=_[_0xf5ca('0x34')](_0x36842f[_0xf5ca('0x35')],qs['fields'](_0x42a7bf[_0xf5ca('0x31')]['fields']));_0x2990e6[_0xf5ca('0x36')]=_0x2990e6[_0xf5ca('0x36')]['length']?_0x2990e6[_0xf5ca('0x36')]:_0x36842f[_0xf5ca('0x35')];if(_0x42a7bf[_0xf5ca('0x31')][_0xf5ca('0x41')]){_0x2990e6['include']=[{'all':!![]}];}_0x2990e6=_[_0xf5ca('0x3e')]({},_0x2990e6,_0x42a7bf[_0xf5ca('0x40')]);return db[_0xf5ca('0x2f')][_0xf5ca('0x47')](_0x2990e6)[_0xf5ca('0x26')](handleEntityNotFound(_0x282820,null))[_0xf5ca('0x26')](respondWithResult(_0x282820,null))['catch'](handleError(_0x282820,null));};exports[_0xf5ca('0x48')]=function(_0x57d505,_0x1d5fe7){return db[_0xf5ca('0x2f')][_0xf5ca('0x48')](_0x57d505[_0xf5ca('0x49')],{})[_0xf5ca('0x26')](function(_0x398c4f){var _0x37e022=_0x57d505[_0xf5ca('0x4a')]['get']({'plain':!![]});if(!_0x37e022)throw new Error(_0xf5ca('0x4b'));if(_0x37e022[_0xf5ca('0x4c')]===_0xf5ca('0x4a')){var _0x30b031=_0x398c4f[_0xf5ca('0x28')]({'plain':!![]});var _0x4e4390='Companies';return db[_0xf5ca('0x4d')]['find']({'where':{'name':_0x4e4390,'userProfileId':_0x37e022[_0xf5ca('0x4e')]},'raw':!![]})[_0xf5ca('0x26')](function(_0x2a749c){if(_0x2a749c&&_0x2a749c['autoAssociation']===0x0){return db[_0xf5ca('0x2a')][_0xf5ca('0x48')]({'name':_0x30b031[_0xf5ca('0x2c')],'resourceId':_0x30b031['id'],'type':_0x2a749c[_0xf5ca('0x2c')],'sectionId':_0x2a749c['id']},{})[_0xf5ca('0x26')](function(){return _0x398c4f;});}else{return _0x398c4f;}})['catch'](function(_0xb37308){logger[_0xf5ca('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb37308);throw _0xb37308;});}return _0x398c4f;})[_0xf5ca('0x26')](respondWithResult(_0x1d5fe7,0xc9))[_0xf5ca('0x45')](handleError(_0x1d5fe7,null));};exports['update']=function(_0x58ada5,_0x6fd659){if(_0x58ada5['body']['id']){delete _0x58ada5[_0xf5ca('0x49')]['id'];}return db[_0xf5ca('0x2f')][_0xf5ca('0x47')]({'where':{'id':_0x58ada5[_0xf5ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x6fd659,null))[_0xf5ca('0x26')](saveUpdates(_0x58ada5[_0xf5ca('0x49')],null))[_0xf5ca('0x26')](respondWithResult(_0x6fd659,null))[_0xf5ca('0x45')](handleError(_0x6fd659,null));};exports[_0xf5ca('0x27')]=function(_0x16685d,_0x33f63f){return db['CmCompany'][_0xf5ca('0x47')]({'where':{'id':_0x16685d['params']['id']}})[_0xf5ca('0x26')](handleEntityNotFound(_0x33f63f,null))[_0xf5ca('0x26')](removeEntity(_0x33f63f,null))[_0xf5ca('0x45')](handleError(_0x33f63f,null));};exports[_0xf5ca('0x30')]=function(_0x1379cc,_0x50ed47){return db[_0xf5ca('0x2f')][_0xf5ca('0x30')]()['then'](respondWithResult(_0x50ed47,null))[_0xf5ca('0x45')](handleError(_0x50ed47,null));};exports[_0xf5ca('0x4f')]=function(_0x94712c,_0x4dd527,_0x34cd29){return db[_0xf5ca('0x50')][_0xf5ca('0x47')]({'where':{'id':_0x94712c[_0xf5ca('0x46')]['id']}})[_0xf5ca('0x26')](handleEntityNotFound(_0x4dd527,null))[_0xf5ca('0x26')](function(_0x39091f){if(_0x39091f){return _0x39091f[_0xf5ca('0x4f')](_0x94712c[_0xf5ca('0x49')][_0xf5ca('0x51')],_['omit'](_0x94712c[_0xf5ca('0x49')],['ids','id'])||{});}})[_0xf5ca('0x26')](respondWithResult(_0x4dd527,null))['catch'](handleError(_0x4dd527,null));};exports['getContacts']=function(_0x54447d,_0xdb0107,_0x53c431){var _0x456974={};var _0xe8e6c3={};var _0x4a9e24;var _0x3e6461;return db[_0xf5ca('0x2f')][_0xf5ca('0x52')]({'where':{'id':_0x54447d['params']['id']}})[_0xf5ca('0x26')](handleEntityNotFound(_0xdb0107,null))['then'](function(_0x18502e){if(_0x18502e){_0x4a9e24=_0x18502e;_0xe8e6c3['model']=_[_0xf5ca('0x32')](db[_0xf5ca('0x50')]['rawAttributes']);_0xe8e6c3['query']=_['keys'](_0x54447d[_0xf5ca('0x31')]);_0xe8e6c3[_0xf5ca('0x33')]=_[_0xf5ca('0x34')](_0xe8e6c3[_0xf5ca('0x35')],_0xe8e6c3[_0xf5ca('0x31')]);_0x456974[_0xf5ca('0x36')]=_[_0xf5ca('0x34')](_0xe8e6c3[_0xf5ca('0x35')],qs[_0xf5ca('0x37')](_0x54447d[_0xf5ca('0x31')][_0xf5ca('0x37')]));_0x456974[_0xf5ca('0x36')]=_0x456974[_0xf5ca('0x36')][_0xf5ca('0x53')]?_0x456974[_0xf5ca('0x36')]:_0xe8e6c3[_0xf5ca('0x35')];_0x456974[_0xf5ca('0x54')]=qs[_0xf5ca('0x3a')](_0x54447d[_0xf5ca('0x31')][_0xf5ca('0x3a')]);_0x456974[_0xf5ca('0x3b')]=qs[_0xf5ca('0x33')](_[_0xf5ca('0x3c')](_0x54447d[_0xf5ca('0x31')],_0xe8e6c3[_0xf5ca('0x33')]));if(_0x54447d[_0xf5ca('0x31')][_0xf5ca('0x3d')]){_0x456974[_0xf5ca('0x3b')]=_[_0xf5ca('0x3e')](_0x456974[_0xf5ca('0x3b')],{'$or':_[_0xf5ca('0x3f')](_0x456974[_0xf5ca('0x36')],function(_0x5b1e32){var _0x22b3f4={};_0x22b3f4[_0x5b1e32]={'$like':'%'+_0x54447d[_0xf5ca('0x31')]['filter']+'%'};return _0x22b3f4;})});}_0x456974=_['merge']({},_0x456974,_0x54447d[_0xf5ca('0x40')]);return _0x4a9e24['getContacts'](_0x456974);}})[_0xf5ca('0x26')](function(_0x8bb946){if(_0x8bb946){_0x3e6461=_0x8bb946[_0xf5ca('0x53')];if(!_0x54447d[_0xf5ca('0x31')][_0xf5ca('0x38')]('nolimit')){_0x456974[_0xf5ca('0x1f')]=qs[_0xf5ca('0x1f')](_0x54447d['query']['limit']);_0x456974[_0xf5ca('0x1d')]=qs['offset'](_0x54447d[_0xf5ca('0x31')][_0xf5ca('0x1d')]);}return _0x4a9e24['getContacts'](_0x456974);}})[_0xf5ca('0x26')](function(_0x1425e2){if(_0x1425e2){return _0x1425e2?{'count':_0x3e6461,'rows':_0x1425e2}:null;}})[_0xf5ca('0x26')](respondWithResult(_0xdb0107,null))[_0xf5ca('0x45')](handleError(_0xdb0107,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 79510ae..7e9ca11 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 _0x898b=['./cmCompany.attributes','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x43042b,_0x212193){var _0x1674dc=function(_0x6a20e5){while(--_0x6a20e5){_0x43042b['push'](_0x43042b['shift']());}};_0x1674dc(++_0x212193);}(_0x898b,0x1cb));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb898('0x0'));var util=require(_0xb898('0x1'));var logger=require(_0xb898('0x2'))(_0xb898('0x3'));var moment=require(_0xb898('0x4'));var BPromise=require(_0xb898('0x5'));var rp=require(_0xb898('0x6'));var fs=require('fs');var path=require(_0xb898('0x7'));var rimraf=require(_0xb898('0x8'));var config=require('../../config/environment');var attributes=require(_0xb898('0x9'));module['exports']=function(_0x2778e8,_0x514b1f){return _0x2778e8[_0xb898('0xa')](_0xb898('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f0b=['util','../../config/logger','moment','bluebird','path','../../config/environment','exports','CmCompany','cm_companies','lodash'];(function(_0x28dd49,_0x15006a){var _0xba8f97=function(_0x26f2d5){while(--_0x26f2d5){_0x28dd49['push'](_0x28dd49['shift']());}};_0xba8f97(++_0x15006a);}(_0x5f0b,0x171));var _0xb5f0=function(_0x1998db,_0x5105c0){_0x1998db=_0x1998db-0x0;var _0x12bd1f=_0x5f0b[_0x1998db];return _0x12bd1f;};'use strict';var _=require(_0xb5f0('0x0'));var util=require(_0xb5f0('0x1'));var logger=require(_0xb5f0('0x2'))('api');var moment=require(_0xb5f0('0x3'));var BPromise=require(_0xb5f0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5f0('0x5'));var rimraf=require('rimraf');var config=require(_0xb5f0('0x6'));var attributes=require('./cmCompany.attributes');module[_0xb5f0('0x7')]=function(_0x1aa3d2,_0x473b64){return _0x1aa3d2['define'](_0xb5f0('0x8'),attributes,{'tableName':_0xb5f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a6711d5..28e2abc 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 _0x98da=['rpc','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0xd28cda,_0x3dffdc){var _0x4c7c35=function(_0x2bb407){while(--_0x2bb407){_0xd28cda['push'](_0xd28cda['shift']());}};_0x4c7c35(++_0x3dffdc);}(_0x98da,0x1c5));var _0xa98d=function(_0x583f6f,_0x4b8a14){_0x583f6f=_0x583f6f-0x0;var _0x284b12=_0x98da[_0x583f6f];return _0x284b12;};'use strict';var _=require(_0xa98d('0x0'));var util=require(_0xa98d('0x1'));var moment=require(_0xa98d('0x2'));var BPromise=require(_0xa98d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa98d('0x4'));var db=require(_0xa98d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa98d('0x6'))(_0xa98d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa98d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b83b,_0xaa4784,_0xb6338){return new BPromise(function(_0x1083e9,_0x48e98f){return client['request'](_0x50b83b,_0xb6338)[_0xa98d('0x9')](function(_0x5b2268){logger[_0xa98d('0xa')](_0xa98d('0xb'),_0xaa4784,_0xa98d('0xc'));logger[_0xa98d('0xd')](_0xa98d('0xe'),_0xaa4784,_0xa98d('0xc'),JSON[_0xa98d('0xf')](_0x5b2268));if(_0x5b2268[_0xa98d('0x10')]){if(_0x5b2268[_0xa98d('0x10')][_0xa98d('0x11')]===0x1f4){logger[_0xa98d('0x10')](_0xa98d('0xb'),_0xaa4784,_0x5b2268[_0xa98d('0x10')][_0xa98d('0x12')]);return _0x48e98f(_0x5b2268[_0xa98d('0x10')]['message']);}logger[_0xa98d('0x10')](_0xa98d('0xb'),_0xaa4784,_0x5b2268[_0xa98d('0x10')][_0xa98d('0x12')]);return _0x1083e9(_0x5b2268[_0xa98d('0x10')][_0xa98d('0x12')]);}else{logger[_0xa98d('0xa')](_0xa98d('0xb'),_0xaa4784,'request\x20sent');_0x1083e9(_0x5b2268['result'][_0xa98d('0x12')]);}})[_0xa98d('0x13')](function(_0xe24b3b){logger['error'](_0xa98d('0xb'),_0xaa4784,_0xe24b3b);_0x48e98f(_0xe24b3b);});});} \ No newline at end of file +var _0xd621=['../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','stringify','error','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2d51f2,_0x49e3cc){var _0x427f52=function(_0x38df2e){while(--_0x38df2e){_0x2d51f2['push'](_0x2d51f2['shift']());}};_0x427f52(++_0x49e3cc);}(_0xd621,0x109));var _0x1d62=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0xd621[_0x2e1af3];return _0x4150cd;};'use strict';var _=require(_0x1d62('0x0'));var util=require(_0x1d62('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d62('0x2'));var fs=require('fs');var Redis=require(_0x1d62('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d62('0x4'));var logger=require(_0x1d62('0x5'))(_0x1d62('0x6'));var config=require(_0x1d62('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x454c9c,_0x4a5d76,_0x2c3eb8){return new BPromise(function(_0x28e46d,_0x6d8900){return client[_0x1d62('0x8')](_0x454c9c,_0x2c3eb8)['then'](function(_0x78f02c){logger[_0x1d62('0x9')]('CmCompany,\x20%s,\x20%s',_0x4a5d76,_0x1d62('0xa'));logger[_0x1d62('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4a5d76,_0x1d62('0xa'),JSON[_0x1d62('0xc')](_0x78f02c));if(_0x78f02c['error']){if(_0x78f02c[_0x1d62('0xd')]['code']===0x1f4){logger[_0x1d62('0xd')]('CmCompany,\x20%s,\x20%s',_0x4a5d76,_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);return _0x6d8900(_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);}logger[_0x1d62('0xd')](_0x1d62('0xf'),_0x4a5d76,_0x78f02c[_0x1d62('0xd')][_0x1d62('0xe')]);return _0x28e46d(_0x78f02c['error']['message']);}else{logger[_0x1d62('0x9')](_0x1d62('0xf'),_0x4a5d76,_0x1d62('0xa'));_0x28e46d(_0x78f02c[_0x1d62('0x10')][_0x1d62('0xe')]);}})[_0x1d62('0x11')](function(_0x5a580b){logger[_0x1d62('0xd')](_0x1d62('0xf'),_0x4a5d76,_0x5a580b);_0x6d8900(_0x5a580b);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b646ea5..b0df994 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 _0x306b=['isAuthenticated','/describe','describe','/:id','/:id/contacts','getContacts','create','post','addContacts','put','update','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0x306b,0x1b0));var _0xb306=function(_0x50faaa,_0x59d114){_0x50faaa=_0x50faaa-0x0;var _0x48300e=_0x306b[_0x50faaa];return _0x48300e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb306('0x0'));var timeout=require(_0xb306('0x1'));var express=require('express');var router=express[_0xb306('0x2')]();var fs_extra=require(_0xb306('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb306('0x4'));var config=require(_0xb306('0x5'));var controller=require(_0xb306('0x6'));router[_0xb306('0x7')]('/',auth[_0xb306('0x8')](),controller['index']);router[_0xb306('0x7')](_0xb306('0x9'),auth[_0xb306('0x8')](),controller[_0xb306('0xa')]);router[_0xb306('0x7')](_0xb306('0xb'),auth[_0xb306('0x8')](),controller['show']);router[_0xb306('0x7')](_0xb306('0xc'),auth['isAuthenticated'](),controller[_0xb306('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb306('0xe')]);router[_0xb306('0xf')](_0xb306('0xc'),auth[_0xb306('0x8')](),controller[_0xb306('0x10')]);router[_0xb306('0x11')](_0xb306('0xb'),auth[_0xb306('0x8')](),controller[_0xb306('0x12')]);router['delete'](_0xb306('0xb'),auth[_0xb306('0x8')](),controller['destroy']);module[_0xb306('0x13')]=router; \ No newline at end of file +var _0x22a3=['addContacts','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','/:id/contacts'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x22a3,0x131));var _0x322a=function(_0x518b99,_0x4333e4){_0x518b99=_0x518b99-0x0;var _0x45faed=_0x22a3[_0x518b99];return _0x45faed;};'use strict';var multer=require(_0x322a('0x0'));var util=require(_0x322a('0x1'));var path=require('path');var timeout=require(_0x322a('0x2'));var express=require(_0x322a('0x3'));var router=express[_0x322a('0x4')]();var fs_extra=require(_0x322a('0x5'));var auth=require(_0x322a('0x6'));var interaction=require(_0x322a('0x7'));var config=require(_0x322a('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x322a('0x9')](_0x322a('0xa'),auth[_0x322a('0xb')](),controller[_0x322a('0xc')]);router[_0x322a('0x9')](_0x322a('0xd'),auth['isAuthenticated'](),controller[_0x322a('0xe')]);router[_0x322a('0x9')]('/:id/contacts',auth[_0x322a('0xb')](),controller['getContacts']);router[_0x322a('0xf')]('/',auth[_0x322a('0xb')](),controller['create']);router['post'](_0x322a('0x10'),auth[_0x322a('0xb')](),controller[_0x322a('0x11')]);router[_0x322a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x322a('0x13')]);router[_0x322a('0x14')](_0x322a('0xd'),auth[_0x322a('0xb')](),controller[_0x322a('0x15')]);module[_0x322a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1f12cea..0552f6a 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 _0x3607=['DATE','NOW','lodash','STRING','INTEGER'];(function(_0x405824,_0x2e9fb0){var _0x637617=function(_0x375f1d){while(--_0x375f1d){_0x405824['push'](_0x405824['shift']());}};_0x637617(++_0x2e9fb0);}(_0x3607,0xde));var _0x7360=function(_0x2ecb99,_0x12fac6){_0x2ecb99=_0x2ecb99-0x0;var _0x1831f9=_0x3607[_0x2ecb99];return _0x1831f9;};'use strict';var _=require(_0x7360('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x7360('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7360('0x1')]},'street':{'type':Sequelize[_0x7360('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7360('0x1')]},'country':{'type':Sequelize[_0x7360('0x1')]},'dateOfBirth':{'type':Sequelize[_0x7360('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x7360('0x1')]},'mobile':{'type':Sequelize[_0x7360('0x1')]},'fax':{'type':Sequelize[_0x7360('0x1')]},'email':{'type':Sequelize[_0x7360('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x7360('0x1')]},'fb_data':{'type':Sequelize[_0x7360('0x1')]},'twitter':{'type':Sequelize[_0x7360('0x1')]},'skype':{'type':Sequelize[_0x7360('0x1')]},'teams':{'type':Sequelize[_0x7360('0x1')]},'viber':{'type':Sequelize[_0x7360('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x7360('0x1')]},'telegram':{'type':Sequelize[_0x7360('0x1')]},'UserId':{'type':Sequelize[_0x7360('0x2')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7360('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7360('0x3')],'defaultValue':Sequelize[_0x7360('0x4')]},'dialTimezone':{'type':Sequelize[_0x7360('0x1')]},'utcOffset':{'type':Sequelize[_0x7360('0x2')]}}; \ No newline at end of file +var _0x03c6=['INTEGER','UNSIGNED','NOW','lodash','exports','STRING','TEXT'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x03c6,0x81));var _0x603c=function(_0x1b8d89,_0x276f9b){_0x1b8d89=_0x1b8d89-0x0;var _0x575674=_0x03c6[_0x1b8d89];return _0x575674;};'use strict';var _=require(_0x603c('0x0'));var Sequelize=require('sequelize');module[_0x603c('0x1')]={'firstName':{'type':Sequelize[_0x603c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x603c('0x2')]},'street':{'type':Sequelize[_0x603c('0x2')]},'postalCode':{'type':Sequelize[_0x603c('0x2')]},'city':{'type':Sequelize[_0x603c('0x2')]},'country':{'type':Sequelize[_0x603c('0x2')]},'dateOfBirth':{'type':Sequelize[_0x603c('0x2')]},'description':{'type':Sequelize[_0x603c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x603c('0x2')]},'fax':{'type':Sequelize[_0x603c('0x2')]},'email':{'type':Sequelize[_0x603c('0x2')]},'url':{'type':Sequelize[_0x603c('0x2')]},'facebook':{'type':Sequelize[_0x603c('0x2')]},'fb_data':{'type':Sequelize[_0x603c('0x2')]},'twitter':{'type':Sequelize[_0x603c('0x2')]},'skype':{'type':Sequelize[_0x603c('0x2')]},'teams':{'type':Sequelize[_0x603c('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x603c('0x2')]},'wechat':{'type':Sequelize[_0x603c('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x603c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x603c('0x2')]},'priority':{'type':Sequelize[_0x603c('0x4')](0x2)[_0x603c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x603c('0x6')]},'dialTimezone':{'type':Sequelize[_0x603c('0x2')]},'utcOffset':{'type':Sequelize[_0x603c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 96773c2..1a85abe 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 _0x5381=['startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','$and','map','format','cf_%d','timezones','omit','pickBy','isEmpty','table','cm_contacts','setFields','toParam','values','phone','findOne','model','rawAttributes','filters','intersection','attributes','order','sort','pick','filter','options','nolimit','getTags','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','fields','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','child_process','fork','File\x20uploaded\x20correctly!','pid','upload','parse','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','resolve','channel','toLowerCase','Invalid\x20channel','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','starttime','endtime','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC','range','createdAt','findAndCountAll','startCase','Website','disposition','UserId','Account','Owner','browserName','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','threadId','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','ioredis','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','update','then','destroy','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','length'];(function(_0x208b8b,_0x32fc5e){var _0xd4f92=function(_0xdef3eb){while(--_0xdef3eb){_0x208b8b['push'](_0x208b8b['shift']());}};_0xd4f92(++_0x32fc5e);}(_0x5381,0xcd));var _0x1538=function(_0x3129b1,_0x3868f2){_0x3129b1=_0x3129b1-0x0;var _0x5b1685=_0x5381[_0x3129b1];return _0x5b1685;};'use strict';var moment=require(_0x1538('0x0'));var BPromise=require(_0x1538('0x1'));var util=require(_0x1538('0x2'));var path=require(_0x1538('0x3'));var fs=require('fs');var _=require(_0x1538('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x1538('0x5'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x1538('0x6'))(_0x1538('0x7'));var config=require('../../config/environment');var shared=require(_0x1538('0x8'));var db=require(_0x1538('0x9'))['db'];config[_0x1538('0xa')]=_[_0x1538('0xb')](config[_0x1538('0xa')],{'host':_0x1538('0xc'),'port':0x18eb});var socket=require(_0x1538('0xd'))(new Redis(config[_0x1538('0xa')]));require('./cmContact.socket')[_0x1538('0xe')](socket);function respondWithResult(_0x4b1727,_0x503d45){_0x503d45=_0x503d45||0xc8;return function(_0x4724a7){if(_0x4724a7){return _0x4b1727[_0x1538('0xf')](_0x503d45)[_0x1538('0x10')](_0x4724a7);}};}function respondWithFilteredResult(_0x391939,_0x27ce81){return function(_0x44331d){if(_0x44331d){var _0x52e562=typeof _0x27ce81[_0x1538('0x11')]===_0x1538('0x12')&&typeof _0x27ce81[_0x1538('0x13')]===_0x1538('0x12');var _0x41c15f=_0x44331d[_0x1538('0x14')];var _0x18fc6f=_0x52e562?0x0:_0x27ce81['offset'];var _0x413ee5=_0x52e562?_0x44331d[_0x1538('0x14')]:_0x27ce81['offset']+_0x27ce81[_0x1538('0x13')];var _0x4a0d44;if(_0x413ee5>=_0x41c15f){_0x413ee5=_0x41c15f;_0x4a0d44=0xc8;}else{_0x4a0d44=0xce;}_0x391939[_0x1538('0xf')](_0x4a0d44);return _0x391939['set']('Content-Range',_0x18fc6f+'-'+_0x413ee5+'/'+_0x41c15f)[_0x1538('0x10')](_0x44331d);}return null;};}function saveUpdates(_0x25f4e1){return function(_0x37c062){if(_0x37c062){return _0x37c062[_0x1538('0x15')](_0x25f4e1)[_0x1538('0x16')](function(_0x2f0fe2){return _0x2f0fe2;});}return null;};}function removeEntity(_0x2bb0d3){return function(_0x44292a){if(_0x44292a){return _0x44292a[_0x1538('0x17')]()[_0x1538('0x16')](function(){_0x2bb0d3[_0x1538('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250695){return function(_0x5e27f5){if(!_0x5e27f5){_0x250695[_0x1538('0x18')](0x194);}return _0x5e27f5;};}function handleError(_0xafda3b,_0x226808){_0x226808=_0x226808||0x1f4;return function(_0x5bcaa2){logger[_0x1538('0x19')](_0x5bcaa2[_0x1538('0x1a')]);if(_0x5bcaa2[_0x1538('0x1b')]){delete _0x5bcaa2[_0x1538('0x1b')];}_0xafda3b[_0x1538('0xf')](_0x226808)[_0x1538('0x1c')](_0x5bcaa2);};}exports[_0x1538('0x1d')]=function(_0x45f807,_0x47f9af){var _0x42c280={};return contacts[_0x1538('0x1e')]()[_0x1538('0x16')](function(_0x35dbd9){_0x42c280=qs[_0x1538('0x1f')](_0x35dbd9,_0x45f807);return contacts[_0x1538('0x20')](_0x45f807[_0x1538('0x21')],_0x45f807[_0x1538('0x22')],_0x42c280,_0x35dbd9);})[_0x1538('0x16')](respondWithFilteredResult(_0x47f9af,_0x42c280))[_0x1538('0x23')](handleError(_0x47f9af,null));};exports[_0x1538('0x17')]=function(_0x481efa,_0x187ab4){return db[_0x1538('0x24')][_0x1538('0x25')]({'where':{'id':_0x481efa[_0x1538('0x26')]['id']}})['then'](handleEntityNotFound(_0x187ab4,null))[_0x1538('0x16')](removeEntity(_0x187ab4,null))['catch'](handleError(_0x187ab4,null));};exports[_0x1538('0x1e')]=function(_0x1fe5ef,_0x32fde0){return db[_0x1538('0x24')][_0x1538('0x1e')]()[_0x1538('0x16')](function(_0x43d8fd){delete _0x43d8fd[_0x1538('0x27')];for(var _0x1ad530=0x0;_0x1ad5300x0){return new Promise(function(_0x2e9db1){var _0x5b5efa=[];for(var _0x45213d=0x0;_0x45213d<_0x3c1de4[_0x1538('0x29')];_0x45213d++){_0x5b5efa['push'](insertAdditionalPhones(_0x3c1de4[_0x45213d][_0x1538('0x61')],_0x3c1de4[_0x45213d][_0x1538('0x57')]));}Promise[_0x1538('0x62')](_0x5b5efa)['then'](function(){_0x2e9db1(0x1);});})[_0x1538('0x16')](function(){return{'success':_0x21dba5,'failure':_0x31a582,'duplicates':_0x3ef29f};});}else{return{'success':_0x21dba5,'failure':_0x31a582,'duplicates':_0x3ef29f};}}})[_0x1538('0x16')](respondWithResult(_0x223adf,0xc9))[_0x1538('0x23')](handleError(_0x223adf,null));};exports[_0x1538('0x63')]=function(_0x15c6e8,_0x51f5fe){var _0x423a59;return db[_0x1538('0x24')][_0x1538('0x1e')]()[_0x1538('0x16')](function(_0x28f39f){return db[_0x1538('0x24')]['find']({'where':{'id':_0x15c6e8['params']['id']},'include':[{'model':db[_0x1538('0x64')],'as':_0x1538('0x65'),'attributes':['id',_0x1538('0x1b'),_0x1538('0x66')],'required':_0x15c6e8['query'][_0x1538('0x67')]?!![]:![]},{'model':db[_0x1538('0x68')],'as':_0x1538('0x69'),'where':{'CmContactId':_0x15c6e8['params']['id']},'required':![],'include':[{'model':db[_0x1538('0x6a')],'as':_0x1538('0x6b')}]}],'order':[db[_0x1538('0x6c')]['literal']('Phones.OrderBy')],'attributes':_[_0x1538('0x28')](_0x28f39f)});})[_0x1538('0x16')](function(_0x2ae9ce){if(!_[_0x1538('0x54')](_0x2ae9ce)){_0x423a59=_0x2ae9ce[_0x1538('0x39')]({'plain':!![]});var _0x1cd209={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ae9ce&&_0x2ae9ce['ListId']){if(_0x2ae9ce[_0x1538('0x5d')]){_0x1cd209['where'][_0x1538('0x6d')][_0x1538('0x60')]({'ListId':{'$ne':_0x2ae9ce[_0x1538('0x5d')]}});}}return db[_0x1538('0x2e')]['findAll'](_0x1cd209);}})[_0x1538('0x16')](function(_0xa4aa94){if(!_[_0x1538('0x54')](_0xa4aa94)){return _['omit'](_0x423a59,_[_0x1538('0x6e')](_0xa4aa94,function(_0x1bdece){return util[_0x1538('0x6f')](_0x1538('0x70'),_0x1bdece['id']);}));}})[_0x1538('0x16')](handleEntityNotFound(_0x51f5fe,null))['then'](respondWithResult(_0x51f5fe,null))['catch'](handleError(_0x51f5fe,null));};exports[_0x1538('0x15')]=function(_0x139fba,_0x2d1f94){var _0x1b3bce;if(_0x139fba['body']['id']){delete _0x139fba[_0x1538('0x37')]['id'];}if(!_[_0x1538('0x54')](_0x139fba['body'][_0x1538('0x55')])){var _0x431193=_0x139fba[_0x1538('0x37')][_0x1538('0x55')];if(!_[_0x1538('0x54')](shared['timezones'][_0x431193]))_0x139fba[_0x1538('0x37')][_0x1538('0x56')]=shared[_0x1538('0x71')][_0x431193][_0x1538('0x56')];}return db[_0x1538('0x24')]['find']({'where':{'id':_0x139fba['params']['id']}})[_0x1538('0x16')](handleEntityNotFound(_0x2d1f94,null))[_0x1538('0x16')](saveUpdates(_0x139fba[_0x1538('0x37')],null))[_0x1538('0x16')](function(_0x36d3f4){_0x1b3bce=_0x36d3f4;var _0x38c959={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x36d3f4&&_0x36d3f4[_0x1538('0x5d')]){if(_0x36d3f4[_0x1538('0x5d')]){_0x38c959[_0x1538('0x5b')][_0x1538('0x6d')]['push']({'ListId':{'$ne':_0x36d3f4[_0x1538('0x5d')]}});}}return db[_0x1538('0x2e')][_0x1538('0x20')](_0x38c959);})['then'](function(_0x5beed1){if(_0x5beed1){return _[_0x1538('0x72')](_[_0x1538('0x73')](_0x139fba[_0x1538('0x37')],function(_0x530769,_0x4dfbf9){return _[_0x1538('0x2a')](_0x4dfbf9,_0x1538('0x2b'));}),_['map'](_0x5beed1,function(_0x55aae6){return util[_0x1538('0x6f')](_0x1538('0x70'),_0x55aae6['id']);}));}})[_0x1538('0x16')](function(_0x18dcdf){if(_0x18dcdf&&!_[_0x1538('0x74')](_0x18dcdf)){var _0x47288b=squel[_0x1538('0x15')]()[_0x1538('0x75')](_0x1538('0x76'))[_0x1538('0x77')](_0x18dcdf)[_0x1538('0x5b')]('id\x20=\x20?',_0x139fba['params']['id'])[_0x1538('0x78')]();return db['sequelize'][_0x1538('0x21')](_0x47288b['text'],{'replacements':_0x47288b[_0x1538('0x79')]});}})['then'](function(){if(_0x139fba[_0x1538('0x37')]['phone']&&_0x1b3bce){return db[_0x1538('0x3d')][_0x1538('0x15')]({'phone':_0x139fba['body'][_0x1538('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x1b3bce['id']}});}})[_0x1538('0x16')](function(){return _0x1b3bce;})['then'](respondWithResult(_0x2d1f94,null))['catch'](handleError(_0x2d1f94,null));};exports['getTags']=function(_0x2d3edf,_0x4a8827){var _0x311edb={};var _0x2fe817={};var _0x2011ac;var _0x2f112d;return db[_0x1538('0x24')][_0x1538('0x7b')]({'where':{'id':_0x2d3edf[_0x1538('0x26')]['id']}})[_0x1538('0x16')](handleEntityNotFound(_0x4a8827,null))[_0x1538('0x16')](function(_0x46bb1c){if(_0x46bb1c){_0x2011ac=_0x46bb1c;_0x2fe817[_0x1538('0x7c')]=_[_0x1538('0x28')](db[_0x1538('0x64')][_0x1538('0x7d')]);_0x2fe817['query']=_[_0x1538('0x28')](_0x2d3edf[_0x1538('0x21')]);_0x2fe817[_0x1538('0x7e')]=_[_0x1538('0x7f')](_0x2fe817['model'],_0x2fe817[_0x1538('0x21')]);_0x311edb[_0x1538('0x80')]=_[_0x1538('0x7f')](_0x2fe817[_0x1538('0x7c')],qs['fields'](_0x2d3edf[_0x1538('0x21')]['fields']));_0x311edb[_0x1538('0x80')]=_0x311edb[_0x1538('0x80')][_0x1538('0x29')]?_0x311edb['attributes']:_0x2fe817['model'];_0x311edb[_0x1538('0x81')]=qs[_0x1538('0x82')](_0x2d3edf[_0x1538('0x21')][_0x1538('0x82')]);_0x311edb[_0x1538('0x5b')]=qs['filters'](_[_0x1538('0x83')](_0x2d3edf[_0x1538('0x21')],_0x2fe817[_0x1538('0x7e')]));if(_0x2d3edf[_0x1538('0x21')][_0x1538('0x84')]){_0x311edb[_0x1538('0x5b')]=_[_0x1538('0x36')](_0x311edb['where'],{'$or':_[_0x1538('0x6e')](_0x311edb['attributes'],function(_0x36fb11){var _0x41f4b8={};_0x41f4b8[_0x36fb11]={'$like':'%'+_0x2d3edf[_0x1538('0x21')][_0x1538('0x84')]+'%'};return _0x41f4b8;})});}_0x311edb=_['merge']({},_0x311edb,_0x2d3edf[_0x1538('0x85')]);return _0x2011ac['getTags'](_0x311edb);}})[_0x1538('0x16')](function(_0x488f84){if(_0x488f84){_0x2f112d=_0x488f84[_0x1538('0x29')];if(!_0x2d3edf[_0x1538('0x21')][_0x1538('0x35')](_0x1538('0x86'))){_0x311edb[_0x1538('0x13')]=qs[_0x1538('0x13')](_0x2d3edf[_0x1538('0x21')][_0x1538('0x13')]);_0x311edb[_0x1538('0x11')]=qs[_0x1538('0x11')](_0x2d3edf[_0x1538('0x21')][_0x1538('0x11')]);}return _0x2011ac[_0x1538('0x87')](_0x311edb);}})['then'](function(_0x5b31dc){if(_0x5b31dc){return _0x5b31dc?{'count':_0x2f112d,'rows':_0x5b31dc}:null;}})[_0x1538('0x16')](respondWithResult(_0x4a8827,null))[_0x1538('0x23')](handleError(_0x4a8827,null));};exports['setTags']=function(_0x3ce878,_0x58f9e4){if(_0x3ce878[_0x1538('0x37')]['id']){delete _0x3ce878[_0x1538('0x37')]['id'];}return db[_0x1538('0x24')]['findOne']({'where':{'id':_0x3ce878[_0x1538('0x26')]['id']}})[_0x1538('0x16')](handleEntityNotFound(_0x58f9e4,null))[_0x1538('0x16')](function(_0x51bf49){if(_0x51bf49){return _0x51bf49[_0x1538('0x88')](_0x3ce878[_0x1538('0x37')][_0x1538('0x89')]||[]);}return null;})[_0x1538('0x16')](respondWithResult(_0x58f9e4,null))[_0x1538('0x23')](handleError(_0x58f9e4,null));};exports['setAdditionalPhones']=function(_0x4a966f,_0x2129b3){var _0x1edcf0=[];_0x1edcf0[_0x1538('0x60')](addAdditionalPhones(_0x4a966f[_0x1538('0x37')]));Promise['all'](_0x1edcf0)['then'](function(){_0x1edcf0=[];_0x1edcf0['push'](deleteCmHopperPhones(_0x4a966f['body']['id']));_0x1edcf0[_0x1538('0x60')](addCmHopperPhones(_0x4a966f[_0x1538('0x37')]['id']));Promise['all'](_0x1edcf0)[_0x1538('0x16')](function(){return[0x1];})['then'](respondWithResult(_0x2129b3,null));});};function addAdditionalPhones(_0x4f04fa){var _0x1da275;return new Promise(function(_0x22dc50){return db['CmContactHasItem'][_0x1538('0x17')]({'where':{'CmContactId':_0x4f04fa['id']}})[_0x1538('0x16')](function(){db[_0x1538('0x6a')][_0x1538('0x20')]({'raw':!![],'attributes':['id',_0x1538('0x8a')]})[_0x1538('0x16')](function(_0x5c6985){var _0x41c4ee=[];for(var _0x2c1be8=0x0;_0x2c1be8<_0x4f04fa[_0x1538('0x8b')][_0x1538('0x29')];_0x2c1be8++){var _0x46d6eb=_0x4f04fa[_0x1538('0x8c')]?_[_0x1538('0x54')](_0x4f04fa['item_types'][_0x2c1be8])?'':_0x4f04fa[_0x1538('0x8c')][_0x2c1be8]:_0x4f04fa[_0x1538('0x8b')][_0x2c1be8][_0x1538('0x8d')]?_0x4f04fa[_0x1538('0x8b')][_0x2c1be8][_0x1538('0x8d')]:'';var _0x1e90ec=_['isNil'](_0x4f04fa[_0x1538('0x8b')][_0x2c1be8][_0x1538('0x8e')])?'':_0x4f04fa['items'][_0x2c1be8][_0x1538('0x8e')];var _0x5d3ded=_0x46d6eb+':'+_0x4f04fa['items'][_0x2c1be8][_0x1538('0x7a')]+'§'+_0x1e90ec;if(_[_0x1538('0x54')](_0x1da275))_0x1da275=_0x5d3ded;else _0x1da275+=';'+_0x5d3ded;var _0x7b092c=null;var _0x229935=null;if(_0x4f04fa['item_types']){if(!_[_0x1538('0x54')](_0x4f04fa[_0x1538('0x8c')][_0x2c1be8])){_0x229935=_[_0x1538('0x25')](_0x5c6985,function(_0x3fad17){return _0x3fad17['id']===_0x4f04fa[_0x1538('0x8c')][_0x2c1be8];});if(!_['isNil'](_0x229935)){_0x7b092c=_0x229935[_0x1538('0x8a')];}}}else{if(!_[_0x1538('0x54')](_0x4f04fa[_0x1538('0x8b')][_0x2c1be8])){_0x229935=_[_0x1538('0x25')](_0x5c6985,function(_0x5d634b){return _0x5d634b['id']===_0x4f04fa[_0x1538('0x8b')][_0x2c1be8][_0x1538('0x8d')];});if(!_[_0x1538('0x54')](_0x229935)){_0x7b092c=_0x2c1be8;}}}if(_[_0x1538('0x54')](_0x7b092c)){_0x7b092c=0x64;}_0x41c4ee['push'](addAdditionalPhone(_0x4f04fa['id'],_0x4f04fa[_0x1538('0x8b')][_0x2c1be8][_0x1538('0x7a')],_0x4f04fa[_0x1538('0x8c')]?_[_0x1538('0x54')](_0x4f04fa[_0x1538('0x8c')][_0x2c1be8])?null:_0x4f04fa[_0x1538('0x8c')][_0x2c1be8]:_0x4f04fa[_0x1538('0x8b')][_0x2c1be8]['ItemTypeId']?_0x4f04fa[_0x1538('0x8b')][_0x2c1be8]['ItemTypeId']:null,_0x7b092c,_0x1e90ec));}Promise[_0x1538('0x62')](_0x41c4ee)[_0x1538('0x16')](function(){db[_0x1538('0x24')][_0x1538('0x15')]({'AdditionalPhones':_0x1da275},{'where':{'id':_0x4f04fa['id']}})['then'](function(){_0x22dc50(0x1);});});});});});}function addAdditionalPhone(_0x44c27f,_0x39efd1,_0x8ea2f2,_0x12110a,_0x5d7b6a){return db[_0x1538('0x68')][_0x1538('0x25')]({'where':{'CmContactId':_0x44c27f,'item':_0x39efd1}})[_0x1538('0x16')](function(_0x330296){if(_0x330296)logger[_0x1538('0x32')](_0x1538('0x8f'),_0x330296);else{db[_0x1538('0x68')][_0x1538('0x41')]({'CmContactId':_0x44c27f,'item':_0x39efd1,'ItemTypeId':_0x8ea2f2,'OrderBy':_0x12110a,'ItemClass':_0x1538('0x90'),'description':_0x5d7b6a});}});}function deleteCmHopperPhones(_0x4534f6){return new Promise(function(_0x4de08a){return db[_0x1538('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4534f6}})['then'](function(_0x54f2bb){db[_0x1538('0x91')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x54f2bb,'id')}}});})[_0x1538('0x16')](function(){_0x4de08a(0x1);});});}function addCmHopperPhones(_0x148532){return new Promise(function(_0x3c7029){return db['CmHopper'][_0x1538('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x148532}})[_0x1538('0x16')](function(_0x51113f){var _0x114ac4=[];_[_0x1538('0x6e')](_0x51113f,function(_0x1cc217){_0x114ac4['push'](createCmHopperPhone(_0x148532,_0x1cc217['id']));});Promise['all'](_0x114ac4)[_0x1538('0x16')](function(){_0x3c7029(0x1);});});});}function createCmHopperPhone(_0x8b0b01,_0x2cbdb0){return new Promise(function(_0x2d0774){db[_0x1538('0x68')][_0x1538('0x20')]({'raw':!![],'attributes':[_0x1538('0x92'),_0x1538('0x8a')],'where':{'CmContactId':_0x8b0b01,'ItemClass':_0x1538('0x90')},'include':[{'model':db[_0x1538('0x6a')],'attributes':[_0x1538('0x8a')],'as':_0x1538('0x6b')}],'order':['OrderBy',db[_0x1538('0x6c')][_0x1538('0x93')](_0x1538('0x94'))]})[_0x1538('0x16')](function(_0x2e8726){var _0x603cce=0x1;var _0x50f7bf=_[_0x1538('0x6e')](_0x2e8726,function(_0x147050){_0x147050['CmHopperId']=_0x2cbdb0;_0x147050[_0x1538('0x7a')]=_0x147050[_0x1538('0x92')];_0x147050[_0x1538('0x8a')]=_0x603cce;delete _0x147050[_0x1538('0x95')];_0x603cce=_0x603cce+0x1;return _0x147050;});return db['CmHopperAdditionalPhone'][_0x1538('0x58')](_0x50f7bf,{});})['then'](function(){_0x2d0774(0x1);});});}function insertAdditionalPhones(_0x476b28,_0x2748d5){return new Promise(function(_0x1280e3){var _0x3cc17b=[];for(var _0x198409=0x0;_0x198409<_0x2748d5[_0x1538('0x29')];_0x198409++){var _0x4dd5c8=_0x2748d5[_0x198409];_0x3cc17b[_0x1538('0x60')](parseContactItemType(_0x4dd5c8));}Promise[_0x1538('0x62')](_0x3cc17b)['then'](function(){var _0x2996e6={'id':_0x476b28['id'],'items':_0x2748d5};return addAdditionalPhones(_0x2996e6)[_0x1538('0x16')](function(){return addCmHopperPhones(_0x476b28['id']);});})[_0x1538('0x16')](function(){_0x1280e3(_0x476b28);});});}function parseContactItemType(_0x3d15a9){return new Promise(function(_0x168836){if(_0x3d15a9[_0x1538('0x35')](_0x1538('0x8d'))){_0x168836(_0x3d15a9);}else{return db[_0x1538('0x6a')]['find']({'where':{'name':_0x3d15a9[_0x1538('0x6b')]}})[_0x1538('0x16')](function(_0x1c2811){if(_[_0x1538('0x54')](_0x1c2811))_0x3d15a9[_0x1538('0x8d')]=null;else _0x3d15a9[_0x1538('0x8d')]=_0x1c2811['id'];_0x168836(_0x3d15a9);});}});}exports[_0x1538('0x96')]=function(_0x4417a3,_0x204507){return db['CmContactHasItem'][_0x1538('0x20')]({'raw':!![],'where':{'CmContactId':_0x4417a3['params']['id'],'ItemClass':_0x1538('0x90')},'include':[{'model':db[_0x1538('0x6a')],'as':_0x1538('0x6b')}],'order':[[_0x1538('0x8a')],[db['sequelize']['literal'](_0x1538('0x94'))]]})[_0x1538('0x16')](function(_0x3f574c){return _0x3f574c;})[_0x1538('0x16')](respondWithResult(_0x204507,null))[_0x1538('0x23')](handleError(_0x204507,null));};exports[_0x1538('0x97')]=function(_0x2bb8c8,_0x1ca6cd){return db[_0x1538('0x68')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2bb8c8[_0x1538('0x37')][_0x1538('0x98')]}})[_0x1538('0x16')](function(_0x22516d){var _0x454bf0=_[_0x1538('0x6e')](_0x22516d,function(_0x168cc6){_0x168cc6[_0x1538('0x99')]=_0x2bb8c8[_0x1538('0x37')][_0x1538('0x9a')];return _0x168cc6;});return db[_0x1538('0x68')][_0x1538('0x58')](_0x454bf0,{});})[_0x1538('0x16')](function(){return addCmHopperPhones(_0x2bb8c8[_0x1538('0x37')][_0x1538('0x9a')]);})[_0x1538('0x16')](function(){return['ok'];})[_0x1538('0x16')](respondWithResult(_0x1ca6cd,null))[_0x1538('0x23')](handleError(_0x1ca6cd,null));};exports[_0x1538('0x9b')]=function(_0x2c90c2,_0xf2bd01){var _0x2e8b7e=[];_0x2e8b7e[_0x1538('0x60')](createCmHopperPhone(_0x2c90c2[_0x1538('0x37')]['id'],_0x2c90c2[_0x1538('0x37')]['hopperId']));Promise['all'](_0x2e8b7e)[_0x1538('0x16')](function(){return[0x1];})['then'](respondWithResult(_0xf2bd01,null));};exports['getHoppers']=function(_0x47ca94,_0x1fd0bb){var _0x529af5={'raw':![],'where':{}};var _0x1b876e={};var _0xe210a9={'count':0x0,'rows':[]};return db['CmContact'][_0x1538('0x7b')]({'where':{'id':_0x47ca94[_0x1538('0x26')]['id']}})[_0x1538('0x16')](handleEntityNotFound(_0x1fd0bb,null))[_0x1538('0x16')](function(_0x19b354){if(_0x19b354){_0x1b876e['model']=_[_0x1538('0x28')](db[_0x1538('0x3d')][_0x1538('0x7d')]);_0x1b876e['query']=_[_0x1538('0x28')](_0x47ca94['query']);_0x1b876e[_0x1538('0x7e')]=_[_0x1538('0x7f')](_0x1b876e[_0x1538('0x7c')],_0x1b876e['query']);_0x529af5['attributes']=_['intersection'](_0x1b876e['model'],qs[_0x1538('0x9c')](_0x47ca94[_0x1538('0x21')]['fields']));_0x529af5['attributes']=_0x529af5[_0x1538('0x80')]['length']?_0x529af5['attributes']:_0x1b876e[_0x1538('0x7c')];if(!_0x47ca94['query']['hasOwnProperty'](_0x1538('0x86'))){_0x529af5['limit']=qs[_0x1538('0x13')](_0x47ca94['query'][_0x1538('0x13')]);_0x529af5[_0x1538('0x11')]=qs[_0x1538('0x11')](_0x47ca94[_0x1538('0x21')][_0x1538('0x11')]);}_0x529af5[_0x1538('0x81')]=qs[_0x1538('0x82')](_0x47ca94[_0x1538('0x21')][_0x1538('0x82')]);_0x529af5[_0x1538('0x5b')]=qs[_0x1538('0x7e')](_[_0x1538('0x83')](_0x47ca94['query'],_0x1b876e['filters']));_0x529af5[_0x1538('0x5b')][_0x1538('0x9d')]=_0x19b354['id'];if(_0x47ca94[_0x1538('0x21')]['filter']){_0x529af5[_0x1538('0x5b')]=_['merge'](_0x529af5[_0x1538('0x5b')],{'$or':_[_0x1538('0x6e')](_0x529af5['attributes'],function(_0x1ccfd1){var _0x3896c5={};_0x3896c5[_0x1ccfd1]={'$like':'%'+_0x47ca94[_0x1538('0x21')][_0x1538('0x84')]+'%'};return _0x3896c5;})});}_0x529af5=_[_0x1538('0x36')]({},_0x529af5,_0x47ca94[_0x1538('0x85')]);return db[_0x1538('0x3d')][_0x1538('0x14')]({'where':_0x529af5[_0x1538('0x5b')]})[_0x1538('0x16')](function(_0x3d6528){_0xe210a9[_0x1538('0x14')]=_0x3d6528;if(_0x47ca94[_0x1538('0x21')][_0x1538('0x9e')]){_0x529af5[_0x1538('0x9f')]=[{'all':!![]}];}return db[_0x1538('0x3d')][_0x1538('0x20')](_0x529af5);})[_0x1538('0x16')](function(_0xad000a){_0xe210a9[_0x1538('0xa0')]=_0xad000a;return _0xe210a9;});}})[_0x1538('0x16')](respondWithFilteredResult(_0x1fd0bb,_0x529af5))[_0x1538('0x23')](handleError(_0x1fd0bb,null));};exports[_0x1538('0xa1')]=function(_0x1fffd4,_0x31f6ec){var _0x446f94={'raw':!![],'where':{}};var _0x19f976={};var _0x2c416d={'count':0x0,'rows':[]};return db['CmContact'][_0x1538('0x7b')]({'where':{'id':_0x1fffd4[_0x1538('0x26')]['id']}})[_0x1538('0x16')](handleEntityNotFound(_0x31f6ec,null))[_0x1538('0x16')](function(_0x353e7a){if(_0x353e7a){_0x19f976[_0x1538('0x7c')]=_[_0x1538('0x28')](db[_0x1538('0x4b')][_0x1538('0x7d')]);_0x19f976[_0x1538('0x21')]=_[_0x1538('0x28')](_0x1fffd4[_0x1538('0x21')]);_0x19f976[_0x1538('0x7e')]=_['intersection'](_0x19f976[_0x1538('0x7c')],_0x19f976[_0x1538('0x21')]);_0x446f94[_0x1538('0x80')]=_[_0x1538('0x7f')](_0x19f976[_0x1538('0x7c')],qs['fields'](_0x1fffd4['query'][_0x1538('0x9c')]));_0x446f94[_0x1538('0x80')]=_0x446f94['attributes']['length']?_0x446f94[_0x1538('0x80')]:_0x19f976[_0x1538('0x7c')];if(!_0x1fffd4[_0x1538('0x21')]['hasOwnProperty'](_0x1538('0x86'))){_0x446f94[_0x1538('0x13')]=qs[_0x1538('0x13')](_0x1fffd4[_0x1538('0x21')][_0x1538('0x13')]);_0x446f94[_0x1538('0x11')]=qs[_0x1538('0x11')](_0x1fffd4[_0x1538('0x21')][_0x1538('0x11')]);}_0x446f94[_0x1538('0x81')]=qs[_0x1538('0x82')](_0x1fffd4[_0x1538('0x21')]['sort']);_0x446f94[_0x1538('0x5b')]=qs[_0x1538('0x7e')](_[_0x1538('0x83')](_0x1fffd4[_0x1538('0x21')],_0x19f976[_0x1538('0x7e')]));_0x446f94[_0x1538('0x5b')][_0x1538('0x9d')]=_0x353e7a['id'];if(_0x1fffd4[_0x1538('0x21')][_0x1538('0x84')]){_0x446f94[_0x1538('0x5b')]=_[_0x1538('0x36')](_0x446f94[_0x1538('0x5b')],{'$or':_[_0x1538('0x6e')](_0x446f94[_0x1538('0x80')],function(_0x2be889){var _0x239030={};_0x239030[_0x2be889]={'$like':'%'+_0x1fffd4['query'][_0x1538('0x84')]+'%'};return _0x239030;})});}_0x446f94=_[_0x1538('0x36')]({},_0x446f94,_0x1fffd4[_0x1538('0x85')]);return db[_0x1538('0x4b')][_0x1538('0x14')]({'where':_0x446f94[_0x1538('0x5b')]})[_0x1538('0x16')](function(_0xadbd2f){_0x2c416d[_0x1538('0x14')]=_0xadbd2f;if(_0x1fffd4['query'][_0x1538('0x9e')]){_0x446f94[_0x1538('0x9f')]=[{'all':!![]}];}return db[_0x1538('0x4b')][_0x1538('0x20')](_0x446f94);})[_0x1538('0x16')](function(_0x3a2b1a){_0x2c416d[_0x1538('0xa0')]=_0x3a2b1a;return _0x2c416d;});}})['then'](respondWithFilteredResult(_0x31f6ec,_0x446f94))[_0x1538('0x23')](handleError(_0x31f6ec,null));};exports[_0x1538('0xa2')]=function(_0x46aad4,_0x3b581f){var _0x26f2a8={'raw':!![],'where':{}};var _0x2976e0={};var _0x42b671={'count':0x0,'rows':[]};return db[_0x1538('0x24')][_0x1538('0x7b')]({'where':{'id':_0x46aad4[_0x1538('0x26')]['id']}})['then'](handleEntityNotFound(_0x3b581f,null))[_0x1538('0x16')](function(_0x2f9f1e){if(_0x2f9f1e){_0x2976e0[_0x1538('0x7c')]=_[_0x1538('0x28')](db[_0x1538('0x4a')][_0x1538('0x7d')]);_0x2976e0[_0x1538('0x21')]=_[_0x1538('0x28')](_0x46aad4[_0x1538('0x21')]);_0x2976e0[_0x1538('0x7e')]=_[_0x1538('0x7f')](_0x2976e0[_0x1538('0x7c')],_0x2976e0[_0x1538('0x21')]);_0x26f2a8[_0x1538('0x80')]=_[_0x1538('0x7f')](_0x2976e0[_0x1538('0x7c')],qs[_0x1538('0x9c')](_0x46aad4[_0x1538('0x21')][_0x1538('0x9c')]));_0x26f2a8[_0x1538('0x80')]=_0x26f2a8[_0x1538('0x80')][_0x1538('0x29')]?_0x26f2a8[_0x1538('0x80')]:_0x2976e0[_0x1538('0x7c')];if(!_0x46aad4[_0x1538('0x21')][_0x1538('0x35')](_0x1538('0x86'))){_0x26f2a8[_0x1538('0x13')]=qs[_0x1538('0x13')](_0x46aad4[_0x1538('0x21')][_0x1538('0x13')]);_0x26f2a8['offset']=qs['offset'](_0x46aad4[_0x1538('0x21')][_0x1538('0x11')]);}_0x26f2a8[_0x1538('0x81')]=qs[_0x1538('0x82')](_0x46aad4['query']['sort']);_0x26f2a8['where']=qs[_0x1538('0x7e')](_[_0x1538('0x83')](_0x46aad4[_0x1538('0x21')],_0x2976e0['filters']));_0x26f2a8['where']['ContactId']=_0x2f9f1e['id'];if(_0x46aad4[_0x1538('0x21')][_0x1538('0x84')]){_0x26f2a8[_0x1538('0x5b')]=_[_0x1538('0x36')](_0x26f2a8['where'],{'$or':_[_0x1538('0x6e')](_0x26f2a8[_0x1538('0x80')],function(_0x8c994){var _0x2529ba={};_0x2529ba[_0x8c994]={'$like':'%'+_0x46aad4['query'][_0x1538('0x84')]+'%'};return _0x2529ba;})});}_0x26f2a8=_[_0x1538('0x36')]({},_0x26f2a8,_0x46aad4['options']);return db[_0x1538('0x4a')][_0x1538('0x14')]({'where':_0x26f2a8['where']})[_0x1538('0x16')](function(_0x2eb172){_0x42b671[_0x1538('0x14')]=_0x2eb172;if(_0x46aad4[_0x1538('0x21')]['includeAll']){_0x26f2a8[_0x1538('0x9f')]=[{'all':!![]}];}return db[_0x1538('0x4a')]['findAll'](_0x26f2a8);})[_0x1538('0x16')](function(_0x3055fd){_0x42b671[_0x1538('0xa0')]=_0x3055fd;return _0x42b671;});}})[_0x1538('0x16')](respondWithFilteredResult(_0x3b581f,_0x26f2a8))[_0x1538('0x23')](handleError(_0x3b581f,null));};exports[_0x1538('0xa3')]=function(_0x52c75e,_0x480958){var _0xb5fe15={'raw':!![],'where':{}};var _0xee5357={};var _0x1e0567={'count':0x0,'rows':[]};return db[_0x1538('0x24')][_0x1538('0x7b')]({'where':{'id':_0x52c75e[_0x1538('0x26')]['id']}})['then'](handleEntityNotFound(_0x480958,null))[_0x1538('0x16')](function(_0x2a4a59){if(_0x2a4a59){_0xee5357[_0x1538('0x7c')]=_[_0x1538('0x28')](db[_0x1538('0xa4')]['rawAttributes']);_0xee5357['query']=_['keys'](_0x52c75e[_0x1538('0x21')]);_0xee5357[_0x1538('0x7e')]=_[_0x1538('0x7f')](_0xee5357[_0x1538('0x7c')],_0xee5357[_0x1538('0x21')]);_0xb5fe15[_0x1538('0x80')]=_[_0x1538('0x7f')](_0xee5357['model'],qs[_0x1538('0x9c')](_0x52c75e[_0x1538('0x21')][_0x1538('0x9c')]));_0xb5fe15['attributes']=_0xb5fe15['attributes']['length']?_0xb5fe15['attributes']:_0xee5357[_0x1538('0x7c')];if(!_0x52c75e[_0x1538('0x21')]['hasOwnProperty'](_0x1538('0x86'))){_0xb5fe15[_0x1538('0x13')]=qs[_0x1538('0x13')](_0x52c75e['query'][_0x1538('0x13')]);_0xb5fe15[_0x1538('0x11')]=qs['offset'](_0x52c75e[_0x1538('0x21')]['offset']);}_0xb5fe15[_0x1538('0x81')]=qs[_0x1538('0x82')](_0x52c75e['query'][_0x1538('0x82')]);_0xb5fe15[_0x1538('0x5b')]=qs['filters'](_[_0x1538('0x83')](_0x52c75e['query'],_0xee5357[_0x1538('0x7e')]));_0xb5fe15[_0x1538('0x5b')][_0x1538('0x9d')]=_0x2a4a59['id'];if(_0x52c75e[_0x1538('0x21')][_0x1538('0x84')]){_0xb5fe15['where']=_[_0x1538('0x36')](_0xb5fe15[_0x1538('0x5b')],{'$or':_[_0x1538('0x6e')](_0xb5fe15['attributes'],function(_0x15d693){var _0x18eeb1={};_0x18eeb1[_0x15d693]={'$like':'%'+_0x52c75e[_0x1538('0x21')][_0x1538('0x84')]+'%'};return _0x18eeb1;})});}_0xb5fe15=_[_0x1538('0x36')]({},_0xb5fe15,_0x52c75e[_0x1538('0x85')]);return db['JscriptySessionReport'][_0x1538('0x14')]({'where':_0xb5fe15[_0x1538('0x5b')]})[_0x1538('0x16')](function(_0x20f3bf){_0x1e0567['count']=_0x20f3bf;if(_0x52c75e[_0x1538('0x21')][_0x1538('0x9e')]){_0xb5fe15['include']=[{'all':!![]}];}return db[_0x1538('0xa4')][_0x1538('0x20')](_0xb5fe15);})[_0x1538('0x16')](function(_0x1768b0){_0x1e0567[_0x1538('0xa0')]=_0x1768b0;return _0x1e0567;});}})[_0x1538('0x16')](respondWithFilteredResult(_0x480958,_0xb5fe15))[_0x1538('0x23')](handleError(_0x480958,null));};exports[_0x1538('0xa5')]=function(_0x1245bd,_0x3199b8){try{if(!_0x1245bd[_0x1538('0x37')]['ListId']){throw new Error(_0x1538('0xa6'));}if(!_0x1245bd[_0x1538('0x37')][_0x1538('0xa7')]){throw new Error(_0x1538('0xa8'));}if(!_0x1245bd[_0x1538('0x37')][_0x1538('0xa9')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x1245bd[_0x1538('0x37')][_0x1538('0xaa')]){throw new Error(_0x1538('0xab'));}var _0x2551a3=_0x1245bd[_0x1538('0x37')][_0x1538('0xa7')][_0x1538('0xac')](',');var _0x30e65d=_0x1245bd[_0x1538('0x37')][_0x1538('0xa9')][_0x1538('0xac')](',');if(!_0x2551a3[_0x1538('0x29')]||!_0x30e65d[_0x1538('0x29')]||_0x2551a3[_0x1538('0x29')]!==_0x30e65d[_0x1538('0x29')]){throw new Error(_0x1538('0xad'));}_0x1245bd[_0x1538('0x37')][_0x1538('0x9c')]=_[_0x1538('0xae')](_0x2551a3,_0x30e65d);if(!_0x1245bd['body'][_0x1538('0x9c')][_0x1538('0x7a')]){throw new Error(_0x1538('0xaf'));}if(!_0x1245bd[_0x1538('0x37')][_0x1538('0x9c')][_0x1538('0xb0')]){throw new Error(_0x1538('0xb1'));}var _0xf12074=path['join'](config[_0x1538('0xb2')],_0x1538('0xb3'),_0x1245bd[_0x1538('0xb4')][_0x1538('0xb5')]);fs['chmodSync'](_0xf12074,parseInt('0777',0x8));var _0xc7539a=require(_0x1538('0xb6'))[_0x1538('0xb7')](path[_0x1538('0x3c')](__dirname,'../../components/import/cm/csv'),[_0xf12074,_0x1245bd[_0x1538('0x37')][_0x1538('0xa7')],_0x1245bd[_0x1538('0x37')][_0x1538('0xa9')],_0x1245bd[_0x1538('0x37')][_0x1538('0x5d')],_0x1245bd[_0x1538('0x37')]['CompanyId'],_0x1245bd[_0x1538('0x37')][_0x1538('0x5a')],_0x1245bd['body'][_0x1538('0xaa')]]);return _0x3199b8[_0x1538('0xf')](0xc8)[_0x1538('0x10')]({'message':_0x1538('0xb8'),'pid':_0xc7539a[_0x1538('0xb9')]});}catch(_0x486569){return _0x3199b8[_0x1538('0xf')](0x1f4)[_0x1538('0x1c')](_0x486569);}};exports[_0x1538('0xba')]=function(_0x28cf57,_0x4164e2){var _0x81a6a8=fs['createReadStream'](_0x28cf57[_0x1538('0xb4')][_0x1538('0x3')]);Papa[_0x1538('0xbb')](_0x81a6a8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x50538b){return _0x4164e2[_0x1538('0xf')](0xc8)[_0x1538('0x10')]({'file':_0x28cf57[_0x1538('0xb4')],'fields':_0x50538b['meta']['fields']});}});};exports[_0x1538('0xbc')]=function(_0x51a3e5,_0x191d61){return db[_0x1538('0xbd')][_0x1538('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1538('0xbe')}})['then'](function(_0xac040c){var _0x323284=![];if(!_0x51a3e5[_0x1538('0x37')]['ListId']){throw new Error(_0x1538('0xa6'));}if(!_0x51a3e5[_0x1538('0x37')][_0x1538('0xbf')][_0x1538('0x7a')]){throw new Error(_0x1538('0xaf'));}if(!_0x51a3e5['body'][_0x1538('0xbf')][_0x1538('0xb0')]){throw new Error(_0x1538('0xb1'));}if(!_0x51a3e5[_0x1538('0x37')][_0x1538('0xaa')]){throw new Error(_0x1538('0xab'));}var _0x36d833=require(_0x1538('0xb6'))['fork'](path[_0x1538('0x3c')](__dirname,_0x1538('0xc0')),[_0x51a3e5[_0x1538('0x26')]['id'],JSON['stringify'](_0x51a3e5[_0x1538('0x37')]),JSON[_0x1538('0xc1')](_0xac040c)]);_0x36d833['on'](_0x1538('0xc2'),function(){_0x323284=!![];return _0x191d61[_0x1538('0xf')](0xc8)[_0x1538('0x10')]({'message':_0x1538('0xc3'),'pid':_0x36d833[_0x1538('0xb9')]});});_0x36d833['on'](_0x1538('0xc4'),function(_0x4efce8){if(_0x4efce8&&!_0x323284){return _0x191d61[_0x1538('0xf')](0x1f4)[_0x1538('0x10')]({'message':'error\x20child\x20process','pid':_0x36d833['pid']});}});})['catch'](handleError(_0x191d61,null));};exports['importUpdates']=function(_0x33b0fc,_0x16eaa9){return db['User'][_0x1538('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1538('0xbe')}})['then'](function(_0x2881a9){var _0x571f6e=![];if(!_0x33b0fc[_0x1538('0x37')][_0x1538('0x5d')]){throw new Error(_0x1538('0xa6'));}if(!_0x33b0fc[_0x1538('0x37')][_0x1538('0xbf')][_0x1538('0x7a')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x33b0fc[_0x1538('0x37')][_0x1538('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x33b0fc[_0x1538('0x37')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5b4e7f=require(_0x1538('0xb6'))[_0x1538('0xb7')](path[_0x1538('0x3c')](__dirname,_0x1538('0xc5')),[_0x33b0fc[_0x1538('0x26')]['id'],JSON[_0x1538('0xc1')](_0x33b0fc[_0x1538('0x37')]),JSON[_0x1538('0xc1')](_0x2881a9)]);_0x5b4e7f['on']('message',function(){_0x571f6e=!![];return _0x16eaa9['status'](0xc8)[_0x1538('0x10')]({'message':_0x1538('0xc3'),'pid':_0x5b4e7f[_0x1538('0xb9')]});});_0x5b4e7f['on'](_0x1538('0xc4'),function(_0x4da5d6){if(_0x4da5d6&&!_0x571f6e){return _0x16eaa9[_0x1538('0xf')](0x1f4)[_0x1538('0x10')]({'message':'error\x20child\x20process','pid':_0x5b4e7f[_0x1538('0xb9')]});}});})['catch'](handleError(_0x16eaa9,null));};exports[_0x1538('0xc6')]=function(_0x346215,_0x186132){var _0xda17c0=['mail',_0x1538('0xc7'),_0x1538('0xc8'),_0x1538('0xc9'),_0x1538('0xca'),_0x1538('0xcb'),_0x1538('0xcc')];var _0x3a6a30={'offset':0x0,'order':qs[_0x1538('0x82')]('-createdAt')},_0x31ebd5={'count':0x0,'rows':[]};Promise[_0x1538('0xcd')]()[_0x1538('0x16')](function(){if(_0x346215[_0x1538('0x21')][_0x1538('0xce')]){if(!_['includes'](_0xda17c0,_0x346215[_0x1538('0x21')]['channel'][_0x1538('0xcf')]())){throw new Error(_0x1538('0xd0'));}_0xda17c0=[_0x346215[_0x1538('0x21')]['channel'][_0x1538('0xcf')]()];}if(_0x346215[_0x1538('0x21')]['range']){try{var _0x464592=JSON[_0x1538('0xbb')](_0x346215[_0x1538('0x21')]['range']);if(!moment(_0x464592[_0x1538('0x38')])[_0x1538('0xd1')]()){throw new Error(_0x1538('0xd2'));}if(!moment(_0x464592['to'])[_0x1538('0xd1')]()){throw new Error(_0x1538('0xd3'));}}catch(_0x3b3cd5){throw new Error(_0x1538('0xd4'));}}if(!_0x346215[_0x1538('0x21')][_0x1538('0x35')](_0x1538('0x86'))){_0x3a6a30['limit']=qs[_0x1538('0x13')](_0x346215['query'][_0x1538('0x13')]||0xa);_0x3a6a30[_0x1538('0x11')]=qs[_0x1538('0x11')](_0x346215[_0x1538('0x21')][_0x1538('0x11')]);}var _0x1ab0af=_0xda17c0['map'](function(_0x31440d){if(_0x31440d===_0x1538('0xcc')){var _0x1932c8={'attributes':['id',_0x1538('0xd5'),'type','source',_0x1538('0xd6'),'callerid',_0x1538('0xd7'),_0x1538('0xd8'),'duration',_0x1538('0xd9'),'createdAt',_0x1538('0xda'),_0x1538('0xdb'),_0x1538('0xdc'),'UserId'],'where':{'ContactId':_0x346215[_0x1538('0x26')]['id']},'include':[{'model':db[_0x1538('0xbd')],'as':_0x1538('0xbd'),'attributes':['id',_0x1538('0x1b'),_0x1538('0xdd'),_0x1538('0x2f')]}],'order':[['createdAt',_0x1538('0xde')]]};if(_0x346215[_0x1538('0x21')][_0x1538('0xdf')]){_0x1932c8[_0x1538('0x5b')][_0x1538('0xe0')]={'$gte':_0x464592[_0x1538('0x38')],'$lte':_0x464592['to']};}return db[_0x1538('0x4d')][_0x1538('0xe1')](_0x1932c8)[_0x1538('0x16')](function(_0x1b8858){_0x31ebd5[_0x1538('0x14')]+=_0x1b8858[_0x1538('0x14')];return _[_0x1538('0x6e')](_0x1b8858[_0x1538('0xa0')],function(_0x3639b4){var _0x22e68e=_0x3639b4[_0x1538('0x39')]({'plain':!![]});_0x22e68e[_0x1538('0xce')]=_0x31440d;if(_0x22e68e[_0x1538('0xbd')]){_0x22e68e[_0x1538('0xbd')]={'id':_0x22e68e[_0x1538('0xbd')]['id'],'name':_0x22e68e[_0x1538('0xbd')][_0x1538('0x1b')],'fullname':_0x22e68e['User'][_0x1538('0xdd')],'alias':_0x22e68e[_0x1538('0xbd')][_0x1538('0x2f')]};}return _0x22e68e;});});}else{var _0x5a1136=_[_0x1538('0xe2')](_0x31440d)+(_0x31440d===_0x1538('0xc7')?_0x1538('0xe3'):'Account');var _0x14bfd9={'attributes':['id','closed','closedAt',_0x1538('0xe0'),'note',_0x1538('0xe4'),'secondDisposition','thirdDisposition',_0x1538('0xe5'),_0x5a1136+'Id'],'where':{'ContactId':_0x346215[_0x1538('0x26')]['id']},'include':[{'model':db[_0x5a1136],'as':_0x1538('0xe6'),'attributes':['id','name','key']},{'model':db[_0x1538('0xbd')],'as':_0x1538('0xe7'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':_0x1538('0x65'),'attributes':['id',_0x1538('0x1b'),_0x1538('0x66')],'through':{'attributes':[]}}],'order':[['createdAt',_0x1538('0xde')]]};if(_0x346215[_0x1538('0x21')][_0x1538('0xdf')]){_0x14bfd9[_0x1538('0x5b')]['createdAt']={'$gte':_0x464592[_0x1538('0x38')],'$lte':_0x464592['to']};}switch(_0x31440d){case'chat':_0x14bfd9[_0x1538('0x80')][_0x1538('0x60')](_0x1538('0xe8'),'customerIp',_0x1538('0xe9'),'deviceModel',_0x1538('0xea'),_0x1538('0xeb'),_0x1538('0xec'),_0x1538('0xed'),_0x1538('0xee'));break;case _0x1538('0xef'):_0x14bfd9[_0x1538('0x80')][_0x1538('0x60')](_0x1538('0xf0'),_0x1538('0xf1'));break;case _0x1538('0xc9'):_0x14bfd9['attributes'][_0x1538('0x60')]('externalUrl',_0x1538('0xf2'));break;}return db[_[_0x1538('0xe2')](_0x31440d)+'Interaction'][_0x1538('0xe1')](_0x14bfd9)[_0x1538('0x16')](function(_0x3129fa){_0x31ebd5[_0x1538('0x14')]+=_0x3129fa[_0x1538('0x14')];return _[_0x1538('0x6e')](_0x3129fa[_0x1538('0xa0')],function(_0x21248c){var _0x519b83=_0x21248c['get']({'plain':!![]});_0x519b83[_0x1538('0xce')]=_0x31440d;if(_0x519b83[_0x1538('0xe7')]){_0x519b83['Owner']={'id':_0x519b83['Owner']['id'],'name':_0x519b83[_0x1538('0xe7')][_0x1538('0x1b')],'fullname':_0x519b83['Owner'][_0x1538('0xdd')]};}return _0x519b83;});});}});return Promise[_0x1538('0x62')](_0x1ab0af);})['then'](function(_0x30bb91){return _(_0x30bb91)[_0x1538('0xf3')]()[_0x1538('0xf4')]('createdAt')[_0x1538('0xf5')]()['value']();})[_0x1538('0x16')](function(_0x45e23c){_0x31ebd5[_0x1538('0xa0')]=_0x3a6a30[_0x1538('0x13')]?_0x45e23c[_0x1538('0xf6')](_0x3a6a30[_0x1538('0x11')],_0x3a6a30[_0x1538('0x11')]+_0x3a6a30[_0x1538('0x13')]):_0x45e23c;return _0x31ebd5;})[_0x1538('0x16')](respondWithFilteredResult(_0x186132,_0x3a6a30))[_0x1538('0x23')](handleError(_0x186132,null));}; \ No newline at end of file +var _0xc8f1=['order','sort','pick','filter','merge','options','setTags','setAdditionalPhones','OrderBy','items','item_types','description','ItemTypeId','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','nolimit','ContactId','includeAll','include','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','agent','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','sms','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','chat','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','customerPort','deviceModel','ratingMessage','ratingValue','referer','mail','subject','externalUrl','threadId','Interaction','sortBy','reverse','value','util','path','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','user','CmContact','find','params','catch','tags','keys','length','cf_','displayName','query','analytics','columnName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','body','from','get','mergeWith','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','ListId','findOrCreate','spread','push','contact','all','show','Tag','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','CmCustomField','omit','format','cf_%d','pickBy','map','cm_contacts','id\x20=\x20?','sequelize','text','phone','getTags','findOne','filters','model','attributes','intersection','fields'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xc8f1,0x183));var _0x1c8f=function(_0x497d6e,_0x51b011){_0x497d6e=_0x497d6e-0x0;var _0x50347b=_0xc8f1[_0x497d6e];return _0x50347b;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1c8f('0x0'));var path=require(_0x1c8f('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0x1c8f('0x2'));var Redis=require(_0x1c8f('0x3'));var contacts=require(_0x1c8f('0x4'));var qs=require(_0x1c8f('0x5'));var logger=require(_0x1c8f('0x6'))(_0x1c8f('0x7'));var config=require(_0x1c8f('0x8'));var shared=require(_0x1c8f('0x9'));var db=require(_0x1c8f('0xa'))['db'];config[_0x1c8f('0xb')]=_[_0x1c8f('0xc')](config[_0x1c8f('0xb')],{'host':_0x1c8f('0xd'),'port':0x18eb});var socket=require(_0x1c8f('0xe'))(new Redis(config[_0x1c8f('0xb')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x18db32,_0x3d8844){_0x3d8844=_0x3d8844||0xc8;return function(_0x591408){if(_0x591408){return _0x18db32[_0x1c8f('0xf')](_0x3d8844)[_0x1c8f('0x10')](_0x591408);}};}function respondWithFilteredResult(_0xa75ca7,_0x5410f1){return function(_0x168225){if(_0x168225){var _0x2a726a=typeof _0x5410f1[_0x1c8f('0x11')]==='undefined'&&typeof _0x5410f1[_0x1c8f('0x12')]===_0x1c8f('0x13');var _0xfdbf38=_0x168225[_0x1c8f('0x14')];var _0x5b60f2=_0x2a726a?0x0:_0x5410f1[_0x1c8f('0x11')];var _0x1f59a5=_0x2a726a?_0x168225['count']:_0x5410f1[_0x1c8f('0x11')]+_0x5410f1[_0x1c8f('0x12')];var _0x3c1981;if(_0x1f59a5>=_0xfdbf38){_0x1f59a5=_0xfdbf38;_0x3c1981=0xc8;}else{_0x3c1981=0xce;}_0xa75ca7[_0x1c8f('0xf')](_0x3c1981);return _0xa75ca7[_0x1c8f('0x15')](_0x1c8f('0x16'),_0x5b60f2+'-'+_0x1f59a5+'/'+_0xfdbf38)[_0x1c8f('0x10')](_0x168225);}return null;};}function saveUpdates(_0x4846c5){return function(_0x17fb1d){if(_0x17fb1d){return _0x17fb1d[_0x1c8f('0x17')](_0x4846c5)[_0x1c8f('0x18')](function(_0x4a6f8a){return _0x4a6f8a;});}return null;};}function removeEntity(_0x4a3950){return function(_0x4aad59){if(_0x4aad59){return _0x4aad59[_0x1c8f('0x19')]()[_0x1c8f('0x18')](function(){_0x4a3950[_0x1c8f('0xf')](0xcc)[_0x1c8f('0x1a')]();});}};}function handleEntityNotFound(_0x3727e5){return function(_0x276e19){if(!_0x276e19){_0x3727e5[_0x1c8f('0x1b')](0x194);}return _0x276e19;};}function handleError(_0x5f2895,_0x98b41b){_0x98b41b=_0x98b41b||0x1f4;return function(_0x2b66a2){logger[_0x1c8f('0x1c')](_0x2b66a2[_0x1c8f('0x1d')]);if(_0x2b66a2[_0x1c8f('0x1e')]){delete _0x2b66a2[_0x1c8f('0x1e')];}_0x5f2895[_0x1c8f('0xf')](_0x98b41b)[_0x1c8f('0x1f')](_0x2b66a2);};}exports[_0x1c8f('0x20')]=function(_0x3d31a6,_0x153b66){var _0x268a61={};return contacts[_0x1c8f('0x21')]()[_0x1c8f('0x18')](function(_0x3ee218){_0x268a61=qs[_0x1c8f('0x22')](_0x3ee218,_0x3d31a6);return contacts[_0x1c8f('0x23')](_0x3d31a6['query'],_0x3d31a6[_0x1c8f('0x24')],_0x268a61,_0x3ee218);})[_0x1c8f('0x18')](respondWithFilteredResult(_0x153b66,_0x268a61))['catch'](handleError(_0x153b66,null));};exports[_0x1c8f('0x19')]=function(_0xc0194b,_0x479b4c){return db[_0x1c8f('0x25')][_0x1c8f('0x26')]({'where':{'id':_0xc0194b[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x479b4c,null))[_0x1c8f('0x18')](removeEntity(_0x479b4c,null))[_0x1c8f('0x28')](handleError(_0x479b4c,null));};exports[_0x1c8f('0x21')]=function(_0xa05d7a,_0x1a4fc5){return db[_0x1c8f('0x25')][_0x1c8f('0x21')]()[_0x1c8f('0x18')](function(_0x27491d){delete _0x27491d[_0x1c8f('0x29')];for(var _0x3d8cf8=0x0;_0x3d8cf80x0){return new Promise(function(_0x1f3c78){var _0x29eabc=[];for(var _0x3ed12b=0x0;_0x3ed12b<_0x244d29[_0x1c8f('0x2b')];_0x3ed12b++){_0x29eabc[_0x1c8f('0x61')](insertAdditionalPhones(_0x244d29[_0x3ed12b][_0x1c8f('0x62')],_0x244d29[_0x3ed12b][_0x1c8f('0x59')]));}Promise[_0x1c8f('0x63')](_0x29eabc)[_0x1c8f('0x18')](function(){_0x1f3c78(0x1);});})[_0x1c8f('0x18')](function(){return{'success':_0x2a6315,'failure':_0x283f0b,'duplicates':_0x3c9851};});}else{return{'success':_0x2a6315,'failure':_0x283f0b,'duplicates':_0x3c9851};}}})[_0x1c8f('0x18')](respondWithResult(_0x34d4e7,0xc9))[_0x1c8f('0x28')](handleError(_0x34d4e7,null));};exports[_0x1c8f('0x64')]=function(_0x53b602,_0x59d388){var _0x4a70e4;return db[_0x1c8f('0x25')][_0x1c8f('0x21')]()[_0x1c8f('0x18')](function(_0x4d8ce1){return db[_0x1c8f('0x25')][_0x1c8f('0x26')]({'where':{'id':_0x53b602['params']['id']},'include':[{'model':db[_0x1c8f('0x65')],'as':'Tags','attributes':['id',_0x1c8f('0x1e'),_0x1c8f('0x66')],'required':_0x53b602[_0x1c8f('0x2e')][_0x1c8f('0x67')]?!![]:![]},{'model':db[_0x1c8f('0x68')],'as':_0x1c8f('0x69'),'where':{'CmContactId':_0x53b602[_0x1c8f('0x27')]['id']},'required':![],'include':[{'model':db[_0x1c8f('0x6a')],'as':_0x1c8f('0x6b')}]}],'order':[db['sequelize'][_0x1c8f('0x6c')](_0x1c8f('0x6d'))],'attributes':_['keys'](_0x4d8ce1)});})[_0x1c8f('0x18')](function(_0x4e6f69){if(!_[_0x1c8f('0x55')](_0x4e6f69)){_0x4a70e4=_0x4e6f69[_0x1c8f('0x3a')]({'plain':!![]});var _0x36f41d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4e6f69&&_0x4e6f69['ListId']){if(_0x4e6f69['ListId']){_0x36f41d[_0x1c8f('0x5d')][_0x1c8f('0x6e')]['push']({'ListId':{'$ne':_0x4e6f69[_0x1c8f('0x5e')]}});}}return db[_0x1c8f('0x6f')]['findAll'](_0x36f41d);}})[_0x1c8f('0x18')](function(_0x4fde0f){if(!_[_0x1c8f('0x55')](_0x4fde0f)){return _[_0x1c8f('0x70')](_0x4a70e4,_['map'](_0x4fde0f,function(_0x5c13b1){return util[_0x1c8f('0x71')](_0x1c8f('0x72'),_0x5c13b1['id']);}));}})['then'](handleEntityNotFound(_0x59d388,null))[_0x1c8f('0x18')](respondWithResult(_0x59d388,null))[_0x1c8f('0x28')](handleError(_0x59d388,null));};exports['update']=function(_0x1487cc,_0x297379){var _0x3c2289;if(_0x1487cc[_0x1c8f('0x38')]['id']){delete _0x1487cc[_0x1c8f('0x38')]['id'];}if(!_[_0x1c8f('0x55')](_0x1487cc[_0x1c8f('0x38')][_0x1c8f('0x56')])){var _0x26c623=_0x1487cc[_0x1c8f('0x38')][_0x1c8f('0x56')];if(!_['isNil'](shared[_0x1c8f('0x57')][_0x26c623]))_0x1487cc['body'][_0x1c8f('0x58')]=shared[_0x1c8f('0x57')][_0x26c623][_0x1c8f('0x58')];}return db[_0x1c8f('0x25')][_0x1c8f('0x26')]({'where':{'id':_0x1487cc[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x297379,null))['then'](saveUpdates(_0x1487cc['body'],null))[_0x1c8f('0x18')](function(_0x49a06c){_0x3c2289=_0x49a06c;var _0x11a193={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x49a06c&&_0x49a06c[_0x1c8f('0x5e')]){if(_0x49a06c['ListId']){_0x11a193['where'][_0x1c8f('0x6e')][_0x1c8f('0x61')]({'ListId':{'$ne':_0x49a06c[_0x1c8f('0x5e')]}});}}return db['CmCustomField']['findAll'](_0x11a193);})[_0x1c8f('0x18')](function(_0x2a1ec0){if(_0x2a1ec0){return _[_0x1c8f('0x70')](_[_0x1c8f('0x73')](_0x1487cc[_0x1c8f('0x38')],function(_0x25cf7a,_0x337868){return _['startsWith'](_0x337868,_0x1c8f('0x2c'));}),_[_0x1c8f('0x74')](_0x2a1ec0,function(_0x3bd0a0){return util[_0x1c8f('0x71')](_0x1c8f('0x72'),_0x3bd0a0['id']);}));}})[_0x1c8f('0x18')](function(_0x4ff19a){if(_0x4ff19a&&!_['isEmpty'](_0x4ff19a)){var _0x28cf53=squel[_0x1c8f('0x17')]()['table'](_0x1c8f('0x75'))['setFields'](_0x4ff19a)[_0x1c8f('0x5d')](_0x1c8f('0x76'),_0x1487cc['params']['id'])['toParam']();return db[_0x1c8f('0x77')][_0x1c8f('0x2e')](_0x28cf53[_0x1c8f('0x78')],{'replacements':_0x28cf53[_0x1c8f('0x34')]});}})[_0x1c8f('0x18')](function(){if(_0x1487cc['body'][_0x1c8f('0x79')]&&_0x3c2289){return db['CmHopper'][_0x1c8f('0x17')]({'phone':_0x1487cc[_0x1c8f('0x38')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x3c2289['id']}});}})[_0x1c8f('0x18')](function(){return _0x3c2289;})[_0x1c8f('0x18')](respondWithResult(_0x297379,null))[_0x1c8f('0x28')](handleError(_0x297379,null));};exports[_0x1c8f('0x7a')]=function(_0x44c51e,_0x1288b4){var _0x20b5c9={};var _0x414bc4={};var _0x3fb43a;var _0x4a63db;return db[_0x1c8f('0x25')][_0x1c8f('0x7b')]({'where':{'id':_0x44c51e[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x1288b4,null))['then'](function(_0x52cf79){if(_0x52cf79){_0x3fb43a=_0x52cf79;_0x414bc4['model']=_[_0x1c8f('0x2a')](db[_0x1c8f('0x65')]['rawAttributes']);_0x414bc4[_0x1c8f('0x2e')]=_['keys'](_0x44c51e[_0x1c8f('0x2e')]);_0x414bc4[_0x1c8f('0x7c')]=_['intersection'](_0x414bc4[_0x1c8f('0x7d')],_0x414bc4[_0x1c8f('0x2e')]);_0x20b5c9[_0x1c8f('0x7e')]=_[_0x1c8f('0x7f')](_0x414bc4[_0x1c8f('0x7d')],qs[_0x1c8f('0x80')](_0x44c51e['query']['fields']));_0x20b5c9[_0x1c8f('0x7e')]=_0x20b5c9[_0x1c8f('0x7e')]['length']?_0x20b5c9[_0x1c8f('0x7e')]:_0x414bc4[_0x1c8f('0x7d')];_0x20b5c9[_0x1c8f('0x81')]=qs[_0x1c8f('0x82')](_0x44c51e[_0x1c8f('0x2e')]['sort']);_0x20b5c9[_0x1c8f('0x5d')]=qs[_0x1c8f('0x7c')](_[_0x1c8f('0x83')](_0x44c51e['query'],_0x414bc4[_0x1c8f('0x7c')]));if(_0x44c51e['query'][_0x1c8f('0x84')]){_0x20b5c9[_0x1c8f('0x5d')]=_[_0x1c8f('0x85')](_0x20b5c9[_0x1c8f('0x5d')],{'$or':_[_0x1c8f('0x74')](_0x20b5c9[_0x1c8f('0x7e')],function(_0x41fa21){var _0x2a8555={};_0x2a8555[_0x41fa21]={'$like':'%'+_0x44c51e[_0x1c8f('0x2e')][_0x1c8f('0x84')]+'%'};return _0x2a8555;})});}_0x20b5c9=_[_0x1c8f('0x85')]({},_0x20b5c9,_0x44c51e[_0x1c8f('0x86')]);return _0x3fb43a['getTags'](_0x20b5c9);}})['then'](function(_0x3035b0){if(_0x3035b0){_0x4a63db=_0x3035b0['length'];if(!_0x44c51e['query'][_0x1c8f('0x37')]('nolimit')){_0x20b5c9[_0x1c8f('0x12')]=qs['limit'](_0x44c51e[_0x1c8f('0x2e')]['limit']);_0x20b5c9[_0x1c8f('0x11')]=qs[_0x1c8f('0x11')](_0x44c51e[_0x1c8f('0x2e')][_0x1c8f('0x11')]);}return _0x3fb43a[_0x1c8f('0x7a')](_0x20b5c9);}})[_0x1c8f('0x18')](function(_0x5c4f62){if(_0x5c4f62){return _0x5c4f62?{'count':_0x4a63db,'rows':_0x5c4f62}:null;}})[_0x1c8f('0x18')](respondWithResult(_0x1288b4,null))[_0x1c8f('0x28')](handleError(_0x1288b4,null));};exports['setTags']=function(_0x5f0b79,_0x2c5726){if(_0x5f0b79[_0x1c8f('0x38')]['id']){delete _0x5f0b79[_0x1c8f('0x38')]['id'];}return db[_0x1c8f('0x25')][_0x1c8f('0x7b')]({'where':{'id':_0x5f0b79[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x2c5726,null))['then'](function(_0x35ea0a){if(_0x35ea0a){return _0x35ea0a[_0x1c8f('0x87')](_0x5f0b79['body']['ids']||[]);}return null;})[_0x1c8f('0x18')](respondWithResult(_0x2c5726,null))['catch'](handleError(_0x2c5726,null));};exports[_0x1c8f('0x88')]=function(_0x49c002,_0x4beb00){var _0x2daf12=[];_0x2daf12['push'](addAdditionalPhones(_0x49c002[_0x1c8f('0x38')]));Promise[_0x1c8f('0x63')](_0x2daf12)['then'](function(){_0x2daf12=[];_0x2daf12[_0x1c8f('0x61')](deleteCmHopperPhones(_0x49c002[_0x1c8f('0x38')]['id']));_0x2daf12[_0x1c8f('0x61')](addCmHopperPhones(_0x49c002['body']['id']));Promise[_0x1c8f('0x63')](_0x2daf12)[_0x1c8f('0x18')](function(){return[0x1];})[_0x1c8f('0x18')](respondWithResult(_0x4beb00,null));});};function addAdditionalPhones(_0x30fa40){var _0x442dcc;return new Promise(function(_0x2fbef3){return db[_0x1c8f('0x68')][_0x1c8f('0x19')]({'where':{'CmContactId':_0x30fa40['id']}})[_0x1c8f('0x18')](function(){db[_0x1c8f('0x6a')][_0x1c8f('0x23')]({'raw':!![],'attributes':['id',_0x1c8f('0x89')]})['then'](function(_0x5bfa58){var _0xfb685f=[];for(var _0x42aca6=0x0;_0x42aca6<_0x30fa40[_0x1c8f('0x8a')]['length'];_0x42aca6++){var _0x16068f=_0x30fa40[_0x1c8f('0x8b')]?_['isNil'](_0x30fa40[_0x1c8f('0x8b')][_0x42aca6])?'':_0x30fa40['item_types'][_0x42aca6]:_0x30fa40['items'][_0x42aca6]['ItemTypeId']?_0x30fa40[_0x1c8f('0x8a')][_0x42aca6]['ItemTypeId']:'';var _0x43dda9=_[_0x1c8f('0x55')](_0x30fa40[_0x1c8f('0x8a')][_0x42aca6]['description'])?'':_0x30fa40[_0x1c8f('0x8a')][_0x42aca6][_0x1c8f('0x8c')];var _0x3fcb3b=_0x16068f+':'+_0x30fa40[_0x1c8f('0x8a')][_0x42aca6][_0x1c8f('0x79')]+'§'+_0x43dda9;if(_['isNil'](_0x442dcc))_0x442dcc=_0x3fcb3b;else _0x442dcc+=';'+_0x3fcb3b;var _0x3a7368=null;var _0x5692fd=null;if(_0x30fa40[_0x1c8f('0x8b')]){if(!_[_0x1c8f('0x55')](_0x30fa40['item_types'][_0x42aca6])){_0x5692fd=_[_0x1c8f('0x26')](_0x5bfa58,function(_0x31ccf0){return _0x31ccf0['id']===_0x30fa40[_0x1c8f('0x8b')][_0x42aca6];});if(!_[_0x1c8f('0x55')](_0x5692fd)){_0x3a7368=_0x5692fd[_0x1c8f('0x89')];}}}else{if(!_[_0x1c8f('0x55')](_0x30fa40[_0x1c8f('0x8a')][_0x42aca6])){_0x5692fd=_[_0x1c8f('0x26')](_0x5bfa58,function(_0x19bed6){return _0x19bed6['id']===_0x30fa40[_0x1c8f('0x8a')][_0x42aca6]['ItemTypeId'];});if(!_[_0x1c8f('0x55')](_0x5692fd)){_0x3a7368=_0x42aca6;}}}if(_['isNil'](_0x3a7368)){_0x3a7368=0x64;}_0xfb685f[_0x1c8f('0x61')](addAdditionalPhone(_0x30fa40['id'],_0x30fa40[_0x1c8f('0x8a')][_0x42aca6][_0x1c8f('0x79')],_0x30fa40[_0x1c8f('0x8b')]?_[_0x1c8f('0x55')](_0x30fa40[_0x1c8f('0x8b')][_0x42aca6])?null:_0x30fa40[_0x1c8f('0x8b')][_0x42aca6]:_0x30fa40[_0x1c8f('0x8a')][_0x42aca6][_0x1c8f('0x8d')]?_0x30fa40['items'][_0x42aca6][_0x1c8f('0x8d')]:null,_0x3a7368,_0x43dda9));}Promise[_0x1c8f('0x63')](_0xfb685f)['then'](function(){db[_0x1c8f('0x25')][_0x1c8f('0x17')]({'AdditionalPhones':_0x442dcc},{'where':{'id':_0x30fa40['id']}})['then'](function(){_0x2fbef3(0x1);});});});});});}function addAdditionalPhone(_0x25353e,_0x5364a3,_0x17f628,_0x5345dc,_0x3296ee){return db['CmContactHasItem'][_0x1c8f('0x26')]({'where':{'CmContactId':_0x25353e,'item':_0x5364a3}})[_0x1c8f('0x18')](function(_0x5789a5){if(_0x5789a5)logger[_0x1c8f('0x35')](_0x1c8f('0x8e'),_0x5789a5);else{db[_0x1c8f('0x68')][_0x1c8f('0x40')]({'CmContactId':_0x25353e,'item':_0x5364a3,'ItemTypeId':_0x17f628,'OrderBy':_0x5345dc,'ItemClass':'PHONE','description':_0x3296ee});}});}function deleteCmHopperPhones(_0x539a61){return new Promise(function(_0x4c3b0d){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x539a61}})[_0x1c8f('0x18')](function(_0x42ed6c){db[_0x1c8f('0x8f')][_0x1c8f('0x19')]({'where':{'CmHopperId':{'$in':_[_0x1c8f('0x74')](_0x42ed6c,'id')}}});})[_0x1c8f('0x18')](function(){_0x4c3b0d(0x1);});});}function addCmHopperPhones(_0x4efdb7){return new Promise(function(_0x5b5918){return db[_0x1c8f('0x3d')][_0x1c8f('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4efdb7}})[_0x1c8f('0x18')](function(_0x32a8ec){var _0x3830b2=[];_[_0x1c8f('0x74')](_0x32a8ec,function(_0x22dfb8){_0x3830b2[_0x1c8f('0x61')](createCmHopperPhone(_0x4efdb7,_0x22dfb8['id']));});Promise[_0x1c8f('0x63')](_0x3830b2)[_0x1c8f('0x18')](function(){_0x5b5918(0x1);});});});}function createCmHopperPhone(_0x1f320a,_0x5070e0){return new Promise(function(_0x318589){db[_0x1c8f('0x68')]['findAll']({'raw':!![],'attributes':[_0x1c8f('0x90'),'OrderBy'],'where':{'CmContactId':_0x1f320a,'ItemClass':_0x1c8f('0x91')},'include':[{'model':db[_0x1c8f('0x6a')],'attributes':[_0x1c8f('0x89')],'as':'ItemType'}],'order':['OrderBy',db[_0x1c8f('0x77')][_0x1c8f('0x6c')](_0x1c8f('0x92'))]})[_0x1c8f('0x18')](function(_0x57bdfa){var _0xbddd64=0x1;var _0x513365=_['map'](_0x57bdfa,function(_0x3495a3){_0x3495a3[_0x1c8f('0x93')]=_0x5070e0;_0x3495a3['phone']=_0x3495a3['item'];_0x3495a3[_0x1c8f('0x89')]=_0xbddd64;delete _0x3495a3[_0x1c8f('0x94')];_0xbddd64=_0xbddd64+0x1;return _0x3495a3;});return db[_0x1c8f('0x8f')]['bulkCreate'](_0x513365,{});})['then'](function(){_0x318589(0x1);});});}function insertAdditionalPhones(_0x1e509d,_0xab98dc){return new Promise(function(_0x5eec12){var _0x8139c4=[];for(var _0x6a42fc=0x0;_0x6a42fc<_0xab98dc[_0x1c8f('0x2b')];_0x6a42fc++){var _0x13cab9=_0xab98dc[_0x6a42fc];_0x8139c4[_0x1c8f('0x61')](parseContactItemType(_0x13cab9));}Promise['all'](_0x8139c4)['then'](function(){var _0x32f4b4={'id':_0x1e509d['id'],'items':_0xab98dc};return addAdditionalPhones(_0x32f4b4)[_0x1c8f('0x18')](function(){return addCmHopperPhones(_0x1e509d['id']);});})[_0x1c8f('0x18')](function(){_0x5eec12(_0x1e509d);});});}function parseContactItemType(_0x12c406){return new Promise(function(_0x5d4077){if(_0x12c406[_0x1c8f('0x37')](_0x1c8f('0x8d'))){_0x5d4077(_0x12c406);}else{return db[_0x1c8f('0x6a')][_0x1c8f('0x26')]({'where':{'name':_0x12c406[_0x1c8f('0x6b')]}})['then'](function(_0x483216){if(_[_0x1c8f('0x55')](_0x483216))_0x12c406[_0x1c8f('0x8d')]=null;else _0x12c406[_0x1c8f('0x8d')]=_0x483216['id'];_0x5d4077(_0x12c406);});}});}exports[_0x1c8f('0x95')]=function(_0x1e0640,_0xd2b7c){return db[_0x1c8f('0x68')][_0x1c8f('0x23')]({'raw':!![],'where':{'CmContactId':_0x1e0640['params']['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x1c8f('0x6a')],'as':_0x1c8f('0x6b')}],'order':[[_0x1c8f('0x89')],[db[_0x1c8f('0x77')][_0x1c8f('0x6c')](_0x1c8f('0x92'))]]})['then'](function(_0x10d97c){return _0x10d97c;})[_0x1c8f('0x18')](respondWithResult(_0xd2b7c,null))[_0x1c8f('0x28')](handleError(_0xd2b7c,null));};exports[_0x1c8f('0x96')]=function(_0x3e9527,_0x45373f){return db[_0x1c8f('0x68')][_0x1c8f('0x23')]({'raw':!![],'where':{'CmContactId':_0x3e9527[_0x1c8f('0x38')][_0x1c8f('0x97')]}})[_0x1c8f('0x18')](function(_0x4ca492){var _0x1c2de1=_[_0x1c8f('0x74')](_0x4ca492,function(_0x1dddc4){_0x1dddc4[_0x1c8f('0x98')]=_0x3e9527['body'][_0x1c8f('0x99')];return _0x1dddc4;});return db['CmContactHasItem'][_0x1c8f('0x5a')](_0x1c2de1,{});})[_0x1c8f('0x18')](function(){return addCmHopperPhones(_0x3e9527[_0x1c8f('0x38')]['toContactId']);})[_0x1c8f('0x18')](function(){return['ok'];})[_0x1c8f('0x18')](respondWithResult(_0x45373f,null))[_0x1c8f('0x28')](handleError(_0x45373f,null));};exports[_0x1c8f('0x9a')]=function(_0xb450b0,_0x52d82f){var _0x34e7fc=[];_0x34e7fc[_0x1c8f('0x61')](createCmHopperPhone(_0xb450b0[_0x1c8f('0x38')]['id'],_0xb450b0[_0x1c8f('0x38')][_0x1c8f('0x9b')]));Promise[_0x1c8f('0x63')](_0x34e7fc)['then'](function(){return[0x1];})['then'](respondWithResult(_0x52d82f,null));};exports[_0x1c8f('0x9c')]=function(_0x452668,_0x165c69){var _0x1d1e8a={'raw':![],'where':{}};var _0x6f4d4b={};var _0x1537ec={'count':0x0,'rows':[]};return db[_0x1c8f('0x25')][_0x1c8f('0x7b')]({'where':{'id':_0x452668[_0x1c8f('0x27')]['id']}})['then'](handleEntityNotFound(_0x165c69,null))[_0x1c8f('0x18')](function(_0x26c720){if(_0x26c720){_0x6f4d4b[_0x1c8f('0x7d')]=_[_0x1c8f('0x2a')](db[_0x1c8f('0x3d')][_0x1c8f('0x9d')]);_0x6f4d4b['query']=_[_0x1c8f('0x2a')](_0x452668[_0x1c8f('0x2e')]);_0x6f4d4b[_0x1c8f('0x7c')]=_[_0x1c8f('0x7f')](_0x6f4d4b[_0x1c8f('0x7d')],_0x6f4d4b['query']);_0x1d1e8a[_0x1c8f('0x7e')]=_[_0x1c8f('0x7f')](_0x6f4d4b['model'],qs[_0x1c8f('0x80')](_0x452668['query'][_0x1c8f('0x80')]));_0x1d1e8a[_0x1c8f('0x7e')]=_0x1d1e8a[_0x1c8f('0x7e')][_0x1c8f('0x2b')]?_0x1d1e8a['attributes']:_0x6f4d4b[_0x1c8f('0x7d')];if(!_0x452668[_0x1c8f('0x2e')][_0x1c8f('0x37')](_0x1c8f('0x9e'))){_0x1d1e8a[_0x1c8f('0x12')]=qs[_0x1c8f('0x12')](_0x452668[_0x1c8f('0x2e')][_0x1c8f('0x12')]);_0x1d1e8a[_0x1c8f('0x11')]=qs[_0x1c8f('0x11')](_0x452668[_0x1c8f('0x2e')][_0x1c8f('0x11')]);}_0x1d1e8a[_0x1c8f('0x81')]=qs[_0x1c8f('0x82')](_0x452668[_0x1c8f('0x2e')]['sort']);_0x1d1e8a[_0x1c8f('0x5d')]=qs[_0x1c8f('0x7c')](_[_0x1c8f('0x83')](_0x452668[_0x1c8f('0x2e')],_0x6f4d4b[_0x1c8f('0x7c')]));_0x1d1e8a[_0x1c8f('0x5d')][_0x1c8f('0x9f')]=_0x26c720['id'];if(_0x452668['query'][_0x1c8f('0x84')]){_0x1d1e8a[_0x1c8f('0x5d')]=_[_0x1c8f('0x85')](_0x1d1e8a[_0x1c8f('0x5d')],{'$or':_['map'](_0x1d1e8a[_0x1c8f('0x7e')],function(_0xd2d881){var _0x3647bd={};_0x3647bd[_0xd2d881]={'$like':'%'+_0x452668['query'][_0x1c8f('0x84')]+'%'};return _0x3647bd;})});}_0x1d1e8a=_[_0x1c8f('0x85')]({},_0x1d1e8a,_0x452668['options']);return db[_0x1c8f('0x3d')][_0x1c8f('0x14')]({'where':_0x1d1e8a[_0x1c8f('0x5d')]})[_0x1c8f('0x18')](function(_0x3356e6){_0x1537ec[_0x1c8f('0x14')]=_0x3356e6;if(_0x452668[_0x1c8f('0x2e')][_0x1c8f('0xa0')]){_0x1d1e8a[_0x1c8f('0xa1')]=[{'all':!![]}];}return db[_0x1c8f('0x3d')][_0x1c8f('0x23')](_0x1d1e8a);})[_0x1c8f('0x18')](function(_0x3d304b){_0x1537ec[_0x1c8f('0xa2')]=_0x3d304b;return _0x1537ec;});}})[_0x1c8f('0x18')](respondWithFilteredResult(_0x165c69,_0x1d1e8a))[_0x1c8f('0x28')](handleError(_0x165c69,null));};exports['getHopperHistories']=function(_0x2f5707,_0x29f8cf){var _0x2879be={'raw':!![],'where':{}};var _0x3f6e87={};var _0x27f40b={'count':0x0,'rows':[]};return db[_0x1c8f('0x25')]['findOne']({'where':{'id':_0x2f5707[_0x1c8f('0x27')]['id']}})['then'](handleEntityNotFound(_0x29f8cf,null))[_0x1c8f('0x18')](function(_0x3691de){if(_0x3691de){_0x3f6e87[_0x1c8f('0x7d')]=_['keys'](db[_0x1c8f('0x48')]['rawAttributes']);_0x3f6e87['query']=_[_0x1c8f('0x2a')](_0x2f5707[_0x1c8f('0x2e')]);_0x3f6e87[_0x1c8f('0x7c')]=_['intersection'](_0x3f6e87['model'],_0x3f6e87[_0x1c8f('0x2e')]);_0x2879be[_0x1c8f('0x7e')]=_['intersection'](_0x3f6e87['model'],qs[_0x1c8f('0x80')](_0x2f5707[_0x1c8f('0x2e')]['fields']));_0x2879be[_0x1c8f('0x7e')]=_0x2879be[_0x1c8f('0x7e')][_0x1c8f('0x2b')]?_0x2879be[_0x1c8f('0x7e')]:_0x3f6e87[_0x1c8f('0x7d')];if(!_0x2f5707[_0x1c8f('0x2e')][_0x1c8f('0x37')](_0x1c8f('0x9e'))){_0x2879be[_0x1c8f('0x12')]=qs[_0x1c8f('0x12')](_0x2f5707['query']['limit']);_0x2879be[_0x1c8f('0x11')]=qs[_0x1c8f('0x11')](_0x2f5707[_0x1c8f('0x2e')][_0x1c8f('0x11')]);}_0x2879be[_0x1c8f('0x81')]=qs['sort'](_0x2f5707[_0x1c8f('0x2e')][_0x1c8f('0x82')]);_0x2879be[_0x1c8f('0x5d')]=qs[_0x1c8f('0x7c')](_[_0x1c8f('0x83')](_0x2f5707[_0x1c8f('0x2e')],_0x3f6e87[_0x1c8f('0x7c')]));_0x2879be['where'][_0x1c8f('0x9f')]=_0x3691de['id'];if(_0x2f5707[_0x1c8f('0x2e')][_0x1c8f('0x84')]){_0x2879be['where']=_['merge'](_0x2879be[_0x1c8f('0x5d')],{'$or':_[_0x1c8f('0x74')](_0x2879be[_0x1c8f('0x7e')],function(_0x2e4f9d){var _0x10ebb0={};_0x10ebb0[_0x2e4f9d]={'$like':'%'+_0x2f5707['query'][_0x1c8f('0x84')]+'%'};return _0x10ebb0;})});}_0x2879be=_[_0x1c8f('0x85')]({},_0x2879be,_0x2f5707[_0x1c8f('0x86')]);return db[_0x1c8f('0x48')][_0x1c8f('0x14')]({'where':_0x2879be['where']})['then'](function(_0x182274){_0x27f40b[_0x1c8f('0x14')]=_0x182274;if(_0x2f5707['query']['includeAll']){_0x2879be[_0x1c8f('0xa1')]=[{'all':!![]}];}return db[_0x1c8f('0x48')][_0x1c8f('0x23')](_0x2879be);})[_0x1c8f('0x18')](function(_0x31291b){_0x27f40b[_0x1c8f('0xa2')]=_0x31291b;return _0x27f40b;});}})[_0x1c8f('0x18')](respondWithFilteredResult(_0x29f8cf,_0x2879be))['catch'](handleError(_0x29f8cf,null));};exports['getHopperFinals']=function(_0x55364e,_0x3ca232){var _0x16ada3={'raw':!![],'where':{}};var _0x5b9939={};var _0x4c155d={'count':0x0,'rows':[]};return db[_0x1c8f('0x25')][_0x1c8f('0x7b')]({'where':{'id':_0x55364e[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x3ca232,null))[_0x1c8f('0x18')](function(_0x433111){if(_0x433111){_0x5b9939[_0x1c8f('0x7d')]=_[_0x1c8f('0x2a')](db[_0x1c8f('0x47')][_0x1c8f('0x9d')]);_0x5b9939[_0x1c8f('0x2e')]=_[_0x1c8f('0x2a')](_0x55364e[_0x1c8f('0x2e')]);_0x5b9939['filters']=_['intersection'](_0x5b9939['model'],_0x5b9939[_0x1c8f('0x2e')]);_0x16ada3[_0x1c8f('0x7e')]=_['intersection'](_0x5b9939['model'],qs[_0x1c8f('0x80')](_0x55364e[_0x1c8f('0x2e')]['fields']));_0x16ada3['attributes']=_0x16ada3[_0x1c8f('0x7e')][_0x1c8f('0x2b')]?_0x16ada3[_0x1c8f('0x7e')]:_0x5b9939['model'];if(!_0x55364e['query']['hasOwnProperty'](_0x1c8f('0x9e'))){_0x16ada3[_0x1c8f('0x12')]=qs[_0x1c8f('0x12')](_0x55364e[_0x1c8f('0x2e')]['limit']);_0x16ada3[_0x1c8f('0x11')]=qs['offset'](_0x55364e[_0x1c8f('0x2e')][_0x1c8f('0x11')]);}_0x16ada3[_0x1c8f('0x81')]=qs[_0x1c8f('0x82')](_0x55364e[_0x1c8f('0x2e')]['sort']);_0x16ada3[_0x1c8f('0x5d')]=qs[_0x1c8f('0x7c')](_[_0x1c8f('0x83')](_0x55364e[_0x1c8f('0x2e')],_0x5b9939[_0x1c8f('0x7c')]));_0x16ada3[_0x1c8f('0x5d')]['ContactId']=_0x433111['id'];if(_0x55364e[_0x1c8f('0x2e')][_0x1c8f('0x84')]){_0x16ada3['where']=_[_0x1c8f('0x85')](_0x16ada3[_0x1c8f('0x5d')],{'$or':_[_0x1c8f('0x74')](_0x16ada3[_0x1c8f('0x7e')],function(_0x363ed0){var _0x4e133e={};_0x4e133e[_0x363ed0]={'$like':'%'+_0x55364e[_0x1c8f('0x2e')][_0x1c8f('0x84')]+'%'};return _0x4e133e;})});}_0x16ada3=_[_0x1c8f('0x85')]({},_0x16ada3,_0x55364e['options']);return db['CmHopperFinal'][_0x1c8f('0x14')]({'where':_0x16ada3['where']})[_0x1c8f('0x18')](function(_0x26b2ca){_0x4c155d[_0x1c8f('0x14')]=_0x26b2ca;if(_0x55364e['query'][_0x1c8f('0xa0')]){_0x16ada3['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x1c8f('0x23')](_0x16ada3);})['then'](function(_0x41eac5){_0x4c155d['rows']=_0x41eac5;return _0x4c155d;});}})['then'](respondWithFilteredResult(_0x3ca232,_0x16ada3))[_0x1c8f('0x28')](handleError(_0x3ca232,null));};exports[_0x1c8f('0xa3')]=function(_0x123cc9,_0x2ac1d5){var _0x5ec461={'raw':!![],'where':{}};var _0x32b811={};var _0x213e91={'count':0x0,'rows':[]};return db['CmContact'][_0x1c8f('0x7b')]({'where':{'id':_0x123cc9[_0x1c8f('0x27')]['id']}})[_0x1c8f('0x18')](handleEntityNotFound(_0x2ac1d5,null))['then'](function(_0x5792f8){if(_0x5792f8){_0x32b811[_0x1c8f('0x7d')]=_[_0x1c8f('0x2a')](db[_0x1c8f('0x4f')][_0x1c8f('0x9d')]);_0x32b811[_0x1c8f('0x2e')]=_['keys'](_0x123cc9['query']);_0x32b811[_0x1c8f('0x7c')]=_[_0x1c8f('0x7f')](_0x32b811[_0x1c8f('0x7d')],_0x32b811[_0x1c8f('0x2e')]);_0x5ec461[_0x1c8f('0x7e')]=_['intersection'](_0x32b811['model'],qs[_0x1c8f('0x80')](_0x123cc9[_0x1c8f('0x2e')]['fields']));_0x5ec461[_0x1c8f('0x7e')]=_0x5ec461[_0x1c8f('0x7e')]['length']?_0x5ec461[_0x1c8f('0x7e')]:_0x32b811[_0x1c8f('0x7d')];if(!_0x123cc9[_0x1c8f('0x2e')][_0x1c8f('0x37')](_0x1c8f('0x9e'))){_0x5ec461[_0x1c8f('0x12')]=qs['limit'](_0x123cc9[_0x1c8f('0x2e')]['limit']);_0x5ec461[_0x1c8f('0x11')]=qs[_0x1c8f('0x11')](_0x123cc9['query'][_0x1c8f('0x11')]);}_0x5ec461[_0x1c8f('0x81')]=qs['sort'](_0x123cc9['query'][_0x1c8f('0x82')]);_0x5ec461[_0x1c8f('0x5d')]=qs[_0x1c8f('0x7c')](_[_0x1c8f('0x83')](_0x123cc9[_0x1c8f('0x2e')],_0x32b811['filters']));_0x5ec461[_0x1c8f('0x5d')][_0x1c8f('0x9f')]=_0x5792f8['id'];if(_0x123cc9['query'][_0x1c8f('0x84')]){_0x5ec461[_0x1c8f('0x5d')]=_[_0x1c8f('0x85')](_0x5ec461[_0x1c8f('0x5d')],{'$or':_[_0x1c8f('0x74')](_0x5ec461[_0x1c8f('0x7e')],function(_0x4566c1){var _0xd42692={};_0xd42692[_0x4566c1]={'$like':'%'+_0x123cc9[_0x1c8f('0x2e')][_0x1c8f('0x84')]+'%'};return _0xd42692;})});}_0x5ec461=_['merge']({},_0x5ec461,_0x123cc9[_0x1c8f('0x86')]);return db[_0x1c8f('0x4f')][_0x1c8f('0x14')]({'where':_0x5ec461[_0x1c8f('0x5d')]})[_0x1c8f('0x18')](function(_0x427dc5){_0x213e91[_0x1c8f('0x14')]=_0x427dc5;if(_0x123cc9['query'][_0x1c8f('0xa0')]){_0x5ec461[_0x1c8f('0xa1')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1c8f('0x23')](_0x5ec461);})['then'](function(_0x1c640c){_0x213e91[_0x1c8f('0xa2')]=_0x1c640c;return _0x213e91;});}})[_0x1c8f('0x18')](respondWithFilteredResult(_0x2ac1d5,_0x5ec461))['catch'](handleError(_0x2ac1d5,null));};exports[_0x1c8f('0xa4')]=function(_0x37ddb4,_0x2f17b3){try{if(!_0x37ddb4['body'][_0x1c8f('0x5e')]){throw new Error(_0x1c8f('0xa5'));}if(!_0x37ddb4['body']['binding_keys']){throw new Error(_0x1c8f('0xa6'));}if(!_0x37ddb4[_0x1c8f('0x38')]['binding_values']){throw new Error(_0x1c8f('0xa7'));}if(!_0x37ddb4[_0x1c8f('0x38')]['socket_timestamp']){throw new Error(_0x1c8f('0xa8'));}var _0x58d3f1=_0x37ddb4['body'][_0x1c8f('0xa9')][_0x1c8f('0xaa')](',');var _0x1a47a3=_0x37ddb4[_0x1c8f('0x38')][_0x1c8f('0xab')][_0x1c8f('0xaa')](',');if(!_0x58d3f1[_0x1c8f('0x2b')]||!_0x1a47a3[_0x1c8f('0x2b')]||_0x58d3f1['length']!==_0x1a47a3[_0x1c8f('0x2b')]){throw new Error(_0x1c8f('0xac'));}_0x37ddb4[_0x1c8f('0x38')]['fields']=_[_0x1c8f('0xad')](_0x58d3f1,_0x1a47a3);if(!_0x37ddb4['body'][_0x1c8f('0x80')][_0x1c8f('0x79')]){throw new Error(_0x1c8f('0xae'));}if(!_0x37ddb4[_0x1c8f('0x38')][_0x1c8f('0x80')][_0x1c8f('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x17fd28=path['join'](config[_0x1c8f('0xb0')],_0x1c8f('0xb1'),_0x37ddb4[_0x1c8f('0xb2')][_0x1c8f('0xb3')]);fs[_0x1c8f('0xb4')](_0x17fd28,parseInt(_0x1c8f('0xb5'),0x8));var _0x8ac62d=require(_0x1c8f('0xb6'))[_0x1c8f('0xb7')](path['join'](__dirname,_0x1c8f('0xb8')),[_0x17fd28,_0x37ddb4['body'][_0x1c8f('0xa9')],_0x37ddb4[_0x1c8f('0x38')][_0x1c8f('0xab')],_0x37ddb4[_0x1c8f('0x38')]['ListId'],_0x37ddb4[_0x1c8f('0x38')][_0x1c8f('0xb9')],_0x37ddb4[_0x1c8f('0x38')]['duplicates'],_0x37ddb4[_0x1c8f('0x38')][_0x1c8f('0xba')]]);return _0x2f17b3['status'](0xc8)['json']({'message':_0x1c8f('0xbb'),'pid':_0x8ac62d[_0x1c8f('0xbc')]});}catch(_0x4d687f){return _0x2f17b3['status'](0x1f4)['send'](_0x4d687f);}};exports[_0x1c8f('0xbd')]=function(_0x52169d,_0x9fd1be){var _0x1015d7=fs[_0x1c8f('0xbe')](_0x52169d[_0x1c8f('0xb2')][_0x1c8f('0x1')]);Papa[_0x1c8f('0xbf')](_0x1015d7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2aaac3){return _0x9fd1be['status'](0xc8)[_0x1c8f('0x10')]({'file':_0x52169d['file'],'fields':_0x2aaac3['meta']['fields']});}});};exports[_0x1c8f('0xc0')]=function(_0x5ec446,_0x46b13d){return db[_0x1c8f('0xc1')][_0x1c8f('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1c8f('0xc2')}})[_0x1c8f('0x18')](function(_0x251cc3){var _0x1fcc20=![];if(!_0x5ec446[_0x1c8f('0x38')][_0x1c8f('0x5e')]){throw new Error(_0x1c8f('0xa5'));}if(!_0x5ec446[_0x1c8f('0x38')][_0x1c8f('0xc3')][_0x1c8f('0x79')]){throw new Error(_0x1c8f('0xae'));}if(!_0x5ec446[_0x1c8f('0x38')][_0x1c8f('0xc3')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5ec446[_0x1c8f('0x38')][_0x1c8f('0xba')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x857cd4=require('child_process')[_0x1c8f('0xb7')](path[_0x1c8f('0x54')](__dirname,_0x1c8f('0xc4')),[_0x5ec446['params']['id'],JSON[_0x1c8f('0xc5')](_0x5ec446[_0x1c8f('0x38')]),JSON['stringify'](_0x251cc3)]);_0x857cd4['on']('message',function(){_0x1fcc20=!![];return _0x46b13d[_0x1c8f('0xf')](0xc8)[_0x1c8f('0x10')]({'message':_0x1c8f('0xc6'),'pid':_0x857cd4[_0x1c8f('0xbc')]});});_0x857cd4['on'](_0x1c8f('0xc7'),function(_0x553668){if(_0x553668&&!_0x1fcc20){return _0x46b13d[_0x1c8f('0xf')](0x1f4)['json']({'message':_0x1c8f('0xc8'),'pid':_0x857cd4[_0x1c8f('0xbc')]});}});})[_0x1c8f('0x28')](handleError(_0x46b13d,null));};exports[_0x1c8f('0xc9')]=function(_0xed79a5,_0xfeb211){return db[_0x1c8f('0xc1')][_0x1c8f('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x1c8f('0x18')](function(_0x4fd1d1){var _0x14021a=![];if(!_0xed79a5['body'][_0x1c8f('0x5e')]){throw new Error(_0x1c8f('0xa5'));}if(!_0xed79a5['body']['binding']['phone']){throw new Error(_0x1c8f('0xae'));}if(!_0xed79a5[_0x1c8f('0x38')][_0x1c8f('0xc3')][_0x1c8f('0xaf')]){throw new Error(_0x1c8f('0xca'));}if(!_0xed79a5[_0x1c8f('0x38')]['socket_timestamp']){throw new Error(_0x1c8f('0xa8'));}var _0x3ec867=require(_0x1c8f('0xb6'))[_0x1c8f('0xb7')](path[_0x1c8f('0x54')](__dirname,_0x1c8f('0xcb')),[_0xed79a5[_0x1c8f('0x27')]['id'],JSON[_0x1c8f('0xc5')](_0xed79a5['body']),JSON[_0x1c8f('0xc5')](_0x4fd1d1)]);_0x3ec867['on']('message',function(){_0x14021a=!![];return _0xfeb211[_0x1c8f('0xf')](0xc8)[_0x1c8f('0x10')]({'message':_0x1c8f('0xc6'),'pid':_0x3ec867[_0x1c8f('0xbc')]});});_0x3ec867['on']('exit',function(_0x1734ba){if(_0x1734ba&&!_0x14021a){return _0xfeb211[_0x1c8f('0xf')](0x1f4)['json']({'message':_0x1c8f('0xc8'),'pid':_0x3ec867[_0x1c8f('0xbc')]});}});})['catch'](handleError(_0xfeb211,null));};exports[_0x1c8f('0xcc')]=function(_0x140a01,_0x1d51ff){var _0x462410=['mail','chat',_0x1c8f('0xcd'),_0x1c8f('0xce'),_0x1c8f('0xcf'),_0x1c8f('0xd0'),_0x1c8f('0xd1')];var _0x1103be={'offset':0x0,'order':qs['sort']('-createdAt')},_0x3c12da={'count':0x0,'rows':[]};Promise[_0x1c8f('0xd2')]()['then'](function(){if(_0x140a01[_0x1c8f('0x2e')][_0x1c8f('0xd3')]){if(!_[_0x1c8f('0xd4')](_0x462410,_0x140a01[_0x1c8f('0x2e')][_0x1c8f('0xd3')][_0x1c8f('0xd5')]())){throw new Error(_0x1c8f('0xd6'));}_0x462410=[_0x140a01[_0x1c8f('0x2e')][_0x1c8f('0xd3')]['toLowerCase']()];}if(_0x140a01['query'][_0x1c8f('0xd7')]){try{var _0x1ae73b=JSON[_0x1c8f('0xbf')](_0x140a01['query'][_0x1c8f('0xd7')]);if(!moment(_0x1ae73b['from'])[_0x1c8f('0xd8')]()){throw new Error(_0x1c8f('0xd9'));}if(!moment(_0x1ae73b['to'])[_0x1c8f('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3a14fe){throw new Error(_0x1c8f('0xda'));}}if(!_0x140a01[_0x1c8f('0x2e')]['hasOwnProperty']('nolimit')){_0x1103be[_0x1c8f('0x12')]=qs[_0x1c8f('0x12')](_0x140a01[_0x1c8f('0x2e')][_0x1c8f('0x12')]||0xa);_0x1103be[_0x1c8f('0x11')]=qs['offset'](_0x140a01[_0x1c8f('0x2e')]['offset']);}var _0x3df44c=_0x462410[_0x1c8f('0x74')](function(_0x392336){if(_0x392336===_0x1c8f('0xd1')){var _0x9f8313={'attributes':['id','uniqueid','type',_0x1c8f('0xdb'),_0x1c8f('0xdc'),_0x1c8f('0xdd'),_0x1c8f('0xde'),'endtime',_0x1c8f('0xdf'),_0x1c8f('0xe0'),_0x1c8f('0xe1'),_0x1c8f('0xe2'),_0x1c8f('0xe3'),_0x1c8f('0xe4'),_0x1c8f('0xe5')],'where':{'ContactId':_0x140a01['params']['id']},'include':[{'model':db['User'],'as':_0x1c8f('0xc1'),'attributes':['id',_0x1c8f('0x1e'),_0x1c8f('0xe6'),_0x1c8f('0x31')]}],'order':[[_0x1c8f('0xe1'),_0x1c8f('0xe7')]]};if(_0x140a01[_0x1c8f('0x2e')]['range']){_0x9f8313[_0x1c8f('0x5d')][_0x1c8f('0xe1')]={'$gte':_0x1ae73b[_0x1c8f('0x39')],'$lte':_0x1ae73b['to']};}return db[_0x1c8f('0x4a')][_0x1c8f('0xe8')](_0x9f8313)[_0x1c8f('0x18')](function(_0x176e80){_0x3c12da[_0x1c8f('0x14')]+=_0x176e80[_0x1c8f('0x14')];return _[_0x1c8f('0x74')](_0x176e80['rows'],function(_0x41920c){var _0x420eaa=_0x41920c[_0x1c8f('0x3a')]({'plain':!![]});_0x420eaa['channel']=_0x392336;if(_0x420eaa[_0x1c8f('0xc1')]){_0x420eaa[_0x1c8f('0xc1')]={'id':_0x420eaa[_0x1c8f('0xc1')]['id'],'name':_0x420eaa[_0x1c8f('0xc1')][_0x1c8f('0x1e')],'fullname':_0x420eaa['User'][_0x1c8f('0xe6')],'alias':_0x420eaa[_0x1c8f('0xc1')][_0x1c8f('0x31')]};}return _0x420eaa;});});}else{var _0x565a95=_[_0x1c8f('0xe9')](_0x392336)+(_0x392336===_0x1c8f('0xea')?'Website':_0x1c8f('0xeb'));var _0x42e9ac={'attributes':['id',_0x1c8f('0xec'),_0x1c8f('0xed'),_0x1c8f('0xe1'),_0x1c8f('0xe0'),_0x1c8f('0xee'),_0x1c8f('0xef'),_0x1c8f('0xf0'),_0x1c8f('0xe5'),_0x565a95+'Id'],'where':{'ContactId':_0x140a01[_0x1c8f('0x27')]['id']},'include':[{'model':db[_0x565a95],'as':'Account','attributes':['id',_0x1c8f('0x1e'),_0x1c8f('0xf1')]},{'model':db[_0x1c8f('0xc1')],'as':_0x1c8f('0xf2'),'attributes':['id',_0x1c8f('0x1e'),'fullname']},{'model':db['Tag'],'as':_0x1c8f('0xf3'),'attributes':['id','name',_0x1c8f('0x66')],'through':{'attributes':[]}}],'order':[[_0x1c8f('0xe1'),_0x1c8f('0xe7')]]};if(_0x140a01[_0x1c8f('0x2e')][_0x1c8f('0xd7')]){_0x42e9ac[_0x1c8f('0x5d')][_0x1c8f('0xe1')]={'$gte':_0x1ae73b[_0x1c8f('0x39')],'$lte':_0x1ae73b['to']};}switch(_0x392336){case _0x1c8f('0xea'):_0x42e9ac[_0x1c8f('0x7e')][_0x1c8f('0x61')](_0x1c8f('0xf4'),'customerIp',_0x1c8f('0xf5'),_0x1c8f('0xf6'),'osName',_0x1c8f('0xf7'),'ratingType',_0x1c8f('0xf8'),_0x1c8f('0xf9'));break;case _0x1c8f('0xfa'):_0x42e9ac[_0x1c8f('0x7e')][_0x1c8f('0x61')](_0x1c8f('0xfb'),'substatus');break;case'openchannel':_0x42e9ac['attributes'][_0x1c8f('0x61')](_0x1c8f('0xfc'),_0x1c8f('0xfd'));break;}return db[_[_0x1c8f('0xe9')](_0x392336)+_0x1c8f('0xfe')][_0x1c8f('0xe8')](_0x42e9ac)[_0x1c8f('0x18')](function(_0x4de5b3){_0x3c12da[_0x1c8f('0x14')]+=_0x4de5b3[_0x1c8f('0x14')];return _[_0x1c8f('0x74')](_0x4de5b3[_0x1c8f('0xa2')],function(_0x1c81f6){var _0x2757d8=_0x1c81f6[_0x1c8f('0x3a')]({'plain':!![]});_0x2757d8['channel']=_0x392336;if(_0x2757d8['Owner']){_0x2757d8['Owner']={'id':_0x2757d8[_0x1c8f('0xf2')]['id'],'name':_0x2757d8[_0x1c8f('0xf2')][_0x1c8f('0x1e')],'fullname':_0x2757d8[_0x1c8f('0xf2')][_0x1c8f('0xe6')]};}return _0x2757d8;});});}});return Promise[_0x1c8f('0x63')](_0x3df44c);})[_0x1c8f('0x18')](function(_0x5d0053){return _(_0x5d0053)['flatten']()[_0x1c8f('0xff')](_0x1c8f('0xe1'))[_0x1c8f('0x100')]()[_0x1c8f('0x101')]();})['then'](function(_0x38080b){_0x3c12da[_0x1c8f('0xa2')]=_0x1103be['limit']?_0x38080b['slice'](_0x1103be[_0x1c8f('0x11')],_0x1103be[_0x1c8f('0x11')]+_0x1103be['limit']):_0x38080b;return _0x3c12da;})[_0x1c8f('0x18')](respondWithFilteredResult(_0x1d51ff,_0x1103be))[_0x1c8f('0x28')](handleError(_0x1d51ff,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 11f64b6..aefbea3 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 _0xcb61=['hook','exports','events','save','emit'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xcb61,0x1dd));var _0x1cb6=function(_0x2e9919,_0x1f64e5){_0x2e9919=_0x2e9919-0x0;var _0x266787=_0xcb61[_0x2e9919];return _0x266787;};'use strict';var EventEmitter=require(_0x1cb6('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cb6('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x88615){return function(_0x32164d,_0x33b77b,_0x4d4b7d){CmContactEvents[_0x1cb6('0x2')](_0x88615+':'+_0x32164d['id'],_0x32164d);CmContactEvents[_0x1cb6('0x2')](_0x88615,_0x32164d);_0x4d4b7d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x1cb6('0x3')](e,emitEvent(event));}}module[_0x1cb6('0x4')]=CmContactEvents; \ No newline at end of file +var _0xb43f=['exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hook'];(function(_0x9e4385,_0x3905a1){var _0x13f82f=function(_0x45c316){while(--_0x45c316){_0x9e4385['push'](_0x9e4385['shift']());}};_0x13f82f(++_0x3905a1);}(_0xb43f,0xc7));var _0xfb43=function(_0x37b0e1,_0x5f3934){_0x37b0e1=_0x37b0e1-0x0;var _0x24e3b2=_0xb43f[_0x37b0e1];return _0x24e3b2;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xfb43('0x0'))['db'][_0xfb43('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xfb43('0x2')](0x0);var events={'afterCreate':_0xfb43('0x3'),'afterUpdate':_0xfb43('0x4'),'afterDestroy':_0xfb43('0x5')};function emitEvent(_0x236fa8){return function(_0x445df6,_0x54a7b8,_0x14185b){CmContactEvents[_0xfb43('0x6')](_0x236fa8+':'+_0x445df6['id'],_0x445df6);CmContactEvents[_0xfb43('0x6')](_0x236fa8,_0x445df6);_0x14185b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xfb43('0x7')](e,emitEvent(event));}}module[_0xfb43('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 82c67f2..0de5bf2 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 _0xa6a7=['Lists','length','dialCheckDuplicateType','always','onlyIfOpen','findAll','CmHopperBlack','cmContact,\x20%s,\x20%s','message','BlackLists','models','isEmpty','destroy','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','get','error','cmContact','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','utcOffset','add','CmHopper','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','callbackUniqueid','catch','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','ListId','afterCreate','inspect','timezones','minutes','\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','create','outbound','CmList'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xa6a7,0xee));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a6a('0x0'));var util=require(_0x7a6a('0x1'));var logger=require('../../config/logger')(_0x7a6a('0x2'));var moment=require(_0x7a6a('0x3'));var BPromise=require(_0x7a6a('0x4'));var rp=require(_0x7a6a('0x5'));var fs=require('fs');var path=require(_0x7a6a('0x6'));var rimraf=require('rimraf');var config=require(_0x7a6a('0x7'));var shared=require(_0x7a6a('0x8'));var attributes=require(_0x7a6a('0x9'));module[_0x7a6a('0xa')]=function(_0x37b56c,_0x2a97cf){return _0x37b56c[_0x7a6a('0xb')](_0x7a6a('0xc'),attributes,{'tableName':_0x7a6a('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x7a6a('0xe')]},{'name':'fti_cm_contacts','fields':[_0x7a6a('0xf'),_0x7a6a('0x10'),_0x7a6a('0xe'),_0x7a6a('0x11'),_0x7a6a('0x12'),'email'],'type':_0x7a6a('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x7a6a('0x14'),'hooks':{'afterCreate':function(_0x587e78,_0x23c3b0,_0x493571){var _0x526bf3=_0x37b56c['models'];var _0x522927=_0x587e78[_0x7a6a('0x15')]({'plain':!![]});function _0x34379a(){return function(_0x4123f5){logger[_0x7a6a('0x16')](_0x7a6a('0x17'),'afterCreate',util['inspect'](_0x4123f5,{'showHidden':![],'depth':null}));};}function _0x2642be(_0x2e0ab5,_0x5a1735){var _0x578a3a=_0x5a1735[_0x7a6a('0x18')]?_0x5a1735['scheduledat']:moment()[_0x7a6a('0x19')](_0x7a6a('0x1a'));return new BPromise(function(_0x4d12e8,_0x3c70df){if(_[_0x7a6a('0x1b')](_0x5a1735[_0x7a6a('0x1c')])){_0x4d12e8({'ret':_0x578a3a});}else{_0x526bf3[_0x7a6a('0x1d')]['findOne']({'where':{'id':_0x2e0ab5['id']}})[_0x7a6a('0x1e')](function(_0x4901f7){if(!_[_0x7a6a('0x1b')](_0x4901f7)){var _0x16adf6=_0x4901f7[_0x7a6a('0x1c')];if(!_[_0x7a6a('0x1b')](_0x16adf6)){var _0x7129be=shared['timezones'];var _0x330b2d=_0x7129be[_0x16adf6];var _0x361a12=_0x7129be[_0x5a1735[_0x7a6a('0x1c')]];if(!_[_0x7a6a('0x1b')](_0x330b2d)&&!_[_0x7a6a('0x1b')](_0x361a12)){var _0x30ba3f=_0x330b2d[_0x7a6a('0x1f')]-_0x361a12[_0x7a6a('0x1f')];_0x578a3a=_0x5a1735[_0x7a6a('0x18')]?_0x5a1735[_0x7a6a('0x18')]:moment();var _0x4acd63=moment(_0x578a3a)[_0x7a6a('0x20')](_0x30ba3f,'minutes');_0x4d12e8({'ret':_0x4acd63[_0x7a6a('0x19')](_0x7a6a('0x1a'))});}else _0x4d12e8({'ret':_0x578a3a});}else _0x4d12e8({'ret':_0x578a3a});}else{_0x4d12e8({'ret':_0x578a3a});}});}});return 0xa;}var _0x3d53f8=function(_0x4562f7){return new BPromise(function(_0x5cfbc3,_0x5f2666){_0x2642be(_0x4562f7,_0x522927)[_0x7a6a('0x1e')](function(_0x4b0a5d){_0x522927[_0x7a6a('0x18')]=_0x4b0a5d['ret'];_0x526bf3[_0x7a6a('0x21')][_0x7a6a('0x22')]({'where':{'phone':_0x522927[_0x7a6a('0xe')],'VoiceQueueId':_0x4562f7['id']}})[_0x7a6a('0x1e')](function(_0x4947f6){if(!_['isNil'](_0x4947f6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x522927[_0x7a6a('0xe')]+_0x7a6a('0x23')+_0x4562f7['id']);}return _0x526bf3[_0x7a6a('0x21')]['create']({'phone':_0x522927[_0x7a6a('0xe')],'ContactId':_0x522927['id'],'ListId':_0x522927['ListId'],'priority':_0x522927[_0x7a6a('0x24')]?_0x522927[_0x7a6a('0x24')]:0x2,'scheduledat':_0x522927[_0x7a6a('0x18')]?_0x522927[_0x7a6a('0x18')]:moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')),'callback':_0x522927[_0x7a6a('0x25')]?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927[_0x7a6a('0x25')]?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'VoiceQueueId':_0x4562f7['id']});})[_0x7a6a('0x26')](function(_0x5c5df9){_0x5f2666(_0x5c5df9);});});});};var _0x281028=function(_0xdfa33d){return new BPromise(function(_0x51a58e,_0x40ce0a){_0x2642be(_0xdfa33d,_0x522927)['then'](function(_0xcc1d3c){_0x522927[_0x7a6a('0x18')]=_0xcc1d3c[_0x7a6a('0x27')];_0x526bf3['CmHopper']['findOne']({'where':{'phone':_0x522927['phone'],'VoiceQueueId':_0xdfa33d['id']}})[_0x7a6a('0x1e')](function(_0x54716f){if(!_[_0x7a6a('0x1b')](_0x54716f)){throw new Error(_0x7a6a('0x28')+_0x522927[_0x7a6a('0xe')]+_0x7a6a('0x29')+_0xdfa33d['id']);}return _0x526bf3[_0x7a6a('0x2a')][_0x7a6a('0x22')]({'where':{'calleridnum':_0x522927[_0x7a6a('0xe')],'VoiceQueueId':_0xdfa33d['id']}});})[_0x7a6a('0x1e')](function(_0x4626a7){if(!_['isNil'](_0x4626a7)){throw new Error(_0x7a6a('0x2b')+_0x522927['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xdfa33d['id']);}return _0x526bf3['CmHopper']['create']({'phone':_0x522927['phone'],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'priority':_0x522927[_0x7a6a('0x24')]?_0x522927[_0x7a6a('0x24')]:0x2,'scheduledat':_0x522927['scheduledat']?_0x522927[_0x7a6a('0x18')]:moment()[_0x7a6a('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x522927['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927[_0x7a6a('0x25')]?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'VoiceQueueId':_0xdfa33d['id']});})[_0x7a6a('0x26')](function(_0x362e49){_0x40ce0a(_0x362e49);});});});};function _0x665a04(){return function(_0xc681f2){logger[_0x7a6a('0x16')](_0x7a6a('0x17'),_0x7a6a('0x2d'),util[_0x7a6a('0x2e')](_0xc681f2,{'showHidden':![],'depth':null}));};}function _0x2f48ea(_0xec70b0,_0x219809){var _0x5f12a0=_0x219809[_0x7a6a('0x18')]?_0x219809[_0x7a6a('0x18')]:moment()[_0x7a6a('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x8d30a,_0x433e7b){if(_['isNil'](_0x219809['dialTimezone'])){_0x8d30a({'ret':_0x5f12a0});}else{_0x526bf3['Campaign'][_0x7a6a('0x22')]({'where':{'id':_0xec70b0['id']}})[_0x7a6a('0x1e')](function(_0x55c37d){if(!_[_0x7a6a('0x1b')](_0x55c37d)){var _0x4e2d09=_0x55c37d[_0x7a6a('0x1c')];if(!_['isNil'](_0x4e2d09)){var _0x10ffcb=shared[_0x7a6a('0x2f')];var _0x744df9=_0x10ffcb[_0x4e2d09];var _0x44d312=_0x10ffcb[_0x219809['dialTimezone']];if(!_['isNil'](_0x744df9)&&!_[_0x7a6a('0x1b')](_0x44d312)){var _0x382e23=_0x744df9[_0x7a6a('0x1f')]-_0x44d312[_0x7a6a('0x1f')];_0x5f12a0=_0x219809[_0x7a6a('0x18')]?_0x219809[_0x7a6a('0x18')]:moment();var _0x403383=moment(_0x5f12a0)['add'](_0x382e23,_0x7a6a('0x30'));_0x8d30a({'ret':_0x403383[_0x7a6a('0x19')](_0x7a6a('0x1a'))});}else _0x8d30a({'ret':_0x5f12a0});}else _0x8d30a({'ret':_0x5f12a0});}else{_0x8d30a({'ret':_0x5f12a0});}});}});return 0xa;}var _0x38b8cf=function(_0x9e695f){return new BPromise(function(_0x1f60ea,_0x401cd9){_0x2f48ea(_0x9e695f,_0x522927)['then'](function(_0x45d921){_0x522927['scheduledat']=_0x45d921[_0x7a6a('0x27')];_0x526bf3['CmHopper'][_0x7a6a('0x22')]({'where':{'phone':_0x522927[_0x7a6a('0xe')],'CampaignId':_0x9e695f['id']}})[_0x7a6a('0x1e')](function(_0x1d840e){if(!_[_0x7a6a('0x1b')](_0x1d840e)){throw new Error(_0x7a6a('0x28')+_0x522927['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x9e695f['id']);}return _0x526bf3[_0x7a6a('0x21')]['create']({'phone':_0x522927['phone'],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'priority':_0x522927[_0x7a6a('0x24')]?_0x522927[_0x7a6a('0x24')]:0x2,'scheduledat':_0x522927['scheduledat']?_0x522927['scheduledat']:moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')),'callback':_0x522927[_0x7a6a('0x25')]?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927[_0x7a6a('0x25')]?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'CampaignId':_0x9e695f['id']});})[_0x7a6a('0x26')](function(_0x1fcca9){_0x401cd9(_0x1fcca9);});});});};var _0x1abb86=function(_0x4c247d){return new BPromise(function(_0x52e662,_0x24ff89){_0x2f48ea(_0x4c247d,_0x522927)[_0x7a6a('0x1e')](function(_0x457219){_0x522927[_0x7a6a('0x18')]=_0x457219[_0x7a6a('0x27')];_0x526bf3[_0x7a6a('0x21')][_0x7a6a('0x22')]({'where':{'phone':_0x522927[_0x7a6a('0xe')],'CampaignId':_0x4c247d['id']}})[_0x7a6a('0x1e')](function(_0xfbedde){if(!_[_0x7a6a('0x1b')](_0xfbedde)){throw new Error('cmContact,\x20afterCreate\x20'+_0x522927[_0x7a6a('0xe')]+_0x7a6a('0x31')+_0x4c247d['id']);}return _0x526bf3[_0x7a6a('0x2a')][_0x7a6a('0x22')]({'where':{'calleridnum':_0x522927[_0x7a6a('0xe')],'CampaignId':_0x4c247d['id']}});})[_0x7a6a('0x1e')](function(_0x52ff1a){if(!_[_0x7a6a('0x1b')](_0x52ff1a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x522927[_0x7a6a('0xe')]+_0x7a6a('0x32')+_0x4c247d['id']);}return _0x526bf3[_0x7a6a('0x21')][_0x7a6a('0x33')]({'phone':_0x522927[_0x7a6a('0xe')],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'priority':_0x522927[_0x7a6a('0x24')]?_0x522927['priority']:0x2,'scheduledat':_0x522927[_0x7a6a('0x18')]?_0x522927['scheduledat']:moment()['format'](_0x7a6a('0x1a')),'callback':_0x522927[_0x7a6a('0x25')]?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927[_0x7a6a('0x25')]?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'CampaignId':_0x4c247d['id']});})[_0x7a6a('0x26')](function(_0x13e97f){_0x24ff89(_0x13e97f);});});});};if(_0x522927['ListId']){_0x526bf3[_0x7a6a('0x1d')]['findAll']({'where':{'type':_0x7a6a('0x34')},'attributes':['id','dialCheckDuplicateType',_0x7a6a('0x1c')],'include':[{'model':_0x526bf3[_0x7a6a('0x35')],'as':_0x7a6a('0x36'),'where':{'id':_0x522927[_0x7a6a('0x2c')]}}]})['then'](function(_0x1e69a0){if(_0x1e69a0){var _0x408237=[];for(var _0x20617c=0x0,_0x364678;_0x20617c<_0x1e69a0[_0x7a6a('0x37')];_0x20617c+=0x1){_0x364678=_0x1e69a0[_0x20617c]['get']({'plain':!![]});switch(_0x364678[_0x7a6a('0x38')]){case _0x7a6a('0x39'):_0x281028(_0x364678)[_0x7a6a('0x26')](_0x34379a());break;case _0x7a6a('0x3a'):_0x3d53f8(_0x364678)[_0x7a6a('0x26')](_0x34379a());break;default:_0x2f48ea(_0x364678,_0x522927)[_0x7a6a('0x1e')](function(_0x5dae6b){_0x522927[_0x7a6a('0x18')]=_0x5dae6b['ret'];_0x526bf3[_0x7a6a('0x21')][_0x7a6a('0x33')]({'phone':_0x522927[_0x7a6a('0xe')],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'scheduledat':_0x522927[_0x7a6a('0x18')]?_0x522927[_0x7a6a('0x18')]:moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')),'priority':_0x522927[_0x7a6a('0x24')]?_0x522927[_0x7a6a('0x24')]:0x2,'callback':_0x522927[_0x7a6a('0x25')]?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927[_0x7a6a('0x25')]?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'VoiceQueueId':_0x364678['id']})[_0x7a6a('0x26')](_0x34379a());});}}}})[_0x7a6a('0x1e')](function(){return _0x526bf3[_0x7a6a('0x1d')][_0x7a6a('0x3b')]({'where':{'type':_0x7a6a('0x34')},'attributes':['id'],'include':[{'model':_0x526bf3[_0x7a6a('0x35')],'as':'BlackLists','where':{'id':_0x522927[_0x7a6a('0x2c')]}}]})[_0x7a6a('0x1e')](function(_0xf37224){if(_0xf37224){var _0x649996=[];for(var _0x3db5d2=0x0,_0x34cf1e;_0x3db5d2<_0xf37224[_0x7a6a('0x37')];_0x3db5d2+=0x1){_0x34cf1e=_0xf37224[_0x3db5d2]['get']({'plain':!![]});_0x526bf3[_0x7a6a('0x3c')][_0x7a6a('0x33')]({'phone':_0x522927[_0x7a6a('0xe')],'ContactId':_0x522927['id'],'ListId':_0x522927['ListId'],'VoiceQueueId':_0x34cf1e['id']})[_0x7a6a('0x26')](function(_0x28ca42){logger[_0x7a6a('0x16')](_0x7a6a('0x3d'),_0x7a6a('0x2d'),_0x28ca42[_0x7a6a('0x3e')]);});}}});})['then'](function(){return _0x526bf3['Campaign'][_0x7a6a('0x3b')]({'attributes':['id',_0x7a6a('0x38'),_0x7a6a('0x1c')],'include':[{'model':_0x526bf3[_0x7a6a('0x35')],'as':_0x7a6a('0x36'),'where':{'id':_0x522927[_0x7a6a('0x2c')]}}]})['then'](function(_0x33ffbe){if(_0x33ffbe){var _0x1da208=[];for(var _0x340bfb=0x0,_0x39431e;_0x340bfb<_0x33ffbe[_0x7a6a('0x37')];_0x340bfb+=0x1){_0x39431e=_0x33ffbe[_0x340bfb][_0x7a6a('0x15')]({'plain':!![]});switch(_0x39431e[_0x7a6a('0x38')]){case _0x7a6a('0x39'):_0x1abb86(_0x39431e)[_0x7a6a('0x26')](_0x665a04());break;case _0x7a6a('0x3a'):_0x38b8cf(_0x39431e)[_0x7a6a('0x26')](_0x665a04());break;default:_0x526bf3[_0x7a6a('0x21')]['create']({'phone':_0x522927['phone'],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'scheduledat':_0x522927[_0x7a6a('0x18')]?_0x522927[_0x7a6a('0x18')]:moment()[_0x7a6a('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x522927['priority']?_0x522927[_0x7a6a('0x24')]:0x2,'callback':_0x522927['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x522927[_0x7a6a('0x25')]?_0x522927[_0x7a6a('0x25')]:undefined,'callbackat':_0x522927['callbackUniqueid']?moment()[_0x7a6a('0x19')](_0x7a6a('0x1a')):undefined,'CampaignId':_0x39431e['id']})[_0x7a6a('0x26')](_0x665a04());}}}});})[_0x7a6a('0x1e')](function(){return _0x526bf3['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x526bf3[_0x7a6a('0x35')],'as':_0x7a6a('0x3f'),'where':{'id':_0x522927[_0x7a6a('0x2c')]}}]})['then'](function(_0x1a2914){if(_0x1a2914){var _0x567c1c=[];for(var _0x45844a=0x0,_0x58ecde;_0x45844a<_0x1a2914['length'];_0x45844a+=0x1){_0x58ecde=_0x1a2914[_0x45844a]['get']({'plain':!![]});_0x526bf3[_0x7a6a('0x3c')][_0x7a6a('0x33')]({'phone':_0x522927[_0x7a6a('0xe')],'ContactId':_0x522927['id'],'ListId':_0x522927[_0x7a6a('0x2c')],'CampaignId':_0x58ecde['id']})[_0x7a6a('0x26')](function(_0x4994ef){logger['error'](_0x7a6a('0x3d'),_0x7a6a('0x2d'),_0x4994ef['message']);});}}});})['then'](function(){_0x493571();})[_0x7a6a('0x26')](function(_0x64a9b1){logger[_0x7a6a('0x16')](_0x7a6a('0x3d'),_0x7a6a('0x2d'),_0x64a9b1[_0x7a6a('0x3e')]);_0x493571(_0x64a9b1);});}else{_0x493571(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3124aa,_0x58eab0,_0x2d7ba7){var _0x4d8064=_0x37b56c[_0x7a6a('0x40')];var _0x31a8ed=_0x3124aa['get']({'plain':!![]});return _0x4d8064[_0x7a6a('0x21')][_0x7a6a('0x3b')]({'raw':!![],'where':{'ListId':_0x31a8ed[_0x7a6a('0x2c')],'ContactId':_0x31a8ed['id']}})[_0x7a6a('0x1e')](function(_0x29608a){if(!_[_0x7a6a('0x41')](_0x29608a)){var _0x271232=[];for(var _0x4f0cd7=0x0;_0x4f0cd7<_0x29608a[_0x7a6a('0x37')];_0x4f0cd7+=0x1){var _0x2f0eab=_0x4d8064[_0x7a6a('0x21')][_0x7a6a('0x42')]({'where':{'ListId':_0x29608a[_0x4f0cd7][_0x7a6a('0x2c')],'ContactId':_0x29608a[_0x4f0cd7][_0x7a6a('0x43')],'VoiceQueueId':_0x29608a[_0x4f0cd7]['VoiceQueueId'],'CampaignId':_0x29608a[_0x4f0cd7][_0x7a6a('0x44')]}});_0x271232['push'](_0x2f0eab);}return BPromise[_0x7a6a('0x45')](_0x271232);}})['then'](function(_0xbd5ea9){logger[_0x7a6a('0x46')](_0x7a6a('0x47'),util[_0x7a6a('0x2e')](_0xbd5ea9,{'showHidden':![],'depth':null}));_0x2d7ba7();})[_0x7a6a('0x26')](function(_0x33a3c5){logger[_0x7a6a('0x16')](_0x7a6a('0x48'),util['inspect'](_0x33a3c5,{'showHidden':![],'depth':null}));_0x2d7ba7(_0x33a3c5);});}}});}; \ No newline at end of file +var _0xf1f3=['cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','inspect','Campaign','timezones','\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','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf1f3,0xe8));var _0x3f1f=function(_0x4ad62a,_0x1fa4ab){_0x4ad62a=_0x4ad62a-0x0;var _0x94f0cc=_0xf1f3[_0x4ad62a];return _0x94f0cc;};'use strict';var _=require(_0x3f1f('0x0'));var util=require(_0x3f1f('0x1'));var logger=require(_0x3f1f('0x2'))(_0x3f1f('0x3'));var moment=require(_0x3f1f('0x4'));var BPromise=require(_0x3f1f('0x5'));var rp=require(_0x3f1f('0x6'));var fs=require('fs');var path=require(_0x3f1f('0x7'));var rimraf=require(_0x3f1f('0x8'));var config=require(_0x3f1f('0x9'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x3f1f('0xa')]=function(_0x50ed7e,_0x38a9c1){return _0x50ed7e['define']('CmContact',attributes,{'tableName':_0x3f1f('0xb'),'paranoid':!![],'indexes':[{'name':_0x3f1f('0xc'),'fields':[_0x3f1f('0xc')]},{'name':_0x3f1f('0xd'),'fields':[_0x3f1f('0xe'),'lastName','phone',_0x3f1f('0xf'),_0x3f1f('0x10'),'email'],'type':_0x3f1f('0x11')}],'timestamps':!![],'charset':_0x3f1f('0x12'),'collate':_0x3f1f('0x13'),'hooks':{'afterCreate':function(_0x55cce1,_0x1e82ee,_0x57e13b){var _0x3083a0=_0x50ed7e[_0x3f1f('0x14')];var _0x3342ed=_0x55cce1[_0x3f1f('0x15')]({'plain':!![]});function _0x3e011c(){return function(_0x16910a){logger[_0x3f1f('0x16')](_0x3f1f('0x17'),_0x3f1f('0x18'),util['inspect'](_0x16910a,{'showHidden':![],'depth':null}));};}function _0x3677bb(_0x3d0a9e,_0xba582b){var _0x41751b=_0xba582b[_0x3f1f('0x19')]?_0xba582b[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b'));return new BPromise(function(_0x354ccc,_0x443e1b){if(_[_0x3f1f('0x1c')](_0xba582b[_0x3f1f('0x1d')])){_0x354ccc({'ret':_0x41751b});}else{_0x3083a0[_0x3f1f('0x1e')][_0x3f1f('0x1f')]({'where':{'id':_0x3d0a9e['id']}})[_0x3f1f('0x20')](function(_0x46e9a0){if(!_['isNil'](_0x46e9a0)){var _0x2ce409=_0x46e9a0[_0x3f1f('0x1d')];if(!_[_0x3f1f('0x1c')](_0x2ce409)){var _0x5b86f0=shared['timezones'];var _0x4fcda3=_0x5b86f0[_0x2ce409];var _0x2266b7=_0x5b86f0[_0xba582b[_0x3f1f('0x1d')]];if(!_[_0x3f1f('0x1c')](_0x4fcda3)&&!_['isNil'](_0x2266b7)){var _0x533547=_0x4fcda3[_0x3f1f('0x21')]-_0x2266b7['utcOffset'];_0x41751b=_0xba582b[_0x3f1f('0x19')]?_0xba582b[_0x3f1f('0x19')]:moment();var _0x105bd7=moment(_0x41751b)[_0x3f1f('0x22')](_0x533547,'minutes');_0x354ccc({'ret':_0x105bd7['format'](_0x3f1f('0x1b'))});}else _0x354ccc({'ret':_0x41751b});}else _0x354ccc({'ret':_0x41751b});}else{_0x354ccc({'ret':_0x41751b});}});}});return 0xa;}var _0x134628=function(_0x149154){return new BPromise(function(_0x7ccb4c,_0x4f5b5b){_0x3677bb(_0x149154,_0x3342ed)[_0x3f1f('0x20')](function(_0x4ae5a9){_0x3342ed[_0x3f1f('0x19')]=_0x4ae5a9[_0x3f1f('0x23')];_0x3083a0['CmHopper'][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'VoiceQueueId':_0x149154['id']}})['then'](function(_0x1ca45b){if(!_[_0x3f1f('0x1c')](_0x1ca45b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x24')+_0x149154['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed['priority']:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed['callbackUniqueid']?moment()['format'](_0x3f1f('0x1b')):undefined,'VoiceQueueId':_0x149154['id']});})['catch'](function(_0x3d1c7a){_0x4f5b5b(_0x3d1c7a);});});});};var _0x446018=function(_0x420aee){return new BPromise(function(_0x344c1d,_0x24904c){_0x3677bb(_0x420aee,_0x3342ed)[_0x3f1f('0x20')](function(_0x20ad9e){_0x3342ed[_0x3f1f('0x19')]=_0x20ad9e[_0x3f1f('0x23')];_0x3083a0['CmHopper'][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'VoiceQueueId':_0x420aee['id']}})[_0x3f1f('0x20')](function(_0x1a1182){if(!_[_0x3f1f('0x1c')](_0x1a1182)){throw new Error(_0x3f1f('0x29')+_0x3342ed['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x420aee['id']);}return _0x3083a0[_0x3f1f('0x2a')][_0x3f1f('0x1f')]({'where':{'calleridnum':_0x3342ed['phone'],'VoiceQueueId':_0x420aee['id']}});})[_0x3f1f('0x20')](function(_0x5ce66b){if(!_[_0x3f1f('0x1c')](_0x5ce66b)){throw new Error(_0x3f1f('0x2b')+_0x3342ed['phone']+_0x3f1f('0x2c')+_0x420aee['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed['priority']:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x420aee['id']});})[_0x3f1f('0x2e')](function(_0x5968a4){_0x24904c(_0x5968a4);});});});};function _0x27826f(){return function(_0x20cb72){logger[_0x3f1f('0x16')](_0x3f1f('0x17'),_0x3f1f('0x18'),util[_0x3f1f('0x2f')](_0x20cb72,{'showHidden':![],'depth':null}));};}function _0x210f9d(_0x38b1f6,_0x5c4079){var _0x4e4aa7=_0x5c4079[_0x3f1f('0x19')]?_0x5c4079[_0x3f1f('0x19')]:moment()['format'](_0x3f1f('0x1b'));return new BPromise(function(_0x39540e,_0x61745d){if(_[_0x3f1f('0x1c')](_0x5c4079['dialTimezone'])){_0x39540e({'ret':_0x4e4aa7});}else{_0x3083a0[_0x3f1f('0x30')][_0x3f1f('0x1f')]({'where':{'id':_0x38b1f6['id']}})[_0x3f1f('0x20')](function(_0x5c0ca7){if(!_[_0x3f1f('0x1c')](_0x5c0ca7)){var _0x19a1f3=_0x5c0ca7[_0x3f1f('0x1d')];if(!_['isNil'](_0x19a1f3)){var _0x4e581c=shared[_0x3f1f('0x31')];var _0x60efeb=_0x4e581c[_0x19a1f3];var _0x59bf16=_0x4e581c[_0x5c4079[_0x3f1f('0x1d')]];if(!_[_0x3f1f('0x1c')](_0x60efeb)&&!_[_0x3f1f('0x1c')](_0x59bf16)){var _0x422bed=_0x60efeb[_0x3f1f('0x21')]-_0x59bf16['utcOffset'];_0x4e4aa7=_0x5c4079[_0x3f1f('0x19')]?_0x5c4079['scheduledat']:moment();var _0x539aa8=moment(_0x4e4aa7)[_0x3f1f('0x22')](_0x422bed,'minutes');_0x39540e({'ret':_0x539aa8[_0x3f1f('0x1a')](_0x3f1f('0x1b'))});}else _0x39540e({'ret':_0x4e4aa7});}else _0x39540e({'ret':_0x4e4aa7});}else{_0x39540e({'ret':_0x4e4aa7});}});}});return 0xa;}var _0x428f58=function(_0x4b3a23){return new BPromise(function(_0x4e494f,_0x3ade3a){_0x210f9d(_0x4b3a23,_0x3342ed)[_0x3f1f('0x20')](function(_0x132e15){_0x3342ed[_0x3f1f('0x19')]=_0x132e15['ret'];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x4b3a23['id']}})['then'](function(_0x1c9197){if(!_[_0x3f1f('0x1c')](_0x1c9197)){throw new Error(_0x3f1f('0x29')+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x32')+_0x4b3a23['id']);}return _0x3083a0['CmHopper'][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed[_0x3f1f('0x27')]:0x2,'scheduledat':_0x3342ed['scheduledat']?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')):undefined,'CampaignId':_0x4b3a23['id']});})['catch'](function(_0x47ebf6){_0x3ade3a(_0x47ebf6);});});});};var _0x359433=function(_0x559841){return new BPromise(function(_0xe19b7b,_0x41ef0b){_0x210f9d(_0x559841,_0x3342ed)[_0x3f1f('0x20')](function(_0x3b092f){_0x3342ed[_0x3f1f('0x19')]=_0x3b092f[_0x3f1f('0x23')];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x559841['id']}})[_0x3f1f('0x20')](function(_0x585e49){if(!_[_0x3f1f('0x1c')](_0x585e49)){throw new Error(_0x3f1f('0x29')+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x33')+_0x559841['id']);}return _0x3083a0[_0x3f1f('0x2a')][_0x3f1f('0x1f')]({'where':{'calleridnum':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x559841['id']}});})[_0x3f1f('0x20')](function(_0x34a1d6){if(!_['isNil'](_0x34a1d6)){throw new Error(_0x3f1f('0x2b')+_0x3342ed['phone']+_0x3f1f('0x34')+_0x559841['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed[_0x3f1f('0x27')]:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x559841['id']});})['catch'](function(_0x441405){_0x41ef0b(_0x441405);});});});};if(_0x3342ed['ListId']){_0x3083a0[_0x3f1f('0x1e')][_0x3f1f('0x35')]({'where':{'type':_0x3f1f('0x36')},'attributes':['id',_0x3f1f('0x37'),_0x3f1f('0x1d')],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x39'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x302fdf){if(_0x302fdf){var _0x136877=[];for(var _0xe29b2a=0x0,_0xb23628;_0xe29b2a<_0x302fdf[_0x3f1f('0x3a')];_0xe29b2a+=0x1){_0xb23628=_0x302fdf[_0xe29b2a][_0x3f1f('0x15')]({'plain':!![]});switch(_0xb23628[_0x3f1f('0x37')]){case _0x3f1f('0x3b'):_0x446018(_0xb23628)[_0x3f1f('0x2e')](_0x3e011c());break;case _0x3f1f('0x3c'):_0x134628(_0xb23628)[_0x3f1f('0x2e')](_0x3e011c());break;default:_0x210f9d(_0xb23628,_0x3342ed)[_0x3f1f('0x20')](function(_0x20d83a){_0x3342ed['scheduledat']=_0x20d83a[_0x3f1f('0x23')];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'priority':_0x3342ed['priority']?_0x3342ed[_0x3f1f('0x27')]:0x2,'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed[_0x3f1f('0x28')]?_0x3342ed['callbackUniqueid']:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xb23628['id']})['catch'](_0x3e011c());});}}}})[_0x3f1f('0x20')](function(){return _0x3083a0['VoiceQueue'][_0x3f1f('0x35')]({'where':{'type':_0x3f1f('0x36')},'attributes':['id'],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x3d'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x342e53){if(_0x342e53){var _0x1f8cf5=[];for(var _0x518063=0x0,_0x3f7e88;_0x518063<_0x342e53[_0x3f1f('0x3a')];_0x518063+=0x1){_0x3f7e88=_0x342e53[_0x518063][_0x3f1f('0x15')]({'plain':!![]});_0x3083a0[_0x3f1f('0x3e')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'VoiceQueueId':_0x3f7e88['id']})[_0x3f1f('0x2e')](function(_0x522de7){logger[_0x3f1f('0x16')]('cmContact,\x20%s,\x20%s',_0x3f1f('0x18'),_0x522de7[_0x3f1f('0x3f')]);});}}});})['then'](function(){return _0x3083a0['Campaign'][_0x3f1f('0x35')]({'attributes':['id','dialCheckDuplicateType',_0x3f1f('0x1d')],'include':[{'model':_0x3083a0['CmList'],'as':'Lists','where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x5cc556){if(_0x5cc556){var _0x594adf=[];for(var _0x373bf5=0x0,_0x4f9ef7;_0x373bf5<_0x5cc556[_0x3f1f('0x3a')];_0x373bf5+=0x1){_0x4f9ef7=_0x5cc556[_0x373bf5][_0x3f1f('0x15')]({'plain':!![]});switch(_0x4f9ef7[_0x3f1f('0x37')]){case _0x3f1f('0x3b'):_0x359433(_0x4f9ef7)[_0x3f1f('0x2e')](_0x27826f());break;case _0x3f1f('0x3c'):_0x428f58(_0x4f9ef7)[_0x3f1f('0x2e')](_0x27826f());break;default:_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3342ed['priority']?_0x3342ed[_0x3f1f('0x27')]:0x2,'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed[_0x3f1f('0x28')]?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed['callbackUniqueid']?moment()['format'](_0x3f1f('0x1b')):undefined,'CampaignId':_0x4f9ef7['id']})[_0x3f1f('0x2e')](_0x27826f());}}}});})['then'](function(){return _0x3083a0[_0x3f1f('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x3d'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x53b2bf){if(_0x53b2bf){var _0x2548d3=[];for(var _0x445ccd=0x0,_0x3d0e26;_0x445ccd<_0x53b2bf[_0x3f1f('0x3a')];_0x445ccd+=0x1){_0x3d0e26=_0x53b2bf[_0x445ccd][_0x3f1f('0x15')]({'plain':!![]});_0x3083a0['CmHopperBlack'][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'CampaignId':_0x3d0e26['id']})['catch'](function(_0x86f19c){logger[_0x3f1f('0x16')](_0x3f1f('0x40'),_0x3f1f('0x18'),_0x86f19c['message']);});}}});})[_0x3f1f('0x20')](function(){_0x57e13b();})['catch'](function(_0x3d80a1){logger['error'](_0x3f1f('0x40'),_0x3f1f('0x18'),_0x3d80a1['message']);_0x57e13b(_0x3d80a1);});}else{_0x57e13b(new Error(_0x3f1f('0x41')));}},'afterDestroy':function(_0x5aa267,_0x2845c1,_0x354f5f){var _0x3781de=_0x50ed7e[_0x3f1f('0x14')];var _0xd71360=_0x5aa267[_0x3f1f('0x15')]({'plain':!![]});return _0x3781de[_0x3f1f('0x25')]['findAll']({'raw':!![],'where':{'ListId':_0xd71360[_0x3f1f('0x2d')],'ContactId':_0xd71360['id']}})[_0x3f1f('0x20')](function(_0x45ff03){if(!_[_0x3f1f('0x42')](_0x45ff03)){var _0x5aa81e=[];for(var _0xb9f9df=0x0;_0xb9f9df<_0x45ff03[_0x3f1f('0x3a')];_0xb9f9df+=0x1){var _0xda45ce=_0x3781de[_0x3f1f('0x25')][_0x3f1f('0x43')]({'where':{'ListId':_0x45ff03[_0xb9f9df][_0x3f1f('0x2d')],'ContactId':_0x45ff03[_0xb9f9df][_0x3f1f('0x44')],'VoiceQueueId':_0x45ff03[_0xb9f9df][_0x3f1f('0x45')],'CampaignId':_0x45ff03[_0xb9f9df][_0x3f1f('0x46')]}});_0x5aa81e[_0x3f1f('0x47')](_0xda45ce);}return BPromise['all'](_0x5aa81e);}})[_0x3f1f('0x20')](function(_0x26adc8){logger[_0x3f1f('0x48')](_0x3f1f('0x49'),util[_0x3f1f('0x2f')](_0x26adc8,{'showHidden':![],'depth':null}));_0x354f5f();})[_0x3f1f('0x2e')](function(_0x3bfde8){logger['error']('[CmContact][afterDestroy][Error]',util[_0x3f1f('0x2f')](_0x3bfde8,{'showHidden':![],'depth':null}));_0x354f5f(_0x3bfde8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e71da84..ca86ab0 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x5ebe85,_0x15269f){var _0x3a4f85=function(_0x4f37ce){while(--_0x4f37ce){_0x5ebe85['push'](_0x5ebe85['shift']());}};_0x3a4f85(++_0x15269f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 2b07571..d9f3452 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 _0x7119=['STRING','PHONE','INTEGER','exports'];(function(_0x3ef6c9,_0xfb1bdd){var _0x4d513b=function(_0x7e1c81){while(--_0x7e1c81){_0x3ef6c9['push'](_0x3ef6c9['shift']());}};_0x4d513b(++_0xfb1bdd);}(_0x7119,0x1c7));var _0x9711=function(_0x568039,_0x570f8e){_0x568039=_0x568039-0x0;var _0x1595fc=_0x7119[_0x568039];return _0x1595fc;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9711('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9711('0x1')],'defaultValue':_0x9711('0x2')},'OrderBy':{'type':Sequelize[_0x9711('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x9711('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x4fdb=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x5505e5,_0x34bb84){var _0x2bc748=function(_0xe16af8){while(--_0xe16af8){_0x5505e5['push'](_0x5505e5['shift']());}};_0x2bc748(++_0x34bb84);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x5e38e1,_0xbfaba9){_0x5e38e1=_0x5e38e1-0x0;var _0x4c1253=_0x4fdb[_0x5e38e1];return _0x4c1253;};'use strict';var Sequelize=require(_0xb4fd('0x0'));module[_0xb4fd('0x1')]={'CmContactId':{'type':Sequelize[_0xb4fd('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb4fd('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb4fd('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb4fd('0x3')],'defaultValue':_0xb4fd('0x4')},'OrderBy':{'type':Sequelize[_0xb4fd('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xb4fd('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 9c604ab..a65d6c3 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 _0x8890=['key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type'];(function(_0x3bd83b,_0x2d4591){var _0x24abdc=function(_0x25ae9e){while(--_0x25ae9e){_0x3bd83b['push'](_0x3bd83b['shift']());}};_0x24abdc(++_0x2d4591);}(_0x8890,0x77));var _0x0889=function(_0xb17e70,_0x33df4d){_0xb17e70=_0xb17e70-0x0;var _0x12e359=_0x8890[_0xb17e70];return _0x12e359;};'use strict';var emlformat=require(_0x0889('0x0'));var rimraf=require(_0x0889('0x1'));var zipdir=require(_0x0889('0x2'));var jsonpatch=require(_0x0889('0x3'));var rp=require(_0x0889('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0889('0x5'));var sox=require(_0x0889('0x6'));var csv=require(_0x0889('0x7'));var ejs=require(_0x0889('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0889('0x9'));var crypto=require(_0x0889('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0889('0xb'));var toCsv=require(_0x0889('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0889('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0889('0xd'));var logger=require(_0x0889('0xe'))(_0x0889('0xf'));var utils=require(_0x0889('0x10'));var config=require(_0x0889('0x11'));var licenseUtil=require(_0x0889('0x12'));var db=require(_0x0889('0x13'))['db'];function respondWithStatusCode(_0x115045,_0x21bddd){_0x21bddd=_0x21bddd||0xcc;return function(_0x58d20c){if(_0x58d20c){return _0x115045[_0x0889('0x14')](_0x21bddd);}return _0x115045[_0x0889('0x15')](_0x21bddd)[_0x0889('0x16')]();};}function respondWithResult(_0x26402d,_0xe19d4a){_0xe19d4a=_0xe19d4a||0xc8;return function(_0x25e63c){if(_0x25e63c){return _0x26402d[_0x0889('0x15')](_0xe19d4a)[_0x0889('0x17')](_0x25e63c);}};}function respondWithFilteredResult(_0x2e80c5,_0x211db3){return function(_0xb37a8e){if(_0xb37a8e){var _0x33b480=typeof _0x211db3[_0x0889('0x18')]===_0x0889('0x19')&&typeof _0x211db3['limit']===_0x0889('0x19');var _0xa6a0b6=_0xb37a8e['count'];var _0x525210=_0x33b480?0x0:_0x211db3[_0x0889('0x18')];var _0x172445=_0x33b480?_0xb37a8e[_0x0889('0x1a')]:_0x211db3[_0x0889('0x18')]+_0x211db3['limit'];var _0x23093b;if(_0x172445>=_0xa6a0b6){_0x172445=_0xa6a0b6;_0x23093b=0xc8;}else{_0x23093b=0xce;}_0x2e80c5[_0x0889('0x15')](_0x23093b);return _0x2e80c5[_0x0889('0x1b')](_0x0889('0x1c'),_0x525210+'-'+_0x172445+'/'+_0xa6a0b6)[_0x0889('0x17')](_0xb37a8e);}return null;};}function patchUpdates(_0x26a9a7){return function(_0x1e23e9){try{jsonpatch[_0x0889('0x1d')](_0x1e23e9,_0x26a9a7,!![]);}catch(_0x818cda){return BPromise['reject'](_0x818cda);}return _0x1e23e9[_0x0889('0x1e')]();};}function saveUpdates(_0x15ac1,_0x3ff743){return function(_0x5514ce){if(_0x5514ce){return _0x5514ce['update'](_0x15ac1)['then'](function(_0x18505b){return _0x18505b;});}return null;};}function removeEntity(_0x54d96f,_0x2e987d){return function(_0x144e7d){if(_0x144e7d){return _0x144e7d['destroy']()[_0x0889('0x1f')](function(){var _0x1dd61d=_0x144e7d[_0x0889('0x20')]({'plain':!![]});var _0x57d0d0='CmContactHasItems';return db[_0x0889('0x21')][_0x0889('0x22')]({'where':{'type':_0x57d0d0,'resourceId':_0x1dd61d['id']}})[_0x0889('0x1f')](function(){return _0x144e7d;});})[_0x0889('0x1f')](function(){_0x54d96f[_0x0889('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29fee9,_0x8c00b7){return function(_0x1f2b18){if(!_0x1f2b18){_0x29fee9[_0x0889('0x14')](0x194);}return _0x1f2b18;};}function handleError(_0x3a6850,_0x4a72d8){_0x4a72d8=_0x4a72d8||0x1f4;return function(_0x30d4ad){logger[_0x0889('0x23')](_0x30d4ad[_0x0889('0x24')]);if(_0x30d4ad[_0x0889('0x25')]){delete _0x30d4ad[_0x0889('0x25')];}_0x3a6850[_0x0889('0x15')](_0x4a72d8)[_0x0889('0x26')](_0x30d4ad);};}exports[_0x0889('0x27')]=function(_0xb01e5,_0x50a927){var _0x43a9a3={},_0x48f168={},_0x1f8874={'count':0x0,'rows':[]};var _0x4e05fe=_[_0x0889('0x28')](db[_0x0889('0x29')][_0x0889('0x2a')],function(_0x27bd7d){return{'name':_0x27bd7d[_0x0889('0x2b')],'type':_0x27bd7d[_0x0889('0x2c')][_0x0889('0x2d')]};});_0x48f168[_0x0889('0x2e')]=_[_0x0889('0x28')](_0x4e05fe,_0x0889('0x25'));_0x48f168[_0x0889('0x2f')]=_[_0x0889('0x30')](_0xb01e5[_0x0889('0x2f')]);_0x48f168[_0x0889('0x31')]=_['intersection'](_0x48f168[_0x0889('0x2e')],_0x48f168['query']);_0x43a9a3[_0x0889('0x32')]=_[_0x0889('0x33')](_0x48f168[_0x0889('0x2e')],qs[_0x0889('0x34')](_0xb01e5['query']['fields']));_0x43a9a3[_0x0889('0x32')]=_0x43a9a3[_0x0889('0x32')][_0x0889('0x35')]?_0x43a9a3[_0x0889('0x32')]:_0x48f168[_0x0889('0x2e')];if(!_0xb01e5[_0x0889('0x2f')]['hasOwnProperty'](_0x0889('0x36'))){_0x43a9a3[_0x0889('0x37')]=qs[_0x0889('0x37')](_0xb01e5[_0x0889('0x2f')][_0x0889('0x37')]);_0x43a9a3[_0x0889('0x18')]=qs[_0x0889('0x18')](_0xb01e5[_0x0889('0x2f')][_0x0889('0x18')]);}_0x43a9a3[_0x0889('0x38')]=qs[_0x0889('0x39')](_0xb01e5[_0x0889('0x2f')][_0x0889('0x39')]);_0x43a9a3[_0x0889('0x3a')]=qs['filters'](_[_0x0889('0x3b')](_0xb01e5[_0x0889('0x2f')],_0x48f168[_0x0889('0x31')]),_0x4e05fe);if(_0xb01e5[_0x0889('0x2f')][_0x0889('0x3c')]){_0x43a9a3['where']=_[_0x0889('0x3d')](_0x43a9a3[_0x0889('0x3a')],{'$or':_[_0x0889('0x28')](_0x4e05fe,function(_0x5c39b1){if(_0x5c39b1[_0x0889('0x2c')]!==_0x0889('0x3e')){var _0x229e1f={};_0x229e1f[_0x5c39b1[_0x0889('0x25')]]={'$like':'%'+_0xb01e5[_0x0889('0x2f')][_0x0889('0x3c')]+'%'};return _0x229e1f;}})});}_0x43a9a3=_[_0x0889('0x3d')]({},_0x43a9a3,_0xb01e5['options']);var _0x11a2c3={'where':_0x43a9a3[_0x0889('0x3a')]};return db['CmContactHasItem'][_0x0889('0x1a')](_0x11a2c3)[_0x0889('0x1f')](function(_0x30ce2c){_0x1f8874[_0x0889('0x1a')]=_0x30ce2c;if(_0xb01e5['query'][_0x0889('0x3f')]){_0x43a9a3[_0x0889('0x40')]=[{'all':!![]}];}return db[_0x0889('0x29')][_0x0889('0x41')](_0x43a9a3);})[_0x0889('0x1f')](function(_0x5c2199){_0x1f8874[_0x0889('0x42')]=_0x5c2199;return _0x1f8874;})['then'](respondWithFilteredResult(_0x50a927,_0x43a9a3))[_0x0889('0x43')](handleError(_0x50a927,null));};exports['show']=function(_0x16f272,_0xc4ffa0){var _0x3ee063={'raw':!![],'where':{'id':_0x16f272[_0x0889('0x44')]['id']}},_0x53c822={};_0x53c822[_0x0889('0x2e')]=_[_0x0889('0x30')](db[_0x0889('0x29')][_0x0889('0x2a')]);_0x53c822['query']=_[_0x0889('0x30')](_0x16f272['query']);_0x53c822[_0x0889('0x31')]=_[_0x0889('0x33')](_0x53c822[_0x0889('0x2e')],_0x53c822[_0x0889('0x2f')]);_0x3ee063['attributes']=_[_0x0889('0x33')](_0x53c822[_0x0889('0x2e')],qs[_0x0889('0x34')](_0x16f272[_0x0889('0x2f')][_0x0889('0x34')]));_0x3ee063[_0x0889('0x32')]=_0x3ee063['attributes']['length']?_0x3ee063[_0x0889('0x32')]:_0x53c822[_0x0889('0x2e')];if(_0x16f272[_0x0889('0x2f')][_0x0889('0x3f')]){_0x3ee063[_0x0889('0x40')]=[{'all':!![]}];}_0x3ee063=_[_0x0889('0x3d')]({},_0x3ee063,_0x16f272[_0x0889('0x45')]);return db[_0x0889('0x29')][_0x0889('0x46')](_0x3ee063)[_0x0889('0x1f')](handleEntityNotFound(_0xc4ffa0,null))[_0x0889('0x1f')](respondWithResult(_0xc4ffa0,null))[_0x0889('0x43')](handleError(_0xc4ffa0,null));};exports['create']=function(_0xea7a86,_0x22fa1d){return db['CmContactHasItem'][_0x0889('0x47')](_0xea7a86[_0x0889('0x48')],{})[_0x0889('0x1f')](function(_0x167312){var _0x57b0d3=_0xea7a86['user'][_0x0889('0x20')]({'plain':!![]});if(!_0x57b0d3)throw new Error(_0x0889('0x49'));if(_0x57b0d3[_0x0889('0x4a')]===_0x0889('0x4b')){var _0x5a8abc=_0x167312[_0x0889('0x20')]({'plain':!![]});var _0x56ee2c=_0x0889('0x4c');return db[_0x0889('0x4d')][_0x0889('0x46')]({'where':{'name':_0x56ee2c,'userProfileId':_0x57b0d3[_0x0889('0x4e')]},'raw':!![]})[_0x0889('0x1f')](function(_0x1aa47a){if(_0x1aa47a&&_0x1aa47a[_0x0889('0x4f')]===0x0){return db[_0x0889('0x21')][_0x0889('0x47')]({'name':_0x5a8abc[_0x0889('0x25')],'resourceId':_0x5a8abc['id'],'type':_0x1aa47a[_0x0889('0x25')],'sectionId':_0x1aa47a['id']},{})[_0x0889('0x1f')](function(){return _0x167312;});}else{return _0x167312;}})[_0x0889('0x43')](function(_0x2e2bf8){logger[_0x0889('0x23')](_0x0889('0x50'),_0x2e2bf8);throw _0x2e2bf8;});}return _0x167312;})[_0x0889('0x1f')](respondWithResult(_0x22fa1d,0xc9))[_0x0889('0x43')](handleError(_0x22fa1d,null));};exports[_0x0889('0x51')]=function(_0x3546f8,_0x2a1753){if(_0x3546f8[_0x0889('0x48')]['id']){delete _0x3546f8['body']['id'];}return db[_0x0889('0x29')][_0x0889('0x46')]({'where':{'id':_0x3546f8[_0x0889('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a1753,null))['then'](saveUpdates(_0x3546f8['body'],null))[_0x0889('0x1f')](respondWithResult(_0x2a1753,null))['catch'](handleError(_0x2a1753,null));};exports[_0x0889('0x22')]=function(_0xea40cd,_0x1236b0){return db['CmContactHasItem'][_0x0889('0x46')]({'where':{'id':_0xea40cd['params']['id']}})['then'](handleEntityNotFound(_0x1236b0,null))[_0x0889('0x1f')](removeEntity(_0x1236b0,null))[_0x0889('0x43')](handleError(_0x1236b0,null));}; \ No newline at end of file +var _0x2f79=['catch','show','params','rawAttributes','fields','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','CmContactHasItem','findAll','rows'];(function(_0x4ac00f,_0x356690){var _0x535bef=function(_0x496c7a){while(--_0x496c7a){_0x4ac00f['push'](_0x4ac00f['shift']());}};_0x535bef(++_0x356690);}(_0x2f79,0x103));var _0x92f7=function(_0x52fc85,_0x963a91){_0x52fc85=_0x52fc85-0x0;var _0x18c3d9=_0x2f79[_0x52fc85];return _0x18c3d9;};'use strict';var emlformat=require(_0x92f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x92f7('0x1'));var rp=require(_0x92f7('0x2'));var moment=require(_0x92f7('0x3'));var BPromise=require(_0x92f7('0x4'));var Mustache=require(_0x92f7('0x5'));var util=require(_0x92f7('0x6'));var path=require(_0x92f7('0x7'));var sox=require('sox');var csv=require(_0x92f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f7('0x9'));var _=require(_0x92f7('0xa'));var squel=require(_0x92f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x92f7('0xc'));var deskjs=require(_0x92f7('0xd'));var toCsv=require(_0x92f7('0x8'));var querystring=require(_0x92f7('0xe'));var Papa=require(_0x92f7('0xf'));var Redis=require('ioredis');var authService=require(_0x92f7('0x10'));var qs=require(_0x92f7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92f7('0x12'));var utils=require('../../config/utils');var config=require(_0x92f7('0x13'));var licenseUtil=require(_0x92f7('0x14'));var db=require(_0x92f7('0x15'))['db'];function respondWithStatusCode(_0x5234e0,_0x37e623){_0x37e623=_0x37e623||0xcc;return function(_0x5c546c){if(_0x5c546c){return _0x5234e0[_0x92f7('0x16')](_0x37e623);}return _0x5234e0[_0x92f7('0x17')](_0x37e623)[_0x92f7('0x18')]();};}function respondWithResult(_0x8ae538,_0x70b8e7){_0x70b8e7=_0x70b8e7||0xc8;return function(_0x2e3cef){if(_0x2e3cef){return _0x8ae538[_0x92f7('0x17')](_0x70b8e7)[_0x92f7('0x19')](_0x2e3cef);}};}function respondWithFilteredResult(_0x4c2903,_0x59453e){return function(_0x2ba257){if(_0x2ba257){var _0x7c3466=typeof _0x59453e['offset']===_0x92f7('0x1a')&&typeof _0x59453e[_0x92f7('0x1b')]===_0x92f7('0x1a');var _0x10c321=_0x2ba257[_0x92f7('0x1c')];var _0x3efcdc=_0x7c3466?0x0:_0x59453e[_0x92f7('0x1d')];var _0x2ba55b=_0x7c3466?_0x2ba257[_0x92f7('0x1c')]:_0x59453e[_0x92f7('0x1d')]+_0x59453e[_0x92f7('0x1b')];var _0x506a29;if(_0x2ba55b>=_0x10c321){_0x2ba55b=_0x10c321;_0x506a29=0xc8;}else{_0x506a29=0xce;}_0x4c2903[_0x92f7('0x17')](_0x506a29);return _0x4c2903[_0x92f7('0x1e')](_0x92f7('0x1f'),_0x3efcdc+'-'+_0x2ba55b+'/'+_0x10c321)[_0x92f7('0x19')](_0x2ba257);}return null;};}function patchUpdates(_0x565fee){return function(_0x3ee83f){try{jsonpatch[_0x92f7('0x20')](_0x3ee83f,_0x565fee,!![]);}catch(_0x1033c8){return BPromise[_0x92f7('0x21')](_0x1033c8);}return _0x3ee83f['save']();};}function saveUpdates(_0x47c134,_0x255461){return function(_0x482d4f){if(_0x482d4f){return _0x482d4f[_0x92f7('0x22')](_0x47c134)[_0x92f7('0x23')](function(_0x277741){return _0x277741;});}return null;};}function removeEntity(_0x3c64b7,_0x24e631){return function(_0x32362f){if(_0x32362f){return _0x32362f['destroy']()['then'](function(){var _0x212840=_0x32362f[_0x92f7('0x24')]({'plain':!![]});var _0x593f50='CmContactHasItems';return db[_0x92f7('0x25')][_0x92f7('0x26')]({'where':{'type':_0x593f50,'resourceId':_0x212840['id']}})[_0x92f7('0x23')](function(){return _0x32362f;});})[_0x92f7('0x23')](function(){_0x3c64b7['status'](0xcc)[_0x92f7('0x18')]();});}};}function handleEntityNotFound(_0x24bebe,_0x34ed58){return function(_0x1676d0){if(!_0x1676d0){_0x24bebe[_0x92f7('0x16')](0x194);}return _0x1676d0;};}function handleError(_0x28d6c7,_0x9fc30b){_0x9fc30b=_0x9fc30b||0x1f4;return function(_0x551663){logger[_0x92f7('0x27')](_0x551663[_0x92f7('0x28')]);if(_0x551663[_0x92f7('0x29')]){delete _0x551663[_0x92f7('0x29')];}_0x28d6c7[_0x92f7('0x17')](_0x9fc30b)[_0x92f7('0x2a')](_0x551663);};}exports[_0x92f7('0x2b')]=function(_0x343796,_0x180cca){var _0x278bed={},_0x26dc48={},_0x1dfa5f={'count':0x0,'rows':[]};var _0x6a3b6c=_[_0x92f7('0x2c')](db['CmContactHasItem']['rawAttributes'],function(_0x4a2c08){return{'name':_0x4a2c08['fieldName'],'type':_0x4a2c08[_0x92f7('0x2d')]['key']};});_0x26dc48[_0x92f7('0x2e')]=_[_0x92f7('0x2c')](_0x6a3b6c,_0x92f7('0x29'));_0x26dc48['query']=_[_0x92f7('0x2f')](_0x343796[_0x92f7('0x30')]);_0x26dc48[_0x92f7('0x31')]=_[_0x92f7('0x32')](_0x26dc48[_0x92f7('0x2e')],_0x26dc48['query']);_0x278bed['attributes']=_[_0x92f7('0x32')](_0x26dc48['model'],qs['fields'](_0x343796[_0x92f7('0x30')]['fields']));_0x278bed[_0x92f7('0x33')]=_0x278bed[_0x92f7('0x33')][_0x92f7('0x34')]?_0x278bed[_0x92f7('0x33')]:_0x26dc48[_0x92f7('0x2e')];if(!_0x343796['query'][_0x92f7('0x35')]('nolimit')){_0x278bed[_0x92f7('0x1b')]=qs[_0x92f7('0x1b')](_0x343796['query'][_0x92f7('0x1b')]);_0x278bed[_0x92f7('0x1d')]=qs[_0x92f7('0x1d')](_0x343796[_0x92f7('0x30')][_0x92f7('0x1d')]);}_0x278bed[_0x92f7('0x36')]=qs['sort'](_0x343796[_0x92f7('0x30')][_0x92f7('0x37')]);_0x278bed[_0x92f7('0x38')]=qs[_0x92f7('0x31')](_['pick'](_0x343796['query'],_0x26dc48['filters']),_0x6a3b6c);if(_0x343796['query'][_0x92f7('0x39')]){_0x278bed[_0x92f7('0x38')]=_['merge'](_0x278bed['where'],{'$or':_['map'](_0x6a3b6c,function(_0xbc2195){if(_0xbc2195[_0x92f7('0x2d')]!==_0x92f7('0x3a')){var _0x41f618={};_0x41f618[_0xbc2195[_0x92f7('0x29')]]={'$like':'%'+_0x343796[_0x92f7('0x30')][_0x92f7('0x39')]+'%'};return _0x41f618;}})});}_0x278bed=_[_0x92f7('0x3b')]({},_0x278bed,_0x343796[_0x92f7('0x3c')]);var _0x2800ba={'where':_0x278bed[_0x92f7('0x38')]};return db['CmContactHasItem'][_0x92f7('0x1c')](_0x2800ba)[_0x92f7('0x23')](function(_0x416a7d){_0x1dfa5f[_0x92f7('0x1c')]=_0x416a7d;if(_0x343796['query'][_0x92f7('0x3d')]){_0x278bed['include']=[{'all':!![]}];}return db[_0x92f7('0x3e')][_0x92f7('0x3f')](_0x278bed);})[_0x92f7('0x23')](function(_0x29ac0c){_0x1dfa5f[_0x92f7('0x40')]=_0x29ac0c;return _0x1dfa5f;})['then'](respondWithFilteredResult(_0x180cca,_0x278bed))[_0x92f7('0x41')](handleError(_0x180cca,null));};exports[_0x92f7('0x42')]=function(_0x778126,_0x2a8df8){var _0x577918={'raw':!![],'where':{'id':_0x778126[_0x92f7('0x43')]['id']}},_0x56e3de={};_0x56e3de[_0x92f7('0x2e')]=_[_0x92f7('0x2f')](db[_0x92f7('0x3e')][_0x92f7('0x44')]);_0x56e3de[_0x92f7('0x30')]=_[_0x92f7('0x2f')](_0x778126[_0x92f7('0x30')]);_0x56e3de['filters']=_['intersection'](_0x56e3de[_0x92f7('0x2e')],_0x56e3de[_0x92f7('0x30')]);_0x577918[_0x92f7('0x33')]=_[_0x92f7('0x32')](_0x56e3de[_0x92f7('0x2e')],qs[_0x92f7('0x45')](_0x778126['query'][_0x92f7('0x45')]));_0x577918[_0x92f7('0x33')]=_0x577918[_0x92f7('0x33')]['length']?_0x577918['attributes']:_0x56e3de['model'];if(_0x778126[_0x92f7('0x30')][_0x92f7('0x3d')]){_0x577918[_0x92f7('0x46')]=[{'all':!![]}];}_0x577918=_[_0x92f7('0x3b')]({},_0x577918,_0x778126[_0x92f7('0x3c')]);return db[_0x92f7('0x3e')][_0x92f7('0x47')](_0x577918)['then'](handleEntityNotFound(_0x2a8df8,null))['then'](respondWithResult(_0x2a8df8,null))[_0x92f7('0x41')](handleError(_0x2a8df8,null));};exports['create']=function(_0x56f546,_0xb3f2fa){return db['CmContactHasItem']['create'](_0x56f546[_0x92f7('0x48')],{})['then'](function(_0x38d5f6){var _0x450c46=_0x56f546[_0x92f7('0x49')][_0x92f7('0x24')]({'plain':!![]});if(!_0x450c46)throw new Error(_0x92f7('0x4a'));if(_0x450c46[_0x92f7('0x4b')]===_0x92f7('0x49')){var _0x5f1fd4=_0x38d5f6[_0x92f7('0x24')]({'plain':!![]});var _0x3c1f49='CmContactHasItems';return db[_0x92f7('0x4c')][_0x92f7('0x47')]({'where':{'name':_0x3c1f49,'userProfileId':_0x450c46[_0x92f7('0x4d')]},'raw':!![]})[_0x92f7('0x23')](function(_0x351a15){if(_0x351a15&&_0x351a15[_0x92f7('0x4e')]===0x0){return db[_0x92f7('0x25')][_0x92f7('0x4f')]({'name':_0x5f1fd4[_0x92f7('0x29')],'resourceId':_0x5f1fd4['id'],'type':_0x351a15[_0x92f7('0x29')],'sectionId':_0x351a15['id']},{})[_0x92f7('0x23')](function(){return _0x38d5f6;});}else{return _0x38d5f6;}})[_0x92f7('0x41')](function(_0x4ced4e){logger[_0x92f7('0x27')](_0x92f7('0x50'),_0x4ced4e);throw _0x4ced4e;});}return _0x38d5f6;})[_0x92f7('0x23')](respondWithResult(_0xb3f2fa,0xc9))[_0x92f7('0x41')](handleError(_0xb3f2fa,null));};exports[_0x92f7('0x22')]=function(_0x2def0d,_0x2d5c86){if(_0x2def0d[_0x92f7('0x48')]['id']){delete _0x2def0d[_0x92f7('0x48')]['id'];}return db[_0x92f7('0x3e')][_0x92f7('0x47')]({'where':{'id':_0x2def0d[_0x92f7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d5c86,null))[_0x92f7('0x23')](saveUpdates(_0x2def0d['body'],null))[_0x92f7('0x23')](respondWithResult(_0x2d5c86,null))[_0x92f7('0x41')](handleError(_0x2d5c86,null));};exports['destroy']=function(_0x105a08,_0x499745){return db[_0x92f7('0x3e')][_0x92f7('0x47')]({'where':{'id':_0x105a08['params']['id']}})[_0x92f7('0x23')](handleEntityNotFound(_0x499745,null))[_0x92f7('0x23')](removeEntity(_0x499745,null))['catch'](handleError(_0x499745,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 954f8e1..3fff51c 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 _0x38d3=['bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api'];(function(_0x1c4d77,_0x4de364){var _0x41e109=function(_0x390da2){while(--_0x390da2){_0x1c4d77['push'](_0x1c4d77['shift']());}};_0x41e109(++_0x4de364);}(_0x38d3,0x1e1));var _0x338d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x38d3[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x338d('0x0'));var util=require('util');var logger=require(_0x338d('0x1'))(_0x338d('0x2'));var moment=require('moment');var BPromise=require(_0x338d('0x3'));var rp=require(_0x338d('0x4'));var fs=require('fs');var path=require(_0x338d('0x5'));var rimraf=require('rimraf');var config=require(_0x338d('0x6'));var attributes=require(_0x338d('0x7'));module[_0x338d('0x8')]=function(_0x9804d4,_0x5d8150){return _0x9804d4['define'](_0x338d('0x9'),attributes,{'tableName':_0x338d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x901b=['request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5521ae,_0x40c4c4){var _0x85cf17=function(_0x2dae39){while(--_0x2dae39){_0x5521ae['push'](_0x5521ae['shift']());}};_0x85cf17(++_0x40c4c4);}(_0x901b,0x125));var _0xb901=function(_0x100623,_0x311484){_0x100623=_0x100623-0x0;var _0x21b00f=_0x901b[_0x100623];return _0x21b00f;};'use strict';var _=require(_0xb901('0x0'));var util=require(_0xb901('0x1'));var logger=require(_0xb901('0x2'))(_0xb901('0x3'));var moment=require(_0xb901('0x4'));var BPromise=require(_0xb901('0x5'));var rp=require(_0xb901('0x6'));var fs=require('fs');var path=require(_0xb901('0x7'));var rimraf=require('rimraf');var config=require(_0xb901('0x8'));var attributes=require(_0xb901('0x9'));module[_0xb901('0xa')]=function(_0x427637,_0x25f067){return _0x427637[_0xb901('0xb')](_0xb901('0xc'),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 599b1e4..5d17fe5 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 _0xff49=['then','CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x127539,_0x58cb14){var _0x359376=function(_0x3eea32){while(--_0x3eea32){_0x127539['push'](_0x127539['shift']());}};_0x359376(++_0x58cb14);}(_0xff49,0x155));var _0x9ff4=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xff49[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x9ff4('0x0'));var util=require('util');var moment=require(_0x9ff4('0x1'));var BPromise=require(_0x9ff4('0x2'));var rs=require(_0x9ff4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ff4('0x4'))['db'];var utils=require(_0x9ff4('0x5'));var logger=require(_0x9ff4('0x6'))(_0x9ff4('0x7'));var config=require(_0x9ff4('0x8'));var jayson=require(_0x9ff4('0x9'));var client=jayson['client'][_0x9ff4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cce02,_0xb2db81,_0x525835){return new BPromise(function(_0x3680a5,_0xe39d24){return client['request'](_0x3cce02,_0x525835)[_0x9ff4('0xb')](function(_0x302b15){logger['info'](_0x9ff4('0xc'),_0xb2db81,'request\x20sent');logger['debug'](_0x9ff4('0xd'),_0xb2db81,_0x9ff4('0xe'),JSON[_0x9ff4('0xf')](_0x302b15));if(_0x302b15[_0x9ff4('0x10')]){if(_0x302b15['error'][_0x9ff4('0x11')]===0x1f4){logger[_0x9ff4('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0xb2db81,_0x302b15[_0x9ff4('0x10')][_0x9ff4('0x12')]);return _0xe39d24(_0x302b15[_0x9ff4('0x10')][_0x9ff4('0x12')]);}logger[_0x9ff4('0x10')](_0x9ff4('0xc'),_0xb2db81,_0x302b15[_0x9ff4('0x10')][_0x9ff4('0x12')]);return _0x3680a5(_0x302b15[_0x9ff4('0x10')][_0x9ff4('0x12')]);}else{logger[_0x9ff4('0x13')](_0x9ff4('0xc'),_0xb2db81,_0x9ff4('0xe'));_0x3680a5(_0x302b15[_0x9ff4('0x14')][_0x9ff4('0x12')]);}})[_0x9ff4('0x15')](function(_0x4a3f49){logger[_0x9ff4('0x10')](_0x9ff4('0xc'),_0xb2db81,_0x4a3f49);_0xe39d24(_0x4a3f49);});});} \ No newline at end of file +var _0x2671=['debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x12f08d,_0x5f13b3){var _0x3a49cd=function(_0x39c753){while(--_0x39c753){_0x12f08d['push'](_0x12f08d['shift']());}};_0x3a49cd(++_0x5f13b3);}(_0x2671,0x1e9));var _0x1267=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2671[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x1267('0x0'));var util=require(_0x1267('0x1'));var moment=require(_0x1267('0x2'));var BPromise=require(_0x1267('0x3'));var rs=require(_0x1267('0x4'));var fs=require('fs');var Redis=require(_0x1267('0x5'));var db=require(_0x1267('0x6'))['db'];var utils=require(_0x1267('0x7'));var logger=require(_0x1267('0x8'))(_0x1267('0x9'));var config=require('../../config/environment');var jayson=require(_0x1267('0xa'));var client=jayson[_0x1267('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c8dc4,_0x4f1011,_0x5ba4d8){return new BPromise(function(_0x2ed248,_0xd36caf){return client['request'](_0x4c8dc4,_0x5ba4d8)[_0x1267('0xc')](function(_0x514cad){logger[_0x1267('0xd')](_0x1267('0xe'),_0x4f1011,'request\x20sent');logger[_0x1267('0xf')](_0x1267('0x10'),_0x4f1011,_0x1267('0x11'),JSON[_0x1267('0x12')](_0x514cad));if(_0x514cad['error']){if(_0x514cad[_0x1267('0x13')][_0x1267('0x14')]===0x1f4){logger[_0x1267('0x13')](_0x1267('0xe'),_0x4f1011,_0x514cad[_0x1267('0x13')][_0x1267('0x15')]);return _0xd36caf(_0x514cad['error'][_0x1267('0x15')]);}logger['error'](_0x1267('0xe'),_0x4f1011,_0x514cad[_0x1267('0x13')]['message']);return _0x2ed248(_0x514cad['error'][_0x1267('0x15')]);}else{logger[_0x1267('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x4f1011,_0x1267('0x11'));_0x2ed248(_0x514cad[_0x1267('0x16')][_0x1267('0x15')]);}})[_0x1267('0x17')](function(_0x1b8c61){logger[_0x1267('0x13')](_0x1267('0xe'),_0x4f1011,_0x1b8c61);_0xd36caf(_0x1b8c61);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6d41e16..476069a 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 _0x865c=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4fe123,_0x362922){var _0x3fb8a3=function(_0x241939){while(--_0x241939){_0x4fe123['push'](_0x4fe123['shift']());}};_0x3fb8a3(++_0x362922);}(_0x865c,0x158));var _0xc865=function(_0xfd9b61,_0x1fdad6){_0xfd9b61=_0xfd9b61-0x0;var _0x46c759=_0x865c[_0xfd9b61];return _0x46c759;};'use strict';var multer=require(_0xc865('0x0'));var util=require(_0xc865('0x1'));var path=require(_0xc865('0x2'));var timeout=require(_0xc865('0x3'));var express=require('express');var router=express[_0xc865('0x4')]();var fs_extra=require(_0xc865('0x5'));var auth=require(_0xc865('0x6'));var interaction=require(_0xc865('0x7'));var config=require(_0xc865('0x8'));var controller=require(_0xc865('0x9'));router[_0xc865('0xa')]('/',auth[_0xc865('0xb')](),controller[_0xc865('0xc')]);router[_0xc865('0xa')](_0xc865('0xd'),auth['isAuthenticated'](),controller[_0xc865('0xe')]);router[_0xc865('0xf')]('/',auth[_0xc865('0xb')](),controller['create']);router[_0xc865('0x10')]('/:id',auth[_0xc865('0xb')](),controller[_0xc865('0x11')]);router[_0xc865('0x12')](_0xc865('0xd'),auth[_0xc865('0xb')](),controller['destroy']);module[_0xc865('0x13')]=router; \ No newline at end of file +var _0x580c=['/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x580c,0x1a0));var _0xc580=function(_0x4a2936,_0x42d86c){_0x4a2936=_0x4a2936-0x0;var _0x15ffb4=_0x580c[_0x4a2936];return _0x15ffb4;};'use strict';var multer=require(_0xc580('0x0'));var util=require(_0xc580('0x1'));var path=require(_0xc580('0x2'));var timeout=require(_0xc580('0x3'));var express=require('express');var router=express[_0xc580('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc580('0x5'));var interaction=require(_0xc580('0x6'));var config=require('../../config/environment');var controller=require(_0xc580('0x7'));router[_0xc580('0x8')]('/',auth[_0xc580('0x9')](),controller[_0xc580('0xa')]);router[_0xc580('0x8')]('/:id',auth[_0xc580('0x9')](),controller[_0xc580('0xb')]);router[_0xc580('0xc')]('/',auth[_0xc580('0x9')](),controller[_0xc580('0xd')]);router[_0xc580('0xe')]('/:id',auth[_0xc580('0x9')](),controller[_0xc580('0xf')]);router['delete'](_0xc580('0x10'),auth[_0xc580('0x9')](),controller[_0xc580('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e097a46..0190809 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 _0x4344=['alias','STRING','getDataValue','name','TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','exports','VIRTUAL'];(function(_0x4ebb1e,_0x1051c7){var _0x18846b=function(_0x494c66){while(--_0x494c66){_0x4ebb1e['push'](_0x4ebb1e['shift']());}};_0x18846b(++_0x1051c7);}(_0x4344,0x8e));var _0x4434=function(_0x17564f,_0x51b23d){_0x17564f=_0x17564f-0x0;var _0x1b8d3b=_0x4344[_0x17564f];return _0x1b8d3b;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x4434('0x0')]={'name':{'type':Sequelize[_0x4434('0x1')],'get':function(_0x560d0a){return this['getDataValue'](_0x4434('0x2'));}},'alias':{'type':Sequelize[_0x4434('0x3')],'allowNull':![],'set':function(_0xfe88c){this['setDataValue']('alias',_0xfe88c?_0xfe88c:this[_0x4434('0x4')](_0x4434('0x5')));}},'type':{'type':Sequelize[_0x4434('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x4434('0x6')](_0x4434('0x7')),'get':function(){if(this[_0x4434('0x4')](_0x4434('0x8'))==='select'){return JSON[_0x4434('0x9')](this[_0x4434('0x4')]('values'));}else{return this[_0x4434('0x4')](_0x4434('0xa'));}},'set':function(_0x3347f1){if(Array[_0x4434('0xb')](_0x3347f1)){this['setDataValue'](_0x4434('0xa'),JSON[_0x4434('0xc')](_0x3347f1));}else{this['setDataValue'](_0x4434('0xa'),_0x3347f1);}}},'required':{'type':Sequelize[_0x4434('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4434('0xe')](_0x4434('0xf'))}}; \ No newline at end of file +var _0xfc2a=['alias','STRING','TEXT','long','type','select','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x42a838,_0x35455c){var _0x28aa5a=function(_0x542eaf){while(--_0x542eaf){_0x42a838['push'](_0x42a838['shift']());}};_0x28aa5a(++_0x35455c);}(_0xfc2a,0x83));var _0xafc2=function(_0x161698,_0x6e60e7){_0x161698=_0x161698-0x0;var _0x22c3b8=_0xfc2a[_0x161698];return _0x22c3b8;};'use strict';var Sequelize=require(_0xafc2('0x0'));var _=require(_0xafc2('0x1'));module[_0xafc2('0x2')]={'name':{'type':Sequelize[_0xafc2('0x3')],'get':function(_0x29ce86){return this[_0xafc2('0x4')](_0xafc2('0x5'));}},'alias':{'type':Sequelize[_0xafc2('0x6')],'allowNull':![],'set':function(_0x47b8d7){this['setDataValue'](_0xafc2('0x5'),_0x47b8d7?_0x47b8d7:this[_0xafc2('0x4')]('name'));}},'type':{'type':Sequelize[_0xafc2('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xafc2('0x7')](_0xafc2('0x8')),'get':function(){if(this['getDataValue'](_0xafc2('0x9'))===_0xafc2('0xa')){return JSON['parse'](this[_0xafc2('0x4')](_0xafc2('0xb')));}else{return this[_0xafc2('0x4')](_0xafc2('0xb'));}},'set':function(_0x4981a2){if(Array[_0xafc2('0xc')](_0x4981a2)){this[_0xafc2('0xd')](_0xafc2('0xb'),JSON['stringify'](_0x4981a2));}else{this[_0xafc2('0xd')]('values',_0x4981a2);}}},'required':{'type':Sequelize[_0xafc2('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xafc2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xafc2('0xf')](_0xafc2('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f290bd9..a02604c 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 _0xf5f2=['catch','params','includeAll','include','body','find','create','sequelize','Sequelize','TEXT','text','INTEGER','queryInterface','addColumn','format','cf_%d','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','destroy','then','error','name','send','index','map','CmCustomField','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','findAll'];(function(_0x1ddabd,_0x3a3c19){var _0x3bf517=function(_0x30044c){while(--_0x30044c){_0x1ddabd['push'](_0x1ddabd['shift']());}};_0x3bf517(++_0x3a3c19);}(_0xf5f2,0x1de));var _0x2f5f=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xf5f2[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f5f('0x1'));var rp=require(_0x2f5f('0x2'));var moment=require(_0x2f5f('0x3'));var BPromise=require(_0x2f5f('0x4'));var Mustache=require(_0x2f5f('0x5'));var util=require(_0x2f5f('0x6'));var path=require('path');var sox=require(_0x2f5f('0x7'));var csv=require('to-csv');var ejs=require(_0x2f5f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f5f('0x9'));var squel=require(_0x2f5f('0xa'));var crypto=require(_0x2f5f('0xb'));var jsforce=require(_0x2f5f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f5f('0xd'));var Redis=require('ioredis');var authService=require(_0x2f5f('0xe'));var qs=require(_0x2f5f('0xf'));var as=require(_0x2f5f('0x10'));var hardwareService=require(_0x2f5f('0x11'));var logger=require('../../config/logger')(_0x2f5f('0x12'));var utils=require(_0x2f5f('0x13'));var config=require(_0x2f5f('0x14'));var licenseUtil=require(_0x2f5f('0x15'));var db=require(_0x2f5f('0x16'))['db'];function respondWithStatusCode(_0x55255d,_0x507812){_0x507812=_0x507812||0xcc;return function(_0xad0385){if(_0xad0385){return _0x55255d[_0x2f5f('0x17')](_0x507812);}return _0x55255d[_0x2f5f('0x18')](_0x507812)[_0x2f5f('0x19')]();};}function respondWithResult(_0x4b8c88,_0x58adb4){_0x58adb4=_0x58adb4||0xc8;return function(_0x1c3b86){if(_0x1c3b86){return _0x4b8c88[_0x2f5f('0x18')](_0x58adb4)[_0x2f5f('0x1a')](_0x1c3b86);}};}function respondWithFilteredResult(_0x2e542b,_0x48de1d){return function(_0x285778){if(_0x285778){var _0x2294c2=typeof _0x48de1d['offset']===_0x2f5f('0x1b')&&typeof _0x48de1d[_0x2f5f('0x1c')]==='undefined';var _0x329015=_0x285778[_0x2f5f('0x1d')];var _0x4deada=_0x2294c2?0x0:_0x48de1d[_0x2f5f('0x1e')];var _0x2d7525=_0x2294c2?_0x285778[_0x2f5f('0x1d')]:_0x48de1d[_0x2f5f('0x1e')]+_0x48de1d[_0x2f5f('0x1c')];var _0x2b02bf;if(_0x2d7525>=_0x329015){_0x2d7525=_0x329015;_0x2b02bf=0xc8;}else{_0x2b02bf=0xce;}_0x2e542b[_0x2f5f('0x18')](_0x2b02bf);return _0x2e542b[_0x2f5f('0x1f')](_0x2f5f('0x20'),_0x4deada+'-'+_0x2d7525+'/'+_0x329015)['json'](_0x285778);}return null;};}function patchUpdates(_0x49c134){return function(_0x589577){try{jsonpatch['apply'](_0x589577,_0x49c134,!![]);}catch(_0x4b06e2){return BPromise['reject'](_0x4b06e2);}return _0x589577[_0x2f5f('0x21')]();};}function saveUpdates(_0x268e68,_0x4a69cf){return function(_0x5d1036){if(_0x5d1036){return _0x5d1036['update'](_0x268e68)['then'](function(_0x386f11){return _0x386f11;});}return null;};}function removeEntity(_0x473945,_0x12fbba){return function(_0x128799){if(_0x128799){return _0x128799[_0x2f5f('0x22')]()[_0x2f5f('0x23')](function(){_0x473945[_0x2f5f('0x18')](0xcc)[_0x2f5f('0x19')]();});}};}function handleEntityNotFound(_0x3b8428,_0x11c651){return function(_0x5b1f4f){if(!_0x5b1f4f){_0x3b8428[_0x2f5f('0x17')](0x194);}return _0x5b1f4f;};}function handleError(_0x2ab0b2,_0x21bfd3){_0x21bfd3=_0x21bfd3||0x1f4;return function(_0x6824ff){logger[_0x2f5f('0x24')](_0x6824ff['stack']);if(_0x6824ff[_0x2f5f('0x25')]){delete _0x6824ff['name'];}_0x2ab0b2[_0x2f5f('0x18')](_0x21bfd3)[_0x2f5f('0x26')](_0x6824ff);};}exports[_0x2f5f('0x27')]=function(_0x30f24c,_0x174f65){var _0x5847ba={},_0x58a45b={},_0x29cb16={'count':0x0,'rows':[]};var _0x283357=_[_0x2f5f('0x28')](db[_0x2f5f('0x29')][_0x2f5f('0x2a')],function(_0x16b951){return{'name':_0x16b951['fieldName'],'type':_0x16b951[_0x2f5f('0x2b')]['key']};});_0x58a45b[_0x2f5f('0x2c')]=_['differenceBy'](_[_0x2f5f('0x28')](_0x283357,_0x2f5f('0x25')),['name']);_0x58a45b[_0x2f5f('0x2d')]=_[_0x2f5f('0x2e')](_0x30f24c['query']);_0x58a45b[_0x2f5f('0x2f')]=_['intersection'](_0x58a45b[_0x2f5f('0x2c')],_0x58a45b[_0x2f5f('0x2d')]);_0x5847ba[_0x2f5f('0x30')]=_[_0x2f5f('0x31')](_0x58a45b[_0x2f5f('0x2c')],qs['fields'](_0x30f24c[_0x2f5f('0x2d')][_0x2f5f('0x32')]));_0x5847ba[_0x2f5f('0x30')]=_0x5847ba[_0x2f5f('0x30')][_0x2f5f('0x33')]?_0x5847ba[_0x2f5f('0x30')]:_0x58a45b['model'];if(!_0x30f24c[_0x2f5f('0x2d')][_0x2f5f('0x34')]('nolimit')){_0x5847ba[_0x2f5f('0x1c')]=qs[_0x2f5f('0x1c')](_0x30f24c[_0x2f5f('0x2d')][_0x2f5f('0x1c')]);_0x5847ba['offset']=qs[_0x2f5f('0x1e')](_0x30f24c['query']['offset']);}_0x5847ba[_0x2f5f('0x35')]=qs[_0x2f5f('0x36')](_0x30f24c['query'][_0x2f5f('0x36')]);_0x5847ba['where']=qs[_0x2f5f('0x2f')](_['pick'](_0x30f24c['query'],_0x58a45b[_0x2f5f('0x2f')]),_0x283357);if(_0x30f24c['query'][_0x2f5f('0x37')]){_0x5847ba[_0x2f5f('0x38')]=_[_0x2f5f('0x39')](_0x5847ba['where'],{'$or':_[_0x2f5f('0x28')](_0x283357,function(_0x342557){if(_0x342557[_0x2f5f('0x2b')]!==_0x2f5f('0x3a')){var _0x159bef={};_0x159bef[_0x342557['name']]={'$like':'%'+_0x30f24c[_0x2f5f('0x2d')][_0x2f5f('0x37')]+'%'};return _0x159bef;}})});}_0x5847ba=_[_0x2f5f('0x39')]({},_0x5847ba,_0x30f24c[_0x2f5f('0x3b')]);var _0xc958f9={'where':_0x5847ba[_0x2f5f('0x38')]};return db[_0x2f5f('0x29')][_0x2f5f('0x1d')](_0xc958f9)['then'](function(_0x36b0a0){_0x29cb16['count']=_0x36b0a0;if(_0x30f24c[_0x2f5f('0x2d')]['includeAll']){_0x5847ba['include']=[{'all':!![]}];}return db[_0x2f5f('0x29')][_0x2f5f('0x3c')](_0x5847ba);})['then'](function(_0x2aa9c5){_0x29cb16['rows']=_0x2aa9c5;return _0x29cb16;})['then'](respondWithFilteredResult(_0x174f65,_0x5847ba))[_0x2f5f('0x3d')](handleError(_0x174f65,null));};exports['show']=function(_0x9c0e32,_0x2ef003){var _0x3e2393={'raw':!![],'where':{'id':_0x9c0e32[_0x2f5f('0x3e')]['id']}},_0x13deed={};_0x13deed['model']=_[_0x2f5f('0x2e')](db['CmCustomField'][_0x2f5f('0x2a')]);_0x13deed[_0x2f5f('0x2d')]=_[_0x2f5f('0x2e')](_0x9c0e32[_0x2f5f('0x2d')]);_0x13deed['filters']=_[_0x2f5f('0x31')](_0x13deed[_0x2f5f('0x2c')],_0x13deed[_0x2f5f('0x2d')]);_0x3e2393['attributes']=_[_0x2f5f('0x31')](_0x13deed[_0x2f5f('0x2c')],qs[_0x2f5f('0x32')](_0x9c0e32[_0x2f5f('0x2d')]['fields']));_0x3e2393[_0x2f5f('0x30')]=_0x3e2393[_0x2f5f('0x30')][_0x2f5f('0x33')]?_0x3e2393[_0x2f5f('0x30')]:_0x13deed[_0x2f5f('0x2c')];if(_0x9c0e32[_0x2f5f('0x2d')][_0x2f5f('0x3f')]){_0x3e2393[_0x2f5f('0x40')]=[{'all':!![]}];}_0x3e2393=_[_0x2f5f('0x39')]({},_0x3e2393,_0x9c0e32[_0x2f5f('0x3b')]);return db['CmCustomField']['find'](_0x3e2393)[_0x2f5f('0x23')](handleEntityNotFound(_0x2ef003,null))[_0x2f5f('0x23')](respondWithResult(_0x2ef003,null))['catch'](handleError(_0x2ef003,null));};exports['update']=function(_0x5e732c,_0x35b0a2){if(_0x5e732c[_0x2f5f('0x41')]['id']){delete _0x5e732c[_0x2f5f('0x41')]['id'];}return db[_0x2f5f('0x29')][_0x2f5f('0x42')]({'where':{'id':_0x5e732c[_0x2f5f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x35b0a2,null))['then'](saveUpdates(_0x5e732c[_0x2f5f('0x41')],null))[_0x2f5f('0x23')](respondWithResult(_0x35b0a2,null))[_0x2f5f('0x3d')](handleError(_0x35b0a2,null));};exports[_0x2f5f('0x22')]=function(_0x463d74,_0x4cf574){return db['CmCustomField']['find']({'where':{'id':_0x463d74[_0x2f5f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cf574,null))[_0x2f5f('0x23')](removeEntity(_0x4cf574,null))['catch'](handleError(_0x4cf574,null));};exports[_0x2f5f('0x43')]=function(_0x471003,_0x15dff5){var _0x26edd8;return db[_0x2f5f('0x44')]['transaction'](function(_0x338cb7){return db[_0x2f5f('0x29')]['create'](_0x471003['body'],{'transaction':_0x338cb7})[_0x2f5f('0x23')](function(_0x3d5803){_0x26edd8=_0x3d5803;var _0x4b0615={'type':db[_0x2f5f('0x45')][_0x2f5f('0x46')],'transaction':_0x338cb7};switch(_0x471003[_0x2f5f('0x41')][_0x2f5f('0x2b')]){case _0x2f5f('0x47'):_0x4b0615[_0x2f5f('0x2b')]=db['Sequelize']['TEXT'];break;case'number':_0x4b0615[_0x2f5f('0x2b')]=db[_0x2f5f('0x45')][_0x2f5f('0x48')];break;case'switch':_0x4b0615['type']=db[_0x2f5f('0x45')]['BOOLEAN'];_0x4b0615['defaultValue']=![];break;default:}return db['sequelize'][_0x2f5f('0x49')][_0x2f5f('0x4a')]('cm_contacts',util[_0x2f5f('0x4b')](_0x2f5f('0x4c'),_0x26edd8['id']),_0x4b0615);})[_0x2f5f('0x23')](function(){return _0x26edd8;});})[_0x2f5f('0x23')](respondWithResult(_0x15dff5,0xc9))['catch'](handleError(_0x15dff5,null));}; \ No newline at end of file +var _0xb8b6=['include','findAll','catch','params','find','body','destroy','create','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','Content-Range','json','apply','update','then','end','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x2a5864,_0x2b9396){var _0x490ab6=function(_0x3bcd16){while(--_0x3bcd16){_0x2a5864['push'](_0x2a5864['shift']());}};_0x490ab6(++_0x2b9396);}(_0xb8b6,0x10e));var _0x6b8b=function(_0x4f945c,_0x4ff131){_0x4f945c=_0x4f945c-0x0;var _0x4c85a8=_0xb8b6[_0x4f945c];return _0x4c85a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b8b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b8b('0x1'));var moment=require(_0x6b8b('0x2'));var BPromise=require(_0x6b8b('0x3'));var Mustache=require(_0x6b8b('0x4'));var util=require(_0x6b8b('0x5'));var path=require(_0x6b8b('0x6'));var sox=require(_0x6b8b('0x7'));var csv=require(_0x6b8b('0x8'));var ejs=require(_0x6b8b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b8b('0xa'));var squel=require('squel');var crypto=require(_0x6b8b('0xb'));var jsforce=require(_0x6b8b('0xc'));var deskjs=require(_0x6b8b('0xd'));var toCsv=require(_0x6b8b('0x8'));var querystring=require(_0x6b8b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b8b('0xf'));var qs=require(_0x6b8b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b8b('0x11'))(_0x6b8b('0x12'));var utils=require(_0x6b8b('0x13'));var config=require(_0x6b8b('0x14'));var licenseUtil=require(_0x6b8b('0x15'));var db=require(_0x6b8b('0x16'))['db'];function respondWithStatusCode(_0x375f0e,_0x16f560){_0x16f560=_0x16f560||0xcc;return function(_0x2d70c4){if(_0x2d70c4){return _0x375f0e[_0x6b8b('0x17')](_0x16f560);}return _0x375f0e[_0x6b8b('0x18')](_0x16f560)['end']();};}function respondWithResult(_0x33ad0c,_0x34066b){_0x34066b=_0x34066b||0xc8;return function(_0x3b4a31){if(_0x3b4a31){return _0x33ad0c[_0x6b8b('0x18')](_0x34066b)['json'](_0x3b4a31);}};}function respondWithFilteredResult(_0x1c0c0d,_0x49c92b){return function(_0x49698f){if(_0x49698f){var _0x2379a8=typeof _0x49c92b['offset']==='undefined'&&typeof _0x49c92b['limit']===_0x6b8b('0x19');var _0x4df7c4=_0x49698f[_0x6b8b('0x1a')];var _0x13dfda=_0x2379a8?0x0:_0x49c92b[_0x6b8b('0x1b')];var _0x11e28e=_0x2379a8?_0x49698f[_0x6b8b('0x1a')]:_0x49c92b[_0x6b8b('0x1b')]+_0x49c92b['limit'];var _0xaad000;if(_0x11e28e>=_0x4df7c4){_0x11e28e=_0x4df7c4;_0xaad000=0xc8;}else{_0xaad000=0xce;}_0x1c0c0d[_0x6b8b('0x18')](_0xaad000);return _0x1c0c0d['set'](_0x6b8b('0x1c'),_0x13dfda+'-'+_0x11e28e+'/'+_0x4df7c4)[_0x6b8b('0x1d')](_0x49698f);}return null;};}function patchUpdates(_0x10d6ba){return function(_0x1d941b){try{jsonpatch[_0x6b8b('0x1e')](_0x1d941b,_0x10d6ba,!![]);}catch(_0x4a4032){return BPromise['reject'](_0x4a4032);}return _0x1d941b['save']();};}function saveUpdates(_0x18ff63,_0x139e71){return function(_0x3d9bec){if(_0x3d9bec){return _0x3d9bec[_0x6b8b('0x1f')](_0x18ff63)[_0x6b8b('0x20')](function(_0x5a0434){return _0x5a0434;});}return null;};}function removeEntity(_0x34b66f,_0x5cef00){return function(_0x27c57e){if(_0x27c57e){return _0x27c57e['destroy']()[_0x6b8b('0x20')](function(){_0x34b66f[_0x6b8b('0x18')](0xcc)[_0x6b8b('0x21')]();});}};}function handleEntityNotFound(_0x4e3e55,_0x2c4d1a){return function(_0x3a4791){if(!_0x3a4791){_0x4e3e55[_0x6b8b('0x17')](0x194);}return _0x3a4791;};}function handleError(_0x260882,_0x2d3ab5){_0x2d3ab5=_0x2d3ab5||0x1f4;return function(_0x32b181){logger['error'](_0x32b181[_0x6b8b('0x22')]);if(_0x32b181[_0x6b8b('0x23')]){delete _0x32b181[_0x6b8b('0x23')];}_0x260882['status'](_0x2d3ab5)[_0x6b8b('0x24')](_0x32b181);};}exports['index']=function(_0x29f150,_0x17595a){var _0x2665e3={},_0x33e7a6={},_0xa99120={'count':0x0,'rows':[]};var _0x4e7738=_[_0x6b8b('0x25')](db[_0x6b8b('0x26')][_0x6b8b('0x27')],function(_0x4073d2){return{'name':_0x4073d2[_0x6b8b('0x28')],'type':_0x4073d2[_0x6b8b('0x29')][_0x6b8b('0x2a')]};});_0x33e7a6[_0x6b8b('0x2b')]=_[_0x6b8b('0x2c')](_['map'](_0x4e7738,_0x6b8b('0x23')),['name']);_0x33e7a6['query']=_[_0x6b8b('0x2d')](_0x29f150['query']);_0x33e7a6[_0x6b8b('0x2e')]=_[_0x6b8b('0x2f')](_0x33e7a6['model'],_0x33e7a6['query']);_0x2665e3[_0x6b8b('0x30')]=_['intersection'](_0x33e7a6[_0x6b8b('0x2b')],qs[_0x6b8b('0x31')](_0x29f150[_0x6b8b('0x32')]['fields']));_0x2665e3[_0x6b8b('0x30')]=_0x2665e3[_0x6b8b('0x30')][_0x6b8b('0x33')]?_0x2665e3[_0x6b8b('0x30')]:_0x33e7a6[_0x6b8b('0x2b')];if(!_0x29f150[_0x6b8b('0x32')][_0x6b8b('0x34')](_0x6b8b('0x35'))){_0x2665e3['limit']=qs['limit'](_0x29f150[_0x6b8b('0x32')]['limit']);_0x2665e3[_0x6b8b('0x1b')]=qs[_0x6b8b('0x1b')](_0x29f150[_0x6b8b('0x32')][_0x6b8b('0x1b')]);}_0x2665e3[_0x6b8b('0x36')]=qs[_0x6b8b('0x37')](_0x29f150[_0x6b8b('0x32')]['sort']);_0x2665e3[_0x6b8b('0x38')]=qs[_0x6b8b('0x2e')](_['pick'](_0x29f150[_0x6b8b('0x32')],_0x33e7a6[_0x6b8b('0x2e')]),_0x4e7738);if(_0x29f150[_0x6b8b('0x32')][_0x6b8b('0x39')]){_0x2665e3[_0x6b8b('0x38')]=_[_0x6b8b('0x3a')](_0x2665e3[_0x6b8b('0x38')],{'$or':_[_0x6b8b('0x25')](_0x4e7738,function(_0x49e2d0){if(_0x49e2d0[_0x6b8b('0x29')]!==_0x6b8b('0x3b')){var _0xfaeefa={};_0xfaeefa[_0x49e2d0['name']]={'$like':'%'+_0x29f150[_0x6b8b('0x32')]['filter']+'%'};return _0xfaeefa;}})});}_0x2665e3=_[_0x6b8b('0x3a')]({},_0x2665e3,_0x29f150[_0x6b8b('0x3c')]);var _0x4ef74e={'where':_0x2665e3[_0x6b8b('0x38')]};return db[_0x6b8b('0x26')][_0x6b8b('0x1a')](_0x4ef74e)[_0x6b8b('0x20')](function(_0x552f58){_0xa99120[_0x6b8b('0x1a')]=_0x552f58;if(_0x29f150[_0x6b8b('0x32')][_0x6b8b('0x3d')]){_0x2665e3[_0x6b8b('0x3e')]=[{'all':!![]}];}return db['CmCustomField'][_0x6b8b('0x3f')](_0x2665e3);})[_0x6b8b('0x20')](function(_0x40f323){_0xa99120['rows']=_0x40f323;return _0xa99120;})[_0x6b8b('0x20')](respondWithFilteredResult(_0x17595a,_0x2665e3))[_0x6b8b('0x40')](handleError(_0x17595a,null));};exports['show']=function(_0x507195,_0xcb5c44){var _0x43048a={'raw':!![],'where':{'id':_0x507195[_0x6b8b('0x41')]['id']}},_0x4bd8bb={};_0x4bd8bb[_0x6b8b('0x2b')]=_[_0x6b8b('0x2d')](db[_0x6b8b('0x26')][_0x6b8b('0x27')]);_0x4bd8bb['query']=_[_0x6b8b('0x2d')](_0x507195[_0x6b8b('0x32')]);_0x4bd8bb['filters']=_[_0x6b8b('0x2f')](_0x4bd8bb[_0x6b8b('0x2b')],_0x4bd8bb[_0x6b8b('0x32')]);_0x43048a[_0x6b8b('0x30')]=_['intersection'](_0x4bd8bb[_0x6b8b('0x2b')],qs['fields'](_0x507195[_0x6b8b('0x32')]['fields']));_0x43048a[_0x6b8b('0x30')]=_0x43048a[_0x6b8b('0x30')]['length']?_0x43048a[_0x6b8b('0x30')]:_0x4bd8bb[_0x6b8b('0x2b')];if(_0x507195[_0x6b8b('0x32')]['includeAll']){_0x43048a['include']=[{'all':!![]}];}_0x43048a=_[_0x6b8b('0x3a')]({},_0x43048a,_0x507195[_0x6b8b('0x3c')]);return db[_0x6b8b('0x26')][_0x6b8b('0x42')](_0x43048a)[_0x6b8b('0x20')](handleEntityNotFound(_0xcb5c44,null))[_0x6b8b('0x20')](respondWithResult(_0xcb5c44,null))[_0x6b8b('0x40')](handleError(_0xcb5c44,null));};exports[_0x6b8b('0x1f')]=function(_0x213405,_0x2a665e){if(_0x213405['body']['id']){delete _0x213405[_0x6b8b('0x43')]['id'];}return db[_0x6b8b('0x26')][_0x6b8b('0x42')]({'where':{'id':_0x213405['params']['id']}})['then'](handleEntityNotFound(_0x2a665e,null))['then'](saveUpdates(_0x213405[_0x6b8b('0x43')],null))[_0x6b8b('0x20')](respondWithResult(_0x2a665e,null))[_0x6b8b('0x40')](handleError(_0x2a665e,null));};exports[_0x6b8b('0x44')]=function(_0x4955b8,_0x279395){return db[_0x6b8b('0x26')][_0x6b8b('0x42')]({'where':{'id':_0x4955b8[_0x6b8b('0x41')]['id']}})['then'](handleEntityNotFound(_0x279395,null))[_0x6b8b('0x20')](removeEntity(_0x279395,null))['catch'](handleError(_0x279395,null));};exports[_0x6b8b('0x45')]=function(_0x5de500,_0x4e4f1c){var _0xc14ba3;return db['sequelize'][_0x6b8b('0x46')](function(_0xe51657){return db['CmCustomField'][_0x6b8b('0x45')](_0x5de500[_0x6b8b('0x43')],{'transaction':_0xe51657})[_0x6b8b('0x20')](function(_0x19e816){_0xc14ba3=_0x19e816;var _0x4f865f={'type':db[_0x6b8b('0x47')][_0x6b8b('0x48')],'transaction':_0xe51657};switch(_0x5de500[_0x6b8b('0x43')]['type']){case _0x6b8b('0x49'):_0x4f865f[_0x6b8b('0x29')]=db['Sequelize']['TEXT'];break;case _0x6b8b('0x4a'):_0x4f865f[_0x6b8b('0x29')]=db[_0x6b8b('0x47')][_0x6b8b('0x4b')];break;case'switch':_0x4f865f[_0x6b8b('0x29')]=db[_0x6b8b('0x47')][_0x6b8b('0x4c')];_0x4f865f['defaultValue']=![];break;default:}return db[_0x6b8b('0x4d')][_0x6b8b('0x4e')][_0x6b8b('0x4f')](_0x6b8b('0x50'),util[_0x6b8b('0x51')](_0x6b8b('0x52'),_0xc14ba3['id']),_0x4f865f);})['then'](function(){return _0xc14ba3;});})['then'](respondWithResult(_0x4e4f1c,0xc9))['catch'](handleError(_0x4e4f1c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index dba1451..ebda997 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 _0x145c=['bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment'];(function(_0xc620ea,_0x2a69cc){var _0x13113f=function(_0x284f68){while(--_0x284f68){_0xc620ea['push'](_0xc620ea['shift']());}};_0x13113f(++_0x2a69cc);}(_0x145c,0x104));var _0xc145=function(_0x575dcd,_0x2405e9){_0x575dcd=_0x575dcd-0x0;var _0x435982=_0x145c[_0x575dcd];return _0x435982;};'use strict';var _=require(_0xc145('0x0'));var util=require('util');var logger=require(_0xc145('0x1'))(_0xc145('0x2'));var moment=require(_0xc145('0x3'));var BPromise=require(_0xc145('0x4'));var rp=require(_0xc145('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc145('0x6'));var config=require(_0xc145('0x7'));var attributes=require(_0xc145('0x8'));module['exports']=function(_0x59182c,_0x182882){return _0x59182c[_0xc145('0x9')](_0xc145('0xa'),attributes,{'tableName':_0xc145('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc18=['path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xbc18,0x19e));var _0x8bc1=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0xbc18[_0x5e77db];return _0x34b675;};'use strict';var _=require(_0x8bc1('0x0'));var util=require(_0x8bc1('0x1'));var logger=require(_0x8bc1('0x2'))('api');var moment=require(_0x8bc1('0x3'));var BPromise=require(_0x8bc1('0x4'));var rp=require(_0x8bc1('0x5'));var fs=require('fs');var path=require(_0x8bc1('0x6'));var rimraf=require(_0x8bc1('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bc1('0x8'));module[_0x8bc1('0x9')]=function(_0x3bae08,_0x1dfdeb){return _0x3bae08[_0x8bc1('0xa')](_0x8bc1('0xb'),attributes,{'tableName':'cm_custom_fields','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 794167c..d543bfd 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 _0x45c8=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x16408b,_0x411aff){var _0x598f38=function(_0x3c3e34){while(--_0x3c3e34){_0x16408b['push'](_0x16408b['shift']());}};_0x598f38(++_0x411aff);}(_0x45c8,0x8b));var _0x845c=function(_0x287238,_0x226933){_0x287238=_0x287238-0x0;var _0x2b503b=_0x45c8[_0x287238];return _0x2b503b;};'use strict';var _=require(_0x845c('0x0'));var util=require(_0x845c('0x1'));var moment=require(_0x845c('0x2'));var BPromise=require(_0x845c('0x3'));var rs=require(_0x845c('0x4'));var fs=require('fs');var Redis=require(_0x845c('0x5'));var db=require(_0x845c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x845c('0x7'))('rpc');var config=require(_0x845c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x845c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e5d13,_0x1c5c65,_0x2575bb){return new BPromise(function(_0x5723f1,_0x299d37){return client['request'](_0x3e5d13,_0x2575bb)['then'](function(_0x57b8f0){logger[_0x845c('0xa')](_0x845c('0xb'),_0x1c5c65,_0x845c('0xc'));logger[_0x845c('0xd')](_0x845c('0xe'),_0x1c5c65,_0x845c('0xc'),JSON[_0x845c('0xf')](_0x57b8f0));if(_0x57b8f0['error']){if(_0x57b8f0[_0x845c('0x10')]['code']===0x1f4){logger[_0x845c('0x10')](_0x845c('0xb'),_0x1c5c65,_0x57b8f0['error'][_0x845c('0x11')]);return _0x299d37(_0x57b8f0['error'][_0x845c('0x11')]);}logger[_0x845c('0x10')]('CmCustomField,\x20%s,\x20%s',_0x1c5c65,_0x57b8f0[_0x845c('0x10')][_0x845c('0x11')]);return _0x5723f1(_0x57b8f0[_0x845c('0x10')]['message']);}else{logger['info'](_0x845c('0xb'),_0x1c5c65,_0x845c('0xc'));_0x5723f1(_0x57b8f0[_0x845c('0x12')]['message']);}})['catch'](function(_0x154e57){logger[_0x845c('0x10')](_0x845c('0xb'),_0x1c5c65,_0x154e57);_0x299d37(_0x154e57);});});} \ No newline at end of file +var _0x8b0b=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x552764,_0x41b377){var _0x36048e=function(_0xdd6971){while(--_0xdd6971){_0x552764['push'](_0x552764['shift']());}};_0x36048e(++_0x41b377);}(_0x8b0b,0x97));var _0xb8b0=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8b0b[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xb8b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8b0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8b0('0x2'))['db'];var utils=require(_0xb8b0('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8b0('0x4')][_0xb8b0('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x24d97a,_0x3c14e0,_0x6b1f0c){return new BPromise(function(_0x24facd,_0x392467){return client[_0xb8b0('0x6')](_0x24d97a,_0x6b1f0c)[_0xb8b0('0x7')](function(_0x3b6180){logger[_0xb8b0('0x8')](_0xb8b0('0x9'),_0x3c14e0,_0xb8b0('0xa'));logger['debug'](_0xb8b0('0xb'),_0x3c14e0,_0xb8b0('0xa'),JSON[_0xb8b0('0xc')](_0x3b6180));if(_0x3b6180['error']){if(_0x3b6180[_0xb8b0('0xd')][_0xb8b0('0xe')]===0x1f4){logger[_0xb8b0('0xd')](_0xb8b0('0x9'),_0x3c14e0,_0x3b6180[_0xb8b0('0xd')]['message']);return _0x392467(_0x3b6180[_0xb8b0('0xd')][_0xb8b0('0xf')]);}logger[_0xb8b0('0xd')](_0xb8b0('0x9'),_0x3c14e0,_0x3b6180[_0xb8b0('0xd')][_0xb8b0('0xf')]);return _0x24facd(_0x3b6180[_0xb8b0('0xd')][_0xb8b0('0xf')]);}else{logger[_0xb8b0('0x8')]('CmCustomField,\x20%s,\x20%s',_0x3c14e0,'request\x20sent');_0x24facd(_0x3b6180[_0xb8b0('0x10')][_0xb8b0('0xf')]);}})[_0xb8b0('0x11')](function(_0x26a86e){logger[_0xb8b0('0xd')](_0xb8b0('0x9'),_0x3c14e0,_0x26a86e);_0x392467(_0x26a86e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index de60336..b333ed1 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 _0x9f5a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','delete','exports','multer','util','path'];(function(_0xf461f,_0x251066){var _0xc81493=function(_0x4177c9){while(--_0x4177c9){_0xf461f['push'](_0xf461f['shift']());}};_0xc81493(++_0x251066);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x449ecc,_0xe16173){_0x449ecc=_0x449ecc-0x0;var _0x20dc4b=_0x9f5a[_0x449ecc];return _0x20dc4b;};'use strict';var multer=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var path=require(_0xa9f5('0x2'));var timeout=require(_0xa9f5('0x3'));var express=require('express');var router=express[_0xa9f5('0x4')]();var fs_extra=require(_0xa9f5('0x5'));var auth=require(_0xa9f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f5('0x7'));var controller=require('./cmCustomField.controller');router[_0xa9f5('0x8')]('/',auth[_0xa9f5('0x9')](),controller['index']);router[_0xa9f5('0x8')](_0xa9f5('0xa'),auth[_0xa9f5('0x9')](),controller[_0xa9f5('0xb')]);router[_0xa9f5('0xc')]('/',auth[_0xa9f5('0x9')](),controller[_0xa9f5('0xd')]);router['put'](_0xa9f5('0xa'),auth[_0xa9f5('0x9')](),controller['update']);router[_0xa9f5('0xe')](_0xa9f5('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa9f5('0xf')]=router; \ No newline at end of file +var _0x8569=['index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x702ca,_0x31d17a){var _0x11f6ed=function(_0x59aea2){while(--_0x59aea2){_0x702ca['push'](_0x702ca['shift']());}};_0x11f6ed(++_0x31d17a);}(_0x8569,0x14d));var _0x9856=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x8569[_0x3d5351];return _0x1db4db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9856('0x0'));var timeout=require(_0x9856('0x1'));var express=require(_0x9856('0x2'));var router=express['Router']();var fs_extra=require(_0x9856('0x3'));var auth=require(_0x9856('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9856('0x5'));var controller=require(_0x9856('0x6'));router[_0x9856('0x7')]('/',auth[_0x9856('0x8')](),controller[_0x9856('0x9')]);router[_0x9856('0x7')](_0x9856('0xa'),auth[_0x9856('0x8')](),controller[_0x9856('0xb')]);router[_0x9856('0xc')]('/',auth[_0x9856('0x8')](),controller[_0x9856('0xd')]);router[_0x9856('0xe')](_0x9856('0xa'),auth[_0x9856('0x8')](),controller[_0x9856('0xf')]);router[_0x9856('0x10')](_0x9856('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9856('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 15062c7..f8a0d8c 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 _0xcfcd=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xcfcd,0xb5));var _0xdcfc=function(_0x20e357,_0x118e03){_0x20e357=_0x20e357-0x0;var _0x567e7f=_0xcfcd[_0x20e357];return _0x567e7f;};'use strict';var moment=require(_0xdcfc('0x0'));var Sequelize=require(_0xdcfc('0x1'));module[_0xdcfc('0x2')]={'phone':{'type':Sequelize[_0xdcfc('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xdcfc('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdcfc('0x5')],'defaultValue':moment()[_0xdcfc('0x6')](_0xdcfc('0x7'))},'countbusyretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdcfc('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdcfc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xdcfc('0x8')](0x2)[_0xdcfc('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdcfc('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdcfc('0x8')],'unique':_0xdcfc('0xa')},'ListId':{'type':Sequelize[_0xdcfc('0x8')],'unique':_0xdcfc('0xa')},'UserId':{'type':Sequelize[_0xdcfc('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xdcfc('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xdcfc('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdcfc('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdcfc('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdcfc('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5fde=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46a042,_0x4c8ac9){var _0x5469dd=function(_0x5e2d19){while(--_0x5e2d19){_0x46a042['push'](_0x46a042['shift']());}};_0x5469dd(++_0x4c8ac9);}(_0x5fde,0x100));var _0xe5fd=function(_0x4320bb,_0x5b51ff){_0x4320bb=_0x4320bb-0x0;var _0x1441ed=_0x5fde[_0x4320bb];return _0x1441ed;};'use strict';var moment=require(_0xe5fd('0x0'));var Sequelize=require(_0xe5fd('0x1'));module[_0xe5fd('0x2')]={'phone':{'type':Sequelize[_0xe5fd('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe5fd('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe5fd('0x5')],'defaultValue':moment()[_0xe5fd('0x6')](_0xe5fd('0x7'))},'countbusyretry':{'type':Sequelize[_0xe5fd('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe5fd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe5fd('0x5')]},'priority':{'type':Sequelize[_0xe5fd('0x8')](0x2)[_0xe5fd('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe5fd('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe5fd('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xe5fd('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xe5fd('0x8')],'unique':_0xe5fd('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xe5fd('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe5fd('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe5fd('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xe5fd('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xe5fd('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8877c44..5c4f3a2 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 _0x4b19=['limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$gt','$lt','$lte','$ne','$eq','$notBetween','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','merge','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','hopperIds','priority','ASC','scheduledAt','literal','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','CmList','List','dialActive','getPreviewRecall','Contact','Company','Queue','outbound','isNumber','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined'];(function(_0x4c4d6d,_0x10ac62){var _0x4eacef=function(_0x589133){while(--_0x589133){_0x4c4d6d['push'](_0x4c4d6d['shift']());}};_0x4eacef(++_0x10ac62);}(_0x4b19,0x195));var _0x94b1=function(_0x2169e8,_0x42a9b5){_0x2169e8=_0x2169e8-0x0;var _0x239a69=_0x4b19[_0x2169e8];return _0x239a69;};'use strict';var moment=require(_0x94b1('0x0'));var _=require('lodash');var qs=require(_0x94b1('0x1'));var logger=require(_0x94b1('0x2'))(_0x94b1('0x3'));var shared=require('../../config/environment');var db=require(_0x94b1('0x4'))['db'];function respondWithResult(_0x3648ad,_0x2240b9){_0x2240b9=_0x2240b9||0xc8;return function(_0x4f607f){if(_0x4f607f){return _0x3648ad[_0x94b1('0x5')](_0x2240b9)[_0x94b1('0x6')](_0x4f607f);}};}function respondWithFilteredResult(_0x52d6c1,_0x24df76){return function(_0x110a52){if(_0x110a52){var _0x4ea1f9=typeof _0x24df76[_0x94b1('0x7')]===_0x94b1('0x8')&&typeof _0x24df76[_0x94b1('0x9')]==='undefined';var _0x15c0a9=_0x110a52['count'];var _0x4aafcc=_0x4ea1f9?0x0:_0x24df76[_0x94b1('0x7')];var _0x126424=_0x4ea1f9?_0x110a52[_0x94b1('0xa')]:_0x24df76[_0x94b1('0x7')]+_0x24df76[_0x94b1('0x9')];var _0x3aeb91;if(_0x126424>=_0x15c0a9){_0x126424=_0x15c0a9;_0x3aeb91=0xc8;}else{_0x3aeb91=0xce;}_0x52d6c1['status'](_0x3aeb91);return _0x52d6c1[_0x94b1('0xb')](_0x94b1('0xc'),_0x4aafcc+'-'+_0x126424+'/'+_0x15c0a9)[_0x94b1('0x6')](_0x110a52);}return null;};}function saveUpdates(_0x2b378c,_0x5cbf96){return function(_0x4a4fe6){if(_0x4a4fe6){return _0x4a4fe6[_0x94b1('0xd')](_0x2b378c)[_0x94b1('0xe')](function(_0x57de2f){return _0x57de2f;});}return null;};}function handleEntityNotFound(_0x5059d8,_0x9329c9){return function(_0xb9924c){if(!_0xb9924c){_0x5059d8['sendStatus'](0x194);}return _0xb9924c;};}function handleError(_0x3f3eab,_0x58fab3){_0x58fab3=_0x58fab3||0x1f4;return function(_0x4ea6a4){logger[_0x94b1('0xf')](_0x4ea6a4[_0x94b1('0x10')]);if(_0x4ea6a4[_0x94b1('0x11')]){delete _0x4ea6a4[_0x94b1('0x11')];}_0x3f3eab['status'](_0x58fab3)[_0x94b1('0x12')](_0x4ea6a4);};}exports[_0x94b1('0x13')]=function(_0xa29b90,_0x224099){var _0x3a6ae0={},_0x1abb7f={},_0x2d33dc={'count':0x0,'rows':[]};var _0x59d7cf=_[_0x94b1('0x14')](db[_0x94b1('0x15')][_0x94b1('0x16')],function(_0x5deb20){return{'name':_0x5deb20[_0x94b1('0x17')],'type':_0x5deb20[_0x94b1('0x18')]['key']};});_0x1abb7f[_0x94b1('0x19')]=_[_0x94b1('0x14')](_0x59d7cf,_0x94b1('0x11'));_0x1abb7f[_0x94b1('0x1a')]=_[_0x94b1('0x1b')](_0xa29b90[_0x94b1('0x1a')]);_0x1abb7f[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],_0x1abb7f[_0x94b1('0x1a')]);_0x1abb7f['filters']=_[_0x94b1('0x1e')](_0x1abb7f[_0x94b1('0x1c')],[_0x94b1('0x1f'),'$or',_0x94b1('0x20'),'$gte',_0x94b1('0x21'),_0x94b1('0x22'),_0x94b1('0x23'),_0x94b1('0x24'),'$not','$between',_0x94b1('0x25'),'$in',_0x94b1('0x26'),'$like',_0x94b1('0x27'),_0x94b1('0x28'),_0x94b1('0x29'),'$like',_0x94b1('0x2a'),_0x94b1('0x2b'),_0x94b1('0x2c'),_0x94b1('0x2d')]);_0x3a6ae0[_0x94b1('0x2e')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0xa29b90[_0x94b1('0x1a')]['fields']));_0x3a6ae0[_0x94b1('0x2e')]=_0x3a6ae0[_0x94b1('0x2e')]['length']?_0x3a6ae0[_0x94b1('0x2e')]:_0x1abb7f[_0x94b1('0x19')];if(!_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x30')](_0x94b1('0x31'))){_0x3a6ae0[_0x94b1('0x9')]=qs['limit'](_0xa29b90[_0x94b1('0x1a')]['limit']);_0x3a6ae0[_0x94b1('0x7')]=qs['offset'](_0xa29b90['query'][_0x94b1('0x7')]);}_0x3a6ae0[_0x94b1('0x32')]=qs[_0x94b1('0x33')](_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x33')]);_0x3a6ae0[_0x94b1('0x34')]=qs[_0x94b1('0x1c')](_[_0x94b1('0x35')](_0xa29b90[_0x94b1('0x1a')],_0x1abb7f[_0x94b1('0x1c')]),_0x59d7cf);if(_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]){_0x3a6ae0['where']=_['merge'](_0x3a6ae0[_0x94b1('0x34')],{'$or':_[_0x94b1('0x14')](_0x59d7cf,function(_0x298bc2){if(_0x298bc2[_0x94b1('0x18')]!==_0x94b1('0x37')){var _0x2ba486={};_0x2ba486[_0x298bc2[_0x94b1('0x11')]]={'$like':'%'+_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]+'%'};return _0x2ba486;}})});}_0x3a6ae0=_['merge']({},_0x3a6ae0,_0xa29b90[_0x94b1('0x38')]);var _0x4d18e8={'where':_0x3a6ae0[_0x94b1('0x34')]};return db[_0x94b1('0x15')][_0x94b1('0xa')](_0x4d18e8)['then'](function(_0x357798){_0x2d33dc[_0x94b1('0xa')]=_0x357798;if(_0xa29b90[_0x94b1('0x1a')]['includeAll']){_0x3a6ae0[_0x94b1('0x39')]=[{'all':!![]}];}return db[_0x94b1('0x15')][_0x94b1('0x3a')](_0x3a6ae0);})[_0x94b1('0xe')](function(_0x3e5b02){_0x2d33dc[_0x94b1('0x3b')]=_0x3e5b02;return _0x2d33dc;})[_0x94b1('0xe')](respondWithFilteredResult(_0x224099,_0x3a6ae0))[_0x94b1('0x3c')](handleError(_0x224099,null));};exports[_0x94b1('0x3d')]=function(_0x2d6f38,_0x32d009){var _0xfb5e55={'raw':!![],'where':{'id':_0x2d6f38['params']['id']}},_0x235a44={};_0x235a44[_0x94b1('0x19')]=_[_0x94b1('0x1b')](db[_0x94b1('0x15')][_0x94b1('0x16')]);_0x235a44[_0x94b1('0x1a')]=_['keys'](_0x2d6f38[_0x94b1('0x1a')]);_0x235a44[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x235a44[_0x94b1('0x19')],_0x235a44[_0x94b1('0x1a')]);_0xfb5e55[_0x94b1('0x2e')]=_['intersection'](_0x235a44[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0x2d6f38['query'][_0x94b1('0x2f')]));_0xfb5e55[_0x94b1('0x2e')]=_0xfb5e55['attributes'][_0x94b1('0x3e')]?_0xfb5e55[_0x94b1('0x2e')]:_0x235a44[_0x94b1('0x19')];if(_0x2d6f38['query'][_0x94b1('0x3f')]){_0xfb5e55[_0x94b1('0x39')]=[{'all':!![]}];}_0xfb5e55=_[_0x94b1('0x40')]({},_0xfb5e55,_0x2d6f38[_0x94b1('0x38')]);return db[_0x94b1('0x15')][_0x94b1('0x41')](_0xfb5e55)[_0x94b1('0xe')](handleEntityNotFound(_0x32d009,null))['then'](respondWithResult(_0x32d009,null))[_0x94b1('0x3c')](handleError(_0x32d009,null));};exports[_0x94b1('0x42')]=function(_0x163b8e,_0x4f023d){return db[_0x94b1('0x15')][_0x94b1('0x42')](_0x163b8e['body'],{})[_0x94b1('0xe')](respondWithResult(_0x4f023d,0xc9))[_0x94b1('0x3c')](handleError(_0x4f023d,null));};exports[_0x94b1('0xd')]=function(_0x4755c5,_0x13ec08){if(_0x4755c5[_0x94b1('0x43')]['id']){delete _0x4755c5[_0x94b1('0x43')]['id'];}return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x4755c5[_0x94b1('0x44')]['id']}})[_0x94b1('0xe')](handleEntityNotFound(_0x13ec08,null))[_0x94b1('0xe')](saveUpdates(_0x4755c5[_0x94b1('0x43')],null))[_0x94b1('0xe')](respondWithResult(_0x13ec08,null))[_0x94b1('0x3c')](handleError(_0x13ec08,null));};exports[_0x94b1('0x45')]=function(_0xfe1c8f,_0x2b22ee){return db[_0x94b1('0x15')]['describe']()[_0x94b1('0xe')](respondWithResult(_0x2b22ee,null))['catch'](handleError(_0x2b22ee,null));};exports[_0x94b1('0x46')]=function(_0x3fc0fc,_0x1d8e57){var _0x54fc33;var _0x4dacb2=_0x3fc0fc['params']['id'];return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x3fc0fc[_0x94b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d8e57,null))['then'](function(_0x4d2af3){if(_0x4d2af3){return _0x4d2af3[_0x94b1('0x46')]()[_0x94b1('0xe')](function(_0xbfd51b){return _0xbfd51b;});}})[_0x94b1('0xe')](function(_0x4109ca){_0x54fc33=_0x4109ca;if(_0x4109ca){if(_0x4109ca[_0x94b1('0x47')]||_0x4109ca[_0x94b1('0x48')]){return db[_0x4109ca['VoiceQueueId']?_0x94b1('0x49'):_0x94b1('0x4a')][_0x94b1('0x41')]({'where':{'id':_0x4109ca[_0x94b1('0x47')]?_0x4109ca[_0x94b1('0x47')]:_0x4109ca[_0x94b1('0x48')]},'attributes':['id',_0x94b1('0x11')],'raw':!![]});}}})[_0x94b1('0xe')](function(_0x37aa72){var _0x252a63={};if(_0x37aa72){_[_0x94b1('0x40')](_0x252a63,_[_0x94b1('0x4b')](_0x54fc33[_0x94b1('0x4c')],[_0x94b1('0x4d'),'updatedAt','id']));_0x252a63[_0x94b1('0x4e')]=0x15;_0x252a63[_0x94b1('0x4f')]=_0x94b1('0x50');_0x252a63[_0x94b1('0x51')]=_0x37aa72[_0x94b1('0x11')];_0x252a63[_0x94b1('0x52')]=_0x3fc0fc[_0x94b1('0x53')][_0x94b1('0x11')];_0x252a63[_0x94b1('0x54')]=_0x3fc0fc['user']['id'];_0x252a63[_0x94b1('0x50')]=!![];_0x252a63[_0x94b1('0x55')]=moment()[_0x94b1('0x56')](_0x94b1('0x57'));_0x252a63[_0x94b1('0x58')]=_0x54fc33[_0x94b1('0x59')];_0x252a63['campaigntype']=_0x54fc33[_0x94b1('0x47')]?_0x94b1('0x5a'):_0x94b1('0x5b');return db[_0x94b1('0x5c')][_0x94b1('0x41')]({'where':{'id':_0x252a63[_0x94b1('0x5d')]},'attributes':[_0x94b1('0x5e'),_0x94b1('0x5f')]})[_0x94b1('0xe')](function(_0x502d2c){if(!_['isNil'](_0x1d8e57)&&!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5e')])){_0x252a63[_0x94b1('0x61')]=_0x502d2c[_0x94b1('0x5e')];if(!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5f')])){_0x252a63[_0x94b1('0x61')]+='\x20'+_0x502d2c[_0x94b1('0x5f')];}}})[_0x94b1('0x62')](function(){return db[_0x94b1('0x63')][_0x94b1('0x42')](_0x252a63);});}})[_0x94b1('0xe')](function(_0x4d22ac){return db['CmHopperAdditionalPhone'][_0x94b1('0x46')]({'where':{'CmHopperId':_0x4dacb2}});})[_0x94b1('0xe')](function(){return _0x1d8e57[_0x94b1('0x5')](0xcc)[_0x94b1('0x64')]();})[_0x94b1('0x3c')](handleError(_0x1d8e57,null));};exports['getPreview']=function(_0x249c48,_0x478117){var _0x37e951=[];return db[_0x94b1('0x5c')][_0x94b1('0x45')]()['then'](function(_0x576a6d){_0x37e951=_[_0x94b1('0x1b')](_0x576a6d);return _0x249c48[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id',_0x94b1('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0xca90cf){if(_0xca90cf&&_0xca90cf[_0x94b1('0x3e')]){return db[_0x94b1('0x68')][_0x94b1('0x69')](function(_0x282081){var _0x1c0013={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0xca90cf,'id')},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x4a26cc={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xca90cf)[_0x94b1('0x36')]([_0x94b1('0x6a'),0x0])[_0x94b1('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x5b1340={'$or':[_0x1c0013,_0x4a26cc]};var _0x5615c8=[];if(_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]&&_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]==='prev'){if(!_['isEmpty'](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$in':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[[_0x94b1('0x6d'),_0x94b1('0x6e')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]==='ASC'?'DESC':_0x94b1('0x6e')],db['sequelize'][_0x94b1('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x94b1('0x71')]];}else{if(!_[_0x94b1('0x72')](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$notIn':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[['priority',_0x94b1('0x71')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]],db[_0x94b1('0x68')][_0x94b1('0x70')](_0x94b1('0x73')),['id',_0x94b1('0x6e')]];}return db['CmHopper'][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x59'),_0x94b1('0x76')],'where':_0x5b1340,'order':_0x5615c8,'transaction':_0x282081,'lock':_0x282081[_0x94b1('0x77')][_0x94b1('0x78')],'include':[{'model':db[_0x94b1('0x5c')],'as':'Contact','attributes':_0x37e951,'include':[{'model':db[_0x94b1('0x79')],'as':'Company','attributes':['id',_0x94b1('0x11')]}]},{'model':db[_0x94b1('0x7a')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xe48788){if(_0xe48788){return _0xe48788[_0x94b1('0xd')]({'UserId':_0x249c48[_0x94b1('0x53')]['id']},{'transaction':_0x282081});}});});}})['then'](handleEntityNotFound(_0x478117,null))[_0x94b1('0xe')](respondWithResult(_0x478117,null))[_0x94b1('0x3c')](handleError(_0x478117,null));};exports[_0x94b1('0x7d')]=function(_0x219939,_0x48472c,_0x46893d){var _0x486841=[];var _0x53faf9=_0x219939['params']['id'];var _0x2f05d5=_0x219939[_0x94b1('0x53')]['id'];return db[_0x94b1('0x5c')]['describe']()['then'](function(_0x587099){_0x486841=_[_0x94b1('0x1b')](_0x587099);return db[_0x94b1('0x68')]['transaction'](function(_0x5edb29){const _0x4c2a00={'id':_0x53faf9};return db[_0x94b1('0x15')][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x76')],'where':_0x4c2a00,'transaction':_0x5edb29,'lock':_0x5edb29['LOCK']['UPDATE'],'include':[{'model':db[_0x94b1('0x5c')],'as':_0x94b1('0x7e'),'attributes':_0x486841,'include':[{'model':db[_0x94b1('0x79')],'as':_0x94b1('0x7f'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x94b1('0x11')]},{'model':db[_0x94b1('0x49')],'as':_0x94b1('0x80'),'attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xc2894f){if(_0xc2894f){return _0xc2894f[_0x94b1('0xd')]({'UserId':_0x2f05d5},{'transaction':_0x5edb29});}});});})['then'](handleEntityNotFound(_0x48472c,null))[_0x94b1('0xe')](respondWithResult(_0x48472c,null))['catch'](handleError(_0x48472c,null));};exports['getOpenContacts']=function(_0x416055,_0x5edac4){return _0x416055[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':_0x94b1('0x81'),'dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id'],'raw':!![]})[_0x94b1('0xe')](function(_0x4f182c){if(_0x4f182c&&_0x4f182c[_0x94b1('0x3e')]){return db['CmHopper'][_0x94b1('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x4f182c,'id')},'$or':[{'UserId':null},{'UserId':_0x416055[_0x94b1('0x53')]['id']}]}});}return 0x0;})[_0x94b1('0xe')](function(_0x59f77a){if(!_['isNil'](_0x59f77a)&&_[_0x94b1('0x82')](_0x59f77a)){return _0x5edac4[_0x94b1('0x5')](0xc8)[_0x94b1('0x6')]({'contacts':_0x59f77a});}else{logger[_0x94b1('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x94b1('0x83'),0x194,'entity\x20not\x20found');_0x5edac4[_0x94b1('0x84')](0x194);}})['catch'](handleError(_0x5edac4,null));};exports[_0x94b1('0x85')]=function(_0x4ba865,_0x497c2f){var _0x3f0958=shared[_0x94b1('0x86')];var _0x594bbd=[];_[_0x94b1('0x14')](_0x3f0958,function(_0x1b9a5d){_0x594bbd[_0x94b1('0x87')]({'id':_0x1b9a5d['name'],'name':_0x1b9a5d[_0x94b1('0x11')],'utcOffset':_0x1b9a5d[_0x94b1('0x88')]});});return _0x497c2f[_0x94b1('0x5')](0xc8)['json']({'tz':_0x594bbd});};exports[_0x94b1('0x89')]=function(_0x4d6c7e,_0x595ae3){var _0x238963=shared['timezones'];var _0x3ca231={};if(!_['isNil'](_0x238963[_0x4d6c7e[_0x94b1('0x43')]['id']]))_0x3ca231=_0x238963[_0x4d6c7e['body']['id']];return _0x595ae3[_0x94b1('0x5')](0xc8)['json'](_0x3ca231);}; \ No newline at end of file +var _0xafdd=['status','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','concat','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','firstName','lastName','isNil','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','Company','List','Queue','dialActive','getPreviewRecall','UPDATE','CmCompany','CmList','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0xd8d9fe,_0x2c03d6){var _0x50f5dd=function(_0xec3d4e){while(--_0xec3d4e){_0xd8d9fe['push'](_0xd8d9fe['shift']());}};_0x50f5dd(++_0x2c03d6);}(_0xafdd,0x19a));var _0xdafd=function(_0x44dfb3,_0x2f9b1f){_0x44dfb3=_0x44dfb3-0x0;var _0x431a29=_0xafdd[_0x44dfb3];return _0x431a29;};'use strict';var moment=require(_0xdafd('0x0'));var _=require(_0xdafd('0x1'));var qs=require(_0xdafd('0x2'));var logger=require(_0xdafd('0x3'))(_0xdafd('0x4'));var shared=require(_0xdafd('0x5'));var db=require(_0xdafd('0x6'))['db'];function respondWithResult(_0x2b0752,_0x5624f6){_0x5624f6=_0x5624f6||0xc8;return function(_0x283ab1){if(_0x283ab1){return _0x2b0752[_0xdafd('0x7')](_0x5624f6)[_0xdafd('0x8')](_0x283ab1);}};}function respondWithFilteredResult(_0x37f05a,_0xfa4ad6){return function(_0x57cfee){if(_0x57cfee){var _0x2ed8ea=typeof _0xfa4ad6['offset']===_0xdafd('0x9')&&typeof _0xfa4ad6[_0xdafd('0xa')]===_0xdafd('0x9');var _0x48000b=_0x57cfee[_0xdafd('0xb')];var _0x413d23=_0x2ed8ea?0x0:_0xfa4ad6[_0xdafd('0xc')];var _0x2f3bb3=_0x2ed8ea?_0x57cfee['count']:_0xfa4ad6[_0xdafd('0xc')]+_0xfa4ad6[_0xdafd('0xa')];var _0x3ee1e9;if(_0x2f3bb3>=_0x48000b){_0x2f3bb3=_0x48000b;_0x3ee1e9=0xc8;}else{_0x3ee1e9=0xce;}_0x37f05a[_0xdafd('0x7')](_0x3ee1e9);return _0x37f05a[_0xdafd('0xd')](_0xdafd('0xe'),_0x413d23+'-'+_0x2f3bb3+'/'+_0x48000b)['json'](_0x57cfee);}return null;};}function saveUpdates(_0x166176,_0x594f47){return function(_0x553508){if(_0x553508){return _0x553508[_0xdafd('0xf')](_0x166176)[_0xdafd('0x10')](function(_0x55b05a){return _0x55b05a;});}return null;};}function handleEntityNotFound(_0x43a716,_0x490382){return function(_0x4b09da){if(!_0x4b09da){_0x43a716[_0xdafd('0x11')](0x194);}return _0x4b09da;};}function handleError(_0x14b895,_0x583b1d){_0x583b1d=_0x583b1d||0x1f4;return function(_0x267bfc){logger[_0xdafd('0x12')](_0x267bfc['stack']);if(_0x267bfc[_0xdafd('0x13')]){delete _0x267bfc[_0xdafd('0x13')];}_0x14b895[_0xdafd('0x7')](_0x583b1d)['send'](_0x267bfc);};}exports[_0xdafd('0x14')]=function(_0x15beca,_0x4fc3a4){var _0x4e6ccc={},_0x2569b2={},_0x5acc78={'count':0x0,'rows':[]};var _0x3556da=_[_0xdafd('0x15')](db[_0xdafd('0x16')][_0xdafd('0x17')],function(_0x1c2029){return{'name':_0x1c2029[_0xdafd('0x18')],'type':_0x1c2029[_0xdafd('0x19')][_0xdafd('0x1a')]};});_0x2569b2[_0xdafd('0x1b')]=_[_0xdafd('0x15')](_0x3556da,_0xdafd('0x13'));_0x2569b2[_0xdafd('0x1c')]=_[_0xdafd('0x1d')](_0x15beca[_0xdafd('0x1c')]);_0x2569b2['filters']=_[_0xdafd('0x1e')](_0x2569b2['model'],_0x2569b2[_0xdafd('0x1c')]);_0x2569b2['filters']=_[_0xdafd('0x1f')](_0x2569b2[_0xdafd('0x20')],[_0xdafd('0x21'),_0xdafd('0x22'),_0xdafd('0x23'),_0xdafd('0x24'),_0xdafd('0x25'),_0xdafd('0x26'),_0xdafd('0x27'),'$eq',_0xdafd('0x28'),_0xdafd('0x29'),_0xdafd('0x2a'),_0xdafd('0x2b'),_0xdafd('0x2c'),_0xdafd('0x2d'),_0xdafd('0x2e'),_0xdafd('0x2f'),_0xdafd('0x30'),_0xdafd('0x2d'),'$overlap',_0xdafd('0x31'),_0xdafd('0x32'),_0xdafd('0x33')]);_0x4e6ccc[_0xdafd('0x34')]=_[_0xdafd('0x1e')](_0x2569b2[_0xdafd('0x1b')],qs['fields'](_0x15beca['query']['fields']));_0x4e6ccc[_0xdafd('0x34')]=_0x4e6ccc[_0xdafd('0x34')]['length']?_0x4e6ccc['attributes']:_0x2569b2[_0xdafd('0x1b')];if(!_0x15beca[_0xdafd('0x1c')][_0xdafd('0x35')](_0xdafd('0x36'))){_0x4e6ccc[_0xdafd('0xa')]=qs[_0xdafd('0xa')](_0x15beca[_0xdafd('0x1c')]['limit']);_0x4e6ccc[_0xdafd('0xc')]=qs[_0xdafd('0xc')](_0x15beca[_0xdafd('0x1c')]['offset']);}_0x4e6ccc[_0xdafd('0x37')]=qs[_0xdafd('0x38')](_0x15beca['query'][_0xdafd('0x38')]);_0x4e6ccc[_0xdafd('0x39')]=qs[_0xdafd('0x20')](_['pick'](_0x15beca[_0xdafd('0x1c')],_0x2569b2[_0xdafd('0x20')]),_0x3556da);if(_0x15beca[_0xdafd('0x1c')][_0xdafd('0x3a')]){_0x4e6ccc[_0xdafd('0x39')]=_[_0xdafd('0x3b')](_0x4e6ccc[_0xdafd('0x39')],{'$or':_['map'](_0x3556da,function(_0x3d904a){if(_0x3d904a[_0xdafd('0x19')]!==_0xdafd('0x3c')){var _0x161d15={};_0x161d15[_0x3d904a[_0xdafd('0x13')]]={'$like':'%'+_0x15beca['query'][_0xdafd('0x3a')]+'%'};return _0x161d15;}})});}_0x4e6ccc=_[_0xdafd('0x3b')]({},_0x4e6ccc,_0x15beca['options']);var _0x3dbdb1={'where':_0x4e6ccc[_0xdafd('0x39')]};return db[_0xdafd('0x16')][_0xdafd('0xb')](_0x3dbdb1)[_0xdafd('0x10')](function(_0x1611f0){_0x5acc78[_0xdafd('0xb')]=_0x1611f0;if(_0x15beca[_0xdafd('0x1c')][_0xdafd('0x3d')]){_0x4e6ccc[_0xdafd('0x3e')]=[{'all':!![]}];}return db[_0xdafd('0x16')][_0xdafd('0x3f')](_0x4e6ccc);})[_0xdafd('0x10')](function(_0x3c446d){_0x5acc78[_0xdafd('0x40')]=_0x3c446d;return _0x5acc78;})[_0xdafd('0x10')](respondWithFilteredResult(_0x4fc3a4,_0x4e6ccc))[_0xdafd('0x41')](handleError(_0x4fc3a4,null));};exports[_0xdafd('0x42')]=function(_0x31dd01,_0x1d4be4){var _0x3f25c2={'raw':!![],'where':{'id':_0x31dd01[_0xdafd('0x43')]['id']}},_0x2605d2={};_0x2605d2[_0xdafd('0x1b')]=_[_0xdafd('0x1d')](db[_0xdafd('0x16')]['rawAttributes']);_0x2605d2['query']=_[_0xdafd('0x1d')](_0x31dd01['query']);_0x2605d2[_0xdafd('0x20')]=_[_0xdafd('0x1e')](_0x2605d2['model'],_0x2605d2['query']);_0x3f25c2[_0xdafd('0x34')]=_[_0xdafd('0x1e')](_0x2605d2[_0xdafd('0x1b')],qs[_0xdafd('0x44')](_0x31dd01[_0xdafd('0x1c')][_0xdafd('0x44')]));_0x3f25c2[_0xdafd('0x34')]=_0x3f25c2[_0xdafd('0x34')][_0xdafd('0x45')]?_0x3f25c2['attributes']:_0x2605d2['model'];if(_0x31dd01[_0xdafd('0x1c')][_0xdafd('0x3d')]){_0x3f25c2[_0xdafd('0x3e')]=[{'all':!![]}];}_0x3f25c2=_[_0xdafd('0x3b')]({},_0x3f25c2,_0x31dd01[_0xdafd('0x46')]);return db[_0xdafd('0x16')][_0xdafd('0x47')](_0x3f25c2)[_0xdafd('0x10')](handleEntityNotFound(_0x1d4be4,null))[_0xdafd('0x10')](respondWithResult(_0x1d4be4,null))[_0xdafd('0x41')](handleError(_0x1d4be4,null));};exports[_0xdafd('0x48')]=function(_0x3a9505,_0x2dee16){return db['CmHopper'][_0xdafd('0x48')](_0x3a9505['body'],{})[_0xdafd('0x10')](respondWithResult(_0x2dee16,0xc9))['catch'](handleError(_0x2dee16,null));};exports[_0xdafd('0xf')]=function(_0x4240b1,_0x4464f2){if(_0x4240b1[_0xdafd('0x49')]['id']){delete _0x4240b1[_0xdafd('0x49')]['id'];}return db[_0xdafd('0x16')]['find']({'where':{'id':_0x4240b1[_0xdafd('0x43')]['id']}})[_0xdafd('0x10')](handleEntityNotFound(_0x4464f2,null))[_0xdafd('0x10')](saveUpdates(_0x4240b1[_0xdafd('0x49')],null))[_0xdafd('0x10')](respondWithResult(_0x4464f2,null))['catch'](handleError(_0x4464f2,null));};exports['describe']=function(_0x189d61,_0x44b71a){return db[_0xdafd('0x16')][_0xdafd('0x4a')]()[_0xdafd('0x10')](respondWithResult(_0x44b71a,null))[_0xdafd('0x41')](handleError(_0x44b71a,null));};exports[_0xdafd('0x4b')]=function(_0x2f5e4c,_0x2ae4cd){var _0x5058b1;var _0x6f2f39=_0x2f5e4c[_0xdafd('0x43')]['id'];return db[_0xdafd('0x16')][_0xdafd('0x47')]({'where':{'id':_0x2f5e4c['params']['id']}})[_0xdafd('0x10')](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x10')](function(_0x254824){if(_0x254824){return _0x254824[_0xdafd('0x4b')]()[_0xdafd('0x10')](function(_0x4b6fbb){return _0x4b6fbb;});}})['then'](function(_0xc1dadb){_0x5058b1=_0xc1dadb;if(_0xc1dadb){if(_0xc1dadb[_0xdafd('0x4c')]||_0xc1dadb['CampaignId']){return db[_0xc1dadb['VoiceQueueId']?_0xdafd('0x4d'):_0xdafd('0x4e')]['find']({'where':{'id':_0xc1dadb[_0xdafd('0x4c')]?_0xc1dadb[_0xdafd('0x4c')]:_0xc1dadb[_0xdafd('0x4f')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x2feff8){var _0x38662d={};if(_0x2feff8){_['merge'](_0x38662d,_[_0xdafd('0x50')](_0x5058b1['dataValues'],['createdAt',_0xdafd('0x51'),'id']));_0x38662d[_0xdafd('0x52')]=0x15;_0x38662d[_0xdafd('0x53')]=_0xdafd('0x54');_0x38662d[_0xdafd('0x55')]=_0x2feff8[_0xdafd('0x13')];_0x38662d[_0xdafd('0x56')]=_0x2f5e4c[_0xdafd('0x57')]['name'];_0x38662d[_0xdafd('0x58')]=_0x2f5e4c[_0xdafd('0x57')]['id'];_0x38662d['deleted']=!![];_0x38662d[_0xdafd('0x59')]=moment()[_0xdafd('0x5a')](_0xdafd('0x5b'));_0x38662d[_0xdafd('0x5c')]=_0x5058b1[_0xdafd('0x5d')];_0x38662d['campaigntype']=_0x5058b1[_0xdafd('0x4c')]?_0xdafd('0x5e'):_0xdafd('0x5f');return db[_0xdafd('0x60')][_0xdafd('0x47')]({'where':{'id':_0x38662d['ContactId']},'attributes':[_0xdafd('0x61'),_0xdafd('0x62')]})['then'](function(_0x4f3059){if(!_[_0xdafd('0x63')](_0x2ae4cd)&&!_['isNil'](_0x4f3059[_0xdafd('0x61')])){_0x38662d['calleridname']=_0x4f3059[_0xdafd('0x61')];if(!_[_0xdafd('0x63')](_0x4f3059[_0xdafd('0x62')])){_0x38662d['calleridname']+='\x20'+_0x4f3059[_0xdafd('0x62')];}}})['finally'](function(){return db[_0xdafd('0x64')][_0xdafd('0x48')](_0x38662d);});}})['then'](function(_0xd9231){return db[_0xdafd('0x65')][_0xdafd('0x4b')]({'where':{'CmHopperId':_0x6f2f39}});})[_0xdafd('0x10')](function(){return _0x2ae4cd[_0xdafd('0x7')](0xcc)['end']();})[_0xdafd('0x41')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x66')]=function(_0x4e1714,_0x316699){var _0x46b3fb=[];return db[_0xdafd('0x60')][_0xdafd('0x4a')]()[_0xdafd('0x10')](function(_0x4d0667){_0x46b3fb=_[_0xdafd('0x1d')](_0x4d0667);return _0x4e1714['user']['getVoiceQueues']({'where':{'type':_0xdafd('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xdafd('0x68'),_0xdafd('0x69')],'raw':!![]});})[_0xdafd('0x10')](function(_0x46564e){if(_0x46564e&&_0x46564e['length']){return db[_0xdafd('0x6a')][_0xdafd('0x6b')](function(_0x3f080b){var _0x4049f8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdafd('0x5a')](_0xdafd('0x5b'))},'VoiceQueueId':{'$in':_[_0xdafd('0x15')](_0x46564e,'id')},'$or':[{'UserId':null},{'UserId':_0x4e1714[_0xdafd('0x57')]['id']}]};var _0x3a6bc1={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x46564e)[_0xdafd('0x3a')]([_0xdafd('0x69'),0x0])[_0xdafd('0x15')]('id')[_0xdafd('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x4e1714[_0xdafd('0x57')]['id']}]};var _0x40f9fa={'$or':[_0x4049f8,_0x3a6bc1]};var _0x339c9e=[];if(_0x4e1714[_0xdafd('0x49')]['direction']&&_0x4e1714[_0xdafd('0x49')]['direction']===_0xdafd('0x6d')){if(!_['isEmpty'](_0x4e1714[_0xdafd('0x49')][_0xdafd('0x6e')])){_0x40f9fa['id']={'$in':_0x4e1714['body']['hopperIds']};}_0x339c9e=[[_0xdafd('0x6f'),_0xdafd('0x70')],[_0xdafd('0x71'),_0x46564e[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0xdafd('0x70')],db['sequelize'][_0xdafd('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xdafd('0x73')]];}else{if(!_[_0xdafd('0x74')](_0x4e1714[_0xdafd('0x49')][_0xdafd('0x6e')])){_0x40f9fa['id']={'$notIn':_0x4e1714[_0xdafd('0x49')]['hopperIds']};}_0x339c9e=[['priority',_0xdafd('0x73')],['scheduledAt',_0x46564e[0x0][_0xdafd('0x68')]],db[_0xdafd('0x6a')]['literal'](_0xdafd('0x75')),['id',_0xdafd('0x70')]];}return db[_0xdafd('0x16')][_0xdafd('0x76')]({'attributes':['id',_0xdafd('0x77'),_0xdafd('0x5d'),_0xdafd('0x78')],'where':_0x40f9fa,'order':_0x339c9e,'transaction':_0x3f080b,'lock':_0x3f080b[_0xdafd('0x79')]['UPDATE'],'include':[{'model':db[_0xdafd('0x60')],'as':_0xdafd('0x7a'),'attributes':_0x46b3fb,'include':[{'model':db['CmCompany'],'as':_0xdafd('0x7b'),'attributes':['id',_0xdafd('0x13')]}]},{'model':db['CmList'],'as':_0xdafd('0x7c'),'attributes':['id',_0xdafd('0x13')]},{'model':db['VoiceQueue'],'as':_0xdafd('0x7d'),'attributes':['id',_0xdafd('0x13'),_0xdafd('0x7e')]}]})['then'](function(_0x1a0f40){if(_0x1a0f40){return _0x1a0f40[_0xdafd('0xf')]({'UserId':_0x4e1714[_0xdafd('0x57')]['id']},{'transaction':_0x3f080b});}});});}})[_0xdafd('0x10')](handleEntityNotFound(_0x316699,null))['then'](respondWithResult(_0x316699,null))['catch'](handleError(_0x316699,null));};exports[_0xdafd('0x7f')]=function(_0x1acd79,_0x5e1bef,_0x3bbf21){var _0x3d3862=[];var _0x6f3fec=_0x1acd79[_0xdafd('0x43')]['id'];var _0x221377=_0x1acd79[_0xdafd('0x57')]['id'];return db['CmContact'][_0xdafd('0x4a')]()[_0xdafd('0x10')](function(_0x5a2359){_0x3d3862=_[_0xdafd('0x1d')](_0x5a2359);return db[_0xdafd('0x6a')][_0xdafd('0x6b')](function(_0x4c09eb){const _0xdadb19={'id':_0x6f3fec};return db[_0xdafd('0x16')][_0xdafd('0x76')]({'attributes':['id',_0xdafd('0x77'),_0xdafd('0x78')],'where':_0xdadb19,'transaction':_0x4c09eb,'lock':_0x4c09eb[_0xdafd('0x79')][_0xdafd('0x80')],'include':[{'model':db['CmContact'],'as':_0xdafd('0x7a'),'attributes':_0x3d3862,'include':[{'model':db[_0xdafd('0x81')],'as':_0xdafd('0x7b'),'attributes':['id',_0xdafd('0x13')]}]},{'model':db[_0xdafd('0x82')],'as':_0xdafd('0x7c'),'attributes':['id',_0xdafd('0x13')]},{'model':db[_0xdafd('0x4d')],'as':_0xdafd('0x7d'),'attributes':['id',_0xdafd('0x13'),_0xdafd('0x7e')]}]})['then'](function(_0x174594){if(_0x174594){return _0x174594[_0xdafd('0xf')]({'UserId':_0x221377},{'transaction':_0x4c09eb});}});});})['then'](handleEntityNotFound(_0x5e1bef,null))[_0xdafd('0x10')](respondWithResult(_0x5e1bef,null))[_0xdafd('0x41')](handleError(_0x5e1bef,null));};exports[_0xdafd('0x83')]=function(_0x53e68a,_0x153578){return _0x53e68a['user'][_0xdafd('0x84')]({'where':{'type':_0xdafd('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xdafd('0x10')](function(_0x1f8091){if(_0x1f8091&&_0x1f8091[_0xdafd('0x45')]){return db[_0xdafd('0x16')][_0xdafd('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdafd('0x5a')](_0xdafd('0x5b'))},'VoiceQueueId':{'$in':_[_0xdafd('0x15')](_0x1f8091,'id')},'$or':[{'UserId':null},{'UserId':_0x53e68a[_0xdafd('0x57')]['id']}]}});}return 0x0;})[_0xdafd('0x10')](function(_0x37b2eb){if(!_[_0xdafd('0x63')](_0x37b2eb)&&_['isNumber'](_0x37b2eb)){return _0x153578['status'](0xc8)[_0xdafd('0x8')]({'contacts':_0x37b2eb});}else{logger[_0xdafd('0x12')](_0xdafd('0x85'),_0xdafd('0x83'),0x194,_0xdafd('0x86'));_0x153578[_0xdafd('0x11')](0x194);}})[_0xdafd('0x41')](handleError(_0x153578,null));};exports[_0xdafd('0x87')]=function(_0x538449,_0x705220){var _0x368142=shared[_0xdafd('0x88')];var _0xed9bfb=[];_['map'](_0x368142,function(_0x5e6114){_0xed9bfb['push']({'id':_0x5e6114[_0xdafd('0x13')],'name':_0x5e6114['name'],'utcOffset':_0x5e6114[_0xdafd('0x89')]});});return _0x705220[_0xdafd('0x7')](0xc8)[_0xdafd('0x8')]({'tz':_0xed9bfb});};exports[_0xdafd('0x8a')]=function(_0x4ff7d5,_0xed0633){var _0x16172d=shared[_0xdafd('0x88')];var _0x1243e5={};if(!_[_0xdafd('0x63')](_0x16172d[_0x4ff7d5['body']['id']]))_0x1243e5=_0x16172d[_0x4ff7d5[_0xdafd('0x49')]['id']];return _0xed0633['status'](0xc8)[_0xdafd('0x8')](_0x1243e5);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 040f7f3..5515cc1 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 _0x31f0=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone'];(function(_0x5cb6d0,_0x108050){var _0xea7288=function(_0x1afe58){while(--_0x1afe58){_0x5cb6d0['push'](_0x5cb6d0['shift']());}};_0xea7288(++_0x108050);}(_0x31f0,0xb7));var _0x031f=function(_0x4e7102,_0x283dee){_0x4e7102=_0x4e7102-0x0;var _0x58f5d1=_0x31f0[_0x4e7102];return _0x58f5d1;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('CmHopper',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[{'name':_0x031f('0xa'),'fields':[_0x031f('0xa')]},{'name':_0x031f('0xb'),'fields':['phone']},{'name':_0x031f('0xc'),'fields':[_0x031f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x21f0c9,_0x53ca25){var _0x137976=function(_0x1f4ea6){while(--_0x1f4ea6){_0x21f0c9['push'](_0x21f0c9['shift']());}};_0x137976(++_0x53ca25);}(_0x33af,0xec));var _0xf33a=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x33af[_0x461119];return _0x4b5ed3;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ad5b521..525adc5 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 _0x2229=['CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','NOW()','Agent','name','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','info','debug','stringify','catch','error','message','ShowCmHopper','find','then','CreateCmHopper','create','body','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','voicePause','length','UserId','push','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer'];(function(_0x512428,_0x1453b6){var _0x4df187=function(_0x499962){while(--_0x499962){_0x512428['push'](_0x512428['shift']());}};_0x4df187(++_0x1453b6);}(_0x2229,0xb5));var _0x9222=function(_0x4dca38,_0x5dfae1){_0x4dca38=_0x4dca38-0x0;var _0x44656c=_0x2229[_0x4dca38];return _0x44656c;};'use strict';var _=require(_0x9222('0x0'));var util=require('util');var moment=require(_0x9222('0x1'));var BPromise=require(_0x9222('0x2'));var db=require(_0x9222('0x3'))['db'];var logger=require(_0x9222('0x4'))(_0x9222('0x5'));exports[_0x9222('0x6')]=function(_0x646df9){var _0x1fffd7=this;return new Promise(function(_0x5e632b,_0x3561ef){return db[_0x9222('0x7')][_0x9222('0x8')]({'raw':_0x646df9['options']?_0x646df9[_0x9222('0x9')][_0x9222('0xa')]===undefined?!![]:![]:!![],'where':_0x646df9[_0x9222('0x9')]?_0x646df9['options'][_0x9222('0xb')]||null:null,'attributes':_0x646df9[_0x9222('0x9')]?_0x646df9[_0x9222('0x9')][_0x9222('0xc')]||null:null,'limit':_0x646df9[_0x9222('0x9')]?_0x646df9[_0x9222('0x9')]['limit']||null:null,'include':_0x646df9['options']?_0x646df9['options'][_0x9222('0xd')]?_['map'](_0x646df9[_0x9222('0x9')][_0x9222('0xd')],function(_0x1a2817){return{'model':db[_0x1a2817['model']],'as':_0x1a2817['as'],'attributes':_0x1a2817['attributes'],'include':_0x1a2817[_0x9222('0xd')]?_[_0x9222('0xe')](_0x1a2817['include'],function(_0x4892c4){return{'model':db[_0x4892c4[_0x9222('0xf')]],'as':_0x4892c4['as'],'attributes':_0x4892c4[_0x9222('0xc')],'include':_0x4892c4['include']?_[_0x9222('0xe')](_0x4892c4[_0x9222('0xd')],function(_0x3c62a5){return{'model':db[_0x3c62a5['model']],'as':_0x3c62a5['as'],'attributes':_0x3c62a5[_0x9222('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcda4cc){logger[_0x9222('0x10')](_0x9222('0x6'),_0x646df9);logger[_0x9222('0x11')](_0x9222('0x6'),_0x646df9,JSON[_0x9222('0x12')](_0xcda4cc));_0x5e632b(_0xcda4cc);})[_0x9222('0x13')](function(_0x7b2cfa){logger[_0x9222('0x14')]('GetCmHopper',_0x7b2cfa[_0x9222('0x15')],_0x646df9);_0x3561ef(_0x1fffd7[_0x9222('0x14')](0x1f4,_0x7b2cfa[_0x9222('0x15')]));});});};exports[_0x9222('0x16')]=function(_0x1ec062){var _0x575621=this;return new Promise(function(_0x1e51ce,_0x3ee736){return db[_0x9222('0x7')][_0x9222('0x17')]({'raw':_0x1ec062[_0x9222('0x9')]?_0x1ec062[_0x9222('0x9')][_0x9222('0xa')]===undefined?!![]:![]:!![],'where':_0x1ec062['options']?_0x1ec062['options'][_0x9222('0xb')]||null:null,'attributes':_0x1ec062[_0x9222('0x9')]?_0x1ec062[_0x9222('0x9')][_0x9222('0xc')]||null:null,'include':_0x1ec062[_0x9222('0x9')]?_0x1ec062['options'][_0x9222('0xd')]?_['map'](_0x1ec062[_0x9222('0x9')][_0x9222('0xd')],function(_0x3bdc21){return{'model':db[_0x3bdc21[_0x9222('0xf')]],'as':_0x3bdc21['as'],'attributes':_0x3bdc21['attributes'],'include':_0x3bdc21[_0x9222('0xd')]?_[_0x9222('0xe')](_0x3bdc21[_0x9222('0xd')],function(_0x514016){return{'model':db[_0x514016[_0x9222('0xf')]],'as':_0x514016['as'],'attributes':_0x514016['attributes'],'include':_0x514016[_0x9222('0xd')]?_[_0x9222('0xe')](_0x514016['include'],function(_0x3024dc){return{'model':db[_0x3024dc['model']],'as':_0x3024dc['as'],'attributes':_0x3024dc[_0x9222('0xc')]};}):[]};}):[]};}):[]:[]})[_0x9222('0x18')](function(_0x968e15){logger[_0x9222('0x10')]('ShowCmHopper',_0x1ec062);logger['debug'](_0x9222('0x16'),_0x1ec062,JSON[_0x9222('0x12')](_0x968e15));_0x1e51ce(_0x968e15);})[_0x9222('0x13')](function(_0x5a8daf){logger[_0x9222('0x14')](_0x9222('0x16'),_0x5a8daf['message'],_0x1ec062);_0x3ee736(_0x575621[_0x9222('0x14')](0x1f4,_0x5a8daf[_0x9222('0x15')]));});});};exports[_0x9222('0x19')]=function(_0x42788c){var _0x55430d=this;return new Promise(function(_0x43ed75,_0x5d8245){return db[_0x9222('0x7')][_0x9222('0x1a')](_0x42788c[_0x9222('0x1b')],{'raw':_0x42788c[_0x9222('0x9')]?_0x42788c['options']['raw']===undefined?!![]:![]:!![]})[_0x9222('0x18')](function(_0xba2659){logger['info'](_0x9222('0x19'),_0x42788c);logger[_0x9222('0x11')](_0x9222('0x19'),_0x42788c,JSON[_0x9222('0x12')](_0xba2659));_0x43ed75(_0xba2659);})['catch'](function(_0x45dd44){logger[_0x9222('0x14')]('CreateCmHopper',_0x45dd44[_0x9222('0x15')],_0x42788c);_0x5d8245(_0x55430d[_0x9222('0x14')](0x1f4,_0x45dd44['message']));});});};exports['UpdateCmHopper']=function(_0xf49d4f){var _0xb30dc9=this;return new Promise(function(_0x446f89,_0x9de80e){return db[_0x9222('0x7')][_0x9222('0x1c')](_0xf49d4f[_0x9222('0x1b')],{'raw':_0xf49d4f[_0x9222('0x9')]?_0xf49d4f['options'][_0x9222('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf49d4f[_0x9222('0x9')]?_0xf49d4f[_0x9222('0x9')][_0x9222('0xb')]||null:null,'attributes':_0xf49d4f[_0x9222('0x9')]?_0xf49d4f['options']['attributes']||null:null,'limit':_0xf49d4f[_0x9222('0x9')]?_0xf49d4f['options'][_0x9222('0x1d')]||null:null})['then'](function(_0x3a1634){logger['info'](_0x9222('0x1e'),_0xf49d4f);logger[_0x9222('0x10')](_0x9222('0x1f'),JSON[_0x9222('0x12')](_0xf49d4f[_0x9222('0x9')][_0x9222('0xb')]),_0xf49d4f['body']['active']);logger['debug'](_0x9222('0x1e'),_0xf49d4f,JSON[_0x9222('0x12')](_0x3a1634));_0x446f89(_0x3a1634);})[_0x9222('0x13')](function(_0xaa2222){logger[_0x9222('0x14')](_0x9222('0x1e'),_0xaa2222[_0x9222('0x15')],_0xf49d4f);_0x9de80e(_0xb30dc9[_0x9222('0x14')](0x1f4,_0xaa2222['message']));});});};exports[_0x9222('0x20')]=function(_0x4fd7f5){var _0x346bab=this;return new Promise(function(_0x5a7460,_0x38de8d){return db[_0x9222('0x7')][_0x9222('0x21')]({'where':_0x4fd7f5[_0x9222('0x9')]?_0x4fd7f5[_0x9222('0x9')][_0x9222('0xb')]||null:null})[_0x9222('0x18')](function(_0x2b4068){logger[_0x9222('0x10')]('DestroyCmHopper',_0x4fd7f5);logger[_0x9222('0x11')]('DestroyCmHopper',_0x4fd7f5,JSON[_0x9222('0x12')](_0x2b4068));_0x5a7460(_0x2b4068);})[_0x9222('0x13')](function(_0x3490e2){logger[_0x9222('0x14')](_0x9222('0x20'),_0x3490e2[_0x9222('0x15')],_0x4fd7f5);_0x38de8d(_0x346bab['error'](0x1f4,_0x3490e2[_0x9222('0x15')]));});});};exports['GetContactDialer']=function(_0x3c45c0){var _0x1cb6ab=this;return new Promise(function(_0x110dd6,_0x294c6a){return db[_0x9222('0x22')][_0x9222('0x23')]()['then'](function(_0x2c642c){return db[_0x9222('0x24')][_0x9222('0x25')](function(_0x317b3d){return db[_0x9222('0x7')][_0x9222('0x8')]({'where':_0x3c45c0[_0x9222('0x9')]?_0x3c45c0[_0x9222('0x9')][_0x9222('0xb')]||null:null,'attributes':_0x3c45c0['options']?_0x3c45c0['options']['attributes']||null:null,'limit':_0x3c45c0['options']?_0x3c45c0['options'][_0x9222('0x1d')]||null:null,'order':_0x3c45c0[_0x9222('0x9')]?_0x3c45c0[_0x9222('0x9')][_0x9222('0x26')]||null:null,'transaction':_0x317b3d,'lock':_0x317b3d[_0x9222('0x27')][_0x9222('0x28')],'include':[{'model':db[_0x9222('0x22')],'as':_0x9222('0x29'),'attributes':_[_0x9222('0x2a')](_0x2c642c)},{'model':db[_0x9222('0x2b')],'as':'Agent','attributes':['id','name',_0x9222('0x2c')]}]})['then'](function(_0x25fcc4){var _0x4e8c4c=[];var _0x43eba5=[];for(var _0x23caab=0x0;_0x23caab<_0x25fcc4[_0x9222('0x2d')];_0x23caab+=0x1){var _0x3cd04b=_0x25fcc4[_0x23caab][_0x9222('0x2e')];if(_0x3cd04b===null){_0x4e8c4c['push'](_0x25fcc4[_0x23caab][_0x9222('0x1c')](_0x3c45c0[_0x9222('0x1b')],{'transaction':_0x317b3d}));}else if(!_0x43eba5['includes'](_0x3cd04b)){_0x43eba5['push'](_0x3cd04b);_0x4e8c4c[_0x9222('0x2f')](_0x25fcc4[_0x23caab][_0x9222('0x1c')](_0x3c45c0[_0x9222('0x1b')],{'transaction':_0x317b3d}));}}return BPromise['all'](_0x4e8c4c);});})[_0x9222('0x18')](function(_0x15760c){logger[_0x9222('0x10')](_0x9222('0x30'),_0x3c45c0);if(_0x15760c[_0x9222('0x2d')]>0x0){logger[_0x9222('0x10')](_0x9222('0x31'),_0x15760c[0x0][_0x9222('0x32')]['id'],_0x15760c[0x0]['dataValues'][_0x9222('0x33')],_0x15760c[0x0][_0x9222('0x32')][_0x9222('0x34')]);}logger[_0x9222('0x11')](_0x9222('0x30'),_0x3c45c0,JSON[_0x9222('0x12')](_0x15760c));_0x110dd6(_0x15760c);})['catch'](function(_0x5ee1dd){logger[_0x9222('0x14')](_0x9222('0x30'),_0x5ee1dd[_0x9222('0x15')],_0x3c45c0);_0x294c6a(_0x1cb6ab['error'](0x1f4,_0x5ee1dd[_0x9222('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x20f7a7){var _0x5cd468=this;return new Promise(function(_0x5f3ad,_0x53d955){return db[_0x9222('0x24')][_0x9222('0x25')](function(_0x1cd5b9){return db[_0x9222('0x35')][_0x9222('0x1a')](_0x20f7a7['body'],{'raw':_0x20f7a7[_0x9222('0x9')]?_0x20f7a7['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x1cd5b9})[_0x9222('0x18')](function(){logger[_0x9222('0x10')](_0x9222('0x36'),JSON[_0x9222('0x12')](_0x20f7a7[_0x9222('0x9')][_0x9222('0xb')]),_0x20f7a7[_0x9222('0x9')][_0x9222('0xb')][_0x9222('0x34')]);return db[_0x9222('0x7')][_0x9222('0x21')]({'where':_0x20f7a7[_0x9222('0x9')]?_0x20f7a7[_0x9222('0x9')]['where']||null:null,'transaction':_0x1cd5b9});});})[_0x9222('0x18')](function(_0x2eafc8){logger[_0x9222('0x10')](_0x9222('0x37'),_0x20f7a7);logger[_0x9222('0x11')](_0x9222('0x37'),_0x20f7a7,JSON[_0x9222('0x12')](_0x2eafc8));_0x5f3ad(_0x2eafc8);})[_0x9222('0x13')](function(_0x18fd77){logger[_0x9222('0x14')](_0x9222('0x37'),_0x18fd77[_0x9222('0x15')],_0x20f7a7);_0x53d955(_0x5cd468[_0x9222('0x14')](0x1f4,_0x18fd77[_0x9222('0x15')]));});});};exports[_0x9222('0x38')]=function(_0x27189a){var _0xe352c2=this;return new Promise(function(_0x2e8e51,_0x1968d2){return db[_0x9222('0x7')][_0x9222('0x8')]({'raw':_0x27189a[_0x9222('0x9')]?_0x27189a[_0x9222('0x9')][_0x9222('0xa')]===undefined?!![]:![]:!![],'where':_0x27189a[_0x9222('0x9')]?_0x27189a['options']['where']||null:null,'attributes':[[db[_0x9222('0x24')]['fn'](_0x9222('0x39'),db['sequelize']['fn']('IF',db[_0x9222('0x24')][_0x9222('0x3a')](_0x9222('0x3b')+util[_0x9222('0x3c')](_0x9222('0x3d'),moment()[_0x9222('0x3c')](_0x9222('0x3e')))+_0x9222('0x3f')))),_0x9222('0x40')]]})['then'](function(_0x582bad){logger['info']('CountReScheduled',_0x27189a);logger[_0x9222('0x11')](_0x9222('0x38'),_0x27189a,JSON[_0x9222('0x12')](_0x582bad));_0x2e8e51(_0x582bad);})[_0x9222('0x13')](function(_0x1f747b){logger[_0x9222('0x14')](_0x9222('0x38'),_0x1f747b['message'],_0x27189a);_0x1968d2(_0xe352c2[_0x9222('0x14')](0x1f4,_0x1f747b[_0x9222('0x15')]));});});};exports[_0x9222('0x41')]=function(_0x1ed2cb){var _0x5a8e06=this;return new Promise(function(_0x3fcd5c,_0x3337fa){return db[_0x9222('0x22')]['describe']()[_0x9222('0x18')](function(){return db['sequelize'][_0x9222('0x25')](function(_0x5ccf11){return db['CmHopper'][_0x9222('0x8')]({'where':_0x1ed2cb[_0x9222('0x9')]?_0x1ed2cb[_0x9222('0x9')]['where']||null:null,'attributes':_0x1ed2cb[_0x9222('0x9')]?_0x1ed2cb[_0x9222('0x9')]['attributes']||null:null,'limit':0x1,'order':_0x1ed2cb[_0x9222('0x9')]?_0x1ed2cb[_0x9222('0x9')][_0x9222('0x26')]||null:null,'group':db[_0x9222('0x7')]['UserId'],'transaction':_0x5ccf11,'lock':_0x5ccf11[_0x9222('0x27')]['UPDATE'],'include':_0x1ed2cb[_0x9222('0x9')]?_0x1ed2cb[_0x9222('0x9')][_0x9222('0xd')]?_[_0x9222('0xe')](_0x1ed2cb[_0x9222('0x9')][_0x9222('0xd')],function(_0x123e3e){return{'model':db[_0x123e3e[_0x9222('0xf')]],'as':_0x123e3e['as'],'attributes':_0x123e3e[_0x9222('0xc')],'include':_0x123e3e['include']?_['map'](_0x123e3e[_0x9222('0xd')],function(_0x33a081){return{'model':db[_0x33a081['model']],'as':_0x33a081['as'],'attributes':_0x33a081[_0x9222('0xc')],'include':_0x33a081['include']?_['map'](_0x33a081['include'],function(_0x4fea95){return{'model':db[_0x4fea95['model']],'as':_0x4fea95['as'],'attributes':_0x4fea95[_0x9222('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39fbfc){var _0x64650f=[];for(var _0x1ed397=0x0;_0x1ed397<_0x39fbfc[_0x9222('0x2d')];_0x1ed397+=0x1){_0x64650f[_0x9222('0x2f')](_0x39fbfc[_0x1ed397]['update'](_0x1ed2cb[_0x9222('0x1b')],{'transaction':_0x5ccf11}));}return BPromise['all'](_0x64650f);});})[_0x9222('0x18')](function(_0x5816da){logger['info'](_0x9222('0x41'),_0x1ed2cb);logger['debug'](_0x9222('0x41'),_0x1ed2cb,JSON[_0x9222('0x12')](_0x5816da));_0x3fcd5c(_0x5816da);})['catch'](function(_0x5d0e1f){logger['error'](_0x9222('0x41'),_0x5d0e1f[_0x9222('0x15')],_0x1ed2cb);_0x3337fa(_0x5a8e06[_0x9222('0x14')](0x1f4,_0x5d0e1f[_0x9222('0x15')]));});});});};exports[_0x9222('0x42')]=function(_0x62022f){var _0x577fd3=this;return new Promise(function(_0x51c552,_0x21ff52){db[_0x9222('0x22')][_0x9222('0x23')]()[_0x9222('0x18')](function(_0x2a5d62){return db[_0x9222('0x7')][_0x9222('0x8')]({'raw':_0x62022f[_0x9222('0x9')]?_0x62022f[_0x9222('0x9')][_0x9222('0xa')]===undefined?!![]:![]:!![],'where':_0x62022f[_0x9222('0x9')]?_0x62022f[_0x9222('0x9')][_0x9222('0xb')]||null:null,'attributes':_0x62022f['options']?_0x62022f['options'][_0x9222('0xc')]||null:null,'limit':_0x62022f[_0x9222('0x9')]?_0x62022f[_0x9222('0x9')][_0x9222('0x1d')]||null:null,'include':_0x62022f[_0x9222('0x9')]?_0x62022f[_0x9222('0x9')][_0x9222('0xd')]?_[_0x9222('0xe')](_0x62022f['options'][_0x9222('0xd')],function(_0x4d6213){return{'model':db[_0x4d6213[_0x9222('0xf')]],'as':_0x4d6213['as'],'attributes':_0x4d6213['as']==='Contact'?_[_0x9222('0x2a')](_0x2a5d62):_0x4d6213[_0x9222('0xc')],'include':_0x4d6213[_0x9222('0xd')]?_[_0x9222('0xe')](_0x4d6213['include'],function(_0x8b09b7){return{'model':db[_0x8b09b7[_0x9222('0xf')]],'as':_0x8b09b7['as'],'attributes':_0x8b09b7[_0x9222('0xc')],'include':_0x8b09b7[_0x9222('0xd')]?_[_0x9222('0xe')](_0x8b09b7[_0x9222('0xd')],function(_0x1ba1d6){return{'model':db[_0x1ba1d6['model']],'as':_0x1ba1d6['as'],'attributes':_0x1ba1d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x9222('0x18')](function(_0x4ce2be){logger[_0x9222('0x10')](_0x9222('0x6'),_0x62022f);logger[_0x9222('0x11')]('GetCmHopper',_0x62022f,JSON['stringify'](_0x4ce2be));_0x51c552(_0x4ce2be);})['catch'](function(_0x357560){logger['error']('GetCmHopper',_0x357560[_0x9222('0x15')],_0x62022f);_0x21ff52(_0x577fd3['error'](0x1f4,_0x357560[_0x9222('0x15')]));});});});};exports[_0x9222('0x43')]=function(_0x565661){var _0x336a74=this;return new Promise(function(_0x51b1de,_0x293f6a){return db[_0x9222('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x565661[_0x9222('0x9')][_0x9222('0xb')]['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0x9222('0x44')]]})[_0x9222('0x18')](function(_0x45d325){logger[_0x9222('0x10')](_0x9222('0x45'),_0x565661);logger['debug']('getContactByPhone',_0x565661,JSON['stringify'](_0x45d325));_0x51b1de(_0x45d325);})['catch'](function(_0x2a80cc){logger[_0x9222('0x14')]('getContactByPhone',_0x2a80cc['message'],_0x565661);_0x293f6a(_0x336a74[_0x9222('0x14')](0x1f4,_0x2a80cc[_0x9222('0x15')]));});});};exports[_0x9222('0x46')]=function(_0x1f012f){var _0x530910=this;return new Promise(function(_0x20d342,_0x58c417){return db[_0x9222('0x24')]['transaction'](function(_0x3d722e){var _0x56a65f=_0x1f012f[_0x9222('0x9')]&&_0x1f012f['options'][_0x9222('0xb')]?_0x1f012f['options'][_0x9222('0xb')]:{};return db[_0x9222('0x7')][_0x9222('0x1c')](_0x1f012f[_0x9222('0x1b')],{'where':_0x56a65f,'transaction':_0x3d722e})[_0x9222('0x18')](function(_0x28398c){logger[_0x9222('0x10')](_0x9222('0x46'),_0x1f012f);logger[_0x9222('0x11')](_0x9222('0x46'),_0x1f012f,JSON['stringify'](_0x28398c));_0x20d342(_0x28398c);})[_0x9222('0x13')](function(_0x364d7a){logger[_0x9222('0x14')](_0x9222('0x46'),_0x364d7a[_0x9222('0x15')],_0x1f012f);_0x58c417(_0x530910[_0x9222('0x14')](0x1f4,_0x364d7a['message']));});});});};exports[_0x9222('0x47')]=function(_0x39b9f2){var _0x25aef9=this;var _0xbb4a49=_0x39b9f2[_0x9222('0x1b')][_0x9222('0xb')]['voiceQueueIds'];var _0x50d5da=_0x39b9f2[_0x9222('0x1b')][_0x9222('0xb')][_0x9222('0x48')];var _0x1659ce=_0x39b9f2[_0x9222('0x1b')][_0x9222('0xb')]['availableAgentsIds'];return new Promise(function(_0x464bc9,_0x3fd1cb){return db[_0x9222('0x7')][_0x9222('0x8')]({'where':{'voiceQueueId':{'$in':_0xbb4a49},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9222('0x24')][_0x9222('0x3a')](_0x9222('0x49')+_0x50d5da+'\x20MINUTE'),'$gt':db[_0x9222('0x24')][_0x9222('0x3a')](_0x9222('0x4a'))}},'UserId':{'$in':_0x1659ce}},'include':[{'model':db[_0x9222('0x22')],'as':_0x9222('0x29')},{'model':db['User'],'as':_0x9222('0x4b'),'attributes':['id',_0x9222('0x4c'),_0x9222('0x2c')]},{'model':db[_0x9222('0x4d')],'as':_0x9222('0x4e')}]})[_0x9222('0x18')](function(_0x281566){if(_0x281566[_0x9222('0x2d')]>0x0){return db[_0x9222('0x24')][_0x9222('0x25')](function(_0x4eb809){return db[_0x9222('0x7')]['update']({'recallmeNotifiedDate':db[_0x9222('0x24')]['literal'](_0x9222('0x4a'))},{'where':{'id':{'$in':_[_0x9222('0xe')](_0x281566,'id')}},'transaction':_0x4eb809})[_0x9222('0x18')](function(){_0x464bc9(_0x281566);})[_0x9222('0x13')](function(_0x30373b){logger[_0x9222('0x14')](_0x9222('0x47'),_0x30373b[_0x9222('0x15')],_0x39b9f2);_0x3fd1cb(_0x25aef9['error'](0x1f4,_0x30373b[_0x9222('0x15')]));});})['catch'](function(_0x2baf8a){logger['error'](_0x9222('0x47'),_0x2baf8a[_0x9222('0x15')],_0x39b9f2);_0x3fd1cb(_0x25aef9['error'](0x1f4,_0x2baf8a[_0x9222('0x15')]));});}else{_0x464bc9(_0x281566);}});});}; \ No newline at end of file +var _0x33f4=['DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','literal','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','raw','where','attributes','include','map','model','then','info','debug','catch','error','message','ShowCmHopper','find','create','body','CreateCmHopper','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','stringify','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','dataValues','active','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','GetCmHopperPreview','findOne','phone','dialTimezone'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33f4,0xf5));var _0x433f=function(_0xfeaf90,_0x399512){_0xfeaf90=_0xfeaf90-0x0;var _0xf96d66=_0x33f4[_0xfeaf90];return _0xf96d66;};'use strict';var _=require(_0x433f('0x0'));var util=require(_0x433f('0x1'));var moment=require('moment');var BPromise=require(_0x433f('0x2'));var db=require(_0x433f('0x3'))['db'];var logger=require(_0x433f('0x4'))(_0x433f('0x5'));exports[_0x433f('0x6')]=function(_0x2522c3){var _0x3cbb2b=this;return new Promise(function(_0x17c508,_0x4fcc15){return db[_0x433f('0x7')]['findAll']({'raw':_0x2522c3[_0x433f('0x8')]?_0x2522c3['options'][_0x433f('0x9')]===undefined?!![]:![]:!![],'where':_0x2522c3[_0x433f('0x8')]?_0x2522c3[_0x433f('0x8')][_0x433f('0xa')]||null:null,'attributes':_0x2522c3['options']?_0x2522c3[_0x433f('0x8')][_0x433f('0xb')]||null:null,'limit':_0x2522c3[_0x433f('0x8')]?_0x2522c3['options']['limit']||null:null,'include':_0x2522c3[_0x433f('0x8')]?_0x2522c3['options'][_0x433f('0xc')]?_[_0x433f('0xd')](_0x2522c3['options']['include'],function(_0x511b45){return{'model':db[_0x511b45[_0x433f('0xe')]],'as':_0x511b45['as'],'attributes':_0x511b45[_0x433f('0xb')],'include':_0x511b45[_0x433f('0xc')]?_[_0x433f('0xd')](_0x511b45[_0x433f('0xc')],function(_0x27f2fe){return{'model':db[_0x27f2fe[_0x433f('0xe')]],'as':_0x27f2fe['as'],'attributes':_0x27f2fe[_0x433f('0xb')],'include':_0x27f2fe[_0x433f('0xc')]?_[_0x433f('0xd')](_0x27f2fe[_0x433f('0xc')],function(_0x164aac){return{'model':db[_0x164aac[_0x433f('0xe')]],'as':_0x164aac['as'],'attributes':_0x164aac[_0x433f('0xb')]};}):[]};}):[]};}):[]:[]})[_0x433f('0xf')](function(_0xd861b0){logger[_0x433f('0x10')](_0x433f('0x6'),_0x2522c3);logger[_0x433f('0x11')]('GetCmHopper',_0x2522c3,JSON['stringify'](_0xd861b0));_0x17c508(_0xd861b0);})[_0x433f('0x12')](function(_0x12041e){logger[_0x433f('0x13')](_0x433f('0x6'),_0x12041e[_0x433f('0x14')],_0x2522c3);_0x4fcc15(_0x3cbb2b[_0x433f('0x13')](0x1f4,_0x12041e[_0x433f('0x14')]));});});};exports[_0x433f('0x15')]=function(_0x527c9c){var _0x337674=this;return new Promise(function(_0x298f35,_0x44ad42){return db[_0x433f('0x7')][_0x433f('0x16')]({'raw':_0x527c9c[_0x433f('0x8')]?_0x527c9c[_0x433f('0x8')][_0x433f('0x9')]===undefined?!![]:![]:!![],'where':_0x527c9c['options']?_0x527c9c['options'][_0x433f('0xa')]||null:null,'attributes':_0x527c9c[_0x433f('0x8')]?_0x527c9c[_0x433f('0x8')]['attributes']||null:null,'include':_0x527c9c[_0x433f('0x8')]?_0x527c9c[_0x433f('0x8')][_0x433f('0xc')]?_['map'](_0x527c9c[_0x433f('0x8')][_0x433f('0xc')],function(_0x292de9){return{'model':db[_0x292de9[_0x433f('0xe')]],'as':_0x292de9['as'],'attributes':_0x292de9[_0x433f('0xb')],'include':_0x292de9[_0x433f('0xc')]?_[_0x433f('0xd')](_0x292de9['include'],function(_0x56a705){return{'model':db[_0x56a705['model']],'as':_0x56a705['as'],'attributes':_0x56a705['attributes'],'include':_0x56a705['include']?_[_0x433f('0xd')](_0x56a705[_0x433f('0xc')],function(_0x405bb2){return{'model':db[_0x405bb2[_0x433f('0xe')]],'as':_0x405bb2['as'],'attributes':_0x405bb2[_0x433f('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f9dc8){logger[_0x433f('0x10')](_0x433f('0x15'),_0x527c9c);logger[_0x433f('0x11')](_0x433f('0x15'),_0x527c9c,JSON['stringify'](_0x4f9dc8));_0x298f35(_0x4f9dc8);})[_0x433f('0x12')](function(_0x20f069){logger[_0x433f('0x13')](_0x433f('0x15'),_0x20f069[_0x433f('0x14')],_0x527c9c);_0x44ad42(_0x337674[_0x433f('0x13')](0x1f4,_0x20f069[_0x433f('0x14')]));});});};exports['CreateCmHopper']=function(_0x3e4c38){var _0x31ecee=this;return new Promise(function(_0x6ef772,_0x2dd59b){return db['CmHopper'][_0x433f('0x17')](_0x3e4c38[_0x433f('0x18')],{'raw':_0x3e4c38[_0x433f('0x8')]?_0x3e4c38['options'][_0x433f('0x9')]===undefined?!![]:![]:!![]})[_0x433f('0xf')](function(_0x2ffe23){logger['info'](_0x433f('0x19'),_0x3e4c38);logger[_0x433f('0x11')](_0x433f('0x19'),_0x3e4c38,JSON['stringify'](_0x2ffe23));_0x6ef772(_0x2ffe23);})[_0x433f('0x12')](function(_0x39f230){logger[_0x433f('0x13')](_0x433f('0x19'),_0x39f230[_0x433f('0x14')],_0x3e4c38);_0x2dd59b(_0x31ecee[_0x433f('0x13')](0x1f4,_0x39f230['message']));});});};exports['UpdateCmHopper']=function(_0x3374e8){var _0x24921d=this;return new Promise(function(_0xafadbf,_0x2fd17b){return db['CmHopper'][_0x433f('0x1a')](_0x3374e8['body'],{'raw':_0x3374e8['options']?_0x3374e8[_0x433f('0x8')][_0x433f('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3374e8[_0x433f('0x8')]?_0x3374e8['options'][_0x433f('0xa')]||null:null,'attributes':_0x3374e8[_0x433f('0x8')]?_0x3374e8[_0x433f('0x8')][_0x433f('0xb')]||null:null,'limit':_0x3374e8['options']?_0x3374e8['options'][_0x433f('0x1b')]||null:null})['then'](function(_0x2043f2){logger['info'](_0x433f('0x1c'),_0x3374e8);logger[_0x433f('0x10')](_0x433f('0x1d'),JSON[_0x433f('0x1e')](_0x3374e8[_0x433f('0x8')]['where']),_0x3374e8['body']['active']);logger[_0x433f('0x11')](_0x433f('0x1c'),_0x3374e8,JSON[_0x433f('0x1e')](_0x2043f2));_0xafadbf(_0x2043f2);})['catch'](function(_0x17b4eb){logger[_0x433f('0x13')]('UpdateCmHopper',_0x17b4eb[_0x433f('0x14')],_0x3374e8);_0x2fd17b(_0x24921d['error'](0x1f4,_0x17b4eb[_0x433f('0x14')]));});});};exports['DestroyCmHopper']=function(_0x1f4f83){var _0x269e2c=this;return new Promise(function(_0x5201e3,_0x2d04fc){return db[_0x433f('0x7')][_0x433f('0x1f')]({'where':_0x1f4f83[_0x433f('0x8')]?_0x1f4f83[_0x433f('0x8')]['where']||null:null})['then'](function(_0x3714e4){logger['info']('DestroyCmHopper',_0x1f4f83);logger[_0x433f('0x11')](_0x433f('0x20'),_0x1f4f83,JSON[_0x433f('0x1e')](_0x3714e4));_0x5201e3(_0x3714e4);})[_0x433f('0x12')](function(_0x2dbcc0){logger[_0x433f('0x13')]('DestroyCmHopper',_0x2dbcc0['message'],_0x1f4f83);_0x2d04fc(_0x269e2c[_0x433f('0x13')](0x1f4,_0x2dbcc0['message']));});});};exports[_0x433f('0x21')]=function(_0x167c33){var _0x212f16=this;return new Promise(function(_0x2913a9,_0x4e3fa9){return db[_0x433f('0x22')][_0x433f('0x23')]()['then'](function(_0x1e9c03){return db[_0x433f('0x24')][_0x433f('0x25')](function(_0xe9ad98){return db[_0x433f('0x7')][_0x433f('0x26')]({'where':_0x167c33['options']?_0x167c33[_0x433f('0x8')][_0x433f('0xa')]||null:null,'attributes':_0x167c33[_0x433f('0x8')]?_0x167c33[_0x433f('0x8')][_0x433f('0xb')]||null:null,'limit':_0x167c33['options']?_0x167c33[_0x433f('0x8')][_0x433f('0x1b')]||null:null,'order':_0x167c33['options']?_0x167c33[_0x433f('0x8')][_0x433f('0x27')]||null:null,'transaction':_0xe9ad98,'lock':_0xe9ad98['LOCK'][_0x433f('0x28')],'include':[{'model':db[_0x433f('0x22')],'as':_0x433f('0x29'),'attributes':_[_0x433f('0x2a')](_0x1e9c03)},{'model':db[_0x433f('0x2b')],'as':_0x433f('0x2c'),'attributes':['id',_0x433f('0x2d'),_0x433f('0x2e')]}]})['then'](function(_0x4808b4){var _0x199779=[];var _0x4eb1a7=[];for(var _0x66897d=0x0;_0x66897d<_0x4808b4[_0x433f('0x2f')];_0x66897d+=0x1){var _0x55e90e=_0x4808b4[_0x66897d][_0x433f('0x30')];if(_0x55e90e===null){_0x199779[_0x433f('0x31')](_0x4808b4[_0x66897d]['update'](_0x167c33[_0x433f('0x18')],{'transaction':_0xe9ad98}));}else if(!_0x4eb1a7[_0x433f('0x32')](_0x55e90e)){_0x4eb1a7[_0x433f('0x31')](_0x55e90e);_0x199779[_0x433f('0x31')](_0x4808b4[_0x66897d][_0x433f('0x1a')](_0x167c33[_0x433f('0x18')],{'transaction':_0xe9ad98}));}}return BPromise['all'](_0x199779);});})[_0x433f('0xf')](function(_0x321f69){logger[_0x433f('0x10')](_0x433f('0x21'),_0x167c33);if(_0x321f69['length']>0x0){logger[_0x433f('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x321f69[0x0][_0x433f('0x33')]['id'],_0x321f69[0x0][_0x433f('0x33')]['ContactId'],_0x321f69[0x0][_0x433f('0x33')][_0x433f('0x34')]);}logger[_0x433f('0x11')](_0x433f('0x21'),_0x167c33,JSON[_0x433f('0x1e')](_0x321f69));_0x2913a9(_0x321f69);})[_0x433f('0x12')](function(_0x1f6eb3){logger[_0x433f('0x13')]('GetContactDialer',_0x1f6eb3['message'],_0x167c33);_0x4e3fa9(_0x212f16[_0x433f('0x13')](0x1f4,_0x1f6eb3[_0x433f('0x14')]));});});});};exports[_0x433f('0x35')]=function(_0x4030ef){var _0x5583a8=this;return new Promise(function(_0x267297,_0x1f371a){return db[_0x433f('0x24')][_0x433f('0x25')](function(_0x305dad){return db[_0x433f('0x36')][_0x433f('0x17')](_0x4030ef[_0x433f('0x18')],{'raw':_0x4030ef[_0x433f('0x8')]?_0x4030ef['options'][_0x433f('0x9')]===undefined?!![]:![]:!![],'transaction':_0x305dad})['then'](function(){logger[_0x433f('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x433f('0x1e')](_0x4030ef[_0x433f('0x8')][_0x433f('0xa')]),_0x4030ef[_0x433f('0x8')][_0x433f('0xa')][_0x433f('0x34')]);return db[_0x433f('0x7')]['destroy']({'where':_0x4030ef[_0x433f('0x8')]?_0x4030ef[_0x433f('0x8')][_0x433f('0xa')]||null:null,'transaction':_0x305dad});});})[_0x433f('0xf')](function(_0x5ad28b){logger[_0x433f('0x10')](_0x433f('0x35'),_0x4030ef);logger['debug'](_0x433f('0x35'),_0x4030ef,JSON[_0x433f('0x1e')](_0x5ad28b));_0x267297(_0x5ad28b);})[_0x433f('0x12')](function(_0x2f07e7){logger[_0x433f('0x13')]('MoveContactManagedDialer',_0x2f07e7[_0x433f('0x14')],_0x4030ef);_0x1f371a(_0x5583a8[_0x433f('0x13')](0x1f4,_0x2f07e7[_0x433f('0x14')]));});});};exports[_0x433f('0x37')]=function(_0x5bc61d){var _0x18cd02=this;return new Promise(function(_0x243b78,_0x933cb3){return db[_0x433f('0x7')][_0x433f('0x26')]({'raw':_0x5bc61d[_0x433f('0x8')]?_0x5bc61d[_0x433f('0x8')][_0x433f('0x9')]===undefined?!![]:![]:!![],'where':_0x5bc61d[_0x433f('0x8')]?_0x5bc61d[_0x433f('0x8')][_0x433f('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x433f('0x38'),db['sequelize']['fn']('IF',db[_0x433f('0x24')]['literal']('`scheduledat`\x20>=\x20'+util[_0x433f('0x39')](_0x433f('0x3a'),moment()[_0x433f('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x433f('0x3b')))),_0x433f('0x3c')]]})[_0x433f('0xf')](function(_0x8dde53){logger[_0x433f('0x10')](_0x433f('0x37'),_0x5bc61d);logger['debug'](_0x433f('0x37'),_0x5bc61d,JSON['stringify'](_0x8dde53));_0x243b78(_0x8dde53);})[_0x433f('0x12')](function(_0x2a956f){logger[_0x433f('0x13')](_0x433f('0x37'),_0x2a956f[_0x433f('0x14')],_0x5bc61d);_0x933cb3(_0x18cd02[_0x433f('0x13')](0x1f4,_0x2a956f['message']));});});};exports[_0x433f('0x3d')]=function(_0x4ee298){var _0x488967=this;return new Promise(function(_0x28bebd,_0x25ef82){return db[_0x433f('0x22')]['describe']()[_0x433f('0xf')](function(){return db[_0x433f('0x24')][_0x433f('0x25')](function(_0xc9186){return db['CmHopper'][_0x433f('0x26')]({'where':_0x4ee298[_0x433f('0x8')]?_0x4ee298['options']['where']||null:null,'attributes':_0x4ee298[_0x433f('0x8')]?_0x4ee298[_0x433f('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x4ee298[_0x433f('0x8')]?_0x4ee298[_0x433f('0x8')][_0x433f('0x27')]||null:null,'group':db[_0x433f('0x7')]['UserId'],'transaction':_0xc9186,'lock':_0xc9186['LOCK'][_0x433f('0x28')],'include':_0x4ee298['options']?_0x4ee298[_0x433f('0x8')]['include']?_[_0x433f('0xd')](_0x4ee298['options'][_0x433f('0xc')],function(_0x32749e){return{'model':db[_0x32749e[_0x433f('0xe')]],'as':_0x32749e['as'],'attributes':_0x32749e[_0x433f('0xb')],'include':_0x32749e['include']?_[_0x433f('0xd')](_0x32749e['include'],function(_0x4abd0a){return{'model':db[_0x4abd0a['model']],'as':_0x4abd0a['as'],'attributes':_0x4abd0a['attributes'],'include':_0x4abd0a[_0x433f('0xc')]?_['map'](_0x4abd0a['include'],function(_0xa384da){return{'model':db[_0xa384da[_0x433f('0xe')]],'as':_0xa384da['as'],'attributes':_0xa384da[_0x433f('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3be62f){var _0x6734cb=[];for(var _0x2dbe9a=0x0;_0x2dbe9a<_0x3be62f['length'];_0x2dbe9a+=0x1){_0x6734cb['push'](_0x3be62f[_0x2dbe9a][_0x433f('0x1a')](_0x4ee298[_0x433f('0x18')],{'transaction':_0xc9186}));}return BPromise[_0x433f('0x3e')](_0x6734cb);});})[_0x433f('0xf')](function(_0x5f167a){logger[_0x433f('0x10')](_0x433f('0x3d'),_0x4ee298);logger[_0x433f('0x11')]('GetContactRecallMe',_0x4ee298,JSON[_0x433f('0x1e')](_0x5f167a));_0x28bebd(_0x5f167a);})[_0x433f('0x12')](function(_0x49554c){logger[_0x433f('0x13')](_0x433f('0x3d'),_0x49554c[_0x433f('0x14')],_0x4ee298);_0x25ef82(_0x488967['error'](0x1f4,_0x49554c[_0x433f('0x14')]));});});});};exports[_0x433f('0x3f')]=function(_0x48c1d3){var _0xbbb582=this;return new Promise(function(_0x38cad6,_0x185786){db[_0x433f('0x22')][_0x433f('0x23')]()[_0x433f('0xf')](function(_0x5084c9){return db[_0x433f('0x7')][_0x433f('0x26')]({'raw':_0x48c1d3[_0x433f('0x8')]?_0x48c1d3[_0x433f('0x8')][_0x433f('0x9')]===undefined?!![]:![]:!![],'where':_0x48c1d3[_0x433f('0x8')]?_0x48c1d3['options']['where']||null:null,'attributes':_0x48c1d3[_0x433f('0x8')]?_0x48c1d3['options'][_0x433f('0xb')]||null:null,'limit':_0x48c1d3[_0x433f('0x8')]?_0x48c1d3[_0x433f('0x8')][_0x433f('0x1b')]||null:null,'include':_0x48c1d3['options']?_0x48c1d3['options'][_0x433f('0xc')]?_[_0x433f('0xd')](_0x48c1d3[_0x433f('0x8')][_0x433f('0xc')],function(_0x275199){return{'model':db[_0x275199[_0x433f('0xe')]],'as':_0x275199['as'],'attributes':_0x275199['as']===_0x433f('0x29')?_[_0x433f('0x2a')](_0x5084c9):_0x275199[_0x433f('0xb')],'include':_0x275199[_0x433f('0xc')]?_['map'](_0x275199['include'],function(_0x4970f6){return{'model':db[_0x4970f6['model']],'as':_0x4970f6['as'],'attributes':_0x4970f6[_0x433f('0xb')],'include':_0x4970f6[_0x433f('0xc')]?_[_0x433f('0xd')](_0x4970f6['include'],function(_0x2cad58){return{'model':db[_0x2cad58[_0x433f('0xe')]],'as':_0x2cad58['as'],'attributes':_0x2cad58['attributes']};}):[]};}):[]};}):[]:[]})[_0x433f('0xf')](function(_0x23ddab){logger[_0x433f('0x10')](_0x433f('0x6'),_0x48c1d3);logger['debug']('GetCmHopper',_0x48c1d3,JSON[_0x433f('0x1e')](_0x23ddab));_0x38cad6(_0x23ddab);})[_0x433f('0x12')](function(_0x2a44d9){logger[_0x433f('0x13')](_0x433f('0x6'),_0x2a44d9[_0x433f('0x14')],_0x48c1d3);_0x185786(_0xbbb582[_0x433f('0x13')](0x1f4,_0x2a44d9[_0x433f('0x14')]));});});});};exports['GetContactByPhone']=function(_0x975e83){var _0x1981a2=this;return new Promise(function(_0x1fb50e,_0x169a55){return db[_0x433f('0x22')][_0x433f('0x40')]({'raw':!![],'where':{'phone':_0x975e83[_0x433f('0x8')]['where'][_0x433f('0x41')]},'attributes':['id',_0x433f('0x42')],'order':[['id',_0x433f('0x43')]]})['then'](function(_0x4247d2){logger[_0x433f('0x10')](_0x433f('0x44'),_0x975e83);logger[_0x433f('0x11')]('getContactByPhone',_0x975e83,JSON[_0x433f('0x1e')](_0x4247d2));_0x1fb50e(_0x4247d2);})[_0x433f('0x12')](function(_0x1d6a5e){logger[_0x433f('0x13')](_0x433f('0x44'),_0x1d6a5e[_0x433f('0x14')],_0x975e83);_0x169a55(_0x1981a2['error'](0x1f4,_0x1d6a5e[_0x433f('0x14')]));});});};exports[_0x433f('0x45')]=function(_0x284da5){var _0x442191=this;return new Promise(function(_0x2d50cc,_0x40ffe2){return db[_0x433f('0x24')]['transaction'](function(_0x43f149){var _0x41ce3a=_0x284da5[_0x433f('0x8')]&&_0x284da5[_0x433f('0x8')][_0x433f('0xa')]?_0x284da5[_0x433f('0x8')]['where']:{};return db[_0x433f('0x7')]['update'](_0x284da5[_0x433f('0x18')],{'where':_0x41ce3a,'transaction':_0x43f149})['then'](function(_0x208965){logger[_0x433f('0x10')]('ResetActiveCalls',_0x284da5);logger['debug']('ResetActiveCalls',_0x284da5,JSON[_0x433f('0x1e')](_0x208965));_0x2d50cc(_0x208965);})[_0x433f('0x12')](function(_0x242cc7){logger[_0x433f('0x13')]('ResetActiveCalls',_0x242cc7[_0x433f('0x14')],_0x284da5);_0x40ffe2(_0x442191[_0x433f('0x13')](0x1f4,_0x242cc7[_0x433f('0x14')]));});});});};exports[_0x433f('0x46')]=function(_0x217462){var _0x43fb0f=this;var _0x46e0bf=_0x217462[_0x433f('0x18')][_0x433f('0xa')][_0x433f('0x47')];var _0x3a33b9=_0x217462[_0x433f('0x18')][_0x433f('0xa')]['interval'];var _0x37a371=_0x217462['body'][_0x433f('0xa')]['availableAgentsIds'];return new Promise(function(_0x502b02,_0x1681eb){return db['CmHopper'][_0x433f('0x26')]({'where':{'voiceQueueId':{'$in':_0x46e0bf},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x433f('0x24')]['literal'](_0x433f('0x48')+_0x3a33b9+_0x433f('0x49')),'$gt':db[_0x433f('0x24')]['literal'](_0x433f('0x4a'))}},'UserId':{'$in':_0x37a371}},'include':[{'model':db[_0x433f('0x22')],'as':'Contact'},{'model':db[_0x433f('0x2b')],'as':'Agent','attributes':['id',_0x433f('0x2d'),'voicePause']},{'model':db[_0x433f('0x4b')],'as':_0x433f('0x4c')}]})[_0x433f('0xf')](function(_0x4aae83){if(_0x4aae83[_0x433f('0x2f')]>0x0){return db[_0x433f('0x24')][_0x433f('0x25')](function(_0x552f7a){return db[_0x433f('0x7')][_0x433f('0x1a')]({'recallmeNotifiedDate':db[_0x433f('0x24')][_0x433f('0x4d')](_0x433f('0x4a'))},{'where':{'id':{'$in':_[_0x433f('0xd')](_0x4aae83,'id')}},'transaction':_0x552f7a})[_0x433f('0xf')](function(){_0x502b02(_0x4aae83);})[_0x433f('0x12')](function(_0x51c518){logger[_0x433f('0x13')](_0x433f('0x46'),_0x51c518[_0x433f('0x14')],_0x217462);_0x1681eb(_0x43fb0f[_0x433f('0x13')](0x1f4,_0x51c518[_0x433f('0x14')]));});})[_0x433f('0x12')](function(_0x122d82){logger[_0x433f('0x13')](_0x433f('0x46'),_0x122d82['message'],_0x217462);_0x1681eb(_0x43fb0f['error'](0x1f4,_0x122d82['message']));});}else{_0x502b02(_0x4aae83);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index e6ae4e3..41a3722 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 _0x7773=['getPreview','/timezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','create','/preview'];(function(_0x5e9590,_0x390b30){var _0x3d0ecd=function(_0x4a1738){while(--_0x4a1738){_0x5e9590['push'](_0x5e9590['shift']());}};_0x3d0ecd(++_0x390b30);}(_0x7773,0x74));var _0x3777=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7773[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x3777('0x0'));var router=express[_0x3777('0x1')]();var auth=require(_0x3777('0x2'));var controller=require(_0x3777('0x3'));router['get']('/',auth[_0x3777('0x4')](),controller[_0x3777('0x5')]);router[_0x3777('0x6')]('/describe',auth[_0x3777('0x4')](),controller['describe']);router['get'](_0x3777('0x7'),auth[_0x3777('0x4')](),controller[_0x3777('0x8')]);router['get'](_0x3777('0x9'),auth['isAuthenticated'](),controller[_0x3777('0xa')]);router[_0x3777('0x6')](_0x3777('0xb'),auth[_0x3777('0x4')](),controller['show']);router[_0x3777('0x6')](_0x3777('0xc'),auth[_0x3777('0x4')](),controller['getPreviewRecall']);router[_0x3777('0xd')]('/',auth[_0x3777('0x4')](),controller[_0x3777('0xe')]);router[_0x3777('0xd')](_0x3777('0xf'),auth['isAuthenticated'](),controller[_0x3777('0x10')]);router[_0x3777('0xd')](_0x3777('0x11'),auth[_0x3777('0x4')](),controller['getTimezone']);router['put'](_0x3777('0xb'),auth[_0x3777('0x4')](),controller[_0x3777('0x12')]);router[_0x3777('0x13')](_0x3777('0xb'),auth[_0x3777('0x4')](),controller[_0x3777('0x14')]);module[_0x3777('0x15')]=router; \ No newline at end of file +var _0xe100=['express','Router','./cmHopper.controller','index','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','show','create','post','getPreview','/timezone','getTimezone','put','update','delete','destroy'];(function(_0xca2488,_0x14de01){var _0xa77bb9=function(_0x2b820c){while(--_0x2b820c){_0xca2488['push'](_0xca2488['shift']());}};_0xa77bb9(++_0x14de01);}(_0xe100,0x14a));var _0x0e10=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe100[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x0e10('0x0'));var router=express[_0x0e10('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x0e10('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x0e10('0x3')]);router[_0x0e10('0x4')](_0x0e10('0x5'),auth[_0x0e10('0x6')](),controller[_0x0e10('0x7')]);router[_0x0e10('0x4')](_0x0e10('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x0e10('0x4')](_0x0e10('0x9'),auth[_0x0e10('0x6')](),controller[_0x0e10('0xa')]);router[_0x0e10('0x4')](_0x0e10('0xb'),auth[_0x0e10('0x6')](),controller[_0x0e10('0xc')]);router[_0x0e10('0x4')]('/:id/previewrecall',auth[_0x0e10('0x6')](),controller['getPreviewRecall']);router['post']('/',auth[_0x0e10('0x6')](),controller[_0x0e10('0xd')]);router[_0x0e10('0xe')]('/preview',auth['isAuthenticated'](),controller[_0x0e10('0xf')]);router[_0x0e10('0xe')](_0x0e10('0x10'),auth[_0x0e10('0x6')](),controller[_0x0e10('0x11')]);router[_0x0e10('0x12')](_0x0e10('0xb'),auth[_0x0e10('0x6')](),controller[_0x0e10('0x13')]);router[_0x0e10('0x14')](_0x0e10('0xb'),auth[_0x0e10('0x6')](),controller[_0x0e10('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ca401a6..15e5394 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 _0x229e=['exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x52dfe9,_0x4a0c76){var _0x4fd409=function(_0x89db85){while(--_0x89db85){_0x52dfe9['push'](_0x52dfe9['shift']());}};_0x4fd409(++_0x4a0c76);}(_0x229e,0x1ee));var _0xe229=function(_0x4722ac,_0x31800e){_0x4722ac=_0x4722ac-0x0;var _0x42e5d2=_0x229e[_0x4722ac];return _0x42e5d2;};'use strict';var moment=require(_0xe229('0x0'));var Sequelize=require(_0xe229('0x1'));module[_0xe229('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xe229('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe229('0x5')],'defaultValue':moment()[_0xe229('0x6')](_0xe229('0x7'))},'countbusyretry':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe229('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x44d3=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x388a4c,_0x18317d){var _0x33b8a1=function(_0x1a74b2){while(--_0x1a74b2){_0x388a4c['push'](_0x388a4c['shift']());}};_0x33b8a1(++_0x18317d);}(_0x44d3,0x1be));var _0x344d=function(_0x8fd9c2,_0x1426e3){_0x8fd9c2=_0x8fd9c2-0x0;var _0x20b8c3=_0x44d3[_0x8fd9c2];return _0x20b8c3;};'use strict';var moment=require('moment');var Sequelize=require(_0x344d('0x0'));module[_0x344d('0x1')]={'CmHopperId':{'type':Sequelize[_0x344d('0x2')]},'phone':{'type':Sequelize[_0x344d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x344d('0x4')],'defaultValue':moment()[_0x344d('0x5')](_0x344d('0x6'))},'countbusyretry':{'type':Sequelize[_0x344d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x344d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x344d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x344d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x344d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x344d('0x2')],'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 559b697..4e7bdb8 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 _0x1b1f=['merge','type','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','params','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','get','CmHopperAdditionalPhones','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x1b1f,0x168));var _0xf1b1=function(_0x310947,_0x22d6da){_0x310947=_0x310947-0x0;var _0x460383=_0x1b1f[_0x310947];return _0x460383;};'use strict';var emlformat=require(_0xf1b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1b1('0x2'));var moment=require(_0xf1b1('0x3'));var BPromise=require(_0xf1b1('0x4'));var Mustache=require(_0xf1b1('0x5'));var util=require('util');var path=require(_0xf1b1('0x6'));var sox=require(_0xf1b1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1b1('0x8'));var _=require(_0xf1b1('0x9'));var squel=require(_0xf1b1('0xa'));var crypto=require('crypto');var jsforce=require(_0xf1b1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf1b1('0xc'));var querystring=require(_0xf1b1('0xd'));var Papa=require(_0xf1b1('0xe'));var Redis=require(_0xf1b1('0xf'));var authService=require(_0xf1b1('0x10'));var qs=require(_0xf1b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1b1('0x12'));var logger=require(_0xf1b1('0x13'))(_0xf1b1('0x14'));var utils=require(_0xf1b1('0x15'));var config=require(_0xf1b1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1b1('0x17'))['db'];function respondWithStatusCode(_0x1c8356,_0x2c5e3e){_0x2c5e3e=_0x2c5e3e||0xcc;return function(_0x5e7f40){if(_0x5e7f40){return _0x1c8356['sendStatus'](_0x2c5e3e);}return _0x1c8356[_0xf1b1('0x18')](_0x2c5e3e)[_0xf1b1('0x19')]();};}function respondWithResult(_0x5c0fbc,_0x48ca59){_0x48ca59=_0x48ca59||0xc8;return function(_0x266fa2){if(_0x266fa2){return _0x5c0fbc[_0xf1b1('0x18')](_0x48ca59)['json'](_0x266fa2);}};}function respondWithFilteredResult(_0x40e925,_0x772cdd){return function(_0x5a3c7c){if(_0x5a3c7c){var _0xe8012c=typeof _0x772cdd[_0xf1b1('0x1a')]===_0xf1b1('0x1b')&&typeof _0x772cdd[_0xf1b1('0x1c')]===_0xf1b1('0x1b');var _0x21d298=_0x5a3c7c[_0xf1b1('0x1d')];var _0x621ccf=_0xe8012c?0x0:_0x772cdd['offset'];var _0x568e47=_0xe8012c?_0x5a3c7c[_0xf1b1('0x1d')]:_0x772cdd[_0xf1b1('0x1a')]+_0x772cdd[_0xf1b1('0x1c')];var _0x26f979;if(_0x568e47>=_0x21d298){_0x568e47=_0x21d298;_0x26f979=0xc8;}else{_0x26f979=0xce;}_0x40e925[_0xf1b1('0x18')](_0x26f979);return _0x40e925[_0xf1b1('0x1e')](_0xf1b1('0x1f'),_0x621ccf+'-'+_0x568e47+'/'+_0x21d298)[_0xf1b1('0x20')](_0x5a3c7c);}return null;};}function patchUpdates(_0x4aba60){return function(_0x14f68d){try{jsonpatch[_0xf1b1('0x21')](_0x14f68d,_0x4aba60,!![]);}catch(_0x53bdfa){return BPromise['reject'](_0x53bdfa);}return _0x14f68d[_0xf1b1('0x22')]();};}function saveUpdates(_0x34e931,_0x406f03){return function(_0x2b29ce){if(_0x2b29ce){return _0x2b29ce[_0xf1b1('0x23')](_0x34e931)['then'](function(_0x1a5bf1){return _0x1a5bf1;});}return null;};}function removeEntity(_0xa1183,_0x482f6c){return function(_0x576c7d){if(_0x576c7d){return _0x576c7d['destroy']()['then'](function(){var _0x4a1a83=_0x576c7d[_0xf1b1('0x24')]({'plain':!![]});var _0x33badf=_0xf1b1('0x25');return db[_0xf1b1('0x26')]['destroy']({'where':{'type':_0x33badf,'resourceId':_0x4a1a83['id']}})[_0xf1b1('0x27')](function(){return _0x576c7d;});})[_0xf1b1('0x27')](function(){_0xa1183[_0xf1b1('0x18')](0xcc)[_0xf1b1('0x19')]();});}};}function handleEntityNotFound(_0x3fa82d,_0x287047){return function(_0x300c90){if(!_0x300c90){_0x3fa82d[_0xf1b1('0x28')](0x194);}return _0x300c90;};}function handleError(_0x24c31c,_0x313998){_0x313998=_0x313998||0x1f4;return function(_0x13af83){logger[_0xf1b1('0x29')](_0x13af83[_0xf1b1('0x2a')]);if(_0x13af83[_0xf1b1('0x2b')]){delete _0x13af83[_0xf1b1('0x2b')];}_0x24c31c[_0xf1b1('0x18')](_0x313998)[_0xf1b1('0x2c')](_0x13af83);};}exports[_0xf1b1('0x2d')]=function(_0x13ac10,_0x28e599){var _0x414a23={},_0x48b693={},_0x157c4b={'count':0x0,'rows':[]};var _0x4944f3=_[_0xf1b1('0x2e')](db[_0xf1b1('0x2f')][_0xf1b1('0x30')],function(_0x1f5911){return{'name':_0x1f5911[_0xf1b1('0x31')],'type':_0x1f5911['type'][_0xf1b1('0x32')]};});_0x48b693['model']=_['map'](_0x4944f3,_0xf1b1('0x2b'));_0x48b693[_0xf1b1('0x33')]=_[_0xf1b1('0x34')](_0x13ac10['query']);_0x48b693['filters']=_['intersection'](_0x48b693[_0xf1b1('0x35')],_0x48b693[_0xf1b1('0x33')]);_0x414a23['attributes']=_[_0xf1b1('0x36')](_0x48b693[_0xf1b1('0x35')],qs[_0xf1b1('0x37')](_0x13ac10[_0xf1b1('0x33')]['fields']));_0x414a23[_0xf1b1('0x38')]=_0x414a23[_0xf1b1('0x38')][_0xf1b1('0x39')]?_0x414a23[_0xf1b1('0x38')]:_0x48b693[_0xf1b1('0x35')];if(!_0x13ac10[_0xf1b1('0x33')][_0xf1b1('0x3a')](_0xf1b1('0x3b'))){_0x414a23[_0xf1b1('0x1c')]=qs[_0xf1b1('0x1c')](_0x13ac10['query'][_0xf1b1('0x1c')]);_0x414a23[_0xf1b1('0x1a')]=qs[_0xf1b1('0x1a')](_0x13ac10[_0xf1b1('0x33')][_0xf1b1('0x1a')]);}_0x414a23['order']=qs[_0xf1b1('0x3c')](_0x13ac10[_0xf1b1('0x33')][_0xf1b1('0x3c')]);_0x414a23[_0xf1b1('0x3d')]=qs[_0xf1b1('0x3e')](_[_0xf1b1('0x3f')](_0x13ac10[_0xf1b1('0x33')],_0x48b693[_0xf1b1('0x3e')]),_0x4944f3);if(_0x13ac10[_0xf1b1('0x33')][_0xf1b1('0x40')]){_0x414a23['where']=_[_0xf1b1('0x41')](_0x414a23[_0xf1b1('0x3d')],{'$or':_[_0xf1b1('0x2e')](_0x4944f3,function(_0x52b69d){if(_0x52b69d[_0xf1b1('0x42')]!==_0xf1b1('0x43')){var _0x59cbb7={};_0x59cbb7[_0x52b69d[_0xf1b1('0x2b')]]={'$like':'%'+_0x13ac10[_0xf1b1('0x33')][_0xf1b1('0x40')]+'%'};return _0x59cbb7;}})});}_0x414a23=_[_0xf1b1('0x41')]({},_0x414a23,_0x13ac10[_0xf1b1('0x44')]);var _0x2d8480={'where':_0x414a23['where']};return db[_0xf1b1('0x2f')][_0xf1b1('0x1d')](_0x2d8480)['then'](function(_0x11d3c7){_0x157c4b[_0xf1b1('0x1d')]=_0x11d3c7;if(_0x13ac10[_0xf1b1('0x33')]['includeAll']){_0x414a23[_0xf1b1('0x45')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xf1b1('0x46')](_0x414a23);})[_0xf1b1('0x27')](function(_0x34ecab){_0x157c4b[_0xf1b1('0x47')]=_0x34ecab;return _0x157c4b;})[_0xf1b1('0x27')](respondWithFilteredResult(_0x28e599,_0x414a23))[_0xf1b1('0x48')](handleError(_0x28e599,null));};exports['show']=function(_0x5a8a51,_0x196934){var _0xc19d68={'raw':!![],'where':{'id':_0x5a8a51['params']['id']}},_0x39e41e={};_0x39e41e[_0xf1b1('0x35')]=_[_0xf1b1('0x34')](db[_0xf1b1('0x2f')][_0xf1b1('0x30')]);_0x39e41e[_0xf1b1('0x33')]=_['keys'](_0x5a8a51['query']);_0x39e41e[_0xf1b1('0x3e')]=_['intersection'](_0x39e41e[_0xf1b1('0x35')],_0x39e41e['query']);_0xc19d68[_0xf1b1('0x38')]=_[_0xf1b1('0x36')](_0x39e41e[_0xf1b1('0x35')],qs[_0xf1b1('0x37')](_0x5a8a51['query'][_0xf1b1('0x37')]));_0xc19d68[_0xf1b1('0x38')]=_0xc19d68[_0xf1b1('0x38')][_0xf1b1('0x39')]?_0xc19d68['attributes']:_0x39e41e['model'];if(_0x5a8a51[_0xf1b1('0x33')][_0xf1b1('0x49')]){_0xc19d68['include']=[{'all':!![]}];}_0xc19d68=_[_0xf1b1('0x41')]({},_0xc19d68,_0x5a8a51[_0xf1b1('0x44')]);return db[_0xf1b1('0x2f')][_0xf1b1('0x4a')](_0xc19d68)['then'](handleEntityNotFound(_0x196934,null))[_0xf1b1('0x27')](respondWithResult(_0x196934,null))['catch'](handleError(_0x196934,null));};exports[_0xf1b1('0x4b')]=function(_0x528d04,_0x22f841){return db[_0xf1b1('0x2f')]['create'](_0x528d04['body'],{})[_0xf1b1('0x27')](function(_0x54c4a7){var _0x2ae59c=_0x528d04['user']['get']({'plain':!![]});if(!_0x2ae59c)throw new Error(_0xf1b1('0x4c'));if(_0x2ae59c[_0xf1b1('0x4d')]===_0xf1b1('0x4e')){var _0x333aa2=_0x54c4a7[_0xf1b1('0x24')]({'plain':!![]});var _0x215154=_0xf1b1('0x25');return db[_0xf1b1('0x4f')][_0xf1b1('0x4a')]({'where':{'name':_0x215154,'userProfileId':_0x2ae59c[_0xf1b1('0x50')]},'raw':!![]})['then'](function(_0xf0eef8){if(_0xf0eef8&&_0xf0eef8[_0xf1b1('0x51')]===0x0){return db[_0xf1b1('0x26')][_0xf1b1('0x4b')]({'name':_0x333aa2[_0xf1b1('0x2b')],'resourceId':_0x333aa2['id'],'type':_0xf0eef8[_0xf1b1('0x2b')],'sectionId':_0xf0eef8['id']},{})[_0xf1b1('0x27')](function(){return _0x54c4a7;});}else{return _0x54c4a7;}})[_0xf1b1('0x48')](function(_0x4569f2){logger[_0xf1b1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4569f2);throw _0x4569f2;});}return _0x54c4a7;})[_0xf1b1('0x27')](respondWithResult(_0x22f841,0xc9))[_0xf1b1('0x48')](handleError(_0x22f841,null));};exports[_0xf1b1('0x23')]=function(_0x9d488,_0x97cdcd){if(_0x9d488[_0xf1b1('0x52')]['id']){delete _0x9d488[_0xf1b1('0x52')]['id'];}return db[_0xf1b1('0x2f')][_0xf1b1('0x4a')]({'where':{'id':_0x9d488[_0xf1b1('0x53')]['id']}})['then'](handleEntityNotFound(_0x97cdcd,null))[_0xf1b1('0x27')](saveUpdates(_0x9d488['body'],null))['then'](respondWithResult(_0x97cdcd,null))['catch'](handleError(_0x97cdcd,null));};exports[_0xf1b1('0x54')]=function(_0x5b5220,_0x5a459f){return db[_0xf1b1('0x2f')][_0xf1b1('0x4a')]({'where':{'id':_0x5b5220[_0xf1b1('0x53')]['id']}})['then'](handleEntityNotFound(_0x5a459f,null))[_0xf1b1('0x27')](removeEntity(_0x5a459f,null))[_0xf1b1('0x48')](handleError(_0x5a459f,null));}; \ No newline at end of file +var _0x2833=['count','set','json','reject','save','then','UserProfileResource','destroy','error','name','send','map','CmHopperAdditionalPhone','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','create','body','user','role','get','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2833,0x1b4));var _0x3283=function(_0x1647a9,_0x19350f){_0x1647a9=_0x1647a9-0x0;var _0x1ea003=_0x2833[_0x1647a9];return _0x1ea003;};'use strict';var emlformat=require(_0x3283('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3283('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3283('0x2'));var moment=require('moment');var BPromise=require(_0x3283('0x3'));var Mustache=require('mustache');var util=require(_0x3283('0x4'));var path=require('path');var sox=require(_0x3283('0x5'));var csv=require(_0x3283('0x6'));var ejs=require(_0x3283('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3283('0x8'));var squel=require('squel');var crypto=require(_0x3283('0x9'));var jsforce=require(_0x3283('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3283('0x6'));var querystring=require('querystring');var Papa=require(_0x3283('0xb'));var Redis=require(_0x3283('0xc'));var authService=require(_0x3283('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3283('0xe'));var hardwareService=require(_0x3283('0xf'));var logger=require(_0x3283('0x10'))(_0x3283('0x11'));var utils=require('../../config/utils');var config=require(_0x3283('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3283('0x13'))['db'];function respondWithStatusCode(_0x4569f7,_0x326445){_0x326445=_0x326445||0xcc;return function(_0x322df3){if(_0x322df3){return _0x4569f7[_0x3283('0x14')](_0x326445);}return _0x4569f7[_0x3283('0x15')](_0x326445)[_0x3283('0x16')]();};}function respondWithResult(_0xdac5ba,_0x579a18){_0x579a18=_0x579a18||0xc8;return function(_0x34ef2b){if(_0x34ef2b){return _0xdac5ba['status'](_0x579a18)['json'](_0x34ef2b);}};}function respondWithFilteredResult(_0x4aa974,_0x2290f8){return function(_0x985c07){if(_0x985c07){var _0x5e501f=typeof _0x2290f8[_0x3283('0x17')]===_0x3283('0x18')&&typeof _0x2290f8[_0x3283('0x19')]===_0x3283('0x18');var _0x32f705=_0x985c07[_0x3283('0x1a')];var _0x1c58e0=_0x5e501f?0x0:_0x2290f8['offset'];var _0x387640=_0x5e501f?_0x985c07['count']:_0x2290f8[_0x3283('0x17')]+_0x2290f8[_0x3283('0x19')];var _0x262b16;if(_0x387640>=_0x32f705){_0x387640=_0x32f705;_0x262b16=0xc8;}else{_0x262b16=0xce;}_0x4aa974[_0x3283('0x15')](_0x262b16);return _0x4aa974[_0x3283('0x1b')]('Content-Range',_0x1c58e0+'-'+_0x387640+'/'+_0x32f705)[_0x3283('0x1c')](_0x985c07);}return null;};}function patchUpdates(_0x43d63a){return function(_0x50b2a4){try{jsonpatch['apply'](_0x50b2a4,_0x43d63a,!![]);}catch(_0x5f3a72){return BPromise[_0x3283('0x1d')](_0x5f3a72);}return _0x50b2a4[_0x3283('0x1e')]();};}function saveUpdates(_0x3ed16e,_0x5996aa){return function(_0xf8aa65){if(_0xf8aa65){return _0xf8aa65['update'](_0x3ed16e)[_0x3283('0x1f')](function(_0x194fba){return _0x194fba;});}return null;};}function removeEntity(_0x1cbfcc,_0x3dc534){return function(_0x16238d){if(_0x16238d){return _0x16238d['destroy']()['then'](function(){var _0xeb61d7=_0x16238d['get']({'plain':!![]});var _0x442aca='CmHopperAdditionalPhones';return db[_0x3283('0x20')][_0x3283('0x21')]({'where':{'type':_0x442aca,'resourceId':_0xeb61d7['id']}})[_0x3283('0x1f')](function(){return _0x16238d;});})[_0x3283('0x1f')](function(){_0x1cbfcc[_0x3283('0x15')](0xcc)[_0x3283('0x16')]();});}};}function handleEntityNotFound(_0x5efaa4,_0x33996c){return function(_0x3a9c37){if(!_0x3a9c37){_0x5efaa4[_0x3283('0x14')](0x194);}return _0x3a9c37;};}function handleError(_0x4aca5c,_0x5401c3){_0x5401c3=_0x5401c3||0x1f4;return function(_0x332ecc){logger[_0x3283('0x22')](_0x332ecc['stack']);if(_0x332ecc['name']){delete _0x332ecc[_0x3283('0x23')];}_0x4aca5c[_0x3283('0x15')](_0x5401c3)[_0x3283('0x24')](_0x332ecc);};}exports['index']=function(_0x25a78c,_0x417bb5){var _0x5c0682={},_0x2d0a54={},_0x64667c={'count':0x0,'rows':[]};var _0x2aed43=_[_0x3283('0x25')](db[_0x3283('0x26')]['rawAttributes'],function(_0x9651b3){return{'name':_0x9651b3[_0x3283('0x27')],'type':_0x9651b3['type'][_0x3283('0x28')]};});_0x2d0a54[_0x3283('0x29')]=_[_0x3283('0x25')](_0x2aed43,_0x3283('0x23'));_0x2d0a54['query']=_[_0x3283('0x2a')](_0x25a78c[_0x3283('0x2b')]);_0x2d0a54[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0x2d0a54[_0x3283('0x29')],_0x2d0a54[_0x3283('0x2b')]);_0x5c0682[_0x3283('0x2e')]=_[_0x3283('0x2d')](_0x2d0a54['model'],qs[_0x3283('0x2f')](_0x25a78c[_0x3283('0x2b')][_0x3283('0x2f')]));_0x5c0682[_0x3283('0x2e')]=_0x5c0682[_0x3283('0x2e')][_0x3283('0x30')]?_0x5c0682['attributes']:_0x2d0a54[_0x3283('0x29')];if(!_0x25a78c['query'][_0x3283('0x31')](_0x3283('0x32'))){_0x5c0682[_0x3283('0x19')]=qs['limit'](_0x25a78c['query'][_0x3283('0x19')]);_0x5c0682['offset']=qs[_0x3283('0x17')](_0x25a78c['query']['offset']);}_0x5c0682['order']=qs[_0x3283('0x33')](_0x25a78c['query']['sort']);_0x5c0682[_0x3283('0x34')]=qs[_0x3283('0x2c')](_[_0x3283('0x35')](_0x25a78c['query'],_0x2d0a54[_0x3283('0x2c')]),_0x2aed43);if(_0x25a78c[_0x3283('0x2b')][_0x3283('0x36')]){_0x5c0682[_0x3283('0x34')]=_['merge'](_0x5c0682[_0x3283('0x34')],{'$or':_[_0x3283('0x25')](_0x2aed43,function(_0x4f3b10){if(_0x4f3b10['type']!=='VIRTUAL'){var _0x4fd855={};_0x4fd855[_0x4f3b10[_0x3283('0x23')]]={'$like':'%'+_0x25a78c[_0x3283('0x2b')]['filter']+'%'};return _0x4fd855;}})});}_0x5c0682=_['merge']({},_0x5c0682,_0x25a78c[_0x3283('0x37')]);var _0x169e5c={'where':_0x5c0682[_0x3283('0x34')]};return db[_0x3283('0x26')]['count'](_0x169e5c)[_0x3283('0x1f')](function(_0x4e9fd2){_0x64667c[_0x3283('0x1a')]=_0x4e9fd2;if(_0x25a78c[_0x3283('0x2b')][_0x3283('0x38')]){_0x5c0682[_0x3283('0x39')]=[{'all':!![]}];}return db[_0x3283('0x26')][_0x3283('0x3a')](_0x5c0682);})['then'](function(_0x440155){_0x64667c[_0x3283('0x3b')]=_0x440155;return _0x64667c;})[_0x3283('0x1f')](respondWithFilteredResult(_0x417bb5,_0x5c0682))[_0x3283('0x3c')](handleError(_0x417bb5,null));};exports[_0x3283('0x3d')]=function(_0xe22fcf,_0x390960){var _0x23b6da={'raw':!![],'where':{'id':_0xe22fcf[_0x3283('0x3e')]['id']}},_0xd683a={};_0xd683a[_0x3283('0x29')]=_['keys'](db['CmHopperAdditionalPhone'][_0x3283('0x3f')]);_0xd683a['query']=_['keys'](_0xe22fcf[_0x3283('0x2b')]);_0xd683a[_0x3283('0x2c')]=_[_0x3283('0x2d')](_0xd683a[_0x3283('0x29')],_0xd683a[_0x3283('0x2b')]);_0x23b6da[_0x3283('0x2e')]=_[_0x3283('0x2d')](_0xd683a[_0x3283('0x29')],qs['fields'](_0xe22fcf[_0x3283('0x2b')]['fields']));_0x23b6da['attributes']=_0x23b6da[_0x3283('0x2e')][_0x3283('0x30')]?_0x23b6da[_0x3283('0x2e')]:_0xd683a[_0x3283('0x29')];if(_0xe22fcf[_0x3283('0x2b')]['includeAll']){_0x23b6da[_0x3283('0x39')]=[{'all':!![]}];}_0x23b6da=_[_0x3283('0x40')]({},_0x23b6da,_0xe22fcf[_0x3283('0x37')]);return db['CmHopperAdditionalPhone']['find'](_0x23b6da)['then'](handleEntityNotFound(_0x390960,null))['then'](respondWithResult(_0x390960,null))[_0x3283('0x3c')](handleError(_0x390960,null));};exports['create']=function(_0x4c3a38,_0x1022d1){return db['CmHopperAdditionalPhone'][_0x3283('0x41')](_0x4c3a38[_0x3283('0x42')],{})[_0x3283('0x1f')](function(_0xe458d){var _0x3c3b2b=_0x4c3a38[_0x3283('0x43')]['get']({'plain':!![]});if(!_0x3c3b2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c3b2b[_0x3283('0x44')]==='user'){var _0x18a3e6=_0xe458d[_0x3283('0x45')]({'plain':!![]});var _0x28e010=_0x3283('0x46');return db[_0x3283('0x47')]['find']({'where':{'name':_0x28e010,'userProfileId':_0x3c3b2b[_0x3283('0x48')]},'raw':!![]})[_0x3283('0x1f')](function(_0x5e7844){if(_0x5e7844&&_0x5e7844[_0x3283('0x49')]===0x0){return db['UserProfileResource'][_0x3283('0x41')]({'name':_0x18a3e6['name'],'resourceId':_0x18a3e6['id'],'type':_0x5e7844['name'],'sectionId':_0x5e7844['id']},{})[_0x3283('0x1f')](function(){return _0xe458d;});}else{return _0xe458d;}})[_0x3283('0x3c')](function(_0x208f90){logger[_0x3283('0x22')](_0x3283('0x4a'),_0x208f90);throw _0x208f90;});}return _0xe458d;})[_0x3283('0x1f')](respondWithResult(_0x1022d1,0xc9))['catch'](handleError(_0x1022d1,null));};exports[_0x3283('0x4b')]=function(_0x1ea4b0,_0x5e127d){if(_0x1ea4b0[_0x3283('0x42')]['id']){delete _0x1ea4b0[_0x3283('0x42')]['id'];}return db[_0x3283('0x26')]['find']({'where':{'id':_0x1ea4b0['params']['id']}})[_0x3283('0x1f')](handleEntityNotFound(_0x5e127d,null))[_0x3283('0x1f')](saveUpdates(_0x1ea4b0[_0x3283('0x42')],null))[_0x3283('0x1f')](respondWithResult(_0x5e127d,null))[_0x3283('0x3c')](handleError(_0x5e127d,null));};exports[_0x3283('0x21')]=function(_0x17b8ba,_0x5311e0){return db[_0x3283('0x26')][_0x3283('0x4c')]({'where':{'id':_0x17b8ba['params']['id']}})[_0x3283('0x1f')](handleEntityNotFound(_0x5311e0,null))[_0x3283('0x1f')](removeEntity(_0x5311e0,null))[_0x3283('0x3c')](handleError(_0x5311e0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a5a618c..08348df 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 _0xf2ca=['define','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2d7a59,_0x5be6f6){var _0x4f23ec=function(_0x5cc9d9){while(--_0x5cc9d9){_0x2d7a59['push'](_0x2d7a59['shift']());}};_0x4f23ec(++_0x5be6f6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0xf2ca[_0x137da3];return _0x1ac46c;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xaf2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf1=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util'];(function(_0x322274,_0x59ba19){var _0xfc0ce9=function(_0x172d5b){while(--_0x172d5b){_0x322274['push'](_0x322274['shift']());}};_0xfc0ce9(++_0x59ba19);}(_0xaaf1,0x173));var _0x1aaf=function(_0x186b51,_0x2a7158){_0x186b51=_0x186b51-0x0;var _0xfabac8=_0xaaf1[_0x186b51];return _0xfabac8;};'use strict';var _=require('lodash');var util=require(_0x1aaf('0x0'));var logger=require(_0x1aaf('0x1'))(_0x1aaf('0x2'));var moment=require(_0x1aaf('0x3'));var BPromise=require(_0x1aaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aaf('0x5'));var rimraf=require(_0x1aaf('0x6'));var config=require(_0x1aaf('0x7'));var attributes=require(_0x1aaf('0x8'));module['exports']=function(_0x4f6273,_0x557cbe){return _0x4f6273[_0x1aaf('0x9')](_0x1aaf('0xa'),attributes,{'tableName':_0x1aaf('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 9a24dfc..b29a983 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 _0x4bc3=['duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','sequelize','transaction','phone','activateAdditionalPhone','update','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countnoanswerretry','countmachineretry','SwapAdditionalPhones'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x4bc3,0xfe));var _0x34bc=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4bc3[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x34bc('0x0'));var util=require('util');var moment=require(_0x34bc('0x1'));var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34bc('0x5'))(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var jayson=require(_0x34bc('0x8'));var client=jayson[_0x34bc('0x9')][_0x34bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2894b4,_0x3492ed,_0x40e495){return new BPromise(function(_0x1818c4,_0x3e2b52){return client[_0x34bc('0xb')](_0x2894b4,_0x40e495)[_0x34bc('0xc')](function(_0x334b64){logger['info'](_0x34bc('0xd'),_0x3492ed,_0x34bc('0xe'));logger[_0x34bc('0xf')](_0x34bc('0x10'),_0x3492ed,'request\x20sent',JSON[_0x34bc('0x11')](_0x334b64));if(_0x334b64[_0x34bc('0x12')]){if(_0x334b64[_0x34bc('0x12')][_0x34bc('0x13')]===0x1f4){logger[_0x34bc('0x12')](_0x34bc('0xd'),_0x3492ed,_0x334b64[_0x34bc('0x12')][_0x34bc('0x14')]);return _0x3e2b52(_0x334b64[_0x34bc('0x12')]['message']);}logger[_0x34bc('0x12')](_0x34bc('0xd'),_0x3492ed,_0x334b64[_0x34bc('0x12')][_0x34bc('0x14')]);return _0x1818c4(_0x334b64['error'][_0x34bc('0x14')]);}else{logger[_0x34bc('0x15')](_0x34bc('0xd'),_0x3492ed,'request\x20sent');_0x1818c4(_0x334b64[_0x34bc('0x16')][_0x34bc('0x14')]);}})[_0x34bc('0x17')](function(_0x1f933a){logger[_0x34bc('0x12')](_0x34bc('0xd'),_0x3492ed,_0x1f933a);_0x3e2b52(_0x1f933a);});});}exports[_0x34bc('0x18')]=function(_0x4474ee){var _0x13ae48=this;return new Promise(function(_0x4c58ad,_0x50a933){return db[_0x34bc('0x19')][_0x34bc('0x1a')]({'raw':!![],'where':{'ContactId':_0x4474ee['body'][_0x34bc('0x1b')],'ListId':_0x4474ee[_0x34bc('0x1c')][_0x34bc('0x1d')],'VoiceQueueId':_0x4474ee[_0x34bc('0x1c')][_0x34bc('0x1e')]===undefined?null:_0x4474ee['body']['VoiceQueueId'],'CampaignId':_0x4474ee[_0x34bc('0x1c')][_0x34bc('0x1f')]===undefined?null:_0x4474ee['body'][_0x34bc('0x1f')]}})[_0x34bc('0xc')](function(_0x2ffd43){if(_0x2ffd43!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2ffd43['id'],'OrderBy':{'$gt':_0x2ffd43[_0x34bc('0x20')]}},'order':[[_0x34bc('0x20'),'ASC']]})[_0x34bc('0xc')](function(_0x5265d2){var _0xb01dea=0x0;if(_0x5265d2){if(_0x5265d2[_0x34bc('0x21')]+_0x5265d2[_0x34bc('0x22')]+_0x5265d2['countnoanswerretry']+_0x5265d2[_0x34bc('0x23')]+_0x5265d2[_0x34bc('0x24')]+_0x5265d2[_0x34bc('0x25')]+_0x5265d2['countmachineretry']+_0x5265d2[_0x34bc('0x26')]<_0x4474ee[_0x34bc('0x27')][_0x34bc('0x28')])_0xb01dea=0x1;_0x4c58ad({'additional':_0xb01dea});}else{return db[_0x34bc('0x29')][_0x34bc('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2ffd43['id']},'order':[[_0x34bc('0x20'),_0x34bc('0x2a')]]})[_0x34bc('0xc')](function(_0x9ac404){var _0x1aba66=0x0;if(_0x9ac404){if(_0x9ac404[_0x34bc('0x21')]+_0x9ac404[_0x34bc('0x22')]+_0x9ac404[_0x34bc('0x2b')]+_0x9ac404[_0x34bc('0x23')]+_0x9ac404[_0x34bc('0x24')]+_0x9ac404[_0x34bc('0x25')]+_0x9ac404[_0x34bc('0x2c')]+_0x9ac404[_0x34bc('0x26')]<_0x4474ee[_0x34bc('0x27')]['dialGlobalMaxRetry'])_0x1aba66=0x1;_0x4c58ad({'additional':_0x1aba66});}else{_0x4c58ad({'additional':0x0});}})['catch'](function(_0x15e2a2){logger[_0x34bc('0x12')]('VerifyAdditionalPhones',_0x15e2a2[_0x34bc('0x14')]);_0x50a933(_0x13ae48[_0x34bc('0x12')](0x1f4,_0x15e2a2[_0x34bc('0x14')]));});}})['catch'](function(_0x59821f){logger[_0x34bc('0x12')](_0x34bc('0x18'),_0x59821f[_0x34bc('0x14')]);_0x50a933(_0x13ae48['error'](0x1f4,_0x59821f[_0x34bc('0x14')]));});}else _0x4c58ad({'additional':0x0});});});};exports[_0x34bc('0x2d')]=function(_0x5c86c0){var _0x8656e8=this;return new Promise(function(_0x203cf9,_0xc9475a){return db[_0x34bc('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x5c86c0['body']['ContactId'],'ListId':_0x5c86c0['body'][_0x34bc('0x1d')],'VoiceQueueId':_0x5c86c0[_0x34bc('0x1c')][_0x34bc('0x1e')]===undefined?null:_0x5c86c0[_0x34bc('0x1c')]['VoiceQueueId'],'CampaignId':_0x5c86c0[_0x34bc('0x1c')][_0x34bc('0x1f')]===undefined?null:_0x5c86c0[_0x34bc('0x1c')][_0x34bc('0x1f')]}})[_0x34bc('0xc')](function(_0x34b15d){if(_0x34b15d!=null){return db[_0x34bc('0x29')][_0x34bc('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x34b15d['id'],'OrderBy':{'$gte':_0x34b15d[_0x34bc('0x20')]}},'order':[[_0x34bc('0x20'),_0x34bc('0x2a')]]})[_0x34bc('0xc')](function(_0x2d15ab){if(_0x2d15ab)return activateAdditionalPhone(_0x34b15d,_0x5c86c0['body'],_0x2d15ab,_0x5c86c0[_0x34bc('0x2e')],_0x5c86c0[_0x34bc('0x2f')])[_0x34bc('0xc')](function(_0x41bb40){_0x203cf9(_0x41bb40);});else{return db[_0x34bc('0x29')][_0x34bc('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x34b15d['id']},'order':[[_0x34bc('0x20'),_0x34bc('0x2a')]]})[_0x34bc('0xc')](function(_0x490cce){if(_0x490cce)return activateAdditionalPhone(_0x34b15d,_0x5c86c0[_0x34bc('0x1c')],_0x490cce,_0x5c86c0['duration'],_0x5c86c0[_0x34bc('0x2f')])['then'](function(_0x539ada){_0x203cf9(_0x539ada);});else{_0x203cf9({'id':_0x34b15d['id'],'phone':''});}})[_0x34bc('0x17')](function(_0x6535f9){logger[_0x34bc('0x12')](_0x34bc('0x18'),_0x6535f9[_0x34bc('0x14')]);_0xc9475a(_0x8656e8[_0x34bc('0x12')](0x1f4,_0x6535f9[_0x34bc('0x14')]));});}})[_0x34bc('0x17')](function(_0x536a00){logger[_0x34bc('0x12')](_0x34bc('0x18'),_0x536a00[_0x34bc('0x14')]);_0xc9475a(_0x8656e8[_0x34bc('0x12')](0x1f4,_0x536a00[_0x34bc('0x14')]));});}else _0x203cf9(0x1);});});};function activateAdditionalPhone(_0x15b3f4,_0x6e71c6,_0xda53ed,_0x5110c7,_0x2848f1){return new Promise(function(_0x521714,_0x4b6d42){var _0x3cef12;if(_[_0x34bc('0x30')](_0xda53ed[_0x34bc('0x31')])){_0xda53ed[_0x34bc('0x31')]=moment();}if(moment()>moment(_0xda53ed[_0x34bc('0x31')])){_0x3cef12=moment()['add'](_0x2848f1||0x3,'minutes');}else{if(_0xda53ed[_0x34bc('0x20')]==0x0){_0x3cef12=moment(_0xda53ed[_0x34bc('0x31')]);}else{_0x3cef12=moment()[_0x34bc('0x32')](_0x2848f1||0x3,'minutes');}}if(_[_0x34bc('0x30')](_0x3cef12)){_0x3cef12=moment()['add'](_0x2848f1||0x3,_0x34bc('0x33'));}var _0x8a2e1c={'phone':_0x15b3f4['phone'],'active':0x0,'OrderBy':_[_0x34bc('0x30')](_0x15b3f4[_0x34bc('0x20')])?0x0:_0x15b3f4[_0x34bc('0x20')],'scheduledat':moment()[_0x34bc('0x32')](_0x5110c7||0x1,'minutes'),'countbusyretry':_0x6e71c6['countbusyretry'],'countcongestionretry':_0x6e71c6['countcongestionretry'],'countnoanswerretry':_0x6e71c6[_0x34bc('0x2b')],'countnosuchnumberretry':_0x6e71c6[_0x34bc('0x23')],'countdropretry':_0x6e71c6['countdropretry'],'countabandonedretry':_0x6e71c6['countabandonedretry'],'countmachineretry':_0x6e71c6[_0x34bc('0x2c')],'countagentrejectretry':_0x6e71c6[_0x34bc('0x26')],'createdAt':_0x6e71c6[_0x34bc('0x34')],'updatedAt':_0x6e71c6['updatedAt']};var _0x3bfc1f={'CmHopperId':_0x15b3f4['id'],'phone':_0xda53ed['phone'],'active':0x0,'OrderBy':_[_0x34bc('0x30')](_0xda53ed[_0x34bc('0x20')])?0x0:_0xda53ed['OrderBy'],'scheduledat':_0x3cef12,'countbusyretry':_0xda53ed[_0x34bc('0x21')],'countcongestionretry':_0xda53ed['countcongestionretry'],'countnoanswerretry':_0xda53ed[_0x34bc('0x2b')],'countnosuchnumberretry':_0xda53ed[_0x34bc('0x23')],'countdropretry':_0xda53ed[_0x34bc('0x24')],'countabandonedretry':_0xda53ed[_0x34bc('0x25')],'countmachineretry':_0xda53ed[_0x34bc('0x2c')],'countagentrejectretry':_0xda53ed[_0x34bc('0x26')],'createdAt':_0xda53ed['createdAt'],'updatedAt':_0xda53ed[_0x34bc('0x35')]};return db[_0x34bc('0x36')][_0x34bc('0x37')](function(_0x1c1740){return db['CmHopperAdditionalPhone']['update'](_0x8a2e1c,{'where':{'id':_0xda53ed['id']}},{'transaction':_0x1c1740})[_0x34bc('0xc')](function(){return db[_0x34bc('0x19')]['update'](_0x3bfc1f,{'where':{'id':_0x15b3f4['id']}},{'transaction':_0x1c1740});});})['then'](function(_0x13577b){_0x521714({'id':_0x15b3f4['id'],'phone':_0xda53ed[_0x34bc('0x38')]});})['catch'](function(_0x5c08be){logger['error'](_0x34bc('0x39'),_0x5c08be[_0x34bc('0x14')]);_0x4b6d42({'error':_0x5c08be['message']});});});}exports['IncrementPreviewCounters']=function(_0x39b2df){var _0x2e41f5=this;return new Promise(function(_0x1828ff,_0x1d8e5e){return db[_0x34bc('0x19')][_0x34bc('0x3a')](_0x39b2df[_0x34bc('0x1c')]['field'],{'where':{'id':_0x39b2df['body']['id']}})[_0x34bc('0xc')](function(_0x2ca3ac){_0x1828ff(_0x2ca3ac);})[_0x34bc('0x17')](function(_0x233b0a){logger['error'](_0x34bc('0x3b'),_0x233b0a[_0x34bc('0x14')]);_0x1d8e5e(_0x2e41f5[_0x34bc('0x12')](0x1f4,_0x233b0a[_0x34bc('0x14')]));});});}; \ No newline at end of file +var _0xbdbc=['countabandonedretry','countmachineretry','entity','ASC','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','then','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countdropretry'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0xbdbc,0x1b5));var _0xcbdb=function(_0x23e3eb,_0x419ae8){_0x23e3eb=_0x23e3eb-0x0;var _0x1c9ab6=_0xbdbc[_0x23e3eb];return _0x1c9ab6;};'use strict';var _=require(_0xcbdb('0x0'));var util=require(_0xcbdb('0x1'));var moment=require('moment');var BPromise=require(_0xcbdb('0x2'));var rs=require(_0xcbdb('0x3'));var fs=require('fs');var Redis=require(_0xcbdb('0x4'));var db=require(_0xcbdb('0x5'))['db'];var utils=require(_0xcbdb('0x6'));var logger=require(_0xcbdb('0x7'))(_0xcbdb('0x8'));var config=require('../../config/environment');var jayson=require(_0xcbdb('0x9'));var client=jayson[_0xcbdb('0xa')][_0xcbdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536dc6,_0x3d6a5e,_0x52c447){return new BPromise(function(_0x518518,_0x24354b){return client[_0xcbdb('0xc')](_0x536dc6,_0x52c447)['then'](function(_0xdeef72){logger['info'](_0xcbdb('0xd'),_0x3d6a5e,_0xcbdb('0xe'));logger[_0xcbdb('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3d6a5e,_0xcbdb('0xe'),JSON[_0xcbdb('0x10')](_0xdeef72));if(_0xdeef72[_0xcbdb('0x11')]){if(_0xdeef72[_0xcbdb('0x11')][_0xcbdb('0x12')]===0x1f4){logger[_0xcbdb('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3d6a5e,_0xdeef72['error']['message']);return _0x24354b(_0xdeef72['error']['message']);}logger[_0xcbdb('0x11')](_0xcbdb('0xd'),_0x3d6a5e,_0xdeef72[_0xcbdb('0x11')]['message']);return _0x518518(_0xdeef72[_0xcbdb('0x11')][_0xcbdb('0x13')]);}else{logger[_0xcbdb('0x14')](_0xcbdb('0xd'),_0x3d6a5e,'request\x20sent');_0x518518(_0xdeef72[_0xcbdb('0x15')][_0xcbdb('0x13')]);}})[_0xcbdb('0x16')](function(_0x2e909e){logger[_0xcbdb('0x11')](_0xcbdb('0xd'),_0x3d6a5e,_0x2e909e);_0x24354b(_0x2e909e);});});}exports[_0xcbdb('0x17')]=function(_0x4456a0){var _0x1685db=this;return new Promise(function(_0x8789e9,_0x29bca0){return db['CmHopper'][_0xcbdb('0x18')]({'raw':!![],'where':{'ContactId':_0x4456a0['body'][_0xcbdb('0x19')],'ListId':_0x4456a0[_0xcbdb('0x1a')][_0xcbdb('0x1b')],'VoiceQueueId':_0x4456a0[_0xcbdb('0x1a')][_0xcbdb('0x1c')]===undefined?null:_0x4456a0[_0xcbdb('0x1a')][_0xcbdb('0x1c')],'CampaignId':_0x4456a0[_0xcbdb('0x1a')]['CampaignId']===undefined?null:_0x4456a0[_0xcbdb('0x1a')][_0xcbdb('0x1d')]}})['then'](function(_0x20208e){if(_0x20208e!=null){return db[_0xcbdb('0x1e')][_0xcbdb('0x18')]({'raw':!![],'where':{'CmHopperId':_0x20208e['id'],'OrderBy':{'$gt':_0x20208e['OrderBy']}},'order':[[_0xcbdb('0x1f'),'ASC']]})['then'](function(_0xfc75c7){var _0x4495dd=0x0;if(_0xfc75c7){if(_0xfc75c7[_0xcbdb('0x20')]+_0xfc75c7[_0xcbdb('0x21')]+_0xfc75c7['countnoanswerretry']+_0xfc75c7['countnosuchnumberretry']+_0xfc75c7[_0xcbdb('0x22')]+_0xfc75c7[_0xcbdb('0x23')]+_0xfc75c7[_0xcbdb('0x24')]+_0xfc75c7['countagentrejectretry']<_0x4456a0[_0xcbdb('0x25')]['dialGlobalMaxRetry'])_0x4495dd=0x1;_0x8789e9({'additional':_0x4495dd});}else{return db[_0xcbdb('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x20208e['id']},'order':[[_0xcbdb('0x1f'),_0xcbdb('0x26')]]})['then'](function(_0x589d70){var _0x1d4d3d=0x0;if(_0x589d70){if(_0x589d70[_0xcbdb('0x20')]+_0x589d70['countcongestionretry']+_0x589d70[_0xcbdb('0x27')]+_0x589d70[_0xcbdb('0x28')]+_0x589d70[_0xcbdb('0x22')]+_0x589d70[_0xcbdb('0x23')]+_0x589d70['countmachineretry']+_0x589d70[_0xcbdb('0x29')]<_0x4456a0[_0xcbdb('0x25')][_0xcbdb('0x2a')])_0x1d4d3d=0x1;_0x8789e9({'additional':_0x1d4d3d});}else{_0x8789e9({'additional':0x0});}})['catch'](function(_0x3218f2){logger['error'](_0xcbdb('0x17'),_0x3218f2[_0xcbdb('0x13')]);_0x29bca0(_0x1685db[_0xcbdb('0x11')](0x1f4,_0x3218f2[_0xcbdb('0x13')]));});}})[_0xcbdb('0x16')](function(_0xbd0eb4){logger[_0xcbdb('0x11')](_0xcbdb('0x17'),_0xbd0eb4[_0xcbdb('0x13')]);_0x29bca0(_0x1685db[_0xcbdb('0x11')](0x1f4,_0xbd0eb4[_0xcbdb('0x13')]));});}else _0x8789e9({'additional':0x0});});});};exports[_0xcbdb('0x2b')]=function(_0x4bb16e){var _0xc01018=this;return new Promise(function(_0x24b6b6,_0x45571f){return db[_0xcbdb('0x2c')][_0xcbdb('0x18')]({'raw':!![],'where':{'ContactId':_0x4bb16e[_0xcbdb('0x1a')]['ContactId'],'ListId':_0x4bb16e['body'][_0xcbdb('0x1b')],'VoiceQueueId':_0x4bb16e[_0xcbdb('0x1a')][_0xcbdb('0x1c')]===undefined?null:_0x4bb16e[_0xcbdb('0x1a')]['VoiceQueueId'],'CampaignId':_0x4bb16e['body']['CampaignId']===undefined?null:_0x4bb16e[_0xcbdb('0x1a')][_0xcbdb('0x1d')]}})[_0xcbdb('0x2d')](function(_0x750a73){if(_0x750a73!=null){return db[_0xcbdb('0x1e')][_0xcbdb('0x18')]({'raw':!![],'where':{'CmHopperId':_0x750a73['id'],'OrderBy':{'$gte':_0x750a73['OrderBy']}},'order':[[_0xcbdb('0x1f'),'ASC']]})[_0xcbdb('0x2d')](function(_0x292ebe){if(_0x292ebe)return activateAdditionalPhone(_0x750a73,_0x4bb16e[_0xcbdb('0x1a')],_0x292ebe,_0x4bb16e['duration'],_0x4bb16e['waitTime'])[_0xcbdb('0x2d')](function(_0x83cd59){_0x24b6b6(_0x83cd59);});else{return db[_0xcbdb('0x1e')][_0xcbdb('0x18')]({'raw':!![],'where':{'CmHopperId':_0x750a73['id']},'order':[['OrderBy',_0xcbdb('0x26')]]})[_0xcbdb('0x2d')](function(_0x2cbb9c){if(_0x2cbb9c)return activateAdditionalPhone(_0x750a73,_0x4bb16e[_0xcbdb('0x1a')],_0x2cbb9c,_0x4bb16e[_0xcbdb('0x2e')],_0x4bb16e[_0xcbdb('0x2f')])['then'](function(_0x29cfe1){_0x24b6b6(_0x29cfe1);});else{_0x24b6b6({'id':_0x750a73['id'],'phone':''});}})[_0xcbdb('0x16')](function(_0x46727a){logger['error'](_0xcbdb('0x17'),_0x46727a[_0xcbdb('0x13')]);_0x45571f(_0xc01018[_0xcbdb('0x11')](0x1f4,_0x46727a[_0xcbdb('0x13')]));});}})[_0xcbdb('0x16')](function(_0x48d3c2){logger['error'](_0xcbdb('0x17'),_0x48d3c2[_0xcbdb('0x13')]);_0x45571f(_0xc01018[_0xcbdb('0x11')](0x1f4,_0x48d3c2[_0xcbdb('0x13')]));});}else _0x24b6b6(0x1);});});};function activateAdditionalPhone(_0x31991c,_0x10ef44,_0x4f0345,_0x357323,_0x17c989){return new Promise(function(_0x31624d,_0x2d607b){var _0x4596f1;if(_[_0xcbdb('0x30')](_0x4f0345[_0xcbdb('0x31')])){_0x4f0345[_0xcbdb('0x31')]=moment();}if(moment()>moment(_0x4f0345[_0xcbdb('0x31')])){_0x4596f1=moment()[_0xcbdb('0x32')](_0x17c989||0x3,_0xcbdb('0x33'));}else{if(_0x4f0345[_0xcbdb('0x1f')]==0x0){_0x4596f1=moment(_0x4f0345[_0xcbdb('0x31')]);}else{_0x4596f1=moment()[_0xcbdb('0x32')](_0x17c989||0x3,'minutes');}}if(_[_0xcbdb('0x30')](_0x4596f1)){_0x4596f1=moment()['add'](_0x17c989||0x3,'minutes');}var _0x363873={'phone':_0x31991c['phone'],'active':0x0,'OrderBy':_['isNil'](_0x31991c[_0xcbdb('0x1f')])?0x0:_0x31991c[_0xcbdb('0x1f')],'scheduledat':moment()[_0xcbdb('0x32')](_0x357323||0x1,_0xcbdb('0x33')),'countbusyretry':_0x10ef44[_0xcbdb('0x20')],'countcongestionretry':_0x10ef44['countcongestionretry'],'countnoanswerretry':_0x10ef44[_0xcbdb('0x27')],'countnosuchnumberretry':_0x10ef44[_0xcbdb('0x28')],'countdropretry':_0x10ef44[_0xcbdb('0x22')],'countabandonedretry':_0x10ef44[_0xcbdb('0x23')],'countmachineretry':_0x10ef44[_0xcbdb('0x24')],'countagentrejectretry':_0x10ef44[_0xcbdb('0x29')],'createdAt':_0x10ef44[_0xcbdb('0x34')],'updatedAt':_0x10ef44[_0xcbdb('0x35')]};var _0x1de1ad={'CmHopperId':_0x31991c['id'],'phone':_0x4f0345[_0xcbdb('0x36')],'active':0x0,'OrderBy':_[_0xcbdb('0x30')](_0x4f0345[_0xcbdb('0x1f')])?0x0:_0x4f0345[_0xcbdb('0x1f')],'scheduledat':_0x4596f1,'countbusyretry':_0x4f0345[_0xcbdb('0x20')],'countcongestionretry':_0x4f0345[_0xcbdb('0x21')],'countnoanswerretry':_0x4f0345['countnoanswerretry'],'countnosuchnumberretry':_0x4f0345[_0xcbdb('0x28')],'countdropretry':_0x4f0345[_0xcbdb('0x22')],'countabandonedretry':_0x4f0345[_0xcbdb('0x23')],'countmachineretry':_0x4f0345[_0xcbdb('0x24')],'countagentrejectretry':_0x4f0345['countagentrejectretry'],'createdAt':_0x4f0345[_0xcbdb('0x34')],'updatedAt':_0x4f0345['updatedAt']};return db[_0xcbdb('0x37')]['transaction'](function(_0x2fc300){return db[_0xcbdb('0x1e')][_0xcbdb('0x38')](_0x363873,{'where':{'id':_0x4f0345['id']}},{'transaction':_0x2fc300})['then'](function(){return db['CmHopper'][_0xcbdb('0x38')](_0x1de1ad,{'where':{'id':_0x31991c['id']}},{'transaction':_0x2fc300});});})[_0xcbdb('0x2d')](function(_0x3e69d1){_0x31624d({'id':_0x31991c['id'],'phone':_0x4f0345[_0xcbdb('0x36')]});})[_0xcbdb('0x16')](function(_0x3409b1){logger[_0xcbdb('0x11')](_0xcbdb('0x39'),_0x3409b1['message']);_0x2d607b({'error':_0x3409b1['message']});});});}exports[_0xcbdb('0x3a')]=function(_0x3911eb){var _0x1d49d5=this;return new Promise(function(_0x1baef6,_0x53df71){return db[_0xcbdb('0x2c')][_0xcbdb('0x38')](_0x3911eb[_0xcbdb('0x1a')]['field'],{'where':{'id':_0x3911eb[_0xcbdb('0x1a')]['id']}})[_0xcbdb('0x2d')](function(_0x4e38b4){_0x1baef6(_0x4e38b4);})[_0xcbdb('0x16')](function(_0x347a57){logger['error'](_0xcbdb('0x3a'),_0x347a57[_0xcbdb('0x13')]);_0x53df71(_0x1d49d5[_0xcbdb('0x11')](0x1f4,_0x347a57[_0xcbdb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b9d3177..2000417 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 _0xc437=['connect-timeout','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0xc437,0xca));var _0x7c43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc437[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7c43('0x0'));var util=require('util');var path=require(_0x7c43('0x1'));var timeout=require(_0x7c43('0x2'));var express=require(_0x7c43('0x3'));var router=express[_0x7c43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7c43('0x5'));var config=require('../../config/environment');var controller=require(_0x7c43('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7c43('0x7')](_0x7c43('0x8'),auth[_0x7c43('0x9')](),controller[_0x7c43('0xa')]);router[_0x7c43('0xb')]('/',auth['isAuthenticated'](),controller[_0x7c43('0xc')]);router[_0x7c43('0xd')](_0x7c43('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7c43('0xe')](_0x7c43('0x8'),auth[_0x7c43('0x9')](),controller[_0x7c43('0xf')]);module[_0x7c43('0x10')]=router; \ No newline at end of file +var _0x770f=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show'];(function(_0xb36cc0,_0x161136){var _0x3fd015=function(_0x1c04f6){while(--_0x1c04f6){_0xb36cc0['push'](_0xb36cc0['shift']());}};_0x3fd015(++_0x161136);}(_0x770f,0x1e7));var _0xf770=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x770f[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require('multer');var util=require(_0xf770('0x0'));var path=require(_0xf770('0x1'));var timeout=require(_0xf770('0x2'));var express=require('express');var router=express[_0xf770('0x3')]();var fs_extra=require(_0xf770('0x4'));var auth=require(_0xf770('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf770('0x6'));var controller=require(_0xf770('0x7'));router[_0xf770('0x8')]('/',auth[_0xf770('0x9')](),controller[_0xf770('0xa')]);router['get'](_0xf770('0xb'),auth[_0xf770('0x9')](),controller[_0xf770('0xc')]);router[_0xf770('0xd')]('/',auth['isAuthenticated'](),controller[_0xf770('0xe')]);router[_0xf770('0xf')](_0xf770('0xb'),auth[_0xf770('0x9')](),controller[_0xf770('0x10')]);router[_0xf770('0x11')](_0xf770('0xb'),auth[_0xf770('0x9')](),controller[_0xf770('0x12')]);module[_0xf770('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 39df5cc..0c7b24c 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 _0x2c70=['exports','contactListQueue','INTEGER','moment'];(function(_0x91dc0c,_0x5669e1){var _0xbfd1dc=function(_0x272ca1){while(--_0x272ca1){_0x91dc0c['push'](_0x91dc0c['shift']());}};_0xbfd1dc(++_0x5669e1);}(_0x2c70,0x19f));var _0x02c7=function(_0x56acc4,_0x1accb4){_0x56acc4=_0x56acc4-0x0;var _0x4fc1eb=_0x2c70[_0x56acc4];return _0x4fc1eb;};'use strict';var moment=require(_0x02c7('0x0'));var Sequelize=require('sequelize');module[_0x02c7('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x02c7('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x02c7('0x3')],'unique':_0x02c7('0x2')}}; \ No newline at end of file +var _0x984b=['STRING','contactListQueue','moment','sequelize','exports'];(function(_0x57add0,_0x2067dd){var _0x51e356=function(_0x3ab11a){while(--_0x3ab11a){_0x57add0['push'](_0x57add0['shift']());}};_0x51e356(++_0x2067dd);}(_0x984b,0x15b));var _0xb984=function(_0x548f41,_0x388330){_0x548f41=_0x548f41-0x0;var _0x43bac9=_0x984b[_0x548f41];return _0x43bac9;};'use strict';var moment=require(_0xb984('0x0'));var Sequelize=require(_0xb984('0x1'));module[_0xb984('0x2')]={'phone':{'type':Sequelize[_0xb984('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb984('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c9e3159..726aa51 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 _0x4028=['limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','params','length','find','catch','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4028,0x15a));var _0x8402=function(_0x5d6ef1,_0x19007f){_0x5d6ef1=_0x5d6ef1-0x0;var _0x394297=_0x4028[_0x5d6ef1];return _0x394297;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8402('0x0'));var zipdir=require(_0x8402('0x1'));var jsonpatch=require(_0x8402('0x2'));var rp=require(_0x8402('0x3'));var moment=require('moment');var BPromise=require(_0x8402('0x4'));var Mustache=require(_0x8402('0x5'));var util=require(_0x8402('0x6'));var path=require(_0x8402('0x7'));var sox=require(_0x8402('0x8'));var csv=require(_0x8402('0x9'));var ejs=require(_0x8402('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8402('0xb'));var crypto=require(_0x8402('0xc'));var jsforce=require(_0x8402('0xd'));var deskjs=require(_0x8402('0xe'));var toCsv=require(_0x8402('0x9'));var querystring=require(_0x8402('0xf'));var Papa=require(_0x8402('0x10'));var Redis=require(_0x8402('0x11'));var authService=require(_0x8402('0x12'));var qs=require(_0x8402('0x13'));var as=require(_0x8402('0x14'));var hardwareService=require(_0x8402('0x15'));var logger=require('../../config/logger')(_0x8402('0x16'));var utils=require(_0x8402('0x17'));var config=require(_0x8402('0x18'));var licenseUtil=require(_0x8402('0x19'));var db=require(_0x8402('0x1a'))['db'];function respondWithStatusCode(_0x53234e,_0x38d381){_0x38d381=_0x38d381||0xcc;return function(_0x2509de){if(_0x2509de){return _0x53234e[_0x8402('0x1b')](_0x38d381);}return _0x53234e[_0x8402('0x1c')](_0x38d381)[_0x8402('0x1d')]();};}function respondWithResult(_0x1f84ba,_0x10163f){_0x10163f=_0x10163f||0xc8;return function(_0xb10a65){if(_0xb10a65){return _0x1f84ba['status'](_0x10163f)[_0x8402('0x1e')](_0xb10a65);}};}function respondWithFilteredResult(_0x193ad4,_0x42b0b8){return function(_0x5c5bdc){if(_0x5c5bdc){var _0x4d85b=typeof _0x42b0b8[_0x8402('0x1f')]===_0x8402('0x20')&&typeof _0x42b0b8['limit']===_0x8402('0x20');var _0x1acf0e=_0x5c5bdc[_0x8402('0x21')];var _0x1d1674=_0x4d85b?0x0:_0x42b0b8[_0x8402('0x1f')];var _0x58576d=_0x4d85b?_0x5c5bdc[_0x8402('0x21')]:_0x42b0b8['offset']+_0x42b0b8[_0x8402('0x22')];var _0x3afa8c;if(_0x58576d>=_0x1acf0e){_0x58576d=_0x1acf0e;_0x3afa8c=0xc8;}else{_0x3afa8c=0xce;}_0x193ad4[_0x8402('0x1c')](_0x3afa8c);return _0x193ad4[_0x8402('0x23')](_0x8402('0x24'),_0x1d1674+'-'+_0x58576d+'/'+_0x1acf0e)[_0x8402('0x1e')](_0x5c5bdc);}return null;};}function patchUpdates(_0x2d0d08){return function(_0x57cef7){try{jsonpatch[_0x8402('0x25')](_0x57cef7,_0x2d0d08,!![]);}catch(_0x8f68ae){return BPromise['reject'](_0x8f68ae);}return _0x57cef7[_0x8402('0x26')]();};}function saveUpdates(_0xb3b789,_0x4e7961){return function(_0x3bd2de){if(_0x3bd2de){return _0x3bd2de[_0x8402('0x27')](_0xb3b789)[_0x8402('0x28')](function(_0x4ac43a){return _0x4ac43a;});}return null;};}function removeEntity(_0x41dceb,_0xe76fb4){return function(_0x465815){if(_0x465815){return _0x465815['destroy']()[_0x8402('0x28')](function(){_0x41dceb['status'](0xcc)[_0x8402('0x1d')]();});}};}function handleEntityNotFound(_0x1f6c74,_0x1cf060){return function(_0x4e654c){if(!_0x4e654c){_0x1f6c74['sendStatus'](0x194);}return _0x4e654c;};}function handleError(_0x14bfcd,_0x346d01){_0x346d01=_0x346d01||0x1f4;return function(_0x28d4fa){logger[_0x8402('0x29')](_0x28d4fa[_0x8402('0x2a')]);if(_0x28d4fa[_0x8402('0x2b')]){delete _0x28d4fa[_0x8402('0x2b')];}_0x14bfcd[_0x8402('0x1c')](_0x346d01)[_0x8402('0x2c')](_0x28d4fa);};}exports[_0x8402('0x2d')]=function(_0x3a9851,_0x4235eb){var _0x2fd02d={},_0x103f01={},_0x5c911a={'count':0x0,'rows':[]};var _0x1da0c9=_[_0x8402('0x2e')](db[_0x8402('0x2f')][_0x8402('0x30')],function(_0x17870e){return{'name':_0x17870e[_0x8402('0x31')],'type':_0x17870e[_0x8402('0x32')][_0x8402('0x33')]};});_0x103f01[_0x8402('0x34')]=_['map'](_0x1da0c9,_0x8402('0x2b'));_0x103f01['query']=_[_0x8402('0x35')](_0x3a9851['query']);_0x103f01[_0x8402('0x36')]=_[_0x8402('0x37')](_0x103f01[_0x8402('0x34')],_0x103f01[_0x8402('0x38')]);_0x2fd02d['attributes']=_[_0x8402('0x37')](_0x103f01['model'],qs['fields'](_0x3a9851['query'][_0x8402('0x39')]));_0x2fd02d[_0x8402('0x3a')]=_0x2fd02d['attributes']['length']?_0x2fd02d[_0x8402('0x3a')]:_0x103f01[_0x8402('0x34')];if(!_0x3a9851['query'][_0x8402('0x3b')](_0x8402('0x3c'))){_0x2fd02d['limit']=qs[_0x8402('0x22')](_0x3a9851['query'][_0x8402('0x22')]);_0x2fd02d[_0x8402('0x1f')]=qs[_0x8402('0x1f')](_0x3a9851[_0x8402('0x38')][_0x8402('0x1f')]);}_0x2fd02d['order']=qs['sort'](_0x3a9851[_0x8402('0x38')][_0x8402('0x3d')]);_0x2fd02d['where']=qs['filters'](_[_0x8402('0x3e')](_0x3a9851[_0x8402('0x38')],_0x103f01[_0x8402('0x36')]),_0x1da0c9);if(_0x3a9851[_0x8402('0x38')][_0x8402('0x3f')]){_0x2fd02d[_0x8402('0x40')]=_['merge'](_0x2fd02d[_0x8402('0x40')],{'$or':_[_0x8402('0x2e')](_0x1da0c9,function(_0x2b926f){if(_0x2b926f[_0x8402('0x32')]!==_0x8402('0x41')){var _0x48fed6={};_0x48fed6[_0x2b926f['name']]={'$like':'%'+_0x3a9851[_0x8402('0x38')][_0x8402('0x3f')]+'%'};return _0x48fed6;}})});}_0x2fd02d=_[_0x8402('0x42')]({},_0x2fd02d,_0x3a9851['options']);var _0x3d3161={'where':_0x2fd02d[_0x8402('0x40')]};return db['CmHopperBlack'][_0x8402('0x21')](_0x3d3161)[_0x8402('0x28')](function(_0x34fe37){_0x5c911a[_0x8402('0x21')]=_0x34fe37;if(_0x3a9851['query'][_0x8402('0x43')]){_0x2fd02d[_0x8402('0x44')]=[{'all':!![]}];}return db[_0x8402('0x2f')]['findAll'](_0x2fd02d);})[_0x8402('0x28')](function(_0x1d19e7){_0x5c911a['rows']=_0x1d19e7;return _0x5c911a;})[_0x8402('0x28')](respondWithFilteredResult(_0x4235eb,_0x2fd02d))['catch'](handleError(_0x4235eb,null));};exports['show']=function(_0x1df3c7,_0x3ad84c){var _0x34fe30={'raw':!![],'where':{'id':_0x1df3c7[_0x8402('0x45')]['id']}},_0x290ddb={};_0x290ddb['model']=_[_0x8402('0x35')](db[_0x8402('0x2f')][_0x8402('0x30')]);_0x290ddb[_0x8402('0x38')]=_[_0x8402('0x35')](_0x1df3c7['query']);_0x290ddb[_0x8402('0x36')]=_[_0x8402('0x37')](_0x290ddb[_0x8402('0x34')],_0x290ddb['query']);_0x34fe30['attributes']=_[_0x8402('0x37')](_0x290ddb[_0x8402('0x34')],qs[_0x8402('0x39')](_0x1df3c7['query'][_0x8402('0x39')]));_0x34fe30['attributes']=_0x34fe30['attributes'][_0x8402('0x46')]?_0x34fe30[_0x8402('0x3a')]:_0x290ddb[_0x8402('0x34')];if(_0x1df3c7[_0x8402('0x38')][_0x8402('0x43')]){_0x34fe30['include']=[{'all':!![]}];}_0x34fe30=_[_0x8402('0x42')]({},_0x34fe30,_0x1df3c7['options']);return db[_0x8402('0x2f')][_0x8402('0x47')](_0x34fe30)[_0x8402('0x28')](handleEntityNotFound(_0x3ad84c,null))[_0x8402('0x28')](respondWithResult(_0x3ad84c,null))[_0x8402('0x48')](handleError(_0x3ad84c,null));};exports[_0x8402('0x27')]=function(_0x5680c8,_0x2f7c39){if(_0x5680c8['body']['id']){delete _0x5680c8[_0x8402('0x49')]['id'];}return db['CmHopperBlack'][_0x8402('0x47')]({'where':{'id':_0x5680c8['params']['id']}})['then'](handleEntityNotFound(_0x2f7c39,null))['then'](saveUpdates(_0x5680c8[_0x8402('0x49')],null))['then'](respondWithResult(_0x2f7c39,null))[_0x8402('0x48')](handleError(_0x2f7c39,null));};exports[_0x8402('0x4a')]=function(_0x1a0f6c,_0x2b7d59){return db[_0x8402('0x2f')][_0x8402('0x47')]({'where':{'id':_0x1a0f6c[_0x8402('0x45')]['id']}})[_0x8402('0x28')](handleEntityNotFound(_0x2b7d59,null))[_0x8402('0x28')](removeEntity(_0x2b7d59,null))['catch'](handleError(_0x2b7d59,null));};exports[_0x8402('0x4b')]=function(_0x190c73,_0x23c334){return db[_0x8402('0x2f')][_0x8402('0x4b')]()[_0x8402('0x28')](respondWithResult(_0x23c334,null))[_0x8402('0x48')](handleError(_0x23c334,null));}; \ No newline at end of file +var _0x4399=['to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x592c4f,_0xe8a4f0){var _0x57ad00=function(_0x38a436){while(--_0x38a436){_0x592c4f['push'](_0x592c4f['shift']());}};_0x57ad00(++_0xe8a4f0);}(_0x4399,0x150));var _0x9439=function(_0x2e552f,_0x3bb0bd){_0x2e552f=_0x2e552f-0x0;var _0x7e19d5=_0x4399[_0x2e552f];return _0x7e19d5;};'use strict';var emlformat=require(_0x9439('0x0'));var rimraf=require(_0x9439('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9439('0x2'));var rp=require('request-promise');var moment=require(_0x9439('0x3'));var BPromise=require(_0x9439('0x4'));var Mustache=require(_0x9439('0x5'));var util=require(_0x9439('0x6'));var path=require(_0x9439('0x7'));var sox=require(_0x9439('0x8'));var csv=require(_0x9439('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9439('0xa'));var _=require(_0x9439('0xb'));var squel=require(_0x9439('0xc'));var crypto=require(_0x9439('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9439('0xe'));var toCsv=require(_0x9439('0x9'));var querystring=require(_0x9439('0xf'));var Papa=require(_0x9439('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9439('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9439('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9439('0x13'))['db'];function respondWithStatusCode(_0x151b55,_0x1ee639){_0x1ee639=_0x1ee639||0xcc;return function(_0x81e2f4){if(_0x81e2f4){return _0x151b55['sendStatus'](_0x1ee639);}return _0x151b55[_0x9439('0x14')](_0x1ee639)['end']();};}function respondWithResult(_0x5f224d,_0xf9c7e0){_0xf9c7e0=_0xf9c7e0||0xc8;return function(_0x13b8c1){if(_0x13b8c1){return _0x5f224d['status'](_0xf9c7e0)[_0x9439('0x15')](_0x13b8c1);}};}function respondWithFilteredResult(_0x3a5ce3,_0x560b36){return function(_0x28ade9){if(_0x28ade9){var _0x9993ea=typeof _0x560b36[_0x9439('0x16')]===_0x9439('0x17')&&typeof _0x560b36['limit']===_0x9439('0x17');var _0x4478da=_0x28ade9[_0x9439('0x18')];var _0x564d24=_0x9993ea?0x0:_0x560b36[_0x9439('0x16')];var _0x3d1cec=_0x9993ea?_0x28ade9[_0x9439('0x18')]:_0x560b36[_0x9439('0x16')]+_0x560b36[_0x9439('0x19')];var _0x5eb94c;if(_0x3d1cec>=_0x4478da){_0x3d1cec=_0x4478da;_0x5eb94c=0xc8;}else{_0x5eb94c=0xce;}_0x3a5ce3[_0x9439('0x14')](_0x5eb94c);return _0x3a5ce3[_0x9439('0x1a')](_0x9439('0x1b'),_0x564d24+'-'+_0x3d1cec+'/'+_0x4478da)[_0x9439('0x15')](_0x28ade9);}return null;};}function patchUpdates(_0x1bf122){return function(_0x30d135){try{jsonpatch[_0x9439('0x1c')](_0x30d135,_0x1bf122,!![]);}catch(_0xc03e36){return BPromise[_0x9439('0x1d')](_0xc03e36);}return _0x30d135[_0x9439('0x1e')]();};}function saveUpdates(_0xbf78c9,_0x513ace){return function(_0x33af6f){if(_0x33af6f){return _0x33af6f[_0x9439('0x1f')](_0xbf78c9)[_0x9439('0x20')](function(_0xf6e08c){return _0xf6e08c;});}return null;};}function removeEntity(_0x4dfa8f,_0x56e95b){return function(_0x320771){if(_0x320771){return _0x320771[_0x9439('0x21')]()[_0x9439('0x20')](function(){_0x4dfa8f[_0x9439('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2247e5,_0x2cfdfc){return function(_0x691cd7){if(!_0x691cd7){_0x2247e5[_0x9439('0x22')](0x194);}return _0x691cd7;};}function handleError(_0x4352a8,_0x82c594){_0x82c594=_0x82c594||0x1f4;return function(_0x4b23ec){logger[_0x9439('0x23')](_0x4b23ec['stack']);if(_0x4b23ec['name']){delete _0x4b23ec[_0x9439('0x24')];}_0x4352a8[_0x9439('0x14')](_0x82c594)[_0x9439('0x25')](_0x4b23ec);};}exports[_0x9439('0x26')]=function(_0x3f75f8,_0x5054e0){var _0x433980={},_0x4acb27={},_0x39847b={'count':0x0,'rows':[]};var _0x52c369=_[_0x9439('0x27')](db[_0x9439('0x28')][_0x9439('0x29')],function(_0x5b4ea5){return{'name':_0x5b4ea5['fieldName'],'type':_0x5b4ea5[_0x9439('0x2a')][_0x9439('0x2b')]};});_0x4acb27[_0x9439('0x2c')]=_['map'](_0x52c369,'name');_0x4acb27[_0x9439('0x2d')]=_[_0x9439('0x2e')](_0x3f75f8[_0x9439('0x2d')]);_0x4acb27[_0x9439('0x2f')]=_[_0x9439('0x30')](_0x4acb27[_0x9439('0x2c')],_0x4acb27[_0x9439('0x2d')]);_0x433980['attributes']=_['intersection'](_0x4acb27[_0x9439('0x2c')],qs[_0x9439('0x31')](_0x3f75f8[_0x9439('0x2d')][_0x9439('0x31')]));_0x433980['attributes']=_0x433980[_0x9439('0x32')][_0x9439('0x33')]?_0x433980[_0x9439('0x32')]:_0x4acb27[_0x9439('0x2c')];if(!_0x3f75f8[_0x9439('0x2d')]['hasOwnProperty']('nolimit')){_0x433980[_0x9439('0x19')]=qs[_0x9439('0x19')](_0x3f75f8['query']['limit']);_0x433980[_0x9439('0x16')]=qs['offset'](_0x3f75f8['query']['offset']);}_0x433980[_0x9439('0x34')]=qs[_0x9439('0x35')](_0x3f75f8['query']['sort']);_0x433980[_0x9439('0x36')]=qs[_0x9439('0x2f')](_[_0x9439('0x37')](_0x3f75f8['query'],_0x4acb27['filters']),_0x52c369);if(_0x3f75f8[_0x9439('0x2d')][_0x9439('0x38')]){_0x433980[_0x9439('0x36')]=_[_0x9439('0x39')](_0x433980[_0x9439('0x36')],{'$or':_[_0x9439('0x27')](_0x52c369,function(_0x524657){if(_0x524657[_0x9439('0x2a')]!==_0x9439('0x3a')){var _0x180ee1={};_0x180ee1[_0x524657['name']]={'$like':'%'+_0x3f75f8[_0x9439('0x2d')][_0x9439('0x38')]+'%'};return _0x180ee1;}})});}_0x433980=_[_0x9439('0x39')]({},_0x433980,_0x3f75f8['options']);var _0x5d6c08={'where':_0x433980[_0x9439('0x36')]};return db[_0x9439('0x28')][_0x9439('0x18')](_0x5d6c08)[_0x9439('0x20')](function(_0x79dc2){_0x39847b['count']=_0x79dc2;if(_0x3f75f8[_0x9439('0x2d')][_0x9439('0x3b')]){_0x433980[_0x9439('0x3c')]=[{'all':!![]}];}return db[_0x9439('0x28')][_0x9439('0x3d')](_0x433980);})[_0x9439('0x20')](function(_0x29d6fb){_0x39847b['rows']=_0x29d6fb;return _0x39847b;})[_0x9439('0x20')](respondWithFilteredResult(_0x5054e0,_0x433980))[_0x9439('0x3e')](handleError(_0x5054e0,null));};exports[_0x9439('0x3f')]=function(_0x3dd3c2,_0x169a2c){var _0x2dfe3e={'raw':!![],'where':{'id':_0x3dd3c2[_0x9439('0x40')]['id']}},_0x5341d3={};_0x5341d3[_0x9439('0x2c')]=_[_0x9439('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x5341d3[_0x9439('0x2d')]=_[_0x9439('0x2e')](_0x3dd3c2[_0x9439('0x2d')]);_0x5341d3[_0x9439('0x2f')]=_[_0x9439('0x30')](_0x5341d3['model'],_0x5341d3[_0x9439('0x2d')]);_0x2dfe3e['attributes']=_['intersection'](_0x5341d3[_0x9439('0x2c')],qs[_0x9439('0x31')](_0x3dd3c2[_0x9439('0x2d')][_0x9439('0x31')]));_0x2dfe3e[_0x9439('0x32')]=_0x2dfe3e['attributes']['length']?_0x2dfe3e[_0x9439('0x32')]:_0x5341d3[_0x9439('0x2c')];if(_0x3dd3c2['query'][_0x9439('0x3b')]){_0x2dfe3e[_0x9439('0x3c')]=[{'all':!![]}];}_0x2dfe3e=_['merge']({},_0x2dfe3e,_0x3dd3c2[_0x9439('0x41')]);return db[_0x9439('0x28')]['find'](_0x2dfe3e)[_0x9439('0x20')](handleEntityNotFound(_0x169a2c,null))[_0x9439('0x20')](respondWithResult(_0x169a2c,null))['catch'](handleError(_0x169a2c,null));};exports['update']=function(_0x33dbc1,_0x5dd546){if(_0x33dbc1['body']['id']){delete _0x33dbc1[_0x9439('0x42')]['id'];}return db[_0x9439('0x28')][_0x9439('0x43')]({'where':{'id':_0x33dbc1['params']['id']}})['then'](handleEntityNotFound(_0x5dd546,null))[_0x9439('0x20')](saveUpdates(_0x33dbc1[_0x9439('0x42')],null))[_0x9439('0x20')](respondWithResult(_0x5dd546,null))['catch'](handleError(_0x5dd546,null));};exports['destroy']=function(_0x36a044,_0x37d41c){return db[_0x9439('0x28')][_0x9439('0x43')]({'where':{'id':_0x36a044[_0x9439('0x40')]['id']}})['then'](handleEntityNotFound(_0x37d41c,null))['then'](removeEntity(_0x37d41c,null))[_0x9439('0x3e')](handleError(_0x37d41c,null));};exports['describe']=function(_0x5a4c0b,_0x44a527){return db[_0x9439('0x28')][_0x9439('0x44')]()['then'](respondWithResult(_0x44a527,null))['catch'](handleError(_0x44a527,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 761c9c3..0e8af9b 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 _0x42d3=['path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','request-promise'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x42d3,0xcf));var _0x342d=function(_0x17e3a0,_0x93f232){_0x17e3a0=_0x17e3a0-0x0;var _0xbd6440=_0x42d3[_0x17e3a0];return _0xbd6440;};'use strict';var _=require('lodash');var util=require(_0x342d('0x0'));var logger=require(_0x342d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x342d('0x2'));var fs=require('fs');var path=require(_0x342d('0x3'));var rimraf=require('rimraf');var config=require(_0x342d('0x4'));var attributes=require(_0x342d('0x5'));module[_0x342d('0x6')]=function(_0x112243,_0x481994){return _0x112243[_0x342d('0x7')](_0x342d('0x8'),attributes,{'tableName':_0x342d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cfc=['lodash','util','api','moment','bluebird','path','rimraf','exports','CmHopperBlack','cm_hopper_black'];(function(_0x42560f,_0x41a4d7){var _0x25db8b=function(_0x526a7a){while(--_0x526a7a){_0x42560f['push'](_0x42560f['shift']());}};_0x25db8b(++_0x41a4d7);}(_0x2cfc,0x10e));var _0xc2cf=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2cfc[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xc2cf('0x0'));var util=require(_0xc2cf('0x1'));var logger=require('../../config/logger')(_0xc2cf('0x2'));var moment=require(_0xc2cf('0x3'));var BPromise=require(_0xc2cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2cf('0x5'));var rimraf=require(_0xc2cf('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xc2cf('0x7')]=function(_0x51cce3,_0xb21c01){return _0x51cce3['define'](_0xc2cf('0x8'),attributes,{'tableName':_0xc2cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index fc42e43..e76878f 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 _0x7535=['include','model','attributes','GetCmHopperBlack','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','options','raw','where','limit','map'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x7535,0x196));var _0x5753=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x7535[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x5753('0x0'));var util=require(_0x5753('0x1'));var moment=require('moment');var BPromise=require(_0x5753('0x2'));var rs=require(_0x5753('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5753('0x4'))['db'];var utils=require(_0x5753('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5753('0x6'));var jayson=require(_0x5753('0x7'));var client=jayson['client'][_0x5753('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x508016,_0x48a9ad,_0x573d9a){return new BPromise(function(_0x49568e,_0x5ab804){return client[_0x5753('0x9')](_0x508016,_0x573d9a)[_0x5753('0xa')](function(_0x279b6d){logger[_0x5753('0xb')](_0x5753('0xc'),_0x48a9ad,_0x5753('0xd'));logger['debug'](_0x5753('0xe'),_0x48a9ad,_0x5753('0xd'),JSON[_0x5753('0xf')](_0x279b6d));if(_0x279b6d['error']){if(_0x279b6d[_0x5753('0x10')][_0x5753('0x11')]===0x1f4){logger[_0x5753('0x10')](_0x5753('0xc'),_0x48a9ad,_0x279b6d[_0x5753('0x10')]['message']);return _0x5ab804(_0x279b6d[_0x5753('0x10')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x48a9ad,_0x279b6d['error']['message']);return _0x49568e(_0x279b6d['error'][_0x5753('0x12')]);}else{logger[_0x5753('0xb')](_0x5753('0xc'),_0x48a9ad,_0x5753('0xd'));_0x49568e(_0x279b6d[_0x5753('0x13')][_0x5753('0x12')]);}})['catch'](function(_0x3f5b92){logger[_0x5753('0x10')](_0x5753('0xc'),_0x48a9ad,_0x3f5b92);_0x5ab804(_0x3f5b92);});});}exports['GetCmHopperBlack']=function(_0x39b5ea){var _0x23a8d1=this;return new Promise(function(_0x58ff72,_0x5a40a9){return db[_0x5753('0x14')]['findAll']({'raw':_0x39b5ea[_0x5753('0x15')]?_0x39b5ea[_0x5753('0x15')][_0x5753('0x16')]===undefined?!![]:![]:!![],'where':_0x39b5ea['options']?_0x39b5ea['options'][_0x5753('0x17')]||null:null,'attributes':_0x39b5ea[_0x5753('0x15')]?_0x39b5ea[_0x5753('0x15')]['attributes']||null:null,'limit':_0x39b5ea[_0x5753('0x15')]?_0x39b5ea[_0x5753('0x15')][_0x5753('0x18')]||null:null,'include':_0x39b5ea[_0x5753('0x15')]?_0x39b5ea['options']['include']?_[_0x5753('0x19')](_0x39b5ea[_0x5753('0x15')][_0x5753('0x1a')],function(_0x31b660){return{'model':db[_0x31b660['model']],'as':_0x31b660['as'],'attributes':_0x31b660['attributes'],'include':_0x31b660[_0x5753('0x1a')]?_[_0x5753('0x19')](_0x31b660[_0x5753('0x1a')],function(_0x4d83d5){return{'model':db[_0x4d83d5[_0x5753('0x1b')]],'as':_0x4d83d5['as'],'attributes':_0x4d83d5[_0x5753('0x1c')],'include':_0x4d83d5[_0x5753('0x1a')]?_[_0x5753('0x19')](_0x4d83d5['include'],function(_0x1b6506){return{'model':db[_0x1b6506[_0x5753('0x1b')]],'as':_0x1b6506['as'],'attributes':_0x1b6506[_0x5753('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5753('0xa')](function(_0x525881){logger[_0x5753('0xb')](_0x5753('0x1d'),_0x39b5ea);logger['debug'](_0x5753('0x1d'),_0x39b5ea,JSON[_0x5753('0xf')](_0x525881));_0x58ff72(_0x525881);})[_0x5753('0x1e')](function(_0x36af44){logger['error']('GetCmHopperBlack',_0x36af44[_0x5753('0x12')],_0x39b5ea);_0x5a40a9(_0x23a8d1[_0x5753('0x10')](0x1f4,_0x36af44[_0x5753('0x12')]));});});};exports[_0x5753('0x1f')]=function(_0x9e628b){var _0x2916c2=this;return new Promise(function(_0x38a0d0,_0x5616df){return db[_0x5753('0x14')]['update'](_0x9e628b[_0x5753('0x20')],{'raw':_0x9e628b[_0x5753('0x15')]?_0x9e628b[_0x5753('0x15')][_0x5753('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9e628b['options']?_0x9e628b[_0x5753('0x15')][_0x5753('0x17')]||null:null,'attributes':_0x9e628b[_0x5753('0x15')]?_0x9e628b[_0x5753('0x15')][_0x5753('0x1c')]||null:null,'limit':_0x9e628b[_0x5753('0x15')]?_0x9e628b[_0x5753('0x15')][_0x5753('0x18')]||null:null})[_0x5753('0xa')](function(_0x57f09c){logger['info']('UpdateCmHopperBlack',_0x9e628b);logger['debug'](_0x5753('0x1f'),_0x9e628b,JSON['stringify'](_0x57f09c));_0x38a0d0(_0x57f09c);})['catch'](function(_0xa7a02e){logger[_0x5753('0x10')](_0x5753('0x1f'),_0xa7a02e['message'],_0x9e628b);_0x5616df(_0x2916c2[_0x5753('0x10')](0x1f4,_0xa7a02e[_0x5753('0x12')]));});});};exports[_0x5753('0x21')]=function(_0x1d8ed9){var _0x2298ba=this;return new Promise(function(_0x912eb1,_0x237f40){return db['CmHopperBlack'][_0x5753('0x22')]({'where':_0x1d8ed9[_0x5753('0x15')]?_0x1d8ed9[_0x5753('0x15')]['where']||null:null})[_0x5753('0xa')](function(_0x3b6521){logger['info'](_0x5753('0x21'),_0x1d8ed9);logger[_0x5753('0x23')](_0x5753('0x21'),_0x1d8ed9,JSON[_0x5753('0xf')](_0x3b6521));_0x912eb1(_0x3b6521);})[_0x5753('0x1e')](function(_0x3cec51){logger[_0x5753('0x10')](_0x5753('0x21'),_0x3cec51[_0x5753('0x12')],_0x1d8ed9);_0x237f40(_0x2298ba[_0x5753('0x10')](0x1f4,_0x3cec51[_0x5753('0x12')]));});});}; \ No newline at end of file +var _0x47d6=['map','include','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','where','stringify','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','CmHopperBlack','findAll','options','raw','attributes'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x47d6,0xe8));var _0x647d=function(_0x2f802e,_0x5bd031){_0x2f802e=_0x2f802e-0x0;var _0x3e10d1=_0x47d6[_0x2f802e];return _0x3e10d1;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var moment=require(_0x647d('0x2'));var BPromise=require('bluebird');var rs=require(_0x647d('0x3'));var fs=require('fs');var Redis=require(_0x647d('0x4'));var db=require(_0x647d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x647d('0x6'))(_0x647d('0x7'));var config=require('../../config/environment');var jayson=require(_0x647d('0x8'));var client=jayson[_0x647d('0x9')][_0x647d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fd8bf,_0x52204c,_0x347d1d){return new BPromise(function(_0x45e57b,_0x21f23f){return client[_0x647d('0xb')](_0x4fd8bf,_0x347d1d)[_0x647d('0xc')](function(_0x34796a){logger['info'](_0x647d('0xd'),_0x52204c,_0x647d('0xe'));logger['debug'](_0x647d('0xf'),_0x52204c,_0x647d('0xe'),JSON['stringify'](_0x34796a));if(_0x34796a['error']){if(_0x34796a['error'][_0x647d('0x10')]===0x1f4){logger[_0x647d('0x11')](_0x647d('0xd'),_0x52204c,_0x34796a[_0x647d('0x11')][_0x647d('0x12')]);return _0x21f23f(_0x34796a[_0x647d('0x11')][_0x647d('0x12')]);}logger['error'](_0x647d('0xd'),_0x52204c,_0x34796a['error'][_0x647d('0x12')]);return _0x45e57b(_0x34796a[_0x647d('0x11')][_0x647d('0x12')]);}else{logger[_0x647d('0x13')](_0x647d('0xd'),_0x52204c,_0x647d('0xe'));_0x45e57b(_0x34796a[_0x647d('0x14')]['message']);}})[_0x647d('0x15')](function(_0x55e928){logger['error'](_0x647d('0xd'),_0x52204c,_0x55e928);_0x21f23f(_0x55e928);});});}exports['GetCmHopperBlack']=function(_0x5149ab){var _0x3c3cc4=this;return new Promise(function(_0x415f5b,_0x407951){return db[_0x647d('0x16')][_0x647d('0x17')]({'raw':_0x5149ab[_0x647d('0x18')]?_0x5149ab[_0x647d('0x18')][_0x647d('0x19')]===undefined?!![]:![]:!![],'where':_0x5149ab[_0x647d('0x18')]?_0x5149ab['options']['where']||null:null,'attributes':_0x5149ab[_0x647d('0x18')]?_0x5149ab[_0x647d('0x18')][_0x647d('0x1a')]||null:null,'limit':_0x5149ab[_0x647d('0x18')]?_0x5149ab['options']['limit']||null:null,'include':_0x5149ab[_0x647d('0x18')]?_0x5149ab[_0x647d('0x18')]['include']?_[_0x647d('0x1b')](_0x5149ab[_0x647d('0x18')][_0x647d('0x1c')],function(_0x30b53f){return{'model':db[_0x30b53f['model']],'as':_0x30b53f['as'],'attributes':_0x30b53f[_0x647d('0x1a')],'include':_0x30b53f[_0x647d('0x1c')]?_[_0x647d('0x1b')](_0x30b53f[_0x647d('0x1c')],function(_0x34020a){return{'model':db[_0x34020a[_0x647d('0x1d')]],'as':_0x34020a['as'],'attributes':_0x34020a[_0x647d('0x1a')],'include':_0x34020a[_0x647d('0x1c')]?_[_0x647d('0x1b')](_0x34020a['include'],function(_0x3021e5){return{'model':db[_0x3021e5[_0x647d('0x1d')]],'as':_0x3021e5['as'],'attributes':_0x3021e5[_0x647d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x647d('0xc')](function(_0x4bcf6d){logger[_0x647d('0x13')](_0x647d('0x1e'),_0x5149ab);logger[_0x647d('0x1f')]('GetCmHopperBlack',_0x5149ab,JSON['stringify'](_0x4bcf6d));_0x415f5b(_0x4bcf6d);})[_0x647d('0x15')](function(_0x174325){logger[_0x647d('0x11')](_0x647d('0x1e'),_0x174325[_0x647d('0x12')],_0x5149ab);_0x407951(_0x3c3cc4[_0x647d('0x11')](0x1f4,_0x174325['message']));});});};exports[_0x647d('0x20')]=function(_0x49b974){var _0x58ec0e=this;return new Promise(function(_0x5c1e33,_0xc5ed35){return db[_0x647d('0x16')][_0x647d('0x21')](_0x49b974['body'],{'raw':_0x49b974[_0x647d('0x18')]?_0x49b974[_0x647d('0x18')][_0x647d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49b974[_0x647d('0x18')]?_0x49b974['options'][_0x647d('0x22')]||null:null,'attributes':_0x49b974[_0x647d('0x18')]?_0x49b974[_0x647d('0x18')][_0x647d('0x1a')]||null:null,'limit':_0x49b974['options']?_0x49b974[_0x647d('0x18')]['limit']||null:null})[_0x647d('0xc')](function(_0x5b55eb){logger[_0x647d('0x13')]('UpdateCmHopperBlack',_0x49b974);logger[_0x647d('0x1f')]('UpdateCmHopperBlack',_0x49b974,JSON[_0x647d('0x23')](_0x5b55eb));_0x5c1e33(_0x5b55eb);})['catch'](function(_0x2c81ee){logger[_0x647d('0x11')](_0x647d('0x20'),_0x2c81ee[_0x647d('0x12')],_0x49b974);_0xc5ed35(_0x58ec0e[_0x647d('0x11')](0x1f4,_0x2c81ee[_0x647d('0x12')]));});});};exports[_0x647d('0x24')]=function(_0x5ad2d0){var _0x189e00=this;return new Promise(function(_0x192b4b,_0x1e2ce0){return db[_0x647d('0x16')]['destroy']({'where':_0x5ad2d0[_0x647d('0x18')]?_0x5ad2d0[_0x647d('0x18')][_0x647d('0x22')]||null:null})[_0x647d('0xc')](function(_0x4a0a97){logger[_0x647d('0x13')](_0x647d('0x24'),_0x5ad2d0);logger[_0x647d('0x1f')](_0x647d('0x24'),_0x5ad2d0,JSON[_0x647d('0x23')](_0x4a0a97));_0x192b4b(_0x4a0a97);})[_0x647d('0x15')](function(_0x1ab362){logger[_0x647d('0x11')](_0x647d('0x24'),_0x1ab362[_0x647d('0x12')],_0x5ad2d0);_0x1e2ce0(_0x189e00['error'](0x1f4,_0x1ab362[_0x647d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e0fdec5..1b22977 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 _0x68b3=['/:id','show','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x37cb83,_0x1151bd){var _0x27386d=function(_0x3f23e3){while(--_0x3f23e3){_0x37cb83['push'](_0x37cb83['shift']());}};_0x27386d(++_0x1151bd);}(_0x68b3,0x1d8));var _0x368b=function(_0x5e100f,_0x48e456){_0x5e100f=_0x5e100f-0x0;var _0x44b748=_0x68b3[_0x5e100f];return _0x44b748;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['put'](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0x10')]);router['delete'](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb016=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','put','/:id','destroy'];(function(_0x3fff8d,_0x1802a3){var _0x402a06=function(_0x195e2d){while(--_0x195e2d){_0x3fff8d['push'](_0x3fff8d['shift']());}};_0x402a06(++_0x1802a3);}(_0xb016,0x159));var _0x6b01=function(_0x3c592c,_0x148d70){_0x3c592c=_0x3c592c-0x0;var _0x37ced5=_0xb016[_0x3c592c];return _0x37ced5;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller['update']);router['delete'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8c44f33..47dc72d 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 _0x7832=['seconds','BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','endtime','setDataValue','followuptime','diff'];(function(_0x1d6a1d,_0x452e52){var _0x87232a=function(_0x538854){while(--_0x538854){_0x1d6a1d['push'](_0x1d6a1d['shift']());}};_0x87232a(++_0x452e52);}(_0x7832,0x176));var _0x2783=function(_0x15dc14,_0x4f7118){_0x15dc14=_0x15dc14-0x0;var _0x8236ec=_0x7832[_0x15dc14];return _0x8236ec;};'use strict';var Sequelize=require(_0x2783('0x0'));var moment=require(_0x2783('0x1'));module[_0x2783('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2783('0x3')]},'countbusyretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2783('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x2783('0x5')]},'originatecalleridname':{'type':Sequelize[_0x2783('0x5')]},'calleridnum':{'type':Sequelize[_0x2783('0x5')]},'calleridname':{'type':Sequelize[_0x2783('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2783('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2783('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2783('0x5')]},'reason':{'type':Sequelize[_0x2783('0x5')]},'disposition':{'type':Sequelize[_0x2783('0x5')]},'secondDisposition':{'type':Sequelize[_0x2783('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2783('0x5')]},'dispositionat':{'type':Sequelize[_0x2783('0x3')],'set':function(_0x339235){var _0x260d92=this['getDataValue'](_0x2783('0x6'));if(_0x260d92&&_0x339235){this[_0x2783('0x7')](_0x2783('0x8'),moment(_0x339235)[_0x2783('0x9')](moment(_0x260d92),_0x2783('0xa')));}}},'amd':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2783('0x3')]},'callback':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2783('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2783('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2783('0x3')]},'recallme':{'type':Sequelize[_0x2783('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2783('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe32d=['DATE','INTEGER','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe32d,0x1ca));var _0xde32=function(_0x3c98fa,_0x3020dc){_0x3c98fa=_0x3c98fa-0x0;var _0x52c31b=_0xe32d[_0x3c98fa];return _0x52c31b;};'use strict';var Sequelize=require(_0xde32('0x0'));var moment=require(_0xde32('0x1'));module[_0xde32('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xde32('0x3')]},'scheduledat':{'type':Sequelize[_0xde32('0x4')]},'countbusyretry':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xde32('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xde32('0x3')]},'originatecalleridname':{'type':Sequelize[_0xde32('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xde32('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xde32('0x4')]},'answertime':{'type':Sequelize[_0xde32('0x4')]},'droptime':{'type':Sequelize[_0xde32('0x4')]},'endtime':{'type':Sequelize[_0xde32('0x4')]},'ringtime':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xde32('0x3')]},'campaign':{'type':Sequelize[_0xde32('0x3')]},'campaigntype':{'type':Sequelize[_0xde32('0x3')]},'membername':{'type':Sequelize[_0xde32('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xde32('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xde32('0x3')]},'dispositionat':{'type':Sequelize[_0xde32('0x4')],'set':function(_0x2c825f){var _0x3a96b9=this['getDataValue'](_0xde32('0x6'));if(_0x3a96b9&&_0x2c825f){this['setDataValue'](_0xde32('0x7'),moment(_0x2c825f)[_0xde32('0x8')](moment(_0x3a96b9),_0xde32('0x9')));}}},'amd':{'type':Sequelize[_0xde32('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xde32('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xde32('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xde32('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xde32('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xde32('0x4')]},'deleted':{'type':Sequelize[_0xde32('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xde32('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xde32('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xde32('0x5')],'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 014fc8e..a1452c2 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 _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x5c6eaf,_0x48190e){var _0x5ee663=function(_0x4832b7){while(--_0x4832b7){_0x5c6eaf['push'](_0x5c6eaf['shift']());}};_0x5ee663(++_0x48190e);}(_0xb016,0x159));var _0x6b01=function(_0x13e8fe,_0x2bce25){_0x13e8fe=_0x13e8fe-0x0;var _0x64615b=_0xb016[_0x13e8fe];return _0x64615b;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file +var _0x9536=['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','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0xa9361f,_0x4b36f8){var _0xf8c893=function(_0x56b120){while(--_0x56b120){_0xa9361f['push'](_0xa9361f['shift']());}};_0xf8c893(++_0x4b36f8);}(_0x9536,0x179));var _0x6953=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x9536[_0xd2d54];return _0x78b113;};'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['CmHopperFinal'][_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['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 35b46c2..f65b195 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 _0x2c5a=['api','moment','bluebird','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x2c5a,0x8c));var _0xa2c5=function(_0x42e2a4,_0x44dd82){_0x42e2a4=_0x42e2a4-0x0;var _0x2e40f9=_0x2c5a[_0x42e2a4];return _0x2e40f9;};'use strict';var _=require(_0xa2c5('0x0'));var util=require(_0xa2c5('0x1'));var logger=require(_0xa2c5('0x2'))(_0xa2c5('0x3'));var moment=require(_0xa2c5('0x4'));var BPromise=require(_0xa2c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa2c5('0x6'));var attributes=require(_0xa2c5('0x7'));module[_0xa2c5('0x8')]=function(_0x1dfa64,_0x58ed0f){return _0x1dfa64[_0xa2c5('0x9')](_0xa2c5('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xa2c5('0xb')]},{'name':_0xa2c5('0xc'),'fields':[_0xa2c5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c06=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x487358,_0x3b36b5){var _0x1473fe=function(_0x497cef){while(--_0x497cef){_0x487358['push'](_0x487358['shift']());}};_0x1473fe(++_0x3b36b5);}(_0x1c06,0x190));var _0x61c0=function(_0x52ab62,_0x203d25){_0x52ab62=_0x52ab62-0x0;var _0x42f499=_0x1c06[_0x52ab62];return _0x42f499;};'use strict';var _=require(_0x61c0('0x0'));var util=require(_0x61c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61c0('0x2'));var BPromise=require(_0x61c0('0x3'));var rp=require(_0x61c0('0x4'));var fs=require('fs');var path=require(_0x61c0('0x5'));var rimraf=require(_0x61c0('0x6'));var config=require(_0x61c0('0x7'));var attributes=require(_0x61c0('0x8'));module[_0x61c0('0x9')]=function(_0x1e45d8,_0x4f5e35){return _0x1e45d8['define'](_0x61c0('0xa'),attributes,{'tableName':_0x61c0('0xb'),'paranoid':![],'indexes':[{'name':_0x61c0('0xc'),'fields':[_0x61c0('0xc')]},{'name':_0x61c0('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2c93f06..02c1116 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(_0x40564e,_0xc8612e){var _0x1d073a=function(_0x554fe4){while(--_0x554fe4){_0x40564e['push'](_0x40564e['shift']());}};_0x1d073a(++_0xc8612e);}(_0x7a54,0x106));var _0x47a5=function(_0x526188,_0x59184e){_0x526188=_0x526188-0x0;var _0x32b1f9=_0x7a54[_0x526188];return _0x32b1f9;};'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(_0x4e9dde,_0x5e620f){var _0x2b0e99=function(_0x3180da){while(--_0x3180da){_0x4e9dde['push'](_0x4e9dde['shift']());}};_0x2b0e99(++_0x5e620f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ab821,_0xffb575){_0x3ab821=_0x3ab821-0x0;var _0x4741b9=_0xb10b[_0x3ab821];return _0x4741b9;};'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 daa47a2..e5dba49 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 _0xc0bf=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','checkContactHopper','put','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc0bf,0x8c));var _0xfc0b=function(_0xce3cc7,_0x22c6f4){_0xce3cc7=_0xce3cc7-0x0;var _0x281fae=_0xc0bf[_0xce3cc7];return _0x281fae;};'use strict';var multer=require('multer');var util=require(_0xfc0b('0x0'));var path=require(_0xfc0b('0x1'));var timeout=require(_0xfc0b('0x2'));var express=require(_0xfc0b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc0b('0x4'));var interaction=require(_0xfc0b('0x5'));var config=require(_0xfc0b('0x6'));var controller=require(_0xfc0b('0x7'));router[_0xfc0b('0x8')]('/',auth[_0xfc0b('0x9')](),controller[_0xfc0b('0xa')]);router[_0xfc0b('0x8')](_0xfc0b('0xb'),auth[_0xfc0b('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfc0b('0xc')]);router[_0xfc0b('0x8')](_0xfc0b('0xd'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xfc0b('0x8')](_0xfc0b('0xe'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xfc0b('0xf')](_0xfc0b('0x10'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xfc0b('0xf')]('/voice/campaign/moveContacts/:id',auth[_0xfc0b('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xfc0b('0xf')]('/checkContactHopper',auth[_0xfc0b('0x9')](),controller[_0xfc0b('0x11')]);router[_0xfc0b('0x12')]('/:id',auth[_0xfc0b('0x9')](),controller[_0xfc0b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x161a=['get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3bab61,_0x199734){var _0x9d7aef=function(_0x516220){while(--_0x516220){_0x3bab61['push'](_0x3bab61['shift']());}};_0x9d7aef(++_0x199734);}(_0x161a,0x140));var _0xa161=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x161a[_0x1df7b8];return _0x29d911;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa161('0x0'));var timeout=require(_0xa161('0x1'));var express=require('express');var router=express[_0xa161('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa161('0x3'));var interaction=require(_0xa161('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xa161('0x5')]('/',auth[_0xa161('0x6')](),controller[_0xa161('0x7')]);router[_0xa161('0x5')](_0xa161('0x8'),auth[_0xa161('0x6')](),controller[_0xa161('0x9')]);router['get'](_0xa161('0xa'),auth[_0xa161('0x6')](),controller[_0xa161('0xb')]);router[_0xa161('0x5')](_0xa161('0xc'),auth[_0xa161('0x6')](),controller[_0xa161('0xd')]);router[_0xa161('0x5')](_0xa161('0xe'),auth[_0xa161('0x6')](),controller[_0xa161('0xf')]);router[_0xa161('0x10')](_0xa161('0x11'),auth['isAuthenticated'](),controller[_0xa161('0x12')]);router[_0xa161('0x10')](_0xa161('0x13'),auth[_0xa161('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa161('0x10')](_0xa161('0x14'),auth['isAuthenticated'](),controller[_0xa161('0x15')]);router[_0xa161('0x16')]('/:id',auth[_0xa161('0x6')](),controller[_0xa161('0x17')]);module[_0xa161('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index cea1241..95a1e5f 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 _0x59ee=['BOOLEAN','exports','STRING','INTEGER','DATE'];(function(_0xb10b6d,_0x125587){var _0x1efcc5=function(_0x1425c1){while(--_0x1425c1){_0xb10b6d['push'](_0xb10b6d['shift']());}};_0x1efcc5(++_0x125587);}(_0x59ee,0x1a0));var _0xe59e=function(_0x13ec2b,_0x40b664){_0x13ec2b=_0x13ec2b-0x0;var _0x1fb3f4=_0x59ee[_0x13ec2b];return _0x1fb3f4;};'use strict';var Sequelize=require('sequelize');module[_0xe59e('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe59e('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe59e('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xe59e('0x1')]},'originatecalleridname':{'type':Sequelize[_0xe59e('0x1')]},'calleridnum':{'type':Sequelize[_0xe59e('0x1')]},'calleridname':{'type':Sequelize[_0xe59e('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe59e('0x3')]},'answertime':{'type':Sequelize[_0xe59e('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe59e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe59e('0x1')]},'campaign':{'type':Sequelize[_0xe59e('0x1')]},'campaigntype':{'type':Sequelize[_0xe59e('0x1')]},'membername':{'type':Sequelize[_0xe59e('0x1')]},'reason':{'type':Sequelize[_0xe59e('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe59e('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe59e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe59e('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe59e('0x3')]},'edited':{'type':Sequelize[_0xe59e('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe59e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe59e('0x1')]}}; \ No newline at end of file +var _0x6ff6=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x6ff6,0x182));var _0x66ff=function(_0x660f56,_0x350b0d){_0x660f56=_0x660f56-0x0;var _0x55e37d=_0x6ff6[_0x660f56];return _0x55e37d;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x66ff('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x66ff('0x1')]},'scheduledat':{'type':Sequelize[_0x66ff('0x2')]},'countbusyretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x66ff('0x1')]},'calleridnum':{'type':Sequelize[_0x66ff('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x66ff('0x2')]},'answertime':{'type':Sequelize[_0x66ff('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x66ff('0x2')]},'ringtime':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x66ff('0x1')]},'campaign':{'type':Sequelize[_0x66ff('0x1')]},'campaigntype':{'type':Sequelize[_0x66ff('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x66ff('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x66ff('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x66ff('0x2')]},'recallme':{'type':Sequelize[_0x66ff('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x66ff('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x66ff('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x66ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a23bc31..7bb9f69 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 _0xe849=['update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','CmHopperHistory','findAll','rows','catch','show','params','keys','include','create','body','describe','uniqueid','find','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save'];(function(_0x27d0ad,_0x3f8bef){var _0x4eec43=function(_0x336bb6){while(--_0x336bb6){_0x27d0ad['push'](_0x27d0ad['shift']());}};_0x4eec43(++_0x3f8bef);}(_0xe849,0x1a0));var _0x9e84=function(_0x4c0e74,_0x3a01b1){_0x4c0e74=_0x4c0e74-0x0;var _0x44bbb1=_0xe849[_0x4c0e74];return _0x44bbb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9e84('0x0'));var jsonpatch=require(_0x9e84('0x1'));var rp=require(_0x9e84('0x2'));var moment=require('moment');var BPromise=require(_0x9e84('0x3'));var Mustache=require(_0x9e84('0x4'));var util=require(_0x9e84('0x5'));var path=require(_0x9e84('0x6'));var sox=require(_0x9e84('0x7'));var csv=require(_0x9e84('0x8'));var ejs=require(_0x9e84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e84('0xa'));var squel=require(_0x9e84('0xb'));var crypto=require(_0x9e84('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e84('0xd'));var toCsv=require(_0x9e84('0x8'));var querystring=require(_0x9e84('0xe'));var Papa=require(_0x9e84('0xf'));var Redis=require(_0x9e84('0x10'));var authService=require(_0x9e84('0x11'));var qs=require(_0x9e84('0x12'));var as=require(_0x9e84('0x13'));var hardwareService=require(_0x9e84('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e84('0x15'));var db=require(_0x9e84('0x16'))['db'];function respondWithStatusCode(_0x4e6496,_0x280fc0){_0x280fc0=_0x280fc0||0xcc;return function(_0x51cf57){if(_0x51cf57){return _0x4e6496['sendStatus'](_0x280fc0);}return _0x4e6496[_0x9e84('0x17')](_0x280fc0)[_0x9e84('0x18')]();};}function respondWithResult(_0x48d178,_0x1824a2){_0x1824a2=_0x1824a2||0xc8;return function(_0x329962){if(_0x329962){return _0x48d178[_0x9e84('0x17')](_0x1824a2)['json'](_0x329962);}};}function respondWithFilteredResult(_0x25b941,_0x3a719f){return function(_0x5c56a5){if(_0x5c56a5){var _0x2c4152=typeof _0x3a719f[_0x9e84('0x19')]===_0x9e84('0x1a')&&typeof _0x3a719f[_0x9e84('0x1b')]===_0x9e84('0x1a');var _0x1d6b64=_0x5c56a5['count'];var _0x10fcd7=_0x2c4152?0x0:_0x3a719f[_0x9e84('0x19')];var _0x33a5a9=_0x2c4152?_0x5c56a5[_0x9e84('0x1c')]:_0x3a719f[_0x9e84('0x19')]+_0x3a719f['limit'];var _0x34c34e;if(_0x33a5a9>=_0x1d6b64){_0x33a5a9=_0x1d6b64;_0x34c34e=0xc8;}else{_0x34c34e=0xce;}_0x25b941[_0x9e84('0x17')](_0x34c34e);return _0x25b941[_0x9e84('0x1d')]('Content-Range',_0x10fcd7+'-'+_0x33a5a9+'/'+_0x1d6b64)[_0x9e84('0x1e')](_0x5c56a5);}return null;};}function patchUpdates(_0x4f6cae){return function(_0x1a5be0){try{jsonpatch[_0x9e84('0x1f')](_0x1a5be0,_0x4f6cae,!![]);}catch(_0x4a0726){return BPromise[_0x9e84('0x20')](_0x4a0726);}return _0x1a5be0[_0x9e84('0x21')]();};}function saveUpdates(_0x35ad10,_0x414f97){return function(_0x1eb983){if(_0x1eb983){return _0x1eb983[_0x9e84('0x22')](_0x35ad10)[_0x9e84('0x23')](function(_0x1e4829){return _0x1e4829;});}return null;};}function removeEntity(_0x229e9e,_0x37dee1){return function(_0x178ba0){if(_0x178ba0){return _0x178ba0[_0x9e84('0x24')]()[_0x9e84('0x23')](function(){_0x229e9e[_0x9e84('0x17')](0xcc)[_0x9e84('0x18')]();});}};}function handleEntityNotFound(_0x4494f0,_0xa7d39f){return function(_0x3b89be){if(!_0x3b89be){_0x4494f0[_0x9e84('0x25')](0x194);}return _0x3b89be;};}function handleError(_0x41c094,_0x32d2ab){_0x32d2ab=_0x32d2ab||0x1f4;return function(_0x3718fd){logger['error'](_0x3718fd[_0x9e84('0x26')]);if(_0x3718fd[_0x9e84('0x27')]){delete _0x3718fd[_0x9e84('0x27')];}_0x41c094[_0x9e84('0x17')](_0x32d2ab)['send'](_0x3718fd);};}exports[_0x9e84('0x28')]=function(_0x29bd9d,_0xaac1f3){var _0x388bbd={},_0xd10aa4={},_0x3efcdc={'count':0x0,'rows':[]};var _0x2c9947=_[_0x9e84('0x29')](db['CmHopperHistory'][_0x9e84('0x2a')],function(_0x1304da){return{'name':_0x1304da[_0x9e84('0x2b')],'type':_0x1304da[_0x9e84('0x2c')][_0x9e84('0x2d')]};});_0xd10aa4[_0x9e84('0x2e')]=_['map'](_0x2c9947,'name');_0xd10aa4[_0x9e84('0x2f')]=_['keys'](_0x29bd9d[_0x9e84('0x2f')]);_0xd10aa4['filters']=_[_0x9e84('0x30')](_0xd10aa4[_0x9e84('0x2e')],_0xd10aa4[_0x9e84('0x2f')]);_0x388bbd[_0x9e84('0x31')]=_[_0x9e84('0x30')](_0xd10aa4[_0x9e84('0x2e')],qs[_0x9e84('0x32')](_0x29bd9d['query'][_0x9e84('0x32')]));_0x388bbd[_0x9e84('0x31')]=_0x388bbd[_0x9e84('0x31')][_0x9e84('0x33')]?_0x388bbd[_0x9e84('0x31')]:_0xd10aa4[_0x9e84('0x2e')];if(!_0x29bd9d[_0x9e84('0x2f')]['hasOwnProperty'](_0x9e84('0x34'))){_0x388bbd[_0x9e84('0x1b')]=qs[_0x9e84('0x1b')](_0x29bd9d[_0x9e84('0x2f')][_0x9e84('0x1b')]);_0x388bbd[_0x9e84('0x19')]=qs[_0x9e84('0x19')](_0x29bd9d[_0x9e84('0x2f')][_0x9e84('0x19')]);}_0x388bbd[_0x9e84('0x35')]=qs[_0x9e84('0x36')](_0x29bd9d['query']['sort']);_0x388bbd['where']=qs[_0x9e84('0x37')](_['pick'](_0x29bd9d[_0x9e84('0x2f')],_0xd10aa4[_0x9e84('0x37')]),_0x2c9947);if(_0x29bd9d[_0x9e84('0x2f')][_0x9e84('0x38')]){_0x388bbd[_0x9e84('0x39')]=_[_0x9e84('0x3a')](_0x388bbd[_0x9e84('0x39')],{'$or':_[_0x9e84('0x29')](_0x2c9947,function(_0x587040){if(_0x587040[_0x9e84('0x2c')]!==_0x9e84('0x3b')){var _0x4c8818={};_0x4c8818[_0x587040[_0x9e84('0x27')]]={'$like':'%'+_0x29bd9d[_0x9e84('0x2f')][_0x9e84('0x38')]+'%'};return _0x4c8818;}})});}_0x388bbd=_[_0x9e84('0x3a')]({},_0x388bbd,_0x29bd9d[_0x9e84('0x3c')]);var _0x333b05={'where':_0x388bbd['where']};return db['CmHopperHistory'][_0x9e84('0x1c')](_0x333b05)[_0x9e84('0x23')](function(_0x28754e){_0x3efcdc[_0x9e84('0x1c')]=_0x28754e;if(_0x29bd9d[_0x9e84('0x2f')][_0x9e84('0x3d')]){_0x388bbd['include']=[{'all':!![]}];}return db[_0x9e84('0x3e')][_0x9e84('0x3f')](_0x388bbd);})[_0x9e84('0x23')](function(_0x303a50){_0x3efcdc[_0x9e84('0x40')]=_0x303a50;return _0x3efcdc;})['then'](respondWithFilteredResult(_0xaac1f3,_0x388bbd))[_0x9e84('0x41')](handleError(_0xaac1f3,null));};exports[_0x9e84('0x42')]=function(_0x3c9096,_0x1217ac){var _0x566392={'raw':!![],'where':{'id':_0x3c9096[_0x9e84('0x43')]['id']}},_0x2facbb={};_0x2facbb[_0x9e84('0x2e')]=_[_0x9e84('0x44')](db[_0x9e84('0x3e')]['rawAttributes']);_0x2facbb[_0x9e84('0x2f')]=_[_0x9e84('0x44')](_0x3c9096['query']);_0x2facbb[_0x9e84('0x37')]=_[_0x9e84('0x30')](_0x2facbb[_0x9e84('0x2e')],_0x2facbb[_0x9e84('0x2f')]);_0x566392[_0x9e84('0x31')]=_['intersection'](_0x2facbb[_0x9e84('0x2e')],qs[_0x9e84('0x32')](_0x3c9096[_0x9e84('0x2f')][_0x9e84('0x32')]));_0x566392[_0x9e84('0x31')]=_0x566392['attributes'][_0x9e84('0x33')]?_0x566392[_0x9e84('0x31')]:_0x2facbb[_0x9e84('0x2e')];if(_0x3c9096[_0x9e84('0x2f')][_0x9e84('0x3d')]){_0x566392[_0x9e84('0x45')]=[{'all':!![]}];}_0x566392=_[_0x9e84('0x3a')]({},_0x566392,_0x3c9096['options']);return db['CmHopperHistory']['find'](_0x566392)['then'](handleEntityNotFound(_0x1217ac,null))['then'](respondWithResult(_0x1217ac,null))[_0x9e84('0x41')](handleError(_0x1217ac,null));};exports['create']=function(_0xaea822,_0x39a869){return db['CmHopperHistory'][_0x9e84('0x46')](_0xaea822[_0x9e84('0x47')],{})[_0x9e84('0x23')](respondWithResult(_0x39a869,0xc9))['catch'](handleError(_0x39a869,null));};exports['describe']=function(_0x413ca7,_0xff3f2d){return db[_0x9e84('0x3e')][_0x9e84('0x48')]()['then'](respondWithResult(_0xff3f2d,null))[_0x9e84('0x41')](handleError(_0xff3f2d,null));};exports[_0x9e84('0x22')]=function(_0x520653,_0x9b5c5e){if(_0x520653[_0x9e84('0x47')][_0x9e84('0x49')]){delete _0x520653[_0x9e84('0x47')]['uniqueid'];}return db[_0x9e84('0x3e')][_0x9e84('0x4a')]({'where':{'uniqueid':_0x520653['params']['id']}})[_0x9e84('0x23')](handleEntityNotFound(_0x9b5c5e,null))[_0x9e84('0x23')](saveUpdates(_0x520653[_0x9e84('0x47')],null))[_0x9e84('0x23')](respondWithResult(_0x9b5c5e,null))[_0x9e84('0x41')](handleError(_0x9b5c5e,null));}; \ No newline at end of file +var _0xfb3c=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','describe','uniqueid','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x14d27a,_0x184165){var _0x3b9e20=function(_0x547afa){while(--_0x547afa){_0x14d27a['push'](_0x14d27a['shift']());}};_0x3b9e20(++_0x184165);}(_0xfb3c,0x182));var _0xcfb3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfb3c[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xcfb3('0x0'));var rimraf=require(_0xcfb3('0x1'));var zipdir=require(_0xcfb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfb3('0x3'));var moment=require(_0xcfb3('0x4'));var BPromise=require(_0xcfb3('0x5'));var Mustache=require(_0xcfb3('0x6'));var util=require(_0xcfb3('0x7'));var path=require(_0xcfb3('0x8'));var sox=require(_0xcfb3('0x9'));var csv=require(_0xcfb3('0xa'));var ejs=require(_0xcfb3('0xb'));var fs=require('fs');var fs_extra=require(_0xcfb3('0xc'));var _=require(_0xcfb3('0xd'));var squel=require(_0xcfb3('0xe'));var crypto=require(_0xcfb3('0xf'));var jsforce=require(_0xcfb3('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfb3('0x11'));var Papa=require(_0xcfb3('0x12'));var Redis=require(_0xcfb3('0x13'));var authService=require(_0xcfb3('0x14'));var qs=require(_0xcfb3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfb3('0x16'));var logger=require(_0xcfb3('0x17'))('api');var utils=require(_0xcfb3('0x18'));var config=require(_0xcfb3('0x19'));var licenseUtil=require(_0xcfb3('0x1a'));var db=require(_0xcfb3('0x1b'))['db'];function respondWithStatusCode(_0x24c935,_0x3a1e2c){_0x3a1e2c=_0x3a1e2c||0xcc;return function(_0x36b64f){if(_0x36b64f){return _0x24c935[_0xcfb3('0x1c')](_0x3a1e2c);}return _0x24c935[_0xcfb3('0x1d')](_0x3a1e2c)[_0xcfb3('0x1e')]();};}function respondWithResult(_0x48a94d,_0x5dd23e){_0x5dd23e=_0x5dd23e||0xc8;return function(_0x13a320){if(_0x13a320){return _0x48a94d[_0xcfb3('0x1d')](_0x5dd23e)[_0xcfb3('0x1f')](_0x13a320);}};}function respondWithFilteredResult(_0x3aa0f8,_0x48ac8d){return function(_0x253a01){if(_0x253a01){var _0x18e824=typeof _0x48ac8d[_0xcfb3('0x20')]==='undefined'&&typeof _0x48ac8d[_0xcfb3('0x21')]===_0xcfb3('0x22');var _0x5c303d=_0x253a01[_0xcfb3('0x23')];var _0x16a66a=_0x18e824?0x0:_0x48ac8d[_0xcfb3('0x20')];var _0xdbde11=_0x18e824?_0x253a01[_0xcfb3('0x23')]:_0x48ac8d[_0xcfb3('0x20')]+_0x48ac8d[_0xcfb3('0x21')];var _0x3dc799;if(_0xdbde11>=_0x5c303d){_0xdbde11=_0x5c303d;_0x3dc799=0xc8;}else{_0x3dc799=0xce;}_0x3aa0f8[_0xcfb3('0x1d')](_0x3dc799);return _0x3aa0f8[_0xcfb3('0x24')]('Content-Range',_0x16a66a+'-'+_0xdbde11+'/'+_0x5c303d)[_0xcfb3('0x1f')](_0x253a01);}return null;};}function patchUpdates(_0x638b85){return function(_0x173126){try{jsonpatch[_0xcfb3('0x25')](_0x173126,_0x638b85,!![]);}catch(_0x396511){return BPromise[_0xcfb3('0x26')](_0x396511);}return _0x173126[_0xcfb3('0x27')]();};}function saveUpdates(_0x46e01f,_0x402a96){return function(_0x4dcd78){if(_0x4dcd78){return _0x4dcd78[_0xcfb3('0x28')](_0x46e01f)[_0xcfb3('0x29')](function(_0x5e5bb1){return _0x5e5bb1;});}return null;};}function removeEntity(_0xe343b4,_0x2c5d5e){return function(_0x5ce272){if(_0x5ce272){return _0x5ce272[_0xcfb3('0x2a')]()[_0xcfb3('0x29')](function(){_0xe343b4[_0xcfb3('0x1d')](0xcc)[_0xcfb3('0x1e')]();});}};}function handleEntityNotFound(_0xcc2f6,_0x28cda3){return function(_0x34c0f4){if(!_0x34c0f4){_0xcc2f6[_0xcfb3('0x1c')](0x194);}return _0x34c0f4;};}function handleError(_0x1f2fe4,_0x94012e){_0x94012e=_0x94012e||0x1f4;return function(_0x2de02c){logger[_0xcfb3('0x2b')](_0x2de02c[_0xcfb3('0x2c')]);if(_0x2de02c[_0xcfb3('0x2d')]){delete _0x2de02c[_0xcfb3('0x2d')];}_0x1f2fe4['status'](_0x94012e)[_0xcfb3('0x2e')](_0x2de02c);};}exports[_0xcfb3('0x2f')]=function(_0x254ea3,_0xa35c4d){var _0x3748e7={},_0x4eeed9={},_0x4825d6={'count':0x0,'rows':[]};var _0x556260=_['map'](db[_0xcfb3('0x30')][_0xcfb3('0x31')],function(_0x268863){return{'name':_0x268863['fieldName'],'type':_0x268863[_0xcfb3('0x32')]['key']};});_0x4eeed9[_0xcfb3('0x33')]=_[_0xcfb3('0x34')](_0x556260,_0xcfb3('0x2d'));_0x4eeed9[_0xcfb3('0x35')]=_[_0xcfb3('0x36')](_0x254ea3[_0xcfb3('0x35')]);_0x4eeed9[_0xcfb3('0x37')]=_[_0xcfb3('0x38')](_0x4eeed9[_0xcfb3('0x33')],_0x4eeed9['query']);_0x3748e7[_0xcfb3('0x39')]=_['intersection'](_0x4eeed9[_0xcfb3('0x33')],qs[_0xcfb3('0x3a')](_0x254ea3[_0xcfb3('0x35')][_0xcfb3('0x3a')]));_0x3748e7[_0xcfb3('0x39')]=_0x3748e7[_0xcfb3('0x39')]['length']?_0x3748e7[_0xcfb3('0x39')]:_0x4eeed9['model'];if(!_0x254ea3[_0xcfb3('0x35')][_0xcfb3('0x3b')](_0xcfb3('0x3c'))){_0x3748e7[_0xcfb3('0x21')]=qs[_0xcfb3('0x21')](_0x254ea3[_0xcfb3('0x35')][_0xcfb3('0x21')]);_0x3748e7[_0xcfb3('0x20')]=qs[_0xcfb3('0x20')](_0x254ea3['query'][_0xcfb3('0x20')]);}_0x3748e7[_0xcfb3('0x3d')]=qs[_0xcfb3('0x3e')](_0x254ea3[_0xcfb3('0x35')]['sort']);_0x3748e7[_0xcfb3('0x3f')]=qs['filters'](_['pick'](_0x254ea3['query'],_0x4eeed9[_0xcfb3('0x37')]),_0x556260);if(_0x254ea3['query'][_0xcfb3('0x40')]){_0x3748e7[_0xcfb3('0x3f')]=_[_0xcfb3('0x41')](_0x3748e7['where'],{'$or':_[_0xcfb3('0x34')](_0x556260,function(_0x50884d){if(_0x50884d[_0xcfb3('0x32')]!=='VIRTUAL'){var _0x210670={};_0x210670[_0x50884d['name']]={'$like':'%'+_0x254ea3[_0xcfb3('0x35')][_0xcfb3('0x40')]+'%'};return _0x210670;}})});}_0x3748e7=_[_0xcfb3('0x41')]({},_0x3748e7,_0x254ea3[_0xcfb3('0x42')]);var _0x4a2fa9={'where':_0x3748e7[_0xcfb3('0x3f')]};return db[_0xcfb3('0x30')][_0xcfb3('0x23')](_0x4a2fa9)[_0xcfb3('0x29')](function(_0x61d005){_0x4825d6[_0xcfb3('0x23')]=_0x61d005;if(_0x254ea3[_0xcfb3('0x35')][_0xcfb3('0x43')]){_0x3748e7[_0xcfb3('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xcfb3('0x45')](_0x3748e7);})[_0xcfb3('0x29')](function(_0x40bfc7){_0x4825d6[_0xcfb3('0x46')]=_0x40bfc7;return _0x4825d6;})[_0xcfb3('0x29')](respondWithFilteredResult(_0xa35c4d,_0x3748e7))[_0xcfb3('0x47')](handleError(_0xa35c4d,null));};exports['show']=function(_0x2acbef,_0x363a76){var _0x170f07={'raw':!![],'where':{'id':_0x2acbef[_0xcfb3('0x48')]['id']}},_0x118d92={};_0x118d92[_0xcfb3('0x33')]=_['keys'](db['CmHopperHistory'][_0xcfb3('0x31')]);_0x118d92['query']=_[_0xcfb3('0x36')](_0x2acbef[_0xcfb3('0x35')]);_0x118d92[_0xcfb3('0x37')]=_[_0xcfb3('0x38')](_0x118d92[_0xcfb3('0x33')],_0x118d92[_0xcfb3('0x35')]);_0x170f07['attributes']=_[_0xcfb3('0x38')](_0x118d92[_0xcfb3('0x33')],qs['fields'](_0x2acbef[_0xcfb3('0x35')][_0xcfb3('0x3a')]));_0x170f07[_0xcfb3('0x39')]=_0x170f07[_0xcfb3('0x39')][_0xcfb3('0x49')]?_0x170f07[_0xcfb3('0x39')]:_0x118d92[_0xcfb3('0x33')];if(_0x2acbef[_0xcfb3('0x35')][_0xcfb3('0x43')]){_0x170f07[_0xcfb3('0x44')]=[{'all':!![]}];}_0x170f07=_['merge']({},_0x170f07,_0x2acbef[_0xcfb3('0x42')]);return db['CmHopperHistory'][_0xcfb3('0x4a')](_0x170f07)[_0xcfb3('0x29')](handleEntityNotFound(_0x363a76,null))['then'](respondWithResult(_0x363a76,null))[_0xcfb3('0x47')](handleError(_0x363a76,null));};exports['create']=function(_0x4e9007,_0x24dab6){return db[_0xcfb3('0x30')][_0xcfb3('0x4b')](_0x4e9007['body'],{})[_0xcfb3('0x29')](respondWithResult(_0x24dab6,0xc9))[_0xcfb3('0x47')](handleError(_0x24dab6,null));};exports[_0xcfb3('0x4c')]=function(_0xad31ca,_0x5e8d17){return db[_0xcfb3('0x30')][_0xcfb3('0x4c')]()[_0xcfb3('0x29')](respondWithResult(_0x5e8d17,null))[_0xcfb3('0x47')](handleError(_0x5e8d17,null));};exports['update']=function(_0x3f5f76,_0x6f31d7){if(_0x3f5f76['body'][_0xcfb3('0x4d')]){delete _0x3f5f76[_0xcfb3('0x4e')]['uniqueid'];}return db[_0xcfb3('0x30')][_0xcfb3('0x4a')]({'where':{'uniqueid':_0x3f5f76[_0xcfb3('0x48')]['id']}})['then'](handleEntityNotFound(_0x6f31d7,null))[_0xcfb3('0x29')](saveUpdates(_0x3f5f76[_0xcfb3('0x4e')],null))['then'](respondWithResult(_0x6f31d7,null))[_0xcfb3('0x47')](handleError(_0x6f31d7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index de143ab..c696e3c 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 _0xa848=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e1fd2,_0x5d2829){var _0x14a61f=function(_0x181d15){while(--_0x181d15){_0x3e1fd2['push'](_0x3e1fd2['shift']());}};_0x14a61f(++_0x5d2829);}(_0xa848,0x99));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var logger=require(_0x8a84('0x2'))('api');var moment=require(_0x8a84('0x3'));var BPromise=require(_0x8a84('0x4'));var rp=require(_0x8a84('0x5'));var fs=require('fs');var path=require(_0x8a84('0x6'));var rimraf=require(_0x8a84('0x7'));var config=require(_0x8a84('0x8'));var attributes=require(_0x8a84('0x9'));module[_0x8a84('0xa')]=function(_0x13acad,_0x3ee596){return _0x13acad[_0x8a84('0xb')](_0x8a84('0xc'),attributes,{'tableName':_0x8a84('0xd'),'paranoid':![],'indexes':[{'name':_0x8a84('0xe'),'fields':['endtime']},{'name':_0x8a84('0xf'),'fields':[_0x8a84('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c32=['./cmHopperHistory.attributes','exports','define','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1ccf87,_0x5e2467){var _0x2b97d5=function(_0x36c7f8){while(--_0x36c7f8){_0x1ccf87['push'](_0x1ccf87['shift']());}};_0x2b97d5(++_0x5e2467);}(_0x3c32,0x161));var _0x23c3=function(_0xda3235,_0x4164f1){_0xda3235=_0xda3235-0x0;var _0x38db4e=_0x3c32[_0xda3235];return _0x38db4e;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var logger=require(_0x23c3('0x2'))('api');var moment=require(_0x23c3('0x3'));var BPromise=require(_0x23c3('0x4'));var rp=require(_0x23c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x23c3('0x7'));module[_0x23c3('0x8')]=function(_0x1ec17b,_0x190132){return _0x1ec17b[_0x23c3('0x9')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x23c3('0xa')]},{'name':_0x23c3('0xb'),'fields':[_0x23c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c52e0f8..fbe6246 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 _0x8840=['`state`\x20=\x204,\x20`talktime`,\x20null','findAll','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','raw','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0xc7e695,_0x5290fa){var _0x3a4ff0=function(_0xa21d6e){while(--_0xa21d6e){_0xc7e695['push'](_0xc7e695['shift']());}};_0x3a4ff0(++_0x5290fa);}(_0x8840,0x1ac));var _0x0884=function(_0x3e8bf8,_0x4e76d6){_0x3e8bf8=_0x3e8bf8-0x0;var _0x3391ce=_0x8840[_0x3e8bf8];return _0x3391ce;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var moment=require(_0x0884('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0884('0x2'));var db=require(_0x0884('0x3'))['db'];var utils=require(_0x0884('0x4'));var logger=require(_0x0884('0x5'))(_0x0884('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0884('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f25ca,_0x9cbb26,_0x5aff5b){return new BPromise(function(_0x19f0d3,_0x26e915){return client[_0x0884('0x8')](_0x1f25ca,_0x5aff5b)[_0x0884('0x9')](function(_0x302342){logger[_0x0884('0xa')](_0x0884('0xb'),_0x9cbb26,_0x0884('0xc'));logger[_0x0884('0xd')](_0x0884('0xe'),_0x9cbb26,'request\x20sent',JSON[_0x0884('0xf')](_0x302342));if(_0x302342[_0x0884('0x10')]){if(_0x302342['error']['code']===0x1f4){logger['error'](_0x0884('0xb'),_0x9cbb26,_0x302342[_0x0884('0x10')][_0x0884('0x11')]);return _0x26e915(_0x302342[_0x0884('0x10')][_0x0884('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x9cbb26,_0x302342['error']['message']);return _0x19f0d3(_0x302342[_0x0884('0x10')]['message']);}else{logger['info'](_0x0884('0xb'),_0x9cbb26,_0x0884('0xc'));_0x19f0d3(_0x302342[_0x0884('0x12')]['message']);}})[_0x0884('0x13')](function(_0xf3c35){logger[_0x0884('0x10')](_0x0884('0xb'),_0x9cbb26,_0xf3c35);_0x26e915(_0xf3c35);});});}exports[_0x0884('0x14')]=function(_0x497cf9){var _0x21e7a0=this;return new Promise(function(_0x343df7,_0x45bed6){return db[_0x0884('0x15')][_0x0884('0x16')](_0x497cf9[_0x0884('0x17')],{'raw':_0x497cf9[_0x0884('0x18')]?_0x497cf9[_0x0884('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23949d){logger['info'](_0x0884('0x14'),_0x497cf9);logger[_0x0884('0xd')](_0x0884('0x14'),_0x497cf9,JSON[_0x0884('0xf')](_0x23949d));_0x343df7(_0x23949d);})[_0x0884('0x13')](function(_0x2556f4){logger[_0x0884('0x10')](_0x0884('0x14'),_0x2556f4['message'],_0x497cf9);_0x45bed6(_0x21e7a0[_0x0884('0x10')](0x1f4,_0x2556f4['message']));});});};exports[_0x0884('0x19')]=function(_0x3e4238){var _0x330124=this;return new Promise(function(_0x59d0dd,_0x479eb4){return db['CmHopperHistory']['findAll']({'raw':_0x3e4238[_0x0884('0x18')]?_0x3e4238[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e4238['options']?_0x3e4238[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')][_0x0884('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x20')))),_0x0884('0x21')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x22')))),_0x0884('0x23')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x24')))),_0x0884('0x25')],[db['sequelize']['fn'](_0x0884('0x26'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x27')))),_0x0884('0x28')],[db['sequelize']['fn'](_0x0884('0x26'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x0884('0x9')](function(_0x4d2dbf){logger['info']('AvgHandleTime',_0x3e4238);logger['debug'](_0x0884('0x19'),_0x3e4238,JSON[_0x0884('0xf')](_0x4d2dbf));_0x59d0dd(_0x4d2dbf);})[_0x0884('0x13')](function(_0x5736e0){logger[_0x0884('0x10')](_0x0884('0x19'),_0x5736e0[_0x0884('0x11')],_0x3e4238);_0x479eb4(_0x330124['error'](0x1f4,_0x5736e0[_0x0884('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3ba7a3){var _0x478256=this;return new Promise(function(_0x762228,_0x1bb243){return db['CmHopperHistory'][_0x0884('0x2a')]({'raw':_0x3ba7a3[_0x0884('0x18')]?_0x3ba7a3[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ba7a3[_0x0884('0x18')]?_0x3ba7a3[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[_0x0884('0x2b'),_0x0884('0x2c')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0x0884('0x2d')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x0884('0x2e')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x20')))),_0x0884('0x2f')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0x0884('0x30')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x31')))),_0x0884('0x32')],[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x33')))),_0x0884('0x34')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0884('0x35')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x36')))),_0x0884('0x37')],[db['sequelize']['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x38')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x39')))),_0x0884('0x3a')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x3b')))),_0x0884('0x3c')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x3d')))),_0x0884('0x3e')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0884('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x0884('0x2b')]})['then'](function(_0x4fb8ad){logger['info'](_0x0884('0x3f'),_0x3ba7a3);logger[_0x0884('0xd')]('GetVoiceQueueHopperHistory',_0x3ba7a3,JSON[_0x0884('0xf')](_0x4fb8ad));_0x762228(_0x4fb8ad);})[_0x0884('0x13')](function(_0x30982e){logger[_0x0884('0x10')](_0x0884('0x3f'),_0x30982e[_0x0884('0x11')],_0x3ba7a3);_0x1bb243(_0x478256[_0x0884('0x10')](0x1f4,_0x30982e[_0x0884('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x361824){var _0xc50f96=this;return new Promise(function(_0x3471d7,_0x530451){return db[_0x0884('0x15')]['findAll']({'raw':_0x361824[_0x0884('0x18')]?_0x361824[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x361824[_0x0884('0x18')]?_0x361824[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[_0x0884('0x2b'),_0x0884('0x2c')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')][_0x0884('0x1e')]('id')),_0x0884('0x40')],[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x20')))),_0x0884('0x41')]],'group':[_0x0884('0x2b')]})['then'](function(_0x449363){logger[_0x0884('0xa')]('GetCampaignHopperHistory',_0x361824);logger[_0x0884('0xd')](_0x0884('0x42'),_0x361824,JSON[_0x0884('0xf')](_0x449363));_0x3471d7(_0x449363);})[_0x0884('0x13')](function(_0x1ed143){logger[_0x0884('0x10')](_0x0884('0x42'),_0x1ed143[_0x0884('0x11')],_0x361824);_0x530451(_0xc50f96['error'](0x1f4,_0x1ed143[_0x0884('0x11')]));});});}; \ No newline at end of file +var _0xc964=['request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','body','options','raw','then','catch','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x149dcd,_0x2632f8){var _0x587c43=function(_0x2eb285){while(--_0x2eb285){_0x149dcd['push'](_0x149dcd['shift']());}};_0x587c43(++_0x2632f8);}(_0xc964,0x7e));var _0x4c96=function(_0x27c8b9,_0x5b6a96){_0x27c8b9=_0x27c8b9-0x0;var _0x27a0ee=_0xc964[_0x27c8b9];return _0x27a0ee;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rs=require(_0x4c96('0x3'));var fs=require('fs');var Redis=require(_0x4c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c96('0x5'));var logger=require('../../config/logger')(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var jayson=require(_0x4c96('0x8'));var client=jayson[_0x4c96('0x9')][_0x4c96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa8a0,_0x4070a5,_0x493618){return new BPromise(function(_0x19ed76,_0xaa3f20){return client[_0x4c96('0xb')](_0x1fa8a0,_0x493618)['then'](function(_0x208911){logger[_0x4c96('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x4070a5,'request\x20sent');logger['debug'](_0x4c96('0xd'),_0x4070a5,_0x4c96('0xe'),JSON[_0x4c96('0xf')](_0x208911));if(_0x208911['error']){if(_0x208911[_0x4c96('0x10')]['code']===0x1f4){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);return _0xaa3f20(_0x208911['error']['message']);}logger[_0x4c96('0x10')](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')]['message']);return _0x19ed76(_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0xc')](_0x4c96('0x11'),_0x4070a5,_0x4c96('0xe'));_0x19ed76(_0x208911[_0x4c96('0x13')][_0x4c96('0x12')]);}})['catch'](function(_0x388237){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x388237);_0xaa3f20(_0x388237);});});}exports['CreateCmHopperHistory']=function(_0x2453e0){var _0x494a26=this;return new Promise(function(_0x17891b,_0x1807b6){return db[_0x4c96('0x14')][_0x4c96('0x15')](_0x2453e0[_0x4c96('0x16')],{'raw':_0x2453e0[_0x4c96('0x17')]?_0x2453e0[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![]})[_0x4c96('0x19')](function(_0x9546c5){logger[_0x4c96('0xc')]('CreateCmHopperHistory',_0x2453e0);logger['debug']('CreateCmHopperHistory',_0x2453e0,JSON[_0x4c96('0xf')](_0x9546c5));_0x17891b(_0x9546c5);})[_0x4c96('0x1a')](function(_0x29f3a3){logger[_0x4c96('0x10')](_0x4c96('0x1b'),_0x29f3a3[_0x4c96('0x12')],_0x2453e0);_0x1807b6(_0x494a26['error'](0x1f4,_0x29f3a3[_0x4c96('0x12')]));});});};exports[_0x4c96('0x1c')]=function(_0x2cabae){var _0x31a854=this;return new Promise(function(_0x2f6f93,_0x23fbfa){return db['CmHopperHistory'][_0x4c96('0x1d')]({'raw':_0x2cabae[_0x4c96('0x17')]?_0x2cabae['options'][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0x2cabae['options']?_0x2cabae[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db['sequelize'][_0x4c96('0x21')]('id')),_0x4c96('0x22')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x23')))),_0x4c96('0x24')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x4c96('0x25')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4c96('0x1f')]['fn']('AVG',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x28')))),_0x4c96('0x29')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x2a'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x2b')))),_0x4c96('0x2c')]]})[_0x4c96('0x19')](function(_0xa1e751){logger[_0x4c96('0xc')]('AvgHandleTime',_0x2cabae);logger[_0x4c96('0x2d')](_0x4c96('0x1c'),_0x2cabae,JSON[_0x4c96('0xf')](_0xa1e751));_0x2f6f93(_0xa1e751);})['catch'](function(_0x299939){logger['error'](_0x4c96('0x1c'),_0x299939['message'],_0x2cabae);_0x23fbfa(_0x31a854[_0x4c96('0x10')](0x1f4,_0x299939[_0x4c96('0x12')]));});});};exports[_0x4c96('0x2e')]=function(_0x47c1ce){var _0x5d0f4e=this;return new Promise(function(_0x367230,_0x3cb0af){return db['CmHopperHistory'][_0x4c96('0x1d')]({'raw':_0x47c1ce[_0x4c96('0x17')]?_0x47c1ce[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0x47c1ce['options']?_0x47c1ce[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[[_0x4c96('0x2f'),_0x4c96('0x30')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x31')))),_0x4c96('0x32')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')]('`state`\x20=\x203,\x201,\x20null'))),_0x4c96('0x33')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x23')))),_0x4c96('0x34')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db['sequelize']['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x35')))),_0x4c96('0x36')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x37')))),'outboundCongestionCallsDay'],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4c96('0x38')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4c96('0x39')],[db['sequelize']['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x3a')))),_0x4c96('0x3b')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x3c')))),_0x4c96('0x3d')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db['sequelize'][_0x4c96('0x27')](_0x4c96('0x3e')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal'](_0x4c96('0x3f')))),_0x4c96('0x40')],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x41')))),_0x4c96('0x40')],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0x4c96('0x19')](function(_0x454b63){logger['info'](_0x4c96('0x2e'),_0x47c1ce);logger[_0x4c96('0x2d')](_0x4c96('0x2e'),_0x47c1ce,JSON[_0x4c96('0xf')](_0x454b63));_0x367230(_0x454b63);})[_0x4c96('0x1a')](function(_0x37d112){logger['error'](_0x4c96('0x2e'),_0x37d112['message'],_0x47c1ce);_0x3cb0af(_0x5d0f4e[_0x4c96('0x10')](0x1f4,_0x37d112[_0x4c96('0x12')]));});});};exports[_0x4c96('0x43')]=function(_0xb4e36d){var _0x3b0992=this;return new Promise(function(_0xd3b2c9,_0x5eac72){return db[_0x4c96('0x14')][_0x4c96('0x1d')]({'raw':_0xb4e36d[_0x4c96('0x17')]?_0xb4e36d['options'][_0x4c96('0x18')]===undefined?!![]:![]:!![],'where':_0xb4e36d['options']?_0xb4e36d[_0x4c96('0x17')][_0x4c96('0x1e')]||null:null,'attributes':[['campaign','name'],[db[_0x4c96('0x1f')]['fn'](_0x4c96('0x20'),db[_0x4c96('0x1f')][_0x4c96('0x21')]('id')),_0x4c96('0x44')],[db[_0x4c96('0x1f')]['fn']('COUNT',db[_0x4c96('0x1f')]['fn']('IF',db[_0x4c96('0x1f')][_0x4c96('0x27')](_0x4c96('0x23')))),_0x4c96('0x45')]],'group':['campaign']})[_0x4c96('0x19')](function(_0x22dda3){logger[_0x4c96('0xc')](_0x4c96('0x43'),_0xb4e36d);logger['debug'](_0x4c96('0x43'),_0xb4e36d,JSON[_0x4c96('0xf')](_0x22dda3));_0xd3b2c9(_0x22dda3);})[_0x4c96('0x1a')](function(_0x388a9b){logger['error']('GetCampaignHopperHistory',_0x388a9b[_0x4c96('0x12')],_0xb4e36d);_0x5eac72(_0x3b0992['error'](0x1f4,_0x388a9b[_0x4c96('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d8829f4..0c37ded 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 _0x3510=['index','/describe','/:id','show','post','create','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x44c7a2,_0x449be7){var _0x3efc90=function(_0x114726){while(--_0x114726){_0x44c7a2['push'](_0x44c7a2['shift']());}};_0x3efc90(++_0x449be7);}(_0x3510,0x15d));var _0x0351=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3510[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x0351('0x0'));var util=require(_0x0351('0x1'));var path=require(_0x0351('0x2'));var timeout=require(_0x0351('0x3'));var express=require(_0x0351('0x4'));var router=express[_0x0351('0x5')]();var fs_extra=require(_0x0351('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0351('0x7'));var config=require(_0x0351('0x8'));var controller=require(_0x0351('0x9'));router[_0x0351('0xa')]('/',auth[_0x0351('0xb')](),controller[_0x0351('0xc')]);router[_0x0351('0xa')](_0x0351('0xd'),auth[_0x0351('0xb')](),controller['describe']);router[_0x0351('0xa')](_0x0351('0xe'),auth[_0x0351('0xb')](),controller[_0x0351('0xf')]);router[_0x0351('0x10')]('/',auth[_0x0351('0xb')](),controller[_0x0351('0x11')]);router[_0x0351('0x12')](_0x0351('0xe'),auth[_0x0351('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xbce0=['show','post','create','put','/:id','update','exports','multer','util','express','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','describe'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xbce0,0x17e));var _0x0bce=function(_0x57918a,_0x2f8b38){_0x57918a=_0x57918a-0x0;var _0x3ca918=_0xbce0[_0x57918a];return _0x3ca918;};'use strict';var multer=require(_0x0bce('0x0'));var util=require(_0x0bce('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0bce('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0bce('0x3'));var config=require('../../config/environment');var controller=require(_0x0bce('0x4'));router['get']('/',auth[_0x0bce('0x5')](),controller[_0x0bce('0x6')]);router['get']('/describe',auth[_0x0bce('0x5')](),controller[_0x0bce('0x7')]);router['get']('/:id',auth[_0x0bce('0x5')](),controller[_0x0bce('0x8')]);router[_0x0bce('0x9')]('/',auth['isAuthenticated'](),controller[_0x0bce('0xa')]);router[_0x0bce('0xb')](_0x0bce('0xc'),auth[_0x0bce('0x5')](),controller[_0x0bce('0xd')]);module[_0x0bce('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index fbf35ec..f959462 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 _0x1159=['sequelize','name','STRING'];(function(_0x547a3d,_0x4d0e1e){var _0x49643a=function(_0x4314f5){while(--_0x4314f5){_0x547a3d['push'](_0x547a3d['shift']());}};_0x49643a(++_0x4d0e1e);}(_0x1159,0xf3));var _0x9115=function(_0x12095a,_0x6c18bb){_0x12095a=_0x12095a-0x0;var _0x52bf3a=_0x1159[_0x12095a];return _0x52bf3a;};'use strict';var Sequelize=require(_0x9115('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9115('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9115('0x2')]},'dialPrefix':{'type':Sequelize[_0x9115('0x2')]}}; \ No newline at end of file +var _0xbe48=['name','sequelize','exports','STRING'];(function(_0x165896,_0x4b58be){var _0x5f2a32=function(_0x57d0ab){while(--_0x57d0ab){_0x165896['push'](_0x165896['shift']());}};_0x5f2a32(++_0x4b58be);}(_0xbe48,0x121));var _0x8be4=function(_0x4100e6,_0x52a864){_0x4100e6=_0x4100e6-0x0;var _0x4cfefb=_0xbe48[_0x4100e6];return _0x4cfefb;};'use strict';var Sequelize=require(_0x8be4('0x0'));module[_0x8be4('0x1')]={'name':{'type':Sequelize[_0x8be4('0x2')],'unique':_0x8be4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8be4('0x2')]},'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 d19b559..d2a70c4 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 _0x60c4=['customField_','from','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','format','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','TEXT','text','number','Sequelize','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','findAll','rows','catch','show','CmList','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','addDisposition','Disposition','getDispositions','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_'];(function(_0x54bada,_0xa5047d){var _0x16fffe=function(_0x1280b4){while(--_0x1280b4){_0x54bada['push'](_0x54bada['shift']());}};_0x16fffe(++_0xa5047d);}(_0x60c4,0x175));var _0x460c=function(_0x4c34a3,_0x15327b){_0x4c34a3=_0x4c34a3-0x0;var _0x3800ae=_0x60c4[_0x4c34a3];return _0x3800ae;};'use strict';var emlformat=require(_0x460c('0x0'));var rimraf=require(_0x460c('0x1'));var zipdir=require(_0x460c('0x2'));var jsonpatch=require(_0x460c('0x3'));var rp=require('request-promise');var moment=require(_0x460c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x460c('0x5'));var util=require(_0x460c('0x6'));var path=require(_0x460c('0x7'));var sox=require(_0x460c('0x8'));var csv=require(_0x460c('0x9'));var ejs=require(_0x460c('0xa'));var fs=require('fs');var fs_extra=require(_0x460c('0xb'));var _=require(_0x460c('0xc'));var squel=require(_0x460c('0xd'));var crypto=require(_0x460c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x460c('0xf'));var toCsv=require(_0x460c('0x9'));var querystring=require(_0x460c('0x10'));var Papa=require(_0x460c('0x11'));var Redis=require('ioredis');var authService=require(_0x460c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x460c('0x13'));var logger=require('../../config/logger')(_0x460c('0x14'));var utils=require(_0x460c('0x15'));var config=require(_0x460c('0x16'));var licenseUtil=require(_0x460c('0x17'));var db=require(_0x460c('0x18'))['db'];var csv_results;config[_0x460c('0x19')]=_[_0x460c('0x1a')](config[_0x460c('0x19')],{'host':_0x460c('0x1b'),'port':0x18eb});var socket=require(_0x460c('0x1c'))(new Redis(config[_0x460c('0x19')]));require(_0x460c('0x1d'))['register'](socket);function respondWithStatusCode(_0x4326a8,_0x199e6e){_0x199e6e=_0x199e6e||0xcc;return function(_0x145af4){if(_0x145af4){return _0x4326a8[_0x460c('0x1e')](_0x199e6e);}return _0x4326a8[_0x460c('0x1f')](_0x199e6e)['end']();};}function respondWithResult(_0x1710e9,_0x3d3719){_0x3d3719=_0x3d3719||0xc8;return function(_0x12ef37){if(_0x12ef37){return _0x1710e9['status'](_0x3d3719)[_0x460c('0x20')](_0x12ef37);}};}function respondWithFilteredResult(_0x16be16,_0xb80738){return function(_0x54d122){if(_0x54d122){var _0x3ae99f=typeof _0xb80738[_0x460c('0x21')]===_0x460c('0x22')&&typeof _0xb80738[_0x460c('0x23')]===_0x460c('0x22');var _0x1d1e94=_0x54d122['count'];var _0x2535fa=_0x3ae99f?0x0:_0xb80738[_0x460c('0x21')];var _0x176739=_0x3ae99f?_0x54d122['count']:_0xb80738['offset']+_0xb80738['limit'];var _0xd18356;if(_0x176739>=_0x1d1e94){_0x176739=_0x1d1e94;_0xd18356=0xc8;}else{_0xd18356=0xce;}_0x16be16[_0x460c('0x1f')](_0xd18356);return _0x16be16[_0x460c('0x24')](_0x460c('0x25'),_0x2535fa+'-'+_0x176739+'/'+_0x1d1e94)['json'](_0x54d122);}return null;};}function patchUpdates(_0x541882){return function(_0x351c3a){try{jsonpatch[_0x460c('0x26')](_0x351c3a,_0x541882,!![]);}catch(_0x1e6023){return BPromise[_0x460c('0x27')](_0x1e6023);}return _0x351c3a[_0x460c('0x28')]();};}function saveUpdates(_0x4ce088,_0x49d16e){return function(_0x285de4){if(_0x285de4){return _0x285de4[_0x460c('0x29')](_0x4ce088)[_0x460c('0x2a')](function(_0x3d5d1a){return _0x3d5d1a;});}return null;};}function removeEntity(_0x289399,_0x550e18){return function(_0x226003){if(_0x226003){return _0x226003[_0x460c('0x2b')]()[_0x460c('0x2a')](function(){var _0x4b36c2=_0x226003['get']({'plain':!![]});var _0x43782f='Lists';return db[_0x460c('0x2c')]['destroy']({'where':{'type':_0x43782f,'resourceId':_0x4b36c2['id']}})[_0x460c('0x2a')](function(){return _0x226003;});})['then'](function(){_0x289399[_0x460c('0x1f')](0xcc)[_0x460c('0x2d')]();});}};}function handleEntityNotFound(_0x59da55,_0x4fb4db){return function(_0x132223){if(!_0x132223){_0x59da55[_0x460c('0x1e')](0x194);}return _0x132223;};}function handleError(_0x4e10a9,_0x339f92){_0x339f92=_0x339f92||0x1f4;return function(_0x358476){logger[_0x460c('0x2e')](_0x358476['stack']);if(_0x358476[_0x460c('0x2f')]){delete _0x358476['name'];}_0x4e10a9['status'](_0x339f92)[_0x460c('0x30')](_0x358476);};}exports[_0x460c('0x31')]=function(_0x4c1c26,_0x306c7a){var _0x43f4b8={},_0x4118f5={},_0x510987={'count':0x0,'rows':[]};var _0x542773=_[_0x460c('0x32')](db['CmList'][_0x460c('0x33')],function(_0x163146){return{'name':_0x163146[_0x460c('0x34')],'type':_0x163146[_0x460c('0x35')]['key']};});_0x4118f5['model']=_['map'](_0x542773,_0x460c('0x2f'));_0x4118f5[_0x460c('0x36')]=_[_0x460c('0x37')](_0x4c1c26[_0x460c('0x36')]);_0x4118f5['filters']=_['intersection'](_0x4118f5[_0x460c('0x38')],_0x4118f5['query']);_0x43f4b8[_0x460c('0x39')]=_[_0x460c('0x3a')](_0x4118f5['model'],qs[_0x460c('0x3b')](_0x4c1c26[_0x460c('0x36')][_0x460c('0x3b')]));_0x43f4b8['attributes']=_0x43f4b8[_0x460c('0x39')][_0x460c('0x3c')]?_0x43f4b8[_0x460c('0x39')]:_0x4118f5['model'];if(!_0x4c1c26['query'][_0x460c('0x3d')](_0x460c('0x3e'))){_0x43f4b8[_0x460c('0x23')]=qs[_0x460c('0x23')](_0x4c1c26[_0x460c('0x36')][_0x460c('0x23')]);_0x43f4b8['offset']=qs[_0x460c('0x21')](_0x4c1c26['query'][_0x460c('0x21')]);}_0x43f4b8[_0x460c('0x3f')]=qs[_0x460c('0x40')](_0x4c1c26[_0x460c('0x36')][_0x460c('0x40')]);_0x43f4b8[_0x460c('0x41')]=qs[_0x460c('0x42')](_[_0x460c('0x43')](_0x4c1c26[_0x460c('0x36')],_0x4118f5[_0x460c('0x42')]),_0x542773);if(_0x4c1c26[_0x460c('0x36')][_0x460c('0x44')]){_0x43f4b8[_0x460c('0x41')]=_[_0x460c('0x45')](_0x43f4b8[_0x460c('0x41')],{'$or':_[_0x460c('0x32')](_0x542773,function(_0x1ae1d9){if(_0x1ae1d9[_0x460c('0x35')]!=='VIRTUAL'){var _0x31d840={};_0x31d840[_0x1ae1d9[_0x460c('0x2f')]]={'$like':'%'+_0x4c1c26[_0x460c('0x36')][_0x460c('0x44')]+'%'};return _0x31d840;}})});}_0x43f4b8=_[_0x460c('0x45')]({},_0x43f4b8,_0x4c1c26[_0x460c('0x46')]);var _0x34ea08={'where':_0x43f4b8[_0x460c('0x41')]};return db['CmList'][_0x460c('0x47')](_0x34ea08)['then'](function(_0xed0bdd){_0x510987[_0x460c('0x47')]=_0xed0bdd;if(_0x4c1c26[_0x460c('0x36')]['includeAll']){_0x43f4b8[_0x460c('0x48')]=[{'all':!![]}];}return db['CmList'][_0x460c('0x49')](_0x43f4b8);})[_0x460c('0x2a')](function(_0x27f288){_0x510987[_0x460c('0x4a')]=_0x27f288;return _0x510987;})[_0x460c('0x2a')](respondWithFilteredResult(_0x306c7a,_0x43f4b8))[_0x460c('0x4b')](handleError(_0x306c7a,null));};exports[_0x460c('0x4c')]=function(_0x12b06a,_0x29fa6a){var _0x5bf1bf={'raw':![],'where':{'id':_0x12b06a['params']['id']}},_0x36637d={};_0x36637d[_0x460c('0x38')]=_[_0x460c('0x37')](db[_0x460c('0x4d')][_0x460c('0x33')]);_0x36637d['query']=_[_0x460c('0x37')](_0x12b06a[_0x460c('0x36')]);_0x36637d[_0x460c('0x42')]=_['intersection'](_0x36637d[_0x460c('0x38')],_0x36637d['query']);_0x5bf1bf['attributes']=_[_0x460c('0x3a')](_0x36637d[_0x460c('0x38')],qs[_0x460c('0x3b')](_0x12b06a[_0x460c('0x36')]['fields']));_0x5bf1bf['attributes']=_0x5bf1bf[_0x460c('0x39')]['length']?_0x5bf1bf['attributes']:_0x36637d[_0x460c('0x38')];if(_0x12b06a['query'][_0x460c('0x4e')]){_0x5bf1bf[_0x460c('0x48')]=[{'all':!![]}];}_0x5bf1bf=_[_0x460c('0x45')]({},_0x5bf1bf,_0x12b06a[_0x460c('0x46')]);return db[_0x460c('0x4d')]['find'](_0x5bf1bf)[_0x460c('0x2a')](handleEntityNotFound(_0x29fa6a,null))['then'](respondWithResult(_0x29fa6a,null))[_0x460c('0x4b')](handleError(_0x29fa6a,null));};exports[_0x460c('0x4f')]=function(_0x8e36ae,_0x3bd099){return db['CmList'][_0x460c('0x4f')](_0x8e36ae['body'],{})['then'](function(_0x2be977){var _0x3582be=_0x8e36ae[_0x460c('0x50')][_0x460c('0x51')]({'plain':!![]});if(!_0x3582be)throw new Error(_0x460c('0x52'));if(_0x3582be[_0x460c('0x53')]===_0x460c('0x50')){var _0x5d261e=_0x2be977[_0x460c('0x51')]({'plain':!![]});var _0x23a094=_0x460c('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x23a094,'userProfileId':_0x3582be[_0x460c('0x55')]},'raw':!![]})[_0x460c('0x2a')](function(_0x3699d7){if(_0x3699d7&&_0x3699d7['autoAssociation']===0x0){return db[_0x460c('0x2c')][_0x460c('0x4f')]({'name':_0x5d261e['name'],'resourceId':_0x5d261e['id'],'type':_0x3699d7[_0x460c('0x2f')],'sectionId':_0x3699d7['id']},{})[_0x460c('0x2a')](function(){return _0x2be977;});}else{return _0x2be977;}})[_0x460c('0x4b')](function(_0x19d578){logger[_0x460c('0x2e')](_0x460c('0x56'),_0x19d578);throw _0x19d578;});}return _0x2be977;})['then'](respondWithResult(_0x3bd099,0xc9))['catch'](handleError(_0x3bd099,null));};exports['update']=function(_0x14c056,_0xaf312f){if(_0x14c056['body']['id']){delete _0x14c056[_0x460c('0x57')]['id'];}return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x14c056[_0x460c('0x59')]['id']}})['then'](handleEntityNotFound(_0xaf312f,null))[_0x460c('0x2a')](saveUpdates(_0x14c056['body'],null))['then'](respondWithResult(_0xaf312f,null))['catch'](handleError(_0xaf312f,null));};exports[_0x460c('0x2b')]=function(_0x34f741,_0x4ca076){return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x34f741['params']['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0x4ca076,null))[_0x460c('0x2a')](removeEntity(_0x4ca076,null))[_0x460c('0x4b')](handleError(_0x4ca076,null));};exports['describe']=function(_0xca92b4,_0x285bbe){return db['CmList'][_0x460c('0x5a')]()[_0x460c('0x2a')](respondWithResult(_0x285bbe,null))[_0x460c('0x4b')](handleError(_0x285bbe,null));};exports[_0x460c('0x5b')]=function(_0x49859c,_0xc2f9ca,_0x401704){if(_0x49859c[_0x460c('0x57')]['id']){delete _0x49859c['body']['id'];}return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x49859c[_0x460c('0x59')]['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0xc2f9ca,null))[_0x460c('0x2a')](function(_0x339d5c){if(_0x339d5c){_0x49859c[_0x460c('0x57')]['ListId']=_0x339d5c['id'];return db[_0x460c('0x5c')]['create'](_0x49859c[_0x460c('0x57')]);}})['then'](respondWithResult(_0xc2f9ca,null))[_0x460c('0x4b')](handleError(_0xc2f9ca,null));};exports[_0x460c('0x5d')]=function(_0x151a85,_0x631a74,_0x30c67b){var _0x15606e={'raw':![],'where':{}};var _0x7a4dee={};var _0x189d43={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x151a85[_0x460c('0x59')]['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0x631a74,null))['then'](function(_0x596127){if(_0x596127){_0x7a4dee[_0x460c('0x38')]=_[_0x460c('0x37')](db[_0x460c('0x5c')][_0x460c('0x33')]);_0x7a4dee['query']=_[_0x460c('0x37')](_0x151a85['query']);_0x7a4dee[_0x460c('0x42')]=_['intersection'](_0x7a4dee['model'],_0x7a4dee[_0x460c('0x36')]);_0x15606e[_0x460c('0x39')]=_[_0x460c('0x3a')](_0x7a4dee[_0x460c('0x38')],qs[_0x460c('0x3b')](_0x151a85[_0x460c('0x36')][_0x460c('0x3b')]));_0x15606e[_0x460c('0x39')]=_0x15606e['attributes'][_0x460c('0x3c')]?_0x15606e[_0x460c('0x39')]:_0x7a4dee['model'];if(!_0x151a85['query'][_0x460c('0x3d')]('nolimit')){_0x15606e[_0x460c('0x23')]=qs[_0x460c('0x23')](_0x151a85[_0x460c('0x36')][_0x460c('0x23')]);_0x15606e[_0x460c('0x21')]=qs[_0x460c('0x21')](_0x151a85['query'][_0x460c('0x21')]);}_0x15606e[_0x460c('0x3f')]=qs['sort'](_0x151a85['query']['sort']);_0x15606e['where']=qs[_0x460c('0x42')](_[_0x460c('0x43')](_0x151a85['query'],_0x7a4dee['filters']));_0x15606e[_0x460c('0x41')][_0x460c('0x5e')]=_0x596127['id'];if(_0x151a85['query']['filter']){_0x15606e[_0x460c('0x41')]=_[_0x460c('0x45')](_0x15606e[_0x460c('0x41')],{'$or':_[_0x460c('0x32')](_0x15606e['attributes'],function(_0x122a0a){var _0x591103={};_0x591103[_0x122a0a]={'$like':'%'+_0x151a85[_0x460c('0x36')][_0x460c('0x44')]+'%'};return _0x591103;})});}_0x15606e=_[_0x460c('0x45')]({},_0x15606e,_0x151a85['options']);return db[_0x460c('0x5c')]['count']({'where':_0x15606e[_0x460c('0x41')]})[_0x460c('0x2a')](function(_0x28a65f){_0x189d43[_0x460c('0x47')]=_0x28a65f;if(_0x151a85[_0x460c('0x36')][_0x460c('0x4e')]){_0x15606e[_0x460c('0x48')]=[{'all':!![]}];}return db[_0x460c('0x5c')][_0x460c('0x49')](_0x15606e);})[_0x460c('0x2a')](function(_0x1fb114){_0x189d43[_0x460c('0x4a')]=_0x1fb114;return _0x189d43;});}})['then'](respondWithFilteredResult(_0x631a74,_0x15606e))[_0x460c('0x4b')](handleError(_0x631a74,null));};exports[_0x460c('0x5f')]=function(_0x20027a,_0x171637,_0x572c27){return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x20027a['params']['id']}})['then'](handleEntityNotFound(_0x171637,null))[_0x460c('0x2a')](function(_0x1e2ca0){if(_0x1e2ca0){return _0x1e2ca0['removeDispositions'](_0x20027a[_0x460c('0x36')][_0x460c('0x60')]);}})['then'](respondWithStatusCode(_0x171637,null))['catch'](handleError(_0x171637,null));};exports[_0x460c('0x61')]=function(_0x5a7d33,_0x1cc4f4,_0x220ee7){return db[_0x460c('0x4d')]['find']({'where':{'id':_0x5a7d33[_0x460c('0x59')]['id']}})['then'](handleEntityNotFound(_0x1cc4f4,null))[_0x460c('0x2a')](function(_0x71373){if(_0x71373){var _0x4b3a20=[];var _0x2e6f32={'success':[],'errors':[]};return db[_0x460c('0x62')][_0x460c('0x5a')]()['then'](function(_0x31ad8d){if(_0x5a7d33[_0x460c('0x57')][_0x460c('0x63')]&&_[_0x460c('0x64')](_0x5a7d33['body'][_0x460c('0x63')])){if(_0x5a7d33[_0x460c('0x57')]['tags'][_0x460c('0x3c')]){_0x5a7d33[_0x460c('0x57')]['tags']=_0x5a7d33['body'][_0x460c('0x63')][_0x460c('0x65')](';')+';';}else{_0x5a7d33['body'][_0x460c('0x63')]=null;}}else{_0x5a7d33[_0x460c('0x57')][_0x460c('0x63')]=null;}if(_0x5a7d33['body']&&_[_0x460c('0x64')](_0x5a7d33[_0x460c('0x57')])){for(var _0x2591de=0x0;_0x2591de<_0x5a7d33[_0x460c('0x57')][_0x460c('0x3c')];_0x2591de+=0x1){_0x5a7d33[_0x460c('0x57')][_0x2591de][_0x460c('0x5e')]=_0x5a7d33[_0x460c('0x59')]['id'];_0x4b3a20[_0x460c('0x66')](_0x5a7d33[_0x460c('0x57')][_0x2591de]);}return BPromise['each'](_0x4b3a20,function(_0x2bde0d){return db[_0x460c('0x62')][_0x460c('0x4f')](_[_0x460c('0x67')](_0x2bde0d,[_0x460c('0x60'),'id'])||{},{'fields':_[_0x460c('0x37')](_0x31ad8d),'raw':!![]})[_0x460c('0x2a')](function(_0xe135b6){_0x2e6f32[_0x460c('0x68')]['push'](_0xe135b6[_0x460c('0x69')]);})['catch'](function(_0x49b4ed){_0x2e6f32['errors'][_0x460c('0x66')]({'data':_0x2bde0d,'error':_0x49b4ed[_0x460c('0x6a')]});});})[_0x460c('0x2a')](function(_0x125894){return _0x2e6f32;})['catch'](function(_0x5be6c7){return _0x5be6c7;});}else{_0x1cc4f4[_0x460c('0x1f')](0x190)[_0x460c('0x20')]({'message':_0x460c('0x6b')});}});}})[_0x460c('0x2a')](respondWithResult(_0x1cc4f4,null))[_0x460c('0x4b')](handleError(_0x1cc4f4,null));};exports[_0x460c('0x6c')]=function(_0x128e8f,_0x149db4,_0x5a0ea1){var _0x1c23dc;return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x128e8f[_0x460c('0x59')]['id']},'include':[{'model':db[_0x460c('0x6d')],'as':_0x460c('0x6e')}]})['then'](handleEntityNotFound(_0x149db4,null))[_0x460c('0x2a')](function(_0x41a71e){if(_0x41a71e){_0x1c23dc=_0x41a71e;return db[_0x460c('0x62')][_0x460c('0x33')];}})[_0x460c('0x2a')](function(_0x867bea){if(_0x867bea){var _0x1068b1={};var _0x28e21e={};_0x28e21e[_0x460c('0x38')]=_[_0x460c('0x6f')](_['keys'](_0x867bea),_['map'](_0x1c23dc[_0x460c('0x6e')],function(_0x514c80){return util['format'](_0x460c('0x70'),_0x514c80['id']);}));_0x28e21e['query']=_[_0x460c('0x37')](_0x128e8f[_0x460c('0x36')]);_0x28e21e[_0x460c('0x42')]=_[_0x460c('0x3a')](_0x28e21e['model'],_0x28e21e[_0x460c('0x36')]);_0x1068b1[_0x460c('0x39')]=_[_0x460c('0x3a')](_0x28e21e[_0x460c('0x38')],qs[_0x460c('0x3b')](_0x128e8f[_0x460c('0x36')][_0x460c('0x3b')]));_0x1068b1[_0x460c('0x39')]=_0x1068b1[_0x460c('0x39')][_0x460c('0x3c')]?_0x1068b1[_0x460c('0x39')]:_0x28e21e['model'];if(!_0x128e8f[_0x460c('0x36')]['hasOwnProperty'](_0x460c('0x3e'))){_0x1068b1[_0x460c('0x23')]=qs[_0x460c('0x23')](_0x128e8f[_0x460c('0x36')][_0x460c('0x23')]);_0x1068b1[_0x460c('0x21')]=qs[_0x460c('0x21')](_0x128e8f[_0x460c('0x36')][_0x460c('0x21')]);}_0x1068b1[_0x460c('0x3f')]=qs[_0x460c('0x40')](_0x128e8f[_0x460c('0x36')][_0x460c('0x40')]);_0x1068b1['where']=qs[_0x460c('0x42')](_[_0x460c('0x43')](_0x128e8f['query'],_0x28e21e[_0x460c('0x42')]));_0x1068b1[_0x460c('0x71')]=!![];if(_0x128e8f[_0x460c('0x36')]['filter']){_0x1068b1[_0x460c('0x41')]=_[_0x460c('0x45')](_0x1068b1[_0x460c('0x41')],{'$or':_[_0x460c('0x32')](_0x1068b1['attributes'],function(_0x257fa9){var _0x41f9fb={};_0x41f9fb[_0x257fa9]={'$like':'%'+_0x128e8f[_0x460c('0x36')][_0x460c('0x44')]+'%'};return _0x41f9fb;})});}_0x1068b1=_[_0x460c('0x45')]({},_0x1068b1,_0x128e8f[_0x460c('0x46')]);return _0x1c23dc['getContacts'](_0x1068b1);}})[_0x460c('0x2a')](respondWithResult(_0x149db4,null))[_0x460c('0x4b')](handleError(_0x149db4,null));};exports[_0x460c('0x72')]=function(_0x1b51f7,_0x5aedb8,_0x427b7c){var _0x5aa8db;var _0x29c101;var _0x3d8eeb;var _0x1ea4ef=_0x1b51f7[_0x460c('0x59')]['id'];csv_results=[];return db[_0x460c('0x73')][_0x460c('0x49')]({'attributes':['id',_0x460c('0x2f')],'raw':!![],'order':[_0x460c('0x74')]})[_0x460c('0x2a')](function(_0x23d6b7){_0x5aa8db=_0x23d6b7;var _0x3ac30c=_[_0x460c('0x37')](db['CmContact']['rawAttributes']);return db['CmCustomField'][_0x460c('0x49')]({'raw':!![],'attributes':['id',_0x460c('0x75')]})[_0x460c('0x2a')](function(_0x35cd77){_0x29c101=_0x35cd77;var _0x1e574a=squel[_0x460c('0x76')]()[_0x460c('0x3b')](_0x3ac30c)['from'](_0x460c('0x77'),'c')[_0x460c('0x41')](_0x460c('0x78'),_0x1ea4ef)[_0x460c('0x41')](_0x460c('0x79'))[_0x460c('0x7a')]();for(var _0x2ba038=0x0;_0x2ba038<_0x29c101[_0x460c('0x3c')];_0x2ba038++){_0x1e574a[_0x460c('0x7b')](_0x460c('0x7c')+_0x29c101[_0x2ba038]['id'],_0x460c('0x7d')+_0x29c101[_0x2ba038]['alias']);}for(var _0x2ba038=0x0;_0x2ba038<_0x5aa8db[_0x460c('0x3c')];_0x2ba038++){_0x1e574a['field'](squel[_0x460c('0x76')]()[_0x460c('0x7b')]('item')[_0x460c('0x7e')](_0x460c('0x7f'))['where'](_0x460c('0x80'),_0x5aa8db[_0x2ba038]['id'])[_0x460c('0x41')]('CmContactId\x20=\x20c.id'),_0x460c('0x81')+_0x5aa8db[_0x2ba038][_0x460c('0x2f')]);_0x1e574a[_0x460c('0x7b')](squel[_0x460c('0x76')]()[_0x460c('0x7b')](_0x460c('0x82'))[_0x460c('0x7e')]('cm_contact_has_items')['where'](_0x460c('0x80'),_0x5aa8db[_0x2ba038]['id'])[_0x460c('0x41')]('CmContactId\x20=\x20c.id'),_0x460c('0x83')+_0x5aa8db[_0x2ba038][_0x460c('0x2f')]);}var _0x14b7c5=[];_0x14b7c5['push'](_0x1e574a['toString']());BPromise['each'](_0x14b7c5,handleQuery)[_0x460c('0x2a')](function(_0x4909d7){handleQuery(_0x1e574a[_0x460c('0x84')]());var _0x526dc4=csv_results[0x0];if(!_[_0x460c('0x85')](_0x526dc4)){var _0x4f37b9=toCsv(_0x526dc4);var _0x3bb9ba=Date['now']();fs[_0x460c('0x86')](util['format'](_0x460c('0x87'),_0x1ea4ef,_0x3bb9ba),_0x4f37b9);_0x5aedb8[_0x460c('0x88')](_0x460c('0x89'),'attachment;\x20filename='+util[_0x460c('0x8a')]('list_%d_%s.csv',_0x1ea4ef,_0x3bb9ba));_0x5aedb8[_0x460c('0x88')](_0x460c('0x8b'),_0x460c('0x8c'));return _0x5aedb8[_0x460c('0x8d')](util[_0x460c('0x8a')](_0x460c('0x87'),_0x1ea4ef,_0x3bb9ba));}else{return _0x5aedb8[_0x460c('0x1e')](0xcc);}});});});};exports[_0x460c('0x8e')]=function(_0x7db85a,_0xbbd489,_0x5d7d04){var _0x574420;delete _0x7db85a[_0x460c('0x57')]['id'];return db[_0x460c('0x4d')][_0x460c('0x8f')]({'where':{'id':_0x7db85a[_0x460c('0x59')]['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0xbbd489,null))[_0x460c('0x2a')](function(_0x14da67){if(_0x14da67){return db[_0x460c('0x90')][_0x460c('0x91')](function(_0x1be72b){return db[_0x460c('0x6d')][_0x460c('0x4f')](_0x7db85a[_0x460c('0x57')],{'transaction':_0x1be72b})[_0x460c('0x2a')](function(_0x261209){_0x574420=_0x261209;return _0x14da67[_0x460c('0x92')](_0x261209,{'transaction':_0x1be72b});})[_0x460c('0x2a')](function(){var _0x129a57={'type':db['Sequelize'][_0x460c('0x93')],'transaction':_0x1be72b};switch(_0x7db85a[_0x460c('0x57')][_0x460c('0x35')]){case _0x460c('0x94'):_0x129a57['type']=db['Sequelize'][_0x460c('0x93')];break;case _0x460c('0x95'):_0x129a57['type']=db[_0x460c('0x96')]['INTEGER'];break;case'switch':_0x129a57[_0x460c('0x35')]=db[_0x460c('0x96')][_0x460c('0x97')];_0x129a57[_0x460c('0x98')]=![];break;default:}return db[_0x460c('0x90')]['queryInterface'][_0x460c('0x99')](_0x460c('0x77'),util[_0x460c('0x8a')](_0x460c('0x9a'),_0x574420['id']),_0x129a57);})[_0x460c('0x2a')](function(){return _0x574420;});});}})[_0x460c('0x2a')](respondWithResult(_0xbbd489,null))[_0x460c('0x4b')](handleError(_0xbbd489,null));};exports[_0x460c('0x9b')]=function(_0x4a9433,_0x231643,_0x2d36a8){var _0x163af8={};var _0x36b404={};var _0x5e5777;var _0x92bc85;return db[_0x460c('0x4d')]['findOne']({'where':{'id':_0x4a9433['params']['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0x231643,null))[_0x460c('0x2a')](function(_0x260167){if(_0x260167){_0x5e5777=_0x260167;_0x36b404[_0x460c('0x38')]=_[_0x460c('0x37')](db['CmCustomField'][_0x460c('0x33')]);_0x36b404[_0x460c('0x36')]=_[_0x460c('0x37')](_0x4a9433[_0x460c('0x36')]);_0x36b404['filters']=_[_0x460c('0x3a')](_0x36b404[_0x460c('0x38')],_0x36b404['query']);_0x163af8[_0x460c('0x39')]=_[_0x460c('0x3a')](_0x36b404[_0x460c('0x38')],qs[_0x460c('0x3b')](_0x4a9433[_0x460c('0x36')]['fields']));_0x163af8[_0x460c('0x39')]=_0x163af8[_0x460c('0x39')][_0x460c('0x3c')]?_0x163af8['attributes']:_0x36b404[_0x460c('0x38')];_0x163af8[_0x460c('0x3f')]=qs[_0x460c('0x40')](_0x4a9433[_0x460c('0x36')]['sort']);_0x163af8[_0x460c('0x41')]=qs[_0x460c('0x42')](_['pick'](_0x4a9433[_0x460c('0x36')],_0x36b404[_0x460c('0x42')]));_0x163af8[_0x460c('0x41')]=_[_0x460c('0x45')](_0x163af8['where'],{'$or':[{'ListId':_0x260167['id']},{'ListId':null}]});if(_0x4a9433[_0x460c('0x36')]['filter']){_0x163af8['where']=_[_0x460c('0x45')](_0x163af8[_0x460c('0x41')],{'$or':_[_0x460c('0x32')](_0x163af8[_0x460c('0x39')],function(_0x5cf496){var _0x3b8f3c={};_0x3b8f3c[_0x5cf496]={'$like':'%'+_0x4a9433[_0x460c('0x36')]['filter']+'%'};return _0x3b8f3c;})});}_0x163af8=_[_0x460c('0x45')]({},_0x163af8,_0x4a9433['options']);return db[_0x460c('0x6d')][_0x460c('0x9c')](_0x163af8);}})[_0x460c('0x2a')](respondWithResult(_0x231643,null))['catch'](handleError(_0x231643,null));};exports[_0x460c('0x9d')]=function(_0x116e92,_0x4822d8){return db[_0x460c('0x6d')][_0x460c('0x9c')]({'where':{'ListId':null}})[_0x460c('0x2a')](handleEntityNotFound(_0x4822d8,null))['then'](function(_0xb93603){return _0xb93603;})[_0x460c('0x2a')](respondWithResult(_0x4822d8,null))[_0x460c('0x4b')](handleError(_0x4822d8,null));};exports[_0x460c('0x9e')]=function(_0x578e09,_0x59d298,_0xf1e48a){return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x578e09[_0x460c('0x59')]['id']}})['then'](handleEntityNotFound(_0x59d298,null))[_0x460c('0x2a')](function(_0x20d4d8){if(_0x20d4d8){return _0x20d4d8[_0x460c('0x9e')](_0x578e09[_0x460c('0x57')][_0x460c('0x60')],_[_0x460c('0x67')](_0x578e09[_0x460c('0x57')],[_0x460c('0x60'),'id'])||{})['spread'](function(_0x3c6461){for(var _0x590d5f=0x0;_0x590d5f<_0x578e09[_0x460c('0x57')]['ids']['length'];_0x590d5f+=0x1){socket[_0x460c('0x9f')](_0x460c('0xa0'),{'UserId':Number(_0x578e09[_0x460c('0x57')][_0x460c('0x60')][_0x590d5f]),'CmListId':Number(_0x578e09[_0x460c('0x59')]['id'])});}return _0x3c6461;});}})[_0x460c('0x2a')](respondWithResult(_0x59d298,null))[_0x460c('0x4b')](handleError(_0x59d298,null));};exports[_0x460c('0xa1')]=function(_0x3061e1,_0x5f1849,_0x3d78ef){return db[_0x460c('0x4d')][_0x460c('0x58')]({'where':{'id':_0x3061e1[_0x460c('0x59')]['id']}})[_0x460c('0x2a')](handleEntityNotFound(_0x5f1849,null))[_0x460c('0x2a')](function(_0x59bec1){if(_0x59bec1){return _0x59bec1[_0x460c('0xa1')](_0x3061e1[_0x460c('0x36')][_0x460c('0x60')])[_0x460c('0x2a')](function(){if(_['isArray'](_0x3061e1['query'][_0x460c('0x60')])){for(var _0x426868=0x0;_0x426868<_0x3061e1['query'][_0x460c('0x60')][_0x460c('0x3c')];_0x426868+=0x1){socket[_0x460c('0x9f')](_0x460c('0xa2'),{'UserId':Number(_0x3061e1[_0x460c('0x36')]['ids'][_0x426868]),'CmListId':Number(_0x3061e1[_0x460c('0x59')]['id'])});}}else{socket[_0x460c('0x9f')]('userCmList:remove',{'UserId':Number(_0x3061e1[_0x460c('0x36')]['ids']),'CmListId':Number(_0x3061e1[_0x460c('0x59')]['id'])});}});}})[_0x460c('0x2a')](respondWithStatusCode(_0x5f1849,null))[_0x460c('0x4b')](handleError(_0x5f1849,null));};exports[_0x460c('0xa3')]=function(_0xa283e5,_0x42c18c,_0x2637a2){var _0x13cea1={};var _0x3d3adf={};var _0x474743;var _0x3e82c9;return db[_0x460c('0x4d')][_0x460c('0x8f')]({'where':{'id':_0xa283e5[_0x460c('0x59')]['id']}})['then'](handleEntityNotFound(_0x42c18c,null))[_0x460c('0x2a')](function(_0x13cf5c){if(_0x13cf5c){_0x474743=_0x13cf5c;_0x3d3adf[_0x460c('0x38')]=_[_0x460c('0x37')](db[_0x460c('0xa4')][_0x460c('0x33')]);_0x3d3adf['query']=_[_0x460c('0x37')](_0xa283e5['query']);_0x3d3adf[_0x460c('0x42')]=_['intersection'](_0x3d3adf[_0x460c('0x38')],_0x3d3adf['query']);_0x13cea1['attributes']=_[_0x460c('0x3a')](_0x3d3adf[_0x460c('0x38')],qs['fields'](_0xa283e5['query']['fields']));_0x13cea1[_0x460c('0x39')]=_0x13cea1[_0x460c('0x39')][_0x460c('0x3c')]?_0x13cea1[_0x460c('0x39')]:_0x3d3adf[_0x460c('0x38')];_0x13cea1[_0x460c('0x3f')]=qs['sort'](_0xa283e5[_0x460c('0x36')][_0x460c('0x40')]);_0x13cea1[_0x460c('0x41')]=qs[_0x460c('0x42')](_[_0x460c('0x43')](_0xa283e5[_0x460c('0x36')],_0x3d3adf[_0x460c('0x42')]));if(_0xa283e5['query'][_0x460c('0x44')]){_0x13cea1['where']=_['merge'](_0x13cea1[_0x460c('0x41')],{'$or':_[_0x460c('0x32')](_0x13cea1[_0x460c('0x39')],function(_0x11557e){var _0x3f1042={};_0x3f1042[_0x11557e]={'$like':'%'+_0xa283e5['query'][_0x460c('0x44')]+'%'};return _0x3f1042;})});}_0x13cea1=_[_0x460c('0x45')]({},_0x13cea1,_0xa283e5[_0x460c('0x46')]);return _0x474743['getAgents'](_0x13cea1);}})[_0x460c('0x2a')](function(_0xcc3c5e){if(_0xcc3c5e){_0x3e82c9=_0xcc3c5e[_0x460c('0x3c')];if(!_0xa283e5[_0x460c('0x36')][_0x460c('0x3d')](_0x460c('0x3e'))){_0x13cea1['limit']=qs[_0x460c('0x23')](_0xa283e5[_0x460c('0x36')][_0x460c('0x23')]);_0x13cea1[_0x460c('0x21')]=qs[_0x460c('0x21')](_0xa283e5[_0x460c('0x36')][_0x460c('0x21')]);}return _0x474743[_0x460c('0xa3')](_0x13cea1);}})[_0x460c('0x2a')](function(_0x34b7d2){if(_0x34b7d2){return _0x34b7d2?{'count':_0x3e82c9,'rows':_0x34b7d2}:null;}})[_0x460c('0x2a')](respondWithResult(_0x42c18c,null))[_0x460c('0x4b')](handleError(_0x42c18c,null));};function handleQuery(_0x55700a){logger['info'](_0x55700a);return db[_0x460c('0x90')][_0x460c('0x36')](_0x55700a)[_0x460c('0xa5')](function(_0xa0c619){csv_results[_0x460c('0x66')](_0xa0c619);})[_0x460c('0x4b')](function(_0x44da24){logger[_0x460c('0x2e')](_0x44da24[_0x460c('0x6a')]);});} \ No newline at end of file +var _0xb32d=['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','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','fields','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','order','filter','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','removeAgents','emit','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','moment','mustache','path','ejs'];(function(_0x1bcb11,_0x11f345){var _0x180ae1=function(_0x2c441a){while(--_0x2c441a){_0x1bcb11['push'](_0x1bcb11['shift']());}};_0x180ae1(++_0x11f345);}(_0xb32d,0xa1));var _0xdb32=function(_0x3486b0,_0x248021){_0x3486b0=_0x3486b0-0x0;var _0x2c8a3f=_0xb32d[_0x3486b0];return _0x2c8a3f;};'use strict';var emlformat=require(_0xdb32('0x0'));var rimraf=require(_0xdb32('0x1'));var zipdir=require(_0xdb32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb32('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb32('0x4'));var util=require('util');var path=require(_0xdb32('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb32('0x6'));var fs=require('fs');var fs_extra=require(_0xdb32('0x7'));var _=require(_0xdb32('0x8'));var squel=require(_0xdb32('0x9'));var crypto=require(_0xdb32('0xa'));var jsforce=require(_0xdb32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb32('0xc'));var querystring=require(_0xdb32('0xd'));var Papa=require(_0xdb32('0xe'));var Redis=require(_0xdb32('0xf'));var authService=require(_0xdb32('0x10'));var qs=require(_0xdb32('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb32('0x12'));var logger=require(_0xdb32('0x13'))(_0xdb32('0x14'));var utils=require(_0xdb32('0x15'));var config=require(_0xdb32('0x16'));var licenseUtil=require(_0xdb32('0x17'));var db=require(_0xdb32('0x18'))['db'];var csv_results;config[_0xdb32('0x19')]=_[_0xdb32('0x1a')](config[_0xdb32('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb32('0x1b'))(new Redis(config[_0xdb32('0x19')]));require(_0xdb32('0x1c'))[_0xdb32('0x1d')](socket);function respondWithStatusCode(_0x1c14fd,_0x215b09){_0x215b09=_0x215b09||0xcc;return function(_0x5ed58c){if(_0x5ed58c){return _0x1c14fd[_0xdb32('0x1e')](_0x215b09);}return _0x1c14fd[_0xdb32('0x1f')](_0x215b09)[_0xdb32('0x20')]();};}function respondWithResult(_0x1b3a11,_0x163591){_0x163591=_0x163591||0xc8;return function(_0x19e9a2){if(_0x19e9a2){return _0x1b3a11[_0xdb32('0x1f')](_0x163591)[_0xdb32('0x21')](_0x19e9a2);}};}function respondWithFilteredResult(_0x3d9d36,_0x361016){return function(_0x238213){if(_0x238213){var _0x10b8c7=typeof _0x361016[_0xdb32('0x22')]===_0xdb32('0x23')&&typeof _0x361016['limit']==='undefined';var _0x5a4c0f=_0x238213[_0xdb32('0x24')];var _0x2e4710=_0x10b8c7?0x0:_0x361016['offset'];var _0x2cf34b=_0x10b8c7?_0x238213[_0xdb32('0x24')]:_0x361016[_0xdb32('0x22')]+_0x361016[_0xdb32('0x25')];var _0x1d8d10;if(_0x2cf34b>=_0x5a4c0f){_0x2cf34b=_0x5a4c0f;_0x1d8d10=0xc8;}else{_0x1d8d10=0xce;}_0x3d9d36[_0xdb32('0x1f')](_0x1d8d10);return _0x3d9d36[_0xdb32('0x26')](_0xdb32('0x27'),_0x2e4710+'-'+_0x2cf34b+'/'+_0x5a4c0f)['json'](_0x238213);}return null;};}function patchUpdates(_0x8d4e73){return function(_0x326a3c){try{jsonpatch[_0xdb32('0x28')](_0x326a3c,_0x8d4e73,!![]);}catch(_0x2864ba){return BPromise[_0xdb32('0x29')](_0x2864ba);}return _0x326a3c[_0xdb32('0x2a')]();};}function saveUpdates(_0x21fb5a,_0x424a46){return function(_0x34a627){if(_0x34a627){return _0x34a627[_0xdb32('0x2b')](_0x21fb5a)[_0xdb32('0x2c')](function(_0x382f8c){return _0x382f8c;});}return null;};}function removeEntity(_0x17add4,_0x53d643){return function(_0x46c5b4){if(_0x46c5b4){return _0x46c5b4[_0xdb32('0x2d')]()[_0xdb32('0x2c')](function(){var _0x2bd022=_0x46c5b4[_0xdb32('0x2e')]({'plain':!![]});var _0x25e1cb=_0xdb32('0x2f');return db[_0xdb32('0x30')][_0xdb32('0x2d')]({'where':{'type':_0x25e1cb,'resourceId':_0x2bd022['id']}})[_0xdb32('0x2c')](function(){return _0x46c5b4;});})[_0xdb32('0x2c')](function(){_0x17add4[_0xdb32('0x1f')](0xcc)[_0xdb32('0x20')]();});}};}function handleEntityNotFound(_0x12b20b,_0x5bf82f){return function(_0x3a3448){if(!_0x3a3448){_0x12b20b[_0xdb32('0x1e')](0x194);}return _0x3a3448;};}function handleError(_0x3aecf8,_0x306f02){_0x306f02=_0x306f02||0x1f4;return function(_0x369223){logger[_0xdb32('0x31')](_0x369223[_0xdb32('0x32')]);if(_0x369223[_0xdb32('0x33')]){delete _0x369223[_0xdb32('0x33')];}_0x3aecf8[_0xdb32('0x1f')](_0x306f02)[_0xdb32('0x34')](_0x369223);};}exports[_0xdb32('0x35')]=function(_0x537a7a,_0x36dd1a){var _0x4fb4f7={},_0x7ff96b={},_0x4aae29={'count':0x0,'rows':[]};var _0x162a4c=_[_0xdb32('0x36')](db[_0xdb32('0x37')][_0xdb32('0x38')],function(_0x3a402d){return{'name':_0x3a402d[_0xdb32('0x39')],'type':_0x3a402d[_0xdb32('0x3a')][_0xdb32('0x3b')]};});_0x7ff96b[_0xdb32('0x3c')]=_[_0xdb32('0x36')](_0x162a4c,'name');_0x7ff96b[_0xdb32('0x3d')]=_['keys'](_0x537a7a[_0xdb32('0x3d')]);_0x7ff96b[_0xdb32('0x3e')]=_['intersection'](_0x7ff96b['model'],_0x7ff96b[_0xdb32('0x3d')]);_0x4fb4f7[_0xdb32('0x3f')]=_[_0xdb32('0x40')](_0x7ff96b[_0xdb32('0x3c')],qs['fields'](_0x537a7a[_0xdb32('0x3d')]['fields']));_0x4fb4f7['attributes']=_0x4fb4f7[_0xdb32('0x3f')][_0xdb32('0x41')]?_0x4fb4f7[_0xdb32('0x3f')]:_0x7ff96b['model'];if(!_0x537a7a['query']['hasOwnProperty'](_0xdb32('0x42'))){_0x4fb4f7[_0xdb32('0x25')]=qs[_0xdb32('0x25')](_0x537a7a[_0xdb32('0x3d')][_0xdb32('0x25')]);_0x4fb4f7[_0xdb32('0x22')]=qs['offset'](_0x537a7a[_0xdb32('0x3d')][_0xdb32('0x22')]);}_0x4fb4f7['order']=qs[_0xdb32('0x43')](_0x537a7a['query'][_0xdb32('0x43')]);_0x4fb4f7[_0xdb32('0x44')]=qs[_0xdb32('0x3e')](_[_0xdb32('0x45')](_0x537a7a[_0xdb32('0x3d')],_0x7ff96b[_0xdb32('0x3e')]),_0x162a4c);if(_0x537a7a[_0xdb32('0x3d')]['filter']){_0x4fb4f7[_0xdb32('0x44')]=_[_0xdb32('0x46')](_0x4fb4f7['where'],{'$or':_[_0xdb32('0x36')](_0x162a4c,function(_0x4f0bd9){if(_0x4f0bd9[_0xdb32('0x3a')]!==_0xdb32('0x47')){var _0x1f6686={};_0x1f6686[_0x4f0bd9['name']]={'$like':'%'+_0x537a7a[_0xdb32('0x3d')]['filter']+'%'};return _0x1f6686;}})});}_0x4fb4f7=_['merge']({},_0x4fb4f7,_0x537a7a[_0xdb32('0x48')]);var _0x4ae85b={'where':_0x4fb4f7[_0xdb32('0x44')]};return db[_0xdb32('0x37')]['count'](_0x4ae85b)['then'](function(_0x1dfce6){_0x4aae29[_0xdb32('0x24')]=_0x1dfce6;if(_0x537a7a['query'][_0xdb32('0x49')]){_0x4fb4f7[_0xdb32('0x4a')]=[{'all':!![]}];}return db[_0xdb32('0x37')][_0xdb32('0x4b')](_0x4fb4f7);})['then'](function(_0x344dac){_0x4aae29[_0xdb32('0x4c')]=_0x344dac;return _0x4aae29;})[_0xdb32('0x2c')](respondWithFilteredResult(_0x36dd1a,_0x4fb4f7))['catch'](handleError(_0x36dd1a,null));};exports[_0xdb32('0x4d')]=function(_0x1b029b,_0x268c2e){var _0x5b87fa={'raw':![],'where':{'id':_0x1b029b['params']['id']}},_0x2d1c11={};_0x2d1c11[_0xdb32('0x3c')]=_[_0xdb32('0x4e')](db[_0xdb32('0x37')][_0xdb32('0x38')]);_0x2d1c11[_0xdb32('0x3d')]=_[_0xdb32('0x4e')](_0x1b029b[_0xdb32('0x3d')]);_0x2d1c11[_0xdb32('0x3e')]=_[_0xdb32('0x40')](_0x2d1c11[_0xdb32('0x3c')],_0x2d1c11[_0xdb32('0x3d')]);_0x5b87fa[_0xdb32('0x3f')]=_[_0xdb32('0x40')](_0x2d1c11['model'],qs['fields'](_0x1b029b[_0xdb32('0x3d')][_0xdb32('0x4f')]));_0x5b87fa[_0xdb32('0x3f')]=_0x5b87fa[_0xdb32('0x3f')]['length']?_0x5b87fa[_0xdb32('0x3f')]:_0x2d1c11[_0xdb32('0x3c')];if(_0x1b029b['query']['includeAll']){_0x5b87fa['include']=[{'all':!![]}];}_0x5b87fa=_[_0xdb32('0x46')]({},_0x5b87fa,_0x1b029b[_0xdb32('0x48')]);return db[_0xdb32('0x37')][_0xdb32('0x50')](_0x5b87fa)[_0xdb32('0x2c')](handleEntityNotFound(_0x268c2e,null))[_0xdb32('0x2c')](respondWithResult(_0x268c2e,null))['catch'](handleError(_0x268c2e,null));};exports[_0xdb32('0x51')]=function(_0x341acf,_0x5daa3f){return db[_0xdb32('0x37')][_0xdb32('0x51')](_0x341acf[_0xdb32('0x52')],{})['then'](function(_0x115ec6){var _0x475df2=_0x341acf[_0xdb32('0x53')]['get']({'plain':!![]});if(!_0x475df2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x475df2[_0xdb32('0x54')]==='user'){var _0xade490=_0x115ec6['get']({'plain':!![]});var _0x5e9f45=_0xdb32('0x2f');return db[_0xdb32('0x55')][_0xdb32('0x50')]({'where':{'name':_0x5e9f45,'userProfileId':_0x475df2[_0xdb32('0x56')]},'raw':!![]})[_0xdb32('0x2c')](function(_0x2aabee){if(_0x2aabee&&_0x2aabee[_0xdb32('0x57')]===0x0){return db[_0xdb32('0x30')][_0xdb32('0x51')]({'name':_0xade490['name'],'resourceId':_0xade490['id'],'type':_0x2aabee['name'],'sectionId':_0x2aabee['id']},{})['then'](function(){return _0x115ec6;});}else{return _0x115ec6;}})[_0xdb32('0x58')](function(_0x47f328){logger[_0xdb32('0x31')](_0xdb32('0x59'),_0x47f328);throw _0x47f328;});}return _0x115ec6;})[_0xdb32('0x2c')](respondWithResult(_0x5daa3f,0xc9))[_0xdb32('0x58')](handleError(_0x5daa3f,null));};exports[_0xdb32('0x2b')]=function(_0x4e0b42,_0xda9f9a){if(_0x4e0b42[_0xdb32('0x52')]['id']){delete _0x4e0b42['body']['id'];}return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0x4e0b42['params']['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0xda9f9a,null))[_0xdb32('0x2c')](saveUpdates(_0x4e0b42[_0xdb32('0x52')],null))[_0xdb32('0x2c')](respondWithResult(_0xda9f9a,null))['catch'](handleError(_0xda9f9a,null));};exports[_0xdb32('0x2d')]=function(_0x28230a,_0x4076b5){return db['CmList'][_0xdb32('0x50')]({'where':{'id':_0x28230a[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x4076b5,null))[_0xdb32('0x2c')](removeEntity(_0x4076b5,null))[_0xdb32('0x58')](handleError(_0x4076b5,null));};exports[_0xdb32('0x5b')]=function(_0x5ac42b,_0x1b1433){return db['CmList'][_0xdb32('0x5b')]()[_0xdb32('0x2c')](respondWithResult(_0x1b1433,null))['catch'](handleError(_0x1b1433,null));};exports['addDisposition']=function(_0xa38dfc,_0x507030,_0x5edda0){if(_0xa38dfc[_0xdb32('0x52')]['id']){delete _0xa38dfc[_0xdb32('0x52')]['id'];}return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0xa38dfc[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x507030,null))[_0xdb32('0x2c')](function(_0x5eef36){if(_0x5eef36){_0xa38dfc['body'][_0xdb32('0x5c')]=_0x5eef36['id'];return db[_0xdb32('0x5d')][_0xdb32('0x51')](_0xa38dfc['body']);}})[_0xdb32('0x2c')](respondWithResult(_0x507030,null))[_0xdb32('0x58')](handleError(_0x507030,null));};exports[_0xdb32('0x5e')]=function(_0x521f29,_0x562d2f,_0x36e417){var _0xfacd81={'raw':![],'where':{}};var _0x504588={};var _0x5210a8={'count':0x0,'rows':[]};return db[_0xdb32('0x37')][_0xdb32('0x5f')]({'where':{'id':_0x521f29['params']['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x562d2f,null))[_0xdb32('0x2c')](function(_0x41e67c){if(_0x41e67c){_0x504588['model']=_[_0xdb32('0x4e')](db['Disposition'][_0xdb32('0x38')]);_0x504588[_0xdb32('0x3d')]=_[_0xdb32('0x4e')](_0x521f29[_0xdb32('0x3d')]);_0x504588[_0xdb32('0x3e')]=_[_0xdb32('0x40')](_0x504588[_0xdb32('0x3c')],_0x504588['query']);_0xfacd81['attributes']=_[_0xdb32('0x40')](_0x504588[_0xdb32('0x3c')],qs['fields'](_0x521f29[_0xdb32('0x3d')]['fields']));_0xfacd81['attributes']=_0xfacd81[_0xdb32('0x3f')][_0xdb32('0x41')]?_0xfacd81[_0xdb32('0x3f')]:_0x504588[_0xdb32('0x3c')];if(!_0x521f29['query'][_0xdb32('0x60')](_0xdb32('0x42'))){_0xfacd81[_0xdb32('0x25')]=qs[_0xdb32('0x25')](_0x521f29[_0xdb32('0x3d')]['limit']);_0xfacd81[_0xdb32('0x22')]=qs[_0xdb32('0x22')](_0x521f29[_0xdb32('0x3d')]['offset']);}_0xfacd81[_0xdb32('0x61')]=qs[_0xdb32('0x43')](_0x521f29['query']['sort']);_0xfacd81[_0xdb32('0x44')]=qs[_0xdb32('0x3e')](_[_0xdb32('0x45')](_0x521f29[_0xdb32('0x3d')],_0x504588[_0xdb32('0x3e')]));_0xfacd81['where'][_0xdb32('0x5c')]=_0x41e67c['id'];if(_0x521f29['query']['filter']){_0xfacd81[_0xdb32('0x44')]=_['merge'](_0xfacd81[_0xdb32('0x44')],{'$or':_['map'](_0xfacd81['attributes'],function(_0x1f565c){var _0xa8b68c={};_0xa8b68c[_0x1f565c]={'$like':'%'+_0x521f29[_0xdb32('0x3d')][_0xdb32('0x62')]+'%'};return _0xa8b68c;})});}_0xfacd81=_[_0xdb32('0x46')]({},_0xfacd81,_0x521f29[_0xdb32('0x48')]);return db[_0xdb32('0x5d')][_0xdb32('0x24')]({'where':_0xfacd81['where']})[_0xdb32('0x2c')](function(_0x43827d){_0x5210a8[_0xdb32('0x24')]=_0x43827d;if(_0x521f29[_0xdb32('0x3d')][_0xdb32('0x49')]){_0xfacd81[_0xdb32('0x4a')]=[{'all':!![]}];}return db[_0xdb32('0x5d')][_0xdb32('0x4b')](_0xfacd81);})[_0xdb32('0x2c')](function(_0x31cae4){_0x5210a8[_0xdb32('0x4c')]=_0x31cae4;return _0x5210a8;});}})[_0xdb32('0x2c')](respondWithFilteredResult(_0x562d2f,_0xfacd81))[_0xdb32('0x58')](handleError(_0x562d2f,null));};exports[_0xdb32('0x63')]=function(_0x3e1c17,_0x439b6d,_0x50350a){return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0x3e1c17[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x439b6d,null))[_0xdb32('0x2c')](function(_0x5a47d0){if(_0x5a47d0){return _0x5a47d0['removeDispositions'](_0x3e1c17[_0xdb32('0x3d')][_0xdb32('0x64')]);}})[_0xdb32('0x2c')](respondWithStatusCode(_0x439b6d,null))[_0xdb32('0x58')](handleError(_0x439b6d,null));};exports[_0xdb32('0x65')]=function(_0x10150b,_0x1420f2,_0x5c122e){return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0x10150b[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x1420f2,null))[_0xdb32('0x2c')](function(_0x524e6f){if(_0x524e6f){var _0x619e5c=[];var _0x5521c8={'success':[],'errors':[]};return db[_0xdb32('0x66')][_0xdb32('0x5b')]()[_0xdb32('0x2c')](function(_0xa7b7ff){if(_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')]&&_[_0xdb32('0x68')](_0x10150b[_0xdb32('0x52')]['tags'])){if(_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')]['length']){_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')]=_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')][_0xdb32('0x69')](';')+';';}else{_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')]=null;}}else{_0x10150b[_0xdb32('0x52')][_0xdb32('0x67')]=null;}if(_0x10150b['body']&&_[_0xdb32('0x68')](_0x10150b['body'])){for(var _0x523b02=0x0;_0x523b02<_0x10150b[_0xdb32('0x52')][_0xdb32('0x41')];_0x523b02+=0x1){_0x10150b[_0xdb32('0x52')][_0x523b02][_0xdb32('0x5c')]=_0x10150b[_0xdb32('0x5a')]['id'];_0x619e5c[_0xdb32('0x6a')](_0x10150b[_0xdb32('0x52')][_0x523b02]);}return BPromise[_0xdb32('0x6b')](_0x619e5c,function(_0x198331){return db['CmContact'][_0xdb32('0x51')](_['omit'](_0x198331,[_0xdb32('0x64'),'id'])||{},{'fields':_[_0xdb32('0x4e')](_0xa7b7ff),'raw':!![]})[_0xdb32('0x2c')](function(_0x5422e6){_0x5521c8[_0xdb32('0x6c')][_0xdb32('0x6a')](_0x5422e6[_0xdb32('0x6d')]);})[_0xdb32('0x58')](function(_0x2dfdaf){_0x5521c8['errors']['push']({'data':_0x198331,'error':_0x2dfdaf['message']});});})[_0xdb32('0x2c')](function(_0x4489a7){return _0x5521c8;})['catch'](function(_0x4ad246){return _0x4ad246;});}else{_0x1420f2['status'](0x190)['json']({'message':_0xdb32('0x6e')});}});}})[_0xdb32('0x2c')](respondWithResult(_0x1420f2,null))[_0xdb32('0x58')](handleError(_0x1420f2,null));};exports[_0xdb32('0x6f')]=function(_0x285be6,_0x16b199,_0x4809d5){var _0x38e7a3;return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0x285be6[_0xdb32('0x5a')]['id']},'include':[{'model':db[_0xdb32('0x70')],'as':_0xdb32('0x71')}]})[_0xdb32('0x2c')](handleEntityNotFound(_0x16b199,null))[_0xdb32('0x2c')](function(_0x1b921b){if(_0x1b921b){_0x38e7a3=_0x1b921b;return db[_0xdb32('0x66')][_0xdb32('0x38')];}})['then'](function(_0x30c7f2){if(_0x30c7f2){var _0x3cb8fa={};var _0x362439={};_0x362439[_0xdb32('0x3c')]=_[_0xdb32('0x72')](_['keys'](_0x30c7f2),_[_0xdb32('0x36')](_0x38e7a3[_0xdb32('0x71')],function(_0x580afb){return util[_0xdb32('0x73')](_0xdb32('0x74'),_0x580afb['id']);}));_0x362439[_0xdb32('0x3d')]=_[_0xdb32('0x4e')](_0x285be6['query']);_0x362439[_0xdb32('0x3e')]=_[_0xdb32('0x40')](_0x362439[_0xdb32('0x3c')],_0x362439['query']);_0x3cb8fa['attributes']=_[_0xdb32('0x40')](_0x362439[_0xdb32('0x3c')],qs['fields'](_0x285be6[_0xdb32('0x3d')]['fields']));_0x3cb8fa[_0xdb32('0x3f')]=_0x3cb8fa[_0xdb32('0x3f')][_0xdb32('0x41')]?_0x3cb8fa[_0xdb32('0x3f')]:_0x362439[_0xdb32('0x3c')];if(!_0x285be6['query']['hasOwnProperty'](_0xdb32('0x42'))){_0x3cb8fa[_0xdb32('0x25')]=qs['limit'](_0x285be6[_0xdb32('0x3d')][_0xdb32('0x25')]);_0x3cb8fa[_0xdb32('0x22')]=qs[_0xdb32('0x22')](_0x285be6[_0xdb32('0x3d')][_0xdb32('0x22')]);}_0x3cb8fa[_0xdb32('0x61')]=qs[_0xdb32('0x43')](_0x285be6['query'][_0xdb32('0x43')]);_0x3cb8fa['where']=qs[_0xdb32('0x3e')](_[_0xdb32('0x45')](_0x285be6[_0xdb32('0x3d')],_0x362439[_0xdb32('0x3e')]));_0x3cb8fa[_0xdb32('0x75')]=!![];if(_0x285be6['query']['filter']){_0x3cb8fa['where']=_[_0xdb32('0x46')](_0x3cb8fa[_0xdb32('0x44')],{'$or':_[_0xdb32('0x36')](_0x3cb8fa[_0xdb32('0x3f')],function(_0x570df6){var _0x49e44c={};_0x49e44c[_0x570df6]={'$like':'%'+_0x285be6[_0xdb32('0x3d')]['filter']+'%'};return _0x49e44c;})});}_0x3cb8fa=_[_0xdb32('0x46')]({},_0x3cb8fa,_0x285be6[_0xdb32('0x48')]);return _0x38e7a3[_0xdb32('0x6f')](_0x3cb8fa);}})['then'](respondWithResult(_0x16b199,null))[_0xdb32('0x58')](handleError(_0x16b199,null));};exports[_0xdb32('0x76')]=function(_0x266313,_0x18cf78,_0x1dbbc6){var _0x2add41;var _0x207780;var _0x124ee3;var _0x37bff8=_0x266313[_0xdb32('0x5a')]['id'];csv_results=[];return db[_0xdb32('0x77')][_0xdb32('0x4b')]({'attributes':['id',_0xdb32('0x33')],'raw':!![],'order':[_0xdb32('0x78')]})[_0xdb32('0x2c')](function(_0xbc3bc4){_0x2add41=_0xbc3bc4;var _0x370511=_[_0xdb32('0x4e')](db['CmContact'][_0xdb32('0x38')]);return db['CmCustomField'][_0xdb32('0x4b')]({'raw':!![],'attributes':['id',_0xdb32('0x79')]})[_0xdb32('0x2c')](function(_0x20da1e){_0x207780=_0x20da1e;var _0x448969=squel[_0xdb32('0x7a')]()['fields'](_0x370511)[_0xdb32('0x7b')](_0xdb32('0x7c'),'c')['where'](_0xdb32('0x7d'),_0x37bff8)[_0xdb32('0x44')]('c.deletedAt\x20is\x20null')[_0xdb32('0x7e')]();for(var _0x5dc35f=0x0;_0x5dc35f<_0x207780[_0xdb32('0x41')];_0x5dc35f++){_0x448969[_0xdb32('0x7f')]('c.cf_'+_0x207780[_0x5dc35f]['id'],_0xdb32('0x80')+_0x207780[_0x5dc35f][_0xdb32('0x79')]);}for(var _0x5dc35f=0x0;_0x5dc35f<_0x2add41[_0xdb32('0x41')];_0x5dc35f++){_0x448969['field'](squel['select']()[_0xdb32('0x7f')](_0xdb32('0x81'))['from'](_0xdb32('0x82'))[_0xdb32('0x44')](_0xdb32('0x83'),_0x2add41[_0x5dc35f]['id'])['where'](_0xdb32('0x84')),_0xdb32('0x85')+_0x2add41[_0x5dc35f][_0xdb32('0x33')]);_0x448969[_0xdb32('0x7f')](squel['select']()[_0xdb32('0x7f')](_0xdb32('0x86'))['from'](_0xdb32('0x82'))[_0xdb32('0x44')](_0xdb32('0x83'),_0x2add41[_0x5dc35f]['id'])[_0xdb32('0x44')](_0xdb32('0x84')),'description_additionalPhone_'+_0x2add41[_0x5dc35f][_0xdb32('0x33')]);}var _0xf6d73b=[];_0xf6d73b[_0xdb32('0x6a')](_0x448969[_0xdb32('0x87')]());BPromise[_0xdb32('0x6b')](_0xf6d73b,handleQuery)[_0xdb32('0x2c')](function(_0x433a99){handleQuery(_0x448969[_0xdb32('0x87')]());var _0xa7e85e=csv_results[0x0];if(!_[_0xdb32('0x88')](_0xa7e85e)){var _0x270e07=toCsv(_0xa7e85e);var _0x28ff00=Date[_0xdb32('0x89')]();fs['writeFileSync'](util[_0xdb32('0x73')](_0xdb32('0x8a'),_0x37bff8,_0x28ff00),_0x270e07);_0x18cf78['setHeader'](_0xdb32('0x8b'),'attachment;\x20filename='+util[_0xdb32('0x73')](_0xdb32('0x8c'),_0x37bff8,_0x28ff00));_0x18cf78[_0xdb32('0x8d')](_0xdb32('0x8e'),_0xdb32('0x8f'));return _0x18cf78[_0xdb32('0x90')](util[_0xdb32('0x73')](_0xdb32('0x8a'),_0x37bff8,_0x28ff00));}else{return _0x18cf78[_0xdb32('0x1e')](0xcc);}});});});};exports[_0xdb32('0x91')]=function(_0x3dbf4a,_0x28594f,_0x36f09d){var _0x560d2d;delete _0x3dbf4a['body']['id'];return db[_0xdb32('0x37')][_0xdb32('0x5f')]({'where':{'id':_0x3dbf4a[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x28594f,null))[_0xdb32('0x2c')](function(_0x34e876){if(_0x34e876){return db[_0xdb32('0x92')][_0xdb32('0x93')](function(_0x3a118a){return db[_0xdb32('0x70')][_0xdb32('0x51')](_0x3dbf4a[_0xdb32('0x52')],{'transaction':_0x3a118a})['then'](function(_0x2e146d){_0x560d2d=_0x2e146d;return _0x34e876[_0xdb32('0x94')](_0x2e146d,{'transaction':_0x3a118a});})[_0xdb32('0x2c')](function(){var _0x2f42de={'type':db[_0xdb32('0x95')][_0xdb32('0x96')],'transaction':_0x3a118a};switch(_0x3dbf4a['body'][_0xdb32('0x3a')]){case _0xdb32('0x97'):_0x2f42de[_0xdb32('0x3a')]=db[_0xdb32('0x95')]['TEXT'];break;case'number':_0x2f42de[_0xdb32('0x3a')]=db[_0xdb32('0x95')]['INTEGER'];break;case _0xdb32('0x98'):_0x2f42de['type']=db[_0xdb32('0x95')]['BOOLEAN'];_0x2f42de[_0xdb32('0x99')]=![];break;default:}return db[_0xdb32('0x92')][_0xdb32('0x9a')][_0xdb32('0x9b')](_0xdb32('0x7c'),util['format'](_0xdb32('0x9c'),_0x560d2d['id']),_0x2f42de);})['then'](function(){return _0x560d2d;});});}})[_0xdb32('0x2c')](respondWithResult(_0x28594f,null))['catch'](handleError(_0x28594f,null));};exports[_0xdb32('0x9d')]=function(_0x5ea3e2,_0x387402,_0x276347){var _0x34391f={};var _0x4db87b={};var _0x4656d8;var _0x16f8a8;return db[_0xdb32('0x37')]['findOne']({'where':{'id':_0x5ea3e2[_0xdb32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x387402,null))[_0xdb32('0x2c')](function(_0xb2a27a){if(_0xb2a27a){_0x4656d8=_0xb2a27a;_0x4db87b[_0xdb32('0x3c')]=_[_0xdb32('0x4e')](db[_0xdb32('0x70')][_0xdb32('0x38')]);_0x4db87b[_0xdb32('0x3d')]=_[_0xdb32('0x4e')](_0x5ea3e2['query']);_0x4db87b['filters']=_[_0xdb32('0x40')](_0x4db87b[_0xdb32('0x3c')],_0x4db87b[_0xdb32('0x3d')]);_0x34391f[_0xdb32('0x3f')]=_[_0xdb32('0x40')](_0x4db87b[_0xdb32('0x3c')],qs[_0xdb32('0x4f')](_0x5ea3e2[_0xdb32('0x3d')]['fields']));_0x34391f[_0xdb32('0x3f')]=_0x34391f[_0xdb32('0x3f')]['length']?_0x34391f[_0xdb32('0x3f')]:_0x4db87b['model'];_0x34391f[_0xdb32('0x61')]=qs[_0xdb32('0x43')](_0x5ea3e2[_0xdb32('0x3d')][_0xdb32('0x43')]);_0x34391f[_0xdb32('0x44')]=qs[_0xdb32('0x3e')](_[_0xdb32('0x45')](_0x5ea3e2[_0xdb32('0x3d')],_0x4db87b[_0xdb32('0x3e')]));_0x34391f[_0xdb32('0x44')]=_[_0xdb32('0x46')](_0x34391f['where'],{'$or':[{'ListId':_0xb2a27a['id']},{'ListId':null}]});if(_0x5ea3e2[_0xdb32('0x3d')][_0xdb32('0x62')]){_0x34391f[_0xdb32('0x44')]=_[_0xdb32('0x46')](_0x34391f['where'],{'$or':_[_0xdb32('0x36')](_0x34391f[_0xdb32('0x3f')],function(_0x1b81f2){var _0x4febf0={};_0x4febf0[_0x1b81f2]={'$like':'%'+_0x5ea3e2[_0xdb32('0x3d')][_0xdb32('0x62')]+'%'};return _0x4febf0;})});}_0x34391f=_['merge']({},_0x34391f,_0x5ea3e2[_0xdb32('0x48')]);return db[_0xdb32('0x70')][_0xdb32('0x9e')](_0x34391f);}})[_0xdb32('0x2c')](respondWithResult(_0x387402,null))[_0xdb32('0x58')](handleError(_0x387402,null));};exports[_0xdb32('0x9f')]=function(_0x429763,_0x204122){return db['CmCustomField'][_0xdb32('0x9e')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x204122,null))['then'](function(_0x1c4e90){return _0x1c4e90;})[_0xdb32('0x2c')](respondWithResult(_0x204122,null))[_0xdb32('0x58')](handleError(_0x204122,null));};exports[_0xdb32('0xa0')]=function(_0x40132f,_0x587f69,_0x5eb016){return db[_0xdb32('0x37')][_0xdb32('0x50')]({'where':{'id':_0x40132f['params']['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x587f69,null))[_0xdb32('0x2c')](function(_0x366abb){if(_0x366abb){return _0x366abb['addAgents'](_0x40132f[_0xdb32('0x52')][_0xdb32('0x64')],_[_0xdb32('0xa1')](_0x40132f[_0xdb32('0x52')],[_0xdb32('0x64'),'id'])||{})[_0xdb32('0xa2')](function(_0x4e9c52){for(var _0xc565cd=0x0;_0xc565cd<_0x40132f[_0xdb32('0x52')][_0xdb32('0x64')][_0xdb32('0x41')];_0xc565cd+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x40132f[_0xdb32('0x52')][_0xdb32('0x64')][_0xc565cd]),'CmListId':Number(_0x40132f['params']['id'])});}return _0x4e9c52;});}})[_0xdb32('0x2c')](respondWithResult(_0x587f69,null))[_0xdb32('0x58')](handleError(_0x587f69,null));};exports[_0xdb32('0xa3')]=function(_0x300663,_0x80961a,_0x1b781f){return db['CmList'][_0xdb32('0x50')]({'where':{'id':_0x300663[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x80961a,null))[_0xdb32('0x2c')](function(_0x294a20){if(_0x294a20){return _0x294a20[_0xdb32('0xa3')](_0x300663[_0xdb32('0x3d')]['ids'])[_0xdb32('0x2c')](function(){if(_[_0xdb32('0x68')](_0x300663[_0xdb32('0x3d')]['ids'])){for(var _0x5e2f51=0x0;_0x5e2f51<_0x300663[_0xdb32('0x3d')][_0xdb32('0x64')][_0xdb32('0x41')];_0x5e2f51+=0x1){socket[_0xdb32('0xa4')](_0xdb32('0xa5'),{'UserId':Number(_0x300663[_0xdb32('0x3d')][_0xdb32('0x64')][_0x5e2f51]),'CmListId':Number(_0x300663[_0xdb32('0x5a')]['id'])});}}else{socket[_0xdb32('0xa4')](_0xdb32('0xa5'),{'UserId':Number(_0x300663[_0xdb32('0x3d')][_0xdb32('0x64')]),'CmListId':Number(_0x300663['params']['id'])});}});}})[_0xdb32('0x2c')](respondWithStatusCode(_0x80961a,null))[_0xdb32('0x58')](handleError(_0x80961a,null));};exports['getAgents']=function(_0x470192,_0x1f48ec,_0x84474f){var _0x162beb={};var _0x35cf4a={};var _0x13dd64;var _0x2abe03;return db[_0xdb32('0x37')][_0xdb32('0x5f')]({'where':{'id':_0x470192[_0xdb32('0x5a')]['id']}})[_0xdb32('0x2c')](handleEntityNotFound(_0x1f48ec,null))[_0xdb32('0x2c')](function(_0x20fe29){if(_0x20fe29){_0x13dd64=_0x20fe29;_0x35cf4a[_0xdb32('0x3c')]=_[_0xdb32('0x4e')](db['User'][_0xdb32('0x38')]);_0x35cf4a[_0xdb32('0x3d')]=_[_0xdb32('0x4e')](_0x470192['query']);_0x35cf4a[_0xdb32('0x3e')]=_['intersection'](_0x35cf4a[_0xdb32('0x3c')],_0x35cf4a[_0xdb32('0x3d')]);_0x162beb[_0xdb32('0x3f')]=_['intersection'](_0x35cf4a['model'],qs['fields'](_0x470192['query'][_0xdb32('0x4f')]));_0x162beb[_0xdb32('0x3f')]=_0x162beb[_0xdb32('0x3f')][_0xdb32('0x41')]?_0x162beb[_0xdb32('0x3f')]:_0x35cf4a[_0xdb32('0x3c')];_0x162beb[_0xdb32('0x61')]=qs[_0xdb32('0x43')](_0x470192[_0xdb32('0x3d')]['sort']);_0x162beb[_0xdb32('0x44')]=qs[_0xdb32('0x3e')](_[_0xdb32('0x45')](_0x470192[_0xdb32('0x3d')],_0x35cf4a[_0xdb32('0x3e')]));if(_0x470192[_0xdb32('0x3d')][_0xdb32('0x62')]){_0x162beb[_0xdb32('0x44')]=_[_0xdb32('0x46')](_0x162beb['where'],{'$or':_['map'](_0x162beb[_0xdb32('0x3f')],function(_0x195da0){var _0x4954ad={};_0x4954ad[_0x195da0]={'$like':'%'+_0x470192[_0xdb32('0x3d')]['filter']+'%'};return _0x4954ad;})});}_0x162beb=_[_0xdb32('0x46')]({},_0x162beb,_0x470192[_0xdb32('0x48')]);return _0x13dd64[_0xdb32('0xa6')](_0x162beb);}})[_0xdb32('0x2c')](function(_0x3bcdd5){if(_0x3bcdd5){_0x2abe03=_0x3bcdd5[_0xdb32('0x41')];if(!_0x470192[_0xdb32('0x3d')][_0xdb32('0x60')]('nolimit')){_0x162beb['limit']=qs[_0xdb32('0x25')](_0x470192[_0xdb32('0x3d')][_0xdb32('0x25')]);_0x162beb[_0xdb32('0x22')]=qs[_0xdb32('0x22')](_0x470192[_0xdb32('0x3d')][_0xdb32('0x22')]);}return _0x13dd64[_0xdb32('0xa6')](_0x162beb);}})[_0xdb32('0x2c')](function(_0x5cc09b){if(_0x5cc09b){return _0x5cc09b?{'count':_0x2abe03,'rows':_0x5cc09b}:null;}})[_0xdb32('0x2c')](respondWithResult(_0x1f48ec,null))['catch'](handleError(_0x1f48ec,null));};function handleQuery(_0x11cd19){logger[_0xdb32('0xa7')](_0x11cd19);return db[_0xdb32('0x92')][_0xdb32('0x3d')](_0x11cd19)[_0xdb32('0xa2')](function(_0x34fc80){csv_results[_0xdb32('0x6a')](_0x34fc80);})[_0xdb32('0x58')](function(_0x3bc121){logger[_0xdb32('0x31')](_0x3bc121['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cb95b38..864cfd5 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x55ca,0x126));var _0xa55c=function(_0x246e1a,_0x30ee98){_0x246e1a=_0x246e1a-0x0;var _0x19a13c=_0x55ca[_0x246e1a];return _0x19a13c;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2b38f7,_0x3897af){var _0x4f8e27=function(_0x217360){while(--_0x217360){_0x2b38f7['push'](_0x2b38f7['shift']());}};_0x4f8e27(++_0x3897af);}(_0x814b,0x1a2));var _0xb814=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x814b[_0x34e752];return _0x7c6347;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index dc7bd73..829b9ce 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x24510e,_0x10061a){var _0x7861e3=function(_0x21d557){while(--_0x21d557){_0x24510e['push'](_0x24510e['shift']());}};_0x7861e3(++_0x10061a);}(_0xa8a8,0xec));var _0x8a8a=function(_0x327317,_0x3faa28){_0x327317=_0x327317-0x0;var _0x2acc1f=_0xa8a8[_0x327317];return _0x2acc1f;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x37e708,_0x1e8b54){var _0x398a09=function(_0xcda755){while(--_0xcda755){_0x37e708['push'](_0x37e708['shift']());}};_0x398a09(++_0x1e8b54);}(_0x6c76,0x184));var _0x66c7=function(_0x33d900,_0x51bb40){_0x33d900=_0x33d900-0x0;var _0x4b9209=_0x6c76[_0x33d900];return _0x4b9209;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 15cfa48..42f76f9 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 _0x2a65=['message','result','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc','defaults','socket.io-emitter','redis','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x337229,_0x390e5e){var _0x5c639a=function(_0x359e02){while(--_0x359e02){_0x337229['push'](_0x337229['shift']());}};_0x5c639a(++_0x390e5e);}(_0x2a65,0x129));var _0x52a6=function(_0xd598e9,_0x20cb54){_0xd598e9=_0xd598e9-0x0;var _0x12c224=_0x2a65[_0xd598e9];return _0x12c224;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52a6('0x0'));var fs=require('fs');var Redis=require(_0x52a6('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x52a6('0x2'));var logger=require(_0x52a6('0x3'))(_0x52a6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x52a6('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x52a6('0x6'))(new Redis(config[_0x52a6('0x7')]));require('./cmList.socket')[_0x52a6('0x8')](socket);function respondWithRpcPromise(_0x2a9a86,_0x33ca9b,_0x1ef513){return new BPromise(function(_0x1fc6b0,_0x5ac21d){return client[_0x52a6('0x9')](_0x2a9a86,_0x1ef513)['then'](function(_0x2b0975){logger[_0x52a6('0xa')](_0x52a6('0xb'),_0x33ca9b,_0x52a6('0xc'));logger[_0x52a6('0xd')](_0x52a6('0xe'),_0x33ca9b,_0x52a6('0xc'),JSON[_0x52a6('0xf')](_0x2b0975));if(_0x2b0975[_0x52a6('0x10')]){if(_0x2b0975[_0x52a6('0x10')][_0x52a6('0x11')]===0x1f4){logger['error'](_0x52a6('0xb'),_0x33ca9b,_0x2b0975[_0x52a6('0x10')]['message']);return _0x5ac21d(_0x2b0975['error'][_0x52a6('0x12')]);}logger[_0x52a6('0x10')]('CmList,\x20%s,\x20%s',_0x33ca9b,_0x2b0975['error'][_0x52a6('0x12')]);return _0x1fc6b0(_0x2b0975[_0x52a6('0x10')][_0x52a6('0x12')]);}else{logger[_0x52a6('0xa')](_0x52a6('0xb'),_0x33ca9b,_0x52a6('0xc'));_0x1fc6b0(_0x2b0975[_0x52a6('0x13')][_0x52a6('0x12')]);}})[_0x52a6('0x14')](function(_0x2ed311){logger['error'](_0x52a6('0xb'),_0x33ca9b,_0x2ed311);_0x5ac21d(_0x2ed311);});});} \ No newline at end of file +var _0x27c9=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1fdfb,_0x1a298c){var _0x27dafe=function(_0x36c36d){while(--_0x36c36d){_0x1fdfb['push'](_0x1fdfb['shift']());}};_0x27dafe(++_0x1a298c);}(_0x27c9,0x139));var _0x927c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x27c9[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x927c('0x0'));var moment=require(_0x927c('0x1'));var BPromise=require(_0x927c('0x2'));var rs=require(_0x927c('0x3'));var fs=require('fs');var Redis=require(_0x927c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x927c('0x5'));var logger=require(_0x927c('0x6'))(_0x927c('0x7'));var config=require(_0x927c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x927c('0x9')]['http']({'port':0x232a});config[_0x927c('0xa')]=_[_0x927c('0xb')](config[_0x927c('0xa')],{'host':_0x927c('0xc'),'port':0x18eb});var socket=require(_0x927c('0xd'))(new Redis(config['redis']));require(_0x927c('0xe'))[_0x927c('0xf')](socket);function respondWithRpcPromise(_0x988d76,_0x3217df,_0x4191f5){return new BPromise(function(_0x211131,_0x7be59c){return client[_0x927c('0x10')](_0x988d76,_0x4191f5)[_0x927c('0x11')](function(_0x32c069){logger[_0x927c('0x12')]('CmList,\x20%s,\x20%s',_0x3217df,_0x927c('0x13'));logger[_0x927c('0x14')](_0x927c('0x15'),_0x3217df,_0x927c('0x13'),JSON[_0x927c('0x16')](_0x32c069));if(_0x32c069[_0x927c('0x17')]){if(_0x32c069['error'][_0x927c('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3217df,_0x32c069[_0x927c('0x17')][_0x927c('0x19')]);return _0x7be59c(_0x32c069[_0x927c('0x17')][_0x927c('0x19')]);}logger[_0x927c('0x17')]('CmList,\x20%s,\x20%s',_0x3217df,_0x32c069[_0x927c('0x17')][_0x927c('0x19')]);return _0x211131(_0x32c069[_0x927c('0x17')][_0x927c('0x19')]);}else{logger[_0x927c('0x12')](_0x927c('0x1a'),_0x3217df,_0x927c('0x13'));_0x211131(_0x32c069[_0x927c('0x1b')]['message']);}})[_0x927c('0x1c')](function(_0x2694be){logger[_0x927c('0x17')](_0x927c('0x1a'),_0x3217df,_0x2694be);_0x7be59c(_0x2694be);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f37d97d..f0f2e08 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 _0xa2cc=['length','./cmList.events','remove','update','register'];(function(_0x2625c9,_0x40e731){var _0xc340e6=function(_0x2b214c){while(--_0x2b214c){_0x2625c9['push'](_0x2625c9['shift']());}};_0xc340e6(++_0x40e731);}(_0xa2cc,0x191));var _0xca2c=function(_0x3fb95d,_0x416522){_0x3fb95d=_0x3fb95d-0x0;var _0x493108=_0xa2cc[_0x3fb95d];return _0x493108;};'use strict';var CmListEvents=require(_0xca2c('0x0'));var events=['save',_0xca2c('0x1'),_0xca2c('0x2')];function createListener(_0x4350ec,_0x39174c){return function(_0x34cd69){_0x39174c['emit'](_0x4350ec,_0x34cd69);};}function removeListener(_0x1ac41b,_0xe7133f){return function(){CmListEvents['removeListener'](_0x1ac41b,_0xe7133f);};}exports[_0xca2c('0x3')]=function(_0x3f0d0c){for(var _0x3cf801=0x0,_0x34f8da=events[_0xca2c('0x4')];_0x3cf801<_0x34f8da;_0x3cf801++){var _0x401bfa=events[_0x3cf801];var _0x4a5cf2=createListener('cmList:'+_0x401bfa,_0x3f0d0c);CmListEvents['on'](_0x401bfa,_0x4a5cf2);}}; \ No newline at end of file +var _0x67b0=['register','length','./cmList.events','save','update','removeListener'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x67b0,0xda));var _0x067b=function(_0x2729b1,_0x1c40aa){_0x2729b1=_0x2729b1-0x0;var _0x5a54d9=_0x67b0[_0x2729b1];return _0x5a54d9;};'use strict';var CmListEvents=require(_0x067b('0x0'));var events=[_0x067b('0x1'),'remove',_0x067b('0x2')];function createListener(_0xff59e1,_0x227115){return function(_0x30ec2c){_0x227115['emit'](_0xff59e1,_0x30ec2c);};}function removeListener(_0x3cb30e,_0x42def1){return function(){CmListEvents[_0x067b('0x3')](_0x3cb30e,_0x42def1);};}exports[_0x067b('0x4')]=function(_0x4fbd31){for(var _0x44fe20=0x0,_0x529e72=events[_0x067b('0x5')];_0x44fe20<_0x529e72;_0x44fe20++){var _0x47aabd=events[_0x44fe20];var _0x25914d=createListener('cmList:'+_0x47aabd,_0x4fbd31);CmListEvents['on'](_0x47aabd,_0x25914d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index dfd992d..bc604b9 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 _0xa7eb=['post','create','addDisposition','/:id/contacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents'];(function(_0x298295,_0x2e832d){var _0x259367=function(_0x147284){while(--_0x147284){_0x298295['push'](_0x298295['shift']());}};_0x259367(++_0x2e832d);}(_0xa7eb,0x1d5));var _0xba7e=function(_0x12bc4b,_0x32089f){_0x12bc4b=_0x12bc4b-0x0;var _0x341b0f=_0xa7eb[_0x12bc4b];return _0x341b0f;};'use strict';var multer=require(_0xba7e('0x0'));var util=require('util');var path=require(_0xba7e('0x1'));var timeout=require(_0xba7e('0x2'));var express=require(_0xba7e('0x3'));var router=express[_0xba7e('0x4')]();var fs_extra=require(_0xba7e('0x5'));var auth=require(_0xba7e('0x6'));var interaction=require(_0xba7e('0x7'));var config=require(_0xba7e('0x8'));var controller=require(_0xba7e('0x9'));router['get']('/',auth[_0xba7e('0xa')](),controller[_0xba7e('0xb')]);router['get'](_0xba7e('0xc'),auth[_0xba7e('0xa')](),controller[_0xba7e('0xd')]);router[_0xba7e('0xe')](_0xba7e('0xf'),auth[_0xba7e('0xa')](),controller['getGlobalCustomFields']);router[_0xba7e('0xe')](_0xba7e('0x10'),auth['isAuthenticated'](),controller[_0xba7e('0x11')]);router[_0xba7e('0xe')](_0xba7e('0x12'),auth['isAuthenticated'](),controller[_0xba7e('0x13')]);router[_0xba7e('0xe')]('/:id/contacts',auth[_0xba7e('0xa')](),controller['getContacts']);router['get'](_0xba7e('0x14'),auth['isAuthenticated'](),controller[_0xba7e('0x15')]);router[_0xba7e('0xe')](_0xba7e('0x16'),auth['isAuthenticated'](),controller[_0xba7e('0x17')]);router['get']('/:id/users',auth[_0xba7e('0xa')](),controller[_0xba7e('0x18')]);router[_0xba7e('0x19')]('/',auth[_0xba7e('0xa')](),controller[_0xba7e('0x1a')]);router[_0xba7e('0x19')](_0xba7e('0x12'),auth[_0xba7e('0xa')](),controller[_0xba7e('0x1b')]);router['post'](_0xba7e('0x1c'),auth[_0xba7e('0xa')](),controller['addContacts']);router['post'](_0xba7e('0x16'),auth[_0xba7e('0xa')](),controller[_0xba7e('0x1d')]);router[_0xba7e('0x19')](_0xba7e('0x1e'),auth[_0xba7e('0xa')](),controller[_0xba7e('0x1f')]);router[_0xba7e('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xba7e('0x21')]);router[_0xba7e('0x22')](_0xba7e('0x10'),auth[_0xba7e('0xa')](),controller[_0xba7e('0x23')]);router[_0xba7e('0x22')](_0xba7e('0x12'),auth[_0xba7e('0xa')](),controller[_0xba7e('0x24')]);router[_0xba7e('0x22')](_0xba7e('0x1e'),auth[_0xba7e('0xa')](),controller['removeAgents']);module[_0xba7e('0x25')]=router; \ No newline at end of file +var _0xe222=['addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition'];(function(_0x41a30a,_0x567cc3){var _0x36aa05=function(_0x2490b8){while(--_0x2490b8){_0x41a30a['push'](_0x41a30a['shift']());}};_0x36aa05(++_0x567cc3);}(_0xe222,0x18e));var _0x2e22=function(_0x27a1e0,_0x3ff2cb){_0x27a1e0=_0x27a1e0-0x0;var _0x1ca624=_0xe222[_0x27a1e0];return _0x1ca624;};'use strict';var multer=require(_0x2e22('0x0'));var util=require('util');var path=require(_0x2e22('0x1'));var timeout=require(_0x2e22('0x2'));var express=require(_0x2e22('0x3'));var router=express[_0x2e22('0x4')]();var fs_extra=require(_0x2e22('0x5'));var auth=require(_0x2e22('0x6'));var interaction=require(_0x2e22('0x7'));var config=require(_0x2e22('0x8'));var controller=require(_0x2e22('0x9'));router[_0x2e22('0xa')]('/',auth[_0x2e22('0xb')](),controller[_0x2e22('0xc')]);router[_0x2e22('0xa')](_0x2e22('0xd'),auth[_0x2e22('0xb')](),controller[_0x2e22('0xe')]);router[_0x2e22('0xa')]('/global_fields',auth[_0x2e22('0xb')](),controller[_0x2e22('0xf')]);router[_0x2e22('0xa')](_0x2e22('0x10'),auth['isAuthenticated'](),controller[_0x2e22('0x11')]);router[_0x2e22('0xa')](_0x2e22('0x12'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x13')]);router['get'](_0x2e22('0x14'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x15')]);router[_0x2e22('0xa')](_0x2e22('0x16'),auth['isAuthenticated'](),controller[_0x2e22('0x17')]);router[_0x2e22('0xa')](_0x2e22('0x18'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x19')]);router[_0x2e22('0xa')](_0x2e22('0x1a'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x1b')]);router[_0x2e22('0x1c')]('/',auth[_0x2e22('0xb')](),controller[_0x2e22('0x1d')]);router['post'](_0x2e22('0x12'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x1e')]);router[_0x2e22('0x1c')](_0x2e22('0x14'),auth['isAuthenticated'](),controller[_0x2e22('0x1f')]);router[_0x2e22('0x1c')](_0x2e22('0x18'),auth['isAuthenticated'](),controller[_0x2e22('0x20')]);router[_0x2e22('0x1c')](_0x2e22('0x1a'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x21')]);router['put'](_0x2e22('0x10'),auth['isAuthenticated'](),controller[_0x2e22('0x22')]);router[_0x2e22('0x23')]('/:id',auth[_0x2e22('0xb')](),controller[_0x2e22('0x24')]);router[_0x2e22('0x23')](_0x2e22('0x12'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x25')]);router['delete'](_0x2e22('0x1a'),auth[_0x2e22('0xb')](),controller['removeAgents']);module[_0x2e22('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9847cc8..5c158df 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 _0x3a05=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4925f7,_0x3d4e6b){var _0x4cbb3f=function(_0x1e017c){while(--_0x1e017c){_0x4925f7['push'](_0x4925f7['shift']());}};_0x4cbb3f(++_0x3d4e6b);}(_0x3a05,0xc8));var _0x53a0=function(_0x32fda1,_0x407c75){_0x32fda1=_0x32fda1-0x0;var _0x3f57da=_0x3a05[_0x32fda1];return _0x3f57da;};'use strict';var Sequelize=require('sequelize');module[_0x53a0('0x0')]={'name':{'type':Sequelize[_0x53a0('0x1')],'get':function(_0x30fb68){return this[_0x53a0('0x2')](_0x53a0('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x53a0('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x53a0('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xdc21=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x3baa44,_0x38655f){var _0x24c6db=function(_0xce5a8e){while(--_0xce5a8e){_0x3baa44['push'](_0x3baa44['shift']());}};_0x24c6db(++_0x38655f);}(_0xdc21,0x125));var _0x1dc2=function(_0x2bf60b,_0x4968df){_0x2bf60b=_0x2bf60b-0x0;var _0x562fd8=_0xdc21[_0x2bf60b];return _0x562fd8;};'use strict';var Sequelize=require(_0x1dc2('0x0'));module[_0x1dc2('0x1')]={'name':{'type':Sequelize[_0x1dc2('0x2')],'get':function(_0x347d4e){return this['getDataValue'](_0x1dc2('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x1dc2('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7de5373..6eb85e6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3815d5,_0x1c55bc){var _0x43eb53=function(_0x3b3ebf){while(--_0x3b3ebf){_0x3815d5['push'](_0x3815d5['shift']());}};_0x43eb53(++_0x1c55bc);}(_0x7a54,0x106));var _0x47a5=function(_0x1c231f,_0x261cc4){_0x1c231f=_0x1c231f-0x0;var _0x42b5e3=_0x7a54[_0x1c231f];return _0x42b5e3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x439dac,_0x37403f){var _0x3a1365=function(_0x2cd1ec){while(--_0x2cd1ec){_0x439dac['push'](_0x439dac['shift']());}};_0x3a1365(++_0x37403f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 02a4f1e..c94f6b8 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 _0xcd0a=['bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','tools_conditions','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd0a,0x102));var _0xacd0=function(_0x3a0a14,_0x3a1216){_0x3a0a14=_0x3a0a14-0x0;var _0x2844ee=_0xcd0a[_0x3a0a14];return _0x2844ee;};'use strict';var _=require('lodash');var util=require(_0xacd0('0x0'));var logger=require(_0xacd0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xacd0('0x2'));var rp=require(_0xacd0('0x3'));var fs=require('fs');var path=require(_0xacd0('0x4'));var rimraf=require(_0xacd0('0x5'));var config=require('../../config/environment');var attributes=require(_0xacd0('0x6'));module[_0xacd0('0x7')]=function(_0x492c1b,_0xfa3fec){return _0x492c1b[_0xacd0('0x8')]('Condition',attributes,{'tableName':_0xacd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea7b=['define','Condition','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x4893ab,_0xf0483){var _0x17345d=function(_0x41a413){while(--_0x41a413){_0x4893ab['push'](_0x4893ab['shift']());}};_0x17345d(++_0xf0483);}(_0xea7b,0xac));var _0xbea7=function(_0x26d753,_0x9daa90){_0x26d753=_0x26d753-0x0;var _0x10d5f0=_0xea7b[_0x26d753];return _0x10d5f0;};'use strict';var _=require('lodash');var util=require(_0xbea7('0x0'));var logger=require(_0xbea7('0x1'))(_0xbea7('0x2'));var moment=require(_0xbea7('0x3'));var BPromise=require('bluebird');var rp=require(_0xbea7('0x4'));var fs=require('fs');var path=require(_0xbea7('0x5'));var rimraf=require(_0xbea7('0x6'));var config=require(_0xbea7('0x7'));var attributes=require(_0xbea7('0x8'));module[_0xbea7('0x9')]=function(_0x441462,_0x1287fe){return _0x441462[_0xbea7('0xa')](_0xbea7('0xb'),attributes,{'tableName':_0xbea7('0xc'),'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 b7f7d36..712096d 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 _0x4b7c=['debug','stringify','error','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x26588b,_0x12a550){var _0x558cb5=function(_0xfd9a62){while(--_0xfd9a62){_0x26588b['push'](_0x26588b['shift']());}};_0x558cb5(++_0x12a550);}(_0x4b7c,0x85));var _0xc4b7=function(_0x4106b4,_0x32cd77){_0x4106b4=_0x4106b4-0x0;var _0x4c4add=_0x4b7c[_0x4106b4];return _0x4c4add;};'use strict';var _=require(_0xc4b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4b7('0x2'));var db=require(_0xc4b7('0x3'))['db'];var utils=require(_0xc4b7('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc4b7('0x5'));var client=jayson['client'][_0xc4b7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x83dfe,_0x12b51f,_0x480aa8){return new BPromise(function(_0x32153b,_0x3a729c){return client[_0xc4b7('0x7')](_0x83dfe,_0x480aa8)[_0xc4b7('0x8')](function(_0x3e19a0){logger['info'](_0xc4b7('0x9'),_0x12b51f,_0xc4b7('0xa'));logger[_0xc4b7('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x12b51f,_0xc4b7('0xa'),JSON[_0xc4b7('0xc')](_0x3e19a0));if(_0x3e19a0['error']){if(_0x3e19a0[_0xc4b7('0xd')]['code']===0x1f4){logger[_0xc4b7('0xd')]('Condition,\x20%s,\x20%s',_0x12b51f,_0x3e19a0[_0xc4b7('0xd')][_0xc4b7('0xe')]);return _0x3a729c(_0x3e19a0[_0xc4b7('0xd')][_0xc4b7('0xe')]);}logger['error'](_0xc4b7('0x9'),_0x12b51f,_0x3e19a0[_0xc4b7('0xd')][_0xc4b7('0xe')]);return _0x32153b(_0x3e19a0[_0xc4b7('0xd')][_0xc4b7('0xe')]);}else{logger[_0xc4b7('0xf')]('Condition,\x20%s,\x20%s',_0x12b51f,_0xc4b7('0xa'));_0x32153b(_0x3e19a0[_0xc4b7('0x10')][_0xc4b7('0xe')]);}})[_0xc4b7('0x11')](function(_0x5822b5){logger[_0xc4b7('0xd')](_0xc4b7('0x9'),_0x12b51f,_0x5822b5);_0x3a729c(_0x5822b5);});});} \ No newline at end of file +var _0xbfe4=['then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xbfe4,0x120));var _0x4bfe=function(_0x428c38,_0x1801c5){_0x428c38=_0x428c38-0x0;var _0x5913bb=_0xbfe4[_0x428c38];return _0x5913bb;};'use strict';var _=require(_0x4bfe('0x0'));var util=require(_0x4bfe('0x1'));var moment=require('moment');var BPromise=require(_0x4bfe('0x2'));var rs=require(_0x4bfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bfe('0x4'))['db'];var utils=require(_0x4bfe('0x5'));var logger=require('../../config/logger')(_0x4bfe('0x6'));var config=require(_0x4bfe('0x7'));var jayson=require(_0x4bfe('0x8'));var client=jayson[_0x4bfe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6327,_0x592bbf,_0x7e5f75){return new BPromise(function(_0x155a13,_0x4a4121){return client[_0x4bfe('0xa')](_0x1a6327,_0x7e5f75)[_0x4bfe('0xb')](function(_0x1fd5fd){logger[_0x4bfe('0xc')](_0x4bfe('0xd'),_0x592bbf,_0x4bfe('0xe'));logger[_0x4bfe('0xf')](_0x4bfe('0x10'),_0x592bbf,'request\x20sent',JSON[_0x4bfe('0x11')](_0x1fd5fd));if(_0x1fd5fd['error']){if(_0x1fd5fd[_0x4bfe('0x12')][_0x4bfe('0x13')]===0x1f4){logger[_0x4bfe('0x12')]('Condition,\x20%s,\x20%s',_0x592bbf,_0x1fd5fd[_0x4bfe('0x12')][_0x4bfe('0x14')]);return _0x4a4121(_0x1fd5fd['error'][_0x4bfe('0x14')]);}logger[_0x4bfe('0x12')]('Condition,\x20%s,\x20%s',_0x592bbf,_0x1fd5fd[_0x4bfe('0x12')][_0x4bfe('0x14')]);return _0x155a13(_0x1fd5fd[_0x4bfe('0x12')][_0x4bfe('0x14')]);}else{logger['info'](_0x4bfe('0xd'),_0x592bbf,_0x4bfe('0xe'));_0x155a13(_0x1fd5fd[_0x4bfe('0x15')][_0x4bfe('0x14')]);}})[_0x4bfe('0x16')](function(_0x2e117a){logger[_0x4bfe('0x12')]('Condition,\x20%s,\x20%s',_0x592bbf,_0x2e117a);_0x4a4121(_0x2e117a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e9f087a..ab01caa 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 _0x1fe0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x211448,_0x333996){var _0x162266=function(_0x18269f){while(--_0x18269f){_0x211448['push'](_0x211448['shift']());}};_0x162266(++_0x333996);}(_0x1fe0,0x1e8));var _0x01fe=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x1fe0[_0x47242d];return _0x30273a;};'use strict';var multer=require(_0x01fe('0x0'));var util=require(_0x01fe('0x1'));var path=require('path');var timeout=require(_0x01fe('0x2'));var express=require(_0x01fe('0x3'));var router=express[_0x01fe('0x4')]();var fs_extra=require(_0x01fe('0x5'));var auth=require(_0x01fe('0x6'));var interaction=require(_0x01fe('0x7'));var config=require(_0x01fe('0x8'));var controller=require(_0x01fe('0x9'));router[_0x01fe('0xa')](_0x01fe('0xb'),auth['isAuthenticated'](),controller[_0x01fe('0xc')]);router[_0x01fe('0xd')](_0x01fe('0xb'),auth[_0x01fe('0xe')](),controller[_0x01fe('0xf')]);module[_0x01fe('0x10')]=router; \ No newline at end of file +var _0xb31a=['/:id','isAuthenticated','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x36af16,_0xad766b){var _0xb6ae7a=function(_0x5d4bf3){while(--_0x5d4bf3){_0x36af16['push'](_0x36af16['shift']());}};_0xb6ae7a(++_0xad766b);}(_0xb31a,0xd4));var _0xab31=function(_0xb06465,_0x38abc7){_0xb06465=_0xb06465-0x0;var _0x55e622=_0xb31a[_0xb06465];return _0x55e622;};'use strict';var multer=require(_0xab31('0x0'));var util=require('util');var path=require(_0xab31('0x1'));var timeout=require(_0xab31('0x2'));var express=require('express');var router=express[_0xab31('0x3')]();var fs_extra=require(_0xab31('0x4'));var auth=require(_0xab31('0x5'));var interaction=require(_0xab31('0x6'));var config=require(_0xab31('0x7'));var controller=require('./condition.controller');router[_0xab31('0x8')](_0xab31('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xab31('0x9'),auth[_0xab31('0xa')](),controller[_0xab31('0xb')]);module[_0xab31('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 009d1c9..d2949d4 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 _0xcc40=['STRING','name','INTEGER','exports'];(function(_0x4ffa5e,_0x24883e){var _0x54c2e9=function(_0x3ced90){while(--_0x3ced90){_0x4ffa5e['push'](_0x4ffa5e['shift']());}};_0x54c2e9(++_0x24883e);}(_0xcc40,0x1ef));var _0x0cc4=function(_0x22d995,_0x4981ab){_0x22d995=_0x22d995-0x0;var _0x1e7df8=_0xcc40[_0x22d995];return _0x1e7df8;};'use strict';var Sequelize=require('sequelize');module[_0x0cc4('0x0')]={'name':{'type':Sequelize[_0x0cc4('0x1')],'allowNull':![],'unique':_0x0cc4('0x2')},'OrderBy':{'type':Sequelize[_0x0cc4('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0cc4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8a6e=['INTEGER','STRING','name'];(function(_0x2c52c5,_0x82e8ba){var _0x343640=function(_0x19d409){while(--_0x19d409){_0x2c52c5['push'](_0x2c52c5['shift']());}};_0x343640(++_0x82e8ba);}(_0x8a6e,0x16c));var _0xe8a6=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x8a6e[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe8a6('0x0')],'allowNull':![],'unique':_0xe8a6('0x1')},'OrderBy':{'type':Sequelize[_0xe8a6('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe8a6('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0293f9d..a76e0d0 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 _0xda2d=['sort','where','filter','map','options','includeAll','rows','catch','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','stack','name','send','index','ContactItemType','type','model','keys','query','filters','intersection','attributes','fields','length','order'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xda2d,0x102));var _0xdda2=function(_0x400f76,_0x4a92da){_0x400f76=_0x400f76-0x0;var _0x3c0f2f=_0xda2d[_0x400f76];return _0x3c0f2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){var _0x5739ad=_0x2528d7[_0xdda2('0x28')]({'plain':!![]});var _0x4be5ea=_0xdda2('0x29');return db[_0xdda2('0x2a')]['destroy']({'where':{'type':_0x4be5ea,'resourceId':_0x5739ad['id']}})['then'](function(){return _0x2528d7;});})[_0xdda2('0x26')](function(){_0x144f1e[_0xdda2('0x1a')](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x5e9e74,_0x90d919){return function(_0x5d26ae){if(!_0x5d26ae){_0x5e9e74[_0xdda2('0x19')](0x194);}return _0x5d26ae;};}function handleError(_0xe53dee,_0xe16ec7){_0xe16ec7=_0xe16ec7||0x1f4;return function(_0x91b41a){logger['error'](_0x91b41a[_0xdda2('0x2b')]);if(_0x91b41a[_0xdda2('0x2c')]){delete _0x91b41a['name'];}_0xe53dee[_0xdda2('0x1a')](_0xe16ec7)[_0xdda2('0x2d')](_0x91b41a);};}exports[_0xdda2('0x2e')]=function(_0x15e511,_0x5540e5){var _0x129eba={},_0x5e107f={},_0x4b19b7={'count':0x0,'rows':[]};var _0x1ca9f3=_['map'](db[_0xdda2('0x2f')]['rawAttributes'],function(_0x53ff76){return{'name':_0x53ff76['fieldName'],'type':_0x53ff76[_0xdda2('0x30')]['key']};});_0x5e107f[_0xdda2('0x31')]=_['map'](_0x1ca9f3,'name');_0x5e107f['query']=_[_0xdda2('0x32')](_0x15e511[_0xdda2('0x33')]);_0x5e107f[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],_0x5e107f[_0xdda2('0x33')]);_0x129eba[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],qs[_0xdda2('0x37')](_0x15e511['query'][_0xdda2('0x37')]));_0x129eba[_0xdda2('0x36')]=_0x129eba[_0xdda2('0x36')][_0xdda2('0x38')]?_0x129eba[_0xdda2('0x36')]:_0x5e107f[_0xdda2('0x31')];if(!_0x15e511[_0xdda2('0x33')]['hasOwnProperty']('nolimit')){_0x129eba[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x15e511[_0xdda2('0x33')]['limit']);_0x129eba['offset']=qs[_0xdda2('0x1c')](_0x15e511[_0xdda2('0x33')][_0xdda2('0x1c')]);}_0x129eba[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x15e511['query'][_0xdda2('0x3a')]);_0x129eba[_0xdda2('0x3b')]=qs['filters'](_['pick'](_0x15e511[_0xdda2('0x33')],_0x5e107f[_0xdda2('0x34')]),_0x1ca9f3);if(_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]){_0x129eba[_0xdda2('0x3b')]=_['merge'](_0x129eba[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3d')](_0x1ca9f3,function(_0x7dac2c){if(_0x7dac2c[_0xdda2('0x30')]!=='VIRTUAL'){var _0x4dc38f={};_0x4dc38f[_0x7dac2c[_0xdda2('0x2c')]]={'$like':'%'+_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0x4dc38f;}})});}_0x129eba=_['merge']({},_0x129eba,_0x15e511[_0xdda2('0x3e')]);var _0x542ceb={'where':_0x129eba[_0xdda2('0x3b')]};return db['ContactItemType'][_0xdda2('0x1e')](_0x542ceb)[_0xdda2('0x26')](function(_0x1db762){_0x4b19b7[_0xdda2('0x1e')]=_0x1db762;if(_0x15e511['query'][_0xdda2('0x3f')]){_0x129eba['include']=[{'all':!![]}];}return db[_0xdda2('0x2f')]['findAll'](_0x129eba);})[_0xdda2('0x26')](function(_0x12589b){_0x4b19b7[_0xdda2('0x40')]=_0x12589b;return _0x4b19b7;})[_0xdda2('0x26')](respondWithFilteredResult(_0x5540e5,_0x129eba))[_0xdda2('0x41')](handleError(_0x5540e5,null));};exports['show']=function(_0x1e29dc,_0x15a616){var _0x54735b={'raw':!![],'where':{'id':_0x1e29dc['params']['id']}},_0x2caced={};_0x2caced[_0xdda2('0x31')]=_[_0xdda2('0x32')](db[_0xdda2('0x2f')][_0xdda2('0x42')]);_0x2caced[_0xdda2('0x33')]=_[_0xdda2('0x32')](_0x1e29dc[_0xdda2('0x33')]);_0x2caced[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x2caced[_0xdda2('0x31')],_0x2caced[_0xdda2('0x33')]);_0x54735b[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x2caced['model'],qs['fields'](_0x1e29dc['query'][_0xdda2('0x37')]));_0x54735b[_0xdda2('0x36')]=_0x54735b['attributes'][_0xdda2('0x38')]?_0x54735b[_0xdda2('0x36')]:_0x2caced[_0xdda2('0x31')];if(_0x1e29dc['query'][_0xdda2('0x3f')]){_0x54735b[_0xdda2('0x43')]=[{'all':!![]}];}_0x54735b=_['merge']({},_0x54735b,_0x1e29dc['options']);return db[_0xdda2('0x2f')]['find'](_0x54735b)[_0xdda2('0x26')](handleEntityNotFound(_0x15a616,null))['then'](respondWithResult(_0x15a616,null))[_0xdda2('0x41')](handleError(_0x15a616,null));};exports[_0xdda2('0x44')]=function(_0x50bd88,_0x585665){return db[_0xdda2('0x2f')][_0xdda2('0x44')](_0x50bd88[_0xdda2('0x45')],{})[_0xdda2('0x26')](function(_0x578a6c){var _0x1edbc6=_0x50bd88[_0xdda2('0x46')][_0xdda2('0x28')]({'plain':!![]});if(!_0x1edbc6)throw new Error(_0xdda2('0x47'));if(_0x1edbc6[_0xdda2('0x48')]==='user'){var _0x1a56cc=_0x578a6c[_0xdda2('0x28')]({'plain':!![]});var _0x51f2b6=_0xdda2('0x29');return db[_0xdda2('0x49')][_0xdda2('0x4a')]({'where':{'name':_0x51f2b6,'userProfileId':_0x1edbc6[_0xdda2('0x4b')]},'raw':!![]})[_0xdda2('0x26')](function(_0x265169){if(_0x265169&&_0x265169['autoAssociation']===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x1a56cc[_0xdda2('0x2c')],'resourceId':_0x1a56cc['id'],'type':_0x265169['name'],'sectionId':_0x265169['id']},{})[_0xdda2('0x26')](function(){return _0x578a6c;});}else{return _0x578a6c;}})['catch'](function(_0x3b5bbf){logger[_0xdda2('0x4c')](_0xdda2('0x4d'),_0x3b5bbf);throw _0x3b5bbf;});}return _0x578a6c;})[_0xdda2('0x26')](respondWithResult(_0x585665,0xc9))[_0xdda2('0x41')](handleError(_0x585665,null));};exports[_0xdda2('0x25')]=function(_0x471b86,_0x40655d){if(_0x471b86['body']['id']){delete _0x471b86[_0xdda2('0x45')]['id'];}return db[_0xdda2('0x2f')][_0xdda2('0x4a')]({'where':{'id':_0x471b86['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x40655d,null))[_0xdda2('0x26')](saveUpdates(_0x471b86['body'],null))[_0xdda2('0x26')](respondWithResult(_0x40655d,null))['catch'](handleError(_0x40655d,null));};exports[_0xdda2('0x27')]=function(_0x10fbac,_0x378704){return db[_0xdda2('0x2f')][_0xdda2('0x4a')]({'where':{'id':_0x10fbac['params']['id']}})['then'](handleEntityNotFound(_0x378704,null))['then'](db[_0xdda2('0x4e')][_0xdda2('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x10fbac['params']['id']}}))[_0xdda2('0x26')](removeEntity(_0x378704,null))[_0xdda2('0x41')](handleError(_0x378704,null));}; \ No newline at end of file +var _0x7880=['pick','filter','merge','includeAll','include','rows','params','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','ContactItemTypes','sendStatus','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','where'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x7880,0x1f4));var _0x0788=function(_0x508d1,_0xc0c0e5){_0x508d1=_0x508d1-0x0;var _0x322d8d=_0x7880[_0x508d1];return _0x322d8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){var _0x50b65c=_0x79204e['get']({'plain':!![]});var _0x240459=_0x0788('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x240459,'resourceId':_0x50b65c['id']}})[_0x0788('0x26')](function(){return _0x79204e;});})[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)[_0x0788('0x1b')]();});}};}function handleEntityNotFound(_0x40e7a6,_0x467d52){return function(_0x18fc0e){if(!_0x18fc0e){_0x40e7a6[_0x0788('0x29')](0x194);}return _0x18fc0e;};}function handleError(_0xb2f4a5,_0x6bf651){_0x6bf651=_0x6bf651||0x1f4;return function(_0x3ffe4f){logger['error'](_0x3ffe4f['stack']);if(_0x3ffe4f[_0x0788('0x2a')]){delete _0x3ffe4f[_0x0788('0x2a')];}_0xb2f4a5['status'](_0x6bf651)['send'](_0x3ffe4f);};}exports[_0x0788('0x2b')]=function(_0x68658a,_0x20fcd8){var _0x436031={},_0x44cbfb={},_0x44bff2={'count':0x0,'rows':[]};var _0x327d67=_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x5ec0ed){return{'name':_0x5ec0ed[_0x0788('0x2f')],'type':_0x5ec0ed[_0x0788('0x30')][_0x0788('0x31')]};});_0x44cbfb[_0x0788('0x32')]=_[_0x0788('0x2c')](_0x327d67,_0x0788('0x2a'));_0x44cbfb[_0x0788('0x33')]=_[_0x0788('0x34')](_0x68658a[_0x0788('0x33')]);_0x44cbfb[_0x0788('0x35')]=_['intersection'](_0x44cbfb['model'],_0x44cbfb['query']);_0x436031['attributes']=_['intersection'](_0x44cbfb['model'],qs[_0x0788('0x36')](_0x68658a[_0x0788('0x33')][_0x0788('0x36')]));_0x436031['attributes']=_0x436031[_0x0788('0x37')][_0x0788('0x38')]?_0x436031[_0x0788('0x37')]:_0x44cbfb[_0x0788('0x32')];if(!_0x68658a['query'][_0x0788('0x39')]('nolimit')){_0x436031[_0x0788('0x1f')]=qs['limit'](_0x68658a[_0x0788('0x33')][_0x0788('0x1f')]);_0x436031['offset']=qs[_0x0788('0x1c')](_0x68658a[_0x0788('0x33')]['offset']);}_0x436031[_0x0788('0x3a')]=qs['sort'](_0x68658a[_0x0788('0x33')]['sort']);_0x436031[_0x0788('0x3b')]=qs['filters'](_[_0x0788('0x3c')](_0x68658a['query'],_0x44cbfb['filters']),_0x327d67);if(_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]){_0x436031[_0x0788('0x3b')]=_[_0x0788('0x3e')](_0x436031[_0x0788('0x3b')],{'$or':_['map'](_0x327d67,function(_0x530c5a){if(_0x530c5a['type']!=='VIRTUAL'){var _0x501dd5={};_0x501dd5[_0x530c5a[_0x0788('0x2a')]]={'$like':'%'+_0x68658a[_0x0788('0x33')][_0x0788('0x3d')]+'%'};return _0x501dd5;}})});}_0x436031=_[_0x0788('0x3e')]({},_0x436031,_0x68658a['options']);var _0x4c7833={'where':_0x436031[_0x0788('0x3b')]};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x4c7833)[_0x0788('0x26')](function(_0x236b63){_0x44bff2[_0x0788('0x1e')]=_0x236b63;if(_0x68658a[_0x0788('0x33')][_0x0788('0x3f')]){_0x436031[_0x0788('0x40')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x436031);})[_0x0788('0x26')](function(_0x1d579d){_0x44bff2[_0x0788('0x41')]=_0x1d579d;return _0x44bff2;})['then'](respondWithFilteredResult(_0x20fcd8,_0x436031))['catch'](handleError(_0x20fcd8,null));};exports['show']=function(_0x172424,_0x150c1e){var _0x25501b={'raw':!![],'where':{'id':_0x172424[_0x0788('0x42')]['id']}},_0x189d33={};_0x189d33[_0x0788('0x32')]=_[_0x0788('0x34')](db[_0x0788('0x2d')]['rawAttributes']);_0x189d33[_0x0788('0x33')]=_[_0x0788('0x34')](_0x172424[_0x0788('0x33')]);_0x189d33[_0x0788('0x35')]=_['intersection'](_0x189d33[_0x0788('0x32')],_0x189d33[_0x0788('0x33')]);_0x25501b['attributes']=_['intersection'](_0x189d33['model'],qs[_0x0788('0x36')](_0x172424['query'][_0x0788('0x36')]));_0x25501b[_0x0788('0x37')]=_0x25501b[_0x0788('0x37')][_0x0788('0x38')]?_0x25501b[_0x0788('0x37')]:_0x189d33[_0x0788('0x32')];if(_0x172424[_0x0788('0x33')][_0x0788('0x3f')]){_0x25501b['include']=[{'all':!![]}];}_0x25501b=_['merge']({},_0x25501b,_0x172424[_0x0788('0x43')]);return db[_0x0788('0x2d')][_0x0788('0x44')](_0x25501b)['then'](handleEntityNotFound(_0x150c1e,null))[_0x0788('0x26')](respondWithResult(_0x150c1e,null))[_0x0788('0x45')](handleError(_0x150c1e,null));};exports[_0x0788('0x46')]=function(_0x4563cd,_0x2395ad){return db['ContactItemType']['create'](_0x4563cd[_0x0788('0x47')],{})[_0x0788('0x26')](function(_0x5f1542){var _0x2b1479=_0x4563cd['user'][_0x0788('0x48')]({'plain':!![]});if(!_0x2b1479)throw new Error(_0x0788('0x49'));if(_0x2b1479[_0x0788('0x4a')]===_0x0788('0x4b')){var _0x3c757a=_0x5f1542[_0x0788('0x48')]({'plain':!![]});var _0x1722d4=_0x0788('0x28');return db['UserProfileSection'][_0x0788('0x44')]({'where':{'name':_0x1722d4,'userProfileId':_0x2b1479[_0x0788('0x4c')]},'raw':!![]})[_0x0788('0x26')](function(_0x5ef557){if(_0x5ef557&&_0x5ef557[_0x0788('0x4d')]===0x0){return db[_0x0788('0x4e')]['create']({'name':_0x3c757a[_0x0788('0x2a')],'resourceId':_0x3c757a['id'],'type':_0x5ef557[_0x0788('0x2a')],'sectionId':_0x5ef557['id']},{})[_0x0788('0x26')](function(){return _0x5f1542;});}else{return _0x5f1542;}})[_0x0788('0x45')](function(_0x137e24){logger[_0x0788('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x137e24);throw _0x137e24;});}return _0x5f1542;})['then'](respondWithResult(_0x2395ad,0xc9))[_0x0788('0x45')](handleError(_0x2395ad,null));};exports[_0x0788('0x25')]=function(_0x4b345d,_0x17d9fc){if(_0x4b345d[_0x0788('0x47')]['id']){delete _0x4b345d[_0x0788('0x47')]['id'];}return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x4b345d[_0x0788('0x42')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x17d9fc,null))[_0x0788('0x26')](saveUpdates(_0x4b345d[_0x0788('0x47')],null))[_0x0788('0x26')](respondWithResult(_0x17d9fc,null))[_0x0788('0x45')](handleError(_0x17d9fc,null));};exports[_0x0788('0x27')]=function(_0x55481c,_0x1c8be0){return db[_0x0788('0x2d')][_0x0788('0x44')]({'where':{'id':_0x55481c['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x1c8be0,null))[_0x0788('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x55481c[_0x0788('0x42')]['id']}}))[_0x0788('0x26')](removeEntity(_0x1c8be0,null))[_0x0788('0x45')](handleError(_0x1c8be0,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5ae3618..62663ca 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 _0x63cc=['lodash','util','api','moment','path','rimraf','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x63cc,0x1ea));var _0xc63c=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x63cc[_0x155c64];return _0x1f154a;};'use strict';var _=require(_0xc63c('0x0'));var util=require(_0xc63c('0x1'));var logger=require('../../config/logger')(_0xc63c('0x2'));var moment=require(_0xc63c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc63c('0x4'));var rimraf=require(_0xc63c('0x5'));var config=require('../../config/environment');var attributes=require(_0xc63c('0x6'));module[_0xc63c('0x7')]=function(_0x45e750,_0x534db9){return _0x45e750['define'](_0xc63c('0x8'),attributes,{'tableName':_0xc63c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e5c=['./contactItemType.attributes','exports','define','ContactItemType','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6e5c,0x1f3));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc6e5('0x0'));var logger=require(_0xc6e5('0x1'))(_0xc6e5('0x2'));var moment=require(_0xc6e5('0x3'));var BPromise=require('bluebird');var rp=require(_0xc6e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6e5('0x5'));var config=require(_0xc6e5('0x6'));var attributes=require(_0xc6e5('0x7'));module[_0xc6e5('0x8')]=function(_0x18b3ff,_0x259ed8){return _0x18b3ff[_0xc6e5('0x9')](_0xc6e5('0xa'),attributes,{'tableName':'tools_contact_item_types','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 f6f6c79..6eaa536 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 _0xbfa6=['code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21499b,_0x2ecd9c){var _0x4acd5d=function(_0x2c023a){while(--_0x2c023a){_0x21499b['push'](_0x21499b['shift']());}};_0x4acd5d(++_0x2ecd9c);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0xbfa6[_0x4c6bca];return _0x29d58e;};'use strict';var _=require(_0x6bfa('0x0'));var util=require(_0x6bfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bfa('0x2'));var db=require(_0x6bfa('0x3'))['db'];var utils=require(_0x6bfa('0x4'));var logger=require('../../config/logger')(_0x6bfa('0x5'));var config=require(_0x6bfa('0x6'));var jayson=require(_0x6bfa('0x7'));var client=jayson[_0x6bfa('0x8')][_0x6bfa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41708e,_0x20ae93,_0x5b4337){return new BPromise(function(_0x1ad59f,_0x560318){return client[_0x6bfa('0xa')](_0x41708e,_0x5b4337)[_0x6bfa('0xb')](function(_0x2f837b){logger[_0x6bfa('0xc')](_0x6bfa('0xd'),_0x20ae93,_0x6bfa('0xe'));logger[_0x6bfa('0xf')](_0x6bfa('0x10'),_0x20ae93,_0x6bfa('0xe'),JSON[_0x6bfa('0x11')](_0x2f837b));if(_0x2f837b['error']){if(_0x2f837b[_0x6bfa('0x12')][_0x6bfa('0x13')]===0x1f4){logger[_0x6bfa('0x12')]('ContactItemType,\x20%s,\x20%s',_0x20ae93,_0x2f837b[_0x6bfa('0x12')][_0x6bfa('0x14')]);return _0x560318(_0x2f837b[_0x6bfa('0x12')][_0x6bfa('0x14')]);}logger[_0x6bfa('0x12')]('ContactItemType,\x20%s,\x20%s',_0x20ae93,_0x2f837b[_0x6bfa('0x12')]['message']);return _0x1ad59f(_0x2f837b[_0x6bfa('0x12')][_0x6bfa('0x14')]);}else{logger[_0x6bfa('0xc')](_0x6bfa('0xd'),_0x20ae93,_0x6bfa('0xe'));_0x1ad59f(_0x2f837b[_0x6bfa('0x15')][_0x6bfa('0x14')]);}})[_0x6bfa('0x16')](function(_0x118f06){logger['error'](_0x6bfa('0xd'),_0x20ae93,_0x118f06);_0x560318(_0x118f06);});});} \ No newline at end of file +var _0xe237=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2055a7,_0x415a4c){var _0x42a14d=function(_0x83139b){while(--_0x83139b){_0x2055a7['push'](_0x2055a7['shift']());}};_0x42a14d(++_0x415a4c);}(_0xe237,0xd4));var _0x7e23=function(_0x2e10a0,_0x38276c){_0x2e10a0=_0x2e10a0-0x0;var _0x2d163f=_0xe237[_0x2e10a0];return _0x2d163f;};'use strict';var _=require(_0x7e23('0x0'));var util=require(_0x7e23('0x1'));var moment=require(_0x7e23('0x2'));var BPromise=require(_0x7e23('0x3'));var rs=require(_0x7e23('0x4'));var fs=require('fs');var Redis=require(_0x7e23('0x5'));var db=require(_0x7e23('0x6'))['db'];var utils=require(_0x7e23('0x7'));var logger=require(_0x7e23('0x8'))(_0x7e23('0x9'));var config=require(_0x7e23('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7e23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30e6e7,_0x22e41d,_0x16800d){return new BPromise(function(_0x2e18e9,_0x82a49c){return client['request'](_0x30e6e7,_0x16800d)[_0x7e23('0xc')](function(_0x343ca0){logger['info'](_0x7e23('0xd'),_0x22e41d,_0x7e23('0xe'));logger['debug'](_0x7e23('0xf'),_0x22e41d,'request\x20sent',JSON[_0x7e23('0x10')](_0x343ca0));if(_0x343ca0['error']){if(_0x343ca0[_0x7e23('0x11')][_0x7e23('0x12')]===0x1f4){logger['error'](_0x7e23('0xd'),_0x22e41d,_0x343ca0[_0x7e23('0x11')][_0x7e23('0x13')]);return _0x82a49c(_0x343ca0[_0x7e23('0x11')][_0x7e23('0x13')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x22e41d,_0x343ca0['error'][_0x7e23('0x13')]);return _0x2e18e9(_0x343ca0[_0x7e23('0x11')][_0x7e23('0x13')]);}else{logger[_0x7e23('0x14')]('ContactItemType,\x20%s,\x20%s',_0x22e41d,_0x7e23('0xe'));_0x2e18e9(_0x343ca0[_0x7e23('0x15')][_0x7e23('0x13')]);}})[_0x7e23('0x16')](function(_0x2ca4e7){logger[_0x7e23('0x11')](_0x7e23('0xd'),_0x22e41d,_0x2ca4e7);_0x82a49c(_0x2ca4e7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index d184dc6..5cb76d2 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 _0x8714=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','util'];(function(_0xeaf74c,_0x5203){var _0x11b10b=function(_0x554b25){while(--_0x554b25){_0xeaf74c['push'](_0xeaf74c['shift']());}};_0x11b10b(++_0x5203);}(_0x8714,0xdc));var _0x4871=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8714[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x4871('0x0'));var path=require(_0x4871('0x1'));var timeout=require(_0x4871('0x2'));var express=require('express');var router=express[_0x4871('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4871('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4871('0x5'));var controller=require(_0x4871('0x6'));router[_0x4871('0x7')]('/',auth['isAuthenticated'](),controller[_0x4871('0x8')]);router['get'](_0x4871('0x9'),auth[_0x4871('0xa')](),controller[_0x4871('0xb')]);router['post']('/',auth[_0x4871('0xa')](),controller[_0x4871('0xc')]);router['put'](_0x4871('0x9'),auth[_0x4871('0xa')](),controller[_0x4871('0xd')]);router[_0x4871('0xe')](_0x4871('0x9'),auth[_0x4871('0xa')](),controller[_0x4871('0xf')]);module[_0x4871('0x10')]=router; \ No newline at end of file +var _0x0fdd=['express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1e9a82,_0x84f2ad){var _0x3930d6=function(_0x6c955d){while(--_0x6c955d){_0x1e9a82['push'](_0x1e9a82['shift']());}};_0x3930d6(++_0x84f2ad);}(_0x0fdd,0x9f));var _0xd0fd=function(_0x2c42b7,_0x29ddac){_0x2c42b7=_0x2c42b7-0x0;var _0x651ad0=_0x0fdd[_0x2c42b7];return _0x651ad0;};'use strict';var multer=require(_0xd0fd('0x0'));var util=require(_0xd0fd('0x1'));var path=require(_0xd0fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0fd('0x3'));var router=express[_0xd0fd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd0fd('0x5'));var interaction=require(_0xd0fd('0x6'));var config=require('../../config/environment');var controller=require(_0xd0fd('0x7'));router[_0xd0fd('0x8')]('/',auth[_0xd0fd('0x9')](),controller['index']);router[_0xd0fd('0x8')](_0xd0fd('0xa'),auth['isAuthenticated'](),controller[_0xd0fd('0xb')]);router[_0xd0fd('0xc')]('/',auth[_0xd0fd('0x9')](),controller['create']);router[_0xd0fd('0xd')](_0xd0fd('0xa'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0xe')]);router[_0xd0fd('0xf')](_0xd0fd('0xa'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0x10')]);module[_0xd0fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c1c6785..291f1f7 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 _0xd8b0=['exports','sequelize'];(function(_0x5de7f3,_0x3ff6c3){var _0x5d2460=function(_0x36eb32){while(--_0x36eb32){_0x5de7f3['push'](_0x5de7f3['shift']());}};_0x5d2460(++_0x3ff6c3);}(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x54175b,_0x342273){var _0x519b6d=function(_0x1c7177){while(--_0x1c7177){_0x54175b['push'](_0x54175b['shift']());}};_0x519b6d(++_0x342273);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d8048,_0x445203){_0x5d8048=_0x5d8048-0x0;var _0x3affba=_0xb10b[_0x5d8048];return _0x3affba;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3d5454b..2562960 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 _0xd013=['fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','count','limit','set','apply','update','then','get','CustomDashboards','UserProfileResource','destroy','end','error','stack','name','send','index','map','Dashboard','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','order','filter','options','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x2708d5,_0x274c8d){var _0x1ae6f5=function(_0x2d0c1d){while(--_0x2d0c1d){_0x2708d5['push'](_0x2708d5['shift']());}};_0x1ae6f5(++_0x274c8d);}(_0xd013,0x77));var _0x3d01=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0xd013[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0x3d01('0x0'));var rimraf=require(_0x3d01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d01('0x2'));var moment=require(_0x3d01('0x3'));var BPromise=require(_0x3d01('0x4'));var Mustache=require(_0x3d01('0x5'));var util=require(_0x3d01('0x6'));var path=require(_0x3d01('0x7'));var sox=require(_0x3d01('0x8'));var csv=require('to-csv');var ejs=require(_0x3d01('0x9'));var fs=require('fs');var fs_extra=require(_0x3d01('0xa'));var _=require(_0x3d01('0xb'));var squel=require(_0x3d01('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d01('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d01('0xe'));var querystring=require('querystring');var Papa=require(_0x3d01('0xf'));var Redis=require(_0x3d01('0x10'));var authService=require(_0x3d01('0x11'));var qs=require(_0x3d01('0x12'));var as=require(_0x3d01('0x13'));var hardwareService=require(_0x3d01('0x14'));var logger=require(_0x3d01('0x15'))(_0x3d01('0x16'));var utils=require(_0x3d01('0x17'));var config=require(_0x3d01('0x18'));var licenseUtil=require(_0x3d01('0x19'));var db=require(_0x3d01('0x1a'))['db'];config['redis']=_[_0x3d01('0x1b')](config[_0x3d01('0x1c')],{'host':_0x3d01('0x1d'),'port':0x18eb});var socket=require(_0x3d01('0x1e'))(new Redis(config[_0x3d01('0x1c')]));require('./dashboard.socket')[_0x3d01('0x1f')](socket);function respondWithStatusCode(_0x157fef,_0x1bc681){_0x1bc681=_0x1bc681||0xcc;return function(_0x2baa6a){if(_0x2baa6a){return _0x157fef[_0x3d01('0x20')](_0x1bc681);}return _0x157fef[_0x3d01('0x21')](_0x1bc681)['end']();};}function respondWithResult(_0x4a5398,_0x4b7d61){_0x4b7d61=_0x4b7d61||0xc8;return function(_0x4345e9){if(_0x4345e9){return _0x4a5398['status'](_0x4b7d61)['json'](_0x4345e9);}};}function respondWithFilteredResult(_0x1c1696,_0x438a8c){return function(_0x3bf08b){if(_0x3bf08b){var _0x568740=typeof _0x438a8c[_0x3d01('0x22')]==='undefined'&&typeof _0x438a8c['limit']==='undefined';var _0x3d0ba9=_0x3bf08b[_0x3d01('0x23')];var _0x50b1bc=_0x568740?0x0:_0x438a8c[_0x3d01('0x22')];var _0x1cb98d=_0x568740?_0x3bf08b[_0x3d01('0x23')]:_0x438a8c[_0x3d01('0x22')]+_0x438a8c[_0x3d01('0x24')];var _0x38054b;if(_0x1cb98d>=_0x3d0ba9){_0x1cb98d=_0x3d0ba9;_0x38054b=0xc8;}else{_0x38054b=0xce;}_0x1c1696['status'](_0x38054b);return _0x1c1696[_0x3d01('0x25')]('Content-Range',_0x50b1bc+'-'+_0x1cb98d+'/'+_0x3d0ba9)['json'](_0x3bf08b);}return null;};}function patchUpdates(_0x3fb7e9){return function(_0x20b77a){try{jsonpatch[_0x3d01('0x26')](_0x20b77a,_0x3fb7e9,!![]);}catch(_0x590ea4){return BPromise['reject'](_0x590ea4);}return _0x20b77a['save']();};}function saveUpdates(_0x5a11a8,_0x2e571e){return function(_0x51de0d){if(_0x51de0d){return _0x51de0d[_0x3d01('0x27')](_0x5a11a8)[_0x3d01('0x28')](function(_0x395910){return _0x395910;});}return null;};}function removeEntity(_0x2484b0,_0x1e1bed){return function(_0x350c6b){if(_0x350c6b){return _0x350c6b['destroy']()['then'](function(){var _0x45d1c7=_0x350c6b[_0x3d01('0x29')]({'plain':!![]});var _0x2c2065=_0x3d01('0x2a');return db[_0x3d01('0x2b')][_0x3d01('0x2c')]({'where':{'type':_0x2c2065,'resourceId':_0x45d1c7['id']}})['then'](function(){return _0x350c6b;});})['then'](function(){_0x2484b0[_0x3d01('0x21')](0xcc)[_0x3d01('0x2d')]();});}};}function handleEntityNotFound(_0x5a4f82,_0x255ab9){return function(_0x554338){if(!_0x554338){_0x5a4f82['sendStatus'](0x194);}return _0x554338;};}function handleError(_0x4665c0,_0x3dc7a7){_0x3dc7a7=_0x3dc7a7||0x1f4;return function(_0x12711f){logger[_0x3d01('0x2e')](_0x12711f[_0x3d01('0x2f')]);if(_0x12711f['name']){delete _0x12711f[_0x3d01('0x30')];}_0x4665c0[_0x3d01('0x21')](_0x3dc7a7)[_0x3d01('0x31')](_0x12711f);};}exports[_0x3d01('0x32')]=function(_0x382144,_0xa336f9){var _0x102185={},_0x3c081b={},_0xbe5c68={'count':0x0,'rows':[]};var _0xcb4d35=_[_0x3d01('0x33')](db[_0x3d01('0x34')]['rawAttributes'],function(_0x226ecb){return{'name':_0x226ecb[_0x3d01('0x35')],'type':_0x226ecb[_0x3d01('0x36')][_0x3d01('0x37')]};});_0x3c081b['model']=_[_0x3d01('0x33')](_0xcb4d35,_0x3d01('0x30'));_0x3c081b[_0x3d01('0x38')]=_[_0x3d01('0x39')](_0x382144[_0x3d01('0x38')]);_0x3c081b[_0x3d01('0x3a')]=_['intersection'](_0x3c081b[_0x3d01('0x3b')],_0x3c081b[_0x3d01('0x38')]);_0x102185[_0x3d01('0x3c')]=_[_0x3d01('0x3d')](_0x3c081b['model'],qs[_0x3d01('0x3e')](_0x382144['query'][_0x3d01('0x3e')]));_0x102185['attributes']=_0x102185['attributes'][_0x3d01('0x3f')]?_0x102185[_0x3d01('0x3c')]:_0x3c081b[_0x3d01('0x3b')];if(!_0x382144['query'][_0x3d01('0x40')]('nolimit')){_0x102185[_0x3d01('0x24')]=qs[_0x3d01('0x24')](_0x382144[_0x3d01('0x38')][_0x3d01('0x24')]);_0x102185[_0x3d01('0x22')]=qs[_0x3d01('0x22')](_0x382144[_0x3d01('0x38')]['offset']);}_0x102185['order']=qs[_0x3d01('0x41')](_0x382144['query'][_0x3d01('0x41')]);_0x102185[_0x3d01('0x42')]=qs['filters'](_[_0x3d01('0x43')](_0x382144['query'],_0x3c081b[_0x3d01('0x3a')]),_0xcb4d35);if(_0x382144[_0x3d01('0x38')]['filter']){_0x102185['where']=_[_0x3d01('0x44')](_0x102185[_0x3d01('0x42')],{'$or':_[_0x3d01('0x33')](_0xcb4d35,function(_0xf82c8f){if(_0xf82c8f['type']!=='VIRTUAL'){var _0x56fccd={};_0x56fccd[_0xf82c8f[_0x3d01('0x30')]]={'$like':'%'+_0x382144[_0x3d01('0x38')]['filter']+'%'};return _0x56fccd;}})});}_0x102185=_['merge']({},_0x102185,_0x382144['options']);var _0x46830b={'where':_0x102185['where']};return db[_0x3d01('0x34')][_0x3d01('0x23')](_0x46830b)[_0x3d01('0x28')](function(_0x5f48a9){_0xbe5c68[_0x3d01('0x23')]=_0x5f48a9;if(_0x382144[_0x3d01('0x38')][_0x3d01('0x45')]){_0x102185[_0x3d01('0x46')]=[{'all':!![]}];}return db[_0x3d01('0x34')][_0x3d01('0x47')](_0x102185);})[_0x3d01('0x28')](function(_0x4f419b){_0xbe5c68[_0x3d01('0x48')]=_0x4f419b;return _0xbe5c68;})['then'](respondWithFilteredResult(_0xa336f9,_0x102185))[_0x3d01('0x49')](handleError(_0xa336f9,null));};exports[_0x3d01('0x4a')]=function(_0xa1022f,_0x21735b){var _0x4e6dae={'raw':![],'where':{'id':_0xa1022f[_0x3d01('0x4b')]['id']}},_0xc5864e={};_0xc5864e[_0x3d01('0x3b')]=_['keys'](db[_0x3d01('0x34')][_0x3d01('0x4c')]);_0xc5864e[_0x3d01('0x38')]=_[_0x3d01('0x39')](_0xa1022f[_0x3d01('0x38')]);_0xc5864e['filters']=_[_0x3d01('0x3d')](_0xc5864e[_0x3d01('0x3b')],_0xc5864e[_0x3d01('0x38')]);_0x4e6dae[_0x3d01('0x3c')]=_[_0x3d01('0x3d')](_0xc5864e[_0x3d01('0x3b')],qs[_0x3d01('0x3e')](_0xa1022f[_0x3d01('0x38')][_0x3d01('0x3e')]));_0x4e6dae[_0x3d01('0x3c')]=_0x4e6dae['attributes'][_0x3d01('0x3f')]?_0x4e6dae[_0x3d01('0x3c')]:_0xc5864e[_0x3d01('0x3b')];if(_0xa1022f[_0x3d01('0x38')][_0x3d01('0x45')]){_0x4e6dae[_0x3d01('0x46')]=[{'all':!![]}];}_0x4e6dae=_[_0x3d01('0x44')]({},_0x4e6dae,_0xa1022f['options']);return db['Dashboard'][_0x3d01('0x4d')](_0x4e6dae)['then'](handleEntityNotFound(_0x21735b,null))[_0x3d01('0x28')](respondWithResult(_0x21735b,null))[_0x3d01('0x49')](handleError(_0x21735b,null));};exports[_0x3d01('0x4e')]=function(_0x287537,_0x526f5c){return db[_0x3d01('0x34')][_0x3d01('0x4e')](_0x287537[_0x3d01('0x4f')],{})[_0x3d01('0x28')](function(_0x118864){var _0x1d6b17=_0x287537[_0x3d01('0x50')][_0x3d01('0x29')]({'plain':!![]});if(!_0x1d6b17)throw new Error(_0x3d01('0x51'));if(_0x1d6b17[_0x3d01('0x52')]===_0x3d01('0x50')){var _0x48b1ed=_0x118864['get']({'plain':!![]});var _0x4078c8='CustomDashboards';return db[_0x3d01('0x53')][_0x3d01('0x4d')]({'where':{'name':_0x4078c8,'userProfileId':_0x1d6b17[_0x3d01('0x54')]},'raw':!![]})[_0x3d01('0x28')](function(_0x1a1660){if(_0x1a1660&&_0x1a1660[_0x3d01('0x55')]===0x0){return db[_0x3d01('0x2b')][_0x3d01('0x4e')]({'name':_0x48b1ed[_0x3d01('0x30')],'resourceId':_0x48b1ed['id'],'type':_0x1a1660[_0x3d01('0x30')],'sectionId':_0x1a1660['id']},{})[_0x3d01('0x28')](function(){return _0x118864;});}else{return _0x118864;}})['catch'](function(_0x2abb23){logger[_0x3d01('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2abb23);throw _0x2abb23;});}return _0x118864;})[_0x3d01('0x28')](respondWithResult(_0x526f5c,0xc9))[_0x3d01('0x49')](handleError(_0x526f5c,null));};exports[_0x3d01('0x56')]=function(_0x58028f,_0x4c56f8){var _0x1fd08f={'where':{'id':_0x58028f[_0x3d01('0x4b')]['id']}},_0x462986={};_0x462986[_0x3d01('0x3b')]=_[_0x3d01('0x39')](db[_0x3d01('0x34')][_0x3d01('0x4c')]);_0x1fd08f['attributes']=_[_0x3d01('0x3d')](_0x462986[_0x3d01('0x3b')],qs[_0x3d01('0x3e')](_0x58028f[_0x3d01('0x38')]['fields']));_0x1fd08f[_0x3d01('0x3c')]=_0x1fd08f['attributes'][_0x3d01('0x3f')]?_0x1fd08f[_0x3d01('0x3c')]:_0x462986['model'];if(_0x58028f['query'][_0x3d01('0x45')]){_0x1fd08f[_0x3d01('0x46')]=[{'all':!![]}];}_0x1fd08f=_[_0x3d01('0x44')]({},_0x1fd08f,_0x58028f['options']);return db[_0x3d01('0x34')][_0x3d01('0x4d')](_0x1fd08f)[_0x3d01('0x28')](handleEntityNotFound(_0x4c56f8,null))[_0x3d01('0x28')](function(_0x9438ac){if(_0x9438ac){var _0x1e7cfe=_0x9438ac['get']({'plain':!![]});_0x1e7cfe=qs[_0x3d01('0x57')](_0x1e7cfe,['id',_0x3d01('0x58'),_0x3d01('0x59')]);_0x58028f[_0x3d01('0x4f')]=_[_0x3d01('0x57')](_0x58028f[_0x3d01('0x4f')],['id',_0x3d01('0x58'),_0x3d01('0x59')]);return db['Dashboard'][_0x3d01('0x4e')](_[_0x3d01('0x44')](_0x1e7cfe,_0x58028f[_0x3d01('0x4f')]),{'include':_0x58028f[_0x3d01('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x3d01('0x28')](function(_0x40ed83){var _0x5ecc3e=_0x58028f[_0x3d01('0x50')][_0x3d01('0x29')]({'plain':!![]});if(!_0x5ecc3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ecc3e[_0x3d01('0x52')]===_0x3d01('0x50')){var _0x26c44e=_0x40ed83[_0x3d01('0x29')]({'plain':!![]});var _0x21bc4f=_0x3d01('0x2a');return db['UserProfileSection'][_0x3d01('0x4d')]({'where':{'name':_0x21bc4f,'userProfileId':_0x5ecc3e[_0x3d01('0x54')]},'raw':!![]})[_0x3d01('0x28')](function(_0x8ef195){if(_0x8ef195&&_0x8ef195[_0x3d01('0x55')]===0x0){return db[_0x3d01('0x2b')][_0x3d01('0x4e')]({'name':_0x26c44e[_0x3d01('0x30')],'resourceId':_0x26c44e['id'],'type':_0x8ef195[_0x3d01('0x30')],'sectionId':_0x8ef195['id']},{})[_0x3d01('0x28')](function(){return _0x40ed83;});}else{return _0x40ed83;}})['catch'](function(_0x3a07b1){logger[_0x3d01('0x2e')](_0x3d01('0x5a'),_0x3a07b1);throw _0x3a07b1;});}return _0x40ed83;});}})[_0x3d01('0x28')](respondWithResult(_0x4c56f8,0xc9))[_0x3d01('0x49')](handleError(_0x4c56f8,null));};exports[_0x3d01('0x27')]=function(_0x37d811,_0x1bf723){if(_0x37d811['body']['id']){delete _0x37d811[_0x3d01('0x4f')]['id'];}return db[_0x3d01('0x34')][_0x3d01('0x4d')]({'where':{'id':_0x37d811[_0x3d01('0x4b')]['id']}})[_0x3d01('0x28')](handleEntityNotFound(_0x1bf723,null))[_0x3d01('0x28')](saveUpdates(_0x37d811['body'],null))[_0x3d01('0x28')](respondWithResult(_0x1bf723,null))['catch'](handleError(_0x1bf723,null));};exports[_0x3d01('0x2c')]=function(_0x3c9e66,_0x3da434){return db[_0x3d01('0x34')]['find']({'where':{'id':_0x3c9e66['params']['id']}})[_0x3d01('0x28')](handleEntityNotFound(_0x3da434,null))['then'](removeEntity(_0x3da434,null))[_0x3d01('0x49')](handleError(_0x3da434,null));};function widgetAttributes(_0x52014a){try{switch(_0x52014a[_0x3d01('0x36')]){case'iframe':return[{'name':'attrUrl','value':_0x52014a['attrUrl']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x0]?_0x52014a[_0x3d01('0x5b')][0x0][_0x3d01('0x5c')]:undefined)||'https://'}];case _0x3d01('0x5d'):return[{'name':_0x3d01('0x5e'),'value':_0x52014a[_0x3d01('0x5e')]||(_0x52014a['attrs']&&_0x52014a[_0x3d01('0x5b')][0x0]?_0x52014a['attrs'][0x0][_0x3d01('0x5c')]:undefined)||''}];case _0x3d01('0x5f'):return[{'name':_0x3d01('0x60'),'value':_0x52014a[_0x3d01('0x60')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x0]?_0x52014a[_0x3d01('0x5b')][0x0][_0x3d01('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x3d01('0x61'),'value':_0x52014a[_0x3d01('0x61')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x1]?_0x52014a['attrs'][0x1][_0x3d01('0x5c')]:undefined)||_0x3d01('0x62')},{'name':_0x3d01('0x63'),'value':_0x52014a[_0x3d01('0x63')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x2]?_0x52014a[_0x3d01('0x5b')][0x2][_0x3d01('0x5c')]:undefined)||0xc}];case _0x3d01('0x64'):return[{'name':_0x3d01('0x65'),'value':_0x52014a[_0x3d01('0x65')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x0]?_0x52014a[_0x3d01('0x5b')][0x0][_0x3d01('0x5c')]:undefined)||'total'},{'name':_0x3d01('0x66'),'value':_0x52014a[_0x3d01('0x66')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x1]?_0x52014a['attrs'][0x1][_0x3d01('0x5c')]:undefined)||[]},{'name':_0x3d01('0x63'),'value':_0x52014a['attrFontSize']||(_0x52014a['attrs']&&_0x52014a[_0x3d01('0x5b')][0x2]?_0x52014a[_0x3d01('0x5b')][0x2][_0x3d01('0x5c')]:undefined)||0x14},{'name':_0x3d01('0x67'),'value':_0x52014a[_0x3d01('0x67')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x3]?_0x52014a[_0x3d01('0x5b')][0x3]['value']:undefined)||'voice'},{'name':_0x3d01('0x68'),'value':_0x52014a['attrEmailAccounts']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x4]?_0x52014a[_0x3d01('0x5b')][0x4]['value']:undefined)||''},{'name':_0x3d01('0x69'),'value':_0x52014a[_0x3d01('0x69')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x5]?_0x52014a[_0x3d01('0x5b')][0x5]['value']:undefined)||''},{'name':_0x3d01('0x6a'),'value':_0x52014a[_0x3d01('0x6a')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x6]?_0x52014a['attrs'][0x6]['value']:undefined)||''},{'name':_0x3d01('0x6b'),'value':_0x52014a[_0x3d01('0x6b')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x7]?_0x52014a[_0x3d01('0x5b')][0x7]['value']:undefined)||''},{'name':_0x3d01('0x6c'),'value':_0x52014a['attrWhatsappAccounts']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x8]?_0x52014a[_0x3d01('0x5b')][0x8][_0x3d01('0x5c')]:undefined)||''},{'name':_0x3d01('0x6d'),'value':_0x52014a[_0x3d01('0x6d')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x9]?_0x52014a[_0x3d01('0x5b')][0x9]['value']:undefined)||''}];case _0x3d01('0x6e'):case _0x3d01('0x6f'):return[{'name':'attrSerie1','value':_0x52014a[_0x3d01('0x70')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x0]?_0x52014a[_0x3d01('0x5b')][0x0][_0x3d01('0x5c')]:undefined)||_0x3d01('0x71')},{'name':_0x3d01('0x72'),'value':_0x52014a['attrSerie2']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x1]?_0x52014a[_0x3d01('0x5b')][0x1][_0x3d01('0x5c')]:undefined)||null},{'name':_0x3d01('0x73'),'value':_0x52014a['attrSerie3']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x2]?_0x52014a[_0x3d01('0x5b')][0x2][_0x3d01('0x5c')]:undefined)||null},{'name':_0x3d01('0x66'),'value':_0x52014a['attrVoiceQueues']||(_0x52014a['attrs']&&_0x52014a[_0x3d01('0x5b')][0x3]?_0x52014a[_0x3d01('0x5b')][0x3][_0x3d01('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x52014a[_0x3d01('0x67')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x4]?_0x52014a[_0x3d01('0x5b')][0x4][_0x3d01('0x5c')]:undefined)||_0x3d01('0x74')},{'name':_0x3d01('0x68'),'value':_0x52014a[_0x3d01('0x68')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x5]?_0x52014a[_0x3d01('0x5b')][0x5]['value']:undefined)||''},{'name':_0x3d01('0x69'),'value':_0x52014a['attrFaxAccounts']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x6]?_0x52014a[_0x3d01('0x5b')][0x6][_0x3d01('0x5c')]:undefined)||''},{'name':_0x3d01('0x6a'),'value':_0x52014a[_0x3d01('0x6a')]||(_0x52014a['attrs']&&_0x52014a['attrs'][0x7]?_0x52014a[_0x3d01('0x5b')][0x7][_0x3d01('0x5c')]:undefined)||''},{'name':_0x3d01('0x6b'),'value':_0x52014a[_0x3d01('0x6b')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x8]?_0x52014a[_0x3d01('0x5b')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x52014a[_0x3d01('0x6c')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0x9]?_0x52014a[_0x3d01('0x5b')][0x9][_0x3d01('0x5c')]:undefined)||''},{'name':_0x3d01('0x6d'),'value':_0x52014a['attrChatWebsites']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a['attrs'][0xa]?_0x52014a[_0x3d01('0x5b')][0xa][_0x3d01('0x5c')]:undefined)||''}];case _0x3d01('0x75'):return[{'name':_0x3d01('0x76'),'type':_0x52014a[_0x3d01('0x77')]||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x0]?_0x52014a['attrs'][0x0][_0x3d01('0x36')]:undefined)||null,'value':_0x52014a['attrReport']||(_0x52014a[_0x3d01('0x5b')]&&_0x52014a[_0x3d01('0x5b')][0x0]?_0x52014a[_0x3d01('0x5b')][0x0]['value']:undefined)||null},{'name':_0x3d01('0x78'),'value':_0x52014a[_0x3d01('0x78')]||(_0x52014a['attrs']&&_0x52014a['attrs'][0x1]?_0x52014a[_0x3d01('0x5b')][0x1][_0x3d01('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x423470){logger[_0x3d01('0x2e')](_0x3d01('0x79'),JSON['stringify'](_0x423470));return[];}}exports['addItem']=function(_0x3b9629,_0x5d2d65,_0xf82407){if(_0x3b9629[_0x3d01('0x4f')]['id']){delete _0x3b9629['body']['id'];}return db[_0x3d01('0x34')][_0x3d01('0x4d')]({'where':{'id':_0x3b9629['params']['id']}})[_0x3d01('0x28')](handleEntityNotFound(_0x5d2d65,null))[_0x3d01('0x28')](function(_0x25fa38){if(_0x25fa38){_0x3b9629[_0x3d01('0x4f')][_0x3d01('0x7a')]=_0x25fa38['id'];_0x3b9629['body']['attrs']=widgetAttributes(_0x3b9629[_0x3d01('0x4f')]);return db[_0x3d01('0x7b')][_0x3d01('0x4e')](_0x3b9629[_0x3d01('0x4f')]);}})['then'](respondWithResult(_0x5d2d65,null))['catch'](handleError(_0x5d2d65,null));};exports[_0x3d01('0x7c')]=function(_0x3207ac,_0x4bc893,_0x148079){var _0x19113a={};var _0x3d9769={};var _0x151f0a;var _0x5cb655;return db[_0x3d01('0x34')]['findOne']({'where':{'id':_0x3207ac['params']['id']}})['then'](handleEntityNotFound(_0x4bc893,null))['then'](function(_0x298ce8){if(_0x298ce8){_0x151f0a=_0x298ce8;_0x3d9769[_0x3d01('0x3b')]=_[_0x3d01('0x39')](db[_0x3d01('0x7b')]['rawAttributes']);_0x3d9769[_0x3d01('0x38')]=_[_0x3d01('0x39')](_0x3207ac[_0x3d01('0x38')]);_0x3d9769[_0x3d01('0x3a')]=_[_0x3d01('0x3d')](_0x3d9769[_0x3d01('0x3b')],_0x3d9769['query']);_0x19113a[_0x3d01('0x3c')]=_[_0x3d01('0x3d')](_0x3d9769[_0x3d01('0x3b')],qs['fields'](_0x3207ac[_0x3d01('0x38')][_0x3d01('0x3e')]));_0x19113a[_0x3d01('0x3c')]=_0x19113a[_0x3d01('0x3c')][_0x3d01('0x3f')]?_0x19113a[_0x3d01('0x3c')]:_0x3d9769[_0x3d01('0x3b')];_0x19113a[_0x3d01('0x7d')]=qs[_0x3d01('0x41')](_0x3207ac[_0x3d01('0x38')][_0x3d01('0x41')]);_0x19113a['where']=qs['filters'](_[_0x3d01('0x43')](_0x3207ac[_0x3d01('0x38')],_0x3d9769[_0x3d01('0x3a')]));if(_0x3207ac['query']['filter']){_0x19113a[_0x3d01('0x42')]=_[_0x3d01('0x44')](_0x19113a[_0x3d01('0x42')],{'$or':_[_0x3d01('0x33')](_0x19113a[_0x3d01('0x3c')],function(_0x24435b){var _0x570959={};_0x570959[_0x24435b]={'$like':'%'+_0x3207ac[_0x3d01('0x38')][_0x3d01('0x7e')]+'%'};return _0x570959;})});}_0x19113a=_[_0x3d01('0x44')]({},_0x19113a,_0x3207ac[_0x3d01('0x7f')]);return _0x151f0a['getItems'](_0x19113a);}})[_0x3d01('0x28')](function(_0x16c0b5){if(_0x16c0b5){_0x5cb655=_0x16c0b5[_0x3d01('0x3f')];if(!_0x3207ac['query'][_0x3d01('0x40')](_0x3d01('0x80'))){_0x19113a[_0x3d01('0x24')]=qs[_0x3d01('0x24')](_0x3207ac['query']['limit']);_0x19113a[_0x3d01('0x22')]=qs['offset'](_0x3207ac[_0x3d01('0x38')][_0x3d01('0x22')]);}return _0x151f0a[_0x3d01('0x7c')](_0x19113a);}})[_0x3d01('0x28')](function(_0x162f46){if(_0x162f46){return _0x162f46?{'count':_0x5cb655,'rows':_0x162f46}:null;}})[_0x3d01('0x28')](respondWithResult(_0x4bc893,null))[_0x3d01('0x49')](handleError(_0x4bc893,null));}; \ No newline at end of file +var _0x3adb=['keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','params','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','name','index','Dashboard','rawAttributes','fieldName','type','key','model','map'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x3adb,0xc5));var _0xb3ad=function(_0x4e2950,_0x8181a){_0x4e2950=_0x4e2950-0x0;var _0x4087c5=_0x3adb[_0x4e2950];return _0x4087c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3ad('0x0'));var zipdir=require(_0xb3ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3ad('0x2'));var BPromise=require(_0xb3ad('0x3'));var Mustache=require(_0xb3ad('0x4'));var util=require('util');var path=require(_0xb3ad('0x5'));var sox=require('sox');var csv=require(_0xb3ad('0x6'));var ejs=require(_0xb3ad('0x7'));var fs=require('fs');var fs_extra=require(_0xb3ad('0x8'));var _=require(_0xb3ad('0x9'));var squel=require(_0xb3ad('0xa'));var crypto=require(_0xb3ad('0xb'));var jsforce=require(_0xb3ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3ad('0xd'));var Papa=require(_0xb3ad('0xe'));var Redis=require(_0xb3ad('0xf'));var authService=require(_0xb3ad('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3ad('0x11'));var logger=require('../../config/logger')(_0xb3ad('0x12'));var utils=require(_0xb3ad('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb3ad('0x14'));var db=require('../../mysqldb')['db'];config[_0xb3ad('0x15')]=_['defaults'](config[_0xb3ad('0x15')],{'host':_0xb3ad('0x16'),'port':0x18eb});var socket=require(_0xb3ad('0x17'))(new Redis(config[_0xb3ad('0x15')]));require('./dashboard.socket')[_0xb3ad('0x18')](socket);function respondWithStatusCode(_0x39a4b1,_0x4478d8){_0x4478d8=_0x4478d8||0xcc;return function(_0x438e4a){if(_0x438e4a){return _0x39a4b1[_0xb3ad('0x19')](_0x4478d8);}return _0x39a4b1[_0xb3ad('0x1a')](_0x4478d8)[_0xb3ad('0x1b')]();};}function respondWithResult(_0x23b265,_0x474820){_0x474820=_0x474820||0xc8;return function(_0x463109){if(_0x463109){return _0x23b265[_0xb3ad('0x1a')](_0x474820)[_0xb3ad('0x1c')](_0x463109);}};}function respondWithFilteredResult(_0x5d0404,_0x1680af){return function(_0x433acf){if(_0x433acf){var _0x4b7b90=typeof _0x1680af[_0xb3ad('0x1d')]===_0xb3ad('0x1e')&&typeof _0x1680af[_0xb3ad('0x1f')]===_0xb3ad('0x1e');var _0x5ebee7=_0x433acf[_0xb3ad('0x20')];var _0x14597f=_0x4b7b90?0x0:_0x1680af['offset'];var _0x1426ae=_0x4b7b90?_0x433acf[_0xb3ad('0x20')]:_0x1680af[_0xb3ad('0x1d')]+_0x1680af[_0xb3ad('0x1f')];var _0xb0aa4e;if(_0x1426ae>=_0x5ebee7){_0x1426ae=_0x5ebee7;_0xb0aa4e=0xc8;}else{_0xb0aa4e=0xce;}_0x5d0404[_0xb3ad('0x1a')](_0xb0aa4e);return _0x5d0404[_0xb3ad('0x21')]('Content-Range',_0x14597f+'-'+_0x1426ae+'/'+_0x5ebee7)[_0xb3ad('0x1c')](_0x433acf);}return null;};}function patchUpdates(_0x2f7826){return function(_0x2edd37){try{jsonpatch['apply'](_0x2edd37,_0x2f7826,!![]);}catch(_0x17df98){return BPromise[_0xb3ad('0x22')](_0x17df98);}return _0x2edd37[_0xb3ad('0x23')]();};}function saveUpdates(_0x20a18b,_0x46378c){return function(_0x23ebd3){if(_0x23ebd3){return _0x23ebd3[_0xb3ad('0x24')](_0x20a18b)[_0xb3ad('0x25')](function(_0x179bf4){return _0x179bf4;});}return null;};}function removeEntity(_0x9f1800,_0xc73e87){return function(_0x1235c5){if(_0x1235c5){return _0x1235c5[_0xb3ad('0x26')]()[_0xb3ad('0x25')](function(){var _0x3dfd1d=_0x1235c5[_0xb3ad('0x27')]({'plain':!![]});var _0x39dd24=_0xb3ad('0x28');return db[_0xb3ad('0x29')][_0xb3ad('0x26')]({'where':{'type':_0x39dd24,'resourceId':_0x3dfd1d['id']}})[_0xb3ad('0x25')](function(){return _0x1235c5;});})[_0xb3ad('0x25')](function(){_0x9f1800[_0xb3ad('0x1a')](0xcc)[_0xb3ad('0x1b')]();});}};}function handleEntityNotFound(_0x18d9e5,_0x4e40df){return function(_0x290424){if(!_0x290424){_0x18d9e5['sendStatus'](0x194);}return _0x290424;};}function handleError(_0x175c3b,_0x517403){_0x517403=_0x517403||0x1f4;return function(_0xe0b6b0){logger['error'](_0xe0b6b0['stack']);if(_0xe0b6b0[_0xb3ad('0x2a')]){delete _0xe0b6b0['name'];}_0x175c3b['status'](_0x517403)['send'](_0xe0b6b0);};}exports[_0xb3ad('0x2b')]=function(_0x3a6272,_0x5449f6){var _0x3b1437={},_0x3ed553={},_0x418937={'count':0x0,'rows':[]};var _0xadc685=_['map'](db[_0xb3ad('0x2c')][_0xb3ad('0x2d')],function(_0x476a37){return{'name':_0x476a37[_0xb3ad('0x2e')],'type':_0x476a37[_0xb3ad('0x2f')][_0xb3ad('0x30')]};});_0x3ed553[_0xb3ad('0x31')]=_[_0xb3ad('0x32')](_0xadc685,_0xb3ad('0x2a'));_0x3ed553['query']=_[_0xb3ad('0x33')](_0x3a6272['query']);_0x3ed553[_0xb3ad('0x34')]=_[_0xb3ad('0x35')](_0x3ed553['model'],_0x3ed553[_0xb3ad('0x36')]);_0x3b1437['attributes']=_[_0xb3ad('0x35')](_0x3ed553[_0xb3ad('0x31')],qs[_0xb3ad('0x37')](_0x3a6272['query'][_0xb3ad('0x37')]));_0x3b1437[_0xb3ad('0x38')]=_0x3b1437[_0xb3ad('0x38')][_0xb3ad('0x39')]?_0x3b1437[_0xb3ad('0x38')]:_0x3ed553['model'];if(!_0x3a6272[_0xb3ad('0x36')][_0xb3ad('0x3a')](_0xb3ad('0x3b'))){_0x3b1437['limit']=qs[_0xb3ad('0x1f')](_0x3a6272['query'][_0xb3ad('0x1f')]);_0x3b1437[_0xb3ad('0x1d')]=qs[_0xb3ad('0x1d')](_0x3a6272['query'][_0xb3ad('0x1d')]);}_0x3b1437[_0xb3ad('0x3c')]=qs[_0xb3ad('0x3d')](_0x3a6272[_0xb3ad('0x36')][_0xb3ad('0x3d')]);_0x3b1437[_0xb3ad('0x3e')]=qs[_0xb3ad('0x34')](_[_0xb3ad('0x3f')](_0x3a6272[_0xb3ad('0x36')],_0x3ed553[_0xb3ad('0x34')]),_0xadc685);if(_0x3a6272[_0xb3ad('0x36')][_0xb3ad('0x40')]){_0x3b1437['where']=_[_0xb3ad('0x41')](_0x3b1437[_0xb3ad('0x3e')],{'$or':_[_0xb3ad('0x32')](_0xadc685,function(_0x25423a){if(_0x25423a['type']!==_0xb3ad('0x42')){var _0x268472={};_0x268472[_0x25423a[_0xb3ad('0x2a')]]={'$like':'%'+_0x3a6272[_0xb3ad('0x36')][_0xb3ad('0x40')]+'%'};return _0x268472;}})});}_0x3b1437=_[_0xb3ad('0x41')]({},_0x3b1437,_0x3a6272[_0xb3ad('0x43')]);var _0x2bf3ed={'where':_0x3b1437[_0xb3ad('0x3e')]};return db[_0xb3ad('0x2c')][_0xb3ad('0x20')](_0x2bf3ed)[_0xb3ad('0x25')](function(_0x2d9db7){_0x418937[_0xb3ad('0x20')]=_0x2d9db7;if(_0x3a6272[_0xb3ad('0x36')][_0xb3ad('0x44')]){_0x3b1437[_0xb3ad('0x45')]=[{'all':!![]}];}return db[_0xb3ad('0x2c')][_0xb3ad('0x46')](_0x3b1437);})['then'](function(_0x5614c6){_0x418937[_0xb3ad('0x47')]=_0x5614c6;return _0x418937;})[_0xb3ad('0x25')](respondWithFilteredResult(_0x5449f6,_0x3b1437))[_0xb3ad('0x48')](handleError(_0x5449f6,null));};exports[_0xb3ad('0x49')]=function(_0x8fa5c8,_0x53f684){var _0x42c759={'raw':![],'where':{'id':_0x8fa5c8['params']['id']}},_0x7b1e33={};_0x7b1e33[_0xb3ad('0x31')]=_[_0xb3ad('0x33')](db['Dashboard'][_0xb3ad('0x2d')]);_0x7b1e33['query']=_[_0xb3ad('0x33')](_0x8fa5c8[_0xb3ad('0x36')]);_0x7b1e33[_0xb3ad('0x34')]=_[_0xb3ad('0x35')](_0x7b1e33['model'],_0x7b1e33[_0xb3ad('0x36')]);_0x42c759['attributes']=_[_0xb3ad('0x35')](_0x7b1e33[_0xb3ad('0x31')],qs[_0xb3ad('0x37')](_0x8fa5c8[_0xb3ad('0x36')][_0xb3ad('0x37')]));_0x42c759['attributes']=_0x42c759[_0xb3ad('0x38')][_0xb3ad('0x39')]?_0x42c759[_0xb3ad('0x38')]:_0x7b1e33[_0xb3ad('0x31')];if(_0x8fa5c8['query'][_0xb3ad('0x44')]){_0x42c759['include']=[{'all':!![]}];}_0x42c759=_['merge']({},_0x42c759,_0x8fa5c8['options']);return db[_0xb3ad('0x2c')]['find'](_0x42c759)[_0xb3ad('0x25')](handleEntityNotFound(_0x53f684,null))[_0xb3ad('0x25')](respondWithResult(_0x53f684,null))[_0xb3ad('0x48')](handleError(_0x53f684,null));};exports['create']=function(_0x63bf41,_0x12c148){return db[_0xb3ad('0x2c')][_0xb3ad('0x4a')](_0x63bf41[_0xb3ad('0x4b')],{})['then'](function(_0x3e3c98){var _0x27afc6=_0x63bf41[_0xb3ad('0x4c')][_0xb3ad('0x27')]({'plain':!![]});if(!_0x27afc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27afc6[_0xb3ad('0x4d')]===_0xb3ad('0x4c')){var _0x5d649d=_0x3e3c98[_0xb3ad('0x27')]({'plain':!![]});var _0x5f4313=_0xb3ad('0x28');return db[_0xb3ad('0x4e')][_0xb3ad('0x4f')]({'where':{'name':_0x5f4313,'userProfileId':_0x27afc6[_0xb3ad('0x50')]},'raw':!![]})[_0xb3ad('0x25')](function(_0x46e4fb){if(_0x46e4fb&&_0x46e4fb['autoAssociation']===0x0){return db[_0xb3ad('0x29')][_0xb3ad('0x4a')]({'name':_0x5d649d['name'],'resourceId':_0x5d649d['id'],'type':_0x46e4fb[_0xb3ad('0x2a')],'sectionId':_0x46e4fb['id']},{})[_0xb3ad('0x25')](function(){return _0x3e3c98;});}else{return _0x3e3c98;}})[_0xb3ad('0x48')](function(_0xad59ec){logger[_0xb3ad('0x51')](_0xb3ad('0x52'),_0xad59ec);throw _0xad59ec;});}return _0x3e3c98;})[_0xb3ad('0x25')](respondWithResult(_0x12c148,0xc9))[_0xb3ad('0x48')](handleError(_0x12c148,null));};exports['clone']=function(_0x553884,_0x13cd70){var _0x417ee3={'where':{'id':_0x553884['params']['id']}},_0x5bb096={};_0x5bb096[_0xb3ad('0x31')]=_[_0xb3ad('0x33')](db[_0xb3ad('0x2c')]['rawAttributes']);_0x417ee3[_0xb3ad('0x38')]=_[_0xb3ad('0x35')](_0x5bb096[_0xb3ad('0x31')],qs['fields'](_0x553884[_0xb3ad('0x36')][_0xb3ad('0x37')]));_0x417ee3[_0xb3ad('0x38')]=_0x417ee3['attributes'][_0xb3ad('0x39')]?_0x417ee3['attributes']:_0x5bb096[_0xb3ad('0x31')];if(_0x553884[_0xb3ad('0x36')]['includeAll']){_0x417ee3[_0xb3ad('0x45')]=[{'all':!![]}];}_0x417ee3=_[_0xb3ad('0x41')]({},_0x417ee3,_0x553884[_0xb3ad('0x43')]);return db['Dashboard']['find'](_0x417ee3)[_0xb3ad('0x25')](handleEntityNotFound(_0x13cd70,null))[_0xb3ad('0x25')](function(_0x394531){if(_0x394531){var _0x3039d6=_0x394531[_0xb3ad('0x27')]({'plain':!![]});_0x3039d6=qs[_0xb3ad('0x53')](_0x3039d6,['id',_0xb3ad('0x54'),_0xb3ad('0x55')]);_0x553884[_0xb3ad('0x4b')]=_[_0xb3ad('0x53')](_0x553884[_0xb3ad('0x4b')],['id',_0xb3ad('0x54'),_0xb3ad('0x55')]);return db[_0xb3ad('0x2c')][_0xb3ad('0x4a')](_[_0xb3ad('0x41')](_0x3039d6,_0x553884[_0xb3ad('0x4b')]),{'include':_0x553884[_0xb3ad('0x36')][_0xb3ad('0x44')]?[{'all':!![]}]:undefined})[_0xb3ad('0x25')](function(_0x301fca){var _0x5e43d2=_0x553884[_0xb3ad('0x4c')][_0xb3ad('0x27')]({'plain':!![]});if(!_0x5e43d2)throw new Error(_0xb3ad('0x56'));if(_0x5e43d2['role']===_0xb3ad('0x4c')){var _0x215a6b=_0x301fca[_0xb3ad('0x27')]({'plain':!![]});var _0x22b42f=_0xb3ad('0x28');return db[_0xb3ad('0x4e')]['find']({'where':{'name':_0x22b42f,'userProfileId':_0x5e43d2[_0xb3ad('0x50')]},'raw':!![]})[_0xb3ad('0x25')](function(_0x5e076d){if(_0x5e076d&&_0x5e076d[_0xb3ad('0x57')]===0x0){return db[_0xb3ad('0x29')][_0xb3ad('0x4a')]({'name':_0x215a6b['name'],'resourceId':_0x215a6b['id'],'type':_0x5e076d[_0xb3ad('0x2a')],'sectionId':_0x5e076d['id']},{})[_0xb3ad('0x25')](function(){return _0x301fca;});}else{return _0x301fca;}})[_0xb3ad('0x48')](function(_0x438b42){logger[_0xb3ad('0x51')](_0xb3ad('0x52'),_0x438b42);throw _0x438b42;});}return _0x301fca;});}})[_0xb3ad('0x25')](respondWithResult(_0x13cd70,0xc9))['catch'](handleError(_0x13cd70,null));};exports[_0xb3ad('0x24')]=function(_0x239c37,_0x398802){if(_0x239c37[_0xb3ad('0x4b')]['id']){delete _0x239c37[_0xb3ad('0x4b')]['id'];}return db[_0xb3ad('0x2c')]['find']({'where':{'id':_0x239c37[_0xb3ad('0x58')]['id']}})[_0xb3ad('0x25')](handleEntityNotFound(_0x398802,null))[_0xb3ad('0x25')](saveUpdates(_0x239c37[_0xb3ad('0x4b')],null))[_0xb3ad('0x25')](respondWithResult(_0x398802,null))[_0xb3ad('0x48')](handleError(_0x398802,null));};exports['destroy']=function(_0x1c1676,_0x2d8985){return db[_0xb3ad('0x2c')]['find']({'where':{'id':_0x1c1676[_0xb3ad('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d8985,null))[_0xb3ad('0x25')](removeEntity(_0x2d8985,null))[_0xb3ad('0x48')](handleError(_0x2d8985,null));};function widgetAttributes(_0x3b9ad5){try{switch(_0x3b9ad5[_0xb3ad('0x2f')]){case _0xb3ad('0x59'):return[{'name':_0xb3ad('0x5a'),'value':_0x3b9ad5[_0xb3ad('0x5a')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x3b9ad5[_0xb3ad('0x5c')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0][_0xb3ad('0x5d')]:undefined)||''}];case _0xb3ad('0x5e'):return[{'name':_0xb3ad('0x5f'),'value':_0x3b9ad5[_0xb3ad('0x5f')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0]['value']:undefined)||_0xb3ad('0x60')},{'name':_0xb3ad('0x61'),'value':_0x3b9ad5[_0xb3ad('0x61')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x1]?_0x3b9ad5[_0xb3ad('0x5b')][0x1][_0xb3ad('0x5d')]:undefined)||'0.00'},{'name':_0xb3ad('0x62'),'value':_0x3b9ad5[_0xb3ad('0x62')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x2]?_0x3b9ad5['attrs'][0x2][_0xb3ad('0x5d')]:undefined)||0xc}];case _0xb3ad('0x63'):return[{'name':_0xb3ad('0x64'),'value':_0x3b9ad5[_0xb3ad('0x64')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0][_0xb3ad('0x5d')]:undefined)||_0xb3ad('0x65')},{'name':_0xb3ad('0x66'),'value':_0x3b9ad5['attrVoiceQueues']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x1]?_0x3b9ad5[_0xb3ad('0x5b')][0x1][_0xb3ad('0x5d')]:undefined)||[]},{'name':_0xb3ad('0x62'),'value':_0x3b9ad5[_0xb3ad('0x62')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x2]?_0x3b9ad5[_0xb3ad('0x5b')][0x2][_0xb3ad('0x5d')]:undefined)||0x14},{'name':_0xb3ad('0x67'),'value':_0x3b9ad5[_0xb3ad('0x67')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x3]?_0x3b9ad5[_0xb3ad('0x5b')][0x3]['value']:undefined)||_0xb3ad('0x68')},{'name':_0xb3ad('0x69'),'value':_0x3b9ad5[_0xb3ad('0x69')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x4]?_0x3b9ad5[_0xb3ad('0x5b')][0x4][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6a'),'value':_0x3b9ad5['attrFaxAccounts']||(_0x3b9ad5['attrs']&&_0x3b9ad5[_0xb3ad('0x5b')][0x5]?_0x3b9ad5[_0xb3ad('0x5b')][0x5][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6b'),'value':_0x3b9ad5['attrSmsAccounts']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x6]?_0x3b9ad5[_0xb3ad('0x5b')][0x6][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6c'),'value':_0x3b9ad5[_0xb3ad('0x6c')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x7]?_0x3b9ad5[_0xb3ad('0x5b')][0x7]['value']:undefined)||''},{'name':_0xb3ad('0x6d'),'value':_0x3b9ad5[_0xb3ad('0x6d')]||(_0x3b9ad5['attrs']&&_0x3b9ad5['attrs'][0x8]?_0x3b9ad5[_0xb3ad('0x5b')][0x8][_0xb3ad('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3b9ad5[_0xb3ad('0x6e')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x9]?_0x3b9ad5[_0xb3ad('0x5b')][0x9][_0xb3ad('0x5d')]:undefined)||''}];case'multibar-chart':case _0xb3ad('0x6f'):return[{'name':'attrSerie1','value':_0x3b9ad5[_0xb3ad('0x70')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0]['value']:undefined)||'total'},{'name':_0xb3ad('0x71'),'value':_0x3b9ad5['attrSerie2']||(_0x3b9ad5['attrs']&&_0x3b9ad5['attrs'][0x1]?_0x3b9ad5['attrs'][0x1]['value']:undefined)||null},{'name':_0xb3ad('0x72'),'value':_0x3b9ad5[_0xb3ad('0x72')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x2]?_0x3b9ad5[_0xb3ad('0x5b')][0x2][_0xb3ad('0x5d')]:undefined)||null},{'name':_0xb3ad('0x66'),'value':_0x3b9ad5['attrVoiceQueues']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x3]?_0x3b9ad5[_0xb3ad('0x5b')][0x3][_0xb3ad('0x5d')]:undefined)||[]},{'name':_0xb3ad('0x67'),'value':_0x3b9ad5['attrChannel']||(_0x3b9ad5['attrs']&&_0x3b9ad5[_0xb3ad('0x5b')][0x4]?_0x3b9ad5[_0xb3ad('0x5b')][0x4][_0xb3ad('0x5d')]:undefined)||_0xb3ad('0x68')},{'name':_0xb3ad('0x69'),'value':_0x3b9ad5[_0xb3ad('0x69')]||(_0x3b9ad5['attrs']&&_0x3b9ad5[_0xb3ad('0x5b')][0x5]?_0x3b9ad5[_0xb3ad('0x5b')][0x5][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6a'),'value':_0x3b9ad5[_0xb3ad('0x6a')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x6]?_0x3b9ad5[_0xb3ad('0x5b')][0x6]['value']:undefined)||''},{'name':_0xb3ad('0x6b'),'value':_0x3b9ad5['attrSmsAccounts']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x7]?_0x3b9ad5[_0xb3ad('0x5b')][0x7][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6c'),'value':_0x3b9ad5['attrOpenchannelAccounts']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x8]?_0x3b9ad5[_0xb3ad('0x5b')][0x8][_0xb3ad('0x5d')]:undefined)||''},{'name':_0xb3ad('0x6d'),'value':_0x3b9ad5['attrWhatsappAccounts']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5['attrs'][0x9]?_0x3b9ad5['attrs'][0x9][_0xb3ad('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3b9ad5[_0xb3ad('0x6e')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0xa]?_0x3b9ad5[_0xb3ad('0x5b')][0xa][_0xb3ad('0x5d')]:undefined)||''}];case _0xb3ad('0x73'):return[{'name':_0xb3ad('0x74'),'type':_0x3b9ad5['reportType']||(_0x3b9ad5['attrs']&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0][_0xb3ad('0x2f')]:undefined)||null,'value':_0x3b9ad5[_0xb3ad('0x74')]||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x0]?_0x3b9ad5[_0xb3ad('0x5b')][0x0][_0xb3ad('0x5d')]:undefined)||null},{'name':_0xb3ad('0x75'),'value':_0x3b9ad5['attrRefresh']||(_0x3b9ad5[_0xb3ad('0x5b')]&&_0x3b9ad5[_0xb3ad('0x5b')][0x1]?_0x3b9ad5[_0xb3ad('0x5b')][0x1][_0xb3ad('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x409026){logger['error'](_0xb3ad('0x76'),JSON[_0xb3ad('0x77')](_0x409026));return[];}}exports[_0xb3ad('0x78')]=function(_0x230eaf,_0x345f4d,_0x53ced6){if(_0x230eaf['body']['id']){delete _0x230eaf['body']['id'];}return db[_0xb3ad('0x2c')]['find']({'where':{'id':_0x230eaf['params']['id']}})[_0xb3ad('0x25')](handleEntityNotFound(_0x345f4d,null))[_0xb3ad('0x25')](function(_0x3cb726){if(_0x3cb726){_0x230eaf[_0xb3ad('0x4b')]['DashboardId']=_0x3cb726['id'];_0x230eaf[_0xb3ad('0x4b')][_0xb3ad('0x5b')]=widgetAttributes(_0x230eaf[_0xb3ad('0x4b')]);return db[_0xb3ad('0x79')][_0xb3ad('0x4a')](_0x230eaf[_0xb3ad('0x4b')]);}})[_0xb3ad('0x25')](respondWithResult(_0x345f4d,null))[_0xb3ad('0x48')](handleError(_0x345f4d,null));};exports[_0xb3ad('0x7a')]=function(_0x4933da,_0x558d6e,_0x11e497){var _0x23806b={};var _0x34f21e={};var _0x544cd6;var _0x406c1b;return db[_0xb3ad('0x2c')][_0xb3ad('0x7b')]({'where':{'id':_0x4933da[_0xb3ad('0x58')]['id']}})[_0xb3ad('0x25')](handleEntityNotFound(_0x558d6e,null))[_0xb3ad('0x25')](function(_0x3c867b){if(_0x3c867b){_0x544cd6=_0x3c867b;_0x34f21e[_0xb3ad('0x31')]=_[_0xb3ad('0x33')](db['DashboardItem'][_0xb3ad('0x2d')]);_0x34f21e[_0xb3ad('0x36')]=_[_0xb3ad('0x33')](_0x4933da[_0xb3ad('0x36')]);_0x34f21e[_0xb3ad('0x34')]=_[_0xb3ad('0x35')](_0x34f21e[_0xb3ad('0x31')],_0x34f21e[_0xb3ad('0x36')]);_0x23806b['attributes']=_['intersection'](_0x34f21e['model'],qs[_0xb3ad('0x37')](_0x4933da['query'][_0xb3ad('0x37')]));_0x23806b['attributes']=_0x23806b['attributes'][_0xb3ad('0x39')]?_0x23806b[_0xb3ad('0x38')]:_0x34f21e[_0xb3ad('0x31')];_0x23806b[_0xb3ad('0x3c')]=qs[_0xb3ad('0x3d')](_0x4933da[_0xb3ad('0x36')]['sort']);_0x23806b[_0xb3ad('0x3e')]=qs[_0xb3ad('0x34')](_['pick'](_0x4933da[_0xb3ad('0x36')],_0x34f21e[_0xb3ad('0x34')]));if(_0x4933da[_0xb3ad('0x36')][_0xb3ad('0x40')]){_0x23806b[_0xb3ad('0x3e')]=_[_0xb3ad('0x41')](_0x23806b['where'],{'$or':_[_0xb3ad('0x32')](_0x23806b[_0xb3ad('0x38')],function(_0x464f81){var _0x2bf975={};_0x2bf975[_0x464f81]={'$like':'%'+_0x4933da['query'][_0xb3ad('0x40')]+'%'};return _0x2bf975;})});}_0x23806b=_[_0xb3ad('0x41')]({},_0x23806b,_0x4933da['options']);return _0x544cd6[_0xb3ad('0x7a')](_0x23806b);}})[_0xb3ad('0x25')](function(_0x4f46d2){if(_0x4f46d2){_0x406c1b=_0x4f46d2[_0xb3ad('0x39')];if(!_0x4933da[_0xb3ad('0x36')][_0xb3ad('0x3a')]('nolimit')){_0x23806b[_0xb3ad('0x1f')]=qs[_0xb3ad('0x1f')](_0x4933da['query']['limit']);_0x23806b['offset']=qs[_0xb3ad('0x1d')](_0x4933da[_0xb3ad('0x36')]['offset']);}return _0x544cd6['getItems'](_0x23806b);}})['then'](function(_0xd2fc0){if(_0xd2fc0){return _0xd2fc0?{'count':_0x406c1b,'rows':_0xd2fc0}:null;}})[_0xb3ad('0x25')](respondWithResult(_0x558d6e,null))[_0xb3ad('0x48')](handleError(_0x558d6e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8d28152..5b57a33 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 _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','emit'];(function(_0x4db1c5,_0x4e3f37){var _0x5bd81b=function(_0x36454d){while(--_0x36454d){_0x4db1c5['push'](_0x4db1c5['shift']());}};_0x5bd81b(++_0x4e3f37);}(_0x0f80,0x108));var _0x00f8=function(_0x538ad6,_0x2c43d3){_0x538ad6=_0x538ad6-0x0;var _0x34d9f1=_0x0f80[_0x538ad6];return _0x34d9f1;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){DashboardEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);DashboardEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];Dashboard[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('0x8')]=DashboardEvents; \ No newline at end of file +var _0x4e61=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ea290,_0x470735){var _0x4ade49=function(_0x501f49){while(--_0x501f49){_0x4ea290['push'](_0x4ea290['shift']());}};_0x4ade49(++_0x470735);}(_0x4e61,0x1cf));var _0x14e6=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x4e61[_0x525af9];return _0x129fbf;};'use strict';var EventEmitter=require(_0x14e6('0x0'));var Dashboard=require(_0x14e6('0x1'))['db'][_0x14e6('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x14e6('0x3')](0x0);var events={'afterCreate':_0x14e6('0x4'),'afterUpdate':_0x14e6('0x5'),'afterDestroy':_0x14e6('0x6')};function emitEvent(_0x3413d6){return function(_0x24b954,_0x4e37a4,_0x15a77f){DashboardEvents[_0x14e6('0x7')](_0x3413d6+':'+_0x24b954['id'],_0x24b954);DashboardEvents[_0x14e6('0x7')](_0x3413d6,_0x24b954);_0x15a77f(null);};}for(var e in events){if(events[_0x14e6('0x8')](e)){var event=events[e];Dashboard[_0x14e6('0x9')](e,emitEvent(event));}}module[_0x14e6('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 389f2d0..9fb5ef3 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 _0xb892=['dashboards','util','../../config/logger','moment','bluebird','request-promise','path','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2a94fc,_0x5635ba){var _0xedd69f=function(_0x277831){while(--_0x277831){_0x2a94fc['push'](_0x2a94fc['shift']());}};_0xedd69f(++_0x5635ba);}(_0xb892,0x9b));var _0x2b89=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xb892[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require('lodash');var util=require(_0x2b89('0x0'));var logger=require(_0x2b89('0x1'))('api');var moment=require(_0x2b89('0x2'));var BPromise=require(_0x2b89('0x3'));var rp=require(_0x2b89('0x4'));var fs=require('fs');var path=require(_0x2b89('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b89('0x6'));module[_0x2b89('0x7')]=function(_0x2fa58f,_0x169e77){return _0x2fa58f[_0x2b89('0x8')](_0x2b89('0x9'),attributes,{'tableName':_0x2b89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2171=['bluebird','request-promise','path','../../config/environment','define','Dashboard','lodash','api','moment'];(function(_0x15ae7c,_0x563916){var _0x32483c=function(_0x5ab54d){while(--_0x5ab54d){_0x15ae7c['push'](_0x15ae7c['shift']());}};_0x32483c(++_0x563916);}(_0x2171,0x15c));var _0x1217=function(_0x1a431c,_0x1728db){_0x1a431c=_0x1a431c-0x0;var _0x4f64af=_0x2171[_0x1a431c];return _0x4f64af;};'use strict';var _=require(_0x1217('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1217('0x1'));var moment=require(_0x1217('0x2'));var BPromise=require(_0x1217('0x3'));var rp=require(_0x1217('0x4'));var fs=require('fs');var path=require(_0x1217('0x5'));var rimraf=require('rimraf');var config=require(_0x1217('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x2dd1d6,_0x3b58f0){return _0x2dd1d6[_0x1217('0x7')](_0x1217('0x8'),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 a230a4d..d275762 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 _0x7450=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','./dashboard.socket','register','request'];(function(_0x73e4cf,_0x2a8375){var _0x1e1bf8=function(_0xca0967){while(--_0xca0967){_0x73e4cf['push'](_0x73e4cf['shift']());}};_0x1e1bf8(++_0x2a8375);}(_0x7450,0xc0));var _0x0745=function(_0x59b3d1,_0x4f6ed0){_0x59b3d1=_0x59b3d1-0x0;var _0x328c7e=_0x7450[_0x59b3d1];return _0x328c7e;};'use strict';var _=require(_0x0745('0x0'));var util=require('util');var moment=require(_0x0745('0x1'));var BPromise=require(_0x0745('0x2'));var rs=require(_0x0745('0x3'));var fs=require('fs');var Redis=require(_0x0745('0x4'));var db=require(_0x0745('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0745('0x6'))(_0x0745('0x7'));var config=require('../../config/environment');var jayson=require(_0x0745('0x8'));var client=jayson['client'][_0x0745('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0745('0xa')],{'host':_0x0745('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0745('0xc'))[_0x0745('0xd')](socket);function respondWithRpcPromise(_0x36bf4f,_0x1e31c6,_0x93a41d){return new BPromise(function(_0x3e5d33,_0x2d7858){return client[_0x0745('0xe')](_0x36bf4f,_0x93a41d)[_0x0745('0xf')](function(_0x389cb9){logger[_0x0745('0x10')](_0x0745('0x11'),_0x1e31c6,_0x0745('0x12'));logger[_0x0745('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x1e31c6,_0x0745('0x12'),JSON['stringify'](_0x389cb9));if(_0x389cb9[_0x0745('0x14')]){if(_0x389cb9[_0x0745('0x14')]['code']===0x1f4){logger[_0x0745('0x14')](_0x0745('0x11'),_0x1e31c6,_0x389cb9[_0x0745('0x14')][_0x0745('0x15')]);return _0x2d7858(_0x389cb9[_0x0745('0x14')][_0x0745('0x15')]);}logger[_0x0745('0x14')]('Dashboard,\x20%s,\x20%s',_0x1e31c6,_0x389cb9['error'][_0x0745('0x15')]);return _0x3e5d33(_0x389cb9['error'][_0x0745('0x15')]);}else{logger[_0x0745('0x10')](_0x0745('0x11'),_0x1e31c6,_0x0745('0x12'));_0x3e5d33(_0x389cb9['result'][_0x0745('0x15')]);}})[_0x0745('0x16')](function(_0x4e6072){logger[_0x0745('0x14')](_0x0745('0x11'),_0x1e31c6,_0x4e6072);_0x2d7858(_0x4e6072);});});} \ No newline at end of file +var _0x9b74=['Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then'];(function(_0x51e9f2,_0x19f63b){var _0x531bb2=function(_0x3cc43f){while(--_0x3cc43f){_0x51e9f2['push'](_0x51e9f2['shift']());}};_0x531bb2(++_0x19f63b);}(_0x9b74,0x15c));var _0x49b7=function(_0x577b0c,_0xff5f7e){_0x577b0c=_0x577b0c-0x0;var _0x35219d=_0x9b74[_0x577b0c];return _0x35219d;};'use strict';var _=require(_0x49b7('0x0'));var util=require(_0x49b7('0x1'));var moment=require('moment');var BPromise=require(_0x49b7('0x2'));var rs=require(_0x49b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x49b7('0x5'))(_0x49b7('0x6'));var config=require(_0x49b7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49b7('0x8')][_0x49b7('0x9')]({'port':0x232a});config[_0x49b7('0xa')]=_['defaults'](config[_0x49b7('0xa')],{'host':_0x49b7('0xb'),'port':0x18eb});var socket=require(_0x49b7('0xc'))(new Redis(config[_0x49b7('0xa')]));require(_0x49b7('0xd'))[_0x49b7('0xe')](socket);function respondWithRpcPromise(_0x5f1bf4,_0x41a325,_0x4b0547){return new BPromise(function(_0x38a87d,_0x4def49){return client['request'](_0x5f1bf4,_0x4b0547)[_0x49b7('0xf')](function(_0x30e7a4){logger['info'](_0x49b7('0x10'),_0x41a325,_0x49b7('0x11'));logger['debug'](_0x49b7('0x12'),_0x41a325,'request\x20sent',JSON[_0x49b7('0x13')](_0x30e7a4));if(_0x30e7a4[_0x49b7('0x14')]){if(_0x30e7a4[_0x49b7('0x14')][_0x49b7('0x15')]===0x1f4){logger[_0x49b7('0x14')]('Dashboard,\x20%s,\x20%s',_0x41a325,_0x30e7a4[_0x49b7('0x14')]['message']);return _0x4def49(_0x30e7a4[_0x49b7('0x14')][_0x49b7('0x16')]);}logger[_0x49b7('0x14')](_0x49b7('0x10'),_0x41a325,_0x30e7a4['error']['message']);return _0x38a87d(_0x30e7a4['error'][_0x49b7('0x16')]);}else{logger[_0x49b7('0x17')](_0x49b7('0x10'),_0x41a325,_0x49b7('0x11'));_0x38a87d(_0x30e7a4[_0x49b7('0x18')][_0x49b7('0x16')]);}})[_0x49b7('0x19')](function(_0x3d7c46){logger[_0x49b7('0x14')]('Dashboard,\x20%s,\x20%s',_0x41a325,_0x3d7c46);_0x4def49(_0x3d7c46);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 642c2a1..2bfbc58 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 _0x3c2a=['remove','update','removeListener','register','./dashboard.events','save'];(function(_0x2fa310,_0x1557fb){var _0x41b6a0=function(_0x221a55){while(--_0x221a55){_0x2fa310['push'](_0x2fa310['shift']());}};_0x41b6a0(++_0x1557fb);}(_0x3c2a,0xb8));var _0xa3c2=function(_0x42f92e,_0x33951c){_0x42f92e=_0x42f92e-0x0;var _0x5ab5f1=_0x3c2a[_0x42f92e];return _0x5ab5f1;};'use strict';var DashboardEvents=require(_0xa3c2('0x0'));var events=[_0xa3c2('0x1'),_0xa3c2('0x2'),_0xa3c2('0x3')];function createListener(_0x2f67c0,_0x407148){return function(_0x343845){_0x407148['emit'](_0x2f67c0,_0x343845);};}function removeListener(_0x3bdca9,_0x9dc3c1){return function(){DashboardEvents[_0xa3c2('0x4')](_0x3bdca9,_0x9dc3c1);};}exports[_0xa3c2('0x5')]=function(_0x4d6363){for(var _0x73b560=0x0,_0xe8372d=events['length'];_0x73b560<_0xe8372d;_0x73b560++){var _0x1e214f=events[_0x73b560];var _0x144b20=createListener('dashboard:'+_0x1e214f,_0x4d6363);DashboardEvents['on'](_0x1e214f,_0x144b20);}}; \ No newline at end of file +var _0x7264=['emit','register','length','dashboard:','./dashboard.events','remove'];(function(_0x4202bc,_0x2ed6cf){var _0x319148=function(_0x537d36){while(--_0x537d36){_0x4202bc['push'](_0x4202bc['shift']());}};_0x319148(++_0x2ed6cf);}(_0x7264,0x7c));var _0x4726=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7264[_0x6131cd];return _0x47e916;};'use strict';var DashboardEvents=require(_0x4726('0x0'));var events=['save',_0x4726('0x1'),'update'];function createListener(_0x185a40,_0x516bd1){return function(_0x3a46f2){_0x516bd1[_0x4726('0x2')](_0x185a40,_0x3a46f2);};}function removeListener(_0x1b00d8,_0x29a05f){return function(){DashboardEvents['removeListener'](_0x1b00d8,_0x29a05f);};}exports[_0x4726('0x3')]=function(_0x598c05){for(var _0x4f306d=0x0,_0x18e5eb=events[_0x4726('0x4')];_0x4f306d<_0x18e5eb;_0x4f306d++){var _0x510d7b=events[_0x4f306d];var _0x2d2133=createListener(_0x4726('0x5')+_0x510d7b,_0x598c05);DashboardEvents['on'](_0x510d7b,_0x2d2133);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7e63a08..a67c532 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 _0x20be=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','/:id/items','isAuthenticated','post','create','/:id/clone','clone','addItem','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4acc32,_0x1685e7){var _0x5b019a=function(_0x3e36a9){while(--_0x3e36a9){_0x4acc32['push'](_0x4acc32['shift']());}};_0x5b019a(++_0x1685e7);}(_0x20be,0x170));var _0xe20b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x20be[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe20b('0x0'));var util=require(_0xe20b('0x1'));var path=require(_0xe20b('0x2'));var timeout=require(_0xe20b('0x3'));var express=require(_0xe20b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe20b('0x5'));var interaction=require(_0xe20b('0x6'));var config=require(_0xe20b('0x7'));var controller=require(_0xe20b('0x8'));router[_0xe20b('0x9')]('/',auth['isAuthenticated'](),controller[_0xe20b('0xa')]);router['get'](_0xe20b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe20b('0x9')](_0xe20b('0xc'),auth[_0xe20b('0xd')](),controller['getItems']);router[_0xe20b('0xe')]('/',auth['isAuthenticated'](),controller[_0xe20b('0xf')]);router[_0xe20b('0xe')](_0xe20b('0x10'),auth[_0xe20b('0xd')](),controller[_0xe20b('0x11')]);router[_0xe20b('0xe')](_0xe20b('0xc'),auth[_0xe20b('0xd')](),controller[_0xe20b('0x12')]);router[_0xe20b('0x13')](_0xe20b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe20b('0x14')](_0xe20b('0xb'),auth[_0xe20b('0xd')](),controller[_0xe20b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc5df=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','clone','addItem','put'];(function(_0xfb1f40,_0x4016b7){var _0x15a357=function(_0x46c0d2){while(--_0x46c0d2){_0xfb1f40['push'](_0xfb1f40['shift']());}};_0x15a357(++_0x4016b7);}(_0xc5df,0x14d));var _0xfc5d=function(_0x3263b5,_0x286b6a){_0x3263b5=_0x3263b5-0x0;var _0x17910a=_0xc5df[_0x3263b5];return _0x17910a;};'use strict';var multer=require(_0xfc5d('0x0'));var util=require(_0xfc5d('0x1'));var path=require(_0xfc5d('0x2'));var timeout=require(_0xfc5d('0x3'));var express=require(_0xfc5d('0x4'));var router=express[_0xfc5d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc5d('0x6'));var interaction=require(_0xfc5d('0x7'));var config=require('../../config/environment');var controller=require(_0xfc5d('0x8'));router[_0xfc5d('0x9')]('/',auth[_0xfc5d('0xa')](),controller['index']);router['get'](_0xfc5d('0xb'),auth[_0xfc5d('0xa')](),controller[_0xfc5d('0xc')]);router['get'](_0xfc5d('0xd'),auth[_0xfc5d('0xa')](),controller[_0xfc5d('0xe')]);router[_0xfc5d('0xf')]('/',auth[_0xfc5d('0xa')](),controller['create']);router[_0xfc5d('0xf')]('/:id/clone',auth[_0xfc5d('0xa')](),controller[_0xfc5d('0x10')]);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0xfc5d('0x11')]);router[_0xfc5d('0x12')]('/:id',auth[_0xfc5d('0xa')](),controller[_0xfc5d('0x13')]);router[_0xfc5d('0x14')](_0xfc5d('0xb'),auth['isAuthenticated'](),controller[_0xfc5d('0x15')]);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 1e84fca..7362d78 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x71ab,0x64));var _0xb71a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x71ab[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x2ec911,_0x58c0da){var _0x540dbe=function(_0x5e6093){while(--_0x5e6093){_0x2ec911['push'](_0x2ec911['shift']());}};_0x540dbe(++_0x58c0da);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5517dd,_0x433948){_0x5517dd=_0x5517dd-0x0;var _0x46444a=_0xdbf5[_0x5517dd];return _0x46444a;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e6da7c5..0ffc070 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 _0x5785=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','show','DashboardItem','keys','filters','intersection','model','query','fields','attributes','length','include','options','catch','find','params','iframe','attrs','custom','attrPath','clock','value','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrChannel','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5785,0x119));var _0x5578=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5785[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x5578('0x0'));var rimraf=require(_0x5578('0x1'));var zipdir=require(_0x5578('0x2'));var jsonpatch=require(_0x5578('0x3'));var rp=require(_0x5578('0x4'));var moment=require('moment');var BPromise=require(_0x5578('0x5'));var Mustache=require(_0x5578('0x6'));var util=require(_0x5578('0x7'));var path=require(_0x5578('0x8'));var sox=require(_0x5578('0x9'));var csv=require(_0x5578('0xa'));var ejs=require(_0x5578('0xb'));var fs=require('fs');var fs_extra=require(_0x5578('0xc'));var _=require(_0x5578('0xd'));var squel=require(_0x5578('0xe'));var crypto=require('crypto');var jsforce=require(_0x5578('0xf'));var deskjs=require(_0x5578('0x10'));var toCsv=require(_0x5578('0xa'));var querystring=require('querystring');var Papa=require(_0x5578('0x11'));var Redis=require('ioredis');var authService=require(_0x5578('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5578('0x13'));var hardwareService=require(_0x5578('0x14'));var logger=require(_0x5578('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5578('0x16'));var licenseUtil=require(_0x5578('0x17'));var db=require(_0x5578('0x18'))['db'];config[_0x5578('0x19')]=_[_0x5578('0x1a')](config[_0x5578('0x19')],{'host':_0x5578('0x1b'),'port':0x18eb});var socket=require(_0x5578('0x1c'))(new Redis(config[_0x5578('0x19')]));require(_0x5578('0x1d'))['register'](socket);function respondWithStatusCode(_0xe7ea50,_0xa3c79b){_0xa3c79b=_0xa3c79b||0xcc;return function(_0x2f88c1){if(_0x2f88c1){return _0xe7ea50[_0x5578('0x1e')](_0xa3c79b);}return _0xe7ea50[_0x5578('0x1f')](_0xa3c79b)[_0x5578('0x20')]();};}function respondWithResult(_0x3fa05b,_0x3be4ef){_0x3be4ef=_0x3be4ef||0xc8;return function(_0xe91599){if(_0xe91599){return _0x3fa05b[_0x5578('0x1f')](_0x3be4ef)['json'](_0xe91599);}};}function respondWithFilteredResult(_0x24b5b1,_0x85cb40){return function(_0x5db57a){if(_0x5db57a){var _0x59fb63=typeof _0x85cb40[_0x5578('0x21')]===_0x5578('0x22')&&typeof _0x85cb40['limit']===_0x5578('0x22');var _0x2021b6=_0x5db57a[_0x5578('0x23')];var _0xdd1957=_0x59fb63?0x0:_0x85cb40[_0x5578('0x21')];var _0x2d7d70=_0x59fb63?_0x5db57a[_0x5578('0x23')]:_0x85cb40[_0x5578('0x21')]+_0x85cb40[_0x5578('0x24')];var _0x38d06f;if(_0x2d7d70>=_0x2021b6){_0x2d7d70=_0x2021b6;_0x38d06f=0xc8;}else{_0x38d06f=0xce;}_0x24b5b1[_0x5578('0x1f')](_0x38d06f);return _0x24b5b1[_0x5578('0x25')](_0x5578('0x26'),_0xdd1957+'-'+_0x2d7d70+'/'+_0x2021b6)[_0x5578('0x27')](_0x5db57a);}return null;};}function patchUpdates(_0x5d0a54){return function(_0x18ac7b){try{jsonpatch['apply'](_0x18ac7b,_0x5d0a54,!![]);}catch(_0x208952){return BPromise[_0x5578('0x28')](_0x208952);}return _0x18ac7b[_0x5578('0x29')]();};}function saveUpdates(_0x199853,_0x198c3e){return function(_0x4783f3){if(_0x4783f3){return _0x4783f3['update'](_0x199853)[_0x5578('0x2a')](function(_0x5d2c0c){return _0x5d2c0c;});}return null;};}function removeEntity(_0x4c4d89,_0x16cea){return function(_0x504493){if(_0x504493){return _0x504493[_0x5578('0x2b')]()[_0x5578('0x2a')](function(){_0x4c4d89[_0x5578('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27380f,_0x142098){return function(_0x5b3a9c){if(!_0x5b3a9c){_0x27380f['sendStatus'](0x194);}return _0x5b3a9c;};}function handleError(_0x3266b4,_0x42eebd){_0x42eebd=_0x42eebd||0x1f4;return function(_0x807da6){logger[_0x5578('0x2c')](_0x807da6[_0x5578('0x2d')]);if(_0x807da6['name']){delete _0x807da6[_0x5578('0x2e')];}_0x3266b4[_0x5578('0x1f')](_0x42eebd)[_0x5578('0x2f')](_0x807da6);};}exports[_0x5578('0x30')]=function(_0x10f72f,_0xe44d1b){var _0x896221={'raw':![],'where':{'id':_0x10f72f['params']['id']}},_0x2d6ea1={};_0x2d6ea1['model']=_['keys'](db[_0x5578('0x31')]['rawAttributes']);_0x2d6ea1['query']=_[_0x5578('0x32')](_0x10f72f['query']);_0x2d6ea1[_0x5578('0x33')]=_[_0x5578('0x34')](_0x2d6ea1[_0x5578('0x35')],_0x2d6ea1[_0x5578('0x36')]);_0x896221['attributes']=_[_0x5578('0x34')](_0x2d6ea1[_0x5578('0x35')],qs[_0x5578('0x37')](_0x10f72f[_0x5578('0x36')]['fields']));_0x896221[_0x5578('0x38')]=_0x896221[_0x5578('0x38')][_0x5578('0x39')]?_0x896221['attributes']:_0x2d6ea1[_0x5578('0x35')];if(_0x10f72f[_0x5578('0x36')]['includeAll']){_0x896221[_0x5578('0x3a')]=[{'all':!![]}];}_0x896221=_['merge']({},_0x896221,_0x10f72f[_0x5578('0x3b')]);return db[_0x5578('0x31')]['find'](_0x896221)[_0x5578('0x2a')](handleEntityNotFound(_0xe44d1b,null))[_0x5578('0x2a')](respondWithResult(_0xe44d1b,null))[_0x5578('0x3c')](handleError(_0xe44d1b,null));};exports[_0x5578('0x2b')]=function(_0x5055a8,_0x1df687){return db[_0x5578('0x31')][_0x5578('0x3d')]({'where':{'id':_0x5055a8[_0x5578('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1df687,null))[_0x5578('0x2a')](removeEntity(_0x1df687,null))[_0x5578('0x3c')](handleError(_0x1df687,null));};function widgetAttributes(_0x750014){try{switch(_0x750014['type']){case _0x5578('0x3f'):return[{'name':'attrUrl','value':_0x750014['attrUrl']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014[_0x5578('0x40')][0x0]['value']:undefined)||'https://'}];case _0x5578('0x41'):return[{'name':_0x5578('0x42'),'value':_0x750014[_0x5578('0x42')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014['attrs'][0x0]['value']:undefined)||''}];case _0x5578('0x43'):return[{'name':'attrHourFormat','value':_0x750014['attrHourFormat']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014[_0x5578('0x40')][0x0][_0x5578('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x5578('0x45'),'value':_0x750014[_0x5578('0x45')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x1]?_0x750014[_0x5578('0x40')][0x1]['value']:undefined)||_0x5578('0x46')},{'name':_0x5578('0x47'),'value':_0x750014['attrFontSize']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x2]?_0x750014[_0x5578('0x40')][0x2]['value']:undefined)||0xc}];case _0x5578('0x48'):return[{'name':_0x5578('0x49'),'value':_0x750014[_0x5578('0x49')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x0]?_0x750014[_0x5578('0x40')][0x0][_0x5578('0x44')]:undefined)||_0x5578('0x4a')},{'name':'attrVoiceQueues','value':_0x750014['attrVoiceQueues']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x1]?_0x750014['attrs'][0x1][_0x5578('0x44')]:undefined)||[]},{'name':_0x5578('0x47'),'value':_0x750014[_0x5578('0x47')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x2]?_0x750014[_0x5578('0x40')][0x2][_0x5578('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x750014['attrChannel']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x3]?_0x750014['attrs'][0x3]['value']:undefined)||_0x5578('0x4b')},{'name':_0x5578('0x4c'),'value':_0x750014[_0x5578('0x4c')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x4]?_0x750014[_0x5578('0x40')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x750014[_0x5578('0x4d')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x5]?_0x750014[_0x5578('0x40')][0x5][_0x5578('0x44')]:undefined)||''},{'name':_0x5578('0x4e'),'value':_0x750014['attrSmsAccounts']||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x6]?_0x750014[_0x5578('0x40')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x750014[_0x5578('0x4f')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x7]?_0x750014['attrs'][0x7][_0x5578('0x44')]:undefined)||''},{'name':_0x5578('0x50'),'value':_0x750014[_0x5578('0x50')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x8]?_0x750014[_0x5578('0x40')][0x8][_0x5578('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x750014[_0x5578('0x51')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x9]?_0x750014[_0x5578('0x40')][0x9]['value']:undefined)||''}];case _0x5578('0x52'):case _0x5578('0x53'):return[{'name':_0x5578('0x54'),'value':_0x750014[_0x5578('0x54')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014[_0x5578('0x40')][0x0][_0x5578('0x44')]:undefined)||'total'},{'name':_0x5578('0x55'),'value':_0x750014[_0x5578('0x55')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x1]?_0x750014['attrs'][0x1][_0x5578('0x44')]:undefined)||null},{'name':_0x5578('0x56'),'value':_0x750014[_0x5578('0x56')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x2]?_0x750014[_0x5578('0x40')][0x2][_0x5578('0x44')]:undefined)||null},{'name':_0x5578('0x57'),'value':_0x750014['attrVoiceQueues']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x3]?_0x750014[_0x5578('0x40')][0x3][_0x5578('0x44')]:undefined)||[]},{'name':_0x5578('0x58'),'value':_0x750014[_0x5578('0x58')]||(_0x750014['attrs']&&_0x750014[_0x5578('0x40')][0x4]?_0x750014[_0x5578('0x40')][0x4][_0x5578('0x44')]:undefined)||_0x5578('0x4b')},{'name':_0x5578('0x4c'),'value':_0x750014['attrEmailAccounts']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x5]?_0x750014['attrs'][0x5]['value']:undefined)||''},{'name':_0x5578('0x4d'),'value':_0x750014[_0x5578('0x4d')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x6]?_0x750014['attrs'][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x750014[_0x5578('0x4e')]||(_0x750014[_0x5578('0x40')]&&_0x750014['attrs'][0x7]?_0x750014[_0x5578('0x40')][0x7][_0x5578('0x44')]:undefined)||''},{'name':_0x5578('0x4f'),'value':_0x750014[_0x5578('0x4f')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x8]?_0x750014['attrs'][0x8][_0x5578('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x750014[_0x5578('0x50')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x9]?_0x750014[_0x5578('0x40')][0x9][_0x5578('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x750014[_0x5578('0x51')]||(_0x750014['attrs']&&_0x750014['attrs'][0xa]?_0x750014[_0x5578('0x40')][0xa][_0x5578('0x44')]:undefined)||''}];case _0x5578('0x59'):return[{'name':'attrReport','type':_0x750014[_0x5578('0x5a')]||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014[_0x5578('0x40')][0x0]['type']:undefined)||null,'value':_0x750014['attrReport']||(_0x750014[_0x5578('0x40')]&&_0x750014[_0x5578('0x40')][0x0]?_0x750014[_0x5578('0x40')][0x0]['value']:undefined)||null},{'name':_0x5578('0x5b'),'value':_0x750014[_0x5578('0x5b')]||(_0x750014['attrs']&&_0x750014[_0x5578('0x40')][0x1]?_0x750014['attrs'][0x1][_0x5578('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x39774f){logger[_0x5578('0x2c')](_0x5578('0x5c'),JSON[_0x5578('0x5d')](_0x39774f));return[];}}exports['create']=function(_0x39402c,_0x1fd960){if(_0x39402c[_0x5578('0x5e')]){_0x39402c[_0x5578('0x5e')]['attrs']=widgetAttributes(_0x39402c[_0x5578('0x5e')]);}return db[_0x5578('0x31')]['create'](_0x39402c[_0x5578('0x5e')],{})[_0x5578('0x2a')](respondWithResult(_0x1fd960,0xc9))[_0x5578('0x3c')](handleError(_0x1fd960,null));};exports['update']=function(_0x3a8a33,_0x466d5d){if(_0x3a8a33[_0x5578('0x5e')]['id']){delete _0x3a8a33[_0x5578('0x5e')]['id'];}_0x3a8a33[_0x5578('0x5e')]['attrs']=widgetAttributes(_0x3a8a33[_0x5578('0x5e')]);return db[_0x5578('0x31')]['find']({'where':{'id':_0x3a8a33['params']['id']}})[_0x5578('0x2a')](handleEntityNotFound(_0x466d5d,null))[_0x5578('0x2a')](saveUpdates(_0x3a8a33[_0x5578('0x5e')],null))[_0x5578('0x2a')](respondWithResult(_0x466d5d,null))[_0x5578('0x3c')](handleError(_0x466d5d,null));}; \ No newline at end of file +var _0x4cfd=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','find','catch','type','attrUrl','attrs','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4cfd,0x170));var _0xd4cf=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x4cfd[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4cf('0x2'));var rp=require(_0xd4cf('0x3'));var moment=require(_0xd4cf('0x4'));var BPromise=require(_0xd4cf('0x5'));var Mustache=require(_0xd4cf('0x6'));var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require(_0xd4cf('0x8'));var csv=require(_0xd4cf('0x9'));var ejs=require(_0xd4cf('0xa'));var fs=require('fs');var fs_extra=require(_0xd4cf('0xb'));var _=require(_0xd4cf('0xc'));var squel=require(_0xd4cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xe'));var deskjs=require(_0xd4cf('0xf'));var toCsv=require(_0xd4cf('0x9'));var querystring=require(_0xd4cf('0x10'));var Papa=require(_0xd4cf('0x11'));var Redis=require(_0xd4cf('0x12'));var authService=require(_0xd4cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cf('0x14'));var hardwareService=require(_0xd4cf('0x15'));var logger=require(_0xd4cf('0x16'))(_0xd4cf('0x17'));var utils=require(_0xd4cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4cf('0x19'))['db'];config[_0xd4cf('0x1a')]=_['defaults'](config[_0xd4cf('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4cf('0x1b'))(new Redis(config['redis']));require(_0xd4cf('0x1c'))[_0xd4cf('0x1d')](socket);function respondWithStatusCode(_0x51c61e,_0x3248dd){_0x3248dd=_0x3248dd||0xcc;return function(_0x12314e){if(_0x12314e){return _0x51c61e[_0xd4cf('0x1e')](_0x3248dd);}return _0x51c61e[_0xd4cf('0x1f')](_0x3248dd)[_0xd4cf('0x20')]();};}function respondWithResult(_0x2ff69e,_0x560723){_0x560723=_0x560723||0xc8;return function(_0x3aa40d){if(_0x3aa40d){return _0x2ff69e[_0xd4cf('0x1f')](_0x560723)[_0xd4cf('0x21')](_0x3aa40d);}};}function respondWithFilteredResult(_0x11b06a,_0x8c327a){return function(_0x3e749d){if(_0x3e749d){var _0x183f6c=typeof _0x8c327a[_0xd4cf('0x22')]===_0xd4cf('0x23')&&typeof _0x8c327a[_0xd4cf('0x24')]===_0xd4cf('0x23');var _0x540e2b=_0x3e749d[_0xd4cf('0x25')];var _0x412e19=_0x183f6c?0x0:_0x8c327a[_0xd4cf('0x22')];var _0xe8908=_0x183f6c?_0x3e749d[_0xd4cf('0x25')]:_0x8c327a[_0xd4cf('0x22')]+_0x8c327a[_0xd4cf('0x24')];var _0x5338dc;if(_0xe8908>=_0x540e2b){_0xe8908=_0x540e2b;_0x5338dc=0xc8;}else{_0x5338dc=0xce;}_0x11b06a[_0xd4cf('0x1f')](_0x5338dc);return _0x11b06a['set']('Content-Range',_0x412e19+'-'+_0xe8908+'/'+_0x540e2b)[_0xd4cf('0x21')](_0x3e749d);}return null;};}function patchUpdates(_0x3dbe6d){return function(_0x336b9a){try{jsonpatch[_0xd4cf('0x26')](_0x336b9a,_0x3dbe6d,!![]);}catch(_0x2fe806){return BPromise[_0xd4cf('0x27')](_0x2fe806);}return _0x336b9a['save']();};}function saveUpdates(_0x14c159,_0x4f9a7c){return function(_0xd3f670){if(_0xd3f670){return _0xd3f670[_0xd4cf('0x28')](_0x14c159)[_0xd4cf('0x29')](function(_0x4c1896){return _0x4c1896;});}return null;};}function removeEntity(_0x5266aa,_0x52c21b){return function(_0x1cc9f7){if(_0x1cc9f7){return _0x1cc9f7[_0xd4cf('0x2a')]()['then'](function(){_0x5266aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23658f,_0x5a3962){return function(_0x53ac7e){if(!_0x53ac7e){_0x23658f['sendStatus'](0x194);}return _0x53ac7e;};}function handleError(_0xd28042,_0x4bb272){_0x4bb272=_0x4bb272||0x1f4;return function(_0xd08f38){logger[_0xd4cf('0x2b')](_0xd08f38[_0xd4cf('0x2c')]);if(_0xd08f38[_0xd4cf('0x2d')]){delete _0xd08f38[_0xd4cf('0x2d')];}_0xd28042[_0xd4cf('0x1f')](_0x4bb272)[_0xd4cf('0x2e')](_0xd08f38);};}exports[_0xd4cf('0x2f')]=function(_0x51b80f,_0x1c6ae5){var _0xad7ac9={'raw':![],'where':{'id':_0x51b80f['params']['id']}},_0x155f50={};_0x155f50['model']=_[_0xd4cf('0x30')](db[_0xd4cf('0x31')][_0xd4cf('0x32')]);_0x155f50[_0xd4cf('0x33')]=_[_0xd4cf('0x30')](_0x51b80f[_0xd4cf('0x33')]);_0x155f50[_0xd4cf('0x34')]=_[_0xd4cf('0x35')](_0x155f50['model'],_0x155f50[_0xd4cf('0x33')]);_0xad7ac9[_0xd4cf('0x36')]=_[_0xd4cf('0x35')](_0x155f50[_0xd4cf('0x37')],qs[_0xd4cf('0x38')](_0x51b80f[_0xd4cf('0x33')][_0xd4cf('0x38')]));_0xad7ac9[_0xd4cf('0x36')]=_0xad7ac9[_0xd4cf('0x36')][_0xd4cf('0x39')]?_0xad7ac9[_0xd4cf('0x36')]:_0x155f50[_0xd4cf('0x37')];if(_0x51b80f[_0xd4cf('0x33')]['includeAll']){_0xad7ac9['include']=[{'all':!![]}];}_0xad7ac9=_[_0xd4cf('0x3a')]({},_0xad7ac9,_0x51b80f[_0xd4cf('0x3b')]);return db[_0xd4cf('0x31')][_0xd4cf('0x3c')](_0xad7ac9)[_0xd4cf('0x29')](handleEntityNotFound(_0x1c6ae5,null))[_0xd4cf('0x29')](respondWithResult(_0x1c6ae5,null))[_0xd4cf('0x3d')](handleError(_0x1c6ae5,null));};exports[_0xd4cf('0x2a')]=function(_0x576141,_0x30dcfc){return db[_0xd4cf('0x31')][_0xd4cf('0x3c')]({'where':{'id':_0x576141['params']['id']}})['then'](handleEntityNotFound(_0x30dcfc,null))[_0xd4cf('0x29')](removeEntity(_0x30dcfc,null))[_0xd4cf('0x3d')](handleError(_0x30dcfc,null));};function widgetAttributes(_0xda1964){try{switch(_0xda1964[_0xd4cf('0x3e')]){case'iframe':return[{'name':_0xd4cf('0x3f'),'value':_0xda1964[_0xd4cf('0x3f')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964['attrs'][0x0]['value']:undefined)||'https://'}];case _0xd4cf('0x41'):return[{'name':_0xd4cf('0x42'),'value':_0xda1964[_0xd4cf('0x42')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964[_0xd4cf('0x40')][0x0][_0xd4cf('0x43')]:undefined)||''}];case _0xd4cf('0x44'):return[{'name':'attrHourFormat','value':_0xda1964['attrHourFormat']||(_0xda1964['attrs']&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964['attrs'][0x0][_0xd4cf('0x43')]:undefined)||_0xd4cf('0x45')},{'name':_0xd4cf('0x46'),'value':_0xda1964['attrTimezone']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x1]?_0xda1964['attrs'][0x1][_0xd4cf('0x43')]:undefined)||'0.00'},{'name':_0xd4cf('0x47'),'value':_0xda1964['attrFontSize']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x2]?_0xda1964['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xd4cf('0x48'),'value':_0xda1964[_0xd4cf('0x48')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964[_0xd4cf('0x40')][0x0][_0xd4cf('0x43')]:undefined)||'total'},{'name':_0xd4cf('0x49'),'value':_0xda1964[_0xd4cf('0x49')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x1]?_0xda1964['attrs'][0x1][_0xd4cf('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0xda1964[_0xd4cf('0x47')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964['attrs'][0x2]?_0xda1964['attrs'][0x2][_0xd4cf('0x43')]:undefined)||0x14},{'name':_0xd4cf('0x4a'),'value':_0xda1964['attrChannel']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x3]?_0xda1964[_0xd4cf('0x40')][0x3][_0xd4cf('0x43')]:undefined)||_0xd4cf('0x4b')},{'name':'attrEmailAccounts','value':_0xda1964[_0xd4cf('0x4c')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x4]?_0xda1964[_0xd4cf('0x40')][0x4][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x4d'),'value':_0xda1964['attrFaxAccounts']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x5]?_0xda1964[_0xd4cf('0x40')][0x5][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x4e'),'value':_0xda1964[_0xd4cf('0x4e')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964['attrs'][0x6]?_0xda1964[_0xd4cf('0x40')][0x6][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x4f'),'value':_0xda1964[_0xd4cf('0x4f')]||(_0xda1964['attrs']&&_0xda1964[_0xd4cf('0x40')][0x7]?_0xda1964[_0xd4cf('0x40')][0x7][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x50'),'value':_0xda1964[_0xd4cf('0x50')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x8]?_0xda1964['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xda1964[_0xd4cf('0x51')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x9]?_0xda1964[_0xd4cf('0x40')][0x9][_0xd4cf('0x43')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xd4cf('0x52'),'value':_0xda1964['attrSerie1']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964['attrs'][0x0][_0xd4cf('0x43')]:undefined)||_0xd4cf('0x53')},{'name':'attrSerie2','value':_0xda1964['attrSerie2']||(_0xda1964['attrs']&&_0xda1964['attrs'][0x1]?_0xda1964[_0xd4cf('0x40')][0x1][_0xd4cf('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0xda1964[_0xd4cf('0x54')]||(_0xda1964['attrs']&&_0xda1964['attrs'][0x2]?_0xda1964[_0xd4cf('0x40')][0x2][_0xd4cf('0x43')]:undefined)||null},{'name':_0xd4cf('0x49'),'value':_0xda1964[_0xd4cf('0x49')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x3]?_0xda1964[_0xd4cf('0x40')][0x3][_0xd4cf('0x43')]:undefined)||[]},{'name':_0xd4cf('0x4a'),'value':_0xda1964[_0xd4cf('0x4a')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x4]?_0xda1964[_0xd4cf('0x40')][0x4]['value']:undefined)||_0xd4cf('0x4b')},{'name':_0xd4cf('0x4c'),'value':_0xda1964[_0xd4cf('0x4c')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x5]?_0xda1964[_0xd4cf('0x40')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0xda1964[_0xd4cf('0x4d')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x6]?_0xda1964[_0xd4cf('0x40')][0x6][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x4e'),'value':_0xda1964[_0xd4cf('0x4e')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x7]?_0xda1964[_0xd4cf('0x40')][0x7][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x4f'),'value':_0xda1964[_0xd4cf('0x4f')]||(_0xda1964['attrs']&&_0xda1964[_0xd4cf('0x40')][0x8]?_0xda1964[_0xd4cf('0x40')][0x8][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x50'),'value':_0xda1964[_0xd4cf('0x50')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x9]?_0xda1964[_0xd4cf('0x40')][0x9][_0xd4cf('0x43')]:undefined)||''},{'name':_0xd4cf('0x51'),'value':_0xda1964[_0xd4cf('0x51')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0xa]?_0xda1964['attrs'][0xa][_0xd4cf('0x43')]:undefined)||''}];case _0xd4cf('0x55'):return[{'name':_0xd4cf('0x56'),'type':_0xda1964[_0xd4cf('0x57')]||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964[_0xd4cf('0x40')][0x0]?_0xda1964[_0xd4cf('0x40')][0x0][_0xd4cf('0x3e')]:undefined)||null,'value':_0xda1964['attrReport']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964['attrs'][0x0]?_0xda1964[_0xd4cf('0x40')][0x0][_0xd4cf('0x43')]:undefined)||null},{'name':_0xd4cf('0x58'),'value':_0xda1964['attrRefresh']||(_0xda1964[_0xd4cf('0x40')]&&_0xda1964['attrs'][0x1]?_0xda1964[_0xd4cf('0x40')][0x1][_0xd4cf('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x5353e2){logger[_0xd4cf('0x2b')](_0xd4cf('0x59'),JSON[_0xd4cf('0x5a')](_0x5353e2));return[];}}exports[_0xd4cf('0x5b')]=function(_0x293cca,_0x3f5abe){if(_0x293cca[_0xd4cf('0x5c')]){_0x293cca[_0xd4cf('0x5c')]['attrs']=widgetAttributes(_0x293cca[_0xd4cf('0x5c')]);}return db[_0xd4cf('0x31')]['create'](_0x293cca[_0xd4cf('0x5c')],{})['then'](respondWithResult(_0x3f5abe,0xc9))[_0xd4cf('0x3d')](handleError(_0x3f5abe,null));};exports[_0xd4cf('0x28')]=function(_0x4de72d,_0xf31716){if(_0x4de72d[_0xd4cf('0x5c')]['id']){delete _0x4de72d[_0xd4cf('0x5c')]['id'];}_0x4de72d[_0xd4cf('0x5c')][_0xd4cf('0x40')]=widgetAttributes(_0x4de72d[_0xd4cf('0x5c')]);return db['DashboardItem']['find']({'where':{'id':_0x4de72d[_0xd4cf('0x5d')]['id']}})['then'](handleEntityNotFound(_0xf31716,null))[_0xd4cf('0x29')](saveUpdates(_0x4de72d[_0xd4cf('0x5c')],null))[_0xd4cf('0x29')](respondWithResult(_0xf31716,null))[_0xd4cf('0x3d')](handleError(_0xf31716,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6450bda..12038ff 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 _0x3971=['hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x5d9c96,_0x19d308){var _0x5ac635=function(_0x160a34){while(--_0x160a34){_0x5d9c96['push'](_0x5d9c96['shift']());}};_0x5ac635(++_0x19d308);}(_0x3971,0x7a));var _0x1397=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x3971[_0x2f3ecd];return _0xffdc44;};'use strict';var EventEmitter=require(_0x1397('0x0'));var DashboardItem=require(_0x1397('0x1'))['db'][_0x1397('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1397('0x3')](0x0);var events={'afterCreate':_0x1397('0x4'),'afterUpdate':_0x1397('0x5'),'afterDestroy':_0x1397('0x6')};function emitEvent(_0x3c2fce){return function(_0x383ba0,_0x3dcfb9,_0x462a41){DashboardItemEvents[_0x1397('0x7')](_0x3c2fce+':'+_0x383ba0['id'],_0x383ba0);DashboardItemEvents[_0x1397('0x7')](_0x3c2fce,_0x383ba0);_0x462a41(null);};}for(var e in events){if(events[_0x1397('0x8')](e)){var event=events[e];DashboardItem[_0x1397('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x6be9=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x6be9,0xec));var _0x96be=function(_0x1e548d,_0x56c6ac){_0x1e548d=_0x1e548d-0x0;var _0x4d2a76=_0x6be9[_0x1e548d];return _0x4d2a76;};'use strict';var EventEmitter=require(_0x96be('0x0'));var DashboardItem=require(_0x96be('0x1'))['db'][_0x96be('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x96be('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96be('0x4'),'afterDestroy':_0x96be('0x5')};function emitEvent(_0x3e6a7a){return function(_0x162adc,_0x301fc6,_0x239e19){DashboardItemEvents[_0x96be('0x6')](_0x3e6a7a+':'+_0x162adc['id'],_0x162adc);DashboardItemEvents[_0x96be('0x6')](_0x3e6a7a,_0x162adc);_0x239e19(null);};}for(var e in events){if(events[_0x96be('0x7')](e)){var event=events[e];DashboardItem[_0x96be('0x8')](e,emitEvent(event));}}module[_0x96be('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6b079f9..cb43c4a 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 _0xa39b=['moment','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x200aa2,_0xa55c56){var _0x39d214=function(_0x3c4857){while(--_0x3c4857){_0x200aa2['push'](_0x200aa2['shift']());}};_0x39d214(++_0xa55c56);}(_0xa39b,0xee));var _0xba39=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa39b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xba39('0x0'));var util=require(_0xba39('0x1'));var logger=require(_0xba39('0x2'))(_0xba39('0x3'));var moment=require(_0xba39('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba39('0x5'));var rimraf=require(_0xba39('0x6'));var config=require(_0xba39('0x7'));var attributes=require(_0xba39('0x8'));module['exports']=function(_0xf4f1d1,_0x3e1395){return _0xf4f1d1[_0xba39('0x9')](_0xba39('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d44=['../../config/environment','./dashboardItem.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5e08f4,_0x46d3d4){var _0x367762=function(_0x123929){while(--_0x123929){_0x5e08f4['push'](_0x5e08f4['shift']());}};_0x367762(++_0x46d3d4);}(_0x6d44,0x70));var _0x46d4=function(_0x35d1f9,_0xee484c){_0x35d1f9=_0x35d1f9-0x0;var _0x2d7877=_0x6d44[_0x35d1f9];return _0x2d7877;};'use strict';var _=require(_0x46d4('0x0'));var util=require(_0x46d4('0x1'));var logger=require(_0x46d4('0x2'))(_0x46d4('0x3'));var moment=require(_0x46d4('0x4'));var BPromise=require(_0x46d4('0x5'));var rp=require(_0x46d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46d4('0x7'));var config=require(_0x46d4('0x8'));var attributes=require(_0x46d4('0x9'));module[_0x46d4('0xa')]=function(_0x46037e,_0x558c55){return _0x46037e[_0x46d4('0xb')]('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 d2b9511..f90c155 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 _0xb5bf=['DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0xb5bf,0x96));var _0xfb5b=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xb5bf[_0x26f702];return _0x11417d;};'use strict';var _=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb5b('0x2'));var fs=require('fs');var Redis=require(_0xfb5b('0x3'));var db=require(_0xfb5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb5b('0x5'))(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb5b('0x8')][_0xfb5b('0x9')]({'port':0x232a});config[_0xfb5b('0xa')]=_[_0xfb5b('0xb')](config[_0xfb5b('0xa')],{'host':_0xfb5b('0xc'),'port':0x18eb});var socket=require(_0xfb5b('0xd'))(new Redis(config[_0xfb5b('0xa')]));require(_0xfb5b('0xe'))[_0xfb5b('0xf')](socket);function respondWithRpcPromise(_0x2e26f1,_0x37ee5c,_0x40614a){return new BPromise(function(_0x38630d,_0x27a605){return client[_0xfb5b('0x10')](_0x2e26f1,_0x40614a)[_0xfb5b('0x11')](function(_0x47d08a){logger['info'](_0xfb5b('0x12'),_0x37ee5c,'request\x20sent');logger[_0xfb5b('0x13')](_0xfb5b('0x14'),_0x37ee5c,_0xfb5b('0x15'),JSON['stringify'](_0x47d08a));if(_0x47d08a['error']){if(_0x47d08a[_0xfb5b('0x16')][_0xfb5b('0x17')]===0x1f4){logger[_0xfb5b('0x16')](_0xfb5b('0x12'),_0x37ee5c,_0x47d08a[_0xfb5b('0x16')][_0xfb5b('0x18')]);return _0x27a605(_0x47d08a[_0xfb5b('0x16')][_0xfb5b('0x18')]);}logger['error'](_0xfb5b('0x12'),_0x37ee5c,_0x47d08a[_0xfb5b('0x16')]['message']);return _0x38630d(_0x47d08a[_0xfb5b('0x16')][_0xfb5b('0x18')]);}else{logger[_0xfb5b('0x19')](_0xfb5b('0x12'),_0x37ee5c,'request\x20sent');_0x38630d(_0x47d08a[_0xfb5b('0x1a')][_0xfb5b('0x18')]);}})[_0xfb5b('0x1b')](function(_0x2441cb){logger[_0xfb5b('0x16')](_0xfb5b('0x12'),_0x37ee5c,_0x2441cb);_0x27a605(_0x2441cb);});});} \ No newline at end of file +var _0xd645=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3f3f1f,_0x28b7ea){var _0x16872b=function(_0xb81b23){while(--_0xb81b23){_0x3f3f1f['push'](_0x3f3f1f['shift']());}};_0x16872b(++_0x28b7ea);}(_0xd645,0x15e));var _0x5d64=function(_0x1e12f8,_0x283759){_0x1e12f8=_0x1e12f8-0x0;var _0x57d5d9=_0xd645[_0x1e12f8];return _0x57d5d9;};'use strict';var _=require('lodash');var util=require(_0x5d64('0x0'));var moment=require(_0x5d64('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d64('0x2'));var fs=require('fs');var Redis=require(_0x5d64('0x3'));var db=require(_0x5d64('0x4'))['db'];var utils=require(_0x5d64('0x5'));var logger=require(_0x5d64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5d64('0x7'));var client=jayson[_0x5d64('0x8')][_0x5d64('0x9')]({'port':0x232a});config[_0x5d64('0xa')]=_['defaults'](config[_0x5d64('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d64('0xa')]));require(_0x5d64('0xb'))[_0x5d64('0xc')](socket);function respondWithRpcPromise(_0x2db61c,_0x49e951,_0x3865ce){return new BPromise(function(_0x40a528,_0x3c8ed3){return client[_0x5d64('0xd')](_0x2db61c,_0x3865ce)['then'](function(_0x240606){logger[_0x5d64('0xe')](_0x5d64('0xf'),_0x49e951,_0x5d64('0x10'));logger[_0x5d64('0x11')](_0x5d64('0x12'),_0x49e951,_0x5d64('0x10'),JSON[_0x5d64('0x13')](_0x240606));if(_0x240606[_0x5d64('0x14')]){if(_0x240606[_0x5d64('0x14')][_0x5d64('0x15')]===0x1f4){logger[_0x5d64('0x14')](_0x5d64('0xf'),_0x49e951,_0x240606['error'][_0x5d64('0x16')]);return _0x3c8ed3(_0x240606[_0x5d64('0x14')][_0x5d64('0x16')]);}logger[_0x5d64('0x14')](_0x5d64('0xf'),_0x49e951,_0x240606[_0x5d64('0x14')][_0x5d64('0x16')]);return _0x40a528(_0x240606[_0x5d64('0x14')][_0x5d64('0x16')]);}else{logger[_0x5d64('0xe')](_0x5d64('0xf'),_0x49e951,_0x5d64('0x10'));_0x40a528(_0x240606[_0x5d64('0x17')][_0x5d64('0x16')]);}})[_0x5d64('0x18')](function(_0x27343d){logger[_0x5d64('0x14')](_0x5d64('0xf'),_0x49e951,_0x27343d);_0x3c8ed3(_0x27343d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 11e63c7..470bc50 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 _0x9ce3=['length','dashboardItem:','save','remove','update','emit','removeListener'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0x9ce3,0xc6));var _0x39ce=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x9ce3[_0x54defc];return _0x1955d3;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x39ce('0x0'),_0x39ce('0x1'),_0x39ce('0x2')];function createListener(_0x224ec1,_0x165dfd){return function(_0x362988){_0x165dfd[_0x39ce('0x3')](_0x224ec1,_0x362988);};}function removeListener(_0x569889,_0x14abc1){return function(){DashboardItemEvents[_0x39ce('0x4')](_0x569889,_0x14abc1);};}exports['register']=function(_0x5d94a3){for(var _0x34fdaf=0x0,_0x4a3211=events[_0x39ce('0x5')];_0x34fdaf<_0x4a3211;_0x34fdaf++){var _0x4bd88c=events[_0x34fdaf];var _0x8ad94=createListener(_0x39ce('0x6')+_0x4bd88c,_0x5d94a3);DashboardItemEvents['on'](_0x4bd88c,_0x8ad94);}}; \ No newline at end of file +var _0xe688=['save','emit','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xe688,0x9b));var _0x8e68=function(_0x1fd4cc,_0xd97342){_0x1fd4cc=_0x1fd4cc-0x0;var _0x7facfc=_0xe688[_0x1fd4cc];return _0x7facfc;};'use strict';var DashboardItemEvents=require(_0x8e68('0x0'));var events=[_0x8e68('0x1'),'remove','update'];function createListener(_0x456814,_0x197e17){return function(_0x2450dd){_0x197e17[_0x8e68('0x2')](_0x456814,_0x2450dd);};}function removeListener(_0x5d583d,_0x34c72e){return function(){DashboardItemEvents[_0x8e68('0x3')](_0x5d583d,_0x34c72e);};}exports['register']=function(_0x402a31){for(var _0x1eb0a6=0x0,_0x1f016a=events[_0x8e68('0x4')];_0x1eb0a6<_0x1f016a;_0x1eb0a6++){var _0x72d3b8=events[_0x1eb0a6];var _0x5d01f2=createListener(_0x8e68('0x5')+_0x72d3b8,_0x402a31);DashboardItemEvents['on'](_0x72d3b8,_0x5d01f2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index de73824..fe11dbb 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 _0xf436=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post','create','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf436,0x11f));var _0x6f43=function(_0x4d800c,_0x16c21e){_0x4d800c=_0x4d800c-0x0;var _0x4f9788=_0xf436[_0x4d800c];return _0x4f9788;};'use strict';var multer=require(_0x6f43('0x0'));var util=require(_0x6f43('0x1'));var path=require(_0x6f43('0x2'));var timeout=require(_0x6f43('0x3'));var express=require(_0x6f43('0x4'));var router=express[_0x6f43('0x5')]();var fs_extra=require(_0x6f43('0x6'));var auth=require(_0x6f43('0x7'));var interaction=require(_0x6f43('0x8'));var config=require('../../config/environment');var controller=require(_0x6f43('0x9'));router[_0x6f43('0xa')]('/:id',auth[_0x6f43('0xb')](),controller[_0x6f43('0xc')]);router[_0x6f43('0xd')]('/',auth[_0x6f43('0xb')](),controller[_0x6f43('0xe')]);router['put']('/:id',auth[_0x6f43('0xb')](),controller[_0x6f43('0xf')]);router[_0x6f43('0x10')]('/:id',auth[_0x6f43('0xb')](),controller[_0x6f43('0x11')]);module[_0x6f43('0x12')]=router; \ No newline at end of file +var _0x8461=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f10be,_0x3d4704){var _0x3344fe=function(_0xcd14ff){while(--_0xcd14ff){_0x5f10be['push'](_0x5f10be['shift']());}};_0x3344fe(++_0x3d4704);}(_0x8461,0xf9));var _0x1846=function(_0x2e992b,_0xb335f7){_0x2e992b=_0x2e992b-0x0;var _0x29ec07=_0x8461[_0x2e992b];return _0x29ec07;};'use strict';var multer=require(_0x1846('0x0'));var util=require('util');var path=require(_0x1846('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1846('0x2')]();var fs_extra=require(_0x1846('0x3'));var auth=require(_0x1846('0x4'));var interaction=require(_0x1846('0x5'));var config=require(_0x1846('0x6'));var controller=require(_0x1846('0x7'));router[_0x1846('0x8')](_0x1846('0x9'),auth[_0x1846('0xa')](),controller['show']);router[_0x1846('0xb')]('/',auth[_0x1846('0xa')](),controller[_0x1846('0xc')]);router[_0x1846('0xd')](_0x1846('0x9'),auth[_0x1846('0xa')](),controller[_0x1846('0xe')]);router['delete'](_0x1846('0x9'),auth[_0x1846('0xa')](),controller[_0x1846('0xf')]);module[_0x1846('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4dd07b0..3091c9e 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 _0x7d58=['STRING','first','third','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d58,0x67));var _0x87d5=function(_0x461a30,_0x4366bc){_0x461a30=_0x461a30-0x0;var _0x2e4a01=_0x7d58[_0x461a30];return _0x2e4a01;};'use strict';var Sequelize=require(_0x87d5('0x0'));module[_0x87d5('0x1')]={'name':{'type':Sequelize[_0x87d5('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x87d5('0x3'),'second',_0x87d5('0x4')),'allowNull':![],'defaultValue':_0x87d5('0x3')},'description':{'type':Sequelize[_0x87d5('0x2')]}}; \ No newline at end of file +var _0x3673=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x503f9f,_0x2a3c77){var _0x4272fe=function(_0x224010){while(--_0x224010){_0x503f9f['push'](_0x503f9f['shift']());}};_0x4272fe(++_0x2a3c77);}(_0x3673,0x145));var _0x3367=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x3673[_0x487ab4];return _0x3bef77;};'use strict';var Sequelize=require(_0x3367('0x0'));module[_0x3367('0x1')]={'name':{'type':Sequelize[_0x3367('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3367('0x3')](_0x3367('0x4'),_0x3367('0x5'),'third'),'allowNull':![],'defaultValue':_0x3367('0x4')},'description':{'type':Sequelize[_0x3367('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 27b6430..8465119 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 _0x6b71=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util'];(function(_0x59434e,_0x546553){var _0x21f12d=function(_0x213a7a){while(--_0x213a7a){_0x59434e['push'](_0x59434e['shift']());}};_0x21f12d(++_0x546553);}(_0x6b71,0x12c));var _0x16b7=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x6b71[_0x209ec9];return _0x129b1b;};'use strict';var emlformat=require(_0x16b7('0x0'));var rimraf=require(_0x16b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16b7('0x2'));var rp=require(_0x16b7('0x3'));var moment=require('moment');var BPromise=require(_0x16b7('0x4'));var Mustache=require(_0x16b7('0x5'));var util=require(_0x16b7('0x6'));var path=require(_0x16b7('0x7'));var sox=require(_0x16b7('0x8'));var csv=require(_0x16b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16b7('0xa'));var squel=require('squel');var crypto=require(_0x16b7('0xb'));var jsforce=require(_0x16b7('0xc'));var deskjs=require(_0x16b7('0xd'));var toCsv=require(_0x16b7('0x9'));var querystring=require('querystring');var Papa=require(_0x16b7('0xe'));var Redis=require('ioredis');var authService=require(_0x16b7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16b7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16b7('0x11'));var utils=require(_0x16b7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x16b7('0x13'));var db=require(_0x16b7('0x14'))['db'];function respondWithStatusCode(_0x2e310e,_0x4d136a){_0x4d136a=_0x4d136a||0xcc;return function(_0x42c90f){if(_0x42c90f){return _0x2e310e[_0x16b7('0x15')](_0x4d136a);}return _0x2e310e[_0x16b7('0x16')](_0x4d136a)[_0x16b7('0x17')]();};}function respondWithResult(_0x2ade91,_0x258cfc){_0x258cfc=_0x258cfc||0xc8;return function(_0x28c58a){if(_0x28c58a){return _0x2ade91[_0x16b7('0x16')](_0x258cfc)[_0x16b7('0x18')](_0x28c58a);}};}function respondWithFilteredResult(_0x5e5035,_0x5a9dc1){return function(_0x42c83a){if(_0x42c83a){var _0x9038e0=typeof _0x5a9dc1[_0x16b7('0x19')]==='undefined'&&typeof _0x5a9dc1[_0x16b7('0x1a')]===_0x16b7('0x1b');var _0x27afcf=_0x42c83a[_0x16b7('0x1c')];var _0x3582c3=_0x9038e0?0x0:_0x5a9dc1[_0x16b7('0x19')];var _0x55854a=_0x9038e0?_0x42c83a[_0x16b7('0x1c')]:_0x5a9dc1[_0x16b7('0x19')]+_0x5a9dc1[_0x16b7('0x1a')];var _0x277890;if(_0x55854a>=_0x27afcf){_0x55854a=_0x27afcf;_0x277890=0xc8;}else{_0x277890=0xce;}_0x5e5035['status'](_0x277890);return _0x5e5035['set'](_0x16b7('0x1d'),_0x3582c3+'-'+_0x55854a+'/'+_0x27afcf)[_0x16b7('0x18')](_0x42c83a);}return null;};}function patchUpdates(_0x197f08){return function(_0x268d2d){try{jsonpatch[_0x16b7('0x1e')](_0x268d2d,_0x197f08,!![]);}catch(_0x394500){return BPromise['reject'](_0x394500);}return _0x268d2d[_0x16b7('0x1f')]();};}function saveUpdates(_0x494883,_0x4fd59c){return function(_0x1bd04e){if(_0x1bd04e){return _0x1bd04e[_0x16b7('0x20')](_0x494883)[_0x16b7('0x21')](function(_0x4316b0){return _0x4316b0;});}return null;};}function removeEntity(_0x1f5405,_0x5df3a3){return function(_0x55a367){if(_0x55a367){return _0x55a367[_0x16b7('0x22')]()[_0x16b7('0x21')](function(){var _0x12d054=_0x55a367['get']({'plain':!![]});var _0x7870e0='Dispositions';return db[_0x16b7('0x23')][_0x16b7('0x22')]({'where':{'type':_0x7870e0,'resourceId':_0x12d054['id']}})[_0x16b7('0x21')](function(){return _0x55a367;});})['then'](function(){_0x1f5405[_0x16b7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3c9cf,_0x4e5e04){return function(_0xf4a534){if(!_0xf4a534){_0xd3c9cf[_0x16b7('0x15')](0x194);}return _0xf4a534;};}function handleError(_0xa45b3c,_0x45686a){_0x45686a=_0x45686a||0x1f4;return function(_0x110add){logger['error'](_0x110add[_0x16b7('0x24')]);if(_0x110add[_0x16b7('0x25')]){delete _0x110add[_0x16b7('0x25')];}_0xa45b3c[_0x16b7('0x16')](_0x45686a)[_0x16b7('0x26')](_0x110add);};}exports[_0x16b7('0x27')]=function(_0x2b2304,_0x100ed0){var _0x102656={},_0x2d6bf1={},_0x9e43b={'count':0x0,'rows':[]};var _0x1f76e8=_[_0x16b7('0x28')](db[_0x16b7('0x29')][_0x16b7('0x2a')],function(_0x30278e){return{'name':_0x30278e[_0x16b7('0x2b')],'type':_0x30278e[_0x16b7('0x2c')][_0x16b7('0x2d')]};});_0x2d6bf1[_0x16b7('0x2e')]=_['map'](_0x1f76e8,_0x16b7('0x25'));_0x2d6bf1['query']=_[_0x16b7('0x2f')](_0x2b2304['query']);_0x2d6bf1[_0x16b7('0x30')]=_['intersection'](_0x2d6bf1[_0x16b7('0x2e')],_0x2d6bf1[_0x16b7('0x31')]);_0x102656[_0x16b7('0x32')]=_[_0x16b7('0x33')](_0x2d6bf1['model'],qs[_0x16b7('0x34')](_0x2b2304[_0x16b7('0x31')]['fields']));_0x102656[_0x16b7('0x32')]=_0x102656[_0x16b7('0x32')][_0x16b7('0x35')]?_0x102656['attributes']:_0x2d6bf1[_0x16b7('0x2e')];if(!_0x2b2304['query'][_0x16b7('0x36')](_0x16b7('0x37'))){_0x102656[_0x16b7('0x1a')]=qs['limit'](_0x2b2304[_0x16b7('0x31')][_0x16b7('0x1a')]);_0x102656[_0x16b7('0x19')]=qs[_0x16b7('0x19')](_0x2b2304[_0x16b7('0x31')]['offset']);}_0x102656[_0x16b7('0x38')]=qs[_0x16b7('0x39')](_0x2b2304[_0x16b7('0x31')]['sort']);_0x102656[_0x16b7('0x3a')]=qs[_0x16b7('0x30')](_[_0x16b7('0x3b')](_0x2b2304[_0x16b7('0x31')],_0x2d6bf1['filters']),_0x1f76e8);if(_0x2b2304['query'][_0x16b7('0x3c')]){_0x102656[_0x16b7('0x3a')]=_['merge'](_0x102656[_0x16b7('0x3a')],{'$or':_[_0x16b7('0x28')](_0x1f76e8,function(_0x23c98f){if(_0x23c98f[_0x16b7('0x2c')]!=='VIRTUAL'){var _0x41cf22={};_0x41cf22[_0x23c98f[_0x16b7('0x25')]]={'$like':'%'+_0x2b2304['query'][_0x16b7('0x3c')]+'%'};return _0x41cf22;}})});}_0x102656=_[_0x16b7('0x3d')]({},_0x102656,_0x2b2304[_0x16b7('0x3e')]);var _0x4d97e7={'where':_0x102656[_0x16b7('0x3a')]};return db[_0x16b7('0x29')][_0x16b7('0x1c')](_0x4d97e7)['then'](function(_0x511bbc){_0x9e43b[_0x16b7('0x1c')]=_0x511bbc;if(_0x2b2304[_0x16b7('0x31')][_0x16b7('0x3f')]){_0x102656[_0x16b7('0x40')]=[{'all':!![]}];}return db[_0x16b7('0x29')]['findAll'](_0x102656);})[_0x16b7('0x21')](function(_0x38cffd){_0x9e43b[_0x16b7('0x41')]=_0x38cffd;return _0x9e43b;})[_0x16b7('0x21')](respondWithFilteredResult(_0x100ed0,_0x102656))[_0x16b7('0x42')](handleError(_0x100ed0,null));};exports[_0x16b7('0x43')]=function(_0x2d7d2d,_0x1341c1){var _0x394903={'raw':!![],'where':{'id':_0x2d7d2d[_0x16b7('0x44')]['id']}},_0x1817fd={};_0x1817fd[_0x16b7('0x2e')]=_[_0x16b7('0x2f')](db[_0x16b7('0x29')][_0x16b7('0x2a')]);_0x1817fd[_0x16b7('0x31')]=_[_0x16b7('0x2f')](_0x2d7d2d['query']);_0x1817fd[_0x16b7('0x30')]=_[_0x16b7('0x33')](_0x1817fd[_0x16b7('0x2e')],_0x1817fd['query']);_0x394903[_0x16b7('0x32')]=_[_0x16b7('0x33')](_0x1817fd['model'],qs[_0x16b7('0x34')](_0x2d7d2d[_0x16b7('0x31')][_0x16b7('0x34')]));_0x394903[_0x16b7('0x32')]=_0x394903['attributes'][_0x16b7('0x35')]?_0x394903[_0x16b7('0x32')]:_0x1817fd['model'];if(_0x2d7d2d[_0x16b7('0x31')][_0x16b7('0x3f')]){_0x394903[_0x16b7('0x40')]=[{'all':!![]}];}_0x394903=_[_0x16b7('0x3d')]({},_0x394903,_0x2d7d2d[_0x16b7('0x3e')]);return db[_0x16b7('0x29')][_0x16b7('0x45')](_0x394903)['then'](handleEntityNotFound(_0x1341c1,null))['then'](respondWithResult(_0x1341c1,null))[_0x16b7('0x42')](handleError(_0x1341c1,null));};exports[_0x16b7('0x46')]=function(_0x43b6bc,_0x5782fc){return db['Disposition'][_0x16b7('0x46')](_0x43b6bc[_0x16b7('0x47')],{})[_0x16b7('0x21')](function(_0xb586a6){var _0xa78c5b=_0x43b6bc[_0x16b7('0x48')]['get']({'plain':!![]});if(!_0xa78c5b)throw new Error(_0x16b7('0x49'));if(_0xa78c5b[_0x16b7('0x4a')]===_0x16b7('0x48')){var _0x25b77e=_0xb586a6[_0x16b7('0x4b')]({'plain':!![]});var _0x497762='Dispositions';return db[_0x16b7('0x4c')][_0x16b7('0x45')]({'where':{'name':_0x497762,'userProfileId':_0xa78c5b[_0x16b7('0x4d')]},'raw':!![]})[_0x16b7('0x21')](function(_0x274c02){if(_0x274c02&&_0x274c02['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x25b77e[_0x16b7('0x25')],'resourceId':_0x25b77e['id'],'type':_0x274c02['name'],'sectionId':_0x274c02['id']},{})[_0x16b7('0x21')](function(){return _0xb586a6;});}else{return _0xb586a6;}})['catch'](function(_0x1e09d9){logger[_0x16b7('0x4e')](_0x16b7('0x4f'),_0x1e09d9);throw _0x1e09d9;});}return _0xb586a6;})[_0x16b7('0x21')](respondWithResult(_0x5782fc,0xc9))[_0x16b7('0x42')](handleError(_0x5782fc,null));};exports[_0x16b7('0x20')]=function(_0x359df6,_0xb62731){if(_0x359df6['body']['id']){delete _0x359df6[_0x16b7('0x47')]['id'];}return db[_0x16b7('0x29')][_0x16b7('0x45')]({'where':{'id':_0x359df6['params']['id']}})[_0x16b7('0x21')](handleEntityNotFound(_0xb62731,null))[_0x16b7('0x21')](saveUpdates(_0x359df6[_0x16b7('0x47')],null))[_0x16b7('0x21')](respondWithResult(_0xb62731,null))[_0x16b7('0x42')](handleError(_0xb62731,null));};exports['destroy']=function(_0x24dd54,_0x49a899){return db[_0x16b7('0x29')][_0x16b7('0x45')]({'where':{'id':_0x24dd54[_0x16b7('0x44')]['id']}})[_0x16b7('0x21')](handleEntityNotFound(_0x49a899,null))[_0x16b7('0x21')](removeEntity(_0x49a899,null))['catch'](handleError(_0x49a899,null));}; \ No newline at end of file +var _0xb383=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','intersection','attributes','fields','order','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x4282aa,_0xe66504){var _0x5085f0=function(_0x73b59e){while(--_0x73b59e){_0x4282aa['push'](_0x4282aa['shift']());}};_0x5085f0(++_0xe66504);}(_0xb383,0x87));var _0x3b38=function(_0x514e0d,_0x45d174){_0x514e0d=_0x514e0d-0x0;var _0x5def2f=_0xb383[_0x514e0d];return _0x5def2f;};'use strict';var emlformat=require(_0x3b38('0x0'));var rimraf=require(_0x3b38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b38('0x2'));var rp=require('request-promise');var moment=require(_0x3b38('0x3'));var BPromise=require(_0x3b38('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b38('0x5'));var sox=require(_0x3b38('0x6'));var csv=require(_0x3b38('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b38('0x8'));var squel=require(_0x3b38('0x9'));var crypto=require('crypto');var jsforce=require(_0x3b38('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3b38('0x7'));var querystring=require(_0x3b38('0xb'));var Papa=require('papaparse');var Redis=require(_0x3b38('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3b38('0xd'));var as=require(_0x3b38('0xe'));var hardwareService=require(_0x3b38('0xf'));var logger=require(_0x3b38('0x10'))(_0x3b38('0x11'));var utils=require(_0x3b38('0x12'));var config=require(_0x3b38('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d715b,_0x15df9c){_0x15df9c=_0x15df9c||0xcc;return function(_0xa844ff){if(_0xa844ff){return _0x4d715b[_0x3b38('0x14')](_0x15df9c);}return _0x4d715b['status'](_0x15df9c)[_0x3b38('0x15')]();};}function respondWithResult(_0x1a97e9,_0x2de602){_0x2de602=_0x2de602||0xc8;return function(_0x2339b6){if(_0x2339b6){return _0x1a97e9[_0x3b38('0x16')](_0x2de602)[_0x3b38('0x17')](_0x2339b6);}};}function respondWithFilteredResult(_0x7efe5f,_0xad6c5e){return function(_0x550d56){if(_0x550d56){var _0x4bfc43=typeof _0xad6c5e[_0x3b38('0x18')]===_0x3b38('0x19')&&typeof _0xad6c5e[_0x3b38('0x1a')]===_0x3b38('0x19');var _0x4672e9=_0x550d56['count'];var _0x4beb84=_0x4bfc43?0x0:_0xad6c5e[_0x3b38('0x18')];var _0x5dda95=_0x4bfc43?_0x550d56[_0x3b38('0x1b')]:_0xad6c5e[_0x3b38('0x18')]+_0xad6c5e[_0x3b38('0x1a')];var _0x481b8c;if(_0x5dda95>=_0x4672e9){_0x5dda95=_0x4672e9;_0x481b8c=0xc8;}else{_0x481b8c=0xce;}_0x7efe5f[_0x3b38('0x16')](_0x481b8c);return _0x7efe5f[_0x3b38('0x1c')](_0x3b38('0x1d'),_0x4beb84+'-'+_0x5dda95+'/'+_0x4672e9)[_0x3b38('0x17')](_0x550d56);}return null;};}function patchUpdates(_0x13a1ac){return function(_0xad590){try{jsonpatch[_0x3b38('0x1e')](_0xad590,_0x13a1ac,!![]);}catch(_0x27f69c){return BPromise[_0x3b38('0x1f')](_0x27f69c);}return _0xad590[_0x3b38('0x20')]();};}function saveUpdates(_0x4ec5a4,_0x2009f8){return function(_0x3fd25d){if(_0x3fd25d){return _0x3fd25d[_0x3b38('0x21')](_0x4ec5a4)[_0x3b38('0x22')](function(_0x4a951b){return _0x4a951b;});}return null;};}function removeEntity(_0x469d0d,_0x17ebb3){return function(_0xc8a86a){if(_0xc8a86a){return _0xc8a86a['destroy']()['then'](function(){var _0x37f100=_0xc8a86a['get']({'plain':!![]});var _0x41d70b=_0x3b38('0x23');return db[_0x3b38('0x24')][_0x3b38('0x25')]({'where':{'type':_0x41d70b,'resourceId':_0x37f100['id']}})['then'](function(){return _0xc8a86a;});})[_0x3b38('0x22')](function(){_0x469d0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb85d3,_0x1cc625){return function(_0x5c2d5b){if(!_0x5c2d5b){_0xb85d3['sendStatus'](0x194);}return _0x5c2d5b;};}function handleError(_0x2d291f,_0x539221){_0x539221=_0x539221||0x1f4;return function(_0x546ae9){logger[_0x3b38('0x26')](_0x546ae9[_0x3b38('0x27')]);if(_0x546ae9[_0x3b38('0x28')]){delete _0x546ae9[_0x3b38('0x28')];}_0x2d291f[_0x3b38('0x16')](_0x539221)[_0x3b38('0x29')](_0x546ae9);};}exports[_0x3b38('0x2a')]=function(_0x37d37e,_0x3fa688){var _0xa04c48={},_0x6bd137={},_0x1b0de6={'count':0x0,'rows':[]};var _0x4c92a7=_[_0x3b38('0x2b')](db[_0x3b38('0x2c')][_0x3b38('0x2d')],function(_0xe2778a){return{'name':_0xe2778a['fieldName'],'type':_0xe2778a[_0x3b38('0x2e')][_0x3b38('0x2f')]};});_0x6bd137[_0x3b38('0x30')]=_[_0x3b38('0x2b')](_0x4c92a7,_0x3b38('0x28'));_0x6bd137[_0x3b38('0x31')]=_['keys'](_0x37d37e[_0x3b38('0x31')]);_0x6bd137['filters']=_[_0x3b38('0x32')](_0x6bd137[_0x3b38('0x30')],_0x6bd137[_0x3b38('0x31')]);_0xa04c48[_0x3b38('0x33')]=_['intersection'](_0x6bd137[_0x3b38('0x30')],qs[_0x3b38('0x34')](_0x37d37e[_0x3b38('0x31')][_0x3b38('0x34')]));_0xa04c48[_0x3b38('0x33')]=_0xa04c48[_0x3b38('0x33')]['length']?_0xa04c48['attributes']:_0x6bd137[_0x3b38('0x30')];if(!_0x37d37e[_0x3b38('0x31')]['hasOwnProperty']('nolimit')){_0xa04c48['limit']=qs[_0x3b38('0x1a')](_0x37d37e['query'][_0x3b38('0x1a')]);_0xa04c48['offset']=qs[_0x3b38('0x18')](_0x37d37e[_0x3b38('0x31')][_0x3b38('0x18')]);}_0xa04c48[_0x3b38('0x35')]=qs[_0x3b38('0x36')](_0x37d37e['query']['sort']);_0xa04c48['where']=qs[_0x3b38('0x37')](_[_0x3b38('0x38')](_0x37d37e[_0x3b38('0x31')],_0x6bd137['filters']),_0x4c92a7);if(_0x37d37e[_0x3b38('0x31')][_0x3b38('0x39')]){_0xa04c48['where']=_[_0x3b38('0x3a')](_0xa04c48['where'],{'$or':_[_0x3b38('0x2b')](_0x4c92a7,function(_0x33ae0f){if(_0x33ae0f['type']!==_0x3b38('0x3b')){var _0x319e6d={};_0x319e6d[_0x33ae0f[_0x3b38('0x28')]]={'$like':'%'+_0x37d37e[_0x3b38('0x31')][_0x3b38('0x39')]+'%'};return _0x319e6d;}})});}_0xa04c48=_[_0x3b38('0x3a')]({},_0xa04c48,_0x37d37e[_0x3b38('0x3c')]);var _0x4fde9b={'where':_0xa04c48['where']};return db[_0x3b38('0x2c')][_0x3b38('0x1b')](_0x4fde9b)['then'](function(_0x4c630a){_0x1b0de6[_0x3b38('0x1b')]=_0x4c630a;if(_0x37d37e[_0x3b38('0x31')][_0x3b38('0x3d')]){_0xa04c48[_0x3b38('0x3e')]=[{'all':!![]}];}return db[_0x3b38('0x2c')]['findAll'](_0xa04c48);})[_0x3b38('0x22')](function(_0xe5fc2c){_0x1b0de6[_0x3b38('0x3f')]=_0xe5fc2c;return _0x1b0de6;})[_0x3b38('0x22')](respondWithFilteredResult(_0x3fa688,_0xa04c48))[_0x3b38('0x40')](handleError(_0x3fa688,null));};exports['show']=function(_0x65cbe4,_0x449031){var _0x2b8c90={'raw':!![],'where':{'id':_0x65cbe4[_0x3b38('0x41')]['id']}},_0x33494c={};_0x33494c[_0x3b38('0x30')]=_[_0x3b38('0x42')](db[_0x3b38('0x2c')][_0x3b38('0x2d')]);_0x33494c[_0x3b38('0x31')]=_[_0x3b38('0x42')](_0x65cbe4[_0x3b38('0x31')]);_0x33494c[_0x3b38('0x37')]=_[_0x3b38('0x32')](_0x33494c[_0x3b38('0x30')],_0x33494c[_0x3b38('0x31')]);_0x2b8c90[_0x3b38('0x33')]=_[_0x3b38('0x32')](_0x33494c[_0x3b38('0x30')],qs[_0x3b38('0x34')](_0x65cbe4[_0x3b38('0x31')][_0x3b38('0x34')]));_0x2b8c90[_0x3b38('0x33')]=_0x2b8c90['attributes'][_0x3b38('0x43')]?_0x2b8c90['attributes']:_0x33494c[_0x3b38('0x30')];if(_0x65cbe4[_0x3b38('0x31')][_0x3b38('0x3d')]){_0x2b8c90['include']=[{'all':!![]}];}_0x2b8c90=_[_0x3b38('0x3a')]({},_0x2b8c90,_0x65cbe4[_0x3b38('0x3c')]);return db[_0x3b38('0x2c')][_0x3b38('0x44')](_0x2b8c90)[_0x3b38('0x22')](handleEntityNotFound(_0x449031,null))[_0x3b38('0x22')](respondWithResult(_0x449031,null))['catch'](handleError(_0x449031,null));};exports[_0x3b38('0x45')]=function(_0x59b11a,_0x5124c7){return db[_0x3b38('0x2c')][_0x3b38('0x45')](_0x59b11a[_0x3b38('0x46')],{})[_0x3b38('0x22')](function(_0x1003ae){var _0x408568=_0x59b11a[_0x3b38('0x47')][_0x3b38('0x48')]({'plain':!![]});if(!_0x408568)throw new Error(_0x3b38('0x49'));if(_0x408568[_0x3b38('0x4a')]===_0x3b38('0x47')){var _0x2729ef=_0x1003ae['get']({'plain':!![]});var _0x295028=_0x3b38('0x23');return db[_0x3b38('0x4b')][_0x3b38('0x44')]({'where':{'name':_0x295028,'userProfileId':_0x408568['userProfileId']},'raw':!![]})[_0x3b38('0x22')](function(_0x187aec){if(_0x187aec&&_0x187aec[_0x3b38('0x4c')]===0x0){return db[_0x3b38('0x24')][_0x3b38('0x45')]({'name':_0x2729ef[_0x3b38('0x28')],'resourceId':_0x2729ef['id'],'type':_0x187aec['name'],'sectionId':_0x187aec['id']},{})[_0x3b38('0x22')](function(){return _0x1003ae;});}else{return _0x1003ae;}})[_0x3b38('0x40')](function(_0x48f3aa){logger[_0x3b38('0x26')](_0x3b38('0x4d'),_0x48f3aa);throw _0x48f3aa;});}return _0x1003ae;})[_0x3b38('0x22')](respondWithResult(_0x5124c7,0xc9))['catch'](handleError(_0x5124c7,null));};exports['update']=function(_0x2c21a8,_0x463404){if(_0x2c21a8[_0x3b38('0x46')]['id']){delete _0x2c21a8[_0x3b38('0x46')]['id'];}return db['Disposition'][_0x3b38('0x44')]({'where':{'id':_0x2c21a8['params']['id']}})['then'](handleEntityNotFound(_0x463404,null))[_0x3b38('0x22')](saveUpdates(_0x2c21a8[_0x3b38('0x46')],null))['then'](respondWithResult(_0x463404,null))['catch'](handleError(_0x463404,null));};exports[_0x3b38('0x25')]=function(_0x28a6dd,_0x57bcd8){return db[_0x3b38('0x2c')][_0x3b38('0x44')]({'where':{'id':_0x28a6dd[_0x3b38('0x41')]['id']}})[_0x3b38('0x22')](handleEntityNotFound(_0x57bcd8,null))['then'](removeEntity(_0x57bcd8,null))[_0x3b38('0x40')](handleError(_0x57bcd8,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index db8c343..230b31e 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 _0x2ea6=['Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define'];(function(_0xd3c879,_0x1a531a){var _0x31251d=function(_0x4aa663){while(--_0x4aa663){_0xd3c879['push'](_0xd3c879['shift']());}};_0x31251d(++_0x1a531a);}(_0x2ea6,0x148));var _0x62ea=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x2ea6[_0x45c981];return _0x4f62c8;};'use strict';var _=require(_0x62ea('0x0'));var util=require('util');var logger=require(_0x62ea('0x1'))(_0x62ea('0x2'));var moment=require(_0x62ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x62ea('0x4'));var fs=require('fs');var path=require(_0x62ea('0x5'));var rimraf=require(_0x62ea('0x6'));var config=require(_0x62ea('0x7'));var attributes=require(_0x62ea('0x8'));module['exports']=function(_0x30eaf8,_0x4d0360){return _0x30eaf8[_0x62ea('0x9')](_0x62ea('0xa'),attributes,{'tableName':_0x62ea('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x62ea('0xc'),'fields':[_0x62ea('0xd'),'ListId']},{'unique':!![],'name':_0x62ea('0xe'),'fields':['name',_0x62ea('0xf')]},{'unique':!![],'name':_0x62ea('0x10'),'fields':[_0x62ea('0xd'),_0x62ea('0x11')]},{'unique':!![],'name':_0x62ea('0x12'),'fields':['name',_0x62ea('0x13')]},{'unique':!![],'name':_0x62ea('0x14'),'fields':[_0x62ea('0xd'),_0x62ea('0x15')]},{'unique':!![],'name':_0x62ea('0x16'),'fields':[_0x62ea('0xd'),_0x62ea('0x17')]},{'unique':!![],'name':_0x62ea('0x18'),'fields':['name',_0x62ea('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7372=['Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x527293,_0x57bde0){var _0x482d4e=function(_0x499cee){while(--_0x499cee){_0x527293['push'](_0x527293['shift']());}};_0x482d4e(++_0x57bde0);}(_0x7372,0x83));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2737('0x0'));var logger=require(_0x2737('0x1'))(_0x2737('0x2'));var moment=require(_0x2737('0x3'));var BPromise=require(_0x2737('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2737('0x5'));var rimraf=require('rimraf');var config=require(_0x2737('0x6'));var attributes=require('./disposition.attributes');module[_0x2737('0x7')]=function(_0x529c96,_0x2012ab){return _0x529c96[_0x2737('0x8')](_0x2737('0x9'),attributes,{'tableName':_0x2737('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x2737('0xb'),_0x2737('0xc')]},{'unique':!![],'name':_0x2737('0xd'),'fields':[_0x2737('0xb'),_0x2737('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x2737('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x2737('0xb'),_0x2737('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x2737('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x2737('0x11'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x2737('0x12'),'fields':[_0x2737('0xb'),_0x2737('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 140160e..fbdfef5 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(_0x342042,_0x133913){var _0x417b69=function(_0x5cb9fc){while(--_0x5cb9fc){_0x342042['push'](_0x342042['shift']());}};_0x417b69(++_0x133913);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x694768,_0x12856e){var _0x4a7e81=function(_0x2c1f5c){while(--_0x2c1f5c){_0x694768['push'](_0x694768['shift']());}};_0x4a7e81(++_0x12856e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 7769dfb..090631a 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 _0xd36d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3109ce,_0x4e8d5){var _0x44b884=function(_0x52e818){while(--_0x52e818){_0x3109ce['push'](_0x3109ce['shift']());}};_0x44b884(++_0x4e8d5);}(_0xd36d,0x72));var _0xdd36=function(_0x325ca0,_0x1defdd){_0x325ca0=_0x325ca0-0x0;var _0x451076=_0xd36d[_0x325ca0];return _0x451076;};'use strict';var multer=require(_0xdd36('0x0'));var util=require('util');var path=require(_0xdd36('0x1'));var timeout=require(_0xdd36('0x2'));var express=require(_0xdd36('0x3'));var router=express[_0xdd36('0x4')]();var fs_extra=require(_0xdd36('0x5'));var auth=require(_0xdd36('0x6'));var interaction=require(_0xdd36('0x7'));var config=require(_0xdd36('0x8'));var controller=require(_0xdd36('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdd36('0xa')](_0xdd36('0xb'),auth[_0xdd36('0xc')](),controller[_0xdd36('0xd')]);router[_0xdd36('0xe')]('/',auth[_0xdd36('0xc')](),controller[_0xdd36('0xf')]);router[_0xdd36('0x10')](_0xdd36('0xb'),auth['isAuthenticated'](),controller[_0xdd36('0x11')]);router[_0xdd36('0x12')](_0xdd36('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xdd36('0x13')]=router; \ No newline at end of file +var _0x8926=['create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x8926,0x10f));var _0x6892=function(_0x56196c,_0x55bf95){_0x56196c=_0x56196c-0x0;var _0x33d519=_0x8926[_0x56196c];return _0x33d519;};'use strict';var multer=require(_0x6892('0x0'));var util=require('util');var path=require(_0x6892('0x1'));var timeout=require(_0x6892('0x2'));var express=require(_0x6892('0x3'));var router=express[_0x6892('0x4')]();var fs_extra=require(_0x6892('0x5'));var auth=require(_0x6892('0x6'));var interaction=require(_0x6892('0x7'));var config=require(_0x6892('0x8'));var controller=require(_0x6892('0x9'));router[_0x6892('0xa')]('/',auth[_0x6892('0xb')](),controller[_0x6892('0xc')]);router[_0x6892('0xa')]('/:id',auth[_0x6892('0xb')](),controller[_0x6892('0xd')]);router[_0x6892('0xe')]('/',auth[_0x6892('0xb')](),controller[_0x6892('0xf')]);router[_0x6892('0x10')](_0x6892('0x11'),auth[_0x6892('0xb')](),controller[_0x6892('0x12')]);router[_0x6892('0x13')](_0x6892('0x11'),auth[_0x6892('0xb')](),controller[_0x6892('0x14')]);module[_0x6892('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 461157b..227f63d 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 _0xf494=['localstationid','2400','4800','7200','14400','9600','12000','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x1094e8,_0x1df06a){var _0x51daab=function(_0x42b65f){while(--_0x42b65f){_0x1094e8['push'](_0x1094e8['shift']());}};_0x51daab(++_0x1df06a);}(_0xf494,0x1c6));var _0x4f49=function(_0x436989,_0x307d89){_0x436989=_0x436989-0x0;var _0x2e9ce5=_0xf494[_0x436989];return _0x2e9ce5;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x4f49('0x3')](_0x4f49('0x4'),'no'),'defaultValue':_0x4f49('0x4')},'headerinfo':{'type':Sequelize[_0x4f49('0x2')],'defaultValue':_0x4f49('0x5')},'localstationid':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x6')},'minrate':{'type':Sequelize[_0x4f49('0x3')](_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'9600','12000',_0x4f49('0xa')),'defaultValue':_0x4f49('0x8')},'maxrate':{'type':Sequelize[_0x4f49('0x3')](_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),_0x4f49('0xb'),_0x4f49('0xc'),'14400'),'defaultValue':_0x4f49('0xa')},'modem':{'type':Sequelize[_0x4f49('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x4f49('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4f49('0x3')](_0x4f49('0xd'),'IAX',_0x4f49('0xe'),_0x4f49('0xf')),'defaultValue':_0x4f49('0xd')},'key':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4f49('0x10')],'defaultValue':function(){return _0x4f49('0x11');}},'notificationSound':{'type':Sequelize[_0x4f49('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f49('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4f49('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4f49('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f49('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f49('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x4f49('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4f49('0x15'),'set':function(_0x399be7){if(!_0x399be7)this[_0x4f49('0x16')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x399be7);}}}; \ No newline at end of file +var _0xc4aa=['setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI','KHOMP','TEXT','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'];(function(_0x356c40,_0x4d8407){var _0x2cef63=function(_0x1affea){while(--_0x1affea){_0x356c40['push'](_0x356c40['shift']());}};_0x2cef63(++_0x4d8407);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xac4a('0x2')]},'ecm':{'type':Sequelize[_0xac4a('0x3')](_0xac4a('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x5')},'minrate':{'type':Sequelize[_0xac4a('0x3')](_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xac4a('0x3')](_0xac4a('0x6'),_0xac4a('0x7'),'7200',_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xac4a('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xac4a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xac4a('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xac4a('0x3')](_0xac4a('0xd'),'IAX',_0xac4a('0xe'),_0xac4a('0xf')),'defaultValue':_0xac4a('0xd')},'key':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xac4a('0x10')],'defaultValue':function(){return _0xac4a('0x11');}},'notificationSound':{'type':Sequelize[_0xac4a('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac4a('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac4a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xac4a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac4a('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac4a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac4a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xac4a('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xac4a('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xac4a('0x12')],'defaultValue':![],'comment':_0xac4a('0x14'),'set':function(_0x387a54){if(!_0x387a54)this[_0xac4a('0x15')](_0xac4a('0x16'),null);this['setDataValue']('mandatoryDisposition',_0x387a54);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 65a161d..acf7027 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 _0x61af=['Fax\x20Extension','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','t38timeout','push','FAXOPT(','Wait','ReceiveFax','VoiceExtension','omit','createdAt','updatedAt','findById','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','count','set','reject','destroy','UserProfileResource','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','length','includeAll','find','create','user','get','role','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','Pause','describe','FaxAccountId','getDispositions','findOne','Disposition','nolimit','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','from-voip-provider','exten','localstationid','app','description'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x61af,0xf1));var _0xf61a=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x61af[_0x19ef2b];return _0x4df537;};'use strict';var emlformat=require(_0xf61a('0x0'));var rimraf=require(_0xf61a('0x1'));var zipdir=require(_0xf61a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf61a('0x3'));var moment=require('moment');var BPromise=require(_0xf61a('0x4'));var Mustache=require(_0xf61a('0x5'));var util=require(_0xf61a('0x6'));var path=require(_0xf61a('0x7'));var sox=require(_0xf61a('0x8'));var csv=require(_0xf61a('0x9'));var ejs=require(_0xf61a('0xa'));var fs=require('fs');var fs_extra=require(_0xf61a('0xb'));var _=require(_0xf61a('0xc'));var squel=require(_0xf61a('0xd'));var crypto=require(_0xf61a('0xe'));var jsforce=require(_0xf61a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf61a('0x9'));var querystring=require('querystring');var Papa=require(_0xf61a('0x10'));var Redis=require(_0xf61a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf61a('0x12'));var as=require(_0xf61a('0x13'));var hardwareService=require(_0xf61a('0x14'));var logger=require('../../config/logger')(_0xf61a('0x15'));var utils=require(_0xf61a('0x16'));var config=require(_0xf61a('0x17'));var licenseUtil=require(_0xf61a('0x18'));var db=require(_0xf61a('0x19'))['db'];config[_0xf61a('0x1a')]=_[_0xf61a('0x1b')](config['redis'],{'host':_0xf61a('0x1c'),'port':0x18eb});var socket=require(_0xf61a('0x1d'))(new Redis(config['redis']));require(_0xf61a('0x1e'))[_0xf61a('0x1f')](socket);var jayson=require(_0xf61a('0x20'));var client=jayson[_0xf61a('0x21')][_0xf61a('0x22')]({'port':0x232c});var client9002=jayson[_0xf61a('0x21')][_0xf61a('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2c64cc,_0x15a35f,_0x1e423a,_0x5b40e4){return new BPromise(function(_0x9d1867,_0xebeff){var _0x2fda53=_0x5b40e4||client;return _0x2fda53['request'](_0x2c64cc,_0x1e423a)[_0xf61a('0x23')](function(_0xb84bc1){logger[_0xf61a('0x24')]('FaxAccount,\x20%s,\x20%s',_0x15a35f,'request\x20sent');logger[_0xf61a('0x25')](_0xf61a('0x26'),_0x15a35f,'request\x20sent',JSON[_0xf61a('0x27')](_0xb84bc1));if(_0xb84bc1[_0xf61a('0x28')]){if(_0xb84bc1[_0xf61a('0x28')]['code']===0x1f4){logger[_0xf61a('0x28')]('FaxAccount,\x20%s,\x20%s',_0x15a35f,_0xb84bc1[_0xf61a('0x28')][_0xf61a('0x29')]);return _0xebeff(_0xb84bc1[_0xf61a('0x28')][_0xf61a('0x29')]);}logger[_0xf61a('0x28')](_0xf61a('0x2a'),_0x15a35f,_0xb84bc1[_0xf61a('0x28')][_0xf61a('0x29')]);return _0x9d1867(_0xb84bc1[_0xf61a('0x28')][_0xf61a('0x29')]);}else{logger[_0xf61a('0x24')](_0xf61a('0x2a'),_0x15a35f,'request\x20sent');_0x9d1867(_0xb84bc1['result'][_0xf61a('0x29')]);}})[_0xf61a('0x2b')](function(_0x4ec9a6){logger[_0xf61a('0x28')]('FaxAccount,\x20%s,\x20%s',_0x15a35f,_0x4ec9a6);_0xebeff(_0x4ec9a6);});});}function respondWithStatusCode(_0x196bd0,_0x2e72b4){_0x2e72b4=_0x2e72b4||0xcc;return function(_0x4b6001){if(_0x4b6001){return _0x196bd0[_0xf61a('0x2c')](_0x2e72b4);}return _0x196bd0[_0xf61a('0x2d')](_0x2e72b4)[_0xf61a('0x2e')]();};}function respondWithResult(_0x3f6714,_0x14ab93){_0x14ab93=_0x14ab93||0xc8;return function(_0x53d7c3){if(_0x53d7c3){return _0x3f6714[_0xf61a('0x2d')](_0x14ab93)[_0xf61a('0x2f')](_0x53d7c3);}};}function respondWithFilteredResult(_0x3a1d29,_0x38b36f){return function(_0x297a0c){if(_0x297a0c){var _0x394b39=typeof _0x38b36f[_0xf61a('0x30')]==='undefined'&&typeof _0x38b36f[_0xf61a('0x31')]==='undefined';var _0x4dc760=_0x297a0c[_0xf61a('0x32')];var _0x365b99=_0x394b39?0x0:_0x38b36f['offset'];var _0x5c6c05=_0x394b39?_0x297a0c[_0xf61a('0x32')]:_0x38b36f[_0xf61a('0x30')]+_0x38b36f[_0xf61a('0x31')];var _0x450288;if(_0x5c6c05>=_0x4dc760){_0x5c6c05=_0x4dc760;_0x450288=0xc8;}else{_0x450288=0xce;}_0x3a1d29[_0xf61a('0x2d')](_0x450288);return _0x3a1d29[_0xf61a('0x33')]('Content-Range',_0x365b99+'-'+_0x5c6c05+'/'+_0x4dc760)[_0xf61a('0x2f')](_0x297a0c);}return null;};}function patchUpdates(_0x152b8d){return function(_0x18f935){try{jsonpatch['apply'](_0x18f935,_0x152b8d,!![]);}catch(_0x43e394){return BPromise[_0xf61a('0x34')](_0x43e394);}return _0x18f935['save']();};}function saveUpdates(_0x1afd05,_0xb0c8a1){return function(_0x36e710){if(_0x36e710){return _0x36e710['update'](_0x1afd05)[_0xf61a('0x23')](function(_0x573425){return _0x573425;});}return null;};}function removeEntity(_0x137f39,_0x308769){return function(_0x5eafae){if(_0x5eafae){return _0x5eafae[_0xf61a('0x35')]()[_0xf61a('0x23')](function(){var _0x1c0908=_0x5eafae['get']({'plain':!![]});var _0x80514f='FaxAccounts';return db[_0xf61a('0x36')][_0xf61a('0x35')]({'where':{'type':_0x80514f,'resourceId':_0x1c0908['id']}})[_0xf61a('0x23')](function(){return _0x5eafae;});})['then'](function(){_0x137f39[_0xf61a('0x2d')](0xcc)[_0xf61a('0x2e')]();});}};}function handleEntityNotFound(_0x511047,_0x58970a){return function(_0x3b14f3){if(!_0x3b14f3){_0x511047[_0xf61a('0x2c')](0x194);}return _0x3b14f3;};}function handleError(_0x476014,_0x528039){_0x528039=_0x528039||0x1f4;return function(_0x57df24){logger['error'](_0x57df24['stack']);if(_0x57df24[_0xf61a('0x37')]){delete _0x57df24['name'];}_0x476014[_0xf61a('0x2d')](_0x528039)[_0xf61a('0x38')](_0x57df24);};}exports[_0xf61a('0x39')]=function(_0x1d80fd,_0x5d6ea1){var _0xa2141f={'include':[{'model':db['Pause'],'as':_0xf61a('0x3a')}]},_0x5e1a30={},_0xada1e3={'count':0x0,'rows':[]};var _0x161c75=_[_0xf61a('0x3b')](db[_0xf61a('0x3c')][_0xf61a('0x3d')],function(_0x3eb86e){return{'name':_0x3eb86e[_0xf61a('0x3e')],'type':_0x3eb86e[_0xf61a('0x3f')][_0xf61a('0x40')]};});_0x5e1a30[_0xf61a('0x41')]=_['map'](_0x161c75,_0xf61a('0x37'));_0x5e1a30[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x1d80fd['query']);_0x5e1a30[_0xf61a('0x44')]=_['intersection'](_0x5e1a30[_0xf61a('0x41')],_0x5e1a30[_0xf61a('0x42')]);_0xa2141f['attributes']=_[_0xf61a('0x45')](_0x5e1a30[_0xf61a('0x41')],qs[_0xf61a('0x46')](_0x1d80fd[_0xf61a('0x42')][_0xf61a('0x46')]));_0xa2141f[_0xf61a('0x47')]=_0xa2141f[_0xf61a('0x47')]['length']?_0xa2141f[_0xf61a('0x47')]:_0x5e1a30[_0xf61a('0x41')];if(!_0x1d80fd['query'][_0xf61a('0x48')]('nolimit')){_0xa2141f[_0xf61a('0x31')]=qs['limit'](_0x1d80fd[_0xf61a('0x42')][_0xf61a('0x31')]);_0xa2141f[_0xf61a('0x30')]=qs[_0xf61a('0x30')](_0x1d80fd[_0xf61a('0x42')][_0xf61a('0x30')]);}_0xa2141f[_0xf61a('0x49')]=qs[_0xf61a('0x4a')](_0x1d80fd[_0xf61a('0x42')][_0xf61a('0x4a')]);_0xa2141f[_0xf61a('0x4b')]=qs[_0xf61a('0x44')](_[_0xf61a('0x4c')](_0x1d80fd[_0xf61a('0x42')],_0x5e1a30[_0xf61a('0x44')]),_0x161c75);if(_0x1d80fd['query'][_0xf61a('0x4d')]){_0xa2141f[_0xf61a('0x4b')]=_[_0xf61a('0x4e')](_0xa2141f[_0xf61a('0x4b')],{'$or':_['map'](_0x161c75,function(_0x54c257){if(_0x54c257[_0xf61a('0x3f')]!==_0xf61a('0x4f')){var _0x26abed={};_0x26abed[_0x54c257[_0xf61a('0x37')]]={'$like':'%'+_0x1d80fd['query']['filter']+'%'};return _0x26abed;}})});}_0xa2141f=_[_0xf61a('0x4e')]({},_0xa2141f,_0x1d80fd[_0xf61a('0x50')]);var _0x576dbc={'where':_0xa2141f[_0xf61a('0x4b')]};return db[_0xf61a('0x3c')][_0xf61a('0x32')](_0x576dbc)[_0xf61a('0x23')](function(_0x3fb3fd){_0xada1e3[_0xf61a('0x32')]=_0x3fb3fd;if(_0x1d80fd[_0xf61a('0x42')]['includeAll']){_0xa2141f[_0xf61a('0x51')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0xa2141f);})['then'](function(_0x289421){_0xada1e3['rows']=_0x289421;return _0xada1e3;})[_0xf61a('0x23')](respondWithFilteredResult(_0x5d6ea1,_0xa2141f))[_0xf61a('0x2b')](handleError(_0x5d6ea1,null));};exports[_0xf61a('0x52')]=function(_0x2fe10e,_0x33ef13){var _0x656c50={'raw':![],'where':{'id':_0x2fe10e[_0xf61a('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xf61a('0x3a')}]},_0x58d5c1={};_0x58d5c1['model']=_[_0xf61a('0x43')](db[_0xf61a('0x3c')][_0xf61a('0x3d')]);_0x58d5c1['query']=_[_0xf61a('0x43')](_0x2fe10e[_0xf61a('0x42')]);_0x58d5c1[_0xf61a('0x44')]=_['intersection'](_0x58d5c1[_0xf61a('0x41')],_0x58d5c1[_0xf61a('0x42')]);_0x656c50[_0xf61a('0x47')]=_['intersection'](_0x58d5c1['model'],qs['fields'](_0x2fe10e[_0xf61a('0x42')][_0xf61a('0x46')]));_0x656c50[_0xf61a('0x47')]=_0x656c50[_0xf61a('0x47')][_0xf61a('0x54')]?_0x656c50[_0xf61a('0x47')]:_0x58d5c1[_0xf61a('0x41')];if(_0x2fe10e[_0xf61a('0x42')][_0xf61a('0x55')]){_0x656c50[_0xf61a('0x51')]=[{'all':!![]}];}_0x656c50=_[_0xf61a('0x4e')]({},_0x656c50,_0x2fe10e[_0xf61a('0x50')]);return db[_0xf61a('0x3c')][_0xf61a('0x56')](_0x656c50)[_0xf61a('0x23')](handleEntityNotFound(_0x33ef13,null))['then'](respondWithResult(_0x33ef13,null))[_0xf61a('0x2b')](handleError(_0x33ef13,null));};exports[_0xf61a('0x57')]=function(_0x1e2f49,_0xac90c8){return db['FaxAccount'][_0xf61a('0x57')](_0x1e2f49['body'],{})[_0xf61a('0x23')](function(_0x296996){var _0x129753=_0x1e2f49[_0xf61a('0x58')][_0xf61a('0x59')]({'plain':!![]});if(!_0x129753)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x129753[_0xf61a('0x5a')]===_0xf61a('0x58')){var _0x3b92fa=_0x296996['get']({'plain':!![]});var _0x490a42=_0xf61a('0x5b');return db['UserProfileSection'][_0xf61a('0x56')]({'where':{'name':_0x490a42,'userProfileId':_0x129753[_0xf61a('0x5c')]},'raw':!![]})[_0xf61a('0x23')](function(_0x4d3b57){if(_0x4d3b57&&_0x4d3b57[_0xf61a('0x5d')]===0x0){return db[_0xf61a('0x36')]['create']({'name':_0x3b92fa['name'],'resourceId':_0x3b92fa['id'],'type':_0x4d3b57[_0xf61a('0x37')],'sectionId':_0x4d3b57['id']},{})[_0xf61a('0x23')](function(){return _0x296996;});}else{return _0x296996;}})[_0xf61a('0x2b')](function(_0x640b99){logger[_0xf61a('0x28')](_0xf61a('0x5e'),_0x640b99);throw _0x640b99;});}return _0x296996;})[_0xf61a('0x23')](respondWithResult(_0xac90c8,0xc9))[_0xf61a('0x2b')](handleError(_0xac90c8,null));};exports[_0xf61a('0x5f')]=function(_0x4159af,_0x4dfa14){if(_0x4159af[_0xf61a('0x60')]['id']){delete _0x4159af[_0xf61a('0x60')]['id'];}return db['FaxAccount'][_0xf61a('0x56')]({'where':{'id':_0x4159af[_0xf61a('0x53')]['id']},'include':[{'model':db[_0xf61a('0x61')],'as':'mandatoryDispositionPause'}]})[_0xf61a('0x23')](handleEntityNotFound(_0x4dfa14,null))['then'](saveUpdates(_0x4159af[_0xf61a('0x60')],null))[_0xf61a('0x23')](respondWithResult(_0x4dfa14,null))[_0xf61a('0x2b')](handleError(_0x4dfa14,null));};exports[_0xf61a('0x35')]=function(_0x732bc3,_0x5754a2){return db[_0xf61a('0x3c')][_0xf61a('0x56')]({'where':{'id':_0x732bc3['params']['id']}})['then'](handleEntityNotFound(_0x5754a2,null))[_0xf61a('0x23')](removeEntity(_0x5754a2,null))[_0xf61a('0x2b')](handleError(_0x5754a2,null));};exports['describe']=function(_0x56fcf1,_0x100d3d){return db[_0xf61a('0x3c')][_0xf61a('0x62')]()[_0xf61a('0x23')](respondWithResult(_0x100d3d,null))[_0xf61a('0x2b')](handleError(_0x100d3d,null));};exports['addDisposition']=function(_0x4d8b90,_0x248973,_0xf70337){if(_0x4d8b90['body']['id']){delete _0x4d8b90[_0xf61a('0x60')]['id'];}return db[_0xf61a('0x3c')]['find']({'where':{'id':_0x4d8b90[_0xf61a('0x53')]['id']}})['then'](handleEntityNotFound(_0x248973,null))[_0xf61a('0x23')](function(_0x345fa8){if(_0x345fa8){_0x4d8b90['body'][_0xf61a('0x63')]=_0x345fa8['id'];return db['Disposition'][_0xf61a('0x57')](_0x4d8b90[_0xf61a('0x60')]);}})[_0xf61a('0x23')](respondWithResult(_0x248973,null))[_0xf61a('0x2b')](handleError(_0x248973,null));};exports[_0xf61a('0x64')]=function(_0x34d60b,_0x3f322f,_0x478b79){var _0x22bc30={'raw':![],'where':{}};var _0x28b9d5={};var _0x364127={'count':0x0,'rows':[]};return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x34d60b[_0xf61a('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f322f,null))[_0xf61a('0x23')](function(_0xd9b4d4){if(_0xd9b4d4){_0x28b9d5['model']=_[_0xf61a('0x43')](db[_0xf61a('0x66')][_0xf61a('0x3d')]);_0x28b9d5[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x34d60b[_0xf61a('0x42')]);_0x28b9d5[_0xf61a('0x44')]=_[_0xf61a('0x45')](_0x28b9d5[_0xf61a('0x41')],_0x28b9d5[_0xf61a('0x42')]);_0x22bc30[_0xf61a('0x47')]=_[_0xf61a('0x45')](_0x28b9d5[_0xf61a('0x41')],qs['fields'](_0x34d60b[_0xf61a('0x42')]['fields']));_0x22bc30[_0xf61a('0x47')]=_0x22bc30['attributes'][_0xf61a('0x54')]?_0x22bc30[_0xf61a('0x47')]:_0x28b9d5[_0xf61a('0x41')];if(!_0x34d60b[_0xf61a('0x42')][_0xf61a('0x48')](_0xf61a('0x67'))){_0x22bc30['limit']=qs[_0xf61a('0x31')](_0x34d60b['query'][_0xf61a('0x31')]);_0x22bc30[_0xf61a('0x30')]=qs['offset'](_0x34d60b[_0xf61a('0x42')][_0xf61a('0x30')]);}_0x22bc30['order']=qs[_0xf61a('0x4a')](_0x34d60b[_0xf61a('0x42')]['sort']);_0x22bc30[_0xf61a('0x4b')]=qs['filters'](_['pick'](_0x34d60b[_0xf61a('0x42')],_0x28b9d5['filters']));_0x22bc30[_0xf61a('0x4b')][_0xf61a('0x63')]=_0xd9b4d4['id'];if(_0x34d60b[_0xf61a('0x42')][_0xf61a('0x4d')]){_0x22bc30[_0xf61a('0x4b')]=_['merge'](_0x22bc30[_0xf61a('0x4b')],{'$or':_[_0xf61a('0x3b')](_0x22bc30[_0xf61a('0x47')],function(_0x1b5db5){var _0x1e1cf5={};_0x1e1cf5[_0x1b5db5]={'$like':'%'+_0x34d60b[_0xf61a('0x42')][_0xf61a('0x4d')]+'%'};return _0x1e1cf5;})});}_0x22bc30=_[_0xf61a('0x4e')]({},_0x22bc30,_0x34d60b['options']);return db[_0xf61a('0x66')][_0xf61a('0x32')]({'where':_0x22bc30[_0xf61a('0x4b')]})['then'](function(_0x27a9b5){_0x364127[_0xf61a('0x32')]=_0x27a9b5;if(_0x34d60b[_0xf61a('0x42')][_0xf61a('0x55')]){_0x22bc30[_0xf61a('0x51')]=[{'all':!![]}];}return db[_0xf61a('0x66')][_0xf61a('0x68')](_0x22bc30);})[_0xf61a('0x23')](function(_0x199948){_0x364127[_0xf61a('0x69')]=_0x199948;return _0x364127;});}})[_0xf61a('0x23')](respondWithFilteredResult(_0x3f322f,_0x22bc30))[_0xf61a('0x2b')](handleError(_0x3f322f,null));};exports['removeDispositions']=function(_0x164612,_0x440eaf,_0xb26726){return db[_0xf61a('0x3c')][_0xf61a('0x56')]({'where':{'id':_0x164612[_0xf61a('0x53')]['id']}})['then'](handleEntityNotFound(_0x440eaf,null))[_0xf61a('0x23')](function(_0x7190e8){if(_0x7190e8){return _0x7190e8[_0xf61a('0x6a')](_0x164612[_0xf61a('0x42')][_0xf61a('0x6b')]);}})[_0xf61a('0x23')](respondWithStatusCode(_0x440eaf,null))[_0xf61a('0x2b')](handleError(_0x440eaf,null));};exports[_0xf61a('0x6c')]=function(_0x1ea1fe,_0x110c0c,_0x50c6d3){if(_0x1ea1fe[_0xf61a('0x60')]['id']){delete _0x1ea1fe[_0xf61a('0x60')]['id'];}return db[_0xf61a('0x3c')]['find']({'where':{'id':_0x1ea1fe[_0xf61a('0x53')]['id']}})['then'](handleEntityNotFound(_0x110c0c,null))[_0xf61a('0x23')](function(_0x1f8060){if(_0x1f8060){_0x1ea1fe[_0xf61a('0x60')]['FaxAccountId']=_0x1f8060['id'];return db[_0xf61a('0x6d')][_0xf61a('0x57')](_0x1ea1fe['body']);}})[_0xf61a('0x23')](respondWithResult(_0x110c0c,null))[_0xf61a('0x2b')](handleError(_0x110c0c,null));};exports[_0xf61a('0x6e')]=function(_0x34cbef,_0x25dd89,_0x460a2e){var _0x1d4796={'raw':![],'where':{}};var _0x284b26={};var _0x423291={'count':0x0,'rows':[]};return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x34cbef[_0xf61a('0x53')]['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x25dd89,null))[_0xf61a('0x23')](function(_0x42c594){if(_0x42c594){_0x284b26[_0xf61a('0x41')]=_[_0xf61a('0x43')](db[_0xf61a('0x6d')][_0xf61a('0x3d')]);_0x284b26[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x34cbef[_0xf61a('0x42')]);_0x284b26[_0xf61a('0x44')]=_[_0xf61a('0x45')](_0x284b26[_0xf61a('0x41')],_0x284b26[_0xf61a('0x42')]);_0x1d4796['attributes']=_['intersection'](_0x284b26[_0xf61a('0x41')],qs[_0xf61a('0x46')](_0x34cbef[_0xf61a('0x42')]['fields']));_0x1d4796['attributes']=_0x1d4796[_0xf61a('0x47')][_0xf61a('0x54')]?_0x1d4796[_0xf61a('0x47')]:_0x284b26[_0xf61a('0x41')];if(!_0x34cbef[_0xf61a('0x42')][_0xf61a('0x48')](_0xf61a('0x67'))){_0x1d4796[_0xf61a('0x31')]=qs[_0xf61a('0x31')](_0x34cbef[_0xf61a('0x42')][_0xf61a('0x31')]);_0x1d4796[_0xf61a('0x30')]=qs[_0xf61a('0x30')](_0x34cbef['query']['offset']);}_0x1d4796[_0xf61a('0x49')]=qs['sort'](_0x34cbef['query'][_0xf61a('0x4a')]);_0x1d4796[_0xf61a('0x4b')]=qs[_0xf61a('0x44')](_[_0xf61a('0x4c')](_0x34cbef['query'],_0x284b26['filters']));_0x1d4796[_0xf61a('0x4b')]['FaxAccountId']=_0x42c594['id'];if(_0x34cbef[_0xf61a('0x42')][_0xf61a('0x4d')]){_0x1d4796['where']=_[_0xf61a('0x4e')](_0x1d4796[_0xf61a('0x4b')],{'$or':_[_0xf61a('0x3b')](_0x1d4796[_0xf61a('0x47')],function(_0x4ec04f){var _0x100f68={};_0x100f68[_0x4ec04f]={'$like':'%'+_0x34cbef['query']['filter']+'%'};return _0x100f68;})});}_0x1d4796=_[_0xf61a('0x4e')]({},_0x1d4796,_0x34cbef['options']);return db[_0xf61a('0x6d')][_0xf61a('0x32')]({'where':_0x1d4796['where']})['then'](function(_0x1d9f66){_0x423291['count']=_0x1d9f66;if(_0x34cbef['query'][_0xf61a('0x55')]){_0x1d4796[_0xf61a('0x51')]=[{'all':!![]}];}return db[_0xf61a('0x6d')][_0xf61a('0x68')](_0x1d4796);})[_0xf61a('0x23')](function(_0x4c2338){_0x423291[_0xf61a('0x69')]=_0x4c2338;return _0x423291;});}})[_0xf61a('0x23')](respondWithFilteredResult(_0x25dd89,_0x1d4796))[_0xf61a('0x2b')](handleError(_0x25dd89,null));};exports['removeAnswers']=function(_0x4e4c90,_0x357a79,_0x2dca7a){return db['FaxAccount'][_0xf61a('0x56')]({'where':{'id':_0x4e4c90['params']['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x357a79,null))['then'](function(_0xe367af){if(_0xe367af){return _0xe367af['removeAnswers'](_0x4e4c90[_0xf61a('0x42')][_0xf61a('0x6b')]);}})['then'](respondWithStatusCode(_0x357a79,null))[_0xf61a('0x2b')](handleError(_0x357a79,null));};exports[_0xf61a('0x6f')]=function(_0x6ca02a,_0x2c1214,_0x1bd93b){return db['FaxInteraction'][_0xf61a('0x56')]({'where':{'id':_0x6ca02a['params']['id']}})['then'](handleEntityNotFound(_0x2c1214,null))[_0xf61a('0x23')](function(_0x45c54d){if(_0x45c54d){return _0x45c54d['addInteraction'](_0x6ca02a[_0xf61a('0x60')][_0xf61a('0x6b')],_['omit'](_0x6ca02a[_0xf61a('0x60')],[_0xf61a('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x2c1214,null))[_0xf61a('0x2b')](handleError(_0x2c1214,null));};exports[_0xf61a('0x70')]=function(_0x237425,_0x21f807,_0x38ee27){var _0x2642b0={'raw':![],'where':{}};var _0x5409ad={};var _0x3e06e2={'count':0x0,'rows':[]};return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x237425['params']['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x21f807,null))[_0xf61a('0x23')](function(_0x1e44ca){if(_0x1e44ca){_0x5409ad[_0xf61a('0x41')]=_[_0xf61a('0x43')](db[_0xf61a('0x71')]['rawAttributes']);_0x5409ad[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x237425['query']);_0x5409ad[_0xf61a('0x44')]=_[_0xf61a('0x45')](_0x5409ad[_0xf61a('0x41')],_0x5409ad[_0xf61a('0x42')]);_0x2642b0['attributes']=_[_0xf61a('0x45')](_0x5409ad['model'],qs[_0xf61a('0x46')](_0x237425[_0xf61a('0x42')][_0xf61a('0x46')]));_0x2642b0[_0xf61a('0x47')]=_0x2642b0['attributes'][_0xf61a('0x54')]?_0x2642b0[_0xf61a('0x47')]:_0x5409ad[_0xf61a('0x41')];if(!_0x237425[_0xf61a('0x42')]['hasOwnProperty']('nolimit')){_0x2642b0[_0xf61a('0x31')]=qs[_0xf61a('0x31')](_0x237425['query']['limit']);_0x2642b0[_0xf61a('0x30')]=qs['offset'](_0x237425[_0xf61a('0x42')][_0xf61a('0x30')]);}_0x2642b0['order']=qs[_0xf61a('0x4a')](_0x237425[_0xf61a('0x42')]['sort']);_0x2642b0[_0xf61a('0x4b')]=qs['filters'](_[_0xf61a('0x4c')](_0x237425['query'],_0x5409ad[_0xf61a('0x44')]));_0x2642b0[_0xf61a('0x4b')][_0xf61a('0x63')]=_0x1e44ca['id'];if(_0x237425[_0xf61a('0x42')][_0xf61a('0x4d')]){_0x2642b0[_0xf61a('0x4b')]=_['merge'](_0x2642b0['where'],{'$or':_[_0xf61a('0x3b')](_0x2642b0[_0xf61a('0x47')],function(_0x6306e0){var _0x5129eb={};_0x5129eb[_0x6306e0]={'$like':'%'+_0x237425[_0xf61a('0x42')]['filter']+'%'};return _0x5129eb;})});}_0x2642b0=_[_0xf61a('0x4e')]({},_0x2642b0,_0x237425[_0xf61a('0x50')]);return db[_0xf61a('0x71')][_0xf61a('0x32')]({'where':_0x2642b0['where']})[_0xf61a('0x23')](function(_0x18130a){_0x3e06e2[_0xf61a('0x32')]=_0x18130a;if(_0x237425['query'][_0xf61a('0x55')]){_0x2642b0[_0xf61a('0x51')]=[{'model':db[_0xf61a('0x72')],'as':'Contact','required':![]},{'model':db[_0xf61a('0x73')],'as':_0xf61a('0x74'),'attributes':[_0xf61a('0x37'),_0xf61a('0x75'),'internal'],'required':![]},{'model':db[_0xf61a('0x76')],'as':'Tags','attributes':['id',_0xf61a('0x37'),_0xf61a('0x77')],'where':_0x237425[_0xf61a('0x42')][_0xf61a('0x78')]?{'id':_0x237425[_0xf61a('0x42')][_0xf61a('0x78')]}:undefined,'required':_0x237425['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0xf61a('0x68')](_0x2642b0);})[_0xf61a('0x23')](function(_0xa605af){_0x3e06e2['rows']=_0xa605af;return _0x3e06e2;});}})[_0xf61a('0x23')](respondWithFilteredResult(_0x21f807,_0x2642b0))[_0xf61a('0x2b')](handleError(_0x21f807,null));};exports[_0xf61a('0x79')]=function(_0x2c1060,_0x3ab88a){var _0x270b43=_0x2c1060[_0xf61a('0x53')]['id'];var _0x3b2f02=_0x2c1060['body'];var _0x3e1d2e=0xc8;var _0x29b7bf=null;return db[_0xf61a('0x7a')][_0xf61a('0x7b')]({'isolationLevel':db[_0xf61a('0x7a')][_0xf61a('0x7c')][_0xf61a('0x7d')][_0xf61a('0x7e')]},function(_0x3a09ac){return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x270b43},'transaction':_0x3a09ac})['then'](function(_0x3e39cb){if(_0x3e39cb){return db[_0xf61a('0x7f')][_0xf61a('0x35')]({'where':{'FaxAccountId':_0x270b43},'transaction':_0x3a09ac})[_0xf61a('0x23')](function(){var _0x39689f=_[_0xf61a('0x3b')](_0x3b2f02,function(_0x5d86ed){_0x5d86ed[_0xf61a('0x63')]=_0x270b43;return _0x5d86ed;});return db['FaxApplication'][_0xf61a('0x80')](_0x39689f,{'transaction':_0x3a09ac});});}else{_0x3e1d2e=0x194;_0x29b7bf=[];}});})[_0xf61a('0x23')](function(){if(_0x3e1d2e!==0x194){return db[_0xf61a('0x7f')][_0xf61a('0x81')]({'where':{'FaxAccountId':_0x270b43},'order':_0xf61a('0x82')})[_0xf61a('0x23')](function(_0x3a9783){_0x29b7bf=_0x3a9783;});}})[_0xf61a('0x2b')](function(_0x16ed90){_0x3e1d2e=0x1f4;logger[_0xf61a('0x28')](_0x16ed90[_0xf61a('0x83')]);if(_0x16ed90['name']){delete _0x16ed90[_0xf61a('0x37')];}_0x29b7bf=_0x16ed90;})[_0xf61a('0x84')](function(){if(_0x29b7bf===null){_0x3ab88a[_0xf61a('0x2c')](_0x3e1d2e);}else{if(_0x3e1d2e===0x1f4){_0x3ab88a[_0xf61a('0x2d')](_0x3e1d2e)[_0xf61a('0x38')](_0x29b7bf);}else{_0x3ab88a[_0xf61a('0x2d')](_0x3e1d2e)[_0xf61a('0x2f')](_0x29b7bf);}}});};exports[_0xf61a('0x85')]=function(_0x159109,_0x1b6a8f,_0x5062e4){var _0x1444e4={};var _0x2cfdc9={};var _0x4c9add;var _0x22bf97;return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x159109[_0xf61a('0x53')]['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x1b6a8f,null))['then'](function(_0x1862de){if(_0x1862de){_0x4c9add=_0x1862de;_0x2cfdc9[_0xf61a('0x41')]=_['keys'](db[_0xf61a('0x7f')]['rawAttributes']);_0x2cfdc9[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x159109[_0xf61a('0x42')]);_0x2cfdc9[_0xf61a('0x44')]=_['intersection'](_0x2cfdc9[_0xf61a('0x41')],_0x2cfdc9['query']);_0x1444e4[_0xf61a('0x47')]=_['intersection'](_0x2cfdc9[_0xf61a('0x41')],qs[_0xf61a('0x46')](_0x159109[_0xf61a('0x42')][_0xf61a('0x46')]));_0x1444e4[_0xf61a('0x47')]=_0x1444e4[_0xf61a('0x47')][_0xf61a('0x54')]?_0x1444e4[_0xf61a('0x47')]:_0x2cfdc9[_0xf61a('0x41')];_0x1444e4[_0xf61a('0x49')]=qs[_0xf61a('0x4a')](_0x159109[_0xf61a('0x42')][_0xf61a('0x4a')]);_0x1444e4[_0xf61a('0x4b')]=qs[_0xf61a('0x44')](_[_0xf61a('0x4c')](_0x159109['query'],_0x2cfdc9['filters']));if(_0x159109[_0xf61a('0x42')][_0xf61a('0x4d')]){_0x1444e4[_0xf61a('0x4b')]=_['merge'](_0x1444e4[_0xf61a('0x4b')],{'$or':_['map'](_0x1444e4['attributes'],function(_0x545c40){var _0x117574={};_0x117574[_0x545c40]={'$like':'%'+_0x159109['query']['filter']+'%'};return _0x117574;})});}_0x1444e4=_[_0xf61a('0x4e')]({},_0x1444e4,_0x159109['options']);return _0x4c9add[_0xf61a('0x85')](_0x1444e4);}})['then'](function(_0x39247){if(_0x39247){_0x22bf97=_0x39247[_0xf61a('0x54')];if(!_0x159109[_0xf61a('0x42')][_0xf61a('0x48')]('nolimit')){_0x1444e4[_0xf61a('0x31')]=qs[_0xf61a('0x31')](_0x159109[_0xf61a('0x42')][_0xf61a('0x31')]);_0x1444e4[_0xf61a('0x30')]=qs[_0xf61a('0x30')](_0x159109[_0xf61a('0x42')][_0xf61a('0x30')]);}return _0x4c9add[_0xf61a('0x85')](_0x1444e4);}})['then'](function(_0x3325ae){if(_0x3325ae){return _0x3325ae?{'count':_0x22bf97,'rows':_0x3325ae}:null;}})['then'](respondWithResult(_0x1b6a8f,null))[_0xf61a('0x2b')](handleError(_0x1b6a8f,null));};function Extension(_0x6367e1,_0xdb7544,_0x1eaaf9,_0x284392){this['context']=_0xf61a('0x86');this[_0xf61a('0x87')]=_0x6367e1[_0xf61a('0x88')];this[_0xf61a('0x89')]=_0x284392;this['type']='system';this[_0xf61a('0x8a')]=_0xf61a('0x8b');this[_0xf61a('0x63')]=_0x6367e1['id'];this[_0xf61a('0x82')]=_0xdb7544;this['appdata']=_0x1eaaf9;}function createExtensionsReciveFax(_0x43bae8){var _0x20d8ba=0x1;var _0x5cbd3c=[];_0x5cbd3c['push'](new Extension(_0x43bae8,_0x20d8ba,'',_0xf61a('0x8c')));_0x20d8ba+=0x1;_0x5cbd3c['push'](new Extension(_0x43bae8,_0x20d8ba,_0xf61a('0x8d'),_0xf61a('0x8e')));_0x20d8ba+=0x1;for(var _0x49d741 in _0x43bae8){if(_0x43bae8[_0xf61a('0x48')](_0x49d741)&&(_0x49d741===_0xf61a('0x8f')||_0x49d741===_0xf61a('0x88')||_0x49d741==='gateway'||_0x49d741===_0xf61a('0x90')||_0x49d741===_0xf61a('0x91')||_0x49d741==='maxrate'||_0x49d741===_0xf61a('0x92')||_0x49d741===_0xf61a('0x93')||_0x49d741===_0xf61a('0x94'))){_0x5cbd3c[_0xf61a('0x95')](new Extension(_0x43bae8,_0x20d8ba,_0xf61a('0x96')+_0x49d741+')='+_0x43bae8[_0x49d741],_0xf61a('0x8e')));_0x20d8ba+=0x1;}}_0x5cbd3c[_0xf61a('0x95')](new Extension(_0x43bae8,_0x20d8ba,'6',_0xf61a('0x97')));_0x20d8ba+=0x1;_0x5cbd3c[_0xf61a('0x95')](new Extension(_0x43bae8,_0x20d8ba,'/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',_0xf61a('0x98')));_0x20d8ba=0x0;return _0x5cbd3c;}exports['addAccountApplications']=function(_0x56c602,_0x29c7cf,_0x5b94a5){var _0x13b39c;return db[_0xf61a('0x7a')][_0xf61a('0x7b')](function(_0x2b1353){return db[_0xf61a('0x3c')]['create'](_0x56c602['body'],{'transaction':_0x2b1353})[_0xf61a('0x23')](function(_0x118da0){_0x13b39c=_0x118da0['get']({'plain':!![]});return db[_0xf61a('0x99')][_0xf61a('0x80')](createExtensionsReciveFax(_0x13b39c),{'transaction':_0x2b1353});});})[_0xf61a('0x23')](function(){return _0x13b39c;})[_0xf61a('0x23')](respondWithResult(_0x29c7cf,null))['catch'](handleError(_0x29c7cf,null));};exports['updateAccountApplications']=function(_0x469a28,_0x262bea,_0x3f4efd){var _0x27e4c1;return db[_0xf61a('0x7a')][_0xf61a('0x7b')](function(_0x15630d){return db[_0xf61a('0x3c')][_0xf61a('0x5f')](_0x469a28[_0xf61a('0x60')],{'where':{'id':_0x469a28[_0xf61a('0x60')]['id']},'transaction':_0x15630d})[_0xf61a('0x23')](function(_0x2ad819){return db[_0xf61a('0x99')]['destroy']({'where':{'FaxAccountId':_0x469a28['body']['id']},'transaction':_0x15630d})['then'](function(_0x34b418){return db[_0xf61a('0x99')][_0xf61a('0x80')](createExtensionsReciveFax(_[_0xf61a('0x9a')](_0x469a28[_0xf61a('0x60')],['tech',_0xf61a('0x40'),_0xf61a('0x9b'),_0xf61a('0x9c'),'TrunkId','ListId'])),{'transaction':_0x15630d});});});})['then'](function(){return db[_0xf61a('0x3c')][_0xf61a('0x9d')](_0x469a28[_0xf61a('0x60')]['id']);})[_0xf61a('0x23')](respondWithResult(_0x262bea,null))['catch'](handleError(_0x262bea,null));};exports['getMessages']=function(_0x4a8843,_0x5f3d62,_0x2ea13d){var _0x14c281={'raw':!![],'where':{}};var _0xc1d7f6={};var _0x199c57={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf61a('0x65')]({'where':{'id':_0x4a8843[_0xf61a('0x53')]['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x5f3d62,null))[_0xf61a('0x23')](function(_0x16da93){if(_0x16da93){_0xc1d7f6[_0xf61a('0x41')]=_[_0xf61a('0x43')](db[_0xf61a('0x9e')][_0xf61a('0x3d')]);_0xc1d7f6[_0xf61a('0x42')]=_[_0xf61a('0x43')](_0x4a8843['query']);_0xc1d7f6[_0xf61a('0x44')]=_['intersection'](_0xc1d7f6['model'],_0xc1d7f6['query']);_0x14c281['attributes']=_[_0xf61a('0x45')](_0xc1d7f6['model'],qs[_0xf61a('0x46')](_0x4a8843[_0xf61a('0x42')][_0xf61a('0x46')]));_0x14c281['attributes']=_0x14c281[_0xf61a('0x47')]['length']?_0x14c281[_0xf61a('0x47')]:_0xc1d7f6[_0xf61a('0x41')];if(!_0x4a8843[_0xf61a('0x42')]['hasOwnProperty']('nolimit')){_0x14c281[_0xf61a('0x31')]=qs[_0xf61a('0x31')](_0x4a8843[_0xf61a('0x42')][_0xf61a('0x31')]);_0x14c281['offset']=qs['offset'](_0x4a8843[_0xf61a('0x42')]['offset']);}_0x14c281[_0xf61a('0x49')]=qs['sort'](_0x4a8843['query'][_0xf61a('0x4a')]);_0x14c281['where']=qs[_0xf61a('0x44')](_['pick'](_0x4a8843[_0xf61a('0x42')],_0xc1d7f6['filters']));_0x14c281[_0xf61a('0x4b')]['FaxAccountId']=_0x16da93['id'];if(_0x4a8843[_0xf61a('0x42')][_0xf61a('0x4d')]){_0x14c281['where']=_['merge'](_0x14c281[_0xf61a('0x4b')],{'$or':_[_0xf61a('0x3b')](_0x14c281[_0xf61a('0x47')],function(_0x18363b){var _0x4852e0={};_0x4852e0[_0x18363b]={'$like':'%'+_0x4a8843[_0xf61a('0x42')][_0xf61a('0x4d')]+'%'};return _0x4852e0;})});}if(_0x4a8843[_0xf61a('0x42')][_0xf61a('0x9f')]){var _0x11e56b=_0x4a8843[_0xf61a('0x42')]['$gte']['split'](',');var _0x16f13f={};_0x16f13f[_0x11e56b[0x0]]={'$gte':moment(_0x11e56b[0x1])[_0xf61a('0xa0')](_0xf61a('0xa1'))};_0x14c281[_0xf61a('0x4b')]=_[_0xf61a('0x4e')](_0x14c281[_0xf61a('0x4b')],_0x16f13f);}_0x14c281=_[_0xf61a('0x4e')]({},_0x14c281,_0x4a8843['options']);return db[_0xf61a('0x9e')][_0xf61a('0x32')]({'where':_0x14c281[_0xf61a('0x4b')]})[_0xf61a('0x23')](function(_0x5b2af6){_0x199c57[_0xf61a('0x32')]=_0x5b2af6;if(_0x4a8843[_0xf61a('0x42')][_0xf61a('0x55')]){_0x14c281[_0xf61a('0x51')]=[{'all':!![]}];}return db[_0xf61a('0x9e')][_0xf61a('0x68')](_0x14c281);})[_0xf61a('0x23')](function(_0x5c000e){_0x199c57['rows']=_0x5c000e;return _0x199c57;});}})['then'](respondWithFilteredResult(_0x5f3d62,_0x14c281))[_0xf61a('0x2b')](handleError(_0x5f3d62,null));};exports[_0xf61a('0x38')]=function(_0x42b7a1,_0x342c5c,_0x294f43){var _0x2a524b,_0x565539={},_0x11774d;if(_0x42b7a1[_0xf61a('0x60')]['to']){_0x11774d=_0x42b7a1[_0xf61a('0x60')]['to'][0x0];}return db['FaxAccount'][_0xf61a('0x56')]({'where':{'id':_0x42b7a1['params']['id']},'include':[{'model':db[_0xf61a('0xa2')],'as':'List','include':[{'model':db[_0xf61a('0x72')],'as':_0xf61a('0xa3'),'where':{'fax':_0x11774d},'limit':0x1,'order':[['updatedAt',_0xf61a('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x342c5c,null))[_0xf61a('0x23')](function(_0x391dd1){_0x2a524b=_0x391dd1;if(_0x42b7a1['body'][_0xf61a('0xa5')]&&_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][_0xf61a('0x54')]){for(var _0x59456c=0x0;_0x59456c<_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][_0xf61a('0x54')];_0x59456c+=0x1){_0x42b7a1['body'][_0xf61a('0xa5')][_0x59456c]={'filename':_0x42b7a1[_0xf61a('0x60')]['attachments'][_0x59456c][_0xf61a('0x37')],'id':_0x42b7a1['body'][_0xf61a('0xa5')][_0x59456c]['id'],'path':path['join'](config['root'],_0xf61a('0xa6'),_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][_0x59456c][_0xf61a('0xa7')])};}}return respondWithRpcPromise(_0xf61a('0xa8'),'CheckAfterSend',{'FaxAccountId':_[_0xf61a('0xa9')](_0x42b7a1[_0xf61a('0x53')]['id'])?undefined:_0x42b7a1[_0xf61a('0x53')]['id'],'path':_['isNil'](_0x42b7a1['body'][_0xf61a('0xa5')][0x0][_0xf61a('0x7')])?undefined:_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][0x0]['path'],'fax':_['isNil'](_0x42b7a1[_0xf61a('0x60')]['to'][0x0])?undefined:_0x42b7a1[_0xf61a('0x60')]['to'][0x0]},client9002);})[_0xf61a('0x23')](function(){if(_0x2a524b){if(_[_0xf61a('0xa9')](_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xaa')])){_0x42b7a1[_0xf61a('0x60')]['from']=util[_0xf61a('0xa0')](_0xf61a('0xab'),_0x2a524b[_0xf61a('0x37')],_0x2a524b[_0xf61a('0xac')]);}if(_0x2a524b[_0xf61a('0xad')]){if(_0x2a524b[_0xf61a('0xad')][_0xf61a('0xa3')][_0xf61a('0x54')]){return _0x2a524b[_0xf61a('0xad')]['Contacts'][0x0];}else{return db['CmContact'][_0xf61a('0x57')](_[_0xf61a('0x1b')](_0x42b7a1['body'],{'firstName':_0x42b7a1[_0xf61a('0x60')]['to'][0x0],'phone':_0x42b7a1[_0xf61a('0x60')]['to'][0x0],'fax':_0x42b7a1['body']['to'][0x0],'ListId':_0x2a524b[_0xf61a('0xae')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf61a('0xaf'));}})['then'](function(_0x1d1240){if(_0x1d1240){return db['FaxInteraction'][_0xf61a('0x56')]({'where':{'ContactId':_0x1d1240['id'],'closed':![],'FaxAccountId':_0x2a524b['id']}})[_0xf61a('0x23')](function(_0x3fd48b){if(_0x3fd48b){return[_0x3fd48b,![]];}return db[_0xf61a('0x71')][_0xf61a('0x57')]({'UserId':_0x42b7a1['user']['id'],'ContactId':_0x1d1240['id'],'FaxAccountId':_0x2a524b['id'],'fax':_0x42b7a1[_0xf61a('0x60')]['to'][0x0],'firstMsgDirection':_0xf61a('0xb0'),'Messages':[_[_0xf61a('0x4e')](_0x42b7a1[_0xf61a('0x60')],{'read':![],'body':_0x42b7a1['body']['attachments'][0x0][_0xf61a('0xb1')],'FaxAccountId':_0x2a524b['id'],'UserId':_0x42b7a1[_0xf61a('0x58')]['id'],'ContactId':_0x1d1240['id'],'AttachmentId':_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x5d993e){return[_0x5d993e,!![]];});});}else{throw new Error(_0xf61a('0xb2'));}})[_0xf61a('0xb3')](function(_0x30cd4a,_0xfec442){if(_0xfec442){return _0x30cd4a;}return db[_0xf61a('0x9e')][_0xf61a('0x57')]({'direction':'out','read':![],'body':_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][0x0][_0xf61a('0xb1')],'FaxAccountId':_0x2a524b['id'],'FaxInteractionId':_0x30cd4a['id'],'UserId':_0x42b7a1['user']['id'],'ContactId':_0x30cd4a[_0xf61a('0xb4')],'AttachmentId':_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][0x0]['id']})[_0xf61a('0x23')](function(_0x82d928){_0x30cd4a['dataValues'][_0xf61a('0xb5')]=[];_0x30cd4a[_0xf61a('0xb6')][_0xf61a('0xb5')][_0xf61a('0x95')](_0x82d928['dataValues']);return _0x30cd4a;});})['then'](function(_0x1d7eaa){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x42b7a1[_0xf61a('0x53')]['id'])?undefined:_0x42b7a1[_0xf61a('0x53')]['id'],'path':_[_0xf61a('0xa9')](_0x42b7a1['body'][_0xf61a('0xa5')][0x0][_0xf61a('0x7')])?undefined:_0x42b7a1[_0xf61a('0x60')]['attachments'][0x0]['path'],'fax':_[_0xf61a('0xa9')](_0x42b7a1['body']['to'][0x0])?undefined:_0x42b7a1[_0xf61a('0x60')]['to'][0x0],'AttachmentId':_0x42b7a1[_0xf61a('0x60')][_0xf61a('0xa5')][0x0]['id']},client9002)[_0xf61a('0x23')](function(_0x4d9003){logger['info'](_0xf61a('0xb7'),_0x4d9003);})['catch'](function(_0x58f23a){logger[_0xf61a('0x24')](_0xf61a('0xb7'),_0x58f23a);});return _0x1d7eaa;})[_0xf61a('0x23')](respondWithResult(_0x342c5c,null))[_0xf61a('0x2b')](handleError(_0x342c5c,null));};exports['addAgents']=function(_0x48cbae,_0x29dab3,_0x4d075c){return db['FaxAccount']['find']({'where':{'id':_0x48cbae[_0xf61a('0x53')]['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x29dab3,null))[_0xf61a('0x23')](function(_0x2e2e9b){if(_0x2e2e9b){return _0x2e2e9b[_0xf61a('0xb8')](_0x48cbae[_0xf61a('0x60')][_0xf61a('0x6b')],_['omit'](_0x48cbae['body'],[_0xf61a('0x6b'),'id'])||{})['spread'](function(_0x7bd335){for(var _0x2d0a4a=0x0;_0x2d0a4a<_0x48cbae[_0xf61a('0x60')]['ids'][_0xf61a('0x54')];_0x2d0a4a+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x48cbae[_0xf61a('0x60')]['ids'][_0x2d0a4a]),'FaxAccountId':Number(_0x48cbae[_0xf61a('0x53')]['id'])});}return _0x7bd335;});}})['then'](respondWithResult(_0x29dab3,null))[_0xf61a('0x2b')](handleError(_0x29dab3,null));};exports[_0xf61a('0xb9')]=function(_0x45199a,_0x11af40,_0x4d72d2){return db[_0xf61a('0x3c')][_0xf61a('0x56')]({'where':{'id':_0x45199a['params']['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x11af40,null))[_0xf61a('0x23')](function(_0x3c078f){if(_0x3c078f){return _0x3c078f[_0xf61a('0xb9')](_0x45199a[_0xf61a('0x42')][_0xf61a('0x6b')])['then'](function(){if(_[_0xf61a('0xba')](_0x45199a['query']['ids'])){for(var _0x5de552=0x0;_0x5de552<_0x45199a[_0xf61a('0x42')][_0xf61a('0x6b')][_0xf61a('0x54')];_0x5de552+=0x1){socket[_0xf61a('0xbb')](_0xf61a('0xbc'),{'UserId':Number(_0x45199a[_0xf61a('0x42')]['ids'][_0x5de552]),'FaxAccountId':Number(_0x45199a[_0xf61a('0x53')]['id'])});}}else{socket[_0xf61a('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x45199a[_0xf61a('0x42')]['ids']),'FaxAccountId':Number(_0x45199a[_0xf61a('0x53')]['id'])});}});}})[_0xf61a('0x23')](respondWithStatusCode(_0x11af40,null))[_0xf61a('0x2b')](handleError(_0x11af40,null));};exports['getAgents']=function(_0x240765,_0x1eff00,_0xec78ce){var _0x7dc0a={};var _0x3000a0={};var _0x172051;var _0x19d05e;return db[_0xf61a('0x3c')][_0xf61a('0x65')]({'where':{'id':_0x240765['params']['id']}})[_0xf61a('0x23')](handleEntityNotFound(_0x1eff00,null))[_0xf61a('0x23')](function(_0x20108f){if(_0x20108f){_0x172051=_0x20108f;_0x3000a0[_0xf61a('0x41')]=_[_0xf61a('0x43')](db[_0xf61a('0x73')][_0xf61a('0x3d')]);_0x3000a0['query']=_['keys'](_0x240765[_0xf61a('0x42')]);_0x3000a0[_0xf61a('0x44')]=_[_0xf61a('0x45')](_0x3000a0['model'],_0x3000a0[_0xf61a('0x42')]);_0x7dc0a[_0xf61a('0x47')]=_['intersection'](_0x3000a0['model'],qs[_0xf61a('0x46')](_0x240765[_0xf61a('0x42')]['fields']));_0x7dc0a[_0xf61a('0x47')]=_0x7dc0a[_0xf61a('0x47')][_0xf61a('0x54')]?_0x7dc0a[_0xf61a('0x47')]:_0x3000a0['model'];_0x7dc0a[_0xf61a('0x49')]=qs['sort'](_0x240765[_0xf61a('0x42')]['sort']);_0x7dc0a['where']=qs[_0xf61a('0x44')](_[_0xf61a('0x4c')](_0x240765[_0xf61a('0x42')],_0x3000a0[_0xf61a('0x44')]));if(_0x240765[_0xf61a('0x42')]['filter']){_0x7dc0a[_0xf61a('0x4b')]=_[_0xf61a('0x4e')](_0x7dc0a[_0xf61a('0x4b')],{'$or':_[_0xf61a('0x3b')](_0x7dc0a[_0xf61a('0x47')],function(_0x2705bd){var _0x4e6281={};_0x4e6281[_0x2705bd]={'$like':'%'+_0x240765[_0xf61a('0x42')][_0xf61a('0x4d')]+'%'};return _0x4e6281;})});}_0x7dc0a=_['merge']({},_0x7dc0a,_0x240765[_0xf61a('0x50')]);return _0x172051['getAgents'](_0x7dc0a);}})[_0xf61a('0x23')](function(_0xb3b543){if(_0xb3b543){_0x19d05e=_0xb3b543[_0xf61a('0x54')];if(!_0x240765['query'][_0xf61a('0x48')](_0xf61a('0x67'))){_0x7dc0a[_0xf61a('0x31')]=qs[_0xf61a('0x31')](_0x240765[_0xf61a('0x42')][_0xf61a('0x31')]);_0x7dc0a[_0xf61a('0x30')]=qs[_0xf61a('0x30')](_0x240765[_0xf61a('0x42')][_0xf61a('0x30')]);}return _0x172051[_0xf61a('0xbd')](_0x7dc0a);}})[_0xf61a('0x23')](function(_0x552b05){if(_0x552b05){return _0x552b05?{'count':_0x19d05e,'rows':_0x552b05}:null;}})[_0xf61a('0x23')](respondWithResult(_0x1eff00,null))[_0xf61a('0x2b')](handleError(_0x1eff00,null));}; \ No newline at end of file +var _0xf986=['show','params','length','include','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','order','pick','FaxAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','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','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','CmList','List','updatedAt','attachments','join','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','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/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf986,0x12e));var _0x6f98=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf986[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6f98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f98('0x1'));var jsonpatch=require(_0x6f98('0x2'));var rp=require(_0x6f98('0x3'));var moment=require(_0x6f98('0x4'));var BPromise=require(_0x6f98('0x5'));var Mustache=require(_0x6f98('0x6'));var util=require(_0x6f98('0x7'));var path=require(_0x6f98('0x8'));var sox=require(_0x6f98('0x9'));var csv=require(_0x6f98('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f98('0xb'));var _=require(_0x6f98('0xc'));var squel=require(_0x6f98('0xd'));var crypto=require(_0x6f98('0xe'));var jsforce=require(_0x6f98('0xf'));var deskjs=require(_0x6f98('0x10'));var toCsv=require(_0x6f98('0xa'));var querystring=require(_0x6f98('0x11'));var Papa=require(_0x6f98('0x12'));var Redis=require(_0x6f98('0x13'));var authService=require(_0x6f98('0x14'));var qs=require(_0x6f98('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f98('0x16'));var logger=require('../../config/logger')(_0x6f98('0x17'));var utils=require('../../config/utils');var config=require(_0x6f98('0x18'));var licenseUtil=require(_0x6f98('0x19'));var db=require(_0x6f98('0x1a'))['db'];config[_0x6f98('0x1b')]=_[_0x6f98('0x1c')](config[_0x6f98('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f98('0x1d'))(new Redis(config[_0x6f98('0x1b')]));require(_0x6f98('0x1e'))[_0x6f98('0x1f')](socket);var jayson=require(_0x6f98('0x20'));var client=jayson[_0x6f98('0x21')][_0x6f98('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x6f98('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1afbcc,_0x5abea2,_0x75576c,_0x33f272){return new BPromise(function(_0x3675e9,_0x27c48b){var _0x3ec5f7=_0x33f272||client;return _0x3ec5f7[_0x6f98('0x23')](_0x1afbcc,_0x75576c)[_0x6f98('0x24')](function(_0x4c1047){logger[_0x6f98('0x25')](_0x6f98('0x26'),_0x5abea2,'request\x20sent');logger[_0x6f98('0x27')](_0x6f98('0x28'),_0x5abea2,_0x6f98('0x29'),JSON['stringify'](_0x4c1047));if(_0x4c1047['error']){if(_0x4c1047[_0x6f98('0x2a')]['code']===0x1f4){logger[_0x6f98('0x2a')](_0x6f98('0x26'),_0x5abea2,_0x4c1047[_0x6f98('0x2a')][_0x6f98('0x2b')]);return _0x27c48b(_0x4c1047[_0x6f98('0x2a')]['message']);}logger[_0x6f98('0x2a')](_0x6f98('0x26'),_0x5abea2,_0x4c1047[_0x6f98('0x2a')][_0x6f98('0x2b')]);return _0x3675e9(_0x4c1047[_0x6f98('0x2a')][_0x6f98('0x2b')]);}else{logger[_0x6f98('0x25')](_0x6f98('0x26'),_0x5abea2,'request\x20sent');_0x3675e9(_0x4c1047[_0x6f98('0x2c')][_0x6f98('0x2b')]);}})[_0x6f98('0x2d')](function(_0x247994){logger[_0x6f98('0x2a')](_0x6f98('0x26'),_0x5abea2,_0x247994);_0x27c48b(_0x247994);});});}function respondWithStatusCode(_0x453eb3,_0x5e6d5d){_0x5e6d5d=_0x5e6d5d||0xcc;return function(_0x389b16){if(_0x389b16){return _0x453eb3[_0x6f98('0x2e')](_0x5e6d5d);}return _0x453eb3[_0x6f98('0x2f')](_0x5e6d5d)['end']();};}function respondWithResult(_0x19bf8e,_0x3e5e30){_0x3e5e30=_0x3e5e30||0xc8;return function(_0x4008f7){if(_0x4008f7){return _0x19bf8e[_0x6f98('0x2f')](_0x3e5e30)[_0x6f98('0x30')](_0x4008f7);}};}function respondWithFilteredResult(_0x3771db,_0xa8b66){return function(_0x53dd4b){if(_0x53dd4b){var _0x1bc6bc=typeof _0xa8b66[_0x6f98('0x31')]===_0x6f98('0x32')&&typeof _0xa8b66['limit']===_0x6f98('0x32');var _0x3a0602=_0x53dd4b[_0x6f98('0x33')];var _0x1d1a33=_0x1bc6bc?0x0:_0xa8b66[_0x6f98('0x31')];var _0x9b3a72=_0x1bc6bc?_0x53dd4b[_0x6f98('0x33')]:_0xa8b66[_0x6f98('0x31')]+_0xa8b66['limit'];var _0x250a07;if(_0x9b3a72>=_0x3a0602){_0x9b3a72=_0x3a0602;_0x250a07=0xc8;}else{_0x250a07=0xce;}_0x3771db[_0x6f98('0x2f')](_0x250a07);return _0x3771db[_0x6f98('0x34')](_0x6f98('0x35'),_0x1d1a33+'-'+_0x9b3a72+'/'+_0x3a0602)['json'](_0x53dd4b);}return null;};}function patchUpdates(_0x404ec6){return function(_0x5bce0c){try{jsonpatch[_0x6f98('0x36')](_0x5bce0c,_0x404ec6,!![]);}catch(_0x3c3516){return BPromise[_0x6f98('0x37')](_0x3c3516);}return _0x5bce0c[_0x6f98('0x38')]();};}function saveUpdates(_0x1ad697,_0x3c6f85){return function(_0x1762cc){if(_0x1762cc){return _0x1762cc[_0x6f98('0x39')](_0x1ad697)[_0x6f98('0x24')](function(_0x1a999a){return _0x1a999a;});}return null;};}function removeEntity(_0x11ad64,_0x5c3b59){return function(_0x3ce529){if(_0x3ce529){return _0x3ce529[_0x6f98('0x3a')]()[_0x6f98('0x24')](function(){var _0x19fc80=_0x3ce529['get']({'plain':!![]});var _0x17e920=_0x6f98('0x3b');return db[_0x6f98('0x3c')][_0x6f98('0x3a')]({'where':{'type':_0x17e920,'resourceId':_0x19fc80['id']}})[_0x6f98('0x24')](function(){return _0x3ce529;});})[_0x6f98('0x24')](function(){_0x11ad64[_0x6f98('0x2f')](0xcc)[_0x6f98('0x3d')]();});}};}function handleEntityNotFound(_0x293c04,_0x415418){return function(_0x563ecc){if(!_0x563ecc){_0x293c04['sendStatus'](0x194);}return _0x563ecc;};}function handleError(_0x4af799,_0x2e8fa2){_0x2e8fa2=_0x2e8fa2||0x1f4;return function(_0x3f39a7){logger['error'](_0x3f39a7[_0x6f98('0x3e')]);if(_0x3f39a7[_0x6f98('0x3f')]){delete _0x3f39a7['name'];}_0x4af799[_0x6f98('0x2f')](_0x2e8fa2)[_0x6f98('0x40')](_0x3f39a7);};}exports[_0x6f98('0x41')]=function(_0x52436e,_0x2d60a0){var _0x3ce079={'include':[{'model':db[_0x6f98('0x42')],'as':_0x6f98('0x43')}]},_0x2f51a0={},_0x5ef1bd={'count':0x0,'rows':[]};var _0x2558d5=_[_0x6f98('0x44')](db[_0x6f98('0x45')][_0x6f98('0x46')],function(_0x16d7aa){return{'name':_0x16d7aa[_0x6f98('0x47')],'type':_0x16d7aa[_0x6f98('0x48')][_0x6f98('0x49')]};});_0x2f51a0[_0x6f98('0x4a')]=_['map'](_0x2558d5,_0x6f98('0x3f'));_0x2f51a0['query']=_[_0x6f98('0x4b')](_0x52436e[_0x6f98('0x4c')]);_0x2f51a0[_0x6f98('0x4d')]=_[_0x6f98('0x4e')](_0x2f51a0[_0x6f98('0x4a')],_0x2f51a0[_0x6f98('0x4c')]);_0x3ce079['attributes']=_['intersection'](_0x2f51a0['model'],qs[_0x6f98('0x4f')](_0x52436e[_0x6f98('0x4c')]['fields']));_0x3ce079[_0x6f98('0x50')]=_0x3ce079['attributes']['length']?_0x3ce079[_0x6f98('0x50')]:_0x2f51a0[_0x6f98('0x4a')];if(!_0x52436e[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x3ce079[_0x6f98('0x53')]=qs['limit'](_0x52436e['query']['limit']);_0x3ce079[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x52436e[_0x6f98('0x4c')][_0x6f98('0x31')]);}_0x3ce079['order']=qs[_0x6f98('0x54')](_0x52436e[_0x6f98('0x4c')][_0x6f98('0x54')]);_0x3ce079[_0x6f98('0x55')]=qs[_0x6f98('0x4d')](_['pick'](_0x52436e['query'],_0x2f51a0[_0x6f98('0x4d')]),_0x2558d5);if(_0x52436e[_0x6f98('0x4c')][_0x6f98('0x56')]){_0x3ce079[_0x6f98('0x55')]=_[_0x6f98('0x57')](_0x3ce079['where'],{'$or':_[_0x6f98('0x44')](_0x2558d5,function(_0x209382){if(_0x209382[_0x6f98('0x48')]!==_0x6f98('0x58')){var _0xd32252={};_0xd32252[_0x209382[_0x6f98('0x3f')]]={'$like':'%'+_0x52436e[_0x6f98('0x4c')][_0x6f98('0x56')]+'%'};return _0xd32252;}})});}_0x3ce079=_[_0x6f98('0x57')]({},_0x3ce079,_0x52436e[_0x6f98('0x59')]);var _0x48b8f7={'where':_0x3ce079['where']};return db[_0x6f98('0x45')][_0x6f98('0x33')](_0x48b8f7)[_0x6f98('0x24')](function(_0x2f0ee5){_0x5ef1bd['count']=_0x2f0ee5;if(_0x52436e['query']['includeAll']){_0x3ce079['include']=[{'all':!![]}];}return db[_0x6f98('0x45')][_0x6f98('0x5a')](_0x3ce079);})[_0x6f98('0x24')](function(_0x5766f4){_0x5ef1bd[_0x6f98('0x5b')]=_0x5766f4;return _0x5ef1bd;})[_0x6f98('0x24')](respondWithFilteredResult(_0x2d60a0,_0x3ce079))[_0x6f98('0x2d')](handleError(_0x2d60a0,null));};exports[_0x6f98('0x5c')]=function(_0x57ec02,_0x11a2fa){var _0x28051b={'raw':![],'where':{'id':_0x57ec02[_0x6f98('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x6f98('0x43')}]},_0x17e31c={};_0x17e31c['model']=_[_0x6f98('0x4b')](db['FaxAccount']['rawAttributes']);_0x17e31c[_0x6f98('0x4c')]=_['keys'](_0x57ec02[_0x6f98('0x4c')]);_0x17e31c[_0x6f98('0x4d')]=_['intersection'](_0x17e31c['model'],_0x17e31c['query']);_0x28051b[_0x6f98('0x50')]=_[_0x6f98('0x4e')](_0x17e31c['model'],qs[_0x6f98('0x4f')](_0x57ec02[_0x6f98('0x4c')]['fields']));_0x28051b[_0x6f98('0x50')]=_0x28051b['attributes'][_0x6f98('0x5e')]?_0x28051b[_0x6f98('0x50')]:_0x17e31c['model'];if(_0x57ec02[_0x6f98('0x4c')]['includeAll']){_0x28051b[_0x6f98('0x5f')]=[{'all':!![]}];}_0x28051b=_[_0x6f98('0x57')]({},_0x28051b,_0x57ec02['options']);return db[_0x6f98('0x45')][_0x6f98('0x60')](_0x28051b)[_0x6f98('0x24')](handleEntityNotFound(_0x11a2fa,null))['then'](respondWithResult(_0x11a2fa,null))[_0x6f98('0x2d')](handleError(_0x11a2fa,null));};exports[_0x6f98('0x61')]=function(_0x43b3fb,_0x4bb63f){return db[_0x6f98('0x45')]['create'](_0x43b3fb[_0x6f98('0x62')],{})[_0x6f98('0x24')](function(_0x57eaea){var _0x368c2c=_0x43b3fb[_0x6f98('0x63')][_0x6f98('0x64')]({'plain':!![]});if(!_0x368c2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x368c2c[_0x6f98('0x65')]==='user'){var _0x5e5387=_0x57eaea[_0x6f98('0x64')]({'plain':!![]});var _0x55d6b8=_0x6f98('0x3b');return db['UserProfileSection'][_0x6f98('0x60')]({'where':{'name':_0x55d6b8,'userProfileId':_0x368c2c[_0x6f98('0x66')]},'raw':!![]})['then'](function(_0x149ba6){if(_0x149ba6&&_0x149ba6[_0x6f98('0x67')]===0x0){return db[_0x6f98('0x3c')][_0x6f98('0x61')]({'name':_0x5e5387[_0x6f98('0x3f')],'resourceId':_0x5e5387['id'],'type':_0x149ba6[_0x6f98('0x3f')],'sectionId':_0x149ba6['id']},{})['then'](function(){return _0x57eaea;});}else{return _0x57eaea;}})['catch'](function(_0x41fbac){logger['error'](_0x6f98('0x68'),_0x41fbac);throw _0x41fbac;});}return _0x57eaea;})[_0x6f98('0x24')](respondWithResult(_0x4bb63f,0xc9))[_0x6f98('0x2d')](handleError(_0x4bb63f,null));};exports[_0x6f98('0x39')]=function(_0x39174e,_0x40a250){if(_0x39174e[_0x6f98('0x62')]['id']){delete _0x39174e[_0x6f98('0x62')]['id'];}return db[_0x6f98('0x45')][_0x6f98('0x60')]({'where':{'id':_0x39174e['params']['id']},'include':[{'model':db[_0x6f98('0x42')],'as':_0x6f98('0x43')}]})['then'](handleEntityNotFound(_0x40a250,null))[_0x6f98('0x24')](saveUpdates(_0x39174e[_0x6f98('0x62')],null))[_0x6f98('0x24')](respondWithResult(_0x40a250,null))['catch'](handleError(_0x40a250,null));};exports[_0x6f98('0x3a')]=function(_0x4d4a06,_0x154be6){return db[_0x6f98('0x45')][_0x6f98('0x60')]({'where':{'id':_0x4d4a06['params']['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x154be6,null))[_0x6f98('0x24')](removeEntity(_0x154be6,null))[_0x6f98('0x2d')](handleError(_0x154be6,null));};exports[_0x6f98('0x69')]=function(_0x5d2771,_0x637e6b){return db[_0x6f98('0x45')]['describe']()[_0x6f98('0x24')](respondWithResult(_0x637e6b,null))[_0x6f98('0x2d')](handleError(_0x637e6b,null));};exports['addDisposition']=function(_0x44341c,_0x384586,_0x10c5db){if(_0x44341c['body']['id']){delete _0x44341c[_0x6f98('0x62')]['id'];}return db['FaxAccount'][_0x6f98('0x60')]({'where':{'id':_0x44341c['params']['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x384586,null))[_0x6f98('0x24')](function(_0x4be54f){if(_0x4be54f){_0x44341c[_0x6f98('0x62')]['FaxAccountId']=_0x4be54f['id'];return db[_0x6f98('0x6a')][_0x6f98('0x61')](_0x44341c[_0x6f98('0x62')]);}})[_0x6f98('0x24')](respondWithResult(_0x384586,null))[_0x6f98('0x2d')](handleError(_0x384586,null));};exports[_0x6f98('0x6b')]=function(_0x54b8b5,_0x474811,_0x1b9a32){var _0x29df73={'raw':![],'where':{}};var _0x138df8={};var _0x37ab5b={'count':0x0,'rows':[]};return db[_0x6f98('0x45')][_0x6f98('0x6c')]({'where':{'id':_0x54b8b5[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x474811,null))[_0x6f98('0x24')](function(_0x502b95){if(_0x502b95){_0x138df8[_0x6f98('0x4a')]=_['keys'](db['Disposition'][_0x6f98('0x46')]);_0x138df8[_0x6f98('0x4c')]=_[_0x6f98('0x4b')](_0x54b8b5['query']);_0x138df8['filters']=_[_0x6f98('0x4e')](_0x138df8[_0x6f98('0x4a')],_0x138df8[_0x6f98('0x4c')]);_0x29df73[_0x6f98('0x50')]=_[_0x6f98('0x4e')](_0x138df8['model'],qs[_0x6f98('0x4f')](_0x54b8b5[_0x6f98('0x4c')][_0x6f98('0x4f')]));_0x29df73[_0x6f98('0x50')]=_0x29df73['attributes'][_0x6f98('0x5e')]?_0x29df73['attributes']:_0x138df8[_0x6f98('0x4a')];if(!_0x54b8b5[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x29df73[_0x6f98('0x53')]=qs['limit'](_0x54b8b5[_0x6f98('0x4c')][_0x6f98('0x53')]);_0x29df73[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x54b8b5['query']['offset']);}_0x29df73[_0x6f98('0x6d')]=qs['sort'](_0x54b8b5[_0x6f98('0x4c')][_0x6f98('0x54')]);_0x29df73[_0x6f98('0x55')]=qs[_0x6f98('0x4d')](_[_0x6f98('0x6e')](_0x54b8b5[_0x6f98('0x4c')],_0x138df8[_0x6f98('0x4d')]));_0x29df73[_0x6f98('0x55')][_0x6f98('0x6f')]=_0x502b95['id'];if(_0x54b8b5[_0x6f98('0x4c')]['filter']){_0x29df73['where']=_[_0x6f98('0x57')](_0x29df73['where'],{'$or':_[_0x6f98('0x44')](_0x29df73[_0x6f98('0x50')],function(_0x5eb133){var _0x3a9d60={};_0x3a9d60[_0x5eb133]={'$like':'%'+_0x54b8b5['query'][_0x6f98('0x56')]+'%'};return _0x3a9d60;})});}_0x29df73=_[_0x6f98('0x57')]({},_0x29df73,_0x54b8b5['options']);return db[_0x6f98('0x6a')]['count']({'where':_0x29df73[_0x6f98('0x55')]})[_0x6f98('0x24')](function(_0x3fb3d2){_0x37ab5b[_0x6f98('0x33')]=_0x3fb3d2;if(_0x54b8b5[_0x6f98('0x4c')][_0x6f98('0x70')]){_0x29df73[_0x6f98('0x5f')]=[{'all':!![]}];}return db[_0x6f98('0x6a')][_0x6f98('0x5a')](_0x29df73);})['then'](function(_0x27923f){_0x37ab5b[_0x6f98('0x5b')]=_0x27923f;return _0x37ab5b;});}})['then'](respondWithFilteredResult(_0x474811,_0x29df73))[_0x6f98('0x2d')](handleError(_0x474811,null));};exports['removeDispositions']=function(_0x526b27,_0x46e7e2,_0x2645f0){return db['FaxAccount'][_0x6f98('0x60')]({'where':{'id':_0x526b27[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x46e7e2,null))['then'](function(_0x4e7b44){if(_0x4e7b44){return _0x4e7b44[_0x6f98('0x71')](_0x526b27['query'][_0x6f98('0x72')]);}})[_0x6f98('0x24')](respondWithStatusCode(_0x46e7e2,null))[_0x6f98('0x2d')](handleError(_0x46e7e2,null));};exports[_0x6f98('0x73')]=function(_0x4d27fd,_0x57e507,_0x53b8f3){if(_0x4d27fd[_0x6f98('0x62')]['id']){delete _0x4d27fd['body']['id'];}return db[_0x6f98('0x45')][_0x6f98('0x60')]({'where':{'id':_0x4d27fd[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x57e507,null))[_0x6f98('0x24')](function(_0x9b3b1c){if(_0x9b3b1c){_0x4d27fd[_0x6f98('0x62')][_0x6f98('0x6f')]=_0x9b3b1c['id'];return db[_0x6f98('0x74')][_0x6f98('0x61')](_0x4d27fd['body']);}})[_0x6f98('0x24')](respondWithResult(_0x57e507,null))['catch'](handleError(_0x57e507,null));};exports[_0x6f98('0x75')]=function(_0x45a379,_0x410b2,_0x164a05){var _0x454b3e={'raw':![],'where':{}};var _0xf45aaa={};var _0x537881={'count':0x0,'rows':[]};return db[_0x6f98('0x45')][_0x6f98('0x6c')]({'where':{'id':_0x45a379['params']['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x410b2,null))[_0x6f98('0x24')](function(_0x3cbdd8){if(_0x3cbdd8){_0xf45aaa[_0x6f98('0x4a')]=_[_0x6f98('0x4b')](db['CannedAnswer'][_0x6f98('0x46')]);_0xf45aaa[_0x6f98('0x4c')]=_[_0x6f98('0x4b')](_0x45a379['query']);_0xf45aaa['filters']=_[_0x6f98('0x4e')](_0xf45aaa['model'],_0xf45aaa[_0x6f98('0x4c')]);_0x454b3e['attributes']=_['intersection'](_0xf45aaa[_0x6f98('0x4a')],qs[_0x6f98('0x4f')](_0x45a379[_0x6f98('0x4c')]['fields']));_0x454b3e[_0x6f98('0x50')]=_0x454b3e[_0x6f98('0x50')][_0x6f98('0x5e')]?_0x454b3e[_0x6f98('0x50')]:_0xf45aaa[_0x6f98('0x4a')];if(!_0x45a379[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x454b3e[_0x6f98('0x53')]=qs[_0x6f98('0x53')](_0x45a379[_0x6f98('0x4c')]['limit']);_0x454b3e[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x45a379[_0x6f98('0x4c')][_0x6f98('0x31')]);}_0x454b3e['order']=qs[_0x6f98('0x54')](_0x45a379['query']['sort']);_0x454b3e[_0x6f98('0x55')]=qs[_0x6f98('0x4d')](_[_0x6f98('0x6e')](_0x45a379['query'],_0xf45aaa[_0x6f98('0x4d')]));_0x454b3e[_0x6f98('0x55')]['FaxAccountId']=_0x3cbdd8['id'];if(_0x45a379['query']['filter']){_0x454b3e['where']=_[_0x6f98('0x57')](_0x454b3e['where'],{'$or':_[_0x6f98('0x44')](_0x454b3e['attributes'],function(_0x72b33){var _0x237060={};_0x237060[_0x72b33]={'$like':'%'+_0x45a379[_0x6f98('0x4c')][_0x6f98('0x56')]+'%'};return _0x237060;})});}_0x454b3e=_[_0x6f98('0x57')]({},_0x454b3e,_0x45a379[_0x6f98('0x59')]);return db[_0x6f98('0x74')][_0x6f98('0x33')]({'where':_0x454b3e['where']})[_0x6f98('0x24')](function(_0x5d60b7){_0x537881[_0x6f98('0x33')]=_0x5d60b7;if(_0x45a379[_0x6f98('0x4c')][_0x6f98('0x70')]){_0x454b3e[_0x6f98('0x5f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x454b3e);})[_0x6f98('0x24')](function(_0x4a24f2){_0x537881[_0x6f98('0x5b')]=_0x4a24f2;return _0x537881;});}})[_0x6f98('0x24')](respondWithFilteredResult(_0x410b2,_0x454b3e))[_0x6f98('0x2d')](handleError(_0x410b2,null));};exports[_0x6f98('0x76')]=function(_0x34ca21,_0x296740,_0x1559f7){return db[_0x6f98('0x45')][_0x6f98('0x60')]({'where':{'id':_0x34ca21[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x296740,null))[_0x6f98('0x24')](function(_0x4c3770){if(_0x4c3770){return _0x4c3770[_0x6f98('0x76')](_0x34ca21[_0x6f98('0x4c')][_0x6f98('0x72')]);}})[_0x6f98('0x24')](respondWithStatusCode(_0x296740,null))[_0x6f98('0x2d')](handleError(_0x296740,null));};exports[_0x6f98('0x77')]=function(_0x53ae95,_0x4e902c,_0xa675f4){return db[_0x6f98('0x78')][_0x6f98('0x60')]({'where':{'id':_0x53ae95[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x4e902c,null))['then'](function(_0x597735){if(_0x597735){return _0x597735[_0x6f98('0x77')](_0x53ae95[_0x6f98('0x62')][_0x6f98('0x72')],_[_0x6f98('0x79')](_0x53ae95[_0x6f98('0x62')],[_0x6f98('0x72'),'id'])||{});}})[_0x6f98('0x24')](respondWithResult(_0x4e902c,null))[_0x6f98('0x2d')](handleError(_0x4e902c,null));};exports['getInteractions']=function(_0x853658,_0x4c336b,_0xa20d2){var _0x2c3b49={'raw':![],'where':{}};var _0x58feb0={};var _0x43693d={'count':0x0,'rows':[]};return db[_0x6f98('0x45')][_0x6f98('0x6c')]({'where':{'id':_0x853658['params']['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x4c336b,null))[_0x6f98('0x24')](function(_0x43b808){if(_0x43b808){_0x58feb0[_0x6f98('0x4a')]=_[_0x6f98('0x4b')](db[_0x6f98('0x78')][_0x6f98('0x46')]);_0x58feb0[_0x6f98('0x4c')]=_[_0x6f98('0x4b')](_0x853658[_0x6f98('0x4c')]);_0x58feb0[_0x6f98('0x4d')]=_[_0x6f98('0x4e')](_0x58feb0[_0x6f98('0x4a')],_0x58feb0[_0x6f98('0x4c')]);_0x2c3b49[_0x6f98('0x50')]=_[_0x6f98('0x4e')](_0x58feb0['model'],qs[_0x6f98('0x4f')](_0x853658[_0x6f98('0x4c')][_0x6f98('0x4f')]));_0x2c3b49['attributes']=_0x2c3b49[_0x6f98('0x50')]['length']?_0x2c3b49[_0x6f98('0x50')]:_0x58feb0[_0x6f98('0x4a')];if(!_0x853658[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x2c3b49['limit']=qs[_0x6f98('0x53')](_0x853658[_0x6f98('0x4c')][_0x6f98('0x53')]);_0x2c3b49[_0x6f98('0x31')]=qs['offset'](_0x853658[_0x6f98('0x4c')]['offset']);}_0x2c3b49[_0x6f98('0x6d')]=qs['sort'](_0x853658['query'][_0x6f98('0x54')]);_0x2c3b49['where']=qs[_0x6f98('0x4d')](_[_0x6f98('0x6e')](_0x853658['query'],_0x58feb0[_0x6f98('0x4d')]));_0x2c3b49['where'][_0x6f98('0x6f')]=_0x43b808['id'];if(_0x853658[_0x6f98('0x4c')][_0x6f98('0x56')]){_0x2c3b49[_0x6f98('0x55')]=_[_0x6f98('0x57')](_0x2c3b49[_0x6f98('0x55')],{'$or':_[_0x6f98('0x44')](_0x2c3b49[_0x6f98('0x50')],function(_0x5cdf0f){var _0x1ea1f9={};_0x1ea1f9[_0x5cdf0f]={'$like':'%'+_0x853658[_0x6f98('0x4c')][_0x6f98('0x56')]+'%'};return _0x1ea1f9;})});}_0x2c3b49=_[_0x6f98('0x57')]({},_0x2c3b49,_0x853658['options']);return db[_0x6f98('0x78')][_0x6f98('0x33')]({'where':_0x2c3b49['where']})[_0x6f98('0x24')](function(_0xeeb338){_0x43693d[_0x6f98('0x33')]=_0xeeb338;if(_0x853658[_0x6f98('0x4c')][_0x6f98('0x70')]){_0x2c3b49[_0x6f98('0x5f')]=[{'model':db[_0x6f98('0x7a')],'as':'Contact','required':![]},{'model':db[_0x6f98('0x7b')],'as':_0x6f98('0x7c'),'attributes':['name',_0x6f98('0x7d'),'internal'],'required':![]},{'model':db[_0x6f98('0x7e')],'as':_0x6f98('0x7f'),'attributes':['id','name','color'],'where':_0x853658[_0x6f98('0x4c')][_0x6f98('0x80')]?{'id':_0x853658[_0x6f98('0x4c')]['tag']}:undefined,'required':_0x853658['query'][_0x6f98('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0x6f98('0x5a')](_0x2c3b49);})[_0x6f98('0x24')](function(_0x50df48){_0x43693d[_0x6f98('0x5b')]=_0x50df48;return _0x43693d;});}})[_0x6f98('0x24')](respondWithFilteredResult(_0x4c336b,_0x2c3b49))['catch'](handleError(_0x4c336b,null));};exports[_0x6f98('0x81')]=function(_0x33a778,_0x13b3d3){var _0x7769d4=_0x33a778[_0x6f98('0x5d')]['id'];var _0x37cc97=_0x33a778[_0x6f98('0x62')];var _0x36a5e8=0xc8;var _0x3fe426=null;return db[_0x6f98('0x82')][_0x6f98('0x83')]({'isolationLevel':db[_0x6f98('0x82')][_0x6f98('0x84')][_0x6f98('0x85')]['READ_COMMITTED']},function(_0xc24d3c){return db['FaxAccount'][_0x6f98('0x6c')]({'where':{'id':_0x7769d4},'transaction':_0xc24d3c})['then'](function(_0x1b3eb1){if(_0x1b3eb1){return db[_0x6f98('0x86')][_0x6f98('0x3a')]({'where':{'FaxAccountId':_0x7769d4},'transaction':_0xc24d3c})[_0x6f98('0x24')](function(){var _0x1cca6b=_[_0x6f98('0x44')](_0x37cc97,function(_0x325c88){_0x325c88[_0x6f98('0x6f')]=_0x7769d4;return _0x325c88;});return db[_0x6f98('0x86')][_0x6f98('0x87')](_0x1cca6b,{'transaction':_0xc24d3c});});}else{_0x36a5e8=0x194;_0x3fe426=[];}});})[_0x6f98('0x24')](function(){if(_0x36a5e8!==0x194){return db[_0x6f98('0x86')][_0x6f98('0x88')]({'where':{'FaxAccountId':_0x7769d4},'order':'priority'})['then'](function(_0xec8b92){_0x3fe426=_0xec8b92;});}})[_0x6f98('0x2d')](function(_0x2ee7c7){_0x36a5e8=0x1f4;logger[_0x6f98('0x2a')](_0x2ee7c7['stack']);if(_0x2ee7c7[_0x6f98('0x3f')]){delete _0x2ee7c7[_0x6f98('0x3f')];}_0x3fe426=_0x2ee7c7;})[_0x6f98('0x89')](function(){if(_0x3fe426===null){_0x13b3d3[_0x6f98('0x2e')](_0x36a5e8);}else{if(_0x36a5e8===0x1f4){_0x13b3d3[_0x6f98('0x2f')](_0x36a5e8)[_0x6f98('0x40')](_0x3fe426);}else{_0x13b3d3[_0x6f98('0x2f')](_0x36a5e8)[_0x6f98('0x30')](_0x3fe426);}}});};exports[_0x6f98('0x8a')]=function(_0x286370,_0x4c0bda,_0xcc3c9a){var _0x29f296={};var _0x56d097={};var _0x253c75;var _0x3ad440;return db[_0x6f98('0x45')]['findOne']({'where':{'id':_0x286370[_0x6f98('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c0bda,null))['then'](function(_0x5e0a6e){if(_0x5e0a6e){_0x253c75=_0x5e0a6e;_0x56d097[_0x6f98('0x4a')]=_['keys'](db['FaxApplication'][_0x6f98('0x46')]);_0x56d097[_0x6f98('0x4c')]=_[_0x6f98('0x4b')](_0x286370[_0x6f98('0x4c')]);_0x56d097['filters']=_['intersection'](_0x56d097[_0x6f98('0x4a')],_0x56d097[_0x6f98('0x4c')]);_0x29f296[_0x6f98('0x50')]=_['intersection'](_0x56d097[_0x6f98('0x4a')],qs[_0x6f98('0x4f')](_0x286370['query'][_0x6f98('0x4f')]));_0x29f296['attributes']=_0x29f296[_0x6f98('0x50')][_0x6f98('0x5e')]?_0x29f296[_0x6f98('0x50')]:_0x56d097[_0x6f98('0x4a')];_0x29f296[_0x6f98('0x6d')]=qs[_0x6f98('0x54')](_0x286370[_0x6f98('0x4c')][_0x6f98('0x54')]);_0x29f296[_0x6f98('0x55')]=qs['filters'](_[_0x6f98('0x6e')](_0x286370['query'],_0x56d097[_0x6f98('0x4d')]));if(_0x286370[_0x6f98('0x4c')][_0x6f98('0x56')]){_0x29f296[_0x6f98('0x55')]=_[_0x6f98('0x57')](_0x29f296[_0x6f98('0x55')],{'$or':_[_0x6f98('0x44')](_0x29f296[_0x6f98('0x50')],function(_0x56a057){var _0x46396f={};_0x46396f[_0x56a057]={'$like':'%'+_0x286370[_0x6f98('0x4c')][_0x6f98('0x56')]+'%'};return _0x46396f;})});}_0x29f296=_[_0x6f98('0x57')]({},_0x29f296,_0x286370[_0x6f98('0x59')]);return _0x253c75[_0x6f98('0x8a')](_0x29f296);}})[_0x6f98('0x24')](function(_0x236b68){if(_0x236b68){_0x3ad440=_0x236b68['length'];if(!_0x286370[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x29f296[_0x6f98('0x53')]=qs[_0x6f98('0x53')](_0x286370[_0x6f98('0x4c')][_0x6f98('0x53')]);_0x29f296[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x286370[_0x6f98('0x4c')][_0x6f98('0x31')]);}return _0x253c75['getApplications'](_0x29f296);}})[_0x6f98('0x24')](function(_0x6fd954){if(_0x6fd954){return _0x6fd954?{'count':_0x3ad440,'rows':_0x6fd954}:null;}})[_0x6f98('0x24')](respondWithResult(_0x4c0bda,null))[_0x6f98('0x2d')](handleError(_0x4c0bda,null));};function Extension(_0x5ab778,_0x14d672,_0x4e5dd2,_0x393791){this['context']='from-voip-provider';this[_0x6f98('0x8b')]=_0x5ab778[_0x6f98('0x8c')];this[_0x6f98('0x8d')]=_0x393791;this[_0x6f98('0x48')]=_0x6f98('0x8e');this['description']=_0x6f98('0x8f');this[_0x6f98('0x6f')]=_0x5ab778['id'];this[_0x6f98('0x90')]=_0x14d672;this[_0x6f98('0x91')]=_0x4e5dd2;}function createExtensionsReciveFax(_0x7e66bb){var _0x5d0698=0x1;var _0x14a21a=[];_0x14a21a[_0x6f98('0x92')](new Extension(_0x7e66bb,_0x5d0698,'',_0x6f98('0x93')));_0x5d0698+=0x1;_0x14a21a[_0x6f98('0x92')](new Extension(_0x7e66bb,_0x5d0698,_0x6f98('0x94'),_0x6f98('0x95')));_0x5d0698+=0x1;for(var _0x3a1602 in _0x7e66bb){if(_0x7e66bb[_0x6f98('0x51')](_0x3a1602)&&(_0x3a1602===_0x6f98('0x96')||_0x3a1602===_0x6f98('0x8c')||_0x3a1602===_0x6f98('0x97')||_0x3a1602===_0x6f98('0x98')||_0x3a1602===_0x6f98('0x99')||_0x3a1602===_0x6f98('0x9a')||_0x3a1602===_0x6f98('0x9b')||_0x3a1602===_0x6f98('0x9c')||_0x3a1602===_0x6f98('0x9d'))){_0x14a21a['push'](new Extension(_0x7e66bb,_0x5d0698,'FAXOPT('+_0x3a1602+')='+_0x7e66bb[_0x3a1602],_0x6f98('0x95')));_0x5d0698+=0x1;}}_0x14a21a[_0x6f98('0x92')](new Extension(_0x7e66bb,_0x5d0698,'6',_0x6f98('0x9e')));_0x5d0698+=0x1;_0x14a21a[_0x6f98('0x92')](new Extension(_0x7e66bb,_0x5d0698,_0x6f98('0x9f'),'ReceiveFax'));_0x5d0698=0x0;return _0x14a21a;}exports['addAccountApplications']=function(_0x4686cb,_0x46f7dc,_0x298a65){var _0x2956bf;return db[_0x6f98('0x82')][_0x6f98('0x83')](function(_0x5b0a22){return db[_0x6f98('0x45')][_0x6f98('0x61')](_0x4686cb[_0x6f98('0x62')],{'transaction':_0x5b0a22})[_0x6f98('0x24')](function(_0x5ab3d4){_0x2956bf=_0x5ab3d4[_0x6f98('0x64')]({'plain':!![]});return db[_0x6f98('0xa0')][_0x6f98('0x87')](createExtensionsReciveFax(_0x2956bf),{'transaction':_0x5b0a22});});})[_0x6f98('0x24')](function(){return _0x2956bf;})[_0x6f98('0x24')](respondWithResult(_0x46f7dc,null))[_0x6f98('0x2d')](handleError(_0x46f7dc,null));};exports[_0x6f98('0xa1')]=function(_0x52484f,_0x313896,_0x2bf35c){var _0x36db31;return db[_0x6f98('0x82')]['transaction'](function(_0x53dfa4){return db['FaxAccount'][_0x6f98('0x39')](_0x52484f[_0x6f98('0x62')],{'where':{'id':_0x52484f[_0x6f98('0x62')]['id']},'transaction':_0x53dfa4})[_0x6f98('0x24')](function(_0x9f5f7){return db[_0x6f98('0xa0')][_0x6f98('0x3a')]({'where':{'FaxAccountId':_0x52484f[_0x6f98('0x62')]['id']},'transaction':_0x53dfa4})[_0x6f98('0x24')](function(_0x534169){return db[_0x6f98('0xa0')]['bulkCreate'](createExtensionsReciveFax(_[_0x6f98('0x79')](_0x52484f['body'],[_0x6f98('0xa2'),_0x6f98('0x49'),_0x6f98('0xa3'),'updatedAt',_0x6f98('0xa4'),_0x6f98('0xa5')])),{'transaction':_0x53dfa4});});});})[_0x6f98('0x24')](function(){return db[_0x6f98('0x45')]['findById'](_0x52484f['body']['id']);})[_0x6f98('0x24')](respondWithResult(_0x313896,null))[_0x6f98('0x2d')](handleError(_0x313896,null));};exports[_0x6f98('0xa6')]=function(_0x310b68,_0x5eed33,_0x42dfdb){var _0x59cf52={'raw':!![],'where':{}};var _0x33b8c2={};var _0x785991={'count':0x0,'rows':[]};return db[_0x6f98('0x45')][_0x6f98('0x6c')]({'where':{'id':_0x310b68[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x5eed33,null))[_0x6f98('0x24')](function(_0x5f0af9){if(_0x5f0af9){_0x33b8c2['model']=_[_0x6f98('0x4b')](db[_0x6f98('0xa7')]['rawAttributes']);_0x33b8c2[_0x6f98('0x4c')]=_['keys'](_0x310b68[_0x6f98('0x4c')]);_0x33b8c2[_0x6f98('0x4d')]=_[_0x6f98('0x4e')](_0x33b8c2[_0x6f98('0x4a')],_0x33b8c2[_0x6f98('0x4c')]);_0x59cf52[_0x6f98('0x50')]=_[_0x6f98('0x4e')](_0x33b8c2['model'],qs[_0x6f98('0x4f')](_0x310b68[_0x6f98('0x4c')][_0x6f98('0x4f')]));_0x59cf52[_0x6f98('0x50')]=_0x59cf52[_0x6f98('0x50')][_0x6f98('0x5e')]?_0x59cf52['attributes']:_0x33b8c2[_0x6f98('0x4a')];if(!_0x310b68[_0x6f98('0x4c')][_0x6f98('0x51')]('nolimit')){_0x59cf52['limit']=qs[_0x6f98('0x53')](_0x310b68[_0x6f98('0x4c')][_0x6f98('0x53')]);_0x59cf52[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x310b68[_0x6f98('0x4c')][_0x6f98('0x31')]);}_0x59cf52[_0x6f98('0x6d')]=qs['sort'](_0x310b68[_0x6f98('0x4c')][_0x6f98('0x54')]);_0x59cf52['where']=qs[_0x6f98('0x4d')](_[_0x6f98('0x6e')](_0x310b68[_0x6f98('0x4c')],_0x33b8c2['filters']));_0x59cf52[_0x6f98('0x55')]['FaxAccountId']=_0x5f0af9['id'];if(_0x310b68[_0x6f98('0x4c')][_0x6f98('0x56')]){_0x59cf52[_0x6f98('0x55')]=_[_0x6f98('0x57')](_0x59cf52[_0x6f98('0x55')],{'$or':_[_0x6f98('0x44')](_0x59cf52['attributes'],function(_0x50c713){var _0x33ff3b={};_0x33ff3b[_0x50c713]={'$like':'%'+_0x310b68[_0x6f98('0x4c')][_0x6f98('0x56')]+'%'};return _0x33ff3b;})});}if(_0x310b68[_0x6f98('0x4c')]['$gte']){var _0x5cdd22=_0x310b68[_0x6f98('0x4c')][_0x6f98('0xa8')][_0x6f98('0xa9')](',');var _0x325652={};_0x325652[_0x5cdd22[0x0]]={'$gte':moment(_0x5cdd22[0x1])[_0x6f98('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x59cf52[_0x6f98('0x55')]=_['merge'](_0x59cf52[_0x6f98('0x55')],_0x325652);}_0x59cf52=_['merge']({},_0x59cf52,_0x310b68[_0x6f98('0x59')]);return db[_0x6f98('0xa7')][_0x6f98('0x33')]({'where':_0x59cf52['where']})['then'](function(_0x3f366a){_0x785991[_0x6f98('0x33')]=_0x3f366a;if(_0x310b68[_0x6f98('0x4c')][_0x6f98('0x70')]){_0x59cf52[_0x6f98('0x5f')]=[{'all':!![]}];}return db[_0x6f98('0xa7')][_0x6f98('0x5a')](_0x59cf52);})[_0x6f98('0x24')](function(_0x1c924d){_0x785991[_0x6f98('0x5b')]=_0x1c924d;return _0x785991;});}})[_0x6f98('0x24')](respondWithFilteredResult(_0x5eed33,_0x59cf52))[_0x6f98('0x2d')](handleError(_0x5eed33,null));};exports[_0x6f98('0x40')]=function(_0x433f23,_0x306afa,_0x4d7cf6){var _0x8b8a8,_0x3d37fd={},_0x180d58;if(_0x433f23[_0x6f98('0x62')]['to']){_0x180d58=_0x433f23[_0x6f98('0x62')]['to'][0x0];}return db['FaxAccount'][_0x6f98('0x60')]({'where':{'id':_0x433f23['params']['id']},'include':[{'model':db[_0x6f98('0xab')],'as':_0x6f98('0xac'),'include':[{'model':db[_0x6f98('0x7a')],'as':'Contacts','where':{'fax':_0x180d58},'limit':0x1,'order':[[_0x6f98('0xad'),'DESC']]}]}]})[_0x6f98('0x24')](handleEntityNotFound(_0x306afa,null))['then'](function(_0x5bccae){_0x8b8a8=_0x5bccae;if(_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')]&&_0x433f23['body'][_0x6f98('0xae')]['length']){for(var _0x2d5d82=0x0;_0x2d5d82<_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][_0x6f98('0x5e')];_0x2d5d82+=0x1){_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][_0x2d5d82]={'filename':_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][_0x2d5d82][_0x6f98('0x3f')],'id':_0x433f23[_0x6f98('0x62')]['attachments'][_0x2d5d82]['id'],'path':path[_0x6f98('0xaf')](config['root'],'server/files/attachments',_0x433f23[_0x6f98('0x62')]['attachments'][_0x2d5d82]['basename'])};}}return respondWithRpcPromise(_0x6f98('0xb0'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x433f23[_0x6f98('0x5d')]['id'])?undefined:_0x433f23['params']['id'],'path':_[_0x6f98('0xb1')](_0x433f23[_0x6f98('0x62')]['attachments'][0x0][_0x6f98('0x8')])?undefined:_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][0x0]['path'],'fax':_[_0x6f98('0xb1')](_0x433f23[_0x6f98('0x62')]['to'][0x0])?undefined:_0x433f23['body']['to'][0x0]},client9002);})['then'](function(){if(_0x8b8a8){if(_['isNil'](_0x433f23['body']['from'])){_0x433f23[_0x6f98('0x62')][_0x6f98('0xb2')]=util['format'](_0x6f98('0xb3'),_0x8b8a8[_0x6f98('0x3f')],_0x8b8a8[_0x6f98('0xb4')]);}if(_0x8b8a8[_0x6f98('0xac')]){if(_0x8b8a8[_0x6f98('0xac')][_0x6f98('0xb5')][_0x6f98('0x5e')]){return _0x8b8a8['List'][_0x6f98('0xb5')][0x0];}else{return db[_0x6f98('0x7a')][_0x6f98('0x61')](_[_0x6f98('0x1c')](_0x433f23[_0x6f98('0x62')],{'firstName':_0x433f23[_0x6f98('0x62')]['to'][0x0],'phone':_0x433f23[_0x6f98('0x62')]['to'][0x0],'fax':_0x433f23['body']['to'][0x0],'ListId':_0x8b8a8[_0x6f98('0xa5')]}));}}else{throw new Error(_0x6f98('0xb6'));}}else{throw new Error(_0x6f98('0xb7'));}})['then'](function(_0x538cad){if(_0x538cad){return db[_0x6f98('0x78')]['find']({'where':{'ContactId':_0x538cad['id'],'closed':![],'FaxAccountId':_0x8b8a8['id']}})[_0x6f98('0x24')](function(_0x18bd04){if(_0x18bd04){return[_0x18bd04,![]];}return db[_0x6f98('0x78')]['create']({'UserId':_0x433f23[_0x6f98('0x63')]['id'],'ContactId':_0x538cad['id'],'FaxAccountId':_0x8b8a8['id'],'fax':_0x433f23['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x6f98('0x57')](_0x433f23[_0x6f98('0x62')],{'read':![],'body':_0x433f23['body']['attachments'][0x0][_0x6f98('0xb8')],'FaxAccountId':_0x8b8a8['id'],'UserId':_0x433f23[_0x6f98('0x63')]['id'],'ContactId':_0x538cad['id'],'AttachmentId':_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x95580f){return[_0x95580f,!![]];});});}else{throw new Error(_0x6f98('0xb9'));}})[_0x6f98('0xba')](function(_0x258abb,_0x1537b8){if(_0x1537b8){return _0x258abb;}return db[_0x6f98('0xa7')][_0x6f98('0x61')]({'direction':'out','read':![],'body':_0x433f23['body'][_0x6f98('0xae')][0x0][_0x6f98('0xb8')],'FaxAccountId':_0x8b8a8['id'],'FaxInteractionId':_0x258abb['id'],'UserId':_0x433f23[_0x6f98('0x63')]['id'],'ContactId':_0x258abb['ContactId'],'AttachmentId':_0x433f23[_0x6f98('0x62')]['attachments'][0x0]['id']})['then'](function(_0x541120){_0x258abb[_0x6f98('0xbb')]['Messages']=[];_0x258abb['dataValues']['Messages'][_0x6f98('0x92')](_0x541120['dataValues']);return _0x258abb;});})[_0x6f98('0x24')](function(_0x1ebdd1){respondWithRpcPromise(_0x6f98('0xbc'),'SendFax',{'FaxAccountId':_[_0x6f98('0xb1')](_0x433f23[_0x6f98('0x5d')]['id'])?undefined:_0x433f23['params']['id'],'path':_[_0x6f98('0xb1')](_0x433f23['body'][_0x6f98('0xae')][0x0][_0x6f98('0x8')])?undefined:_0x433f23[_0x6f98('0x62')][_0x6f98('0xae')][0x0][_0x6f98('0x8')],'fax':_[_0x6f98('0xb1')](_0x433f23['body']['to'][0x0])?undefined:_0x433f23[_0x6f98('0x62')]['to'][0x0],'AttachmentId':_0x433f23['body'][_0x6f98('0xae')][0x0]['id']},client9002)[_0x6f98('0x24')](function(_0x5c7253){logger[_0x6f98('0x25')](_0x6f98('0xbd'),_0x5c7253);})['catch'](function(_0x5151de){logger['info'](_0x6f98('0xbd'),_0x5151de);});return _0x1ebdd1;})['then'](respondWithResult(_0x306afa,null))[_0x6f98('0x2d')](handleError(_0x306afa,null));};exports[_0x6f98('0xbe')]=function(_0x4e1e08,_0x45de0d,_0x116f12){return db[_0x6f98('0x45')]['find']({'where':{'id':_0x4e1e08[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x45de0d,null))[_0x6f98('0x24')](function(_0x2b8724){if(_0x2b8724){return _0x2b8724[_0x6f98('0xbe')](_0x4e1e08[_0x6f98('0x62')][_0x6f98('0x72')],_[_0x6f98('0x79')](_0x4e1e08[_0x6f98('0x62')],[_0x6f98('0x72'),'id'])||{})[_0x6f98('0xba')](function(_0x413254){for(var _0x77bcbb=0x0;_0x77bcbb<_0x4e1e08[_0x6f98('0x62')][_0x6f98('0x72')][_0x6f98('0x5e')];_0x77bcbb+=0x1){socket[_0x6f98('0xbf')](_0x6f98('0xc0'),{'UserId':Number(_0x4e1e08[_0x6f98('0x62')]['ids'][_0x77bcbb]),'FaxAccountId':Number(_0x4e1e08[_0x6f98('0x5d')]['id'])});}return _0x413254;});}})[_0x6f98('0x24')](respondWithResult(_0x45de0d,null))[_0x6f98('0x2d')](handleError(_0x45de0d,null));};exports[_0x6f98('0xc1')]=function(_0x396930,_0x203a46,_0xc0e222){return db[_0x6f98('0x45')][_0x6f98('0x60')]({'where':{'id':_0x396930[_0x6f98('0x5d')]['id']}})[_0x6f98('0x24')](handleEntityNotFound(_0x203a46,null))['then'](function(_0x3bda15){if(_0x3bda15){return _0x3bda15[_0x6f98('0xc1')](_0x396930[_0x6f98('0x4c')]['ids'])[_0x6f98('0x24')](function(){if(_[_0x6f98('0xc2')](_0x396930[_0x6f98('0x4c')][_0x6f98('0x72')])){for(var _0x1db901=0x0;_0x1db901<_0x396930[_0x6f98('0x4c')][_0x6f98('0x72')][_0x6f98('0x5e')];_0x1db901+=0x1){socket['emit'](_0x6f98('0xc3'),{'UserId':Number(_0x396930[_0x6f98('0x4c')][_0x6f98('0x72')][_0x1db901]),'FaxAccountId':Number(_0x396930['params']['id'])});}}else{socket['emit'](_0x6f98('0xc3'),{'UserId':Number(_0x396930[_0x6f98('0x4c')][_0x6f98('0x72')]),'FaxAccountId':Number(_0x396930[_0x6f98('0x5d')]['id'])});}});}})[_0x6f98('0x24')](respondWithStatusCode(_0x203a46,null))[_0x6f98('0x2d')](handleError(_0x203a46,null));};exports[_0x6f98('0xc4')]=function(_0x3b2945,_0x4715cb,_0x47b6c8){var _0x14125c={};var _0x34b2db={};var _0xca79d7;var _0x49654a;return db['FaxAccount'][_0x6f98('0x6c')]({'where':{'id':_0x3b2945[_0x6f98('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4715cb,null))['then'](function(_0x30fb2e){if(_0x30fb2e){_0xca79d7=_0x30fb2e;_0x34b2db[_0x6f98('0x4a')]=_[_0x6f98('0x4b')](db['User'][_0x6f98('0x46')]);_0x34b2db[_0x6f98('0x4c')]=_[_0x6f98('0x4b')](_0x3b2945[_0x6f98('0x4c')]);_0x34b2db[_0x6f98('0x4d')]=_[_0x6f98('0x4e')](_0x34b2db['model'],_0x34b2db[_0x6f98('0x4c')]);_0x14125c[_0x6f98('0x50')]=_[_0x6f98('0x4e')](_0x34b2db[_0x6f98('0x4a')],qs['fields'](_0x3b2945[_0x6f98('0x4c')][_0x6f98('0x4f')]));_0x14125c[_0x6f98('0x50')]=_0x14125c[_0x6f98('0x50')][_0x6f98('0x5e')]?_0x14125c[_0x6f98('0x50')]:_0x34b2db['model'];_0x14125c[_0x6f98('0x6d')]=qs[_0x6f98('0x54')](_0x3b2945[_0x6f98('0x4c')][_0x6f98('0x54')]);_0x14125c[_0x6f98('0x55')]=qs[_0x6f98('0x4d')](_[_0x6f98('0x6e')](_0x3b2945[_0x6f98('0x4c')],_0x34b2db[_0x6f98('0x4d')]));if(_0x3b2945[_0x6f98('0x4c')][_0x6f98('0x56')]){_0x14125c[_0x6f98('0x55')]=_[_0x6f98('0x57')](_0x14125c[_0x6f98('0x55')],{'$or':_[_0x6f98('0x44')](_0x14125c[_0x6f98('0x50')],function(_0x24bc00){var _0xccc169={};_0xccc169[_0x24bc00]={'$like':'%'+_0x3b2945[_0x6f98('0x4c')]['filter']+'%'};return _0xccc169;})});}_0x14125c=_[_0x6f98('0x57')]({},_0x14125c,_0x3b2945[_0x6f98('0x59')]);return _0xca79d7['getAgents'](_0x14125c);}})[_0x6f98('0x24')](function(_0x188e45){if(_0x188e45){_0x49654a=_0x188e45[_0x6f98('0x5e')];if(!_0x3b2945[_0x6f98('0x4c')][_0x6f98('0x51')](_0x6f98('0x52'))){_0x14125c[_0x6f98('0x53')]=qs['limit'](_0x3b2945['query'][_0x6f98('0x53')]);_0x14125c[_0x6f98('0x31')]=qs[_0x6f98('0x31')](_0x3b2945[_0x6f98('0x4c')][_0x6f98('0x31')]);}return _0xca79d7[_0x6f98('0xc4')](_0x14125c);}})[_0x6f98('0x24')](function(_0x57f74b){if(_0x57f74b){return _0x57f74b?{'count':_0x49654a,'rows':_0x57f74b}:null;}})[_0x6f98('0x24')](respondWithResult(_0x4715cb,null))[_0x6f98('0x2d')](handleError(_0x4715cb,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 85a876d..c317c91 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 _0x1a58=['exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x1a58,0x17b));var _0x81a5=function(_0x384f18,_0x4aab2c){_0x384f18=_0x384f18-0x0;var _0x4ac0a7=_0x1a58[_0x384f18];return _0x4ac0a7;};'use strict';var EventEmitter=require(_0x81a5('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x81a5('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x81a5('0x2')](0x0);var events={'afterCreate':_0x81a5('0x3'),'afterUpdate':_0x81a5('0x4'),'afterDestroy':_0x81a5('0x5')};function emitEvent(_0x5b96eb){return function(_0x57dc14,_0xb12256,_0x25441c){FaxAccountEvents[_0x81a5('0x6')](_0x5b96eb+':'+_0x57dc14['id'],_0x57dc14);FaxAccountEvents['emit'](_0x5b96eb,_0x57dc14);_0x25441c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x81a5('0x7')](e,emitEvent(event));}}module[_0x81a5('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x817f=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','events'];(function(_0x339bdb,_0x41d092){var _0x2b631d=function(_0x183094){while(--_0x183094){_0x339bdb['push'](_0x339bdb['shift']());}};_0x2b631d(++_0x41d092);}(_0x817f,0x147));var _0xf817=function(_0x590f0c,_0x1f7002){_0x590f0c=_0x590f0c-0x0;var _0x2de6e0=_0x817f[_0x590f0c];return _0x2de6e0;};'use strict';var EventEmitter=require(_0xf817('0x0'));var FaxAccount=require(_0xf817('0x1'))['db'][_0xf817('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf817('0x3')](0x0);var events={'afterCreate':_0xf817('0x4'),'afterUpdate':_0xf817('0x5'),'afterDestroy':_0xf817('0x6')};function emitEvent(_0x20080f){return function(_0x4776ac,_0x3b9e86,_0x31ba66){FaxAccountEvents['emit'](_0x20080f+':'+_0x4776ac['id'],_0x4776ac);FaxAccountEvents[_0xf817('0x7')](_0x20080f,_0x4776ac);_0x31ba66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 47d29a7..e9be653 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 _0xf58d=['fax_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes','define','FaxAccount'];(function(_0x3f06da,_0x884b2a){var _0x38a82a=function(_0x423878){while(--_0x423878){_0x3f06da['push'](_0x3f06da['shift']());}};_0x38a82a(++_0x884b2a);}(_0xf58d,0xdd));var _0xdf58=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xf58d[_0x43a1b8];return _0x324ecc;};'use strict';var _=require('lodash');var util=require(_0xdf58('0x0'));var logger=require(_0xdf58('0x1'))(_0xdf58('0x2'));var moment=require(_0xdf58('0x3'));var BPromise=require(_0xdf58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf58('0x5'));var rimraf=require(_0xdf58('0x6'));var config=require('../../config/environment');var attributes=require(_0xdf58('0x7'));module['exports']=function(_0x71e47f,_0x11abcd){return _0x71e47f[_0xdf58('0x8')](_0xdf58('0x9'),attributes,{'tableName':_0xdf58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f26=['fax_accounts','lodash','../../config/logger','request-promise','path','rimraf','./faxAccount.attributes','exports','FaxAccount'];(function(_0x3eeef7,_0x5ced1f){var _0x573ce8=function(_0x280f72){while(--_0x280f72){_0x3eeef7['push'](_0x3eeef7['shift']());}};_0x573ce8(++_0x5ced1f);}(_0x3f26,0x19f));var _0x63f2=function(_0x4588f3,_0x163480){_0x4588f3=_0x4588f3-0x0;var _0x15d649=_0x3f26[_0x4588f3];return _0x15d649;};'use strict';var _=require(_0x63f2('0x0'));var util=require('util');var logger=require(_0x63f2('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x63f2('0x2'));var fs=require('fs');var path=require(_0x63f2('0x3'));var rimraf=require(_0x63f2('0x4'));var config=require('../../config/environment');var attributes=require(_0x63f2('0x5'));module[_0x63f2('0x6')]=function(_0x30f9d9,_0x3616d3){return _0x30f9d9['define'](_0x63f2('0x7'),attributes,{'tableName':_0x63f2('0x8'),'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 c2b453d..40b2b57 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 _0xa6b7=['FaxQueue','queueId','unshift','queue','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','CmContact','describe','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','Contacts','FaxApplication','List','applications','list','orderBy','priority','asc','Applications','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa6b7,0xbf));var _0x7a6b=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xa6b7[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x7a6b('0x0'));var util=require(_0x7a6b('0x1'));var moment=require(_0x7a6b('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a6b('0x4'))['db'];var utils=require(_0x7a6b('0x5'));var logger=require('../../config/logger')(_0x7a6b('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a6b('0x7'));var client=jayson['client'][_0x7a6b('0x8')]({'port':0x232c});config[_0x7a6b('0x9')]=_[_0x7a6b('0xa')](config[_0x7a6b('0x9')],{'host':_0x7a6b('0xb'),'port':0x18eb});var socket=require(_0x7a6b('0xc'))(new Redis(config[_0x7a6b('0x9')]));require(_0x7a6b('0xd'))[_0x7a6b('0xe')](socket);function respondWithRpcPromise(_0x3f3761,_0x354f5d,_0x5387e4){return new BPromise(function(_0x4a764e,_0x2b7ee8){return client[_0x7a6b('0xf')](_0x3f3761,_0x5387e4)[_0x7a6b('0x10')](function(_0x438e24){logger[_0x7a6b('0x11')](_0x7a6b('0x12'),_0x354f5d,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x354f5d,_0x7a6b('0x13'),JSON[_0x7a6b('0x14')](_0x438e24));if(_0x438e24[_0x7a6b('0x15')]){if(_0x438e24[_0x7a6b('0x15')][_0x7a6b('0x16')]===0x1f4){logger[_0x7a6b('0x15')]('FaxAccount,\x20%s,\x20%s',_0x354f5d,_0x438e24[_0x7a6b('0x15')][_0x7a6b('0x17')]);return _0x2b7ee8(_0x438e24[_0x7a6b('0x15')][_0x7a6b('0x17')]);}logger[_0x7a6b('0x15')](_0x7a6b('0x12'),_0x354f5d,_0x438e24['error'][_0x7a6b('0x17')]);return _0x4a764e(_0x438e24[_0x7a6b('0x15')][_0x7a6b('0x17')]);}else{logger[_0x7a6b('0x11')](_0x7a6b('0x12'),_0x354f5d,_0x7a6b('0x13'));_0x4a764e(_0x438e24[_0x7a6b('0x18')][_0x7a6b('0x17')]);}})[_0x7a6b('0x19')](function(_0xe2f0c2){logger[_0x7a6b('0x15')](_0x7a6b('0x12'),_0x354f5d,_0xe2f0c2);_0x2b7ee8(_0xe2f0c2);});});}exports[_0x7a6b('0x1a')]=function(_0x3e11a1){var _0xdb29d1=this;return new Promise(function(_0x2268ff,_0x47e507){return db['FaxAccount'][_0x7a6b('0x1b')]({'raw':_0x3e11a1[_0x7a6b('0x1c')]?_0x3e11a1[_0x7a6b('0x1c')][_0x7a6b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e11a1[_0x7a6b('0x1c')]?_0x3e11a1[_0x7a6b('0x1c')]['where']||null:null,'attributes':_0x3e11a1[_0x7a6b('0x1c')]?_0x3e11a1[_0x7a6b('0x1c')][_0x7a6b('0x1e')]||null:null,'limit':_0x3e11a1[_0x7a6b('0x1c')]?_0x3e11a1['options'][_0x7a6b('0x1f')]||null:null,'include':_0x3e11a1[_0x7a6b('0x1c')]?_0x3e11a1[_0x7a6b('0x1c')][_0x7a6b('0x20')]?_[_0x7a6b('0x21')](_0x3e11a1[_0x7a6b('0x1c')][_0x7a6b('0x20')],function(_0x2eb0cd){return{'model':db[_0x2eb0cd[_0x7a6b('0x22')]],'as':_0x2eb0cd['as'],'attributes':_0x2eb0cd[_0x7a6b('0x1e')],'include':_0x2eb0cd[_0x7a6b('0x20')]?_[_0x7a6b('0x21')](_0x2eb0cd[_0x7a6b('0x20')],function(_0x18eb3b){return{'model':db[_0x18eb3b[_0x7a6b('0x22')]],'as':_0x18eb3b['as'],'attributes':_0x18eb3b[_0x7a6b('0x1e')],'include':_0x18eb3b[_0x7a6b('0x20')]?_['map'](_0x18eb3b[_0x7a6b('0x20')],function(_0x2d4b05){return{'model':db[_0x2d4b05[_0x7a6b('0x22')]],'as':_0x2d4b05['as'],'attributes':_0x2d4b05[_0x7a6b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a6b('0x10')](function(_0x361b41){logger['info'](_0x7a6b('0x1a'),_0x3e11a1);logger[_0x7a6b('0x23')](_0x7a6b('0x1a'),_0x3e11a1,JSON[_0x7a6b('0x14')](_0x361b41));_0x2268ff(_0x361b41);})[_0x7a6b('0x19')](function(_0x1ef45d){logger[_0x7a6b('0x15')](_0x7a6b('0x1a'),_0x1ef45d[_0x7a6b('0x17')],_0x3e11a1);_0x47e507(_0xdb29d1[_0x7a6b('0x15')](0x1f4,_0x1ef45d[_0x7a6b('0x17')]));});});};exports[_0x7a6b('0x24')]=function(_0x25083e,_0x5c3ffc,_0x347db4){var _0xf171f7=this;return new Promise(function(_0x1b35fe,_0x4b59a7){var _0x2aebdf={'body':_0x25083e[_0x7a6b('0x25')],'channel':'fax'};var _0x2b9b50=[];var _0x2f3539=[];var _0x2d3ed4={};return db[_0x7a6b('0x26')][_0x7a6b('0x27')]()[_0x7a6b('0x10')](function(_0x1a735d){if(!_0x1a735d){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x2b9b50=_[_0x7a6b('0x28')](_['keys'](_0x1a735d),[_0x7a6b('0x29'),_0x7a6b('0x2a')]);_0x2f3539=_[_0x7a6b('0x28')](_['keys'](_0x1a735d),[_0x7a6b('0x29'),_0x7a6b('0x2a'),_0x7a6b('0x2b'),_0x7a6b('0x2c')]);if(_0x25083e[_0x7a6b('0x25')]['id']){delete _0x25083e['body']['id'];}if(_[_0x7a6b('0x2d')](_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x2e')])){throw new db['Sequelize'][(_0x7a6b('0x2f'))](_0x7a6b('0x30'));}if(_[_0x7a6b('0x2d')](_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x25')])||_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x25')]===''){throw new db['Sequelize']['ValidationError'](_0x7a6b('0x31'));}if(_[_0x7a6b('0x2d')](_0x25083e[_0x7a6b('0x25')]['mapKey'])){throw new db[(_0x7a6b('0x32'))][(_0x7a6b('0x2f'))](_0x7a6b('0x33')+_0x2f3539);}if(!_['includes'](_0x2f3539,_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x34')])){throw new db[(_0x7a6b('0x32'))][(_0x7a6b('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f3539);}_0x2d3ed4[_0x25083e['body'][_0x7a6b('0x34')]]=_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x2e')];})['then'](function(){return db[_0x7a6b('0x35')][_0x7a6b('0x36')]({'where':{'id':_0x25083e[_0x7a6b('0x37')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7a6b('0x26')],'as':_0x7a6b('0x38'),'where':_0x2d3ed4,'limit':0x1,'order':[[_0x7a6b('0x2a'),'DESC']]}]},{'model':db[_0x7a6b('0x39')],'as':'Applications'}]});})['then'](function(_0x557480){if(_0x557480&&_0x557480[_0x7a6b('0x3a')]){var _0x17d2d6=_0x557480['get']({'plain':!![]});_0x2aebdf['account']=_0x17d2d6;_0x2aebdf[_0x7a6b('0x3b')]=_0x17d2d6['Applications'];_0x2aebdf[_0x7a6b('0x3c')]=_0x17d2d6[_0x7a6b('0x3a')];_0x2aebdf[_0x7a6b('0x3b')]=_[_0x7a6b('0x3d')](_0x2aebdf[_0x7a6b('0x3b')],[_0x7a6b('0x3e')],[_0x7a6b('0x3f')]);if(_0x2aebdf[_0x7a6b('0x37')][_0x7a6b('0x40')]){delete _0x2aebdf[_0x7a6b('0x37')][_0x7a6b('0x40')];}if(_0x2aebdf[_0x7a6b('0x37')]['List']&&_0x2aebdf[_0x7a6b('0x37')][_0x7a6b('0x3a')][_0x7a6b('0x38')][_0x7a6b('0x41')]){return _0x2aebdf['account'][_0x7a6b('0x3a')]['Contacts'][0x0];}var _0x49724f=_['defaults'](_0x25083e['body'],{'firstName':_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x2e')],'ListId':_0x17d2d6['ListId']});_0x49724f[_0x25083e['body']['mapKey']]=_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x2e')];return db[_0x7a6b('0x26')][_0x7a6b('0x42')](_0x49724f,{'fields':_0x2b9b50,'raw':!![]});}})[_0x7a6b('0x10')](function(_0x3aad16){_0x2aebdf[_0x7a6b('0x43')]=_0x3aad16;if(_0x3aad16){var _0x388ed7={'ContactId':_0x3aad16['id'],'FaxAccountId':_0x25083e['account']['id'],'fax':_0x3aad16[_0x7a6b('0x44')]};return db['FaxInteraction'][_0x7a6b('0x36')]({'where':{'ContactId':_0x3aad16['id'],'closed':![],'FaxAccountId':_0x25083e[_0x7a6b('0x37')]['id']}})[_0x7a6b('0x10')](function(_0xe6176e){if(_0xe6176e){return[_0xe6176e,![]];}return db[_0x7a6b('0x45')]['create'](_0x388ed7)['then'](function(_0x441bd5){return[_0x441bd5,!![]];});});}else{throw new Error(_0x7a6b('0x46'));}})[_0x7a6b('0x47')](function(_0x38b969,_0x22d11c){var _0x20ffdc=_0x38b969[_0x7a6b('0x48')]({'plain':!![]});if(_0x22d11c){if(_0x2aebdf[_0x7a6b('0x37')][_0x7a6b('0x49')]){_0x2aebdf[_0x7a6b('0x3b')][_0x7a6b('0x4a')]({'id':0x0,'priority':_0x2aebdf[_0x7a6b('0x3b')]['length']+0x1,'app':_0x7a6b('0x4b'),'appdata':_0x7a6b('0x4c'),'interval':_0x7a6b('0x4d')});}_0x20ffdc['created']=!![];}else{_0x20ffdc[_0x7a6b('0x4e')]=![];}_0x2aebdf[_0x7a6b('0x4f')]=_0x20ffdc;return db[_0x7a6b('0x50')]['create']({'body':_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x25')],'FaxAccountId':_0x25083e[_0x7a6b('0x37')]['id'],'FaxInteractionId':_0x38b969['id'],'direction':'in','ContactId':_0x38b969[_0x7a6b('0x51')],'AttachmentId':_0x25083e[_0x7a6b('0x25')][_0x7a6b('0x52')]});})['then'](function(_0x4211f){_0x2aebdf[_0x7a6b('0x17')]=_0x4211f;if(!_0x2aebdf[_0x7a6b('0x4f')][_0x7a6b('0x53')])return;return db[_0x7a6b('0x54')][_0x7a6b('0x36')]({'attributes':['id',_0x7a6b('0x55')],'where':{'id':_0x2aebdf[_0x7a6b('0x4f')][_0x7a6b('0x53')]}});})[_0x7a6b('0x10')](function(_0x32d5f4){if(_0x32d5f4){_0x2aebdf[_0x7a6b('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7a6b('0x56'),'appdata':_0x32d5f4['name']+','+(_0x2aebdf[_0x7a6b('0x37')][_0x7a6b('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x2aebdf[_0x7a6b('0x4f')]['queueId'])return;return db[_0x7a6b('0x58')][_0x7a6b('0x36')]({'attributes':['id',_0x7a6b('0x55')],'where':{'id':_0x2aebdf[_0x7a6b('0x4f')][_0x7a6b('0x59')]}});})[_0x7a6b('0x10')](function(_0x23e871){if(_0x23e871){_0x2aebdf[_0x7a6b('0x3b')][_0x7a6b('0x5a')]({'id':0x0,'priority':0x1,'app':_0x7a6b('0x5b'),'appdata':_0x23e871['name']+','+(_0x2aebdf[_0x7a6b('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x7a6b('0x5c'),_0x2aebdf);})['then'](function(_0x2e07df){_0x1b35fe(_0x2e07df);})['catch'](function(_0x104f89){_0x4b59a7(_0xf171f7[_0x7a6b('0x15')](0x1f4,_0x104f89['message']));});});}; \ No newline at end of file +var _0x7168=['difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','applications','list','List','orderBy','priority','asc','contact','FaxInteraction','create','Contact\x20not\x20found','get','push','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFaxAccount','FaxAccount','findAll','options','where','limit','map','include','model','attributes','catch','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7168,0x1a8));var _0x8716=function(_0x29bdc8,_0x276f4a){_0x29bdc8=_0x29bdc8-0x0;var _0x6d070d=_0x7168[_0x29bdc8];return _0x6d070d;};'use strict';var _=require(_0x8716('0x0'));var util=require('util');var moment=require(_0x8716('0x1'));var BPromise=require(_0x8716('0x2'));var rs=require(_0x8716('0x3'));var fs=require('fs');var Redis=require(_0x8716('0x4'));var db=require(_0x8716('0x5'))['db'];var utils=require(_0x8716('0x6'));var logger=require(_0x8716('0x7'))(_0x8716('0x8'));var config=require(_0x8716('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8716('0xa')]({'port':0x232c});config[_0x8716('0xb')]=_[_0x8716('0xc')](config[_0x8716('0xb')],{'host':_0x8716('0xd'),'port':0x18eb});var socket=require(_0x8716('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x8716('0xf')](socket);function respondWithRpcPromise(_0x40e99d,_0x251132,_0x201dff){return new BPromise(function(_0xfde38,_0x1e4ecb){return client[_0x8716('0x10')](_0x40e99d,_0x201dff)[_0x8716('0x11')](function(_0x313935){logger['info'](_0x8716('0x12'),_0x251132,_0x8716('0x13'));logger[_0x8716('0x14')](_0x8716('0x15'),_0x251132,_0x8716('0x13'),JSON[_0x8716('0x16')](_0x313935));if(_0x313935[_0x8716('0x17')]){if(_0x313935[_0x8716('0x17')][_0x8716('0x18')]===0x1f4){logger[_0x8716('0x17')]('FaxAccount,\x20%s,\x20%s',_0x251132,_0x313935['error'][_0x8716('0x19')]);return _0x1e4ecb(_0x313935[_0x8716('0x17')][_0x8716('0x19')]);}logger[_0x8716('0x17')]('FaxAccount,\x20%s,\x20%s',_0x251132,_0x313935[_0x8716('0x17')][_0x8716('0x19')]);return _0xfde38(_0x313935[_0x8716('0x17')][_0x8716('0x19')]);}else{logger[_0x8716('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x251132,'request\x20sent');_0xfde38(_0x313935[_0x8716('0x1b')]['message']);}})['catch'](function(_0x1918ec){logger[_0x8716('0x17')](_0x8716('0x12'),_0x251132,_0x1918ec);_0x1e4ecb(_0x1918ec);});});}exports[_0x8716('0x1c')]=function(_0x6841b2){var _0x4330ec=this;return new Promise(function(_0x5ad6aa,_0x46b976){return db[_0x8716('0x1d')][_0x8716('0x1e')]({'raw':_0x6841b2['options']?_0x6841b2[_0x8716('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x6841b2[_0x8716('0x1f')]?_0x6841b2[_0x8716('0x1f')][_0x8716('0x20')]||null:null,'attributes':_0x6841b2[_0x8716('0x1f')]?_0x6841b2[_0x8716('0x1f')]['attributes']||null:null,'limit':_0x6841b2[_0x8716('0x1f')]?_0x6841b2[_0x8716('0x1f')][_0x8716('0x21')]||null:null,'include':_0x6841b2[_0x8716('0x1f')]?_0x6841b2[_0x8716('0x1f')]['include']?_[_0x8716('0x22')](_0x6841b2[_0x8716('0x1f')][_0x8716('0x23')],function(_0x339378){return{'model':db[_0x339378[_0x8716('0x24')]],'as':_0x339378['as'],'attributes':_0x339378[_0x8716('0x25')],'include':_0x339378[_0x8716('0x23')]?_['map'](_0x339378[_0x8716('0x23')],function(_0x4d8899){return{'model':db[_0x4d8899[_0x8716('0x24')]],'as':_0x4d8899['as'],'attributes':_0x4d8899[_0x8716('0x25')],'include':_0x4d8899['include']?_['map'](_0x4d8899[_0x8716('0x23')],function(_0x51f292){return{'model':db[_0x51f292[_0x8716('0x24')]],'as':_0x51f292['as'],'attributes':_0x51f292['attributes']};}):[]};}):[]};}):[]:[]})[_0x8716('0x11')](function(_0x588657){logger[_0x8716('0x1a')]('GetFaxAccount',_0x6841b2);logger[_0x8716('0x14')](_0x8716('0x1c'),_0x6841b2,JSON[_0x8716('0x16')](_0x588657));_0x5ad6aa(_0x588657);})[_0x8716('0x26')](function(_0x5afc8b){logger[_0x8716('0x17')](_0x8716('0x1c'),_0x5afc8b[_0x8716('0x19')],_0x6841b2);_0x46b976(_0x4330ec[_0x8716('0x17')](0x1f4,_0x5afc8b[_0x8716('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x2a40ec,_0x2d3702,_0x5adce8){var _0x195402=this;return new Promise(function(_0x496370,_0x369f04){var _0x567c7e={'body':_0x2a40ec[_0x8716('0x27')],'channel':_0x8716('0x28')};var _0x4a506a=[];var _0x4f06cd=[];var _0x1f0661={};return db[_0x8716('0x29')][_0x8716('0x2a')]()[_0x8716('0x11')](function(_0x52c17c){if(!_0x52c17c){throw new db[(_0x8716('0x2b'))][(_0x8716('0x2c'))](_0x8716('0x2d'));}_0x4a506a=_[_0x8716('0x2e')](_[_0x8716('0x2f')](_0x52c17c),[_0x8716('0x30'),'updatedAt']);_0x4f06cd=_[_0x8716('0x2e')](_['keys'](_0x52c17c),[_0x8716('0x30'),_0x8716('0x31'),_0x8716('0x32'),_0x8716('0x33')]);if(_0x2a40ec[_0x8716('0x27')]['id']){delete _0x2a40ec['body']['id'];}if(_[_0x8716('0x34')](_0x2a40ec[_0x8716('0x27')][_0x8716('0x35')])){throw new db['Sequelize'][(_0x8716('0x2c'))](_0x8716('0x36'));}if(_[_0x8716('0x34')](_0x2a40ec[_0x8716('0x27')][_0x8716('0x27')])||_0x2a40ec[_0x8716('0x27')][_0x8716('0x27')]===''){throw new db['Sequelize'][(_0x8716('0x2c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8716('0x34')](_0x2a40ec[_0x8716('0x27')][_0x8716('0x37')])){throw new db[(_0x8716('0x2b'))][(_0x8716('0x2c'))](_0x8716('0x38')+_0x4f06cd);}if(!_[_0x8716('0x39')](_0x4f06cd,_0x2a40ec['body'][_0x8716('0x37')])){throw new db[(_0x8716('0x2b'))][(_0x8716('0x2c'))](_0x8716('0x3a')+_0x4f06cd);}_0x1f0661[_0x2a40ec[_0x8716('0x27')][_0x8716('0x37')]]=_0x2a40ec[_0x8716('0x27')][_0x8716('0x35')];})[_0x8716('0x11')](function(){return db[_0x8716('0x1d')][_0x8716('0x3b')]({'where':{'id':_0x2a40ec[_0x8716('0x3c')]['id']},'include':[{'model':db[_0x8716('0x3d')],'as':'List','include':[{'model':db[_0x8716('0x29')],'as':_0x8716('0x3e'),'where':_0x1f0661,'limit':0x1,'order':[[_0x8716('0x31'),_0x8716('0x3f')]]}]},{'model':db[_0x8716('0x40')],'as':_0x8716('0x41')}]});})['then'](function(_0xbaf9af){if(_0xbaf9af&&_0xbaf9af['List']){var _0x18ce77=_0xbaf9af['get']({'plain':!![]});_0x567c7e[_0x8716('0x3c')]=_0x18ce77;_0x567c7e[_0x8716('0x42')]=_0x18ce77[_0x8716('0x41')];_0x567c7e[_0x8716('0x43')]=_0x18ce77[_0x8716('0x44')];_0x567c7e['applications']=_[_0x8716('0x45')](_0x567c7e[_0x8716('0x42')],[_0x8716('0x46')],[_0x8716('0x47')]);if(_0x567c7e[_0x8716('0x3c')][_0x8716('0x41')]){delete _0x567c7e['account'][_0x8716('0x41')];}if(_0x567c7e[_0x8716('0x3c')][_0x8716('0x44')]&&_0x567c7e[_0x8716('0x3c')]['List'][_0x8716('0x3e')]['length']){return _0x567c7e[_0x8716('0x3c')][_0x8716('0x44')]['Contacts'][0x0];}var _0x3e70ad=_[_0x8716('0xc')](_0x2a40ec[_0x8716('0x27')],{'firstName':_0x2a40ec['body'][_0x8716('0x35')],'ListId':_0x18ce77['ListId']});_0x3e70ad[_0x2a40ec[_0x8716('0x27')]['mapKey']]=_0x2a40ec[_0x8716('0x27')][_0x8716('0x35')];return db[_0x8716('0x29')]['create'](_0x3e70ad,{'fields':_0x4a506a,'raw':!![]});}})[_0x8716('0x11')](function(_0x326760){_0x567c7e[_0x8716('0x48')]=_0x326760;if(_0x326760){var _0x9bb633={'ContactId':_0x326760['id'],'FaxAccountId':_0x2a40ec[_0x8716('0x3c')]['id'],'fax':_0x326760[_0x8716('0x28')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x326760['id'],'closed':![],'FaxAccountId':_0x2a40ec[_0x8716('0x3c')]['id']}})['then'](function(_0x447ea3){if(_0x447ea3){return[_0x447ea3,![]];}return db[_0x8716('0x49')][_0x8716('0x4a')](_0x9bb633)[_0x8716('0x11')](function(_0x4142e1){return[_0x4142e1,!![]];});});}else{throw new Error(_0x8716('0x4b'));}})['spread'](function(_0x3297de,_0x1f1ca5){var _0x1c8733=_0x3297de[_0x8716('0x4c')]({'plain':!![]});if(_0x1f1ca5){if(_0x567c7e[_0x8716('0x3c')]['autoclose']){_0x567c7e[_0x8716('0x42')][_0x8716('0x4d')]({'id':0x0,'priority':_0x567c7e[_0x8716('0x42')][_0x8716('0x4e')]+0x1,'app':'close','appdata':_0x8716('0x4f'),'interval':_0x8716('0x50')});}_0x1c8733[_0x8716('0x51')]=!![];}else{_0x1c8733[_0x8716('0x51')]=![];}_0x567c7e[_0x8716('0x52')]=_0x1c8733;return db[_0x8716('0x53')][_0x8716('0x4a')]({'body':_0x2a40ec['body'][_0x8716('0x27')],'FaxAccountId':_0x2a40ec[_0x8716('0x3c')]['id'],'FaxInteractionId':_0x3297de['id'],'direction':'in','ContactId':_0x3297de[_0x8716('0x54')],'AttachmentId':_0x2a40ec[_0x8716('0x27')]['AttachmentId']});})['then'](function(_0x5458bb){_0x567c7e[_0x8716('0x19')]=_0x5458bb;if(!_0x567c7e[_0x8716('0x52')][_0x8716('0x55')])return;return db[_0x8716('0x56')][_0x8716('0x3b')]({'attributes':['id',_0x8716('0x57')],'where':{'id':_0x567c7e['interaction'][_0x8716('0x55')]}});})[_0x8716('0x11')](function(_0x3fd6f0){if(_0x3fd6f0){_0x567c7e['applications'][_0x8716('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3fd6f0[_0x8716('0x57')]+','+(_0x567c7e[_0x8716('0x3c')][_0x8716('0x59')]||0xa),'interval':'*,*,*,*'});}if(!_0x567c7e[_0x8716('0x52')]['queueId'])return;return db['FaxQueue'][_0x8716('0x3b')]({'attributes':['id',_0x8716('0x57')],'where':{'id':_0x567c7e[_0x8716('0x52')][_0x8716('0x5a')]}});})[_0x8716('0x11')](function(_0x20cdd4){if(_0x20cdd4){_0x567c7e['applications'][_0x8716('0x58')]({'id':0x0,'priority':0x1,'app':_0x8716('0x5b'),'appdata':_0x20cdd4[_0x8716('0x57')]+','+(_0x567c7e[_0x8716('0x3c')][_0x8716('0x5c')]||0x12c),'interval':_0x8716('0x50')});}return respondWithRpcPromise(_0x8716('0x5d'),'startRouting',_0x567c7e);})[_0x8716('0x11')](function(_0x169d18){_0x496370(_0x169d18);})[_0x8716('0x26')](function(_0x42e109){_0x369f04(_0x195402[_0x8716('0x17')](0x1f4,_0x42e109['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index baa09f9..8c89d91 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 _0xc779=['emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x3cb36e,_0x28cd2b){var _0x460aad=function(_0x562350){while(--_0x562350){_0x3cb36e['push'](_0x3cb36e['shift']());}};_0x460aad(++_0x28cd2b);}(_0xc779,0x162));var _0x9c77=function(_0xf321d2,_0x38997f){_0xf321d2=_0xf321d2-0x0;var _0x2ed5c5=_0xc779[_0xf321d2];return _0x2ed5c5;};'use strict';var FaxAccountEvents=require(_0x9c77('0x0'));var events=[_0x9c77('0x1'),_0x9c77('0x2'),'update'];function createListener(_0x58eea6,_0x2918b7){return function(_0x2c75c0){_0x2918b7[_0x9c77('0x3')](_0x58eea6,_0x2c75c0);};}function removeListener(_0x17dbd3,_0x7915c9){return function(){FaxAccountEvents[_0x9c77('0x4')](_0x17dbd3,_0x7915c9);};}exports['register']=function(_0xb6914b){for(var _0xbf96ca=0x0,_0x58d6a2=events[_0x9c77('0x5')];_0xbf96ca<_0x58d6a2;_0xbf96ca++){var _0x18d96b=events[_0xbf96ca];var _0x57c969=createListener(_0x9c77('0x6')+_0x18d96b,_0xb6914b);FaxAccountEvents['on'](_0x18d96b,_0x57c969);}}; \ No newline at end of file +var _0x4cba=['save','remove','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x2bf663,_0x2b97ba){var _0x143f7b=function(_0x433f0d){while(--_0x433f0d){_0x2bf663['push'](_0x2bf663['shift']());}};_0x143f7b(++_0x2b97ba);}(_0x4cba,0x141));var _0xa4cb=function(_0x1e68bb,_0x389857){_0x1e68bb=_0x1e68bb-0x0;var _0x22a1de=_0x4cba[_0x1e68bb];return _0x22a1de;};'use strict';var FaxAccountEvents=require(_0xa4cb('0x0'));var events=[_0xa4cb('0x1'),_0xa4cb('0x2'),'update'];function createListener(_0x1a3189,_0x20d740){return function(_0x49b2d1){_0x20d740['emit'](_0x1a3189,_0x49b2d1);};}function removeListener(_0x2694c4,_0x15e827){return function(){FaxAccountEvents[_0xa4cb('0x3')](_0x2694c4,_0x15e827);};}exports[_0xa4cb('0x4')]=function(_0x5d9541){for(var _0x599035=0x0,_0x302223=events[_0xa4cb('0x5')];_0x599035<_0x302223;_0x599035++){var _0xf7d00=events[_0x599035];var _0x181ce5=createListener(_0xa4cb('0x6')+_0xf7d00,_0x5d9541);FaxAccountEvents['on'](_0xf7d00,_0x181ce5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 289aecc..f65d87c 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 _0xbbeb=['/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','update','delete','/:id','destroy','removeDispositions','removeAnswers','/:id/users','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','/describe','describe','get','show','/:id/dispositions','getDispositions','getAnswers','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','addDisposition','/:id/canned_answers','/:id/interactions','addInteraction','addApplications','/addaccountapplications'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xbbeb,0x86));var _0xbbbe=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0xbbeb[_0x3145af];return _0x37758a;};'use strict';var multer=require(_0xbbbe('0x0'));var util=require('util');var path=require(_0xbbbe('0x1'));var timeout=require(_0xbbbe('0x2'));var express=require(_0xbbbe('0x3'));var router=express[_0xbbbe('0x4')]();var fs_extra=require(_0xbbbe('0x5'));var auth=require(_0xbbbe('0x6'));var interaction=require(_0xbbbe('0x7'));var config=require(_0xbbbe('0x8'));var controller=require(_0xbbbe('0x9'));router['get']('/',auth[_0xbbbe('0xa')](),controller['index']);router['get'](_0xbbbe('0xb'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0xc')]);router[_0xbbbe('0xd')]('/:id',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0xe')]);router[_0xbbbe('0xd')](_0xbbbe('0xf'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x10')]);router[_0xbbbe('0xd')]('/:id/canned_answers',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x11')]);router['get']('/:id/interactions',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x12')]);router['get'](_0xbbbe('0x13'),auth[_0xbbbe('0xa')](),controller['getApplications']);router[_0xbbbe('0xd')](_0xbbbe('0x14'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x15')]);router[_0xbbbe('0xd')]('/:id/users',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x16')]);router[_0xbbbe('0x17')]('/',auth[_0xbbbe('0xa')](),controller['create']);router[_0xbbbe('0x17')]('/:id/dispositions',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x18')]);router[_0xbbbe('0x17')](_0xbbbe('0x19'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xbbbe('0x17')](_0xbbbe('0x1a'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x1b')]);router[_0xbbbe('0x17')](_0xbbbe('0x13'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x1c')]);router[_0xbbbe('0x17')](_0xbbbe('0x1d'),auth[_0xbbbe('0xa')](),controller['addAccountApplications']);router[_0xbbbe('0x17')](_0xbbbe('0x1e'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x1f')]);router['post'](_0xbbbe('0x20'),auth[_0xbbbe('0xa')](),controller['send']);router[_0xbbbe('0x17')]('/:id/users',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x21')]);router['put']('/:id',auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x22')]);router[_0xbbbe('0x23')](_0xbbbe('0x24'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x25')]);router[_0xbbbe('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbbbe('0x26')]);router[_0xbbbe('0x23')](_0xbbbe('0x19'),auth[_0xbbbe('0xa')](),controller[_0xbbbe('0x27')]);router[_0xbbbe('0x23')](_0xbbbe('0x28'),auth[_0xbbbe('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8c18=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','addDisposition','addInteraction','addApplications','/updateaccountapplications','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x480efa,_0x210d86){var _0x42786d=function(_0x5599f6){while(--_0x5599f6){_0x480efa['push'](_0x480efa['shift']());}};_0x42786d(++_0x210d86);}(_0x8c18,0x1ab));var _0x88c1=function(_0x1f0f2b,_0x4a0cf9){_0x1f0f2b=_0x1f0f2b-0x0;var _0x195976=_0x8c18[_0x1f0f2b];return _0x195976;};'use strict';var multer=require(_0x88c1('0x0'));var util=require(_0x88c1('0x1'));var path=require('path');var timeout=require(_0x88c1('0x2'));var express=require(_0x88c1('0x3'));var router=express[_0x88c1('0x4')]();var fs_extra=require(_0x88c1('0x5'));var auth=require(_0x88c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x88c1('0x7'));var controller=require(_0x88c1('0x8'));router[_0x88c1('0x9')]('/',auth[_0x88c1('0xa')](),controller[_0x88c1('0xb')]);router[_0x88c1('0x9')](_0x88c1('0xc'),auth['isAuthenticated'](),controller[_0x88c1('0xd')]);router['get'](_0x88c1('0xe'),auth[_0x88c1('0xa')](),controller['show']);router[_0x88c1('0x9')](_0x88c1('0xf'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x10')]);router[_0x88c1('0x9')](_0x88c1('0x11'),auth['isAuthenticated'](),controller[_0x88c1('0x12')]);router['get'](_0x88c1('0x13'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x14')]);router[_0x88c1('0x9')](_0x88c1('0x15'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x16')]);router[_0x88c1('0x9')]('/:id/messages',auth[_0x88c1('0xa')](),controller[_0x88c1('0x17')]);router[_0x88c1('0x9')](_0x88c1('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0x88c1('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x88c1('0x19')](_0x88c1('0xf'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x1a')]);router[_0x88c1('0x19')]('/:id/canned_answers',auth[_0x88c1('0xa')](),controller['addAnswer']);router['post'](_0x88c1('0x13'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x1b')]);router['post'](_0x88c1('0x15'),auth['isAuthenticated'](),controller[_0x88c1('0x1c')]);router[_0x88c1('0x19')]('/addaccountapplications',auth[_0x88c1('0xa')](),controller['addAccountApplications']);router[_0x88c1('0x19')](_0x88c1('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x88c1('0x19')](_0x88c1('0x1e'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x1f')]);router[_0x88c1('0x19')](_0x88c1('0x18'),auth[_0x88c1('0xa')](),controller['addAgents']);router[_0x88c1('0x20')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x88c1('0x21')]('/:id',auth[_0x88c1('0xa')](),controller[_0x88c1('0x22')]);router[_0x88c1('0x21')](_0x88c1('0xf'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x23')]);router[_0x88c1('0x21')](_0x88c1('0x11'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x24')]);router[_0x88c1('0x21')](_0x88c1('0x18'),auth[_0x88c1('0xa')](),controller[_0x88c1('0x25')]);module[_0x88c1('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d1b319d..9a300f0 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 _0xffa7=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x5e4ae1,_0x5977b5){var _0x12aa32=function(_0x18d2aa){while(--_0x18d2aa){_0x5e4ae1['push'](_0x5e4ae1['shift']());}};_0x12aa32(++_0x5977b5);}(_0xffa7,0xa1));var _0x7ffa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xffa7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7ffa('0x0'));module[_0x7ffa('0x1')]={'priority':{'type':Sequelize[_0x7ffa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7ffa('0x3')],'allowNull':![],'defaultValue':_0x7ffa('0x4')},'appdata':{'type':Sequelize[_0x7ffa('0x5')]()},'description':{'type':Sequelize[_0x7ffa('0x3')]},'interval':{'type':Sequelize[_0x7ffa('0x3')],'defaultValue':_0x7ffa('0x6')}}; \ No newline at end of file +var _0x4e3d=['STRING','TEXT','sequelize','exports'];(function(_0x8269ae,_0xcd8119){var _0x1e733d=function(_0x1365df){while(--_0x1365df){_0x8269ae['push'](_0x8269ae['shift']());}};_0x1e733d(++_0xcd8119);}(_0x4e3d,0x102));var _0xd4e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4e3d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xd4e3('0x0'));module[_0xd4e3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd4e3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd4e3('0x3')]()},'description':{'type':Sequelize[_0xd4e3('0x2')]},'interval':{'type':Sequelize[_0xd4e3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 90de096..7eadc3b 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 _0x0ef3=['FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','map'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0ef3,0x19c));var _0x30ef=function(_0x3ab6cb,_0x591249){_0x3ab6cb=_0x3ab6cb-0x0;var _0x108ae5=_0x0ef3[_0x3ab6cb];return _0x108ae5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30ef('0x0'));var zipdir=require(_0x30ef('0x1'));var jsonpatch=require(_0x30ef('0x2'));var rp=require(_0x30ef('0x3'));var moment=require(_0x30ef('0x4'));var BPromise=require(_0x30ef('0x5'));var Mustache=require(_0x30ef('0x6'));var util=require('util');var path=require(_0x30ef('0x7'));var sox=require(_0x30ef('0x8'));var csv=require('to-csv');var ejs=require(_0x30ef('0x9'));var fs=require('fs');var fs_extra=require(_0x30ef('0xa'));var _=require(_0x30ef('0xb'));var squel=require('squel');var crypto=require(_0x30ef('0xc'));var jsforce=require(_0x30ef('0xd'));var deskjs=require(_0x30ef('0xe'));var toCsv=require(_0x30ef('0xf'));var querystring=require(_0x30ef('0x10'));var Papa=require(_0x30ef('0x11'));var Redis=require(_0x30ef('0x12'));var authService=require(_0x30ef('0x13'));var qs=require(_0x30ef('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30ef('0x15'));var logger=require(_0x30ef('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x30ef('0x17'));var db=require(_0x30ef('0x18'))['db'];function respondWithStatusCode(_0x2f188e,_0x28a781){_0x28a781=_0x28a781||0xcc;return function(_0x315428){if(_0x315428){return _0x2f188e[_0x30ef('0x19')](_0x28a781);}return _0x2f188e[_0x30ef('0x1a')](_0x28a781)[_0x30ef('0x1b')]();};}function respondWithResult(_0x4cf6dd,_0x4839ef){_0x4839ef=_0x4839ef||0xc8;return function(_0x138cda){if(_0x138cda){return _0x4cf6dd[_0x30ef('0x1a')](_0x4839ef)[_0x30ef('0x1c')](_0x138cda);}};}function respondWithFilteredResult(_0x1cf9d8,_0x4c6933){return function(_0x149e2a){if(_0x149e2a){var _0x28b343=typeof _0x4c6933[_0x30ef('0x1d')]===_0x30ef('0x1e')&&typeof _0x4c6933['limit']==='undefined';var _0x5ed4de=_0x149e2a[_0x30ef('0x1f')];var _0x458144=_0x28b343?0x0:_0x4c6933[_0x30ef('0x1d')];var _0x3437b2=_0x28b343?_0x149e2a[_0x30ef('0x1f')]:_0x4c6933[_0x30ef('0x1d')]+_0x4c6933[_0x30ef('0x20')];var _0x77a03e;if(_0x3437b2>=_0x5ed4de){_0x3437b2=_0x5ed4de;_0x77a03e=0xc8;}else{_0x77a03e=0xce;}_0x1cf9d8[_0x30ef('0x1a')](_0x77a03e);return _0x1cf9d8[_0x30ef('0x21')](_0x30ef('0x22'),_0x458144+'-'+_0x3437b2+'/'+_0x5ed4de)[_0x30ef('0x1c')](_0x149e2a);}return null;};}function patchUpdates(_0xb2e4c6){return function(_0x266502){try{jsonpatch[_0x30ef('0x23')](_0x266502,_0xb2e4c6,!![]);}catch(_0x6f8eaf){return BPromise[_0x30ef('0x24')](_0x6f8eaf);}return _0x266502['save']();};}function saveUpdates(_0x4c0b8b,_0x581b74){return function(_0x541c0e){if(_0x541c0e){return _0x541c0e['update'](_0x4c0b8b)['then'](function(_0x2856a0){return _0x2856a0;});}return null;};}function removeEntity(_0x29260f,_0x5376a3){return function(_0x707ca1){if(_0x707ca1){return _0x707ca1[_0x30ef('0x25')]()[_0x30ef('0x26')](function(){_0x29260f[_0x30ef('0x1a')](0xcc)[_0x30ef('0x1b')]();});}};}function handleEntityNotFound(_0x1defad,_0x5d8250){return function(_0x2b21de){if(!_0x2b21de){_0x1defad[_0x30ef('0x19')](0x194);}return _0x2b21de;};}function handleError(_0x6a3dd1,_0x5dafd3){_0x5dafd3=_0x5dafd3||0x1f4;return function(_0x49003c){logger[_0x30ef('0x27')](_0x49003c[_0x30ef('0x28')]);if(_0x49003c['name']){delete _0x49003c[_0x30ef('0x29')];}_0x6a3dd1[_0x30ef('0x1a')](_0x5dafd3)[_0x30ef('0x2a')](_0x49003c);};}exports['index']=function(_0x31b7dd,_0x34d930){var _0x40e06f={},_0x1e8dd6={},_0x59f032={'count':0x0,'rows':[]};var _0x1e4b1e=_[_0x30ef('0x2b')](db[_0x30ef('0x2c')][_0x30ef('0x2d')],function(_0x4edafd){return{'name':_0x4edafd[_0x30ef('0x2e')],'type':_0x4edafd[_0x30ef('0x2f')][_0x30ef('0x30')]};});_0x1e8dd6[_0x30ef('0x31')]=_['map'](_0x1e4b1e,'name');_0x1e8dd6[_0x30ef('0x32')]=_[_0x30ef('0x33')](_0x31b7dd[_0x30ef('0x32')]);_0x1e8dd6[_0x30ef('0x34')]=_[_0x30ef('0x35')](_0x1e8dd6[_0x30ef('0x31')],_0x1e8dd6[_0x30ef('0x32')]);_0x40e06f['attributes']=_[_0x30ef('0x35')](_0x1e8dd6['model'],qs['fields'](_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x36')]));_0x40e06f['attributes']=_0x40e06f['attributes'][_0x30ef('0x37')]?_0x40e06f[_0x30ef('0x38')]:_0x1e8dd6['model'];if(!_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x39')]('nolimit')){_0x40e06f[_0x30ef('0x20')]=qs[_0x30ef('0x20')](_0x31b7dd['query']['limit']);_0x40e06f[_0x30ef('0x1d')]=qs[_0x30ef('0x1d')](_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x1d')]);}_0x40e06f[_0x30ef('0x3a')]=qs[_0x30ef('0x3b')](_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x3b')]);_0x40e06f[_0x30ef('0x3c')]=qs['filters'](_[_0x30ef('0x3d')](_0x31b7dd[_0x30ef('0x32')],_0x1e8dd6[_0x30ef('0x34')]),_0x1e4b1e);if(_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x3e')]){_0x40e06f[_0x30ef('0x3c')]=_['merge'](_0x40e06f[_0x30ef('0x3c')],{'$or':_[_0x30ef('0x2b')](_0x1e4b1e,function(_0x5b5dbd){if(_0x5b5dbd['type']!=='VIRTUAL'){var _0x30d2d9={};_0x30d2d9[_0x5b5dbd[_0x30ef('0x29')]]={'$like':'%'+_0x31b7dd[_0x30ef('0x32')][_0x30ef('0x3e')]+'%'};return _0x30d2d9;}})});}_0x40e06f=_[_0x30ef('0x3f')]({},_0x40e06f,_0x31b7dd[_0x30ef('0x40')]);var _0x15eda7={'where':_0x40e06f[_0x30ef('0x3c')]};return db[_0x30ef('0x2c')][_0x30ef('0x1f')](_0x15eda7)[_0x30ef('0x26')](function(_0xdf0b1e){_0x59f032['count']=_0xdf0b1e;if(_0x31b7dd['query']['includeAll']){_0x40e06f['include']=[{'all':!![]}];}return db[_0x30ef('0x2c')][_0x30ef('0x41')](_0x40e06f);})[_0x30ef('0x26')](function(_0x581b17){_0x59f032[_0x30ef('0x42')]=_0x581b17;return _0x59f032;})[_0x30ef('0x26')](respondWithFilteredResult(_0x34d930,_0x40e06f))[_0x30ef('0x43')](handleError(_0x34d930,null));};exports[_0x30ef('0x44')]=function(_0x3811a0,_0xa08bdd){var _0x4f6ad4={'raw':!![],'where':{'id':_0x3811a0[_0x30ef('0x45')]['id']}},_0x4f9543={};_0x4f9543[_0x30ef('0x31')]=_[_0x30ef('0x33')](db[_0x30ef('0x2c')]['rawAttributes']);_0x4f9543[_0x30ef('0x32')]=_[_0x30ef('0x33')](_0x3811a0[_0x30ef('0x32')]);_0x4f9543[_0x30ef('0x34')]=_[_0x30ef('0x35')](_0x4f9543['model'],_0x4f9543['query']);_0x4f6ad4[_0x30ef('0x38')]=_[_0x30ef('0x35')](_0x4f9543[_0x30ef('0x31')],qs[_0x30ef('0x36')](_0x3811a0['query'][_0x30ef('0x36')]));_0x4f6ad4[_0x30ef('0x38')]=_0x4f6ad4[_0x30ef('0x38')][_0x30ef('0x37')]?_0x4f6ad4[_0x30ef('0x38')]:_0x4f9543[_0x30ef('0x31')];if(_0x3811a0['query'][_0x30ef('0x46')]){_0x4f6ad4[_0x30ef('0x47')]=[{'all':!![]}];}_0x4f6ad4=_['merge']({},_0x4f6ad4,_0x3811a0[_0x30ef('0x40')]);return db[_0x30ef('0x2c')][_0x30ef('0x48')](_0x4f6ad4)['then'](handleEntityNotFound(_0xa08bdd,null))[_0x30ef('0x26')](respondWithResult(_0xa08bdd,null))[_0x30ef('0x43')](handleError(_0xa08bdd,null));};exports[_0x30ef('0x49')]=function(_0x564628,_0x1551b3){return db[_0x30ef('0x2c')][_0x30ef('0x49')](_0x564628[_0x30ef('0x4a')],{})[_0x30ef('0x26')](respondWithResult(_0x1551b3,0xc9))[_0x30ef('0x43')](handleError(_0x1551b3,null));};exports[_0x30ef('0x4b')]=function(_0x27af8f,_0x52f229){if(_0x27af8f['body']['id']){delete _0x27af8f[_0x30ef('0x4a')]['id'];}return db['FaxApplication'][_0x30ef('0x48')]({'where':{'id':_0x27af8f[_0x30ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x52f229,null))['then'](saveUpdates(_0x27af8f[_0x30ef('0x4a')],null))[_0x30ef('0x26')](respondWithResult(_0x52f229,null))[_0x30ef('0x43')](handleError(_0x52f229,null));};exports[_0x30ef('0x25')]=function(_0x3b1507,_0x37aa9d){return db[_0x30ef('0x2c')]['find']({'where':{'id':_0x3b1507[_0x30ef('0x45')]['id']}})[_0x30ef('0x26')](handleEntityNotFound(_0x37aa9d,null))[_0x30ef('0x26')](removeEntity(_0x37aa9d,null))[_0x30ef('0x43')](handleError(_0x37aa9d,null));}; \ No newline at end of file +var _0x48ad=['request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch'];(function(_0x1e5ad0,_0x58ffe3){var _0x46da3b=function(_0x37d2f6){while(--_0x37d2f6){_0x1e5ad0['push'](_0x1e5ad0['shift']());}};_0x46da3b(++_0x58ffe3);}(_0x48ad,0xdb));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd48a('0x0'));var rimraf=require(_0xd48a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd48a('0x2'));var rp=require(_0xd48a('0x3'));var moment=require(_0xd48a('0x4'));var BPromise=require(_0xd48a('0x5'));var Mustache=require(_0xd48a('0x6'));var util=require(_0xd48a('0x7'));var path=require('path');var sox=require(_0xd48a('0x8'));var csv=require(_0xd48a('0x9'));var ejs=require(_0xd48a('0xa'));var fs=require('fs');var fs_extra=require(_0xd48a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd48a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd48a('0xd'));var toCsv=require(_0xd48a('0x9'));var querystring=require(_0xd48a('0xe'));var Papa=require(_0xd48a('0xf'));var Redis=require('ioredis');var authService=require(_0xd48a('0x10'));var qs=require(_0xd48a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd48a('0x12'));var logger=require(_0xd48a('0x13'))(_0xd48a('0x14'));var utils=require(_0xd48a('0x15'));var config=require(_0xd48a('0x16'));var licenseUtil=require(_0xd48a('0x17'));var db=require(_0xd48a('0x18'))['db'];function respondWithStatusCode(_0x1a5c42,_0x2d7e6e){_0x2d7e6e=_0x2d7e6e||0xcc;return function(_0x4ade0d){if(_0x4ade0d){return _0x1a5c42['sendStatus'](_0x2d7e6e);}return _0x1a5c42[_0xd48a('0x19')](_0x2d7e6e)['end']();};}function respondWithResult(_0x1768fe,_0x35005){_0x35005=_0x35005||0xc8;return function(_0x2cb04a){if(_0x2cb04a){return _0x1768fe[_0xd48a('0x19')](_0x35005)[_0xd48a('0x1a')](_0x2cb04a);}};}function respondWithFilteredResult(_0x1d0bea,_0x46d4a6){return function(_0x4024ac){if(_0x4024ac){var _0x186a6d=typeof _0x46d4a6[_0xd48a('0x1b')]===_0xd48a('0x1c')&&typeof _0x46d4a6[_0xd48a('0x1d')]===_0xd48a('0x1c');var _0xdd8ebb=_0x4024ac['count'];var _0x456d39=_0x186a6d?0x0:_0x46d4a6[_0xd48a('0x1b')];var _0x1a7453=_0x186a6d?_0x4024ac[_0xd48a('0x1e')]:_0x46d4a6[_0xd48a('0x1b')]+_0x46d4a6['limit'];var _0x1e394c;if(_0x1a7453>=_0xdd8ebb){_0x1a7453=_0xdd8ebb;_0x1e394c=0xc8;}else{_0x1e394c=0xce;}_0x1d0bea['status'](_0x1e394c);return _0x1d0bea[_0xd48a('0x1f')](_0xd48a('0x20'),_0x456d39+'-'+_0x1a7453+'/'+_0xdd8ebb)[_0xd48a('0x1a')](_0x4024ac);}return null;};}function patchUpdates(_0xeef3cc){return function(_0x46284e){try{jsonpatch[_0xd48a('0x21')](_0x46284e,_0xeef3cc,!![]);}catch(_0x437513){return BPromise['reject'](_0x437513);}return _0x46284e[_0xd48a('0x22')]();};}function saveUpdates(_0x52533c,_0x5644ad){return function(_0x4eeeca){if(_0x4eeeca){return _0x4eeeca[_0xd48a('0x23')](_0x52533c)[_0xd48a('0x24')](function(_0x545a1e){return _0x545a1e;});}return null;};}function removeEntity(_0x144171,_0x33822c){return function(_0x23563a){if(_0x23563a){return _0x23563a[_0xd48a('0x25')]()['then'](function(){_0x144171[_0xd48a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110c8f,_0xadb9d5){return function(_0x1e6f22){if(!_0x1e6f22){_0x110c8f['sendStatus'](0x194);}return _0x1e6f22;};}function handleError(_0x493368,_0x20125b){_0x20125b=_0x20125b||0x1f4;return function(_0x6e9d26){logger[_0xd48a('0x26')](_0x6e9d26[_0xd48a('0x27')]);if(_0x6e9d26['name']){delete _0x6e9d26[_0xd48a('0x28')];}_0x493368['status'](_0x20125b)['send'](_0x6e9d26);};}exports[_0xd48a('0x29')]=function(_0x568e5e,_0x200247){var _0xd2d741={},_0x1c224f={},_0x5295e1={'count':0x0,'rows':[]};var _0x2e4766=_[_0xd48a('0x2a')](db[_0xd48a('0x2b')][_0xd48a('0x2c')],function(_0xb700ba){return{'name':_0xb700ba[_0xd48a('0x2d')],'type':_0xb700ba[_0xd48a('0x2e')][_0xd48a('0x2f')]};});_0x1c224f[_0xd48a('0x30')]=_[_0xd48a('0x2a')](_0x2e4766,_0xd48a('0x28'));_0x1c224f[_0xd48a('0x31')]=_['keys'](_0x568e5e['query']);_0x1c224f['filters']=_[_0xd48a('0x32')](_0x1c224f[_0xd48a('0x30')],_0x1c224f[_0xd48a('0x31')]);_0xd2d741[_0xd48a('0x33')]=_[_0xd48a('0x32')](_0x1c224f[_0xd48a('0x30')],qs[_0xd48a('0x34')](_0x568e5e[_0xd48a('0x31')]['fields']));_0xd2d741[_0xd48a('0x33')]=_0xd2d741[_0xd48a('0x33')][_0xd48a('0x35')]?_0xd2d741['attributes']:_0x1c224f[_0xd48a('0x30')];if(!_0x568e5e['query'][_0xd48a('0x36')](_0xd48a('0x37'))){_0xd2d741[_0xd48a('0x1d')]=qs[_0xd48a('0x1d')](_0x568e5e[_0xd48a('0x31')][_0xd48a('0x1d')]);_0xd2d741['offset']=qs['offset'](_0x568e5e['query'][_0xd48a('0x1b')]);}_0xd2d741['order']=qs[_0xd48a('0x38')](_0x568e5e[_0xd48a('0x31')][_0xd48a('0x38')]);_0xd2d741[_0xd48a('0x39')]=qs[_0xd48a('0x3a')](_[_0xd48a('0x3b')](_0x568e5e[_0xd48a('0x31')],_0x1c224f['filters']),_0x2e4766);if(_0x568e5e['query'][_0xd48a('0x3c')]){_0xd2d741['where']=_[_0xd48a('0x3d')](_0xd2d741['where'],{'$or':_[_0xd48a('0x2a')](_0x2e4766,function(_0x361809){if(_0x361809[_0xd48a('0x2e')]!==_0xd48a('0x3e')){var _0x374b4c={};_0x374b4c[_0x361809[_0xd48a('0x28')]]={'$like':'%'+_0x568e5e['query'][_0xd48a('0x3c')]+'%'};return _0x374b4c;}})});}_0xd2d741=_[_0xd48a('0x3d')]({},_0xd2d741,_0x568e5e[_0xd48a('0x3f')]);var _0x181a75={'where':_0xd2d741['where']};return db[_0xd48a('0x2b')][_0xd48a('0x1e')](_0x181a75)[_0xd48a('0x24')](function(_0x2394f6){_0x5295e1[_0xd48a('0x1e')]=_0x2394f6;if(_0x568e5e[_0xd48a('0x31')]['includeAll']){_0xd2d741[_0xd48a('0x40')]=[{'all':!![]}];}return db[_0xd48a('0x2b')][_0xd48a('0x41')](_0xd2d741);})[_0xd48a('0x24')](function(_0x183912){_0x5295e1[_0xd48a('0x42')]=_0x183912;return _0x5295e1;})['then'](respondWithFilteredResult(_0x200247,_0xd2d741))[_0xd48a('0x43')](handleError(_0x200247,null));};exports['show']=function(_0x183940,_0x395ec2){var _0x1cec5c={'raw':!![],'where':{'id':_0x183940[_0xd48a('0x44')]['id']}},_0x43f8e6={};_0x43f8e6[_0xd48a('0x30')]=_[_0xd48a('0x45')](db[_0xd48a('0x2b')]['rawAttributes']);_0x43f8e6['query']=_[_0xd48a('0x45')](_0x183940['query']);_0x43f8e6[_0xd48a('0x3a')]=_['intersection'](_0x43f8e6[_0xd48a('0x30')],_0x43f8e6[_0xd48a('0x31')]);_0x1cec5c[_0xd48a('0x33')]=_[_0xd48a('0x32')](_0x43f8e6[_0xd48a('0x30')],qs['fields'](_0x183940[_0xd48a('0x31')][_0xd48a('0x34')]));_0x1cec5c['attributes']=_0x1cec5c[_0xd48a('0x33')]['length']?_0x1cec5c[_0xd48a('0x33')]:_0x43f8e6['model'];if(_0x183940['query'][_0xd48a('0x46')]){_0x1cec5c['include']=[{'all':!![]}];}_0x1cec5c=_[_0xd48a('0x3d')]({},_0x1cec5c,_0x183940[_0xd48a('0x3f')]);return db[_0xd48a('0x2b')][_0xd48a('0x47')](_0x1cec5c)[_0xd48a('0x24')](handleEntityNotFound(_0x395ec2,null))['then'](respondWithResult(_0x395ec2,null))[_0xd48a('0x43')](handleError(_0x395ec2,null));};exports[_0xd48a('0x48')]=function(_0x2ef1fd,_0x4b39be){return db[_0xd48a('0x2b')][_0xd48a('0x48')](_0x2ef1fd[_0xd48a('0x49')],{})['then'](respondWithResult(_0x4b39be,0xc9))[_0xd48a('0x43')](handleError(_0x4b39be,null));};exports[_0xd48a('0x23')]=function(_0x4d888a,_0x3d97e9){if(_0x4d888a['body']['id']){delete _0x4d888a['body']['id'];}return db['FaxApplication'][_0xd48a('0x47')]({'where':{'id':_0x4d888a['params']['id']}})[_0xd48a('0x24')](handleEntityNotFound(_0x3d97e9,null))[_0xd48a('0x24')](saveUpdates(_0x4d888a[_0xd48a('0x49')],null))['then'](respondWithResult(_0x3d97e9,null))['catch'](handleError(_0x3d97e9,null));};exports[_0xd48a('0x25')]=function(_0x11b2ef,_0x5ced66){return db[_0xd48a('0x2b')][_0xd48a('0x47')]({'where':{'id':_0x11b2ef[_0xd48a('0x44')]['id']}})[_0xd48a('0x24')](handleEntityNotFound(_0x5ced66,null))[_0xd48a('0x24')](removeEntity(_0x5ced66,null))[_0xd48a('0x43')](handleError(_0x5ced66,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d4d2df4..0952d7e 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 _0x89aa=['./faxApplication.attributes','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e408f,_0x1b0597){var _0x47b20c=function(_0x4dc05f){while(--_0x4dc05f){_0x3e408f['push'](_0x3e408f['shift']());}};_0x47b20c(++_0x1b0597);}(_0x89aa,0x18f));var _0xa89a=function(_0x4a1462,_0x376e44){_0x4a1462=_0x4a1462-0x0;var _0xf0b742=_0x89aa[_0x4a1462];return _0xf0b742;};'use strict';var _=require(_0xa89a('0x0'));var util=require(_0xa89a('0x1'));var logger=require(_0xa89a('0x2'))(_0xa89a('0x3'));var moment=require(_0xa89a('0x4'));var BPromise=require(_0xa89a('0x5'));var rp=require(_0xa89a('0x6'));var fs=require('fs');var path=require(_0xa89a('0x7'));var rimraf=require(_0xa89a('0x8'));var config=require('../../config/environment');var attributes=require(_0xa89a('0x9'));module['exports']=function(_0x2910b6,_0x4d487b){return _0x2910b6[_0xa89a('0xa')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa89a('0xb')});}; \ No newline at end of file +var _0xabfc=['define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4f004f,_0x3ec1ca){var _0x3cd3bf=function(_0x3e7ad8){while(--_0x3e7ad8){_0x4f004f['push'](_0x4f004f['shift']());}};_0x3cd3bf(++_0x3ec1ca);}(_0xabfc,0x90));var _0xcabf=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0xabfc[_0x344adc];return _0x4014b2;};'use strict';var _=require(_0xcabf('0x0'));var util=require('util');var logger=require(_0xcabf('0x1'))(_0xcabf('0x2'));var moment=require(_0xcabf('0x3'));var BPromise=require(_0xcabf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcabf('0x5'));var rimraf=require(_0xcabf('0x6'));var config=require(_0xcabf('0x7'));var attributes=require(_0xcabf('0x8'));module[_0xcabf('0x9')]=function(_0x3a5b08,_0x271680){return _0x3a5b08[_0xcabf('0xa')](_0xcabf('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcabf('0xc'),'collate':_0xcabf('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index bbd7f13..ca05f65 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 _0xc541=['rpc','../../config/environment','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','raw','options','where','attributes','limit','then','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0xd1e5fa,_0x4d7da7){var _0x1ca5ed=function(_0x5618e0){while(--_0x5618e0){_0xd1e5fa['push'](_0xd1e5fa['shift']());}};_0x1ca5ed(++_0x4d7da7);}(_0xc541,0x139));var _0x1c54=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xc541[_0x1c8cc6];return _0x522936;};'use strict';var _=require(_0x1c54('0x0'));var util=require(_0x1c54('0x1'));var moment=require(_0x1c54('0x2'));var BPromise=require(_0x1c54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c54('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c54('0x5'));var logger=require(_0x1c54('0x6'))(_0x1c54('0x7'));var config=require(_0x1c54('0x8'));var jayson=require(_0x1c54('0x9'));var client=jayson['client'][_0x1c54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d41a4,_0x5bfef9,_0x22e4e8){return new BPromise(function(_0xf04050,_0xfe6803){return client[_0x1c54('0xb')](_0x2d41a4,_0x22e4e8)['then'](function(_0x2c82fc){logger[_0x1c54('0xc')](_0x1c54('0xd'),_0x5bfef9,_0x1c54('0xe'));logger[_0x1c54('0xf')](_0x1c54('0x10'),_0x5bfef9,_0x1c54('0xe'),JSON['stringify'](_0x2c82fc));if(_0x2c82fc['error']){if(_0x2c82fc[_0x1c54('0x11')]['code']===0x1f4){logger[_0x1c54('0x11')]('FaxApplication,\x20%s,\x20%s',_0x5bfef9,_0x2c82fc[_0x1c54('0x11')][_0x1c54('0x12')]);return _0xfe6803(_0x2c82fc[_0x1c54('0x11')][_0x1c54('0x12')]);}logger['error'](_0x1c54('0xd'),_0x5bfef9,_0x2c82fc['error']['message']);return _0xf04050(_0x2c82fc[_0x1c54('0x11')][_0x1c54('0x12')]);}else{logger[_0x1c54('0xc')](_0x1c54('0xd'),_0x5bfef9,_0x1c54('0xe'));_0xf04050(_0x2c82fc[_0x1c54('0x13')][_0x1c54('0x12')]);}})[_0x1c54('0x14')](function(_0x5c939a){logger[_0x1c54('0x11')](_0x1c54('0xd'),_0x5bfef9,_0x5c939a);_0xfe6803(_0x5c939a);});});}exports[_0x1c54('0x15')]=function(_0x51dffe){var _0x4afca8=this;return new Promise(function(_0x42fe7f,_0x5ab386){return db[_0x1c54('0x16')][_0x1c54('0x17')](_0x51dffe[_0x1c54('0x18')],{'raw':_0x51dffe['options']?_0x51dffe['options'][_0x1c54('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51dffe[_0x1c54('0x1a')]?_0x51dffe[_0x1c54('0x1a')][_0x1c54('0x1b')]||null:null,'attributes':_0x51dffe[_0x1c54('0x1a')]?_0x51dffe[_0x1c54('0x1a')][_0x1c54('0x1c')]||null:null,'limit':_0x51dffe[_0x1c54('0x1a')]?_0x51dffe[_0x1c54('0x1a')][_0x1c54('0x1d')]||null:null})[_0x1c54('0x1e')](function(_0x2a1a08){logger[_0x1c54('0xc')](_0x1c54('0x15'),_0x51dffe);logger[_0x1c54('0xf')]('UpdateFaxApplication',_0x51dffe,JSON[_0x1c54('0x1f')](_0x2a1a08));_0x42fe7f(_0x2a1a08);})[_0x1c54('0x14')](function(_0x3528ba){logger[_0x1c54('0x11')](_0x1c54('0x15'),_0x3528ba[_0x1c54('0x12')],_0x51dffe);_0x5ab386(_0x4afca8[_0x1c54('0x11')](0x1f4,_0x3528ba[_0x1c54('0x12')]));});});}; \ No newline at end of file +var _0x59a8=['UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2d2b84,_0x35aa11){var _0x2e268d=function(_0x2e5026){while(--_0x2e5026){_0x2d2b84['push'](_0x2d2b84['shift']());}};_0x2e268d(++_0x35aa11);}(_0x59a8,0x100));var _0x859a=function(_0x5a8c3f,_0x54bde6){_0x5a8c3f=_0x5a8c3f-0x0;var _0x2a00d1=_0x59a8[_0x5a8c3f];return _0x2a00d1;};'use strict';var _=require(_0x859a('0x0'));var util=require(_0x859a('0x1'));var moment=require(_0x859a('0x2'));var BPromise=require(_0x859a('0x3'));var rs=require(_0x859a('0x4'));var fs=require('fs');var Redis=require(_0x859a('0x5'));var db=require(_0x859a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x859a('0x7'))(_0x859a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x859a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48444d,_0x4c7b96,_0x4c8f3c){return new BPromise(function(_0x317ed8,_0xe8b563){return client[_0x859a('0xa')](_0x48444d,_0x4c8f3c)[_0x859a('0xb')](function(_0x149779){logger[_0x859a('0xc')](_0x859a('0xd'),_0x4c7b96,'request\x20sent');logger[_0x859a('0xe')](_0x859a('0xf'),_0x4c7b96,_0x859a('0x10'),JSON[_0x859a('0x11')](_0x149779));if(_0x149779[_0x859a('0x12')]){if(_0x149779['error'][_0x859a('0x13')]===0x1f4){logger[_0x859a('0x12')](_0x859a('0xd'),_0x4c7b96,_0x149779['error'][_0x859a('0x14')]);return _0xe8b563(_0x149779[_0x859a('0x12')][_0x859a('0x14')]);}logger[_0x859a('0x12')](_0x859a('0xd'),_0x4c7b96,_0x149779[_0x859a('0x12')]['message']);return _0x317ed8(_0x149779[_0x859a('0x12')][_0x859a('0x14')]);}else{logger[_0x859a('0xc')](_0x859a('0xd'),_0x4c7b96,_0x859a('0x10'));_0x317ed8(_0x149779[_0x859a('0x15')][_0x859a('0x14')]);}})[_0x859a('0x16')](function(_0x3a5ab0){logger[_0x859a('0x12')](_0x859a('0xd'),_0x4c7b96,_0x3a5ab0);_0xe8b563(_0x3a5ab0);});});}exports[_0x859a('0x17')]=function(_0x319123){var _0x1624fc=this;return new Promise(function(_0x1ed68e,_0x30a2ca){return db[_0x859a('0x18')][_0x859a('0x19')](_0x319123[_0x859a('0x1a')],{'raw':_0x319123[_0x859a('0x1b')]?_0x319123['options'][_0x859a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319123[_0x859a('0x1b')]?_0x319123['options'][_0x859a('0x1d')]||null:null,'attributes':_0x319123[_0x859a('0x1b')]?_0x319123['options']['attributes']||null:null,'limit':_0x319123[_0x859a('0x1b')]?_0x319123[_0x859a('0x1b')][_0x859a('0x1e')]||null:null})['then'](function(_0x4a163a){logger[_0x859a('0xc')](_0x859a('0x17'),_0x319123);logger[_0x859a('0xe')](_0x859a('0x17'),_0x319123,JSON[_0x859a('0x11')](_0x4a163a));_0x1ed68e(_0x4a163a);})['catch'](function(_0x3a22af){logger[_0x859a('0x12')]('UpdateFaxApplication',_0x3a22af['message'],_0x319123);_0x30a2ca(_0x1624fc[_0x859a('0x12')](0x1f4,_0x3a22af[_0x859a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cf12a97..60850fc 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 _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c264f,_0x571dfa){var _0x57455c=function(_0x5eefbf){while(--_0x5eefbf){_0x5c264f['push'](_0x5c264f['shift']());}};_0x57455c(++_0x571dfa);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x177ec0,_0x326f25){_0x177ec0=_0x177ec0-0x0;var _0x4a2f65=_0xf4f4[_0x177ec0];return _0x4a2f65;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./faxApplication.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x80ed,0x11c));var _0xd80e=function(_0x134c4f,_0x3af7a0){_0x134c4f=_0x134c4f-0x0;var _0x20be0d=_0x80ed[_0x134c4f];return _0x20be0d;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index bc9c595..ea50494 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 _0x6a55=['DATE','ENUM','INTEGER','sequelize','STRING','out'];(function(_0x45549d,_0x1a06b6){var _0x50afdd=function(_0x1d24d0){while(--_0x1d24d0){_0x45549d['push'](_0x45549d['shift']());}};_0x50afdd(++_0x1a06b6);}(_0x6a55,0xdb));var _0x56a5=function(_0x27e7e2,_0x3ddb8a){_0x27e7e2=_0x27e7e2-0x0;var _0x55431f=_0x6a55[_0x27e7e2];return _0x55431f;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x56a5('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x56a5('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x56a5('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x56a5('0x2')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56a5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x56a5('0x4')]('in',_0x56a5('0x2')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x56a5('0x5')]}}; \ No newline at end of file +var _0x5f66=['INTEGER','exports','DATE','STRING','out'];(function(_0x4e36d8,_0x3da157){var _0x38cec0=function(_0x4d38d1){while(--_0x4d38d1){_0x4e36d8['push'](_0x4e36d8['shift']());}};_0x38cec0(++_0x3da157);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x65f6('0x1')]},'disposition':{'type':Sequelize[_0x65f6('0x2')]},'secondDisposition':{'type':Sequelize[_0x65f6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x65f6('0x2')]},'note':{'type':Sequelize[_0x65f6('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x65f6('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x65f6('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x65f6('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x65f6('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b201151..e2b75eb 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 _0x82fa=['emit','faxInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','attachments','push','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','zip-dir','moment','util','path','../../components/interaction/service','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','update','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','fields','attributes','include','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','length','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','format','options','FaxMessage','includeAll','rows','setTags','spread','Tag','color'];(function(_0x5ed1a2,_0x5b70fb){var _0x47f53c=function(_0x264c92){while(--_0x264c92){_0x5ed1a2['push'](_0x5ed1a2['shift']());}};_0x47f53c(++_0x5b70fb);}(_0x82fa,0x140));var _0xa82f=function(_0x4d1b7d,_0x35b291){_0x4d1b7d=_0x4d1b7d-0x0;var _0x6f8f00=_0x82fa[_0x4d1b7d];return _0x6f8f00;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xa82f('0x0'));var moment=require(_0xa82f('0x1'));var BPromise=require('bluebird');var util=require(_0xa82f('0x2'));var path=require(_0xa82f('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xa82f('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa82f('0x5'));var config=require(_0xa82f('0x6'));var db=require(_0xa82f('0x7'))['db'];config['redis']=_[_0xa82f('0x8')](config[_0xa82f('0x9')],{'host':_0xa82f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa82f('0x9')]));require(_0xa82f('0xb'))[_0xa82f('0xc')](socket);function respondWithStatusCode(_0x2883c1,_0x44d95c){_0x44d95c=_0x44d95c||0xcc;return function(_0x1a182e){if(_0x1a182e){return _0x2883c1[_0xa82f('0xd')](_0x44d95c);}return _0x2883c1[_0xa82f('0xe')](_0x44d95c)['end']();};}function respondWithResult(_0x12b1b4,_0x33f5f2){_0x33f5f2=_0x33f5f2||0xc8;return function(_0x5bd91c){if(_0x5bd91c){return _0x12b1b4[_0xa82f('0xe')](_0x33f5f2)[_0xa82f('0xf')](_0x5bd91c);}};}function respondWithFilteredResult(_0x355e7c,_0x5115f8){return function(_0x1aa3ee){if(_0x1aa3ee){var _0x31842f=typeof _0x5115f8['offset']===_0xa82f('0x10')&&typeof _0x5115f8[_0xa82f('0x11')]===_0xa82f('0x10');var _0x466b0c=_0x1aa3ee[_0xa82f('0x12')];var _0x2ecca1=_0x31842f?0x0:_0x5115f8[_0xa82f('0x13')];var _0x41b05d=_0x31842f?_0x1aa3ee[_0xa82f('0x12')]:_0x5115f8[_0xa82f('0x13')]+_0x5115f8['limit'];var _0x202fc0;if(_0x41b05d>=_0x466b0c){_0x41b05d=_0x466b0c;_0x202fc0=0xc8;}else{_0x202fc0=0xce;}_0x355e7c[_0xa82f('0xe')](_0x202fc0);return _0x355e7c[_0xa82f('0x14')]('Content-Range',_0x2ecca1+'-'+_0x41b05d+'/'+_0x466b0c)[_0xa82f('0xf')](_0x1aa3ee);}return null;};}function saveUpdates(_0x5cc9d8){return function(_0x1c1f01){if(_0x1c1f01){return _0x1c1f01[_0xa82f('0x15')](_0x5cc9d8)['then'](function(_0x53022e){return _0x53022e;});}return null;};}function removeEntity(_0x27ba05){return function(_0x3b8d47){if(_0x3b8d47){return _0x3b8d47['destroy']()[_0xa82f('0x16')](function(){_0x27ba05['status'](0xcc)[_0xa82f('0x17')]();});}};}function handleEntityNotFound(_0x2fcac5){return function(_0x4adc1c){if(!_0x4adc1c){_0x2fcac5[_0xa82f('0xd')](0x194);}return _0x4adc1c;};}function handleError(_0x48c48d,_0x3234e4){_0x3234e4=_0x3234e4||0x1f4;return function(_0x2f6807){logger[_0xa82f('0x18')](_0x2f6807[_0xa82f('0x19')]);if(_0x2f6807[_0xa82f('0x1a')]){delete _0x2f6807['name'];}_0x48c48d[_0xa82f('0xe')](_0x3234e4)['send'](_0x2f6807);};}exports[_0xa82f('0x1b')]=function(_0x34adb8,_0x16d6ac){var _0x54804f={};var _0x4c13d4=_['map'](db['FaxInteraction'][_0xa82f('0x1c')],function(_0x3ed7da){return{'name':_0x3ed7da[_0xa82f('0x1d')],'type':_0x3ed7da[_0xa82f('0x1e')][_0xa82f('0x1f')]};});_0x54804f=qs[_0xa82f('0x20')](_0x4c13d4,_0x34adb8);return interaction[_0xa82f('0x21')](_0xa82f('0x22'),_0x34adb8[_0xa82f('0x23')],_0x34adb8[_0xa82f('0x24')],_0x54804f,_0x4c13d4)[_0xa82f('0x16')](respondWithFilteredResult(_0x16d6ac,_0x54804f))[_0xa82f('0x25')](handleError(_0x16d6ac,null));};exports[_0xa82f('0x26')]=function(_0x282363,_0x751a3d){var _0x1a96f6={'raw':![],'where':{'id':_0x282363[_0xa82f('0x27')]['id']}},_0x2e7165={};_0x2e7165[_0xa82f('0x28')]=_[_0xa82f('0x29')](db[_0xa82f('0x2a')][_0xa82f('0x1c')]);_0x2e7165['query']=_[_0xa82f('0x29')](_0x282363['query']);_0x2e7165[_0xa82f('0x2b')]=_[_0xa82f('0x2c')](_0x2e7165[_0xa82f('0x28')],_0x2e7165[_0xa82f('0x23')]);_0x1a96f6['attributes']=_['intersection'](_0x2e7165[_0xa82f('0x28')],qs['fields'](_0x282363[_0xa82f('0x23')][_0xa82f('0x2d')]));_0x1a96f6[_0xa82f('0x2e')]=_0x1a96f6[_0xa82f('0x2e')]['length']?_0x1a96f6[_0xa82f('0x2e')]:_0x2e7165[_0xa82f('0x28')];if(_0x282363[_0xa82f('0x23')]['includeAll']){_0x1a96f6[_0xa82f('0x2f')]=[{'all':!![]}];}_0x1a96f6=_[_0xa82f('0x30')]({},_0x1a96f6,_0x282363['options']);return db[_0xa82f('0x2a')][_0xa82f('0x31')](_0x1a96f6)[_0xa82f('0x16')](handleEntityNotFound(_0x751a3d,null))[_0xa82f('0x16')](respondWithResult(_0x751a3d,null))['catch'](handleError(_0x751a3d,null));};exports[_0xa82f('0x32')]=function(_0x55966e,_0x36b78a){return db['FaxInteraction'][_0xa82f('0x32')](_0x55966e[_0xa82f('0x33')],{})['then'](respondWithResult(_0x36b78a,0xc9))['catch'](handleError(_0x36b78a,null));};exports['update']=function(_0xe84b28,_0x7a4072){if(_0xe84b28[_0xa82f('0x33')]['id']){delete _0xe84b28[_0xa82f('0x33')]['id'];}return db[_0xa82f('0x2a')][_0xa82f('0x31')]({'where':{'id':_0xe84b28[_0xa82f('0x27')]['id']}})[_0xa82f('0x16')](handleEntityNotFound(_0x7a4072,null))['then'](saveUpdates(_0xe84b28[_0xa82f('0x33')],null))['then'](respondWithResult(_0x7a4072,null))[_0xa82f('0x25')](handleError(_0x7a4072,null));};exports['destroy']=function(_0x29514f,_0x3a843b){return db[_0xa82f('0x2a')][_0xa82f('0x31')]({'where':{'id':_0x29514f['params']['id']}})[_0xa82f('0x16')](handleEntityNotFound(_0x3a843b,null))['then'](removeEntity(_0x3a843b,null))[_0xa82f('0x25')](handleError(_0x3a843b,null));};exports[_0xa82f('0x34')]=function(_0x1e59ca,_0x2c3cdf){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0x2c3cdf,null))[_0xa82f('0x25')](handleError(_0x2c3cdf,null));};exports[_0xa82f('0x35')]=function(_0x45628a,_0x3cb705){return db['FaxMessage']['find']({'where':{'id':_0x45628a[_0xa82f('0x27')]['id']}})[_0xa82f('0x16')](handleEntityNotFound(_0x3cb705,null))[_0xa82f('0x16')](function(_0x4cc617){if(_0x4cc617){return _0x4cc617[_0xa82f('0x35')](_0x45628a['body'][_0xa82f('0x36')],_[_0xa82f('0x37')](_0x45628a[_0xa82f('0x33')],[_0xa82f('0x36'),'id'])||{});}})['then'](respondWithResult(_0x3cb705,null))[_0xa82f('0x25')](handleError(_0x3cb705,null));};exports[_0xa82f('0x38')]=function(_0x4699fb,_0x1122c6){var _0x3d92df={'raw':![],'where':{}};var _0x46a0ad={};var _0x43e077={'count':0x0,'rows':[]};return db[_0xa82f('0x2a')][_0xa82f('0x39')]({'where':{'id':_0x4699fb[_0xa82f('0x27')]['id']}})[_0xa82f('0x16')](handleEntityNotFound(_0x1122c6,null))[_0xa82f('0x16')](function(_0x15cc63){if(_0x15cc63){_0x46a0ad['model']=_[_0xa82f('0x29')](db['FaxMessage'][_0xa82f('0x1c')]);_0x46a0ad['query']=_['keys'](_0x4699fb[_0xa82f('0x23')]);_0x46a0ad[_0xa82f('0x2b')]=_['intersection'](_0x46a0ad[_0xa82f('0x28')],_0x46a0ad['query']);_0x3d92df[_0xa82f('0x2e')]=_[_0xa82f('0x2c')](_0x46a0ad['model'],qs['fields'](_0x4699fb['query'][_0xa82f('0x2d')]));_0x3d92df[_0xa82f('0x2e')]=_0x3d92df[_0xa82f('0x2e')][_0xa82f('0x3a')]?_0x3d92df['attributes']:_0x46a0ad[_0xa82f('0x28')];if(!_0x4699fb[_0xa82f('0x23')]['hasOwnProperty'](_0xa82f('0x3b'))){_0x3d92df[_0xa82f('0x11')]=qs[_0xa82f('0x11')](_0x4699fb[_0xa82f('0x23')][_0xa82f('0x11')]);_0x3d92df['offset']=qs['offset'](_0x4699fb[_0xa82f('0x23')][_0xa82f('0x13')]);}_0x3d92df[_0xa82f('0x3c')]=qs[_0xa82f('0x3d')](_0x4699fb[_0xa82f('0x23')]['sort']);_0x3d92df[_0xa82f('0x3e')]=qs[_0xa82f('0x2b')](_[_0xa82f('0x3f')](_0x4699fb[_0xa82f('0x23')],_0x46a0ad[_0xa82f('0x2b')]));_0x3d92df[_0xa82f('0x3e')][_0xa82f('0x40')]=_0x15cc63['id'];if(_0x4699fb[_0xa82f('0x23')][_0xa82f('0x41')]){_0x3d92df[_0xa82f('0x3e')]=_[_0xa82f('0x30')](_0x3d92df[_0xa82f('0x3e')],{'$or':_['map'](_0x3d92df[_0xa82f('0x2e')],function(_0x12126c){var _0x2f4be3={};_0x2f4be3[_0x12126c]={'$like':'%'+_0x4699fb[_0xa82f('0x23')][_0xa82f('0x41')]+'%'};return _0x2f4be3;})});}if(_0x4699fb['query'][_0xa82f('0x42')]){var _0x983c28=_0x4699fb['query']['$gte']['split'](',');var _0xd0780a={};_0xd0780a[_0x983c28[0x0]]={'$gte':moment(_0x983c28[0x1])[_0xa82f('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3d92df['where']=_[_0xa82f('0x30')](_0x3d92df['where'],_0xd0780a);}_0x3d92df=_['merge']({},_0x3d92df,_0x4699fb[_0xa82f('0x44')]);return db[_0xa82f('0x45')]['count']({'where':_0x3d92df['where']})[_0xa82f('0x16')](function(_0x349327){_0x43e077[_0xa82f('0x12')]=_0x349327;if(_0x4699fb[_0xa82f('0x23')][_0xa82f('0x46')]){_0x3d92df[_0xa82f('0x2f')]=[{'all':!![]}];}return db['FaxMessage'][_0xa82f('0x21')](_0x3d92df);})['then'](function(_0x233afe){_0x43e077[_0xa82f('0x47')]=_0x233afe;return _0x43e077;});}})[_0xa82f('0x16')](respondWithFilteredResult(_0x1122c6,_0x3d92df))[_0xa82f('0x25')](handleError(_0x1122c6,null));};exports['addTags']=function(_0x1e63a1,_0x1a891f){return db[_0xa82f('0x2a')][_0xa82f('0x31')]({'where':{'id':_0x1e63a1['params']['id']}})[_0xa82f('0x16')](handleEntityNotFound(_0x1a891f,null))[_0xa82f('0x16')](function(_0x1983c9){if(_0x1983c9){return _0x1983c9[_0xa82f('0x48')](_0x1e63a1[_0xa82f('0x33')][_0xa82f('0x36')],_[_0xa82f('0x37')](_0x1e63a1['body'],[_0xa82f('0x36'),'id'])||{})[_0xa82f('0x49')](function(){return db[_0xa82f('0x4a')][_0xa82f('0x21')]({'attributes':['id',_0xa82f('0x1a'),_0xa82f('0x4b')],'where':{'id':_0x1e63a1['body'][_0xa82f('0x36')]}});})[_0xa82f('0x16')](function(_0x520172){socket[_0xa82f('0x4c')](_0xa82f('0x4d'),{'id':Number(_0x1e63a1[_0xa82f('0x27')]['id']),'tags':_0x520172||[]});return{'id':Number(_0x1e63a1[_0xa82f('0x27')]['id']),'tags':_0x520172||[]};});}})[_0xa82f('0x16')](respondWithResult(_0x1a891f,null))['catch'](handleError(_0x1a891f,null));};exports['removeTags']=function(_0x1778a6,_0x1c3d11){return db[_0xa82f('0x2a')][_0xa82f('0x31')]({'where':{'id':_0x1778a6[_0xa82f('0x27')]['id']}})['then'](handleEntityNotFound(_0x1c3d11,null))[_0xa82f('0x16')](function(_0x5dad90){if(_0x5dad90){return _0x5dad90[_0xa82f('0x4e')](_0x1778a6[_0xa82f('0x23')]['ids']);}})['then'](respondWithStatusCode(_0x1c3d11,null))[_0xa82f('0x25')](handleError(_0x1c3d11,null));};exports[_0xa82f('0x4f')]=function(_0x2f19b9,_0x5ebeb7){var _0x10aab9=moment()['unix']()[_0xa82f('0x50')]();var _0x4638a1=path[_0xa82f('0x51')](config[_0xa82f('0x52')],_0xa82f('0x53'),'files',_0xa82f('0x54'));var _0xe5054d=path[_0xa82f('0x51')](config['root'],_0xa82f('0x53'),_0xa82f('0x55'),_0xa82f('0x56'));var _0x1017a9=path['join'](_0x4638a1,_0x10aab9);var _0x25fffd=util[_0xa82f('0x43')]('transcript-%d-%s.zip',_0x2f19b9[_0xa82f('0x27')]['id'],_0x10aab9);var _0x4e7c0c=path[_0xa82f('0x51')](_0x4638a1,_0x25fffd);var _0x1076de=[];_0x1076de[_0xa82f('0x57')]({'model':db['Attachment'],'as':_0xa82f('0x58'),'raw':!![]});var _0x2a7d13=[{'model':db[_0xa82f('0x45')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x1076de}];return db[_0xa82f('0x2a')]['find']({'where':{'id':_0x2f19b9[_0xa82f('0x27')]['id']},'include':_0x2a7d13})[_0xa82f('0x16')](handleEntityNotFound(_0x5ebeb7,null))['then'](function(_0x2df731){if(_0x2df731&&_0x2df731[_0xa82f('0x59')]){var _0x272626=_0x2df731[_0xa82f('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x1017a9);for(var _0x2db8fb=0x0;_0x2db8fb<_0x272626[_0xa82f('0x59')][_0xa82f('0x3a')];_0x2db8fb++){var _0x47e396=_0x272626[_0xa82f('0x59')][_0x2db8fb][_0xa82f('0x58')];if(_0x47e396){var _0x58852f=path['join'](_0xe5054d,_0x47e396[_0xa82f('0x5b')]);if(fs['existsSync'](_0x58852f)){fs[_0xa82f('0x5c')](_0x58852f)[_0xa82f('0x5d')](fs[_0xa82f('0x5e')](path[_0xa82f('0x51')](_0x1017a9,_0x47e396['basename'])));}}}return BPromise[_0xa82f('0x5f')]()[_0xa82f('0x16')](function(){return new BPromise(function(_0x2f02bc,_0x3e58e5){zipdir(_0x1017a9,{'saveTo':_0x4e7c0c},function(_0x37cc63,_0xc527d9){if(_0x37cc63)return _0x3e58e5(_0x37cc63);return _0x2f02bc(_0xc527d9);});})[_0xa82f('0x16')](function(){return new BPromise(function(_0x343ef8,_0x34dc7f){rimraf(_0x1017a9,function(_0x4c4032){if(_0x4c4032)_0x34dc7f(_0x4c4032);return _0x343ef8();});});})[_0xa82f('0x16')](function(){return _0x5ebeb7[_0xa82f('0x4f')](_0x4e7c0c,_0x25fffd,function(_0x562c1e){if(_0x562c1e){console[_0xa82f('0x60')](_0xa82f('0x61'),_0x562c1e);}else{fs[_0xa82f('0x62')](_0x4e7c0c);}});});});}else{return _0x5ebeb7['sendStatus'](0xc8);}})[_0xa82f('0x25')](handleError(_0x5ebeb7,null));}; \ No newline at end of file +var _0x096f=['merge','create','body','find','describe','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log','unlinkSync','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','offset','undefined','limit','count','update','then','destroy','end','error','stack','name','send','index','FaxInteraction','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','include'];(function(_0x149109,_0x1cbb30){var _0x25a47a=function(_0x3ee459){while(--_0x3ee459){_0x149109['push'](_0x149109['shift']());}};_0x25a47a(++_0x1cbb30);}(_0x096f,0x1a3));var _0xf096=function(_0x2c99a3,_0x1168fb){_0x2c99a3=_0x2c99a3-0x0;var _0x53293d=_0x096f[_0x2c99a3];return _0x53293d;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xf096('0x0'));var BPromise=require(_0xf096('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xf096('0x2'));var Redis=require(_0xf096('0x3'));var interaction=require(_0xf096('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xf096('0x5'))('api');var config=require(_0xf096('0x6'));var db=require('../../mysqldb')['db'];config[_0xf096('0x7')]=_[_0xf096('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf096('0x9'))(new Redis(config['redis']));require(_0xf096('0xa'))['register'](socket);function respondWithStatusCode(_0x2cec90,_0x372521){_0x372521=_0x372521||0xcc;return function(_0x5e368e){if(_0x5e368e){return _0x2cec90[_0xf096('0xb')](_0x372521);}return _0x2cec90[_0xf096('0xc')](_0x372521)['end']();};}function respondWithResult(_0x2b23d0,_0x174b04){_0x174b04=_0x174b04||0xc8;return function(_0x422ba9){if(_0x422ba9){return _0x2b23d0[_0xf096('0xc')](_0x174b04)['json'](_0x422ba9);}};}function respondWithFilteredResult(_0x3200a2,_0x523013){return function(_0x39dff7){if(_0x39dff7){var _0x3d5851=typeof _0x523013[_0xf096('0xd')]===_0xf096('0xe')&&typeof _0x523013[_0xf096('0xf')]===_0xf096('0xe');var _0x497bd4=_0x39dff7[_0xf096('0x10')];var _0x29c79a=_0x3d5851?0x0:_0x523013[_0xf096('0xd')];var _0x5a8c7b=_0x3d5851?_0x39dff7['count']:_0x523013[_0xf096('0xd')]+_0x523013[_0xf096('0xf')];var _0x4e1755;if(_0x5a8c7b>=_0x497bd4){_0x5a8c7b=_0x497bd4;_0x4e1755=0xc8;}else{_0x4e1755=0xce;}_0x3200a2['status'](_0x4e1755);return _0x3200a2['set']('Content-Range',_0x29c79a+'-'+_0x5a8c7b+'/'+_0x497bd4)['json'](_0x39dff7);}return null;};}function saveUpdates(_0x1cda81){return function(_0x48af5e){if(_0x48af5e){return _0x48af5e[_0xf096('0x11')](_0x1cda81)[_0xf096('0x12')](function(_0x4ba3cc){return _0x4ba3cc;});}return null;};}function removeEntity(_0xe9a492){return function(_0x294dc9){if(_0x294dc9){return _0x294dc9[_0xf096('0x13')]()[_0xf096('0x12')](function(){_0xe9a492['status'](0xcc)[_0xf096('0x14')]();});}};}function handleEntityNotFound(_0x1e8696){return function(_0x4a1233){if(!_0x4a1233){_0x1e8696[_0xf096('0xb')](0x194);}return _0x4a1233;};}function handleError(_0x4547de,_0x333479){_0x333479=_0x333479||0x1f4;return function(_0x3d93d8){logger[_0xf096('0x15')](_0x3d93d8[_0xf096('0x16')]);if(_0x3d93d8[_0xf096('0x17')]){delete _0x3d93d8[_0xf096('0x17')];}_0x4547de[_0xf096('0xc')](_0x333479)[_0xf096('0x18')](_0x3d93d8);};}exports[_0xf096('0x19')]=function(_0x1218a4,_0x2fe1f){var _0x416929={};var _0x45a04a=_['map'](db[_0xf096('0x1a')]['rawAttributes'],function(_0x3ab7bc){return{'name':_0x3ab7bc['fieldName'],'type':_0x3ab7bc[_0xf096('0x1b')][_0xf096('0x1c')]};});_0x416929=qs[_0xf096('0x1d')](_0x45a04a,_0x1218a4);return interaction[_0xf096('0x1e')](_0xf096('0x1f'),_0x1218a4[_0xf096('0x20')],_0x1218a4[_0xf096('0x21')],_0x416929,_0x45a04a)['then'](respondWithFilteredResult(_0x2fe1f,_0x416929))[_0xf096('0x22')](handleError(_0x2fe1f,null));};exports[_0xf096('0x23')]=function(_0x561679,_0x51115f){var _0x57d977={'raw':![],'where':{'id':_0x561679[_0xf096('0x24')]['id']}},_0x7f58f8={};_0x7f58f8[_0xf096('0x25')]=_[_0xf096('0x26')](db[_0xf096('0x1a')][_0xf096('0x27')]);_0x7f58f8['query']=_['keys'](_0x561679[_0xf096('0x20')]);_0x7f58f8[_0xf096('0x28')]=_[_0xf096('0x29')](_0x7f58f8[_0xf096('0x25')],_0x7f58f8[_0xf096('0x20')]);_0x57d977[_0xf096('0x2a')]=_[_0xf096('0x29')](_0x7f58f8[_0xf096('0x25')],qs[_0xf096('0x2b')](_0x561679['query'][_0xf096('0x2b')]));_0x57d977[_0xf096('0x2a')]=_0x57d977[_0xf096('0x2a')][_0xf096('0x2c')]?_0x57d977[_0xf096('0x2a')]:_0x7f58f8[_0xf096('0x25')];if(_0x561679['query']['includeAll']){_0x57d977[_0xf096('0x2d')]=[{'all':!![]}];}_0x57d977=_[_0xf096('0x2e')]({},_0x57d977,_0x561679['options']);return db[_0xf096('0x1a')]['find'](_0x57d977)['then'](handleEntityNotFound(_0x51115f,null))[_0xf096('0x12')](respondWithResult(_0x51115f,null))['catch'](handleError(_0x51115f,null));};exports[_0xf096('0x2f')]=function(_0x1e91cc,_0x2ed7f7){return db[_0xf096('0x1a')][_0xf096('0x2f')](_0x1e91cc[_0xf096('0x30')],{})[_0xf096('0x12')](respondWithResult(_0x2ed7f7,0xc9))[_0xf096('0x22')](handleError(_0x2ed7f7,null));};exports[_0xf096('0x11')]=function(_0x158e46,_0x27e34d){if(_0x158e46['body']['id']){delete _0x158e46[_0xf096('0x30')]['id'];}return db['FaxInteraction'][_0xf096('0x31')]({'where':{'id':_0x158e46['params']['id']}})[_0xf096('0x12')](handleEntityNotFound(_0x27e34d,null))[_0xf096('0x12')](saveUpdates(_0x158e46[_0xf096('0x30')],null))['then'](respondWithResult(_0x27e34d,null))['catch'](handleError(_0x27e34d,null));};exports[_0xf096('0x13')]=function(_0x3e1274,_0x2eb8c8){return db[_0xf096('0x1a')]['find']({'where':{'id':_0x3e1274[_0xf096('0x24')]['id']}})['then'](handleEntityNotFound(_0x2eb8c8,null))[_0xf096('0x12')](removeEntity(_0x2eb8c8,null))[_0xf096('0x22')](handleError(_0x2eb8c8,null));};exports[_0xf096('0x32')]=function(_0x27d3ab,_0x304bb8){return db[_0xf096('0x1a')][_0xf096('0x32')]()[_0xf096('0x12')](respondWithResult(_0x304bb8,null))['catch'](handleError(_0x304bb8,null));};exports['addMessage']=function(_0x437824,_0x354a06){return db[_0xf096('0x33')][_0xf096('0x31')]({'where':{'id':_0x437824['params']['id']}})[_0xf096('0x12')](handleEntityNotFound(_0x354a06,null))[_0xf096('0x12')](function(_0x216f0e){if(_0x216f0e){return _0x216f0e['addMessage'](_0x437824[_0xf096('0x30')]['ids'],_[_0xf096('0x34')](_0x437824['body'],[_0xf096('0x35'),'id'])||{});}})[_0xf096('0x12')](respondWithResult(_0x354a06,null))[_0xf096('0x22')](handleError(_0x354a06,null));};exports[_0xf096('0x36')]=function(_0xfcb48b,_0x382611){var _0x5399ce={'raw':![],'where':{}};var _0x33ab99={};var _0x5e3cd5={'count':0x0,'rows':[]};return db[_0xf096('0x1a')][_0xf096('0x37')]({'where':{'id':_0xfcb48b[_0xf096('0x24')]['id']}})[_0xf096('0x12')](handleEntityNotFound(_0x382611,null))[_0xf096('0x12')](function(_0x4952ce){if(_0x4952ce){_0x33ab99[_0xf096('0x25')]=_['keys'](db[_0xf096('0x33')]['rawAttributes']);_0x33ab99[_0xf096('0x20')]=_[_0xf096('0x26')](_0xfcb48b[_0xf096('0x20')]);_0x33ab99[_0xf096('0x28')]=_[_0xf096('0x29')](_0x33ab99[_0xf096('0x25')],_0x33ab99[_0xf096('0x20')]);_0x5399ce[_0xf096('0x2a')]=_[_0xf096('0x29')](_0x33ab99[_0xf096('0x25')],qs[_0xf096('0x2b')](_0xfcb48b[_0xf096('0x20')][_0xf096('0x2b')]));_0x5399ce[_0xf096('0x2a')]=_0x5399ce['attributes'][_0xf096('0x2c')]?_0x5399ce[_0xf096('0x2a')]:_0x33ab99['model'];if(!_0xfcb48b[_0xf096('0x20')][_0xf096('0x38')](_0xf096('0x39'))){_0x5399ce[_0xf096('0xf')]=qs[_0xf096('0xf')](_0xfcb48b[_0xf096('0x20')][_0xf096('0xf')]);_0x5399ce[_0xf096('0xd')]=qs[_0xf096('0xd')](_0xfcb48b['query'][_0xf096('0xd')]);}_0x5399ce[_0xf096('0x3a')]=qs[_0xf096('0x3b')](_0xfcb48b[_0xf096('0x20')][_0xf096('0x3b')]);_0x5399ce['where']=qs[_0xf096('0x28')](_[_0xf096('0x3c')](_0xfcb48b[_0xf096('0x20')],_0x33ab99[_0xf096('0x28')]));_0x5399ce[_0xf096('0x3d')]['FaxInteractionId']=_0x4952ce['id'];if(_0xfcb48b[_0xf096('0x20')][_0xf096('0x3e')]){_0x5399ce[_0xf096('0x3d')]=_[_0xf096('0x2e')](_0x5399ce['where'],{'$or':_[_0xf096('0x3f')](_0x5399ce[_0xf096('0x2a')],function(_0x226059){var _0x381ce8={};_0x381ce8[_0x226059]={'$like':'%'+_0xfcb48b[_0xf096('0x20')][_0xf096('0x3e')]+'%'};return _0x381ce8;})});}if(_0xfcb48b[_0xf096('0x20')][_0xf096('0x40')]){var _0xab0a2e=_0xfcb48b[_0xf096('0x20')][_0xf096('0x40')]['split'](',');var _0x3ce7b6={};_0x3ce7b6[_0xab0a2e[0x0]]={'$gte':moment(_0xab0a2e[0x1])['format'](_0xf096('0x41'))};_0x5399ce[_0xf096('0x3d')]=_['merge'](_0x5399ce[_0xf096('0x3d')],_0x3ce7b6);}_0x5399ce=_['merge']({},_0x5399ce,_0xfcb48b['options']);return db['FaxMessage'][_0xf096('0x10')]({'where':_0x5399ce[_0xf096('0x3d')]})['then'](function(_0x317132){_0x5e3cd5[_0xf096('0x10')]=_0x317132;if(_0xfcb48b[_0xf096('0x20')]['includeAll']){_0x5399ce[_0xf096('0x2d')]=[{'all':!![]}];}return db[_0xf096('0x33')][_0xf096('0x1e')](_0x5399ce);})[_0xf096('0x12')](function(_0xdc3601){_0x5e3cd5[_0xf096('0x42')]=_0xdc3601;return _0x5e3cd5;});}})[_0xf096('0x12')](respondWithFilteredResult(_0x382611,_0x5399ce))[_0xf096('0x22')](handleError(_0x382611,null));};exports['addTags']=function(_0x5766e0,_0x2f3042){return db[_0xf096('0x1a')][_0xf096('0x31')]({'where':{'id':_0x5766e0[_0xf096('0x24')]['id']}})[_0xf096('0x12')](handleEntityNotFound(_0x2f3042,null))['then'](function(_0x554029){if(_0x554029){return _0x554029[_0xf096('0x43')](_0x5766e0['body'][_0xf096('0x35')],_[_0xf096('0x34')](_0x5766e0[_0xf096('0x30')],['ids','id'])||{})[_0xf096('0x44')](function(){return db['Tag']['findAll']({'attributes':['id',_0xf096('0x17'),'color'],'where':{'id':_0x5766e0[_0xf096('0x30')]['ids']}});})[_0xf096('0x12')](function(_0x233957){socket[_0xf096('0x45')](_0xf096('0x46'),{'id':Number(_0x5766e0[_0xf096('0x24')]['id']),'tags':_0x233957||[]});return{'id':Number(_0x5766e0[_0xf096('0x24')]['id']),'tags':_0x233957||[]};});}})[_0xf096('0x12')](respondWithResult(_0x2f3042,null))['catch'](handleError(_0x2f3042,null));};exports[_0xf096('0x47')]=function(_0x4c3404,_0x49ac73){return db[_0xf096('0x1a')]['find']({'where':{'id':_0x4c3404[_0xf096('0x24')]['id']}})[_0xf096('0x12')](handleEntityNotFound(_0x49ac73,null))['then'](function(_0x46cf46){if(_0x46cf46){return _0x46cf46[_0xf096('0x47')](_0x4c3404[_0xf096('0x20')][_0xf096('0x35')]);}})[_0xf096('0x12')](respondWithStatusCode(_0x49ac73,null))[_0xf096('0x22')](handleError(_0x49ac73,null));};exports[_0xf096('0x48')]=function(_0x3c431a,_0x41d485){var _0x4ed7f3=moment()[_0xf096('0x49')]()[_0xf096('0x4a')]();var _0x590ef6=path[_0xf096('0x4b')](config[_0xf096('0x4c')],_0xf096('0x4d'),_0xf096('0x4e'),_0xf096('0x4f'));var _0x1f3a3e=path[_0xf096('0x4b')](config[_0xf096('0x4c')],'server',_0xf096('0x4e'),_0xf096('0x50'));var _0x58445f=path[_0xf096('0x4b')](_0x590ef6,_0x4ed7f3);var _0x478cba=util['format'](_0xf096('0x51'),_0x3c431a['params']['id'],_0x4ed7f3);var _0x285a45=path[_0xf096('0x4b')](_0x590ef6,_0x478cba);var _0x2f61ab=[];_0x2f61ab['push']({'model':db[_0xf096('0x52')],'as':_0xf096('0x52'),'raw':!![]});var _0xd231bb=[{'model':db['FaxMessage'],'as':_0xf096('0x53'),'attributes':['id',_0xf096('0x30'),'createdAt'],'include':_0x2f61ab}];return db[_0xf096('0x1a')]['find']({'where':{'id':_0x3c431a[_0xf096('0x24')]['id']},'include':_0xd231bb})[_0xf096('0x12')](handleEntityNotFound(_0x41d485,null))[_0xf096('0x12')](function(_0x562c4c){if(_0x562c4c&&_0x562c4c[_0xf096('0x53')]){var _0x1f6da0=_0x562c4c[_0xf096('0x54')]({'plain':!![]});fs[_0xf096('0x55')](_0x58445f);for(var _0x50b407=0x0;_0x50b407<_0x1f6da0[_0xf096('0x53')][_0xf096('0x2c')];_0x50b407++){var _0x4f109f=_0x1f6da0[_0xf096('0x53')][_0x50b407][_0xf096('0x52')];if(_0x4f109f){var _0x22aa61=path[_0xf096('0x4b')](_0x1f3a3e,_0x4f109f[_0xf096('0x56')]);if(fs[_0xf096('0x57')](_0x22aa61)){fs[_0xf096('0x58')](_0x22aa61)['pipe'](fs[_0xf096('0x59')](path[_0xf096('0x4b')](_0x58445f,_0x4f109f['basename'])));}}}return BPromise[_0xf096('0x5a')]()[_0xf096('0x12')](function(){return new BPromise(function(_0x2baa9e,_0x5959b1){zipdir(_0x58445f,{'saveTo':_0x285a45},function(_0x3108d2,_0x14bbae){if(_0x3108d2)return _0x5959b1(_0x3108d2);return _0x2baa9e(_0x14bbae);});})[_0xf096('0x12')](function(){return new BPromise(function(_0x228ef0,_0x554215){rimraf(_0x58445f,function(_0x288d00){if(_0x288d00)_0x554215(_0x288d00);return _0x228ef0();});});})['then'](function(){return _0x41d485['download'](_0x285a45,_0x478cba,function(_0x1bd20c){if(_0x1bd20c){console[_0xf096('0x5b')]('err',_0x1bd20c);}else{fs[_0xf096('0x5c')](_0x285a45);}});});});}else{return _0x41d485[_0xf096('0xb')](0xc8);}})['catch'](handleError(_0x41d485,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3d90bd0..d861b43 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 _0x9440=['hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x593893,_0x288a73){var _0x2ed926=function(_0x3886e1){while(--_0x3886e1){_0x593893['push'](_0x593893['shift']());}};_0x2ed926(++_0x288a73);}(_0x9440,0xc8));var _0x0944=function(_0x2729c5,_0x536bfb){_0x2729c5=_0x2729c5-0x0;var _0x50e4a7=_0x9440[_0x2729c5];return _0x50e4a7;};'use strict';var EventEmitter=require(_0x0944('0x0'));var FaxInteraction=require(_0x0944('0x1'))['db'][_0x0944('0x2')];var FaxMessage=require(_0x0944('0x1'))['db'][_0x0944('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0944('0x4')](0x0);var events={'afterCreate':_0x0944('0x5'),'afterUpdate':_0x0944('0x6'),'afterDestroy':_0x0944('0x7')};function emitEvent(_0x5f49ea){return function(_0x5f285c,_0x14eeae,_0xa8d2c7){_0x5f285c[_0x0944('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9f3d08){_0x5f285c[_0x0944('0x9')](_0x0944('0xa'),_0x9f3d08[_0x0944('0xb')](function(_0x58750b){return{'id':_0x58750b['id']};}));return FaxMessage[_0x0944('0xc')]({'where':{'FaxInteractionId':_0x5f285c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1abaee){_0x5f285c[_0x0944('0x9')](_0x0944('0xd'),_0x1abaee['length']);FaxInteractionEvents[_0x0944('0xe')](_0x5f49ea+':'+_0x5f285c['id'],_0x5f285c);FaxInteractionEvents[_0x0944('0xe')](_0x5f49ea,_0x5f285c);_0xa8d2c7(null);})[_0x0944('0xf')](_0xa8d2c7(null));};}for(var e in events){if(events[_0x0944('0x10')](e)){var event=events[e];FaxInteraction[_0x0944('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xf9e0=['FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events'];(function(_0x53aecd,_0x3d159f){var _0x13992c=function(_0x17ebc5){while(--_0x17ebc5){_0x53aecd['push'](_0x53aecd['shift']());}};_0x13992c(++_0x3d159f);}(_0xf9e0,0x11f));var _0x0f9e=function(_0x2be4f6,_0x21c524){_0x2be4f6=_0x2be4f6-0x0;var _0x20ec2c=_0xf9e0[_0x2be4f6];return _0x20ec2c;};'use strict';var EventEmitter=require(_0x0f9e('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x0f9e('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x0f9e('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0f9e('0x3')](0x0);var events={'afterCreate':_0x0f9e('0x4'),'afterUpdate':'update','afterDestroy':_0x0f9e('0x5')};function emitEvent(_0x224b4c){return function(_0x2ced23,_0x3fa73c,_0x3479a0){_0x2ced23[_0x0f9e('0x6')]({'attributes':['id'],'raw':!![]})[_0x0f9e('0x7')](function(_0x1d057d){_0x2ced23[_0x0f9e('0x8')]('Users',_0x1d057d[_0x0f9e('0x9')](function(_0x5e6533){return{'id':_0x5e6533['id']};}));return FaxMessage[_0x0f9e('0xa')]({'where':{'FaxInteractionId':_0x2ced23['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f9e('0x7')](function(_0x3d89e9){_0x2ced23[_0x0f9e('0x8')](_0x0f9e('0xb'),_0x3d89e9[_0x0f9e('0xc')]);FaxInteractionEvents['emit'](_0x224b4c+':'+_0x2ced23['id'],_0x2ced23);FaxInteractionEvents[_0x0f9e('0xd')](_0x224b4c,_0x2ced23);_0x3479a0(null);})[_0x0f9e('0xe')](_0x3479a0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x0f9e('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index dd9f4e8..e943119 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 _0xd070=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x5ee8d1,_0x24cc76){var _0x4fe7e7=function(_0x3c68b9){while(--_0x3c68b9){_0x5ee8d1['push'](_0x5ee8d1['shift']());}};_0x4fe7e7(++_0x24cc76);}(_0xd070,0x8e));var _0x0d07=function(_0x578e77,_0x150fbf){_0x578e77=_0x578e77-0x0;var _0x4f5954=_0xd070[_0x578e77];return _0x4f5954;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var logger=require(_0x0d07('0x1'))(_0x0d07('0x2'));var moment=require(_0x0d07('0x3'));var BPromise=require(_0x0d07('0x4'));var rp=require(_0x0d07('0x5'));var fs=require('fs');var path=require(_0x0d07('0x6'));var rimraf=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var attributes=require(_0x0d07('0x9'));module[_0x0d07('0xa')]=function(_0x18943f,_0x495815){return _0x18943f[_0x0d07('0xb')]('FaxInteraction',attributes,{'tableName':_0x0d07('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8c16d8,_0x1f989e,_0x1eed7a){if(_0x8c16d8[_0x0d07('0xd')](_0x0d07('0xe'))){_0x8c16d8[_0x0d07('0xf')]=moment()[_0x0d07('0x10')](_0x0d07('0x11'));}_0x1eed7a(null,_0x8c16d8);}}});}; \ No newline at end of file +var _0xae08=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x93e248,_0x119414){var _0x511245=function(_0x28f555){while(--_0x28f555){_0x93e248['push'](_0x93e248['shift']());}};_0x511245(++_0x119414);}(_0xae08,0x115));var _0x8ae0=function(_0x35e327,_0x2a6348){_0x35e327=_0x35e327-0x0;var _0xf533cc=_0xae08[_0x35e327];return _0xf533cc;};'use strict';var _=require('lodash');var util=require(_0x8ae0('0x0'));var logger=require(_0x8ae0('0x1'))(_0x8ae0('0x2'));var moment=require(_0x8ae0('0x3'));var BPromise=require(_0x8ae0('0x4'));var rp=require(_0x8ae0('0x5'));var fs=require('fs');var path=require(_0x8ae0('0x6'));var rimraf=require(_0x8ae0('0x7'));var config=require(_0x8ae0('0x8'));var attributes=require(_0x8ae0('0x9'));module[_0x8ae0('0xa')]=function(_0x5eab60,_0x417452){return _0x5eab60[_0x8ae0('0xb')](_0x8ae0('0xc'),attributes,{'tableName':_0x8ae0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d03dd,_0x3ec7bf,_0x51005d){if(_0x5d03dd[_0x8ae0('0xe')](_0x8ae0('0xf'))){_0x5d03dd[_0x8ae0('0x10')]=moment()[_0x8ae0('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51005d(null,_0x5d03dd);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a5b9b83..feef403 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 _0xf5eb=['AddTags','debug','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','AddTagsToFaxInteraction','where','addTags','ids','omit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf5eb,0x17c));var _0xbf5e=function(_0x408eb4,_0x5acf9b){_0x408eb4=_0x408eb4-0x0;var _0x14c954=_0xf5eb[_0x408eb4];return _0x14c954;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf5e('0x0'));var BPromise=require(_0xbf5e('0x1'));var rs=require(_0xbf5e('0x2'));var fs=require('fs');var Redis=require(_0xbf5e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf5e('0x4'));var logger=require(_0xbf5e('0x5'))(_0xbf5e('0x6'));var config=require(_0xbf5e('0x7'));var jayson=require(_0xbf5e('0x8'));var client=jayson[_0xbf5e('0x9')][_0xbf5e('0xa')]({'port':0x232a});config[_0xbf5e('0xb')]=_[_0xbf5e('0xc')](config[_0xbf5e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf5e('0xd'))(new Redis(config[_0xbf5e('0xb')]));require(_0xbf5e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5630e9,_0x200b57,_0xf435f0){return new BPromise(function(_0x5d7730,_0x1f3a19){return client[_0xbf5e('0xf')](_0x5630e9,_0xf435f0)[_0xbf5e('0x10')](function(_0x52dec9){logger['info'](_0xbf5e('0x11'),_0x200b57,'request\x20sent');logger['debug'](_0xbf5e('0x12'),_0x200b57,'request\x20sent',JSON[_0xbf5e('0x13')](_0x52dec9));if(_0x52dec9[_0xbf5e('0x14')]){if(_0x52dec9[_0xbf5e('0x14')][_0xbf5e('0x15')]===0x1f4){logger['error'](_0xbf5e('0x11'),_0x200b57,_0x52dec9[_0xbf5e('0x14')][_0xbf5e('0x16')]);return _0x1f3a19(_0x52dec9[_0xbf5e('0x14')]['message']);}logger['error'](_0xbf5e('0x11'),_0x200b57,_0x52dec9[_0xbf5e('0x14')][_0xbf5e('0x16')]);return _0x5d7730(_0x52dec9['error'][_0xbf5e('0x16')]);}else{logger[_0xbf5e('0x17')](_0xbf5e('0x11'),_0x200b57,_0xbf5e('0x18'));_0x5d7730(_0x52dec9[_0xbf5e('0x19')][_0xbf5e('0x16')]);}})[_0xbf5e('0x1a')](function(_0x2e2159){logger['error'](_0xbf5e('0x11'),_0x200b57,_0x2e2159);_0x1f3a19(_0x2e2159);});});}exports[_0xbf5e('0x1b')]=function(_0xb691b0){var _0x1f423c=this;return new Promise(function(_0x3dde4c,_0x4b18b2){return db[_0xbf5e('0x1c')][_0xbf5e('0x1d')](_0xb691b0[_0xbf5e('0x1e')],{'raw':_0xb691b0[_0xbf5e('0x1f')]?_0xb691b0['options'][_0xbf5e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb691b0['options']?_0xb691b0[_0xbf5e('0x1f')]['where']||null:null,'attributes':_0xb691b0[_0xbf5e('0x1f')]?_0xb691b0[_0xbf5e('0x1f')][_0xbf5e('0x21')]||null:null,'limit':_0xb691b0[_0xbf5e('0x1f')]?_0xb691b0['options'][_0xbf5e('0x22')]||null:null})[_0xbf5e('0x10')](function(_0x3d2c43){logger[_0xbf5e('0x17')](_0xbf5e('0x1b'),_0xb691b0);logger['debug'](_0xbf5e('0x1b'),_0xb691b0,JSON[_0xbf5e('0x13')](_0x3d2c43));_0x3dde4c(_0x3d2c43);})[_0xbf5e('0x1a')](function(_0x2d4f2b){logger[_0xbf5e('0x14')](_0xbf5e('0x1b'),_0x2d4f2b[_0xbf5e('0x16')],_0xb691b0);_0x4b18b2(_0x1f423c['error'](0x1f4,_0x2d4f2b[_0xbf5e('0x16')]));});});};exports[_0xbf5e('0x23')]=function(_0x3b3f1b){return new Promise(function(_0x179857,_0x1625cd){return db['FaxInteraction']['find']({'where':_0x3b3f1b[_0xbf5e('0x1f')]?_0x3b3f1b[_0xbf5e('0x1f')][_0xbf5e('0x24')]||null:null})[_0xbf5e('0x10')](function(_0x23eb94){if(_0x23eb94){return _0x23eb94[_0xbf5e('0x25')](_0x3b3f1b['body'][_0xbf5e('0x26')],_[_0xbf5e('0x27')](_0x3b3f1b[_0xbf5e('0x1e')],[_0xbf5e('0x26'),'id'])||{});}})['spread'](function(_0x3ec2b){logger[_0xbf5e('0x17')](_0xbf5e('0x28'),_0x3b3f1b);logger[_0xbf5e('0x29')](_0xbf5e('0x28'),_0x3b3f1b,JSON[_0xbf5e('0x13')](_0x3ec2b));_0x179857(_0x3ec2b);})[_0xbf5e('0x1a')](function(_0x1c7b3a){logger[_0xbf5e('0x14')](_0xbf5e('0x28'),_0x1c7b3a[_0xbf5e('0x16')],_0x3b3f1b);_0x1625cd(_this[_0xbf5e('0x14')](0x1f4,_0x1c7b3a[_0xbf5e('0x16')]));});});}; \ No newline at end of file +var _0x0969=['result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','addTags','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x0969,0x19f));var _0x9096=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0969[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x9096('0x0'));var util=require(_0x9096('0x1'));var moment=require('moment');var BPromise=require(_0x9096('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9096('0x3'));var db=require(_0x9096('0x4'))['db'];var utils=require(_0x9096('0x5'));var logger=require(_0x9096('0x6'))(_0x9096('0x7'));var config=require(_0x9096('0x8'));var jayson=require(_0x9096('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9096('0xa')]=_['defaults'](config['redis'],{'host':_0x9096('0xb'),'port':0x18eb});var socket=require(_0x9096('0xc'))(new Redis(config[_0x9096('0xa')]));require(_0x9096('0xd'))[_0x9096('0xe')](socket);function respondWithRpcPromise(_0x565b22,_0xae144b,_0x3c499a){return new BPromise(function(_0x3bf3b7,_0x42b863){return client['request'](_0x565b22,_0x3c499a)[_0x9096('0xf')](function(_0x2e7cf7){logger['info']('FaxInteraction,\x20%s,\x20%s',_0xae144b,_0x9096('0x10'));logger[_0x9096('0x11')](_0x9096('0x12'),_0xae144b,_0x9096('0x10'),JSON[_0x9096('0x13')](_0x2e7cf7));if(_0x2e7cf7[_0x9096('0x14')]){if(_0x2e7cf7[_0x9096('0x14')][_0x9096('0x15')]===0x1f4){logger[_0x9096('0x14')](_0x9096('0x16'),_0xae144b,_0x2e7cf7[_0x9096('0x14')]['message']);return _0x42b863(_0x2e7cf7[_0x9096('0x14')][_0x9096('0x17')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0xae144b,_0x2e7cf7[_0x9096('0x14')][_0x9096('0x17')]);return _0x3bf3b7(_0x2e7cf7[_0x9096('0x14')][_0x9096('0x17')]);}else{logger[_0x9096('0x18')](_0x9096('0x16'),_0xae144b,_0x9096('0x10'));_0x3bf3b7(_0x2e7cf7[_0x9096('0x19')][_0x9096('0x17')]);}})[_0x9096('0x1a')](function(_0x30cd05){logger['error']('FaxInteraction,\x20%s,\x20%s',_0xae144b,_0x30cd05);_0x42b863(_0x30cd05);});});}exports[_0x9096('0x1b')]=function(_0x35b9d6){var _0x56035e=this;return new Promise(function(_0x3f2251,_0xedaf91){return db[_0x9096('0x1c')]['update'](_0x35b9d6[_0x9096('0x1d')],{'raw':_0x35b9d6[_0x9096('0x1e')]?_0x35b9d6['options'][_0x9096('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35b9d6[_0x9096('0x1e')]?_0x35b9d6[_0x9096('0x1e')][_0x9096('0x20')]||null:null,'attributes':_0x35b9d6['options']?_0x35b9d6[_0x9096('0x1e')][_0x9096('0x21')]||null:null,'limit':_0x35b9d6['options']?_0x35b9d6['options']['limit']||null:null})[_0x9096('0xf')](function(_0x3ce94b){logger[_0x9096('0x18')]('UpdateFaxInteraction',_0x35b9d6);logger[_0x9096('0x11')]('UpdateFaxInteraction',_0x35b9d6,JSON['stringify'](_0x3ce94b));_0x3f2251(_0x3ce94b);})[_0x9096('0x1a')](function(_0x4d976f){logger[_0x9096('0x14')](_0x9096('0x1b'),_0x4d976f['message'],_0x35b9d6);_0xedaf91(_0x56035e[_0x9096('0x14')](0x1f4,_0x4d976f['message']));});});};exports[_0x9096('0x22')]=function(_0x5d44fe){return new Promise(function(_0x2ae90a,_0xf04af6){return db[_0x9096('0x1c')][_0x9096('0x23')]({'where':_0x5d44fe[_0x9096('0x1e')]?_0x5d44fe[_0x9096('0x1e')][_0x9096('0x20')]||null:null})[_0x9096('0xf')](function(_0x5a022f){if(_0x5a022f){return _0x5a022f[_0x9096('0x24')](_0x5d44fe['body']['ids'],_[_0x9096('0x25')](_0x5d44fe['body'],['ids','id'])||{});}})[_0x9096('0x26')](function(_0x26942d){logger[_0x9096('0x18')](_0x9096('0x27'),_0x5d44fe);logger[_0x9096('0x11')](_0x9096('0x27'),_0x5d44fe,JSON['stringify'](_0x26942d));_0x2ae90a(_0x26942d);})[_0x9096('0x1a')](function(_0x402660){logger[_0x9096('0x14')](_0x9096('0x27'),_0x402660[_0x9096('0x17')],_0x5d44fe);_0xf04af6(_this[_0x9096('0x14')](0x1f4,_0x402660['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0ab4df0..e2a7668 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 _0xdd1a=['save','update','emit','removeListener','length','faxInteraction:','./faxInteraction.events'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xdd1a,0x1b8));var _0xadd1=function(_0x14d829,_0x59c436){_0x14d829=_0x14d829-0x0;var _0x26b4cf=_0xdd1a[_0x14d829];return _0x26b4cf;};'use strict';var FaxInteractionEvents=require(_0xadd1('0x0'));var events=[_0xadd1('0x1'),'remove',_0xadd1('0x2')];function createListener(_0x3abd01,_0x27fc00){return function(_0x2536c3){_0x27fc00[_0xadd1('0x3')](_0x3abd01,_0x2536c3);};}function removeListener(_0x2ee93a,_0xb6b61b){return function(){FaxInteractionEvents[_0xadd1('0x4')](_0x2ee93a,_0xb6b61b);};}exports['register']=function(_0x54f2c2){for(var _0x45dc18=0x0,_0x5df83f=events[_0xadd1('0x5')];_0x45dc18<_0x5df83f;_0x45dc18++){var _0x3f4141=events[_0x45dc18];var _0x3eca3b=createListener(_0xadd1('0x6')+_0x3f4141,_0x54f2c2);FaxInteractionEvents['on'](_0x3f4141,_0x3eca3b);}}; \ No newline at end of file +var _0x737d=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x4f9f8b,_0x4c46c7){var _0x429526=function(_0x21393e){while(--_0x21393e){_0x4f9f8b['push'](_0x4f9f8b['shift']());}};_0x429526(++_0x4c46c7);}(_0x737d,0x129));var _0xd737=function(_0x2c267d,_0x27133e){_0x2c267d=_0x2c267d-0x0;var _0x121769=_0x737d[_0x2c267d];return _0x121769;};'use strict';var FaxInteractionEvents=require(_0xd737('0x0'));var events=[_0xd737('0x1'),_0xd737('0x2'),_0xd737('0x3')];function createListener(_0x5ab79b,_0x4e3dce){return function(_0x24b8a4){_0x4e3dce['emit'](_0x5ab79b,_0x24b8a4);};}function removeListener(_0x24caa1,_0x2cae2b){return function(){FaxInteractionEvents[_0xd737('0x4')](_0x24caa1,_0x2cae2b);};}exports[_0xd737('0x5')]=function(_0x21d569){for(var _0x17f7ec=0x0,_0x126975=events[_0xd737('0x6')];_0x17f7ec<_0x126975;_0x17f7ec++){var _0x6db6f9=events[_0x17f7ec];var _0x226ccd=createListener(_0xd737('0x7')+_0x6db6f9,_0x21d569);FaxInteractionEvents['on'](_0x6db6f9,_0x226ccd);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7943e86..2ac7737 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 _0xdc00=['post','create','addMessage','/:id/tags','tracked','/:id','fax','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id/messages','/:id/download','download'];(function(_0x3f1885,_0x3aa3ff){var _0x459832=function(_0x1f1ff2){while(--_0x1f1ff2){_0x3f1885['push'](_0x3f1885['shift']());}};_0x459832(++_0x3aa3ff);}(_0xdc00,0x64));var _0x0dc0=function(_0xa5485e,_0x4a67b1){_0xa5485e=_0xa5485e-0x0;var _0x2ce708=_0xdc00[_0xa5485e];return _0x2ce708;};'use strict';var multer=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var path=require(_0x0dc0('0x2'));var timeout=require(_0x0dc0('0x3'));var express=require(_0x0dc0('0x4'));var router=express[_0x0dc0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0dc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0dc0('0x7'));var controller=require(_0x0dc0('0x8'));router[_0x0dc0('0x9')]('/',auth[_0x0dc0('0xa')](),controller[_0x0dc0('0xb')]);router[_0x0dc0('0x9')](_0x0dc0('0xc'),auth[_0x0dc0('0xa')](),controller['describe']);router['get']('/:id',auth[_0x0dc0('0xa')](),controller['show']);router[_0x0dc0('0x9')](_0x0dc0('0xd'),auth[_0x0dc0('0xa')](),controller['getMessages']);router[_0x0dc0('0x9')](_0x0dc0('0xe'),auth[_0x0dc0('0xa')](),controller[_0x0dc0('0xf')]);router[_0x0dc0('0x10')]('/',auth['isAuthenticated'](),controller[_0x0dc0('0x11')]);router[_0x0dc0('0x10')](_0x0dc0('0xd'),auth[_0x0dc0('0xa')](),controller[_0x0dc0('0x12')]);router[_0x0dc0('0x10')](_0x0dc0('0x13'),auth[_0x0dc0('0xa')](),interaction[_0x0dc0('0x14')]('fax','faxinteraction:addtags'),controller['addTags']);router['put'](_0x0dc0('0x15'),auth[_0x0dc0('0xa')](),interaction[_0x0dc0('0x14')](_0x0dc0('0x16'),'faxinteraction:update'),controller[_0x0dc0('0x17')]);router['delete'](_0x0dc0('0x15'),auth['isAuthenticated'](),interaction[_0x0dc0('0x14')](_0x0dc0('0x16'),_0x0dc0('0x18')),controller[_0x0dc0('0x19')]);router[_0x0dc0('0x1a')](_0x0dc0('0x13'),auth[_0x0dc0('0xa')](),controller[_0x0dc0('0x1b')]);module[_0x0dc0('0x1c')]=router; \ No newline at end of file +var _0xa7e9=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','delete','faxinteraction:destroy'];(function(_0x57aee2,_0x524e05){var _0x59003c=function(_0x321a9f){while(--_0x321a9f){_0x57aee2['push'](_0x57aee2['shift']());}};_0x59003c(++_0x524e05);}(_0xa7e9,0x1d2));var _0x9a7e=function(_0x28e80f,_0xe7244a){_0x28e80f=_0x28e80f-0x0;var _0xf51985=_0xa7e9[_0x28e80f];return _0xf51985;};'use strict';var multer=require(_0x9a7e('0x0'));var util=require('util');var path=require(_0x9a7e('0x1'));var timeout=require(_0x9a7e('0x2'));var express=require(_0x9a7e('0x3'));var router=express[_0x9a7e('0x4')]();var fs_extra=require(_0x9a7e('0x5'));var auth=require(_0x9a7e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a7e('0x7'));var controller=require(_0x9a7e('0x8'));router[_0x9a7e('0x9')]('/',auth[_0x9a7e('0xa')](),controller[_0x9a7e('0xb')]);router['get'](_0x9a7e('0xc'),auth[_0x9a7e('0xa')](),controller[_0x9a7e('0xd')]);router['get'](_0x9a7e('0xe'),auth[_0x9a7e('0xa')](),controller[_0x9a7e('0xf')]);router[_0x9a7e('0x9')](_0x9a7e('0x10'),auth[_0x9a7e('0xa')](),controller['getMessages']);router[_0x9a7e('0x9')](_0x9a7e('0x11'),auth['isAuthenticated'](),controller[_0x9a7e('0x12')]);router[_0x9a7e('0x13')]('/',auth[_0x9a7e('0xa')](),controller[_0x9a7e('0x14')]);router[_0x9a7e('0x13')](_0x9a7e('0x10'),auth[_0x9a7e('0xa')](),controller[_0x9a7e('0x15')]);router['post'](_0x9a7e('0x16'),auth['isAuthenticated'](),interaction[_0x9a7e('0x17')]('fax',_0x9a7e('0x18')),controller[_0x9a7e('0x19')]);router[_0x9a7e('0x1a')](_0x9a7e('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x9a7e('0x1b'),'faxinteraction:update'),controller['update']);router[_0x9a7e('0x1c')](_0x9a7e('0xe'),auth['isAuthenticated'](),interaction[_0x9a7e('0x17')](_0x9a7e('0x1b'),_0x9a7e('0x1d')),controller[_0x9a7e('0x1e')]);router['delete'](_0x9a7e('0x16'),auth[_0x9a7e('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5a1f7a6..e34e398 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 _0x9f62=['BOOLEAN','ENUM','TEXT','DATE','exports','medium'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0x9f62,0x154));var _0x29f6=function(_0x11a29c,_0x1015da){_0x11a29c=_0x11a29c-0x0;var _0x1ed02c=_0x9f62[_0x11a29c];return _0x1ed02c;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x29f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x29f6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x29f6('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x29f6('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x29f6('0x5')]}}; \ No newline at end of file +var _0x0a9a=['TEXT','DATE','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3d5d36,_0x471d6b){var _0x3816c6=function(_0x489734){while(--_0x489734){_0x3d5d36['push'](_0x3d5d36['shift']());}};_0x3816c6(++_0x471d6b);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4ec326,_0x1447c7){_0x4ec326=_0x4ec326-0x0;var _0x3a0912=_0x0a9a[_0x4ec326];return _0x3a0912;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa0a9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa0a9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa0a9('0x3')]('in',_0xa0a9('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xa0a9('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa0a9('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e8970a9..74f9686 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 _0xd946=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','Sequelize','contact','rejectmessage','create','CmContact','findOne','fax','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','FaxMessage','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','fax-interactions','accept','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage'];(function(_0x3ac002,_0x3c94a9){var _0x106531=function(_0x51baf1){while(--_0x51baf1){_0x3ac002['push'](_0x3ac002['shift']());}};_0x106531(++_0x3c94a9);}(_0xd946,0x1e3));var _0x6d94=function(_0x14f5df,_0x7bce38){_0x14f5df=_0x14f5df-0x0;var _0x6029d5=_0xd946[_0x14f5df];return _0x6029d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d94('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d94('0x1'));var rp=require(_0x6d94('0x2'));var moment=require(_0x6d94('0x3'));var BPromise=require(_0x6d94('0x4'));var Mustache=require(_0x6d94('0x5'));var util=require(_0x6d94('0x6'));var path=require(_0x6d94('0x7'));var sox=require(_0x6d94('0x8'));var csv=require(_0x6d94('0x9'));var ejs=require(_0x6d94('0xa'));var fs=require('fs');var fs_extra=require(_0x6d94('0xb'));var _=require(_0x6d94('0xc'));var squel=require(_0x6d94('0xd'));var crypto=require(_0x6d94('0xe'));var jsforce=require(_0x6d94('0xf'));var deskjs=require(_0x6d94('0x10'));var toCsv=require(_0x6d94('0x9'));var querystring=require(_0x6d94('0x11'));var Papa=require(_0x6d94('0x12'));var Redis=require(_0x6d94('0x13'));var authService=require(_0x6d94('0x14'));var qs=require(_0x6d94('0x15'));var as=require(_0x6d94('0x16'));var hardwareService=require(_0x6d94('0x17'));var logger=require(_0x6d94('0x18'))('api');var utils=require(_0x6d94('0x19'));var config=require(_0x6d94('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d94('0x1b'))['db'];config['redis']=_[_0x6d94('0x1c')](config[_0x6d94('0x1d')],{'host':_0x6d94('0x1e'),'port':0x18eb});var socket=require(_0x6d94('0x1f'))(new Redis(config[_0x6d94('0x1d')]));require(_0x6d94('0x20'))[_0x6d94('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6d94('0x22')][_0x6d94('0x23')]({'port':0x232c});var client9002=jayson[_0x6d94('0x22')][_0x6d94('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1cea3f,_0x313dfc,_0x174b32,_0x161da9){return new BPromise(function(_0x4788ce,_0x388a9b){var _0x19461c=_0x161da9||client;return _0x19461c[_0x6d94('0x24')](_0x1cea3f,_0x174b32)[_0x6d94('0x25')](function(_0x30a192){logger[_0x6d94('0x26')](_0x6d94('0x27'),_0x313dfc,_0x6d94('0x28'));logger[_0x6d94('0x29')](_0x6d94('0x2a'),_0x313dfc,'request\x20sent',JSON['stringify'](_0x30a192));if(_0x30a192['error']){if(_0x30a192['error'][_0x6d94('0x2b')]===0x1f4){logger['error'](_0x6d94('0x27'),_0x313dfc,_0x30a192[_0x6d94('0x2c')][_0x6d94('0x2d')]);return _0x388a9b(_0x30a192[_0x6d94('0x2c')]['message']);}logger[_0x6d94('0x2c')]('FaxMessage,\x20%s,\x20%s',_0x313dfc,_0x30a192[_0x6d94('0x2c')][_0x6d94('0x2d')]);return _0x4788ce(_0x30a192['error'][_0x6d94('0x2d')]);}else{logger['info'](_0x6d94('0x27'),_0x313dfc,_0x6d94('0x28'));_0x4788ce(_0x30a192[_0x6d94('0x2e')][_0x6d94('0x2d')]);}})['catch'](function(_0x3170e2){logger[_0x6d94('0x2c')](_0x6d94('0x27'),_0x313dfc,_0x3170e2);_0x388a9b(_0x3170e2);});});}function respondWithStatusCode(_0x3e24de,_0x87e564){_0x87e564=_0x87e564||0xcc;return function(_0x3a57dc){if(_0x3a57dc){return _0x3e24de['sendStatus'](_0x87e564);}return _0x3e24de[_0x6d94('0x2f')](_0x87e564)[_0x6d94('0x30')]();};}function respondWithResult(_0x200b9e,_0x4e9bec){_0x4e9bec=_0x4e9bec||0xc8;return function(_0x5e5f5b){if(_0x5e5f5b){return _0x200b9e[_0x6d94('0x2f')](_0x4e9bec)[_0x6d94('0x31')](_0x5e5f5b);}};}function respondWithFilteredResult(_0x5371ff,_0x40c3eb){return function(_0x251d1e){if(_0x251d1e){var _0x520bbf=typeof _0x40c3eb[_0x6d94('0x32')]===_0x6d94('0x33')&&typeof _0x40c3eb[_0x6d94('0x34')]===_0x6d94('0x33');var _0x271588=_0x251d1e[_0x6d94('0x35')];var _0x37b8b8=_0x520bbf?0x0:_0x40c3eb[_0x6d94('0x32')];var _0x55012f=_0x520bbf?_0x251d1e[_0x6d94('0x35')]:_0x40c3eb['offset']+_0x40c3eb['limit'];var _0x4555b8;if(_0x55012f>=_0x271588){_0x55012f=_0x271588;_0x4555b8=0xc8;}else{_0x4555b8=0xce;}_0x5371ff[_0x6d94('0x2f')](_0x4555b8);return _0x5371ff[_0x6d94('0x36')]('Content-Range',_0x37b8b8+'-'+_0x55012f+'/'+_0x271588)['json'](_0x251d1e);}return null;};}function patchUpdates(_0x10c72c){return function(_0xea0b85){try{jsonpatch[_0x6d94('0x37')](_0xea0b85,_0x10c72c,!![]);}catch(_0x4e2fa0){return BPromise[_0x6d94('0x38')](_0x4e2fa0);}return _0xea0b85[_0x6d94('0x39')]();};}function saveUpdates(_0x5575a2,_0x4ec5d1){return function(_0x55eb9a){if(_0x55eb9a){return _0x55eb9a['update'](_0x5575a2)[_0x6d94('0x25')](function(_0x56d9b8){return _0x56d9b8;});}return null;};}function removeEntity(_0x1d89bf,_0x415788){return function(_0x39bf88){if(_0x39bf88){return _0x39bf88[_0x6d94('0x3a')]()['then'](function(){_0x1d89bf[_0x6d94('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2245eb,_0x3ab2d2){return function(_0x498d0b){if(!_0x498d0b){_0x2245eb[_0x6d94('0x3b')](0x194);}return _0x498d0b;};}function handleError(_0x2cf2b6,_0x1dcdaf){_0x1dcdaf=_0x1dcdaf||0x1f4;return function(_0x28f752){logger[_0x6d94('0x2c')](_0x28f752[_0x6d94('0x3c')]);if(_0x28f752[_0x6d94('0x3d')]){delete _0x28f752[_0x6d94('0x3d')];}_0x2cf2b6['status'](_0x1dcdaf)[_0x6d94('0x3e')](_0x28f752);};}exports[_0x6d94('0x3f')]=function(_0x526ac3,_0x4d8903){var _0x3650ca={},_0x2c6e30={},_0x4ed571={'count':0x0,'rows':[]};var _0x1a5192=_[_0x6d94('0x40')](db['FaxMessage'][_0x6d94('0x41')],function(_0x343fc8){return{'name':_0x343fc8['fieldName'],'type':_0x343fc8[_0x6d94('0x42')]['key']};});_0x2c6e30[_0x6d94('0x43')]=_[_0x6d94('0x40')](_0x1a5192,_0x6d94('0x3d'));_0x2c6e30[_0x6d94('0x44')]=_[_0x6d94('0x45')](_0x526ac3[_0x6d94('0x44')]);_0x2c6e30[_0x6d94('0x46')]=_['intersection'](_0x2c6e30['model'],_0x2c6e30['query']);_0x3650ca[_0x6d94('0x47')]=_[_0x6d94('0x48')](_0x2c6e30[_0x6d94('0x43')],qs[_0x6d94('0x49')](_0x526ac3['query'][_0x6d94('0x49')]));_0x3650ca['attributes']=_0x3650ca['attributes'][_0x6d94('0x4a')]?_0x3650ca['attributes']:_0x2c6e30[_0x6d94('0x43')];if(!_0x526ac3[_0x6d94('0x44')][_0x6d94('0x4b')]('nolimit')){_0x3650ca[_0x6d94('0x34')]=qs['limit'](_0x526ac3[_0x6d94('0x44')][_0x6d94('0x34')]);_0x3650ca[_0x6d94('0x32')]=qs[_0x6d94('0x32')](_0x526ac3[_0x6d94('0x44')][_0x6d94('0x32')]);}_0x3650ca[_0x6d94('0x4c')]=qs[_0x6d94('0x4d')](_0x526ac3[_0x6d94('0x44')][_0x6d94('0x4d')]);_0x3650ca['where']=qs['filters'](_[_0x6d94('0x4e')](_0x526ac3[_0x6d94('0x44')],_0x2c6e30[_0x6d94('0x46')]),_0x1a5192);if(_0x526ac3[_0x6d94('0x44')][_0x6d94('0x4f')]){_0x3650ca[_0x6d94('0x50')]=_['merge'](_0x3650ca['where'],{'$or':_[_0x6d94('0x40')](_0x1a5192,function(_0x3fd8b8){if(_0x3fd8b8[_0x6d94('0x42')]!=='VIRTUAL'){var _0x4849d9={};_0x4849d9[_0x3fd8b8[_0x6d94('0x3d')]]={'$like':'%'+_0x526ac3['query'][_0x6d94('0x4f')]+'%'};return _0x4849d9;}})});}_0x3650ca=_[_0x6d94('0x51')]({},_0x3650ca,_0x526ac3[_0x6d94('0x52')]);var _0x460ced={'where':_0x3650ca[_0x6d94('0x50')]};return db[_0x6d94('0x53')][_0x6d94('0x35')](_0x460ced)[_0x6d94('0x25')](function(_0x104cd0){_0x4ed571[_0x6d94('0x35')]=_0x104cd0;if(_0x526ac3[_0x6d94('0x44')][_0x6d94('0x54')]){_0x3650ca[_0x6d94('0x55')]=[{'all':!![]}];}return db[_0x6d94('0x53')][_0x6d94('0x56')](_0x3650ca);})['then'](function(_0x2bb774){_0x4ed571[_0x6d94('0x57')]=_0x2bb774;return _0x4ed571;})[_0x6d94('0x25')](respondWithFilteredResult(_0x4d8903,_0x3650ca))[_0x6d94('0x58')](handleError(_0x4d8903,null));};exports[_0x6d94('0x59')]=function(_0x2c0152,_0x1b0eb7){var _0x10f0a5={'raw':!![],'where':{'id':_0x2c0152[_0x6d94('0x5a')]['id']}},_0x53f0af={};_0x53f0af['model']=_[_0x6d94('0x45')](db[_0x6d94('0x53')][_0x6d94('0x41')]);_0x53f0af[_0x6d94('0x44')]=_[_0x6d94('0x45')](_0x2c0152['query']);_0x53f0af[_0x6d94('0x46')]=_['intersection'](_0x53f0af[_0x6d94('0x43')],_0x53f0af[_0x6d94('0x44')]);_0x10f0a5[_0x6d94('0x47')]=_['intersection'](_0x53f0af['model'],qs[_0x6d94('0x49')](_0x2c0152[_0x6d94('0x44')]['fields']));_0x10f0a5['attributes']=_0x10f0a5[_0x6d94('0x47')]['length']?_0x10f0a5[_0x6d94('0x47')]:_0x53f0af[_0x6d94('0x43')];if(_0x2c0152[_0x6d94('0x44')][_0x6d94('0x54')]){_0x10f0a5['include']=[{'all':!![]}];}_0x10f0a5=_['merge']({},_0x10f0a5,_0x2c0152['options']);return db[_0x6d94('0x53')][_0x6d94('0x5b')](_0x10f0a5)[_0x6d94('0x25')](handleEntityNotFound(_0x1b0eb7,null))[_0x6d94('0x25')](respondWithResult(_0x1b0eb7,null))[_0x6d94('0x58')](handleError(_0x1b0eb7,null));};exports[_0x6d94('0x5c')]=function(_0x52d96a,_0x3f304f){if(_0x52d96a[_0x6d94('0x5d')]['id']){delete _0x52d96a[_0x6d94('0x5d')]['id'];}return db[_0x6d94('0x53')][_0x6d94('0x5b')]({'where':{'id':_0x52d96a[_0x6d94('0x5a')]['id']}})[_0x6d94('0x25')](handleEntityNotFound(_0x3f304f,null))[_0x6d94('0x25')](saveUpdates(_0x52d96a[_0x6d94('0x5d')],null))[_0x6d94('0x25')](respondWithResult(_0x3f304f,null))[_0x6d94('0x58')](handleError(_0x3f304f,null));};exports[_0x6d94('0x3a')]=function(_0x40e73b,_0x4758bd){return db[_0x6d94('0x53')][_0x6d94('0x5b')]({'where':{'id':_0x40e73b['params']['id']}})[_0x6d94('0x25')](handleEntityNotFound(_0x4758bd,null))[_0x6d94('0x25')](removeEntity(_0x4758bd,null))[_0x6d94('0x58')](handleError(_0x4758bd,null));};exports[_0x6d94('0x5e')]=function(_0x199efa,_0x3b05f3){return db['FaxMessage']['describe']()[_0x6d94('0x25')](respondWithResult(_0x3b05f3,null))[_0x6d94('0x58')](handleError(_0x3b05f3,null));};var interaction_log=require(_0x6d94('0x18'))(_0x6d94('0x5f'));exports[_0x6d94('0x60')]=function(_0x3b5e9b,_0x19123a,_0x1501ce){var _0x574270={'agent':{},'channel':'fax'};if(_0x3b5e9b[_0x6d94('0x5d')]['id']){delete _0x3b5e9b[_0x6d94('0x5d')]['id'];}_0x3b5e9b[_0x6d94('0x5d')][_0x6d94('0x61')]=!![];_0x3b5e9b[_0x6d94('0x5d')][_0x6d94('0x62')]=moment()[_0x6d94('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b5e9b['body'][_0x6d94('0x64')]=_0x3b5e9b[_0x6d94('0x5d')][_0x6d94('0x64')]||_0x3b5e9b[_0x6d94('0x65')]['id'];_0x574270[_0x6d94('0x66')]['id']=_0x3b5e9b['body'][_0x6d94('0x64')];return db['FaxMessage'][_0x6d94('0x5b')]({'where':{'id':_0x3b5e9b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19123a,null))[_0x6d94('0x25')](saveUpdates(_0x3b5e9b[_0x6d94('0x5d')],null))[_0x6d94('0x25')](function(_0x2ddb74){if(_0x2ddb74){_0x574270[_0x6d94('0x2d')]=_0x2ddb74[_0x6d94('0x67')]({'plain':!![]});return db[_0x6d94('0x68')][_0x6d94('0x5b')]({'where':{'id':_0x2ddb74[_0x6d94('0x69')]}});}return null;})[_0x6d94('0x25')](handleEntityNotFound(_0x19123a,null))[_0x6d94('0x25')](function(_0x4d7190){if(_0x4d7190){return _0x4d7190[_0x6d94('0x5c')]({'UserId':_0x3b5e9b['body'][_0x6d94('0x64')],'read1stAt':_[_0x6d94('0x6a')](_0x4d7190[_0x6d94('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6d94('0x25')](function(_0x54260a){if(_0x54260a){_0x574270[_0x6d94('0x6c')]=_0x54260a[_0x6d94('0x67')]({'plain':!![]});interaction_log['info'](_0x6d94('0x6d'),_0x3b5e9b[_0x6d94('0x65')]['id'],_0x3b5e9b['user'][_0x6d94('0x3d')],_0x3b5e9b[_0x6d94('0x65')]['role'],_0x574270[_0x6d94('0x6c')]['id'],_0x3b5e9b[_0x6d94('0x5d')]?JSON[_0x6d94('0x6e')](_0x3b5e9b[_0x6d94('0x5d')]):_0x6d94('0x6f'));return respondWithRpcPromise(_0x6d94('0x70'),'acceptMessage',_0x574270);}return null;})[_0x6d94('0x25')](function(_0x198b88){var _0x2c1ecc=_0x6d94('0x71')+_0x198b88[_0x6d94('0x2d')][_0x6d94('0x72')];return db['sequelize'][_0x6d94('0x44')](_0x2c1ecc,{'type':db['Sequelize']['QueryTypes'][_0x6d94('0x73')],'raw':!![]})[_0x6d94('0x25')](function(_0x1fa12c){return _0x1fa12c;});})['then'](function(_0x2b1e64){if(_0x2b1e64){_0x574270[_0x6d94('0x2d')]['contact']=_0x2b1e64[0x0];if(!_0x3b5e9b[_0x6d94('0x5d')]['UserId'])return;return db[_0x6d94('0x74')][_0x6d94('0x5b')]({'where':{'id':_0x3b5e9b[_0x6d94('0x5d')]['UserId'],'role':'agent'},'attributes':['id','name',_0x6d94('0x75'),_0x6d94('0x76'),_0x6d94('0x77')],'raw':!![]});}return null;})[_0x6d94('0x25')](function(_0x1e45a5){if(!_0x1e45a5)return null;_0x574270[_0x6d94('0x2d')][_0x6d94('0x66')]=_0x1e45a5;return _0x574270;})[_0x6d94('0x25')](function(_0xaecdd2){if(_0xaecdd2){if(_0x3b5e9b[_0x6d94('0x5d')]['manual']){_0x574270[_0x6d94('0x2d')][_0x6d94('0x78')]=util[_0x6d94('0x63')](_0x6d94('0x79'),_0x3b5e9b[_0x6d94('0x65')][_0x6d94('0x3d')]);_0x574270[_0x6d94('0x2d')][_0x6d94('0x7a')]=_0x574270['channel'];_0x574270[_0x6d94('0x2d')][_0x6d94('0x7b')]=_0x574270[_0x6d94('0x7a')];_0x574270['message'][_0x6d94('0x7c')]=_0x6d94('0x60');return respondWithRpcPromise(_0x6d94('0x7d'),_0x6d94('0x7d'),{'event':_0x6d94('0x7e'),'message':_0x574270['message']},client9002)[_0x6d94('0x25')](function(){return _0x574270;});}return _0x574270;}return null;})['then'](respondWithResult(_0x19123a,null))[_0x6d94('0x58')](handleError(_0x19123a,null));};var interaction_log=require(_0x6d94('0x18'))('fax-interactions');exports['reject']=function(_0x44241e,_0x34f63b,_0x25283b){var _0x265adb={'agent':{},'channel':'fax'};if(_0x44241e['body']['id']){delete _0x44241e[_0x6d94('0x5d')]['id'];}_0x44241e[_0x6d94('0x5d')][_0x6d94('0x64')]=_0x44241e['body']['UserId']||_0x44241e['user']['id'];_0x265adb[_0x6d94('0x66')]['id']=_0x44241e[_0x6d94('0x5d')]['UserId'];return db[_0x6d94('0x53')][_0x6d94('0x5b')]({'where':{'id':_0x44241e['params']['id'],'UserId':null}})[_0x6d94('0x25')](handleEntityNotFound(_0x34f63b,null))[_0x6d94('0x25')](function(_0x3f711e){if(_0x3f711e){_0x265adb['message']=_0x3f711e[_0x6d94('0x67')]({'plain':!![]});return db[_0x6d94('0x68')][_0x6d94('0x5b')]({'where':{'id':_0x3f711e[_0x6d94('0x69')]}});}return null;})[_0x6d94('0x25')](handleEntityNotFound(_0x34f63b,null))[_0x6d94('0x25')](function(_0x2da033){if(_0x2da033){_0x265adb['interaction']=_0x2da033['get']({'plain':!![]});interaction_log[_0x6d94('0x26')](_0x6d94('0x7f'),_0x44241e[_0x6d94('0x65')]['id'],_0x44241e[_0x6d94('0x65')][_0x6d94('0x3d')],_0x44241e['user'][_0x6d94('0x80')],_0x265adb[_0x6d94('0x6c')]['id'],_0x44241e[_0x6d94('0x5d')]?JSON[_0x6d94('0x6e')](_0x44241e['body']):_0x6d94('0x6f'));return respondWithRpcPromise(_0x6d94('0x81'),_0x6d94('0x82'),_0x265adb);}return null;})['then'](function(_0x445cb9){var _0x24ea35='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x445cb9[_0x6d94('0x2d')]['ContactId'];return db[_0x6d94('0x83')]['query'](_0x24ea35,{'type':db[_0x6d94('0x84')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6d94('0x25')](function(_0x243d22){return _0x243d22;});})[_0x6d94('0x25')](function(_0x43db7d){if(_0x43db7d){_0x265adb['message'][_0x6d94('0x85')]=_0x43db7d[0x0];if(!_0x44241e[_0x6d94('0x5d')][_0x6d94('0x64')])return;return db[_0x6d94('0x74')][_0x6d94('0x5b')]({'where':{'id':_0x44241e[_0x6d94('0x5d')][_0x6d94('0x64')],'role':_0x6d94('0x66')},'attributes':['id',_0x6d94('0x3d'),'fullname',_0x6d94('0x76'),_0x6d94('0x77')],'raw':!![]});}return null;})[_0x6d94('0x25')](function(_0x5cbf77){if(!_0x5cbf77)return null;_0x265adb['message'][_0x6d94('0x66')]=_0x5cbf77;return _0x265adb;})['then'](function(_0xb940fd){if(_0xb940fd){_0xb940fd[_0x6d94('0x2d')][_0x6d94('0x78')]=util[_0x6d94('0x63')](_0x6d94('0x79'),_0x44241e[_0x6d94('0x65')][_0x6d94('0x3d')]);_0xb940fd[_0x6d94('0x2d')][_0x6d94('0x7a')]=_0x265adb[_0x6d94('0x7a')];_0xb940fd['message'][_0x6d94('0x7b')]=_0x265adb[_0x6d94('0x7a')];_0xb940fd[_0x6d94('0x2d')][_0x6d94('0x7c')]=_0x6d94('0x38');respondWithRpcPromise(_0x6d94('0x7d'),_0x6d94('0x7d'),{'event':_0x6d94('0x86'),'message':_0xb940fd[_0x6d94('0x2d')]},client9002);return _0x265adb;}return null;})[_0x6d94('0x25')](respondWithResult(_0x34f63b,null))[_0x6d94('0x58')](handleError(_0x34f63b,null));};exports[_0x6d94('0x87')]=function(_0x27c9ed,_0x4e860d){var _0x1bfc04;return db[_0x6d94('0x53')][_0x6d94('0x87')](_0x27c9ed[_0x6d94('0x5d')],{})[_0x6d94('0x25')](function(_0xdaeb47){_0x1bfc04=_0xdaeb47;return db[_0x6d94('0x88')][_0x6d94('0x89')]({'where':{'id':_0x1bfc04[_0x6d94('0x72')]}});})[_0x6d94('0x25')](function(_0xa21f86){if(_[_0x6d94('0x6a')](_0xa21f86)){return;}else{_0x1bfc04[_0x6d94('0x8a')]=_0xa21f86[_0x6d94('0x8a')];return db[_0x6d94('0x8b')][_0x6d94('0x89')]({'where':{'id':_0x1bfc04[_0x6d94('0x8c')]}});}})[_0x6d94('0x25')](function(_0x4a8cc7){return respondWithRpcPromise(_0x6d94('0x8d'),'SendFax',{'FaxAccountId':_[_0x6d94('0x6a')](_0x27c9ed[_0x6d94('0x5d')])?undefined:_0x27c9ed['body'][_0x6d94('0x8e')],'path':_[_0x6d94('0x6a')](_0x4a8cc7)?undefined:util[_0x6d94('0x63')]('/var/opt/motion2/server/files/attachments/%s',_0x4a8cc7[_0x6d94('0x8f')]),'fax':_[_0x6d94('0x6a')](_0x1bfc04[_0x6d94('0x8a')])?undefined:_0x1bfc04['fax'],'AttachmentId':_0x1bfc04[_0x6d94('0x8c')]},client9002);})['then'](respondWithResult(_0x4e860d,0xc9))['catch'](handleError(_0x4e860d,null));};exports[_0x6d94('0x90')]=function(_0xa1b438,_0x88982d){var _0xabb20f=path[_0x6d94('0x91')](config[_0x6d94('0x92')],_0x6d94('0x93'),_0x6d94('0x94'),'attachments');return db[_0x6d94('0x53')][_0x6d94('0x5b')]({'where':{'id':_0xa1b438[_0x6d94('0x5a')]['id']},'include':[{'model':db[_0x6d94('0x8b')],'as':_0x6d94('0x8b')}]})[_0x6d94('0x25')](handleEntityNotFound(_0x88982d,null))[_0x6d94('0x25')](function(_0x4ca9f3){if(_0x4ca9f3){return _0x88982d[_0x6d94('0x90')](path[_0x6d94('0x91')](_0xabb20f,_0x4ca9f3[_0x6d94('0x8b')]['basename']));}})[_0x6d94('0x58')](handleError(_0x88982d,null));}; \ No newline at end of file +var _0x0172=['FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','basename','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','FaxMessage','includeAll','include','findAll','show','params','intersection','length','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','Sequelize','contact','User','fullname','internal','interface','SIP/%s','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','SELECT','email','channel','rejectmessage','findOne','Attachment','AttachmentId','SendFax'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0172,0x1b2));var _0x2017=function(_0x5c5fca,_0x3332b8){_0x5c5fca=_0x5c5fca-0x0;var _0x1721de=_0x0172[_0x5c5fca];return _0x1721de;};'use strict';var emlformat=require(_0x2017('0x0'));var rimraf=require(_0x2017('0x1'));var zipdir=require(_0x2017('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2017('0x3'));var moment=require(_0x2017('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2017('0x5'));var util=require(_0x2017('0x6'));var path=require(_0x2017('0x7'));var sox=require(_0x2017('0x8'));var csv=require('to-csv');var ejs=require(_0x2017('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2017('0xa'));var squel=require(_0x2017('0xb'));var crypto=require(_0x2017('0xc'));var jsforce=require(_0x2017('0xd'));var deskjs=require(_0x2017('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2017('0xf'));var Papa=require(_0x2017('0x10'));var Redis=require('ioredis');var authService=require(_0x2017('0x11'));var qs=require(_0x2017('0x12'));var as=require(_0x2017('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2017('0x14'))('api');var utils=require(_0x2017('0x15'));var config=require(_0x2017('0x16'));var licenseUtil=require(_0x2017('0x17'));var db=require(_0x2017('0x18'))['db'];config[_0x2017('0x19')]=_[_0x2017('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2017('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x2017('0x1c')](socket);var jayson=require(_0x2017('0x1d'));var client=jayson['client'][_0x2017('0x1e')]({'port':0x232c});var client9002=jayson[_0x2017('0x1f')][_0x2017('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xac1942,_0x2c7ce2,_0x127ba5,_0x6f0ce6){return new BPromise(function(_0x2e293e,_0x144be7){var _0x19e0f4=_0x6f0ce6||client;return _0x19e0f4[_0x2017('0x20')](_0xac1942,_0x127ba5)[_0x2017('0x21')](function(_0x189c79){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2c7ce2,_0x2017('0x22'));logger[_0x2017('0x23')](_0x2017('0x24'),_0x2c7ce2,_0x2017('0x22'),JSON[_0x2017('0x25')](_0x189c79));if(_0x189c79[_0x2017('0x26')]){if(_0x189c79[_0x2017('0x26')][_0x2017('0x27')]===0x1f4){logger[_0x2017('0x26')](_0x2017('0x28'),_0x2c7ce2,_0x189c79[_0x2017('0x26')][_0x2017('0x29')]);return _0x144be7(_0x189c79[_0x2017('0x26')][_0x2017('0x29')]);}logger[_0x2017('0x26')](_0x2017('0x28'),_0x2c7ce2,_0x189c79['error'][_0x2017('0x29')]);return _0x2e293e(_0x189c79[_0x2017('0x26')][_0x2017('0x29')]);}else{logger['info'](_0x2017('0x28'),_0x2c7ce2,'request\x20sent');_0x2e293e(_0x189c79[_0x2017('0x2a')]['message']);}})[_0x2017('0x2b')](function(_0x2892f6){logger[_0x2017('0x26')](_0x2017('0x28'),_0x2c7ce2,_0x2892f6);_0x144be7(_0x2892f6);});});}function respondWithStatusCode(_0x32ab41,_0x4e5835){_0x4e5835=_0x4e5835||0xcc;return function(_0x47b8a6){if(_0x47b8a6){return _0x32ab41['sendStatus'](_0x4e5835);}return _0x32ab41[_0x2017('0x2c')](_0x4e5835)[_0x2017('0x2d')]();};}function respondWithResult(_0x7e05e3,_0x318137){_0x318137=_0x318137||0xc8;return function(_0x1096e7){if(_0x1096e7){return _0x7e05e3['status'](_0x318137)['json'](_0x1096e7);}};}function respondWithFilteredResult(_0x45f092,_0x21d586){return function(_0x26d1ab){if(_0x26d1ab){var _0x9eb83a=typeof _0x21d586[_0x2017('0x2e')]===_0x2017('0x2f')&&typeof _0x21d586[_0x2017('0x30')]===_0x2017('0x2f');var _0x2b4c18=_0x26d1ab['count'];var _0x5d97d0=_0x9eb83a?0x0:_0x21d586[_0x2017('0x2e')];var _0x3c8eb9=_0x9eb83a?_0x26d1ab[_0x2017('0x31')]:_0x21d586[_0x2017('0x2e')]+_0x21d586[_0x2017('0x30')];var _0x59a22e;if(_0x3c8eb9>=_0x2b4c18){_0x3c8eb9=_0x2b4c18;_0x59a22e=0xc8;}else{_0x59a22e=0xce;}_0x45f092[_0x2017('0x2c')](_0x59a22e);return _0x45f092['set'](_0x2017('0x32'),_0x5d97d0+'-'+_0x3c8eb9+'/'+_0x2b4c18)[_0x2017('0x33')](_0x26d1ab);}return null;};}function patchUpdates(_0x86cca3){return function(_0x373a78){try{jsonpatch[_0x2017('0x34')](_0x373a78,_0x86cca3,!![]);}catch(_0x55976c){return BPromise[_0x2017('0x35')](_0x55976c);}return _0x373a78['save']();};}function saveUpdates(_0x4dcb8b,_0x43a0db){return function(_0x5ec1bf){if(_0x5ec1bf){return _0x5ec1bf[_0x2017('0x36')](_0x4dcb8b)[_0x2017('0x21')](function(_0x5ceda0){return _0x5ceda0;});}return null;};}function removeEntity(_0x40a28b,_0x4276da){return function(_0x1db332){if(_0x1db332){return _0x1db332[_0x2017('0x37')]()[_0x2017('0x21')](function(){_0x40a28b[_0x2017('0x2c')](0xcc)[_0x2017('0x2d')]();});}};}function handleEntityNotFound(_0x28cece,_0x1d0691){return function(_0x3b47fa){if(!_0x3b47fa){_0x28cece[_0x2017('0x38')](0x194);}return _0x3b47fa;};}function handleError(_0x5abf15,_0x57b364){_0x57b364=_0x57b364||0x1f4;return function(_0x1ebab5){logger[_0x2017('0x26')](_0x1ebab5[_0x2017('0x39')]);if(_0x1ebab5[_0x2017('0x3a')]){delete _0x1ebab5['name'];}_0x5abf15['status'](_0x57b364)[_0x2017('0x3b')](_0x1ebab5);};}exports[_0x2017('0x3c')]=function(_0x930262,_0xb6e0c7){var _0x406c33={},_0x3476dd={},_0x4d1763={'count':0x0,'rows':[]};var _0x1c2892=_['map'](db['FaxMessage'][_0x2017('0x3d')],function(_0x36d158){return{'name':_0x36d158[_0x2017('0x3e')],'type':_0x36d158[_0x2017('0x3f')][_0x2017('0x40')]};});_0x3476dd[_0x2017('0x41')]=_['map'](_0x1c2892,_0x2017('0x3a'));_0x3476dd['query']=_[_0x2017('0x42')](_0x930262['query']);_0x3476dd['filters']=_['intersection'](_0x3476dd[_0x2017('0x41')],_0x3476dd[_0x2017('0x43')]);_0x406c33[_0x2017('0x44')]=_['intersection'](_0x3476dd[_0x2017('0x41')],qs[_0x2017('0x45')](_0x930262[_0x2017('0x43')][_0x2017('0x45')]));_0x406c33[_0x2017('0x44')]=_0x406c33[_0x2017('0x44')]['length']?_0x406c33[_0x2017('0x44')]:_0x3476dd['model'];if(!_0x930262[_0x2017('0x43')][_0x2017('0x46')](_0x2017('0x47'))){_0x406c33[_0x2017('0x30')]=qs[_0x2017('0x30')](_0x930262[_0x2017('0x43')][_0x2017('0x30')]);_0x406c33[_0x2017('0x2e')]=qs[_0x2017('0x2e')](_0x930262[_0x2017('0x43')][_0x2017('0x2e')]);}_0x406c33[_0x2017('0x48')]=qs[_0x2017('0x49')](_0x930262[_0x2017('0x43')][_0x2017('0x49')]);_0x406c33[_0x2017('0x4a')]=qs[_0x2017('0x4b')](_['pick'](_0x930262['query'],_0x3476dd['filters']),_0x1c2892);if(_0x930262[_0x2017('0x43')][_0x2017('0x4c')]){_0x406c33[_0x2017('0x4a')]=_[_0x2017('0x4d')](_0x406c33[_0x2017('0x4a')],{'$or':_[_0x2017('0x4e')](_0x1c2892,function(_0x52e235){if(_0x52e235[_0x2017('0x3f')]!=='VIRTUAL'){var _0x491373={};_0x491373[_0x52e235[_0x2017('0x3a')]]={'$like':'%'+_0x930262[_0x2017('0x43')]['filter']+'%'};return _0x491373;}})});}_0x406c33=_[_0x2017('0x4d')]({},_0x406c33,_0x930262[_0x2017('0x4f')]);var _0x2a347e={'where':_0x406c33['where']};return db[_0x2017('0x50')][_0x2017('0x31')](_0x2a347e)[_0x2017('0x21')](function(_0x313ab1){_0x4d1763[_0x2017('0x31')]=_0x313ab1;if(_0x930262[_0x2017('0x43')][_0x2017('0x51')]){_0x406c33[_0x2017('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x2017('0x53')](_0x406c33);})[_0x2017('0x21')](function(_0x377601){_0x4d1763['rows']=_0x377601;return _0x4d1763;})['then'](respondWithFilteredResult(_0xb6e0c7,_0x406c33))[_0x2017('0x2b')](handleError(_0xb6e0c7,null));};exports[_0x2017('0x54')]=function(_0x178455,_0x4cda0e){var _0x1c4010={'raw':!![],'where':{'id':_0x178455[_0x2017('0x55')]['id']}},_0x4a376d={};_0x4a376d[_0x2017('0x41')]=_[_0x2017('0x42')](db[_0x2017('0x50')][_0x2017('0x3d')]);_0x4a376d[_0x2017('0x43')]=_['keys'](_0x178455[_0x2017('0x43')]);_0x4a376d[_0x2017('0x4b')]=_['intersection'](_0x4a376d[_0x2017('0x41')],_0x4a376d[_0x2017('0x43')]);_0x1c4010[_0x2017('0x44')]=_[_0x2017('0x56')](_0x4a376d[_0x2017('0x41')],qs[_0x2017('0x45')](_0x178455[_0x2017('0x43')][_0x2017('0x45')]));_0x1c4010[_0x2017('0x44')]=_0x1c4010[_0x2017('0x44')][_0x2017('0x57')]?_0x1c4010[_0x2017('0x44')]:_0x4a376d[_0x2017('0x41')];if(_0x178455['query'][_0x2017('0x51')]){_0x1c4010[_0x2017('0x52')]=[{'all':!![]}];}_0x1c4010=_[_0x2017('0x4d')]({},_0x1c4010,_0x178455[_0x2017('0x4f')]);return db[_0x2017('0x50')][_0x2017('0x58')](_0x1c4010)[_0x2017('0x21')](handleEntityNotFound(_0x4cda0e,null))[_0x2017('0x21')](respondWithResult(_0x4cda0e,null))['catch'](handleError(_0x4cda0e,null));};exports[_0x2017('0x36')]=function(_0x9b6e63,_0x2154e5){if(_0x9b6e63[_0x2017('0x59')]['id']){delete _0x9b6e63['body']['id'];}return db[_0x2017('0x50')][_0x2017('0x58')]({'where':{'id':_0x9b6e63[_0x2017('0x55')]['id']}})[_0x2017('0x21')](handleEntityNotFound(_0x2154e5,null))['then'](saveUpdates(_0x9b6e63[_0x2017('0x59')],null))[_0x2017('0x21')](respondWithResult(_0x2154e5,null))[_0x2017('0x2b')](handleError(_0x2154e5,null));};exports['destroy']=function(_0x4e82dd,_0x586936){return db[_0x2017('0x50')][_0x2017('0x58')]({'where':{'id':_0x4e82dd['params']['id']}})['then'](handleEntityNotFound(_0x586936,null))[_0x2017('0x21')](removeEntity(_0x586936,null))[_0x2017('0x2b')](handleError(_0x586936,null));};exports[_0x2017('0x5a')]=function(_0x5ba170,_0x16918f){return db[_0x2017('0x50')][_0x2017('0x5a')]()[_0x2017('0x21')](respondWithResult(_0x16918f,null))[_0x2017('0x2b')](handleError(_0x16918f,null));};var interaction_log=require(_0x2017('0x14'))(_0x2017('0x5b'));exports[_0x2017('0x5c')]=function(_0x1a9009,_0x24ec28,_0x4fb49){var _0x2895a8={'agent':{},'channel':_0x2017('0x5d')};if(_0x1a9009[_0x2017('0x59')]['id']){delete _0x1a9009[_0x2017('0x59')]['id'];}_0x1a9009['body'][_0x2017('0x5e')]=!![];_0x1a9009['body'][_0x2017('0x5f')]=moment()[_0x2017('0x60')](_0x2017('0x61'));_0x1a9009[_0x2017('0x59')][_0x2017('0x62')]=_0x1a9009[_0x2017('0x59')]['UserId']||_0x1a9009[_0x2017('0x63')]['id'];_0x2895a8[_0x2017('0x64')]['id']=_0x1a9009[_0x2017('0x59')]['UserId'];return db[_0x2017('0x50')]['find']({'where':{'id':_0x1a9009[_0x2017('0x55')]['id'],'UserId':null}})[_0x2017('0x21')](handleEntityNotFound(_0x24ec28,null))[_0x2017('0x21')](saveUpdates(_0x1a9009['body'],null))[_0x2017('0x21')](function(_0x449dc4){if(_0x449dc4){_0x2895a8['message']=_0x449dc4[_0x2017('0x65')]({'plain':!![]});return db[_0x2017('0x66')][_0x2017('0x58')]({'where':{'id':_0x449dc4[_0x2017('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x24ec28,null))[_0x2017('0x21')](function(_0x1e04e3){if(_0x1e04e3){return _0x1e04e3[_0x2017('0x36')]({'UserId':_0x1a9009[_0x2017('0x59')][_0x2017('0x62')],'read1stAt':_[_0x2017('0x68')](_0x1e04e3['read1stAt'])?moment()[_0x2017('0x60')](_0x2017('0x61')):undefined});}return null;})[_0x2017('0x21')](function(_0x372ed6){if(_0x372ed6){_0x2895a8[_0x2017('0x69')]=_0x372ed6[_0x2017('0x65')]({'plain':!![]});interaction_log[_0x2017('0x6a')](_0x2017('0x6b'),_0x1a9009[_0x2017('0x63')]['id'],_0x1a9009['user'][_0x2017('0x3a')],_0x1a9009[_0x2017('0x63')]['role'],_0x2895a8[_0x2017('0x69')]['id'],_0x1a9009[_0x2017('0x59')]?JSON[_0x2017('0x25')](_0x1a9009[_0x2017('0x59')]):_0x2017('0x6c'));return respondWithRpcPromise(_0x2017('0x6d'),_0x2017('0x6e'),_0x2895a8);}return null;})[_0x2017('0x21')](function(_0x583d75){var _0x104a63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x583d75[_0x2017('0x29')]['ContactId'];return db[_0x2017('0x6f')][_0x2017('0x43')](_0x104a63,{'type':db[_0x2017('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2017('0x21')](function(_0x24e9d7){return _0x24e9d7;});})[_0x2017('0x21')](function(_0x68a43){if(_0x68a43){_0x2895a8['message'][_0x2017('0x71')]=_0x68a43[0x0];if(!_0x1a9009['body']['UserId'])return;return db[_0x2017('0x72')][_0x2017('0x58')]({'where':{'id':_0x1a9009['body'][_0x2017('0x62')],'role':_0x2017('0x64')},'attributes':['id',_0x2017('0x3a'),_0x2017('0x73'),'email',_0x2017('0x74')],'raw':!![]});}return null;})[_0x2017('0x21')](function(_0xd5b8a9){if(!_0xd5b8a9)return null;_0x2895a8[_0x2017('0x29')][_0x2017('0x64')]=_0xd5b8a9;return _0x2895a8;})[_0x2017('0x21')](function(_0x63f287){if(_0x63f287){if(_0x1a9009['body']['manual']){_0x2895a8[_0x2017('0x29')][_0x2017('0x75')]=util[_0x2017('0x60')](_0x2017('0x76'),_0x1a9009[_0x2017('0x63')][_0x2017('0x3a')]);_0x2895a8[_0x2017('0x29')]['channel']=_0x2895a8['channel'];_0x2895a8[_0x2017('0x29')]['motionChannel']=_0x2895a8['channel'];_0x2895a8[_0x2017('0x29')][_0x2017('0x77')]=_0x2017('0x5c');return respondWithRpcPromise(_0x2017('0x78'),_0x2017('0x78'),{'event':_0x2017('0x79'),'message':_0x2895a8['message']},client9002)[_0x2017('0x21')](function(){return _0x2895a8;});}return _0x2895a8;}return null;})[_0x2017('0x21')](respondWithResult(_0x24ec28,null))[_0x2017('0x2b')](handleError(_0x24ec28,null));};var interaction_log=require(_0x2017('0x14'))(_0x2017('0x5b'));exports[_0x2017('0x35')]=function(_0x595cc5,_0x174985,_0x535977){var _0x2fbb97={'agent':{},'channel':_0x2017('0x5d')};if(_0x595cc5[_0x2017('0x59')]['id']){delete _0x595cc5[_0x2017('0x59')]['id'];}_0x595cc5[_0x2017('0x59')][_0x2017('0x62')]=_0x595cc5[_0x2017('0x59')][_0x2017('0x62')]||_0x595cc5[_0x2017('0x63')]['id'];_0x2fbb97[_0x2017('0x64')]['id']=_0x595cc5['body']['UserId'];return db[_0x2017('0x50')][_0x2017('0x58')]({'where':{'id':_0x595cc5['params']['id'],'UserId':null}})[_0x2017('0x21')](handleEntityNotFound(_0x174985,null))['then'](function(_0x4c9f12){if(_0x4c9f12){_0x2fbb97[_0x2017('0x29')]=_0x4c9f12['get']({'plain':!![]});return db[_0x2017('0x66')][_0x2017('0x58')]({'where':{'id':_0x4c9f12[_0x2017('0x67')]}});}return null;})[_0x2017('0x21')](handleEntityNotFound(_0x174985,null))['then'](function(_0xc4d89c){if(_0xc4d89c){_0x2fbb97[_0x2017('0x69')]=_0xc4d89c[_0x2017('0x65')]({'plain':!![]});interaction_log[_0x2017('0x6a')](_0x2017('0x7a'),_0x595cc5[_0x2017('0x63')]['id'],_0x595cc5[_0x2017('0x63')][_0x2017('0x3a')],_0x595cc5[_0x2017('0x63')][_0x2017('0x7b')],_0x2fbb97['interaction']['id'],_0x595cc5[_0x2017('0x59')]?JSON[_0x2017('0x25')](_0x595cc5[_0x2017('0x59')]):_0x2017('0x6c'));return respondWithRpcPromise(_0x2017('0x7c'),'rejectMessage',_0x2fbb97);}return null;})[_0x2017('0x21')](function(_0x4e1e54){var _0x2cd185='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e1e54[_0x2017('0x29')][_0x2017('0x7d')];return db[_0x2017('0x6f')][_0x2017('0x43')](_0x2cd185,{'type':db[_0x2017('0x70')]['QueryTypes'][_0x2017('0x7e')],'raw':!![]})[_0x2017('0x21')](function(_0x3178da){return _0x3178da;});})[_0x2017('0x21')](function(_0x190a76){if(_0x190a76){_0x2fbb97[_0x2017('0x29')]['contact']=_0x190a76[0x0];if(!_0x595cc5[_0x2017('0x59')][_0x2017('0x62')])return;return db['User'][_0x2017('0x58')]({'where':{'id':_0x595cc5['body']['UserId'],'role':_0x2017('0x64')},'attributes':['id',_0x2017('0x3a'),'fullname',_0x2017('0x7f'),_0x2017('0x74')],'raw':!![]});}return null;})['then'](function(_0x199898){if(!_0x199898)return null;_0x2fbb97['message']['agent']=_0x199898;return _0x2fbb97;})[_0x2017('0x21')](function(_0x1246a1){if(_0x1246a1){_0x1246a1[_0x2017('0x29')][_0x2017('0x75')]=util[_0x2017('0x60')](_0x2017('0x76'),_0x595cc5[_0x2017('0x63')]['name']);_0x1246a1['message'][_0x2017('0x80')]=_0x2fbb97[_0x2017('0x80')];_0x1246a1[_0x2017('0x29')]['motionChannel']=_0x2fbb97[_0x2017('0x80')];_0x1246a1[_0x2017('0x29')][_0x2017('0x77')]=_0x2017('0x35');respondWithRpcPromise('EventManager',_0x2017('0x78'),{'event':_0x2017('0x81'),'message':_0x1246a1[_0x2017('0x29')]},client9002);return _0x2fbb97;}return null;})['then'](respondWithResult(_0x174985,null))[_0x2017('0x2b')](handleError(_0x174985,null));};exports['create']=function(_0x46865e,_0x57fb3e){var _0x1e4e4d;return db[_0x2017('0x50')]['create'](_0x46865e['body'],{})[_0x2017('0x21')](function(_0x154ef0){_0x1e4e4d=_0x154ef0;return db['CmContact'][_0x2017('0x82')]({'where':{'id':_0x1e4e4d[_0x2017('0x7d')]}});})['then'](function(_0x13cb11){if(_['isNil'](_0x13cb11)){return;}else{_0x1e4e4d[_0x2017('0x5d')]=_0x13cb11['fax'];return db[_0x2017('0x83')][_0x2017('0x82')]({'where':{'id':_0x1e4e4d[_0x2017('0x84')]}});}})[_0x2017('0x21')](function(_0x4708f3){return respondWithRpcPromise('SendFax',_0x2017('0x85'),{'FaxAccountId':_[_0x2017('0x68')](_0x46865e[_0x2017('0x59')])?undefined:_0x46865e['body'][_0x2017('0x86')],'path':_[_0x2017('0x68')](_0x4708f3)?undefined:util['format'](_0x2017('0x87'),_0x4708f3['basename']),'fax':_['isNil'](_0x1e4e4d[_0x2017('0x5d')])?undefined:_0x1e4e4d['fax'],'AttachmentId':_0x1e4e4d[_0x2017('0x84')]},client9002);})[_0x2017('0x21')](respondWithResult(_0x57fb3e,0xc9))['catch'](handleError(_0x57fb3e,null));};exports[_0x2017('0x88')]=function(_0x81dcbf,_0x294667){var _0x335bef=path[_0x2017('0x89')](config['root'],_0x2017('0x8a'),_0x2017('0x8b'),_0x2017('0x8c'));return db['FaxMessage']['find']({'where':{'id':_0x81dcbf[_0x2017('0x55')]['id']},'include':[{'model':db[_0x2017('0x83')],'as':_0x2017('0x83')}]})[_0x2017('0x21')](handleEntityNotFound(_0x294667,null))['then'](function(_0x514d69){if(_0x514d69){return _0x294667[_0x2017('0x88')](path['join'](_0x335bef,_0x514d69[_0x2017('0x83')][_0x2017('0x8d')]));}})[_0x2017('0x2b')](handleError(_0x294667,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ed04849..f1afcef 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 _0xc9c3=['FaxMessage','save','update','remove','hook','exports'];(function(_0x4ee1d1,_0x344259){var _0x192470=function(_0x27b11f){while(--_0x27b11f){_0x4ee1d1['push'](_0x4ee1d1['shift']());}};_0x192470(++_0x344259);}(_0xc9c3,0x96));var _0x3c9c=function(_0x558e4f,_0x5b3312){_0x558e4f=_0x558e4f-0x0;var _0x2220fa=_0xc9c3[_0x558e4f];return _0x2220fa;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x3c9c('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c9c('0x1'),'afterUpdate':_0x3c9c('0x2'),'afterDestroy':_0x3c9c('0x3')};function emitEvent(_0x2ec103){return function(_0x2b0045,_0xe07e05,_0x143bfe){FaxMessageEvents['emit'](_0x2ec103+':'+_0x2b0045['id'],_0x2b0045);FaxMessageEvents['emit'](_0x2ec103,_0x2b0045);_0x143bfe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x3c9c('0x4')](e,emitEvent(event));}}module[_0x3c9c('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0x0a1c=['FaxMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x528b36,_0x4fb3eb){var _0x319172=function(_0x2a489d){while(--_0x2a489d){_0x528b36['push'](_0x528b36['shift']());}};_0x319172(++_0x4fb3eb);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x0a1c[_0x2cf2e9];return _0xd3670d;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0xc0a1('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc0a1('0x1')](0x0);var events={'afterCreate':_0xc0a1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e1b0a){return function(_0x411ce9,_0x108afd,_0x1df4bf){FaxMessageEvents[_0xc0a1('0x3')](_0x3e1b0a+':'+_0x411ce9['id'],_0x411ce9);FaxMessageEvents[_0xc0a1('0x3')](_0x3e1b0a,_0x411ce9);_0x1df4bf(null);};}for(var e in events){if(events[_0xc0a1('0x4')](e)){var event=events[e];FaxMessage[_0xc0a1('0x5')](e,emitEvent(event));}}module[_0xc0a1('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8b60842..e8c4e78 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 _0x2602=['FaxInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','direction','out','secret','UserId','FaxInteraction'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0x2602,0x1c2));var _0x2260=function(_0xed0bb8,_0x26e01a){_0xed0bb8=_0xed0bb8-0x0;var _0x55a32b=_0x2602[_0xed0bb8];return _0x55a32b;};'use strict';var _=require(_0x2260('0x0'));var util=require(_0x2260('0x1'));var logger=require('../../config/logger')(_0x2260('0x2'));var moment=require(_0x2260('0x3'));var BPromise=require('bluebird');var rp=require(_0x2260('0x4'));var fs=require('fs');var path=require(_0x2260('0x5'));var rimraf=require(_0x2260('0x6'));var config=require(_0x2260('0x7'));var attributes=require(_0x2260('0x8'));module[_0x2260('0x9')]=function(_0x344830,_0x455c59){return _0x344830[_0x2260('0xa')]('FaxMessage',attributes,{'tableName':_0x2260('0xb'),'paranoid':![],'indexes':[{'name':_0x2260('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x516be6,_0x249497,_0xb704d7){var _0x127613=_0x344830['models'];var _0x222fcf=_0x516be6['get']({'plain':!![]});if(_0x222fcf['direction']['toLowerCase']()==='in'||_0x222fcf[_0x2260('0xd')]['toLowerCase']()===_0x2260('0xe')&&!_0x222fcf[_0x2260('0xf')]&&!_['isNil'](_0x222fcf[_0x2260('0x10')])){_0x127613[_0x2260('0x11')]['findOne']({'where':{'id':_0x222fcf[_0x2260('0x12')]}})[_0x2260('0x13')](function(_0x531f16){if(_0x531f16){_0x531f16[_0x2260('0x14')]({'lastMsgAt':_0x222fcf[_0x2260('0x15')],'lastMsgDirection':_0x222fcf[_0x2260('0xd')][_0x2260('0x16')]()});}})[_0x2260('0x17')](function(_0x18b0ef){console[_0x2260('0x18')](_0x18b0ef);});}_0xb704d7();}},'charset':'utf8mb4','collate':_0x2260('0x19')});}; \ No newline at end of file +var _0xbb32=['FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','out','secret','isNil','UserId'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xbb32,0xcb));var _0x2bb3=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xbb32[_0x178856];return _0x3c7fe7;};'use strict';var _=require('lodash');var util=require(_0x2bb3('0x0'));var logger=require(_0x2bb3('0x1'))(_0x2bb3('0x2'));var moment=require(_0x2bb3('0x3'));var BPromise=require('bluebird');var rp=require(_0x2bb3('0x4'));var fs=require('fs');var path=require(_0x2bb3('0x5'));var rimraf=require(_0x2bb3('0x6'));var config=require(_0x2bb3('0x7'));var attributes=require(_0x2bb3('0x8'));module['exports']=function(_0x23f7e2,_0x2aaa45){return _0x23f7e2[_0x2bb3('0x9')](_0x2bb3('0xa'),attributes,{'tableName':_0x2bb3('0xb'),'paranoid':![],'indexes':[{'name':_0x2bb3('0xc'),'fields':['body'],'type':_0x2bb3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x75346,_0x56ac64,_0x34dfb1){var _0x1f234c=_0x23f7e2[_0x2bb3('0xe')];var _0x4864c4=_0x75346[_0x2bb3('0xf')]({'plain':!![]});if(_0x4864c4[_0x2bb3('0x10')]['toLowerCase']()==='in'||_0x4864c4[_0x2bb3('0x10')]['toLowerCase']()===_0x2bb3('0x11')&&!_0x4864c4[_0x2bb3('0x12')]&&!_[_0x2bb3('0x13')](_0x4864c4[_0x2bb3('0x14')])){_0x1f234c[_0x2bb3('0x15')]['findOne']({'where':{'id':_0x4864c4[_0x2bb3('0x16')]}})['then'](function(_0x2cbe1c){if(_0x2cbe1c){_0x2cbe1c[_0x2bb3('0x17')]({'lastMsgAt':_0x4864c4[_0x2bb3('0x18')],'lastMsgDirection':_0x4864c4['direction']['toLowerCase']()});}})[_0x2bb3('0x19')](function(_0x3fe574){console[_0x2bb3('0x1a')](_0x3fe574);});}_0x34dfb1();}},'charset':'utf8mb4','collate':_0x2bb3('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3249995..9bc9747 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 _0x8d0e=['http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','debug','UpdateFaxMessage','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x17ee1c,_0x4aede4){var _0x177179=function(_0x159ba3){while(--_0x159ba3){_0x17ee1c['push'](_0x17ee1c['shift']());}};_0x177179(++_0x4aede4);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3b1ef5,_0x3a7e62){_0x3b1ef5=_0x3b1ef5-0x0;var _0x220864=_0x8d0e[_0x3b1ef5];return _0x220864;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});config[_0xe8d0('0xb')]=_[_0xe8d0('0xc')](config[_0xe8d0('0xb')],{'host':_0xe8d0('0xd'),'port':0x18eb});var socket=require(_0xe8d0('0xe'))(new Redis(config[_0xe8d0('0xb')]));require(_0xe8d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x10e56c,_0x19c3d0,_0x463159){return new BPromise(function(_0x599bc3,_0x580aab){return client[_0xe8d0('0x10')](_0x10e56c,_0x463159)[_0xe8d0('0x11')](function(_0x3da047){logger[_0xe8d0('0x12')](_0xe8d0('0x13'),_0x19c3d0,_0xe8d0('0x14'));logger['debug'](_0xe8d0('0x15'),_0x19c3d0,_0xe8d0('0x14'),JSON['stringify'](_0x3da047));if(_0x3da047[_0xe8d0('0x16')]){if(_0x3da047['error']['code']===0x1f4){logger[_0xe8d0('0x16')](_0xe8d0('0x13'),_0x19c3d0,_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);return _0x580aab(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}logger['error'](_0xe8d0('0x13'),_0x19c3d0,_0x3da047['error'][_0xe8d0('0x17')]);return _0x599bc3(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x19c3d0,'request\x20sent');_0x599bc3(_0x3da047[_0xe8d0('0x18')][_0xe8d0('0x17')]);}})[_0xe8d0('0x19')](function(_0x44bbe4){logger[_0xe8d0('0x16')]('FaxMessage,\x20%s,\x20%s',_0x19c3d0,_0x44bbe4);_0x580aab(_0x44bbe4);});});}exports[_0xe8d0('0x1a')]=function(_0x12ebf4){var _0x524b00=this;return new Promise(function(_0x5ce284,_0x554402){return db[_0xe8d0('0x1b')][_0xe8d0('0x1c')](_0x12ebf4[_0xe8d0('0x1d')],{'raw':_0x12ebf4[_0xe8d0('0x1e')]?_0x12ebf4[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![]})[_0xe8d0('0x11')](function(_0x28a6b5){logger[_0xe8d0('0x12')]('CreateFaxMessage',_0x12ebf4);logger[_0xe8d0('0x20')](_0xe8d0('0x1a'),_0x12ebf4,JSON['stringify'](_0x28a6b5));_0x5ce284(_0x28a6b5);})[_0xe8d0('0x19')](function(_0x2e69d1){logger[_0xe8d0('0x16')](_0xe8d0('0x1a'),_0x2e69d1[_0xe8d0('0x17')],_0x12ebf4);_0x554402(_0x524b00[_0xe8d0('0x16')](0x1f4,_0x2e69d1[_0xe8d0('0x17')]));});});};exports[_0xe8d0('0x21')]=function(_0xfa3527){var _0x2dee67=this;return new Promise(function(_0x264de4,_0x539548){return db[_0xe8d0('0x1b')][_0xe8d0('0x22')](_0xfa3527[_0xe8d0('0x1d')],{'raw':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x23')]||null:null,'attributes':_0xfa3527[_0xe8d0('0x1e')]?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x24')]||null:null,'limit':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')]['limit']||null:null})['then'](function(_0x50ad3c){logger[_0xe8d0('0x12')](_0xe8d0('0x21'),_0xfa3527);logger[_0xe8d0('0x20')]('UpdateFaxMessage',_0xfa3527,JSON['stringify'](_0x50ad3c));_0x264de4(_0x50ad3c);})[_0xe8d0('0x19')](function(_0x551999){logger[_0xe8d0('0x16')](_0xe8d0('0x21'),_0x551999[_0xe8d0('0x17')],_0xfa3527);_0x539548(_0x2dee67[_0xe8d0('0x16')](0x1f4,_0x551999[_0xe8d0('0x17')]));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fd1,0x155));var _0x15fd=function(_0x933daf,_0x58c304){_0x933daf=_0x933daf-0x0;var _0x1d56c9=_0x5fd1[_0x933daf];return _0x1d56c9;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 586d7b8..a3e87aa 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 _0xe488=['removeListener','register','faxMessage:','remove','emit'];(function(_0x129146,_0x4041ef){var _0x300e5e=function(_0x13594a){while(--_0x13594a){_0x129146['push'](_0x129146['shift']());}};_0x300e5e(++_0x4041ef);}(_0xe488,0x120));var _0x8e48=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xe488[_0x39e283];return _0x7de89f;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x8e48('0x0'),'update'];function createListener(_0x19eddf,_0x343285){return function(_0x16fd17){_0x343285[_0x8e48('0x1')](_0x19eddf,_0x16fd17);};}function removeListener(_0x29ef0d,_0x375ae){return function(){FaxMessageEvents[_0x8e48('0x2')](_0x29ef0d,_0x375ae);};}exports[_0x8e48('0x3')]=function(_0x231747){for(var _0x3ebf8f=0x0,_0x44b8b3=events['length'];_0x3ebf8f<_0x44b8b3;_0x3ebf8f++){var _0x326cec=events[_0x3ebf8f];var _0x42eb19=createListener(_0x8e48('0x4')+_0x326cec,_0x231747);FaxMessageEvents['on'](_0x326cec,_0x42eb19);}}; \ No newline at end of file +var _0x52c8=['./faxMessage.events','save','update','removeListener','register','length','faxMessage:'];(function(_0x16108c,_0x1c0ff2){var _0x5e23b6=function(_0x8c00b3){while(--_0x8c00b3){_0x16108c['push'](_0x16108c['shift']());}};_0x5e23b6(++_0x1c0ff2);}(_0x52c8,0x1f1));var _0x852c=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x52c8[_0x45518f];return _0x198175;};'use strict';var FaxMessageEvents=require(_0x852c('0x0'));var events=[_0x852c('0x1'),'remove',_0x852c('0x2')];function createListener(_0x53e144,_0x42f435){return function(_0x2ae726){_0x42f435['emit'](_0x53e144,_0x2ae726);};}function removeListener(_0x5e16a1,_0x458bfb){return function(){FaxMessageEvents[_0x852c('0x3')](_0x5e16a1,_0x458bfb);};}exports[_0x852c('0x4')]=function(_0x2c72bc){for(var _0xcf1ec7=0x0,_0x67350c=events[_0x852c('0x5')];_0xcf1ec7<_0x67350c;_0xcf1ec7++){var _0xdb4ae0=events[_0xcf1ec7];var _0x19322f=createListener(_0x852c('0x6')+_0xdb4ae0,_0x2c72bc);FaxMessageEvents['on'](_0xdb4ae0,_0x19322f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index fd8a0f5..a707e3e 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 _0xf109=['update','/:id/accept','put','/:id/reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','fax','faxmessage:create','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf109,0xce));var _0x9f10=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf109[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0x8')]('/:id/download',auth[_0x9f10('0x9')](),controller[_0x9f10('0xe')]);router[_0x9f10('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x9f10('0x10'),_0x9f10('0x11')),controller[_0x9f10('0x12')]);router['put'](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0x13')]);router['put'](_0x9f10('0x14'),auth[_0x9f10('0x9')](),controller['accept']);router[_0x9f10('0x15')](_0x9f10('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x9f10('0x17')](_0x9f10('0xc'),auth['isAuthenticated'](),controller[_0x9f10('0x18')]);module['exports']=router; \ No newline at end of file +var _0x44a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','download','fax','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x815b87,_0x270652){var _0x398960=function(_0x32aad2){while(--_0x32aad2){_0x815b87['push'](_0x815b87['shift']());}};_0x398960(++_0x270652);}(_0x44a3,0x1a9));var _0x344a=function(_0x5a123f,_0x14cb93){_0x5a123f=_0x5a123f-0x0;var _0x40f3e8=_0x44a3[_0x5a123f];return _0x40f3e8;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/download',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),interaction['tracked'](_0x344a('0x10'),'faxmessage:create'),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x344a('0x13')]);router[_0x344a('0x12')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);router[_0x344a('0x12')]('/:id/reject',auth[_0x344a('0xb')](),controller[_0x344a('0x16')]);router[_0x344a('0x17')](_0x344a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x344a('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index eef3797..c169447 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 _0x80d3=['name','rrmemory','STRING'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x80d3,0x122));var _0x380d=function(_0x2ff93a,_0x507de3){_0x2ff93a=_0x2ff93a-0x0;var _0x5e4145=_0x80d3[_0x2ff93a];return _0x5e4145;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x380d('0x0')],'unique':_0x380d('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x380d('0x2'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bdc=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5999c9,_0x49d2fb){var _0x227679=function(_0x30f133){while(--_0x30f133){_0x5999c9['push'](_0x5999c9['shift']());}};_0x227679(++_0x49d2fb);}(_0x8bdc,0x17a));var _0xc8bd=function(_0x4417f3,_0x4fb595){_0x4417f3=_0x4417f3-0x0;var _0x5b39c2=_0x8bdc[_0x4417f3];return _0x5b39c2;};'use strict';var Sequelize=require('sequelize');module[_0xc8bd('0x0')]={'name':{'type':Sequelize[_0xc8bd('0x1')],'unique':_0xc8bd('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8bd('0x1')]},'timeout':{'type':Sequelize[_0xc8bd('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8bd('0x4')](_0xc8bd('0x5'),_0xc8bd('0x6'),_0xc8bd('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc8bd('0x3')],'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 94c6df1..419e720 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 _0x6c65=['ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','type','getOptions','where','include','query','findAll','rows','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','user','role','FaxQueues','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x6c65,0x78));var _0x56c6=function(_0x1f2a53,_0x2499cb){_0x1f2a53=_0x1f2a53-0x0;var _0x2ccde2=_0x6c65[_0x1f2a53];return _0x2ccde2;};'use strict';var BPromise=require(_0x56c6('0x0'));var util=require(_0x56c6('0x1'));var _=require(_0x56c6('0x2'));var squel=require(_0x56c6('0x3'));var Redis=require(_0x56c6('0x4'));var qs=require(_0x56c6('0x5'));var logger=require('../../config/logger')(_0x56c6('0x6'));var config=require(_0x56c6('0x7'));var db=require(_0x56c6('0x8'))['db'];config[_0x56c6('0x9')]=_[_0x56c6('0xa')](config['redis'],{'host':_0x56c6('0xb'),'port':0x18eb});var socket=require(_0x56c6('0xc'))(new Redis(config[_0x56c6('0x9')]));require(_0x56c6('0xd'))[_0x56c6('0xe')](socket);function respondWithStatusCode(_0x5f35af,_0x3e0810){_0x3e0810=_0x3e0810||0xcc;return function(_0x3cc376){if(_0x3cc376){return _0x5f35af[_0x56c6('0xf')](_0x3e0810);}return _0x5f35af['status'](_0x3e0810)[_0x56c6('0x10')]();};}function respondWithResult(_0x30a2f2,_0x34a0e9){_0x34a0e9=_0x34a0e9||0xc8;return function(_0x229ca9){if(_0x229ca9){return _0x30a2f2[_0x56c6('0x11')](_0x34a0e9)[_0x56c6('0x12')](_0x229ca9);}};}function respondWithFilteredResult(_0x5dce6b,_0x188e84){return function(_0x5d9a9d){if(_0x5d9a9d){var _0x5e412f=typeof _0x188e84[_0x56c6('0x13')]===_0x56c6('0x14')&&typeof _0x188e84[_0x56c6('0x15')]===_0x56c6('0x14');var _0x54ac65=_0x5d9a9d[_0x56c6('0x16')];var _0x511316=_0x5e412f?0x0:_0x188e84[_0x56c6('0x13')];var _0x59b7b5=_0x5e412f?_0x5d9a9d[_0x56c6('0x16')]:_0x188e84['offset']+_0x188e84['limit'];var _0x4b47ce;if(_0x59b7b5>=_0x54ac65){_0x59b7b5=_0x54ac65;_0x4b47ce=0xc8;}else{_0x4b47ce=0xce;}_0x5dce6b['status'](_0x4b47ce);return _0x5dce6b[_0x56c6('0x17')]('Content-Range',_0x511316+'-'+_0x59b7b5+'/'+_0x54ac65)[_0x56c6('0x12')](_0x5d9a9d);}return null;};}function saveUpdates(_0x5daebf){return function(_0x457156){if(_0x457156){return _0x457156['update'](_0x5daebf)[_0x56c6('0x18')](function(_0x5625f2){return _0x5625f2;});}return null;};}function removeEntity(_0x129b17){return function(_0x288325){if(_0x288325){return _0x288325['destroy']()[_0x56c6('0x18')](function(){var _0x32f195=_0x288325[_0x56c6('0x19')]({'plain':!![]});var _0x2eb4a7='FaxQueues';return db[_0x56c6('0x1a')][_0x56c6('0x1b')]({'where':{'type':_0x2eb4a7,'resourceId':_0x32f195['id']}})[_0x56c6('0x18')](function(){return _0x288325;});})[_0x56c6('0x18')](function(){_0x129b17[_0x56c6('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd575){return function(_0x1bc637){if(!_0x1bc637){_0x1cd575['sendStatus'](0x194);}return _0x1bc637;};}function handleError(_0x40d7be,_0x4d33f7){_0x4d33f7=_0x4d33f7||0x1f4;return function(_0x5cdef8){logger[_0x56c6('0x1c')](_0x5cdef8[_0x56c6('0x1d')]);if(_0x5cdef8[_0x56c6('0x1e')]){delete _0x5cdef8['name'];}_0x40d7be[_0x56c6('0x11')](_0x4d33f7)[_0x56c6('0x1f')](_0x5cdef8);};}exports[_0x56c6('0x20')]=function(_0x235c7a,_0x1c3b82){var _0x207f05={};var _0x50d7ee={'count':0x0,'rows':[]};var _0x4be5df=_[_0x56c6('0x21')](db[_0x56c6('0x22')]['rawAttributes'],function(_0x33f95e){return{'name':_0x33f95e['fieldName'],'type':_0x33f95e[_0x56c6('0x23')]['key']};});_0x207f05=qs[_0x56c6('0x24')](_0x4be5df,_0x235c7a);var _0x5827e7={'where':_0x207f05[_0x56c6('0x25')]};return db[_0x56c6('0x22')][_0x56c6('0x16')](_0x5827e7)[_0x56c6('0x18')](function(_0x1acdcf){_0x50d7ee[_0x56c6('0x16')]=_0x1acdcf;_0x207f05[_0x56c6('0x26')]=qs[_0x56c6('0x26')](_0x235c7a[_0x56c6('0x27')]);return db[_0x56c6('0x22')][_0x56c6('0x28')](_0x207f05);})['then'](function(_0x271c38){_0x50d7ee[_0x56c6('0x29')]=_0x271c38;return _0x50d7ee;})['then'](respondWithFilteredResult(_0x1c3b82,_0x207f05))['catch'](handleError(_0x1c3b82,null));};exports[_0x56c6('0x2a')]=function(_0x58cc94,_0x3e6433){var _0x530a03={'raw':!![],'where':{'id':_0x58cc94[_0x56c6('0x2b')]['id']}},_0x15e631={};_0x15e631[_0x56c6('0x2c')]=_['keys'](db[_0x56c6('0x22')][_0x56c6('0x2d')]);_0x15e631[_0x56c6('0x27')]=_[_0x56c6('0x2e')](_0x58cc94[_0x56c6('0x27')]);_0x15e631[_0x56c6('0x2f')]=_[_0x56c6('0x30')](_0x15e631[_0x56c6('0x2c')],_0x15e631[_0x56c6('0x27')]);_0x530a03[_0x56c6('0x31')]=_['intersection'](_0x15e631[_0x56c6('0x2c')],qs[_0x56c6('0x32')](_0x58cc94['query'][_0x56c6('0x32')]));_0x530a03[_0x56c6('0x31')]=_0x530a03[_0x56c6('0x31')][_0x56c6('0x33')]?_0x530a03[_0x56c6('0x31')]:_0x15e631[_0x56c6('0x2c')];if(_0x58cc94[_0x56c6('0x27')]['includeAll']){_0x530a03[_0x56c6('0x26')]=[{'all':!![]}];}_0x530a03=_[_0x56c6('0x34')]({},_0x530a03,_0x58cc94[_0x56c6('0x35')]);return db[_0x56c6('0x22')][_0x56c6('0x36')](_0x530a03)[_0x56c6('0x18')](handleEntityNotFound(_0x3e6433,null))[_0x56c6('0x18')](respondWithResult(_0x3e6433,null))['catch'](handleError(_0x3e6433,null));};exports['create']=function(_0x175c87,_0x13a927){return db[_0x56c6('0x22')][_0x56c6('0x37')](_0x175c87[_0x56c6('0x38')],{})[_0x56c6('0x18')](function(_0x449667){var _0xbc92e=_0x175c87[_0x56c6('0x39')][_0x56c6('0x19')]({'plain':!![]});if(!_0xbc92e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbc92e[_0x56c6('0x3a')]===_0x56c6('0x39')){var _0x1db308=_0x449667['get']({'plain':!![]});var _0x474964=_0x56c6('0x3b');return db[_0x56c6('0x3c')]['find']({'where':{'name':_0x474964,'userProfileId':_0xbc92e['userProfileId']},'raw':!![]})[_0x56c6('0x18')](function(_0x2dea5d){if(_0x2dea5d&&_0x2dea5d[_0x56c6('0x3d')]===0x0){return db[_0x56c6('0x1a')][_0x56c6('0x37')]({'name':_0x1db308[_0x56c6('0x1e')],'resourceId':_0x1db308['id'],'type':_0x2dea5d[_0x56c6('0x1e')],'sectionId':_0x2dea5d['id']},{})[_0x56c6('0x18')](function(){return _0x449667;});}else{return _0x449667;}})[_0x56c6('0x3e')](function(_0x295522){logger[_0x56c6('0x1c')](_0x56c6('0x3f'),_0x295522);throw _0x295522;});}return _0x449667;})[_0x56c6('0x18')](respondWithResult(_0x13a927,0xc9))['catch'](handleError(_0x13a927,null));};exports[_0x56c6('0x40')]=function(_0x851bbe,_0x1e6b10){if(_0x851bbe['body']['id']){delete _0x851bbe[_0x56c6('0x38')]['id'];}return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x851bbe[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x1e6b10,null))[_0x56c6('0x18')](saveUpdates(_0x851bbe[_0x56c6('0x38')],null))[_0x56c6('0x18')](respondWithResult(_0x1e6b10,null))['catch'](handleError(_0x1e6b10,null));};exports[_0x56c6('0x1b')]=function(_0x5deaa9,_0x5ade3d){return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x5deaa9[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x5ade3d,null))['then'](removeEntity(_0x5ade3d,null))[_0x56c6('0x3e')](handleError(_0x5ade3d,null));};exports[_0x56c6('0x41')]=function(_0xa9edf6,_0x5eaa23){return db[_0x56c6('0x22')][_0x56c6('0x41')]()[_0x56c6('0x18')](respondWithResult(_0x5eaa23,null))[_0x56c6('0x3e')](handleError(_0x5eaa23,null));};exports[_0x56c6('0x42')]=function(_0x4c4351,_0x21cbaa){var _0x275de2={'raw':!![],'where':{}},_0x3e4c8={},_0x2c7a7e;return db[_0x56c6('0x22')][_0x56c6('0x43')]({'where':{'id':_0x4c4351[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x21cbaa,null))[_0x56c6('0x18')](function(_0x3ee188){if(_0x3ee188){_0x2c7a7e=_0x3ee188[_0x56c6('0x19')]({'plain':!![]});_0x3e4c8['model']=_[_0x56c6('0x2e')](db['UserFaxQueue'][_0x56c6('0x2d')]);_0x3e4c8['query']=_['keys'](_0x4c4351[_0x56c6('0x27')]);_0x3e4c8[_0x56c6('0x2f')]=_[_0x56c6('0x30')](_0x3e4c8[_0x56c6('0x2c')],_0x3e4c8[_0x56c6('0x27')]);_0x275de2[_0x56c6('0x31')]=_[_0x56c6('0x30')](_0x3e4c8[_0x56c6('0x2c')],qs[_0x56c6('0x32')](_0x4c4351[_0x56c6('0x27')]['fields']));_0x275de2[_0x56c6('0x31')]=_0x275de2[_0x56c6('0x31')][_0x56c6('0x33')]?_0x275de2[_0x56c6('0x31')]:_0x3e4c8['model'];if(!_0x4c4351[_0x56c6('0x27')][_0x56c6('0x44')](_0x56c6('0x45'))){_0x275de2['limit']=qs[_0x56c6('0x15')](_0x4c4351[_0x56c6('0x27')][_0x56c6('0x15')]);_0x275de2[_0x56c6('0x13')]=qs['offset'](_0x4c4351[_0x56c6('0x27')][_0x56c6('0x13')]);}_0x275de2[_0x56c6('0x46')]=qs[_0x56c6('0x47')](_0x4c4351[_0x56c6('0x27')]['sort']);_0x275de2['where']=qs[_0x56c6('0x2f')](_[_0x56c6('0x48')](_0x4c4351[_0x56c6('0x27')],_0x3e4c8[_0x56c6('0x2f')]));_0x275de2[_0x56c6('0x25')][_0x56c6('0x49')]=_0x3ee188['id'];if(_0x4c4351[_0x56c6('0x27')][_0x56c6('0x4a')]){_0x275de2['where']=_[_0x56c6('0x34')](_0x275de2['where'],{'$or':_[_0x56c6('0x21')](_0x275de2['attributes'],function(_0x2bf952){var _0x5eb82a={};_0x5eb82a[_0x2bf952]={'$like':'%'+_0x4c4351[_0x56c6('0x27')][_0x56c6('0x4a')]+'%'};return _0x5eb82a;})});}_0x275de2=_[_0x56c6('0x34')]({},_0x275de2,_0x4c4351[_0x56c6('0x35')]);return db[_0x56c6('0x4b')][_0x56c6('0x28')](_0x275de2);}})['then'](function(_0xeb3c2c){if(_0xeb3c2c){return db['User'][_0x56c6('0x4c')]({'where':{'id':_['map'](_0xeb3c2c,_0x56c6('0x4d')),'role':_0x56c6('0x4e')},'attributes':['id','name',_0x56c6('0x4f'),'updatedAt','createdAt']});}})[_0x56c6('0x18')](function(_0x3ffe64){if(_0x3ffe64){return{'count':_0x3ffe64[_0x56c6('0x16')],'rows':_[_0x56c6('0x21')](_0x3ffe64[_0x56c6('0x29')],function(_0x2141e5){return{'membername':_0x2141e5['name'],'UserId':_0x2141e5['id'],'queue_name':_0x2c7a7e['name'],'FaxQueueId':_0x2c7a7e['id'],'interface':util[_0x56c6('0x50')](_0x56c6('0x51'),_0x56c6('0x52'),_0x2141e5[_0x56c6('0x1e')]),'penalty':0x0,'paused':_0x2141e5[_0x56c6('0x4f')],'createdAt':_0x2141e5['createdAt'],'updatedAt':_0x2141e5[_0x56c6('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x56c6('0x18')](respondWithFilteredResult(_0x21cbaa,_0x275de2))[_0x56c6('0x3e')](handleError(_0x21cbaa,null));};exports['getTeams']=function(_0x158258,_0x1135a3){var _0x36f118={};var _0x3b4cca={};var _0x4db0fd;var _0x5a0a4e;return db['FaxQueue']['findOne']({'where':{'id':_0x158258[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x1135a3,null))[_0x56c6('0x18')](function(_0x61122d){if(_0x61122d){_0x4db0fd=_0x61122d;_0x3b4cca[_0x56c6('0x2c')]=_[_0x56c6('0x2e')](db[_0x56c6('0x54')][_0x56c6('0x2d')]);_0x3b4cca[_0x56c6('0x27')]=_[_0x56c6('0x2e')](_0x158258['query']);_0x3b4cca[_0x56c6('0x2f')]=_[_0x56c6('0x30')](_0x3b4cca[_0x56c6('0x2c')],_0x3b4cca[_0x56c6('0x27')]);_0x36f118['attributes']=_[_0x56c6('0x30')](_0x3b4cca['model'],qs['fields'](_0x158258[_0x56c6('0x27')][_0x56c6('0x32')]));_0x36f118['attributes']=_0x36f118['attributes'][_0x56c6('0x33')]?_0x36f118[_0x56c6('0x31')]:_0x3b4cca[_0x56c6('0x2c')];_0x36f118[_0x56c6('0x46')]=qs['sort'](_0x158258[_0x56c6('0x27')][_0x56c6('0x47')]);_0x36f118['where']=qs[_0x56c6('0x2f')](_[_0x56c6('0x48')](_0x158258['query'],_0x3b4cca[_0x56c6('0x2f')]));if(_0x158258[_0x56c6('0x27')]['filter']){_0x36f118['where']=_['merge'](_0x36f118[_0x56c6('0x25')],{'$or':_[_0x56c6('0x21')](_0x36f118[_0x56c6('0x31')],function(_0xd0e5d5){var _0xcaa70f={};_0xcaa70f[_0xd0e5d5]={'$like':'%'+_0x158258[_0x56c6('0x27')][_0x56c6('0x4a')]+'%'};return _0xcaa70f;})});}_0x36f118=_[_0x56c6('0x34')]({},_0x36f118,_0x158258[_0x56c6('0x35')]);return _0x4db0fd[_0x56c6('0x55')](_0x36f118);}})['then'](function(_0x393181){if(_0x393181){_0x5a0a4e=_0x393181[_0x56c6('0x33')];if(!_0x158258[_0x56c6('0x27')][_0x56c6('0x44')](_0x56c6('0x45'))){_0x36f118[_0x56c6('0x15')]=qs[_0x56c6('0x15')](_0x158258[_0x56c6('0x27')][_0x56c6('0x15')]);_0x36f118[_0x56c6('0x13')]=qs[_0x56c6('0x13')](_0x158258[_0x56c6('0x27')][_0x56c6('0x13')]);}return _0x4db0fd[_0x56c6('0x55')](_0x36f118);}})[_0x56c6('0x18')](function(_0x48fc27){if(_0x48fc27){return _0x48fc27?{'count':_0x5a0a4e,'rows':_0x48fc27}:null;}})['then'](respondWithResult(_0x1135a3,null))[_0x56c6('0x3e')](handleError(_0x1135a3,null));};exports[_0x56c6('0x56')]=function(_0x533c15,_0x146f01){var _0x2f898a=_0x533c15[_0x56c6('0x38')][_0x56c6('0x57')];return db[_0x56c6('0x54')][_0x56c6('0x28')]({'where':{'id':_0x2f898a},'attributes':['id'],'include':[{'model':db[_0x56c6('0x58')],'as':_0x56c6('0x59'),'attributes':['id','name','online',_0x56c6('0x5a'),'interface'],'raw':!![]}]})[_0x56c6('0x18')](function(_0x4c5aa2){if(_0x4c5aa2){var _0x2a30b4=_[_0x56c6('0x5b')](_0x4c5aa2,function(_0x2c133c){var _0x12d438=_0x2c133c[_0x56c6('0x19')]({'plain':!![]});return _0x12d438[_0x56c6('0x59')];});return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x533c15[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](function(_0x75b30c){return db[_0x56c6('0x5c')][_0x56c6('0x5d')](function(_0x3ad321){return _0x75b30c[_0x56c6('0x56')](_0x2f898a,{'transaction':_0x3ad321})[_0x56c6('0x18')](function(){return BPromise[_0x56c6('0x5e')](_0x2a30b4,function(_0x4d6075){return db[_0x56c6('0x4b')][_0x56c6('0x5f')]({'where':{'UserId':_0x4d6075['id'],'FaxQueueId':_0x533c15[_0x56c6('0x2b')]['id']},'transaction':_0x3ad321});});})['then'](function(){_0x2a30b4[_0x56c6('0x60')](function(_0x275f90){socket['emit'](_0x56c6('0x61'),{'UserId':_0x275f90['id'],'FaxQueueId':_0x75b30c['id']});});});});});}})[_0x56c6('0x18')](respondWithStatusCode(_0x146f01,null))[_0x56c6('0x3e')](handleError(_0x146f01,null));};exports[_0x56c6('0x62')]=function(_0x3e9e67,_0x4c6ccd){return db[_0x56c6('0x54')][_0x56c6('0x28')]({'where':{'id':_0x3e9e67[_0x56c6('0x27')][_0x56c6('0x57')]},'attributes':['id'],'include':[{'model':db[_0x56c6('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x56c6('0x18')](handleEntityNotFound(_0x4c6ccd,null))[_0x56c6('0x18')](function(_0x143b53){var _0x3a93e6=_[_0x56c6('0x21')](_0x143b53,'id');var _0xc38d58=[];var _0x3ac45d=[];var _0x393469=squel[_0x56c6('0x63')]();_0x393469[_0x56c6('0x64')](_0x56c6('0x65'))[_0x56c6('0x66')]('team_has_fax_queues','tq')[_0x56c6('0x67')](_0x56c6('0x68'),'ut',_0x56c6('0x69'))[_0x56c6('0x25')](_0x56c6('0x6a'),_0x3e9e67[_0x56c6('0x2b')]['id']);for(var _0x4f6851=0x0;_0x4f6851<_0x143b53['length'];_0x4f6851+=0x1){let _0x2285b5=_0x143b53[_0x4f6851];for(var _0x1d776a=0x0;_0x1d776a<_0x2285b5[_0x56c6('0x59')][_0x56c6('0x33')];_0x1d776a+=0x1){let _0x5aecc7=_0x2285b5[_0x56c6('0x59')][_0x1d776a];var _0x3f835a=_0x393469[_0x56c6('0x6b')]();_0x3f835a[_0x56c6('0x25')](_0x56c6('0x6c'),_0x5aecc7['id']);_0x3ac45d[_0x56c6('0x6d')](db[_0x56c6('0x5c')]['query'](_0x3f835a['toString'](),{'type':db[_0x56c6('0x5c')][_0x56c6('0x6e')]['SELECT']})[_0x56c6('0x18')](function(_0x50ca63){if(_0x50ca63['length']===0x1){return _0x5aecc7['id'];}else{var _0x1ed608=_[_0x56c6('0x6f')](_[_0x56c6('0x21')](_0x50ca63,_0x56c6('0x70')),function(_0x345f28){return _['includes'](_0x3a93e6,_0x345f28);});if(_0x1ed608){return _0x5aecc7['id'];}}}));}}return BPromise[_0x56c6('0x71')](_0x3ac45d)['then'](function(_0x32d8f4){_0xc38d58=_(_0xc38d58)[_0x56c6('0x72')](_0x32d8f4)[_0x56c6('0x73')]()[_0x56c6('0x74')]();return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x3e9e67[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](function(_0x21721b){return db[_0x56c6('0x5c')]['transaction'](function(_0x9c1bc9){return _0x21721b[_0x56c6('0x62')](_0x3e9e67['query'][_0x56c6('0x57')],{'transaction':_0x9c1bc9})[_0x56c6('0x18')](function(){if(!_[_0x56c6('0x75')](_0xc38d58)){return _0x21721b[_0x56c6('0x76')](_0xc38d58,{'transaction':_0x9c1bc9});}})[_0x56c6('0x18')](function(){_0xc38d58[_0x56c6('0x60')](function(_0x3383ed){socket[_0x56c6('0x77')]('userFaxQueue:remove',{'UserId':_0x3383ed,'FaxQueueId':_0x21721b['id']});});});});});});})[_0x56c6('0x18')](respondWithStatusCode(_0x4c6ccd,null))[_0x56c6('0x3e')](handleError(_0x4c6ccd,null));};exports['addAgents']=function(_0x22e28e,_0x3598b4){return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x22e28e[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x3598b4,null))[_0x56c6('0x18')](function(_0x35e25b){if(_0x35e25b){return _0x35e25b['addAgents'](_0x22e28e[_0x56c6('0x38')][_0x56c6('0x57')],_['omit'](_0x22e28e['body'],[_0x56c6('0x57'),'id'])||{})[_0x56c6('0x78')](function(_0xea91f){for(var _0x2bd0bc=0x0;_0x2bd0bc<_0x22e28e[_0x56c6('0x38')][_0x56c6('0x57')]['length'];_0x2bd0bc+=0x1){socket['emit'](_0x56c6('0x61'),{'UserId':Number(_0x22e28e['body'][_0x56c6('0x57')][_0x2bd0bc]),'FaxQueueId':Number(_0x22e28e[_0x56c6('0x2b')]['id'])});}return _0xea91f;});}})[_0x56c6('0x18')](respondWithResult(_0x3598b4,null))[_0x56c6('0x3e')](handleError(_0x3598b4,null));};exports[_0x56c6('0x76')]=function(_0x1eca23,_0x43ca5f){return db[_0x56c6('0x22')][_0x56c6('0x36')]({'where':{'id':_0x1eca23[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0x43ca5f,null))[_0x56c6('0x18')](function(_0x39302c){if(_0x39302c){return _0x39302c[_0x56c6('0x76')](_0x1eca23['query'][_0x56c6('0x57')])['then'](function(){if(_[_0x56c6('0x79')](_0x1eca23[_0x56c6('0x27')][_0x56c6('0x57')])){for(var _0x18df6c=0x0;_0x18df6c<_0x1eca23['query'][_0x56c6('0x57')]['length'];_0x18df6c+=0x1){socket[_0x56c6('0x77')](_0x56c6('0x7a'),{'UserId':Number(_0x1eca23[_0x56c6('0x27')]['ids'][_0x18df6c]),'FaxQueueId':Number(_0x1eca23[_0x56c6('0x2b')]['id'])});}}else{socket[_0x56c6('0x77')](_0x56c6('0x7a'),{'UserId':Number(_0x1eca23['query']['ids']),'FaxQueueId':Number(_0x1eca23['params']['id'])});}});}})[_0x56c6('0x18')](respondWithStatusCode(_0x43ca5f,null))[_0x56c6('0x3e')](handleError(_0x43ca5f,null));};exports['getAgents']=function(_0x5e0b13,_0xdf4168){var _0x55adbc={};var _0x565c5c={};var _0x2e7194;var _0x23a665;return db[_0x56c6('0x22')][_0x56c6('0x43')]({'where':{'id':_0x5e0b13[_0x56c6('0x2b')]['id']}})[_0x56c6('0x18')](handleEntityNotFound(_0xdf4168,null))[_0x56c6('0x18')](function(_0x47dd24){if(_0x47dd24){_0x2e7194=_0x47dd24;_0x565c5c['model']=_['keys'](db[_0x56c6('0x58')][_0x56c6('0x2d')]);_0x565c5c['query']=_[_0x56c6('0x2e')](_0x5e0b13['query']);_0x565c5c[_0x56c6('0x2f')]=_[_0x56c6('0x30')](_0x565c5c['model'],_0x565c5c[_0x56c6('0x27')]);_0x55adbc['attributes']=_[_0x56c6('0x30')](_0x565c5c['model'],qs['fields'](_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x32')]));_0x55adbc[_0x56c6('0x31')]=_0x55adbc[_0x56c6('0x31')][_0x56c6('0x33')]?_0x55adbc[_0x56c6('0x31')]:_0x565c5c['model'];_0x55adbc[_0x56c6('0x46')]=qs[_0x56c6('0x47')](_0x5e0b13['query'][_0x56c6('0x47')]);_0x55adbc[_0x56c6('0x25')]=qs[_0x56c6('0x2f')](_[_0x56c6('0x48')](_0x5e0b13[_0x56c6('0x27')],_0x565c5c['filters']));if(_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x4a')]){_0x55adbc[_0x56c6('0x25')]=_[_0x56c6('0x34')](_0x55adbc[_0x56c6('0x25')],{'$or':_[_0x56c6('0x21')](_0x55adbc['attributes'],function(_0x525ee2){var _0x2f86c7={};_0x2f86c7[_0x525ee2]={'$like':'%'+_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x4a')]+'%'};return _0x2f86c7;})});}_0x55adbc=_[_0x56c6('0x34')]({},_0x55adbc,_0x5e0b13['options']);return _0x2e7194[_0x56c6('0x7b')](_0x55adbc);}})[_0x56c6('0x18')](function(_0x14973b){if(_0x14973b){_0x23a665=_0x14973b[_0x56c6('0x33')];if(!_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x44')](_0x56c6('0x45'))){_0x55adbc['limit']=qs[_0x56c6('0x15')](_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x15')]);_0x55adbc[_0x56c6('0x13')]=qs['offset'](_0x5e0b13[_0x56c6('0x27')][_0x56c6('0x13')]);}return _0x2e7194[_0x56c6('0x7b')](_0x55adbc);}})[_0x56c6('0x18')](function(_0x5dc800){if(_0x5dc800){return _0x5dc800?{'count':_0x23a665,'rows':_0x5dc800}:null;}})[_0x56c6('0x18')](respondWithResult(_0xdf4168,null))[_0x56c6('0x3e')](handleError(_0xdf4168,null));}; \ No newline at end of file +var _0xad5f=['findAndCountAll','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','Agents','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','emit','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','removeAgents','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','include','rows','catch','show','model','keys','query','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserFaxQueue','hasOwnProperty','nolimit','sort','where','pick','FaxQueueId','filter','findAll','User'];(function(_0x2b2800,_0x496997){var _0x22f214=function(_0x3a0b73){while(--_0x3a0b73){_0x2b2800['push'](_0x2b2800['shift']());}};_0x22f214(++_0x496997);}(_0xad5f,0x1a8));var _0xfad5=function(_0x373e27,_0x527f8d){_0x373e27=_0x373e27-0x0;var _0x4a336f=_0xad5f[_0x373e27];return _0x4a336f;};'use strict';var BPromise=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var _=require(_0xfad5('0x2'));var squel=require(_0xfad5('0x3'));var Redis=require(_0xfad5('0x4'));var qs=require(_0xfad5('0x5'));var logger=require('../../config/logger')(_0xfad5('0x6'));var config=require(_0xfad5('0x7'));var db=require(_0xfad5('0x8'))['db'];config[_0xfad5('0x9')]=_[_0xfad5('0xa')](config[_0xfad5('0x9')],{'host':_0xfad5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfad5('0x9')]));require(_0xfad5('0xc'))[_0xfad5('0xd')](socket);function respondWithStatusCode(_0xbe8f56,_0x535cb5){_0x535cb5=_0x535cb5||0xcc;return function(_0x2226a8){if(_0x2226a8){return _0xbe8f56[_0xfad5('0xe')](_0x535cb5);}return _0xbe8f56[_0xfad5('0xf')](_0x535cb5)[_0xfad5('0x10')]();};}function respondWithResult(_0x1baeb8,_0x154840){_0x154840=_0x154840||0xc8;return function(_0x23d032){if(_0x23d032){return _0x1baeb8['status'](_0x154840)[_0xfad5('0x11')](_0x23d032);}};}function respondWithFilteredResult(_0x3dd0f7,_0xbcf23){return function(_0x5c8fef){if(_0x5c8fef){var _0x59c9ae=typeof _0xbcf23[_0xfad5('0x12')]===_0xfad5('0x13')&&typeof _0xbcf23[_0xfad5('0x14')]===_0xfad5('0x13');var _0x441a68=_0x5c8fef['count'];var _0x35911d=_0x59c9ae?0x0:_0xbcf23[_0xfad5('0x12')];var _0x162d27=_0x59c9ae?_0x5c8fef[_0xfad5('0x15')]:_0xbcf23[_0xfad5('0x12')]+_0xbcf23[_0xfad5('0x14')];var _0x446f3c;if(_0x162d27>=_0x441a68){_0x162d27=_0x441a68;_0x446f3c=0xc8;}else{_0x446f3c=0xce;}_0x3dd0f7['status'](_0x446f3c);return _0x3dd0f7['set'](_0xfad5('0x16'),_0x35911d+'-'+_0x162d27+'/'+_0x441a68)[_0xfad5('0x11')](_0x5c8fef);}return null;};}function saveUpdates(_0x311e75){return function(_0xe94444){if(_0xe94444){return _0xe94444[_0xfad5('0x17')](_0x311e75)[_0xfad5('0x18')](function(_0x10ae77){return _0x10ae77;});}return null;};}function removeEntity(_0x2fc3ed){return function(_0x259766){if(_0x259766){return _0x259766['destroy']()['then'](function(){var _0x12f9e3=_0x259766[_0xfad5('0x19')]({'plain':!![]});var _0x57874d='FaxQueues';return db[_0xfad5('0x1a')][_0xfad5('0x1b')]({'where':{'type':_0x57874d,'resourceId':_0x12f9e3['id']}})['then'](function(){return _0x259766;});})['then'](function(){_0x2fc3ed[_0xfad5('0xf')](0xcc)[_0xfad5('0x10')]();});}};}function handleEntityNotFound(_0x1b7507){return function(_0x102b20){if(!_0x102b20){_0x1b7507[_0xfad5('0xe')](0x194);}return _0x102b20;};}function handleError(_0x58e43d,_0x354a31){_0x354a31=_0x354a31||0x1f4;return function(_0x4e6ecc){logger[_0xfad5('0x1c')](_0x4e6ecc[_0xfad5('0x1d')]);if(_0x4e6ecc[_0xfad5('0x1e')]){delete _0x4e6ecc[_0xfad5('0x1e')];}_0x58e43d[_0xfad5('0xf')](_0x354a31)[_0xfad5('0x1f')](_0x4e6ecc);};}exports[_0xfad5('0x20')]=function(_0x3bcb8f,_0x2e72c7){var _0x45c149={};var _0x3ea0d8={'count':0x0,'rows':[]};var _0x503b98=_[_0xfad5('0x21')](db[_0xfad5('0x22')][_0xfad5('0x23')],function(_0xc772e6){return{'name':_0xc772e6[_0xfad5('0x24')],'type':_0xc772e6['type'][_0xfad5('0x25')]};});_0x45c149=qs[_0xfad5('0x26')](_0x503b98,_0x3bcb8f);var _0x333ee0={'where':_0x45c149['where']};return db[_0xfad5('0x22')]['count'](_0x333ee0)[_0xfad5('0x18')](function(_0x1ccdb0){_0x3ea0d8[_0xfad5('0x15')]=_0x1ccdb0;_0x45c149['include']=qs[_0xfad5('0x27')](_0x3bcb8f['query']);return db['FaxQueue']['findAll'](_0x45c149);})[_0xfad5('0x18')](function(_0x1f5329){_0x3ea0d8[_0xfad5('0x28')]=_0x1f5329;return _0x3ea0d8;})[_0xfad5('0x18')](respondWithFilteredResult(_0x2e72c7,_0x45c149))[_0xfad5('0x29')](handleError(_0x2e72c7,null));};exports[_0xfad5('0x2a')]=function(_0x299ce8,_0x3022fc){var _0x982e10={'raw':!![],'where':{'id':_0x299ce8['params']['id']}},_0x3b05d7={};_0x3b05d7[_0xfad5('0x2b')]=_[_0xfad5('0x2c')](db[_0xfad5('0x22')]['rawAttributes']);_0x3b05d7[_0xfad5('0x2d')]=_[_0xfad5('0x2c')](_0x299ce8[_0xfad5('0x2d')]);_0x3b05d7[_0xfad5('0x2e')]=_['intersection'](_0x3b05d7[_0xfad5('0x2b')],_0x3b05d7[_0xfad5('0x2d')]);_0x982e10[_0xfad5('0x2f')]=_[_0xfad5('0x30')](_0x3b05d7[_0xfad5('0x2b')],qs['fields'](_0x299ce8[_0xfad5('0x2d')][_0xfad5('0x31')]));_0x982e10[_0xfad5('0x2f')]=_0x982e10['attributes'][_0xfad5('0x32')]?_0x982e10[_0xfad5('0x2f')]:_0x3b05d7['model'];if(_0x299ce8['query'][_0xfad5('0x33')]){_0x982e10[_0xfad5('0x27')]=[{'all':!![]}];}_0x982e10=_[_0xfad5('0x34')]({},_0x982e10,_0x299ce8[_0xfad5('0x35')]);return db[_0xfad5('0x22')][_0xfad5('0x36')](_0x982e10)[_0xfad5('0x18')](handleEntityNotFound(_0x3022fc,null))['then'](respondWithResult(_0x3022fc,null))[_0xfad5('0x29')](handleError(_0x3022fc,null));};exports[_0xfad5('0x37')]=function(_0x2f1533,_0x3aa0e2){return db[_0xfad5('0x22')]['create'](_0x2f1533[_0xfad5('0x38')],{})[_0xfad5('0x18')](function(_0x593483){var _0x365eb1=_0x2f1533[_0xfad5('0x39')][_0xfad5('0x19')]({'plain':!![]});if(!_0x365eb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365eb1['role']===_0xfad5('0x39')){var _0x2932f=_0x593483[_0xfad5('0x19')]({'plain':!![]});var _0x29bf9f=_0xfad5('0x3a');return db[_0xfad5('0x3b')][_0xfad5('0x36')]({'where':{'name':_0x29bf9f,'userProfileId':_0x365eb1[_0xfad5('0x3c')]},'raw':!![]})[_0xfad5('0x18')](function(_0x322bd9){if(_0x322bd9&&_0x322bd9[_0xfad5('0x3d')]===0x0){return db[_0xfad5('0x1a')][_0xfad5('0x37')]({'name':_0x2932f[_0xfad5('0x1e')],'resourceId':_0x2932f['id'],'type':_0x322bd9[_0xfad5('0x1e')],'sectionId':_0x322bd9['id']},{})[_0xfad5('0x18')](function(){return _0x593483;});}else{return _0x593483;}})[_0xfad5('0x29')](function(_0x92e225){logger[_0xfad5('0x1c')](_0xfad5('0x3e'),_0x92e225);throw _0x92e225;});}return _0x593483;})['then'](respondWithResult(_0x3aa0e2,0xc9))[_0xfad5('0x29')](handleError(_0x3aa0e2,null));};exports[_0xfad5('0x17')]=function(_0x598028,_0x501ae6){if(_0x598028['body']['id']){delete _0x598028['body']['id'];}return db[_0xfad5('0x22')]['find']({'where':{'id':_0x598028[_0xfad5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x501ae6,null))[_0xfad5('0x18')](saveUpdates(_0x598028[_0xfad5('0x38')],null))['then'](respondWithResult(_0x501ae6,null))[_0xfad5('0x29')](handleError(_0x501ae6,null));};exports[_0xfad5('0x1b')]=function(_0x4e184b,_0x5c78a6){return db[_0xfad5('0x22')]['find']({'where':{'id':_0x4e184b['params']['id']}})[_0xfad5('0x18')](handleEntityNotFound(_0x5c78a6,null))['then'](removeEntity(_0x5c78a6,null))[_0xfad5('0x29')](handleError(_0x5c78a6,null));};exports[_0xfad5('0x40')]=function(_0x260c15,_0x3c2ad9){return db[_0xfad5('0x22')]['describe']()[_0xfad5('0x18')](respondWithResult(_0x3c2ad9,null))[_0xfad5('0x29')](handleError(_0x3c2ad9,null));};exports[_0xfad5('0x41')]=function(_0x510491,_0x2c7685){var _0x21e7a2={'raw':!![],'where':{}},_0x5399dc={},_0x314799;return db[_0xfad5('0x22')]['findOne']({'where':{'id':_0x510491['params']['id']}})['then'](handleEntityNotFound(_0x2c7685,null))[_0xfad5('0x18')](function(_0x46955c){if(_0x46955c){_0x314799=_0x46955c[_0xfad5('0x19')]({'plain':!![]});_0x5399dc[_0xfad5('0x2b')]=_['keys'](db[_0xfad5('0x42')][_0xfad5('0x23')]);_0x5399dc[_0xfad5('0x2d')]=_[_0xfad5('0x2c')](_0x510491[_0xfad5('0x2d')]);_0x5399dc[_0xfad5('0x2e')]=_[_0xfad5('0x30')](_0x5399dc[_0xfad5('0x2b')],_0x5399dc[_0xfad5('0x2d')]);_0x21e7a2['attributes']=_[_0xfad5('0x30')](_0x5399dc[_0xfad5('0x2b')],qs['fields'](_0x510491[_0xfad5('0x2d')][_0xfad5('0x31')]));_0x21e7a2[_0xfad5('0x2f')]=_0x21e7a2[_0xfad5('0x2f')][_0xfad5('0x32')]?_0x21e7a2[_0xfad5('0x2f')]:_0x5399dc['model'];if(!_0x510491[_0xfad5('0x2d')][_0xfad5('0x43')](_0xfad5('0x44'))){_0x21e7a2[_0xfad5('0x14')]=qs[_0xfad5('0x14')](_0x510491[_0xfad5('0x2d')]['limit']);_0x21e7a2['offset']=qs[_0xfad5('0x12')](_0x510491[_0xfad5('0x2d')][_0xfad5('0x12')]);}_0x21e7a2['order']=qs[_0xfad5('0x45')](_0x510491['query']['sort']);_0x21e7a2[_0xfad5('0x46')]=qs[_0xfad5('0x2e')](_[_0xfad5('0x47')](_0x510491[_0xfad5('0x2d')],_0x5399dc[_0xfad5('0x2e')]));_0x21e7a2[_0xfad5('0x46')][_0xfad5('0x48')]=_0x46955c['id'];if(_0x510491['query'][_0xfad5('0x49')]){_0x21e7a2[_0xfad5('0x46')]=_[_0xfad5('0x34')](_0x21e7a2[_0xfad5('0x46')],{'$or':_['map'](_0x21e7a2['attributes'],function(_0x11f647){var _0x118bc5={};_0x118bc5[_0x11f647]={'$like':'%'+_0x510491[_0xfad5('0x2d')][_0xfad5('0x49')]+'%'};return _0x118bc5;})});}_0x21e7a2=_[_0xfad5('0x34')]({},_0x21e7a2,_0x510491['options']);return db['UserFaxQueue'][_0xfad5('0x4a')](_0x21e7a2);}})['then'](function(_0x289b8f){if(_0x289b8f){return db[_0xfad5('0x4b')][_0xfad5('0x4c')]({'where':{'id':_[_0xfad5('0x21')](_0x289b8f,_0xfad5('0x4d')),'role':'agent'},'attributes':['id',_0xfad5('0x1e'),_0xfad5('0x4e'),_0xfad5('0x4f'),_0xfad5('0x50')]});}})[_0xfad5('0x18')](function(_0x5ecc1a){if(_0x5ecc1a){return{'count':_0x5ecc1a[_0xfad5('0x15')],'rows':_['map'](_0x5ecc1a['rows'],function(_0x38f658){return{'membername':_0x38f658[_0xfad5('0x1e')],'UserId':_0x38f658['id'],'queue_name':_0x314799[_0xfad5('0x1e')],'FaxQueueId':_0x314799['id'],'interface':util['format'](_0xfad5('0x51'),_0xfad5('0x52'),_0x38f658[_0xfad5('0x1e')]),'penalty':0x0,'paused':_0x38f658['faxPause'],'createdAt':_0x38f658[_0xfad5('0x50')],'updatedAt':_0x38f658[_0xfad5('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfad5('0x18')](respondWithFilteredResult(_0x2c7685,_0x21e7a2))[_0xfad5('0x29')](handleError(_0x2c7685,null));};exports[_0xfad5('0x53')]=function(_0x1605f1,_0x2e0304){var _0x397d21={};var _0x6003b7={};var _0x1e80d3;var _0x262b50;return db['FaxQueue'][_0xfad5('0x54')]({'where':{'id':_0x1605f1[_0xfad5('0x3f')]['id']}})[_0xfad5('0x18')](handleEntityNotFound(_0x2e0304,null))[_0xfad5('0x18')](function(_0x599a00){if(_0x599a00){_0x1e80d3=_0x599a00;_0x6003b7[_0xfad5('0x2b')]=_['keys'](db[_0xfad5('0x55')][_0xfad5('0x23')]);_0x6003b7[_0xfad5('0x2d')]=_[_0xfad5('0x2c')](_0x1605f1[_0xfad5('0x2d')]);_0x6003b7['filters']=_[_0xfad5('0x30')](_0x6003b7[_0xfad5('0x2b')],_0x6003b7['query']);_0x397d21['attributes']=_[_0xfad5('0x30')](_0x6003b7[_0xfad5('0x2b')],qs[_0xfad5('0x31')](_0x1605f1['query'][_0xfad5('0x31')]));_0x397d21[_0xfad5('0x2f')]=_0x397d21[_0xfad5('0x2f')][_0xfad5('0x32')]?_0x397d21[_0xfad5('0x2f')]:_0x6003b7[_0xfad5('0x2b')];_0x397d21['order']=qs[_0xfad5('0x45')](_0x1605f1[_0xfad5('0x2d')][_0xfad5('0x45')]);_0x397d21[_0xfad5('0x46')]=qs[_0xfad5('0x2e')](_['pick'](_0x1605f1[_0xfad5('0x2d')],_0x6003b7['filters']));if(_0x1605f1[_0xfad5('0x2d')][_0xfad5('0x49')]){_0x397d21[_0xfad5('0x46')]=_[_0xfad5('0x34')](_0x397d21[_0xfad5('0x46')],{'$or':_[_0xfad5('0x21')](_0x397d21[_0xfad5('0x2f')],function(_0x5c32e7){var _0x2983fe={};_0x2983fe[_0x5c32e7]={'$like':'%'+_0x1605f1[_0xfad5('0x2d')][_0xfad5('0x49')]+'%'};return _0x2983fe;})});}_0x397d21=_[_0xfad5('0x34')]({},_0x397d21,_0x1605f1[_0xfad5('0x35')]);return _0x1e80d3[_0xfad5('0x53')](_0x397d21);}})['then'](function(_0x3b7dbc){if(_0x3b7dbc){_0x262b50=_0x3b7dbc['length'];if(!_0x1605f1[_0xfad5('0x2d')]['hasOwnProperty']('nolimit')){_0x397d21[_0xfad5('0x14')]=qs['limit'](_0x1605f1[_0xfad5('0x2d')][_0xfad5('0x14')]);_0x397d21[_0xfad5('0x12')]=qs[_0xfad5('0x12')](_0x1605f1[_0xfad5('0x2d')][_0xfad5('0x12')]);}return _0x1e80d3[_0xfad5('0x53')](_0x397d21);}})[_0xfad5('0x18')](function(_0x2b307e){if(_0x2b307e){return _0x2b307e?{'count':_0x262b50,'rows':_0x2b307e}:null;}})[_0xfad5('0x18')](respondWithResult(_0x2e0304,null))[_0xfad5('0x29')](handleError(_0x2e0304,null));};exports[_0xfad5('0x56')]=function(_0xbc64f2,_0xf5ecad){var _0x5416c2=_0xbc64f2[_0xfad5('0x38')][_0xfad5('0x57')];return db['Team'][_0xfad5('0x4a')]({'where':{'id':_0x5416c2},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xfad5('0x1e'),_0xfad5('0x58'),_0xfad5('0x59'),_0xfad5('0x5a')],'raw':!![]}]})[_0xfad5('0x18')](function(_0x32bdac){if(_0x32bdac){var _0x387442=_['flatMap'](_0x32bdac,function(_0x43cef2){var _0x14fe15=_0x43cef2[_0xfad5('0x19')]({'plain':!![]});return _0x14fe15[_0xfad5('0x5b')];});return db[_0xfad5('0x22')][_0xfad5('0x36')]({'where':{'id':_0xbc64f2[_0xfad5('0x3f')]['id']}})[_0xfad5('0x18')](function(_0x391273){return db['sequelize'][_0xfad5('0x5c')](function(_0x1b8fae){return _0x391273['addTeams'](_0x5416c2,{'transaction':_0x1b8fae})['then'](function(){return BPromise[_0xfad5('0x5d')](_0x387442,function(_0x4618a3){return db[_0xfad5('0x42')][_0xfad5('0x5e')]({'where':{'UserId':_0x4618a3['id'],'FaxQueueId':_0xbc64f2['params']['id']},'transaction':_0x1b8fae});});})[_0xfad5('0x18')](function(){_0x387442[_0xfad5('0x5f')](function(_0x29aa09){socket['emit']('userFaxQueue:save',{'UserId':_0x29aa09['id'],'FaxQueueId':_0x391273['id']});});});});});}})['then'](respondWithStatusCode(_0xf5ecad,null))[_0xfad5('0x29')](handleError(_0xf5ecad,null));};exports[_0xfad5('0x60')]=function(_0x2b0dcb,_0x5b5baa){return db[_0xfad5('0x55')][_0xfad5('0x4a')]({'where':{'id':_0x2b0dcb[_0xfad5('0x2d')][_0xfad5('0x57')]},'attributes':['id'],'include':[{'model':db[_0xfad5('0x4b')],'as':_0xfad5('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xfad5('0x18')](handleEntityNotFound(_0x5b5baa,null))[_0xfad5('0x18')](function(_0x1c7068){var _0x2b01f1=_[_0xfad5('0x21')](_0x1c7068,'id');var _0x536e18=[];var _0x3c82b3=[];var _0x20e64f=squel[_0xfad5('0x61')]();_0x20e64f[_0xfad5('0x62')](_0xfad5('0x63'))['from']('team_has_fax_queues','tq')['join'](_0xfad5('0x64'),'ut',_0xfad5('0x65'))['where'](_0xfad5('0x66'),_0x2b0dcb[_0xfad5('0x3f')]['id']);for(var _0x2d91d6=0x0;_0x2d91d6<_0x1c7068['length'];_0x2d91d6+=0x1){let _0x399e2d=_0x1c7068[_0x2d91d6];for(var _0x452ce8=0x0;_0x452ce8<_0x399e2d[_0xfad5('0x5b')][_0xfad5('0x32')];_0x452ce8+=0x1){let _0x18a785=_0x399e2d[_0xfad5('0x5b')][_0x452ce8];var _0x4b919a=_0x20e64f[_0xfad5('0x67')]();_0x4b919a['where'](_0xfad5('0x68'),_0x18a785['id']);_0x3c82b3[_0xfad5('0x69')](db[_0xfad5('0x6a')][_0xfad5('0x2d')](_0x4b919a[_0xfad5('0x6b')](),{'type':db[_0xfad5('0x6a')]['QueryTypes'][_0xfad5('0x6c')]})[_0xfad5('0x18')](function(_0x1fef29){if(_0x1fef29[_0xfad5('0x32')]===0x1){return _0x18a785['id'];}else{var _0x2b26e8=_[_0xfad5('0x6d')](_['map'](_0x1fef29,_0xfad5('0x6e')),function(_0x5c0829){return _[_0xfad5('0x6f')](_0x2b01f1,_0x5c0829);});if(_0x2b26e8){return _0x18a785['id'];}}}));}}return BPromise[_0xfad5('0x70')](_0x3c82b3)[_0xfad5('0x18')](function(_0xd9ecd5){_0x536e18=_(_0x536e18)[_0xfad5('0x71')](_0xd9ecd5)[_0xfad5('0x72')]()[_0xfad5('0x73')]();return db[_0xfad5('0x22')][_0xfad5('0x36')]({'where':{'id':_0x2b0dcb[_0xfad5('0x3f')]['id']}})[_0xfad5('0x18')](function(_0x24487b){return db[_0xfad5('0x6a')]['transaction'](function(_0x41bfd9){return _0x24487b[_0xfad5('0x60')](_0x2b0dcb[_0xfad5('0x2d')][_0xfad5('0x57')],{'transaction':_0x41bfd9})[_0xfad5('0x18')](function(){if(!_['isEmpty'](_0x536e18)){return _0x24487b['removeAgents'](_0x536e18,{'transaction':_0x41bfd9});}})[_0xfad5('0x18')](function(){_0x536e18[_0xfad5('0x5f')](function(_0x5392fe){socket[_0xfad5('0x74')](_0xfad5('0x75'),{'UserId':_0x5392fe,'FaxQueueId':_0x24487b['id']});});});});});});})['then'](respondWithStatusCode(_0x5b5baa,null))['catch'](handleError(_0x5b5baa,null));};exports[_0xfad5('0x76')]=function(_0x526656,_0x44091b){return db[_0xfad5('0x22')]['find']({'where':{'id':_0x526656[_0xfad5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44091b,null))[_0xfad5('0x18')](function(_0x5866a5){if(_0x5866a5){return _0x5866a5[_0xfad5('0x76')](_0x526656[_0xfad5('0x38')][_0xfad5('0x57')],_['omit'](_0x526656[_0xfad5('0x38')],[_0xfad5('0x57'),'id'])||{})[_0xfad5('0x77')](function(_0x5c8f79){for(var _0x33549a=0x0;_0x33549a<_0x526656[_0xfad5('0x38')]['ids']['length'];_0x33549a+=0x1){socket[_0xfad5('0x74')](_0xfad5('0x78'),{'UserId':Number(_0x526656[_0xfad5('0x38')][_0xfad5('0x57')][_0x33549a]),'FaxQueueId':Number(_0x526656[_0xfad5('0x3f')]['id'])});}return _0x5c8f79;});}})['then'](respondWithResult(_0x44091b,null))[_0xfad5('0x29')](handleError(_0x44091b,null));};exports[_0xfad5('0x79')]=function(_0x28bf97,_0x151629){return db[_0xfad5('0x22')][_0xfad5('0x36')]({'where':{'id':_0x28bf97[_0xfad5('0x3f')]['id']}})[_0xfad5('0x18')](handleEntityNotFound(_0x151629,null))['then'](function(_0x40adda){if(_0x40adda){return _0x40adda[_0xfad5('0x79')](_0x28bf97[_0xfad5('0x2d')][_0xfad5('0x57')])[_0xfad5('0x18')](function(){if(_[_0xfad5('0x7a')](_0x28bf97[_0xfad5('0x2d')][_0xfad5('0x57')])){for(var _0x5dd8fc=0x0;_0x5dd8fc<_0x28bf97['query']['ids']['length'];_0x5dd8fc+=0x1){socket[_0xfad5('0x74')]('userFaxQueue:remove',{'UserId':Number(_0x28bf97[_0xfad5('0x2d')][_0xfad5('0x57')][_0x5dd8fc]),'FaxQueueId':Number(_0x28bf97[_0xfad5('0x3f')]['id'])});}}else{socket[_0xfad5('0x74')](_0xfad5('0x75'),{'UserId':Number(_0x28bf97[_0xfad5('0x2d')][_0xfad5('0x57')]),'FaxQueueId':Number(_0x28bf97[_0xfad5('0x3f')]['id'])});}});}})[_0xfad5('0x18')](respondWithStatusCode(_0x151629,null))['catch'](handleError(_0x151629,null));};exports[_0xfad5('0x7b')]=function(_0x4afeda,_0x27bb1a){var _0x523a5e={};var _0x331b8e={};var _0x287a32;var _0x21dffa;return db[_0xfad5('0x22')][_0xfad5('0x54')]({'where':{'id':_0x4afeda[_0xfad5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x27bb1a,null))[_0xfad5('0x18')](function(_0x5d2180){if(_0x5d2180){_0x287a32=_0x5d2180;_0x331b8e['model']=_[_0xfad5('0x2c')](db['User'][_0xfad5('0x23')]);_0x331b8e[_0xfad5('0x2d')]=_[_0xfad5('0x2c')](_0x4afeda[_0xfad5('0x2d')]);_0x331b8e[_0xfad5('0x2e')]=_[_0xfad5('0x30')](_0x331b8e[_0xfad5('0x2b')],_0x331b8e[_0xfad5('0x2d')]);_0x523a5e[_0xfad5('0x2f')]=_['intersection'](_0x331b8e[_0xfad5('0x2b')],qs['fields'](_0x4afeda['query']['fields']));_0x523a5e[_0xfad5('0x2f')]=_0x523a5e['attributes'][_0xfad5('0x32')]?_0x523a5e[_0xfad5('0x2f')]:_0x331b8e[_0xfad5('0x2b')];_0x523a5e[_0xfad5('0x7c')]=qs[_0xfad5('0x45')](_0x4afeda[_0xfad5('0x2d')]['sort']);_0x523a5e['where']=qs[_0xfad5('0x2e')](_['pick'](_0x4afeda[_0xfad5('0x2d')],_0x331b8e[_0xfad5('0x2e')]));if(_0x4afeda['query'][_0xfad5('0x49')]){_0x523a5e[_0xfad5('0x46')]=_['merge'](_0x523a5e[_0xfad5('0x46')],{'$or':_['map'](_0x523a5e['attributes'],function(_0x3d7413){var _0x4778df={};_0x4778df[_0x3d7413]={'$like':'%'+_0x4afeda[_0xfad5('0x2d')][_0xfad5('0x49')]+'%'};return _0x4778df;})});}_0x523a5e=_[_0xfad5('0x34')]({},_0x523a5e,_0x4afeda[_0xfad5('0x35')]);return _0x287a32[_0xfad5('0x7b')](_0x523a5e);}})[_0xfad5('0x18')](function(_0x145232){if(_0x145232){_0x21dffa=_0x145232['length'];if(!_0x4afeda[_0xfad5('0x2d')][_0xfad5('0x43')](_0xfad5('0x44'))){_0x523a5e[_0xfad5('0x14')]=qs[_0xfad5('0x14')](_0x4afeda[_0xfad5('0x2d')][_0xfad5('0x14')]);_0x523a5e[_0xfad5('0x12')]=qs[_0xfad5('0x12')](_0x4afeda[_0xfad5('0x2d')][_0xfad5('0x12')]);}return _0x287a32[_0xfad5('0x7b')](_0x523a5e);}})['then'](function(_0x41c1f2){if(_0x41c1f2){return _0x41c1f2?{'count':_0x21dffa,'rows':_0x41c1f2}:null;}})['then'](respondWithResult(_0x27bb1a,null))[_0xfad5('0x29')](handleError(_0x27bb1a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f727a0c..02c831f 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 _0x940b=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x37ad25,_0x454c78){var _0x8e467f=function(_0x3cbcbc){while(--_0x3cbcbc){_0x37ad25['push'](_0x37ad25['shift']());}};_0x8e467f(++_0x454c78);}(_0x940b,0x11f));var _0xb940=function(_0x442b4e,_0x16983e){_0x442b4e=_0x442b4e-0x0;var _0x2475a0=_0x940b[_0x442b4e];return _0x2475a0;};'use strict';var EventEmitter=require(_0xb940('0x0'));var FaxQueue=require(_0xb940('0x1'))['db'][_0xb940('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb940('0x3')](0x0);var events={'afterCreate':_0xb940('0x4'),'afterUpdate':_0xb940('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc1df9d){return function(_0x1c02df,_0x1b97a7,_0x3b44dd){FaxQueueEvents[_0xb940('0x6')](_0xc1df9d+':'+_0x1c02df['id'],_0x1c02df);FaxQueueEvents[_0xb940('0x6')](_0xc1df9d,_0x1c02df);_0x3b44dd(null);};}for(var e in events){if(events[_0xb940('0x7')](e)){var event=events[e];FaxQueue[_0xb940('0x8')](e,emitEvent(event));}}module[_0xb940('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xa8bd=['save','update','remove','emit','hook','exports','../../mysqldb','FaxQueue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa8bd,0x76));var _0xda8b=function(_0xa7bcad,_0x59a881){_0xa7bcad=_0xa7bcad-0x0;var _0x19a0e9=_0xa8bd[_0xa7bcad];return _0x19a0e9;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xda8b('0x0'))['db'][_0xda8b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda8b('0x2'),'afterUpdate':_0xda8b('0x3'),'afterDestroy':_0xda8b('0x4')};function emitEvent(_0x545aee){return function(_0x3f0fa0,_0xa3488b,_0xea4d30){FaxQueueEvents[_0xda8b('0x5')](_0x545aee+':'+_0x3f0fa0['id'],_0x3f0fa0);FaxQueueEvents['emit'](_0x545aee,_0x3f0fa0);_0xea4d30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xda8b('0x6')](e,emitEvent(event));}}module[_0xda8b('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 68f232a..6ee7545 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 _0x6b72=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0xa9d9c4,_0x2cfe0c){var _0x18d97e=function(_0x17ba08){while(--_0x17ba08){_0xa9d9c4['push'](_0xa9d9c4['shift']());}};_0x18d97e(++_0x2cfe0c);}(_0x6b72,0x1dd));var _0x26b7=function(_0x4d7917,_0x32e349){_0x4d7917=_0x4d7917-0x0;var _0x2bb07f=_0x6b72[_0x4d7917];return _0x2bb07f;};'use strict';var _=require(_0x26b7('0x0'));var util=require(_0x26b7('0x1'));var logger=require(_0x26b7('0x2'))(_0x26b7('0x3'));var moment=require(_0x26b7('0x4'));var BPromise=require(_0x26b7('0x5'));var rp=require(_0x26b7('0x6'));var fs=require('fs');var path=require(_0x26b7('0x7'));var rimraf=require(_0x26b7('0x8'));var config=require(_0x26b7('0x9'));var attributes=require('./faxQueue.attributes');module[_0x26b7('0xa')]=function(_0x3e89c5,_0x441697){return _0x3e89c5['define'](_0x26b7('0xb'),attributes,{'tableName':_0x26b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2abe=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x171f27,_0x56bb8f){var _0x57f375=function(_0x43e92a){while(--_0x43e92a){_0x171f27['push'](_0x171f27['shift']());}};_0x57f375(++_0x56bb8f);}(_0x2abe,0x1f3));var _0xe2ab=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x2abe[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xe2ab('0x0'));var util=require('util');var logger=require(_0xe2ab('0x1'))(_0xe2ab('0x2'));var moment=require(_0xe2ab('0x3'));var BPromise=require('bluebird');var rp=require(_0xe2ab('0x4'));var fs=require('fs');var path=require(_0xe2ab('0x5'));var rimraf=require(_0xe2ab('0x6'));var config=require(_0xe2ab('0x7'));var attributes=require(_0xe2ab('0x8'));module[_0xe2ab('0x9')]=function(_0x11af12,_0x13f825){return _0x11af12[_0xe2ab('0xa')](_0xe2ab('0xb'),attributes,{'tableName':_0xe2ab('0xc'),'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 cce0b35..4ef50ee 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 _0xc19a=['message','catch','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','GetFaxQueue','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s'];(function(_0x1e8a37,_0x1a7cd9){var _0x40b851=function(_0x436337){while(--_0x436337){_0x1e8a37['push'](_0x1e8a37['shift']());}};_0x40b851(++_0x1a7cd9);}(_0xc19a,0xf7));var _0xac19=function(_0x39c42e,_0x275573){_0x39c42e=_0x39c42e-0x0;var _0x6a7124=_0xc19a[_0x39c42e];return _0x6a7124;};'use strict';var _=require(_0xac19('0x0'));var util=require('util');var moment=require(_0xac19('0x1'));var BPromise=require(_0xac19('0x2'));var rs=require(_0xac19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac19('0x4'));var logger=require(_0xac19('0x5'))(_0xac19('0x6'));var config=require('../../config/environment');var jayson=require(_0xac19('0x7'));var client=jayson[_0xac19('0x8')][_0xac19('0x9')]({'port':0x232a});config[_0xac19('0xa')]=_[_0xac19('0xb')](config[_0xac19('0xa')],{'host':_0xac19('0xc'),'port':0x18eb});var socket=require(_0xac19('0xd'))(new Redis(config[_0xac19('0xa')]));require(_0xac19('0xe'))[_0xac19('0xf')](socket);function respondWithRpcPromise(_0x46161c,_0x521e20,_0x15ca3f){return new BPromise(function(_0x2e0094,_0x471394){return client[_0xac19('0x10')](_0x46161c,_0x15ca3f)[_0xac19('0x11')](function(_0x224216){logger[_0xac19('0x12')]('FaxQueue,\x20%s,\x20%s',_0x521e20,_0xac19('0x13'));logger[_0xac19('0x14')](_0xac19('0x15'),_0x521e20,'request\x20sent',JSON[_0xac19('0x16')](_0x224216));if(_0x224216['error']){if(_0x224216[_0xac19('0x17')][_0xac19('0x18')]===0x1f4){logger['error'](_0xac19('0x19'),_0x521e20,_0x224216[_0xac19('0x17')][_0xac19('0x1a')]);return _0x471394(_0x224216['error'][_0xac19('0x1a')]);}logger[_0xac19('0x17')](_0xac19('0x19'),_0x521e20,_0x224216[_0xac19('0x17')][_0xac19('0x1a')]);return _0x2e0094(_0x224216[_0xac19('0x17')][_0xac19('0x1a')]);}else{logger['info'](_0xac19('0x19'),_0x521e20,_0xac19('0x13'));_0x2e0094(_0x224216['result'][_0xac19('0x1a')]);}})[_0xac19('0x1b')](function(_0x1c9407){logger['error'](_0xac19('0x19'),_0x521e20,_0x1c9407);_0x471394(_0x1c9407);});});}exports['GetFaxQueue']=function(_0x8a2783){var _0xc58136=this;return new Promise(function(_0x406bff,_0x5f221f){return db[_0xac19('0x1c')][_0xac19('0x1d')]({'raw':_0x8a2783[_0xac19('0x1e')]?_0x8a2783[_0xac19('0x1e')][_0xac19('0x1f')]===undefined?!![]:![]:!![],'where':_0x8a2783[_0xac19('0x1e')]?_0x8a2783[_0xac19('0x1e')]['where']||null:null,'attributes':_0x8a2783[_0xac19('0x1e')]?_0x8a2783['options'][_0xac19('0x20')]||null:null,'limit':_0x8a2783[_0xac19('0x1e')]?_0x8a2783[_0xac19('0x1e')][_0xac19('0x21')]||null:null,'include':_0x8a2783['options']?_0x8a2783[_0xac19('0x1e')][_0xac19('0x22')]?_[_0xac19('0x23')](_0x8a2783[_0xac19('0x1e')][_0xac19('0x22')],function(_0x2e2168){return{'model':db[_0x2e2168[_0xac19('0x24')]],'as':_0x2e2168['as'],'attributes':_0x2e2168[_0xac19('0x20')],'include':_0x2e2168['include']?_[_0xac19('0x23')](_0x2e2168[_0xac19('0x22')],function(_0x33efc0){return{'model':db[_0x33efc0[_0xac19('0x24')]],'as':_0x33efc0['as'],'attributes':_0x33efc0[_0xac19('0x20')],'include':_0x33efc0['include']?_[_0xac19('0x23')](_0x33efc0[_0xac19('0x22')],function(_0x78eb1c){return{'model':db[_0x78eb1c[_0xac19('0x24')]],'as':_0x78eb1c['as'],'attributes':_0x78eb1c['attributes']};}):[]};}):[]};}):[]:[]})[_0xac19('0x11')](function(_0x4e244b){logger['info'](_0xac19('0x25'),_0x8a2783);logger[_0xac19('0x14')](_0xac19('0x25'),_0x8a2783,JSON[_0xac19('0x16')](_0x4e244b));_0x406bff(_0x4e244b);})[_0xac19('0x1b')](function(_0x3dc5a7){logger['error']('GetFaxQueue',_0x3dc5a7[_0xac19('0x1a')],_0x8a2783);_0x5f221f(_0xc58136[_0xac19('0x17')](0x1f4,_0x3dc5a7[_0xac19('0x1a')]));});});};exports[_0xac19('0x26')]=function(_0x27f367){var _0x4d4b18=this;return new Promise(function(_0x135f65,_0x20e491){return db[_0xac19('0x1c')]['find']({'raw':_0x27f367[_0xac19('0x1e')]?_0x27f367[_0xac19('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x27f367[_0xac19('0x1e')]?_0x27f367[_0xac19('0x1e')]['where']||null:null,'attributes':_0x27f367[_0xac19('0x1e')]?_0x27f367[_0xac19('0x1e')][_0xac19('0x20')]||null:null,'include':_0x27f367[_0xac19('0x1e')]?_0x27f367[_0xac19('0x1e')][_0xac19('0x22')]?_[_0xac19('0x23')](_0x27f367[_0xac19('0x1e')][_0xac19('0x22')],function(_0x3837e1){return{'model':db[_0x3837e1[_0xac19('0x24')]],'as':_0x3837e1['as'],'attributes':_0x3837e1[_0xac19('0x20')],'include':_0x3837e1[_0xac19('0x22')]?_[_0xac19('0x23')](_0x3837e1[_0xac19('0x22')],function(_0x3f1ecd){return{'model':db[_0x3f1ecd[_0xac19('0x24')]],'as':_0x3f1ecd['as'],'attributes':_0x3f1ecd['attributes'],'include':_0x3f1ecd['include']?_['map'](_0x3f1ecd[_0xac19('0x22')],function(_0x283139){return{'model':db[_0x283139[_0xac19('0x24')]],'as':_0x283139['as'],'attributes':_0x283139[_0xac19('0x20')]};}):[]};}):[]};}):[]:[]})[_0xac19('0x11')](function(_0x31c3d7){logger[_0xac19('0x12')](_0xac19('0x26'),_0x27f367);logger['debug'](_0xac19('0x26'),_0x27f367,JSON[_0xac19('0x16')](_0x31c3d7));_0x135f65(_0x31c3d7);})[_0xac19('0x1b')](function(_0x481eae){logger[_0xac19('0x17')]('ShowFaxQueue',_0x481eae['message'],_0x27f367);_0x20e491(_0x4d4b18[_0xac19('0x17')](0x1f4,_0x481eae['message']));});});}; \ No newline at end of file +var _0x483f=['socket.io-emitter','./faxQueue.socket','register','request','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','then','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x533deb,_0x13d177){var _0x2efe05=function(_0x390f7e){while(--_0x390f7e){_0x533deb['push'](_0x533deb['shift']());}};_0x2efe05(++_0x13d177);}(_0x483f,0x1a0));var _0xf483=function(_0x388cb9,_0x13cb3f){_0x388cb9=_0x388cb9-0x0;var _0x581197=_0x483f[_0x388cb9];return _0x581197;};'use strict';var _=require(_0xf483('0x0'));var util=require('util');var moment=require(_0xf483('0x1'));var BPromise=require(_0xf483('0x2'));var rs=require(_0xf483('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf483('0x4'))['db'];var utils=require(_0xf483('0x5'));var logger=require(_0xf483('0x6'))('rpc');var config=require(_0xf483('0x7'));var jayson=require(_0xf483('0x8'));var client=jayson['client'][_0xf483('0x9')]({'port':0x232a});config[_0xf483('0xa')]=_[_0xf483('0xb')](config[_0xf483('0xa')],{'host':_0xf483('0xc'),'port':0x18eb});var socket=require(_0xf483('0xd'))(new Redis(config[_0xf483('0xa')]));require(_0xf483('0xe'))[_0xf483('0xf')](socket);function respondWithRpcPromise(_0x48dbeb,_0x478e8f,_0x1ea5b8){return new BPromise(function(_0x9f0318,_0x253d17){return client[_0xf483('0x10')](_0x48dbeb,_0x1ea5b8)['then'](function(_0x45beb4){logger['info']('FaxQueue,\x20%s,\x20%s',_0x478e8f,_0xf483('0x11'));logger[_0xf483('0x12')](_0xf483('0x13'),_0x478e8f,_0xf483('0x11'),JSON[_0xf483('0x14')](_0x45beb4));if(_0x45beb4[_0xf483('0x15')]){if(_0x45beb4[_0xf483('0x15')][_0xf483('0x16')]===0x1f4){logger['error'](_0xf483('0x17'),_0x478e8f,_0x45beb4[_0xf483('0x15')]['message']);return _0x253d17(_0x45beb4[_0xf483('0x15')]['message']);}logger[_0xf483('0x15')](_0xf483('0x17'),_0x478e8f,_0x45beb4[_0xf483('0x15')][_0xf483('0x18')]);return _0x9f0318(_0x45beb4[_0xf483('0x15')][_0xf483('0x18')]);}else{logger[_0xf483('0x19')]('FaxQueue,\x20%s,\x20%s',_0x478e8f,_0xf483('0x11'));_0x9f0318(_0x45beb4['result'][_0xf483('0x18')]);}})[_0xf483('0x1a')](function(_0x2cf170){logger[_0xf483('0x15')](_0xf483('0x17'),_0x478e8f,_0x2cf170);_0x253d17(_0x2cf170);});});}exports[_0xf483('0x1b')]=function(_0x5d6e1e){var _0x4d3d90=this;return new Promise(function(_0x528d73,_0x33506a){return db[_0xf483('0x1c')]['findAll']({'raw':_0x5d6e1e[_0xf483('0x1d')]?_0x5d6e1e[_0xf483('0x1d')][_0xf483('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d6e1e[_0xf483('0x1d')]?_0x5d6e1e[_0xf483('0x1d')][_0xf483('0x1f')]||null:null,'attributes':_0x5d6e1e['options']?_0x5d6e1e[_0xf483('0x1d')][_0xf483('0x20')]||null:null,'limit':_0x5d6e1e[_0xf483('0x1d')]?_0x5d6e1e['options']['limit']||null:null,'include':_0x5d6e1e[_0xf483('0x1d')]?_0x5d6e1e[_0xf483('0x1d')][_0xf483('0x21')]?_[_0xf483('0x22')](_0x5d6e1e[_0xf483('0x1d')][_0xf483('0x21')],function(_0x129e25){return{'model':db[_0x129e25[_0xf483('0x23')]],'as':_0x129e25['as'],'attributes':_0x129e25[_0xf483('0x20')],'include':_0x129e25[_0xf483('0x21')]?_[_0xf483('0x22')](_0x129e25['include'],function(_0x400cb6){return{'model':db[_0x400cb6[_0xf483('0x23')]],'as':_0x400cb6['as'],'attributes':_0x400cb6[_0xf483('0x20')],'include':_0x400cb6['include']?_['map'](_0x400cb6[_0xf483('0x21')],function(_0x471643){return{'model':db[_0x471643[_0xf483('0x23')]],'as':_0x471643['as'],'attributes':_0x471643['attributes']};}):[]};}):[]};}):[]:[]})[_0xf483('0x24')](function(_0x1306c4){logger[_0xf483('0x19')](_0xf483('0x1b'),_0x5d6e1e);logger[_0xf483('0x12')](_0xf483('0x1b'),_0x5d6e1e,JSON[_0xf483('0x14')](_0x1306c4));_0x528d73(_0x1306c4);})['catch'](function(_0x21ed87){logger['error'](_0xf483('0x1b'),_0x21ed87[_0xf483('0x18')],_0x5d6e1e);_0x33506a(_0x4d3d90[_0xf483('0x15')](0x1f4,_0x21ed87['message']));});});};exports[_0xf483('0x25')]=function(_0x8fcfa3){var _0x2afea4=this;return new Promise(function(_0x362094,_0x13913c){return db['FaxQueue'][_0xf483('0x26')]({'raw':_0x8fcfa3[_0xf483('0x1d')]?_0x8fcfa3[_0xf483('0x1d')][_0xf483('0x1e')]===undefined?!![]:![]:!![],'where':_0x8fcfa3[_0xf483('0x1d')]?_0x8fcfa3[_0xf483('0x1d')]['where']||null:null,'attributes':_0x8fcfa3[_0xf483('0x1d')]?_0x8fcfa3[_0xf483('0x1d')][_0xf483('0x20')]||null:null,'include':_0x8fcfa3[_0xf483('0x1d')]?_0x8fcfa3[_0xf483('0x1d')]['include']?_[_0xf483('0x22')](_0x8fcfa3[_0xf483('0x1d')][_0xf483('0x21')],function(_0x1baccd){return{'model':db[_0x1baccd['model']],'as':_0x1baccd['as'],'attributes':_0x1baccd[_0xf483('0x20')],'include':_0x1baccd[_0xf483('0x21')]?_['map'](_0x1baccd[_0xf483('0x21')],function(_0x231141){return{'model':db[_0x231141[_0xf483('0x23')]],'as':_0x231141['as'],'attributes':_0x231141[_0xf483('0x20')],'include':_0x231141[_0xf483('0x21')]?_[_0xf483('0x22')](_0x231141[_0xf483('0x21')],function(_0x437716){return{'model':db[_0x437716[_0xf483('0x23')]],'as':_0x437716['as'],'attributes':_0x437716[_0xf483('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf483('0x24')](function(_0x277509){logger['info']('ShowFaxQueue',_0x8fcfa3);logger[_0xf483('0x12')]('ShowFaxQueue',_0x8fcfa3,JSON[_0xf483('0x14')](_0x277509));_0x362094(_0x277509);})['catch'](function(_0x21a9e5){logger['error']('ShowFaxQueue',_0x21a9e5[_0xf483('0x18')],_0x8fcfa3);_0x13913c(_0x2afea4[_0xf483('0x15')](0x1f4,_0x21a9e5[_0xf483('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 51cdfd2..b701170 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 _0xdade=['register','length','faxQueue:','./faxQueue.events','update','emit','removeListener'];(function(_0x2fb275,_0x54f3a2){var _0x29de06=function(_0x28c1ee){while(--_0x28c1ee){_0x2fb275['push'](_0x2fb275['shift']());}};_0x29de06(++_0x54f3a2);}(_0xdade,0x1e6));var _0xedad=function(_0x1e7aff,_0x1c843b){_0x1e7aff=_0x1e7aff-0x0;var _0x2a16bf=_0xdade[_0x1e7aff];return _0x2a16bf;};'use strict';var FaxQueueEvents=require(_0xedad('0x0'));var events=['save','remove',_0xedad('0x1')];function createListener(_0x1781ef,_0x4ba8be){return function(_0x4f321d){_0x4ba8be[_0xedad('0x2')](_0x1781ef,_0x4f321d);};}function removeListener(_0x49deec,_0x5b11a7){return function(){FaxQueueEvents[_0xedad('0x3')](_0x49deec,_0x5b11a7);};}exports[_0xedad('0x4')]=function(_0x3ab906){for(var _0x4df785=0x0,_0x499fa3=events[_0xedad('0x5')];_0x4df785<_0x499fa3;_0x4df785++){var _0x58452d=events[_0x4df785];var _0x383e41=createListener(_0xedad('0x6')+_0x58452d,_0x3ab906);FaxQueueEvents['on'](_0x58452d,_0x383e41);}}; \ No newline at end of file +var _0x3cd4=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x3cd4,0x1af));var _0x43cd=function(_0x2e71e8,_0x54150f){_0x2e71e8=_0x2e71e8-0x0;var _0x3d59b3=_0x3cd4[_0x2e71e8];return _0x3d59b3;};'use strict';var FaxQueueEvents=require(_0x43cd('0x0'));var events=[_0x43cd('0x1'),_0x43cd('0x2'),_0x43cd('0x3')];function createListener(_0x2adff1,_0x2ea236){return function(_0x57588c){_0x2ea236[_0x43cd('0x4')](_0x2adff1,_0x57588c);};}function removeListener(_0x2868d8,_0x12c657){return function(){FaxQueueEvents[_0x43cd('0x5')](_0x2868d8,_0x12c657);};}exports[_0x43cd('0x6')]=function(_0x32c7b0){for(var _0xe3ed0e=0x0,_0x5987f0=events[_0x43cd('0x7')];_0xe3ed0e<_0x5987f0;_0xe3ed0e++){var _0xab659c=events[_0xe3ed0e];var _0x212e44=createListener(_0x43cd('0x8')+_0xab659c,_0x32c7b0);FaxQueueEvents['on'](_0xab659c,_0x212e44);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 49d1181..8edacda 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 _0x7880=['delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update'];(function(_0x32bec5,_0x40c841){var _0x170d7b=function(_0x32b5be){while(--_0x32b5be){_0x32bec5['push'](_0x32bec5['shift']());}};_0x170d7b(++_0x40c841);}(_0x7880,0x1f4));var _0x0788=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x7880[_0x38080e];return _0x4e4c87;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x16')]('/',auth[_0x0788('0xa')](),controller['create']);router[_0x0788('0x16')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x17')]);router['post'](_0x0788('0x14'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router[_0x0788('0x19')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x1a')]);router[_0x0788('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x1b')]('/:id/teams',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x1b')]('/:id/users',auth[_0x0788('0xa')](),controller[_0x0788('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2da6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','multer','util','path'];(function(_0x184d42,_0x210861){var _0x1ff479=function(_0x14253d){while(--_0x14253d){_0x184d42['push'](_0x184d42['shift']());}};_0x1ff479(++_0x210861);}(_0x2da6,0x1dd));var _0x62da=function(_0x576a48,_0x2a596c){_0x576a48=_0x576a48-0x0;var _0x49578c=_0x2da6[_0x576a48];return _0x49578c;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0x9')](_0x62da('0xf'),auth['isAuthenticated'](),controller[_0x62da('0x10')]);router[_0x62da('0x9')](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);router['get'](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x14')]);router[_0x62da('0x15')]('/',auth[_0x62da('0xa')](),controller['create']);router['post'](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x16')]);router[_0x62da('0x15')](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x17')]);router[_0x62da('0x18')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller[_0x62da('0x1a')]);router[_0x62da('0x1b')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller['destroy']);router['delete'](_0x62da('0x11'),auth['isAuthenticated'](),controller[_0x62da('0x1c')]);router[_0x62da('0x1b')](_0x62da('0x13'),auth['isAuthenticated'](),controller[_0x62da('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 875173a..e1fdf7e 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 _0x23e3=['moment','STRING','DATE'];(function(_0x224ab0,_0x35895f){var _0x49aebf=function(_0x502487){while(--_0x502487){_0x224ab0['push'](_0x224ab0['shift']());}};_0x49aebf(++_0x35895f);}(_0x23e3,0x120));var _0x323e=function(_0x3d9604,_0x515a07){_0x3d9604=_0x3d9604-0x0;var _0x61e373=_0x23e3[_0x3d9604];return _0x61e373;};'use strict';var moment=require(_0x323e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x323e('0x1')]},'joinAt':{'type':Sequelize[_0x323e('0x2')]},'leaveAt':{'type':Sequelize[_0x323e('0x2')]},'acceptAt':{'type':Sequelize[_0x323e('0x2')]},'exitAt':{'type':Sequelize[_0x323e('0x2')]},'reason':{'type':Sequelize[_0x323e('0x1')]}}; \ No newline at end of file +var _0x7825=['sequelize','STRING','DATE'];(function(_0x47bde2,_0x284170){var _0x56ad45=function(_0x35cbb3){while(--_0x35cbb3){_0x47bde2['push'](_0x47bde2['shift']());}};_0x56ad45(++_0x284170);}(_0x7825,0x138));var _0x5782=function(_0x2081aa,_0x31d653){_0x2081aa=_0x2081aa-0x0;var _0x36485d=_0x7825[_0x2081aa];return _0x36485d;};'use strict';var moment=require('moment');var Sequelize=require(_0x5782('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5782('0x1')]},'joinAt':{'type':Sequelize[_0x5782('0x2')]},'leaveAt':{'type':Sequelize[_0x5782('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5782('0x2')]},'reason':{'type':Sequelize[_0x5782('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0e42742..2b4a1fc 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 _0x4a3d=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a3d,0x79));var _0xd4a3=function(_0x2b1227,_0x551735){_0x2b1227=_0x2b1227-0x0;var _0xebce09=_0x4a3d[_0x2b1227];return _0xebce09;};'use strict';var emlformat=require(_0xd4a3('0x0'));var rimraf=require(_0xd4a3('0x1'));var zipdir=require(_0xd4a3('0x2'));var jsonpatch=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var moment=require(_0xd4a3('0x5'));var BPromise=require(_0xd4a3('0x6'));var Mustache=require(_0xd4a3('0x7'));var util=require(_0xd4a3('0x8'));var path=require(_0xd4a3('0x9'));var sox=require(_0xd4a3('0xa'));var csv=require(_0xd4a3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xb'));var querystring=require(_0xd4a3('0xf'));var Papa=require(_0xd4a3('0x10'));var Redis=require(_0xd4a3('0x11'));var authService=require(_0xd4a3('0x12'));var qs=require(_0xd4a3('0x13'));var as=require(_0xd4a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x15'))(_0xd4a3('0x16'));var utils=require(_0xd4a3('0x17'));var config=require(_0xd4a3('0x18'));var licenseUtil=require(_0xd4a3('0x19'));var db=require(_0xd4a3('0x1a'))['db'];function respondWithStatusCode(_0x3e7728,_0x57bd90){_0x57bd90=_0x57bd90||0xcc;return function(_0x3548e4){if(_0x3548e4){return _0x3e7728[_0xd4a3('0x1b')](_0x57bd90);}return _0x3e7728[_0xd4a3('0x1c')](_0x57bd90)[_0xd4a3('0x1d')]();};}function respondWithResult(_0xd28551,_0x11f325){_0x11f325=_0x11f325||0xc8;return function(_0x2bfeb6){if(_0x2bfeb6){return _0xd28551[_0xd4a3('0x1c')](_0x11f325)['json'](_0x2bfeb6);}};}function respondWithFilteredResult(_0x5d16e8,_0x140379){return function(_0x2f96bb){if(_0x2f96bb){var _0x124d03=typeof _0x140379[_0xd4a3('0x1e')]===_0xd4a3('0x1f')&&typeof _0x140379[_0xd4a3('0x20')]==='undefined';var _0x2a3b7e=_0x2f96bb['count'];var _0xf9fc3c=_0x124d03?0x0:_0x140379['offset'];var _0x21fa36=_0x124d03?_0x2f96bb['count']:_0x140379[_0xd4a3('0x1e')]+_0x140379[_0xd4a3('0x20')];var _0x4be8b7;if(_0x21fa36>=_0x2a3b7e){_0x21fa36=_0x2a3b7e;_0x4be8b7=0xc8;}else{_0x4be8b7=0xce;}_0x5d16e8[_0xd4a3('0x1c')](_0x4be8b7);return _0x5d16e8[_0xd4a3('0x21')](_0xd4a3('0x22'),_0xf9fc3c+'-'+_0x21fa36+'/'+_0x2a3b7e)['json'](_0x2f96bb);}return null;};}function patchUpdates(_0x4a1cf0){return function(_0x21efd7){try{jsonpatch['apply'](_0x21efd7,_0x4a1cf0,!![]);}catch(_0x402201){return BPromise[_0xd4a3('0x23')](_0x402201);}return _0x21efd7['save']();};}function saveUpdates(_0x5bc708,_0x4f957f){return function(_0x40535d){if(_0x40535d){return _0x40535d[_0xd4a3('0x24')](_0x5bc708)[_0xd4a3('0x25')](function(_0x5717f7){return _0x5717f7;});}return null;};}function removeEntity(_0x2de130,_0x137bba){return function(_0x1a4ced){if(_0x1a4ced){return _0x1a4ced[_0xd4a3('0x26')]()[_0xd4a3('0x25')](function(){_0x2de130[_0xd4a3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a871,_0x1dea89){return function(_0x50c8ac){if(!_0x50c8ac){_0x35a871[_0xd4a3('0x1b')](0x194);}return _0x50c8ac;};}function handleError(_0x42f100,_0x26cb96){_0x26cb96=_0x26cb96||0x1f4;return function(_0x4ce98a){logger[_0xd4a3('0x27')](_0x4ce98a[_0xd4a3('0x28')]);if(_0x4ce98a[_0xd4a3('0x29')]){delete _0x4ce98a['name'];}_0x42f100[_0xd4a3('0x1c')](_0x26cb96)['send'](_0x4ce98a);};}exports[_0xd4a3('0x2a')]=function(_0x523871,_0x3019a4){var _0x5d84f2={},_0x2769b7={},_0x535ecd={'count':0x0,'rows':[]};var _0x3e471e=_['map'](db[_0xd4a3('0x2b')][_0xd4a3('0x2c')],function(_0x2f2e8d){return{'name':_0x2f2e8d[_0xd4a3('0x2d')],'type':_0x2f2e8d[_0xd4a3('0x2e')]['key']};});_0x2769b7['model']=_[_0xd4a3('0x2f')](_0x3e471e,_0xd4a3('0x29'));_0x2769b7[_0xd4a3('0x30')]=_[_0xd4a3('0x31')](_0x523871['query']);_0x2769b7[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x2769b7['model'],_0x2769b7[_0xd4a3('0x30')]);_0x5d84f2['attributes']=_[_0xd4a3('0x33')](_0x2769b7[_0xd4a3('0x34')],qs[_0xd4a3('0x35')](_0x523871[_0xd4a3('0x30')][_0xd4a3('0x35')]));_0x5d84f2[_0xd4a3('0x36')]=_0x5d84f2[_0xd4a3('0x36')][_0xd4a3('0x37')]?_0x5d84f2[_0xd4a3('0x36')]:_0x2769b7['model'];if(!_0x523871[_0xd4a3('0x30')][_0xd4a3('0x38')](_0xd4a3('0x39'))){_0x5d84f2['limit']=qs[_0xd4a3('0x20')](_0x523871[_0xd4a3('0x30')][_0xd4a3('0x20')]);_0x5d84f2[_0xd4a3('0x1e')]=qs[_0xd4a3('0x1e')](_0x523871[_0xd4a3('0x30')][_0xd4a3('0x1e')]);}_0x5d84f2['order']=qs[_0xd4a3('0x3a')](_0x523871['query']['sort']);_0x5d84f2[_0xd4a3('0x3b')]=qs[_0xd4a3('0x32')](_[_0xd4a3('0x3c')](_0x523871[_0xd4a3('0x30')],_0x2769b7['filters']),_0x3e471e);if(_0x523871[_0xd4a3('0x30')]['filter']){_0x5d84f2[_0xd4a3('0x3b')]=_[_0xd4a3('0x3d')](_0x5d84f2[_0xd4a3('0x3b')],{'$or':_[_0xd4a3('0x2f')](_0x3e471e,function(_0x4d667a){if(_0x4d667a[_0xd4a3('0x2e')]!==_0xd4a3('0x3e')){var _0x131ade={};_0x131ade[_0x4d667a[_0xd4a3('0x29')]]={'$like':'%'+_0x523871['query']['filter']+'%'};return _0x131ade;}})});}_0x5d84f2=_[_0xd4a3('0x3d')]({},_0x5d84f2,_0x523871[_0xd4a3('0x3f')]);var _0x284a7c={'where':_0x5d84f2[_0xd4a3('0x3b')]};return db[_0xd4a3('0x2b')][_0xd4a3('0x40')](_0x284a7c)[_0xd4a3('0x25')](function(_0x515e79){_0x535ecd['count']=_0x515e79;if(_0x523871[_0xd4a3('0x30')][_0xd4a3('0x41')]){_0x5d84f2[_0xd4a3('0x42')]=[{'all':!![]}];}return db[_0xd4a3('0x2b')][_0xd4a3('0x43')](_0x5d84f2);})[_0xd4a3('0x25')](function(_0xcb013){_0x535ecd[_0xd4a3('0x44')]=_0xcb013;return _0x535ecd;})[_0xd4a3('0x25')](respondWithFilteredResult(_0x3019a4,_0x5d84f2))[_0xd4a3('0x45')](handleError(_0x3019a4,null));};exports['show']=function(_0x2bb7ce,_0x29955b){var _0x6e7362={'raw':!![],'where':{'id':_0x2bb7ce['params']['id']}},_0x40b847={};_0x40b847[_0xd4a3('0x34')]=_['keys'](db[_0xd4a3('0x2b')]['rawAttributes']);_0x40b847[_0xd4a3('0x30')]=_[_0xd4a3('0x31')](_0x2bb7ce[_0xd4a3('0x30')]);_0x40b847[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x40b847['model'],_0x40b847[_0xd4a3('0x30')]);_0x6e7362[_0xd4a3('0x36')]=_[_0xd4a3('0x33')](_0x40b847['model'],qs[_0xd4a3('0x35')](_0x2bb7ce[_0xd4a3('0x30')]['fields']));_0x6e7362[_0xd4a3('0x36')]=_0x6e7362[_0xd4a3('0x36')][_0xd4a3('0x37')]?_0x6e7362[_0xd4a3('0x36')]:_0x40b847[_0xd4a3('0x34')];if(_0x2bb7ce['query']['includeAll']){_0x6e7362[_0xd4a3('0x42')]=[{'all':!![]}];}_0x6e7362=_[_0xd4a3('0x3d')]({},_0x6e7362,_0x2bb7ce[_0xd4a3('0x3f')]);return db[_0xd4a3('0x2b')][_0xd4a3('0x46')](_0x6e7362)[_0xd4a3('0x25')](handleEntityNotFound(_0x29955b,null))[_0xd4a3('0x25')](respondWithResult(_0x29955b,null))[_0xd4a3('0x45')](handleError(_0x29955b,null));};exports['create']=function(_0xbe9cee,_0x1ba4b9){return db['FaxQueueReport']['create'](_0xbe9cee[_0xd4a3('0x47')],{})['then'](respondWithResult(_0x1ba4b9,0xc9))['catch'](handleError(_0x1ba4b9,null));};exports[_0xd4a3('0x24')]=function(_0x3410e6,_0x1b0051){if(_0x3410e6[_0xd4a3('0x47')]['id']){delete _0x3410e6[_0xd4a3('0x47')]['id'];}return db[_0xd4a3('0x2b')]['find']({'where':{'id':_0x3410e6['params']['id']}})['then'](handleEntityNotFound(_0x1b0051,null))[_0xd4a3('0x25')](saveUpdates(_0x3410e6['body'],null))[_0xd4a3('0x25')](respondWithResult(_0x1b0051,null))[_0xd4a3('0x45')](handleError(_0x1b0051,null));};exports[_0xd4a3('0x26')]=function(_0x8668d,_0x37cdd3){return db[_0xd4a3('0x2b')][_0xd4a3('0x46')]({'where':{'id':_0x8668d['params']['id']}})[_0xd4a3('0x25')](handleEntityNotFound(_0x37cdd3,null))['then'](removeEntity(_0x37cdd3,null))[_0xd4a3('0x45')](handleError(_0x37cdd3,null));};exports['describe']=function(_0x42b0e7,_0x31d2ca){return db['FaxQueueReport'][_0xd4a3('0x48')]()[_0xd4a3('0x25')](respondWithResult(_0x31d2ca,null))['catch'](handleError(_0x31d2ca,null));}; \ No newline at end of file +var _0x68fc=['pick','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','map','FaxQueueReport','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x68fc,0xa5));var _0xc68f=function(_0x4368ed,_0x2ba355){_0x4368ed=_0x4368ed-0x0;var _0x26276d=_0x68fc[_0x4368ed];return _0x26276d;};'use strict';var emlformat=require(_0xc68f('0x0'));var rimraf=require(_0xc68f('0x1'));var zipdir=require(_0xc68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc68f('0x5'));var csv=require(_0xc68f('0x6'));var ejs=require(_0xc68f('0x7'));var fs=require('fs');var fs_extra=require(_0xc68f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc68f('0x9'));var jsforce=require(_0xc68f('0xa'));var deskjs=require(_0xc68f('0xb'));var toCsv=require(_0xc68f('0x6'));var querystring=require(_0xc68f('0xc'));var Papa=require(_0xc68f('0xd'));var Redis=require(_0xc68f('0xe'));var authService=require(_0xc68f('0xf'));var qs=require(_0xc68f('0x10'));var as=require(_0xc68f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc68f('0x12'))(_0xc68f('0x13'));var utils=require(_0xc68f('0x14'));var config=require(_0xc68f('0x15'));var licenseUtil=require(_0xc68f('0x16'));var db=require(_0xc68f('0x17'))['db'];function respondWithStatusCode(_0x3ccebe,_0x41aeb8){_0x41aeb8=_0x41aeb8||0xcc;return function(_0x151bde){if(_0x151bde){return _0x3ccebe[_0xc68f('0x18')](_0x41aeb8);}return _0x3ccebe[_0xc68f('0x19')](_0x41aeb8)['end']();};}function respondWithResult(_0x2ea1c4,_0x90ccbd){_0x90ccbd=_0x90ccbd||0xc8;return function(_0x2b1d30){if(_0x2b1d30){return _0x2ea1c4[_0xc68f('0x19')](_0x90ccbd)[_0xc68f('0x1a')](_0x2b1d30);}};}function respondWithFilteredResult(_0x2673b4,_0x3d1406){return function(_0x209d16){if(_0x209d16){var _0x4648c6=typeof _0x3d1406['offset']==='undefined'&&typeof _0x3d1406[_0xc68f('0x1b')]===_0xc68f('0x1c');var _0x171eea=_0x209d16[_0xc68f('0x1d')];var _0x2d9d85=_0x4648c6?0x0:_0x3d1406[_0xc68f('0x1e')];var _0x50fab4=_0x4648c6?_0x209d16[_0xc68f('0x1d')]:_0x3d1406[_0xc68f('0x1e')]+_0x3d1406[_0xc68f('0x1b')];var _0x2c058c;if(_0x50fab4>=_0x171eea){_0x50fab4=_0x171eea;_0x2c058c=0xc8;}else{_0x2c058c=0xce;}_0x2673b4[_0xc68f('0x19')](_0x2c058c);return _0x2673b4[_0xc68f('0x1f')](_0xc68f('0x20'),_0x2d9d85+'-'+_0x50fab4+'/'+_0x171eea)[_0xc68f('0x1a')](_0x209d16);}return null;};}function patchUpdates(_0x582301){return function(_0xcc11a3){try{jsonpatch[_0xc68f('0x21')](_0xcc11a3,_0x582301,!![]);}catch(_0x2e27b9){return BPromise['reject'](_0x2e27b9);}return _0xcc11a3[_0xc68f('0x22')]();};}function saveUpdates(_0x1daac5,_0x116203){return function(_0x2064db){if(_0x2064db){return _0x2064db[_0xc68f('0x23')](_0x1daac5)[_0xc68f('0x24')](function(_0x2412a9){return _0x2412a9;});}return null;};}function removeEntity(_0x547d46,_0x38c3a0){return function(_0x288957){if(_0x288957){return _0x288957['destroy']()[_0xc68f('0x24')](function(){_0x547d46[_0xc68f('0x19')](0xcc)[_0xc68f('0x25')]();});}};}function handleEntityNotFound(_0x44c4b2,_0x39419a){return function(_0x48d797){if(!_0x48d797){_0x44c4b2[_0xc68f('0x18')](0x194);}return _0x48d797;};}function handleError(_0x417de2,_0x5d4632){_0x5d4632=_0x5d4632||0x1f4;return function(_0x38b935){logger[_0xc68f('0x26')](_0x38b935['stack']);if(_0x38b935[_0xc68f('0x27')]){delete _0x38b935[_0xc68f('0x27')];}_0x417de2[_0xc68f('0x19')](_0x5d4632)[_0xc68f('0x28')](_0x38b935);};}exports['index']=function(_0x477a1c,_0x1cc5b2){var _0x26003a={},_0x435482={},_0x1ba1ac={'count':0x0,'rows':[]};var _0x11b203=_[_0xc68f('0x29')](db[_0xc68f('0x2a')]['rawAttributes'],function(_0x37f947){return{'name':_0x37f947[_0xc68f('0x2b')],'type':_0x37f947['type'][_0xc68f('0x2c')]};});_0x435482[_0xc68f('0x2d')]=_[_0xc68f('0x29')](_0x11b203,_0xc68f('0x27'));_0x435482['query']=_[_0xc68f('0x2e')](_0x477a1c[_0xc68f('0x2f')]);_0x435482['filters']=_[_0xc68f('0x30')](_0x435482[_0xc68f('0x2d')],_0x435482[_0xc68f('0x2f')]);_0x26003a[_0xc68f('0x31')]=_[_0xc68f('0x30')](_0x435482['model'],qs['fields'](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x32')]));_0x26003a[_0xc68f('0x31')]=_0x26003a[_0xc68f('0x31')][_0xc68f('0x33')]?_0x26003a['attributes']:_0x435482['model'];if(!_0x477a1c[_0xc68f('0x2f')]['hasOwnProperty'](_0xc68f('0x34'))){_0x26003a[_0xc68f('0x1b')]=qs[_0xc68f('0x1b')](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x1b')]);_0x26003a[_0xc68f('0x1e')]=qs[_0xc68f('0x1e')](_0x477a1c['query'][_0xc68f('0x1e')]);}_0x26003a[_0xc68f('0x35')]=qs[_0xc68f('0x36')](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x36')]);_0x26003a[_0xc68f('0x37')]=qs[_0xc68f('0x38')](_[_0xc68f('0x39')](_0x477a1c[_0xc68f('0x2f')],_0x435482[_0xc68f('0x38')]),_0x11b203);if(_0x477a1c[_0xc68f('0x2f')]['filter']){_0x26003a['where']=_['merge'](_0x26003a[_0xc68f('0x37')],{'$or':_[_0xc68f('0x29')](_0x11b203,function(_0x268649){if(_0x268649[_0xc68f('0x3a')]!=='VIRTUAL'){var _0x10c664={};_0x10c664[_0x268649[_0xc68f('0x27')]]={'$like':'%'+_0x477a1c[_0xc68f('0x2f')]['filter']+'%'};return _0x10c664;}})});}_0x26003a=_[_0xc68f('0x3b')]({},_0x26003a,_0x477a1c[_0xc68f('0x3c')]);var _0x4a8883={'where':_0x26003a[_0xc68f('0x37')]};return db[_0xc68f('0x2a')][_0xc68f('0x1d')](_0x4a8883)['then'](function(_0x2702ac){_0x1ba1ac[_0xc68f('0x1d')]=_0x2702ac;if(_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x3d')]){_0x26003a[_0xc68f('0x3e')]=[{'all':!![]}];}return db[_0xc68f('0x2a')][_0xc68f('0x3f')](_0x26003a);})['then'](function(_0x192942){_0x1ba1ac[_0xc68f('0x40')]=_0x192942;return _0x1ba1ac;})[_0xc68f('0x24')](respondWithFilteredResult(_0x1cc5b2,_0x26003a))[_0xc68f('0x41')](handleError(_0x1cc5b2,null));};exports[_0xc68f('0x42')]=function(_0x1e4f50,_0x1d4619){var _0x335b52={'raw':!![],'where':{'id':_0x1e4f50['params']['id']}},_0x1e8141={};_0x1e8141[_0xc68f('0x2d')]=_[_0xc68f('0x2e')](db[_0xc68f('0x2a')][_0xc68f('0x43')]);_0x1e8141[_0xc68f('0x2f')]=_[_0xc68f('0x2e')](_0x1e4f50[_0xc68f('0x2f')]);_0x1e8141['filters']=_[_0xc68f('0x30')](_0x1e8141['model'],_0x1e8141['query']);_0x335b52[_0xc68f('0x31')]=_[_0xc68f('0x30')](_0x1e8141['model'],qs['fields'](_0x1e4f50[_0xc68f('0x2f')][_0xc68f('0x32')]));_0x335b52[_0xc68f('0x31')]=_0x335b52[_0xc68f('0x31')][_0xc68f('0x33')]?_0x335b52[_0xc68f('0x31')]:_0x1e8141[_0xc68f('0x2d')];if(_0x1e4f50[_0xc68f('0x2f')][_0xc68f('0x3d')]){_0x335b52[_0xc68f('0x3e')]=[{'all':!![]}];}_0x335b52=_[_0xc68f('0x3b')]({},_0x335b52,_0x1e4f50['options']);return db[_0xc68f('0x2a')]['find'](_0x335b52)[_0xc68f('0x24')](handleEntityNotFound(_0x1d4619,null))[_0xc68f('0x24')](respondWithResult(_0x1d4619,null))['catch'](handleError(_0x1d4619,null));};exports[_0xc68f('0x44')]=function(_0x3f4537,_0x28e8ef){return db[_0xc68f('0x2a')][_0xc68f('0x44')](_0x3f4537[_0xc68f('0x45')],{})[_0xc68f('0x24')](respondWithResult(_0x28e8ef,0xc9))[_0xc68f('0x41')](handleError(_0x28e8ef,null));};exports['update']=function(_0x2920d5,_0x15eaa2){if(_0x2920d5[_0xc68f('0x45')]['id']){delete _0x2920d5['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2920d5[_0xc68f('0x46')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x15eaa2,null))['then'](saveUpdates(_0x2920d5[_0xc68f('0x45')],null))['then'](respondWithResult(_0x15eaa2,null))[_0xc68f('0x41')](handleError(_0x15eaa2,null));};exports[_0xc68f('0x47')]=function(_0x44efa8,_0x26ac9a){return db[_0xc68f('0x2a')][_0xc68f('0x48')]({'where':{'id':_0x44efa8[_0xc68f('0x46')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x26ac9a,null))[_0xc68f('0x24')](removeEntity(_0x26ac9a,null))[_0xc68f('0x41')](handleError(_0x26ac9a,null));};exports[_0xc68f('0x49')]=function(_0x5e36c7,_0x2e4ebc){return db[_0xc68f('0x2a')]['describe']()['then'](respondWithResult(_0x2e4ebc,null))[_0xc68f('0x41')](handleError(_0x2e4ebc,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b16e60e..78a323c 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x218497,_0x279042){var _0x23ecfa=function(_0x6f1f16){while(--_0x6f1f16){_0x218497['push'](_0x218497['shift']());}};_0x23ecfa(++_0x279042);}(_0x1261,0x144));var _0x1126=function(_0x460fd9,_0x4b4b97){_0x460fd9=_0x460fd9-0x0;var _0x424e18=_0x1261[_0x460fd9];return _0x424e18;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xaa023e,_0x4f5d41){var _0x24a457=function(_0x44b3f4){while(--_0x44b3f4){_0xaa023e['push'](_0xaa023e['shift']());}};_0x24a457(++_0x4f5d41);}(_0xabce,0x103));var _0xeabc=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xabce[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f78ebae..1ef5342 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 _0xad2a=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug'];(function(_0xb02eed,_0x13d074){var _0x43455b=function(_0x2cdd32){while(--_0x2cdd32){_0xb02eed['push'](_0xb02eed['shift']());}};_0x43455b(++_0x13d074);}(_0xad2a,0x146));var _0xaad2=function(_0x4f6839,_0xfa1d6b){_0x4f6839=_0x4f6839-0x0;var _0x2ac85a=_0xad2a[_0x4f6839];return _0x2ac85a;};'use strict';var _=require('lodash');var util=require(_0xaad2('0x0'));var moment=require('moment');var BPromise=require(_0xaad2('0x1'));var rs=require(_0xaad2('0x2'));var fs=require('fs');var Redis=require(_0xaad2('0x3'));var db=require(_0xaad2('0x4'))['db'];var utils=require(_0xaad2('0x5'));var logger=require(_0xaad2('0x6'))('rpc');var config=require(_0xaad2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaad2('0x8')][_0xaad2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbccb96,_0x8d7d33,_0x258000){return new BPromise(function(_0xd0d9ee,_0x9619f1){return client[_0xaad2('0xa')](_0xbccb96,_0x258000)[_0xaad2('0xb')](function(_0x2eae79){logger[_0xaad2('0xc')](_0xaad2('0xd'),_0x8d7d33,'request\x20sent');logger[_0xaad2('0xe')](_0xaad2('0xf'),_0x8d7d33,'request\x20sent',JSON[_0xaad2('0x10')](_0x2eae79));if(_0x2eae79['error']){if(_0x2eae79[_0xaad2('0x11')][_0xaad2('0x12')]===0x1f4){logger[_0xaad2('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x8d7d33,_0x2eae79[_0xaad2('0x11')][_0xaad2('0x13')]);return _0x9619f1(_0x2eae79[_0xaad2('0x11')][_0xaad2('0x13')]);}logger[_0xaad2('0x11')](_0xaad2('0xd'),_0x8d7d33,_0x2eae79['error']['message']);return _0xd0d9ee(_0x2eae79[_0xaad2('0x11')][_0xaad2('0x13')]);}else{logger['info'](_0xaad2('0xd'),_0x8d7d33,_0xaad2('0x14'));_0xd0d9ee(_0x2eae79['result'][_0xaad2('0x13')]);}})[_0xaad2('0x15')](function(_0x5dee03){logger[_0xaad2('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x8d7d33,_0x5dee03);_0x9619f1(_0x5dee03);});});}exports[_0xaad2('0x16')]=function(_0x105765){var _0x169913=this;return new Promise(function(_0x2b2614,_0x194ddd){return db[_0xaad2('0x17')]['create'](_0x105765['body'],{'raw':_0x105765[_0xaad2('0x18')]?_0x105765[_0xaad2('0x18')][_0xaad2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5edfb1){logger[_0xaad2('0xc')](_0xaad2('0x16'),_0x105765);logger[_0xaad2('0xe')](_0xaad2('0x16'),_0x105765,JSON['stringify'](_0x5edfb1));_0x2b2614(_0x5edfb1);})[_0xaad2('0x15')](function(_0x2cc475){logger[_0xaad2('0x11')](_0xaad2('0x16'),_0x2cc475[_0xaad2('0x13')],_0x105765);_0x194ddd(_0x169913[_0xaad2('0x11')](0x1f4,_0x2cc475[_0xaad2('0x13')]));});});};exports[_0xaad2('0x1a')]=function(_0x5a1fe2){var _0x2d71f6=this;return new Promise(function(_0x4e3f7b,_0x35937b){return db[_0xaad2('0x17')][_0xaad2('0x1b')](_0x5a1fe2['body'],{'raw':_0x5a1fe2[_0xaad2('0x18')]?_0x5a1fe2[_0xaad2('0x18')][_0xaad2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a1fe2[_0xaad2('0x18')]?_0x5a1fe2[_0xaad2('0x18')][_0xaad2('0x1c')]||null:null,'attributes':_0x5a1fe2[_0xaad2('0x18')]?_0x5a1fe2[_0xaad2('0x18')][_0xaad2('0x1d')]||null:null,'limit':_0x5a1fe2['options']?_0x5a1fe2['options'][_0xaad2('0x1e')]||null:null})[_0xaad2('0xb')](function(_0x15b99b){logger[_0xaad2('0xc')](_0xaad2('0x1a'),_0x5a1fe2);logger[_0xaad2('0xe')](_0xaad2('0x1a'),_0x5a1fe2,JSON[_0xaad2('0x10')](_0x15b99b));_0x4e3f7b(_0x15b99b);})[_0xaad2('0x15')](function(_0x5e93a6){logger[_0xaad2('0x11')](_0xaad2('0x1a'),_0x5e93a6[_0xaad2('0x13')],_0x5a1fe2);_0x35937b(_0x2d71f6['error'](0x1f4,_0x5e93a6[_0xaad2('0x13')]));});});}; \ No newline at end of file +var _0x67c0=['client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3914e8,_0x577306){var _0x265a47=function(_0x1f883a){while(--_0x1f883a){_0x3914e8['push'](_0x3914e8['shift']());}};_0x265a47(++_0x577306);}(_0x67c0,0x117));var _0x067c=function(_0x49745e,_0x34ff8b){_0x49745e=_0x49745e-0x0;var _0x42dcd2=_0x67c0[_0x49745e];return _0x42dcd2;};'use strict';var _=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var moment=require('moment');var BPromise=require(_0x067c('0x2'));var rs=require(_0x067c('0x3'));var fs=require('fs');var Redis=require(_0x067c('0x4'));var db=require(_0x067c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x067c('0x6'))('rpc');var config=require(_0x067c('0x7'));var jayson=require(_0x067c('0x8'));var client=jayson[_0x067c('0x9')][_0x067c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d147d,_0x16d8fd,_0x1c7a7d){return new BPromise(function(_0x1baea2,_0x59d9a6){return client[_0x067c('0xb')](_0x2d147d,_0x1c7a7d)[_0x067c('0xc')](function(_0x4d2078){logger[_0x067c('0xd')](_0x067c('0xe'),_0x16d8fd,'request\x20sent');logger[_0x067c('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x16d8fd,_0x067c('0x10'),JSON[_0x067c('0x11')](_0x4d2078));if(_0x4d2078['error']){if(_0x4d2078[_0x067c('0x12')]['code']===0x1f4){logger[_0x067c('0x12')](_0x067c('0xe'),_0x16d8fd,_0x4d2078[_0x067c('0x12')]['message']);return _0x59d9a6(_0x4d2078[_0x067c('0x12')]['message']);}logger[_0x067c('0x12')](_0x067c('0xe'),_0x16d8fd,_0x4d2078['error'][_0x067c('0x13')]);return _0x1baea2(_0x4d2078['error']['message']);}else{logger[_0x067c('0xd')](_0x067c('0xe'),_0x16d8fd,'request\x20sent');_0x1baea2(_0x4d2078[_0x067c('0x14')][_0x067c('0x13')]);}})[_0x067c('0x15')](function(_0x27f2e1){logger['error'](_0x067c('0xe'),_0x16d8fd,_0x27f2e1);_0x59d9a6(_0x27f2e1);});});}exports['CreateFaxQueueReport']=function(_0x4ead52){var _0x59d29f=this;return new Promise(function(_0x292070,_0x57e72b){return db[_0x067c('0x16')][_0x067c('0x17')](_0x4ead52[_0x067c('0x18')],{'raw':_0x4ead52[_0x067c('0x19')]?_0x4ead52[_0x067c('0x19')][_0x067c('0x1a')]===undefined?!![]:![]:!![]})[_0x067c('0xc')](function(_0x1bd9b9){logger[_0x067c('0xd')](_0x067c('0x1b'),_0x4ead52);logger['debug'](_0x067c('0x1b'),_0x4ead52,JSON[_0x067c('0x11')](_0x1bd9b9));_0x292070(_0x1bd9b9);})['catch'](function(_0x3b7fc6){logger['error'](_0x067c('0x1b'),_0x3b7fc6[_0x067c('0x13')],_0x4ead52);_0x57e72b(_0x59d29f[_0x067c('0x12')](0x1f4,_0x3b7fc6[_0x067c('0x13')]));});});};exports[_0x067c('0x1c')]=function(_0x2435d1){var _0x22e7d2=this;return new Promise(function(_0x34e8bd,_0x5a674a){return db[_0x067c('0x16')][_0x067c('0x1d')](_0x2435d1['body'],{'raw':_0x2435d1['options']?_0x2435d1[_0x067c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2435d1[_0x067c('0x19')]?_0x2435d1[_0x067c('0x19')]['where']||null:null,'attributes':_0x2435d1[_0x067c('0x19')]?_0x2435d1[_0x067c('0x19')][_0x067c('0x1e')]||null:null,'limit':_0x2435d1[_0x067c('0x19')]?_0x2435d1['options'][_0x067c('0x1f')]||null:null})[_0x067c('0xc')](function(_0x3e9776){logger['info'](_0x067c('0x1c'),_0x2435d1);logger[_0x067c('0xf')](_0x067c('0x1c'),_0x2435d1,JSON['stringify'](_0x3e9776));_0x34e8bd(_0x3e9776);})[_0x067c('0x15')](function(_0x26a455){logger[_0x067c('0x12')](_0x067c('0x1c'),_0x26a455[_0x067c('0x13')],_0x2435d1);_0x5a674a(_0x22e7d2['error'](0x1f4,_0x26a455['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index dd2c8fd..bcd559c 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 _0x8e3e=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2fe108,_0x2995fd){var _0x4439c5=function(_0x2ef8ec){while(--_0x2ef8ec){_0x2fe108['push'](_0x2fe108['shift']());}};_0x4439c5(++_0x2995fd);}(_0x8e3e,0x65));var _0xe8e3=function(_0x270359,_0x328df8){_0x270359=_0x270359-0x0;var _0x1b34d0=_0x8e3e[_0x270359];return _0x1b34d0;};'use strict';var multer=require(_0xe8e3('0x0'));var util=require(_0xe8e3('0x1'));var path=require('path');var timeout=require(_0xe8e3('0x2'));var express=require(_0xe8e3('0x3'));var router=express[_0xe8e3('0x4')]();var fs_extra=require(_0xe8e3('0x5'));var auth=require(_0xe8e3('0x6'));var interaction=require(_0xe8e3('0x7'));var config=require(_0xe8e3('0x8'));var controller=require(_0xe8e3('0x9'));router[_0xe8e3('0xa')]('/',auth[_0xe8e3('0xb')](),controller[_0xe8e3('0xc')]);router[_0xe8e3('0xa')](_0xe8e3('0xd'),auth[_0xe8e3('0xb')](),controller['describe']);router[_0xe8e3('0xa')](_0xe8e3('0xe'),auth['isAuthenticated'](),controller[_0xe8e3('0xf')]);router[_0xe8e3('0x10')]('/',auth[_0xe8e3('0xb')](),controller[_0xe8e3('0x11')]);router[_0xe8e3('0x12')](_0xe8e3('0xe'),auth['isAuthenticated'](),controller[_0xe8e3('0x13')]);router[_0xe8e3('0x14')]('/:id',auth[_0xe8e3('0xb')](),controller[_0xe8e3('0x15')]);module[_0xe8e3('0x16')]=router; \ No newline at end of file +var _0x3a4e=['update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3a4e,0xdf));var _0xe3a4=function(_0x105878,_0x7eb9c6){_0x105878=_0x105878-0x0;var _0x202398=_0x3a4e[_0x105878];return _0x202398;};'use strict';var multer=require(_0xe3a4('0x0'));var util=require(_0xe3a4('0x1'));var path=require(_0xe3a4('0x2'));var timeout=require(_0xe3a4('0x3'));var express=require('express');var router=express[_0xe3a4('0x4')]();var fs_extra=require(_0xe3a4('0x5'));var auth=require(_0xe3a4('0x6'));var interaction=require(_0xe3a4('0x7'));var config=require('../../config/environment');var controller=require(_0xe3a4('0x8'));router[_0xe3a4('0x9')]('/',auth[_0xe3a4('0xa')](),controller[_0xe3a4('0xb')]);router[_0xe3a4('0x9')](_0xe3a4('0xc'),auth[_0xe3a4('0xa')](),controller[_0xe3a4('0xd')]);router[_0xe3a4('0x9')](_0xe3a4('0xe'),auth['isAuthenticated'](),controller[_0xe3a4('0xf')]);router[_0xe3a4('0x10')]('/',auth['isAuthenticated'](),controller[_0xe3a4('0x11')]);router[_0xe3a4('0x12')](_0xe3a4('0xe'),auth[_0xe3a4('0xa')](),controller[_0xe3a4('0x13')]);router[_0xe3a4('0x14')](_0xe3a4('0xe'),auth['isAuthenticated'](),controller[_0xe3a4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 461627e..fe7bf60 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x460032,_0x1e8180){_0x460032=_0x460032-0x0;var _0x42d238=_0xb43b[_0x460032];return _0x42d238;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5220c2,_0x141f7b){var _0x5ab074=function(_0x1043da){while(--_0x1043da){_0x5220c2['push'](_0x5220c2['shift']());}};_0x5ab074(++_0x141f7b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f78e1fa..f2126d0 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 _0xc259=['destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','error','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0xc259,0xe3));var _0x9c25=function(_0x5267be,_0x2430af){_0x5267be=_0x5267be-0x0;var _0x4d98a1=_0xc259[_0x5267be];return _0x4d98a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c25('0x0'));var jsonpatch=require(_0x9c25('0x1'));var rp=require(_0x9c25('0x2'));var moment=require(_0x9c25('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c25('0x4'));var util=require('util');var path=require(_0x9c25('0x5'));var sox=require(_0x9c25('0x6'));var csv=require('to-csv');var ejs=require(_0x9c25('0x7'));var fs=require('fs');var fs_extra=require(_0x9c25('0x8'));var _=require(_0x9c25('0x9'));var squel=require(_0x9c25('0xa'));var crypto=require(_0x9c25('0xb'));var jsforce=require(_0x9c25('0xc'));var deskjs=require(_0x9c25('0xd'));var toCsv=require(_0x9c25('0xe'));var querystring=require(_0x9c25('0xf'));var Papa=require(_0x9c25('0x10'));var Redis=require(_0x9c25('0x11'));var authService=require(_0x9c25('0x12'));var qs=require(_0x9c25('0x13'));var as=require(_0x9c25('0x14'));var hardwareService=require(_0x9c25('0x15'));var logger=require(_0x9c25('0x16'))(_0x9c25('0x17'));var utils=require(_0x9c25('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9c25('0x19'));var db=require(_0x9c25('0x1a'))['db'];function respondWithStatusCode(_0x2dd376,_0x39e801){_0x39e801=_0x39e801||0xcc;return function(_0x467a19){if(_0x467a19){return _0x2dd376['sendStatus'](_0x39e801);}return _0x2dd376['status'](_0x39e801)['end']();};}function respondWithResult(_0x506ff4,_0x5425d1){_0x5425d1=_0x5425d1||0xc8;return function(_0x34196e){if(_0x34196e){return _0x506ff4[_0x9c25('0x1b')](_0x5425d1)['json'](_0x34196e);}};}function respondWithFilteredResult(_0x5bf60b,_0x16276b){return function(_0x83539c){if(_0x83539c){var _0x26f4f3=typeof _0x16276b[_0x9c25('0x1c')]===_0x9c25('0x1d')&&typeof _0x16276b[_0x9c25('0x1e')]===_0x9c25('0x1d');var _0x588e01=_0x83539c['count'];var _0x381a4e=_0x26f4f3?0x0:_0x16276b['offset'];var _0x3cfcf2=_0x26f4f3?_0x83539c[_0x9c25('0x1f')]:_0x16276b['offset']+_0x16276b[_0x9c25('0x1e')];var _0x346a43;if(_0x3cfcf2>=_0x588e01){_0x3cfcf2=_0x588e01;_0x346a43=0xc8;}else{_0x346a43=0xce;}_0x5bf60b[_0x9c25('0x1b')](_0x346a43);return _0x5bf60b[_0x9c25('0x20')](_0x9c25('0x21'),_0x381a4e+'-'+_0x3cfcf2+'/'+_0x588e01)[_0x9c25('0x22')](_0x83539c);}return null;};}function patchUpdates(_0x4743d0){return function(_0x39bf85){try{jsonpatch[_0x9c25('0x23')](_0x39bf85,_0x4743d0,!![]);}catch(_0x4cff81){return BPromise['reject'](_0x4cff81);}return _0x39bf85['save']();};}function saveUpdates(_0xb29825,_0x5598d4){return function(_0x32efb8){if(_0x32efb8){return _0x32efb8['update'](_0xb29825)[_0x9c25('0x24')](function(_0x34fbf7){return _0x34fbf7;});}return null;};}function removeEntity(_0x51b9d7,_0x40cf70){return function(_0x113ebb){if(_0x113ebb){return _0x113ebb['destroy']()['then'](function(){_0x51b9d7[_0x9c25('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa186f1,_0x445db0){return function(_0x5ef11d){if(!_0x5ef11d){_0xa186f1['sendStatus'](0x194);}return _0x5ef11d;};}function handleError(_0x563b7a,_0x1b77eb){_0x1b77eb=_0x1b77eb||0x1f4;return function(_0x2fab72){logger[_0x9c25('0x25')](_0x2fab72['stack']);if(_0x2fab72[_0x9c25('0x26')]){delete _0x2fab72[_0x9c25('0x26')];}_0x563b7a[_0x9c25('0x1b')](_0x1b77eb)[_0x9c25('0x27')](_0x2fab72);};}exports['index']=function(_0xf8cacb,_0x5eb959){var _0x2a2107={},_0x177d37={},_0x45f0a0={'count':0x0,'rows':[]};var _0x3235fa=_[_0x9c25('0x28')](db[_0x9c25('0x29')][_0x9c25('0x2a')],function(_0x3d72e4){return{'name':_0x3d72e4[_0x9c25('0x2b')],'type':_0x3d72e4[_0x9c25('0x2c')][_0x9c25('0x2d')]};});_0x177d37[_0x9c25('0x2e')]=_[_0x9c25('0x28')](_0x3235fa,_0x9c25('0x26'));_0x177d37['query']=_[_0x9c25('0x2f')](_0xf8cacb['query']);_0x177d37[_0x9c25('0x30')]=_[_0x9c25('0x31')](_0x177d37[_0x9c25('0x2e')],_0x177d37[_0x9c25('0x32')]);_0x2a2107[_0x9c25('0x33')]=_[_0x9c25('0x31')](_0x177d37[_0x9c25('0x2e')],qs[_0x9c25('0x34')](_0xf8cacb['query'][_0x9c25('0x34')]));_0x2a2107[_0x9c25('0x33')]=_0x2a2107[_0x9c25('0x33')]['length']?_0x2a2107[_0x9c25('0x33')]:_0x177d37[_0x9c25('0x2e')];if(!_0xf8cacb[_0x9c25('0x32')][_0x9c25('0x35')](_0x9c25('0x36'))){_0x2a2107['limit']=qs[_0x9c25('0x1e')](_0xf8cacb[_0x9c25('0x32')][_0x9c25('0x1e')]);_0x2a2107[_0x9c25('0x1c')]=qs[_0x9c25('0x1c')](_0xf8cacb[_0x9c25('0x32')][_0x9c25('0x1c')]);}_0x2a2107[_0x9c25('0x37')]=qs['sort'](_0xf8cacb['query'][_0x9c25('0x38')]);_0x2a2107[_0x9c25('0x39')]=qs[_0x9c25('0x30')](_['pick'](_0xf8cacb[_0x9c25('0x32')],_0x177d37[_0x9c25('0x30')]),_0x3235fa);if(_0xf8cacb[_0x9c25('0x32')]['filter']){_0x2a2107[_0x9c25('0x39')]=_[_0x9c25('0x3a')](_0x2a2107[_0x9c25('0x39')],{'$or':_[_0x9c25('0x28')](_0x3235fa,function(_0x1138a6){if(_0x1138a6[_0x9c25('0x2c')]!==_0x9c25('0x3b')){var _0x35ed49={};_0x35ed49[_0x1138a6[_0x9c25('0x26')]]={'$like':'%'+_0xf8cacb[_0x9c25('0x32')]['filter']+'%'};return _0x35ed49;}})});}_0x2a2107=_[_0x9c25('0x3a')]({},_0x2a2107,_0xf8cacb[_0x9c25('0x3c')]);var _0x166acc={'where':_0x2a2107[_0x9c25('0x39')]};return db[_0x9c25('0x29')][_0x9c25('0x1f')](_0x166acc)['then'](function(_0x1c84db){_0x45f0a0[_0x9c25('0x1f')]=_0x1c84db;if(_0xf8cacb[_0x9c25('0x32')][_0x9c25('0x3d')]){_0x2a2107[_0x9c25('0x3e')]=[{'all':!![]}];}return db[_0x9c25('0x29')][_0x9c25('0x3f')](_0x2a2107);})[_0x9c25('0x24')](function(_0x3fb730){_0x45f0a0[_0x9c25('0x40')]=_0x3fb730;return _0x45f0a0;})[_0x9c25('0x24')](respondWithFilteredResult(_0x5eb959,_0x2a2107))[_0x9c25('0x41')](handleError(_0x5eb959,null));};exports[_0x9c25('0x42')]=function(_0x4aebd9,_0x15d907){var _0x43805e={'raw':!![],'where':{'id':_0x4aebd9[_0x9c25('0x43')]['id']}},_0x2548e1={};_0x2548e1[_0x9c25('0x2e')]=_[_0x9c25('0x2f')](db[_0x9c25('0x29')]['rawAttributes']);_0x2548e1[_0x9c25('0x32')]=_[_0x9c25('0x2f')](_0x4aebd9[_0x9c25('0x32')]);_0x2548e1[_0x9c25('0x30')]=_[_0x9c25('0x31')](_0x2548e1['model'],_0x2548e1[_0x9c25('0x32')]);_0x43805e['attributes']=_[_0x9c25('0x31')](_0x2548e1[_0x9c25('0x2e')],qs[_0x9c25('0x34')](_0x4aebd9[_0x9c25('0x32')][_0x9c25('0x34')]));_0x43805e['attributes']=_0x43805e[_0x9c25('0x33')][_0x9c25('0x44')]?_0x43805e[_0x9c25('0x33')]:_0x2548e1[_0x9c25('0x2e')];if(_0x4aebd9['query']['includeAll']){_0x43805e['include']=[{'all':!![]}];}_0x43805e=_[_0x9c25('0x3a')]({},_0x43805e,_0x4aebd9[_0x9c25('0x3c')]);return db[_0x9c25('0x29')][_0x9c25('0x45')](_0x43805e)[_0x9c25('0x24')](handleEntityNotFound(_0x15d907,null))[_0x9c25('0x24')](respondWithResult(_0x15d907,null))[_0x9c25('0x41')](handleError(_0x15d907,null));};exports['create']=function(_0x2ead7e,_0x26c57a){return db[_0x9c25('0x29')][_0x9c25('0x46')](_0x2ead7e['body'],{})[_0x9c25('0x24')](respondWithResult(_0x26c57a,0xc9))[_0x9c25('0x41')](handleError(_0x26c57a,null));};exports[_0x9c25('0x47')]=function(_0x15da55,_0x526cff){if(_0x15da55['body']['id']){delete _0x15da55['body']['id'];}return db['FaxTransferReport'][_0x9c25('0x45')]({'where':{'id':_0x15da55[_0x9c25('0x43')]['id']}})[_0x9c25('0x24')](handleEntityNotFound(_0x526cff,null))[_0x9c25('0x24')](saveUpdates(_0x15da55[_0x9c25('0x48')],null))['then'](respondWithResult(_0x526cff,null))[_0x9c25('0x41')](handleError(_0x526cff,null));};exports[_0x9c25('0x49')]=function(_0x31ec20,_0x3a38a2){return db[_0x9c25('0x29')][_0x9c25('0x45')]({'where':{'id':_0x31ec20[_0x9c25('0x43')]['id']}})[_0x9c25('0x24')](handleEntityNotFound(_0x3a38a2,null))['then'](removeEntity(_0x3a38a2,null))[_0x9c25('0x41')](handleError(_0x3a38a2,null));};exports[_0x9c25('0x4a')]=function(_0xba4b2e,_0x45ed16){return db[_0x9c25('0x29')][_0x9c25('0x4a')]()[_0x9c25('0x24')](respondWithResult(_0x45ed16,null))['catch'](handleError(_0x45ed16,null));}; \ No newline at end of file +var _0x8639=['path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','sendStatus','name','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8639,0x8b));var _0x9863=function(_0x18a6a2,_0x1bf4a0){_0x18a6a2=_0x18a6a2-0x0;var _0x1cee6f=_0x8639[_0x18a6a2];return _0x1cee6f;};'use strict';var emlformat=require(_0x9863('0x0'));var rimraf=require(_0x9863('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9863('0x2'));var rp=require(_0x9863('0x3'));var moment=require(_0x9863('0x4'));var BPromise=require(_0x9863('0x5'));var Mustache=require('mustache');var util=require(_0x9863('0x6'));var path=require(_0x9863('0x7'));var sox=require(_0x9863('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9863('0x9'));var _=require('lodash');var squel=require(_0x9863('0xa'));var crypto=require('crypto');var jsforce=require(_0x9863('0xb'));var deskjs=require(_0x9863('0xc'));var toCsv=require(_0x9863('0xd'));var querystring=require(_0x9863('0xe'));var Papa=require(_0x9863('0xf'));var Redis=require(_0x9863('0x10'));var authService=require(_0x9863('0x11'));var qs=require(_0x9863('0x12'));var as=require(_0x9863('0x13'));var hardwareService=require(_0x9863('0x14'));var logger=require(_0x9863('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9863('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9863('0x17'))['db'];function respondWithStatusCode(_0x1bb132,_0x10b443){_0x10b443=_0x10b443||0xcc;return function(_0x14d60d){if(_0x14d60d){return _0x1bb132['sendStatus'](_0x10b443);}return _0x1bb132[_0x9863('0x18')](_0x10b443)['end']();};}function respondWithResult(_0x537195,_0x1a9c6e){_0x1a9c6e=_0x1a9c6e||0xc8;return function(_0x142b66){if(_0x142b66){return _0x537195['status'](_0x1a9c6e)[_0x9863('0x19')](_0x142b66);}};}function respondWithFilteredResult(_0x57ae39,_0x47cc4c){return function(_0xc93c22){if(_0xc93c22){var _0x4660e7=typeof _0x47cc4c[_0x9863('0x1a')]===_0x9863('0x1b')&&typeof _0x47cc4c[_0x9863('0x1c')]===_0x9863('0x1b');var _0x5b9a9d=_0xc93c22[_0x9863('0x1d')];var _0x389c72=_0x4660e7?0x0:_0x47cc4c['offset'];var _0x204561=_0x4660e7?_0xc93c22[_0x9863('0x1d')]:_0x47cc4c['offset']+_0x47cc4c['limit'];var _0x1aba9d;if(_0x204561>=_0x5b9a9d){_0x204561=_0x5b9a9d;_0x1aba9d=0xc8;}else{_0x1aba9d=0xce;}_0x57ae39['status'](_0x1aba9d);return _0x57ae39[_0x9863('0x1e')]('Content-Range',_0x389c72+'-'+_0x204561+'/'+_0x5b9a9d)['json'](_0xc93c22);}return null;};}function patchUpdates(_0x14e339){return function(_0x241305){try{jsonpatch[_0x9863('0x1f')](_0x241305,_0x14e339,!![]);}catch(_0x21d00e){return BPromise['reject'](_0x21d00e);}return _0x241305[_0x9863('0x20')]();};}function saveUpdates(_0x33ccc5,_0x167b80){return function(_0x1ccc5e){if(_0x1ccc5e){return _0x1ccc5e[_0x9863('0x21')](_0x33ccc5)[_0x9863('0x22')](function(_0xdc9e64){return _0xdc9e64;});}return null;};}function removeEntity(_0xa13c9c,_0x387aa9){return function(_0x472d0e){if(_0x472d0e){return _0x472d0e[_0x9863('0x23')]()['then'](function(){_0xa13c9c[_0x9863('0x18')](0xcc)[_0x9863('0x24')]();});}};}function handleEntityNotFound(_0x413ef9,_0x163c7b){return function(_0x479397){if(!_0x479397){_0x413ef9[_0x9863('0x25')](0x194);}return _0x479397;};}function handleError(_0x41a8b0,_0x4584b6){_0x4584b6=_0x4584b6||0x1f4;return function(_0x1a635c){logger['error'](_0x1a635c['stack']);if(_0x1a635c['name']){delete _0x1a635c[_0x9863('0x26')];}_0x41a8b0[_0x9863('0x18')](_0x4584b6)['send'](_0x1a635c);};}exports['index']=function(_0x241a4f,_0x309350){var _0x3790b7={},_0xf03c15={},_0x26fc0a={'count':0x0,'rows':[]};var _0x42af85=_[_0x9863('0x27')](db[_0x9863('0x28')][_0x9863('0x29')],function(_0x376303){return{'name':_0x376303[_0x9863('0x2a')],'type':_0x376303[_0x9863('0x2b')][_0x9863('0x2c')]};});_0xf03c15[_0x9863('0x2d')]=_['map'](_0x42af85,_0x9863('0x26'));_0xf03c15['query']=_['keys'](_0x241a4f[_0x9863('0x2e')]);_0xf03c15[_0x9863('0x2f')]=_[_0x9863('0x30')](_0xf03c15['model'],_0xf03c15['query']);_0x3790b7[_0x9863('0x31')]=_[_0x9863('0x30')](_0xf03c15[_0x9863('0x2d')],qs[_0x9863('0x32')](_0x241a4f[_0x9863('0x2e')]['fields']));_0x3790b7['attributes']=_0x3790b7[_0x9863('0x31')]['length']?_0x3790b7[_0x9863('0x31')]:_0xf03c15[_0x9863('0x2d')];if(!_0x241a4f[_0x9863('0x2e')][_0x9863('0x33')](_0x9863('0x34'))){_0x3790b7[_0x9863('0x1c')]=qs['limit'](_0x241a4f[_0x9863('0x2e')][_0x9863('0x1c')]);_0x3790b7[_0x9863('0x1a')]=qs[_0x9863('0x1a')](_0x241a4f[_0x9863('0x2e')][_0x9863('0x1a')]);}_0x3790b7[_0x9863('0x35')]=qs['sort'](_0x241a4f[_0x9863('0x2e')][_0x9863('0x36')]);_0x3790b7['where']=qs['filters'](_[_0x9863('0x37')](_0x241a4f[_0x9863('0x2e')],_0xf03c15['filters']),_0x42af85);if(_0x241a4f[_0x9863('0x2e')]['filter']){_0x3790b7['where']=_[_0x9863('0x38')](_0x3790b7[_0x9863('0x39')],{'$or':_[_0x9863('0x27')](_0x42af85,function(_0x2d3389){if(_0x2d3389[_0x9863('0x2b')]!==_0x9863('0x3a')){var _0x4885ff={};_0x4885ff[_0x2d3389[_0x9863('0x26')]]={'$like':'%'+_0x241a4f['query'][_0x9863('0x3b')]+'%'};return _0x4885ff;}})});}_0x3790b7=_['merge']({},_0x3790b7,_0x241a4f[_0x9863('0x3c')]);var _0xd6bd2e={'where':_0x3790b7[_0x9863('0x39')]};return db[_0x9863('0x28')]['count'](_0xd6bd2e)[_0x9863('0x22')](function(_0xce7662){_0x26fc0a['count']=_0xce7662;if(_0x241a4f[_0x9863('0x2e')][_0x9863('0x3d')]){_0x3790b7[_0x9863('0x3e')]=[{'all':!![]}];}return db[_0x9863('0x28')][_0x9863('0x3f')](_0x3790b7);})[_0x9863('0x22')](function(_0xe60398){_0x26fc0a[_0x9863('0x40')]=_0xe60398;return _0x26fc0a;})['then'](respondWithFilteredResult(_0x309350,_0x3790b7))[_0x9863('0x41')](handleError(_0x309350,null));};exports['show']=function(_0x2dba6d,_0x3ccb16){var _0x29fa37={'raw':!![],'where':{'id':_0x2dba6d[_0x9863('0x42')]['id']}},_0xf208da={};_0xf208da[_0x9863('0x2d')]=_[_0x9863('0x43')](db['FaxTransferReport'][_0x9863('0x29')]);_0xf208da[_0x9863('0x2e')]=_[_0x9863('0x43')](_0x2dba6d[_0x9863('0x2e')]);_0xf208da['filters']=_[_0x9863('0x30')](_0xf208da[_0x9863('0x2d')],_0xf208da[_0x9863('0x2e')]);_0x29fa37[_0x9863('0x31')]=_[_0x9863('0x30')](_0xf208da[_0x9863('0x2d')],qs[_0x9863('0x32')](_0x2dba6d[_0x9863('0x2e')]['fields']));_0x29fa37['attributes']=_0x29fa37[_0x9863('0x31')][_0x9863('0x44')]?_0x29fa37[_0x9863('0x31')]:_0xf208da[_0x9863('0x2d')];if(_0x2dba6d['query'][_0x9863('0x3d')]){_0x29fa37['include']=[{'all':!![]}];}_0x29fa37=_[_0x9863('0x38')]({},_0x29fa37,_0x2dba6d['options']);return db['FaxTransferReport'][_0x9863('0x45')](_0x29fa37)[_0x9863('0x22')](handleEntityNotFound(_0x3ccb16,null))['then'](respondWithResult(_0x3ccb16,null))[_0x9863('0x41')](handleError(_0x3ccb16,null));};exports[_0x9863('0x46')]=function(_0x45545e,_0x581d31){return db[_0x9863('0x28')][_0x9863('0x46')](_0x45545e[_0x9863('0x47')],{})[_0x9863('0x22')](respondWithResult(_0x581d31,0xc9))[_0x9863('0x41')](handleError(_0x581d31,null));};exports[_0x9863('0x21')]=function(_0x27fece,_0x24abf1){if(_0x27fece[_0x9863('0x47')]['id']){delete _0x27fece['body']['id'];}return db['FaxTransferReport'][_0x9863('0x45')]({'where':{'id':_0x27fece['params']['id']}})['then'](handleEntityNotFound(_0x24abf1,null))['then'](saveUpdates(_0x27fece[_0x9863('0x47')],null))[_0x9863('0x22')](respondWithResult(_0x24abf1,null))[_0x9863('0x41')](handleError(_0x24abf1,null));};exports[_0x9863('0x23')]=function(_0x39f05c,_0x407c41){return db[_0x9863('0x28')][_0x9863('0x45')]({'where':{'id':_0x39f05c[_0x9863('0x42')]['id']}})[_0x9863('0x22')](handleEntityNotFound(_0x407c41,null))['then'](removeEntity(_0x407c41,null))[_0x9863('0x41')](handleError(_0x407c41,null));};exports['describe']=function(_0x300307,_0x2deafd){return db['FaxTransferReport'][_0x9863('0x48')]()[_0x9863('0x22')](respondWithResult(_0x2deafd,null))[_0x9863('0x41')](handleError(_0x2deafd,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4a29e7d..d872085 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 _0xa177=['exports','report_fax_transfer','uniqueid','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x3611b3,_0x5b1360){var _0x75b526=function(_0x15d56e){while(--_0x15d56e){_0x3611b3['push'](_0x3611b3['shift']());}};_0x75b526(++_0x5b1360);}(_0xa177,0x143));var _0x7a17=function(_0x475185,_0x358f95){_0x475185=_0x475185-0x0;var _0x376174=_0xa177[_0x475185];return _0x376174;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7a17('0x0'))('api');var moment=require(_0x7a17('0x1'));var BPromise=require(_0x7a17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a17('0x3'));var rimraf=require(_0x7a17('0x4'));var config=require(_0x7a17('0x5'));var attributes=require(_0x7a17('0x6'));module[_0x7a17('0x7')]=function(_0x35e3f9,_0x9ad53){return _0x35e3f9['define']('FaxTransferReport',attributes,{'tableName':_0x7a17('0x8'),'paranoid':![],'indexes':[{'name':_0x7a17('0x9'),'fields':[_0x7a17('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6588=['../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x4c003a,_0x8f6066){var _0x3ad101=function(_0x59cd81){while(--_0x59cd81){_0x4c003a['push'](_0x4c003a['shift']());}};_0x3ad101(++_0x8f6066);}(_0x6588,0xc1));var _0x8658=function(_0x817388,_0x58547f){_0x817388=_0x817388-0x0;var _0x12d106=_0x6588[_0x817388];return _0x12d106;};'use strict';var _=require(_0x8658('0x0'));var util=require('util');var logger=require(_0x8658('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8658('0x2'));var rp=require(_0x8658('0x3'));var fs=require('fs');var path=require(_0x8658('0x4'));var rimraf=require('rimraf');var config=require(_0x8658('0x5'));var attributes=require(_0x8658('0x6'));module[_0x8658('0x7')]=function(_0x5b69b4,_0xfa3bbf){return _0x5b69b4[_0x8658('0x8')]('FaxTransferReport',attributes,{'tableName':_0x8658('0x9'),'paranoid':![],'indexes':[{'name':_0x8658('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5d30af0..48121f8 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 _0x7248=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5bd482,_0x574852){var _0x3bdbbc=function(_0x42fa16){while(--_0x42fa16){_0x5bd482['push'](_0x5bd482['shift']());}};_0x3bdbbc(++_0x574852);}(_0x7248,0x1f4));var _0x8724=function(_0x5dbaa7,_0x1f6d4a){_0x5dbaa7=_0x5dbaa7-0x0;var _0x481319=_0x7248[_0x5dbaa7];return _0x481319;};'use strict';var _=require('lodash');var util=require(_0x8724('0x0'));var moment=require(_0x8724('0x1'));var BPromise=require(_0x8724('0x2'));var rs=require(_0x8724('0x3'));var fs=require('fs');var Redis=require(_0x8724('0x4'));var db=require(_0x8724('0x5'))['db'];var utils=require(_0x8724('0x6'));var logger=require(_0x8724('0x7'))(_0x8724('0x8'));var config=require(_0x8724('0x9'));var jayson=require(_0x8724('0xa'));var client=jayson[_0x8724('0xb')][_0x8724('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd7bea6,_0x4a5530,_0x501aba){return new BPromise(function(_0x5c7da0,_0x55b415){return client[_0x8724('0xd')](_0xd7bea6,_0x501aba)[_0x8724('0xe')](function(_0x1b3fc0){logger[_0x8724('0xf')](_0x8724('0x10'),_0x4a5530,_0x8724('0x11'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4a5530,_0x8724('0x11'),JSON[_0x8724('0x12')](_0x1b3fc0));if(_0x1b3fc0[_0x8724('0x13')]){if(_0x1b3fc0['error'][_0x8724('0x14')]===0x1f4){logger[_0x8724('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x4a5530,_0x1b3fc0['error'][_0x8724('0x15')]);return _0x55b415(_0x1b3fc0[_0x8724('0x13')]['message']);}logger['error'](_0x8724('0x10'),_0x4a5530,_0x1b3fc0[_0x8724('0x13')]['message']);return _0x5c7da0(_0x1b3fc0[_0x8724('0x13')]['message']);}else{logger['info'](_0x8724('0x10'),_0x4a5530,_0x8724('0x11'));_0x5c7da0(_0x1b3fc0[_0x8724('0x16')][_0x8724('0x15')]);}})[_0x8724('0x17')](function(_0x50bccc){logger[_0x8724('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x4a5530,_0x50bccc);_0x55b415(_0x50bccc);});});} \ No newline at end of file +var _0x20cb=['http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7f98c9,_0x547197){var _0x24b672=function(_0x41ef7c){while(--_0x41ef7c){_0x7f98c9['push'](_0x7f98c9['shift']());}};_0x24b672(++_0x547197);}(_0x20cb,0x14b));var _0xb20c=function(_0x4895ff,_0x3c8a17){_0x4895ff=_0x4895ff-0x0;var _0x30acd6=_0x20cb[_0x4895ff];return _0x30acd6;};'use strict';var _=require(_0xb20c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb20c('0x1'));var fs=require('fs');var Redis=require(_0xb20c('0x2'));var db=require(_0xb20c('0x3'))['db'];var utils=require(_0xb20c('0x4'));var logger=require(_0xb20c('0x5'))(_0xb20c('0x6'));var config=require(_0xb20c('0x7'));var jayson=require(_0xb20c('0x8'));var client=jayson['client'][_0xb20c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd59ea5,_0x5984bd,_0xb66d09){return new BPromise(function(_0x4b48c8,_0x1c5d59){return client['request'](_0xd59ea5,_0xb66d09)[_0xb20c('0xa')](function(_0x5bcee3){logger[_0xb20c('0xb')](_0xb20c('0xc'),_0x5984bd,_0xb20c('0xd'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5984bd,_0xb20c('0xd'),JSON[_0xb20c('0xe')](_0x5bcee3));if(_0x5bcee3[_0xb20c('0xf')]){if(_0x5bcee3[_0xb20c('0xf')][_0xb20c('0x10')]===0x1f4){logger['error'](_0xb20c('0xc'),_0x5984bd,_0x5bcee3['error']['message']);return _0x1c5d59(_0x5bcee3['error'][_0xb20c('0x11')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5984bd,_0x5bcee3[_0xb20c('0xf')][_0xb20c('0x11')]);return _0x4b48c8(_0x5bcee3[_0xb20c('0xf')]['message']);}else{logger[_0xb20c('0xb')](_0xb20c('0xc'),_0x5984bd,_0xb20c('0xd'));_0x4b48c8(_0x5bcee3[_0xb20c('0x12')][_0xb20c('0x11')]);}})[_0xb20c('0x13')](function(_0x2a1d5f){logger['error'](_0xb20c('0xc'),_0x5984bd,_0x2a1d5f);_0x1c5d59(_0x2a1d5f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3d805c1..43b92cc 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 _0x7d77=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xffc88,_0x1016a6){var _0x4dbe55=function(_0x203641){while(--_0x203641){_0xffc88['push'](_0xffc88['shift']());}};_0x4dbe55(++_0x1016a6);}(_0x7d77,0x164));var _0x77d7=function(_0x5e4a6a,_0x287632){_0x5e4a6a=_0x5e4a6a-0x0;var _0xc8879f=_0x7d77[_0x5e4a6a];return _0xc8879f;};'use strict';var multer=require(_0x77d7('0x0'));var util=require(_0x77d7('0x1'));var path=require(_0x77d7('0x2'));var timeout=require(_0x77d7('0x3'));var express=require(_0x77d7('0x4'));var router=express[_0x77d7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x77d7('0x6'));var interaction=require(_0x77d7('0x7'));var config=require(_0x77d7('0x8'));var controller=require(_0x77d7('0x9'));router[_0x77d7('0xa')]('/',auth[_0x77d7('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x77d7('0xc')]);router['get'](_0x77d7('0xd'),auth[_0x77d7('0xb')](),controller[_0x77d7('0xe')]);router[_0x77d7('0xf')]('/',auth[_0x77d7('0xb')](),controller['create']);router[_0x77d7('0x10')]('/:id',auth[_0x77d7('0xb')](),controller[_0x77d7('0x11')]);router[_0x77d7('0x12')](_0x77d7('0xd'),auth[_0x77d7('0xb')](),controller[_0x77d7('0x13')]);module['exports']=router; \ No newline at end of file +var _0xca88=['../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x4b9023,_0x4592cc){var _0x502620=function(_0x30c21f){while(--_0x30c21f){_0x4b9023['push'](_0x4b9023['shift']());}};_0x502620(++_0x4592cc);}(_0xca88,0x80));var _0x8ca8=function(_0x345ff0,_0x4015e8){_0x345ff0=_0x345ff0-0x0;var _0x5cd417=_0xca88[_0x345ff0];return _0x5cd417;};'use strict';var multer=require(_0x8ca8('0x0'));var util=require('util');var path=require(_0x8ca8('0x1'));var timeout=require(_0x8ca8('0x2'));var express=require('express');var router=express[_0x8ca8('0x3')]();var fs_extra=require(_0x8ca8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ca8('0x5'));var controller=require(_0x8ca8('0x6'));router[_0x8ca8('0x7')]('/',auth['isAuthenticated'](),controller[_0x8ca8('0x8')]);router[_0x8ca8('0x7')](_0x8ca8('0x9'),auth[_0x8ca8('0xa')](),controller[_0x8ca8('0xb')]);router[_0x8ca8('0x7')]('/:id',auth[_0x8ca8('0xa')](),controller[_0x8ca8('0xc')]);router[_0x8ca8('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ca8('0xe')](_0x8ca8('0xf'),auth[_0x8ca8('0xa')](),controller[_0x8ca8('0x10')]);router[_0x8ca8('0x11')](_0x8ca8('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x8ca8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 07903f9..dc29967 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 _0x1f7f=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','/:id','update','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x1f7f,0x124));var _0xf1f7=function(_0x27f5de,_0x577080){_0x27f5de=_0x27f5de-0x0;var _0x484149=_0x1f7f[_0x27f5de];return _0x484149;};'use strict';var multer=require('multer');var util=require(_0xf1f7('0x0'));var path=require(_0xf1f7('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1f7('0x2'));var router=express[_0xf1f7('0x3')]();var fs_extra=require(_0xf1f7('0x4'));var auth=require(_0xf1f7('0x5'));var interaction=require(_0xf1f7('0x6'));var config=require(_0xf1f7('0x7'));var controller=require('./intDeskAccount.controller');router[_0xf1f7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf1f7('0x9')]);router[_0xf1f7('0x8')]('/:id',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xb')]);router[_0xf1f7('0x8')](_0xf1f7('0xc'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xd')]);router[_0xf1f7('0x8')](_0xf1f7('0xe'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xf')]);router[_0xf1f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf1f7('0x10')]('/:id/configurations',auth[_0xf1f7('0xa')](),controller['addConfiguration']);router['put'](_0xf1f7('0x11'),auth['isAuthenticated'](),controller[_0xf1f7('0x12')]);router['delete'](_0xf1f7('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb036=['/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','getConfigurations','/:id/fields','getFields'];(function(_0x2ca5d0,_0x35530d){var _0x15bdee=function(_0x1485c9){while(--_0x1485c9){_0x2ca5d0['push'](_0x2ca5d0['shift']());}};_0x15bdee(++_0x35530d);}(_0xb036,0x1d4));var _0x6b03=function(_0x32fe6f,_0x10fce7){_0x32fe6f=_0x32fe6f-0x0;var _0x48d273=_0xb036[_0x32fe6f];return _0x48d273;};'use strict';var multer=require(_0x6b03('0x0'));var util=require(_0x6b03('0x1'));var path=require('path');var timeout=require(_0x6b03('0x2'));var express=require('express');var router=express[_0x6b03('0x3')]();var fs_extra=require(_0x6b03('0x4'));var auth=require(_0x6b03('0x5'));var interaction=require(_0x6b03('0x6'));var config=require(_0x6b03('0x7'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6b03('0x8')]);router['get'](_0x6b03('0x9'),auth[_0x6b03('0xa')](),controller[_0x6b03('0xb')]);router[_0x6b03('0xc')]('/:id/configurations',auth[_0x6b03('0xa')](),controller[_0x6b03('0xd')]);router['get'](_0x6b03('0xe'),auth[_0x6b03('0xa')](),controller[_0x6b03('0xf')]);router['post']('/',auth[_0x6b03('0xa')](),controller['create']);router['post'](_0x6b03('0x10'),auth['isAuthenticated'](),controller[_0x6b03('0x11')]);router[_0x6b03('0x12')](_0x6b03('0x9'),auth[_0x6b03('0xa')](),controller[_0x6b03('0x13')]);router['delete'](_0x6b03('0x9'),auth[_0x6b03('0xa')](),controller[_0x6b03('0x14')]);module[_0x6b03('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ca15df6..95bf5cb 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 _0x938d=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x343f11,_0x2ce7ba){var _0x2dd00c=function(_0x355a4b){while(--_0x355a4b){_0x343f11['push'](_0x343f11['shift']());}};_0x2dd00c(++_0x2ce7ba);}(_0x938d,0x177));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize[_0xd938('0x2')]},'description':{'type':Sequelize[_0xd938('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd938('0x2')]},'authType':{'type':Sequelize[_0xd938('0x3')](_0xd938('0x4')),'defaultValue':_0xd938('0x4')},'password':{'type':Sequelize[_0xd938('0x2')]},'consumerKey':{'type':Sequelize[_0xd938('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd938('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd938('0x3')](_0xd938('0x5'),'newTab'),'defaultValue':_0xd938('0x5')}}; \ No newline at end of file +var _0x830d=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x2df19d,_0x3a689a){var _0x285df8=function(_0x1c8b1e){while(--_0x1c8b1e){_0x2df19d['push'](_0x2df19d['shift']());}};_0x285df8(++_0x3a689a);}(_0x830d,0x1ed));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd830('0x0'));module[_0xd830('0x1')]={'name':{'type':Sequelize[_0xd830('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xd830('0x3')]('basic'),'defaultValue':_0xd830('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xd830('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd830('0x2')]},'tokenSecret':{'type':Sequelize[_0xd830('0x2')]},'serverUrl':{'type':Sequelize[_0xd830('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd830('0x3')](_0xd830('0x5'),_0xd830('0x6')),'defaultValue':_0xd830('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 71f748f..53615be 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 _0xcb9f=['end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','keys','length','create','body','catch','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then'];(function(_0xae0abc,_0x36097a){var _0x5da8ee=function(_0x42f917){while(--_0x42f917){_0xae0abc['push'](_0xae0abc['shift']());}};_0x5da8ee(++_0x36097a);}(_0xcb9f,0x186));var _0xfcb9=function(_0x72b04f,_0x3d929f){_0x72b04f=_0x72b04f-0x0;var _0x159c87=_0xcb9f[_0x72b04f];return _0x159c87;};'use strict';var emlformat=require(_0xfcb9('0x0'));var rimraf=require(_0xfcb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcb9('0x2'));var rp=require(_0xfcb9('0x3'));var moment=require(_0xfcb9('0x4'));var BPromise=require(_0xfcb9('0x5'));var Mustache=require(_0xfcb9('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfcb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcb9('0x8'));var _=require(_0xfcb9('0x9'));var squel=require('squel');var crypto=require(_0xfcb9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfcb9('0xb'));var toCsv=require(_0xfcb9('0x7'));var querystring=require(_0xfcb9('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcb9('0xd'));var qs=require(_0xfcb9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcb9('0xf'));var logger=require(_0xfcb9('0x10'))('api');var utils=require(_0xfcb9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xfcb9('0x12'));var db=require(_0xfcb9('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2628fc,_0x51f180){_0x51f180=_0x51f180||0xcc;return function(_0x17fd34){if(_0x17fd34){return _0x2628fc[_0xfcb9('0x14')](_0x51f180);}return _0x2628fc[_0xfcb9('0x15')](_0x51f180)['end']();};}function respondWithResult(_0x505432,_0x324bd1){_0x324bd1=_0x324bd1||0xc8;return function(_0x2cb976){if(_0x2cb976){return _0x505432[_0xfcb9('0x15')](_0x324bd1)[_0xfcb9('0x16')](_0x2cb976);}};}function respondWithFilteredResult(_0x2697dc,_0x44eabb){return function(_0x18f76f){if(_0x18f76f){var _0x389a24=typeof _0x44eabb['offset']===_0xfcb9('0x17')&&typeof _0x44eabb[_0xfcb9('0x18')]===_0xfcb9('0x17');var _0x185279=_0x18f76f['count'];var _0x74e415=_0x389a24?0x0:_0x44eabb[_0xfcb9('0x19')];var _0x1793c4=_0x389a24?_0x18f76f[_0xfcb9('0x1a')]:_0x44eabb['offset']+_0x44eabb[_0xfcb9('0x18')];var _0xfaa41b;if(_0x1793c4>=_0x185279){_0x1793c4=_0x185279;_0xfaa41b=0xc8;}else{_0xfaa41b=0xce;}_0x2697dc[_0xfcb9('0x15')](_0xfaa41b);return _0x2697dc['set'](_0xfcb9('0x1b'),_0x74e415+'-'+_0x1793c4+'/'+_0x185279)[_0xfcb9('0x16')](_0x18f76f);}return null;};}function patchUpdates(_0x1c7adc){return function(_0x543cf9){try{jsonpatch[_0xfcb9('0x1c')](_0x543cf9,_0x1c7adc,!![]);}catch(_0x2e4bb3){return BPromise[_0xfcb9('0x1d')](_0x2e4bb3);}return _0x543cf9[_0xfcb9('0x1e')]();};}function saveUpdates(_0x12e390,_0x242960){return function(_0x1e7c6c){if(_0x1e7c6c){return _0x1e7c6c[_0xfcb9('0x1f')](_0x12e390)['then'](function(_0x1eb8c9){return _0x1eb8c9;});}return null;};}function removeEntity(_0x11e884,_0x52b3e0){return function(_0x5712ea){if(_0x5712ea){return _0x5712ea[_0xfcb9('0x20')]()[_0xfcb9('0x21')](function(){_0x11e884[_0xfcb9('0x15')](0xcc)[_0xfcb9('0x22')]();});}};}function handleEntityNotFound(_0x486160,_0x479c08){return function(_0x299961){if(!_0x299961){_0x486160['sendStatus'](0x194);}return _0x299961;};}function handleError(_0x2d3046,_0x3b993f){_0x3b993f=_0x3b993f||0x1f4;return function(_0x2218dc){logger[_0xfcb9('0x23')](_0x2218dc[_0xfcb9('0x24')]);if(_0x2218dc[_0xfcb9('0x25')]){delete _0x2218dc[_0xfcb9('0x25')];}_0x2d3046[_0xfcb9('0x15')](_0x3b993f)[_0xfcb9('0x26')](_0x2218dc);};}exports[_0xfcb9('0x27')]=function(_0x3e1042,_0x274bc3){var _0x40bfc1={},_0x504ca7={},_0x4a29b9={'count':0x0,'rows':[]};var _0x8bfc2f=_[_0xfcb9('0x28')](db[_0xfcb9('0x29')][_0xfcb9('0x2a')],function(_0x5f1ad3){return{'name':_0x5f1ad3[_0xfcb9('0x2b')],'type':_0x5f1ad3[_0xfcb9('0x2c')][_0xfcb9('0x2d')]};});_0x504ca7[_0xfcb9('0x2e')]=_['map'](_0x8bfc2f,'name');_0x504ca7[_0xfcb9('0x2f')]=_['keys'](_0x3e1042[_0xfcb9('0x2f')]);_0x504ca7[_0xfcb9('0x30')]=_[_0xfcb9('0x31')](_0x504ca7[_0xfcb9('0x2e')],_0x504ca7[_0xfcb9('0x2f')]);_0x40bfc1['attributes']=_[_0xfcb9('0x31')](_0x504ca7[_0xfcb9('0x2e')],qs[_0xfcb9('0x32')](_0x3e1042[_0xfcb9('0x2f')][_0xfcb9('0x32')]));_0x40bfc1[_0xfcb9('0x33')]=_0x40bfc1[_0xfcb9('0x33')]['length']?_0x40bfc1[_0xfcb9('0x33')]:_0x504ca7[_0xfcb9('0x2e')];if(!_0x3e1042[_0xfcb9('0x2f')][_0xfcb9('0x34')](_0xfcb9('0x35'))){_0x40bfc1['limit']=qs['limit'](_0x3e1042['query'][_0xfcb9('0x18')]);_0x40bfc1[_0xfcb9('0x19')]=qs[_0xfcb9('0x19')](_0x3e1042['query'][_0xfcb9('0x19')]);}_0x40bfc1[_0xfcb9('0x36')]=qs[_0xfcb9('0x37')](_0x3e1042[_0xfcb9('0x2f')][_0xfcb9('0x37')]);_0x40bfc1['where']=qs[_0xfcb9('0x30')](_[_0xfcb9('0x38')](_0x3e1042[_0xfcb9('0x2f')],_0x504ca7[_0xfcb9('0x30')]),_0x8bfc2f);if(_0x3e1042['query'][_0xfcb9('0x39')]){_0x40bfc1[_0xfcb9('0x3a')]=_[_0xfcb9('0x3b')](_0x40bfc1['where'],{'$or':_[_0xfcb9('0x28')](_0x8bfc2f,function(_0x5d7a0f){if(_0x5d7a0f[_0xfcb9('0x2c')]!=='VIRTUAL'){var _0x5e8c1d={};_0x5e8c1d[_0x5d7a0f[_0xfcb9('0x25')]]={'$like':'%'+_0x3e1042['query'][_0xfcb9('0x39')]+'%'};return _0x5e8c1d;}})});}_0x40bfc1=_[_0xfcb9('0x3b')]({},_0x40bfc1,_0x3e1042[_0xfcb9('0x3c')]);var _0x3e379a={'where':_0x40bfc1['where']};return db['DeskAccount'][_0xfcb9('0x1a')](_0x3e379a)[_0xfcb9('0x21')](function(_0x547728){_0x4a29b9['count']=_0x547728;if(_0x3e1042[_0xfcb9('0x2f')][_0xfcb9('0x3d')]){_0x40bfc1[_0xfcb9('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0xfcb9('0x3f')](_0x40bfc1);})['then'](function(_0x5c2b47){_0x4a29b9[_0xfcb9('0x40')]=_0x5c2b47;return _0x4a29b9;})[_0xfcb9('0x21')](respondWithFilteredResult(_0x274bc3,_0x40bfc1))['catch'](handleError(_0x274bc3,null));};exports['show']=function(_0x3bbdf6,_0x53319f){var _0x261e8d={'raw':![],'where':{'id':_0x3bbdf6[_0xfcb9('0x41')]['id']}},_0x8274a3={};_0x8274a3[_0xfcb9('0x2e')]=_['keys'](db['DeskAccount'][_0xfcb9('0x2a')]);_0x8274a3[_0xfcb9('0x2f')]=_[_0xfcb9('0x42')](_0x3bbdf6[_0xfcb9('0x2f')]);_0x8274a3[_0xfcb9('0x30')]=_[_0xfcb9('0x31')](_0x8274a3[_0xfcb9('0x2e')],_0x8274a3['query']);_0x261e8d['attributes']=_[_0xfcb9('0x31')](_0x8274a3[_0xfcb9('0x2e')],qs[_0xfcb9('0x32')](_0x3bbdf6[_0xfcb9('0x2f')][_0xfcb9('0x32')]));_0x261e8d[_0xfcb9('0x33')]=_0x261e8d[_0xfcb9('0x33')][_0xfcb9('0x43')]?_0x261e8d[_0xfcb9('0x33')]:_0x8274a3[_0xfcb9('0x2e')];if(_0x3bbdf6[_0xfcb9('0x2f')][_0xfcb9('0x3d')]){_0x261e8d[_0xfcb9('0x3e')]=[{'all':!![]}];}_0x261e8d=_[_0xfcb9('0x3b')]({},_0x261e8d,_0x3bbdf6['options']);return db[_0xfcb9('0x29')]['find'](_0x261e8d)[_0xfcb9('0x21')](handleEntityNotFound(_0x53319f,null))[_0xfcb9('0x21')](respondWithResult(_0x53319f,null))['catch'](handleError(_0x53319f,null));};exports[_0xfcb9('0x44')]=function(_0x4ac785,_0x255085){return db[_0xfcb9('0x29')][_0xfcb9('0x44')](_0x4ac785[_0xfcb9('0x45')],{})[_0xfcb9('0x21')](respondWithResult(_0x255085,0xc9))[_0xfcb9('0x46')](handleError(_0x255085,null));};exports['update']=function(_0x20ef9b,_0x413e5a){if(_0x20ef9b[_0xfcb9('0x45')]['id']){delete _0x20ef9b[_0xfcb9('0x45')]['id'];}return db[_0xfcb9('0x29')]['find']({'where':{'id':_0x20ef9b[_0xfcb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x413e5a,null))[_0xfcb9('0x21')](saveUpdates(_0x20ef9b['body'],null))['then'](respondWithResult(_0x413e5a,null))['catch'](handleError(_0x413e5a,null));};exports[_0xfcb9('0x20')]=function(_0x52e901,_0x2a4449){return db['DeskAccount']['find']({'where':{'id':_0x52e901[_0xfcb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a4449,null))['then'](removeEntity(_0x2a4449,null))[_0xfcb9('0x46')](handleError(_0x2a4449,null));};exports[_0xfcb9('0x47')]=function(_0x184bef,_0x31e1fd,_0x33c3ea){var _0x261cfe={};var _0x3179a9={};var _0x488313;var _0x6ce3c6;return db['DeskAccount']['findOne']({'where':{'id':_0x184bef['params']['id']}})[_0xfcb9('0x21')](handleEntityNotFound(_0x31e1fd,null))['then'](function(_0xb5cb42){if(_0xb5cb42){_0x488313=_0xb5cb42;_0x3179a9[_0xfcb9('0x2e')]=_[_0xfcb9('0x42')](db[_0xfcb9('0x48')][_0xfcb9('0x2a')]);_0x3179a9[_0xfcb9('0x2f')]=_[_0xfcb9('0x42')](_0x184bef[_0xfcb9('0x2f')]);_0x3179a9[_0xfcb9('0x30')]=_['intersection'](_0x3179a9['model'],_0x3179a9['query']);_0x261cfe[_0xfcb9('0x33')]=_['intersection'](_0x3179a9[_0xfcb9('0x2e')],qs['fields'](_0x184bef[_0xfcb9('0x2f')][_0xfcb9('0x32')]));_0x261cfe['attributes']=_0x261cfe['attributes'][_0xfcb9('0x43')]?_0x261cfe[_0xfcb9('0x33')]:_0x3179a9[_0xfcb9('0x2e')];_0x261cfe['order']=qs[_0xfcb9('0x37')](_0x184bef['query'][_0xfcb9('0x37')]);_0x261cfe['where']=qs[_0xfcb9('0x30')](_[_0xfcb9('0x38')](_0x184bef[_0xfcb9('0x2f')],_0x3179a9[_0xfcb9('0x30')]));if(_0x184bef[_0xfcb9('0x2f')][_0xfcb9('0x39')]){_0x261cfe['where']=_[_0xfcb9('0x3b')](_0x261cfe[_0xfcb9('0x3a')],{'$or':_['map'](_0x261cfe[_0xfcb9('0x33')],function(_0x355fd6){var _0x5603eb={};_0x5603eb[_0x355fd6]={'$like':'%'+_0x184bef[_0xfcb9('0x2f')][_0xfcb9('0x39')]+'%'};return _0x5603eb;})});}_0x261cfe=_[_0xfcb9('0x3b')]({},_0x261cfe,_0x184bef[_0xfcb9('0x3c')]);return _0x488313[_0xfcb9('0x47')](_0x261cfe);}})[_0xfcb9('0x21')](function(_0x23a397){if(_0x23a397){_0x6ce3c6=_0x23a397[_0xfcb9('0x43')];if(!_0x184bef[_0xfcb9('0x2f')][_0xfcb9('0x34')]('nolimit')){_0x261cfe[_0xfcb9('0x18')]=qs[_0xfcb9('0x18')](_0x184bef['query'][_0xfcb9('0x18')]);_0x261cfe[_0xfcb9('0x19')]=qs['offset'](_0x184bef[_0xfcb9('0x2f')][_0xfcb9('0x19')]);}return _0x488313[_0xfcb9('0x47')](_0x261cfe);}})[_0xfcb9('0x21')](function(_0x1dc1fe){if(_0x1dc1fe){return _0x1dc1fe?{'count':_0x6ce3c6,'rows':_0x1dc1fe}:null;}})[_0xfcb9('0x21')](respondWithResult(_0x31e1fd,null))['catch'](handleError(_0x31e1fd,null));};exports[_0xfcb9('0x49')]=function(_0x41bcbd,_0x31be91,_0x36b9e7){if(_0x41bcbd[_0xfcb9('0x45')]['id']){delete _0x41bcbd[_0xfcb9('0x45')]['id'];}return db[_0xfcb9('0x29')][_0xfcb9('0x4a')]({'where':{'id':_0x41bcbd['params']['id']}})[_0xfcb9('0x21')](handleEntityNotFound(_0x31be91,null))[_0xfcb9('0x21')](function(_0x3c787d){if(_0x3c787d){_0x41bcbd[_0xfcb9('0x45')][_0xfcb9('0x4b')]=_0x3c787d['id'];_0x41bcbd[_0xfcb9('0x45')]['Subjects']=integrations[_0xfcb9('0x4c')](_0x41bcbd[_0xfcb9('0x45')][_0xfcb9('0x4d')],_0x41bcbd[_0xfcb9('0x45')]['type']);_0x41bcbd[_0xfcb9('0x45')][_0xfcb9('0x4e')]=integrations[_0xfcb9('0x4f')](_0x41bcbd['body'][_0xfcb9('0x4d')],_0x41bcbd[_0xfcb9('0x45')]['type']);return db[_0xfcb9('0x48')][_0xfcb9('0x44')](_0x41bcbd[_0xfcb9('0x45')],{'include':[{'model':db[_0xfcb9('0x50')],'as':'Subjects'},{'model':db[_0xfcb9('0x50')],'as':_0xfcb9('0x4e')}]});}return null;})['then'](respondWithResult(_0x31be91,null))[_0xfcb9('0x46')](handleError(_0x31be91,null));};exports[_0xfcb9('0x51')]=function(_0x35c679,_0x35b2b0,_0x2e9d84){var _0x14033a=[{'name':_0xfcb9('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4e58e8='';return db['DeskAccount'][_0xfcb9('0x4a')]({'where':{'id':_0x35c679[_0xfcb9('0x41')]['id']},'attributes':['id',_0xfcb9('0x53'),_0xfcb9('0x54'),_0xfcb9('0x55'),_0xfcb9('0x56'),'consumerKey','consumerSecret',_0xfcb9('0x57'),_0xfcb9('0x58')]})[_0xfcb9('0x21')](handleEntityNotFound(_0x35b2b0,null))[_0xfcb9('0x21')](function(_0x52470d){if(_0x52470d){_0x4e58e8=_0x52470d[_0xfcb9('0x53')];var _0x3927f3=_0x4e58e8[_0xfcb9('0x59')](-0x1);if(_0x3927f3==='/'){_0x4e58e8=_0x4e58e8[_0xfcb9('0x5a')](0x0,_0x4e58e8[_0xfcb9('0x5b')](_0x3927f3));}var _0x3a5fb1={'method':'GET','uri':util[_0xfcb9('0x5c')](_0xfcb9('0x5d'),_0x4e58e8),'headers':{'Content-Type':_0xfcb9('0x5e'),'Accept':'application/json'},'json':!![]};if(_0x52470d['authType']===_0xfcb9('0x5f')){_0x3a5fb1[_0xfcb9('0x60')][_0xfcb9('0x61')]=util[_0xfcb9('0x5c')]('Basic\x20%s',new Buffer(util[_0xfcb9('0x5c')](_0xfcb9('0x62'),_0x52470d[_0xfcb9('0x55')],_0x52470d[_0xfcb9('0x56')]))[_0xfcb9('0x63')]('base64'));}return rp(_0x3a5fb1)[_0xfcb9('0x21')](function(_0x2b48d9){return _0x14033a[_0xfcb9('0x64')](_[_0xfcb9('0x28')](_0x2b48d9['_embedded'][_0xfcb9('0x65')],function(_0x257d41){return{'id':_0x257d41[_0xfcb9('0x25')],'name':_0x257d41[_0xfcb9('0x25')],'type':_0x257d41[_0xfcb9('0x2c')],'active':_0x257d41[_0xfcb9('0x66')],'label':_0x257d41[_0xfcb9('0x67')],'custom':!![]};}));});}})[_0xfcb9('0x21')](function(_0xf5fe19){return{'count':_0xf5fe19[_0xfcb9('0x43')],'rows':_0xf5fe19};})[_0xfcb9('0x21')](respondWithResult(_0x35b2b0,null))['catch'](function(_0x12864e){var _0x4471a6=_0x35c679[_0xfcb9('0x2f')]['test']?0x1f4:_0x12864e[_0xfcb9('0x68')]||0x1f4;logger[_0xfcb9('0x23')](_0xfcb9('0x69'),_0xfcb9('0x51'),_0x4471a6,JSON['stringify'](_0x12864e));delete _0x12864e[_0xfcb9('0x25')];if(_0x4471a6===0x191){_0x4471a6=0x190;}_0x35b2b0[_0xfcb9('0x15')](_0x4471a6)[_0xfcb9('0x26')](_0x35c679[_0xfcb9('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x12864e['statusCode']}:_0x12864e);});}; \ No newline at end of file +var _0x26ed=['create','body','find','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','remoteUri','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../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','name','send','DeskAccount','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','nolimit','order','sort','filters','pick','filter','merge','options','where','includeAll','include','findAll','catch','show','params'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0x26ed,0x9c));var _0xd26e=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0x26ed[_0x555069];return _0x100af7;};'use strict';var emlformat=require(_0xd26e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd26e('0x1'));var jsonpatch=require(_0xd26e('0x2'));var rp=require(_0xd26e('0x3'));var moment=require(_0xd26e('0x4'));var BPromise=require(_0xd26e('0x5'));var Mustache=require(_0xd26e('0x6'));var util=require(_0xd26e('0x7'));var path=require(_0xd26e('0x8'));var sox=require(_0xd26e('0x9'));var csv=require(_0xd26e('0xa'));var ejs=require(_0xd26e('0xb'));var fs=require('fs');var fs_extra=require(_0xd26e('0xc'));var _=require('lodash');var squel=require(_0xd26e('0xd'));var crypto=require(_0xd26e('0xe'));var jsforce=require(_0xd26e('0xf'));var deskjs=require(_0xd26e('0x10'));var toCsv=require(_0xd26e('0xa'));var querystring=require(_0xd26e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd26e('0x12'));var authService=require(_0xd26e('0x13'));var qs=require(_0xd26e('0x14'));var as=require(_0xd26e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd26e('0x16'));var utils=require(_0xd26e('0x17'));var config=require(_0xd26e('0x18'));var licenseUtil=require(_0xd26e('0x19'));var db=require(_0xd26e('0x1a'))['db'];var integrations=require(_0xd26e('0x1b'));function respondWithStatusCode(_0x5afd12,_0xf9aab0){_0xf9aab0=_0xf9aab0||0xcc;return function(_0x5ebaf5){if(_0x5ebaf5){return _0x5afd12[_0xd26e('0x1c')](_0xf9aab0);}return _0x5afd12[_0xd26e('0x1d')](_0xf9aab0)[_0xd26e('0x1e')]();};}function respondWithResult(_0x1304d0,_0x3c58d4){_0x3c58d4=_0x3c58d4||0xc8;return function(_0x3da6a7){if(_0x3da6a7){return _0x1304d0[_0xd26e('0x1d')](_0x3c58d4)[_0xd26e('0x1f')](_0x3da6a7);}};}function respondWithFilteredResult(_0x289889,_0x4553fe){return function(_0xa978){if(_0xa978){var _0x3a9149=typeof _0x4553fe[_0xd26e('0x20')]==='undefined'&&typeof _0x4553fe[_0xd26e('0x21')]===_0xd26e('0x22');var _0x59ec19=_0xa978[_0xd26e('0x23')];var _0xca255f=_0x3a9149?0x0:_0x4553fe['offset'];var _0x28de94=_0x3a9149?_0xa978['count']:_0x4553fe[_0xd26e('0x20')]+_0x4553fe[_0xd26e('0x21')];var _0x4d09ec;if(_0x28de94>=_0x59ec19){_0x28de94=_0x59ec19;_0x4d09ec=0xc8;}else{_0x4d09ec=0xce;}_0x289889['status'](_0x4d09ec);return _0x289889[_0xd26e('0x24')](_0xd26e('0x25'),_0xca255f+'-'+_0x28de94+'/'+_0x59ec19)[_0xd26e('0x1f')](_0xa978);}return null;};}function patchUpdates(_0x584093){return function(_0x5c4586){try{jsonpatch['apply'](_0x5c4586,_0x584093,!![]);}catch(_0x250c55){return BPromise[_0xd26e('0x26')](_0x250c55);}return _0x5c4586[_0xd26e('0x27')]();};}function saveUpdates(_0x20870b,_0x30385b){return function(_0x501316){if(_0x501316){return _0x501316[_0xd26e('0x28')](_0x20870b)[_0xd26e('0x29')](function(_0x2997e6){return _0x2997e6;});}return null;};}function removeEntity(_0x336adc,_0x55ab63){return function(_0x2d2414){if(_0x2d2414){return _0x2d2414[_0xd26e('0x2a')]()[_0xd26e('0x29')](function(){_0x336adc['status'](0xcc)[_0xd26e('0x1e')]();});}};}function handleEntityNotFound(_0x2ebd54,_0x36758a){return function(_0x335bcc){if(!_0x335bcc){_0x2ebd54[_0xd26e('0x1c')](0x194);}return _0x335bcc;};}function handleError(_0x400147,_0x32b906){_0x32b906=_0x32b906||0x1f4;return function(_0x494e2e){logger[_0xd26e('0x2b')](_0x494e2e['stack']);if(_0x494e2e[_0xd26e('0x2c')]){delete _0x494e2e[_0xd26e('0x2c')];}_0x400147[_0xd26e('0x1d')](_0x32b906)[_0xd26e('0x2d')](_0x494e2e);};}exports['index']=function(_0x4d026d,_0x5a0374){var _0x10a210={},_0x47bd8e={},_0x173748={'count':0x0,'rows':[]};var _0x3b2d7f=_['map'](db[_0xd26e('0x2e')][_0xd26e('0x2f')],function(_0x556960){return{'name':_0x556960[_0xd26e('0x30')],'type':_0x556960[_0xd26e('0x31')][_0xd26e('0x32')]};});_0x47bd8e[_0xd26e('0x33')]=_[_0xd26e('0x34')](_0x3b2d7f,_0xd26e('0x2c'));_0x47bd8e['query']=_[_0xd26e('0x35')](_0x4d026d['query']);_0x47bd8e['filters']=_[_0xd26e('0x36')](_0x47bd8e[_0xd26e('0x33')],_0x47bd8e[_0xd26e('0x37')]);_0x10a210['attributes']=_[_0xd26e('0x36')](_0x47bd8e[_0xd26e('0x33')],qs[_0xd26e('0x38')](_0x4d026d['query']['fields']));_0x10a210[_0xd26e('0x39')]=_0x10a210['attributes'][_0xd26e('0x3a')]?_0x10a210['attributes']:_0x47bd8e['model'];if(!_0x4d026d[_0xd26e('0x37')]['hasOwnProperty'](_0xd26e('0x3b'))){_0x10a210[_0xd26e('0x21')]=qs[_0xd26e('0x21')](_0x4d026d[_0xd26e('0x37')][_0xd26e('0x21')]);_0x10a210[_0xd26e('0x20')]=qs['offset'](_0x4d026d[_0xd26e('0x37')]['offset']);}_0x10a210[_0xd26e('0x3c')]=qs[_0xd26e('0x3d')](_0x4d026d[_0xd26e('0x37')]['sort']);_0x10a210['where']=qs[_0xd26e('0x3e')](_[_0xd26e('0x3f')](_0x4d026d[_0xd26e('0x37')],_0x47bd8e[_0xd26e('0x3e')]),_0x3b2d7f);if(_0x4d026d[_0xd26e('0x37')][_0xd26e('0x40')]){_0x10a210['where']=_[_0xd26e('0x41')](_0x10a210['where'],{'$or':_['map'](_0x3b2d7f,function(_0xe011c6){if(_0xe011c6['type']!=='VIRTUAL'){var _0x3874d1={};_0x3874d1[_0xe011c6[_0xd26e('0x2c')]]={'$like':'%'+_0x4d026d['query']['filter']+'%'};return _0x3874d1;}})});}_0x10a210=_[_0xd26e('0x41')]({},_0x10a210,_0x4d026d[_0xd26e('0x42')]);var _0x41e225={'where':_0x10a210[_0xd26e('0x43')]};return db[_0xd26e('0x2e')][_0xd26e('0x23')](_0x41e225)[_0xd26e('0x29')](function(_0x231bf8){_0x173748[_0xd26e('0x23')]=_0x231bf8;if(_0x4d026d['query'][_0xd26e('0x44')]){_0x10a210[_0xd26e('0x45')]=[{'all':!![]}];}return db[_0xd26e('0x2e')][_0xd26e('0x46')](_0x10a210);})['then'](function(_0x14036b){_0x173748['rows']=_0x14036b;return _0x173748;})['then'](respondWithFilteredResult(_0x5a0374,_0x10a210))[_0xd26e('0x47')](handleError(_0x5a0374,null));};exports[_0xd26e('0x48')]=function(_0x558a8d,_0x27ebba){var _0x4d3b79={'raw':![],'where':{'id':_0x558a8d[_0xd26e('0x49')]['id']}},_0x4280af={};_0x4280af['model']=_[_0xd26e('0x35')](db['DeskAccount'][_0xd26e('0x2f')]);_0x4280af[_0xd26e('0x37')]=_[_0xd26e('0x35')](_0x558a8d[_0xd26e('0x37')]);_0x4280af[_0xd26e('0x3e')]=_[_0xd26e('0x36')](_0x4280af[_0xd26e('0x33')],_0x4280af[_0xd26e('0x37')]);_0x4d3b79['attributes']=_[_0xd26e('0x36')](_0x4280af[_0xd26e('0x33')],qs['fields'](_0x558a8d[_0xd26e('0x37')][_0xd26e('0x38')]));_0x4d3b79['attributes']=_0x4d3b79['attributes'][_0xd26e('0x3a')]?_0x4d3b79[_0xd26e('0x39')]:_0x4280af[_0xd26e('0x33')];if(_0x558a8d[_0xd26e('0x37')][_0xd26e('0x44')]){_0x4d3b79[_0xd26e('0x45')]=[{'all':!![]}];}_0x4d3b79=_[_0xd26e('0x41')]({},_0x4d3b79,_0x558a8d[_0xd26e('0x42')]);return db[_0xd26e('0x2e')]['find'](_0x4d3b79)[_0xd26e('0x29')](handleEntityNotFound(_0x27ebba,null))[_0xd26e('0x29')](respondWithResult(_0x27ebba,null))[_0xd26e('0x47')](handleError(_0x27ebba,null));};exports[_0xd26e('0x4a')]=function(_0x50fdfc,_0x353e94){return db[_0xd26e('0x2e')]['create'](_0x50fdfc[_0xd26e('0x4b')],{})[_0xd26e('0x29')](respondWithResult(_0x353e94,0xc9))['catch'](handleError(_0x353e94,null));};exports[_0xd26e('0x28')]=function(_0x30b6b2,_0x6686e9){if(_0x30b6b2[_0xd26e('0x4b')]['id']){delete _0x30b6b2['body']['id'];}return db[_0xd26e('0x2e')][_0xd26e('0x4c')]({'where':{'id':_0x30b6b2[_0xd26e('0x49')]['id']}})[_0xd26e('0x29')](handleEntityNotFound(_0x6686e9,null))[_0xd26e('0x29')](saveUpdates(_0x30b6b2['body'],null))[_0xd26e('0x29')](respondWithResult(_0x6686e9,null))['catch'](handleError(_0x6686e9,null));};exports[_0xd26e('0x2a')]=function(_0x4647e3,_0x36e24b){return db[_0xd26e('0x2e')][_0xd26e('0x4c')]({'where':{'id':_0x4647e3['params']['id']}})[_0xd26e('0x29')](handleEntityNotFound(_0x36e24b,null))[_0xd26e('0x29')](removeEntity(_0x36e24b,null))[_0xd26e('0x47')](handleError(_0x36e24b,null));};exports[_0xd26e('0x4d')]=function(_0x525348,_0x249083,_0x42ba06){var _0x35dbf2={};var _0x39408b={};var _0x1c5869;var _0x3e0dc2;return db['DeskAccount'][_0xd26e('0x4e')]({'where':{'id':_0x525348[_0xd26e('0x49')]['id']}})['then'](handleEntityNotFound(_0x249083,null))['then'](function(_0x19351a){if(_0x19351a){_0x1c5869=_0x19351a;_0x39408b[_0xd26e('0x33')]=_[_0xd26e('0x35')](db[_0xd26e('0x4f')][_0xd26e('0x2f')]);_0x39408b['query']=_['keys'](_0x525348[_0xd26e('0x37')]);_0x39408b[_0xd26e('0x3e')]=_[_0xd26e('0x36')](_0x39408b[_0xd26e('0x33')],_0x39408b['query']);_0x35dbf2[_0xd26e('0x39')]=_['intersection'](_0x39408b[_0xd26e('0x33')],qs[_0xd26e('0x38')](_0x525348[_0xd26e('0x37')][_0xd26e('0x38')]));_0x35dbf2[_0xd26e('0x39')]=_0x35dbf2[_0xd26e('0x39')][_0xd26e('0x3a')]?_0x35dbf2[_0xd26e('0x39')]:_0x39408b[_0xd26e('0x33')];_0x35dbf2[_0xd26e('0x3c')]=qs[_0xd26e('0x3d')](_0x525348['query'][_0xd26e('0x3d')]);_0x35dbf2[_0xd26e('0x43')]=qs[_0xd26e('0x3e')](_['pick'](_0x525348['query'],_0x39408b['filters']));if(_0x525348['query']['filter']){_0x35dbf2['where']=_[_0xd26e('0x41')](_0x35dbf2[_0xd26e('0x43')],{'$or':_[_0xd26e('0x34')](_0x35dbf2[_0xd26e('0x39')],function(_0x31ca24){var _0x5e6c56={};_0x5e6c56[_0x31ca24]={'$like':'%'+_0x525348[_0xd26e('0x37')][_0xd26e('0x40')]+'%'};return _0x5e6c56;})});}_0x35dbf2=_[_0xd26e('0x41')]({},_0x35dbf2,_0x525348[_0xd26e('0x42')]);return _0x1c5869['getConfigurations'](_0x35dbf2);}})['then'](function(_0x25919d){if(_0x25919d){_0x3e0dc2=_0x25919d[_0xd26e('0x3a')];if(!_0x525348[_0xd26e('0x37')]['hasOwnProperty'](_0xd26e('0x3b'))){_0x35dbf2[_0xd26e('0x21')]=qs[_0xd26e('0x21')](_0x525348['query'][_0xd26e('0x21')]);_0x35dbf2[_0xd26e('0x20')]=qs[_0xd26e('0x20')](_0x525348[_0xd26e('0x37')]['offset']);}return _0x1c5869[_0xd26e('0x4d')](_0x35dbf2);}})['then'](function(_0x153b33){if(_0x153b33){return _0x153b33?{'count':_0x3e0dc2,'rows':_0x153b33}:null;}})[_0xd26e('0x29')](respondWithResult(_0x249083,null))[_0xd26e('0x47')](handleError(_0x249083,null));};exports['addConfiguration']=function(_0x54000f,_0x79702b,_0x236f3a){if(_0x54000f[_0xd26e('0x4b')]['id']){delete _0x54000f['body']['id'];}return db[_0xd26e('0x2e')][_0xd26e('0x4e')]({'where':{'id':_0x54000f[_0xd26e('0x49')]['id']}})[_0xd26e('0x29')](handleEntityNotFound(_0x79702b,null))[_0xd26e('0x29')](function(_0x4b4e64){if(_0x4b4e64){_0x54000f[_0xd26e('0x4b')][_0xd26e('0x50')]=_0x4b4e64['id'];_0x54000f['body'][_0xd26e('0x51')]=integrations[_0xd26e('0x52')](_0x54000f['body']['channel'],_0x54000f[_0xd26e('0x4b')][_0xd26e('0x31')]);_0x54000f[_0xd26e('0x4b')][_0xd26e('0x53')]=integrations[_0xd26e('0x54')](_0x54000f[_0xd26e('0x4b')][_0xd26e('0x55')],_0x54000f[_0xd26e('0x4b')][_0xd26e('0x31')]);return db['DeskConfiguration'][_0xd26e('0x4a')](_0x54000f['body'],{'include':[{'model':db[_0xd26e('0x56')],'as':_0xd26e('0x51')},{'model':db[_0xd26e('0x56')],'as':_0xd26e('0x53')}]});}return null;})[_0xd26e('0x29')](respondWithResult(_0x79702b,null))['catch'](handleError(_0x79702b,null));};exports['getFields']=function(_0xb82f2f,_0xef9dca,_0x14bc7c){var _0x2ccc2a=[{'name':_0xd26e('0x57'),'label':_0xd26e('0x57'),'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 _0x142f22='';return db[_0xd26e('0x2e')][_0xd26e('0x4e')]({'where':{'id':_0xb82f2f[_0xd26e('0x49')]['id']},'attributes':['id',_0xd26e('0x58'),'authType','username',_0xd26e('0x59'),_0xd26e('0x5a'),_0xd26e('0x5b'),_0xd26e('0x5c'),'tokenSecret']})[_0xd26e('0x29')](handleEntityNotFound(_0xef9dca,null))[_0xd26e('0x29')](function(_0x1f6e7f){if(_0x1f6e7f){_0x142f22=_0x1f6e7f[_0xd26e('0x58')];var _0x19cbf6=_0x142f22[_0xd26e('0x5d')](-0x1);if(_0x19cbf6==='/'){_0x142f22=_0x142f22[_0xd26e('0x5e')](0x0,_0x142f22[_0xd26e('0x5f')](_0x19cbf6));}var _0x430275={'method':_0xd26e('0x60'),'uri':util[_0xd26e('0x61')](_0xd26e('0x62'),_0x142f22),'headers':{'Content-Type':'application/json','Accept':_0xd26e('0x63')},'json':!![]};if(_0x1f6e7f[_0xd26e('0x64')]===_0xd26e('0x65')){_0x430275['headers'][_0xd26e('0x66')]=util[_0xd26e('0x61')](_0xd26e('0x67'),new Buffer(util['format'](_0xd26e('0x68'),_0x1f6e7f['username'],_0x1f6e7f['password']))[_0xd26e('0x69')](_0xd26e('0x6a')));}return rp(_0x430275)[_0xd26e('0x29')](function(_0x382429){return _0x2ccc2a['concat'](_[_0xd26e('0x34')](_0x382429[_0xd26e('0x6b')][_0xd26e('0x6c')],function(_0x5660fd){return{'id':_0x5660fd[_0xd26e('0x2c')],'name':_0x5660fd['name'],'type':_0x5660fd[_0xd26e('0x31')],'active':_0x5660fd[_0xd26e('0x6d')],'label':_0x5660fd[_0xd26e('0x6e')],'custom':!![]};}));});}})[_0xd26e('0x29')](function(_0x32b962){return{'count':_0x32b962[_0xd26e('0x3a')],'rows':_0x32b962};})[_0xd26e('0x29')](respondWithResult(_0xef9dca,null))[_0xd26e('0x47')](function(_0x55c190){var _0x5673c7=_0xb82f2f['query'][_0xd26e('0x6f')]?0x1f4:_0x55c190[_0xd26e('0x70')]||0x1f4;logger[_0xd26e('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xd26e('0x71'),_0x5673c7,JSON[_0xd26e('0x72')](_0x55c190));delete _0x55c190['name'];if(_0x5673c7===0x191){_0x5673c7=0x190;}_0xef9dca[_0xd26e('0x1d')](_0x5673c7)[_0xd26e('0x2d')](_0xb82f2f[_0xd26e('0x37')][_0xd26e('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x55c190[_0xd26e('0x70')]}:_0x55c190);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0235c16..1ec7215 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 _0x4af5=['rimraf','./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4af5,0xb5));var _0x54af=function(_0x46720e,_0x3b5fc4){_0x46720e=_0x46720e-0x0;var _0x23b94c=_0x4af5[_0x46720e];return _0x23b94c;};'use strict';var _=require(_0x54af('0x0'));var util=require('util');var logger=require(_0x54af('0x1'))(_0x54af('0x2'));var moment=require(_0x54af('0x3'));var BPromise=require('bluebird');var rp=require(_0x54af('0x4'));var fs=require('fs');var path=require(_0x54af('0x5'));var rimraf=require(_0x54af('0x6'));var config=require('../../config/environment');var attributes=require(_0x54af('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x54af('0x8')]=function(_0xefadf8,_0x44c5bf){return _0xefadf8['define'](_0x54af('0x9'),attributes,{'tableName':_0x54af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc32b=['api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0xc32b,0xf9));var _0xbc32=function(_0x230a65,_0x3f923d){_0x230a65=_0x230a65-0x0;var _0x17f8bb=_0xc32b[_0x230a65];return _0x17f8bb;};'use strict';var _=require(_0xbc32('0x0'));var util=require(_0xbc32('0x1'));var logger=require(_0xbc32('0x2'))(_0xbc32('0x3'));var moment=require(_0xbc32('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc32('0x5'));var config=require(_0xbc32('0x6'));var attributes=require(_0xbc32('0x7'));var integrations=require(_0xbc32('0x8'));module['exports']=function(_0x4be399,_0x2bd20d){return _0x4be399[_0xbc32('0x9')](_0xbc32('0xa'),attributes,{'tableName':_0xbc32('0xb'),'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 0fb075f..49855a0 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 _0xb378=['info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then'];(function(_0x5cecb3,_0x327dd9){var _0x5a55d7=function(_0x477789){while(--_0x477789){_0x5cecb3['push'](_0x5cecb3['shift']());}};_0x5a55d7(++_0x327dd9);}(_0xb378,0x10d));var _0x8b37=function(_0x5724e9,_0x28e9ca){_0x5724e9=_0x5724e9-0x0;var _0x28bd9a=_0xb378[_0x5724e9];return _0x28bd9a;};'use strict';var _=require(_0x8b37('0x0'));var util=require(_0x8b37('0x1'));var moment=require(_0x8b37('0x2'));var BPromise=require(_0x8b37('0x3'));var rs=require(_0x8b37('0x4'));var fs=require('fs');var Redis=require(_0x8b37('0x5'));var db=require(_0x8b37('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8b37('0x7'));var client=jayson[_0x8b37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x305be3,_0xb535ff,_0x421e39){return new BPromise(function(_0x4805a2,_0x3427d8){return client[_0x8b37('0x9')](_0x305be3,_0x421e39)[_0x8b37('0xa')](function(_0x421679){logger[_0x8b37('0xb')]('DeskAccount,\x20%s,\x20%s',_0xb535ff,_0x8b37('0xc'));logger[_0x8b37('0xd')](_0x8b37('0xe'),_0xb535ff,_0x8b37('0xc'),JSON[_0x8b37('0xf')](_0x421679));if(_0x421679[_0x8b37('0x10')]){if(_0x421679[_0x8b37('0x10')][_0x8b37('0x11')]===0x1f4){logger['error'](_0x8b37('0x12'),_0xb535ff,_0x421679[_0x8b37('0x10')][_0x8b37('0x13')]);return _0x3427d8(_0x421679[_0x8b37('0x10')]['message']);}logger[_0x8b37('0x10')](_0x8b37('0x12'),_0xb535ff,_0x421679[_0x8b37('0x10')][_0x8b37('0x13')]);return _0x4805a2(_0x421679['error'][_0x8b37('0x13')]);}else{logger[_0x8b37('0xb')]('DeskAccount,\x20%s,\x20%s',_0xb535ff,_0x8b37('0xc'));_0x4805a2(_0x421679[_0x8b37('0x14')][_0x8b37('0x13')]);}})[_0x8b37('0x15')](function(_0x1d1854){logger[_0x8b37('0x10')]('DeskAccount,\x20%s,\x20%s',_0xb535ff,_0x1d1854);_0x3427d8(_0x1d1854);});});}exports['GetDeskAccount']=function(_0x5aba5b){var _0x30cee2=this;return new Promise(function(_0x15a057,_0x375451){return db[_0x8b37('0x16')][_0x8b37('0x17')]({'raw':_0x5aba5b[_0x8b37('0x18')]?_0x5aba5b[_0x8b37('0x18')][_0x8b37('0x19')]===undefined?!![]:![]:!![],'where':_0x5aba5b[_0x8b37('0x18')]?_0x5aba5b[_0x8b37('0x18')][_0x8b37('0x1a')]||null:null,'attributes':_0x5aba5b[_0x8b37('0x18')]?_0x5aba5b[_0x8b37('0x18')][_0x8b37('0x1b')]||null:null,'limit':_0x5aba5b['options']?_0x5aba5b['options'][_0x8b37('0x1c')]||null:null,'include':_0x5aba5b[_0x8b37('0x18')]?_0x5aba5b[_0x8b37('0x18')][_0x8b37('0x1d')]?_['map'](_0x5aba5b['options']['include'],function(_0x4dd3e2){return{'model':db[_0x4dd3e2[_0x8b37('0x1e')]],'as':_0x4dd3e2['as'],'attributes':_0x4dd3e2[_0x8b37('0x1b')],'include':_0x4dd3e2[_0x8b37('0x1d')]?_[_0x8b37('0x1f')](_0x4dd3e2[_0x8b37('0x1d')],function(_0x38c1cb){return{'model':db[_0x38c1cb[_0x8b37('0x1e')]],'as':_0x38c1cb['as'],'attributes':_0x38c1cb['attributes'],'include':_0x38c1cb[_0x8b37('0x1d')]?_[_0x8b37('0x1f')](_0x38c1cb['include'],function(_0x484d01){return{'model':db[_0x484d01[_0x8b37('0x1e')]],'as':_0x484d01['as'],'attributes':_0x484d01[_0x8b37('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b37('0xa')](function(_0x13920a){logger[_0x8b37('0xb')]('GetDeskAccount',_0x5aba5b);logger['debug']('GetDeskAccount',_0x5aba5b,JSON[_0x8b37('0xf')](_0x13920a));_0x15a057(_0x13920a);})[_0x8b37('0x15')](function(_0x466fef){logger[_0x8b37('0x10')](_0x8b37('0x20'),_0x466fef[_0x8b37('0x13')],_0x5aba5b);_0x375451(_0x30cee2[_0x8b37('0x10')](0x1f4,_0x466fef[_0x8b37('0x13')]));});});};exports[_0x8b37('0x21')]=function(_0x41043f){var _0x44c5af=this;return new Promise(function(_0x4e6f15,_0x420510){return db['DeskAccount'][_0x8b37('0x22')]({'raw':_0x41043f['options']?_0x41043f[_0x8b37('0x18')][_0x8b37('0x19')]===undefined?!![]:![]:!![],'where':_0x41043f['options']?_0x41043f[_0x8b37('0x18')][_0x8b37('0x1a')]||null:null,'attributes':_0x41043f[_0x8b37('0x18')]?_0x41043f[_0x8b37('0x18')][_0x8b37('0x1b')]||null:null,'include':_0x41043f[_0x8b37('0x18')]?_0x41043f['options'][_0x8b37('0x1d')]?_['map'](_0x41043f['options'][_0x8b37('0x1d')],function(_0x2eb154){return{'model':db[_0x2eb154[_0x8b37('0x1e')]],'as':_0x2eb154['as'],'attributes':_0x2eb154[_0x8b37('0x1b')],'include':_0x2eb154['include']?_[_0x8b37('0x1f')](_0x2eb154['include'],function(_0x5d5255){return{'model':db[_0x5d5255[_0x8b37('0x1e')]],'as':_0x5d5255['as'],'attributes':_0x5d5255[_0x8b37('0x1b')],'include':_0x5d5255[_0x8b37('0x1d')]?_['map'](_0x5d5255[_0x8b37('0x1d')],function(_0x1dcf3c){return{'model':db[_0x1dcf3c['model']],'as':_0x1dcf3c['as'],'attributes':_0x1dcf3c[_0x8b37('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b37('0xa')](function(_0x2b4245){logger[_0x8b37('0xb')](_0x8b37('0x21'),_0x41043f);logger[_0x8b37('0xd')](_0x8b37('0x21'),_0x41043f,JSON[_0x8b37('0xf')](_0x2b4245));_0x4e6f15(_0x2b4245);})[_0x8b37('0x15')](function(_0x2fe2cb){logger[_0x8b37('0x10')](_0x8b37('0x21'),_0x2fe2cb[_0x8b37('0x13')],_0x41043f);_0x420510(_0x44c5af['error'](0x1f4,_0x2fe2cb[_0x8b37('0x13')]));});});}; \ No newline at end of file +var _0xc9c7=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','catch','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','info','GetDeskAccount','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x581927,_0x3b393c){var _0xad44fb=function(_0x232248){while(--_0x232248){_0x581927['push'](_0x581927['shift']());}};_0xad44fb(++_0x3b393c);}(_0xc9c7,0x191));var _0x7c9c=function(_0x3b1180,_0x9f595a){_0x3b1180=_0x3b1180-0x0;var _0x22056f=_0xc9c7[_0x3b1180];return _0x22056f;};'use strict';var _=require(_0x7c9c('0x0'));var util=require(_0x7c9c('0x1'));var moment=require(_0x7c9c('0x2'));var BPromise=require(_0x7c9c('0x3'));var rs=require(_0x7c9c('0x4'));var fs=require('fs');var Redis=require(_0x7c9c('0x5'));var db=require(_0x7c9c('0x6'))['db'];var utils=require(_0x7c9c('0x7'));var logger=require(_0x7c9c('0x8'))(_0x7c9c('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c9c('0xa'));var client=jayson[_0x7c9c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0ada,_0x564c58,_0x3faba5){return new BPromise(function(_0x5a905b,_0x94f0a8){return client[_0x7c9c('0xc')](_0x4e0ada,_0x3faba5)[_0x7c9c('0xd')](function(_0x3d878e){logger['info']('DeskAccount,\x20%s,\x20%s',_0x564c58,_0x7c9c('0xe'));logger[_0x7c9c('0xf')](_0x7c9c('0x10'),_0x564c58,_0x7c9c('0xe'),JSON[_0x7c9c('0x11')](_0x3d878e));if(_0x3d878e[_0x7c9c('0x12')]){if(_0x3d878e[_0x7c9c('0x12')][_0x7c9c('0x13')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x564c58,_0x3d878e[_0x7c9c('0x12')]['message']);return _0x94f0a8(_0x3d878e['error'][_0x7c9c('0x14')]);}logger[_0x7c9c('0x12')](_0x7c9c('0x15'),_0x564c58,_0x3d878e[_0x7c9c('0x12')][_0x7c9c('0x14')]);return _0x5a905b(_0x3d878e[_0x7c9c('0x12')][_0x7c9c('0x14')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x564c58,_0x7c9c('0xe'));_0x5a905b(_0x3d878e['result']['message']);}})[_0x7c9c('0x16')](function(_0x21d93f){logger[_0x7c9c('0x12')]('DeskAccount,\x20%s,\x20%s',_0x564c58,_0x21d93f);_0x94f0a8(_0x21d93f);});});}exports['GetDeskAccount']=function(_0x261efc){var _0x32b530=this;return new Promise(function(_0x319690,_0x31b03a){return db[_0x7c9c('0x17')][_0x7c9c('0x18')]({'raw':_0x261efc[_0x7c9c('0x19')]?_0x261efc[_0x7c9c('0x19')][_0x7c9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x261efc[_0x7c9c('0x19')]?_0x261efc[_0x7c9c('0x19')]['where']||null:null,'attributes':_0x261efc[_0x7c9c('0x19')]?_0x261efc[_0x7c9c('0x19')][_0x7c9c('0x1b')]||null:null,'limit':_0x261efc[_0x7c9c('0x19')]?_0x261efc[_0x7c9c('0x19')][_0x7c9c('0x1c')]||null:null,'include':_0x261efc[_0x7c9c('0x19')]?_0x261efc[_0x7c9c('0x19')][_0x7c9c('0x1d')]?_[_0x7c9c('0x1e')](_0x261efc[_0x7c9c('0x19')][_0x7c9c('0x1d')],function(_0x42589d){return{'model':db[_0x42589d['model']],'as':_0x42589d['as'],'attributes':_0x42589d[_0x7c9c('0x1b')],'include':_0x42589d[_0x7c9c('0x1d')]?_[_0x7c9c('0x1e')](_0x42589d[_0x7c9c('0x1d')],function(_0x38c4c6){return{'model':db[_0x38c4c6[_0x7c9c('0x1f')]],'as':_0x38c4c6['as'],'attributes':_0x38c4c6['attributes'],'include':_0x38c4c6['include']?_[_0x7c9c('0x1e')](_0x38c4c6[_0x7c9c('0x1d')],function(_0x441f83){return{'model':db[_0x441f83[_0x7c9c('0x1f')]],'as':_0x441f83['as'],'attributes':_0x441f83[_0x7c9c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c9c('0xd')](function(_0x457ea6){logger[_0x7c9c('0x20')]('GetDeskAccount',_0x261efc);logger[_0x7c9c('0xf')](_0x7c9c('0x21'),_0x261efc,JSON[_0x7c9c('0x11')](_0x457ea6));_0x319690(_0x457ea6);})[_0x7c9c('0x16')](function(_0x2452b1){logger['error'](_0x7c9c('0x21'),_0x2452b1[_0x7c9c('0x14')],_0x261efc);_0x31b03a(_0x32b530['error'](0x1f4,_0x2452b1['message']));});});};exports[_0x7c9c('0x22')]=function(_0x1f04a1){var _0x37abdf=this;return new Promise(function(_0x5c7c96,_0x55a3c3){return db['DeskAccount'][_0x7c9c('0x23')]({'raw':_0x1f04a1[_0x7c9c('0x19')]?_0x1f04a1[_0x7c9c('0x19')][_0x7c9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f04a1[_0x7c9c('0x19')]?_0x1f04a1[_0x7c9c('0x19')][_0x7c9c('0x24')]||null:null,'attributes':_0x1f04a1[_0x7c9c('0x19')]?_0x1f04a1[_0x7c9c('0x19')][_0x7c9c('0x1b')]||null:null,'include':_0x1f04a1[_0x7c9c('0x19')]?_0x1f04a1['options'][_0x7c9c('0x1d')]?_['map'](_0x1f04a1[_0x7c9c('0x19')][_0x7c9c('0x1d')],function(_0x3ddfbb){return{'model':db[_0x3ddfbb['model']],'as':_0x3ddfbb['as'],'attributes':_0x3ddfbb[_0x7c9c('0x1b')],'include':_0x3ddfbb[_0x7c9c('0x1d')]?_[_0x7c9c('0x1e')](_0x3ddfbb[_0x7c9c('0x1d')],function(_0x13a6d2){return{'model':db[_0x13a6d2[_0x7c9c('0x1f')]],'as':_0x13a6d2['as'],'attributes':_0x13a6d2[_0x7c9c('0x1b')],'include':_0x13a6d2[_0x7c9c('0x1d')]?_[_0x7c9c('0x1e')](_0x13a6d2[_0x7c9c('0x1d')],function(_0x454b64){return{'model':db[_0x454b64[_0x7c9c('0x1f')]],'as':_0x454b64['as'],'attributes':_0x454b64[_0x7c9c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c9c('0xd')](function(_0x3f439d){logger['info'](_0x7c9c('0x22'),_0x1f04a1);logger[_0x7c9c('0xf')](_0x7c9c('0x22'),_0x1f04a1,JSON[_0x7c9c('0x11')](_0x3f439d));_0x5c7c96(_0x3f439d);})['catch'](function(_0x502a63){logger[_0x7c9c('0x12')](_0x7c9c('0x22'),_0x502a63[_0x7c9c('0x14')],_0x1f04a1);_0x55a3c3(_0x37abdf['error'](0x1f4,_0x502a63[_0x7c9c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 43212aa..62bc7f4 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52a7fa,_0xf983f2){var _0x4d7eca=function(_0x7b877f){while(--_0x7b877f){_0x52a7fa['push'](_0x52a7fa['shift']());}};_0x4d7eca(++_0xf983f2);}(_0x008c,0x188));var _0xc008=function(_0x2640fa,_0xaeaf32){_0x2640fa=_0x2640fa-0x0;var _0x5aa2cd=_0x008c[_0x2640fa];return _0x5aa2cd;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x3dff0f,_0x10e92b){var _0x21332a=function(_0x3d89fd){while(--_0x3d89fd){_0x3dff0f['push'](_0x3dff0f['shift']());}};_0x21332a(++_0x10e92b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cd65775..a0e7d2f 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 _0xdd1e=['STRING','sequelize'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xdd1e,0xbf));var _0xedd1=function(_0x5cf6f8,_0x131a81){_0x5cf6f8=_0x5cf6f8-0x0;var _0x162415=_0xdd1e[_0x5cf6f8];return _0x162415;};'use strict';var Sequelize=require(_0xedd1('0x0'));module['exports']={'name':{'type':Sequelize[_0xedd1('0x1')]},'description':{'type':Sequelize[_0xedd1('0x1')]}}; \ No newline at end of file +var _0xd6ab=['STRING','exports'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xd6ab,0xb1));var _0xbd6a=function(_0x5675b5,_0x53141f){_0x5675b5=_0x5675b5-0x0;var _0x3f4418=_0xd6ab[_0x5675b5];return _0x3f4418;};'use strict';var Sequelize=require('sequelize');module[_0xbd6a('0x0')]={'name':{'type':Sequelize[_0xbd6a('0x1')]},'description':{'type':Sequelize[_0xbd6a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c8b1c6e..2b798a5 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 _0xb49b=['getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','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','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find'];(function(_0x166cc1,_0x6da5b5){var _0x4aa750=function(_0x5eede9){while(--_0x5eede9){_0x166cc1['push'](_0x166cc1['shift']());}};_0x4aa750(++_0x6da5b5);}(_0xb49b,0x1a3));var _0xbb49=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb49b[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb49('0x1'));var rp=require(_0xbb49('0x2'));var moment=require('moment');var BPromise=require(_0xbb49('0x3'));var Mustache=require(_0xbb49('0x4'));var util=require('util');var path=require(_0xbb49('0x5'));var sox=require(_0xbb49('0x6'));var csv=require(_0xbb49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb49('0x8'));var _=require(_0xbb49('0x9'));var squel=require(_0xbb49('0xa'));var crypto=require(_0xbb49('0xb'));var jsforce=require(_0xbb49('0xc'));var deskjs=require(_0xbb49('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbb49('0xe'));var Papa=require(_0xbb49('0xf'));var Redis=require(_0xbb49('0x10'));var authService=require(_0xbb49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbb49('0x12'));var hardwareService=require(_0xbb49('0x13'));var logger=require(_0xbb49('0x14'))(_0xbb49('0x15'));var utils=require(_0xbb49('0x16'));var config=require(_0xbb49('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3171,_0x46d1f4){_0x46d1f4=_0x46d1f4||0xcc;return function(_0x363e2d){if(_0x363e2d){return _0x4f3171[_0xbb49('0x18')](_0x46d1f4);}return _0x4f3171[_0xbb49('0x19')](_0x46d1f4)['end']();};}function respondWithResult(_0x3efd71,_0x2cf130){_0x2cf130=_0x2cf130||0xc8;return function(_0x242f66){if(_0x242f66){return _0x3efd71[_0xbb49('0x19')](_0x2cf130)[_0xbb49('0x1a')](_0x242f66);}};}function respondWithFilteredResult(_0x1e5d23,_0x24209d){return function(_0x22f08e){if(_0x22f08e){var _0x36e583=typeof _0x24209d['offset']===_0xbb49('0x1b')&&typeof _0x24209d[_0xbb49('0x1c')]==='undefined';var _0x3587cc=_0x22f08e['count'];var _0x572f73=_0x36e583?0x0:_0x24209d['offset'];var _0x4b2250=_0x36e583?_0x22f08e[_0xbb49('0x1d')]:_0x24209d['offset']+_0x24209d['limit'];var _0x47bc84;if(_0x4b2250>=_0x3587cc){_0x4b2250=_0x3587cc;_0x47bc84=0xc8;}else{_0x47bc84=0xce;}_0x1e5d23['status'](_0x47bc84);return _0x1e5d23[_0xbb49('0x1e')](_0xbb49('0x1f'),_0x572f73+'-'+_0x4b2250+'/'+_0x3587cc)[_0xbb49('0x1a')](_0x22f08e);}return null;};}function patchUpdates(_0x4263d0){return function(_0x125644){try{jsonpatch[_0xbb49('0x20')](_0x125644,_0x4263d0,!![]);}catch(_0x133415){return BPromise[_0xbb49('0x21')](_0x133415);}return _0x125644['save']();};}function saveUpdates(_0x4725cb,_0x57d1d3){return function(_0x452ac6){if(_0x452ac6){return _0x452ac6[_0xbb49('0x22')](_0x4725cb)[_0xbb49('0x23')](function(_0x4f1d9c){return _0x4f1d9c;});}return null;};}function removeEntity(_0x25d378,_0x3de7c3){return function(_0x36a68c){if(_0x36a68c){return _0x36a68c[_0xbb49('0x24')]()['then'](function(){_0x25d378[_0xbb49('0x19')](0xcc)[_0xbb49('0x25')]();});}};}function handleEntityNotFound(_0x286534,_0x3f8939){return function(_0x25727a){if(!_0x25727a){_0x286534[_0xbb49('0x18')](0x194);}return _0x25727a;};}function handleError(_0x29ec57,_0x1789fc){_0x1789fc=_0x1789fc||0x1f4;return function(_0x15d835){logger['error'](_0x15d835['stack']);if(_0x15d835[_0xbb49('0x26')]){delete _0x15d835['name'];}_0x29ec57['status'](_0x1789fc)['send'](_0x15d835);};}exports[_0xbb49('0x27')]=function(_0x2ebe08,_0x30ad03){var _0x4ad4b6={},_0x2a338c={},_0xdea5bb={'count':0x0,'rows':[]};var _0x383e1b=_['map'](db[_0xbb49('0x28')][_0xbb49('0x29')],function(_0x12b53a){return{'name':_0x12b53a[_0xbb49('0x2a')],'type':_0x12b53a[_0xbb49('0x2b')][_0xbb49('0x2c')]};});_0x2a338c[_0xbb49('0x2d')]=_[_0xbb49('0x2e')](_0x383e1b,'name');_0x2a338c['query']=_[_0xbb49('0x2f')](_0x2ebe08[_0xbb49('0x30')]);_0x2a338c[_0xbb49('0x31')]=_[_0xbb49('0x32')](_0x2a338c[_0xbb49('0x2d')],_0x2a338c[_0xbb49('0x30')]);_0x4ad4b6[_0xbb49('0x33')]=_[_0xbb49('0x32')](_0x2a338c[_0xbb49('0x2d')],qs[_0xbb49('0x34')](_0x2ebe08[_0xbb49('0x30')]['fields']));_0x4ad4b6[_0xbb49('0x33')]=_0x4ad4b6['attributes'][_0xbb49('0x35')]?_0x4ad4b6[_0xbb49('0x33')]:_0x2a338c[_0xbb49('0x2d')];if(!_0x2ebe08['query']['hasOwnProperty'](_0xbb49('0x36'))){_0x4ad4b6['limit']=qs[_0xbb49('0x1c')](_0x2ebe08['query'][_0xbb49('0x1c')]);_0x4ad4b6[_0xbb49('0x37')]=qs['offset'](_0x2ebe08['query'][_0xbb49('0x37')]);}_0x4ad4b6[_0xbb49('0x38')]=qs[_0xbb49('0x39')](_0x2ebe08[_0xbb49('0x30')][_0xbb49('0x39')]);_0x4ad4b6[_0xbb49('0x3a')]=qs[_0xbb49('0x31')](_[_0xbb49('0x3b')](_0x2ebe08[_0xbb49('0x30')],_0x2a338c['filters']),_0x383e1b);if(_0x2ebe08[_0xbb49('0x30')]['filter']){_0x4ad4b6[_0xbb49('0x3a')]=_[_0xbb49('0x3c')](_0x4ad4b6[_0xbb49('0x3a')],{'$or':_[_0xbb49('0x2e')](_0x383e1b,function(_0x1e4c77){if(_0x1e4c77[_0xbb49('0x2b')]!==_0xbb49('0x3d')){var _0x6384e6={};_0x6384e6[_0x1e4c77[_0xbb49('0x26')]]={'$like':'%'+_0x2ebe08[_0xbb49('0x30')][_0xbb49('0x3e')]+'%'};return _0x6384e6;}})});}_0x4ad4b6=_[_0xbb49('0x3c')]({},_0x4ad4b6,_0x2ebe08[_0xbb49('0x3f')]);var _0x11a710={'where':_0x4ad4b6[_0xbb49('0x3a')]};return db[_0xbb49('0x28')][_0xbb49('0x1d')](_0x11a710)[_0xbb49('0x23')](function(_0x19f567){_0xdea5bb[_0xbb49('0x1d')]=_0x19f567;if(_0x2ebe08['query'][_0xbb49('0x40')]){_0x4ad4b6[_0xbb49('0x41')]=[{'all':!![]}];}return db[_0xbb49('0x28')][_0xbb49('0x42')](_0x4ad4b6);})[_0xbb49('0x23')](function(_0x468264){_0xdea5bb[_0xbb49('0x43')]=_0x468264;return _0xdea5bb;})['then'](respondWithFilteredResult(_0x30ad03,_0x4ad4b6))[_0xbb49('0x44')](handleError(_0x30ad03,null));};exports['show']=function(_0x467d9f,_0x4fa55d){var _0x1480f7={'raw':![],'where':{'id':_0x467d9f[_0xbb49('0x45')]['id']}},_0x5a5a7f={};_0x5a5a7f[_0xbb49('0x2d')]=_[_0xbb49('0x2f')](db[_0xbb49('0x28')][_0xbb49('0x29')]);_0x5a5a7f[_0xbb49('0x30')]=_['keys'](_0x467d9f['query']);_0x5a5a7f['filters']=_[_0xbb49('0x32')](_0x5a5a7f[_0xbb49('0x2d')],_0x5a5a7f[_0xbb49('0x30')]);_0x1480f7[_0xbb49('0x33')]=_['intersection'](_0x5a5a7f[_0xbb49('0x2d')],qs['fields'](_0x467d9f[_0xbb49('0x30')][_0xbb49('0x34')]));_0x1480f7[_0xbb49('0x33')]=_0x1480f7['attributes'][_0xbb49('0x35')]?_0x1480f7[_0xbb49('0x33')]:_0x5a5a7f[_0xbb49('0x2d')];if(_0x467d9f[_0xbb49('0x30')][_0xbb49('0x40')]){_0x1480f7['include']=[{'all':!![]}];}_0x1480f7=_['merge']({},_0x1480f7,_0x467d9f[_0xbb49('0x3f')]);return db[_0xbb49('0x28')]['find'](_0x1480f7)[_0xbb49('0x23')](handleEntityNotFound(_0x4fa55d,null))[_0xbb49('0x23')](respondWithResult(_0x4fa55d,null))[_0xbb49('0x44')](handleError(_0x4fa55d,null));};exports[_0xbb49('0x46')]=function(_0x9ad4e6,_0x54f581){return db[_0xbb49('0x28')][_0xbb49('0x46')](_0x9ad4e6[_0xbb49('0x47')],{})['then'](respondWithResult(_0x54f581,0xc9))['catch'](handleError(_0x54f581,null));};exports['update']=function(_0xfc4f36,_0x3a7b00){if(_0xfc4f36[_0xbb49('0x47')]['id']){delete _0xfc4f36[_0xbb49('0x47')]['id'];}return db['DeskConfiguration'][_0xbb49('0x48')]({'where':{'id':_0xfc4f36['params']['id']}})[_0xbb49('0x23')](handleEntityNotFound(_0x3a7b00,null))[_0xbb49('0x23')](saveUpdates(_0xfc4f36[_0xbb49('0x47')],null))['then'](respondWithResult(_0x3a7b00,null))[_0xbb49('0x44')](handleError(_0x3a7b00,null));};exports[_0xbb49('0x24')]=function(_0x112db7,_0x5aaa6a){return db[_0xbb49('0x28')]['find']({'where':{'id':_0x112db7[_0xbb49('0x45')]['id']}})[_0xbb49('0x23')](handleEntityNotFound(_0x5aaa6a,null))[_0xbb49('0x23')](removeEntity(_0x5aaa6a,null))[_0xbb49('0x44')](handleError(_0x5aaa6a,null));};exports[_0xbb49('0x49')]=function(_0x326072,_0x389584,_0x1b0264){var _0xc63151={};var _0x5c4ab8={};var _0x17c4fd;var _0x4c49c8;return db[_0xbb49('0x28')][_0xbb49('0x4a')]({'where':{'id':_0x326072[_0xbb49('0x45')]['id']}})[_0xbb49('0x23')](handleEntityNotFound(_0x389584,null))[_0xbb49('0x23')](function(_0x2c2a25){if(_0x2c2a25){_0x17c4fd=_0x2c2a25;_0x5c4ab8['model']=_[_0xbb49('0x2f')](db[_0xbb49('0x4b')][_0xbb49('0x29')]);_0x5c4ab8[_0xbb49('0x30')]=_[_0xbb49('0x2f')](_0x326072['query']);_0x5c4ab8['filters']=_[_0xbb49('0x32')](_0x5c4ab8['model'],_0x5c4ab8[_0xbb49('0x30')]);_0xc63151['attributes']=_[_0xbb49('0x32')](_0x5c4ab8[_0xbb49('0x2d')],qs[_0xbb49('0x34')](_0x326072['query'][_0xbb49('0x34')]));_0xc63151['attributes']=_0xc63151[_0xbb49('0x33')][_0xbb49('0x35')]?_0xc63151[_0xbb49('0x33')]:_0x5c4ab8['model'];_0xc63151['order']=qs[_0xbb49('0x39')](_0x326072[_0xbb49('0x30')][_0xbb49('0x39')]);_0xc63151[_0xbb49('0x3a')]=qs[_0xbb49('0x31')](_[_0xbb49('0x3b')](_0x326072[_0xbb49('0x30')],_0x5c4ab8[_0xbb49('0x31')]));if(_0x326072[_0xbb49('0x30')][_0xbb49('0x3e')]){_0xc63151[_0xbb49('0x3a')]=_[_0xbb49('0x3c')](_0xc63151[_0xbb49('0x3a')],{'$or':_[_0xbb49('0x2e')](_0xc63151[_0xbb49('0x33')],function(_0x149226){var _0x3dc386={};_0x3dc386[_0x149226]={'$like':'%'+_0x326072[_0xbb49('0x30')][_0xbb49('0x3e')]+'%'};return _0x3dc386;})});}_0xc63151=_[_0xbb49('0x3c')]({},_0xc63151,_0x326072[_0xbb49('0x3f')]);return _0x17c4fd[_0xbb49('0x49')](_0xc63151);}})[_0xbb49('0x23')](function(_0x58c3ee){if(_0x58c3ee){_0x4c49c8=_0x58c3ee[_0xbb49('0x35')];if(!_0x326072['query'][_0xbb49('0x4c')](_0xbb49('0x36'))){_0xc63151[_0xbb49('0x1c')]=qs[_0xbb49('0x1c')](_0x326072[_0xbb49('0x30')][_0xbb49('0x1c')]);_0xc63151['offset']=qs['offset'](_0x326072[_0xbb49('0x30')]['offset']);}return _0x17c4fd[_0xbb49('0x49')](_0xc63151);}})['then'](function(_0x5d673d){if(_0x5d673d){return _0x5d673d?{'count':_0x4c49c8,'rows':_0x5d673d}:null;}})[_0xbb49('0x23')](respondWithResult(_0x389584,null))[_0xbb49('0x44')](handleError(_0x389584,null));};exports['getSubjects']=function(_0x151bbb,_0x3cba8a,_0x5c30ec){var _0x26304c={};var _0x3eed1f={};var _0x3f7c52;var _0x51a779;return db['DeskConfiguration'][_0xbb49('0x4a')]({'where':{'id':_0x151bbb[_0xbb49('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cba8a,null))[_0xbb49('0x23')](function(_0x49da85){if(_0x49da85){_0x3f7c52=_0x49da85;_0x3eed1f[_0xbb49('0x2d')]=_[_0xbb49('0x2f')](db[_0xbb49('0x4b')][_0xbb49('0x29')]);_0x3eed1f[_0xbb49('0x30')]=_[_0xbb49('0x2f')](_0x151bbb[_0xbb49('0x30')]);_0x3eed1f['filters']=_['intersection'](_0x3eed1f['model'],_0x3eed1f[_0xbb49('0x30')]);_0x26304c[_0xbb49('0x33')]=_[_0xbb49('0x32')](_0x3eed1f[_0xbb49('0x2d')],qs[_0xbb49('0x34')](_0x151bbb[_0xbb49('0x30')][_0xbb49('0x34')]));_0x26304c[_0xbb49('0x33')]=_0x26304c['attributes'][_0xbb49('0x35')]?_0x26304c[_0xbb49('0x33')]:_0x3eed1f[_0xbb49('0x2d')];_0x26304c[_0xbb49('0x38')]=qs[_0xbb49('0x39')](_0x151bbb[_0xbb49('0x30')][_0xbb49('0x39')]);_0x26304c[_0xbb49('0x3a')]=qs[_0xbb49('0x31')](_[_0xbb49('0x3b')](_0x151bbb[_0xbb49('0x30')],_0x3eed1f[_0xbb49('0x31')]));if(_0x151bbb['query'][_0xbb49('0x3e')]){_0x26304c[_0xbb49('0x3a')]=_['merge'](_0x26304c[_0xbb49('0x3a')],{'$or':_[_0xbb49('0x2e')](_0x26304c[_0xbb49('0x33')],function(_0x57b14b){var _0x4fd190={};_0x4fd190[_0x57b14b]={'$like':'%'+_0x151bbb['query'][_0xbb49('0x3e')]+'%'};return _0x4fd190;})});}_0x26304c=_['merge']({},_0x26304c,_0x151bbb[_0xbb49('0x3f')]);return _0x3f7c52['getSubjects'](_0x26304c);}})['then'](function(_0x3d701c){if(_0x3d701c){_0x51a779=_0x3d701c[_0xbb49('0x35')];if(!_0x151bbb[_0xbb49('0x30')][_0xbb49('0x4c')](_0xbb49('0x36'))){_0x26304c[_0xbb49('0x1c')]=qs['limit'](_0x151bbb[_0xbb49('0x30')]['limit']);_0x26304c['offset']=qs[_0xbb49('0x37')](_0x151bbb[_0xbb49('0x30')]['offset']);}return _0x3f7c52[_0xbb49('0x4d')](_0x26304c);}})[_0xbb49('0x23')](function(_0x21d608){if(_0x21d608){return _0x21d608?{'count':_0x51a779,'rows':_0x21d608}:null;}})['then'](respondWithResult(_0x3cba8a,null))['catch'](handleError(_0x3cba8a,null));};exports[_0xbb49('0x4e')]=function(_0x472058,_0x311e16,_0x4562d7){var _0x3f8f23={};var _0x1a2bd7={};var _0x402087;var _0x5bdc22;return db[_0xbb49('0x28')][_0xbb49('0x4a')]({'where':{'id':_0x472058[_0xbb49('0x45')]['id']}})[_0xbb49('0x23')](handleEntityNotFound(_0x311e16,null))[_0xbb49('0x23')](function(_0x3171bb){if(_0x3171bb){_0x402087=_0x3171bb;_0x1a2bd7[_0xbb49('0x2d')]=_[_0xbb49('0x2f')](db[_0xbb49('0x4b')][_0xbb49('0x29')]);_0x1a2bd7[_0xbb49('0x30')]=_[_0xbb49('0x2f')](_0x472058[_0xbb49('0x30')]);_0x1a2bd7[_0xbb49('0x31')]=_['intersection'](_0x1a2bd7[_0xbb49('0x2d')],_0x1a2bd7[_0xbb49('0x30')]);_0x3f8f23[_0xbb49('0x33')]=_[_0xbb49('0x32')](_0x1a2bd7[_0xbb49('0x2d')],qs[_0xbb49('0x34')](_0x472058[_0xbb49('0x30')]['fields']));_0x3f8f23[_0xbb49('0x33')]=_0x3f8f23[_0xbb49('0x33')][_0xbb49('0x35')]?_0x3f8f23['attributes']:_0x1a2bd7[_0xbb49('0x2d')];_0x3f8f23[_0xbb49('0x38')]=qs[_0xbb49('0x39')](_0x472058[_0xbb49('0x30')][_0xbb49('0x39')]);_0x3f8f23[_0xbb49('0x3a')]=qs[_0xbb49('0x31')](_[_0xbb49('0x3b')](_0x472058[_0xbb49('0x30')],_0x1a2bd7[_0xbb49('0x31')]));if(_0x472058[_0xbb49('0x30')][_0xbb49('0x3e')]){_0x3f8f23[_0xbb49('0x3a')]=_[_0xbb49('0x3c')](_0x3f8f23[_0xbb49('0x3a')],{'$or':_[_0xbb49('0x2e')](_0x3f8f23[_0xbb49('0x33')],function(_0x50c440){var _0x356836={};_0x356836[_0x50c440]={'$like':'%'+_0x472058['query'][_0xbb49('0x3e')]+'%'};return _0x356836;})});}_0x3f8f23=_['merge']({},_0x3f8f23,_0x472058[_0xbb49('0x3f')]);return _0x402087[_0xbb49('0x4e')](_0x3f8f23);}})[_0xbb49('0x23')](function(_0x262f05){if(_0x262f05){_0x5bdc22=_0x262f05[_0xbb49('0x35')];if(!_0x472058['query'][_0xbb49('0x4c')](_0xbb49('0x36'))){_0x3f8f23[_0xbb49('0x1c')]=qs[_0xbb49('0x1c')](_0x472058['query'][_0xbb49('0x1c')]);_0x3f8f23['offset']=qs['offset'](_0x472058['query'][_0xbb49('0x37')]);}return _0x402087[_0xbb49('0x4e')](_0x3f8f23);}})[_0xbb49('0x23')](function(_0x32b40f){if(_0x32b40f){return _0x32b40f?{'count':_0x5bdc22,'rows':_0x32b40f}:null;}})[_0xbb49('0x23')](respondWithResult(_0x311e16,null))[_0xbb49('0x44')](handleError(_0x311e16,null));};exports[_0xbb49('0x4f')]=function(_0x27a4c3,_0x4590a7,_0x15f980){var _0x1142a2={};var _0x4b523a={};var _0x34d893;var _0x28371b;return db[_0xbb49('0x28')][_0xbb49('0x4a')]({'where':{'id':_0x27a4c3[_0xbb49('0x45')]['id']}})[_0xbb49('0x23')](handleEntityNotFound(_0x4590a7,null))[_0xbb49('0x23')](function(_0x3c1b18){if(_0x3c1b18){_0x34d893=_0x3c1b18;_0x4b523a['model']=_[_0xbb49('0x2f')](db[_0xbb49('0x50')][_0xbb49('0x29')]);_0x4b523a[_0xbb49('0x30')]=_['keys'](_0x27a4c3[_0xbb49('0x30')]);_0x4b523a[_0xbb49('0x31')]=_['intersection'](_0x4b523a[_0xbb49('0x2d')],_0x4b523a[_0xbb49('0x30')]);_0x1142a2['attributes']=_[_0xbb49('0x32')](_0x4b523a['model'],qs[_0xbb49('0x34')](_0x27a4c3[_0xbb49('0x30')][_0xbb49('0x34')]));_0x1142a2['attributes']=_0x1142a2['attributes'][_0xbb49('0x35')]?_0x1142a2[_0xbb49('0x33')]:_0x4b523a[_0xbb49('0x2d')];_0x1142a2['order']=qs[_0xbb49('0x39')](_0x27a4c3['query'][_0xbb49('0x39')]);_0x1142a2['where']=qs[_0xbb49('0x31')](_[_0xbb49('0x3b')](_0x27a4c3[_0xbb49('0x30')],_0x4b523a[_0xbb49('0x31')]));if(_0x27a4c3[_0xbb49('0x30')][_0xbb49('0x3e')]){_0x1142a2[_0xbb49('0x3a')]=_[_0xbb49('0x3c')](_0x1142a2[_0xbb49('0x3a')],{'$or':_[_0xbb49('0x2e')](_0x1142a2[_0xbb49('0x33')],function(_0x270b1a){var _0xb1fc48={};_0xb1fc48[_0x270b1a]={'$like':'%'+_0x27a4c3[_0xbb49('0x30')][_0xbb49('0x3e')]+'%'};return _0xb1fc48;})});}_0x1142a2=_[_0xbb49('0x3c')]({},_0x1142a2,_0x27a4c3['options']);return _0x34d893[_0xbb49('0x4f')](_0x1142a2);}})['then'](function(_0x1ede00){if(_0x1ede00){_0x28371b=_0x1ede00[_0xbb49('0x35')];if(!_0x27a4c3[_0xbb49('0x30')]['hasOwnProperty'](_0xbb49('0x36'))){_0x1142a2[_0xbb49('0x1c')]=qs[_0xbb49('0x1c')](_0x27a4c3[_0xbb49('0x30')][_0xbb49('0x1c')]);_0x1142a2[_0xbb49('0x37')]=qs[_0xbb49('0x37')](_0x27a4c3[_0xbb49('0x30')][_0xbb49('0x37')]);}return _0x34d893[_0xbb49('0x4f')](_0x1142a2);}})[_0xbb49('0x23')](function(_0x4b18c6){if(_0x4b18c6){return _0x4b18c6?{'count':_0x28371b,'rows':_0x4b18c6}:null;}})[_0xbb49('0x23')](respondWithResult(_0x4590a7,null))[_0xbb49('0x44')](handleError(_0x4590a7,null));};exports['setTags']=function(_0x4236fe,_0x1bd06c,_0x301035){if(_0x4236fe[_0xbb49('0x47')]['id']){delete _0x4236fe[_0xbb49('0x47')]['id'];}return db['DeskConfiguration'][_0xbb49('0x4a')]({'where':{'id':_0x4236fe[_0xbb49('0x45')]['id']}})['then'](handleEntityNotFound(_0x1bd06c,null))['then'](function(_0x4c37d1){if(_0x4c37d1){return _0x4c37d1['setTags'](_0x4236fe[_0xbb49('0x47')][_0xbb49('0x51')]||[]);}return null;})[_0xbb49('0x23')](respondWithResult(_0x1bd06c,null))['catch'](handleError(_0x1bd06c,null));}; \ No newline at end of file +var _0xa8ae=['findOne','hasOwnProperty','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','update','then','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','getFields','DeskField','order','getSubjects','getDescriptions'];(function(_0x50336c,_0x27faf0){var _0x1b3cc5=function(_0x15237e){while(--_0x15237e){_0x50336c['push'](_0x50336c['shift']());}};_0x1b3cc5(++_0x27faf0);}(_0xa8ae,0x1aa));var _0xea8a=function(_0x20655f,_0x1d48c0){_0x20655f=_0x20655f-0x0;var _0x4c3f5a=_0xa8ae[_0x20655f];return _0x4c3f5a;};'use strict';var emlformat=require(_0xea8a('0x0'));var rimraf=require(_0xea8a('0x1'));var zipdir=require(_0xea8a('0x2'));var jsonpatch=require(_0xea8a('0x3'));var rp=require(_0xea8a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xea8a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xea8a('0x6'));var csv=require(_0xea8a('0x7'));var ejs=require(_0xea8a('0x8'));var fs=require('fs');var fs_extra=require(_0xea8a('0x9'));var _=require('lodash');var squel=require(_0xea8a('0xa'));var crypto=require('crypto');var jsforce=require(_0xea8a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xea8a('0x7'));var querystring=require(_0xea8a('0xc'));var Papa=require(_0xea8a('0xd'));var Redis=require(_0xea8a('0xe'));var authService=require(_0xea8a('0xf'));var qs=require(_0xea8a('0x10'));var as=require(_0xea8a('0x11'));var hardwareService=require(_0xea8a('0x12'));var logger=require('../../config/logger')(_0xea8a('0x13'));var utils=require(_0xea8a('0x14'));var config=require(_0xea8a('0x15'));var licenseUtil=require(_0xea8a('0x16'));var db=require(_0xea8a('0x17'))['db'];function respondWithStatusCode(_0x22b066,_0x5ddd99){_0x5ddd99=_0x5ddd99||0xcc;return function(_0x420e61){if(_0x420e61){return _0x22b066[_0xea8a('0x18')](_0x5ddd99);}return _0x22b066[_0xea8a('0x19')](_0x5ddd99)['end']();};}function respondWithResult(_0xa3fd2e,_0x5615e8){_0x5615e8=_0x5615e8||0xc8;return function(_0x4028a0){if(_0x4028a0){return _0xa3fd2e[_0xea8a('0x19')](_0x5615e8)['json'](_0x4028a0);}};}function respondWithFilteredResult(_0x2c5b74,_0x201379){return function(_0x43605e){if(_0x43605e){var _0x41a4c1=typeof _0x201379['offset']===_0xea8a('0x1a')&&typeof _0x201379[_0xea8a('0x1b')]==='undefined';var _0x1c4fb3=_0x43605e['count'];var _0x23909e=_0x41a4c1?0x0:_0x201379[_0xea8a('0x1c')];var _0x11be4b=_0x41a4c1?_0x43605e[_0xea8a('0x1d')]:_0x201379['offset']+_0x201379[_0xea8a('0x1b')];var _0x143b85;if(_0x11be4b>=_0x1c4fb3){_0x11be4b=_0x1c4fb3;_0x143b85=0xc8;}else{_0x143b85=0xce;}_0x2c5b74[_0xea8a('0x19')](_0x143b85);return _0x2c5b74[_0xea8a('0x1e')](_0xea8a('0x1f'),_0x23909e+'-'+_0x11be4b+'/'+_0x1c4fb3)[_0xea8a('0x20')](_0x43605e);}return null;};}function patchUpdates(_0x53ced3){return function(_0x595ce0){try{jsonpatch['apply'](_0x595ce0,_0x53ced3,!![]);}catch(_0x418033){return BPromise[_0xea8a('0x21')](_0x418033);}return _0x595ce0['save']();};}function saveUpdates(_0x59e1ab,_0x5476e1){return function(_0x98d70f){if(_0x98d70f){return _0x98d70f[_0xea8a('0x22')](_0x59e1ab)[_0xea8a('0x23')](function(_0x4a0640){return _0x4a0640;});}return null;};}function removeEntity(_0x5255a3,_0x233a6d){return function(_0x18bc72){if(_0x18bc72){return _0x18bc72['destroy']()[_0xea8a('0x23')](function(){_0x5255a3[_0xea8a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fde4f,_0x17ba6b){return function(_0x16bdf1){if(!_0x16bdf1){_0x1fde4f['sendStatus'](0x194);}return _0x16bdf1;};}function handleError(_0x43d91f,_0x24c5c6){_0x24c5c6=_0x24c5c6||0x1f4;return function(_0x24c760){logger['error'](_0x24c760[_0xea8a('0x24')]);if(_0x24c760[_0xea8a('0x25')]){delete _0x24c760[_0xea8a('0x25')];}_0x43d91f[_0xea8a('0x19')](_0x24c5c6)[_0xea8a('0x26')](_0x24c760);};}exports[_0xea8a('0x27')]=function(_0x20633b,_0x40bdc5){var _0x3e8a48={},_0x2307ce={},_0xeafc76={'count':0x0,'rows':[]};var _0x592eb0=_['map'](db[_0xea8a('0x28')][_0xea8a('0x29')],function(_0x5890d8){return{'name':_0x5890d8[_0xea8a('0x2a')],'type':_0x5890d8[_0xea8a('0x2b')][_0xea8a('0x2c')]};});_0x2307ce[_0xea8a('0x2d')]=_['map'](_0x592eb0,_0xea8a('0x25'));_0x2307ce[_0xea8a('0x2e')]=_['keys'](_0x20633b[_0xea8a('0x2e')]);_0x2307ce[_0xea8a('0x2f')]=_[_0xea8a('0x30')](_0x2307ce[_0xea8a('0x2d')],_0x2307ce[_0xea8a('0x2e')]);_0x3e8a48[_0xea8a('0x31')]=_['intersection'](_0x2307ce[_0xea8a('0x2d')],qs[_0xea8a('0x32')](_0x20633b[_0xea8a('0x2e')][_0xea8a('0x32')]));_0x3e8a48[_0xea8a('0x31')]=_0x3e8a48['attributes'][_0xea8a('0x33')]?_0x3e8a48[_0xea8a('0x31')]:_0x2307ce[_0xea8a('0x2d')];if(!_0x20633b[_0xea8a('0x2e')]['hasOwnProperty'](_0xea8a('0x34'))){_0x3e8a48[_0xea8a('0x1b')]=qs[_0xea8a('0x1b')](_0x20633b['query'][_0xea8a('0x1b')]);_0x3e8a48['offset']=qs[_0xea8a('0x1c')](_0x20633b['query'][_0xea8a('0x1c')]);}_0x3e8a48['order']=qs[_0xea8a('0x35')](_0x20633b[_0xea8a('0x2e')][_0xea8a('0x35')]);_0x3e8a48[_0xea8a('0x36')]=qs['filters'](_[_0xea8a('0x37')](_0x20633b[_0xea8a('0x2e')],_0x2307ce[_0xea8a('0x2f')]),_0x592eb0);if(_0x20633b[_0xea8a('0x2e')][_0xea8a('0x38')]){_0x3e8a48[_0xea8a('0x36')]=_[_0xea8a('0x39')](_0x3e8a48[_0xea8a('0x36')],{'$or':_[_0xea8a('0x3a')](_0x592eb0,function(_0x4250f7){if(_0x4250f7[_0xea8a('0x2b')]!==_0xea8a('0x3b')){var _0x436630={};_0x436630[_0x4250f7[_0xea8a('0x25')]]={'$like':'%'+_0x20633b[_0xea8a('0x2e')][_0xea8a('0x38')]+'%'};return _0x436630;}})});}_0x3e8a48=_[_0xea8a('0x39')]({},_0x3e8a48,_0x20633b[_0xea8a('0x3c')]);var _0x1017c4={'where':_0x3e8a48[_0xea8a('0x36')]};return db[_0xea8a('0x28')][_0xea8a('0x1d')](_0x1017c4)[_0xea8a('0x23')](function(_0x39bddf){_0xeafc76[_0xea8a('0x1d')]=_0x39bddf;if(_0x20633b[_0xea8a('0x2e')][_0xea8a('0x3d')]){_0x3e8a48[_0xea8a('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xea8a('0x3f')](_0x3e8a48);})[_0xea8a('0x23')](function(_0x154bb0){_0xeafc76[_0xea8a('0x40')]=_0x154bb0;return _0xeafc76;})['then'](respondWithFilteredResult(_0x40bdc5,_0x3e8a48))[_0xea8a('0x41')](handleError(_0x40bdc5,null));};exports[_0xea8a('0x42')]=function(_0xb1b672,_0x1788a3){var _0xe1af4d={'raw':![],'where':{'id':_0xb1b672[_0xea8a('0x43')]['id']}},_0x1e9a5b={};_0x1e9a5b[_0xea8a('0x2d')]=_[_0xea8a('0x44')](db[_0xea8a('0x28')]['rawAttributes']);_0x1e9a5b[_0xea8a('0x2e')]=_[_0xea8a('0x44')](_0xb1b672[_0xea8a('0x2e')]);_0x1e9a5b['filters']=_[_0xea8a('0x30')](_0x1e9a5b['model'],_0x1e9a5b[_0xea8a('0x2e')]);_0xe1af4d[_0xea8a('0x31')]=_[_0xea8a('0x30')](_0x1e9a5b[_0xea8a('0x2d')],qs[_0xea8a('0x32')](_0xb1b672[_0xea8a('0x2e')]['fields']));_0xe1af4d['attributes']=_0xe1af4d[_0xea8a('0x31')][_0xea8a('0x33')]?_0xe1af4d[_0xea8a('0x31')]:_0x1e9a5b[_0xea8a('0x2d')];if(_0xb1b672['query'][_0xea8a('0x3d')]){_0xe1af4d['include']=[{'all':!![]}];}_0xe1af4d=_['merge']({},_0xe1af4d,_0xb1b672[_0xea8a('0x3c')]);return db[_0xea8a('0x28')][_0xea8a('0x45')](_0xe1af4d)[_0xea8a('0x23')](handleEntityNotFound(_0x1788a3,null))[_0xea8a('0x23')](respondWithResult(_0x1788a3,null))[_0xea8a('0x41')](handleError(_0x1788a3,null));};exports[_0xea8a('0x46')]=function(_0x400bfa,_0x2da4f7){return db[_0xea8a('0x28')][_0xea8a('0x46')](_0x400bfa[_0xea8a('0x47')],{})['then'](respondWithResult(_0x2da4f7,0xc9))[_0xea8a('0x41')](handleError(_0x2da4f7,null));};exports[_0xea8a('0x22')]=function(_0x4e3c1e,_0x1d8dd1){if(_0x4e3c1e[_0xea8a('0x47')]['id']){delete _0x4e3c1e['body']['id'];}return db[_0xea8a('0x28')][_0xea8a('0x45')]({'where':{'id':_0x4e3c1e['params']['id']}})['then'](handleEntityNotFound(_0x1d8dd1,null))[_0xea8a('0x23')](saveUpdates(_0x4e3c1e['body'],null))[_0xea8a('0x23')](respondWithResult(_0x1d8dd1,null))[_0xea8a('0x41')](handleError(_0x1d8dd1,null));};exports[_0xea8a('0x48')]=function(_0x2d8131,_0x5e6e18){return db[_0xea8a('0x28')][_0xea8a('0x45')]({'where':{'id':_0x2d8131[_0xea8a('0x43')]['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0x5e6e18,null))[_0xea8a('0x23')](removeEntity(_0x5e6e18,null))[_0xea8a('0x41')](handleError(_0x5e6e18,null));};exports[_0xea8a('0x49')]=function(_0x384234,_0x16d057,_0x2a3b2d){var _0x5a1d0d={};var _0x512ce7={};var _0xc70c57;var _0x2064b3;return db[_0xea8a('0x28')]['findOne']({'where':{'id':_0x384234['params']['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0x16d057,null))[_0xea8a('0x23')](function(_0x46f885){if(_0x46f885){_0xc70c57=_0x46f885;_0x512ce7['model']=_['keys'](db[_0xea8a('0x4a')][_0xea8a('0x29')]);_0x512ce7[_0xea8a('0x2e')]=_[_0xea8a('0x44')](_0x384234[_0xea8a('0x2e')]);_0x512ce7[_0xea8a('0x2f')]=_[_0xea8a('0x30')](_0x512ce7[_0xea8a('0x2d')],_0x512ce7[_0xea8a('0x2e')]);_0x5a1d0d[_0xea8a('0x31')]=_[_0xea8a('0x30')](_0x512ce7[_0xea8a('0x2d')],qs[_0xea8a('0x32')](_0x384234[_0xea8a('0x2e')]['fields']));_0x5a1d0d[_0xea8a('0x31')]=_0x5a1d0d[_0xea8a('0x31')]['length']?_0x5a1d0d[_0xea8a('0x31')]:_0x512ce7[_0xea8a('0x2d')];_0x5a1d0d['order']=qs['sort'](_0x384234['query']['sort']);_0x5a1d0d[_0xea8a('0x36')]=qs['filters'](_[_0xea8a('0x37')](_0x384234['query'],_0x512ce7[_0xea8a('0x2f')]));if(_0x384234['query'][_0xea8a('0x38')]){_0x5a1d0d[_0xea8a('0x36')]=_['merge'](_0x5a1d0d[_0xea8a('0x36')],{'$or':_[_0xea8a('0x3a')](_0x5a1d0d[_0xea8a('0x31')],function(_0x2fd153){var _0x39d896={};_0x39d896[_0x2fd153]={'$like':'%'+_0x384234['query'][_0xea8a('0x38')]+'%'};return _0x39d896;})});}_0x5a1d0d=_[_0xea8a('0x39')]({},_0x5a1d0d,_0x384234[_0xea8a('0x3c')]);return _0xc70c57['getFields'](_0x5a1d0d);}})[_0xea8a('0x23')](function(_0xfbbe3d){if(_0xfbbe3d){_0x2064b3=_0xfbbe3d['length'];if(!_0x384234[_0xea8a('0x2e')]['hasOwnProperty']('nolimit')){_0x5a1d0d['limit']=qs[_0xea8a('0x1b')](_0x384234[_0xea8a('0x2e')][_0xea8a('0x1b')]);_0x5a1d0d[_0xea8a('0x1c')]=qs[_0xea8a('0x1c')](_0x384234['query'][_0xea8a('0x1c')]);}return _0xc70c57[_0xea8a('0x49')](_0x5a1d0d);}})[_0xea8a('0x23')](function(_0x1ac15d){if(_0x1ac15d){return _0x1ac15d?{'count':_0x2064b3,'rows':_0x1ac15d}:null;}})[_0xea8a('0x23')](respondWithResult(_0x16d057,null))[_0xea8a('0x41')](handleError(_0x16d057,null));};exports['getSubjects']=function(_0x2a1e18,_0xe1fc0,_0x32d881){var _0xbd815f={};var _0x12b7eb={};var _0x337289;var _0x4d7215;return db[_0xea8a('0x28')]['findOne']({'where':{'id':_0x2a1e18[_0xea8a('0x43')]['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0xe1fc0,null))['then'](function(_0x5e2cfa){if(_0x5e2cfa){_0x337289=_0x5e2cfa;_0x12b7eb[_0xea8a('0x2d')]=_[_0xea8a('0x44')](db['DeskField']['rawAttributes']);_0x12b7eb[_0xea8a('0x2e')]=_[_0xea8a('0x44')](_0x2a1e18['query']);_0x12b7eb[_0xea8a('0x2f')]=_[_0xea8a('0x30')](_0x12b7eb[_0xea8a('0x2d')],_0x12b7eb[_0xea8a('0x2e')]);_0xbd815f[_0xea8a('0x31')]=_[_0xea8a('0x30')](_0x12b7eb[_0xea8a('0x2d')],qs['fields'](_0x2a1e18[_0xea8a('0x2e')][_0xea8a('0x32')]));_0xbd815f['attributes']=_0xbd815f[_0xea8a('0x31')][_0xea8a('0x33')]?_0xbd815f[_0xea8a('0x31')]:_0x12b7eb[_0xea8a('0x2d')];_0xbd815f[_0xea8a('0x4b')]=qs[_0xea8a('0x35')](_0x2a1e18['query']['sort']);_0xbd815f[_0xea8a('0x36')]=qs['filters'](_['pick'](_0x2a1e18[_0xea8a('0x2e')],_0x12b7eb[_0xea8a('0x2f')]));if(_0x2a1e18['query'][_0xea8a('0x38')]){_0xbd815f[_0xea8a('0x36')]=_[_0xea8a('0x39')](_0xbd815f[_0xea8a('0x36')],{'$or':_[_0xea8a('0x3a')](_0xbd815f[_0xea8a('0x31')],function(_0xf12a07){var _0x34eedf={};_0x34eedf[_0xf12a07]={'$like':'%'+_0x2a1e18[_0xea8a('0x2e')][_0xea8a('0x38')]+'%'};return _0x34eedf;})});}_0xbd815f=_[_0xea8a('0x39')]({},_0xbd815f,_0x2a1e18['options']);return _0x337289[_0xea8a('0x4c')](_0xbd815f);}})[_0xea8a('0x23')](function(_0x1c5d04){if(_0x1c5d04){_0x4d7215=_0x1c5d04[_0xea8a('0x33')];if(!_0x2a1e18[_0xea8a('0x2e')]['hasOwnProperty']('nolimit')){_0xbd815f[_0xea8a('0x1b')]=qs['limit'](_0x2a1e18[_0xea8a('0x2e')]['limit']);_0xbd815f['offset']=qs['offset'](_0x2a1e18[_0xea8a('0x2e')]['offset']);}return _0x337289[_0xea8a('0x4c')](_0xbd815f);}})[_0xea8a('0x23')](function(_0x1062e3){if(_0x1062e3){return _0x1062e3?{'count':_0x4d7215,'rows':_0x1062e3}:null;}})[_0xea8a('0x23')](respondWithResult(_0xe1fc0,null))[_0xea8a('0x41')](handleError(_0xe1fc0,null));};exports[_0xea8a('0x4d')]=function(_0x4562ea,_0x2b8bf0,_0x458457){var _0x201393={};var _0x22f837={};var _0x5453dd;var _0x16c478;return db[_0xea8a('0x28')][_0xea8a('0x4e')]({'where':{'id':_0x4562ea[_0xea8a('0x43')]['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0x2b8bf0,null))[_0xea8a('0x23')](function(_0x5c2de6){if(_0x5c2de6){_0x5453dd=_0x5c2de6;_0x22f837[_0xea8a('0x2d')]=_[_0xea8a('0x44')](db['DeskField'][_0xea8a('0x29')]);_0x22f837[_0xea8a('0x2e')]=_[_0xea8a('0x44')](_0x4562ea[_0xea8a('0x2e')]);_0x22f837[_0xea8a('0x2f')]=_[_0xea8a('0x30')](_0x22f837['model'],_0x22f837[_0xea8a('0x2e')]);_0x201393[_0xea8a('0x31')]=_[_0xea8a('0x30')](_0x22f837[_0xea8a('0x2d')],qs[_0xea8a('0x32')](_0x4562ea['query'][_0xea8a('0x32')]));_0x201393[_0xea8a('0x31')]=_0x201393[_0xea8a('0x31')][_0xea8a('0x33')]?_0x201393['attributes']:_0x22f837['model'];_0x201393[_0xea8a('0x4b')]=qs[_0xea8a('0x35')](_0x4562ea[_0xea8a('0x2e')]['sort']);_0x201393[_0xea8a('0x36')]=qs['filters'](_[_0xea8a('0x37')](_0x4562ea[_0xea8a('0x2e')],_0x22f837[_0xea8a('0x2f')]));if(_0x4562ea[_0xea8a('0x2e')][_0xea8a('0x38')]){_0x201393[_0xea8a('0x36')]=_['merge'](_0x201393[_0xea8a('0x36')],{'$or':_[_0xea8a('0x3a')](_0x201393[_0xea8a('0x31')],function(_0x1e4ccd){var _0x338a0b={};_0x338a0b[_0x1e4ccd]={'$like':'%'+_0x4562ea[_0xea8a('0x2e')][_0xea8a('0x38')]+'%'};return _0x338a0b;})});}_0x201393=_[_0xea8a('0x39')]({},_0x201393,_0x4562ea[_0xea8a('0x3c')]);return _0x5453dd['getDescriptions'](_0x201393);}})[_0xea8a('0x23')](function(_0x4e9778){if(_0x4e9778){_0x16c478=_0x4e9778[_0xea8a('0x33')];if(!_0x4562ea[_0xea8a('0x2e')][_0xea8a('0x4f')](_0xea8a('0x34'))){_0x201393['limit']=qs[_0xea8a('0x1b')](_0x4562ea[_0xea8a('0x2e')][_0xea8a('0x1b')]);_0x201393[_0xea8a('0x1c')]=qs[_0xea8a('0x1c')](_0x4562ea[_0xea8a('0x2e')][_0xea8a('0x1c')]);}return _0x5453dd[_0xea8a('0x4d')](_0x201393);}})['then'](function(_0x3367d2){if(_0x3367d2){return _0x3367d2?{'count':_0x16c478,'rows':_0x3367d2}:null;}})[_0xea8a('0x23')](respondWithResult(_0x2b8bf0,null))[_0xea8a('0x41')](handleError(_0x2b8bf0,null));};exports['getTags']=function(_0x1042f7,_0x1c6f81,_0xcd9328){var _0x57dbc8={};var _0x3ba5eb={};var _0x2e041a;var _0xef202b;return db[_0xea8a('0x28')][_0xea8a('0x4e')]({'where':{'id':_0x1042f7[_0xea8a('0x43')]['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0x1c6f81,null))[_0xea8a('0x23')](function(_0x543e70){if(_0x543e70){_0x2e041a=_0x543e70;_0x3ba5eb[_0xea8a('0x2d')]=_[_0xea8a('0x44')](db[_0xea8a('0x50')][_0xea8a('0x29')]);_0x3ba5eb[_0xea8a('0x2e')]=_[_0xea8a('0x44')](_0x1042f7[_0xea8a('0x2e')]);_0x3ba5eb['filters']=_['intersection'](_0x3ba5eb['model'],_0x3ba5eb[_0xea8a('0x2e')]);_0x57dbc8[_0xea8a('0x31')]=_[_0xea8a('0x30')](_0x3ba5eb[_0xea8a('0x2d')],qs['fields'](_0x1042f7[_0xea8a('0x2e')][_0xea8a('0x32')]));_0x57dbc8[_0xea8a('0x31')]=_0x57dbc8[_0xea8a('0x31')]['length']?_0x57dbc8[_0xea8a('0x31')]:_0x3ba5eb[_0xea8a('0x2d')];_0x57dbc8[_0xea8a('0x4b')]=qs[_0xea8a('0x35')](_0x1042f7[_0xea8a('0x2e')]['sort']);_0x57dbc8[_0xea8a('0x36')]=qs[_0xea8a('0x2f')](_[_0xea8a('0x37')](_0x1042f7[_0xea8a('0x2e')],_0x3ba5eb[_0xea8a('0x2f')]));if(_0x1042f7[_0xea8a('0x2e')]['filter']){_0x57dbc8[_0xea8a('0x36')]=_['merge'](_0x57dbc8['where'],{'$or':_[_0xea8a('0x3a')](_0x57dbc8[_0xea8a('0x31')],function(_0x2c6717){var _0x1baa9e={};_0x1baa9e[_0x2c6717]={'$like':'%'+_0x1042f7[_0xea8a('0x2e')][_0xea8a('0x38')]+'%'};return _0x1baa9e;})});}_0x57dbc8=_['merge']({},_0x57dbc8,_0x1042f7[_0xea8a('0x3c')]);return _0x2e041a[_0xea8a('0x51')](_0x57dbc8);}})[_0xea8a('0x23')](function(_0x3a3fe3){if(_0x3a3fe3){_0xef202b=_0x3a3fe3[_0xea8a('0x33')];if(!_0x1042f7['query'][_0xea8a('0x4f')](_0xea8a('0x34'))){_0x57dbc8[_0xea8a('0x1b')]=qs['limit'](_0x1042f7['query']['limit']);_0x57dbc8['offset']=qs[_0xea8a('0x1c')](_0x1042f7[_0xea8a('0x2e')][_0xea8a('0x1c')]);}return _0x2e041a['getTags'](_0x57dbc8);}})['then'](function(_0x41fc57){if(_0x41fc57){return _0x41fc57?{'count':_0xef202b,'rows':_0x41fc57}:null;}})['then'](respondWithResult(_0x1c6f81,null))[_0xea8a('0x41')](handleError(_0x1c6f81,null));};exports[_0xea8a('0x52')]=function(_0x1919d0,_0x33c5c7,_0x42f235){if(_0x1919d0[_0xea8a('0x47')]['id']){delete _0x1919d0[_0xea8a('0x47')]['id'];}return db['DeskConfiguration'][_0xea8a('0x4e')]({'where':{'id':_0x1919d0[_0xea8a('0x43')]['id']}})[_0xea8a('0x23')](handleEntityNotFound(_0x33c5c7,null))[_0xea8a('0x23')](function(_0x12afc6){if(_0x12afc6){return _0x12afc6[_0xea8a('0x52')](_0x1919d0[_0xea8a('0x47')][_0xea8a('0x53')]||[]);}return null;})['then'](respondWithResult(_0x33c5c7,null))[_0xea8a('0x41')](handleError(_0x33c5c7,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index aac5f1c..023d551 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 _0x9141=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x8cf362,_0x3a26a3){var _0x2ff5d4=function(_0x54b216){while(--_0x54b216){_0x8cf362['push'](_0x8cf362['shift']());}};_0x2ff5d4(++_0x3a26a3);}(_0x9141,0xcd));var _0x1914=function(_0x5e4780,_0x971530){_0x5e4780=_0x5e4780-0x0;var _0x4a0283=_0x9141[_0x5e4780];return _0x4a0283;};'use strict';var _=require(_0x1914('0x0'));var util=require(_0x1914('0x1'));var logger=require(_0x1914('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1914('0x3'));var rp=require(_0x1914('0x4'));var fs=require('fs');var path=require(_0x1914('0x5'));var rimraf=require(_0x1914('0x6'));var config=require(_0x1914('0x7'));var attributes=require(_0x1914('0x8'));module[_0x1914('0x9')]=function(_0x51a9da,_0x114cb3){return _0x51a9da[_0x1914('0xa')](_0x1914('0xb'),attributes,{'tableName':_0x1914('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1685=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x567751,_0x4287c3){var _0x21a84c=function(_0x2471d4){while(--_0x2471d4){_0x567751['push'](_0x567751['shift']());}};_0x21a84c(++_0x4287c3);}(_0x1685,0x196));var _0x5168=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x1685[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x5168('0x0'));var util=require(_0x5168('0x1'));var logger=require(_0x5168('0x2'))(_0x5168('0x3'));var moment=require(_0x5168('0x4'));var BPromise=require(_0x5168('0x5'));var rp=require(_0x5168('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5168('0x7'));var config=require(_0x5168('0x8'));var attributes=require(_0x5168('0x9'));module[_0x5168('0xa')]=function(_0x23d763,_0x56f8eb){return _0x23d763[_0x5168('0xb')](_0x5168('0xc'),attributes,{'tableName':_0x5168('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 57decc4..8d6e17f 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 _0xdfdd=['request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0xdfdd,0x104));var _0xddfd=function(_0x29ba90,_0x31ea0c){_0x29ba90=_0x29ba90-0x0;var _0x454995=_0xdfdd[_0x29ba90];return _0x454995;};'use strict';var _=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var moment=require(_0xddfd('0x2'));var BPromise=require(_0xddfd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddfd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddfd('0x5'));var logger=require('../../config/logger')(_0xddfd('0x6'));var config=require(_0xddfd('0x7'));var jayson=require(_0xddfd('0x8'));var client=jayson[_0xddfd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25fcbc,_0x485ede,_0x2e8f21){return new BPromise(function(_0x45bdd0,_0xf134d7){return client[_0xddfd('0xa')](_0x25fcbc,_0x2e8f21)[_0xddfd('0xb')](function(_0x2a3b1e){logger['info'](_0xddfd('0xc'),_0x485ede,_0xddfd('0xd'));logger['debug'](_0xddfd('0xe'),_0x485ede,_0xddfd('0xd'),JSON[_0xddfd('0xf')](_0x2a3b1e));if(_0x2a3b1e[_0xddfd('0x10')]){if(_0x2a3b1e[_0xddfd('0x10')]['code']===0x1f4){logger[_0xddfd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x485ede,_0x2a3b1e[_0xddfd('0x10')]['message']);return _0xf134d7(_0x2a3b1e[_0xddfd('0x10')]['message']);}logger[_0xddfd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x485ede,_0x2a3b1e[_0xddfd('0x10')][_0xddfd('0x11')]);return _0x45bdd0(_0x2a3b1e[_0xddfd('0x10')][_0xddfd('0x11')]);}else{logger[_0xddfd('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x485ede,_0xddfd('0xd'));_0x45bdd0(_0x2a3b1e[_0xddfd('0x13')][_0xddfd('0x11')]);}})[_0xddfd('0x14')](function(_0xa85d01){logger[_0xddfd('0x10')](_0xddfd('0xc'),_0x485ede,_0xa85d01);_0xf134d7(_0xa85d01);});});} \ No newline at end of file +var _0xe683=['info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0xfecbad,_0x5915f8){var _0x5e1806=function(_0x2a46ec){while(--_0x2a46ec){_0xfecbad['push'](_0xfecbad['shift']());}};_0x5e1806(++_0x5915f8);}(_0xe683,0x1d7));var _0x3e68=function(_0x29572f,_0x24b83e){_0x29572f=_0x29572f-0x0;var _0x4ba100=_0xe683[_0x29572f];return _0x4ba100;};'use strict';var _=require(_0x3e68('0x0'));var util=require(_0x3e68('0x1'));var moment=require(_0x3e68('0x2'));var BPromise=require(_0x3e68('0x3'));var rs=require(_0x3e68('0x4'));var fs=require('fs');var Redis=require(_0x3e68('0x5'));var db=require(_0x3e68('0x6'))['db'];var utils=require(_0x3e68('0x7'));var logger=require(_0x3e68('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3e68('0x9'));var client=jayson[_0x3e68('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfd39,_0xbbe4b1,_0x5d8380){return new BPromise(function(_0x48aab0,_0x346080){return client[_0x3e68('0xb')](_0x1cfd39,_0x5d8380)['then'](function(_0x5acf9a){logger[_0x3e68('0xc')](_0x3e68('0xd'),_0xbbe4b1,'request\x20sent');logger[_0x3e68('0xe')](_0x3e68('0xf'),_0xbbe4b1,_0x3e68('0x10'),JSON[_0x3e68('0x11')](_0x5acf9a));if(_0x5acf9a[_0x3e68('0x12')]){if(_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x13')]===0x1f4){logger['error'](_0x3e68('0xd'),_0xbbe4b1,_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x14')]);return _0x346080(_0x5acf9a['error'][_0x3e68('0x14')]);}logger[_0x3e68('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xbbe4b1,_0x5acf9a[_0x3e68('0x12')][_0x3e68('0x14')]);return _0x48aab0(_0x5acf9a['error'][_0x3e68('0x14')]);}else{logger[_0x3e68('0xc')](_0x3e68('0xd'),_0xbbe4b1,_0x3e68('0x10'));_0x48aab0(_0x5acf9a[_0x3e68('0x15')]['message']);}})[_0x3e68('0x16')](function(_0x3b663d){logger[_0x3e68('0x12')](_0x3e68('0xd'),_0xbbe4b1,_0x3b663d);_0x346080(_0x3b663d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5cb0ee5..9a566af 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 _0xa9fc=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x35a9ac,_0x311deb){var _0x37d5ce=function(_0x14853c){while(--_0x14853c){_0x35a9ac['push'](_0x35a9ac['shift']());}};_0x37d5ce(++_0x311deb);}(_0xa9fc,0x19f));var _0xca9f=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xa9fc[_0x5c3ae9];return _0x3f5950;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')]('/',auth[_0xca9f('0xa')](),controller[_0xca9f('0xd')]);router[_0xca9f('0xe')](_0xca9f('0x9'),auth['isAuthenticated'](),controller[_0xca9f('0xf')]);router[_0xca9f('0x10')](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller['destroy']);module[_0xca9f('0x11')]=router; \ No newline at end of file +var _0x8b5c=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0xc2529c,_0xc4cf75){var _0x9d3207=function(_0x14e4cb){while(--_0x14e4cb){_0xc2529c['push'](_0xc2529c['shift']());}};_0x9d3207(++_0xc4cf75);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x3e4108,_0xb39ead){_0x3e4108=_0x3e4108-0x0;var _0x3ed4fc=_0x8b5c[_0x3e4108];return _0x3ed4fc;};'use strict';var multer=require('multer');var util=require(_0xc8b5('0x0'));var path=require('path');var timeout=require(_0xc8b5('0x1'));var express=require(_0xc8b5('0x2'));var router=express['Router']();var fs_extra=require(_0xc8b5('0x3'));var auth=require(_0xc8b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b5('0x5'));var controller=require('./intDeskField.controller');router[_0xc8b5('0x6')]('/',auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x8')]);router[_0xc8b5('0x6')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xa')]);router[_0xc8b5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc8b5('0xc')]);router[_0xc8b5('0xd')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xe')]);router[_0xc8b5('0xf')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x10')]);module[_0xc8b5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8d4196b..51d8d10 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 _0x41d9=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1a03cc,_0x19bdb1){var _0x44e5d9=function(_0x216b87){while(--_0x216b87){_0x1a03cc['push'](_0x1a03cc['shift']());}};_0x44e5d9(++_0x19bdb1);}(_0x41d9,0x98));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x941d('0x0'));module[_0x941d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x941d('0x2'),_0x941d('0x3'),_0x941d('0x4'),_0x941d('0x5'),_0x941d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x941d('0x7')]},'keyType':{'type':Sequelize[_0x941d('0x8')](_0x941d('0x2'),_0x941d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x941d('0x7')]},'idField':{'type':Sequelize[_0x941d('0x7')]},'nameField':{'type':Sequelize[_0x941d('0x7')]},'customField':{'type':Sequelize[_0x941d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x941d('0x7')]}}; \ No newline at end of file +var _0x8371=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8371,0x18d));var _0x1837=function(_0x40a5da,_0x2cacae){_0x40a5da=_0x40a5da-0x0;var _0x503504=_0x8371[_0x40a5da];return _0x503504;};'use strict';var Sequelize=require(_0x1837('0x0'));module[_0x1837('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1837('0x2'),_0x1837('0x3'),_0x1837('0x4'),_0x1837('0x5'),_0x1837('0x6')),'defaultValue':_0x1837('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1837('0x7')]},'keyType':{'type':Sequelize[_0x1837('0x8')](_0x1837('0x2'),'variable',_0x1837('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1837('0x7')]},'nameField':{'type':Sequelize[_0x1837('0x7')]},'customField':{'type':Sequelize[_0x1837('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 999642f..c7e92c3 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 _0xd634=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','DeskField','fieldName','type','key','model'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xd634,0xf4));var _0x4d63=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xd634[_0x10f68e];return _0x4c8372;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d63('0x0'));var zipdir=require(_0x4d63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d63('0x2'));var BPromise=require(_0x4d63('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d63('0x4'));var sox=require(_0x4d63('0x5'));var csv=require(_0x4d63('0x6'));var ejs=require(_0x4d63('0x7'));var fs=require('fs');var fs_extra=require(_0x4d63('0x8'));var _=require(_0x4d63('0x9'));var squel=require(_0x4d63('0xa'));var crypto=require(_0x4d63('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d63('0xc'));var authService=require(_0x4d63('0xd'));var qs=require(_0x4d63('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d63('0xf'));var logger=require(_0x4d63('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4d63('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d63('0x12'))['db'];function respondWithStatusCode(_0x35ab93,_0x19a9dd){_0x19a9dd=_0x19a9dd||0xcc;return function(_0xb30e76){if(_0xb30e76){return _0x35ab93[_0x4d63('0x13')](_0x19a9dd);}return _0x35ab93[_0x4d63('0x14')](_0x19a9dd)['end']();};}function respondWithResult(_0x51db48,_0x4ce316){_0x4ce316=_0x4ce316||0xc8;return function(_0x29065c){if(_0x29065c){return _0x51db48[_0x4d63('0x14')](_0x4ce316)[_0x4d63('0x15')](_0x29065c);}};}function respondWithFilteredResult(_0x24be25,_0x51048b){return function(_0x226eb4){if(_0x226eb4){var _0x2ca49a=typeof _0x51048b[_0x4d63('0x16')]===_0x4d63('0x17')&&typeof _0x51048b[_0x4d63('0x18')]===_0x4d63('0x17');var _0x43dc31=_0x226eb4[_0x4d63('0x19')];var _0x53bbb8=_0x2ca49a?0x0:_0x51048b['offset'];var _0x790e03=_0x2ca49a?_0x226eb4['count']:_0x51048b[_0x4d63('0x16')]+_0x51048b[_0x4d63('0x18')];var _0x37a03f;if(_0x790e03>=_0x43dc31){_0x790e03=_0x43dc31;_0x37a03f=0xc8;}else{_0x37a03f=0xce;}_0x24be25[_0x4d63('0x14')](_0x37a03f);return _0x24be25[_0x4d63('0x1a')]('Content-Range',_0x53bbb8+'-'+_0x790e03+'/'+_0x43dc31)[_0x4d63('0x15')](_0x226eb4);}return null;};}function patchUpdates(_0x12ef62){return function(_0x5b53db){try{jsonpatch[_0x4d63('0x1b')](_0x5b53db,_0x12ef62,!![]);}catch(_0xc2d3ab){return BPromise[_0x4d63('0x1c')](_0xc2d3ab);}return _0x5b53db['save']();};}function saveUpdates(_0x315da4,_0x131386){return function(_0xcc4333){if(_0xcc4333){return _0xcc4333[_0x4d63('0x1d')](_0x315da4)['then'](function(_0x3bb2f5){return _0x3bb2f5;});}return null;};}function removeEntity(_0x4f9cbb,_0x4e3e00){return function(_0x2ce377){if(_0x2ce377){return _0x2ce377[_0x4d63('0x1e')]()[_0x4d63('0x1f')](function(){_0x4f9cbb[_0x4d63('0x14')](0xcc)[_0x4d63('0x20')]();});}};}function handleEntityNotFound(_0x2b4423,_0x2beb3b){return function(_0x2195a9){if(!_0x2195a9){_0x2b4423[_0x4d63('0x13')](0x194);}return _0x2195a9;};}function handleError(_0x24a95d,_0x4d0d14){_0x4d0d14=_0x4d0d14||0x1f4;return function(_0x410bd9){logger[_0x4d63('0x21')](_0x410bd9[_0x4d63('0x22')]);if(_0x410bd9[_0x4d63('0x23')]){delete _0x410bd9[_0x4d63('0x23')];}_0x24a95d[_0x4d63('0x14')](_0x4d0d14)[_0x4d63('0x24')](_0x410bd9);};}exports[_0x4d63('0x25')]=function(_0xee43e,_0x6fcc4c){var _0x3860fe={},_0x1f8950={},_0x1b48bd={'count':0x0,'rows':[]};var _0x34136e=_[_0x4d63('0x26')](db[_0x4d63('0x27')]['rawAttributes'],function(_0x1968c2){return{'name':_0x1968c2[_0x4d63('0x28')],'type':_0x1968c2[_0x4d63('0x29')][_0x4d63('0x2a')]};});_0x1f8950[_0x4d63('0x2b')]=_[_0x4d63('0x26')](_0x34136e,'name');_0x1f8950[_0x4d63('0x2c')]=_[_0x4d63('0x2d')](_0xee43e[_0x4d63('0x2c')]);_0x1f8950[_0x4d63('0x2e')]=_[_0x4d63('0x2f')](_0x1f8950['model'],_0x1f8950[_0x4d63('0x2c')]);_0x3860fe[_0x4d63('0x30')]=_['intersection'](_0x1f8950[_0x4d63('0x2b')],qs[_0x4d63('0x31')](_0xee43e[_0x4d63('0x2c')]['fields']));_0x3860fe[_0x4d63('0x30')]=_0x3860fe[_0x4d63('0x30')]['length']?_0x3860fe[_0x4d63('0x30')]:_0x1f8950['model'];if(!_0xee43e['query'][_0x4d63('0x32')](_0x4d63('0x33'))){_0x3860fe[_0x4d63('0x18')]=qs[_0x4d63('0x18')](_0xee43e[_0x4d63('0x2c')][_0x4d63('0x18')]);_0x3860fe['offset']=qs[_0x4d63('0x16')](_0xee43e[_0x4d63('0x2c')][_0x4d63('0x16')]);}_0x3860fe[_0x4d63('0x34')]=qs['sort'](_0xee43e[_0x4d63('0x2c')][_0x4d63('0x35')]);_0x3860fe[_0x4d63('0x36')]=qs[_0x4d63('0x2e')](_[_0x4d63('0x37')](_0xee43e['query'],_0x1f8950['filters']),_0x34136e);if(_0xee43e[_0x4d63('0x2c')][_0x4d63('0x38')]){_0x3860fe['where']=_['merge'](_0x3860fe[_0x4d63('0x36')],{'$or':_['map'](_0x34136e,function(_0x9cc59c){if(_0x9cc59c[_0x4d63('0x29')]!==_0x4d63('0x39')){var _0x47880b={};_0x47880b[_0x9cc59c[_0x4d63('0x23')]]={'$like':'%'+_0xee43e[_0x4d63('0x2c')]['filter']+'%'};return _0x47880b;}})});}_0x3860fe=_[_0x4d63('0x3a')]({},_0x3860fe,_0xee43e[_0x4d63('0x3b')]);var _0x1a693e={'where':_0x3860fe[_0x4d63('0x36')]};return db[_0x4d63('0x27')][_0x4d63('0x19')](_0x1a693e)[_0x4d63('0x1f')](function(_0x892fe1){_0x1b48bd[_0x4d63('0x19')]=_0x892fe1;if(_0xee43e[_0x4d63('0x2c')]['includeAll']){_0x3860fe[_0x4d63('0x3c')]=[{'all':!![]}];}return db[_0x4d63('0x27')][_0x4d63('0x3d')](_0x3860fe);})[_0x4d63('0x1f')](function(_0x57ab7d){_0x1b48bd[_0x4d63('0x3e')]=_0x57ab7d;return _0x1b48bd;})['then'](respondWithFilteredResult(_0x6fcc4c,_0x3860fe))[_0x4d63('0x3f')](handleError(_0x6fcc4c,null));};exports[_0x4d63('0x40')]=function(_0x2ec761,_0x482045){var _0x31f7fd={'raw':!![],'where':{'id':_0x2ec761[_0x4d63('0x41')]['id']}},_0x5a53ea={};_0x5a53ea[_0x4d63('0x2b')]=_[_0x4d63('0x2d')](db[_0x4d63('0x27')][_0x4d63('0x42')]);_0x5a53ea[_0x4d63('0x2c')]=_['keys'](_0x2ec761[_0x4d63('0x2c')]);_0x5a53ea[_0x4d63('0x2e')]=_[_0x4d63('0x2f')](_0x5a53ea['model'],_0x5a53ea[_0x4d63('0x2c')]);_0x31f7fd[_0x4d63('0x30')]=_[_0x4d63('0x2f')](_0x5a53ea[_0x4d63('0x2b')],qs[_0x4d63('0x31')](_0x2ec761[_0x4d63('0x2c')]['fields']));_0x31f7fd[_0x4d63('0x30')]=_0x31f7fd[_0x4d63('0x30')][_0x4d63('0x43')]?_0x31f7fd[_0x4d63('0x30')]:_0x5a53ea[_0x4d63('0x2b')];if(_0x2ec761[_0x4d63('0x2c')][_0x4d63('0x44')]){_0x31f7fd['include']=[{'all':!![]}];}_0x31f7fd=_[_0x4d63('0x3a')]({},_0x31f7fd,_0x2ec761['options']);return db['DeskField'][_0x4d63('0x45')](_0x31f7fd)['then'](handleEntityNotFound(_0x482045,null))[_0x4d63('0x1f')](respondWithResult(_0x482045,null))[_0x4d63('0x3f')](handleError(_0x482045,null));};exports[_0x4d63('0x46')]=function(_0xe9a417,_0x58d946){return db[_0x4d63('0x27')][_0x4d63('0x46')](_0xe9a417[_0x4d63('0x47')],{})[_0x4d63('0x1f')](respondWithResult(_0x58d946,0xc9))[_0x4d63('0x3f')](handleError(_0x58d946,null));};exports[_0x4d63('0x1d')]=function(_0x1b74e9,_0x282424){if(_0x1b74e9[_0x4d63('0x47')]['id']){delete _0x1b74e9[_0x4d63('0x47')]['id'];}return db[_0x4d63('0x27')][_0x4d63('0x45')]({'where':{'id':_0x1b74e9[_0x4d63('0x41')]['id']}})['then'](handleEntityNotFound(_0x282424,null))[_0x4d63('0x1f')](saveUpdates(_0x1b74e9[_0x4d63('0x47')],null))['then'](respondWithResult(_0x282424,null))['catch'](handleError(_0x282424,null));};exports[_0x4d63('0x1e')]=function(_0x5a9553,_0xd318b0){return db[_0x4d63('0x27')][_0x4d63('0x45')]({'where':{'id':_0x5a9553['params']['id']}})[_0x4d63('0x1f')](handleEntityNotFound(_0xd318b0,null))['then'](removeEntity(_0xd318b0,null))[_0x4d63('0x3f')](handleError(_0xd318b0,null));}; \ No newline at end of file +var _0x41d9=['filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','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','status','end','json','undefined','limit','count','offset','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','order','sort','pick'];(function(_0x17b72e,_0x265f72){var _0x4ea690=function(_0x6faa09){while(--_0x6faa09){_0x17b72e['push'](_0x17b72e['shift']());}};_0x4ea690(++_0x265f72);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x941d('0x0'));var rimraf=require(_0x941d('0x1'));var zipdir=require(_0x941d('0x2'));var jsonpatch=require(_0x941d('0x3'));var rp=require(_0x941d('0x4'));var moment=require(_0x941d('0x5'));var BPromise=require(_0x941d('0x6'));var Mustache=require('mustache');var util=require(_0x941d('0x7'));var path=require(_0x941d('0x8'));var sox=require('sox');var csv=require(_0x941d('0x9'));var ejs=require(_0x941d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x941d('0xb'));var squel=require('squel');var crypto=require(_0x941d('0xc'));var jsforce=require(_0x941d('0xd'));var deskjs=require(_0x941d('0xe'));var toCsv=require(_0x941d('0x9'));var querystring=require(_0x941d('0xf'));var Papa=require('papaparse');var Redis=require(_0x941d('0x10'));var authService=require(_0x941d('0x11'));var qs=require(_0x941d('0x12'));var as=require(_0x941d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941d('0x14'))(_0x941d('0x15'));var utils=require(_0x941d('0x16'));var config=require(_0x941d('0x17'));var licenseUtil=require(_0x941d('0x18'));var db=require(_0x941d('0x19'))['db'];function respondWithStatusCode(_0x4d93c4,_0x192331){_0x192331=_0x192331||0xcc;return function(_0x55c5aa){if(_0x55c5aa){return _0x4d93c4['sendStatus'](_0x192331);}return _0x4d93c4[_0x941d('0x1a')](_0x192331)[_0x941d('0x1b')]();};}function respondWithResult(_0xbd3711,_0x2aa972){_0x2aa972=_0x2aa972||0xc8;return function(_0x20a6ab){if(_0x20a6ab){return _0xbd3711[_0x941d('0x1a')](_0x2aa972)[_0x941d('0x1c')](_0x20a6ab);}};}function respondWithFilteredResult(_0x45d85d,_0x369b0b){return function(_0x1f1aeb){if(_0x1f1aeb){var _0x7df80e=typeof _0x369b0b['offset']===_0x941d('0x1d')&&typeof _0x369b0b[_0x941d('0x1e')]===_0x941d('0x1d');var _0x2e5c4f=_0x1f1aeb[_0x941d('0x1f')];var _0x3ac25f=_0x7df80e?0x0:_0x369b0b[_0x941d('0x20')];var _0x2c6ce5=_0x7df80e?_0x1f1aeb[_0x941d('0x1f')]:_0x369b0b['offset']+_0x369b0b[_0x941d('0x1e')];var _0x57f5e6;if(_0x2c6ce5>=_0x2e5c4f){_0x2c6ce5=_0x2e5c4f;_0x57f5e6=0xc8;}else{_0x57f5e6=0xce;}_0x45d85d[_0x941d('0x1a')](_0x57f5e6);return _0x45d85d[_0x941d('0x21')]('Content-Range',_0x3ac25f+'-'+_0x2c6ce5+'/'+_0x2e5c4f)[_0x941d('0x1c')](_0x1f1aeb);}return null;};}function patchUpdates(_0x5ac2e6){return function(_0x526708){try{jsonpatch[_0x941d('0x22')](_0x526708,_0x5ac2e6,!![]);}catch(_0xf6636){return BPromise[_0x941d('0x23')](_0xf6636);}return _0x526708['save']();};}function saveUpdates(_0x1309af,_0x3baf0b){return function(_0xc19c76){if(_0xc19c76){return _0xc19c76['update'](_0x1309af)['then'](function(_0x520bb2){return _0x520bb2;});}return null;};}function removeEntity(_0x306557,_0x26b7b6){return function(_0xd72c49){if(_0xd72c49){return _0xd72c49[_0x941d('0x24')]()[_0x941d('0x25')](function(){_0x306557['status'](0xcc)[_0x941d('0x1b')]();});}};}function handleEntityNotFound(_0x43a443,_0x11c2c9){return function(_0x48baff){if(!_0x48baff){_0x43a443[_0x941d('0x26')](0x194);}return _0x48baff;};}function handleError(_0x1ce2fe,_0x3190d4){_0x3190d4=_0x3190d4||0x1f4;return function(_0x3a72d7){logger[_0x941d('0x27')](_0x3a72d7[_0x941d('0x28')]);if(_0x3a72d7[_0x941d('0x29')]){delete _0x3a72d7[_0x941d('0x29')];}_0x1ce2fe[_0x941d('0x1a')](_0x3190d4)[_0x941d('0x2a')](_0x3a72d7);};}exports[_0x941d('0x2b')]=function(_0x1cacc4,_0x4cf929){var _0x30615a={},_0x42050d={},_0x5908c3={'count':0x0,'rows':[]};var _0x16ce52=_[_0x941d('0x2c')](db[_0x941d('0x2d')][_0x941d('0x2e')],function(_0x46db04){return{'name':_0x46db04[_0x941d('0x2f')],'type':_0x46db04[_0x941d('0x30')]['key']};});_0x42050d['model']=_[_0x941d('0x2c')](_0x16ce52,_0x941d('0x29'));_0x42050d[_0x941d('0x31')]=_['keys'](_0x1cacc4['query']);_0x42050d[_0x941d('0x32')]=_[_0x941d('0x33')](_0x42050d[_0x941d('0x34')],_0x42050d['query']);_0x30615a[_0x941d('0x35')]=_[_0x941d('0x33')](_0x42050d[_0x941d('0x34')],qs[_0x941d('0x36')](_0x1cacc4['query'][_0x941d('0x36')]));_0x30615a[_0x941d('0x35')]=_0x30615a[_0x941d('0x35')][_0x941d('0x37')]?_0x30615a[_0x941d('0x35')]:_0x42050d[_0x941d('0x34')];if(!_0x1cacc4['query']['hasOwnProperty']('nolimit')){_0x30615a[_0x941d('0x1e')]=qs['limit'](_0x1cacc4[_0x941d('0x31')][_0x941d('0x1e')]);_0x30615a[_0x941d('0x20')]=qs[_0x941d('0x20')](_0x1cacc4[_0x941d('0x31')][_0x941d('0x20')]);}_0x30615a[_0x941d('0x38')]=qs[_0x941d('0x39')](_0x1cacc4[_0x941d('0x31')][_0x941d('0x39')]);_0x30615a['where']=qs[_0x941d('0x32')](_[_0x941d('0x3a')](_0x1cacc4[_0x941d('0x31')],_0x42050d[_0x941d('0x32')]),_0x16ce52);if(_0x1cacc4[_0x941d('0x31')][_0x941d('0x3b')]){_0x30615a[_0x941d('0x3c')]=_[_0x941d('0x3d')](_0x30615a[_0x941d('0x3c')],{'$or':_[_0x941d('0x2c')](_0x16ce52,function(_0x37b04c){if(_0x37b04c[_0x941d('0x30')]!==_0x941d('0x3e')){var _0x55fbf2={};_0x55fbf2[_0x37b04c['name']]={'$like':'%'+_0x1cacc4[_0x941d('0x31')][_0x941d('0x3b')]+'%'};return _0x55fbf2;}})});}_0x30615a=_['merge']({},_0x30615a,_0x1cacc4[_0x941d('0x3f')]);var _0x554c8b={'where':_0x30615a[_0x941d('0x3c')]};return db['DeskField'][_0x941d('0x1f')](_0x554c8b)['then'](function(_0x2a0a21){_0x5908c3[_0x941d('0x1f')]=_0x2a0a21;if(_0x1cacc4[_0x941d('0x31')][_0x941d('0x40')]){_0x30615a[_0x941d('0x41')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x30615a);})[_0x941d('0x25')](function(_0x3354ef){_0x5908c3[_0x941d('0x42')]=_0x3354ef;return _0x5908c3;})[_0x941d('0x25')](respondWithFilteredResult(_0x4cf929,_0x30615a))[_0x941d('0x43')](handleError(_0x4cf929,null));};exports[_0x941d('0x44')]=function(_0x35ac51,_0x265a08){var _0x385099={'raw':!![],'where':{'id':_0x35ac51[_0x941d('0x45')]['id']}},_0xf7ff74={};_0xf7ff74[_0x941d('0x34')]=_[_0x941d('0x46')](db['DeskField'][_0x941d('0x2e')]);_0xf7ff74['query']=_[_0x941d('0x46')](_0x35ac51['query']);_0xf7ff74['filters']=_['intersection'](_0xf7ff74['model'],_0xf7ff74[_0x941d('0x31')]);_0x385099[_0x941d('0x35')]=_['intersection'](_0xf7ff74[_0x941d('0x34')],qs[_0x941d('0x36')](_0x35ac51[_0x941d('0x31')]['fields']));_0x385099['attributes']=_0x385099[_0x941d('0x35')][_0x941d('0x37')]?_0x385099[_0x941d('0x35')]:_0xf7ff74[_0x941d('0x34')];if(_0x35ac51['query'][_0x941d('0x40')]){_0x385099['include']=[{'all':!![]}];}_0x385099=_['merge']({},_0x385099,_0x35ac51['options']);return db[_0x941d('0x2d')][_0x941d('0x47')](_0x385099)[_0x941d('0x25')](handleEntityNotFound(_0x265a08,null))[_0x941d('0x25')](respondWithResult(_0x265a08,null))['catch'](handleError(_0x265a08,null));};exports[_0x941d('0x48')]=function(_0x235f13,_0x2daf90){return db['DeskField']['create'](_0x235f13[_0x941d('0x49')],{})['then'](respondWithResult(_0x2daf90,0xc9))[_0x941d('0x43')](handleError(_0x2daf90,null));};exports[_0x941d('0x4a')]=function(_0x319d85,_0xef7ff7){if(_0x319d85[_0x941d('0x49')]['id']){delete _0x319d85[_0x941d('0x49')]['id'];}return db[_0x941d('0x2d')][_0x941d('0x47')]({'where':{'id':_0x319d85[_0x941d('0x45')]['id']}})[_0x941d('0x25')](handleEntityNotFound(_0xef7ff7,null))[_0x941d('0x25')](saveUpdates(_0x319d85[_0x941d('0x49')],null))[_0x941d('0x25')](respondWithResult(_0xef7ff7,null))[_0x941d('0x43')](handleError(_0xef7ff7,null));};exports[_0x941d('0x24')]=function(_0x2ec3cf,_0x331792){return db['DeskField'][_0x941d('0x47')]({'where':{'id':_0x2ec3cf[_0x941d('0x45')]['id']}})[_0x941d('0x25')](handleEntityNotFound(_0x331792,null))['then'](removeEntity(_0x331792,null))['catch'](handleError(_0x331792,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bbe8ac7..7f81f79 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 _0xd84b=['exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0xd84b,0x1d7));var _0xbd84=function(_0xaa0a95,_0x581116){_0xaa0a95=_0xaa0a95-0x0;var _0xb4501=_0xd84b[_0xaa0a95];return _0xb4501;};'use strict';var _=require(_0xbd84('0x0'));var util=require(_0xbd84('0x1'));var logger=require('../../config/logger')(_0xbd84('0x2'));var moment=require('moment');var BPromise=require(_0xbd84('0x3'));var rp=require(_0xbd84('0x4'));var fs=require('fs');var path=require(_0xbd84('0x5'));var rimraf=require(_0xbd84('0x6'));var config=require(_0xbd84('0x7'));var attributes=require(_0xbd84('0x8'));module[_0xbd84('0x9')]=function(_0x422146,_0x2db63c){return _0x422146['define'](_0xbd84('0xa'),attributes,{'tableName':_0xbd84('0xb'),'paranoid':![],'indexes':[{'name':_0xbd84('0xc'),'fields':[_0xbd84('0xd'),_0xbd84('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe56a=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField','lodash','util'];(function(_0x1ef1ff,_0x3cd099){var _0x5c3243=function(_0x4befb0){while(--_0x4befb0){_0x1ef1ff['push'](_0x1ef1ff['shift']());}};_0x5c3243(++_0x3cd099);}(_0xe56a,0x18a));var _0xae56=function(_0x4b5adf,_0x1c4db4){_0x4b5adf=_0x4b5adf-0x0;var _0x3b2175=_0xe56a[_0x4b5adf];return _0x3b2175;};'use strict';var _=require(_0xae56('0x0'));var util=require(_0xae56('0x1'));var logger=require(_0xae56('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae56('0x3'));var rp=require(_0xae56('0x4'));var fs=require('fs');var path=require(_0xae56('0x5'));var rimraf=require('rimraf');var config=require(_0xae56('0x6'));var attributes=require(_0xae56('0x7'));module['exports']=function(_0x5cb006,_0x3f6f4d){return _0x5cb006[_0xae56('0x8')]('DeskField',attributes,{'tableName':_0xae56('0x9'),'paranoid':![],'indexes':[{'name':_0xae56('0xa'),'fields':[_0xae56('0xb'),'FieldId'],'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 4304a8c..3fdddce 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 _0xef4f=['message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s'];(function(_0x248fd7,_0x2a33e5){var _0x42d417=function(_0x182287){while(--_0x182287){_0x248fd7['push'](_0x248fd7['shift']());}};_0x42d417(++_0x2a33e5);}(_0xef4f,0x177));var _0xfef4=function(_0x2322a7,_0x2eb04f){_0x2322a7=_0x2322a7-0x0;var _0x2e47c6=_0xef4f[_0x2322a7];return _0x2e47c6;};'use strict';var _=require(_0xfef4('0x0'));var util=require(_0xfef4('0x1'));var moment=require(_0xfef4('0x2'));var BPromise=require(_0xfef4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfef4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfef4('0x5'));var logger=require(_0xfef4('0x6'))(_0xfef4('0x7'));var config=require('../../config/environment');var jayson=require(_0xfef4('0x8'));var client=jayson[_0xfef4('0x9')][_0xfef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31487c,_0x114e7c,_0x21145b){return new BPromise(function(_0x102b04,_0x2785b2){return client[_0xfef4('0xb')](_0x31487c,_0x21145b)[_0xfef4('0xc')](function(_0x29bfc0){logger[_0xfef4('0xd')]('DeskField,\x20%s,\x20%s',_0x114e7c,_0xfef4('0xe'));logger[_0xfef4('0xf')](_0xfef4('0x10'),_0x114e7c,_0xfef4('0xe'),JSON[_0xfef4('0x11')](_0x29bfc0));if(_0x29bfc0['error']){if(_0x29bfc0[_0xfef4('0x12')][_0xfef4('0x13')]===0x1f4){logger[_0xfef4('0x12')](_0xfef4('0x14'),_0x114e7c,_0x29bfc0[_0xfef4('0x12')]['message']);return _0x2785b2(_0x29bfc0[_0xfef4('0x12')][_0xfef4('0x15')]);}logger[_0xfef4('0x12')](_0xfef4('0x14'),_0x114e7c,_0x29bfc0[_0xfef4('0x12')]['message']);return _0x102b04(_0x29bfc0['error']['message']);}else{logger[_0xfef4('0xd')](_0xfef4('0x14'),_0x114e7c,_0xfef4('0xe'));_0x102b04(_0x29bfc0['result'][_0xfef4('0x15')]);}})['catch'](function(_0x3ac0eb){logger[_0xfef4('0x12')](_0xfef4('0x14'),_0x114e7c,_0x3ac0eb);_0x2785b2(_0x3ac0eb);});});} \ No newline at end of file +var _0x9945=['request\x20sent','code','error','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x468672,_0xb700ef){var _0x39b2e0=function(_0x4a5eff){while(--_0x4a5eff){_0x468672['push'](_0x468672['shift']());}};_0x39b2e0(++_0xb700ef);}(_0x9945,0x16f));var _0x5994=function(_0x3037c5,_0x56f692){_0x3037c5=_0x3037c5-0x0;var _0x9ff78b=_0x9945[_0x3037c5];return _0x9ff78b;};'use strict';var _=require(_0x5994('0x0'));var util=require(_0x5994('0x1'));var moment=require('moment');var BPromise=require(_0x5994('0x2'));var rs=require(_0x5994('0x3'));var fs=require('fs');var Redis=require(_0x5994('0x4'));var db=require(_0x5994('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5994('0x6'))(_0x5994('0x7'));var config=require(_0x5994('0x8'));var jayson=require(_0x5994('0x9'));var client=jayson[_0x5994('0xa')][_0x5994('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dea38,_0x364e95,_0x5b9952){return new BPromise(function(_0x56bfdd,_0x5d037a){return client[_0x5994('0xc')](_0x3dea38,_0x5b9952)[_0x5994('0xd')](function(_0x5e253a){logger[_0x5994('0xe')]('DeskField,\x20%s,\x20%s',_0x364e95,'request\x20sent');logger[_0x5994('0xf')](_0x5994('0x10'),_0x364e95,_0x5994('0x11'),JSON['stringify'](_0x5e253a));if(_0x5e253a['error']){if(_0x5e253a['error'][_0x5994('0x12')]===0x1f4){logger[_0x5994('0x13')]('DeskField,\x20%s,\x20%s',_0x364e95,_0x5e253a[_0x5994('0x13')][_0x5994('0x14')]);return _0x5d037a(_0x5e253a['error'][_0x5994('0x14')]);}logger[_0x5994('0x13')](_0x5994('0x15'),_0x364e95,_0x5e253a['error']['message']);return _0x56bfdd(_0x5e253a['error']['message']);}else{logger[_0x5994('0xe')](_0x5994('0x15'),_0x364e95,_0x5994('0x11'));_0x56bfdd(_0x5e253a[_0x5994('0x16')][_0x5994('0x14')]);}})[_0x5994('0x17')](function(_0x1b7643){logger[_0x5994('0x13')](_0x5994('0x15'),_0x364e95,_0x1b7643);_0x5d037a(_0x1b7643);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c59b657..a17b63e 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 _0xabd0=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update'];(function(_0x5bf8b9,_0x456e35){var _0x8e2d09=function(_0xf3c804){while(--_0xf3c804){_0x5bf8b9['push'](_0x5bf8b9['shift']());}};_0x8e2d09(++_0x456e35);}(_0xabd0,0x189));var _0x0abd=function(_0x4fe768,_0x1715ba){_0x4fe768=_0x4fe768-0x0;var _0x5a686b=_0xabd0[_0x4fe768];return _0x5a686b;};'use strict';var multer=require(_0x0abd('0x0'));var util=require('util');var path=require(_0x0abd('0x1'));var timeout=require(_0x0abd('0x2'));var express=require(_0x0abd('0x3'));var router=express[_0x0abd('0x4')]();var fs_extra=require(_0x0abd('0x5'));var auth=require(_0x0abd('0x6'));var interaction=require(_0x0abd('0x7'));var config=require(_0x0abd('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x0abd('0x9')]('/',auth['isAuthenticated'](),controller[_0x0abd('0xa')]);router[_0x0abd('0x9')](_0x0abd('0xb'),auth[_0x0abd('0xc')](),controller[_0x0abd('0xd')]);router[_0x0abd('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0abd('0xe')]);router[_0x0abd('0x9')](_0x0abd('0xf'),auth[_0x0abd('0xc')](),controller[_0x0abd('0x10')]);router[_0x0abd('0x11')]('/',auth[_0x0abd('0xc')](),controller[_0x0abd('0x12')]);router[_0x0abd('0x11')](_0x0abd('0x13'),auth[_0x0abd('0xc')](),controller[_0x0abd('0x14')]);router[_0x0abd('0x15')](_0x0abd('0xb'),auth['isAuthenticated'](),controller[_0x0abd('0x16')]);router[_0x0abd('0x17')](_0x0abd('0xb'),auth[_0x0abd('0xc')](),controller[_0x0abd('0x18')]);module[_0x0abd('0x19')]=router; \ No newline at end of file +var _0x455f=['../../components/interaction/service','../../config/environment','get','index','/:id','/:id/configurations','isAuthenticated','getFields','post','create','put','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x47d086,_0xcc5e91){var _0xf5fa2a=function(_0x21e805){while(--_0x21e805){_0x47d086['push'](_0x47d086['shift']());}};_0xf5fa2a(++_0xcc5e91);}(_0x455f,0x118));var _0xf455=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x455f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf455('0x0'));var timeout=require('connect-timeout');var express=require(_0xf455('0x1'));var router=express[_0xf455('0x2')]();var fs_extra=require(_0xf455('0x3'));var auth=require(_0xf455('0x4'));var interaction=require(_0xf455('0x5'));var config=require(_0xf455('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xf455('0x7')]('/',auth['isAuthenticated'](),controller[_0xf455('0x8')]);router[_0xf455('0x7')](_0xf455('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf455('0x7')](_0xf455('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf455('0x7')]('/:id/fields',auth[_0xf455('0xb')](),controller[_0xf455('0xc')]);router[_0xf455('0xd')]('/',auth[_0xf455('0xb')](),controller[_0xf455('0xe')]);router[_0xf455('0xd')](_0xf455('0xa'),auth[_0xf455('0xb')](),controller['addConfiguration']);router[_0xf455('0xf')](_0xf455('0x9'),auth['isAuthenticated'](),controller[_0xf455('0x10')]);router[_0xf455('0x11')](_0xf455('0x9'),auth[_0xf455('0xb')](),controller[_0xf455('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index db9578d..335f0fc 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 _0x6a88=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1cecf8,_0x96aed7){var _0x586838=function(_0x3925b5){while(--_0x3925b5){_0x1cecf8['push'](_0x1cecf8['shift']());}};_0x586838(++_0x96aed7);}(_0x6a88,0xa9));var _0x86a8=function(_0x44b0af,_0xdb6975){_0x44b0af=_0x44b0af-0x0;var _0xafaa74=_0x6a88[_0x44b0af];return _0xafaa74;};'use strict';var Sequelize=require(_0x86a8('0x0'));module[_0x86a8('0x1')]={'name':{'type':Sequelize[_0x86a8('0x2')]},'username':{'type':Sequelize[_0x86a8('0x2')]},'password':{'type':Sequelize[_0x86a8('0x2')]},'remoteUri':{'type':Sequelize[_0x86a8('0x2')]},'tenantId':{'type':Sequelize[_0x86a8('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x86a8('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x86a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9432=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3404c3,_0xc747a1){var _0x1996f3=function(_0x1e8fed){while(--_0x1e8fed){_0x3404c3['push'](_0x3404c3['shift']());}};_0x1996f3(++_0xc747a1);}(_0x9432,0x1e3));var _0x2943=function(_0x2f58b2,_0x33fc16){_0x2f58b2=_0x2f58b2-0x0;var _0x5dfa1b=_0x9432[_0x2f58b2];return _0x5dfa1b;};'use strict';var Sequelize=require(_0x2943('0x0'));module[_0x2943('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2943('0x2')]},'password':{'type':Sequelize[_0x2943('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2943('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2943('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2943('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2943('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 db23c9b..2252064 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 _0x6a21=['ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','OptionSet','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','filter','where','options','then','include','findAll','rows','catch','show','includeAll','merge','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','getFields','incident','Incident','title','customerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyyominame','customeridname','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode'];(function(_0x26a538,_0x47cff0){var _0x251765=function(_0x108ada){while(--_0x108ada){_0x26a538['push'](_0x26a538['shift']());}};_0x251765(++_0x47cff0);}(_0x6a21,0xf9));var _0x16a2=function(_0x4d66ed,_0x21989d){_0x4d66ed=_0x4d66ed-0x0;var _0x58ace2=_0x6a21[_0x4d66ed];return _0x58ace2;};'use strict';var rp=require('request-promise');var util=require(_0x16a2('0x0'));var _=require(_0x16a2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x16a2('0x2'))(_0x16a2('0x3'));var db=require(_0x16a2('0x4'))['db'];var integrations=require(_0x16a2('0x5'));function respondWithResult(_0x3304d3,_0x501069){_0x501069=_0x501069||0xc8;return function(_0x4c40eb){if(_0x4c40eb){return _0x3304d3[_0x16a2('0x6')](_0x501069)[_0x16a2('0x7')](_0x4c40eb);}};}function respondWithFilteredResult(_0x5ad469,_0x172a4f){return function(_0x4eaaca){if(_0x4eaaca){var _0x438970=typeof _0x172a4f[_0x16a2('0x8')]===_0x16a2('0x9')&&typeof _0x172a4f['limit']==='undefined';var _0x3fe118=_0x4eaaca[_0x16a2('0xa')];var _0x124c19=_0x438970?0x0:_0x172a4f[_0x16a2('0x8')];var _0x2f6240=_0x438970?_0x4eaaca[_0x16a2('0xa')]:_0x172a4f[_0x16a2('0x8')]+_0x172a4f[_0x16a2('0xb')];var _0x23a224;if(_0x2f6240>=_0x3fe118){_0x2f6240=_0x3fe118;_0x23a224=0xc8;}else{_0x23a224=0xce;}_0x5ad469[_0x16a2('0x6')](_0x23a224);return _0x5ad469[_0x16a2('0xc')](_0x16a2('0xd'),_0x124c19+'-'+_0x2f6240+'/'+_0x3fe118)[_0x16a2('0x7')](_0x4eaaca);}return null;};}function saveUpdates(_0x4f6329){return function(_0x1cc48b){if(_0x1cc48b){return _0x1cc48b[_0x16a2('0xe')](_0x4f6329)['then'](function(_0x3d55bf){return _0x3d55bf;});}return null;};}function removeEntity(_0x5b48de){return function(_0x55d140){if(_0x55d140){return _0x55d140[_0x16a2('0xf')]()['then'](function(){_0x5b48de[_0x16a2('0x6')](0xcc)[_0x16a2('0x10')]();});}};}function handleEntityNotFound(_0x1000f7){return function(_0x5da45e){if(!_0x5da45e){_0x1000f7[_0x16a2('0x11')](0x194);}return _0x5da45e;};}function handleError(_0x4c49b8,_0x25c8ef){_0x25c8ef=_0x25c8ef||0x1f4;return function(_0x64b2b){logger[_0x16a2('0x12')](_0x64b2b[_0x16a2('0x13')]);if(_0x64b2b[_0x16a2('0x14')]){delete _0x64b2b[_0x16a2('0x14')];}_0x4c49b8[_0x16a2('0x6')](_0x25c8ef)[_0x16a2('0x15')](_0x64b2b);};}exports[_0x16a2('0x16')]=function(_0x4a0c54,_0x525a19){var _0x294324={},_0x2fd8b5={},_0x390a2e={'count':0x0,'rows':[]};var _0x229ffa=_['map'](db[_0x16a2('0x17')][_0x16a2('0x18')],function(_0x1cf949){return{'name':_0x1cf949[_0x16a2('0x19')],'type':_0x1cf949[_0x16a2('0x1a')][_0x16a2('0x1b')]};});_0x2fd8b5['model']=_[_0x16a2('0x1c')](_0x229ffa,'name');_0x2fd8b5['query']=_[_0x16a2('0x1d')](_0x4a0c54[_0x16a2('0x1e')]);_0x2fd8b5[_0x16a2('0x1f')]=_[_0x16a2('0x20')](_0x2fd8b5['model'],_0x2fd8b5[_0x16a2('0x1e')]);_0x294324[_0x16a2('0x21')]=_[_0x16a2('0x20')](_0x2fd8b5[_0x16a2('0x22')],qs[_0x16a2('0x23')](_0x4a0c54[_0x16a2('0x1e')][_0x16a2('0x23')]));_0x294324['attributes']=_0x294324[_0x16a2('0x21')][_0x16a2('0x24')]?_0x294324[_0x16a2('0x21')]:_0x2fd8b5[_0x16a2('0x22')];if(!_0x4a0c54[_0x16a2('0x1e')]['hasOwnProperty'](_0x16a2('0x25'))){_0x294324[_0x16a2('0xb')]=qs['limit'](_0x4a0c54['query'][_0x16a2('0xb')]);_0x294324['offset']=qs[_0x16a2('0x8')](_0x4a0c54['query'][_0x16a2('0x8')]);}_0x294324[_0x16a2('0x26')]=qs[_0x16a2('0x27')](_0x4a0c54[_0x16a2('0x1e')][_0x16a2('0x27')]);_0x294324['where']=qs[_0x16a2('0x1f')](_['pick'](_0x4a0c54[_0x16a2('0x1e')],_0x2fd8b5[_0x16a2('0x1f')]),_0x229ffa);if(_0x4a0c54[_0x16a2('0x1e')][_0x16a2('0x28')]){_0x294324['where']=_['merge'](_0x294324[_0x16a2('0x29')],{'$or':_[_0x16a2('0x1c')](_0x229ffa,function(_0x17464f){if(_0x17464f['type']!=='VIRTUAL'){var _0x4615bd={};_0x4615bd[_0x17464f[_0x16a2('0x14')]]={'$like':'%'+_0x4a0c54[_0x16a2('0x1e')][_0x16a2('0x28')]+'%'};return _0x4615bd;}})});}_0x294324=_['merge']({},_0x294324,_0x4a0c54[_0x16a2('0x2a')]);var _0x1d786b={'where':_0x294324[_0x16a2('0x29')]};return db[_0x16a2('0x17')][_0x16a2('0xa')](_0x1d786b)[_0x16a2('0x2b')](function(_0x3c12af){_0x390a2e[_0x16a2('0xa')]=_0x3c12af;if(_0x4a0c54[_0x16a2('0x1e')]['includeAll']){_0x294324[_0x16a2('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x16a2('0x2d')](_0x294324);})[_0x16a2('0x2b')](function(_0x370b7b){_0x390a2e[_0x16a2('0x2e')]=_0x370b7b;return _0x390a2e;})['then'](respondWithFilteredResult(_0x525a19,_0x294324))[_0x16a2('0x2f')](handleError(_0x525a19,null));};exports[_0x16a2('0x30')]=function(_0x33c2bb,_0x1707b6){var _0x4254ec={'raw':![],'where':{'id':_0x33c2bb['params']['id']}},_0x2a97dd={};_0x2a97dd[_0x16a2('0x22')]=_[_0x16a2('0x1d')](db[_0x16a2('0x17')][_0x16a2('0x18')]);_0x2a97dd[_0x16a2('0x1e')]=_['keys'](_0x33c2bb['query']);_0x2a97dd['filters']=_[_0x16a2('0x20')](_0x2a97dd['model'],_0x2a97dd[_0x16a2('0x1e')]);_0x4254ec[_0x16a2('0x21')]=_[_0x16a2('0x20')](_0x2a97dd[_0x16a2('0x22')],qs['fields'](_0x33c2bb['query']['fields']));_0x4254ec['attributes']=_0x4254ec[_0x16a2('0x21')][_0x16a2('0x24')]?_0x4254ec[_0x16a2('0x21')]:_0x2a97dd['model'];if(_0x33c2bb[_0x16a2('0x1e')][_0x16a2('0x31')]){_0x4254ec[_0x16a2('0x2c')]=[{'all':!![]}];}_0x4254ec=_[_0x16a2('0x32')]({},_0x4254ec,_0x33c2bb[_0x16a2('0x2a')]);return db[_0x16a2('0x17')][_0x16a2('0x33')](_0x4254ec)[_0x16a2('0x2b')](handleEntityNotFound(_0x1707b6,null))[_0x16a2('0x2b')](respondWithResult(_0x1707b6,null))[_0x16a2('0x2f')](handleError(_0x1707b6,null));};exports[_0x16a2('0x34')]=function(_0x196071,_0x232998){return db['Dynamics365Account'][_0x16a2('0x34')](_0x196071[_0x16a2('0x35')],{})[_0x16a2('0x2b')](respondWithResult(_0x232998,0xc9))[_0x16a2('0x2f')](handleError(_0x232998,null));};exports[_0x16a2('0xe')]=function(_0x46e907,_0x140ad3){if(_0x46e907[_0x16a2('0x35')]['id']){delete _0x46e907[_0x16a2('0x35')]['id'];}return db[_0x16a2('0x17')][_0x16a2('0x33')]({'where':{'id':_0x46e907[_0x16a2('0x36')]['id']}})[_0x16a2('0x2b')](handleEntityNotFound(_0x140ad3,null))[_0x16a2('0x2b')](saveUpdates(_0x46e907[_0x16a2('0x35')],null))[_0x16a2('0x2b')](respondWithResult(_0x140ad3,null))[_0x16a2('0x2f')](handleError(_0x140ad3,null));};exports[_0x16a2('0xf')]=function(_0x1d919c,_0x4a797b){return db['Dynamics365Account'][_0x16a2('0x33')]({'where':{'id':_0x1d919c[_0x16a2('0x36')]['id']}})[_0x16a2('0x2b')](handleEntityNotFound(_0x4a797b,null))[_0x16a2('0x2b')](removeEntity(_0x4a797b,null))[_0x16a2('0x2f')](handleError(_0x4a797b,null));};exports[_0x16a2('0x37')]=function(_0x5ff1e6,_0x159b9e){var _0x414f7d={};var _0x4908f7={};var _0x513e63;var _0x4bcfa0;return db[_0x16a2('0x17')][_0x16a2('0x38')]({'where':{'id':_0x5ff1e6[_0x16a2('0x36')]['id']}})[_0x16a2('0x2b')](handleEntityNotFound(_0x159b9e,null))[_0x16a2('0x2b')](function(_0x51b248){if(_0x51b248){_0x513e63=_0x51b248;_0x4908f7[_0x16a2('0x22')]=_['keys'](db[_0x16a2('0x39')][_0x16a2('0x18')]);_0x4908f7[_0x16a2('0x1e')]=_[_0x16a2('0x1d')](_0x5ff1e6[_0x16a2('0x1e')]);_0x4908f7[_0x16a2('0x1f')]=_[_0x16a2('0x20')](_0x4908f7[_0x16a2('0x22')],_0x4908f7['query']);_0x414f7d[_0x16a2('0x21')]=_[_0x16a2('0x20')](_0x4908f7['model'],qs[_0x16a2('0x23')](_0x5ff1e6[_0x16a2('0x1e')][_0x16a2('0x23')]));_0x414f7d[_0x16a2('0x21')]=_0x414f7d[_0x16a2('0x21')]['length']?_0x414f7d[_0x16a2('0x21')]:_0x4908f7[_0x16a2('0x22')];_0x414f7d['order']=qs[_0x16a2('0x27')](_0x5ff1e6[_0x16a2('0x1e')]['sort']);_0x414f7d[_0x16a2('0x29')]=qs[_0x16a2('0x1f')](_[_0x16a2('0x3a')](_0x5ff1e6[_0x16a2('0x1e')],_0x4908f7[_0x16a2('0x1f')]));if(_0x5ff1e6['query']['filter']){_0x414f7d[_0x16a2('0x29')]=_['merge'](_0x414f7d[_0x16a2('0x29')],{'$or':_[_0x16a2('0x1c')](_0x414f7d[_0x16a2('0x21')],function(_0x3d3559){var _0x537fdc={};_0x537fdc[_0x3d3559]={'$like':'%'+_0x5ff1e6[_0x16a2('0x1e')][_0x16a2('0x28')]+'%'};return _0x537fdc;})});}_0x414f7d=_[_0x16a2('0x32')]({},_0x414f7d,_0x5ff1e6[_0x16a2('0x2a')]);return _0x513e63[_0x16a2('0x37')](_0x414f7d);}})[_0x16a2('0x2b')](function(_0x2ea21a){if(_0x2ea21a){_0x4bcfa0=_0x2ea21a[_0x16a2('0x24')];if(!_0x5ff1e6['query'][_0x16a2('0x3b')]('nolimit')){_0x414f7d[_0x16a2('0xb')]=qs[_0x16a2('0xb')](_0x5ff1e6[_0x16a2('0x1e')][_0x16a2('0xb')]);_0x414f7d['offset']=qs[_0x16a2('0x8')](_0x5ff1e6[_0x16a2('0x1e')][_0x16a2('0x8')]);}return _0x513e63[_0x16a2('0x37')](_0x414f7d);}})['then'](function(_0x1a380e){if(_0x1a380e){return _0x1a380e?{'count':_0x4bcfa0,'rows':_0x1a380e}:null;}})[_0x16a2('0x2b')](respondWithResult(_0x159b9e,null))[_0x16a2('0x2f')](handleError(_0x159b9e,null));};exports[_0x16a2('0x3c')]=function(_0x166346,_0x49f69b){if(_0x166346[_0x16a2('0x35')]['id']){delete _0x166346['body']['id'];}return db['Dynamics365Account'][_0x16a2('0x38')]({'where':{'id':_0x166346['params']['id']}})[_0x16a2('0x2b')](handleEntityNotFound(_0x49f69b,null))['then'](function(_0x3eb1b7){if(_0x3eb1b7){_0x166346[_0x16a2('0x35')][_0x16a2('0x3d')]=_0x3eb1b7['id'];_0x166346[_0x16a2('0x35')][_0x16a2('0x3e')]=integrations['getSubjects'](_0x166346[_0x16a2('0x35')][_0x16a2('0x3f')],_0x166346[_0x16a2('0x35')]['type']);_0x166346[_0x16a2('0x35')][_0x16a2('0x40')]=integrations[_0x16a2('0x41')](_0x166346['body'][_0x16a2('0x3f')],_0x166346[_0x16a2('0x35')][_0x16a2('0x1a')]);return db[_0x16a2('0x39')][_0x16a2('0x34')](_0x166346[_0x16a2('0x35')],{'include':[{'model':db[_0x16a2('0x42')],'as':_0x16a2('0x3e')},{'model':db[_0x16a2('0x42')],'as':'Descriptions'}]});}return null;})[_0x16a2('0x2b')](respondWithResult(_0x49f69b,null))[_0x16a2('0x2f')](handleError(_0x49f69b,null));};function sanitizeRemoteUri(_0x291b54){var _0x20d112=_0x291b54[_0x16a2('0x43')](-0x1);if(_0x20d112==='/')return _0x291b54['substring'](0x0,_0x291b54[_0x16a2('0x44')](_0x20d112));return _0x291b54;}function getWebApiUrl(_0x4b3ceb){return util[_0x16a2('0x45')]('%s/api/data/v9.0/',_0x4b3ceb);}exports[_0x16a2('0x46')]=function(_0x196eec,_0x2fc07f){var _0x2ea6a3=_0x196eec[_0x16a2('0x1e')]['ticketType'];var _0x4c2c8f=_0x2ea6a3===_0x16a2('0x47')?_0x16a2('0x48'):'PhoneCall';var _0x21d69e='';var _0x4a26c7='';var _0xd3d733='';var _0x13b60b='';var _0xe55d74='';var _0x5a216a='';var _0x1a3d4f='';var _0x440e88='';var _0x320096=[_0x16a2('0x49'),'description',_0x16a2('0x4a'),'ownerid',_0x16a2('0x4b'),'subject',_0x16a2('0x4c'),_0x16a2('0x4d'),_0x16a2('0x4e'),_0x16a2('0x4f')];var _0x231f41=[_0x16a2('0x50'),_0x16a2('0x51'),_0x16a2('0x52'),_0x16a2('0x53'),_0x16a2('0x54'),_0x16a2('0x55'),_0x16a2('0x56'),_0x16a2('0x57'),_0x16a2('0x58'),_0x16a2('0x59'),'createdbyname',_0x16a2('0x5a'),'createdon','createdonbehalfbyname',_0x16a2('0x5b'),_0x16a2('0x5c'),'customeridtype','customeridyominame','emailaddress',_0x16a2('0x5d'),_0x16a2('0x5e'),_0x16a2('0x5f'),'escalatedon',_0x16a2('0x60'),_0x16a2('0x61'),_0x16a2('0x62'),_0x16a2('0x63'),'influencescore',_0x16a2('0x64'),'lastonholdtime','masteridname',_0x16a2('0x65'),_0x16a2('0x66'),_0x16a2('0x67'),_0x16a2('0x68'),_0x16a2('0x69'),'modifiedonbehalfbyname',_0x16a2('0x6a'),_0x16a2('0x6b'),'msdyn_iotalertname',_0x16a2('0x6c'),_0x16a2('0x6d'),_0x16a2('0x6e'),_0x16a2('0x6f'),_0x16a2('0x70'),_0x16a2('0x71'),_0x16a2('0x72'),'primarycontactidname',_0x16a2('0x73'),_0x16a2('0x74'),_0x16a2('0x75'),_0x16a2('0x76'),_0x16a2('0x77'),_0x16a2('0x78'),_0x16a2('0x79'),_0x16a2('0x7a'),_0x16a2('0x7b'),_0x16a2('0x7c'),_0x16a2('0x7d'),_0x16a2('0x7e'),'socialprofileidname',_0x16a2('0x7f'),_0x16a2('0x80'),'subjectidname',_0x16a2('0x81'),'timezoneruleversionnumber',_0x16a2('0x82'),_0x16a2('0x83'),_0x16a2('0x84'),_0x16a2('0x85')];var _0x20925c=_0x320096[_0x16a2('0x86')](_0x231f41);return db[_0x16a2('0x17')][_0x16a2('0x38')]({'where':{'id':_0x196eec[_0x16a2('0x36')]['id']},'attributes':['id',_0x16a2('0x87'),_0x16a2('0x88'),_0x16a2('0x89'),_0x16a2('0x8a'),_0x16a2('0x8b'),_0x16a2('0x8c'),_0x16a2('0x8d')],'include':[{'model':db[_0x16a2('0x8e')],'as':_0x16a2('0x8e'),'attributes':['id',_0x16a2('0x8f'),_0x16a2('0x90')]}]})['then'](handleEntityNotFound(_0x2fc07f,null))[_0x16a2('0x2b')](function(_0x165307){if(_0x165307){if(_0x165307[_0x16a2('0x8d')]){_0x165307['access_token']=_0x165307[_0x16a2('0x8e')][_0x16a2('0x8f')];_0x440e88=sanitizeRemoteUri(_0x165307[_0x16a2('0x8e')]['data7']);_0x1a3d4f=getWebApiUrl(_0x440e88);return _0x165307;}_0x440e88=sanitizeRemoteUri(_0x165307[_0x16a2('0x89')]);_0x1a3d4f=getWebApiUrl(_0x440e88);var _0x18c577={'method':'POST','uri':_0x16a2('0x91')+_0x165307['tenantId']+_0x16a2('0x92'),'form':{'client_id':_0x165307[_0x16a2('0x8b')],'resource':_0x440e88,'username':_0x165307[_0x16a2('0x87')],'password':_0x165307[_0x16a2('0x88')],'grant_type':_0x16a2('0x88'),'client_secret':_0x165307[_0x16a2('0x8c')]},'json':!![]};return rp(_0x18c577);}})['then'](function(_0x57ae6c){_0x5a216a=_0x57ae6c['access_token'];var _0x4b585b={'method':'GET','uri':encodeURI(_0x1a3d4f+_0x16a2('0x93')+_0x4c2c8f+'\x27'),'headers':{'Authorization':_0x16a2('0x94')+_0x5a216a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b585b);})[_0x16a2('0x2b')](function(_0x1e0449){var _0x267302=_0x1e0449['value'][0x0];var _0x580ba6=_0x267302[_0x16a2('0x95')];var _0x5dc71f={'method':_0x16a2('0x96'),'uri':_0x1a3d4f+_0x16a2('0x97')+_0x580ba6+_0x16a2('0x98'),'headers':{'Authorization':_0x16a2('0x94')+_0x5a216a,'If-None-Match':null,'OData-Version':_0x16a2('0x99')},'json':!![]};return rp(_0x5dc71f);})[_0x16a2('0x2b')](function(_0xcf4971){_0x21d69e=_0xcf4971;_0x4a26c7=_0x21d69e[_0x16a2('0x9a')];_0x4a26c7=_[_0x16a2('0x9b')](_0x4a26c7,function(_0xc1f8d7){return!_0x20925c[_0x16a2('0x9c')](_0xc1f8d7[_0x16a2('0x9d')]);});var _0x5aefd8=[];var _0xaf3f29=[];_0x4a26c7[_0x16a2('0x9e')](function(_0x7d4141){if(_0x7d4141[_0x16a2('0x9f')]){var _0xd52783=_0x7d4141[_0x16a2('0x9f')]['substring'](_0x7d4141[_0x16a2('0x9f')][_0x16a2('0x44')]('.')+0x1);if(_0xd52783==='PicklistAttributeMetadata'){_0x5aefd8[_0x16a2('0xa0')](getSelectList(_0x1a3d4f,_0x2ea6a3,_0xaf3f29,_0x21d69e[_0x16a2('0x95')],_0x7d4141[_0x16a2('0x95')],_0x5a216a));}}});return Promise[_0x16a2('0xa1')](_0x5aefd8);})[_0x16a2('0x2b')](function(_0x2ce2bb){_0xd3d733=_0x2ce2bb[0x0];var _0x589df1=[];var _0x5d3254=[];_0x4a26c7[_0x16a2('0x9e')](function(_0x4c826a){if(!_['isNil'](_0x4c826a['@odata.type'])){var _0x49a5c1=_0x4c826a[_0x16a2('0x9f')][_0x16a2('0xa2')](_0x4c826a[_0x16a2('0x9f')][_0x16a2('0x44')]('.')+0x1);if(_0x49a5c1===_0x16a2('0xa3')){_0x589df1['push'](getBooleanList(_0x1a3d4f,_0x2ea6a3,_0x5d3254,_0x21d69e['MetadataId'],_0x4c826a[_0x16a2('0x95')],_0x5a216a));}}});return Promise[_0x16a2('0xa1')](_0x589df1);})['then'](function(_0x244396){_0x13b60b=_0x244396[0x0];var _0x57d186=[];var _0xf07654=[];_0x4a26c7[_0x16a2('0x9e')](function(_0x3b3d4b){if(_0x3b3d4b[_0x16a2('0x9f')]){var _0x2a893d=_0x3b3d4b[_0x16a2('0x9f')][_0x16a2('0xa2')](_0x3b3d4b[_0x16a2('0x9f')][_0x16a2('0x44')]('.')+0x1);if(_0x2a893d===_0x16a2('0xa4')||_0x2a893d===_0x16a2('0xa5')||_0x2a893d===_0x16a2('0xa6')||_0x2a893d===_0x16a2('0xa7')||_0x2a893d===_0x16a2('0xa8')||_0x2a893d===_0x16a2('0xa9')||_0x2a893d===_0x16a2('0xaa')||_0x2a893d==='EntityNameAttributeMetadata'||_0x2a893d==='StateAttributeMetadata'||_0x2a893d===_0x16a2('0xab')){_0x57d186[_0x16a2('0xa0')](getInputList(_0x1a3d4f,_0x2ea6a3,_0x2a893d,_0xf07654,_0x21d69e[_0x16a2('0x95')],_0x3b3d4b[_0x16a2('0x95')],_0x5a216a));}}});return Promise['all'](_0x57d186);})[_0x16a2('0x2b')](function(_0x19ffdc){_0xe55d74=_0x19ffdc[0x0];var _0x386dd9=_0xd3d733[_0x16a2('0x86')](_0x13b60b)['concat'](_0xe55d74);var _0x6789b6={'count':_0x386dd9[_0x16a2('0x24')],'rows':_0x386dd9};return _0x6789b6;})[_0x16a2('0x2b')](respondWithResult(_0x2fc07f,null))[_0x16a2('0x2f')](function(_0x3ca093){var _0x3e0540=_0x196eec['query']['test']?0x1f4:_0x3ca093[_0x16a2('0xac')]||0x1f4;logger[_0x16a2('0x12')](_0x3ca093[_0x16a2('0x13')]);delete _0x3ca093[_0x16a2('0x14')];if(_0x3e0540===0x191){_0x3e0540=0x190;}_0x2fc07f[_0x16a2('0x6')](_0x3e0540)[_0x16a2('0x15')](_0x196eec[_0x16a2('0x1e')][_0x16a2('0xad')]?{'message':_0x16a2('0xae'),'statusCode':_0x3ca093[_0x16a2('0xac')]}:_0x3ca093);});};function getSelectList(_0x37010d,_0x34a066,_0x171a98,_0x66ea32,_0x25e364,_0x3618e8){var _0x34f8fe={'method':_0x16a2('0x96'),'uri':_0x37010d+_0x16a2('0x97')+_0x66ea32+_0x16a2('0xaf')+_0x25e364+_0x16a2('0xb0')+_0x16a2('0xb1'),'headers':{'Authorization':_0x16a2('0x94')+_0x3618e8,'If-None-Match':null,'OData-Version':_0x16a2('0x99')},'json':!![]};return rp(_0x34f8fe)[_0x16a2('0x2b')](function(_0x411af7){var _0x13a704=[];var _0x5b4fb7=_0x411af7['OptionSet'][_0x16a2('0xb2')];_0x5b4fb7[_0x16a2('0x9e')](function(_0x1c732b){_0x13a704[_0x16a2('0xa0')]({'name':_0x1c732b[_0x16a2('0xb3')][_0x16a2('0xb4')][_0x16a2('0xb3')],'value':String(_0x1c732b[_0x16a2('0xb5')])});});var _0x5a22ee={'id':_0x34a066+'_'+_0x411af7[_0x16a2('0x9d')],'name':_0x411af7[_0x16a2('0xb6')]['UserLocalizedLabel'][_0x16a2('0xb3')],'custom':![],'options':_0x13a704};_0x171a98['push'](_0x5a22ee);return _0x171a98;});}function getBooleanList(_0x36d379,_0x56966f,_0x53f2d3,_0x52f3e3,_0xb39251,_0xfdf2ae){var _0x219335={'method':'GET','uri':_0x36d379+_0x16a2('0x97')+_0x52f3e3+_0x16a2('0xaf')+_0xb39251+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0xfdf2ae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x219335)[_0x16a2('0x2b')](function(_0x495f38){var _0x5aac88=[];_0x5aac88[_0x16a2('0xa0')]({'name':_0x495f38[_0x16a2('0xb7')][_0x16a2('0xb8')]['Label'][_0x16a2('0xb4')][_0x16a2('0xb3')],'value':'true'},{'name':_0x495f38[_0x16a2('0xb7')][_0x16a2('0xb9')][_0x16a2('0xb3')][_0x16a2('0xb4')]['Label'],'value':_0x16a2('0xba')});var _0x181cbf={'id':_0x56966f+'_'+_0x495f38[_0x16a2('0x9d')],'name':_0x495f38[_0x16a2('0xb6')][_0x16a2('0xb4')][_0x16a2('0xb3')],'custom':![],'options':_0x5aac88};_0x53f2d3[_0x16a2('0xa0')](_0x181cbf);return _0x53f2d3;});}function getInputList(_0x53da07,_0x5a45ee,_0xbfa323,_0x2ae6d8,_0x207485,_0x9945c,_0x5859ca){var _0x1cef76={'method':_0x16a2('0x96'),'uri':_0x53da07+_0x16a2('0x97')+_0x207485+_0x16a2('0xaf')+_0x9945c+_0x16a2('0xbb')+_0xbfa323+_0x16a2('0xbc'),'headers':{'Authorization':_0x16a2('0x94')+_0x5859ca,'If-None-Match':null,'OData-Version':_0x16a2('0x99')},'json':!![]};return rp(_0x1cef76)[_0x16a2('0x2b')](function(_0x4ceaf1){var _0x441424={'id':_0x5a45ee+'_'+_0x4ceaf1[_0x16a2('0x9d')],'name':_0x4ceaf1[_0x16a2('0xb6')]['UserLocalizedLabel']?_0x4ceaf1['DisplayName'][_0x16a2('0xb4')][_0x16a2('0xb3')]:_0x4ceaf1['LogicalName'],'custom':![],'options':[]};_0x2ae6d8[_0x16a2('0xa0')](_0x441424);return _0x2ae6d8;});} \ No newline at end of file +var _0x6b0e=['Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','update','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','responseby','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','/oauth2/token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','isNil','BooleanAttributeMetadata','all','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6b0e,0x185));var _0xe6b0=function(_0x379062,_0x25a617){_0x379062=_0x379062-0x0;var _0x4f9acd=_0x6b0e[_0x379062];return _0x4f9acd;};'use strict';var rp=require(_0xe6b0('0x0'));var util=require(_0xe6b0('0x1'));var _=require(_0xe6b0('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe6b0('0x3'))('api');var db=require(_0xe6b0('0x4'))['db'];var integrations=require(_0xe6b0('0x5'));function respondWithResult(_0x4b472e,_0x10dd4d){_0x10dd4d=_0x10dd4d||0xc8;return function(_0x178af2){if(_0x178af2){return _0x4b472e[_0xe6b0('0x6')](_0x10dd4d)[_0xe6b0('0x7')](_0x178af2);}};}function respondWithFilteredResult(_0x1eb26c,_0x5d719e){return function(_0x4f9e4a){if(_0x4f9e4a){var _0x3c88bc=typeof _0x5d719e[_0xe6b0('0x8')]===_0xe6b0('0x9')&&typeof _0x5d719e['limit']===_0xe6b0('0x9');var _0x51739e=_0x4f9e4a[_0xe6b0('0xa')];var _0x57a51d=_0x3c88bc?0x0:_0x5d719e[_0xe6b0('0x8')];var _0x110477=_0x3c88bc?_0x4f9e4a[_0xe6b0('0xa')]:_0x5d719e['offset']+_0x5d719e['limit'];var _0x41cc7a;if(_0x110477>=_0x51739e){_0x110477=_0x51739e;_0x41cc7a=0xc8;}else{_0x41cc7a=0xce;}_0x1eb26c['status'](_0x41cc7a);return _0x1eb26c[_0xe6b0('0xb')](_0xe6b0('0xc'),_0x57a51d+'-'+_0x110477+'/'+_0x51739e)[_0xe6b0('0x7')](_0x4f9e4a);}return null;};}function saveUpdates(_0x77c755){return function(_0xa2f4bc){if(_0xa2f4bc){return _0xa2f4bc['update'](_0x77c755)[_0xe6b0('0xd')](function(_0x124722){return _0x124722;});}return null;};}function removeEntity(_0x21ba83){return function(_0x31c3e5){if(_0x31c3e5){return _0x31c3e5[_0xe6b0('0xe')]()['then'](function(){_0x21ba83[_0xe6b0('0x6')](0xcc)[_0xe6b0('0xf')]();});}};}function handleEntityNotFound(_0x360e49){return function(_0x2b2af7){if(!_0x2b2af7){_0x360e49[_0xe6b0('0x10')](0x194);}return _0x2b2af7;};}function handleError(_0x37d4ad,_0x424ac3){_0x424ac3=_0x424ac3||0x1f4;return function(_0x3069e0){logger[_0xe6b0('0x11')](_0x3069e0[_0xe6b0('0x12')]);if(_0x3069e0[_0xe6b0('0x13')]){delete _0x3069e0[_0xe6b0('0x13')];}_0x37d4ad[_0xe6b0('0x6')](_0x424ac3)[_0xe6b0('0x14')](_0x3069e0);};}exports[_0xe6b0('0x15')]=function(_0x156d4e,_0x467673){var _0x40f5db={},_0x427bfb={},_0x3ca422={'count':0x0,'rows':[]};var _0x467cbf=_[_0xe6b0('0x16')](db[_0xe6b0('0x17')][_0xe6b0('0x18')],function(_0x53c090){return{'name':_0x53c090['fieldName'],'type':_0x53c090[_0xe6b0('0x19')][_0xe6b0('0x1a')]};});_0x427bfb[_0xe6b0('0x1b')]=_[_0xe6b0('0x16')](_0x467cbf,_0xe6b0('0x13'));_0x427bfb[_0xe6b0('0x1c')]=_[_0xe6b0('0x1d')](_0x156d4e[_0xe6b0('0x1c')]);_0x427bfb[_0xe6b0('0x1e')]=_[_0xe6b0('0x1f')](_0x427bfb[_0xe6b0('0x1b')],_0x427bfb[_0xe6b0('0x1c')]);_0x40f5db[_0xe6b0('0x20')]=_[_0xe6b0('0x1f')](_0x427bfb[_0xe6b0('0x1b')],qs[_0xe6b0('0x21')](_0x156d4e['query']['fields']));_0x40f5db[_0xe6b0('0x20')]=_0x40f5db[_0xe6b0('0x20')][_0xe6b0('0x22')]?_0x40f5db[_0xe6b0('0x20')]:_0x427bfb['model'];if(!_0x156d4e['query'][_0xe6b0('0x23')](_0xe6b0('0x24'))){_0x40f5db[_0xe6b0('0x25')]=qs[_0xe6b0('0x25')](_0x156d4e[_0xe6b0('0x1c')]['limit']);_0x40f5db[_0xe6b0('0x8')]=qs['offset'](_0x156d4e[_0xe6b0('0x1c')][_0xe6b0('0x8')]);}_0x40f5db['order']=qs[_0xe6b0('0x26')](_0x156d4e[_0xe6b0('0x1c')][_0xe6b0('0x26')]);_0x40f5db['where']=qs[_0xe6b0('0x1e')](_[_0xe6b0('0x27')](_0x156d4e[_0xe6b0('0x1c')],_0x427bfb[_0xe6b0('0x1e')]),_0x467cbf);if(_0x156d4e[_0xe6b0('0x1c')][_0xe6b0('0x28')]){_0x40f5db[_0xe6b0('0x29')]=_[_0xe6b0('0x2a')](_0x40f5db[_0xe6b0('0x29')],{'$or':_[_0xe6b0('0x16')](_0x467cbf,function(_0x4ebaf8){if(_0x4ebaf8[_0xe6b0('0x19')]!==_0xe6b0('0x2b')){var _0xf50eb7={};_0xf50eb7[_0x4ebaf8[_0xe6b0('0x13')]]={'$like':'%'+_0x156d4e[_0xe6b0('0x1c')]['filter']+'%'};return _0xf50eb7;}})});}_0x40f5db=_['merge']({},_0x40f5db,_0x156d4e['options']);var _0x17309c={'where':_0x40f5db[_0xe6b0('0x29')]};return db[_0xe6b0('0x17')][_0xe6b0('0xa')](_0x17309c)[_0xe6b0('0xd')](function(_0x37dfa8){_0x3ca422['count']=_0x37dfa8;if(_0x156d4e[_0xe6b0('0x1c')][_0xe6b0('0x2c')]){_0x40f5db['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x40f5db);})[_0xe6b0('0xd')](function(_0x142816){_0x3ca422[_0xe6b0('0x2d')]=_0x142816;return _0x3ca422;})[_0xe6b0('0xd')](respondWithFilteredResult(_0x467673,_0x40f5db))[_0xe6b0('0x2e')](handleError(_0x467673,null));};exports[_0xe6b0('0x2f')]=function(_0x37c6b1,_0xaed73){var _0x5454d={'raw':![],'where':{'id':_0x37c6b1[_0xe6b0('0x30')]['id']}},_0x5f1a97={};_0x5f1a97['model']=_[_0xe6b0('0x1d')](db[_0xe6b0('0x17')][_0xe6b0('0x18')]);_0x5f1a97[_0xe6b0('0x1c')]=_[_0xe6b0('0x1d')](_0x37c6b1['query']);_0x5f1a97[_0xe6b0('0x1e')]=_[_0xe6b0('0x1f')](_0x5f1a97[_0xe6b0('0x1b')],_0x5f1a97['query']);_0x5454d[_0xe6b0('0x20')]=_[_0xe6b0('0x1f')](_0x5f1a97['model'],qs[_0xe6b0('0x21')](_0x37c6b1['query'][_0xe6b0('0x21')]));_0x5454d[_0xe6b0('0x20')]=_0x5454d[_0xe6b0('0x20')][_0xe6b0('0x22')]?_0x5454d['attributes']:_0x5f1a97[_0xe6b0('0x1b')];if(_0x37c6b1[_0xe6b0('0x1c')][_0xe6b0('0x2c')]){_0x5454d[_0xe6b0('0x31')]=[{'all':!![]}];}_0x5454d=_[_0xe6b0('0x2a')]({},_0x5454d,_0x37c6b1[_0xe6b0('0x32')]);return db[_0xe6b0('0x17')][_0xe6b0('0x33')](_0x5454d)[_0xe6b0('0xd')](handleEntityNotFound(_0xaed73,null))['then'](respondWithResult(_0xaed73,null))[_0xe6b0('0x2e')](handleError(_0xaed73,null));};exports[_0xe6b0('0x34')]=function(_0x3f40f8,_0x468df3){return db[_0xe6b0('0x17')][_0xe6b0('0x34')](_0x3f40f8[_0xe6b0('0x35')],{})['then'](respondWithResult(_0x468df3,0xc9))[_0xe6b0('0x2e')](handleError(_0x468df3,null));};exports[_0xe6b0('0x36')]=function(_0x26bb76,_0xc4c8c9){if(_0x26bb76[_0xe6b0('0x35')]['id']){delete _0x26bb76[_0xe6b0('0x35')]['id'];}return db[_0xe6b0('0x17')][_0xe6b0('0x33')]({'where':{'id':_0x26bb76[_0xe6b0('0x30')]['id']}})[_0xe6b0('0xd')](handleEntityNotFound(_0xc4c8c9,null))[_0xe6b0('0xd')](saveUpdates(_0x26bb76[_0xe6b0('0x35')],null))[_0xe6b0('0xd')](respondWithResult(_0xc4c8c9,null))[_0xe6b0('0x2e')](handleError(_0xc4c8c9,null));};exports['destroy']=function(_0x1736ac,_0x44104a){return db[_0xe6b0('0x17')][_0xe6b0('0x33')]({'where':{'id':_0x1736ac[_0xe6b0('0x30')]['id']}})['then'](handleEntityNotFound(_0x44104a,null))[_0xe6b0('0xd')](removeEntity(_0x44104a,null))[_0xe6b0('0x2e')](handleError(_0x44104a,null));};exports[_0xe6b0('0x37')]=function(_0x3cdceb,_0x4245cc){var _0x55be18={};var _0xb83eb5={};var _0x296d5b;var _0x24b780;return db['Dynamics365Account'][_0xe6b0('0x38')]({'where':{'id':_0x3cdceb['params']['id']}})['then'](handleEntityNotFound(_0x4245cc,null))[_0xe6b0('0xd')](function(_0x5afce5){if(_0x5afce5){_0x296d5b=_0x5afce5;_0xb83eb5['model']=_[_0xe6b0('0x1d')](db[_0xe6b0('0x39')][_0xe6b0('0x18')]);_0xb83eb5[_0xe6b0('0x1c')]=_[_0xe6b0('0x1d')](_0x3cdceb['query']);_0xb83eb5[_0xe6b0('0x1e')]=_[_0xe6b0('0x1f')](_0xb83eb5[_0xe6b0('0x1b')],_0xb83eb5['query']);_0x55be18[_0xe6b0('0x20')]=_[_0xe6b0('0x1f')](_0xb83eb5[_0xe6b0('0x1b')],qs[_0xe6b0('0x21')](_0x3cdceb[_0xe6b0('0x1c')]['fields']));_0x55be18[_0xe6b0('0x20')]=_0x55be18['attributes'][_0xe6b0('0x22')]?_0x55be18['attributes']:_0xb83eb5['model'];_0x55be18[_0xe6b0('0x3a')]=qs[_0xe6b0('0x26')](_0x3cdceb[_0xe6b0('0x1c')][_0xe6b0('0x26')]);_0x55be18[_0xe6b0('0x29')]=qs[_0xe6b0('0x1e')](_[_0xe6b0('0x27')](_0x3cdceb['query'],_0xb83eb5[_0xe6b0('0x1e')]));if(_0x3cdceb['query'][_0xe6b0('0x28')]){_0x55be18['where']=_[_0xe6b0('0x2a')](_0x55be18['where'],{'$or':_[_0xe6b0('0x16')](_0x55be18[_0xe6b0('0x20')],function(_0x2cb2c8){var _0x5e1f8f={};_0x5e1f8f[_0x2cb2c8]={'$like':'%'+_0x3cdceb[_0xe6b0('0x1c')]['filter']+'%'};return _0x5e1f8f;})});}_0x55be18=_[_0xe6b0('0x2a')]({},_0x55be18,_0x3cdceb[_0xe6b0('0x32')]);return _0x296d5b[_0xe6b0('0x37')](_0x55be18);}})[_0xe6b0('0xd')](function(_0x23fa64){if(_0x23fa64){_0x24b780=_0x23fa64[_0xe6b0('0x22')];if(!_0x3cdceb[_0xe6b0('0x1c')][_0xe6b0('0x23')](_0xe6b0('0x24'))){_0x55be18['limit']=qs[_0xe6b0('0x25')](_0x3cdceb[_0xe6b0('0x1c')]['limit']);_0x55be18[_0xe6b0('0x8')]=qs[_0xe6b0('0x8')](_0x3cdceb[_0xe6b0('0x1c')]['offset']);}return _0x296d5b[_0xe6b0('0x37')](_0x55be18);}})[_0xe6b0('0xd')](function(_0x3f9d3f){if(_0x3f9d3f){return _0x3f9d3f?{'count':_0x24b780,'rows':_0x3f9d3f}:null;}})['then'](respondWithResult(_0x4245cc,null))['catch'](handleError(_0x4245cc,null));};exports[_0xe6b0('0x3b')]=function(_0x18658a,_0x1cf152){if(_0x18658a['body']['id']){delete _0x18658a['body']['id'];}return db['Dynamics365Account'][_0xe6b0('0x38')]({'where':{'id':_0x18658a[_0xe6b0('0x30')]['id']}})[_0xe6b0('0xd')](handleEntityNotFound(_0x1cf152,null))[_0xe6b0('0xd')](function(_0x3804f9){if(_0x3804f9){_0x18658a['body'][_0xe6b0('0x3c')]=_0x3804f9['id'];_0x18658a[_0xe6b0('0x35')][_0xe6b0('0x3d')]=integrations[_0xe6b0('0x3e')](_0x18658a[_0xe6b0('0x35')][_0xe6b0('0x3f')],_0x18658a['body']['type']);_0x18658a[_0xe6b0('0x35')]['Descriptions']=integrations[_0xe6b0('0x40')](_0x18658a[_0xe6b0('0x35')][_0xe6b0('0x3f')],_0x18658a[_0xe6b0('0x35')]['type']);return db[_0xe6b0('0x39')][_0xe6b0('0x34')](_0x18658a['body'],{'include':[{'model':db[_0xe6b0('0x41')],'as':_0xe6b0('0x3d')},{'model':db[_0xe6b0('0x41')],'as':_0xe6b0('0x42')}]});}return null;})[_0xe6b0('0xd')](respondWithResult(_0x1cf152,null))[_0xe6b0('0x2e')](handleError(_0x1cf152,null));};function sanitizeRemoteUri(_0xd343fc){var _0x12f6cb=_0xd343fc[_0xe6b0('0x43')](-0x1);if(_0x12f6cb==='/')return _0xd343fc[_0xe6b0('0x44')](0x0,_0xd343fc[_0xe6b0('0x45')](_0x12f6cb));return _0xd343fc;}function getWebApiUrl(_0x5a870b){return util[_0xe6b0('0x46')](_0xe6b0('0x47'),_0x5a870b);}exports[_0xe6b0('0x48')]=function(_0x5b1dc6,_0x55d0f8){var _0x187bfe=_0x5b1dc6[_0xe6b0('0x1c')][_0xe6b0('0x49')];var _0x493e9c=_0x187bfe===_0xe6b0('0x4a')?_0xe6b0('0x4b'):_0xe6b0('0x4c');var _0x1ee6ad='';var _0x300713='';var _0x5d6571='';var _0x13b9f4='';var _0x1abbf4='';var _0x4884bd='';var _0x86c056='';var _0x4c8882='';var _0x5686f0=[_0xe6b0('0x4d'),_0xe6b0('0x4e'),_0xe6b0('0x4f'),'ownerid',_0xe6b0('0x50'),_0xe6b0('0x51'),_0xe6b0('0x52'),'regardingobjectid',_0xe6b0('0x53'),_0xe6b0('0x54')];var _0x3e3ae7=[_0xe6b0('0x55'),_0xe6b0('0x56'),_0xe6b0('0x57'),_0xe6b0('0x58'),_0xe6b0('0x59'),_0xe6b0('0x5a'),_0xe6b0('0x5b'),'contractidname',_0xe6b0('0x5c'),_0xe6b0('0x5d'),_0xe6b0('0x5e'),_0xe6b0('0x5f'),_0xe6b0('0x60'),'createdonbehalfbyname',_0xe6b0('0x61'),_0xe6b0('0x62'),_0xe6b0('0x63'),_0xe6b0('0x64'),'emailaddress','entitlementidname',_0xe6b0('0x65'),_0xe6b0('0x66'),_0xe6b0('0x67'),_0xe6b0('0x68'),_0xe6b0('0x69'),'followupby',_0xe6b0('0x6a'),_0xe6b0('0x6b'),_0xe6b0('0x6c'),_0xe6b0('0x6d'),_0xe6b0('0x6e'),_0xe6b0('0x6f'),_0xe6b0('0x70'),_0xe6b0('0x71'),_0xe6b0('0x72'),_0xe6b0('0x73'),'modifiedonbehalfbyname',_0xe6b0('0x74'),'msdyn_incidenttypename',_0xe6b0('0x75'),'numberofchildincidents',_0xe6b0('0x76'),'overriddencreatedon',_0xe6b0('0x77'),_0xe6b0('0x78'),_0xe6b0('0x79'),_0xe6b0('0x7a'),'primarycontactidname',_0xe6b0('0x7b'),_0xe6b0('0x7c'),'productidname',_0xe6b0('0x7d'),'resolveby','resolvebykpiidname',_0xe6b0('0x7e'),'responsiblecontactidname','responsiblecontactidyominame',_0xe6b0('0x7f'),_0xe6b0('0x80'),'slaname',_0xe6b0('0x81'),_0xe6b0('0x82'),_0xe6b0('0x83'),_0xe6b0('0x84'),'ticketnumber',_0xe6b0('0x85'),_0xe6b0('0x86'),_0xe6b0('0x87'),_0xe6b0('0x88'),_0xe6b0('0x89')];var _0x31a7d6=_0x5686f0[_0xe6b0('0x8a')](_0x3e3ae7);return db[_0xe6b0('0x17')]['findOne']({'where':{'id':_0x5b1dc6[_0xe6b0('0x30')]['id']},'attributes':['id',_0xe6b0('0x8b'),_0xe6b0('0x8c'),_0xe6b0('0x8d'),_0xe6b0('0x8e'),_0xe6b0('0x8f'),_0xe6b0('0x90'),_0xe6b0('0x91')],'include':[{'model':db[_0xe6b0('0x92')],'as':_0xe6b0('0x92'),'attributes':['id',_0xe6b0('0x93'),_0xe6b0('0x94')]}]})[_0xe6b0('0xd')](handleEntityNotFound(_0x55d0f8,null))['then'](function(_0x19d9c5){if(_0x19d9c5){if(_0x19d9c5[_0xe6b0('0x91')]){_0x19d9c5[_0xe6b0('0x95')]=_0x19d9c5[_0xe6b0('0x92')][_0xe6b0('0x93')];_0x4c8882=sanitizeRemoteUri(_0x19d9c5[_0xe6b0('0x92')]['data7']);_0x86c056=getWebApiUrl(_0x4c8882);return _0x19d9c5;}_0x4c8882=sanitizeRemoteUri(_0x19d9c5[_0xe6b0('0x8d')]);_0x86c056=getWebApiUrl(_0x4c8882);var _0x46c3f2={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x19d9c5[_0xe6b0('0x8e')]+_0xe6b0('0x96'),'form':{'client_id':_0x19d9c5[_0xe6b0('0x8f')],'resource':_0x4c8882,'username':_0x19d9c5[_0xe6b0('0x8b')],'password':_0x19d9c5['password'],'grant_type':_0xe6b0('0x8c'),'client_secret':_0x19d9c5[_0xe6b0('0x90')]},'json':!![]};return rp(_0x46c3f2);}})[_0xe6b0('0xd')](function(_0x56e137){_0x4884bd=_0x56e137[_0xe6b0('0x95')];var _0x4dca18={'method':_0xe6b0('0x97'),'uri':encodeURI(_0x86c056+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x493e9c+'\x27'),'headers':{'Authorization':_0xe6b0('0x98')+_0x4884bd,'If-None-Match':null,'OData-Version':_0xe6b0('0x99')},'json':!![]};return rp(_0x4dca18);})[_0xe6b0('0xd')](function(_0x49dbe8){var _0x54eec0=_0x49dbe8['value'][0x0];var _0xb951da=_0x54eec0[_0xe6b0('0x9a')];var _0x5d7fe5={'method':_0xe6b0('0x97'),'uri':_0x86c056+_0xe6b0('0x9b')+_0xb951da+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe6b0('0x98')+_0x4884bd,'If-None-Match':null,'OData-Version':_0xe6b0('0x99')},'json':!![]};return rp(_0x5d7fe5);})['then'](function(_0x25dc01){_0x1ee6ad=_0x25dc01;_0x300713=_0x1ee6ad[_0xe6b0('0x9c')];_0x300713=_[_0xe6b0('0x9d')](_0x300713,function(_0x2a9907){return!_0x31a7d6[_0xe6b0('0x9e')](_0x2a9907[_0xe6b0('0x9f')]);});var _0x338898=[];var _0x5025e4=[];_0x300713[_0xe6b0('0xa0')](function(_0x295432){if(_0x295432[_0xe6b0('0xa1')]){var _0x2fc61c=_0x295432[_0xe6b0('0xa1')][_0xe6b0('0x44')](_0x295432[_0xe6b0('0xa1')]['lastIndexOf']('.')+0x1);if(_0x2fc61c==='PicklistAttributeMetadata'){_0x338898[_0xe6b0('0xa2')](getSelectList(_0x86c056,_0x187bfe,_0x5025e4,_0x1ee6ad[_0xe6b0('0x9a')],_0x295432[_0xe6b0('0x9a')],_0x4884bd));}}});return Promise['all'](_0x338898);})[_0xe6b0('0xd')](function(_0x203ac7){_0x5d6571=_0x203ac7[0x0];var _0x2a7e3d=[];var _0xca45e4=[];_0x300713[_0xe6b0('0xa0')](function(_0x104015){if(!_[_0xe6b0('0xa3')](_0x104015[_0xe6b0('0xa1')])){var _0x383827=_0x104015['@odata.type'][_0xe6b0('0x44')](_0x104015[_0xe6b0('0xa1')][_0xe6b0('0x45')]('.')+0x1);if(_0x383827===_0xe6b0('0xa4')){_0x2a7e3d[_0xe6b0('0xa2')](getBooleanList(_0x86c056,_0x187bfe,_0xca45e4,_0x1ee6ad['MetadataId'],_0x104015[_0xe6b0('0x9a')],_0x4884bd));}}});return Promise[_0xe6b0('0xa5')](_0x2a7e3d);})[_0xe6b0('0xd')](function(_0x2ece3d){_0x13b9f4=_0x2ece3d[0x0];var _0x18d23f=[];var _0x3727ce=[];_0x300713['forEach'](function(_0x468db2){if(_0x468db2['@odata.type']){var _0x561e73=_0x468db2['@odata.type'][_0xe6b0('0x44')](_0x468db2['@odata.type'][_0xe6b0('0x45')]('.')+0x1);if(_0x561e73==='StringAttributeMetadata'||_0x561e73==='DoubleAttributeMetadata'||_0x561e73===_0xe6b0('0xa6')||_0x561e73===_0xe6b0('0xa7')||_0x561e73===_0xe6b0('0xa8')||_0x561e73===_0xe6b0('0xa9')||_0x561e73===_0xe6b0('0xaa')||_0x561e73===_0xe6b0('0xab')||_0x561e73===_0xe6b0('0xac')||_0x561e73===_0xe6b0('0xad')){_0x18d23f['push'](getInputList(_0x86c056,_0x187bfe,_0x561e73,_0x3727ce,_0x1ee6ad[_0xe6b0('0x9a')],_0x468db2[_0xe6b0('0x9a')],_0x4884bd));}}});return Promise[_0xe6b0('0xa5')](_0x18d23f);})[_0xe6b0('0xd')](function(_0x2b0004){_0x1abbf4=_0x2b0004[0x0];var _0x21fdc4=_0x5d6571['concat'](_0x13b9f4)[_0xe6b0('0x8a')](_0x1abbf4);var _0x434d99={'count':_0x21fdc4['length'],'rows':_0x21fdc4};return _0x434d99;})[_0xe6b0('0xd')](respondWithResult(_0x55d0f8,null))['catch'](function(_0x47d57a){var _0x3f6d85=_0x5b1dc6[_0xe6b0('0x1c')][_0xe6b0('0xae')]?0x1f4:_0x47d57a[_0xe6b0('0xaf')]||0x1f4;logger['error'](_0x47d57a[_0xe6b0('0x12')]);delete _0x47d57a[_0xe6b0('0x13')];if(_0x3f6d85===0x191){_0x3f6d85=0x190;}_0x55d0f8[_0xe6b0('0x6')](_0x3f6d85)['send'](_0x5b1dc6[_0xe6b0('0x1c')][_0xe6b0('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x47d57a[_0xe6b0('0xaf')]}:_0x47d57a);});};function getSelectList(_0x52fa42,_0x557c25,_0x542777,_0x51d41c,_0x3a9bef,_0x3d188e){var _0x3d5600={'method':_0xe6b0('0x97'),'uri':_0x52fa42+_0xe6b0('0x9b')+_0x51d41c+_0xe6b0('0xb0')+_0x3a9bef+_0xe6b0('0xb1')+_0xe6b0('0xb2'),'headers':{'Authorization':_0xe6b0('0x98')+_0x3d188e,'If-None-Match':null,'OData-Version':_0xe6b0('0x99')},'json':!![]};return rp(_0x3d5600)[_0xe6b0('0xd')](function(_0x1e3c39){var _0x21898b=[];var _0x29e536=_0x1e3c39[_0xe6b0('0xb3')][_0xe6b0('0xb4')];_0x29e536['forEach'](function(_0x19268a){_0x21898b[_0xe6b0('0xa2')]({'name':_0x19268a[_0xe6b0('0xb5')]['UserLocalizedLabel'][_0xe6b0('0xb5')],'value':String(_0x19268a[_0xe6b0('0xb6')])});});var _0x29881e={'id':_0x557c25+'_'+_0x1e3c39[_0xe6b0('0x9f')],'name':_0x1e3c39[_0xe6b0('0xb7')][_0xe6b0('0xb8')][_0xe6b0('0xb5')],'custom':![],'options':_0x21898b};_0x542777[_0xe6b0('0xa2')](_0x29881e);return _0x542777;});}function getBooleanList(_0x4cacc2,_0x346667,_0x3a1533,_0x53e182,_0x4d90b5,_0x5ab339){var _0x42cc09={'method':_0xe6b0('0x97'),'uri':_0x4cacc2+_0xe6b0('0x9b')+_0x53e182+_0xe6b0('0xb0')+_0x4d90b5+_0xe6b0('0xb9'),'headers':{'Authorization':_0xe6b0('0x98')+_0x5ab339,'If-None-Match':null,'OData-Version':_0xe6b0('0x99')},'json':!![]};return rp(_0x42cc09)[_0xe6b0('0xd')](function(_0x380266){var _0x3f55c9=[];_0x3f55c9[_0xe6b0('0xa2')]({'name':_0x380266[_0xe6b0('0xb3')]['TrueOption'][_0xe6b0('0xb5')]['UserLocalizedLabel'][_0xe6b0('0xb5')],'value':_0xe6b0('0xba')},{'name':_0x380266['OptionSet'][_0xe6b0('0xbb')]['Label'][_0xe6b0('0xb8')][_0xe6b0('0xb5')],'value':'false'});var _0x143f4a={'id':_0x346667+'_'+_0x380266['LogicalName'],'name':_0x380266[_0xe6b0('0xb7')][_0xe6b0('0xb8')][_0xe6b0('0xb5')],'custom':![],'options':_0x3f55c9};_0x3a1533['push'](_0x143f4a);return _0x3a1533;});}function getInputList(_0x45632a,_0x5a1bbd,_0x18045a,_0x516fd2,_0x20c6c1,_0x3a9478,_0xc4f981){var _0x2d1836={'method':_0xe6b0('0x97'),'uri':_0x45632a+_0xe6b0('0x9b')+_0x20c6c1+_0xe6b0('0xb0')+_0x3a9478+_0xe6b0('0xbc')+_0x18045a+_0xe6b0('0xbd'),'headers':{'Authorization':'Bearer\x20'+_0xc4f981,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d1836)[_0xe6b0('0xd')](function(_0x5c1cf7){var _0x2ceb66={'id':_0x5a1bbd+'_'+_0x5c1cf7['LogicalName'],'name':_0x5c1cf7['DisplayName'][_0xe6b0('0xb8')]?_0x5c1cf7['DisplayName']['UserLocalizedLabel']['Label']:_0x5c1cf7[_0xe6b0('0x9f')],'custom':![],'options':[]};_0x516fd2['push'](_0x2ceb66);return _0x516fd2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b43339c..430d8bd 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x41b7a6,_0x4bd8bb){var _0x58b56d=function(_0x2025cf){while(--_0x2025cf){_0x41b7a6['push'](_0x41b7a6['shift']());}};_0x58b56d(++_0x4bd8bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x585f70,_0x475a3e){var _0x1658d3=function(_0x1605eb){while(--_0x1605eb){_0x585f70['push'](_0x585f70['shift']());}};_0x1658d3(++_0x475a3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',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 2f7b3a5..7f45742 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 _0xadae=['debug','catch','where','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','GetDynamics365Account'];(function(_0x4834b0,_0x136f5b){var _0x1213da=function(_0x5b45f0){while(--_0x5b45f0){_0x4834b0['push'](_0x4834b0['shift']());}};_0x1213da(++_0x136f5b);}(_0xadae,0x6d));var _0xeada=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xadae[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var moment=require(_0xeada('0x2'));var BPromise=require(_0xeada('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeada('0x4'));var db=require(_0xeada('0x5'))['db'];var utils=require(_0xeada('0x6'));var logger=require(_0xeada('0x7'))(_0xeada('0x8'));var config=require(_0xeada('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeada('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59aae9,_0x4ba0e6,_0xb02351){return new BPromise(function(_0x55f39a,_0x19a5d0){return client[_0xeada('0xb')](_0x59aae9,_0xb02351)[_0xeada('0xc')](function(_0x1cbbcc){logger[_0xeada('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x4ba0e6,_0xeada('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4ba0e6,'request\x20sent',JSON[_0xeada('0xf')](_0x1cbbcc));if(_0x1cbbcc['error']){if(_0x1cbbcc[_0xeada('0x10')][_0xeada('0x11')]===0x1f4){logger[_0xeada('0x10')](_0xeada('0x12'),_0x4ba0e6,_0x1cbbcc[_0xeada('0x10')]['message']);return _0x19a5d0(_0x1cbbcc['error'][_0xeada('0x13')]);}logger[_0xeada('0x10')](_0xeada('0x12'),_0x4ba0e6,_0x1cbbcc[_0xeada('0x10')][_0xeada('0x13')]);return _0x55f39a(_0x1cbbcc['error'][_0xeada('0x13')]);}else{logger[_0xeada('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x4ba0e6,_0xeada('0xe'));_0x55f39a(_0x1cbbcc[_0xeada('0x14')][_0xeada('0x13')]);}})['catch'](function(_0x43368b){logger['error'](_0xeada('0x12'),_0x4ba0e6,_0x43368b);_0x19a5d0(_0x43368b);});});}exports['GetDynamics365Account']=function(_0x550c15){var _0x1b2257=this;return new Promise(function(_0x15a6b1,_0xf01ac1){return db[_0xeada('0x15')][_0xeada('0x16')]({'raw':_0x550c15[_0xeada('0x17')]?_0x550c15['options'][_0xeada('0x18')]===undefined?!![]:![]:!![],'where':_0x550c15[_0xeada('0x17')]?_0x550c15['options']['where']||null:null,'attributes':_0x550c15[_0xeada('0x17')]?_0x550c15[_0xeada('0x17')][_0xeada('0x19')]||null:null,'limit':_0x550c15[_0xeada('0x17')]?_0x550c15[_0xeada('0x17')][_0xeada('0x1a')]||null:null,'include':_0x550c15[_0xeada('0x17')]?_0x550c15[_0xeada('0x17')][_0xeada('0x1b')]?_[_0xeada('0x1c')](_0x550c15[_0xeada('0x17')]['include'],function(_0x3e3982){return{'model':db[_0x3e3982[_0xeada('0x1d')]],'as':_0x3e3982['as'],'attributes':_0x3e3982[_0xeada('0x19')],'include':_0x3e3982[_0xeada('0x1b')]?_['map'](_0x3e3982['include'],function(_0x2de8e3){return{'model':db[_0x2de8e3[_0xeada('0x1d')]],'as':_0x2de8e3['as'],'attributes':_0x2de8e3[_0xeada('0x19')],'include':_0x2de8e3['include']?_[_0xeada('0x1c')](_0x2de8e3['include'],function(_0xef5ee2){return{'model':db[_0xef5ee2[_0xeada('0x1d')]],'as':_0xef5ee2['as'],'attributes':_0xef5ee2['attributes']};}):[]};}):[]};}):[]:[]})[_0xeada('0xc')](function(_0x2768c1){logger[_0xeada('0xd')](_0xeada('0x1e'),_0x550c15);logger[_0xeada('0x1f')](_0xeada('0x1e'),_0x550c15,JSON['stringify'](_0x2768c1));_0x15a6b1(_0x2768c1);})[_0xeada('0x20')](function(_0x146a07){logger[_0xeada('0x10')](_0xeada('0x1e'),_0x146a07[_0xeada('0x13')],_0x550c15);_0xf01ac1(_0x1b2257[_0xeada('0x10')](0x1f4,_0x146a07[_0xeada('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x317e34){var _0x5e750d=this;return new Promise(function(_0x56d601,_0x2303dd){return db[_0xeada('0x15')]['find']({'raw':_0x317e34[_0xeada('0x17')]?_0x317e34['options'][_0xeada('0x18')]===undefined?!![]:![]:!![],'where':_0x317e34[_0xeada('0x17')]?_0x317e34['options'][_0xeada('0x21')]||null:null,'attributes':_0x317e34[_0xeada('0x17')]?_0x317e34[_0xeada('0x17')][_0xeada('0x19')]||null:null,'include':_0x317e34['options']?_0x317e34[_0xeada('0x17')][_0xeada('0x1b')]?_[_0xeada('0x1c')](_0x317e34['options'][_0xeada('0x1b')],function(_0x33ab7a){return{'model':db[_0x33ab7a['model']],'as':_0x33ab7a['as'],'attributes':_0x33ab7a[_0xeada('0x19')],'include':_0x33ab7a[_0xeada('0x1b')]?_['map'](_0x33ab7a[_0xeada('0x1b')],function(_0x26d398){return{'model':db[_0x26d398[_0xeada('0x1d')]],'as':_0x26d398['as'],'attributes':_0x26d398['attributes'],'include':_0x26d398[_0xeada('0x1b')]?_[_0xeada('0x1c')](_0x26d398[_0xeada('0x1b')],function(_0xaf064d){return{'model':db[_0xaf064d[_0xeada('0x1d')]],'as':_0xaf064d['as'],'attributes':_0xaf064d[_0xeada('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeada('0xc')](function(_0x10a8ce){logger['info'](_0xeada('0x22'),_0x317e34);logger['debug']('ShowDynamics365Account',_0x317e34,JSON['stringify'](_0x10a8ce));_0x56d601(_0x10a8ce);})[_0xeada('0x20')](function(_0x1cc227){logger['error'](_0xeada('0x22'),_0x1cc227['message'],_0x317e34);_0x2303dd(_0x5e750d['error'](0x1f4,_0x1cc227[_0xeada('0x13')]));});});}; \ No newline at end of file +var _0xce83=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','catch','find','then','ShowDynamics365Account','lodash','util'];(function(_0x2c53c5,_0x3eef95){var _0x52ab4f=function(_0x4cfed5){while(--_0x4cfed5){_0x2c53c5['push'](_0x2c53c5['shift']());}};_0x52ab4f(++_0x3eef95);}(_0xce83,0x14b));var _0x3ce8=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xce83[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x3ce8('0x0'));var util=require(_0x3ce8('0x1'));var moment=require('moment');var BPromise=require(_0x3ce8('0x2'));var rs=require(_0x3ce8('0x3'));var fs=require('fs');var Redis=require(_0x3ce8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ce8('0x5'));var logger=require(_0x3ce8('0x6'))(_0x3ce8('0x7'));var config=require(_0x3ce8('0x8'));var jayson=require(_0x3ce8('0x9'));var client=jayson[_0x3ce8('0xa')][_0x3ce8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114379,_0x39e142,_0x4b0a06){return new BPromise(function(_0x1c7762,_0x2bb5b2){return client[_0x3ce8('0xc')](_0x114379,_0x4b0a06)['then'](function(_0x217fb5){logger[_0x3ce8('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x39e142,_0x3ce8('0xe'));logger[_0x3ce8('0xf')](_0x3ce8('0x10'),_0x39e142,'request\x20sent',JSON[_0x3ce8('0x11')](_0x217fb5));if(_0x217fb5[_0x3ce8('0x12')]){if(_0x217fb5[_0x3ce8('0x12')][_0x3ce8('0x13')]===0x1f4){logger[_0x3ce8('0x12')](_0x3ce8('0x14'),_0x39e142,_0x217fb5[_0x3ce8('0x12')][_0x3ce8('0x15')]);return _0x2bb5b2(_0x217fb5['error'][_0x3ce8('0x15')]);}logger[_0x3ce8('0x12')](_0x3ce8('0x14'),_0x39e142,_0x217fb5[_0x3ce8('0x12')][_0x3ce8('0x15')]);return _0x1c7762(_0x217fb5[_0x3ce8('0x12')][_0x3ce8('0x15')]);}else{logger[_0x3ce8('0xd')](_0x3ce8('0x14'),_0x39e142,_0x3ce8('0xe'));_0x1c7762(_0x217fb5['result'][_0x3ce8('0x15')]);}})['catch'](function(_0x55c375){logger[_0x3ce8('0x12')](_0x3ce8('0x14'),_0x39e142,_0x55c375);_0x2bb5b2(_0x55c375);});});}exports[_0x3ce8('0x16')]=function(_0xde0c1e){var _0x102127=this;return new Promise(function(_0x5a6329,_0x155836){return db[_0x3ce8('0x17')][_0x3ce8('0x18')]({'raw':_0xde0c1e[_0x3ce8('0x19')]?_0xde0c1e[_0x3ce8('0x19')][_0x3ce8('0x1a')]===undefined?!![]:![]:!![],'where':_0xde0c1e[_0x3ce8('0x19')]?_0xde0c1e['options'][_0x3ce8('0x1b')]||null:null,'attributes':_0xde0c1e[_0x3ce8('0x19')]?_0xde0c1e[_0x3ce8('0x19')][_0x3ce8('0x1c')]||null:null,'limit':_0xde0c1e['options']?_0xde0c1e['options'][_0x3ce8('0x1d')]||null:null,'include':_0xde0c1e[_0x3ce8('0x19')]?_0xde0c1e[_0x3ce8('0x19')]['include']?_['map'](_0xde0c1e[_0x3ce8('0x19')][_0x3ce8('0x1e')],function(_0x3dd726){return{'model':db[_0x3dd726[_0x3ce8('0x1f')]],'as':_0x3dd726['as'],'attributes':_0x3dd726['attributes'],'include':_0x3dd726['include']?_[_0x3ce8('0x20')](_0x3dd726[_0x3ce8('0x1e')],function(_0xd0bb1b){return{'model':db[_0xd0bb1b[_0x3ce8('0x1f')]],'as':_0xd0bb1b['as'],'attributes':_0xd0bb1b[_0x3ce8('0x1c')],'include':_0xd0bb1b['include']?_[_0x3ce8('0x20')](_0xd0bb1b[_0x3ce8('0x1e')],function(_0x35acb2){return{'model':db[_0x35acb2['model']],'as':_0x35acb2['as'],'attributes':_0x35acb2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x560051){logger[_0x3ce8('0xd')](_0x3ce8('0x16'),_0xde0c1e);logger['debug']('GetDynamics365Account',_0xde0c1e,JSON[_0x3ce8('0x11')](_0x560051));_0x5a6329(_0x560051);})[_0x3ce8('0x21')](function(_0x49fb8c){logger[_0x3ce8('0x12')]('GetDynamics365Account',_0x49fb8c['message'],_0xde0c1e);_0x155836(_0x102127['error'](0x1f4,_0x49fb8c[_0x3ce8('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x128595){var _0x137e69=this;return new Promise(function(_0x65d903,_0x23e09e){return db[_0x3ce8('0x17')][_0x3ce8('0x22')]({'raw':_0x128595[_0x3ce8('0x19')]?_0x128595[_0x3ce8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x128595[_0x3ce8('0x19')]?_0x128595[_0x3ce8('0x19')]['where']||null:null,'attributes':_0x128595[_0x3ce8('0x19')]?_0x128595[_0x3ce8('0x19')][_0x3ce8('0x1c')]||null:null,'include':_0x128595[_0x3ce8('0x19')]?_0x128595[_0x3ce8('0x19')][_0x3ce8('0x1e')]?_[_0x3ce8('0x20')](_0x128595[_0x3ce8('0x19')][_0x3ce8('0x1e')],function(_0x9321f3){return{'model':db[_0x9321f3['model']],'as':_0x9321f3['as'],'attributes':_0x9321f3['attributes'],'include':_0x9321f3[_0x3ce8('0x1e')]?_[_0x3ce8('0x20')](_0x9321f3[_0x3ce8('0x1e')],function(_0x2761aa){return{'model':db[_0x2761aa[_0x3ce8('0x1f')]],'as':_0x2761aa['as'],'attributes':_0x2761aa[_0x3ce8('0x1c')],'include':_0x2761aa[_0x3ce8('0x1e')]?_[_0x3ce8('0x20')](_0x2761aa[_0x3ce8('0x1e')],function(_0x22eb2a){return{'model':db[_0x22eb2a['model']],'as':_0x22eb2a['as'],'attributes':_0x22eb2a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ce8('0x23')](function(_0x480f9b){logger[_0x3ce8('0xd')](_0x3ce8('0x24'),_0x128595);logger[_0x3ce8('0xf')](_0x3ce8('0x24'),_0x128595,JSON[_0x3ce8('0x11')](_0x480f9b));_0x65d903(_0x480f9b);})[_0x3ce8('0x21')](function(_0x559866){logger[_0x3ce8('0x12')](_0x3ce8('0x24'),_0x559866[_0x3ce8('0x15')],_0x128595);_0x23e09e(_0x137e69[_0x3ce8('0x12')](0x1f4,_0x559866[_0x3ce8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1d429b9..c996b0b 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 _0xc009=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x421e8d,_0x572137){var _0xd1938d=function(_0x5c4ed0){while(--_0x5c4ed0){_0x421e8d['push'](_0x421e8d['shift']());}};_0xd1938d(++_0x572137);}(_0xc009,0xc9));var _0x9c00=function(_0x54b7e9,_0x18c9fe){_0x54b7e9=_0x54b7e9-0x0;var _0x1913ff=_0xc009[_0x54b7e9];return _0x1913ff;};'use strict';var multer=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var path=require('path');var timeout=require(_0x9c00('0x2'));var express=require(_0x9c00('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c00('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c00('0x5'));var controller=require(_0x9c00('0x6'));router[_0x9c00('0x7')]('/',auth[_0x9c00('0x8')](),controller[_0x9c00('0x9')]);router['get'](_0x9c00('0xa'),auth['isAuthenticated'](),controller[_0x9c00('0xb')]);router['get'](_0x9c00('0xc'),auth[_0x9c00('0x8')](),controller[_0x9c00('0xd')]);router[_0x9c00('0x7')](_0x9c00('0xe'),auth[_0x9c00('0x8')](),controller[_0x9c00('0xf')]);router['get'](_0x9c00('0x10'),auth[_0x9c00('0x8')](),controller[_0x9c00('0x11')]);router['post']('/',auth[_0x9c00('0x8')](),controller[_0x9c00('0x12')]);router[_0x9c00('0x13')](_0x9c00('0xa'),auth['isAuthenticated'](),controller[_0x9c00('0x14')]);router[_0x9c00('0x15')](_0x9c00('0xa'),auth[_0x9c00('0x8')](),controller['destroy']);module[_0x9c00('0x16')]=router; \ No newline at end of file +var _0x311e=['put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x311e,0x17d));var _0xe311=function(_0x11e1ea,_0x5ad728){_0x11e1ea=_0x11e1ea-0x0;var _0x98bd72=_0x311e[_0x11e1ea];return _0x98bd72;};'use strict';var multer=require('multer');var util=require(_0xe311('0x0'));var path=require(_0xe311('0x1'));var timeout=require(_0xe311('0x2'));var express=require('express');var router=express[_0xe311('0x3')]();var fs_extra=require(_0xe311('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe311('0x5'));var config=require(_0xe311('0x6'));var controller=require(_0xe311('0x7'));router[_0xe311('0x8')]('/',auth[_0xe311('0x9')](),controller[_0xe311('0xa')]);router[_0xe311('0x8')](_0xe311('0xb'),auth['isAuthenticated'](),controller[_0xe311('0xc')]);router[_0xe311('0x8')](_0xe311('0xd'),auth['isAuthenticated'](),controller[_0xe311('0xe')]);router[_0xe311('0x8')](_0xe311('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe311('0x8')]('/:id/descriptions',auth[_0xe311('0x9')](),controller[_0xe311('0x10')]);router[_0xe311('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe311('0x12')](_0xe311('0xb'),auth['isAuthenticated'](),controller[_0xe311('0x13')]);router['delete'](_0xe311('0xb'),auth[_0xe311('0x9')](),controller['destroy']);module[_0xe311('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d037df0..5de1aba 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 _0x4dd3=['sequelize','exports','STRING','incident','ENUM','contact','BOOLEAN'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0x4dd3,0xf5));var _0x34dd=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x4dd3[_0x580971];return _0x16d873;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'name':{'type':Sequelize[_0x34dd('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x34dd('0x3'),'phonecall'),'defaultValue':_0x34dd('0x3')},'moduleCreate':{'type':Sequelize[_0x34dd('0x4')](_0x34dd('0x5'),'nothing'),'defaultValue':_0x34dd('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x34dd('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x34dd('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0869=['sequelize','exports','STRING','phonecall','incident','ENUM','contact','nothing'];(function(_0x520138,_0x28b48e){var _0x46b0bf=function(_0x13798e){while(--_0x13798e){_0x520138['push'](_0x520138['shift']());}};_0x46b0bf(++_0x28b48e);}(_0x0869,0x1c8));var _0x9086=function(_0x5c3ce4,_0x4a58e2){_0x5c3ce4=_0x5c3ce4-0x0;var _0xc90b44=_0x0869[_0x5c3ce4];return _0xc90b44;};'use strict';var Sequelize=require(_0x9086('0x0'));module[_0x9086('0x1')]={'name':{'type':Sequelize[_0x9086('0x2')]},'description':{'type':Sequelize[_0x9086('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x9086('0x3')),'defaultValue':_0x9086('0x4')},'moduleCreate':{'type':Sequelize[_0x9086('0x5')](_0x9086('0x6'),_0x9086('0x7')),'defaultValue':_0x9086('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9086('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e3cc425..3f93b70 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 _0xa0e0=['fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','getFields','Dynamics365Field','getSubjects','findOne','hasOwnProperty','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes'];(function(_0x5a5e3d,_0x54b3af){var _0x306d45=function(_0xf31ce0){while(--_0xf31ce0){_0x5a5e3d['push'](_0x5a5e3d['shift']());}};_0x306d45(++_0x54b3af);}(_0xa0e0,0x1b4));var _0x0a0e=function(_0x54a0fd,_0x1ca212){_0x54a0fd=_0x54a0fd-0x0;var _0x23aea3=_0xa0e0[_0x54a0fd];return _0x23aea3;};'use strict';var emlformat=require(_0x0a0e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a0e('0x1'));var rp=require(_0x0a0e('0x2'));var moment=require(_0x0a0e('0x3'));var BPromise=require(_0x0a0e('0x4'));var Mustache=require(_0x0a0e('0x5'));var util=require(_0x0a0e('0x6'));var path=require(_0x0a0e('0x7'));var sox=require('sox');var csv=require(_0x0a0e('0x8'));var ejs=require(_0x0a0e('0x9'));var fs=require('fs');var fs_extra=require(_0x0a0e('0xa'));var _=require(_0x0a0e('0xb'));var squel=require('squel');var crypto=require(_0x0a0e('0xc'));var jsforce=require(_0x0a0e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a0e('0xe'));var Papa=require(_0x0a0e('0xf'));var Redis=require(_0x0a0e('0x10'));var authService=require(_0x0a0e('0x11'));var qs=require(_0x0a0e('0x12'));var as=require(_0x0a0e('0x13'));var hardwareService=require(_0x0a0e('0x14'));var logger=require(_0x0a0e('0x15'))(_0x0a0e('0x16'));var utils=require(_0x0a0e('0x17'));var config=require(_0x0a0e('0x18'));var licenseUtil=require(_0x0a0e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x97f00a,_0x2da11c){_0x2da11c=_0x2da11c||0xcc;return function(_0x38839c){if(_0x38839c){return _0x97f00a[_0x0a0e('0x1a')](_0x2da11c);}return _0x97f00a[_0x0a0e('0x1b')](_0x2da11c)[_0x0a0e('0x1c')]();};}function respondWithResult(_0x2630eb,_0x2f4dd3){_0x2f4dd3=_0x2f4dd3||0xc8;return function(_0x1f2b5a){if(_0x1f2b5a){return _0x2630eb[_0x0a0e('0x1b')](_0x2f4dd3)[_0x0a0e('0x1d')](_0x1f2b5a);}};}function respondWithFilteredResult(_0x2fc50b,_0x263d1a){return function(_0x15e5dc){if(_0x15e5dc){var _0x390c71=typeof _0x263d1a[_0x0a0e('0x1e')]==='undefined'&&typeof _0x263d1a['limit']===_0x0a0e('0x1f');var _0x567df1=_0x15e5dc[_0x0a0e('0x20')];var _0x2cf288=_0x390c71?0x0:_0x263d1a[_0x0a0e('0x1e')];var _0x2e376f=_0x390c71?_0x15e5dc[_0x0a0e('0x20')]:_0x263d1a[_0x0a0e('0x1e')]+_0x263d1a['limit'];var _0xa5a063;if(_0x2e376f>=_0x567df1){_0x2e376f=_0x567df1;_0xa5a063=0xc8;}else{_0xa5a063=0xce;}_0x2fc50b[_0x0a0e('0x1b')](_0xa5a063);return _0x2fc50b[_0x0a0e('0x21')]('Content-Range',_0x2cf288+'-'+_0x2e376f+'/'+_0x567df1)[_0x0a0e('0x1d')](_0x15e5dc);}return null;};}function patchUpdates(_0x1a79c6){return function(_0x3e3cf4){try{jsonpatch[_0x0a0e('0x22')](_0x3e3cf4,_0x1a79c6,!![]);}catch(_0x405c05){return BPromise[_0x0a0e('0x23')](_0x405c05);}return _0x3e3cf4[_0x0a0e('0x24')]();};}function saveUpdates(_0x436dd8,_0x699c9f){return function(_0x316d14){if(_0x316d14){return _0x316d14[_0x0a0e('0x25')](_0x436dd8)[_0x0a0e('0x26')](function(_0x560672){return _0x560672;});}return null;};}function removeEntity(_0x443c62,_0xff8609){return function(_0x1f605c){if(_0x1f605c){return _0x1f605c[_0x0a0e('0x27')]()[_0x0a0e('0x26')](function(){_0x443c62[_0x0a0e('0x1b')](0xcc)[_0x0a0e('0x1c')]();});}};}function handleEntityNotFound(_0x426ed3,_0x4daa4e){return function(_0x1539be){if(!_0x1539be){_0x426ed3['sendStatus'](0x194);}return _0x1539be;};}function handleError(_0x264588,_0x418a17){_0x418a17=_0x418a17||0x1f4;return function(_0x273d7c){logger['error'](_0x273d7c[_0x0a0e('0x28')]);if(_0x273d7c['name']){delete _0x273d7c['name'];}_0x264588[_0x0a0e('0x1b')](_0x418a17)[_0x0a0e('0x29')](_0x273d7c);};}exports[_0x0a0e('0x2a')]=function(_0x291b58,_0x89081d){var _0x476673={},_0x32062d={},_0x48aafb={'count':0x0,'rows':[]};var _0xb83a99=_[_0x0a0e('0x2b')](db[_0x0a0e('0x2c')][_0x0a0e('0x2d')],function(_0x492197){return{'name':_0x492197[_0x0a0e('0x2e')],'type':_0x492197[_0x0a0e('0x2f')][_0x0a0e('0x30')]};});_0x32062d[_0x0a0e('0x31')]=_['map'](_0xb83a99,_0x0a0e('0x32'));_0x32062d[_0x0a0e('0x33')]=_[_0x0a0e('0x34')](_0x291b58['query']);_0x32062d[_0x0a0e('0x35')]=_[_0x0a0e('0x36')](_0x32062d['model'],_0x32062d[_0x0a0e('0x33')]);_0x476673[_0x0a0e('0x37')]=_[_0x0a0e('0x36')](_0x32062d['model'],qs['fields'](_0x291b58[_0x0a0e('0x33')][_0x0a0e('0x38')]));_0x476673[_0x0a0e('0x37')]=_0x476673[_0x0a0e('0x37')][_0x0a0e('0x39')]?_0x476673[_0x0a0e('0x37')]:_0x32062d['model'];if(!_0x291b58[_0x0a0e('0x33')]['hasOwnProperty'](_0x0a0e('0x3a'))){_0x476673[_0x0a0e('0x3b')]=qs[_0x0a0e('0x3b')](_0x291b58[_0x0a0e('0x33')]['limit']);_0x476673[_0x0a0e('0x1e')]=qs[_0x0a0e('0x1e')](_0x291b58['query']['offset']);}_0x476673[_0x0a0e('0x3c')]=qs[_0x0a0e('0x3d')](_0x291b58[_0x0a0e('0x33')][_0x0a0e('0x3d')]);_0x476673[_0x0a0e('0x3e')]=qs[_0x0a0e('0x35')](_[_0x0a0e('0x3f')](_0x291b58[_0x0a0e('0x33')],_0x32062d[_0x0a0e('0x35')]),_0xb83a99);if(_0x291b58[_0x0a0e('0x33')][_0x0a0e('0x40')]){_0x476673[_0x0a0e('0x3e')]=_[_0x0a0e('0x41')](_0x476673['where'],{'$or':_['map'](_0xb83a99,function(_0x5ba077){if(_0x5ba077[_0x0a0e('0x2f')]!==_0x0a0e('0x42')){var _0x21b97c={};_0x21b97c[_0x5ba077['name']]={'$like':'%'+_0x291b58[_0x0a0e('0x33')]['filter']+'%'};return _0x21b97c;}})});}_0x476673=_['merge']({},_0x476673,_0x291b58[_0x0a0e('0x43')]);var _0x36c664={'where':_0x476673['where']};return db[_0x0a0e('0x2c')][_0x0a0e('0x20')](_0x36c664)[_0x0a0e('0x26')](function(_0x426a03){_0x48aafb[_0x0a0e('0x20')]=_0x426a03;if(_0x291b58[_0x0a0e('0x33')]['includeAll']){_0x476673[_0x0a0e('0x44')]=[{'all':!![]}];}return db[_0x0a0e('0x2c')]['findAll'](_0x476673);})[_0x0a0e('0x26')](function(_0x3a3b14){_0x48aafb[_0x0a0e('0x45')]=_0x3a3b14;return _0x48aafb;})[_0x0a0e('0x26')](respondWithFilteredResult(_0x89081d,_0x476673))[_0x0a0e('0x46')](handleError(_0x89081d,null));};exports['show']=function(_0x326784,_0x326f26){var _0xe83579={'raw':![],'where':{'id':_0x326784[_0x0a0e('0x47')]['id']}},_0x3f02b8={};_0x3f02b8[_0x0a0e('0x31')]=_['keys'](db[_0x0a0e('0x2c')][_0x0a0e('0x2d')]);_0x3f02b8['query']=_['keys'](_0x326784[_0x0a0e('0x33')]);_0x3f02b8['filters']=_['intersection'](_0x3f02b8['model'],_0x3f02b8[_0x0a0e('0x33')]);_0xe83579[_0x0a0e('0x37')]=_[_0x0a0e('0x36')](_0x3f02b8[_0x0a0e('0x31')],qs[_0x0a0e('0x38')](_0x326784[_0x0a0e('0x33')][_0x0a0e('0x38')]));_0xe83579[_0x0a0e('0x37')]=_0xe83579[_0x0a0e('0x37')][_0x0a0e('0x39')]?_0xe83579[_0x0a0e('0x37')]:_0x3f02b8[_0x0a0e('0x31')];if(_0x326784['query'][_0x0a0e('0x48')]){_0xe83579['include']=[{'all':!![]}];}_0xe83579=_[_0x0a0e('0x41')]({},_0xe83579,_0x326784[_0x0a0e('0x43')]);return db[_0x0a0e('0x2c')][_0x0a0e('0x49')](_0xe83579)[_0x0a0e('0x26')](handleEntityNotFound(_0x326f26,null))[_0x0a0e('0x26')](respondWithResult(_0x326f26,null))[_0x0a0e('0x46')](handleError(_0x326f26,null));};exports['create']=function(_0x387a41,_0xcfb1e5){return db['Dynamics365Configuration'][_0x0a0e('0x4a')](_0x387a41[_0x0a0e('0x4b')],{})[_0x0a0e('0x26')](respondWithResult(_0xcfb1e5,0xc9))[_0x0a0e('0x46')](handleError(_0xcfb1e5,null));};exports['update']=function(_0x562b53,_0x2ca320){if(_0x562b53[_0x0a0e('0x4b')]['id']){delete _0x562b53[_0x0a0e('0x4b')]['id'];}return db[_0x0a0e('0x2c')][_0x0a0e('0x49')]({'where':{'id':_0x562b53['params']['id']}})['then'](handleEntityNotFound(_0x2ca320,null))[_0x0a0e('0x26')](saveUpdates(_0x562b53[_0x0a0e('0x4b')],null))[_0x0a0e('0x26')](respondWithResult(_0x2ca320,null))[_0x0a0e('0x46')](handleError(_0x2ca320,null));};exports[_0x0a0e('0x27')]=function(_0x33f27b,_0x187d4c){return db['Dynamics365Configuration'][_0x0a0e('0x49')]({'where':{'id':_0x33f27b[_0x0a0e('0x47')]['id']}})['then'](handleEntityNotFound(_0x187d4c,null))[_0x0a0e('0x26')](removeEntity(_0x187d4c,null))[_0x0a0e('0x46')](handleError(_0x187d4c,null));};exports[_0x0a0e('0x4c')]=function(_0x4525db,_0x5b3271,_0x1dcb46){var _0x2ab5bb={};var _0x378ba7={};var _0x371e22;var _0x452cc5;return db[_0x0a0e('0x2c')]['findOne']({'where':{'id':_0x4525db['params']['id']}})[_0x0a0e('0x26')](handleEntityNotFound(_0x5b3271,null))['then'](function(_0x54237f){if(_0x54237f){_0x371e22=_0x54237f;_0x378ba7[_0x0a0e('0x31')]=_[_0x0a0e('0x34')](db[_0x0a0e('0x4d')][_0x0a0e('0x2d')]);_0x378ba7[_0x0a0e('0x33')]=_[_0x0a0e('0x34')](_0x4525db['query']);_0x378ba7[_0x0a0e('0x35')]=_['intersection'](_0x378ba7[_0x0a0e('0x31')],_0x378ba7[_0x0a0e('0x33')]);_0x2ab5bb[_0x0a0e('0x37')]=_[_0x0a0e('0x36')](_0x378ba7[_0x0a0e('0x31')],qs[_0x0a0e('0x38')](_0x4525db[_0x0a0e('0x33')]['fields']));_0x2ab5bb['attributes']=_0x2ab5bb[_0x0a0e('0x37')][_0x0a0e('0x39')]?_0x2ab5bb['attributes']:_0x378ba7['model'];_0x2ab5bb[_0x0a0e('0x3c')]=qs[_0x0a0e('0x3d')](_0x4525db[_0x0a0e('0x33')][_0x0a0e('0x3d')]);_0x2ab5bb['where']=qs['filters'](_[_0x0a0e('0x3f')](_0x4525db['query'],_0x378ba7['filters']));if(_0x4525db[_0x0a0e('0x33')]['filter']){_0x2ab5bb['where']=_['merge'](_0x2ab5bb[_0x0a0e('0x3e')],{'$or':_[_0x0a0e('0x2b')](_0x2ab5bb[_0x0a0e('0x37')],function(_0x37170b){var _0x4f581e={};_0x4f581e[_0x37170b]={'$like':'%'+_0x4525db[_0x0a0e('0x33')][_0x0a0e('0x40')]+'%'};return _0x4f581e;})});}_0x2ab5bb=_[_0x0a0e('0x41')]({},_0x2ab5bb,_0x4525db[_0x0a0e('0x43')]);return _0x371e22[_0x0a0e('0x4c')](_0x2ab5bb);}})['then'](function(_0x4da916){if(_0x4da916){_0x452cc5=_0x4da916['length'];if(!_0x4525db[_0x0a0e('0x33')]['hasOwnProperty'](_0x0a0e('0x3a'))){_0x2ab5bb[_0x0a0e('0x3b')]=qs['limit'](_0x4525db[_0x0a0e('0x33')]['limit']);_0x2ab5bb[_0x0a0e('0x1e')]=qs[_0x0a0e('0x1e')](_0x4525db[_0x0a0e('0x33')]['offset']);}return _0x371e22[_0x0a0e('0x4c')](_0x2ab5bb);}})['then'](function(_0x4a2724){if(_0x4a2724){return _0x4a2724?{'count':_0x452cc5,'rows':_0x4a2724}:null;}})[_0x0a0e('0x26')](respondWithResult(_0x5b3271,null))['catch'](handleError(_0x5b3271,null));};exports[_0x0a0e('0x4e')]=function(_0x53d8ae,_0x3f13e0,_0x255849){var _0x5c2408={};var _0x3d6970={};var _0x31b1e2;var _0x113835;return db[_0x0a0e('0x2c')][_0x0a0e('0x4f')]({'where':{'id':_0x53d8ae['params']['id']}})[_0x0a0e('0x26')](handleEntityNotFound(_0x3f13e0,null))['then'](function(_0x5e1925){if(_0x5e1925){_0x31b1e2=_0x5e1925;_0x3d6970[_0x0a0e('0x31')]=_[_0x0a0e('0x34')](db['Dynamics365Field']['rawAttributes']);_0x3d6970[_0x0a0e('0x33')]=_['keys'](_0x53d8ae[_0x0a0e('0x33')]);_0x3d6970[_0x0a0e('0x35')]=_[_0x0a0e('0x36')](_0x3d6970['model'],_0x3d6970[_0x0a0e('0x33')]);_0x5c2408['attributes']=_['intersection'](_0x3d6970['model'],qs[_0x0a0e('0x38')](_0x53d8ae[_0x0a0e('0x33')]['fields']));_0x5c2408[_0x0a0e('0x37')]=_0x5c2408[_0x0a0e('0x37')][_0x0a0e('0x39')]?_0x5c2408['attributes']:_0x3d6970[_0x0a0e('0x31')];_0x5c2408[_0x0a0e('0x3c')]=qs[_0x0a0e('0x3d')](_0x53d8ae['query'][_0x0a0e('0x3d')]);_0x5c2408[_0x0a0e('0x3e')]=qs['filters'](_[_0x0a0e('0x3f')](_0x53d8ae[_0x0a0e('0x33')],_0x3d6970[_0x0a0e('0x35')]));if(_0x53d8ae[_0x0a0e('0x33')][_0x0a0e('0x40')]){_0x5c2408[_0x0a0e('0x3e')]=_['merge'](_0x5c2408[_0x0a0e('0x3e')],{'$or':_[_0x0a0e('0x2b')](_0x5c2408['attributes'],function(_0x3f9295){var _0x60f6e9={};_0x60f6e9[_0x3f9295]={'$like':'%'+_0x53d8ae[_0x0a0e('0x33')]['filter']+'%'};return _0x60f6e9;})});}_0x5c2408=_['merge']({},_0x5c2408,_0x53d8ae[_0x0a0e('0x43')]);return _0x31b1e2[_0x0a0e('0x4e')](_0x5c2408);}})[_0x0a0e('0x26')](function(_0xc9e4b8){if(_0xc9e4b8){_0x113835=_0xc9e4b8[_0x0a0e('0x39')];if(!_0x53d8ae[_0x0a0e('0x33')][_0x0a0e('0x50')]('nolimit')){_0x5c2408[_0x0a0e('0x3b')]=qs['limit'](_0x53d8ae[_0x0a0e('0x33')][_0x0a0e('0x3b')]);_0x5c2408[_0x0a0e('0x1e')]=qs[_0x0a0e('0x1e')](_0x53d8ae['query'][_0x0a0e('0x1e')]);}return _0x31b1e2[_0x0a0e('0x4e')](_0x5c2408);}})[_0x0a0e('0x26')](function(_0x43cbf4){if(_0x43cbf4){return _0x43cbf4?{'count':_0x113835,'rows':_0x43cbf4}:null;}})[_0x0a0e('0x26')](respondWithResult(_0x3f13e0,null))[_0x0a0e('0x46')](handleError(_0x3f13e0,null));};exports[_0x0a0e('0x51')]=function(_0x4f0633,_0x1d047b,_0x6ca399){var _0x213edb={};var _0x19fd59={};var _0x458c4b;var _0x10c7c4;return db[_0x0a0e('0x2c')][_0x0a0e('0x4f')]({'where':{'id':_0x4f0633['params']['id']}})[_0x0a0e('0x26')](handleEntityNotFound(_0x1d047b,null))[_0x0a0e('0x26')](function(_0x52abfb){if(_0x52abfb){_0x458c4b=_0x52abfb;_0x19fd59[_0x0a0e('0x31')]=_[_0x0a0e('0x34')](db[_0x0a0e('0x4d')]['rawAttributes']);_0x19fd59[_0x0a0e('0x33')]=_[_0x0a0e('0x34')](_0x4f0633['query']);_0x19fd59['filters']=_[_0x0a0e('0x36')](_0x19fd59[_0x0a0e('0x31')],_0x19fd59[_0x0a0e('0x33')]);_0x213edb[_0x0a0e('0x37')]=_['intersection'](_0x19fd59[_0x0a0e('0x31')],qs['fields'](_0x4f0633[_0x0a0e('0x33')][_0x0a0e('0x38')]));_0x213edb[_0x0a0e('0x37')]=_0x213edb[_0x0a0e('0x37')][_0x0a0e('0x39')]?_0x213edb['attributes']:_0x19fd59['model'];_0x213edb['order']=qs[_0x0a0e('0x3d')](_0x4f0633[_0x0a0e('0x33')]['sort']);_0x213edb[_0x0a0e('0x3e')]=qs['filters'](_[_0x0a0e('0x3f')](_0x4f0633[_0x0a0e('0x33')],_0x19fd59['filters']));if(_0x4f0633[_0x0a0e('0x33')][_0x0a0e('0x40')]){_0x213edb[_0x0a0e('0x3e')]=_[_0x0a0e('0x41')](_0x213edb[_0x0a0e('0x3e')],{'$or':_['map'](_0x213edb[_0x0a0e('0x37')],function(_0x121066){var _0x63fbdf={};_0x63fbdf[_0x121066]={'$like':'%'+_0x4f0633[_0x0a0e('0x33')]['filter']+'%'};return _0x63fbdf;})});}_0x213edb=_[_0x0a0e('0x41')]({},_0x213edb,_0x4f0633[_0x0a0e('0x43')]);return _0x458c4b[_0x0a0e('0x51')](_0x213edb);}})[_0x0a0e('0x26')](function(_0x2cda26){if(_0x2cda26){_0x10c7c4=_0x2cda26[_0x0a0e('0x39')];if(!_0x4f0633[_0x0a0e('0x33')][_0x0a0e('0x50')](_0x0a0e('0x3a'))){_0x213edb[_0x0a0e('0x3b')]=qs[_0x0a0e('0x3b')](_0x4f0633['query'][_0x0a0e('0x3b')]);_0x213edb[_0x0a0e('0x1e')]=qs[_0x0a0e('0x1e')](_0x4f0633[_0x0a0e('0x33')][_0x0a0e('0x1e')]);}return _0x458c4b[_0x0a0e('0x51')](_0x213edb);}})[_0x0a0e('0x26')](function(_0x410d37){if(_0x410d37){return _0x410d37?{'count':_0x10c7c4,'rows':_0x410d37}:null;}})[_0x0a0e('0x26')](respondWithResult(_0x1d047b,null))[_0x0a0e('0x46')](handleError(_0x1d047b,null));}; \ No newline at end of file +var _0x3104=['rows','catch','params','keys','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','save','update','then','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x3104,0x1a1));var _0x4310=function(_0x2067c,_0x40ceae){_0x2067c=_0x2067c-0x0;var _0x3e5ac6=_0x3104[_0x2067c];return _0x3e5ac6;};'use strict';var emlformat=require(_0x4310('0x0'));var rimraf=require(_0x4310('0x1'));var zipdir=require(_0x4310('0x2'));var jsonpatch=require(_0x4310('0x3'));var rp=require(_0x4310('0x4'));var moment=require(_0x4310('0x5'));var BPromise=require(_0x4310('0x6'));var Mustache=require(_0x4310('0x7'));var util=require(_0x4310('0x8'));var path=require(_0x4310('0x9'));var sox=require(_0x4310('0xa'));var csv=require(_0x4310('0xb'));var ejs=require(_0x4310('0xc'));var fs=require('fs');var fs_extra=require(_0x4310('0xd'));var _=require('lodash');var squel=require(_0x4310('0xe'));var crypto=require(_0x4310('0xf'));var jsforce=require(_0x4310('0x10'));var deskjs=require(_0x4310('0x11'));var toCsv=require(_0x4310('0xb'));var querystring=require(_0x4310('0x12'));var Papa=require(_0x4310('0x13'));var Redis=require(_0x4310('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x4310('0x15'));var as=require(_0x4310('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4310('0x17'));var utils=require(_0x4310('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aac68,_0xfeda01){_0xfeda01=_0xfeda01||0xcc;return function(_0x128446){if(_0x128446){return _0x3aac68[_0x4310('0x19')](_0xfeda01);}return _0x3aac68[_0x4310('0x1a')](_0xfeda01)[_0x4310('0x1b')]();};}function respondWithResult(_0x512226,_0x3a0830){_0x3a0830=_0x3a0830||0xc8;return function(_0x222bfb){if(_0x222bfb){return _0x512226[_0x4310('0x1a')](_0x3a0830)['json'](_0x222bfb);}};}function respondWithFilteredResult(_0x4969af,_0xa61d95){return function(_0x4de885){if(_0x4de885){var _0x1cfb46=typeof _0xa61d95['offset']==='undefined'&&typeof _0xa61d95[_0x4310('0x1c')]===_0x4310('0x1d');var _0x5f499e=_0x4de885['count'];var _0x3a996b=_0x1cfb46?0x0:_0xa61d95[_0x4310('0x1e')];var _0x119c56=_0x1cfb46?_0x4de885[_0x4310('0x1f')]:_0xa61d95['offset']+_0xa61d95['limit'];var _0x17c65b;if(_0x119c56>=_0x5f499e){_0x119c56=_0x5f499e;_0x17c65b=0xc8;}else{_0x17c65b=0xce;}_0x4969af[_0x4310('0x1a')](_0x17c65b);return _0x4969af[_0x4310('0x20')](_0x4310('0x21'),_0x3a996b+'-'+_0x119c56+'/'+_0x5f499e)[_0x4310('0x22')](_0x4de885);}return null;};}function patchUpdates(_0x3ed0b4){return function(_0x41fed3){try{jsonpatch['apply'](_0x41fed3,_0x3ed0b4,!![]);}catch(_0x4ba236){return BPromise['reject'](_0x4ba236);}return _0x41fed3[_0x4310('0x23')]();};}function saveUpdates(_0x3813ec,_0x4afff7){return function(_0x13c36c){if(_0x13c36c){return _0x13c36c[_0x4310('0x24')](_0x3813ec)[_0x4310('0x25')](function(_0x256d3d){return _0x256d3d;});}return null;};}function removeEntity(_0x1622c9,_0xfbff9b){return function(_0x1ae17a){if(_0x1ae17a){return _0x1ae17a['destroy']()[_0x4310('0x25')](function(){_0x1622c9[_0x4310('0x1a')](0xcc)[_0x4310('0x1b')]();});}};}function handleEntityNotFound(_0xb48730,_0x3fc149){return function(_0x5c7828){if(!_0x5c7828){_0xb48730[_0x4310('0x19')](0x194);}return _0x5c7828;};}function handleError(_0x12acef,_0xf9c388){_0xf9c388=_0xf9c388||0x1f4;return function(_0x43c3ee){logger[_0x4310('0x26')](_0x43c3ee[_0x4310('0x27')]);if(_0x43c3ee['name']){delete _0x43c3ee[_0x4310('0x28')];}_0x12acef['status'](_0xf9c388)[_0x4310('0x29')](_0x43c3ee);};}exports[_0x4310('0x2a')]=function(_0x31eb43,_0x18550d){var _0x5f2a80={},_0x5b308f={},_0x460d1d={'count':0x0,'rows':[]};var _0x26b704=_['map'](db[_0x4310('0x2b')][_0x4310('0x2c')],function(_0x1bdc1a){return{'name':_0x1bdc1a[_0x4310('0x2d')],'type':_0x1bdc1a['type'][_0x4310('0x2e')]};});_0x5b308f[_0x4310('0x2f')]=_[_0x4310('0x30')](_0x26b704,_0x4310('0x28'));_0x5b308f['query']=_['keys'](_0x31eb43['query']);_0x5b308f[_0x4310('0x31')]=_[_0x4310('0x32')](_0x5b308f[_0x4310('0x2f')],_0x5b308f[_0x4310('0x33')]);_0x5f2a80[_0x4310('0x34')]=_[_0x4310('0x32')](_0x5b308f['model'],qs[_0x4310('0x35')](_0x31eb43[_0x4310('0x33')][_0x4310('0x35')]));_0x5f2a80[_0x4310('0x34')]=_0x5f2a80[_0x4310('0x34')][_0x4310('0x36')]?_0x5f2a80['attributes']:_0x5b308f[_0x4310('0x2f')];if(!_0x31eb43['query'][_0x4310('0x37')](_0x4310('0x38'))){_0x5f2a80[_0x4310('0x1c')]=qs[_0x4310('0x1c')](_0x31eb43['query'][_0x4310('0x1c')]);_0x5f2a80[_0x4310('0x1e')]=qs['offset'](_0x31eb43[_0x4310('0x33')]['offset']);}_0x5f2a80[_0x4310('0x39')]=qs[_0x4310('0x3a')](_0x31eb43['query']['sort']);_0x5f2a80['where']=qs[_0x4310('0x31')](_[_0x4310('0x3b')](_0x31eb43[_0x4310('0x33')],_0x5b308f[_0x4310('0x31')]),_0x26b704);if(_0x31eb43['query'][_0x4310('0x3c')]){_0x5f2a80[_0x4310('0x3d')]=_[_0x4310('0x3e')](_0x5f2a80[_0x4310('0x3d')],{'$or':_[_0x4310('0x30')](_0x26b704,function(_0x20b078){if(_0x20b078[_0x4310('0x3f')]!==_0x4310('0x40')){var _0x44da7c={};_0x44da7c[_0x20b078['name']]={'$like':'%'+_0x31eb43[_0x4310('0x33')][_0x4310('0x3c')]+'%'};return _0x44da7c;}})});}_0x5f2a80=_[_0x4310('0x3e')]({},_0x5f2a80,_0x31eb43[_0x4310('0x41')]);var _0x360ee0={'where':_0x5f2a80[_0x4310('0x3d')]};return db[_0x4310('0x2b')][_0x4310('0x1f')](_0x360ee0)['then'](function(_0x134fb5){_0x460d1d[_0x4310('0x1f')]=_0x134fb5;if(_0x31eb43['query'][_0x4310('0x42')]){_0x5f2a80[_0x4310('0x43')]=[{'all':!![]}];}return db[_0x4310('0x2b')][_0x4310('0x44')](_0x5f2a80);})['then'](function(_0x5a2ad1){_0x460d1d[_0x4310('0x45')]=_0x5a2ad1;return _0x460d1d;})[_0x4310('0x25')](respondWithFilteredResult(_0x18550d,_0x5f2a80))[_0x4310('0x46')](handleError(_0x18550d,null));};exports['show']=function(_0x3316e4,_0x8c18ee){var _0xb33765={'raw':![],'where':{'id':_0x3316e4[_0x4310('0x47')]['id']}},_0x1140f4={};_0x1140f4[_0x4310('0x2f')]=_[_0x4310('0x48')](db[_0x4310('0x2b')][_0x4310('0x2c')]);_0x1140f4[_0x4310('0x33')]=_[_0x4310('0x48')](_0x3316e4[_0x4310('0x33')]);_0x1140f4[_0x4310('0x31')]=_[_0x4310('0x32')](_0x1140f4[_0x4310('0x2f')],_0x1140f4['query']);_0xb33765[_0x4310('0x34')]=_[_0x4310('0x32')](_0x1140f4[_0x4310('0x2f')],qs['fields'](_0x3316e4['query']['fields']));_0xb33765[_0x4310('0x34')]=_0xb33765[_0x4310('0x34')][_0x4310('0x36')]?_0xb33765[_0x4310('0x34')]:_0x1140f4[_0x4310('0x2f')];if(_0x3316e4[_0x4310('0x33')][_0x4310('0x42')]){_0xb33765[_0x4310('0x43')]=[{'all':!![]}];}_0xb33765=_[_0x4310('0x3e')]({},_0xb33765,_0x3316e4['options']);return db[_0x4310('0x2b')][_0x4310('0x49')](_0xb33765)[_0x4310('0x25')](handleEntityNotFound(_0x8c18ee,null))[_0x4310('0x25')](respondWithResult(_0x8c18ee,null))[_0x4310('0x46')](handleError(_0x8c18ee,null));};exports[_0x4310('0x4a')]=function(_0x1e6b12,_0x52f94b){return db[_0x4310('0x2b')][_0x4310('0x4a')](_0x1e6b12[_0x4310('0x4b')],{})[_0x4310('0x25')](respondWithResult(_0x52f94b,0xc9))['catch'](handleError(_0x52f94b,null));};exports['update']=function(_0x4db0d9,_0x118e0a){if(_0x4db0d9[_0x4310('0x4b')]['id']){delete _0x4db0d9[_0x4310('0x4b')]['id'];}return db[_0x4310('0x2b')]['find']({'where':{'id':_0x4db0d9['params']['id']}})[_0x4310('0x25')](handleEntityNotFound(_0x118e0a,null))['then'](saveUpdates(_0x4db0d9[_0x4310('0x4b')],null))[_0x4310('0x25')](respondWithResult(_0x118e0a,null))[_0x4310('0x46')](handleError(_0x118e0a,null));};exports['destroy']=function(_0x4040a8,_0x33f36c){return db[_0x4310('0x2b')][_0x4310('0x49')]({'where':{'id':_0x4040a8['params']['id']}})[_0x4310('0x25')](handleEntityNotFound(_0x33f36c,null))[_0x4310('0x25')](removeEntity(_0x33f36c,null))[_0x4310('0x46')](handleError(_0x33f36c,null));};exports[_0x4310('0x4c')]=function(_0x1f453f,_0x13ff22,_0xb2bda){var _0x33fc9b={};var _0x3649c8={};var _0x35813c;var _0x324d64;return db[_0x4310('0x2b')][_0x4310('0x4d')]({'where':{'id':_0x1f453f[_0x4310('0x47')]['id']}})[_0x4310('0x25')](handleEntityNotFound(_0x13ff22,null))[_0x4310('0x25')](function(_0x14b2b2){if(_0x14b2b2){_0x35813c=_0x14b2b2;_0x3649c8[_0x4310('0x2f')]=_[_0x4310('0x48')](db[_0x4310('0x4e')][_0x4310('0x2c')]);_0x3649c8[_0x4310('0x33')]=_[_0x4310('0x48')](_0x1f453f[_0x4310('0x33')]);_0x3649c8[_0x4310('0x31')]=_[_0x4310('0x32')](_0x3649c8[_0x4310('0x2f')],_0x3649c8[_0x4310('0x33')]);_0x33fc9b[_0x4310('0x34')]=_[_0x4310('0x32')](_0x3649c8['model'],qs[_0x4310('0x35')](_0x1f453f['query'][_0x4310('0x35')]));_0x33fc9b['attributes']=_0x33fc9b['attributes'][_0x4310('0x36')]?_0x33fc9b['attributes']:_0x3649c8[_0x4310('0x2f')];_0x33fc9b[_0x4310('0x39')]=qs[_0x4310('0x3a')](_0x1f453f[_0x4310('0x33')][_0x4310('0x3a')]);_0x33fc9b['where']=qs[_0x4310('0x31')](_['pick'](_0x1f453f[_0x4310('0x33')],_0x3649c8['filters']));if(_0x1f453f[_0x4310('0x33')][_0x4310('0x3c')]){_0x33fc9b['where']=_[_0x4310('0x3e')](_0x33fc9b[_0x4310('0x3d')],{'$or':_[_0x4310('0x30')](_0x33fc9b[_0x4310('0x34')],function(_0x4c5cbd){var _0x240cbe={};_0x240cbe[_0x4c5cbd]={'$like':'%'+_0x1f453f['query'][_0x4310('0x3c')]+'%'};return _0x240cbe;})});}_0x33fc9b=_[_0x4310('0x3e')]({},_0x33fc9b,_0x1f453f[_0x4310('0x41')]);return _0x35813c[_0x4310('0x4c')](_0x33fc9b);}})['then'](function(_0x468c5e){if(_0x468c5e){_0x324d64=_0x468c5e['length'];if(!_0x1f453f['query'][_0x4310('0x37')](_0x4310('0x38'))){_0x33fc9b[_0x4310('0x1c')]=qs['limit'](_0x1f453f[_0x4310('0x33')][_0x4310('0x1c')]);_0x33fc9b[_0x4310('0x1e')]=qs[_0x4310('0x1e')](_0x1f453f[_0x4310('0x33')][_0x4310('0x1e')]);}return _0x35813c[_0x4310('0x4c')](_0x33fc9b);}})[_0x4310('0x25')](function(_0x145a31){if(_0x145a31){return _0x145a31?{'count':_0x324d64,'rows':_0x145a31}:null;}})[_0x4310('0x25')](respondWithResult(_0x13ff22,null))[_0x4310('0x46')](handleError(_0x13ff22,null));};exports[_0x4310('0x4f')]=function(_0x3651e5,_0x30c01a,_0x13e6f3){var _0x27abcf={};var _0x2c005a={};var _0x1c9d0d;var _0x5ce50c;return db[_0x4310('0x2b')][_0x4310('0x4d')]({'where':{'id':_0x3651e5[_0x4310('0x47')]['id']}})[_0x4310('0x25')](handleEntityNotFound(_0x30c01a,null))[_0x4310('0x25')](function(_0x1cb1de){if(_0x1cb1de){_0x1c9d0d=_0x1cb1de;_0x2c005a[_0x4310('0x2f')]=_[_0x4310('0x48')](db[_0x4310('0x4e')]['rawAttributes']);_0x2c005a['query']=_[_0x4310('0x48')](_0x3651e5[_0x4310('0x33')]);_0x2c005a[_0x4310('0x31')]=_[_0x4310('0x32')](_0x2c005a[_0x4310('0x2f')],_0x2c005a[_0x4310('0x33')]);_0x27abcf[_0x4310('0x34')]=_[_0x4310('0x32')](_0x2c005a[_0x4310('0x2f')],qs['fields'](_0x3651e5[_0x4310('0x33')][_0x4310('0x35')]));_0x27abcf[_0x4310('0x34')]=_0x27abcf['attributes'][_0x4310('0x36')]?_0x27abcf['attributes']:_0x2c005a[_0x4310('0x2f')];_0x27abcf[_0x4310('0x39')]=qs['sort'](_0x3651e5[_0x4310('0x33')][_0x4310('0x3a')]);_0x27abcf['where']=qs[_0x4310('0x31')](_[_0x4310('0x3b')](_0x3651e5[_0x4310('0x33')],_0x2c005a[_0x4310('0x31')]));if(_0x3651e5[_0x4310('0x33')]['filter']){_0x27abcf['where']=_[_0x4310('0x3e')](_0x27abcf[_0x4310('0x3d')],{'$or':_[_0x4310('0x30')](_0x27abcf['attributes'],function(_0x3ab57b){var _0x36f32a={};_0x36f32a[_0x3ab57b]={'$like':'%'+_0x3651e5['query']['filter']+'%'};return _0x36f32a;})});}_0x27abcf=_[_0x4310('0x3e')]({},_0x27abcf,_0x3651e5['options']);return _0x1c9d0d[_0x4310('0x4f')](_0x27abcf);}})[_0x4310('0x25')](function(_0x10fe99){if(_0x10fe99){_0x5ce50c=_0x10fe99[_0x4310('0x36')];if(!_0x3651e5['query'][_0x4310('0x37')]('nolimit')){_0x27abcf[_0x4310('0x1c')]=qs[_0x4310('0x1c')](_0x3651e5['query'][_0x4310('0x1c')]);_0x27abcf[_0x4310('0x1e')]=qs['offset'](_0x3651e5[_0x4310('0x33')]['offset']);}return _0x1c9d0d[_0x4310('0x4f')](_0x27abcf);}})[_0x4310('0x25')](function(_0x5514a1){if(_0x5514a1){return _0x5514a1?{'count':_0x5ce50c,'rows':_0x5514a1}:null;}})[_0x4310('0x25')](respondWithResult(_0x30c01a,null))[_0x4310('0x46')](handleError(_0x30c01a,null));};exports['getDescriptions']=function(_0x4394ec,_0x35b15a,_0x4a8053){var _0x54ab4e={};var _0x2e6195={};var _0x4e47a3;var _0x4621c9;return db[_0x4310('0x2b')][_0x4310('0x4d')]({'where':{'id':_0x4394ec[_0x4310('0x47')]['id']}})[_0x4310('0x25')](handleEntityNotFound(_0x35b15a,null))[_0x4310('0x25')](function(_0x5bc151){if(_0x5bc151){_0x4e47a3=_0x5bc151;_0x2e6195[_0x4310('0x2f')]=_[_0x4310('0x48')](db['Dynamics365Field'][_0x4310('0x2c')]);_0x2e6195[_0x4310('0x33')]=_[_0x4310('0x48')](_0x4394ec['query']);_0x2e6195[_0x4310('0x31')]=_[_0x4310('0x32')](_0x2e6195[_0x4310('0x2f')],_0x2e6195[_0x4310('0x33')]);_0x54ab4e[_0x4310('0x34')]=_[_0x4310('0x32')](_0x2e6195[_0x4310('0x2f')],qs[_0x4310('0x35')](_0x4394ec[_0x4310('0x33')][_0x4310('0x35')]));_0x54ab4e[_0x4310('0x34')]=_0x54ab4e[_0x4310('0x34')][_0x4310('0x36')]?_0x54ab4e[_0x4310('0x34')]:_0x2e6195[_0x4310('0x2f')];_0x54ab4e[_0x4310('0x39')]=qs['sort'](_0x4394ec['query'][_0x4310('0x3a')]);_0x54ab4e[_0x4310('0x3d')]=qs[_0x4310('0x31')](_['pick'](_0x4394ec['query'],_0x2e6195[_0x4310('0x31')]));if(_0x4394ec[_0x4310('0x33')]['filter']){_0x54ab4e[_0x4310('0x3d')]=_['merge'](_0x54ab4e['where'],{'$or':_['map'](_0x54ab4e['attributes'],function(_0x44ebdb){var _0x3e8d62={};_0x3e8d62[_0x44ebdb]={'$like':'%'+_0x4394ec[_0x4310('0x33')]['filter']+'%'};return _0x3e8d62;})});}_0x54ab4e=_['merge']({},_0x54ab4e,_0x4394ec[_0x4310('0x41')]);return _0x4e47a3[_0x4310('0x50')](_0x54ab4e);}})[_0x4310('0x25')](function(_0x11590e){if(_0x11590e){_0x4621c9=_0x11590e[_0x4310('0x36')];if(!_0x4394ec[_0x4310('0x33')][_0x4310('0x37')](_0x4310('0x38'))){_0x54ab4e[_0x4310('0x1c')]=qs[_0x4310('0x1c')](_0x4394ec[_0x4310('0x33')][_0x4310('0x1c')]);_0x54ab4e[_0x4310('0x1e')]=qs[_0x4310('0x1e')](_0x4394ec[_0x4310('0x33')]['offset']);}return _0x4e47a3['getDescriptions'](_0x54ab4e);}})[_0x4310('0x25')](function(_0x50e873){if(_0x50e873){return _0x50e873?{'count':_0x4621c9,'rows':_0x50e873}:null;}})['then'](respondWithResult(_0x35b15a,null))[_0x4310('0x46')](handleError(_0x35b15a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c8d8322..277edc8 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 _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x4fcb7d,_0x18dd5d){var _0x29fff0=function(_0x4bf29b){while(--_0x4bf29b){_0x4fcb7d['push'](_0x4fcb7d['shift']());}};_0x29fff0(++_0x18dd5d);}(_0xbec5,0xe5));var _0x5bec=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0xbec5[_0x54e6f5];return _0x5e8794;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x265029,_0x199002){var _0x3ae0c9=function(_0x311031){while(--_0x311031){_0x265029['push'](_0x265029['shift']());}};_0x3ae0c9(++_0x199002);}(_0x34e8,0x12c));var _0x834e=function(_0x216989,_0x597102){_0x216989=_0x216989-0x0;var _0xe90616=_0x34e8[_0x216989];return _0xe90616;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 169b402..28960b0 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 _0x0f3e=['../../config/utils','../../config/logger','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f3e,0x16a));var _0xe0f3=function(_0x298b0d,_0x1f3a6a){_0x298b0d=_0x298b0d-0x0;var _0x3c3a87=_0x0f3e[_0x298b0d];return _0x3c3a87;};'use strict';var _=require('lodash');var util=require(_0xe0f3('0x0'));var moment=require(_0xe0f3('0x1'));var BPromise=require(_0xe0f3('0x2'));var rs=require(_0xe0f3('0x3'));var fs=require('fs');var Redis=require(_0xe0f3('0x4'));var db=require(_0xe0f3('0x5'))['db'];var utils=require(_0xe0f3('0x6'));var logger=require(_0xe0f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe0f3('0x8')][_0xe0f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aafc8,_0x402f95,_0x2bcc83){return new BPromise(function(_0x2411e4,_0x38aff6){return client[_0xe0f3('0xa')](_0x4aafc8,_0x2bcc83)[_0xe0f3('0xb')](function(_0x21312d){logger[_0xe0f3('0xc')](_0xe0f3('0xd'),_0x402f95,'request\x20sent');logger[_0xe0f3('0xe')](_0xe0f3('0xf'),_0x402f95,_0xe0f3('0x10'),JSON[_0xe0f3('0x11')](_0x21312d));if(_0x21312d[_0xe0f3('0x12')]){if(_0x21312d[_0xe0f3('0x12')][_0xe0f3('0x13')]===0x1f4){logger['error'](_0xe0f3('0xd'),_0x402f95,_0x21312d[_0xe0f3('0x12')][_0xe0f3('0x14')]);return _0x38aff6(_0x21312d[_0xe0f3('0x12')]['message']);}logger[_0xe0f3('0x12')](_0xe0f3('0xd'),_0x402f95,_0x21312d[_0xe0f3('0x12')]['message']);return _0x2411e4(_0x21312d['error'][_0xe0f3('0x14')]);}else{logger[_0xe0f3('0xc')](_0xe0f3('0xd'),_0x402f95,_0xe0f3('0x10'));_0x2411e4(_0x21312d[_0xe0f3('0x15')][_0xe0f3('0x14')]);}})[_0xe0f3('0x16')](function(_0x2b913e){logger[_0xe0f3('0x12')](_0xe0f3('0xd'),_0x402f95,_0x2b913e);_0x38aff6(_0x2b913e);});});} \ No newline at end of file +var _0x39df=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39df,0x107));var _0xf39d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39df[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xf39d('0x0'));var moment=require(_0xf39d('0x1'));var BPromise=require(_0xf39d('0x2'));var rs=require(_0xf39d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf39d('0x4'))['db'];var utils=require(_0xf39d('0x5'));var logger=require(_0xf39d('0x6'))(_0xf39d('0x7'));var config=require(_0xf39d('0x8'));var jayson=require(_0xf39d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372990,_0x55a260,_0x4bccd3){return new BPromise(function(_0x548e3d,_0x5a17cd){return client[_0xf39d('0xa')](_0x372990,_0x4bccd3)['then'](function(_0x41cf26){logger[_0xf39d('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55a260,_0xf39d('0xc'));logger[_0xf39d('0xd')](_0xf39d('0xe'),_0x55a260,_0xf39d('0xc'),JSON[_0xf39d('0xf')](_0x41cf26));if(_0x41cf26[_0xf39d('0x10')]){if(_0x41cf26['error'][_0xf39d('0x11')]===0x1f4){logger[_0xf39d('0x10')](_0xf39d('0x12'),_0x55a260,_0x41cf26[_0xf39d('0x10')][_0xf39d('0x13')]);return _0x5a17cd(_0x41cf26[_0xf39d('0x10')][_0xf39d('0x13')]);}logger[_0xf39d('0x10')](_0xf39d('0x12'),_0x55a260,_0x41cf26[_0xf39d('0x10')]['message']);return _0x548e3d(_0x41cf26[_0xf39d('0x10')][_0xf39d('0x13')]);}else{logger[_0xf39d('0xb')](_0xf39d('0x12'),_0x55a260,_0xf39d('0xc'));_0x548e3d(_0x41cf26[_0xf39d('0x14')][_0xf39d('0x13')]);}})[_0xf39d('0x15')](function(_0x554f91){logger[_0xf39d('0x10')](_0xf39d('0x12'),_0x55a260,_0x554f91);_0x5a17cd(_0x554f91);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8bdc13f..1b1dd3d 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 _0x88e9=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3ee14a,_0x4a651c){var _0x3d426c=function(_0x1e5fd1){while(--_0x1e5fd1){_0x3ee14a['push'](_0x3ee14a['shift']());}};_0x3d426c(++_0x4a651c);}(_0x88e9,0x14f));var _0x988e=function(_0x527674,_0x4f5dc7){_0x527674=_0x527674-0x0;var _0x1a1640=_0x88e9[_0x527674];return _0x1a1640;};'use strict';var multer=require(_0x988e('0x0'));var util=require(_0x988e('0x1'));var path=require(_0x988e('0x2'));var timeout=require(_0x988e('0x3'));var express=require(_0x988e('0x4'));var router=express[_0x988e('0x5')]();var fs_extra=require(_0x988e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x988e('0x7'));var config=require(_0x988e('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x988e('0x9')](),controller[_0x988e('0xa')]);router[_0x988e('0xb')](_0x988e('0xc'),auth[_0x988e('0x9')](),controller[_0x988e('0xd')]);router[_0x988e('0xe')]('/',auth[_0x988e('0x9')](),controller[_0x988e('0xf')]);router['put'](_0x988e('0xc'),auth[_0x988e('0x9')](),controller['update']);router[_0x988e('0x10')](_0x988e('0xc'),auth[_0x988e('0x9')](),controller[_0x988e('0x11')]);module[_0x988e('0x12')]=router; \ No newline at end of file +var _0xfee3=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16fbe6,_0x56dfb3){var _0x55217f=function(_0x30b2ef){while(--_0x30b2ef){_0x16fbe6['push'](_0x16fbe6['shift']());}};_0x55217f(++_0x56dfb3);}(_0xfee3,0xac));var _0x3fee=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xfee3[_0x361d3f];return _0x320229;};'use strict';var multer=require(_0x3fee('0x0'));var util=require(_0x3fee('0x1'));var path=require(_0x3fee('0x2'));var timeout=require(_0x3fee('0x3'));var express=require(_0x3fee('0x4'));var router=express[_0x3fee('0x5')]();var fs_extra=require(_0x3fee('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3fee('0x7'));var config=require(_0x3fee('0x8'));var controller=require(_0x3fee('0x9'));router[_0x3fee('0xa')]('/',auth[_0x3fee('0xb')](),controller[_0x3fee('0xc')]);router[_0x3fee('0xa')](_0x3fee('0xd'),auth[_0x3fee('0xb')](),controller['show']);router[_0x3fee('0xe')]('/',auth['isAuthenticated'](),controller[_0x3fee('0xf')]);router[_0x3fee('0x10')](_0x3fee('0xd'),auth['isAuthenticated'](),controller[_0x3fee('0x11')]);router['delete'](_0x3fee('0xd'),auth[_0x3fee('0xb')](),controller[_0x3fee('0x12')]);module[_0x3fee('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 12c0deb..08bb1fb 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 _0x7113=['STRING','variable','customVariable','sequelize','exports','ENUM','string','keyValue'];(function(_0x92d130,_0x2569f2){var _0x15ad5b=function(_0x9eb8c9){while(--_0x9eb8c9){_0x92d130['push'](_0x92d130['shift']());}};_0x15ad5b(++_0x2569f2);}(_0x7113,0x1e3));var _0x3711=function(_0x39970b,_0x57e344){_0x39970b=_0x39970b-0x0;var _0x517f86=_0x7113[_0x39970b];return _0x517f86;};'use strict';var Sequelize=require(_0x3711('0x0'));module[_0x3711('0x1')]={'type':{'type':Sequelize[_0x3711('0x2')](_0x3711('0x3'),'variable','customVariable',_0x3711('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3711('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3711('0x2')]('string',_0x3711('0x6'),_0x3711('0x7'))},'keyContent':{'type':Sequelize[_0x3711('0x5')]},'idField':{'type':Sequelize[_0x3711('0x5')]},'nameField':{'type':Sequelize[_0x3711('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3711('0x5')]}}; \ No newline at end of file +var _0x4c18=['picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x1efa33,_0x372346){var _0x211229=function(_0x28fb77){while(--_0x28fb77){_0x1efa33['push'](_0x1efa33['shift']());}};_0x211229(++_0x372346);}(_0x4c18,0x11a));var _0x84c1=function(_0x19522a,_0x405919){_0x19522a=_0x19522a-0x0;var _0x138ca5=_0x4c18[_0x19522a];return _0x138ca5;};'use strict';var Sequelize=require('sequelize');module[_0x84c1('0x0')]={'type':{'type':Sequelize[_0x84c1('0x1')](_0x84c1('0x2'),_0x84c1('0x3'),_0x84c1('0x4'),'keyValue',_0x84c1('0x5')),'defaultValue':_0x84c1('0x2')},'content':{'type':Sequelize[_0x84c1('0x6')]},'key':{'type':Sequelize[_0x84c1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x84c1('0x2'),_0x84c1('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x84c1('0x6')]},'idField':{'type':Sequelize[_0x84c1('0x6')]},'nameField':{'type':Sequelize[_0x84c1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 624404b..c27a2d5 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 _0xc7b0=['map','fieldName','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','Dynamics365Field','findAll','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index'];(function(_0x125385,_0x105227){var _0x295d48=function(_0x4a5a23){while(--_0x4a5a23){_0x125385['push'](_0x125385['shift']());}};_0x295d48(++_0x105227);}(_0xc7b0,0x66));var _0x0c7b=function(_0x2595bf,_0x5c453e){_0x2595bf=_0x2595bf-0x0;var _0x4618f9=_0xc7b0[_0x2595bf];return _0x4618f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c7b('0x1'));var rp=require(_0x0c7b('0x2'));var moment=require('moment');var BPromise=require(_0x0c7b('0x3'));var Mustache=require('mustache');var util=require(_0x0c7b('0x4'));var path=require(_0x0c7b('0x5'));var sox=require(_0x0c7b('0x6'));var csv=require('to-csv');var ejs=require(_0x0c7b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c7b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c7b('0x9'));var deskjs=require(_0x0c7b('0xa'));var toCsv=require(_0x0c7b('0xb'));var querystring=require(_0x0c7b('0xc'));var Papa=require(_0x0c7b('0xd'));var Redis=require('ioredis');var authService=require(_0x0c7b('0xe'));var qs=require(_0x0c7b('0xf'));var as=require(_0x0c7b('0x10'));var hardwareService=require(_0x0c7b('0x11'));var logger=require(_0x0c7b('0x12'))(_0x0c7b('0x13'));var utils=require(_0x0c7b('0x14'));var config=require(_0x0c7b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c7b('0x16'))['db'];function respondWithStatusCode(_0x34ae8c,_0x157369){_0x157369=_0x157369||0xcc;return function(_0x4eb054){if(_0x4eb054){return _0x34ae8c[_0x0c7b('0x17')](_0x157369);}return _0x34ae8c[_0x0c7b('0x18')](_0x157369)['end']();};}function respondWithResult(_0x3b97e0,_0x5ec9c9){_0x5ec9c9=_0x5ec9c9||0xc8;return function(_0x2a3d6c){if(_0x2a3d6c){return _0x3b97e0[_0x0c7b('0x18')](_0x5ec9c9)[_0x0c7b('0x19')](_0x2a3d6c);}};}function respondWithFilteredResult(_0x592f12,_0x581064){return function(_0x207ff){if(_0x207ff){var _0xc295c=typeof _0x581064[_0x0c7b('0x1a')]==='undefined'&&typeof _0x581064[_0x0c7b('0x1b')]==='undefined';var _0xd7757e=_0x207ff['count'];var _0x37eafd=_0xc295c?0x0:_0x581064[_0x0c7b('0x1a')];var _0x4fd1e3=_0xc295c?_0x207ff['count']:_0x581064[_0x0c7b('0x1a')]+_0x581064[_0x0c7b('0x1b')];var _0x4563ac;if(_0x4fd1e3>=_0xd7757e){_0x4fd1e3=_0xd7757e;_0x4563ac=0xc8;}else{_0x4563ac=0xce;}_0x592f12[_0x0c7b('0x18')](_0x4563ac);return _0x592f12[_0x0c7b('0x1c')](_0x0c7b('0x1d'),_0x37eafd+'-'+_0x4fd1e3+'/'+_0xd7757e)[_0x0c7b('0x19')](_0x207ff);}return null;};}function patchUpdates(_0x178246){return function(_0xafc67f){try{jsonpatch[_0x0c7b('0x1e')](_0xafc67f,_0x178246,!![]);}catch(_0x16a8b8){return BPromise[_0x0c7b('0x1f')](_0x16a8b8);}return _0xafc67f[_0x0c7b('0x20')]();};}function saveUpdates(_0x1ca673,_0x4a7db2){return function(_0x18f359){if(_0x18f359){return _0x18f359[_0x0c7b('0x21')](_0x1ca673)[_0x0c7b('0x22')](function(_0x489cfe){return _0x489cfe;});}return null;};}function removeEntity(_0x4340fd,_0x2a0147){return function(_0x3102a7){if(_0x3102a7){return _0x3102a7[_0x0c7b('0x23')]()[_0x0c7b('0x22')](function(){_0x4340fd[_0x0c7b('0x18')](0xcc)[_0x0c7b('0x24')]();});}};}function handleEntityNotFound(_0x3dbb13,_0x5751c6){return function(_0x5ac86e){if(!_0x5ac86e){_0x3dbb13[_0x0c7b('0x17')](0x194);}return _0x5ac86e;};}function handleError(_0x3d461a,_0x41feff){_0x41feff=_0x41feff||0x1f4;return function(_0x3539fd){logger[_0x0c7b('0x25')](_0x3539fd['stack']);if(_0x3539fd['name']){delete _0x3539fd[_0x0c7b('0x26')];}_0x3d461a['status'](_0x41feff)['send'](_0x3539fd);};}exports[_0x0c7b('0x27')]=function(_0x56c8e7,_0x1e84b6){var _0x22347f={},_0x2e4979={},_0x1b52cb={'count':0x0,'rows':[]};var _0x1023bf=_[_0x0c7b('0x28')](db['Dynamics365Field']['rawAttributes'],function(_0x3ad9f2){return{'name':_0x3ad9f2[_0x0c7b('0x29')],'type':_0x3ad9f2['type'][_0x0c7b('0x2a')]};});_0x2e4979['model']=_['map'](_0x1023bf,_0x0c7b('0x26'));_0x2e4979[_0x0c7b('0x2b')]=_['keys'](_0x56c8e7[_0x0c7b('0x2b')]);_0x2e4979[_0x0c7b('0x2c')]=_[_0x0c7b('0x2d')](_0x2e4979[_0x0c7b('0x2e')],_0x2e4979[_0x0c7b('0x2b')]);_0x22347f[_0x0c7b('0x2f')]=_[_0x0c7b('0x2d')](_0x2e4979['model'],qs['fields'](_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x30')]));_0x22347f[_0x0c7b('0x2f')]=_0x22347f[_0x0c7b('0x2f')][_0x0c7b('0x31')]?_0x22347f['attributes']:_0x2e4979[_0x0c7b('0x2e')];if(!_0x56c8e7[_0x0c7b('0x2b')]['hasOwnProperty']('nolimit')){_0x22347f[_0x0c7b('0x1b')]=qs[_0x0c7b('0x1b')](_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x1b')]);_0x22347f[_0x0c7b('0x1a')]=qs[_0x0c7b('0x1a')](_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x1a')]);}_0x22347f[_0x0c7b('0x32')]=qs[_0x0c7b('0x33')](_0x56c8e7['query'][_0x0c7b('0x33')]);_0x22347f[_0x0c7b('0x34')]=qs[_0x0c7b('0x2c')](_[_0x0c7b('0x35')](_0x56c8e7[_0x0c7b('0x2b')],_0x2e4979[_0x0c7b('0x2c')]),_0x1023bf);if(_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x36')]){_0x22347f[_0x0c7b('0x34')]=_[_0x0c7b('0x37')](_0x22347f['where'],{'$or':_['map'](_0x1023bf,function(_0x19e552){if(_0x19e552[_0x0c7b('0x38')]!==_0x0c7b('0x39')){var _0xa72495={};_0xa72495[_0x19e552['name']]={'$like':'%'+_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x36')]+'%'};return _0xa72495;}})});}_0x22347f=_[_0x0c7b('0x37')]({},_0x22347f,_0x56c8e7['options']);var _0x384adb={'where':_0x22347f[_0x0c7b('0x34')]};return db['Dynamics365Field'][_0x0c7b('0x3a')](_0x384adb)['then'](function(_0x36bcd6){_0x1b52cb['count']=_0x36bcd6;if(_0x56c8e7[_0x0c7b('0x2b')][_0x0c7b('0x3b')]){_0x22347f[_0x0c7b('0x3c')]=[{'all':!![]}];}return db[_0x0c7b('0x3d')][_0x0c7b('0x3e')](_0x22347f);})['then'](function(_0x297be8){_0x1b52cb[_0x0c7b('0x3f')]=_0x297be8;return _0x1b52cb;})[_0x0c7b('0x22')](respondWithFilteredResult(_0x1e84b6,_0x22347f))[_0x0c7b('0x40')](handleError(_0x1e84b6,null));};exports[_0x0c7b('0x41')]=function(_0x46ce01,_0x65105){var _0x1ce06d={'raw':!![],'where':{'id':_0x46ce01[_0x0c7b('0x42')]['id']}},_0x308182={};_0x308182[_0x0c7b('0x2e')]=_[_0x0c7b('0x43')](db[_0x0c7b('0x3d')]['rawAttributes']);_0x308182[_0x0c7b('0x2b')]=_[_0x0c7b('0x43')](_0x46ce01[_0x0c7b('0x2b')]);_0x308182['filters']=_[_0x0c7b('0x2d')](_0x308182[_0x0c7b('0x2e')],_0x308182[_0x0c7b('0x2b')]);_0x1ce06d['attributes']=_[_0x0c7b('0x2d')](_0x308182['model'],qs[_0x0c7b('0x30')](_0x46ce01[_0x0c7b('0x2b')][_0x0c7b('0x30')]));_0x1ce06d['attributes']=_0x1ce06d[_0x0c7b('0x2f')]['length']?_0x1ce06d[_0x0c7b('0x2f')]:_0x308182['model'];if(_0x46ce01[_0x0c7b('0x2b')][_0x0c7b('0x3b')]){_0x1ce06d[_0x0c7b('0x3c')]=[{'all':!![]}];}_0x1ce06d=_[_0x0c7b('0x37')]({},_0x1ce06d,_0x46ce01['options']);return db[_0x0c7b('0x3d')][_0x0c7b('0x44')](_0x1ce06d)[_0x0c7b('0x22')](handleEntityNotFound(_0x65105,null))[_0x0c7b('0x22')](respondWithResult(_0x65105,null))[_0x0c7b('0x40')](handleError(_0x65105,null));};exports[_0x0c7b('0x45')]=function(_0x53ec5c,_0x206dad){return db['Dynamics365Field'][_0x0c7b('0x45')](_0x53ec5c[_0x0c7b('0x46')],{})['then'](respondWithResult(_0x206dad,0xc9))[_0x0c7b('0x40')](handleError(_0x206dad,null));};exports[_0x0c7b('0x21')]=function(_0x282497,_0x1feb32){if(_0x282497[_0x0c7b('0x46')]['id']){delete _0x282497[_0x0c7b('0x46')]['id'];}return db[_0x0c7b('0x3d')][_0x0c7b('0x44')]({'where':{'id':_0x282497[_0x0c7b('0x42')]['id']}})[_0x0c7b('0x22')](handleEntityNotFound(_0x1feb32,null))[_0x0c7b('0x22')](saveUpdates(_0x282497[_0x0c7b('0x46')],null))['then'](respondWithResult(_0x1feb32,null))[_0x0c7b('0x40')](handleError(_0x1feb32,null));};exports[_0x0c7b('0x23')]=function(_0x2c158e,_0x4e5a59){return db['Dynamics365Field']['find']({'where':{'id':_0x2c158e[_0x0c7b('0x42')]['id']}})[_0x0c7b('0x22')](handleEntityNotFound(_0x4e5a59,null))[_0x0c7b('0x22')](removeEntity(_0x4e5a59,null))[_0x0c7b('0x40')](handleError(_0x4e5a59,null));}; \ No newline at end of file +var _0xba99=['limit','count','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','find','create','body','zip-dir','request-promise','bluebird','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/utils','../../mysqldb','status','end','json','offset','undefined'];(function(_0x2e1ca2,_0x150397){var _0x60bc65=function(_0x12de2d){while(--_0x12de2d){_0x2e1ca2['push'](_0x2e1ca2['shift']());}};_0x60bc65(++_0x150397);}(_0xba99,0xbb));var _0x9ba9=function(_0x40d422,_0x307d6b){_0x40d422=_0x40d422-0x0;var _0x46d9da=_0xba99[_0x40d422];return _0x46d9da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9ba9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ba9('0x1'));var moment=require('moment');var BPromise=require(_0x9ba9('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9ba9('0x3'));var csv=require(_0x9ba9('0x4'));var ejs=require(_0x9ba9('0x5'));var fs=require('fs');var fs_extra=require(_0x9ba9('0x6'));var _=require(_0x9ba9('0x7'));var squel=require(_0x9ba9('0x8'));var crypto=require(_0x9ba9('0x9'));var jsforce=require(_0x9ba9('0xa'));var deskjs=require(_0x9ba9('0xb'));var toCsv=require(_0x9ba9('0x4'));var querystring=require(_0x9ba9('0xc'));var Papa=require(_0x9ba9('0xd'));var Redis=require(_0x9ba9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9ba9('0xf'));var as=require(_0x9ba9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ba9('0x11'))(_0x9ba9('0x12'));var utils=require(_0x9ba9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ba9('0x14'))['db'];function respondWithStatusCode(_0x2c3894,_0x34457c){_0x34457c=_0x34457c||0xcc;return function(_0x2dedee){if(_0x2dedee){return _0x2c3894['sendStatus'](_0x34457c);}return _0x2c3894[_0x9ba9('0x15')](_0x34457c)[_0x9ba9('0x16')]();};}function respondWithResult(_0x37ae03,_0x42a6ec){_0x42a6ec=_0x42a6ec||0xc8;return function(_0x36b2ea){if(_0x36b2ea){return _0x37ae03[_0x9ba9('0x15')](_0x42a6ec)[_0x9ba9('0x17')](_0x36b2ea);}};}function respondWithFilteredResult(_0x279af1,_0x2f4ab2){return function(_0x13a789){if(_0x13a789){var _0x207af8=typeof _0x2f4ab2[_0x9ba9('0x18')]===_0x9ba9('0x19')&&typeof _0x2f4ab2[_0x9ba9('0x1a')]===_0x9ba9('0x19');var _0x3e4308=_0x13a789[_0x9ba9('0x1b')];var _0x3a3280=_0x207af8?0x0:_0x2f4ab2[_0x9ba9('0x18')];var _0x2f2826=_0x207af8?_0x13a789['count']:_0x2f4ab2[_0x9ba9('0x18')]+_0x2f4ab2[_0x9ba9('0x1a')];var _0x1c9aba;if(_0x2f2826>=_0x3e4308){_0x2f2826=_0x3e4308;_0x1c9aba=0xc8;}else{_0x1c9aba=0xce;}_0x279af1[_0x9ba9('0x15')](_0x1c9aba);return _0x279af1['set']('Content-Range',_0x3a3280+'-'+_0x2f2826+'/'+_0x3e4308)[_0x9ba9('0x17')](_0x13a789);}return null;};}function patchUpdates(_0x3d43d2){return function(_0x4e15f4){try{jsonpatch[_0x9ba9('0x1c')](_0x4e15f4,_0x3d43d2,!![]);}catch(_0x414abd){return BPromise[_0x9ba9('0x1d')](_0x414abd);}return _0x4e15f4[_0x9ba9('0x1e')]();};}function saveUpdates(_0x28873d,_0x4df798){return function(_0x268f8d){if(_0x268f8d){return _0x268f8d[_0x9ba9('0x1f')](_0x28873d)[_0x9ba9('0x20')](function(_0x57321a){return _0x57321a;});}return null;};}function removeEntity(_0x57c926,_0x137d96){return function(_0xa9c181){if(_0xa9c181){return _0xa9c181[_0x9ba9('0x21')]()[_0x9ba9('0x20')](function(){_0x57c926['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5db26b,_0x126902){return function(_0x349c44){if(!_0x349c44){_0x5db26b[_0x9ba9('0x22')](0x194);}return _0x349c44;};}function handleError(_0x349022,_0xb4bb1){_0xb4bb1=_0xb4bb1||0x1f4;return function(_0x72d9da){logger['error'](_0x72d9da[_0x9ba9('0x23')]);if(_0x72d9da[_0x9ba9('0x24')]){delete _0x72d9da['name'];}_0x349022[_0x9ba9('0x15')](_0xb4bb1)[_0x9ba9('0x25')](_0x72d9da);};}exports[_0x9ba9('0x26')]=function(_0x37778c,_0x466962){var _0x26710f={},_0x22a000={},_0x21d843={'count':0x0,'rows':[]};var _0x8ef662=_['map'](db['Dynamics365Field'][_0x9ba9('0x27')],function(_0x197d8b){return{'name':_0x197d8b[_0x9ba9('0x28')],'type':_0x197d8b['type'][_0x9ba9('0x29')]};});_0x22a000['model']=_[_0x9ba9('0x2a')](_0x8ef662,_0x9ba9('0x24'));_0x22a000[_0x9ba9('0x2b')]=_[_0x9ba9('0x2c')](_0x37778c[_0x9ba9('0x2b')]);_0x22a000[_0x9ba9('0x2d')]=_['intersection'](_0x22a000[_0x9ba9('0x2e')],_0x22a000[_0x9ba9('0x2b')]);_0x26710f[_0x9ba9('0x2f')]=_[_0x9ba9('0x30')](_0x22a000['model'],qs['fields'](_0x37778c[_0x9ba9('0x2b')][_0x9ba9('0x31')]));_0x26710f['attributes']=_0x26710f['attributes'][_0x9ba9('0x32')]?_0x26710f[_0x9ba9('0x2f')]:_0x22a000[_0x9ba9('0x2e')];if(!_0x37778c[_0x9ba9('0x2b')][_0x9ba9('0x33')](_0x9ba9('0x34'))){_0x26710f[_0x9ba9('0x1a')]=qs[_0x9ba9('0x1a')](_0x37778c[_0x9ba9('0x2b')][_0x9ba9('0x1a')]);_0x26710f[_0x9ba9('0x18')]=qs[_0x9ba9('0x18')](_0x37778c['query'][_0x9ba9('0x18')]);}_0x26710f['order']=qs[_0x9ba9('0x35')](_0x37778c['query'][_0x9ba9('0x35')]);_0x26710f[_0x9ba9('0x36')]=qs['filters'](_[_0x9ba9('0x37')](_0x37778c['query'],_0x22a000[_0x9ba9('0x2d')]),_0x8ef662);if(_0x37778c['query'][_0x9ba9('0x38')]){_0x26710f[_0x9ba9('0x36')]=_[_0x9ba9('0x39')](_0x26710f[_0x9ba9('0x36')],{'$or':_[_0x9ba9('0x2a')](_0x8ef662,function(_0x5dfe4a){if(_0x5dfe4a[_0x9ba9('0x3a')]!==_0x9ba9('0x3b')){var _0x32676f={};_0x32676f[_0x5dfe4a[_0x9ba9('0x24')]]={'$like':'%'+_0x37778c[_0x9ba9('0x2b')][_0x9ba9('0x38')]+'%'};return _0x32676f;}})});}_0x26710f=_[_0x9ba9('0x39')]({},_0x26710f,_0x37778c[_0x9ba9('0x3c')]);var _0x66f86d={'where':_0x26710f['where']};return db[_0x9ba9('0x3d')][_0x9ba9('0x1b')](_0x66f86d)[_0x9ba9('0x20')](function(_0x9cedea){_0x21d843[_0x9ba9('0x1b')]=_0x9cedea;if(_0x37778c['query'][_0x9ba9('0x3e')]){_0x26710f[_0x9ba9('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x9ba9('0x40')](_0x26710f);})['then'](function(_0xc64dc){_0x21d843[_0x9ba9('0x41')]=_0xc64dc;return _0x21d843;})[_0x9ba9('0x20')](respondWithFilteredResult(_0x466962,_0x26710f))[_0x9ba9('0x42')](handleError(_0x466962,null));};exports['show']=function(_0x2ef82d,_0x2094b9){var _0x1a2586={'raw':!![],'where':{'id':_0x2ef82d[_0x9ba9('0x43')]['id']}},_0x4a83a7={};_0x4a83a7['model']=_[_0x9ba9('0x2c')](db[_0x9ba9('0x3d')][_0x9ba9('0x27')]);_0x4a83a7[_0x9ba9('0x2b')]=_[_0x9ba9('0x2c')](_0x2ef82d[_0x9ba9('0x2b')]);_0x4a83a7['filters']=_[_0x9ba9('0x30')](_0x4a83a7[_0x9ba9('0x2e')],_0x4a83a7[_0x9ba9('0x2b')]);_0x1a2586['attributes']=_[_0x9ba9('0x30')](_0x4a83a7[_0x9ba9('0x2e')],qs['fields'](_0x2ef82d[_0x9ba9('0x2b')][_0x9ba9('0x31')]));_0x1a2586[_0x9ba9('0x2f')]=_0x1a2586['attributes'][_0x9ba9('0x32')]?_0x1a2586['attributes']:_0x4a83a7[_0x9ba9('0x2e')];if(_0x2ef82d[_0x9ba9('0x2b')][_0x9ba9('0x3e')]){_0x1a2586[_0x9ba9('0x3f')]=[{'all':!![]}];}_0x1a2586=_[_0x9ba9('0x39')]({},_0x1a2586,_0x2ef82d[_0x9ba9('0x3c')]);return db['Dynamics365Field'][_0x9ba9('0x44')](_0x1a2586)[_0x9ba9('0x20')](handleEntityNotFound(_0x2094b9,null))[_0x9ba9('0x20')](respondWithResult(_0x2094b9,null))[_0x9ba9('0x42')](handleError(_0x2094b9,null));};exports['create']=function(_0x53d0df,_0xe4c611){return db['Dynamics365Field'][_0x9ba9('0x45')](_0x53d0df['body'],{})[_0x9ba9('0x20')](respondWithResult(_0xe4c611,0xc9))[_0x9ba9('0x42')](handleError(_0xe4c611,null));};exports['update']=function(_0xc7e2db,_0x60fdf5){if(_0xc7e2db[_0x9ba9('0x46')]['id']){delete _0xc7e2db[_0x9ba9('0x46')]['id'];}return db[_0x9ba9('0x3d')][_0x9ba9('0x44')]({'where':{'id':_0xc7e2db['params']['id']}})[_0x9ba9('0x20')](handleEntityNotFound(_0x60fdf5,null))[_0x9ba9('0x20')](saveUpdates(_0xc7e2db[_0x9ba9('0x46')],null))[_0x9ba9('0x20')](respondWithResult(_0x60fdf5,null))['catch'](handleError(_0x60fdf5,null));};exports[_0x9ba9('0x21')]=function(_0x4da065,_0x236528){return db[_0x9ba9('0x3d')][_0x9ba9('0x44')]({'where':{'id':_0x4da065[_0x9ba9('0x43')]['id']}})[_0x9ba9('0x20')](handleEntityNotFound(_0x236528,null))['then'](removeEntity(_0x236528,null))[_0x9ba9('0x42')](handleError(_0x236528,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c3b382a..4cd90df 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 _0x5900=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','FieldId','lodash','util','../../config/logger'];(function(_0x9d393c,_0x1c85e2){var _0x577844=function(_0x23f905){while(--_0x23f905){_0x9d393c['push'](_0x9d393c['shift']());}};_0x577844(++_0x1c85e2);}(_0x5900,0x176));var _0x0590=function(_0x4e658c,_0x3139a5){_0x4e658c=_0x4e658c-0x0;var _0x3a2973=_0x5900[_0x4e658c];return _0x3a2973;};'use strict';var _=require(_0x0590('0x0'));var util=require(_0x0590('0x1'));var logger=require(_0x0590('0x2'))(_0x0590('0x3'));var moment=require('moment');var BPromise=require(_0x0590('0x4'));var rp=require(_0x0590('0x5'));var fs=require('fs');var path=require(_0x0590('0x6'));var rimraf=require(_0x0590('0x7'));var config=require(_0x0590('0x8'));var attributes=require(_0x0590('0x9'));module[_0x0590('0xa')]=function(_0xf13f41,_0x555e7c){return _0xf13f41['define'](_0x0590('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0590('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x102ae7,_0x21f536){var _0x704a8b=function(_0x250bf0){while(--_0x250bf0){_0x102ae7['push'](_0x102ae7['shift']());}};_0x704a8b(++_0x21f536);}(_0xb9a5,0xd2));var _0x5b9a=function(_0x34fe22,_0x4b0faa){_0x34fe22=_0x34fe22-0x0;var _0x126030=_0xb9a5[_0x34fe22];return _0x126030;};'use strict';var _=require('lodash');var util=require(_0x5b9a('0x0'));var logger=require(_0x5b9a('0x1'))(_0x5b9a('0x2'));var moment=require(_0x5b9a('0x3'));var BPromise=require(_0x5b9a('0x4'));var rp=require(_0x5b9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b9a('0x6'));var config=require(_0x5b9a('0x7'));var attributes=require(_0x5b9a('0x8'));module[_0x5b9a('0x9')]=function(_0x5bf3c4,_0x8df5f7){return _0x5bf3c4['define'](_0x5b9a('0xa'),attributes,{'tableName':_0x5b9a('0xb'),'paranoid':![],'indexes':[{'name':_0x5b9a('0xc'),'fields':[_0x5b9a('0xd'),_0x5b9a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 24b35db..7c07d34 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 _0x4b8d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring'];(function(_0x853127,_0x1dc3c1){var _0x8006fb=function(_0x487e8e){while(--_0x487e8e){_0x853127['push'](_0x853127['shift']());}};_0x8006fb(++_0x1dc3c1);}(_0x4b8d,0x106));var _0xd4b8=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x4b8d[_0x1667df];return _0x341abf;};'use strict';var _=require(_0xd4b8('0x0'));var util=require(_0xd4b8('0x1'));var moment=require(_0xd4b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4b8('0x3'));var fs=require('fs');var Redis=require(_0xd4b8('0x4'));var db=require(_0xd4b8('0x5'))['db'];var utils=require(_0xd4b8('0x6'));var logger=require(_0xd4b8('0x7'))('rpc');var config=require(_0xd4b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4b8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494f40,_0x51eb3c,_0x555974){return new BPromise(function(_0x443ee3,_0x488c56){return client['request'](_0x494f40,_0x555974)['then'](function(_0x478f0e){logger[_0xd4b8('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x51eb3c,_0xd4b8('0xb'));logger['debug'](_0xd4b8('0xc'),_0x51eb3c,'request\x20sent',JSON[_0xd4b8('0xd')](_0x478f0e));if(_0x478f0e[_0xd4b8('0xe')]){if(_0x478f0e[_0xd4b8('0xe')][_0xd4b8('0xf')]===0x1f4){logger[_0xd4b8('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x51eb3c,_0x478f0e[_0xd4b8('0xe')]['message']);return _0x488c56(_0x478f0e['error']['message']);}logger[_0xd4b8('0xe')](_0xd4b8('0x10'),_0x51eb3c,_0x478f0e[_0xd4b8('0xe')][_0xd4b8('0x11')]);return _0x443ee3(_0x478f0e['error'][_0xd4b8('0x11')]);}else{logger[_0xd4b8('0xa')](_0xd4b8('0x10'),_0x51eb3c,'request\x20sent');_0x443ee3(_0x478f0e['result']['message']);}})[_0xd4b8('0x12')](function(_0x51a900){logger['error'](_0xd4b8('0x10'),_0x51eb3c,_0x51a900);_0x488c56(_0x51a900);});});} \ No newline at end of file +var _0xf49c=['message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x486bcc,_0x95d7df){var _0x19f6ff=function(_0x2de8cc){while(--_0x2de8cc){_0x486bcc['push'](_0x486bcc['shift']());}};_0x19f6ff(++_0x95d7df);}(_0xf49c,0x192));var _0xcf49=function(_0x1bef2f,_0x410813){_0x1bef2f=_0x1bef2f-0x0;var _0x40683d=_0xf49c[_0x1bef2f];return _0x40683d;};'use strict';var _=require(_0xcf49('0x0'));var util=require(_0xcf49('0x1'));var moment=require('moment');var BPromise=require(_0xcf49('0x2'));var rs=require(_0xcf49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf49('0x4'))['db'];var utils=require(_0xcf49('0x5'));var logger=require(_0xcf49('0x6'))('rpc');var config=require(_0xcf49('0x7'));var jayson=require(_0xcf49('0x8'));var client=jayson[_0xcf49('0x9')][_0xcf49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c4c8c,_0x1df82b,_0x3d71d8){return new BPromise(function(_0x1b338a,_0x164cc6){return client['request'](_0x5c4c8c,_0x3d71d8)[_0xcf49('0xb')](function(_0x11e010){logger['info'](_0xcf49('0xc'),_0x1df82b,_0xcf49('0xd'));logger['debug'](_0xcf49('0xe'),_0x1df82b,_0xcf49('0xd'),JSON['stringify'](_0x11e010));if(_0x11e010[_0xcf49('0xf')]){if(_0x11e010[_0xcf49('0xf')]['code']===0x1f4){logger[_0xcf49('0xf')](_0xcf49('0xc'),_0x1df82b,_0x11e010['error'][_0xcf49('0x10')]);return _0x164cc6(_0x11e010[_0xcf49('0xf')][_0xcf49('0x10')]);}logger[_0xcf49('0xf')](_0xcf49('0xc'),_0x1df82b,_0x11e010[_0xcf49('0xf')][_0xcf49('0x10')]);return _0x1b338a(_0x11e010['error'][_0xcf49('0x10')]);}else{logger[_0xcf49('0x11')](_0xcf49('0xc'),_0x1df82b,'request\x20sent');_0x1b338a(_0x11e010[_0xcf49('0x12')][_0xcf49('0x10')]);}})['catch'](function(_0x34aa84){logger[_0xcf49('0xf')](_0xcf49('0xc'),_0x1df82b,_0x34aa84);_0x164cc6(_0x34aa84);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b244189..464941f 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 _0xf0e8=['util','path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x11ffa0,_0x2622cd){var _0x14e9bf=function(_0x3ce964){while(--_0x3ce964){_0x11ffa0['push'](_0x11ffa0['shift']());}};_0x14e9bf(++_0x2622cd);}(_0xf0e8,0xfd));var _0x8f0e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf0e8[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x8f0e('0x0'));var path=require(_0x8f0e('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f0e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f0e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8f0e('0x4'));var controller=require(_0x8f0e('0x5'));router[_0x8f0e('0x6')]('/',auth[_0x8f0e('0x7')](),controller[_0x8f0e('0x8')]);router[_0x8f0e('0x6')](_0x8f0e('0x9'),auth['isAuthenticated'](),controller[_0x8f0e('0xa')]);router[_0x8f0e('0x6')](_0x8f0e('0xb'),auth[_0x8f0e('0x7')](),controller[_0x8f0e('0xc')]);router[_0x8f0e('0x6')](_0x8f0e('0xd'),auth[_0x8f0e('0x7')](),controller[_0x8f0e('0xe')]);router[_0x8f0e('0xf')]('/',auth['isAuthenticated'](),controller[_0x8f0e('0x10')]);router[_0x8f0e('0xf')](_0x8f0e('0xb'),auth[_0x8f0e('0x7')](),controller[_0x8f0e('0x11')]);router[_0x8f0e('0x12')]('/:id',auth[_0x8f0e('0x7')](),controller[_0x8f0e('0x13')]);router[_0x8f0e('0x14')](_0x8f0e('0x9'),auth['isAuthenticated'](),controller[_0x8f0e('0x15')]);module[_0x8f0e('0x16')]=router; \ No newline at end of file +var _0x8df0=['express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x35282c,_0x7eba5e){var _0x267b6d=function(_0x441ba2){while(--_0x441ba2){_0x35282c['push'](_0x35282c['shift']());}};_0x267b6d(++_0x7eba5e);}(_0x8df0,0x1c8));var _0x08df=function(_0xece529,_0xef79a8){_0xece529=_0xece529-0x0;var _0x20abcb=_0x8df0[_0xece529];return _0x20abcb;};'use strict';var multer=require(_0x08df('0x0'));var util=require(_0x08df('0x1'));var path=require(_0x08df('0x2'));var timeout=require(_0x08df('0x3'));var express=require(_0x08df('0x4'));var router=express[_0x08df('0x5')]();var fs_extra=require(_0x08df('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x08df('0x7'));var controller=require(_0x08df('0x8'));router[_0x08df('0x9')]('/',auth[_0x08df('0xa')](),controller[_0x08df('0xb')]);router['get'](_0x08df('0xc'),auth[_0x08df('0xa')](),controller[_0x08df('0xd')]);router[_0x08df('0x9')]('/:id/configurations',auth[_0x08df('0xa')](),controller[_0x08df('0xe')]);router[_0x08df('0x9')](_0x08df('0xf'),auth['isAuthenticated'](),controller[_0x08df('0x10')]);router[_0x08df('0x11')]('/',auth[_0x08df('0xa')](),controller[_0x08df('0x12')]);router[_0x08df('0x11')]('/:id/configurations',auth[_0x08df('0xa')](),controller[_0x08df('0x13')]);router[_0x08df('0x14')](_0x08df('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x08df('0x15')](_0x08df('0xc'),auth[_0x08df('0xa')](),controller['destroy']);module[_0x08df('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index dcbece5..1e465fb 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 _0x056b=['username','remoteUri','exports','STRING'];(function(_0x27688b,_0x31dec0){var _0x49ab33=function(_0x51d109){while(--_0x51d109){_0x27688b['push'](_0x27688b['shift']());}};_0x49ab33(++_0x31dec0);}(_0x056b,0xb6));var _0xb056=function(_0x577789,_0x24b8e8){_0x577789=_0x577789-0x0;var _0x403787=_0x056b[_0x577789];return _0x403787;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x5b3aaf,_0x4c947b){var _0x322c39=function(_0x17797c){while(--_0x17797c){_0x5b3aaf['push'](_0x5b3aaf['shift']());}};_0x322c39(++_0x4c947b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x22ced8,_0x3b02ad){_0x22ced8=_0x22ced8-0x0;var _0x38e43f=_0x02ce[_0x22ced8];return _0x38e43f;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 39ee7ff..8bfe262 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 _0x50a8=['../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','params','keys','length','catch','create','find','getConfigurations','findOne','FreshdeskConfiguration','filter','body','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','FreshdeskField','apiKey','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','group','source','company','remove','includes','default','custom_text','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50a8,0x198));var _0x850a=function(_0x56eb70,_0x2bd75c){_0x56eb70=_0x56eb70-0x0;var _0x47f1fe=_0x50a8[_0x56eb70];return _0x47f1fe;};'use strict';var emlformat=require(_0x850a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x850a('0x1'));var moment=require('moment');var BPromise=require(_0x850a('0x2'));var Mustache=require(_0x850a('0x3'));var util=require(_0x850a('0x4'));var path=require(_0x850a('0x5'));var sox=require(_0x850a('0x6'));var csv=require(_0x850a('0x7'));var ejs=require(_0x850a('0x8'));var fs=require('fs');var fs_extra=require(_0x850a('0x9'));var _=require(_0x850a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x850a('0xb'));var deskjs=require(_0x850a('0xc'));var toCsv=require(_0x850a('0x7'));var querystring=require(_0x850a('0xd'));var Papa=require('papaparse');var Redis=require(_0x850a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x850a('0xf'));var hardwareService=require(_0x850a('0x10'));var logger=require(_0x850a('0x11'))(_0x850a('0x12'));var utils=require(_0x850a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x850a('0x14'));function respondWithStatusCode(_0x4d591d,_0x45cd78){_0x45cd78=_0x45cd78||0xcc;return function(_0x21d324){if(_0x21d324){return _0x4d591d[_0x850a('0x15')](_0x45cd78);}return _0x4d591d[_0x850a('0x16')](_0x45cd78)[_0x850a('0x17')]();};}function respondWithResult(_0x50c199,_0x355a31){_0x355a31=_0x355a31||0xc8;return function(_0x59f778){if(_0x59f778){return _0x50c199['status'](_0x355a31)['json'](_0x59f778);}};}function respondWithFilteredResult(_0x4c0156,_0x3e6e81){return function(_0x5e0fbe){if(_0x5e0fbe){var _0x657067=typeof _0x3e6e81[_0x850a('0x18')]===_0x850a('0x19')&&typeof _0x3e6e81[_0x850a('0x1a')]===_0x850a('0x19');var _0x1a987c=_0x5e0fbe[_0x850a('0x1b')];var _0x419ae6=_0x657067?0x0:_0x3e6e81['offset'];var _0x432a28=_0x657067?_0x5e0fbe['count']:_0x3e6e81['offset']+_0x3e6e81['limit'];var _0x5acf31;if(_0x432a28>=_0x1a987c){_0x432a28=_0x1a987c;_0x5acf31=0xc8;}else{_0x5acf31=0xce;}_0x4c0156[_0x850a('0x16')](_0x5acf31);return _0x4c0156[_0x850a('0x1c')](_0x850a('0x1d'),_0x419ae6+'-'+_0x432a28+'/'+_0x1a987c)['json'](_0x5e0fbe);}return null;};}function patchUpdates(_0x17eadb){return function(_0x6221f6){try{jsonpatch[_0x850a('0x1e')](_0x6221f6,_0x17eadb,!![]);}catch(_0x484b13){return BPromise['reject'](_0x484b13);}return _0x6221f6[_0x850a('0x1f')]();};}function saveUpdates(_0x285ef4,_0x5758af){return function(_0xf4655a){if(_0xf4655a){return _0xf4655a['update'](_0x285ef4)['then'](function(_0x561fde){return _0x561fde;});}return null;};}function removeEntity(_0x4363d4,_0x47d527){return function(_0x3ad545){if(_0x3ad545){return _0x3ad545[_0x850a('0x20')]()[_0x850a('0x21')](function(){_0x4363d4['status'](0xcc)[_0x850a('0x17')]();});}};}function handleEntityNotFound(_0xc52e71,_0x33327e){return function(_0x59bc52){if(!_0x59bc52){_0xc52e71[_0x850a('0x15')](0x194);}return _0x59bc52;};}function handleError(_0xe46a27,_0x4d715c){_0x4d715c=_0x4d715c||0x1f4;return function(_0x21e34d){logger[_0x850a('0x22')](_0x21e34d[_0x850a('0x23')]);if(_0x21e34d[_0x850a('0x24')]){delete _0x21e34d[_0x850a('0x24')];}_0xe46a27[_0x850a('0x16')](_0x4d715c)[_0x850a('0x25')](_0x21e34d);};}exports[_0x850a('0x26')]=function(_0x3a228f,_0x177dd6){var _0x44fb58={},_0x1e8632={},_0x3f1efc={'count':0x0,'rows':[]};var _0x7af273=_[_0x850a('0x27')](db['FreshdeskAccount'][_0x850a('0x28')],function(_0x5cbab3){return{'name':_0x5cbab3[_0x850a('0x29')],'type':_0x5cbab3[_0x850a('0x2a')][_0x850a('0x2b')]};});_0x1e8632['model']=_['map'](_0x7af273,'name');_0x1e8632[_0x850a('0x2c')]=_['keys'](_0x3a228f[_0x850a('0x2c')]);_0x1e8632[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x1e8632[_0x850a('0x2f')],_0x1e8632['query']);_0x44fb58[_0x850a('0x30')]=_[_0x850a('0x2e')](_0x1e8632[_0x850a('0x2f')],qs[_0x850a('0x31')](_0x3a228f[_0x850a('0x2c')]['fields']));_0x44fb58['attributes']=_0x44fb58[_0x850a('0x30')]['length']?_0x44fb58[_0x850a('0x30')]:_0x1e8632[_0x850a('0x2f')];if(!_0x3a228f[_0x850a('0x2c')][_0x850a('0x32')](_0x850a('0x33'))){_0x44fb58[_0x850a('0x1a')]=qs[_0x850a('0x1a')](_0x3a228f[_0x850a('0x2c')][_0x850a('0x1a')]);_0x44fb58[_0x850a('0x18')]=qs['offset'](_0x3a228f[_0x850a('0x2c')][_0x850a('0x18')]);}_0x44fb58[_0x850a('0x34')]=qs[_0x850a('0x35')](_0x3a228f[_0x850a('0x2c')]['sort']);_0x44fb58[_0x850a('0x36')]=qs[_0x850a('0x2d')](_['pick'](_0x3a228f[_0x850a('0x2c')],_0x1e8632[_0x850a('0x2d')]),_0x7af273);if(_0x3a228f[_0x850a('0x2c')]['filter']){_0x44fb58['where']=_[_0x850a('0x37')](_0x44fb58[_0x850a('0x36')],{'$or':_[_0x850a('0x27')](_0x7af273,function(_0x387dd8){if(_0x387dd8[_0x850a('0x2a')]!==_0x850a('0x38')){var _0x5425df={};_0x5425df[_0x387dd8['name']]={'$like':'%'+_0x3a228f['query']['filter']+'%'};return _0x5425df;}})});}_0x44fb58=_['merge']({},_0x44fb58,_0x3a228f[_0x850a('0x39')]);var _0xb8b012={'where':_0x44fb58[_0x850a('0x36')]};return db[_0x850a('0x3a')][_0x850a('0x1b')](_0xb8b012)['then'](function(_0x1c5c37){_0x3f1efc[_0x850a('0x1b')]=_0x1c5c37;if(_0x3a228f['query'][_0x850a('0x3b')]){_0x44fb58[_0x850a('0x3c')]=[{'all':!![]}];}return db[_0x850a('0x3a')][_0x850a('0x3d')](_0x44fb58);})[_0x850a('0x21')](function(_0x23418d){_0x3f1efc[_0x850a('0x3e')]=_0x23418d;return _0x3f1efc;})[_0x850a('0x21')](respondWithFilteredResult(_0x177dd6,_0x44fb58))['catch'](handleError(_0x177dd6,null));};exports[_0x850a('0x3f')]=function(_0x13ea8b,_0x1e5d20){var _0x4a0a41={'raw':![],'where':{'id':_0x13ea8b[_0x850a('0x40')]['id']}},_0x15f04e={};_0x15f04e[_0x850a('0x2f')]=_[_0x850a('0x41')](db[_0x850a('0x3a')][_0x850a('0x28')]);_0x15f04e[_0x850a('0x2c')]=_[_0x850a('0x41')](_0x13ea8b[_0x850a('0x2c')]);_0x15f04e[_0x850a('0x2d')]=_[_0x850a('0x2e')](_0x15f04e[_0x850a('0x2f')],_0x15f04e[_0x850a('0x2c')]);_0x4a0a41['attributes']=_[_0x850a('0x2e')](_0x15f04e[_0x850a('0x2f')],qs[_0x850a('0x31')](_0x13ea8b[_0x850a('0x2c')][_0x850a('0x31')]));_0x4a0a41['attributes']=_0x4a0a41[_0x850a('0x30')][_0x850a('0x42')]?_0x4a0a41['attributes']:_0x15f04e[_0x850a('0x2f')];if(_0x13ea8b[_0x850a('0x2c')][_0x850a('0x3b')]){_0x4a0a41[_0x850a('0x3c')]=[{'all':!![]}];}_0x4a0a41=_[_0x850a('0x37')]({},_0x4a0a41,_0x13ea8b['options']);return db[_0x850a('0x3a')]['find'](_0x4a0a41)[_0x850a('0x21')](handleEntityNotFound(_0x1e5d20,null))[_0x850a('0x21')](respondWithResult(_0x1e5d20,null))[_0x850a('0x43')](handleError(_0x1e5d20,null));};exports[_0x850a('0x44')]=function(_0x2c4439,_0x9f9f15){return db[_0x850a('0x3a')]['create'](_0x2c4439['body'],{})[_0x850a('0x21')](respondWithResult(_0x9f9f15,0xc9))[_0x850a('0x43')](handleError(_0x9f9f15,null));};exports['update']=function(_0x4e669c,_0x500d17){if(_0x4e669c['body']['id']){delete _0x4e669c['body']['id'];}return db['FreshdeskAccount'][_0x850a('0x45')]({'where':{'id':_0x4e669c[_0x850a('0x40')]['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x500d17,null))[_0x850a('0x21')](saveUpdates(_0x4e669c['body'],null))[_0x850a('0x21')](respondWithResult(_0x500d17,null))[_0x850a('0x43')](handleError(_0x500d17,null));};exports['destroy']=function(_0x3e712c,_0x463e17){return db[_0x850a('0x3a')]['find']({'where':{'id':_0x3e712c['params']['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x463e17,null))['then'](removeEntity(_0x463e17,null))[_0x850a('0x43')](handleError(_0x463e17,null));};exports[_0x850a('0x46')]=function(_0x3b3e68,_0x5a61f9,_0x3dd882){var _0x42b85c={};var _0x501031={};var _0x5d817a;var _0x3247a8;return db[_0x850a('0x3a')][_0x850a('0x47')]({'where':{'id':_0x3b3e68[_0x850a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a61f9,null))[_0x850a('0x21')](function(_0x41f9dc){if(_0x41f9dc){_0x5d817a=_0x41f9dc;_0x501031[_0x850a('0x2f')]=_['keys'](db[_0x850a('0x48')][_0x850a('0x28')]);_0x501031[_0x850a('0x2c')]=_['keys'](_0x3b3e68[_0x850a('0x2c')]);_0x501031['filters']=_[_0x850a('0x2e')](_0x501031[_0x850a('0x2f')],_0x501031[_0x850a('0x2c')]);_0x42b85c['attributes']=_['intersection'](_0x501031['model'],qs[_0x850a('0x31')](_0x3b3e68[_0x850a('0x2c')][_0x850a('0x31')]));_0x42b85c[_0x850a('0x30')]=_0x42b85c['attributes'][_0x850a('0x42')]?_0x42b85c[_0x850a('0x30')]:_0x501031[_0x850a('0x2f')];_0x42b85c[_0x850a('0x34')]=qs[_0x850a('0x35')](_0x3b3e68['query'][_0x850a('0x35')]);_0x42b85c['where']=qs[_0x850a('0x2d')](_['pick'](_0x3b3e68[_0x850a('0x2c')],_0x501031['filters']));if(_0x3b3e68[_0x850a('0x2c')][_0x850a('0x49')]){_0x42b85c[_0x850a('0x36')]=_[_0x850a('0x37')](_0x42b85c[_0x850a('0x36')],{'$or':_[_0x850a('0x27')](_0x42b85c[_0x850a('0x30')],function(_0x3fb0d5){var _0x71e746={};_0x71e746[_0x3fb0d5]={'$like':'%'+_0x3b3e68[_0x850a('0x2c')][_0x850a('0x49')]+'%'};return _0x71e746;})});}_0x42b85c=_[_0x850a('0x37')]({},_0x42b85c,_0x3b3e68[_0x850a('0x39')]);return _0x5d817a[_0x850a('0x46')](_0x42b85c);}})[_0x850a('0x21')](function(_0x284e62){if(_0x284e62){_0x3247a8=_0x284e62['length'];if(!_0x3b3e68[_0x850a('0x2c')]['hasOwnProperty'](_0x850a('0x33'))){_0x42b85c['limit']=qs[_0x850a('0x1a')](_0x3b3e68[_0x850a('0x2c')][_0x850a('0x1a')]);_0x42b85c['offset']=qs['offset'](_0x3b3e68['query'][_0x850a('0x18')]);}return _0x5d817a['getConfigurations'](_0x42b85c);}})['then'](function(_0x1103ac){if(_0x1103ac){return _0x1103ac?{'count':_0x3247a8,'rows':_0x1103ac}:null;}})[_0x850a('0x21')](respondWithResult(_0x5a61f9,null))[_0x850a('0x43')](handleError(_0x5a61f9,null));};exports['addConfiguration']=function(_0x18aa12,_0x4c25fa,_0xb3c661){if(_0x18aa12[_0x850a('0x4a')]['id']){delete _0x18aa12[_0x850a('0x4a')]['id'];}return db[_0x850a('0x3a')]['findOne']({'where':{'id':_0x18aa12[_0x850a('0x40')]['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x4c25fa,null))[_0x850a('0x21')](function(_0x9bb156){if(_0x9bb156){_0x18aa12[_0x850a('0x4a')][_0x850a('0x4b')]=_0x9bb156['id'];_0x18aa12['body']['Subjects']=integrations[_0x850a('0x4c')](_0x18aa12['body']['channel'],_0x18aa12[_0x850a('0x4a')]['type']);_0x18aa12[_0x850a('0x4a')][_0x850a('0x4d')]=integrations[_0x850a('0x4e')](_0x18aa12[_0x850a('0x4a')]['channel'],_0x18aa12['body'][_0x850a('0x2a')]);return db['FreshdeskConfiguration'][_0x850a('0x44')](_0x18aa12['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x850a('0x4f')},{'model':db[_0x850a('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4c25fa,null))['catch'](handleError(_0x4c25fa,null));};exports['getFields']=function(_0x3c183a,_0x29ba64,_0x4b5842){var _0x3768b4='';return db[_0x850a('0x3a')][_0x850a('0x47')]({'where':{'id':_0x3c183a[_0x850a('0x40')]['id']},'attributes':['id','remoteUri',_0x850a('0x51')]})[_0x850a('0x21')](handleEntityNotFound(_0x29ba64,null))[_0x850a('0x21')](function(_0x20fddf){if(_0x20fddf){_0x3768b4=_0x20fddf[_0x850a('0x52')];var _0x43a920=_0x3768b4[_0x850a('0x53')](-0x1);if(_0x43a920==='/'){_0x3768b4=_0x3768b4[_0x850a('0x54')](0x0,_0x3768b4['lastIndexOf'](_0x43a920));}return rp({'method':_0x850a('0x55'),'uri':util['format'](_0x850a('0x56'),_0x3768b4,_0x850a('0x57')),'headers':{'Authorization':util['format'](_0x850a('0x58'),new Buffer(util['format'](_0x850a('0x59'),_0x20fddf[_0x850a('0x51')]))['toString'](_0x850a('0x5a')))},'json':!![]});}})[_0x850a('0x21')](function(_0x1c56d5){if(_0x1c56d5){var _0x48b3f3=[_0x850a('0x5b'),_0x850a('0x5c'),_0x850a('0x5d'),'description','status','priority',_0x850a('0x5e'),_0x850a('0x5f'),'ticket_type',_0x850a('0x5e'),_0x850a('0x60')];_[_0x850a('0x61')](_0x1c56d5,function(_0x3d6862){return _0x48b3f3[_0x850a('0x62')](_0x3d6862[_0x850a('0x24')])||!_0x3d6862[_0x850a('0x63')]&&_0x3d6862['type']!==_0x850a('0x64')&&_0x3d6862[_0x850a('0x2a')]!==_0x850a('0x65');});return{'count':_0x1c56d5[_0x850a('0x42')],'rows':_['map'](_0x1c56d5,function(_0xc05dac){return{'id':_0xc05dac[_0x850a('0x24')],'name':_0xc05dac['label'],'custom':!_0xc05dac[_0x850a('0x63')],'options':_0xc05dac[_0x850a('0x66')]?_[_0x850a('0x27')](_0xc05dac['choices'],function(_0x516e4d){return{'name':_['capitalize'](_0x516e4d),'value':_0x516e4d};}):[]};})};}})[_0x850a('0x21')](respondWithResult(_0x29ba64,null))[_0x850a('0x43')](function(_0x5d81d1){var _0x12d1c2=_0x3c183a['query'][_0x850a('0x67')]?0x1f4:_0x5d81d1[_0x850a('0x68')]||0x1f4;logger[_0x850a('0x22')](_0x850a('0x69'),_0x850a('0x6a'),_0x12d1c2,JSON['stringify'](_0x5d81d1));delete _0x5d81d1['name'];if(_0x12d1c2===0x191){_0x12d1c2=0x190;}_0x29ba64[_0x850a('0x16')](_0x12d1c2)[_0x850a('0x25')](_0x3c183a[_0x850a('0x2c')][_0x850a('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x5d81d1[_0x850a('0x68')]}:_0x5d81d1);});}; \ No newline at end of file +var _0xaa1b=['query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','include','FreshdeskAccount','findAll','rows','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','slice','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','toString','requester','subject','agent','priority','group','ticket_type','company','remove','default','custom_dropdown','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','model'];(function(_0x4f9f2c,_0x22c819){var _0x4af5d4=function(_0x454c57){while(--_0x454c57){_0x4f9f2c['push'](_0x4f9f2c['shift']());}};_0x4af5d4(++_0x22c819);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xbaa1('0x0'));var rimraf=require(_0xbaa1('0x1'));var zipdir=require(_0xbaa1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbaa1('0x3'));var moment=require('moment');var BPromise=require(_0xbaa1('0x4'));var Mustache=require(_0xbaa1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbaa1('0x6'));var ejs=require(_0xbaa1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaa1('0x8'));var squel=require('squel');var crypto=require(_0xbaa1('0x9'));var jsforce=require(_0xbaa1('0xa'));var deskjs=require(_0xbaa1('0xb'));var toCsv=require(_0xbaa1('0x6'));var querystring=require(_0xbaa1('0xc'));var Papa=require(_0xbaa1('0xd'));var Redis=require('ioredis');var authService=require(_0xbaa1('0xe'));var qs=require(_0xbaa1('0xf'));var as=require(_0xbaa1('0x10'));var hardwareService=require(_0xbaa1('0x11'));var logger=require(_0xbaa1('0x12'))(_0xbaa1('0x13'));var utils=require(_0xbaa1('0x14'));var config=require(_0xbaa1('0x15'));var licenseUtil=require(_0xbaa1('0x16'));var db=require(_0xbaa1('0x17'))['db'];var integrations=require(_0xbaa1('0x18'));function respondWithStatusCode(_0x1376c6,_0x5064a4){_0x5064a4=_0x5064a4||0xcc;return function(_0x592a07){if(_0x592a07){return _0x1376c6['sendStatus'](_0x5064a4);}return _0x1376c6['status'](_0x5064a4)[_0xbaa1('0x19')]();};}function respondWithResult(_0x388cfd,_0x3bfbcc){_0x3bfbcc=_0x3bfbcc||0xc8;return function(_0x26c1f5){if(_0x26c1f5){return _0x388cfd[_0xbaa1('0x1a')](_0x3bfbcc)[_0xbaa1('0x1b')](_0x26c1f5);}};}function respondWithFilteredResult(_0x30f191,_0xdbaa8b){return function(_0x35a3fd){if(_0x35a3fd){var _0x2a0c0b=typeof _0xdbaa8b[_0xbaa1('0x1c')]===_0xbaa1('0x1d')&&typeof _0xdbaa8b[_0xbaa1('0x1e')]===_0xbaa1('0x1d');var _0xa9883f=_0x35a3fd[_0xbaa1('0x1f')];var _0x305481=_0x2a0c0b?0x0:_0xdbaa8b[_0xbaa1('0x1c')];var _0x302cd3=_0x2a0c0b?_0x35a3fd['count']:_0xdbaa8b[_0xbaa1('0x1c')]+_0xdbaa8b[_0xbaa1('0x1e')];var _0x20d75f;if(_0x302cd3>=_0xa9883f){_0x302cd3=_0xa9883f;_0x20d75f=0xc8;}else{_0x20d75f=0xce;}_0x30f191[_0xbaa1('0x1a')](_0x20d75f);return _0x30f191[_0xbaa1('0x20')](_0xbaa1('0x21'),_0x305481+'-'+_0x302cd3+'/'+_0xa9883f)['json'](_0x35a3fd);}return null;};}function patchUpdates(_0x1c587c){return function(_0x451255){try{jsonpatch[_0xbaa1('0x22')](_0x451255,_0x1c587c,!![]);}catch(_0x365810){return BPromise[_0xbaa1('0x23')](_0x365810);}return _0x451255['save']();};}function saveUpdates(_0x4e4a0c,_0x2b01ec){return function(_0x24427a){if(_0x24427a){return _0x24427a[_0xbaa1('0x24')](_0x4e4a0c)[_0xbaa1('0x25')](function(_0x117079){return _0x117079;});}return null;};}function removeEntity(_0x113bbd,_0x4806e7){return function(_0x243eeb){if(_0x243eeb){return _0x243eeb[_0xbaa1('0x26')]()[_0xbaa1('0x25')](function(){_0x113bbd[_0xbaa1('0x1a')](0xcc)[_0xbaa1('0x19')]();});}};}function handleEntityNotFound(_0x2a56ad,_0x39e3ce){return function(_0x2d208e){if(!_0x2d208e){_0x2a56ad[_0xbaa1('0x27')](0x194);}return _0x2d208e;};}function handleError(_0x58d85d,_0x2b80a4){_0x2b80a4=_0x2b80a4||0x1f4;return function(_0x29298c){logger[_0xbaa1('0x28')](_0x29298c[_0xbaa1('0x29')]);if(_0x29298c[_0xbaa1('0x2a')]){delete _0x29298c[_0xbaa1('0x2a')];}_0x58d85d['status'](_0x2b80a4)['send'](_0x29298c);};}exports[_0xbaa1('0x2b')]=function(_0x1e1869,_0x270759){var _0x48cbc0={},_0xf3ff18={},_0x45c184={'count':0x0,'rows':[]};var _0x4f3e27=_[_0xbaa1('0x2c')](db['FreshdeskAccount'][_0xbaa1('0x2d')],function(_0x3670bd){return{'name':_0x3670bd[_0xbaa1('0x2e')],'type':_0x3670bd['type']['key']};});_0xf3ff18[_0xbaa1('0x2f')]=_[_0xbaa1('0x2c')](_0x4f3e27,_0xbaa1('0x2a'));_0xf3ff18[_0xbaa1('0x30')]=_[_0xbaa1('0x31')](_0x1e1869[_0xbaa1('0x30')]);_0xf3ff18['filters']=_[_0xbaa1('0x32')](_0xf3ff18[_0xbaa1('0x2f')],_0xf3ff18[_0xbaa1('0x30')]);_0x48cbc0[_0xbaa1('0x33')]=_['intersection'](_0xf3ff18[_0xbaa1('0x2f')],qs['fields'](_0x1e1869[_0xbaa1('0x30')][_0xbaa1('0x34')]));_0x48cbc0[_0xbaa1('0x33')]=_0x48cbc0[_0xbaa1('0x33')]['length']?_0x48cbc0[_0xbaa1('0x33')]:_0xf3ff18[_0xbaa1('0x2f')];if(!_0x1e1869[_0xbaa1('0x30')]['hasOwnProperty'](_0xbaa1('0x35'))){_0x48cbc0[_0xbaa1('0x1e')]=qs['limit'](_0x1e1869[_0xbaa1('0x30')][_0xbaa1('0x1e')]);_0x48cbc0[_0xbaa1('0x1c')]=qs['offset'](_0x1e1869[_0xbaa1('0x30')]['offset']);}_0x48cbc0['order']=qs[_0xbaa1('0x36')](_0x1e1869['query'][_0xbaa1('0x36')]);_0x48cbc0[_0xbaa1('0x37')]=qs[_0xbaa1('0x38')](_['pick'](_0x1e1869[_0xbaa1('0x30')],_0xf3ff18[_0xbaa1('0x38')]),_0x4f3e27);if(_0x1e1869['query'][_0xbaa1('0x39')]){_0x48cbc0[_0xbaa1('0x37')]=_[_0xbaa1('0x3a')](_0x48cbc0[_0xbaa1('0x37')],{'$or':_[_0xbaa1('0x2c')](_0x4f3e27,function(_0x35b873){if(_0x35b873[_0xbaa1('0x3b')]!==_0xbaa1('0x3c')){var _0x47c998={};_0x47c998[_0x35b873[_0xbaa1('0x2a')]]={'$like':'%'+_0x1e1869['query'][_0xbaa1('0x39')]+'%'};return _0x47c998;}})});}_0x48cbc0=_[_0xbaa1('0x3a')]({},_0x48cbc0,_0x1e1869[_0xbaa1('0x3d')]);var _0x4c1bfe={'where':_0x48cbc0[_0xbaa1('0x37')]};return db['FreshdeskAccount']['count'](_0x4c1bfe)[_0xbaa1('0x25')](function(_0x5245a9){_0x45c184[_0xbaa1('0x1f')]=_0x5245a9;if(_0x1e1869['query']['includeAll']){_0x48cbc0[_0xbaa1('0x3e')]=[{'all':!![]}];}return db[_0xbaa1('0x3f')][_0xbaa1('0x40')](_0x48cbc0);})[_0xbaa1('0x25')](function(_0x2c0984){_0x45c184[_0xbaa1('0x41')]=_0x2c0984;return _0x45c184;})[_0xbaa1('0x25')](respondWithFilteredResult(_0x270759,_0x48cbc0))[_0xbaa1('0x42')](handleError(_0x270759,null));};exports[_0xbaa1('0x43')]=function(_0x36b72b,_0x148792){var _0xc59188={'raw':![],'where':{'id':_0x36b72b[_0xbaa1('0x44')]['id']}},_0x163605={};_0x163605['model']=_['keys'](db[_0xbaa1('0x3f')][_0xbaa1('0x2d')]);_0x163605[_0xbaa1('0x30')]=_[_0xbaa1('0x31')](_0x36b72b[_0xbaa1('0x30')]);_0x163605[_0xbaa1('0x38')]=_[_0xbaa1('0x32')](_0x163605[_0xbaa1('0x2f')],_0x163605['query']);_0xc59188[_0xbaa1('0x33')]=_[_0xbaa1('0x32')](_0x163605[_0xbaa1('0x2f')],qs[_0xbaa1('0x34')](_0x36b72b[_0xbaa1('0x30')][_0xbaa1('0x34')]));_0xc59188['attributes']=_0xc59188['attributes'][_0xbaa1('0x45')]?_0xc59188['attributes']:_0x163605[_0xbaa1('0x2f')];if(_0x36b72b[_0xbaa1('0x30')][_0xbaa1('0x46')]){_0xc59188['include']=[{'all':!![]}];}_0xc59188=_[_0xbaa1('0x3a')]({},_0xc59188,_0x36b72b[_0xbaa1('0x3d')]);return db[_0xbaa1('0x3f')][_0xbaa1('0x47')](_0xc59188)[_0xbaa1('0x25')](handleEntityNotFound(_0x148792,null))['then'](respondWithResult(_0x148792,null))['catch'](handleError(_0x148792,null));};exports[_0xbaa1('0x48')]=function(_0x2627ae,_0x3bad61){return db[_0xbaa1('0x3f')][_0xbaa1('0x48')](_0x2627ae[_0xbaa1('0x49')],{})[_0xbaa1('0x25')](respondWithResult(_0x3bad61,0xc9))[_0xbaa1('0x42')](handleError(_0x3bad61,null));};exports[_0xbaa1('0x24')]=function(_0x19c7f5,_0x471173){if(_0x19c7f5['body']['id']){delete _0x19c7f5[_0xbaa1('0x49')]['id'];}return db[_0xbaa1('0x3f')][_0xbaa1('0x47')]({'where':{'id':_0x19c7f5[_0xbaa1('0x44')]['id']}})[_0xbaa1('0x25')](handleEntityNotFound(_0x471173,null))[_0xbaa1('0x25')](saveUpdates(_0x19c7f5[_0xbaa1('0x49')],null))['then'](respondWithResult(_0x471173,null))[_0xbaa1('0x42')](handleError(_0x471173,null));};exports[_0xbaa1('0x26')]=function(_0x56aeda,_0x18e207){return db[_0xbaa1('0x3f')][_0xbaa1('0x47')]({'where':{'id':_0x56aeda[_0xbaa1('0x44')]['id']}})['then'](handleEntityNotFound(_0x18e207,null))[_0xbaa1('0x25')](removeEntity(_0x18e207,null))['catch'](handleError(_0x18e207,null));};exports[_0xbaa1('0x4a')]=function(_0x166e2a,_0x5afdab,_0x1410bb){var _0x4dbb48={};var _0x42e38e={};var _0x109b08;var _0x176ce2;return db[_0xbaa1('0x3f')][_0xbaa1('0x4b')]({'where':{'id':_0x166e2a[_0xbaa1('0x44')]['id']}})[_0xbaa1('0x25')](handleEntityNotFound(_0x5afdab,null))[_0xbaa1('0x25')](function(_0x5018e2){if(_0x5018e2){_0x109b08=_0x5018e2;_0x42e38e[_0xbaa1('0x2f')]=_[_0xbaa1('0x31')](db[_0xbaa1('0x4c')][_0xbaa1('0x2d')]);_0x42e38e[_0xbaa1('0x30')]=_[_0xbaa1('0x31')](_0x166e2a[_0xbaa1('0x30')]);_0x42e38e['filters']=_['intersection'](_0x42e38e[_0xbaa1('0x2f')],_0x42e38e[_0xbaa1('0x30')]);_0x4dbb48['attributes']=_[_0xbaa1('0x32')](_0x42e38e[_0xbaa1('0x2f')],qs[_0xbaa1('0x34')](_0x166e2a['query'][_0xbaa1('0x34')]));_0x4dbb48[_0xbaa1('0x33')]=_0x4dbb48[_0xbaa1('0x33')][_0xbaa1('0x45')]?_0x4dbb48[_0xbaa1('0x33')]:_0x42e38e[_0xbaa1('0x2f')];_0x4dbb48['order']=qs[_0xbaa1('0x36')](_0x166e2a[_0xbaa1('0x30')]['sort']);_0x4dbb48['where']=qs[_0xbaa1('0x38')](_['pick'](_0x166e2a[_0xbaa1('0x30')],_0x42e38e[_0xbaa1('0x38')]));if(_0x166e2a[_0xbaa1('0x30')]['filter']){_0x4dbb48[_0xbaa1('0x37')]=_[_0xbaa1('0x3a')](_0x4dbb48[_0xbaa1('0x37')],{'$or':_[_0xbaa1('0x2c')](_0x4dbb48['attributes'],function(_0x20b61f){var _0x206dd6={};_0x206dd6[_0x20b61f]={'$like':'%'+_0x166e2a[_0xbaa1('0x30')][_0xbaa1('0x39')]+'%'};return _0x206dd6;})});}_0x4dbb48=_[_0xbaa1('0x3a')]({},_0x4dbb48,_0x166e2a[_0xbaa1('0x3d')]);return _0x109b08[_0xbaa1('0x4a')](_0x4dbb48);}})[_0xbaa1('0x25')](function(_0x2200e0){if(_0x2200e0){_0x176ce2=_0x2200e0[_0xbaa1('0x45')];if(!_0x166e2a[_0xbaa1('0x30')][_0xbaa1('0x4d')](_0xbaa1('0x35'))){_0x4dbb48['limit']=qs[_0xbaa1('0x1e')](_0x166e2a[_0xbaa1('0x30')][_0xbaa1('0x1e')]);_0x4dbb48['offset']=qs[_0xbaa1('0x1c')](_0x166e2a[_0xbaa1('0x30')][_0xbaa1('0x1c')]);}return _0x109b08[_0xbaa1('0x4a')](_0x4dbb48);}})[_0xbaa1('0x25')](function(_0x3fb861){if(_0x3fb861){return _0x3fb861?{'count':_0x176ce2,'rows':_0x3fb861}:null;}})[_0xbaa1('0x25')](respondWithResult(_0x5afdab,null))[_0xbaa1('0x42')](handleError(_0x5afdab,null));};exports[_0xbaa1('0x4e')]=function(_0x415535,_0x3b16da,_0x2bdcaa){if(_0x415535[_0xbaa1('0x49')]['id']){delete _0x415535['body']['id'];}return db['FreshdeskAccount'][_0xbaa1('0x4b')]({'where':{'id':_0x415535[_0xbaa1('0x44')]['id']}})[_0xbaa1('0x25')](handleEntityNotFound(_0x3b16da,null))[_0xbaa1('0x25')](function(_0x296d32){if(_0x296d32){_0x415535[_0xbaa1('0x49')]['AccountId']=_0x296d32['id'];_0x415535[_0xbaa1('0x49')][_0xbaa1('0x4f')]=integrations['getSubjects'](_0x415535['body']['channel'],_0x415535[_0xbaa1('0x49')]['type']);_0x415535[_0xbaa1('0x49')]['Descriptions']=integrations[_0xbaa1('0x50')](_0x415535[_0xbaa1('0x49')][_0xbaa1('0x51')],_0x415535[_0xbaa1('0x49')]['type']);return db[_0xbaa1('0x4c')]['create'](_0x415535[_0xbaa1('0x49')],{'include':[{'model':db[_0xbaa1('0x52')],'as':_0xbaa1('0x4f')},{'model':db[_0xbaa1('0x52')],'as':_0xbaa1('0x53')}]});}return null;})[_0xbaa1('0x25')](respondWithResult(_0x3b16da,null))['catch'](handleError(_0x3b16da,null));};exports[_0xbaa1('0x54')]=function(_0x5c1e78,_0x438bd6,_0xa9a5f4){var _0x48a591='';return db['FreshdeskAccount'][_0xbaa1('0x4b')]({'where':{'id':_0x5c1e78[_0xbaa1('0x44')]['id']},'attributes':['id','remoteUri',_0xbaa1('0x55')]})['then'](handleEntityNotFound(_0x438bd6,null))['then'](function(_0x363c2b){if(_0x363c2b){_0x48a591=_0x363c2b[_0xbaa1('0x56')];var _0x13cb7b=_0x48a591[_0xbaa1('0x57')](-0x1);if(_0x13cb7b==='/'){_0x48a591=_0x48a591['substring'](0x0,_0x48a591['lastIndexOf'](_0x13cb7b));}return rp({'method':_0xbaa1('0x58'),'uri':util['format'](_0xbaa1('0x59'),_0x48a591,_0xbaa1('0x5a')),'headers':{'Authorization':util['format'](_0xbaa1('0x5b'),new Buffer(util[_0xbaa1('0x5c')](_0xbaa1('0x5d'),_0x363c2b[_0xbaa1('0x55')]))[_0xbaa1('0x5e')]('base64'))},'json':!![]});}})[_0xbaa1('0x25')](function(_0x57455d){if(_0x57455d){var _0xb98816=[_0xbaa1('0x5f'),_0xbaa1('0x60'),_0xbaa1('0x61'),'description',_0xbaa1('0x1a'),_0xbaa1('0x62'),_0xbaa1('0x63'),'source',_0xbaa1('0x64'),_0xbaa1('0x63'),_0xbaa1('0x65')];_[_0xbaa1('0x66')](_0x57455d,function(_0x18b948){return _0xb98816['includes'](_0x18b948['name'])||!_0x18b948[_0xbaa1('0x67')]&&_0x18b948[_0xbaa1('0x3b')]!=='custom_text'&&_0x18b948[_0xbaa1('0x3b')]!==_0xbaa1('0x68');});return{'count':_0x57455d['length'],'rows':_['map'](_0x57455d,function(_0x1ff633){return{'id':_0x1ff633[_0xbaa1('0x2a')],'name':_0x1ff633['label'],'custom':!_0x1ff633[_0xbaa1('0x67')],'options':_0x1ff633[_0xbaa1('0x69')]?_['map'](_0x1ff633['choices'],function(_0x154f8e){return{'name':_[_0xbaa1('0x6a')](_0x154f8e),'value':_0x154f8e};}):[]};})};}})[_0xbaa1('0x25')](respondWithResult(_0x438bd6,null))[_0xbaa1('0x42')](function(_0xea66ab){var _0x41acc3=_0x5c1e78['query']['test']?0x1f4:_0xea66ab['statusCode']||0x1f4;logger[_0xbaa1('0x28')](_0xbaa1('0x6b'),_0xbaa1('0x54'),_0x41acc3,JSON[_0xbaa1('0x6c')](_0xea66ab));delete _0xea66ab[_0xbaa1('0x2a')];if(_0x41acc3===0x191){_0x41acc3=0x190;}_0x438bd6['status'](_0x41acc3)[_0xbaa1('0x6d')](_0x5c1e78[_0xbaa1('0x30')][_0xbaa1('0x6e')]?{'message':_0xbaa1('0x6f'),'statusCode':_0xea66ab[_0xbaa1('0x70')]}:_0xea66ab);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 0af6462..6570a63 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 _0x7e46=['path','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x115edd,_0x505f03){var _0x255f84=function(_0x1586ae){while(--_0x1586ae){_0x115edd['push'](_0x115edd['shift']());}};_0x255f84(++_0x505f03);}(_0x7e46,0x8a));var _0x67e4=function(_0x5d8390,_0x5d3ae0){_0x5d8390=_0x5d8390-0x0;var _0x2b0fcf=_0x7e46[_0x5d8390];return _0x2b0fcf;};'use strict';var _=require(_0x67e4('0x0'));var util=require(_0x67e4('0x1'));var logger=require(_0x67e4('0x2'))(_0x67e4('0x3'));var moment=require(_0x67e4('0x4'));var BPromise=require(_0x67e4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67e4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x67e4('0x7'));module[_0x67e4('0x8')]=function(_0x330a22,_0x4ec410){return _0x330a22[_0x67e4('0x9')](_0x67e4('0xa'),attributes,{'tableName':_0x67e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bd6=['int_freshdesk_accounts','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x540315,_0x5e4286){var _0x45b752=function(_0x42f23e){while(--_0x42f23e){_0x540315['push'](_0x540315['shift']());}};_0x45b752(++_0x5e4286);}(_0x3bd6,0x169));var _0x63bd=function(_0x490dde,_0x4917c6){_0x490dde=_0x490dde-0x0;var _0x10c022=_0x3bd6[_0x490dde];return _0x10c022;};'use strict';var _=require(_0x63bd('0x0'));var util=require(_0x63bd('0x1'));var logger=require('../../config/logger')(_0x63bd('0x2'));var moment=require(_0x63bd('0x3'));var BPromise=require('bluebird');var rp=require(_0x63bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63bd('0x5'));var config=require(_0x63bd('0x6'));var attributes=require(_0x63bd('0x7'));var integrations=require(_0x63bd('0x8'));module['exports']=function(_0x2483e3,_0x478a0e){return _0x2483e3[_0x63bd('0x9')](_0x63bd('0xa'),attributes,{'tableName':_0x63bd('0xb'),'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 b552993..dc1f974 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 _0xb763=['jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','debug','catch','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d2c62,_0xfc649d){var _0x3e63f9=function(_0x4a6074){while(--_0x4a6074){_0x4d2c62['push'](_0x4d2c62['shift']());}};_0x3e63f9(++_0xfc649d);}(_0xb763,0x155));var _0x3b76=function(_0x2ac3a8,_0x4d90c9){_0x2ac3a8=_0x2ac3a8-0x0;var _0x3b59ca=_0xb763[_0x2ac3a8];return _0x3b59ca;};'use strict';var _=require(_0x3b76('0x0'));var util=require(_0x3b76('0x1'));var moment=require(_0x3b76('0x2'));var BPromise=require(_0x3b76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b76('0x4'))['db'];var utils=require(_0x3b76('0x5'));var logger=require(_0x3b76('0x6'))(_0x3b76('0x7'));var config=require(_0x3b76('0x8'));var jayson=require(_0x3b76('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0428,_0x81f08f,_0xe60f92){return new BPromise(function(_0x4b7b35,_0x1c66bd){return client[_0x3b76('0xa')](_0x4a0428,_0xe60f92)[_0x3b76('0xb')](function(_0x38bafa){logger[_0x3b76('0xc')](_0x3b76('0xd'),_0x81f08f,_0x3b76('0xe'));logger['debug'](_0x3b76('0xf'),_0x81f08f,_0x3b76('0xe'),JSON[_0x3b76('0x10')](_0x38bafa));if(_0x38bafa[_0x3b76('0x11')]){if(_0x38bafa[_0x3b76('0x11')][_0x3b76('0x12')]===0x1f4){logger[_0x3b76('0x11')](_0x3b76('0xd'),_0x81f08f,_0x38bafa[_0x3b76('0x11')]['message']);return _0x1c66bd(_0x38bafa[_0x3b76('0x11')][_0x3b76('0x13')]);}logger[_0x3b76('0x11')](_0x3b76('0xd'),_0x81f08f,_0x38bafa['error'][_0x3b76('0x13')]);return _0x4b7b35(_0x38bafa['error'][_0x3b76('0x13')]);}else{logger[_0x3b76('0xc')](_0x3b76('0xd'),_0x81f08f,_0x3b76('0xe'));_0x4b7b35(_0x38bafa['result'][_0x3b76('0x13')]);}})['catch'](function(_0x406b9d){logger[_0x3b76('0x11')](_0x3b76('0xd'),_0x81f08f,_0x406b9d);_0x1c66bd(_0x406b9d);});});}exports['GetFreshdeskAccount']=function(_0x10249c){var _0x3d2df7=this;return new Promise(function(_0x442d0d,_0x35d161){return db[_0x3b76('0x14')][_0x3b76('0x15')]({'raw':_0x10249c[_0x3b76('0x16')]?_0x10249c['options']['raw']===undefined?!![]:![]:!![],'where':_0x10249c['options']?_0x10249c[_0x3b76('0x16')][_0x3b76('0x17')]||null:null,'attributes':_0x10249c[_0x3b76('0x16')]?_0x10249c['options'][_0x3b76('0x18')]||null:null,'limit':_0x10249c[_0x3b76('0x16')]?_0x10249c['options'][_0x3b76('0x19')]||null:null,'include':_0x10249c['options']?_0x10249c['options'][_0x3b76('0x1a')]?_[_0x3b76('0x1b')](_0x10249c[_0x3b76('0x16')][_0x3b76('0x1a')],function(_0x700325){return{'model':db[_0x700325[_0x3b76('0x1c')]],'as':_0x700325['as'],'attributes':_0x700325[_0x3b76('0x18')],'include':_0x700325[_0x3b76('0x1a')]?_['map'](_0x700325[_0x3b76('0x1a')],function(_0x184380){return{'model':db[_0x184380[_0x3b76('0x1c')]],'as':_0x184380['as'],'attributes':_0x184380[_0x3b76('0x18')],'include':_0x184380[_0x3b76('0x1a')]?_[_0x3b76('0x1b')](_0x184380[_0x3b76('0x1a')],function(_0x2b97b9){return{'model':db[_0x2b97b9[_0x3b76('0x1c')]],'as':_0x2b97b9['as'],'attributes':_0x2b97b9[_0x3b76('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b76('0xb')](function(_0x1acde4){logger[_0x3b76('0xc')](_0x3b76('0x1d'),_0x10249c);logger[_0x3b76('0x1e')](_0x3b76('0x1d'),_0x10249c,JSON['stringify'](_0x1acde4));_0x442d0d(_0x1acde4);})[_0x3b76('0x1f')](function(_0x59763b){logger[_0x3b76('0x11')](_0x3b76('0x1d'),_0x59763b[_0x3b76('0x13')],_0x10249c);_0x35d161(_0x3d2df7['error'](0x1f4,_0x59763b[_0x3b76('0x13')]));});});};exports[_0x3b76('0x20')]=function(_0x47126c){var _0x265d6e=this;return new Promise(function(_0x53f4f9,_0xd80475){return db[_0x3b76('0x14')][_0x3b76('0x21')]({'raw':_0x47126c[_0x3b76('0x16')]?_0x47126c[_0x3b76('0x16')][_0x3b76('0x22')]===undefined?!![]:![]:!![],'where':_0x47126c[_0x3b76('0x16')]?_0x47126c[_0x3b76('0x16')]['where']||null:null,'attributes':_0x47126c[_0x3b76('0x16')]?_0x47126c[_0x3b76('0x16')][_0x3b76('0x18')]||null:null,'include':_0x47126c['options']?_0x47126c[_0x3b76('0x16')][_0x3b76('0x1a')]?_[_0x3b76('0x1b')](_0x47126c[_0x3b76('0x16')]['include'],function(_0x3419e0){return{'model':db[_0x3419e0[_0x3b76('0x1c')]],'as':_0x3419e0['as'],'attributes':_0x3419e0[_0x3b76('0x18')],'include':_0x3419e0[_0x3b76('0x1a')]?_['map'](_0x3419e0['include'],function(_0xc2a827){return{'model':db[_0xc2a827[_0x3b76('0x1c')]],'as':_0xc2a827['as'],'attributes':_0xc2a827[_0x3b76('0x18')],'include':_0xc2a827['include']?_[_0x3b76('0x1b')](_0xc2a827[_0x3b76('0x1a')],function(_0x36f5d3){return{'model':db[_0x36f5d3['model']],'as':_0x36f5d3['as'],'attributes':_0x36f5d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x340f6f){logger['info'](_0x3b76('0x20'),_0x47126c);logger[_0x3b76('0x1e')]('ShowFreshdeskAccount',_0x47126c,JSON[_0x3b76('0x10')](_0x340f6f));_0x53f4f9(_0x340f6f);})['catch'](function(_0x4ca6fe){logger[_0x3b76('0x11')](_0x3b76('0x20'),_0x4ca6fe[_0x3b76('0x13')],_0x47126c);_0xd80475(_0x265d6e['error'](0x1f4,_0x4ca6fe[_0x3b76('0x13')]));});});}; \ No newline at end of file +var _0x5b1d=['options','raw','attributes','limit','map','include','model','stringify','ShowFreshdeskAccount','find','where','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x5e041b,_0x2b6e8c){var _0x5594b5=function(_0x33dab4){while(--_0x33dab4){_0x5e041b['push'](_0x5e041b['shift']());}};_0x5594b5(++_0x2b6e8c);}(_0x5b1d,0xd8));var _0xd5b1=function(_0x3c61c5,_0x58175c){_0x3c61c5=_0x3c61c5-0x0;var _0x2caafd=_0x5b1d[_0x3c61c5];return _0x2caafd;};'use strict';var _=require(_0xd5b1('0x0'));var util=require(_0xd5b1('0x1'));var moment=require('moment');var BPromise=require(_0xd5b1('0x2'));var rs=require(_0xd5b1('0x3'));var fs=require('fs');var Redis=require(_0xd5b1('0x4'));var db=require(_0xd5b1('0x5'))['db'];var utils=require(_0xd5b1('0x6'));var logger=require(_0xd5b1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd5b1('0x8'));var client=jayson['client'][_0xd5b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55b348,_0x37eceb,_0x32b68c){return new BPromise(function(_0x3978ac,_0x4bae25){return client[_0xd5b1('0xa')](_0x55b348,_0x32b68c)[_0xd5b1('0xb')](function(_0x47a9ca){logger[_0xd5b1('0xc')](_0xd5b1('0xd'),_0x37eceb,_0xd5b1('0xe'));logger[_0xd5b1('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x37eceb,_0xd5b1('0xe'),JSON['stringify'](_0x47a9ca));if(_0x47a9ca[_0xd5b1('0x10')]){if(_0x47a9ca[_0xd5b1('0x10')]['code']===0x1f4){logger[_0xd5b1('0x10')](_0xd5b1('0xd'),_0x37eceb,_0x47a9ca[_0xd5b1('0x10')][_0xd5b1('0x11')]);return _0x4bae25(_0x47a9ca['error']['message']);}logger[_0xd5b1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x37eceb,_0x47a9ca['error'][_0xd5b1('0x11')]);return _0x3978ac(_0x47a9ca[_0xd5b1('0x10')][_0xd5b1('0x11')]);}else{logger['info'](_0xd5b1('0xd'),_0x37eceb,_0xd5b1('0xe'));_0x3978ac(_0x47a9ca[_0xd5b1('0x12')][_0xd5b1('0x11')]);}})['catch'](function(_0x562814){logger[_0xd5b1('0x10')](_0xd5b1('0xd'),_0x37eceb,_0x562814);_0x4bae25(_0x562814);});});}exports[_0xd5b1('0x13')]=function(_0x397737){var _0x560080=this;return new Promise(function(_0x6e8add,_0x449626){return db[_0xd5b1('0x14')][_0xd5b1('0x15')]({'raw':_0x397737[_0xd5b1('0x16')]?_0x397737[_0xd5b1('0x16')][_0xd5b1('0x17')]===undefined?!![]:![]:!![],'where':_0x397737[_0xd5b1('0x16')]?_0x397737[_0xd5b1('0x16')]['where']||null:null,'attributes':_0x397737['options']?_0x397737[_0xd5b1('0x16')][_0xd5b1('0x18')]||null:null,'limit':_0x397737[_0xd5b1('0x16')]?_0x397737[_0xd5b1('0x16')][_0xd5b1('0x19')]||null:null,'include':_0x397737[_0xd5b1('0x16')]?_0x397737['options']['include']?_[_0xd5b1('0x1a')](_0x397737['options'][_0xd5b1('0x1b')],function(_0x42b6eb){return{'model':db[_0x42b6eb[_0xd5b1('0x1c')]],'as':_0x42b6eb['as'],'attributes':_0x42b6eb['attributes'],'include':_0x42b6eb['include']?_[_0xd5b1('0x1a')](_0x42b6eb['include'],function(_0x1b1f36){return{'model':db[_0x1b1f36['model']],'as':_0x1b1f36['as'],'attributes':_0x1b1f36[_0xd5b1('0x18')],'include':_0x1b1f36[_0xd5b1('0x1b')]?_['map'](_0x1b1f36['include'],function(_0x18df01){return{'model':db[_0x18df01[_0xd5b1('0x1c')]],'as':_0x18df01['as'],'attributes':_0x18df01['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5b1('0xb')](function(_0x5c2a37){logger[_0xd5b1('0xc')](_0xd5b1('0x13'),_0x397737);logger[_0xd5b1('0xf')](_0xd5b1('0x13'),_0x397737,JSON[_0xd5b1('0x1d')](_0x5c2a37));_0x6e8add(_0x5c2a37);})['catch'](function(_0x53042d){logger[_0xd5b1('0x10')](_0xd5b1('0x13'),_0x53042d[_0xd5b1('0x11')],_0x397737);_0x449626(_0x560080[_0xd5b1('0x10')](0x1f4,_0x53042d[_0xd5b1('0x11')]));});});};exports[_0xd5b1('0x1e')]=function(_0x118507){var _0x595fbb=this;return new Promise(function(_0xe4cc16,_0x5de0bb){return db[_0xd5b1('0x14')][_0xd5b1('0x1f')]({'raw':_0x118507[_0xd5b1('0x16')]?_0x118507['options'][_0xd5b1('0x17')]===undefined?!![]:![]:!![],'where':_0x118507['options']?_0x118507[_0xd5b1('0x16')][_0xd5b1('0x20')]||null:null,'attributes':_0x118507[_0xd5b1('0x16')]?_0x118507[_0xd5b1('0x16')]['attributes']||null:null,'include':_0x118507['options']?_0x118507[_0xd5b1('0x16')][_0xd5b1('0x1b')]?_[_0xd5b1('0x1a')](_0x118507['options'][_0xd5b1('0x1b')],function(_0x28c66c){return{'model':db[_0x28c66c[_0xd5b1('0x1c')]],'as':_0x28c66c['as'],'attributes':_0x28c66c[_0xd5b1('0x18')],'include':_0x28c66c[_0xd5b1('0x1b')]?_[_0xd5b1('0x1a')](_0x28c66c[_0xd5b1('0x1b')],function(_0x218523){return{'model':db[_0x218523[_0xd5b1('0x1c')]],'as':_0x218523['as'],'attributes':_0x218523['attributes'],'include':_0x218523['include']?_[_0xd5b1('0x1a')](_0x218523['include'],function(_0xe74c90){return{'model':db[_0xe74c90[_0xd5b1('0x1c')]],'as':_0xe74c90['as'],'attributes':_0xe74c90[_0xd5b1('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f2687){logger[_0xd5b1('0xc')]('ShowFreshdeskAccount',_0x118507);logger['debug']('ShowFreshdeskAccount',_0x118507,JSON[_0xd5b1('0x1d')](_0x2f2687));_0xe4cc16(_0x2f2687);})[_0xd5b1('0x21')](function(_0x9c1a74){logger[_0xd5b1('0x10')](_0xd5b1('0x1e'),_0x9c1a74[_0xd5b1('0x11')],_0x118507);_0x5de0bb(_0x595fbb[_0xd5b1('0x10')](0x1f4,_0x9c1a74[_0xd5b1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 688d5a3..8666cd5 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 _0xca7b=['isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x18723d,_0x5815b3){var _0x10a7db=function(_0x1d07eb){while(--_0x1d07eb){_0x18723d['push'](_0x18723d['shift']());}};_0x10a7db(++_0x5815b3);}(_0xca7b,0x1a6));var _0xbca7=function(_0x17c7a7,_0x58a177){_0x17c7a7=_0x17c7a7-0x0;var _0x39ff8e=_0xca7b[_0x17c7a7];return _0x39ff8e;};'use strict';var multer=require(_0xbca7('0x0'));var util=require(_0xbca7('0x1'));var path=require('path');var timeout=require(_0xbca7('0x2'));var express=require('express');var router=express[_0xbca7('0x3')]();var fs_extra=require(_0xbca7('0x4'));var auth=require(_0xbca7('0x5'));var interaction=require(_0xbca7('0x6'));var config=require(_0xbca7('0x7'));var controller=require(_0xbca7('0x8'));router[_0xbca7('0x9')]('/',auth[_0xbca7('0xa')](),controller['index']);router[_0xbca7('0x9')](_0xbca7('0xb'),auth[_0xbca7('0xa')](),controller[_0xbca7('0xc')]);router[_0xbca7('0x9')]('/:id/fields',auth[_0xbca7('0xa')](),controller[_0xbca7('0xd')]);router['get'](_0xbca7('0xe'),auth[_0xbca7('0xa')](),controller[_0xbca7('0xf')]);router[_0xbca7('0x9')](_0xbca7('0x10'),auth[_0xbca7('0xa')](),controller[_0xbca7('0x11')]);router[_0xbca7('0x9')](_0xbca7('0x12'),auth[_0xbca7('0xa')](),controller[_0xbca7('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbca7('0x14')]);router[_0xbca7('0x15')](_0xbca7('0x12'),auth[_0xbca7('0xa')](),controller[_0xbca7('0x16')]);router[_0xbca7('0x17')](_0xbca7('0xb'),auth[_0xbca7('0xa')](),controller[_0xbca7('0x18')]);router[_0xbca7('0x19')](_0xbca7('0xb'),auth[_0xbca7('0xa')](),controller['destroy']);module[_0xbca7('0x1a')]=router; \ No newline at end of file +var _0x35cc=['getTags','post','create','setTags','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','/:id/fields','getFields','get','/:id/subjects','/:id/descriptions','/:id/tags'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x35cc,0x1dc));var _0xc35c=function(_0x246362,_0x23e487){_0x246362=_0x246362-0x0;var _0x39bfe8=_0x35cc[_0x246362];return _0x39bfe8;};'use strict';var multer=require(_0xc35c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc35c('0x1'));var express=require(_0xc35c('0x2'));var router=express[_0xc35c('0x3')]();var fs_extra=require(_0xc35c('0x4'));var auth=require(_0xc35c('0x5'));var interaction=require(_0xc35c('0x6'));var config=require(_0xc35c('0x7'));var controller=require(_0xc35c('0x8'));router['get']('/',auth[_0xc35c('0x9')](),controller[_0xc35c('0xa')]);router['get'](_0xc35c('0xb'),auth[_0xc35c('0x9')](),controller['show']);router['get'](_0xc35c('0xc'),auth[_0xc35c('0x9')](),controller[_0xc35c('0xd')]);router[_0xc35c('0xe')](_0xc35c('0xf'),auth[_0xc35c('0x9')](),controller['getSubjects']);router[_0xc35c('0xe')](_0xc35c('0x10'),auth[_0xc35c('0x9')](),controller['getDescriptions']);router[_0xc35c('0xe')](_0xc35c('0x11'),auth[_0xc35c('0x9')](),controller[_0xc35c('0x12')]);router[_0xc35c('0x13')]('/',auth['isAuthenticated'](),controller[_0xc35c('0x14')]);router[_0xc35c('0x13')](_0xc35c('0x11'),auth[_0xc35c('0x9')](),controller[_0xc35c('0x15')]);router[_0xc35c('0x16')](_0xc35c('0xb'),auth[_0xc35c('0x9')](),controller[_0xc35c('0x17')]);router[_0xc35c('0x18')](_0xc35c('0xb'),auth[_0xc35c('0x9')](),controller['destroy']);module[_0xc35c('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index e77ce88..7f791fb 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 _0xbe88=['STRING','sequelize','exports'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xbe88,0x11b));var _0x8be8=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0xbe88[_0x1233d2];return _0x22759e;};'use strict';var Sequelize=require(_0x8be8('0x0'));module[_0x8be8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8be8('0x2')]}}; \ No newline at end of file +var _0xf222=['STRING','sequelize'];(function(_0x573fdf,_0x16cc8f){var _0x269299=function(_0x1c34cc){while(--_0x1c34cc){_0x573fdf['push'](_0x573fdf['shift']());}};_0x269299(++_0x16cc8f);}(_0xf222,0x101));var _0x2f22=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf222[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x2f22('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f22('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b38f634..d3abd5a 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 _0x5cc8=['send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','FreshdeskConfiguration','findAll','rows','catch','params','include','create','body','find','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','then','destroy','error','stack','name'];(function(_0x226584,_0x1af1bc){var _0x205921=function(_0x296558){while(--_0x296558){_0x226584['push'](_0x226584['shift']());}};_0x205921(++_0x1af1bc);}(_0x5cc8,0x113));var _0x85cc=function(_0x5dcc5d,_0x60f0b1){_0x5dcc5d=_0x5dcc5d-0x0;var _0x151355=_0x5cc8[_0x5dcc5d];return _0x151355;};'use strict';var emlformat=require(_0x85cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x85cc('0x1'));var jsonpatch=require(_0x85cc('0x2'));var rp=require(_0x85cc('0x3'));var moment=require(_0x85cc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85cc('0x5'));var path=require('path');var sox=require(_0x85cc('0x6'));var csv=require(_0x85cc('0x7'));var ejs=require(_0x85cc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x85cc('0x9'));var jsforce=require(_0x85cc('0xa'));var deskjs=require(_0x85cc('0xb'));var toCsv=require(_0x85cc('0x7'));var querystring=require(_0x85cc('0xc'));var Papa=require(_0x85cc('0xd'));var Redis=require(_0x85cc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x85cc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85cc('0x10'));var logger=require(_0x85cc('0x11'))('api');var utils=require(_0x85cc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x85cc('0x13'));var db=require(_0x85cc('0x14'))['db'];function respondWithStatusCode(_0x5e99f6,_0x65a3fa){_0x65a3fa=_0x65a3fa||0xcc;return function(_0x20302a){if(_0x20302a){return _0x5e99f6[_0x85cc('0x15')](_0x65a3fa);}return _0x5e99f6[_0x85cc('0x16')](_0x65a3fa)[_0x85cc('0x17')]();};}function respondWithResult(_0x23a872,_0x19f528){_0x19f528=_0x19f528||0xc8;return function(_0x3d8824){if(_0x3d8824){return _0x23a872[_0x85cc('0x16')](_0x19f528)[_0x85cc('0x18')](_0x3d8824);}};}function respondWithFilteredResult(_0x2d4e54,_0x3df8ae){return function(_0x41be56){if(_0x41be56){var _0xaa225a=typeof _0x3df8ae[_0x85cc('0x19')]==='undefined'&&typeof _0x3df8ae[_0x85cc('0x1a')]===_0x85cc('0x1b');var _0xa6ddb2=_0x41be56[_0x85cc('0x1c')];var _0x280f06=_0xaa225a?0x0:_0x3df8ae[_0x85cc('0x19')];var _0x55b711=_0xaa225a?_0x41be56[_0x85cc('0x1c')]:_0x3df8ae[_0x85cc('0x19')]+_0x3df8ae[_0x85cc('0x1a')];var _0x56a6a7;if(_0x55b711>=_0xa6ddb2){_0x55b711=_0xa6ddb2;_0x56a6a7=0xc8;}else{_0x56a6a7=0xce;}_0x2d4e54['status'](_0x56a6a7);return _0x2d4e54['set']('Content-Range',_0x280f06+'-'+_0x55b711+'/'+_0xa6ddb2)['json'](_0x41be56);}return null;};}function patchUpdates(_0xa921d9){return function(_0x28904f){try{jsonpatch['apply'](_0x28904f,_0xa921d9,!![]);}catch(_0x2fccf7){return BPromise[_0x85cc('0x1d')](_0x2fccf7);}return _0x28904f[_0x85cc('0x1e')]();};}function saveUpdates(_0x130ade,_0x40eb7a){return function(_0x4181c7){if(_0x4181c7){return _0x4181c7[_0x85cc('0x1f')](_0x130ade)[_0x85cc('0x20')](function(_0x5b3c13){return _0x5b3c13;});}return null;};}function removeEntity(_0x5eb30f,_0x389d3c){return function(_0x5db637){if(_0x5db637){return _0x5db637[_0x85cc('0x21')]()[_0x85cc('0x20')](function(){_0x5eb30f[_0x85cc('0x16')](0xcc)[_0x85cc('0x17')]();});}};}function handleEntityNotFound(_0x318fd5,_0x15d2de){return function(_0x537645){if(!_0x537645){_0x318fd5[_0x85cc('0x15')](0x194);}return _0x537645;};}function handleError(_0xbcc0f0,_0x400789){_0x400789=_0x400789||0x1f4;return function(_0x15e8d5){logger[_0x85cc('0x22')](_0x15e8d5[_0x85cc('0x23')]);if(_0x15e8d5['name']){delete _0x15e8d5[_0x85cc('0x24')];}_0xbcc0f0[_0x85cc('0x16')](_0x400789)[_0x85cc('0x25')](_0x15e8d5);};}exports['index']=function(_0x1e7567,_0x231d66){var _0x2618e9={},_0x4f061f={},_0x5e5cd4={'count':0x0,'rows':[]};var _0x3b3bd5=_[_0x85cc('0x26')](db['FreshdeskConfiguration'][_0x85cc('0x27')],function(_0x17062f){return{'name':_0x17062f['fieldName'],'type':_0x17062f[_0x85cc('0x28')][_0x85cc('0x29')]};});_0x4f061f[_0x85cc('0x2a')]=_[_0x85cc('0x26')](_0x3b3bd5,_0x85cc('0x24'));_0x4f061f['query']=_[_0x85cc('0x2b')](_0x1e7567[_0x85cc('0x2c')]);_0x4f061f[_0x85cc('0x2d')]=_[_0x85cc('0x2e')](_0x4f061f['model'],_0x4f061f[_0x85cc('0x2c')]);_0x2618e9[_0x85cc('0x2f')]=_[_0x85cc('0x2e')](_0x4f061f['model'],qs[_0x85cc('0x30')](_0x1e7567[_0x85cc('0x2c')]['fields']));_0x2618e9[_0x85cc('0x2f')]=_0x2618e9['attributes'][_0x85cc('0x31')]?_0x2618e9[_0x85cc('0x2f')]:_0x4f061f[_0x85cc('0x2a')];if(!_0x1e7567[_0x85cc('0x2c')][_0x85cc('0x32')](_0x85cc('0x33'))){_0x2618e9[_0x85cc('0x1a')]=qs[_0x85cc('0x1a')](_0x1e7567[_0x85cc('0x2c')][_0x85cc('0x1a')]);_0x2618e9[_0x85cc('0x19')]=qs['offset'](_0x1e7567[_0x85cc('0x2c')]['offset']);}_0x2618e9['order']=qs[_0x85cc('0x34')](_0x1e7567[_0x85cc('0x2c')][_0x85cc('0x34')]);_0x2618e9['where']=qs['filters'](_[_0x85cc('0x35')](_0x1e7567[_0x85cc('0x2c')],_0x4f061f[_0x85cc('0x2d')]),_0x3b3bd5);if(_0x1e7567['query'][_0x85cc('0x36')]){_0x2618e9[_0x85cc('0x37')]=_[_0x85cc('0x38')](_0x2618e9[_0x85cc('0x37')],{'$or':_['map'](_0x3b3bd5,function(_0x49f220){if(_0x49f220[_0x85cc('0x28')]!==_0x85cc('0x39')){var _0x18c327={};_0x18c327[_0x49f220[_0x85cc('0x24')]]={'$like':'%'+_0x1e7567['query'][_0x85cc('0x36')]+'%'};return _0x18c327;}})});}_0x2618e9=_['merge']({},_0x2618e9,_0x1e7567[_0x85cc('0x3a')]);var _0x34b7da={'where':_0x2618e9[_0x85cc('0x37')]};return db['FreshdeskConfiguration']['count'](_0x34b7da)[_0x85cc('0x20')](function(_0x4fd191){_0x5e5cd4[_0x85cc('0x1c')]=_0x4fd191;if(_0x1e7567[_0x85cc('0x2c')][_0x85cc('0x3b')]){_0x2618e9['include']=[{'all':!![]}];}return db[_0x85cc('0x3c')][_0x85cc('0x3d')](_0x2618e9);})[_0x85cc('0x20')](function(_0x50d20c){_0x5e5cd4[_0x85cc('0x3e')]=_0x50d20c;return _0x5e5cd4;})[_0x85cc('0x20')](respondWithFilteredResult(_0x231d66,_0x2618e9))[_0x85cc('0x3f')](handleError(_0x231d66,null));};exports['show']=function(_0x1ad048,_0x19d331){var _0x142dd6={'raw':![],'where':{'id':_0x1ad048[_0x85cc('0x40')]['id']}},_0xc9a08a={};_0xc9a08a['model']=_[_0x85cc('0x2b')](db[_0x85cc('0x3c')][_0x85cc('0x27')]);_0xc9a08a[_0x85cc('0x2c')]=_[_0x85cc('0x2b')](_0x1ad048[_0x85cc('0x2c')]);_0xc9a08a[_0x85cc('0x2d')]=_['intersection'](_0xc9a08a[_0x85cc('0x2a')],_0xc9a08a['query']);_0x142dd6['attributes']=_[_0x85cc('0x2e')](_0xc9a08a[_0x85cc('0x2a')],qs[_0x85cc('0x30')](_0x1ad048['query'][_0x85cc('0x30')]));_0x142dd6[_0x85cc('0x2f')]=_0x142dd6[_0x85cc('0x2f')][_0x85cc('0x31')]?_0x142dd6[_0x85cc('0x2f')]:_0xc9a08a[_0x85cc('0x2a')];if(_0x1ad048[_0x85cc('0x2c')]['includeAll']){_0x142dd6[_0x85cc('0x41')]=[{'all':!![]}];}_0x142dd6=_[_0x85cc('0x38')]({},_0x142dd6,_0x1ad048['options']);return db[_0x85cc('0x3c')]['find'](_0x142dd6)[_0x85cc('0x20')](handleEntityNotFound(_0x19d331,null))['then'](respondWithResult(_0x19d331,null))[_0x85cc('0x3f')](handleError(_0x19d331,null));};exports['create']=function(_0x107cef,_0x285ee4){return db[_0x85cc('0x3c')][_0x85cc('0x42')](_0x107cef[_0x85cc('0x43')],{})['then'](respondWithResult(_0x285ee4,0xc9))[_0x85cc('0x3f')](handleError(_0x285ee4,null));};exports['update']=function(_0x1c7315,_0x2aac00){if(_0x1c7315['body']['id']){delete _0x1c7315[_0x85cc('0x43')]['id'];}return db[_0x85cc('0x3c')][_0x85cc('0x44')]({'where':{'id':_0x1c7315[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0x2aac00,null))[_0x85cc('0x20')](saveUpdates(_0x1c7315['body'],null))[_0x85cc('0x20')](respondWithResult(_0x2aac00,null))[_0x85cc('0x3f')](handleError(_0x2aac00,null));};exports[_0x85cc('0x21')]=function(_0x4c60cb,_0xc5617){return db[_0x85cc('0x3c')]['find']({'where':{'id':_0x4c60cb[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0xc5617,null))['then'](removeEntity(_0xc5617,null))[_0x85cc('0x3f')](handleError(_0xc5617,null));};exports[_0x85cc('0x45')]=function(_0x2e506e,_0x4428b9,_0x49874a){var _0x43920a={};var _0x5921d1={};var _0x3dad16;var _0x449ae1;return db[_0x85cc('0x3c')][_0x85cc('0x46')]({'where':{'id':_0x2e506e[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0x4428b9,null))[_0x85cc('0x20')](function(_0x21b87a){if(_0x21b87a){_0x3dad16=_0x21b87a;_0x5921d1[_0x85cc('0x2a')]=_[_0x85cc('0x2b')](db[_0x85cc('0x47')][_0x85cc('0x27')]);_0x5921d1[_0x85cc('0x2c')]=_[_0x85cc('0x2b')](_0x2e506e[_0x85cc('0x2c')]);_0x5921d1[_0x85cc('0x2d')]=_[_0x85cc('0x2e')](_0x5921d1[_0x85cc('0x2a')],_0x5921d1[_0x85cc('0x2c')]);_0x43920a[_0x85cc('0x2f')]=_[_0x85cc('0x2e')](_0x5921d1[_0x85cc('0x2a')],qs[_0x85cc('0x30')](_0x2e506e[_0x85cc('0x2c')][_0x85cc('0x30')]));_0x43920a['attributes']=_0x43920a['attributes'][_0x85cc('0x31')]?_0x43920a[_0x85cc('0x2f')]:_0x5921d1[_0x85cc('0x2a')];_0x43920a[_0x85cc('0x48')]=qs[_0x85cc('0x34')](_0x2e506e[_0x85cc('0x2c')][_0x85cc('0x34')]);_0x43920a[_0x85cc('0x37')]=qs[_0x85cc('0x2d')](_[_0x85cc('0x35')](_0x2e506e[_0x85cc('0x2c')],_0x5921d1[_0x85cc('0x2d')]));if(_0x2e506e[_0x85cc('0x2c')]['filter']){_0x43920a[_0x85cc('0x37')]=_[_0x85cc('0x38')](_0x43920a[_0x85cc('0x37')],{'$or':_['map'](_0x43920a[_0x85cc('0x2f')],function(_0xfa6c00){var _0x450f7c={};_0x450f7c[_0xfa6c00]={'$like':'%'+_0x2e506e[_0x85cc('0x2c')][_0x85cc('0x36')]+'%'};return _0x450f7c;})});}_0x43920a=_[_0x85cc('0x38')]({},_0x43920a,_0x2e506e[_0x85cc('0x3a')]);return _0x3dad16[_0x85cc('0x45')](_0x43920a);}})[_0x85cc('0x20')](function(_0x360e71){if(_0x360e71){_0x449ae1=_0x360e71[_0x85cc('0x31')];if(!_0x2e506e['query'][_0x85cc('0x32')](_0x85cc('0x33'))){_0x43920a[_0x85cc('0x1a')]=qs[_0x85cc('0x1a')](_0x2e506e[_0x85cc('0x2c')][_0x85cc('0x1a')]);_0x43920a[_0x85cc('0x19')]=qs[_0x85cc('0x19')](_0x2e506e['query'][_0x85cc('0x19')]);}return _0x3dad16[_0x85cc('0x45')](_0x43920a);}})[_0x85cc('0x20')](function(_0x44f5f9){if(_0x44f5f9){return _0x44f5f9?{'count':_0x449ae1,'rows':_0x44f5f9}:null;}})[_0x85cc('0x20')](respondWithResult(_0x4428b9,null))[_0x85cc('0x3f')](handleError(_0x4428b9,null));};exports[_0x85cc('0x49')]=function(_0x7f9fa9,_0xb5fe,_0xe79d42){var _0x202b7d={};var _0x5613eb={};var _0x36ffb8;var _0x43d248;return db[_0x85cc('0x3c')][_0x85cc('0x46')]({'where':{'id':_0x7f9fa9[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0xb5fe,null))[_0x85cc('0x20')](function(_0x50188a){if(_0x50188a){_0x36ffb8=_0x50188a;_0x5613eb[_0x85cc('0x2a')]=_[_0x85cc('0x2b')](db['FreshdeskField'][_0x85cc('0x27')]);_0x5613eb[_0x85cc('0x2c')]=_['keys'](_0x7f9fa9[_0x85cc('0x2c')]);_0x5613eb['filters']=_[_0x85cc('0x2e')](_0x5613eb[_0x85cc('0x2a')],_0x5613eb[_0x85cc('0x2c')]);_0x202b7d[_0x85cc('0x2f')]=_['intersection'](_0x5613eb[_0x85cc('0x2a')],qs[_0x85cc('0x30')](_0x7f9fa9[_0x85cc('0x2c')][_0x85cc('0x30')]));_0x202b7d[_0x85cc('0x2f')]=_0x202b7d[_0x85cc('0x2f')][_0x85cc('0x31')]?_0x202b7d[_0x85cc('0x2f')]:_0x5613eb[_0x85cc('0x2a')];_0x202b7d['order']=qs[_0x85cc('0x34')](_0x7f9fa9[_0x85cc('0x2c')]['sort']);_0x202b7d[_0x85cc('0x37')]=qs[_0x85cc('0x2d')](_[_0x85cc('0x35')](_0x7f9fa9[_0x85cc('0x2c')],_0x5613eb[_0x85cc('0x2d')]));if(_0x7f9fa9[_0x85cc('0x2c')][_0x85cc('0x36')]){_0x202b7d[_0x85cc('0x37')]=_[_0x85cc('0x38')](_0x202b7d[_0x85cc('0x37')],{'$or':_[_0x85cc('0x26')](_0x202b7d[_0x85cc('0x2f')],function(_0x26384c){var _0x1f999a={};_0x1f999a[_0x26384c]={'$like':'%'+_0x7f9fa9[_0x85cc('0x2c')]['filter']+'%'};return _0x1f999a;})});}_0x202b7d=_[_0x85cc('0x38')]({},_0x202b7d,_0x7f9fa9['options']);return _0x36ffb8['getSubjects'](_0x202b7d);}})[_0x85cc('0x20')](function(_0x326fd4){if(_0x326fd4){_0x43d248=_0x326fd4[_0x85cc('0x31')];if(!_0x7f9fa9['query'][_0x85cc('0x32')](_0x85cc('0x33'))){_0x202b7d[_0x85cc('0x1a')]=qs[_0x85cc('0x1a')](_0x7f9fa9[_0x85cc('0x2c')][_0x85cc('0x1a')]);_0x202b7d[_0x85cc('0x19')]=qs[_0x85cc('0x19')](_0x7f9fa9[_0x85cc('0x2c')]['offset']);}return _0x36ffb8[_0x85cc('0x49')](_0x202b7d);}})[_0x85cc('0x20')](function(_0xb99493){if(_0xb99493){return _0xb99493?{'count':_0x43d248,'rows':_0xb99493}:null;}})['then'](respondWithResult(_0xb5fe,null))[_0x85cc('0x3f')](handleError(_0xb5fe,null));};exports[_0x85cc('0x4a')]=function(_0x4d9fcd,_0x5563ec,_0x6b0e66){var _0x19f9ec={};var _0x3c51ab={};var _0x3ed31a;var _0x445fbe;return db[_0x85cc('0x3c')]['findOne']({'where':{'id':_0x4d9fcd['params']['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0x5563ec,null))['then'](function(_0xd52996){if(_0xd52996){_0x3ed31a=_0xd52996;_0x3c51ab[_0x85cc('0x2a')]=_[_0x85cc('0x2b')](db[_0x85cc('0x47')][_0x85cc('0x27')]);_0x3c51ab[_0x85cc('0x2c')]=_[_0x85cc('0x2b')](_0x4d9fcd['query']);_0x3c51ab[_0x85cc('0x2d')]=_['intersection'](_0x3c51ab[_0x85cc('0x2a')],_0x3c51ab['query']);_0x19f9ec[_0x85cc('0x2f')]=_[_0x85cc('0x2e')](_0x3c51ab[_0x85cc('0x2a')],qs['fields'](_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x30')]));_0x19f9ec[_0x85cc('0x2f')]=_0x19f9ec[_0x85cc('0x2f')][_0x85cc('0x31')]?_0x19f9ec[_0x85cc('0x2f')]:_0x3c51ab[_0x85cc('0x2a')];_0x19f9ec[_0x85cc('0x48')]=qs['sort'](_0x4d9fcd['query'][_0x85cc('0x34')]);_0x19f9ec[_0x85cc('0x37')]=qs[_0x85cc('0x2d')](_[_0x85cc('0x35')](_0x4d9fcd[_0x85cc('0x2c')],_0x3c51ab[_0x85cc('0x2d')]));if(_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x36')]){_0x19f9ec['where']=_['merge'](_0x19f9ec['where'],{'$or':_[_0x85cc('0x26')](_0x19f9ec[_0x85cc('0x2f')],function(_0x561729){var _0x5e83c9={};_0x5e83c9[_0x561729]={'$like':'%'+_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x36')]+'%'};return _0x5e83c9;})});}_0x19f9ec=_[_0x85cc('0x38')]({},_0x19f9ec,_0x4d9fcd[_0x85cc('0x3a')]);return _0x3ed31a[_0x85cc('0x4a')](_0x19f9ec);}})[_0x85cc('0x20')](function(_0x3cd2de){if(_0x3cd2de){_0x445fbe=_0x3cd2de['length'];if(!_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x32')]('nolimit')){_0x19f9ec[_0x85cc('0x1a')]=qs[_0x85cc('0x1a')](_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x1a')]);_0x19f9ec['offset']=qs['offset'](_0x4d9fcd[_0x85cc('0x2c')][_0x85cc('0x19')]);}return _0x3ed31a['getDescriptions'](_0x19f9ec);}})[_0x85cc('0x20')](function(_0x5269b5){if(_0x5269b5){return _0x5269b5?{'count':_0x445fbe,'rows':_0x5269b5}:null;}})[_0x85cc('0x20')](respondWithResult(_0x5563ec,null))['catch'](handleError(_0x5563ec,null));};exports[_0x85cc('0x4b')]=function(_0x32ec9e,_0x53983e,_0x44ba2b){var _0x46beb2={};var _0xf441f={};var _0x49b3e8;var _0x144282;return db[_0x85cc('0x3c')][_0x85cc('0x46')]({'where':{'id':_0x32ec9e[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0x53983e,null))[_0x85cc('0x20')](function(_0x54fb3a){if(_0x54fb3a){_0x49b3e8=_0x54fb3a;_0xf441f[_0x85cc('0x2a')]=_[_0x85cc('0x2b')](db['Tag'][_0x85cc('0x27')]);_0xf441f[_0x85cc('0x2c')]=_[_0x85cc('0x2b')](_0x32ec9e[_0x85cc('0x2c')]);_0xf441f['filters']=_[_0x85cc('0x2e')](_0xf441f[_0x85cc('0x2a')],_0xf441f[_0x85cc('0x2c')]);_0x46beb2[_0x85cc('0x2f')]=_[_0x85cc('0x2e')](_0xf441f['model'],qs[_0x85cc('0x30')](_0x32ec9e[_0x85cc('0x2c')][_0x85cc('0x30')]));_0x46beb2[_0x85cc('0x2f')]=_0x46beb2[_0x85cc('0x2f')][_0x85cc('0x31')]?_0x46beb2[_0x85cc('0x2f')]:_0xf441f[_0x85cc('0x2a')];_0x46beb2[_0x85cc('0x48')]=qs[_0x85cc('0x34')](_0x32ec9e['query']['sort']);_0x46beb2[_0x85cc('0x37')]=qs[_0x85cc('0x2d')](_[_0x85cc('0x35')](_0x32ec9e['query'],_0xf441f['filters']));if(_0x32ec9e['query'][_0x85cc('0x36')]){_0x46beb2[_0x85cc('0x37')]=_[_0x85cc('0x38')](_0x46beb2['where'],{'$or':_[_0x85cc('0x26')](_0x46beb2['attributes'],function(_0x27ed40){var _0x212f7d={};_0x212f7d[_0x27ed40]={'$like':'%'+_0x32ec9e[_0x85cc('0x2c')]['filter']+'%'};return _0x212f7d;})});}_0x46beb2=_['merge']({},_0x46beb2,_0x32ec9e[_0x85cc('0x3a')]);return _0x49b3e8['getTags'](_0x46beb2);}})['then'](function(_0x19c8af){if(_0x19c8af){_0x144282=_0x19c8af[_0x85cc('0x31')];if(!_0x32ec9e[_0x85cc('0x2c')]['hasOwnProperty'](_0x85cc('0x33'))){_0x46beb2[_0x85cc('0x1a')]=qs['limit'](_0x32ec9e[_0x85cc('0x2c')][_0x85cc('0x1a')]);_0x46beb2[_0x85cc('0x19')]=qs['offset'](_0x32ec9e['query'][_0x85cc('0x19')]);}return _0x49b3e8[_0x85cc('0x4b')](_0x46beb2);}})['then'](function(_0x53bb74){if(_0x53bb74){return _0x53bb74?{'count':_0x144282,'rows':_0x53bb74}:null;}})[_0x85cc('0x20')](respondWithResult(_0x53983e,null))[_0x85cc('0x3f')](handleError(_0x53983e,null));};exports[_0x85cc('0x4c')]=function(_0x2658c0,_0x473187,_0x564248){if(_0x2658c0[_0x85cc('0x43')]['id']){delete _0x2658c0[_0x85cc('0x43')]['id'];}return db[_0x85cc('0x3c')]['findOne']({'where':{'id':_0x2658c0[_0x85cc('0x40')]['id']}})[_0x85cc('0x20')](handleEntityNotFound(_0x473187,null))[_0x85cc('0x20')](function(_0xa2e9a){if(_0xa2e9a){return _0xa2e9a[_0x85cc('0x4c')](_0x2658c0['body'][_0x85cc('0x4d')]||[]);}return null;})[_0x85cc('0x20')](respondWithResult(_0x473187,null))[_0x85cc('0x3f')](handleError(_0x473187,null));}; \ No newline at end of file +var _0x6d1d=['FreshdeskField','order','getFields','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','stack','name','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','merge','where','type','VIRTUAL','filter','FreshdeskConfiguration','includeAll','findAll','catch','show','params','rawAttributes','include','options','create','body','find','findOne'];(function(_0x584bfa,_0x15fccb){var _0x3b55a6=function(_0x299738){while(--_0x299738){_0x584bfa['push'](_0x584bfa['shift']());}};_0x3b55a6(++_0x15fccb);}(_0x6d1d,0xab));var _0xd6d1=function(_0x508028,_0x990267){_0x508028=_0x508028-0x0;var _0xa68b8d=_0x6d1d[_0x508028];return _0xa68b8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6d1('0x0'));var zipdir=require(_0xd6d1('0x1'));var jsonpatch=require(_0xd6d1('0x2'));var rp=require(_0xd6d1('0x3'));var moment=require(_0xd6d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6d1('0x5'));var util=require(_0xd6d1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd6d1('0x7'));var ejs=require(_0xd6d1('0x8'));var fs=require('fs');var fs_extra=require(_0xd6d1('0x9'));var _=require(_0xd6d1('0xa'));var squel=require(_0xd6d1('0xb'));var crypto=require(_0xd6d1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd6d1('0xd'));var toCsv=require(_0xd6d1('0x7'));var querystring=require(_0xd6d1('0xe'));var Papa=require(_0xd6d1('0xf'));var Redis=require(_0xd6d1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd6d1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6d1('0x12'));var logger=require(_0xd6d1('0x13'))(_0xd6d1('0x14'));var utils=require(_0xd6d1('0x15'));var config=require(_0xd6d1('0x16'));var licenseUtil=require(_0xd6d1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12611a,_0xca8bb4){_0xca8bb4=_0xca8bb4||0xcc;return function(_0x46c207){if(_0x46c207){return _0x12611a[_0xd6d1('0x18')](_0xca8bb4);}return _0x12611a['status'](_0xca8bb4)[_0xd6d1('0x19')]();};}function respondWithResult(_0x40d9b3,_0xe1db73){_0xe1db73=_0xe1db73||0xc8;return function(_0x457c56){if(_0x457c56){return _0x40d9b3[_0xd6d1('0x1a')](_0xe1db73)['json'](_0x457c56);}};}function respondWithFilteredResult(_0x3e740d,_0x160c48){return function(_0x1a05e7){if(_0x1a05e7){var _0x34b9b6=typeof _0x160c48[_0xd6d1('0x1b')]===_0xd6d1('0x1c')&&typeof _0x160c48[_0xd6d1('0x1d')]===_0xd6d1('0x1c');var _0x1e3be4=_0x1a05e7[_0xd6d1('0x1e')];var _0x3507cb=_0x34b9b6?0x0:_0x160c48[_0xd6d1('0x1b')];var _0x25ac7d=_0x34b9b6?_0x1a05e7[_0xd6d1('0x1e')]:_0x160c48[_0xd6d1('0x1b')]+_0x160c48[_0xd6d1('0x1d')];var _0x34a3c7;if(_0x25ac7d>=_0x1e3be4){_0x25ac7d=_0x1e3be4;_0x34a3c7=0xc8;}else{_0x34a3c7=0xce;}_0x3e740d[_0xd6d1('0x1a')](_0x34a3c7);return _0x3e740d[_0xd6d1('0x1f')](_0xd6d1('0x20'),_0x3507cb+'-'+_0x25ac7d+'/'+_0x1e3be4)[_0xd6d1('0x21')](_0x1a05e7);}return null;};}function patchUpdates(_0x2cc5ea){return function(_0xb3416b){try{jsonpatch[_0xd6d1('0x22')](_0xb3416b,_0x2cc5ea,!![]);}catch(_0xe9ca05){return BPromise['reject'](_0xe9ca05);}return _0xb3416b['save']();};}function saveUpdates(_0x14919b,_0x5f38d1){return function(_0x438a4f){if(_0x438a4f){return _0x438a4f[_0xd6d1('0x23')](_0x14919b)[_0xd6d1('0x24')](function(_0x36e9c8){return _0x36e9c8;});}return null;};}function removeEntity(_0x26d327,_0x32d702){return function(_0x51343e){if(_0x51343e){return _0x51343e[_0xd6d1('0x25')]()['then'](function(){_0x26d327['status'](0xcc)[_0xd6d1('0x19')]();});}};}function handleEntityNotFound(_0x54e202,_0x5c81c2){return function(_0x1d8f4c){if(!_0x1d8f4c){_0x54e202[_0xd6d1('0x18')](0x194);}return _0x1d8f4c;};}function handleError(_0x30accb,_0x10db3b){_0x10db3b=_0x10db3b||0x1f4;return function(_0xa6141){logger['error'](_0xa6141[_0xd6d1('0x26')]);if(_0xa6141[_0xd6d1('0x27')]){delete _0xa6141[_0xd6d1('0x27')];}_0x30accb['status'](_0x10db3b)['send'](_0xa6141);};}exports['index']=function(_0x40a31f,_0x22732e){var _0x2f08da={},_0x140d2a={},_0x59496d={'count':0x0,'rows':[]};var _0x3b2ada=_[_0xd6d1('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x477589){return{'name':_0x477589[_0xd6d1('0x29')],'type':_0x477589['type'][_0xd6d1('0x2a')]};});_0x140d2a[_0xd6d1('0x2b')]=_[_0xd6d1('0x28')](_0x3b2ada,_0xd6d1('0x27'));_0x140d2a[_0xd6d1('0x2c')]=_[_0xd6d1('0x2d')](_0x40a31f[_0xd6d1('0x2c')]);_0x140d2a[_0xd6d1('0x2e')]=_[_0xd6d1('0x2f')](_0x140d2a[_0xd6d1('0x2b')],_0x140d2a[_0xd6d1('0x2c')]);_0x2f08da[_0xd6d1('0x30')]=_[_0xd6d1('0x2f')](_0x140d2a[_0xd6d1('0x2b')],qs[_0xd6d1('0x31')](_0x40a31f[_0xd6d1('0x2c')]['fields']));_0x2f08da[_0xd6d1('0x30')]=_0x2f08da[_0xd6d1('0x30')][_0xd6d1('0x32')]?_0x2f08da[_0xd6d1('0x30')]:_0x140d2a['model'];if(!_0x40a31f[_0xd6d1('0x2c')]['hasOwnProperty'](_0xd6d1('0x33'))){_0x2f08da['limit']=qs[_0xd6d1('0x1d')](_0x40a31f[_0xd6d1('0x2c')][_0xd6d1('0x1d')]);_0x2f08da[_0xd6d1('0x1b')]=qs['offset'](_0x40a31f[_0xd6d1('0x2c')][_0xd6d1('0x1b')]);}_0x2f08da['order']=qs[_0xd6d1('0x34')](_0x40a31f[_0xd6d1('0x2c')][_0xd6d1('0x34')]);_0x2f08da['where']=qs[_0xd6d1('0x2e')](_[_0xd6d1('0x35')](_0x40a31f['query'],_0x140d2a['filters']),_0x3b2ada);if(_0x40a31f['query']['filter']){_0x2f08da['where']=_[_0xd6d1('0x36')](_0x2f08da[_0xd6d1('0x37')],{'$or':_[_0xd6d1('0x28')](_0x3b2ada,function(_0x55c046){if(_0x55c046[_0xd6d1('0x38')]!==_0xd6d1('0x39')){var _0xd0ba06={};_0xd0ba06[_0x55c046[_0xd6d1('0x27')]]={'$like':'%'+_0x40a31f[_0xd6d1('0x2c')][_0xd6d1('0x3a')]+'%'};return _0xd0ba06;}})});}_0x2f08da=_[_0xd6d1('0x36')]({},_0x2f08da,_0x40a31f['options']);var _0x5f0f22={'where':_0x2f08da[_0xd6d1('0x37')]};return db[_0xd6d1('0x3b')]['count'](_0x5f0f22)[_0xd6d1('0x24')](function(_0x1b32b0){_0x59496d['count']=_0x1b32b0;if(_0x40a31f[_0xd6d1('0x2c')][_0xd6d1('0x3c')]){_0x2f08da['include']=[{'all':!![]}];}return db[_0xd6d1('0x3b')][_0xd6d1('0x3d')](_0x2f08da);})[_0xd6d1('0x24')](function(_0x5e2ed4){_0x59496d['rows']=_0x5e2ed4;return _0x59496d;})[_0xd6d1('0x24')](respondWithFilteredResult(_0x22732e,_0x2f08da))[_0xd6d1('0x3e')](handleError(_0x22732e,null));};exports[_0xd6d1('0x3f')]=function(_0x48540c,_0x4ea4f2){var _0x2ce4f9={'raw':![],'where':{'id':_0x48540c[_0xd6d1('0x40')]['id']}},_0x318f75={};_0x318f75[_0xd6d1('0x2b')]=_[_0xd6d1('0x2d')](db[_0xd6d1('0x3b')][_0xd6d1('0x41')]);_0x318f75[_0xd6d1('0x2c')]=_[_0xd6d1('0x2d')](_0x48540c[_0xd6d1('0x2c')]);_0x318f75[_0xd6d1('0x2e')]=_[_0xd6d1('0x2f')](_0x318f75[_0xd6d1('0x2b')],_0x318f75[_0xd6d1('0x2c')]);_0x2ce4f9['attributes']=_['intersection'](_0x318f75[_0xd6d1('0x2b')],qs[_0xd6d1('0x31')](_0x48540c[_0xd6d1('0x2c')][_0xd6d1('0x31')]));_0x2ce4f9[_0xd6d1('0x30')]=_0x2ce4f9[_0xd6d1('0x30')]['length']?_0x2ce4f9['attributes']:_0x318f75[_0xd6d1('0x2b')];if(_0x48540c['query'][_0xd6d1('0x3c')]){_0x2ce4f9[_0xd6d1('0x42')]=[{'all':!![]}];}_0x2ce4f9=_[_0xd6d1('0x36')]({},_0x2ce4f9,_0x48540c[_0xd6d1('0x43')]);return db['FreshdeskConfiguration']['find'](_0x2ce4f9)['then'](handleEntityNotFound(_0x4ea4f2,null))['then'](respondWithResult(_0x4ea4f2,null))[_0xd6d1('0x3e')](handleError(_0x4ea4f2,null));};exports[_0xd6d1('0x44')]=function(_0x454b86,_0x1aaf84){return db[_0xd6d1('0x3b')][_0xd6d1('0x44')](_0x454b86[_0xd6d1('0x45')],{})['then'](respondWithResult(_0x1aaf84,0xc9))[_0xd6d1('0x3e')](handleError(_0x1aaf84,null));};exports[_0xd6d1('0x23')]=function(_0x23e224,_0x4fbbe6){if(_0x23e224[_0xd6d1('0x45')]['id']){delete _0x23e224['body']['id'];}return db[_0xd6d1('0x3b')][_0xd6d1('0x46')]({'where':{'id':_0x23e224[_0xd6d1('0x40')]['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x4fbbe6,null))[_0xd6d1('0x24')](saveUpdates(_0x23e224[_0xd6d1('0x45')],null))['then'](respondWithResult(_0x4fbbe6,null))['catch'](handleError(_0x4fbbe6,null));};exports[_0xd6d1('0x25')]=function(_0x4ffcfe,_0x530250){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4ffcfe['params']['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x530250,null))[_0xd6d1('0x24')](removeEntity(_0x530250,null))['catch'](handleError(_0x530250,null));};exports['getFields']=function(_0x21d76b,_0x445164,_0x524e5a){var _0x59b17c={};var _0x4f3703={};var _0x854f1e;var _0x1b8539;return db[_0xd6d1('0x3b')][_0xd6d1('0x47')]({'where':{'id':_0x21d76b['params']['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x445164,null))['then'](function(_0x137f26){if(_0x137f26){_0x854f1e=_0x137f26;_0x4f3703[_0xd6d1('0x2b')]=_[_0xd6d1('0x2d')](db[_0xd6d1('0x48')][_0xd6d1('0x41')]);_0x4f3703['query']=_[_0xd6d1('0x2d')](_0x21d76b[_0xd6d1('0x2c')]);_0x4f3703['filters']=_[_0xd6d1('0x2f')](_0x4f3703[_0xd6d1('0x2b')],_0x4f3703['query']);_0x59b17c['attributes']=_['intersection'](_0x4f3703[_0xd6d1('0x2b')],qs[_0xd6d1('0x31')](_0x21d76b[_0xd6d1('0x2c')][_0xd6d1('0x31')]));_0x59b17c[_0xd6d1('0x30')]=_0x59b17c[_0xd6d1('0x30')]['length']?_0x59b17c[_0xd6d1('0x30')]:_0x4f3703[_0xd6d1('0x2b')];_0x59b17c[_0xd6d1('0x49')]=qs[_0xd6d1('0x34')](_0x21d76b[_0xd6d1('0x2c')][_0xd6d1('0x34')]);_0x59b17c[_0xd6d1('0x37')]=qs['filters'](_[_0xd6d1('0x35')](_0x21d76b[_0xd6d1('0x2c')],_0x4f3703['filters']));if(_0x21d76b[_0xd6d1('0x2c')][_0xd6d1('0x3a')]){_0x59b17c['where']=_[_0xd6d1('0x36')](_0x59b17c[_0xd6d1('0x37')],{'$or':_[_0xd6d1('0x28')](_0x59b17c[_0xd6d1('0x30')],function(_0x1d979b){var _0x3fec92={};_0x3fec92[_0x1d979b]={'$like':'%'+_0x21d76b['query'][_0xd6d1('0x3a')]+'%'};return _0x3fec92;})});}_0x59b17c=_['merge']({},_0x59b17c,_0x21d76b[_0xd6d1('0x43')]);return _0x854f1e[_0xd6d1('0x4a')](_0x59b17c);}})[_0xd6d1('0x24')](function(_0x3fcabb){if(_0x3fcabb){_0x1b8539=_0x3fcabb['length'];if(!_0x21d76b['query']['hasOwnProperty'](_0xd6d1('0x33'))){_0x59b17c[_0xd6d1('0x1d')]=qs[_0xd6d1('0x1d')](_0x21d76b[_0xd6d1('0x2c')][_0xd6d1('0x1d')]);_0x59b17c[_0xd6d1('0x1b')]=qs['offset'](_0x21d76b[_0xd6d1('0x2c')][_0xd6d1('0x1b')]);}return _0x854f1e[_0xd6d1('0x4a')](_0x59b17c);}})['then'](function(_0x3f1366){if(_0x3f1366){return _0x3f1366?{'count':_0x1b8539,'rows':_0x3f1366}:null;}})[_0xd6d1('0x24')](respondWithResult(_0x445164,null))['catch'](handleError(_0x445164,null));};exports[_0xd6d1('0x4b')]=function(_0x5e1f97,_0x13ceab,_0x281a7d){var _0x5747bc={};var _0x1f6112={};var _0x144350;var _0x3bf6fa;return db['FreshdeskConfiguration'][_0xd6d1('0x47')]({'where':{'id':_0x5e1f97[_0xd6d1('0x40')]['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x13ceab,null))[_0xd6d1('0x24')](function(_0x32534d){if(_0x32534d){_0x144350=_0x32534d;_0x1f6112['model']=_['keys'](db[_0xd6d1('0x48')][_0xd6d1('0x41')]);_0x1f6112['query']=_[_0xd6d1('0x2d')](_0x5e1f97[_0xd6d1('0x2c')]);_0x1f6112[_0xd6d1('0x2e')]=_[_0xd6d1('0x2f')](_0x1f6112['model'],_0x1f6112[_0xd6d1('0x2c')]);_0x5747bc['attributes']=_['intersection'](_0x1f6112[_0xd6d1('0x2b')],qs[_0xd6d1('0x31')](_0x5e1f97['query'][_0xd6d1('0x31')]));_0x5747bc[_0xd6d1('0x30')]=_0x5747bc[_0xd6d1('0x30')][_0xd6d1('0x32')]?_0x5747bc[_0xd6d1('0x30')]:_0x1f6112['model'];_0x5747bc[_0xd6d1('0x49')]=qs[_0xd6d1('0x34')](_0x5e1f97[_0xd6d1('0x2c')][_0xd6d1('0x34')]);_0x5747bc[_0xd6d1('0x37')]=qs['filters'](_[_0xd6d1('0x35')](_0x5e1f97['query'],_0x1f6112['filters']));if(_0x5e1f97[_0xd6d1('0x2c')]['filter']){_0x5747bc[_0xd6d1('0x37')]=_['merge'](_0x5747bc[_0xd6d1('0x37')],{'$or':_[_0xd6d1('0x28')](_0x5747bc[_0xd6d1('0x30')],function(_0x3a84d1){var _0x541fea={};_0x541fea[_0x3a84d1]={'$like':'%'+_0x5e1f97[_0xd6d1('0x2c')][_0xd6d1('0x3a')]+'%'};return _0x541fea;})});}_0x5747bc=_[_0xd6d1('0x36')]({},_0x5747bc,_0x5e1f97[_0xd6d1('0x43')]);return _0x144350[_0xd6d1('0x4b')](_0x5747bc);}})[_0xd6d1('0x24')](function(_0x2e44f1){if(_0x2e44f1){_0x3bf6fa=_0x2e44f1['length'];if(!_0x5e1f97[_0xd6d1('0x2c')]['hasOwnProperty'](_0xd6d1('0x33'))){_0x5747bc[_0xd6d1('0x1d')]=qs[_0xd6d1('0x1d')](_0x5e1f97[_0xd6d1('0x2c')]['limit']);_0x5747bc[_0xd6d1('0x1b')]=qs[_0xd6d1('0x1b')](_0x5e1f97['query']['offset']);}return _0x144350['getSubjects'](_0x5747bc);}})[_0xd6d1('0x24')](function(_0x56c080){if(_0x56c080){return _0x56c080?{'count':_0x3bf6fa,'rows':_0x56c080}:null;}})[_0xd6d1('0x24')](respondWithResult(_0x13ceab,null))['catch'](handleError(_0x13ceab,null));};exports['getDescriptions']=function(_0xc60529,_0x1de1bc,_0x31239f){var _0x2cf076={};var _0x3fa6ad={};var _0x5c7d0d;var _0x541ea1;return db[_0xd6d1('0x3b')]['findOne']({'where':{'id':_0xc60529['params']['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x1de1bc,null))[_0xd6d1('0x24')](function(_0xe69af8){if(_0xe69af8){_0x5c7d0d=_0xe69af8;_0x3fa6ad[_0xd6d1('0x2b')]=_['keys'](db[_0xd6d1('0x48')][_0xd6d1('0x41')]);_0x3fa6ad[_0xd6d1('0x2c')]=_[_0xd6d1('0x2d')](_0xc60529[_0xd6d1('0x2c')]);_0x3fa6ad[_0xd6d1('0x2e')]=_['intersection'](_0x3fa6ad['model'],_0x3fa6ad[_0xd6d1('0x2c')]);_0x2cf076[_0xd6d1('0x30')]=_['intersection'](_0x3fa6ad['model'],qs[_0xd6d1('0x31')](_0xc60529[_0xd6d1('0x2c')][_0xd6d1('0x31')]));_0x2cf076['attributes']=_0x2cf076['attributes'][_0xd6d1('0x32')]?_0x2cf076[_0xd6d1('0x30')]:_0x3fa6ad[_0xd6d1('0x2b')];_0x2cf076['order']=qs[_0xd6d1('0x34')](_0xc60529['query']['sort']);_0x2cf076[_0xd6d1('0x37')]=qs[_0xd6d1('0x2e')](_[_0xd6d1('0x35')](_0xc60529[_0xd6d1('0x2c')],_0x3fa6ad[_0xd6d1('0x2e')]));if(_0xc60529['query']['filter']){_0x2cf076[_0xd6d1('0x37')]=_[_0xd6d1('0x36')](_0x2cf076[_0xd6d1('0x37')],{'$or':_['map'](_0x2cf076['attributes'],function(_0x17d09e){var _0x3d57ad={};_0x3d57ad[_0x17d09e]={'$like':'%'+_0xc60529[_0xd6d1('0x2c')]['filter']+'%'};return _0x3d57ad;})});}_0x2cf076=_[_0xd6d1('0x36')]({},_0x2cf076,_0xc60529[_0xd6d1('0x43')]);return _0x5c7d0d[_0xd6d1('0x4c')](_0x2cf076);}})[_0xd6d1('0x24')](function(_0x9bb313){if(_0x9bb313){_0x541ea1=_0x9bb313[_0xd6d1('0x32')];if(!_0xc60529['query'][_0xd6d1('0x4d')](_0xd6d1('0x33'))){_0x2cf076[_0xd6d1('0x1d')]=qs[_0xd6d1('0x1d')](_0xc60529['query'][_0xd6d1('0x1d')]);_0x2cf076['offset']=qs[_0xd6d1('0x1b')](_0xc60529[_0xd6d1('0x2c')][_0xd6d1('0x1b')]);}return _0x5c7d0d['getDescriptions'](_0x2cf076);}})['then'](function(_0xdcb698){if(_0xdcb698){return _0xdcb698?{'count':_0x541ea1,'rows':_0xdcb698}:null;}})[_0xd6d1('0x24')](respondWithResult(_0x1de1bc,null))['catch'](handleError(_0x1de1bc,null));};exports[_0xd6d1('0x4e')]=function(_0x354b15,_0x16a71e,_0x295060){var _0x5290ed={};var _0x55e289={};var _0x10b04e;var _0x1de6ab;return db[_0xd6d1('0x3b')][_0xd6d1('0x47')]({'where':{'id':_0x354b15[_0xd6d1('0x40')]['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0x16a71e,null))[_0xd6d1('0x24')](function(_0x53980c){if(_0x53980c){_0x10b04e=_0x53980c;_0x55e289[_0xd6d1('0x2b')]=_[_0xd6d1('0x2d')](db[_0xd6d1('0x4f')][_0xd6d1('0x41')]);_0x55e289[_0xd6d1('0x2c')]=_[_0xd6d1('0x2d')](_0x354b15[_0xd6d1('0x2c')]);_0x55e289[_0xd6d1('0x2e')]=_[_0xd6d1('0x2f')](_0x55e289[_0xd6d1('0x2b')],_0x55e289['query']);_0x5290ed[_0xd6d1('0x30')]=_[_0xd6d1('0x2f')](_0x55e289[_0xd6d1('0x2b')],qs[_0xd6d1('0x31')](_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x31')]));_0x5290ed[_0xd6d1('0x30')]=_0x5290ed[_0xd6d1('0x30')][_0xd6d1('0x32')]?_0x5290ed[_0xd6d1('0x30')]:_0x55e289['model'];_0x5290ed[_0xd6d1('0x49')]=qs['sort'](_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x34')]);_0x5290ed[_0xd6d1('0x37')]=qs[_0xd6d1('0x2e')](_[_0xd6d1('0x35')](_0x354b15[_0xd6d1('0x2c')],_0x55e289[_0xd6d1('0x2e')]));if(_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x3a')]){_0x5290ed['where']=_['merge'](_0x5290ed[_0xd6d1('0x37')],{'$or':_[_0xd6d1('0x28')](_0x5290ed[_0xd6d1('0x30')],function(_0x10f277){var _0x4952a8={};_0x4952a8[_0x10f277]={'$like':'%'+_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x3a')]+'%'};return _0x4952a8;})});}_0x5290ed=_['merge']({},_0x5290ed,_0x354b15[_0xd6d1('0x43')]);return _0x10b04e[_0xd6d1('0x4e')](_0x5290ed);}})[_0xd6d1('0x24')](function(_0x57ba3c){if(_0x57ba3c){_0x1de6ab=_0x57ba3c[_0xd6d1('0x32')];if(!_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x4d')]('nolimit')){_0x5290ed[_0xd6d1('0x1d')]=qs[_0xd6d1('0x1d')](_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x1d')]);_0x5290ed[_0xd6d1('0x1b')]=qs[_0xd6d1('0x1b')](_0x354b15[_0xd6d1('0x2c')][_0xd6d1('0x1b')]);}return _0x10b04e['getTags'](_0x5290ed);}})[_0xd6d1('0x24')](function(_0x3ac2ab){if(_0x3ac2ab){return _0x3ac2ab?{'count':_0x1de6ab,'rows':_0x3ac2ab}:null;}})[_0xd6d1('0x24')](respondWithResult(_0x16a71e,null))[_0xd6d1('0x3e')](handleError(_0x16a71e,null));};exports[_0xd6d1('0x50')]=function(_0x46bc4f,_0xd8bb80,_0x4badaf){if(_0x46bc4f[_0xd6d1('0x45')]['id']){delete _0x46bc4f['body']['id'];}return db[_0xd6d1('0x3b')][_0xd6d1('0x47')]({'where':{'id':_0x46bc4f['params']['id']}})[_0xd6d1('0x24')](handleEntityNotFound(_0xd8bb80,null))[_0xd6d1('0x24')](function(_0x29b29c){if(_0x29b29c){return _0x29b29c[_0xd6d1('0x50')](_0x46bc4f['body']['ids']||[]);}return null;})[_0xd6d1('0x24')](respondWithResult(_0xd8bb80,null))['catch'](handleError(_0xd8bb80,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0528153..dba910e 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 _0xf8af=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0xf8af,0x1a8));var _0xff8a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf8af[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xff8a('0x0'));var util=require(_0xff8a('0x1'));var logger=require(_0xff8a('0x2'))(_0xff8a('0x3'));var moment=require(_0xff8a('0x4'));var BPromise=require(_0xff8a('0x5'));var rp=require(_0xff8a('0x6'));var fs=require('fs');var path=require(_0xff8a('0x7'));var rimraf=require(_0xff8a('0x8'));var config=require('../../config/environment');var attributes=require(_0xff8a('0x9'));module['exports']=function(_0x5f376e,_0x18c76d){return _0x5f376e[_0xff8a('0xa')](_0xff8a('0xb'),attributes,{'tableName':_0xff8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c78=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports'];(function(_0x21fc78,_0x1099a8){var _0x5a0222=function(_0x9743d0){while(--_0x9743d0){_0x21fc78['push'](_0x21fc78['shift']());}};_0x5a0222(++_0x1099a8);}(_0x3c78,0x14c));var _0x83c7=function(_0x11a0b0,_0x13077c){_0x11a0b0=_0x11a0b0-0x0;var _0x1382e6=_0x3c78[_0x11a0b0];return _0x1382e6;};'use strict';var _=require(_0x83c7('0x0'));var util=require(_0x83c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x83c7('0x2'));var BPromise=require('bluebird');var rp=require(_0x83c7('0x3'));var fs=require('fs');var path=require(_0x83c7('0x4'));var rimraf=require(_0x83c7('0x5'));var config=require('../../config/environment');var attributes=require(_0x83c7('0x6'));module[_0x83c7('0x7')]=function(_0x440abf,_0x40272a){return _0x440abf['define'](_0x83c7('0x8'),attributes,{'tableName':_0x83c7('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 0603bb6..1f58110 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 _0x8d9a=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info'];(function(_0x115e75,_0x5cebbc){var _0x2ebea8=function(_0x1e168f){while(--_0x1e168f){_0x115e75['push'](_0x115e75['shift']());}};_0x2ebea8(++_0x5cebbc);}(_0x8d9a,0x1b2));var _0xa8d9=function(_0x50c62c,_0x11e514){_0x50c62c=_0x50c62c-0x0;var _0x2f8210=_0x8d9a[_0x50c62c];return _0x2f8210;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8d9('0x0'));var fs=require('fs');var Redis=require(_0xa8d9('0x1'));var db=require(_0xa8d9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8d9('0x3'))(_0xa8d9('0x4'));var config=require('../../config/environment');var jayson=require(_0xa8d9('0x5'));var client=jayson['client'][_0xa8d9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4d06db,_0x5c5464,_0x3eb679){return new BPromise(function(_0x4d2261,_0x4421fc){return client['request'](_0x4d06db,_0x3eb679)['then'](function(_0x48214f){logger[_0xa8d9('0x7')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c5464,_0xa8d9('0x8'));logger[_0xa8d9('0x9')](_0xa8d9('0xa'),_0x5c5464,_0xa8d9('0x8'),JSON[_0xa8d9('0xb')](_0x48214f));if(_0x48214f[_0xa8d9('0xc')]){if(_0x48214f[_0xa8d9('0xc')][_0xa8d9('0xd')]===0x1f4){logger[_0xa8d9('0xc')](_0xa8d9('0xe'),_0x5c5464,_0x48214f['error'][_0xa8d9('0xf')]);return _0x4421fc(_0x48214f['error'][_0xa8d9('0xf')]);}logger[_0xa8d9('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c5464,_0x48214f[_0xa8d9('0xc')][_0xa8d9('0xf')]);return _0x4d2261(_0x48214f['error'][_0xa8d9('0xf')]);}else{logger['info'](_0xa8d9('0xe'),_0x5c5464,_0xa8d9('0x8'));_0x4d2261(_0x48214f[_0xa8d9('0x10')]['message']);}})['catch'](function(_0x4cb366){logger[_0xa8d9('0xc')](_0xa8d9('0xe'),_0x5c5464,_0x4cb366);_0x4421fc(_0x4cb366);});});} \ No newline at end of file +var _0x81df=['client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0x81df,0xb3));var _0xf81d=function(_0x22311a,_0x49fcec){_0x22311a=_0x22311a-0x0;var _0x2576d8=_0x81df[_0x22311a];return _0x2576d8;};'use strict';var _=require(_0xf81d('0x0'));var util=require(_0xf81d('0x1'));var moment=require(_0xf81d('0x2'));var BPromise=require(_0xf81d('0x3'));var rs=require(_0xf81d('0x4'));var fs=require('fs');var Redis=require(_0xf81d('0x5'));var db=require(_0xf81d('0x6'))['db'];var utils=require(_0xf81d('0x7'));var logger=require(_0xf81d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf81d('0x9'));var client=jayson[_0xf81d('0xa')][_0xf81d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ab464,_0x1f50b9,_0x519b67){return new BPromise(function(_0x5d817b,_0x25beab){return client['request'](_0x4ab464,_0x519b67)['then'](function(_0x417c30){logger[_0xf81d('0xc')](_0xf81d('0xd'),_0x1f50b9,_0xf81d('0xe'));logger[_0xf81d('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1f50b9,_0xf81d('0xe'),JSON['stringify'](_0x417c30));if(_0x417c30[_0xf81d('0x10')]){if(_0x417c30['error'][_0xf81d('0x11')]===0x1f4){logger[_0xf81d('0x10')](_0xf81d('0xd'),_0x1f50b9,_0x417c30['error']['message']);return _0x25beab(_0x417c30[_0xf81d('0x10')][_0xf81d('0x12')]);}logger[_0xf81d('0x10')](_0xf81d('0xd'),_0x1f50b9,_0x417c30[_0xf81d('0x10')][_0xf81d('0x12')]);return _0x5d817b(_0x417c30['error'][_0xf81d('0x12')]);}else{logger['info'](_0xf81d('0xd'),_0x1f50b9,_0xf81d('0xe'));_0x5d817b(_0x417c30[_0xf81d('0x13')][_0xf81d('0x12')]);}})[_0xf81d('0x14')](function(_0xb2481e){logger['error'](_0xf81d('0xd'),_0x1f50b9,_0xb2481e);_0x25beab(_0xb2481e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e8d2210..3dd882d 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 _0xfa5c=['post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show'];(function(_0x340b68,_0x2abe14){var _0x4009f8=function(_0x344917){while(--_0x344917){_0x340b68['push'](_0x340b68['shift']());}};_0x4009f8(++_0x2abe14);}(_0xfa5c,0x191));var _0xcfa5=function(_0x5dfd33,_0x5414bd){_0x5dfd33=_0x5dfd33-0x0;var _0x2234c0=_0xfa5c[_0x5dfd33];return _0x2234c0;};'use strict';var multer=require('multer');var util=require(_0xcfa5('0x0'));var path=require(_0xcfa5('0x1'));var timeout=require(_0xcfa5('0x2'));var express=require(_0xcfa5('0x3'));var router=express[_0xcfa5('0x4')]();var fs_extra=require(_0xcfa5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcfa5('0x6'));var config=require(_0xcfa5('0x7'));var controller=require(_0xcfa5('0x8'));router[_0xcfa5('0x9')]('/',auth[_0xcfa5('0xa')](),controller['index']);router[_0xcfa5('0x9')](_0xcfa5('0xb'),auth[_0xcfa5('0xa')](),controller[_0xcfa5('0xc')]);router[_0xcfa5('0xd')]('/',auth[_0xcfa5('0xa')](),controller[_0xcfa5('0xe')]);router[_0xcfa5('0xf')](_0xcfa5('0xb'),auth[_0xcfa5('0xa')](),controller[_0xcfa5('0x10')]);router[_0xcfa5('0x11')](_0xcfa5('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x257b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x257b,0xa9));var _0xb257=function(_0x13d09f,_0x4f9002){_0x13d09f=_0x13d09f-0x0;var _0x5df055=_0x257b[_0x13d09f];return _0x5df055;};'use strict';var multer=require(_0xb257('0x0'));var util=require('util');var path=require(_0xb257('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb257('0x2')]();var fs_extra=require(_0xb257('0x3'));var auth=require(_0xb257('0x4'));var interaction=require(_0xb257('0x5'));var config=require(_0xb257('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xb257('0x7')]('/',auth[_0xb257('0x8')](),controller[_0xb257('0x9')]);router['get'](_0xb257('0xa'),auth[_0xb257('0x8')](),controller[_0xb257('0xb')]);router[_0xb257('0xc')]('/',auth[_0xb257('0x8')](),controller['create']);router[_0xb257('0xd')](_0xb257('0xa'),auth[_0xb257('0x8')](),controller[_0xb257('0xe')]);router[_0xb257('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb257('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ba9e61a..780f98c 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 _0x11d1=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x27797e,_0x1116a6){var _0x351d86=function(_0x46d519){while(--_0x46d519){_0x27797e['push'](_0x27797e['shift']());}};_0x351d86(++_0x1116a6);}(_0x11d1,0x1f4));var _0x111d=function(_0x4821d9,_0xf7e673){_0x4821d9=_0x4821d9-0x0;var _0x16ed37=_0x11d1[_0x4821d9];return _0x16ed37;};'use strict';var Sequelize=require(_0x111d('0x0'));module[_0x111d('0x1')]={'type':{'type':Sequelize[_0x111d('0x2')](_0x111d('0x3'),_0x111d('0x4'),_0x111d('0x5'),_0x111d('0x6'),'picklist'),'defaultValue':_0x111d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x111d('0x7')]},'keyType':{'type':Sequelize[_0x111d('0x2')](_0x111d('0x3'),_0x111d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x111d('0x7')]},'idField':{'type':Sequelize[_0x111d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x111d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c22=['exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x51daa1,_0x34dfa7){var _0x218bbb=function(_0x40b05b){while(--_0x40b05b){_0x51daa1['push'](_0x51daa1['shift']());}};_0x218bbb(++_0x34dfa7);}(_0x0c22,0x12b));var _0x20c2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0c22[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x20c2('0x0'));module[_0x20c2('0x1')]={'type':{'type':Sequelize[_0x20c2('0x2')](_0x20c2('0x3'),'variable','customVariable',_0x20c2('0x4'),_0x20c2('0x5')),'defaultValue':_0x20c2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x20c2('0x6')]},'keyType':{'type':Sequelize[_0x20c2('0x2')](_0x20c2('0x3'),_0x20c2('0x7'),_0x20c2('0x8'))},'keyContent':{'type':Sequelize[_0x20c2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x20c2('0x6')]},'customField':{'type':Sequelize[_0x20c2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20c2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 381d04d..769ce86 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 _0x49e9=['status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['FreshdeskField'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));}; \ No newline at end of file +var _0x97c1=['params','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskField','includeAll','include','rows','catch'];(function(_0x2c1767,_0x540dd9){var _0x923631=function(_0x17bc16){while(--_0x17bc16){_0x2c1767['push'](_0x2c1767['shift']());}};_0x923631(++_0x540dd9);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x2911dd,_0x2b6319){return function(_0x499051){if(!_0x499051){_0x2911dd[_0x197c('0x26')](0x194);}return _0x499051;};}function handleError(_0x3331ac,_0x4c3337){_0x4c3337=_0x4c3337||0x1f4;return function(_0x5e7bc9){logger[_0x197c('0x27')](_0x5e7bc9['stack']);if(_0x5e7bc9[_0x197c('0x28')]){delete _0x5e7bc9[_0x197c('0x28')];}_0x3331ac[_0x197c('0x17')](_0x4c3337)[_0x197c('0x29')](_0x5e7bc9);};}exports[_0x197c('0x2a')]=function(_0x3cdcd8,_0x2b6154){var _0x215df1={},_0x4422d1={},_0x5df39e={'count':0x0,'rows':[]};var _0x50dea3=_['map'](db['FreshdeskField'][_0x197c('0x2b')],function(_0x4c9256){return{'name':_0x4c9256[_0x197c('0x2c')],'type':_0x4c9256[_0x197c('0x2d')]['key']};});_0x4422d1[_0x197c('0x2e')]=_['map'](_0x50dea3,_0x197c('0x28'));_0x4422d1[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3cdcd8[_0x197c('0x2f')]);_0x4422d1[_0x197c('0x31')]=_[_0x197c('0x32')](_0x4422d1[_0x197c('0x2e')],_0x4422d1[_0x197c('0x2f')]);_0x215df1[_0x197c('0x33')]=_['intersection'](_0x4422d1['model'],qs[_0x197c('0x34')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x34')]));_0x215df1[_0x197c('0x33')]=_0x215df1[_0x197c('0x33')][_0x197c('0x35')]?_0x215df1[_0x197c('0x33')]:_0x4422d1['model'];if(!_0x3cdcd8['query'][_0x197c('0x36')](_0x197c('0x37'))){_0x215df1['limit']=qs['limit'](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x1b')]);_0x215df1[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x19')]);}_0x215df1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x3cdcd8[_0x197c('0x2f')]['sort']);_0x215df1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x3cdcd8[_0x197c('0x2f')],_0x4422d1[_0x197c('0x31')]),_0x50dea3);if(_0x3cdcd8[_0x197c('0x2f')]['filter']){_0x215df1[_0x197c('0x3a')]=_[_0x197c('0x3c')](_0x215df1[_0x197c('0x3a')],{'$or':_['map'](_0x50dea3,function(_0x28ce19){if(_0x28ce19[_0x197c('0x2d')]!==_0x197c('0x3d')){var _0xdb64da={};_0xdb64da[_0x28ce19[_0x197c('0x28')]]={'$like':'%'+_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x3e')]+'%'};return _0xdb64da;}})});}_0x215df1=_[_0x197c('0x3c')]({},_0x215df1,_0x3cdcd8[_0x197c('0x3f')]);var _0x1dc01b={'where':_0x215df1['where']};return db[_0x197c('0x40')][_0x197c('0x1c')](_0x1dc01b)['then'](function(_0x4c715a){_0x5df39e[_0x197c('0x1c')]=_0x4c715a;if(_0x3cdcd8[_0x197c('0x2f')][_0x197c('0x41')]){_0x215df1[_0x197c('0x42')]=[{'all':!![]}];}return db[_0x197c('0x40')]['findAll'](_0x215df1);})[_0x197c('0x24')](function(_0x3efae){_0x5df39e[_0x197c('0x43')]=_0x3efae;return _0x5df39e;})[_0x197c('0x24')](respondWithFilteredResult(_0x2b6154,_0x215df1))[_0x197c('0x44')](handleError(_0x2b6154,null));};exports['show']=function(_0x3e21bd,_0x37bb94){var _0x6d7bda={'raw':!![],'where':{'id':_0x3e21bd[_0x197c('0x45')]['id']}},_0x197b27={};_0x197b27['model']=_[_0x197c('0x30')](db[_0x197c('0x40')][_0x197c('0x2b')]);_0x197b27[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x3e21bd[_0x197c('0x2f')]);_0x197b27[_0x197c('0x31')]=_[_0x197c('0x32')](_0x197b27[_0x197c('0x2e')],_0x197b27[_0x197c('0x2f')]);_0x6d7bda[_0x197c('0x33')]=_['intersection'](_0x197b27['model'],qs['fields'](_0x3e21bd['query'][_0x197c('0x34')]));_0x6d7bda[_0x197c('0x33')]=_0x6d7bda['attributes'][_0x197c('0x35')]?_0x6d7bda[_0x197c('0x33')]:_0x197b27['model'];if(_0x3e21bd[_0x197c('0x2f')][_0x197c('0x41')]){_0x6d7bda['include']=[{'all':!![]}];}_0x6d7bda=_[_0x197c('0x3c')]({},_0x6d7bda,_0x3e21bd[_0x197c('0x3f')]);return db['FreshdeskField'][_0x197c('0x46')](_0x6d7bda)[_0x197c('0x24')](handleEntityNotFound(_0x37bb94,null))[_0x197c('0x24')](respondWithResult(_0x37bb94,null))['catch'](handleError(_0x37bb94,null));};exports[_0x197c('0x47')]=function(_0x3f26df,_0x220909){return db[_0x197c('0x40')]['create'](_0x3f26df[_0x197c('0x48')],{})[_0x197c('0x24')](respondWithResult(_0x220909,0xc9))[_0x197c('0x44')](handleError(_0x220909,null));};exports['update']=function(_0x5994bf,_0x3a5089){if(_0x5994bf[_0x197c('0x48')]['id']){delete _0x5994bf[_0x197c('0x48')]['id'];}return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x5994bf[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a5089,null))[_0x197c('0x24')](saveUpdates(_0x5994bf['body'],null))[_0x197c('0x24')](respondWithResult(_0x3a5089,null))[_0x197c('0x44')](handleError(_0x3a5089,null));};exports[_0x197c('0x25')]=function(_0x9e8c6a,_0x34a211){return db[_0x197c('0x40')][_0x197c('0x46')]({'where':{'id':_0x9e8c6a[_0x197c('0x45')]['id']}})['then'](handleEntityNotFound(_0x34a211,null))[_0x197c('0x24')](removeEntity(_0x34a211,null))[_0x197c('0x44')](handleError(_0x34a211,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d10b30c..0ffa33e 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 _0x2029=['FieldId','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x19a044,_0x286f24){var _0x2489df=function(_0x4d71b2){while(--_0x4d71b2){_0x19a044['push'](_0x19a044['shift']());}};_0x2489df(++_0x286f24);}(_0x2029,0xb5));var _0x9202=function(_0x407238,_0x59f207){_0x407238=_0x407238-0x0;var _0x4e0a43=_0x2029[_0x407238];return _0x4e0a43;};'use strict';var _=require('lodash');var util=require(_0x9202('0x0'));var logger=require('../../config/logger')(_0x9202('0x1'));var moment=require(_0x9202('0x2'));var BPromise=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var fs=require('fs');var path=require(_0x9202('0x5'));var rimraf=require(_0x9202('0x6'));var config=require('../../config/environment');var attributes=require(_0x9202('0x7'));module[_0x9202('0x8')]=function(_0x5b92d1,_0x4f232f){return _0x5b92d1[_0x9202('0x9')](_0x9202('0xa'),attributes,{'tableName':_0x9202('0xb'),'paranoid':![],'indexes':[{'name':_0x9202('0xc'),'fields':[_0x9202('0xd'),_0x9202('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x214c=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x41a7b2,_0x348ccd){var _0x25f47e=function(_0x18795a){while(--_0x18795a){_0x41a7b2['push'](_0x41a7b2['shift']());}};_0x25f47e(++_0x348ccd);}(_0x214c,0x169));var _0xc214=function(_0x4d4339,_0x33e314){_0x4d4339=_0x4d4339-0x0;var _0x24b8d8=_0x214c[_0x4d4339];return _0x24b8d8;};'use strict';var _=require(_0xc214('0x0'));var util=require(_0xc214('0x1'));var logger=require(_0xc214('0x2'))('api');var moment=require(_0xc214('0x3'));var BPromise=require(_0xc214('0x4'));var rp=require(_0xc214('0x5'));var fs=require('fs');var path=require(_0xc214('0x6'));var rimraf=require(_0xc214('0x7'));var config=require(_0xc214('0x8'));var attributes=require(_0xc214('0x9'));module[_0xc214('0xa')]=function(_0x288788,_0xe75f77){return _0x288788[_0xc214('0xb')](_0xc214('0xc'),attributes,{'tableName':_0xc214('0xd'),'paranoid':![],'indexes':[{'name':_0xc214('0xe'),'fields':[_0xc214('0xf'),_0xc214('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 04708b3..9e7a27d 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 _0x27ff=['client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x18388a,_0x4fb88a){var _0x34ab79=function(_0x47b4fa){while(--_0x47b4fa){_0x18388a['push'](_0x18388a['shift']());}};_0x34ab79(++_0x4fb88a);}(_0x27ff,0x65));var _0xf27f=function(_0x59f0ff,_0x2b9d67){_0x59f0ff=_0x59f0ff-0x0;var _0x28e782=_0x27ff[_0x59f0ff];return _0x28e782;};'use strict';var _=require('lodash');var util=require(_0xf27f('0x0'));var moment=require(_0xf27f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf27f('0x2'));var fs=require('fs');var Redis=require(_0xf27f('0x3'));var db=require(_0xf27f('0x4'))['db'];var utils=require(_0xf27f('0x5'));var logger=require(_0xf27f('0x6'))(_0xf27f('0x7'));var config=require('../../config/environment');var jayson=require(_0xf27f('0x8'));var client=jayson[_0xf27f('0x9')][_0xf27f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1649b0,_0x46cf91,_0x6e4231){return new BPromise(function(_0x51cde7,_0xab7059){return client[_0xf27f('0xb')](_0x1649b0,_0x6e4231)[_0xf27f('0xc')](function(_0x204628){logger[_0xf27f('0xd')](_0xf27f('0xe'),_0x46cf91,_0xf27f('0xf'));logger['debug'](_0xf27f('0x10'),_0x46cf91,_0xf27f('0xf'),JSON[_0xf27f('0x11')](_0x204628));if(_0x204628['error']){if(_0x204628[_0xf27f('0x12')][_0xf27f('0x13')]===0x1f4){logger[_0xf27f('0x12')](_0xf27f('0xe'),_0x46cf91,_0x204628['error'][_0xf27f('0x14')]);return _0xab7059(_0x204628[_0xf27f('0x12')][_0xf27f('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x46cf91,_0x204628[_0xf27f('0x12')]['message']);return _0x51cde7(_0x204628['error'][_0xf27f('0x14')]);}else{logger[_0xf27f('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x46cf91,'request\x20sent');_0x51cde7(_0x204628[_0xf27f('0x15')]['message']);}})['catch'](function(_0x3f0e9d){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x46cf91,_0x3f0e9d);_0xab7059(_0x3f0e9d);});});} \ No newline at end of file +var _0xadcb=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x580aff,_0x27c5e2){var _0x399c58=function(_0x5dc2fd){while(--_0x5dc2fd){_0x580aff['push'](_0x580aff['shift']());}};_0x399c58(++_0x27c5e2);}(_0xadcb,0xc2));var _0xbadc=function(_0x572e2e,_0x3c9532){_0x572e2e=_0x572e2e-0x0;var _0x51a1ea=_0xadcb[_0x572e2e];return _0x51a1ea;};'use strict';var _=require(_0xbadc('0x0'));var util=require(_0xbadc('0x1'));var moment=require(_0xbadc('0x2'));var BPromise=require(_0xbadc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbadc('0x4'));var db=require(_0xbadc('0x5'))['db'];var utils=require(_0xbadc('0x6'));var logger=require(_0xbadc('0x7'))(_0xbadc('0x8'));var config=require('../../config/environment');var jayson=require(_0xbadc('0x9'));var client=jayson[_0xbadc('0xa')][_0xbadc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eafc1,_0x57df5a,_0x41148f){return new BPromise(function(_0x561362,_0x234c5e){return client['request'](_0x2eafc1,_0x41148f)[_0xbadc('0xc')](function(_0x389a82){logger[_0xbadc('0xd')](_0xbadc('0xe'),_0x57df5a,_0xbadc('0xf'));logger[_0xbadc('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x57df5a,_0xbadc('0xf'),JSON['stringify'](_0x389a82));if(_0x389a82['error']){if(_0x389a82['error']['code']===0x1f4){logger[_0xbadc('0x11')](_0xbadc('0xe'),_0x57df5a,_0x389a82[_0xbadc('0x11')][_0xbadc('0x12')]);return _0x234c5e(_0x389a82[_0xbadc('0x11')]['message']);}logger['error'](_0xbadc('0xe'),_0x57df5a,_0x389a82[_0xbadc('0x11')][_0xbadc('0x12')]);return _0x561362(_0x389a82[_0xbadc('0x11')]['message']);}else{logger['info'](_0xbadc('0xe'),_0x57df5a,'request\x20sent');_0x561362(_0x389a82[_0xbadc('0x13')][_0xbadc('0x12')]);}})['catch'](function(_0x1df346){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x57df5a,_0x1df346);_0x234c5e(_0x1df346);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e301f37..3788402 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xf8f6f1,_0x551483){var _0x51db61=function(_0x31f8af){while(--_0x31f8af){_0xf8f6f1['push'](_0xf8f6f1['shift']());}};_0x51db61(++_0x551483);}(_0x0fd9,0xa3));var _0x90fd=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x0fd9[_0x482214];return _0x38d0cb;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file +var _0xe5b5=['index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x4177f2,_0x270233){var _0x3ee7a6=function(_0x2c36e2){while(--_0x2c36e2){_0x4177f2['push'](_0x4177f2['shift']());}};_0x3ee7a6(++_0x270233);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe5b5[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/fields',auth[_0x5e5b('0xc')](),controller['getFields']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router[_0x5e5b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e5b('0x14')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller['destroy']);module[_0x5e5b('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 b0e1b07..d67d29d 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x3ac179,_0x2832d4){var _0x5565f1=function(_0x7695a1){while(--_0x7695a1){_0x3ac179['push'](_0x3ac179['shift']());}};_0x5565f1(++_0x2832d4);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4ffbee,_0x4b13f4){_0x4ffbee=_0x4ffbee-0x0;var _0x7ab7c7=_0xdd4f[_0x4ffbee];return _0x7ab7c7;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x496801,_0x1a6711){var _0x1eca67=function(_0xb14eb2){while(--_0xb14eb2){_0x496801['push'](_0x496801['shift']());}};_0x1eca67(++_0x1a6711);}(_0xd824,0xc2));var _0x4d82=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd824[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2bf0a72..b9e2bfe 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 _0x6745=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','findOne','FreshsalesConfiguration','filter','merge','options','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshsalesField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6745,0x198));var _0x5674=function(_0x16f099,_0x38de4d){_0x16f099=_0x16f099-0x0;var _0x5aa123=_0x6745[_0x16f099];return _0x5aa123;};'use strict';var emlformat=require(_0x5674('0x0'));var rimraf=require(_0x5674('0x1'));var zipdir=require(_0x5674('0x2'));var jsonpatch=require(_0x5674('0x3'));var rp=require(_0x5674('0x4'));var moment=require(_0x5674('0x5'));var BPromise=require(_0x5674('0x6'));var Mustache=require('mustache');var util=require(_0x5674('0x7'));var path=require(_0x5674('0x8'));var sox=require(_0x5674('0x9'));var csv=require(_0x5674('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5674('0xb'));var squel=require(_0x5674('0xc'));var crypto=require(_0x5674('0xd'));var jsforce=require(_0x5674('0xe'));var deskjs=require(_0x5674('0xf'));var toCsv=require(_0x5674('0xa'));var querystring=require(_0x5674('0x10'));var Papa=require(_0x5674('0x11'));var Redis=require('ioredis');var authService=require(_0x5674('0x12'));var qs=require(_0x5674('0x13'));var as=require(_0x5674('0x14'));var hardwareService=require(_0x5674('0x15'));var logger=require(_0x5674('0x16'))(_0x5674('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5674('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5674('0x19'));function respondWithStatusCode(_0x175b79,_0x3f79eb){_0x3f79eb=_0x3f79eb||0xcc;return function(_0x27a1d7){if(_0x27a1d7){return _0x175b79[_0x5674('0x1a')](_0x3f79eb);}return _0x175b79[_0x5674('0x1b')](_0x3f79eb)['end']();};}function respondWithResult(_0x26b9bb,_0x336950){_0x336950=_0x336950||0xc8;return function(_0x25b9ce){if(_0x25b9ce){return _0x26b9bb['status'](_0x336950)[_0x5674('0x1c')](_0x25b9ce);}};}function respondWithFilteredResult(_0x104d46,_0x25714e){return function(_0x48a427){if(_0x48a427){var _0x29d27a=typeof _0x25714e[_0x5674('0x1d')]===_0x5674('0x1e')&&typeof _0x25714e[_0x5674('0x1f')]===_0x5674('0x1e');var _0x4ce333=_0x48a427['count'];var _0x4c504c=_0x29d27a?0x0:_0x25714e['offset'];var _0x13f41d=_0x29d27a?_0x48a427[_0x5674('0x20')]:_0x25714e['offset']+_0x25714e[_0x5674('0x1f')];var _0x38ced2;if(_0x13f41d>=_0x4ce333){_0x13f41d=_0x4ce333;_0x38ced2=0xc8;}else{_0x38ced2=0xce;}_0x104d46[_0x5674('0x1b')](_0x38ced2);return _0x104d46['set'](_0x5674('0x21'),_0x4c504c+'-'+_0x13f41d+'/'+_0x4ce333)[_0x5674('0x1c')](_0x48a427);}return null;};}function patchUpdates(_0x3680cc){return function(_0x412859){try{jsonpatch['apply'](_0x412859,_0x3680cc,!![]);}catch(_0x32e0e9){return BPromise[_0x5674('0x22')](_0x32e0e9);}return _0x412859[_0x5674('0x23')]();};}function saveUpdates(_0x555a0c,_0x54cf08){return function(_0x3eef61){if(_0x3eef61){return _0x3eef61[_0x5674('0x24')](_0x555a0c)['then'](function(_0x8ba988){return _0x8ba988;});}return null;};}function removeEntity(_0x21e026,_0x210414){return function(_0x26bf27){if(_0x26bf27){return _0x26bf27[_0x5674('0x25')]()[_0x5674('0x26')](function(){_0x21e026[_0x5674('0x1b')](0xcc)[_0x5674('0x27')]();});}};}function handleEntityNotFound(_0x40b5fd,_0x554adf){return function(_0x48b0af){if(!_0x48b0af){_0x40b5fd[_0x5674('0x1a')](0x194);}return _0x48b0af;};}function handleError(_0x5253df,_0x535089){_0x535089=_0x535089||0x1f4;return function(_0x2437ff){logger[_0x5674('0x28')](_0x2437ff[_0x5674('0x29')]);if(_0x2437ff[_0x5674('0x2a')]){delete _0x2437ff['name'];}_0x5253df[_0x5674('0x1b')](_0x535089)[_0x5674('0x2b')](_0x2437ff);};}exports[_0x5674('0x2c')]=function(_0x4d6eb2,_0x83ee44){var _0x4500b3={},_0x33e58d={},_0x3429ee={'count':0x0,'rows':[]};var _0x5c50e3=_[_0x5674('0x2d')](db[_0x5674('0x2e')]['rawAttributes'],function(_0x418cea){return{'name':_0x418cea[_0x5674('0x2f')],'type':_0x418cea[_0x5674('0x30')][_0x5674('0x31')]};});_0x33e58d['model']=_[_0x5674('0x2d')](_0x5c50e3,_0x5674('0x2a'));_0x33e58d[_0x5674('0x32')]=_[_0x5674('0x33')](_0x4d6eb2[_0x5674('0x32')]);_0x33e58d['filters']=_[_0x5674('0x34')](_0x33e58d[_0x5674('0x35')],_0x33e58d[_0x5674('0x32')]);_0x4500b3['attributes']=_[_0x5674('0x34')](_0x33e58d[_0x5674('0x35')],qs[_0x5674('0x36')](_0x4d6eb2[_0x5674('0x32')][_0x5674('0x36')]));_0x4500b3[_0x5674('0x37')]=_0x4500b3['attributes'][_0x5674('0x38')]?_0x4500b3[_0x5674('0x37')]:_0x33e58d[_0x5674('0x35')];if(!_0x4d6eb2[_0x5674('0x32')][_0x5674('0x39')](_0x5674('0x3a'))){_0x4500b3[_0x5674('0x1f')]=qs[_0x5674('0x1f')](_0x4d6eb2[_0x5674('0x32')][_0x5674('0x1f')]);_0x4500b3['offset']=qs['offset'](_0x4d6eb2[_0x5674('0x32')]['offset']);}_0x4500b3[_0x5674('0x3b')]=qs[_0x5674('0x3c')](_0x4d6eb2['query'][_0x5674('0x3c')]);_0x4500b3['where']=qs[_0x5674('0x3d')](_[_0x5674('0x3e')](_0x4d6eb2['query'],_0x33e58d[_0x5674('0x3d')]),_0x5c50e3);if(_0x4d6eb2[_0x5674('0x32')]['filter']){_0x4500b3[_0x5674('0x3f')]=_['merge'](_0x4500b3['where'],{'$or':_[_0x5674('0x2d')](_0x5c50e3,function(_0x727f60){if(_0x727f60['type']!==_0x5674('0x40')){var _0xc5bb8c={};_0xc5bb8c[_0x727f60[_0x5674('0x2a')]]={'$like':'%'+_0x4d6eb2['query']['filter']+'%'};return _0xc5bb8c;}})});}_0x4500b3=_['merge']({},_0x4500b3,_0x4d6eb2['options']);var _0xd27b4c={'where':_0x4500b3['where']};return db[_0x5674('0x2e')][_0x5674('0x20')](_0xd27b4c)[_0x5674('0x26')](function(_0x3118ff){_0x3429ee[_0x5674('0x20')]=_0x3118ff;if(_0x4d6eb2[_0x5674('0x32')][_0x5674('0x41')]){_0x4500b3['include']=[{'all':!![]}];}return db[_0x5674('0x2e')][_0x5674('0x42')](_0x4500b3);})[_0x5674('0x26')](function(_0x4a789f){_0x3429ee[_0x5674('0x43')]=_0x4a789f;return _0x3429ee;})[_0x5674('0x26')](respondWithFilteredResult(_0x83ee44,_0x4500b3))[_0x5674('0x44')](handleError(_0x83ee44,null));};exports[_0x5674('0x45')]=function(_0x56bf82,_0x2f3e77){var _0x3b13b5={'raw':![],'where':{'id':_0x56bf82[_0x5674('0x46')]['id']}},_0x27ba3d={};_0x27ba3d[_0x5674('0x35')]=_['keys'](db['FreshsalesAccount'][_0x5674('0x47')]);_0x27ba3d[_0x5674('0x32')]=_[_0x5674('0x33')](_0x56bf82[_0x5674('0x32')]);_0x27ba3d[_0x5674('0x3d')]=_['intersection'](_0x27ba3d['model'],_0x27ba3d[_0x5674('0x32')]);_0x3b13b5[_0x5674('0x37')]=_[_0x5674('0x34')](_0x27ba3d[_0x5674('0x35')],qs[_0x5674('0x36')](_0x56bf82[_0x5674('0x32')][_0x5674('0x36')]));_0x3b13b5[_0x5674('0x37')]=_0x3b13b5[_0x5674('0x37')][_0x5674('0x38')]?_0x3b13b5['attributes']:_0x27ba3d[_0x5674('0x35')];if(_0x56bf82['query']['includeAll']){_0x3b13b5[_0x5674('0x48')]=[{'all':!![]}];}_0x3b13b5=_['merge']({},_0x3b13b5,_0x56bf82['options']);return db[_0x5674('0x2e')][_0x5674('0x49')](_0x3b13b5)[_0x5674('0x26')](handleEntityNotFound(_0x2f3e77,null))[_0x5674('0x26')](respondWithResult(_0x2f3e77,null))[_0x5674('0x44')](handleError(_0x2f3e77,null));};exports[_0x5674('0x4a')]=function(_0x1c8ab2,_0x4ae740){return db[_0x5674('0x2e')][_0x5674('0x4a')](_0x1c8ab2[_0x5674('0x4b')],{})[_0x5674('0x26')](respondWithResult(_0x4ae740,0xc9))['catch'](handleError(_0x4ae740,null));};exports[_0x5674('0x24')]=function(_0x233eff,_0x4d786f){if(_0x233eff[_0x5674('0x4b')]['id']){delete _0x233eff[_0x5674('0x4b')]['id'];}return db[_0x5674('0x2e')][_0x5674('0x49')]({'where':{'id':_0x233eff[_0x5674('0x46')]['id']}})[_0x5674('0x26')](handleEntityNotFound(_0x4d786f,null))[_0x5674('0x26')](saveUpdates(_0x233eff[_0x5674('0x4b')],null))['then'](respondWithResult(_0x4d786f,null))[_0x5674('0x44')](handleError(_0x4d786f,null));};exports[_0x5674('0x25')]=function(_0x460eec,_0x1e1487){return db[_0x5674('0x2e')]['find']({'where':{'id':_0x460eec[_0x5674('0x46')]['id']}})[_0x5674('0x26')](handleEntityNotFound(_0x1e1487,null))[_0x5674('0x26')](removeEntity(_0x1e1487,null))[_0x5674('0x44')](handleError(_0x1e1487,null));};exports['getConfigurations']=function(_0x307b70,_0x2b62e1,_0x3ce2f7){var _0xf74cca={};var _0x1e15b0={};var _0x3f20e4;var _0x3d7022;return db[_0x5674('0x2e')][_0x5674('0x4c')]({'where':{'id':_0x307b70[_0x5674('0x46')]['id']}})[_0x5674('0x26')](handleEntityNotFound(_0x2b62e1,null))[_0x5674('0x26')](function(_0x2aa60f){if(_0x2aa60f){_0x3f20e4=_0x2aa60f;_0x1e15b0[_0x5674('0x35')]=_[_0x5674('0x33')](db[_0x5674('0x4d')][_0x5674('0x47')]);_0x1e15b0[_0x5674('0x32')]=_[_0x5674('0x33')](_0x307b70[_0x5674('0x32')]);_0x1e15b0[_0x5674('0x3d')]=_[_0x5674('0x34')](_0x1e15b0[_0x5674('0x35')],_0x1e15b0[_0x5674('0x32')]);_0xf74cca['attributes']=_[_0x5674('0x34')](_0x1e15b0[_0x5674('0x35')],qs[_0x5674('0x36')](_0x307b70[_0x5674('0x32')][_0x5674('0x36')]));_0xf74cca[_0x5674('0x37')]=_0xf74cca[_0x5674('0x37')][_0x5674('0x38')]?_0xf74cca[_0x5674('0x37')]:_0x1e15b0[_0x5674('0x35')];_0xf74cca[_0x5674('0x3b')]=qs['sort'](_0x307b70['query']['sort']);_0xf74cca[_0x5674('0x3f')]=qs[_0x5674('0x3d')](_[_0x5674('0x3e')](_0x307b70['query'],_0x1e15b0[_0x5674('0x3d')]));if(_0x307b70[_0x5674('0x32')][_0x5674('0x4e')]){_0xf74cca[_0x5674('0x3f')]=_[_0x5674('0x4f')](_0xf74cca['where'],{'$or':_[_0x5674('0x2d')](_0xf74cca['attributes'],function(_0x4e9f63){var _0x1d0ef3={};_0x1d0ef3[_0x4e9f63]={'$like':'%'+_0x307b70[_0x5674('0x32')]['filter']+'%'};return _0x1d0ef3;})});}_0xf74cca=_[_0x5674('0x4f')]({},_0xf74cca,_0x307b70[_0x5674('0x50')]);return _0x3f20e4[_0x5674('0x51')](_0xf74cca);}})['then'](function(_0x528e78){if(_0x528e78){_0x3d7022=_0x528e78[_0x5674('0x38')];if(!_0x307b70['query'][_0x5674('0x39')](_0x5674('0x3a'))){_0xf74cca[_0x5674('0x1f')]=qs[_0x5674('0x1f')](_0x307b70[_0x5674('0x32')][_0x5674('0x1f')]);_0xf74cca[_0x5674('0x1d')]=qs[_0x5674('0x1d')](_0x307b70[_0x5674('0x32')][_0x5674('0x1d')]);}return _0x3f20e4['getConfigurations'](_0xf74cca);}})['then'](function(_0x463387){if(_0x463387){return _0x463387?{'count':_0x3d7022,'rows':_0x463387}:null;}})[_0x5674('0x26')](respondWithResult(_0x2b62e1,null))['catch'](handleError(_0x2b62e1,null));};exports[_0x5674('0x52')]=function(_0x2b7c14,_0x282d81,_0x5bcfd0){if(_0x2b7c14[_0x5674('0x4b')]['id']){delete _0x2b7c14[_0x5674('0x4b')]['id'];}return db['FreshsalesAccount'][_0x5674('0x4c')]({'where':{'id':_0x2b7c14[_0x5674('0x46')]['id']}})[_0x5674('0x26')](handleEntityNotFound(_0x282d81,null))[_0x5674('0x26')](function(_0xa31e66){if(_0xa31e66){_0x2b7c14['body'][_0x5674('0x53')]=_0xa31e66['id'];_0x2b7c14['body']['Subjects']=integrations[_0x5674('0x54')](_0x2b7c14[_0x5674('0x4b')]['channel'],_0x2b7c14[_0x5674('0x4b')][_0x5674('0x30')]);_0x2b7c14[_0x5674('0x4b')][_0x5674('0x55')]=integrations[_0x5674('0x56')](_0x2b7c14[_0x5674('0x4b')][_0x5674('0x57')],_0x2b7c14['body'][_0x5674('0x30')]);return db[_0x5674('0x4d')][_0x5674('0x4a')](_0x2b7c14[_0x5674('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':_0x5674('0x58')},{'model':db[_0x5674('0x59')],'as':_0x5674('0x55')}]});}return null;})[_0x5674('0x26')](respondWithResult(_0x282d81,null))[_0x5674('0x44')](handleError(_0x282d81,null));};exports[_0x5674('0x5a')]=function(_0x234e03,_0x2a4ff7,_0x482a78){var _0x33aab3='';var _0x33154c='';return db[_0x5674('0x2e')][_0x5674('0x4c')]({'where':{'id':_0x234e03['params']['id']},'attributes':['id','username','remoteUri',_0x5674('0x5b')]})[_0x5674('0x26')](handleEntityNotFound(_0x2a4ff7,null))[_0x5674('0x26')](function(_0x1c5bc2){if(_0x1c5bc2){_0x33154c=_0x1c5bc2['username'];_0x33aab3=_0x1c5bc2[_0x5674('0x5c')];var _0x2e4c50=_0x1c5bc2[_0x5674('0x5c')][_0x5674('0x5d')](-0x1);if(_0x2e4c50==='/'){_0x33aab3=_0x33aab3[_0x5674('0x5e')](0x0,_0x33aab3[_0x5674('0x5f')](_0x2e4c50));}return rp({'method':_0x5674('0x60'),'uri':util[_0x5674('0x61')](_0x5674('0x62'),_0x33aab3,_0x5674('0x63')),'headers':{'Authorization':_0x5674('0x64')+_0x1c5bc2[_0x5674('0x5b')]},'json':!![]});}})[_0x5674('0x26')](function(_0x5045e1){if(_0x5045e1){var _0x59dc80=_0x5045e1[_0x5674('0x65')];var _0x570e7c=![];var _0xf5f788=null;for(_0xf5f788=0x0;_0xf5f788<_0x59dc80['length'];_0xf5f788++){if(_0x59dc80[_0xf5f788][_0x5674('0x66')]===_0x33154c){_0x570e7c=!![];}}if(_0x570e7c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5674('0x26')](respondWithResult(_0x2a4ff7,null))[_0x5674('0x44')](function(_0x3fae75){var _0x316370=_0x234e03[_0x5674('0x32')][_0x5674('0x67')]?0x1f4:_0x3fae75[_0x5674('0x68')]||0x1f4;logger[_0x5674('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x5674('0x5a'),_0x316370,JSON[_0x5674('0x69')](_0x3fae75));delete _0x3fae75[_0x5674('0x2a')];if(_0x316370===0x191){_0x316370=0x190;}_0x2a4ff7[_0x5674('0x1b')](_0x316370)[_0x5674('0x2b')](_0x234e03[_0x5674('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3fae75[_0x5674('0x68')]}:_0x3fae75);});}; \ No newline at end of file +var _0x36b3=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','FreshsalesAccount','show','options','catch','create','body','find','params','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','getFields','findOne','apiKey','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit'];(function(_0x52c996,_0x47b29d){var _0x42d1a0=function(_0x1ebaa4){while(--_0x1ebaa4){_0x52c996['push'](_0x52c996['shift']());}};_0x42d1a0(++_0x47b29d);}(_0x36b3,0x1ba));var _0x336b=function(_0x220581,_0x3f77c4){_0x220581=_0x220581-0x0;var _0x24c887=_0x36b3[_0x220581];return _0x24c887;};'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(_0x336b('0x0'));var moment=require(_0x336b('0x1'));var BPromise=require(_0x336b('0x2'));var Mustache=require(_0x336b('0x3'));var util=require(_0x336b('0x4'));var path=require(_0x336b('0x5'));var sox=require(_0x336b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x336b('0x7'));var _=require('lodash');var squel=require(_0x336b('0x8'));var crypto=require('crypto');var jsforce=require(_0x336b('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x336b('0xa'));var Papa=require('papaparse');var Redis=require(_0x336b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x336b('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x336b('0xd'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x336b('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0x336b('0xf'))['db'];var integrations=require(_0x336b('0x10'));function respondWithStatusCode(_0x4f996e,_0x575981){_0x575981=_0x575981||0xcc;return function(_0x4e8a93){if(_0x4e8a93){return _0x4f996e[_0x336b('0x11')](_0x575981);}return _0x4f996e[_0x336b('0x12')](_0x575981)[_0x336b('0x13')]();};}function respondWithResult(_0xe3517c,_0x4c3c1c){_0x4c3c1c=_0x4c3c1c||0xc8;return function(_0x10a009){if(_0x10a009){return _0xe3517c[_0x336b('0x12')](_0x4c3c1c)['json'](_0x10a009);}};}function respondWithFilteredResult(_0x2f21a3,_0x14cc1e){return function(_0x518a0b){if(_0x518a0b){var _0x15a5d5=typeof _0x14cc1e[_0x336b('0x14')]===_0x336b('0x15')&&typeof _0x14cc1e[_0x336b('0x16')]==='undefined';var _0x37b001=_0x518a0b['count'];var _0x3eb724=_0x15a5d5?0x0:_0x14cc1e['offset'];var _0x3e427e=_0x15a5d5?_0x518a0b[_0x336b('0x17')]:_0x14cc1e[_0x336b('0x14')]+_0x14cc1e['limit'];var _0x5d5fea;if(_0x3e427e>=_0x37b001){_0x3e427e=_0x37b001;_0x5d5fea=0xc8;}else{_0x5d5fea=0xce;}_0x2f21a3[_0x336b('0x12')](_0x5d5fea);return _0x2f21a3[_0x336b('0x18')](_0x336b('0x19'),_0x3eb724+'-'+_0x3e427e+'/'+_0x37b001)['json'](_0x518a0b);}return null;};}function patchUpdates(_0xcabb89){return function(_0x4f4aeb){try{jsonpatch[_0x336b('0x1a')](_0x4f4aeb,_0xcabb89,!![]);}catch(_0x37473d){return BPromise[_0x336b('0x1b')](_0x37473d);}return _0x4f4aeb[_0x336b('0x1c')]();};}function saveUpdates(_0x355e1d,_0x39e824){return function(_0x30744e){if(_0x30744e){return _0x30744e[_0x336b('0x1d')](_0x355e1d)[_0x336b('0x1e')](function(_0x283e66){return _0x283e66;});}return null;};}function removeEntity(_0x507e21,_0x3185e8){return function(_0x3f33f3){if(_0x3f33f3){return _0x3f33f3[_0x336b('0x1f')]()[_0x336b('0x1e')](function(){_0x507e21['status'](0xcc)[_0x336b('0x13')]();});}};}function handleEntityNotFound(_0x4d511c,_0x11447e){return function(_0x388989){if(!_0x388989){_0x4d511c[_0x336b('0x11')](0x194);}return _0x388989;};}function handleError(_0xe8b921,_0x416ac4){_0x416ac4=_0x416ac4||0x1f4;return function(_0x57ab95){logger[_0x336b('0x20')](_0x57ab95[_0x336b('0x21')]);if(_0x57ab95[_0x336b('0x22')]){delete _0x57ab95[_0x336b('0x22')];}_0xe8b921[_0x336b('0x12')](_0x416ac4)[_0x336b('0x23')](_0x57ab95);};}exports[_0x336b('0x24')]=function(_0x399e45,_0x616590){var _0x3ae1ff={},_0x2e32e6={},_0x869e95={'count':0x0,'rows':[]};var _0x3cb463=_[_0x336b('0x25')](db['FreshsalesAccount'][_0x336b('0x26')],function(_0x148d8b){return{'name':_0x148d8b[_0x336b('0x27')],'type':_0x148d8b[_0x336b('0x28')]['key']};});_0x2e32e6['model']=_['map'](_0x3cb463,_0x336b('0x22'));_0x2e32e6[_0x336b('0x29')]=_[_0x336b('0x2a')](_0x399e45[_0x336b('0x29')]);_0x2e32e6[_0x336b('0x2b')]=_[_0x336b('0x2c')](_0x2e32e6[_0x336b('0x2d')],_0x2e32e6['query']);_0x3ae1ff[_0x336b('0x2e')]=_[_0x336b('0x2c')](_0x2e32e6[_0x336b('0x2d')],qs[_0x336b('0x2f')](_0x399e45[_0x336b('0x29')]['fields']));_0x3ae1ff['attributes']=_0x3ae1ff[_0x336b('0x2e')][_0x336b('0x30')]?_0x3ae1ff[_0x336b('0x2e')]:_0x2e32e6[_0x336b('0x2d')];if(!_0x399e45[_0x336b('0x29')][_0x336b('0x31')](_0x336b('0x32'))){_0x3ae1ff[_0x336b('0x16')]=qs[_0x336b('0x16')](_0x399e45[_0x336b('0x29')][_0x336b('0x16')]);_0x3ae1ff[_0x336b('0x14')]=qs[_0x336b('0x14')](_0x399e45[_0x336b('0x29')][_0x336b('0x14')]);}_0x3ae1ff[_0x336b('0x33')]=qs[_0x336b('0x34')](_0x399e45['query'][_0x336b('0x34')]);_0x3ae1ff[_0x336b('0x35')]=qs[_0x336b('0x2b')](_[_0x336b('0x36')](_0x399e45[_0x336b('0x29')],_0x2e32e6[_0x336b('0x2b')]),_0x3cb463);if(_0x399e45[_0x336b('0x29')][_0x336b('0x37')]){_0x3ae1ff['where']=_[_0x336b('0x38')](_0x3ae1ff['where'],{'$or':_['map'](_0x3cb463,function(_0x50dc9b){if(_0x50dc9b['type']!==_0x336b('0x39')){var _0x331500={};_0x331500[_0x50dc9b['name']]={'$like':'%'+_0x399e45[_0x336b('0x29')][_0x336b('0x37')]+'%'};return _0x331500;}})});}_0x3ae1ff=_[_0x336b('0x38')]({},_0x3ae1ff,_0x399e45['options']);var _0x732b59={'where':_0x3ae1ff[_0x336b('0x35')]};return db['FreshsalesAccount'][_0x336b('0x17')](_0x732b59)[_0x336b('0x1e')](function(_0x2d42e0){_0x869e95[_0x336b('0x17')]=_0x2d42e0;if(_0x399e45['query'][_0x336b('0x3a')]){_0x3ae1ff[_0x336b('0x3b')]=[{'all':!![]}];}return db[_0x336b('0x3c')]['findAll'](_0x3ae1ff);})[_0x336b('0x1e')](function(_0x3996e6){_0x869e95['rows']=_0x3996e6;return _0x869e95;})[_0x336b('0x1e')](respondWithFilteredResult(_0x616590,_0x3ae1ff))['catch'](handleError(_0x616590,null));};exports[_0x336b('0x3d')]=function(_0x4478c9,_0x511b8b){var _0x3831a6={'raw':![],'where':{'id':_0x4478c9['params']['id']}},_0x454da5={};_0x454da5[_0x336b('0x2d')]=_[_0x336b('0x2a')](db[_0x336b('0x3c')][_0x336b('0x26')]);_0x454da5['query']=_[_0x336b('0x2a')](_0x4478c9[_0x336b('0x29')]);_0x454da5[_0x336b('0x2b')]=_[_0x336b('0x2c')](_0x454da5[_0x336b('0x2d')],_0x454da5[_0x336b('0x29')]);_0x3831a6[_0x336b('0x2e')]=_[_0x336b('0x2c')](_0x454da5[_0x336b('0x2d')],qs[_0x336b('0x2f')](_0x4478c9['query'][_0x336b('0x2f')]));_0x3831a6[_0x336b('0x2e')]=_0x3831a6[_0x336b('0x2e')]['length']?_0x3831a6['attributes']:_0x454da5['model'];if(_0x4478c9['query'][_0x336b('0x3a')]){_0x3831a6['include']=[{'all':!![]}];}_0x3831a6=_['merge']({},_0x3831a6,_0x4478c9[_0x336b('0x3e')]);return db['FreshsalesAccount']['find'](_0x3831a6)['then'](handleEntityNotFound(_0x511b8b,null))[_0x336b('0x1e')](respondWithResult(_0x511b8b,null))[_0x336b('0x3f')](handleError(_0x511b8b,null));};exports[_0x336b('0x40')]=function(_0x356cf5,_0x2b55f8){return db[_0x336b('0x3c')]['create'](_0x356cf5['body'],{})[_0x336b('0x1e')](respondWithResult(_0x2b55f8,0xc9))[_0x336b('0x3f')](handleError(_0x2b55f8,null));};exports[_0x336b('0x1d')]=function(_0x5bc84b,_0x35a303){if(_0x5bc84b[_0x336b('0x41')]['id']){delete _0x5bc84b[_0x336b('0x41')]['id'];}return db[_0x336b('0x3c')][_0x336b('0x42')]({'where':{'id':_0x5bc84b['params']['id']}})[_0x336b('0x1e')](handleEntityNotFound(_0x35a303,null))[_0x336b('0x1e')](saveUpdates(_0x5bc84b['body'],null))['then'](respondWithResult(_0x35a303,null))['catch'](handleError(_0x35a303,null));};exports[_0x336b('0x1f')]=function(_0x5bb1b6,_0x1893fd){return db['FreshsalesAccount']['find']({'where':{'id':_0x5bb1b6[_0x336b('0x43')]['id']}})[_0x336b('0x1e')](handleEntityNotFound(_0x1893fd,null))['then'](removeEntity(_0x1893fd,null))[_0x336b('0x3f')](handleError(_0x1893fd,null));};exports['getConfigurations']=function(_0x4db225,_0x37a558,_0x2e275b){var _0x183f53={};var _0x3b40d5={};var _0xc5ad54;var _0x3f5e27;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4db225[_0x336b('0x43')]['id']}})['then'](handleEntityNotFound(_0x37a558,null))[_0x336b('0x1e')](function(_0x2f1938){if(_0x2f1938){_0xc5ad54=_0x2f1938;_0x3b40d5[_0x336b('0x2d')]=_[_0x336b('0x2a')](db['FreshsalesConfiguration'][_0x336b('0x26')]);_0x3b40d5[_0x336b('0x29')]=_['keys'](_0x4db225[_0x336b('0x29')]);_0x3b40d5[_0x336b('0x2b')]=_[_0x336b('0x2c')](_0x3b40d5[_0x336b('0x2d')],_0x3b40d5[_0x336b('0x29')]);_0x183f53[_0x336b('0x2e')]=_['intersection'](_0x3b40d5[_0x336b('0x2d')],qs[_0x336b('0x2f')](_0x4db225['query'][_0x336b('0x2f')]));_0x183f53[_0x336b('0x2e')]=_0x183f53['attributes'][_0x336b('0x30')]?_0x183f53[_0x336b('0x2e')]:_0x3b40d5['model'];_0x183f53[_0x336b('0x33')]=qs[_0x336b('0x34')](_0x4db225[_0x336b('0x29')][_0x336b('0x34')]);_0x183f53['where']=qs[_0x336b('0x2b')](_['pick'](_0x4db225[_0x336b('0x29')],_0x3b40d5[_0x336b('0x2b')]));if(_0x4db225['query'][_0x336b('0x37')]){_0x183f53[_0x336b('0x35')]=_[_0x336b('0x38')](_0x183f53[_0x336b('0x35')],{'$or':_[_0x336b('0x25')](_0x183f53[_0x336b('0x2e')],function(_0x5d3cc5){var _0x2563b1={};_0x2563b1[_0x5d3cc5]={'$like':'%'+_0x4db225['query'][_0x336b('0x37')]+'%'};return _0x2563b1;})});}_0x183f53=_['merge']({},_0x183f53,_0x4db225[_0x336b('0x3e')]);return _0xc5ad54['getConfigurations'](_0x183f53);}})['then'](function(_0x2c8ea5){if(_0x2c8ea5){_0x3f5e27=_0x2c8ea5['length'];if(!_0x4db225[_0x336b('0x29')][_0x336b('0x31')](_0x336b('0x32'))){_0x183f53[_0x336b('0x16')]=qs[_0x336b('0x16')](_0x4db225[_0x336b('0x29')]['limit']);_0x183f53[_0x336b('0x14')]=qs[_0x336b('0x14')](_0x4db225[_0x336b('0x29')][_0x336b('0x14')]);}return _0xc5ad54['getConfigurations'](_0x183f53);}})[_0x336b('0x1e')](function(_0x59e93a){if(_0x59e93a){return _0x59e93a?{'count':_0x3f5e27,'rows':_0x59e93a}:null;}})[_0x336b('0x1e')](respondWithResult(_0x37a558,null))[_0x336b('0x3f')](handleError(_0x37a558,null));};exports[_0x336b('0x44')]=function(_0x21cd23,_0x5a9022,_0x5d5d1c){if(_0x21cd23[_0x336b('0x41')]['id']){delete _0x21cd23[_0x336b('0x41')]['id'];}return db[_0x336b('0x3c')]['findOne']({'where':{'id':_0x21cd23[_0x336b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a9022,null))[_0x336b('0x1e')](function(_0x46502f){if(_0x46502f){_0x21cd23[_0x336b('0x41')][_0x336b('0x45')]=_0x46502f['id'];_0x21cd23['body'][_0x336b('0x46')]=integrations[_0x336b('0x47')](_0x21cd23[_0x336b('0x41')][_0x336b('0x48')],_0x21cd23['body'][_0x336b('0x28')]);_0x21cd23['body']['Descriptions']=integrations['getDescriptions'](_0x21cd23[_0x336b('0x41')][_0x336b('0x48')],_0x21cd23['body'][_0x336b('0x28')]);return db[_0x336b('0x49')][_0x336b('0x40')](_0x21cd23['body'],{'include':[{'model':db[_0x336b('0x4a')],'as':_0x336b('0x46')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x336b('0x1e')](respondWithResult(_0x5a9022,null))['catch'](handleError(_0x5a9022,null));};exports[_0x336b('0x4b')]=function(_0x3c5731,_0x2e2fbd,_0x36da69){var _0x593e10='';var _0x5c2cb9='';return db['FreshsalesAccount'][_0x336b('0x4c')]({'where':{'id':_0x3c5731[_0x336b('0x43')]['id']},'attributes':['id','username','remoteUri',_0x336b('0x4d')]})[_0x336b('0x1e')](handleEntityNotFound(_0x2e2fbd,null))[_0x336b('0x1e')](function(_0x2669be){if(_0x2669be){_0x5c2cb9=_0x2669be[_0x336b('0x4e')];_0x593e10=_0x2669be[_0x336b('0x4f')];var _0x18ee13=_0x2669be[_0x336b('0x4f')][_0x336b('0x50')](-0x1);if(_0x18ee13==='/'){_0x593e10=_0x593e10[_0x336b('0x51')](0x0,_0x593e10[_0x336b('0x52')](_0x18ee13));}return rp({'method':_0x336b('0x53'),'uri':util[_0x336b('0x54')](_0x336b('0x55'),_0x593e10,'/api/selector/owners'),'headers':{'Authorization':_0x336b('0x56')+_0x2669be['apiKey']},'json':!![]});}})[_0x336b('0x1e')](function(_0x4ae2bf){if(_0x4ae2bf){var _0x39ef5d=_0x4ae2bf['users'];var _0x4a31d9=![];var _0x55cf5b=null;for(_0x55cf5b=0x0;_0x55cf5b<_0x39ef5d[_0x336b('0x30')];_0x55cf5b++){if(_0x39ef5d[_0x55cf5b][_0x336b('0x57')]===_0x5c2cb9){_0x4a31d9=!![];}}if(_0x4a31d9){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x336b('0x1e')](respondWithResult(_0x2e2fbd,null))[_0x336b('0x3f')](function(_0x2c1a1a){var _0x31f83a=_0x3c5731[_0x336b('0x29')][_0x336b('0x58')]?0x1f4:_0x2c1a1a[_0x336b('0x59')]||0x1f4;logger[_0x336b('0x20')](_0x336b('0x5a'),'getFields',_0x31f83a,JSON[_0x336b('0x5b')](_0x2c1a1a));delete _0x2c1a1a[_0x336b('0x22')];if(_0x31f83a===0x191){_0x31f83a=0x190;}_0x2e2fbd['status'](_0x31f83a)[_0x336b('0x23')](_0x3c5731[_0x336b('0x29')][_0x336b('0x58')]?{'message':_0x336b('0x5c'),'statusCode':_0x2c1a1a['statusCode']}:_0x2c1a1a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b290207..c9997db 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 _0xa6b0=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2bf664,_0x398c10){var _0x6bd372=function(_0x902ee8){while(--_0x902ee8){_0x2bf664['push'](_0x2bf664['shift']());}};_0x6bd372(++_0x398c10);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x539090,_0x3bb76f){_0x539090=_0x539090-0x0;var _0x5045a4=_0xa6b0[_0x539090];return _0x5045a4;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));var integrations=require(_0x0a6b('0x8'));module[_0x0a6b('0x9')]=function(_0x3b6967,_0x1b5fb5){return _0x3b6967[_0x0a6b('0xa')](_0x0a6b('0xb'),attributes,{'tableName':_0x0a6b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x1f45df,_0x4afa0b){var _0x1644cf=function(_0x1b7a69){while(--_0x1b7a69){_0x1f45df['push'](_0x1f45df['shift']());}};_0x1644cf(++_0x4afa0b);}(_0x4819,0xcd));var _0x9481=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x4819[_0x38ce4c];return _0x5d4544;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 c8631c9..073ad14 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 _0xb145=['stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetFreshsalesAccount','where','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb145,0xa3));var _0x5b14=function(_0xa5953f,_0x178829){_0xa5953f=_0xa5953f-0x0;var _0x2b296a=_0xb145[_0xa5953f];return _0x2b296a;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['GetFreshsalesAccount']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')]({'raw':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d395['options']?_0x48d395['options']['where']||null:null,'attributes':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'limit':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1c')]||null:null,'include':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x48d395['options'][_0x5b14('0x1d')],function(_0x54073f){return{'model':db[_0x54073f['model']],'as':_0x54073f['as'],'attributes':_0x54073f['attributes'],'include':_0x54073f['include']?_[_0x5b14('0x1e')](_0x54073f[_0x5b14('0x1d')],function(_0x153a25){return{'model':db[_0x153a25['model']],'as':_0x153a25['as'],'attributes':_0x153a25[_0x5b14('0x1b')],'include':_0x153a25[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x153a25[_0x5b14('0x1d')],function(_0xe6851b){return{'model':db[_0xe6851b[_0x5b14('0x1f')]],'as':_0xe6851b['as'],'attributes':_0xe6851b[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b14('0x20')](function(_0x296d65){logger[_0x5b14('0xd')](_0x5b14('0x21'),_0x48d395);logger[_0x5b14('0xf')](_0x5b14('0x21'),_0x48d395,JSON[_0x5b14('0x11')](_0x296d65));_0x3f397d(_0x296d65);})['catch'](function(_0x370fcd){logger[_0x5b14('0x12')]('GetFreshsalesAccount',_0x370fcd['message'],_0x48d395);_0x3035b5(_0x58bf3c[_0x5b14('0x12')](0x1f4,_0x370fcd[_0x5b14('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1f0e){var _0x21b43b=this;return new Promise(function(_0x4d3905,_0x38c665){return db[_0x5b14('0x17')]['find']({'raw':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e['options'][_0x5b14('0x22')]||null:null,'attributes':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'include':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e[_0x5b14('0x19')]['include']?_[_0x5b14('0x1e')](_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1d')],function(_0x37f62c){return{'model':db[_0x37f62c['model']],'as':_0x37f62c['as'],'attributes':_0x37f62c[_0x5b14('0x1b')],'include':_0x37f62c[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x37f62c['include'],function(_0x2fe74d){return{'model':db[_0x2fe74d['model']],'as':_0x2fe74d['as'],'attributes':_0x2fe74d[_0x5b14('0x1b')],'include':_0x2fe74d[_0x5b14('0x1d')]?_['map'](_0x2fe74d[_0x5b14('0x1d')],function(_0x2a83d4){return{'model':db[_0x2a83d4['model']],'as':_0x2a83d4['as'],'attributes':_0x2a83d4[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce6bb){logger[_0x5b14('0xd')](_0x5b14('0x23'),_0x4c1f0e);logger[_0x5b14('0xf')]('ShowFreshsalesAccount',_0x4c1f0e,JSON[_0x5b14('0x11')](_0x1ce6bb));_0x4d3905(_0x1ce6bb);})[_0x5b14('0x16')](function(_0x15d4c4){logger[_0x5b14('0x12')](_0x5b14('0x23'),_0x15d4c4[_0x5b14('0x14')],_0x4c1f0e);_0x38c665(_0x21b43b[_0x5b14('0x12')](0x1f4,_0x15d4c4[_0x5b14('0x14')]));});});}; \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0x5454f8,_0x61bfaf){var _0x38be89=function(_0x53b24b){while(--_0x53b24b){_0x5454f8['push'](_0x5454f8['shift']());}};_0x38be89(++_0x61bfaf);}(_0x77d4,0x108));var _0x477d=function(_0x5541a1,_0x1cf32b){_0x5541a1=_0x5541a1-0x0;var _0x1b5183=_0x77d4[_0x5541a1];return _0x1b5183;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 864ebb6..cac5e1c 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 _0xf0f6=['post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','getSubjects','getDescriptions','/:id/fields','getFields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf0f6,0xb5));var _0x6f0f=function(_0x218a4c,_0x34c96d){_0x218a4c=_0x218a4c-0x0;var _0x59cb6c=_0xf0f6[_0x218a4c];return _0x59cb6c;};'use strict';var multer=require('multer');var util=require(_0x6f0f('0x0'));var path=require(_0x6f0f('0x1'));var timeout=require(_0x6f0f('0x2'));var express=require(_0x6f0f('0x3'));var router=express[_0x6f0f('0x4')]();var fs_extra=require(_0x6f0f('0x5'));var auth=require(_0x6f0f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f0f('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x6f0f('0x8')](),controller[_0x6f0f('0x9')]);router['get'](_0x6f0f('0xa'),auth[_0x6f0f('0x8')](),controller[_0x6f0f('0xb')]);router[_0x6f0f('0xc')]('/:id/subjects',auth[_0x6f0f('0x8')](),controller[_0x6f0f('0xd')]);router[_0x6f0f('0xc')]('/:id/descriptions',auth[_0x6f0f('0x8')](),controller[_0x6f0f('0xe')]);router[_0x6f0f('0xc')](_0x6f0f('0xf'),auth[_0x6f0f('0x8')](),controller[_0x6f0f('0x10')]);router[_0x6f0f('0x11')]('/',auth[_0x6f0f('0x8')](),controller['create']);router['put'](_0x6f0f('0xa'),auth[_0x6f0f('0x8')](),controller[_0x6f0f('0x12')]);router[_0x6f0f('0x13')](_0x6f0f('0xa'),auth[_0x6f0f('0x8')](),controller[_0x6f0f('0x14')]);module[_0x6f0f('0x15')]=router; \ No newline at end of file +var _0xf6b5=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf6b5,0x192));var _0x5f6b=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xf6b5[_0x56a871];return _0x124954;};'use strict';var multer=require(_0x5f6b('0x0'));var util=require(_0x5f6b('0x1'));var path=require(_0x5f6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f6b('0x3'));var router=express[_0x5f6b('0x4')]();var fs_extra=require(_0x5f6b('0x5'));var auth=require(_0x5f6b('0x6'));var interaction=require(_0x5f6b('0x7'));var config=require(_0x5f6b('0x8'));var controller=require(_0x5f6b('0x9'));router[_0x5f6b('0xa')]('/',auth[_0x5f6b('0xb')](),controller[_0x5f6b('0xc')]);router['get'](_0x5f6b('0xd'),auth[_0x5f6b('0xb')](),controller[_0x5f6b('0xe')]);router[_0x5f6b('0xa')](_0x5f6b('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x5f6b('0xa')](_0x5f6b('0x10'),auth[_0x5f6b('0xb')](),controller[_0x5f6b('0x11')]);router[_0x5f6b('0xa')](_0x5f6b('0x12'),auth[_0x5f6b('0xb')](),controller['getFields']);router[_0x5f6b('0x13')]('/',auth[_0x5f6b('0xb')](),controller[_0x5f6b('0x14')]);router[_0x5f6b('0x15')]('/:id',auth[_0x5f6b('0xb')](),controller[_0x5f6b('0x16')]);router[_0x5f6b('0x17')](_0x5f6b('0xd'),auth[_0x5f6b('0xb')](),controller[_0x5f6b('0x18')]);module[_0x5f6b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5541a51..0cd57fd 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 _0x3a9d=['STRING','sequelize'];(function(_0x57a2e1,_0x708336){var _0x5eede0=function(_0x17d7e8){while(--_0x17d7e8){_0x57a2e1['push'](_0x57a2e1['shift']());}};_0x5eede0(++_0x708336);}(_0x3a9d,0x149));var _0xd3a9=function(_0x761fcf,_0x2e5fe7){_0x761fcf=_0x761fcf-0x0;var _0x46bc5e=_0x3a9d[_0x761fcf];return _0x46bc5e;};'use strict';var Sequelize=require(_0xd3a9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3a9('0x1')]},'description':{'type':Sequelize[_0xd3a9('0x1')]}}; \ No newline at end of file +var _0x435d=['sequelize','exports','STRING'];(function(_0xa143cc,_0x3d702b){var _0x4301d8=function(_0xf1b307){while(--_0xf1b307){_0xa143cc['push'](_0xa143cc['shift']());}};_0x4301d8(++_0x3d702b);}(_0x435d,0xf0));var _0xd435=function(_0x2c76be,_0x564ede){_0x2c76be=_0x2c76be-0x0;var _0x30637b=_0x435d[_0x2c76be];return _0x30637b;};'use strict';var Sequelize=require(_0xd435('0x0'));module[_0xd435('0x1')]={'name':{'type':Sequelize[_0xd435('0x2')]},'description':{'type':Sequelize[_0xd435('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c5a96ae..3812cae 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 _0x5b05=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','send','FreshsalesConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','FreshsalesField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5b05,0x1c6));var _0x55b0=function(_0x2abb42,_0x5f74da){_0x2abb42=_0x2abb42-0x0;var _0x2c4bee=_0x5b05[_0x2abb42];return _0x2c4bee;};'use strict';var emlformat=require(_0x55b0('0x0'));var rimraf=require(_0x55b0('0x1'));var zipdir=require(_0x55b0('0x2'));var jsonpatch=require(_0x55b0('0x3'));var rp=require(_0x55b0('0x4'));var moment=require('moment');var BPromise=require(_0x55b0('0x5'));var Mustache=require(_0x55b0('0x6'));var util=require(_0x55b0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x55b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x55b0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x55b0('0xa'));var jsforce=require(_0x55b0('0xb'));var deskjs=require(_0x55b0('0xc'));var toCsv=require(_0x55b0('0x8'));var querystring=require(_0x55b0('0xd'));var Papa=require(_0x55b0('0xe'));var Redis=require(_0x55b0('0xf'));var authService=require(_0x55b0('0x10'));var qs=require(_0x55b0('0x11'));var as=require(_0x55b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55b0('0x13'))(_0x55b0('0x14'));var utils=require(_0x55b0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x55b0('0x16'));var db=require(_0x55b0('0x17'))['db'];function respondWithStatusCode(_0x4a3552,_0x2dad1a){_0x2dad1a=_0x2dad1a||0xcc;return function(_0x1dea8f){if(_0x1dea8f){return _0x4a3552['sendStatus'](_0x2dad1a);}return _0x4a3552[_0x55b0('0x18')](_0x2dad1a)['end']();};}function respondWithResult(_0xdda7fe,_0x3a3434){_0x3a3434=_0x3a3434||0xc8;return function(_0x3e9b01){if(_0x3e9b01){return _0xdda7fe[_0x55b0('0x18')](_0x3a3434)[_0x55b0('0x19')](_0x3e9b01);}};}function respondWithFilteredResult(_0x313202,_0x3c3fc7){return function(_0x443e20){if(_0x443e20){var _0x5af488=typeof _0x3c3fc7[_0x55b0('0x1a')]===_0x55b0('0x1b')&&typeof _0x3c3fc7[_0x55b0('0x1c')]==='undefined';var _0x599a57=_0x443e20['count'];var _0x147c26=_0x5af488?0x0:_0x3c3fc7['offset'];var _0x10d73b=_0x5af488?_0x443e20[_0x55b0('0x1d')]:_0x3c3fc7[_0x55b0('0x1a')]+_0x3c3fc7[_0x55b0('0x1c')];var _0x2e30ab;if(_0x10d73b>=_0x599a57){_0x10d73b=_0x599a57;_0x2e30ab=0xc8;}else{_0x2e30ab=0xce;}_0x313202['status'](_0x2e30ab);return _0x313202[_0x55b0('0x1e')](_0x55b0('0x1f'),_0x147c26+'-'+_0x10d73b+'/'+_0x599a57)['json'](_0x443e20);}return null;};}function patchUpdates(_0x2ce0fc){return function(_0x17efd6){try{jsonpatch['apply'](_0x17efd6,_0x2ce0fc,!![]);}catch(_0x4dba62){return BPromise[_0x55b0('0x20')](_0x4dba62);}return _0x17efd6[_0x55b0('0x21')]();};}function saveUpdates(_0x2a213b,_0xa5a90){return function(_0x7d0a81){if(_0x7d0a81){return _0x7d0a81[_0x55b0('0x22')](_0x2a213b)[_0x55b0('0x23')](function(_0x268e86){return _0x268e86;});}return null;};}function removeEntity(_0x2fa945,_0x3fcaab){return function(_0x3e2bc5){if(_0x3e2bc5){return _0x3e2bc5[_0x55b0('0x24')]()[_0x55b0('0x23')](function(){_0x2fa945['status'](0xcc)[_0x55b0('0x25')]();});}};}function handleEntityNotFound(_0x4dc628,_0x35db6a){return function(_0x2da6b6){if(!_0x2da6b6){_0x4dc628[_0x55b0('0x26')](0x194);}return _0x2da6b6;};}function handleError(_0x50745f,_0x371435){_0x371435=_0x371435||0x1f4;return function(_0x55ecf1){logger['error'](_0x55ecf1[_0x55b0('0x27')]);if(_0x55ecf1[_0x55b0('0x28')]){delete _0x55ecf1['name'];}_0x50745f[_0x55b0('0x18')](_0x371435)[_0x55b0('0x29')](_0x55ecf1);};}exports['index']=function(_0x27ad5b,_0x411121){var _0x46b7a4={},_0x41770e={},_0x16fe62={'count':0x0,'rows':[]};var _0x3cc1c8=_['map'](db[_0x55b0('0x2a')]['rawAttributes'],function(_0x17e448){return{'name':_0x17e448[_0x55b0('0x2b')],'type':_0x17e448[_0x55b0('0x2c')][_0x55b0('0x2d')]};});_0x41770e[_0x55b0('0x2e')]=_[_0x55b0('0x2f')](_0x3cc1c8,_0x55b0('0x28'));_0x41770e[_0x55b0('0x30')]=_['keys'](_0x27ad5b['query']);_0x41770e[_0x55b0('0x31')]=_[_0x55b0('0x32')](_0x41770e[_0x55b0('0x2e')],_0x41770e[_0x55b0('0x30')]);_0x46b7a4[_0x55b0('0x33')]=_[_0x55b0('0x32')](_0x41770e[_0x55b0('0x2e')],qs[_0x55b0('0x34')](_0x27ad5b['query'][_0x55b0('0x34')]));_0x46b7a4[_0x55b0('0x33')]=_0x46b7a4[_0x55b0('0x33')][_0x55b0('0x35')]?_0x46b7a4[_0x55b0('0x33')]:_0x41770e[_0x55b0('0x2e')];if(!_0x27ad5b['query'][_0x55b0('0x36')](_0x55b0('0x37'))){_0x46b7a4[_0x55b0('0x1c')]=qs[_0x55b0('0x1c')](_0x27ad5b['query'][_0x55b0('0x1c')]);_0x46b7a4['offset']=qs[_0x55b0('0x1a')](_0x27ad5b[_0x55b0('0x30')][_0x55b0('0x1a')]);}_0x46b7a4['order']=qs[_0x55b0('0x38')](_0x27ad5b['query']['sort']);_0x46b7a4[_0x55b0('0x39')]=qs[_0x55b0('0x31')](_[_0x55b0('0x3a')](_0x27ad5b[_0x55b0('0x30')],_0x41770e['filters']),_0x3cc1c8);if(_0x27ad5b[_0x55b0('0x30')]['filter']){_0x46b7a4['where']=_['merge'](_0x46b7a4['where'],{'$or':_[_0x55b0('0x2f')](_0x3cc1c8,function(_0x23124e){if(_0x23124e['type']!==_0x55b0('0x3b')){var _0x4c2410={};_0x4c2410[_0x23124e[_0x55b0('0x28')]]={'$like':'%'+_0x27ad5b[_0x55b0('0x30')][_0x55b0('0x3c')]+'%'};return _0x4c2410;}})});}_0x46b7a4=_[_0x55b0('0x3d')]({},_0x46b7a4,_0x27ad5b[_0x55b0('0x3e')]);var _0x3f6831={'where':_0x46b7a4[_0x55b0('0x39')]};return db[_0x55b0('0x2a')][_0x55b0('0x1d')](_0x3f6831)[_0x55b0('0x23')](function(_0x429b9f){_0x16fe62[_0x55b0('0x1d')]=_0x429b9f;if(_0x27ad5b[_0x55b0('0x30')][_0x55b0('0x3f')]){_0x46b7a4[_0x55b0('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x55b0('0x41')](_0x46b7a4);})['then'](function(_0x121ff2){_0x16fe62[_0x55b0('0x42')]=_0x121ff2;return _0x16fe62;})[_0x55b0('0x23')](respondWithFilteredResult(_0x411121,_0x46b7a4))[_0x55b0('0x43')](handleError(_0x411121,null));};exports[_0x55b0('0x44')]=function(_0xcbd489,_0x47a86b){var _0x2cbd6d={'raw':![],'where':{'id':_0xcbd489[_0x55b0('0x45')]['id']}},_0x2559dd={};_0x2559dd[_0x55b0('0x2e')]=_[_0x55b0('0x46')](db[_0x55b0('0x2a')][_0x55b0('0x47')]);_0x2559dd[_0x55b0('0x30')]=_[_0x55b0('0x46')](_0xcbd489[_0x55b0('0x30')]);_0x2559dd[_0x55b0('0x31')]=_[_0x55b0('0x32')](_0x2559dd['model'],_0x2559dd['query']);_0x2cbd6d[_0x55b0('0x33')]=_[_0x55b0('0x32')](_0x2559dd[_0x55b0('0x2e')],qs[_0x55b0('0x34')](_0xcbd489[_0x55b0('0x30')]['fields']));_0x2cbd6d['attributes']=_0x2cbd6d[_0x55b0('0x33')]['length']?_0x2cbd6d[_0x55b0('0x33')]:_0x2559dd['model'];if(_0xcbd489[_0x55b0('0x30')][_0x55b0('0x3f')]){_0x2cbd6d[_0x55b0('0x40')]=[{'all':!![]}];}_0x2cbd6d=_[_0x55b0('0x3d')]({},_0x2cbd6d,_0xcbd489['options']);return db[_0x55b0('0x2a')][_0x55b0('0x48')](_0x2cbd6d)[_0x55b0('0x23')](handleEntityNotFound(_0x47a86b,null))[_0x55b0('0x23')](respondWithResult(_0x47a86b,null))['catch'](handleError(_0x47a86b,null));};exports[_0x55b0('0x49')]=function(_0x1b0a3c,_0x7ac36d){return db['FreshsalesConfiguration'][_0x55b0('0x49')](_0x1b0a3c[_0x55b0('0x4a')],{})[_0x55b0('0x23')](respondWithResult(_0x7ac36d,0xc9))[_0x55b0('0x43')](handleError(_0x7ac36d,null));};exports[_0x55b0('0x22')]=function(_0x360ade,_0x15a501){if(_0x360ade[_0x55b0('0x4a')]['id']){delete _0x360ade[_0x55b0('0x4a')]['id'];}return db[_0x55b0('0x2a')][_0x55b0('0x48')]({'where':{'id':_0x360ade[_0x55b0('0x45')]['id']}})[_0x55b0('0x23')](handleEntityNotFound(_0x15a501,null))[_0x55b0('0x23')](saveUpdates(_0x360ade['body'],null))[_0x55b0('0x23')](respondWithResult(_0x15a501,null))[_0x55b0('0x43')](handleError(_0x15a501,null));};exports[_0x55b0('0x24')]=function(_0x230c25,_0x4828a1){return db['FreshsalesConfiguration'][_0x55b0('0x48')]({'where':{'id':_0x230c25['params']['id']}})['then'](handleEntityNotFound(_0x4828a1,null))[_0x55b0('0x23')](removeEntity(_0x4828a1,null))['catch'](handleError(_0x4828a1,null));};exports['getSubjects']=function(_0x11b9b6,_0x2a3c48,_0x1505ec){var _0x1c8d7f={};var _0x3e6d77={};var _0x183dd7;var _0x59164c;return db[_0x55b0('0x2a')]['findOne']({'where':{'id':_0x11b9b6[_0x55b0('0x45')]['id']}})[_0x55b0('0x23')](handleEntityNotFound(_0x2a3c48,null))[_0x55b0('0x23')](function(_0x362946){if(_0x362946){_0x183dd7=_0x362946;_0x3e6d77[_0x55b0('0x2e')]=_[_0x55b0('0x46')](db[_0x55b0('0x4b')][_0x55b0('0x47')]);_0x3e6d77[_0x55b0('0x30')]=_[_0x55b0('0x46')](_0x11b9b6[_0x55b0('0x30')]);_0x3e6d77[_0x55b0('0x31')]=_['intersection'](_0x3e6d77['model'],_0x3e6d77[_0x55b0('0x30')]);_0x1c8d7f[_0x55b0('0x33')]=_['intersection'](_0x3e6d77['model'],qs['fields'](_0x11b9b6[_0x55b0('0x30')][_0x55b0('0x34')]));_0x1c8d7f['attributes']=_0x1c8d7f[_0x55b0('0x33')][_0x55b0('0x35')]?_0x1c8d7f[_0x55b0('0x33')]:_0x3e6d77[_0x55b0('0x2e')];_0x1c8d7f[_0x55b0('0x4c')]=qs['sort'](_0x11b9b6[_0x55b0('0x30')][_0x55b0('0x38')]);_0x1c8d7f[_0x55b0('0x39')]=qs['filters'](_[_0x55b0('0x3a')](_0x11b9b6[_0x55b0('0x30')],_0x3e6d77['filters']));if(_0x11b9b6[_0x55b0('0x30')][_0x55b0('0x3c')]){_0x1c8d7f['where']=_[_0x55b0('0x3d')](_0x1c8d7f['where'],{'$or':_[_0x55b0('0x2f')](_0x1c8d7f[_0x55b0('0x33')],function(_0x5c9863){var _0x214154={};_0x214154[_0x5c9863]={'$like':'%'+_0x11b9b6[_0x55b0('0x30')]['filter']+'%'};return _0x214154;})});}_0x1c8d7f=_[_0x55b0('0x3d')]({},_0x1c8d7f,_0x11b9b6['options']);return _0x183dd7[_0x55b0('0x4d')](_0x1c8d7f);}})[_0x55b0('0x23')](function(_0x558742){if(_0x558742){_0x59164c=_0x558742[_0x55b0('0x35')];if(!_0x11b9b6[_0x55b0('0x30')][_0x55b0('0x36')](_0x55b0('0x37'))){_0x1c8d7f[_0x55b0('0x1c')]=qs['limit'](_0x11b9b6[_0x55b0('0x30')]['limit']);_0x1c8d7f['offset']=qs[_0x55b0('0x1a')](_0x11b9b6[_0x55b0('0x30')][_0x55b0('0x1a')]);}return _0x183dd7[_0x55b0('0x4d')](_0x1c8d7f);}})[_0x55b0('0x23')](function(_0x7893e7){if(_0x7893e7){return _0x7893e7?{'count':_0x59164c,'rows':_0x7893e7}:null;}})['then'](respondWithResult(_0x2a3c48,null))[_0x55b0('0x43')](handleError(_0x2a3c48,null));};exports['getDescriptions']=function(_0x183e79,_0x47cad3,_0x2162e1){var _0xe9bea8={};var _0x1856cf={};var _0x17235e;var _0x436c18;return db[_0x55b0('0x2a')][_0x55b0('0x4e')]({'where':{'id':_0x183e79['params']['id']}})[_0x55b0('0x23')](handleEntityNotFound(_0x47cad3,null))[_0x55b0('0x23')](function(_0x5d2926){if(_0x5d2926){_0x17235e=_0x5d2926;_0x1856cf['model']=_[_0x55b0('0x46')](db[_0x55b0('0x4b')][_0x55b0('0x47')]);_0x1856cf['query']=_[_0x55b0('0x46')](_0x183e79[_0x55b0('0x30')]);_0x1856cf[_0x55b0('0x31')]=_[_0x55b0('0x32')](_0x1856cf[_0x55b0('0x2e')],_0x1856cf[_0x55b0('0x30')]);_0xe9bea8['attributes']=_[_0x55b0('0x32')](_0x1856cf[_0x55b0('0x2e')],qs['fields'](_0x183e79[_0x55b0('0x30')][_0x55b0('0x34')]));_0xe9bea8['attributes']=_0xe9bea8['attributes'][_0x55b0('0x35')]?_0xe9bea8['attributes']:_0x1856cf[_0x55b0('0x2e')];_0xe9bea8[_0x55b0('0x4c')]=qs[_0x55b0('0x38')](_0x183e79[_0x55b0('0x30')][_0x55b0('0x38')]);_0xe9bea8['where']=qs[_0x55b0('0x31')](_[_0x55b0('0x3a')](_0x183e79['query'],_0x1856cf[_0x55b0('0x31')]));if(_0x183e79['query'][_0x55b0('0x3c')]){_0xe9bea8[_0x55b0('0x39')]=_[_0x55b0('0x3d')](_0xe9bea8[_0x55b0('0x39')],{'$or':_[_0x55b0('0x2f')](_0xe9bea8[_0x55b0('0x33')],function(_0x3677df){var _0x532264={};_0x532264[_0x3677df]={'$like':'%'+_0x183e79['query'][_0x55b0('0x3c')]+'%'};return _0x532264;})});}_0xe9bea8=_[_0x55b0('0x3d')]({},_0xe9bea8,_0x183e79[_0x55b0('0x3e')]);return _0x17235e[_0x55b0('0x4f')](_0xe9bea8);}})[_0x55b0('0x23')](function(_0xdb3e7a){if(_0xdb3e7a){_0x436c18=_0xdb3e7a[_0x55b0('0x35')];if(!_0x183e79['query'][_0x55b0('0x36')](_0x55b0('0x37'))){_0xe9bea8['limit']=qs[_0x55b0('0x1c')](_0x183e79[_0x55b0('0x30')][_0x55b0('0x1c')]);_0xe9bea8[_0x55b0('0x1a')]=qs[_0x55b0('0x1a')](_0x183e79[_0x55b0('0x30')]['offset']);}return _0x17235e[_0x55b0('0x4f')](_0xe9bea8);}})[_0x55b0('0x23')](function(_0x51bfe7){if(_0x51bfe7){return _0x51bfe7?{'count':_0x436c18,'rows':_0x51bfe7}:null;}})[_0x55b0('0x23')](respondWithResult(_0x47cad3,null))[_0x55b0('0x43')](handleError(_0x47cad3,null));};exports['getFields']=function(_0x52d7a0,_0x1d3d61,_0x184452){var _0x373391={};var _0x3dd1b5={};var _0x55b352;var _0x257925;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x52d7a0[_0x55b0('0x45')]['id']}})[_0x55b0('0x23')](handleEntityNotFound(_0x1d3d61,null))[_0x55b0('0x23')](function(_0xfbbff2){if(_0xfbbff2){_0x55b352=_0xfbbff2;_0x3dd1b5[_0x55b0('0x2e')]=_[_0x55b0('0x46')](db[_0x55b0('0x4b')][_0x55b0('0x47')]);_0x3dd1b5[_0x55b0('0x30')]=_[_0x55b0('0x46')](_0x52d7a0[_0x55b0('0x30')]);_0x3dd1b5[_0x55b0('0x31')]=_[_0x55b0('0x32')](_0x3dd1b5[_0x55b0('0x2e')],_0x3dd1b5['query']);_0x373391[_0x55b0('0x33')]=_[_0x55b0('0x32')](_0x3dd1b5[_0x55b0('0x2e')],qs[_0x55b0('0x34')](_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x34')]));_0x373391[_0x55b0('0x33')]=_0x373391['attributes'][_0x55b0('0x35')]?_0x373391[_0x55b0('0x33')]:_0x3dd1b5[_0x55b0('0x2e')];_0x373391[_0x55b0('0x4c')]=qs['sort'](_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x38')]);_0x373391[_0x55b0('0x39')]=qs[_0x55b0('0x31')](_['pick'](_0x52d7a0[_0x55b0('0x30')],_0x3dd1b5[_0x55b0('0x31')]));if(_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x3c')]){_0x373391[_0x55b0('0x39')]=_['merge'](_0x373391[_0x55b0('0x39')],{'$or':_['map'](_0x373391[_0x55b0('0x33')],function(_0x102d08){var _0x361c51={};_0x361c51[_0x102d08]={'$like':'%'+_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x3c')]+'%'};return _0x361c51;})});}_0x373391=_[_0x55b0('0x3d')]({},_0x373391,_0x52d7a0[_0x55b0('0x3e')]);return _0x55b352['getFields'](_0x373391);}})[_0x55b0('0x23')](function(_0x346f89){if(_0x346f89){_0x257925=_0x346f89[_0x55b0('0x35')];if(!_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x36')](_0x55b0('0x37'))){_0x373391[_0x55b0('0x1c')]=qs[_0x55b0('0x1c')](_0x52d7a0[_0x55b0('0x30')]['limit']);_0x373391[_0x55b0('0x1a')]=qs['offset'](_0x52d7a0[_0x55b0('0x30')][_0x55b0('0x1a')]);}return _0x55b352['getFields'](_0x373391);}})[_0x55b0('0x23')](function(_0x1116c9){if(_0x1116c9){return _0x1116c9?{'count':_0x257925,'rows':_0x1116c9}:null;}})[_0x55b0('0x23')](respondWithResult(_0x1d3d61,null))[_0x55b0('0x43')](handleError(_0x1d3d61,null));}; \ No newline at end of file +var _0xa7b6=['json','apply','reject','save','then','stack','send','index','FreshsalesConfiguration','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range'];(function(_0xe1aa41,_0xe9a3b9){var _0x53a179=function(_0x519b51){while(--_0x519b51){_0xe1aa41['push'](_0xe1aa41['shift']());}};_0x53a179(++_0xe9a3b9);}(_0xa7b6,0x7e));var _0x6a7b=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xa7b6[_0x4f2c3a];return _0x17d91c;};'use strict';var emlformat=require(_0x6a7b('0x0'));var rimraf=require(_0x6a7b('0x1'));var zipdir=require(_0x6a7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a7b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a7b('0x4'));var util=require(_0x6a7b('0x5'));var path=require('path');var sox=require(_0x6a7b('0x6'));var csv=require(_0x6a7b('0x7'));var ejs=require(_0x6a7b('0x8'));var fs=require('fs');var fs_extra=require(_0x6a7b('0x9'));var _=require(_0x6a7b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a7b('0xb'));var deskjs=require(_0x6a7b('0xc'));var toCsv=require(_0x6a7b('0x7'));var querystring=require(_0x6a7b('0xd'));var Papa=require(_0x6a7b('0xe'));var Redis=require('ioredis');var authService=require(_0x6a7b('0xf'));var qs=require(_0x6a7b('0x10'));var as=require(_0x6a7b('0x11'));var hardwareService=require(_0x6a7b('0x12'));var logger=require('../../config/logger')(_0x6a7b('0x13'));var utils=require(_0x6a7b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6a7b('0x15'));var db=require(_0x6a7b('0x16'))['db'];function respondWithStatusCode(_0x268e26,_0x394382){_0x394382=_0x394382||0xcc;return function(_0x5d73ef){if(_0x5d73ef){return _0x268e26[_0x6a7b('0x17')](_0x394382);}return _0x268e26['status'](_0x394382)[_0x6a7b('0x18')]();};}function respondWithResult(_0x4452c6,_0x479360){_0x479360=_0x479360||0xc8;return function(_0x3e9623){if(_0x3e9623){return _0x4452c6['status'](_0x479360)['json'](_0x3e9623);}};}function respondWithFilteredResult(_0x376141,_0x11bf69){return function(_0x46fb55){if(_0x46fb55){var _0x35de2e=typeof _0x11bf69[_0x6a7b('0x19')]==='undefined'&&typeof _0x11bf69[_0x6a7b('0x1a')]==='undefined';var _0x4e9c1d=_0x46fb55['count'];var _0x50f609=_0x35de2e?0x0:_0x11bf69['offset'];var _0x47ee34=_0x35de2e?_0x46fb55['count']:_0x11bf69[_0x6a7b('0x19')]+_0x11bf69[_0x6a7b('0x1a')];var _0x4014d1;if(_0x47ee34>=_0x4e9c1d){_0x47ee34=_0x4e9c1d;_0x4014d1=0xc8;}else{_0x4014d1=0xce;}_0x376141[_0x6a7b('0x1b')](_0x4014d1);return _0x376141[_0x6a7b('0x1c')](_0x6a7b('0x1d'),_0x50f609+'-'+_0x47ee34+'/'+_0x4e9c1d)[_0x6a7b('0x1e')](_0x46fb55);}return null;};}function patchUpdates(_0x1ad5f8){return function(_0x14e125){try{jsonpatch[_0x6a7b('0x1f')](_0x14e125,_0x1ad5f8,!![]);}catch(_0x35bd9a){return BPromise[_0x6a7b('0x20')](_0x35bd9a);}return _0x14e125[_0x6a7b('0x21')]();};}function saveUpdates(_0x27e153,_0x6c51cb){return function(_0x51cfe5){if(_0x51cfe5){return _0x51cfe5['update'](_0x27e153)[_0x6a7b('0x22')](function(_0x9a4d8a){return _0x9a4d8a;});}return null;};}function removeEntity(_0x3a43ee,_0x533e46){return function(_0x258292){if(_0x258292){return _0x258292['destroy']()[_0x6a7b('0x22')](function(){_0x3a43ee[_0x6a7b('0x1b')](0xcc)[_0x6a7b('0x18')]();});}};}function handleEntityNotFound(_0x329ab1,_0x103baa){return function(_0x205a9f){if(!_0x205a9f){_0x329ab1[_0x6a7b('0x17')](0x194);}return _0x205a9f;};}function handleError(_0xe4e7f2,_0x3db472){_0x3db472=_0x3db472||0x1f4;return function(_0x437b4e){logger['error'](_0x437b4e[_0x6a7b('0x23')]);if(_0x437b4e['name']){delete _0x437b4e['name'];}_0xe4e7f2[_0x6a7b('0x1b')](_0x3db472)[_0x6a7b('0x24')](_0x437b4e);};}exports[_0x6a7b('0x25')]=function(_0x348413,_0x396685){var _0x383802={},_0x351170={},_0x5e601d={'count':0x0,'rows':[]};var _0x180c2e=_['map'](db[_0x6a7b('0x26')]['rawAttributes'],function(_0x238503){return{'name':_0x238503[_0x6a7b('0x27')],'type':_0x238503[_0x6a7b('0x28')][_0x6a7b('0x29')]};});_0x351170[_0x6a7b('0x2a')]=_[_0x6a7b('0x2b')](_0x180c2e,_0x6a7b('0x2c'));_0x351170[_0x6a7b('0x2d')]=_['keys'](_0x348413[_0x6a7b('0x2d')]);_0x351170['filters']=_[_0x6a7b('0x2e')](_0x351170['model'],_0x351170[_0x6a7b('0x2d')]);_0x383802[_0x6a7b('0x2f')]=_[_0x6a7b('0x2e')](_0x351170['model'],qs[_0x6a7b('0x30')](_0x348413[_0x6a7b('0x2d')]['fields']));_0x383802[_0x6a7b('0x2f')]=_0x383802[_0x6a7b('0x2f')][_0x6a7b('0x31')]?_0x383802[_0x6a7b('0x2f')]:_0x351170[_0x6a7b('0x2a')];if(!_0x348413['query'][_0x6a7b('0x32')](_0x6a7b('0x33'))){_0x383802[_0x6a7b('0x1a')]=qs['limit'](_0x348413[_0x6a7b('0x2d')][_0x6a7b('0x1a')]);_0x383802[_0x6a7b('0x19')]=qs[_0x6a7b('0x19')](_0x348413[_0x6a7b('0x2d')][_0x6a7b('0x19')]);}_0x383802[_0x6a7b('0x34')]=qs[_0x6a7b('0x35')](_0x348413['query'][_0x6a7b('0x35')]);_0x383802[_0x6a7b('0x36')]=qs[_0x6a7b('0x37')](_[_0x6a7b('0x38')](_0x348413['query'],_0x351170[_0x6a7b('0x37')]),_0x180c2e);if(_0x348413[_0x6a7b('0x2d')][_0x6a7b('0x39')]){_0x383802['where']=_[_0x6a7b('0x3a')](_0x383802['where'],{'$or':_['map'](_0x180c2e,function(_0x5d52fa){if(_0x5d52fa['type']!==_0x6a7b('0x3b')){var _0x368724={};_0x368724[_0x5d52fa['name']]={'$like':'%'+_0x348413['query'][_0x6a7b('0x39')]+'%'};return _0x368724;}})});}_0x383802=_[_0x6a7b('0x3a')]({},_0x383802,_0x348413[_0x6a7b('0x3c')]);var _0x2aedbb={'where':_0x383802[_0x6a7b('0x36')]};return db['FreshsalesConfiguration'][_0x6a7b('0x3d')](_0x2aedbb)[_0x6a7b('0x22')](function(_0x4cc61c){_0x5e601d[_0x6a7b('0x3d')]=_0x4cc61c;if(_0x348413[_0x6a7b('0x2d')][_0x6a7b('0x3e')]){_0x383802[_0x6a7b('0x3f')]=[{'all':!![]}];}return db[_0x6a7b('0x26')][_0x6a7b('0x40')](_0x383802);})[_0x6a7b('0x22')](function(_0x4db81b){_0x5e601d['rows']=_0x4db81b;return _0x5e601d;})[_0x6a7b('0x22')](respondWithFilteredResult(_0x396685,_0x383802))[_0x6a7b('0x41')](handleError(_0x396685,null));};exports[_0x6a7b('0x42')]=function(_0x3424f5,_0x5a39c2){var _0x4f82d6={'raw':![],'where':{'id':_0x3424f5['params']['id']}},_0x5cd781={};_0x5cd781[_0x6a7b('0x2a')]=_['keys'](db[_0x6a7b('0x26')][_0x6a7b('0x43')]);_0x5cd781[_0x6a7b('0x2d')]=_[_0x6a7b('0x44')](_0x3424f5[_0x6a7b('0x2d')]);_0x5cd781[_0x6a7b('0x37')]=_['intersection'](_0x5cd781['model'],_0x5cd781['query']);_0x4f82d6[_0x6a7b('0x2f')]=_[_0x6a7b('0x2e')](_0x5cd781[_0x6a7b('0x2a')],qs[_0x6a7b('0x30')](_0x3424f5[_0x6a7b('0x2d')][_0x6a7b('0x30')]));_0x4f82d6[_0x6a7b('0x2f')]=_0x4f82d6['attributes'][_0x6a7b('0x31')]?_0x4f82d6['attributes']:_0x5cd781[_0x6a7b('0x2a')];if(_0x3424f5[_0x6a7b('0x2d')][_0x6a7b('0x3e')]){_0x4f82d6[_0x6a7b('0x3f')]=[{'all':!![]}];}_0x4f82d6=_['merge']({},_0x4f82d6,_0x3424f5[_0x6a7b('0x3c')]);return db['FreshsalesConfiguration'][_0x6a7b('0x45')](_0x4f82d6)['then'](handleEntityNotFound(_0x5a39c2,null))[_0x6a7b('0x22')](respondWithResult(_0x5a39c2,null))[_0x6a7b('0x41')](handleError(_0x5a39c2,null));};exports[_0x6a7b('0x46')]=function(_0x42cad3,_0x1cfa93){return db[_0x6a7b('0x26')][_0x6a7b('0x46')](_0x42cad3['body'],{})[_0x6a7b('0x22')](respondWithResult(_0x1cfa93,0xc9))['catch'](handleError(_0x1cfa93,null));};exports['update']=function(_0x15d3d0,_0x3a77bb){if(_0x15d3d0[_0x6a7b('0x47')]['id']){delete _0x15d3d0[_0x6a7b('0x47')]['id'];}return db[_0x6a7b('0x26')][_0x6a7b('0x45')]({'where':{'id':_0x15d3d0[_0x6a7b('0x48')]['id']}})[_0x6a7b('0x22')](handleEntityNotFound(_0x3a77bb,null))[_0x6a7b('0x22')](saveUpdates(_0x15d3d0[_0x6a7b('0x47')],null))['then'](respondWithResult(_0x3a77bb,null))['catch'](handleError(_0x3a77bb,null));};exports['destroy']=function(_0x1aca84,_0x5b5414){return db['FreshsalesConfiguration'][_0x6a7b('0x45')]({'where':{'id':_0x1aca84[_0x6a7b('0x48')]['id']}})[_0x6a7b('0x22')](handleEntityNotFound(_0x5b5414,null))[_0x6a7b('0x22')](removeEntity(_0x5b5414,null))[_0x6a7b('0x41')](handleError(_0x5b5414,null));};exports[_0x6a7b('0x49')]=function(_0x33d84e,_0x50d051,_0x513270){var _0x204f54={};var _0x5bf1b0={};var _0x42ac33;var _0x212ead;return db['FreshsalesConfiguration'][_0x6a7b('0x4a')]({'where':{'id':_0x33d84e[_0x6a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x50d051,null))[_0x6a7b('0x22')](function(_0x4299dc){if(_0x4299dc){_0x42ac33=_0x4299dc;_0x5bf1b0[_0x6a7b('0x2a')]=_[_0x6a7b('0x44')](db[_0x6a7b('0x4b')][_0x6a7b('0x43')]);_0x5bf1b0[_0x6a7b('0x2d')]=_[_0x6a7b('0x44')](_0x33d84e[_0x6a7b('0x2d')]);_0x5bf1b0[_0x6a7b('0x37')]=_[_0x6a7b('0x2e')](_0x5bf1b0[_0x6a7b('0x2a')],_0x5bf1b0[_0x6a7b('0x2d')]);_0x204f54[_0x6a7b('0x2f')]=_['intersection'](_0x5bf1b0[_0x6a7b('0x2a')],qs[_0x6a7b('0x30')](_0x33d84e[_0x6a7b('0x2d')][_0x6a7b('0x30')]));_0x204f54[_0x6a7b('0x2f')]=_0x204f54['attributes'][_0x6a7b('0x31')]?_0x204f54['attributes']:_0x5bf1b0[_0x6a7b('0x2a')];_0x204f54[_0x6a7b('0x34')]=qs[_0x6a7b('0x35')](_0x33d84e[_0x6a7b('0x2d')][_0x6a7b('0x35')]);_0x204f54[_0x6a7b('0x36')]=qs[_0x6a7b('0x37')](_['pick'](_0x33d84e[_0x6a7b('0x2d')],_0x5bf1b0[_0x6a7b('0x37')]));if(_0x33d84e['query'][_0x6a7b('0x39')]){_0x204f54['where']=_['merge'](_0x204f54[_0x6a7b('0x36')],{'$or':_[_0x6a7b('0x2b')](_0x204f54['attributes'],function(_0x365cd4){var _0x2f7120={};_0x2f7120[_0x365cd4]={'$like':'%'+_0x33d84e[_0x6a7b('0x2d')][_0x6a7b('0x39')]+'%'};return _0x2f7120;})});}_0x204f54=_[_0x6a7b('0x3a')]({},_0x204f54,_0x33d84e['options']);return _0x42ac33['getSubjects'](_0x204f54);}})[_0x6a7b('0x22')](function(_0x2ef3a1){if(_0x2ef3a1){_0x212ead=_0x2ef3a1[_0x6a7b('0x31')];if(!_0x33d84e['query'][_0x6a7b('0x32')]('nolimit')){_0x204f54[_0x6a7b('0x1a')]=qs['limit'](_0x33d84e[_0x6a7b('0x2d')][_0x6a7b('0x1a')]);_0x204f54[_0x6a7b('0x19')]=qs[_0x6a7b('0x19')](_0x33d84e['query']['offset']);}return _0x42ac33['getSubjects'](_0x204f54);}})[_0x6a7b('0x22')](function(_0x454943){if(_0x454943){return _0x454943?{'count':_0x212ead,'rows':_0x454943}:null;}})[_0x6a7b('0x22')](respondWithResult(_0x50d051,null))['catch'](handleError(_0x50d051,null));};exports[_0x6a7b('0x4c')]=function(_0x568f46,_0x4f680d,_0x217747){var _0x534e03={};var _0x1697cb={};var _0x5127b0;var _0x4d566d;return db[_0x6a7b('0x26')][_0x6a7b('0x4a')]({'where':{'id':_0x568f46[_0x6a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f680d,null))[_0x6a7b('0x22')](function(_0x561076){if(_0x561076){_0x5127b0=_0x561076;_0x1697cb[_0x6a7b('0x2a')]=_['keys'](db[_0x6a7b('0x4b')][_0x6a7b('0x43')]);_0x1697cb[_0x6a7b('0x2d')]=_[_0x6a7b('0x44')](_0x568f46[_0x6a7b('0x2d')]);_0x1697cb[_0x6a7b('0x37')]=_['intersection'](_0x1697cb['model'],_0x1697cb[_0x6a7b('0x2d')]);_0x534e03[_0x6a7b('0x2f')]=_[_0x6a7b('0x2e')](_0x1697cb['model'],qs[_0x6a7b('0x30')](_0x568f46[_0x6a7b('0x2d')][_0x6a7b('0x30')]));_0x534e03['attributes']=_0x534e03[_0x6a7b('0x2f')][_0x6a7b('0x31')]?_0x534e03[_0x6a7b('0x2f')]:_0x1697cb[_0x6a7b('0x2a')];_0x534e03[_0x6a7b('0x34')]=qs[_0x6a7b('0x35')](_0x568f46[_0x6a7b('0x2d')]['sort']);_0x534e03['where']=qs[_0x6a7b('0x37')](_[_0x6a7b('0x38')](_0x568f46[_0x6a7b('0x2d')],_0x1697cb['filters']));if(_0x568f46['query'][_0x6a7b('0x39')]){_0x534e03[_0x6a7b('0x36')]=_['merge'](_0x534e03[_0x6a7b('0x36')],{'$or':_[_0x6a7b('0x2b')](_0x534e03[_0x6a7b('0x2f')],function(_0x1cf865){var _0x173ce8={};_0x173ce8[_0x1cf865]={'$like':'%'+_0x568f46[_0x6a7b('0x2d')][_0x6a7b('0x39')]+'%'};return _0x173ce8;})});}_0x534e03=_[_0x6a7b('0x3a')]({},_0x534e03,_0x568f46['options']);return _0x5127b0[_0x6a7b('0x4c')](_0x534e03);}})['then'](function(_0x24290e){if(_0x24290e){_0x4d566d=_0x24290e['length'];if(!_0x568f46[_0x6a7b('0x2d')][_0x6a7b('0x32')](_0x6a7b('0x33'))){_0x534e03[_0x6a7b('0x1a')]=qs[_0x6a7b('0x1a')](_0x568f46[_0x6a7b('0x2d')][_0x6a7b('0x1a')]);_0x534e03['offset']=qs[_0x6a7b('0x19')](_0x568f46[_0x6a7b('0x2d')][_0x6a7b('0x19')]);}return _0x5127b0[_0x6a7b('0x4c')](_0x534e03);}})['then'](function(_0x36b3ac){if(_0x36b3ac){return _0x36b3ac?{'count':_0x4d566d,'rows':_0x36b3ac}:null;}})[_0x6a7b('0x22')](respondWithResult(_0x4f680d,null))[_0x6a7b('0x41')](handleError(_0x4f680d,null));};exports[_0x6a7b('0x4d')]=function(_0x5667ad,_0x52c524,_0x26317a){var _0x2cfcc4={};var _0xfdb868={};var _0x314184;var _0x500ffe;return db[_0x6a7b('0x26')]['findOne']({'where':{'id':_0x5667ad[_0x6a7b('0x48')]['id']}})[_0x6a7b('0x22')](handleEntityNotFound(_0x52c524,null))[_0x6a7b('0x22')](function(_0x30c522){if(_0x30c522){_0x314184=_0x30c522;_0xfdb868[_0x6a7b('0x2a')]=_[_0x6a7b('0x44')](db[_0x6a7b('0x4b')]['rawAttributes']);_0xfdb868[_0x6a7b('0x2d')]=_[_0x6a7b('0x44')](_0x5667ad[_0x6a7b('0x2d')]);_0xfdb868[_0x6a7b('0x37')]=_[_0x6a7b('0x2e')](_0xfdb868['model'],_0xfdb868[_0x6a7b('0x2d')]);_0x2cfcc4[_0x6a7b('0x2f')]=_[_0x6a7b('0x2e')](_0xfdb868['model'],qs[_0x6a7b('0x30')](_0x5667ad[_0x6a7b('0x2d')][_0x6a7b('0x30')]));_0x2cfcc4[_0x6a7b('0x2f')]=_0x2cfcc4['attributes'][_0x6a7b('0x31')]?_0x2cfcc4[_0x6a7b('0x2f')]:_0xfdb868[_0x6a7b('0x2a')];_0x2cfcc4['order']=qs[_0x6a7b('0x35')](_0x5667ad['query']['sort']);_0x2cfcc4[_0x6a7b('0x36')]=qs['filters'](_[_0x6a7b('0x38')](_0x5667ad[_0x6a7b('0x2d')],_0xfdb868[_0x6a7b('0x37')]));if(_0x5667ad[_0x6a7b('0x2d')]['filter']){_0x2cfcc4[_0x6a7b('0x36')]=_['merge'](_0x2cfcc4['where'],{'$or':_[_0x6a7b('0x2b')](_0x2cfcc4[_0x6a7b('0x2f')],function(_0x2dac8d){var _0x1d4f42={};_0x1d4f42[_0x2dac8d]={'$like':'%'+_0x5667ad[_0x6a7b('0x2d')][_0x6a7b('0x39')]+'%'};return _0x1d4f42;})});}_0x2cfcc4=_[_0x6a7b('0x3a')]({},_0x2cfcc4,_0x5667ad[_0x6a7b('0x3c')]);return _0x314184[_0x6a7b('0x4d')](_0x2cfcc4);}})[_0x6a7b('0x22')](function(_0x313c6d){if(_0x313c6d){_0x500ffe=_0x313c6d['length'];if(!_0x5667ad[_0x6a7b('0x2d')][_0x6a7b('0x32')](_0x6a7b('0x33'))){_0x2cfcc4[_0x6a7b('0x1a')]=qs[_0x6a7b('0x1a')](_0x5667ad[_0x6a7b('0x2d')][_0x6a7b('0x1a')]);_0x2cfcc4[_0x6a7b('0x19')]=qs[_0x6a7b('0x19')](_0x5667ad[_0x6a7b('0x2d')]['offset']);}return _0x314184['getFields'](_0x2cfcc4);}})[_0x6a7b('0x22')](function(_0x20e47f){if(_0x20e47f){return _0x20e47f?{'count':_0x500ffe,'rows':_0x20e47f}:null;}})[_0x6a7b('0x22')](respondWithResult(_0x52c524,null))[_0x6a7b('0x41')](handleError(_0x52c524,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 42edd5d..c671b0e 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 _0xe7ae=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x4e8123,_0x31172b){var _0x36143c=function(_0x1196a0){while(--_0x1196a0){_0x4e8123['push'](_0x4e8123['shift']());}};_0x36143c(++_0x31172b);}(_0xe7ae,0x1d7));var _0xee7a=function(_0x25eea5,_0x161246){_0x25eea5=_0x25eea5-0x0;var _0x519286=_0xe7ae[_0x25eea5];return _0x519286;};'use strict';var _=require(_0xee7a('0x0'));var util=require(_0xee7a('0x1'));var logger=require('../../config/logger')(_0xee7a('0x2'));var moment=require('moment');var BPromise=require(_0xee7a('0x3'));var rp=require(_0xee7a('0x4'));var fs=require('fs');var path=require(_0xee7a('0x5'));var rimraf=require(_0xee7a('0x6'));var config=require(_0xee7a('0x7'));var attributes=require(_0xee7a('0x8'));module['exports']=function(_0x49a592,_0x3d4bf2){return _0x49a592[_0xee7a('0x9')](_0xee7a('0xa'),attributes,{'tableName':_0xee7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3593=['request-promise','rimraf','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3593,0x1ed));var _0x3359=function(_0x2d7b60,_0x1a0fbe){_0x2d7b60=_0x2d7b60-0x0;var _0x36b9e1=_0x3593[_0x2d7b60];return _0x36b9e1;};'use strict';var _=require(_0x3359('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3359('0x1'));var BPromise=require(_0x3359('0x2'));var rp=require(_0x3359('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3359('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x16625b,_0x246e18){return _0x16625b[_0x3359('0x5')](_0x3359('0x6'),attributes,{'tableName':_0x3359('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 4bdd3a1..7810177 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 _0xaee8=['rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xaee8,0x152));var _0x8aee=function(_0x534b58,_0x53ecd6){_0x534b58=_0x534b58-0x0;var _0x446260=_0xaee8[_0x534b58];return _0x446260;};'use strict';var _=require(_0x8aee('0x0'));var util=require(_0x8aee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8aee('0x2'));var fs=require('fs');var Redis=require(_0x8aee('0x3'));var db=require(_0x8aee('0x4'))['db'];var utils=require(_0x8aee('0x5'));var logger=require(_0x8aee('0x6'))(_0x8aee('0x7'));var config=require(_0x8aee('0x8'));var jayson=require(_0x8aee('0x9'));var client=jayson[_0x8aee('0xa')][_0x8aee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38e095,_0x45573d,_0x54b7d8){return new BPromise(function(_0x49f527,_0x115228){return client[_0x8aee('0xc')](_0x38e095,_0x54b7d8)['then'](function(_0x820d6c){logger[_0x8aee('0xd')](_0x8aee('0xe'),_0x45573d,'request\x20sent');logger['debug'](_0x8aee('0xf'),_0x45573d,_0x8aee('0x10'),JSON[_0x8aee('0x11')](_0x820d6c));if(_0x820d6c[_0x8aee('0x12')]){if(_0x820d6c['error'][_0x8aee('0x13')]===0x1f4){logger['error'](_0x8aee('0xe'),_0x45573d,_0x820d6c['error'][_0x8aee('0x14')]);return _0x115228(_0x820d6c[_0x8aee('0x12')][_0x8aee('0x14')]);}logger[_0x8aee('0x12')](_0x8aee('0xe'),_0x45573d,_0x820d6c[_0x8aee('0x12')][_0x8aee('0x14')]);return _0x49f527(_0x820d6c[_0x8aee('0x12')][_0x8aee('0x14')]);}else{logger[_0x8aee('0xd')](_0x8aee('0xe'),_0x45573d,_0x8aee('0x10'));_0x49f527(_0x820d6c[_0x8aee('0x15')][_0x8aee('0x14')]);}})[_0x8aee('0x16')](function(_0x54f877){logger['error'](_0x8aee('0xe'),_0x45573d,_0x54f877);_0x115228(_0x54f877);});});} \ No newline at end of file +var _0x736b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0xb26308,_0xb6375c){var _0xd9bb27=function(_0x62df66){while(--_0x62df66){_0xb26308['push'](_0xb26308['shift']());}};_0xd9bb27(++_0xb6375c);}(_0x736b,0xb3));var _0xb736=function(_0x12de90,_0x4c0239){_0x12de90=_0x12de90-0x0;var _0x280503=_0x736b[_0x12de90];return _0x280503;};'use strict';var _=require(_0xb736('0x0'));var util=require(_0xb736('0x1'));var moment=require(_0xb736('0x2'));var BPromise=require(_0xb736('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb736('0x4'));var db=require(_0xb736('0x5'))['db'];var utils=require(_0xb736('0x6'));var logger=require('../../config/logger')(_0xb736('0x7'));var config=require(_0xb736('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb736('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31bac4,_0x10fd52,_0x38c570){return new BPromise(function(_0x417061,_0x5e9e12){return client[_0xb736('0xa')](_0x31bac4,_0x38c570)['then'](function(_0xd8d7c8){logger[_0xb736('0xb')](_0xb736('0xc'),_0x10fd52,_0xb736('0xd'));logger[_0xb736('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x10fd52,_0xb736('0xd'),JSON[_0xb736('0xf')](_0xd8d7c8));if(_0xd8d7c8[_0xb736('0x10')]){if(_0xd8d7c8['error']['code']===0x1f4){logger[_0xb736('0x10')](_0xb736('0xc'),_0x10fd52,_0xd8d7c8[_0xb736('0x10')][_0xb736('0x11')]);return _0x5e9e12(_0xd8d7c8[_0xb736('0x10')][_0xb736('0x11')]);}logger[_0xb736('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x10fd52,_0xd8d7c8['error']['message']);return _0x417061(_0xd8d7c8['error']['message']);}else{logger['info'](_0xb736('0xc'),_0x10fd52,_0xb736('0xd'));_0x417061(_0xd8d7c8[_0xb736('0x12')][_0xb736('0x11')]);}})[_0xb736('0x13')](function(_0x417b0c){logger[_0xb736('0x10')](_0xb736('0xc'),_0x10fd52,_0x417b0c);_0x5e9e12(_0x417b0c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2f58988..cac5f8c 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 _0xf874=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf874,0xed));var _0x4f87=function(_0x4751d7,_0x1a497e){_0x4751d7=_0x4751d7-0x0;var _0xd07a60=_0xf874[_0x4751d7];return _0xd07a60;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f87('0x0'));var timeout=require(_0x4f87('0x1'));var express=require(_0x4f87('0x2'));var router=express[_0x4f87('0x3')]();var fs_extra=require(_0x4f87('0x4'));var auth=require(_0x4f87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4f87('0x6'));var controller=require(_0x4f87('0x7'));router[_0x4f87('0x8')]('/',auth[_0x4f87('0x9')](),controller[_0x4f87('0xa')]);router[_0x4f87('0x8')]('/:id',auth[_0x4f87('0x9')](),controller[_0x4f87('0xb')]);router['post']('/',auth[_0x4f87('0x9')](),controller[_0x4f87('0xc')]);router['put'](_0x4f87('0xd'),auth[_0x4f87('0x9')](),controller[_0x4f87('0xe')]);router[_0x4f87('0xf')](_0x4f87('0xd'),auth[_0x4f87('0x9')](),controller[_0x4f87('0x10')]);module['exports']=router; \ No newline at end of file +var _0x62da=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29e423,_0x260ef0){var _0x16a2aa=function(_0x24dd11){while(--_0x24dd11){_0x29e423['push'](_0x29e423['shift']());}};_0x16a2aa(++_0x260ef0);}(_0x62da,0xc0));var _0xa62d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62da[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa62d('0x0'));var util=require('util');var path=require(_0xa62d('0x1'));var timeout=require(_0xa62d('0x2'));var express=require(_0xa62d('0x3'));var router=express[_0xa62d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa62d('0x5'));var interaction=require(_0xa62d('0x6'));var config=require(_0xa62d('0x7'));var controller=require(_0xa62d('0x8'));router[_0xa62d('0x9')]('/',auth[_0xa62d('0xa')](),controller[_0xa62d('0xb')]);router[_0xa62d('0x9')](_0xa62d('0xc'),auth[_0xa62d('0xa')](),controller[_0xa62d('0xd')]);router[_0xa62d('0xe')]('/',auth['isAuthenticated'](),controller[_0xa62d('0xf')]);router[_0xa62d('0x10')]('/:id',auth[_0xa62d('0xa')](),controller[_0xa62d('0x11')]);router[_0xa62d('0x12')](_0xa62d('0xc'),auth[_0xa62d('0xa')](),controller['destroy']);module[_0xa62d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6db930e..85098a7 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 _0x15d7=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x5216ce,_0x142fa9){var _0x33532e=function(_0x35d2f3){while(--_0x35d2f3){_0x5216ce['push'](_0x5216ce['shift']());}};_0x33532e(++_0x142fa9);}(_0x15d7,0x13b));var _0x715d=function(_0x1ddc04,_0x5d11db){_0x1ddc04=_0x1ddc04-0x0;var _0x346490=_0x15d7[_0x1ddc04];return _0x346490;};'use strict';var Sequelize=require(_0x715d('0x0'));module[_0x715d('0x1')]={'type':{'type':Sequelize[_0x715d('0x2')](_0x715d('0x3'),_0x715d('0x4'),_0x715d('0x5'),_0x715d('0x6'),_0x715d('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x715d('0x8')]},'key':{'type':Sequelize[_0x715d('0x8')]},'keyType':{'type':Sequelize[_0x715d('0x2')](_0x715d('0x3'),_0x715d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x715d('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x715d('0x8')]},'customField':{'type':Sequelize[_0x715d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7fd=['sequelize','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x7fc97e,_0x5b4a6f){var _0x1d533f=function(_0x2439ef){while(--_0x2439ef){_0x7fc97e['push'](_0x7fc97e['shift']());}};_0x1d533f(++_0x5b4a6f);}(_0xc7fd,0xd8));var _0xdc7f=function(_0x284a47,_0x4cfb9d){_0x284a47=_0x284a47-0x0;var _0xa68aca=_0xc7fd[_0x284a47];return _0xa68aca;};'use strict';var Sequelize=require(_0xdc7f('0x0'));module[_0xdc7f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdc7f('0x2'),_0xdc7f('0x3'),'customVariable',_0xdc7f('0x4'),'picklist'),'defaultValue':_0xdc7f('0x2')},'content':{'type':Sequelize[_0xdc7f('0x5')]},'key':{'type':Sequelize[_0xdc7f('0x5')]},'keyType':{'type':Sequelize[_0xdc7f('0x6')](_0xdc7f('0x2'),_0xdc7f('0x3'),_0xdc7f('0x7'))},'keyContent':{'type':Sequelize[_0xdc7f('0x5')]},'idField':{'type':Sequelize[_0xdc7f('0x5')]},'nameField':{'type':Sequelize[_0xdc7f('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc7f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ebd2dee..75516aa 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 _0xb099=['mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0xb099,0x1ec));var _0x9b09=function(_0x25bacc,_0x1780f8){_0x25bacc=_0x25bacc-0x0;var _0x50c023=_0xb099[_0x25bacc];return _0x50c023;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b09('0x0'));var zipdir=require(_0x9b09('0x1'));var jsonpatch=require(_0x9b09('0x2'));var rp=require(_0x9b09('0x3'));var moment=require(_0x9b09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b09('0x5'));var util=require(_0x9b09('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b09('0x7'));var fs=require('fs');var fs_extra=require(_0x9b09('0x8'));var _=require(_0x9b09('0x9'));var squel=require(_0x9b09('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b09('0xb'));var deskjs=require(_0x9b09('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b09('0xd'));var authService=require(_0x9b09('0xe'));var qs=require(_0x9b09('0xf'));var as=require(_0x9b09('0x10'));var hardwareService=require(_0x9b09('0x11'));var logger=require(_0x9b09('0x12'))(_0x9b09('0x13'));var utils=require('../../config/utils');var config=require(_0x9b09('0x14'));var licenseUtil=require(_0x9b09('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c0179,_0x5062df){_0x5062df=_0x5062df||0xcc;return function(_0x2c639c){if(_0x2c639c){return _0x1c0179['sendStatus'](_0x5062df);}return _0x1c0179[_0x9b09('0x16')](_0x5062df)[_0x9b09('0x17')]();};}function respondWithResult(_0x568d2c,_0x288be0){_0x288be0=_0x288be0||0xc8;return function(_0x94d282){if(_0x94d282){return _0x568d2c['status'](_0x288be0)['json'](_0x94d282);}};}function respondWithFilteredResult(_0x14f6e1,_0x56bf48){return function(_0x47b456){if(_0x47b456){var _0x195542=typeof _0x56bf48[_0x9b09('0x18')]===_0x9b09('0x19')&&typeof _0x56bf48[_0x9b09('0x1a')]==='undefined';var _0x45dbb6=_0x47b456[_0x9b09('0x1b')];var _0x1df887=_0x195542?0x0:_0x56bf48[_0x9b09('0x18')];var _0x220471=_0x195542?_0x47b456[_0x9b09('0x1b')]:_0x56bf48[_0x9b09('0x18')]+_0x56bf48[_0x9b09('0x1a')];var _0x43d6b2;if(_0x220471>=_0x45dbb6){_0x220471=_0x45dbb6;_0x43d6b2=0xc8;}else{_0x43d6b2=0xce;}_0x14f6e1[_0x9b09('0x16')](_0x43d6b2);return _0x14f6e1['set'](_0x9b09('0x1c'),_0x1df887+'-'+_0x220471+'/'+_0x45dbb6)[_0x9b09('0x1d')](_0x47b456);}return null;};}function patchUpdates(_0x3db49b){return function(_0x37470f){try{jsonpatch[_0x9b09('0x1e')](_0x37470f,_0x3db49b,!![]);}catch(_0x132b77){return BPromise[_0x9b09('0x1f')](_0x132b77);}return _0x37470f['save']();};}function saveUpdates(_0xc2f007,_0x5144be){return function(_0x51f6a0){if(_0x51f6a0){return _0x51f6a0[_0x9b09('0x20')](_0xc2f007)[_0x9b09('0x21')](function(_0x4a2dea){return _0x4a2dea;});}return null;};}function removeEntity(_0x4195aa,_0x13ca87){return function(_0x454f00){if(_0x454f00){return _0x454f00[_0x9b09('0x22')]()['then'](function(){_0x4195aa[_0x9b09('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x550821,_0x4b03a2){return function(_0xa0b38d){if(!_0xa0b38d){_0x550821[_0x9b09('0x23')](0x194);}return _0xa0b38d;};}function handleError(_0xa18bd7,_0x5b41db){_0x5b41db=_0x5b41db||0x1f4;return function(_0x5d0738){logger['error'](_0x5d0738[_0x9b09('0x24')]);if(_0x5d0738[_0x9b09('0x25')]){delete _0x5d0738[_0x9b09('0x25')];}_0xa18bd7[_0x9b09('0x16')](_0x5b41db)[_0x9b09('0x26')](_0x5d0738);};}exports[_0x9b09('0x27')]=function(_0x5e16a2,_0x3c0dd2){var _0x102d96={},_0x9e147f={},_0x4a69c9={'count':0x0,'rows':[]};var _0x2b862b=_['map'](db[_0x9b09('0x28')][_0x9b09('0x29')],function(_0x4b4acc){return{'name':_0x4b4acc[_0x9b09('0x2a')],'type':_0x4b4acc['type'][_0x9b09('0x2b')]};});_0x9e147f[_0x9b09('0x2c')]=_[_0x9b09('0x2d')](_0x2b862b,'name');_0x9e147f['query']=_[_0x9b09('0x2e')](_0x5e16a2['query']);_0x9e147f[_0x9b09('0x2f')]=_[_0x9b09('0x30')](_0x9e147f['model'],_0x9e147f[_0x9b09('0x31')]);_0x102d96['attributes']=_[_0x9b09('0x30')](_0x9e147f[_0x9b09('0x2c')],qs[_0x9b09('0x32')](_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x32')]));_0x102d96[_0x9b09('0x33')]=_0x102d96[_0x9b09('0x33')]['length']?_0x102d96['attributes']:_0x9e147f[_0x9b09('0x2c')];if(!_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x34')](_0x9b09('0x35'))){_0x102d96['limit']=qs[_0x9b09('0x1a')](_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x1a')]);_0x102d96[_0x9b09('0x18')]=qs['offset'](_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x18')]);}_0x102d96['order']=qs[_0x9b09('0x36')](_0x5e16a2['query']['sort']);_0x102d96[_0x9b09('0x37')]=qs[_0x9b09('0x2f')](_[_0x9b09('0x38')](_0x5e16a2[_0x9b09('0x31')],_0x9e147f[_0x9b09('0x2f')]),_0x2b862b);if(_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x39')]){_0x102d96[_0x9b09('0x37')]=_['merge'](_0x102d96[_0x9b09('0x37')],{'$or':_[_0x9b09('0x2d')](_0x2b862b,function(_0x27d490){if(_0x27d490[_0x9b09('0x3a')]!==_0x9b09('0x3b')){var _0x5d744d={};_0x5d744d[_0x27d490['name']]={'$like':'%'+_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x39')]+'%'};return _0x5d744d;}})});}_0x102d96=_['merge']({},_0x102d96,_0x5e16a2['options']);var _0x2327b8={'where':_0x102d96[_0x9b09('0x37')]};return db['FreshsalesField'][_0x9b09('0x1b')](_0x2327b8)[_0x9b09('0x21')](function(_0x39586d){_0x4a69c9[_0x9b09('0x1b')]=_0x39586d;if(_0x5e16a2[_0x9b09('0x31')][_0x9b09('0x3c')]){_0x102d96[_0x9b09('0x3d')]=[{'all':!![]}];}return db[_0x9b09('0x28')][_0x9b09('0x3e')](_0x102d96);})['then'](function(_0x437cb6){_0x4a69c9[_0x9b09('0x3f')]=_0x437cb6;return _0x4a69c9;})[_0x9b09('0x21')](respondWithFilteredResult(_0x3c0dd2,_0x102d96))[_0x9b09('0x40')](handleError(_0x3c0dd2,null));};exports[_0x9b09('0x41')]=function(_0x22319a,_0x39cbdc){var _0x4fa5b3={'raw':!![],'where':{'id':_0x22319a['params']['id']}},_0x2d1ad6={};_0x2d1ad6[_0x9b09('0x2c')]=_['keys'](db[_0x9b09('0x28')][_0x9b09('0x29')]);_0x2d1ad6[_0x9b09('0x31')]=_['keys'](_0x22319a['query']);_0x2d1ad6[_0x9b09('0x2f')]=_[_0x9b09('0x30')](_0x2d1ad6[_0x9b09('0x2c')],_0x2d1ad6[_0x9b09('0x31')]);_0x4fa5b3[_0x9b09('0x33')]=_[_0x9b09('0x30')](_0x2d1ad6['model'],qs[_0x9b09('0x32')](_0x22319a[_0x9b09('0x31')]['fields']));_0x4fa5b3[_0x9b09('0x33')]=_0x4fa5b3[_0x9b09('0x33')]['length']?_0x4fa5b3[_0x9b09('0x33')]:_0x2d1ad6[_0x9b09('0x2c')];if(_0x22319a[_0x9b09('0x31')]['includeAll']){_0x4fa5b3['include']=[{'all':!![]}];}_0x4fa5b3=_[_0x9b09('0x42')]({},_0x4fa5b3,_0x22319a['options']);return db[_0x9b09('0x28')][_0x9b09('0x43')](_0x4fa5b3)['then'](handleEntityNotFound(_0x39cbdc,null))['then'](respondWithResult(_0x39cbdc,null))[_0x9b09('0x40')](handleError(_0x39cbdc,null));};exports[_0x9b09('0x44')]=function(_0xdf6596,_0x19f5fc){return db[_0x9b09('0x28')][_0x9b09('0x44')](_0xdf6596[_0x9b09('0x45')],{})[_0x9b09('0x21')](respondWithResult(_0x19f5fc,0xc9))[_0x9b09('0x40')](handleError(_0x19f5fc,null));};exports[_0x9b09('0x20')]=function(_0x5e58eb,_0x1ab12c){if(_0x5e58eb[_0x9b09('0x45')]['id']){delete _0x5e58eb['body']['id'];}return db[_0x9b09('0x28')][_0x9b09('0x43')]({'where':{'id':_0x5e58eb[_0x9b09('0x46')]['id']}})[_0x9b09('0x21')](handleEntityNotFound(_0x1ab12c,null))[_0x9b09('0x21')](saveUpdates(_0x5e58eb[_0x9b09('0x45')],null))['then'](respondWithResult(_0x1ab12c,null))['catch'](handleError(_0x1ab12c,null));};exports[_0x9b09('0x22')]=function(_0xdb0976,_0x2177aa){return db['FreshsalesField'][_0x9b09('0x43')]({'where':{'id':_0xdb0976[_0x9b09('0x46')]['id']}})[_0x9b09('0x21')](handleEntityNotFound(_0x2177aa,null))['then'](removeEntity(_0x2177aa,null))[_0x9b09('0x40')](handleError(_0x2177aa,null));}; \ No newline at end of file +var _0xe469=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','FreshsalesField','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4811a4,_0x3034b1){var _0xc1dcf2=function(_0x39865d){while(--_0x39865d){_0x4811a4['push'](_0x4811a4['shift']());}};_0xc1dcf2(++_0x3034b1);}(_0xe469,0x7e));var _0x9e46=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xe469[_0x247fa1];return _0x244f35;};'use strict';var emlformat=require(_0x9e46('0x0'));var rimraf=require(_0x9e46('0x1'));var zipdir=require(_0x9e46('0x2'));var jsonpatch=require(_0x9e46('0x3'));var rp=require(_0x9e46('0x4'));var moment=require(_0x9e46('0x5'));var BPromise=require(_0x9e46('0x6'));var Mustache=require(_0x9e46('0x7'));var util=require(_0x9e46('0x8'));var path=require(_0x9e46('0x9'));var sox=require(_0x9e46('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e46('0xb'));var squel=require(_0x9e46('0xc'));var crypto=require(_0x9e46('0xd'));var jsforce=require(_0x9e46('0xe'));var deskjs=require(_0x9e46('0xf'));var toCsv=require(_0x9e46('0x10'));var querystring=require(_0x9e46('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e46('0x12'));var qs=require(_0x9e46('0x13'));var as=require(_0x9e46('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e46('0x15'))(_0x9e46('0x16'));var utils=require(_0x9e46('0x17'));var config=require(_0x9e46('0x18'));var licenseUtil=require(_0x9e46('0x19'));var db=require(_0x9e46('0x1a'))['db'];function respondWithStatusCode(_0x391435,_0x591a9b){_0x591a9b=_0x591a9b||0xcc;return function(_0x25c4a8){if(_0x25c4a8){return _0x391435[_0x9e46('0x1b')](_0x591a9b);}return _0x391435[_0x9e46('0x1c')](_0x591a9b)[_0x9e46('0x1d')]();};}function respondWithResult(_0x2ab039,_0x3786cf){_0x3786cf=_0x3786cf||0xc8;return function(_0x591d3a){if(_0x591d3a){return _0x2ab039[_0x9e46('0x1c')](_0x3786cf)[_0x9e46('0x1e')](_0x591d3a);}};}function respondWithFilteredResult(_0x5184bc,_0x5aa885){return function(_0x43d3f9){if(_0x43d3f9){var _0x53a212=typeof _0x5aa885[_0x9e46('0x1f')]===_0x9e46('0x20')&&typeof _0x5aa885[_0x9e46('0x21')]==='undefined';var _0x2092bb=_0x43d3f9[_0x9e46('0x22')];var _0x43e3ad=_0x53a212?0x0:_0x5aa885[_0x9e46('0x1f')];var _0x3af3d6=_0x53a212?_0x43d3f9[_0x9e46('0x22')]:_0x5aa885[_0x9e46('0x1f')]+_0x5aa885['limit'];var _0x4270a3;if(_0x3af3d6>=_0x2092bb){_0x3af3d6=_0x2092bb;_0x4270a3=0xc8;}else{_0x4270a3=0xce;}_0x5184bc[_0x9e46('0x1c')](_0x4270a3);return _0x5184bc[_0x9e46('0x23')](_0x9e46('0x24'),_0x43e3ad+'-'+_0x3af3d6+'/'+_0x2092bb)[_0x9e46('0x1e')](_0x43d3f9);}return null;};}function patchUpdates(_0x9ba44){return function(_0x521548){try{jsonpatch[_0x9e46('0x25')](_0x521548,_0x9ba44,!![]);}catch(_0x29ec34){return BPromise[_0x9e46('0x26')](_0x29ec34);}return _0x521548[_0x9e46('0x27')]();};}function saveUpdates(_0x4d68a8,_0x4f233b){return function(_0x3f8dbe){if(_0x3f8dbe){return _0x3f8dbe[_0x9e46('0x28')](_0x4d68a8)[_0x9e46('0x29')](function(_0x345739){return _0x345739;});}return null;};}function removeEntity(_0x3e3d3b,_0x4f4c94){return function(_0xf1c860){if(_0xf1c860){return _0xf1c860['destroy']()[_0x9e46('0x29')](function(){_0x3e3d3b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2870d1,_0x3c10b4){return function(_0x49548f){if(!_0x49548f){_0x2870d1[_0x9e46('0x1b')](0x194);}return _0x49548f;};}function handleError(_0x480da1,_0x422cb8){_0x422cb8=_0x422cb8||0x1f4;return function(_0x422617){logger[_0x9e46('0x2a')](_0x422617['stack']);if(_0x422617[_0x9e46('0x2b')]){delete _0x422617[_0x9e46('0x2b')];}_0x480da1[_0x9e46('0x1c')](_0x422cb8)[_0x9e46('0x2c')](_0x422617);};}exports[_0x9e46('0x2d')]=function(_0x61be8d,_0x2278d4){var _0x19c439={},_0x542e18={},_0x4da391={'count':0x0,'rows':[]};var _0x424e67=_[_0x9e46('0x2e')](db['FreshsalesField'][_0x9e46('0x2f')],function(_0x50ea62){return{'name':_0x50ea62[_0x9e46('0x30')],'type':_0x50ea62[_0x9e46('0x31')][_0x9e46('0x32')]};});_0x542e18[_0x9e46('0x33')]=_['map'](_0x424e67,_0x9e46('0x2b'));_0x542e18[_0x9e46('0x34')]=_[_0x9e46('0x35')](_0x61be8d[_0x9e46('0x34')]);_0x542e18['filters']=_[_0x9e46('0x36')](_0x542e18[_0x9e46('0x33')],_0x542e18['query']);_0x19c439[_0x9e46('0x37')]=_[_0x9e46('0x36')](_0x542e18[_0x9e46('0x33')],qs[_0x9e46('0x38')](_0x61be8d['query'][_0x9e46('0x38')]));_0x19c439[_0x9e46('0x37')]=_0x19c439[_0x9e46('0x37')][_0x9e46('0x39')]?_0x19c439[_0x9e46('0x37')]:_0x542e18['model'];if(!_0x61be8d[_0x9e46('0x34')]['hasOwnProperty'](_0x9e46('0x3a'))){_0x19c439[_0x9e46('0x21')]=qs['limit'](_0x61be8d[_0x9e46('0x34')][_0x9e46('0x21')]);_0x19c439[_0x9e46('0x1f')]=qs['offset'](_0x61be8d['query']['offset']);}_0x19c439['order']=qs[_0x9e46('0x3b')](_0x61be8d[_0x9e46('0x34')][_0x9e46('0x3b')]);_0x19c439[_0x9e46('0x3c')]=qs[_0x9e46('0x3d')](_[_0x9e46('0x3e')](_0x61be8d[_0x9e46('0x34')],_0x542e18[_0x9e46('0x3d')]),_0x424e67);if(_0x61be8d[_0x9e46('0x34')][_0x9e46('0x3f')]){_0x19c439[_0x9e46('0x3c')]=_[_0x9e46('0x40')](_0x19c439['where'],{'$or':_[_0x9e46('0x2e')](_0x424e67,function(_0x1e220d){if(_0x1e220d[_0x9e46('0x31')]!=='VIRTUAL'){var _0x19e9f7={};_0x19e9f7[_0x1e220d['name']]={'$like':'%'+_0x61be8d[_0x9e46('0x34')][_0x9e46('0x3f')]+'%'};return _0x19e9f7;}})});}_0x19c439=_['merge']({},_0x19c439,_0x61be8d[_0x9e46('0x41')]);var _0xfde5c9={'where':_0x19c439['where']};return db['FreshsalesField'][_0x9e46('0x22')](_0xfde5c9)['then'](function(_0x16e625){_0x4da391[_0x9e46('0x22')]=_0x16e625;if(_0x61be8d[_0x9e46('0x34')][_0x9e46('0x42')]){_0x19c439[_0x9e46('0x43')]=[{'all':!![]}];}return db[_0x9e46('0x44')][_0x9e46('0x45')](_0x19c439);})[_0x9e46('0x29')](function(_0x49d43e){_0x4da391[_0x9e46('0x46')]=_0x49d43e;return _0x4da391;})[_0x9e46('0x29')](respondWithFilteredResult(_0x2278d4,_0x19c439))['catch'](handleError(_0x2278d4,null));};exports[_0x9e46('0x47')]=function(_0x1ab26b,_0x2a8b3d){var _0x54bdf3={'raw':!![],'where':{'id':_0x1ab26b[_0x9e46('0x48')]['id']}},_0x3f34e8={};_0x3f34e8[_0x9e46('0x33')]=_[_0x9e46('0x35')](db['FreshsalesField'][_0x9e46('0x2f')]);_0x3f34e8[_0x9e46('0x34')]=_[_0x9e46('0x35')](_0x1ab26b[_0x9e46('0x34')]);_0x3f34e8[_0x9e46('0x3d')]=_['intersection'](_0x3f34e8['model'],_0x3f34e8[_0x9e46('0x34')]);_0x54bdf3[_0x9e46('0x37')]=_['intersection'](_0x3f34e8[_0x9e46('0x33')],qs[_0x9e46('0x38')](_0x1ab26b[_0x9e46('0x34')][_0x9e46('0x38')]));_0x54bdf3[_0x9e46('0x37')]=_0x54bdf3[_0x9e46('0x37')]['length']?_0x54bdf3[_0x9e46('0x37')]:_0x3f34e8['model'];if(_0x1ab26b['query'][_0x9e46('0x42')]){_0x54bdf3[_0x9e46('0x43')]=[{'all':!![]}];}_0x54bdf3=_[_0x9e46('0x40')]({},_0x54bdf3,_0x1ab26b['options']);return db[_0x9e46('0x44')][_0x9e46('0x49')](_0x54bdf3)[_0x9e46('0x29')](handleEntityNotFound(_0x2a8b3d,null))[_0x9e46('0x29')](respondWithResult(_0x2a8b3d,null))[_0x9e46('0x4a')](handleError(_0x2a8b3d,null));};exports[_0x9e46('0x4b')]=function(_0x319151,_0x2c0924){return db[_0x9e46('0x44')][_0x9e46('0x4b')](_0x319151['body'],{})[_0x9e46('0x29')](respondWithResult(_0x2c0924,0xc9))[_0x9e46('0x4a')](handleError(_0x2c0924,null));};exports[_0x9e46('0x28')]=function(_0x5a412c,_0x568a6f){if(_0x5a412c[_0x9e46('0x4c')]['id']){delete _0x5a412c[_0x9e46('0x4c')]['id'];}return db[_0x9e46('0x44')][_0x9e46('0x49')]({'where':{'id':_0x5a412c[_0x9e46('0x48')]['id']}})[_0x9e46('0x29')](handleEntityNotFound(_0x568a6f,null))[_0x9e46('0x29')](saveUpdates(_0x5a412c[_0x9e46('0x4c')],null))[_0x9e46('0x29')](respondWithResult(_0x568a6f,null))[_0x9e46('0x4a')](handleError(_0x568a6f,null));};exports[_0x9e46('0x4d')]=function(_0x55e8f7,_0xa3a3e2){return db['FreshsalesField'][_0x9e46('0x49')]({'where':{'id':_0x55e8f7[_0x9e46('0x48')]['id']}})['then'](handleEntityNotFound(_0xa3a3e2,null))[_0x9e46('0x29')](removeEntity(_0xa3a3e2,null))[_0x9e46('0x4a')](handleError(_0xa3a3e2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 19c28da..8855814 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 _0xb4f8=['idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xb4f8,0x83));var _0x8b4f=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xb4f8[_0x484c03];return _0x294127;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var logger=require(_0x8b4f('0x1'))(_0x8b4f('0x2'));var moment=require(_0x8b4f('0x3'));var BPromise=require(_0x8b4f('0x4'));var rp=require(_0x8b4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b4f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b4f('0x7'));module[_0x8b4f('0x8')]=function(_0x533e63,_0x17e04f){return _0x533e63[_0x8b4f('0x9')]('FreshsalesField',attributes,{'tableName':_0x8b4f('0xa'),'paranoid':![],'indexes':[{'name':_0x8b4f('0xb'),'fields':[_0x8b4f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x955f=['util','../../config/logger','api','moment','request-promise','../../config/environment','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash'];(function(_0x1d80b7,_0xc3da5a){var _0xf32ffe=function(_0x5a8580){while(--_0x5a8580){_0x1d80b7['push'](_0x1d80b7['shift']());}};_0xf32ffe(++_0xc3da5a);}(_0x955f,0x1eb));var _0xf955=function(_0x20dc14,_0x58b364){_0x20dc14=_0x20dc14-0x0;var _0x294744=_0x955f[_0x20dc14];return _0x294744;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf955('0xa'),_0xf955('0xb')],'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 6e98e81..130c972 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x4b5f7a,_0x1b7fb6){var _0x3ce598=function(_0x468459){while(--_0x468459){_0x4b5f7a['push'](_0x4b5f7a['shift']());}};_0x3ce598(++_0x1b7fb6);}(_0x4819,0xcd));var _0x9481=function(_0x1baef6,_0x104b34){_0x1baef6=_0x1baef6-0x0;var _0x5f34a6=_0x4819[_0x1baef6];return _0x5f34a6;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1fa770,_0x327e40){var _0x28b05f=function(_0x55d8b1){while(--_0x55d8b1){_0x1fa770['push'](_0x1fa770['shift']());}};_0x28b05f(++_0x327e40);}(_0x2ef3,0xba));var _0x32ef=function(_0x23b68f,_0x34714e){_0x23b68f=_0x23b68f-0x0;var _0x95cd1d=_0x2ef3[_0x23b68f];return _0x95cd1d;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f710bc7..e4afdf2 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(_0x1155f7,_0xc3472b){var _0x3a1696=function(_0x4a3bde){while(--_0x4a3bde){_0x1155f7['push'](_0x1155f7['shift']());}};_0x3a1696(++_0xc3472b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xaff72f,_0x4817e7){var _0x304a05=function(_0x154cc7){while(--_0x154cc7){_0xaff72f['push'](_0xaff72f['shift']());}};_0x304a05(++_0x4817e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a3cda37..45aa346 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 _0x2b38=['newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x3c4c80,_0x4e317a){var _0x26bacf=function(_0x1c30c1){while(--_0x1c30c1){_0x3c4c80['push'](_0x3c4c80['shift']());}};_0x26bacf(++_0x4e317a);}(_0x2b38,0x19f));var _0x82b3=function(_0x427dc9,_0x1bbee2){_0x427dc9=_0x427dc9-0x0;var _0x537482=_0x2b38[_0x427dc9];return _0x537482;};'use strict';var Sequelize=require(_0x82b3('0x0'));module[_0x82b3('0x1')]={'name':{'type':Sequelize[_0x82b3('0x2')]},'description':{'type':Sequelize[_0x82b3('0x2')]},'username':{'type':Sequelize[_0x82b3('0x2')],'unique':_0x82b3('0x3')},'remoteUri':{'type':Sequelize[_0x82b3('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x82b3('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x82b3('0x4')]('integrationTab',_0x82b3('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x77e6=['ENUM','newTab','sequelize','exports','STRING','username'];(function(_0x12db90,_0x5166ca){var _0x5e868e=function(_0x21b7e1){while(--_0x21b7e1){_0x12db90['push'](_0x12db90['shift']());}};_0x5e868e(++_0x5166ca);}(_0x77e6,0x1a6));var _0x677e=function(_0x4d14dc,_0x294fc0){_0x4d14dc=_0x4d14dc-0x0;var _0x206aec=_0x77e6[_0x4d14dc];return _0x206aec;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'remoteUri':{'type':Sequelize[_0x677e('0x2')]},'password':{'type':Sequelize[_0x677e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x677e('0x2')]},'securityToken':{'type':Sequelize[_0x677e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x677e('0x4')]('integrationTab',_0x677e('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 f29cff9..a4a84da 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 _0xd6b6=['body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','describe','OwnerId','IsReminderSet','Description','int','email','textarea','phone','remove','includes','label','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','error','send','index','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','catch','params','SalesforceAccount','options','find','create'];(function(_0x5dd84e,_0x35686d){var _0x58ae32=function(_0xfa28b5){while(--_0xfa28b5){_0x5dd84e['push'](_0x5dd84e['shift']());}};_0x58ae32(++_0x35686d);}(_0xd6b6,0x197));var _0x6d6b=function(_0x52b985,_0x2742f0){_0x52b985=_0x52b985-0x0;var _0x3b273b=_0xd6b6[_0x52b985];return _0x3b273b;};'use strict';var emlformat=require(_0x6d6b('0x0'));var rimraf=require(_0x6d6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d6b('0x2'));var rp=require('request-promise');var moment=require(_0x6d6b('0x3'));var BPromise=require(_0x6d6b('0x4'));var Mustache=require('mustache');var util=require(_0x6d6b('0x5'));var path=require(_0x6d6b('0x6'));var sox=require('sox');var csv=require(_0x6d6b('0x7'));var ejs=require(_0x6d6b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d6b('0x9'));var jsforce=require(_0x6d6b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6d6b('0x7'));var querystring=require(_0x6d6b('0xb'));var Papa=require('papaparse');var Redis=require(_0x6d6b('0xc'));var authService=require(_0x6d6b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6d6b('0xe'));var hardwareService=require(_0x6d6b('0xf'));var logger=require(_0x6d6b('0x10'))(_0x6d6b('0x11'));var utils=require(_0x6d6b('0x12'));var config=require(_0x6d6b('0x13'));var licenseUtil=require(_0x6d6b('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d6b('0x15'));function respondWithStatusCode(_0x591122,_0x46118d){_0x46118d=_0x46118d||0xcc;return function(_0x4d1413){if(_0x4d1413){return _0x591122['sendStatus'](_0x46118d);}return _0x591122[_0x6d6b('0x16')](_0x46118d)[_0x6d6b('0x17')]();};}function respondWithResult(_0x34185b,_0x5d7fe7){_0x5d7fe7=_0x5d7fe7||0xc8;return function(_0x3e96bb){if(_0x3e96bb){return _0x34185b[_0x6d6b('0x16')](_0x5d7fe7)[_0x6d6b('0x18')](_0x3e96bb);}};}function respondWithFilteredResult(_0x45bb28,_0xeb73be){return function(_0x368dd7){if(_0x368dd7){var _0x276df9=typeof _0xeb73be[_0x6d6b('0x19')]===_0x6d6b('0x1a')&&typeof _0xeb73be[_0x6d6b('0x1b')]===_0x6d6b('0x1a');var _0x8d0ef7=_0x368dd7['count'];var _0x5b8d68=_0x276df9?0x0:_0xeb73be[_0x6d6b('0x19')];var _0x102ca1=_0x276df9?_0x368dd7['count']:_0xeb73be[_0x6d6b('0x19')]+_0xeb73be['limit'];var _0x30492a;if(_0x102ca1>=_0x8d0ef7){_0x102ca1=_0x8d0ef7;_0x30492a=0xc8;}else{_0x30492a=0xce;}_0x45bb28[_0x6d6b('0x16')](_0x30492a);return _0x45bb28[_0x6d6b('0x1c')](_0x6d6b('0x1d'),_0x5b8d68+'-'+_0x102ca1+'/'+_0x8d0ef7)[_0x6d6b('0x18')](_0x368dd7);}return null;};}function patchUpdates(_0x54b11f){return function(_0x59a695){try{jsonpatch['apply'](_0x59a695,_0x54b11f,!![]);}catch(_0x3d0013){return BPromise['reject'](_0x3d0013);}return _0x59a695[_0x6d6b('0x1e')]();};}function saveUpdates(_0x355009,_0x318912){return function(_0x205dd0){if(_0x205dd0){return _0x205dd0[_0x6d6b('0x1f')](_0x355009)[_0x6d6b('0x20')](function(_0x309e08){return _0x309e08;});}return null;};}function removeEntity(_0x481ba4,_0x14432a){return function(_0x1a82ca){if(_0x1a82ca){return _0x1a82ca['destroy']()['then'](function(){_0x481ba4[_0x6d6b('0x16')](0xcc)[_0x6d6b('0x17')]();});}};}function handleEntityNotFound(_0x5b00eb,_0x4c9c93){return function(_0x5d088d){if(!_0x5d088d){_0x5b00eb['sendStatus'](0x194);}return _0x5d088d;};}function handleError(_0x360db6,_0x5475ed){_0x5475ed=_0x5475ed||0x1f4;return function(_0x5d7221){logger[_0x6d6b('0x21')](_0x5d7221['stack']);if(_0x5d7221['name']){delete _0x5d7221['name'];}_0x360db6[_0x6d6b('0x16')](_0x5475ed)[_0x6d6b('0x22')](_0x5d7221);};}exports[_0x6d6b('0x23')]=function(_0x92e057,_0x37741c){var _0x584742={},_0x4ba122={},_0x418115={'count':0x0,'rows':[]};var _0x3ef97a=_['map'](db['SalesforceAccount'][_0x6d6b('0x24')],function(_0x9d8c03){return{'name':_0x9d8c03[_0x6d6b('0x25')],'type':_0x9d8c03[_0x6d6b('0x26')][_0x6d6b('0x27')]};});_0x4ba122[_0x6d6b('0x28')]=_['map'](_0x3ef97a,_0x6d6b('0x29'));_0x4ba122['query']=_[_0x6d6b('0x2a')](_0x92e057[_0x6d6b('0x2b')]);_0x4ba122['filters']=_[_0x6d6b('0x2c')](_0x4ba122[_0x6d6b('0x28')],_0x4ba122[_0x6d6b('0x2b')]);_0x584742['attributes']=_['intersection'](_0x4ba122[_0x6d6b('0x28')],qs[_0x6d6b('0x2d')](_0x92e057['query'][_0x6d6b('0x2d')]));_0x584742[_0x6d6b('0x2e')]=_0x584742['attributes'][_0x6d6b('0x2f')]?_0x584742['attributes']:_0x4ba122['model'];if(!_0x92e057[_0x6d6b('0x2b')][_0x6d6b('0x30')](_0x6d6b('0x31'))){_0x584742[_0x6d6b('0x1b')]=qs[_0x6d6b('0x1b')](_0x92e057['query'][_0x6d6b('0x1b')]);_0x584742[_0x6d6b('0x19')]=qs[_0x6d6b('0x19')](_0x92e057[_0x6d6b('0x2b')]['offset']);}_0x584742[_0x6d6b('0x32')]=qs['sort'](_0x92e057[_0x6d6b('0x2b')][_0x6d6b('0x33')]);_0x584742[_0x6d6b('0x34')]=qs[_0x6d6b('0x35')](_[_0x6d6b('0x36')](_0x92e057[_0x6d6b('0x2b')],_0x4ba122[_0x6d6b('0x35')]),_0x3ef97a);if(_0x92e057[_0x6d6b('0x2b')][_0x6d6b('0x37')]){_0x584742[_0x6d6b('0x34')]=_[_0x6d6b('0x38')](_0x584742[_0x6d6b('0x34')],{'$or':_[_0x6d6b('0x39')](_0x3ef97a,function(_0xa4a708){if(_0xa4a708['type']!==_0x6d6b('0x3a')){var _0x2d7ae9={};_0x2d7ae9[_0xa4a708['name']]={'$like':'%'+_0x92e057[_0x6d6b('0x2b')][_0x6d6b('0x37')]+'%'};return _0x2d7ae9;}})});}_0x584742=_[_0x6d6b('0x38')]({},_0x584742,_0x92e057['options']);var _0x4bb101={'where':_0x584742[_0x6d6b('0x34')]};return db['SalesforceAccount']['count'](_0x4bb101)[_0x6d6b('0x20')](function(_0x7bf727){_0x418115[_0x6d6b('0x3b')]=_0x7bf727;if(_0x92e057[_0x6d6b('0x2b')][_0x6d6b('0x3c')]){_0x584742[_0x6d6b('0x3d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x6d6b('0x3e')](_0x584742);})[_0x6d6b('0x20')](function(_0x2ff8b0){_0x418115['rows']=_0x2ff8b0;return _0x418115;})[_0x6d6b('0x20')](respondWithFilteredResult(_0x37741c,_0x584742))[_0x6d6b('0x3f')](handleError(_0x37741c,null));};exports['show']=function(_0x7b2ffc,_0x4b9f2a){var _0x572fe6={'raw':![],'where':{'id':_0x7b2ffc[_0x6d6b('0x40')]['id']}},_0x1c2d60={};_0x1c2d60['model']=_[_0x6d6b('0x2a')](db[_0x6d6b('0x41')][_0x6d6b('0x24')]);_0x1c2d60[_0x6d6b('0x2b')]=_[_0x6d6b('0x2a')](_0x7b2ffc[_0x6d6b('0x2b')]);_0x1c2d60[_0x6d6b('0x35')]=_[_0x6d6b('0x2c')](_0x1c2d60['model'],_0x1c2d60[_0x6d6b('0x2b')]);_0x572fe6['attributes']=_[_0x6d6b('0x2c')](_0x1c2d60[_0x6d6b('0x28')],qs['fields'](_0x7b2ffc['query']['fields']));_0x572fe6[_0x6d6b('0x2e')]=_0x572fe6[_0x6d6b('0x2e')][_0x6d6b('0x2f')]?_0x572fe6[_0x6d6b('0x2e')]:_0x1c2d60[_0x6d6b('0x28')];if(_0x7b2ffc['query']['includeAll']){_0x572fe6[_0x6d6b('0x3d')]=[{'all':!![]}];}_0x572fe6=_[_0x6d6b('0x38')]({},_0x572fe6,_0x7b2ffc[_0x6d6b('0x42')]);return db[_0x6d6b('0x41')][_0x6d6b('0x43')](_0x572fe6)[_0x6d6b('0x20')](handleEntityNotFound(_0x4b9f2a,null))[_0x6d6b('0x20')](respondWithResult(_0x4b9f2a,null))[_0x6d6b('0x3f')](handleError(_0x4b9f2a,null));};exports[_0x6d6b('0x44')]=function(_0x4add77,_0x1fb8ac){return db['SalesforceAccount']['create'](_0x4add77[_0x6d6b('0x45')],{})[_0x6d6b('0x20')](respondWithResult(_0x1fb8ac,0xc9))[_0x6d6b('0x3f')](handleError(_0x1fb8ac,null));};exports['update']=function(_0x283621,_0x559fab){if(_0x283621[_0x6d6b('0x45')]['id']){delete _0x283621[_0x6d6b('0x45')]['id'];}return db[_0x6d6b('0x41')][_0x6d6b('0x43')]({'where':{'id':_0x283621[_0x6d6b('0x40')]['id']}})[_0x6d6b('0x20')](handleEntityNotFound(_0x559fab,null))[_0x6d6b('0x20')](saveUpdates(_0x283621[_0x6d6b('0x45')],null))[_0x6d6b('0x20')](respondWithResult(_0x559fab,null))['catch'](handleError(_0x559fab,null));};exports['destroy']=function(_0x6cac33,_0x41063b){return db['SalesforceAccount']['find']({'where':{'id':_0x6cac33['params']['id']}})[_0x6d6b('0x20')](handleEntityNotFound(_0x41063b,null))[_0x6d6b('0x20')](removeEntity(_0x41063b,null))['catch'](handleError(_0x41063b,null));};exports[_0x6d6b('0x46')]=function(_0xe299f1,_0x568a0f,_0x58d123){var _0x225117={};var _0x134f21={};var _0x3a8106;var _0x5cc196;return db[_0x6d6b('0x41')][_0x6d6b('0x47')]({'where':{'id':_0xe299f1[_0x6d6b('0x40')]['id']}})[_0x6d6b('0x20')](handleEntityNotFound(_0x568a0f,null))['then'](function(_0x2b1724){if(_0x2b1724){_0x3a8106=_0x2b1724;_0x134f21[_0x6d6b('0x28')]=_[_0x6d6b('0x2a')](db[_0x6d6b('0x48')][_0x6d6b('0x24')]);_0x134f21[_0x6d6b('0x2b')]=_[_0x6d6b('0x2a')](_0xe299f1[_0x6d6b('0x2b')]);_0x134f21[_0x6d6b('0x35')]=_[_0x6d6b('0x2c')](_0x134f21[_0x6d6b('0x28')],_0x134f21['query']);_0x225117[_0x6d6b('0x2e')]=_[_0x6d6b('0x2c')](_0x134f21[_0x6d6b('0x28')],qs[_0x6d6b('0x2d')](_0xe299f1[_0x6d6b('0x2b')]['fields']));_0x225117[_0x6d6b('0x2e')]=_0x225117[_0x6d6b('0x2e')][_0x6d6b('0x2f')]?_0x225117['attributes']:_0x134f21[_0x6d6b('0x28')];_0x225117[_0x6d6b('0x32')]=qs[_0x6d6b('0x33')](_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x33')]);_0x225117[_0x6d6b('0x34')]=qs['filters'](_[_0x6d6b('0x36')](_0xe299f1[_0x6d6b('0x2b')],_0x134f21['filters']));if(_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x37')]){_0x225117[_0x6d6b('0x34')]=_[_0x6d6b('0x38')](_0x225117[_0x6d6b('0x34')],{'$or':_[_0x6d6b('0x39')](_0x225117[_0x6d6b('0x2e')],function(_0x3745f2){var _0x5a69c0={};_0x5a69c0[_0x3745f2]={'$like':'%'+_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x37')]+'%'};return _0x5a69c0;})});}_0x225117=_[_0x6d6b('0x38')]({},_0x225117,_0xe299f1['options']);return _0x3a8106[_0x6d6b('0x46')](_0x225117);}})[_0x6d6b('0x20')](function(_0xb1da14){if(_0xb1da14){_0x5cc196=_0xb1da14[_0x6d6b('0x2f')];if(!_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x30')](_0x6d6b('0x31'))){_0x225117[_0x6d6b('0x1b')]=qs[_0x6d6b('0x1b')](_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x1b')]);_0x225117[_0x6d6b('0x19')]=qs[_0x6d6b('0x19')](_0xe299f1[_0x6d6b('0x2b')][_0x6d6b('0x19')]);}return _0x3a8106[_0x6d6b('0x46')](_0x225117);}})[_0x6d6b('0x20')](function(_0x438c75){if(_0x438c75){return _0x438c75?{'count':_0x5cc196,'rows':_0x438c75}:null;}})['then'](respondWithResult(_0x568a0f,null))[_0x6d6b('0x3f')](handleError(_0x568a0f,null));};exports[_0x6d6b('0x49')]=function(_0x46840f,_0x243adc,_0x590044){if(_0x46840f[_0x6d6b('0x45')]['id']){delete _0x46840f[_0x6d6b('0x45')]['id'];}return db[_0x6d6b('0x41')][_0x6d6b('0x47')]({'where':{'id':_0x46840f['params']['id']}})[_0x6d6b('0x20')](handleEntityNotFound(_0x243adc,null))['then'](function(_0x4811b7){if(_0x4811b7){_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x4a')]=_0x4811b7['id'];_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x4b')]=integrations[_0x6d6b('0x4c')](_0x46840f['body']['channel'],_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x26')]);_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x4d')]=integrations[_0x6d6b('0x4e')](_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x4f')],_0x46840f[_0x6d6b('0x45')][_0x6d6b('0x26')]);return db['SalesforceConfiguration']['create'](_0x46840f[_0x6d6b('0x45')],{'include':[{'model':db[_0x6d6b('0x50')],'as':_0x6d6b('0x4b')},{'model':db[_0x6d6b('0x50')],'as':_0x6d6b('0x4d')}]});}return null;})[_0x6d6b('0x20')](respondWithResult(_0x243adc,null))['catch'](handleError(_0x243adc,null));};exports['getFields']=function(_0x409025,_0x368b7e,_0x5d18a5){var _0x1a2d45;var _0x5eb1f='';var _0xa851e8=_0x6d6b('0x51');return db['SalesforceAccount'][_0x6d6b('0x47')]({'where':{'id':_0x409025[_0x6d6b('0x40')]['id']},'attributes':['id',_0x6d6b('0x52'),_0x6d6b('0x53'),_0x6d6b('0x54'),_0x6d6b('0x55'),_0x6d6b('0x56'),_0x6d6b('0x57')]})[_0x6d6b('0x20')](handleEntityNotFound(_0x368b7e,null))['then'](function(_0x4c2375){if(_0x4c2375){_0x5eb1f=_0x4c2375[_0x6d6b('0x52')];var _0x1212e4=_0x5eb1f[_0x6d6b('0x58')](-0x1);if(_0x1212e4==='/'){_0x5eb1f=_0x5eb1f[_0x6d6b('0x59')](0x0,_0x5eb1f[_0x6d6b('0x5a')](_0x1212e4));}_0x1a2d45=new jsforce[(_0x6d6b('0x5b'))]({'oauth2':{'loginUrl':_0x5eb1f,'clientId':_0x4c2375[_0x6d6b('0x53')],'clientSecret':_0x4c2375[_0x6d6b('0x54')]}});return _0x1a2d45['login'](_0x4c2375[_0x6d6b('0x55')],_0x4c2375[_0x6d6b('0x56')][_0x6d6b('0x5c')](_0x4c2375[_0x6d6b('0x57')]));}})[_0x6d6b('0x20')](function(_0x4535c2){if(_0x4535c2){if(!_[_0x6d6b('0x5d')](_0x409025[_0x6d6b('0x2b')]['ticketType'])){_0xa851e8=_0x409025[_0x6d6b('0x2b')][_0x6d6b('0x5e')];}return _0x1a2d45['sobject'](_0xa851e8)[_0x6d6b('0x5f')]();}})[_0x6d6b('0x20')](function(_0x1a9e68){var _0xb840fe=[_0x6d6b('0x60'),'ActivityDate',_0x6d6b('0x61'),'IsRecurrence','Subject',_0x6d6b('0x62')];var _0x2b902b=['string',_0x6d6b('0x63'),'picklist','boolean',_0x6d6b('0x64'),_0x6d6b('0x65'),_0x6d6b('0x66')];if(_0x1a9e68){_[_0x6d6b('0x67')](_0x1a9e68[_0x6d6b('0x2d')],function(_0x1e5191){return _0xb840fe[_0x6d6b('0x68')](_0x1e5191[_0x6d6b('0x29')])||!_0x2b902b['includes'](_0x1e5191[_0x6d6b('0x26')]);});return{'count':_0x1a9e68[_0x6d6b('0x2d')]['length'],'rows':_[_0x6d6b('0x39')](_0x1a9e68['fields'],function(_0x2b4d56){return{'id':_0x2b4d56[_0x6d6b('0x29')],'name':_0x2b4d56[_0x6d6b('0x69')],'custom':_0x2b4d56['custom'],'options':_0x2b4d56[_0x6d6b('0x6a')][_0x6d6b('0x2f')]>0x0?_[_0x6d6b('0x39')](_0x2b4d56[_0x6d6b('0x6a')],function(_0x4d2e53){return{'name':_0x4d2e53[_0x6d6b('0x69')],'value':_0x4d2e53[_0x6d6b('0x6b')]};}):_0x2b4d56[_0x6d6b('0x26')]==_0x6d6b('0x6c')?[{'name':_0x6d6b('0x6d'),'value':_0x6d6b('0x6e')},{'name':_0x6d6b('0x6f'),'value':_0x6d6b('0x70')}]:[]};})};}})[_0x6d6b('0x20')](respondWithResult(_0x368b7e,null))['catch'](function(_0xe22f2){var _0x3c0e7d=_0x409025[_0x6d6b('0x2b')][_0x6d6b('0x71')]?0x1f4:_0xe22f2[_0x6d6b('0x72')]||0x1f4;logger[_0x6d6b('0x21')](_0x6d6b('0x73'),_0x6d6b('0x74'),_0x3c0e7d,JSON[_0x6d6b('0x75')](_0xe22f2));delete _0xe22f2['name'];if(_0x3c0e7d===0x191){_0x3c0e7d=0x190;}_0x368b7e[_0x6d6b('0x16')](_0x3c0e7d)['send'](_0x409025[_0x6d6b('0x2b')]['test']?{'message':_0x6d6b('0x76'),'statusCode':_0xe22f2['statusCode']}:_0xe22f2);});}; \ No newline at end of file +var _0xc305=['rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','update','then','error','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','boolean','textarea','phone','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format'];(function(_0x1890e0,_0x1ab8e9){var _0x477f94=function(_0x2975ae){while(--_0x2975ae){_0x1890e0['push'](_0x1890e0['shift']());}};_0x477f94(++_0x1ab8e9);}(_0xc305,0xf7));var _0x5c30=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xc305[_0x4fe19c];return _0x952ac7;};'use strict';var emlformat=require(_0x5c30('0x0'));var rimraf=require(_0x5c30('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c30('0x2'));var rp=require(_0x5c30('0x3'));var moment=require(_0x5c30('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c30('0x5'));var util=require('util');var path=require(_0x5c30('0x6'));var sox=require('sox');var csv=require(_0x5c30('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c30('0x8'));var squel=require(_0x5c30('0x9'));var crypto=require(_0x5c30('0xa'));var jsforce=require(_0x5c30('0xb'));var deskjs=require(_0x5c30('0xc'));var toCsv=require(_0x5c30('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c30('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5c30('0xe'));var as=require(_0x5c30('0xf'));var hardwareService=require(_0x5c30('0x10'));var logger=require(_0x5c30('0x11'))(_0x5c30('0x12'));var utils=require(_0x5c30('0x13'));var config=require(_0x5c30('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c30('0x15'))['db'];var integrations=require(_0x5c30('0x16'));function respondWithStatusCode(_0xbd7fdc,_0x511af2){_0x511af2=_0x511af2||0xcc;return function(_0x34bc43){if(_0x34bc43){return _0xbd7fdc[_0x5c30('0x17')](_0x511af2);}return _0xbd7fdc[_0x5c30('0x18')](_0x511af2)[_0x5c30('0x19')]();};}function respondWithResult(_0x3b3e80,_0x1e2aa1){_0x1e2aa1=_0x1e2aa1||0xc8;return function(_0x3ffbf4){if(_0x3ffbf4){return _0x3b3e80[_0x5c30('0x18')](_0x1e2aa1)['json'](_0x3ffbf4);}};}function respondWithFilteredResult(_0xbabef9,_0x2cab0b){return function(_0x20da86){if(_0x20da86){var _0x34fe8e=typeof _0x2cab0b[_0x5c30('0x1a')]===_0x5c30('0x1b')&&typeof _0x2cab0b[_0x5c30('0x1c')]===_0x5c30('0x1b');var _0x5ba79a=_0x20da86[_0x5c30('0x1d')];var _0x136bec=_0x34fe8e?0x0:_0x2cab0b[_0x5c30('0x1a')];var _0x17502a=_0x34fe8e?_0x20da86[_0x5c30('0x1d')]:_0x2cab0b['offset']+_0x2cab0b[_0x5c30('0x1c')];var _0xb703f9;if(_0x17502a>=_0x5ba79a){_0x17502a=_0x5ba79a;_0xb703f9=0xc8;}else{_0xb703f9=0xce;}_0xbabef9[_0x5c30('0x18')](_0xb703f9);return _0xbabef9[_0x5c30('0x1e')](_0x5c30('0x1f'),_0x136bec+'-'+_0x17502a+'/'+_0x5ba79a)[_0x5c30('0x20')](_0x20da86);}return null;};}function patchUpdates(_0x1b7c91){return function(_0x5e38be){try{jsonpatch[_0x5c30('0x21')](_0x5e38be,_0x1b7c91,!![]);}catch(_0x150cd9){return BPromise[_0x5c30('0x22')](_0x150cd9);}return _0x5e38be['save']();};}function saveUpdates(_0x49c646,_0x5bf5a0){return function(_0x16b07b){if(_0x16b07b){return _0x16b07b[_0x5c30('0x23')](_0x49c646)[_0x5c30('0x24')](function(_0xbb891f){return _0xbb891f;});}return null;};}function removeEntity(_0x5dbe3a,_0x36b983){return function(_0x42037d){if(_0x42037d){return _0x42037d['destroy']()[_0x5c30('0x24')](function(){_0x5dbe3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x582a9d,_0x10ce63){return function(_0x58011c){if(!_0x58011c){_0x582a9d['sendStatus'](0x194);}return _0x58011c;};}function handleError(_0x3ce37b,_0x50d7d1){_0x50d7d1=_0x50d7d1||0x1f4;return function(_0x59dacd){logger[_0x5c30('0x25')](_0x59dacd['stack']);if(_0x59dacd['name']){delete _0x59dacd[_0x5c30('0x26')];}_0x3ce37b['status'](_0x50d7d1)[_0x5c30('0x27')](_0x59dacd);};}exports[_0x5c30('0x28')]=function(_0x51b69f,_0x12d9e2){var _0x1b8c7b={},_0x3310d4={},_0x461240={'count':0x0,'rows':[]};var _0x238bdb=_[_0x5c30('0x29')](db['SalesforceAccount']['rawAttributes'],function(_0x204a79){return{'name':_0x204a79[_0x5c30('0x2a')],'type':_0x204a79[_0x5c30('0x2b')]['key']};});_0x3310d4[_0x5c30('0x2c')]=_['map'](_0x238bdb,_0x5c30('0x26'));_0x3310d4['query']=_[_0x5c30('0x2d')](_0x51b69f[_0x5c30('0x2e')]);_0x3310d4[_0x5c30('0x2f')]=_['intersection'](_0x3310d4[_0x5c30('0x2c')],_0x3310d4['query']);_0x1b8c7b[_0x5c30('0x30')]=_[_0x5c30('0x31')](_0x3310d4['model'],qs[_0x5c30('0x32')](_0x51b69f[_0x5c30('0x2e')][_0x5c30('0x32')]));_0x1b8c7b[_0x5c30('0x30')]=_0x1b8c7b['attributes'][_0x5c30('0x33')]?_0x1b8c7b[_0x5c30('0x30')]:_0x3310d4['model'];if(!_0x51b69f[_0x5c30('0x2e')][_0x5c30('0x34')](_0x5c30('0x35'))){_0x1b8c7b['limit']=qs[_0x5c30('0x1c')](_0x51b69f[_0x5c30('0x2e')][_0x5c30('0x1c')]);_0x1b8c7b[_0x5c30('0x1a')]=qs[_0x5c30('0x1a')](_0x51b69f['query'][_0x5c30('0x1a')]);}_0x1b8c7b['order']=qs[_0x5c30('0x36')](_0x51b69f[_0x5c30('0x2e')]['sort']);_0x1b8c7b[_0x5c30('0x37')]=qs[_0x5c30('0x2f')](_['pick'](_0x51b69f[_0x5c30('0x2e')],_0x3310d4[_0x5c30('0x2f')]),_0x238bdb);if(_0x51b69f[_0x5c30('0x2e')][_0x5c30('0x38')]){_0x1b8c7b[_0x5c30('0x37')]=_[_0x5c30('0x39')](_0x1b8c7b[_0x5c30('0x37')],{'$or':_[_0x5c30('0x29')](_0x238bdb,function(_0x56eba2){if(_0x56eba2[_0x5c30('0x2b')]!==_0x5c30('0x3a')){var _0x7f5bed={};_0x7f5bed[_0x56eba2[_0x5c30('0x26')]]={'$like':'%'+_0x51b69f[_0x5c30('0x2e')]['filter']+'%'};return _0x7f5bed;}})});}_0x1b8c7b=_[_0x5c30('0x39')]({},_0x1b8c7b,_0x51b69f[_0x5c30('0x3b')]);var _0x384b7c={'where':_0x1b8c7b[_0x5c30('0x37')]};return db[_0x5c30('0x3c')][_0x5c30('0x1d')](_0x384b7c)['then'](function(_0xbbdb9b){_0x461240[_0x5c30('0x1d')]=_0xbbdb9b;if(_0x51b69f[_0x5c30('0x2e')][_0x5c30('0x3d')]){_0x1b8c7b['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x5c30('0x3e')](_0x1b8c7b);})['then'](function(_0x1e2c09){_0x461240['rows']=_0x1e2c09;return _0x461240;})[_0x5c30('0x24')](respondWithFilteredResult(_0x12d9e2,_0x1b8c7b))[_0x5c30('0x3f')](handleError(_0x12d9e2,null));};exports[_0x5c30('0x40')]=function(_0xfc7380,_0x404a02){var _0x39527e={'raw':![],'where':{'id':_0xfc7380['params']['id']}},_0x5adb16={};_0x5adb16[_0x5c30('0x2c')]=_['keys'](db['SalesforceAccount'][_0x5c30('0x41')]);_0x5adb16[_0x5c30('0x2e')]=_['keys'](_0xfc7380[_0x5c30('0x2e')]);_0x5adb16[_0x5c30('0x2f')]=_['intersection'](_0x5adb16['model'],_0x5adb16[_0x5c30('0x2e')]);_0x39527e[_0x5c30('0x30')]=_[_0x5c30('0x31')](_0x5adb16[_0x5c30('0x2c')],qs[_0x5c30('0x32')](_0xfc7380[_0x5c30('0x2e')][_0x5c30('0x32')]));_0x39527e[_0x5c30('0x30')]=_0x39527e['attributes']['length']?_0x39527e[_0x5c30('0x30')]:_0x5adb16[_0x5c30('0x2c')];if(_0xfc7380['query']['includeAll']){_0x39527e[_0x5c30('0x42')]=[{'all':!![]}];}_0x39527e=_[_0x5c30('0x39')]({},_0x39527e,_0xfc7380[_0x5c30('0x3b')]);return db[_0x5c30('0x3c')][_0x5c30('0x43')](_0x39527e)[_0x5c30('0x24')](handleEntityNotFound(_0x404a02,null))[_0x5c30('0x24')](respondWithResult(_0x404a02,null))[_0x5c30('0x3f')](handleError(_0x404a02,null));};exports[_0x5c30('0x44')]=function(_0x183cde,_0x5ca0c3){return db[_0x5c30('0x3c')][_0x5c30('0x44')](_0x183cde['body'],{})['then'](respondWithResult(_0x5ca0c3,0xc9))[_0x5c30('0x3f')](handleError(_0x5ca0c3,null));};exports['update']=function(_0x3b125c,_0x4f47c4){if(_0x3b125c[_0x5c30('0x45')]['id']){delete _0x3b125c[_0x5c30('0x45')]['id'];}return db['SalesforceAccount'][_0x5c30('0x43')]({'where':{'id':_0x3b125c[_0x5c30('0x46')]['id']}})[_0x5c30('0x24')](handleEntityNotFound(_0x4f47c4,null))[_0x5c30('0x24')](saveUpdates(_0x3b125c[_0x5c30('0x45')],null))[_0x5c30('0x24')](respondWithResult(_0x4f47c4,null))[_0x5c30('0x3f')](handleError(_0x4f47c4,null));};exports[_0x5c30('0x47')]=function(_0x2e7e46,_0x2d5069){return db[_0x5c30('0x3c')]['find']({'where':{'id':_0x2e7e46[_0x5c30('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d5069,null))[_0x5c30('0x24')](removeEntity(_0x2d5069,null))[_0x5c30('0x3f')](handleError(_0x2d5069,null));};exports[_0x5c30('0x48')]=function(_0x21d157,_0x1d3234,_0x492356){var _0x36d4b4={};var _0x216c12={};var _0x41cf2d;var _0x1cc7cf;return db[_0x5c30('0x3c')][_0x5c30('0x49')]({'where':{'id':_0x21d157[_0x5c30('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d3234,null))[_0x5c30('0x24')](function(_0x40629c){if(_0x40629c){_0x41cf2d=_0x40629c;_0x216c12[_0x5c30('0x2c')]=_[_0x5c30('0x2d')](db[_0x5c30('0x4a')][_0x5c30('0x41')]);_0x216c12[_0x5c30('0x2e')]=_['keys'](_0x21d157[_0x5c30('0x2e')]);_0x216c12['filters']=_[_0x5c30('0x31')](_0x216c12['model'],_0x216c12[_0x5c30('0x2e')]);_0x36d4b4['attributes']=_[_0x5c30('0x31')](_0x216c12[_0x5c30('0x2c')],qs['fields'](_0x21d157[_0x5c30('0x2e')][_0x5c30('0x32')]));_0x36d4b4[_0x5c30('0x30')]=_0x36d4b4[_0x5c30('0x30')][_0x5c30('0x33')]?_0x36d4b4[_0x5c30('0x30')]:_0x216c12[_0x5c30('0x2c')];_0x36d4b4[_0x5c30('0x4b')]=qs[_0x5c30('0x36')](_0x21d157[_0x5c30('0x2e')]['sort']);_0x36d4b4['where']=qs[_0x5c30('0x2f')](_[_0x5c30('0x4c')](_0x21d157[_0x5c30('0x2e')],_0x216c12['filters']));if(_0x21d157[_0x5c30('0x2e')][_0x5c30('0x38')]){_0x36d4b4['where']=_[_0x5c30('0x39')](_0x36d4b4['where'],{'$or':_[_0x5c30('0x29')](_0x36d4b4['attributes'],function(_0xc88e83){var _0x3614c6={};_0x3614c6[_0xc88e83]={'$like':'%'+_0x21d157[_0x5c30('0x2e')][_0x5c30('0x38')]+'%'};return _0x3614c6;})});}_0x36d4b4=_[_0x5c30('0x39')]({},_0x36d4b4,_0x21d157[_0x5c30('0x3b')]);return _0x41cf2d['getConfigurations'](_0x36d4b4);}})[_0x5c30('0x24')](function(_0x4a2b9e){if(_0x4a2b9e){_0x1cc7cf=_0x4a2b9e['length'];if(!_0x21d157['query'][_0x5c30('0x34')]('nolimit')){_0x36d4b4[_0x5c30('0x1c')]=qs[_0x5c30('0x1c')](_0x21d157[_0x5c30('0x2e')][_0x5c30('0x1c')]);_0x36d4b4['offset']=qs[_0x5c30('0x1a')](_0x21d157['query'][_0x5c30('0x1a')]);}return _0x41cf2d[_0x5c30('0x48')](_0x36d4b4);}})[_0x5c30('0x24')](function(_0x95b4f8){if(_0x95b4f8){return _0x95b4f8?{'count':_0x1cc7cf,'rows':_0x95b4f8}:null;}})[_0x5c30('0x24')](respondWithResult(_0x1d3234,null))['catch'](handleError(_0x1d3234,null));};exports['addConfiguration']=function(_0x2e139e,_0x240075,_0x33b515){if(_0x2e139e[_0x5c30('0x45')]['id']){delete _0x2e139e['body']['id'];}return db[_0x5c30('0x3c')][_0x5c30('0x49')]({'where':{'id':_0x2e139e[_0x5c30('0x46')]['id']}})[_0x5c30('0x24')](handleEntityNotFound(_0x240075,null))[_0x5c30('0x24')](function(_0x33c520){if(_0x33c520){_0x2e139e[_0x5c30('0x45')][_0x5c30('0x4d')]=_0x33c520['id'];_0x2e139e['body'][_0x5c30('0x4e')]=integrations[_0x5c30('0x4f')](_0x2e139e[_0x5c30('0x45')][_0x5c30('0x50')],_0x2e139e[_0x5c30('0x45')][_0x5c30('0x2b')]);_0x2e139e[_0x5c30('0x45')][_0x5c30('0x51')]=integrations[_0x5c30('0x52')](_0x2e139e[_0x5c30('0x45')][_0x5c30('0x50')],_0x2e139e[_0x5c30('0x45')][_0x5c30('0x2b')]);return db['SalesforceConfiguration'][_0x5c30('0x44')](_0x2e139e[_0x5c30('0x45')],{'include':[{'model':db[_0x5c30('0x53')],'as':_0x5c30('0x4e')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x240075,null))[_0x5c30('0x3f')](handleError(_0x240075,null));};exports[_0x5c30('0x54')]=function(_0x5bf8ed,_0x382845,_0x5b21a2){var _0x5a1789;var _0x145002='';var _0x2639f4=_0x5c30('0x55');return db['SalesforceAccount']['findOne']({'where':{'id':_0x5bf8ed[_0x5c30('0x46')]['id']},'attributes':['id',_0x5c30('0x56'),_0x5c30('0x57'),_0x5c30('0x58'),_0x5c30('0x59'),_0x5c30('0x5a'),_0x5c30('0x5b')]})[_0x5c30('0x24')](handleEntityNotFound(_0x382845,null))[_0x5c30('0x24')](function(_0x15bbe3){if(_0x15bbe3){_0x145002=_0x15bbe3[_0x5c30('0x56')];var _0x1ee54a=_0x145002[_0x5c30('0x5c')](-0x1);if(_0x1ee54a==='/'){_0x145002=_0x145002[_0x5c30('0x5d')](0x0,_0x145002[_0x5c30('0x5e')](_0x1ee54a));}_0x5a1789=new jsforce[(_0x5c30('0x5f'))]({'oauth2':{'loginUrl':_0x145002,'clientId':_0x15bbe3[_0x5c30('0x57')],'clientSecret':_0x15bbe3[_0x5c30('0x58')]}});return _0x5a1789[_0x5c30('0x60')](_0x15bbe3[_0x5c30('0x59')],_0x15bbe3[_0x5c30('0x5a')][_0x5c30('0x61')](_0x15bbe3[_0x5c30('0x5b')]));}})[_0x5c30('0x24')](function(_0x433918){if(_0x433918){if(!_[_0x5c30('0x62')](_0x5bf8ed[_0x5c30('0x2e')][_0x5c30('0x63')])){_0x2639f4=_0x5bf8ed[_0x5c30('0x2e')][_0x5c30('0x63')];}return _0x5a1789[_0x5c30('0x64')](_0x2639f4)[_0x5c30('0x65')]();}})[_0x5c30('0x24')](function(_0x39f931){var _0x1785b9=[_0x5c30('0x66'),_0x5c30('0x67'),'IsReminderSet',_0x5c30('0x68'),_0x5c30('0x69'),'Description'];var _0x2dda28=[_0x5c30('0x6a'),_0x5c30('0x6b'),'picklist',_0x5c30('0x6c'),'email',_0x5c30('0x6d'),_0x5c30('0x6e')];if(_0x39f931){_['remove'](_0x39f931['fields'],function(_0x199b52){return _0x1785b9[_0x5c30('0x6f')](_0x199b52[_0x5c30('0x26')])||!_0x2dda28['includes'](_0x199b52[_0x5c30('0x2b')]);});return{'count':_0x39f931[_0x5c30('0x32')][_0x5c30('0x33')],'rows':_[_0x5c30('0x29')](_0x39f931[_0x5c30('0x32')],function(_0x54ae38){return{'id':_0x54ae38['name'],'name':_0x54ae38[_0x5c30('0x70')],'custom':_0x54ae38[_0x5c30('0x71')],'options':_0x54ae38[_0x5c30('0x72')][_0x5c30('0x33')]>0x0?_['map'](_0x54ae38[_0x5c30('0x72')],function(_0x58d396){return{'name':_0x58d396['label'],'value':_0x58d396[_0x5c30('0x73')]};}):_0x54ae38[_0x5c30('0x2b')]=='boolean'?[{'name':'True','value':_0x5c30('0x74')},{'name':_0x5c30('0x75'),'value':_0x5c30('0x76')}]:[]};})};}})[_0x5c30('0x24')](respondWithResult(_0x382845,null))[_0x5c30('0x3f')](function(_0x1516b4){var _0x36a0cd=_0x5bf8ed[_0x5c30('0x2e')][_0x5c30('0x77')]?0x1f4:_0x1516b4[_0x5c30('0x78')]||0x1f4;logger[_0x5c30('0x25')](_0x5c30('0x79'),_0x5c30('0x54'),_0x36a0cd,JSON[_0x5c30('0x7a')](_0x1516b4));delete _0x1516b4[_0x5c30('0x26')];if(_0x36a0cd===0x191){_0x36a0cd=0x190;}_0x382845['status'](_0x36a0cd)['send'](_0x5bf8ed[_0x5c30('0x2e')][_0x5c30('0x77')]?{'message':_0x5c30('0x7b'),'statusCode':_0x1516b4[_0x5c30('0x78')]}:_0x1516b4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 75cae64..e7c923a 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 _0xaf9b=['int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x3ce93a,_0x269884){var _0x22a37e=function(_0x30bb16){while(--_0x30bb16){_0x3ce93a['push'](_0x3ce93a['shift']());}};_0x22a37e(++_0x269884);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0xe17d4,_0xa653e8){_0xe17d4=_0xe17d4-0x0;var _0x42f47b=_0xaf9b[_0xe17d4];return _0x42f47b;};'use strict';var _=require(_0xbaf9('0x0'));var util=require('util');var logger=require(_0xbaf9('0x1'))('api');var moment=require(_0xbaf9('0x2'));var BPromise=require(_0xbaf9('0x3'));var rp=require(_0xbaf9('0x4'));var fs=require('fs');var path=require(_0xbaf9('0x5'));var rimraf=require('rimraf');var config=require(_0xbaf9('0x6'));var attributes=require(_0xbaf9('0x7'));var integrations=require(_0xbaf9('0x8'));module['exports']=function(_0x40b949,_0x3578fd){return _0x40b949['define']('SalesforceAccount',attributes,{'tableName':_0xbaf9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd43a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','util','../../config/logger','api'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xd43a,0x65));var _0xad43=function(_0xacf274,_0x1c13d9){_0xacf274=_0xacf274-0x0;var _0x1c32ab=_0xd43a[_0xacf274];return _0x1c32ab;};'use strict';var _=require('lodash');var util=require(_0xad43('0x0'));var logger=require(_0xad43('0x1'))(_0xad43('0x2'));var moment=require(_0xad43('0x3'));var BPromise=require(_0xad43('0x4'));var rp=require(_0xad43('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad43('0x6'));var config=require(_0xad43('0x7'));var attributes=require(_0xad43('0x8'));var integrations=require(_0xad43('0x9'));module[_0xad43('0xa')]=function(_0x1ea62a,_0x2acc07){return _0x1ea62a[_0xad43('0xb')](_0xad43('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 3d81e37..7ab200a 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 _0x6b77=['where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','SalesforceAccount','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b77,0xc3));var _0x76b7=function(_0x5192b9,_0x3a3d25){_0x5192b9=_0x5192b9-0x0;var _0x49c362=_0x6b77[_0x5192b9];return _0x49c362;};'use strict';var _=require(_0x76b7('0x0'));var util=require(_0x76b7('0x1'));var moment=require(_0x76b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x76b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76b7('0x5'));var config=require(_0x76b7('0x6'));var jayson=require(_0x76b7('0x7'));var client=jayson[_0x76b7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4955ce,_0x5d7011,_0x1c9981){return new BPromise(function(_0x438a31,_0x453425){return client[_0x76b7('0x9')](_0x4955ce,_0x1c9981)['then'](function(_0x2ccc5d){logger[_0x76b7('0xa')](_0x76b7('0xb'),_0x5d7011,_0x76b7('0xc'));logger[_0x76b7('0xd')](_0x76b7('0xe'),_0x5d7011,'request\x20sent',JSON[_0x76b7('0xf')](_0x2ccc5d));if(_0x2ccc5d[_0x76b7('0x10')]){if(_0x2ccc5d[_0x76b7('0x10')]['code']===0x1f4){logger[_0x76b7('0x10')](_0x76b7('0xb'),_0x5d7011,_0x2ccc5d[_0x76b7('0x10')][_0x76b7('0x11')]);return _0x453425(_0x2ccc5d[_0x76b7('0x10')][_0x76b7('0x11')]);}logger[_0x76b7('0x10')](_0x76b7('0xb'),_0x5d7011,_0x2ccc5d['error'][_0x76b7('0x11')]);return _0x438a31(_0x2ccc5d[_0x76b7('0x10')]['message']);}else{logger[_0x76b7('0xa')](_0x76b7('0xb'),_0x5d7011,_0x76b7('0xc'));_0x438a31(_0x2ccc5d['result'][_0x76b7('0x11')]);}})[_0x76b7('0x12')](function(_0x3c5c1b){logger[_0x76b7('0x10')](_0x76b7('0xb'),_0x5d7011,_0x3c5c1b);_0x453425(_0x3c5c1b);});});}exports[_0x76b7('0x13')]=function(_0x27ef3f){var _0x43bdf3=this;return new Promise(function(_0x3d40cb,_0x4593ca){return db[_0x76b7('0x14')]['findAll']({'raw':_0x27ef3f[_0x76b7('0x15')]?_0x27ef3f[_0x76b7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x27ef3f[_0x76b7('0x15')]?_0x27ef3f['options'][_0x76b7('0x16')]||null:null,'attributes':_0x27ef3f[_0x76b7('0x15')]?_0x27ef3f[_0x76b7('0x15')][_0x76b7('0x17')]||null:null,'limit':_0x27ef3f[_0x76b7('0x15')]?_0x27ef3f[_0x76b7('0x15')][_0x76b7('0x18')]||null:null,'include':_0x27ef3f['options']?_0x27ef3f[_0x76b7('0x15')][_0x76b7('0x19')]?_[_0x76b7('0x1a')](_0x27ef3f[_0x76b7('0x15')]['include'],function(_0x421508){return{'model':db[_0x421508[_0x76b7('0x1b')]],'as':_0x421508['as'],'attributes':_0x421508[_0x76b7('0x17')],'include':_0x421508[_0x76b7('0x19')]?_[_0x76b7('0x1a')](_0x421508['include'],function(_0x3fdb4e){return{'model':db[_0x3fdb4e[_0x76b7('0x1b')]],'as':_0x3fdb4e['as'],'attributes':_0x3fdb4e['attributes'],'include':_0x3fdb4e['include']?_[_0x76b7('0x1a')](_0x3fdb4e[_0x76b7('0x19')],function(_0x728a8e){return{'model':db[_0x728a8e['model']],'as':_0x728a8e['as'],'attributes':_0x728a8e[_0x76b7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x76b7('0x1c')](function(_0x3dcf39){logger[_0x76b7('0xa')](_0x76b7('0x13'),_0x27ef3f);logger[_0x76b7('0xd')](_0x76b7('0x13'),_0x27ef3f,JSON[_0x76b7('0xf')](_0x3dcf39));_0x3d40cb(_0x3dcf39);})[_0x76b7('0x12')](function(_0x5c72e2){logger[_0x76b7('0x10')](_0x76b7('0x13'),_0x5c72e2[_0x76b7('0x11')],_0x27ef3f);_0x4593ca(_0x43bdf3['error'](0x1f4,_0x5c72e2[_0x76b7('0x11')]));});});};exports[_0x76b7('0x1d')]=function(_0x1317f3){var _0x583cd4=this;return new Promise(function(_0x2c47e0,_0x22eef3){return db[_0x76b7('0x14')][_0x76b7('0x1e')]({'raw':_0x1317f3[_0x76b7('0x15')]?_0x1317f3[_0x76b7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1317f3[_0x76b7('0x15')]?_0x1317f3[_0x76b7('0x15')][_0x76b7('0x16')]||null:null,'attributes':_0x1317f3['options']?_0x1317f3[_0x76b7('0x15')][_0x76b7('0x17')]||null:null,'include':_0x1317f3['options']?_0x1317f3['options'][_0x76b7('0x19')]?_[_0x76b7('0x1a')](_0x1317f3[_0x76b7('0x15')][_0x76b7('0x19')],function(_0xf96727){return{'model':db[_0xf96727['model']],'as':_0xf96727['as'],'attributes':_0xf96727[_0x76b7('0x17')],'include':_0xf96727['include']?_[_0x76b7('0x1a')](_0xf96727[_0x76b7('0x19')],function(_0x13d006){return{'model':db[_0x13d006[_0x76b7('0x1b')]],'as':_0x13d006['as'],'attributes':_0x13d006['attributes'],'include':_0x13d006[_0x76b7('0x19')]?_[_0x76b7('0x1a')](_0x13d006[_0x76b7('0x19')],function(_0x4da5cd){return{'model':db[_0x4da5cd['model']],'as':_0x4da5cd['as'],'attributes':_0x4da5cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x76b7('0x1c')](function(_0x39c22f){logger['info']('ShowSalesforceAccount',_0x1317f3);logger[_0x76b7('0xd')](_0x76b7('0x1d'),_0x1317f3,JSON[_0x76b7('0xf')](_0x39c22f));_0x2c47e0(_0x39c22f);})['catch'](function(_0x3ddfb7){logger['error'](_0x76b7('0x1d'),_0x3ddfb7['message'],_0x1317f3);_0x22eef3(_0x583cd4['error'](0x1f4,_0x3ddfb7[_0x76b7('0x11')]));});});}; \ No newline at end of file +var _0x418f=['include','map','model','then','stringify','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit'];(function(_0x252cf2,_0x4ce265){var _0x4ce263=function(_0x12bf84){while(--_0x12bf84){_0x252cf2['push'](_0x252cf2['shift']());}};_0x4ce263(++_0x4ce265);}(_0x418f,0x116));var _0xf418=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x418f[_0x1f909a];return _0x543f16;};'use strict';var _=require(_0xf418('0x0'));var util=require(_0xf418('0x1'));var moment=require(_0xf418('0x2'));var BPromise=require(_0xf418('0x3'));var rs=require(_0xf418('0x4'));var fs=require('fs');var Redis=require(_0xf418('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf418('0x6'));var logger=require('../../config/logger')(_0xf418('0x7'));var config=require(_0xf418('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf418('0x9')][_0xf418('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5be451,_0x4cb169,_0x2d14bf){return new BPromise(function(_0x4f7124,_0x487738){return client[_0xf418('0xb')](_0x5be451,_0x2d14bf)['then'](function(_0x50d430){logger[_0xf418('0xc')](_0xf418('0xd'),_0x4cb169,_0xf418('0xe'));logger['debug'](_0xf418('0xf'),_0x4cb169,_0xf418('0xe'),JSON['stringify'](_0x50d430));if(_0x50d430[_0xf418('0x10')]){if(_0x50d430[_0xf418('0x10')][_0xf418('0x11')]===0x1f4){logger[_0xf418('0x10')](_0xf418('0xd'),_0x4cb169,_0x50d430[_0xf418('0x10')]['message']);return _0x487738(_0x50d430[_0xf418('0x10')][_0xf418('0x12')]);}logger[_0xf418('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4cb169,_0x50d430['error'][_0xf418('0x12')]);return _0x4f7124(_0x50d430['error'][_0xf418('0x12')]);}else{logger[_0xf418('0xc')](_0xf418('0xd'),_0x4cb169,_0xf418('0xe'));_0x4f7124(_0x50d430[_0xf418('0x13')][_0xf418('0x12')]);}})[_0xf418('0x14')](function(_0x28208d){logger['error'](_0xf418('0xd'),_0x4cb169,_0x28208d);_0x487738(_0x28208d);});});}exports[_0xf418('0x15')]=function(_0x2ad5da){var _0x34bdc6=this;return new Promise(function(_0x2f9b05,_0x48bb64){return db['SalesforceAccount'][_0xf418('0x16')]({'raw':_0x2ad5da[_0xf418('0x17')]?_0x2ad5da[_0xf418('0x17')][_0xf418('0x18')]===undefined?!![]:![]:!![],'where':_0x2ad5da[_0xf418('0x17')]?_0x2ad5da[_0xf418('0x17')][_0xf418('0x19')]||null:null,'attributes':_0x2ad5da['options']?_0x2ad5da[_0xf418('0x17')][_0xf418('0x1a')]||null:null,'limit':_0x2ad5da[_0xf418('0x17')]?_0x2ad5da[_0xf418('0x17')][_0xf418('0x1b')]||null:null,'include':_0x2ad5da[_0xf418('0x17')]?_0x2ad5da['options'][_0xf418('0x1c')]?_[_0xf418('0x1d')](_0x2ad5da[_0xf418('0x17')][_0xf418('0x1c')],function(_0xb47fc8){return{'model':db[_0xb47fc8[_0xf418('0x1e')]],'as':_0xb47fc8['as'],'attributes':_0xb47fc8['attributes'],'include':_0xb47fc8[_0xf418('0x1c')]?_[_0xf418('0x1d')](_0xb47fc8[_0xf418('0x1c')],function(_0x4d4663){return{'model':db[_0x4d4663['model']],'as':_0x4d4663['as'],'attributes':_0x4d4663['attributes'],'include':_0x4d4663[_0xf418('0x1c')]?_[_0xf418('0x1d')](_0x4d4663[_0xf418('0x1c')],function(_0x28ada1){return{'model':db[_0x28ada1['model']],'as':_0x28ada1['as'],'attributes':_0x28ada1['attributes']};}):[]};}):[]};}):[]:[]})[_0xf418('0x1f')](function(_0x165d71){logger[_0xf418('0xc')](_0xf418('0x15'),_0x2ad5da);logger['debug'](_0xf418('0x15'),_0x2ad5da,JSON[_0xf418('0x20')](_0x165d71));_0x2f9b05(_0x165d71);})[_0xf418('0x14')](function(_0x66f50b){logger[_0xf418('0x10')]('GetSalesforceAccount',_0x66f50b[_0xf418('0x12')],_0x2ad5da);_0x48bb64(_0x34bdc6[_0xf418('0x10')](0x1f4,_0x66f50b['message']));});});};exports[_0xf418('0x21')]=function(_0x424f5e){var _0x35d7e8=this;return new Promise(function(_0x394ba8,_0x13bc1b){return db['SalesforceAccount']['find']({'raw':_0x424f5e[_0xf418('0x17')]?_0x424f5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x424f5e['options']?_0x424f5e[_0xf418('0x17')][_0xf418('0x19')]||null:null,'attributes':_0x424f5e[_0xf418('0x17')]?_0x424f5e[_0xf418('0x17')][_0xf418('0x1a')]||null:null,'include':_0x424f5e[_0xf418('0x17')]?_0x424f5e[_0xf418('0x17')][_0xf418('0x1c')]?_[_0xf418('0x1d')](_0x424f5e[_0xf418('0x17')][_0xf418('0x1c')],function(_0x3523c0){return{'model':db[_0x3523c0[_0xf418('0x1e')]],'as':_0x3523c0['as'],'attributes':_0x3523c0['attributes'],'include':_0x3523c0[_0xf418('0x1c')]?_[_0xf418('0x1d')](_0x3523c0[_0xf418('0x1c')],function(_0x54bece){return{'model':db[_0x54bece['model']],'as':_0x54bece['as'],'attributes':_0x54bece[_0xf418('0x1a')],'include':_0x54bece[_0xf418('0x1c')]?_[_0xf418('0x1d')](_0x54bece[_0xf418('0x1c')],function(_0x1f61c0){return{'model':db[_0x1f61c0[_0xf418('0x1e')]],'as':_0x1f61c0['as'],'attributes':_0x1f61c0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57386a){logger[_0xf418('0xc')](_0xf418('0x21'),_0x424f5e);logger['debug'](_0xf418('0x21'),_0x424f5e,JSON[_0xf418('0x20')](_0x57386a));_0x394ba8(_0x57386a);})[_0xf418('0x14')](function(_0x4ce613){logger[_0xf418('0x10')]('ShowSalesforceAccount',_0x4ce613[_0xf418('0x12')],_0x424f5e);_0x13bc1b(_0x35d7e8[_0xf418('0x10')](0x1f4,_0x4ce613['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 37490fd..a241be0 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x52448c,_0x15d790){var _0x57d3e5=function(_0x14d02e){while(--_0x14d02e){_0x52448c['push'](_0x52448c['shift']());}};_0x57d3e5(++_0x15d790);}(_0xadb5,0xad));var _0x5adb=function(_0x6696d6,_0xfaaf0a){_0x6696d6=_0x6696d6-0x0;var _0x226213=_0xadb5[_0x6696d6];return _0x226213;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x4bb4b3,_0x23c6aa){var _0x2967bf=function(_0x5b4855){while(--_0x5b4855){_0x4bb4b3['push'](_0x4bb4b3['shift']());}};_0x2967bf(++_0x23c6aa);}(_0x7a54,0x106));var _0x47a5=function(_0x3825f0,_0x72b932){_0x3825f0=_0x3825f0-0x0;var _0x23efae=_0x7a54[_0x3825f0];return _0x23efae;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a7e0504..6e35370 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 _0x9464=['contact_lead','contact','lead','account_contact_lead','account','exports','STRING','ENUM','Task','Case'];(function(_0x18ea8a,_0x32f09f){var _0x19c99a=function(_0x21d8d6){while(--_0x21d8d6){_0x18ea8a['push'](_0x18ea8a['shift']());}};_0x19c99a(++_0x32f09f);}(_0x9464,0xd7));var _0x4946=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x9464[_0x515afd];return _0x536d53;};'use strict';var Sequelize=require('sequelize');module[_0x4946('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4946('0x1')]},'ticketType':{'type':Sequelize[_0x4946('0x2')](_0x4946('0x3'),_0x4946('0x4')),'defaultValue':_0x4946('0x3')},'moduleSearch':{'type':Sequelize[_0x4946('0x2')](_0x4946('0x5'),_0x4946('0x6'),_0x4946('0x7'),_0x4946('0x8'),_0x4946('0x9')),'defaultValue':_0x4946('0x5')},'moduleCreate':{'type':Sequelize[_0x4946('0x2')]('nothing',_0x4946('0x6'),'lead',_0x4946('0x9')),'defaultValue':_0x4946('0x7')},'leadId':{'type':Sequelize[_0x4946('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x4946('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x4946('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x4946('0x1')]}}; \ No newline at end of file +var _0x0de8=['ENUM','Task','Case','contact','lead','account_contact_lead','contact_lead','account','STRING','sequelize'];(function(_0x19f3ad,_0x27f666){var _0x1ad5ae=function(_0x456255){while(--_0x456255){_0x19f3ad['push'](_0x19f3ad['shift']());}};_0x1ad5ae(++_0x27f666);}(_0x0de8,0x1e9));var _0x80de=function(_0x2abf7f,_0x23b05a){_0x2abf7f=_0x2abf7f-0x0;var _0x248bce=_0x0de8[_0x2abf7f];return _0x248bce;};'use strict';var Sequelize=require(_0x80de('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x80de('0x1')](_0x80de('0x2'),_0x80de('0x3')),'defaultValue':_0x80de('0x2')},'moduleSearch':{'type':Sequelize[_0x80de('0x1')]('contact_lead',_0x80de('0x4'),_0x80de('0x5'),_0x80de('0x6'),'account'),'defaultValue':_0x80de('0x7')},'moduleCreate':{'type':Sequelize[_0x80de('0x1')]('nothing',_0x80de('0x4'),'lead',_0x80de('0x8')),'defaultValue':_0x80de('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x80de('0x9')]},'additionalSearchContact':{'type':Sequelize[_0x80de('0x9')]},'additionalSearchLead':{'type':Sequelize[_0x80de('0x9')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4bc2a85..1f711ed 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 _0x5f45=['create','body','find','length','filter','getFields','getSubjects','findOne','getDescriptions','SalesforceField','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x5f45,0xfd));var _0x55f4=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x5f45[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0x55f4('0x0'));var rimraf=require(_0x55f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x55f4('0x2'));var BPromise=require(_0x55f4('0x3'));var Mustache=require(_0x55f4('0x4'));var util=require(_0x55f4('0x5'));var path=require(_0x55f4('0x6'));var sox=require('sox');var csv=require(_0x55f4('0x7'));var ejs=require(_0x55f4('0x8'));var fs=require('fs');var fs_extra=require(_0x55f4('0x9'));var _=require(_0x55f4('0xa'));var squel=require(_0x55f4('0xb'));var crypto=require('crypto');var jsforce=require(_0x55f4('0xc'));var deskjs=require(_0x55f4('0xd'));var toCsv=require(_0x55f4('0x7'));var querystring=require(_0x55f4('0xe'));var Papa=require(_0x55f4('0xf'));var Redis=require(_0x55f4('0x10'));var authService=require(_0x55f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x55f4('0x12'));var utils=require(_0x55f4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x55f4('0x14'));var db=require(_0x55f4('0x15'))['db'];function respondWithStatusCode(_0x3a459c,_0x3c91df){_0x3c91df=_0x3c91df||0xcc;return function(_0x5b21b7){if(_0x5b21b7){return _0x3a459c[_0x55f4('0x16')](_0x3c91df);}return _0x3a459c[_0x55f4('0x17')](_0x3c91df)['end']();};}function respondWithResult(_0x1670bb,_0x6c3634){_0x6c3634=_0x6c3634||0xc8;return function(_0x4b2b23){if(_0x4b2b23){return _0x1670bb[_0x55f4('0x17')](_0x6c3634)[_0x55f4('0x18')](_0x4b2b23);}};}function respondWithFilteredResult(_0x15dae6,_0xef6a55){return function(_0x5ce3f5){if(_0x5ce3f5){var _0x4a9531=typeof _0xef6a55[_0x55f4('0x19')]==='undefined'&&typeof _0xef6a55['limit']===_0x55f4('0x1a');var _0x364386=_0x5ce3f5[_0x55f4('0x1b')];var _0x18b6cd=_0x4a9531?0x0:_0xef6a55[_0x55f4('0x19')];var _0x1ec73b=_0x4a9531?_0x5ce3f5['count']:_0xef6a55[_0x55f4('0x19')]+_0xef6a55[_0x55f4('0x1c')];var _0x157546;if(_0x1ec73b>=_0x364386){_0x1ec73b=_0x364386;_0x157546=0xc8;}else{_0x157546=0xce;}_0x15dae6['status'](_0x157546);return _0x15dae6[_0x55f4('0x1d')](_0x55f4('0x1e'),_0x18b6cd+'-'+_0x1ec73b+'/'+_0x364386)[_0x55f4('0x18')](_0x5ce3f5);}return null;};}function patchUpdates(_0x26f683){return function(_0x36e727){try{jsonpatch[_0x55f4('0x1f')](_0x36e727,_0x26f683,!![]);}catch(_0x5e63d3){return BPromise[_0x55f4('0x20')](_0x5e63d3);}return _0x36e727[_0x55f4('0x21')]();};}function saveUpdates(_0x570d46,_0x20a1dd){return function(_0x52954d){if(_0x52954d){return _0x52954d[_0x55f4('0x22')](_0x570d46)[_0x55f4('0x23')](function(_0x48a310){return _0x48a310;});}return null;};}function removeEntity(_0x333f7c,_0x1fa129){return function(_0x1d04d1){if(_0x1d04d1){return _0x1d04d1[_0x55f4('0x24')]()[_0x55f4('0x23')](function(){_0x333f7c[_0x55f4('0x17')](0xcc)[_0x55f4('0x25')]();});}};}function handleEntityNotFound(_0x34b853,_0x7625db){return function(_0x46c29f){if(!_0x46c29f){_0x34b853[_0x55f4('0x16')](0x194);}return _0x46c29f;};}function handleError(_0x69abe8,_0x5677ce){_0x5677ce=_0x5677ce||0x1f4;return function(_0x1307e2){logger[_0x55f4('0x26')](_0x1307e2[_0x55f4('0x27')]);if(_0x1307e2['name']){delete _0x1307e2[_0x55f4('0x28')];}_0x69abe8[_0x55f4('0x17')](_0x5677ce)[_0x55f4('0x29')](_0x1307e2);};}exports[_0x55f4('0x2a')]=function(_0x4b2544,_0x3ce083){var _0x47cd36={},_0x4a5884={},_0x294c5e={'count':0x0,'rows':[]};var _0x35bd32=_['map'](db[_0x55f4('0x2b')][_0x55f4('0x2c')],function(_0x214816){return{'name':_0x214816[_0x55f4('0x2d')],'type':_0x214816[_0x55f4('0x2e')]['key']};});_0x4a5884[_0x55f4('0x2f')]=_[_0x55f4('0x30')](_0x35bd32,_0x55f4('0x28'));_0x4a5884[_0x55f4('0x31')]=_[_0x55f4('0x32')](_0x4b2544[_0x55f4('0x31')]);_0x4a5884[_0x55f4('0x33')]=_[_0x55f4('0x34')](_0x4a5884[_0x55f4('0x2f')],_0x4a5884[_0x55f4('0x31')]);_0x47cd36[_0x55f4('0x35')]=_['intersection'](_0x4a5884[_0x55f4('0x2f')],qs['fields'](_0x4b2544[_0x55f4('0x31')][_0x55f4('0x36')]));_0x47cd36[_0x55f4('0x35')]=_0x47cd36[_0x55f4('0x35')]['length']?_0x47cd36[_0x55f4('0x35')]:_0x4a5884['model'];if(!_0x4b2544['query'][_0x55f4('0x37')](_0x55f4('0x38'))){_0x47cd36[_0x55f4('0x1c')]=qs[_0x55f4('0x1c')](_0x4b2544[_0x55f4('0x31')][_0x55f4('0x1c')]);_0x47cd36[_0x55f4('0x19')]=qs[_0x55f4('0x19')](_0x4b2544[_0x55f4('0x31')]['offset']);}_0x47cd36[_0x55f4('0x39')]=qs[_0x55f4('0x3a')](_0x4b2544[_0x55f4('0x31')][_0x55f4('0x3a')]);_0x47cd36[_0x55f4('0x3b')]=qs[_0x55f4('0x33')](_[_0x55f4('0x3c')](_0x4b2544[_0x55f4('0x31')],_0x4a5884[_0x55f4('0x33')]),_0x35bd32);if(_0x4b2544[_0x55f4('0x31')]['filter']){_0x47cd36[_0x55f4('0x3b')]=_[_0x55f4('0x3d')](_0x47cd36[_0x55f4('0x3b')],{'$or':_['map'](_0x35bd32,function(_0x5ec032){if(_0x5ec032[_0x55f4('0x2e')]!==_0x55f4('0x3e')){var _0x3b433e={};_0x3b433e[_0x5ec032['name']]={'$like':'%'+_0x4b2544[_0x55f4('0x31')]['filter']+'%'};return _0x3b433e;}})});}_0x47cd36=_[_0x55f4('0x3d')]({},_0x47cd36,_0x4b2544[_0x55f4('0x3f')]);var _0x46dc9f={'where':_0x47cd36[_0x55f4('0x3b')]};return db[_0x55f4('0x2b')][_0x55f4('0x1b')](_0x46dc9f)[_0x55f4('0x23')](function(_0x40d5a1){_0x294c5e['count']=_0x40d5a1;if(_0x4b2544[_0x55f4('0x31')][_0x55f4('0x40')]){_0x47cd36[_0x55f4('0x41')]=[{'all':!![]}];}return db[_0x55f4('0x2b')][_0x55f4('0x42')](_0x47cd36);})[_0x55f4('0x23')](function(_0x15a461){_0x294c5e[_0x55f4('0x43')]=_0x15a461;return _0x294c5e;})[_0x55f4('0x23')](respondWithFilteredResult(_0x3ce083,_0x47cd36))['catch'](handleError(_0x3ce083,null));};exports[_0x55f4('0x44')]=function(_0x3f37e4,_0x315b9e){var _0x2bb2a8={'raw':![],'where':{'id':_0x3f37e4[_0x55f4('0x45')]['id']}},_0x1ac6ca={};_0x1ac6ca[_0x55f4('0x2f')]=_['keys'](db[_0x55f4('0x2b')][_0x55f4('0x2c')]);_0x1ac6ca[_0x55f4('0x31')]=_[_0x55f4('0x32')](_0x3f37e4[_0x55f4('0x31')]);_0x1ac6ca['filters']=_[_0x55f4('0x34')](_0x1ac6ca[_0x55f4('0x2f')],_0x1ac6ca[_0x55f4('0x31')]);_0x2bb2a8[_0x55f4('0x35')]=_['intersection'](_0x1ac6ca[_0x55f4('0x2f')],qs['fields'](_0x3f37e4[_0x55f4('0x31')]['fields']));_0x2bb2a8['attributes']=_0x2bb2a8[_0x55f4('0x35')]['length']?_0x2bb2a8[_0x55f4('0x35')]:_0x1ac6ca[_0x55f4('0x2f')];if(_0x3f37e4[_0x55f4('0x31')][_0x55f4('0x40')]){_0x2bb2a8[_0x55f4('0x41')]=[{'all':!![]}];}_0x2bb2a8=_['merge']({},_0x2bb2a8,_0x3f37e4['options']);return db[_0x55f4('0x2b')]['find'](_0x2bb2a8)[_0x55f4('0x23')](handleEntityNotFound(_0x315b9e,null))['then'](respondWithResult(_0x315b9e,null))[_0x55f4('0x46')](handleError(_0x315b9e,null));};exports[_0x55f4('0x47')]=function(_0x39bd8a,_0x2e6184){return db[_0x55f4('0x2b')][_0x55f4('0x47')](_0x39bd8a[_0x55f4('0x48')],{})[_0x55f4('0x23')](respondWithResult(_0x2e6184,0xc9))[_0x55f4('0x46')](handleError(_0x2e6184,null));};exports['update']=function(_0x443cfc,_0x16c083){if(_0x443cfc[_0x55f4('0x48')]['id']){delete _0x443cfc['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x443cfc[_0x55f4('0x45')]['id']}})[_0x55f4('0x23')](handleEntityNotFound(_0x16c083,null))[_0x55f4('0x23')](saveUpdates(_0x443cfc['body'],null))[_0x55f4('0x23')](respondWithResult(_0x16c083,null))[_0x55f4('0x46')](handleError(_0x16c083,null));};exports[_0x55f4('0x24')]=function(_0x4abc9e,_0x588f73){return db[_0x55f4('0x2b')][_0x55f4('0x49')]({'where':{'id':_0x4abc9e['params']['id']}})[_0x55f4('0x23')](handleEntityNotFound(_0x588f73,null))['then'](removeEntity(_0x588f73,null))[_0x55f4('0x46')](handleError(_0x588f73,null));};exports['getFields']=function(_0x5e6197,_0x1b827f,_0x3b8467){var _0x5abff9={};var _0x491862={};var _0xd23945;var _0x37a085;return db[_0x55f4('0x2b')]['findOne']({'where':{'id':_0x5e6197[_0x55f4('0x45')]['id']}})[_0x55f4('0x23')](handleEntityNotFound(_0x1b827f,null))[_0x55f4('0x23')](function(_0x3f25a4){if(_0x3f25a4){_0xd23945=_0x3f25a4;_0x491862[_0x55f4('0x2f')]=_['keys'](db['SalesforceField'][_0x55f4('0x2c')]);_0x491862['query']=_['keys'](_0x5e6197[_0x55f4('0x31')]);_0x491862['filters']=_[_0x55f4('0x34')](_0x491862[_0x55f4('0x2f')],_0x491862[_0x55f4('0x31')]);_0x5abff9[_0x55f4('0x35')]=_['intersection'](_0x491862[_0x55f4('0x2f')],qs[_0x55f4('0x36')](_0x5e6197[_0x55f4('0x31')][_0x55f4('0x36')]));_0x5abff9[_0x55f4('0x35')]=_0x5abff9['attributes'][_0x55f4('0x4a')]?_0x5abff9[_0x55f4('0x35')]:_0x491862[_0x55f4('0x2f')];_0x5abff9[_0x55f4('0x39')]=qs[_0x55f4('0x3a')](_0x5e6197[_0x55f4('0x31')][_0x55f4('0x3a')]);_0x5abff9[_0x55f4('0x3b')]=qs['filters'](_[_0x55f4('0x3c')](_0x5e6197[_0x55f4('0x31')],_0x491862[_0x55f4('0x33')]));if(_0x5e6197[_0x55f4('0x31')][_0x55f4('0x4b')]){_0x5abff9[_0x55f4('0x3b')]=_[_0x55f4('0x3d')](_0x5abff9[_0x55f4('0x3b')],{'$or':_[_0x55f4('0x30')](_0x5abff9[_0x55f4('0x35')],function(_0xc5018e){var _0x451c68={};_0x451c68[_0xc5018e]={'$like':'%'+_0x5e6197[_0x55f4('0x31')][_0x55f4('0x4b')]+'%'};return _0x451c68;})});}_0x5abff9=_['merge']({},_0x5abff9,_0x5e6197[_0x55f4('0x3f')]);return _0xd23945['getFields'](_0x5abff9);}})[_0x55f4('0x23')](function(_0x18965b){if(_0x18965b){_0x37a085=_0x18965b['length'];if(!_0x5e6197[_0x55f4('0x31')][_0x55f4('0x37')]('nolimit')){_0x5abff9['limit']=qs['limit'](_0x5e6197[_0x55f4('0x31')]['limit']);_0x5abff9[_0x55f4('0x19')]=qs[_0x55f4('0x19')](_0x5e6197[_0x55f4('0x31')]['offset']);}return _0xd23945[_0x55f4('0x4c')](_0x5abff9);}})[_0x55f4('0x23')](function(_0x2882c1){if(_0x2882c1){return _0x2882c1?{'count':_0x37a085,'rows':_0x2882c1}:null;}})['then'](respondWithResult(_0x1b827f,null))[_0x55f4('0x46')](handleError(_0x1b827f,null));};exports[_0x55f4('0x4d')]=function(_0x59cf57,_0x330015,_0x33b798){var _0x57023c={};var _0x4903a5={};var _0x1490f4;var _0x49725b;return db[_0x55f4('0x2b')][_0x55f4('0x4e')]({'where':{'id':_0x59cf57[_0x55f4('0x45')]['id']}})[_0x55f4('0x23')](handleEntityNotFound(_0x330015,null))['then'](function(_0x59a089){if(_0x59a089){_0x1490f4=_0x59a089;_0x4903a5[_0x55f4('0x2f')]=_[_0x55f4('0x32')](db['SalesforceField']['rawAttributes']);_0x4903a5[_0x55f4('0x31')]=_[_0x55f4('0x32')](_0x59cf57[_0x55f4('0x31')]);_0x4903a5['filters']=_[_0x55f4('0x34')](_0x4903a5[_0x55f4('0x2f')],_0x4903a5[_0x55f4('0x31')]);_0x57023c['attributes']=_[_0x55f4('0x34')](_0x4903a5[_0x55f4('0x2f')],qs[_0x55f4('0x36')](_0x59cf57[_0x55f4('0x31')][_0x55f4('0x36')]));_0x57023c['attributes']=_0x57023c[_0x55f4('0x35')][_0x55f4('0x4a')]?_0x57023c['attributes']:_0x4903a5[_0x55f4('0x2f')];_0x57023c[_0x55f4('0x39')]=qs[_0x55f4('0x3a')](_0x59cf57[_0x55f4('0x31')][_0x55f4('0x3a')]);_0x57023c[_0x55f4('0x3b')]=qs[_0x55f4('0x33')](_['pick'](_0x59cf57[_0x55f4('0x31')],_0x4903a5['filters']));if(_0x59cf57['query'][_0x55f4('0x4b')]){_0x57023c[_0x55f4('0x3b')]=_[_0x55f4('0x3d')](_0x57023c[_0x55f4('0x3b')],{'$or':_[_0x55f4('0x30')](_0x57023c['attributes'],function(_0x36e3f4){var _0x27963e={};_0x27963e[_0x36e3f4]={'$like':'%'+_0x59cf57[_0x55f4('0x31')][_0x55f4('0x4b')]+'%'};return _0x27963e;})});}_0x57023c=_[_0x55f4('0x3d')]({},_0x57023c,_0x59cf57[_0x55f4('0x3f')]);return _0x1490f4[_0x55f4('0x4d')](_0x57023c);}})[_0x55f4('0x23')](function(_0x881ac6){if(_0x881ac6){_0x49725b=_0x881ac6[_0x55f4('0x4a')];if(!_0x59cf57[_0x55f4('0x31')][_0x55f4('0x37')](_0x55f4('0x38'))){_0x57023c[_0x55f4('0x1c')]=qs[_0x55f4('0x1c')](_0x59cf57[_0x55f4('0x31')][_0x55f4('0x1c')]);_0x57023c[_0x55f4('0x19')]=qs['offset'](_0x59cf57[_0x55f4('0x31')][_0x55f4('0x19')]);}return _0x1490f4[_0x55f4('0x4d')](_0x57023c);}})[_0x55f4('0x23')](function(_0x22c74e){if(_0x22c74e){return _0x22c74e?{'count':_0x49725b,'rows':_0x22c74e}:null;}})[_0x55f4('0x23')](respondWithResult(_0x330015,null))[_0x55f4('0x46')](handleError(_0x330015,null));};exports[_0x55f4('0x4f')]=function(_0x23dcdb,_0x29a705,_0x1827cb){var _0x3ee65b={};var _0x2206d7={};var _0x3aea14;var _0x21f989;return db['SalesforceConfiguration'][_0x55f4('0x4e')]({'where':{'id':_0x23dcdb[_0x55f4('0x45')]['id']}})[_0x55f4('0x23')](handleEntityNotFound(_0x29a705,null))[_0x55f4('0x23')](function(_0x375a37){if(_0x375a37){_0x3aea14=_0x375a37;_0x2206d7['model']=_['keys'](db[_0x55f4('0x50')][_0x55f4('0x2c')]);_0x2206d7['query']=_[_0x55f4('0x32')](_0x23dcdb['query']);_0x2206d7[_0x55f4('0x33')]=_[_0x55f4('0x34')](_0x2206d7[_0x55f4('0x2f')],_0x2206d7['query']);_0x3ee65b[_0x55f4('0x35')]=_['intersection'](_0x2206d7[_0x55f4('0x2f')],qs[_0x55f4('0x36')](_0x23dcdb[_0x55f4('0x31')]['fields']));_0x3ee65b[_0x55f4('0x35')]=_0x3ee65b[_0x55f4('0x35')]['length']?_0x3ee65b[_0x55f4('0x35')]:_0x2206d7[_0x55f4('0x2f')];_0x3ee65b[_0x55f4('0x39')]=qs['sort'](_0x23dcdb[_0x55f4('0x31')][_0x55f4('0x3a')]);_0x3ee65b['where']=qs['filters'](_[_0x55f4('0x3c')](_0x23dcdb['query'],_0x2206d7[_0x55f4('0x33')]));if(_0x23dcdb['query']['filter']){_0x3ee65b[_0x55f4('0x3b')]=_[_0x55f4('0x3d')](_0x3ee65b[_0x55f4('0x3b')],{'$or':_['map'](_0x3ee65b[_0x55f4('0x35')],function(_0x791879){var _0xd590a5={};_0xd590a5[_0x791879]={'$like':'%'+_0x23dcdb[_0x55f4('0x31')][_0x55f4('0x4b')]+'%'};return _0xd590a5;})});}_0x3ee65b=_[_0x55f4('0x3d')]({},_0x3ee65b,_0x23dcdb[_0x55f4('0x3f')]);return _0x3aea14['getDescriptions'](_0x3ee65b);}})[_0x55f4('0x23')](function(_0x51c05c){if(_0x51c05c){_0x21f989=_0x51c05c[_0x55f4('0x4a')];if(!_0x23dcdb[_0x55f4('0x31')][_0x55f4('0x37')]('nolimit')){_0x3ee65b[_0x55f4('0x1c')]=qs[_0x55f4('0x1c')](_0x23dcdb['query'][_0x55f4('0x1c')]);_0x3ee65b[_0x55f4('0x19')]=qs[_0x55f4('0x19')](_0x23dcdb[_0x55f4('0x31')][_0x55f4('0x19')]);}return _0x3aea14[_0x55f4('0x4f')](_0x3ee65b);}})[_0x55f4('0x23')](function(_0x5555b7){if(_0x5555b7){return _0x5555b7?{'count':_0x21f989,'rows':_0x5555b7}:null;}})[_0x55f4('0x23')](respondWithResult(_0x29a705,null))['catch'](handleError(_0x29a705,null));}; \ No newline at end of file +var _0x0aae=['request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','apply','reject','then','destroy','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x0aae,0xe0));var _0xe0aa=function(_0x1a3673,_0x284946){_0x1a3673=_0x1a3673-0x0;var _0x2dbcdf=_0x0aae[_0x1a3673];return _0x2dbcdf;};'use strict';var emlformat=require(_0xe0aa('0x0'));var rimraf=require(_0xe0aa('0x1'));var zipdir=require(_0xe0aa('0x2'));var jsonpatch=require(_0xe0aa('0x3'));var rp=require(_0xe0aa('0x4'));var moment=require(_0xe0aa('0x5'));var BPromise=require(_0xe0aa('0x6'));var Mustache=require('mustache');var util=require(_0xe0aa('0x7'));var path=require(_0xe0aa('0x8'));var sox=require(_0xe0aa('0x9'));var csv=require('to-csv');var ejs=require(_0xe0aa('0xa'));var fs=require('fs');var fs_extra=require(_0xe0aa('0xb'));var _=require(_0xe0aa('0xc'));var squel=require('squel');var crypto=require(_0xe0aa('0xd'));var jsforce=require(_0xe0aa('0xe'));var deskjs=require(_0xe0aa('0xf'));var toCsv=require(_0xe0aa('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0aa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0aa('0x12'));var hardwareService=require(_0xe0aa('0x13'));var logger=require(_0xe0aa('0x14'))('api');var utils=require(_0xe0aa('0x15'));var config=require(_0xe0aa('0x16'));var licenseUtil=require(_0xe0aa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc66901,_0x5daeb2){_0x5daeb2=_0x5daeb2||0xcc;return function(_0x5721ec){if(_0x5721ec){return _0xc66901[_0xe0aa('0x18')](_0x5daeb2);}return _0xc66901[_0xe0aa('0x19')](_0x5daeb2)[_0xe0aa('0x1a')]();};}function respondWithResult(_0x38a947,_0x1d51bb){_0x1d51bb=_0x1d51bb||0xc8;return function(_0x45426d){if(_0x45426d){return _0x38a947[_0xe0aa('0x19')](_0x1d51bb)[_0xe0aa('0x1b')](_0x45426d);}};}function respondWithFilteredResult(_0x454261,_0x8fdf1b){return function(_0x58dd6e){if(_0x58dd6e){var _0x311c3f=typeof _0x8fdf1b[_0xe0aa('0x1c')]==='undefined'&&typeof _0x8fdf1b[_0xe0aa('0x1d')]==='undefined';var _0x1c6d20=_0x58dd6e[_0xe0aa('0x1e')];var _0x88ebe8=_0x311c3f?0x0:_0x8fdf1b[_0xe0aa('0x1c')];var _0x2857d0=_0x311c3f?_0x58dd6e[_0xe0aa('0x1e')]:_0x8fdf1b[_0xe0aa('0x1c')]+_0x8fdf1b[_0xe0aa('0x1d')];var _0x17c2c2;if(_0x2857d0>=_0x1c6d20){_0x2857d0=_0x1c6d20;_0x17c2c2=0xc8;}else{_0x17c2c2=0xce;}_0x454261[_0xe0aa('0x19')](_0x17c2c2);return _0x454261['set']('Content-Range',_0x88ebe8+'-'+_0x2857d0+'/'+_0x1c6d20)[_0xe0aa('0x1b')](_0x58dd6e);}return null;};}function patchUpdates(_0x419bf0){return function(_0x988466){try{jsonpatch[_0xe0aa('0x1f')](_0x988466,_0x419bf0,!![]);}catch(_0x38beab){return BPromise[_0xe0aa('0x20')](_0x38beab);}return _0x988466['save']();};}function saveUpdates(_0x48fef9,_0x22d8a5){return function(_0x586449){if(_0x586449){return _0x586449['update'](_0x48fef9)[_0xe0aa('0x21')](function(_0x524cee){return _0x524cee;});}return null;};}function removeEntity(_0x497c29,_0x3cdf13){return function(_0x2129be){if(_0x2129be){return _0x2129be[_0xe0aa('0x22')]()[_0xe0aa('0x21')](function(){_0x497c29[_0xe0aa('0x19')](0xcc)[_0xe0aa('0x1a')]();});}};}function handleEntityNotFound(_0x1d619f,_0x528936){return function(_0x4925b9){if(!_0x4925b9){_0x1d619f[_0xe0aa('0x18')](0x194);}return _0x4925b9;};}function handleError(_0x4466ef,_0x1b5c5a){_0x1b5c5a=_0x1b5c5a||0x1f4;return function(_0x57872b){logger[_0xe0aa('0x23')](_0x57872b[_0xe0aa('0x24')]);if(_0x57872b[_0xe0aa('0x25')]){delete _0x57872b[_0xe0aa('0x25')];}_0x4466ef['status'](_0x1b5c5a)[_0xe0aa('0x26')](_0x57872b);};}exports['index']=function(_0x21c8ac,_0x139b0c){var _0x577933={},_0x4b702a={},_0x507017={'count':0x0,'rows':[]};var _0x166f8a=_[_0xe0aa('0x27')](db[_0xe0aa('0x28')][_0xe0aa('0x29')],function(_0x594ff2){return{'name':_0x594ff2[_0xe0aa('0x2a')],'type':_0x594ff2['type']['key']};});_0x4b702a[_0xe0aa('0x2b')]=_['map'](_0x166f8a,_0xe0aa('0x25'));_0x4b702a[_0xe0aa('0x2c')]=_[_0xe0aa('0x2d')](_0x21c8ac['query']);_0x4b702a[_0xe0aa('0x2e')]=_['intersection'](_0x4b702a[_0xe0aa('0x2b')],_0x4b702a[_0xe0aa('0x2c')]);_0x577933['attributes']=_[_0xe0aa('0x2f')](_0x4b702a[_0xe0aa('0x2b')],qs['fields'](_0x21c8ac['query'][_0xe0aa('0x30')]));_0x577933[_0xe0aa('0x31')]=_0x577933['attributes'][_0xe0aa('0x32')]?_0x577933[_0xe0aa('0x31')]:_0x4b702a[_0xe0aa('0x2b')];if(!_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x33')](_0xe0aa('0x34'))){_0x577933['limit']=qs['limit'](_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x1d')]);_0x577933[_0xe0aa('0x1c')]=qs[_0xe0aa('0x1c')](_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x1c')]);}_0x577933[_0xe0aa('0x35')]=qs['sort'](_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x36')]);_0x577933[_0xe0aa('0x37')]=qs['filters'](_[_0xe0aa('0x38')](_0x21c8ac[_0xe0aa('0x2c')],_0x4b702a[_0xe0aa('0x2e')]),_0x166f8a);if(_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x39')]){_0x577933['where']=_[_0xe0aa('0x3a')](_0x577933['where'],{'$or':_[_0xe0aa('0x27')](_0x166f8a,function(_0x124e43){if(_0x124e43[_0xe0aa('0x3b')]!=='VIRTUAL'){var _0x47841d={};_0x47841d[_0x124e43[_0xe0aa('0x25')]]={'$like':'%'+_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x39')]+'%'};return _0x47841d;}})});}_0x577933=_[_0xe0aa('0x3a')]({},_0x577933,_0x21c8ac[_0xe0aa('0x3c')]);var _0x4dadc6={'where':_0x577933[_0xe0aa('0x37')]};return db[_0xe0aa('0x28')][_0xe0aa('0x1e')](_0x4dadc6)[_0xe0aa('0x21')](function(_0x2aca23){_0x507017[_0xe0aa('0x1e')]=_0x2aca23;if(_0x21c8ac[_0xe0aa('0x2c')][_0xe0aa('0x3d')]){_0x577933[_0xe0aa('0x3e')]=[{'all':!![]}];}return db[_0xe0aa('0x28')][_0xe0aa('0x3f')](_0x577933);})[_0xe0aa('0x21')](function(_0x1b8b28){_0x507017[_0xe0aa('0x40')]=_0x1b8b28;return _0x507017;})['then'](respondWithFilteredResult(_0x139b0c,_0x577933))['catch'](handleError(_0x139b0c,null));};exports[_0xe0aa('0x41')]=function(_0x42688b,_0x1bedf3){var _0x59212f={'raw':![],'where':{'id':_0x42688b['params']['id']}},_0x4de365={};_0x4de365['model']=_[_0xe0aa('0x2d')](db[_0xe0aa('0x28')]['rawAttributes']);_0x4de365[_0xe0aa('0x2c')]=_[_0xe0aa('0x2d')](_0x42688b[_0xe0aa('0x2c')]);_0x4de365[_0xe0aa('0x2e')]=_['intersection'](_0x4de365[_0xe0aa('0x2b')],_0x4de365[_0xe0aa('0x2c')]);_0x59212f[_0xe0aa('0x31')]=_[_0xe0aa('0x2f')](_0x4de365[_0xe0aa('0x2b')],qs[_0xe0aa('0x30')](_0x42688b[_0xe0aa('0x2c')][_0xe0aa('0x30')]));_0x59212f[_0xe0aa('0x31')]=_0x59212f[_0xe0aa('0x31')][_0xe0aa('0x32')]?_0x59212f[_0xe0aa('0x31')]:_0x4de365[_0xe0aa('0x2b')];if(_0x42688b[_0xe0aa('0x2c')][_0xe0aa('0x3d')]){_0x59212f[_0xe0aa('0x3e')]=[{'all':!![]}];}_0x59212f=_[_0xe0aa('0x3a')]({},_0x59212f,_0x42688b[_0xe0aa('0x3c')]);return db[_0xe0aa('0x28')]['find'](_0x59212f)[_0xe0aa('0x21')](handleEntityNotFound(_0x1bedf3,null))[_0xe0aa('0x21')](respondWithResult(_0x1bedf3,null))[_0xe0aa('0x42')](handleError(_0x1bedf3,null));};exports[_0xe0aa('0x43')]=function(_0x1039d0,_0x2b33d3){return db[_0xe0aa('0x28')][_0xe0aa('0x43')](_0x1039d0['body'],{})[_0xe0aa('0x21')](respondWithResult(_0x2b33d3,0xc9))[_0xe0aa('0x42')](handleError(_0x2b33d3,null));};exports['update']=function(_0x50ac29,_0xcd344f){if(_0x50ac29[_0xe0aa('0x44')]['id']){delete _0x50ac29[_0xe0aa('0x44')]['id'];}return db[_0xe0aa('0x28')][_0xe0aa('0x45')]({'where':{'id':_0x50ac29[_0xe0aa('0x46')]['id']}})[_0xe0aa('0x21')](handleEntityNotFound(_0xcd344f,null))[_0xe0aa('0x21')](saveUpdates(_0x50ac29[_0xe0aa('0x44')],null))[_0xe0aa('0x21')](respondWithResult(_0xcd344f,null))[_0xe0aa('0x42')](handleError(_0xcd344f,null));};exports[_0xe0aa('0x22')]=function(_0x4dea04,_0x34bb53){return db['SalesforceConfiguration']['find']({'where':{'id':_0x4dea04[_0xe0aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x34bb53,null))[_0xe0aa('0x21')](removeEntity(_0x34bb53,null))[_0xe0aa('0x42')](handleError(_0x34bb53,null));};exports[_0xe0aa('0x47')]=function(_0x48ccb1,_0x3c8bfa,_0x527729){var _0x1b7aa3={};var _0x5a5aa2={};var _0x47b8e0;var _0x5188de;return db[_0xe0aa('0x28')][_0xe0aa('0x48')]({'where':{'id':_0x48ccb1[_0xe0aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c8bfa,null))[_0xe0aa('0x21')](function(_0x24d871){if(_0x24d871){_0x47b8e0=_0x24d871;_0x5a5aa2[_0xe0aa('0x2b')]=_[_0xe0aa('0x2d')](db[_0xe0aa('0x49')]['rawAttributes']);_0x5a5aa2[_0xe0aa('0x2c')]=_[_0xe0aa('0x2d')](_0x48ccb1[_0xe0aa('0x2c')]);_0x5a5aa2[_0xe0aa('0x2e')]=_[_0xe0aa('0x2f')](_0x5a5aa2['model'],_0x5a5aa2[_0xe0aa('0x2c')]);_0x1b7aa3['attributes']=_[_0xe0aa('0x2f')](_0x5a5aa2[_0xe0aa('0x2b')],qs[_0xe0aa('0x30')](_0x48ccb1[_0xe0aa('0x2c')]['fields']));_0x1b7aa3[_0xe0aa('0x31')]=_0x1b7aa3[_0xe0aa('0x31')][_0xe0aa('0x32')]?_0x1b7aa3[_0xe0aa('0x31')]:_0x5a5aa2['model'];_0x1b7aa3[_0xe0aa('0x35')]=qs[_0xe0aa('0x36')](_0x48ccb1[_0xe0aa('0x2c')][_0xe0aa('0x36')]);_0x1b7aa3[_0xe0aa('0x37')]=qs[_0xe0aa('0x2e')](_[_0xe0aa('0x38')](_0x48ccb1[_0xe0aa('0x2c')],_0x5a5aa2[_0xe0aa('0x2e')]));if(_0x48ccb1[_0xe0aa('0x2c')][_0xe0aa('0x39')]){_0x1b7aa3[_0xe0aa('0x37')]=_[_0xe0aa('0x3a')](_0x1b7aa3[_0xe0aa('0x37')],{'$or':_[_0xe0aa('0x27')](_0x1b7aa3['attributes'],function(_0x39bd76){var _0x22de7e={};_0x22de7e[_0x39bd76]={'$like':'%'+_0x48ccb1[_0xe0aa('0x2c')][_0xe0aa('0x39')]+'%'};return _0x22de7e;})});}_0x1b7aa3=_[_0xe0aa('0x3a')]({},_0x1b7aa3,_0x48ccb1[_0xe0aa('0x3c')]);return _0x47b8e0[_0xe0aa('0x47')](_0x1b7aa3);}})[_0xe0aa('0x21')](function(_0x3a5ad4){if(_0x3a5ad4){_0x5188de=_0x3a5ad4[_0xe0aa('0x32')];if(!_0x48ccb1['query']['hasOwnProperty']('nolimit')){_0x1b7aa3['limit']=qs[_0xe0aa('0x1d')](_0x48ccb1['query'][_0xe0aa('0x1d')]);_0x1b7aa3[_0xe0aa('0x1c')]=qs[_0xe0aa('0x1c')](_0x48ccb1[_0xe0aa('0x2c')][_0xe0aa('0x1c')]);}return _0x47b8e0[_0xe0aa('0x47')](_0x1b7aa3);}})[_0xe0aa('0x21')](function(_0x4a262f){if(_0x4a262f){return _0x4a262f?{'count':_0x5188de,'rows':_0x4a262f}:null;}})[_0xe0aa('0x21')](respondWithResult(_0x3c8bfa,null))[_0xe0aa('0x42')](handleError(_0x3c8bfa,null));};exports['getSubjects']=function(_0x6ebc43,_0x3fe277,_0x556415){var _0x3349cc={};var _0x3ec19d={};var _0x3c4f90;var _0x44650e;return db[_0xe0aa('0x28')][_0xe0aa('0x48')]({'where':{'id':_0x6ebc43['params']['id']}})['then'](handleEntityNotFound(_0x3fe277,null))['then'](function(_0x476be3){if(_0x476be3){_0x3c4f90=_0x476be3;_0x3ec19d['model']=_[_0xe0aa('0x2d')](db['SalesforceField'][_0xe0aa('0x29')]);_0x3ec19d[_0xe0aa('0x2c')]=_[_0xe0aa('0x2d')](_0x6ebc43['query']);_0x3ec19d[_0xe0aa('0x2e')]=_[_0xe0aa('0x2f')](_0x3ec19d['model'],_0x3ec19d['query']);_0x3349cc[_0xe0aa('0x31')]=_[_0xe0aa('0x2f')](_0x3ec19d['model'],qs[_0xe0aa('0x30')](_0x6ebc43[_0xe0aa('0x2c')][_0xe0aa('0x30')]));_0x3349cc[_0xe0aa('0x31')]=_0x3349cc[_0xe0aa('0x31')]['length']?_0x3349cc['attributes']:_0x3ec19d[_0xe0aa('0x2b')];_0x3349cc[_0xe0aa('0x35')]=qs[_0xe0aa('0x36')](_0x6ebc43[_0xe0aa('0x2c')]['sort']);_0x3349cc[_0xe0aa('0x37')]=qs[_0xe0aa('0x2e')](_['pick'](_0x6ebc43[_0xe0aa('0x2c')],_0x3ec19d[_0xe0aa('0x2e')]));if(_0x6ebc43['query'][_0xe0aa('0x39')]){_0x3349cc[_0xe0aa('0x37')]=_[_0xe0aa('0x3a')](_0x3349cc[_0xe0aa('0x37')],{'$or':_['map'](_0x3349cc['attributes'],function(_0x483c97){var _0x1d20a0={};_0x1d20a0[_0x483c97]={'$like':'%'+_0x6ebc43[_0xe0aa('0x2c')][_0xe0aa('0x39')]+'%'};return _0x1d20a0;})});}_0x3349cc=_[_0xe0aa('0x3a')]({},_0x3349cc,_0x6ebc43[_0xe0aa('0x3c')]);return _0x3c4f90['getSubjects'](_0x3349cc);}})['then'](function(_0x2db13f){if(_0x2db13f){_0x44650e=_0x2db13f[_0xe0aa('0x32')];if(!_0x6ebc43[_0xe0aa('0x2c')][_0xe0aa('0x33')](_0xe0aa('0x34'))){_0x3349cc[_0xe0aa('0x1d')]=qs[_0xe0aa('0x1d')](_0x6ebc43[_0xe0aa('0x2c')][_0xe0aa('0x1d')]);_0x3349cc[_0xe0aa('0x1c')]=qs['offset'](_0x6ebc43[_0xe0aa('0x2c')][_0xe0aa('0x1c')]);}return _0x3c4f90[_0xe0aa('0x4a')](_0x3349cc);}})[_0xe0aa('0x21')](function(_0x419b02){if(_0x419b02){return _0x419b02?{'count':_0x44650e,'rows':_0x419b02}:null;}})['then'](respondWithResult(_0x3fe277,null))[_0xe0aa('0x42')](handleError(_0x3fe277,null));};exports[_0xe0aa('0x4b')]=function(_0x2ccac1,_0x46bcab,_0x2359e0){var _0x5c96ca={};var _0x194c4c={};var _0x19b490;var _0x57ae20;return db[_0xe0aa('0x28')][_0xe0aa('0x48')]({'where':{'id':_0x2ccac1[_0xe0aa('0x46')]['id']}})[_0xe0aa('0x21')](handleEntityNotFound(_0x46bcab,null))[_0xe0aa('0x21')](function(_0x1f2a91){if(_0x1f2a91){_0x19b490=_0x1f2a91;_0x194c4c[_0xe0aa('0x2b')]=_[_0xe0aa('0x2d')](db['SalesforceField']['rawAttributes']);_0x194c4c['query']=_[_0xe0aa('0x2d')](_0x2ccac1[_0xe0aa('0x2c')]);_0x194c4c['filters']=_[_0xe0aa('0x2f')](_0x194c4c['model'],_0x194c4c['query']);_0x5c96ca['attributes']=_[_0xe0aa('0x2f')](_0x194c4c[_0xe0aa('0x2b')],qs[_0xe0aa('0x30')](_0x2ccac1[_0xe0aa('0x2c')][_0xe0aa('0x30')]));_0x5c96ca[_0xe0aa('0x31')]=_0x5c96ca[_0xe0aa('0x31')][_0xe0aa('0x32')]?_0x5c96ca[_0xe0aa('0x31')]:_0x194c4c['model'];_0x5c96ca[_0xe0aa('0x35')]=qs[_0xe0aa('0x36')](_0x2ccac1['query'][_0xe0aa('0x36')]);_0x5c96ca[_0xe0aa('0x37')]=qs[_0xe0aa('0x2e')](_[_0xe0aa('0x38')](_0x2ccac1['query'],_0x194c4c['filters']));if(_0x2ccac1['query'][_0xe0aa('0x39')]){_0x5c96ca[_0xe0aa('0x37')]=_[_0xe0aa('0x3a')](_0x5c96ca[_0xe0aa('0x37')],{'$or':_[_0xe0aa('0x27')](_0x5c96ca[_0xe0aa('0x31')],function(_0x13cb87){var _0x30221a={};_0x30221a[_0x13cb87]={'$like':'%'+_0x2ccac1['query']['filter']+'%'};return _0x30221a;})});}_0x5c96ca=_[_0xe0aa('0x3a')]({},_0x5c96ca,_0x2ccac1[_0xe0aa('0x3c')]);return _0x19b490[_0xe0aa('0x4b')](_0x5c96ca);}})[_0xe0aa('0x21')](function(_0x3d61b3){if(_0x3d61b3){_0x57ae20=_0x3d61b3[_0xe0aa('0x32')];if(!_0x2ccac1['query'][_0xe0aa('0x33')](_0xe0aa('0x34'))){_0x5c96ca[_0xe0aa('0x1d')]=qs['limit'](_0x2ccac1[_0xe0aa('0x2c')][_0xe0aa('0x1d')]);_0x5c96ca[_0xe0aa('0x1c')]=qs[_0xe0aa('0x1c')](_0x2ccac1[_0xe0aa('0x2c')][_0xe0aa('0x1c')]);}return _0x19b490[_0xe0aa('0x4b')](_0x5c96ca);}})['then'](function(_0x393461){if(_0x393461){return _0x393461?{'count':_0x57ae20,'rows':_0x393461}:null;}})[_0xe0aa('0x21')](respondWithResult(_0x46bcab,null))[_0xe0aa('0x42')](handleError(_0x46bcab,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2267606..a6bbb23 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 _0x874e=['./intSalesforceConfiguration.attributes','define','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x48c3ec,_0x53eea3){var _0x26b723=function(_0x2e393b){while(--_0x2e393b){_0x48c3ec['push'](_0x48c3ec['shift']());}};_0x26b723(++_0x53eea3);}(_0x874e,0x1f1));var _0xe874=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x874e[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0xe874('0x0'));var logger=require('../../config/logger')(_0xe874('0x1'));var moment=require(_0xe874('0x2'));var BPromise=require(_0xe874('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe874('0x4'));var rimraf=require(_0xe874('0x5'));var config=require(_0xe874('0x6'));var attributes=require(_0xe874('0x7'));module['exports']=function(_0x53a679,_0x3abc34){return _0x53a679[_0xe874('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b3=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird','path','rimraf'];(function(_0x3a4aec,_0xb0b3d7){var _0xa018a1=function(_0x30862b){while(--_0x30862b){_0x3a4aec['push'](_0x3a4aec['shift']());}};_0xa018a1(++_0xb0b3d7);}(_0x64b3,0x1de));var _0x364b=function(_0x520fdc,_0x3739a8){_0x520fdc=_0x520fdc-0x0;var _0x560b79=_0x64b3[_0x520fdc];return _0x560b79;};'use strict';var _=require(_0x364b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x364b('0x1'));var moment=require(_0x364b('0x2'));var BPromise=require(_0x364b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x364b('0x4'));var rimraf=require(_0x364b('0x5'));var config=require(_0x364b('0x6'));var attributes=require(_0x364b('0x7'));module[_0x364b('0x8')]=function(_0x42092d,_0x53ae27){return _0x42092d['define'](_0x364b('0x9'),attributes,{'tableName':_0x364b('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 9a2cc14..6dfe0e5 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 _0x5ee2=['../../config/utils','../../config/environment','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','info','result','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32610f,_0x3bdce7){var _0x2a707f=function(_0x1a0332){while(--_0x1a0332){_0x32610f['push'](_0x32610f['shift']());}};_0x2a707f(++_0x3bdce7);}(_0x5ee2,0x1d6));var _0x25ee=function(_0x5c44be,_0x221746){_0x5c44be=_0x5c44be-0x0;var _0x5709f1=_0x5ee2[_0x5c44be];return _0x5709f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x25ee('0x0'));var BPromise=require(_0x25ee('0x1'));var rs=require(_0x25ee('0x2'));var fs=require('fs');var Redis=require(_0x25ee('0x3'));var db=require(_0x25ee('0x4'))['db'];var utils=require(_0x25ee('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x25ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x25ee('0x7')][_0x25ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56e177,_0x5d4050,_0x391749){return new BPromise(function(_0x5c71f1,_0x2a3b69){return client[_0x25ee('0x9')](_0x56e177,_0x391749)['then'](function(_0x4989c2){logger['info'](_0x25ee('0xa'),_0x5d4050,_0x25ee('0xb'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5d4050,_0x25ee('0xb'),JSON[_0x25ee('0xc')](_0x4989c2));if(_0x4989c2[_0x25ee('0xd')]){if(_0x4989c2['error'][_0x25ee('0xe')]===0x1f4){logger[_0x25ee('0xd')](_0x25ee('0xa'),_0x5d4050,_0x4989c2['error']['message']);return _0x2a3b69(_0x4989c2[_0x25ee('0xd')]['message']);}logger['error'](_0x25ee('0xa'),_0x5d4050,_0x4989c2[_0x25ee('0xd')]['message']);return _0x5c71f1(_0x4989c2[_0x25ee('0xd')]['message']);}else{logger[_0x25ee('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5d4050,_0x25ee('0xb'));_0x5c71f1(_0x4989c2[_0x25ee('0x10')][_0x25ee('0x11')]);}})[_0x25ee('0x12')](function(_0x210ed8){logger[_0x25ee('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5d4050,_0x210ed8);_0x2a3b69(_0x210ed8);});});} \ No newline at end of file +var _0x1042=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x4f5f6c,_0x15a990){var _0x3f3fba=function(_0x4e6e3f){while(--_0x4e6e3f){_0x4f5f6c['push'](_0x4f5f6c['shift']());}};_0x3f3fba(++_0x15a990);}(_0x1042,0x18f));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require(_0x2104('0x1'));var moment=require(_0x2104('0x2'));var BPromise=require(_0x2104('0x3'));var rs=require(_0x2104('0x4'));var fs=require('fs');var Redis=require(_0x2104('0x5'));var db=require(_0x2104('0x6'))['db'];var utils=require(_0x2104('0x7'));var logger=require(_0x2104('0x8'))(_0x2104('0x9'));var config=require('../../config/environment');var jayson=require(_0x2104('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c1609,_0x4ecd3e,_0x203ead){return new BPromise(function(_0x1b6b61,_0x53c43a){return client[_0x2104('0xb')](_0x1c1609,_0x203ead)[_0x2104('0xc')](function(_0x303c92){logger[_0x2104('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ecd3e,_0x2104('0xe'));logger['debug'](_0x2104('0xf'),_0x4ecd3e,_0x2104('0xe'),JSON['stringify'](_0x303c92));if(_0x303c92[_0x2104('0x10')]){if(_0x303c92[_0x2104('0x10')][_0x2104('0x11')]===0x1f4){logger[_0x2104('0x10')](_0x2104('0x12'),_0x4ecd3e,_0x303c92['error'][_0x2104('0x13')]);return _0x53c43a(_0x303c92[_0x2104('0x10')][_0x2104('0x13')]);}logger[_0x2104('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ecd3e,_0x303c92[_0x2104('0x10')][_0x2104('0x13')]);return _0x1b6b61(_0x303c92['error']['message']);}else{logger[_0x2104('0xd')](_0x2104('0x12'),_0x4ecd3e,'request\x20sent');_0x1b6b61(_0x303c92['result']['message']);}})[_0x2104('0x14')](function(_0x58dc0e){logger['error'](_0x2104('0x12'),_0x4ecd3e,_0x58dc0e);_0x53c43a(_0x58dc0e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4620261..5cec5dd 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 _0x4988=['get','index','/:id','isAuthenticated','create','put','update','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x321091,_0x32b3ef){var _0x1479ca=function(_0xfb759){while(--_0xfb759){_0x321091['push'](_0x321091['shift']());}};_0x1479ca(++_0x32b3ef);}(_0x4988,0x1ca));var _0x8498=function(_0x15d8e0,_0x46909d){_0x15d8e0=_0x15d8e0-0x0;var _0x570480=_0x4988[_0x15d8e0];return _0x570480;};'use strict';var multer=require(_0x8498('0x0'));var util=require('util');var path=require(_0x8498('0x1'));var timeout=require('connect-timeout');var express=require(_0x8498('0x2'));var router=express[_0x8498('0x3')]();var fs_extra=require(_0x8498('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8498('0x5'));var config=require('../../config/environment');var controller=require(_0x8498('0x6'));router[_0x8498('0x7')]('/',auth['isAuthenticated'](),controller[_0x8498('0x8')]);router['get'](_0x8498('0x9'),auth[_0x8498('0xa')](),controller['show']);router['post']('/',auth[_0x8498('0xa')](),controller[_0x8498('0xb')]);router[_0x8498('0xc')](_0x8498('0x9'),auth[_0x8498('0xa')](),controller[_0x8498('0xd')]);router['delete'](_0x8498('0x9'),auth['isAuthenticated'](),controller[_0x8498('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe692=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe692,0x11d));var _0x2e69=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe692[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x2e69('0x0'));var util=require(_0x2e69('0x1'));var path=require('path');var timeout=require(_0x2e69('0x2'));var express=require('express');var router=express[_0x2e69('0x3')]();var fs_extra=require(_0x2e69('0x4'));var auth=require(_0x2e69('0x5'));var interaction=require(_0x2e69('0x6'));var config=require(_0x2e69('0x7'));var controller=require('./intSalesforceField.controller');router[_0x2e69('0x8')]('/',auth[_0x2e69('0x9')](),controller['index']);router[_0x2e69('0x8')](_0x2e69('0xa'),auth[_0x2e69('0x9')](),controller[_0x2e69('0xb')]);router[_0x2e69('0xc')]('/',auth[_0x2e69('0x9')](),controller[_0x2e69('0xd')]);router[_0x2e69('0xe')](_0x2e69('0xa'),auth[_0x2e69('0x9')](),controller[_0x2e69('0xf')]);router['delete'](_0x2e69('0xa'),auth[_0x2e69('0x9')](),controller[_0x2e69('0x10')]);module[_0x2e69('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index bcc6769..0a55281 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 _0x6fe4=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6fe4,0x119));var _0x46fe=function(_0x5960ba,_0x5ed2fa){_0x5960ba=_0x5960ba-0x0;var _0x1dc2fb=_0x6fe4[_0x5960ba];return _0x1dc2fb;};'use strict';var Sequelize=require(_0x46fe('0x0'));module[_0x46fe('0x1')]={'type':{'type':Sequelize[_0x46fe('0x2')](_0x46fe('0x3'),_0x46fe('0x4'),_0x46fe('0x5'),_0x46fe('0x6'),'picklist'),'defaultValue':_0x46fe('0x3')},'content':{'type':Sequelize[_0x46fe('0x7')]},'key':{'type':Sequelize[_0x46fe('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x46fe('0x3'),'variable',_0x46fe('0x5'))},'keyContent':{'type':Sequelize[_0x46fe('0x7')]},'idField':{'type':Sequelize[_0x46fe('0x7')]},'variableName':{'type':Sequelize[_0x46fe('0x7')]}}; \ No newline at end of file +var _0xf1bf=['ENUM','exports','string','picklist','STRING'];(function(_0x4d6960,_0x3f5235){var _0x1ca530=function(_0xb6f2d2){while(--_0xb6f2d2){_0x4d6960['push'](_0x4d6960['shift']());}};_0x1ca530(++_0x3f5235);}(_0xf1bf,0xab));var _0xff1b=function(_0x5227d2,_0x3a953c){_0x5227d2=_0x5227d2-0x0;var _0x5e6530=_0xf1bf[_0x5227d2];return _0x5e6530;};'use strict';var Sequelize=require('sequelize');module[_0xff1b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xff1b('0x1'),'variable','customVariable','keyValue',_0xff1b('0x2')),'defaultValue':_0xff1b('0x1')},'content':{'type':Sequelize[_0xff1b('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xff1b('0x4')](_0xff1b('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xff1b('0x3')]},'idField':{'type':Sequelize[_0xff1b('0x3')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 595a162..3db916e 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 _0x04cc=['status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','SalesforceField','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x205bb3,_0x5daa31){var _0x59dc9a=function(_0x3921af){while(--_0x3921af){_0x205bb3['push'](_0x205bb3['shift']());}};_0x59dc9a(++_0x5daa31);}(_0x04cc,0x11a));var _0xc04c=function(_0xe1b523,_0x2bc05b){_0xe1b523=_0xe1b523-0x0;var _0x52c152=_0x04cc[_0xe1b523];return _0x52c152;};'use strict';var emlformat=require(_0xc04c('0x0'));var rimraf=require(_0xc04c('0x1'));var zipdir=require(_0xc04c('0x2'));var jsonpatch=require(_0xc04c('0x3'));var rp=require('request-promise');var moment=require(_0xc04c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc04c('0x5'));var path=require(_0xc04c('0x6'));var sox=require(_0xc04c('0x7'));var csv=require(_0xc04c('0x8'));var ejs=require(_0xc04c('0x9'));var fs=require('fs');var fs_extra=require(_0xc04c('0xa'));var _=require(_0xc04c('0xb'));var squel=require('squel');var crypto=require(_0xc04c('0xc'));var jsforce=require(_0xc04c('0xd'));var deskjs=require(_0xc04c('0xe'));var toCsv=require(_0xc04c('0x8'));var querystring=require(_0xc04c('0xf'));var Papa=require(_0xc04c('0x10'));var Redis=require(_0xc04c('0x11'));var authService=require(_0xc04c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc04c('0x13'));var logger=require(_0xc04c('0x14'))(_0xc04c('0x15'));var utils=require(_0xc04c('0x16'));var config=require(_0xc04c('0x17'));var licenseUtil=require(_0xc04c('0x18'));var db=require(_0xc04c('0x19'))['db'];function respondWithStatusCode(_0x563a5f,_0x510e18){_0x510e18=_0x510e18||0xcc;return function(_0x11a9e4){if(_0x11a9e4){return _0x563a5f['sendStatus'](_0x510e18);}return _0x563a5f[_0xc04c('0x1a')](_0x510e18)[_0xc04c('0x1b')]();};}function respondWithResult(_0x27a3f8,_0x23e500){_0x23e500=_0x23e500||0xc8;return function(_0x4f318d){if(_0x4f318d){return _0x27a3f8[_0xc04c('0x1a')](_0x23e500)[_0xc04c('0x1c')](_0x4f318d);}};}function respondWithFilteredResult(_0x1df6d9,_0x247582){return function(_0x4c1154){if(_0x4c1154){var _0x4e1aea=typeof _0x247582['offset']===_0xc04c('0x1d')&&typeof _0x247582[_0xc04c('0x1e')]==='undefined';var _0x82afdd=_0x4c1154['count'];var _0x170f47=_0x4e1aea?0x0:_0x247582[_0xc04c('0x1f')];var _0x59d405=_0x4e1aea?_0x4c1154[_0xc04c('0x20')]:_0x247582[_0xc04c('0x1f')]+_0x247582[_0xc04c('0x1e')];var _0x1ad3e6;if(_0x59d405>=_0x82afdd){_0x59d405=_0x82afdd;_0x1ad3e6=0xc8;}else{_0x1ad3e6=0xce;}_0x1df6d9[_0xc04c('0x1a')](_0x1ad3e6);return _0x1df6d9[_0xc04c('0x21')](_0xc04c('0x22'),_0x170f47+'-'+_0x59d405+'/'+_0x82afdd)[_0xc04c('0x1c')](_0x4c1154);}return null;};}function patchUpdates(_0x9b1151){return function(_0x4050ae){try{jsonpatch[_0xc04c('0x23')](_0x4050ae,_0x9b1151,!![]);}catch(_0x5d7c0e){return BPromise[_0xc04c('0x24')](_0x5d7c0e);}return _0x4050ae[_0xc04c('0x25')]();};}function saveUpdates(_0x1a3927,_0x1fa984){return function(_0x2422af){if(_0x2422af){return _0x2422af[_0xc04c('0x26')](_0x1a3927)[_0xc04c('0x27')](function(_0x244e80){return _0x244e80;});}return null;};}function removeEntity(_0x204d03,_0x17bc59){return function(_0x47dddc){if(_0x47dddc){return _0x47dddc[_0xc04c('0x28')]()['then'](function(){_0x204d03[_0xc04c('0x1a')](0xcc)[_0xc04c('0x1b')]();});}};}function handleEntityNotFound(_0x446722,_0x40f467){return function(_0x3b2337){if(!_0x3b2337){_0x446722['sendStatus'](0x194);}return _0x3b2337;};}function handleError(_0x175049,_0x158f28){_0x158f28=_0x158f28||0x1f4;return function(_0xae56c9){logger[_0xc04c('0x29')](_0xae56c9[_0xc04c('0x2a')]);if(_0xae56c9['name']){delete _0xae56c9[_0xc04c('0x2b')];}_0x175049[_0xc04c('0x1a')](_0x158f28)[_0xc04c('0x2c')](_0xae56c9);};}exports['index']=function(_0x1c3f29,_0x5f0706){var _0x4082da={},_0x14ba62={},_0x1bc9ab={'count':0x0,'rows':[]};var _0x596b9b=_[_0xc04c('0x2d')](db['SalesforceField'][_0xc04c('0x2e')],function(_0xc356a2){return{'name':_0xc356a2[_0xc04c('0x2f')],'type':_0xc356a2[_0xc04c('0x30')][_0xc04c('0x31')]};});_0x14ba62['model']=_[_0xc04c('0x2d')](_0x596b9b,'name');_0x14ba62[_0xc04c('0x32')]=_['keys'](_0x1c3f29['query']);_0x14ba62['filters']=_[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x34')],_0x14ba62['query']);_0x4082da['attributes']=_[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x34')],qs[_0xc04c('0x35')](_0x1c3f29[_0xc04c('0x32')]['fields']));_0x4082da[_0xc04c('0x36')]=_0x4082da[_0xc04c('0x36')][_0xc04c('0x37')]?_0x4082da[_0xc04c('0x36')]:_0x14ba62[_0xc04c('0x34')];if(!_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x38')](_0xc04c('0x39'))){_0x4082da[_0xc04c('0x1e')]=qs['limit'](_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x1e')]);_0x4082da[_0xc04c('0x1f')]=qs[_0xc04c('0x1f')](_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x1f')]);}_0x4082da['order']=qs[_0xc04c('0x3a')](_0x1c3f29['query']['sort']);_0x4082da['where']=qs[_0xc04c('0x3b')](_[_0xc04c('0x3c')](_0x1c3f29[_0xc04c('0x32')],_0x14ba62[_0xc04c('0x3b')]),_0x596b9b);if(_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x3d')]){_0x4082da[_0xc04c('0x3e')]=_[_0xc04c('0x3f')](_0x4082da['where'],{'$or':_[_0xc04c('0x2d')](_0x596b9b,function(_0x2ecddd){if(_0x2ecddd['type']!==_0xc04c('0x40')){var _0x2ff7b4={};_0x2ff7b4[_0x2ecddd[_0xc04c('0x2b')]]={'$like':'%'+_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x3d')]+'%'};return _0x2ff7b4;}})});}_0x4082da=_[_0xc04c('0x3f')]({},_0x4082da,_0x1c3f29[_0xc04c('0x41')]);var _0xb4968={'where':_0x4082da['where']};return db[_0xc04c('0x42')]['count'](_0xb4968)[_0xc04c('0x27')](function(_0x1cd5df){_0x1bc9ab[_0xc04c('0x20')]=_0x1cd5df;if(_0x1c3f29[_0xc04c('0x32')][_0xc04c('0x43')]){_0x4082da[_0xc04c('0x44')]=[{'all':!![]}];}return db[_0xc04c('0x42')]['findAll'](_0x4082da);})[_0xc04c('0x27')](function(_0xf6d3ce){_0x1bc9ab[_0xc04c('0x45')]=_0xf6d3ce;return _0x1bc9ab;})[_0xc04c('0x27')](respondWithFilteredResult(_0x5f0706,_0x4082da))[_0xc04c('0x46')](handleError(_0x5f0706,null));};exports[_0xc04c('0x47')]=function(_0x29dd7d,_0x287bbb){var _0x3320be={'raw':!![],'where':{'id':_0x29dd7d[_0xc04c('0x48')]['id']}},_0x4ba324={};_0x4ba324[_0xc04c('0x34')]=_['keys'](db[_0xc04c('0x42')][_0xc04c('0x2e')]);_0x4ba324[_0xc04c('0x32')]=_[_0xc04c('0x49')](_0x29dd7d[_0xc04c('0x32')]);_0x4ba324[_0xc04c('0x3b')]=_[_0xc04c('0x33')](_0x4ba324['model'],_0x4ba324[_0xc04c('0x32')]);_0x3320be[_0xc04c('0x36')]=_['intersection'](_0x4ba324[_0xc04c('0x34')],qs[_0xc04c('0x35')](_0x29dd7d[_0xc04c('0x32')][_0xc04c('0x35')]));_0x3320be['attributes']=_0x3320be['attributes']['length']?_0x3320be['attributes']:_0x4ba324['model'];if(_0x29dd7d[_0xc04c('0x32')][_0xc04c('0x43')]){_0x3320be['include']=[{'all':!![]}];}_0x3320be=_[_0xc04c('0x3f')]({},_0x3320be,_0x29dd7d[_0xc04c('0x41')]);return db[_0xc04c('0x42')][_0xc04c('0x4a')](_0x3320be)[_0xc04c('0x27')](handleEntityNotFound(_0x287bbb,null))['then'](respondWithResult(_0x287bbb,null))['catch'](handleError(_0x287bbb,null));};exports[_0xc04c('0x4b')]=function(_0x196bf4,_0x360f04){return db[_0xc04c('0x42')][_0xc04c('0x4b')](_0x196bf4['body'],{})[_0xc04c('0x27')](respondWithResult(_0x360f04,0xc9))[_0xc04c('0x46')](handleError(_0x360f04,null));};exports[_0xc04c('0x26')]=function(_0x3a93bf,_0x1e2590){if(_0x3a93bf['body']['id']){delete _0x3a93bf[_0xc04c('0x4c')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x3a93bf[_0xc04c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e2590,null))[_0xc04c('0x27')](saveUpdates(_0x3a93bf['body'],null))[_0xc04c('0x27')](respondWithResult(_0x1e2590,null))[_0xc04c('0x46')](handleError(_0x1e2590,null));};exports['destroy']=function(_0x37f794,_0x4d6af4){return db[_0xc04c('0x42')][_0xc04c('0x4a')]({'where':{'id':_0x37f794[_0xc04c('0x48')]['id']}})[_0xc04c('0x27')](handleEntityNotFound(_0x4d6af4,null))[_0xc04c('0x27')](removeEntity(_0x4d6af4,null))[_0xc04c('0x46')](handleError(_0x4d6af4,null));}; \ No newline at end of file +var _0x5b8f=['destroy','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b8f,0x15c));var _0xf5b8=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0x5b8f[_0x5515a7];return _0x43f4bf;};'use strict';var emlformat=require(_0xf5b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5b8('0x1'));var jsonpatch=require(_0xf5b8('0x2'));var rp=require(_0xf5b8('0x3'));var moment=require(_0xf5b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5b8('0x5'));var path=require(_0xf5b8('0x6'));var sox=require(_0xf5b8('0x7'));var csv=require(_0xf5b8('0x8'));var ejs=require(_0xf5b8('0x9'));var fs=require('fs');var fs_extra=require(_0xf5b8('0xa'));var _=require(_0xf5b8('0xb'));var squel=require(_0xf5b8('0xc'));var crypto=require(_0xf5b8('0xd'));var jsforce=require(_0xf5b8('0xe'));var deskjs=require(_0xf5b8('0xf'));var toCsv=require(_0xf5b8('0x8'));var querystring=require(_0xf5b8('0x10'));var Papa=require('papaparse');var Redis=require(_0xf5b8('0x11'));var authService=require(_0xf5b8('0x12'));var qs=require(_0xf5b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5b8('0x14'));var logger=require(_0xf5b8('0x15'))(_0xf5b8('0x16'));var utils=require(_0xf5b8('0x17'));var config=require(_0xf5b8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x543b99,_0x176521){_0x176521=_0x176521||0xcc;return function(_0x567d41){if(_0x567d41){return _0x543b99[_0xf5b8('0x19')](_0x176521);}return _0x543b99[_0xf5b8('0x1a')](_0x176521)['end']();};}function respondWithResult(_0xd1dd3,_0x52ea81){_0x52ea81=_0x52ea81||0xc8;return function(_0x10f604){if(_0x10f604){return _0xd1dd3[_0xf5b8('0x1a')](_0x52ea81)[_0xf5b8('0x1b')](_0x10f604);}};}function respondWithFilteredResult(_0x40483c,_0x31ec74){return function(_0x5aec3a){if(_0x5aec3a){var _0xc2cdd0=typeof _0x31ec74[_0xf5b8('0x1c')]===_0xf5b8('0x1d')&&typeof _0x31ec74['limit']==='undefined';var _0x2a8f39=_0x5aec3a['count'];var _0x67aebf=_0xc2cdd0?0x0:_0x31ec74[_0xf5b8('0x1c')];var _0xd2d8da=_0xc2cdd0?_0x5aec3a[_0xf5b8('0x1e')]:_0x31ec74[_0xf5b8('0x1c')]+_0x31ec74['limit'];var _0x5b786e;if(_0xd2d8da>=_0x2a8f39){_0xd2d8da=_0x2a8f39;_0x5b786e=0xc8;}else{_0x5b786e=0xce;}_0x40483c[_0xf5b8('0x1a')](_0x5b786e);return _0x40483c[_0xf5b8('0x1f')](_0xf5b8('0x20'),_0x67aebf+'-'+_0xd2d8da+'/'+_0x2a8f39)['json'](_0x5aec3a);}return null;};}function patchUpdates(_0xf148ab){return function(_0x1ef09a){try{jsonpatch[_0xf5b8('0x21')](_0x1ef09a,_0xf148ab,!![]);}catch(_0x581b3f){return BPromise[_0xf5b8('0x22')](_0x581b3f);}return _0x1ef09a[_0xf5b8('0x23')]();};}function saveUpdates(_0x59e1f5,_0x40f206){return function(_0x58b985){if(_0x58b985){return _0x58b985['update'](_0x59e1f5)[_0xf5b8('0x24')](function(_0x5ee538){return _0x5ee538;});}return null;};}function removeEntity(_0x424f58,_0x34f650){return function(_0x2b243b){if(_0x2b243b){return _0x2b243b[_0xf5b8('0x25')]()[_0xf5b8('0x24')](function(){_0x424f58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b094,_0x1a96c0){return function(_0x1bb65f){if(!_0x1bb65f){_0x52b094[_0xf5b8('0x19')](0x194);}return _0x1bb65f;};}function handleError(_0x122220,_0x17ee53){_0x17ee53=_0x17ee53||0x1f4;return function(_0x5c3f29){logger['error'](_0x5c3f29[_0xf5b8('0x26')]);if(_0x5c3f29[_0xf5b8('0x27')]){delete _0x5c3f29[_0xf5b8('0x27')];}_0x122220[_0xf5b8('0x1a')](_0x17ee53)[_0xf5b8('0x28')](_0x5c3f29);};}exports[_0xf5b8('0x29')]=function(_0x5e156f,_0x37e8a7){var _0x7837b8={},_0xd8af69={},_0x5f3700={'count':0x0,'rows':[]};var _0x5d726a=_[_0xf5b8('0x2a')](db[_0xf5b8('0x2b')][_0xf5b8('0x2c')],function(_0xdc2a71){return{'name':_0xdc2a71[_0xf5b8('0x2d')],'type':_0xdc2a71['type'][_0xf5b8('0x2e')]};});_0xd8af69['model']=_[_0xf5b8('0x2a')](_0x5d726a,_0xf5b8('0x27'));_0xd8af69[_0xf5b8('0x2f')]=_[_0xf5b8('0x30')](_0x5e156f[_0xf5b8('0x2f')]);_0xd8af69['filters']=_[_0xf5b8('0x31')](_0xd8af69['model'],_0xd8af69['query']);_0x7837b8[_0xf5b8('0x32')]=_[_0xf5b8('0x31')](_0xd8af69[_0xf5b8('0x33')],qs[_0xf5b8('0x34')](_0x5e156f[_0xf5b8('0x2f')]['fields']));_0x7837b8[_0xf5b8('0x32')]=_0x7837b8[_0xf5b8('0x32')][_0xf5b8('0x35')]?_0x7837b8[_0xf5b8('0x32')]:_0xd8af69[_0xf5b8('0x33')];if(!_0x5e156f[_0xf5b8('0x2f')][_0xf5b8('0x36')](_0xf5b8('0x37'))){_0x7837b8['limit']=qs[_0xf5b8('0x38')](_0x5e156f[_0xf5b8('0x2f')]['limit']);_0x7837b8[_0xf5b8('0x1c')]=qs[_0xf5b8('0x1c')](_0x5e156f[_0xf5b8('0x2f')][_0xf5b8('0x1c')]);}_0x7837b8[_0xf5b8('0x39')]=qs[_0xf5b8('0x3a')](_0x5e156f[_0xf5b8('0x2f')]['sort']);_0x7837b8[_0xf5b8('0x3b')]=qs[_0xf5b8('0x3c')](_[_0xf5b8('0x3d')](_0x5e156f[_0xf5b8('0x2f')],_0xd8af69[_0xf5b8('0x3c')]),_0x5d726a);if(_0x5e156f['query'][_0xf5b8('0x3e')]){_0x7837b8['where']=_[_0xf5b8('0x3f')](_0x7837b8[_0xf5b8('0x3b')],{'$or':_['map'](_0x5d726a,function(_0x5e4f53){if(_0x5e4f53[_0xf5b8('0x40')]!==_0xf5b8('0x41')){var _0x576dc4={};_0x576dc4[_0x5e4f53['name']]={'$like':'%'+_0x5e156f[_0xf5b8('0x2f')][_0xf5b8('0x3e')]+'%'};return _0x576dc4;}})});}_0x7837b8=_['merge']({},_0x7837b8,_0x5e156f[_0xf5b8('0x42')]);var _0x4893dd={'where':_0x7837b8[_0xf5b8('0x3b')]};return db['SalesforceField'][_0xf5b8('0x1e')](_0x4893dd)['then'](function(_0x2593ea){_0x5f3700[_0xf5b8('0x1e')]=_0x2593ea;if(_0x5e156f['query'][_0xf5b8('0x43')]){_0x7837b8['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x7837b8);})[_0xf5b8('0x24')](function(_0x28e2a2){_0x5f3700[_0xf5b8('0x44')]=_0x28e2a2;return _0x5f3700;})['then'](respondWithFilteredResult(_0x37e8a7,_0x7837b8))[_0xf5b8('0x45')](handleError(_0x37e8a7,null));};exports[_0xf5b8('0x46')]=function(_0x2e74f6,_0x3af57c){var _0x439aa8={'raw':!![],'where':{'id':_0x2e74f6[_0xf5b8('0x47')]['id']}},_0x30d659={};_0x30d659[_0xf5b8('0x33')]=_['keys'](db[_0xf5b8('0x2b')]['rawAttributes']);_0x30d659[_0xf5b8('0x2f')]=_[_0xf5b8('0x30')](_0x2e74f6[_0xf5b8('0x2f')]);_0x30d659[_0xf5b8('0x3c')]=_[_0xf5b8('0x31')](_0x30d659[_0xf5b8('0x33')],_0x30d659[_0xf5b8('0x2f')]);_0x439aa8['attributes']=_[_0xf5b8('0x31')](_0x30d659[_0xf5b8('0x33')],qs[_0xf5b8('0x34')](_0x2e74f6['query'][_0xf5b8('0x34')]));_0x439aa8[_0xf5b8('0x32')]=_0x439aa8[_0xf5b8('0x32')][_0xf5b8('0x35')]?_0x439aa8[_0xf5b8('0x32')]:_0x30d659[_0xf5b8('0x33')];if(_0x2e74f6['query']['includeAll']){_0x439aa8[_0xf5b8('0x48')]=[{'all':!![]}];}_0x439aa8=_[_0xf5b8('0x3f')]({},_0x439aa8,_0x2e74f6[_0xf5b8('0x42')]);return db['SalesforceField'][_0xf5b8('0x49')](_0x439aa8)[_0xf5b8('0x24')](handleEntityNotFound(_0x3af57c,null))[_0xf5b8('0x24')](respondWithResult(_0x3af57c,null))[_0xf5b8('0x45')](handleError(_0x3af57c,null));};exports[_0xf5b8('0x4a')]=function(_0x15913a,_0x284703){return db[_0xf5b8('0x2b')][_0xf5b8('0x4a')](_0x15913a[_0xf5b8('0x4b')],{})[_0xf5b8('0x24')](respondWithResult(_0x284703,0xc9))[_0xf5b8('0x45')](handleError(_0x284703,null));};exports[_0xf5b8('0x4c')]=function(_0x53a69e,_0x4feba4){if(_0x53a69e[_0xf5b8('0x4b')]['id']){delete _0x53a69e['body']['id'];}return db[_0xf5b8('0x2b')]['find']({'where':{'id':_0x53a69e[_0xf5b8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4feba4,null))[_0xf5b8('0x24')](saveUpdates(_0x53a69e[_0xf5b8('0x4b')],null))[_0xf5b8('0x24')](respondWithResult(_0x4feba4,null))['catch'](handleError(_0x4feba4,null));};exports[_0xf5b8('0x25')]=function(_0x3a4970,_0x580983){return db[_0xf5b8('0x2b')][_0xf5b8('0x49')]({'where':{'id':_0x3a4970[_0xf5b8('0x47')]['id']}})['then'](handleEntityNotFound(_0x580983,null))[_0xf5b8('0x24')](removeEntity(_0x580983,null))['catch'](handleError(_0x580983,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index cfbc471..d01d426 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 _0x33b9=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0x33b9,0x1ee));var _0x933b=function(_0x17229a,_0x288b06){_0x17229a=_0x17229a-0x0;var _0x18a8e8=_0x33b9[_0x17229a];return _0x18a8e8;};'use strict';var _=require('lodash');var util=require(_0x933b('0x0'));var logger=require(_0x933b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x933b('0x2'));var rp=require(_0x933b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x933b('0x4'));var config=require(_0x933b('0x5'));var attributes=require(_0x933b('0x6'));module['exports']=function(_0x5393fc,_0x11f2a3){return _0x5393fc[_0x933b('0x7')](_0x933b('0x8'),attributes,{'tableName':_0x933b('0x9'),'paranoid':![],'indexes':[{'name':_0x933b('0xa'),'fields':[_0x933b('0xb'),_0x933b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6b1=['salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','SalesforceField'];(function(_0x5635a3,_0x5064ae){var _0x128d1a=function(_0x43dbeb){while(--_0x43dbeb){_0x5635a3['push'](_0x5635a3['shift']());}};_0x128d1a(++_0x5064ae);}(_0xc6b1,0x65));var _0x1c6b=function(_0x50367e,_0x4e0850){_0x50367e=_0x50367e-0x0;var _0x5c65ed=_0xc6b1[_0x50367e];return _0x5c65ed;};'use strict';var _=require(_0x1c6b('0x0'));var util=require(_0x1c6b('0x1'));var logger=require(_0x1c6b('0x2'))(_0x1c6b('0x3'));var moment=require(_0x1c6b('0x4'));var BPromise=require(_0x1c6b('0x5'));var rp=require(_0x1c6b('0x6'));var fs=require('fs');var path=require(_0x1c6b('0x7'));var rimraf=require('rimraf');var config=require(_0x1c6b('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x1c6b('0x9')]=function(_0x401628,_0xe33c47){return _0x401628['define'](_0x1c6b('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1c6b('0xb'),'fields':[_0x1c6b('0xc'),_0x1c6b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b067e71..22ca440 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 _0x3b91=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x443f1c,_0x196e24){var _0x15e894=function(_0x2553de){while(--_0x2553de){_0x443f1c['push'](_0x443f1c['shift']());}};_0x15e894(++_0x196e24);}(_0x3b91,0xeb));var _0x13b9=function(_0x37c5ad,_0x56dd08){_0x37c5ad=_0x37c5ad-0x0;var _0x3adf96=_0x3b91[_0x37c5ad];return _0x3adf96;};'use strict';var _=require('lodash');var util=require(_0x13b9('0x0'));var moment=require(_0x13b9('0x1'));var BPromise=require(_0x13b9('0x2'));var rs=require(_0x13b9('0x3'));var fs=require('fs');var Redis=require(_0x13b9('0x4'));var db=require(_0x13b9('0x5'))['db'];var utils=require(_0x13b9('0x6'));var logger=require(_0x13b9('0x7'))(_0x13b9('0x8'));var config=require(_0x13b9('0x9'));var jayson=require(_0x13b9('0xa'));var client=jayson[_0x13b9('0xb')][_0x13b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xad0882,_0x271fa2,_0x1d365d){return new BPromise(function(_0x250596,_0x4b5335){return client[_0x13b9('0xd')](_0xad0882,_0x1d365d)['then'](function(_0x16d713){logger['info'](_0x13b9('0xe'),_0x271fa2,_0x13b9('0xf'));logger[_0x13b9('0x10')](_0x13b9('0x11'),_0x271fa2,_0x13b9('0xf'),JSON['stringify'](_0x16d713));if(_0x16d713[_0x13b9('0x12')]){if(_0x16d713[_0x13b9('0x12')]['code']===0x1f4){logger[_0x13b9('0x12')]('SalesforceField,\x20%s,\x20%s',_0x271fa2,_0x16d713['error'][_0x13b9('0x13')]);return _0x4b5335(_0x16d713[_0x13b9('0x12')][_0x13b9('0x13')]);}logger['error'](_0x13b9('0xe'),_0x271fa2,_0x16d713[_0x13b9('0x12')][_0x13b9('0x13')]);return _0x250596(_0x16d713[_0x13b9('0x12')]['message']);}else{logger['info'](_0x13b9('0xe'),_0x271fa2,_0x13b9('0xf'));_0x250596(_0x16d713[_0x13b9('0x14')][_0x13b9('0x13')]);}})[_0x13b9('0x15')](function(_0x2903fb){logger[_0x13b9('0x12')]('SalesforceField,\x20%s,\x20%s',_0x271fa2,_0x2903fb);_0x4b5335(_0x2903fb);});});} \ No newline at end of file +var _0x9ad6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch'];(function(_0x5d6fcb,_0x3d6dc3){var _0x5dac3d=function(_0x124ae0){while(--_0x124ae0){_0x5d6fcb['push'](_0x5d6fcb['shift']());}};_0x5dac3d(++_0x3d6dc3);}(_0x9ad6,0x198));var _0x69ad=function(_0x4fe4fd,_0x53cce2){_0x4fe4fd=_0x4fe4fd-0x0;var _0x1a21bf=_0x9ad6[_0x4fe4fd];return _0x1a21bf;};'use strict';var _=require(_0x69ad('0x0'));var util=require(_0x69ad('0x1'));var moment=require(_0x69ad('0x2'));var BPromise=require(_0x69ad('0x3'));var rs=require(_0x69ad('0x4'));var fs=require('fs');var Redis=require(_0x69ad('0x5'));var db=require(_0x69ad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x69ad('0x7'))('rpc');var config=require(_0x69ad('0x8'));var jayson=require(_0x69ad('0x9'));var client=jayson[_0x69ad('0xa')][_0x69ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e2b21,_0x308079,_0x1a12a3){return new BPromise(function(_0x56c3af,_0x2901ff){return client[_0x69ad('0xc')](_0x5e2b21,_0x1a12a3)[_0x69ad('0xd')](function(_0x7c6f32){logger['info'](_0x69ad('0xe'),_0x308079,'request\x20sent');logger[_0x69ad('0xf')](_0x69ad('0x10'),_0x308079,'request\x20sent',JSON['stringify'](_0x7c6f32));if(_0x7c6f32[_0x69ad('0x11')]){if(_0x7c6f32[_0x69ad('0x11')][_0x69ad('0x12')]===0x1f4){logger[_0x69ad('0x11')](_0x69ad('0xe'),_0x308079,_0x7c6f32[_0x69ad('0x11')][_0x69ad('0x13')]);return _0x2901ff(_0x7c6f32[_0x69ad('0x11')][_0x69ad('0x13')]);}logger[_0x69ad('0x11')]('SalesforceField,\x20%s,\x20%s',_0x308079,_0x7c6f32[_0x69ad('0x11')][_0x69ad('0x13')]);return _0x56c3af(_0x7c6f32[_0x69ad('0x11')]['message']);}else{logger[_0x69ad('0x14')](_0x69ad('0xe'),_0x308079,_0x69ad('0x15'));_0x56c3af(_0x7c6f32[_0x69ad('0x16')]['message']);}})[_0x69ad('0x17')](function(_0x1e903e){logger[_0x69ad('0x11')](_0x69ad('0xe'),_0x308079,_0x1e903e);_0x2901ff(_0x1e903e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 90a094b..71560cd 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 _0xd96b=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x4b6ff4,_0x12ea15){var _0x5508e5=function(_0x53bd29){while(--_0x53bd29){_0x4b6ff4['push'](_0x4b6ff4['shift']());}};_0x5508e5(++_0x12ea15);}(_0xd96b,0x109));var _0xbd96=function(_0x483b2f,_0xc7fa87){_0x483b2f=_0x483b2f-0x0;var _0x57e4b5=_0xd96b[_0x483b2f];return _0x57e4b5;};'use strict';var multer=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var path=require(_0xbd96('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd96('0x3'));var router=express[_0xbd96('0x4')]();var fs_extra=require(_0xbd96('0x5'));var auth=require(_0xbd96('0x6'));var interaction=require(_0xbd96('0x7'));var config=require(_0xbd96('0x8'));var controller=require(_0xbd96('0x9'));router[_0xbd96('0xa')]('/',auth[_0xbd96('0xb')](),controller[_0xbd96('0xc')]);router[_0xbd96('0xa')](_0xbd96('0xd'),auth[_0xbd96('0xb')](),controller['show']);router[_0xbd96('0xa')](_0xbd96('0xe'),auth[_0xbd96('0xb')](),controller['getConfigurations']);router[_0xbd96('0xa')](_0xbd96('0xf'),auth[_0xbd96('0xb')](),controller[_0xbd96('0x10')]);router[_0xbd96('0x11')]('/',auth[_0xbd96('0xb')](),controller['create']);router[_0xbd96('0x11')](_0xbd96('0xe'),auth[_0xbd96('0xb')](),controller['addConfiguration']);router[_0xbd96('0x12')](_0xbd96('0xd'),auth['isAuthenticated'](),controller[_0xbd96('0x13')]);router[_0xbd96('0x14')]('/:id',auth[_0xbd96('0xb')](),controller[_0xbd96('0x15')]);module[_0xbd96('0x16')]=router; \ No newline at end of file +var _0xcd56=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','exports','multer','util','path','express','Router'];(function(_0x19c1f4,_0x509bbc){var _0x530b04=function(_0x993e27){while(--_0x993e27){_0x19c1f4['push'](_0x19c1f4['shift']());}};_0x530b04(++_0x509bbc);}(_0xcd56,0x1c9));var _0x6cd5=function(_0x5d6807,_0x2c49d4){_0x5d6807=_0x5d6807-0x0;var _0x50843a=_0xcd56[_0x5d6807];return _0x50843a;};'use strict';var multer=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var path=require(_0x6cd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cd5('0x3'));var router=express[_0x6cd5('0x4')]();var fs_extra=require(_0x6cd5('0x5'));var auth=require(_0x6cd5('0x6'));var interaction=require(_0x6cd5('0x7'));var config=require(_0x6cd5('0x8'));var controller=require(_0x6cd5('0x9'));router[_0x6cd5('0xa')]('/',auth['isAuthenticated'](),controller[_0x6cd5('0xb')]);router[_0x6cd5('0xa')](_0x6cd5('0xc'),auth[_0x6cd5('0xd')](),controller['show']);router['get'](_0x6cd5('0xe'),auth[_0x6cd5('0xd')](),controller[_0x6cd5('0xf')]);router[_0x6cd5('0xa')](_0x6cd5('0x10'),auth[_0x6cd5('0xd')](),controller[_0x6cd5('0x11')]);router[_0x6cd5('0x12')]('/',auth[_0x6cd5('0xd')](),controller['create']);router[_0x6cd5('0x12')]('/:id/configurations',auth[_0x6cd5('0xd')](),controller[_0x6cd5('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6cd5('0x14')]);router['delete'](_0x6cd5('0xc'),auth[_0x6cd5('0xd')](),controller['destroy']);module[_0x6cd5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 07c8c07..0614eb1 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 _0xee9b=['sequelize','exports','STRING','username','remoteUri'];(function(_0x54ef43,_0x308497){var _0x4e3816=function(_0x5147c6){while(--_0x5147c6){_0x54ef43['push'](_0x54ef43['shift']());}};_0x4e3816(++_0x308497);}(_0xee9b,0x186));var _0xbee9=function(_0x415b2d,_0x8c1676){_0x415b2d=_0x415b2d-0x0;var _0x5966b7=_0xee9b[_0x415b2d];return _0x5966b7;};'use strict';var Sequelize=require(_0xbee9('0x0'));module[_0xbee9('0x1')]={'name':{'type':Sequelize[_0xbee9('0x2')]},'description':{'type':Sequelize[_0xbee9('0x2')]},'username':{'type':Sequelize[_0xbee9('0x2')],'unique':_0xbee9('0x3')},'password':{'type':Sequelize[_0xbee9('0x2')]},'email':{'type':Sequelize[_0xbee9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xbee9('0x4')},'serverUrl':{'type':Sequelize[_0xbee9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x79a9=['exports','STRING','remoteUri','sequelize'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x79a9,0x1db));var _0x979a=function(_0x2ebd0f,_0x2536ba){_0x2ebd0f=_0x2ebd0f-0x0;var _0x4c8f5e=_0x79a9[_0x2ebd0f];return _0x4c8f5e;};'use strict';var Sequelize=require(_0x979a('0x0'));module[_0x979a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x979a('0x2')]},'username':{'type':Sequelize[_0x979a('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x979a('0x2')]},'email':{'type':Sequelize[_0x979a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x979a('0x3')},'serverUrl':{'type':Sequelize[_0x979a('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 9306a17..2245b24 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 _0xa54a=['False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','include','findAll','catch','show','params','includeAll','find','body','getConfigurations','ServicenowConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','category','username','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','assign','remove','internalType','label','push','all','log','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','test','statusCode','Wrong\x20credentials','boolean','true'];(function(_0x516d88,_0x27df32){var _0x27050a=function(_0x27bbd5){while(--_0x27bbd5){_0x516d88['push'](_0x516d88['shift']());}};_0x27050a(++_0x27df32);}(_0xa54a,0xba));var _0xaa54=function(_0x196568,_0xca661d){_0x196568=_0x196568-0x0;var _0x103c20=_0xa54a[_0x196568];return _0x103c20;};'use strict';var emlformat=require(_0xaa54('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa54('0x1'));var rp=require(_0xaa54('0x2'));var moment=require(_0xaa54('0x3'));var BPromise=require(_0xaa54('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaa54('0x5'));var sox=require(_0xaa54('0x6'));var csv=require(_0xaa54('0x7'));var ejs=require(_0xaa54('0x8'));var fs=require('fs');var fs_extra=require(_0xaa54('0x9'));var _=require(_0xaa54('0xa'));var squel=require('squel');var crypto=require(_0xaa54('0xb'));var jsforce=require(_0xaa54('0xc'));var deskjs=require(_0xaa54('0xd'));var toCsv=require(_0xaa54('0x7'));var querystring=require(_0xaa54('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa54('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa54('0x10'));var logger=require(_0xaa54('0x11'))(_0xaa54('0x12'));var utils=require(_0xaa54('0x13'));var config=require(_0xaa54('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa54('0x15'))['db'];var integrations=require(_0xaa54('0x16'));function respondWithStatusCode(_0x593a79,_0x501db9){_0x501db9=_0x501db9||0xcc;return function(_0x48b35e){if(_0x48b35e){return _0x593a79[_0xaa54('0x17')](_0x501db9);}return _0x593a79[_0xaa54('0x18')](_0x501db9)['end']();};}function respondWithResult(_0xc0a702,_0x300d2f){_0x300d2f=_0x300d2f||0xc8;return function(_0x3ac866){if(_0x3ac866){return _0xc0a702[_0xaa54('0x18')](_0x300d2f)[_0xaa54('0x19')](_0x3ac866);}};}function respondWithFilteredResult(_0x3a19f6,_0x39834a){return function(_0x1ca4d5){if(_0x1ca4d5){var _0x31f272=typeof _0x39834a[_0xaa54('0x1a')]==='undefined'&&typeof _0x39834a[_0xaa54('0x1b')]===_0xaa54('0x1c');var _0x284ed1=_0x1ca4d5[_0xaa54('0x1d')];var _0x143a73=_0x31f272?0x0:_0x39834a[_0xaa54('0x1a')];var _0x2a3a35=_0x31f272?_0x1ca4d5[_0xaa54('0x1d')]:_0x39834a[_0xaa54('0x1a')]+_0x39834a[_0xaa54('0x1b')];var _0x1eb262;if(_0x2a3a35>=_0x284ed1){_0x2a3a35=_0x284ed1;_0x1eb262=0xc8;}else{_0x1eb262=0xce;}_0x3a19f6[_0xaa54('0x18')](_0x1eb262);return _0x3a19f6[_0xaa54('0x1e')](_0xaa54('0x1f'),_0x143a73+'-'+_0x2a3a35+'/'+_0x284ed1)['json'](_0x1ca4d5);}return null;};}function patchUpdates(_0x2fd98b){return function(_0x59a5ac){try{jsonpatch[_0xaa54('0x20')](_0x59a5ac,_0x2fd98b,!![]);}catch(_0x4fbe44){return BPromise['reject'](_0x4fbe44);}return _0x59a5ac[_0xaa54('0x21')]();};}function saveUpdates(_0x5e64cb,_0x4d140c){return function(_0x261486){if(_0x261486){return _0x261486[_0xaa54('0x22')](_0x5e64cb)[_0xaa54('0x23')](function(_0x199e2a){return _0x199e2a;});}return null;};}function removeEntity(_0x5cdad8,_0x4d85c6){return function(_0x54e570){if(_0x54e570){return _0x54e570[_0xaa54('0x24')]()['then'](function(){_0x5cdad8['status'](0xcc)[_0xaa54('0x25')]();});}};}function handleEntityNotFound(_0x460003,_0x3bc321){return function(_0x246008){if(!_0x246008){_0x460003[_0xaa54('0x17')](0x194);}return _0x246008;};}function handleError(_0x18a5c7,_0x3a95ee){_0x3a95ee=_0x3a95ee||0x1f4;return function(_0x4d3a96){logger[_0xaa54('0x26')](_0x4d3a96[_0xaa54('0x27')]);if(_0x4d3a96[_0xaa54('0x28')]){delete _0x4d3a96[_0xaa54('0x28')];}_0x18a5c7['status'](_0x3a95ee)['send'](_0x4d3a96);};}exports['index']=function(_0x3925d9,_0x5381b5){var _0x124f69={},_0x134e2c={},_0x1dbb29={'count':0x0,'rows':[]};var _0x234bfa=_['map'](db['ServicenowAccount'][_0xaa54('0x29')],function(_0x2c7d35){return{'name':_0x2c7d35[_0xaa54('0x2a')],'type':_0x2c7d35['type'][_0xaa54('0x2b')]};});_0x134e2c[_0xaa54('0x2c')]=_[_0xaa54('0x2d')](_0x234bfa,'name');_0x134e2c[_0xaa54('0x2e')]=_[_0xaa54('0x2f')](_0x3925d9[_0xaa54('0x2e')]);_0x134e2c[_0xaa54('0x30')]=_[_0xaa54('0x31')](_0x134e2c[_0xaa54('0x2c')],_0x134e2c[_0xaa54('0x2e')]);_0x124f69[_0xaa54('0x32')]=_[_0xaa54('0x31')](_0x134e2c[_0xaa54('0x2c')],qs[_0xaa54('0x33')](_0x3925d9[_0xaa54('0x2e')][_0xaa54('0x33')]));_0x124f69['attributes']=_0x124f69['attributes'][_0xaa54('0x34')]?_0x124f69['attributes']:_0x134e2c[_0xaa54('0x2c')];if(!_0x3925d9['query']['hasOwnProperty'](_0xaa54('0x35'))){_0x124f69[_0xaa54('0x1b')]=qs['limit'](_0x3925d9[_0xaa54('0x2e')]['limit']);_0x124f69['offset']=qs[_0xaa54('0x1a')](_0x3925d9[_0xaa54('0x2e')][_0xaa54('0x1a')]);}_0x124f69[_0xaa54('0x36')]=qs[_0xaa54('0x37')](_0x3925d9[_0xaa54('0x2e')]['sort']);_0x124f69[_0xaa54('0x38')]=qs[_0xaa54('0x30')](_[_0xaa54('0x39')](_0x3925d9['query'],_0x134e2c[_0xaa54('0x30')]),_0x234bfa);if(_0x3925d9['query'][_0xaa54('0x3a')]){_0x124f69[_0xaa54('0x38')]=_[_0xaa54('0x3b')](_0x124f69[_0xaa54('0x38')],{'$or':_[_0xaa54('0x2d')](_0x234bfa,function(_0xfa46fa){if(_0xfa46fa['type']!==_0xaa54('0x3c')){var _0x5d8864={};_0x5d8864[_0xfa46fa['name']]={'$like':'%'+_0x3925d9[_0xaa54('0x2e')][_0xaa54('0x3a')]+'%'};return _0x5d8864;}})});}_0x124f69=_['merge']({},_0x124f69,_0x3925d9[_0xaa54('0x3d')]);var _0x2dea8e={'where':_0x124f69[_0xaa54('0x38')]};return db[_0xaa54('0x3e')][_0xaa54('0x1d')](_0x2dea8e)[_0xaa54('0x23')](function(_0x16d906){_0x1dbb29[_0xaa54('0x1d')]=_0x16d906;if(_0x3925d9[_0xaa54('0x2e')]['includeAll']){_0x124f69[_0xaa54('0x3f')]=[{'all':!![]}];}return db[_0xaa54('0x3e')][_0xaa54('0x40')](_0x124f69);})[_0xaa54('0x23')](function(_0x4f874a){_0x1dbb29['rows']=_0x4f874a;return _0x1dbb29;})['then'](respondWithFilteredResult(_0x5381b5,_0x124f69))[_0xaa54('0x41')](handleError(_0x5381b5,null));};exports[_0xaa54('0x42')]=function(_0x35f8c5,_0x462ac9){var _0x558b73={'raw':![],'where':{'id':_0x35f8c5[_0xaa54('0x43')]['id']}},_0x575c0f={};_0x575c0f[_0xaa54('0x2c')]=_['keys'](db[_0xaa54('0x3e')][_0xaa54('0x29')]);_0x575c0f[_0xaa54('0x2e')]=_[_0xaa54('0x2f')](_0x35f8c5[_0xaa54('0x2e')]);_0x575c0f[_0xaa54('0x30')]=_[_0xaa54('0x31')](_0x575c0f['model'],_0x575c0f['query']);_0x558b73[_0xaa54('0x32')]=_[_0xaa54('0x31')](_0x575c0f['model'],qs[_0xaa54('0x33')](_0x35f8c5[_0xaa54('0x2e')]['fields']));_0x558b73[_0xaa54('0x32')]=_0x558b73['attributes'][_0xaa54('0x34')]?_0x558b73['attributes']:_0x575c0f[_0xaa54('0x2c')];if(_0x35f8c5[_0xaa54('0x2e')][_0xaa54('0x44')]){_0x558b73[_0xaa54('0x3f')]=[{'all':!![]}];}_0x558b73=_[_0xaa54('0x3b')]({},_0x558b73,_0x35f8c5[_0xaa54('0x3d')]);return db[_0xaa54('0x3e')][_0xaa54('0x45')](_0x558b73)[_0xaa54('0x23')](handleEntityNotFound(_0x462ac9,null))['then'](respondWithResult(_0x462ac9,null))[_0xaa54('0x41')](handleError(_0x462ac9,null));};exports['create']=function(_0x235f27,_0x491c2f){return db[_0xaa54('0x3e')]['create'](_0x235f27[_0xaa54('0x46')],{})[_0xaa54('0x23')](respondWithResult(_0x491c2f,0xc9))[_0xaa54('0x41')](handleError(_0x491c2f,null));};exports[_0xaa54('0x22')]=function(_0x331ef0,_0x1c05b1){if(_0x331ef0[_0xaa54('0x46')]['id']){delete _0x331ef0[_0xaa54('0x46')]['id'];}return db['ServicenowAccount'][_0xaa54('0x45')]({'where':{'id':_0x331ef0[_0xaa54('0x43')]['id']}})[_0xaa54('0x23')](handleEntityNotFound(_0x1c05b1,null))[_0xaa54('0x23')](saveUpdates(_0x331ef0[_0xaa54('0x46')],null))[_0xaa54('0x23')](respondWithResult(_0x1c05b1,null))[_0xaa54('0x41')](handleError(_0x1c05b1,null));};exports[_0xaa54('0x24')]=function(_0x1c3ba4,_0x531b7a){return db['ServicenowAccount']['find']({'where':{'id':_0x1c3ba4[_0xaa54('0x43')]['id']}})['then'](handleEntityNotFound(_0x531b7a,null))['then'](removeEntity(_0x531b7a,null))[_0xaa54('0x41')](handleError(_0x531b7a,null));};exports[_0xaa54('0x47')]=function(_0x37a858,_0x42ba84,_0x3855b9){var _0x124899={};var _0x54ad5c={};var _0x114d5e;var _0x595990;return db[_0xaa54('0x3e')]['findOne']({'where':{'id':_0x37a858[_0xaa54('0x43')]['id']}})[_0xaa54('0x23')](handleEntityNotFound(_0x42ba84,null))[_0xaa54('0x23')](function(_0x459dc6){if(_0x459dc6){_0x114d5e=_0x459dc6;_0x54ad5c[_0xaa54('0x2c')]=_[_0xaa54('0x2f')](db[_0xaa54('0x48')][_0xaa54('0x29')]);_0x54ad5c[_0xaa54('0x2e')]=_[_0xaa54('0x2f')](_0x37a858['query']);_0x54ad5c[_0xaa54('0x30')]=_[_0xaa54('0x31')](_0x54ad5c[_0xaa54('0x2c')],_0x54ad5c[_0xaa54('0x2e')]);_0x124899[_0xaa54('0x32')]=_[_0xaa54('0x31')](_0x54ad5c[_0xaa54('0x2c')],qs[_0xaa54('0x33')](_0x37a858[_0xaa54('0x2e')][_0xaa54('0x33')]));_0x124899[_0xaa54('0x32')]=_0x124899[_0xaa54('0x32')][_0xaa54('0x34')]?_0x124899[_0xaa54('0x32')]:_0x54ad5c['model'];_0x124899['order']=qs[_0xaa54('0x37')](_0x37a858['query']['sort']);_0x124899['where']=qs[_0xaa54('0x30')](_[_0xaa54('0x39')](_0x37a858[_0xaa54('0x2e')],_0x54ad5c[_0xaa54('0x30')]));if(_0x37a858[_0xaa54('0x2e')][_0xaa54('0x3a')]){_0x124899[_0xaa54('0x38')]=_[_0xaa54('0x3b')](_0x124899[_0xaa54('0x38')],{'$or':_[_0xaa54('0x2d')](_0x124899[_0xaa54('0x32')],function(_0x82c494){var _0x450b71={};_0x450b71[_0x82c494]={'$like':'%'+_0x37a858[_0xaa54('0x2e')]['filter']+'%'};return _0x450b71;})});}_0x124899=_[_0xaa54('0x3b')]({},_0x124899,_0x37a858[_0xaa54('0x3d')]);return _0x114d5e[_0xaa54('0x47')](_0x124899);}})['then'](function(_0x893dc){if(_0x893dc){_0x595990=_0x893dc[_0xaa54('0x34')];if(!_0x37a858[_0xaa54('0x2e')][_0xaa54('0x49')](_0xaa54('0x35'))){_0x124899[_0xaa54('0x1b')]=qs['limit'](_0x37a858[_0xaa54('0x2e')][_0xaa54('0x1b')]);_0x124899[_0xaa54('0x1a')]=qs[_0xaa54('0x1a')](_0x37a858[_0xaa54('0x2e')][_0xaa54('0x1a')]);}return _0x114d5e[_0xaa54('0x47')](_0x124899);}})['then'](function(_0x5d9998){if(_0x5d9998){return _0x5d9998?{'count':_0x595990,'rows':_0x5d9998}:null;}})[_0xaa54('0x23')](respondWithResult(_0x42ba84,null))[_0xaa54('0x41')](handleError(_0x42ba84,null));};exports[_0xaa54('0x4a')]=function(_0x32cb34,_0x9b6e81,_0x2ea7e4){if(_0x32cb34[_0xaa54('0x46')]['id']){delete _0x32cb34[_0xaa54('0x46')]['id'];}return db[_0xaa54('0x3e')][_0xaa54('0x4b')]({'where':{'id':_0x32cb34[_0xaa54('0x43')]['id']}})[_0xaa54('0x23')](handleEntityNotFound(_0x9b6e81,null))[_0xaa54('0x23')](function(_0x192927){if(_0x192927){_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4c')]=_0x192927['id'];_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4d')]=integrations['getSubjects'](_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4e')],_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4f')]);_0x32cb34[_0xaa54('0x46')][_0xaa54('0x50')]=integrations[_0xaa54('0x51')](_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4e')],_0x32cb34[_0xaa54('0x46')][_0xaa54('0x4f')]);return db[_0xaa54('0x48')]['create'](_0x32cb34[_0xaa54('0x46')],{'include':[{'model':db[_0xaa54('0x52')],'as':_0xaa54('0x4d')},{'model':db[_0xaa54('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x9b6e81,null))[_0xaa54('0x41')](handleError(_0x9b6e81,null));};exports[_0xaa54('0x53')]=function(_0x3bd595,_0x1d3e78,_0x2b823c){var _0x188d0c=[_0xaa54('0x54'),_0xaa54('0x55'),'knowledge','subcategory',_0xaa54('0x56'),_0xaa54('0x57'),_0xaa54('0x58'),'severity','category'];var _0x4e6109=[_0xaa54('0x59'),_0xaa54('0x54'),_0xaa54('0x5a'),_0xaa54('0x5b'),_0xaa54('0x5c'),'sys_updated_on',_0xaa54('0x5d'),_0xaa54('0x55'),'approval_history',_0xaa54('0x5e'),_0xaa54('0x5f'),'sys_updated_by',_0xaa54('0x60'),_0xaa54('0x61'),_0xaa54('0x62'),'sys_domain','state',_0xaa54('0x63'),_0xaa54('0x64'),_0xaa54('0x36'),_0xaa54('0x65'),_0xaa54('0x66'),_0xaa54('0x67'),_0xaa54('0x68'),_0xaa54('0x69'),_0xaa54('0x6a'),_0xaa54('0x6b'),_0xaa54('0x6c'),_0xaa54('0x6d'),'sys_domain_path',_0xaa54('0x6e'),_0xaa54('0x6f'),_0xaa54('0x70'),'opened_at','business_duration',_0xaa54('0x71'),'work_end',_0xaa54('0x72'),_0xaa54('0x73'),_0xaa54('0x74'),_0xaa54('0x75'),_0xaa54('0x76'),_0xaa54('0x77'),_0xaa54('0x78'),'close_code',_0xaa54('0x79'),_0xaa54('0x7a'),'work_start',_0xaa54('0x7b'),_0xaa54('0x7c'),_0xaa54('0x7d'),_0xaa54('0x7e'),'calendar_duration',_0xaa54('0x57'),_0xaa54('0x7f'),_0xaa54('0x80'),_0xaa54('0x81'),_0xaa54('0x82'),_0xaa54('0x83'),_0xaa54('0x84'),_0xaa54('0x85'),'reopened_by',_0xaa54('0x58'),_0xaa54('0x86'),_0xaa54('0x87'),_0xaa54('0x88'),_0xaa54('0x89'),'activity_due',_0xaa54('0x8a'),_0xaa54('0x8b'),_0xaa54('0x8c'),'sla_due',_0xaa54('0x8d'),_0xaa54('0x8e'),_0xaa54('0x8f'),_0xaa54('0x90'),'reopen_count',_0xaa54('0x91'),'escalation',_0xaa54('0x92'),_0xaa54('0x93'),_0xaa54('0x94'),_0xaa54('0x95')];var _0x575410='';var _0xd6cfc0='';var _0xc81ea8=[];var _0x10084d='';var _0x4264a0='';var _0x41dd98=[];var _0x2d16fa='';var _0x332aa0='';var _0x5626fe={};var _0x4d2b38='';return db[_0xaa54('0x3e')][_0xaa54('0x4b')]({'where':{'id':_0x3bd595[_0xaa54('0x43')]['id']},'attributes':['id',_0xaa54('0x96'),'password','email',_0xaa54('0x97'),'serverUrl']})[_0xaa54('0x23')](handleEntityNotFound(_0x1d3e78,null))[_0xaa54('0x23')](function(_0x10093f){if(_0x10093f){_0x4d2b38=_0x10093f[_0xaa54('0x97')];var _0x5a5bb4=_0x4d2b38[_0xaa54('0x98')](-0x1);if(_0x5a5bb4==='/'){_0x4d2b38=_0x4d2b38['substring'](0x0,_0x4d2b38[_0xaa54('0x99')](_0x5a5bb4));}_0x332aa0=util[_0xaa54('0x9a')](_0xaa54('0x9b'),_0x4d2b38);_0x2d16fa=util['format'](_0xaa54('0x9c'),_0x4d2b38);_0x5626fe={'user':_0x10093f[_0xaa54('0x96')],'pass':_0x10093f[_0xaa54('0x9d')]};var _0x3ccccd={'method':_0xaa54('0x9e'),'uri':_0x332aa0+_0xaa54('0x9f'),'auth':_0x5626fe,'json':!![]};return rp(_0x3ccccd);}})[_0xaa54('0x23')](function(_0x58f2f4){if(_0x58f2f4[_0xaa54('0xa0')][_0xaa54('0x34')]>0x0){_0x575410=_0x58f2f4[_0xaa54('0xa0')];}console['log']('incident\x20table\x20objects',_0x575410);_0x41dd98=[];_0xd6cfc0=Object[_0xaa54('0xa1')]([],_0x575410);_[_0xaa54('0xa2')](_0xd6cfc0,function(_0x271a1c){return!_0x188d0c['includes'](_0x271a1c[_0xaa54('0x28')]);});_0xd6cfc0['forEach'](function(_0x3baafa){var _0x4b07aa=createFieldObject(_0x2d16fa,_0x5626fe,_0x3baafa[_0xaa54('0xa3')],_0x3baafa['name'],_0x3baafa[_0xaa54('0xa4')],![]);_0x41dd98[_0xaa54('0xa5')](_0x4b07aa);});return Promise[_0xaa54('0xa6')](_0x41dd98);})[_0xaa54('0x23')](function(_0x5942ac){_0xc81ea8=_0x5942ac;_0x10084d=Object['assign']([],_0x575410);console[_0xaa54('0xa7')](_0xaa54('0xa8'),_0x575410);_[_0xaa54('0xa2')](_0x10084d,function(_0x569343){return _0x4e6109[_0xaa54('0xa9')](_0x569343[_0xaa54('0x28')]);});console['log'](_0xaa54('0xaa'),_0x10084d);_0x41dd98=[];_0x10084d[_0xaa54('0xab')](function(_0x362658){var _0x26ee32=createFieldObject(_0x2d16fa,_0x5626fe,_0x362658[_0xaa54('0xa3')],_0x362658['name'],_0x362658[_0xaa54('0xa4')],!![]);_0x41dd98['push'](_0x26ee32);});return Promise[_0xaa54('0xa6')](_0x41dd98);})['then'](function(_0x10e07d){_0x4264a0=_0x10e07d;var _0x3ec8d3=_0xc81ea8[_0xaa54('0xac')](_0x4264a0);return{'count':_0x3ec8d3[_0xaa54('0x34')],'rows':_0x3ec8d3};})[_0xaa54('0x23')](respondWithResult(_0x1d3e78,null))[_0xaa54('0x41')](function(_0x1c117d){console[_0xaa54('0xa7')]('ServiceNow\x20error:\x20'+_0x1c117d);var _0x2b5e86=_0x3bd595[_0xaa54('0x2e')][_0xaa54('0xad')]?0x1f4:_0x1c117d[_0xaa54('0xae')]||0x1f4;logger[_0xaa54('0x26')](_0x1c117d['stack']);delete _0x1c117d[_0xaa54('0x28')];if(_0x2b5e86===0x191){_0x2b5e86=0x190;}_0x1d3e78[_0xaa54('0x18')](_0x2b5e86)['send'](_0x3bd595[_0xaa54('0x2e')][_0xaa54('0xad')]?{'message':_0xaa54('0xaf'),'statusCode':_0x1c117d[_0xaa54('0xae')]}:_0x1c117d);});};function createFieldObject(_0x23d981,_0x1968d4,_0x261148,_0x124bfd,_0x17ce34,_0x5ae2c0){return new Promise(function(_0x3864b8,_0x5af7da){var _0x5ac25a={'id':_0x124bfd,'name':_0x17ce34,'custom':_0x5ae2c0};if(_0x261148===_0xaa54('0xb0')){_0x5ac25a['options']=[{'name':'True','value':_0xaa54('0xb1')},{'name':_0xaa54('0xb2'),'value':'false'}];_0x3864b8(_0x5ac25a);}else{var _0x47d157={'method':_0xaa54('0x9e'),'uri':_0x23d981+_0xaa54('0xb3')+_0x124bfd,'auth':_0x1968d4,'json':!![]};return rp(_0x47d157)[_0xaa54('0x23')](function(_0x45c083){var _0xd390ad=[];if(_0x45c083['result']['length']>0x0){_0x45c083['result'][_0xaa54('0xab')](function(_0x524794){if(_0x524794[_0xaa54('0xb4')]===_0xaa54('0xb5')){var _0x4ed07c={'name':_0x524794[_0xaa54('0xa4')],'value':_0x524794['value']};_0xd390ad[_0xaa54('0xa5')](_0x4ed07c);}});}_0x5ac25a[_0xaa54('0x3d')]=_0xd390ad;if(_0x5ac25a[_0xaa54('0x3d')][_0xaa54('0x34')]>0x0){_0x3864b8(_0x5ac25a);}else{if(_0x5ae2c0==![]){_0x3864b8();}else{_0x3864b8(_0x5ac25a);}}});}});} \ No newline at end of file +var _0x785c=['ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','calendar_stc','delivery_plan','impact','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','closed_by','follow_up','parent_incident','sys_id','incident_state','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','length','options','find','catch','create','body','getConfigurations','ServicenowConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x5584bd,_0x14ab49){var _0x281f0d=function(_0x3c8a1a){while(--_0x3c8a1a){_0x5584bd['push'](_0x5584bd['shift']());}};_0x281f0d(++_0x14ab49);}(_0x785c,0x1d7));var _0xc785=function(_0x36cb33,_0x3293e3){_0x36cb33=_0x36cb33-0x0;var _0x1fb6f2=_0x785c[_0x36cb33];return _0x1fb6f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc785('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc785('0x1'));var rp=require(_0xc785('0x2'));var moment=require('moment');var BPromise=require(_0xc785('0x3'));var Mustache=require(_0xc785('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc785('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc785('0x6'));var _=require('lodash');var squel=require(_0xc785('0x7'));var crypto=require(_0xc785('0x8'));var jsforce=require(_0xc785('0x9'));var deskjs=require(_0xc785('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc785('0xb'));var Papa=require(_0xc785('0xc'));var Redis=require(_0xc785('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc785('0xe'));var as=require(_0xc785('0xf'));var hardwareService=require(_0xc785('0x10'));var logger=require(_0xc785('0x11'))(_0xc785('0x12'));var utils=require(_0xc785('0x13'));var config=require(_0xc785('0x14'));var licenseUtil=require(_0xc785('0x15'));var db=require(_0xc785('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x379708,_0x2490c8){_0x2490c8=_0x2490c8||0xcc;return function(_0x9e239d){if(_0x9e239d){return _0x379708[_0xc785('0x17')](_0x2490c8);}return _0x379708[_0xc785('0x18')](_0x2490c8)[_0xc785('0x19')]();};}function respondWithResult(_0x438e38,_0x33d17d){_0x33d17d=_0x33d17d||0xc8;return function(_0xf23943){if(_0xf23943){return _0x438e38[_0xc785('0x18')](_0x33d17d)[_0xc785('0x1a')](_0xf23943);}};}function respondWithFilteredResult(_0x58d92f,_0x5b906b){return function(_0x599f97){if(_0x599f97){var _0x8b8f59=typeof _0x5b906b[_0xc785('0x1b')]==='undefined'&&typeof _0x5b906b[_0xc785('0x1c')]===_0xc785('0x1d');var _0x3b7ba7=_0x599f97[_0xc785('0x1e')];var _0x4ddbc3=_0x8b8f59?0x0:_0x5b906b['offset'];var _0x471884=_0x8b8f59?_0x599f97['count']:_0x5b906b['offset']+_0x5b906b[_0xc785('0x1c')];var _0x2c9db9;if(_0x471884>=_0x3b7ba7){_0x471884=_0x3b7ba7;_0x2c9db9=0xc8;}else{_0x2c9db9=0xce;}_0x58d92f[_0xc785('0x18')](_0x2c9db9);return _0x58d92f[_0xc785('0x1f')](_0xc785('0x20'),_0x4ddbc3+'-'+_0x471884+'/'+_0x3b7ba7)[_0xc785('0x1a')](_0x599f97);}return null;};}function patchUpdates(_0x370f12){return function(_0x289102){try{jsonpatch[_0xc785('0x21')](_0x289102,_0x370f12,!![]);}catch(_0x1b62e0){return BPromise[_0xc785('0x22')](_0x1b62e0);}return _0x289102[_0xc785('0x23')]();};}function saveUpdates(_0x19f30b,_0x109255){return function(_0x551497){if(_0x551497){return _0x551497['update'](_0x19f30b)[_0xc785('0x24')](function(_0x200940){return _0x200940;});}return null;};}function removeEntity(_0x3856b1,_0x525c40){return function(_0x51d323){if(_0x51d323){return _0x51d323[_0xc785('0x25')]()['then'](function(){_0x3856b1[_0xc785('0x18')](0xcc)[_0xc785('0x19')]();});}};}function handleEntityNotFound(_0x26bbce,_0x25bb27){return function(_0x4f3450){if(!_0x4f3450){_0x26bbce[_0xc785('0x17')](0x194);}return _0x4f3450;};}function handleError(_0x2aae82,_0x534df7){_0x534df7=_0x534df7||0x1f4;return function(_0x580a1b){logger[_0xc785('0x26')](_0x580a1b[_0xc785('0x27')]);if(_0x580a1b[_0xc785('0x28')]){delete _0x580a1b['name'];}_0x2aae82[_0xc785('0x18')](_0x534df7)[_0xc785('0x29')](_0x580a1b);};}exports[_0xc785('0x2a')]=function(_0x2beb84,_0x456767){var _0x384e02={},_0x23314b={},_0x3b5676={'count':0x0,'rows':[]};var _0x334931=_['map'](db[_0xc785('0x2b')][_0xc785('0x2c')],function(_0x3efe9c){return{'name':_0x3efe9c[_0xc785('0x2d')],'type':_0x3efe9c[_0xc785('0x2e')]['key']};});_0x23314b[_0xc785('0x2f')]=_[_0xc785('0x30')](_0x334931,'name');_0x23314b[_0xc785('0x31')]=_[_0xc785('0x32')](_0x2beb84[_0xc785('0x31')]);_0x23314b[_0xc785('0x33')]=_[_0xc785('0x34')](_0x23314b[_0xc785('0x2f')],_0x23314b['query']);_0x384e02['attributes']=_[_0xc785('0x34')](_0x23314b[_0xc785('0x2f')],qs[_0xc785('0x35')](_0x2beb84[_0xc785('0x31')]['fields']));_0x384e02[_0xc785('0x36')]=_0x384e02[_0xc785('0x36')]['length']?_0x384e02[_0xc785('0x36')]:_0x23314b[_0xc785('0x2f')];if(!_0x2beb84['query']['hasOwnProperty']('nolimit')){_0x384e02['limit']=qs['limit'](_0x2beb84[_0xc785('0x31')][_0xc785('0x1c')]);_0x384e02[_0xc785('0x1b')]=qs[_0xc785('0x1b')](_0x2beb84[_0xc785('0x31')]['offset']);}_0x384e02[_0xc785('0x37')]=qs['sort'](_0x2beb84[_0xc785('0x31')][_0xc785('0x38')]);_0x384e02['where']=qs[_0xc785('0x33')](_['pick'](_0x2beb84[_0xc785('0x31')],_0x23314b[_0xc785('0x33')]),_0x334931);if(_0x2beb84[_0xc785('0x31')][_0xc785('0x39')]){_0x384e02[_0xc785('0x3a')]=_[_0xc785('0x3b')](_0x384e02['where'],{'$or':_[_0xc785('0x30')](_0x334931,function(_0x3da309){if(_0x3da309[_0xc785('0x2e')]!==_0xc785('0x3c')){var _0x3c0731={};_0x3c0731[_0x3da309[_0xc785('0x28')]]={'$like':'%'+_0x2beb84[_0xc785('0x31')][_0xc785('0x39')]+'%'};return _0x3c0731;}})});}_0x384e02=_[_0xc785('0x3b')]({},_0x384e02,_0x2beb84['options']);var _0x20883d={'where':_0x384e02[_0xc785('0x3a')]};return db[_0xc785('0x2b')][_0xc785('0x1e')](_0x20883d)[_0xc785('0x24')](function(_0x35ad74){_0x3b5676[_0xc785('0x1e')]=_0x35ad74;if(_0x2beb84[_0xc785('0x31')][_0xc785('0x3d')]){_0x384e02[_0xc785('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x384e02);})[_0xc785('0x24')](function(_0x4a0557){_0x3b5676[_0xc785('0x3f')]=_0x4a0557;return _0x3b5676;})[_0xc785('0x24')](respondWithFilteredResult(_0x456767,_0x384e02))['catch'](handleError(_0x456767,null));};exports[_0xc785('0x40')]=function(_0x5763df,_0x3adea7){var _0x320659={'raw':![],'where':{'id':_0x5763df[_0xc785('0x41')]['id']}},_0x5061c2={};_0x5061c2['model']=_[_0xc785('0x32')](db[_0xc785('0x2b')]['rawAttributes']);_0x5061c2[_0xc785('0x31')]=_[_0xc785('0x32')](_0x5763df[_0xc785('0x31')]);_0x5061c2[_0xc785('0x33')]=_['intersection'](_0x5061c2[_0xc785('0x2f')],_0x5061c2[_0xc785('0x31')]);_0x320659[_0xc785('0x36')]=_[_0xc785('0x34')](_0x5061c2[_0xc785('0x2f')],qs[_0xc785('0x35')](_0x5763df[_0xc785('0x31')][_0xc785('0x35')]));_0x320659[_0xc785('0x36')]=_0x320659[_0xc785('0x36')][_0xc785('0x42')]?_0x320659[_0xc785('0x36')]:_0x5061c2[_0xc785('0x2f')];if(_0x5763df[_0xc785('0x31')]['includeAll']){_0x320659[_0xc785('0x3e')]=[{'all':!![]}];}_0x320659=_['merge']({},_0x320659,_0x5763df[_0xc785('0x43')]);return db['ServicenowAccount'][_0xc785('0x44')](_0x320659)['then'](handleEntityNotFound(_0x3adea7,null))[_0xc785('0x24')](respondWithResult(_0x3adea7,null))[_0xc785('0x45')](handleError(_0x3adea7,null));};exports[_0xc785('0x46')]=function(_0x58155c,_0x2ae8dc){return db[_0xc785('0x2b')][_0xc785('0x46')](_0x58155c[_0xc785('0x47')],{})[_0xc785('0x24')](respondWithResult(_0x2ae8dc,0xc9))[_0xc785('0x45')](handleError(_0x2ae8dc,null));};exports['update']=function(_0x17be67,_0x10b48a){if(_0x17be67[_0xc785('0x47')]['id']){delete _0x17be67[_0xc785('0x47')]['id'];}return db[_0xc785('0x2b')][_0xc785('0x44')]({'where':{'id':_0x17be67['params']['id']}})[_0xc785('0x24')](handleEntityNotFound(_0x10b48a,null))[_0xc785('0x24')](saveUpdates(_0x17be67['body'],null))[_0xc785('0x24')](respondWithResult(_0x10b48a,null))[_0xc785('0x45')](handleError(_0x10b48a,null));};exports['destroy']=function(_0x35702b,_0x4d343d){return db[_0xc785('0x2b')]['find']({'where':{'id':_0x35702b[_0xc785('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d343d,null))['then'](removeEntity(_0x4d343d,null))[_0xc785('0x45')](handleError(_0x4d343d,null));};exports[_0xc785('0x48')]=function(_0x4e0349,_0x32b7a5,_0x4046bb){var _0x1f3ccc={};var _0x39a94a={};var _0x2152f4;var _0x1f7f09;return db[_0xc785('0x2b')]['findOne']({'where':{'id':_0x4e0349[_0xc785('0x41')]['id']}})[_0xc785('0x24')](handleEntityNotFound(_0x32b7a5,null))[_0xc785('0x24')](function(_0x4f49fe){if(_0x4f49fe){_0x2152f4=_0x4f49fe;_0x39a94a['model']=_[_0xc785('0x32')](db[_0xc785('0x49')]['rawAttributes']);_0x39a94a[_0xc785('0x31')]=_['keys'](_0x4e0349[_0xc785('0x31')]);_0x39a94a[_0xc785('0x33')]=_['intersection'](_0x39a94a[_0xc785('0x2f')],_0x39a94a[_0xc785('0x31')]);_0x1f3ccc[_0xc785('0x36')]=_['intersection'](_0x39a94a[_0xc785('0x2f')],qs[_0xc785('0x35')](_0x4e0349[_0xc785('0x31')][_0xc785('0x35')]));_0x1f3ccc[_0xc785('0x36')]=_0x1f3ccc['attributes'][_0xc785('0x42')]?_0x1f3ccc['attributes']:_0x39a94a[_0xc785('0x2f')];_0x1f3ccc[_0xc785('0x37')]=qs[_0xc785('0x38')](_0x4e0349[_0xc785('0x31')]['sort']);_0x1f3ccc[_0xc785('0x3a')]=qs[_0xc785('0x33')](_[_0xc785('0x4a')](_0x4e0349[_0xc785('0x31')],_0x39a94a['filters']));if(_0x4e0349['query'][_0xc785('0x39')]){_0x1f3ccc[_0xc785('0x3a')]=_[_0xc785('0x3b')](_0x1f3ccc[_0xc785('0x3a')],{'$or':_['map'](_0x1f3ccc[_0xc785('0x36')],function(_0x5eea87){var _0x4c000d={};_0x4c000d[_0x5eea87]={'$like':'%'+_0x4e0349[_0xc785('0x31')][_0xc785('0x39')]+'%'};return _0x4c000d;})});}_0x1f3ccc=_[_0xc785('0x3b')]({},_0x1f3ccc,_0x4e0349['options']);return _0x2152f4[_0xc785('0x48')](_0x1f3ccc);}})['then'](function(_0xa3b402){if(_0xa3b402){_0x1f7f09=_0xa3b402[_0xc785('0x42')];if(!_0x4e0349[_0xc785('0x31')][_0xc785('0x4b')](_0xc785('0x4c'))){_0x1f3ccc[_0xc785('0x1c')]=qs['limit'](_0x4e0349[_0xc785('0x31')][_0xc785('0x1c')]);_0x1f3ccc[_0xc785('0x1b')]=qs['offset'](_0x4e0349['query'][_0xc785('0x1b')]);}return _0x2152f4[_0xc785('0x48')](_0x1f3ccc);}})['then'](function(_0x3daee8){if(_0x3daee8){return _0x3daee8?{'count':_0x1f7f09,'rows':_0x3daee8}:null;}})[_0xc785('0x24')](respondWithResult(_0x32b7a5,null))['catch'](handleError(_0x32b7a5,null));};exports[_0xc785('0x4d')]=function(_0x2a9cd9,_0x16b205,_0x540b63){if(_0x2a9cd9[_0xc785('0x47')]['id']){delete _0x2a9cd9[_0xc785('0x47')]['id'];}return db['ServicenowAccount'][_0xc785('0x4e')]({'where':{'id':_0x2a9cd9[_0xc785('0x41')]['id']}})[_0xc785('0x24')](handleEntityNotFound(_0x16b205,null))[_0xc785('0x24')](function(_0x388bff){if(_0x388bff){_0x2a9cd9[_0xc785('0x47')]['AccountId']=_0x388bff['id'];_0x2a9cd9[_0xc785('0x47')][_0xc785('0x4f')]=integrations[_0xc785('0x50')](_0x2a9cd9[_0xc785('0x47')][_0xc785('0x51')],_0x2a9cd9[_0xc785('0x47')][_0xc785('0x2e')]);_0x2a9cd9['body'][_0xc785('0x52')]=integrations[_0xc785('0x53')](_0x2a9cd9[_0xc785('0x47')][_0xc785('0x51')],_0x2a9cd9[_0xc785('0x47')]['type']);return db['ServicenowConfiguration']['create'](_0x2a9cd9['body'],{'include':[{'model':db[_0xc785('0x54')],'as':_0xc785('0x4f')},{'model':db[_0xc785('0x54')],'as':'Descriptions'}]});}return null;})[_0xc785('0x24')](respondWithResult(_0x16b205,null))[_0xc785('0x45')](handleError(_0x16b205,null));};exports[_0xc785('0x55')]=function(_0x1bd44b,_0x39a27a,_0x5ba87b){var _0x387deb=[_0xc785('0x56'),'hold_reason',_0xc785('0x57'),_0xc785('0x58'),_0xc785('0x59'),_0xc785('0x5a'),'incident_state',_0xc785('0x5b'),_0xc785('0x5c')];var _0x2ace33=[_0xc785('0x5d'),_0xc785('0x56'),_0xc785('0x5e'),_0xc785('0x5f'),_0xc785('0x60'),_0xc785('0x61'),_0xc785('0x62'),_0xc785('0x63'),_0xc785('0x64'),'number',_0xc785('0x65'),_0xc785('0x66'),_0xc785('0x67'),'user_input',_0xc785('0x68'),'sys_domain',_0xc785('0x69'),_0xc785('0x6a'),'knowledge','order',_0xc785('0x6b'),'closed_at','cmdb_ci',_0xc785('0x6c'),_0xc785('0x6d'),'active','work_notes_list','business_service',_0xc785('0x6e'),_0xc785('0x6f'),'rfc',_0xc785('0x70'),_0xc785('0x71'),_0xc785('0x72'),_0xc785('0x73'),_0xc785('0x74'),'work_end',_0xc785('0x75'),_0xc785('0x76'),_0xc785('0x77'),_0xc785('0x78'),_0xc785('0x58'),_0xc785('0x79'),_0xc785('0x7a'),_0xc785('0x59'),_0xc785('0x7b'),'delivery_task',_0xc785('0x7c'),'assignment_group',_0xc785('0x7d'),_0xc785('0x7e'),_0xc785('0x7f'),_0xc785('0x80'),'notify','sys_class_name','close_notes',_0xc785('0x81'),_0xc785('0x82'),_0xc785('0x83'),_0xc785('0x84'),'contact_type','reopened_by',_0xc785('0x85'),_0xc785('0x86'),_0xc785('0x87'),'company',_0xc785('0x88'),_0xc785('0x89'),_0xc785('0x8a'),_0xc785('0x5b'),_0xc785('0x8b'),_0xc785('0x8c'),_0xc785('0x8d'),_0xc785('0x8e'),_0xc785('0x8f'),_0xc785('0x90'),_0xc785('0x91'),_0xc785('0x92'),'escalation','upon_approval',_0xc785('0x93'),_0xc785('0x94'),_0xc785('0x5c')];var _0x4ad831='';var _0xb88728='';var _0x5a5895=[];var _0x4a36fc='';var _0x10cc06='';var _0x536304=[];var _0x27743b='';var _0x54f1bc='';var _0x469491={};var _0x5d7007='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1bd44b[_0xc785('0x41')]['id']},'attributes':['id',_0xc785('0x95'),_0xc785('0x96'),_0xc785('0x97'),'remoteUri',_0xc785('0x98')]})[_0xc785('0x24')](handleEntityNotFound(_0x39a27a,null))['then'](function(_0x5aacb6){if(_0x5aacb6){_0x5d7007=_0x5aacb6[_0xc785('0x99')];var _0xce3ded=_0x5d7007[_0xc785('0x9a')](-0x1);if(_0xce3ded==='/'){_0x5d7007=_0x5d7007[_0xc785('0x9b')](0x0,_0x5d7007['lastIndexOf'](_0xce3ded));}_0x54f1bc=util[_0xc785('0x9c')](_0xc785('0x9d'),_0x5d7007);_0x27743b=util['format'](_0xc785('0x9e'),_0x5d7007);_0x469491={'user':_0x5aacb6[_0xc785('0x95')],'pass':_0x5aacb6['password']};var _0x37b70a={'method':_0xc785('0x9f'),'uri':_0x54f1bc+_0xc785('0xa0'),'auth':_0x469491,'json':!![]};return rp(_0x37b70a);}})[_0xc785('0x24')](function(_0x4a9c3b){if(_0x4a9c3b[_0xc785('0xa1')][_0xc785('0x42')]>0x0){_0x4ad831=_0x4a9c3b[_0xc785('0xa1')];}console[_0xc785('0xa2')](_0xc785('0xa3'),_0x4ad831);_0x536304=[];_0xb88728=Object[_0xc785('0xa4')]([],_0x4ad831);_[_0xc785('0xa5')](_0xb88728,function(_0x3015ad){return!_0x387deb[_0xc785('0xa6')](_0x3015ad[_0xc785('0x28')]);});_0xb88728[_0xc785('0xa7')](function(_0x376724){var _0x3ff3e1=createFieldObject(_0x27743b,_0x469491,_0x376724[_0xc785('0xa8')],_0x376724[_0xc785('0x28')],_0x376724['label'],![]);_0x536304['push'](_0x3ff3e1);});return Promise[_0xc785('0xa9')](_0x536304);})[_0xc785('0x24')](function(_0x1975d6){_0x5a5895=_0x1975d6;_0x4a36fc=Object[_0xc785('0xa4')]([],_0x4ad831);console[_0xc785('0xa2')]('TCL:\x20_object',_0x4ad831);_['remove'](_0x4a36fc,function(_0x27a3b5){return _0x2ace33[_0xc785('0xa6')](_0x27a3b5[_0xc785('0x28')]);});console[_0xc785('0xa2')](_0xc785('0xaa'),_0x4a36fc);_0x536304=[];_0x4a36fc[_0xc785('0xa7')](function(_0xf37a96){var _0x31f91e=createFieldObject(_0x27743b,_0x469491,_0xf37a96['internalType'],_0xf37a96[_0xc785('0x28')],_0xf37a96[_0xc785('0xab')],!![]);_0x536304[_0xc785('0xac')](_0x31f91e);});return Promise['all'](_0x536304);})['then'](function(_0x47149b){_0x10cc06=_0x47149b;var _0x5a0266=_0x5a5895[_0xc785('0xad')](_0x10cc06);return{'count':_0x5a0266[_0xc785('0x42')],'rows':_0x5a0266};})[_0xc785('0x24')](respondWithResult(_0x39a27a,null))[_0xc785('0x45')](function(_0x2109ec){console[_0xc785('0xa2')](_0xc785('0xae')+_0x2109ec);var _0x218b73=_0x1bd44b['query'][_0xc785('0xaf')]?0x1f4:_0x2109ec[_0xc785('0xb0')]||0x1f4;logger['error'](_0x2109ec['stack']);delete _0x2109ec[_0xc785('0x28')];if(_0x218b73===0x191){_0x218b73=0x190;}_0x39a27a['status'](_0x218b73)[_0xc785('0x29')](_0x1bd44b[_0xc785('0x31')]['test']?{'message':_0xc785('0xb1'),'statusCode':_0x2109ec[_0xc785('0xb0')]}:_0x2109ec);});};function createFieldObject(_0x1c2baa,_0x57690b,_0x6374f7,_0x5c1d8c,_0x52305e,_0x1255a1){return new Promise(function(_0x151324,_0x47a1bc){var _0x499a32={'id':_0x5c1d8c,'name':_0x52305e,'custom':_0x1255a1};if(_0x6374f7===_0xc785('0xb2')){_0x499a32[_0xc785('0x43')]=[{'name':_0xc785('0xb3'),'value':_0xc785('0xb4')},{'name':_0xc785('0xb5'),'value':'false'}];_0x151324(_0x499a32);}else{var _0x134a88={'method':_0xc785('0x9f'),'uri':_0x1c2baa+_0xc785('0xb6')+_0x5c1d8c,'auth':_0x57690b,'json':!![]};return rp(_0x134a88)[_0xc785('0x24')](function(_0x4d63e3){var _0x1edf17=[];if(_0x4d63e3[_0xc785('0xa1')]['length']>0x0){_0x4d63e3[_0xc785('0xa1')][_0xc785('0xa7')](function(_0x23ad8e){if(_0x23ad8e[_0xc785('0xb7')]===_0xc785('0xb8')){var _0x3428b2={'name':_0x23ad8e['label'],'value':_0x23ad8e['value']};_0x1edf17['push'](_0x3428b2);}});}_0x499a32[_0xc785('0x43')]=_0x1edf17;if(_0x499a32['options'][_0xc785('0x42')]>0x0){_0x151324(_0x499a32);}else{if(_0x1255a1==![]){_0x151324();}else{_0x151324(_0x499a32);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ac8d7bd..34886f6 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0x7a54,0x106));var _0x47a5=function(_0x38b28d,_0x629dcd){_0x38b28d=_0x38b28d-0x0;var _0x369b9e=_0x7a54[_0x38b28d];return _0x369b9e;};'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'));var integrations=require(_0x47a5('0x9'));module['exports']=function(_0x3d5629,_0x59199c){return _0x3d5629[_0x47a5('0xa')](_0x47a5('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xf494,0x1c6));var _0x4f49=function(_0x4f5366,_0x3f93f2){_0x4f5366=_0x4f5366-0x0;var _0x53b0f4=_0xf494[_0x4f5366];return _0x53b0f4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7f94ed8..d30f4b6 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 _0x43c0=['options','raw','where','attributes','map','include','model','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5a4105,_0x1ee76a){var _0xd0695d=function(_0x346eb5){while(--_0x346eb5){_0x5a4105['push'](_0x5a4105['shift']());}};_0xd0695d(++_0x1ee76a);}(_0x43c0,0x1e5));var _0x043c=function(_0x15c56c,_0x4090bc){_0x15c56c=_0x15c56c-0x0;var _0x2bc18f=_0x43c0[_0x15c56c];return _0x2bc18f;};'use strict';var _=require(_0x043c('0x0'));var util=require('util');var moment=require(_0x043c('0x1'));var BPromise=require(_0x043c('0x2'));var rs=require(_0x043c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x043c('0x4'))['db'];var utils=require(_0x043c('0x5'));var logger=require(_0x043c('0x6'))(_0x043c('0x7'));var config=require(_0x043c('0x8'));var jayson=require(_0x043c('0x9'));var client=jayson['client'][_0x043c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c9d0,_0x36e038,_0x314705){return new BPromise(function(_0x28f39f,_0x53a48f){return client[_0x043c('0xb')](_0x13c9d0,_0x314705)[_0x043c('0xc')](function(_0x489f72){logger['info'](_0x043c('0xd'),_0x36e038,_0x043c('0xe'));logger[_0x043c('0xf')](_0x043c('0x10'),_0x36e038,'request\x20sent',JSON[_0x043c('0x11')](_0x489f72));if(_0x489f72[_0x043c('0x12')]){if(_0x489f72[_0x043c('0x12')][_0x043c('0x13')]===0x1f4){logger['error'](_0x043c('0xd'),_0x36e038,_0x489f72[_0x043c('0x12')]['message']);return _0x53a48f(_0x489f72[_0x043c('0x12')]['message']);}logger[_0x043c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x36e038,_0x489f72[_0x043c('0x12')][_0x043c('0x14')]);return _0x28f39f(_0x489f72[_0x043c('0x12')][_0x043c('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x36e038,'request\x20sent');_0x28f39f(_0x489f72[_0x043c('0x15')][_0x043c('0x14')]);}})[_0x043c('0x16')](function(_0x42f2b7){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x36e038,_0x42f2b7);_0x53a48f(_0x42f2b7);});});}exports[_0x043c('0x17')]=function(_0x23ab20){var _0x375fce=this;return new Promise(function(_0x1054c4,_0x2c18f8){return db[_0x043c('0x18')]['findAll']({'raw':_0x23ab20[_0x043c('0x19')]?_0x23ab20[_0x043c('0x19')][_0x043c('0x1a')]===undefined?!![]:![]:!![],'where':_0x23ab20[_0x043c('0x19')]?_0x23ab20[_0x043c('0x19')][_0x043c('0x1b')]||null:null,'attributes':_0x23ab20[_0x043c('0x19')]?_0x23ab20[_0x043c('0x19')][_0x043c('0x1c')]||null:null,'limit':_0x23ab20[_0x043c('0x19')]?_0x23ab20[_0x043c('0x19')]['limit']||null:null,'include':_0x23ab20[_0x043c('0x19')]?_0x23ab20[_0x043c('0x19')]['include']?_[_0x043c('0x1d')](_0x23ab20[_0x043c('0x19')][_0x043c('0x1e')],function(_0x1e113b){return{'model':db[_0x1e113b[_0x043c('0x1f')]],'as':_0x1e113b['as'],'attributes':_0x1e113b['attributes'],'include':_0x1e113b[_0x043c('0x1e')]?_[_0x043c('0x1d')](_0x1e113b[_0x043c('0x1e')],function(_0x1a99c7){return{'model':db[_0x1a99c7[_0x043c('0x1f')]],'as':_0x1a99c7['as'],'attributes':_0x1a99c7[_0x043c('0x1c')],'include':_0x1a99c7['include']?_[_0x043c('0x1d')](_0x1a99c7[_0x043c('0x1e')],function(_0x3ff899){return{'model':db[_0x3ff899[_0x043c('0x1f')]],'as':_0x3ff899['as'],'attributes':_0x3ff899[_0x043c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x043c('0xc')](function(_0x191e0e){logger['info'](_0x043c('0x17'),_0x23ab20);logger['debug'](_0x043c('0x17'),_0x23ab20,JSON[_0x043c('0x11')](_0x191e0e));_0x1054c4(_0x191e0e);})[_0x043c('0x16')](function(_0x5792a1){logger[_0x043c('0x12')](_0x043c('0x17'),_0x5792a1[_0x043c('0x14')],_0x23ab20);_0x2c18f8(_0x375fce['error'](0x1f4,_0x5792a1[_0x043c('0x14')]));});});};exports[_0x043c('0x20')]=function(_0x244121){var _0x4dc8eb=this;return new Promise(function(_0x543d47,_0x432b8d){return db['ServicenowAccount'][_0x043c('0x21')]({'raw':_0x244121[_0x043c('0x19')]?_0x244121[_0x043c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x244121['options']?_0x244121[_0x043c('0x19')][_0x043c('0x1b')]||null:null,'attributes':_0x244121['options']?_0x244121[_0x043c('0x19')][_0x043c('0x1c')]||null:null,'include':_0x244121['options']?_0x244121[_0x043c('0x19')][_0x043c('0x1e')]?_[_0x043c('0x1d')](_0x244121[_0x043c('0x19')][_0x043c('0x1e')],function(_0xcfa279){return{'model':db[_0xcfa279[_0x043c('0x1f')]],'as':_0xcfa279['as'],'attributes':_0xcfa279[_0x043c('0x1c')],'include':_0xcfa279[_0x043c('0x1e')]?_[_0x043c('0x1d')](_0xcfa279['include'],function(_0x3aaed9){return{'model':db[_0x3aaed9[_0x043c('0x1f')]],'as':_0x3aaed9['as'],'attributes':_0x3aaed9['attributes'],'include':_0x3aaed9[_0x043c('0x1e')]?_['map'](_0x3aaed9['include'],function(_0x2738e7){return{'model':db[_0x2738e7[_0x043c('0x1f')]],'as':_0x2738e7['as'],'attributes':_0x2738e7[_0x043c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x043c('0xc')](function(_0x5e59b0){logger['info'](_0x043c('0x20'),_0x244121);logger[_0x043c('0xf')](_0x043c('0x20'),_0x244121,JSON[_0x043c('0x11')](_0x5e59b0));_0x543d47(_0x5e59b0);})['catch'](function(_0x3a3194){logger['error'](_0x043c('0x20'),_0x3a3194['message'],_0x244121);_0x432b8d(_0x4dc8eb[_0x043c('0x12')](0x1f4,_0x3a3194[_0x043c('0x14')]));});});}; \ No newline at end of file +var _0x04a3=['bluebird','ioredis','../../mysqldb','rpc','jayson/promise','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','options','attributes','include','map','model','ShowServicenowAccount','find','raw','where','lodash','util','moment'];(function(_0x3ed1a7,_0x50b1d0){var _0x59d8e1=function(_0x475625){while(--_0x475625){_0x3ed1a7['push'](_0x3ed1a7['shift']());}};_0x59d8e1(++_0x50b1d0);}(_0x04a3,0x10d));var _0x304a=function(_0x306268,_0x50005e){_0x306268=_0x306268-0x0;var _0x5065c1=_0x04a3[_0x306268];return _0x5065c1;};'use strict';var _=require(_0x304a('0x0'));var util=require(_0x304a('0x1'));var moment=require(_0x304a('0x2'));var BPromise=require(_0x304a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x304a('0x4'));var db=require(_0x304a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x304a('0x6'));var config=require('../../config/environment');var jayson=require(_0x304a('0x7'));var client=jayson['client'][_0x304a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5efed8,_0x2f0bc4,_0x47ac84){return new BPromise(function(_0x1587c4,_0x3fa7ea){return client[_0x304a('0x9')](_0x5efed8,_0x47ac84)[_0x304a('0xa')](function(_0xb8d2b9){logger[_0x304a('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x2f0bc4,_0x304a('0xc'));logger[_0x304a('0xd')](_0x304a('0xe'),_0x2f0bc4,_0x304a('0xc'),JSON[_0x304a('0xf')](_0xb8d2b9));if(_0xb8d2b9[_0x304a('0x10')]){if(_0xb8d2b9[_0x304a('0x10')][_0x304a('0x11')]===0x1f4){logger[_0x304a('0x10')](_0x304a('0x12'),_0x2f0bc4,_0xb8d2b9[_0x304a('0x10')][_0x304a('0x13')]);return _0x3fa7ea(_0xb8d2b9[_0x304a('0x10')][_0x304a('0x13')]);}logger[_0x304a('0x10')](_0x304a('0x12'),_0x2f0bc4,_0xb8d2b9[_0x304a('0x10')]['message']);return _0x1587c4(_0xb8d2b9[_0x304a('0x10')][_0x304a('0x13')]);}else{logger[_0x304a('0xb')](_0x304a('0x12'),_0x2f0bc4,_0x304a('0xc'));_0x1587c4(_0xb8d2b9[_0x304a('0x14')][_0x304a('0x13')]);}})[_0x304a('0x15')](function(_0x2c0e2d){logger[_0x304a('0x10')](_0x304a('0x12'),_0x2f0bc4,_0x2c0e2d);_0x3fa7ea(_0x2c0e2d);});});}exports[_0x304a('0x16')]=function(_0xe4b7d7){var _0x4148ef=this;return new Promise(function(_0x4abaac,_0x5cabdc){return db[_0x304a('0x17')][_0x304a('0x18')]({'raw':_0xe4b7d7[_0x304a('0x19')]?_0xe4b7d7['options']['raw']===undefined?!![]:![]:!![],'where':_0xe4b7d7[_0x304a('0x19')]?_0xe4b7d7[_0x304a('0x19')]['where']||null:null,'attributes':_0xe4b7d7['options']?_0xe4b7d7[_0x304a('0x19')][_0x304a('0x1a')]||null:null,'limit':_0xe4b7d7[_0x304a('0x19')]?_0xe4b7d7[_0x304a('0x19')]['limit']||null:null,'include':_0xe4b7d7[_0x304a('0x19')]?_0xe4b7d7[_0x304a('0x19')][_0x304a('0x1b')]?_[_0x304a('0x1c')](_0xe4b7d7[_0x304a('0x19')][_0x304a('0x1b')],function(_0x1ce9ca){return{'model':db[_0x1ce9ca['model']],'as':_0x1ce9ca['as'],'attributes':_0x1ce9ca[_0x304a('0x1a')],'include':_0x1ce9ca[_0x304a('0x1b')]?_[_0x304a('0x1c')](_0x1ce9ca['include'],function(_0x553acc){return{'model':db[_0x553acc[_0x304a('0x1d')]],'as':_0x553acc['as'],'attributes':_0x553acc[_0x304a('0x1a')],'include':_0x553acc[_0x304a('0x1b')]?_[_0x304a('0x1c')](_0x553acc['include'],function(_0x552806){return{'model':db[_0x552806[_0x304a('0x1d')]],'as':_0x552806['as'],'attributes':_0x552806[_0x304a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x304a('0xa')](function(_0x53fd30){logger[_0x304a('0xb')](_0x304a('0x16'),_0xe4b7d7);logger[_0x304a('0xd')](_0x304a('0x16'),_0xe4b7d7,JSON['stringify'](_0x53fd30));_0x4abaac(_0x53fd30);})[_0x304a('0x15')](function(_0x767f24){logger[_0x304a('0x10')](_0x304a('0x16'),_0x767f24[_0x304a('0x13')],_0xe4b7d7);_0x5cabdc(_0x4148ef[_0x304a('0x10')](0x1f4,_0x767f24[_0x304a('0x13')]));});});};exports[_0x304a('0x1e')]=function(_0x50c767){var _0x20297e=this;return new Promise(function(_0x20d74f,_0xf4b847){return db[_0x304a('0x17')][_0x304a('0x1f')]({'raw':_0x50c767['options']?_0x50c767[_0x304a('0x19')][_0x304a('0x20')]===undefined?!![]:![]:!![],'where':_0x50c767[_0x304a('0x19')]?_0x50c767['options'][_0x304a('0x21')]||null:null,'attributes':_0x50c767[_0x304a('0x19')]?_0x50c767[_0x304a('0x19')][_0x304a('0x1a')]||null:null,'include':_0x50c767[_0x304a('0x19')]?_0x50c767[_0x304a('0x19')][_0x304a('0x1b')]?_['map'](_0x50c767[_0x304a('0x19')]['include'],function(_0x54941f){return{'model':db[_0x54941f['model']],'as':_0x54941f['as'],'attributes':_0x54941f['attributes'],'include':_0x54941f['include']?_[_0x304a('0x1c')](_0x54941f[_0x304a('0x1b')],function(_0x7d984a){return{'model':db[_0x7d984a[_0x304a('0x1d')]],'as':_0x7d984a['as'],'attributes':_0x7d984a['attributes'],'include':_0x7d984a['include']?_[_0x304a('0x1c')](_0x7d984a[_0x304a('0x1b')],function(_0x4778e2){return{'model':db[_0x4778e2[_0x304a('0x1d')]],'as':_0x4778e2['as'],'attributes':_0x4778e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x304a('0xa')](function(_0x190799){logger[_0x304a('0xb')](_0x304a('0x1e'),_0x50c767);logger[_0x304a('0xd')](_0x304a('0x1e'),_0x50c767,JSON[_0x304a('0xf')](_0x190799));_0x20d74f(_0x190799);})['catch'](function(_0x300ab4){logger[_0x304a('0x10')](_0x304a('0x1e'),_0x300ab4[_0x304a('0x13')],_0x50c767);_0xf4b847(_0x20297e[_0x304a('0x10')](0x1f4,_0x300ab4[_0x304a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 950781f..1f8a61c 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 _0x83e8=['update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83e8,0x1e5));var _0x883e=function(_0xb69b28,_0x556d65){_0xb69b28=_0xb69b28-0x0;var _0x1ae547=_0x83e8[_0xb69b28];return _0x1ae547;};'use strict';var multer=require(_0x883e('0x0'));var util=require('util');var path=require(_0x883e('0x1'));var timeout=require('connect-timeout');var express=require(_0x883e('0x2'));var router=express[_0x883e('0x3')]();var fs_extra=require(_0x883e('0x4'));var auth=require(_0x883e('0x5'));var interaction=require(_0x883e('0x6'));var config=require(_0x883e('0x7'));var controller=require(_0x883e('0x8'));router[_0x883e('0x9')]('/',auth['isAuthenticated'](),controller[_0x883e('0xa')]);router[_0x883e('0x9')]('/:id',auth[_0x883e('0xb')](),controller[_0x883e('0xc')]);router[_0x883e('0x9')](_0x883e('0xd'),auth[_0x883e('0xb')](),controller['getFields']);router[_0x883e('0x9')]('/:id/subjects',auth[_0x883e('0xb')](),controller[_0x883e('0xe')]);router[_0x883e('0x9')](_0x883e('0xf'),auth[_0x883e('0xb')](),controller[_0x883e('0x10')]);router[_0x883e('0x11')]('/',auth[_0x883e('0xb')](),controller[_0x883e('0x12')]);router[_0x883e('0x13')](_0x883e('0x14'),auth[_0x883e('0xb')](),controller[_0x883e('0x15')]);router['delete'](_0x883e('0x14'),auth[_0x883e('0xb')](),controller['destroy']);module[_0x883e('0x16')]=router; \ No newline at end of file +var _0x9cfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x482bac,_0x2ad787){var _0x35d510=function(_0x3b15ee){while(--_0x3b15ee){_0x482bac['push'](_0x482bac['shift']());}};_0x35d510(++_0x2ad787);}(_0x9cfd,0xa8));var _0xd9cf=function(_0x394e0c,_0x2b0997){_0x394e0c=_0x394e0c-0x0;var _0x501a93=_0x9cfd[_0x394e0c];return _0x501a93;};'use strict';var multer=require(_0xd9cf('0x0'));var util=require(_0xd9cf('0x1'));var path=require(_0xd9cf('0x2'));var timeout=require(_0xd9cf('0x3'));var express=require(_0xd9cf('0x4'));var router=express[_0xd9cf('0x5')]();var fs_extra=require(_0xd9cf('0x6'));var auth=require(_0xd9cf('0x7'));var interaction=require(_0xd9cf('0x8'));var config=require(_0xd9cf('0x9'));var controller=require(_0xd9cf('0xa'));router['get']('/',auth[_0xd9cf('0xb')](),controller[_0xd9cf('0xc')]);router[_0xd9cf('0xd')](_0xd9cf('0xe'),auth['isAuthenticated'](),controller[_0xd9cf('0xf')]);router['get'](_0xd9cf('0x10'),auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x11')]);router[_0xd9cf('0xd')](_0xd9cf('0x12'),auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x13')]);router[_0xd9cf('0xd')](_0xd9cf('0x14'),auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x15')]);router[_0xd9cf('0x16')]('/',auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x17')]);router[_0xd9cf('0x18')]('/:id',auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x19')]);router[_0xd9cf('0x1a')](_0xd9cf('0xe'),auth[_0xd9cf('0xb')](),controller[_0xd9cf('0x1b')]);module[_0xd9cf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4d68b2d..7f6e534 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 _0xae1c=['sequelize','exports','STRING'];(function(_0x1762d,_0x3976d6){var _0x390ff0=function(_0x3962bc){while(--_0x3962bc){_0x1762d['push'](_0x1762d['shift']());}};_0x390ff0(++_0x3976d6);}(_0xae1c,0x75));var _0xcae1=function(_0x1325e8,_0x12bccb){_0x1325e8=_0x1325e8-0x0;var _0x44bcff=_0xae1c[_0x1325e8];return _0x44bcff;};'use strict';var Sequelize=require(_0xcae1('0x0'));module[_0xcae1('0x1')]={'name':{'type':Sequelize[_0xcae1('0x2')]},'description':{'type':Sequelize[_0xcae1('0x2')]}}; \ No newline at end of file +var _0x3b7d=['sequelize','exports','STRING'];(function(_0x3430a2,_0x17b394){var _0x593109=function(_0x3b2b52){while(--_0x3b2b52){_0x3430a2['push'](_0x3430a2['shift']());}};_0x593109(++_0x17b394);}(_0x3b7d,0xa2));var _0xd3b7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3b7d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xd3b7('0x0'));module[_0xd3b7('0x1')]={'name':{'type':Sequelize[_0xd3b7('0x2')]},'description':{'type':Sequelize[_0xd3b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cb029ad..d11ce92 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 _0x7885=['ServicenowConfiguration','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','model','find','create','body','getFields','ServicenowField','pick','filter','hasOwnProperty','findOne','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map'];(function(_0xf5650f,_0x5c0559){var _0x182dc7=function(_0x45c46a){while(--_0x45c46a){_0xf5650f['push'](_0xf5650f['shift']());}};_0x182dc7(++_0x5c0559);}(_0x7885,0x14b));var _0x5788=function(_0x3f2d3c,_0x50309c){_0x3f2d3c=_0x3f2d3c-0x0;var _0x358404=_0x7885[_0x3f2d3c];return _0x358404;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5788('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5788('0x1'));var rp=require(_0x5788('0x2'));var moment=require(_0x5788('0x3'));var BPromise=require(_0x5788('0x4'));var Mustache=require(_0x5788('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5788('0x6'));var csv=require(_0x5788('0x7'));var ejs=require(_0x5788('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5788('0x9'));var crypto=require('crypto');var jsforce=require(_0x5788('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5788('0x7'));var querystring=require('querystring');var Papa=require(_0x5788('0xb'));var Redis=require(_0x5788('0xc'));var authService=require(_0x5788('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5788('0xe'));var logger=require(_0x5788('0xf'))(_0x5788('0x10'));var utils=require(_0x5788('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5788('0x12'))['db'];function respondWithStatusCode(_0x1c2601,_0x1e6c51){_0x1e6c51=_0x1e6c51||0xcc;return function(_0x5aec7d){if(_0x5aec7d){return _0x1c2601['sendStatus'](_0x1e6c51);}return _0x1c2601[_0x5788('0x13')](_0x1e6c51)[_0x5788('0x14')]();};}function respondWithResult(_0x42a202,_0xab45e5){_0xab45e5=_0xab45e5||0xc8;return function(_0x135b36){if(_0x135b36){return _0x42a202[_0x5788('0x13')](_0xab45e5)[_0x5788('0x15')](_0x135b36);}};}function respondWithFilteredResult(_0x242c4f,_0x59a488){return function(_0x3119e4){if(_0x3119e4){var _0x51d1a3=typeof _0x59a488[_0x5788('0x16')]===_0x5788('0x17')&&typeof _0x59a488[_0x5788('0x18')]===_0x5788('0x17');var _0x27cf60=_0x3119e4[_0x5788('0x19')];var _0xcf90b3=_0x51d1a3?0x0:_0x59a488[_0x5788('0x16')];var _0x3baed4=_0x51d1a3?_0x3119e4[_0x5788('0x19')]:_0x59a488[_0x5788('0x16')]+_0x59a488[_0x5788('0x18')];var _0x3901f5;if(_0x3baed4>=_0x27cf60){_0x3baed4=_0x27cf60;_0x3901f5=0xc8;}else{_0x3901f5=0xce;}_0x242c4f['status'](_0x3901f5);return _0x242c4f[_0x5788('0x1a')](_0x5788('0x1b'),_0xcf90b3+'-'+_0x3baed4+'/'+_0x27cf60)['json'](_0x3119e4);}return null;};}function patchUpdates(_0x17212c){return function(_0x5335ca){try{jsonpatch[_0x5788('0x1c')](_0x5335ca,_0x17212c,!![]);}catch(_0x446c29){return BPromise[_0x5788('0x1d')](_0x446c29);}return _0x5335ca['save']();};}function saveUpdates(_0x30882b,_0x13fda9){return function(_0x10b6a7){if(_0x10b6a7){return _0x10b6a7[_0x5788('0x1e')](_0x30882b)[_0x5788('0x1f')](function(_0x5323dc){return _0x5323dc;});}return null;};}function removeEntity(_0x25cf8a,_0x3fed1f){return function(_0x2ab27b){if(_0x2ab27b){return _0x2ab27b[_0x5788('0x20')]()[_0x5788('0x1f')](function(){_0x25cf8a['status'](0xcc)[_0x5788('0x14')]();});}};}function handleEntityNotFound(_0x56db23,_0x5614c8){return function(_0x7578a3){if(!_0x7578a3){_0x56db23[_0x5788('0x21')](0x194);}return _0x7578a3;};}function handleError(_0x3a4a90,_0x1ce336){_0x1ce336=_0x1ce336||0x1f4;return function(_0x23dfde){logger['error'](_0x23dfde[_0x5788('0x22')]);if(_0x23dfde[_0x5788('0x23')]){delete _0x23dfde[_0x5788('0x23')];}_0x3a4a90['status'](_0x1ce336)[_0x5788('0x24')](_0x23dfde);};}exports[_0x5788('0x25')]=function(_0x22fcf4,_0x30d557){var _0x2f7b0c={},_0x43d213={},_0xadcf0e={'count':0x0,'rows':[]};var _0x323713=_[_0x5788('0x26')](db[_0x5788('0x27')][_0x5788('0x28')],function(_0xf021c9){return{'name':_0xf021c9['fieldName'],'type':_0xf021c9[_0x5788('0x29')][_0x5788('0x2a')]};});_0x43d213['model']=_[_0x5788('0x26')](_0x323713,'name');_0x43d213[_0x5788('0x2b')]=_[_0x5788('0x2c')](_0x22fcf4[_0x5788('0x2b')]);_0x43d213[_0x5788('0x2d')]=_[_0x5788('0x2e')](_0x43d213['model'],_0x43d213[_0x5788('0x2b')]);_0x2f7b0c['attributes']=_[_0x5788('0x2e')](_0x43d213['model'],qs[_0x5788('0x2f')](_0x22fcf4[_0x5788('0x2b')][_0x5788('0x2f')]));_0x2f7b0c[_0x5788('0x30')]=_0x2f7b0c['attributes'][_0x5788('0x31')]?_0x2f7b0c['attributes']:_0x43d213['model'];if(!_0x22fcf4['query']['hasOwnProperty'](_0x5788('0x32'))){_0x2f7b0c[_0x5788('0x18')]=qs[_0x5788('0x18')](_0x22fcf4[_0x5788('0x2b')]['limit']);_0x2f7b0c['offset']=qs[_0x5788('0x16')](_0x22fcf4['query'][_0x5788('0x16')]);}_0x2f7b0c[_0x5788('0x33')]=qs['sort'](_0x22fcf4[_0x5788('0x2b')][_0x5788('0x34')]);_0x2f7b0c[_0x5788('0x35')]=qs[_0x5788('0x2d')](_['pick'](_0x22fcf4['query'],_0x43d213[_0x5788('0x2d')]),_0x323713);if(_0x22fcf4[_0x5788('0x2b')]['filter']){_0x2f7b0c[_0x5788('0x35')]=_['merge'](_0x2f7b0c[_0x5788('0x35')],{'$or':_[_0x5788('0x26')](_0x323713,function(_0x19b825){if(_0x19b825[_0x5788('0x29')]!==_0x5788('0x36')){var _0x34deca={};_0x34deca[_0x19b825['name']]={'$like':'%'+_0x22fcf4[_0x5788('0x2b')]['filter']+'%'};return _0x34deca;}})});}_0x2f7b0c=_[_0x5788('0x37')]({},_0x2f7b0c,_0x22fcf4[_0x5788('0x38')]);var _0x3a2209={'where':_0x2f7b0c['where']};return db['ServicenowConfiguration'][_0x5788('0x19')](_0x3a2209)[_0x5788('0x1f')](function(_0x52afc1){_0xadcf0e[_0x5788('0x19')]=_0x52afc1;if(_0x22fcf4[_0x5788('0x2b')][_0x5788('0x39')]){_0x2f7b0c[_0x5788('0x3a')]=[{'all':!![]}];}return db[_0x5788('0x27')]['findAll'](_0x2f7b0c);})[_0x5788('0x1f')](function(_0x3896d6){_0xadcf0e[_0x5788('0x3b')]=_0x3896d6;return _0xadcf0e;})[_0x5788('0x1f')](respondWithFilteredResult(_0x30d557,_0x2f7b0c))[_0x5788('0x3c')](handleError(_0x30d557,null));};exports[_0x5788('0x3d')]=function(_0x137d75,_0x1eeed8){var _0xb5693={'raw':![],'where':{'id':_0x137d75[_0x5788('0x3e')]['id']}},_0x31cbb1={};_0x31cbb1['model']=_[_0x5788('0x2c')](db[_0x5788('0x27')][_0x5788('0x28')]);_0x31cbb1[_0x5788('0x2b')]=_[_0x5788('0x2c')](_0x137d75[_0x5788('0x2b')]);_0x31cbb1[_0x5788('0x2d')]=_[_0x5788('0x2e')](_0x31cbb1[_0x5788('0x3f')],_0x31cbb1[_0x5788('0x2b')]);_0xb5693['attributes']=_[_0x5788('0x2e')](_0x31cbb1[_0x5788('0x3f')],qs[_0x5788('0x2f')](_0x137d75[_0x5788('0x2b')][_0x5788('0x2f')]));_0xb5693[_0x5788('0x30')]=_0xb5693[_0x5788('0x30')][_0x5788('0x31')]?_0xb5693[_0x5788('0x30')]:_0x31cbb1['model'];if(_0x137d75['query'][_0x5788('0x39')]){_0xb5693[_0x5788('0x3a')]=[{'all':!![]}];}_0xb5693=_[_0x5788('0x37')]({},_0xb5693,_0x137d75['options']);return db[_0x5788('0x27')][_0x5788('0x40')](_0xb5693)[_0x5788('0x1f')](handleEntityNotFound(_0x1eeed8,null))[_0x5788('0x1f')](respondWithResult(_0x1eeed8,null))[_0x5788('0x3c')](handleError(_0x1eeed8,null));};exports['create']=function(_0x19ca16,_0x3cbcdf){return db['ServicenowConfiguration'][_0x5788('0x41')](_0x19ca16['body'],{})[_0x5788('0x1f')](respondWithResult(_0x3cbcdf,0xc9))[_0x5788('0x3c')](handleError(_0x3cbcdf,null));};exports[_0x5788('0x1e')]=function(_0x1e0ff3,_0x182a54){if(_0x1e0ff3[_0x5788('0x42')]['id']){delete _0x1e0ff3[_0x5788('0x42')]['id'];}return db[_0x5788('0x27')][_0x5788('0x40')]({'where':{'id':_0x1e0ff3[_0x5788('0x3e')]['id']}})[_0x5788('0x1f')](handleEntityNotFound(_0x182a54,null))[_0x5788('0x1f')](saveUpdates(_0x1e0ff3[_0x5788('0x42')],null))[_0x5788('0x1f')](respondWithResult(_0x182a54,null))[_0x5788('0x3c')](handleError(_0x182a54,null));};exports[_0x5788('0x20')]=function(_0x20db72,_0x4719a6){return db[_0x5788('0x27')][_0x5788('0x40')]({'where':{'id':_0x20db72[_0x5788('0x3e')]['id']}})[_0x5788('0x1f')](handleEntityNotFound(_0x4719a6,null))[_0x5788('0x1f')](removeEntity(_0x4719a6,null))[_0x5788('0x3c')](handleError(_0x4719a6,null));};exports[_0x5788('0x43')]=function(_0xedad69,_0x43adfb,_0x18ab80){var _0x1ef155={};var _0x443b84={};var _0x31b00a;var _0x4f3318;return db[_0x5788('0x27')]['findOne']({'where':{'id':_0xedad69[_0x5788('0x3e')]['id']}})['then'](handleEntityNotFound(_0x43adfb,null))[_0x5788('0x1f')](function(_0x54b911){if(_0x54b911){_0x31b00a=_0x54b911;_0x443b84['model']=_[_0x5788('0x2c')](db[_0x5788('0x44')][_0x5788('0x28')]);_0x443b84[_0x5788('0x2b')]=_['keys'](_0xedad69[_0x5788('0x2b')]);_0x443b84[_0x5788('0x2d')]=_['intersection'](_0x443b84[_0x5788('0x3f')],_0x443b84[_0x5788('0x2b')]);_0x1ef155['attributes']=_[_0x5788('0x2e')](_0x443b84[_0x5788('0x3f')],qs[_0x5788('0x2f')](_0xedad69['query'][_0x5788('0x2f')]));_0x1ef155[_0x5788('0x30')]=_0x1ef155['attributes']['length']?_0x1ef155[_0x5788('0x30')]:_0x443b84[_0x5788('0x3f')];_0x1ef155[_0x5788('0x33')]=qs[_0x5788('0x34')](_0xedad69['query']['sort']);_0x1ef155[_0x5788('0x35')]=qs[_0x5788('0x2d')](_[_0x5788('0x45')](_0xedad69[_0x5788('0x2b')],_0x443b84['filters']));if(_0xedad69[_0x5788('0x2b')][_0x5788('0x46')]){_0x1ef155[_0x5788('0x35')]=_[_0x5788('0x37')](_0x1ef155['where'],{'$or':_[_0x5788('0x26')](_0x1ef155[_0x5788('0x30')],function(_0x1f8a06){var _0x119da7={};_0x119da7[_0x1f8a06]={'$like':'%'+_0xedad69[_0x5788('0x2b')][_0x5788('0x46')]+'%'};return _0x119da7;})});}_0x1ef155=_[_0x5788('0x37')]({},_0x1ef155,_0xedad69[_0x5788('0x38')]);return _0x31b00a[_0x5788('0x43')](_0x1ef155);}})[_0x5788('0x1f')](function(_0x354bc7){if(_0x354bc7){_0x4f3318=_0x354bc7[_0x5788('0x31')];if(!_0xedad69[_0x5788('0x2b')][_0x5788('0x47')](_0x5788('0x32'))){_0x1ef155['limit']=qs['limit'](_0xedad69[_0x5788('0x2b')][_0x5788('0x18')]);_0x1ef155[_0x5788('0x16')]=qs[_0x5788('0x16')](_0xedad69[_0x5788('0x2b')]['offset']);}return _0x31b00a['getFields'](_0x1ef155);}})['then'](function(_0x125967){if(_0x125967){return _0x125967?{'count':_0x4f3318,'rows':_0x125967}:null;}})[_0x5788('0x1f')](respondWithResult(_0x43adfb,null))[_0x5788('0x3c')](handleError(_0x43adfb,null));};exports['getSubjects']=function(_0x95960b,_0x1d48ff,_0x33025a){var _0x3a8a03={};var _0x42fa9={};var _0x305483;var _0x51a329;return db['ServicenowConfiguration'][_0x5788('0x48')]({'where':{'id':_0x95960b[_0x5788('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d48ff,null))['then'](function(_0x2f2248){if(_0x2f2248){_0x305483=_0x2f2248;_0x42fa9[_0x5788('0x3f')]=_[_0x5788('0x2c')](db[_0x5788('0x44')]['rawAttributes']);_0x42fa9['query']=_[_0x5788('0x2c')](_0x95960b[_0x5788('0x2b')]);_0x42fa9[_0x5788('0x2d')]=_['intersection'](_0x42fa9[_0x5788('0x3f')],_0x42fa9['query']);_0x3a8a03['attributes']=_[_0x5788('0x2e')](_0x42fa9['model'],qs['fields'](_0x95960b[_0x5788('0x2b')][_0x5788('0x2f')]));_0x3a8a03['attributes']=_0x3a8a03[_0x5788('0x30')][_0x5788('0x31')]?_0x3a8a03[_0x5788('0x30')]:_0x42fa9['model'];_0x3a8a03[_0x5788('0x33')]=qs[_0x5788('0x34')](_0x95960b[_0x5788('0x2b')][_0x5788('0x34')]);_0x3a8a03[_0x5788('0x35')]=qs[_0x5788('0x2d')](_[_0x5788('0x45')](_0x95960b[_0x5788('0x2b')],_0x42fa9[_0x5788('0x2d')]));if(_0x95960b[_0x5788('0x2b')][_0x5788('0x46')]){_0x3a8a03[_0x5788('0x35')]=_[_0x5788('0x37')](_0x3a8a03[_0x5788('0x35')],{'$or':_[_0x5788('0x26')](_0x3a8a03[_0x5788('0x30')],function(_0x2b96c6){var _0x24f187={};_0x24f187[_0x2b96c6]={'$like':'%'+_0x95960b['query'][_0x5788('0x46')]+'%'};return _0x24f187;})});}_0x3a8a03=_[_0x5788('0x37')]({},_0x3a8a03,_0x95960b[_0x5788('0x38')]);return _0x305483['getSubjects'](_0x3a8a03);}})[_0x5788('0x1f')](function(_0x3833b9){if(_0x3833b9){_0x51a329=_0x3833b9[_0x5788('0x31')];if(!_0x95960b[_0x5788('0x2b')][_0x5788('0x47')](_0x5788('0x32'))){_0x3a8a03['limit']=qs[_0x5788('0x18')](_0x95960b[_0x5788('0x2b')][_0x5788('0x18')]);_0x3a8a03[_0x5788('0x16')]=qs['offset'](_0x95960b['query'][_0x5788('0x16')]);}return _0x305483['getSubjects'](_0x3a8a03);}})[_0x5788('0x1f')](function(_0x167e5c){if(_0x167e5c){return _0x167e5c?{'count':_0x51a329,'rows':_0x167e5c}:null;}})[_0x5788('0x1f')](respondWithResult(_0x1d48ff,null))[_0x5788('0x3c')](handleError(_0x1d48ff,null));};exports['getDescriptions']=function(_0x1eed7b,_0x511409,_0x3f6867){var _0x5a2205={};var _0x1eed6c={};var _0x2a4b8b;var _0x3e399d;return db[_0x5788('0x27')][_0x5788('0x48')]({'where':{'id':_0x1eed7b[_0x5788('0x3e')]['id']}})[_0x5788('0x1f')](handleEntityNotFound(_0x511409,null))[_0x5788('0x1f')](function(_0x2bbd45){if(_0x2bbd45){_0x2a4b8b=_0x2bbd45;_0x1eed6c[_0x5788('0x3f')]=_[_0x5788('0x2c')](db['ServicenowField'][_0x5788('0x28')]);_0x1eed6c['query']=_[_0x5788('0x2c')](_0x1eed7b[_0x5788('0x2b')]);_0x1eed6c['filters']=_['intersection'](_0x1eed6c['model'],_0x1eed6c[_0x5788('0x2b')]);_0x5a2205[_0x5788('0x30')]=_['intersection'](_0x1eed6c[_0x5788('0x3f')],qs['fields'](_0x1eed7b[_0x5788('0x2b')][_0x5788('0x2f')]));_0x5a2205[_0x5788('0x30')]=_0x5a2205[_0x5788('0x30')][_0x5788('0x31')]?_0x5a2205[_0x5788('0x30')]:_0x1eed6c[_0x5788('0x3f')];_0x5a2205[_0x5788('0x33')]=qs[_0x5788('0x34')](_0x1eed7b[_0x5788('0x2b')][_0x5788('0x34')]);_0x5a2205[_0x5788('0x35')]=qs[_0x5788('0x2d')](_['pick'](_0x1eed7b[_0x5788('0x2b')],_0x1eed6c['filters']));if(_0x1eed7b[_0x5788('0x2b')][_0x5788('0x46')]){_0x5a2205[_0x5788('0x35')]=_[_0x5788('0x37')](_0x5a2205['where'],{'$or':_[_0x5788('0x26')](_0x5a2205[_0x5788('0x30')],function(_0x35f3d4){var _0x34658f={};_0x34658f[_0x35f3d4]={'$like':'%'+_0x1eed7b['query'][_0x5788('0x46')]+'%'};return _0x34658f;})});}_0x5a2205=_[_0x5788('0x37')]({},_0x5a2205,_0x1eed7b[_0x5788('0x38')]);return _0x2a4b8b[_0x5788('0x49')](_0x5a2205);}})['then'](function(_0x45a218){if(_0x45a218){_0x3e399d=_0x45a218[_0x5788('0x31')];if(!_0x1eed7b[_0x5788('0x2b')]['hasOwnProperty'](_0x5788('0x32'))){_0x5a2205['limit']=qs[_0x5788('0x18')](_0x1eed7b[_0x5788('0x2b')][_0x5788('0x18')]);_0x5a2205[_0x5788('0x16')]=qs[_0x5788('0x16')](_0x1eed7b[_0x5788('0x2b')][_0x5788('0x16')]);}return _0x2a4b8b[_0x5788('0x49')](_0x5a2205);}})[_0x5788('0x1f')](function(_0x5957fb){if(_0x5957fb){return _0x5957fb?{'count':_0x3e399d,'rows':_0x5957fb}:null;}})['then'](respondWithResult(_0x511409,null))[_0x5788('0x3c')](handleError(_0x511409,null));}; \ No newline at end of file +var _0xab0f=['save','then','destroy','status','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','order','length','getSubjects','ServicenowField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','apply','reject'];(function(_0x301997,_0x1c2cce){var _0x49eeb5=function(_0x120bd6){while(--_0x120bd6){_0x301997['push'](_0x301997['shift']());}};_0x49eeb5(++_0x1c2cce);}(_0xab0f,0x11f));var _0xfab0=function(_0x4d0abb,_0x1446f8){_0x4d0abb=_0x4d0abb-0x0;var _0x2c049d=_0xab0f[_0x4d0abb];return _0x2c049d;};'use strict';var emlformat=require(_0xfab0('0x0'));var rimraf=require(_0xfab0('0x1'));var zipdir=require(_0xfab0('0x2'));var jsonpatch=require(_0xfab0('0x3'));var rp=require(_0xfab0('0x4'));var moment=require(_0xfab0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfab0('0x6'));var util=require(_0xfab0('0x7'));var path=require(_0xfab0('0x8'));var sox=require(_0xfab0('0x9'));var csv=require(_0xfab0('0xa'));var ejs=require(_0xfab0('0xb'));var fs=require('fs');var fs_extra=require(_0xfab0('0xc'));var _=require(_0xfab0('0xd'));var squel=require(_0xfab0('0xe'));var crypto=require(_0xfab0('0xf'));var jsforce=require(_0xfab0('0x10'));var deskjs=require(_0xfab0('0x11'));var toCsv=require(_0xfab0('0xa'));var querystring=require(_0xfab0('0x12'));var Papa=require(_0xfab0('0x13'));var Redis=require(_0xfab0('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfab0('0x15'));var hardwareService=require(_0xfab0('0x16'));var logger=require('../../config/logger')(_0xfab0('0x17'));var utils=require(_0xfab0('0x18'));var config=require(_0xfab0('0x19'));var licenseUtil=require(_0xfab0('0x1a'));var db=require(_0xfab0('0x1b'))['db'];function respondWithStatusCode(_0x35a039,_0x55083e){_0x55083e=_0x55083e||0xcc;return function(_0x7ea369){if(_0x7ea369){return _0x35a039[_0xfab0('0x1c')](_0x55083e);}return _0x35a039['status'](_0x55083e)[_0xfab0('0x1d')]();};}function respondWithResult(_0x1a7a78,_0x46926b){_0x46926b=_0x46926b||0xc8;return function(_0x5a4c68){if(_0x5a4c68){return _0x1a7a78['status'](_0x46926b)[_0xfab0('0x1e')](_0x5a4c68);}};}function respondWithFilteredResult(_0x10f199,_0x4ffa67){return function(_0x483fa7){if(_0x483fa7){var _0x585d4d=typeof _0x4ffa67[_0xfab0('0x1f')]===_0xfab0('0x20')&&typeof _0x4ffa67[_0xfab0('0x21')]===_0xfab0('0x20');var _0x1d1861=_0x483fa7['count'];var _0x217514=_0x585d4d?0x0:_0x4ffa67[_0xfab0('0x1f')];var _0x1d938c=_0x585d4d?_0x483fa7[_0xfab0('0x22')]:_0x4ffa67[_0xfab0('0x1f')]+_0x4ffa67[_0xfab0('0x21')];var _0x2fec15;if(_0x1d938c>=_0x1d1861){_0x1d938c=_0x1d1861;_0x2fec15=0xc8;}else{_0x2fec15=0xce;}_0x10f199['status'](_0x2fec15);return _0x10f199['set']('Content-Range',_0x217514+'-'+_0x1d938c+'/'+_0x1d1861)[_0xfab0('0x1e')](_0x483fa7);}return null;};}function patchUpdates(_0x3570d6){return function(_0x2d2f10){try{jsonpatch[_0xfab0('0x23')](_0x2d2f10,_0x3570d6,!![]);}catch(_0x1ccaac){return BPromise[_0xfab0('0x24')](_0x1ccaac);}return _0x2d2f10[_0xfab0('0x25')]();};}function saveUpdates(_0x16842c,_0x48d41c){return function(_0x2d270e){if(_0x2d270e){return _0x2d270e['update'](_0x16842c)[_0xfab0('0x26')](function(_0x3175bf){return _0x3175bf;});}return null;};}function removeEntity(_0x4af353,_0x12266c){return function(_0x401524){if(_0x401524){return _0x401524[_0xfab0('0x27')]()[_0xfab0('0x26')](function(){_0x4af353[_0xfab0('0x28')](0xcc)[_0xfab0('0x1d')]();});}};}function handleEntityNotFound(_0x44bc44,_0x1d6174){return function(_0x215261){if(!_0x215261){_0x44bc44[_0xfab0('0x1c')](0x194);}return _0x215261;};}function handleError(_0x3ad001,_0x260c7a){_0x260c7a=_0x260c7a||0x1f4;return function(_0x29f1e8){logger['error'](_0x29f1e8[_0xfab0('0x29')]);if(_0x29f1e8[_0xfab0('0x2a')]){delete _0x29f1e8[_0xfab0('0x2a')];}_0x3ad001[_0xfab0('0x28')](_0x260c7a)[_0xfab0('0x2b')](_0x29f1e8);};}exports[_0xfab0('0x2c')]=function(_0x3d4844,_0x49b13a){var _0x46255b={},_0x64506b={},_0x1a77d6={'count':0x0,'rows':[]};var _0x3070bf=_[_0xfab0('0x2d')](db[_0xfab0('0x2e')][_0xfab0('0x2f')],function(_0x2e9f0d){return{'name':_0x2e9f0d['fieldName'],'type':_0x2e9f0d['type']['key']};});_0x64506b[_0xfab0('0x30')]=_['map'](_0x3070bf,_0xfab0('0x2a'));_0x64506b['query']=_[_0xfab0('0x31')](_0x3d4844[_0xfab0('0x32')]);_0x64506b[_0xfab0('0x33')]=_[_0xfab0('0x34')](_0x64506b[_0xfab0('0x30')],_0x64506b[_0xfab0('0x32')]);_0x46255b[_0xfab0('0x35')]=_[_0xfab0('0x34')](_0x64506b[_0xfab0('0x30')],qs[_0xfab0('0x36')](_0x3d4844[_0xfab0('0x32')]['fields']));_0x46255b[_0xfab0('0x35')]=_0x46255b[_0xfab0('0x35')]['length']?_0x46255b[_0xfab0('0x35')]:_0x64506b[_0xfab0('0x30')];if(!_0x3d4844['query'][_0xfab0('0x37')](_0xfab0('0x38'))){_0x46255b[_0xfab0('0x21')]=qs['limit'](_0x3d4844[_0xfab0('0x32')][_0xfab0('0x21')]);_0x46255b[_0xfab0('0x1f')]=qs[_0xfab0('0x1f')](_0x3d4844[_0xfab0('0x32')][_0xfab0('0x1f')]);}_0x46255b['order']=qs[_0xfab0('0x39')](_0x3d4844[_0xfab0('0x32')]['sort']);_0x46255b[_0xfab0('0x3a')]=qs[_0xfab0('0x33')](_['pick'](_0x3d4844['query'],_0x64506b['filters']),_0x3070bf);if(_0x3d4844[_0xfab0('0x32')][_0xfab0('0x3b')]){_0x46255b['where']=_[_0xfab0('0x3c')](_0x46255b[_0xfab0('0x3a')],{'$or':_[_0xfab0('0x2d')](_0x3070bf,function(_0x1f04fc){if(_0x1f04fc[_0xfab0('0x3d')]!==_0xfab0('0x3e')){var _0x402c6a={};_0x402c6a[_0x1f04fc[_0xfab0('0x2a')]]={'$like':'%'+_0x3d4844[_0xfab0('0x32')]['filter']+'%'};return _0x402c6a;}})});}_0x46255b=_[_0xfab0('0x3c')]({},_0x46255b,_0x3d4844[_0xfab0('0x3f')]);var _0x3a9f6e={'where':_0x46255b[_0xfab0('0x3a')]};return db['ServicenowConfiguration'][_0xfab0('0x22')](_0x3a9f6e)[_0xfab0('0x26')](function(_0x421fda){_0x1a77d6['count']=_0x421fda;if(_0x3d4844['query'][_0xfab0('0x40')]){_0x46255b[_0xfab0('0x41')]=[{'all':!![]}];}return db[_0xfab0('0x2e')][_0xfab0('0x42')](_0x46255b);})[_0xfab0('0x26')](function(_0x4dfe44){_0x1a77d6['rows']=_0x4dfe44;return _0x1a77d6;})['then'](respondWithFilteredResult(_0x49b13a,_0x46255b))['catch'](handleError(_0x49b13a,null));};exports[_0xfab0('0x43')]=function(_0x2341ef,_0x480c8d){var _0x25f02e={'raw':![],'where':{'id':_0x2341ef[_0xfab0('0x44')]['id']}},_0x10023f={};_0x10023f[_0xfab0('0x30')]=_[_0xfab0('0x31')](db['ServicenowConfiguration'][_0xfab0('0x2f')]);_0x10023f[_0xfab0('0x32')]=_[_0xfab0('0x31')](_0x2341ef['query']);_0x10023f[_0xfab0('0x33')]=_[_0xfab0('0x34')](_0x10023f[_0xfab0('0x30')],_0x10023f[_0xfab0('0x32')]);_0x25f02e['attributes']=_[_0xfab0('0x34')](_0x10023f[_0xfab0('0x30')],qs[_0xfab0('0x36')](_0x2341ef[_0xfab0('0x32')][_0xfab0('0x36')]));_0x25f02e[_0xfab0('0x35')]=_0x25f02e[_0xfab0('0x35')]['length']?_0x25f02e[_0xfab0('0x35')]:_0x10023f['model'];if(_0x2341ef[_0xfab0('0x32')][_0xfab0('0x40')]){_0x25f02e['include']=[{'all':!![]}];}_0x25f02e=_['merge']({},_0x25f02e,_0x2341ef[_0xfab0('0x3f')]);return db[_0xfab0('0x2e')][_0xfab0('0x45')](_0x25f02e)['then'](handleEntityNotFound(_0x480c8d,null))[_0xfab0('0x26')](respondWithResult(_0x480c8d,null))[_0xfab0('0x46')](handleError(_0x480c8d,null));};exports[_0xfab0('0x47')]=function(_0x4d9fe1,_0x197ed8){return db['ServicenowConfiguration']['create'](_0x4d9fe1[_0xfab0('0x48')],{})[_0xfab0('0x26')](respondWithResult(_0x197ed8,0xc9))[_0xfab0('0x46')](handleError(_0x197ed8,null));};exports['update']=function(_0x2301f7,_0x15124d){if(_0x2301f7[_0xfab0('0x48')]['id']){delete _0x2301f7[_0xfab0('0x48')]['id'];}return db[_0xfab0('0x2e')]['find']({'where':{'id':_0x2301f7[_0xfab0('0x44')]['id']}})[_0xfab0('0x26')](handleEntityNotFound(_0x15124d,null))[_0xfab0('0x26')](saveUpdates(_0x2301f7[_0xfab0('0x48')],null))[_0xfab0('0x26')](respondWithResult(_0x15124d,null))['catch'](handleError(_0x15124d,null));};exports[_0xfab0('0x27')]=function(_0xce4251,_0x5dc5ba){return db[_0xfab0('0x2e')]['find']({'where':{'id':_0xce4251[_0xfab0('0x44')]['id']}})[_0xfab0('0x26')](handleEntityNotFound(_0x5dc5ba,null))[_0xfab0('0x26')](removeEntity(_0x5dc5ba,null))[_0xfab0('0x46')](handleError(_0x5dc5ba,null));};exports[_0xfab0('0x49')]=function(_0x3471b8,_0x37d042,_0x223e3b){var _0x18f541={};var _0x2e2302={};var _0x15214c;var _0x5fac9d;return db[_0xfab0('0x2e')][_0xfab0('0x4a')]({'where':{'id':_0x3471b8[_0xfab0('0x44')]['id']}})[_0xfab0('0x26')](handleEntityNotFound(_0x37d042,null))[_0xfab0('0x26')](function(_0x15c6da){if(_0x15c6da){_0x15214c=_0x15c6da;_0x2e2302[_0xfab0('0x30')]=_[_0xfab0('0x31')](db['ServicenowField']['rawAttributes']);_0x2e2302[_0xfab0('0x32')]=_[_0xfab0('0x31')](_0x3471b8[_0xfab0('0x32')]);_0x2e2302['filters']=_[_0xfab0('0x34')](_0x2e2302['model'],_0x2e2302[_0xfab0('0x32')]);_0x18f541[_0xfab0('0x35')]=_[_0xfab0('0x34')](_0x2e2302['model'],qs[_0xfab0('0x36')](_0x3471b8[_0xfab0('0x32')][_0xfab0('0x36')]));_0x18f541[_0xfab0('0x35')]=_0x18f541[_0xfab0('0x35')]['length']?_0x18f541[_0xfab0('0x35')]:_0x2e2302[_0xfab0('0x30')];_0x18f541[_0xfab0('0x4b')]=qs['sort'](_0x3471b8['query'][_0xfab0('0x39')]);_0x18f541[_0xfab0('0x3a')]=qs[_0xfab0('0x33')](_['pick'](_0x3471b8[_0xfab0('0x32')],_0x2e2302[_0xfab0('0x33')]));if(_0x3471b8['query'][_0xfab0('0x3b')]){_0x18f541[_0xfab0('0x3a')]=_[_0xfab0('0x3c')](_0x18f541['where'],{'$or':_[_0xfab0('0x2d')](_0x18f541[_0xfab0('0x35')],function(_0x19d56b){var _0x457ef6={};_0x457ef6[_0x19d56b]={'$like':'%'+_0x3471b8[_0xfab0('0x32')][_0xfab0('0x3b')]+'%'};return _0x457ef6;})});}_0x18f541=_['merge']({},_0x18f541,_0x3471b8[_0xfab0('0x3f')]);return _0x15214c[_0xfab0('0x49')](_0x18f541);}})['then'](function(_0x377d8e){if(_0x377d8e){_0x5fac9d=_0x377d8e[_0xfab0('0x4c')];if(!_0x3471b8['query']['hasOwnProperty'](_0xfab0('0x38'))){_0x18f541[_0xfab0('0x21')]=qs[_0xfab0('0x21')](_0x3471b8[_0xfab0('0x32')][_0xfab0('0x21')]);_0x18f541[_0xfab0('0x1f')]=qs[_0xfab0('0x1f')](_0x3471b8[_0xfab0('0x32')]['offset']);}return _0x15214c['getFields'](_0x18f541);}})[_0xfab0('0x26')](function(_0x2cf554){if(_0x2cf554){return _0x2cf554?{'count':_0x5fac9d,'rows':_0x2cf554}:null;}})[_0xfab0('0x26')](respondWithResult(_0x37d042,null))[_0xfab0('0x46')](handleError(_0x37d042,null));};exports[_0xfab0('0x4d')]=function(_0x5718e5,_0x411f09,_0xe6deb3){var _0x327923={};var _0x23c413={};var _0x102e3d;var _0x499b48;return db['ServicenowConfiguration'][_0xfab0('0x4a')]({'where':{'id':_0x5718e5[_0xfab0('0x44')]['id']}})[_0xfab0('0x26')](handleEntityNotFound(_0x411f09,null))[_0xfab0('0x26')](function(_0x460ac2){if(_0x460ac2){_0x102e3d=_0x460ac2;_0x23c413[_0xfab0('0x30')]=_[_0xfab0('0x31')](db[_0xfab0('0x4e')][_0xfab0('0x2f')]);_0x23c413[_0xfab0('0x32')]=_[_0xfab0('0x31')](_0x5718e5[_0xfab0('0x32')]);_0x23c413[_0xfab0('0x33')]=_[_0xfab0('0x34')](_0x23c413[_0xfab0('0x30')],_0x23c413['query']);_0x327923[_0xfab0('0x35')]=_[_0xfab0('0x34')](_0x23c413[_0xfab0('0x30')],qs[_0xfab0('0x36')](_0x5718e5['query'][_0xfab0('0x36')]));_0x327923[_0xfab0('0x35')]=_0x327923[_0xfab0('0x35')][_0xfab0('0x4c')]?_0x327923[_0xfab0('0x35')]:_0x23c413[_0xfab0('0x30')];_0x327923[_0xfab0('0x4b')]=qs['sort'](_0x5718e5[_0xfab0('0x32')][_0xfab0('0x39')]);_0x327923[_0xfab0('0x3a')]=qs[_0xfab0('0x33')](_[_0xfab0('0x4f')](_0x5718e5[_0xfab0('0x32')],_0x23c413['filters']));if(_0x5718e5[_0xfab0('0x32')][_0xfab0('0x3b')]){_0x327923[_0xfab0('0x3a')]=_[_0xfab0('0x3c')](_0x327923[_0xfab0('0x3a')],{'$or':_[_0xfab0('0x2d')](_0x327923['attributes'],function(_0x193c38){var _0x233f72={};_0x233f72[_0x193c38]={'$like':'%'+_0x5718e5[_0xfab0('0x32')][_0xfab0('0x3b')]+'%'};return _0x233f72;})});}_0x327923=_[_0xfab0('0x3c')]({},_0x327923,_0x5718e5[_0xfab0('0x3f')]);return _0x102e3d[_0xfab0('0x4d')](_0x327923);}})[_0xfab0('0x26')](function(_0x58122d){if(_0x58122d){_0x499b48=_0x58122d[_0xfab0('0x4c')];if(!_0x5718e5[_0xfab0('0x32')][_0xfab0('0x37')](_0xfab0('0x38'))){_0x327923['limit']=qs[_0xfab0('0x21')](_0x5718e5[_0xfab0('0x32')][_0xfab0('0x21')]);_0x327923[_0xfab0('0x1f')]=qs[_0xfab0('0x1f')](_0x5718e5[_0xfab0('0x32')][_0xfab0('0x1f')]);}return _0x102e3d[_0xfab0('0x4d')](_0x327923);}})[_0xfab0('0x26')](function(_0x4f0528){if(_0x4f0528){return _0x4f0528?{'count':_0x499b48,'rows':_0x4f0528}:null;}})[_0xfab0('0x26')](respondWithResult(_0x411f09,null))[_0xfab0('0x46')](handleError(_0x411f09,null));};exports[_0xfab0('0x50')]=function(_0x3efe39,_0xa05ec1,_0x1ff941){var _0x2e0090={};var _0x473b53={};var _0x3bbf41;var _0x12416c;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3efe39[_0xfab0('0x44')]['id']}})[_0xfab0('0x26')](handleEntityNotFound(_0xa05ec1,null))[_0xfab0('0x26')](function(_0x348290){if(_0x348290){_0x3bbf41=_0x348290;_0x473b53[_0xfab0('0x30')]=_[_0xfab0('0x31')](db[_0xfab0('0x4e')][_0xfab0('0x2f')]);_0x473b53[_0xfab0('0x32')]=_[_0xfab0('0x31')](_0x3efe39['query']);_0x473b53['filters']=_[_0xfab0('0x34')](_0x473b53[_0xfab0('0x30')],_0x473b53['query']);_0x2e0090[_0xfab0('0x35')]=_['intersection'](_0x473b53[_0xfab0('0x30')],qs[_0xfab0('0x36')](_0x3efe39[_0xfab0('0x32')][_0xfab0('0x36')]));_0x2e0090['attributes']=_0x2e0090[_0xfab0('0x35')][_0xfab0('0x4c')]?_0x2e0090[_0xfab0('0x35')]:_0x473b53[_0xfab0('0x30')];_0x2e0090[_0xfab0('0x4b')]=qs[_0xfab0('0x39')](_0x3efe39[_0xfab0('0x32')][_0xfab0('0x39')]);_0x2e0090[_0xfab0('0x3a')]=qs[_0xfab0('0x33')](_[_0xfab0('0x4f')](_0x3efe39[_0xfab0('0x32')],_0x473b53['filters']));if(_0x3efe39[_0xfab0('0x32')]['filter']){_0x2e0090[_0xfab0('0x3a')]=_['merge'](_0x2e0090['where'],{'$or':_['map'](_0x2e0090[_0xfab0('0x35')],function(_0xf2f864){var _0x400d45={};_0x400d45[_0xf2f864]={'$like':'%'+_0x3efe39['query'][_0xfab0('0x3b')]+'%'};return _0x400d45;})});}_0x2e0090=_[_0xfab0('0x3c')]({},_0x2e0090,_0x3efe39[_0xfab0('0x3f')]);return _0x3bbf41[_0xfab0('0x50')](_0x2e0090);}})[_0xfab0('0x26')](function(_0x395a57){if(_0x395a57){_0x12416c=_0x395a57[_0xfab0('0x4c')];if(!_0x3efe39['query'][_0xfab0('0x37')]('nolimit')){_0x2e0090[_0xfab0('0x21')]=qs['limit'](_0x3efe39[_0xfab0('0x32')][_0xfab0('0x21')]);_0x2e0090[_0xfab0('0x1f')]=qs[_0xfab0('0x1f')](_0x3efe39[_0xfab0('0x32')]['offset']);}return _0x3bbf41[_0xfab0('0x50')](_0x2e0090);}})[_0xfab0('0x26')](function(_0x4475dc){if(_0x4475dc){return _0x4475dc?{'count':_0x12416c,'rows':_0x4475dc}:null;}})[_0xfab0('0x26')](respondWithResult(_0xa05ec1,null))['catch'](handleError(_0xa05ec1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 08842ba..2f7d15c 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x25b507,_0x5d6bb8){_0x25b507=_0x25b507-0x0;var _0x2de08b=_0xf4f4[_0x25b507];return _0x2de08b;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae9=['util','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x5e0dab,_0x43e609){var _0x528345=function(_0x41f25b){while(--_0x41f25b){_0x5e0dab['push'](_0x5e0dab['shift']());}};_0x528345(++_0x43e609);}(_0x8ae9,0x179));var _0x98ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ae9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x98ae('0x2'));var rp=require(_0x98ae('0x3'));var fs=require('fs');var path=require(_0x98ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98ae('0x5'));module[_0x98ae('0x6')]=function(_0x237dd0,_0x3a6b37){return _0x237dd0['define'](_0x98ae('0x7'),attributes,{'tableName':_0x98ae('0x8'),'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 5dc20d0..159a49a 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 _0x3d91=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x4df0ba,_0x82a353){var _0x4a0fd4=function(_0x26aa07){while(--_0x26aa07){_0x4df0ba['push'](_0x4df0ba['shift']());}};_0x4a0fd4(++_0x82a353);}(_0x3d91,0x1d9));var _0x13d9=function(_0x1ce337,_0x2e7814){_0x1ce337=_0x1ce337-0x0;var _0x157500=_0x3d91[_0x1ce337];return _0x157500;};'use strict';var _=require(_0x13d9('0x0'));var util=require('util');var moment=require(_0x13d9('0x1'));var BPromise=require(_0x13d9('0x2'));var rs=require(_0x13d9('0x3'));var fs=require('fs');var Redis=require(_0x13d9('0x4'));var db=require(_0x13d9('0x5'))['db'];var utils=require(_0x13d9('0x6'));var logger=require('../../config/logger')(_0x13d9('0x7'));var config=require('../../config/environment');var jayson=require(_0x13d9('0x8'));var client=jayson[_0x13d9('0x9')][_0x13d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d7c01,_0x1d5fe5,_0x1ed118){return new BPromise(function(_0x5db7be,_0x376891){return client['request'](_0x4d7c01,_0x1ed118)[_0x13d9('0xb')](function(_0x1f68e2){logger[_0x13d9('0xc')](_0x13d9('0xd'),_0x1d5fe5,_0x13d9('0xe'));logger[_0x13d9('0xf')](_0x13d9('0x10'),_0x1d5fe5,_0x13d9('0xe'),JSON[_0x13d9('0x11')](_0x1f68e2));if(_0x1f68e2[_0x13d9('0x12')]){if(_0x1f68e2[_0x13d9('0x12')]['code']===0x1f4){logger[_0x13d9('0x12')](_0x13d9('0xd'),_0x1d5fe5,_0x1f68e2['error']['message']);return _0x376891(_0x1f68e2[_0x13d9('0x12')]['message']);}logger[_0x13d9('0x12')](_0x13d9('0xd'),_0x1d5fe5,_0x1f68e2[_0x13d9('0x12')][_0x13d9('0x13')]);return _0x5db7be(_0x1f68e2[_0x13d9('0x12')][_0x13d9('0x13')]);}else{logger[_0x13d9('0xc')](_0x13d9('0xd'),_0x1d5fe5,_0x13d9('0xe'));_0x5db7be(_0x1f68e2[_0x13d9('0x14')]['message']);}})[_0x13d9('0x15')](function(_0x1aa5c2){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1d5fe5,_0x1aa5c2);_0x376891(_0x1aa5c2);});});} \ No newline at end of file +var _0x58d8=['ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5094cb,_0x3e5e20){var _0x272111=function(_0xef398){while(--_0xef398){_0x5094cb['push'](_0x5094cb['shift']());}};_0x272111(++_0x3e5e20);}(_0x58d8,0xb9));var _0x858d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x858d('0x0'));var util=require(_0x858d('0x1'));var moment=require('moment');var BPromise=require(_0x858d('0x2'));var rs=require(_0x858d('0x3'));var fs=require('fs');var Redis=require(_0x858d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x858d('0x5'));var config=require(_0x858d('0x6'));var jayson=require(_0x858d('0x7'));var client=jayson[_0x858d('0x8')][_0x858d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c804a,_0x376e82,_0x5d7006){return new BPromise(function(_0x4e52bc,_0x16e4a6){return client[_0x858d('0xa')](_0x1c804a,_0x5d7006)[_0x858d('0xb')](function(_0x8b6323){logger[_0x858d('0xc')](_0x858d('0xd'),_0x376e82,_0x858d('0xe'));logger[_0x858d('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x376e82,'request\x20sent',JSON['stringify'](_0x8b6323));if(_0x8b6323[_0x858d('0x10')]){if(_0x8b6323[_0x858d('0x10')][_0x858d('0x11')]===0x1f4){logger['error'](_0x858d('0xd'),_0x376e82,_0x8b6323[_0x858d('0x10')][_0x858d('0x12')]);return _0x16e4a6(_0x8b6323[_0x858d('0x10')][_0x858d('0x12')]);}logger[_0x858d('0x10')](_0x858d('0xd'),_0x376e82,_0x8b6323[_0x858d('0x10')][_0x858d('0x12')]);return _0x4e52bc(_0x8b6323['error'][_0x858d('0x12')]);}else{logger[_0x858d('0xc')](_0x858d('0xd'),_0x376e82,_0x858d('0xe'));_0x4e52bc(_0x8b6323[_0x858d('0x13')][_0x858d('0x12')]);}})[_0x858d('0x14')](function(_0x47eaaa){logger[_0x858d('0x10')](_0x858d('0xd'),_0x376e82,_0x47eaaa);_0x16e4a6(_0x47eaaa);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 036173c..551843f 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 _0x5276=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4529ce,_0x2ada76){var _0x10f7e1=function(_0x11022b){while(--_0x11022b){_0x4529ce['push'](_0x4529ce['shift']());}};_0x10f7e1(++_0x2ada76);}(_0x5276,0x141));var _0x6527=function(_0x5193e8,_0x5198fa){_0x5193e8=_0x5193e8-0x0;var _0xbb23e0=_0x5276[_0x5193e8];return _0xbb23e0;};'use strict';var multer=require(_0x6527('0x0'));var util=require(_0x6527('0x1'));var path=require(_0x6527('0x2'));var timeout=require('connect-timeout');var express=require(_0x6527('0x3'));var router=express[_0x6527('0x4')]();var fs_extra=require(_0x6527('0x5'));var auth=require(_0x6527('0x6'));var interaction=require(_0x6527('0x7'));var config=require(_0x6527('0x8'));var controller=require(_0x6527('0x9'));router[_0x6527('0xa')]('/',auth[_0x6527('0xb')](),controller[_0x6527('0xc')]);router['get'](_0x6527('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6527('0xe')]('/',auth[_0x6527('0xb')](),controller[_0x6527('0xf')]);router[_0x6527('0x10')](_0x6527('0xd'),auth[_0x6527('0xb')](),controller[_0x6527('0x11')]);router[_0x6527('0x12')](_0x6527('0xd'),auth[_0x6527('0xb')](),controller[_0x6527('0x13')]);module[_0x6527('0x14')]=router; \ No newline at end of file +var _0x581c=['isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1f36a0,_0x43d338){var _0xe00103=function(_0x2f6ff8){while(--_0x2f6ff8){_0x1f36a0['push'](_0x1f36a0['shift']());}};_0xe00103(++_0x43d338);}(_0x581c,0xa2));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc581('0x0'));var util=require('util');var path=require(_0xc581('0x1'));var timeout=require(_0xc581('0x2'));var express=require('express');var router=express[_0xc581('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc581('0x4'));var interaction=require(_0xc581('0x5'));var config=require(_0xc581('0x6'));var controller=require('./intServicenowField.controller');router[_0xc581('0x7')]('/',auth[_0xc581('0x8')](),controller[_0xc581('0x9')]);router[_0xc581('0x7')](_0xc581('0xa'),auth[_0xc581('0x8')](),controller[_0xc581('0xb')]);router[_0xc581('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc581('0xd')](_0xc581('0xa'),auth[_0xc581('0x8')](),controller[_0xc581('0xe')]);router['delete'](_0xc581('0xa'),auth['isAuthenticated'](),controller[_0xc581('0xf')]);module[_0xc581('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 09e7545..1ab0164 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 _0x4d13=['variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4d13,0x196));var _0x34d1=function(_0x5e9119,_0x6b51cb){_0x5e9119=_0x5e9119-0x0;var _0x2b0797=_0x4d13[_0x5e9119];return _0x2b0797;};'use strict';var Sequelize=require(_0x34d1('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x34d1('0x1'),_0x34d1('0x2'),_0x34d1('0x3'),'keyValue',_0x34d1('0x4')),'defaultValue':_0x34d1('0x1')},'content':{'type':Sequelize[_0x34d1('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x34d1('0x6')](_0x34d1('0x1'),'variable',_0x34d1('0x3'))},'keyContent':{'type':Sequelize[_0x34d1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x34d1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x34d1('0x5')]}}; \ No newline at end of file +var _0x9bc8=['BOOLEAN','sequelize','customVariable','keyValue','string','STRING','ENUM'];(function(_0x3dce46,_0xf7527f){var _0x237a6a=function(_0x418fb1){while(--_0x418fb1){_0x3dce46['push'](_0x3dce46['shift']());}};_0x237a6a(++_0xf7527f);}(_0x9bc8,0x8d));var _0x89bc=function(_0x4054fe,_0x18f33e){_0x4054fe=_0x4054fe-0x0;var _0x4f9bee=_0x9bc8[_0x4054fe];return _0x4f9bee;};'use strict';var Sequelize=require(_0x89bc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x89bc('0x1'),_0x89bc('0x2'),'picklist'),'defaultValue':_0x89bc('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x89bc('0x4')]},'keyType':{'type':Sequelize[_0x89bc('0x5')]('string','variable',_0x89bc('0x1'))},'keyContent':{'type':Sequelize[_0x89bc('0x4')]},'idField':{'type':Sequelize[_0x89bc('0x4')]},'nameField':{'type':Sequelize[_0x89bc('0x4')]},'customField':{'type':Sequelize[_0x89bc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x89bc('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6d8583e..00d9b53 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 _0x45a3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','destroy'];(function(_0x42c862,_0x1ded47){var _0x320549=function(_0xfd5084){while(--_0xfd5084){_0x42c862['push'](_0x42c862['shift']());}};_0x320549(++_0x1ded47);}(_0x45a3,0x144));var _0x345a=function(_0x24ff3f,_0x4dd94b){_0x24ff3f=_0x24ff3f-0x0;var _0x13c930=_0x45a3[_0x24ff3f];return _0x13c930;};'use strict';var emlformat=require(_0x345a('0x0'));var rimraf=require(_0x345a('0x1'));var zipdir=require(_0x345a('0x2'));var jsonpatch=require(_0x345a('0x3'));var rp=require(_0x345a('0x4'));var moment=require(_0x345a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x345a('0x6'));var util=require(_0x345a('0x7'));var path=require(_0x345a('0x8'));var sox=require(_0x345a('0x9'));var csv=require('to-csv');var ejs=require(_0x345a('0xa'));var fs=require('fs');var fs_extra=require(_0x345a('0xb'));var _=require(_0x345a('0xc'));var squel=require(_0x345a('0xd'));var crypto=require(_0x345a('0xe'));var jsforce=require(_0x345a('0xf'));var deskjs=require(_0x345a('0x10'));var toCsv=require(_0x345a('0x11'));var querystring=require(_0x345a('0x12'));var Papa=require(_0x345a('0x13'));var Redis=require(_0x345a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x345a('0x15'));var as=require(_0x345a('0x16'));var hardwareService=require(_0x345a('0x17'));var logger=require(_0x345a('0x18'))(_0x345a('0x19'));var utils=require(_0x345a('0x1a'));var config=require(_0x345a('0x1b'));var licenseUtil=require(_0x345a('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x481b77,_0x3a6c08){_0x3a6c08=_0x3a6c08||0xcc;return function(_0x3dcac1){if(_0x3dcac1){return _0x481b77['sendStatus'](_0x3a6c08);}return _0x481b77[_0x345a('0x1d')](_0x3a6c08)[_0x345a('0x1e')]();};}function respondWithResult(_0x37ddcd,_0x30c530){_0x30c530=_0x30c530||0xc8;return function(_0x3ca876){if(_0x3ca876){return _0x37ddcd[_0x345a('0x1d')](_0x30c530)[_0x345a('0x1f')](_0x3ca876);}};}function respondWithFilteredResult(_0x11ebc7,_0x16a1f4){return function(_0x1566b0){if(_0x1566b0){var _0x1030a7=typeof _0x16a1f4['offset']===_0x345a('0x20')&&typeof _0x16a1f4[_0x345a('0x21')]===_0x345a('0x20');var _0x81be07=_0x1566b0[_0x345a('0x22')];var _0x215f8f=_0x1030a7?0x0:_0x16a1f4['offset'];var _0x543232=_0x1030a7?_0x1566b0[_0x345a('0x22')]:_0x16a1f4[_0x345a('0x23')]+_0x16a1f4[_0x345a('0x21')];var _0x566f67;if(_0x543232>=_0x81be07){_0x543232=_0x81be07;_0x566f67=0xc8;}else{_0x566f67=0xce;}_0x11ebc7[_0x345a('0x1d')](_0x566f67);return _0x11ebc7[_0x345a('0x24')](_0x345a('0x25'),_0x215f8f+'-'+_0x543232+'/'+_0x81be07)['json'](_0x1566b0);}return null;};}function patchUpdates(_0x4dd6bf){return function(_0x419574){try{jsonpatch[_0x345a('0x26')](_0x419574,_0x4dd6bf,!![]);}catch(_0x162c0f){return BPromise[_0x345a('0x27')](_0x162c0f);}return _0x419574[_0x345a('0x28')]();};}function saveUpdates(_0xdc686b,_0x5ddb80){return function(_0xffcb94){if(_0xffcb94){return _0xffcb94[_0x345a('0x29')](_0xdc686b)[_0x345a('0x2a')](function(_0x2eb5a3){return _0x2eb5a3;});}return null;};}function removeEntity(_0x4c6572,_0x2d4c1f){return function(_0x30df0d){if(_0x30df0d){return _0x30df0d['destroy']()[_0x345a('0x2a')](function(){_0x4c6572[_0x345a('0x1d')](0xcc)[_0x345a('0x1e')]();});}};}function handleEntityNotFound(_0x1ecbd0,_0x4220e6){return function(_0x3220f7){if(!_0x3220f7){_0x1ecbd0[_0x345a('0x2b')](0x194);}return _0x3220f7;};}function handleError(_0x1556cc,_0x4d5a51){_0x4d5a51=_0x4d5a51||0x1f4;return function(_0x1b4ad6){logger[_0x345a('0x2c')](_0x1b4ad6[_0x345a('0x2d')]);if(_0x1b4ad6[_0x345a('0x2e')]){delete _0x1b4ad6['name'];}_0x1556cc[_0x345a('0x1d')](_0x4d5a51)[_0x345a('0x2f')](_0x1b4ad6);};}exports['index']=function(_0x3d9b28,_0x2c36b5){var _0x48839d={},_0x58279b={},_0x57b41c={'count':0x0,'rows':[]};var _0x464416=_[_0x345a('0x30')](db[_0x345a('0x31')][_0x345a('0x32')],function(_0x327db3){return{'name':_0x327db3['fieldName'],'type':_0x327db3[_0x345a('0x33')][_0x345a('0x34')]};});_0x58279b['model']=_[_0x345a('0x30')](_0x464416,_0x345a('0x2e'));_0x58279b[_0x345a('0x35')]=_[_0x345a('0x36')](_0x3d9b28[_0x345a('0x35')]);_0x58279b['filters']=_[_0x345a('0x37')](_0x58279b[_0x345a('0x38')],_0x58279b['query']);_0x48839d[_0x345a('0x39')]=_[_0x345a('0x37')](_0x58279b[_0x345a('0x38')],qs[_0x345a('0x3a')](_0x3d9b28[_0x345a('0x35')][_0x345a('0x3a')]));_0x48839d['attributes']=_0x48839d[_0x345a('0x39')]['length']?_0x48839d[_0x345a('0x39')]:_0x58279b[_0x345a('0x38')];if(!_0x3d9b28['query'][_0x345a('0x3b')](_0x345a('0x3c'))){_0x48839d['limit']=qs[_0x345a('0x21')](_0x3d9b28['query']['limit']);_0x48839d['offset']=qs[_0x345a('0x23')](_0x3d9b28[_0x345a('0x35')][_0x345a('0x23')]);}_0x48839d[_0x345a('0x3d')]=qs[_0x345a('0x3e')](_0x3d9b28[_0x345a('0x35')][_0x345a('0x3e')]);_0x48839d[_0x345a('0x3f')]=qs[_0x345a('0x40')](_[_0x345a('0x41')](_0x3d9b28[_0x345a('0x35')],_0x58279b[_0x345a('0x40')]),_0x464416);if(_0x3d9b28[_0x345a('0x35')][_0x345a('0x42')]){_0x48839d[_0x345a('0x3f')]=_[_0x345a('0x43')](_0x48839d[_0x345a('0x3f')],{'$or':_['map'](_0x464416,function(_0x512ad8){if(_0x512ad8[_0x345a('0x33')]!==_0x345a('0x44')){var _0xcaf4a0={};_0xcaf4a0[_0x512ad8[_0x345a('0x2e')]]={'$like':'%'+_0x3d9b28[_0x345a('0x35')][_0x345a('0x42')]+'%'};return _0xcaf4a0;}})});}_0x48839d=_['merge']({},_0x48839d,_0x3d9b28['options']);var _0x3c5de4={'where':_0x48839d[_0x345a('0x3f')]};return db[_0x345a('0x31')][_0x345a('0x22')](_0x3c5de4)[_0x345a('0x2a')](function(_0x4794d0){_0x57b41c[_0x345a('0x22')]=_0x4794d0;if(_0x3d9b28[_0x345a('0x35')][_0x345a('0x45')]){_0x48839d[_0x345a('0x46')]=[{'all':!![]}];}return db['ServicenowField'][_0x345a('0x47')](_0x48839d);})['then'](function(_0x3eee26){_0x57b41c[_0x345a('0x48')]=_0x3eee26;return _0x57b41c;})['then'](respondWithFilteredResult(_0x2c36b5,_0x48839d))[_0x345a('0x49')](handleError(_0x2c36b5,null));};exports['show']=function(_0x2c85c1,_0x22fc03){var _0x1a723d={'raw':!![],'where':{'id':_0x2c85c1[_0x345a('0x4a')]['id']}},_0x1636c0={};_0x1636c0['model']=_[_0x345a('0x36')](db[_0x345a('0x31')][_0x345a('0x32')]);_0x1636c0['query']=_[_0x345a('0x36')](_0x2c85c1['query']);_0x1636c0[_0x345a('0x40')]=_[_0x345a('0x37')](_0x1636c0[_0x345a('0x38')],_0x1636c0[_0x345a('0x35')]);_0x1a723d[_0x345a('0x39')]=_[_0x345a('0x37')](_0x1636c0[_0x345a('0x38')],qs[_0x345a('0x3a')](_0x2c85c1[_0x345a('0x35')][_0x345a('0x3a')]));_0x1a723d['attributes']=_0x1a723d[_0x345a('0x39')][_0x345a('0x4b')]?_0x1a723d[_0x345a('0x39')]:_0x1636c0['model'];if(_0x2c85c1[_0x345a('0x35')][_0x345a('0x45')]){_0x1a723d['include']=[{'all':!![]}];}_0x1a723d=_[_0x345a('0x43')]({},_0x1a723d,_0x2c85c1[_0x345a('0x4c')]);return db[_0x345a('0x31')][_0x345a('0x4d')](_0x1a723d)[_0x345a('0x2a')](handleEntityNotFound(_0x22fc03,null))[_0x345a('0x2a')](respondWithResult(_0x22fc03,null))[_0x345a('0x49')](handleError(_0x22fc03,null));};exports['create']=function(_0x4c0ad8,_0x48f1a1){return db[_0x345a('0x31')][_0x345a('0x4e')](_0x4c0ad8[_0x345a('0x4f')],{})['then'](respondWithResult(_0x48f1a1,0xc9))[_0x345a('0x49')](handleError(_0x48f1a1,null));};exports[_0x345a('0x29')]=function(_0x11167b,_0x470b2b){if(_0x11167b['body']['id']){delete _0x11167b[_0x345a('0x4f')]['id'];}return db[_0x345a('0x31')][_0x345a('0x4d')]({'where':{'id':_0x11167b[_0x345a('0x4a')]['id']}})[_0x345a('0x2a')](handleEntityNotFound(_0x470b2b,null))[_0x345a('0x2a')](saveUpdates(_0x11167b[_0x345a('0x4f')],null))['then'](respondWithResult(_0x470b2b,null))['catch'](handleError(_0x470b2b,null));};exports[_0x345a('0x50')]=function(_0x66ba2d,_0x3f74ea){return db[_0x345a('0x31')][_0x345a('0x4d')]({'where':{'id':_0x66ba2d['params']['id']}})[_0x345a('0x2a')](handleEntityNotFound(_0x3f74ea,null))[_0x345a('0x2a')](removeEntity(_0x3f74ea,null))[_0x345a('0x49')](handleError(_0x3f74ea,null));}; \ No newline at end of file +var _0x1458=['fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x461f94,_0x14b67f){var _0x2eaf3a=function(_0x34fc58){while(--_0x34fc58){_0x461f94['push'](_0x461f94['shift']());}};_0x2eaf3a(++_0x14b67f);}(_0x1458,0x1a1));var _0x8145=function(_0x31dbc3,_0xfcfbb1){_0x31dbc3=_0x31dbc3-0x0;var _0x1227aa=_0x1458[_0x31dbc3];return _0x1227aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8145('0x0'));var jsonpatch=require(_0x8145('0x1'));var rp=require(_0x8145('0x2'));var moment=require('moment');var BPromise=require(_0x8145('0x3'));var Mustache=require(_0x8145('0x4'));var util=require(_0x8145('0x5'));var path=require(_0x8145('0x6'));var sox=require('sox');var csv=require(_0x8145('0x7'));var ejs=require(_0x8145('0x8'));var fs=require('fs');var fs_extra=require(_0x8145('0x9'));var _=require('lodash');var squel=require(_0x8145('0xa'));var crypto=require(_0x8145('0xb'));var jsforce=require(_0x8145('0xc'));var deskjs=require(_0x8145('0xd'));var toCsv=require(_0x8145('0x7'));var querystring=require('querystring');var Papa=require(_0x8145('0xe'));var Redis=require(_0x8145('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8145('0x10'));var as=require(_0x8145('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8145('0x12'))('api');var utils=require(_0x8145('0x13'));var config=require(_0x8145('0x14'));var licenseUtil=require(_0x8145('0x15'));var db=require(_0x8145('0x16'))['db'];function respondWithStatusCode(_0x9dfbc7,_0x1d98cb){_0x1d98cb=_0x1d98cb||0xcc;return function(_0xdb0f77){if(_0xdb0f77){return _0x9dfbc7[_0x8145('0x17')](_0x1d98cb);}return _0x9dfbc7[_0x8145('0x18')](_0x1d98cb)[_0x8145('0x19')]();};}function respondWithResult(_0x4b1978,_0x41db4e){_0x41db4e=_0x41db4e||0xc8;return function(_0x1016d7){if(_0x1016d7){return _0x4b1978['status'](_0x41db4e)[_0x8145('0x1a')](_0x1016d7);}};}function respondWithFilteredResult(_0x5ded65,_0x5f5d90){return function(_0x264468){if(_0x264468){var _0x4b2527=typeof _0x5f5d90['offset']==='undefined'&&typeof _0x5f5d90[_0x8145('0x1b')]===_0x8145('0x1c');var _0x11f01a=_0x264468['count'];var _0x529e5f=_0x4b2527?0x0:_0x5f5d90[_0x8145('0x1d')];var _0x2a1cb5=_0x4b2527?_0x264468[_0x8145('0x1e')]:_0x5f5d90[_0x8145('0x1d')]+_0x5f5d90[_0x8145('0x1b')];var _0x52a77c;if(_0x2a1cb5>=_0x11f01a){_0x2a1cb5=_0x11f01a;_0x52a77c=0xc8;}else{_0x52a77c=0xce;}_0x5ded65[_0x8145('0x18')](_0x52a77c);return _0x5ded65[_0x8145('0x1f')]('Content-Range',_0x529e5f+'-'+_0x2a1cb5+'/'+_0x11f01a)['json'](_0x264468);}return null;};}function patchUpdates(_0x5ac0d9){return function(_0x32ea0b){try{jsonpatch['apply'](_0x32ea0b,_0x5ac0d9,!![]);}catch(_0x33946e){return BPromise[_0x8145('0x20')](_0x33946e);}return _0x32ea0b[_0x8145('0x21')]();};}function saveUpdates(_0x518366,_0xdd468d){return function(_0x1dda1c){if(_0x1dda1c){return _0x1dda1c[_0x8145('0x22')](_0x518366)['then'](function(_0x5c175e){return _0x5c175e;});}return null;};}function removeEntity(_0x50ccc8,_0x26b902){return function(_0x23afbb){if(_0x23afbb){return _0x23afbb[_0x8145('0x23')]()[_0x8145('0x24')](function(){_0x50ccc8[_0x8145('0x18')](0xcc)[_0x8145('0x19')]();});}};}function handleEntityNotFound(_0x55da7b,_0x5a7ad1){return function(_0x1f86bc){if(!_0x1f86bc){_0x55da7b[_0x8145('0x17')](0x194);}return _0x1f86bc;};}function handleError(_0x1e8272,_0x5ca6ec){_0x5ca6ec=_0x5ca6ec||0x1f4;return function(_0x46f837){logger[_0x8145('0x25')](_0x46f837['stack']);if(_0x46f837['name']){delete _0x46f837[_0x8145('0x26')];}_0x1e8272[_0x8145('0x18')](_0x5ca6ec)[_0x8145('0x27')](_0x46f837);};}exports[_0x8145('0x28')]=function(_0x3affe0,_0x1a4a65){var _0x320d68={},_0x8cd0ab={},_0x5abc0c={'count':0x0,'rows':[]};var _0x390627=_[_0x8145('0x29')](db[_0x8145('0x2a')]['rawAttributes'],function(_0x3f560b){return{'name':_0x3f560b['fieldName'],'type':_0x3f560b[_0x8145('0x2b')][_0x8145('0x2c')]};});_0x8cd0ab[_0x8145('0x2d')]=_['map'](_0x390627,_0x8145('0x26'));_0x8cd0ab[_0x8145('0x2e')]=_[_0x8145('0x2f')](_0x3affe0[_0x8145('0x2e')]);_0x8cd0ab[_0x8145('0x30')]=_[_0x8145('0x31')](_0x8cd0ab['model'],_0x8cd0ab[_0x8145('0x2e')]);_0x320d68[_0x8145('0x32')]=_['intersection'](_0x8cd0ab[_0x8145('0x2d')],qs[_0x8145('0x33')](_0x3affe0[_0x8145('0x2e')][_0x8145('0x33')]));_0x320d68['attributes']=_0x320d68[_0x8145('0x32')][_0x8145('0x34')]?_0x320d68[_0x8145('0x32')]:_0x8cd0ab[_0x8145('0x2d')];if(!_0x3affe0['query'][_0x8145('0x35')](_0x8145('0x36'))){_0x320d68[_0x8145('0x1b')]=qs['limit'](_0x3affe0[_0x8145('0x2e')]['limit']);_0x320d68[_0x8145('0x1d')]=qs[_0x8145('0x1d')](_0x3affe0[_0x8145('0x2e')][_0x8145('0x1d')]);}_0x320d68['order']=qs[_0x8145('0x37')](_0x3affe0[_0x8145('0x2e')][_0x8145('0x37')]);_0x320d68[_0x8145('0x38')]=qs[_0x8145('0x30')](_[_0x8145('0x39')](_0x3affe0[_0x8145('0x2e')],_0x8cd0ab[_0x8145('0x30')]),_0x390627);if(_0x3affe0[_0x8145('0x2e')][_0x8145('0x3a')]){_0x320d68[_0x8145('0x38')]=_[_0x8145('0x3b')](_0x320d68[_0x8145('0x38')],{'$or':_[_0x8145('0x29')](_0x390627,function(_0x59be56){if(_0x59be56[_0x8145('0x2b')]!==_0x8145('0x3c')){var _0x5a62af={};_0x5a62af[_0x59be56[_0x8145('0x26')]]={'$like':'%'+_0x3affe0['query']['filter']+'%'};return _0x5a62af;}})});}_0x320d68=_['merge']({},_0x320d68,_0x3affe0[_0x8145('0x3d')]);var _0x560f7f={'where':_0x320d68[_0x8145('0x38')]};return db['ServicenowField'][_0x8145('0x1e')](_0x560f7f)['then'](function(_0x3882de){_0x5abc0c['count']=_0x3882de;if(_0x3affe0[_0x8145('0x2e')][_0x8145('0x3e')]){_0x320d68[_0x8145('0x3f')]=[{'all':!![]}];}return db[_0x8145('0x2a')][_0x8145('0x40')](_0x320d68);})[_0x8145('0x24')](function(_0x11d8ee){_0x5abc0c['rows']=_0x11d8ee;return _0x5abc0c;})[_0x8145('0x24')](respondWithFilteredResult(_0x1a4a65,_0x320d68))[_0x8145('0x41')](handleError(_0x1a4a65,null));};exports['show']=function(_0x2c204d,_0x1e153c){var _0x3b29cb={'raw':!![],'where':{'id':_0x2c204d[_0x8145('0x42')]['id']}},_0x4cfa48={};_0x4cfa48['model']=_[_0x8145('0x2f')](db[_0x8145('0x2a')][_0x8145('0x43')]);_0x4cfa48['query']=_[_0x8145('0x2f')](_0x2c204d[_0x8145('0x2e')]);_0x4cfa48[_0x8145('0x30')]=_[_0x8145('0x31')](_0x4cfa48['model'],_0x4cfa48[_0x8145('0x2e')]);_0x3b29cb[_0x8145('0x32')]=_['intersection'](_0x4cfa48[_0x8145('0x2d')],qs[_0x8145('0x33')](_0x2c204d[_0x8145('0x2e')]['fields']));_0x3b29cb[_0x8145('0x32')]=_0x3b29cb[_0x8145('0x32')][_0x8145('0x34')]?_0x3b29cb[_0x8145('0x32')]:_0x4cfa48[_0x8145('0x2d')];if(_0x2c204d[_0x8145('0x2e')][_0x8145('0x3e')]){_0x3b29cb[_0x8145('0x3f')]=[{'all':!![]}];}_0x3b29cb=_[_0x8145('0x3b')]({},_0x3b29cb,_0x2c204d[_0x8145('0x3d')]);return db['ServicenowField'][_0x8145('0x44')](_0x3b29cb)[_0x8145('0x24')](handleEntityNotFound(_0x1e153c,null))[_0x8145('0x24')](respondWithResult(_0x1e153c,null))['catch'](handleError(_0x1e153c,null));};exports[_0x8145('0x45')]=function(_0xdb80b7,_0x333d74){return db[_0x8145('0x2a')][_0x8145('0x45')](_0xdb80b7['body'],{})[_0x8145('0x24')](respondWithResult(_0x333d74,0xc9))[_0x8145('0x41')](handleError(_0x333d74,null));};exports[_0x8145('0x22')]=function(_0xb574ee,_0x54c821){if(_0xb574ee['body']['id']){delete _0xb574ee[_0x8145('0x46')]['id'];}return db[_0x8145('0x2a')][_0x8145('0x44')]({'where':{'id':_0xb574ee[_0x8145('0x42')]['id']}})[_0x8145('0x24')](handleEntityNotFound(_0x54c821,null))['then'](saveUpdates(_0xb574ee['body'],null))[_0x8145('0x24')](respondWithResult(_0x54c821,null))[_0x8145('0x41')](handleError(_0x54c821,null));};exports[_0x8145('0x23')]=function(_0x174a3f,_0x3e9efe){return db['ServicenowField'][_0x8145('0x44')]({'where':{'id':_0x174a3f[_0x8145('0x42')]['id']}})[_0x8145('0x24')](handleEntityNotFound(_0x3e9efe,null))[_0x8145('0x24')](removeEntity(_0x3e9efe,null))[_0x8145('0x41')](handleError(_0x3e9efe,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4f21d63..50d62c3 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 _0x39c7=['idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','servicenow_unique_index'];(function(_0x40fbe,_0x40b20c){var _0x17c57e=function(_0x57818){while(--_0x57818){_0x40fbe['push'](_0x40fbe['shift']());}};_0x17c57e(++_0x40b20c);}(_0x39c7,0x85));var _0x739c=function(_0x1e3446,_0x3f0de3){_0x1e3446=_0x1e3446-0x0;var _0x364458=_0x39c7[_0x1e3446];return _0x364458;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x739c('0x6'));var config=require(_0x739c('0x7'));var attributes=require(_0x739c('0x8'));module['exports']=function(_0x4c5030,_0x1923d9){return _0x4c5030[_0x739c('0x9')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x739c('0xa'),'fields':[_0x739c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','util','api'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x1bb8,0x1d2));var _0x81bb=function(_0x13c979,_0x1f4cae){_0x13c979=_0x13c979-0x0;var _0x45d3d1=_0x1bb8[_0x13c979];return _0x45d3d1;};'use strict';var _=require('lodash');var util=require(_0x81bb('0x0'));var logger=require('../../config/logger')(_0x81bb('0x1'));var moment=require(_0x81bb('0x2'));var BPromise=require(_0x81bb('0x3'));var rp=require(_0x81bb('0x4'));var fs=require('fs');var path=require(_0x81bb('0x5'));var rimraf=require(_0x81bb('0x6'));var config=require(_0x81bb('0x7'));var attributes=require(_0x81bb('0x8'));module['exports']=function(_0x3c2c05,_0x5e6a6b){return _0x3c2c05[_0x81bb('0x9')](_0x81bb('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x81bb('0xb'),'fields':['idField','FieldId'],'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 61c41a6..164072c 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a40ce,_0x396eba){var _0x1919f0=function(_0x443658){while(--_0x443658){_0x4a40ce['push'](_0x4a40ce['shift']());}};_0x1919f0(++_0x396eba);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2be9c4,_0x208943){_0x2be9c4=_0x2be9c4-0x0;var _0x57173b=_0xf4eb[_0x2be9c4];return _0x57173b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xf8eb8c,_0x1dbc72){var _0xa336d4=function(_0x39fdf2){while(--_0x39fdf2){_0xf8eb8c['push'](_0xf8eb8c['shift']());}};_0xa336d4(++_0x1dbc72);}(_0xb43b,0x1b2));var _0xbb43=function(_0x8ff8a0,_0x2df580){_0x8ff8a0=_0x8ff8a0-0x0;var _0x249aa4=_0xb43b[_0x8ff8a0];return _0x249aa4;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fc8fde4..dcad32a 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(_0x63485d,_0x2c5754){var _0x4c9674=function(_0x331c65){while(--_0x331c65){_0x63485d['push'](_0x63485d['shift']());}};_0x4c9674(++_0x2c5754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x59862b,_0x4c703e){var _0x3d3420=function(_0x3d7cdd){while(--_0x3d7cdd){_0x59862b['push'](_0x59862b['shift']());}};_0x3d3420(++_0x4c703e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d0f20bf..3eb6fdf 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(_0x564323,_0x1cbb43){var _0x139a77=function(_0x209133){while(--_0x209133){_0x564323['push'](_0x564323['shift']());}};_0x139a77(++_0x1cbb43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x5e4ecd,_0x49395e){var _0x123d18=function(_0x51df0c){while(--_0x51df0c){_0x5e4ecd['push'](_0x5e4ecd['shift']());}};_0x123d18(++_0x49395e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 2daf343..173c457 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 _0x823f=['Password\x20Expired','%s%s','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','substring','format','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login'];(function(_0x5066cd,_0x703314){var _0x28c062=function(_0xa676bb){while(--_0xa676bb){_0x5066cd['push'](_0x5066cd['shift']());}};_0x28c062(++_0x703314);}(_0x823f,0x181));var _0xf823=function(_0x4d4e7c,_0x1a8689){_0x4d4e7c=_0x4d4e7c-0x0;var _0x408125=_0x823f[_0x4d4e7c];return _0x408125;};'use strict';var emlformat=require(_0xf823('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf823('0x1'));var jsonpatch=require(_0xf823('0x2'));var rp=require(_0xf823('0x3'));var moment=require(_0xf823('0x4'));var BPromise=require(_0xf823('0x5'));var Mustache=require('mustache');var util=require(_0xf823('0x6'));var path=require('path');var sox=require(_0xf823('0x7'));var csv=require(_0xf823('0x8'));var ejs=require(_0xf823('0x9'));var fs=require('fs');var fs_extra=require(_0xf823('0xa'));var _=require(_0xf823('0xb'));var squel=require(_0xf823('0xc'));var crypto=require(_0xf823('0xd'));var jsforce=require(_0xf823('0xe'));var deskjs=require(_0xf823('0xf'));var toCsv=require(_0xf823('0x8'));var querystring=require(_0xf823('0x10'));var Papa=require(_0xf823('0x11'));var Redis=require(_0xf823('0x12'));var authService=require(_0xf823('0x13'));var qs=require(_0xf823('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf823('0x15'));var logger=require('../../config/logger')(_0xf823('0x16'));var utils=require('../../config/utils');var config=require(_0xf823('0x17'));var licenseUtil=require(_0xf823('0x18'));var db=require(_0xf823('0x19'))['db'];var integrations=require(_0xf823('0x1a'));function respondWithStatusCode(_0x1b8794,_0x439983){_0x439983=_0x439983||0xcc;return function(_0x3aeec3){if(_0x3aeec3){return _0x1b8794[_0xf823('0x1b')](_0x439983);}return _0x1b8794[_0xf823('0x1c')](_0x439983)['end']();};}function respondWithResult(_0x4ffa6c,_0x44eaf4){_0x44eaf4=_0x44eaf4||0xc8;return function(_0x5c63da){if(_0x5c63da){return _0x4ffa6c[_0xf823('0x1c')](_0x44eaf4)['json'](_0x5c63da);}};}function respondWithFilteredResult(_0x16e115,_0x77de8e){return function(_0x2c6d8b){if(_0x2c6d8b){var _0x371197=typeof _0x77de8e[_0xf823('0x1d')]===_0xf823('0x1e')&&typeof _0x77de8e['limit']===_0xf823('0x1e');var _0x5b5d58=_0x2c6d8b[_0xf823('0x1f')];var _0x566359=_0x371197?0x0:_0x77de8e[_0xf823('0x1d')];var _0x98ff73=_0x371197?_0x2c6d8b['count']:_0x77de8e[_0xf823('0x1d')]+_0x77de8e[_0xf823('0x20')];var _0xddce9d;if(_0x98ff73>=_0x5b5d58){_0x98ff73=_0x5b5d58;_0xddce9d=0xc8;}else{_0xddce9d=0xce;}_0x16e115[_0xf823('0x1c')](_0xddce9d);return _0x16e115[_0xf823('0x21')](_0xf823('0x22'),_0x566359+'-'+_0x98ff73+'/'+_0x5b5d58)[_0xf823('0x23')](_0x2c6d8b);}return null;};}function patchUpdates(_0x228ebd){return function(_0x33cfc4){try{jsonpatch[_0xf823('0x24')](_0x33cfc4,_0x228ebd,!![]);}catch(_0x155a57){return BPromise['reject'](_0x155a57);}return _0x33cfc4[_0xf823('0x25')]();};}function saveUpdates(_0x2a4631,_0x2619bf){return function(_0x5a817c){if(_0x5a817c){return _0x5a817c['update'](_0x2a4631)[_0xf823('0x26')](function(_0x45d697){return _0x45d697;});}return null;};}function removeEntity(_0x3370fd,_0x2c4337){return function(_0x5b8f7e){if(_0x5b8f7e){return _0x5b8f7e[_0xf823('0x27')]()[_0xf823('0x26')](function(){_0x3370fd[_0xf823('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf8d8,_0x210caf){return function(_0x1e1d86){if(!_0x1e1d86){_0x2cf8d8['sendStatus'](0x194);}return _0x1e1d86;};}function handleError(_0xf635df,_0x5d9e0e){_0x5d9e0e=_0x5d9e0e||0x1f4;return function(_0x3aa1ec){logger[_0xf823('0x28')](_0x3aa1ec['stack']);if(_0x3aa1ec[_0xf823('0x29')]){delete _0x3aa1ec[_0xf823('0x29')];}_0xf635df['status'](_0x5d9e0e)['send'](_0x3aa1ec);};}exports[_0xf823('0x2a')]=function(_0x53a6f5,_0x59838d){var _0x432e4a={},_0x185195={},_0x247c2b={'count':0x0,'rows':[]};var _0x3179c3=_[_0xf823('0x2b')](db[_0xf823('0x2c')][_0xf823('0x2d')],function(_0x3661d6){return{'name':_0x3661d6[_0xf823('0x2e')],'type':_0x3661d6[_0xf823('0x2f')][_0xf823('0x30')]};});_0x185195['model']=_[_0xf823('0x2b')](_0x3179c3,_0xf823('0x29'));_0x185195[_0xf823('0x31')]=_[_0xf823('0x32')](_0x53a6f5['query']);_0x185195[_0xf823('0x33')]=_[_0xf823('0x34')](_0x185195[_0xf823('0x35')],_0x185195[_0xf823('0x31')]);_0x432e4a['attributes']=_[_0xf823('0x34')](_0x185195['model'],qs['fields'](_0x53a6f5[_0xf823('0x31')][_0xf823('0x36')]));_0x432e4a[_0xf823('0x37')]=_0x432e4a['attributes']['length']?_0x432e4a['attributes']:_0x185195[_0xf823('0x35')];if(!_0x53a6f5[_0xf823('0x31')]['hasOwnProperty']('nolimit')){_0x432e4a[_0xf823('0x20')]=qs[_0xf823('0x20')](_0x53a6f5[_0xf823('0x31')][_0xf823('0x20')]);_0x432e4a[_0xf823('0x1d')]=qs['offset'](_0x53a6f5[_0xf823('0x31')][_0xf823('0x1d')]);}_0x432e4a[_0xf823('0x38')]=qs[_0xf823('0x39')](_0x53a6f5[_0xf823('0x31')][_0xf823('0x39')]);_0x432e4a[_0xf823('0x3a')]=qs['filters'](_[_0xf823('0x3b')](_0x53a6f5[_0xf823('0x31')],_0x185195[_0xf823('0x33')]),_0x3179c3);if(_0x53a6f5['query'][_0xf823('0x3c')]){_0x432e4a['where']=_[_0xf823('0x3d')](_0x432e4a['where'],{'$or':_[_0xf823('0x2b')](_0x3179c3,function(_0xf8b1e9){if(_0xf8b1e9[_0xf823('0x2f')]!==_0xf823('0x3e')){var _0x14486f={};_0x14486f[_0xf8b1e9['name']]={'$like':'%'+_0x53a6f5[_0xf823('0x31')][_0xf823('0x3c')]+'%'};return _0x14486f;}})});}_0x432e4a=_[_0xf823('0x3d')]({},_0x432e4a,_0x53a6f5[_0xf823('0x3f')]);var _0x282e14={'where':_0x432e4a[_0xf823('0x3a')]};return db[_0xf823('0x2c')]['count'](_0x282e14)[_0xf823('0x26')](function(_0x361705){_0x247c2b[_0xf823('0x1f')]=_0x361705;if(_0x53a6f5[_0xf823('0x31')][_0xf823('0x40')]){_0x432e4a[_0xf823('0x41')]=[{'all':!![]}];}return db[_0xf823('0x2c')][_0xf823('0x42')](_0x432e4a);})['then'](function(_0xadcc81){_0x247c2b['rows']=_0xadcc81;return _0x247c2b;})[_0xf823('0x26')](respondWithFilteredResult(_0x59838d,_0x432e4a))['catch'](handleError(_0x59838d,null));};exports[_0xf823('0x43')]=function(_0x279edc,_0xe2c19e){var _0x5817ad={'raw':![],'where':{'id':_0x279edc[_0xf823('0x44')]['id']}},_0x2570cf={};_0x2570cf[_0xf823('0x35')]=_[_0xf823('0x32')](db[_0xf823('0x2c')][_0xf823('0x2d')]);_0x2570cf[_0xf823('0x31')]=_['keys'](_0x279edc['query']);_0x2570cf[_0xf823('0x33')]=_[_0xf823('0x34')](_0x2570cf[_0xf823('0x35')],_0x2570cf[_0xf823('0x31')]);_0x5817ad[_0xf823('0x37')]=_[_0xf823('0x34')](_0x2570cf[_0xf823('0x35')],qs[_0xf823('0x36')](_0x279edc[_0xf823('0x31')][_0xf823('0x36')]));_0x5817ad[_0xf823('0x37')]=_0x5817ad[_0xf823('0x37')][_0xf823('0x45')]?_0x5817ad['attributes']:_0x2570cf[_0xf823('0x35')];if(_0x279edc[_0xf823('0x31')]['includeAll']){_0x5817ad[_0xf823('0x41')]=[{'all':!![]}];}_0x5817ad=_[_0xf823('0x3d')]({},_0x5817ad,_0x279edc[_0xf823('0x3f')]);return db[_0xf823('0x2c')][_0xf823('0x46')](_0x5817ad)[_0xf823('0x26')](handleEntityNotFound(_0xe2c19e,null))[_0xf823('0x26')](respondWithResult(_0xe2c19e,null))[_0xf823('0x47')](handleError(_0xe2c19e,null));};exports[_0xf823('0x48')]=function(_0x31246d,_0x3a55c3){return db[_0xf823('0x2c')]['create'](_0x31246d['body'],{})['then'](respondWithResult(_0x3a55c3,0xc9))[_0xf823('0x47')](handleError(_0x3a55c3,null));};exports['update']=function(_0x3ab84f,_0x574d5c){if(_0x3ab84f[_0xf823('0x49')]['id']){delete _0x3ab84f[_0xf823('0x49')]['id'];}return db[_0xf823('0x2c')]['find']({'where':{'id':_0x3ab84f['params']['id']}})[_0xf823('0x26')](handleEntityNotFound(_0x574d5c,null))[_0xf823('0x26')](saveUpdates(_0x3ab84f['body'],null))[_0xf823('0x26')](respondWithResult(_0x574d5c,null))[_0xf823('0x47')](handleError(_0x574d5c,null));};exports[_0xf823('0x27')]=function(_0xa0a741,_0x4a4656){return db[_0xf823('0x2c')][_0xf823('0x46')]({'where':{'id':_0xa0a741[_0xf823('0x44')]['id']}})[_0xf823('0x26')](handleEntityNotFound(_0x4a4656,null))[_0xf823('0x26')](removeEntity(_0x4a4656,null))[_0xf823('0x47')](handleError(_0x4a4656,null));};exports[_0xf823('0x4a')]=function(_0xcd0003,_0x30905e,_0x124178){var _0x5f2ea7={};var _0x1f8212={};var _0x4700b7;var _0x25a22f;return db[_0xf823('0x2c')][_0xf823('0x4b')]({'where':{'id':_0xcd0003[_0xf823('0x44')]['id']}})['then'](handleEntityNotFound(_0x30905e,null))['then'](function(_0x3ea743){if(_0x3ea743){_0x4700b7=_0x3ea743;_0x1f8212[_0xf823('0x35')]=_['keys'](db[_0xf823('0x4c')][_0xf823('0x2d')]);_0x1f8212['query']=_[_0xf823('0x32')](_0xcd0003[_0xf823('0x31')]);_0x1f8212[_0xf823('0x33')]=_[_0xf823('0x34')](_0x1f8212[_0xf823('0x35')],_0x1f8212[_0xf823('0x31')]);_0x5f2ea7[_0xf823('0x37')]=_[_0xf823('0x34')](_0x1f8212[_0xf823('0x35')],qs[_0xf823('0x36')](_0xcd0003['query'][_0xf823('0x36')]));_0x5f2ea7[_0xf823('0x37')]=_0x5f2ea7['attributes'][_0xf823('0x45')]?_0x5f2ea7['attributes']:_0x1f8212['model'];_0x5f2ea7[_0xf823('0x38')]=qs[_0xf823('0x39')](_0xcd0003['query'][_0xf823('0x39')]);_0x5f2ea7[_0xf823('0x3a')]=qs['filters'](_[_0xf823('0x3b')](_0xcd0003[_0xf823('0x31')],_0x1f8212[_0xf823('0x33')]));if(_0xcd0003[_0xf823('0x31')]['filter']){_0x5f2ea7[_0xf823('0x3a')]=_[_0xf823('0x3d')](_0x5f2ea7[_0xf823('0x3a')],{'$or':_[_0xf823('0x2b')](_0x5f2ea7[_0xf823('0x37')],function(_0x1d02c8){var _0x48013e={};_0x48013e[_0x1d02c8]={'$like':'%'+_0xcd0003[_0xf823('0x31')]['filter']+'%'};return _0x48013e;})});}_0x5f2ea7=_['merge']({},_0x5f2ea7,_0xcd0003['options']);return _0x4700b7[_0xf823('0x4a')](_0x5f2ea7);}})[_0xf823('0x26')](function(_0x5a8c9f){if(_0x5a8c9f){_0x25a22f=_0x5a8c9f[_0xf823('0x45')];if(!_0xcd0003['query'][_0xf823('0x4d')](_0xf823('0x4e'))){_0x5f2ea7[_0xf823('0x20')]=qs['limit'](_0xcd0003[_0xf823('0x31')][_0xf823('0x20')]);_0x5f2ea7['offset']=qs['offset'](_0xcd0003['query']['offset']);}return _0x4700b7[_0xf823('0x4a')](_0x5f2ea7);}})[_0xf823('0x26')](function(_0x238300){if(_0x238300){return _0x238300?{'count':_0x25a22f,'rows':_0x238300}:null;}})[_0xf823('0x26')](respondWithResult(_0x30905e,null))['catch'](handleError(_0x30905e,null));};exports[_0xf823('0x4f')]=function(_0x443d9e,_0x5741bb,_0x3c34ef){if(_0x443d9e[_0xf823('0x49')]['id']){delete _0x443d9e[_0xf823('0x49')]['id'];}return db[_0xf823('0x2c')][_0xf823('0x4b')]({'where':{'id':_0x443d9e[_0xf823('0x44')]['id']}})[_0xf823('0x26')](handleEntityNotFound(_0x5741bb,null))[_0xf823('0x26')](function(_0x462b0){if(_0x462b0){_0x443d9e[_0xf823('0x49')][_0xf823('0x50')]=_0x462b0['id'];_0x443d9e[_0xf823('0x49')][_0xf823('0x51')]=integrations['getSubjects'](_0x443d9e[_0xf823('0x49')][_0xf823('0x52')],_0x443d9e[_0xf823('0x49')][_0xf823('0x2f')]);_0x443d9e[_0xf823('0x49')]['Descriptions']=integrations[_0xf823('0x53')](_0x443d9e[_0xf823('0x49')][_0xf823('0x52')],_0x443d9e[_0xf823('0x49')][_0xf823('0x2f')]);return db[_0xf823('0x4c')]['create'](_0x443d9e['body'],{'include':[{'model':db[_0xf823('0x54')],'as':_0xf823('0x51')},{'model':db[_0xf823('0x54')],'as':_0xf823('0x55')}]});}return null;})[_0xf823('0x26')](respondWithResult(_0x5741bb,null))[_0xf823('0x47')](handleError(_0x5741bb,null));};exports[_0xf823('0x56')]=function(_0x236261,_0x5aa20e,_0x3de5ea){var _0x5e9e8b='';var _0x6c3a59=['id',_0xf823('0x29'),_0xf823('0x57'),_0xf823('0x58'),_0xf823('0x59'),_0xf823('0x5a'),_0xf823('0x5b'),'duration_minutes',_0xf823('0x5c'),_0xf823('0x5d'),_0xf823('0x5e'),_0xf823('0x5f')];return db[_0xf823('0x2c')][_0xf823('0x4b')]({'where':{'id':_0x236261[_0xf823('0x44')]['id']},'attributes':['id',_0xf823('0x60'),'password',_0xf823('0x61')]})[_0xf823('0x26')](handleEntityNotFound(_0x5aa20e,null))[_0xf823('0x26')](function(_0x48f4b4){if(_0x48f4b4){_0x5e9e8b=_0x48f4b4[_0xf823('0x61')];var _0x2f894f=_0x5e9e8b['slice'](-0x1);if(_0x2f894f==='/'){_0x5e9e8b=_0x5e9e8b[_0xf823('0x62')](0x0,_0x5e9e8b['lastIndexOf'](_0x2f894f));}return rp({'method':'POST','uri':util[_0xf823('0x63')]('%s%s',_0x5e9e8b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf823('0x64'),'input_type':_0xf823('0x65'),'response_type':_0xf823('0x65'),'rest_data':JSON[_0xf823('0x66')]({'user_auth':{'user_name':_0x48f4b4[_0xf823('0x60')],'password':_0x48f4b4[_0xf823('0x67')],'encryption':_0xf823('0x68')},'application':_0xf823('0x69')})}});}})['then'](function(_0x4a258a){if(_0x4a258a&&_0x4a258a[_0xf823('0x29')]!==_0xf823('0x6a')&&_0x4a258a[_0xf823('0x29')]!==_0xf823('0x6b')){return rp({'method':'POST','uri':util['format'](_0xf823('0x6c'),_0x5e9e8b,_0xf823('0x6d')),'json':!![],'form':{'method':_0xf823('0x6e'),'input_type':_0xf823('0x65'),'response_type':_0xf823('0x65'),'rest_data':JSON[_0xf823('0x66')]({'session':_0x4a258a['id'],'module_name':_0xf823('0x6f')})}})['then'](function(_0x3e2714){if(_0x3e2714){var _0x48b655=_[_0xf823('0x70')](_0x3e2714[_0xf823('0x71')]);_['remove'](_0x48b655,function(_0x113759){return _0x6c3a59[_0xf823('0x72')](_0x113759[_0xf823('0x29')]);});return{'count':_0x48b655['length'],'rows':_[_0xf823('0x2b')](_0x48b655,function(_0x3b6080){return{'id':_0x3b6080[_0xf823('0x29')],'name':_0x3b6080[_0xf823('0x73')],'custom':_[_0xf823('0x74')](_0x3b6080['name'],'_c')?!![]:![],'options':_0x3b6080['options']?_['map'](_[_0xf823('0x70')](_0x3b6080['options']),function(_0x460a5c){return{'name':_0x460a5c[_0xf823('0x75')],'value':_0x460a5c[_0xf823('0x29')]};}):[]};})};}})[_0xf823('0x26')](respondWithResult(_0x5aa20e,null))[_0xf823('0x47')](function(_0x131d76){var _0x3b0578=_0x236261['query']['test']?0x1f4:_0x131d76['statusCode']||0x1f4;logger[_0xf823('0x28')](_0xf823('0x76'),_0xf823('0x56'),_0x3b0578,JSON[_0xf823('0x66')](_0x131d76));delete _0x131d76[_0xf823('0x29')];if(_0x3b0578===0x191){_0x3b0578=0x190;}_0x5aa20e[_0xf823('0x1c')](_0x3b0578)[_0xf823('0x77')](_0x236261[_0xf823('0x31')][_0xf823('0x78')]?{'message':_0xf823('0x79'),'statusCode':_0x131d76[_0xf823('0x7a')]}:_0x131d76);});}else{var _0xbc70c5=0x1f4;_0x5aa20e[_0xf823('0x1c')](_0xbc70c5)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x2c42=['index','map','SugarcrmAccount','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','show','rawAttributes','include','create','body','find','params','catch','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','send','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c42,0x139));var _0x22c4=function(_0x1a393d,_0x203e50){_0x1a393d=_0x1a393d-0x0;var _0x35aecb=_0x2c42[_0x1a393d];return _0x35aecb;};'use strict';var emlformat=require(_0x22c4('0x0'));var rimraf=require(_0x22c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22c4('0x2'));var rp=require('request-promise');var moment=require(_0x22c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x22c4('0x4'));var util=require(_0x22c4('0x5'));var path=require(_0x22c4('0x6'));var sox=require(_0x22c4('0x7'));var csv=require(_0x22c4('0x8'));var ejs=require(_0x22c4('0x9'));var fs=require('fs');var fs_extra=require(_0x22c4('0xa'));var _=require(_0x22c4('0xb'));var squel=require(_0x22c4('0xc'));var crypto=require(_0x22c4('0xd'));var jsforce=require(_0x22c4('0xe'));var deskjs=require(_0x22c4('0xf'));var toCsv=require(_0x22c4('0x8'));var querystring=require(_0x22c4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x22c4('0x11'));var qs=require(_0x22c4('0x12'));var as=require(_0x22c4('0x13'));var hardwareService=require(_0x22c4('0x14'));var logger=require('../../config/logger')(_0x22c4('0x15'));var utils=require(_0x22c4('0x16'));var config=require(_0x22c4('0x17'));var licenseUtil=require(_0x22c4('0x18'));var db=require(_0x22c4('0x19'))['db'];var integrations=require(_0x22c4('0x1a'));function respondWithStatusCode(_0x476764,_0x562331){_0x562331=_0x562331||0xcc;return function(_0x5d33ff){if(_0x5d33ff){return _0x476764[_0x22c4('0x1b')](_0x562331);}return _0x476764[_0x22c4('0x1c')](_0x562331)[_0x22c4('0x1d')]();};}function respondWithResult(_0x3014da,_0x56d762){_0x56d762=_0x56d762||0xc8;return function(_0x5983e3){if(_0x5983e3){return _0x3014da[_0x22c4('0x1c')](_0x56d762)[_0x22c4('0x1e')](_0x5983e3);}};}function respondWithFilteredResult(_0x466c96,_0x3561ec){return function(_0x5f3aab){if(_0x5f3aab){var _0x3d8fd1=typeof _0x3561ec[_0x22c4('0x1f')]===_0x22c4('0x20')&&typeof _0x3561ec[_0x22c4('0x21')]==='undefined';var _0x41f142=_0x5f3aab[_0x22c4('0x22')];var _0x3a36d0=_0x3d8fd1?0x0:_0x3561ec[_0x22c4('0x1f')];var _0x898c78=_0x3d8fd1?_0x5f3aab['count']:_0x3561ec[_0x22c4('0x1f')]+_0x3561ec[_0x22c4('0x21')];var _0x80c0fc;if(_0x898c78>=_0x41f142){_0x898c78=_0x41f142;_0x80c0fc=0xc8;}else{_0x80c0fc=0xce;}_0x466c96[_0x22c4('0x1c')](_0x80c0fc);return _0x466c96['set'](_0x22c4('0x23'),_0x3a36d0+'-'+_0x898c78+'/'+_0x41f142)[_0x22c4('0x1e')](_0x5f3aab);}return null;};}function patchUpdates(_0x39d622){return function(_0x1d8cf9){try{jsonpatch[_0x22c4('0x24')](_0x1d8cf9,_0x39d622,!![]);}catch(_0x3446a5){return BPromise[_0x22c4('0x25')](_0x3446a5);}return _0x1d8cf9[_0x22c4('0x26')]();};}function saveUpdates(_0x3c10b8,_0x5134b9){return function(_0x3b168a){if(_0x3b168a){return _0x3b168a['update'](_0x3c10b8)[_0x22c4('0x27')](function(_0x4f81dd){return _0x4f81dd;});}return null;};}function removeEntity(_0x46d7a8,_0x43c43d){return function(_0xeb08ee){if(_0xeb08ee){return _0xeb08ee[_0x22c4('0x28')]()['then'](function(){_0x46d7a8[_0x22c4('0x1c')](0xcc)[_0x22c4('0x1d')]();});}};}function handleEntityNotFound(_0x1b1998,_0x4408d2){return function(_0x3d7104){if(!_0x3d7104){_0x1b1998[_0x22c4('0x1b')](0x194);}return _0x3d7104;};}function handleError(_0x5d9fb3,_0x5995c9){_0x5995c9=_0x5995c9||0x1f4;return function(_0x46e8e2){logger[_0x22c4('0x29')](_0x46e8e2[_0x22c4('0x2a')]);if(_0x46e8e2['name']){delete _0x46e8e2[_0x22c4('0x2b')];}_0x5d9fb3[_0x22c4('0x1c')](_0x5995c9)['send'](_0x46e8e2);};}exports[_0x22c4('0x2c')]=function(_0x3e42bc,_0x28477b){var _0x22fcae={},_0x1119f3={},_0x3a6b62={'count':0x0,'rows':[]};var _0xe41426=_[_0x22c4('0x2d')](db[_0x22c4('0x2e')]['rawAttributes'],function(_0x41e269){return{'name':_0x41e269['fieldName'],'type':_0x41e269[_0x22c4('0x2f')][_0x22c4('0x30')]};});_0x1119f3[_0x22c4('0x31')]=_[_0x22c4('0x2d')](_0xe41426,_0x22c4('0x2b'));_0x1119f3[_0x22c4('0x32')]=_[_0x22c4('0x33')](_0x3e42bc[_0x22c4('0x32')]);_0x1119f3['filters']=_[_0x22c4('0x34')](_0x1119f3[_0x22c4('0x31')],_0x1119f3[_0x22c4('0x32')]);_0x22fcae[_0x22c4('0x35')]=_[_0x22c4('0x34')](_0x1119f3[_0x22c4('0x31')],qs['fields'](_0x3e42bc[_0x22c4('0x32')][_0x22c4('0x36')]));_0x22fcae[_0x22c4('0x35')]=_0x22fcae[_0x22c4('0x35')][_0x22c4('0x37')]?_0x22fcae[_0x22c4('0x35')]:_0x1119f3[_0x22c4('0x31')];if(!_0x3e42bc[_0x22c4('0x32')]['hasOwnProperty']('nolimit')){_0x22fcae['limit']=qs[_0x22c4('0x21')](_0x3e42bc[_0x22c4('0x32')]['limit']);_0x22fcae[_0x22c4('0x1f')]=qs[_0x22c4('0x1f')](_0x3e42bc[_0x22c4('0x32')][_0x22c4('0x1f')]);}_0x22fcae[_0x22c4('0x38')]=qs[_0x22c4('0x39')](_0x3e42bc[_0x22c4('0x32')]['sort']);_0x22fcae[_0x22c4('0x3a')]=qs[_0x22c4('0x3b')](_['pick'](_0x3e42bc[_0x22c4('0x32')],_0x1119f3['filters']),_0xe41426);if(_0x3e42bc[_0x22c4('0x32')][_0x22c4('0x3c')]){_0x22fcae[_0x22c4('0x3a')]=_[_0x22c4('0x3d')](_0x22fcae[_0x22c4('0x3a')],{'$or':_[_0x22c4('0x2d')](_0xe41426,function(_0x4b4456){if(_0x4b4456[_0x22c4('0x2f')]!==_0x22c4('0x3e')){var _0x2932ac={};_0x2932ac[_0x4b4456['name']]={'$like':'%'+_0x3e42bc['query'][_0x22c4('0x3c')]+'%'};return _0x2932ac;}})});}_0x22fcae=_[_0x22c4('0x3d')]({},_0x22fcae,_0x3e42bc[_0x22c4('0x3f')]);var _0x2fd827={'where':_0x22fcae[_0x22c4('0x3a')]};return db[_0x22c4('0x2e')][_0x22c4('0x22')](_0x2fd827)[_0x22c4('0x27')](function(_0x88c452){_0x3a6b62[_0x22c4('0x22')]=_0x88c452;if(_0x3e42bc[_0x22c4('0x32')]['includeAll']){_0x22fcae['include']=[{'all':!![]}];}return db[_0x22c4('0x2e')][_0x22c4('0x40')](_0x22fcae);})['then'](function(_0x1a6079){_0x3a6b62[_0x22c4('0x41')]=_0x1a6079;return _0x3a6b62;})[_0x22c4('0x27')](respondWithFilteredResult(_0x28477b,_0x22fcae))['catch'](handleError(_0x28477b,null));};exports[_0x22c4('0x42')]=function(_0x24c445,_0xb2336e){var _0x479c2a={'raw':![],'where':{'id':_0x24c445['params']['id']}},_0x367641={};_0x367641[_0x22c4('0x31')]=_['keys'](db[_0x22c4('0x2e')][_0x22c4('0x43')]);_0x367641[_0x22c4('0x32')]=_['keys'](_0x24c445[_0x22c4('0x32')]);_0x367641[_0x22c4('0x3b')]=_['intersection'](_0x367641[_0x22c4('0x31')],_0x367641['query']);_0x479c2a[_0x22c4('0x35')]=_['intersection'](_0x367641[_0x22c4('0x31')],qs[_0x22c4('0x36')](_0x24c445[_0x22c4('0x32')]['fields']));_0x479c2a[_0x22c4('0x35')]=_0x479c2a[_0x22c4('0x35')][_0x22c4('0x37')]?_0x479c2a[_0x22c4('0x35')]:_0x367641[_0x22c4('0x31')];if(_0x24c445['query']['includeAll']){_0x479c2a[_0x22c4('0x44')]=[{'all':!![]}];}_0x479c2a=_[_0x22c4('0x3d')]({},_0x479c2a,_0x24c445[_0x22c4('0x3f')]);return db[_0x22c4('0x2e')]['find'](_0x479c2a)[_0x22c4('0x27')](handleEntityNotFound(_0xb2336e,null))['then'](respondWithResult(_0xb2336e,null))['catch'](handleError(_0xb2336e,null));};exports[_0x22c4('0x45')]=function(_0x3250da,_0xc384f4){return db[_0x22c4('0x2e')][_0x22c4('0x45')](_0x3250da[_0x22c4('0x46')],{})[_0x22c4('0x27')](respondWithResult(_0xc384f4,0xc9))['catch'](handleError(_0xc384f4,null));};exports['update']=function(_0x1eaa4a,_0xf90dc1){if(_0x1eaa4a[_0x22c4('0x46')]['id']){delete _0x1eaa4a[_0x22c4('0x46')]['id'];}return db[_0x22c4('0x2e')][_0x22c4('0x47')]({'where':{'id':_0x1eaa4a[_0x22c4('0x48')]['id']}})['then'](handleEntityNotFound(_0xf90dc1,null))[_0x22c4('0x27')](saveUpdates(_0x1eaa4a[_0x22c4('0x46')],null))[_0x22c4('0x27')](respondWithResult(_0xf90dc1,null))[_0x22c4('0x49')](handleError(_0xf90dc1,null));};exports[_0x22c4('0x28')]=function(_0x652781,_0x28b4f5){return db[_0x22c4('0x2e')]['find']({'where':{'id':_0x652781['params']['id']}})['then'](handleEntityNotFound(_0x28b4f5,null))[_0x22c4('0x27')](removeEntity(_0x28b4f5,null))[_0x22c4('0x49')](handleError(_0x28b4f5,null));};exports['getConfigurations']=function(_0x3e27ed,_0x570239,_0x14ed4d){var _0x3c3780={};var _0x16d814={};var _0x37cf5b;var _0x14c14f;return db[_0x22c4('0x2e')]['findOne']({'where':{'id':_0x3e27ed[_0x22c4('0x48')]['id']}})[_0x22c4('0x27')](handleEntityNotFound(_0x570239,null))[_0x22c4('0x27')](function(_0x18c53c){if(_0x18c53c){_0x37cf5b=_0x18c53c;_0x16d814[_0x22c4('0x31')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x16d814[_0x22c4('0x32')]=_[_0x22c4('0x33')](_0x3e27ed[_0x22c4('0x32')]);_0x16d814[_0x22c4('0x3b')]=_[_0x22c4('0x34')](_0x16d814[_0x22c4('0x31')],_0x16d814[_0x22c4('0x32')]);_0x3c3780['attributes']=_['intersection'](_0x16d814[_0x22c4('0x31')],qs[_0x22c4('0x36')](_0x3e27ed[_0x22c4('0x32')]['fields']));_0x3c3780['attributes']=_0x3c3780[_0x22c4('0x35')][_0x22c4('0x37')]?_0x3c3780[_0x22c4('0x35')]:_0x16d814[_0x22c4('0x31')];_0x3c3780[_0x22c4('0x38')]=qs['sort'](_0x3e27ed[_0x22c4('0x32')]['sort']);_0x3c3780[_0x22c4('0x3a')]=qs[_0x22c4('0x3b')](_[_0x22c4('0x4a')](_0x3e27ed[_0x22c4('0x32')],_0x16d814[_0x22c4('0x3b')]));if(_0x3e27ed[_0x22c4('0x32')][_0x22c4('0x3c')]){_0x3c3780['where']=_[_0x22c4('0x3d')](_0x3c3780[_0x22c4('0x3a')],{'$or':_[_0x22c4('0x2d')](_0x3c3780[_0x22c4('0x35')],function(_0x4a4498){var _0x2066dc={};_0x2066dc[_0x4a4498]={'$like':'%'+_0x3e27ed[_0x22c4('0x32')][_0x22c4('0x3c')]+'%'};return _0x2066dc;})});}_0x3c3780=_['merge']({},_0x3c3780,_0x3e27ed['options']);return _0x37cf5b[_0x22c4('0x4b')](_0x3c3780);}})[_0x22c4('0x27')](function(_0x1a495d){if(_0x1a495d){_0x14c14f=_0x1a495d[_0x22c4('0x37')];if(!_0x3e27ed['query']['hasOwnProperty']('nolimit')){_0x3c3780[_0x22c4('0x21')]=qs[_0x22c4('0x21')](_0x3e27ed['query']['limit']);_0x3c3780[_0x22c4('0x1f')]=qs['offset'](_0x3e27ed[_0x22c4('0x32')]['offset']);}return _0x37cf5b[_0x22c4('0x4b')](_0x3c3780);}})['then'](function(_0x584ebb){if(_0x584ebb){return _0x584ebb?{'count':_0x14c14f,'rows':_0x584ebb}:null;}})[_0x22c4('0x27')](respondWithResult(_0x570239,null))[_0x22c4('0x49')](handleError(_0x570239,null));};exports[_0x22c4('0x4c')]=function(_0x8e1527,_0x9fad90,_0x325728){if(_0x8e1527[_0x22c4('0x46')]['id']){delete _0x8e1527[_0x22c4('0x46')]['id'];}return db[_0x22c4('0x2e')][_0x22c4('0x4d')]({'where':{'id':_0x8e1527[_0x22c4('0x48')]['id']}})[_0x22c4('0x27')](handleEntityNotFound(_0x9fad90,null))['then'](function(_0xd8d4db){if(_0xd8d4db){_0x8e1527[_0x22c4('0x46')][_0x22c4('0x4e')]=_0xd8d4db['id'];_0x8e1527[_0x22c4('0x46')][_0x22c4('0x4f')]=integrations['getSubjects'](_0x8e1527[_0x22c4('0x46')]['channel'],_0x8e1527[_0x22c4('0x46')][_0x22c4('0x2f')]);_0x8e1527['body']['Descriptions']=integrations[_0x22c4('0x50')](_0x8e1527[_0x22c4('0x46')][_0x22c4('0x51')],_0x8e1527[_0x22c4('0x46')][_0x22c4('0x2f')]);return db[_0x22c4('0x52')][_0x22c4('0x45')](_0x8e1527['body'],{'include':[{'model':db[_0x22c4('0x53')],'as':_0x22c4('0x4f')},{'model':db[_0x22c4('0x53')],'as':_0x22c4('0x54')}]});}return null;})[_0x22c4('0x27')](respondWithResult(_0x9fad90,null))[_0x22c4('0x49')](handleError(_0x9fad90,null));};exports['getFields']=function(_0x232354,_0xde9f35,_0x589753){var _0x75cf87='';var _0x2e95ae=['id',_0x22c4('0x2b'),_0x22c4('0x55'),_0x22c4('0x56'),_0x22c4('0x57'),_0x22c4('0x58'),'duration_hours',_0x22c4('0x59'),_0x22c4('0x5a'),_0x22c4('0x5b'),_0x22c4('0x5c'),_0x22c4('0x5d')];return db[_0x22c4('0x2e')]['findOne']({'where':{'id':_0x232354['params']['id']},'attributes':['id',_0x22c4('0x5e'),_0x22c4('0x5f'),'remoteUri']})[_0x22c4('0x27')](handleEntityNotFound(_0xde9f35,null))[_0x22c4('0x27')](function(_0x57fad8){if(_0x57fad8){_0x75cf87=_0x57fad8['remoteUri'];var _0xbedce0=_0x75cf87['slice'](-0x1);if(_0xbedce0==='/'){_0x75cf87=_0x75cf87[_0x22c4('0x60')](0x0,_0x75cf87[_0x22c4('0x61')](_0xbedce0));}return rp({'method':_0x22c4('0x62'),'uri':util[_0x22c4('0x63')]('%s%s',_0x75cf87,_0x22c4('0x64')),'json':!![],'form':{'method':_0x22c4('0x65'),'input_type':_0x22c4('0x66'),'response_type':_0x22c4('0x66'),'rest_data':JSON[_0x22c4('0x67')]({'user_auth':{'user_name':_0x57fad8[_0x22c4('0x5e')],'password':_0x57fad8[_0x22c4('0x5f')],'encryption':'PLAIN'},'application':_0x22c4('0x68')})}});}})[_0x22c4('0x27')](function(_0xe49499){if(_0xe49499&&_0xe49499[_0x22c4('0x2b')]!=='Invalid\x20Login'&&_0xe49499[_0x22c4('0x2b')]!==_0x22c4('0x69')){return rp({'method':_0x22c4('0x62'),'uri':util[_0x22c4('0x63')](_0x22c4('0x6a'),_0x75cf87,_0x22c4('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x22c4('0x66'),'response_type':'JSON','rest_data':JSON[_0x22c4('0x67')]({'session':_0xe49499['id'],'module_name':_0x22c4('0x6b')})}})[_0x22c4('0x27')](function(_0xd56690){if(_0xd56690){var _0x2b28c4=_[_0x22c4('0x6c')](_0xd56690[_0x22c4('0x6d')]);_[_0x22c4('0x6e')](_0x2b28c4,function(_0x37e48b){return _0x2e95ae[_0x22c4('0x6f')](_0x37e48b[_0x22c4('0x2b')]);});return{'count':_0x2b28c4[_0x22c4('0x37')],'rows':_[_0x22c4('0x2d')](_0x2b28c4,function(_0x50e922){return{'id':_0x50e922[_0x22c4('0x2b')],'name':_0x50e922['label'],'custom':_[_0x22c4('0x70')](_0x50e922[_0x22c4('0x2b')],'_c')?!![]:![],'options':_0x50e922[_0x22c4('0x3f')]?_[_0x22c4('0x2d')](_[_0x22c4('0x6c')](_0x50e922[_0x22c4('0x3f')]),function(_0x640a98){return{'name':_0x640a98[_0x22c4('0x71')],'value':_0x640a98[_0x22c4('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0xde9f35,null))[_0x22c4('0x49')](function(_0x209b1d){var _0x10c7b1=_0x232354[_0x22c4('0x32')][_0x22c4('0x72')]?0x1f4:_0x209b1d['statusCode']||0x1f4;logger['error'](_0x22c4('0x73'),'getFields',_0x10c7b1,JSON[_0x22c4('0x67')](_0x209b1d));delete _0x209b1d[_0x22c4('0x2b')];if(_0x10c7b1===0x191){_0x10c7b1=0x190;}_0xde9f35[_0x22c4('0x1c')](_0x10c7b1)['send'](_0x232354[_0x22c4('0x32')]['test']?{'message':_0x22c4('0x74'),'statusCode':_0x209b1d[_0x22c4('0x75')]}:_0x209b1d);});}else{var _0xccb024=0x1f4;_0xde9f35[_0x22c4('0x1c')](_0xccb024)[_0x22c4('0x76')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 3121497..cb1f3e9 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 _0xcb03=['SugarcrmAccount','int_sugarcrm_accounts','api','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x9e92e4,_0x3094b6){var _0x36bfb2=function(_0x3b83e3){while(--_0x3b83e3){_0x9e92e4['push'](_0x9e92e4['shift']());}};_0x36bfb2(++_0x3094b6);}(_0xcb03,0x19f));var _0x3cb0=function(_0x49d68c,_0xb29af8){_0x49d68c=_0x49d68c-0x0;var _0x43f4e9=_0xcb03[_0x49d68c];return _0x43f4e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3cb0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cb0('0x1'));var rimraf=require('rimraf');var config=require(_0x3cb0('0x2'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x3cb0('0x3'));module[_0x3cb0('0x4')]=function(_0x4098fa,_0x2ec8b8){return _0x4098fa['define'](_0x3cb0('0x5'),attributes,{'tableName':_0x3cb0('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc125=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d53fa,_0x39a7d2){var _0x3366db=function(_0xcfdcc5){while(--_0xcfdcc5){_0x5d53fa['push'](_0x5d53fa['shift']());}};_0x3366db(++_0x39a7d2);}(_0xc125,0x139));var _0x5c12=function(_0x441b6e,_0x473052){_0x441b6e=_0x441b6e-0x0;var _0x2fb21f=_0xc125[_0x441b6e];return _0x2fb21f;};'use strict';var _=require(_0x5c12('0x0'));var util=require('util');var logger=require(_0x5c12('0x1'))(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var rp=require(_0x5c12('0x5'));var fs=require('fs');var path=require(_0x5c12('0x6'));var rimraf=require(_0x5c12('0x7'));var config=require(_0x5c12('0x8'));var attributes=require(_0x5c12('0x9'));var integrations=require(_0x5c12('0xa'));module[_0x5c12('0xb')]=function(_0x32be5b,_0x3dcdc4){return _0x32be5b[_0x5c12('0xc')]('SugarcrmAccount',attributes,{'tableName':_0x5c12('0xd'),'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 07a16b7..62f6db6 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 _0xee73=['options','raw','limit','include','map','attributes','model','stringify','find','where','ShowSugarcrmAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetSugarcrmAccount','SugarcrmAccount','findAll'];(function(_0x4b6cd3,_0x5154c0){var _0x4e8ec9=function(_0x86ae32){while(--_0x86ae32){_0x4b6cd3['push'](_0x4b6cd3['shift']());}};_0x4e8ec9(++_0x5154c0);}(_0xee73,0xd8));var _0x3ee7=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0xee73[_0x1fc18b];return _0x16a351;};'use strict';var _=require(_0x3ee7('0x0'));var util=require(_0x3ee7('0x1'));var moment=require('moment');var BPromise=require(_0x3ee7('0x2'));var rs=require(_0x3ee7('0x3'));var fs=require('fs');var Redis=require(_0x3ee7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ee7('0x5'));var logger=require(_0x3ee7('0x6'))('rpc');var config=require(_0x3ee7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3ee7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12ad02,_0x4e91f0,_0x3dfa8a){return new BPromise(function(_0x328b7c,_0x4714a7){return client[_0x3ee7('0x9')](_0x12ad02,_0x3dfa8a)[_0x3ee7('0xa')](function(_0x4669bd){logger[_0x3ee7('0xb')](_0x3ee7('0xc'),_0x4e91f0,_0x3ee7('0xd'));logger[_0x3ee7('0xe')](_0x3ee7('0xf'),_0x4e91f0,_0x3ee7('0xd'),JSON['stringify'](_0x4669bd));if(_0x4669bd[_0x3ee7('0x10')]){if(_0x4669bd[_0x3ee7('0x10')][_0x3ee7('0x11')]===0x1f4){logger[_0x3ee7('0x10')](_0x3ee7('0xc'),_0x4e91f0,_0x4669bd['error']['message']);return _0x4714a7(_0x4669bd['error'][_0x3ee7('0x12')]);}logger['error'](_0x3ee7('0xc'),_0x4e91f0,_0x4669bd[_0x3ee7('0x10')]['message']);return _0x328b7c(_0x4669bd[_0x3ee7('0x10')][_0x3ee7('0x12')]);}else{logger['info'](_0x3ee7('0xc'),_0x4e91f0,'request\x20sent');_0x328b7c(_0x4669bd['result'][_0x3ee7('0x12')]);}})['catch'](function(_0xc7e074){logger[_0x3ee7('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x4e91f0,_0xc7e074);_0x4714a7(_0xc7e074);});});}exports[_0x3ee7('0x13')]=function(_0x282b76){var _0x1dcbee=this;return new Promise(function(_0x3f6619,_0x1ed8e1){return db[_0x3ee7('0x14')][_0x3ee7('0x15')]({'raw':_0x282b76['options']?_0x282b76[_0x3ee7('0x16')][_0x3ee7('0x17')]===undefined?!![]:![]:!![],'where':_0x282b76[_0x3ee7('0x16')]?_0x282b76[_0x3ee7('0x16')]['where']||null:null,'attributes':_0x282b76[_0x3ee7('0x16')]?_0x282b76['options']['attributes']||null:null,'limit':_0x282b76[_0x3ee7('0x16')]?_0x282b76[_0x3ee7('0x16')][_0x3ee7('0x18')]||null:null,'include':_0x282b76[_0x3ee7('0x16')]?_0x282b76['options'][_0x3ee7('0x19')]?_['map'](_0x282b76[_0x3ee7('0x16')][_0x3ee7('0x19')],function(_0x5e7788){return{'model':db[_0x5e7788['model']],'as':_0x5e7788['as'],'attributes':_0x5e7788['attributes'],'include':_0x5e7788[_0x3ee7('0x19')]?_[_0x3ee7('0x1a')](_0x5e7788[_0x3ee7('0x19')],function(_0x5c16e1){return{'model':db[_0x5c16e1['model']],'as':_0x5c16e1['as'],'attributes':_0x5c16e1[_0x3ee7('0x1b')],'include':_0x5c16e1[_0x3ee7('0x19')]?_[_0x3ee7('0x1a')](_0x5c16e1[_0x3ee7('0x19')],function(_0x163f19){return{'model':db[_0x163f19[_0x3ee7('0x1c')]],'as':_0x163f19['as'],'attributes':_0x163f19[_0x3ee7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ee7('0xa')](function(_0x1794a7){logger['info'](_0x3ee7('0x13'),_0x282b76);logger[_0x3ee7('0xe')](_0x3ee7('0x13'),_0x282b76,JSON[_0x3ee7('0x1d')](_0x1794a7));_0x3f6619(_0x1794a7);})['catch'](function(_0x521718){logger[_0x3ee7('0x10')]('GetSugarcrmAccount',_0x521718[_0x3ee7('0x12')],_0x282b76);_0x1ed8e1(_0x1dcbee[_0x3ee7('0x10')](0x1f4,_0x521718[_0x3ee7('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x39ca0d){var _0x347c11=this;return new Promise(function(_0x1a93b3,_0x1eee52){return db[_0x3ee7('0x14')][_0x3ee7('0x1e')]({'raw':_0x39ca0d[_0x3ee7('0x16')]?_0x39ca0d[_0x3ee7('0x16')][_0x3ee7('0x17')]===undefined?!![]:![]:!![],'where':_0x39ca0d['options']?_0x39ca0d[_0x3ee7('0x16')][_0x3ee7('0x1f')]||null:null,'attributes':_0x39ca0d[_0x3ee7('0x16')]?_0x39ca0d[_0x3ee7('0x16')]['attributes']||null:null,'include':_0x39ca0d[_0x3ee7('0x16')]?_0x39ca0d['options'][_0x3ee7('0x19')]?_[_0x3ee7('0x1a')](_0x39ca0d['options'][_0x3ee7('0x19')],function(_0x248879){return{'model':db[_0x248879['model']],'as':_0x248879['as'],'attributes':_0x248879[_0x3ee7('0x1b')],'include':_0x248879[_0x3ee7('0x19')]?_[_0x3ee7('0x1a')](_0x248879['include'],function(_0xf5adae){return{'model':db[_0xf5adae['model']],'as':_0xf5adae['as'],'attributes':_0xf5adae[_0x3ee7('0x1b')],'include':_0xf5adae['include']?_[_0x3ee7('0x1a')](_0xf5adae['include'],function(_0x488193){return{'model':db[_0x488193['model']],'as':_0x488193['as'],'attributes':_0x488193['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ee7('0xa')](function(_0x556307){logger[_0x3ee7('0xb')](_0x3ee7('0x20'),_0x39ca0d);logger[_0x3ee7('0xe')](_0x3ee7('0x20'),_0x39ca0d,JSON[_0x3ee7('0x1d')](_0x556307));_0x1a93b3(_0x556307);})[_0x3ee7('0x21')](function(_0x532a42){logger[_0x3ee7('0x10')](_0x3ee7('0x20'),_0x532a42[_0x3ee7('0x12')],_0x39ca0d);_0x1eee52(_0x347c11[_0x3ee7('0x10')](0x1f4,_0x532a42[_0x3ee7('0x12')]));});});}; \ No newline at end of file +var _0xca07=['SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findAll','raw','options','limit','map','include','model','attributes','then','stringify','GetSugarcrmAccount','ShowSugarcrmAccount','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xca07,0x80));var _0x7ca0=function(_0x2729cd,_0x462966){_0x2729cd=_0x2729cd-0x0;var _0x1c259=_0xca07[_0x2729cd];return _0x1c259;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7ca0('0x0'));var BPromise=require(_0x7ca0('0x1'));var rs=require(_0x7ca0('0x2'));var fs=require('fs');var Redis=require(_0x7ca0('0x3'));var db=require(_0x7ca0('0x4'))['db'];var utils=require(_0x7ca0('0x5'));var logger=require(_0x7ca0('0x6'))('rpc');var config=require(_0x7ca0('0x7'));var jayson=require(_0x7ca0('0x8'));var client=jayson[_0x7ca0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304c3f,_0x5eb2c7,_0x410f36){return new BPromise(function(_0x3bb267,_0x14c9fc){return client[_0x7ca0('0xa')](_0x304c3f,_0x410f36)['then'](function(_0x2ccf37){logger[_0x7ca0('0xb')](_0x7ca0('0xc'),_0x5eb2c7,'request\x20sent');logger[_0x7ca0('0xd')](_0x7ca0('0xe'),_0x5eb2c7,_0x7ca0('0xf'),JSON['stringify'](_0x2ccf37));if(_0x2ccf37['error']){if(_0x2ccf37[_0x7ca0('0x10')][_0x7ca0('0x11')]===0x1f4){logger[_0x7ca0('0x10')](_0x7ca0('0xc'),_0x5eb2c7,_0x2ccf37[_0x7ca0('0x10')][_0x7ca0('0x12')]);return _0x14c9fc(_0x2ccf37[_0x7ca0('0x10')]['message']);}logger[_0x7ca0('0x10')](_0x7ca0('0xc'),_0x5eb2c7,_0x2ccf37[_0x7ca0('0x10')][_0x7ca0('0x12')]);return _0x3bb267(_0x2ccf37['error'][_0x7ca0('0x12')]);}else{logger[_0x7ca0('0xb')](_0x7ca0('0xc'),_0x5eb2c7,'request\x20sent');_0x3bb267(_0x2ccf37[_0x7ca0('0x13')][_0x7ca0('0x12')]);}})[_0x7ca0('0x14')](function(_0x5976b4){logger['error'](_0x7ca0('0xc'),_0x5eb2c7,_0x5976b4);_0x14c9fc(_0x5976b4);});});}exports['GetSugarcrmAccount']=function(_0x1d2400){var _0x136c1a=this;return new Promise(function(_0x19a5e6,_0x599453){return db['SugarcrmAccount'][_0x7ca0('0x15')]({'raw':_0x1d2400['options']?_0x1d2400['options'][_0x7ca0('0x16')]===undefined?!![]:![]:!![],'where':_0x1d2400['options']?_0x1d2400['options']['where']||null:null,'attributes':_0x1d2400[_0x7ca0('0x17')]?_0x1d2400[_0x7ca0('0x17')]['attributes']||null:null,'limit':_0x1d2400[_0x7ca0('0x17')]?_0x1d2400[_0x7ca0('0x17')][_0x7ca0('0x18')]||null:null,'include':_0x1d2400[_0x7ca0('0x17')]?_0x1d2400[_0x7ca0('0x17')]['include']?_[_0x7ca0('0x19')](_0x1d2400['options'][_0x7ca0('0x1a')],function(_0x57bad9){return{'model':db[_0x57bad9[_0x7ca0('0x1b')]],'as':_0x57bad9['as'],'attributes':_0x57bad9['attributes'],'include':_0x57bad9[_0x7ca0('0x1a')]?_[_0x7ca0('0x19')](_0x57bad9[_0x7ca0('0x1a')],function(_0x29d6f3){return{'model':db[_0x29d6f3[_0x7ca0('0x1b')]],'as':_0x29d6f3['as'],'attributes':_0x29d6f3['attributes'],'include':_0x29d6f3[_0x7ca0('0x1a')]?_[_0x7ca0('0x19')](_0x29d6f3[_0x7ca0('0x1a')],function(_0xdefe9a){return{'model':db[_0xdefe9a[_0x7ca0('0x1b')]],'as':_0xdefe9a['as'],'attributes':_0xdefe9a[_0x7ca0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ca0('0x1d')](function(_0x4c4b07){logger[_0x7ca0('0xb')]('GetSugarcrmAccount',_0x1d2400);logger[_0x7ca0('0xd')]('GetSugarcrmAccount',_0x1d2400,JSON[_0x7ca0('0x1e')](_0x4c4b07));_0x19a5e6(_0x4c4b07);})['catch'](function(_0x449f13){logger[_0x7ca0('0x10')](_0x7ca0('0x1f'),_0x449f13[_0x7ca0('0x12')],_0x1d2400);_0x599453(_0x136c1a[_0x7ca0('0x10')](0x1f4,_0x449f13[_0x7ca0('0x12')]));});});};exports[_0x7ca0('0x20')]=function(_0x46d54b){var _0x2775e9=this;return new Promise(function(_0x5ea5ef,_0x12e811){return db['SugarcrmAccount'][_0x7ca0('0x21')]({'raw':_0x46d54b['options']?_0x46d54b[_0x7ca0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46d54b['options']?_0x46d54b['options'][_0x7ca0('0x22')]||null:null,'attributes':_0x46d54b[_0x7ca0('0x17')]?_0x46d54b[_0x7ca0('0x17')][_0x7ca0('0x1c')]||null:null,'include':_0x46d54b[_0x7ca0('0x17')]?_0x46d54b['options'][_0x7ca0('0x1a')]?_['map'](_0x46d54b['options']['include'],function(_0x3d6fc5){return{'model':db[_0x3d6fc5[_0x7ca0('0x1b')]],'as':_0x3d6fc5['as'],'attributes':_0x3d6fc5[_0x7ca0('0x1c')],'include':_0x3d6fc5[_0x7ca0('0x1a')]?_['map'](_0x3d6fc5[_0x7ca0('0x1a')],function(_0x5b6c7a){return{'model':db[_0x5b6c7a[_0x7ca0('0x1b')]],'as':_0x5b6c7a['as'],'attributes':_0x5b6c7a[_0x7ca0('0x1c')],'include':_0x5b6c7a[_0x7ca0('0x1a')]?_[_0x7ca0('0x19')](_0x5b6c7a['include'],function(_0x308f5f){return{'model':db[_0x308f5f[_0x7ca0('0x1b')]],'as':_0x308f5f['as'],'attributes':_0x308f5f[_0x7ca0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c477a){logger[_0x7ca0('0xb')](_0x7ca0('0x20'),_0x46d54b);logger[_0x7ca0('0xd')](_0x7ca0('0x20'),_0x46d54b,JSON[_0x7ca0('0x1e')](_0x2c477a));_0x5ea5ef(_0x2c477a);})[_0x7ca0('0x14')](function(_0x302ed5){logger[_0x7ca0('0x10')](_0x7ca0('0x20'),_0x302ed5[_0x7ca0('0x12')],_0x46d54b);_0x12e811(_0x2775e9['error'](0x1f4,_0x302ed5['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b5c5756..05af7d9 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 _0x6312=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x3dac6c,_0x4a8a24){var _0x27c8d8=function(_0x3a1e23){while(--_0x3a1e23){_0x3dac6c['push'](_0x3dac6c['shift']());}};_0x27c8d8(++_0x4a8a24);}(_0x6312,0x10f));var _0x2631=function(_0x4b6998,_0x423b7c){_0x4b6998=_0x4b6998-0x0;var _0x3e8e40=_0x6312[_0x4b6998];return _0x3e8e40;};'use strict';var multer=require('multer');var util=require(_0x2631('0x0'));var path=require('path');var timeout=require(_0x2631('0x1'));var express=require(_0x2631('0x2'));var router=express[_0x2631('0x3')]();var fs_extra=require(_0x2631('0x4'));var auth=require(_0x2631('0x5'));var interaction=require(_0x2631('0x6'));var config=require(_0x2631('0x7'));var controller=require(_0x2631('0x8'));router[_0x2631('0x9')]('/',auth[_0x2631('0xa')](),controller[_0x2631('0xb')]);router['get'](_0x2631('0xc'),auth[_0x2631('0xa')](),controller[_0x2631('0xd')]);router[_0x2631('0x9')](_0x2631('0xe'),auth[_0x2631('0xa')](),controller[_0x2631('0xf')]);router['get']('/:id/subjects',auth[_0x2631('0xa')](),controller[_0x2631('0x10')]);router[_0x2631('0x9')]('/:id/descriptions',auth[_0x2631('0xa')](),controller[_0x2631('0x11')]);router[_0x2631('0x12')]('/',auth['isAuthenticated'](),controller[_0x2631('0x13')]);router[_0x2631('0x14')]('/:id',auth[_0x2631('0xa')](),controller['update']);router['delete'](_0x2631('0xc'),auth['isAuthenticated'](),controller[_0x2631('0x15')]);module[_0x2631('0x16')]=router; \ No newline at end of file +var _0xee5f=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x2a7de5,_0x3a9482){var _0x14b8db=function(_0x5f74f9){while(--_0x5f74f9){_0x2a7de5['push'](_0x2a7de5['shift']());}};_0x14b8db(++_0x3a9482);}(_0xee5f,0xea));var _0xfee5=function(_0x418d29,_0x1ce828){_0x418d29=_0x418d29-0x0;var _0x5b030a=_0xee5f[_0x418d29];return _0x5b030a;};'use strict';var multer=require(_0xfee5('0x0'));var util=require(_0xfee5('0x1'));var path=require(_0xfee5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfee5('0x3')]();var fs_extra=require(_0xfee5('0x4'));var auth=require(_0xfee5('0x5'));var interaction=require(_0xfee5('0x6'));var config=require(_0xfee5('0x7'));var controller=require(_0xfee5('0x8'));router[_0xfee5('0x9')]('/',auth[_0xfee5('0xa')](),controller['index']);router[_0xfee5('0x9')](_0xfee5('0xb'),auth['isAuthenticated'](),controller[_0xfee5('0xc')]);router['get'](_0xfee5('0xd'),auth[_0xfee5('0xa')](),controller[_0xfee5('0xe')]);router[_0xfee5('0x9')](_0xfee5('0xf'),auth[_0xfee5('0xa')](),controller[_0xfee5('0x10')]);router['get']('/:id/descriptions',auth[_0xfee5('0xa')](),controller[_0xfee5('0x11')]);router[_0xfee5('0x12')]('/',auth['isAuthenticated'](),controller[_0xfee5('0x13')]);router[_0xfee5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xfee5('0x15')]);router[_0xfee5('0x16')](_0xfee5('0xb'),auth[_0xfee5('0xa')](),controller[_0xfee5('0x17')]);module[_0xfee5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 04fd6bf..8b4885a 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 _0x1df4=['sequelize','exports','STRING'];(function(_0x3cdbf7,_0x47fc87){var _0x529029=function(_0x1522df){while(--_0x1522df){_0x3cdbf7['push'](_0x3cdbf7['shift']());}};_0x529029(++_0x47fc87);}(_0x1df4,0xb1));var _0x41df=function(_0x3ef3cc,_0x1658a0){_0x3ef3cc=_0x3ef3cc-0x0;var _0x378d37=_0x1df4[_0x3ef3cc];return _0x378d37;};'use strict';var Sequelize=require(_0x41df('0x0'));module[_0x41df('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x41df('0x2')]}}; \ No newline at end of file +var _0x40e0=['exports','STRING'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x40e0,0x14c));var _0x040e=function(_0x29561a,_0x34459b){_0x29561a=_0x29561a-0x0;var _0x35ef81=_0x40e0[_0x29561a];return _0x35ef81;};'use strict';var Sequelize=require('sequelize');module[_0x040e('0x0')]={'name':{'type':Sequelize[_0x040e('0x1')]},'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 8a32b30..123a72a 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 _0xcb56=['offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','keys','options','catch','create','body','find','getFields','findOne','SugarcrmField','rawAttributes','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xdad196,_0x82ecac){var _0x594247=function(_0x158bbc){while(--_0x158bbc){_0xdad196['push'](_0xdad196['shift']());}};_0x594247(++_0x82ecac);}(_0xcb56,0x1ca));var _0x6cb5=function(_0x53d709,_0x1906f6){_0x53d709=_0x53d709-0x0;var _0xc1f741=_0xcb56[_0x53d709];return _0xc1f741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cb5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cb5('0x1'));var rp=require(_0x6cb5('0x2'));var moment=require('moment');var BPromise=require(_0x6cb5('0x3'));var Mustache=require(_0x6cb5('0x4'));var util=require(_0x6cb5('0x5'));var path=require(_0x6cb5('0x6'));var sox=require(_0x6cb5('0x7'));var csv=require(_0x6cb5('0x8'));var ejs=require(_0x6cb5('0x9'));var fs=require('fs');var fs_extra=require(_0x6cb5('0xa'));var _=require(_0x6cb5('0xb'));var squel=require(_0x6cb5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6cb5('0xd'));var toCsv=require(_0x6cb5('0x8'));var querystring=require(_0x6cb5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6cb5('0xf'));var qs=require(_0x6cb5('0x10'));var as=require(_0x6cb5('0x11'));var hardwareService=require(_0x6cb5('0x12'));var logger=require(_0x6cb5('0x13'))(_0x6cb5('0x14'));var utils=require(_0x6cb5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6cb5('0x16'));var db=require(_0x6cb5('0x17'))['db'];function respondWithStatusCode(_0x2ca221,_0xba2647){_0xba2647=_0xba2647||0xcc;return function(_0xb18aa0){if(_0xb18aa0){return _0x2ca221[_0x6cb5('0x18')](_0xba2647);}return _0x2ca221[_0x6cb5('0x19')](_0xba2647)[_0x6cb5('0x1a')]();};}function respondWithResult(_0x52215f,_0x3faf57){_0x3faf57=_0x3faf57||0xc8;return function(_0x5d1efc){if(_0x5d1efc){return _0x52215f[_0x6cb5('0x19')](_0x3faf57)[_0x6cb5('0x1b')](_0x5d1efc);}};}function respondWithFilteredResult(_0x1ed1f8,_0x48e6ff){return function(_0x1ed466){if(_0x1ed466){var _0x90ec12=typeof _0x48e6ff[_0x6cb5('0x1c')]===_0x6cb5('0x1d')&&typeof _0x48e6ff[_0x6cb5('0x1e')]===_0x6cb5('0x1d');var _0x3fae1f=_0x1ed466[_0x6cb5('0x1f')];var _0x596e3e=_0x90ec12?0x0:_0x48e6ff[_0x6cb5('0x1c')];var _0x26166b=_0x90ec12?_0x1ed466[_0x6cb5('0x1f')]:_0x48e6ff[_0x6cb5('0x1c')]+_0x48e6ff[_0x6cb5('0x1e')];var _0x5dd619;if(_0x26166b>=_0x3fae1f){_0x26166b=_0x3fae1f;_0x5dd619=0xc8;}else{_0x5dd619=0xce;}_0x1ed1f8[_0x6cb5('0x19')](_0x5dd619);return _0x1ed1f8[_0x6cb5('0x20')](_0x6cb5('0x21'),_0x596e3e+'-'+_0x26166b+'/'+_0x3fae1f)[_0x6cb5('0x1b')](_0x1ed466);}return null;};}function patchUpdates(_0x4a8c03){return function(_0x32532b){try{jsonpatch['apply'](_0x32532b,_0x4a8c03,!![]);}catch(_0x50c586){return BPromise[_0x6cb5('0x22')](_0x50c586);}return _0x32532b['save']();};}function saveUpdates(_0x5738ea,_0x35cbf7){return function(_0x5ab31b){if(_0x5ab31b){return _0x5ab31b[_0x6cb5('0x23')](_0x5738ea)[_0x6cb5('0x24')](function(_0x31f078){return _0x31f078;});}return null;};}function removeEntity(_0x16d107,_0x17fabb){return function(_0x574453){if(_0x574453){return _0x574453[_0x6cb5('0x25')]()[_0x6cb5('0x24')](function(){_0x16d107['status'](0xcc)[_0x6cb5('0x1a')]();});}};}function handleEntityNotFound(_0x42e617,_0x3ebdee){return function(_0x5450dd){if(!_0x5450dd){_0x42e617[_0x6cb5('0x18')](0x194);}return _0x5450dd;};}function handleError(_0x3f1518,_0x3e4a35){_0x3e4a35=_0x3e4a35||0x1f4;return function(_0x54aab1){logger[_0x6cb5('0x26')](_0x54aab1[_0x6cb5('0x27')]);if(_0x54aab1[_0x6cb5('0x28')]){delete _0x54aab1[_0x6cb5('0x28')];}_0x3f1518[_0x6cb5('0x19')](_0x3e4a35)[_0x6cb5('0x29')](_0x54aab1);};}exports[_0x6cb5('0x2a')]=function(_0xae6565,_0x33877e){var _0x5d9ea4={},_0x2f8948={},_0xe54d9d={'count':0x0,'rows':[]};var _0x5aa126=_['map'](db[_0x6cb5('0x2b')]['rawAttributes'],function(_0x55f980){return{'name':_0x55f980[_0x6cb5('0x2c')],'type':_0x55f980[_0x6cb5('0x2d')][_0x6cb5('0x2e')]};});_0x2f8948['model']=_[_0x6cb5('0x2f')](_0x5aa126,_0x6cb5('0x28'));_0x2f8948['query']=_['keys'](_0xae6565[_0x6cb5('0x30')]);_0x2f8948[_0x6cb5('0x31')]=_[_0x6cb5('0x32')](_0x2f8948[_0x6cb5('0x33')],_0x2f8948['query']);_0x5d9ea4[_0x6cb5('0x34')]=_[_0x6cb5('0x32')](_0x2f8948[_0x6cb5('0x33')],qs[_0x6cb5('0x35')](_0xae6565[_0x6cb5('0x30')][_0x6cb5('0x35')]));_0x5d9ea4['attributes']=_0x5d9ea4[_0x6cb5('0x34')][_0x6cb5('0x36')]?_0x5d9ea4[_0x6cb5('0x34')]:_0x2f8948[_0x6cb5('0x33')];if(!_0xae6565[_0x6cb5('0x30')][_0x6cb5('0x37')]('nolimit')){_0x5d9ea4[_0x6cb5('0x1e')]=qs['limit'](_0xae6565[_0x6cb5('0x30')][_0x6cb5('0x1e')]);_0x5d9ea4['offset']=qs['offset'](_0xae6565[_0x6cb5('0x30')]['offset']);}_0x5d9ea4[_0x6cb5('0x38')]=qs['sort'](_0xae6565[_0x6cb5('0x30')][_0x6cb5('0x39')]);_0x5d9ea4['where']=qs[_0x6cb5('0x31')](_[_0x6cb5('0x3a')](_0xae6565[_0x6cb5('0x30')],_0x2f8948[_0x6cb5('0x31')]),_0x5aa126);if(_0xae6565['query'][_0x6cb5('0x3b')]){_0x5d9ea4['where']=_[_0x6cb5('0x3c')](_0x5d9ea4[_0x6cb5('0x3d')],{'$or':_[_0x6cb5('0x2f')](_0x5aa126,function(_0x3cefcc){if(_0x3cefcc[_0x6cb5('0x2d')]!==_0x6cb5('0x3e')){var _0x9a6cb9={};_0x9a6cb9[_0x3cefcc['name']]={'$like':'%'+_0xae6565[_0x6cb5('0x30')][_0x6cb5('0x3b')]+'%'};return _0x9a6cb9;}})});}_0x5d9ea4=_[_0x6cb5('0x3c')]({},_0x5d9ea4,_0xae6565['options']);var _0x2e3780={'where':_0x5d9ea4['where']};return db[_0x6cb5('0x2b')][_0x6cb5('0x1f')](_0x2e3780)[_0x6cb5('0x24')](function(_0x463497){_0xe54d9d['count']=_0x463497;if(_0xae6565['query'][_0x6cb5('0x3f')]){_0x5d9ea4[_0x6cb5('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x6cb5('0x41')](_0x5d9ea4);})[_0x6cb5('0x24')](function(_0x57878a){_0xe54d9d['rows']=_0x57878a;return _0xe54d9d;})[_0x6cb5('0x24')](respondWithFilteredResult(_0x33877e,_0x5d9ea4))['catch'](handleError(_0x33877e,null));};exports[_0x6cb5('0x42')]=function(_0x18360a,_0x190bad){var _0x21ab7a={'raw':![],'where':{'id':_0x18360a[_0x6cb5('0x43')]['id']}},_0x4f86d7={};_0x4f86d7['model']=_[_0x6cb5('0x44')](db[_0x6cb5('0x2b')]['rawAttributes']);_0x4f86d7[_0x6cb5('0x30')]=_[_0x6cb5('0x44')](_0x18360a[_0x6cb5('0x30')]);_0x4f86d7[_0x6cb5('0x31')]=_[_0x6cb5('0x32')](_0x4f86d7[_0x6cb5('0x33')],_0x4f86d7[_0x6cb5('0x30')]);_0x21ab7a[_0x6cb5('0x34')]=_['intersection'](_0x4f86d7[_0x6cb5('0x33')],qs[_0x6cb5('0x35')](_0x18360a[_0x6cb5('0x30')]['fields']));_0x21ab7a[_0x6cb5('0x34')]=_0x21ab7a['attributes']['length']?_0x21ab7a[_0x6cb5('0x34')]:_0x4f86d7['model'];if(_0x18360a[_0x6cb5('0x30')][_0x6cb5('0x3f')]){_0x21ab7a['include']=[{'all':!![]}];}_0x21ab7a=_[_0x6cb5('0x3c')]({},_0x21ab7a,_0x18360a[_0x6cb5('0x45')]);return db['SugarcrmConfiguration']['find'](_0x21ab7a)['then'](handleEntityNotFound(_0x190bad,null))[_0x6cb5('0x24')](respondWithResult(_0x190bad,null))[_0x6cb5('0x46')](handleError(_0x190bad,null));};exports[_0x6cb5('0x47')]=function(_0x5e7f33,_0x352c0b){return db[_0x6cb5('0x2b')][_0x6cb5('0x47')](_0x5e7f33['body'],{})[_0x6cb5('0x24')](respondWithResult(_0x352c0b,0xc9))['catch'](handleError(_0x352c0b,null));};exports[_0x6cb5('0x23')]=function(_0x552ee3,_0x28cbc9){if(_0x552ee3[_0x6cb5('0x48')]['id']){delete _0x552ee3[_0x6cb5('0x48')]['id'];}return db[_0x6cb5('0x2b')][_0x6cb5('0x49')]({'where':{'id':_0x552ee3[_0x6cb5('0x43')]['id']}})[_0x6cb5('0x24')](handleEntityNotFound(_0x28cbc9,null))[_0x6cb5('0x24')](saveUpdates(_0x552ee3['body'],null))[_0x6cb5('0x24')](respondWithResult(_0x28cbc9,null))[_0x6cb5('0x46')](handleError(_0x28cbc9,null));};exports[_0x6cb5('0x25')]=function(_0x304610,_0x22116e){return db[_0x6cb5('0x2b')][_0x6cb5('0x49')]({'where':{'id':_0x304610['params']['id']}})[_0x6cb5('0x24')](handleEntityNotFound(_0x22116e,null))[_0x6cb5('0x24')](removeEntity(_0x22116e,null))['catch'](handleError(_0x22116e,null));};exports[_0x6cb5('0x4a')]=function(_0x2fb212,_0x28f9d8,_0x26753b){var _0x4c4ca2={};var _0x4de7c5={};var _0x287dfa;var _0x5bb545;return db[_0x6cb5('0x2b')][_0x6cb5('0x4b')]({'where':{'id':_0x2fb212[_0x6cb5('0x43')]['id']}})[_0x6cb5('0x24')](handleEntityNotFound(_0x28f9d8,null))[_0x6cb5('0x24')](function(_0x2ebd54){if(_0x2ebd54){_0x287dfa=_0x2ebd54;_0x4de7c5['model']=_[_0x6cb5('0x44')](db[_0x6cb5('0x4c')][_0x6cb5('0x4d')]);_0x4de7c5[_0x6cb5('0x30')]=_[_0x6cb5('0x44')](_0x2fb212[_0x6cb5('0x30')]);_0x4de7c5['filters']=_['intersection'](_0x4de7c5[_0x6cb5('0x33')],_0x4de7c5[_0x6cb5('0x30')]);_0x4c4ca2['attributes']=_[_0x6cb5('0x32')](_0x4de7c5[_0x6cb5('0x33')],qs[_0x6cb5('0x35')](_0x2fb212['query'][_0x6cb5('0x35')]));_0x4c4ca2[_0x6cb5('0x34')]=_0x4c4ca2['attributes'][_0x6cb5('0x36')]?_0x4c4ca2['attributes']:_0x4de7c5['model'];_0x4c4ca2['order']=qs[_0x6cb5('0x39')](_0x2fb212[_0x6cb5('0x30')][_0x6cb5('0x39')]);_0x4c4ca2[_0x6cb5('0x3d')]=qs[_0x6cb5('0x31')](_[_0x6cb5('0x3a')](_0x2fb212[_0x6cb5('0x30')],_0x4de7c5['filters']));if(_0x2fb212['query'][_0x6cb5('0x3b')]){_0x4c4ca2[_0x6cb5('0x3d')]=_[_0x6cb5('0x3c')](_0x4c4ca2[_0x6cb5('0x3d')],{'$or':_[_0x6cb5('0x2f')](_0x4c4ca2[_0x6cb5('0x34')],function(_0x2318d6){var _0x4bce98={};_0x4bce98[_0x2318d6]={'$like':'%'+_0x2fb212[_0x6cb5('0x30')][_0x6cb5('0x3b')]+'%'};return _0x4bce98;})});}_0x4c4ca2=_[_0x6cb5('0x3c')]({},_0x4c4ca2,_0x2fb212[_0x6cb5('0x45')]);return _0x287dfa[_0x6cb5('0x4a')](_0x4c4ca2);}})[_0x6cb5('0x24')](function(_0x56f677){if(_0x56f677){_0x5bb545=_0x56f677[_0x6cb5('0x36')];if(!_0x2fb212[_0x6cb5('0x30')][_0x6cb5('0x37')](_0x6cb5('0x4e'))){_0x4c4ca2['limit']=qs[_0x6cb5('0x1e')](_0x2fb212[_0x6cb5('0x30')][_0x6cb5('0x1e')]);_0x4c4ca2[_0x6cb5('0x1c')]=qs['offset'](_0x2fb212['query'][_0x6cb5('0x1c')]);}return _0x287dfa['getFields'](_0x4c4ca2);}})[_0x6cb5('0x24')](function(_0x932d99){if(_0x932d99){return _0x932d99?{'count':_0x5bb545,'rows':_0x932d99}:null;}})[_0x6cb5('0x24')](respondWithResult(_0x28f9d8,null))[_0x6cb5('0x46')](handleError(_0x28f9d8,null));};exports[_0x6cb5('0x4f')]=function(_0x35add4,_0x5cf2c7,_0x41168f){var _0xe75a0c={};var _0x568ebb={};var _0x414437;var _0x51f7d5;return db[_0x6cb5('0x2b')]['findOne']({'where':{'id':_0x35add4[_0x6cb5('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cf2c7,null))[_0x6cb5('0x24')](function(_0x4abc97){if(_0x4abc97){_0x414437=_0x4abc97;_0x568ebb[_0x6cb5('0x33')]=_[_0x6cb5('0x44')](db[_0x6cb5('0x4c')][_0x6cb5('0x4d')]);_0x568ebb[_0x6cb5('0x30')]=_[_0x6cb5('0x44')](_0x35add4['query']);_0x568ebb[_0x6cb5('0x31')]=_[_0x6cb5('0x32')](_0x568ebb['model'],_0x568ebb[_0x6cb5('0x30')]);_0xe75a0c[_0x6cb5('0x34')]=_['intersection'](_0x568ebb[_0x6cb5('0x33')],qs['fields'](_0x35add4['query']['fields']));_0xe75a0c['attributes']=_0xe75a0c[_0x6cb5('0x34')][_0x6cb5('0x36')]?_0xe75a0c['attributes']:_0x568ebb[_0x6cb5('0x33')];_0xe75a0c[_0x6cb5('0x38')]=qs[_0x6cb5('0x39')](_0x35add4[_0x6cb5('0x30')][_0x6cb5('0x39')]);_0xe75a0c[_0x6cb5('0x3d')]=qs[_0x6cb5('0x31')](_['pick'](_0x35add4[_0x6cb5('0x30')],_0x568ebb[_0x6cb5('0x31')]));if(_0x35add4[_0x6cb5('0x30')][_0x6cb5('0x3b')]){_0xe75a0c['where']=_[_0x6cb5('0x3c')](_0xe75a0c[_0x6cb5('0x3d')],{'$or':_[_0x6cb5('0x2f')](_0xe75a0c[_0x6cb5('0x34')],function(_0x51090d){var _0x1a692c={};_0x1a692c[_0x51090d]={'$like':'%'+_0x35add4['query']['filter']+'%'};return _0x1a692c;})});}_0xe75a0c=_[_0x6cb5('0x3c')]({},_0xe75a0c,_0x35add4[_0x6cb5('0x45')]);return _0x414437[_0x6cb5('0x4f')](_0xe75a0c);}})[_0x6cb5('0x24')](function(_0x1eb021){if(_0x1eb021){_0x51f7d5=_0x1eb021[_0x6cb5('0x36')];if(!_0x35add4['query'][_0x6cb5('0x37')](_0x6cb5('0x4e'))){_0xe75a0c[_0x6cb5('0x1e')]=qs[_0x6cb5('0x1e')](_0x35add4['query']['limit']);_0xe75a0c['offset']=qs[_0x6cb5('0x1c')](_0x35add4[_0x6cb5('0x30')][_0x6cb5('0x1c')]);}return _0x414437[_0x6cb5('0x4f')](_0xe75a0c);}})[_0x6cb5('0x24')](function(_0x267c81){if(_0x267c81){return _0x267c81?{'count':_0x51f7d5,'rows':_0x267c81}:null;}})[_0x6cb5('0x24')](respondWithResult(_0x5cf2c7,null))['catch'](handleError(_0x5cf2c7,null));};exports['getDescriptions']=function(_0x297877,_0x18bdfc,_0x309359){var _0x3944c9={};var _0x114efc={};var _0x579744;var _0x5cc529;return db[_0x6cb5('0x2b')]['findOne']({'where':{'id':_0x297877[_0x6cb5('0x43')]['id']}})[_0x6cb5('0x24')](handleEntityNotFound(_0x18bdfc,null))['then'](function(_0x376b3f){if(_0x376b3f){_0x579744=_0x376b3f;_0x114efc[_0x6cb5('0x33')]=_['keys'](db[_0x6cb5('0x4c')][_0x6cb5('0x4d')]);_0x114efc['query']=_[_0x6cb5('0x44')](_0x297877[_0x6cb5('0x30')]);_0x114efc[_0x6cb5('0x31')]=_[_0x6cb5('0x32')](_0x114efc[_0x6cb5('0x33')],_0x114efc['query']);_0x3944c9['attributes']=_[_0x6cb5('0x32')](_0x114efc[_0x6cb5('0x33')],qs[_0x6cb5('0x35')](_0x297877['query'][_0x6cb5('0x35')]));_0x3944c9[_0x6cb5('0x34')]=_0x3944c9['attributes'][_0x6cb5('0x36')]?_0x3944c9[_0x6cb5('0x34')]:_0x114efc['model'];_0x3944c9['order']=qs['sort'](_0x297877[_0x6cb5('0x30')][_0x6cb5('0x39')]);_0x3944c9[_0x6cb5('0x3d')]=qs[_0x6cb5('0x31')](_[_0x6cb5('0x3a')](_0x297877[_0x6cb5('0x30')],_0x114efc[_0x6cb5('0x31')]));if(_0x297877[_0x6cb5('0x30')]['filter']){_0x3944c9[_0x6cb5('0x3d')]=_[_0x6cb5('0x3c')](_0x3944c9[_0x6cb5('0x3d')],{'$or':_[_0x6cb5('0x2f')](_0x3944c9[_0x6cb5('0x34')],function(_0x39ee89){var _0x5e26cb={};_0x5e26cb[_0x39ee89]={'$like':'%'+_0x297877[_0x6cb5('0x30')][_0x6cb5('0x3b')]+'%'};return _0x5e26cb;})});}_0x3944c9=_[_0x6cb5('0x3c')]({},_0x3944c9,_0x297877[_0x6cb5('0x45')]);return _0x579744[_0x6cb5('0x50')](_0x3944c9);}})[_0x6cb5('0x24')](function(_0x5435e2){if(_0x5435e2){_0x5cc529=_0x5435e2[_0x6cb5('0x36')];if(!_0x297877[_0x6cb5('0x30')][_0x6cb5('0x37')]('nolimit')){_0x3944c9[_0x6cb5('0x1e')]=qs['limit'](_0x297877[_0x6cb5('0x30')][_0x6cb5('0x1e')]);_0x3944c9[_0x6cb5('0x1c')]=qs['offset'](_0x297877[_0x6cb5('0x30')][_0x6cb5('0x1c')]);}return _0x579744[_0x6cb5('0x50')](_0x3944c9);}})['then'](function(_0x1f37f7){if(_0x1f37f7){return _0x1f37f7?{'count':_0x5cc529,'rows':_0x1f37f7}:null;}})[_0x6cb5('0x24')](respondWithResult(_0x18bdfc,null))['catch'](handleError(_0x18bdfc,null));}; \ No newline at end of file +var _0x49ae=['body','find','getFields','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','keys','create'];(function(_0x3b1256,_0x11c3c9){var _0x55b7ae=function(_0x43e14e){while(--_0x43e14e){_0x3b1256['push'](_0x3b1256['shift']());}};_0x55b7ae(++_0x11c3c9);}(_0x49ae,0x1c2));var _0xe49a=function(_0x124691,_0x36c9c7){_0x124691=_0x124691-0x0;var _0x17e141=_0x49ae[_0x124691];return _0x17e141;};'use strict';var emlformat=require(_0xe49a('0x0'));var rimraf=require(_0xe49a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49a('0x2'));var moment=require('moment');var BPromise=require(_0xe49a('0x3'));var Mustache=require('mustache');var util=require(_0xe49a('0x4'));var path=require(_0xe49a('0x5'));var sox=require(_0xe49a('0x6'));var csv=require(_0xe49a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe49a('0x8'));var _=require('lodash');var squel=require(_0xe49a('0x9'));var crypto=require(_0xe49a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe49a('0x7'));var querystring=require(_0xe49a('0xb'));var Papa=require(_0xe49a('0xc'));var Redis=require(_0xe49a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe49a('0xe'));var hardwareService=require(_0xe49a('0xf'));var logger=require('../../config/logger')(_0xe49a('0x10'));var utils=require(_0xe49a('0x11'));var config=require(_0xe49a('0x12'));var licenseUtil=require(_0xe49a('0x13'));var db=require(_0xe49a('0x14'))['db'];function respondWithStatusCode(_0x40f2cd,_0x3a5f79){_0x3a5f79=_0x3a5f79||0xcc;return function(_0x397c59){if(_0x397c59){return _0x40f2cd['sendStatus'](_0x3a5f79);}return _0x40f2cd[_0xe49a('0x15')](_0x3a5f79)['end']();};}function respondWithResult(_0x46c860,_0x8cc87){_0x8cc87=_0x8cc87||0xc8;return function(_0xe3b4be){if(_0xe3b4be){return _0x46c860[_0xe49a('0x15')](_0x8cc87)[_0xe49a('0x16')](_0xe3b4be);}};}function respondWithFilteredResult(_0x21753c,_0x7eabcb){return function(_0x234ed6){if(_0x234ed6){var _0x17b7ef=typeof _0x7eabcb['offset']===_0xe49a('0x17')&&typeof _0x7eabcb[_0xe49a('0x18')]===_0xe49a('0x17');var _0x4bf8e0=_0x234ed6[_0xe49a('0x19')];var _0x344ea0=_0x17b7ef?0x0:_0x7eabcb['offset'];var _0xbd0684=_0x17b7ef?_0x234ed6[_0xe49a('0x19')]:_0x7eabcb['offset']+_0x7eabcb[_0xe49a('0x18')];var _0x5c6114;if(_0xbd0684>=_0x4bf8e0){_0xbd0684=_0x4bf8e0;_0x5c6114=0xc8;}else{_0x5c6114=0xce;}_0x21753c[_0xe49a('0x15')](_0x5c6114);return _0x21753c[_0xe49a('0x1a')]('Content-Range',_0x344ea0+'-'+_0xbd0684+'/'+_0x4bf8e0)[_0xe49a('0x16')](_0x234ed6);}return null;};}function patchUpdates(_0xf028ad){return function(_0x27177b){try{jsonpatch[_0xe49a('0x1b')](_0x27177b,_0xf028ad,!![]);}catch(_0x2b214f){return BPromise[_0xe49a('0x1c')](_0x2b214f);}return _0x27177b[_0xe49a('0x1d')]();};}function saveUpdates(_0x17266d,_0x3d945a){return function(_0x154779){if(_0x154779){return _0x154779[_0xe49a('0x1e')](_0x17266d)[_0xe49a('0x1f')](function(_0x2e41a2){return _0x2e41a2;});}return null;};}function removeEntity(_0x5bb5e2,_0x5a07fa){return function(_0x142669){if(_0x142669){return _0x142669[_0xe49a('0x20')]()[_0xe49a('0x1f')](function(){_0x5bb5e2['status'](0xcc)[_0xe49a('0x21')]();});}};}function handleEntityNotFound(_0x472f8e,_0x18c14d){return function(_0x66c041){if(!_0x66c041){_0x472f8e[_0xe49a('0x22')](0x194);}return _0x66c041;};}function handleError(_0x5af118,_0xb266d0){_0xb266d0=_0xb266d0||0x1f4;return function(_0x5d1412){logger['error'](_0x5d1412[_0xe49a('0x23')]);if(_0x5d1412[_0xe49a('0x24')]){delete _0x5d1412['name'];}_0x5af118['status'](_0xb266d0)[_0xe49a('0x25')](_0x5d1412);};}exports[_0xe49a('0x26')]=function(_0x42f5bb,_0x5bb94f){var _0x26fbdf={},_0x3d531a={},_0x21a35e={'count':0x0,'rows':[]};var _0x358800=_[_0xe49a('0x27')](db[_0xe49a('0x28')][_0xe49a('0x29')],function(_0x3c4338){return{'name':_0x3c4338[_0xe49a('0x2a')],'type':_0x3c4338['type']['key']};});_0x3d531a[_0xe49a('0x2b')]=_[_0xe49a('0x27')](_0x358800,_0xe49a('0x24'));_0x3d531a['query']=_['keys'](_0x42f5bb[_0xe49a('0x2c')]);_0x3d531a[_0xe49a('0x2d')]=_['intersection'](_0x3d531a['model'],_0x3d531a[_0xe49a('0x2c')]);_0x26fbdf['attributes']=_[_0xe49a('0x2e')](_0x3d531a[_0xe49a('0x2b')],qs[_0xe49a('0x2f')](_0x42f5bb[_0xe49a('0x2c')][_0xe49a('0x2f')]));_0x26fbdf[_0xe49a('0x30')]=_0x26fbdf[_0xe49a('0x30')][_0xe49a('0x31')]?_0x26fbdf[_0xe49a('0x30')]:_0x3d531a['model'];if(!_0x42f5bb['query'][_0xe49a('0x32')](_0xe49a('0x33'))){_0x26fbdf[_0xe49a('0x18')]=qs[_0xe49a('0x18')](_0x42f5bb['query'][_0xe49a('0x18')]);_0x26fbdf[_0xe49a('0x34')]=qs['offset'](_0x42f5bb['query']['offset']);}_0x26fbdf[_0xe49a('0x35')]=qs[_0xe49a('0x36')](_0x42f5bb[_0xe49a('0x2c')][_0xe49a('0x36')]);_0x26fbdf[_0xe49a('0x37')]=qs[_0xe49a('0x2d')](_[_0xe49a('0x38')](_0x42f5bb[_0xe49a('0x2c')],_0x3d531a[_0xe49a('0x2d')]),_0x358800);if(_0x42f5bb['query']['filter']){_0x26fbdf['where']=_['merge'](_0x26fbdf[_0xe49a('0x37')],{'$or':_[_0xe49a('0x27')](_0x358800,function(_0x26175b){if(_0x26175b['type']!==_0xe49a('0x39')){var _0x46c59a={};_0x46c59a[_0x26175b['name']]={'$like':'%'+_0x42f5bb[_0xe49a('0x2c')][_0xe49a('0x3a')]+'%'};return _0x46c59a;}})});}_0x26fbdf=_[_0xe49a('0x3b')]({},_0x26fbdf,_0x42f5bb[_0xe49a('0x3c')]);var _0x3ccc62={'where':_0x26fbdf[_0xe49a('0x37')]};return db['SugarcrmConfiguration']['count'](_0x3ccc62)[_0xe49a('0x1f')](function(_0x2906f1){_0x21a35e[_0xe49a('0x19')]=_0x2906f1;if(_0x42f5bb['query'][_0xe49a('0x3d')]){_0x26fbdf[_0xe49a('0x3e')]=[{'all':!![]}];}return db[_0xe49a('0x28')]['findAll'](_0x26fbdf);})[_0xe49a('0x1f')](function(_0x30f574){_0x21a35e['rows']=_0x30f574;return _0x21a35e;})[_0xe49a('0x1f')](respondWithFilteredResult(_0x5bb94f,_0x26fbdf))[_0xe49a('0x3f')](handleError(_0x5bb94f,null));};exports[_0xe49a('0x40')]=function(_0xba6322,_0x5b065c){var _0x16a91e={'raw':![],'where':{'id':_0xba6322[_0xe49a('0x41')]['id']}},_0x213bc8={};_0x213bc8[_0xe49a('0x2b')]=_[_0xe49a('0x42')](db[_0xe49a('0x28')]['rawAttributes']);_0x213bc8[_0xe49a('0x2c')]=_[_0xe49a('0x42')](_0xba6322[_0xe49a('0x2c')]);_0x213bc8[_0xe49a('0x2d')]=_[_0xe49a('0x2e')](_0x213bc8[_0xe49a('0x2b')],_0x213bc8[_0xe49a('0x2c')]);_0x16a91e[_0xe49a('0x30')]=_[_0xe49a('0x2e')](_0x213bc8[_0xe49a('0x2b')],qs['fields'](_0xba6322[_0xe49a('0x2c')][_0xe49a('0x2f')]));_0x16a91e[_0xe49a('0x30')]=_0x16a91e[_0xe49a('0x30')]['length']?_0x16a91e['attributes']:_0x213bc8[_0xe49a('0x2b')];if(_0xba6322[_0xe49a('0x2c')][_0xe49a('0x3d')]){_0x16a91e[_0xe49a('0x3e')]=[{'all':!![]}];}_0x16a91e=_[_0xe49a('0x3b')]({},_0x16a91e,_0xba6322[_0xe49a('0x3c')]);return db[_0xe49a('0x28')]['find'](_0x16a91e)[_0xe49a('0x1f')](handleEntityNotFound(_0x5b065c,null))[_0xe49a('0x1f')](respondWithResult(_0x5b065c,null))[_0xe49a('0x3f')](handleError(_0x5b065c,null));};exports['create']=function(_0x4b711a,_0x5ca8aa){return db[_0xe49a('0x28')][_0xe49a('0x43')](_0x4b711a['body'],{})['then'](respondWithResult(_0x5ca8aa,0xc9))[_0xe49a('0x3f')](handleError(_0x5ca8aa,null));};exports['update']=function(_0x51b0cf,_0x276863){if(_0x51b0cf[_0xe49a('0x44')]['id']){delete _0x51b0cf[_0xe49a('0x44')]['id'];}return db['SugarcrmConfiguration'][_0xe49a('0x45')]({'where':{'id':_0x51b0cf[_0xe49a('0x41')]['id']}})[_0xe49a('0x1f')](handleEntityNotFound(_0x276863,null))[_0xe49a('0x1f')](saveUpdates(_0x51b0cf[_0xe49a('0x44')],null))[_0xe49a('0x1f')](respondWithResult(_0x276863,null))[_0xe49a('0x3f')](handleError(_0x276863,null));};exports[_0xe49a('0x20')]=function(_0x3595ea,_0x267cf0){return db[_0xe49a('0x28')]['find']({'where':{'id':_0x3595ea['params']['id']}})['then'](handleEntityNotFound(_0x267cf0,null))[_0xe49a('0x1f')](removeEntity(_0x267cf0,null))['catch'](handleError(_0x267cf0,null));};exports[_0xe49a('0x46')]=function(_0x4e3306,_0x88f53a,_0x5b4621){var _0x2cacfb={};var _0x5dc52c={};var _0x203c86;var _0x35673c;return db[_0xe49a('0x28')][_0xe49a('0x47')]({'where':{'id':_0x4e3306[_0xe49a('0x41')]['id']}})[_0xe49a('0x1f')](handleEntityNotFound(_0x88f53a,null))['then'](function(_0x2d1506){if(_0x2d1506){_0x203c86=_0x2d1506;_0x5dc52c['model']=_[_0xe49a('0x42')](db[_0xe49a('0x48')][_0xe49a('0x29')]);_0x5dc52c[_0xe49a('0x2c')]=_['keys'](_0x4e3306[_0xe49a('0x2c')]);_0x5dc52c[_0xe49a('0x2d')]=_[_0xe49a('0x2e')](_0x5dc52c['model'],_0x5dc52c[_0xe49a('0x2c')]);_0x2cacfb[_0xe49a('0x30')]=_[_0xe49a('0x2e')](_0x5dc52c['model'],qs[_0xe49a('0x2f')](_0x4e3306[_0xe49a('0x2c')][_0xe49a('0x2f')]));_0x2cacfb[_0xe49a('0x30')]=_0x2cacfb['attributes'][_0xe49a('0x31')]?_0x2cacfb[_0xe49a('0x30')]:_0x5dc52c[_0xe49a('0x2b')];_0x2cacfb[_0xe49a('0x35')]=qs[_0xe49a('0x36')](_0x4e3306[_0xe49a('0x2c')][_0xe49a('0x36')]);_0x2cacfb['where']=qs[_0xe49a('0x2d')](_[_0xe49a('0x38')](_0x4e3306[_0xe49a('0x2c')],_0x5dc52c[_0xe49a('0x2d')]));if(_0x4e3306['query']['filter']){_0x2cacfb[_0xe49a('0x37')]=_[_0xe49a('0x3b')](_0x2cacfb[_0xe49a('0x37')],{'$or':_['map'](_0x2cacfb['attributes'],function(_0x5adf24){var _0x21b734={};_0x21b734[_0x5adf24]={'$like':'%'+_0x4e3306['query'][_0xe49a('0x3a')]+'%'};return _0x21b734;})});}_0x2cacfb=_['merge']({},_0x2cacfb,_0x4e3306[_0xe49a('0x3c')]);return _0x203c86[_0xe49a('0x46')](_0x2cacfb);}})[_0xe49a('0x1f')](function(_0x42f244){if(_0x42f244){_0x35673c=_0x42f244[_0xe49a('0x31')];if(!_0x4e3306[_0xe49a('0x2c')]['hasOwnProperty'](_0xe49a('0x33'))){_0x2cacfb['limit']=qs[_0xe49a('0x18')](_0x4e3306[_0xe49a('0x2c')][_0xe49a('0x18')]);_0x2cacfb[_0xe49a('0x34')]=qs[_0xe49a('0x34')](_0x4e3306['query'][_0xe49a('0x34')]);}return _0x203c86[_0xe49a('0x46')](_0x2cacfb);}})['then'](function(_0x243e80){if(_0x243e80){return _0x243e80?{'count':_0x35673c,'rows':_0x243e80}:null;}})[_0xe49a('0x1f')](respondWithResult(_0x88f53a,null))['catch'](handleError(_0x88f53a,null));};exports['getSubjects']=function(_0x27f342,_0x236431,_0x383c44){var _0x59423b={};var _0xe75484={};var _0xab35ef;var _0xa92cd2;return db[_0xe49a('0x28')]['findOne']({'where':{'id':_0x27f342[_0xe49a('0x41')]['id']}})['then'](handleEntityNotFound(_0x236431,null))[_0xe49a('0x1f')](function(_0xe70ec0){if(_0xe70ec0){_0xab35ef=_0xe70ec0;_0xe75484[_0xe49a('0x2b')]=_[_0xe49a('0x42')](db['SugarcrmField'][_0xe49a('0x29')]);_0xe75484[_0xe49a('0x2c')]=_['keys'](_0x27f342[_0xe49a('0x2c')]);_0xe75484['filters']=_[_0xe49a('0x2e')](_0xe75484[_0xe49a('0x2b')],_0xe75484[_0xe49a('0x2c')]);_0x59423b[_0xe49a('0x30')]=_[_0xe49a('0x2e')](_0xe75484['model'],qs[_0xe49a('0x2f')](_0x27f342[_0xe49a('0x2c')][_0xe49a('0x2f')]));_0x59423b[_0xe49a('0x30')]=_0x59423b[_0xe49a('0x30')][_0xe49a('0x31')]?_0x59423b[_0xe49a('0x30')]:_0xe75484[_0xe49a('0x2b')];_0x59423b[_0xe49a('0x35')]=qs['sort'](_0x27f342[_0xe49a('0x2c')][_0xe49a('0x36')]);_0x59423b[_0xe49a('0x37')]=qs[_0xe49a('0x2d')](_[_0xe49a('0x38')](_0x27f342[_0xe49a('0x2c')],_0xe75484[_0xe49a('0x2d')]));if(_0x27f342['query'][_0xe49a('0x3a')]){_0x59423b[_0xe49a('0x37')]=_[_0xe49a('0x3b')](_0x59423b[_0xe49a('0x37')],{'$or':_[_0xe49a('0x27')](_0x59423b[_0xe49a('0x30')],function(_0x251eec){var _0x52b033={};_0x52b033[_0x251eec]={'$like':'%'+_0x27f342['query']['filter']+'%'};return _0x52b033;})});}_0x59423b=_[_0xe49a('0x3b')]({},_0x59423b,_0x27f342[_0xe49a('0x3c')]);return _0xab35ef['getSubjects'](_0x59423b);}})['then'](function(_0x14428a){if(_0x14428a){_0xa92cd2=_0x14428a['length'];if(!_0x27f342[_0xe49a('0x2c')][_0xe49a('0x32')](_0xe49a('0x33'))){_0x59423b[_0xe49a('0x18')]=qs[_0xe49a('0x18')](_0x27f342[_0xe49a('0x2c')]['limit']);_0x59423b[_0xe49a('0x34')]=qs[_0xe49a('0x34')](_0x27f342['query'][_0xe49a('0x34')]);}return _0xab35ef['getSubjects'](_0x59423b);}})[_0xe49a('0x1f')](function(_0x49efc6){if(_0x49efc6){return _0x49efc6?{'count':_0xa92cd2,'rows':_0x49efc6}:null;}})[_0xe49a('0x1f')](respondWithResult(_0x236431,null))['catch'](handleError(_0x236431,null));};exports['getDescriptions']=function(_0x1f6ac3,_0x69a7f9,_0x315cc4){var _0x270457={};var _0x47bb1e={};var _0x343bca;var _0x48bb18;return db[_0xe49a('0x28')][_0xe49a('0x47')]({'where':{'id':_0x1f6ac3[_0xe49a('0x41')]['id']}})[_0xe49a('0x1f')](handleEntityNotFound(_0x69a7f9,null))[_0xe49a('0x1f')](function(_0xd42ae0){if(_0xd42ae0){_0x343bca=_0xd42ae0;_0x47bb1e[_0xe49a('0x2b')]=_[_0xe49a('0x42')](db[_0xe49a('0x48')][_0xe49a('0x29')]);_0x47bb1e[_0xe49a('0x2c')]=_[_0xe49a('0x42')](_0x1f6ac3[_0xe49a('0x2c')]);_0x47bb1e[_0xe49a('0x2d')]=_['intersection'](_0x47bb1e['model'],_0x47bb1e[_0xe49a('0x2c')]);_0x270457[_0xe49a('0x30')]=_[_0xe49a('0x2e')](_0x47bb1e[_0xe49a('0x2b')],qs[_0xe49a('0x2f')](_0x1f6ac3['query'][_0xe49a('0x2f')]));_0x270457['attributes']=_0x270457[_0xe49a('0x30')][_0xe49a('0x31')]?_0x270457[_0xe49a('0x30')]:_0x47bb1e[_0xe49a('0x2b')];_0x270457[_0xe49a('0x35')]=qs[_0xe49a('0x36')](_0x1f6ac3[_0xe49a('0x2c')][_0xe49a('0x36')]);_0x270457[_0xe49a('0x37')]=qs[_0xe49a('0x2d')](_['pick'](_0x1f6ac3[_0xe49a('0x2c')],_0x47bb1e[_0xe49a('0x2d')]));if(_0x1f6ac3[_0xe49a('0x2c')][_0xe49a('0x3a')]){_0x270457[_0xe49a('0x37')]=_[_0xe49a('0x3b')](_0x270457['where'],{'$or':_[_0xe49a('0x27')](_0x270457[_0xe49a('0x30')],function(_0x4ed355){var _0x29f461={};_0x29f461[_0x4ed355]={'$like':'%'+_0x1f6ac3[_0xe49a('0x2c')][_0xe49a('0x3a')]+'%'};return _0x29f461;})});}_0x270457=_[_0xe49a('0x3b')]({},_0x270457,_0x1f6ac3[_0xe49a('0x3c')]);return _0x343bca['getDescriptions'](_0x270457);}})['then'](function(_0x21786e){if(_0x21786e){_0x48bb18=_0x21786e[_0xe49a('0x31')];if(!_0x1f6ac3[_0xe49a('0x2c')][_0xe49a('0x32')](_0xe49a('0x33'))){_0x270457[_0xe49a('0x18')]=qs[_0xe49a('0x18')](_0x1f6ac3[_0xe49a('0x2c')]['limit']);_0x270457[_0xe49a('0x34')]=qs['offset'](_0x1f6ac3['query'][_0xe49a('0x34')]);}return _0x343bca[_0xe49a('0x49')](_0x270457);}})[_0xe49a('0x1f')](function(_0x141267){if(_0x141267){return _0x141267?{'count':_0x48bb18,'rows':_0x141267}:null;}})[_0xe49a('0x1f')](respondWithResult(_0x69a7f9,null))[_0xe49a('0x3f')](handleError(_0x69a7f9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 389f695..f94d751 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 _0x0560=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x283b5f,_0x335c12){var _0x15f4be=function(_0x3ab42a){while(--_0x3ab42a){_0x283b5f['push'](_0x283b5f['shift']());}};_0x15f4be(++_0x335c12);}(_0x0560,0x82));var _0x0056=function(_0x3f7279,_0x48e9a4){_0x3f7279=_0x3f7279-0x0;var _0x58cc59=_0x0560[_0x3f7279];return _0x58cc59;};'use strict';var _=require(_0x0056('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0056('0x1'));var moment=require(_0x0056('0x2'));var BPromise=require(_0x0056('0x3'));var rp=require(_0x0056('0x4'));var fs=require('fs');var path=require(_0x0056('0x5'));var rimraf=require(_0x0056('0x6'));var config=require(_0x0056('0x7'));var attributes=require(_0x0056('0x8'));module[_0x0056('0x9')]=function(_0x4afd6e,_0x1813d1){return _0x4afd6e[_0x0056('0xa')](_0x0056('0xb'),attributes,{'tableName':_0x0056('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d97=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0x1d97,0x184));var _0x71d9=function(_0x466006,_0x2b09b8){_0x466006=_0x466006-0x0;var _0x3054ca=_0x1d97[_0x466006];return _0x3054ca;};'use strict';var _=require('lodash');var util=require(_0x71d9('0x0'));var logger=require(_0x71d9('0x1'))(_0x71d9('0x2'));var moment=require(_0x71d9('0x3'));var BPromise=require(_0x71d9('0x4'));var rp=require(_0x71d9('0x5'));var fs=require('fs');var path=require(_0x71d9('0x6'));var rimraf=require(_0x71d9('0x7'));var config=require(_0x71d9('0x8'));var attributes=require(_0x71d9('0x9'));module[_0x71d9('0xa')]=function(_0x1e81f8,_0x2dff9d){return _0x1e81f8['define'](_0x71d9('0xb'),attributes,{'tableName':_0x71d9('0xc'),'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 0f690ac..0e38316 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 _0xddea=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0xddea,0x6b));var _0xadde=function(_0x34afa3,_0x91776e){_0x34afa3=_0x34afa3-0x0;var _0xa56185=_0xddea[_0x34afa3];return _0xa56185;};'use strict';var _=require(_0xadde('0x0'));var util=require(_0xadde('0x1'));var moment=require(_0xadde('0x2'));var BPromise=require(_0xadde('0x3'));var rs=require(_0xadde('0x4'));var fs=require('fs');var Redis=require(_0xadde('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xadde('0x6'));var logger=require(_0xadde('0x7'))('rpc');var config=require(_0xadde('0x8'));var jayson=require(_0xadde('0x9'));var client=jayson[_0xadde('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f129d,_0x4c5673,_0x32c1c7){return new BPromise(function(_0x56a2b6,_0x1ae47a){return client[_0xadde('0xb')](_0x4f129d,_0x32c1c7)[_0xadde('0xc')](function(_0x6ee3ef){logger[_0xadde('0xd')](_0xadde('0xe'),_0x4c5673,_0xadde('0xf'));logger[_0xadde('0x10')](_0xadde('0x11'),_0x4c5673,_0xadde('0xf'),JSON[_0xadde('0x12')](_0x6ee3ef));if(_0x6ee3ef[_0xadde('0x13')]){if(_0x6ee3ef[_0xadde('0x13')][_0xadde('0x14')]===0x1f4){logger[_0xadde('0x13')](_0xadde('0xe'),_0x4c5673,_0x6ee3ef['error'][_0xadde('0x15')]);return _0x1ae47a(_0x6ee3ef[_0xadde('0x13')][_0xadde('0x15')]);}logger[_0xadde('0x13')](_0xadde('0xe'),_0x4c5673,_0x6ee3ef[_0xadde('0x13')][_0xadde('0x15')]);return _0x56a2b6(_0x6ee3ef[_0xadde('0x13')][_0xadde('0x15')]);}else{logger[_0xadde('0xd')](_0xadde('0xe'),_0x4c5673,'request\x20sent');_0x56a2b6(_0x6ee3ef[_0xadde('0x16')][_0xadde('0x15')]);}})[_0xadde('0x17')](function(_0x240fec){logger[_0xadde('0x13')](_0xadde('0xe'),_0x4c5673,_0x240fec);_0x1ae47a(_0x240fec);});});} \ No newline at end of file +var _0x8e4e=['jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x5d9f68,_0x5aa254){var _0x1284b8=function(_0x5581f7){while(--_0x5581f7){_0x5d9f68['push'](_0x5d9f68['shift']());}};_0x1284b8(++_0x5aa254);}(_0x8e4e,0x175));var _0xe8e4=function(_0x955730,_0x536ce1){_0x955730=_0x955730-0x0;var _0x1655ef=_0x8e4e[_0x955730];return _0x1655ef;};'use strict';var _=require(_0xe8e4('0x0'));var util=require('util');var moment=require(_0xe8e4('0x1'));var BPromise=require(_0xe8e4('0x2'));var rs=require(_0xe8e4('0x3'));var fs=require('fs');var Redis=require(_0xe8e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8e4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe8e4('0x6'));var jayson=require(_0xe8e4('0x7'));var client=jayson[_0xe8e4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x146c39,_0x41c9c1,_0x421265){return new BPromise(function(_0x48d12f,_0x23fa95){return client[_0xe8e4('0x9')](_0x146c39,_0x421265)['then'](function(_0x252cbb){logger[_0xe8e4('0xa')](_0xe8e4('0xb'),_0x41c9c1,_0xe8e4('0xc'));logger['debug'](_0xe8e4('0xd'),_0x41c9c1,_0xe8e4('0xc'),JSON[_0xe8e4('0xe')](_0x252cbb));if(_0x252cbb[_0xe8e4('0xf')]){if(_0x252cbb[_0xe8e4('0xf')]['code']===0x1f4){logger[_0xe8e4('0xf')](_0xe8e4('0xb'),_0x41c9c1,_0x252cbb[_0xe8e4('0xf')][_0xe8e4('0x10')]);return _0x23fa95(_0x252cbb[_0xe8e4('0xf')][_0xe8e4('0x10')]);}logger[_0xe8e4('0xf')](_0xe8e4('0xb'),_0x41c9c1,_0x252cbb[_0xe8e4('0xf')]['message']);return _0x48d12f(_0x252cbb[_0xe8e4('0xf')][_0xe8e4('0x10')]);}else{logger[_0xe8e4('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x41c9c1,_0xe8e4('0xc'));_0x48d12f(_0x252cbb[_0xe8e4('0x11')][_0xe8e4('0x10')]);}})[_0xe8e4('0x12')](function(_0x4e9efc){logger[_0xe8e4('0xf')](_0xe8e4('0xb'),_0x41c9c1,_0x4e9efc);_0x23fa95(_0x4e9efc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2062869..b03b547 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 _0xa3e9=['create','put','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x3bac9b,_0x1c5bcf){var _0x47ed58=function(_0x54eb46){while(--_0x54eb46){_0x3bac9b['push'](_0x3bac9b['shift']());}};_0x47ed58(++_0x1c5bcf);}(_0xa3e9,0x8d));var _0x9a3e=function(_0x939c08,_0x5a379e){_0x939c08=_0x939c08-0x0;var _0x2bf228=_0xa3e9[_0x939c08];return _0x2bf228;};'use strict';var multer=require(_0x9a3e('0x0'));var util=require('util');var path=require(_0x9a3e('0x1'));var timeout=require(_0x9a3e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a3e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9a3e('0x4'));var config=require(_0x9a3e('0x5'));var controller=require('./intSugarcrmField.controller');router[_0x9a3e('0x6')]('/',auth[_0x9a3e('0x7')](),controller[_0x9a3e('0x8')]);router[_0x9a3e('0x6')](_0x9a3e('0x9'),auth[_0x9a3e('0x7')](),controller[_0x9a3e('0xa')]);router[_0x9a3e('0xb')]('/',auth[_0x9a3e('0x7')](),controller[_0x9a3e('0xc')]);router[_0x9a3e('0xd')](_0x9a3e('0x9'),auth['isAuthenticated'](),controller[_0x9a3e('0xe')]);router[_0x9a3e('0xf')](_0x9a3e('0x9'),auth[_0x9a3e('0x7')](),controller['destroy']);module[_0x9a3e('0x10')]=router; \ No newline at end of file +var _0xaf7e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x5845de,_0x2b93c5){var _0x25f121=function(_0x8eb3ad){while(--_0x8eb3ad){_0x5845de['push'](_0x5845de['shift']());}};_0x25f121(++_0x2b93c5);}(_0xaf7e,0xa8));var _0xeaf7=function(_0x101ae9,_0x4538f3){_0x101ae9=_0x101ae9-0x0;var _0x358e78=_0xaf7e[_0x101ae9];return _0x358e78;};'use strict';var multer=require(_0xeaf7('0x0'));var util=require(_0xeaf7('0x1'));var path=require(_0xeaf7('0x2'));var timeout=require(_0xeaf7('0x3'));var express=require(_0xeaf7('0x4'));var router=express[_0xeaf7('0x5')]();var fs_extra=require(_0xeaf7('0x6'));var auth=require(_0xeaf7('0x7'));var interaction=require(_0xeaf7('0x8'));var config=require('../../config/environment');var controller=require(_0xeaf7('0x9'));router[_0xeaf7('0xa')]('/',auth[_0xeaf7('0xb')](),controller[_0xeaf7('0xc')]);router[_0xeaf7('0xa')](_0xeaf7('0xd'),auth[_0xeaf7('0xb')](),controller[_0xeaf7('0xe')]);router[_0xeaf7('0xf')]('/',auth[_0xeaf7('0xb')](),controller[_0xeaf7('0x10')]);router[_0xeaf7('0x11')](_0xeaf7('0xd'),auth[_0xeaf7('0xb')](),controller['update']);router[_0xeaf7('0x12')](_0xeaf7('0xd'),auth[_0xeaf7('0xb')](),controller[_0xeaf7('0x13')]);module[_0xeaf7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 7681fa4..4dbfa04 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 _0x22e5=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x31cfca,_0x21048e){var _0x576e24=function(_0x1b391c){while(--_0x1b391c){_0x31cfca['push'](_0x31cfca['shift']());}};_0x576e24(++_0x21048e);}(_0x22e5,0x1e6));var _0x522e=function(_0x1e0acf,_0x14eae2){_0x1e0acf=_0x1e0acf-0x0;var _0x2d0df0=_0x22e5[_0x1e0acf];return _0x2d0df0;};'use strict';var Sequelize=require(_0x522e('0x0'));module['exports']={'type':{'type':Sequelize[_0x522e('0x1')](_0x522e('0x2'),_0x522e('0x3'),_0x522e('0x4'),'keyValue',_0x522e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x522e('0x6')]},'key':{'type':Sequelize[_0x522e('0x6')]},'keyType':{'type':Sequelize[_0x522e('0x1')](_0x522e('0x2'),_0x522e('0x3'),_0x522e('0x4'))},'keyContent':{'type':Sequelize[_0x522e('0x6')]},'idField':{'type':Sequelize[_0x522e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x522e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d6f=['string','STRING','sequelize','exports','variable','customVariable','keyValue','picklist'];(function(_0x43c2b6,_0x3dd136){var _0x372d28=function(_0x20248b){while(--_0x20248b){_0x43c2b6['push'](_0x43c2b6['shift']());}};_0x372d28(++_0x3dd136);}(_0x8d6f,0x122));var _0xf8d6=function(_0x29973e,_0x2ab469){_0x29973e=_0x29973e-0x0;var _0x20f943=_0x8d6f[_0x29973e];return _0x20f943;};'use strict';var Sequelize=require(_0xf8d6('0x0'));module[_0xf8d6('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf8d6('0x2'),_0xf8d6('0x3'),_0xf8d6('0x4'),_0xf8d6('0x5')),'defaultValue':_0xf8d6('0x6')},'content':{'type':Sequelize[_0xf8d6('0x7')]},'key':{'type':Sequelize[_0xf8d6('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf8d6('0x6'),_0xf8d6('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xf8d6('0x7')]},'idField':{'type':Sequelize[_0xf8d6('0x7')]},'nameField':{'type':Sequelize[_0xf8d6('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf8d6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e409fc6..58fe174 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 _0x1e93=['merge','options','includeAll','include','catch','params','rawAttributes','keys','length','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmField','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter'];(function(_0x48f8d5,_0x34f897){var _0x47f9e5=function(_0x1b417f){while(--_0x1b417f){_0x48f8d5['push'](_0x48f8d5['shift']());}};_0x47f9e5(++_0x34f897);}(_0x1e93,0xe7));var _0x31e9=function(_0x26e621,_0x199aee){_0x26e621=_0x26e621-0x0;var _0x53ebdb=_0x1e93[_0x26e621];return _0x53ebdb;};'use strict';var emlformat=require(_0x31e9('0x0'));var rimraf=require(_0x31e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x31e9('0x2'));var moment=require(_0x31e9('0x3'));var BPromise=require(_0x31e9('0x4'));var Mustache=require(_0x31e9('0x5'));var util=require(_0x31e9('0x6'));var path=require('path');var sox=require(_0x31e9('0x7'));var csv=require('to-csv');var ejs=require(_0x31e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31e9('0x9'));var squel=require(_0x31e9('0xa'));var crypto=require(_0x31e9('0xb'));var jsforce=require(_0x31e9('0xc'));var deskjs=require(_0x31e9('0xd'));var toCsv=require(_0x31e9('0xe'));var querystring=require(_0x31e9('0xf'));var Papa=require('papaparse');var Redis=require(_0x31e9('0x10'));var authService=require(_0x31e9('0x11'));var qs=require(_0x31e9('0x12'));var as=require(_0x31e9('0x13'));var hardwareService=require(_0x31e9('0x14'));var logger=require(_0x31e9('0x15'))(_0x31e9('0x16'));var utils=require(_0x31e9('0x17'));var config=require(_0x31e9('0x18'));var licenseUtil=require(_0x31e9('0x19'));var db=require(_0x31e9('0x1a'))['db'];function respondWithStatusCode(_0x4615eb,_0x2cf390){_0x2cf390=_0x2cf390||0xcc;return function(_0x3317ba){if(_0x3317ba){return _0x4615eb['sendStatus'](_0x2cf390);}return _0x4615eb['status'](_0x2cf390)[_0x31e9('0x1b')]();};}function respondWithResult(_0x5a4a8b,_0x11a9e4){_0x11a9e4=_0x11a9e4||0xc8;return function(_0x17c548){if(_0x17c548){return _0x5a4a8b[_0x31e9('0x1c')](_0x11a9e4)['json'](_0x17c548);}};}function respondWithFilteredResult(_0x5a12a6,_0x7c310e){return function(_0x17e1ca){if(_0x17e1ca){var _0x49c890=typeof _0x7c310e[_0x31e9('0x1d')]===_0x31e9('0x1e')&&typeof _0x7c310e[_0x31e9('0x1f')]===_0x31e9('0x1e');var _0x5f4322=_0x17e1ca[_0x31e9('0x20')];var _0x30a918=_0x49c890?0x0:_0x7c310e[_0x31e9('0x1d')];var _0x5adec6=_0x49c890?_0x17e1ca[_0x31e9('0x20')]:_0x7c310e[_0x31e9('0x1d')]+_0x7c310e[_0x31e9('0x1f')];var _0x125add;if(_0x5adec6>=_0x5f4322){_0x5adec6=_0x5f4322;_0x125add=0xc8;}else{_0x125add=0xce;}_0x5a12a6[_0x31e9('0x1c')](_0x125add);return _0x5a12a6['set'](_0x31e9('0x21'),_0x30a918+'-'+_0x5adec6+'/'+_0x5f4322)[_0x31e9('0x22')](_0x17e1ca);}return null;};}function patchUpdates(_0x2802ef){return function(_0x2359af){try{jsonpatch[_0x31e9('0x23')](_0x2359af,_0x2802ef,!![]);}catch(_0xcd034e){return BPromise[_0x31e9('0x24')](_0xcd034e);}return _0x2359af['save']();};}function saveUpdates(_0x4fc8f6,_0x235e3f){return function(_0x5b92d){if(_0x5b92d){return _0x5b92d[_0x31e9('0x25')](_0x4fc8f6)[_0x31e9('0x26')](function(_0x36d662){return _0x36d662;});}return null;};}function removeEntity(_0x12c49e,_0x5e4cce){return function(_0x182dfb){if(_0x182dfb){return _0x182dfb[_0x31e9('0x27')]()[_0x31e9('0x26')](function(){_0x12c49e[_0x31e9('0x1c')](0xcc)[_0x31e9('0x1b')]();});}};}function handleEntityNotFound(_0x388943,_0x59551d){return function(_0x57871f){if(!_0x57871f){_0x388943[_0x31e9('0x28')](0x194);}return _0x57871f;};}function handleError(_0xae68eb,_0x315b9a){_0x315b9a=_0x315b9a||0x1f4;return function(_0x2199e9){logger[_0x31e9('0x29')](_0x2199e9[_0x31e9('0x2a')]);if(_0x2199e9[_0x31e9('0x2b')]){delete _0x2199e9[_0x31e9('0x2b')];}_0xae68eb['status'](_0x315b9a)['send'](_0x2199e9);};}exports[_0x31e9('0x2c')]=function(_0x49963e,_0x56be0a){var _0x595c58={},_0x460174={},_0x56cd98={'count':0x0,'rows':[]};var _0x531979=_[_0x31e9('0x2d')](db[_0x31e9('0x2e')]['rawAttributes'],function(_0x546b54){return{'name':_0x546b54[_0x31e9('0x2f')],'type':_0x546b54[_0x31e9('0x30')][_0x31e9('0x31')]};});_0x460174[_0x31e9('0x32')]=_[_0x31e9('0x2d')](_0x531979,_0x31e9('0x2b'));_0x460174[_0x31e9('0x33')]=_['keys'](_0x49963e[_0x31e9('0x33')]);_0x460174['filters']=_['intersection'](_0x460174[_0x31e9('0x32')],_0x460174[_0x31e9('0x33')]);_0x595c58[_0x31e9('0x34')]=_[_0x31e9('0x35')](_0x460174[_0x31e9('0x32')],qs['fields'](_0x49963e[_0x31e9('0x33')][_0x31e9('0x36')]));_0x595c58[_0x31e9('0x34')]=_0x595c58['attributes']['length']?_0x595c58[_0x31e9('0x34')]:_0x460174[_0x31e9('0x32')];if(!_0x49963e[_0x31e9('0x33')][_0x31e9('0x37')]('nolimit')){_0x595c58[_0x31e9('0x1f')]=qs[_0x31e9('0x1f')](_0x49963e['query']['limit']);_0x595c58[_0x31e9('0x1d')]=qs[_0x31e9('0x1d')](_0x49963e['query'][_0x31e9('0x1d')]);}_0x595c58[_0x31e9('0x38')]=qs[_0x31e9('0x39')](_0x49963e['query'][_0x31e9('0x39')]);_0x595c58[_0x31e9('0x3a')]=qs[_0x31e9('0x3b')](_['pick'](_0x49963e[_0x31e9('0x33')],_0x460174[_0x31e9('0x3b')]),_0x531979);if(_0x49963e[_0x31e9('0x33')][_0x31e9('0x3c')]){_0x595c58[_0x31e9('0x3a')]=_[_0x31e9('0x3d')](_0x595c58['where'],{'$or':_['map'](_0x531979,function(_0x182f65){if(_0x182f65[_0x31e9('0x30')]!=='VIRTUAL'){var _0x32708e={};_0x32708e[_0x182f65[_0x31e9('0x2b')]]={'$like':'%'+_0x49963e[_0x31e9('0x33')][_0x31e9('0x3c')]+'%'};return _0x32708e;}})});}_0x595c58=_[_0x31e9('0x3d')]({},_0x595c58,_0x49963e[_0x31e9('0x3e')]);var _0xfdf822={'where':_0x595c58[_0x31e9('0x3a')]};return db[_0x31e9('0x2e')][_0x31e9('0x20')](_0xfdf822)[_0x31e9('0x26')](function(_0x40c1ba){_0x56cd98['count']=_0x40c1ba;if(_0x49963e[_0x31e9('0x33')][_0x31e9('0x3f')]){_0x595c58[_0x31e9('0x40')]=[{'all':!![]}];}return db[_0x31e9('0x2e')]['findAll'](_0x595c58);})[_0x31e9('0x26')](function(_0x1b78fc){_0x56cd98['rows']=_0x1b78fc;return _0x56cd98;})[_0x31e9('0x26')](respondWithFilteredResult(_0x56be0a,_0x595c58))[_0x31e9('0x41')](handleError(_0x56be0a,null));};exports['show']=function(_0x2fb4ee,_0x5e66ab){var _0x5d7cfb={'raw':!![],'where':{'id':_0x2fb4ee[_0x31e9('0x42')]['id']}},_0x288725={};_0x288725[_0x31e9('0x32')]=_['keys'](db[_0x31e9('0x2e')][_0x31e9('0x43')]);_0x288725['query']=_[_0x31e9('0x44')](_0x2fb4ee[_0x31e9('0x33')]);_0x288725[_0x31e9('0x3b')]=_[_0x31e9('0x35')](_0x288725['model'],_0x288725[_0x31e9('0x33')]);_0x5d7cfb[_0x31e9('0x34')]=_[_0x31e9('0x35')](_0x288725[_0x31e9('0x32')],qs[_0x31e9('0x36')](_0x2fb4ee[_0x31e9('0x33')][_0x31e9('0x36')]));_0x5d7cfb[_0x31e9('0x34')]=_0x5d7cfb[_0x31e9('0x34')][_0x31e9('0x45')]?_0x5d7cfb[_0x31e9('0x34')]:_0x288725[_0x31e9('0x32')];if(_0x2fb4ee[_0x31e9('0x33')]['includeAll']){_0x5d7cfb[_0x31e9('0x40')]=[{'all':!![]}];}_0x5d7cfb=_[_0x31e9('0x3d')]({},_0x5d7cfb,_0x2fb4ee[_0x31e9('0x3e')]);return db[_0x31e9('0x2e')][_0x31e9('0x46')](_0x5d7cfb)[_0x31e9('0x26')](handleEntityNotFound(_0x5e66ab,null))[_0x31e9('0x26')](respondWithResult(_0x5e66ab,null))[_0x31e9('0x41')](handleError(_0x5e66ab,null));};exports[_0x31e9('0x47')]=function(_0x4ce77c,_0x2fdf10){return db[_0x31e9('0x2e')][_0x31e9('0x47')](_0x4ce77c[_0x31e9('0x48')],{})[_0x31e9('0x26')](respondWithResult(_0x2fdf10,0xc9))['catch'](handleError(_0x2fdf10,null));};exports[_0x31e9('0x25')]=function(_0x20abee,_0x2667e8){if(_0x20abee[_0x31e9('0x48')]['id']){delete _0x20abee[_0x31e9('0x48')]['id'];}return db[_0x31e9('0x2e')][_0x31e9('0x46')]({'where':{'id':_0x20abee[_0x31e9('0x42')]['id']}})[_0x31e9('0x26')](handleEntityNotFound(_0x2667e8,null))[_0x31e9('0x26')](saveUpdates(_0x20abee[_0x31e9('0x48')],null))[_0x31e9('0x26')](respondWithResult(_0x2667e8,null))[_0x31e9('0x41')](handleError(_0x2667e8,null));};exports[_0x31e9('0x27')]=function(_0x394583,_0x3a45f9){return db[_0x31e9('0x2e')][_0x31e9('0x46')]({'where':{'id':_0x394583[_0x31e9('0x42')]['id']}})[_0x31e9('0x26')](handleEntityNotFound(_0x3a45f9,null))[_0x31e9('0x26')](removeEntity(_0x3a45f9,null))['catch'](handleError(_0x3a45f9,null));}; \ No newline at end of file +var _0xa187=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','options','includeAll','include','rows','params','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x4d183d,_0x123de0){var _0x431236=function(_0x35642b){while(--_0x35642b){_0x4d183d['push'](_0x4d183d['shift']());}};_0x431236(++_0x123de0);}(_0xa187,0x1e9));var _0x7a18=function(_0x1e1b5a,_0x13b534){_0x1e1b5a=_0x1e1b5a-0x0;var _0x3206db=_0xa187[_0x1e1b5a];return _0x3206db;};'use strict';var emlformat=require(_0x7a18('0x0'));var rimraf=require(_0x7a18('0x1'));var zipdir=require(_0x7a18('0x2'));var jsonpatch=require(_0x7a18('0x3'));var rp=require(_0x7a18('0x4'));var moment=require(_0x7a18('0x5'));var BPromise=require(_0x7a18('0x6'));var Mustache=require(_0x7a18('0x7'));var util=require(_0x7a18('0x8'));var path=require(_0x7a18('0x9'));var sox=require('sox');var csv=require(_0x7a18('0xa'));var ejs=require(_0x7a18('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a18('0xc'));var squel=require(_0x7a18('0xd'));var crypto=require(_0x7a18('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7a18('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a18('0x10'));var Papa=require('papaparse');var Redis=require(_0x7a18('0x11'));var authService=require(_0x7a18('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a18('0x13'));var hardwareService=require(_0x7a18('0x14'));var logger=require('../../config/logger')(_0x7a18('0x15'));var utils=require(_0x7a18('0x16'));var config=require(_0x7a18('0x17'));var licenseUtil=require(_0x7a18('0x18'));var db=require(_0x7a18('0x19'))['db'];function respondWithStatusCode(_0x40d79a,_0x4ec354){_0x4ec354=_0x4ec354||0xcc;return function(_0x109a1c){if(_0x109a1c){return _0x40d79a[_0x7a18('0x1a')](_0x4ec354);}return _0x40d79a['status'](_0x4ec354)[_0x7a18('0x1b')]();};}function respondWithResult(_0x4af560,_0x1b7e5a){_0x1b7e5a=_0x1b7e5a||0xc8;return function(_0xe32fd3){if(_0xe32fd3){return _0x4af560['status'](_0x1b7e5a)['json'](_0xe32fd3);}};}function respondWithFilteredResult(_0x3e7a19,_0x27e99f){return function(_0x2ad125){if(_0x2ad125){var _0x36dd58=typeof _0x27e99f[_0x7a18('0x1c')]===_0x7a18('0x1d')&&typeof _0x27e99f[_0x7a18('0x1e')]===_0x7a18('0x1d');var _0x3c27fe=_0x2ad125['count'];var _0x3364fb=_0x36dd58?0x0:_0x27e99f['offset'];var _0x5f3d76=_0x36dd58?_0x2ad125[_0x7a18('0x1f')]:_0x27e99f[_0x7a18('0x1c')]+_0x27e99f[_0x7a18('0x1e')];var _0x342907;if(_0x5f3d76>=_0x3c27fe){_0x5f3d76=_0x3c27fe;_0x342907=0xc8;}else{_0x342907=0xce;}_0x3e7a19[_0x7a18('0x20')](_0x342907);return _0x3e7a19['set'](_0x7a18('0x21'),_0x3364fb+'-'+_0x5f3d76+'/'+_0x3c27fe)[_0x7a18('0x22')](_0x2ad125);}return null;};}function patchUpdates(_0x42a665){return function(_0x3f86c6){try{jsonpatch[_0x7a18('0x23')](_0x3f86c6,_0x42a665,!![]);}catch(_0x1cdc74){return BPromise['reject'](_0x1cdc74);}return _0x3f86c6[_0x7a18('0x24')]();};}function saveUpdates(_0x209d10,_0x427b9d){return function(_0x5eda74){if(_0x5eda74){return _0x5eda74[_0x7a18('0x25')](_0x209d10)[_0x7a18('0x26')](function(_0x17735a){return _0x17735a;});}return null;};}function removeEntity(_0x31d3d0,_0x1931f6){return function(_0x5add36){if(_0x5add36){return _0x5add36['destroy']()[_0x7a18('0x26')](function(){_0x31d3d0['status'](0xcc)[_0x7a18('0x1b')]();});}};}function handleEntityNotFound(_0xebcb55,_0x276d3a){return function(_0x227888){if(!_0x227888){_0xebcb55[_0x7a18('0x1a')](0x194);}return _0x227888;};}function handleError(_0x54e718,_0x58de6d){_0x58de6d=_0x58de6d||0x1f4;return function(_0x4f6c50){logger[_0x7a18('0x27')](_0x4f6c50[_0x7a18('0x28')]);if(_0x4f6c50[_0x7a18('0x29')]){delete _0x4f6c50[_0x7a18('0x29')];}_0x54e718['status'](_0x58de6d)[_0x7a18('0x2a')](_0x4f6c50);};}exports[_0x7a18('0x2b')]=function(_0x5be53b,_0x59510d){var _0x2feddd={},_0xa30fd3={},_0xaf30e5={'count':0x0,'rows':[]};var _0x212079=_[_0x7a18('0x2c')](db[_0x7a18('0x2d')][_0x7a18('0x2e')],function(_0x3c3416){return{'name':_0x3c3416['fieldName'],'type':_0x3c3416[_0x7a18('0x2f')][_0x7a18('0x30')]};});_0xa30fd3[_0x7a18('0x31')]=_['map'](_0x212079,_0x7a18('0x29'));_0xa30fd3[_0x7a18('0x32')]=_[_0x7a18('0x33')](_0x5be53b[_0x7a18('0x32')]);_0xa30fd3[_0x7a18('0x34')]=_[_0x7a18('0x35')](_0xa30fd3[_0x7a18('0x31')],_0xa30fd3[_0x7a18('0x32')]);_0x2feddd[_0x7a18('0x36')]=_[_0x7a18('0x35')](_0xa30fd3[_0x7a18('0x31')],qs[_0x7a18('0x37')](_0x5be53b[_0x7a18('0x32')]['fields']));_0x2feddd[_0x7a18('0x36')]=_0x2feddd['attributes']['length']?_0x2feddd['attributes']:_0xa30fd3[_0x7a18('0x31')];if(!_0x5be53b['query'][_0x7a18('0x38')]('nolimit')){_0x2feddd[_0x7a18('0x1e')]=qs[_0x7a18('0x1e')](_0x5be53b['query']['limit']);_0x2feddd[_0x7a18('0x1c')]=qs[_0x7a18('0x1c')](_0x5be53b[_0x7a18('0x32')][_0x7a18('0x1c')]);}_0x2feddd[_0x7a18('0x39')]=qs['sort'](_0x5be53b[_0x7a18('0x32')]['sort']);_0x2feddd['where']=qs[_0x7a18('0x34')](_['pick'](_0x5be53b[_0x7a18('0x32')],_0xa30fd3[_0x7a18('0x34')]),_0x212079);if(_0x5be53b[_0x7a18('0x32')]['filter']){_0x2feddd[_0x7a18('0x3a')]=_['merge'](_0x2feddd[_0x7a18('0x3a')],{'$or':_['map'](_0x212079,function(_0x71a6a3){if(_0x71a6a3[_0x7a18('0x2f')]!=='VIRTUAL'){var _0x490901={};_0x490901[_0x71a6a3[_0x7a18('0x29')]]={'$like':'%'+_0x5be53b[_0x7a18('0x32')][_0x7a18('0x3b')]+'%'};return _0x490901;}})});}_0x2feddd=_[_0x7a18('0x3c')]({},_0x2feddd,_0x5be53b[_0x7a18('0x3d')]);var _0x91b99d={'where':_0x2feddd['where']};return db[_0x7a18('0x2d')][_0x7a18('0x1f')](_0x91b99d)['then'](function(_0x2e282c){_0xaf30e5[_0x7a18('0x1f')]=_0x2e282c;if(_0x5be53b[_0x7a18('0x32')][_0x7a18('0x3e')]){_0x2feddd[_0x7a18('0x3f')]=[{'all':!![]}];}return db[_0x7a18('0x2d')]['findAll'](_0x2feddd);})[_0x7a18('0x26')](function(_0x5724f9){_0xaf30e5[_0x7a18('0x40')]=_0x5724f9;return _0xaf30e5;})[_0x7a18('0x26')](respondWithFilteredResult(_0x59510d,_0x2feddd))['catch'](handleError(_0x59510d,null));};exports['show']=function(_0x53a40c,_0x39a6bb){var _0x363cd6={'raw':!![],'where':{'id':_0x53a40c[_0x7a18('0x41')]['id']}},_0x42459e={};_0x42459e[_0x7a18('0x31')]=_[_0x7a18('0x33')](db['SugarcrmField']['rawAttributes']);_0x42459e[_0x7a18('0x32')]=_['keys'](_0x53a40c['query']);_0x42459e['filters']=_[_0x7a18('0x35')](_0x42459e[_0x7a18('0x31')],_0x42459e[_0x7a18('0x32')]);_0x363cd6[_0x7a18('0x36')]=_[_0x7a18('0x35')](_0x42459e[_0x7a18('0x31')],qs['fields'](_0x53a40c[_0x7a18('0x32')][_0x7a18('0x37')]));_0x363cd6[_0x7a18('0x36')]=_0x363cd6[_0x7a18('0x36')][_0x7a18('0x42')]?_0x363cd6[_0x7a18('0x36')]:_0x42459e[_0x7a18('0x31')];if(_0x53a40c[_0x7a18('0x32')][_0x7a18('0x3e')]){_0x363cd6[_0x7a18('0x3f')]=[{'all':!![]}];}_0x363cd6=_[_0x7a18('0x3c')]({},_0x363cd6,_0x53a40c[_0x7a18('0x3d')]);return db[_0x7a18('0x2d')][_0x7a18('0x43')](_0x363cd6)['then'](handleEntityNotFound(_0x39a6bb,null))[_0x7a18('0x26')](respondWithResult(_0x39a6bb,null))[_0x7a18('0x44')](handleError(_0x39a6bb,null));};exports[_0x7a18('0x45')]=function(_0x166daa,_0x285258){return db[_0x7a18('0x2d')][_0x7a18('0x45')](_0x166daa[_0x7a18('0x46')],{})[_0x7a18('0x26')](respondWithResult(_0x285258,0xc9))['catch'](handleError(_0x285258,null));};exports['update']=function(_0x3bebdd,_0x55167c){if(_0x3bebdd[_0x7a18('0x46')]['id']){delete _0x3bebdd[_0x7a18('0x46')]['id'];}return db[_0x7a18('0x2d')][_0x7a18('0x43')]({'where':{'id':_0x3bebdd[_0x7a18('0x41')]['id']}})['then'](handleEntityNotFound(_0x55167c,null))[_0x7a18('0x26')](saveUpdates(_0x3bebdd[_0x7a18('0x46')],null))[_0x7a18('0x26')](respondWithResult(_0x55167c,null))['catch'](handleError(_0x55167c,null));};exports[_0x7a18('0x47')]=function(_0x12f2fb,_0x3bef2e){return db['SugarcrmField'][_0x7a18('0x43')]({'where':{'id':_0x12f2fb[_0x7a18('0x41')]['id']}})[_0x7a18('0x26')](handleEntityNotFound(_0x3bef2e,null))[_0x7a18('0x26')](removeEntity(_0x3bef2e,null))['catch'](handleError(_0x3bef2e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3af6a0d..81387a4 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 _0x97ab=['moment','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','util','../../config/logger'];(function(_0xfb7ebf,_0xbc2c8d){var _0x368871=function(_0x3b0750){while(--_0x3b0750){_0xfb7ebf['push'](_0xfb7ebf['shift']());}};_0x368871(++_0xbc2c8d);}(_0x97ab,0xc4));var _0xb97a=function(_0xd8101e,_0xd3dbca){_0xd8101e=_0xd8101e-0x0;var _0x3e9f08=_0x97ab[_0xd8101e];return _0x3e9f08;};'use strict';var _=require('lodash');var util=require(_0xb97a('0x0'));var logger=require(_0xb97a('0x1'))('api');var moment=require(_0xb97a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb97a('0x3'));var fs=require('fs');var path=require(_0xb97a('0x4'));var rimraf=require(_0xb97a('0x5'));var config=require(_0xb97a('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xb97a('0x7')]=function(_0x3fbf54,_0x4a9303){return _0x3fbf54[_0xb97a('0x8')](_0xb97a('0x9'),attributes,{'tableName':_0xb97a('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6af8=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6af8,0x66));var _0x86af=function(_0x19a7c4,_0x54e46b){_0x19a7c4=_0x19a7c4-0x0;var _0x422f7a=_0x6af8[_0x19a7c4];return _0x422f7a;};'use strict';var _=require(_0x86af('0x0'));var util=require(_0x86af('0x1'));var logger=require(_0x86af('0x2'))(_0x86af('0x3'));var moment=require(_0x86af('0x4'));var BPromise=require('bluebird');var rp=require(_0x86af('0x5'));var fs=require('fs');var path=require(_0x86af('0x6'));var rimraf=require(_0x86af('0x7'));var config=require(_0x86af('0x8'));var attributes=require(_0x86af('0x9'));module[_0x86af('0xa')]=function(_0x28ac34,_0x3422ee){return _0x28ac34[_0x86af('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x86af('0xc'),'fields':[_0x86af('0xd'),_0x86af('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3c6ed7c..b90e2a2 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 _0xefc7=['code','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x165081,_0x153678){var _0x1a7af0=function(_0x42a5b){while(--_0x42a5b){_0x165081['push'](_0x165081['shift']());}};_0x1a7af0(++_0x153678);}(_0xefc7,0x1d1));var _0x7efc=function(_0x475f76,_0xa0815c){_0x475f76=_0x475f76-0x0;var _0xbb5819=_0xefc7[_0x475f76];return _0xbb5819;};'use strict';var _=require('lodash');var util=require(_0x7efc('0x0'));var moment=require(_0x7efc('0x1'));var BPromise=require('bluebird');var rs=require(_0x7efc('0x2'));var fs=require('fs');var Redis=require(_0x7efc('0x3'));var db=require(_0x7efc('0x4'))['db'];var utils=require(_0x7efc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7efc('0x6'));var client=jayson[_0x7efc('0x7')][_0x7efc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23f312,_0x3e9360,_0xe3c8c3){return new BPromise(function(_0xdeb635,_0x1335db){return client[_0x7efc('0x9')](_0x23f312,_0xe3c8c3)['then'](function(_0x324e93){logger[_0x7efc('0xa')](_0x7efc('0xb'),_0x3e9360,_0x7efc('0xc'));logger[_0x7efc('0xd')](_0x7efc('0xe'),_0x3e9360,'request\x20sent',JSON['stringify'](_0x324e93));if(_0x324e93['error']){if(_0x324e93['error'][_0x7efc('0xf')]===0x1f4){logger[_0x7efc('0x10')](_0x7efc('0xb'),_0x3e9360,_0x324e93[_0x7efc('0x10')][_0x7efc('0x11')]);return _0x1335db(_0x324e93[_0x7efc('0x10')]['message']);}logger[_0x7efc('0x10')](_0x7efc('0xb'),_0x3e9360,_0x324e93[_0x7efc('0x10')][_0x7efc('0x11')]);return _0xdeb635(_0x324e93['error'][_0x7efc('0x11')]);}else{logger['info'](_0x7efc('0xb'),_0x3e9360,'request\x20sent');_0xdeb635(_0x324e93[_0x7efc('0x12')][_0x7efc('0x11')]);}})[_0x7efc('0x13')](function(_0x385ff7){logger[_0x7efc('0x10')](_0x7efc('0xb'),_0x3e9360,_0x385ff7);_0x1335db(_0x385ff7);});});} \ No newline at end of file +var _0xd1f5=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message'];(function(_0x23303f,_0x927d66){var _0x4d6bbb=function(_0x23bc11){while(--_0x23bc11){_0x23303f['push'](_0x23303f['shift']());}};_0x4d6bbb(++_0x927d66);}(_0xd1f5,0x13e));var _0x5d1f=function(_0x9dbd0d,_0x4fe187){_0x9dbd0d=_0x9dbd0d-0x0;var _0x38deae=_0xd1f5[_0x9dbd0d];return _0x38deae;};'use strict';var _=require(_0x5d1f('0x0'));var util=require(_0x5d1f('0x1'));var moment=require('moment');var BPromise=require(_0x5d1f('0x2'));var rs=require(_0x5d1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d1f('0x4'))['db'];var utils=require(_0x5d1f('0x5'));var logger=require(_0x5d1f('0x6'))(_0x5d1f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d1f('0x8'));var client=jayson[_0x5d1f('0x9')][_0x5d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4e9d,_0x298a42,_0x372dff){return new BPromise(function(_0x9782f2,_0x299b81){return client['request'](_0x1b4e9d,_0x372dff)[_0x5d1f('0xb')](function(_0xd2e10a){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x298a42,'request\x20sent');logger[_0x5d1f('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x298a42,_0x5d1f('0xd'),JSON['stringify'](_0xd2e10a));if(_0xd2e10a[_0x5d1f('0xe')]){if(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0xf')]===0x1f4){logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);return _0x299b81(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);}logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);return _0x9782f2(_0xd2e10a[_0x5d1f('0xe')][_0x5d1f('0x11')]);}else{logger[_0x5d1f('0x12')](_0x5d1f('0x10'),_0x298a42,'request\x20sent');_0x9782f2(_0xd2e10a[_0x5d1f('0x13')][_0x5d1f('0x11')]);}})[_0x5d1f('0x14')](function(_0x314540){logger[_0x5d1f('0xe')](_0x5d1f('0x10'),_0x298a42,_0x314540);_0x299b81(_0x314540);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4702713..ae386c7 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 _0x3f47=['../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x20f060,_0xe160c9){var _0x46077c=function(_0x3c615a){while(--_0x3c615a){_0x20f060['push'](_0x20f060['shift']());}};_0x46077c(++_0xe160c9);}(_0x3f47,0x10e));var _0x73f4=function(_0x18a8cf,_0x44b967){_0x18a8cf=_0x18a8cf-0x0;var _0x385589=_0x3f47[_0x18a8cf];return _0x385589;};'use strict';var multer=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var path=require('path');var timeout=require(_0x73f4('0x2'));var express=require('express');var router=express[_0x73f4('0x3')]();var fs_extra=require(_0x73f4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73f4('0x5'));var config=require(_0x73f4('0x6'));var controller=require(_0x73f4('0x7'));router[_0x73f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x73f4('0x9')]);router[_0x73f4('0x8')](_0x73f4('0xa'),auth[_0x73f4('0xb')](),controller[_0x73f4('0xc')]);router[_0x73f4('0x8')]('/:id/configurations',auth[_0x73f4('0xb')](),controller[_0x73f4('0xd')]);router[_0x73f4('0x8')](_0x73f4('0xe'),auth[_0x73f4('0xb')](),controller[_0x73f4('0xf')]);router[_0x73f4('0x10')]('/',auth[_0x73f4('0xb')](),controller[_0x73f4('0x11')]);router[_0x73f4('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x73f4('0x12')]);router['put'](_0x73f4('0xa'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x13')]);router[_0x73f4('0x14')](_0x73f4('0xa'),auth['isAuthenticated'](),controller[_0x73f4('0x15')]);module[_0x73f4('0x16')]=router; \ No newline at end of file +var _0x323f=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','post','create','put','update','delete'];(function(_0x4dfa60,_0x4a4260){var _0x234268=function(_0x29086c){while(--_0x29086c){_0x4dfa60['push'](_0x4dfa60['shift']());}};_0x234268(++_0x4a4260);}(_0x323f,0xde));var _0xf323=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x323f[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require('express');var router=express[_0xf323('0x2')]();var fs_extra=require(_0xf323('0x3'));var auth=require(_0xf323('0x4'));var interaction=require(_0xf323('0x5'));var config=require('../../config/environment');var controller=require(_0xf323('0x6'));router['get']('/',auth[_0xf323('0x7')](),controller[_0xf323('0x8')]);router[_0xf323('0x9')](_0xf323('0xa'),auth[_0xf323('0x7')](),controller[_0xf323('0xb')]);router[_0xf323('0x9')](_0xf323('0xc'),auth[_0xf323('0x7')](),controller['getConfigurations']);router[_0xf323('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xf323('0xd')]('/',auth[_0xf323('0x7')](),controller[_0xf323('0xe')]);router['post'](_0xf323('0xc'),auth[_0xf323('0x7')](),controller['addConfiguration']);router[_0xf323('0xf')](_0xf323('0xa'),auth[_0xf323('0x7')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xa'),auth['isAuthenticated'](),controller[_0xf323('0x12')]);module[_0xf323('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0a65b72..955cb28 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 _0x4d7a=['sequelize','exports','STRING','HelpDesk'];(function(_0x16ff31,_0x2fc3d9){var _0x10b629=function(_0x9ef99b){while(--_0x9ef99b){_0x16ff31['push'](_0x16ff31['shift']());}};_0x10b629(++_0x2fc3d9);}(_0x4d7a,0x1ec));var _0xa4d7=function(_0x908521,_0x57ef9f){_0x908521=_0x908521-0x0;var _0x5577ec=_0x4d7a[_0x908521];return _0x5577ec;};'use strict';var Sequelize=require(_0xa4d7('0x0'));module[_0xa4d7('0x1')]={'name':{'type':Sequelize[_0xa4d7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa4d7('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa4d7('0x2')],'allowNull':![],'defaultValue':_0xa4d7('0x3')},'remoteUri':{'type':Sequelize[_0xa4d7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa4d7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa4d7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcd9a=['STRING','HelpDesk'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xcd9a,0x84));var _0xacd9=function(_0x149aa6,_0x3c70c8){_0x149aa6=_0x149aa6-0x0;var _0x1ffdf0=_0xcd9a[_0x149aa6];return _0x1ffdf0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xacd9('0x0')]},'username':{'type':Sequelize[_0xacd9('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xacd9('0x0')],'allowNull':![],'defaultValue':_0xacd9('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xacd9('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e9308e7..3bc6d44 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 _0x87b3=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','params','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','includes','remove','editable','false','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','send','map','VtigerAccount','fieldName','type','key','model','query'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x87b3,0xbf));var _0x387b=function(_0x56ab39,_0x1f9d11){_0x56ab39=_0x56ab39-0x0;var _0x32f0d0=_0x87b3[_0x56ab39];return _0x32f0d0;};'use strict';var emlformat=require(_0x387b('0x0'));var rimraf=require(_0x387b('0x1'));var zipdir=require(_0x387b('0x2'));var jsonpatch=require(_0x387b('0x3'));var rp=require(_0x387b('0x4'));var moment=require(_0x387b('0x5'));var BPromise=require(_0x387b('0x6'));var Mustache=require(_0x387b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x387b('0x8'));var csv=require('to-csv');var ejs=require(_0x387b('0x9'));var fs=require('fs');var fs_extra=require(_0x387b('0xa'));var _=require(_0x387b('0xb'));var squel=require(_0x387b('0xc'));var crypto=require(_0x387b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x387b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x387b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x387b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x387b('0x11'));var hardwareService=require(_0x387b('0x12'));var logger=require(_0x387b('0x13'))(_0x387b('0x14'));var utils=require(_0x387b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x387b('0x16'));var db=require(_0x387b('0x17'))['db'];var integrations=require(_0x387b('0x18'));function respondWithStatusCode(_0x4ea002,_0x139938){_0x139938=_0x139938||0xcc;return function(_0x30fc62){if(_0x30fc62){return _0x4ea002[_0x387b('0x19')](_0x139938);}return _0x4ea002['status'](_0x139938)['end']();};}function respondWithResult(_0x4b0aa4,_0x2d708f){_0x2d708f=_0x2d708f||0xc8;return function(_0xb6cdb8){if(_0xb6cdb8){return _0x4b0aa4[_0x387b('0x1a')](_0x2d708f)[_0x387b('0x1b')](_0xb6cdb8);}};}function respondWithFilteredResult(_0x1fb98a,_0x3b35d7){return function(_0x58a188){if(_0x58a188){var _0x3b65ad=typeof _0x3b35d7['offset']==='undefined'&&typeof _0x3b35d7[_0x387b('0x1c')]==='undefined';var _0x5e66b9=_0x58a188[_0x387b('0x1d')];var _0x258d8b=_0x3b65ad?0x0:_0x3b35d7[_0x387b('0x1e')];var _0x3ec213=_0x3b65ad?_0x58a188[_0x387b('0x1d')]:_0x3b35d7['offset']+_0x3b35d7[_0x387b('0x1c')];var _0x1c62c0;if(_0x3ec213>=_0x5e66b9){_0x3ec213=_0x5e66b9;_0x1c62c0=0xc8;}else{_0x1c62c0=0xce;}_0x1fb98a['status'](_0x1c62c0);return _0x1fb98a[_0x387b('0x1f')](_0x387b('0x20'),_0x258d8b+'-'+_0x3ec213+'/'+_0x5e66b9)['json'](_0x58a188);}return null;};}function patchUpdates(_0x904558){return function(_0x5335d9){try{jsonpatch[_0x387b('0x21')](_0x5335d9,_0x904558,!![]);}catch(_0x160350){return BPromise['reject'](_0x160350);}return _0x5335d9[_0x387b('0x22')]();};}function saveUpdates(_0x2e674e,_0x5f0768){return function(_0x50b701){if(_0x50b701){return _0x50b701[_0x387b('0x23')](_0x2e674e)[_0x387b('0x24')](function(_0x31ff38){return _0x31ff38;});}return null;};}function removeEntity(_0x1c996a,_0x29b9ab){return function(_0x3208f5){if(_0x3208f5){return _0x3208f5['destroy']()[_0x387b('0x24')](function(){_0x1c996a[_0x387b('0x1a')](0xcc)[_0x387b('0x25')]();});}};}function handleEntityNotFound(_0x22fcf5,_0xbdfb8c){return function(_0x124f94){if(!_0x124f94){_0x22fcf5['sendStatus'](0x194);}return _0x124f94;};}function handleError(_0x266001,_0x1864c8){_0x1864c8=_0x1864c8||0x1f4;return function(_0x22def4){logger[_0x387b('0x26')](_0x22def4[_0x387b('0x27')]);if(_0x22def4['name']){delete _0x22def4[_0x387b('0x28')];}_0x266001[_0x387b('0x1a')](_0x1864c8)[_0x387b('0x29')](_0x22def4);};}exports['index']=function(_0x58f451,_0x15fdfc){var _0x201f8a={},_0x1e443f={},_0x36f2e9={'count':0x0,'rows':[]};var _0x1ffb7b=_[_0x387b('0x2a')](db[_0x387b('0x2b')]['rawAttributes'],function(_0x438465){return{'name':_0x438465[_0x387b('0x2c')],'type':_0x438465[_0x387b('0x2d')][_0x387b('0x2e')]};});_0x1e443f[_0x387b('0x2f')]=_[_0x387b('0x2a')](_0x1ffb7b,_0x387b('0x28'));_0x1e443f[_0x387b('0x30')]=_['keys'](_0x58f451[_0x387b('0x30')]);_0x1e443f[_0x387b('0x31')]=_['intersection'](_0x1e443f[_0x387b('0x2f')],_0x1e443f[_0x387b('0x30')]);_0x201f8a[_0x387b('0x32')]=_[_0x387b('0x33')](_0x1e443f[_0x387b('0x2f')],qs['fields'](_0x58f451[_0x387b('0x30')][_0x387b('0x34')]));_0x201f8a[_0x387b('0x32')]=_0x201f8a[_0x387b('0x32')][_0x387b('0x35')]?_0x201f8a[_0x387b('0x32')]:_0x1e443f[_0x387b('0x2f')];if(!_0x58f451[_0x387b('0x30')][_0x387b('0x36')]('nolimit')){_0x201f8a[_0x387b('0x1c')]=qs['limit'](_0x58f451[_0x387b('0x30')][_0x387b('0x1c')]);_0x201f8a['offset']=qs[_0x387b('0x1e')](_0x58f451[_0x387b('0x30')][_0x387b('0x1e')]);}_0x201f8a[_0x387b('0x37')]=qs[_0x387b('0x38')](_0x58f451['query'][_0x387b('0x38')]);_0x201f8a[_0x387b('0x39')]=qs[_0x387b('0x31')](_['pick'](_0x58f451['query'],_0x1e443f[_0x387b('0x31')]),_0x1ffb7b);if(_0x58f451[_0x387b('0x30')][_0x387b('0x3a')]){_0x201f8a[_0x387b('0x39')]=_[_0x387b('0x3b')](_0x201f8a[_0x387b('0x39')],{'$or':_[_0x387b('0x2a')](_0x1ffb7b,function(_0x10ba35){if(_0x10ba35[_0x387b('0x2d')]!==_0x387b('0x3c')){var _0x11f562={};_0x11f562[_0x10ba35[_0x387b('0x28')]]={'$like':'%'+_0x58f451['query'][_0x387b('0x3a')]+'%'};return _0x11f562;}})});}_0x201f8a=_[_0x387b('0x3b')]({},_0x201f8a,_0x58f451[_0x387b('0x3d')]);var _0x2e571f={'where':_0x201f8a['where']};return db[_0x387b('0x2b')]['count'](_0x2e571f)[_0x387b('0x24')](function(_0x438ea5){_0x36f2e9[_0x387b('0x1d')]=_0x438ea5;if(_0x58f451[_0x387b('0x30')][_0x387b('0x3e')]){_0x201f8a[_0x387b('0x3f')]=[{'all':!![]}];}return db[_0x387b('0x2b')][_0x387b('0x40')](_0x201f8a);})[_0x387b('0x24')](function(_0x136d32){_0x36f2e9[_0x387b('0x41')]=_0x136d32;return _0x36f2e9;})[_0x387b('0x24')](respondWithFilteredResult(_0x15fdfc,_0x201f8a))[_0x387b('0x42')](handleError(_0x15fdfc,null));};exports[_0x387b('0x43')]=function(_0x2cda60,_0x1020c0){var _0x2d8c87={'raw':![],'where':{'id':_0x2cda60['params']['id']}},_0x2b63af={};_0x2b63af[_0x387b('0x2f')]=_[_0x387b('0x44')](db['VtigerAccount'][_0x387b('0x45')]);_0x2b63af[_0x387b('0x30')]=_['keys'](_0x2cda60['query']);_0x2b63af[_0x387b('0x31')]=_[_0x387b('0x33')](_0x2b63af[_0x387b('0x2f')],_0x2b63af['query']);_0x2d8c87[_0x387b('0x32')]=_['intersection'](_0x2b63af[_0x387b('0x2f')],qs[_0x387b('0x34')](_0x2cda60[_0x387b('0x30')][_0x387b('0x34')]));_0x2d8c87[_0x387b('0x32')]=_0x2d8c87[_0x387b('0x32')][_0x387b('0x35')]?_0x2d8c87['attributes']:_0x2b63af['model'];if(_0x2cda60[_0x387b('0x30')][_0x387b('0x3e')]){_0x2d8c87['include']=[{'all':!![]}];}_0x2d8c87=_[_0x387b('0x3b')]({},_0x2d8c87,_0x2cda60[_0x387b('0x3d')]);return db[_0x387b('0x2b')]['find'](_0x2d8c87)[_0x387b('0x24')](handleEntityNotFound(_0x1020c0,null))[_0x387b('0x24')](respondWithResult(_0x1020c0,null))['catch'](handleError(_0x1020c0,null));};exports[_0x387b('0x46')]=function(_0x348e36,_0x4859d2){return db[_0x387b('0x2b')][_0x387b('0x46')](_0x348e36['body'],{})[_0x387b('0x24')](respondWithResult(_0x4859d2,0xc9))[_0x387b('0x42')](handleError(_0x4859d2,null));};exports['update']=function(_0x5f14c7,_0x525b08){if(_0x5f14c7[_0x387b('0x47')]['id']){delete _0x5f14c7[_0x387b('0x47')]['id'];}return db[_0x387b('0x2b')]['find']({'where':{'id':_0x5f14c7[_0x387b('0x48')]['id']}})['then'](handleEntityNotFound(_0x525b08,null))[_0x387b('0x24')](saveUpdates(_0x5f14c7[_0x387b('0x47')],null))[_0x387b('0x24')](respondWithResult(_0x525b08,null))[_0x387b('0x42')](handleError(_0x525b08,null));};exports[_0x387b('0x49')]=function(_0x541e3d,_0x91434){return db[_0x387b('0x2b')]['find']({'where':{'id':_0x541e3d['params']['id']}})[_0x387b('0x24')](handleEntityNotFound(_0x91434,null))['then'](removeEntity(_0x91434,null))['catch'](handleError(_0x91434,null));};exports[_0x387b('0x4a')]=function(_0x394068,_0x48ce06,_0x4daf0f){var _0x52a498={};var _0x108f75={};var _0x5c924b;var _0x1bf87c;return db[_0x387b('0x2b')][_0x387b('0x4b')]({'where':{'id':_0x394068[_0x387b('0x48')]['id']}})[_0x387b('0x24')](handleEntityNotFound(_0x48ce06,null))[_0x387b('0x24')](function(_0x88cb9f){if(_0x88cb9f){_0x5c924b=_0x88cb9f;_0x108f75[_0x387b('0x2f')]=_[_0x387b('0x44')](db['VtigerConfiguration'][_0x387b('0x45')]);_0x108f75['query']=_['keys'](_0x394068['query']);_0x108f75['filters']=_[_0x387b('0x33')](_0x108f75[_0x387b('0x2f')],_0x108f75['query']);_0x52a498[_0x387b('0x32')]=_[_0x387b('0x33')](_0x108f75[_0x387b('0x2f')],qs[_0x387b('0x34')](_0x394068[_0x387b('0x30')]['fields']));_0x52a498[_0x387b('0x32')]=_0x52a498[_0x387b('0x32')]['length']?_0x52a498[_0x387b('0x32')]:_0x108f75[_0x387b('0x2f')];_0x52a498[_0x387b('0x37')]=qs['sort'](_0x394068[_0x387b('0x30')]['sort']);_0x52a498[_0x387b('0x39')]=qs['filters'](_['pick'](_0x394068[_0x387b('0x30')],_0x108f75[_0x387b('0x31')]));if(_0x394068[_0x387b('0x30')][_0x387b('0x3a')]){_0x52a498['where']=_['merge'](_0x52a498[_0x387b('0x39')],{'$or':_[_0x387b('0x2a')](_0x52a498[_0x387b('0x32')],function(_0x27bf1b){var _0x1e14dd={};_0x1e14dd[_0x27bf1b]={'$like':'%'+_0x394068['query'][_0x387b('0x3a')]+'%'};return _0x1e14dd;})});}_0x52a498=_[_0x387b('0x3b')]({},_0x52a498,_0x394068[_0x387b('0x3d')]);return _0x5c924b[_0x387b('0x4a')](_0x52a498);}})[_0x387b('0x24')](function(_0x50b383){if(_0x50b383){_0x1bf87c=_0x50b383['length'];if(!_0x394068[_0x387b('0x30')][_0x387b('0x36')]('nolimit')){_0x52a498[_0x387b('0x1c')]=qs[_0x387b('0x1c')](_0x394068[_0x387b('0x30')][_0x387b('0x1c')]);_0x52a498['offset']=qs[_0x387b('0x1e')](_0x394068[_0x387b('0x30')]['offset']);}return _0x5c924b['getConfigurations'](_0x52a498);}})[_0x387b('0x24')](function(_0x22b519){if(_0x22b519){return _0x22b519?{'count':_0x1bf87c,'rows':_0x22b519}:null;}})[_0x387b('0x24')](respondWithResult(_0x48ce06,null))[_0x387b('0x42')](handleError(_0x48ce06,null));};exports['addConfiguration']=function(_0x3539c0,_0x46d7c8,_0x4c2676){if(_0x3539c0[_0x387b('0x47')]['id']){delete _0x3539c0[_0x387b('0x47')]['id'];}return db[_0x387b('0x2b')][_0x387b('0x4b')]({'where':{'id':_0x3539c0[_0x387b('0x48')]['id']}})[_0x387b('0x24')](handleEntityNotFound(_0x46d7c8,null))[_0x387b('0x24')](function(_0x2088e9){if(_0x2088e9){_0x3539c0[_0x387b('0x47')][_0x387b('0x4c')]=_0x2088e9['id'];_0x3539c0[_0x387b('0x47')][_0x387b('0x4d')]=integrations[_0x387b('0x4e')](_0x3539c0[_0x387b('0x47')][_0x387b('0x4f')],_0x3539c0[_0x387b('0x47')]['type']);_0x3539c0['body'][_0x387b('0x50')]=integrations[_0x387b('0x51')](_0x3539c0[_0x387b('0x47')][_0x387b('0x4f')],_0x3539c0[_0x387b('0x47')][_0x387b('0x2d')]);return db['VtigerConfiguration'][_0x387b('0x46')](_0x3539c0[_0x387b('0x47')],{'include':[{'model':db['VtigerField'],'as':_0x387b('0x4d')},{'model':db['VtigerField'],'as':_0x387b('0x50')}]});}return null;})[_0x387b('0x24')](respondWithResult(_0x46d7c8,null))[_0x387b('0x42')](handleError(_0x46d7c8,null));};var md5=require(_0x387b('0x52'));exports[_0x387b('0x53')]=function(_0x3d0066,_0x1e9d0a,_0x60eb70){var _0x21ffca=null;var _0x1b5fea=null;var _0xe384bc=null;var _0x3a0116=null;var _0x4ca5c2='';return db[_0x387b('0x2b')][_0x387b('0x4b')]({'where':{'id':_0x3d0066[_0x387b('0x48')]['id']},'attributes':['id',_0x387b('0x28'),_0x387b('0x54'),_0x387b('0x55'),_0x387b('0x56'),_0x387b('0x57'),_0x387b('0x58'),_0x387b('0x59')]})[_0x387b('0x24')](handleEntityNotFound(_0x1e9d0a,null))[_0x387b('0x24')](function(_0x48aab8){if(_0x48aab8){_0x21ffca=_0x48aab8[_0x387b('0x54')];_0x1b5fea=_0x48aab8[_0x387b('0x59')];_0xe384bc=_0x48aab8[_0x387b('0x56')];_0x4ca5c2=_0x48aab8[_0x387b('0x57')];var _0x20ea13=_0x4ca5c2[_0x387b('0x5a')](-0x1);if(_0x20ea13==='/'){_0x4ca5c2=_0x4ca5c2[_0x387b('0x5b')](0x0,_0x4ca5c2[_0x387b('0x5c')](_0x20ea13));}_0x3a0116=util[_0x387b('0x5d')](_0x387b('0x5e'),_0x4ca5c2);var _0x42562d={'method':_0x387b('0x5f'),'uri':_0x3a0116,'qs':{'operation':_0x387b('0x60'),'username':_0x48aab8[_0x387b('0x54')]},'json':!![]};return rp(_0x42562d);}})[_0x387b('0x24')](function(_0x2486bf){if(_0x2486bf[_0x387b('0x61')]){var _0x125ca2={'method':_0x387b('0x62'),'uri':_0x3a0116,'form':{'operation':_0x387b('0x63'),'username':_0x21ffca,'accessKey':md5(_0x2486bf[_0x387b('0x64')]['token']+_0x1b5fea)},'json':!![]};return rp(_0x125ca2);}})['then'](function(_0x32f41c){if(_0x32f41c[_0x387b('0x61')]){var _0x4aa0e9={'method':_0x387b('0x5f'),'uri':_0x3a0116,'qs':{'operation':_0x387b('0x65'),'username':_0x21ffca,'sessionName':_0x32f41c['result'][_0x387b('0x66')],'elementType':_0xe384bc},'json':!![]};return rp(_0x4aa0e9);}})[_0x387b('0x24')](function(_0x56511c){if(_0x56511c[_0x387b('0x61')]){var _0x3afefc=[_0x387b('0x67'),_0x387b('0x68'),'owner'];_['remove'](_0x56511c[_0x387b('0x64')][_0x387b('0x34')],function(_0x23aaa5){return _0x3afefc[_0x387b('0x69')](_0x23aaa5[_0x387b('0x2d')][_0x387b('0x28')]);});_[_0x387b('0x6a')](_0x56511c[_0x387b('0x64')][_0x387b('0x34')],function(_0x1f55fa){return _0x1f55fa[_0x387b('0x6b')]===_0x387b('0x6c');});return{'count':_0x56511c[_0x387b('0x64')][_0x387b('0x34')][_0x387b('0x35')],'rows':_[_0x387b('0x2a')](_0x56511c[_0x387b('0x64')][_0x387b('0x34')],function(_0x59cffb){return{'id':_0x59cffb['name'],'name':_0x59cffb['label'],'custom':_['startsWith'](_0x59cffb['name'],_0x387b('0x6d'))?!![]:![],'options':_0x59cffb['type']['name']===_0x387b('0x6e')&&_0x59cffb[_0x387b('0x2d')][_0x387b('0x6f')][_0x387b('0x35')]>0x0?_[_0x387b('0x2a')](_0x59cffb['type']['picklistValues'],function(_0x4e87fb){return{'name':_0x4e87fb[_0x387b('0x70')],'value':_0x4e87fb[_0x387b('0x71')]};}):[]};})};}})[_0x387b('0x24')](respondWithResult(_0x1e9d0a,null))[_0x387b('0x42')](function(_0x4ca365){console[_0x387b('0x72')](_0x387b('0x73')+_0x4ca365);var _0x20d680=_0x3d0066[_0x387b('0x30')][_0x387b('0x74')]?0x1f4:_0x4ca365['statusCode']||0x1f4;logger['error'](_0x387b('0x75'),_0x387b('0x53'),_0x20d680,JSON['stringify'](_0x4ca365));delete _0x4ca365[_0x387b('0x28')];if(_0x20d680===0x191){_0x20d680=0x190;}_0x1e9d0a[_0x387b('0x1a')](_0x20d680)['send'](_0x3d0066[_0x387b('0x30')]['test']?{'message':_0x387b('0x76'),'statusCode':_0x4ca365[_0x387b('0x77')]}:_0x4ca365);});}; \ No newline at end of file +var _0xd262=['GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','label','startsWith','picklist','picklistValues','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','length','options','body','params','find','getConfigurations','filter','findOne','AccountId','getSubjects','channel','Descriptions','VtigerConfiguration','create','Subjects','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','%s/webservice.php'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd262,0x10a));var _0x2d26=function(_0xa3151d,_0x299c57){_0xa3151d=_0xa3151d-0x0;var _0x78de41=_0xd262[_0xa3151d];return _0x78de41;};'use strict';var emlformat=require(_0x2d26('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d26('0x1'));var rp=require(_0x2d26('0x2'));var moment=require('moment');var BPromise=require(_0x2d26('0x3'));var Mustache=require(_0x2d26('0x4'));var util=require('util');var path=require(_0x2d26('0x5'));var sox=require(_0x2d26('0x6'));var csv=require(_0x2d26('0x7'));var ejs=require(_0x2d26('0x8'));var fs=require('fs');var fs_extra=require(_0x2d26('0x9'));var _=require(_0x2d26('0xa'));var squel=require(_0x2d26('0xb'));var crypto=require('crypto');var jsforce=require(_0x2d26('0xc'));var deskjs=require(_0x2d26('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2d26('0xe'));var Papa=require(_0x2d26('0xf'));var Redis=require(_0x2d26('0x10'));var authService=require(_0x2d26('0x11'));var qs=require(_0x2d26('0x12'));var as=require(_0x2d26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d26('0x14'))(_0x2d26('0x15'));var utils=require(_0x2d26('0x16'));var config=require(_0x2d26('0x17'));var licenseUtil=require(_0x2d26('0x18'));var db=require(_0x2d26('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4d8621,_0x31962e){_0x31962e=_0x31962e||0xcc;return function(_0x45a7c4){if(_0x45a7c4){return _0x4d8621[_0x2d26('0x1a')](_0x31962e);}return _0x4d8621[_0x2d26('0x1b')](_0x31962e)[_0x2d26('0x1c')]();};}function respondWithResult(_0x19ee66,_0x421665){_0x421665=_0x421665||0xc8;return function(_0x533982){if(_0x533982){return _0x19ee66[_0x2d26('0x1b')](_0x421665)[_0x2d26('0x1d')](_0x533982);}};}function respondWithFilteredResult(_0x2d0322,_0xedea60){return function(_0x1345d8){if(_0x1345d8){var _0x176a82=typeof _0xedea60[_0x2d26('0x1e')]===_0x2d26('0x1f')&&typeof _0xedea60[_0x2d26('0x20')]==='undefined';var _0x1a7d14=_0x1345d8['count'];var _0x29d19b=_0x176a82?0x0:_0xedea60[_0x2d26('0x1e')];var _0x2a120a=_0x176a82?_0x1345d8[_0x2d26('0x21')]:_0xedea60[_0x2d26('0x1e')]+_0xedea60['limit'];var _0x5b2a48;if(_0x2a120a>=_0x1a7d14){_0x2a120a=_0x1a7d14;_0x5b2a48=0xc8;}else{_0x5b2a48=0xce;}_0x2d0322['status'](_0x5b2a48);return _0x2d0322['set'](_0x2d26('0x22'),_0x29d19b+'-'+_0x2a120a+'/'+_0x1a7d14)[_0x2d26('0x1d')](_0x1345d8);}return null;};}function patchUpdates(_0x175b6c){return function(_0x5a002d){try{jsonpatch[_0x2d26('0x23')](_0x5a002d,_0x175b6c,!![]);}catch(_0x567345){return BPromise['reject'](_0x567345);}return _0x5a002d[_0x2d26('0x24')]();};}function saveUpdates(_0x320cec,_0x587f09){return function(_0x49e46c){if(_0x49e46c){return _0x49e46c[_0x2d26('0x25')](_0x320cec)[_0x2d26('0x26')](function(_0x2503a2){return _0x2503a2;});}return null;};}function removeEntity(_0x11a187,_0x27e938){return function(_0xefaaa5){if(_0xefaaa5){return _0xefaaa5[_0x2d26('0x27')]()[_0x2d26('0x26')](function(){_0x11a187['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8b66,_0x2a33a1){return function(_0x510876){if(!_0x510876){_0x5e8b66[_0x2d26('0x1a')](0x194);}return _0x510876;};}function handleError(_0x4e67ac,_0x3b5107){_0x3b5107=_0x3b5107||0x1f4;return function(_0x2d22c3){logger[_0x2d26('0x28')](_0x2d22c3[_0x2d26('0x29')]);if(_0x2d22c3['name']){delete _0x2d22c3[_0x2d26('0x2a')];}_0x4e67ac[_0x2d26('0x1b')](_0x3b5107)[_0x2d26('0x2b')](_0x2d22c3);};}exports[_0x2d26('0x2c')]=function(_0xa4d15c,_0x29e56a){var _0x56dfcc={},_0xb2252e={},_0x23a431={'count':0x0,'rows':[]};var _0x121c3e=_[_0x2d26('0x2d')](db[_0x2d26('0x2e')]['rawAttributes'],function(_0x5190cc){return{'name':_0x5190cc[_0x2d26('0x2f')],'type':_0x5190cc[_0x2d26('0x30')]['key']};});_0xb2252e[_0x2d26('0x31')]=_['map'](_0x121c3e,_0x2d26('0x2a'));_0xb2252e[_0x2d26('0x32')]=_[_0x2d26('0x33')](_0xa4d15c[_0x2d26('0x32')]);_0xb2252e['filters']=_[_0x2d26('0x34')](_0xb2252e[_0x2d26('0x31')],_0xb2252e[_0x2d26('0x32')]);_0x56dfcc['attributes']=_[_0x2d26('0x34')](_0xb2252e[_0x2d26('0x31')],qs[_0x2d26('0x35')](_0xa4d15c[_0x2d26('0x32')]['fields']));_0x56dfcc[_0x2d26('0x36')]=_0x56dfcc[_0x2d26('0x36')]['length']?_0x56dfcc[_0x2d26('0x36')]:_0xb2252e[_0x2d26('0x31')];if(!_0xa4d15c['query'][_0x2d26('0x37')](_0x2d26('0x38'))){_0x56dfcc[_0x2d26('0x20')]=qs[_0x2d26('0x20')](_0xa4d15c[_0x2d26('0x32')][_0x2d26('0x20')]);_0x56dfcc[_0x2d26('0x1e')]=qs[_0x2d26('0x1e')](_0xa4d15c[_0x2d26('0x32')][_0x2d26('0x1e')]);}_0x56dfcc[_0x2d26('0x39')]=qs[_0x2d26('0x3a')](_0xa4d15c['query'][_0x2d26('0x3a')]);_0x56dfcc['where']=qs[_0x2d26('0x3b')](_[_0x2d26('0x3c')](_0xa4d15c['query'],_0xb2252e[_0x2d26('0x3b')]),_0x121c3e);if(_0xa4d15c[_0x2d26('0x32')]['filter']){_0x56dfcc[_0x2d26('0x3d')]=_[_0x2d26('0x3e')](_0x56dfcc[_0x2d26('0x3d')],{'$or':_[_0x2d26('0x2d')](_0x121c3e,function(_0x1a71f2){if(_0x1a71f2[_0x2d26('0x30')]!==_0x2d26('0x3f')){var _0x565cc7={};_0x565cc7[_0x1a71f2[_0x2d26('0x2a')]]={'$like':'%'+_0xa4d15c[_0x2d26('0x32')]['filter']+'%'};return _0x565cc7;}})});}_0x56dfcc=_[_0x2d26('0x3e')]({},_0x56dfcc,_0xa4d15c['options']);var _0x2cd62d={'where':_0x56dfcc[_0x2d26('0x3d')]};return db[_0x2d26('0x2e')][_0x2d26('0x21')](_0x2cd62d)['then'](function(_0x592479){_0x23a431[_0x2d26('0x21')]=_0x592479;if(_0xa4d15c['query'][_0x2d26('0x40')]){_0x56dfcc[_0x2d26('0x41')]=[{'all':!![]}];}return db[_0x2d26('0x2e')]['findAll'](_0x56dfcc);})[_0x2d26('0x26')](function(_0x70b907){_0x23a431[_0x2d26('0x42')]=_0x70b907;return _0x23a431;})[_0x2d26('0x26')](respondWithFilteredResult(_0x29e56a,_0x56dfcc))[_0x2d26('0x43')](handleError(_0x29e56a,null));};exports[_0x2d26('0x44')]=function(_0x41d1af,_0xbb4951){var _0x5d5011={'raw':![],'where':{'id':_0x41d1af['params']['id']}},_0x275bb5={};_0x275bb5[_0x2d26('0x31')]=_[_0x2d26('0x33')](db[_0x2d26('0x2e')][_0x2d26('0x45')]);_0x275bb5[_0x2d26('0x32')]=_[_0x2d26('0x33')](_0x41d1af[_0x2d26('0x32')]);_0x275bb5['filters']=_[_0x2d26('0x34')](_0x275bb5[_0x2d26('0x31')],_0x275bb5[_0x2d26('0x32')]);_0x5d5011[_0x2d26('0x36')]=_['intersection'](_0x275bb5[_0x2d26('0x31')],qs[_0x2d26('0x35')](_0x41d1af[_0x2d26('0x32')]['fields']));_0x5d5011['attributes']=_0x5d5011[_0x2d26('0x36')][_0x2d26('0x46')]?_0x5d5011[_0x2d26('0x36')]:_0x275bb5[_0x2d26('0x31')];if(_0x41d1af[_0x2d26('0x32')]['includeAll']){_0x5d5011[_0x2d26('0x41')]=[{'all':!![]}];}_0x5d5011=_[_0x2d26('0x3e')]({},_0x5d5011,_0x41d1af[_0x2d26('0x47')]);return db[_0x2d26('0x2e')]['find'](_0x5d5011)['then'](handleEntityNotFound(_0xbb4951,null))[_0x2d26('0x26')](respondWithResult(_0xbb4951,null))[_0x2d26('0x43')](handleError(_0xbb4951,null));};exports['create']=function(_0x5bfd10,_0xaf82b4){return db['VtigerAccount']['create'](_0x5bfd10['body'],{})[_0x2d26('0x26')](respondWithResult(_0xaf82b4,0xc9))[_0x2d26('0x43')](handleError(_0xaf82b4,null));};exports[_0x2d26('0x25')]=function(_0x1d75e0,_0x5ded24){if(_0x1d75e0[_0x2d26('0x48')]['id']){delete _0x1d75e0[_0x2d26('0x48')]['id'];}return db[_0x2d26('0x2e')]['find']({'where':{'id':_0x1d75e0[_0x2d26('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ded24,null))[_0x2d26('0x26')](saveUpdates(_0x1d75e0[_0x2d26('0x48')],null))[_0x2d26('0x26')](respondWithResult(_0x5ded24,null))['catch'](handleError(_0x5ded24,null));};exports[_0x2d26('0x27')]=function(_0x4282f2,_0x462429){return db['VtigerAccount'][_0x2d26('0x4a')]({'where':{'id':_0x4282f2[_0x2d26('0x49')]['id']}})[_0x2d26('0x26')](handleEntityNotFound(_0x462429,null))[_0x2d26('0x26')](removeEntity(_0x462429,null))[_0x2d26('0x43')](handleError(_0x462429,null));};exports[_0x2d26('0x4b')]=function(_0x563801,_0x36e1ec,_0x1a46f0){var _0xbf735={};var _0x1c98be={};var _0x43588d;var _0x5a0622;return db['VtigerAccount']['findOne']({'where':{'id':_0x563801['params']['id']}})['then'](handleEntityNotFound(_0x36e1ec,null))[_0x2d26('0x26')](function(_0x5be90b){if(_0x5be90b){_0x43588d=_0x5be90b;_0x1c98be[_0x2d26('0x31')]=_['keys'](db['VtigerConfiguration'][_0x2d26('0x45')]);_0x1c98be['query']=_['keys'](_0x563801[_0x2d26('0x32')]);_0x1c98be['filters']=_[_0x2d26('0x34')](_0x1c98be['model'],_0x1c98be[_0x2d26('0x32')]);_0xbf735['attributes']=_['intersection'](_0x1c98be['model'],qs[_0x2d26('0x35')](_0x563801[_0x2d26('0x32')][_0x2d26('0x35')]));_0xbf735['attributes']=_0xbf735[_0x2d26('0x36')][_0x2d26('0x46')]?_0xbf735[_0x2d26('0x36')]:_0x1c98be[_0x2d26('0x31')];_0xbf735[_0x2d26('0x39')]=qs[_0x2d26('0x3a')](_0x563801[_0x2d26('0x32')][_0x2d26('0x3a')]);_0xbf735[_0x2d26('0x3d')]=qs['filters'](_[_0x2d26('0x3c')](_0x563801['query'],_0x1c98be[_0x2d26('0x3b')]));if(_0x563801[_0x2d26('0x32')][_0x2d26('0x4c')]){_0xbf735['where']=_['merge'](_0xbf735['where'],{'$or':_[_0x2d26('0x2d')](_0xbf735[_0x2d26('0x36')],function(_0x10b89d){var _0xcc8eb2={};_0xcc8eb2[_0x10b89d]={'$like':'%'+_0x563801[_0x2d26('0x32')][_0x2d26('0x4c')]+'%'};return _0xcc8eb2;})});}_0xbf735=_[_0x2d26('0x3e')]({},_0xbf735,_0x563801[_0x2d26('0x47')]);return _0x43588d['getConfigurations'](_0xbf735);}})[_0x2d26('0x26')](function(_0x38383d){if(_0x38383d){_0x5a0622=_0x38383d[_0x2d26('0x46')];if(!_0x563801[_0x2d26('0x32')]['hasOwnProperty'](_0x2d26('0x38'))){_0xbf735[_0x2d26('0x20')]=qs['limit'](_0x563801[_0x2d26('0x32')][_0x2d26('0x20')]);_0xbf735[_0x2d26('0x1e')]=qs[_0x2d26('0x1e')](_0x563801[_0x2d26('0x32')][_0x2d26('0x1e')]);}return _0x43588d[_0x2d26('0x4b')](_0xbf735);}})[_0x2d26('0x26')](function(_0x58eeac){if(_0x58eeac){return _0x58eeac?{'count':_0x5a0622,'rows':_0x58eeac}:null;}})[_0x2d26('0x26')](respondWithResult(_0x36e1ec,null))['catch'](handleError(_0x36e1ec,null));};exports['addConfiguration']=function(_0x5aef5c,_0x321891,_0x3d6476){if(_0x5aef5c[_0x2d26('0x48')]['id']){delete _0x5aef5c[_0x2d26('0x48')]['id'];}return db[_0x2d26('0x2e')][_0x2d26('0x4d')]({'where':{'id':_0x5aef5c[_0x2d26('0x49')]['id']}})[_0x2d26('0x26')](handleEntityNotFound(_0x321891,null))['then'](function(_0x113ef2){if(_0x113ef2){_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x4e')]=_0x113ef2['id'];_0x5aef5c[_0x2d26('0x48')]['Subjects']=integrations[_0x2d26('0x4f')](_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x50')],_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x30')]);_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x51')]=integrations['getDescriptions'](_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x50')],_0x5aef5c[_0x2d26('0x48')][_0x2d26('0x30')]);return db[_0x2d26('0x52')][_0x2d26('0x53')](_0x5aef5c[_0x2d26('0x48')],{'include':[{'model':db['VtigerField'],'as':_0x2d26('0x54')},{'model':db[_0x2d26('0x55')],'as':'Descriptions'}]});}return null;})[_0x2d26('0x26')](respondWithResult(_0x321891,null))[_0x2d26('0x43')](handleError(_0x321891,null));};var md5=require(_0x2d26('0x56'));exports[_0x2d26('0x57')]=function(_0x473d0d,_0xd5890b,_0x34fbb6){var _0x161e42=null;var _0x483c63=null;var _0xfba5b4=null;var _0x368cd7=null;var _0x2a0e8f='';return db[_0x2d26('0x2e')]['findOne']({'where':{'id':_0x473d0d['params']['id']},'attributes':['id',_0x2d26('0x2a'),_0x2d26('0x58'),_0x2d26('0x59'),_0x2d26('0x5a'),_0x2d26('0x5b'),_0x2d26('0x5c'),'accessKey']})['then'](handleEntityNotFound(_0xd5890b,null))[_0x2d26('0x26')](function(_0x51496e){if(_0x51496e){_0x161e42=_0x51496e[_0x2d26('0x58')];_0x483c63=_0x51496e[_0x2d26('0x5d')];_0xfba5b4=_0x51496e[_0x2d26('0x5a')];_0x2a0e8f=_0x51496e[_0x2d26('0x5b')];var _0x431421=_0x2a0e8f[_0x2d26('0x5e')](-0x1);if(_0x431421==='/'){_0x2a0e8f=_0x2a0e8f['substring'](0x0,_0x2a0e8f[_0x2d26('0x5f')](_0x431421));}_0x368cd7=util['format'](_0x2d26('0x60'),_0x2a0e8f);var _0x405ea8={'method':_0x2d26('0x61'),'uri':_0x368cd7,'qs':{'operation':_0x2d26('0x62'),'username':_0x51496e[_0x2d26('0x58')]},'json':!![]};return rp(_0x405ea8);}})[_0x2d26('0x26')](function(_0x4fe774){if(_0x4fe774[_0x2d26('0x63')]){var _0x150298={'method':_0x2d26('0x64'),'uri':_0x368cd7,'form':{'operation':_0x2d26('0x65'),'username':_0x161e42,'accessKey':md5(_0x4fe774[_0x2d26('0x66')][_0x2d26('0x67')]+_0x483c63)},'json':!![]};return rp(_0x150298);}})[_0x2d26('0x26')](function(_0x2ec7d5){if(_0x2ec7d5[_0x2d26('0x63')]){var _0x175bd7={'method':_0x2d26('0x61'),'uri':_0x368cd7,'qs':{'operation':_0x2d26('0x68'),'username':_0x161e42,'sessionName':_0x2ec7d5[_0x2d26('0x66')][_0x2d26('0x69')],'elementType':_0xfba5b4},'json':!![]};return rp(_0x175bd7);}})[_0x2d26('0x26')](function(_0x20a685){if(_0x20a685[_0x2d26('0x63')]){var _0x141404=[_0x2d26('0x6a'),_0x2d26('0x6b'),'owner'];_[_0x2d26('0x6c')](_0x20a685[_0x2d26('0x66')]['fields'],function(_0x5a97d1){return _0x141404[_0x2d26('0x6d')](_0x5a97d1['type']['name']);});_[_0x2d26('0x6c')](_0x20a685['result']['fields'],function(_0x19ecd1){return _0x19ecd1[_0x2d26('0x6e')]==='false';});return{'count':_0x20a685[_0x2d26('0x66')]['fields'][_0x2d26('0x46')],'rows':_[_0x2d26('0x2d')](_0x20a685[_0x2d26('0x66')][_0x2d26('0x35')],function(_0xa99d56){return{'id':_0xa99d56['name'],'name':_0xa99d56[_0x2d26('0x6f')],'custom':_[_0x2d26('0x70')](_0xa99d56[_0x2d26('0x2a')],'cf_')?!![]:![],'options':_0xa99d56[_0x2d26('0x30')][_0x2d26('0x2a')]===_0x2d26('0x71')&&_0xa99d56[_0x2d26('0x30')]['picklistValues'][_0x2d26('0x46')]>0x0?_[_0x2d26('0x2d')](_0xa99d56[_0x2d26('0x30')][_0x2d26('0x72')],function(_0x40c246){return{'name':_0x40c246[_0x2d26('0x6f')],'value':_0x40c246[_0x2d26('0x73')]};}):[]};})};}})[_0x2d26('0x26')](respondWithResult(_0xd5890b,null))[_0x2d26('0x43')](function(_0xf5426c){console['log']('vTiger\x20error:\x20'+_0xf5426c);var _0x14c4e3=_0x473d0d[_0x2d26('0x32')]['test']?0x1f4:_0xf5426c[_0x2d26('0x74')]||0x1f4;logger['error'](_0x2d26('0x75'),_0x2d26('0x57'),_0x14c4e3,JSON[_0x2d26('0x76')](_0xf5426c));delete _0xf5426c['name'];if(_0x14c4e3===0x191){_0x14c4e3=0x190;}_0xd5890b['status'](_0x14c4e3)[_0x2d26('0x2b')](_0x473d0d['query'][_0x2d26('0x77')]?{'message':_0x2d26('0x78'),'statusCode':_0xf5426c['statusCode']}:_0xf5426c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 078950e..a47b3a6 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 _0x0457=['moment','bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','util','api'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x0457,0x82));var _0x7045=function(_0x38cb4a,_0x14fe3d){_0x38cb4a=_0x38cb4a-0x0;var _0x7ef55b=_0x0457[_0x38cb4a];return _0x7ef55b;};'use strict';var _=require('lodash');var util=require(_0x7045('0x0'));var logger=require('../../config/logger')(_0x7045('0x1'));var moment=require(_0x7045('0x2'));var BPromise=require(_0x7045('0x3'));var rp=require(_0x7045('0x4'));var fs=require('fs');var path=require(_0x7045('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7045('0x6'));var integrations=require(_0x7045('0x7'));module[_0x7045('0x8')]=function(_0x357141,_0x839ddf){return _0x357141['define'](_0x7045('0x9'),attributes,{'tableName':_0x7045('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c0d=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7c0d,0x1a6));var _0xd7c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c0d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd7c0('0x0'));var util=require(_0xd7c0('0x1'));var logger=require('../../config/logger')(_0xd7c0('0x2'));var moment=require(_0xd7c0('0x3'));var BPromise=require(_0xd7c0('0x4'));var rp=require(_0xd7c0('0x5'));var fs=require('fs');var path=require(_0xd7c0('0x6'));var rimraf=require(_0xd7c0('0x7'));var config=require(_0xd7c0('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xd7c0('0x9'));module[_0xd7c0('0xa')]=function(_0x5ad78b,_0x547c8d){return _0x5ad78b[_0xd7c0('0xb')]('VtigerAccount',attributes,{'tableName':_0xd7c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1ad6f1b..6ded75f 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 _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe205,0xa7));var _0x5e20=function(_0x12dcc1,_0x56fccd){_0x12dcc1=_0x12dcc1-0x0;var _0x18643e=_0xe205[_0x12dcc1];return _0x18643e;};'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')]('VtigerAccount,\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')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\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);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','include','map','model','then','ShowVtigerAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0xcb91[_0x462fe4];return _0x82b23a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetVtigerAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['VtigerAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowVtigerAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b7849a2..46ddfbe 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 _0x6f71=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','/:id','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x6f71,0x176));var _0x16f7=function(_0x43e4b5,_0x25ccef){_0x43e4b5=_0x43e4b5-0x0;var _0x51002f=_0x6f71[_0x43e4b5];return _0x51002f;};'use strict';var multer=require(_0x16f7('0x0'));var util=require(_0x16f7('0x1'));var path=require(_0x16f7('0x2'));var timeout=require(_0x16f7('0x3'));var express=require(_0x16f7('0x4'));var router=express[_0x16f7('0x5')]();var fs_extra=require(_0x16f7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x16f7('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x16f7('0x8')](),controller['index']);router['get'](_0x16f7('0x9'),auth[_0x16f7('0x8')](),controller['show']);router['get'](_0x16f7('0xa'),auth['isAuthenticated'](),controller[_0x16f7('0xb')]);router[_0x16f7('0xc')](_0x16f7('0xd'),auth['isAuthenticated'](),controller[_0x16f7('0xe')]);router[_0x16f7('0xc')](_0x16f7('0xf'),auth[_0x16f7('0x8')](),controller[_0x16f7('0x10')]);router[_0x16f7('0x11')]('/',auth['isAuthenticated'](),controller[_0x16f7('0x12')]);router[_0x16f7('0x13')](_0x16f7('0x9'),auth['isAuthenticated'](),controller[_0x16f7('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x16f7('0x15')]=router; \ No newline at end of file +var _0x510e=['create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','post'];(function(_0x26b2b3,_0x2fcba7){var _0x3ee842=function(_0x3c1474){while(--_0x3c1474){_0x26b2b3['push'](_0x26b2b3['shift']());}};_0x3ee842(++_0x2fcba7);}(_0x510e,0x1a4));var _0xe510=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x510e[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var path=require(_0xe510('0x2'));var timeout=require(_0xe510('0x3'));var express=require('express');var router=express[_0xe510('0x4')]();var fs_extra=require(_0xe510('0x5'));var auth=require(_0xe510('0x6'));var interaction=require(_0xe510('0x7'));var config=require(_0xe510('0x8'));var controller=require(_0xe510('0x9'));router['get']('/',auth[_0xe510('0xa')](),controller[_0xe510('0xb')]);router[_0xe510('0xc')]('/:id',auth[_0xe510('0xa')](),controller[_0xe510('0xd')]);router[_0xe510('0xc')](_0xe510('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xe510('0xc')](_0xe510('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe510('0xc')]('/:id/descriptions',auth[_0xe510('0xa')](),controller['getDescriptions']);router[_0xe510('0x10')]('/',auth[_0xe510('0xa')](),controller[_0xe510('0x11')]);router[_0xe510('0x12')](_0xe510('0x13'),auth[_0xe510('0xa')](),controller[_0xe510('0x14')]);router[_0xe510('0x15')](_0xe510('0x13'),auth[_0xe510('0xa')](),controller['destroy']);module[_0xe510('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index dad5434..26a8c48 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 _0xaea9=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaea9,0xaf));var _0x9aea=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xaea9[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x9aea('0x0'));module[_0x9aea('0x1')]={'name':{'type':Sequelize[_0x9aea('0x2')]},'description':{'type':Sequelize[_0x9aea('0x2')]}}; \ No newline at end of file +var _0x37bf=['STRING'];(function(_0x34bb20,_0x4349cb){var _0x44f853=function(_0x173bf1){while(--_0x173bf1){_0x34bb20['push'](_0x34bb20['shift']());}};_0x44f853(++_0x4349cb);}(_0x37bf,0xc8));var _0xf37b=function(_0x800d4e,_0x4d2498){_0x800d4e=_0x800d4e-0x0;var _0x34abbb=_0x37bf[_0x800d4e];return _0x34abbb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf37b('0x0')]},'description':{'type':Sequelize[_0xf37b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 031c85d..cd73a21 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 _0xcef6=['../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','getSubjects','VtigerField','hasOwnProperty','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x5808e6,_0x5b0124){var _0x3cbe26=function(_0x3b6f95){while(--_0x3b6f95){_0x5808e6['push'](_0x5808e6['shift']());}};_0x3cbe26(++_0x5b0124);}(_0xcef6,0x16e));var _0x6cef=function(_0x4c9f70,_0x53990b){_0x4c9f70=_0x4c9f70-0x0;var _0x3b1dd9=_0xcef6[_0x4c9f70];return _0x3b1dd9;};'use strict';var emlformat=require(_0x6cef('0x0'));var rimraf=require(_0x6cef('0x1'));var zipdir=require(_0x6cef('0x2'));var jsonpatch=require(_0x6cef('0x3'));var rp=require(_0x6cef('0x4'));var moment=require(_0x6cef('0x5'));var BPromise=require(_0x6cef('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6cef('0x7'));var sox=require(_0x6cef('0x8'));var csv=require(_0x6cef('0x9'));var ejs=require(_0x6cef('0xa'));var fs=require('fs');var fs_extra=require(_0x6cef('0xb'));var _=require(_0x6cef('0xc'));var squel=require(_0x6cef('0xd'));var crypto=require(_0x6cef('0xe'));var jsforce=require(_0x6cef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6cef('0x9'));var querystring=require(_0x6cef('0x10'));var Papa=require('papaparse');var Redis=require(_0x6cef('0x11'));var authService=require(_0x6cef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6cef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6cef('0x14'));var utils=require('../../config/utils');var config=require(_0x6cef('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587586,_0x4a9666){_0x4a9666=_0x4a9666||0xcc;return function(_0x2b6268){if(_0x2b6268){return _0x587586[_0x6cef('0x16')](_0x4a9666);}return _0x587586[_0x6cef('0x17')](_0x4a9666)[_0x6cef('0x18')]();};}function respondWithResult(_0x669ffa,_0x4b7623){_0x4b7623=_0x4b7623||0xc8;return function(_0x2c7195){if(_0x2c7195){return _0x669ffa['status'](_0x4b7623)['json'](_0x2c7195);}};}function respondWithFilteredResult(_0x3a93fe,_0x592641){return function(_0x4dbd80){if(_0x4dbd80){var _0x1483bd=typeof _0x592641['offset']===_0x6cef('0x19')&&typeof _0x592641[_0x6cef('0x1a')]===_0x6cef('0x19');var _0x1cd11b=_0x4dbd80['count'];var _0x5b8b23=_0x1483bd?0x0:_0x592641['offset'];var _0x4412e1=_0x1483bd?_0x4dbd80['count']:_0x592641[_0x6cef('0x1b')]+_0x592641[_0x6cef('0x1a')];var _0x506ff2;if(_0x4412e1>=_0x1cd11b){_0x4412e1=_0x1cd11b;_0x506ff2=0xc8;}else{_0x506ff2=0xce;}_0x3a93fe['status'](_0x506ff2);return _0x3a93fe[_0x6cef('0x1c')](_0x6cef('0x1d'),_0x5b8b23+'-'+_0x4412e1+'/'+_0x1cd11b)[_0x6cef('0x1e')](_0x4dbd80);}return null;};}function patchUpdates(_0x936773){return function(_0x31932d){try{jsonpatch[_0x6cef('0x1f')](_0x31932d,_0x936773,!![]);}catch(_0x3b767d){return BPromise[_0x6cef('0x20')](_0x3b767d);}return _0x31932d[_0x6cef('0x21')]();};}function saveUpdates(_0x104f76,_0x155412){return function(_0x13fed5){if(_0x13fed5){return _0x13fed5['update'](_0x104f76)[_0x6cef('0x22')](function(_0x482ffa){return _0x482ffa;});}return null;};}function removeEntity(_0x476528,_0x201607){return function(_0x32db43){if(_0x32db43){return _0x32db43[_0x6cef('0x23')]()[_0x6cef('0x22')](function(){_0x476528[_0x6cef('0x17')](0xcc)[_0x6cef('0x18')]();});}};}function handleEntityNotFound(_0x3f0406,_0x199999){return function(_0x562652){if(!_0x562652){_0x3f0406[_0x6cef('0x16')](0x194);}return _0x562652;};}function handleError(_0x13ff93,_0x508af1){_0x508af1=_0x508af1||0x1f4;return function(_0x41ac73){logger['error'](_0x41ac73[_0x6cef('0x24')]);if(_0x41ac73[_0x6cef('0x25')]){delete _0x41ac73[_0x6cef('0x25')];}_0x13ff93[_0x6cef('0x17')](_0x508af1)['send'](_0x41ac73);};}exports[_0x6cef('0x26')]=function(_0x2e35d6,_0x471c8c){var _0x58f547={},_0x50027c={},_0x27b08a={'count':0x0,'rows':[]};var _0xe612bb=_[_0x6cef('0x27')](db[_0x6cef('0x28')][_0x6cef('0x29')],function(_0x552572){return{'name':_0x552572[_0x6cef('0x2a')],'type':_0x552572['type'][_0x6cef('0x2b')]};});_0x50027c[_0x6cef('0x2c')]=_[_0x6cef('0x27')](_0xe612bb,_0x6cef('0x25'));_0x50027c['query']=_[_0x6cef('0x2d')](_0x2e35d6[_0x6cef('0x2e')]);_0x50027c[_0x6cef('0x2f')]=_['intersection'](_0x50027c[_0x6cef('0x2c')],_0x50027c[_0x6cef('0x2e')]);_0x58f547[_0x6cef('0x30')]=_[_0x6cef('0x31')](_0x50027c[_0x6cef('0x2c')],qs[_0x6cef('0x32')](_0x2e35d6['query'][_0x6cef('0x32')]));_0x58f547[_0x6cef('0x30')]=_0x58f547[_0x6cef('0x30')][_0x6cef('0x33')]?_0x58f547[_0x6cef('0x30')]:_0x50027c['model'];if(!_0x2e35d6[_0x6cef('0x2e')]['hasOwnProperty']('nolimit')){_0x58f547[_0x6cef('0x1a')]=qs['limit'](_0x2e35d6[_0x6cef('0x2e')][_0x6cef('0x1a')]);_0x58f547[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0x2e35d6[_0x6cef('0x2e')][_0x6cef('0x1b')]);}_0x58f547[_0x6cef('0x34')]=qs[_0x6cef('0x35')](_0x2e35d6['query'][_0x6cef('0x35')]);_0x58f547[_0x6cef('0x36')]=qs['filters'](_[_0x6cef('0x37')](_0x2e35d6[_0x6cef('0x2e')],_0x50027c[_0x6cef('0x2f')]),_0xe612bb);if(_0x2e35d6['query'][_0x6cef('0x38')]){_0x58f547[_0x6cef('0x36')]=_['merge'](_0x58f547[_0x6cef('0x36')],{'$or':_[_0x6cef('0x27')](_0xe612bb,function(_0x4f6082){if(_0x4f6082['type']!==_0x6cef('0x39')){var _0x576627={};_0x576627[_0x4f6082['name']]={'$like':'%'+_0x2e35d6[_0x6cef('0x2e')]['filter']+'%'};return _0x576627;}})});}_0x58f547=_[_0x6cef('0x3a')]({},_0x58f547,_0x2e35d6[_0x6cef('0x3b')]);var _0x10fcdc={'where':_0x58f547[_0x6cef('0x36')]};return db['VtigerConfiguration'][_0x6cef('0x3c')](_0x10fcdc)[_0x6cef('0x22')](function(_0x374483){_0x27b08a[_0x6cef('0x3c')]=_0x374483;if(_0x2e35d6[_0x6cef('0x2e')]['includeAll']){_0x58f547['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x6cef('0x3d')](_0x58f547);})[_0x6cef('0x22')](function(_0x5a820a){_0x27b08a[_0x6cef('0x3e')]=_0x5a820a;return _0x27b08a;})[_0x6cef('0x22')](respondWithFilteredResult(_0x471c8c,_0x58f547))[_0x6cef('0x3f')](handleError(_0x471c8c,null));};exports[_0x6cef('0x40')]=function(_0x54f23f,_0xb9e29){var _0x386800={'raw':![],'where':{'id':_0x54f23f[_0x6cef('0x41')]['id']}},_0x52523e={};_0x52523e[_0x6cef('0x2c')]=_[_0x6cef('0x2d')](db[_0x6cef('0x28')][_0x6cef('0x29')]);_0x52523e[_0x6cef('0x2e')]=_[_0x6cef('0x2d')](_0x54f23f[_0x6cef('0x2e')]);_0x52523e[_0x6cef('0x2f')]=_['intersection'](_0x52523e[_0x6cef('0x2c')],_0x52523e['query']);_0x386800['attributes']=_['intersection'](_0x52523e[_0x6cef('0x2c')],qs['fields'](_0x54f23f[_0x6cef('0x2e')][_0x6cef('0x32')]));_0x386800[_0x6cef('0x30')]=_0x386800['attributes'][_0x6cef('0x33')]?_0x386800[_0x6cef('0x30')]:_0x52523e[_0x6cef('0x2c')];if(_0x54f23f[_0x6cef('0x2e')]['includeAll']){_0x386800['include']=[{'all':!![]}];}_0x386800=_[_0x6cef('0x3a')]({},_0x386800,_0x54f23f[_0x6cef('0x3b')]);return db['VtigerConfiguration'][_0x6cef('0x42')](_0x386800)['then'](handleEntityNotFound(_0xb9e29,null))[_0x6cef('0x22')](respondWithResult(_0xb9e29,null))[_0x6cef('0x3f')](handleError(_0xb9e29,null));};exports[_0x6cef('0x43')]=function(_0x3ce2dc,_0x69278b){return db[_0x6cef('0x28')][_0x6cef('0x43')](_0x3ce2dc[_0x6cef('0x44')],{})[_0x6cef('0x22')](respondWithResult(_0x69278b,0xc9))['catch'](handleError(_0x69278b,null));};exports[_0x6cef('0x45')]=function(_0x4e6506,_0x5c83a4){if(_0x4e6506[_0x6cef('0x44')]['id']){delete _0x4e6506['body']['id'];}return db['VtigerConfiguration'][_0x6cef('0x42')]({'where':{'id':_0x4e6506['params']['id']}})[_0x6cef('0x22')](handleEntityNotFound(_0x5c83a4,null))['then'](saveUpdates(_0x4e6506[_0x6cef('0x44')],null))['then'](respondWithResult(_0x5c83a4,null))[_0x6cef('0x3f')](handleError(_0x5c83a4,null));};exports[_0x6cef('0x23')]=function(_0x3152e1,_0x3e17b1){return db['VtigerConfiguration']['find']({'where':{'id':_0x3152e1[_0x6cef('0x41')]['id']}})[_0x6cef('0x22')](handleEntityNotFound(_0x3e17b1,null))[_0x6cef('0x22')](removeEntity(_0x3e17b1,null))[_0x6cef('0x3f')](handleError(_0x3e17b1,null));};exports[_0x6cef('0x46')]=function(_0xb11764,_0x4b82f3,_0x5ceba9){var _0x2dffc2={};var _0x211359={};var _0x3b33a9;var _0x2ed7c0;return db[_0x6cef('0x28')][_0x6cef('0x47')]({'where':{'id':_0xb11764[_0x6cef('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b82f3,null))['then'](function(_0x57e78b){if(_0x57e78b){_0x3b33a9=_0x57e78b;_0x211359['model']=_[_0x6cef('0x2d')](db['VtigerField'][_0x6cef('0x29')]);_0x211359[_0x6cef('0x2e')]=_[_0x6cef('0x2d')](_0xb11764[_0x6cef('0x2e')]);_0x211359[_0x6cef('0x2f')]=_[_0x6cef('0x31')](_0x211359['model'],_0x211359[_0x6cef('0x2e')]);_0x2dffc2[_0x6cef('0x30')]=_[_0x6cef('0x31')](_0x211359[_0x6cef('0x2c')],qs[_0x6cef('0x32')](_0xb11764[_0x6cef('0x2e')][_0x6cef('0x32')]));_0x2dffc2[_0x6cef('0x30')]=_0x2dffc2[_0x6cef('0x30')][_0x6cef('0x33')]?_0x2dffc2[_0x6cef('0x30')]:_0x211359[_0x6cef('0x2c')];_0x2dffc2[_0x6cef('0x34')]=qs[_0x6cef('0x35')](_0xb11764[_0x6cef('0x2e')][_0x6cef('0x35')]);_0x2dffc2[_0x6cef('0x36')]=qs[_0x6cef('0x2f')](_['pick'](_0xb11764[_0x6cef('0x2e')],_0x211359[_0x6cef('0x2f')]));if(_0xb11764[_0x6cef('0x2e')][_0x6cef('0x38')]){_0x2dffc2['where']=_[_0x6cef('0x3a')](_0x2dffc2[_0x6cef('0x36')],{'$or':_[_0x6cef('0x27')](_0x2dffc2[_0x6cef('0x30')],function(_0x24f65a){var _0x3bc484={};_0x3bc484[_0x24f65a]={'$like':'%'+_0xb11764['query'][_0x6cef('0x38')]+'%'};return _0x3bc484;})});}_0x2dffc2=_[_0x6cef('0x3a')]({},_0x2dffc2,_0xb11764[_0x6cef('0x3b')]);return _0x3b33a9[_0x6cef('0x46')](_0x2dffc2);}})[_0x6cef('0x22')](function(_0x3f9a73){if(_0x3f9a73){_0x2ed7c0=_0x3f9a73['length'];if(!_0xb11764[_0x6cef('0x2e')]['hasOwnProperty']('nolimit')){_0x2dffc2[_0x6cef('0x1a')]=qs[_0x6cef('0x1a')](_0xb11764[_0x6cef('0x2e')][_0x6cef('0x1a')]);_0x2dffc2[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0xb11764['query'][_0x6cef('0x1b')]);}return _0x3b33a9[_0x6cef('0x46')](_0x2dffc2);}})[_0x6cef('0x22')](function(_0x3a69c5){if(_0x3a69c5){return _0x3a69c5?{'count':_0x2ed7c0,'rows':_0x3a69c5}:null;}})['then'](respondWithResult(_0x4b82f3,null))[_0x6cef('0x3f')](handleError(_0x4b82f3,null));};exports[_0x6cef('0x48')]=function(_0x5d0897,_0x58807d,_0x50c4b5){var _0x5a2b64={};var _0x37bcf8={};var _0x3b553f;var _0x56ddfd;return db[_0x6cef('0x28')]['findOne']({'where':{'id':_0x5d0897[_0x6cef('0x41')]['id']}})[_0x6cef('0x22')](handleEntityNotFound(_0x58807d,null))[_0x6cef('0x22')](function(_0x59b813){if(_0x59b813){_0x3b553f=_0x59b813;_0x37bcf8[_0x6cef('0x2c')]=_['keys'](db[_0x6cef('0x49')][_0x6cef('0x29')]);_0x37bcf8[_0x6cef('0x2e')]=_[_0x6cef('0x2d')](_0x5d0897[_0x6cef('0x2e')]);_0x37bcf8[_0x6cef('0x2f')]=_['intersection'](_0x37bcf8['model'],_0x37bcf8[_0x6cef('0x2e')]);_0x5a2b64[_0x6cef('0x30')]=_['intersection'](_0x37bcf8[_0x6cef('0x2c')],qs[_0x6cef('0x32')](_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x32')]));_0x5a2b64['attributes']=_0x5a2b64[_0x6cef('0x30')][_0x6cef('0x33')]?_0x5a2b64[_0x6cef('0x30')]:_0x37bcf8[_0x6cef('0x2c')];_0x5a2b64['order']=qs['sort'](_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x35')]);_0x5a2b64['where']=qs[_0x6cef('0x2f')](_[_0x6cef('0x37')](_0x5d0897['query'],_0x37bcf8[_0x6cef('0x2f')]));if(_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x38')]){_0x5a2b64[_0x6cef('0x36')]=_[_0x6cef('0x3a')](_0x5a2b64[_0x6cef('0x36')],{'$or':_[_0x6cef('0x27')](_0x5a2b64['attributes'],function(_0x1b0560){var _0x234fb1={};_0x234fb1[_0x1b0560]={'$like':'%'+_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x38')]+'%'};return _0x234fb1;})});}_0x5a2b64=_[_0x6cef('0x3a')]({},_0x5a2b64,_0x5d0897[_0x6cef('0x3b')]);return _0x3b553f[_0x6cef('0x48')](_0x5a2b64);}})[_0x6cef('0x22')](function(_0x2e204c){if(_0x2e204c){_0x56ddfd=_0x2e204c[_0x6cef('0x33')];if(!_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x4a')]('nolimit')){_0x5a2b64[_0x6cef('0x1a')]=qs[_0x6cef('0x1a')](_0x5d0897['query'][_0x6cef('0x1a')]);_0x5a2b64[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0x5d0897[_0x6cef('0x2e')][_0x6cef('0x1b')]);}return _0x3b553f[_0x6cef('0x48')](_0x5a2b64);}})[_0x6cef('0x22')](function(_0x33a438){if(_0x33a438){return _0x33a438?{'count':_0x56ddfd,'rows':_0x33a438}:null;}})[_0x6cef('0x22')](respondWithResult(_0x58807d,null))[_0x6cef('0x3f')](handleError(_0x58807d,null));};exports[_0x6cef('0x4b')]=function(_0x49f4b1,_0x15ce6d,_0x3647b9){var _0x501775={};var _0x286ac2={};var _0x28f8b9;var _0x1166c1;return db[_0x6cef('0x28')][_0x6cef('0x47')]({'where':{'id':_0x49f4b1[_0x6cef('0x41')]['id']}})[_0x6cef('0x22')](handleEntityNotFound(_0x15ce6d,null))['then'](function(_0xbb1a39){if(_0xbb1a39){_0x28f8b9=_0xbb1a39;_0x286ac2['model']=_[_0x6cef('0x2d')](db[_0x6cef('0x49')][_0x6cef('0x29')]);_0x286ac2[_0x6cef('0x2e')]=_[_0x6cef('0x2d')](_0x49f4b1['query']);_0x286ac2[_0x6cef('0x2f')]=_['intersection'](_0x286ac2[_0x6cef('0x2c')],_0x286ac2['query']);_0x501775[_0x6cef('0x30')]=_[_0x6cef('0x31')](_0x286ac2[_0x6cef('0x2c')],qs[_0x6cef('0x32')](_0x49f4b1[_0x6cef('0x2e')]['fields']));_0x501775[_0x6cef('0x30')]=_0x501775['attributes'][_0x6cef('0x33')]?_0x501775['attributes']:_0x286ac2[_0x6cef('0x2c')];_0x501775['order']=qs[_0x6cef('0x35')](_0x49f4b1[_0x6cef('0x2e')][_0x6cef('0x35')]);_0x501775['where']=qs[_0x6cef('0x2f')](_[_0x6cef('0x37')](_0x49f4b1[_0x6cef('0x2e')],_0x286ac2['filters']));if(_0x49f4b1[_0x6cef('0x2e')][_0x6cef('0x38')]){_0x501775[_0x6cef('0x36')]=_['merge'](_0x501775[_0x6cef('0x36')],{'$or':_['map'](_0x501775[_0x6cef('0x30')],function(_0x5a1884){var _0x3ca252={};_0x3ca252[_0x5a1884]={'$like':'%'+_0x49f4b1[_0x6cef('0x2e')]['filter']+'%'};return _0x3ca252;})});}_0x501775=_[_0x6cef('0x3a')]({},_0x501775,_0x49f4b1['options']);return _0x28f8b9[_0x6cef('0x4b')](_0x501775);}})['then'](function(_0x60797d){if(_0x60797d){_0x1166c1=_0x60797d[_0x6cef('0x33')];if(!_0x49f4b1['query']['hasOwnProperty'](_0x6cef('0x4c'))){_0x501775['limit']=qs['limit'](_0x49f4b1['query'][_0x6cef('0x1a')]);_0x501775[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0x49f4b1[_0x6cef('0x2e')][_0x6cef('0x1b')]);}return _0x28f8b9['getDescriptions'](_0x501775);}})[_0x6cef('0x22')](function(_0x453e67){if(_0x453e67){return _0x453e67?{'count':_0x1166c1,'rows':_0x453e67}:null;}})[_0x6cef('0x22')](respondWithResult(_0x15ce6d,null))[_0x6cef('0x3f')](handleError(_0x15ce6d,null));}; \ No newline at end of file +var _0x3b1b=['error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','includeAll','include','catch','show','params','length','find','create','body','findOne','pick','options','getFields','hasOwnProperty','getSubjects','getDescriptions','VtigerField','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x223b1a,_0x30c9bc){var _0x785b2b=function(_0x41bfd2){while(--_0x41bfd2){_0x223b1a['push'](_0x223b1a['shift']());}};_0x785b2b(++_0x30c9bc);}(_0x3b1b,0x75));var _0xb3b1=function(_0x34855c,_0x467e71){_0x34855c=_0x34855c-0x0;var _0x1898a2=_0x3b1b[_0x34855c];return _0x1898a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3b1('0x0'));var zipdir=require(_0xb3b1('0x1'));var jsonpatch=require(_0xb3b1('0x2'));var rp=require(_0xb3b1('0x3'));var moment=require(_0xb3b1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb3b1('0x5'));var sox=require('sox');var csv=require(_0xb3b1('0x6'));var ejs=require(_0xb3b1('0x7'));var fs=require('fs');var fs_extra=require(_0xb3b1('0x8'));var _=require(_0xb3b1('0x9'));var squel=require(_0xb3b1('0xa'));var crypto=require(_0xb3b1('0xb'));var jsforce=require(_0xb3b1('0xc'));var deskjs=require(_0xb3b1('0xd'));var toCsv=require(_0xb3b1('0x6'));var querystring=require('querystring');var Papa=require(_0xb3b1('0xe'));var Redis=require('ioredis');var authService=require(_0xb3b1('0xf'));var qs=require(_0xb3b1('0x10'));var as=require(_0xb3b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3b1('0x12'));var utils=require(_0xb3b1('0x13'));var config=require(_0xb3b1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f4788,_0x4fad87){_0x4fad87=_0x4fad87||0xcc;return function(_0x470d67){if(_0x470d67){return _0x4f4788[_0xb3b1('0x15')](_0x4fad87);}return _0x4f4788[_0xb3b1('0x16')](_0x4fad87)[_0xb3b1('0x17')]();};}function respondWithResult(_0x361f60,_0x2705a4){_0x2705a4=_0x2705a4||0xc8;return function(_0x5203c3){if(_0x5203c3){return _0x361f60[_0xb3b1('0x16')](_0x2705a4)[_0xb3b1('0x18')](_0x5203c3);}};}function respondWithFilteredResult(_0xdcdadc,_0x1bf4d9){return function(_0x1d4ded){if(_0x1d4ded){var _0x471df5=typeof _0x1bf4d9[_0xb3b1('0x19')]==='undefined'&&typeof _0x1bf4d9[_0xb3b1('0x1a')]===_0xb3b1('0x1b');var _0x596007=_0x1d4ded[_0xb3b1('0x1c')];var _0x5b66ce=_0x471df5?0x0:_0x1bf4d9[_0xb3b1('0x19')];var _0x14f0de=_0x471df5?_0x1d4ded[_0xb3b1('0x1c')]:_0x1bf4d9['offset']+_0x1bf4d9[_0xb3b1('0x1a')];var _0x6a676d;if(_0x14f0de>=_0x596007){_0x14f0de=_0x596007;_0x6a676d=0xc8;}else{_0x6a676d=0xce;}_0xdcdadc[_0xb3b1('0x16')](_0x6a676d);return _0xdcdadc[_0xb3b1('0x1d')](_0xb3b1('0x1e'),_0x5b66ce+'-'+_0x14f0de+'/'+_0x596007)[_0xb3b1('0x18')](_0x1d4ded);}return null;};}function patchUpdates(_0x2d0d47){return function(_0x20c298){try{jsonpatch[_0xb3b1('0x1f')](_0x20c298,_0x2d0d47,!![]);}catch(_0x4cb234){return BPromise[_0xb3b1('0x20')](_0x4cb234);}return _0x20c298[_0xb3b1('0x21')]();};}function saveUpdates(_0x444e2a,_0x342723){return function(_0x489b0a){if(_0x489b0a){return _0x489b0a[_0xb3b1('0x22')](_0x444e2a)[_0xb3b1('0x23')](function(_0x40609d){return _0x40609d;});}return null;};}function removeEntity(_0x54eccd,_0xb85890){return function(_0x34c050){if(_0x34c050){return _0x34c050[_0xb3b1('0x24')]()[_0xb3b1('0x23')](function(){_0x54eccd[_0xb3b1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324626,_0x827989){return function(_0x2c5c85){if(!_0x2c5c85){_0x324626['sendStatus'](0x194);}return _0x2c5c85;};}function handleError(_0x4b7332,_0x445219){_0x445219=_0x445219||0x1f4;return function(_0x17d6e4){logger[_0xb3b1('0x25')](_0x17d6e4[_0xb3b1('0x26')]);if(_0x17d6e4[_0xb3b1('0x27')]){delete _0x17d6e4[_0xb3b1('0x27')];}_0x4b7332[_0xb3b1('0x16')](_0x445219)[_0xb3b1('0x28')](_0x17d6e4);};}exports[_0xb3b1('0x29')]=function(_0x1b835e,_0xe8e479){var _0x28bdad={},_0x4443b2={},_0x1dd9d6={'count':0x0,'rows':[]};var _0x11bb57=_[_0xb3b1('0x2a')](db[_0xb3b1('0x2b')][_0xb3b1('0x2c')],function(_0x1a16c4){return{'name':_0x1a16c4[_0xb3b1('0x2d')],'type':_0x1a16c4[_0xb3b1('0x2e')]['key']};});_0x4443b2[_0xb3b1('0x2f')]=_[_0xb3b1('0x2a')](_0x11bb57,_0xb3b1('0x27'));_0x4443b2[_0xb3b1('0x30')]=_[_0xb3b1('0x31')](_0x1b835e[_0xb3b1('0x30')]);_0x4443b2[_0xb3b1('0x32')]=_[_0xb3b1('0x33')](_0x4443b2[_0xb3b1('0x2f')],_0x4443b2[_0xb3b1('0x30')]);_0x28bdad['attributes']=_['intersection'](_0x4443b2['model'],qs[_0xb3b1('0x34')](_0x1b835e['query'][_0xb3b1('0x34')]));_0x28bdad[_0xb3b1('0x35')]=_0x28bdad['attributes']['length']?_0x28bdad['attributes']:_0x4443b2[_0xb3b1('0x2f')];if(!_0x1b835e['query']['hasOwnProperty'](_0xb3b1('0x36'))){_0x28bdad[_0xb3b1('0x1a')]=qs['limit'](_0x1b835e[_0xb3b1('0x30')]['limit']);_0x28bdad[_0xb3b1('0x19')]=qs[_0xb3b1('0x19')](_0x1b835e[_0xb3b1('0x30')][_0xb3b1('0x19')]);}_0x28bdad[_0xb3b1('0x37')]=qs[_0xb3b1('0x38')](_0x1b835e['query'][_0xb3b1('0x38')]);_0x28bdad[_0xb3b1('0x39')]=qs[_0xb3b1('0x32')](_['pick'](_0x1b835e[_0xb3b1('0x30')],_0x4443b2[_0xb3b1('0x32')]),_0x11bb57);if(_0x1b835e['query']['filter']){_0x28bdad[_0xb3b1('0x39')]=_['merge'](_0x28bdad['where'],{'$or':_['map'](_0x11bb57,function(_0x4acdc3){if(_0x4acdc3[_0xb3b1('0x2e')]!=='VIRTUAL'){var _0x437486={};_0x437486[_0x4acdc3[_0xb3b1('0x27')]]={'$like':'%'+_0x1b835e[_0xb3b1('0x30')][_0xb3b1('0x3a')]+'%'};return _0x437486;}})});}_0x28bdad=_[_0xb3b1('0x3b')]({},_0x28bdad,_0x1b835e['options']);var _0x26fd61={'where':_0x28bdad[_0xb3b1('0x39')]};return db[_0xb3b1('0x2b')][_0xb3b1('0x1c')](_0x26fd61)[_0xb3b1('0x23')](function(_0x30eed6){_0x1dd9d6[_0xb3b1('0x1c')]=_0x30eed6;if(_0x1b835e[_0xb3b1('0x30')][_0xb3b1('0x3c')]){_0x28bdad[_0xb3b1('0x3d')]=[{'all':!![]}];}return db[_0xb3b1('0x2b')]['findAll'](_0x28bdad);})[_0xb3b1('0x23')](function(_0x15a6d7){_0x1dd9d6['rows']=_0x15a6d7;return _0x1dd9d6;})['then'](respondWithFilteredResult(_0xe8e479,_0x28bdad))[_0xb3b1('0x3e')](handleError(_0xe8e479,null));};exports[_0xb3b1('0x3f')]=function(_0x38fe9a,_0x4a3abe){var _0x35918c={'raw':![],'where':{'id':_0x38fe9a[_0xb3b1('0x40')]['id']}},_0x4222f6={};_0x4222f6[_0xb3b1('0x2f')]=_['keys'](db[_0xb3b1('0x2b')]['rawAttributes']);_0x4222f6[_0xb3b1('0x30')]=_[_0xb3b1('0x31')](_0x38fe9a['query']);_0x4222f6[_0xb3b1('0x32')]=_[_0xb3b1('0x33')](_0x4222f6[_0xb3b1('0x2f')],_0x4222f6[_0xb3b1('0x30')]);_0x35918c[_0xb3b1('0x35')]=_[_0xb3b1('0x33')](_0x4222f6[_0xb3b1('0x2f')],qs[_0xb3b1('0x34')](_0x38fe9a[_0xb3b1('0x30')]['fields']));_0x35918c['attributes']=_0x35918c['attributes'][_0xb3b1('0x41')]?_0x35918c[_0xb3b1('0x35')]:_0x4222f6[_0xb3b1('0x2f')];if(_0x38fe9a[_0xb3b1('0x30')][_0xb3b1('0x3c')]){_0x35918c[_0xb3b1('0x3d')]=[{'all':!![]}];}_0x35918c=_[_0xb3b1('0x3b')]({},_0x35918c,_0x38fe9a['options']);return db['VtigerConfiguration'][_0xb3b1('0x42')](_0x35918c)['then'](handleEntityNotFound(_0x4a3abe,null))['then'](respondWithResult(_0x4a3abe,null))[_0xb3b1('0x3e')](handleError(_0x4a3abe,null));};exports[_0xb3b1('0x43')]=function(_0x5b1c6f,_0x41fda3){return db[_0xb3b1('0x2b')][_0xb3b1('0x43')](_0x5b1c6f[_0xb3b1('0x44')],{})[_0xb3b1('0x23')](respondWithResult(_0x41fda3,0xc9))[_0xb3b1('0x3e')](handleError(_0x41fda3,null));};exports[_0xb3b1('0x22')]=function(_0x374ac3,_0x362541){if(_0x374ac3[_0xb3b1('0x44')]['id']){delete _0x374ac3[_0xb3b1('0x44')]['id'];}return db[_0xb3b1('0x2b')][_0xb3b1('0x42')]({'where':{'id':_0x374ac3[_0xb3b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x362541,null))[_0xb3b1('0x23')](saveUpdates(_0x374ac3[_0xb3b1('0x44')],null))[_0xb3b1('0x23')](respondWithResult(_0x362541,null))[_0xb3b1('0x3e')](handleError(_0x362541,null));};exports[_0xb3b1('0x24')]=function(_0x17d2ee,_0x583eae){return db[_0xb3b1('0x2b')][_0xb3b1('0x42')]({'where':{'id':_0x17d2ee[_0xb3b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x583eae,null))['then'](removeEntity(_0x583eae,null))[_0xb3b1('0x3e')](handleError(_0x583eae,null));};exports['getFields']=function(_0x449b1c,_0xa7ffc2,_0x2053ec){var _0x434eee={};var _0x5da098={};var _0x437117;var _0x489e9d;return db['VtigerConfiguration'][_0xb3b1('0x45')]({'where':{'id':_0x449b1c[_0xb3b1('0x40')]['id']}})[_0xb3b1('0x23')](handleEntityNotFound(_0xa7ffc2,null))['then'](function(_0x14b6f0){if(_0x14b6f0){_0x437117=_0x14b6f0;_0x5da098[_0xb3b1('0x2f')]=_[_0xb3b1('0x31')](db['VtigerField'][_0xb3b1('0x2c')]);_0x5da098[_0xb3b1('0x30')]=_['keys'](_0x449b1c[_0xb3b1('0x30')]);_0x5da098[_0xb3b1('0x32')]=_['intersection'](_0x5da098['model'],_0x5da098['query']);_0x434eee['attributes']=_[_0xb3b1('0x33')](_0x5da098[_0xb3b1('0x2f')],qs[_0xb3b1('0x34')](_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x34')]));_0x434eee[_0xb3b1('0x35')]=_0x434eee[_0xb3b1('0x35')][_0xb3b1('0x41')]?_0x434eee[_0xb3b1('0x35')]:_0x5da098[_0xb3b1('0x2f')];_0x434eee[_0xb3b1('0x37')]=qs[_0xb3b1('0x38')](_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x38')]);_0x434eee[_0xb3b1('0x39')]=qs[_0xb3b1('0x32')](_[_0xb3b1('0x46')](_0x449b1c[_0xb3b1('0x30')],_0x5da098[_0xb3b1('0x32')]));if(_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x3a')]){_0x434eee[_0xb3b1('0x39')]=_[_0xb3b1('0x3b')](_0x434eee[_0xb3b1('0x39')],{'$or':_[_0xb3b1('0x2a')](_0x434eee[_0xb3b1('0x35')],function(_0x3b5d6b){var _0x222d5c={};_0x222d5c[_0x3b5d6b]={'$like':'%'+_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x3a')]+'%'};return _0x222d5c;})});}_0x434eee=_[_0xb3b1('0x3b')]({},_0x434eee,_0x449b1c[_0xb3b1('0x47')]);return _0x437117[_0xb3b1('0x48')](_0x434eee);}})[_0xb3b1('0x23')](function(_0x44a95c){if(_0x44a95c){_0x489e9d=_0x44a95c[_0xb3b1('0x41')];if(!_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x49')]('nolimit')){_0x434eee[_0xb3b1('0x1a')]=qs[_0xb3b1('0x1a')](_0x449b1c[_0xb3b1('0x30')]['limit']);_0x434eee[_0xb3b1('0x19')]=qs['offset'](_0x449b1c[_0xb3b1('0x30')][_0xb3b1('0x19')]);}return _0x437117['getFields'](_0x434eee);}})[_0xb3b1('0x23')](function(_0x2691be){if(_0x2691be){return _0x2691be?{'count':_0x489e9d,'rows':_0x2691be}:null;}})[_0xb3b1('0x23')](respondWithResult(_0xa7ffc2,null))[_0xb3b1('0x3e')](handleError(_0xa7ffc2,null));};exports[_0xb3b1('0x4a')]=function(_0x159b5c,_0x2df5bc,_0x464886){var _0x2fb63a={};var _0x30266d={};var _0x4977fa;var _0x2c1dcc;return db[_0xb3b1('0x2b')][_0xb3b1('0x45')]({'where':{'id':_0x159b5c[_0xb3b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2df5bc,null))[_0xb3b1('0x23')](function(_0x391262){if(_0x391262){_0x4977fa=_0x391262;_0x30266d[_0xb3b1('0x2f')]=_['keys'](db['VtigerField'][_0xb3b1('0x2c')]);_0x30266d[_0xb3b1('0x30')]=_[_0xb3b1('0x31')](_0x159b5c[_0xb3b1('0x30')]);_0x30266d[_0xb3b1('0x32')]=_[_0xb3b1('0x33')](_0x30266d[_0xb3b1('0x2f')],_0x30266d['query']);_0x2fb63a[_0xb3b1('0x35')]=_[_0xb3b1('0x33')](_0x30266d[_0xb3b1('0x2f')],qs[_0xb3b1('0x34')](_0x159b5c[_0xb3b1('0x30')][_0xb3b1('0x34')]));_0x2fb63a['attributes']=_0x2fb63a[_0xb3b1('0x35')][_0xb3b1('0x41')]?_0x2fb63a[_0xb3b1('0x35')]:_0x30266d[_0xb3b1('0x2f')];_0x2fb63a[_0xb3b1('0x37')]=qs[_0xb3b1('0x38')](_0x159b5c[_0xb3b1('0x30')][_0xb3b1('0x38')]);_0x2fb63a[_0xb3b1('0x39')]=qs[_0xb3b1('0x32')](_['pick'](_0x159b5c[_0xb3b1('0x30')],_0x30266d[_0xb3b1('0x32')]));if(_0x159b5c['query'][_0xb3b1('0x3a')]){_0x2fb63a['where']=_[_0xb3b1('0x3b')](_0x2fb63a['where'],{'$or':_[_0xb3b1('0x2a')](_0x2fb63a[_0xb3b1('0x35')],function(_0x4c7102){var _0x55cb83={};_0x55cb83[_0x4c7102]={'$like':'%'+_0x159b5c['query']['filter']+'%'};return _0x55cb83;})});}_0x2fb63a=_[_0xb3b1('0x3b')]({},_0x2fb63a,_0x159b5c['options']);return _0x4977fa[_0xb3b1('0x4a')](_0x2fb63a);}})['then'](function(_0x53ace2){if(_0x53ace2){_0x2c1dcc=_0x53ace2[_0xb3b1('0x41')];if(!_0x159b5c[_0xb3b1('0x30')][_0xb3b1('0x49')]('nolimit')){_0x2fb63a['limit']=qs['limit'](_0x159b5c['query'][_0xb3b1('0x1a')]);_0x2fb63a['offset']=qs[_0xb3b1('0x19')](_0x159b5c['query']['offset']);}return _0x4977fa[_0xb3b1('0x4a')](_0x2fb63a);}})[_0xb3b1('0x23')](function(_0x11836e){if(_0x11836e){return _0x11836e?{'count':_0x2c1dcc,'rows':_0x11836e}:null;}})['then'](respondWithResult(_0x2df5bc,null))[_0xb3b1('0x3e')](handleError(_0x2df5bc,null));};exports[_0xb3b1('0x4b')]=function(_0x37b0bc,_0x4f69be,_0x1f8933){var _0x1d4de3={};var _0x3ae91a={};var _0x58e16b;var _0x547a1f;return db[_0xb3b1('0x2b')]['findOne']({'where':{'id':_0x37b0bc[_0xb3b1('0x40')]['id']}})[_0xb3b1('0x23')](handleEntityNotFound(_0x4f69be,null))[_0xb3b1('0x23')](function(_0x116ce0){if(_0x116ce0){_0x58e16b=_0x116ce0;_0x3ae91a['model']=_[_0xb3b1('0x31')](db[_0xb3b1('0x4c')][_0xb3b1('0x2c')]);_0x3ae91a[_0xb3b1('0x30')]=_['keys'](_0x37b0bc[_0xb3b1('0x30')]);_0x3ae91a[_0xb3b1('0x32')]=_[_0xb3b1('0x33')](_0x3ae91a[_0xb3b1('0x2f')],_0x3ae91a[_0xb3b1('0x30')]);_0x1d4de3[_0xb3b1('0x35')]=_['intersection'](_0x3ae91a[_0xb3b1('0x2f')],qs[_0xb3b1('0x34')](_0x37b0bc[_0xb3b1('0x30')]['fields']));_0x1d4de3[_0xb3b1('0x35')]=_0x1d4de3[_0xb3b1('0x35')]['length']?_0x1d4de3[_0xb3b1('0x35')]:_0x3ae91a[_0xb3b1('0x2f')];_0x1d4de3[_0xb3b1('0x37')]=qs['sort'](_0x37b0bc['query'][_0xb3b1('0x38')]);_0x1d4de3[_0xb3b1('0x39')]=qs[_0xb3b1('0x32')](_[_0xb3b1('0x46')](_0x37b0bc['query'],_0x3ae91a[_0xb3b1('0x32')]));if(_0x37b0bc[_0xb3b1('0x30')][_0xb3b1('0x3a')]){_0x1d4de3[_0xb3b1('0x39')]=_[_0xb3b1('0x3b')](_0x1d4de3[_0xb3b1('0x39')],{'$or':_[_0xb3b1('0x2a')](_0x1d4de3[_0xb3b1('0x35')],function(_0xafc3ce){var _0x1ed361={};_0x1ed361[_0xafc3ce]={'$like':'%'+_0x37b0bc[_0xb3b1('0x30')][_0xb3b1('0x3a')]+'%'};return _0x1ed361;})});}_0x1d4de3=_[_0xb3b1('0x3b')]({},_0x1d4de3,_0x37b0bc[_0xb3b1('0x47')]);return _0x58e16b[_0xb3b1('0x4b')](_0x1d4de3);}})['then'](function(_0x5904af){if(_0x5904af){_0x547a1f=_0x5904af[_0xb3b1('0x41')];if(!_0x37b0bc[_0xb3b1('0x30')][_0xb3b1('0x49')](_0xb3b1('0x36'))){_0x1d4de3[_0xb3b1('0x1a')]=qs[_0xb3b1('0x1a')](_0x37b0bc[_0xb3b1('0x30')]['limit']);_0x1d4de3[_0xb3b1('0x19')]=qs[_0xb3b1('0x19')](_0x37b0bc['query'][_0xb3b1('0x19')]);}return _0x58e16b[_0xb3b1('0x4b')](_0x1d4de3);}})[_0xb3b1('0x23')](function(_0x5763e6){if(_0x5763e6){return _0x5763e6?{'count':_0x547a1f,'rows':_0x5763e6}:null;}})['then'](respondWithResult(_0x4f69be,null))[_0xb3b1('0x3e')](handleError(_0x4f69be,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 44f8a00..a85dacf 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 _0x86ae=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x86ae,0xb0));var _0xe86a=function(_0x194067,_0x35db3c){_0x194067=_0x194067-0x0;var _0x48773f=_0x86ae[_0x194067];return _0x48773f;};'use strict';var _=require(_0xe86a('0x0'));var util=require(_0xe86a('0x1'));var logger=require(_0xe86a('0x2'))(_0xe86a('0x3'));var moment=require(_0xe86a('0x4'));var BPromise=require(_0xe86a('0x5'));var rp=require(_0xe86a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe86a('0x7'));var config=require(_0xe86a('0x8'));var attributes=require(_0xe86a('0x9'));module[_0xe86a('0xa')]=function(_0x1fa2d8,_0x292db4){return _0x1fa2d8['define']('VtigerConfiguration',attributes,{'tableName':_0xe86a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a5=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x2e0a62,_0x36b748){var _0x41578f=function(_0x469981){while(--_0x469981){_0x2e0a62['push'](_0x2e0a62['shift']());}};_0x41578f(++_0x36b748);}(_0x68a5,0x162));var _0x568a=function(_0x42ef69,_0xbac429){_0x42ef69=_0x42ef69-0x0;var _0x2e5689=_0x68a5[_0x42ef69];return _0x2e5689;};'use strict';var _=require(_0x568a('0x0'));var util=require(_0x568a('0x1'));var logger=require(_0x568a('0x2'))('api');var moment=require(_0x568a('0x3'));var BPromise=require('bluebird');var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x568a('0x5'));var config=require(_0x568a('0x6'));var attributes=require(_0x568a('0x7'));module[_0x568a('0x8')]=function(_0x58a9a4,_0x1558e8){return _0x58a9a4[_0x568a('0x9')](_0x568a('0xa'),attributes,{'tableName':_0x568a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index e92c8a7..d8b9540 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 _0xf3d8=['rpc','../../config/environment','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x551aef,_0x3a75be){var _0x4b5526=function(_0x486c73){while(--_0x486c73){_0x551aef['push'](_0x551aef['shift']());}};_0x4b5526(++_0x3a75be);}(_0xf3d8,0x9b));var _0x8f3d=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xf3d8[_0x506d83];return _0x335e8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f3d('0x0'));var BPromise=require(_0x8f3d('0x1'));var rs=require(_0x8f3d('0x2'));var fs=require('fs');var Redis=require(_0x8f3d('0x3'));var db=require(_0x8f3d('0x4'))['db'];var utils=require(_0x8f3d('0x5'));var logger=require('../../config/logger')(_0x8f3d('0x6'));var config=require(_0x8f3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8f3d('0x8')][_0x8f3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x201be9,_0x4404f0,_0x4df2cd){return new BPromise(function(_0x110592,_0xa41e60){return client[_0x8f3d('0xa')](_0x201be9,_0x4df2cd)[_0x8f3d('0xb')](function(_0x5401dc){logger['info'](_0x8f3d('0xc'),_0x4404f0,_0x8f3d('0xd'));logger[_0x8f3d('0xe')](_0x8f3d('0xf'),_0x4404f0,'request\x20sent',JSON[_0x8f3d('0x10')](_0x5401dc));if(_0x5401dc['error']){if(_0x5401dc[_0x8f3d('0x11')][_0x8f3d('0x12')]===0x1f4){logger[_0x8f3d('0x11')](_0x8f3d('0xc'),_0x4404f0,_0x5401dc[_0x8f3d('0x11')][_0x8f3d('0x13')]);return _0xa41e60(_0x5401dc[_0x8f3d('0x11')]['message']);}logger['error'](_0x8f3d('0xc'),_0x4404f0,_0x5401dc[_0x8f3d('0x11')][_0x8f3d('0x13')]);return _0x110592(_0x5401dc[_0x8f3d('0x11')][_0x8f3d('0x13')]);}else{logger[_0x8f3d('0x14')](_0x8f3d('0xc'),_0x4404f0,'request\x20sent');_0x110592(_0x5401dc[_0x8f3d('0x15')]['message']);}})[_0x8f3d('0x16')](function(_0x41af2c){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4404f0,_0x41af2c);_0xa41e60(_0x41af2c);});});} \ No newline at end of file +var _0x26d8=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x8c77c5,_0x78b472){var _0x58871f=function(_0x4ceba5){while(--_0x4ceba5){_0x8c77c5['push'](_0x8c77c5['shift']());}};_0x58871f(++_0x78b472);}(_0x26d8,0x16c));var _0x826d=function(_0xd24358,_0x41b359){_0xd24358=_0xd24358-0x0;var _0x4ac2b1=_0x26d8[_0xd24358];return _0x4ac2b1;};'use strict';var _=require(_0x826d('0x0'));var util=require(_0x826d('0x1'));var moment=require('moment');var BPromise=require(_0x826d('0x2'));var rs=require(_0x826d('0x3'));var fs=require('fs');var Redis=require(_0x826d('0x4'));var db=require(_0x826d('0x5'))['db'];var utils=require(_0x826d('0x6'));var logger=require(_0x826d('0x7'))(_0x826d('0x8'));var config=require(_0x826d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x826d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41a47d,_0x234a9a,_0xe060fb){return new BPromise(function(_0x528286,_0x3da4a3){return client['request'](_0x41a47d,_0xe060fb)[_0x826d('0xb')](function(_0x5454b0){logger[_0x826d('0xc')](_0x826d('0xd'),_0x234a9a,'request\x20sent');logger[_0x826d('0xe')](_0x826d('0xf'),_0x234a9a,'request\x20sent',JSON['stringify'](_0x5454b0));if(_0x5454b0[_0x826d('0x10')]){if(_0x5454b0[_0x826d('0x10')][_0x826d('0x11')]===0x1f4){logger[_0x826d('0x10')](_0x826d('0xd'),_0x234a9a,_0x5454b0['error'][_0x826d('0x12')]);return _0x3da4a3(_0x5454b0[_0x826d('0x10')][_0x826d('0x12')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x234a9a,_0x5454b0[_0x826d('0x10')][_0x826d('0x12')]);return _0x528286(_0x5454b0[_0x826d('0x10')][_0x826d('0x12')]);}else{logger[_0x826d('0xc')](_0x826d('0xd'),_0x234a9a,'request\x20sent');_0x528286(_0x5454b0[_0x826d('0x13')]['message']);}})[_0x826d('0x14')](function(_0x5dd6a8){logger[_0x826d('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x234a9a,_0x5dd6a8);_0x3da4a3(_0x5dd6a8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ca22309..e908be7 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 _0x60c4=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','/:id','show','post'];(function(_0x2ceb50,_0x266ba7){var _0x14234c=function(_0x31d737){while(--_0x31d737){_0x2ceb50['push'](_0x2ceb50['shift']());}};_0x14234c(++_0x266ba7);}(_0x60c4,0xa6));var _0x460c=function(_0x3c8757,_0x3bde2b){_0x3c8757=_0x3c8757-0x0;var _0x3baee9=_0x60c4[_0x3c8757];return _0x3baee9;};'use strict';var multer=require(_0x460c('0x0'));var util=require(_0x460c('0x1'));var path=require(_0x460c('0x2'));var timeout=require(_0x460c('0x3'));var express=require(_0x460c('0x4'));var router=express[_0x460c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x460c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x460c('0x7'));var controller=require(_0x460c('0x8'));router['get']('/',auth[_0x460c('0x9')](),controller[_0x460c('0xa')]);router['get'](_0x460c('0xb'),auth['isAuthenticated'](),controller[_0x460c('0xc')]);router[_0x460c('0xd')]('/',auth[_0x460c('0x9')](),controller[_0x460c('0xe')]);router['put'](_0x460c('0xb'),auth[_0x460c('0x9')](),controller['update']);router[_0x460c('0xf')](_0x460c('0xb'),auth[_0x460c('0x9')](),controller[_0x460c('0x10')]);module[_0x460c('0x11')]=router; \ No newline at end of file +var _0xf01c=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x378069,_0x303d63){var _0xadcbb0=function(_0x2e86ef){while(--_0x2e86ef){_0x378069['push'](_0x378069['shift']());}};_0xadcbb0(++_0x303d63);}(_0xf01c,0x72));var _0xcf01=function(_0x2a2eb6,_0x3838d0){_0x2a2eb6=_0x2a2eb6-0x0;var _0x4fea98=_0xf01c[_0x2a2eb6];return _0x4fea98;};'use strict';var multer=require(_0xcf01('0x0'));var util=require('util');var path=require(_0xcf01('0x1'));var timeout=require(_0xcf01('0x2'));var express=require(_0xcf01('0x3'));var router=express[_0xcf01('0x4')]();var fs_extra=require(_0xcf01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcf01('0x6'));var config=require(_0xcf01('0x7'));var controller=require(_0xcf01('0x8'));router[_0xcf01('0x9')]('/',auth[_0xcf01('0xa')](),controller[_0xcf01('0xb')]);router['get'](_0xcf01('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xcf01('0xd')]('/',auth['isAuthenticated'](),controller[_0xcf01('0xe')]);router[_0xcf01('0xf')](_0xcf01('0xc'),auth[_0xcf01('0xa')](),controller[_0xcf01('0x10')]);router['delete'](_0xcf01('0xc'),auth['isAuthenticated'](),controller[_0xcf01('0x11')]);module[_0xcf01('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 879ec95..2435b7a 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 _0xbef3=['exports','ENUM','keyValue','picklist','string','STRING','variable','customVariable','BOOLEAN'];(function(_0xbd9d20,_0x23acca){var _0x493b1f=function(_0x5bb87e){while(--_0x5bb87e){_0xbd9d20['push'](_0xbd9d20['shift']());}};_0x493b1f(++_0x23acca);}(_0xbef3,0x1b9));var _0x3bef=function(_0x3d22b0,_0xd143cb){_0x3d22b0=_0x3d22b0-0x0;var _0x31665f=_0xbef3[_0x3d22b0];return _0x31665f;};'use strict';var Sequelize=require('sequelize');module[_0x3bef('0x0')]={'type':{'type':Sequelize[_0x3bef('0x1')]('string','variable','customVariable',_0x3bef('0x2'),_0x3bef('0x3')),'defaultValue':_0x3bef('0x4')},'content':{'type':Sequelize[_0x3bef('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3bef('0x1')](_0x3bef('0x4'),_0x3bef('0x6'),_0x3bef('0x7'))},'keyContent':{'type':Sequelize[_0x3bef('0x5')]},'idField':{'type':Sequelize[_0x3bef('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3bef('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3bef('0x5')]}}; \ No newline at end of file +var _0x91ae=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2d910a,_0x3badee){var _0x281857=function(_0x17bdfb){while(--_0x17bdfb){_0x2d910a['push'](_0x2d910a['shift']());}};_0x281857(++_0x3badee);}(_0x91ae,0x11d));var _0xe91a=function(_0x456c25,_0x407fe6){_0x456c25=_0x456c25-0x0;var _0x21050b=_0x91ae[_0x456c25];return _0x21050b;};'use strict';var Sequelize=require(_0xe91a('0x0'));module[_0xe91a('0x1')]={'type':{'type':Sequelize[_0xe91a('0x2')](_0xe91a('0x3'),_0xe91a('0x4'),_0xe91a('0x5'),_0xe91a('0x6'),'picklist'),'defaultValue':_0xe91a('0x3')},'content':{'type':Sequelize[_0xe91a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe91a('0x2')](_0xe91a('0x3'),_0xe91a('0x4'),_0xe91a('0x5'))},'keyContent':{'type':Sequelize[_0xe91a('0x7')]},'idField':{'type':Sequelize[_0xe91a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe91a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe91a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 224c43e..0b90757 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 _0xa02d=['model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','map','VtigerField','rawAttributes','fieldName','type'];(function(_0xc989a3,_0x2ad1b0){var _0x24de1a=function(_0x37ee92){while(--_0x37ee92){_0xc989a3['push'](_0xc989a3['shift']());}};_0x24de1a(++_0x2ad1b0);}(_0xa02d,0x153));var _0xda02=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xa02d[_0x283b55];return _0x192e58;};'use strict';var emlformat=require(_0xda02('0x0'));var rimraf=require(_0xda02('0x1'));var zipdir=require(_0xda02('0x2'));var jsonpatch=require(_0xda02('0x3'));var rp=require(_0xda02('0x4'));var moment=require(_0xda02('0x5'));var BPromise=require(_0xda02('0x6'));var Mustache=require(_0xda02('0x7'));var util=require(_0xda02('0x8'));var path=require(_0xda02('0x9'));var sox=require('sox');var csv=require(_0xda02('0xa'));var ejs=require(_0xda02('0xb'));var fs=require('fs');var fs_extra=require(_0xda02('0xc'));var _=require('lodash');var squel=require(_0xda02('0xd'));var crypto=require(_0xda02('0xe'));var jsforce=require(_0xda02('0xf'));var deskjs=require(_0xda02('0x10'));var toCsv=require(_0xda02('0xa'));var querystring=require(_0xda02('0x11'));var Papa=require('papaparse');var Redis=require(_0xda02('0x12'));var authService=require(_0xda02('0x13'));var qs=require(_0xda02('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda02('0x15'));var logger=require(_0xda02('0x16'))(_0xda02('0x17'));var utils=require(_0xda02('0x18'));var config=require(_0xda02('0x19'));var licenseUtil=require(_0xda02('0x1a'));var db=require(_0xda02('0x1b'))['db'];function respondWithStatusCode(_0x399baf,_0x46f92d){_0x46f92d=_0x46f92d||0xcc;return function(_0x475d81){if(_0x475d81){return _0x399baf[_0xda02('0x1c')](_0x46f92d);}return _0x399baf['status'](_0x46f92d)[_0xda02('0x1d')]();};}function respondWithResult(_0x1db11d,_0xec93fe){_0xec93fe=_0xec93fe||0xc8;return function(_0x239a97){if(_0x239a97){return _0x1db11d[_0xda02('0x1e')](_0xec93fe)[_0xda02('0x1f')](_0x239a97);}};}function respondWithFilteredResult(_0x3e931a,_0x2389e1){return function(_0x908154){if(_0x908154){var _0x337f1e=typeof _0x2389e1[_0xda02('0x20')]===_0xda02('0x21')&&typeof _0x2389e1[_0xda02('0x22')]===_0xda02('0x21');var _0x559d62=_0x908154['count'];var _0x4474fa=_0x337f1e?0x0:_0x2389e1[_0xda02('0x20')];var _0x57fcf4=_0x337f1e?_0x908154[_0xda02('0x23')]:_0x2389e1[_0xda02('0x20')]+_0x2389e1[_0xda02('0x22')];var _0x30bff0;if(_0x57fcf4>=_0x559d62){_0x57fcf4=_0x559d62;_0x30bff0=0xc8;}else{_0x30bff0=0xce;}_0x3e931a[_0xda02('0x1e')](_0x30bff0);return _0x3e931a[_0xda02('0x24')](_0xda02('0x25'),_0x4474fa+'-'+_0x57fcf4+'/'+_0x559d62)[_0xda02('0x1f')](_0x908154);}return null;};}function patchUpdates(_0x2980b3){return function(_0x313e4e){try{jsonpatch[_0xda02('0x26')](_0x313e4e,_0x2980b3,!![]);}catch(_0x2d762b){return BPromise[_0xda02('0x27')](_0x2d762b);}return _0x313e4e[_0xda02('0x28')]();};}function saveUpdates(_0x508413,_0x33feea){return function(_0x4a5b26){if(_0x4a5b26){return _0x4a5b26[_0xda02('0x29')](_0x508413)[_0xda02('0x2a')](function(_0x24b98d){return _0x24b98d;});}return null;};}function removeEntity(_0x39bd5c,_0x4e4f69){return function(_0xd7fa62){if(_0xd7fa62){return _0xd7fa62[_0xda02('0x2b')]()[_0xda02('0x2a')](function(){_0x39bd5c[_0xda02('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3178cd,_0x19c026){return function(_0x13e1d7){if(!_0x13e1d7){_0x3178cd[_0xda02('0x1c')](0x194);}return _0x13e1d7;};}function handleError(_0x27644d,_0x43a223){_0x43a223=_0x43a223||0x1f4;return function(_0x3aea6e){logger['error'](_0x3aea6e[_0xda02('0x2c')]);if(_0x3aea6e['name']){delete _0x3aea6e['name'];}_0x27644d[_0xda02('0x1e')](_0x43a223)[_0xda02('0x2d')](_0x3aea6e);};}exports['index']=function(_0xc90ee9,_0x5c5f09){var _0x5d2c90={},_0x508f73={},_0x334c1b={'count':0x0,'rows':[]};var _0x21d94d=_[_0xda02('0x2e')](db[_0xda02('0x2f')][_0xda02('0x30')],function(_0x4ceae8){return{'name':_0x4ceae8[_0xda02('0x31')],'type':_0x4ceae8[_0xda02('0x32')]['key']};});_0x508f73[_0xda02('0x33')]=_[_0xda02('0x2e')](_0x21d94d,_0xda02('0x34'));_0x508f73[_0xda02('0x35')]=_['keys'](_0xc90ee9['query']);_0x508f73[_0xda02('0x36')]=_[_0xda02('0x37')](_0x508f73['model'],_0x508f73[_0xda02('0x35')]);_0x5d2c90['attributes']=_[_0xda02('0x37')](_0x508f73['model'],qs[_0xda02('0x38')](_0xc90ee9[_0xda02('0x35')][_0xda02('0x38')]));_0x5d2c90[_0xda02('0x39')]=_0x5d2c90['attributes'][_0xda02('0x3a')]?_0x5d2c90['attributes']:_0x508f73[_0xda02('0x33')];if(!_0xc90ee9[_0xda02('0x35')][_0xda02('0x3b')](_0xda02('0x3c'))){_0x5d2c90['limit']=qs[_0xda02('0x22')](_0xc90ee9['query'][_0xda02('0x22')]);_0x5d2c90['offset']=qs['offset'](_0xc90ee9[_0xda02('0x35')][_0xda02('0x20')]);}_0x5d2c90[_0xda02('0x3d')]=qs[_0xda02('0x3e')](_0xc90ee9[_0xda02('0x35')][_0xda02('0x3e')]);_0x5d2c90[_0xda02('0x3f')]=qs[_0xda02('0x36')](_[_0xda02('0x40')](_0xc90ee9['query'],_0x508f73[_0xda02('0x36')]),_0x21d94d);if(_0xc90ee9['query']['filter']){_0x5d2c90[_0xda02('0x3f')]=_['merge'](_0x5d2c90[_0xda02('0x3f')],{'$or':_[_0xda02('0x2e')](_0x21d94d,function(_0x5b3332){if(_0x5b3332['type']!=='VIRTUAL'){var _0x5bacbc={};_0x5bacbc[_0x5b3332[_0xda02('0x34')]]={'$like':'%'+_0xc90ee9['query'][_0xda02('0x41')]+'%'};return _0x5bacbc;}})});}_0x5d2c90=_[_0xda02('0x42')]({},_0x5d2c90,_0xc90ee9[_0xda02('0x43')]);var _0xecd47a={'where':_0x5d2c90[_0xda02('0x3f')]};return db[_0xda02('0x2f')][_0xda02('0x23')](_0xecd47a)['then'](function(_0x40e5ff){_0x334c1b[_0xda02('0x23')]=_0x40e5ff;if(_0xc90ee9[_0xda02('0x35')][_0xda02('0x44')]){_0x5d2c90[_0xda02('0x45')]=[{'all':!![]}];}return db[_0xda02('0x2f')]['findAll'](_0x5d2c90);})[_0xda02('0x2a')](function(_0x1423af){_0x334c1b[_0xda02('0x46')]=_0x1423af;return _0x334c1b;})[_0xda02('0x2a')](respondWithFilteredResult(_0x5c5f09,_0x5d2c90))[_0xda02('0x47')](handleError(_0x5c5f09,null));};exports[_0xda02('0x48')]=function(_0x2ed2d6,_0x482e28){var _0x455eec={'raw':!![],'where':{'id':_0x2ed2d6[_0xda02('0x49')]['id']}},_0x4b1912={};_0x4b1912['model']=_[_0xda02('0x4a')](db['VtigerField']['rawAttributes']);_0x4b1912[_0xda02('0x35')]=_[_0xda02('0x4a')](_0x2ed2d6[_0xda02('0x35')]);_0x4b1912[_0xda02('0x36')]=_[_0xda02('0x37')](_0x4b1912[_0xda02('0x33')],_0x4b1912[_0xda02('0x35')]);_0x455eec[_0xda02('0x39')]=_[_0xda02('0x37')](_0x4b1912[_0xda02('0x33')],qs['fields'](_0x2ed2d6['query']['fields']));_0x455eec['attributes']=_0x455eec['attributes'][_0xda02('0x3a')]?_0x455eec[_0xda02('0x39')]:_0x4b1912[_0xda02('0x33')];if(_0x2ed2d6[_0xda02('0x35')][_0xda02('0x44')]){_0x455eec[_0xda02('0x45')]=[{'all':!![]}];}_0x455eec=_['merge']({},_0x455eec,_0x2ed2d6[_0xda02('0x43')]);return db['VtigerField'][_0xda02('0x4b')](_0x455eec)['then'](handleEntityNotFound(_0x482e28,null))[_0xda02('0x2a')](respondWithResult(_0x482e28,null))[_0xda02('0x47')](handleError(_0x482e28,null));};exports[_0xda02('0x4c')]=function(_0x4372d8,_0x214fcc){return db['VtigerField'][_0xda02('0x4c')](_0x4372d8[_0xda02('0x4d')],{})[_0xda02('0x2a')](respondWithResult(_0x214fcc,0xc9))[_0xda02('0x47')](handleError(_0x214fcc,null));};exports[_0xda02('0x29')]=function(_0x207f74,_0x2c9836){if(_0x207f74[_0xda02('0x4d')]['id']){delete _0x207f74[_0xda02('0x4d')]['id'];}return db[_0xda02('0x2f')][_0xda02('0x4b')]({'where':{'id':_0x207f74[_0xda02('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c9836,null))[_0xda02('0x2a')](saveUpdates(_0x207f74[_0xda02('0x4d')],null))[_0xda02('0x2a')](respondWithResult(_0x2c9836,null))[_0xda02('0x47')](handleError(_0x2c9836,null));};exports[_0xda02('0x2b')]=function(_0x3ee8ec,_0x3f38bb){return db[_0xda02('0x2f')]['find']({'where':{'id':_0x3ee8ec['params']['id']}})[_0xda02('0x2a')](handleEntityNotFound(_0x3f38bb,null))['then'](removeEntity(_0x3f38bb,null))['catch'](handleError(_0x3f38bb,null));}; \ No newline at end of file +var _0x110b=['error','name','send','index','map','VtigerField','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x110b,0x10a));var _0xb110=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x110b[_0x58547b];return _0x1d3fd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb110('0x0'));var zipdir=require(_0xb110('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb110('0x2'));var moment=require(_0xb110('0x3'));var BPromise=require(_0xb110('0x4'));var Mustache=require(_0xb110('0x5'));var util=require('util');var path=require(_0xb110('0x6'));var sox=require(_0xb110('0x7'));var csv=require(_0xb110('0x8'));var ejs=require(_0xb110('0x9'));var fs=require('fs');var fs_extra=require(_0xb110('0xa'));var _=require('lodash');var squel=require(_0xb110('0xb'));var crypto=require('crypto');var jsforce=require(_0xb110('0xc'));var deskjs=require(_0xb110('0xd'));var toCsv=require(_0xb110('0x8'));var querystring=require(_0xb110('0xe'));var Papa=require(_0xb110('0xf'));var Redis=require('ioredis');var authService=require(_0xb110('0x10'));var qs=require(_0xb110('0x11'));var as=require(_0xb110('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb110('0x13'))(_0xb110('0x14'));var utils=require(_0xb110('0x15'));var config=require(_0xb110('0x16'));var licenseUtil=require(_0xb110('0x17'));var db=require(_0xb110('0x18'))['db'];function respondWithStatusCode(_0x4c3374,_0x4b6fed){_0x4b6fed=_0x4b6fed||0xcc;return function(_0x297d5c){if(_0x297d5c){return _0x4c3374['sendStatus'](_0x4b6fed);}return _0x4c3374[_0xb110('0x19')](_0x4b6fed)[_0xb110('0x1a')]();};}function respondWithResult(_0x1ebec3,_0x4df9fd){_0x4df9fd=_0x4df9fd||0xc8;return function(_0xdaf180){if(_0xdaf180){return _0x1ebec3[_0xb110('0x19')](_0x4df9fd)['json'](_0xdaf180);}};}function respondWithFilteredResult(_0x4fae33,_0x5e9f45){return function(_0x360e7f){if(_0x360e7f){var _0x30ef48=typeof _0x5e9f45['offset']===_0xb110('0x1b')&&typeof _0x5e9f45[_0xb110('0x1c')]==='undefined';var _0x47d5d9=_0x360e7f[_0xb110('0x1d')];var _0x2d9302=_0x30ef48?0x0:_0x5e9f45[_0xb110('0x1e')];var _0x3f57da=_0x30ef48?_0x360e7f['count']:_0x5e9f45[_0xb110('0x1e')]+_0x5e9f45[_0xb110('0x1c')];var _0x112f2d;if(_0x3f57da>=_0x47d5d9){_0x3f57da=_0x47d5d9;_0x112f2d=0xc8;}else{_0x112f2d=0xce;}_0x4fae33[_0xb110('0x19')](_0x112f2d);return _0x4fae33[_0xb110('0x1f')](_0xb110('0x20'),_0x2d9302+'-'+_0x3f57da+'/'+_0x47d5d9)[_0xb110('0x21')](_0x360e7f);}return null;};}function patchUpdates(_0x1f5c57){return function(_0x4e3075){try{jsonpatch[_0xb110('0x22')](_0x4e3075,_0x1f5c57,!![]);}catch(_0x5bfaf5){return BPromise['reject'](_0x5bfaf5);}return _0x4e3075[_0xb110('0x23')]();};}function saveUpdates(_0x28015c,_0x133fef){return function(_0x106c42){if(_0x106c42){return _0x106c42[_0xb110('0x24')](_0x28015c)[_0xb110('0x25')](function(_0x44c2c8){return _0x44c2c8;});}return null;};}function removeEntity(_0x4c4697,_0xbb30ed){return function(_0x1d8533){if(_0x1d8533){return _0x1d8533['destroy']()[_0xb110('0x25')](function(){_0x4c4697[_0xb110('0x19')](0xcc)[_0xb110('0x1a')]();});}};}function handleEntityNotFound(_0x698c55,_0x11e255){return function(_0x133dcb){if(!_0x133dcb){_0x698c55['sendStatus'](0x194);}return _0x133dcb;};}function handleError(_0x4d1c6c,_0x5aaf77){_0x5aaf77=_0x5aaf77||0x1f4;return function(_0x3fa6d1){logger[_0xb110('0x26')](_0x3fa6d1['stack']);if(_0x3fa6d1['name']){delete _0x3fa6d1[_0xb110('0x27')];}_0x4d1c6c[_0xb110('0x19')](_0x5aaf77)[_0xb110('0x28')](_0x3fa6d1);};}exports[_0xb110('0x29')]=function(_0x15a8ce,_0x3d3bb2){var _0x2164fb={},_0x3a0a79={},_0x1461ee={'count':0x0,'rows':[]};var _0xfd3582=_[_0xb110('0x2a')](db[_0xb110('0x2b')]['rawAttributes'],function(_0x1a207c){return{'name':_0x1a207c[_0xb110('0x2c')],'type':_0x1a207c['type']['key']};});_0x3a0a79[_0xb110('0x2d')]=_['map'](_0xfd3582,_0xb110('0x27'));_0x3a0a79[_0xb110('0x2e')]=_[_0xb110('0x2f')](_0x15a8ce[_0xb110('0x2e')]);_0x3a0a79[_0xb110('0x30')]=_[_0xb110('0x31')](_0x3a0a79[_0xb110('0x2d')],_0x3a0a79['query']);_0x2164fb[_0xb110('0x32')]=_[_0xb110('0x31')](_0x3a0a79[_0xb110('0x2d')],qs['fields'](_0x15a8ce[_0xb110('0x2e')][_0xb110('0x33')]));_0x2164fb[_0xb110('0x32')]=_0x2164fb[_0xb110('0x32')][_0xb110('0x34')]?_0x2164fb[_0xb110('0x32')]:_0x3a0a79[_0xb110('0x2d')];if(!_0x15a8ce[_0xb110('0x2e')][_0xb110('0x35')](_0xb110('0x36'))){_0x2164fb['limit']=qs[_0xb110('0x1c')](_0x15a8ce[_0xb110('0x2e')][_0xb110('0x1c')]);_0x2164fb[_0xb110('0x1e')]=qs[_0xb110('0x1e')](_0x15a8ce[_0xb110('0x2e')][_0xb110('0x1e')]);}_0x2164fb[_0xb110('0x37')]=qs[_0xb110('0x38')](_0x15a8ce[_0xb110('0x2e')][_0xb110('0x38')]);_0x2164fb[_0xb110('0x39')]=qs['filters'](_[_0xb110('0x3a')](_0x15a8ce[_0xb110('0x2e')],_0x3a0a79[_0xb110('0x30')]),_0xfd3582);if(_0x15a8ce[_0xb110('0x2e')][_0xb110('0x3b')]){_0x2164fb['where']=_[_0xb110('0x3c')](_0x2164fb[_0xb110('0x39')],{'$or':_[_0xb110('0x2a')](_0xfd3582,function(_0x2cdfe7){if(_0x2cdfe7[_0xb110('0x3d')]!==_0xb110('0x3e')){var _0x21fc72={};_0x21fc72[_0x2cdfe7['name']]={'$like':'%'+_0x15a8ce[_0xb110('0x2e')][_0xb110('0x3b')]+'%'};return _0x21fc72;}})});}_0x2164fb=_['merge']({},_0x2164fb,_0x15a8ce[_0xb110('0x3f')]);var _0x2a95b1={'where':_0x2164fb[_0xb110('0x39')]};return db[_0xb110('0x2b')][_0xb110('0x1d')](_0x2a95b1)[_0xb110('0x25')](function(_0x4b73fe){_0x1461ee['count']=_0x4b73fe;if(_0x15a8ce[_0xb110('0x2e')][_0xb110('0x40')]){_0x2164fb['include']=[{'all':!![]}];}return db['VtigerField'][_0xb110('0x41')](_0x2164fb);})[_0xb110('0x25')](function(_0x5ac8e7){_0x1461ee[_0xb110('0x42')]=_0x5ac8e7;return _0x1461ee;})[_0xb110('0x25')](respondWithFilteredResult(_0x3d3bb2,_0x2164fb))[_0xb110('0x43')](handleError(_0x3d3bb2,null));};exports[_0xb110('0x44')]=function(_0x2fa6dc,_0x5e1382){var _0x273682={'raw':!![],'where':{'id':_0x2fa6dc[_0xb110('0x45')]['id']}},_0x41446f={};_0x41446f[_0xb110('0x2d')]=_[_0xb110('0x2f')](db[_0xb110('0x2b')][_0xb110('0x46')]);_0x41446f[_0xb110('0x2e')]=_[_0xb110('0x2f')](_0x2fa6dc[_0xb110('0x2e')]);_0x41446f['filters']=_[_0xb110('0x31')](_0x41446f[_0xb110('0x2d')],_0x41446f[_0xb110('0x2e')]);_0x273682['attributes']=_[_0xb110('0x31')](_0x41446f['model'],qs[_0xb110('0x33')](_0x2fa6dc[_0xb110('0x2e')][_0xb110('0x33')]));_0x273682[_0xb110('0x32')]=_0x273682[_0xb110('0x32')][_0xb110('0x34')]?_0x273682[_0xb110('0x32')]:_0x41446f[_0xb110('0x2d')];if(_0x2fa6dc[_0xb110('0x2e')]['includeAll']){_0x273682[_0xb110('0x47')]=[{'all':!![]}];}_0x273682=_[_0xb110('0x3c')]({},_0x273682,_0x2fa6dc[_0xb110('0x3f')]);return db[_0xb110('0x2b')]['find'](_0x273682)[_0xb110('0x25')](handleEntityNotFound(_0x5e1382,null))[_0xb110('0x25')](respondWithResult(_0x5e1382,null))[_0xb110('0x43')](handleError(_0x5e1382,null));};exports[_0xb110('0x48')]=function(_0x51997d,_0x5b75f5){return db[_0xb110('0x2b')][_0xb110('0x48')](_0x51997d[_0xb110('0x49')],{})['then'](respondWithResult(_0x5b75f5,0xc9))['catch'](handleError(_0x5b75f5,null));};exports[_0xb110('0x24')]=function(_0x2577df,_0x45ccbf){if(_0x2577df[_0xb110('0x49')]['id']){delete _0x2577df[_0xb110('0x49')]['id'];}return db[_0xb110('0x2b')][_0xb110('0x4a')]({'where':{'id':_0x2577df[_0xb110('0x45')]['id']}})['then'](handleEntityNotFound(_0x45ccbf,null))[_0xb110('0x25')](saveUpdates(_0x2577df[_0xb110('0x49')],null))[_0xb110('0x25')](respondWithResult(_0x45ccbf,null))[_0xb110('0x43')](handleError(_0x45ccbf,null));};exports[_0xb110('0x4b')]=function(_0x2837ac,_0x1af8d4){return db[_0xb110('0x2b')][_0xb110('0x4a')]({'where':{'id':_0x2837ac[_0xb110('0x45')]['id']}})['then'](handleEntityNotFound(_0x1af8d4,null))[_0xb110('0x25')](removeEntity(_0x1af8d4,null))['catch'](handleError(_0x1af8d4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a1535be..821c788 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 _0xdd9e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index'];(function(_0x5e2e1a,_0x22e0c3){var _0xeb8474=function(_0xafad25){while(--_0xafad25){_0x5e2e1a['push'](_0x5e2e1a['shift']());}};_0xeb8474(++_0x22e0c3);}(_0xdd9e,0x1b1));var _0xedd9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdd9e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xedd9('0x0'));var util=require(_0xedd9('0x1'));var logger=require(_0xedd9('0x2'))(_0xedd9('0x3'));var moment=require(_0xedd9('0x4'));var BPromise=require(_0xedd9('0x5'));var rp=require(_0xedd9('0x6'));var fs=require('fs');var path=require(_0xedd9('0x7'));var rimraf=require(_0xedd9('0x8'));var config=require(_0xedd9('0x9'));var attributes=require(_0xedd9('0xa'));module[_0xedd9('0xb')]=function(_0x474260,_0x2b428c){return _0x474260[_0xedd9('0xc')](_0xedd9('0xd'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xedd9('0xe'),'fields':[_0xedd9('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6a1=['path','rimraf','../../config/environment','./intVtigerField.attributes','define','int_vtiger_fields','vtiger_unique_index','FieldId','util','api','moment','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6a1,0xbc));var _0x1e6a=function(_0x470b93,_0x192d66){_0x470b93=_0x470b93-0x0;var _0x83e7b8=_0xe6a1[_0x470b93];return _0x83e7b8;};'use strict';var _=require('lodash');var util=require(_0x1e6a('0x0'));var logger=require('../../config/logger')(_0x1e6a('0x1'));var moment=require(_0x1e6a('0x2'));var BPromise=require('bluebird');var rp=require(_0x1e6a('0x3'));var fs=require('fs');var path=require(_0x1e6a('0x4'));var rimraf=require(_0x1e6a('0x5'));var config=require(_0x1e6a('0x6'));var attributes=require(_0x1e6a('0x7'));module['exports']=function(_0x2e7ec8,_0x23363b){return _0x2e7ec8[_0x1e6a('0x8')]('VtigerField',attributes,{'tableName':_0x1e6a('0x9'),'paranoid':![],'indexes':[{'name':_0x1e6a('0xa'),'fields':['idField',_0x1e6a('0xb')],'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 eeddc4d..9b39de0 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 _0x6684=['VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2faba6,_0x324153){var _0x436eec=function(_0x975626){while(--_0x975626){_0x2faba6['push'](_0x2faba6['shift']());}};_0x436eec(++_0x324153);}(_0x6684,0x196));var _0x4668=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x6684[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x4668('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4668('0x1'));var rs=require(_0x4668('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4668('0x3'))['db'];var utils=require(_0x4668('0x4'));var logger=require(_0x4668('0x5'))(_0x4668('0x6'));var config=require('../../config/environment');var jayson=require(_0x4668('0x7'));var client=jayson['client'][_0x4668('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1783da,_0xef7c03,_0x415770){return new BPromise(function(_0x17e349,_0x2d1cfc){return client[_0x4668('0x9')](_0x1783da,_0x415770)['then'](function(_0x33b9d4){logger[_0x4668('0xa')](_0x4668('0xb'),_0xef7c03,_0x4668('0xc'));logger[_0x4668('0xd')](_0x4668('0xe'),_0xef7c03,'request\x20sent',JSON['stringify'](_0x33b9d4));if(_0x33b9d4[_0x4668('0xf')]){if(_0x33b9d4['error'][_0x4668('0x10')]===0x1f4){logger['error'](_0x4668('0xb'),_0xef7c03,_0x33b9d4[_0x4668('0xf')][_0x4668('0x11')]);return _0x2d1cfc(_0x33b9d4[_0x4668('0xf')][_0x4668('0x11')]);}logger[_0x4668('0xf')](_0x4668('0xb'),_0xef7c03,_0x33b9d4['error'][_0x4668('0x11')]);return _0x17e349(_0x33b9d4[_0x4668('0xf')][_0x4668('0x11')]);}else{logger[_0x4668('0xa')](_0x4668('0xb'),_0xef7c03,'request\x20sent');_0x17e349(_0x33b9d4[_0x4668('0x12')][_0x4668('0x11')]);}})[_0x4668('0x13')](function(_0x546409){logger[_0x4668('0xf')](_0x4668('0xb'),_0xef7c03,_0x546409);_0x2d1cfc(_0x546409);});});} \ No newline at end of file +var _0x7eae=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x7be78f,_0x3b03f8){var _0x33b047=function(_0x482d04){while(--_0x482d04){_0x7be78f['push'](_0x7be78f['shift']());}};_0x33b047(++_0x3b03f8);}(_0x7eae,0x8c));var _0xe7ea=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7eae[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xe7ea('0x0'));var util=require(_0xe7ea('0x1'));var moment=require(_0xe7ea('0x2'));var BPromise=require(_0xe7ea('0x3'));var rs=require(_0xe7ea('0x4'));var fs=require('fs');var Redis=require(_0xe7ea('0x5'));var db=require(_0xe7ea('0x6'))['db'];var utils=require(_0xe7ea('0x7'));var logger=require(_0xe7ea('0x8'))(_0xe7ea('0x9'));var config=require(_0xe7ea('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe7ea('0xb')][_0xe7ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20c671,_0x5ee60d,_0x43f28b){return new BPromise(function(_0x4bac94,_0x1c5479){return client[_0xe7ea('0xd')](_0x20c671,_0x43f28b)['then'](function(_0x1c81b8){logger[_0xe7ea('0xe')](_0xe7ea('0xf'),_0x5ee60d,_0xe7ea('0x10'));logger[_0xe7ea('0x11')](_0xe7ea('0x12'),_0x5ee60d,_0xe7ea('0x10'),JSON[_0xe7ea('0x13')](_0x1c81b8));if(_0x1c81b8[_0xe7ea('0x14')]){if(_0x1c81b8[_0xe7ea('0x14')][_0xe7ea('0x15')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x5ee60d,_0x1c81b8[_0xe7ea('0x14')][_0xe7ea('0x16')]);return _0x1c5479(_0x1c81b8['error']['message']);}logger[_0xe7ea('0x14')](_0xe7ea('0xf'),_0x5ee60d,_0x1c81b8[_0xe7ea('0x14')][_0xe7ea('0x16')]);return _0x4bac94(_0x1c81b8['error'][_0xe7ea('0x16')]);}else{logger['info'](_0xe7ea('0xf'),_0x5ee60d,_0xe7ea('0x10'));_0x4bac94(_0x1c81b8[_0xe7ea('0x17')]['message']);}})['catch'](function(_0x232068){logger[_0xe7ea('0x14')](_0xe7ea('0xf'),_0x5ee60d,_0x232068);_0x1c5479(_0x232068);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1727ac4..0e7f5f9 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 _0xba7f=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','multer','util','path','express'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xba7f,0x1f0));var _0xfba7=function(_0x258cbe,_0x3762e6){_0x258cbe=_0x258cbe-0x0;var _0x4b31b9=_0xba7f[_0x258cbe];return _0x4b31b9;};'use strict';var multer=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var path=require(_0xfba7('0x2'));var timeout=require('connect-timeout');var express=require(_0xfba7('0x3'));var router=express['Router']();var fs_extra=require(_0xfba7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfba7('0x5'));var config=require(_0xfba7('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xfba7('0x7')]('/',auth[_0xfba7('0x8')](),controller['index']);router[_0xfba7('0x7')](_0xfba7('0x9'),auth[_0xfba7('0x8')](),controller[_0xfba7('0xa')]);router[_0xfba7('0x7')](_0xfba7('0xb'),auth['isAuthenticated'](),controller[_0xfba7('0xc')]);router[_0xfba7('0x7')](_0xfba7('0xd'),auth[_0xfba7('0x8')](),controller[_0xfba7('0xe')]);router[_0xfba7('0xf')]('/',auth[_0xfba7('0x8')](),controller[_0xfba7('0x10')]);router[_0xfba7('0xf')](_0xfba7('0xb'),auth[_0xfba7('0x8')](),controller[_0xfba7('0x11')]);router['put']('/:id',auth[_0xfba7('0x8')](),controller[_0xfba7('0x12')]);router['delete'](_0xfba7('0x9'),auth[_0xfba7('0x8')](),controller[_0xfba7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6770=['connect-timeout','Router','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6770,0xbc));var _0x0677=function(_0x256c46,_0x2d1a18){_0x256c46=_0x256c46-0x0;var _0x1ad098=_0x6770[_0x256c46];return _0x1ad098;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0677('0x0'));var timeout=require(_0x0677('0x1'));var express=require('express');var router=express[_0x0677('0x2')]();var fs_extra=require(_0x0677('0x3'));var auth=require(_0x0677('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0677('0x5'));router[_0x0677('0x6')]('/',auth[_0x0677('0x7')](),controller['index']);router[_0x0677('0x6')](_0x0677('0x8'),auth['isAuthenticated'](),controller[_0x0677('0x9')]);router[_0x0677('0x6')](_0x0677('0xa'),auth[_0x0677('0x7')](),controller[_0x0677('0xb')]);router[_0x0677('0x6')](_0x0677('0xc'),auth[_0x0677('0x7')](),controller[_0x0677('0xd')]);router['post']('/',auth[_0x0677('0x7')](),controller[_0x0677('0xe')]);router[_0x0677('0xf')](_0x0677('0xa'),auth['isAuthenticated'](),controller[_0x0677('0x10')]);router[_0x0677('0x11')]('/:id',auth[_0x0677('0x7')](),controller[_0x0677('0x12')]);router[_0x0677('0x13')](_0x0677('0x8'),auth[_0x0677('0x7')](),controller[_0x0677('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d014494..f6a02bc 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 _0x8f9d=['token','password','integrationTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x428013,_0x366199){var _0x263dc7=function(_0x132e02){while(--_0x132e02){_0x428013['push'](_0x428013['shift']());}};_0x263dc7(++_0x366199);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8f9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd8f9('0x1')],'unique':_0xd8f9('0x2')},'password':{'type':Sequelize[_0xd8f9('0x1')]},'token':{'type':Sequelize[_0xd8f9('0x1')]},'remoteUri':{'type':Sequelize[_0xd8f9('0x1')],'unique':_0xd8f9('0x3')},'authType':{'type':Sequelize[_0xd8f9('0x4')]('password',_0xd8f9('0x5')),'defaultValue':_0xd8f9('0x6')},'serverUrl':{'type':Sequelize[_0xd8f9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd8f9('0x4')](_0xd8f9('0x7'),'newTab'),'defaultValue':_0xd8f9('0x7')}}; \ No newline at end of file +var _0xb0df=['remoteUri','password','token','ENUM','integrationTab','exports','STRING','username'];(function(_0x18704b,_0x34f57c){var _0x66be36=function(_0x4fd387){while(--_0x4fd387){_0x18704b['push'](_0x18704b['shift']());}};_0x66be36(++_0x34f57c);}(_0xb0df,0x85));var _0xfb0d=function(_0x5ec454,_0xfcd77e){_0x5ec454=_0x5ec454-0x0;var _0x5ebf50=_0xb0df[_0x5ec454];return _0x5ebf50;};'use strict';var Sequelize=require('sequelize');module[_0xfb0d('0x0')]={'name':{'type':Sequelize[_0xfb0d('0x1')]},'description':{'type':Sequelize[_0xfb0d('0x1')]},'username':{'type':Sequelize[_0xfb0d('0x1')],'unique':_0xfb0d('0x2')},'password':{'type':Sequelize[_0xfb0d('0x1')]},'token':{'type':Sequelize[_0xfb0d('0x1')]},'remoteUri':{'type':Sequelize[_0xfb0d('0x1')],'unique':_0xfb0d('0x3')},'authType':{'type':Sequelize['ENUM'](_0xfb0d('0x4'),_0xfb0d('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfb0d('0x6')](_0xfb0d('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e69a05f..10e4343 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 _0x5c00=['getDescriptions','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','%s:%s','toString','headers','format','Basic\x20%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','destroy','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','channel'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x5c00,0x17e));var _0x05c0=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0x5c00[_0x52282a];return _0x3c66b4;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e39d4,_0x5eec41){_0x5eec41=_0x5eec41||0xcc;return function(_0x16a290){if(_0x16a290){return _0x4e39d4[_0x05c0('0x19')](_0x5eec41);}return _0x4e39d4[_0x05c0('0x1a')](_0x5eec41)[_0x05c0('0x1b')]();};}function respondWithResult(_0x25764b,_0xe57ed0){_0xe57ed0=_0xe57ed0||0xc8;return function(_0x331799){if(_0x331799){return _0x25764b[_0x05c0('0x1a')](_0xe57ed0)['json'](_0x331799);}};}function respondWithFilteredResult(_0x238e25,_0x161a5f){return function(_0x4bb164){if(_0x4bb164){var _0x29e6b0=typeof _0x161a5f[_0x05c0('0x1c')]===_0x05c0('0x1d')&&typeof _0x161a5f[_0x05c0('0x1e')]===_0x05c0('0x1d');var _0x38f994=_0x4bb164['count'];var _0x422401=_0x29e6b0?0x0:_0x161a5f[_0x05c0('0x1c')];var _0x4613c0=_0x29e6b0?_0x4bb164['count']:_0x161a5f[_0x05c0('0x1c')]+_0x161a5f[_0x05c0('0x1e')];var _0x10685b;if(_0x4613c0>=_0x38f994){_0x4613c0=_0x38f994;_0x10685b=0xc8;}else{_0x10685b=0xce;}_0x238e25[_0x05c0('0x1a')](_0x10685b);return _0x238e25[_0x05c0('0x1f')]('Content-Range',_0x422401+'-'+_0x4613c0+'/'+_0x38f994)[_0x05c0('0x20')](_0x4bb164);}return null;};}function patchUpdates(_0x1014ef){return function(_0x5313b0){try{jsonpatch['apply'](_0x5313b0,_0x1014ef,!![]);}catch(_0x5e4b80){return BPromise[_0x05c0('0x21')](_0x5e4b80);}return _0x5313b0[_0x05c0('0x22')]();};}function saveUpdates(_0x83f29,_0x8e2d4){return function(_0x5b3acb){if(_0x5b3acb){return _0x5b3acb[_0x05c0('0x23')](_0x83f29)[_0x05c0('0x24')](function(_0x5b4eef){return _0x5b4eef;});}return null;};}function removeEntity(_0x9b4930,_0x1abbf3){return function(_0x4ba978){if(_0x4ba978){return _0x4ba978['destroy']()['then'](function(){_0x9b4930['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df135,_0x15b497){return function(_0x48b56f){if(!_0x48b56f){_0x3df135[_0x05c0('0x19')](0x194);}return _0x48b56f;};}function handleError(_0x336e1b,_0x3617dc){_0x3617dc=_0x3617dc||0x1f4;return function(_0x889c75){logger['error'](_0x889c75[_0x05c0('0x25')]);if(_0x889c75[_0x05c0('0x26')]){delete _0x889c75[_0x05c0('0x26')];}_0x336e1b[_0x05c0('0x1a')](_0x3617dc)[_0x05c0('0x27')](_0x889c75);};}exports[_0x05c0('0x28')]=function(_0x57886b,_0x56ba64){var _0x2df109={},_0xbe7d9e={},_0x2053d5={'count':0x0,'rows':[]};var _0xd6574e=_[_0x05c0('0x29')](db[_0x05c0('0x2a')][_0x05c0('0x2b')],function(_0x3c9eb1){return{'name':_0x3c9eb1[_0x05c0('0x2c')],'type':_0x3c9eb1[_0x05c0('0x2d')][_0x05c0('0x2e')]};});_0xbe7d9e[_0x05c0('0x2f')]=_['map'](_0xd6574e,'name');_0xbe7d9e[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x57886b[_0x05c0('0x30')]);_0xbe7d9e['filters']=_[_0x05c0('0x32')](_0xbe7d9e[_0x05c0('0x2f')],_0xbe7d9e['query']);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0xbe7d9e[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x34')]));_0x2df109[_0x05c0('0x33')]=_0x2df109[_0x05c0('0x33')][_0x05c0('0x35')]?_0x2df109[_0x05c0('0x33')]:_0xbe7d9e[_0x05c0('0x2f')];if(!_0x57886b[_0x05c0('0x30')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x2df109[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x2df109[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1c')]);}_0x2df109[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x39')]);_0x2df109[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x57886b[_0x05c0('0x30')],_0xbe7d9e[_0x05c0('0x3b')]),_0xd6574e);if(_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]){_0x2df109[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x2df109['where'],{'$or':_[_0x05c0('0x29')](_0xd6574e,function(_0x249101){if(_0x249101[_0x05c0('0x2d')]!==_0x05c0('0x3f')){var _0x49f829={};_0x49f829[_0x249101['name']]={'$like':'%'+_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x49f829;}})});}_0x2df109=_[_0x05c0('0x3e')]({},_0x2df109,_0x57886b['options']);var _0x29dc87={'where':_0x2df109[_0x05c0('0x3a')]};return db[_0x05c0('0x2a')][_0x05c0('0x40')](_0x29dc87)['then'](function(_0x152c6a){_0x2053d5[_0x05c0('0x40')]=_0x152c6a;if(_0x57886b['query'][_0x05c0('0x41')]){_0x2df109[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x43')](_0x2df109);})[_0x05c0('0x24')](function(_0x398a6e){_0x2053d5[_0x05c0('0x44')]=_0x398a6e;return _0x2053d5;})['then'](respondWithFilteredResult(_0x56ba64,_0x2df109))['catch'](handleError(_0x56ba64,null));};exports[_0x05c0('0x45')]=function(_0x1d1d94,_0xaa5d53){var _0x11f079={'raw':![],'where':{'id':_0x1d1d94['params']['id']}},_0x14aba3={};_0x14aba3[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x2a')][_0x05c0('0x2b')]);_0x14aba3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x1d1d94[_0x05c0('0x30')]);_0x14aba3['filters']=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],_0x14aba3[_0x05c0('0x30')]);_0x11f079[_0x05c0('0x33')]=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x34')]));_0x11f079[_0x05c0('0x33')]=_0x11f079[_0x05c0('0x33')]['length']?_0x11f079['attributes']:_0x14aba3[_0x05c0('0x2f')];if(_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x41')]){_0x11f079[_0x05c0('0x42')]=[{'all':!![]}];}_0x11f079=_[_0x05c0('0x3e')]({},_0x11f079,_0x1d1d94[_0x05c0('0x46')]);return db['ZendeskAccount'][_0x05c0('0x47')](_0x11f079)[_0x05c0('0x24')](handleEntityNotFound(_0xaa5d53,null))[_0x05c0('0x24')](respondWithResult(_0xaa5d53,null))[_0x05c0('0x48')](handleError(_0xaa5d53,null));};exports['create']=function(_0x34e94e,_0x2440e8){return db[_0x05c0('0x2a')][_0x05c0('0x49')](_0x34e94e['body'],{})[_0x05c0('0x24')](respondWithResult(_0x2440e8,0xc9))[_0x05c0('0x48')](handleError(_0x2440e8,null));};exports[_0x05c0('0x23')]=function(_0x9b521b,_0x5ef6cf){if(_0x9b521b[_0x05c0('0x4a')]['id']){delete _0x9b521b[_0x05c0('0x4a')]['id'];}return db['ZendeskAccount'][_0x05c0('0x47')]({'where':{'id':_0x9b521b['params']['id']}})['then'](handleEntityNotFound(_0x5ef6cf,null))[_0x05c0('0x24')](saveUpdates(_0x9b521b['body'],null))[_0x05c0('0x24')](respondWithResult(_0x5ef6cf,null))[_0x05c0('0x48')](handleError(_0x5ef6cf,null));};exports[_0x05c0('0x4b')]=function(_0x371aff,_0x3ccae9){return db[_0x05c0('0x2a')]['find']({'where':{'id':_0x371aff[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ccae9,null))[_0x05c0('0x24')](removeEntity(_0x3ccae9,null))[_0x05c0('0x48')](handleError(_0x3ccae9,null));};exports[_0x05c0('0x4d')]=function(_0x13ad38,_0x1496d4,_0x37ad50){var _0x156087={};var _0x551b7b={};var _0x5215b4;var _0x523153;return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x13ad38['params']['id']}})['then'](handleEntityNotFound(_0x1496d4,null))[_0x05c0('0x24')](function(_0x1a72d6){if(_0x1a72d6){_0x5215b4=_0x1a72d6;_0x551b7b[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x4f')][_0x05c0('0x2b')]);_0x551b7b[_0x05c0('0x30')]=_['keys'](_0x13ad38[_0x05c0('0x30')]);_0x551b7b[_0x05c0('0x3b')]=_[_0x05c0('0x32')](_0x551b7b[_0x05c0('0x2f')],_0x551b7b['query']);_0x156087[_0x05c0('0x33')]=_['intersection'](_0x551b7b[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x13ad38['query'][_0x05c0('0x34')]));_0x156087['attributes']=_0x156087[_0x05c0('0x33')][_0x05c0('0x35')]?_0x156087[_0x05c0('0x33')]:_0x551b7b[_0x05c0('0x2f')];_0x156087[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x13ad38['query'][_0x05c0('0x39')]);_0x156087[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x13ad38[_0x05c0('0x30')],_0x551b7b[_0x05c0('0x3b')]));if(_0x13ad38['query'][_0x05c0('0x3d')]){_0x156087[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x156087[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x156087[_0x05c0('0x33')],function(_0xf5e123){var _0x866523={};_0x866523[_0xf5e123]={'$like':'%'+_0x13ad38[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x866523;})});}_0x156087=_[_0x05c0('0x3e')]({},_0x156087,_0x13ad38[_0x05c0('0x46')]);return _0x5215b4['getConfigurations'](_0x156087);}})['then'](function(_0x5269b4){if(_0x5269b4){_0x523153=_0x5269b4[_0x05c0('0x35')];if(!_0x13ad38[_0x05c0('0x30')][_0x05c0('0x36')]('nolimit')){_0x156087[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x13ad38[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x156087[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x13ad38[_0x05c0('0x30')]['offset']);}return _0x5215b4[_0x05c0('0x4d')](_0x156087);}})[_0x05c0('0x24')](function(_0x355b44){if(_0x355b44){return _0x355b44?{'count':_0x523153,'rows':_0x355b44}:null;}})[_0x05c0('0x24')](respondWithResult(_0x1496d4,null))['catch'](handleError(_0x1496d4,null));};exports['addConfiguration']=function(_0x5e4941,_0x3b74c5,_0x2b8a13){if(_0x5e4941[_0x05c0('0x4a')]['id']){delete _0x5e4941[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x5e4941[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b74c5,null))[_0x05c0('0x24')](function(_0x225397){if(_0x225397){_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x50')]=_0x225397['id'];_0x5e4941[_0x05c0('0x4a')]['Subjects']=integrations['getSubjects'](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body'][_0x05c0('0x2d')]);_0x5e4941['body']['Descriptions']=integrations[_0x05c0('0x52')](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body']['type']);return db[_0x05c0('0x4f')][_0x05c0('0x49')](_0x5e4941[_0x05c0('0x4a')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3b74c5,null))[_0x05c0('0x48')](handleError(_0x3b74c5,null));};exports['getFields']=function(_0x496acf,_0x5bb9ef,_0xd7a2f3){var _0x1a6dc4='';return db[_0x05c0('0x2a')]['findOne']({'where':{'id':_0x496acf[_0x05c0('0x4c')]['id']},'attributes':['id',_0x05c0('0x53'),'password',_0x05c0('0x54'),_0x05c0('0x55'),_0x05c0('0x56')]})[_0x05c0('0x24')](handleEntityNotFound(_0x5bb9ef,null))['then'](function(_0x35ef76){if(_0x35ef76){_0x1a6dc4=_0x35ef76[_0x05c0('0x56')];var _0xc150e3=_0x1a6dc4[_0x05c0('0x57')](-0x1);if(_0xc150e3==='/'){_0x1a6dc4=_0x1a6dc4[_0x05c0('0x58')](0x0,_0x1a6dc4['lastIndexOf'](_0xc150e3));}var _0x4aee38={'method':_0x05c0('0x59'),'uri':util['format'](_0x05c0('0x5a'),_0x1a6dc4,_0x05c0('0x5b')),'json':!![]};switch(_0x35ef76['authType']){case _0x05c0('0x5c'):_0x4aee38['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x05c0('0x5d'),_0x35ef76[_0x05c0('0x53')],_0x35ef76[_0x05c0('0x5c')]))[_0x05c0('0x5e')]('base64'))};break;case _0x05c0('0x54'):_0x4aee38[_0x05c0('0x5f')]={'Authorization':util[_0x05c0('0x60')](_0x05c0('0x61'),new Buffer(util[_0x05c0('0x60')]('%s/token:%s',_0x35ef76[_0x05c0('0x53')],_0x35ef76['token']))['toString'](_0x05c0('0x62')))};break;default:throw new db[(_0x05c0('0x63'))][(_0x05c0('0x64'))](_0x05c0('0x65'));}return rp(_0x4aee38);}})[_0x05c0('0x24')](function(_0x4577ee){if(_0x4577ee){var _0x4c3c73=['subject',_0x05c0('0x66'),_0x05c0('0x67'),_0x05c0('0x68')];_['remove'](_0x4577ee[_0x05c0('0x5b')],function(_0x7c5ce6){return _0x4c3c73[_0x05c0('0x69')](_0x7c5ce6[_0x05c0('0x2d')]);});return{'count':_0x4577ee[_0x05c0('0x5b')][_0x05c0('0x35')],'rows':_['map'](_0x4577ee[_0x05c0('0x5b')],function(_0x464ae0){return{'id':_0x464ae0['id'],'name':_0x464ae0['position']>0x7?_0x464ae0[_0x05c0('0x6a')]:_0x464ae0[_0x05c0('0x2d')],'custom':_0x464ae0['position']>0x7?!![]:![],'options':_0x464ae0[_0x05c0('0x6b')]?_0x464ae0[_0x05c0('0x6b')]:_0x464ae0[_0x05c0('0x6c')]?_0x464ae0[_0x05c0('0x6c')]:[]};})};}})[_0x05c0('0x24')](respondWithResult(_0x5bb9ef,null))[_0x05c0('0x48')](function(_0x544d6c){var _0x63f20=_0x496acf['query'][_0x05c0('0x6d')]?0x1f4:_0x544d6c[_0x05c0('0x6e')]||0x1f4;logger[_0x05c0('0x6f')](_0x05c0('0x70'),_0x05c0('0x71'),_0x63f20,JSON[_0x05c0('0x72')](_0x544d6c));delete _0x544d6c[_0x05c0('0x26')];if(_0x63f20===0x191){_0x63f20=0x190;}_0x5bb9ef[_0x05c0('0x1a')](_0x63f20)[_0x05c0('0x27')](_0x496acf[_0x05c0('0x30')]['test']?{'message':_0x05c0('0x73'),'statusCode':_0x544d6c['statusCode']}:_0x544d6c);});}; \ No newline at end of file +var _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x28a1cf,_0x1d4415){var _0x44223b=function(_0x1e7e4d){while(--_0x1e7e4d){_0x28a1cf['push'](_0x28a1cf['shift']());}};_0x44223b(++_0x1d4415);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a1ad789..04ecfb7 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 _0x28d1=['../../components/integrations/configuration','exports','define','ZendeskAccount','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4dd6aa,_0x4c4f35){var _0x477430=function(_0x3c0d56){while(--_0x3c0d56){_0x4dd6aa['push'](_0x4dd6aa['shift']());}};_0x477430(++_0x4c4f35);}(_0x28d1,0xeb));var _0x128d=function(_0x35ec8d,_0x28b125){_0x35ec8d=_0x35ec8d-0x0;var _0x48bb46=_0x28d1[_0x35ec8d];return _0x48bb46;};'use strict';var _=require('lodash');var util=require(_0x128d('0x0'));var logger=require(_0x128d('0x1'))(_0x128d('0x2'));var moment=require(_0x128d('0x3'));var BPromise=require('bluebird');var rp=require(_0x128d('0x4'));var fs=require('fs');var path=require(_0x128d('0x5'));var rimraf=require('rimraf');var config=require(_0x128d('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x128d('0x7'));module[_0x128d('0x8')]=function(_0x2f2f14,_0x530e47){return _0x2f2f14[_0x128d('0x9')](_0x128d('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef8b=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','int_zendesk_accounts'];(function(_0xc4a714,_0x14be38){var _0x17a34c=function(_0x3659c7){while(--_0x3659c7){_0xc4a714['push'](_0xc4a714['shift']());}};_0x17a34c(++_0x14be38);}(_0xef8b,0xe7));var _0xbef8=function(_0xab0515,_0x4b8ab2){_0xab0515=_0xab0515-0x0;var _0x443d59=_0xef8b[_0xab0515];return _0x443d59;};'use strict';var _=require(_0xbef8('0x0'));var util=require('util');var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbef8('0x6'));var config=require(_0xbef8('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xbef8('0x8'));module['exports']=function(_0x2270fc,_0x4f008d){return _0x2270fc[_0xbef8('0x9')]('ZendeskAccount',attributes,{'tableName':_0xbef8('0xa'),'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 93346ab..d84a513 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 _0x01ad=['jayson/promise','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','catch','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','ZendeskAccount','raw','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x456a1b,_0x169c26){var _0x14248c=function(_0x2dda4e){while(--_0x2dda4e){_0x456a1b['push'](_0x456a1b['shift']());}};_0x14248c(++_0x169c26);}(_0x01ad,0xd2));var _0xd01a=function(_0x13f1c8,_0x49a872){_0x13f1c8=_0x13f1c8-0x0;var _0x1e716a=_0x01ad[_0x13f1c8];return _0x1e716a;};'use strict';var _=require(_0xd01a('0x0'));var util=require('util');var moment=require(_0xd01a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd01a('0x2'));var db=require(_0xd01a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd01a('0x4'))(_0xd01a('0x5'));var config=require(_0xd01a('0x6'));var jayson=require(_0xd01a('0x7'));var client=jayson['client'][_0xd01a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f150,_0x1df345,_0x5be6a1){return new BPromise(function(_0x24895f,_0x4f1b67){return client[_0xd01a('0x9')](_0x26f150,_0x5be6a1)[_0xd01a('0xa')](function(_0x3087d7){logger[_0xd01a('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x1df345,_0xd01a('0xc'));logger[_0xd01a('0xd')](_0xd01a('0xe'),_0x1df345,_0xd01a('0xc'),JSON[_0xd01a('0xf')](_0x3087d7));if(_0x3087d7[_0xd01a('0x10')]){if(_0x3087d7[_0xd01a('0x10')]['code']===0x1f4){logger[_0xd01a('0x10')](_0xd01a('0x11'),_0x1df345,_0x3087d7['error'][_0xd01a('0x12')]);return _0x4f1b67(_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);}logger[_0xd01a('0x10')](_0xd01a('0x11'),_0x1df345,_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);return _0x24895f(_0x3087d7[_0xd01a('0x10')][_0xd01a('0x12')]);}else{logger[_0xd01a('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x1df345,'request\x20sent');_0x24895f(_0x3087d7['result'][_0xd01a('0x12')]);}})[_0xd01a('0x13')](function(_0x1bf3a7){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1df345,_0x1bf3a7);_0x4f1b67(_0x1bf3a7);});});}exports['GetZendeskAccount']=function(_0x3942af){var _0x24440d=this;return new Promise(function(_0x2ad723,_0x3df023){return db['ZendeskAccount'][_0xd01a('0x14')]({'raw':_0x3942af[_0xd01a('0x15')]?_0x3942af[_0xd01a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3942af['options']?_0x3942af[_0xd01a('0x15')][_0xd01a('0x16')]||null:null,'attributes':_0x3942af[_0xd01a('0x15')]?_0x3942af['options'][_0xd01a('0x17')]||null:null,'limit':_0x3942af[_0xd01a('0x15')]?_0x3942af[_0xd01a('0x15')][_0xd01a('0x18')]||null:null,'include':_0x3942af['options']?_0x3942af['options']['include']?_['map'](_0x3942af[_0xd01a('0x15')][_0xd01a('0x19')],function(_0x5d12b6){return{'model':db[_0x5d12b6[_0xd01a('0x1a')]],'as':_0x5d12b6['as'],'attributes':_0x5d12b6[_0xd01a('0x17')],'include':_0x5d12b6['include']?_[_0xd01a('0x1b')](_0x5d12b6[_0xd01a('0x19')],function(_0x4ba09f){return{'model':db[_0x4ba09f[_0xd01a('0x1a')]],'as':_0x4ba09f['as'],'attributes':_0x4ba09f[_0xd01a('0x17')],'include':_0x4ba09f['include']?_[_0xd01a('0x1b')](_0x4ba09f[_0xd01a('0x19')],function(_0x3f0905){return{'model':db[_0x3f0905[_0xd01a('0x1a')]],'as':_0x3f0905['as'],'attributes':_0x3f0905['attributes']};}):[]};}):[]};}):[]:[]})[_0xd01a('0xa')](function(_0x268304){logger[_0xd01a('0xb')]('GetZendeskAccount',_0x3942af);logger[_0xd01a('0xd')]('GetZendeskAccount',_0x3942af,JSON['stringify'](_0x268304));_0x2ad723(_0x268304);})[_0xd01a('0x13')](function(_0x3ecaf5){logger[_0xd01a('0x10')]('GetZendeskAccount',_0x3ecaf5[_0xd01a('0x12')],_0x3942af);_0x3df023(_0x24440d[_0xd01a('0x10')](0x1f4,_0x3ecaf5[_0xd01a('0x12')]));});});};exports[_0xd01a('0x1c')]=function(_0x2ec6eb){var _0x20f457=this;return new Promise(function(_0x27597c,_0x386e4d){return db[_0xd01a('0x1d')]['find']({'raw':_0x2ec6eb[_0xd01a('0x15')]?_0x2ec6eb[_0xd01a('0x15')][_0xd01a('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ec6eb['options']?_0x2ec6eb[_0xd01a('0x15')]['where']||null:null,'attributes':_0x2ec6eb[_0xd01a('0x15')]?_0x2ec6eb['options'][_0xd01a('0x17')]||null:null,'include':_0x2ec6eb[_0xd01a('0x15')]?_0x2ec6eb[_0xd01a('0x15')][_0xd01a('0x19')]?_[_0xd01a('0x1b')](_0x2ec6eb[_0xd01a('0x15')][_0xd01a('0x19')],function(_0x144ec6){return{'model':db[_0x144ec6['model']],'as':_0x144ec6['as'],'attributes':_0x144ec6[_0xd01a('0x17')],'include':_0x144ec6[_0xd01a('0x19')]?_[_0xd01a('0x1b')](_0x144ec6[_0xd01a('0x19')],function(_0x4a7ce3){return{'model':db[_0x4a7ce3['model']],'as':_0x4a7ce3['as'],'attributes':_0x4a7ce3[_0xd01a('0x17')],'include':_0x4a7ce3[_0xd01a('0x19')]?_['map'](_0x4a7ce3[_0xd01a('0x19')],function(_0x3e27fb){return{'model':db[_0x3e27fb['model']],'as':_0x3e27fb['as'],'attributes':_0x3e27fb[_0xd01a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd01a('0xa')](function(_0x1d3155){logger[_0xd01a('0xb')](_0xd01a('0x1c'),_0x2ec6eb);logger['debug'](_0xd01a('0x1c'),_0x2ec6eb,JSON['stringify'](_0x1d3155));_0x27597c(_0x1d3155);})[_0xd01a('0x13')](function(_0x11f8d7){logger[_0xd01a('0x10')]('ShowZendeskAccount',_0x11f8d7[_0xd01a('0x12')],_0x2ec6eb);_0x386e4d(_0x20f457[_0xd01a('0x10')](0x1f4,_0x11f8d7[_0xd01a('0x12')]));});});}; \ No newline at end of file +var _0x8cbe=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x5e3d12,_0x5599bf){var _0x3dbe52=function(_0x45a3a3){while(--_0x45a3a3){_0x5e3d12['push'](_0x5e3d12['shift']());}};_0x3dbe52(++_0x5599bf);}(_0x8cbe,0x1a1));var _0xe8cb=function(_0x52f3aa,_0x36e378){_0x52f3aa=_0x52f3aa-0x0;var _0x13f3d5=_0x8cbe[_0x52f3aa];return _0x13f3d5;};'use strict';var _=require(_0xe8cb('0x0'));var util=require(_0xe8cb('0x1'));var moment=require(_0xe8cb('0x2'));var BPromise=require(_0xe8cb('0x3'));var rs=require(_0xe8cb('0x4'));var fs=require('fs');var Redis=require(_0xe8cb('0x5'));var db=require(_0xe8cb('0x6'))['db'];var utils=require(_0xe8cb('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe8cb('0x8'));var jayson=require(_0xe8cb('0x9'));var client=jayson['client'][_0xe8cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdf271,_0x483296,_0x3108cc){return new BPromise(function(_0x3b831a,_0x1f9032){return client[_0xe8cb('0xb')](_0xbdf271,_0x3108cc)[_0xe8cb('0xc')](function(_0xa3acc6){logger[_0xe8cb('0xd')](_0xe8cb('0xe'),_0x483296,_0xe8cb('0xf'));logger[_0xe8cb('0x10')](_0xe8cb('0x11'),_0x483296,'request\x20sent',JSON[_0xe8cb('0x12')](_0xa3acc6));if(_0xa3acc6['error']){if(_0xa3acc6[_0xe8cb('0x13')][_0xe8cb('0x14')]===0x1f4){logger[_0xe8cb('0x13')](_0xe8cb('0xe'),_0x483296,_0xa3acc6[_0xe8cb('0x13')][_0xe8cb('0x15')]);return _0x1f9032(_0xa3acc6[_0xe8cb('0x13')][_0xe8cb('0x15')]);}logger[_0xe8cb('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x483296,_0xa3acc6[_0xe8cb('0x13')]['message']);return _0x3b831a(_0xa3acc6['error'][_0xe8cb('0x15')]);}else{logger[_0xe8cb('0xd')](_0xe8cb('0xe'),_0x483296,_0xe8cb('0xf'));_0x3b831a(_0xa3acc6[_0xe8cb('0x16')][_0xe8cb('0x15')]);}})[_0xe8cb('0x17')](function(_0x1e15c2){logger[_0xe8cb('0x13')](_0xe8cb('0xe'),_0x483296,_0x1e15c2);_0x1f9032(_0x1e15c2);});});}exports[_0xe8cb('0x18')]=function(_0x513b19){var _0x5c9e29=this;return new Promise(function(_0x1f33f8,_0x2ae919){return db['ZendeskAccount'][_0xe8cb('0x19')]({'raw':_0x513b19['options']?_0x513b19[_0xe8cb('0x1a')][_0xe8cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x513b19['options']?_0x513b19[_0xe8cb('0x1a')][_0xe8cb('0x1c')]||null:null,'attributes':_0x513b19[_0xe8cb('0x1a')]?_0x513b19['options'][_0xe8cb('0x1d')]||null:null,'limit':_0x513b19['options']?_0x513b19[_0xe8cb('0x1a')]['limit']||null:null,'include':_0x513b19[_0xe8cb('0x1a')]?_0x513b19[_0xe8cb('0x1a')]['include']?_['map'](_0x513b19[_0xe8cb('0x1a')][_0xe8cb('0x1e')],function(_0x2e2963){return{'model':db[_0x2e2963[_0xe8cb('0x1f')]],'as':_0x2e2963['as'],'attributes':_0x2e2963[_0xe8cb('0x1d')],'include':_0x2e2963[_0xe8cb('0x1e')]?_[_0xe8cb('0x20')](_0x2e2963[_0xe8cb('0x1e')],function(_0x911e0e){return{'model':db[_0x911e0e[_0xe8cb('0x1f')]],'as':_0x911e0e['as'],'attributes':_0x911e0e[_0xe8cb('0x1d')],'include':_0x911e0e['include']?_['map'](_0x911e0e[_0xe8cb('0x1e')],function(_0x348215){return{'model':db[_0x348215['model']],'as':_0x348215['as'],'attributes':_0x348215[_0xe8cb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe8cb('0xc')](function(_0x244d7e){logger['info'](_0xe8cb('0x18'),_0x513b19);logger[_0xe8cb('0x10')](_0xe8cb('0x18'),_0x513b19,JSON[_0xe8cb('0x12')](_0x244d7e));_0x1f33f8(_0x244d7e);})[_0xe8cb('0x17')](function(_0x1e39d5){logger[_0xe8cb('0x13')](_0xe8cb('0x18'),_0x1e39d5[_0xe8cb('0x15')],_0x513b19);_0x2ae919(_0x5c9e29[_0xe8cb('0x13')](0x1f4,_0x1e39d5[_0xe8cb('0x15')]));});});};exports[_0xe8cb('0x21')]=function(_0x497129){var _0x31b724=this;return new Promise(function(_0x16ac7b,_0x1bbd03){return db[_0xe8cb('0x22')][_0xe8cb('0x23')]({'raw':_0x497129[_0xe8cb('0x1a')]?_0x497129[_0xe8cb('0x1a')][_0xe8cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x497129['options']?_0x497129[_0xe8cb('0x1a')][_0xe8cb('0x1c')]||null:null,'attributes':_0x497129[_0xe8cb('0x1a')]?_0x497129[_0xe8cb('0x1a')]['attributes']||null:null,'include':_0x497129[_0xe8cb('0x1a')]?_0x497129[_0xe8cb('0x1a')][_0xe8cb('0x1e')]?_[_0xe8cb('0x20')](_0x497129[_0xe8cb('0x1a')]['include'],function(_0xbc7f0a){return{'model':db[_0xbc7f0a[_0xe8cb('0x1f')]],'as':_0xbc7f0a['as'],'attributes':_0xbc7f0a[_0xe8cb('0x1d')],'include':_0xbc7f0a[_0xe8cb('0x1e')]?_[_0xe8cb('0x20')](_0xbc7f0a['include'],function(_0x52d0e9){return{'model':db[_0x52d0e9['model']],'as':_0x52d0e9['as'],'attributes':_0x52d0e9[_0xe8cb('0x1d')],'include':_0x52d0e9[_0xe8cb('0x1e')]?_[_0xe8cb('0x20')](_0x52d0e9[_0xe8cb('0x1e')],function(_0x55fc35){return{'model':db[_0x55fc35[_0xe8cb('0x1f')]],'as':_0x55fc35['as'],'attributes':_0x55fc35[_0xe8cb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe8cb('0xc')](function(_0x45e1c9){logger[_0xe8cb('0xd')](_0xe8cb('0x21'),_0x497129);logger[_0xe8cb('0x10')]('ShowZendeskAccount',_0x497129,JSON[_0xe8cb('0x12')](_0x45e1c9));_0x16ac7b(_0x45e1c9);})[_0xe8cb('0x17')](function(_0x3d9793){logger['error']('ShowZendeskAccount',_0x3d9793['message'],_0x497129);_0x1bbd03(_0x31b724[_0xe8cb('0x13')](0x1f4,_0x3d9793['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 049c815..d0eb23a 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x2781a9,_0x46fa7b){var _0x50045d=function(_0x3fd592){while(--_0x3fd592){_0x2781a9['push'](_0x2781a9['shift']());}};_0x50045d(++_0x46fa7b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0xb10b[_0x2f8a7c];return _0x257e01;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x4c7529,_0x458dee){var _0x2c464e=function(_0x249ad6){while(--_0x249ad6){_0x4c7529['push'](_0x4c7529['shift']());}};_0x2c464e(++_0x458dee);}(_0xda3f,0xec));var _0xfda3=function(_0x1b87e1,_0x3a79c1){_0x1b87e1=_0x1b87e1-0x0;var _0xb51476=_0xda3f[_0x1b87e1];return _0xb51476;};'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('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f39e4fa..bb2b168 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 _0x1d62=['STRING','sequelize','exports'];(function(_0x3fa7d8,_0x3133e0){var _0x1ee70d=function(_0x25b49e){while(--_0x25b49e){_0x3fa7d8['push'](_0x3fa7d8['shift']());}};_0x1ee70d(++_0x3133e0);}(_0x1d62,0xbb));var _0x21d6=function(_0x16a8fe,_0x322b76){_0x16a8fe=_0x16a8fe-0x0;var _0x20225b=_0x1d62[_0x16a8fe];return _0x20225b;};'use strict';var Sequelize=require(_0x21d6('0x0'));module[_0x21d6('0x1')]={'name':{'type':Sequelize[_0x21d6('0x2')]},'description':{'type':Sequelize[_0x21d6('0x2')]}}; \ No newline at end of file +var _0x3f5c=['sequelize','exports','STRING'];(function(_0x9a41ad,_0x2b6a8f){var _0x446d06=function(_0x31d936){while(--_0x31d936){_0x9a41ad['push'](_0x9a41ad['shift']());}};_0x446d06(++_0x2b6a8f);}(_0x3f5c,0x1b0));var _0xc3f5=function(_0x3ce818,_0xd56965){_0x3ce818=_0x3ce818-0x0;var _0x1d03ec=_0x3f5c[_0x3ce818];return _0x1d03ec;};'use strict';var Sequelize=require(_0xc3f5('0x0'));module[_0xc3f5('0x1')]={'name':{'type':Sequelize[_0xc3f5('0x2')]},'description':{'type':Sequelize[_0xc3f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3c487ed..2e6ee75 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 _0xbabb=['json','offset','limit','count','set','apply','reject','update','destroy','then','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x34900e,_0x34b071){var _0x2e4199=function(_0x2c4649){while(--_0x2c4649){_0x34900e['push'](_0x34900e['shift']());}};_0x2e4199(++_0x34b071);}(_0xbabb,0x1c4));var _0xbbab=function(_0xc66e75,_0x3cf7ad){_0xc66e75=_0xc66e75-0x0;var _0x30d174=_0xbabb[_0xc66e75];return _0x30d174;};'use strict';var emlformat=require(_0xbbab('0x0'));var rimraf=require(_0xbbab('0x1'));var zipdir=require(_0xbbab('0x2'));var jsonpatch=require(_0xbbab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbab('0x4'));var util=require(_0xbbab('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbbab('0x6'));var ejs=require(_0xbbab('0x7'));var fs=require('fs');var fs_extra=require(_0xbbab('0x8'));var _=require(_0xbbab('0x9'));var squel=require('squel');var crypto=require(_0xbbab('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbbab('0x6'));var querystring=require(_0xbbab('0xb'));var Papa=require(_0xbbab('0xc'));var Redis=require('ioredis');var authService=require(_0xbbab('0xd'));var qs=require(_0xbbab('0xe'));var as=require(_0xbbab('0xf'));var hardwareService=require(_0xbbab('0x10'));var logger=require(_0xbbab('0x11'))('api');var utils=require(_0xbbab('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbbab('0x13'));var db=require(_0xbbab('0x14'))['db'];function respondWithStatusCode(_0x568e26,_0x31a05a){_0x31a05a=_0x31a05a||0xcc;return function(_0x1b9b84){if(_0x1b9b84){return _0x568e26['sendStatus'](_0x31a05a);}return _0x568e26[_0xbbab('0x15')](_0x31a05a)['end']();};}function respondWithResult(_0xbbf691,_0x5ae0c9){_0x5ae0c9=_0x5ae0c9||0xc8;return function(_0x4e7387){if(_0x4e7387){return _0xbbf691['status'](_0x5ae0c9)[_0xbbab('0x16')](_0x4e7387);}};}function respondWithFilteredResult(_0x58b2c0,_0x29b71d){return function(_0x3675ea){if(_0x3675ea){var _0xec5058=typeof _0x29b71d[_0xbbab('0x17')]==='undefined'&&typeof _0x29b71d[_0xbbab('0x18')]==='undefined';var _0x98de16=_0x3675ea[_0xbbab('0x19')];var _0x34096e=_0xec5058?0x0:_0x29b71d[_0xbbab('0x17')];var _0x208376=_0xec5058?_0x3675ea[_0xbbab('0x19')]:_0x29b71d['offset']+_0x29b71d[_0xbbab('0x18')];var _0x57846f;if(_0x208376>=_0x98de16){_0x208376=_0x98de16;_0x57846f=0xc8;}else{_0x57846f=0xce;}_0x58b2c0[_0xbbab('0x15')](_0x57846f);return _0x58b2c0[_0xbbab('0x1a')]('Content-Range',_0x34096e+'-'+_0x208376+'/'+_0x98de16)[_0xbbab('0x16')](_0x3675ea);}return null;};}function patchUpdates(_0x1e11d7){return function(_0x1d6256){try{jsonpatch[_0xbbab('0x1b')](_0x1d6256,_0x1e11d7,!![]);}catch(_0x382ff8){return BPromise[_0xbbab('0x1c')](_0x382ff8);}return _0x1d6256['save']();};}function saveUpdates(_0x272f0e,_0x4b144e){return function(_0x31bed3){if(_0x31bed3){return _0x31bed3[_0xbbab('0x1d')](_0x272f0e)['then'](function(_0x1ff4d2){return _0x1ff4d2;});}return null;};}function removeEntity(_0x20a05a,_0x5e94ba){return function(_0x3efa3a){if(_0x3efa3a){return _0x3efa3a[_0xbbab('0x1e')]()[_0xbbab('0x1f')](function(){_0x20a05a[_0xbbab('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19179e,_0x5a71ca){return function(_0x2dadbe){if(!_0x2dadbe){_0x19179e['sendStatus'](0x194);}return _0x2dadbe;};}function handleError(_0x1e8d2c,_0x3e6eba){_0x3e6eba=_0x3e6eba||0x1f4;return function(_0x500b4a){logger[_0xbbab('0x20')](_0x500b4a['stack']);if(_0x500b4a[_0xbbab('0x21')]){delete _0x500b4a[_0xbbab('0x21')];}_0x1e8d2c[_0xbbab('0x15')](_0x3e6eba)[_0xbbab('0x22')](_0x500b4a);};}exports[_0xbbab('0x23')]=function(_0x5d08fe,_0xc3587a){var _0x1a59dc={},_0x30d46b={},_0x602a30={'count':0x0,'rows':[]};var _0x3d593e=_['map'](db[_0xbbab('0x24')][_0xbbab('0x25')],function(_0x1cea90){return{'name':_0x1cea90[_0xbbab('0x26')],'type':_0x1cea90[_0xbbab('0x27')][_0xbbab('0x28')]};});_0x30d46b[_0xbbab('0x29')]=_[_0xbbab('0x2a')](_0x3d593e,_0xbbab('0x21'));_0x30d46b['query']=_['keys'](_0x5d08fe['query']);_0x30d46b['filters']=_[_0xbbab('0x2b')](_0x30d46b[_0xbbab('0x29')],_0x30d46b[_0xbbab('0x2c')]);_0x1a59dc[_0xbbab('0x2d')]=_[_0xbbab('0x2b')](_0x30d46b['model'],qs[_0xbbab('0x2e')](_0x5d08fe['query']['fields']));_0x1a59dc[_0xbbab('0x2d')]=_0x1a59dc[_0xbbab('0x2d')][_0xbbab('0x2f')]?_0x1a59dc[_0xbbab('0x2d')]:_0x30d46b[_0xbbab('0x29')];if(!_0x5d08fe[_0xbbab('0x2c')][_0xbbab('0x30')](_0xbbab('0x31'))){_0x1a59dc[_0xbbab('0x18')]=qs[_0xbbab('0x18')](_0x5d08fe[_0xbbab('0x2c')][_0xbbab('0x18')]);_0x1a59dc[_0xbbab('0x17')]=qs[_0xbbab('0x17')](_0x5d08fe[_0xbbab('0x2c')][_0xbbab('0x17')]);}_0x1a59dc[_0xbbab('0x32')]=qs[_0xbbab('0x33')](_0x5d08fe[_0xbbab('0x2c')][_0xbbab('0x33')]);_0x1a59dc['where']=qs[_0xbbab('0x34')](_['pick'](_0x5d08fe[_0xbbab('0x2c')],_0x30d46b[_0xbbab('0x34')]),_0x3d593e);if(_0x5d08fe['query'][_0xbbab('0x35')]){_0x1a59dc[_0xbbab('0x36')]=_[_0xbbab('0x37')](_0x1a59dc['where'],{'$or':_[_0xbbab('0x2a')](_0x3d593e,function(_0x5b1306){if(_0x5b1306[_0xbbab('0x27')]!==_0xbbab('0x38')){var _0x23bc8b={};_0x23bc8b[_0x5b1306['name']]={'$like':'%'+_0x5d08fe['query'][_0xbbab('0x35')]+'%'};return _0x23bc8b;}})});}_0x1a59dc=_[_0xbbab('0x37')]({},_0x1a59dc,_0x5d08fe['options']);var _0x5ba1e3={'where':_0x1a59dc[_0xbbab('0x36')]};return db['ZendeskConfiguration'][_0xbbab('0x19')](_0x5ba1e3)['then'](function(_0x525038){_0x602a30[_0xbbab('0x19')]=_0x525038;if(_0x5d08fe[_0xbbab('0x2c')]['includeAll']){_0x1a59dc[_0xbbab('0x39')]=[{'all':!![]}];}return db[_0xbbab('0x24')][_0xbbab('0x3a')](_0x1a59dc);})[_0xbbab('0x1f')](function(_0x1b30fe){_0x602a30[_0xbbab('0x3b')]=_0x1b30fe;return _0x602a30;})['then'](respondWithFilteredResult(_0xc3587a,_0x1a59dc))[_0xbbab('0x3c')](handleError(_0xc3587a,null));};exports[_0xbbab('0x3d')]=function(_0x246234,_0x3c0715){var _0x3094bd={'raw':![],'where':{'id':_0x246234[_0xbbab('0x3e')]['id']}},_0x224e0c={};_0x224e0c['model']=_[_0xbbab('0x3f')](db[_0xbbab('0x24')][_0xbbab('0x25')]);_0x224e0c['query']=_[_0xbbab('0x3f')](_0x246234[_0xbbab('0x2c')]);_0x224e0c[_0xbbab('0x34')]=_[_0xbbab('0x2b')](_0x224e0c[_0xbbab('0x29')],_0x224e0c[_0xbbab('0x2c')]);_0x3094bd[_0xbbab('0x2d')]=_[_0xbbab('0x2b')](_0x224e0c[_0xbbab('0x29')],qs[_0xbbab('0x2e')](_0x246234['query'][_0xbbab('0x2e')]));_0x3094bd['attributes']=_0x3094bd[_0xbbab('0x2d')][_0xbbab('0x2f')]?_0x3094bd[_0xbbab('0x2d')]:_0x224e0c[_0xbbab('0x29')];if(_0x246234[_0xbbab('0x2c')][_0xbbab('0x40')]){_0x3094bd[_0xbbab('0x39')]=[{'all':!![]}];}_0x3094bd=_[_0xbbab('0x37')]({},_0x3094bd,_0x246234[_0xbbab('0x41')]);return db['ZendeskConfiguration'][_0xbbab('0x42')](_0x3094bd)['then'](handleEntityNotFound(_0x3c0715,null))[_0xbbab('0x1f')](respondWithResult(_0x3c0715,null))['catch'](handleError(_0x3c0715,null));};exports[_0xbbab('0x43')]=function(_0x4a7382,_0x2b749e){return db[_0xbbab('0x24')]['create'](_0x4a7382[_0xbbab('0x44')],{})[_0xbbab('0x1f')](respondWithResult(_0x2b749e,0xc9))[_0xbbab('0x3c')](handleError(_0x2b749e,null));};exports[_0xbbab('0x1d')]=function(_0x1f3055,_0x5acac6){if(_0x1f3055[_0xbbab('0x44')]['id']){delete _0x1f3055[_0xbbab('0x44')]['id'];}return db[_0xbbab('0x24')][_0xbbab('0x42')]({'where':{'id':_0x1f3055[_0xbbab('0x3e')]['id']}})[_0xbbab('0x1f')](handleEntityNotFound(_0x5acac6,null))[_0xbbab('0x1f')](saveUpdates(_0x1f3055[_0xbbab('0x44')],null))[_0xbbab('0x1f')](respondWithResult(_0x5acac6,null))[_0xbbab('0x3c')](handleError(_0x5acac6,null));};exports['destroy']=function(_0x1310bd,_0x20bc64){return db[_0xbbab('0x24')][_0xbbab('0x42')]({'where':{'id':_0x1310bd['params']['id']}})[_0xbbab('0x1f')](handleEntityNotFound(_0x20bc64,null))['then'](removeEntity(_0x20bc64,null))['catch'](handleError(_0x20bc64,null));};exports[_0xbbab('0x45')]=function(_0x309441,_0x19ba2a,_0x468c7c){var _0x2f4684={};var _0x261680={};var _0x170ca9;var _0x3f81e0;return db[_0xbbab('0x24')][_0xbbab('0x46')]({'where':{'id':_0x309441[_0xbbab('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19ba2a,null))[_0xbbab('0x1f')](function(_0xf5333e){if(_0xf5333e){_0x170ca9=_0xf5333e;_0x261680[_0xbbab('0x29')]=_[_0xbbab('0x3f')](db[_0xbbab('0x47')][_0xbbab('0x25')]);_0x261680[_0xbbab('0x2c')]=_['keys'](_0x309441[_0xbbab('0x2c')]);_0x261680['filters']=_['intersection'](_0x261680[_0xbbab('0x29')],_0x261680[_0xbbab('0x2c')]);_0x2f4684[_0xbbab('0x2d')]=_['intersection'](_0x261680[_0xbbab('0x29')],qs[_0xbbab('0x2e')](_0x309441[_0xbbab('0x2c')][_0xbbab('0x2e')]));_0x2f4684[_0xbbab('0x2d')]=_0x2f4684['attributes'][_0xbbab('0x2f')]?_0x2f4684[_0xbbab('0x2d')]:_0x261680[_0xbbab('0x29')];_0x2f4684[_0xbbab('0x32')]=qs['sort'](_0x309441['query']['sort']);_0x2f4684[_0xbbab('0x36')]=qs['filters'](_[_0xbbab('0x48')](_0x309441[_0xbbab('0x2c')],_0x261680['filters']));if(_0x309441[_0xbbab('0x2c')]['filter']){_0x2f4684[_0xbbab('0x36')]=_[_0xbbab('0x37')](_0x2f4684['where'],{'$or':_[_0xbbab('0x2a')](_0x2f4684['attributes'],function(_0x4fb052){var _0x4df57a={};_0x4df57a[_0x4fb052]={'$like':'%'+_0x309441['query'][_0xbbab('0x35')]+'%'};return _0x4df57a;})});}_0x2f4684=_['merge']({},_0x2f4684,_0x309441['options']);return _0x170ca9['getFields'](_0x2f4684);}})['then'](function(_0x41c710){if(_0x41c710){_0x3f81e0=_0x41c710[_0xbbab('0x2f')];if(!_0x309441[_0xbbab('0x2c')][_0xbbab('0x30')](_0xbbab('0x31'))){_0x2f4684[_0xbbab('0x18')]=qs[_0xbbab('0x18')](_0x309441[_0xbbab('0x2c')][_0xbbab('0x18')]);_0x2f4684[_0xbbab('0x17')]=qs['offset'](_0x309441['query'][_0xbbab('0x17')]);}return _0x170ca9['getFields'](_0x2f4684);}})[_0xbbab('0x1f')](function(_0x5b8d2e){if(_0x5b8d2e){return _0x5b8d2e?{'count':_0x3f81e0,'rows':_0x5b8d2e}:null;}})[_0xbbab('0x1f')](respondWithResult(_0x19ba2a,null))['catch'](handleError(_0x19ba2a,null));};exports[_0xbbab('0x49')]=function(_0x58a987,_0x48b8f5,_0x3ad728){var _0x2439f1={};var _0x89f637={};var _0x34f9ce;var _0x314ab3;return db[_0xbbab('0x24')][_0xbbab('0x46')]({'where':{'id':_0x58a987[_0xbbab('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48b8f5,null))[_0xbbab('0x1f')](function(_0x3d2b32){if(_0x3d2b32){_0x34f9ce=_0x3d2b32;_0x89f637[_0xbbab('0x29')]=_[_0xbbab('0x3f')](db[_0xbbab('0x47')][_0xbbab('0x25')]);_0x89f637[_0xbbab('0x2c')]=_[_0xbbab('0x3f')](_0x58a987[_0xbbab('0x2c')]);_0x89f637[_0xbbab('0x34')]=_[_0xbbab('0x2b')](_0x89f637[_0xbbab('0x29')],_0x89f637[_0xbbab('0x2c')]);_0x2439f1[_0xbbab('0x2d')]=_[_0xbbab('0x2b')](_0x89f637[_0xbbab('0x29')],qs['fields'](_0x58a987[_0xbbab('0x2c')]['fields']));_0x2439f1[_0xbbab('0x2d')]=_0x2439f1[_0xbbab('0x2d')]['length']?_0x2439f1[_0xbbab('0x2d')]:_0x89f637[_0xbbab('0x29')];_0x2439f1[_0xbbab('0x32')]=qs[_0xbbab('0x33')](_0x58a987[_0xbbab('0x2c')][_0xbbab('0x33')]);_0x2439f1[_0xbbab('0x36')]=qs[_0xbbab('0x34')](_[_0xbbab('0x48')](_0x58a987[_0xbbab('0x2c')],_0x89f637['filters']));if(_0x58a987[_0xbbab('0x2c')][_0xbbab('0x35')]){_0x2439f1[_0xbbab('0x36')]=_[_0xbbab('0x37')](_0x2439f1[_0xbbab('0x36')],{'$or':_[_0xbbab('0x2a')](_0x2439f1['attributes'],function(_0x3a7af8){var _0x7bfb46={};_0x7bfb46[_0x3a7af8]={'$like':'%'+_0x58a987[_0xbbab('0x2c')][_0xbbab('0x35')]+'%'};return _0x7bfb46;})});}_0x2439f1=_[_0xbbab('0x37')]({},_0x2439f1,_0x58a987['options']);return _0x34f9ce[_0xbbab('0x49')](_0x2439f1);}})[_0xbbab('0x1f')](function(_0x256886){if(_0x256886){_0x314ab3=_0x256886[_0xbbab('0x2f')];if(!_0x58a987[_0xbbab('0x2c')][_0xbbab('0x30')](_0xbbab('0x31'))){_0x2439f1[_0xbbab('0x18')]=qs[_0xbbab('0x18')](_0x58a987[_0xbbab('0x2c')][_0xbbab('0x18')]);_0x2439f1['offset']=qs[_0xbbab('0x17')](_0x58a987[_0xbbab('0x2c')]['offset']);}return _0x34f9ce[_0xbbab('0x49')](_0x2439f1);}})['then'](function(_0x4ff60d){if(_0x4ff60d){return _0x4ff60d?{'count':_0x314ab3,'rows':_0x4ff60d}:null;}})['then'](respondWithResult(_0x48b8f5,null))[_0xbbab('0x3c')](handleError(_0x48b8f5,null));};exports['getDescriptions']=function(_0x5d53cb,_0x3ccdd7,_0x4fd1c1){var _0x4cf9a9={};var _0x563fbf={};var _0x37f12a;var _0x35ff07;return db[_0xbbab('0x24')][_0xbbab('0x46')]({'where':{'id':_0x5d53cb[_0xbbab('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ccdd7,null))[_0xbbab('0x1f')](function(_0x6c3d8a){if(_0x6c3d8a){_0x37f12a=_0x6c3d8a;_0x563fbf[_0xbbab('0x29')]=_[_0xbbab('0x3f')](db[_0xbbab('0x47')]['rawAttributes']);_0x563fbf[_0xbbab('0x2c')]=_['keys'](_0x5d53cb[_0xbbab('0x2c')]);_0x563fbf[_0xbbab('0x34')]=_[_0xbbab('0x2b')](_0x563fbf[_0xbbab('0x29')],_0x563fbf[_0xbbab('0x2c')]);_0x4cf9a9[_0xbbab('0x2d')]=_[_0xbbab('0x2b')](_0x563fbf[_0xbbab('0x29')],qs[_0xbbab('0x2e')](_0x5d53cb['query'][_0xbbab('0x2e')]));_0x4cf9a9[_0xbbab('0x2d')]=_0x4cf9a9[_0xbbab('0x2d')][_0xbbab('0x2f')]?_0x4cf9a9[_0xbbab('0x2d')]:_0x563fbf[_0xbbab('0x29')];_0x4cf9a9[_0xbbab('0x32')]=qs[_0xbbab('0x33')](_0x5d53cb[_0xbbab('0x2c')][_0xbbab('0x33')]);_0x4cf9a9[_0xbbab('0x36')]=qs[_0xbbab('0x34')](_['pick'](_0x5d53cb[_0xbbab('0x2c')],_0x563fbf[_0xbbab('0x34')]));if(_0x5d53cb[_0xbbab('0x2c')][_0xbbab('0x35')]){_0x4cf9a9[_0xbbab('0x36')]=_[_0xbbab('0x37')](_0x4cf9a9[_0xbbab('0x36')],{'$or':_[_0xbbab('0x2a')](_0x4cf9a9[_0xbbab('0x2d')],function(_0xbe01b4){var _0x47ce78={};_0x47ce78[_0xbe01b4]={'$like':'%'+_0x5d53cb['query'][_0xbbab('0x35')]+'%'};return _0x47ce78;})});}_0x4cf9a9=_[_0xbbab('0x37')]({},_0x4cf9a9,_0x5d53cb[_0xbbab('0x41')]);return _0x37f12a[_0xbbab('0x4a')](_0x4cf9a9);}})[_0xbbab('0x1f')](function(_0xc9e680){if(_0xc9e680){_0x35ff07=_0xc9e680['length'];if(!_0x5d53cb[_0xbbab('0x2c')][_0xbbab('0x30')](_0xbbab('0x31'))){_0x4cf9a9[_0xbbab('0x18')]=qs[_0xbbab('0x18')](_0x5d53cb[_0xbbab('0x2c')][_0xbbab('0x18')]);_0x4cf9a9[_0xbbab('0x17')]=qs[_0xbbab('0x17')](_0x5d53cb[_0xbbab('0x2c')]['offset']);}return _0x37f12a[_0xbbab('0x4a')](_0x4cf9a9);}})[_0xbbab('0x1f')](function(_0x334f45){if(_0x334f45){return _0x334f45?{'count':_0x35ff07,'rows':_0x334f45}:null;}})['then'](respondWithResult(_0x3ccdd7,null))[_0xbbab('0x3c')](handleError(_0x3ccdd7,null));};exports[_0xbbab('0x4b')]=function(_0x52fdbf,_0x3ddba3,_0x353259){var _0x41e4ef={};var _0x5c8a78={};var _0x234f2a;var _0x1b5cf2;return db[_0xbbab('0x24')]['findOne']({'where':{'id':_0x52fdbf[_0xbbab('0x3e')]['id']}})[_0xbbab('0x1f')](handleEntityNotFound(_0x3ddba3,null))[_0xbbab('0x1f')](function(_0x2d6bdf){if(_0x2d6bdf){_0x234f2a=_0x2d6bdf;_0x5c8a78[_0xbbab('0x29')]=_[_0xbbab('0x3f')](db[_0xbbab('0x4c')][_0xbbab('0x25')]);_0x5c8a78[_0xbbab('0x2c')]=_[_0xbbab('0x3f')](_0x52fdbf[_0xbbab('0x2c')]);_0x5c8a78[_0xbbab('0x34')]=_[_0xbbab('0x2b')](_0x5c8a78[_0xbbab('0x29')],_0x5c8a78['query']);_0x41e4ef[_0xbbab('0x2d')]=_[_0xbbab('0x2b')](_0x5c8a78[_0xbbab('0x29')],qs[_0xbbab('0x2e')](_0x52fdbf[_0xbbab('0x2c')][_0xbbab('0x2e')]));_0x41e4ef[_0xbbab('0x2d')]=_0x41e4ef['attributes'][_0xbbab('0x2f')]?_0x41e4ef[_0xbbab('0x2d')]:_0x5c8a78[_0xbbab('0x29')];_0x41e4ef['order']=qs['sort'](_0x52fdbf[_0xbbab('0x2c')][_0xbbab('0x33')]);_0x41e4ef[_0xbbab('0x36')]=qs[_0xbbab('0x34')](_['pick'](_0x52fdbf[_0xbbab('0x2c')],_0x5c8a78[_0xbbab('0x34')]));if(_0x52fdbf[_0xbbab('0x2c')][_0xbbab('0x35')]){_0x41e4ef[_0xbbab('0x36')]=_[_0xbbab('0x37')](_0x41e4ef[_0xbbab('0x36')],{'$or':_['map'](_0x41e4ef[_0xbbab('0x2d')],function(_0x5e4175){var _0xd65e08={};_0xd65e08[_0x5e4175]={'$like':'%'+_0x52fdbf[_0xbbab('0x2c')]['filter']+'%'};return _0xd65e08;})});}_0x41e4ef=_[_0xbbab('0x37')]({},_0x41e4ef,_0x52fdbf['options']);return _0x234f2a['getTags'](_0x41e4ef);}})[_0xbbab('0x1f')](function(_0x51511a){if(_0x51511a){_0x1b5cf2=_0x51511a[_0xbbab('0x2f')];if(!_0x52fdbf[_0xbbab('0x2c')]['hasOwnProperty'](_0xbbab('0x31'))){_0x41e4ef[_0xbbab('0x18')]=qs['limit'](_0x52fdbf[_0xbbab('0x2c')]['limit']);_0x41e4ef[_0xbbab('0x17')]=qs['offset'](_0x52fdbf['query'][_0xbbab('0x17')]);}return _0x234f2a['getTags'](_0x41e4ef);}})[_0xbbab('0x1f')](function(_0x367971){if(_0x367971){return _0x367971?{'count':_0x1b5cf2,'rows':_0x367971}:null;}})[_0xbbab('0x1f')](respondWithResult(_0x3ddba3,null))[_0xbbab('0x3c')](handleError(_0x3ddba3,null));};exports['setTags']=function(_0x5c9226,_0x47d18c,_0x170c32){if(_0x5c9226['body']['id']){delete _0x5c9226['body']['id'];}return db[_0xbbab('0x24')][_0xbbab('0x46')]({'where':{'id':_0x5c9226[_0xbbab('0x3e')]['id']}})[_0xbbab('0x1f')](handleEntityNotFound(_0x47d18c,null))[_0xbbab('0x1f')](function(_0x17d972){if(_0x17d972){return _0x17d972[_0xbbab('0x4d')](_0x5c9226[_0xbbab('0x44')][_0xbbab('0x4e')]||[]);}return null;})[_0xbbab('0x1f')](respondWithResult(_0x47d18c,null))[_0xbbab('0x3c')](handleError(_0x47d18c,null));}; \ No newline at end of file +var _0xef9a=['getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','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','limit','undefined','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','count','show','length','includeAll','include','find','catch','create','body','params','destroy','getFields','findOne','rawAttributes','nolimit','getSubjects','ZendeskField','getDescriptions','order'];(function(_0x7af059,_0x43a476){var _0x30ad38=function(_0x2e8459){while(--_0x2e8459){_0x7af059['push'](_0x7af059['shift']());}};_0x30ad38(++_0x43a476);}(_0xef9a,0xa9));var _0xaef9=function(_0x40f97a,_0x3a34aa){_0x40f97a=_0x40f97a-0x0;var _0x3ab17f=_0xef9a[_0x40f97a];return _0x3ab17f;};'use strict';var emlformat=require(_0xaef9('0x0'));var rimraf=require(_0xaef9('0x1'));var zipdir=require(_0xaef9('0x2'));var jsonpatch=require(_0xaef9('0x3'));var rp=require(_0xaef9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaef9('0x5'));var util=require(_0xaef9('0x6'));var path=require('path');var sox=require(_0xaef9('0x7'));var csv=require('to-csv');var ejs=require(_0xaef9('0x8'));var fs=require('fs');var fs_extra=require(_0xaef9('0x9'));var _=require(_0xaef9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaef9('0xb'));var deskjs=require(_0xaef9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaef9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaef9('0xe'));var qs=require(_0xaef9('0xf'));var as=require(_0xaef9('0x10'));var hardwareService=require(_0xaef9('0x11'));var logger=require(_0xaef9('0x12'))(_0xaef9('0x13'));var utils=require(_0xaef9('0x14'));var config=require(_0xaef9('0x15'));var licenseUtil=require(_0xaef9('0x16'));var db=require(_0xaef9('0x17'))['db'];function respondWithStatusCode(_0x279e7e,_0x5729d3){_0x5729d3=_0x5729d3||0xcc;return function(_0x386085){if(_0x386085){return _0x279e7e['sendStatus'](_0x5729d3);}return _0x279e7e[_0xaef9('0x18')](_0x5729d3)[_0xaef9('0x19')]();};}function respondWithResult(_0x4839f4,_0x128406){_0x128406=_0x128406||0xc8;return function(_0x2522f1){if(_0x2522f1){return _0x4839f4[_0xaef9('0x18')](_0x128406)[_0xaef9('0x1a')](_0x2522f1);}};}function respondWithFilteredResult(_0x5d8628,_0x41921b){return function(_0x2d8b31){if(_0x2d8b31){var _0x35f2d2=typeof _0x41921b[_0xaef9('0x1b')]==='undefined'&&typeof _0x41921b[_0xaef9('0x1c')]===_0xaef9('0x1d');var _0x3a289f=_0x2d8b31['count'];var _0x148b58=_0x35f2d2?0x0:_0x41921b[_0xaef9('0x1b')];var _0xf8d794=_0x35f2d2?_0x2d8b31['count']:_0x41921b['offset']+_0x41921b[_0xaef9('0x1c')];var _0xa4cf0;if(_0xf8d794>=_0x3a289f){_0xf8d794=_0x3a289f;_0xa4cf0=0xc8;}else{_0xa4cf0=0xce;}_0x5d8628[_0xaef9('0x18')](_0xa4cf0);return _0x5d8628[_0xaef9('0x1e')](_0xaef9('0x1f'),_0x148b58+'-'+_0xf8d794+'/'+_0x3a289f)[_0xaef9('0x1a')](_0x2d8b31);}return null;};}function patchUpdates(_0x4490a6){return function(_0x542986){try{jsonpatch[_0xaef9('0x20')](_0x542986,_0x4490a6,!![]);}catch(_0x4ca31a){return BPromise[_0xaef9('0x21')](_0x4ca31a);}return _0x542986[_0xaef9('0x22')]();};}function saveUpdates(_0x5a744d,_0x1eefb3){return function(_0x5b0870){if(_0x5b0870){return _0x5b0870[_0xaef9('0x23')](_0x5a744d)[_0xaef9('0x24')](function(_0x312834){return _0x312834;});}return null;};}function removeEntity(_0x277588,_0x2afda9){return function(_0x1a5542){if(_0x1a5542){return _0x1a5542['destroy']()[_0xaef9('0x24')](function(){_0x277588[_0xaef9('0x18')](0xcc)[_0xaef9('0x19')]();});}};}function handleEntityNotFound(_0xc8c8a0,_0x3fda0c){return function(_0x4b3761){if(!_0x4b3761){_0xc8c8a0['sendStatus'](0x194);}return _0x4b3761;};}function handleError(_0x521bc8,_0x40c7cf){_0x40c7cf=_0x40c7cf||0x1f4;return function(_0x50bb77){logger[_0xaef9('0x25')](_0x50bb77['stack']);if(_0x50bb77[_0xaef9('0x26')]){delete _0x50bb77[_0xaef9('0x26')];}_0x521bc8[_0xaef9('0x18')](_0x40c7cf)[_0xaef9('0x27')](_0x50bb77);};}exports[_0xaef9('0x28')]=function(_0x4d877b,_0x402105){var _0x2816cf={},_0x23139b={},_0x37cece={'count':0x0,'rows':[]};var _0x512287=_[_0xaef9('0x29')](db['ZendeskConfiguration']['rawAttributes'],function(_0x169a5f){return{'name':_0x169a5f[_0xaef9('0x2a')],'type':_0x169a5f[_0xaef9('0x2b')][_0xaef9('0x2c')]};});_0x23139b[_0xaef9('0x2d')]=_[_0xaef9('0x29')](_0x512287,_0xaef9('0x26'));_0x23139b[_0xaef9('0x2e')]=_[_0xaef9('0x2f')](_0x4d877b[_0xaef9('0x2e')]);_0x23139b[_0xaef9('0x30')]=_[_0xaef9('0x31')](_0x23139b['model'],_0x23139b[_0xaef9('0x2e')]);_0x2816cf[_0xaef9('0x32')]=_[_0xaef9('0x31')](_0x23139b[_0xaef9('0x2d')],qs[_0xaef9('0x33')](_0x4d877b[_0xaef9('0x2e')][_0xaef9('0x33')]));_0x2816cf[_0xaef9('0x32')]=_0x2816cf[_0xaef9('0x32')]['length']?_0x2816cf[_0xaef9('0x32')]:_0x23139b[_0xaef9('0x2d')];if(!_0x4d877b['query'][_0xaef9('0x34')]('nolimit')){_0x2816cf[_0xaef9('0x1c')]=qs[_0xaef9('0x1c')](_0x4d877b[_0xaef9('0x2e')][_0xaef9('0x1c')]);_0x2816cf[_0xaef9('0x1b')]=qs[_0xaef9('0x1b')](_0x4d877b[_0xaef9('0x2e')]['offset']);}_0x2816cf['order']=qs[_0xaef9('0x35')](_0x4d877b[_0xaef9('0x2e')][_0xaef9('0x35')]);_0x2816cf[_0xaef9('0x36')]=qs[_0xaef9('0x30')](_[_0xaef9('0x37')](_0x4d877b[_0xaef9('0x2e')],_0x23139b[_0xaef9('0x30')]),_0x512287);if(_0x4d877b[_0xaef9('0x2e')][_0xaef9('0x38')]){_0x2816cf[_0xaef9('0x36')]=_[_0xaef9('0x39')](_0x2816cf['where'],{'$or':_[_0xaef9('0x29')](_0x512287,function(_0x587033){if(_0x587033[_0xaef9('0x2b')]!==_0xaef9('0x3a')){var _0x58567c={};_0x58567c[_0x587033[_0xaef9('0x26')]]={'$like':'%'+_0x4d877b[_0xaef9('0x2e')][_0xaef9('0x38')]+'%'};return _0x58567c;}})});}_0x2816cf=_[_0xaef9('0x39')]({},_0x2816cf,_0x4d877b[_0xaef9('0x3b')]);var _0x2f51e0={'where':_0x2816cf['where']};return db[_0xaef9('0x3c')]['count'](_0x2f51e0)[_0xaef9('0x24')](function(_0x6b1759){_0x37cece[_0xaef9('0x3d')]=_0x6b1759;if(_0x4d877b[_0xaef9('0x2e')]['includeAll']){_0x2816cf['include']=[{'all':!![]}];}return db[_0xaef9('0x3c')]['findAll'](_0x2816cf);})['then'](function(_0x3addfb){_0x37cece['rows']=_0x3addfb;return _0x37cece;})[_0xaef9('0x24')](respondWithFilteredResult(_0x402105,_0x2816cf))['catch'](handleError(_0x402105,null));};exports[_0xaef9('0x3e')]=function(_0x51c234,_0x27190b){var _0x2e0f49={'raw':![],'where':{'id':_0x51c234['params']['id']}},_0x1cac6e={};_0x1cac6e[_0xaef9('0x2d')]=_[_0xaef9('0x2f')](db[_0xaef9('0x3c')]['rawAttributes']);_0x1cac6e[_0xaef9('0x2e')]=_[_0xaef9('0x2f')](_0x51c234[_0xaef9('0x2e')]);_0x1cac6e['filters']=_['intersection'](_0x1cac6e[_0xaef9('0x2d')],_0x1cac6e['query']);_0x2e0f49[_0xaef9('0x32')]=_[_0xaef9('0x31')](_0x1cac6e['model'],qs['fields'](_0x51c234['query']['fields']));_0x2e0f49[_0xaef9('0x32')]=_0x2e0f49['attributes'][_0xaef9('0x3f')]?_0x2e0f49[_0xaef9('0x32')]:_0x1cac6e[_0xaef9('0x2d')];if(_0x51c234[_0xaef9('0x2e')][_0xaef9('0x40')]){_0x2e0f49[_0xaef9('0x41')]=[{'all':!![]}];}_0x2e0f49=_['merge']({},_0x2e0f49,_0x51c234[_0xaef9('0x3b')]);return db[_0xaef9('0x3c')][_0xaef9('0x42')](_0x2e0f49)[_0xaef9('0x24')](handleEntityNotFound(_0x27190b,null))[_0xaef9('0x24')](respondWithResult(_0x27190b,null))[_0xaef9('0x43')](handleError(_0x27190b,null));};exports[_0xaef9('0x44')]=function(_0x53dce8,_0x3d52f9){return db[_0xaef9('0x3c')][_0xaef9('0x44')](_0x53dce8['body'],{})['then'](respondWithResult(_0x3d52f9,0xc9))[_0xaef9('0x43')](handleError(_0x3d52f9,null));};exports[_0xaef9('0x23')]=function(_0x250568,_0xd0bde){if(_0x250568[_0xaef9('0x45')]['id']){delete _0x250568[_0xaef9('0x45')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x250568[_0xaef9('0x46')]['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0xd0bde,null))[_0xaef9('0x24')](saveUpdates(_0x250568['body'],null))[_0xaef9('0x24')](respondWithResult(_0xd0bde,null))[_0xaef9('0x43')](handleError(_0xd0bde,null));};exports[_0xaef9('0x47')]=function(_0xd3e61d,_0x4ef9ef){return db[_0xaef9('0x3c')][_0xaef9('0x42')]({'where':{'id':_0xd3e61d[_0xaef9('0x46')]['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0x4ef9ef,null))['then'](removeEntity(_0x4ef9ef,null))[_0xaef9('0x43')](handleError(_0x4ef9ef,null));};exports[_0xaef9('0x48')]=function(_0x271cf2,_0x121229,_0x1e0966){var _0x51a011={};var _0x3b9010={};var _0x15a905;var _0x288fd7;return db[_0xaef9('0x3c')][_0xaef9('0x49')]({'where':{'id':_0x271cf2[_0xaef9('0x46')]['id']}})['then'](handleEntityNotFound(_0x121229,null))['then'](function(_0x3d3bc2){if(_0x3d3bc2){_0x15a905=_0x3d3bc2;_0x3b9010[_0xaef9('0x2d')]=_[_0xaef9('0x2f')](db['ZendeskField'][_0xaef9('0x4a')]);_0x3b9010[_0xaef9('0x2e')]=_['keys'](_0x271cf2[_0xaef9('0x2e')]);_0x3b9010['filters']=_[_0xaef9('0x31')](_0x3b9010['model'],_0x3b9010[_0xaef9('0x2e')]);_0x51a011['attributes']=_['intersection'](_0x3b9010['model'],qs['fields'](_0x271cf2[_0xaef9('0x2e')][_0xaef9('0x33')]));_0x51a011[_0xaef9('0x32')]=_0x51a011[_0xaef9('0x32')][_0xaef9('0x3f')]?_0x51a011[_0xaef9('0x32')]:_0x3b9010[_0xaef9('0x2d')];_0x51a011['order']=qs[_0xaef9('0x35')](_0x271cf2[_0xaef9('0x2e')]['sort']);_0x51a011[_0xaef9('0x36')]=qs['filters'](_[_0xaef9('0x37')](_0x271cf2[_0xaef9('0x2e')],_0x3b9010[_0xaef9('0x30')]));if(_0x271cf2[_0xaef9('0x2e')][_0xaef9('0x38')]){_0x51a011[_0xaef9('0x36')]=_['merge'](_0x51a011['where'],{'$or':_[_0xaef9('0x29')](_0x51a011[_0xaef9('0x32')],function(_0x5e9017){var _0x137f5f={};_0x137f5f[_0x5e9017]={'$like':'%'+_0x271cf2[_0xaef9('0x2e')][_0xaef9('0x38')]+'%'};return _0x137f5f;})});}_0x51a011=_[_0xaef9('0x39')]({},_0x51a011,_0x271cf2[_0xaef9('0x3b')]);return _0x15a905[_0xaef9('0x48')](_0x51a011);}})[_0xaef9('0x24')](function(_0x2dbba2){if(_0x2dbba2){_0x288fd7=_0x2dbba2[_0xaef9('0x3f')];if(!_0x271cf2[_0xaef9('0x2e')]['hasOwnProperty'](_0xaef9('0x4b'))){_0x51a011[_0xaef9('0x1c')]=qs[_0xaef9('0x1c')](_0x271cf2['query']['limit']);_0x51a011[_0xaef9('0x1b')]=qs[_0xaef9('0x1b')](_0x271cf2[_0xaef9('0x2e')][_0xaef9('0x1b')]);}return _0x15a905[_0xaef9('0x48')](_0x51a011);}})[_0xaef9('0x24')](function(_0x2ef028){if(_0x2ef028){return _0x2ef028?{'count':_0x288fd7,'rows':_0x2ef028}:null;}})[_0xaef9('0x24')](respondWithResult(_0x121229,null))['catch'](handleError(_0x121229,null));};exports[_0xaef9('0x4c')]=function(_0x3c8b85,_0x30f02e,_0x34c3a2){var _0xbcb100={};var _0x5b71a6={};var _0x15d2d2;var _0x1c4d01;return db['ZendeskConfiguration'][_0xaef9('0x49')]({'where':{'id':_0x3c8b85[_0xaef9('0x46')]['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0x30f02e,null))['then'](function(_0x4b9db9){if(_0x4b9db9){_0x15d2d2=_0x4b9db9;_0x5b71a6[_0xaef9('0x2d')]=_[_0xaef9('0x2f')](db[_0xaef9('0x4d')][_0xaef9('0x4a')]);_0x5b71a6[_0xaef9('0x2e')]=_[_0xaef9('0x2f')](_0x3c8b85[_0xaef9('0x2e')]);_0x5b71a6[_0xaef9('0x30')]=_[_0xaef9('0x31')](_0x5b71a6[_0xaef9('0x2d')],_0x5b71a6[_0xaef9('0x2e')]);_0xbcb100[_0xaef9('0x32')]=_[_0xaef9('0x31')](_0x5b71a6[_0xaef9('0x2d')],qs['fields'](_0x3c8b85['query'][_0xaef9('0x33')]));_0xbcb100[_0xaef9('0x32')]=_0xbcb100[_0xaef9('0x32')][_0xaef9('0x3f')]?_0xbcb100['attributes']:_0x5b71a6[_0xaef9('0x2d')];_0xbcb100['order']=qs[_0xaef9('0x35')](_0x3c8b85[_0xaef9('0x2e')]['sort']);_0xbcb100[_0xaef9('0x36')]=qs[_0xaef9('0x30')](_[_0xaef9('0x37')](_0x3c8b85[_0xaef9('0x2e')],_0x5b71a6[_0xaef9('0x30')]));if(_0x3c8b85['query'][_0xaef9('0x38')]){_0xbcb100[_0xaef9('0x36')]=_['merge'](_0xbcb100[_0xaef9('0x36')],{'$or':_[_0xaef9('0x29')](_0xbcb100[_0xaef9('0x32')],function(_0x505bf6){var _0x328a25={};_0x328a25[_0x505bf6]={'$like':'%'+_0x3c8b85[_0xaef9('0x2e')]['filter']+'%'};return _0x328a25;})});}_0xbcb100=_[_0xaef9('0x39')]({},_0xbcb100,_0x3c8b85['options']);return _0x15d2d2['getSubjects'](_0xbcb100);}})[_0xaef9('0x24')](function(_0x2167c9){if(_0x2167c9){_0x1c4d01=_0x2167c9[_0xaef9('0x3f')];if(!_0x3c8b85[_0xaef9('0x2e')]['hasOwnProperty'](_0xaef9('0x4b'))){_0xbcb100[_0xaef9('0x1c')]=qs[_0xaef9('0x1c')](_0x3c8b85[_0xaef9('0x2e')][_0xaef9('0x1c')]);_0xbcb100['offset']=qs[_0xaef9('0x1b')](_0x3c8b85[_0xaef9('0x2e')][_0xaef9('0x1b')]);}return _0x15d2d2['getSubjects'](_0xbcb100);}})[_0xaef9('0x24')](function(_0x2523e9){if(_0x2523e9){return _0x2523e9?{'count':_0x1c4d01,'rows':_0x2523e9}:null;}})['then'](respondWithResult(_0x30f02e,null))[_0xaef9('0x43')](handleError(_0x30f02e,null));};exports[_0xaef9('0x4e')]=function(_0x48862a,_0x479863,_0x378a41){var _0x2f3c4e={};var _0x37e41d={};var _0xc0e46e;var _0xe57d41;return db['ZendeskConfiguration'][_0xaef9('0x49')]({'where':{'id':_0x48862a['params']['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0x479863,null))[_0xaef9('0x24')](function(_0x3ef221){if(_0x3ef221){_0xc0e46e=_0x3ef221;_0x37e41d[_0xaef9('0x2d')]=_[_0xaef9('0x2f')](db[_0xaef9('0x4d')]['rawAttributes']);_0x37e41d['query']=_[_0xaef9('0x2f')](_0x48862a[_0xaef9('0x2e')]);_0x37e41d[_0xaef9('0x30')]=_[_0xaef9('0x31')](_0x37e41d['model'],_0x37e41d['query']);_0x2f3c4e[_0xaef9('0x32')]=_[_0xaef9('0x31')](_0x37e41d['model'],qs['fields'](_0x48862a[_0xaef9('0x2e')][_0xaef9('0x33')]));_0x2f3c4e['attributes']=_0x2f3c4e[_0xaef9('0x32')]['length']?_0x2f3c4e[_0xaef9('0x32')]:_0x37e41d[_0xaef9('0x2d')];_0x2f3c4e[_0xaef9('0x4f')]=qs[_0xaef9('0x35')](_0x48862a[_0xaef9('0x2e')][_0xaef9('0x35')]);_0x2f3c4e[_0xaef9('0x36')]=qs[_0xaef9('0x30')](_['pick'](_0x48862a[_0xaef9('0x2e')],_0x37e41d['filters']));if(_0x48862a['query']['filter']){_0x2f3c4e['where']=_[_0xaef9('0x39')](_0x2f3c4e[_0xaef9('0x36')],{'$or':_[_0xaef9('0x29')](_0x2f3c4e[_0xaef9('0x32')],function(_0x7f8148){var _0x474864={};_0x474864[_0x7f8148]={'$like':'%'+_0x48862a['query'][_0xaef9('0x38')]+'%'};return _0x474864;})});}_0x2f3c4e=_[_0xaef9('0x39')]({},_0x2f3c4e,_0x48862a[_0xaef9('0x3b')]);return _0xc0e46e['getDescriptions'](_0x2f3c4e);}})[_0xaef9('0x24')](function(_0x220bf1){if(_0x220bf1){_0xe57d41=_0x220bf1[_0xaef9('0x3f')];if(!_0x48862a[_0xaef9('0x2e')][_0xaef9('0x34')](_0xaef9('0x4b'))){_0x2f3c4e[_0xaef9('0x1c')]=qs[_0xaef9('0x1c')](_0x48862a[_0xaef9('0x2e')][_0xaef9('0x1c')]);_0x2f3c4e[_0xaef9('0x1b')]=qs[_0xaef9('0x1b')](_0x48862a[_0xaef9('0x2e')]['offset']);}return _0xc0e46e[_0xaef9('0x4e')](_0x2f3c4e);}})[_0xaef9('0x24')](function(_0x5133e1){if(_0x5133e1){return _0x5133e1?{'count':_0xe57d41,'rows':_0x5133e1}:null;}})[_0xaef9('0x24')](respondWithResult(_0x479863,null))[_0xaef9('0x43')](handleError(_0x479863,null));};exports[_0xaef9('0x50')]=function(_0x670b45,_0x235628,_0x38de3c){var _0x2fc9a3={};var _0x374695={};var _0x2ae79d;var _0x52bc2a;return db[_0xaef9('0x3c')][_0xaef9('0x49')]({'where':{'id':_0x670b45[_0xaef9('0x46')]['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0x235628,null))['then'](function(_0x627a78){if(_0x627a78){_0x2ae79d=_0x627a78;_0x374695[_0xaef9('0x2d')]=_[_0xaef9('0x2f')](db['Tag'][_0xaef9('0x4a')]);_0x374695[_0xaef9('0x2e')]=_[_0xaef9('0x2f')](_0x670b45[_0xaef9('0x2e')]);_0x374695[_0xaef9('0x30')]=_[_0xaef9('0x31')](_0x374695[_0xaef9('0x2d')],_0x374695['query']);_0x2fc9a3[_0xaef9('0x32')]=_[_0xaef9('0x31')](_0x374695[_0xaef9('0x2d')],qs[_0xaef9('0x33')](_0x670b45['query'][_0xaef9('0x33')]));_0x2fc9a3['attributes']=_0x2fc9a3[_0xaef9('0x32')][_0xaef9('0x3f')]?_0x2fc9a3[_0xaef9('0x32')]:_0x374695['model'];_0x2fc9a3['order']=qs[_0xaef9('0x35')](_0x670b45[_0xaef9('0x2e')][_0xaef9('0x35')]);_0x2fc9a3[_0xaef9('0x36')]=qs[_0xaef9('0x30')](_[_0xaef9('0x37')](_0x670b45['query'],_0x374695[_0xaef9('0x30')]));if(_0x670b45[_0xaef9('0x2e')][_0xaef9('0x38')]){_0x2fc9a3[_0xaef9('0x36')]=_[_0xaef9('0x39')](_0x2fc9a3[_0xaef9('0x36')],{'$or':_[_0xaef9('0x29')](_0x2fc9a3['attributes'],function(_0xef821d){var _0x44fcfb={};_0x44fcfb[_0xef821d]={'$like':'%'+_0x670b45[_0xaef9('0x2e')][_0xaef9('0x38')]+'%'};return _0x44fcfb;})});}_0x2fc9a3=_[_0xaef9('0x39')]({},_0x2fc9a3,_0x670b45[_0xaef9('0x3b')]);return _0x2ae79d[_0xaef9('0x50')](_0x2fc9a3);}})[_0xaef9('0x24')](function(_0x2f6e7a){if(_0x2f6e7a){_0x52bc2a=_0x2f6e7a[_0xaef9('0x3f')];if(!_0x670b45['query'][_0xaef9('0x34')]('nolimit')){_0x2fc9a3[_0xaef9('0x1c')]=qs[_0xaef9('0x1c')](_0x670b45['query']['limit']);_0x2fc9a3['offset']=qs['offset'](_0x670b45['query'][_0xaef9('0x1b')]);}return _0x2ae79d['getTags'](_0x2fc9a3);}})['then'](function(_0x25cd81){if(_0x25cd81){return _0x25cd81?{'count':_0x52bc2a,'rows':_0x25cd81}:null;}})[_0xaef9('0x24')](respondWithResult(_0x235628,null))[_0xaef9('0x43')](handleError(_0x235628,null));};exports[_0xaef9('0x51')]=function(_0x20ba0f,_0x3f542c,_0x31e7cb){if(_0x20ba0f[_0xaef9('0x45')]['id']){delete _0x20ba0f[_0xaef9('0x45')]['id'];}return db[_0xaef9('0x3c')]['findOne']({'where':{'id':_0x20ba0f[_0xaef9('0x46')]['id']}})[_0xaef9('0x24')](handleEntityNotFound(_0x3f542c,null))['then'](function(_0x195849){if(_0x195849){return _0x195849['setTags'](_0x20ba0f['body'][_0xaef9('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3f542c,null))[_0xaef9('0x43')](handleError(_0x3f542c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index bc2dc02..5b43041 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 _0x3f8c=['exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3f8c,0x104));var _0xc3f8=function(_0x7492,_0x3df5b9){_0x7492=_0x7492-0x0;var _0xebb176=_0x3f8c[_0x7492];return _0xebb176;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('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('./intZendeskConfiguration.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x41ae2b,_0x2c19d1){var _0x1595a5=function(_0x597308){while(--_0x597308){_0x41ae2b['push'](_0x41ae2b['shift']());}};_0x1595a5(++_0x2c19d1);}(_0x28f2,0x193));var _0x228f=function(_0x203243,_0x53a335){_0x203243=_0x203243-0x0;var _0x6c35be=_0x28f2[_0x203243];return _0x6c35be;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x228f('0xc'),'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 24ef1ab..15084c1 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 _0xa6bb=['request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xa6bb,0x1ef));var _0xba6b=function(_0xadf2a4,_0x179b49){_0xadf2a4=_0xadf2a4-0x0;var _0x1e4938=_0xa6bb[_0xadf2a4];return _0x1e4938;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var BPromise=require(_0xba6b('0x2'));var rs=require(_0xba6b('0x3'));var fs=require('fs');var Redis=require(_0xba6b('0x4'));var db=require(_0xba6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba6b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xba6b('0x7'));var client=jayson[_0xba6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd34b,_0x6b4ccf,_0x3d3393){return new BPromise(function(_0x388a43,_0x17f676){return client[_0xba6b('0x9')](_0x4fd34b,_0x3d3393)[_0xba6b('0xa')](function(_0x21ef89){logger['info'](_0xba6b('0xb'),_0x6b4ccf,_0xba6b('0xc'));logger['debug'](_0xba6b('0xd'),_0x6b4ccf,_0xba6b('0xc'),JSON[_0xba6b('0xe')](_0x21ef89));if(_0x21ef89[_0xba6b('0xf')]){if(_0x21ef89[_0xba6b('0xf')][_0xba6b('0x10')]===0x1f4){logger[_0xba6b('0xf')](_0xba6b('0xb'),_0x6b4ccf,_0x21ef89[_0xba6b('0xf')][_0xba6b('0x11')]);return _0x17f676(_0x21ef89['error'][_0xba6b('0x11')]);}logger[_0xba6b('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x6b4ccf,_0x21ef89[_0xba6b('0xf')][_0xba6b('0x11')]);return _0x388a43(_0x21ef89[_0xba6b('0xf')][_0xba6b('0x11')]);}else{logger[_0xba6b('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x6b4ccf,_0xba6b('0xc'));_0x388a43(_0x21ef89[_0xba6b('0x13')][_0xba6b('0x11')]);}})[_0xba6b('0x14')](function(_0x347c83){logger[_0xba6b('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x6b4ccf,_0x347c83);_0x17f676(_0x347c83);});});} \ No newline at end of file +var _0x6820=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x6820,0x17d));var _0x0682=function(_0x1d2481,_0x5593e5){_0x1d2481=_0x1d2481-0x0;var _0x3a0bd=_0x6820[_0x1d2481];return _0x3a0bd;};'use strict';var _=require(_0x0682('0x0'));var util=require(_0x0682('0x1'));var moment=require(_0x0682('0x2'));var BPromise=require(_0x0682('0x3'));var rs=require(_0x0682('0x4'));var fs=require('fs');var Redis=require(_0x0682('0x5'));var db=require(_0x0682('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0682('0x7'));var config=require(_0x0682('0x8'));var jayson=require(_0x0682('0x9'));var client=jayson[_0x0682('0xa')][_0x0682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbc04b4,_0x598179,_0x3b5ac5){return new BPromise(function(_0x3b8634,_0x2f73b3){return client[_0x0682('0xc')](_0xbc04b4,_0x3b5ac5)[_0x0682('0xd')](function(_0x38f357){logger[_0x0682('0xe')](_0x0682('0xf'),_0x598179,_0x0682('0x10'));logger[_0x0682('0x11')](_0x0682('0x12'),_0x598179,_0x0682('0x10'),JSON[_0x0682('0x13')](_0x38f357));if(_0x38f357[_0x0682('0x14')]){if(_0x38f357[_0x0682('0x14')]['code']===0x1f4){logger[_0x0682('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x598179,_0x38f357['error'][_0x0682('0x15')]);return _0x2f73b3(_0x38f357[_0x0682('0x14')][_0x0682('0x15')]);}logger['error'](_0x0682('0xf'),_0x598179,_0x38f357[_0x0682('0x14')][_0x0682('0x15')]);return _0x3b8634(_0x38f357['error'][_0x0682('0x15')]);}else{logger['info'](_0x0682('0xf'),_0x598179,_0x0682('0x10'));_0x3b8634(_0x38f357['result'][_0x0682('0x15')]);}})[_0x0682('0x16')](function(_0x57e1ef){logger['error'](_0x0682('0xf'),_0x598179,_0x57e1ef);_0x2f73b3(_0x57e1ef);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6ffccb0..3a1f99d 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 _0x3c78=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','put','update','delete','destroy'];(function(_0x3548e2,_0x20e991){var _0x5ec95a=function(_0x2af3c2){while(--_0x2af3c2){_0x3548e2['push'](_0x3548e2['shift']());}};_0x5ec95a(++_0x20e991);}(_0x3c78,0xc7));var _0x83c7=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0x3c78[_0x31edbe];return _0x37fcee;};'use strict';var multer=require(_0x83c7('0x0'));var util=require(_0x83c7('0x1'));var path=require(_0x83c7('0x2'));var timeout=require(_0x83c7('0x3'));var express=require('express');var router=express[_0x83c7('0x4')]();var fs_extra=require(_0x83c7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x83c7('0x6'));var config=require(_0x83c7('0x7'));var controller=require(_0x83c7('0x8'));router['get']('/',auth[_0x83c7('0x9')](),controller['index']);router[_0x83c7('0xa')](_0x83c7('0xb'),auth[_0x83c7('0x9')](),controller[_0x83c7('0xc')]);router['post']('/',auth[_0x83c7('0x9')](),controller['create']);router[_0x83c7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x83c7('0xe')]);router[_0x83c7('0xf')](_0x83c7('0xb'),auth[_0x83c7('0x9')](),controller[_0x83c7('0x10')]);module[_0x83c7('0x11')]=router; \ No newline at end of file +var _0xe268=['index','/:id','show','create','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xe268,0x86));var _0x8e26=function(_0x152dcb,_0x58658c){_0x152dcb=_0x152dcb-0x0;var _0x571790=_0xe268[_0x152dcb];return _0x571790;};'use strict';var multer=require(_0x8e26('0x0'));var util=require(_0x8e26('0x1'));var path=require('path');var timeout=require(_0x8e26('0x2'));var express=require('express');var router=express[_0x8e26('0x3')]();var fs_extra=require(_0x8e26('0x4'));var auth=require(_0x8e26('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e26('0x6'));var controller=require(_0x8e26('0x7'));router[_0x8e26('0x8')]('/',auth[_0x8e26('0x9')](),controller[_0x8e26('0xa')]);router['get'](_0x8e26('0xb'),auth[_0x8e26('0x9')](),controller[_0x8e26('0xc')]);router['post']('/',auth[_0x8e26('0x9')](),controller[_0x8e26('0xd')]);router['put'](_0x8e26('0xb'),auth[_0x8e26('0x9')](),controller[_0x8e26('0xe')]);router['delete'](_0x8e26('0xb'),auth[_0x8e26('0x9')](),controller[_0x8e26('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 500723b..69add49 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 _0xa010=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x181289,_0x541db8){var _0x2a7d51=function(_0xbbb795){while(--_0xbbb795){_0x181289['push'](_0x181289['shift']());}};_0x2a7d51(++_0x541db8);}(_0xa010,0x18f));var _0x0a01=function(_0x4cf295,_0x47ebfe){_0x4cf295=_0x4cf295-0x0;var _0x2932f5=_0xa010[_0x4cf295];return _0x2932f5;};'use strict';var Sequelize=require(_0x0a01('0x0'));module[_0x0a01('0x1')]={'type':{'type':Sequelize[_0x0a01('0x2')](_0x0a01('0x3'),_0x0a01('0x4'),_0x0a01('0x5'),_0x0a01('0x6'),_0x0a01('0x7')),'defaultValue':_0x0a01('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0a01('0x8')]},'keyType':{'type':Sequelize[_0x0a01('0x2')](_0x0a01('0x3'),_0x0a01('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x0a01('0x8')]},'idField':{'type':Sequelize[_0x0a01('0x8')]},'nameField':{'type':Sequelize[_0x0a01('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a01('0x8')]}}; \ No newline at end of file +var _0x0bc2=['customVariable','sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x2ee9dd,_0x425f44){var _0x576e49=function(_0x5e98aa){while(--_0x5e98aa){_0x2ee9dd['push'](_0x2ee9dd['shift']());}};_0x576e49(++_0x425f44);}(_0x0bc2,0x1a8));var _0x20bc=function(_0x5a2d03,_0x44199d){_0x5a2d03=_0x5a2d03-0x0;var _0x3d9503=_0x0bc2[_0x5a2d03];return _0x3d9503;};'use strict';var Sequelize=require(_0x20bc('0x0'));module[_0x20bc('0x1')]={'type':{'type':Sequelize[_0x20bc('0x2')]('string',_0x20bc('0x3'),'customVariable',_0x20bc('0x4'),_0x20bc('0x5')),'defaultValue':_0x20bc('0x6')},'content':{'type':Sequelize[_0x20bc('0x7')]},'key':{'type':Sequelize[_0x20bc('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x20bc('0x6'),_0x20bc('0x3'),_0x20bc('0x8'))},'keyContent':{'type':Sequelize[_0x20bc('0x7')]},'idField':{'type':Sequelize[_0x20bc('0x7')]},'nameField':{'type':Sequelize[_0x20bc('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20bc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 315ee99..0da2e19 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 _0x8911=['send','index','map','ZendeskField','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','destroy','then','end','stack','name'];(function(_0x31518b,_0x203dfd){var _0x40ee97=function(_0x3e7a8c){while(--_0x3e7a8c){_0x31518b['push'](_0x31518b['shift']());}};_0x40ee97(++_0x203dfd);}(_0x8911,0xf1));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1891('0x0'));var rimraf=require(_0x1891('0x1'));var zipdir=require(_0x1891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1891('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1891('0x4'));var path=require(_0x1891('0x5'));var sox=require(_0x1891('0x6'));var csv=require(_0x1891('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1891('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1891('0x9'));var toCsv=require(_0x1891('0x7'));var querystring=require(_0x1891('0xa'));var Papa=require(_0x1891('0xb'));var Redis=require(_0x1891('0xc'));var authService=require(_0x1891('0xd'));var qs=require(_0x1891('0xe'));var as=require(_0x1891('0xf'));var hardwareService=require(_0x1891('0x10'));var logger=require(_0x1891('0x11'))('api');var utils=require(_0x1891('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1891('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x494538,_0xd7ccf0){_0xd7ccf0=_0xd7ccf0||0xcc;return function(_0x525aa6){if(_0x525aa6){return _0x494538[_0x1891('0x14')](_0xd7ccf0);}return _0x494538['status'](_0xd7ccf0)['end']();};}function respondWithResult(_0x44f43c,_0xf48858){_0xf48858=_0xf48858||0xc8;return function(_0x28db6e){if(_0x28db6e){return _0x44f43c[_0x1891('0x15')](_0xf48858)[_0x1891('0x16')](_0x28db6e);}};}function respondWithFilteredResult(_0x3bb37f,_0x45a373){return function(_0x3b84d5){if(_0x3b84d5){var _0x4c93c4=typeof _0x45a373[_0x1891('0x17')]==='undefined'&&typeof _0x45a373[_0x1891('0x18')]===_0x1891('0x19');var _0x1638dc=_0x3b84d5[_0x1891('0x1a')];var _0x294989=_0x4c93c4?0x0:_0x45a373[_0x1891('0x17')];var _0x1e1337=_0x4c93c4?_0x3b84d5['count']:_0x45a373[_0x1891('0x17')]+_0x45a373[_0x1891('0x18')];var _0x2cd507;if(_0x1e1337>=_0x1638dc){_0x1e1337=_0x1638dc;_0x2cd507=0xc8;}else{_0x2cd507=0xce;}_0x3bb37f[_0x1891('0x15')](_0x2cd507);return _0x3bb37f[_0x1891('0x1b')]('Content-Range',_0x294989+'-'+_0x1e1337+'/'+_0x1638dc)[_0x1891('0x16')](_0x3b84d5);}return null;};}function patchUpdates(_0x4431a0){return function(_0x342cc0){try{jsonpatch[_0x1891('0x1c')](_0x342cc0,_0x4431a0,!![]);}catch(_0x512fea){return BPromise['reject'](_0x512fea);}return _0x342cc0[_0x1891('0x1d')]();};}function saveUpdates(_0x4620be,_0x23320f){return function(_0x2d2d9a){if(_0x2d2d9a){return _0x2d2d9a['update'](_0x4620be)['then'](function(_0x42b689){return _0x42b689;});}return null;};}function removeEntity(_0xd1423f,_0x90db75){return function(_0x4c8e66){if(_0x4c8e66){return _0x4c8e66[_0x1891('0x1e')]()[_0x1891('0x1f')](function(){_0xd1423f['status'](0xcc)[_0x1891('0x20')]();});}};}function handleEntityNotFound(_0x3d2477,_0x35c081){return function(_0x49dbb1){if(!_0x49dbb1){_0x3d2477['sendStatus'](0x194);}return _0x49dbb1;};}function handleError(_0x59629c,_0x47f51a){_0x47f51a=_0x47f51a||0x1f4;return function(_0x423983){logger['error'](_0x423983[_0x1891('0x21')]);if(_0x423983[_0x1891('0x22')]){delete _0x423983[_0x1891('0x22')];}_0x59629c[_0x1891('0x15')](_0x47f51a)[_0x1891('0x23')](_0x423983);};}exports[_0x1891('0x24')]=function(_0x399ea6,_0x53bae0){var _0x255c5f={},_0x114c66={},_0x16359d={'count':0x0,'rows':[]};var _0x428d60=_[_0x1891('0x25')](db[_0x1891('0x26')]['rawAttributes'],function(_0x1e4528){return{'name':_0x1e4528['fieldName'],'type':_0x1e4528[_0x1891('0x27')][_0x1891('0x28')]};});_0x114c66[_0x1891('0x29')]=_[_0x1891('0x25')](_0x428d60,_0x1891('0x22'));_0x114c66[_0x1891('0x2a')]=_[_0x1891('0x2b')](_0x399ea6[_0x1891('0x2a')]);_0x114c66[_0x1891('0x2c')]=_['intersection'](_0x114c66[_0x1891('0x29')],_0x114c66[_0x1891('0x2a')]);_0x255c5f[_0x1891('0x2d')]=_[_0x1891('0x2e')](_0x114c66[_0x1891('0x29')],qs['fields'](_0x399ea6[_0x1891('0x2a')][_0x1891('0x2f')]));_0x255c5f[_0x1891('0x2d')]=_0x255c5f[_0x1891('0x2d')][_0x1891('0x30')]?_0x255c5f[_0x1891('0x2d')]:_0x114c66[_0x1891('0x29')];if(!_0x399ea6[_0x1891('0x2a')]['hasOwnProperty'](_0x1891('0x31'))){_0x255c5f['limit']=qs[_0x1891('0x18')](_0x399ea6[_0x1891('0x2a')]['limit']);_0x255c5f[_0x1891('0x17')]=qs[_0x1891('0x17')](_0x399ea6[_0x1891('0x2a')][_0x1891('0x17')]);}_0x255c5f[_0x1891('0x32')]=qs[_0x1891('0x33')](_0x399ea6['query'][_0x1891('0x33')]);_0x255c5f[_0x1891('0x34')]=qs['filters'](_[_0x1891('0x35')](_0x399ea6[_0x1891('0x2a')],_0x114c66[_0x1891('0x2c')]),_0x428d60);if(_0x399ea6[_0x1891('0x2a')][_0x1891('0x36')]){_0x255c5f[_0x1891('0x34')]=_['merge'](_0x255c5f['where'],{'$or':_[_0x1891('0x25')](_0x428d60,function(_0x5ac391){if(_0x5ac391[_0x1891('0x27')]!==_0x1891('0x37')){var _0x5e31c6={};_0x5e31c6[_0x5ac391[_0x1891('0x22')]]={'$like':'%'+_0x399ea6[_0x1891('0x2a')][_0x1891('0x36')]+'%'};return _0x5e31c6;}})});}_0x255c5f=_[_0x1891('0x38')]({},_0x255c5f,_0x399ea6[_0x1891('0x39')]);var _0x2a0f44={'where':_0x255c5f[_0x1891('0x34')]};return db['ZendeskField'][_0x1891('0x1a')](_0x2a0f44)['then'](function(_0x31f0eb){_0x16359d[_0x1891('0x1a')]=_0x31f0eb;if(_0x399ea6[_0x1891('0x2a')][_0x1891('0x3a')]){_0x255c5f['include']=[{'all':!![]}];}return db[_0x1891('0x26')][_0x1891('0x3b')](_0x255c5f);})['then'](function(_0x466296){_0x16359d[_0x1891('0x3c')]=_0x466296;return _0x16359d;})[_0x1891('0x1f')](respondWithFilteredResult(_0x53bae0,_0x255c5f))[_0x1891('0x3d')](handleError(_0x53bae0,null));};exports['show']=function(_0x2ea7a1,_0xc5f96f){var _0x5d4ae0={'raw':!![],'where':{'id':_0x2ea7a1[_0x1891('0x3e')]['id']}},_0x472b4c={};_0x472b4c[_0x1891('0x29')]=_['keys'](db[_0x1891('0x26')][_0x1891('0x3f')]);_0x472b4c['query']=_[_0x1891('0x2b')](_0x2ea7a1[_0x1891('0x2a')]);_0x472b4c[_0x1891('0x2c')]=_[_0x1891('0x2e')](_0x472b4c[_0x1891('0x29')],_0x472b4c[_0x1891('0x2a')]);_0x5d4ae0[_0x1891('0x2d')]=_['intersection'](_0x472b4c[_0x1891('0x29')],qs[_0x1891('0x2f')](_0x2ea7a1[_0x1891('0x2a')][_0x1891('0x2f')]));_0x5d4ae0[_0x1891('0x2d')]=_0x5d4ae0[_0x1891('0x2d')][_0x1891('0x30')]?_0x5d4ae0['attributes']:_0x472b4c['model'];if(_0x2ea7a1[_0x1891('0x2a')]['includeAll']){_0x5d4ae0[_0x1891('0x40')]=[{'all':!![]}];}_0x5d4ae0=_[_0x1891('0x38')]({},_0x5d4ae0,_0x2ea7a1[_0x1891('0x39')]);return db[_0x1891('0x26')][_0x1891('0x41')](_0x5d4ae0)['then'](handleEntityNotFound(_0xc5f96f,null))[_0x1891('0x1f')](respondWithResult(_0xc5f96f,null))[_0x1891('0x3d')](handleError(_0xc5f96f,null));};exports[_0x1891('0x42')]=function(_0x330e18,_0x1acb6b){return db[_0x1891('0x26')]['create'](_0x330e18[_0x1891('0x43')],{})[_0x1891('0x1f')](respondWithResult(_0x1acb6b,0xc9))[_0x1891('0x3d')](handleError(_0x1acb6b,null));};exports[_0x1891('0x44')]=function(_0x1ca9f8,_0x40c69b){if(_0x1ca9f8[_0x1891('0x43')]['id']){delete _0x1ca9f8[_0x1891('0x43')]['id'];}return db[_0x1891('0x26')][_0x1891('0x41')]({'where':{'id':_0x1ca9f8[_0x1891('0x3e')]['id']}})['then'](handleEntityNotFound(_0x40c69b,null))[_0x1891('0x1f')](saveUpdates(_0x1ca9f8[_0x1891('0x43')],null))['then'](respondWithResult(_0x40c69b,null))[_0x1891('0x3d')](handleError(_0x40c69b,null));};exports[_0x1891('0x1e')]=function(_0xffcc33,_0x34fc7d){return db[_0x1891('0x26')][_0x1891('0x41')]({'where':{'id':_0xffcc33[_0x1891('0x3e')]['id']}})['then'](handleEntityNotFound(_0x34fc7d,null))[_0x1891('0x1f')](removeEntity(_0x34fc7d,null))[_0x1891('0x3d')](handleError(_0x34fc7d,null));}; \ No newline at end of file +var _0x1371=['length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','sendStatus','stack','name','send','index','map','ZendeskField','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','include','rows','catch','show','params','rawAttributes'];(function(_0x4ee99c,_0x200e4c){var _0x2d2673=function(_0x41eaf9){while(--_0x41eaf9){_0x4ee99c['push'](_0x4ee99c['shift']());}};_0x2d2673(++_0x200e4c);}(_0x1371,0x91));var _0x1137=function(_0x3e6d12,_0x4977ca){_0x3e6d12=_0x3e6d12-0x0;var _0x117d32=_0x1371[_0x3e6d12];return _0x117d32;};'use strict';var emlformat=require(_0x1137('0x0'));var rimraf=require(_0x1137('0x1'));var zipdir=require(_0x1137('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1137('0x3'));var moment=require(_0x1137('0x4'));var BPromise=require(_0x1137('0x5'));var Mustache=require(_0x1137('0x6'));var util=require(_0x1137('0x7'));var path=require(_0x1137('0x8'));var sox=require(_0x1137('0x9'));var csv=require(_0x1137('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1137('0xb'));var _=require('lodash');var squel=require(_0x1137('0xc'));var crypto=require(_0x1137('0xd'));var jsforce=require(_0x1137('0xe'));var deskjs=require(_0x1137('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1137('0x10'));var Papa=require(_0x1137('0x11'));var Redis=require(_0x1137('0x12'));var authService=require(_0x1137('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1137('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1137('0x15'))(_0x1137('0x16'));var utils=require(_0x1137('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1137('0x18'))['db'];function respondWithStatusCode(_0x4c14c9,_0xd5bfad){_0xd5bfad=_0xd5bfad||0xcc;return function(_0x6e9f75){if(_0x6e9f75){return _0x4c14c9['sendStatus'](_0xd5bfad);}return _0x4c14c9[_0x1137('0x19')](_0xd5bfad)['end']();};}function respondWithResult(_0x5b33b0,_0x54c32a){_0x54c32a=_0x54c32a||0xc8;return function(_0x2291c0){if(_0x2291c0){return _0x5b33b0[_0x1137('0x19')](_0x54c32a)[_0x1137('0x1a')](_0x2291c0);}};}function respondWithFilteredResult(_0x2aff67,_0x446811){return function(_0x40122f){if(_0x40122f){var _0x1a24ed=typeof _0x446811[_0x1137('0x1b')]===_0x1137('0x1c')&&typeof _0x446811[_0x1137('0x1d')]===_0x1137('0x1c');var _0x42dad3=_0x40122f['count'];var _0x5371cc=_0x1a24ed?0x0:_0x446811[_0x1137('0x1b')];var _0x1586dc=_0x1a24ed?_0x40122f[_0x1137('0x1e')]:_0x446811['offset']+_0x446811['limit'];var _0x14eabd;if(_0x1586dc>=_0x42dad3){_0x1586dc=_0x42dad3;_0x14eabd=0xc8;}else{_0x14eabd=0xce;}_0x2aff67[_0x1137('0x19')](_0x14eabd);return _0x2aff67['set']('Content-Range',_0x5371cc+'-'+_0x1586dc+'/'+_0x42dad3)[_0x1137('0x1a')](_0x40122f);}return null;};}function patchUpdates(_0x31f3e9){return function(_0x25d605){try{jsonpatch[_0x1137('0x1f')](_0x25d605,_0x31f3e9,!![]);}catch(_0x133a2f){return BPromise['reject'](_0x133a2f);}return _0x25d605[_0x1137('0x20')]();};}function saveUpdates(_0x4d9920,_0x21a529){return function(_0x10950c){if(_0x10950c){return _0x10950c[_0x1137('0x21')](_0x4d9920)['then'](function(_0x350da0){return _0x350da0;});}return null;};}function removeEntity(_0x53b638,_0x53e59f){return function(_0x33cfd1){if(_0x33cfd1){return _0x33cfd1['destroy']()['then'](function(){_0x53b638[_0x1137('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ebad,_0x23e4de){return function(_0x4c3269){if(!_0x4c3269){_0x24ebad[_0x1137('0x22')](0x194);}return _0x4c3269;};}function handleError(_0x2c2451,_0x5907eb){_0x5907eb=_0x5907eb||0x1f4;return function(_0x482e9a){logger['error'](_0x482e9a[_0x1137('0x23')]);if(_0x482e9a['name']){delete _0x482e9a[_0x1137('0x24')];}_0x2c2451[_0x1137('0x19')](_0x5907eb)[_0x1137('0x25')](_0x482e9a);};}exports[_0x1137('0x26')]=function(_0x45f40c,_0x1c5fd8){var _0x13414a={},_0x28a60e={},_0x385e5a={'count':0x0,'rows':[]};var _0x189a72=_[_0x1137('0x27')](db[_0x1137('0x28')]['rawAttributes'],function(_0x36798a){return{'name':_0x36798a['fieldName'],'type':_0x36798a[_0x1137('0x29')][_0x1137('0x2a')]};});_0x28a60e[_0x1137('0x2b')]=_[_0x1137('0x27')](_0x189a72,'name');_0x28a60e[_0x1137('0x2c')]=_[_0x1137('0x2d')](_0x45f40c[_0x1137('0x2c')]);_0x28a60e['filters']=_[_0x1137('0x2e')](_0x28a60e[_0x1137('0x2b')],_0x28a60e[_0x1137('0x2c')]);_0x13414a[_0x1137('0x2f')]=_['intersection'](_0x28a60e[_0x1137('0x2b')],qs[_0x1137('0x30')](_0x45f40c[_0x1137('0x2c')]['fields']));_0x13414a['attributes']=_0x13414a[_0x1137('0x2f')]['length']?_0x13414a[_0x1137('0x2f')]:_0x28a60e['model'];if(!_0x45f40c[_0x1137('0x2c')][_0x1137('0x31')](_0x1137('0x32'))){_0x13414a[_0x1137('0x1d')]=qs[_0x1137('0x1d')](_0x45f40c[_0x1137('0x2c')]['limit']);_0x13414a[_0x1137('0x1b')]=qs[_0x1137('0x1b')](_0x45f40c[_0x1137('0x2c')][_0x1137('0x1b')]);}_0x13414a[_0x1137('0x33')]=qs[_0x1137('0x34')](_0x45f40c[_0x1137('0x2c')]['sort']);_0x13414a['where']=qs['filters'](_[_0x1137('0x35')](_0x45f40c[_0x1137('0x2c')],_0x28a60e['filters']),_0x189a72);if(_0x45f40c['query'][_0x1137('0x36')]){_0x13414a[_0x1137('0x37')]=_[_0x1137('0x38')](_0x13414a['where'],{'$or':_['map'](_0x189a72,function(_0x45e6c0){if(_0x45e6c0[_0x1137('0x29')]!=='VIRTUAL'){var _0x341a08={};_0x341a08[_0x45e6c0[_0x1137('0x24')]]={'$like':'%'+_0x45f40c['query'][_0x1137('0x36')]+'%'};return _0x341a08;}})});}_0x13414a=_[_0x1137('0x38')]({},_0x13414a,_0x45f40c[_0x1137('0x39')]);var _0x18c0e3={'where':_0x13414a[_0x1137('0x37')]};return db[_0x1137('0x28')][_0x1137('0x1e')](_0x18c0e3)[_0x1137('0x3a')](function(_0x499a30){_0x385e5a[_0x1137('0x1e')]=_0x499a30;if(_0x45f40c[_0x1137('0x2c')]['includeAll']){_0x13414a[_0x1137('0x3b')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x13414a);})[_0x1137('0x3a')](function(_0x4af933){_0x385e5a[_0x1137('0x3c')]=_0x4af933;return _0x385e5a;})[_0x1137('0x3a')](respondWithFilteredResult(_0x1c5fd8,_0x13414a))[_0x1137('0x3d')](handleError(_0x1c5fd8,null));};exports[_0x1137('0x3e')]=function(_0x43f911,_0x12b63b){var _0x134ed1={'raw':!![],'where':{'id':_0x43f911[_0x1137('0x3f')]['id']}},_0xc50e6c={};_0xc50e6c['model']=_[_0x1137('0x2d')](db[_0x1137('0x28')][_0x1137('0x40')]);_0xc50e6c[_0x1137('0x2c')]=_[_0x1137('0x2d')](_0x43f911['query']);_0xc50e6c['filters']=_[_0x1137('0x2e')](_0xc50e6c[_0x1137('0x2b')],_0xc50e6c[_0x1137('0x2c')]);_0x134ed1[_0x1137('0x2f')]=_[_0x1137('0x2e')](_0xc50e6c[_0x1137('0x2b')],qs[_0x1137('0x30')](_0x43f911['query'][_0x1137('0x30')]));_0x134ed1['attributes']=_0x134ed1[_0x1137('0x2f')][_0x1137('0x41')]?_0x134ed1[_0x1137('0x2f')]:_0xc50e6c[_0x1137('0x2b')];if(_0x43f911[_0x1137('0x2c')]['includeAll']){_0x134ed1[_0x1137('0x3b')]=[{'all':!![]}];}_0x134ed1=_[_0x1137('0x38')]({},_0x134ed1,_0x43f911[_0x1137('0x39')]);return db['ZendeskField'][_0x1137('0x42')](_0x134ed1)[_0x1137('0x3a')](handleEntityNotFound(_0x12b63b,null))[_0x1137('0x3a')](respondWithResult(_0x12b63b,null))['catch'](handleError(_0x12b63b,null));};exports[_0x1137('0x43')]=function(_0x5a5d37,_0x53aa88){return db[_0x1137('0x28')][_0x1137('0x43')](_0x5a5d37[_0x1137('0x44')],{})[_0x1137('0x3a')](respondWithResult(_0x53aa88,0xc9))[_0x1137('0x3d')](handleError(_0x53aa88,null));};exports[_0x1137('0x21')]=function(_0x5c3a14,_0x50d9d7){if(_0x5c3a14[_0x1137('0x44')]['id']){delete _0x5c3a14[_0x1137('0x44')]['id'];}return db[_0x1137('0x28')][_0x1137('0x42')]({'where':{'id':_0x5c3a14['params']['id']}})[_0x1137('0x3a')](handleEntityNotFound(_0x50d9d7,null))[_0x1137('0x3a')](saveUpdates(_0x5c3a14[_0x1137('0x44')],null))['then'](respondWithResult(_0x50d9d7,null))['catch'](handleError(_0x50d9d7,null));};exports[_0x1137('0x45')]=function(_0x4b2855,_0x261e0e){return db[_0x1137('0x28')]['find']({'where':{'id':_0x4b2855['params']['id']}})['then'](handleEntityNotFound(_0x261e0e,null))[_0x1137('0x3a')](removeEntity(_0x261e0e,null))['catch'](handleError(_0x261e0e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 324b3f4..64348ff 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 _0x8a75=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d9319,_0x390e90){var _0x52bc3a=function(_0x237ee7){while(--_0x237ee7){_0x3d9319['push'](_0x3d9319['shift']());}};_0x52bc3a(++_0x390e90);}(_0x8a75,0x110));var _0x58a7=function(_0x3a7fc0,_0x22b945){_0x3a7fc0=_0x3a7fc0-0x0;var _0x3b8b11=_0x8a75[_0x3a7fc0];return _0x3b8b11;};'use strict';var _=require('lodash');var util=require(_0x58a7('0x0'));var logger=require(_0x58a7('0x1'))(_0x58a7('0x2'));var moment=require('moment');var BPromise=require(_0x58a7('0x3'));var rp=require(_0x58a7('0x4'));var fs=require('fs');var path=require(_0x58a7('0x5'));var rimraf=require(_0x58a7('0x6'));var config=require(_0x58a7('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x58a7('0x8')]=function(_0x258cf7,_0x273ebf){return _0x258cf7[_0x58a7('0x9')](_0x58a7('0xa'),attributes,{'tableName':_0x58a7('0xb'),'paranoid':![],'indexes':[{'name':_0x58a7('0xc'),'fields':[_0x58a7('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d0c=['util','api','moment','bluebird','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x4d0c,0x135));var _0xc4d0=function(_0x1a92e3,_0x2a8f10){_0x1a92e3=_0x1a92e3-0x0;var _0x3cc198=_0x4d0c[_0x1a92e3];return _0x3cc198;};'use strict';var _=require(_0xc4d0('0x0'));var util=require(_0xc4d0('0x1'));var logger=require('../../config/logger')(_0xc4d0('0x2'));var moment=require(_0xc4d0('0x3'));var BPromise=require(_0xc4d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4f576d,_0x7bc2ba){return _0x4f576d[_0xc4d0('0x5')](_0xc4d0('0x6'),attributes,{'tableName':_0xc4d0('0x7'),'paranoid':![],'indexes':[{'name':_0xc4d0('0x8'),'fields':[_0xc4d0('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index b9e9708..9000e5d 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 _0xd149=['info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd149,0x1d2));var _0x9d14=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xd149[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x9d14('0x0'));var util=require(_0x9d14('0x1'));var moment=require(_0x9d14('0x2'));var BPromise=require(_0x9d14('0x3'));var rs=require(_0x9d14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d14('0x5'))['db'];var utils=require(_0x9d14('0x6'));var logger=require(_0x9d14('0x7'))(_0x9d14('0x8'));var config=require(_0x9d14('0x9'));var jayson=require(_0x9d14('0xa'));var client=jayson[_0x9d14('0xb')][_0x9d14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5617b8,_0x418f77,_0xcabf3b){return new BPromise(function(_0xd6d9d9,_0x488103){return client[_0x9d14('0xd')](_0x5617b8,_0xcabf3b)['then'](function(_0x2adcb4){logger[_0x9d14('0xe')]('ZendeskField,\x20%s,\x20%s',_0x418f77,_0x9d14('0xf'));logger['debug'](_0x9d14('0x10'),_0x418f77,'request\x20sent',JSON[_0x9d14('0x11')](_0x2adcb4));if(_0x2adcb4['error']){if(_0x2adcb4['error'][_0x9d14('0x12')]===0x1f4){logger[_0x9d14('0x13')](_0x9d14('0x14'),_0x418f77,_0x2adcb4[_0x9d14('0x13')][_0x9d14('0x15')]);return _0x488103(_0x2adcb4['error'][_0x9d14('0x15')]);}logger[_0x9d14('0x13')](_0x9d14('0x14'),_0x418f77,_0x2adcb4[_0x9d14('0x13')][_0x9d14('0x15')]);return _0xd6d9d9(_0x2adcb4[_0x9d14('0x13')][_0x9d14('0x15')]);}else{logger[_0x9d14('0xe')](_0x9d14('0x14'),_0x418f77,_0x9d14('0xf'));_0xd6d9d9(_0x2adcb4[_0x9d14('0x16')][_0x9d14('0x15')]);}})[_0x9d14('0x17')](function(_0x1982ac){logger[_0x9d14('0x13')](_0x9d14('0x14'),_0x418f77,_0x1982ac);_0x488103(_0x1982ac);});});} \ No newline at end of file +var _0x69b6=['then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x98a7f4,_0x26a940){var _0x1d8a5a=function(_0x47c3a8){while(--_0x47c3a8){_0x98a7f4['push'](_0x98a7f4['shift']());}};_0x1d8a5a(++_0x26a940);}(_0x69b6,0x114));var _0x669b=function(_0x4216bd,_0x3a3358){_0x4216bd=_0x4216bd-0x0;var _0x5f1497=_0x69b6[_0x4216bd];return _0x5f1497;};'use strict';var _=require(_0x669b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x669b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x669b('0x2'));var db=require(_0x669b('0x3'))['db'];var utils=require(_0x669b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x669b('0x5'));var jayson=require(_0x669b('0x6'));var client=jayson[_0x669b('0x7')][_0x669b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x317d64,_0x29dab2,_0x37f345){return new BPromise(function(_0x53b73e,_0x3e70c6){return client[_0x669b('0x9')](_0x317d64,_0x37f345)[_0x669b('0xa')](function(_0x353d33){logger['info'](_0x669b('0xb'),_0x29dab2,_0x669b('0xc'));logger[_0x669b('0xd')](_0x669b('0xe'),_0x29dab2,_0x669b('0xc'),JSON[_0x669b('0xf')](_0x353d33));if(_0x353d33[_0x669b('0x10')]){if(_0x353d33[_0x669b('0x10')][_0x669b('0x11')]===0x1f4){logger[_0x669b('0x10')](_0x669b('0xb'),_0x29dab2,_0x353d33['error'][_0x669b('0x12')]);return _0x3e70c6(_0x353d33['error'][_0x669b('0x12')]);}logger[_0x669b('0x10')]('ZendeskField,\x20%s,\x20%s',_0x29dab2,_0x353d33[_0x669b('0x10')]['message']);return _0x53b73e(_0x353d33[_0x669b('0x10')][_0x669b('0x12')]);}else{logger[_0x669b('0x13')](_0x669b('0xb'),_0x29dab2,_0x669b('0xc'));_0x53b73e(_0x353d33[_0x669b('0x14')]['message']);}})[_0x669b('0x15')](function(_0x4b63d3){logger['error'](_0x669b('0xb'),_0x29dab2,_0x4b63d3);_0x3e70c6(_0x4b63d3);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c6c576c..32ebc19 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 _0x2f76=['./intZohoAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x350bdd,_0x5a2be2){var _0x481c4e=function(_0x123af9){while(--_0x123af9){_0x350bdd['push'](_0x350bdd['shift']());}};_0x481c4e(++_0x5a2be2);}(_0x2f76,0xaf));var _0x62f7=function(_0x1f810c,_0x27a26c){_0x1f810c=_0x1f810c-0x0;var _0x51f5f0=_0x2f76[_0x1f810c];return _0x51f5f0;};'use strict';var multer=require(_0x62f7('0x0'));var util=require(_0x62f7('0x1'));var path=require(_0x62f7('0x2'));var timeout=require(_0x62f7('0x3'));var express=require(_0x62f7('0x4'));var router=express[_0x62f7('0x5')]();var fs_extra=require(_0x62f7('0x6'));var auth=require(_0x62f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x62f7('0x8'));var controller=require(_0x62f7('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x62f7('0xa')]);router[_0x62f7('0xb')](_0x62f7('0xc'),auth[_0x62f7('0xd')](),controller[_0x62f7('0xe')]);router[_0x62f7('0xb')](_0x62f7('0xf'),auth[_0x62f7('0xd')](),controller[_0x62f7('0x10')]);router[_0x62f7('0xb')](_0x62f7('0x11'),auth[_0x62f7('0xd')](),controller['getFields']);router['post']('/',auth[_0x62f7('0xd')](),controller[_0x62f7('0x12')]);router[_0x62f7('0x13')](_0x62f7('0xf'),auth[_0x62f7('0xd')](),controller[_0x62f7('0x14')]);router['put'](_0x62f7('0xc'),auth[_0x62f7('0xd')](),controller['update']);router['delete']('/:id',auth[_0x62f7('0xd')](),controller[_0x62f7('0x15')]);module[_0x62f7('0x16')]=router; \ No newline at end of file +var _0x41b1=['addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create'];(function(_0x57381e,_0x3bd145){var _0x46ea7d=function(_0x58658a){while(--_0x58658a){_0x57381e['push'](_0x57381e['shift']());}};_0x46ea7d(++_0x3bd145);}(_0x41b1,0xe1));var _0x141b=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x41b1[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0x141b('0x0'));var util=require(_0x141b('0x1'));var path=require('path');var timeout=require(_0x141b('0x2'));var express=require(_0x141b('0x3'));var router=express[_0x141b('0x4')]();var fs_extra=require(_0x141b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x141b('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x141b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x141b('0x8'),auth[_0x141b('0x9')](),controller[_0x141b('0xa')]);router[_0x141b('0x7')](_0x141b('0xb'),auth[_0x141b('0x9')](),controller['getConfigurations']);router[_0x141b('0x7')](_0x141b('0xc'),auth[_0x141b('0x9')](),controller['getFields']);router[_0x141b('0xd')]('/',auth[_0x141b('0x9')](),controller[_0x141b('0xe')]);router['post'](_0x141b('0xb'),auth[_0x141b('0x9')](),controller[_0x141b('0xf')]);router[_0x141b('0x10')](_0x141b('0x8'),auth['isAuthenticated'](),controller[_0x141b('0x11')]);router[_0x141b('0x12')]('/:id',auth[_0x141b('0x9')](),controller['destroy']);module[_0x141b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 545394e..ab3737a 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 _0x41bb=['exports','STRING','sequelize'];(function(_0x3dd92b,_0x4d1139){var _0x5e1d23=function(_0x5d866f){while(--_0x5d866f){_0x3dd92b['push'](_0x3dd92b['shift']());}};_0x5e1d23(++_0x4d1139);}(_0x41bb,0xc5));var _0xb41b=function(_0x17449a,_0x2dc222){_0x17449a=_0x17449a-0x0;var _0x15bcd8=_0x41bb[_0x17449a];return _0x15bcd8;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file +var _0x41bb=['exports','STRING','sequelize'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x41bb,0xc5));var _0xb41b=function(_0x253e3a,_0x302766){_0x253e3a=_0x253e3a-0x0;var _0x33d05b=_0x41bb[_0x253e3a];return _0x33d05b;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6080588..2f09f85 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 _0x6a6e=['then','destroy','error','stack','name','send','ZohoAccount','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','host','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','update'];(function(_0x389fdd,_0x3d091e){var _0x140d5b=function(_0xba4fa0){while(--_0xba4fa0){_0x389fdd['push'](_0x389fdd['shift']());}};_0x140d5b(++_0x3d091e);}(_0x6a6e,0xd3));var _0xe6a6=function(_0x55a41c,_0x2ced02){_0x55a41c=_0x55a41c-0x0;var _0x278b73=_0x6a6e[_0x55a41c];return _0x278b73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6a6('0x0'));var zipdir=require(_0xe6a6('0x1'));var jsonpatch=require(_0xe6a6('0x2'));var rp=require(_0xe6a6('0x3'));var moment=require(_0xe6a6('0x4'));var BPromise=require(_0xe6a6('0x5'));var Mustache=require(_0xe6a6('0x6'));var util=require(_0xe6a6('0x7'));var path=require('path');var sox=require(_0xe6a6('0x8'));var csv=require(_0xe6a6('0x9'));var ejs=require(_0xe6a6('0xa'));var fs=require('fs');var fs_extra=require(_0xe6a6('0xb'));var _=require(_0xe6a6('0xc'));var squel=require(_0xe6a6('0xd'));var crypto=require(_0xe6a6('0xe'));var jsforce=require(_0xe6a6('0xf'));var deskjs=require(_0xe6a6('0x10'));var toCsv=require(_0xe6a6('0x9'));var querystring=require(_0xe6a6('0x11'));var Papa=require(_0xe6a6('0x12'));var Redis=require('ioredis');var authService=require(_0xe6a6('0x13'));var qs=require(_0xe6a6('0x14'));var as=require(_0xe6a6('0x15'));var hardwareService=require(_0xe6a6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe6a6('0x17'));var config=require(_0xe6a6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6a6('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d02bf,_0x50dab2){_0x50dab2=_0x50dab2||0xcc;return function(_0x4cabab){if(_0x4cabab){return _0x5d02bf[_0xe6a6('0x1a')](_0x50dab2);}return _0x5d02bf['status'](_0x50dab2)[_0xe6a6('0x1b')]();};}function respondWithResult(_0x4cd6c1,_0x4b46f0){_0x4b46f0=_0x4b46f0||0xc8;return function(_0x3e7f5d){if(_0x3e7f5d){return _0x4cd6c1['status'](_0x4b46f0)[_0xe6a6('0x1c')](_0x3e7f5d);}};}function respondWithFilteredResult(_0xcad6d0,_0x54c403){return function(_0x158594){if(_0x158594){var _0x440ddd=typeof _0x54c403[_0xe6a6('0x1d')]==='undefined'&&typeof _0x54c403['limit']===_0xe6a6('0x1e');var _0x3d2efe=_0x158594[_0xe6a6('0x1f')];var _0x4364e3=_0x440ddd?0x0:_0x54c403[_0xe6a6('0x1d')];var _0x24f94d=_0x440ddd?_0x158594[_0xe6a6('0x1f')]:_0x54c403['offset']+_0x54c403[_0xe6a6('0x20')];var _0x5f4445;if(_0x24f94d>=_0x3d2efe){_0x24f94d=_0x3d2efe;_0x5f4445=0xc8;}else{_0x5f4445=0xce;}_0xcad6d0[_0xe6a6('0x21')](_0x5f4445);return _0xcad6d0[_0xe6a6('0x22')](_0xe6a6('0x23'),_0x4364e3+'-'+_0x24f94d+'/'+_0x3d2efe)[_0xe6a6('0x1c')](_0x158594);}return null;};}function patchUpdates(_0x549e09){return function(_0x1fc8d3){try{jsonpatch['apply'](_0x1fc8d3,_0x549e09,!![]);}catch(_0x260d6a){return BPromise['reject'](_0x260d6a);}return _0x1fc8d3['save']();};}function saveUpdates(_0x32b881,_0x333e66){return function(_0x5d1ee2){if(_0x5d1ee2){return _0x5d1ee2[_0xe6a6('0x24')](_0x32b881)[_0xe6a6('0x25')](function(_0x354c31){return _0x354c31;});}return null;};}function removeEntity(_0xe6d821,_0x9b18e4){return function(_0x574074){if(_0x574074){return _0x574074[_0xe6a6('0x26')]()[_0xe6a6('0x25')](function(){_0xe6d821[_0xe6a6('0x21')](0xcc)[_0xe6a6('0x1b')]();});}};}function handleEntityNotFound(_0x2de399,_0x56d6e9){return function(_0x5f1878){if(!_0x5f1878){_0x2de399['sendStatus'](0x194);}return _0x5f1878;};}function handleError(_0x22855c,_0x11b169){_0x11b169=_0x11b169||0x1f4;return function(_0xfb174d){logger[_0xe6a6('0x27')](_0xfb174d[_0xe6a6('0x28')]);if(_0xfb174d[_0xe6a6('0x29')]){delete _0xfb174d['name'];}_0x22855c[_0xe6a6('0x21')](_0x11b169)[_0xe6a6('0x2a')](_0xfb174d);};}exports['index']=function(_0x5392a3,_0x5e3b0b){var _0x4de993={},_0x2a7557={},_0x2b41db={'count':0x0,'rows':[]};var _0x2881ba=_['map'](db[_0xe6a6('0x2b')][_0xe6a6('0x2c')],function(_0x17c0df){return{'name':_0x17c0df['fieldName'],'type':_0x17c0df['type'][_0xe6a6('0x2d')]};});_0x2a7557['model']=_[_0xe6a6('0x2e')](_0x2881ba,_0xe6a6('0x29'));_0x2a7557[_0xe6a6('0x2f')]=_[_0xe6a6('0x30')](_0x5392a3[_0xe6a6('0x2f')]);_0x2a7557[_0xe6a6('0x31')]=_[_0xe6a6('0x32')](_0x2a7557[_0xe6a6('0x33')],_0x2a7557['query']);_0x4de993[_0xe6a6('0x34')]=_[_0xe6a6('0x32')](_0x2a7557[_0xe6a6('0x33')],qs[_0xe6a6('0x35')](_0x5392a3[_0xe6a6('0x2f')]['fields']));_0x4de993[_0xe6a6('0x34')]=_0x4de993[_0xe6a6('0x34')][_0xe6a6('0x36')]?_0x4de993[_0xe6a6('0x34')]:_0x2a7557[_0xe6a6('0x33')];if(!_0x5392a3[_0xe6a6('0x2f')][_0xe6a6('0x37')]('nolimit')){_0x4de993[_0xe6a6('0x20')]=qs[_0xe6a6('0x20')](_0x5392a3[_0xe6a6('0x2f')][_0xe6a6('0x20')]);_0x4de993[_0xe6a6('0x1d')]=qs[_0xe6a6('0x1d')](_0x5392a3[_0xe6a6('0x2f')][_0xe6a6('0x1d')]);}_0x4de993[_0xe6a6('0x38')]=qs[_0xe6a6('0x39')](_0x5392a3['query'][_0xe6a6('0x39')]);_0x4de993['where']=qs[_0xe6a6('0x31')](_[_0xe6a6('0x3a')](_0x5392a3[_0xe6a6('0x2f')],_0x2a7557[_0xe6a6('0x31')]),_0x2881ba);if(_0x5392a3[_0xe6a6('0x2f')][_0xe6a6('0x3b')]){_0x4de993[_0xe6a6('0x3c')]=_[_0xe6a6('0x3d')](_0x4de993['where'],{'$or':_['map'](_0x2881ba,function(_0x3e6a6f){if(_0x3e6a6f[_0xe6a6('0x3e')]!=='VIRTUAL'){var _0x370be2={};_0x370be2[_0x3e6a6f[_0xe6a6('0x29')]]={'$like':'%'+_0x5392a3[_0xe6a6('0x2f')]['filter']+'%'};return _0x370be2;}})});}_0x4de993=_[_0xe6a6('0x3d')]({},_0x4de993,_0x5392a3[_0xe6a6('0x3f')]);var _0x13f5a1={'where':_0x4de993[_0xe6a6('0x3c')]};return db[_0xe6a6('0x2b')][_0xe6a6('0x1f')](_0x13f5a1)['then'](function(_0x5b8556){_0x2b41db[_0xe6a6('0x1f')]=_0x5b8556;if(_0x5392a3[_0xe6a6('0x2f')][_0xe6a6('0x40')]){_0x4de993[_0xe6a6('0x41')]=[{'all':!![]}];}return db[_0xe6a6('0x2b')][_0xe6a6('0x42')](_0x4de993);})['then'](function(_0x42cf21){_0x2b41db['rows']=_0x42cf21;return _0x2b41db;})[_0xe6a6('0x25')](respondWithFilteredResult(_0x5e3b0b,_0x4de993))[_0xe6a6('0x43')](handleError(_0x5e3b0b,null));};exports[_0xe6a6('0x44')]=function(_0x591464,_0x2f4639){var _0x2046d2={'raw':![],'where':{'id':_0x591464[_0xe6a6('0x45')]['id']}},_0x52ed94={};_0x52ed94[_0xe6a6('0x33')]=_[_0xe6a6('0x30')](db[_0xe6a6('0x2b')][_0xe6a6('0x2c')]);_0x52ed94[_0xe6a6('0x2f')]=_[_0xe6a6('0x30')](_0x591464['query']);_0x52ed94['filters']=_['intersection'](_0x52ed94[_0xe6a6('0x33')],_0x52ed94[_0xe6a6('0x2f')]);_0x2046d2[_0xe6a6('0x34')]=_['intersection'](_0x52ed94[_0xe6a6('0x33')],qs[_0xe6a6('0x35')](_0x591464[_0xe6a6('0x2f')][_0xe6a6('0x35')]));_0x2046d2[_0xe6a6('0x34')]=_0x2046d2[_0xe6a6('0x34')][_0xe6a6('0x36')]?_0x2046d2[_0xe6a6('0x34')]:_0x52ed94[_0xe6a6('0x33')];if(_0x591464[_0xe6a6('0x2f')][_0xe6a6('0x40')]){_0x2046d2[_0xe6a6('0x41')]=[{'all':!![]}];}_0x2046d2=_[_0xe6a6('0x3d')]({},_0x2046d2,_0x591464['options']);return db['ZohoAccount'][_0xe6a6('0x46')](_0x2046d2)[_0xe6a6('0x25')](handleEntityNotFound(_0x2f4639,null))[_0xe6a6('0x25')](respondWithResult(_0x2f4639,null))[_0xe6a6('0x43')](handleError(_0x2f4639,null));};exports[_0xe6a6('0x47')]=function(_0x2c7174,_0x4ba94a){return db[_0xe6a6('0x2b')][_0xe6a6('0x47')](_0x2c7174[_0xe6a6('0x48')],{})[_0xe6a6('0x25')](respondWithResult(_0x4ba94a,0xc9))[_0xe6a6('0x43')](handleError(_0x4ba94a,null));};exports[_0xe6a6('0x24')]=function(_0x2dd795,_0x1d3dd3){if(_0x2dd795['body']['id']){delete _0x2dd795[_0xe6a6('0x48')]['id'];}return db['ZohoAccount'][_0xe6a6('0x46')]({'where':{'id':_0x2dd795[_0xe6a6('0x45')]['id']}})[_0xe6a6('0x25')](handleEntityNotFound(_0x1d3dd3,null))[_0xe6a6('0x25')](saveUpdates(_0x2dd795[_0xe6a6('0x48')],null))[_0xe6a6('0x25')](respondWithResult(_0x1d3dd3,null))['catch'](handleError(_0x1d3dd3,null));};exports['destroy']=function(_0x1edcbf,_0x4a1352){return db[_0xe6a6('0x2b')]['find']({'where':{'id':_0x1edcbf[_0xe6a6('0x45')]['id']}})[_0xe6a6('0x25')](handleEntityNotFound(_0x4a1352,null))[_0xe6a6('0x25')](removeEntity(_0x4a1352,null))[_0xe6a6('0x43')](handleError(_0x4a1352,null));};exports[_0xe6a6('0x49')]=function(_0x18d23a,_0xcfa014,_0x2dcfa1){var _0x25c5e5={};var _0x4a4234={};var _0x340e49;var _0x127ef4;return db[_0xe6a6('0x2b')]['findOne']({'where':{'id':_0x18d23a['params']['id']}})['then'](handleEntityNotFound(_0xcfa014,null))['then'](function(_0x121063){if(_0x121063){_0x340e49=_0x121063;_0x4a4234[_0xe6a6('0x33')]=_[_0xe6a6('0x30')](db['ZohoConfiguration'][_0xe6a6('0x2c')]);_0x4a4234[_0xe6a6('0x2f')]=_[_0xe6a6('0x30')](_0x18d23a['query']);_0x4a4234[_0xe6a6('0x31')]=_[_0xe6a6('0x32')](_0x4a4234[_0xe6a6('0x33')],_0x4a4234[_0xe6a6('0x2f')]);_0x25c5e5['attributes']=_[_0xe6a6('0x32')](_0x4a4234[_0xe6a6('0x33')],qs[_0xe6a6('0x35')](_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x35')]));_0x25c5e5[_0xe6a6('0x34')]=_0x25c5e5[_0xe6a6('0x34')][_0xe6a6('0x36')]?_0x25c5e5[_0xe6a6('0x34')]:_0x4a4234['model'];_0x25c5e5[_0xe6a6('0x38')]=qs[_0xe6a6('0x39')](_0x18d23a['query'][_0xe6a6('0x39')]);_0x25c5e5['where']=qs[_0xe6a6('0x31')](_[_0xe6a6('0x3a')](_0x18d23a[_0xe6a6('0x2f')],_0x4a4234['filters']));if(_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x3b')]){_0x25c5e5['where']=_[_0xe6a6('0x3d')](_0x25c5e5[_0xe6a6('0x3c')],{'$or':_[_0xe6a6('0x2e')](_0x25c5e5[_0xe6a6('0x34')],function(_0x3e4019){var _0x3509b1={};_0x3509b1[_0x3e4019]={'$like':'%'+_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x3b')]+'%'};return _0x3509b1;})});}_0x25c5e5=_[_0xe6a6('0x3d')]({},_0x25c5e5,_0x18d23a[_0xe6a6('0x3f')]);return _0x340e49[_0xe6a6('0x49')](_0x25c5e5);}})['then'](function(_0x51aaa7){if(_0x51aaa7){_0x127ef4=_0x51aaa7['length'];if(!_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x37')](_0xe6a6('0x4a'))){_0x25c5e5['limit']=qs['limit'](_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x20')]);_0x25c5e5[_0xe6a6('0x1d')]=qs[_0xe6a6('0x1d')](_0x18d23a[_0xe6a6('0x2f')][_0xe6a6('0x1d')]);}return _0x340e49[_0xe6a6('0x49')](_0x25c5e5);}})[_0xe6a6('0x25')](function(_0x690213){if(_0x690213){return _0x690213?{'count':_0x127ef4,'rows':_0x690213}:null;}})[_0xe6a6('0x25')](respondWithResult(_0xcfa014,null))[_0xe6a6('0x43')](handleError(_0xcfa014,null));};exports[_0xe6a6('0x4b')]=function(_0x42bbd2,_0x5da692,_0x4a926a){if(_0x42bbd2[_0xe6a6('0x48')]['id']){delete _0x42bbd2['body']['id'];}return db[_0xe6a6('0x2b')][_0xe6a6('0x4c')]({'where':{'id':_0x42bbd2['params']['id']}})[_0xe6a6('0x25')](handleEntityNotFound(_0x5da692,null))['then'](function(_0x23713d){if(_0x23713d){_0x42bbd2['body']['AccountId']=_0x23713d['id'];_0x42bbd2['body']['Subjects']=integrations[_0xe6a6('0x4d')](_0x42bbd2[_0xe6a6('0x48')][_0xe6a6('0x4e')],_0x42bbd2[_0xe6a6('0x48')][_0xe6a6('0x3e')]);_0x42bbd2[_0xe6a6('0x48')][_0xe6a6('0x4f')]=integrations[_0xe6a6('0x50')](_0x42bbd2[_0xe6a6('0x48')]['channel'],_0x42bbd2[_0xe6a6('0x48')][_0xe6a6('0x3e')]);return db['ZohoConfiguration'][_0xe6a6('0x47')](_0x42bbd2[_0xe6a6('0x48')],{'include':[{'model':db[_0xe6a6('0x51')],'as':_0xe6a6('0x52')},{'model':db[_0xe6a6('0x51')],'as':_0xe6a6('0x4f')}]});}return null;})[_0xe6a6('0x25')](respondWithResult(_0x5da692,null))[_0xe6a6('0x43')](handleError(_0x5da692,null));};function getAccessToken(_0x191256){return new Promise(function(_0x2b0c06,_0x5c57fe){var _0x50d094;switch(_0x191256[_0xe6a6('0x53')]){case'US':_0x50d094=_0xe6a6('0x54');break;case'AU':_0x50d094=_0xe6a6('0x55');break;case'EU':_0x50d094=_0xe6a6('0x56');break;case'IN':_0x50d094=_0xe6a6('0x57');break;case'CN':_0x50d094=_0xe6a6('0x58');break;default:_0x50d094=_0xe6a6('0x56');break;}var _0xe7796d={'method':_0xe6a6('0x59'),'uri':_0x50d094+_0xe6a6('0x5a'),'qs':{'refresh_token':_0x191256[_0xe6a6('0x5b')],'client_id':_0x191256[_0xe6a6('0x5c')],'client_secret':_0x191256[_0xe6a6('0x5d')],'grant_type':_0xe6a6('0x5e')},'json':!![]};return rp(_0xe7796d)[_0xe6a6('0x25')](function(_0x5783c6){if(_0x5783c6[_0xe6a6('0x5f')]){_0x2b0c06(_0x5783c6[_0xe6a6('0x5f')]);}else{_0x5c57fe(_0xe6a6('0x60'));}})['catch'](function(_0xe93120){_0x5c57fe(_0xe93120);});});}exports['getFields']=function(_0x33b633,_0x54d73f,_0x3aa4a1){var _0x1e27ad,_0x581264,_0xc4b615,_0x2199e9,_0x3ac0ea;return db[_0xe6a6('0x2b')]['findOne']({'where':{'id':_0x33b633[_0xe6a6('0x45')]['id']},'attributes':['id','host',_0xe6a6('0x53'),_0xe6a6('0x5c'),_0xe6a6('0x5d'),_0xe6a6('0x61'),'code',_0xe6a6('0x5b')]})[_0xe6a6('0x25')](handleEntityNotFound(_0x54d73f,null))[_0xe6a6('0x25')](function(_0x4e02c3){_0x3ac0ea=_0x4e02c3;_0x1e27ad=_0x3ac0ea[_0xe6a6('0x62')];_0x581264=_0x1e27ad===_0xe6a6('0x63')?'eu':'com';_0xc4b615=_0x3ac0ea[_0xe6a6('0x61')];var _0x326734=_0xc4b615[_0xe6a6('0x64')](-0x1);if(_0x326734==='/'||_0x326734==='\x5c'||_0x326734===':'){_0xc4b615=_0xc4b615[_0xe6a6('0x65')](0x0,_0xc4b615[_0xe6a6('0x66')](_0x326734));}if(!_0x3ac0ea[_0xe6a6('0x5b')]){throw new Error(_0xe6a6('0x67'));}return getAccessToken(_0x3ac0ea);})[_0xe6a6('0x25')](function(_0x93683c){if(_0x93683c){return rp({'method':_0xe6a6('0x68'),'uri':util[_0xe6a6('0x69')](_0xe6a6('0x6a'),_0x581264),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x93683c},'json':!![]});}})['then'](function(_0x2dadb5){if(_0x2dadb5){if(_0x2dadb5[_0xe6a6('0x6b')]&&_0x2dadb5[_0xe6a6('0x6b')][_0xe6a6('0x27')]){throw new Error(_0x2dadb5[_0xe6a6('0x6b')]['error'][_0xe6a6('0x6c')]);}var _0x28c8f2=[];var _0x48943b=[];var _0x41a5bb=['Owner','Subject',_0xe6a6('0x6d'),_0xe6a6('0x6e'),'Call_Duration',_0xe6a6('0x6f'),_0xe6a6('0x70'),'Call_Type'];_0x48943b=_[_0xe6a6('0x71')](_0x2dadb5[_0xe6a6('0x35')],function(_0x4a4e15){return _0x41a5bb[_0xe6a6('0x72')](_0x4a4e15[_0xe6a6('0x73')]);});for(var _0x8e5309=0x0;_0x8e5309<_0x48943b[_0xe6a6('0x36')];_0x8e5309++){if(_0x48943b[_0x8e5309][_0xe6a6('0x74')]===![]){_0x28c8f2[_0xe6a6('0x75')]({'id':_0x48943b[_0x8e5309]['id'],'name':_0x48943b[_0x8e5309][_0xe6a6('0x76')],'custom':_0x48943b[_0x8e5309][_0xe6a6('0x77')],'options':_0x48943b[_0x8e5309][_0xe6a6('0x78')]==='picklist'&&_0x48943b[_0x8e5309]['pick_list_values'][_0xe6a6('0x36')]>-0x1?_[_0xe6a6('0x2e')](_0x48943b[_0x8e5309][_0xe6a6('0x79')],function(_0x50367c){return{'name':_0x50367c,'value':_0x50367c};}):[]});}}return{'count':_0x28c8f2[_0xe6a6('0x36')],'rows':_0x28c8f2};}else{return{'count':0x0,'rows':[]};}})[_0xe6a6('0x25')](respondWithResult(_0x54d73f,null))[_0xe6a6('0x43')](function(_0x33b408){var _0x2e18e2=_0x33b633[_0xe6a6('0x2f')]['test']?0x1f4:_0x33b408['statusCode']||0x1f4;logger[_0xe6a6('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xe6a6('0x7a'),_0x2e18e2,JSON['stringify'](_0x33b408));delete _0x33b408[_0xe6a6('0x29')];if(_0x2e18e2===0x191){_0x2e18e2=0x190;}_0x54d73f['status'](_0x2e18e2)[_0xe6a6('0x2a')](_0x33b633[_0xe6a6('0x2f')]['test']?{'message':_0xe6a6('0x7b'),'statusCode':_0x33b408['statusCode']}:_0x33b408);});}; \ No newline at end of file +var _0xa6f4=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','apply','reject','save','update','destroy','then','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','show','params','includeAll','find','create','body','getConfigurations','filters','sort','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x9fe83a,_0x31f3f2){var _0x5ebcc1=function(_0x643c33){while(--_0x643c33){_0x9fe83a['push'](_0x9fe83a['shift']());}};_0x5ebcc1(++_0x31f3f2);}(_0xa6f4,0x7b));var _0x4a6f=function(_0x598224,_0x1b210d){_0x598224=_0x598224-0x0;var _0x313007=_0xa6f4[_0x598224];return _0x313007;};'use strict';var emlformat=require(_0x4a6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a6f('0x2'));var moment=require(_0x4a6f('0x3'));var BPromise=require(_0x4a6f('0x4'));var Mustache=require('mustache');var util=require(_0x4a6f('0x5'));var path=require('path');var sox=require(_0x4a6f('0x6'));var csv=require(_0x4a6f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a6f('0x8'));var _=require('lodash');var squel=require(_0x4a6f('0x9'));var crypto=require(_0x4a6f('0xa'));var jsforce=require(_0x4a6f('0xb'));var deskjs=require(_0x4a6f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4a6f('0xd'));var Papa=require(_0x4a6f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4a6f('0xf'));var as=require(_0x4a6f('0x10'));var hardwareService=require(_0x4a6f('0x11'));var logger=require(_0x4a6f('0x12'))(_0x4a6f('0x13'));var utils=require(_0x4a6f('0x14'));var config=require(_0x4a6f('0x15'));var licenseUtil=require(_0x4a6f('0x16'));var db=require(_0x4a6f('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x431b85,_0x5b17bf){_0x5b17bf=_0x5b17bf||0xcc;return function(_0x37ca96){if(_0x37ca96){return _0x431b85[_0x4a6f('0x18')](_0x5b17bf);}return _0x431b85['status'](_0x5b17bf)[_0x4a6f('0x19')]();};}function respondWithResult(_0x2b38b0,_0x1e6bb8){_0x1e6bb8=_0x1e6bb8||0xc8;return function(_0x59f125){if(_0x59f125){return _0x2b38b0[_0x4a6f('0x1a')](_0x1e6bb8)[_0x4a6f('0x1b')](_0x59f125);}};}function respondWithFilteredResult(_0x31c07f,_0x3652b7){return function(_0xfe77fe){if(_0xfe77fe){var _0x3442c2=typeof _0x3652b7['offset']===_0x4a6f('0x1c')&&typeof _0x3652b7[_0x4a6f('0x1d')]===_0x4a6f('0x1c');var _0x2bb58e=_0xfe77fe['count'];var _0x53c03e=_0x3442c2?0x0:_0x3652b7[_0x4a6f('0x1e')];var _0x19bba3=_0x3442c2?_0xfe77fe['count']:_0x3652b7[_0x4a6f('0x1e')]+_0x3652b7[_0x4a6f('0x1d')];var _0x493a8f;if(_0x19bba3>=_0x2bb58e){_0x19bba3=_0x2bb58e;_0x493a8f=0xc8;}else{_0x493a8f=0xce;}_0x31c07f[_0x4a6f('0x1a')](_0x493a8f);return _0x31c07f[_0x4a6f('0x1f')]('Content-Range',_0x53c03e+'-'+_0x19bba3+'/'+_0x2bb58e)[_0x4a6f('0x1b')](_0xfe77fe);}return null;};}function patchUpdates(_0x1d95e5){return function(_0x5cd37d){try{jsonpatch[_0x4a6f('0x20')](_0x5cd37d,_0x1d95e5,!![]);}catch(_0x3611b1){return BPromise[_0x4a6f('0x21')](_0x3611b1);}return _0x5cd37d[_0x4a6f('0x22')]();};}function saveUpdates(_0x51ac7a,_0x560b49){return function(_0x5afe69){if(_0x5afe69){return _0x5afe69[_0x4a6f('0x23')](_0x51ac7a)['then'](function(_0x330242){return _0x330242;});}return null;};}function removeEntity(_0x59c799,_0x58e7e3){return function(_0x205338){if(_0x205338){return _0x205338[_0x4a6f('0x24')]()[_0x4a6f('0x25')](function(){_0x59c799[_0x4a6f('0x1a')](0xcc)[_0x4a6f('0x19')]();});}};}function handleEntityNotFound(_0x4e769f,_0x4c44a0){return function(_0x1c3f49){if(!_0x1c3f49){_0x4e769f['sendStatus'](0x194);}return _0x1c3f49;};}function handleError(_0x4597fd,_0x3c4258){_0x3c4258=_0x3c4258||0x1f4;return function(_0x2c092e){logger['error'](_0x2c092e[_0x4a6f('0x26')]);if(_0x2c092e[_0x4a6f('0x27')]){delete _0x2c092e[_0x4a6f('0x27')];}_0x4597fd[_0x4a6f('0x1a')](_0x3c4258)[_0x4a6f('0x28')](_0x2c092e);};}exports['index']=function(_0x1db113,_0x12affa){var _0x5b5fb9={},_0x42b4de={},_0xd70b3b={'count':0x0,'rows':[]};var _0x49c2cf=_[_0x4a6f('0x29')](db[_0x4a6f('0x2a')][_0x4a6f('0x2b')],function(_0x4774ae){return{'name':_0x4774ae[_0x4a6f('0x2c')],'type':_0x4774ae['type']['key']};});_0x42b4de['model']=_[_0x4a6f('0x29')](_0x49c2cf,_0x4a6f('0x27'));_0x42b4de[_0x4a6f('0x2d')]=_[_0x4a6f('0x2e')](_0x1db113['query']);_0x42b4de['filters']=_[_0x4a6f('0x2f')](_0x42b4de[_0x4a6f('0x30')],_0x42b4de[_0x4a6f('0x2d')]);_0x5b5fb9[_0x4a6f('0x31')]=_[_0x4a6f('0x2f')](_0x42b4de[_0x4a6f('0x30')],qs[_0x4a6f('0x32')](_0x1db113[_0x4a6f('0x2d')][_0x4a6f('0x32')]));_0x5b5fb9['attributes']=_0x5b5fb9[_0x4a6f('0x31')][_0x4a6f('0x33')]?_0x5b5fb9[_0x4a6f('0x31')]:_0x42b4de[_0x4a6f('0x30')];if(!_0x1db113[_0x4a6f('0x2d')][_0x4a6f('0x34')](_0x4a6f('0x35'))){_0x5b5fb9[_0x4a6f('0x1d')]=qs[_0x4a6f('0x1d')](_0x1db113[_0x4a6f('0x2d')][_0x4a6f('0x1d')]);_0x5b5fb9['offset']=qs[_0x4a6f('0x1e')](_0x1db113[_0x4a6f('0x2d')]['offset']);}_0x5b5fb9[_0x4a6f('0x36')]=qs['sort'](_0x1db113[_0x4a6f('0x2d')]['sort']);_0x5b5fb9[_0x4a6f('0x37')]=qs['filters'](_['pick'](_0x1db113[_0x4a6f('0x2d')],_0x42b4de['filters']),_0x49c2cf);if(_0x1db113[_0x4a6f('0x2d')][_0x4a6f('0x38')]){_0x5b5fb9['where']=_[_0x4a6f('0x39')](_0x5b5fb9['where'],{'$or':_[_0x4a6f('0x29')](_0x49c2cf,function(_0x2e8883){if(_0x2e8883[_0x4a6f('0x3a')]!==_0x4a6f('0x3b')){var _0x87f8f1={};_0x87f8f1[_0x2e8883[_0x4a6f('0x27')]]={'$like':'%'+_0x1db113[_0x4a6f('0x2d')][_0x4a6f('0x38')]+'%'};return _0x87f8f1;}})});}_0x5b5fb9=_[_0x4a6f('0x39')]({},_0x5b5fb9,_0x1db113[_0x4a6f('0x3c')]);var _0x1fcfe3={'where':_0x5b5fb9[_0x4a6f('0x37')]};return db['ZohoAccount']['count'](_0x1fcfe3)[_0x4a6f('0x25')](function(_0x171879){_0xd70b3b[_0x4a6f('0x3d')]=_0x171879;if(_0x1db113['query']['includeAll']){_0x5b5fb9[_0x4a6f('0x3e')]=[{'all':!![]}];}return db[_0x4a6f('0x2a')][_0x4a6f('0x3f')](_0x5b5fb9);})['then'](function(_0xe32494){_0xd70b3b['rows']=_0xe32494;return _0xd70b3b;})['then'](respondWithFilteredResult(_0x12affa,_0x5b5fb9))[_0x4a6f('0x40')](handleError(_0x12affa,null));};exports[_0x4a6f('0x41')]=function(_0x3a9e4e,_0x442de4){var _0x235432={'raw':![],'where':{'id':_0x3a9e4e[_0x4a6f('0x42')]['id']}},_0x53cecc={};_0x53cecc[_0x4a6f('0x30')]=_[_0x4a6f('0x2e')](db[_0x4a6f('0x2a')][_0x4a6f('0x2b')]);_0x53cecc[_0x4a6f('0x2d')]=_[_0x4a6f('0x2e')](_0x3a9e4e[_0x4a6f('0x2d')]);_0x53cecc['filters']=_['intersection'](_0x53cecc[_0x4a6f('0x30')],_0x53cecc[_0x4a6f('0x2d')]);_0x235432[_0x4a6f('0x31')]=_[_0x4a6f('0x2f')](_0x53cecc[_0x4a6f('0x30')],qs[_0x4a6f('0x32')](_0x3a9e4e['query']['fields']));_0x235432['attributes']=_0x235432[_0x4a6f('0x31')][_0x4a6f('0x33')]?_0x235432[_0x4a6f('0x31')]:_0x53cecc['model'];if(_0x3a9e4e[_0x4a6f('0x2d')][_0x4a6f('0x43')]){_0x235432['include']=[{'all':!![]}];}_0x235432=_[_0x4a6f('0x39')]({},_0x235432,_0x3a9e4e['options']);return db[_0x4a6f('0x2a')][_0x4a6f('0x44')](_0x235432)[_0x4a6f('0x25')](handleEntityNotFound(_0x442de4,null))[_0x4a6f('0x25')](respondWithResult(_0x442de4,null))['catch'](handleError(_0x442de4,null));};exports['create']=function(_0x10d0fd,_0x3e24b2){return db[_0x4a6f('0x2a')][_0x4a6f('0x45')](_0x10d0fd[_0x4a6f('0x46')],{})['then'](respondWithResult(_0x3e24b2,0xc9))['catch'](handleError(_0x3e24b2,null));};exports[_0x4a6f('0x23')]=function(_0xe54a2d,_0x234441){if(_0xe54a2d[_0x4a6f('0x46')]['id']){delete _0xe54a2d[_0x4a6f('0x46')]['id'];}return db[_0x4a6f('0x2a')][_0x4a6f('0x44')]({'where':{'id':_0xe54a2d[_0x4a6f('0x42')]['id']}})['then'](handleEntityNotFound(_0x234441,null))[_0x4a6f('0x25')](saveUpdates(_0xe54a2d['body'],null))[_0x4a6f('0x25')](respondWithResult(_0x234441,null))[_0x4a6f('0x40')](handleError(_0x234441,null));};exports[_0x4a6f('0x24')]=function(_0x265934,_0x12e199){return db[_0x4a6f('0x2a')][_0x4a6f('0x44')]({'where':{'id':_0x265934['params']['id']}})[_0x4a6f('0x25')](handleEntityNotFound(_0x12e199,null))['then'](removeEntity(_0x12e199,null))[_0x4a6f('0x40')](handleError(_0x12e199,null));};exports[_0x4a6f('0x47')]=function(_0x1c219e,_0x6944aa,_0x88b531){var _0x1b8903={};var _0x3257c1={};var _0x928057;var _0x5a718d;return db[_0x4a6f('0x2a')]['findOne']({'where':{'id':_0x1c219e[_0x4a6f('0x42')]['id']}})[_0x4a6f('0x25')](handleEntityNotFound(_0x6944aa,null))[_0x4a6f('0x25')](function(_0x243a31){if(_0x243a31){_0x928057=_0x243a31;_0x3257c1[_0x4a6f('0x30')]=_[_0x4a6f('0x2e')](db['ZohoConfiguration'][_0x4a6f('0x2b')]);_0x3257c1[_0x4a6f('0x2d')]=_[_0x4a6f('0x2e')](_0x1c219e[_0x4a6f('0x2d')]);_0x3257c1[_0x4a6f('0x48')]=_['intersection'](_0x3257c1[_0x4a6f('0x30')],_0x3257c1[_0x4a6f('0x2d')]);_0x1b8903[_0x4a6f('0x31')]=_['intersection'](_0x3257c1['model'],qs[_0x4a6f('0x32')](_0x1c219e['query'][_0x4a6f('0x32')]));_0x1b8903[_0x4a6f('0x31')]=_0x1b8903[_0x4a6f('0x31')][_0x4a6f('0x33')]?_0x1b8903[_0x4a6f('0x31')]:_0x3257c1[_0x4a6f('0x30')];_0x1b8903[_0x4a6f('0x36')]=qs[_0x4a6f('0x49')](_0x1c219e[_0x4a6f('0x2d')][_0x4a6f('0x49')]);_0x1b8903[_0x4a6f('0x37')]=qs[_0x4a6f('0x48')](_[_0x4a6f('0x4a')](_0x1c219e[_0x4a6f('0x2d')],_0x3257c1[_0x4a6f('0x48')]));if(_0x1c219e[_0x4a6f('0x2d')][_0x4a6f('0x38')]){_0x1b8903[_0x4a6f('0x37')]=_[_0x4a6f('0x39')](_0x1b8903[_0x4a6f('0x37')],{'$or':_[_0x4a6f('0x29')](_0x1b8903['attributes'],function(_0x3cec55){var _0x54b112={};_0x54b112[_0x3cec55]={'$like':'%'+_0x1c219e[_0x4a6f('0x2d')][_0x4a6f('0x38')]+'%'};return _0x54b112;})});}_0x1b8903=_[_0x4a6f('0x39')]({},_0x1b8903,_0x1c219e[_0x4a6f('0x3c')]);return _0x928057[_0x4a6f('0x47')](_0x1b8903);}})[_0x4a6f('0x25')](function(_0x416854){if(_0x416854){_0x5a718d=_0x416854['length'];if(!_0x1c219e['query'][_0x4a6f('0x34')]('nolimit')){_0x1b8903[_0x4a6f('0x1d')]=qs[_0x4a6f('0x1d')](_0x1c219e['query']['limit']);_0x1b8903[_0x4a6f('0x1e')]=qs['offset'](_0x1c219e['query'][_0x4a6f('0x1e')]);}return _0x928057['getConfigurations'](_0x1b8903);}})[_0x4a6f('0x25')](function(_0x887a2b){if(_0x887a2b){return _0x887a2b?{'count':_0x5a718d,'rows':_0x887a2b}:null;}})[_0x4a6f('0x25')](respondWithResult(_0x6944aa,null))[_0x4a6f('0x40')](handleError(_0x6944aa,null));};exports[_0x4a6f('0x4b')]=function(_0x31826c,_0xd9a845,_0x350bd5){if(_0x31826c[_0x4a6f('0x46')]['id']){delete _0x31826c[_0x4a6f('0x46')]['id'];}return db[_0x4a6f('0x2a')][_0x4a6f('0x4c')]({'where':{'id':_0x31826c['params']['id']}})[_0x4a6f('0x25')](handleEntityNotFound(_0xd9a845,null))['then'](function(_0x1b8598){if(_0x1b8598){_0x31826c[_0x4a6f('0x46')][_0x4a6f('0x4d')]=_0x1b8598['id'];_0x31826c[_0x4a6f('0x46')][_0x4a6f('0x4e')]=integrations[_0x4a6f('0x4f')](_0x31826c['body'][_0x4a6f('0x50')],_0x31826c[_0x4a6f('0x46')][_0x4a6f('0x3a')]);_0x31826c[_0x4a6f('0x46')]['Descriptions']=integrations['getDescriptions'](_0x31826c[_0x4a6f('0x46')][_0x4a6f('0x50')],_0x31826c[_0x4a6f('0x46')][_0x4a6f('0x3a')]);return db[_0x4a6f('0x51')][_0x4a6f('0x45')](_0x31826c[_0x4a6f('0x46')],{'include':[{'model':db[_0x4a6f('0x52')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x4a6f('0x25')](respondWithResult(_0xd9a845,null))[_0x4a6f('0x40')](handleError(_0xd9a845,null));};function getAccessToken(_0x2dbf16){return new Promise(function(_0x90272f,_0x4857a0){var _0x51ba7c;switch(_0x2dbf16[_0x4a6f('0x53')]){case'US':_0x51ba7c=_0x4a6f('0x54');break;case'AU':_0x51ba7c=_0x4a6f('0x55');break;case'EU':_0x51ba7c='https://accounts.zoho.eu';break;case'IN':_0x51ba7c=_0x4a6f('0x56');break;case'CN':_0x51ba7c=_0x4a6f('0x57');break;default:_0x51ba7c='https://accounts.zoho.eu';break;}var _0x131be9={'method':_0x4a6f('0x58'),'uri':_0x51ba7c+_0x4a6f('0x59'),'qs':{'refresh_token':_0x2dbf16[_0x4a6f('0x5a')],'client_id':_0x2dbf16[_0x4a6f('0x5b')],'client_secret':_0x2dbf16[_0x4a6f('0x5c')],'grant_type':_0x4a6f('0x5d')},'json':!![]};return rp(_0x131be9)[_0x4a6f('0x25')](function(_0x172708){if(_0x172708[_0x4a6f('0x5e')]){_0x90272f(_0x172708[_0x4a6f('0x5e')]);}else{_0x4857a0(_0x4a6f('0x5f'));}})[_0x4a6f('0x40')](function(_0xdabd5a){_0x4857a0(_0xdabd5a);});});}exports[_0x4a6f('0x60')]=function(_0x4e02b8,_0x21e244,_0x3913de){var _0xcb4a8b,_0xe0170c,_0x5bb8f5,_0x7ee0b9,_0x326c1e;return db[_0x4a6f('0x2a')][_0x4a6f('0x4c')]({'where':{'id':_0x4e02b8[_0x4a6f('0x42')]['id']},'attributes':['id','host','zone','clientId',_0x4a6f('0x5c'),_0x4a6f('0x61'),_0x4a6f('0x62'),_0x4a6f('0x5a')]})['then'](handleEntityNotFound(_0x21e244,null))[_0x4a6f('0x25')](function(_0xa1ecca){_0x326c1e=_0xa1ecca;_0xcb4a8b=_0x326c1e['host'];_0xe0170c=_0xcb4a8b===_0x4a6f('0x63')?'eu':_0x4a6f('0x64');_0x5bb8f5=_0x326c1e[_0x4a6f('0x61')];var _0x3f4089=_0x5bb8f5[_0x4a6f('0x65')](-0x1);if(_0x3f4089==='/'||_0x3f4089==='\x5c'||_0x3f4089===':'){_0x5bb8f5=_0x5bb8f5[_0x4a6f('0x66')](0x0,_0x5bb8f5['lastIndexOf'](_0x3f4089));}if(!_0x326c1e[_0x4a6f('0x5a')]){throw new Error(_0x4a6f('0x67'));}return getAccessToken(_0x326c1e);})[_0x4a6f('0x25')](function(_0x3e7db5){if(_0x3e7db5){return rp({'method':_0x4a6f('0x68'),'uri':util['format'](_0x4a6f('0x69'),_0xe0170c),'qs':{'module':_0x4a6f('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e7db5},'json':!![]});}})[_0x4a6f('0x25')](function(_0x45c1c0){if(_0x45c1c0){if(_0x45c1c0[_0x4a6f('0x6b')]&&_0x45c1c0['response'][_0x4a6f('0x6c')]){throw new Error(_0x45c1c0['response'][_0x4a6f('0x6c')][_0x4a6f('0x6d')]);}var _0x267119=[];var _0x581a8d=[];var _0x3ac295=[_0x4a6f('0x6e'),_0x4a6f('0x6f'),_0x4a6f('0x70'),_0x4a6f('0x71'),_0x4a6f('0x72'),_0x4a6f('0x73'),_0x4a6f('0x74'),_0x4a6f('0x75')];_0x581a8d=_[_0x4a6f('0x76')](_0x45c1c0[_0x4a6f('0x32')],function(_0xdc82a7){return _0x3ac295[_0x4a6f('0x77')](_0xdc82a7[_0x4a6f('0x78')]);});for(var _0x2b25c1=0x0;_0x2b25c1<_0x581a8d[_0x4a6f('0x33')];_0x2b25c1++){if(_0x581a8d[_0x2b25c1][_0x4a6f('0x79')]===![]){_0x267119[_0x4a6f('0x7a')]({'id':_0x581a8d[_0x2b25c1]['id'],'name':_0x581a8d[_0x2b25c1]['display_label'],'custom':_0x581a8d[_0x2b25c1][_0x4a6f('0x7b')],'options':_0x581a8d[_0x2b25c1]['data_type']===_0x4a6f('0x7c')&&_0x581a8d[_0x2b25c1][_0x4a6f('0x7d')][_0x4a6f('0x33')]>-0x1?_['map'](_0x581a8d[_0x2b25c1]['pick_list_values'],function(_0x4eff07){return{'name':_0x4eff07,'value':_0x4eff07};}):[]});}}return{'count':_0x267119[_0x4a6f('0x33')],'rows':_0x267119};}else{return{'count':0x0,'rows':[]};}})[_0x4a6f('0x25')](respondWithResult(_0x21e244,null))[_0x4a6f('0x40')](function(_0x38e5bc){var _0x961de5=_0x4e02b8[_0x4a6f('0x2d')][_0x4a6f('0x7e')]?0x1f4:_0x38e5bc[_0x4a6f('0x7f')]||0x1f4;logger[_0x4a6f('0x6c')](_0x4a6f('0x80'),_0x4a6f('0x60'),_0x961de5,JSON[_0x4a6f('0x81')](_0x38e5bc));delete _0x38e5bc['name'];if(_0x961de5===0x191){_0x961de5=0x190;}_0x21e244[_0x4a6f('0x1a')](_0x961de5)[_0x4a6f('0x28')](_0x4e02b8['query'][_0x4a6f('0x7e')]?{'message':_0x4a6f('0x82'),'statusCode':_0x38e5bc[_0x4a6f('0x7f')]}:_0x38e5bc);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e539f3a..f1b7f23 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 _0x5edc=['define','changed','serverUrl','clientId','clientSecret','host','slice','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','substring','lastIndexOf','authorization_code','parse','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5edc,0x1e6));var _0xc5ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5edc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc5ed('0x0'));var util=require(_0xc5ed('0x1'));var logger=require(_0xc5ed('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc5ed('0x3'));var rp=require(_0xc5ed('0x4'));var fs=require('fs');var path=require(_0xc5ed('0x5'));var rimraf=require(_0xc5ed('0x6'));var config=require('../../config/environment');var attributes=require(_0xc5ed('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x13818b,_0x24f7b4){return _0x13818b[_0xc5ed('0x8')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e95e8,_0x5bb72f,_0x5108e8){if(_0x3e95e8[_0xc5ed('0x9')]('zone')||_0x3e95e8[_0xc5ed('0x9')](_0xc5ed('0xa'))||_0x3e95e8[_0xc5ed('0x9')](_0xc5ed('0xb'))||_0x3e95e8[_0xc5ed('0x9')](_0xc5ed('0xc'))||_0x3e95e8['changed']('code')||_0x3e95e8[_0xc5ed('0x9')](_0xc5ed('0xd'))){var _0x2aed78,_0xdcbf6e;_0x2aed78=_0x3e95e8[_0xc5ed('0xa')];var _0x3985e6=_0x2aed78[_0xc5ed('0xe')](-0x1);if(_0x3985e6==='/'||_0x3985e6==='\x5c'||_0x3985e6===':'){_0x2aed78=_0x2aed78['substring'](0x0,_0x2aed78['lastIndexOf'](_0x3985e6));}switch(_0x3e95e8[_0xc5ed('0xf')]){case'US':_0xdcbf6e=_0xc5ed('0x10');break;case'AU':_0xdcbf6e=_0xc5ed('0x11');break;case'IN':_0xdcbf6e=_0xc5ed('0x12');break;case'CN':_0xdcbf6e=_0xc5ed('0x13');break;default:_0xdcbf6e=_0xc5ed('0x14');break;}var _0x4dc6fa={'method':'POST','uri':_0xdcbf6e+_0xc5ed('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x3e95e8[_0xc5ed('0xb')],'client_secret':_0x3e95e8[_0xc5ed('0xc')],'redirect_uri':_0x3e95e8[_0xc5ed('0xa')],'code':_0x3e95e8[_0xc5ed('0x16')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4dc6fa)[_0xc5ed('0x17')](function(_0x1441dc){var _0x18ceba=JSON['parse'](_0x1441dc);if(_0x18ceba[_0xc5ed('0x18')]){_0x3e95e8[_0xc5ed('0x19')]=_0x18ceba[_0xc5ed('0x18')];logger[_0xc5ed('0x1a')](util[_0xc5ed('0x1b')](_0xc5ed('0x1c'),_0x3e95e8['name'],_0x3e95e8['id']));}else{logger[_0xc5ed('0x1d')](util[_0xc5ed('0x1b')](_0xc5ed('0x1e'),_0x3e95e8[_0xc5ed('0x1f')],_0x3e95e8['id']),util[_0xc5ed('0x20')](_0x18ceba,{'showHidden':![],'depth':null}));}return _0x5108e8(null,_0x5bb72f);})[_0xc5ed('0x21')](function(_0x1ca779){logger[_0xc5ed('0x1d')](util[_0xc5ed('0x1b')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e95e8[_0xc5ed('0x1f')],_0x3e95e8['id']),util[_0xc5ed('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x5108e8(_0x1ca779);});}else{return _0x5108e8(null,_0x5bb72f);}},'beforeUpdate':function(_0x3bd181,_0x3b25b3,_0x28ab8b){if(_0x3bd181[_0xc5ed('0x9')](_0xc5ed('0xf'))||_0x3bd181[_0xc5ed('0x9')](_0xc5ed('0xa'))||_0x3bd181[_0xc5ed('0x9')](_0xc5ed('0xb'))||_0x3bd181[_0xc5ed('0x9')](_0xc5ed('0xc'))||_0x3bd181[_0xc5ed('0x9')](_0xc5ed('0x16'))||_0x3bd181['changed']('host')){var _0x48b074,_0x3d56e4;_0x48b074=_0x3bd181[_0xc5ed('0xa')];var _0x297e8b=_0x48b074[_0xc5ed('0xe')](-0x1);if(_0x297e8b==='/'||_0x297e8b==='\x5c'||_0x297e8b===':'){_0x48b074=_0x48b074[_0xc5ed('0x22')](0x0,_0x48b074[_0xc5ed('0x23')](_0x297e8b));}switch(_0x3bd181[_0xc5ed('0xf')]){case'US':_0x3d56e4=_0xc5ed('0x10');break;case'AU':_0x3d56e4=_0xc5ed('0x11');break;case'IN':_0x3d56e4='https://accounts.zoho.in';break;case'CN':_0x3d56e4=_0xc5ed('0x13');break;default:_0x3d56e4=_0xc5ed('0x14');break;}var _0x139a62={'method':'POST','uri':_0x3d56e4+_0xc5ed('0x15'),'form':{'grant_type':_0xc5ed('0x24'),'client_id':_0x3bd181['clientId'],'client_secret':_0x3bd181[_0xc5ed('0xc')],'redirect_uri':_0x3bd181[_0xc5ed('0xa')],'code':_0x3bd181['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x139a62)[_0xc5ed('0x17')](function(_0x3343b1){var _0x475b0d=JSON[_0xc5ed('0x25')](_0x3343b1);if(_0x475b0d[_0xc5ed('0x18')]){_0x3bd181[_0xc5ed('0x19')]=_0x475b0d[_0xc5ed('0x18')];logger['info'](util['format'](_0xc5ed('0x1c'),_0x3bd181[_0xc5ed('0x1f')],_0x3bd181['id']));}else{logger[_0xc5ed('0x1d')](util[_0xc5ed('0x1b')](_0xc5ed('0x1e'),_0x3bd181[_0xc5ed('0x1f')],_0x3bd181['id']),util['inspect'](_0x475b0d,{'showHidden':![],'depth':null}));}return _0x28ab8b(null,_0x3b25b3);})[_0xc5ed('0x21')](function(_0x6dc485){logger['error'](util[_0xc5ed('0x1b')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3bd181[_0xc5ed('0x1f')],_0x3bd181['id']),util[_0xc5ed('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x28ab8b(_0x6dc485);});}else{return _0x28ab8b(null,_0x3b25b3);}}}});}; \ No newline at end of file +var _0x8237=['clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','substring','application/x-www-form-urlencoded','parse','catch','lodash','api','moment','request-promise','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId'];(function(_0x301496,_0x5423e6){var _0x3ce6e2=function(_0x51030f){while(--_0x51030f){_0x301496['push'](_0x301496['shift']());}};_0x3ce6e2(++_0x5423e6);}(_0x8237,0x117));var _0x7823=function(_0x5f2575,_0x2e2c1a){_0x5f2575=_0x5f2575-0x0;var _0x18b7a8=_0x8237[_0x5f2575];return _0x18b7a8;};'use strict';var _=require(_0x7823('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7823('0x1'));var moment=require(_0x7823('0x2'));var BPromise=require('bluebird');var rp=require(_0x7823('0x3'));var fs=require('fs');var path=require(_0x7823('0x4'));var rimraf=require(_0x7823('0x5'));var config=require('../../config/environment');var attributes=require(_0x7823('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7823('0x7')]=function(_0xf89f5,_0x54f215){return _0xf89f5[_0x7823('0x8')](_0x7823('0x9'),attributes,{'tableName':_0x7823('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x452158,_0x28f2b3,_0x47bcf6){if(_0x452158['changed'](_0x7823('0xb'))||_0x452158[_0x7823('0xc')](_0x7823('0xd'))||_0x452158[_0x7823('0xc')](_0x7823('0xe'))||_0x452158['changed'](_0x7823('0xf'))||_0x452158['changed'](_0x7823('0x10'))||_0x452158['changed']('host')){var _0x177bf9,_0x5c732b;_0x177bf9=_0x452158[_0x7823('0xd')];var _0x45e99a=_0x177bf9[_0x7823('0x11')](-0x1);if(_0x45e99a==='/'||_0x45e99a==='\x5c'||_0x45e99a===':'){_0x177bf9=_0x177bf9['substring'](0x0,_0x177bf9[_0x7823('0x12')](_0x45e99a));}switch(_0x452158[_0x7823('0xb')]){case'US':_0x5c732b=_0x7823('0x13');break;case'AU':_0x5c732b=_0x7823('0x14');break;case'IN':_0x5c732b=_0x7823('0x15');break;case'CN':_0x5c732b=_0x7823('0x16');break;default:_0x5c732b=_0x7823('0x17');break;}var _0x480b15={'method':_0x7823('0x18'),'uri':_0x5c732b+_0x7823('0x19'),'form':{'grant_type':_0x7823('0x1a'),'client_id':_0x452158['clientId'],'client_secret':_0x452158[_0x7823('0xf')],'redirect_uri':_0x452158[_0x7823('0xd')],'code':_0x452158[_0x7823('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x480b15)[_0x7823('0x1b')](function(_0x56caae){var _0x1442d1=JSON['parse'](_0x56caae);if(_0x1442d1[_0x7823('0x1c')]){_0x452158[_0x7823('0x1d')]=_0x1442d1[_0x7823('0x1c')];logger[_0x7823('0x1e')](util[_0x7823('0x1f')](_0x7823('0x20'),_0x452158[_0x7823('0x21')],_0x452158['id']));}else{logger[_0x7823('0x22')](util[_0x7823('0x1f')](_0x7823('0x23'),_0x452158['name'],_0x452158['id']),util[_0x7823('0x24')](_0x1442d1,{'showHidden':![],'depth':null}));}return _0x47bcf6(null,_0x28f2b3);})['catch'](function(_0x29bc41){logger['error'](util[_0x7823('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x452158[_0x7823('0x21')],_0x452158['id']),util[_0x7823('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x47bcf6(_0x29bc41);});}else{return _0x47bcf6(null,_0x28f2b3);}},'beforeUpdate':function(_0x1765f8,_0x9b742d,_0x3beae9){if(_0x1765f8[_0x7823('0xc')](_0x7823('0xb'))||_0x1765f8[_0x7823('0xc')]('serverUrl')||_0x1765f8[_0x7823('0xc')](_0x7823('0xe'))||_0x1765f8[_0x7823('0xc')](_0x7823('0xf'))||_0x1765f8[_0x7823('0xc')](_0x7823('0x10'))||_0x1765f8[_0x7823('0xc')](_0x7823('0x25'))){var _0x51f2be,_0x40dda5;_0x51f2be=_0x1765f8[_0x7823('0xd')];var _0xa3df46=_0x51f2be[_0x7823('0x11')](-0x1);if(_0xa3df46==='/'||_0xa3df46==='\x5c'||_0xa3df46===':'){_0x51f2be=_0x51f2be[_0x7823('0x26')](0x0,_0x51f2be['lastIndexOf'](_0xa3df46));}switch(_0x1765f8[_0x7823('0xb')]){case'US':_0x40dda5=_0x7823('0x13');break;case'AU':_0x40dda5=_0x7823('0x14');break;case'IN':_0x40dda5=_0x7823('0x15');break;case'CN':_0x40dda5=_0x7823('0x16');break;default:_0x40dda5=_0x7823('0x17');break;}var _0x29ba4e={'method':_0x7823('0x18'),'uri':_0x40dda5+_0x7823('0x19'),'form':{'grant_type':_0x7823('0x1a'),'client_id':_0x1765f8['clientId'],'client_secret':_0x1765f8[_0x7823('0xf')],'redirect_uri':_0x1765f8[_0x7823('0xd')],'code':_0x1765f8[_0x7823('0x10')]},'headers':{'Content-Type':_0x7823('0x27')}};return rp(_0x29ba4e)[_0x7823('0x1b')](function(_0x338c56){var _0x307c06=JSON[_0x7823('0x28')](_0x338c56);if(_0x307c06[_0x7823('0x1c')]){_0x1765f8[_0x7823('0x1d')]=_0x307c06['refresh_token'];logger['info'](util[_0x7823('0x1f')](_0x7823('0x20'),_0x1765f8['name'],_0x1765f8['id']));}else{logger[_0x7823('0x22')](util[_0x7823('0x1f')](_0x7823('0x23'),_0x1765f8['name'],_0x1765f8['id']),util[_0x7823('0x24')](_0x307c06,{'showHidden':![],'depth':null}));}return _0x3beae9(null,_0x9b742d);})[_0x7823('0x29')](function(_0xaccbd2){logger[_0x7823('0x22')](util['format'](_0x7823('0x23'),_0x1765f8['name'],_0x1765f8['id']),util[_0x7823('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3beae9(_0xaccbd2);});}else{return _0x3beae9(null,_0x9b742d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index d22f84a..8e47ac7 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 _0xbbdd=['then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetZohoAccount','options','raw','attributes','limit','include','model','map','ShowZohoAccount','ZohoAccount','find','where','util','bluebird','randomstring','../../config/logger','jayson/promise','client','http','request'];(function(_0x263dc3,_0x2ecdc3){var _0x36c2f8=function(_0x2ce25c){while(--_0x2ce25c){_0x263dc3['push'](_0x263dc3['shift']());}};_0x36c2f8(++_0x2ecdc3);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xbbdd[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var moment=require('moment');var BPromise=require(_0xdbbd('0x1'));var rs=require(_0xdbbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbbd('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdbbd('0x4'));var client=jayson[_0xdbbd('0x5')][_0xdbbd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44beae,_0x59b866,_0x42ee02){return new BPromise(function(_0x41e7fe,_0xf5be47){return client[_0xdbbd('0x7')](_0x44beae,_0x42ee02)[_0xdbbd('0x8')](function(_0x38198c){logger[_0xdbbd('0x9')](_0xdbbd('0xa'),_0x59b866,_0xdbbd('0xb'));logger[_0xdbbd('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x59b866,_0xdbbd('0xb'),JSON[_0xdbbd('0xd')](_0x38198c));if(_0x38198c['error']){if(_0x38198c['error']['code']===0x1f4){logger['error'](_0xdbbd('0xa'),_0x59b866,_0x38198c[_0xdbbd('0xe')][_0xdbbd('0xf')]);return _0xf5be47(_0x38198c[_0xdbbd('0xe')][_0xdbbd('0xf')]);}logger[_0xdbbd('0xe')](_0xdbbd('0xa'),_0x59b866,_0x38198c['error'][_0xdbbd('0xf')]);return _0x41e7fe(_0x38198c[_0xdbbd('0xe')]['message']);}else{logger[_0xdbbd('0x9')](_0xdbbd('0xa'),_0x59b866,_0xdbbd('0xb'));_0x41e7fe(_0x38198c[_0xdbbd('0x10')]['message']);}})[_0xdbbd('0x11')](function(_0x4e2c35){logger['error'](_0xdbbd('0xa'),_0x59b866,_0x4e2c35);_0xf5be47(_0x4e2c35);});});}exports[_0xdbbd('0x12')]=function(_0x26eb4c){var _0x315b2d=this;return new Promise(function(_0x322ffc,_0x536a69){return db['ZohoAccount']['findAll']({'raw':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x14')]===undefined?!![]:![]:!![],'where':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')]['where']||null:null,'attributes':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x15')]||null:null,'limit':_0x26eb4c[_0xdbbd('0x13')]?_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x16')]||null:null,'include':_0x26eb4c['options']?_0x26eb4c['options'][_0xdbbd('0x17')]?_['map'](_0x26eb4c[_0xdbbd('0x13')][_0xdbbd('0x17')],function(_0x14eccf){return{'model':db[_0x14eccf[_0xdbbd('0x18')]],'as':_0x14eccf['as'],'attributes':_0x14eccf['attributes'],'include':_0x14eccf[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x14eccf[_0xdbbd('0x17')],function(_0x5f3f4d){return{'model':db[_0x5f3f4d[_0xdbbd('0x18')]],'as':_0x5f3f4d['as'],'attributes':_0x5f3f4d[_0xdbbd('0x15')],'include':_0x5f3f4d[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x5f3f4d[_0xdbbd('0x17')],function(_0x423ce6){return{'model':db[_0x423ce6['model']],'as':_0x423ce6['as'],'attributes':_0x423ce6[_0xdbbd('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdbbd('0x8')](function(_0xb11f5d){logger[_0xdbbd('0x9')](_0xdbbd('0x12'),_0x26eb4c);logger[_0xdbbd('0xc')](_0xdbbd('0x12'),_0x26eb4c,JSON['stringify'](_0xb11f5d));_0x322ffc(_0xb11f5d);})[_0xdbbd('0x11')](function(_0x52e61f){logger[_0xdbbd('0xe')]('GetZohoAccount',_0x52e61f[_0xdbbd('0xf')],_0x26eb4c);_0x536a69(_0x315b2d[_0xdbbd('0xe')](0x1f4,_0x52e61f['message']));});});};exports[_0xdbbd('0x1a')]=function(_0x2ce1eb){var _0x107c08=this;return new Promise(function(_0x369540,_0x40df71){return db[_0xdbbd('0x1b')][_0xdbbd('0x1c')]({'raw':_0x2ce1eb[_0xdbbd('0x13')]?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x14')]===undefined?!![]:![]:!![],'where':_0x2ce1eb['options']?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x1d')]||null:null,'attributes':_0x2ce1eb[_0xdbbd('0x13')]?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x15')]||null:null,'include':_0x2ce1eb['options']?_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x2ce1eb[_0xdbbd('0x13')][_0xdbbd('0x17')],function(_0x5460e7){return{'model':db[_0x5460e7[_0xdbbd('0x18')]],'as':_0x5460e7['as'],'attributes':_0x5460e7[_0xdbbd('0x15')],'include':_0x5460e7[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x5460e7[_0xdbbd('0x17')],function(_0x57aa55){return{'model':db[_0x57aa55[_0xdbbd('0x18')]],'as':_0x57aa55['as'],'attributes':_0x57aa55['attributes'],'include':_0x57aa55[_0xdbbd('0x17')]?_[_0xdbbd('0x19')](_0x57aa55['include'],function(_0x43f0f4){return{'model':db[_0x43f0f4[_0xdbbd('0x18')]],'as':_0x43f0f4['as'],'attributes':_0x43f0f4[_0xdbbd('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdbbd('0x8')](function(_0x4b8c08){logger['info'](_0xdbbd('0x1a'),_0x2ce1eb);logger[_0xdbbd('0xc')](_0xdbbd('0x1a'),_0x2ce1eb,JSON[_0xdbbd('0xd')](_0x4b8c08));_0x369540(_0x4b8c08);})[_0xdbbd('0x11')](function(_0x40e247){logger['error']('ShowZohoAccount',_0x40e247[_0xdbbd('0xf')],_0x2ce1eb);_0x40df71(_0x107c08[_0xdbbd('0xe')](0x1f4,_0x40e247['message']));});});}; \ No newline at end of file +var _0x86dc=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','limit','include','map','attributes','model','then','ShowZohoAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86dc,0x13e));var _0xc86d=function(_0x1cf955,_0x21a000){_0x1cf955=_0x1cf955-0x0;var _0x79141a=_0x86dc[_0x1cf955];return _0x79141a;};'use strict';var _=require(_0xc86d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc86d('0x1'));var rs=require(_0xc86d('0x2'));var fs=require('fs');var Redis=require(_0xc86d('0x3'));var db=require(_0xc86d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc86d('0x5'))('rpc');var config=require(_0xc86d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc86d('0x7')][_0xc86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21114c,_0x56ac0e,_0x17a2b6){return new BPromise(function(_0x59c9a9,_0x20ae2c){return client[_0xc86d('0x9')](_0x21114c,_0x17a2b6)['then'](function(_0x5078d8){logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');logger[_0xc86d('0xc')](_0xc86d('0xd'),_0x56ac0e,_0xc86d('0xe'),JSON[_0xc86d('0xf')](_0x5078d8));if(_0x5078d8[_0xc86d('0x10')]){if(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x11')]===0x1f4){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x20ae2c(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x59c9a9(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}else{logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');_0x59c9a9(_0x5078d8['result']['message']);}})[_0xc86d('0x13')](function(_0x376a90){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x376a90);_0x20ae2c(_0x376a90);});});}exports[_0xc86d('0x14')]=function(_0x3d7e72){var _0x279406=this;return new Promise(function(_0x5f3ece,_0x4d5b38){return db[_0xc86d('0x15')][_0xc86d('0x16')]({'raw':_0x3d7e72[_0xc86d('0x17')]?_0x3d7e72['options'][_0xc86d('0x18')]===undefined?!![]:![]:!![],'where':_0x3d7e72[_0xc86d('0x17')]?_0x3d7e72[_0xc86d('0x17')]['where']||null:null,'attributes':_0x3d7e72[_0xc86d('0x17')]?_0x3d7e72[_0xc86d('0x17')]['attributes']||null:null,'limit':_0x3d7e72[_0xc86d('0x17')]?_0x3d7e72[_0xc86d('0x17')][_0xc86d('0x19')]||null:null,'include':_0x3d7e72[_0xc86d('0x17')]?_0x3d7e72['options'][_0xc86d('0x1a')]?_[_0xc86d('0x1b')](_0x3d7e72[_0xc86d('0x17')][_0xc86d('0x1a')],function(_0xbeed40){return{'model':db[_0xbeed40['model']],'as':_0xbeed40['as'],'attributes':_0xbeed40[_0xc86d('0x1c')],'include':_0xbeed40[_0xc86d('0x1a')]?_[_0xc86d('0x1b')](_0xbeed40[_0xc86d('0x1a')],function(_0x27d636){return{'model':db[_0x27d636['model']],'as':_0x27d636['as'],'attributes':_0x27d636[_0xc86d('0x1c')],'include':_0x27d636['include']?_['map'](_0x27d636['include'],function(_0x2782b8){return{'model':db[_0x2782b8[_0xc86d('0x1d')]],'as':_0x2782b8['as'],'attributes':_0x2782b8[_0xc86d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc86d('0x1e')](function(_0xd8b255){logger[_0xc86d('0xa')](_0xc86d('0x14'),_0x3d7e72);logger[_0xc86d('0xc')]('GetZohoAccount',_0x3d7e72,JSON[_0xc86d('0xf')](_0xd8b255));_0x5f3ece(_0xd8b255);})[_0xc86d('0x13')](function(_0x581a9e){logger['error'](_0xc86d('0x14'),_0x581a9e[_0xc86d('0x12')],_0x3d7e72);_0x4d5b38(_0x279406[_0xc86d('0x10')](0x1f4,_0x581a9e[_0xc86d('0x12')]));});});};exports[_0xc86d('0x1f')]=function(_0x217415){var _0x27e478=this;return new Promise(function(_0x5a4ef1,_0x5bda1c){return db[_0xc86d('0x15')][_0xc86d('0x20')]({'raw':_0x217415[_0xc86d('0x17')]?_0x217415[_0xc86d('0x17')][_0xc86d('0x18')]===undefined?!![]:![]:!![],'where':_0x217415['options']?_0x217415[_0xc86d('0x17')]['where']||null:null,'attributes':_0x217415[_0xc86d('0x17')]?_0x217415[_0xc86d('0x17')][_0xc86d('0x1c')]||null:null,'include':_0x217415[_0xc86d('0x17')]?_0x217415[_0xc86d('0x17')][_0xc86d('0x1a')]?_[_0xc86d('0x1b')](_0x217415[_0xc86d('0x17')][_0xc86d('0x1a')],function(_0x4e51bd){return{'model':db[_0x4e51bd['model']],'as':_0x4e51bd['as'],'attributes':_0x4e51bd['attributes'],'include':_0x4e51bd['include']?_['map'](_0x4e51bd['include'],function(_0x412dd7){return{'model':db[_0x412dd7[_0xc86d('0x1d')]],'as':_0x412dd7['as'],'attributes':_0x412dd7[_0xc86d('0x1c')],'include':_0x412dd7[_0xc86d('0x1a')]?_[_0xc86d('0x1b')](_0x412dd7[_0xc86d('0x1a')],function(_0x51924c){return{'model':db[_0x51924c[_0xc86d('0x1d')]],'as':_0x51924c['as'],'attributes':_0x51924c[_0xc86d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc86d('0x1e')](function(_0xa7bbec){logger[_0xc86d('0xa')](_0xc86d('0x1f'),_0x217415);logger[_0xc86d('0xc')](_0xc86d('0x1f'),_0x217415,JSON[_0xc86d('0xf')](_0xa7bbec));_0x5a4ef1(_0xa7bbec);})[_0xc86d('0x13')](function(_0x5e4b08){logger[_0xc86d('0x10')]('ShowZohoAccount',_0x5e4b08[_0xc86d('0x12')],_0x217415);_0x5bda1c(_0x27e478[_0xc86d('0x10')](0x1f4,_0x5e4b08[_0xc86d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 63b3e18..9c771d2 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 _0x7ded=['isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x17193e,_0x41d6b5){var _0x38ad34=function(_0x2f88e8){while(--_0x2f88e8){_0x17193e['push'](_0x17193e['shift']());}};_0x38ad34(++_0x41d6b5);}(_0x7ded,0x1bd));var _0xd7de=function(_0x24657f,_0x1fdc1e){_0x24657f=_0x24657f-0x0;var _0x5394d2=_0x7ded[_0x24657f];return _0x5394d2;};'use strict';var multer=require('multer');var util=require(_0xd7de('0x0'));var path=require(_0xd7de('0x1'));var timeout=require(_0xd7de('0x2'));var express=require(_0xd7de('0x3'));var router=express[_0xd7de('0x4')]();var fs_extra=require(_0xd7de('0x5'));var auth=require(_0xd7de('0x6'));var interaction=require(_0xd7de('0x7'));var config=require(_0xd7de('0x8'));var controller=require(_0xd7de('0x9'));router[_0xd7de('0xa')]('/',auth[_0xd7de('0xb')](),controller[_0xd7de('0xc')]);router[_0xd7de('0xa')]('/:id',auth[_0xd7de('0xb')](),controller['show']);router[_0xd7de('0xa')](_0xd7de('0xd'),auth[_0xd7de('0xb')](),controller[_0xd7de('0xe')]);router[_0xd7de('0xa')](_0xd7de('0xf'),auth[_0xd7de('0xb')](),controller[_0xd7de('0x10')]);router[_0xd7de('0xa')]('/:id/descriptions',auth[_0xd7de('0xb')](),controller[_0xd7de('0x11')]);router[_0xd7de('0x12')]('/',auth[_0xd7de('0xb')](),controller['create']);router[_0xd7de('0x13')](_0xd7de('0x14'),auth['isAuthenticated'](),controller[_0xd7de('0x15')]);router[_0xd7de('0x16')](_0xd7de('0x14'),auth[_0xd7de('0xb')](),controller['destroy']);module[_0xd7de('0x17')]=router; \ No newline at end of file +var _0xd615=['update','delete','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x5d9295,_0x5f5bc6){var _0x4f2534=function(_0x5560c8){while(--_0x5560c8){_0x5d9295['push'](_0x5d9295['shift']());}};_0x4f2534(++_0x5f5bc6);}(_0xd615,0x1e6));var _0x5d61=function(_0x35fea1,_0x4d7e45){_0x35fea1=_0x35fea1-0x0;var _0x1774ec=_0xd615[_0x35fea1];return _0x1774ec;};'use strict';var multer=require('multer');var util=require(_0x5d61('0x0'));var path=require(_0x5d61('0x1'));var timeout=require(_0x5d61('0x2'));var express=require(_0x5d61('0x3'));var router=express['Router']();var fs_extra=require(_0x5d61('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5d61('0x5'));var controller=require(_0x5d61('0x6'));router[_0x5d61('0x7')]('/',auth['isAuthenticated'](),controller[_0x5d61('0x8')]);router[_0x5d61('0x7')](_0x5d61('0x9'),auth[_0x5d61('0xa')](),controller[_0x5d61('0xb')]);router[_0x5d61('0x7')](_0x5d61('0xc'),auth[_0x5d61('0xa')](),controller['getFields']);router['get'](_0x5d61('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x5d61('0x7')](_0x5d61('0xe'),auth[_0x5d61('0xa')](),controller[_0x5d61('0xf')]);router[_0x5d61('0x10')]('/',auth[_0x5d61('0xa')](),controller['create']);router[_0x5d61('0x11')](_0x5d61('0x9'),auth[_0x5d61('0xa')](),controller[_0x5d61('0x12')]);router[_0x5d61('0x13')](_0x5d61('0x9'),auth[_0x5d61('0xa')](),controller['destroy']);module[_0x5d61('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e4cc0d3..b2bfc50 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 _0x18a8=['contact','contact_lead','sequelize','STRING','ENUM','lead','nothing'];(function(_0x2a4424,_0x24ea22){var _0x2d9fc5=function(_0x5be392){while(--_0x5be392){_0x2a4424['push'](_0x2a4424['shift']());}};_0x2d9fc5(++_0x24ea22);}(_0x18a8,0x160));var _0x818a=function(_0x1b860d,_0x45844f){_0x1b860d=_0x1b860d-0x0;var _0x254fd4=_0x18a8[_0x1b860d];return _0x254fd4;};'use strict';var Sequelize=require(_0x818a('0x0'));module['exports']={'name':{'type':Sequelize[_0x818a('0x1')]},'moduleCreate':{'type':Sequelize[_0x818a('0x2')](_0x818a('0x3'),'contact',_0x818a('0x4')),'defaultValue':_0x818a('0x3')},'moduleSearch':{'type':Sequelize[_0x818a('0x2')]('contact_lead',_0x818a('0x5'),_0x818a('0x3')),'defaultValue':_0x818a('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a52=['sequelize','exports','ENUM','lead','contact','contact_lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a52,0xe4));var _0x20a5=function(_0x1a26a9,_0xfe51d7){_0x1a26a9=_0x1a26a9-0x0;var _0x2b82fb=_0x0a52[_0x1a26a9];return _0x2b82fb;};'use strict';var Sequelize=require(_0x20a5('0x0'));module[_0x20a5('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x20a5('0x2')](_0x20a5('0x3'),_0x20a5('0x4'),'nothing'),'defaultValue':_0x20a5('0x3')},'moduleSearch':{'type':Sequelize[_0x20a5('0x2')](_0x20a5('0x5'),_0x20a5('0x4'),_0x20a5('0x3')),'defaultValue':_0x20a5('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index eaee14a..d0acacf 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 _0x74d9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoConfiguration','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x3a90b6,_0x782086){var _0x56f71a=function(_0x14ff5e){while(--_0x14ff5e){_0x3a90b6['push'](_0x3a90b6['shift']());}};_0x56f71a(++_0x782086);}(_0x74d9,0x13b));var _0x974d=function(_0x389c4c,_0x5d7477){_0x389c4c=_0x389c4c-0x0;var _0x5bbdd3=_0x74d9[_0x389c4c];return _0x5bbdd3;};'use strict';var emlformat=require(_0x974d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x974d('0x1'));var jsonpatch=require(_0x974d('0x2'));var rp=require(_0x974d('0x3'));var moment=require('moment');var BPromise=require(_0x974d('0x4'));var Mustache=require('mustache');var util=require(_0x974d('0x5'));var path=require(_0x974d('0x6'));var sox=require(_0x974d('0x7'));var csv=require(_0x974d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x974d('0x9'));var squel=require(_0x974d('0xa'));var crypto=require(_0x974d('0xb'));var jsforce=require(_0x974d('0xc'));var deskjs=require(_0x974d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x974d('0xe'));var Papa=require(_0x974d('0xf'));var Redis=require(_0x974d('0x10'));var authService=require(_0x974d('0x11'));var qs=require(_0x974d('0x12'));var as=require(_0x974d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x974d('0x14'))(_0x974d('0x15'));var utils=require(_0x974d('0x16'));var config=require(_0x974d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x974d('0x18'))['db'];function respondWithStatusCode(_0xdd22cf,_0x21ce2e){_0x21ce2e=_0x21ce2e||0xcc;return function(_0x2b1430){if(_0x2b1430){return _0xdd22cf[_0x974d('0x19')](_0x21ce2e);}return _0xdd22cf[_0x974d('0x1a')](_0x21ce2e)[_0x974d('0x1b')]();};}function respondWithResult(_0x3deee1,_0x350c00){_0x350c00=_0x350c00||0xc8;return function(_0x59b069){if(_0x59b069){return _0x3deee1[_0x974d('0x1a')](_0x350c00)[_0x974d('0x1c')](_0x59b069);}};}function respondWithFilteredResult(_0x4ddd6a,_0x184aac){return function(_0x4f192b){if(_0x4f192b){var _0x246122=typeof _0x184aac['offset']===_0x974d('0x1d')&&typeof _0x184aac[_0x974d('0x1e')]===_0x974d('0x1d');var _0x1c03c7=_0x4f192b[_0x974d('0x1f')];var _0x29306a=_0x246122?0x0:_0x184aac[_0x974d('0x20')];var _0x36e9c3=_0x246122?_0x4f192b[_0x974d('0x1f')]:_0x184aac[_0x974d('0x20')]+_0x184aac[_0x974d('0x1e')];var _0x129939;if(_0x36e9c3>=_0x1c03c7){_0x36e9c3=_0x1c03c7;_0x129939=0xc8;}else{_0x129939=0xce;}_0x4ddd6a['status'](_0x129939);return _0x4ddd6a[_0x974d('0x21')](_0x974d('0x22'),_0x29306a+'-'+_0x36e9c3+'/'+_0x1c03c7)[_0x974d('0x1c')](_0x4f192b);}return null;};}function patchUpdates(_0x3bfce0){return function(_0xbbff54){try{jsonpatch[_0x974d('0x23')](_0xbbff54,_0x3bfce0,!![]);}catch(_0x101f86){return BPromise[_0x974d('0x24')](_0x101f86);}return _0xbbff54[_0x974d('0x25')]();};}function saveUpdates(_0x6c50e9,_0x1d9a4c){return function(_0x2db4af){if(_0x2db4af){return _0x2db4af[_0x974d('0x26')](_0x6c50e9)[_0x974d('0x27')](function(_0x2156f8){return _0x2156f8;});}return null;};}function removeEntity(_0x36b4be,_0x583117){return function(_0x5b9024){if(_0x5b9024){return _0x5b9024[_0x974d('0x28')]()['then'](function(){_0x36b4be[_0x974d('0x1a')](0xcc)[_0x974d('0x1b')]();});}};}function handleEntityNotFound(_0x502215,_0x5ae75c){return function(_0x327a8f){if(!_0x327a8f){_0x502215[_0x974d('0x19')](0x194);}return _0x327a8f;};}function handleError(_0x359433,_0x357379){_0x357379=_0x357379||0x1f4;return function(_0xeb1e45){logger[_0x974d('0x29')](_0xeb1e45[_0x974d('0x2a')]);if(_0xeb1e45[_0x974d('0x2b')]){delete _0xeb1e45[_0x974d('0x2b')];}_0x359433[_0x974d('0x1a')](_0x357379)[_0x974d('0x2c')](_0xeb1e45);};}exports['index']=function(_0x3e2e62,_0x208a18){var _0x25be00={},_0x230eca={},_0x1b8c0f={'count':0x0,'rows':[]};var _0x187b4d=_['map'](db[_0x974d('0x2d')][_0x974d('0x2e')],function(_0x396249){return{'name':_0x396249['fieldName'],'type':_0x396249[_0x974d('0x2f')][_0x974d('0x30')]};});_0x230eca['model']=_[_0x974d('0x31')](_0x187b4d,_0x974d('0x2b'));_0x230eca[_0x974d('0x32')]=_['keys'](_0x3e2e62[_0x974d('0x32')]);_0x230eca[_0x974d('0x33')]=_[_0x974d('0x34')](_0x230eca[_0x974d('0x35')],_0x230eca[_0x974d('0x32')]);_0x25be00[_0x974d('0x36')]=_['intersection'](_0x230eca[_0x974d('0x35')],qs[_0x974d('0x37')](_0x3e2e62[_0x974d('0x32')][_0x974d('0x37')]));_0x25be00[_0x974d('0x36')]=_0x25be00['attributes']['length']?_0x25be00[_0x974d('0x36')]:_0x230eca[_0x974d('0x35')];if(!_0x3e2e62[_0x974d('0x32')][_0x974d('0x38')]('nolimit')){_0x25be00['limit']=qs['limit'](_0x3e2e62[_0x974d('0x32')][_0x974d('0x1e')]);_0x25be00[_0x974d('0x20')]=qs[_0x974d('0x20')](_0x3e2e62[_0x974d('0x32')][_0x974d('0x20')]);}_0x25be00[_0x974d('0x39')]=qs[_0x974d('0x3a')](_0x3e2e62[_0x974d('0x32')][_0x974d('0x3a')]);_0x25be00[_0x974d('0x3b')]=qs[_0x974d('0x33')](_[_0x974d('0x3c')](_0x3e2e62[_0x974d('0x32')],_0x230eca[_0x974d('0x33')]),_0x187b4d);if(_0x3e2e62[_0x974d('0x32')][_0x974d('0x3d')]){_0x25be00[_0x974d('0x3b')]=_['merge'](_0x25be00['where'],{'$or':_['map'](_0x187b4d,function(_0x2faf17){if(_0x2faf17[_0x974d('0x2f')]!=='VIRTUAL'){var _0x265b65={};_0x265b65[_0x2faf17['name']]={'$like':'%'+_0x3e2e62[_0x974d('0x32')][_0x974d('0x3d')]+'%'};return _0x265b65;}})});}_0x25be00=_[_0x974d('0x3e')]({},_0x25be00,_0x3e2e62['options']);var _0x51f287={'where':_0x25be00['where']};return db[_0x974d('0x2d')]['count'](_0x51f287)[_0x974d('0x27')](function(_0x53a8f1){_0x1b8c0f[_0x974d('0x1f')]=_0x53a8f1;if(_0x3e2e62['query'][_0x974d('0x3f')]){_0x25be00[_0x974d('0x40')]=[{'all':!![]}];}return db[_0x974d('0x2d')][_0x974d('0x41')](_0x25be00);})[_0x974d('0x27')](function(_0x3e0343){_0x1b8c0f[_0x974d('0x42')]=_0x3e0343;return _0x1b8c0f;})[_0x974d('0x27')](respondWithFilteredResult(_0x208a18,_0x25be00))[_0x974d('0x43')](handleError(_0x208a18,null));};exports[_0x974d('0x44')]=function(_0x3086f8,_0x156e00){var _0x1184bb={'raw':![],'where':{'id':_0x3086f8[_0x974d('0x45')]['id']}},_0x10c351={};_0x10c351[_0x974d('0x35')]=_[_0x974d('0x46')](db[_0x974d('0x2d')]['rawAttributes']);_0x10c351[_0x974d('0x32')]=_[_0x974d('0x46')](_0x3086f8[_0x974d('0x32')]);_0x10c351[_0x974d('0x33')]=_[_0x974d('0x34')](_0x10c351[_0x974d('0x35')],_0x10c351[_0x974d('0x32')]);_0x1184bb[_0x974d('0x36')]=_[_0x974d('0x34')](_0x10c351[_0x974d('0x35')],qs['fields'](_0x3086f8[_0x974d('0x32')][_0x974d('0x37')]));_0x1184bb[_0x974d('0x36')]=_0x1184bb[_0x974d('0x36')][_0x974d('0x47')]?_0x1184bb[_0x974d('0x36')]:_0x10c351[_0x974d('0x35')];if(_0x3086f8[_0x974d('0x32')][_0x974d('0x3f')]){_0x1184bb[_0x974d('0x40')]=[{'all':!![]}];}_0x1184bb=_['merge']({},_0x1184bb,_0x3086f8[_0x974d('0x48')]);return db[_0x974d('0x2d')][_0x974d('0x49')](_0x1184bb)[_0x974d('0x27')](handleEntityNotFound(_0x156e00,null))[_0x974d('0x27')](respondWithResult(_0x156e00,null))[_0x974d('0x43')](handleError(_0x156e00,null));};exports[_0x974d('0x4a')]=function(_0x3fa601,_0xb7f8cd){return db[_0x974d('0x2d')]['create'](_0x3fa601['body'],{})[_0x974d('0x27')](respondWithResult(_0xb7f8cd,0xc9))['catch'](handleError(_0xb7f8cd,null));};exports['update']=function(_0x525117,_0x193639){if(_0x525117[_0x974d('0x4b')]['id']){delete _0x525117[_0x974d('0x4b')]['id'];}return db['ZohoConfiguration'][_0x974d('0x49')]({'where':{'id':_0x525117[_0x974d('0x45')]['id']}})[_0x974d('0x27')](handleEntityNotFound(_0x193639,null))[_0x974d('0x27')](saveUpdates(_0x525117[_0x974d('0x4b')],null))[_0x974d('0x27')](respondWithResult(_0x193639,null))['catch'](handleError(_0x193639,null));};exports[_0x974d('0x28')]=function(_0x4065a5,_0x483d82){return db[_0x974d('0x2d')][_0x974d('0x49')]({'where':{'id':_0x4065a5[_0x974d('0x45')]['id']}})['then'](handleEntityNotFound(_0x483d82,null))[_0x974d('0x27')](removeEntity(_0x483d82,null))[_0x974d('0x43')](handleError(_0x483d82,null));};exports[_0x974d('0x4c')]=function(_0x399adb,_0x429ec,_0x1b9a8a){var _0x26a33d={};var _0x3d3178={};var _0x41b1e1;var _0x346524;return db[_0x974d('0x2d')][_0x974d('0x4d')]({'where':{'id':_0x399adb[_0x974d('0x45')]['id']}})[_0x974d('0x27')](handleEntityNotFound(_0x429ec,null))['then'](function(_0x5b1bd9){if(_0x5b1bd9){_0x41b1e1=_0x5b1bd9;_0x3d3178[_0x974d('0x35')]=_['keys'](db[_0x974d('0x4e')][_0x974d('0x2e')]);_0x3d3178[_0x974d('0x32')]=_[_0x974d('0x46')](_0x399adb[_0x974d('0x32')]);_0x3d3178[_0x974d('0x33')]=_[_0x974d('0x34')](_0x3d3178[_0x974d('0x35')],_0x3d3178['query']);_0x26a33d[_0x974d('0x36')]=_[_0x974d('0x34')](_0x3d3178['model'],qs[_0x974d('0x37')](_0x399adb['query'][_0x974d('0x37')]));_0x26a33d[_0x974d('0x36')]=_0x26a33d[_0x974d('0x36')]['length']?_0x26a33d[_0x974d('0x36')]:_0x3d3178['model'];_0x26a33d['order']=qs[_0x974d('0x3a')](_0x399adb['query'][_0x974d('0x3a')]);_0x26a33d[_0x974d('0x3b')]=qs['filters'](_[_0x974d('0x3c')](_0x399adb[_0x974d('0x32')],_0x3d3178[_0x974d('0x33')]));if(_0x399adb[_0x974d('0x32')][_0x974d('0x3d')]){_0x26a33d[_0x974d('0x3b')]=_[_0x974d('0x3e')](_0x26a33d[_0x974d('0x3b')],{'$or':_[_0x974d('0x31')](_0x26a33d[_0x974d('0x36')],function(_0x45ae20){var _0x400a56={};_0x400a56[_0x45ae20]={'$like':'%'+_0x399adb['query'][_0x974d('0x3d')]+'%'};return _0x400a56;})});}_0x26a33d=_[_0x974d('0x3e')]({},_0x26a33d,_0x399adb[_0x974d('0x48')]);return _0x41b1e1[_0x974d('0x4c')](_0x26a33d);}})[_0x974d('0x27')](function(_0xdc0fd4){if(_0xdc0fd4){_0x346524=_0xdc0fd4[_0x974d('0x47')];if(!_0x399adb[_0x974d('0x32')][_0x974d('0x38')](_0x974d('0x4f'))){_0x26a33d['limit']=qs['limit'](_0x399adb[_0x974d('0x32')]['limit']);_0x26a33d[_0x974d('0x20')]=qs[_0x974d('0x20')](_0x399adb[_0x974d('0x32')][_0x974d('0x20')]);}return _0x41b1e1[_0x974d('0x4c')](_0x26a33d);}})[_0x974d('0x27')](function(_0x3e0024){if(_0x3e0024){return _0x3e0024?{'count':_0x346524,'rows':_0x3e0024}:null;}})['then'](respondWithResult(_0x429ec,null))[_0x974d('0x43')](handleError(_0x429ec,null));};exports[_0x974d('0x50')]=function(_0x146db6,_0x593918,_0x118ec4){var _0x36430c={};var _0x24e730={};var _0x5013a7;var _0x21864e;return db[_0x974d('0x2d')]['findOne']({'where':{'id':_0x146db6['params']['id']}})[_0x974d('0x27')](handleEntityNotFound(_0x593918,null))[_0x974d('0x27')](function(_0x4c25fa){if(_0x4c25fa){_0x5013a7=_0x4c25fa;_0x24e730[_0x974d('0x35')]=_[_0x974d('0x46')](db['ZohoField']['rawAttributes']);_0x24e730['query']=_[_0x974d('0x46')](_0x146db6['query']);_0x24e730[_0x974d('0x33')]=_[_0x974d('0x34')](_0x24e730[_0x974d('0x35')],_0x24e730[_0x974d('0x32')]);_0x36430c[_0x974d('0x36')]=_[_0x974d('0x34')](_0x24e730[_0x974d('0x35')],qs[_0x974d('0x37')](_0x146db6['query']['fields']));_0x36430c[_0x974d('0x36')]=_0x36430c[_0x974d('0x36')][_0x974d('0x47')]?_0x36430c[_0x974d('0x36')]:_0x24e730[_0x974d('0x35')];_0x36430c[_0x974d('0x39')]=qs[_0x974d('0x3a')](_0x146db6[_0x974d('0x32')][_0x974d('0x3a')]);_0x36430c['where']=qs[_0x974d('0x33')](_[_0x974d('0x3c')](_0x146db6['query'],_0x24e730['filters']));if(_0x146db6['query']['filter']){_0x36430c['where']=_[_0x974d('0x3e')](_0x36430c[_0x974d('0x3b')],{'$or':_[_0x974d('0x31')](_0x36430c['attributes'],function(_0x4b0694){var _0x3f37e6={};_0x3f37e6[_0x4b0694]={'$like':'%'+_0x146db6['query'][_0x974d('0x3d')]+'%'};return _0x3f37e6;})});}_0x36430c=_['merge']({},_0x36430c,_0x146db6['options']);return _0x5013a7['getSubjects'](_0x36430c);}})['then'](function(_0x41bdae){if(_0x41bdae){_0x21864e=_0x41bdae['length'];if(!_0x146db6[_0x974d('0x32')][_0x974d('0x38')](_0x974d('0x4f'))){_0x36430c[_0x974d('0x1e')]=qs[_0x974d('0x1e')](_0x146db6[_0x974d('0x32')][_0x974d('0x1e')]);_0x36430c[_0x974d('0x20')]=qs[_0x974d('0x20')](_0x146db6['query'][_0x974d('0x20')]);}return _0x5013a7[_0x974d('0x50')](_0x36430c);}})['then'](function(_0x4bd27e){if(_0x4bd27e){return _0x4bd27e?{'count':_0x21864e,'rows':_0x4bd27e}:null;}})[_0x974d('0x27')](respondWithResult(_0x593918,null))['catch'](handleError(_0x593918,null));};exports[_0x974d('0x51')]=function(_0x273741,_0x3e232b,_0xbba976){var _0x18d152={};var _0x36de55={};var _0x4a56bf;var _0x116eba;return db[_0x974d('0x2d')][_0x974d('0x4d')]({'where':{'id':_0x273741[_0x974d('0x45')]['id']}})[_0x974d('0x27')](handleEntityNotFound(_0x3e232b,null))[_0x974d('0x27')](function(_0x117d63){if(_0x117d63){_0x4a56bf=_0x117d63;_0x36de55['model']=_[_0x974d('0x46')](db['ZohoField'][_0x974d('0x2e')]);_0x36de55[_0x974d('0x32')]=_[_0x974d('0x46')](_0x273741[_0x974d('0x32')]);_0x36de55[_0x974d('0x33')]=_[_0x974d('0x34')](_0x36de55[_0x974d('0x35')],_0x36de55[_0x974d('0x32')]);_0x18d152[_0x974d('0x36')]=_[_0x974d('0x34')](_0x36de55[_0x974d('0x35')],qs[_0x974d('0x37')](_0x273741[_0x974d('0x32')][_0x974d('0x37')]));_0x18d152[_0x974d('0x36')]=_0x18d152[_0x974d('0x36')][_0x974d('0x47')]?_0x18d152[_0x974d('0x36')]:_0x36de55[_0x974d('0x35')];_0x18d152[_0x974d('0x39')]=qs[_0x974d('0x3a')](_0x273741['query']['sort']);_0x18d152[_0x974d('0x3b')]=qs[_0x974d('0x33')](_[_0x974d('0x3c')](_0x273741[_0x974d('0x32')],_0x36de55[_0x974d('0x33')]));if(_0x273741[_0x974d('0x32')][_0x974d('0x3d')]){_0x18d152[_0x974d('0x3b')]=_[_0x974d('0x3e')](_0x18d152[_0x974d('0x3b')],{'$or':_['map'](_0x18d152[_0x974d('0x36')],function(_0x2283bf){var _0x44b37d={};_0x44b37d[_0x2283bf]={'$like':'%'+_0x273741['query']['filter']+'%'};return _0x44b37d;})});}_0x18d152=_['merge']({},_0x18d152,_0x273741[_0x974d('0x48')]);return _0x4a56bf['getDescriptions'](_0x18d152);}})[_0x974d('0x27')](function(_0x6a5cf7){if(_0x6a5cf7){_0x116eba=_0x6a5cf7[_0x974d('0x47')];if(!_0x273741['query'][_0x974d('0x38')](_0x974d('0x4f'))){_0x18d152[_0x974d('0x1e')]=qs['limit'](_0x273741[_0x974d('0x32')][_0x974d('0x1e')]);_0x18d152['offset']=qs[_0x974d('0x20')](_0x273741[_0x974d('0x32')]['offset']);}return _0x4a56bf[_0x974d('0x51')](_0x18d152);}})[_0x974d('0x27')](function(_0x1bbc30){if(_0x1bbc30){return _0x1bbc30?{'count':_0x116eba,'rows':_0x1bbc30}:null;}})['then'](respondWithResult(_0x3e232b,null))['catch'](handleError(_0x3e232b,null));}; \ No newline at end of file +var _0x7008=['create','body','catch','getFields','ZohoField','order','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find'];(function(_0x4db141,_0x74de9b){var _0x4e8b56=function(_0x2dc06f){while(--_0x2dc06f){_0x4db141['push'](_0x4db141['shift']());}};_0x4e8b56(++_0x74de9b);}(_0x7008,0x155));var _0x8700=function(_0x4af64c,_0x2d810c){_0x4af64c=_0x4af64c-0x0;var _0x4014ea=_0x7008[_0x4af64c];return _0x4014ea;};'use strict';var emlformat=require(_0x8700('0x0'));var rimraf=require(_0x8700('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8700('0x2'));var rp=require(_0x8700('0x3'));var moment=require(_0x8700('0x4'));var BPromise=require(_0x8700('0x5'));var Mustache=require(_0x8700('0x6'));var util=require('util');var path=require(_0x8700('0x7'));var sox=require(_0x8700('0x8'));var csv=require(_0x8700('0x9'));var ejs=require(_0x8700('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8700('0xb'));var squel=require(_0x8700('0xc'));var crypto=require('crypto');var jsforce=require(_0x8700('0xd'));var deskjs=require(_0x8700('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8700('0xf'));var Papa=require('papaparse');var Redis=require(_0x8700('0x10'));var authService=require(_0x8700('0x11'));var qs=require(_0x8700('0x12'));var as=require(_0x8700('0x13'));var hardwareService=require(_0x8700('0x14'));var logger=require(_0x8700('0x15'))(_0x8700('0x16'));var utils=require(_0x8700('0x17'));var config=require(_0x8700('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f342,_0x5b40cd){_0x5b40cd=_0x5b40cd||0xcc;return function(_0x50f432){if(_0x50f432){return _0x23f342[_0x8700('0x19')](_0x5b40cd);}return _0x23f342[_0x8700('0x1a')](_0x5b40cd)[_0x8700('0x1b')]();};}function respondWithResult(_0xfa2e1a,_0x25ee36){_0x25ee36=_0x25ee36||0xc8;return function(_0x593a09){if(_0x593a09){return _0xfa2e1a[_0x8700('0x1a')](_0x25ee36)[_0x8700('0x1c')](_0x593a09);}};}function respondWithFilteredResult(_0x40c0d2,_0x552eb2){return function(_0x4f4d02){if(_0x4f4d02){var _0xcedc94=typeof _0x552eb2[_0x8700('0x1d')]===_0x8700('0x1e')&&typeof _0x552eb2[_0x8700('0x1f')]===_0x8700('0x1e');var _0x1af1e9=_0x4f4d02[_0x8700('0x20')];var _0x403d28=_0xcedc94?0x0:_0x552eb2[_0x8700('0x1d')];var _0x1cb6d5=_0xcedc94?_0x4f4d02[_0x8700('0x20')]:_0x552eb2[_0x8700('0x1d')]+_0x552eb2['limit'];var _0x3024f4;if(_0x1cb6d5>=_0x1af1e9){_0x1cb6d5=_0x1af1e9;_0x3024f4=0xc8;}else{_0x3024f4=0xce;}_0x40c0d2['status'](_0x3024f4);return _0x40c0d2[_0x8700('0x21')](_0x8700('0x22'),_0x403d28+'-'+_0x1cb6d5+'/'+_0x1af1e9)[_0x8700('0x1c')](_0x4f4d02);}return null;};}function patchUpdates(_0x196ec8){return function(_0x1d5a55){try{jsonpatch[_0x8700('0x23')](_0x1d5a55,_0x196ec8,!![]);}catch(_0x2b427b){return BPromise[_0x8700('0x24')](_0x2b427b);}return _0x1d5a55[_0x8700('0x25')]();};}function saveUpdates(_0x402caa,_0x563265){return function(_0x9efb3a){if(_0x9efb3a){return _0x9efb3a['update'](_0x402caa)[_0x8700('0x26')](function(_0x451ca6){return _0x451ca6;});}return null;};}function removeEntity(_0x1fc641,_0x2baa4e){return function(_0x2e099d){if(_0x2e099d){return _0x2e099d[_0x8700('0x27')]()[_0x8700('0x26')](function(){_0x1fc641[_0x8700('0x1a')](0xcc)[_0x8700('0x1b')]();});}};}function handleEntityNotFound(_0x4c7b2a,_0x461134){return function(_0x440ea3){if(!_0x440ea3){_0x4c7b2a[_0x8700('0x19')](0x194);}return _0x440ea3;};}function handleError(_0x1cddf9,_0x250e0d){_0x250e0d=_0x250e0d||0x1f4;return function(_0x30970a){logger[_0x8700('0x28')](_0x30970a[_0x8700('0x29')]);if(_0x30970a['name']){delete _0x30970a[_0x8700('0x2a')];}_0x1cddf9[_0x8700('0x1a')](_0x250e0d)['send'](_0x30970a);};}exports[_0x8700('0x2b')]=function(_0x4ef489,_0x35f6ec){var _0x2522e2={},_0x15a002={},_0x4e12dd={'count':0x0,'rows':[]};var _0x543552=_['map'](db[_0x8700('0x2c')][_0x8700('0x2d')],function(_0x3bb4d5){return{'name':_0x3bb4d5[_0x8700('0x2e')],'type':_0x3bb4d5[_0x8700('0x2f')][_0x8700('0x30')]};});_0x15a002['model']=_[_0x8700('0x31')](_0x543552,_0x8700('0x2a'));_0x15a002['query']=_[_0x8700('0x32')](_0x4ef489[_0x8700('0x33')]);_0x15a002['filters']=_[_0x8700('0x34')](_0x15a002[_0x8700('0x35')],_0x15a002['query']);_0x2522e2['attributes']=_[_0x8700('0x34')](_0x15a002['model'],qs[_0x8700('0x36')](_0x4ef489[_0x8700('0x33')]['fields']));_0x2522e2[_0x8700('0x37')]=_0x2522e2[_0x8700('0x37')][_0x8700('0x38')]?_0x2522e2[_0x8700('0x37')]:_0x15a002[_0x8700('0x35')];if(!_0x4ef489[_0x8700('0x33')][_0x8700('0x39')](_0x8700('0x3a'))){_0x2522e2[_0x8700('0x1f')]=qs[_0x8700('0x1f')](_0x4ef489[_0x8700('0x33')][_0x8700('0x1f')]);_0x2522e2[_0x8700('0x1d')]=qs[_0x8700('0x1d')](_0x4ef489[_0x8700('0x33')][_0x8700('0x1d')]);}_0x2522e2['order']=qs['sort'](_0x4ef489[_0x8700('0x33')][_0x8700('0x3b')]);_0x2522e2[_0x8700('0x3c')]=qs[_0x8700('0x3d')](_[_0x8700('0x3e')](_0x4ef489['query'],_0x15a002[_0x8700('0x3d')]),_0x543552);if(_0x4ef489[_0x8700('0x33')][_0x8700('0x3f')]){_0x2522e2[_0x8700('0x3c')]=_[_0x8700('0x40')](_0x2522e2[_0x8700('0x3c')],{'$or':_['map'](_0x543552,function(_0x4ba6cf){if(_0x4ba6cf[_0x8700('0x2f')]!==_0x8700('0x41')){var _0x1dbd49={};_0x1dbd49[_0x4ba6cf['name']]={'$like':'%'+_0x4ef489[_0x8700('0x33')]['filter']+'%'};return _0x1dbd49;}})});}_0x2522e2=_[_0x8700('0x40')]({},_0x2522e2,_0x4ef489[_0x8700('0x42')]);var _0x5f1aab={'where':_0x2522e2['where']};return db['ZohoConfiguration'][_0x8700('0x20')](_0x5f1aab)['then'](function(_0x4b0ddf){_0x4e12dd[_0x8700('0x20')]=_0x4b0ddf;if(_0x4ef489[_0x8700('0x33')][_0x8700('0x43')]){_0x2522e2['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8700('0x44')](_0x2522e2);})[_0x8700('0x26')](function(_0x3190aa){_0x4e12dd[_0x8700('0x45')]=_0x3190aa;return _0x4e12dd;})[_0x8700('0x26')](respondWithFilteredResult(_0x35f6ec,_0x2522e2))['catch'](handleError(_0x35f6ec,null));};exports[_0x8700('0x46')]=function(_0x3d946b,_0x9bb21e){var _0x2e7215={'raw':![],'where':{'id':_0x3d946b[_0x8700('0x47')]['id']}},_0x3ddefa={};_0x3ddefa['model']=_[_0x8700('0x32')](db[_0x8700('0x2c')][_0x8700('0x2d')]);_0x3ddefa[_0x8700('0x33')]=_[_0x8700('0x32')](_0x3d946b['query']);_0x3ddefa[_0x8700('0x3d')]=_[_0x8700('0x34')](_0x3ddefa['model'],_0x3ddefa['query']);_0x2e7215[_0x8700('0x37')]=_[_0x8700('0x34')](_0x3ddefa[_0x8700('0x35')],qs[_0x8700('0x36')](_0x3d946b[_0x8700('0x33')][_0x8700('0x36')]));_0x2e7215[_0x8700('0x37')]=_0x2e7215['attributes'][_0x8700('0x38')]?_0x2e7215[_0x8700('0x37')]:_0x3ddefa[_0x8700('0x35')];if(_0x3d946b[_0x8700('0x33')][_0x8700('0x43')]){_0x2e7215[_0x8700('0x48')]=[{'all':!![]}];}_0x2e7215=_['merge']({},_0x2e7215,_0x3d946b[_0x8700('0x42')]);return db[_0x8700('0x2c')][_0x8700('0x49')](_0x2e7215)[_0x8700('0x26')](handleEntityNotFound(_0x9bb21e,null))[_0x8700('0x26')](respondWithResult(_0x9bb21e,null))['catch'](handleError(_0x9bb21e,null));};exports[_0x8700('0x4a')]=function(_0xd7377a,_0x48a321){return db[_0x8700('0x2c')][_0x8700('0x4a')](_0xd7377a[_0x8700('0x4b')],{})['then'](respondWithResult(_0x48a321,0xc9))[_0x8700('0x4c')](handleError(_0x48a321,null));};exports['update']=function(_0x31e99b,_0xad28cb){if(_0x31e99b[_0x8700('0x4b')]['id']){delete _0x31e99b[_0x8700('0x4b')]['id'];}return db[_0x8700('0x2c')][_0x8700('0x49')]({'where':{'id':_0x31e99b[_0x8700('0x47')]['id']}})['then'](handleEntityNotFound(_0xad28cb,null))[_0x8700('0x26')](saveUpdates(_0x31e99b[_0x8700('0x4b')],null))[_0x8700('0x26')](respondWithResult(_0xad28cb,null))[_0x8700('0x4c')](handleError(_0xad28cb,null));};exports[_0x8700('0x27')]=function(_0x3c92cd,_0x310a9b){return db[_0x8700('0x2c')][_0x8700('0x49')]({'where':{'id':_0x3c92cd[_0x8700('0x47')]['id']}})[_0x8700('0x26')](handleEntityNotFound(_0x310a9b,null))['then'](removeEntity(_0x310a9b,null))[_0x8700('0x4c')](handleError(_0x310a9b,null));};exports[_0x8700('0x4d')]=function(_0x2b7ee3,_0x269cf9,_0x40c1dc){var _0x3e05f1={};var _0xb83e97={};var _0x1912f2;var _0x5e8cc3;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2b7ee3[_0x8700('0x47')]['id']}})['then'](handleEntityNotFound(_0x269cf9,null))[_0x8700('0x26')](function(_0xc038c){if(_0xc038c){_0x1912f2=_0xc038c;_0xb83e97[_0x8700('0x35')]=_[_0x8700('0x32')](db[_0x8700('0x4e')][_0x8700('0x2d')]);_0xb83e97[_0x8700('0x33')]=_['keys'](_0x2b7ee3[_0x8700('0x33')]);_0xb83e97[_0x8700('0x3d')]=_[_0x8700('0x34')](_0xb83e97[_0x8700('0x35')],_0xb83e97[_0x8700('0x33')]);_0x3e05f1[_0x8700('0x37')]=_['intersection'](_0xb83e97[_0x8700('0x35')],qs[_0x8700('0x36')](_0x2b7ee3[_0x8700('0x33')][_0x8700('0x36')]));_0x3e05f1[_0x8700('0x37')]=_0x3e05f1[_0x8700('0x37')][_0x8700('0x38')]?_0x3e05f1['attributes']:_0xb83e97[_0x8700('0x35')];_0x3e05f1[_0x8700('0x4f')]=qs[_0x8700('0x3b')](_0x2b7ee3[_0x8700('0x33')][_0x8700('0x3b')]);_0x3e05f1['where']=qs[_0x8700('0x3d')](_[_0x8700('0x3e')](_0x2b7ee3[_0x8700('0x33')],_0xb83e97[_0x8700('0x3d')]));if(_0x2b7ee3[_0x8700('0x33')]['filter']){_0x3e05f1['where']=_[_0x8700('0x40')](_0x3e05f1[_0x8700('0x3c')],{'$or':_[_0x8700('0x31')](_0x3e05f1[_0x8700('0x37')],function(_0x2601e1){var _0x198556={};_0x198556[_0x2601e1]={'$like':'%'+_0x2b7ee3[_0x8700('0x33')][_0x8700('0x3f')]+'%'};return _0x198556;})});}_0x3e05f1=_[_0x8700('0x40')]({},_0x3e05f1,_0x2b7ee3[_0x8700('0x42')]);return _0x1912f2[_0x8700('0x4d')](_0x3e05f1);}})[_0x8700('0x26')](function(_0xf223fc){if(_0xf223fc){_0x5e8cc3=_0xf223fc[_0x8700('0x38')];if(!_0x2b7ee3['query'][_0x8700('0x39')](_0x8700('0x3a'))){_0x3e05f1[_0x8700('0x1f')]=qs[_0x8700('0x1f')](_0x2b7ee3[_0x8700('0x33')][_0x8700('0x1f')]);_0x3e05f1[_0x8700('0x1d')]=qs[_0x8700('0x1d')](_0x2b7ee3[_0x8700('0x33')][_0x8700('0x1d')]);}return _0x1912f2[_0x8700('0x4d')](_0x3e05f1);}})[_0x8700('0x26')](function(_0x389999){if(_0x389999){return _0x389999?{'count':_0x5e8cc3,'rows':_0x389999}:null;}})[_0x8700('0x26')](respondWithResult(_0x269cf9,null))[_0x8700('0x4c')](handleError(_0x269cf9,null));};exports['getSubjects']=function(_0x43b08a,_0x79929,_0x537aae){var _0x5abeec={};var _0x2e4aa1={};var _0x1f9cde;var _0x35fef8;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x43b08a['params']['id']}})['then'](handleEntityNotFound(_0x79929,null))[_0x8700('0x26')](function(_0x109d4b){if(_0x109d4b){_0x1f9cde=_0x109d4b;_0x2e4aa1['model']=_[_0x8700('0x32')](db[_0x8700('0x4e')]['rawAttributes']);_0x2e4aa1[_0x8700('0x33')]=_[_0x8700('0x32')](_0x43b08a[_0x8700('0x33')]);_0x2e4aa1[_0x8700('0x3d')]=_[_0x8700('0x34')](_0x2e4aa1[_0x8700('0x35')],_0x2e4aa1['query']);_0x5abeec['attributes']=_[_0x8700('0x34')](_0x2e4aa1[_0x8700('0x35')],qs[_0x8700('0x36')](_0x43b08a[_0x8700('0x33')]['fields']));_0x5abeec[_0x8700('0x37')]=_0x5abeec[_0x8700('0x37')]['length']?_0x5abeec[_0x8700('0x37')]:_0x2e4aa1['model'];_0x5abeec[_0x8700('0x4f')]=qs[_0x8700('0x3b')](_0x43b08a['query']['sort']);_0x5abeec[_0x8700('0x3c')]=qs[_0x8700('0x3d')](_[_0x8700('0x3e')](_0x43b08a['query'],_0x2e4aa1[_0x8700('0x3d')]));if(_0x43b08a['query']['filter']){_0x5abeec['where']=_[_0x8700('0x40')](_0x5abeec[_0x8700('0x3c')],{'$or':_['map'](_0x5abeec[_0x8700('0x37')],function(_0xd6c35b){var _0x28bca5={};_0x28bca5[_0xd6c35b]={'$like':'%'+_0x43b08a[_0x8700('0x33')]['filter']+'%'};return _0x28bca5;})});}_0x5abeec=_[_0x8700('0x40')]({},_0x5abeec,_0x43b08a[_0x8700('0x42')]);return _0x1f9cde['getSubjects'](_0x5abeec);}})[_0x8700('0x26')](function(_0xa88982){if(_0xa88982){_0x35fef8=_0xa88982[_0x8700('0x38')];if(!_0x43b08a[_0x8700('0x33')]['hasOwnProperty'](_0x8700('0x3a'))){_0x5abeec[_0x8700('0x1f')]=qs[_0x8700('0x1f')](_0x43b08a['query'][_0x8700('0x1f')]);_0x5abeec[_0x8700('0x1d')]=qs['offset'](_0x43b08a[_0x8700('0x33')][_0x8700('0x1d')]);}return _0x1f9cde[_0x8700('0x50')](_0x5abeec);}})['then'](function(_0x303f35){if(_0x303f35){return _0x303f35?{'count':_0x35fef8,'rows':_0x303f35}:null;}})[_0x8700('0x26')](respondWithResult(_0x79929,null))[_0x8700('0x4c')](handleError(_0x79929,null));};exports[_0x8700('0x51')]=function(_0x2fa9eb,_0x465c99,_0x357ae3){var _0x285824={};var _0x34a530={};var _0x4d3687;var _0x373df7;return db[_0x8700('0x2c')][_0x8700('0x52')]({'where':{'id':_0x2fa9eb['params']['id']}})[_0x8700('0x26')](handleEntityNotFound(_0x465c99,null))[_0x8700('0x26')](function(_0x5a4508){if(_0x5a4508){_0x4d3687=_0x5a4508;_0x34a530[_0x8700('0x35')]=_[_0x8700('0x32')](db[_0x8700('0x4e')][_0x8700('0x2d')]);_0x34a530[_0x8700('0x33')]=_[_0x8700('0x32')](_0x2fa9eb[_0x8700('0x33')]);_0x34a530[_0x8700('0x3d')]=_[_0x8700('0x34')](_0x34a530[_0x8700('0x35')],_0x34a530['query']);_0x285824[_0x8700('0x37')]=_[_0x8700('0x34')](_0x34a530[_0x8700('0x35')],qs['fields'](_0x2fa9eb['query'][_0x8700('0x36')]));_0x285824[_0x8700('0x37')]=_0x285824[_0x8700('0x37')]['length']?_0x285824[_0x8700('0x37')]:_0x34a530[_0x8700('0x35')];_0x285824['order']=qs[_0x8700('0x3b')](_0x2fa9eb[_0x8700('0x33')][_0x8700('0x3b')]);_0x285824[_0x8700('0x3c')]=qs[_0x8700('0x3d')](_[_0x8700('0x3e')](_0x2fa9eb[_0x8700('0x33')],_0x34a530[_0x8700('0x3d')]));if(_0x2fa9eb[_0x8700('0x33')][_0x8700('0x3f')]){_0x285824[_0x8700('0x3c')]=_[_0x8700('0x40')](_0x285824['where'],{'$or':_[_0x8700('0x31')](_0x285824['attributes'],function(_0x1f1f80){var _0x219eec={};_0x219eec[_0x1f1f80]={'$like':'%'+_0x2fa9eb[_0x8700('0x33')][_0x8700('0x3f')]+'%'};return _0x219eec;})});}_0x285824=_[_0x8700('0x40')]({},_0x285824,_0x2fa9eb[_0x8700('0x42')]);return _0x4d3687[_0x8700('0x51')](_0x285824);}})[_0x8700('0x26')](function(_0x42f891){if(_0x42f891){_0x373df7=_0x42f891[_0x8700('0x38')];if(!_0x2fa9eb[_0x8700('0x33')][_0x8700('0x39')]('nolimit')){_0x285824[_0x8700('0x1f')]=qs[_0x8700('0x1f')](_0x2fa9eb[_0x8700('0x33')]['limit']);_0x285824[_0x8700('0x1d')]=qs[_0x8700('0x1d')](_0x2fa9eb[_0x8700('0x33')]['offset']);}return _0x4d3687[_0x8700('0x51')](_0x285824);}})['then'](function(_0x456c43){if(_0x456c43){return _0x456c43?{'count':_0x373df7,'rows':_0x456c43}:null;}})['then'](respondWithResult(_0x465c99,null))[_0x8700('0x4c')](handleError(_0x465c99,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ac8cc72..10457af 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 _0x8b5b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x2f0386,_0x124967){var _0x565b69=function(_0x7dce72){while(--_0x7dce72){_0x2f0386['push'](_0x2f0386['shift']());}};_0x565b69(++_0x124967);}(_0x8b5b,0xca));var _0xb8b5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8b5b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb8b5('0x0'));var util=require(_0xb8b5('0x1'));var logger=require(_0xb8b5('0x2'))(_0xb8b5('0x3'));var moment=require(_0xb8b5('0x4'));var BPromise=require(_0xb8b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8b5('0x6'));var rimraf=require(_0xb8b5('0x7'));var config=require(_0xb8b5('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x22225c,_0x18fbfe){return _0x22225c[_0xb8b5('0x9')](_0xb8b5('0xa'),attributes,{'tableName':_0xb8b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb12f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','lodash','util'];(function(_0x3f0b15,_0x29a0c6){var _0x371196=function(_0x39ea4e){while(--_0x39ea4e){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x371196(++_0x29a0c6);}(_0xb12f,0x9a));var _0xfb12=function(_0x13634e,_0x5de6a9){_0x13634e=_0x13634e-0x0;var _0x4b27c0=_0xb12f[_0x13634e];return _0x4b27c0;};'use strict';var _=require(_0xfb12('0x0'));var util=require(_0xfb12('0x1'));var logger=require(_0xfb12('0x2'))(_0xfb12('0x3'));var moment=require(_0xfb12('0x4'));var BPromise=require(_0xfb12('0x5'));var rp=require(_0xfb12('0x6'));var fs=require('fs');var path=require(_0xfb12('0x7'));var rimraf=require(_0xfb12('0x8'));var config=require(_0xfb12('0x9'));var attributes=require(_0xfb12('0xa'));module['exports']=function(_0x25f18b,_0x1c1877){return _0x25f18b['define'](_0xfb12('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 34bfabf..68581c2 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 _0x5065=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4b4b5f,_0x4947e7){var _0x217811=function(_0x2748a4){while(--_0x2748a4){_0x4b4b5f['push'](_0x4b4b5f['shift']());}};_0x217811(++_0x4947e7);}(_0x5065,0xce));var _0x5506=function(_0x32c832,_0x28c89d){_0x32c832=_0x32c832-0x0;var _0x4b0524=_0x5065[_0x32c832];return _0x4b0524;};'use strict';var _=require('lodash');var util=require(_0x5506('0x0'));var moment=require(_0x5506('0x1'));var BPromise=require(_0x5506('0x2'));var rs=require(_0x5506('0x3'));var fs=require('fs');var Redis=require(_0x5506('0x4'));var db=require(_0x5506('0x5'))['db'];var utils=require(_0x5506('0x6'));var logger=require(_0x5506('0x7'))(_0x5506('0x8'));var config=require(_0x5506('0x9'));var jayson=require(_0x5506('0xa'));var client=jayson['client'][_0x5506('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e0119,_0x1fb812,_0x2c6e3b){return new BPromise(function(_0xbcf776,_0x40ff4f){return client[_0x5506('0xc')](_0x1e0119,_0x2c6e3b)['then'](function(_0xfe40d3){logger['info'](_0x5506('0xd'),_0x1fb812,'request\x20sent');logger['debug'](_0x5506('0xe'),_0x1fb812,_0x5506('0xf'),JSON['stringify'](_0xfe40d3));if(_0xfe40d3[_0x5506('0x10')]){if(_0xfe40d3['error'][_0x5506('0x11')]===0x1f4){logger[_0x5506('0x10')](_0x5506('0xd'),_0x1fb812,_0xfe40d3[_0x5506('0x10')][_0x5506('0x12')]);return _0x40ff4f(_0xfe40d3[_0x5506('0x10')][_0x5506('0x12')]);}logger['error'](_0x5506('0xd'),_0x1fb812,_0xfe40d3[_0x5506('0x10')]['message']);return _0xbcf776(_0xfe40d3[_0x5506('0x10')][_0x5506('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1fb812,'request\x20sent');_0xbcf776(_0xfe40d3[_0x5506('0x13')][_0x5506('0x12')]);}})[_0x5506('0x14')](function(_0x4ee6e3){logger['error'](_0x5506('0xd'),_0x1fb812,_0x4ee6e3);_0x40ff4f(_0x4ee6e3);});});} \ No newline at end of file +var _0xdf7c=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xdf7c,0x1a0));var _0xcdf7=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xdf7c[_0x257b0e];return _0x27ac2a;};'use strict';var _=require(_0xcdf7('0x0'));var util=require(_0xcdf7('0x1'));var moment=require(_0xcdf7('0x2'));var BPromise=require(_0xcdf7('0x3'));var rs=require(_0xcdf7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf7('0x5'))['db'];var utils=require(_0xcdf7('0x6'));var logger=require(_0xcdf7('0x7'))(_0xcdf7('0x8'));var config=require(_0xcdf7('0x9'));var jayson=require(_0xcdf7('0xa'));var client=jayson[_0xcdf7('0xb')][_0xcdf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2754fd,_0x464429,_0x464cf8){return new BPromise(function(_0x4409b9,_0x294b2b){return client[_0xcdf7('0xd')](_0x2754fd,_0x464cf8)[_0xcdf7('0xe')](function(_0x255e27){logger[_0xcdf7('0xf')](_0xcdf7('0x10'),_0x464429,_0xcdf7('0x11'));logger['debug'](_0xcdf7('0x12'),_0x464429,_0xcdf7('0x11'),JSON['stringify'](_0x255e27));if(_0x255e27['error']){if(_0x255e27[_0xcdf7('0x13')]['code']===0x1f4){logger[_0xcdf7('0x13')](_0xcdf7('0x10'),_0x464429,_0x255e27[_0xcdf7('0x13')]['message']);return _0x294b2b(_0x255e27[_0xcdf7('0x13')][_0xcdf7('0x14')]);}logger[_0xcdf7('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x464429,_0x255e27[_0xcdf7('0x13')]['message']);return _0x4409b9(_0x255e27['error']['message']);}else{logger[_0xcdf7('0xf')](_0xcdf7('0x10'),_0x464429,'request\x20sent');_0x4409b9(_0x255e27[_0xcdf7('0x15')][_0xcdf7('0x14')]);}})[_0xcdf7('0x16')](function(_0xa4b868){logger[_0xcdf7('0x13')](_0xcdf7('0x10'),_0x464429,_0xa4b868);_0x294b2b(_0xa4b868);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 63924c4..7a26bfe 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 _0x4bcb=['../../config/environment','get','isAuthenticated','index','show','post','/:id','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5c7df9,_0xf3a126){var _0x28a4f9=function(_0x511ea8){while(--_0x511ea8){_0x5c7df9['push'](_0x5c7df9['shift']());}};_0x28a4f9(++_0xf3a126);}(_0x4bcb,0x1ea));var _0xb4bc=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x4bcb[_0x1ee351];return _0x245aaf;};'use strict';var multer=require(_0xb4bc('0x0'));var util=require(_0xb4bc('0x1'));var path=require('path');var timeout=require(_0xb4bc('0x2'));var express=require(_0xb4bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4bc('0x4'));var interaction=require(_0xb4bc('0x5'));var config=require(_0xb4bc('0x6'));var controller=require('./intZohoField.controller');router[_0xb4bc('0x7')]('/',auth[_0xb4bc('0x8')](),controller[_0xb4bc('0x9')]);router[_0xb4bc('0x7')]('/:id',auth[_0xb4bc('0x8')](),controller[_0xb4bc('0xa')]);router[_0xb4bc('0xb')]('/',auth[_0xb4bc('0x8')](),controller['create']);router['put'](_0xb4bc('0xc'),auth[_0xb4bc('0x8')](),controller[_0xb4bc('0xd')]);router[_0xb4bc('0xe')](_0xb4bc('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb4bc('0xf')]=router; \ No newline at end of file +var _0xba6c=['index','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xba6c,0x113));var _0xcba6=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xba6c[_0x5f1cf8];return _0x27d0fa;};'use strict';var multer=require(_0xcba6('0x0'));var util=require('util');var path=require(_0xcba6('0x1'));var timeout=require(_0xcba6('0x2'));var express=require(_0xcba6('0x3'));var router=express[_0xcba6('0x4')]();var fs_extra=require(_0xcba6('0x5'));var auth=require(_0xcba6('0x6'));var interaction=require(_0xcba6('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xcba6('0x8')]('/',auth[_0xcba6('0x9')](),controller[_0xcba6('0xa')]);router[_0xcba6('0x8')](_0xcba6('0xb'),auth[_0xcba6('0x9')](),controller[_0xcba6('0xc')]);router[_0xcba6('0xd')]('/',auth[_0xcba6('0x9')](),controller[_0xcba6('0xe')]);router[_0xcba6('0xf')]('/:id',auth[_0xcba6('0x9')](),controller[_0xcba6('0x10')]);router[_0xcba6('0x11')](_0xcba6('0xb'),auth['isAuthenticated'](),controller[_0xcba6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e618db0..9d72119 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 _0xb5d9=['sequelize','exports','string','customVariable','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x448246,_0xc4bd77){var _0x99837d=function(_0x566c20){while(--_0x566c20){_0x448246['push'](_0x448246['shift']());}};_0x99837d(++_0xc4bd77);}(_0xb5d9,0x18c));var _0x9b5d=function(_0x480204,_0x1993c2){_0x480204=_0x480204-0x0;var _0x56e78d=_0xb5d9[_0x480204];return _0x56e78d;};'use strict';var Sequelize=require(_0x9b5d('0x0'));module[_0x9b5d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9b5d('0x2'),'variable',_0x9b5d('0x3'),'keyValue',_0x9b5d('0x4')),'defaultValue':_0x9b5d('0x2')},'content':{'type':Sequelize[_0x9b5d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9b5d('0x6')](_0x9b5d('0x2'),_0x9b5d('0x7'),_0x9b5d('0x3'))},'keyContent':{'type':Sequelize[_0x9b5d('0x5')]},'idField':{'type':Sequelize[_0x9b5d('0x5')]},'nameField':{'type':Sequelize[_0x9b5d('0x5')]},'customField':{'type':Sequelize[_0x9b5d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b5d('0x5')]}}; \ No newline at end of file +var _0x109f=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x448e99,_0x32e01f){var _0x6d029=function(_0x39e212){while(--_0x39e212){_0x448e99['push'](_0x448e99['shift']());}};_0x6d029(++_0x32e01f);}(_0x109f,0x1a3));var _0xf109=function(_0x60e03,_0x11118b){_0x60e03=_0x60e03-0x0;var _0x54e31a=_0x109f[_0x60e03];return _0x54e31a;};'use strict';var Sequelize=require(_0xf109('0x0'));module[_0xf109('0x1')]={'type':{'type':Sequelize[_0xf109('0x2')](_0xf109('0x3'),_0xf109('0x4'),_0xf109('0x5'),_0xf109('0x6'),_0xf109('0x7')),'defaultValue':_0xf109('0x3')},'content':{'type':Sequelize[_0xf109('0x8')]},'key':{'type':Sequelize[_0xf109('0x8')]},'keyType':{'type':Sequelize[_0xf109('0x2')](_0xf109('0x3'),_0xf109('0x4'),_0xf109('0x5'))},'keyContent':{'type':Sequelize[_0xf109('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf109('0x8')]},'customField':{'type':Sequelize[_0xf109('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf109('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b579073..61ae7f4 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 _0x40be=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','create','body','catch','find','params','destroy','zip-dir','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x2714ae,_0x5c7517){var _0x2fb461=function(_0x7b6b6a){while(--_0x7b6b6a){_0x2714ae['push'](_0x2714ae['shift']());}};_0x2fb461(++_0x5c7517);}(_0x40be,0x14d));var _0xe40b=function(_0x331bdd,_0x403e31){_0x331bdd=_0x331bdd-0x0;var _0x5197eb=_0x40be[_0x331bdd];return _0x5197eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe40b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe40b('0x1'));var Mustache=require('mustache');var util=require(_0xe40b('0x2'));var path=require(_0xe40b('0x3'));var sox=require('sox');var csv=require(_0xe40b('0x4'));var ejs=require(_0xe40b('0x5'));var fs=require('fs');var fs_extra=require(_0xe40b('0x6'));var _=require(_0xe40b('0x7'));var squel=require('squel');var crypto=require(_0xe40b('0x8'));var jsforce=require(_0xe40b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe40b('0x4'));var querystring=require(_0xe40b('0xa'));var Papa=require(_0xe40b('0xb'));var Redis=require(_0xe40b('0xc'));var authService=require(_0xe40b('0xd'));var qs=require(_0xe40b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe40b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xe40b('0x10'));var config=require(_0xe40b('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40aaa4,_0x1cf36b){_0x1cf36b=_0x1cf36b||0xcc;return function(_0x4321cb){if(_0x4321cb){return _0x40aaa4[_0xe40b('0x12')](_0x1cf36b);}return _0x40aaa4[_0xe40b('0x13')](_0x1cf36b)[_0xe40b('0x14')]();};}function respondWithResult(_0x4432e4,_0x43e137){_0x43e137=_0x43e137||0xc8;return function(_0x1fe4f4){if(_0x1fe4f4){return _0x4432e4[_0xe40b('0x13')](_0x43e137)['json'](_0x1fe4f4);}};}function respondWithFilteredResult(_0x3e958b,_0x19e843){return function(_0xc02116){if(_0xc02116){var _0x1a955c=typeof _0x19e843[_0xe40b('0x15')]===_0xe40b('0x16')&&typeof _0x19e843['limit']==='undefined';var _0x4161d0=_0xc02116[_0xe40b('0x17')];var _0x4ffba6=_0x1a955c?0x0:_0x19e843[_0xe40b('0x15')];var _0x7848a4=_0x1a955c?_0xc02116[_0xe40b('0x17')]:_0x19e843[_0xe40b('0x15')]+_0x19e843[_0xe40b('0x18')];var _0x55fe6c;if(_0x7848a4>=_0x4161d0){_0x7848a4=_0x4161d0;_0x55fe6c=0xc8;}else{_0x55fe6c=0xce;}_0x3e958b[_0xe40b('0x13')](_0x55fe6c);return _0x3e958b[_0xe40b('0x19')]('Content-Range',_0x4ffba6+'-'+_0x7848a4+'/'+_0x4161d0)['json'](_0xc02116);}return null;};}function patchUpdates(_0x15dd3f){return function(_0x5c948d){try{jsonpatch[_0xe40b('0x1a')](_0x5c948d,_0x15dd3f,!![]);}catch(_0x13da26){return BPromise[_0xe40b('0x1b')](_0x13da26);}return _0x5c948d[_0xe40b('0x1c')]();};}function saveUpdates(_0x32b9d1,_0x28d979){return function(_0x27d88e){if(_0x27d88e){return _0x27d88e[_0xe40b('0x1d')](_0x32b9d1)[_0xe40b('0x1e')](function(_0x3371a4){return _0x3371a4;});}return null;};}function removeEntity(_0x49ce8a,_0x34d778){return function(_0x1664f1){if(_0x1664f1){return _0x1664f1['destroy']()[_0xe40b('0x1e')](function(){_0x49ce8a[_0xe40b('0x13')](0xcc)[_0xe40b('0x14')]();});}};}function handleEntityNotFound(_0x2c39ab,_0x4918c1){return function(_0x5e5408){if(!_0x5e5408){_0x2c39ab[_0xe40b('0x12')](0x194);}return _0x5e5408;};}function handleError(_0x1cdb2d,_0x3e45b3){_0x3e45b3=_0x3e45b3||0x1f4;return function(_0x53cdd3){logger[_0xe40b('0x1f')](_0x53cdd3[_0xe40b('0x20')]);if(_0x53cdd3[_0xe40b('0x21')]){delete _0x53cdd3[_0xe40b('0x21')];}_0x1cdb2d[_0xe40b('0x13')](_0x3e45b3)[_0xe40b('0x22')](_0x53cdd3);};}exports[_0xe40b('0x23')]=function(_0x1d0b32,_0x24a389){var _0x3e24da={},_0x1cba2d={},_0x19acb0={'count':0x0,'rows':[]};var _0xaacf48=_[_0xe40b('0x24')](db[_0xe40b('0x25')][_0xe40b('0x26')],function(_0x2157bc){return{'name':_0x2157bc[_0xe40b('0x27')],'type':_0x2157bc[_0xe40b('0x28')][_0xe40b('0x29')]};});_0x1cba2d[_0xe40b('0x2a')]=_[_0xe40b('0x24')](_0xaacf48,'name');_0x1cba2d['query']=_[_0xe40b('0x2b')](_0x1d0b32[_0xe40b('0x2c')]);_0x1cba2d[_0xe40b('0x2d')]=_[_0xe40b('0x2e')](_0x1cba2d[_0xe40b('0x2a')],_0x1cba2d[_0xe40b('0x2c')]);_0x3e24da[_0xe40b('0x2f')]=_[_0xe40b('0x2e')](_0x1cba2d[_0xe40b('0x2a')],qs['fields'](_0x1d0b32['query'][_0xe40b('0x30')]));_0x3e24da['attributes']=_0x3e24da[_0xe40b('0x2f')][_0xe40b('0x31')]?_0x3e24da[_0xe40b('0x2f')]:_0x1cba2d[_0xe40b('0x2a')];if(!_0x1d0b32[_0xe40b('0x2c')][_0xe40b('0x32')]('nolimit')){_0x3e24da[_0xe40b('0x18')]=qs['limit'](_0x1d0b32['query'][_0xe40b('0x18')]);_0x3e24da[_0xe40b('0x15')]=qs[_0xe40b('0x15')](_0x1d0b32[_0xe40b('0x2c')][_0xe40b('0x15')]);}_0x3e24da[_0xe40b('0x33')]=qs[_0xe40b('0x34')](_0x1d0b32['query'][_0xe40b('0x34')]);_0x3e24da[_0xe40b('0x35')]=qs[_0xe40b('0x2d')](_[_0xe40b('0x36')](_0x1d0b32[_0xe40b('0x2c')],_0x1cba2d[_0xe40b('0x2d')]),_0xaacf48);if(_0x1d0b32[_0xe40b('0x2c')]['filter']){_0x3e24da[_0xe40b('0x35')]=_[_0xe40b('0x37')](_0x3e24da[_0xe40b('0x35')],{'$or':_['map'](_0xaacf48,function(_0x1d59e9){if(_0x1d59e9[_0xe40b('0x28')]!=='VIRTUAL'){var _0xa568e6={};_0xa568e6[_0x1d59e9[_0xe40b('0x21')]]={'$like':'%'+_0x1d0b32['query'][_0xe40b('0x38')]+'%'};return _0xa568e6;}})});}_0x3e24da=_[_0xe40b('0x37')]({},_0x3e24da,_0x1d0b32[_0xe40b('0x39')]);var _0x2e6989={'where':_0x3e24da[_0xe40b('0x35')]};return db[_0xe40b('0x25')][_0xe40b('0x17')](_0x2e6989)[_0xe40b('0x1e')](function(_0x22812e){_0x19acb0[_0xe40b('0x17')]=_0x22812e;if(_0x1d0b32[_0xe40b('0x2c')][_0xe40b('0x3a')]){_0x3e24da[_0xe40b('0x3b')]=[{'all':!![]}];}return db[_0xe40b('0x25')][_0xe40b('0x3c')](_0x3e24da);})[_0xe40b('0x1e')](function(_0x3cd46a){_0x19acb0[_0xe40b('0x3d')]=_0x3cd46a;return _0x19acb0;})[_0xe40b('0x1e')](respondWithFilteredResult(_0x24a389,_0x3e24da))['catch'](handleError(_0x24a389,null));};exports['show']=function(_0x4454d2,_0x42fc0e){var _0x2e3f02={'raw':!![],'where':{'id':_0x4454d2['params']['id']}},_0x43a2d9={};_0x43a2d9['model']=_[_0xe40b('0x2b')](db['ZohoField'][_0xe40b('0x26')]);_0x43a2d9[_0xe40b('0x2c')]=_[_0xe40b('0x2b')](_0x4454d2[_0xe40b('0x2c')]);_0x43a2d9['filters']=_[_0xe40b('0x2e')](_0x43a2d9[_0xe40b('0x2a')],_0x43a2d9['query']);_0x2e3f02[_0xe40b('0x2f')]=_[_0xe40b('0x2e')](_0x43a2d9[_0xe40b('0x2a')],qs[_0xe40b('0x30')](_0x4454d2['query'][_0xe40b('0x30')]));_0x2e3f02['attributes']=_0x2e3f02[_0xe40b('0x2f')][_0xe40b('0x31')]?_0x2e3f02[_0xe40b('0x2f')]:_0x43a2d9[_0xe40b('0x2a')];if(_0x4454d2[_0xe40b('0x2c')][_0xe40b('0x3a')]){_0x2e3f02['include']=[{'all':!![]}];}_0x2e3f02=_['merge']({},_0x2e3f02,_0x4454d2[_0xe40b('0x39')]);return db['ZohoField']['find'](_0x2e3f02)['then'](handleEntityNotFound(_0x42fc0e,null))[_0xe40b('0x1e')](respondWithResult(_0x42fc0e,null))['catch'](handleError(_0x42fc0e,null));};exports[_0xe40b('0x3e')]=function(_0x22be57,_0x58d0d3){return db['ZohoField'][_0xe40b('0x3e')](_0x22be57[_0xe40b('0x3f')],{})[_0xe40b('0x1e')](respondWithResult(_0x58d0d3,0xc9))[_0xe40b('0x40')](handleError(_0x58d0d3,null));};exports[_0xe40b('0x1d')]=function(_0x4ccccf,_0x4da5f2){if(_0x4ccccf['body']['id']){delete _0x4ccccf[_0xe40b('0x3f')]['id'];}return db['ZohoField'][_0xe40b('0x41')]({'where':{'id':_0x4ccccf[_0xe40b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4da5f2,null))['then'](saveUpdates(_0x4ccccf[_0xe40b('0x3f')],null))[_0xe40b('0x1e')](respondWithResult(_0x4da5f2,null))[_0xe40b('0x40')](handleError(_0x4da5f2,null));};exports[_0xe40b('0x43')]=function(_0x428529,_0x45bb3a){return db[_0xe40b('0x25')][_0xe40b('0x41')]({'where':{'id':_0x428529[_0xe40b('0x42')]['id']}})[_0xe40b('0x1e')](handleEntityNotFound(_0x45bb3a,null))[_0xe40b('0x1e')](removeEntity(_0x45bb3a,null))[_0xe40b('0x40')](handleError(_0x45bb3a,null));}; \ No newline at end of file +var _0x1842=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','index','map','ZohoField','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js'];(function(_0x587c0a,_0x55fe0d){var _0x21136c=function(_0x2989b3){while(--_0x2989b3){_0x587c0a['push'](_0x587c0a['shift']());}};_0x21136c(++_0x55fe0d);}(_0x1842,0x80));var _0x2184=function(_0x508ded,_0x3f2061){_0x508ded=_0x508ded-0x0;var _0x3bc457=_0x1842[_0x508ded];return _0x3bc457;};'use strict';var emlformat=require(_0x2184('0x0'));var rimraf=require(_0x2184('0x1'));var zipdir=require(_0x2184('0x2'));var jsonpatch=require(_0x2184('0x3'));var rp=require(_0x2184('0x4'));var moment=require(_0x2184('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2184('0x6'));var util=require('util');var path=require(_0x2184('0x7'));var sox=require(_0x2184('0x8'));var csv=require(_0x2184('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2184('0xa'));var _=require(_0x2184('0xb'));var squel=require('squel');var crypto=require(_0x2184('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2184('0xd'));var toCsv=require(_0x2184('0x9'));var querystring=require('querystring');var Papa=require(_0x2184('0xe'));var Redis=require(_0x2184('0xf'));var authService=require(_0x2184('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2184('0x11'));var hardwareService=require(_0x2184('0x12'));var logger=require(_0x2184('0x13'))(_0x2184('0x14'));var utils=require(_0x2184('0x15'));var config=require(_0x2184('0x16'));var licenseUtil=require(_0x2184('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c60b,_0x54f04b){_0x54f04b=_0x54f04b||0xcc;return function(_0x54d61d){if(_0x54d61d){return _0x36c60b[_0x2184('0x18')](_0x54f04b);}return _0x36c60b[_0x2184('0x19')](_0x54f04b)['end']();};}function respondWithResult(_0x113b9b,_0x36e3b3){_0x36e3b3=_0x36e3b3||0xc8;return function(_0x47d353){if(_0x47d353){return _0x113b9b[_0x2184('0x19')](_0x36e3b3)['json'](_0x47d353);}};}function respondWithFilteredResult(_0x81f09e,_0x1603d6){return function(_0x3ab481){if(_0x3ab481){var _0x8b3e68=typeof _0x1603d6[_0x2184('0x1a')]===_0x2184('0x1b')&&typeof _0x1603d6[_0x2184('0x1c')]===_0x2184('0x1b');var _0x4c35ed=_0x3ab481['count'];var _0x496ac5=_0x8b3e68?0x0:_0x1603d6[_0x2184('0x1a')];var _0x246fbc=_0x8b3e68?_0x3ab481[_0x2184('0x1d')]:_0x1603d6[_0x2184('0x1a')]+_0x1603d6[_0x2184('0x1c')];var _0x38d895;if(_0x246fbc>=_0x4c35ed){_0x246fbc=_0x4c35ed;_0x38d895=0xc8;}else{_0x38d895=0xce;}_0x81f09e[_0x2184('0x19')](_0x38d895);return _0x81f09e[_0x2184('0x1e')](_0x2184('0x1f'),_0x496ac5+'-'+_0x246fbc+'/'+_0x4c35ed)[_0x2184('0x20')](_0x3ab481);}return null;};}function patchUpdates(_0x28a816){return function(_0x3e8556){try{jsonpatch[_0x2184('0x21')](_0x3e8556,_0x28a816,!![]);}catch(_0x257aa7){return BPromise[_0x2184('0x22')](_0x257aa7);}return _0x3e8556[_0x2184('0x23')]();};}function saveUpdates(_0x11497d,_0xcaa459){return function(_0x72c3c0){if(_0x72c3c0){return _0x72c3c0[_0x2184('0x24')](_0x11497d)[_0x2184('0x25')](function(_0x4d0c5b){return _0x4d0c5b;});}return null;};}function removeEntity(_0x1fbc0e,_0x4ddc65){return function(_0x731d5c){if(_0x731d5c){return _0x731d5c[_0x2184('0x26')]()[_0x2184('0x25')](function(){_0x1fbc0e['status'](0xcc)[_0x2184('0x27')]();});}};}function handleEntityNotFound(_0x484e33,_0x377a6e){return function(_0x3efc88){if(!_0x3efc88){_0x484e33[_0x2184('0x18')](0x194);}return _0x3efc88;};}function handleError(_0x3044b5,_0x1f79db){_0x1f79db=_0x1f79db||0x1f4;return function(_0x180747){logger[_0x2184('0x28')](_0x180747['stack']);if(_0x180747['name']){delete _0x180747['name'];}_0x3044b5[_0x2184('0x19')](_0x1f79db)['send'](_0x180747);};}exports[_0x2184('0x29')]=function(_0x7dd1cf,_0x2a0b94){var _0x77ff1d={},_0x4d07d2={},_0x249545={'count':0x0,'rows':[]};var _0x45b9af=_[_0x2184('0x2a')](db[_0x2184('0x2b')][_0x2184('0x2c')],function(_0x1e9709){return{'name':_0x1e9709['fieldName'],'type':_0x1e9709[_0x2184('0x2d')]['key']};});_0x4d07d2[_0x2184('0x2e')]=_[_0x2184('0x2a')](_0x45b9af,_0x2184('0x2f'));_0x4d07d2[_0x2184('0x30')]=_[_0x2184('0x31')](_0x7dd1cf[_0x2184('0x30')]);_0x4d07d2[_0x2184('0x32')]=_[_0x2184('0x33')](_0x4d07d2[_0x2184('0x2e')],_0x4d07d2[_0x2184('0x30')]);_0x77ff1d[_0x2184('0x34')]=_[_0x2184('0x33')](_0x4d07d2['model'],qs[_0x2184('0x35')](_0x7dd1cf['query']['fields']));_0x77ff1d[_0x2184('0x34')]=_0x77ff1d[_0x2184('0x34')][_0x2184('0x36')]?_0x77ff1d[_0x2184('0x34')]:_0x4d07d2[_0x2184('0x2e')];if(!_0x7dd1cf['query']['hasOwnProperty'](_0x2184('0x37'))){_0x77ff1d[_0x2184('0x1c')]=qs['limit'](_0x7dd1cf['query'][_0x2184('0x1c')]);_0x77ff1d[_0x2184('0x1a')]=qs[_0x2184('0x1a')](_0x7dd1cf['query']['offset']);}_0x77ff1d[_0x2184('0x38')]=qs['sort'](_0x7dd1cf[_0x2184('0x30')][_0x2184('0x39')]);_0x77ff1d[_0x2184('0x3a')]=qs[_0x2184('0x32')](_['pick'](_0x7dd1cf[_0x2184('0x30')],_0x4d07d2[_0x2184('0x32')]),_0x45b9af);if(_0x7dd1cf[_0x2184('0x30')][_0x2184('0x3b')]){_0x77ff1d[_0x2184('0x3a')]=_['merge'](_0x77ff1d[_0x2184('0x3a')],{'$or':_['map'](_0x45b9af,function(_0x594896){if(_0x594896[_0x2184('0x2d')]!==_0x2184('0x3c')){var _0x3f9e49={};_0x3f9e49[_0x594896[_0x2184('0x2f')]]={'$like':'%'+_0x7dd1cf[_0x2184('0x30')]['filter']+'%'};return _0x3f9e49;}})});}_0x77ff1d=_[_0x2184('0x3d')]({},_0x77ff1d,_0x7dd1cf[_0x2184('0x3e')]);var _0x51ee8e={'where':_0x77ff1d[_0x2184('0x3a')]};return db[_0x2184('0x2b')][_0x2184('0x1d')](_0x51ee8e)[_0x2184('0x25')](function(_0x3276a6){_0x249545[_0x2184('0x1d')]=_0x3276a6;if(_0x7dd1cf[_0x2184('0x30')][_0x2184('0x3f')]){_0x77ff1d[_0x2184('0x40')]=[{'all':!![]}];}return db['ZohoField'][_0x2184('0x41')](_0x77ff1d);})[_0x2184('0x25')](function(_0x321049){_0x249545['rows']=_0x321049;return _0x249545;})['then'](respondWithFilteredResult(_0x2a0b94,_0x77ff1d))[_0x2184('0x42')](handleError(_0x2a0b94,null));};exports['show']=function(_0x1de2aa,_0xc156f9){var _0x5b6546={'raw':!![],'where':{'id':_0x1de2aa['params']['id']}},_0x5c3b96={};_0x5c3b96[_0x2184('0x2e')]=_[_0x2184('0x31')](db[_0x2184('0x2b')][_0x2184('0x2c')]);_0x5c3b96[_0x2184('0x30')]=_['keys'](_0x1de2aa[_0x2184('0x30')]);_0x5c3b96[_0x2184('0x32')]=_[_0x2184('0x33')](_0x5c3b96['model'],_0x5c3b96[_0x2184('0x30')]);_0x5b6546[_0x2184('0x34')]=_[_0x2184('0x33')](_0x5c3b96[_0x2184('0x2e')],qs[_0x2184('0x35')](_0x1de2aa[_0x2184('0x30')][_0x2184('0x35')]));_0x5b6546[_0x2184('0x34')]=_0x5b6546[_0x2184('0x34')][_0x2184('0x36')]?_0x5b6546[_0x2184('0x34')]:_0x5c3b96[_0x2184('0x2e')];if(_0x1de2aa[_0x2184('0x30')][_0x2184('0x3f')]){_0x5b6546[_0x2184('0x40')]=[{'all':!![]}];}_0x5b6546=_[_0x2184('0x3d')]({},_0x5b6546,_0x1de2aa[_0x2184('0x3e')]);return db[_0x2184('0x2b')]['find'](_0x5b6546)[_0x2184('0x25')](handleEntityNotFound(_0xc156f9,null))[_0x2184('0x25')](respondWithResult(_0xc156f9,null))['catch'](handleError(_0xc156f9,null));};exports['create']=function(_0x930ba7,_0x29b681){return db['ZohoField'][_0x2184('0x43')](_0x930ba7[_0x2184('0x44')],{})[_0x2184('0x25')](respondWithResult(_0x29b681,0xc9))['catch'](handleError(_0x29b681,null));};exports['update']=function(_0x270d95,_0x4cdd9d){if(_0x270d95[_0x2184('0x44')]['id']){delete _0x270d95[_0x2184('0x44')]['id'];}return db[_0x2184('0x2b')][_0x2184('0x45')]({'where':{'id':_0x270d95[_0x2184('0x46')]['id']}})[_0x2184('0x25')](handleEntityNotFound(_0x4cdd9d,null))[_0x2184('0x25')](saveUpdates(_0x270d95[_0x2184('0x44')],null))[_0x2184('0x25')](respondWithResult(_0x4cdd9d,null))[_0x2184('0x42')](handleError(_0x4cdd9d,null));};exports[_0x2184('0x26')]=function(_0x36db7f,_0x522c03){return db[_0x2184('0x2b')][_0x2184('0x45')]({'where':{'id':_0x36db7f[_0x2184('0x46')]['id']}})[_0x2184('0x25')](handleEntityNotFound(_0x522c03,null))[_0x2184('0x25')](removeEntity(_0x522c03,null))[_0x2184('0x42')](handleError(_0x522c03,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9e4f9e3..2b55bf7 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 _0x5f2f=['bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x91179c,_0x847ac5){var _0x5ba3cd=function(_0x57627f){while(--_0x57627f){_0x91179c['push'](_0x91179c['shift']());}};_0x5ba3cd(++_0x847ac5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x315d77,_0x74c52d){_0x315d77=_0x315d77-0x0;var _0x8a9e0e=_0x5f2f[_0x315d77];return _0x8a9e0e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xf5f2('0xc'),'fields':[_0xf5f2('0xd'),_0xf5f2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xffd6=['bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x190a8f,_0x40db27){var _0x594b2e=function(_0x1f31f2){while(--_0x1f31f2){_0x190a8f['push'](_0x190a8f['shift']());}};_0x594b2e(++_0x40db27);}(_0xffd6,0x97));var _0x6ffd=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xffd6[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[{'name':_0x6ffd('0xc'),'fields':[_0x6ffd('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a29fc9e..91d7a09 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 _0x13f8=['jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x472301,_0xcfe74b){var _0x1fb2da=function(_0x19416d){while(--_0x19416d){_0x472301['push'](_0x472301['shift']());}};_0x1fb2da(++_0xcfe74b);}(_0x13f8,0x19c));var _0x813f=function(_0x348bdb,_0x41f11d){_0x348bdb=_0x348bdb-0x0;var _0x4480f9=_0x13f8[_0x348bdb];return _0x4480f9;};'use strict';var _=require(_0x813f('0x0'));var util=require(_0x813f('0x1'));var moment=require(_0x813f('0x2'));var BPromise=require('bluebird');var rs=require(_0x813f('0x3'));var fs=require('fs');var Redis=require(_0x813f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x813f('0x5'));var logger=require('../../config/logger')(_0x813f('0x6'));var config=require(_0x813f('0x7'));var jayson=require(_0x813f('0x8'));var client=jayson[_0x813f('0x9')][_0x813f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe4b3,_0x3225b2,_0x57f578){return new BPromise(function(_0x2db727,_0x7ffd3d){return client['request'](_0x2fe4b3,_0x57f578)[_0x813f('0xb')](function(_0x41c3bf){logger[_0x813f('0xc')](_0x813f('0xd'),_0x3225b2,_0x813f('0xe'));logger['debug'](_0x813f('0xf'),_0x3225b2,'request\x20sent',JSON[_0x813f('0x10')](_0x41c3bf));if(_0x41c3bf[_0x813f('0x11')]){if(_0x41c3bf[_0x813f('0x11')]['code']===0x1f4){logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x41c3bf[_0x813f('0x11')][_0x813f('0x12')]);return _0x7ffd3d(_0x41c3bf['error']['message']);}logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x41c3bf[_0x813f('0x11')]['message']);return _0x2db727(_0x41c3bf[_0x813f('0x11')][_0x813f('0x12')]);}else{logger[_0x813f('0xc')](_0x813f('0xd'),_0x3225b2,'request\x20sent');_0x2db727(_0x41c3bf[_0x813f('0x13')][_0x813f('0x12')]);}})[_0x813f('0x14')](function(_0x19620e){logger[_0x813f('0x11')](_0x813f('0xd'),_0x3225b2,_0x19620e);_0x7ffd3d(_0x19620e);});});} \ No newline at end of file +var _0x68c5=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5aadb5,_0x126121){var _0x53ff94=function(_0xc39aed){while(--_0xc39aed){_0x5aadb5['push'](_0x5aadb5['shift']());}};_0x53ff94(++_0x126121);}(_0x68c5,0xd9));var _0x568c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x68c5[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x568c('0x0'));var BPromise=require('bluebird');var rs=require(_0x568c('0x1'));var fs=require('fs');var Redis=require(_0x568c('0x2'));var db=require(_0x568c('0x3'))['db'];var utils=require(_0x568c('0x4'));var logger=require(_0x568c('0x5'))(_0x568c('0x6'));var config=require(_0x568c('0x7'));var jayson=require(_0x568c('0x8'));var client=jayson[_0x568c('0x9')][_0x568c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x286d29,_0x1e0957,_0x349089){return new BPromise(function(_0x24ffde,_0x3038cc){return client['request'](_0x286d29,_0x349089)[_0x568c('0xb')](function(_0x36bffe){logger[_0x568c('0xc')](_0x568c('0xd'),_0x1e0957,_0x568c('0xe'));logger[_0x568c('0xf')](_0x568c('0x10'),_0x1e0957,_0x568c('0xe'),JSON[_0x568c('0x11')](_0x36bffe));if(_0x36bffe[_0x568c('0x12')]){if(_0x36bffe[_0x568c('0x12')][_0x568c('0x13')]===0x1f4){logger[_0x568c('0x12')](_0x568c('0xd'),_0x1e0957,_0x36bffe[_0x568c('0x12')]['message']);return _0x3038cc(_0x36bffe[_0x568c('0x12')][_0x568c('0x14')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1e0957,_0x36bffe[_0x568c('0x12')][_0x568c('0x14')]);return _0x24ffde(_0x36bffe[_0x568c('0x12')][_0x568c('0x14')]);}else{logger['info'](_0x568c('0xd'),_0x1e0957,_0x568c('0xe'));_0x24ffde(_0x36bffe[_0x568c('0x15')][_0x568c('0x14')]);}})[_0x568c('0x16')](function(_0xad94cc){logger[_0x568c('0x12')](_0x568c('0xd'),_0x1e0957,_0xad94cc);_0x3038cc(_0xad94cc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1448b98..ff16517 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2329eb,_0x29ba41){var _0x1cd4c8=function(_0x479280){while(--_0x479280){_0x2329eb['push'](_0x2329eb['shift']());}};_0x1cd4c8(++_0x29ba41);}(_0xe706,0xa3));var _0x6e70=function(_0x50f382,_0x32473c){_0x50f382=_0x50f382-0x0;var _0x16afda=_0xe706[_0x50f382];return _0x16afda;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1ffcbb,_0x190569){var _0x5d7578=function(_0x1acf48){while(--_0x1acf48){_0x1ffcbb['push'](_0x1ffcbb['shift']());}};_0x5d7578(++_0x190569);}(_0xedd9,0xfc));var _0x9edd=function(_0x50b78b,_0x2517b3){_0x50b78b=_0x50b78b-0x0;var _0x1d2f12=_0xedd9[_0x50b78b];return _0x1d2f12;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 300d617..159f1ed 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 _0xca91=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0xca91,0x1d2));var _0x1ca9=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xca91[_0x20845e];return _0x28cf2b;};'use strict';var Sequelize=require(_0x1ca9('0x0'));module[_0x1ca9('0x1')]={'name':{'type':Sequelize[_0x1ca9('0x2')],'allowNull':![],'unique':_0x1ca9('0x3')},'version':{'type':Sequelize[_0x1ca9('0x2')],'allowNull':![],'unique':_0x1ca9('0x3')},'main':{'type':Sequelize[_0x1ca9('0x2')],'defaultValue':_0x1ca9('0x4')},'filename':{'type':Sequelize[_0x1ca9('0x2')]},'path':{'type':Sequelize[_0x1ca9('0x2')]},'type':{'type':Sequelize[_0x1ca9('0x2')]},'size':{'type':Sequelize[_0x1ca9('0x5')]},'active':{'type':Sequelize[_0x1ca9('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x1ca9('0x2')]},'logo':{'type':Sequelize[_0x1ca9('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x1ca9('0x7')},'description':{'type':Sequelize[_0x1ca9('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1ca9('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x4e8d=['exports','STRING','unique_name_and_version','app.js','INTEGER','state','sequelize'];(function(_0x4f0678,_0x4e744c){var _0x1aca6d=function(_0x157389){while(--_0x157389){_0x4f0678['push'](_0x4f0678['shift']());}};_0x1aca6d(++_0x4e744c);}(_0x4e8d,0x11e));var _0xd4e8=function(_0x46b65f,_0x36c690){_0x46b65f=_0x46b65f-0x0;var _0x26086f=_0x4e8d[_0x46b65f];return _0x26086f;};'use strict';var Sequelize=require(_0xd4e8('0x0'));module[_0xd4e8('0x1')]={'name':{'type':Sequelize[_0xd4e8('0x2')],'allowNull':![],'unique':_0xd4e8('0x3')},'version':{'type':Sequelize[_0xd4e8('0x2')],'allowNull':![],'unique':_0xd4e8('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xd4e8('0x4')},'filename':{'type':Sequelize[_0xd4e8('0x2')]},'path':{'type':Sequelize[_0xd4e8('0x2')]},'type':{'type':Sequelize[_0xd4e8('0x2')]},'size':{'type':Sequelize[_0xd4e8('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xd4e8('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xd4e8('0x6')},'description':{'type':Sequelize[_0xd4e8('0x2')]},'title':{'type':Sequelize[_0xd4e8('0x2')]},'remoteUri':{'type':Sequelize[_0xd4e8('0x2')]},'link':{'type':Sequelize[_0xd4e8('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 04f4e2f..e7efb50 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 _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x5496,0x175));var _0x6549=function(_0x3d6177,_0x281716){_0x3d6177=_0x3d6177-0x0;var _0x23ebea=_0x5496[_0x3d6177];return _0x23ebea;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file +var _0x687b=['order','sort','where','filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3a07f5,_0x357c50){var _0x1ae6b9=function(_0x18579e){while(--_0x18579e){_0x3a07f5['push'](_0x3a07f5['shift']());}};_0x1ae6b9(++_0x357c50);}(_0x687b,0x14a));var _0xb687=function(_0x3fc287,_0x5c3f36){_0x3fc287=_0x3fc287-0x0;var _0x33af9f=_0x687b[_0x3fc287];return _0x33af9f;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['Integration'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['Integration']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c8beee3..f054915 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 _0x0c80=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0c80,0x171));var _0x00c8=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0c80[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x00c8('0x0'));var util=require(_0x00c8('0x1'));var logger=require(_0x00c8('0x2'))(_0x00c8('0x3'));var moment=require(_0x00c8('0x4'));var BPromise=require(_0x00c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00c8('0x6'));var rimraf=require(_0x00c8('0x7'));var config=require(_0x00c8('0x8'));var attributes=require(_0x00c8('0x9'));module[_0x00c8('0xa')]=function(_0x4ab3e0,_0x58f85f){return _0x4ab3e0[_0x00c8('0xb')](_0x00c8('0xc'),attributes,{'tableName':_0x00c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2320=['../../config/environment','exports','define','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x56b32c,_0xbbb33e){var _0x3093fe=function(_0x3bc6d1){while(--_0x3bc6d1){_0x56b32c['push'](_0x56b32c['shift']());}};_0x3093fe(++_0xbbb33e);}(_0x2320,0x88));var _0x0232=function(_0x46ab94,_0x1c02a5){_0x46ab94=_0x46ab94-0x0;var _0x33a0ca=_0x2320[_0x46ab94];return _0x33a0ca;};'use strict';var _=require(_0x0232('0x0'));var util=require('util');var logger=require(_0x0232('0x1'))(_0x0232('0x2'));var moment=require(_0x0232('0x3'));var BPromise=require(_0x0232('0x4'));var rp=require(_0x0232('0x5'));var fs=require('fs');var path=require(_0x0232('0x6'));var rimraf=require(_0x0232('0x7'));var config=require(_0x0232('0x8'));var attributes=require('./integration.attributes');module[_0x0232('0x9')]=function(_0x386db9,_0x3697a8){return _0x386db9[_0x0232('0xa')]('Integration',attributes,{'tableName':_0x0232('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 7852028..4347c8a 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0xda2d,0x102));var _0xdda2=function(_0x1f37f1,_0x4ab8a6){_0x1f37f1=_0x1f37f1-0x0;var _0x3a8b60=_0xda2d[_0x1f37f1];return _0x3a8b60;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x23d5e3,_0x15a58f){var _0x79c448=function(_0x1cad04){while(--_0x1cad04){_0x23d5e3['push'](_0x23d5e3['shift']());}};_0x79c448(++_0x15a58f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4ceb367..f843211 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x3577e7,_0x52c55d){var _0xefc8dd=function(_0x51ba0f){while(--_0x51ba0f){_0x3577e7['push'](_0x3577e7['shift']());}};_0xefc8dd(++_0x52c55d);}(_0x5fab,0x177));var _0xb5fa=function(_0x5dfb47,_0x5b158c){_0x5dfb47=_0x5dfb47-0x0;var _0x48c85a=_0x5fab[_0x5dfb47];return _0x48c85a;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x35767b,_0x30280f){var _0x18cb32=function(_0x21639d){while(--_0x21639d){_0x35767b['push'](_0x35767b['shift']());}};_0x18cb32(++_0x30280f);}(_0x4975,0x86));var _0x5497=function(_0x36c7b5,_0x1faebf){_0x36c7b5=_0x36c7b5-0x0;var _0x57afdf=_0x4975[_0x36c7b5];return _0x57afdf;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6cc812e..492e688 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 _0x974a=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','BOOLEAN','DATE'];(function(_0xfcf0e8,_0x244efd){var _0x3646f3=function(_0x443966){while(--_0x443966){_0xfcf0e8['push'](_0xfcf0e8['shift']());}};_0x3646f3(++_0x244efd);}(_0x974a,0x170));var _0xa974=function(_0x577dc1,_0x55b05d){_0x577dc1=_0x577dc1-0x0;var _0x3ee896=_0x974a[_0x577dc1];return _0x3ee896;};'use strict';var Sequelize=require(_0xa974('0x0'));module[_0xa974('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa974('0x2')]},'ticketId':{'type':Sequelize[_0xa974('0x2')]},'integrationId':{'type':Sequelize[_0xa974('0x3')]},'contacts':{'type':Sequelize[_0xa974('0x2')]},'uniqueid':{'type':Sequelize[_0xa974('0x2')]},'calleridnum':{'type':Sequelize[_0xa974('0x2')]},'calleridname':{'type':Sequelize[_0xa974('0x2')]},'queue':{'type':Sequelize[_0xa974('0x2')]},'interface':{'type':Sequelize[_0xa974('0x2')]},'membername':{'type':Sequelize[_0xa974('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa974('0x3')]},'agentcomplete':{'type':Sequelize[_0xa974('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa974('0x5')]},'talktime':{'type':Sequelize[_0xa974('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa974('0x3')]},'reason':{'type':Sequelize[_0xa974('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa974('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa974('0x5')]},'agentdump':{'type':Sequelize[_0xa974('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xa974('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa974('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa974('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa974('0x2')]},'language':{'type':Sequelize[_0xa974('0x2')]},'accountcode':{'type':Sequelize[_0xa974('0x2')]},'context':{'type':Sequelize[_0xa974('0x2')]},'exten':{'type':Sequelize[_0xa974('0x2')]},'priority':{'type':Sequelize[_0xa974('0x2')]},'destchannel':{'type':Sequelize[_0xa974('0x2')]},'destchannelstate':{'type':Sequelize[_0xa974('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa974('0x2')]},'destcalleridname':{'type':Sequelize[_0xa974('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa974('0x2')]},'destlanguage':{'type':Sequelize[_0xa974('0x2')]},'destaccountcode':{'type':Sequelize[_0xa974('0x2')]},'destcontext':{'type':Sequelize[_0xa974('0x2')]},'destexten':{'type':Sequelize[_0xa974('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa974('0x2')]},'messageId':{'type':Sequelize[_0xa974('0x2')]},'inReplyTo':{'type':Sequelize[_0xa974('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xa974('0x2')]},'to':{'type':Sequelize[_0xa974('0x2')]},'cc':{'type':Sequelize[_0xa974('0x2')]},'attachment':{'type':Sequelize[_0xa974('0x6')]},'html':{'type':Sequelize[_0xa974('0x6')]},'text':{'type':Sequelize[_0xa974('0x6')]},'status':{'type':Sequelize[_0xa974('0x7')](_0xa974('0x8'),'SENDING',_0xa974('0x9'),_0xa974('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa974('0x2')]},'appdata':{'type':Sequelize[_0xa974('0x2')]},'projectId':{'type':Sequelize[_0xa974('0x3')]}}; \ No newline at end of file +var _0xc54f=['DATE','BOOLEAN','TEXT','ENUM','RECEIVED','exports','STRING','INTEGER'];(function(_0x52f0d0,_0x23aa44){var _0x1babf8=function(_0x102dbe){while(--_0x102dbe){_0x52f0d0['push'](_0x52f0d0['shift']());}};_0x1babf8(++_0x23aa44);}(_0xc54f,0x75));var _0xfc54=function(_0xeae53d,_0x3d74ba){_0xeae53d=_0xeae53d-0x0;var _0x974b50=_0xc54f[_0xeae53d];return _0x974b50;};'use strict';var Sequelize=require('sequelize');module[_0xfc54('0x0')]={'integration':{'type':Sequelize[_0xfc54('0x1')]},'eventChannel':{'type':Sequelize[_0xfc54('0x1')]},'exitStatus':{'type':Sequelize[_0xfc54('0x1')]},'ticketId':{'type':Sequelize[_0xfc54('0x1')]},'integrationId':{'type':Sequelize[_0xfc54('0x2')]},'contacts':{'type':Sequelize[_0xfc54('0x1')]},'uniqueid':{'type':Sequelize[_0xfc54('0x1')]},'calleridnum':{'type':Sequelize[_0xfc54('0x1')]},'calleridname':{'type':Sequelize[_0xfc54('0x1')]},'queue':{'type':Sequelize[_0xfc54('0x1')]},'interface':{'type':Sequelize[_0xfc54('0x1')]},'membername':{'type':Sequelize[_0xfc54('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfc54('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfc54('0x3')]},'holdtime':{'type':Sequelize[_0xfc54('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfc54('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfc54('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfc54('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xfc54('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xfc54('0x3')]},'agentdump':{'type':Sequelize[_0xfc54('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xfc54('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfc54('0x1')]},'channelstate':{'type':Sequelize[_0xfc54('0x2')]},'channelstatedesc':{'type':Sequelize[_0xfc54('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfc54('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfc54('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfc54('0x1')]},'destchannel':{'type':Sequelize[_0xfc54('0x1')]},'destchannelstate':{'type':Sequelize[_0xfc54('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xfc54('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfc54('0x1')]},'destcalleridname':{'type':Sequelize[_0xfc54('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfc54('0x1')]},'destlanguage':{'type':Sequelize[_0xfc54('0x1')]},'destaccountcode':{'type':Sequelize[_0xfc54('0x1')]},'destcontext':{'type':Sequelize[_0xfc54('0x1')]},'destexten':{'type':Sequelize[_0xfc54('0x1')]},'destpriority':{'type':Sequelize[_0xfc54('0x1')]},'destuniqueid':{'type':Sequelize[_0xfc54('0x1')]},'messageId':{'type':Sequelize[_0xfc54('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xfc54('0x1')]},'from':{'type':Sequelize[_0xfc54('0x1')]},'to':{'type':Sequelize[_0xfc54('0x1')]},'cc':{'type':Sequelize[_0xfc54('0x1')]},'attachment':{'type':Sequelize[_0xfc54('0x5')]},'html':{'type':Sequelize[_0xfc54('0x5')]},'text':{'type':Sequelize[_0xfc54('0x5')]},'status':{'type':Sequelize[_0xfc54('0x6')]('SENT','SENDING',_0xfc54('0x7'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xfc54('0x1')]},'projectId':{'type':Sequelize[_0xfc54('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2bcb60c..3fa97b7 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 _0x9d39=['map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','eml-format','rimraf','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9d39,0xff));var _0x99d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d39[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x99d3('0x0'));var rimraf=require(_0x99d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x99d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99d3('0x3'));var util=require(_0x99d3('0x4'));var path=require('path');var sox=require(_0x99d3('0x5'));var csv=require('to-csv');var ejs=require(_0x99d3('0x6'));var fs=require('fs');var fs_extra=require(_0x99d3('0x7'));var _=require(_0x99d3('0x8'));var squel=require(_0x99d3('0x9'));var crypto=require(_0x99d3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x99d3('0xb'));var toCsv=require(_0x99d3('0xc'));var querystring=require(_0x99d3('0xd'));var Papa=require('papaparse');var Redis=require(_0x99d3('0xe'));var authService=require(_0x99d3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x99d3('0x10'));var hardwareService=require(_0x99d3('0x11'));var logger=require('../../config/logger')(_0x99d3('0x12'));var utils=require(_0x99d3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x99d3('0x14'));var db=require(_0x99d3('0x15'))['db'];function respondWithStatusCode(_0x34ecea,_0x29c660){_0x29c660=_0x29c660||0xcc;return function(_0x28e3a4){if(_0x28e3a4){return _0x34ecea[_0x99d3('0x16')](_0x29c660);}return _0x34ecea[_0x99d3('0x17')](_0x29c660)[_0x99d3('0x18')]();};}function respondWithResult(_0x6a7805,_0x3370a3){_0x3370a3=_0x3370a3||0xc8;return function(_0x15afe6){if(_0x15afe6){return _0x6a7805[_0x99d3('0x17')](_0x3370a3)[_0x99d3('0x19')](_0x15afe6);}};}function respondWithFilteredResult(_0x364a1f,_0x434ecb){return function(_0x5c4bba){if(_0x5c4bba){var _0x4f8934=typeof _0x434ecb[_0x99d3('0x1a')]===_0x99d3('0x1b')&&typeof _0x434ecb[_0x99d3('0x1c')]===_0x99d3('0x1b');var _0x3195b9=_0x5c4bba[_0x99d3('0x1d')];var _0x449f50=_0x4f8934?0x0:_0x434ecb[_0x99d3('0x1a')];var _0x46d018=_0x4f8934?_0x5c4bba[_0x99d3('0x1d')]:_0x434ecb[_0x99d3('0x1a')]+_0x434ecb['limit'];var _0x8e87e6;if(_0x46d018>=_0x3195b9){_0x46d018=_0x3195b9;_0x8e87e6=0xc8;}else{_0x8e87e6=0xce;}_0x364a1f[_0x99d3('0x17')](_0x8e87e6);return _0x364a1f[_0x99d3('0x1e')](_0x99d3('0x1f'),_0x449f50+'-'+_0x46d018+'/'+_0x3195b9)['json'](_0x5c4bba);}return null;};}function patchUpdates(_0x1bad76){return function(_0x5311e6){try{jsonpatch['apply'](_0x5311e6,_0x1bad76,!![]);}catch(_0x3f4d71){return BPromise[_0x99d3('0x20')](_0x3f4d71);}return _0x5311e6[_0x99d3('0x21')]();};}function saveUpdates(_0x1464fc,_0x443c3e){return function(_0x445c5c){if(_0x445c5c){return _0x445c5c['update'](_0x1464fc)['then'](function(_0x177a1f){return _0x177a1f;});}return null;};}function removeEntity(_0x341b46,_0x573b89){return function(_0x21d157){if(_0x21d157){return _0x21d157[_0x99d3('0x22')]()['then'](function(){_0x341b46[_0x99d3('0x17')](0xcc)[_0x99d3('0x18')]();});}};}function handleEntityNotFound(_0x10ccc3,_0x298b2f){return function(_0x14bf59){if(!_0x14bf59){_0x10ccc3[_0x99d3('0x16')](0x194);}return _0x14bf59;};}function handleError(_0x5ac4a7,_0x24f74d){_0x24f74d=_0x24f74d||0x1f4;return function(_0x3d1576){logger[_0x99d3('0x23')](_0x3d1576[_0x99d3('0x24')]);if(_0x3d1576['name']){delete _0x3d1576[_0x99d3('0x25')];}_0x5ac4a7[_0x99d3('0x17')](_0x24f74d)[_0x99d3('0x26')](_0x3d1576);};}exports[_0x99d3('0x27')]=function(_0x49684b,_0x4227ac){var _0x3bed50={},_0x6b787b={},_0x2c28fb={'count':0x0,'rows':[]};var _0x337846=_['map'](db[_0x99d3('0x28')][_0x99d3('0x29')],function(_0x36c7b6){return{'name':_0x36c7b6[_0x99d3('0x2a')],'type':_0x36c7b6[_0x99d3('0x2b')][_0x99d3('0x2c')]};});_0x6b787b['model']=_[_0x99d3('0x2d')](_0x337846,'name');_0x6b787b['query']=_[_0x99d3('0x2e')](_0x49684b[_0x99d3('0x2f')]);_0x6b787b['filters']=_[_0x99d3('0x30')](_0x6b787b[_0x99d3('0x31')],_0x6b787b['query']);_0x3bed50[_0x99d3('0x32')]=_['intersection'](_0x6b787b['model'],qs[_0x99d3('0x33')](_0x49684b[_0x99d3('0x2f')][_0x99d3('0x33')]));_0x3bed50['attributes']=_0x3bed50[_0x99d3('0x32')][_0x99d3('0x34')]?_0x3bed50[_0x99d3('0x32')]:_0x6b787b[_0x99d3('0x31')];if(!_0x49684b['query'][_0x99d3('0x35')](_0x99d3('0x36'))){_0x3bed50[_0x99d3('0x1c')]=qs['limit'](_0x49684b[_0x99d3('0x2f')][_0x99d3('0x1c')]);_0x3bed50[_0x99d3('0x1a')]=qs[_0x99d3('0x1a')](_0x49684b[_0x99d3('0x2f')][_0x99d3('0x1a')]);}_0x3bed50['order']=qs[_0x99d3('0x37')](_0x49684b[_0x99d3('0x2f')][_0x99d3('0x37')]);_0x3bed50[_0x99d3('0x38')]=qs[_0x99d3('0x39')](_['pick'](_0x49684b[_0x99d3('0x2f')],_0x6b787b[_0x99d3('0x39')]),_0x337846);if(_0x49684b[_0x99d3('0x2f')]['filter']){_0x3bed50[_0x99d3('0x38')]=_[_0x99d3('0x3a')](_0x3bed50[_0x99d3('0x38')],{'$or':_[_0x99d3('0x2d')](_0x337846,function(_0x3b1363){if(_0x3b1363[_0x99d3('0x2b')]!==_0x99d3('0x3b')){var _0xd7cb19={};_0xd7cb19[_0x3b1363[_0x99d3('0x25')]]={'$like':'%'+_0x49684b['query'][_0x99d3('0x3c')]+'%'};return _0xd7cb19;}})});}_0x3bed50=_[_0x99d3('0x3a')]({},_0x3bed50,_0x49684b[_0x99d3('0x3d')]);var _0xb19646={'where':_0x3bed50[_0x99d3('0x38')]};return db['IntegrationReport']['count'](_0xb19646)[_0x99d3('0x3e')](function(_0x4b5fde){_0x2c28fb[_0x99d3('0x1d')]=_0x4b5fde;if(_0x49684b[_0x99d3('0x2f')][_0x99d3('0x3f')]){_0x3bed50[_0x99d3('0x40')]=[{'all':!![]}];}return db[_0x99d3('0x28')][_0x99d3('0x41')](_0x3bed50);})['then'](function(_0x1d21a4){_0x2c28fb[_0x99d3('0x42')]=_0x1d21a4;return _0x2c28fb;})[_0x99d3('0x3e')](respondWithFilteredResult(_0x4227ac,_0x3bed50))['catch'](handleError(_0x4227ac,null));};exports[_0x99d3('0x43')]=function(_0x279490,_0x3e3673){var _0x335004={'raw':![],'where':{'id':_0x279490[_0x99d3('0x44')]['id']}},_0x36d4ff={};_0x36d4ff[_0x99d3('0x31')]=_['keys'](db[_0x99d3('0x28')]['rawAttributes']);_0x36d4ff[_0x99d3('0x2f')]=_[_0x99d3('0x2e')](_0x279490['query']);_0x36d4ff[_0x99d3('0x39')]=_[_0x99d3('0x30')](_0x36d4ff[_0x99d3('0x31')],_0x36d4ff[_0x99d3('0x2f')]);_0x335004['attributes']=_[_0x99d3('0x30')](_0x36d4ff[_0x99d3('0x31')],qs[_0x99d3('0x33')](_0x279490[_0x99d3('0x2f')][_0x99d3('0x33')]));_0x335004[_0x99d3('0x32')]=_0x335004['attributes'][_0x99d3('0x34')]?_0x335004[_0x99d3('0x32')]:_0x36d4ff[_0x99d3('0x31')];if(_0x279490['query'][_0x99d3('0x3f')]){_0x335004['include']=[{'all':!![]}];}_0x335004=_[_0x99d3('0x3a')]({},_0x335004,_0x279490[_0x99d3('0x3d')]);return db['IntegrationReport'][_0x99d3('0x45')](_0x335004)['then'](handleEntityNotFound(_0x3e3673,null))[_0x99d3('0x3e')](respondWithResult(_0x3e3673,null))['catch'](handleError(_0x3e3673,null));};exports[_0x99d3('0x46')]=function(_0x34d98f,_0x4680f5){return db[_0x99d3('0x28')][_0x99d3('0x46')](_0x34d98f[_0x99d3('0x47')],{})[_0x99d3('0x3e')](respondWithResult(_0x4680f5,0xc9))['catch'](handleError(_0x4680f5,null));};exports[_0x99d3('0x48')]=function(_0xf3cfd1,_0x26638a){if(_0xf3cfd1['body']['id']){delete _0xf3cfd1[_0x99d3('0x47')]['id'];}return db[_0x99d3('0x28')][_0x99d3('0x45')]({'where':{'id':_0xf3cfd1[_0x99d3('0x44')]['id']}})[_0x99d3('0x3e')](handleEntityNotFound(_0x26638a,null))['then'](saveUpdates(_0xf3cfd1[_0x99d3('0x47')],null))['then'](respondWithResult(_0x26638a,null))['catch'](handleError(_0x26638a,null));};exports[_0x99d3('0x22')]=function(_0x1a081f,_0x141933){return db[_0x99d3('0x28')][_0x99d3('0x45')]({'where':{'id':_0x1a081f[_0x99d3('0x44')]['id']}})[_0x99d3('0x3e')](handleEntityNotFound(_0x141933,null))[_0x99d3('0x3e')](removeEntity(_0x141933,null))[_0x99d3('0x49')](handleError(_0x141933,null));};exports[_0x99d3('0x4a')]=function(_0x9ef7e1,_0x5af9d8){return db[_0x99d3('0x28')][_0x99d3('0x4a')]()[_0x99d3('0x3e')](respondWithResult(_0x5af9d8,null))[_0x99d3('0x49')](handleError(_0x5af9d8,null));}; \ No newline at end of file +var _0x8fa4=['filter','type','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','apply','destroy','then','end','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8fa4,0x99));var _0x48fa=function(_0x216ec0,_0x57d2a2){_0x216ec0=_0x216ec0-0x0;var _0x599ff2=_0x8fa4[_0x216ec0];return _0x599ff2;};'use strict';var emlformat=require(_0x48fa('0x0'));var rimraf=require(_0x48fa('0x1'));var zipdir=require(_0x48fa('0x2'));var jsonpatch=require(_0x48fa('0x3'));var rp=require(_0x48fa('0x4'));var moment=require(_0x48fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x48fa('0x6'));var util=require('util');var path=require('path');var sox=require(_0x48fa('0x7'));var csv=require('to-csv');var ejs=require(_0x48fa('0x8'));var fs=require('fs');var fs_extra=require(_0x48fa('0x9'));var _=require(_0x48fa('0xa'));var squel=require('squel');var crypto=require(_0x48fa('0xb'));var jsforce=require(_0x48fa('0xc'));var deskjs=require(_0x48fa('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x48fa('0xe'));var Redis=require(_0x48fa('0xf'));var authService=require(_0x48fa('0x10'));var qs=require(_0x48fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48fa('0x12'));var logger=require('../../config/logger')(_0x48fa('0x13'));var utils=require(_0x48fa('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6c27,_0x633a1c){_0x633a1c=_0x633a1c||0xcc;return function(_0x32aac1){if(_0x32aac1){return _0x5d6c27[_0x48fa('0x15')](_0x633a1c);}return _0x5d6c27[_0x48fa('0x16')](_0x633a1c)['end']();};}function respondWithResult(_0xcdfb69,_0x1b0774){_0x1b0774=_0x1b0774||0xc8;return function(_0x284177){if(_0x284177){return _0xcdfb69[_0x48fa('0x16')](_0x1b0774)[_0x48fa('0x17')](_0x284177);}};}function respondWithFilteredResult(_0x68fc8e,_0x14f77a){return function(_0x183641){if(_0x183641){var _0x22fcc8=typeof _0x14f77a[_0x48fa('0x18')]==='undefined'&&typeof _0x14f77a[_0x48fa('0x19')]===_0x48fa('0x1a');var _0x68718d=_0x183641[_0x48fa('0x1b')];var _0x5eb27f=_0x22fcc8?0x0:_0x14f77a[_0x48fa('0x18')];var _0xfee105=_0x22fcc8?_0x183641[_0x48fa('0x1b')]:_0x14f77a[_0x48fa('0x18')]+_0x14f77a[_0x48fa('0x19')];var _0x37105d;if(_0xfee105>=_0x68718d){_0xfee105=_0x68718d;_0x37105d=0xc8;}else{_0x37105d=0xce;}_0x68fc8e['status'](_0x37105d);return _0x68fc8e[_0x48fa('0x1c')]('Content-Range',_0x5eb27f+'-'+_0xfee105+'/'+_0x68718d)[_0x48fa('0x17')](_0x183641);}return null;};}function patchUpdates(_0x48bbce){return function(_0x4fe534){try{jsonpatch[_0x48fa('0x1d')](_0x4fe534,_0x48bbce,!![]);}catch(_0x13086b){return BPromise['reject'](_0x13086b);}return _0x4fe534['save']();};}function saveUpdates(_0x3d2314,_0x49c525){return function(_0x1ad87c){if(_0x1ad87c){return _0x1ad87c['update'](_0x3d2314)['then'](function(_0x5db4b1){return _0x5db4b1;});}return null;};}function removeEntity(_0x2e5915,_0x42bafa){return function(_0x2198ea){if(_0x2198ea){return _0x2198ea[_0x48fa('0x1e')]()[_0x48fa('0x1f')](function(){_0x2e5915['status'](0xcc)[_0x48fa('0x20')]();});}};}function handleEntityNotFound(_0x8c17ec,_0x1764ae){return function(_0x110032){if(!_0x110032){_0x8c17ec[_0x48fa('0x15')](0x194);}return _0x110032;};}function handleError(_0x25dfd4,_0x57d21c){_0x57d21c=_0x57d21c||0x1f4;return function(_0x49f5f3){logger[_0x48fa('0x21')](_0x49f5f3[_0x48fa('0x22')]);if(_0x49f5f3[_0x48fa('0x23')]){delete _0x49f5f3['name'];}_0x25dfd4['status'](_0x57d21c)[_0x48fa('0x24')](_0x49f5f3);};}exports['index']=function(_0x179aa0,_0x1a88c6){var _0xa38bed={},_0x23da27={},_0x26b67e={'count':0x0,'rows':[]};var _0x19e805=_[_0x48fa('0x25')](db[_0x48fa('0x26')][_0x48fa('0x27')],function(_0x2095df){return{'name':_0x2095df[_0x48fa('0x28')],'type':_0x2095df['type'][_0x48fa('0x29')]};});_0x23da27[_0x48fa('0x2a')]=_[_0x48fa('0x25')](_0x19e805,_0x48fa('0x23'));_0x23da27[_0x48fa('0x2b')]=_[_0x48fa('0x2c')](_0x179aa0[_0x48fa('0x2b')]);_0x23da27[_0x48fa('0x2d')]=_['intersection'](_0x23da27[_0x48fa('0x2a')],_0x23da27[_0x48fa('0x2b')]);_0xa38bed[_0x48fa('0x2e')]=_['intersection'](_0x23da27[_0x48fa('0x2a')],qs[_0x48fa('0x2f')](_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x2f')]));_0xa38bed[_0x48fa('0x2e')]=_0xa38bed[_0x48fa('0x2e')][_0x48fa('0x30')]?_0xa38bed[_0x48fa('0x2e')]:_0x23da27['model'];if(!_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x31')](_0x48fa('0x32'))){_0xa38bed[_0x48fa('0x19')]=qs[_0x48fa('0x19')](_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x19')]);_0xa38bed[_0x48fa('0x18')]=qs['offset'](_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x18')]);}_0xa38bed[_0x48fa('0x33')]=qs[_0x48fa('0x34')](_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x34')]);_0xa38bed[_0x48fa('0x35')]=qs[_0x48fa('0x2d')](_['pick'](_0x179aa0['query'],_0x23da27['filters']),_0x19e805);if(_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x36')]){_0xa38bed[_0x48fa('0x35')]=_['merge'](_0xa38bed[_0x48fa('0x35')],{'$or':_[_0x48fa('0x25')](_0x19e805,function(_0x1737dd){if(_0x1737dd[_0x48fa('0x37')]!=='VIRTUAL'){var _0x40d790={};_0x40d790[_0x1737dd[_0x48fa('0x23')]]={'$like':'%'+_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x36')]+'%'};return _0x40d790;}})});}_0xa38bed=_[_0x48fa('0x38')]({},_0xa38bed,_0x179aa0[_0x48fa('0x39')]);var _0x24e490={'where':_0xa38bed[_0x48fa('0x35')]};return db[_0x48fa('0x26')][_0x48fa('0x1b')](_0x24e490)[_0x48fa('0x1f')](function(_0x4f53df){_0x26b67e[_0x48fa('0x1b')]=_0x4f53df;if(_0x179aa0[_0x48fa('0x2b')][_0x48fa('0x3a')]){_0xa38bed[_0x48fa('0x3b')]=[{'all':!![]}];}return db[_0x48fa('0x26')][_0x48fa('0x3c')](_0xa38bed);})[_0x48fa('0x1f')](function(_0x582144){_0x26b67e[_0x48fa('0x3d')]=_0x582144;return _0x26b67e;})['then'](respondWithFilteredResult(_0x1a88c6,_0xa38bed))[_0x48fa('0x3e')](handleError(_0x1a88c6,null));};exports[_0x48fa('0x3f')]=function(_0x2eb167,_0x221f98){var _0x20801e={'raw':![],'where':{'id':_0x2eb167['params']['id']}},_0x187c2d={};_0x187c2d[_0x48fa('0x2a')]=_[_0x48fa('0x2c')](db['IntegrationReport'][_0x48fa('0x27')]);_0x187c2d[_0x48fa('0x2b')]=_[_0x48fa('0x2c')](_0x2eb167[_0x48fa('0x2b')]);_0x187c2d[_0x48fa('0x2d')]=_['intersection'](_0x187c2d[_0x48fa('0x2a')],_0x187c2d['query']);_0x20801e['attributes']=_['intersection'](_0x187c2d['model'],qs[_0x48fa('0x2f')](_0x2eb167[_0x48fa('0x2b')][_0x48fa('0x2f')]));_0x20801e[_0x48fa('0x2e')]=_0x20801e[_0x48fa('0x2e')][_0x48fa('0x30')]?_0x20801e[_0x48fa('0x2e')]:_0x187c2d['model'];if(_0x2eb167[_0x48fa('0x2b')][_0x48fa('0x3a')]){_0x20801e[_0x48fa('0x3b')]=[{'all':!![]}];}_0x20801e=_[_0x48fa('0x38')]({},_0x20801e,_0x2eb167[_0x48fa('0x39')]);return db['IntegrationReport'][_0x48fa('0x40')](_0x20801e)[_0x48fa('0x1f')](handleEntityNotFound(_0x221f98,null))[_0x48fa('0x1f')](respondWithResult(_0x221f98,null))[_0x48fa('0x3e')](handleError(_0x221f98,null));};exports[_0x48fa('0x41')]=function(_0x4f0b96,_0x190f0b){return db['IntegrationReport'][_0x48fa('0x41')](_0x4f0b96[_0x48fa('0x42')],{})[_0x48fa('0x1f')](respondWithResult(_0x190f0b,0xc9))[_0x48fa('0x3e')](handleError(_0x190f0b,null));};exports['update']=function(_0x18ed6f,_0x12f013){if(_0x18ed6f[_0x48fa('0x42')]['id']){delete _0x18ed6f[_0x48fa('0x42')]['id'];}return db[_0x48fa('0x26')][_0x48fa('0x40')]({'where':{'id':_0x18ed6f[_0x48fa('0x43')]['id']}})[_0x48fa('0x1f')](handleEntityNotFound(_0x12f013,null))['then'](saveUpdates(_0x18ed6f['body'],null))[_0x48fa('0x1f')](respondWithResult(_0x12f013,null))[_0x48fa('0x3e')](handleError(_0x12f013,null));};exports['destroy']=function(_0x4f15d8,_0x2635e5){return db['IntegrationReport'][_0x48fa('0x40')]({'where':{'id':_0x4f15d8['params']['id']}})[_0x48fa('0x1f')](handleEntityNotFound(_0x2635e5,null))[_0x48fa('0x1f')](removeEntity(_0x2635e5,null))[_0x48fa('0x3e')](handleError(_0x2635e5,null));};exports[_0x48fa('0x44')]=function(_0x203440,_0x49dbe7){return db[_0x48fa('0x26')]['describe']()[_0x48fa('0x1f')](respondWithResult(_0x49dbe7,null))[_0x48fa('0x3e')](handleError(_0x49dbe7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 380834a..e18ab82 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 _0x2788=['util','api','moment','request-promise','path','./integrationReport.attributes','exports','report_integration','lodash'];(function(_0x2adc7b,_0x341840){var _0x410e1a=function(_0x371ae0){while(--_0x371ae0){_0x2adc7b['push'](_0x2adc7b['shift']());}};_0x410e1a(++_0x341840);}(_0x2788,0x19d));var _0x8278=function(_0x14e254,_0x19ef9b){_0x14e254=_0x14e254-0x0;var _0x58b40b=_0x2788[_0x14e254];return _0x58b40b;};'use strict';var _=require(_0x8278('0x0'));var util=require(_0x8278('0x1'));var logger=require('../../config/logger')(_0x8278('0x2'));var moment=require(_0x8278('0x3'));var BPromise=require('bluebird');var rp=require(_0x8278('0x4'));var fs=require('fs');var path=require(_0x8278('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8278('0x6'));module[_0x8278('0x7')]=function(_0x4b1a51,_0x5ef37e){return _0x4b1a51['define']('IntegrationReport',attributes,{'tableName':_0x8278('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45d7=['bluebird','request-promise','rimraf','IntegrationReport','report_integration','lodash'];(function(_0x404051,_0x27e871){var _0x58b8c5=function(_0x4f3697){while(--_0x4f3697){_0x404051['push'](_0x404051['shift']());}};_0x58b8c5(++_0x27e871);}(_0x45d7,0x77));var _0x745d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x45d7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x745d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x745d('0x1'));var rp=require(_0x745d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x745d('0x3'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x4aee4f,_0x4c99d6){return _0x4aee4f['define'](_0x745d('0x4'),attributes,{'tableName':_0x745d('0x5'),'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 749d4f8..d99b536 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\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(_0x248374,_0x5cae89){var _0x34e224=function(_0x3773ed){while(--_0x3773ed){_0x248374['push'](_0x248374['shift']());}};_0x34e224(++_0x5cae89);}(_0x2542,0x169));var _0x2254=function(_0x22fe38,_0x3d5c00){_0x22fe38=_0x22fe38-0x0;var _0x3ec055=_0x2542[_0x22fe38];return _0x3ec055;};'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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5a5a28,_0x3c2085){var _0x2bf498=function(_0x3fd7c0){while(--_0x3fd7c0){_0x5a5a28['push'](_0x5a5a28['shift']());}};_0x2bf498(++_0x3c2085);}(_0x1261,0x144));var _0x1126=function(_0x517869,_0x1f383b){_0x517869=_0x517869-0x0;var _0x2e6dd7=_0x1261[_0x517869];return _0x2e6dd7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f0f5232..3f44dda 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 _0xf903=['../../components/interaction/service','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0xf903,0x10b));var _0x3f90=function(_0x1633a0,_0x3cdfc1){_0x1633a0=_0x1633a0-0x0;var _0x523846=_0xf903[_0x1633a0];return _0x523846;};'use strict';var multer=require('multer');var util=require(_0x3f90('0x0'));var path=require(_0x3f90('0x1'));var timeout=require(_0x3f90('0x2'));var express=require('express');var router=express[_0x3f90('0x3')]();var fs_extra=require(_0x3f90('0x4'));var auth=require(_0x3f90('0x5'));var interaction=require(_0x3f90('0x6'));var config=require('../../config/environment');var controller=require(_0x3f90('0x7'));router[_0x3f90('0x8')]('/',auth[_0x3f90('0x9')](),controller['index']);router[_0x3f90('0x8')](_0x3f90('0xa'),auth[_0x3f90('0x9')](),controller[_0x3f90('0xb')]);router['get'](_0x3f90('0xc'),auth[_0x3f90('0x9')](),controller['getIntervals']);router[_0x3f90('0xd')]('/',auth[_0x3f90('0x9')](),controller[_0x3f90('0xe')]);router[_0x3f90('0xd')](_0x3f90('0xc'),auth[_0x3f90('0x9')](),controller['addInterval']);router[_0x3f90('0xd')](_0x3f90('0xf'),auth['isAuthenticated'](),controller[_0x3f90('0x10')]);router[_0x3f90('0x11')](_0x3f90('0xa'),auth[_0x3f90('0x9')](),controller[_0x3f90('0x12')]);router['delete'](_0x3f90('0xa'),auth['isAuthenticated'](),controller[_0x3f90('0x13')]);module[_0x3f90('0x14')]=router; \ No newline at end of file +var _0x3eea=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','addIntervals','put','update'];(function(_0x56e7c1,_0x450309){var _0x5cd72e=function(_0x1dd0b8){while(--_0x1dd0b8){_0x56e7c1['push'](_0x56e7c1['shift']());}};_0x5cd72e(++_0x450309);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5915fd,_0x2b41c5){_0x5915fd=_0x5915fd-0x0;var _0x1c2beb=_0x3eea[_0x5915fd];return _0x1c2beb;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['get'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router['post']('/',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id/sub_intervals',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x12')]);router['post']('/:id/sub_intervals/create_many',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x13')]);router[_0xa3ee('0x14')](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0x15')]);router['delete'](_0xa3ee('0xc'),auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x16')]);module[_0xa3ee('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cbb25ea..43c95dd 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 _0xaadd=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaadd,0xb9));var _0xdaad=function(_0x4b8b81,_0x34f111){_0x4b8b81=_0x4b8b81-0x0;var _0xed7d61=_0xaadd[_0x4b8b81];return _0xed7d61;};'use strict';var Sequelize=require(_0xdaad('0x0'));module[_0xdaad('0x1')]={'name':{'type':Sequelize[_0xdaad('0x2')]},'description':{'type':Sequelize[_0xdaad('0x2')]},'interval':{'type':Sequelize[_0xdaad('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x456e=['exports','STRING','sequelize'];(function(_0x42ac39,_0x3fe106){var _0x4a2c40=function(_0x3bab0d){while(--_0x3bab0d){_0x42ac39['push'](_0x42ac39['shift']());}};_0x4a2c40(++_0x3fe106);}(_0x456e,0x17c));var _0xe456=function(_0x52b6ba,_0x2fdc17){_0x52b6ba=_0x52b6ba-0x0;var _0x3d36e1=_0x456e[_0x52b6ba];return _0x3d36e1;};'use strict';var Sequelize=require(_0xe456('0x0'));module[_0xe456('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe456('0x2')]},'interval':{'type':Sequelize[_0xe456('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 3927e36..3fbc6f3 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 _0xd1cd=['include','rows','show','keys','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','body','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','stack','name','map','Interval','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options'];(function(_0x181204,_0x532d91){var _0x3a1544=function(_0x1eabcf){while(--_0x1eabcf){_0x181204['push'](_0x181204['shift']());}};_0x3a1544(++_0x532d91);}(_0xd1cd,0x127));var _0xdd1c=function(_0x54682b,_0x4f31c8){_0x54682b=_0x54682b-0x0;var _0x3e43c5=_0xd1cd[_0x54682b];return _0x3e43c5;};'use strict';var emlformat=require(_0xdd1c('0x0'));var rimraf=require(_0xdd1c('0x1'));var zipdir=require(_0xdd1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd1c('0x3'));var BPromise=require(_0xdd1c('0x4'));var Mustache=require(_0xdd1c('0x5'));var util=require(_0xdd1c('0x6'));var path=require(_0xdd1c('0x7'));var sox=require(_0xdd1c('0x8'));var csv=require(_0xdd1c('0x9'));var ejs=require(_0xdd1c('0xa'));var fs=require('fs');var fs_extra=require(_0xdd1c('0xb'));var _=require('lodash');var squel=require(_0xdd1c('0xc'));var crypto=require(_0xdd1c('0xd'));var jsforce=require(_0xdd1c('0xe'));var deskjs=require(_0xdd1c('0xf'));var toCsv=require(_0xdd1c('0x9'));var querystring=require(_0xdd1c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd1c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd1c('0x12'));var logger=require(_0xdd1c('0x13'))(_0xdd1c('0x14'));var utils=require(_0xdd1c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdd1c('0x16'));var db=require(_0xdd1c('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x436a46,_0x3b0ce9){_0x3b0ce9=_0x3b0ce9||0xcc;return function(_0x4c09da){if(_0x4c09da){return _0x436a46['sendStatus'](_0x3b0ce9);}return _0x436a46[_0xdd1c('0x18')](_0x3b0ce9)[_0xdd1c('0x19')]();};}function respondWithResult(_0x48debc,_0x1bbb7d){_0x1bbb7d=_0x1bbb7d||0xc8;return function(_0x1d2f03){if(_0x1d2f03){return _0x48debc[_0xdd1c('0x18')](_0x1bbb7d)['json'](_0x1d2f03);}};}function respondWithFilteredResult(_0x29dcc9,_0x2b2f87){return function(_0x3a2a50){if(_0x3a2a50){var _0x238c06=typeof _0x2b2f87[_0xdd1c('0x1a')]===_0xdd1c('0x1b')&&typeof _0x2b2f87['limit']===_0xdd1c('0x1b');var _0x313637=_0x3a2a50['count'];var _0x338175=_0x238c06?0x0:_0x2b2f87[_0xdd1c('0x1a')];var _0x40c01d=_0x238c06?_0x3a2a50[_0xdd1c('0x1c')]:_0x2b2f87[_0xdd1c('0x1a')]+_0x2b2f87[_0xdd1c('0x1d')];var _0x18cb80;if(_0x40c01d>=_0x313637){_0x40c01d=_0x313637;_0x18cb80=0xc8;}else{_0x18cb80=0xce;}_0x29dcc9[_0xdd1c('0x18')](_0x18cb80);return _0x29dcc9[_0xdd1c('0x1e')](_0xdd1c('0x1f'),_0x338175+'-'+_0x40c01d+'/'+_0x313637)[_0xdd1c('0x20')](_0x3a2a50);}return null;};}function patchUpdates(_0x1bff98){return function(_0x291e39){try{jsonpatch[_0xdd1c('0x21')](_0x291e39,_0x1bff98,!![]);}catch(_0x3ee9a1){return BPromise['reject'](_0x3ee9a1);}return _0x291e39[_0xdd1c('0x22')]();};}function saveUpdates(_0x557977,_0xe30abd){return function(_0x4d0d4b){if(_0x4d0d4b){return _0x4d0d4b['update'](_0x557977)[_0xdd1c('0x23')](function(_0x1ab740){return _0x1ab740;});}return null;};}function removeEntity(_0x23d459,_0x25abc8){return function(_0x5692c1){if(_0x5692c1){return _0x5692c1[_0xdd1c('0x24')]()[_0xdd1c('0x23')](function(){var _0x4ed264=_0x5692c1[_0xdd1c('0x25')]({'plain':!![]});var _0x3d481f=_0xdd1c('0x26');return db[_0xdd1c('0x27')][_0xdd1c('0x24')]({'where':{'type':_0x3d481f,'resourceId':_0x4ed264['id']}})[_0xdd1c('0x23')](function(){return _0x5692c1;});})[_0xdd1c('0x23')](function(){_0x23d459[_0xdd1c('0x18')](0xcc)[_0xdd1c('0x19')]();});}};}function handleEntityNotFound(_0x4be5f3,_0x3bcda5){return function(_0xb28db0){if(!_0xb28db0){_0x4be5f3[_0xdd1c('0x28')](0x194);}return _0xb28db0;};}function handleError(_0xb5d7dd,_0x44c852){_0x44c852=_0x44c852||0x1f4;return function(_0x4b4175){logger[_0xdd1c('0x29')](_0x4b4175[_0xdd1c('0x2a')]);if(_0x4b4175[_0xdd1c('0x2b')]){delete _0x4b4175[_0xdd1c('0x2b')];}_0xb5d7dd['status'](_0x44c852)['send'](_0x4b4175);};}exports['index']=function(_0xa5ea2b,_0x4a268d){var _0x1f52e9={},_0x3b3f53={},_0x123693={'count':0x0,'rows':[]};var _0x20abb7=_[_0xdd1c('0x2c')](db[_0xdd1c('0x2d')][_0xdd1c('0x2e')],function(_0x5cd30d){return{'name':_0x5cd30d['fieldName'],'type':_0x5cd30d['type']['key']};});_0x3b3f53[_0xdd1c('0x2f')]=_['map'](_0x20abb7,_0xdd1c('0x2b'));_0x3b3f53[_0xdd1c('0x30')]=_['keys'](_0xa5ea2b[_0xdd1c('0x30')]);_0x3b3f53[_0xdd1c('0x31')]=_[_0xdd1c('0x32')](_0x3b3f53[_0xdd1c('0x2f')],_0x3b3f53[_0xdd1c('0x30')]);_0x1f52e9[_0xdd1c('0x33')]=_['intersection'](_0x3b3f53['model'],qs[_0xdd1c('0x34')](_0xa5ea2b[_0xdd1c('0x30')][_0xdd1c('0x34')]));_0x1f52e9[_0xdd1c('0x33')]=_0x1f52e9[_0xdd1c('0x33')][_0xdd1c('0x35')]?_0x1f52e9[_0xdd1c('0x33')]:_0x3b3f53['model'];if(!_0xa5ea2b[_0xdd1c('0x30')][_0xdd1c('0x36')](_0xdd1c('0x37'))){_0x1f52e9['limit']=qs[_0xdd1c('0x1d')](_0xa5ea2b['query']['limit']);_0x1f52e9['offset']=qs[_0xdd1c('0x1a')](_0xa5ea2b[_0xdd1c('0x30')]['offset']);}_0x1f52e9[_0xdd1c('0x38')]=qs[_0xdd1c('0x39')](_0xa5ea2b[_0xdd1c('0x30')][_0xdd1c('0x39')]);_0x1f52e9[_0xdd1c('0x3a')]=qs[_0xdd1c('0x31')](_[_0xdd1c('0x3b')](_0xa5ea2b[_0xdd1c('0x30')],_0x3b3f53[_0xdd1c('0x31')]),_0x20abb7);if(_0xa5ea2b[_0xdd1c('0x30')]['filter']){_0x1f52e9[_0xdd1c('0x3a')]=_[_0xdd1c('0x3c')](_0x1f52e9[_0xdd1c('0x3a')],{'$or':_[_0xdd1c('0x2c')](_0x20abb7,function(_0x234ed0){if(_0x234ed0[_0xdd1c('0x3d')]!==_0xdd1c('0x3e')){var _0x2fc72b={};_0x2fc72b[_0x234ed0[_0xdd1c('0x2b')]]={'$like':'%'+_0xa5ea2b[_0xdd1c('0x30')][_0xdd1c('0x3f')]+'%'};return _0x2fc72b;}})});}_0x1f52e9=_[_0xdd1c('0x3c')]({},_0x1f52e9,_0xa5ea2b[_0xdd1c('0x40')]);var _0x37309e={'where':_0x1f52e9[_0xdd1c('0x3a')]};return db['Interval'][_0xdd1c('0x1c')](_0x37309e)['then'](function(_0x12433c){_0x123693['count']=_0x12433c;if(_0xa5ea2b[_0xdd1c('0x30')]['includeAll']){_0x1f52e9[_0xdd1c('0x41')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x1f52e9);})[_0xdd1c('0x23')](function(_0x171384){_0x123693[_0xdd1c('0x42')]=_0x171384;return _0x123693;})['then'](respondWithFilteredResult(_0x4a268d,_0x1f52e9))['catch'](handleError(_0x4a268d,null));};exports[_0xdd1c('0x43')]=function(_0xf97fb9,_0x20f6f8){var _0x5961f9={'raw':!![],'where':{'id':_0xf97fb9['params']['id']}},_0x443368={};_0x443368[_0xdd1c('0x2f')]=_[_0xdd1c('0x44')](db[_0xdd1c('0x2d')][_0xdd1c('0x2e')]);_0x443368[_0xdd1c('0x30')]=_[_0xdd1c('0x44')](_0xf97fb9[_0xdd1c('0x30')]);_0x443368[_0xdd1c('0x31')]=_[_0xdd1c('0x32')](_0x443368[_0xdd1c('0x2f')],_0x443368['query']);_0x5961f9[_0xdd1c('0x33')]=_[_0xdd1c('0x32')](_0x443368[_0xdd1c('0x2f')],qs[_0xdd1c('0x34')](_0xf97fb9[_0xdd1c('0x30')][_0xdd1c('0x34')]));_0x5961f9[_0xdd1c('0x33')]=_0x5961f9['attributes'][_0xdd1c('0x35')]?_0x5961f9[_0xdd1c('0x33')]:_0x443368[_0xdd1c('0x2f')];if(_0xf97fb9['query'][_0xdd1c('0x45')]){_0x5961f9[_0xdd1c('0x41')]=[{'all':!![]}];}_0x5961f9=_['merge']({},_0x5961f9,_0xf97fb9[_0xdd1c('0x40')]);return db[_0xdd1c('0x2d')][_0xdd1c('0x46')](_0x5961f9)[_0xdd1c('0x23')](handleEntityNotFound(_0x20f6f8,null))[_0xdd1c('0x23')](respondWithResult(_0x20f6f8,null))[_0xdd1c('0x47')](handleError(_0x20f6f8,null));};exports[_0xdd1c('0x48')]=function(_0xaf3f79,_0x5b46fc){return db['Interval'][_0xdd1c('0x48')](_0xaf3f79['body'],{})[_0xdd1c('0x23')](function(_0xf16381){var _0x58a88b=_0xaf3f79[_0xdd1c('0x49')][_0xdd1c('0x25')]({'plain':!![]});if(!_0x58a88b)throw new Error(_0xdd1c('0x4a'));if(_0x58a88b[_0xdd1c('0x4b')]===_0xdd1c('0x49')){var _0x834c03=_0xf16381[_0xdd1c('0x25')]({'plain':!![]});var _0x14a0c8=_0xdd1c('0x26');return db[_0xdd1c('0x4c')][_0xdd1c('0x46')]({'where':{'name':_0x14a0c8,'userProfileId':_0x58a88b['userProfileId']},'raw':!![]})['then'](function(_0x240354){if(_0x240354&&_0x240354[_0xdd1c('0x4d')]===0x0){return db[_0xdd1c('0x27')][_0xdd1c('0x48')]({'name':_0x834c03[_0xdd1c('0x2b')],'resourceId':_0x834c03['id'],'type':_0x240354[_0xdd1c('0x2b')],'sectionId':_0x240354['id']},{})['then'](function(){return _0xf16381;});}else{return _0xf16381;}})[_0xdd1c('0x47')](function(_0x24542a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24542a);throw _0x24542a;});}return _0xf16381;})[_0xdd1c('0x23')](respondWithResult(_0x5b46fc,0xc9))[_0xdd1c('0x47')](handleError(_0x5b46fc,null));};exports[_0xdd1c('0x4e')]=function(_0x295574,_0x2b7ac2){if(_0x295574[_0xdd1c('0x4f')]['id']){delete _0x295574[_0xdd1c('0x4f')]['id'];}return db[_0xdd1c('0x2d')][_0xdd1c('0x46')]({'where':{'id':_0x295574[_0xdd1c('0x50')]['id']}})[_0xdd1c('0x23')](handleEntityNotFound(_0x2b7ac2,null))['then'](saveUpdates(_0x295574[_0xdd1c('0x4f')],null))['then'](respondWithResult(_0x2b7ac2,null))[_0xdd1c('0x47')](handleError(_0x2b7ac2,null));};exports[_0xdd1c('0x24')]=function(_0x573549,_0x163cef){return db[_0xdd1c('0x2d')]['find']({'where':{'id':_0x573549[_0xdd1c('0x50')]['id']}})['then'](handleEntityNotFound(_0x163cef,null))[_0xdd1c('0x23')](removeEntity(_0x163cef,null))[_0xdd1c('0x47')](handleError(_0x163cef,null));};exports[_0xdd1c('0x51')]=function(_0x19d333,_0x18f181,_0x1f9937){if(_0x19d333[_0xdd1c('0x4f')]['id']){delete _0x19d333[_0xdd1c('0x4f')]['id'];}return db['Interval'][_0xdd1c('0x46')]({'where':{'id':_0x19d333['params']['id']}})[_0xdd1c('0x23')](handleEntityNotFound(_0x18f181,null))['then'](function(_0x5c0c3f){if(_0x5c0c3f){_0x19d333[_0xdd1c('0x4f')][_0xdd1c('0x52')]=_0x5c0c3f['id'];return db['Interval']['create'](_0x19d333['body']);}})[_0xdd1c('0x23')](respondWithResult(_0x18f181,null))[_0xdd1c('0x47')](handleError(_0x18f181,null));};exports[_0xdd1c('0x53')]=function(_0x5f2394,_0x1bf222,_0x1fc0a0){var _0x215440={};var _0x1785bb={};var _0x5158a7;var _0x5aba35;return db[_0xdd1c('0x2d')][_0xdd1c('0x54')]({'where':{'id':_0x5f2394[_0xdd1c('0x50')]['id']}})[_0xdd1c('0x23')](handleEntityNotFound(_0x1bf222,null))[_0xdd1c('0x23')](function(_0x298647){if(_0x298647){_0x5158a7=_0x298647;_0x1785bb[_0xdd1c('0x2f')]=_[_0xdd1c('0x44')](db[_0xdd1c('0x2d')][_0xdd1c('0x2e')]);_0x1785bb[_0xdd1c('0x30')]=_[_0xdd1c('0x44')](_0x5f2394[_0xdd1c('0x30')]);_0x1785bb['filters']=_['intersection'](_0x1785bb[_0xdd1c('0x2f')],_0x1785bb[_0xdd1c('0x30')]);_0x215440[_0xdd1c('0x33')]=_['intersection'](_0x1785bb['model'],qs[_0xdd1c('0x34')](_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x34')]));_0x215440[_0xdd1c('0x33')]=_0x215440[_0xdd1c('0x33')][_0xdd1c('0x35')]?_0x215440['attributes']:_0x1785bb['model'];_0x215440[_0xdd1c('0x38')]=qs['sort'](_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x39')]);_0x215440[_0xdd1c('0x3a')]=qs[_0xdd1c('0x31')](_[_0xdd1c('0x3b')](_0x5f2394[_0xdd1c('0x30')],_0x1785bb['filters']));if(_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x3f')]){_0x215440[_0xdd1c('0x3a')]=_['merge'](_0x215440[_0xdd1c('0x3a')],{'$or':_[_0xdd1c('0x2c')](_0x215440[_0xdd1c('0x33')],function(_0xc1bd4d){var _0x1609cc={};_0x1609cc[_0xc1bd4d]={'$like':'%'+_0x5f2394['query']['filter']+'%'};return _0x1609cc;})});}_0x215440=_[_0xdd1c('0x3c')]({},_0x215440,_0x5f2394[_0xdd1c('0x40')]);return _0x5158a7[_0xdd1c('0x53')](_0x215440);}})['then'](function(_0x100a4b){if(_0x100a4b){_0x5aba35=_0x100a4b[_0xdd1c('0x35')];if(!_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x36')](_0xdd1c('0x37'))){_0x215440['limit']=qs[_0xdd1c('0x1d')](_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x1d')]);_0x215440[_0xdd1c('0x1a')]=qs[_0xdd1c('0x1a')](_0x5f2394[_0xdd1c('0x30')][_0xdd1c('0x1a')]);}return _0x5158a7[_0xdd1c('0x53')](_0x215440);}})[_0xdd1c('0x23')](function(_0x43cb6e){if(_0x43cb6e){return _0x43cb6e?{'count':_0x5aba35,'rows':_0x43cb6e}:null;}})[_0xdd1c('0x23')](respondWithResult(_0x1bf222,null))[_0xdd1c('0x47')](handleError(_0x1bf222,null));};exports[_0xdd1c('0x55')]=function(_0x3ae58d,_0x19ec99,_0x374162){return db['Interval'][_0xdd1c('0x54')]({'where':{'id':_0x3ae58d['params']['id']}})['then'](handleEntityNotFound(_0x19ec99,null))[_0xdd1c('0x23')](function(_0x51301d){if(_0x51301d){return db[_0xdd1c('0x56')][_0xdd1c('0x57')](function(_0x3b3e08){return db[_0xdd1c('0x2d')][_0xdd1c('0x24')]({'where':{'IntervalId':_0x3ae58d['params']['id']},'transaction':_0x3b3e08})[_0xdd1c('0x23')](function(_0x5bd971){var _0x172d5b=_[_0xdd1c('0x2c')](_0x3ae58d[_0xdd1c('0x4f')],function(_0x1c628d){delete _0x1c628d['id'];_0x1c628d['IntervalId']=_0x3ae58d[_0xdd1c('0x50')]['id'];return _0x1c628d;});return db[_0xdd1c('0x2d')][_0xdd1c('0x58')](_0x172d5b,{'transaction':_0x3b3e08});});})[_0xdd1c('0x23')](function(){return db[_0xdd1c('0x2d')][_0xdd1c('0x59')]({'where':{'IntervalId':_0x3ae58d[_0xdd1c('0x50')]['id']}});});}})[_0xdd1c('0x23')](respondWithResult(_0x19ec99,null))[_0xdd1c('0x47')](handleError(_0x19ec99,null));}; \ No newline at end of file +var _0x3bdc=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','Interval','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addInterval','IntervalId','findOne','filter','getIntervals','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x4a6071,_0x13ea96){var _0x2e67b8=function(_0x4159fe){while(--_0x4159fe){_0x4a6071['push'](_0x4a6071['shift']());}};_0x2e67b8(++_0x13ea96);}(_0x3bdc,0x17b));var _0xc3bd=function(_0x46313b,_0x1cf970){_0x46313b=_0x46313b-0x0;var _0x4b6453=_0x3bdc[_0x46313b];return _0x4b6453;};'use strict';var emlformat=require(_0xc3bd('0x0'));var rimraf=require(_0xc3bd('0x1'));var zipdir=require(_0xc3bd('0x2'));var jsonpatch=require(_0xc3bd('0x3'));var rp=require(_0xc3bd('0x4'));var moment=require(_0xc3bd('0x5'));var BPromise=require(_0xc3bd('0x6'));var Mustache=require('mustache');var util=require(_0xc3bd('0x7'));var path=require(_0xc3bd('0x8'));var sox=require(_0xc3bd('0x9'));var csv=require('to-csv');var ejs=require(_0xc3bd('0xa'));var fs=require('fs');var fs_extra=require(_0xc3bd('0xb'));var _=require(_0xc3bd('0xc'));var squel=require(_0xc3bd('0xd'));var crypto=require(_0xc3bd('0xe'));var jsforce=require(_0xc3bd('0xf'));var deskjs=require(_0xc3bd('0x10'));var toCsv=require(_0xc3bd('0x11'));var querystring=require(_0xc3bd('0x12'));var Papa=require('papaparse');var Redis=require(_0xc3bd('0x13'));var authService=require(_0xc3bd('0x14'));var qs=require(_0xc3bd('0x15'));var as=require(_0xc3bd('0x16'));var hardwareService=require(_0xc3bd('0x17'));var logger=require(_0xc3bd('0x18'))(_0xc3bd('0x19'));var utils=require('../../config/utils');var config=require(_0xc3bd('0x1a'));var licenseUtil=require(_0xc3bd('0x1b'));var db=require('../../mysqldb')['db'];var extensions=require(_0xc3bd('0x1c'));function respondWithStatusCode(_0x3b503c,_0x2c2b42){_0x2c2b42=_0x2c2b42||0xcc;return function(_0x2960b0){if(_0x2960b0){return _0x3b503c[_0xc3bd('0x1d')](_0x2c2b42);}return _0x3b503c[_0xc3bd('0x1e')](_0x2c2b42)[_0xc3bd('0x1f')]();};}function respondWithResult(_0x58b12d,_0x1691df){_0x1691df=_0x1691df||0xc8;return function(_0xee1dd5){if(_0xee1dd5){return _0x58b12d[_0xc3bd('0x1e')](_0x1691df)[_0xc3bd('0x20')](_0xee1dd5);}};}function respondWithFilteredResult(_0x3a1d51,_0x4fdd9d){return function(_0xb4001b){if(_0xb4001b){var _0x4e7abe=typeof _0x4fdd9d[_0xc3bd('0x21')]===_0xc3bd('0x22')&&typeof _0x4fdd9d[_0xc3bd('0x23')]==='undefined';var _0x1356c8=_0xb4001b['count'];var _0x5de504=_0x4e7abe?0x0:_0x4fdd9d['offset'];var _0x5a8913=_0x4e7abe?_0xb4001b[_0xc3bd('0x24')]:_0x4fdd9d[_0xc3bd('0x21')]+_0x4fdd9d[_0xc3bd('0x23')];var _0x4377b6;if(_0x5a8913>=_0x1356c8){_0x5a8913=_0x1356c8;_0x4377b6=0xc8;}else{_0x4377b6=0xce;}_0x3a1d51['status'](_0x4377b6);return _0x3a1d51[_0xc3bd('0x25')](_0xc3bd('0x26'),_0x5de504+'-'+_0x5a8913+'/'+_0x1356c8)['json'](_0xb4001b);}return null;};}function patchUpdates(_0x49034d){return function(_0x2ab286){try{jsonpatch[_0xc3bd('0x27')](_0x2ab286,_0x49034d,!![]);}catch(_0x5e1a4e){return BPromise[_0xc3bd('0x28')](_0x5e1a4e);}return _0x2ab286[_0xc3bd('0x29')]();};}function saveUpdates(_0x3a82d2,_0x3828dc){return function(_0x58ac28){if(_0x58ac28){return _0x58ac28[_0xc3bd('0x2a')](_0x3a82d2)[_0xc3bd('0x2b')](function(_0x5a2e25){return _0x5a2e25;});}return null;};}function removeEntity(_0x141429,_0x5d8bba){return function(_0x19e45d){if(_0x19e45d){return _0x19e45d[_0xc3bd('0x2c')]()[_0xc3bd('0x2b')](function(){var _0x111ce1=_0x19e45d['get']({'plain':!![]});var _0x38f4c1=_0xc3bd('0x2d');return db['UserProfileResource'][_0xc3bd('0x2c')]({'where':{'type':_0x38f4c1,'resourceId':_0x111ce1['id']}})[_0xc3bd('0x2b')](function(){return _0x19e45d;});})['then'](function(){_0x141429['status'](0xcc)[_0xc3bd('0x1f')]();});}};}function handleEntityNotFound(_0x5089e1,_0x1fe3e4){return function(_0x600e09){if(!_0x600e09){_0x5089e1['sendStatus'](0x194);}return _0x600e09;};}function handleError(_0x3cdf56,_0x26d393){_0x26d393=_0x26d393||0x1f4;return function(_0x43081d){logger[_0xc3bd('0x2e')](_0x43081d[_0xc3bd('0x2f')]);if(_0x43081d[_0xc3bd('0x30')]){delete _0x43081d[_0xc3bd('0x30')];}_0x3cdf56['status'](_0x26d393)[_0xc3bd('0x31')](_0x43081d);};}exports[_0xc3bd('0x32')]=function(_0x1d2375,_0x18c8f5){var _0x1db606={},_0x56e9b4={},_0x865be={'count':0x0,'rows':[]};var _0x1590bd=_[_0xc3bd('0x33')](db['Interval'][_0xc3bd('0x34')],function(_0x557713){return{'name':_0x557713['fieldName'],'type':_0x557713[_0xc3bd('0x35')][_0xc3bd('0x36')]};});_0x56e9b4[_0xc3bd('0x37')]=_['map'](_0x1590bd,_0xc3bd('0x30'));_0x56e9b4[_0xc3bd('0x38')]=_[_0xc3bd('0x39')](_0x1d2375[_0xc3bd('0x38')]);_0x56e9b4['filters']=_[_0xc3bd('0x3a')](_0x56e9b4[_0xc3bd('0x37')],_0x56e9b4[_0xc3bd('0x38')]);_0x1db606[_0xc3bd('0x3b')]=_[_0xc3bd('0x3a')](_0x56e9b4['model'],qs['fields'](_0x1d2375['query'][_0xc3bd('0x3c')]));_0x1db606[_0xc3bd('0x3b')]=_0x1db606[_0xc3bd('0x3b')][_0xc3bd('0x3d')]?_0x1db606[_0xc3bd('0x3b')]:_0x56e9b4[_0xc3bd('0x37')];if(!_0x1d2375[_0xc3bd('0x38')][_0xc3bd('0x3e')](_0xc3bd('0x3f'))){_0x1db606[_0xc3bd('0x23')]=qs[_0xc3bd('0x23')](_0x1d2375[_0xc3bd('0x38')][_0xc3bd('0x23')]);_0x1db606[_0xc3bd('0x21')]=qs[_0xc3bd('0x21')](_0x1d2375[_0xc3bd('0x38')][_0xc3bd('0x21')]);}_0x1db606[_0xc3bd('0x40')]=qs[_0xc3bd('0x41')](_0x1d2375[_0xc3bd('0x38')][_0xc3bd('0x41')]);_0x1db606[_0xc3bd('0x42')]=qs['filters'](_['pick'](_0x1d2375[_0xc3bd('0x38')],_0x56e9b4[_0xc3bd('0x43')]),_0x1590bd);if(_0x1d2375['query']['filter']){_0x1db606[_0xc3bd('0x42')]=_['merge'](_0x1db606['where'],{'$or':_['map'](_0x1590bd,function(_0x259cda){if(_0x259cda[_0xc3bd('0x35')]!==_0xc3bd('0x44')){var _0x39e38d={};_0x39e38d[_0x259cda[_0xc3bd('0x30')]]={'$like':'%'+_0x1d2375['query']['filter']+'%'};return _0x39e38d;}})});}_0x1db606=_[_0xc3bd('0x45')]({},_0x1db606,_0x1d2375[_0xc3bd('0x46')]);var _0x2152ca={'where':_0x1db606[_0xc3bd('0x42')]};return db[_0xc3bd('0x47')][_0xc3bd('0x24')](_0x2152ca)[_0xc3bd('0x2b')](function(_0x42c418){_0x865be[_0xc3bd('0x24')]=_0x42c418;if(_0x1d2375[_0xc3bd('0x38')]['includeAll']){_0x1db606['include']=[{'all':!![]}];}return db['Interval'][_0xc3bd('0x48')](_0x1db606);})['then'](function(_0xafbc8e){_0x865be[_0xc3bd('0x49')]=_0xafbc8e;return _0x865be;})[_0xc3bd('0x2b')](respondWithFilteredResult(_0x18c8f5,_0x1db606))[_0xc3bd('0x4a')](handleError(_0x18c8f5,null));};exports[_0xc3bd('0x4b')]=function(_0x5c5107,_0x31c659){var _0x48daa6={'raw':!![],'where':{'id':_0x5c5107[_0xc3bd('0x4c')]['id']}},_0x2e5993={};_0x2e5993[_0xc3bd('0x37')]=_[_0xc3bd('0x39')](db['Interval']['rawAttributes']);_0x2e5993[_0xc3bd('0x38')]=_[_0xc3bd('0x39')](_0x5c5107[_0xc3bd('0x38')]);_0x2e5993[_0xc3bd('0x43')]=_['intersection'](_0x2e5993['model'],_0x2e5993[_0xc3bd('0x38')]);_0x48daa6[_0xc3bd('0x3b')]=_['intersection'](_0x2e5993[_0xc3bd('0x37')],qs['fields'](_0x5c5107['query'][_0xc3bd('0x3c')]));_0x48daa6[_0xc3bd('0x3b')]=_0x48daa6[_0xc3bd('0x3b')][_0xc3bd('0x3d')]?_0x48daa6[_0xc3bd('0x3b')]:_0x2e5993[_0xc3bd('0x37')];if(_0x5c5107[_0xc3bd('0x38')][_0xc3bd('0x4d')]){_0x48daa6[_0xc3bd('0x4e')]=[{'all':!![]}];}_0x48daa6=_[_0xc3bd('0x45')]({},_0x48daa6,_0x5c5107[_0xc3bd('0x46')]);return db[_0xc3bd('0x47')][_0xc3bd('0x4f')](_0x48daa6)[_0xc3bd('0x2b')](handleEntityNotFound(_0x31c659,null))[_0xc3bd('0x2b')](respondWithResult(_0x31c659,null))[_0xc3bd('0x4a')](handleError(_0x31c659,null));};exports[_0xc3bd('0x50')]=function(_0x43ae54,_0x2f6c14){return db['Interval']['create'](_0x43ae54[_0xc3bd('0x51')],{})[_0xc3bd('0x2b')](function(_0xd3c072){var _0xc1497d=_0x43ae54[_0xc3bd('0x52')][_0xc3bd('0x53')]({'plain':!![]});if(!_0xc1497d)throw new Error(_0xc3bd('0x54'));if(_0xc1497d['role']===_0xc3bd('0x52')){var _0x38037f=_0xd3c072['get']({'plain':!![]});var _0x3e651b='Intervals';return db[_0xc3bd('0x55')][_0xc3bd('0x4f')]({'where':{'name':_0x3e651b,'userProfileId':_0xc1497d[_0xc3bd('0x56')]},'raw':!![]})['then'](function(_0x4654d4){if(_0x4654d4&&_0x4654d4[_0xc3bd('0x57')]===0x0){return db[_0xc3bd('0x58')][_0xc3bd('0x50')]({'name':_0x38037f[_0xc3bd('0x30')],'resourceId':_0x38037f['id'],'type':_0x4654d4[_0xc3bd('0x30')],'sectionId':_0x4654d4['id']},{})[_0xc3bd('0x2b')](function(){return _0xd3c072;});}else{return _0xd3c072;}})[_0xc3bd('0x4a')](function(_0x2d0dc7){logger[_0xc3bd('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d0dc7);throw _0x2d0dc7;});}return _0xd3c072;})[_0xc3bd('0x2b')](respondWithResult(_0x2f6c14,0xc9))['catch'](handleError(_0x2f6c14,null));};exports[_0xc3bd('0x2a')]=function(_0x5c876f,_0x284d71){if(_0x5c876f[_0xc3bd('0x51')]['id']){delete _0x5c876f[_0xc3bd('0x51')]['id'];}return db[_0xc3bd('0x47')][_0xc3bd('0x4f')]({'where':{'id':_0x5c876f[_0xc3bd('0x4c')]['id']}})[_0xc3bd('0x2b')](handleEntityNotFound(_0x284d71,null))[_0xc3bd('0x2b')](saveUpdates(_0x5c876f['body'],null))['then'](respondWithResult(_0x284d71,null))[_0xc3bd('0x4a')](handleError(_0x284d71,null));};exports['destroy']=function(_0x21048a,_0x92e27){return db['Interval'][_0xc3bd('0x4f')]({'where':{'id':_0x21048a[_0xc3bd('0x4c')]['id']}})[_0xc3bd('0x2b')](handleEntityNotFound(_0x92e27,null))[_0xc3bd('0x2b')](removeEntity(_0x92e27,null))['catch'](handleError(_0x92e27,null));};exports[_0xc3bd('0x59')]=function(_0x194a18,_0x30755f,_0x28d1ca){if(_0x194a18[_0xc3bd('0x51')]['id']){delete _0x194a18[_0xc3bd('0x51')]['id'];}return db[_0xc3bd('0x47')]['find']({'where':{'id':_0x194a18[_0xc3bd('0x4c')]['id']}})[_0xc3bd('0x2b')](handleEntityNotFound(_0x30755f,null))[_0xc3bd('0x2b')](function(_0xeac98d){if(_0xeac98d){_0x194a18[_0xc3bd('0x51')][_0xc3bd('0x5a')]=_0xeac98d['id'];return db[_0xc3bd('0x47')][_0xc3bd('0x50')](_0x194a18[_0xc3bd('0x51')]);}})[_0xc3bd('0x2b')](respondWithResult(_0x30755f,null))[_0xc3bd('0x4a')](handleError(_0x30755f,null));};exports['getIntervals']=function(_0x110b21,_0x2b062c,_0x4409fc){var _0x2704d3={};var _0x90e9cc={};var _0x42ed97;var _0x525d7c;return db[_0xc3bd('0x47')][_0xc3bd('0x5b')]({'where':{'id':_0x110b21[_0xc3bd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b062c,null))['then'](function(_0x536302){if(_0x536302){_0x42ed97=_0x536302;_0x90e9cc[_0xc3bd('0x37')]=_['keys'](db['Interval'][_0xc3bd('0x34')]);_0x90e9cc[_0xc3bd('0x38')]=_[_0xc3bd('0x39')](_0x110b21['query']);_0x90e9cc['filters']=_['intersection'](_0x90e9cc[_0xc3bd('0x37')],_0x90e9cc[_0xc3bd('0x38')]);_0x2704d3[_0xc3bd('0x3b')]=_[_0xc3bd('0x3a')](_0x90e9cc[_0xc3bd('0x37')],qs['fields'](_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x3c')]));_0x2704d3['attributes']=_0x2704d3['attributes']['length']?_0x2704d3[_0xc3bd('0x3b')]:_0x90e9cc[_0xc3bd('0x37')];_0x2704d3[_0xc3bd('0x40')]=qs[_0xc3bd('0x41')](_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x41')]);_0x2704d3[_0xc3bd('0x42')]=qs['filters'](_['pick'](_0x110b21['query'],_0x90e9cc[_0xc3bd('0x43')]));if(_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x5c')]){_0x2704d3['where']=_['merge'](_0x2704d3[_0xc3bd('0x42')],{'$or':_[_0xc3bd('0x33')](_0x2704d3[_0xc3bd('0x3b')],function(_0x3deb73){var _0x36ff5d={};_0x36ff5d[_0x3deb73]={'$like':'%'+_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x5c')]+'%'};return _0x36ff5d;})});}_0x2704d3=_[_0xc3bd('0x45')]({},_0x2704d3,_0x110b21[_0xc3bd('0x46')]);return _0x42ed97['getIntervals'](_0x2704d3);}})[_0xc3bd('0x2b')](function(_0x5ef8ef){if(_0x5ef8ef){_0x525d7c=_0x5ef8ef[_0xc3bd('0x3d')];if(!_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x3e')](_0xc3bd('0x3f'))){_0x2704d3[_0xc3bd('0x23')]=qs[_0xc3bd('0x23')](_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x23')]);_0x2704d3[_0xc3bd('0x21')]=qs['offset'](_0x110b21[_0xc3bd('0x38')][_0xc3bd('0x21')]);}return _0x42ed97[_0xc3bd('0x5d')](_0x2704d3);}})[_0xc3bd('0x2b')](function(_0x5a58cf){if(_0x5a58cf){return _0x5a58cf?{'count':_0x525d7c,'rows':_0x5a58cf}:null;}})[_0xc3bd('0x2b')](respondWithResult(_0x2b062c,null))[_0xc3bd('0x4a')](handleError(_0x2b062c,null));};exports[_0xc3bd('0x5e')]=function(_0x900714,_0x2832fe,_0x3df83c){return db[_0xc3bd('0x47')][_0xc3bd('0x5b')]({'where':{'id':_0x900714[_0xc3bd('0x4c')]['id']}})[_0xc3bd('0x2b')](handleEntityNotFound(_0x2832fe,null))['then'](function(_0x1be1b){if(_0x1be1b){return db['sequelize'][_0xc3bd('0x5f')](function(_0x338112){return db[_0xc3bd('0x47')][_0xc3bd('0x2c')]({'where':{'IntervalId':_0x900714[_0xc3bd('0x4c')]['id']},'transaction':_0x338112})['then'](function(_0x33946d){var _0x3f569f=_[_0xc3bd('0x33')](_0x900714['body'],function(_0x13a83f){delete _0x13a83f['id'];_0x13a83f['IntervalId']=_0x900714[_0xc3bd('0x4c')]['id'];return _0x13a83f;});return db['Interval'][_0xc3bd('0x60')](_0x3f569f,{'transaction':_0x338112});});})[_0xc3bd('0x2b')](function(){return db[_0xc3bd('0x47')][_0xc3bd('0x48')]({'where':{'IntervalId':_0x900714[_0xc3bd('0x4c')]['id']}});});}})[_0xc3bd('0x2b')](respondWithResult(_0x2832fe,null))[_0xc3bd('0x4a')](handleError(_0x2832fe,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d8e0973..cf80bc5 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 _0x4493=['Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map','then','reduce','../../utils/iftime','iftime','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4493,0x122));var _0x3449=function(_0x18ce45,_0x14456b){_0x18ce45=_0x18ce45-0x0;var _0x334c83=_0x4493[_0x18ce45];return _0x334c83;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x3449('0x0'))[_0x3449('0x1')];module[_0x3449('0x2')]=function(_0x2f8451){return _0x2f8451[_0x3449('0x3')](_0x3449('0x4'),attributes,{'tableName':_0x3449('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41ffd6){extensions[_0x3449('0x6')](_0x2f8451,_0x41ffd6);},'afterBulkCreate':function(_0x1299b6,_0x50da3d,_0x335a18){_0x335a18();extensions[_0x3449('0x6')](_0x2f8451,_0x1299b6[0x0]);},'afterUpdate':function(_0x5f43c3){extensions['rewrite'](_0x2f8451,_0x5f43c3);},'afterDestroy':function(_0x361b7f){extensions['rewrite'](_0x2f8451,_0x361b7f);}},'instanceMethods':{'ifTime':function(_0x5e9030=undefined,_0x1842d1=new Date()){if(typeof this[_0x3449('0x7')]===_0x3449('0x8')){return iftime(this['interval'],_0x5e9030,_0x1842d1);}else{return this[_0x3449('0x9')]()['then'](function(_0x257194){return Promise[_0x3449('0xa')](_0x257194[_0x3449('0xb')](function(_0xe9ce6c){return _0xe9ce6c['ifTime'](_0x5e9030,_0x1842d1);}));})[_0x3449('0xc')](function(_0x31339c){return _0x31339c[_0x3449('0xd')](function(_0x4d29a6,_0x384d6e){return _0x4d29a6||_0x384d6e;},![]);});}}}});}; \ No newline at end of file +var _0x65c8=['ifTime','reduce','./interval.attributes','iftime','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all'];(function(_0x5c15cd,_0x235f57){var _0x20a4d4=function(_0x7b7893){while(--_0x7b7893){_0x5c15cd['push'](_0x5c15cd['shift']());}};_0x20a4d4(++_0x235f57);}(_0x65c8,0x13a));var _0x865c=function(_0x1fd19d,_0x40500b){_0x1fd19d=_0x1fd19d-0x0;var _0x49f534=_0x65c8[_0x1fd19d];return _0x49f534;};'use strict';var attributes=require(_0x865c('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x865c('0x1')];module['exports']=function(_0x28a494){return _0x28a494[_0x865c('0x2')](_0x865c('0x3'),attributes,{'tableName':_0x865c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f46c3){extensions[_0x865c('0x5')](_0x28a494,_0x2f46c3);},'afterBulkCreate':function(_0x58a187,_0x51621e,_0x156213){_0x156213();extensions[_0x865c('0x5')](_0x28a494,_0x58a187[0x0]);},'afterUpdate':function(_0x4a1887){extensions[_0x865c('0x5')](_0x28a494,_0x4a1887);},'afterDestroy':function(_0x2fdcbf){extensions[_0x865c('0x5')](_0x28a494,_0x2fdcbf);}},'instanceMethods':{'ifTime':function(_0x5108f6=undefined,_0x3c9513=new Date()){if(typeof this[_0x865c('0x6')]===_0x865c('0x7')){return iftime(this[_0x865c('0x6')],_0x5108f6,_0x3c9513);}else{return this[_0x865c('0x8')]()[_0x865c('0x9')](function(_0x46dd61){return Promise[_0x865c('0xa')](_0x46dd61['map'](function(_0x69279){return _0x69279[_0x865c('0xb')](_0x5108f6,_0x3c9513);}));})[_0x865c('0x9')](function(_0x59da3a){return _0x59da3a[_0x865c('0xc')](function(_0xc80d2b,_0x390ee8){return _0xc80d2b||_0x390ee8;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2805214..ffad3ac 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 _0xd379=['catch','error','message','ShowInterval','raw','debug','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','lodash','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','then','info','stringify'];(function(_0x4e8d84,_0x24690f){var _0xeb2483=function(_0x1178d4){while(--_0x1178d4){_0x4e8d84['push'](_0x4e8d84['shift']());}};_0xeb2483(++_0x24690f);}(_0xd379,0x91));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d37('0x0'));var util=require(_0x9d37('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x9d37('0x2'))[_0x9d37('0x3')];var logger=require(_0x9d37('0x4'))(_0x9d37('0x5'));exports[_0x9d37('0x6')]=function(_0x758f4d){var _0xa9fa6c=this;return new Promise(function(_0x328a2e,_0x4a36e7){return db[_0x9d37('0x7')][_0x9d37('0x8')]({'raw':_0x758f4d['options']?_0x758f4d[_0x9d37('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x758f4d['options']?_0x758f4d[_0x9d37('0x9')][_0x9d37('0xa')]||null:null,'attributes':_0x758f4d[_0x9d37('0x9')]?_0x758f4d[_0x9d37('0x9')][_0x9d37('0xb')]||null:null,'limit':_0x758f4d[_0x9d37('0x9')]?_0x758f4d[_0x9d37('0x9')][_0x9d37('0xc')]||null:null,'include':_0x758f4d[_0x9d37('0x9')]?_0x758f4d[_0x9d37('0x9')][_0x9d37('0xd')]?_[_0x9d37('0xe')](_0x758f4d[_0x9d37('0x9')]['include'],function(_0x5566ce){return{'model':db[_0x5566ce[_0x9d37('0xf')]],'as':_0x5566ce['as'],'attributes':_0x5566ce[_0x9d37('0xb')],'include':_0x5566ce[_0x9d37('0xd')]?_[_0x9d37('0xe')](_0x5566ce['include'],function(_0x2daf03){return{'model':db[_0x2daf03[_0x9d37('0xf')]],'as':_0x2daf03['as'],'attributes':_0x2daf03['attributes'],'include':_0x2daf03['include']?_[_0x9d37('0xe')](_0x2daf03['include'],function(_0x404863){return{'model':db[_0x404863['model']],'as':_0x404863['as'],'attributes':_0x404863['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d37('0x10')](function(_0x254d49){logger[_0x9d37('0x11')]('GetInterval',_0x758f4d);logger['debug']('GetInterval',_0x758f4d,JSON[_0x9d37('0x12')](_0x254d49));_0x328a2e(_0x254d49);})[_0x9d37('0x13')](function(_0xa3d3d7){logger[_0x9d37('0x14')](_0x9d37('0x6'),_0xa3d3d7[_0x9d37('0x15')],_0x758f4d);_0x4a36e7(_0xa9fa6c[_0x9d37('0x14')](0x1f4,_0xa3d3d7[_0x9d37('0x15')]));});});};exports[_0x9d37('0x16')]=function(_0x4afb69){var _0x851d66=this;return new Promise(function(_0x30a969,_0x4cf9f9){return db[_0x9d37('0x7')]['find']({'raw':_0x4afb69[_0x9d37('0x9')]?_0x4afb69['options'][_0x9d37('0x17')]===undefined?!![]:![]:!![],'where':_0x4afb69[_0x9d37('0x9')]?_0x4afb69[_0x9d37('0x9')][_0x9d37('0xa')]||null:null,'attributes':_0x4afb69[_0x9d37('0x9')]?_0x4afb69[_0x9d37('0x9')]['attributes']||null:null,'include':_0x4afb69['options']?_0x4afb69['options'][_0x9d37('0xd')]?_[_0x9d37('0xe')](_0x4afb69[_0x9d37('0x9')][_0x9d37('0xd')],function(_0x173272){return{'model':db[_0x173272[_0x9d37('0xf')]],'as':_0x173272['as'],'attributes':_0x173272[_0x9d37('0xb')],'include':_0x173272[_0x9d37('0xd')]?_['map'](_0x173272[_0x9d37('0xd')],function(_0x4e9830){return{'model':db[_0x4e9830[_0x9d37('0xf')]],'as':_0x4e9830['as'],'attributes':_0x4e9830[_0x9d37('0xb')],'include':_0x4e9830['include']?_[_0x9d37('0xe')](_0x4e9830[_0x9d37('0xd')],function(_0x56eb16){return{'model':db[_0x56eb16['model']],'as':_0x56eb16['as'],'attributes':_0x56eb16['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x152ead){logger[_0x9d37('0x11')](_0x9d37('0x16'),_0x4afb69);logger[_0x9d37('0x18')](_0x9d37('0x16'),_0x4afb69,JSON[_0x9d37('0x12')](_0x152ead));_0x30a969(_0x152ead);})[_0x9d37('0x13')](function(_0x4b5572){logger[_0x9d37('0x14')](_0x9d37('0x16'),_0x4b5572['message'],_0x4afb69);_0x4cf9f9(_0x851d66[_0x9d37('0x14')](0x1f4,_0x4b5572[_0x9d37('0x15')]));});});};function checkArrayOfIntervals(_0x1ea69b,_0x1ec28f){var _0x45502c=[];return db[_0x9d37('0x7')][_0x9d37('0x8')]({'where':{'id':_0x1ea69b}})[_0x9d37('0x10')](function(_0x3e925a){_0x45502c=_0x3e925a;return Promise[_0x9d37('0x19')](_0x45502c[_0x9d37('0xe')](function(_0x48a2a8){return _0x48a2a8[_0x9d37('0x1a')](_0x1ec28f);}));})[_0x9d37('0x10')](function(_0x542b6a){var _0x1c7708=_0x542b6a[_0x9d37('0x1b')](function(_0x2bc73d,_0x5e9525){return _0x2bc73d||_0x5e9525;},![]);logger[_0x9d37('0x11')](util[_0x9d37('0x1c')](_0x9d37('0x1d'),_0x45502c[_0x9d37('0xe')](function(_0x34fe1c){return _0x34fe1c[_0x9d37('0x1e')];})[_0x9d37('0x1f')](',\x20'),_0x45502c[_0x9d37('0xe')](function(_0x49cffd){return _0x49cffd['id'];})[_0x9d37('0x1f')](',\x20')));return _0x1c7708;});}function checkSingleInterval(_0x2240dc,_0xa6c49b){return db[_0x9d37('0x7')]['findById'](_0x2240dc)[_0x9d37('0x10')](function(_0x5849f9){if(_0x5849f9){logger[_0x9d37('0x11')](util[_0x9d37('0x1c')](_0x9d37('0x20'),_0x5849f9[_0x9d37('0x1e')],_0x5849f9['id']));return _0x5849f9[_0x9d37('0x1a')](_0xa6c49b);}});}exports[_0x9d37('0x21')]=function(_0x10b6a6){var _0x49070d=_0x10b6a6[_0x9d37('0x22')];var _0xd41168=Array['isArray'](_0x10b6a6['intervals'])?_0x10b6a6[_0x9d37('0x23')]:typeof _0x10b6a6['intervals']==='string'?[_0x10b6a6[_0x9d37('0x23')]]:[];var _0x24034e=_0x10b6a6['timezone']||undefined;var _0x513a60=![];if(_0xd41168[_0x9d37('0x24')]){logger[_0x9d37('0x11')](util[_0x9d37('0x1c')](_0x9d37('0x25'),_0xd41168['join'](';\x20')));}if(_0x24034e){logger['info'](util['format'](_0x9d37('0x26'),_0x24034e));}logger[_0x9d37('0x18')]('Iftime',_0x513a60);logger[_0x9d37('0x27')](_0x9d37('0x21'),_0x10b6a6);return Promise[_0x9d37('0x28')]()[_0x9d37('0x10')](function(){if(Array['isArray'](_0x49070d)){return checkArrayOfIntervals(_0x49070d,_0x24034e);}else if(_0x49070d){return checkSingleInterval(_0x49070d,_0x24034e);}})['then'](function(_0x2a294c){var _0x43c586=_0xd41168['reduce'](function(_0x3da7a7,_0x5c9f9a){return _0x3da7a7||iftime(_0x5c9f9a,_0x24034e);},![]);_0x513a60=_0x2a294c||_0x43c586;return _0x513a60;})[_0x9d37('0x13')](function(_0x5c4e93){logger[_0x9d37('0x14')](_0x9d37('0x21'),_0x10b6a6,_0x5c4e93);throw this[_0x9d37('0x14')](0x1f4,_0x5c4e93[_0x9d37('0x15')]);});}; \ No newline at end of file +var _0xb63c=['../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','attributes','include','map','model','then','debug','stringify','catch','error','message','ShowInterval','Interval','find','raw','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','info','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','lodash','../../mysqldb'];(function(_0x28cef4,_0x19f95d){var _0x4b4fa4=function(_0x4bca77){while(--_0x4bca77){_0x28cef4['push'](_0x28cef4['shift']());}};_0x4b4fa4(++_0x19f95d);}(_0xb63c,0x1ea));var _0xcb63=function(_0x18d67e,_0x317131){_0x18d67e=_0x18d67e-0x0;var _0x4c3924=_0xb63c[_0x18d67e];return _0x4c3924;};'use strict';var _=require(_0xcb63('0x0'));var util=require('util');var db=require(_0xcb63('0x1'))['db'];var iftime=require(_0xcb63('0x2'))[_0xcb63('0x3')];var logger=require(_0xcb63('0x4'))(_0xcb63('0x5'));exports[_0xcb63('0x6')]=function(_0x3b34b7){var _0x130c3d=this;return new Promise(function(_0x253e3b,_0x42af43){return db['Interval'][_0xcb63('0x7')]({'raw':_0x3b34b7['options']?_0x3b34b7[_0xcb63('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3b34b7['options']?_0x3b34b7[_0xcb63('0x8')]['where']||null:null,'attributes':_0x3b34b7['options']?_0x3b34b7['options'][_0xcb63('0x9')]||null:null,'limit':_0x3b34b7[_0xcb63('0x8')]?_0x3b34b7[_0xcb63('0x8')]['limit']||null:null,'include':_0x3b34b7['options']?_0x3b34b7[_0xcb63('0x8')][_0xcb63('0xa')]?_[_0xcb63('0xb')](_0x3b34b7['options'][_0xcb63('0xa')],function(_0x1d4d4a){return{'model':db[_0x1d4d4a[_0xcb63('0xc')]],'as':_0x1d4d4a['as'],'attributes':_0x1d4d4a[_0xcb63('0x9')],'include':_0x1d4d4a['include']?_['map'](_0x1d4d4a[_0xcb63('0xa')],function(_0x210186){return{'model':db[_0x210186[_0xcb63('0xc')]],'as':_0x210186['as'],'attributes':_0x210186['attributes'],'include':_0x210186[_0xcb63('0xa')]?_['map'](_0x210186[_0xcb63('0xa')],function(_0x45baac){return{'model':db[_0x45baac[_0xcb63('0xc')]],'as':_0x45baac['as'],'attributes':_0x45baac[_0xcb63('0x9')]};}):[]};}):[]};}):[]:[]})[_0xcb63('0xd')](function(_0x477cf7){logger['info'](_0xcb63('0x6'),_0x3b34b7);logger[_0xcb63('0xe')](_0xcb63('0x6'),_0x3b34b7,JSON[_0xcb63('0xf')](_0x477cf7));_0x253e3b(_0x477cf7);})[_0xcb63('0x10')](function(_0x45798a){logger[_0xcb63('0x11')](_0xcb63('0x6'),_0x45798a[_0xcb63('0x12')],_0x3b34b7);_0x42af43(_0x130c3d[_0xcb63('0x11')](0x1f4,_0x45798a[_0xcb63('0x12')]));});});};exports[_0xcb63('0x13')]=function(_0x427572){var _0x310fce=this;return new Promise(function(_0x1f9626,_0x5731da){return db[_0xcb63('0x14')][_0xcb63('0x15')]({'raw':_0x427572[_0xcb63('0x8')]?_0x427572[_0xcb63('0x8')][_0xcb63('0x16')]===undefined?!![]:![]:!![],'where':_0x427572[_0xcb63('0x8')]?_0x427572['options']['where']||null:null,'attributes':_0x427572[_0xcb63('0x8')]?_0x427572[_0xcb63('0x8')][_0xcb63('0x9')]||null:null,'include':_0x427572[_0xcb63('0x8')]?_0x427572[_0xcb63('0x8')][_0xcb63('0xa')]?_[_0xcb63('0xb')](_0x427572[_0xcb63('0x8')][_0xcb63('0xa')],function(_0x4b2fe4){return{'model':db[_0x4b2fe4[_0xcb63('0xc')]],'as':_0x4b2fe4['as'],'attributes':_0x4b2fe4[_0xcb63('0x9')],'include':_0x4b2fe4['include']?_['map'](_0x4b2fe4[_0xcb63('0xa')],function(_0x51ed1d){return{'model':db[_0x51ed1d['model']],'as':_0x51ed1d['as'],'attributes':_0x51ed1d[_0xcb63('0x9')],'include':_0x51ed1d['include']?_[_0xcb63('0xb')](_0x51ed1d['include'],function(_0x305b53){return{'model':db[_0x305b53[_0xcb63('0xc')]],'as':_0x305b53['as'],'attributes':_0x305b53['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb63('0xd')](function(_0x33bf2f){logger['info'](_0xcb63('0x13'),_0x427572);logger['debug'](_0xcb63('0x13'),_0x427572,JSON[_0xcb63('0xf')](_0x33bf2f));_0x1f9626(_0x33bf2f);})['catch'](function(_0x1d1d9e){logger[_0xcb63('0x11')]('ShowInterval',_0x1d1d9e[_0xcb63('0x12')],_0x427572);_0x5731da(_0x310fce[_0xcb63('0x11')](0x1f4,_0x1d1d9e[_0xcb63('0x12')]));});});};function checkArrayOfIntervals(_0x40582f,_0x3f3f2e){var _0x16215a=[];return db[_0xcb63('0x14')]['findAll']({'where':{'id':_0x40582f}})[_0xcb63('0xd')](function(_0x345b88){_0x16215a=_0x345b88;return Promise[_0xcb63('0x17')](_0x16215a[_0xcb63('0xb')](function(_0x21e8b1){return _0x21e8b1[_0xcb63('0x18')](_0x3f3f2e);}));})[_0xcb63('0xd')](function(_0x3ecba2){var _0x38b197=_0x3ecba2[_0xcb63('0x19')](function(_0x1a2fe8,_0x43eb33){return _0x1a2fe8||_0x43eb33;},![]);logger['info'](util[_0xcb63('0x1a')](_0xcb63('0x1b'),_0x16215a[_0xcb63('0xb')](function(_0x996bac){return _0x996bac['name'];})[_0xcb63('0x1c')](',\x20'),_0x16215a['map'](function(_0x1a9b94){return _0x1a9b94['id'];})[_0xcb63('0x1c')](',\x20')));return _0x38b197;});}function checkSingleInterval(_0x569dca,_0x1ab0d2){return db[_0xcb63('0x14')]['findById'](_0x569dca)[_0xcb63('0xd')](function(_0x4be721){if(_0x4be721){logger['info'](util['format'](_0xcb63('0x1d'),_0x4be721['name'],_0x4be721['id']));return _0x4be721[_0xcb63('0x18')](_0x1ab0d2);}});}exports[_0xcb63('0x1e')]=function(_0x9bfe16){var _0x1c8074=_0x9bfe16[_0xcb63('0x1f')];var _0x740fbd=Array[_0xcb63('0x20')](_0x9bfe16[_0xcb63('0x21')])?_0x9bfe16[_0xcb63('0x21')]:typeof _0x9bfe16[_0xcb63('0x21')]===_0xcb63('0x22')?[_0x9bfe16['intervals']]:[];var _0xa2c12c=_0x9bfe16[_0xcb63('0x23')]||undefined;var _0x422a34=![];if(_0x740fbd[_0xcb63('0x24')]){logger[_0xcb63('0x25')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x740fbd['join'](';\x20')));}if(_0xa2c12c){logger[_0xcb63('0x25')](util[_0xcb63('0x1a')](_0xcb63('0x26'),_0xa2c12c));}logger[_0xcb63('0xe')]('Iftime',_0x422a34);logger[_0xcb63('0x27')]('IntervalIftime',_0x9bfe16);return Promise[_0xcb63('0x28')]()[_0xcb63('0xd')](function(){if(Array[_0xcb63('0x20')](_0x1c8074)){return checkArrayOfIntervals(_0x1c8074,_0xa2c12c);}else if(_0x1c8074){return checkSingleInterval(_0x1c8074,_0xa2c12c);}})[_0xcb63('0xd')](function(_0xd12e1a){var _0x1f1888=_0x740fbd[_0xcb63('0x19')](function(_0x4172c4,_0xc8cf06){return _0x4172c4||iftime(_0xc8cf06,_0xa2c12c);},![]);_0x422a34=_0xd12e1a||_0x1f1888;return _0x422a34;})[_0xcb63('0x10')](function(_0x4ffa1d){logger[_0xcb63('0x11')](_0xcb63('0x1e'),_0x9bfe16,_0x4ffa1d);throw this[_0xcb63('0x11')](0x1f4,_0x4ffa1d['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c3f4998..aa51cce 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x198327,_0x17ccd8){var _0x24a35b=function(_0x3b52af){while(--_0x3b52af){_0x198327['push'](_0x198327['shift']());}};_0x24a35b(++_0x17ccd8);}(_0x2ef3,0xba));var _0x32ef=function(_0x51d4ff,_0x1fd96c){_0x51d4ff=_0x51d4ff-0x0;var _0x48c56a=_0x2ef3[_0x51d4ff];return _0x48c56a;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x0b0e[_0x1fc82b];return _0x4c6679;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a47df87..a742e13 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 _0xee74=['POST','toString','base64','data','end','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xee74,0xab));var _0x4ee7=function(_0x27e26a,_0x5bf2e1){_0x27e26a=_0x27e26a-0x0;var _0x2fe928=_0xee74[_0x27e26a];return _0x2fe928;};'use strict';var BPromise=require('bluebird');var https=require(_0x4ee7('0x0'));var logger=require(_0x4ee7('0x1'))(_0x4ee7('0x2'));var USERNAME='support';var PASSWORD=_0x4ee7('0x3');function openIssue(_0x2ee790,_0x75dae9){var _0x2d2c62={'fields':{'project':{'key':_0x2ee790[_0x4ee7('0x4')]||_0x4ee7('0x5')},'summary':(_0x2ee790[_0x4ee7('0x6')]||'Report')+_0x4ee7('0x7')+_0x2ee790['ip'],'description':_0x2ee790[_0x4ee7('0x8')]||JSON[_0x4ee7('0x9')](_0x2ee790),'issuetype':{'name':_0x2ee790['issuetype']||'Bug'}}};_0x2d2c62[_0x4ee7('0xa')]['customfield_11500']=_0x2ee790['email'];_0x2d2c62['fields']['customfield_11501']=_0x2ee790[_0x4ee7('0xb')];_0x2d2c62[_0x4ee7('0xa')][_0x4ee7('0xc')]=_0x2ee790['newToken'];_0x2d2c62['fields'][_0x4ee7('0xd')]=_0x2ee790['name'];_0x2d2c62[_0x4ee7('0xa')][_0x4ee7('0xe')]=_0x2ee790[_0x4ee7('0xf')];_0x2d2c62['fields'][_0x4ee7('0x10')]=_0x2ee790['ip'];var _0x1d427d={'host':_0x4ee7('0x11'),'port':0x1bb,'path':_0x4ee7('0x12'),'method':_0x4ee7('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x4ee7('0x14')](_0x4ee7('0x15'))}};var _0x1d284d=JSON[_0x4ee7('0x9')](_0x2d2c62);var _0x574ed5=https['request'](_0x1d427d,function(_0x215742){_0x215742['setEncoding']('utf8');var _0x499bb4='';_0x215742['on'](_0x4ee7('0x16'),function(_0x304b4b){_0x499bb4+=_0x304b4b;});_0x215742['on'](_0x4ee7('0x17'),function(){if(_0x75dae9){return _0x75dae9['status'](_0x215742[_0x4ee7('0x18')])[_0x4ee7('0x19')](JSON[_0x4ee7('0x1a')](_0x499bb4));}});});_0x574ed5['on'](_0x4ee7('0x1b'),function(_0x4d6df4){if(_0x75dae9){return _0x75dae9['status'](0x1f4)['json']({'errors':[{'message':_0x4ee7('0x1c'),'type':_0x4ee7('0x1d')}]});}});_0x574ed5['write'](_0x1d284d);_0x574ed5[_0x4ee7('0x17')]();}exports[_0x4ee7('0x1e')]=openIssue;exports[_0x4ee7('0x1f')]=function(_0x8a65f0,_0x168f3e){_0x8a65f0[_0x4ee7('0x20')]['ip']=_0x8a65f0[_0x4ee7('0x21')][_0x4ee7('0x22')]||_0x8a65f0[_0x4ee7('0x23')][_0x4ee7('0x24')]||_0x8a65f0[_0x4ee7('0x25')][_0x4ee7('0x24')]||_0x8a65f0[_0x4ee7('0x23')][_0x4ee7('0x25')][_0x4ee7('0x24')];return openIssue(_0x8a65f0[_0x4ee7('0x20')],_0x168f3e);}; \ No newline at end of file +var _0x8cd6=['key','MOTGUI','summary','Report','description','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','headers','x-forwarded-for','remoteAddress','socket','connection','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0'];(function(_0x471830,_0x4e3b7c){var _0xbf2b40=function(_0x79e245){while(--_0x79e245){_0x471830['push'](_0x471830['shift']());}};_0xbf2b40(++_0x4e3b7c);}(_0x8cd6,0x10e));var _0x68cd=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x8cd6[_0x23884b];return _0x28113b;};'use strict';var BPromise=require(_0x68cd('0x0'));var https=require(_0x68cd('0x1'));var logger=require(_0x68cd('0x2'))(_0x68cd('0x3'));var USERNAME=_0x68cd('0x4');var PASSWORD=_0x68cd('0x5');function openIssue(_0x433557,_0x2e435e){var _0x62e151={'fields':{'project':{'key':_0x433557[_0x68cd('0x6')]||_0x68cd('0x7')},'summary':(_0x433557[_0x68cd('0x8')]||_0x68cd('0x9'))+'\x20from\x20'+_0x433557['ip'],'description':_0x433557[_0x68cd('0xa')]||JSON['stringify'](_0x433557),'issuetype':{'name':_0x433557[_0x68cd('0xb')]||'Bug'}}};_0x62e151[_0x68cd('0xc')]['customfield_11500']=_0x433557[_0x68cd('0xd')];_0x62e151['fields'][_0x68cd('0xe')]=_0x433557[_0x68cd('0xf')];_0x62e151['fields'][_0x68cd('0x10')]=_0x433557[_0x68cd('0x11')];_0x62e151[_0x68cd('0xc')][_0x68cd('0x12')]=_0x433557[_0x68cd('0x13')];_0x62e151[_0x68cd('0xc')][_0x68cd('0x14')]=_0x433557[_0x68cd('0x15')];_0x62e151[_0x68cd('0xc')]['customfield_10102']=_0x433557['ip'];var _0x495208={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x68cd('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x68cd('0x17'),'Authorization':_0x68cd('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x68cd('0x19')](_0x68cd('0x1a'))}};var _0x67436b=JSON[_0x68cd('0x1b')](_0x62e151);var _0x3bd63e=https['request'](_0x495208,function(_0x1596c2){_0x1596c2[_0x68cd('0x1c')](_0x68cd('0x1d'));var _0x4a9a3f='';_0x1596c2['on'](_0x68cd('0x1e'),function(_0x31f302){_0x4a9a3f+=_0x31f302;});_0x1596c2['on'](_0x68cd('0x1f'),function(){if(_0x2e435e){return _0x2e435e[_0x68cd('0x20')](_0x1596c2[_0x68cd('0x21')])[_0x68cd('0x22')](JSON[_0x68cd('0x23')](_0x4a9a3f));}});});_0x3bd63e['on'](_0x68cd('0x24'),function(_0x11e0a5){if(_0x2e435e){return _0x2e435e[_0x68cd('0x20')](0x1f4)['json']({'errors':[{'message':_0x68cd('0x25'),'type':_0x68cd('0x26')}]});}});_0x3bd63e['write'](_0x67436b);_0x3bd63e[_0x68cd('0x1f')]();}exports[_0x68cd('0x27')]=openIssue;exports['send']=function(_0x1c388a,_0x535df1){_0x1c388a['body']['ip']=_0x1c388a[_0x68cd('0x28')][_0x68cd('0x29')]||_0x1c388a['connection'][_0x68cd('0x2a')]||_0x1c388a[_0x68cd('0x2b')][_0x68cd('0x2a')]||_0x1c388a[_0x68cd('0x2c')][_0x68cd('0x2b')][_0x68cd('0x2a')];return openIssue(_0x1c388a[_0x68cd('0x2d')],_0x535df1);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 67ade55..f175c36 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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x33cd04,_0x557689){var _0x1a16e7=function(_0x421c74){while(--_0x421c74){_0x33cd04['push'](_0x33cd04['shift']());}};_0x1a16e7(++_0x557689);}(_0x1be1,0x192));var _0x11be=function(_0x1c3ef0,_0x8d1ef9){_0x1c3ef0=_0x1c3ef0-0x0;var _0x48f264=_0x1be1[_0x1c3ef0];return _0x48f264;};'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 +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x4e2fea,_0x105e9a){var _0x4dd3a5=function(_0x57473a){while(--_0x57473a){_0x4e2fea['push'](_0x4e2fea['shift']());}};_0x4dd3a5(++_0x105e9a);}(_0xa75b,0x170));var _0xba75=function(_0x3011a2,_0x3ee97b){_0x3011a2=_0x3011a2-0x0;var _0x3d2379=_0xa75b[_0x3011a2];return _0x3d2379;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 3fcb849..e437f90 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x6d273d,_0x579816){_0x6d273d=_0x6d273d-0x0;var _0x33b698=_0x7a54[_0x6d273d];return _0x33b698;};'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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x75d31d,_0x1e2a6c){_0x75d31d=_0x75d31d-0x0;var _0x15840c=_0x7a54[_0x75d31d];return _0x15840c;};'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 2b8981d..d84bdd2 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 _0x6dac=['then','destroy','error','send','index','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','intersection','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x2623d1,_0x47e15c){var _0x29b94f=function(_0x4d10eb){while(--_0x4d10eb){_0x2623d1['push'](_0x2623d1['shift']());}};_0x29b94f(++_0x47e15c);}(_0x6dac,0x16e));var _0xc6da=function(_0xf3ada,_0x4710ba){_0xf3ada=_0xf3ada-0x0;var _0x1a87f7=_0x6dac[_0xf3ada];return _0x1a87f7;};'use strict';var emlformat=require(_0xc6da('0x0'));var rimraf=require(_0xc6da('0x1'));var zipdir=require(_0xc6da('0x2'));var jsonpatch=require(_0xc6da('0x3'));var rp=require(_0xc6da('0x4'));var moment=require(_0xc6da('0x5'));var BPromise=require(_0xc6da('0x6'));var Mustache=require(_0xc6da('0x7'));var util=require(_0xc6da('0x8'));var path=require(_0xc6da('0x9'));var sox=require(_0xc6da('0xa'));var csv=require(_0xc6da('0xb'));var ejs=require(_0xc6da('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6da('0xd'));var squel=require(_0xc6da('0xe'));var crypto=require(_0xc6da('0xf'));var jsforce=require(_0xc6da('0x10'));var deskjs=require(_0xc6da('0x11'));var toCsv=require(_0xc6da('0xb'));var querystring=require(_0xc6da('0x12'));var Papa=require(_0xc6da('0x13'));var Redis=require(_0xc6da('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc6da('0x15'));var as=require(_0xc6da('0x16'));var hardwareService=require(_0xc6da('0x17'));var logger=require(_0xc6da('0x18'))(_0xc6da('0x19'));var utils=require(_0xc6da('0x1a'));var config=require(_0xc6da('0x1b'));var licenseUtil=require(_0xc6da('0x1c'));var db=require(_0xc6da('0x1d'))['db'];function respondWithStatusCode(_0x22d0e3,_0x3b8656){_0x3b8656=_0x3b8656||0xcc;return function(_0x3a3b39){if(_0x3a3b39){return _0x22d0e3[_0xc6da('0x1e')](_0x3b8656);}return _0x22d0e3['status'](_0x3b8656)[_0xc6da('0x1f')]();};}function respondWithResult(_0x18e521,_0x13d9df){_0x13d9df=_0x13d9df||0xc8;return function(_0x344b09){if(_0x344b09){return _0x18e521[_0xc6da('0x20')](_0x13d9df)[_0xc6da('0x21')](_0x344b09);}};}function respondWithFilteredResult(_0x4fa18b,_0x43e6b3){return function(_0x37767a){if(_0x37767a){var _0x287468=typeof _0x43e6b3[_0xc6da('0x22')]===_0xc6da('0x23')&&typeof _0x43e6b3['limit']===_0xc6da('0x23');var _0x4cf6c4=_0x37767a[_0xc6da('0x24')];var _0x2a63cc=_0x287468?0x0:_0x43e6b3[_0xc6da('0x22')];var _0x25737d=_0x287468?_0x37767a['count']:_0x43e6b3[_0xc6da('0x22')]+_0x43e6b3[_0xc6da('0x25')];var _0x40c346;if(_0x25737d>=_0x4cf6c4){_0x25737d=_0x4cf6c4;_0x40c346=0xc8;}else{_0x40c346=0xce;}_0x4fa18b[_0xc6da('0x20')](_0x40c346);return _0x4fa18b[_0xc6da('0x26')](_0xc6da('0x27'),_0x2a63cc+'-'+_0x25737d+'/'+_0x4cf6c4)[_0xc6da('0x21')](_0x37767a);}return null;};}function patchUpdates(_0x36ac99){return function(_0xe00c70){try{jsonpatch[_0xc6da('0x28')](_0xe00c70,_0x36ac99,!![]);}catch(_0x4deb23){return BPromise[_0xc6da('0x29')](_0x4deb23);}return _0xe00c70[_0xc6da('0x2a')]();};}function saveUpdates(_0x3c7483,_0x94bee1){return function(_0x5f070b){if(_0x5f070b){return _0x5f070b[_0xc6da('0x2b')](_0x3c7483)[_0xc6da('0x2c')](function(_0x5ddab9){return _0x5ddab9;});}return null;};}function removeEntity(_0x2a2ef9,_0x3b180c){return function(_0x1003a3){if(_0x1003a3){return _0x1003a3[_0xc6da('0x2d')]()['then'](function(){_0x2a2ef9[_0xc6da('0x20')](0xcc)[_0xc6da('0x1f')]();});}};}function handleEntityNotFound(_0x55c059,_0x67ebf9){return function(_0x89b637){if(!_0x89b637){_0x55c059[_0xc6da('0x1e')](0x194);}return _0x89b637;};}function handleError(_0x57c198,_0x4d232d){_0x4d232d=_0x4d232d||0x1f4;return function(_0x1ded21){logger[_0xc6da('0x2e')](_0x1ded21['stack']);if(_0x1ded21['name']){delete _0x1ded21['name'];}_0x57c198['status'](_0x4d232d)[_0xc6da('0x2f')](_0x1ded21);};}exports[_0xc6da('0x30')]=function(_0x33eba0,_0x579dab){var _0x32b83={},_0xda1aef={},_0x13cb9e={'count':0x0,'rows':[]};var _0x890254=_['map'](db['JscriptyAnswerReport'][_0xc6da('0x31')],function(_0x572204){return{'name':_0x572204[_0xc6da('0x32')],'type':_0x572204[_0xc6da('0x33')][_0xc6da('0x34')]};});_0xda1aef['model']=_[_0xc6da('0x35')](_0x890254,_0xc6da('0x36'));_0xda1aef[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x33eba0[_0xc6da('0x37')]);_0xda1aef[_0xc6da('0x39')]=_['intersection'](_0xda1aef[_0xc6da('0x3a')],_0xda1aef[_0xc6da('0x37')]);_0x32b83[_0xc6da('0x3b')]=_['intersection'](_0xda1aef['model'],qs[_0xc6da('0x3c')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x32b83[_0xc6da('0x3b')]=_0x32b83[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x32b83[_0xc6da('0x3b')]:_0xda1aef[_0xc6da('0x3a')];if(!_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3e')](_0xc6da('0x3f'))){_0x32b83[_0xc6da('0x25')]=qs[_0xc6da('0x25')](_0x33eba0['query'][_0xc6da('0x25')]);_0x32b83['offset']=qs[_0xc6da('0x22')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x22')]);}_0x32b83['order']=qs[_0xc6da('0x40')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x40')]);_0x32b83['where']=qs[_0xc6da('0x39')](_['pick'](_0x33eba0[_0xc6da('0x37')],_0xda1aef['filters']),_0x890254);if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]){_0x32b83[_0xc6da('0x42')]=_['merge'](_0x32b83['where'],{'$or':_[_0xc6da('0x35')](_0x890254,function(_0x56b071){if(_0x56b071['type']!==_0xc6da('0x43')){var _0x16b440={};_0x16b440[_0x56b071[_0xc6da('0x36')]]={'$like':'%'+_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]+'%'};return _0x16b440;}})});}_0x32b83=_[_0xc6da('0x44')]({},_0x32b83,_0x33eba0[_0xc6da('0x45')]);var _0x3368c9={'where':_0x32b83['where']};return db[_0xc6da('0x46')][_0xc6da('0x24')](_0x3368c9)[_0xc6da('0x2c')](function(_0x4fd663){_0x13cb9e[_0xc6da('0x24')]=_0x4fd663;if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x47')]){_0x32b83[_0xc6da('0x48')]=[{'all':!![]}];}return db[_0xc6da('0x46')][_0xc6da('0x49')](_0x32b83);})[_0xc6da('0x2c')](function(_0xb5e11e){_0x13cb9e['rows']=_0xb5e11e;return _0x13cb9e;})[_0xc6da('0x2c')](respondWithFilteredResult(_0x579dab,_0x32b83))[_0xc6da('0x4a')](handleError(_0x579dab,null));};exports[_0xc6da('0x4b')]=function(_0x34e19a,_0x4f3374){var _0x4e00fc={'raw':!![],'where':{'id':_0x34e19a['params']['id']}},_0xd20888={};_0xd20888['model']=_[_0xc6da('0x38')](db[_0xc6da('0x46')][_0xc6da('0x31')]);_0xd20888[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x34e19a[_0xc6da('0x37')]);_0xd20888['filters']=_[_0xc6da('0x4c')](_0xd20888['model'],_0xd20888[_0xc6da('0x37')]);_0x4e00fc['attributes']=_[_0xc6da('0x4c')](_0xd20888[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x34e19a[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x4e00fc[_0xc6da('0x3b')]=_0x4e00fc[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x4e00fc['attributes']:_0xd20888[_0xc6da('0x3a')];if(_0x34e19a[_0xc6da('0x37')]['includeAll']){_0x4e00fc[_0xc6da('0x48')]=[{'all':!![]}];}_0x4e00fc=_['merge']({},_0x4e00fc,_0x34e19a[_0xc6da('0x45')]);return db[_0xc6da('0x46')][_0xc6da('0x4d')](_0x4e00fc)[_0xc6da('0x2c')](handleEntityNotFound(_0x4f3374,null))['then'](respondWithResult(_0x4f3374,null))['catch'](handleError(_0x4f3374,null));};exports[_0xc6da('0x4e')]=function(_0x3b2f06,_0x4fd983){return db[_0xc6da('0x46')][_0xc6da('0x4e')](_0x3b2f06[_0xc6da('0x4f')],{})[_0xc6da('0x2c')](respondWithResult(_0x4fd983,0xc9))['catch'](handleError(_0x4fd983,null));};exports['update']=function(_0x3d7016,_0x1cd932){if(_0x3d7016[_0xc6da('0x4f')]['id']){delete _0x3d7016[_0xc6da('0x4f')]['id'];}return db['JscriptyAnswerReport'][_0xc6da('0x4d')]({'where':{'id':_0x3d7016['params']['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x1cd932,null))[_0xc6da('0x2c')](saveUpdates(_0x3d7016[_0xc6da('0x4f')],null))[_0xc6da('0x2c')](respondWithResult(_0x1cd932,null))['catch'](handleError(_0x1cd932,null));};exports[_0xc6da('0x2d')]=function(_0x12f27b,_0x225d74){return db[_0xc6da('0x46')][_0xc6da('0x4d')]({'where':{'id':_0x12f27b[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x225d74,null))[_0xc6da('0x2c')](removeEntity(_0x225d74,null))[_0xc6da('0x4a')](handleError(_0x225d74,null));};exports[_0xc6da('0x51')]=function(_0x579a46,_0x5d2213){return db['JscriptyAnswerReport'][_0xc6da('0x51')]()['then'](respondWithResult(_0x5d2213,null))[_0xc6da('0x4a')](handleError(_0x5d2213,null));}; \ No newline at end of file +var _0xdbf5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','create','body','find','describe','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','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','JscriptyAnswerReport'];(function(_0xbb6e35,_0x14d01e){var _0x2c33ef=function(_0x21601e){while(--_0x21601e){_0xbb6e35['push'](_0xbb6e35['shift']());}};_0x2c33ef(++_0x14d01e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4a3d62,_0xed30fb){_0x4a3d62=_0x4a3d62-0x0;var _0x10f320=_0xdbf5[_0x4a3d62];return _0x10f320;};'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(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['map'](_0xc4748,'name');_0x2f71eb[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x471027[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x31')]=_[_0x5dbf('0x32')](_0x2f71eb['model'],_0x2f71eb['query']);_0x5768b7[_0x5dbf('0x33')]=_[_0x5dbf('0x32')](_0x2f71eb['model'],qs[_0x5dbf('0x34')](_0x471027[_0x5dbf('0x2f')][_0x5dbf('0x34')]));_0x5768b7[_0x5dbf('0x33')]=_0x5768b7[_0x5dbf('0x33')]['length']?_0x5768b7[_0x5dbf('0x33')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x2f')][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x5768b7['limit']=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x2f')][_0x5dbf('0x37')]);_0x5768b7[_0x5dbf('0x19')]=qs['offset'](_0x471027[_0x5dbf('0x2f')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x2f')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x31')](_[_0x5dbf('0x3b')](_0x471027[_0x5dbf('0x2f')],_0x2f71eb[_0x5dbf('0x31')]),_0xc4748);if(_0x471027['query'][_0x5dbf('0x3c')]){_0x5768b7[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x5768b7['where'],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x43954b){if(_0x43954b[_0x5dbf('0x2c')]!=='VIRTUAL'){var _0x444814={};_0x444814[_0x43954b[_0x5dbf('0x25')]]={'$like':'%'+_0x471027[_0x5dbf('0x2f')]['filter']+'%'};return _0x444814;}})});}_0x5768b7=_[_0x5dbf('0x3d')]({},_0x5768b7,_0x471027[_0x5dbf('0x3e')]);var _0x2ac162={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x2ac162)[_0x5dbf('0x20')](function(_0x2ed355){_0x24dc99['count']=_0x2ed355;if(_0x471027['query']['includeAll']){_0x5768b7['include']=[{'all':!![]}];}return db[_0x5dbf('0x29')][_0x5dbf('0x3f')](_0x5768b7);})['then'](function(_0x3ef0eb){_0x24dc99[_0x5dbf('0x40')]=_0x3ef0eb;return _0x24dc99;})['then'](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x41')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x42')]=function(_0x2ee717,_0x2ee6b9){var _0x21ae10={'raw':!![],'where':{'id':_0x2ee717[_0x5dbf('0x43')]['id']}},_0x7c390d={};_0x7c390d[_0x5dbf('0x2e')]=_[_0x5dbf('0x30')](db[_0x5dbf('0x29')]['rawAttributes']);_0x7c390d[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x2ee717[_0x5dbf('0x2f')]);_0x7c390d['filters']=_[_0x5dbf('0x32')](_0x7c390d[_0x5dbf('0x2e')],_0x7c390d[_0x5dbf('0x2f')]);_0x21ae10[_0x5dbf('0x33')]=_['intersection'](_0x7c390d[_0x5dbf('0x2e')],qs['fields'](_0x2ee717[_0x5dbf('0x2f')][_0x5dbf('0x34')]));_0x21ae10[_0x5dbf('0x33')]=_0x21ae10[_0x5dbf('0x33')]['length']?_0x21ae10['attributes']:_0x7c390d[_0x5dbf('0x2e')];if(_0x2ee717[_0x5dbf('0x2f')][_0x5dbf('0x44')]){_0x21ae10['include']=[{'all':!![]}];}_0x21ae10=_[_0x5dbf('0x3d')]({},_0x21ae10,_0x2ee717['options']);return db['JscriptyAnswerReport']['find'](_0x21ae10)['then'](handleEntityNotFound(_0x2ee6b9,null))[_0x5dbf('0x20')](respondWithResult(_0x2ee6b9,null))[_0x5dbf('0x41')](handleError(_0x2ee6b9,null));};exports['create']=function(_0x47063d,_0x3ba5cb){return db['JscriptyAnswerReport'][_0x5dbf('0x45')](_0x47063d[_0x5dbf('0x46')],{})['then'](respondWithResult(_0x3ba5cb,0xc9))[_0x5dbf('0x41')](handleError(_0x3ba5cb,null));};exports['update']=function(_0x5ab862,_0x337897){if(_0x5ab862[_0x5dbf('0x46')]['id']){delete _0x5ab862[_0x5dbf('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5ab862[_0x5dbf('0x43')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x337897,null))[_0x5dbf('0x20')](saveUpdates(_0x5ab862[_0x5dbf('0x46')],null))[_0x5dbf('0x20')](respondWithResult(_0x337897,null))[_0x5dbf('0x41')](handleError(_0x337897,null));};exports[_0x5dbf('0x21')]=function(_0x319906,_0x4bc7eb){return db[_0x5dbf('0x29')][_0x5dbf('0x47')]({'where':{'id':_0x319906[_0x5dbf('0x43')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x4bc7eb,null))[_0x5dbf('0x20')](removeEntity(_0x4bc7eb,null))[_0x5dbf('0x41')](handleError(_0x4bc7eb,null));};exports[_0x5dbf('0x48')]=function(_0x59f825,_0x1b0b13){return db['JscriptyAnswerReport'][_0x5dbf('0x48')]()[_0x5dbf('0x20')](respondWithResult(_0x1b0b13,null))[_0x5dbf('0x41')](handleError(_0x1b0b13,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6aa1b64..ca81aea 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 _0xd7a9=['request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x4bed71,_0x5c696e){var _0x45c8dc=function(_0x22b54d){while(--_0x22b54d){_0x4bed71['push'](_0x4bed71['shift']());}};_0x45c8dc(++_0x5c696e);}(_0xd7a9,0x103));var _0x9d7a=function(_0x324fbd,_0x4be36c){_0x324fbd=_0x324fbd-0x0;var _0x5a9eca=_0xd7a9[_0x324fbd];return _0x5a9eca;};'use strict';var _=require(_0x9d7a('0x0'));var util=require(_0x9d7a('0x1'));var logger=require(_0x9d7a('0x2'))(_0x9d7a('0x3'));var moment=require(_0x9d7a('0x4'));var BPromise=require('bluebird');var rp=require(_0x9d7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d7a('0x7'));module[_0x9d7a('0x8')]=function(_0x1f9eaa,_0x6fa5fb){return _0x1f9eaa[_0x9d7a('0x9')](_0x9d7a('0xa'),attributes,{'tableName':_0x9d7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef5a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash'];(function(_0xd25da5,_0x39cd4f){var _0x578f67=function(_0x4740b7){while(--_0x4740b7){_0xd25da5['push'](_0xd25da5['shift']());}};_0x578f67(++_0x39cd4f);}(_0xef5a,0x1e0));var _0xaef5=function(_0x443c34,_0x45eebb){_0x443c34=_0x443c34-0x0;var _0xdfa7ab=_0xef5a[_0x443c34];return _0xdfa7ab;};'use strict';var _=require(_0xaef5('0x0'));var util=require(_0xaef5('0x1'));var logger=require(_0xaef5('0x2'))(_0xaef5('0x3'));var moment=require(_0xaef5('0x4'));var BPromise=require(_0xaef5('0x5'));var rp=require(_0xaef5('0x6'));var fs=require('fs');var path=require(_0xaef5('0x7'));var rimraf=require(_0xaef5('0x8'));var config=require('../../config/environment');var attributes=require(_0xaef5('0x9'));module[_0xaef5('0xa')]=function(_0xb84293,_0x17f562){return _0xb84293[_0xaef5('0xb')](_0xaef5('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index cd66b5d..5448881 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 _0xaa84=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x868f79,_0x5655d4){var _0x4627ed=function(_0x4373d4){while(--_0x4373d4){_0x868f79['push'](_0x868f79['shift']());}};_0x4627ed(++_0x5655d4);}(_0xaa84,0x9a));var _0x4aa8=function(_0x9e99c6,_0x4c2f7e){_0x9e99c6=_0x9e99c6-0x0;var _0x3f07fe=_0xaa84[_0x9e99c6];return _0x3f07fe;};'use strict';var _=require('lodash');var util=require(_0x4aa8('0x0'));var moment=require(_0x4aa8('0x1'));var BPromise=require(_0x4aa8('0x2'));var rs=require(_0x4aa8('0x3'));var fs=require('fs');var Redis=require(_0x4aa8('0x4'));var db=require(_0x4aa8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4aa8('0x6'));var config=require(_0x4aa8('0x7'));var jayson=require(_0x4aa8('0x8'));var client=jayson[_0x4aa8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26d010,_0x4533d8,_0x5b9f58){return new BPromise(function(_0x2a9c5a,_0x58bfee){return client[_0x4aa8('0xa')](_0x26d010,_0x5b9f58)['then'](function(_0x26eab0){logger['info'](_0x4aa8('0xb'),_0x4533d8,_0x4aa8('0xc'));logger[_0x4aa8('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4533d8,_0x4aa8('0xc'),JSON[_0x4aa8('0xe')](_0x26eab0));if(_0x26eab0['error']){if(_0x26eab0[_0x4aa8('0xf')][_0x4aa8('0x10')]===0x1f4){logger[_0x4aa8('0xf')](_0x4aa8('0xb'),_0x4533d8,_0x26eab0[_0x4aa8('0xf')][_0x4aa8('0x11')]);return _0x58bfee(_0x26eab0[_0x4aa8('0xf')][_0x4aa8('0x11')]);}logger[_0x4aa8('0xf')](_0x4aa8('0xb'),_0x4533d8,_0x26eab0['error'][_0x4aa8('0x11')]);return _0x2a9c5a(_0x26eab0[_0x4aa8('0xf')][_0x4aa8('0x11')]);}else{logger['info'](_0x4aa8('0xb'),_0x4533d8,'request\x20sent');_0x2a9c5a(_0x26eab0[_0x4aa8('0x12')][_0x4aa8('0x11')]);}})['catch'](function(_0x3abdfe){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4533d8,_0x3abdfe);_0x58bfee(_0x3abdfe);});});} \ No newline at end of file +var _0x9b76=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird'];(function(_0x504610,_0x42927c){var _0x573e6b=function(_0x52057d){while(--_0x52057d){_0x504610['push'](_0x504610['shift']());}};_0x573e6b(++_0x42927c);}(_0x9b76,0x1ca));var _0x69b7=function(_0x42fdd5,_0x162345){_0x42fdd5=_0x42fdd5-0x0;var _0xcb4c53=_0x9b76[_0x42fdd5];return _0xcb4c53;};'use strict';var _=require(_0x69b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69b7('0x1'));var rs=require(_0x69b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x69b7('0x4'))(_0x69b7('0x5'));var config=require(_0x69b7('0x6'));var jayson=require(_0x69b7('0x7'));var client=jayson[_0x69b7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412db0,_0x26c12d,_0x5ab72e){return new BPromise(function(_0x322522,_0x51f549){return client[_0x69b7('0x9')](_0x412db0,_0x5ab72e)[_0x69b7('0xa')](function(_0x5a1ce5){logger[_0x69b7('0xb')](_0x69b7('0xc'),_0x26c12d,_0x69b7('0xd'));logger[_0x69b7('0xe')](_0x69b7('0xf'),_0x26c12d,_0x69b7('0xd'),JSON['stringify'](_0x5a1ce5));if(_0x5a1ce5['error']){if(_0x5a1ce5[_0x69b7('0x10')]['code']===0x1f4){logger[_0x69b7('0x10')](_0x69b7('0xc'),_0x26c12d,_0x5a1ce5[_0x69b7('0x10')][_0x69b7('0x11')]);return _0x51f549(_0x5a1ce5[_0x69b7('0x10')][_0x69b7('0x11')]);}logger[_0x69b7('0x10')](_0x69b7('0xc'),_0x26c12d,_0x5a1ce5['error']['message']);return _0x322522(_0x5a1ce5['error'][_0x69b7('0x11')]);}else{logger[_0x69b7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x26c12d,_0x69b7('0xd'));_0x322522(_0x5a1ce5[_0x69b7('0x12')][_0x69b7('0x11')]);}})[_0x69b7('0x13')](function(_0x15f0af){logger[_0x69b7('0x10')](_0x69b7('0xc'),_0x26c12d,_0x15f0af);_0x51f549(_0x15f0af);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index b66c9ba..4af2590 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 _0xe98b=['/:id/summary','30s','getSummary','post','clone','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers'];(function(_0x207f1c,_0x1bdfb4){var _0x24e0f6=function(_0x59ba6c){while(--_0x59ba6c){_0x207f1c['push'](_0x207f1c['shift']());}};_0x24e0f6(++_0x1bdfb4);}(_0xe98b,0x135));var _0xbe98=function(_0x3dfeb6,_0x84484d){_0x3dfeb6=_0x3dfeb6-0x0;var _0x3f325c=_0xe98b[_0x3dfeb6];return _0x3f325c;};'use strict';var multer=require(_0xbe98('0x0'));var util=require(_0xbe98('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe98('0x2'));var router=express[_0xbe98('0x3')]();var fs_extra=require(_0xbe98('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbe98('0x5'));var config=require(_0xbe98('0x6'));var controller=require(_0xbe98('0x7'));router[_0xbe98('0x8')]('/',auth[_0xbe98('0x9')](),controller[_0xbe98('0xa')]);router[_0xbe98('0x8')](_0xbe98('0xb'),auth[_0xbe98('0x9')](),controller[_0xbe98('0xc')]);router[_0xbe98('0x8')](_0xbe98('0xd'),auth[_0xbe98('0x9')](),controller[_0xbe98('0xe')]);router[_0xbe98('0x8')]('/:id/answers',auth[_0xbe98('0x9')](),controller[_0xbe98('0xf')]);router[_0xbe98('0x8')](_0xbe98('0x10'),auth[_0xbe98('0x9')](),timeout(_0xbe98('0x11')),controller[_0xbe98('0x12')]);router[_0xbe98('0x13')]('/',auth[_0xbe98('0x9')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xbe98('0x14')]);router[_0xbe98('0x15')](_0xbe98('0xb'),auth[_0xbe98('0x9')](),controller[_0xbe98('0x16')]);router[_0xbe98('0x17')]('/:id',auth[_0xbe98('0x9')](),controller['destroy']);module[_0xbe98('0x18')]=router; \ No newline at end of file +var _0x3aad=['./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','getSessions','getAnswers','30s','getSummary','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x54f080,_0x16ae93){var _0x273816=function(_0x4b2b05){while(--_0x4b2b05){_0x54f080['push'](_0x54f080['shift']());}};_0x273816(++_0x16ae93);}(_0x3aad,0xba));var _0xd3aa=function(_0x368a81,_0x17ba55){_0x368a81=_0x368a81-0x0;var _0x244f16=_0x3aad[_0x368a81];return _0x244f16;};'use strict';var multer=require(_0xd3aa('0x0'));var util=require(_0xd3aa('0x1'));var path=require('path');var timeout=require(_0xd3aa('0x2'));var express=require('express');var router=express[_0xd3aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd3aa('0x5'));var controller=require(_0xd3aa('0x6'));router[_0xd3aa('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3aa('0x8')]);router[_0xd3aa('0x7')](_0xd3aa('0x9'),auth[_0xd3aa('0xa')](),controller[_0xd3aa('0xb')]);router[_0xd3aa('0x7')]('/:id/sessions',auth[_0xd3aa('0xa')](),controller[_0xd3aa('0xc')]);router[_0xd3aa('0x7')]('/:id/answers',auth[_0xd3aa('0xa')](),controller[_0xd3aa('0xd')]);router[_0xd3aa('0x7')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xd3aa('0xe')),controller[_0xd3aa('0xf')]);router[_0xd3aa('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3aa('0x10')](_0xd3aa('0x11'),auth['isAuthenticated'](),controller[_0xd3aa('0x12')]);router[_0xd3aa('0x13')](_0xd3aa('0x9'),auth['isAuthenticated'](),controller[_0xd3aa('0x14')]);router[_0xd3aa('0x15')](_0xd3aa('0x9'),auth[_0xd3aa('0xa')](),controller[_0xd3aa('0x16')]);module[_0xd3aa('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 eabac7e..6a847ff 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 _0xf061=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf061,0x104));var _0x1f06=function(_0x5e58b3,_0x321ebf){_0x5e58b3=_0x5e58b3-0x0;var _0x4137fc=_0xf061[_0x5e58b3];return _0x4137fc;};'use strict';var Sequelize=require(_0x1f06('0x0'));var _=require(_0x1f06('0x1'));var util=require(_0x1f06('0x2'));module[_0x1f06('0x3')]={'name':{'type':Sequelize[_0x1f06('0x4')],'unique':_0x1f06('0x5')},'description':{'type':Sequelize[_0x1f06('0x4')]},'formData':{'type':Sequelize[_0x1f06('0x6')]('long'),'set':function(_0x46c14f){if(_[_0x1f06('0x7')](_0x46c14f)){this[_0x1f06('0x8')](_0x1f06('0x9'),JSON['stringify'](_0x46c14f));}else if(_[_0x1f06('0xa')](_0x46c14f)){this['setDataValue'](_0x1f06('0x9'),_0x46c14f);}else{this[_0x1f06('0x8')](_0x1f06('0x9'),util[_0x1f06('0xb')](_0x1f06('0xc'),this[_0x1f06('0xd')](_0x1f06('0x5'))||'',this[_0x1f06('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1f06('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfdb5=['isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long'];(function(_0x482325,_0x26108c){var _0x2126db=function(_0xa5eda1){while(--_0xa5eda1){_0x482325['push'](_0x482325['shift']());}};_0x2126db(++_0x26108c);}(_0xfdb5,0x1a9));var _0x5fdb=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xfdb5[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x5fdb('0x0'));var _=require(_0x5fdb('0x1'));var util=require(_0x5fdb('0x2'));module[_0x5fdb('0x3')]={'name':{'type':Sequelize[_0x5fdb('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5fdb('0x5')](_0x5fdb('0x6')),'set':function(_0x3e69f5){if(_[_0x5fdb('0x7')](_0x3e69f5)){this[_0x5fdb('0x8')](_0x5fdb('0x9'),JSON[_0x5fdb('0xa')](_0x3e69f5));}else if(_['isString'](_0x3e69f5)){this[_0x5fdb('0x8')](_0x5fdb('0x9'),_0x3e69f5);}else{this['setDataValue']('formData',util[_0x5fdb('0xb')](_0x5fdb('0xc'),this['getDataValue'](_0x5fdb('0xd'))||'',this['getDataValue'](_0x5fdb('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5fdb('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 017d539..75f7550 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 _0x62b7=['question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','indexOf','toString','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId'];(function(_0x72d4eb,_0x169139){var _0x3a15ce=function(_0x205def){while(--_0x205def){_0x72d4eb['push'](_0x72d4eb['shift']());}};_0x3a15ce(++_0x169139);}(_0x62b7,0x179));var _0x762b=function(_0x2a6b66,_0x296932){_0x2a6b66=_0x2a6b66-0x0;var _0x16621a=_0x62b7[_0x2a6b66];return _0x16621a;};'use strict';var emlformat=require(_0x762b('0x0'));var rimraf=require(_0x762b('0x1'));var zipdir=require(_0x762b('0x2'));var jsonpatch=require(_0x762b('0x3'));var rp=require(_0x762b('0x4'));var moment=require(_0x762b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x762b('0x6'));var util=require('util');var path=require(_0x762b('0x7'));var sox=require(_0x762b('0x8'));var csv=require('to-csv');var ejs=require(_0x762b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x762b('0xa'));var crypto=require(_0x762b('0xb'));var jsforce=require(_0x762b('0xc'));var deskjs=require(_0x762b('0xd'));var toCsv=require(_0x762b('0xe'));var querystring=require(_0x762b('0xf'));var Papa=require(_0x762b('0x10'));var Redis=require(_0x762b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x762b('0x12'));var as=require(_0x762b('0x13'));var hardwareService=require(_0x762b('0x14'));var logger=require(_0x762b('0x15'))(_0x762b('0x16'));var utils=require(_0x762b('0x17'));var config=require(_0x762b('0x18'));var licenseUtil=require(_0x762b('0x19'));var db=require(_0x762b('0x1a'))['db'];function respondWithStatusCode(_0x2eff21,_0x16730b){_0x16730b=_0x16730b||0xcc;return function(_0x589a1c){if(_0x589a1c){return _0x2eff21[_0x762b('0x1b')](_0x16730b);}return _0x2eff21[_0x762b('0x1c')](_0x16730b)[_0x762b('0x1d')]();};}function respondWithResult(_0x5cda5b,_0x5d1563){_0x5d1563=_0x5d1563||0xc8;return function(_0x5dff93){if(_0x5dff93){return _0x5cda5b[_0x762b('0x1c')](_0x5d1563)['json'](_0x5dff93);}};}function respondWithFilteredResult(_0x379ae5,_0x2576fb){return function(_0x57e1ac){if(_0x57e1ac){var _0x2118b8=typeof _0x2576fb[_0x762b('0x1e')]==='undefined'&&typeof _0x2576fb['limit']===_0x762b('0x1f');var _0x5105db=_0x57e1ac['count'];var _0x2c9f69=_0x2118b8?0x0:_0x2576fb['offset'];var _0x57af32=_0x2118b8?_0x57e1ac[_0x762b('0x20')]:_0x2576fb[_0x762b('0x1e')]+_0x2576fb[_0x762b('0x21')];var _0x44731e;if(_0x57af32>=_0x5105db){_0x57af32=_0x5105db;_0x44731e=0xc8;}else{_0x44731e=0xce;}_0x379ae5[_0x762b('0x1c')](_0x44731e);return _0x379ae5[_0x762b('0x22')]('Content-Range',_0x2c9f69+'-'+_0x57af32+'/'+_0x5105db)['json'](_0x57e1ac);}return null;};}function patchUpdates(_0x501ae2){return function(_0x18807e){try{jsonpatch[_0x762b('0x23')](_0x18807e,_0x501ae2,!![]);}catch(_0x416e31){return BPromise[_0x762b('0x24')](_0x416e31);}return _0x18807e[_0x762b('0x25')]();};}function saveUpdates(_0x5917b3,_0xe9c5a8){return function(_0x260fa5){if(_0x260fa5){return _0x260fa5[_0x762b('0x26')](_0x5917b3)[_0x762b('0x27')](function(_0x18fd23){return _0x18fd23;});}return null;};}function removeEntity(_0x1d50b7,_0x3f9a7e){return function(_0x122eb1){if(_0x122eb1){return _0x122eb1[_0x762b('0x28')]()[_0x762b('0x27')](function(){var _0x57990b=_0x122eb1[_0x762b('0x29')]({'plain':!![]});var _0x2dce9c=_0x762b('0x2a');return db[_0x762b('0x2b')][_0x762b('0x28')]({'where':{'type':_0x2dce9c,'resourceId':_0x57990b['id']}})[_0x762b('0x27')](function(){return _0x122eb1;});})[_0x762b('0x27')](function(){_0x1d50b7[_0x762b('0x1c')](0xcc)[_0x762b('0x1d')]();});}};}function handleEntityNotFound(_0x235952,_0x2613fc){return function(_0x2e7484){if(!_0x2e7484){_0x235952[_0x762b('0x1b')](0x194);}return _0x2e7484;};}function handleError(_0x5acae6,_0x49c50c){_0x49c50c=_0x49c50c||0x1f4;return function(_0x15cd26){logger[_0x762b('0x2c')](_0x15cd26[_0x762b('0x2d')]);if(_0x15cd26[_0x762b('0x2e')]){delete _0x15cd26[_0x762b('0x2e')];}_0x5acae6[_0x762b('0x1c')](_0x49c50c)['send'](_0x15cd26);};}exports[_0x762b('0x2f')]=function(_0x22d285,_0x2c73b6){var _0xa051d3={},_0x242820={},_0xa7ec35={'count':0x0,'rows':[]};var _0x3ee707=_['map'](db[_0x762b('0x30')][_0x762b('0x31')],function(_0x18242f){return{'name':_0x18242f[_0x762b('0x32')],'type':_0x18242f[_0x762b('0x33')][_0x762b('0x34')]};});_0x242820[_0x762b('0x35')]=_[_0x762b('0x36')](_0x3ee707,_0x762b('0x2e'));_0x242820[_0x762b('0x37')]=_[_0x762b('0x38')](_0x22d285['query']);_0x242820[_0x762b('0x39')]=_['intersection'](_0x242820[_0x762b('0x35')],_0x242820[_0x762b('0x37')]);_0xa051d3[_0x762b('0x3a')]=_[_0x762b('0x3b')](_0x242820[_0x762b('0x35')],qs[_0x762b('0x3c')](_0x22d285['query'][_0x762b('0x3c')]));_0xa051d3[_0x762b('0x3a')]=_0xa051d3[_0x762b('0x3a')][_0x762b('0x3d')]?_0xa051d3[_0x762b('0x3a')]:_0x242820[_0x762b('0x35')];if(!_0x22d285[_0x762b('0x37')]['hasOwnProperty'](_0x762b('0x3e'))){_0xa051d3[_0x762b('0x21')]=qs[_0x762b('0x21')](_0x22d285[_0x762b('0x37')][_0x762b('0x21')]);_0xa051d3[_0x762b('0x1e')]=qs[_0x762b('0x1e')](_0x22d285[_0x762b('0x37')]['offset']);}_0xa051d3[_0x762b('0x3f')]=qs['sort'](_0x22d285['query'][_0x762b('0x40')]);_0xa051d3[_0x762b('0x41')]=qs[_0x762b('0x39')](_[_0x762b('0x42')](_0x22d285[_0x762b('0x37')],_0x242820['filters']),_0x3ee707);if(_0x22d285[_0x762b('0x37')]['filter']){_0xa051d3['where']=_[_0x762b('0x43')](_0xa051d3['where'],{'$or':_[_0x762b('0x36')](_0x3ee707,function(_0x1b6cac){if(_0x1b6cac[_0x762b('0x33')]!==_0x762b('0x44')){var _0x4be3f6={};_0x4be3f6[_0x1b6cac[_0x762b('0x2e')]]={'$like':'%'+_0x22d285[_0x762b('0x37')][_0x762b('0x45')]+'%'};return _0x4be3f6;}})});}_0xa051d3=_[_0x762b('0x43')]({},_0xa051d3,_0x22d285[_0x762b('0x46')]);var _0x46db54={'where':_0xa051d3[_0x762b('0x41')]};return db[_0x762b('0x30')][_0x762b('0x20')](_0x46db54)[_0x762b('0x27')](function(_0x24f1ef){_0xa7ec35[_0x762b('0x20')]=_0x24f1ef;if(_0x22d285[_0x762b('0x37')][_0x762b('0x47')]){_0xa051d3[_0x762b('0x48')]=[{'all':!![]}];}return db[_0x762b('0x30')]['findAll'](_0xa051d3);})[_0x762b('0x27')](function(_0x599fa6){_0xa7ec35[_0x762b('0x49')]=_0x599fa6;return _0xa7ec35;})['then'](respondWithFilteredResult(_0x2c73b6,_0xa051d3))[_0x762b('0x4a')](handleError(_0x2c73b6,null));};exports['show']=function(_0x227732,_0x54dcff){var _0x1bb4f5={'raw':![],'where':{'id':_0x227732['params']['id']}},_0x3e6bcb={};_0x3e6bcb[_0x762b('0x35')]=_[_0x762b('0x38')](db['JscriptyProject'][_0x762b('0x31')]);_0x3e6bcb[_0x762b('0x37')]=_[_0x762b('0x38')](_0x227732[_0x762b('0x37')]);_0x3e6bcb[_0x762b('0x39')]=_[_0x762b('0x3b')](_0x3e6bcb[_0x762b('0x35')],_0x3e6bcb[_0x762b('0x37')]);_0x1bb4f5[_0x762b('0x3a')]=_[_0x762b('0x3b')](_0x3e6bcb[_0x762b('0x35')],qs[_0x762b('0x3c')](_0x227732[_0x762b('0x37')][_0x762b('0x3c')]));_0x1bb4f5[_0x762b('0x3a')]=_0x1bb4f5[_0x762b('0x3a')][_0x762b('0x3d')]?_0x1bb4f5['attributes']:_0x3e6bcb[_0x762b('0x35')];if(_0x227732[_0x762b('0x37')][_0x762b('0x47')]){_0x1bb4f5[_0x762b('0x48')]=[{'all':!![]}];}_0x1bb4f5=_[_0x762b('0x43')]({},_0x1bb4f5,_0x227732[_0x762b('0x46')]);return db['JscriptyProject'][_0x762b('0x4b')](_0x1bb4f5)[_0x762b('0x27')](handleEntityNotFound(_0x54dcff,null))['then'](respondWithResult(_0x54dcff,null))[_0x762b('0x4a')](handleError(_0x54dcff,null));};exports[_0x762b('0x4c')]=function(_0x2f0c76,_0x1a29c0){return db[_0x762b('0x30')][_0x762b('0x4c')](_0x2f0c76[_0x762b('0x4d')],{})[_0x762b('0x27')](function(_0x3cc674){var _0x4c12a7=_0x2f0c76[_0x762b('0x4e')][_0x762b('0x29')]({'plain':!![]});if(!_0x4c12a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c12a7[_0x762b('0x4f')]===_0x762b('0x4e')){var _0x558bea=_0x3cc674[_0x762b('0x29')]({'plain':!![]});var _0x2f8f2d=_0x762b('0x2a');return db[_0x762b('0x50')][_0x762b('0x4b')]({'where':{'name':_0x2f8f2d,'userProfileId':_0x4c12a7[_0x762b('0x51')]},'raw':!![]})['then'](function(_0x14c39e){if(_0x14c39e&&_0x14c39e['autoAssociation']===0x0){return db[_0x762b('0x2b')][_0x762b('0x4c')]({'name':_0x558bea[_0x762b('0x2e')],'resourceId':_0x558bea['id'],'type':_0x14c39e[_0x762b('0x2e')],'sectionId':_0x14c39e['id']},{})[_0x762b('0x27')](function(){return _0x3cc674;});}else{return _0x3cc674;}})[_0x762b('0x4a')](function(_0x3b8e3c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b8e3c);throw _0x3b8e3c;});}return _0x3cc674;})[_0x762b('0x27')](respondWithResult(_0x1a29c0,0xc9))[_0x762b('0x4a')](handleError(_0x1a29c0,null));};exports[_0x762b('0x52')]=function(_0x497dcd,_0x1ebf86){var _0x35942e={'where':{'id':_0x497dcd[_0x762b('0x53')]['id']}},_0x42ad91={};_0x42ad91[_0x762b('0x35')]=_[_0x762b('0x38')](db[_0x762b('0x30')][_0x762b('0x31')]);_0x35942e[_0x762b('0x3a')]=_[_0x762b('0x3b')](_0x42ad91['model'],qs[_0x762b('0x3c')](_0x497dcd[_0x762b('0x37')]['fields']));_0x35942e[_0x762b('0x3a')]=_0x35942e[_0x762b('0x3a')][_0x762b('0x3d')]?_0x35942e[_0x762b('0x3a')]:_0x42ad91[_0x762b('0x35')];if(_0x497dcd[_0x762b('0x37')][_0x762b('0x47')]){_0x35942e[_0x762b('0x48')]=[{'all':!![]}];}_0x35942e=_[_0x762b('0x43')]({},_0x35942e,_0x497dcd[_0x762b('0x46')]);return db[_0x762b('0x30')][_0x762b('0x4b')](_0x35942e)[_0x762b('0x27')](handleEntityNotFound(_0x1ebf86,null))[_0x762b('0x27')](function(_0x418554){if(_0x418554){var _0x1724af=_0x418554[_0x762b('0x29')]({'plain':!![]});_0x1724af=qs[_0x762b('0x54')](_0x1724af,['id','createdAt',_0x762b('0x55')]);_0x497dcd[_0x762b('0x4d')]=_['omit'](_0x497dcd['body'],['id',_0x762b('0x56'),_0x762b('0x55')]);return db[_0x762b('0x30')][_0x762b('0x4c')](_['merge'](_0x1724af,_0x497dcd[_0x762b('0x4d')]),{'include':_0x497dcd[_0x762b('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x762b('0x27')](function(_0x4c4017){var _0x37346f=_0x497dcd[_0x762b('0x4e')][_0x762b('0x29')]({'plain':!![]});if(!_0x37346f)throw new Error(_0x762b('0x57'));if(_0x37346f['role']===_0x762b('0x4e')){var _0xabdd7b=_0x4c4017[_0x762b('0x29')]({'plain':!![]});var _0xd087f6='Projects';return db[_0x762b('0x50')]['find']({'where':{'name':_0xd087f6,'userProfileId':_0x37346f[_0x762b('0x51')]},'raw':!![]})[_0x762b('0x27')](function(_0x177b3c){if(_0x177b3c&&_0x177b3c[_0x762b('0x58')]===0x0){return db['UserProfileResource'][_0x762b('0x4c')]({'name':_0xabdd7b[_0x762b('0x2e')],'resourceId':_0xabdd7b['id'],'type':_0x177b3c['name'],'sectionId':_0x177b3c['id']},{})[_0x762b('0x27')](function(){return _0x4c4017;});}else{return _0x4c4017;}})[_0x762b('0x4a')](function(_0x2ad346){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ad346);throw _0x2ad346;});}return _0x4c4017;});}})[_0x762b('0x27')](respondWithResult(_0x1ebf86,0xc9))[_0x762b('0x4a')](handleError(_0x1ebf86,null));};exports[_0x762b('0x26')]=function(_0x32cc4b,_0x481398){if(_0x32cc4b[_0x762b('0x4d')]['id']){delete _0x32cc4b['body']['id'];}return db[_0x762b('0x30')][_0x762b('0x4b')]({'where':{'id':_0x32cc4b[_0x762b('0x53')]['id']}})[_0x762b('0x27')](handleEntityNotFound(_0x481398,null))[_0x762b('0x27')](saveUpdates(_0x32cc4b[_0x762b('0x4d')],null))[_0x762b('0x27')](respondWithResult(_0x481398,null))[_0x762b('0x4a')](handleError(_0x481398,null));};exports[_0x762b('0x28')]=function(_0x3c3aff,_0x2be01f){return db['JscriptyProject'][_0x762b('0x4b')]({'where':{'id':_0x3c3aff[_0x762b('0x53')]['id']}})[_0x762b('0x27')](handleEntityNotFound(_0x2be01f,null))[_0x762b('0x27')](removeEntity(_0x2be01f,null))[_0x762b('0x4a')](handleError(_0x2be01f,null));};exports[_0x762b('0x59')]=function(_0x100b3e,_0x10d375,_0xab2ad9){var _0xeae059={'raw':!![],'where':{}};var _0x4f395e={};var _0x33530e={'count':0x0,'rows':[]};return db[_0x762b('0x30')][_0x762b('0x5a')]({'where':{'id':_0x100b3e['params']['id']}})[_0x762b('0x27')](handleEntityNotFound(_0x10d375,null))[_0x762b('0x27')](function(_0x42c1fd){if(_0x42c1fd){_0x4f395e['model']=_[_0x762b('0x38')](db[_0x762b('0x5b')][_0x762b('0x31')]);_0x4f395e[_0x762b('0x37')]=_[_0x762b('0x38')](_0x100b3e[_0x762b('0x37')]);_0x4f395e[_0x762b('0x39')]=_[_0x762b('0x3b')](_0x4f395e['model'],_0x4f395e['query']);_0xeae059[_0x762b('0x3a')]=_[_0x762b('0x3b')](_0x4f395e[_0x762b('0x35')],qs[_0x762b('0x3c')](_0x100b3e['query'][_0x762b('0x3c')]));_0xeae059[_0x762b('0x3a')]=_0xeae059[_0x762b('0x3a')][_0x762b('0x3d')]?_0xeae059['attributes']:_0x4f395e[_0x762b('0x35')];if(!_0x100b3e[_0x762b('0x37')][_0x762b('0x5c')](_0x762b('0x3e'))){_0xeae059['limit']=qs['limit'](_0x100b3e[_0x762b('0x37')][_0x762b('0x21')]);_0xeae059[_0x762b('0x1e')]=qs['offset'](_0x100b3e[_0x762b('0x37')][_0x762b('0x1e')]);}_0xeae059['order']=qs['sort'](_0x100b3e[_0x762b('0x37')][_0x762b('0x40')]);_0xeae059[_0x762b('0x41')]=qs[_0x762b('0x39')](_[_0x762b('0x42')](_0x100b3e[_0x762b('0x37')],_0x4f395e[_0x762b('0x39')]));_0xeae059[_0x762b('0x41')][_0x762b('0x5d')]=_0x42c1fd['id'];if(_0x100b3e[_0x762b('0x37')][_0x762b('0x45')]){_0xeae059[_0x762b('0x41')]=_[_0x762b('0x43')](_0xeae059[_0x762b('0x41')],{'$or':_[_0x762b('0x36')](_0xeae059[_0x762b('0x3a')],function(_0x439f14){var _0xadff49={};_0xadff49[_0x439f14]={'$like':'%'+_0x100b3e[_0x762b('0x37')]['filter']+'%'};return _0xadff49;})});}_0xeae059=_['merge']({},_0xeae059,_0x100b3e[_0x762b('0x46')]);return db[_0x762b('0x5b')]['count']({'where':_0xeae059[_0x762b('0x41')]})[_0x762b('0x27')](function(_0x49e637){_0x33530e[_0x762b('0x20')]=_0x49e637;if(_0x100b3e['query'][_0x762b('0x47')]){_0xeae059['include']=[{'all':!![]}];}return db[_0x762b('0x5b')][_0x762b('0x5e')](_0xeae059);})['then'](function(_0x609d7f){_0x33530e[_0x762b('0x49')]=_0x609d7f;return _0x33530e;});}})[_0x762b('0x27')](respondWithFilteredResult(_0x10d375,_0xeae059))[_0x762b('0x4a')](handleError(_0x10d375,null));};exports[_0x762b('0x5f')]=function(_0x4b5f5a,_0x438ba5,_0x10073b){var _0x27a8cb={'raw':!![],'where':{}};var _0x283cbd={};var _0x20626f={'count':0x0,'rows':[]};return db[_0x762b('0x30')][_0x762b('0x5a')]({'where':{'id':_0x4b5f5a[_0x762b('0x53')]['id']}})[_0x762b('0x27')](handleEntityNotFound(_0x438ba5,null))[_0x762b('0x27')](function(_0x5c9983){if(_0x5c9983){_0x283cbd[_0x762b('0x35')]=_[_0x762b('0x38')](db[_0x762b('0x60')][_0x762b('0x31')]);_0x283cbd[_0x762b('0x37')]=_['keys'](_0x4b5f5a[_0x762b('0x37')]);_0x283cbd[_0x762b('0x39')]=_['intersection'](_0x283cbd['model'],_0x283cbd[_0x762b('0x37')]);_0x27a8cb['attributes']=_[_0x762b('0x3b')](_0x283cbd[_0x762b('0x35')],qs[_0x762b('0x3c')](_0x4b5f5a[_0x762b('0x37')][_0x762b('0x3c')]));_0x27a8cb[_0x762b('0x3a')]=_0x27a8cb['attributes'][_0x762b('0x3d')]?_0x27a8cb[_0x762b('0x3a')]:_0x283cbd[_0x762b('0x35')];if(!_0x4b5f5a[_0x762b('0x37')][_0x762b('0x5c')](_0x762b('0x3e'))){_0x27a8cb[_0x762b('0x21')]=qs['limit'](_0x4b5f5a[_0x762b('0x37')]['limit']);_0x27a8cb[_0x762b('0x1e')]=qs['offset'](_0x4b5f5a[_0x762b('0x37')][_0x762b('0x1e')]);}_0x27a8cb[_0x762b('0x3f')]=qs[_0x762b('0x40')](_0x4b5f5a['query'][_0x762b('0x40')]);_0x27a8cb[_0x762b('0x41')]=qs['filters'](_[_0x762b('0x42')](_0x4b5f5a[_0x762b('0x37')],_0x283cbd[_0x762b('0x39')]));_0x27a8cb[_0x762b('0x41')][_0x762b('0x5d')]=_0x5c9983['id'];if(_0x4b5f5a[_0x762b('0x37')][_0x762b('0x45')]){_0x27a8cb[_0x762b('0x41')]=_[_0x762b('0x43')](_0x27a8cb['where'],{'$or':_['map'](_0x27a8cb['attributes'],function(_0x1c1502){var _0x4970a5={};_0x4970a5[_0x1c1502]={'$like':'%'+_0x4b5f5a[_0x762b('0x37')][_0x762b('0x45')]+'%'};return _0x4970a5;})});}_0x27a8cb=_[_0x762b('0x43')]({},_0x27a8cb,_0x4b5f5a[_0x762b('0x46')]);return db[_0x762b('0x60')]['count']({'where':_0x27a8cb[_0x762b('0x41')]})[_0x762b('0x27')](function(_0x40a039){_0x20626f['count']=_0x40a039;if(_0x4b5f5a[_0x762b('0x37')]['includeAll']){_0x27a8cb[_0x762b('0x48')]=[{'all':!![]}];}return db[_0x762b('0x60')]['findAll'](_0x27a8cb);})[_0x762b('0x27')](function(_0x13ab2f){_0x20626f[_0x762b('0x49')]=_0x13ab2f;return _0x20626f;});}})[_0x762b('0x27')](respondWithFilteredResult(_0x438ba5,_0x27a8cb))[_0x762b('0x4a')](handleError(_0x438ba5,null));};function char(_0xcbc325){return'number'===typeof _0xcbc325?String[_0x762b('0x61')][_0x762b('0x23')](null,arguments):_0xcbc325;}function needsEncapsulation(_0x3dbe76){return!!_0x3dbe76&&(_0x3dbe76['toString']()[_0x762b('0x62')](char(0xd))>=0x0||_0x3dbe76['toString']()[_0x762b('0x62')](char(0xa))>=0x0||_0x3dbe76[_0x762b('0x63')]()['indexOf'](char(0x2c))>=0x0||_0x3dbe76['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x269189){var _0x4cd9d0=char(0x22),_0x43f07e='\x5c'+char(0x22),_0x42b7e2=_0x269189[_0x762b('0x63')]()[_0x762b('0x64')](new RegExp(_0x4cd9d0,'g'),_0x43f07e);return _0x4cd9d0+_0x42b7e2+_0x4cd9d0;}exports[_0x762b('0x65')]=function(_0x3c7e6b,_0x5097d,_0x5d8455){var _0x3836e4,_0x51e565;var _0x3d7635={'where':{'ProjectId':_0x3c7e6b[_0x762b('0x53')]['id']}};if(_0x3c7e6b[_0x762b('0x37')]['startTime']){_0x3d7635[_0x762b('0x41')][_0x762b('0x66')]=JSON[_0x762b('0x67')](_0x3c7e6b[_0x762b('0x37')][_0x762b('0x68')]);}return db[_0x762b('0x5b')][_0x762b('0x5e')](_0x3d7635)[_0x762b('0x27')](handleEntityNotFound(_0x5097d,null))['then'](function(_0x345a3d){if(_0x345a3d){_0x3836e4=_0x345a3d;return db[_0x762b('0x69')][_0x762b('0x5e')]({'where':{'SessionId':{'$in':_[_0x762b('0x36')](_0x3836e4,'id')},'ProjectId':_0x3c7e6b[_0x762b('0x53')]['id']},'order':'-createdAt'});}})[_0x762b('0x27')](handleEntityNotFound(_0x5097d,null))[_0x762b('0x27')](function(_0x21312c){if(_0x21312c){_0x51e565=_0x21312c;var _0x1a3cdd={};for(var _0x582bc0=0x0,_0x437751=_0x51e565[_0x762b('0x3d')];_0x582bc0<_0x437751;_0x582bc0++){if(!_0x1a3cdd[_0x762b('0x5c')](_0x51e565[_0x582bc0]['questionId'])){_0x1a3cdd[_0x51e565[_0x582bc0][_0x762b('0x6a')]]=needsEncapsulation(_0x51e565[_0x582bc0][_0x762b('0x6b')])?encapsulate(_0x51e565[_0x582bc0][_0x762b('0x6b')]):_0x51e565[_0x582bc0][_0x762b('0x6b')];}}var _0x32a601=[],_0x41096b={};for(var _0x28a0ee=0x0,_0x4bc0d0=_0x3836e4['length'];_0x28a0ee<_0x4bc0d0;_0x28a0ee++){_0x41096b={'ProjectId':_0x3c7e6b['params']['id'],'SessionId':_0x3836e4[_0x28a0ee]['id'],'StartTime':moment(_0x3836e4[_0x28a0ee][_0x762b('0x66')])['format'](_0x762b('0x6c'))};for(var _0x274aca=0x0,_0x37a7b0=_0x51e565[_0x762b('0x3d')];_0x274aca<_0x37a7b0;_0x274aca++){if(_0x51e565[_0x274aca][_0x762b('0x6d')]==_0x3836e4[_0x28a0ee]['id']&&_0x1a3cdd['hasOwnProperty'](_0x51e565[_0x274aca][_0x762b('0x6a')])){_0x41096b[_0x1a3cdd[_0x51e565[_0x274aca][_0x762b('0x6a')]]]=_0x51e565[_0x274aca][_0x762b('0x6e')];}}for(var _0x12ccd4 in _0x1a3cdd){if(!_0x41096b['hasOwnProperty'](_0x1a3cdd[_0x12ccd4])){_0x41096b[_0x1a3cdd[_0x12ccd4]]=null;}}_0x32a601[_0x762b('0x6f')](_0x41096b);}return _0x32a601;}})[_0x762b('0x27')](function(_0x579bd7){if(!_['isEmpty'](_0x579bd7)){var _0x29be30=toCsv(_0x579bd7);var _0x3e73d2=Date[_0x762b('0x70')]();fs[_0x762b('0x71')](util['format'](_0x762b('0x72'),_0x3c7e6b[_0x762b('0x53')]['id'],_0x3e73d2),_0x29be30);_0x5097d['setHeader']('Content-disposition',_0x762b('0x73')+util['format'](_0x762b('0x74'),_0x3c7e6b[_0x762b('0x53')]['id'],_0x3e73d2));_0x5097d[_0x762b('0x75')](_0x762b('0x76'),_0x762b('0x77'));return _0x5097d['download'](util[_0x762b('0x78')](_0x762b('0x72'),_0x3c7e6b[_0x762b('0x53')]['id'],_0x3e73d2));}else{return _0x5097d['sendStatus'](0xcc);}})[_0x762b('0x4a')](handleError(_0x5097d,null));}; \ No newline at end of file +var _0x5288=['error','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','indexOf','toString','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','Projects','UserProfileResource','end','sendStatus','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','includeAll','autoAssociation'];(function(_0x292716,_0x96d32){var _0x34cb57=function(_0x1d0cde){while(--_0x1d0cde){_0x292716['push'](_0x292716['shift']());}};_0x34cb57(++_0x96d32);}(_0x5288,0x1ed));var _0x8528=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x5288[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0x8528('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8528('0x1'));var jsonpatch=require(_0x8528('0x2'));var rp=require(_0x8528('0x3'));var moment=require(_0x8528('0x4'));var BPromise=require(_0x8528('0x5'));var Mustache=require(_0x8528('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8528('0x7'));var csv=require(_0x8528('0x8'));var ejs=require(_0x8528('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8528('0xa'));var squel=require(_0x8528('0xb'));var crypto=require(_0x8528('0xc'));var jsforce=require(_0x8528('0xd'));var deskjs=require(_0x8528('0xe'));var toCsv=require(_0x8528('0x8'));var querystring=require(_0x8528('0xf'));var Papa=require(_0x8528('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8528('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8528('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8528('0x13'));var config=require(_0x8528('0x14'));var licenseUtil=require(_0x8528('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x762a2,_0x5acf1e){_0x5acf1e=_0x5acf1e||0xcc;return function(_0x5d0cd6){if(_0x5d0cd6){return _0x762a2['sendStatus'](_0x5acf1e);}return _0x762a2['status'](_0x5acf1e)['end']();};}function respondWithResult(_0x309e34,_0x3f41bb){_0x3f41bb=_0x3f41bb||0xc8;return function(_0xad1ae){if(_0xad1ae){return _0x309e34[_0x8528('0x16')](_0x3f41bb)[_0x8528('0x17')](_0xad1ae);}};}function respondWithFilteredResult(_0x5cbb2e,_0x17db94){return function(_0x4daf42){if(_0x4daf42){var _0x5aac73=typeof _0x17db94[_0x8528('0x18')]===_0x8528('0x19')&&typeof _0x17db94['limit']===_0x8528('0x19');var _0x442731=_0x4daf42[_0x8528('0x1a')];var _0x1ba805=_0x5aac73?0x0:_0x17db94[_0x8528('0x18')];var _0x3e54bf=_0x5aac73?_0x4daf42[_0x8528('0x1a')]:_0x17db94[_0x8528('0x18')]+_0x17db94[_0x8528('0x1b')];var _0x536d94;if(_0x3e54bf>=_0x442731){_0x3e54bf=_0x442731;_0x536d94=0xc8;}else{_0x536d94=0xce;}_0x5cbb2e['status'](_0x536d94);return _0x5cbb2e[_0x8528('0x1c')]('Content-Range',_0x1ba805+'-'+_0x3e54bf+'/'+_0x442731)['json'](_0x4daf42);}return null;};}function patchUpdates(_0x549778){return function(_0x225b48){try{jsonpatch[_0x8528('0x1d')](_0x225b48,_0x549778,!![]);}catch(_0x25d9d7){return BPromise[_0x8528('0x1e')](_0x25d9d7);}return _0x225b48[_0x8528('0x1f')]();};}function saveUpdates(_0x7a4de8,_0x3c8a77){return function(_0xeeabfb){if(_0xeeabfb){return _0xeeabfb[_0x8528('0x20')](_0x7a4de8)[_0x8528('0x21')](function(_0x612377){return _0x612377;});}return null;};}function removeEntity(_0x2229b6,_0x2249c8){return function(_0x4a0735){if(_0x4a0735){return _0x4a0735[_0x8528('0x22')]()[_0x8528('0x21')](function(){var _0x24cfe7=_0x4a0735['get']({'plain':!![]});var _0xb4da99=_0x8528('0x23');return db[_0x8528('0x24')][_0x8528('0x22')]({'where':{'type':_0xb4da99,'resourceId':_0x24cfe7['id']}})[_0x8528('0x21')](function(){return _0x4a0735;});})[_0x8528('0x21')](function(){_0x2229b6[_0x8528('0x16')](0xcc)[_0x8528('0x25')]();});}};}function handleEntityNotFound(_0x58f6fe,_0x1769ed){return function(_0x3397d3){if(!_0x3397d3){_0x58f6fe[_0x8528('0x26')](0x194);}return _0x3397d3;};}function handleError(_0x17cd01,_0x142531){_0x142531=_0x142531||0x1f4;return function(_0x5c0a6a){logger['error'](_0x5c0a6a['stack']);if(_0x5c0a6a[_0x8528('0x27')]){delete _0x5c0a6a['name'];}_0x17cd01['status'](_0x142531)[_0x8528('0x28')](_0x5c0a6a);};}exports[_0x8528('0x29')]=function(_0x33951f,_0x4f1535){var _0x22fd47={},_0x3a0d5b={},_0x1744c3={'count':0x0,'rows':[]};var _0xe18834=_['map'](db[_0x8528('0x2a')][_0x8528('0x2b')],function(_0x95922f){return{'name':_0x95922f[_0x8528('0x2c')],'type':_0x95922f[_0x8528('0x2d')][_0x8528('0x2e')]};});_0x3a0d5b[_0x8528('0x2f')]=_[_0x8528('0x30')](_0xe18834,_0x8528('0x27'));_0x3a0d5b[_0x8528('0x31')]=_[_0x8528('0x32')](_0x33951f[_0x8528('0x31')]);_0x3a0d5b[_0x8528('0x33')]=_['intersection'](_0x3a0d5b[_0x8528('0x2f')],_0x3a0d5b[_0x8528('0x31')]);_0x22fd47['attributes']=_[_0x8528('0x34')](_0x3a0d5b[_0x8528('0x2f')],qs[_0x8528('0x35')](_0x33951f[_0x8528('0x31')][_0x8528('0x35')]));_0x22fd47[_0x8528('0x36')]=_0x22fd47[_0x8528('0x36')][_0x8528('0x37')]?_0x22fd47[_0x8528('0x36')]:_0x3a0d5b['model'];if(!_0x33951f['query'][_0x8528('0x38')](_0x8528('0x39'))){_0x22fd47[_0x8528('0x1b')]=qs[_0x8528('0x1b')](_0x33951f['query'][_0x8528('0x1b')]);_0x22fd47[_0x8528('0x18')]=qs[_0x8528('0x18')](_0x33951f[_0x8528('0x31')]['offset']);}_0x22fd47[_0x8528('0x3a')]=qs[_0x8528('0x3b')](_0x33951f['query'][_0x8528('0x3b')]);_0x22fd47[_0x8528('0x3c')]=qs[_0x8528('0x33')](_[_0x8528('0x3d')](_0x33951f[_0x8528('0x31')],_0x3a0d5b[_0x8528('0x33')]),_0xe18834);if(_0x33951f[_0x8528('0x31')][_0x8528('0x3e')]){_0x22fd47[_0x8528('0x3c')]=_[_0x8528('0x3f')](_0x22fd47[_0x8528('0x3c')],{'$or':_[_0x8528('0x30')](_0xe18834,function(_0x571352){if(_0x571352[_0x8528('0x2d')]!==_0x8528('0x40')){var _0x49db24={};_0x49db24[_0x571352['name']]={'$like':'%'+_0x33951f['query'][_0x8528('0x3e')]+'%'};return _0x49db24;}})});}_0x22fd47=_[_0x8528('0x3f')]({},_0x22fd47,_0x33951f[_0x8528('0x41')]);var _0x4adfd4={'where':_0x22fd47['where']};return db[_0x8528('0x2a')]['count'](_0x4adfd4)[_0x8528('0x21')](function(_0x507849){_0x1744c3['count']=_0x507849;if(_0x33951f[_0x8528('0x31')]['includeAll']){_0x22fd47[_0x8528('0x42')]=[{'all':!![]}];}return db[_0x8528('0x2a')][_0x8528('0x43')](_0x22fd47);})[_0x8528('0x21')](function(_0x1edaa9){_0x1744c3[_0x8528('0x44')]=_0x1edaa9;return _0x1744c3;})[_0x8528('0x21')](respondWithFilteredResult(_0x4f1535,_0x22fd47))[_0x8528('0x45')](handleError(_0x4f1535,null));};exports[_0x8528('0x46')]=function(_0x2a57c5,_0x563b1d){var _0x2093bc={'raw':![],'where':{'id':_0x2a57c5[_0x8528('0x47')]['id']}},_0xeb216c={};_0xeb216c[_0x8528('0x2f')]=_['keys'](db[_0x8528('0x2a')][_0x8528('0x2b')]);_0xeb216c[_0x8528('0x31')]=_[_0x8528('0x32')](_0x2a57c5[_0x8528('0x31')]);_0xeb216c[_0x8528('0x33')]=_[_0x8528('0x34')](_0xeb216c['model'],_0xeb216c['query']);_0x2093bc[_0x8528('0x36')]=_['intersection'](_0xeb216c['model'],qs[_0x8528('0x35')](_0x2a57c5[_0x8528('0x31')][_0x8528('0x35')]));_0x2093bc[_0x8528('0x36')]=_0x2093bc[_0x8528('0x36')][_0x8528('0x37')]?_0x2093bc['attributes']:_0xeb216c[_0x8528('0x2f')];if(_0x2a57c5[_0x8528('0x31')]['includeAll']){_0x2093bc[_0x8528('0x42')]=[{'all':!![]}];}_0x2093bc=_[_0x8528('0x3f')]({},_0x2093bc,_0x2a57c5[_0x8528('0x41')]);return db[_0x8528('0x2a')][_0x8528('0x48')](_0x2093bc)['then'](handleEntityNotFound(_0x563b1d,null))[_0x8528('0x21')](respondWithResult(_0x563b1d,null))[_0x8528('0x45')](handleError(_0x563b1d,null));};exports[_0x8528('0x49')]=function(_0x3e5974,_0x2d5bb6){return db[_0x8528('0x2a')][_0x8528('0x49')](_0x3e5974[_0x8528('0x4a')],{})[_0x8528('0x21')](function(_0x25084b){var _0x1f0eff=_0x3e5974['user'][_0x8528('0x4b')]({'plain':!![]});if(!_0x1f0eff)throw new Error(_0x8528('0x4c'));if(_0x1f0eff[_0x8528('0x4d')]==='user'){var _0x2adbb9=_0x25084b[_0x8528('0x4b')]({'plain':!![]});var _0x5d0f5a='Projects';return db[_0x8528('0x4e')][_0x8528('0x48')]({'where':{'name':_0x5d0f5a,'userProfileId':_0x1f0eff[_0x8528('0x4f')]},'raw':!![]})['then'](function(_0x3c6efd){if(_0x3c6efd&&_0x3c6efd['autoAssociation']===0x0){return db[_0x8528('0x24')][_0x8528('0x49')]({'name':_0x2adbb9[_0x8528('0x27')],'resourceId':_0x2adbb9['id'],'type':_0x3c6efd[_0x8528('0x27')],'sectionId':_0x3c6efd['id']},{})[_0x8528('0x21')](function(){return _0x25084b;});}else{return _0x25084b;}})[_0x8528('0x45')](function(_0x41425d){logger['error'](_0x8528('0x50'),_0x41425d);throw _0x41425d;});}return _0x25084b;})['then'](respondWithResult(_0x2d5bb6,0xc9))['catch'](handleError(_0x2d5bb6,null));};exports[_0x8528('0x51')]=function(_0x178886,_0x2ca53c){var _0x5493c9={'where':{'id':_0x178886[_0x8528('0x47')]['id']}},_0x4c34c6={};_0x4c34c6[_0x8528('0x2f')]=_[_0x8528('0x32')](db['JscriptyProject'][_0x8528('0x2b')]);_0x5493c9[_0x8528('0x36')]=_[_0x8528('0x34')](_0x4c34c6[_0x8528('0x2f')],qs['fields'](_0x178886[_0x8528('0x31')][_0x8528('0x35')]));_0x5493c9[_0x8528('0x36')]=_0x5493c9[_0x8528('0x36')]['length']?_0x5493c9[_0x8528('0x36')]:_0x4c34c6[_0x8528('0x2f')];if(_0x178886['query']['includeAll']){_0x5493c9['include']=[{'all':!![]}];}_0x5493c9=_[_0x8528('0x3f')]({},_0x5493c9,_0x178886[_0x8528('0x41')]);return db[_0x8528('0x2a')]['find'](_0x5493c9)['then'](handleEntityNotFound(_0x2ca53c,null))[_0x8528('0x21')](function(_0x1d1402){if(_0x1d1402){var _0x47312b=_0x1d1402[_0x8528('0x4b')]({'plain':!![]});_0x47312b=qs[_0x8528('0x52')](_0x47312b,['id',_0x8528('0x53'),_0x8528('0x54')]);_0x178886[_0x8528('0x4a')]=_[_0x8528('0x52')](_0x178886[_0x8528('0x4a')],['id','createdAt',_0x8528('0x54')]);return db[_0x8528('0x2a')][_0x8528('0x49')](_[_0x8528('0x3f')](_0x47312b,_0x178886['body']),{'include':_0x178886[_0x8528('0x31')][_0x8528('0x55')]?[{'all':!![]}]:undefined})[_0x8528('0x21')](function(_0x22bec9){var _0x5349bc=_0x178886['user']['get']({'plain':!![]});if(!_0x5349bc)throw new Error(_0x8528('0x4c'));if(_0x5349bc[_0x8528('0x4d')]==='user'){var _0x3d6c76=_0x22bec9[_0x8528('0x4b')]({'plain':!![]});var _0x185cf0=_0x8528('0x23');return db[_0x8528('0x4e')][_0x8528('0x48')]({'where':{'name':_0x185cf0,'userProfileId':_0x5349bc[_0x8528('0x4f')]},'raw':!![]})['then'](function(_0x5234df){if(_0x5234df&&_0x5234df[_0x8528('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d6c76[_0x8528('0x27')],'resourceId':_0x3d6c76['id'],'type':_0x5234df[_0x8528('0x27')],'sectionId':_0x5234df['id']},{})['then'](function(){return _0x22bec9;});}else{return _0x22bec9;}})['catch'](function(_0x3a4efd){logger[_0x8528('0x57')](_0x8528('0x50'),_0x3a4efd);throw _0x3a4efd;});}return _0x22bec9;});}})[_0x8528('0x21')](respondWithResult(_0x2ca53c,0xc9))[_0x8528('0x45')](handleError(_0x2ca53c,null));};exports[_0x8528('0x20')]=function(_0x1bca5e,_0x1e16da){if(_0x1bca5e['body']['id']){delete _0x1bca5e['body']['id'];}return db[_0x8528('0x2a')][_0x8528('0x48')]({'where':{'id':_0x1bca5e[_0x8528('0x47')]['id']}})[_0x8528('0x21')](handleEntityNotFound(_0x1e16da,null))[_0x8528('0x21')](saveUpdates(_0x1bca5e['body'],null))['then'](respondWithResult(_0x1e16da,null))[_0x8528('0x45')](handleError(_0x1e16da,null));};exports[_0x8528('0x22')]=function(_0x22d7e9,_0x3d2df4){return db[_0x8528('0x2a')]['find']({'where':{'id':_0x22d7e9[_0x8528('0x47')]['id']}})[_0x8528('0x21')](handleEntityNotFound(_0x3d2df4,null))[_0x8528('0x21')](removeEntity(_0x3d2df4,null))[_0x8528('0x45')](handleError(_0x3d2df4,null));};exports['getSessions']=function(_0x82732c,_0x65f696,_0x348e75){var _0x587aa1={'raw':!![],'where':{}};var _0x4e3af5={};var _0x227104={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8528('0x58')]({'where':{'id':_0x82732c[_0x8528('0x47')]['id']}})['then'](handleEntityNotFound(_0x65f696,null))[_0x8528('0x21')](function(_0x5224fc){if(_0x5224fc){_0x4e3af5['model']=_[_0x8528('0x32')](db['JscriptySessionReport'][_0x8528('0x2b')]);_0x4e3af5[_0x8528('0x31')]=_[_0x8528('0x32')](_0x82732c[_0x8528('0x31')]);_0x4e3af5[_0x8528('0x33')]=_['intersection'](_0x4e3af5[_0x8528('0x2f')],_0x4e3af5[_0x8528('0x31')]);_0x587aa1[_0x8528('0x36')]=_[_0x8528('0x34')](_0x4e3af5[_0x8528('0x2f')],qs[_0x8528('0x35')](_0x82732c['query'][_0x8528('0x35')]));_0x587aa1['attributes']=_0x587aa1[_0x8528('0x36')][_0x8528('0x37')]?_0x587aa1['attributes']:_0x4e3af5[_0x8528('0x2f')];if(!_0x82732c[_0x8528('0x31')][_0x8528('0x38')](_0x8528('0x39'))){_0x587aa1[_0x8528('0x1b')]=qs[_0x8528('0x1b')](_0x82732c['query']['limit']);_0x587aa1[_0x8528('0x18')]=qs[_0x8528('0x18')](_0x82732c[_0x8528('0x31')][_0x8528('0x18')]);}_0x587aa1[_0x8528('0x3a')]=qs[_0x8528('0x3b')](_0x82732c['query'][_0x8528('0x3b')]);_0x587aa1[_0x8528('0x3c')]=qs[_0x8528('0x33')](_[_0x8528('0x3d')](_0x82732c[_0x8528('0x31')],_0x4e3af5[_0x8528('0x33')]));_0x587aa1[_0x8528('0x3c')][_0x8528('0x59')]=_0x5224fc['id'];if(_0x82732c[_0x8528('0x31')][_0x8528('0x3e')]){_0x587aa1[_0x8528('0x3c')]=_[_0x8528('0x3f')](_0x587aa1[_0x8528('0x3c')],{'$or':_[_0x8528('0x30')](_0x587aa1[_0x8528('0x36')],function(_0x3f70ff){var _0x1feac2={};_0x1feac2[_0x3f70ff]={'$like':'%'+_0x82732c[_0x8528('0x31')][_0x8528('0x3e')]+'%'};return _0x1feac2;})});}_0x587aa1=_[_0x8528('0x3f')]({},_0x587aa1,_0x82732c[_0x8528('0x41')]);return db[_0x8528('0x5a')][_0x8528('0x1a')]({'where':_0x587aa1[_0x8528('0x3c')]})[_0x8528('0x21')](function(_0x7bebb1){_0x227104[_0x8528('0x1a')]=_0x7bebb1;if(_0x82732c['query']['includeAll']){_0x587aa1[_0x8528('0x42')]=[{'all':!![]}];}return db[_0x8528('0x5a')]['findAll'](_0x587aa1);})[_0x8528('0x21')](function(_0x5e52a0){_0x227104[_0x8528('0x44')]=_0x5e52a0;return _0x227104;});}})[_0x8528('0x21')](respondWithFilteredResult(_0x65f696,_0x587aa1))['catch'](handleError(_0x65f696,null));};exports[_0x8528('0x5b')]=function(_0x1b2403,_0x1bb8ed,_0x3e7b6e){var _0x276ce4={'raw':!![],'where':{}};var _0x3cee02={};var _0x606452={'count':0x0,'rows':[]};return db[_0x8528('0x2a')][_0x8528('0x58')]({'where':{'id':_0x1b2403[_0x8528('0x47')]['id']}})[_0x8528('0x21')](handleEntityNotFound(_0x1bb8ed,null))[_0x8528('0x21')](function(_0x547588){if(_0x547588){_0x3cee02[_0x8528('0x2f')]=_[_0x8528('0x32')](db[_0x8528('0x5c')][_0x8528('0x2b')]);_0x3cee02[_0x8528('0x31')]=_[_0x8528('0x32')](_0x1b2403[_0x8528('0x31')]);_0x3cee02[_0x8528('0x33')]=_[_0x8528('0x34')](_0x3cee02[_0x8528('0x2f')],_0x3cee02[_0x8528('0x31')]);_0x276ce4[_0x8528('0x36')]=_[_0x8528('0x34')](_0x3cee02[_0x8528('0x2f')],qs['fields'](_0x1b2403[_0x8528('0x31')]['fields']));_0x276ce4[_0x8528('0x36')]=_0x276ce4[_0x8528('0x36')][_0x8528('0x37')]?_0x276ce4[_0x8528('0x36')]:_0x3cee02[_0x8528('0x2f')];if(!_0x1b2403['query'][_0x8528('0x38')](_0x8528('0x39'))){_0x276ce4['limit']=qs[_0x8528('0x1b')](_0x1b2403[_0x8528('0x31')][_0x8528('0x1b')]);_0x276ce4[_0x8528('0x18')]=qs[_0x8528('0x18')](_0x1b2403[_0x8528('0x31')][_0x8528('0x18')]);}_0x276ce4[_0x8528('0x3a')]=qs[_0x8528('0x3b')](_0x1b2403['query'][_0x8528('0x3b')]);_0x276ce4[_0x8528('0x3c')]=qs[_0x8528('0x33')](_[_0x8528('0x3d')](_0x1b2403[_0x8528('0x31')],_0x3cee02['filters']));_0x276ce4[_0x8528('0x3c')][_0x8528('0x59')]=_0x547588['id'];if(_0x1b2403[_0x8528('0x31')][_0x8528('0x3e')]){_0x276ce4[_0x8528('0x3c')]=_['merge'](_0x276ce4[_0x8528('0x3c')],{'$or':_[_0x8528('0x30')](_0x276ce4['attributes'],function(_0x194c25){var _0x550360={};_0x550360[_0x194c25]={'$like':'%'+_0x1b2403['query'][_0x8528('0x3e')]+'%'};return _0x550360;})});}_0x276ce4=_[_0x8528('0x3f')]({},_0x276ce4,_0x1b2403[_0x8528('0x41')]);return db[_0x8528('0x5c')][_0x8528('0x1a')]({'where':_0x276ce4['where']})['then'](function(_0x2310bf){_0x606452['count']=_0x2310bf;if(_0x1b2403['query'][_0x8528('0x55')]){_0x276ce4[_0x8528('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8528('0x43')](_0x276ce4);})[_0x8528('0x21')](function(_0x22b3f8){_0x606452[_0x8528('0x44')]=_0x22b3f8;return _0x606452;});}})['then'](respondWithFilteredResult(_0x1bb8ed,_0x276ce4))[_0x8528('0x45')](handleError(_0x1bb8ed,null));};function char(_0x4766b5){return _0x8528('0x5d')===typeof _0x4766b5?String['fromCharCode']['apply'](null,arguments):_0x4766b5;}function needsEncapsulation(_0x47ba8b){return!!_0x47ba8b&&(_0x47ba8b['toString']()[_0x8528('0x5e')](char(0xd))>=0x0||_0x47ba8b[_0x8528('0x5f')]()[_0x8528('0x5e')](char(0xa))>=0x0||_0x47ba8b[_0x8528('0x5f')]()[_0x8528('0x5e')](char(0x2c))>=0x0||_0x47ba8b[_0x8528('0x5f')]()[_0x8528('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4fc719){var _0x2ec7fa=char(0x22),_0x4efffc='\x5c'+char(0x22),_0x395bf5=_0x4fc719[_0x8528('0x5f')]()['replace'](new RegExp(_0x2ec7fa,'g'),_0x4efffc);return _0x2ec7fa+_0x395bf5+_0x2ec7fa;}exports[_0x8528('0x60')]=function(_0x1dc1e3,_0x38394f,_0x3251ff){var _0x31264b,_0x4250b9;var _0xd3f5cf={'where':{'ProjectId':_0x1dc1e3[_0x8528('0x47')]['id']}};if(_0x1dc1e3[_0x8528('0x31')][_0x8528('0x61')]){_0xd3f5cf['where'][_0x8528('0x62')]=JSON[_0x8528('0x63')](_0x1dc1e3[_0x8528('0x31')]['startTime']);}return db[_0x8528('0x5a')][_0x8528('0x43')](_0xd3f5cf)[_0x8528('0x21')](handleEntityNotFound(_0x38394f,null))['then'](function(_0x216cc2){if(_0x216cc2){_0x31264b=_0x216cc2;return db[_0x8528('0x64')][_0x8528('0x43')]({'where':{'SessionId':{'$in':_[_0x8528('0x30')](_0x31264b,'id')},'ProjectId':_0x1dc1e3[_0x8528('0x47')]['id']},'order':_0x8528('0x65')});}})[_0x8528('0x21')](handleEntityNotFound(_0x38394f,null))[_0x8528('0x21')](function(_0x43ea7a){if(_0x43ea7a){_0x4250b9=_0x43ea7a;var _0x54c339={};for(var _0x28da01=0x0,_0xad147=_0x4250b9[_0x8528('0x37')];_0x28da01<_0xad147;_0x28da01++){if(!_0x54c339[_0x8528('0x38')](_0x4250b9[_0x28da01][_0x8528('0x66')])){_0x54c339[_0x4250b9[_0x28da01][_0x8528('0x66')]]=needsEncapsulation(_0x4250b9[_0x28da01][_0x8528('0x67')])?encapsulate(_0x4250b9[_0x28da01][_0x8528('0x67')]):_0x4250b9[_0x28da01][_0x8528('0x67')];}}var _0x354012=[],_0x44c154={};for(var _0x5393cc=0x0,_0x3965c3=_0x31264b[_0x8528('0x37')];_0x5393cc<_0x3965c3;_0x5393cc++){_0x44c154={'ProjectId':_0x1dc1e3[_0x8528('0x47')]['id'],'SessionId':_0x31264b[_0x5393cc]['id'],'StartTime':moment(_0x31264b[_0x5393cc][_0x8528('0x62')])[_0x8528('0x68')](_0x8528('0x69'))};for(var _0x4b295a=0x0,_0x2a08b5=_0x4250b9[_0x8528('0x37')];_0x4b295a<_0x2a08b5;_0x4b295a++){if(_0x4250b9[_0x4b295a][_0x8528('0x6a')]==_0x31264b[_0x5393cc]['id']&&_0x54c339[_0x8528('0x38')](_0x4250b9[_0x4b295a][_0x8528('0x66')])){_0x44c154[_0x54c339[_0x4250b9[_0x4b295a][_0x8528('0x66')]]]=_0x4250b9[_0x4b295a][_0x8528('0x6b')];}}for(var _0x21d90c in _0x54c339){if(!_0x44c154[_0x8528('0x38')](_0x54c339[_0x21d90c])){_0x44c154[_0x54c339[_0x21d90c]]=null;}}_0x354012[_0x8528('0x6c')](_0x44c154);}return _0x354012;}})[_0x8528('0x21')](function(_0x5bb62e){if(!_[_0x8528('0x6d')](_0x5bb62e)){var _0x54ad1b=toCsv(_0x5bb62e);var _0x2429f1=Date['now']();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1dc1e3[_0x8528('0x47')]['id'],_0x2429f1),_0x54ad1b);_0x38394f[_0x8528('0x6e')](_0x8528('0x6f'),_0x8528('0x70')+util[_0x8528('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x1dc1e3[_0x8528('0x47')]['id'],_0x2429f1));_0x38394f[_0x8528('0x6e')](_0x8528('0x71'),_0x8528('0x72'));return _0x38394f['download'](util[_0x8528('0x68')](_0x8528('0x73'),_0x1dc1e3[_0x8528('0x47')]['id'],_0x2429f1));}else{return _0x38394f[_0x8528('0x26')](0xcc);}})['catch'](handleError(_0x38394f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dbf4ae2..7e219e9 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 _0x6bdc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x5c24ec,_0x491893){var _0x27eae6=function(_0x2b5222){while(--_0x2b5222){_0x5c24ec['push'](_0x5c24ec['shift']());}};_0x27eae6(++_0x491893);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x286d30,_0x10a71a){_0x286d30=_0x286d30-0x0;var _0x2b334b=_0x6bdc[_0x286d30];return _0x2b334b;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./jscriptyProject.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf006=['bluebird','path','./jscriptyProject.attributes','exports','define','jscripty_projects','../../config/logger','api'];(function(_0x78546d,_0x474272){var _0x21f700=function(_0x51bc58){while(--_0x51bc58){_0x78546d['push'](_0x78546d['shift']());}};_0x21f700(++_0x474272);}(_0xf006,0x146));var _0x6f00=function(_0x3c85d4,_0x4262c4){_0x3c85d4=_0x3c85d4-0x0;var _0x1591e4=_0xf006[_0x3c85d4];return _0x1591e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('JscriptyProject',attributes,{'tableName':_0x6f00('0x7'),'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 d9ddced..ff14b0a 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e2686,_0x32e739){var _0x381b29=function(_0x5b8e08){while(--_0x5b8e08){_0x2e2686['push'](_0x2e2686['shift']());}};_0x381b29(++_0x32e739);}(_0x70e0,0x17b));var _0x070e=function(_0x8d9b88,_0x11b071){_0x8d9b88=_0x8d9b88-0x0;var _0x266a9a=_0x70e0[_0x8d9b88];return _0x266a9a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x10b130,_0x38fd74){var _0x149859=function(_0x237e1a){while(--_0x237e1a){_0x10b130['push'](_0x10b130['shift']());}};_0x149859(++_0x38fd74);}(_0xe706,0xa3));var _0x6e70=function(_0x13ba18,_0x39041f){_0x13ba18=_0x13ba18-0x0;var _0x5e292a=_0xe706[_0x13ba18];return _0x5e292a;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 985b94e..2eccbad 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 _0xd364=['post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xd364,0x1d4));var _0x4d36=function(_0x11160c,_0x3aca60){_0x11160c=_0x11160c-0x0;var _0x11a412=_0xd364[_0x11160c];return _0x11a412;};'use strict';var multer=require(_0x4d36('0x0'));var util=require(_0x4d36('0x1'));var path=require(_0x4d36('0x2'));var timeout=require(_0x4d36('0x3'));var express=require(_0x4d36('0x4'));var router=express[_0x4d36('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4d36('0x6'));var interaction=require(_0x4d36('0x7'));var config=require('../../config/environment');var controller=require(_0x4d36('0x8'));router[_0x4d36('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d36('0xa')]);router[_0x4d36('0x9')](_0x4d36('0xb'),auth[_0x4d36('0xc')](),controller[_0x4d36('0xd')]);router[_0x4d36('0x9')]('/:id',auth[_0x4d36('0xc')](),controller[_0x4d36('0xe')]);router[_0x4d36('0xf')]('/',auth[_0x4d36('0xc')](),controller[_0x4d36('0x10')]);router['put'](_0x4d36('0x11'),auth[_0x4d36('0xc')](),controller[_0x4d36('0x12')]);router['delete'](_0x4d36('0x11'),auth[_0x4d36('0xc')](),controller[_0x4d36('0x13')]);module[_0x4d36('0x14')]=router; \ No newline at end of file +var _0x5473=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x5473,0xb3));var _0x3547=function(_0x4f3ccf,_0x42f8e2){_0x4f3ccf=_0x4f3ccf-0x0;var _0x437adc=_0x5473[_0x4f3ccf];return _0x437adc;};'use strict';var multer=require(_0x3547('0x0'));var util=require(_0x3547('0x1'));var path=require('path');var timeout=require(_0x3547('0x2'));var express=require(_0x3547('0x3'));var router=express[_0x3547('0x4')]();var fs_extra=require(_0x3547('0x5'));var auth=require(_0x3547('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3547('0x7'));var controller=require(_0x3547('0x8'));router[_0x3547('0x9')]('/',auth[_0x3547('0xa')](),controller[_0x3547('0xb')]);router[_0x3547('0x9')](_0x3547('0xc'),auth[_0x3547('0xa')](),controller[_0x3547('0xd')]);router[_0x3547('0x9')](_0x3547('0xe'),auth[_0x3547('0xa')](),controller[_0x3547('0xf')]);router[_0x3547('0x10')]('/',auth[_0x3547('0xa')](),controller[_0x3547('0x11')]);router[_0x3547('0x12')](_0x3547('0xe'),auth[_0x3547('0xa')](),controller[_0x3547('0x13')]);router[_0x3547('0x14')](_0x3547('0xe'),auth[_0x3547('0xa')](),controller[_0x3547('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ae4de77..9d2a314 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x491c78,_0x4205d8){_0x491c78=_0x491c78-0x0;var _0x320167=_0x7a54[_0x491c78];return _0x320167;};'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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x10cec1,_0x381a35){_0x10cec1=_0x10cec1-0x0;var _0x169cf6=_0x7a54[_0x10cec1];return _0x169cf6;};'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 02a26ba..891ca2d 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 _0x09a1=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','catch','show','keys','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','JscriptyQuestionReport','rawAttributes','type','key','model'];(function(_0x12d603,_0x170b32){var _0x24c8fe=function(_0x5483d8){while(--_0x5483d8){_0x12d603['push'](_0x12d603['shift']());}};_0x24c8fe(++_0x170b32);}(_0x09a1,0xf0));var _0x109a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x09a1[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x109a('0x0'));var jsonpatch=require(_0x109a('0x1'));var rp=require(_0x109a('0x2'));var moment=require(_0x109a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x109a('0x4'));var util=require(_0x109a('0x5'));var path=require(_0x109a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x109a('0x7'));var fs=require('fs');var fs_extra=require(_0x109a('0x8'));var _=require(_0x109a('0x9'));var squel=require(_0x109a('0xa'));var crypto=require('crypto');var jsforce=require(_0x109a('0xb'));var deskjs=require(_0x109a('0xc'));var toCsv=require(_0x109a('0xd'));var querystring=require('querystring');var Papa=require(_0x109a('0xe'));var Redis=require(_0x109a('0xf'));var authService=require(_0x109a('0x10'));var qs=require(_0x109a('0x11'));var as=require(_0x109a('0x12'));var hardwareService=require(_0x109a('0x13'));var logger=require(_0x109a('0x14'))(_0x109a('0x15'));var utils=require(_0x109a('0x16'));var config=require(_0x109a('0x17'));var licenseUtil=require(_0x109a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x101355,_0x3d0bb3){_0x3d0bb3=_0x3d0bb3||0xcc;return function(_0x57606f){if(_0x57606f){return _0x101355['sendStatus'](_0x3d0bb3);}return _0x101355[_0x109a('0x19')](_0x3d0bb3)[_0x109a('0x1a')]();};}function respondWithResult(_0x2149c0,_0x4e9b6f){_0x4e9b6f=_0x4e9b6f||0xc8;return function(_0x43431){if(_0x43431){return _0x2149c0[_0x109a('0x19')](_0x4e9b6f)[_0x109a('0x1b')](_0x43431);}};}function respondWithFilteredResult(_0x5152b1,_0xf61eee){return function(_0x3ae0e9){if(_0x3ae0e9){var _0x3c0f39=typeof _0xf61eee[_0x109a('0x1c')]==='undefined'&&typeof _0xf61eee[_0x109a('0x1d')]===_0x109a('0x1e');var _0x150eee=_0x3ae0e9[_0x109a('0x1f')];var _0x45d231=_0x3c0f39?0x0:_0xf61eee[_0x109a('0x1c')];var _0x431366=_0x3c0f39?_0x3ae0e9['count']:_0xf61eee['offset']+_0xf61eee[_0x109a('0x1d')];var _0x1ddfa3;if(_0x431366>=_0x150eee){_0x431366=_0x150eee;_0x1ddfa3=0xc8;}else{_0x1ddfa3=0xce;}_0x5152b1[_0x109a('0x19')](_0x1ddfa3);return _0x5152b1['set'](_0x109a('0x20'),_0x45d231+'-'+_0x431366+'/'+_0x150eee)['json'](_0x3ae0e9);}return null;};}function patchUpdates(_0x398013){return function(_0x5e8697){try{jsonpatch[_0x109a('0x21')](_0x5e8697,_0x398013,!![]);}catch(_0x20b103){return BPromise[_0x109a('0x22')](_0x20b103);}return _0x5e8697[_0x109a('0x23')]();};}function saveUpdates(_0x3a34b6,_0x210432){return function(_0x51fb5f){if(_0x51fb5f){return _0x51fb5f[_0x109a('0x24')](_0x3a34b6)[_0x109a('0x25')](function(_0xa6f2f7){return _0xa6f2f7;});}return null;};}function removeEntity(_0x2a0b06,_0x836149){return function(_0x59875e){if(_0x59875e){return _0x59875e[_0x109a('0x26')]()['then'](function(){_0x2a0b06[_0x109a('0x19')](0xcc)[_0x109a('0x1a')]();});}};}function handleEntityNotFound(_0xe66291,_0x1597a1){return function(_0x29e2ed){if(!_0x29e2ed){_0xe66291[_0x109a('0x27')](0x194);}return _0x29e2ed;};}function handleError(_0x32a050,_0x58c32c){_0x58c32c=_0x58c32c||0x1f4;return function(_0x24b1bc){logger[_0x109a('0x28')](_0x24b1bc['stack']);if(_0x24b1bc[_0x109a('0x29')]){delete _0x24b1bc[_0x109a('0x29')];}_0x32a050[_0x109a('0x19')](_0x58c32c)['send'](_0x24b1bc);};}exports['index']=function(_0x2a881e,_0x5bb661){var _0x23cf4e={},_0x3e43ed={},_0x4397a8={'count':0x0,'rows':[]};var _0xda7ea=_[_0x109a('0x2a')](db[_0x109a('0x2b')][_0x109a('0x2c')],function(_0x3e9f6c){return{'name':_0x3e9f6c['fieldName'],'type':_0x3e9f6c[_0x109a('0x2d')][_0x109a('0x2e')]};});_0x3e43ed[_0x109a('0x2f')]=_['map'](_0xda7ea,_0x109a('0x29'));_0x3e43ed[_0x109a('0x30')]=_['keys'](_0x2a881e[_0x109a('0x30')]);_0x3e43ed[_0x109a('0x31')]=_[_0x109a('0x32')](_0x3e43ed[_0x109a('0x2f')],_0x3e43ed[_0x109a('0x30')]);_0x23cf4e['attributes']=_[_0x109a('0x32')](_0x3e43ed[_0x109a('0x2f')],qs[_0x109a('0x33')](_0x2a881e['query'][_0x109a('0x33')]));_0x23cf4e['attributes']=_0x23cf4e[_0x109a('0x34')][_0x109a('0x35')]?_0x23cf4e[_0x109a('0x34')]:_0x3e43ed[_0x109a('0x2f')];if(!_0x2a881e[_0x109a('0x30')][_0x109a('0x36')](_0x109a('0x37'))){_0x23cf4e[_0x109a('0x1d')]=qs[_0x109a('0x1d')](_0x2a881e['query'][_0x109a('0x1d')]);_0x23cf4e[_0x109a('0x1c')]=qs[_0x109a('0x1c')](_0x2a881e[_0x109a('0x30')][_0x109a('0x1c')]);}_0x23cf4e[_0x109a('0x38')]=qs['sort'](_0x2a881e[_0x109a('0x30')]['sort']);_0x23cf4e[_0x109a('0x39')]=qs[_0x109a('0x31')](_[_0x109a('0x3a')](_0x2a881e[_0x109a('0x30')],_0x3e43ed[_0x109a('0x31')]),_0xda7ea);if(_0x2a881e['query'][_0x109a('0x3b')]){_0x23cf4e['where']=_[_0x109a('0x3c')](_0x23cf4e['where'],{'$or':_[_0x109a('0x2a')](_0xda7ea,function(_0x2d067d){if(_0x2d067d[_0x109a('0x2d')]!=='VIRTUAL'){var _0x2587cf={};_0x2587cf[_0x2d067d['name']]={'$like':'%'+_0x2a881e['query']['filter']+'%'};return _0x2587cf;}})});}_0x23cf4e=_['merge']({},_0x23cf4e,_0x2a881e[_0x109a('0x3d')]);var _0x25ba78={'where':_0x23cf4e[_0x109a('0x39')]};return db[_0x109a('0x2b')]['count'](_0x25ba78)[_0x109a('0x25')](function(_0x1245bd){_0x4397a8[_0x109a('0x1f')]=_0x1245bd;if(_0x2a881e[_0x109a('0x30')][_0x109a('0x3e')]){_0x23cf4e[_0x109a('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x23cf4e);})[_0x109a('0x25')](function(_0x38ef27){_0x4397a8['rows']=_0x38ef27;return _0x4397a8;})[_0x109a('0x25')](respondWithFilteredResult(_0x5bb661,_0x23cf4e))[_0x109a('0x40')](handleError(_0x5bb661,null));};exports[_0x109a('0x41')]=function(_0x1e0377,_0x36877e){var _0x188791={'raw':!![],'where':{'id':_0x1e0377['params']['id']}},_0x59287c={};_0x59287c['model']=_[_0x109a('0x42')](db[_0x109a('0x2b')][_0x109a('0x2c')]);_0x59287c[_0x109a('0x30')]=_[_0x109a('0x42')](_0x1e0377[_0x109a('0x30')]);_0x59287c[_0x109a('0x31')]=_[_0x109a('0x32')](_0x59287c[_0x109a('0x2f')],_0x59287c[_0x109a('0x30')]);_0x188791[_0x109a('0x34')]=_['intersection'](_0x59287c[_0x109a('0x2f')],qs['fields'](_0x1e0377['query']['fields']));_0x188791[_0x109a('0x34')]=_0x188791['attributes'][_0x109a('0x35')]?_0x188791[_0x109a('0x34')]:_0x59287c['model'];if(_0x1e0377[_0x109a('0x30')][_0x109a('0x3e')]){_0x188791[_0x109a('0x3f')]=[{'all':!![]}];}_0x188791=_[_0x109a('0x3c')]({},_0x188791,_0x1e0377[_0x109a('0x3d')]);return db['JscriptyQuestionReport'][_0x109a('0x43')](_0x188791)[_0x109a('0x25')](handleEntityNotFound(_0x36877e,null))['then'](respondWithResult(_0x36877e,null))[_0x109a('0x40')](handleError(_0x36877e,null));};exports[_0x109a('0x44')]=function(_0x3eebde,_0xbb946){return db[_0x109a('0x2b')][_0x109a('0x44')](_0x3eebde[_0x109a('0x45')],{})[_0x109a('0x25')](respondWithResult(_0xbb946,0xc9))['catch'](handleError(_0xbb946,null));};exports[_0x109a('0x24')]=function(_0x1fe096,_0x38a74a){if(_0x1fe096['body']['id']){delete _0x1fe096[_0x109a('0x45')]['id'];}return db[_0x109a('0x2b')]['find']({'where':{'id':_0x1fe096[_0x109a('0x46')]['id']}})['then'](handleEntityNotFound(_0x38a74a,null))[_0x109a('0x25')](saveUpdates(_0x1fe096['body'],null))[_0x109a('0x25')](respondWithResult(_0x38a74a,null))['catch'](handleError(_0x38a74a,null));};exports[_0x109a('0x26')]=function(_0x5e82f3,_0x557d05){return db[_0x109a('0x2b')][_0x109a('0x43')]({'where':{'id':_0x5e82f3[_0x109a('0x46')]['id']}})[_0x109a('0x25')](handleEntityNotFound(_0x557d05,null))[_0x109a('0x25')](removeEntity(_0x557d05,null))[_0x109a('0x40')](handleError(_0x557d05,null));};exports[_0x109a('0x47')]=function(_0x1c1a38,_0x50dfb2){return db[_0x109a('0x2b')][_0x109a('0x47')]()[_0x109a('0x25')](respondWithResult(_0x50dfb2,null))[_0x109a('0x40')](handleError(_0x50dfb2,null));}; \ No newline at end of file +var _0xa612=['pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x39439f,_0x5de32c){var _0x5bb4d7=function(_0x4dfe56){while(--_0x4dfe56){_0x39439f['push'](_0x39439f['shift']());}};_0x5bb4d7(++_0x5de32c);}(_0xa612,0x187));var _0x2a61=function(_0x4bfbff,_0x511024){_0x4bfbff=_0x4bfbff-0x0;var _0x3f908d=_0xa612[_0x4bfbff];return _0x3f908d;};'use strict';var emlformat=require(_0x2a61('0x0'));var rimraf=require(_0x2a61('0x1'));var zipdir=require(_0x2a61('0x2'));var jsonpatch=require(_0x2a61('0x3'));var rp=require(_0x2a61('0x4'));var moment=require(_0x2a61('0x5'));var BPromise=require(_0x2a61('0x6'));var Mustache=require(_0x2a61('0x7'));var util=require(_0x2a61('0x8'));var path=require('path');var sox=require(_0x2a61('0x9'));var csv=require('to-csv');var ejs=require(_0x2a61('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a61('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a61('0xc'));var deskjs=require(_0x2a61('0xd'));var toCsv=require(_0x2a61('0xe'));var querystring=require(_0x2a61('0xf'));var Papa=require(_0x2a61('0x10'));var Redis=require(_0x2a61('0x11'));var authService=require(_0x2a61('0x12'));var qs=require(_0x2a61('0x13'));var as=require(_0x2a61('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a61('0x15'))(_0x2a61('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2a61('0x17'))['db'];function respondWithStatusCode(_0x26228a,_0x1d8e45){_0x1d8e45=_0x1d8e45||0xcc;return function(_0x139429){if(_0x139429){return _0x26228a['sendStatus'](_0x1d8e45);}return _0x26228a[_0x2a61('0x18')](_0x1d8e45)[_0x2a61('0x19')]();};}function respondWithResult(_0x4aeab1,_0x5aac9e){_0x5aac9e=_0x5aac9e||0xc8;return function(_0x1d48eb){if(_0x1d48eb){return _0x4aeab1[_0x2a61('0x18')](_0x5aac9e)['json'](_0x1d48eb);}};}function respondWithFilteredResult(_0x3e3e6f,_0xac20b7){return function(_0x4718a1){if(_0x4718a1){var _0x545548=typeof _0xac20b7[_0x2a61('0x1a')]===_0x2a61('0x1b')&&typeof _0xac20b7[_0x2a61('0x1c')]===_0x2a61('0x1b');var _0x4cd55e=_0x4718a1['count'];var _0x458884=_0x545548?0x0:_0xac20b7[_0x2a61('0x1a')];var _0x5711ae=_0x545548?_0x4718a1[_0x2a61('0x1d')]:_0xac20b7[_0x2a61('0x1a')]+_0xac20b7[_0x2a61('0x1c')];var _0x554540;if(_0x5711ae>=_0x4cd55e){_0x5711ae=_0x4cd55e;_0x554540=0xc8;}else{_0x554540=0xce;}_0x3e3e6f[_0x2a61('0x18')](_0x554540);return _0x3e3e6f['set'](_0x2a61('0x1e'),_0x458884+'-'+_0x5711ae+'/'+_0x4cd55e)[_0x2a61('0x1f')](_0x4718a1);}return null;};}function patchUpdates(_0x5cbf89){return function(_0xe1dcce){try{jsonpatch[_0x2a61('0x20')](_0xe1dcce,_0x5cbf89,!![]);}catch(_0x5d93e8){return BPromise[_0x2a61('0x21')](_0x5d93e8);}return _0xe1dcce[_0x2a61('0x22')]();};}function saveUpdates(_0x46e516,_0x9975df){return function(_0x4c91d3){if(_0x4c91d3){return _0x4c91d3['update'](_0x46e516)[_0x2a61('0x23')](function(_0x368c18){return _0x368c18;});}return null;};}function removeEntity(_0x2e8581,_0x126059){return function(_0x40a61f){if(_0x40a61f){return _0x40a61f['destroy']()['then'](function(){_0x2e8581[_0x2a61('0x18')](0xcc)[_0x2a61('0x19')]();});}};}function handleEntityNotFound(_0x36f7f8,_0x1c601f){return function(_0x41b088){if(!_0x41b088){_0x36f7f8[_0x2a61('0x24')](0x194);}return _0x41b088;};}function handleError(_0x3b5890,_0xda05ee){_0xda05ee=_0xda05ee||0x1f4;return function(_0x3b00ef){logger[_0x2a61('0x25')](_0x3b00ef[_0x2a61('0x26')]);if(_0x3b00ef[_0x2a61('0x27')]){delete _0x3b00ef[_0x2a61('0x27')];}_0x3b5890[_0x2a61('0x18')](_0xda05ee)['send'](_0x3b00ef);};}exports[_0x2a61('0x28')]=function(_0x2e4565,_0x3ef56b){var _0x53d46b={},_0x58503a={},_0x4be4ca={'count':0x0,'rows':[]};var _0x471b7d=_[_0x2a61('0x29')](db[_0x2a61('0x2a')][_0x2a61('0x2b')],function(_0x1543ac){return{'name':_0x1543ac[_0x2a61('0x2c')],'type':_0x1543ac[_0x2a61('0x2d')]['key']};});_0x58503a[_0x2a61('0x2e')]=_['map'](_0x471b7d,_0x2a61('0x27'));_0x58503a[_0x2a61('0x2f')]=_[_0x2a61('0x30')](_0x2e4565[_0x2a61('0x2f')]);_0x58503a[_0x2a61('0x31')]=_[_0x2a61('0x32')](_0x58503a[_0x2a61('0x2e')],_0x58503a[_0x2a61('0x2f')]);_0x53d46b['attributes']=_[_0x2a61('0x32')](_0x58503a[_0x2a61('0x2e')],qs[_0x2a61('0x33')](_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x33')]));_0x53d46b['attributes']=_0x53d46b[_0x2a61('0x34')][_0x2a61('0x35')]?_0x53d46b[_0x2a61('0x34')]:_0x58503a[_0x2a61('0x2e')];if(!_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x36')](_0x2a61('0x37'))){_0x53d46b[_0x2a61('0x1c')]=qs[_0x2a61('0x1c')](_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x1c')]);_0x53d46b[_0x2a61('0x1a')]=qs['offset'](_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x1a')]);}_0x53d46b[_0x2a61('0x38')]=qs['sort'](_0x2e4565['query'][_0x2a61('0x39')]);_0x53d46b[_0x2a61('0x3a')]=qs[_0x2a61('0x31')](_[_0x2a61('0x3b')](_0x2e4565[_0x2a61('0x2f')],_0x58503a[_0x2a61('0x31')]),_0x471b7d);if(_0x2e4565['query']['filter']){_0x53d46b['where']=_[_0x2a61('0x3c')](_0x53d46b[_0x2a61('0x3a')],{'$or':_[_0x2a61('0x29')](_0x471b7d,function(_0x1281e1){if(_0x1281e1['type']!=='VIRTUAL'){var _0x55887c={};_0x55887c[_0x1281e1['name']]={'$like':'%'+_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x3d')]+'%'};return _0x55887c;}})});}_0x53d46b=_['merge']({},_0x53d46b,_0x2e4565[_0x2a61('0x3e')]);var _0x2a5750={'where':_0x53d46b[_0x2a61('0x3a')]};return db[_0x2a61('0x2a')]['count'](_0x2a5750)['then'](function(_0x4abd5b){_0x4be4ca[_0x2a61('0x1d')]=_0x4abd5b;if(_0x2e4565[_0x2a61('0x2f')][_0x2a61('0x3f')]){_0x53d46b[_0x2a61('0x40')]=[{'all':!![]}];}return db[_0x2a61('0x2a')][_0x2a61('0x41')](_0x53d46b);})['then'](function(_0x2e94a5){_0x4be4ca[_0x2a61('0x42')]=_0x2e94a5;return _0x4be4ca;})['then'](respondWithFilteredResult(_0x3ef56b,_0x53d46b))[_0x2a61('0x43')](handleError(_0x3ef56b,null));};exports[_0x2a61('0x44')]=function(_0x52e2ff,_0x358fb9){var _0xa447e1={'raw':!![],'where':{'id':_0x52e2ff[_0x2a61('0x45')]['id']}},_0x315318={};_0x315318[_0x2a61('0x2e')]=_['keys'](db[_0x2a61('0x2a')]['rawAttributes']);_0x315318[_0x2a61('0x2f')]=_[_0x2a61('0x30')](_0x52e2ff[_0x2a61('0x2f')]);_0x315318[_0x2a61('0x31')]=_[_0x2a61('0x32')](_0x315318[_0x2a61('0x2e')],_0x315318[_0x2a61('0x2f')]);_0xa447e1[_0x2a61('0x34')]=_[_0x2a61('0x32')](_0x315318[_0x2a61('0x2e')],qs[_0x2a61('0x33')](_0x52e2ff[_0x2a61('0x2f')]['fields']));_0xa447e1[_0x2a61('0x34')]=_0xa447e1[_0x2a61('0x34')]['length']?_0xa447e1[_0x2a61('0x34')]:_0x315318['model'];if(_0x52e2ff[_0x2a61('0x2f')]['includeAll']){_0xa447e1['include']=[{'all':!![]}];}_0xa447e1=_[_0x2a61('0x3c')]({},_0xa447e1,_0x52e2ff[_0x2a61('0x3e')]);return db['JscriptyQuestionReport']['find'](_0xa447e1)[_0x2a61('0x23')](handleEntityNotFound(_0x358fb9,null))['then'](respondWithResult(_0x358fb9,null))[_0x2a61('0x43')](handleError(_0x358fb9,null));};exports['create']=function(_0x3ff126,_0x5b7841){return db[_0x2a61('0x2a')][_0x2a61('0x46')](_0x3ff126['body'],{})[_0x2a61('0x23')](respondWithResult(_0x5b7841,0xc9))[_0x2a61('0x43')](handleError(_0x5b7841,null));};exports['update']=function(_0xe67b69,_0x563939){if(_0xe67b69[_0x2a61('0x47')]['id']){delete _0xe67b69[_0x2a61('0x47')]['id'];}return db[_0x2a61('0x2a')][_0x2a61('0x48')]({'where':{'id':_0xe67b69[_0x2a61('0x45')]['id']}})[_0x2a61('0x23')](handleEntityNotFound(_0x563939,null))[_0x2a61('0x23')](saveUpdates(_0xe67b69[_0x2a61('0x47')],null))[_0x2a61('0x23')](respondWithResult(_0x563939,null))['catch'](handleError(_0x563939,null));};exports[_0x2a61('0x49')]=function(_0x1be028,_0x505d36){return db[_0x2a61('0x2a')][_0x2a61('0x48')]({'where':{'id':_0x1be028[_0x2a61('0x45')]['id']}})['then'](handleEntityNotFound(_0x505d36,null))['then'](removeEntity(_0x505d36,null))[_0x2a61('0x43')](handleError(_0x505d36,null));};exports['describe']=function(_0x1c0b87,_0x5dbc8b){return db[_0x2a61('0x2a')][_0x2a61('0x4a')]()[_0x2a61('0x23')](respondWithResult(_0x5dbc8b,null))[_0x2a61('0x43')](handleError(_0x5dbc8b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5a1651f..2944f4f 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 _0x3fdf=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x29453f,_0x31dd47){var _0x30fdb0=function(_0xa056b5){while(--_0xa056b5){_0x29453f['push'](_0x29453f['shift']());}};_0x30fdb0(++_0x31dd47);}(_0x3fdf,0x182));var _0xf3fd=function(_0x2ac4b6,_0xe1845f){_0x2ac4b6=_0x2ac4b6-0x0;var _0x33bf73=_0x3fdf[_0x2ac4b6];return _0x33bf73;};'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 fs=require('fs');var path=require(_0xf3fd('0x7'));var rimraf=require('rimraf');var config=require(_0xf3fd('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2374d4,_0x56e158){return _0x2374d4[_0xf3fd('0x9')](_0xf3fd('0xa'),attributes,{'tableName':_0xf3fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca39=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x50cd29,_0x35f0f6){var _0xa6586b=function(_0x352f67){while(--_0x352f67){_0x50cd29['push'](_0x50cd29['shift']());}};_0xa6586b(++_0x35f0f6);}(_0xca39,0x1c4));var _0x9ca3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xca39[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9ca3('0x0'));var util=require(_0x9ca3('0x1'));var logger=require(_0x9ca3('0x2'))(_0x9ca3('0x3'));var moment=require(_0x9ca3('0x4'));var BPromise=require(_0x9ca3('0x5'));var rp=require(_0x9ca3('0x6'));var fs=require('fs');var path=require(_0x9ca3('0x7'));var rimraf=require(_0x9ca3('0x8'));var config=require(_0x9ca3('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x50325a,_0x2c7208){return _0x50325a[_0x9ca3('0xa')](_0x9ca3('0xb'),attributes,{'tableName':_0x9ca3('0xc'),'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 559a0cb..51168a3 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 _0x8823=['stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x33f192,_0x45a58e){var _0x2bf2f6=function(_0x5ce68a){while(--_0x5ce68a){_0x33f192['push'](_0x33f192['shift']());}};_0x2bf2f6(++_0x45a58e);}(_0x8823,0x79));var _0x3882=function(_0x4691b2,_0x94c43f){_0x4691b2=_0x4691b2-0x0;var _0x4990df=_0x8823[_0x4691b2];return _0x4990df;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3882('0x0'));var BPromise=require(_0x3882('0x1'));var rs=require(_0x3882('0x2'));var fs=require('fs');var Redis=require(_0x3882('0x3'));var db=require(_0x3882('0x4'))['db'];var utils=require(_0x3882('0x5'));var logger=require(_0x3882('0x6'))(_0x3882('0x7'));var config=require(_0x3882('0x8'));var jayson=require(_0x3882('0x9'));var client=jayson[_0x3882('0xa')][_0x3882('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522cd9,_0x882ca3,_0x3645ed){return new BPromise(function(_0x1417a4,_0x4e8917){return client['request'](_0x522cd9,_0x3645ed)[_0x3882('0xc')](function(_0x588f69){logger[_0x3882('0xd')](_0x3882('0xe'),_0x882ca3,_0x3882('0xf'));logger[_0x3882('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x882ca3,_0x3882('0xf'),JSON[_0x3882('0x11')](_0x588f69));if(_0x588f69[_0x3882('0x12')]){if(_0x588f69[_0x3882('0x12')][_0x3882('0x13')]===0x1f4){logger[_0x3882('0x12')](_0x3882('0xe'),_0x882ca3,_0x588f69[_0x3882('0x12')][_0x3882('0x14')]);return _0x4e8917(_0x588f69[_0x3882('0x12')][_0x3882('0x14')]);}logger[_0x3882('0x12')](_0x3882('0xe'),_0x882ca3,_0x588f69[_0x3882('0x12')][_0x3882('0x14')]);return _0x1417a4(_0x588f69[_0x3882('0x12')]['message']);}else{logger[_0x3882('0xd')](_0x3882('0xe'),_0x882ca3,_0x3882('0xf'));_0x1417a4(_0x588f69[_0x3882('0x15')]['message']);}})[_0x3882('0x16')](function(_0x42c508){logger[_0x3882('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x882ca3,_0x42c508);_0x4e8917(_0x42c508);});});} \ No newline at end of file +var _0x04fd=['../../config/logger','../../config/environment','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0x04fd,0x8d));var _0xd04f=function(_0x40ca25,_0x2c72be){_0x40ca25=_0x40ca25-0x0;var _0x3cd290=_0x04fd[_0x40ca25];return _0x3cd290;};'use strict';var _=require(_0xd04f('0x0'));var util=require('util');var moment=require(_0xd04f('0x1'));var BPromise=require('bluebird');var rs=require(_0xd04f('0x2'));var fs=require('fs');var Redis=require(_0xd04f('0x3'));var db=require(_0xd04f('0x4'))['db'];var utils=require(_0xd04f('0x5'));var logger=require(_0xd04f('0x6'))('rpc');var config=require(_0xd04f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd04f('0x8')][_0xd04f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfeb,_0x4805b2,_0x3ddc98){return new BPromise(function(_0x2c607a,_0x3aa4bf){return client[_0xd04f('0xa')](_0x55cfeb,_0x3ddc98)[_0xd04f('0xb')](function(_0x11c8c1){logger['info'](_0xd04f('0xc'),_0x4805b2,_0xd04f('0xd'));logger['debug'](_0xd04f('0xe'),_0x4805b2,_0xd04f('0xd'),JSON[_0xd04f('0xf')](_0x11c8c1));if(_0x11c8c1[_0xd04f('0x10')]){if(_0x11c8c1[_0xd04f('0x10')][_0xd04f('0x11')]===0x1f4){logger[_0xd04f('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4805b2,_0x11c8c1[_0xd04f('0x10')][_0xd04f('0x12')]);return _0x3aa4bf(_0x11c8c1[_0xd04f('0x10')][_0xd04f('0x12')]);}logger[_0xd04f('0x10')](_0xd04f('0xc'),_0x4805b2,_0x11c8c1[_0xd04f('0x10')][_0xd04f('0x12')]);return _0x2c607a(_0x11c8c1[_0xd04f('0x10')]['message']);}else{logger[_0xd04f('0x13')](_0xd04f('0xc'),_0x4805b2,_0xd04f('0xd'));_0x2c607a(_0x11c8c1[_0xd04f('0x14')][_0xd04f('0x12')]);}})['catch'](function(_0x2de3a0){logger[_0xd04f('0x10')](_0xd04f('0xc'),_0x4805b2,_0x2de3a0);_0x3aa4bf(_0x2de3a0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 86f58d5..a8ed236 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 _0xbf71=['connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show','/:id/questions','getQuestions','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x48e5dd,_0x38de66){var _0x3dcc7e=function(_0x2774ea){while(--_0x2774ea){_0x48e5dd['push'](_0x48e5dd['shift']());}};_0x3dcc7e(++_0x38de66);}(_0xbf71,0xe4));var _0x1bf7=function(_0x170add,_0x206e45){_0x170add=_0x170add-0x0;var _0x1249f1=_0xbf71[_0x170add];return _0x1249f1;};'use strict';var multer=require('multer');var util=require(_0x1bf7('0x0'));var path=require(_0x1bf7('0x1'));var timeout=require(_0x1bf7('0x2'));var express=require(_0x1bf7('0x3'));var router=express[_0x1bf7('0x4')]();var fs_extra=require(_0x1bf7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1bf7('0x6'));var controller=require(_0x1bf7('0x7'));router[_0x1bf7('0x8')]('/',auth[_0x1bf7('0x9')](),controller['index']);router[_0x1bf7('0x8')](_0x1bf7('0xa'),auth['isAuthenticated'](),controller[_0x1bf7('0xb')]);router[_0x1bf7('0x8')]('/:id',auth[_0x1bf7('0x9')](),controller[_0x1bf7('0xc')]);router[_0x1bf7('0x8')](_0x1bf7('0xd'),auth['isAuthenticated'](),controller[_0x1bf7('0xe')]);router[_0x1bf7('0xf')]('/',auth[_0x1bf7('0x9')](),controller[_0x1bf7('0x10')]);router[_0x1bf7('0x11')](_0x1bf7('0x12'),auth[_0x1bf7('0x9')](),controller[_0x1bf7('0x13')]);router[_0x1bf7('0x14')]('/:id',auth[_0x1bf7('0x9')](),controller[_0x1bf7('0x15')]);module[_0x1bf7('0x16')]=router; \ No newline at end of file +var _0x30a7=['create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post'];(function(_0x5471e8,_0x22be63){var _0x128a41=function(_0x45d4df){while(--_0x45d4df){_0x5471e8['push'](_0x5471e8['shift']());}};_0x128a41(++_0x22be63);}(_0x30a7,0x95));var _0x730a=function(_0x375179,_0x57d0cf){_0x375179=_0x375179-0x0;var _0x1b80b8=_0x30a7[_0x375179];return _0x1b80b8;};'use strict';var multer=require('multer');var util=require(_0x730a('0x0'));var path=require(_0x730a('0x1'));var timeout=require(_0x730a('0x2'));var express=require(_0x730a('0x3'));var router=express[_0x730a('0x4')]();var fs_extra=require(_0x730a('0x5'));var auth=require(_0x730a('0x6'));var interaction=require(_0x730a('0x7'));var config=require(_0x730a('0x8'));var controller=require(_0x730a('0x9'));router[_0x730a('0xa')]('/',auth[_0x730a('0xb')](),controller[_0x730a('0xc')]);router[_0x730a('0xa')](_0x730a('0xd'),auth[_0x730a('0xb')](),controller[_0x730a('0xe')]);router[_0x730a('0xa')](_0x730a('0xf'),auth[_0x730a('0xb')](),controller[_0x730a('0x10')]);router[_0x730a('0xa')](_0x730a('0x11'),auth[_0x730a('0xb')](),controller['getQuestions']);router[_0x730a('0x12')]('/',auth[_0x730a('0xb')](),controller[_0x730a('0x13')]);router[_0x730a('0x14')](_0x730a('0xf'),auth['isAuthenticated'](),controller[_0x730a('0x15')]);router[_0x730a('0x16')](_0x730a('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x730a('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 29b44b3..129edca 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 _0xfb10=['format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','setDataValue','starttime','endtime'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xfb10,0x191));var _0x0fb1=function(_0x44823a,_0x19e091){_0x44823a=_0x44823a-0x0;var _0x459828=_0xfb10[_0x44823a];return _0x459828;};'use strict';var moment=require('moment');var Sequelize=require(_0x0fb1('0x0'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x41572e){this[_0x0fb1('0x1')](_0x0fb1('0x2'),_0x41572e);this[_0x0fb1('0x1')](_0x0fb1('0x3'),moment()[_0x0fb1('0x4')](_0x0fb1('0x5')));}},'endtime':{'type':Sequelize[_0x0fb1('0x6')]},'membername':{'type':Sequelize[_0x0fb1('0x7')]},'projectname':{'type':Sequelize[_0x0fb1('0x7')]},'queue':{'type':Sequelize[_0x0fb1('0x7')]},'uniqueid':{'type':Sequelize[_0x0fb1('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0fb1('0x7')]},'completed':{'type':Sequelize[_0x0fb1('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x1f0a=['endtime','format','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0xb7582e,_0x1ab61d){var _0x4a4fcd=function(_0x2bb67b){while(--_0x2bb67b){_0xb7582e['push'](_0xb7582e['shift']());}};_0x4a4fcd(++_0x1ab61d);}(_0x1f0a,0x1cc));var _0xa1f0=function(_0x204c3a,_0x5129a7){_0x204c3a=_0x204c3a-0x0;var _0x465b9d=_0x1f0a[_0x204c3a];return _0x465b9d;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1f0('0x0'));module[_0xa1f0('0x1')]={'starttime':{'type':Sequelize[_0xa1f0('0x2')],'set':function(_0x201c3e){this[_0xa1f0('0x3')]('starttime',_0x201c3e);this[_0xa1f0('0x3')](_0xa1f0('0x4'),moment()[_0xa1f0('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa1f0('0x2')]},'membername':{'type':Sequelize[_0xa1f0('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa1f0('0x6')]},'calleridname':{'type':Sequelize[_0xa1f0('0x6')]},'calleridnum':{'type':Sequelize[_0xa1f0('0x6')]},'completed':{'type':Sequelize[_0xa1f0('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 0272493..8c7c594 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 _0x0a37=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','sort','pick','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils'];(function(_0x534617,_0x41a7ba){var _0x516e6a=function(_0x2cbb81){while(--_0x2cbb81){_0x534617['push'](_0x534617['shift']());}};_0x516e6a(++_0x41a7ba);}(_0x0a37,0x16d));var _0x70a3=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x0a37[_0x81e39d];return _0x548fbb;};'use strict';var emlformat=require(_0x70a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70a3('0x1'));var jsonpatch=require(_0x70a3('0x2'));var rp=require('request-promise');var moment=require(_0x70a3('0x3'));var BPromise=require(_0x70a3('0x4'));var Mustache=require(_0x70a3('0x5'));var util=require(_0x70a3('0x6'));var path=require(_0x70a3('0x7'));var sox=require(_0x70a3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70a3('0x9'));var _=require(_0x70a3('0xa'));var squel=require('squel');var crypto=require(_0x70a3('0xb'));var jsforce=require(_0x70a3('0xc'));var deskjs=require(_0x70a3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70a3('0xe'));var Papa=require(_0x70a3('0xf'));var Redis=require(_0x70a3('0x10'));var authService=require(_0x70a3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70a3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x70a3('0x13'));var config=require(_0x70a3('0x14'));var licenseUtil=require(_0x70a3('0x15'));var db=require(_0x70a3('0x16'))['db'];function respondWithStatusCode(_0x3bc072,_0x1e7086){_0x1e7086=_0x1e7086||0xcc;return function(_0x50dc8d){if(_0x50dc8d){return _0x3bc072[_0x70a3('0x17')](_0x1e7086);}return _0x3bc072[_0x70a3('0x18')](_0x1e7086)[_0x70a3('0x19')]();};}function respondWithResult(_0x597ee2,_0x438018){_0x438018=_0x438018||0xc8;return function(_0x3c4d7e){if(_0x3c4d7e){return _0x597ee2['status'](_0x438018)['json'](_0x3c4d7e);}};}function respondWithFilteredResult(_0x1b9271,_0x54f659){return function(_0x324ed4){if(_0x324ed4){var _0x1ef0ab=typeof _0x54f659['offset']===_0x70a3('0x1a')&&typeof _0x54f659[_0x70a3('0x1b')]===_0x70a3('0x1a');var _0x3ad8ce=_0x324ed4[_0x70a3('0x1c')];var _0x5cda2c=_0x1ef0ab?0x0:_0x54f659[_0x70a3('0x1d')];var _0x372788=_0x1ef0ab?_0x324ed4['count']:_0x54f659['offset']+_0x54f659[_0x70a3('0x1b')];var _0x1cfd4c;if(_0x372788>=_0x3ad8ce){_0x372788=_0x3ad8ce;_0x1cfd4c=0xc8;}else{_0x1cfd4c=0xce;}_0x1b9271[_0x70a3('0x18')](_0x1cfd4c);return _0x1b9271[_0x70a3('0x1e')]('Content-Range',_0x5cda2c+'-'+_0x372788+'/'+_0x3ad8ce)[_0x70a3('0x1f')](_0x324ed4);}return null;};}function patchUpdates(_0x3d4ebc){return function(_0x2d1f34){try{jsonpatch[_0x70a3('0x20')](_0x2d1f34,_0x3d4ebc,!![]);}catch(_0x41d478){return BPromise[_0x70a3('0x21')](_0x41d478);}return _0x2d1f34[_0x70a3('0x22')]();};}function saveUpdates(_0x5f2b40,_0x3cd3d5){return function(_0x2d48b9){if(_0x2d48b9){return _0x2d48b9['update'](_0x5f2b40)[_0x70a3('0x23')](function(_0x218f20){return _0x218f20;});}return null;};}function removeEntity(_0x56d4a6,_0x34f0a6){return function(_0x10b0c9){if(_0x10b0c9){return _0x10b0c9[_0x70a3('0x24')]()[_0x70a3('0x23')](function(){_0x56d4a6[_0x70a3('0x18')](0xcc)[_0x70a3('0x19')]();});}};}function handleEntityNotFound(_0x39857b,_0x4d9bd7){return function(_0x3163d3){if(!_0x3163d3){_0x39857b['sendStatus'](0x194);}return _0x3163d3;};}function handleError(_0x5e16cb,_0x1fdc5c){_0x1fdc5c=_0x1fdc5c||0x1f4;return function(_0x3aac39){logger[_0x70a3('0x25')](_0x3aac39['stack']);if(_0x3aac39[_0x70a3('0x26')]){delete _0x3aac39['name'];}_0x5e16cb[_0x70a3('0x18')](_0x1fdc5c)[_0x70a3('0x27')](_0x3aac39);};}exports[_0x70a3('0x28')]=function(_0x11016e,_0x2d9bbb){var _0xe524a6={},_0x44d202={},_0x2504ed={'count':0x0,'rows':[]};var _0x80103b=_[_0x70a3('0x29')](db[_0x70a3('0x2a')][_0x70a3('0x2b')],function(_0x5a5908){return{'name':_0x5a5908[_0x70a3('0x2c')],'type':_0x5a5908[_0x70a3('0x2d')]['key']};});_0x44d202[_0x70a3('0x2e')]=_['map'](_0x80103b,_0x70a3('0x26'));_0x44d202[_0x70a3('0x2f')]=_[_0x70a3('0x30')](_0x11016e[_0x70a3('0x2f')]);_0x44d202[_0x70a3('0x31')]=_['intersection'](_0x44d202['model'],_0x44d202[_0x70a3('0x2f')]);_0xe524a6['attributes']=_[_0x70a3('0x32')](_0x44d202[_0x70a3('0x2e')],qs[_0x70a3('0x33')](_0x11016e['query'][_0x70a3('0x33')]));_0xe524a6[_0x70a3('0x34')]=_0xe524a6[_0x70a3('0x34')]['length']?_0xe524a6['attributes']:_0x44d202['model'];if(!_0x11016e['query'][_0x70a3('0x35')](_0x70a3('0x36'))){_0xe524a6['limit']=qs[_0x70a3('0x1b')](_0x11016e[_0x70a3('0x2f')]['limit']);_0xe524a6[_0x70a3('0x1d')]=qs[_0x70a3('0x1d')](_0x11016e[_0x70a3('0x2f')][_0x70a3('0x1d')]);}_0xe524a6['order']=qs['sort'](_0x11016e[_0x70a3('0x2f')]['sort']);_0xe524a6[_0x70a3('0x37')]=qs[_0x70a3('0x31')](_['pick'](_0x11016e[_0x70a3('0x2f')],_0x44d202[_0x70a3('0x31')]),_0x80103b);if(_0x11016e[_0x70a3('0x2f')][_0x70a3('0x38')]){_0xe524a6[_0x70a3('0x37')]=_[_0x70a3('0x39')](_0xe524a6['where'],{'$or':_[_0x70a3('0x29')](_0x80103b,function(_0x4c7305){if(_0x4c7305[_0x70a3('0x2d')]!=='VIRTUAL'){var _0x3d2e16={};_0x3d2e16[_0x4c7305['name']]={'$like':'%'+_0x11016e[_0x70a3('0x2f')]['filter']+'%'};return _0x3d2e16;}})});}_0xe524a6=_[_0x70a3('0x39')]({},_0xe524a6,_0x11016e[_0x70a3('0x3a')]);var _0x1f9af8={'where':_0xe524a6['where']};return db[_0x70a3('0x2a')]['count'](_0x1f9af8)[_0x70a3('0x23')](function(_0x4a5b72){_0x2504ed[_0x70a3('0x1c')]=_0x4a5b72;if(_0x11016e[_0x70a3('0x2f')][_0x70a3('0x3b')]){_0xe524a6[_0x70a3('0x3c')]=[{'all':!![]}];}return db[_0x70a3('0x2a')][_0x70a3('0x3d')](_0xe524a6);})[_0x70a3('0x23')](function(_0x1e49b4){_0x2504ed[_0x70a3('0x3e')]=_0x1e49b4;return _0x2504ed;})[_0x70a3('0x23')](respondWithFilteredResult(_0x2d9bbb,_0xe524a6))[_0x70a3('0x3f')](handleError(_0x2d9bbb,null));};exports[_0x70a3('0x40')]=function(_0x5d283d,_0x47c0c5){var _0x5048bf={'raw':!![],'where':{'id':_0x5d283d[_0x70a3('0x41')]['id']}},_0x4f8039={};_0x4f8039[_0x70a3('0x2e')]=_['keys'](db['JscriptySessionReport'][_0x70a3('0x2b')]);_0x4f8039[_0x70a3('0x2f')]=_[_0x70a3('0x30')](_0x5d283d[_0x70a3('0x2f')]);_0x4f8039['filters']=_[_0x70a3('0x32')](_0x4f8039['model'],_0x4f8039['query']);_0x5048bf[_0x70a3('0x34')]=_[_0x70a3('0x32')](_0x4f8039['model'],qs['fields'](_0x5d283d[_0x70a3('0x2f')][_0x70a3('0x33')]));_0x5048bf['attributes']=_0x5048bf[_0x70a3('0x34')][_0x70a3('0x42')]?_0x5048bf[_0x70a3('0x34')]:_0x4f8039[_0x70a3('0x2e')];if(_0x5d283d[_0x70a3('0x2f')][_0x70a3('0x3b')]){_0x5048bf[_0x70a3('0x3c')]=[{'all':!![]}];}_0x5048bf=_[_0x70a3('0x39')]({},_0x5048bf,_0x5d283d[_0x70a3('0x3a')]);return db['JscriptySessionReport'][_0x70a3('0x43')](_0x5048bf)['then'](handleEntityNotFound(_0x47c0c5,null))[_0x70a3('0x23')](respondWithResult(_0x47c0c5,null))['catch'](handleError(_0x47c0c5,null));};exports[_0x70a3('0x44')]=function(_0x2a8dd2,_0xea9260){return db[_0x70a3('0x2a')]['create'](_0x2a8dd2['body'],{})[_0x70a3('0x23')](respondWithResult(_0xea9260,0xc9))[_0x70a3('0x3f')](handleError(_0xea9260,null));};exports['update']=function(_0x4e8da9,_0xb541ee){if(_0x4e8da9['body']['id']){delete _0x4e8da9[_0x70a3('0x45')]['id'];}return db[_0x70a3('0x2a')][_0x70a3('0x43')]({'where':{'id':_0x4e8da9['params']['id']}})[_0x70a3('0x23')](handleEntityNotFound(_0xb541ee,null))[_0x70a3('0x23')](saveUpdates(_0x4e8da9[_0x70a3('0x45')],null))[_0x70a3('0x23')](respondWithResult(_0xb541ee,null))[_0x70a3('0x3f')](handleError(_0xb541ee,null));};exports[_0x70a3('0x24')]=function(_0x53b809,_0x43b88b){return db[_0x70a3('0x2a')][_0x70a3('0x43')]({'where':{'id':_0x53b809[_0x70a3('0x41')]['id']}})[_0x70a3('0x23')](handleEntityNotFound(_0x43b88b,null))[_0x70a3('0x23')](removeEntity(_0x43b88b,null))[_0x70a3('0x3f')](handleError(_0x43b88b,null));};exports[_0x70a3('0x46')]=function(_0x55a877,_0x176556){return db[_0x70a3('0x2a')][_0x70a3('0x46')]()[_0x70a3('0x23')](respondWithResult(_0x176556,null))[_0x70a3('0x3f')](handleError(_0x176556,null));};exports[_0x70a3('0x47')]=function(_0x5f06b9,_0x4fb656,_0x53460f){var _0x313fc9={'raw':!![],'where':{}};var _0x72b7b1={};var _0x4391ef={'count':0x0,'rows':[]};return db[_0x70a3('0x2a')][_0x70a3('0x48')]({'where':{'id':_0x5f06b9['params']['id']}})[_0x70a3('0x23')](handleEntityNotFound(_0x4fb656,null))[_0x70a3('0x23')](function(_0xd0b660){if(_0xd0b660){_0x72b7b1['model']=_[_0x70a3('0x30')](db[_0x70a3('0x49')][_0x70a3('0x2b')]);_0x72b7b1[_0x70a3('0x2f')]=_['keys'](_0x5f06b9[_0x70a3('0x2f')]);_0x72b7b1['filters']=_[_0x70a3('0x32')](_0x72b7b1['model'],_0x72b7b1['query']);_0x313fc9[_0x70a3('0x34')]=_[_0x70a3('0x32')](_0x72b7b1[_0x70a3('0x2e')],qs['fields'](_0x5f06b9[_0x70a3('0x2f')][_0x70a3('0x33')]));_0x313fc9['attributes']=_0x313fc9[_0x70a3('0x34')]['length']?_0x313fc9[_0x70a3('0x34')]:_0x72b7b1[_0x70a3('0x2e')];if(!_0x5f06b9['query'][_0x70a3('0x35')](_0x70a3('0x36'))){_0x313fc9[_0x70a3('0x1b')]=qs[_0x70a3('0x1b')](_0x5f06b9['query'][_0x70a3('0x1b')]);_0x313fc9[_0x70a3('0x1d')]=qs[_0x70a3('0x1d')](_0x5f06b9[_0x70a3('0x2f')][_0x70a3('0x1d')]);}_0x313fc9[_0x70a3('0x4a')]=qs[_0x70a3('0x4b')](_0x5f06b9[_0x70a3('0x2f')][_0x70a3('0x4b')]);_0x313fc9['where']=qs[_0x70a3('0x31')](_[_0x70a3('0x4c')](_0x5f06b9[_0x70a3('0x2f')],_0x72b7b1['filters']));_0x313fc9[_0x70a3('0x37')]['SessionId']=_0xd0b660['id'];if(_0x5f06b9['query']['filter']){_0x313fc9[_0x70a3('0x37')]=_['merge'](_0x313fc9[_0x70a3('0x37')],{'$or':_['map'](_0x313fc9[_0x70a3('0x34')],function(_0x35e3b4){var _0x3c69f4={};_0x3c69f4[_0x35e3b4]={'$like':'%'+_0x5f06b9[_0x70a3('0x2f')]['filter']+'%'};return _0x3c69f4;})});}_0x313fc9=_[_0x70a3('0x39')]({},_0x313fc9,_0x5f06b9['options']);return db[_0x70a3('0x49')][_0x70a3('0x1c')]({'where':_0x313fc9[_0x70a3('0x37')]})['then'](function(_0x16dc77){_0x4391ef[_0x70a3('0x1c')]=_0x16dc77;if(_0x5f06b9['query'][_0x70a3('0x3b')]){_0x313fc9[_0x70a3('0x3c')]=[{'all':!![]}];}return db[_0x70a3('0x49')]['findAll'](_0x313fc9);})[_0x70a3('0x23')](function(_0x2c7de0){_0x4391ef['rows']=_0x2c7de0;return _0x4391ef;});}})['then'](respondWithFilteredResult(_0x4fb656,_0x313fc9))[_0x70a3('0x3f')](handleError(_0x4fb656,null));}; \ No newline at end of file +var _0x74ec=['../../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','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis'];(function(_0xf71220,_0x3ec190){var _0x6efb4f=function(_0x3cee9c){while(--_0x3cee9c){_0xf71220['push'](_0xf71220['shift']());}};_0x6efb4f(++_0x3ec190);}(_0x74ec,0x94));var _0xc74e=function(_0xf0c483,_0x4ff387){_0xf0c483=_0xf0c483-0x0;var _0xe18b59=_0x74ec[_0xf0c483];return _0xe18b59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc74e('0x0'));var rp=require(_0xc74e('0x1'));var moment=require(_0xc74e('0x2'));var BPromise=require(_0xc74e('0x3'));var Mustache=require(_0xc74e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc74e('0x5'));var csv=require(_0xc74e('0x6'));var ejs=require(_0xc74e('0x7'));var fs=require('fs');var fs_extra=require(_0xc74e('0x8'));var _=require(_0xc74e('0x9'));var squel=require(_0xc74e('0xa'));var crypto=require(_0xc74e('0xb'));var jsforce=require(_0xc74e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc74e('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc74e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc74e('0xe'));var as=require(_0xc74e('0xf'));var hardwareService=require(_0xc74e('0x10'));var logger=require(_0xc74e('0x11'))(_0xc74e('0x12'));var utils=require(_0xc74e('0x13'));var config=require(_0xc74e('0x14'));var licenseUtil=require(_0xc74e('0x15'));var db=require(_0xc74e('0x16'))['db'];function respondWithStatusCode(_0x8584a1,_0x41e478){_0x41e478=_0x41e478||0xcc;return function(_0x2cb2cb){if(_0x2cb2cb){return _0x8584a1['sendStatus'](_0x41e478);}return _0x8584a1[_0xc74e('0x17')](_0x41e478)[_0xc74e('0x18')]();};}function respondWithResult(_0x491aa2,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x3d9035){if(_0x3d9035){return _0x491aa2[_0xc74e('0x17')](_0x269909)[_0xc74e('0x19')](_0x3d9035);}};}function respondWithFilteredResult(_0xb6d607,_0x5d66e1){return function(_0x10b841){if(_0x10b841){var _0x16b858=typeof _0x5d66e1[_0xc74e('0x1a')]===_0xc74e('0x1b')&&typeof _0x5d66e1[_0xc74e('0x1c')]===_0xc74e('0x1b');var _0x28aceb=_0x10b841['count'];var _0x3684f8=_0x16b858?0x0:_0x5d66e1[_0xc74e('0x1a')];var _0x5a85f4=_0x16b858?_0x10b841['count']:_0x5d66e1[_0xc74e('0x1a')]+_0x5d66e1[_0xc74e('0x1c')];var _0x5d6259;if(_0x5a85f4>=_0x28aceb){_0x5a85f4=_0x28aceb;_0x5d6259=0xc8;}else{_0x5d6259=0xce;}_0xb6d607[_0xc74e('0x17')](_0x5d6259);return _0xb6d607[_0xc74e('0x1d')](_0xc74e('0x1e'),_0x3684f8+'-'+_0x5a85f4+'/'+_0x28aceb)[_0xc74e('0x19')](_0x10b841);}return null;};}function patchUpdates(_0x40c078){return function(_0xf678ce){try{jsonpatch[_0xc74e('0x1f')](_0xf678ce,_0x40c078,!![]);}catch(_0x5b9ab9){return BPromise[_0xc74e('0x20')](_0x5b9ab9);}return _0xf678ce['save']();};}function saveUpdates(_0x1888fd,_0x5ac943){return function(_0x1c407f){if(_0x1c407f){return _0x1c407f[_0xc74e('0x21')](_0x1888fd)[_0xc74e('0x22')](function(_0x16aabc){return _0x16aabc;});}return null;};}function removeEntity(_0x29054b,_0x34b1de){return function(_0x504ef2){if(_0x504ef2){return _0x504ef2[_0xc74e('0x23')]()[_0xc74e('0x22')](function(){_0x29054b[_0xc74e('0x17')](0xcc)[_0xc74e('0x18')]();});}};}function handleEntityNotFound(_0x21fef5,_0x63d1dd){return function(_0x3002e4){if(!_0x3002e4){_0x21fef5[_0xc74e('0x24')](0x194);}return _0x3002e4;};}function handleError(_0x2c06b9,_0x4335cc){_0x4335cc=_0x4335cc||0x1f4;return function(_0x31edfa){logger[_0xc74e('0x25')](_0x31edfa[_0xc74e('0x26')]);if(_0x31edfa[_0xc74e('0x27')]){delete _0x31edfa[_0xc74e('0x27')];}_0x2c06b9['status'](_0x4335cc)[_0xc74e('0x28')](_0x31edfa);};}exports['index']=function(_0x4859c0,_0x2eb60d){var _0x42b3c6={},_0x3825bf={},_0x194c79={'count':0x0,'rows':[]};var _0x4331ef=_[_0xc74e('0x29')](db[_0xc74e('0x2a')][_0xc74e('0x2b')],function(_0x1d0b92){return{'name':_0x1d0b92[_0xc74e('0x2c')],'type':_0x1d0b92['type'][_0xc74e('0x2d')]};});_0x3825bf[_0xc74e('0x2e')]=_[_0xc74e('0x29')](_0x4331ef,_0xc74e('0x27'));_0x3825bf[_0xc74e('0x2f')]=_[_0xc74e('0x30')](_0x4859c0[_0xc74e('0x2f')]);_0x3825bf[_0xc74e('0x31')]=_[_0xc74e('0x32')](_0x3825bf[_0xc74e('0x2e')],_0x3825bf['query']);_0x42b3c6[_0xc74e('0x33')]=_[_0xc74e('0x32')](_0x3825bf['model'],qs[_0xc74e('0x34')](_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x34')]));_0x42b3c6['attributes']=_0x42b3c6['attributes'][_0xc74e('0x35')]?_0x42b3c6[_0xc74e('0x33')]:_0x3825bf[_0xc74e('0x2e')];if(!_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x36')](_0xc74e('0x37'))){_0x42b3c6[_0xc74e('0x1c')]=qs[_0xc74e('0x1c')](_0x4859c0[_0xc74e('0x2f')]['limit']);_0x42b3c6[_0xc74e('0x1a')]=qs[_0xc74e('0x1a')](_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x1a')]);}_0x42b3c6[_0xc74e('0x38')]=qs[_0xc74e('0x39')](_0x4859c0['query']['sort']);_0x42b3c6['where']=qs[_0xc74e('0x31')](_[_0xc74e('0x3a')](_0x4859c0[_0xc74e('0x2f')],_0x3825bf[_0xc74e('0x31')]),_0x4331ef);if(_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x3b')]){_0x42b3c6[_0xc74e('0x3c')]=_[_0xc74e('0x3d')](_0x42b3c6[_0xc74e('0x3c')],{'$or':_['map'](_0x4331ef,function(_0xe37ff){if(_0xe37ff[_0xc74e('0x3e')]!==_0xc74e('0x3f')){var _0x3d98dd={};_0x3d98dd[_0xe37ff[_0xc74e('0x27')]]={'$like':'%'+_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x3b')]+'%'};return _0x3d98dd;}})});}_0x42b3c6=_[_0xc74e('0x3d')]({},_0x42b3c6,_0x4859c0[_0xc74e('0x40')]);var _0x275136={'where':_0x42b3c6[_0xc74e('0x3c')]};return db[_0xc74e('0x2a')][_0xc74e('0x41')](_0x275136)[_0xc74e('0x22')](function(_0x5b11fa){_0x194c79[_0xc74e('0x41')]=_0x5b11fa;if(_0x4859c0[_0xc74e('0x2f')][_0xc74e('0x42')]){_0x42b3c6[_0xc74e('0x43')]=[{'all':!![]}];}return db[_0xc74e('0x2a')][_0xc74e('0x44')](_0x42b3c6);})[_0xc74e('0x22')](function(_0x228249){_0x194c79[_0xc74e('0x45')]=_0x228249;return _0x194c79;})[_0xc74e('0x22')](respondWithFilteredResult(_0x2eb60d,_0x42b3c6))[_0xc74e('0x46')](handleError(_0x2eb60d,null));};exports[_0xc74e('0x47')]=function(_0x636796,_0x37584f){var _0x57781c={'raw':!![],'where':{'id':_0x636796['params']['id']}},_0x45ae21={};_0x45ae21[_0xc74e('0x2e')]=_[_0xc74e('0x30')](db[_0xc74e('0x2a')][_0xc74e('0x2b')]);_0x45ae21[_0xc74e('0x2f')]=_['keys'](_0x636796['query']);_0x45ae21[_0xc74e('0x31')]=_['intersection'](_0x45ae21[_0xc74e('0x2e')],_0x45ae21[_0xc74e('0x2f')]);_0x57781c['attributes']=_[_0xc74e('0x32')](_0x45ae21[_0xc74e('0x2e')],qs[_0xc74e('0x34')](_0x636796[_0xc74e('0x2f')][_0xc74e('0x34')]));_0x57781c[_0xc74e('0x33')]=_0x57781c[_0xc74e('0x33')][_0xc74e('0x35')]?_0x57781c[_0xc74e('0x33')]:_0x45ae21[_0xc74e('0x2e')];if(_0x636796['query']['includeAll']){_0x57781c[_0xc74e('0x43')]=[{'all':!![]}];}_0x57781c=_[_0xc74e('0x3d')]({},_0x57781c,_0x636796[_0xc74e('0x40')]);return db['JscriptySessionReport']['find'](_0x57781c)[_0xc74e('0x22')](handleEntityNotFound(_0x37584f,null))[_0xc74e('0x22')](respondWithResult(_0x37584f,null))[_0xc74e('0x46')](handleError(_0x37584f,null));};exports[_0xc74e('0x48')]=function(_0x5b980e,_0x5aeeb9){return db[_0xc74e('0x2a')][_0xc74e('0x48')](_0x5b980e[_0xc74e('0x49')],{})['then'](respondWithResult(_0x5aeeb9,0xc9))['catch'](handleError(_0x5aeeb9,null));};exports[_0xc74e('0x21')]=function(_0x52a9d0,_0x5e00d2){if(_0x52a9d0[_0xc74e('0x49')]['id']){delete _0x52a9d0[_0xc74e('0x49')]['id'];}return db[_0xc74e('0x2a')][_0xc74e('0x4a')]({'where':{'id':_0x52a9d0[_0xc74e('0x4b')]['id']}})[_0xc74e('0x22')](handleEntityNotFound(_0x5e00d2,null))[_0xc74e('0x22')](saveUpdates(_0x52a9d0[_0xc74e('0x49')],null))[_0xc74e('0x22')](respondWithResult(_0x5e00d2,null))['catch'](handleError(_0x5e00d2,null));};exports[_0xc74e('0x23')]=function(_0x49957e,_0xafd80a){return db[_0xc74e('0x2a')]['find']({'where':{'id':_0x49957e[_0xc74e('0x4b')]['id']}})[_0xc74e('0x22')](handleEntityNotFound(_0xafd80a,null))[_0xc74e('0x22')](removeEntity(_0xafd80a,null))[_0xc74e('0x46')](handleError(_0xafd80a,null));};exports['describe']=function(_0xa75eda,_0x25863d){return db['JscriptySessionReport'][_0xc74e('0x4c')]()[_0xc74e('0x22')](respondWithResult(_0x25863d,null))[_0xc74e('0x46')](handleError(_0x25863d,null));};exports[_0xc74e('0x4d')]=function(_0x3d0594,_0x5130cb,_0x23216c){var _0xedb149={'raw':!![],'where':{}};var _0x5e5886={};var _0x4563e8={'count':0x0,'rows':[]};return db[_0xc74e('0x2a')][_0xc74e('0x4e')]({'where':{'id':_0x3d0594['params']['id']}})[_0xc74e('0x22')](handleEntityNotFound(_0x5130cb,null))[_0xc74e('0x22')](function(_0x23f310){if(_0x23f310){_0x5e5886[_0xc74e('0x2e')]=_[_0xc74e('0x30')](db[_0xc74e('0x4f')][_0xc74e('0x2b')]);_0x5e5886[_0xc74e('0x2f')]=_[_0xc74e('0x30')](_0x3d0594[_0xc74e('0x2f')]);_0x5e5886[_0xc74e('0x31')]=_['intersection'](_0x5e5886[_0xc74e('0x2e')],_0x5e5886[_0xc74e('0x2f')]);_0xedb149[_0xc74e('0x33')]=_[_0xc74e('0x32')](_0x5e5886['model'],qs[_0xc74e('0x34')](_0x3d0594[_0xc74e('0x2f')][_0xc74e('0x34')]));_0xedb149[_0xc74e('0x33')]=_0xedb149[_0xc74e('0x33')][_0xc74e('0x35')]?_0xedb149[_0xc74e('0x33')]:_0x5e5886[_0xc74e('0x2e')];if(!_0x3d0594['query'][_0xc74e('0x36')]('nolimit')){_0xedb149[_0xc74e('0x1c')]=qs['limit'](_0x3d0594[_0xc74e('0x2f')][_0xc74e('0x1c')]);_0xedb149[_0xc74e('0x1a')]=qs[_0xc74e('0x1a')](_0x3d0594['query'][_0xc74e('0x1a')]);}_0xedb149[_0xc74e('0x38')]=qs[_0xc74e('0x39')](_0x3d0594['query']['sort']);_0xedb149[_0xc74e('0x3c')]=qs[_0xc74e('0x31')](_[_0xc74e('0x3a')](_0x3d0594[_0xc74e('0x2f')],_0x5e5886['filters']));_0xedb149[_0xc74e('0x3c')][_0xc74e('0x50')]=_0x23f310['id'];if(_0x3d0594[_0xc74e('0x2f')]['filter']){_0xedb149[_0xc74e('0x3c')]=_['merge'](_0xedb149[_0xc74e('0x3c')],{'$or':_[_0xc74e('0x29')](_0xedb149['attributes'],function(_0x1c3e5b){var _0x7607bf={};_0x7607bf[_0x1c3e5b]={'$like':'%'+_0x3d0594[_0xc74e('0x2f')]['filter']+'%'};return _0x7607bf;})});}_0xedb149=_[_0xc74e('0x3d')]({},_0xedb149,_0x3d0594[_0xc74e('0x40')]);return db[_0xc74e('0x4f')]['count']({'where':_0xedb149['where']})[_0xc74e('0x22')](function(_0x4ebda1){_0x4563e8['count']=_0x4ebda1;if(_0x3d0594[_0xc74e('0x2f')]['includeAll']){_0xedb149[_0xc74e('0x43')]=[{'all':!![]}];}return db[_0xc74e('0x4f')]['findAll'](_0xedb149);})[_0xc74e('0x22')](function(_0x10695e){_0x4563e8[_0xc74e('0x45')]=_0x10695e;return _0x4563e8;});}})[_0xc74e('0x22')](respondWithFilteredResult(_0x5130cb,_0xedb149))[_0xc74e('0x46')](handleError(_0x5130cb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 46f6b24..51a70b9 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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9a5a,0x194));var _0xa9a5=function(_0x2f4a80,_0x2e4a36){_0x2f4a80=_0x2f4a80-0x0;var _0x4de486=_0x9a5a[_0x2f4a80];return _0x4de486;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['report_jscripty_sessions','util','../../config/logger','api','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x5e1175,_0x1deb67){var _0x4dac0a=function(_0x53fcdf){while(--_0x53fcdf){_0x5e1175['push'](_0x5e1175['shift']());}};_0x4dac0a(++_0x1deb67);}(_0x038b,0x114));var _0xb038=function(_0x423ab8,_0x34317f){_0x423ab8=_0x423ab8-0x0;var _0x7f4e85=_0x038b[_0x423ab8];return _0x7f4e85;};'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'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 359ae09..84e67d2 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 _0x5fdc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring'];(function(_0x2fcaee,_0x3bb94b){var _0x1b5319=function(_0x4fde81){while(--_0x4fde81){_0x2fcaee['push'](_0x2fcaee['shift']());}};_0x1b5319(++_0x3bb94b);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3cd99b,_0x439479){_0x3cd99b=_0x3cd99b-0x0;var _0x37fd4c=_0x5fdc[_0x3cd99b];return _0x37fd4c;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xdf55,0x83));var _0x5df5=function(_0x1ee938,_0x22267f){_0x1ee938=_0x1ee938-0x0;var _0x3ebf3b=_0xdf55[_0x1ee938];return _0x3ebf3b;};'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']('JscriptySessionReport,\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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 72eea2e..3a83900 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 _0x9192=['get','index','/:id','isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4505f2,_0x49ca8c){var _0x4f34f5=function(_0x6dd60){while(--_0x6dd60){_0x4505f2['push'](_0x4505f2['shift']());}};_0x4f34f5(++_0x49ca8c);}(_0x9192,0x1a7));var _0x2919=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x9192[_0x2cbec0];return _0x3d4101;};'use strict';var multer=require(_0x2919('0x0'));var util=require(_0x2919('0x1'));var path=require(_0x2919('0x2'));var timeout=require(_0x2919('0x3'));var express=require(_0x2919('0x4'));var router=express[_0x2919('0x5')]();var fs_extra=require(_0x2919('0x6'));var auth=require(_0x2919('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2919('0x8'));var controller=require('./license.controller');router[_0x2919('0x9')]('/',controller[_0x2919('0xa')]);router['put'](_0x2919('0xb'),auth[_0x2919('0xc')](),controller[_0x2919('0xd')]);router[_0x2919('0x9')](_0x2919('0xe'),auth[_0x2919('0xc')](),controller['downloadLogFile']);module[_0x2919('0xf')]=router; \ No newline at end of file +var _0xd2e2=['update','/download_log_file','downloadLogFile','util','connect-timeout','express','fs-extra','../../components/auth/service','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x39ff3e,_0x1eab5f){var _0x56c03e=function(_0x3dfc18){while(--_0x3dfc18){_0x39ff3e['push'](_0x39ff3e['shift']());}};_0x56c03e(++_0x1eab5f);}(_0xd2e2,0x153));var _0x2d2e=function(_0xdef5bf,_0x26207c){_0xdef5bf=_0xdef5bf-0x0;var _0x41ab3e=_0xd2e2[_0xdef5bf];return _0x41ab3e;};'use strict';var multer=require('multer');var util=require(_0x2d2e('0x0'));var path=require('path');var timeout=require(_0x2d2e('0x1'));var express=require(_0x2d2e('0x2'));var router=express['Router']();var fs_extra=require(_0x2d2e('0x3'));var auth=require(_0x2d2e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2d2e('0x5'));router[_0x2d2e('0x6')]('/',controller[_0x2d2e('0x7')]);router[_0x2d2e('0x8')](_0x2d2e('0x9'),auth[_0x2d2e('0xa')](),controller[_0x2d2e('0xb')]);router[_0x2d2e('0x6')](_0x2d2e('0xc'),auth[_0x2d2e('0xa')](),controller[_0x2d2e('0xd')]);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 e653992..60e58a8 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 _0xfb6b=['STRING','INTEGER','sequelize','exports'];(function(_0x9bc501,_0x42b093){var _0x2df314=function(_0x9be695){while(--_0x9be695){_0x9bc501['push'](_0x9bc501['shift']());}};_0x2df314(++_0x42b093);}(_0xfb6b,0x14a));var _0xbfb6=function(_0x423ab3,_0x27147a){_0x423ab3=_0x423ab3-0x0;var _0x429ba4=_0xfb6b[_0x423ab3];return _0x429ba4;};'use strict';var Sequelize=require(_0xbfb6('0x0'));module[_0xbfb6('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xbfb6('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xbfb6('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x91b2=['STRING','INTEGER','sequelize','TEXT'];(function(_0x3dafd8,_0x263a06){var _0x29f3a7=function(_0x577f8b){while(--_0x577f8b){_0x3dafd8['push'](_0x3dafd8['shift']());}};_0x29f3a7(++_0x263a06);}(_0x91b2,0x9e));var _0x291b=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x91b2[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require(_0x291b('0x0'));module['exports']={'license':{'type':Sequelize[_0x291b('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x291b('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x291b('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 0671c72..c397d05 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 _0x4790=['find','params','get','checkLicense','key','catch','downloadLogFile','license-info.log','/var','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','../../config/license/util','keys','License','query','filters','intersection','model','attributes','fields','merge','options','getLicense','update','body'];(function(_0x1540df,_0x5a33fa){var _0x4fe0da=function(_0x20f67f){while(--_0x20f67f){_0x1540df['push'](_0x1540df['shift']());}};_0x4fe0da(++_0x5a33fa);}(_0x4790,0xe6));var _0x0479=function(_0x245ff8,_0x2e81f8){_0x245ff8=_0x245ff8-0x0;var _0x5a4faa=_0x4790[_0x245ff8];return _0x5a4faa;};'use strict';var emlformat=require(_0x0479('0x0'));var rimraf=require(_0x0479('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0479('0x2'));var rp=require('request-promise');var moment=require(_0x0479('0x3'));var BPromise=require(_0x0479('0x4'));var Mustache=require(_0x0479('0x5'));var util=require(_0x0479('0x6'));var path=require(_0x0479('0x7'));var sox=require(_0x0479('0x8'));var csv=require(_0x0479('0x9'));var ejs=require(_0x0479('0xa'));var fs=require('fs');var fs_extra=require(_0x0479('0xb'));var _=require(_0x0479('0xc'));var squel=require(_0x0479('0xd'));var crypto=require(_0x0479('0xe'));var jsforce=require(_0x0479('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0479('0x10'));var Papa=require('papaparse');var Redis=require(_0x0479('0x11'));var authService=require(_0x0479('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0479('0x13'));var hardwareService=require(_0x0479('0x14'));var logger=require(_0x0479('0x15'))(_0x0479('0x16'));var utils=require('../../config/utils');var config=require(_0x0479('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0479('0x18'))['db'];function respondWithStatusCode(_0x5150e6,_0x48660b){_0x48660b=_0x48660b||0xcc;return function(_0x4e6ad7){if(_0x4e6ad7){return _0x5150e6['sendStatus'](_0x48660b);}return _0x5150e6['status'](_0x48660b)['end']();};}function respondWithResult(_0x383b88,_0x21e138){_0x21e138=_0x21e138||0xc8;return function(_0xbfaa91){if(_0xbfaa91){return _0x383b88[_0x0479('0x19')](_0x21e138)[_0x0479('0x1a')](_0xbfaa91);}};}function respondWithFilteredResult(_0x192d6a,_0x55e0b5){return function(_0x53ffb6){if(_0x53ffb6){var _0x42d340=typeof _0x55e0b5[_0x0479('0x1b')]===_0x0479('0x1c')&&typeof _0x55e0b5[_0x0479('0x1d')]==='undefined';var _0x2b4a17=_0x53ffb6[_0x0479('0x1e')];var _0x70b81e=_0x42d340?0x0:_0x55e0b5[_0x0479('0x1b')];var _0x3ae6a3=_0x42d340?_0x53ffb6['count']:_0x55e0b5[_0x0479('0x1b')]+_0x55e0b5[_0x0479('0x1d')];var _0x4c7a1d;if(_0x3ae6a3>=_0x2b4a17){_0x3ae6a3=_0x2b4a17;_0x4c7a1d=0xc8;}else{_0x4c7a1d=0xce;}_0x192d6a[_0x0479('0x19')](_0x4c7a1d);return _0x192d6a[_0x0479('0x1f')](_0x0479('0x20'),_0x70b81e+'-'+_0x3ae6a3+'/'+_0x2b4a17)[_0x0479('0x1a')](_0x53ffb6);}return null;};}function patchUpdates(_0x2b247a){return function(_0x40514a){try{jsonpatch[_0x0479('0x21')](_0x40514a,_0x2b247a,!![]);}catch(_0x3d3194){return BPromise[_0x0479('0x22')](_0x3d3194);}return _0x40514a[_0x0479('0x23')]();};}function saveUpdates(_0x1329bc,_0x5aefe3){return function(_0xbed52e){if(_0xbed52e){return _0xbed52e['update'](_0x1329bc)[_0x0479('0x24')](function(_0x46162a){return _0x46162a;});}return null;};}function removeEntity(_0x270567,_0x56933a){return function(_0x5f5b2f){if(_0x5f5b2f){return _0x5f5b2f[_0x0479('0x25')]()[_0x0479('0x24')](function(){_0x270567['status'](0xcc)[_0x0479('0x26')]();});}};}function handleEntityNotFound(_0x5de6d7,_0x19a908){return function(_0x467e0c){if(!_0x467e0c){_0x5de6d7[_0x0479('0x27')](0x194);}return _0x467e0c;};}function handleError(_0x551ed5,_0x31caaf){_0x31caaf=_0x31caaf||0x1f4;return function(_0x3e9918){logger[_0x0479('0x28')](_0x3e9918[_0x0479('0x29')]);if(_0x3e9918[_0x0479('0x2a')]){delete _0x3e9918[_0x0479('0x2a')];}_0x551ed5['status'](_0x31caaf)[_0x0479('0x2b')](_0x3e9918);};}var utilLicense=require(_0x0479('0x2c'));exports['index']=function(_0x538f5f,_0x33f972){var _0x42fe61={'raw':!![],'where':{'id':0x1}},_0x2734dd={};_0x2734dd['model']=_[_0x0479('0x2d')](db[_0x0479('0x2e')]['rawAttributes']);_0x2734dd[_0x0479('0x2f')]=_['keys'](_0x538f5f[_0x0479('0x2f')]);_0x2734dd[_0x0479('0x30')]=_[_0x0479('0x31')](_0x2734dd[_0x0479('0x32')],_0x2734dd[_0x0479('0x2f')]);_0x42fe61[_0x0479('0x33')]=_[_0x0479('0x31')](_0x2734dd['model'],qs[_0x0479('0x34')](_0x538f5f[_0x0479('0x2f')]['fields']));_0x42fe61[_0x0479('0x33')]=_0x42fe61[_0x0479('0x33')]['length']?_0x42fe61[_0x0479('0x33')]:_0x2734dd[_0x0479('0x32')];_0x42fe61=_[_0x0479('0x35')]({},_0x42fe61,_0x538f5f[_0x0479('0x36')]);return utilLicense[_0x0479('0x37')](_0x42fe61)[_0x0479('0x24')](respondWithResult(_0x33f972,null))['catch'](handleError(_0x33f972,null));};exports[_0x0479('0x38')]=function(_0xf9b549,_0x25b053){if(_0xf9b549[_0x0479('0x39')]['id']){delete _0xf9b549[_0x0479('0x39')]['id'];}return db['License'][_0x0479('0x3a')]({'where':{'id':_0xf9b549[_0x0479('0x3b')]['id']}})[_0x0479('0x24')](handleEntityNotFound(_0x25b053,null))['then'](function(_0x3fb2cc){var _0x37c195=_0x3fb2cc[_0x0479('0x3c')]({'plain':!![]});return utilLicense[_0x0479('0x3d')](_0x37c195,_0xf9b549[_0x0479('0x39')][_0x0479('0x3e')]);})['then'](function(_0x2d58a8){if(!_0x2d58a8['demo']){return saveUpdates(_0xf9b549[_0x0479('0x39')],null);}return _0x2d58a8;})[_0x0479('0x24')](respondWithResult(_0x25b053,null))[_0x0479('0x3f')](handleError(_0x25b053,null));};exports[_0x0479('0x40')]=function(_0x143c4f,_0x52fb17){var _0x555629=_0x0479('0x41');var _0x4bce5b=path['join'](_0x0479('0x42'),'log',_0x0479('0x43'),_0x555629);_0x52fb17[_0x0479('0x44')]('Content-disposition',_0x0479('0x45')+_0x555629);_0x52fb17['set'](_0x0479('0x46'),_0x0479('0x47'));_0x52fb17['download'](_0x4bce5b);}; \ No newline at end of file +var _0x3a16=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','log','setHeader','attachment;\x20filename=','set','download'];(function(_0x1ffe52,_0x56accb){var _0x39579d=function(_0x4039ce){while(--_0x4039ce){_0x1ffe52['push'](_0x1ffe52['shift']());}};_0x39579d(++_0x56accb);}(_0x3a16,0x8c));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63a1('0x0'));var zipdir=require(_0x63a1('0x1'));var jsonpatch=require(_0x63a1('0x2'));var rp=require(_0x63a1('0x3'));var moment=require(_0x63a1('0x4'));var BPromise=require(_0x63a1('0x5'));var Mustache=require(_0x63a1('0x6'));var util=require(_0x63a1('0x7'));var path=require('path');var sox=require(_0x63a1('0x8'));var csv=require(_0x63a1('0x9'));var ejs=require(_0x63a1('0xa'));var fs=require('fs');var fs_extra=require(_0x63a1('0xb'));var _=require(_0x63a1('0xc'));var squel=require('squel');var crypto=require(_0x63a1('0xd'));var jsforce=require(_0x63a1('0xe'));var deskjs=require(_0x63a1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x63a1('0x10'));var Papa=require(_0x63a1('0x11'));var Redis=require(_0x63a1('0x12'));var authService=require(_0x63a1('0x13'));var qs=require(_0x63a1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63a1('0x15'));var logger=require(_0x63a1('0x16'))(_0x63a1('0x17'));var utils=require(_0x63a1('0x18'));var config=require(_0x63a1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x63a1('0x1a'))['db'];function respondWithStatusCode(_0x50ffcf,_0x3acfc0){_0x3acfc0=_0x3acfc0||0xcc;return function(_0xa19587){if(_0xa19587){return _0x50ffcf[_0x63a1('0x1b')](_0x3acfc0);}return _0x50ffcf[_0x63a1('0x1c')](_0x3acfc0)[_0x63a1('0x1d')]();};}function respondWithResult(_0x446971,_0x4367a5){_0x4367a5=_0x4367a5||0xc8;return function(_0x49694e){if(_0x49694e){return _0x446971[_0x63a1('0x1c')](_0x4367a5)['json'](_0x49694e);}};}function respondWithFilteredResult(_0x467819,_0xdbd553){return function(_0x3e9294){if(_0x3e9294){var _0x34a1b2=typeof _0xdbd553[_0x63a1('0x1e')]==='undefined'&&typeof _0xdbd553[_0x63a1('0x1f')]==='undefined';var _0x13cdcc=_0x3e9294[_0x63a1('0x20')];var _0x351c12=_0x34a1b2?0x0:_0xdbd553[_0x63a1('0x1e')];var _0x24d641=_0x34a1b2?_0x3e9294['count']:_0xdbd553[_0x63a1('0x1e')]+_0xdbd553[_0x63a1('0x1f')];var _0x3d0e6c;if(_0x24d641>=_0x13cdcc){_0x24d641=_0x13cdcc;_0x3d0e6c=0xc8;}else{_0x3d0e6c=0xce;}_0x467819[_0x63a1('0x1c')](_0x3d0e6c);return _0x467819['set'](_0x63a1('0x21'),_0x351c12+'-'+_0x24d641+'/'+_0x13cdcc)[_0x63a1('0x22')](_0x3e9294);}return null;};}function patchUpdates(_0x51af81){return function(_0x2782d6){try{jsonpatch[_0x63a1('0x23')](_0x2782d6,_0x51af81,!![]);}catch(_0x595511){return BPromise[_0x63a1('0x24')](_0x595511);}return _0x2782d6['save']();};}function saveUpdates(_0x5ccba3,_0xd14191){return function(_0x2d9cbe){if(_0x2d9cbe){return _0x2d9cbe[_0x63a1('0x25')](_0x5ccba3)[_0x63a1('0x26')](function(_0x59031d){return _0x59031d;});}return null;};}function removeEntity(_0xb75e75,_0x1a7283){return function(_0x453dc5){if(_0x453dc5){return _0x453dc5[_0x63a1('0x27')]()[_0x63a1('0x26')](function(){_0xb75e75['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x232495,_0x959082){return function(_0x449a95){if(!_0x449a95){_0x232495[_0x63a1('0x1b')](0x194);}return _0x449a95;};}function handleError(_0x5921be,_0x425a63){_0x425a63=_0x425a63||0x1f4;return function(_0x5401df){logger[_0x63a1('0x28')](_0x5401df['stack']);if(_0x5401df['name']){delete _0x5401df['name'];}_0x5921be[_0x63a1('0x1c')](_0x425a63)[_0x63a1('0x29')](_0x5401df);};}var utilLicense=require(_0x63a1('0x2a'));exports[_0x63a1('0x2b')]=function(_0x423a71,_0x213677){var _0x1449a0={'raw':!![],'where':{'id':0x1}},_0x350240={};_0x350240['model']=_[_0x63a1('0x2c')](db[_0x63a1('0x2d')][_0x63a1('0x2e')]);_0x350240[_0x63a1('0x2f')]=_[_0x63a1('0x2c')](_0x423a71[_0x63a1('0x2f')]);_0x350240[_0x63a1('0x30')]=_[_0x63a1('0x31')](_0x350240[_0x63a1('0x32')],_0x350240[_0x63a1('0x2f')]);_0x1449a0[_0x63a1('0x33')]=_[_0x63a1('0x31')](_0x350240['model'],qs[_0x63a1('0x34')](_0x423a71[_0x63a1('0x2f')][_0x63a1('0x34')]));_0x1449a0['attributes']=_0x1449a0[_0x63a1('0x33')][_0x63a1('0x35')]?_0x1449a0[_0x63a1('0x33')]:_0x350240['model'];_0x1449a0=_[_0x63a1('0x36')]({},_0x1449a0,_0x423a71[_0x63a1('0x37')]);return utilLicense[_0x63a1('0x38')](_0x1449a0)[_0x63a1('0x26')](respondWithResult(_0x213677,null))[_0x63a1('0x39')](handleError(_0x213677,null));};exports[_0x63a1('0x25')]=function(_0x4a4eec,_0x3891ea){if(_0x4a4eec['body']['id']){delete _0x4a4eec[_0x63a1('0x3a')]['id'];}return db[_0x63a1('0x2d')]['find']({'where':{'id':_0x4a4eec[_0x63a1('0x3b')]['id']}})[_0x63a1('0x26')](handleEntityNotFound(_0x3891ea,null))[_0x63a1('0x26')](function(_0x25ca15){var _0x4462db=_0x25ca15[_0x63a1('0x3c')]({'plain':!![]});return utilLicense[_0x63a1('0x3d')](_0x4462db,_0x4a4eec['body'][_0x63a1('0x3e')]);})['then'](function(_0x345d2c){if(!_0x345d2c[_0x63a1('0x3f')]){return saveUpdates(_0x4a4eec[_0x63a1('0x3a')],null);}return _0x345d2c;})[_0x63a1('0x26')](respondWithResult(_0x3891ea,null))[_0x63a1('0x39')](handleError(_0x3891ea,null));};exports[_0x63a1('0x40')]=function(_0x52718d,_0x79c42b){var _0x351446='license-info.log';var _0x5121d9=path['join']('/var',_0x63a1('0x41'),'xcally',_0x351446);_0x79c42b[_0x63a1('0x42')]('Content-disposition',_0x63a1('0x43')+_0x351446);_0x79c42b[_0x63a1('0x44')]('Content-Type','text/plain');_0x79c42b[_0x63a1('0x45')](_0x5121d9);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d0dbb70..c55d370 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 _0xc7ec=['define','License','license','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x561a36,_0x4226d4){var _0x44353b=function(_0x5308b3){while(--_0x5308b3){_0x561a36['push'](_0x561a36['shift']());}};_0x44353b(++_0x4226d4);}(_0xc7ec,0xff));var _0xcc7e=function(_0x310a54,_0x212d9a){_0x310a54=_0x310a54-0x0;var _0x4e4caa=_0xc7ec[_0x310a54];return _0x4e4caa;};'use strict';var _=require('lodash');var util=require(_0xcc7e('0x0'));var logger=require(_0xcc7e('0x1'))(_0xcc7e('0x2'));var moment=require(_0xcc7e('0x3'));var BPromise=require(_0xcc7e('0x4'));var rp=require(_0xcc7e('0x5'));var fs=require('fs');var path=require(_0xcc7e('0x6'));var rimraf=require(_0xcc7e('0x7'));var config=require(_0xcc7e('0x8'));var attributes=require(_0xcc7e('0x9'));module[_0xcc7e('0xa')]=function(_0xb3f608,_0x32b59f){return _0xb3f608[_0xcc7e('0xb')](_0xcc7e('0xc'),attributes,{'tableName':_0xcc7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48ad=['License','license','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x27f9aa,_0x40bfcf){var _0x3dc964=function(_0xd53166){while(--_0xd53166){_0x27f9aa['push'](_0x27f9aa['shift']());}};_0x3dc964(++_0x40bfcf);}(_0x48ad,0x182));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd48a('0x0'));var util=require(_0xd48a('0x1'));var logger=require(_0xd48a('0x2'))(_0xd48a('0x3'));var moment=require(_0xd48a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd48a('0x5'));var fs=require('fs');var path=require(_0xd48a('0x6'));var rimraf=require(_0xd48a('0x7'));var config=require(_0xd48a('0x8'));var attributes=require('./license.attributes');module[_0xd48a('0x9')]=function(_0x82ef4e,_0x35adbd){return _0x82ef4e['define'](_0xd48a('0xa'),attributes,{'tableName':_0xd48a('0xb'),'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 a2f0bf7..20c9189 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 _0xb0e7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x48f591,_0xd354ad){var _0x33918a=function(_0x32e3f8){while(--_0x32e3f8){_0x48f591['push'](_0x48f591['shift']());}};_0x33918a(++_0xd354ad);}(_0xb0e7,0x158));var _0x7b0e=function(_0x173030,_0x4089f7){_0x173030=_0x173030-0x0;var _0x2cdcf0=_0xb0e7[_0x173030];return _0x2cdcf0;};'use strict';var _=require(_0x7b0e('0x0'));var util=require(_0x7b0e('0x1'));var moment=require(_0x7b0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7b0e('0x3'));var fs=require('fs');var Redis=require(_0x7b0e('0x4'));var db=require(_0x7b0e('0x5'))['db'];var utils=require(_0x7b0e('0x6'));var logger=require(_0x7b0e('0x7'))(_0x7b0e('0x8'));var config=require(_0x7b0e('0x9'));var jayson=require(_0x7b0e('0xa'));var client=jayson[_0x7b0e('0xb')][_0x7b0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd8b2,_0xd5e186,_0x51f1e5){return new BPromise(function(_0x5b8bae,_0x1503c9){return client[_0x7b0e('0xd')](_0x5dd8b2,_0x51f1e5)[_0x7b0e('0xe')](function(_0x1e161b){logger[_0x7b0e('0xf')](_0x7b0e('0x10'),_0xd5e186,_0x7b0e('0x11'));logger['debug'](_0x7b0e('0x12'),_0xd5e186,_0x7b0e('0x11'),JSON[_0x7b0e('0x13')](_0x1e161b));if(_0x1e161b['error']){if(_0x1e161b[_0x7b0e('0x14')][_0x7b0e('0x15')]===0x1f4){logger['error'](_0x7b0e('0x10'),_0xd5e186,_0x1e161b['error'][_0x7b0e('0x16')]);return _0x1503c9(_0x1e161b[_0x7b0e('0x14')][_0x7b0e('0x16')]);}logger[_0x7b0e('0x14')](_0x7b0e('0x10'),_0xd5e186,_0x1e161b['error'][_0x7b0e('0x16')]);return _0x5b8bae(_0x1e161b[_0x7b0e('0x14')][_0x7b0e('0x16')]);}else{logger[_0x7b0e('0xf')](_0x7b0e('0x10'),_0xd5e186,_0x7b0e('0x11'));_0x5b8bae(_0x1e161b[_0x7b0e('0x17')][_0x7b0e('0x16')]);}})[_0x7b0e('0x18')](function(_0x334c26){logger['error']('License,\x20%s,\x20%s',_0xd5e186,_0x334c26);_0x1503c9(_0x334c26);});});} \ No newline at end of file +var _0xb6b7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6b7,0xaa));var _0x7b6b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb6b7[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7b6b('0x0'));var rs=require(_0x7b6b('0x1'));var fs=require('fs');var Redis=require(_0x7b6b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b6b('0x3'));var logger=require(_0x7b6b('0x4'))(_0x7b6b('0x5'));var config=require(_0x7b6b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b6b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x149582,_0x1406f2,_0x3aa90f){return new BPromise(function(_0x1fc533,_0x5b42c8){return client[_0x7b6b('0x8')](_0x149582,_0x3aa90f)['then'](function(_0x2b427d){logger[_0x7b6b('0x9')](_0x7b6b('0xa'),_0x1406f2,_0x7b6b('0xb'));logger['debug'](_0x7b6b('0xc'),_0x1406f2,_0x7b6b('0xb'),JSON[_0x7b6b('0xd')](_0x2b427d));if(_0x2b427d[_0x7b6b('0xe')]){if(_0x2b427d['error'][_0x7b6b('0xf')]===0x1f4){logger['error'](_0x7b6b('0xa'),_0x1406f2,_0x2b427d['error'][_0x7b6b('0x10')]);return _0x5b42c8(_0x2b427d[_0x7b6b('0xe')][_0x7b6b('0x10')]);}logger[_0x7b6b('0xe')](_0x7b6b('0xa'),_0x1406f2,_0x2b427d[_0x7b6b('0xe')][_0x7b6b('0x10')]);return _0x1fc533(_0x2b427d[_0x7b6b('0xe')][_0x7b6b('0x10')]);}else{logger['info'](_0x7b6b('0xa'),_0x1406f2,_0x7b6b('0xb'));_0x1fc533(_0x2b427d[_0x7b6b('0x11')][_0x7b6b('0x10')]);}})[_0x7b6b('0x12')](function(_0x5b6997){logger['error'](_0x7b6b('0xa'),_0x1406f2,_0x5b6997);_0x5b42c8(_0x5b6997);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 78c14d9..6e6aff8 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 _0x40f5=['../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x439f45,_0x542c73){var _0x6aa2e3=function(_0xc3474){while(--_0xc3474){_0x439f45['push'](_0x439f45['shift']());}};_0x6aa2e3(++_0x542c73);}(_0x40f5,0x181));var _0x540f=function(_0xc9cd47,_0x35a546){_0xc9cd47=_0xc9cd47-0x0;var _0x26827e=_0x40f5[_0xc9cd47];return _0x26827e;};'use strict';var multer=require(_0x540f('0x0'));var util=require(_0x540f('0x1'));var path=require(_0x540f('0x2'));var timeout=require(_0x540f('0x3'));var express=require(_0x540f('0x4'));var router=express['Router']();var fs_extra=require(_0x540f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x540f('0x6'));var config=require(_0x540f('0x7'));var controller=require(_0x540f('0x8'));router['get']('/',auth[_0x540f('0x9')](),controller[_0x540f('0xa')]);router[_0x540f('0xb')](_0x540f('0xc'),auth[_0x540f('0x9')](),controller[_0x540f('0xd')]);router[_0x540f('0xb')](_0x540f('0xe'),auth[_0x540f('0x9')](),controller[_0x540f('0xf')]);router[_0x540f('0xb')](_0x540f('0x10'),auth[_0x540f('0x9')](),controller['getDispositions']);router[_0x540f('0xb')]('/:id/canned_answers',auth[_0x540f('0x9')](),controller['getAnswers']);router[_0x540f('0xb')](_0x540f('0x11'),auth['isAuthenticated'](),controller[_0x540f('0x12')]);router[_0x540f('0xb')](_0x540f('0x13'),auth[_0x540f('0x9')](),controller['getSmtp']);router['get'](_0x540f('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x540f('0xb')](_0x540f('0x15'),auth[_0x540f('0x9')](),controller[_0x540f('0x16')]);router[_0x540f('0xb')](_0x540f('0x17'),auth[_0x540f('0x9')](),controller[_0x540f('0x18')]);router[_0x540f('0xb')](_0x540f('0x19'),auth[_0x540f('0x9')](),controller[_0x540f('0x1a')]);router[_0x540f('0xb')](_0x540f('0x1b'),auth[_0x540f('0x9')](),controller[_0x540f('0x1c')]);router[_0x540f('0x1d')]('/:id/dispositions',auth[_0x540f('0x9')](),controller[_0x540f('0x1e')]);router['post'](_0x540f('0x1f'),auth[_0x540f('0x9')](),controller[_0x540f('0x20')]);router['post']('/',auth['isAuthenticated'](),controller[_0x540f('0x21')]);router[_0x540f('0x1d')](_0x540f('0x11'),auth['isAuthenticated'](),controller[_0x540f('0x22')]);router[_0x540f('0x1d')](_0x540f('0x13'),auth[_0x540f('0x9')](),controller[_0x540f('0x23')]);router[_0x540f('0x1d')](_0x540f('0x14'),auth[_0x540f('0x9')](),controller[_0x540f('0x24')]);router['post'](_0x540f('0x15'),auth[_0x540f('0x9')](),controller[_0x540f('0x25')]);router[_0x540f('0x1d')](_0x540f('0x26'),auth[_0x540f('0x9')](),controller[_0x540f('0x27')]);router[_0x540f('0x1d')](_0x540f('0x1b'),auth[_0x540f('0x9')](),controller[_0x540f('0x28')]);router[_0x540f('0x29')](_0x540f('0xe'),auth[_0x540f('0x9')](),controller[_0x540f('0x2a')]);router[_0x540f('0x2b')](_0x540f('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x540f('0x2b')](_0x540f('0x1f'),auth[_0x540f('0x9')](),controller[_0x540f('0x2c')]);router[_0x540f('0x2b')](_0x540f('0x11'),auth['isAuthenticated'](),controller[_0x540f('0x2d')]);router[_0x540f('0x2b')]('/:id/out_servers',auth[_0x540f('0x9')](),controller['removeSmtp']);router[_0x540f('0x2b')](_0x540f('0xe'),auth[_0x540f('0x9')](),controller[_0x540f('0x2e')]);router[_0x540f('0x2b')]('/:id/users',auth[_0x540f('0x9')](),controller[_0x540f('0x2f')]);module[_0x540f('0x30')]=router; \ No newline at end of file +var _0x3232=['/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addDisposition','create','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','send','/:id/users','addAgents','put','update','removeDispositions','delete','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3232,0x15b));var _0x2323=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3232[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x2323('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2323('0x1'));var express=require(_0x2323('0x2'));var router=express[_0x2323('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2323('0x4'));var config=require(_0x2323('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2323('0x6')]);router[_0x2323('0x7')](_0x2323('0x8'),auth[_0x2323('0x9')](),controller[_0x2323('0xa')]);router['get'](_0x2323('0xb'),auth[_0x2323('0x9')](),controller[_0x2323('0xc')]);router[_0x2323('0x7')](_0x2323('0xd'),auth[_0x2323('0x9')](),controller[_0x2323('0xe')]);router['get'](_0x2323('0xf'),auth[_0x2323('0x9')](),controller[_0x2323('0x10')]);router[_0x2323('0x7')](_0x2323('0x11'),auth[_0x2323('0x9')](),controller[_0x2323('0x12')]);router[_0x2323('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x2323('0x13')]);router[_0x2323('0x7')](_0x2323('0x14'),auth[_0x2323('0x9')](),controller['getInteractions']);router[_0x2323('0x7')](_0x2323('0x15'),auth[_0x2323('0x9')](),controller[_0x2323('0x16')]);router[_0x2323('0x7')](_0x2323('0x17'),auth[_0x2323('0x9')](),controller[_0x2323('0x18')]);router[_0x2323('0x7')]('/:id/verify',auth[_0x2323('0x9')](),controller[_0x2323('0x19')]);router[_0x2323('0x7')]('/:id/users',auth[_0x2323('0x9')](),controller[_0x2323('0x1a')]);router[_0x2323('0x1b')](_0x2323('0xd'),auth[_0x2323('0x9')](),controller[_0x2323('0x1c')]);router['post'](_0x2323('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x2323('0x1b')]('/',auth[_0x2323('0x9')](),controller[_0x2323('0x1d')]);router['post'](_0x2323('0x11'),auth['isAuthenticated'](),controller[_0x2323('0x1e')]);router[_0x2323('0x1b')](_0x2323('0x1f'),auth[_0x2323('0x9')](),controller[_0x2323('0x20')]);router[_0x2323('0x1b')]('/:id/interactions',auth[_0x2323('0x9')](),controller['addInteraction']);router[_0x2323('0x1b')](_0x2323('0x15'),auth[_0x2323('0x9')](),controller[_0x2323('0x21')]);router[_0x2323('0x1b')](_0x2323('0x22'),auth['isAuthenticated'](),controller[_0x2323('0x23')]);router[_0x2323('0x1b')](_0x2323('0x24'),auth[_0x2323('0x9')](),controller[_0x2323('0x25')]);router[_0x2323('0x26')](_0x2323('0xb'),auth[_0x2323('0x9')](),controller[_0x2323('0x27')]);router['delete']('/:id/dispositions',auth[_0x2323('0x9')](),controller[_0x2323('0x28')]);router['delete'](_0x2323('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2323('0x29')](_0x2323('0x11'),auth[_0x2323('0x9')](),controller['removeImap']);router[_0x2323('0x29')](_0x2323('0x1f'),auth[_0x2323('0x9')](),controller[_0x2323('0x2a')]);router[_0x2323('0x29')](_0x2323('0xb'),auth[_0x2323('0x9')](),controller[_0x2323('0x2b')]);router['delete'](_0x2323('0x24'),auth[_0x2323('0x9')](),controller[_0x2323('0x2c')]);module[_0x2323('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index c745f2c..c14b9df 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 _0x2f86=['yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail'];(function(_0x552752,_0x423e32){var _0x19fa79=function(_0xc5e894){while(--_0xc5e894){_0x552752['push'](_0x552752['shift']());}};_0x19fa79(++_0x423e32);}(_0x2f86,0x145));var _0x62f8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2f86[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x62f8('0x0'));module[_0x62f8('0x1')]={'description':{'type':Sequelize[_0x62f8('0x2')]},'name':{'type':Sequelize[_0x62f8('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x62f8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x62f8('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x62f8('0x4')]},'markAsUnread':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x62f8('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x62f8('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x62f8('0x4')],'defaultValue':function(){return _0x62f8('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x62f8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x62f8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x62f8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x62f8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x62f8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x62f8('0x3')],'defaultValue':![],'comment':_0x62f8('0x9'),'set':function(_0x284ba8){if(!_0x284ba8)this[_0x62f8('0xa')](_0x62f8('0xb'),null);this[_0x62f8('0xa')]('mandatoryDisposition',_0x284ba8);}},'provider':{'type':Sequelize[_0x62f8('0xc')](_0x62f8('0xd'),_0x62f8('0xe'),_0x62f8('0xf'),_0x62f8('0x10')),'defaultValue':null,'get':function(){if(!this[_0x62f8('0x11')](_0x62f8('0x12')))return'custom';return this[_0x62f8('0x11')]('provider');},'set':function(_0xef1a7b){if(_0xef1a7b===_0x62f8('0x13'))_0xef1a7b=null;return this[_0x62f8('0xa')](_0x62f8('0x12'),_0xef1a7b);}}}; \ No newline at end of file +var _0x058e=['gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0xa58c58,_0x34c097){var _0x274776=function(_0x5360c3){while(--_0x5360c3){_0xa58c58['push'](_0xa58c58['shift']());}};_0x274776(++_0x34c097);}(_0x058e,0x1ce));var _0xe058=function(_0x244fac,_0x53b387){_0x244fac=_0x244fac-0x0;var _0x4a34c2=_0x058e[_0x244fac];return _0x4a34c2;};'use strict';var Sequelize=require(_0xe058('0x0'));module[_0xe058('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe058('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe058('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe058('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe058('0x3')]},'markAsUnread':{'type':Sequelize[_0xe058('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe058('0x2')],'allowNull':![],'defaultValue':_0xe058('0x5')},'fontSize':{'type':Sequelize[_0xe058('0x6')](0x2)[_0xe058('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe058('0x3')],'defaultValue':function(){return _0xe058('0x8');}},'notificationSound':{'type':Sequelize[_0xe058('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe058('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe058('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe058('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe058('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe058('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe058('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe058('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1ccf48){if(!_0x1ccf48)this[_0xe058('0x9')](_0xe058('0xa'),null);this[_0xe058('0x9')](_0xe058('0xb'),_0x1ccf48);}},'provider':{'type':Sequelize[_0xe058('0xc')](_0xe058('0xd'),_0xe058('0xe'),'yahoo',_0xe058('0xf')),'defaultValue':null,'get':function(){if(!this[_0xe058('0x10')](_0xe058('0x11')))return _0xe058('0x12');return this[_0xe058('0x10')](_0xe058('0x11'));},'set':function(_0x4fcec4){if(_0x4fcec4===_0xe058('0x12'))_0x4fcec4=null;return this['setDataValue'](_0xe058('0x11'),_0x4fcec4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 946bc4f..ce9cc5f 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 _0x0bd5=['includeAll','findAll','rows','show','params','include','find','body','provider','Mail\x20Account\x20not\x20found','describe','Disposition','getDispositions','findOne','hasOwnProperty','MailAccountId','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','ids','custom','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','nolimit','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','format','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','juice','ioredis','../../config/logger','api','../../config/environment','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','user','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x573e6c,_0x1bb970){var _0x23e524=function(_0x2e32ea){while(--_0x2e32ea){_0x573e6c['push'](_0x573e6c['shift']());}};_0x23e524(++_0x1bb970);}(_0x0bd5,0x67));var _0x50bd=function(_0x2f6dd6,_0x5e8d02){_0x2f6dd6=_0x2f6dd6-0x0;var _0x4f4a4=_0x0bd5[_0x2f6dd6];return _0x4f4a4;};'use strict';var moment=require(_0x50bd('0x0'));var BPromise=require(_0x50bd('0x1'));var util=require(_0x50bd('0x2'));var path=require(_0x50bd('0x3'));var _=require('lodash');var juice=require(_0x50bd('0x4'));var Redis=require(_0x50bd('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x50bd('0x6'))(_0x50bd('0x7'));var config=require(_0x50bd('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x50bd('0x9')](config[_0x50bd('0xa')],{'host':_0x50bd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50bd('0xc'))[_0x50bd('0xd')](socket);var jayson=require(_0x50bd('0xe'));var client=jayson[_0x50bd('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x216cd6,_0x3a020c,_0x302c09,_0x367648){return new BPromise(function(_0x15b70a,_0x3e48d8){var _0x10ad8f=_0x367648||client;return _0x10ad8f[_0x50bd('0x10')](_0x216cd6,_0x302c09)[_0x50bd('0x11')](function(_0x42b756){logger[_0x50bd('0x12')]('MailAccount,\x20%s,\x20%s',_0x3a020c,_0x50bd('0x13'));logger[_0x50bd('0x14')](_0x50bd('0x15'),_0x3a020c,_0x50bd('0x13'),JSON[_0x50bd('0x16')](_0x42b756));if(_0x42b756['error']){if(_0x42b756[_0x50bd('0x17')]['code']===0x1f4){logger['error'](_0x50bd('0x18'),_0x3a020c,_0x42b756[_0x50bd('0x17')][_0x50bd('0x19')]);return _0x3e48d8(_0x42b756['error'][_0x50bd('0x19')]);}logger[_0x50bd('0x17')](_0x50bd('0x18'),_0x3a020c,_0x42b756['error']['message']);return _0x15b70a(_0x42b756[_0x50bd('0x17')]['message']);}else{logger['info'](_0x50bd('0x18'),_0x3a020c,_0x50bd('0x13'));_0x15b70a(_0x42b756[_0x50bd('0x1a')][_0x50bd('0x19')]);}})[_0x50bd('0x1b')](function(_0x2576f2){logger[_0x50bd('0x17')]('MailAccount,\x20%s,\x20%s',_0x3a020c,_0x2576f2);_0x3e48d8(_0x2576f2);});});}function respondWithStatusCode(_0x2832f0,_0x120731){_0x120731=_0x120731||0xcc;return function(_0x54b9cb){if(_0x54b9cb){return _0x2832f0[_0x50bd('0x1c')](_0x120731);}return _0x2832f0[_0x50bd('0x1d')](_0x120731)[_0x50bd('0x1e')]();};}function respondWithResult(_0x1e117d,_0x52b072){_0x52b072=_0x52b072||0xc8;return function(_0x4f43e3){if(_0x4f43e3){return _0x1e117d[_0x50bd('0x1d')](_0x52b072)[_0x50bd('0x1f')](_0x4f43e3);}};}function respondWithFilteredResult(_0x590a6b,_0x2d62e8){return function(_0x484d99){if(_0x484d99){var _0x1b6c28=typeof _0x2d62e8[_0x50bd('0x20')]===_0x50bd('0x21')&&typeof _0x2d62e8[_0x50bd('0x22')]===_0x50bd('0x21');var _0x6b3c9b=_0x484d99[_0x50bd('0x23')];var _0x35de9c=_0x1b6c28?0x0:_0x2d62e8[_0x50bd('0x20')];var _0x71c357=_0x1b6c28?_0x484d99[_0x50bd('0x23')]:_0x2d62e8[_0x50bd('0x20')]+_0x2d62e8[_0x50bd('0x22')];var _0x29d3b7;if(_0x71c357>=_0x6b3c9b){_0x71c357=_0x6b3c9b;_0x29d3b7=0xc8;}else{_0x29d3b7=0xce;}_0x590a6b['status'](_0x29d3b7);return _0x590a6b[_0x50bd('0x24')](_0x50bd('0x25'),_0x35de9c+'-'+_0x71c357+'/'+_0x6b3c9b)[_0x50bd('0x1f')](_0x484d99);}return null;};}function saveUpdates(_0x14222e){return function(_0x182d9f){if(_0x182d9f){return _0x182d9f[_0x50bd('0x26')](_0x14222e)[_0x50bd('0x11')](function(_0x5c6a48){return _0x5c6a48;});}return null;};}function removeEntity(_0x31745f){return function(_0x598fb8){if(_0x598fb8){return _0x598fb8[_0x50bd('0x27')]()['then'](function(){var _0x43fccd=_0x598fb8['get']({'plain':!![]});var _0x5a09ee=_0x50bd('0x28');return db[_0x50bd('0x29')][_0x50bd('0x27')]({'where':{'type':_0x5a09ee,'resourceId':_0x43fccd['id']}})[_0x50bd('0x11')](function(){return _0x598fb8;});})[_0x50bd('0x11')](function(){_0x31745f[_0x50bd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa24991){return function(_0x5485ea){if(!_0x5485ea){_0xa24991[_0x50bd('0x1c')](0x194);}return _0x5485ea;};}function handleError(_0x57104b,_0x2542b3){_0x2542b3=_0x2542b3||0x1f4;return function(_0x54e318){logger[_0x50bd('0x17')](_0x54e318[_0x50bd('0x2a')]);if(_0x54e318[_0x50bd('0x2b')]){delete _0x54e318[_0x50bd('0x2b')];}_0x57104b[_0x50bd('0x1d')](_0x2542b3)[_0x50bd('0x2c')](_0x54e318);};}function getImapHost(_0x48f8c9){switch(_0x48f8c9){case _0x50bd('0x2d'):return _0x50bd('0x2e');case'yahoo':return _0x50bd('0x2f');case _0x50bd('0x30'):return _0x50bd('0x31');case _0x50bd('0x32'):return _0x50bd('0x33');}throw new Error(_0x50bd('0x34'),_0x48f8c9);}function getSmtpHost(_0x721914){switch(_0x721914){case _0x50bd('0x2d'):return _0x50bd('0x35');case _0x50bd('0x36'):return _0x50bd('0x37');case _0x50bd('0x30'):return _0x50bd('0x38');case'outlook365':return _0x50bd('0x39');}throw new Error(_0x50bd('0x34'),_0x721914);}function getAuthenticationOptions(_0x112f42,_0x5dff39){var _0x1c5c08={};var _0x123f3f={};if(_0x112f42){_0x1c5c08['user']=_0x123f3f['user']=_0x5dff39[_0x50bd('0x3a')];_0x1c5c08[_0x50bd('0x3b')]=_0x123f3f['pass']=_0x5dff39[_0x50bd('0x3b')];if(_0x5dff39[_0x50bd('0x3c')]){_0x1c5c08[_0x50bd('0x3c')]=_0x123f3f[_0x50bd('0x3c')]=!![];_0x1c5c08['CloudProviderId']=_0x123f3f[_0x50bd('0x3d')]=_0x5dff39[_0x50bd('0x3d')];_0x1c5c08[_0x50bd('0x3b')]=_0x123f3f[_0x50bd('0x3e')]=null;}else{_0x1c5c08[_0x50bd('0x3d')]=_0x123f3f[_0x50bd('0x3d')]=null;}_0x1c5c08[_0x50bd('0x3f')]=getImapHost(_0x112f42);_0x1c5c08[_0x50bd('0x40')]=0x3e1;_0x123f3f[_0x50bd('0x3f')]=getSmtpHost(_0x112f42);_0x123f3f[_0x50bd('0x40')]=0x24b;_0x123f3f[_0x50bd('0x41')]=![];_0x1c5c08[_0x50bd('0x42')]=_0x123f3f[_0x50bd('0x42')]=null;}else{if(_0x5dff39['authentication']){_0x1c5c08[_0x50bd('0x43')]=_0x123f3f['user']=_0x5dff39['username'];_0x1c5c08[_0x50bd('0x3b')]=_0x123f3f[_0x50bd('0x3e')]=_0x5dff39[_0x50bd('0x3b')];}else{_0x1c5c08[_0x50bd('0x44')]=_0x123f3f[_0x50bd('0x44')]=![];_0x1c5c08[_0x50bd('0x43')]=_0x123f3f['user']=null;_0x1c5c08[_0x50bd('0x3b')]=_0x123f3f[_0x50bd('0x3e')]=null;}_0x1c5c08[_0x50bd('0x3f')]=_0x5dff39[_0x50bd('0x45')][_0x50bd('0x3f')];_0x1c5c08['port']=_0x5dff39['Imap']['port'];_0x123f3f[_0x50bd('0x3f')]=_0x5dff39[_0x50bd('0x46')][_0x50bd('0x3f')];_0x123f3f['port']=_0x5dff39[_0x50bd('0x46')][_0x50bd('0x40')];}return{'Imap':_0x1c5c08,'Smtp':_0x123f3f};}exports[_0x50bd('0x47')]=function(_0x2053a4,_0x41ad3d){var _0x1ef190={'include':[{'model':db[_0x50bd('0x48')],'as':_0x50bd('0x45')},{'model':db[_0x50bd('0x49')],'as':'Smtp'},{'model':db[_0x50bd('0x4a')],'as':_0x50bd('0x4b')}]},_0x2d731c={},_0x1b40e2={'count':0x0,'rows':[]};var _0x4b1fd0=_['map'](db[_0x50bd('0x4c')][_0x50bd('0x4d')],function(_0x38c313){return{'name':_0x38c313['fieldName'],'type':_0x38c313[_0x50bd('0x4e')][_0x50bd('0x4f')]};});_0x2d731c[_0x50bd('0x50')]=_[_0x50bd('0x51')](_0x4b1fd0,_0x50bd('0x2b'));_0x2d731c[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0x2053a4[_0x50bd('0x52')]);_0x2d731c[_0x50bd('0x54')]=_['intersection'](_0x2d731c[_0x50bd('0x50')],_0x2d731c[_0x50bd('0x52')]);_0x1ef190['attributes']=_[_0x50bd('0x55')](_0x2d731c[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0x2053a4[_0x50bd('0x52')][_0x50bd('0x56')]));_0x1ef190['attributes']=_0x1ef190[_0x50bd('0x57')][_0x50bd('0x58')]?_0x1ef190[_0x50bd('0x57')]:_0x2d731c[_0x50bd('0x50')];if(!_0x2053a4[_0x50bd('0x52')]['hasOwnProperty']('nolimit')){_0x1ef190[_0x50bd('0x22')]=qs[_0x50bd('0x22')](_0x2053a4[_0x50bd('0x52')]['limit']);_0x1ef190['offset']=qs[_0x50bd('0x20')](_0x2053a4[_0x50bd('0x52')][_0x50bd('0x20')]);}_0x1ef190[_0x50bd('0x59')]=qs[_0x50bd('0x5a')](_0x2053a4[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x1ef190['where']=qs[_0x50bd('0x54')](_[_0x50bd('0x5b')](_0x2053a4[_0x50bd('0x52')],_0x2d731c[_0x50bd('0x54')]),_0x4b1fd0);if(_0x2053a4[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x1ef190[_0x50bd('0x5d')]=_[_0x50bd('0x5e')](_0x1ef190['where'],{'$or':_[_0x50bd('0x51')](_0x4b1fd0,function(_0x51f95d){if(_0x51f95d[_0x50bd('0x4e')]!==_0x50bd('0x5f')){var _0x144ec0={};_0x144ec0[_0x51f95d[_0x50bd('0x2b')]]={'$like':'%'+_0x2053a4['query']['filter']+'%'};return _0x144ec0;}})});}_0x1ef190=_[_0x50bd('0x5e')]({},_0x1ef190,_0x2053a4[_0x50bd('0x60')]);var _0x59c9ef={'where':_0x1ef190[_0x50bd('0x5d')]};return db[_0x50bd('0x4c')][_0x50bd('0x23')](_0x59c9ef)[_0x50bd('0x11')](function(_0x570c18){_0x1b40e2[_0x50bd('0x23')]=_0x570c18;if(_0x2053a4[_0x50bd('0x52')][_0x50bd('0x61')]){_0x1ef190['include']=[{'all':!![]}];}return db[_0x50bd('0x4c')][_0x50bd('0x62')](_0x1ef190);})[_0x50bd('0x11')](function(_0x128d37){_0x1b40e2[_0x50bd('0x63')]=_0x128d37;return _0x1b40e2;})[_0x50bd('0x11')](respondWithFilteredResult(_0x41ad3d,_0x1ef190))[_0x50bd('0x1b')](handleError(_0x41ad3d,null));};exports[_0x50bd('0x64')]=function(_0x5d19da,_0x23b923){var _0x4e3dbb={'raw':![],'where':{'id':_0x5d19da[_0x50bd('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x50bd('0x45')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x50bd('0x4a')],'as':'mandatoryDispositionPause'}]},_0xe937ca={};_0xe937ca['model']=_[_0x50bd('0x53')](db['MailAccount'][_0x50bd('0x4d')]);_0xe937ca[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0x5d19da[_0x50bd('0x52')]);_0xe937ca[_0x50bd('0x54')]=_[_0x50bd('0x55')](_0xe937ca[_0x50bd('0x50')],_0xe937ca[_0x50bd('0x52')]);_0x4e3dbb[_0x50bd('0x57')]=_[_0x50bd('0x55')](_0xe937ca[_0x50bd('0x50')],qs['fields'](_0x5d19da[_0x50bd('0x52')][_0x50bd('0x56')]));_0x4e3dbb[_0x50bd('0x57')]=_0x4e3dbb['attributes'][_0x50bd('0x58')]?_0x4e3dbb[_0x50bd('0x57')]:_0xe937ca['model'];if(_0x5d19da['query']['includeAll']){_0x4e3dbb[_0x50bd('0x66')]=[{'all':!![]}];}_0x4e3dbb=_[_0x50bd('0x5e')]({},_0x4e3dbb,_0x5d19da[_0x50bd('0x60')]);return db[_0x50bd('0x4c')][_0x50bd('0x67')](_0x4e3dbb)['then'](handleEntityNotFound(_0x23b923,null))['then'](respondWithResult(_0x23b923,null))['catch'](handleError(_0x23b923,null));};exports[_0x50bd('0x26')]=function(_0x27c39c,_0x532878){if(_0x27c39c['body']['id']){delete _0x27c39c['body']['id'];}var _0x124993=_0x27c39c[_0x50bd('0x68')][_0x50bd('0x69')]==='custom'?null:_0x27c39c['body'][_0x50bd('0x69')];var _0x56d65f=_0x27c39c[_0x50bd('0x68')][_0x50bd('0x45')]||{};var _0x255dfb=_0x27c39c[_0x50bd('0x68')][_0x50bd('0x46')]||{};if(_0x124993){_0x56d65f[_0x50bd('0x3f')]=getImapHost(_0x124993);_0x56d65f['port']=0x3e1;_0x255dfb[_0x50bd('0x3f')]=getSmtpHost(_0x124993);_0x255dfb['port']=0x24b;_0x255dfb['secure']=![];}if(_0x255dfb[_0x50bd('0x3c')]){_0x255dfb[_0x50bd('0x41')]=![];}else{_0x255dfb['CloudProviderId']=null;}if(!_0x56d65f[_0x50bd('0x3c')])_0x56d65f['CloudProviderId']=null;_0x27c39c[_0x50bd('0x68')][_0x50bd('0x45')]=_0x56d65f;_0x27c39c[_0x50bd('0x68')][_0x50bd('0x46')]=_0x255dfb;return db[_0x50bd('0x4c')][_0x50bd('0x67')]({'where':{'id':_0x27c39c[_0x50bd('0x65')]['id']},'include':[{'model':db[_0x50bd('0x48')],'as':_0x50bd('0x45')},{'model':db[_0x50bd('0x49')],'as':_0x50bd('0x46')},{'model':db[_0x50bd('0x4a')],'as':_0x50bd('0x4b')}]})[_0x50bd('0x11')](handleEntityNotFound(_0x532878,null))['then'](function(_0x564dd2){if(!_0x564dd2)throw new Error(_0x50bd('0x6a'));if(_0x564dd2[_0x50bd('0x42')])delete _0x27c39c[_0x50bd('0x68')][_0x50bd('0x45')];return _0x564dd2;})[_0x50bd('0x11')](saveUpdates(_0x27c39c['body'],null))['then'](function(_0xacad07){if(!_0x27c39c[_0x50bd('0x68')][_0x50bd('0x45')])return _0xacad07;return db[_0x50bd('0x48')][_0x50bd('0x26')](_0x27c39c[_0x50bd('0x68')][_0x50bd('0x45')],{'where':{'MailAccountId':_0xacad07['id']}})['then'](function(){return _0xacad07;});})['then'](function(_0x47c5cb){if(!_0x27c39c[_0x50bd('0x68')][_0x50bd('0x46')])return _0x47c5cb;return db[_0x50bd('0x49')][_0x50bd('0x26')](_0x27c39c['body'][_0x50bd('0x46')],{'where':{'MailAccountId':_0x47c5cb['id']}})[_0x50bd('0x11')](function(){return _0x47c5cb;});})[_0x50bd('0x11')](respondWithResult(_0x532878,null))['catch'](handleError(_0x532878,null));};exports[_0x50bd('0x6b')]=function(_0x5e8566,_0x5b2f6b){return db[_0x50bd('0x4c')][_0x50bd('0x6b')]()[_0x50bd('0x11')](respondWithResult(_0x5b2f6b,null))[_0x50bd('0x1b')](handleError(_0x5b2f6b,null));};exports['addDisposition']=function(_0x2b3faf,_0x444cc7){if(_0x2b3faf[_0x50bd('0x68')]['id']){delete _0x2b3faf[_0x50bd('0x68')]['id'];}return db['MailAccount'][_0x50bd('0x67')]({'where':{'id':_0x2b3faf[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x444cc7,null))[_0x50bd('0x11')](function(_0x4604e4){if(_0x4604e4){_0x2b3faf[_0x50bd('0x68')]['MailAccountId']=_0x4604e4['id'];return db[_0x50bd('0x6c')]['create'](_0x2b3faf['body']);}})[_0x50bd('0x11')](respondWithResult(_0x444cc7,null))[_0x50bd('0x1b')](handleError(_0x444cc7,null));};exports[_0x50bd('0x6d')]=function(_0x156a8e,_0x5a9020){var _0x5d3867={'raw':![],'where':{}};var _0x1a049a={};var _0x4426ec={'count':0x0,'rows':[]};return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0x156a8e[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x5a9020,null))[_0x50bd('0x11')](function(_0x3521c8){if(_0x3521c8){_0x1a049a[_0x50bd('0x50')]=_[_0x50bd('0x53')](db[_0x50bd('0x6c')][_0x50bd('0x4d')]);_0x1a049a['query']=_[_0x50bd('0x53')](_0x156a8e[_0x50bd('0x52')]);_0x1a049a['filters']=_[_0x50bd('0x55')](_0x1a049a[_0x50bd('0x50')],_0x1a049a[_0x50bd('0x52')]);_0x5d3867['attributes']=_['intersection'](_0x1a049a[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0x156a8e['query'][_0x50bd('0x56')]));_0x5d3867[_0x50bd('0x57')]=_0x5d3867[_0x50bd('0x57')]['length']?_0x5d3867['attributes']:_0x1a049a['model'];if(!_0x156a8e[_0x50bd('0x52')][_0x50bd('0x6f')]('nolimit')){_0x5d3867[_0x50bd('0x22')]=qs[_0x50bd('0x22')](_0x156a8e['query'][_0x50bd('0x22')]);_0x5d3867[_0x50bd('0x20')]=qs[_0x50bd('0x20')](_0x156a8e[_0x50bd('0x52')]['offset']);}_0x5d3867[_0x50bd('0x59')]=qs['sort'](_0x156a8e[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x5d3867[_0x50bd('0x5d')]=qs['filters'](_[_0x50bd('0x5b')](_0x156a8e[_0x50bd('0x52')],_0x1a049a[_0x50bd('0x54')]));_0x5d3867['where'][_0x50bd('0x70')]=_0x3521c8['id'];if(_0x156a8e[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x5d3867[_0x50bd('0x5d')]=_['merge'](_0x5d3867[_0x50bd('0x5d')],{'$or':_[_0x50bd('0x51')](_0x5d3867[_0x50bd('0x57')],function(_0x30344d){var _0x307072={};_0x307072[_0x30344d]={'$like':'%'+_0x156a8e[_0x50bd('0x52')][_0x50bd('0x5c')]+'%'};return _0x307072;})});}_0x5d3867=_[_0x50bd('0x5e')]({},_0x5d3867,_0x156a8e[_0x50bd('0x60')]);return db[_0x50bd('0x6c')][_0x50bd('0x23')]({'where':_0x5d3867[_0x50bd('0x5d')]})[_0x50bd('0x11')](function(_0xe782f9){_0x4426ec[_0x50bd('0x23')]=_0xe782f9;if(_0x156a8e[_0x50bd('0x52')][_0x50bd('0x61')]){_0x5d3867['include']=[{'all':!![]}];}return db[_0x50bd('0x6c')][_0x50bd('0x62')](_0x5d3867);})['then'](function(_0xd46b7){_0x4426ec['rows']=_0xd46b7;return _0x4426ec;});}})[_0x50bd('0x11')](respondWithFilteredResult(_0x5a9020,_0x5d3867))[_0x50bd('0x1b')](handleError(_0x5a9020,null));};exports[_0x50bd('0x71')]=function(_0x1424b1,_0x3ea535){return db[_0x50bd('0x4c')][_0x50bd('0x67')]({'where':{'id':_0x1424b1[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x3ea535,null))['then'](function(_0x569b2c){if(_0x569b2c){return _0x569b2c[_0x50bd('0x71')](_0x1424b1[_0x50bd('0x52')]['ids']);}})['then'](respondWithStatusCode(_0x3ea535,null))[_0x50bd('0x1b')](handleError(_0x3ea535,null));};exports[_0x50bd('0x72')]=function(_0x4d5bfa,_0x30bc95){if(_0x4d5bfa[_0x50bd('0x68')]['id']){delete _0x4d5bfa['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x4d5bfa['params']['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x30bc95,null))['then'](function(_0x4d77dc){if(_0x4d77dc){_0x4d5bfa['body']['MailAccountId']=_0x4d77dc['id'];return db[_0x50bd('0x73')][_0x50bd('0x74')](_0x4d5bfa[_0x50bd('0x68')]);}})['then'](respondWithResult(_0x30bc95,null))[_0x50bd('0x1b')](handleError(_0x30bc95,null));};exports[_0x50bd('0x75')]=function(_0x1bb7fe,_0x119c3f){var _0x3110f7={'raw':![],'where':{}};var _0x1c1975={};var _0x1c6d2a={'count':0x0,'rows':[]};return db['MailAccount'][_0x50bd('0x6e')]({'where':{'id':_0x1bb7fe[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x119c3f,null))['then'](function(_0xb73407){if(_0xb73407){_0x1c1975[_0x50bd('0x50')]=_[_0x50bd('0x53')](db['CannedAnswer'][_0x50bd('0x4d')]);_0x1c1975[_0x50bd('0x52')]=_['keys'](_0x1bb7fe['query']);_0x1c1975[_0x50bd('0x54')]=_[_0x50bd('0x55')](_0x1c1975[_0x50bd('0x50')],_0x1c1975[_0x50bd('0x52')]);_0x3110f7[_0x50bd('0x57')]=_['intersection'](_0x1c1975[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0x1bb7fe[_0x50bd('0x52')][_0x50bd('0x56')]));_0x3110f7[_0x50bd('0x57')]=_0x3110f7[_0x50bd('0x57')][_0x50bd('0x58')]?_0x3110f7[_0x50bd('0x57')]:_0x1c1975[_0x50bd('0x50')];if(!_0x1bb7fe[_0x50bd('0x52')]['hasOwnProperty']('nolimit')){_0x3110f7[_0x50bd('0x22')]=qs[_0x50bd('0x22')](_0x1bb7fe['query'][_0x50bd('0x22')]);_0x3110f7[_0x50bd('0x20')]=qs[_0x50bd('0x20')](_0x1bb7fe[_0x50bd('0x52')][_0x50bd('0x20')]);}_0x3110f7['order']=qs['sort'](_0x1bb7fe[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x3110f7['where']=qs[_0x50bd('0x54')](_['pick'](_0x1bb7fe[_0x50bd('0x52')],_0x1c1975[_0x50bd('0x54')]));_0x3110f7['where'][_0x50bd('0x70')]=_0xb73407['id'];if(_0x1bb7fe[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x3110f7['where']=_[_0x50bd('0x5e')](_0x3110f7[_0x50bd('0x5d')],{'$or':_[_0x50bd('0x51')](_0x3110f7[_0x50bd('0x57')],function(_0x248286){var _0xa4c6f1={};_0xa4c6f1[_0x248286]={'$like':'%'+_0x1bb7fe['query'][_0x50bd('0x5c')]+'%'};return _0xa4c6f1;})});}_0x3110f7=_['merge']({},_0x3110f7,_0x1bb7fe[_0x50bd('0x60')]);return db['CannedAnswer']['count']({'where':_0x3110f7[_0x50bd('0x5d')]})['then'](function(_0x4621b3){_0x1c6d2a['count']=_0x4621b3;if(_0x1bb7fe[_0x50bd('0x52')]['includeAll']){_0x3110f7['include']=[{'all':!![]}];}return db[_0x50bd('0x73')][_0x50bd('0x62')](_0x3110f7);})[_0x50bd('0x11')](function(_0x3bd88d){_0x1c6d2a[_0x50bd('0x63')]=_0x3bd88d;return _0x1c6d2a;});}})[_0x50bd('0x11')](respondWithFilteredResult(_0x119c3f,_0x3110f7))[_0x50bd('0x1b')](handleError(_0x119c3f,null));};exports['removeAnswers']=function(_0x143421,_0x38b69c){return db['MailAccount']['find']({'where':{'id':_0x143421[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x38b69c,null))[_0x50bd('0x11')](function(_0xe74ce7){if(_0xe74ce7){return _0xe74ce7['removeAnswers'](_0x143421[_0x50bd('0x52')][_0x50bd('0x76')]);}})[_0x50bd('0x11')](respondWithStatusCode(_0x38b69c,null))[_0x50bd('0x1b')](handleError(_0x38b69c,null));};exports[_0x50bd('0x74')]=function(_0x457ed8,_0x5bf477){var _0x4b009f={'name':_0x457ed8['body'][_0x50bd('0x2b')],'key':_0x457ed8[_0x50bd('0x68')][_0x50bd('0x4f')],'provider':_0x457ed8[_0x50bd('0x68')]['provider']===_0x50bd('0x77')?null:_0x457ed8['body']['provider'],'email':_0x457ed8[_0x50bd('0x68')]['email'],'ListId':_0x457ed8[_0x50bd('0x68')]['ListId'],'active':!_[_0x50bd('0x78')](_0x457ed8[_0x50bd('0x68')][_0x50bd('0x79')])?_0x457ed8[_0x50bd('0x68')][_0x50bd('0x79')]:!![],'description':_0x457ed8[_0x50bd('0x68')][_0x50bd('0x7a')]||null};var _0x5c1c22=getAuthenticationOptions(_0x4b009f[_0x50bd('0x69')],_0x457ed8['body']);_0x4b009f['Imap']=_0x5c1c22['Imap'];_0x4b009f['Smtp']=_0x5c1c22[_0x50bd('0x46')];return db[_0x50bd('0x4c')]['create'](_0x4b009f,{'include':[{'model':db[_0x50bd('0x49')],'as':_0x50bd('0x46')},{'model':db[_0x50bd('0x48')],'as':_0x50bd('0x45')}]})[_0x50bd('0x11')](function(_0x804ead){var _0x44c128=_0x457ed8[_0x50bd('0x43')][_0x50bd('0x7b')]({'plain':!![]});if(!_0x44c128)throw new Error(_0x50bd('0x7c'));if(_0x44c128['role']==='user'){var _0x22d55d=_0x804ead['get']({'plain':!![]});return db[_0x50bd('0x7d')]['find']({'where':{'name':_0x50bd('0x28'),'userProfileId':_0x44c128[_0x50bd('0x7e')]},'raw':!![]})[_0x50bd('0x11')](function(_0x171f23){if(_0x171f23&&_0x171f23[_0x50bd('0x7f')]===0x0){return db['UserProfileResource'][_0x50bd('0x74')]({'name':_0x22d55d[_0x50bd('0x2b')],'resourceId':_0x22d55d['id'],'type':_0x171f23[_0x50bd('0x2b')],'sectionId':_0x171f23['id']},{})['then'](function(){return _0x804ead;});}else{return _0x804ead;}})['catch'](function(_0x4a34e2){logger[_0x50bd('0x17')](_0x50bd('0x80'),_0x4a34e2);throw _0x4a34e2;});}return _0x804ead;})[_0x50bd('0x11')](respondWithResult(_0x5bf477,0xc9))[_0x50bd('0x1b')](handleError(_0x5bf477,null));};exports[_0x50bd('0x81')]=function(_0x36c819,_0x4dc22d){return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0x36c819[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x4dc22d,null))[_0x50bd('0x11')](function(_0xc77c54){if(_0xc77c54){return _0xc77c54[_0x50bd('0x81')]();}return null;})[_0x50bd('0x11')](respondWithResult(_0x4dc22d,null))['catch'](handleError(_0x4dc22d,null));};exports[_0x50bd('0x82')]=function(_0x2c3197,_0x9776a7){if(_0x2c3197[_0x50bd('0x68')]['id']){delete _0x2c3197['body']['id'];}return db['MailAccount'][_0x50bd('0x67')]({'where':{'id':_0x2c3197[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x9776a7,null))[_0x50bd('0x11')](function(_0xde6c74){if(_0xde6c74){_0x2c3197[_0x50bd('0x68')]['MailAccountId']=_0xde6c74['id'];return db[_0x50bd('0x48')][_0x50bd('0x74')](_0x2c3197['body']);}})[_0x50bd('0x11')](respondWithResult(_0x9776a7,null))[_0x50bd('0x1b')](handleError(_0x9776a7,null));};exports[_0x50bd('0x83')]=function(_0x5c06c0,_0xfc7aa2){return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0x5c06c0['params']['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0xfc7aa2,null))[_0x50bd('0x11')](function(_0x3b57d1){if(_0x3b57d1){return _0x3b57d1['setImap'](null);}return null;})['then'](respondWithStatusCode(_0xfc7aa2,null))[_0x50bd('0x1b')](handleError(_0xfc7aa2,null));};exports[_0x50bd('0x84')]=function(_0x313ee0,_0x144d0a){return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0x313ee0[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x144d0a,null))[_0x50bd('0x11')](function(_0x227d7d){if(_0x227d7d){return _0x227d7d[_0x50bd('0x84')]();}return null;})['then'](respondWithResult(_0x144d0a,null))[_0x50bd('0x1b')](handleError(_0x144d0a,null));};exports[_0x50bd('0x85')]=function(_0x4ff106,_0x5b98a2){if(_0x4ff106[_0x50bd('0x68')]['id']){delete _0x4ff106[_0x50bd('0x68')]['id'];}return db[_0x50bd('0x4c')][_0x50bd('0x67')]({'where':{'id':_0x4ff106[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x5b98a2,null))[_0x50bd('0x11')](function(_0x2d86eb){if(_0x2d86eb){_0x4ff106[_0x50bd('0x68')][_0x50bd('0x70')]=_0x2d86eb['id'];return db[_0x50bd('0x49')][_0x50bd('0x74')](_0x4ff106[_0x50bd('0x68')]);}})['then'](respondWithResult(_0x5b98a2,null))['catch'](handleError(_0x5b98a2,null));};exports[_0x50bd('0x86')]=function(_0x135e19,_0x4166c8){return db[_0x50bd('0x4c')]['findOne']({'where':{'id':_0x135e19[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x4166c8,null))[_0x50bd('0x11')](function(_0x3d9318){if(_0x3d9318){return _0x3d9318[_0x50bd('0x87')](null);}return null;})[_0x50bd('0x11')](respondWithStatusCode(_0x4166c8,null))[_0x50bd('0x1b')](handleError(_0x4166c8,null));};exports['addInteraction']=function(_0x421bbd,_0x5918ae){return db['MailInteraction'][_0x50bd('0x67')]({'where':{'id':_0x421bbd[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x5918ae,null))[_0x50bd('0x11')](function(_0x10b4ed){if(_0x10b4ed){return _0x10b4ed[_0x50bd('0x88')](_0x421bbd[_0x50bd('0x68')][_0x50bd('0x76')],_[_0x50bd('0x89')](_0x421bbd[_0x50bd('0x68')],['ids','id'])||{});}})[_0x50bd('0x11')](respondWithResult(_0x5918ae,null))[_0x50bd('0x1b')](handleError(_0x5918ae,null));};exports['getInteractions']=function(_0x4afc7b,_0x49a92d){var _0x20f6d6={'raw':![],'where':{}};var _0x368b17={};var _0x5ac5e6={'count':0x0,'rows':[]};return db['MailAccount'][_0x50bd('0x6e')]({'where':{'id':_0x4afc7b[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x49a92d,null))[_0x50bd('0x11')](function(_0x718f9e){if(_0x718f9e){_0x368b17[_0x50bd('0x50')]=_['keys'](db[_0x50bd('0x8a')][_0x50bd('0x4d')]);_0x368b17[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0x4afc7b[_0x50bd('0x52')]);_0x368b17[_0x50bd('0x54')]=_[_0x50bd('0x55')](_0x368b17['model'],_0x368b17[_0x50bd('0x52')]);_0x20f6d6[_0x50bd('0x57')]=_[_0x50bd('0x55')](_0x368b17[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x56')]));_0x20f6d6[_0x50bd('0x57')]=_0x20f6d6[_0x50bd('0x57')]['length']?_0x20f6d6['attributes']:_0x368b17[_0x50bd('0x50')];if(!_0x4afc7b[_0x50bd('0x52')]['hasOwnProperty'](_0x50bd('0x8b'))){_0x20f6d6[_0x50bd('0x22')]=qs['limit'](_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x22')]);_0x20f6d6[_0x50bd('0x20')]=qs['offset'](_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x20')]);}_0x20f6d6[_0x50bd('0x59')]=qs[_0x50bd('0x5a')](_0x4afc7b[_0x50bd('0x52')]['sort']);_0x20f6d6[_0x50bd('0x5d')]=qs[_0x50bd('0x54')](_[_0x50bd('0x5b')](_0x4afc7b[_0x50bd('0x52')],_0x368b17['filters']));_0x20f6d6['where']['MailAccountId']=_0x718f9e['id'];if(_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x20f6d6['where']=_['merge'](_0x20f6d6[_0x50bd('0x5d')],{'$or':_[_0x50bd('0x51')](_0x20f6d6['attributes'],function(_0x29fc04){var _0x1ba696={};_0x1ba696[_0x29fc04]={'$like':'%'+_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x5c')]+'%'};return _0x1ba696;})});}_0x20f6d6=_['merge']({},_0x20f6d6,_0x4afc7b['options']);return db['MailInteraction'][_0x50bd('0x23')]({'where':_0x20f6d6[_0x50bd('0x5d')]})[_0x50bd('0x11')](function(_0x424f0f){_0x5ac5e6['count']=_0x424f0f;if(_0x4afc7b[_0x50bd('0x52')][_0x50bd('0x61')]){_0x20f6d6[_0x50bd('0x66')]=[{'model':db['CmContact'],'as':_0x50bd('0x8c'),'required':![]},{'model':db[_0x50bd('0x8d')],'as':_0x50bd('0x8e'),'attributes':['name','fullname',_0x50bd('0x8f')],'required':![]},{'model':db[_0x50bd('0x90')],'as':_0x50bd('0x91'),'attributes':['id',_0x50bd('0x2b'),_0x50bd('0x92')],'where':_0x4afc7b[_0x50bd('0x52')]['tag']?{'id':_0x4afc7b[_0x50bd('0x52')]['tag']}:undefined,'required':_0x4afc7b['query'][_0x50bd('0x93')]?!![]:![]}];}return db[_0x50bd('0x8a')][_0x50bd('0x62')](_0x20f6d6);})[_0x50bd('0x11')](function(_0x1e167c){_0x5ac5e6[_0x50bd('0x63')]=_0x1e167c;return _0x5ac5e6;});}})[_0x50bd('0x11')](respondWithFilteredResult(_0x49a92d,_0x20f6d6))[_0x50bd('0x1b')](handleError(_0x49a92d,null));};exports[_0x50bd('0x94')]=function addApplications(_0x1b3c90,_0x5022cb){var _0x2e6e31=_0x1b3c90[_0x50bd('0x65')]['id'];var _0x1d2ed3=_0x1b3c90[_0x50bd('0x68')];var _0x4d41c6=0xc8;var _0x84f7ec=null;return db[_0x50bd('0x95')][_0x50bd('0x96')]({'isolationLevel':db[_0x50bd('0x95')][_0x50bd('0x97')][_0x50bd('0x98')]['READ_COMMITTED']},function(_0x3dbdb6){return db['MailAccount']['findOne']({'where':{'id':_0x2e6e31},'transaction':_0x3dbdb6})[_0x50bd('0x11')](function(_0x29aab6){if(_0x29aab6){return db[_0x50bd('0x99')][_0x50bd('0x27')]({'where':{'MailAccountId':_0x2e6e31},'transaction':_0x3dbdb6})[_0x50bd('0x11')](function(){var _0x1b2b69=_[_0x50bd('0x51')](_0x1d2ed3,function(_0x3dfb27){_0x3dfb27[_0x50bd('0x70')]=_0x2e6e31;return _0x3dfb27;});return db[_0x50bd('0x99')][_0x50bd('0x9a')](_0x1b2b69,{'transaction':_0x3dbdb6});});}else{_0x4d41c6=0x194;_0x84f7ec=[];}});})[_0x50bd('0x11')](function(){if(_0x4d41c6!==0x194){return db['MailApplication'][_0x50bd('0x9b')]({'where':{'MailAccountId':_0x2e6e31},'order':_0x50bd('0x9c')})['then'](function(_0x348bce){_0x84f7ec=_0x348bce;});}})[_0x50bd('0x1b')](function(_0x2b0f16){_0x4d41c6=0x1f4;logger[_0x50bd('0x17')](_0x2b0f16[_0x50bd('0x2a')]);if(_0x2b0f16[_0x50bd('0x2b')]){delete _0x2b0f16[_0x50bd('0x2b')];}_0x84f7ec=_0x2b0f16;})['finally'](function(){if(_0x84f7ec===null){_0x5022cb['sendStatus'](_0x4d41c6);}else{if(_0x4d41c6===0x1f4){_0x5022cb[_0x50bd('0x1d')](_0x4d41c6)[_0x50bd('0x2c')](_0x84f7ec);}else{_0x5022cb['status'](_0x4d41c6)[_0x50bd('0x1f')](_0x84f7ec);}}});};exports[_0x50bd('0x9d')]=function(_0xf9530f,_0x43ff54){var _0x5a4bae={};var _0x179ea0={};var _0x30c634;var _0x2f9b5d;return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0xf9530f['params']['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x43ff54,null))[_0x50bd('0x11')](function(_0x36ebe4){if(_0x36ebe4){_0x30c634=_0x36ebe4;_0x179ea0[_0x50bd('0x50')]=_['keys'](db[_0x50bd('0x99')][_0x50bd('0x4d')]);_0x179ea0[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0xf9530f[_0x50bd('0x52')]);_0x179ea0[_0x50bd('0x54')]=_[_0x50bd('0x55')](_0x179ea0[_0x50bd('0x50')],_0x179ea0['query']);_0x5a4bae[_0x50bd('0x57')]=_[_0x50bd('0x55')](_0x179ea0[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0xf9530f['query'][_0x50bd('0x56')]));_0x5a4bae['attributes']=_0x5a4bae['attributes'][_0x50bd('0x58')]?_0x5a4bae[_0x50bd('0x57')]:_0x179ea0[_0x50bd('0x50')];_0x5a4bae[_0x50bd('0x59')]=qs[_0x50bd('0x5a')](_0xf9530f[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x5a4bae['where']=qs['filters'](_['pick'](_0xf9530f[_0x50bd('0x52')],_0x179ea0[_0x50bd('0x54')]));if(_0xf9530f[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x5a4bae[_0x50bd('0x5d')]=_[_0x50bd('0x5e')](_0x5a4bae[_0x50bd('0x5d')],{'$or':_[_0x50bd('0x51')](_0x5a4bae[_0x50bd('0x57')],function(_0x492fdc){var _0x2c03a7={};_0x2c03a7[_0x492fdc]={'$like':'%'+_0xf9530f[_0x50bd('0x52')]['filter']+'%'};return _0x2c03a7;})});}_0x5a4bae=_[_0x50bd('0x5e')]({},_0x5a4bae,_0xf9530f[_0x50bd('0x60')]);return _0x30c634['getApplications'](_0x5a4bae);}})[_0x50bd('0x11')](function(_0x1f3631){if(_0x1f3631){_0x2f9b5d=_0x1f3631[_0x50bd('0x58')];if(!_0xf9530f[_0x50bd('0x52')][_0x50bd('0x6f')](_0x50bd('0x8b'))){_0x5a4bae[_0x50bd('0x22')]=qs['limit'](_0xf9530f[_0x50bd('0x52')]['limit']);_0x5a4bae[_0x50bd('0x20')]=qs[_0x50bd('0x20')](_0xf9530f['query'][_0x50bd('0x20')]);}return _0x30c634['getApplications'](_0x5a4bae);}})[_0x50bd('0x11')](function(_0x4f57ed){if(_0x4f57ed){return _0x4f57ed?{'count':_0x2f9b5d,'rows':_0x4f57ed}:null;}})[_0x50bd('0x11')](respondWithResult(_0x43ff54,null))['catch'](handleError(_0x43ff54,null));};exports['getMessages']=function(_0x508464,_0x5ed3b6){var _0x1e0c1b={'raw':!![],'where':{}};var _0x2878d4={};var _0x3df29b={'count':0x0,'rows':[]};return db[_0x50bd('0x4c')][_0x50bd('0x6e')]({'where':{'id':_0x508464[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x5ed3b6,null))[_0x50bd('0x11')](function(_0x4ac46f){if(_0x4ac46f){_0x2878d4['model']=_[_0x50bd('0x53')](db['MailMessage'][_0x50bd('0x4d')]);_0x2878d4[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0x508464[_0x50bd('0x52')]);_0x2878d4['filters']=_[_0x50bd('0x55')](_0x2878d4[_0x50bd('0x50')],_0x2878d4[_0x50bd('0x52')]);_0x1e0c1b['attributes']=_[_0x50bd('0x55')](_0x2878d4[_0x50bd('0x50')],qs[_0x50bd('0x56')](_0x508464[_0x50bd('0x52')]['fields']));_0x1e0c1b[_0x50bd('0x57')]=_0x1e0c1b[_0x50bd('0x57')][_0x50bd('0x58')]?_0x1e0c1b[_0x50bd('0x57')]:_0x2878d4[_0x50bd('0x50')];if(!_0x508464[_0x50bd('0x52')][_0x50bd('0x6f')](_0x50bd('0x8b'))){_0x1e0c1b[_0x50bd('0x22')]=qs[_0x50bd('0x22')](_0x508464['query'][_0x50bd('0x22')]);_0x1e0c1b[_0x50bd('0x20')]=qs['offset'](_0x508464['query'][_0x50bd('0x20')]);}_0x1e0c1b['order']=qs[_0x50bd('0x5a')](_0x508464[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x1e0c1b['where']=qs['filters'](_[_0x50bd('0x5b')](_0x508464[_0x50bd('0x52')],_0x2878d4['filters']));_0x1e0c1b[_0x50bd('0x5d')]['MailAccountId']=_0x4ac46f['id'];if(_0x508464[_0x50bd('0x52')][_0x50bd('0x5c')]){_0x1e0c1b[_0x50bd('0x5d')]=_[_0x50bd('0x5e')](_0x1e0c1b['where'],{'$or':_['map'](_0x1e0c1b['attributes'],function(_0x244d57){var _0x32e5d1={};_0x32e5d1[_0x244d57]={'$like':'%'+_0x508464[_0x50bd('0x52')][_0x50bd('0x5c')]+'%'};return _0x32e5d1;})});}if(_0x508464[_0x50bd('0x52')][_0x50bd('0x9e')]){var _0x4ed0f6=_0x508464[_0x50bd('0x52')][_0x50bd('0x9e')][_0x50bd('0x9f')](',');var _0x5c55b0={};_0x5c55b0[_0x4ed0f6[0x0]]={'$gte':moment(_0x4ed0f6[0x1])['format'](_0x50bd('0xa0'))};_0x1e0c1b[_0x50bd('0x5d')]=_[_0x50bd('0x5e')](_0x1e0c1b[_0x50bd('0x5d')],_0x5c55b0);}_0x1e0c1b=_[_0x50bd('0x5e')]({},_0x1e0c1b,_0x508464[_0x50bd('0x60')]);return db[_0x50bd('0xa1')]['count']({'where':_0x1e0c1b[_0x50bd('0x5d')]})[_0x50bd('0x11')](function(_0x4fa38b){_0x3df29b[_0x50bd('0x23')]=_0x4fa38b;if(_0x508464[_0x50bd('0x52')]['includeAll']){_0x1e0c1b[_0x50bd('0x66')]=[{'all':!![]}];}return db[_0x50bd('0xa1')][_0x50bd('0x62')](_0x1e0c1b);})[_0x50bd('0x11')](function(_0x3e510b){if(_0x508464[_0x50bd('0x52')][_0x50bd('0xa2')]==='true'){for(var _0x595a96=0x0;_0x595a96<_0x3e510b[_0x50bd('0x58')];_0x595a96++){_0x3e510b[_0x595a96]['body']=juice(_0x3e510b[_0x595a96]['body']);}}_0x3df29b['rows']=_0x3e510b;return _0x3df29b;});}})[_0x50bd('0x11')](respondWithFilteredResult(_0x5ed3b6,_0x1e0c1b))[_0x50bd('0x1b')](handleError(_0x5ed3b6,null));};exports['send']=function(_0x5f5892,_0x464299){var _0x166e4d,_0x4dc09e={},_0x1acb8a;if(_0x5f5892['body']['to']){_0x1acb8a=_0x5f5892[_0x50bd('0x68')]['to'][_0x50bd('0x9f')](',')[0x0];}return db['MailAccount'][_0x50bd('0x67')]({'where':{'id':_0x5f5892[_0x50bd('0x65')]['id']},'include':[{'model':db[_0x50bd('0xa3')],'as':_0x50bd('0xa4'),'include':[{'model':db['CmContact'],'as':_0x50bd('0xa5'),'where':{'email':_0x1acb8a},'limit':0x1,'order':[['updatedAt',_0x50bd('0xa6')]]}]},{'model':db[_0x50bd('0x49')],'as':_0x50bd('0x46'),'raw':!![],'include':[{'model':db[_0x50bd('0xa7')],'as':_0x50bd('0xa7'),'raw':!![]}]}]})[_0x50bd('0x11')](handleEntityNotFound(_0x464299,null))[_0x50bd('0x11')](function(_0x41f673){if(!_0x41f673)return;_0x166e4d=_0x41f673;if(!_0x41f673[_0x50bd('0x46')])throw new Error(_0x50bd('0xa8'));if(_['isNil'](_0x5f5892[_0x50bd('0x68')][_0x50bd('0xa9')])){_0x5f5892[_0x50bd('0x68')][_0x50bd('0xa9')]=util['format'](_0x50bd('0xaa'),_0x41f673[_0x50bd('0x2b')],_0x41f673[_0x50bd('0xab')]||_0x41f673['Smtp'][_0x50bd('0x43')]);}if(_0x5f5892[_0x50bd('0x68')]['attachments']&&_0x5f5892[_0x50bd('0x68')][_0x50bd('0xac')][_0x50bd('0x58')]){for(var _0x14b0e0=0x0;_0x14b0e0<_0x5f5892[_0x50bd('0x68')][_0x50bd('0xac')][_0x50bd('0x58')];_0x14b0e0+=0x1){_0x5f5892['body'][_0x50bd('0xac')][_0x14b0e0]={'filename':_0x5f5892[_0x50bd('0x68')][_0x50bd('0xac')][_0x14b0e0][_0x50bd('0x2b')],'path':path[_0x50bd('0xad')](config[_0x50bd('0xae')],_0x50bd('0xaf'),_0x5f5892[_0x50bd('0x68')][_0x50bd('0xac')][_0x14b0e0]['basename'])};}}var _0x5038a3=_0x41f673[_0x50bd('0xb0')]();return respondWithRpcPromise(_0x50bd('0xb1'),_0x50bd('0xb2'),{'account':_0x5038a3,'message':_0x5f5892[_0x50bd('0x68')]});})['then'](function(_0x4c5c97){if(!_0x4c5c97)return;_0x4dc09e=_0x4c5c97;if(!_0x166e4d['List'])throw new Error(_0x50bd('0xb3'));if(_0x166e4d['List'][_0x50bd('0xa5')]['length'])return _0x166e4d[_0x50bd('0xa4')]['Contacts'][0x0];return db['CmContact'][_0x50bd('0x74')](_['defaults'](_0x5f5892['body'],{'firstName':_0x5f5892[_0x50bd('0x68')]['to'],'email':_0x5f5892[_0x50bd('0x68')]['to'],'phone':_0x5f5892['body']['to'],'ListId':_0x166e4d[_0x50bd('0xb4')]}));})['then'](function(_0x5dd4b0){if(!_0x5dd4b0)return;var _0x67044c={'UserId':_0x5f5892[_0x50bd('0x43')]['id'],'ContactId':_0x5dd4b0['id'],'MailAccountId':_0x166e4d['id'],'inReplyTo':_0x4dc09e[_0x50bd('0xb5')],'to':_0x5f5892[_0x50bd('0x68')][_0x50bd('0xa9')],'cc':_0x5f5892[_0x50bd('0x68')]['cc'],'subject':_0x5f5892[_0x50bd('0x68')][_0x50bd('0xb6')],'attach':_0x5f5892['body'][_0x50bd('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x50bd('0xa0')),'lastMsgDirection':_0x50bd('0xb8'),'Messages':[_[_0x50bd('0x5e')](_0x5f5892[_0x50bd('0x68')],{'messageId':_0x4dc09e[_0x50bd('0xb5')],'sentAt':moment()[_0x50bd('0xb9')](_0x50bd('0xa0')),'read':!![],'MailAccountId':_0x166e4d['id'],'UserId':_0x5f5892[_0x50bd('0x43')]['id'],'ContactId':_0x5dd4b0['id']})]};if(_0x5f5892['body'][_0x50bd('0xba')]){_0x67044c=_[_0x50bd('0x5e')](_0x67044c,_0x5f5892['body'][_0x50bd('0xba')]);}return db[_0x50bd('0x8a')][_0x50bd('0x74')](_0x67044c,{'include':[{'model':db['MailMessage'],'as':_0x50bd('0xbb')}]});})[_0x50bd('0x11')](respondWithResult(_0x464299,null))[_0x50bd('0x1b')](handleError(_0x464299,null));};exports['verifySmtp']=function(_0xa1e6a,_0x5c5ca8){return db[_0x50bd('0x4c')]['find']({'where':{'id':_0xa1e6a['params']['id']},'include':[{'model':db[_0x50bd('0x49')],'as':_0x50bd('0x46'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x50bd('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5c5ca8,null))['then'](function(_0x1b8b58){if(!_0x1b8b58[_0x50bd('0x46')])return;var _0x58b541=_0x1b8b58[_0x50bd('0xb0')]();return respondWithRpcPromise(_0x50bd('0xbc'),_0x50bd('0xbd'),{'account':_0x58b541});})[_0x50bd('0x11')](respondWithResult(_0x5c5ca8,null))[_0x50bd('0x1b')](handleError(_0x5c5ca8,null));};exports[_0x50bd('0x27')]=function(_0x562a6c,_0x2c4b36){return db[_0x50bd('0x4c')]['find']({'where':{'id':_0x562a6c[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x2c4b36,null))[_0x50bd('0x11')](function(_0x638383){if(_0x638383&&_0x638383[_0x50bd('0x42')]){throw new db[(_0x50bd('0xbe'))][(_0x50bd('0xbf'))](_0x50bd('0xc0'));}return _0x638383;})[_0x50bd('0x11')](removeEntity(_0x2c4b36,null))[_0x50bd('0x1b')](handleError(_0x2c4b36,null));};exports['addAgents']=function(_0x5a9216,_0x52206f){return db['MailAccount'][_0x50bd('0x67')]({'where':{'id':_0x5a9216[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x52206f,null))[_0x50bd('0x11')](function(_0x5e1470){if(_0x5e1470){return _0x5e1470['addAgents'](_0x5a9216['body']['ids'],_[_0x50bd('0x89')](_0x5a9216['body'],[_0x50bd('0x76'),'id'])||{})[_0x50bd('0xc1')](function(_0xa52a03){for(var _0xe60ace=0x0;_0xe60ace<_0x5a9216['body'][_0x50bd('0x76')][_0x50bd('0x58')];_0xe60ace+=0x1){socket[_0x50bd('0xc2')](_0x50bd('0xc3'),{'UserId':Number(_0x5a9216['body'][_0x50bd('0x76')][_0xe60ace]),'MailAccountId':Number(_0x5a9216['params']['id'])});}return _0xa52a03;});}})[_0x50bd('0x11')](respondWithResult(_0x52206f,null))['catch'](handleError(_0x52206f,null));};exports[_0x50bd('0xc4')]=function(_0x110438,_0x3cd7d7){return db[_0x50bd('0x4c')][_0x50bd('0x67')]({'where':{'id':_0x110438[_0x50bd('0x65')]['id']}})['then'](handleEntityNotFound(_0x3cd7d7,null))[_0x50bd('0x11')](function(_0x89c70f){if(_0x89c70f){return _0x89c70f[_0x50bd('0xc4')](_0x110438[_0x50bd('0x52')][_0x50bd('0x76')])[_0x50bd('0x11')](function(){if(_[_0x50bd('0xc5')](_0x110438['query'][_0x50bd('0x76')])){for(var _0x2e5389=0x0;_0x2e5389<_0x110438[_0x50bd('0x52')][_0x50bd('0x76')][_0x50bd('0x58')];_0x2e5389+=0x1){socket[_0x50bd('0xc2')](_0x50bd('0xc6'),{'UserId':Number(_0x110438[_0x50bd('0x52')]['ids'][_0x2e5389]),'MailAccountId':Number(_0x110438[_0x50bd('0x65')]['id'])});}}else{socket['emit'](_0x50bd('0xc6'),{'UserId':Number(_0x110438[_0x50bd('0x52')][_0x50bd('0x76')]),'MailAccountId':Number(_0x110438[_0x50bd('0x65')]['id'])});}});}})[_0x50bd('0x11')](respondWithStatusCode(_0x3cd7d7,null))[_0x50bd('0x1b')](handleError(_0x3cd7d7,null));};exports[_0x50bd('0xc7')]=function(_0x9c04a3,_0x1fb506){var _0x120fa3={};var _0x297d82={};var _0xfe2c3f;var _0x31dce6;return db[_0x50bd('0x4c')]['findOne']({'where':{'id':_0x9c04a3[_0x50bd('0x65')]['id']}})[_0x50bd('0x11')](handleEntityNotFound(_0x1fb506,null))[_0x50bd('0x11')](function(_0x24f69f){if(_0x24f69f){_0xfe2c3f=_0x24f69f;_0x297d82['model']=_[_0x50bd('0x53')](db[_0x50bd('0x8d')]['rawAttributes']);_0x297d82[_0x50bd('0x52')]=_[_0x50bd('0x53')](_0x9c04a3[_0x50bd('0x52')]);_0x297d82[_0x50bd('0x54')]=_[_0x50bd('0x55')](_0x297d82['model'],_0x297d82[_0x50bd('0x52')]);_0x120fa3[_0x50bd('0x57')]=_[_0x50bd('0x55')](_0x297d82['model'],qs[_0x50bd('0x56')](_0x9c04a3['query']['fields']));_0x120fa3[_0x50bd('0x57')]=_0x120fa3[_0x50bd('0x57')][_0x50bd('0x58')]?_0x120fa3['attributes']:_0x297d82['model'];_0x120fa3[_0x50bd('0x59')]=qs[_0x50bd('0x5a')](_0x9c04a3[_0x50bd('0x52')][_0x50bd('0x5a')]);_0x120fa3[_0x50bd('0x5d')]=qs[_0x50bd('0x54')](_[_0x50bd('0x5b')](_0x9c04a3[_0x50bd('0x52')],_0x297d82[_0x50bd('0x54')]));if(_0x9c04a3[_0x50bd('0x52')]['filter']){_0x120fa3[_0x50bd('0x5d')]=_[_0x50bd('0x5e')](_0x120fa3[_0x50bd('0x5d')],{'$or':_['map'](_0x120fa3[_0x50bd('0x57')],function(_0x492dbd){var _0x428cc6={};_0x428cc6[_0x492dbd]={'$like':'%'+_0x9c04a3[_0x50bd('0x52')][_0x50bd('0x5c')]+'%'};return _0x428cc6;})});}_0x120fa3=_[_0x50bd('0x5e')]({},_0x120fa3,_0x9c04a3[_0x50bd('0x60')]);return _0xfe2c3f[_0x50bd('0xc7')](_0x120fa3);}})[_0x50bd('0x11')](function(_0x4aaf43){if(_0x4aaf43){_0x31dce6=_0x4aaf43['length'];if(!_0x9c04a3[_0x50bd('0x52')][_0x50bd('0x6f')](_0x50bd('0x8b'))){_0x120fa3[_0x50bd('0x22')]=qs[_0x50bd('0x22')](_0x9c04a3[_0x50bd('0x52')][_0x50bd('0x22')]);_0x120fa3[_0x50bd('0x20')]=qs[_0x50bd('0x20')](_0x9c04a3[_0x50bd('0x52')]['offset']);}return _0xfe2c3f[_0x50bd('0xc7')](_0x120fa3);}})[_0x50bd('0x11')](function(_0xa8ede2){if(_0xa8ede2){return _0xa8ede2?{'count':_0x31dce6,'rows':_0xa8ede2}:null;}})[_0x50bd('0x11')](respondWithResult(_0x1fb506,null))[_0x50bd('0x1b')](handleError(_0x1fb506,null));}; \ No newline at end of file +var _0x48c3=['VIRTUAL','filter','merge','includeAll','include','findAll','rows','params','length','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','sort','pick','removeDispositions','getAnswers','findOne','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','ids','omit','getInteractions','order','options','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','service','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','userMailAccount:remove','getAgents','bluebird','util','path','ioredis','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','secure','authentication','Imap','port','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters'];(function(_0x2a7701,_0x237f92){var _0x58d042=function(_0x48c36c){while(--_0x48c36c){_0x2a7701['push'](_0x2a7701['shift']());}};_0x58d042(++_0x237f92);}(_0x48c3,0x1f3));var _0x348c=function(_0x535fe6,_0x2c99d2){_0x535fe6=_0x535fe6-0x0;var _0x2b2f8b=_0x48c3[_0x535fe6];return _0x2b2f8b;};'use strict';var moment=require('moment');var BPromise=require(_0x348c('0x0'));var util=require(_0x348c('0x1'));var path=require(_0x348c('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x348c('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x348c('0x4'))(_0x348c('0x5'));var config=require(_0x348c('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x348c('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x348c('0x8'))(new Redis(config[_0x348c('0x9')]));require(_0x348c('0xa'))[_0x348c('0xb')](socket);var jayson=require(_0x348c('0xc'));var client=jayson[_0x348c('0xd')][_0x348c('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1c875e,_0x432929,_0x16243c,_0x2b2d95){return new BPromise(function(_0x401b0d,_0x1d88c4){var _0x409d43=_0x2b2d95||client;return _0x409d43[_0x348c('0xf')](_0x1c875e,_0x16243c)[_0x348c('0x10')](function(_0x501d57){logger['info']('MailAccount,\x20%s,\x20%s',_0x432929,_0x348c('0x11'));logger['debug'](_0x348c('0x12'),_0x432929,_0x348c('0x11'),JSON[_0x348c('0x13')](_0x501d57));if(_0x501d57[_0x348c('0x14')]){if(_0x501d57[_0x348c('0x14')][_0x348c('0x15')]===0x1f4){logger[_0x348c('0x14')](_0x348c('0x16'),_0x432929,_0x501d57['error'][_0x348c('0x17')]);return _0x1d88c4(_0x501d57['error'][_0x348c('0x17')]);}logger[_0x348c('0x14')](_0x348c('0x16'),_0x432929,_0x501d57[_0x348c('0x14')]['message']);return _0x401b0d(_0x501d57['error'][_0x348c('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x432929,_0x348c('0x11'));_0x401b0d(_0x501d57['result']['message']);}})[_0x348c('0x18')](function(_0x558cf5){logger['error'](_0x348c('0x16'),_0x432929,_0x558cf5);_0x1d88c4(_0x558cf5);});});}function respondWithStatusCode(_0x2945ee,_0x270075){_0x270075=_0x270075||0xcc;return function(_0xe6562c){if(_0xe6562c){return _0x2945ee[_0x348c('0x19')](_0x270075);}return _0x2945ee[_0x348c('0x1a')](_0x270075)[_0x348c('0x1b')]();};}function respondWithResult(_0x5efebf,_0x277386){_0x277386=_0x277386||0xc8;return function(_0x26ff88){if(_0x26ff88){return _0x5efebf['status'](_0x277386)[_0x348c('0x1c')](_0x26ff88);}};}function respondWithFilteredResult(_0x2b2d3f,_0x25dd5e){return function(_0x2a6fc6){if(_0x2a6fc6){var _0x547c40=typeof _0x25dd5e[_0x348c('0x1d')]===_0x348c('0x1e')&&typeof _0x25dd5e[_0x348c('0x1f')]===_0x348c('0x1e');var _0x50b171=_0x2a6fc6[_0x348c('0x20')];var _0xc38943=_0x547c40?0x0:_0x25dd5e['offset'];var _0x150e8c=_0x547c40?_0x2a6fc6[_0x348c('0x20')]:_0x25dd5e[_0x348c('0x1d')]+_0x25dd5e['limit'];var _0x233ef4;if(_0x150e8c>=_0x50b171){_0x150e8c=_0x50b171;_0x233ef4=0xc8;}else{_0x233ef4=0xce;}_0x2b2d3f[_0x348c('0x1a')](_0x233ef4);return _0x2b2d3f['set']('Content-Range',_0xc38943+'-'+_0x150e8c+'/'+_0x50b171)[_0x348c('0x1c')](_0x2a6fc6);}return null;};}function saveUpdates(_0x54b2ee){return function(_0x4d9b56){if(_0x4d9b56){return _0x4d9b56[_0x348c('0x21')](_0x54b2ee)[_0x348c('0x10')](function(_0x5c4352){return _0x5c4352;});}return null;};}function removeEntity(_0x19a83a){return function(_0x34355a){if(_0x34355a){return _0x34355a[_0x348c('0x22')]()[_0x348c('0x10')](function(){var _0x3732c3=_0x34355a[_0x348c('0x23')]({'plain':!![]});var _0x55a222=_0x348c('0x24');return db[_0x348c('0x25')]['destroy']({'where':{'type':_0x55a222,'resourceId':_0x3732c3['id']}})[_0x348c('0x10')](function(){return _0x34355a;});})['then'](function(){_0x19a83a['status'](0xcc)[_0x348c('0x1b')]();});}};}function handleEntityNotFound(_0x186921){return function(_0x186acc){if(!_0x186acc){_0x186921[_0x348c('0x19')](0x194);}return _0x186acc;};}function handleError(_0x50a7a2,_0x8b8b5b){_0x8b8b5b=_0x8b8b5b||0x1f4;return function(_0x177124){logger[_0x348c('0x14')](_0x177124[_0x348c('0x26')]);if(_0x177124[_0x348c('0x27')]){delete _0x177124['name'];}_0x50a7a2['status'](_0x8b8b5b)[_0x348c('0x28')](_0x177124);};}function getImapHost(_0x5a3caa){switch(_0x5a3caa){case'gmail':return _0x348c('0x29');case _0x348c('0x2a'):return'imap.mail.yahoo.com';case _0x348c('0x2b'):return'imap-mail.outlook.com';case _0x348c('0x2c'):return _0x348c('0x2d');}throw new Error(_0x348c('0x2e'),_0x5a3caa);}function getSmtpHost(_0x448a5c){switch(_0x448a5c){case'gmail':return _0x348c('0x2f');case _0x348c('0x2a'):return _0x348c('0x30');case _0x348c('0x2b'):return'smtp-mail.outlook.com';case'outlook365':return _0x348c('0x31');}throw new Error(_0x348c('0x2e'),_0x448a5c);}function getAuthenticationOptions(_0x3038f0,_0x484415){var _0x5e555d={};var _0x594ee5={};if(_0x3038f0){_0x5e555d[_0x348c('0x32')]=_0x594ee5[_0x348c('0x32')]=_0x484415[_0x348c('0x33')];_0x5e555d[_0x348c('0x34')]=_0x594ee5['pass']=_0x484415[_0x348c('0x34')];if(_0x484415[_0x348c('0x35')]){_0x5e555d[_0x348c('0x35')]=_0x594ee5[_0x348c('0x35')]=!![];_0x5e555d['CloudProviderId']=_0x594ee5['CloudProviderId']=_0x484415[_0x348c('0x36')];_0x5e555d['password']=_0x594ee5[_0x348c('0x37')]=null;}else{_0x5e555d[_0x348c('0x36')]=_0x594ee5[_0x348c('0x36')]=null;}_0x5e555d['host']=getImapHost(_0x3038f0);_0x5e555d['port']=0x3e1;_0x594ee5[_0x348c('0x38')]=getSmtpHost(_0x3038f0);_0x594ee5['port']=0x24b;_0x594ee5[_0x348c('0x39')]=![];_0x5e555d['service']=_0x594ee5['service']=null;}else{if(_0x484415[_0x348c('0x3a')]){_0x5e555d[_0x348c('0x32')]=_0x594ee5[_0x348c('0x32')]=_0x484415[_0x348c('0x33')];_0x5e555d[_0x348c('0x34')]=_0x594ee5[_0x348c('0x37')]=_0x484415['password'];}else{_0x5e555d[_0x348c('0x3a')]=_0x594ee5[_0x348c('0x3a')]=![];_0x5e555d[_0x348c('0x32')]=_0x594ee5['user']=null;_0x5e555d[_0x348c('0x34')]=_0x594ee5[_0x348c('0x37')]=null;}_0x5e555d[_0x348c('0x38')]=_0x484415[_0x348c('0x3b')][_0x348c('0x38')];_0x5e555d[_0x348c('0x3c')]=_0x484415[_0x348c('0x3b')][_0x348c('0x3c')];_0x594ee5['host']=_0x484415[_0x348c('0x3d')]['host'];_0x594ee5[_0x348c('0x3c')]=_0x484415[_0x348c('0x3d')][_0x348c('0x3c')];}return{'Imap':_0x5e555d,'Smtp':_0x594ee5};}exports[_0x348c('0x3e')]=function(_0x1e0640,_0x2587d3){var _0x581b21={'include':[{'model':db[_0x348c('0x3f')],'as':_0x348c('0x3b')},{'model':db[_0x348c('0x40')],'as':_0x348c('0x3d')},{'model':db[_0x348c('0x41')],'as':_0x348c('0x42')}]},_0x281834={},_0x38635d={'count':0x0,'rows':[]};var _0x7ec34c=_[_0x348c('0x43')](db[_0x348c('0x44')][_0x348c('0x45')],function(_0x4400da){return{'name':_0x4400da[_0x348c('0x46')],'type':_0x4400da[_0x348c('0x47')][_0x348c('0x48')]};});_0x281834['model']=_[_0x348c('0x43')](_0x7ec34c,_0x348c('0x27'));_0x281834['query']=_[_0x348c('0x49')](_0x1e0640[_0x348c('0x4a')]);_0x281834['filters']=_['intersection'](_0x281834[_0x348c('0x4b')],_0x281834[_0x348c('0x4a')]);_0x581b21['attributes']=_[_0x348c('0x4c')](_0x281834[_0x348c('0x4b')],qs['fields'](_0x1e0640[_0x348c('0x4a')][_0x348c('0x4d')]));_0x581b21[_0x348c('0x4e')]=_0x581b21[_0x348c('0x4e')]['length']?_0x581b21['attributes']:_0x281834[_0x348c('0x4b')];if(!_0x1e0640[_0x348c('0x4a')][_0x348c('0x4f')](_0x348c('0x50'))){_0x581b21[_0x348c('0x1f')]=qs[_0x348c('0x1f')](_0x1e0640[_0x348c('0x4a')][_0x348c('0x1f')]);_0x581b21[_0x348c('0x1d')]=qs[_0x348c('0x1d')](_0x1e0640[_0x348c('0x4a')][_0x348c('0x1d')]);}_0x581b21['order']=qs['sort'](_0x1e0640['query']['sort']);_0x581b21[_0x348c('0x51')]=qs[_0x348c('0x52')](_['pick'](_0x1e0640[_0x348c('0x4a')],_0x281834['filters']),_0x7ec34c);if(_0x1e0640[_0x348c('0x4a')]['filter']){_0x581b21[_0x348c('0x51')]=_['merge'](_0x581b21[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x7ec34c,function(_0xcee305){if(_0xcee305[_0x348c('0x47')]!==_0x348c('0x53')){var _0x481898={};_0x481898[_0xcee305[_0x348c('0x27')]]={'$like':'%'+_0x1e0640[_0x348c('0x4a')][_0x348c('0x54')]+'%'};return _0x481898;}})});}_0x581b21=_[_0x348c('0x55')]({},_0x581b21,_0x1e0640['options']);var _0x195616={'where':_0x581b21[_0x348c('0x51')]};return db[_0x348c('0x44')][_0x348c('0x20')](_0x195616)[_0x348c('0x10')](function(_0xaad72a){_0x38635d['count']=_0xaad72a;if(_0x1e0640[_0x348c('0x4a')][_0x348c('0x56')]){_0x581b21[_0x348c('0x57')]=[{'all':!![]}];}return db[_0x348c('0x44')][_0x348c('0x58')](_0x581b21);})[_0x348c('0x10')](function(_0xf8c6df){_0x38635d[_0x348c('0x59')]=_0xf8c6df;return _0x38635d;})[_0x348c('0x10')](respondWithFilteredResult(_0x2587d3,_0x581b21))[_0x348c('0x18')](handleError(_0x2587d3,null));};exports['show']=function(_0x5a902a,_0x2bbbad){var _0x5d9769={'raw':![],'where':{'id':_0x5a902a[_0x348c('0x5a')]['id']},'include':[{'model':db[_0x348c('0x3f')],'as':_0x348c('0x3b')},{'model':db[_0x348c('0x40')],'as':_0x348c('0x3d')},{'model':db[_0x348c('0x41')],'as':'mandatoryDispositionPause'}]},_0x49954a={};_0x49954a[_0x348c('0x4b')]=_['keys'](db[_0x348c('0x44')]['rawAttributes']);_0x49954a['query']=_['keys'](_0x5a902a[_0x348c('0x4a')]);_0x49954a[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x49954a[_0x348c('0x4b')],_0x49954a['query']);_0x5d9769[_0x348c('0x4e')]=_['intersection'](_0x49954a[_0x348c('0x4b')],qs[_0x348c('0x4d')](_0x5a902a[_0x348c('0x4a')][_0x348c('0x4d')]));_0x5d9769['attributes']=_0x5d9769[_0x348c('0x4e')][_0x348c('0x5b')]?_0x5d9769[_0x348c('0x4e')]:_0x49954a[_0x348c('0x4b')];if(_0x5a902a[_0x348c('0x4a')]['includeAll']){_0x5d9769[_0x348c('0x57')]=[{'all':!![]}];}_0x5d9769=_[_0x348c('0x55')]({},_0x5d9769,_0x5a902a['options']);return db['MailAccount'][_0x348c('0x5c')](_0x5d9769)['then'](handleEntityNotFound(_0x2bbbad,null))[_0x348c('0x10')](respondWithResult(_0x2bbbad,null))[_0x348c('0x18')](handleError(_0x2bbbad,null));};exports['update']=function(_0x31fe90,_0x3872b3){if(_0x31fe90['body']['id']){delete _0x31fe90[_0x348c('0x5d')]['id'];}var _0x1322ec=_0x31fe90[_0x348c('0x5d')][_0x348c('0x5e')]===_0x348c('0x5f')?null:_0x31fe90[_0x348c('0x5d')][_0x348c('0x5e')];var _0x26fdfd=_0x31fe90[_0x348c('0x5d')]['Imap']||{};var _0x3d7dfe=_0x31fe90['body'][_0x348c('0x3d')]||{};if(_0x1322ec){_0x26fdfd['host']=getImapHost(_0x1322ec);_0x26fdfd[_0x348c('0x3c')]=0x3e1;_0x3d7dfe[_0x348c('0x38')]=getSmtpHost(_0x1322ec);_0x3d7dfe[_0x348c('0x3c')]=0x24b;_0x3d7dfe['secure']=![];}if(_0x3d7dfe['modernAuthentication']){_0x3d7dfe[_0x348c('0x39')]=![];}else{_0x3d7dfe[_0x348c('0x36')]=null;}if(!_0x26fdfd['modernAuthentication'])_0x26fdfd[_0x348c('0x36')]=null;_0x31fe90[_0x348c('0x5d')][_0x348c('0x3b')]=_0x26fdfd;_0x31fe90[_0x348c('0x5d')][_0x348c('0x3d')]=_0x3d7dfe;return db['MailAccount'][_0x348c('0x5c')]({'where':{'id':_0x31fe90['params']['id']},'include':[{'model':db[_0x348c('0x3f')],'as':'Imap'},{'model':db[_0x348c('0x40')],'as':_0x348c('0x3d')},{'model':db[_0x348c('0x41')],'as':_0x348c('0x42')}]})[_0x348c('0x10')](handleEntityNotFound(_0x3872b3,null))['then'](function(_0x5c86f1){if(!_0x5c86f1)throw new Error(_0x348c('0x60'));if(_0x5c86f1['service'])delete _0x31fe90['body'][_0x348c('0x3b')];return _0x5c86f1;})[_0x348c('0x10')](saveUpdates(_0x31fe90[_0x348c('0x5d')],null))[_0x348c('0x10')](function(_0x4ac637){if(!_0x31fe90[_0x348c('0x5d')]['Imap'])return _0x4ac637;return db['MailServerIn'][_0x348c('0x21')](_0x31fe90[_0x348c('0x5d')][_0x348c('0x3b')],{'where':{'MailAccountId':_0x4ac637['id']}})[_0x348c('0x10')](function(){return _0x4ac637;});})['then'](function(_0x5792da){if(!_0x31fe90[_0x348c('0x5d')][_0x348c('0x3d')])return _0x5792da;return db[_0x348c('0x40')][_0x348c('0x21')](_0x31fe90['body'][_0x348c('0x3d')],{'where':{'MailAccountId':_0x5792da['id']}})[_0x348c('0x10')](function(){return _0x5792da;});})['then'](respondWithResult(_0x3872b3,null))[_0x348c('0x18')](handleError(_0x3872b3,null));};exports[_0x348c('0x61')]=function(_0x52b343,_0x1fc787){return db[_0x348c('0x44')][_0x348c('0x61')]()['then'](respondWithResult(_0x1fc787,null))[_0x348c('0x18')](handleError(_0x1fc787,null));};exports[_0x348c('0x62')]=function(_0x5da363,_0x40e9fe){if(_0x5da363[_0x348c('0x5d')]['id']){delete _0x5da363[_0x348c('0x5d')]['id'];}return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x5da363['params']['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x40e9fe,null))[_0x348c('0x10')](function(_0x371b10){if(_0x371b10){_0x5da363[_0x348c('0x5d')][_0x348c('0x63')]=_0x371b10['id'];return db[_0x348c('0x64')][_0x348c('0x65')](_0x5da363[_0x348c('0x5d')]);}})['then'](respondWithResult(_0x40e9fe,null))[_0x348c('0x18')](handleError(_0x40e9fe,null));};exports[_0x348c('0x66')]=function(_0x1f0c7c,_0xa0e031){var _0x2784b9={'raw':![],'where':{}};var _0x4e1b0e={};var _0x229748={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1f0c7c[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0xa0e031,null))[_0x348c('0x10')](function(_0x4e3fc6){if(_0x4e3fc6){_0x4e1b0e['model']=_[_0x348c('0x49')](db[_0x348c('0x64')][_0x348c('0x45')]);_0x4e1b0e[_0x348c('0x4a')]=_[_0x348c('0x49')](_0x1f0c7c[_0x348c('0x4a')]);_0x4e1b0e[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x4e1b0e[_0x348c('0x4b')],_0x4e1b0e['query']);_0x2784b9[_0x348c('0x4e')]=_[_0x348c('0x4c')](_0x4e1b0e[_0x348c('0x4b')],qs[_0x348c('0x4d')](_0x1f0c7c[_0x348c('0x4a')][_0x348c('0x4d')]));_0x2784b9[_0x348c('0x4e')]=_0x2784b9[_0x348c('0x4e')][_0x348c('0x5b')]?_0x2784b9[_0x348c('0x4e')]:_0x4e1b0e[_0x348c('0x4b')];if(!_0x1f0c7c[_0x348c('0x4a')]['hasOwnProperty'](_0x348c('0x50'))){_0x2784b9[_0x348c('0x1f')]=qs[_0x348c('0x1f')](_0x1f0c7c[_0x348c('0x4a')][_0x348c('0x1f')]);_0x2784b9[_0x348c('0x1d')]=qs[_0x348c('0x1d')](_0x1f0c7c[_0x348c('0x4a')][_0x348c('0x1d')]);}_0x2784b9['order']=qs[_0x348c('0x67')](_0x1f0c7c[_0x348c('0x4a')][_0x348c('0x67')]);_0x2784b9[_0x348c('0x51')]=qs[_0x348c('0x52')](_[_0x348c('0x68')](_0x1f0c7c['query'],_0x4e1b0e[_0x348c('0x52')]));_0x2784b9[_0x348c('0x51')][_0x348c('0x63')]=_0x4e3fc6['id'];if(_0x1f0c7c['query']['filter']){_0x2784b9['where']=_[_0x348c('0x55')](_0x2784b9[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x2784b9[_0x348c('0x4e')],function(_0x403b8c){var _0x51e4fb={};_0x51e4fb[_0x403b8c]={'$like':'%'+_0x1f0c7c[_0x348c('0x4a')]['filter']+'%'};return _0x51e4fb;})});}_0x2784b9=_[_0x348c('0x55')]({},_0x2784b9,_0x1f0c7c['options']);return db[_0x348c('0x64')][_0x348c('0x20')]({'where':_0x2784b9[_0x348c('0x51')]})['then'](function(_0x480ab5){_0x229748[_0x348c('0x20')]=_0x480ab5;if(_0x1f0c7c[_0x348c('0x4a')][_0x348c('0x56')]){_0x2784b9[_0x348c('0x57')]=[{'all':!![]}];}return db[_0x348c('0x64')]['findAll'](_0x2784b9);})[_0x348c('0x10')](function(_0x6d87ea){_0x229748[_0x348c('0x59')]=_0x6d87ea;return _0x229748;});}})[_0x348c('0x10')](respondWithFilteredResult(_0xa0e031,_0x2784b9))[_0x348c('0x18')](handleError(_0xa0e031,null));};exports[_0x348c('0x69')]=function(_0x5357dd,_0x5deda3){return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x5357dd[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x5deda3,null))[_0x348c('0x10')](function(_0xb228d3){if(_0xb228d3){return _0xb228d3[_0x348c('0x69')](_0x5357dd[_0x348c('0x4a')]['ids']);}})[_0x348c('0x10')](respondWithStatusCode(_0x5deda3,null))[_0x348c('0x18')](handleError(_0x5deda3,null));};exports['addAnswer']=function(_0x1effe1,_0x393a9c){if(_0x1effe1[_0x348c('0x5d')]['id']){delete _0x1effe1[_0x348c('0x5d')]['id'];}return db[_0x348c('0x44')]['find']({'where':{'id':_0x1effe1[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x393a9c,null))[_0x348c('0x10')](function(_0x2f29a1){if(_0x2f29a1){_0x1effe1[_0x348c('0x5d')][_0x348c('0x63')]=_0x2f29a1['id'];return db['CannedAnswer'][_0x348c('0x65')](_0x1effe1[_0x348c('0x5d')]);}})['then'](respondWithResult(_0x393a9c,null))['catch'](handleError(_0x393a9c,null));};exports[_0x348c('0x6a')]=function(_0x4ed42b,_0x50282a){var _0x3ac02b={'raw':![],'where':{}};var _0x42b482={};var _0x4a993b={'count':0x0,'rows':[]};return db['MailAccount'][_0x348c('0x6b')]({'where':{'id':_0x4ed42b['params']['id']}})['then'](handleEntityNotFound(_0x50282a,null))[_0x348c('0x10')](function(_0xabd1f0){if(_0xabd1f0){_0x42b482[_0x348c('0x4b')]=_[_0x348c('0x49')](db[_0x348c('0x6c')][_0x348c('0x45')]);_0x42b482[_0x348c('0x4a')]=_['keys'](_0x4ed42b[_0x348c('0x4a')]);_0x42b482[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x42b482[_0x348c('0x4b')],_0x42b482[_0x348c('0x4a')]);_0x3ac02b['attributes']=_[_0x348c('0x4c')](_0x42b482['model'],qs[_0x348c('0x4d')](_0x4ed42b[_0x348c('0x4a')][_0x348c('0x4d')]));_0x3ac02b[_0x348c('0x4e')]=_0x3ac02b[_0x348c('0x4e')][_0x348c('0x5b')]?_0x3ac02b['attributes']:_0x42b482[_0x348c('0x4b')];if(!_0x4ed42b[_0x348c('0x4a')]['hasOwnProperty']('nolimit')){_0x3ac02b[_0x348c('0x1f')]=qs[_0x348c('0x1f')](_0x4ed42b[_0x348c('0x4a')][_0x348c('0x1f')]);_0x3ac02b[_0x348c('0x1d')]=qs['offset'](_0x4ed42b[_0x348c('0x4a')][_0x348c('0x1d')]);}_0x3ac02b['order']=qs['sort'](_0x4ed42b['query']['sort']);_0x3ac02b['where']=qs[_0x348c('0x52')](_[_0x348c('0x68')](_0x4ed42b[_0x348c('0x4a')],_0x42b482[_0x348c('0x52')]));_0x3ac02b[_0x348c('0x51')][_0x348c('0x63')]=_0xabd1f0['id'];if(_0x4ed42b['query'][_0x348c('0x54')]){_0x3ac02b[_0x348c('0x51')]=_[_0x348c('0x55')](_0x3ac02b[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x3ac02b['attributes'],function(_0x4bd8fd){var _0x40a1a9={};_0x40a1a9[_0x4bd8fd]={'$like':'%'+_0x4ed42b[_0x348c('0x4a')][_0x348c('0x54')]+'%'};return _0x40a1a9;})});}_0x3ac02b=_[_0x348c('0x55')]({},_0x3ac02b,_0x4ed42b['options']);return db[_0x348c('0x6c')][_0x348c('0x20')]({'where':_0x3ac02b[_0x348c('0x51')]})[_0x348c('0x10')](function(_0x4c5572){_0x4a993b['count']=_0x4c5572;if(_0x4ed42b[_0x348c('0x4a')]['includeAll']){_0x3ac02b[_0x348c('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3ac02b);})[_0x348c('0x10')](function(_0x501895){_0x4a993b[_0x348c('0x59')]=_0x501895;return _0x4a993b;});}})[_0x348c('0x10')](respondWithFilteredResult(_0x50282a,_0x3ac02b))[_0x348c('0x18')](handleError(_0x50282a,null));};exports['removeAnswers']=function(_0x2e26c1,_0x382e4b){return db['MailAccount'][_0x348c('0x5c')]({'where':{'id':_0x2e26c1['params']['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x382e4b,null))['then'](function(_0x42c58b){if(_0x42c58b){return _0x42c58b[_0x348c('0x6d')](_0x2e26c1[_0x348c('0x4a')]['ids']);}})[_0x348c('0x10')](respondWithStatusCode(_0x382e4b,null))[_0x348c('0x18')](handleError(_0x382e4b,null));};exports[_0x348c('0x65')]=function(_0x24d4ad,_0x2c82ff){var _0x3bca18={'name':_0x24d4ad[_0x348c('0x5d')][_0x348c('0x27')],'key':_0x24d4ad[_0x348c('0x5d')][_0x348c('0x48')],'provider':_0x24d4ad['body']['provider']===_0x348c('0x5f')?null:_0x24d4ad[_0x348c('0x5d')][_0x348c('0x5e')],'email':_0x24d4ad[_0x348c('0x5d')][_0x348c('0x6e')],'ListId':_0x24d4ad['body'][_0x348c('0x6f')],'active':!_[_0x348c('0x70')](_0x24d4ad[_0x348c('0x5d')][_0x348c('0x71')])?_0x24d4ad[_0x348c('0x5d')][_0x348c('0x71')]:!![],'description':_0x24d4ad['body'][_0x348c('0x72')]||null};var _0x149516=getAuthenticationOptions(_0x3bca18[_0x348c('0x5e')],_0x24d4ad[_0x348c('0x5d')]);_0x3bca18[_0x348c('0x3b')]=_0x149516[_0x348c('0x3b')];_0x3bca18[_0x348c('0x3d')]=_0x149516[_0x348c('0x3d')];return db['MailAccount'][_0x348c('0x65')](_0x3bca18,{'include':[{'model':db['MailServerOut'],'as':_0x348c('0x3d')},{'model':db[_0x348c('0x3f')],'as':_0x348c('0x3b')}]})[_0x348c('0x10')](function(_0x43659f){var _0x4893e1=_0x24d4ad[_0x348c('0x32')]['get']({'plain':!![]});if(!_0x4893e1)throw new Error(_0x348c('0x73'));if(_0x4893e1[_0x348c('0x74')]===_0x348c('0x32')){var _0x5cd7cb=_0x43659f['get']({'plain':!![]});return db[_0x348c('0x75')]['find']({'where':{'name':_0x348c('0x24'),'userProfileId':_0x4893e1[_0x348c('0x76')]},'raw':!![]})[_0x348c('0x10')](function(_0x5c06c5){if(_0x5c06c5&&_0x5c06c5[_0x348c('0x77')]===0x0){return db[_0x348c('0x25')][_0x348c('0x65')]({'name':_0x5cd7cb[_0x348c('0x27')],'resourceId':_0x5cd7cb['id'],'type':_0x5c06c5[_0x348c('0x27')],'sectionId':_0x5c06c5['id']},{})[_0x348c('0x10')](function(){return _0x43659f;});}else{return _0x43659f;}})['catch'](function(_0x10a068){logger[_0x348c('0x14')](_0x348c('0x78'),_0x10a068);throw _0x10a068;});}return _0x43659f;})[_0x348c('0x10')](respondWithResult(_0x2c82ff,0xc9))[_0x348c('0x18')](handleError(_0x2c82ff,null));};exports[_0x348c('0x79')]=function(_0x317c80,_0xbfeccc){return db['MailAccount']['findOne']({'where':{'id':_0x317c80[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0xbfeccc,null))[_0x348c('0x10')](function(_0x3d864f){if(_0x3d864f){return _0x3d864f[_0x348c('0x79')]();}return null;})[_0x348c('0x10')](respondWithResult(_0xbfeccc,null))['catch'](handleError(_0xbfeccc,null));};exports['addImap']=function(_0x5252e6,_0x4e30ef){if(_0x5252e6['body']['id']){delete _0x5252e6[_0x348c('0x5d')]['id'];}return db['MailAccount'][_0x348c('0x5c')]({'where':{'id':_0x5252e6[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x4e30ef,null))[_0x348c('0x10')](function(_0x558854){if(_0x558854){_0x5252e6['body'][_0x348c('0x63')]=_0x558854['id'];return db[_0x348c('0x3f')][_0x348c('0x65')](_0x5252e6['body']);}})[_0x348c('0x10')](respondWithResult(_0x4e30ef,null))[_0x348c('0x18')](handleError(_0x4e30ef,null));};exports[_0x348c('0x7a')]=function(_0x3ddc2c,_0x150dba){return db[_0x348c('0x44')]['findOne']({'where':{'id':_0x3ddc2c[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x150dba,null))[_0x348c('0x10')](function(_0x420ff4){if(_0x420ff4){return _0x420ff4[_0x348c('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x150dba,null))['catch'](handleError(_0x150dba,null));};exports[_0x348c('0x7c')]=function(_0x56ad46,_0x3b9e04){return db[_0x348c('0x44')][_0x348c('0x6b')]({'where':{'id':_0x56ad46[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3b9e04,null))[_0x348c('0x10')](function(_0x119216){if(_0x119216){return _0x119216[_0x348c('0x7c')]();}return null;})[_0x348c('0x10')](respondWithResult(_0x3b9e04,null))['catch'](handleError(_0x3b9e04,null));};exports['addSmtp']=function(_0x1dcb25,_0x229a50){if(_0x1dcb25['body']['id']){delete _0x1dcb25[_0x348c('0x5d')]['id'];}return db[_0x348c('0x44')]['find']({'where':{'id':_0x1dcb25['params']['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x229a50,null))[_0x348c('0x10')](function(_0x33fd73){if(_0x33fd73){_0x1dcb25[_0x348c('0x5d')][_0x348c('0x63')]=_0x33fd73['id'];return db[_0x348c('0x40')][_0x348c('0x65')](_0x1dcb25[_0x348c('0x5d')]);}})['then'](respondWithResult(_0x229a50,null))[_0x348c('0x18')](handleError(_0x229a50,null));};exports[_0x348c('0x7d')]=function(_0x58d994,_0x3c4f1f){return db[_0x348c('0x44')][_0x348c('0x6b')]({'where':{'id':_0x58d994[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x3c4f1f,null))['then'](function(_0x35f696){if(_0x35f696){return _0x35f696[_0x348c('0x7e')](null);}return null;})[_0x348c('0x10')](respondWithStatusCode(_0x3c4f1f,null))[_0x348c('0x18')](handleError(_0x3c4f1f,null));};exports[_0x348c('0x7f')]=function(_0x3c37e3,_0x304e12){return db['MailInteraction'][_0x348c('0x5c')]({'where':{'id':_0x3c37e3[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x304e12,null))['then'](function(_0x3c05a0){if(_0x3c05a0){return _0x3c05a0['addInteraction'](_0x3c37e3[_0x348c('0x5d')][_0x348c('0x80')],_[_0x348c('0x81')](_0x3c37e3[_0x348c('0x5d')],[_0x348c('0x80'),'id'])||{});}})[_0x348c('0x10')](respondWithResult(_0x304e12,null))[_0x348c('0x18')](handleError(_0x304e12,null));};exports[_0x348c('0x82')]=function(_0x3b339f,_0x2c9040){var _0x296694={'raw':![],'where':{}};var _0x2ed5ab={};var _0x4a6197={'count':0x0,'rows':[]};return db[_0x348c('0x44')]['findOne']({'where':{'id':_0x3b339f[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x2c9040,null))[_0x348c('0x10')](function(_0x350d20){if(_0x350d20){_0x2ed5ab[_0x348c('0x4b')]=_[_0x348c('0x49')](db['MailInteraction']['rawAttributes']);_0x2ed5ab[_0x348c('0x4a')]=_['keys'](_0x3b339f[_0x348c('0x4a')]);_0x2ed5ab[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x2ed5ab[_0x348c('0x4b')],_0x2ed5ab[_0x348c('0x4a')]);_0x296694[_0x348c('0x4e')]=_[_0x348c('0x4c')](_0x2ed5ab[_0x348c('0x4b')],qs['fields'](_0x3b339f[_0x348c('0x4a')][_0x348c('0x4d')]));_0x296694[_0x348c('0x4e')]=_0x296694['attributes']['length']?_0x296694['attributes']:_0x2ed5ab[_0x348c('0x4b')];if(!_0x3b339f[_0x348c('0x4a')][_0x348c('0x4f')](_0x348c('0x50'))){_0x296694[_0x348c('0x1f')]=qs['limit'](_0x3b339f[_0x348c('0x4a')][_0x348c('0x1f')]);_0x296694[_0x348c('0x1d')]=qs[_0x348c('0x1d')](_0x3b339f[_0x348c('0x4a')][_0x348c('0x1d')]);}_0x296694[_0x348c('0x83')]=qs['sort'](_0x3b339f[_0x348c('0x4a')]['sort']);_0x296694[_0x348c('0x51')]=qs[_0x348c('0x52')](_[_0x348c('0x68')](_0x3b339f[_0x348c('0x4a')],_0x2ed5ab[_0x348c('0x52')]));_0x296694['where'][_0x348c('0x63')]=_0x350d20['id'];if(_0x3b339f[_0x348c('0x4a')][_0x348c('0x54')]){_0x296694[_0x348c('0x51')]=_['merge'](_0x296694[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x296694[_0x348c('0x4e')],function(_0x4f2fbb){var _0x12b2e9={};_0x12b2e9[_0x4f2fbb]={'$like':'%'+_0x3b339f[_0x348c('0x4a')]['filter']+'%'};return _0x12b2e9;})});}_0x296694=_[_0x348c('0x55')]({},_0x296694,_0x3b339f[_0x348c('0x84')]);return db[_0x348c('0x85')][_0x348c('0x20')]({'where':_0x296694[_0x348c('0x51')]})[_0x348c('0x10')](function(_0x314ae5){_0x4a6197['count']=_0x314ae5;if(_0x3b339f[_0x348c('0x4a')][_0x348c('0x56')]){_0x296694[_0x348c('0x57')]=[{'model':db['CmContact'],'as':_0x348c('0x86'),'required':![]},{'model':db[_0x348c('0x87')],'as':_0x348c('0x88'),'attributes':[_0x348c('0x27'),_0x348c('0x89'),_0x348c('0x8a')],'required':![]},{'model':db[_0x348c('0x8b')],'as':_0x348c('0x8c'),'attributes':['id',_0x348c('0x27'),'color'],'where':_0x3b339f[_0x348c('0x4a')][_0x348c('0x8d')]?{'id':_0x3b339f[_0x348c('0x4a')][_0x348c('0x8d')]}:undefined,'required':_0x3b339f[_0x348c('0x4a')][_0x348c('0x8d')]?!![]:![]}];}return db[_0x348c('0x85')]['findAll'](_0x296694);})[_0x348c('0x10')](function(_0x5afdee){_0x4a6197[_0x348c('0x59')]=_0x5afdee;return _0x4a6197;});}})[_0x348c('0x10')](respondWithFilteredResult(_0x2c9040,_0x296694))[_0x348c('0x18')](handleError(_0x2c9040,null));};exports[_0x348c('0x8e')]=function addApplications(_0x4d082b,_0xba3d67){var _0x586a78=_0x4d082b[_0x348c('0x5a')]['id'];var _0x18ebbb=_0x4d082b['body'];var _0x2d7df4=0xc8;var _0x1a87ce=null;return db[_0x348c('0x8f')]['transaction']({'isolationLevel':db['sequelize'][_0x348c('0x90')][_0x348c('0x91')]['READ_COMMITTED']},function(_0x1089be){return db['MailAccount'][_0x348c('0x6b')]({'where':{'id':_0x586a78},'transaction':_0x1089be})[_0x348c('0x10')](function(_0x427ccf){if(_0x427ccf){return db[_0x348c('0x92')][_0x348c('0x22')]({'where':{'MailAccountId':_0x586a78},'transaction':_0x1089be})['then'](function(){var _0xc91ac8=_[_0x348c('0x43')](_0x18ebbb,function(_0x49d312){_0x49d312[_0x348c('0x63')]=_0x586a78;return _0x49d312;});return db[_0x348c('0x92')][_0x348c('0x93')](_0xc91ac8,{'transaction':_0x1089be});});}else{_0x2d7df4=0x194;_0x1a87ce=[];}});})[_0x348c('0x10')](function(){if(_0x2d7df4!==0x194){return db[_0x348c('0x92')][_0x348c('0x94')]({'where':{'MailAccountId':_0x586a78},'order':_0x348c('0x95')})[_0x348c('0x10')](function(_0x202036){_0x1a87ce=_0x202036;});}})[_0x348c('0x18')](function(_0x5a6d58){_0x2d7df4=0x1f4;logger[_0x348c('0x14')](_0x5a6d58[_0x348c('0x26')]);if(_0x5a6d58[_0x348c('0x27')]){delete _0x5a6d58[_0x348c('0x27')];}_0x1a87ce=_0x5a6d58;})[_0x348c('0x96')](function(){if(_0x1a87ce===null){_0xba3d67[_0x348c('0x19')](_0x2d7df4);}else{if(_0x2d7df4===0x1f4){_0xba3d67[_0x348c('0x1a')](_0x2d7df4)[_0x348c('0x28')](_0x1a87ce);}else{_0xba3d67[_0x348c('0x1a')](_0x2d7df4)[_0x348c('0x1c')](_0x1a87ce);}}});};exports[_0x348c('0x97')]=function(_0x574793,_0x3d9c73){var _0x7e0172={};var _0x4479ad={};var _0x3d7608;var _0x355518;return db['MailAccount']['findOne']({'where':{'id':_0x574793[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x3d9c73,null))[_0x348c('0x10')](function(_0x477d3e){if(_0x477d3e){_0x3d7608=_0x477d3e;_0x4479ad[_0x348c('0x4b')]=_['keys'](db[_0x348c('0x92')][_0x348c('0x45')]);_0x4479ad[_0x348c('0x4a')]=_[_0x348c('0x49')](_0x574793[_0x348c('0x4a')]);_0x4479ad[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x4479ad['model'],_0x4479ad[_0x348c('0x4a')]);_0x7e0172['attributes']=_[_0x348c('0x4c')](_0x4479ad[_0x348c('0x4b')],qs['fields'](_0x574793[_0x348c('0x4a')][_0x348c('0x4d')]));_0x7e0172[_0x348c('0x4e')]=_0x7e0172[_0x348c('0x4e')][_0x348c('0x5b')]?_0x7e0172[_0x348c('0x4e')]:_0x4479ad[_0x348c('0x4b')];_0x7e0172[_0x348c('0x83')]=qs['sort'](_0x574793[_0x348c('0x4a')][_0x348c('0x67')]);_0x7e0172['where']=qs[_0x348c('0x52')](_[_0x348c('0x68')](_0x574793['query'],_0x4479ad[_0x348c('0x52')]));if(_0x574793['query'][_0x348c('0x54')]){_0x7e0172[_0x348c('0x51')]=_[_0x348c('0x55')](_0x7e0172[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x7e0172[_0x348c('0x4e')],function(_0x1bbc4e){var _0x860a2c={};_0x860a2c[_0x1bbc4e]={'$like':'%'+_0x574793[_0x348c('0x4a')][_0x348c('0x54')]+'%'};return _0x860a2c;})});}_0x7e0172=_['merge']({},_0x7e0172,_0x574793[_0x348c('0x84')]);return _0x3d7608[_0x348c('0x97')](_0x7e0172);}})[_0x348c('0x10')](function(_0x2ad1b7){if(_0x2ad1b7){_0x355518=_0x2ad1b7[_0x348c('0x5b')];if(!_0x574793[_0x348c('0x4a')][_0x348c('0x4f')](_0x348c('0x50'))){_0x7e0172['limit']=qs[_0x348c('0x1f')](_0x574793[_0x348c('0x4a')][_0x348c('0x1f')]);_0x7e0172[_0x348c('0x1d')]=qs[_0x348c('0x1d')](_0x574793['query'][_0x348c('0x1d')]);}return _0x3d7608[_0x348c('0x97')](_0x7e0172);}})[_0x348c('0x10')](function(_0x1929d0){if(_0x1929d0){return _0x1929d0?{'count':_0x355518,'rows':_0x1929d0}:null;}})['then'](respondWithResult(_0x3d9c73,null))[_0x348c('0x18')](handleError(_0x3d9c73,null));};exports[_0x348c('0x98')]=function(_0x3084e2,_0x3b3429){var _0x579505={'raw':!![],'where':{}};var _0x2cea7d={};var _0x5503da={'count':0x0,'rows':[]};return db['MailAccount'][_0x348c('0x6b')]({'where':{'id':_0x3084e2[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x3b3429,null))[_0x348c('0x10')](function(_0x1240a9){if(_0x1240a9){_0x2cea7d[_0x348c('0x4b')]=_[_0x348c('0x49')](db[_0x348c('0x99')][_0x348c('0x45')]);_0x2cea7d[_0x348c('0x4a')]=_[_0x348c('0x49')](_0x3084e2['query']);_0x2cea7d[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x2cea7d['model'],_0x2cea7d[_0x348c('0x4a')]);_0x579505[_0x348c('0x4e')]=_[_0x348c('0x4c')](_0x2cea7d['model'],qs[_0x348c('0x4d')](_0x3084e2[_0x348c('0x4a')][_0x348c('0x4d')]));_0x579505['attributes']=_0x579505[_0x348c('0x4e')][_0x348c('0x5b')]?_0x579505['attributes']:_0x2cea7d[_0x348c('0x4b')];if(!_0x3084e2[_0x348c('0x4a')]['hasOwnProperty'](_0x348c('0x50'))){_0x579505[_0x348c('0x1f')]=qs[_0x348c('0x1f')](_0x3084e2[_0x348c('0x4a')][_0x348c('0x1f')]);_0x579505['offset']=qs[_0x348c('0x1d')](_0x3084e2['query']['offset']);}_0x579505[_0x348c('0x83')]=qs[_0x348c('0x67')](_0x3084e2[_0x348c('0x4a')][_0x348c('0x67')]);_0x579505[_0x348c('0x51')]=qs['filters'](_[_0x348c('0x68')](_0x3084e2[_0x348c('0x4a')],_0x2cea7d['filters']));_0x579505['where']['MailAccountId']=_0x1240a9['id'];if(_0x3084e2[_0x348c('0x4a')][_0x348c('0x54')]){_0x579505['where']=_['merge'](_0x579505['where'],{'$or':_[_0x348c('0x43')](_0x579505[_0x348c('0x4e')],function(_0x5f04c9){var _0x44fd26={};_0x44fd26[_0x5f04c9]={'$like':'%'+_0x3084e2[_0x348c('0x4a')][_0x348c('0x54')]+'%'};return _0x44fd26;})});}if(_0x3084e2[_0x348c('0x4a')][_0x348c('0x9a')]){var _0x339c52=_0x3084e2[_0x348c('0x4a')][_0x348c('0x9a')][_0x348c('0x9b')](',');var _0x1d3b92={};_0x1d3b92[_0x339c52[0x0]]={'$gte':moment(_0x339c52[0x1])[_0x348c('0x9c')](_0x348c('0x9d'))};_0x579505[_0x348c('0x51')]=_[_0x348c('0x55')](_0x579505['where'],_0x1d3b92);}_0x579505=_[_0x348c('0x55')]({},_0x579505,_0x3084e2[_0x348c('0x84')]);return db[_0x348c('0x99')][_0x348c('0x20')]({'where':_0x579505[_0x348c('0x51')]})[_0x348c('0x10')](function(_0x53e404){_0x5503da[_0x348c('0x20')]=_0x53e404;if(_0x3084e2[_0x348c('0x4a')][_0x348c('0x56')]){_0x579505[_0x348c('0x57')]=[{'all':!![]}];}return db[_0x348c('0x99')][_0x348c('0x58')](_0x579505);})[_0x348c('0x10')](function(_0x275293){if(_0x3084e2[_0x348c('0x4a')]['inlineCss']===_0x348c('0x9e')){for(var _0x4960e6=0x0;_0x4960e6<_0x275293[_0x348c('0x5b')];_0x4960e6++){_0x275293[_0x4960e6][_0x348c('0x5d')]=juice(_0x275293[_0x4960e6][_0x348c('0x5d')]);}}_0x5503da[_0x348c('0x59')]=_0x275293;return _0x5503da;});}})[_0x348c('0x10')](respondWithFilteredResult(_0x3b3429,_0x579505))[_0x348c('0x18')](handleError(_0x3b3429,null));};exports[_0x348c('0x28')]=function(_0x3964f0,_0x4fc432){var _0x1007fd,_0xdbaf9={},_0xf0f3cb;if(_0x3964f0[_0x348c('0x5d')]['to']){_0xf0f3cb=_0x3964f0['body']['to'][_0x348c('0x9b')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x3964f0[_0x348c('0x5a')]['id']},'include':[{'model':db[_0x348c('0x9f')],'as':'List','include':[{'model':db[_0x348c('0xa0')],'as':_0x348c('0xa1'),'where':{'email':_0xf0f3cb},'limit':0x1,'order':[[_0x348c('0xa2'),_0x348c('0xa3')]]}]},{'model':db[_0x348c('0x40')],'as':_0x348c('0x3d'),'raw':!![],'include':[{'model':db[_0x348c('0xa4')],'as':_0x348c('0xa4'),'raw':!![]}]}]})[_0x348c('0x10')](handleEntityNotFound(_0x4fc432,null))['then'](function(_0x337715){if(!_0x337715)return;_0x1007fd=_0x337715;if(!_0x337715[_0x348c('0x3d')])throw new Error(_0x348c('0xa5'));if(_['isNil'](_0x3964f0['body'][_0x348c('0xa6')])){_0x3964f0['body'][_0x348c('0xa6')]=util['format'](_0x348c('0xa7'),_0x337715['name'],_0x337715[_0x348c('0x6e')]||_0x337715[_0x348c('0x3d')][_0x348c('0x32')]);}if(_0x3964f0[_0x348c('0x5d')]['attachments']&&_0x3964f0[_0x348c('0x5d')][_0x348c('0xa8')][_0x348c('0x5b')]){for(var _0x152d75=0x0;_0x152d75<_0x3964f0[_0x348c('0x5d')][_0x348c('0xa8')][_0x348c('0x5b')];_0x152d75+=0x1){_0x3964f0[_0x348c('0x5d')][_0x348c('0xa8')][_0x152d75]={'filename':_0x3964f0[_0x348c('0x5d')]['attachments'][_0x152d75][_0x348c('0x27')],'path':path[_0x348c('0xa9')](config[_0x348c('0xaa')],_0x348c('0xab'),_0x3964f0[_0x348c('0x5d')][_0x348c('0xa8')][_0x152d75][_0x348c('0xac')])};}}var _0x298648=_0x337715[_0x348c('0xad')]();return respondWithRpcPromise(_0x348c('0xae'),_0x348c('0xaf'),{'account':_0x298648,'message':_0x3964f0[_0x348c('0x5d')]});})[_0x348c('0x10')](function(_0x523c99){if(!_0x523c99)return;_0xdbaf9=_0x523c99;if(!_0x1007fd[_0x348c('0xb0')])throw new Error(_0x348c('0xb1'));if(_0x1007fd[_0x348c('0xb0')]['Contacts'][_0x348c('0x5b')])return _0x1007fd[_0x348c('0xb0')][_0x348c('0xa1')][0x0];return db['CmContact'][_0x348c('0x65')](_[_0x348c('0x7')](_0x3964f0[_0x348c('0x5d')],{'firstName':_0x3964f0[_0x348c('0x5d')]['to'],'email':_0x3964f0['body']['to'],'phone':_0x3964f0[_0x348c('0x5d')]['to'],'ListId':_0x1007fd['ListId']}));})['then'](function(_0x50c434){if(!_0x50c434)return;var _0x325a54={'UserId':_0x3964f0['user']['id'],'ContactId':_0x50c434['id'],'MailAccountId':_0x1007fd['id'],'inReplyTo':_0xdbaf9[_0x348c('0xb2')],'to':_0x3964f0[_0x348c('0x5d')]['from'],'cc':_0x3964f0['body']['cc'],'subject':_0x3964f0[_0x348c('0x5d')][_0x348c('0xb3')],'attach':_0x3964f0[_0x348c('0x5d')][_0x348c('0xb4')],'firstMsgDirection':_0x348c('0xb5'),'lastMsgAt':moment()[_0x348c('0x9c')](_0x348c('0x9d')),'lastMsgDirection':'out','Messages':[_['merge'](_0x3964f0[_0x348c('0x5d')],{'messageId':_0xdbaf9[_0x348c('0xb2')],'sentAt':moment()[_0x348c('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1007fd['id'],'UserId':_0x3964f0[_0x348c('0x32')]['id'],'ContactId':_0x50c434['id']})]};if(_0x3964f0[_0x348c('0x5d')][_0x348c('0xb6')]){_0x325a54=_['merge'](_0x325a54,_0x3964f0[_0x348c('0x5d')]['Interaction']);}return db[_0x348c('0x85')][_0x348c('0x65')](_0x325a54,{'include':[{'model':db['MailMessage'],'as':_0x348c('0xb7')}]});})[_0x348c('0x10')](respondWithResult(_0x4fc432,null))[_0x348c('0x18')](handleError(_0x4fc432,null));};exports[_0x348c('0xb8')]=function(_0x2823ff,_0x123fec){return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x2823ff[_0x348c('0x5a')]['id']},'include':[{'model':db[_0x348c('0x40')],'as':_0x348c('0x3d'),'raw':!![],'include':[{'model':db[_0x348c('0xa4')],'as':_0x348c('0xa4'),'raw':!![]}]}]})[_0x348c('0x10')](handleEntityNotFound(_0x123fec,null))[_0x348c('0x10')](function(_0x2b21a6){if(!_0x2b21a6[_0x348c('0x3d')])return;var _0x191906=_0x2b21a6[_0x348c('0xad')]();return respondWithRpcPromise(_0x348c('0xb9'),_0x348c('0xb8'),{'account':_0x191906});})[_0x348c('0x10')](respondWithResult(_0x123fec,null))['catch'](handleError(_0x123fec,null));};exports[_0x348c('0x22')]=function(_0x56f147,_0x1b36a9){return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x56f147['params']['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x1b36a9,null))[_0x348c('0x10')](function(_0x1f7337){if(_0x1f7337&&_0x1f7337[_0x348c('0xba')]){throw new db['Sequelize']['ValidationError'](_0x348c('0xbb'));}return _0x1f7337;})[_0x348c('0x10')](removeEntity(_0x1b36a9,null))['catch'](handleError(_0x1b36a9,null));};exports[_0x348c('0xbc')]=function(_0x47b7c0,_0x40df52){return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x47b7c0[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x40df52,null))[_0x348c('0x10')](function(_0x56c237){if(_0x56c237){return _0x56c237[_0x348c('0xbc')](_0x47b7c0[_0x348c('0x5d')][_0x348c('0x80')],_[_0x348c('0x81')](_0x47b7c0['body'],['ids','id'])||{})[_0x348c('0xbd')](function(_0x5dfea7){for(var _0x4b965e=0x0;_0x4b965e<_0x47b7c0[_0x348c('0x5d')][_0x348c('0x80')]['length'];_0x4b965e+=0x1){socket[_0x348c('0xbe')](_0x348c('0xbf'),{'UserId':Number(_0x47b7c0[_0x348c('0x5d')][_0x348c('0x80')][_0x4b965e]),'MailAccountId':Number(_0x47b7c0[_0x348c('0x5a')]['id'])});}return _0x5dfea7;});}})[_0x348c('0x10')](respondWithResult(_0x40df52,null))[_0x348c('0x18')](handleError(_0x40df52,null));};exports['removeAgents']=function(_0x2ee53b,_0x231af7){return db[_0x348c('0x44')][_0x348c('0x5c')]({'where':{'id':_0x2ee53b[_0x348c('0x5a')]['id']}})[_0x348c('0x10')](handleEntityNotFound(_0x231af7,null))[_0x348c('0x10')](function(_0x33b490){if(_0x33b490){return _0x33b490['removeAgents'](_0x2ee53b[_0x348c('0x4a')][_0x348c('0x80')])[_0x348c('0x10')](function(){if(_['isArray'](_0x2ee53b[_0x348c('0x4a')][_0x348c('0x80')])){for(var _0x2c2477=0x0;_0x2c2477<_0x2ee53b['query'][_0x348c('0x80')][_0x348c('0x5b')];_0x2c2477+=0x1){socket['emit'](_0x348c('0xc0'),{'UserId':Number(_0x2ee53b['query'][_0x348c('0x80')][_0x2c2477]),'MailAccountId':Number(_0x2ee53b['params']['id'])});}}else{socket[_0x348c('0xbe')](_0x348c('0xc0'),{'UserId':Number(_0x2ee53b[_0x348c('0x4a')][_0x348c('0x80')]),'MailAccountId':Number(_0x2ee53b[_0x348c('0x5a')]['id'])});}});}})[_0x348c('0x10')](respondWithStatusCode(_0x231af7,null))[_0x348c('0x18')](handleError(_0x231af7,null));};exports[_0x348c('0xc1')]=function(_0x2ea8e2,_0x1f3acc){var _0x37084e={};var _0x29c46d={};var _0x591690;var _0x421594;return db['MailAccount'][_0x348c('0x6b')]({'where':{'id':_0x2ea8e2[_0x348c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f3acc,null))['then'](function(_0xc158f7){if(_0xc158f7){_0x591690=_0xc158f7;_0x29c46d['model']=_[_0x348c('0x49')](db['User']['rawAttributes']);_0x29c46d[_0x348c('0x4a')]=_[_0x348c('0x49')](_0x2ea8e2[_0x348c('0x4a')]);_0x29c46d[_0x348c('0x52')]=_[_0x348c('0x4c')](_0x29c46d[_0x348c('0x4b')],_0x29c46d[_0x348c('0x4a')]);_0x37084e['attributes']=_[_0x348c('0x4c')](_0x29c46d[_0x348c('0x4b')],qs['fields'](_0x2ea8e2['query'][_0x348c('0x4d')]));_0x37084e[_0x348c('0x4e')]=_0x37084e['attributes'][_0x348c('0x5b')]?_0x37084e['attributes']:_0x29c46d[_0x348c('0x4b')];_0x37084e['order']=qs[_0x348c('0x67')](_0x2ea8e2[_0x348c('0x4a')][_0x348c('0x67')]);_0x37084e[_0x348c('0x51')]=qs[_0x348c('0x52')](_[_0x348c('0x68')](_0x2ea8e2[_0x348c('0x4a')],_0x29c46d[_0x348c('0x52')]));if(_0x2ea8e2[_0x348c('0x4a')][_0x348c('0x54')]){_0x37084e[_0x348c('0x51')]=_[_0x348c('0x55')](_0x37084e[_0x348c('0x51')],{'$or':_[_0x348c('0x43')](_0x37084e[_0x348c('0x4e')],function(_0x30d765){var _0x12a692={};_0x12a692[_0x30d765]={'$like':'%'+_0x2ea8e2[_0x348c('0x4a')][_0x348c('0x54')]+'%'};return _0x12a692;})});}_0x37084e=_[_0x348c('0x55')]({},_0x37084e,_0x2ea8e2[_0x348c('0x84')]);return _0x591690['getAgents'](_0x37084e);}})[_0x348c('0x10')](function(_0x5128ad){if(_0x5128ad){_0x421594=_0x5128ad[_0x348c('0x5b')];if(!_0x2ea8e2[_0x348c('0x4a')][_0x348c('0x4f')]('nolimit')){_0x37084e[_0x348c('0x1f')]=qs['limit'](_0x2ea8e2[_0x348c('0x4a')]['limit']);_0x37084e[_0x348c('0x1d')]=qs[_0x348c('0x1d')](_0x2ea8e2[_0x348c('0x4a')][_0x348c('0x1d')]);}return _0x591690[_0x348c('0xc1')](_0x37084e);}})['then'](function(_0x52b8a2){if(_0x52b8a2){return _0x52b8a2?{'count':_0x421594,'rows':_0x52b8a2}:null;}})[_0x348c('0x10')](respondWithResult(_0x1f3acc,null))[_0x348c('0x18')](handleError(_0x1f3acc,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7456cbd..f4a036b 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 _0xe528=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe528,0x167));var _0x8e52=function(_0x52f6aa,_0xa297cc){_0x52f6aa=_0x52f6aa-0x0;var _0x30de4b=_0xe528[_0x52f6aa];return _0x30de4b;};'use strict';var EventEmitter=require(_0x8e52('0x0'));var MailAccount=require(_0x8e52('0x1'))['db'][_0x8e52('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8e52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e52('0x4'),'afterDestroy':_0x8e52('0x5')};function emitEvent(_0x4dfac1){return function(_0x23b7e4,_0x3321b5,_0x1856dd){MailAccountEvents[_0x8e52('0x6')](_0x4dfac1+':'+_0x23b7e4['id'],_0x23b7e4);MailAccountEvents[_0x8e52('0x6')](_0x4dfac1,_0x23b7e4);_0x1856dd(null);};}for(var e in events){if(events[_0x8e52('0x7')](e)){var event=events[e];MailAccount[_0x8e52('0x8')](e,emitEvent(event));}}module[_0x8e52('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x4bc7=['hook','exports','MailAccount','setMaxListeners','remove','emit'];(function(_0x3773ec,_0x41de27){var _0xf4adab=function(_0x22dd40){while(--_0x22dd40){_0x3773ec['push'](_0x3773ec['shift']());}};_0xf4adab(++_0x41de27);}(_0x4bc7,0x188));var _0x74bc=function(_0x25da9f,_0x47d72c){_0x25da9f=_0x25da9f-0x0;var _0x447588=_0x4bc7[_0x25da9f];return _0x447588;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x74bc('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x74bc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x74bc('0x2')};function emitEvent(_0x5b08d0){return function(_0x249871,_0x3089fb,_0x2eee2f){MailAccountEvents['emit'](_0x5b08d0+':'+_0x249871['id'],_0x249871);MailAccountEvents[_0x74bc('0x3')](_0x5b08d0,_0x249871);_0x2eee2f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x74bc('0x4')](e,emitEvent(event));}}module[_0x74bc('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b88d3d8..5102c73 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 _0x2cf3=['exports','define','MailAccount','mail_accounts','provider','host','Smtp','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','pass','./mailAccount.attributes'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2cf3,0x87));var _0x32cf=function(_0x1d9ebd,_0x5d2079){_0x1d9ebd=_0x1d9ebd-0x0;var _0x1abdce=_0x2cf3[_0x1d9ebd];return _0x1abdce;};'use strict';var attributes=require(_0x32cf('0x0'));module[_0x32cf('0x1')]=function(_0x318593){return _0x318593[_0x32cf('0x2')](_0x32cf('0x3'),attributes,{'tableName':_0x32cf('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e71b7=this;var _0x4a1cbd={'id':_0x2e71b7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e71b7[_0x32cf('0x5')]!=='custom'){_0x4a1cbd['service']=_0x2e71b7['provider'];}else{_0x4a1cbd[_0x32cf('0x6')]=_0x2e71b7[_0x32cf('0x7')][_0x32cf('0x6')];_0x4a1cbd[_0x32cf('0x8')]=_0x2e71b7[_0x32cf('0x7')][_0x32cf('0x8')];_0x4a1cbd[_0x32cf('0x9')]=_0x2e71b7['Smtp']['secure'];}if(_0x2e71b7[_0x32cf('0x7')][_0x32cf('0xa')]){if(_0x2e71b7[_0x32cf('0x7')]['modernAuthentication']){if(!_0x2e71b7[_0x32cf('0x7')]['CloudProvider'])throw new Error(_0x32cf('0xb'));_0x4a1cbd[_0x32cf('0xc')]={'type':_0x32cf('0xd'),'user':_0x2e71b7[_0x32cf('0x7')]['user'],'accessToken':_0x2e71b7[_0x32cf('0x7')]['CloudProvider'][_0x32cf('0xe')]};}else{_0x4a1cbd[_0x32cf('0xc')]={'user':_0x2e71b7[_0x32cf('0x7')][_0x32cf('0xf')],'pass':_0x2e71b7[_0x32cf('0x7')][_0x32cf('0x10')]};}}return _0x4a1cbd;}}});}; \ No newline at end of file +var _0xadbd=['define','MailAccount','mail_accounts','provider','custom','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','CloudProvider','data5','user','pass','./mailAccount.attributes','exports'];(function(_0x47bd9a,_0x2abd94){var _0x141294=function(_0x19500d){while(--_0x19500d){_0x47bd9a['push'](_0x47bd9a['shift']());}};_0x141294(++_0x2abd94);}(_0xadbd,0xb2));var _0xdadb=function(_0xf85033,_0xf4089b){_0xf85033=_0xf85033-0x0;var _0xb12234=_0xadbd[_0xf85033];return _0xb12234;};'use strict';var attributes=require(_0xdadb('0x0'));module[_0xdadb('0x1')]=function(_0x2223b0){return _0x2223b0[_0xdadb('0x2')](_0xdadb('0x3'),attributes,{'tableName':_0xdadb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x516d4f=this;var _0x4c2771={'id':_0x516d4f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x516d4f[_0xdadb('0x5')]!==_0xdadb('0x6')){_0x4c2771['service']=_0x516d4f[_0xdadb('0x5')];}else{_0x4c2771[_0xdadb('0x7')]=_0x516d4f[_0xdadb('0x8')][_0xdadb('0x7')];_0x4c2771[_0xdadb('0x9')]=_0x516d4f[_0xdadb('0x8')][_0xdadb('0x9')];_0x4c2771[_0xdadb('0xa')]=_0x516d4f[_0xdadb('0x8')][_0xdadb('0xa')];}if(_0x516d4f[_0xdadb('0x8')][_0xdadb('0xb')]){if(_0x516d4f[_0xdadb('0x8')][_0xdadb('0xc')]){if(!_0x516d4f[_0xdadb('0x8')]['CloudProvider'])throw new Error(_0xdadb('0xd'));_0x4c2771[_0xdadb('0xe')]={'type':_0xdadb('0xf'),'user':_0x516d4f['Smtp']['user'],'accessToken':_0x516d4f[_0xdadb('0x8')][_0xdadb('0x10')][_0xdadb('0x11')]};}else{_0x4c2771[_0xdadb('0xe')]={'user':_0x516d4f[_0xdadb('0x8')][_0xdadb('0x12')],'pass':_0x516d4f[_0xdadb('0x8')][_0xdadb('0x13')]};}}return _0x4c2771;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 11daa24..bb1d4bc 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 _0xfc65=['startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','list','priority','asc','push','length','close','autoclose','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start'];(function(_0x465116,_0x232f8d){var _0x5d0894=function(_0x44f1d5){while(--_0x44f1d5){_0x465116['push'](_0x465116['shift']());}};_0x5d0894(++_0x232f8d);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x55b1a8,_0x588ed6){_0x55b1a8=_0x55b1a8-0x0;var _0x523b26=_0xfc65[_0x55b1a8];return _0x523b26;};'use strict';var _=require(_0x5fc6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fc6('0x1'));var Redis=require(_0x5fc6('0x2'));var db=require(_0x5fc6('0x3'))['db'];var logger=require(_0x5fc6('0x4'))(_0x5fc6('0x5'));var config=require(_0x5fc6('0x6'));var jayson=require(_0x5fc6('0x7'));var client=jayson[_0x5fc6('0x8')][_0x5fc6('0x9')]({'port':0x232c});config[_0x5fc6('0xa')]=_[_0x5fc6('0xb')](config[_0x5fc6('0xa')],{'host':_0x5fc6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fc6('0xa')]));require(_0x5fc6('0xd'))[_0x5fc6('0xe')](socket);function respondWithRpcPromise(_0x3d9a11,_0x16c285,_0xbc3db9){return new BPromise(function(_0x23c4e2,_0x27cad8){return client[_0x5fc6('0xf')](_0x3d9a11,_0xbc3db9)[_0x5fc6('0x10')](function(_0x4cc207){logger[_0x5fc6('0x11')]('MailAccount,\x20%s,\x20%s',_0x16c285,_0x5fc6('0x12'));logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x16c285,_0x5fc6('0x12'),JSON['stringify'](_0x4cc207));if(_0x4cc207[_0x5fc6('0x15')]){if(_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x16')]===0x1f4){logger[_0x5fc6('0x15')](_0x5fc6('0x17'),_0x16c285,_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x18')]);return _0x27cad8(_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x18')]);}logger[_0x5fc6('0x15')]('MailAccount,\x20%s,\x20%s',_0x16c285,_0x4cc207['error'][_0x5fc6('0x18')]);return _0x23c4e2(_0x4cc207[_0x5fc6('0x15')]['message']);}else{logger[_0x5fc6('0x11')](_0x5fc6('0x17'),_0x16c285,_0x5fc6('0x12'));_0x23c4e2(_0x4cc207[_0x5fc6('0x19')][_0x5fc6('0x18')]);}})[_0x5fc6('0x1a')](function(_0x569bbc){logger[_0x5fc6('0x15')](_0x5fc6('0x17'),_0x16c285,_0x569bbc);_0x27cad8(_0x569bbc);});});}exports[_0x5fc6('0x1b')]=function(_0xad2ccb){var _0x5c76e7=this;return new Promise(function(_0xafe3a8,_0x1d2bd1){return db[_0x5fc6('0x1c')][_0x5fc6('0x1d')]({'raw':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x1f')]===undefined?!![]:![]:!![],'where':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x20')]||null:null,'attributes':_0xad2ccb['options']?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x21')]||null:null,'limit':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x22')]||null:null,'include':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x23')]?_['map'](_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x23')],function(_0x1db1f0){return{'model':db[_0x1db1f0[_0x5fc6('0x24')]],'as':_0x1db1f0['as'],'attributes':_0x1db1f0[_0x5fc6('0x21')],'include':_0x1db1f0[_0x5fc6('0x23')]?_['map'](_0x1db1f0[_0x5fc6('0x23')],function(_0xd31fa1){return{'model':db[_0xd31fa1['model']],'as':_0xd31fa1['as'],'attributes':_0xd31fa1[_0x5fc6('0x21')],'include':_0xd31fa1[_0x5fc6('0x23')]?_[_0x5fc6('0x25')](_0xd31fa1[_0x5fc6('0x23')],function(_0x2abeeb){return{'model':db[_0x2abeeb['model']],'as':_0x2abeeb['as'],'attributes':_0x2abeeb[_0x5fc6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fc6('0x10')](function(_0x21066b){logger[_0x5fc6('0x11')](_0x5fc6('0x1b'),_0xad2ccb);logger[_0x5fc6('0x13')](_0x5fc6('0x1b'),_0xad2ccb,JSON[_0x5fc6('0x26')](_0x21066b));_0xafe3a8(_0x21066b);})[_0x5fc6('0x1a')](function(_0x57502b){logger[_0x5fc6('0x15')]('GetMailAccount',_0x57502b[_0x5fc6('0x18')],_0xad2ccb);_0x1d2bd1(_0x5c76e7[_0x5fc6('0x15')](0x1f4,_0x57502b[_0x5fc6('0x18')]));});});};exports[_0x5fc6('0x27')]=function(_0x331c2b){var _0x479e96=this;return new Promise(function(_0x1dbb8c,_0x330f9b){return db[_0x5fc6('0x1c')][_0x5fc6('0x28')]({'raw':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x1f')]===undefined?!![]:![]:!![],'where':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b['options'][_0x5fc6('0x20')]||null:null,'attributes':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b['options']['attributes']||null:null,'include':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b[_0x5fc6('0x1e')]['include']?_[_0x5fc6('0x25')](_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x23')],function(_0x1a3f21){return{'model':db[_0x1a3f21['model']],'as':_0x1a3f21['as'],'attributes':_0x1a3f21['attributes'],'include':_0x1a3f21[_0x5fc6('0x23')]?_[_0x5fc6('0x25')](_0x1a3f21['include'],function(_0x58552a){return{'model':db[_0x58552a[_0x5fc6('0x24')]],'as':_0x58552a['as'],'attributes':_0x58552a[_0x5fc6('0x21')],'include':_0x58552a['include']?_[_0x5fc6('0x25')](_0x58552a['include'],function(_0x2f95ba){return{'model':db[_0x2f95ba[_0x5fc6('0x24')]],'as':_0x2f95ba['as'],'attributes':_0x2f95ba[_0x5fc6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fc6('0x10')](function(_0x51fe4f){if(_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x29')]===!![])_0x51fe4f[_0x5fc6('0x2a')](_0x5fc6('0x2b'),_0x51fe4f[_0x5fc6('0x2c')]());logger[_0x5fc6('0x11')]('ShowMailAccount',_0x331c2b);logger[_0x5fc6('0x13')]('ShowMailAccount',_0x331c2b,JSON[_0x5fc6('0x26')](_0x51fe4f));_0x1dbb8c(_0x51fe4f);})[_0x5fc6('0x1a')](function(_0x5df9d3){logger[_0x5fc6('0x15')](_0x5fc6('0x27'),_0x5df9d3['message'],_0x331c2b);_0x330f9b(_0x479e96['error'](0x1f4,_0x5df9d3[_0x5fc6('0x18')]));});});};exports[_0x5fc6('0x2d')]=function(_0xb5492a){var _0x3883a9=this;return new Promise(function(_0x370bc4,_0x1b6d1a){var _0x43b764={'body':_0xb5492a[_0x5fc6('0x2e')],'channel':_0x5fc6('0x2f')};var _0x1b72a3=_[_0x5fc6('0x30')](_['keys'](db[_0x5fc6('0x31')][_0x5fc6('0x32')]),[_0x5fc6('0x33'),_0x5fc6('0x34'),_0x5fc6('0x35'),'ListId']);var _0x56dd97=![];if(_0xb5492a['body']['id']){delete _0xb5492a[_0x5fc6('0x2e')]['id'];}if(_[_0x5fc6('0x36')](_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x37')])){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x38')));}if(_[_0x5fc6('0x36')](_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')])||_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')]===''){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x39')));}if(_['isNil'](_0xb5492a['body']['mapKey'])){return _0x1b6d1a(_0x3883a9[_0x5fc6('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b72a3));}if(!_[_0x5fc6('0x3a')](_0x1b72a3,_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x3b')])){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x3c')+_0x1b72a3));}var _0x58ecb1={};_0x58ecb1[_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x3b')]]=_0xb5492a['body'][_0x5fc6('0x37')];return db['MailAccount'][_0x5fc6('0x28')]({'where':{'id':_0xb5492a[_0x5fc6('0x3d')]['id']},'include':[{'model':db[_0x5fc6('0x3e')],'as':_0x5fc6('0x3f'),'include':[{'model':db['CmContact'],'as':_0x5fc6('0x40'),'where':_0x58ecb1,'limit':0x1,'order':[[_0x5fc6('0x34'),_0x5fc6('0x41')]]}]},{'model':db[_0x5fc6('0x42')],'as':'Applications'},{'model':db[_0x5fc6('0x43')],'as':_0x5fc6('0x44'),'include':[{'model':db[_0x5fc6('0x45')],'as':_0x5fc6('0x45')}]}]})[_0x5fc6('0x10')](function(_0x298151){if(_0x298151&&_0x298151[_0x5fc6('0x3f')]){var _0x49eb58=_0x298151[_0x5fc6('0x46')]({'plain':!![]});_0x43b764[_0x5fc6('0x3d')]=_[_0x5fc6('0x47')](_0x49eb58,['Applications',_0x5fc6('0x3f')]);_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x2b')]=_0x298151[_0x5fc6('0x2c')]();_0x43b764[_0x5fc6('0x48')]=_0x49eb58[_0x5fc6('0x49')];_0x43b764[_0x5fc6('0x4a')]=_0x49eb58[_0x5fc6('0x3f')];_0x43b764[_0x5fc6('0x48')]=_['orderBy'](_0x43b764[_0x5fc6('0x48')],[_0x5fc6('0x4b')],[_0x5fc6('0x4c')]);if(_0x43b764[_0x5fc6('0x3d')]&&_0x43b764[_0x5fc6('0x3d')]['autoclose']){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x4d')]({'id':0x0,'priority':_0x43b764['applications'][_0x5fc6('0x4e')]+0x1,'app':_0x5fc6('0x4f'),'appdata':_0x5fc6('0x50'),'interval':_0x5fc6('0x51')});}if(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x49')]){delete _0x43b764[_0x5fc6('0x3d')]['Applications'];}if(_0x43b764['account']['List']){delete _0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x3f')];}if(_0x49eb58[_0x5fc6('0x3f')]['Contacts'][_0x5fc6('0x4e')]){return _0x49eb58[_0x5fc6('0x3f')]['Contacts'][0x0];}var _0x1415df=_[_0x5fc6('0xb')](_0xb5492a[_0x5fc6('0x2e')],{'firstName':_0xb5492a['body'][_0x5fc6('0x37')],'ListId':_0x49eb58[_0x5fc6('0x52')]});_0x1415df[_0xb5492a['body'][_0x5fc6('0x3b')]]=_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x37')];return db[_0x5fc6('0x31')][_0x5fc6('0x53')](_0x1415df);}else{throw new Error(_0x5fc6('0x54'));}})[_0x5fc6('0x10')](function(_0x3bd2aa){_0x43b764[_0x5fc6('0x55')]=_0x3bd2aa;if(_0x3bd2aa){if(!_0xb5492a['body']['message']['messageId']){_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x56')]=rs[_0x5fc6('0x57')]()+'\x20'+_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x37')];}var _0x25b097={'ContactId':_0x3bd2aa['id'],'MailAccountId':_0xb5492a[_0x5fc6('0x3d')]['id'],'inReplyTo':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['messageId'],'to':_0xb5492a['body']['message']['from'],'cc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['cc'],'subject':_0xb5492a['body'][_0x5fc6('0x18')]['subject'],'attach':_0xb5492a['body']['message'][_0x5fc6('0x58')],'lastMsgAt':moment()['format'](_0x5fc6('0x59')),'lastMsgDirection':'in'};return db[_0x5fc6('0x5a')][_0x5fc6('0x28')]({'where':{'closed':![],'MailAccountId':_0xb5492a['account']['id']},'include':[{'model':db[_0x5fc6('0x5b')],'as':_0x5fc6('0x5c'),'attributes':[_0x5fc6('0x56')],'where':{'messageId':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x5d')]}}]})[_0x5fc6('0x10')](function(_0x385923){if(_0x385923){return[_0x385923,![]];}return db[_0x5fc6('0x5a')][_0x5fc6('0x53')](_0x25b097)[_0x5fc6('0x10')](function(_0x3dfa9e){return[_0x3dfa9e,!![]];});});}else{throw new Error(_0x5fc6('0x5e'));}})[_0x5fc6('0x5f')](function(_0x176db6,_0x3f9a6e){if(_0x176db6){_0x56dd97=_0x3f9a6e;if(!_0x3f9a6e){return _0x176db6[_0x5fc6('0x60')]({'inReplyTo':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x56')],'to':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x37')],'cc':_0xb5492a[_0x5fc6('0x2e')]['message']['cc'],'subject':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x61')],'attach':_0x176db6[_0x5fc6('0x58')]?_0x176db6[_0x5fc6('0x58')]:_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x58')],'substatus':null,'substatusAt':moment()[_0x5fc6('0x62')](_0x5fc6('0x59')),'lastMsgAt':moment()[_0x5fc6('0x62')](_0x5fc6('0x59')),'lastMsgDirection':'in'});}else{return _0x176db6;}}})['then'](function(_0xd32e0c){_0x43b764[_0x5fc6('0x63')]=_0xd32e0c[_0x5fc6('0x46')]({'plain':!![]});_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x64')]=_0x56dd97;return db['MailMessage'][_0x5fc6('0x53')]({'body':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')],'MailAccountId':_0xb5492a['account']['id'],'MailInteractionId':_0xd32e0c['id'],'direction':'in','ContactId':_0x43b764[_0x5fc6('0x55')]['id'],'messageId':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x56')],'from':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x37')],'to':_0xb5492a[_0x5fc6('0x2e')]['message']['to'],'cc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['cc'],'subject':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['subject'],'attach':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x58')],'Attachments':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x65')],'originTo':_0xb5492a[_0x5fc6('0x2e')]['message']['originTo'],'originCc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x66')],'bcc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['bcc'],'ChatWebsiteId':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x67')]||null,'originChannel':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x68')]||_0x5fc6('0x69'),'ChatOfflineMessageId':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x6a')]||null},{'include':[{'model':db[_0x5fc6('0x6b')],'as':_0x5fc6('0x6c')}]});})[_0x5fc6('0x10')](function(_0x2fc0c5){_0x43b764[_0x5fc6('0x18')]=_0x2fc0c5;if(!_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x6d')]){return;}return db[_0x5fc6('0x6e')][_0x5fc6('0x28')]({'attributes':['id',_0x5fc6('0x6f')],'where':{'id':_0x43b764['interaction'][_0x5fc6('0x6d')]}});})['then'](function(_0x5b6492){if(_0x5b6492){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x70')]({'id':0x0,'priority':0x0,'app':_0x5fc6('0x71'),'appdata':_0x5b6492[_0x5fc6('0x6f')]+','+(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x72')]||0xa),'interval':_0x5fc6('0x51')});}if(!_0x43b764['interaction'][_0x5fc6('0x73')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x73')]}});})[_0x5fc6('0x10')](function(_0x77b4ab){if(_0x77b4ab){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x70')]({'id':0x0,'priority':0x1,'app':_0x5fc6('0x74'),'appdata':_0x77b4ab['name']+','+(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x75')]||0x12c),'interval':_0x5fc6('0x51')});}return respondWithRpcPromise(_0x5fc6('0x76'),_0x5fc6('0x77'),_0x43b764);})['then'](function(_0x5dfab6){_0x370bc4(_0x5dfab6);})[_0x5fc6('0x1a')](function(_0x3282bc){_0x1b6d1a(_0x3883a9['error'](0x1f4,_0x3282bc['message']));});});}; \ No newline at end of file +var _0x31c2=['Applications','MailServerOut','CloudProvider','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','contact','messageId','generate','attach','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','debug','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication'];(function(_0x18b1be,_0x185237){var _0x4a4224=function(_0x4be7cd){while(--_0x4be7cd){_0x18b1be['push'](_0x18b1be['shift']());}};_0x4a4224(++_0x185237);}(_0x31c2,0x1e1));var _0x231c=function(_0x3ffa89,_0x3304db){_0x3ffa89=_0x3ffa89-0x0;var _0x72f747=_0x31c2[_0x3ffa89];return _0x72f747;};'use strict';var _=require(_0x231c('0x0'));var moment=require(_0x231c('0x1'));var BPromise=require(_0x231c('0x2'));var rs=require(_0x231c('0x3'));var Redis=require(_0x231c('0x4'));var db=require(_0x231c('0x5'))['db'];var logger=require(_0x231c('0x6'))(_0x231c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x231c('0x8')][_0x231c('0x9')]({'port':0x232c});config[_0x231c('0xa')]=_[_0x231c('0xb')](config['redis'],{'host':_0x231c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x231c('0xa')]));require(_0x231c('0xd'))[_0x231c('0xe')](socket);function respondWithRpcPromise(_0x55fa3a,_0x2524bf,_0x3cffb0){return new BPromise(function(_0x1e390f,_0x23841c){return client[_0x231c('0xf')](_0x55fa3a,_0x3cffb0)[_0x231c('0x10')](function(_0x10b80f){logger['info'](_0x231c('0x11'),_0x2524bf,_0x231c('0x12'));logger['debug'](_0x231c('0x13'),_0x2524bf,_0x231c('0x12'),JSON[_0x231c('0x14')](_0x10b80f));if(_0x10b80f[_0x231c('0x15')]){if(_0x10b80f[_0x231c('0x15')][_0x231c('0x16')]===0x1f4){logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);return _0x23841c(_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);}logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);return _0x1e390f(_0x10b80f[_0x231c('0x15')][_0x231c('0x17')]);}else{logger[_0x231c('0x18')](_0x231c('0x11'),_0x2524bf,'request\x20sent');_0x1e390f(_0x10b80f[_0x231c('0x19')][_0x231c('0x17')]);}})[_0x231c('0x1a')](function(_0xadea80){logger[_0x231c('0x15')](_0x231c('0x11'),_0x2524bf,_0xadea80);_0x23841c(_0xadea80);});});}exports[_0x231c('0x1b')]=function(_0x172d50){var _0x2890e3=this;return new Promise(function(_0x1c9c85,_0x5f045f){return db[_0x231c('0x1c')]['findAll']({'raw':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x1e')]===undefined?!![]:![]:!![],'where':_0x172d50[_0x231c('0x1d')]?_0x172d50[_0x231c('0x1d')][_0x231c('0x1f')]||null:null,'attributes':_0x172d50[_0x231c('0x1d')]?_0x172d50[_0x231c('0x1d')][_0x231c('0x20')]||null:null,'limit':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x21')]||null:null,'include':_0x172d50[_0x231c('0x1d')]?_0x172d50['options'][_0x231c('0x22')]?_[_0x231c('0x23')](_0x172d50['options'][_0x231c('0x22')],function(_0x564939){return{'model':db[_0x564939[_0x231c('0x24')]],'as':_0x564939['as'],'attributes':_0x564939[_0x231c('0x20')],'include':_0x564939[_0x231c('0x22')]?_[_0x231c('0x23')](_0x564939[_0x231c('0x22')],function(_0x131cfd){return{'model':db[_0x131cfd[_0x231c('0x24')]],'as':_0x131cfd['as'],'attributes':_0x131cfd['attributes'],'include':_0x131cfd[_0x231c('0x22')]?_[_0x231c('0x23')](_0x131cfd['include'],function(_0x3a0ca4){return{'model':db[_0x3a0ca4[_0x231c('0x24')]],'as':_0x3a0ca4['as'],'attributes':_0x3a0ca4[_0x231c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x231c('0x10')](function(_0x271635){logger[_0x231c('0x18')](_0x231c('0x1b'),_0x172d50);logger['debug'](_0x231c('0x1b'),_0x172d50,JSON[_0x231c('0x14')](_0x271635));_0x1c9c85(_0x271635);})['catch'](function(_0x4be2e2){logger['error'](_0x231c('0x1b'),_0x4be2e2['message'],_0x172d50);_0x5f045f(_0x2890e3[_0x231c('0x15')](0x1f4,_0x4be2e2['message']));});});};exports[_0x231c('0x25')]=function(_0x35a956){var _0x6fb073=this;return new Promise(function(_0x5380e0,_0x534cfe){return db[_0x231c('0x1c')][_0x231c('0x26')]({'raw':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x1e')]===undefined?!![]:![]:!![],'where':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x1f')]||null:null,'attributes':_0x35a956['options']?_0x35a956['options'][_0x231c('0x20')]||null:null,'include':_0x35a956[_0x231c('0x1d')]?_0x35a956[_0x231c('0x1d')][_0x231c('0x22')]?_[_0x231c('0x23')](_0x35a956[_0x231c('0x1d')]['include'],function(_0x382c12){return{'model':db[_0x382c12[_0x231c('0x24')]],'as':_0x382c12['as'],'attributes':_0x382c12['attributes'],'include':_0x382c12['include']?_[_0x231c('0x23')](_0x382c12['include'],function(_0x1fe30b){return{'model':db[_0x1fe30b['model']],'as':_0x1fe30b['as'],'attributes':_0x1fe30b[_0x231c('0x20')],'include':_0x1fe30b[_0x231c('0x22')]?_['map'](_0x1fe30b[_0x231c('0x22')],function(_0x433952){return{'model':db[_0x433952[_0x231c('0x24')]],'as':_0x433952['as'],'attributes':_0x433952['attributes']};}):[]};}):[]};}):[]:[]})[_0x231c('0x10')](function(_0xf413f9){if(_0x35a956[_0x231c('0x1d')][_0x231c('0x27')]===!![])_0xf413f9[_0x231c('0x28')](_0x231c('0x29'),_0xf413f9[_0x231c('0x2a')]());logger[_0x231c('0x18')](_0x231c('0x25'),_0x35a956);logger[_0x231c('0x2b')](_0x231c('0x25'),_0x35a956,JSON[_0x231c('0x14')](_0xf413f9));_0x5380e0(_0xf413f9);})[_0x231c('0x1a')](function(_0x486cab){logger[_0x231c('0x15')](_0x231c('0x25'),_0x486cab[_0x231c('0x17')],_0x35a956);_0x534cfe(_0x6fb073[_0x231c('0x15')](0x1f4,_0x486cab[_0x231c('0x17')]));});});};exports['NotifyMailAccount']=function(_0x41ce86){var _0x3b62bc=this;return new Promise(function(_0x229953,_0x52b9dc){var _0x1e8521={'body':_0x41ce86[_0x231c('0x2c')],'channel':_0x231c('0x2d')};var _0x37f0f6=_[_0x231c('0x2e')](_[_0x231c('0x2f')](db['CmContact'][_0x231c('0x30')]),[_0x231c('0x31'),_0x231c('0x32'),_0x231c('0x33'),'ListId']);var _0x33396b=![];if(_0x41ce86['body']['id']){delete _0x41ce86[_0x231c('0x2c')]['id'];}if(_['isNil'](_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x231c('0x35')));}if(_[_0x231c('0x36')](_0x41ce86[_0x231c('0x2c')]['body'])||_0x41ce86[_0x231c('0x2c')][_0x231c('0x2c')]===''){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x231c('0x36')](_0x41ce86[_0x231c('0x2c')][_0x231c('0x37')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37f0f6));}if(!_[_0x231c('0x38')](_0x37f0f6,_0x41ce86['body'][_0x231c('0x37')])){return _0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x231c('0x39')+_0x37f0f6));}var _0x436907={};_0x436907[_0x41ce86[_0x231c('0x2c')][_0x231c('0x37')]]=_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')];return db[_0x231c('0x1c')][_0x231c('0x26')]({'where':{'id':_0x41ce86[_0x231c('0x3a')]['id']},'include':[{'model':db[_0x231c('0x3b')],'as':_0x231c('0x3c'),'include':[{'model':db[_0x231c('0x3d')],'as':'Contacts','where':_0x436907,'limit':0x1,'order':[[_0x231c('0x32'),_0x231c('0x3e')]]}]},{'model':db[_0x231c('0x3f')],'as':_0x231c('0x40')},{'model':db[_0x231c('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x231c('0x42')}]}]})['then'](function(_0x419f63){if(_0x419f63&&_0x419f63[_0x231c('0x3c')]){var _0x1ef2e7=_0x419f63['get']({'plain':!![]});_0x1e8521[_0x231c('0x3a')]=_['omit'](_0x1ef2e7,[_0x231c('0x40'),_0x231c('0x3c')]);_0x1e8521['account'][_0x231c('0x29')]=_0x419f63[_0x231c('0x2a')]();_0x1e8521[_0x231c('0x43')]=_0x1ef2e7['Applications'];_0x1e8521['list']=_0x1ef2e7['List'];_0x1e8521[_0x231c('0x43')]=_[_0x231c('0x44')](_0x1e8521[_0x231c('0x43')],['priority'],[_0x231c('0x45')]);if(_0x1e8521[_0x231c('0x3a')]&&_0x1e8521[_0x231c('0x3a')][_0x231c('0x46')]){_0x1e8521[_0x231c('0x43')][_0x231c('0x47')]({'id':0x0,'priority':_0x1e8521[_0x231c('0x43')][_0x231c('0x48')]+0x1,'app':_0x231c('0x49'),'appdata':_0x231c('0x46'),'interval':_0x231c('0x4a')});}if(_0x1e8521['account'][_0x231c('0x40')]){delete _0x1e8521[_0x231c('0x3a')]['Applications'];}if(_0x1e8521[_0x231c('0x3a')]['List']){delete _0x1e8521[_0x231c('0x3a')][_0x231c('0x3c')];}if(_0x1ef2e7[_0x231c('0x3c')][_0x231c('0x4b')][_0x231c('0x48')]){return _0x1ef2e7[_0x231c('0x3c')][_0x231c('0x4b')][0x0];}var _0x12fdcd=_[_0x231c('0xb')](_0x41ce86[_0x231c('0x2c')],{'firstName':_0x41ce86['body'][_0x231c('0x34')],'ListId':_0x1ef2e7[_0x231c('0x4c')]});_0x12fdcd[_0x41ce86[_0x231c('0x2c')]['mapKey']]=_0x41ce86[_0x231c('0x2c')][_0x231c('0x34')];return db['CmContact'][_0x231c('0x4d')](_0x12fdcd);}else{throw new Error('List\x20not\x20found');}})[_0x231c('0x10')](function(_0x1f119c){_0x1e8521[_0x231c('0x4e')]=_0x1f119c;if(_0x1f119c){if(!_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['messageId']){_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x4f')]=rs[_0x231c('0x50')]()+'\x20'+_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x34')];}var _0x4eddb2={'ContactId':_0x1f119c['id'],'MailAccountId':_0x41ce86['account']['id'],'inReplyTo':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x4f')],'to':_0x41ce86['body'][_0x231c('0x17')]['from'],'cc':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['cc'],'subject':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['subject'],'attach':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x51')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x231c('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x41ce86[_0x231c('0x3a')]['id']},'include':[{'model':db[_0x231c('0x53')],'as':'Messages','attributes':[_0x231c('0x4f')],'where':{'messageId':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x54')]}}]})[_0x231c('0x10')](function(_0x334dac){if(_0x334dac){return[_0x334dac,![]];}return db['MailInteraction']['create'](_0x4eddb2)['then'](function(_0x111b8d){return[_0x111b8d,!![]];});});}else{throw new Error(_0x231c('0x55'));}})[_0x231c('0x56')](function(_0x1e77ca,_0xb72644){if(_0x1e77ca){_0x33396b=_0xb72644;if(!_0xb72644){return _0x1e77ca['update']({'inReplyTo':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x4f')],'to':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x34')],'cc':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['cc'],'subject':_0x41ce86[_0x231c('0x2c')]['message']['subject'],'attach':_0x1e77ca['attach']?_0x1e77ca[_0x231c('0x51')]:_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x51')],'substatus':null,'substatusAt':moment()[_0x231c('0x57')](_0x231c('0x58')),'lastMsgAt':moment()[_0x231c('0x57')](_0x231c('0x58')),'lastMsgDirection':'in'});}else{return _0x1e77ca;}}})[_0x231c('0x10')](function(_0x4d20fc){_0x1e8521[_0x231c('0x59')]=_0x4d20fc[_0x231c('0x5a')]({'plain':!![]});_0x1e8521[_0x231c('0x59')]['created']=_0x33396b;return db[_0x231c('0x53')][_0x231c('0x4d')]({'body':_0x41ce86[_0x231c('0x2c')]['body'],'MailAccountId':_0x41ce86[_0x231c('0x3a')]['id'],'MailInteractionId':_0x4d20fc['id'],'direction':'in','ContactId':_0x1e8521[_0x231c('0x4e')]['id'],'messageId':_0x41ce86['body']['message'][_0x231c('0x4f')],'from':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x34')],'to':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['to'],'cc':_0x41ce86[_0x231c('0x2c')]['message']['cc'],'subject':_0x41ce86['body'][_0x231c('0x17')]['subject'],'attach':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['attach'],'Attachments':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')]['attachments'],'originTo':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x5b')],'originCc':_0x41ce86[_0x231c('0x2c')]['message'][_0x231c('0x5c')],'bcc':_0x41ce86['body'][_0x231c('0x17')][_0x231c('0x5d')],'ChatWebsiteId':_0x41ce86['body'][_0x231c('0x17')]['ChatWebsiteId']||null,'originChannel':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x5e')]||_0x231c('0x5f'),'ChatOfflineMessageId':_0x41ce86[_0x231c('0x2c')][_0x231c('0x17')][_0x231c('0x60')]||null},{'include':[{'model':db[_0x231c('0x61')],'as':_0x231c('0x62')}]});})[_0x231c('0x10')](function(_0x1a60c7){_0x1e8521[_0x231c('0x17')]=_0x1a60c7;if(!_0x1e8521[_0x231c('0x59')][_0x231c('0x63')]){return;}return db[_0x231c('0x64')][_0x231c('0x26')]({'attributes':['id',_0x231c('0x65')],'where':{'id':_0x1e8521[_0x231c('0x59')][_0x231c('0x63')]}});})[_0x231c('0x10')](function(_0x14ec8f){if(_0x14ec8f){_0x1e8521[_0x231c('0x43')][_0x231c('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x14ec8f[_0x231c('0x65')]+','+(_0x1e8521['account'][_0x231c('0x67')]||0xa),'interval':_0x231c('0x4a')});}if(!_0x1e8521[_0x231c('0x59')][_0x231c('0x68')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1e8521[_0x231c('0x59')][_0x231c('0x68')]}});})['then'](function(_0x430f7a){if(_0x430f7a){_0x1e8521[_0x231c('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':_0x231c('0x69'),'appdata':_0x430f7a['name']+','+(_0x1e8521[_0x231c('0x3a')][_0x231c('0x6a')]||0x12c),'interval':_0x231c('0x4a')});}return respondWithRpcPromise(_0x231c('0x6b'),_0x231c('0x6c'),_0x1e8521);})['then'](function(_0x4f8f3b){_0x229953(_0x4f8f3b);})[_0x231c('0x1a')](function(_0x1bad18){_0x52b9dc(_0x3b62bc[_0x231c('0x15')](0x1f4,_0x1bad18['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ce6be0c..8b9c1b8 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 _0xa2b8=['register','length','mailAccount:','./mailAccount.events','update','emit'];(function(_0x492f16,_0x1c46c7){var _0x3883f2=function(_0x5aae03){while(--_0x5aae03){_0x492f16['push'](_0x492f16['shift']());}};_0x3883f2(++_0x1c46c7);}(_0xa2b8,0x14d));var _0x8a2b=function(_0xb253b2,_0x4556c5){_0xb253b2=_0xb253b2-0x0;var _0x4aa0d2=_0xa2b8[_0xb253b2];return _0x4aa0d2;};'use strict';var MailAccountEvents=require(_0x8a2b('0x0'));var events=['save','remove',_0x8a2b('0x1')];function createListener(_0x531a15,_0x3cbaf5){return function(_0x323c7a){_0x3cbaf5[_0x8a2b('0x2')](_0x531a15,_0x323c7a);};}function removeListener(_0x27a7de,_0x35a30f){return function(){MailAccountEvents['removeListener'](_0x27a7de,_0x35a30f);};}exports[_0x8a2b('0x3')]=function(_0x781afa){for(var _0x1391cb=0x0,_0x3a1915=events[_0x8a2b('0x4')];_0x1391cb<_0x3a1915;_0x1391cb++){var _0x1dd08c=events[_0x1391cb];var _0x1dc4b1=createListener(_0x8a2b('0x5')+_0x1dd08c,_0x781afa);MailAccountEvents['on'](_0x1dd08c,_0x1dc4b1);}}; \ No newline at end of file +var _0x33d0=['mailAccount:','./mailAccount.events','save','remove','update','emit','length'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x33d0,0x7f));var _0x033d=function(_0x177db3,_0x25697a){_0x177db3=_0x177db3-0x0;var _0x28e0d0=_0x33d0[_0x177db3];return _0x28e0d0;};'use strict';var MailAccountEvents=require(_0x033d('0x0'));var events=[_0x033d('0x1'),_0x033d('0x2'),_0x033d('0x3')];function createListener(_0x2df372,_0x33181a){return function(_0x2158eb){_0x33181a[_0x033d('0x4')](_0x2df372,_0x2158eb);};}function removeListener(_0x103dd2,_0x5a5afd){return function(){MailAccountEvents['removeListener'](_0x103dd2,_0x5a5afd);};}exports['register']=function(_0x53006f){for(var _0x429d66=0x0,_0x30df3c=events[_0x033d('0x5')];_0x429d66<_0x30df3c;_0x429d66++){var _0x568ee6=events[_0x429d66];var _0x420d03=createListener(_0x033d('0x6')+_0x568ee6,_0x53006f);MailAccountEvents['on'](_0x568ee6,_0x420d03);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7429af1..8500b5e 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 _0xfddf=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','destroy'];(function(_0x3792bd,_0x547e1f){var _0x5465e4=function(_0x5e8a3b){while(--_0x5e8a3b){_0x3792bd['push'](_0x3792bd['shift']());}};_0x5465e4(++_0x547e1f);}(_0xfddf,0x89));var _0xffdd=function(_0x366189,_0x1263d6){_0x366189=_0x366189-0x0;var _0x4abb78=_0xfddf[_0x366189];return _0x4abb78;};'use strict';var multer=require(_0xffdd('0x0'));var util=require(_0xffdd('0x1'));var path=require(_0xffdd('0x2'));var timeout=require(_0xffdd('0x3'));var express=require(_0xffdd('0x4'));var router=express[_0xffdd('0x5')]();var fs_extra=require(_0xffdd('0x6'));var auth=require(_0xffdd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xffdd('0x8'));var controller=require(_0xffdd('0x9'));router[_0xffdd('0xa')](_0xffdd('0xb'),auth[_0xffdd('0xc')](),controller[_0xffdd('0xd')]);router['put'](_0xffdd('0xb'),auth['isAuthenticated'](),controller[_0xffdd('0xe')]);router['delete'](_0xffdd('0xb'),auth['isAuthenticated'](),controller[_0xffdd('0xf')]);module[_0xffdd('0x10')]=router; \ No newline at end of file +var _0x7778=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express'];(function(_0xef6c6a,_0x2f7369){var _0x4bdc83=function(_0x2227a0){while(--_0x2227a0){_0xef6c6a['push'](_0xef6c6a['shift']());}};_0x4bdc83(++_0x2f7369);}(_0x7778,0xf7));var _0x8777=function(_0x5e28d6,_0x458ab1){_0x5e28d6=_0x5e28d6-0x0;var _0x21197c=_0x7778[_0x5e28d6];return _0x21197c;};'use strict';var multer=require(_0x8777('0x0'));var util=require(_0x8777('0x1'));var path=require(_0x8777('0x2'));var timeout=require(_0x8777('0x3'));var express=require(_0x8777('0x4'));var router=express[_0x8777('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8777('0x6'));var interaction=require(_0x8777('0x7'));var config=require(_0x8777('0x8'));var controller=require(_0x8777('0x9'));router[_0x8777('0xa')](_0x8777('0xb'),auth[_0x8777('0xc')](),controller['show']);router['put'](_0x8777('0xb'),auth[_0x8777('0xc')](),controller['update']);router['delete'](_0x8777('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8777('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f3397b0..3dd679b 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 _0xf959=['sequelize','INTEGER','STRING'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xf959,0x1bf));var _0x9f95=function(_0x2a71d2,_0x35bcda){_0x2a71d2=_0x2a71d2-0x0;var _0x200112=_0xf959[_0x2a71d2];return _0x200112;};'use strict';var Sequelize=require(_0x9f95('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f95('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9f95('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1a85=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x33572b,_0x1a616a){var _0x512ee2=function(_0x19899a){while(--_0x19899a){_0x33572b['push'](_0x33572b['shift']());}};_0x512ee2(++_0x1a616a);}(_0x1a85,0x178));var _0x51a8=function(_0x12699c,_0xf9dd49){_0x12699c=_0x12699c-0x0;var _0x54360e=_0x1a85[_0x12699c];return _0x54360e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x51a8('0x1')],'allowNull':![],'defaultValue':_0x51a8('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x51a8('0x1')],'defaultValue':_0x51a8('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bf916a9..a4dfda3 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2e69fb,_0x4359e3){_0x2e69fb=_0x2e69fb-0x0;var _0x4d2404=_0xbdb7[_0x2e69fb];return _0x4d2404;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4cac57,_0x4db8b1){var _0x1a348c=function(_0x263c3e){while(--_0x263c3e){_0x4cac57['push'](_0x4cac57['shift']());}};_0x1a348c(++_0x4db8b1);}(_0x54ef,0x112));var _0xf54e=function(_0x3f4f33,_0x179374){_0x3f4f33=_0x3f4f33-0x0;var _0x4c4fd9=_0x54ef[_0x3f4f33];return _0x4c4fd9;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ba68102..0ca7bba 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 _0x42ff=['utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x59486a,_0x2ac89a){var _0x25b9b9=function(_0x2c7b08){while(--_0x2c7b08){_0x59486a['push'](_0x59486a['shift']());}};_0x25b9b9(++_0x2ac89a);}(_0x42ff,0x9d));var _0xf42f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x42ff[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf42f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf42f('0x1'));var moment=require(_0xf42f('0x2'));var BPromise=require(_0xf42f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf42f('0x4'));var rimraf=require(_0xf42f('0x5'));var config=require(_0xf42f('0x6'));var attributes=require(_0xf42f('0x7'));module[_0xf42f('0x8')]=function(_0x2909e9,_0xc70900){return _0x2909e9[_0xf42f('0x9')](_0xf42f('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf42f('0xb')});}; \ No newline at end of file +var _0x8f3d=['lodash','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4cc4f7,_0x57370b){var _0x1b9d72=function(_0x2a3216){while(--_0x2a3216){_0x4cc4f7['push'](_0x4cc4f7['shift']());}};_0x1b9d72(++_0x57370b);}(_0x8f3d,0x12c));var _0xd8f3=function(_0x2c5637,_0x372d39){_0x2c5637=_0x2c5637-0x0;var _0x211b5b=_0x8f3d[_0x2c5637];return _0x211b5b;};'use strict';var _=require(_0xd8f3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8f3('0x1'));var fs=require('fs');var path=require(_0xd8f3('0x2'));var rimraf=require(_0xd8f3('0x3'));var config=require(_0xd8f3('0x4'));var attributes=require(_0xd8f3('0x5'));module[_0xd8f3('0x6')]=function(_0x25236c,_0x49c8c6){return _0x25236c[_0xd8f3('0x7')](_0xd8f3('0x8'),attributes,{'tableName':_0xd8f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd8f3('0xa'),'collate':_0xd8f3('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 13da9c8..cc2d095 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 _0xe3aa=['MailApplication','body','options','where','limit','UpdateMailApplication','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x380da5,_0x368448){var _0xa24fd5=function(_0xfe0007){while(--_0xfe0007){_0x380da5['push'](_0x380da5['shift']());}};_0xa24fd5(++_0x368448);}(_0xe3aa,0x132));var _0xae3a=function(_0x3408f9,_0x222b7c){_0x3408f9=_0x3408f9-0x0;var _0x15a3c4=_0xe3aa[_0x3408f9];return _0x15a3c4;};'use strict';var _=require('lodash');var util=require(_0xae3a('0x0'));var moment=require(_0xae3a('0x1'));var BPromise=require(_0xae3a('0x2'));var rs=require(_0xae3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae3a('0x4'))['db'];var utils=require(_0xae3a('0x5'));var logger=require(_0xae3a('0x6'))(_0xae3a('0x7'));var config=require('../../config/environment');var jayson=require(_0xae3a('0x8'));var client=jayson[_0xae3a('0x9')][_0xae3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f60f0,_0x32f059,_0x4c34c1){return new BPromise(function(_0x1b31e3,_0x347a02){return client[_0xae3a('0xb')](_0x4f60f0,_0x4c34c1)[_0xae3a('0xc')](function(_0x37d716){logger[_0xae3a('0xd')]('MailApplication,\x20%s,\x20%s',_0x32f059,'request\x20sent');logger[_0xae3a('0xe')](_0xae3a('0xf'),_0x32f059,_0xae3a('0x10'),JSON[_0xae3a('0x11')](_0x37d716));if(_0x37d716[_0xae3a('0x12')]){if(_0x37d716[_0xae3a('0x12')][_0xae3a('0x13')]===0x1f4){logger[_0xae3a('0x12')](_0xae3a('0x14'),_0x32f059,_0x37d716[_0xae3a('0x12')][_0xae3a('0x15')]);return _0x347a02(_0x37d716[_0xae3a('0x12')][_0xae3a('0x15')]);}logger[_0xae3a('0x12')](_0xae3a('0x14'),_0x32f059,_0x37d716[_0xae3a('0x12')][_0xae3a('0x15')]);return _0x1b31e3(_0x37d716[_0xae3a('0x12')][_0xae3a('0x15')]);}else{logger[_0xae3a('0xd')]('MailApplication,\x20%s,\x20%s',_0x32f059,_0xae3a('0x10'));_0x1b31e3(_0x37d716[_0xae3a('0x16')][_0xae3a('0x15')]);}})[_0xae3a('0x17')](function(_0x573bab){logger[_0xae3a('0x12')](_0xae3a('0x14'),_0x32f059,_0x573bab);_0x347a02(_0x573bab);});});}exports['UpdateMailApplication']=function(_0x33baaf){var _0x501365=this;return new Promise(function(_0x5d95d1,_0x3835c3){return db[_0xae3a('0x18')]['update'](_0x33baaf[_0xae3a('0x19')],{'raw':_0x33baaf[_0xae3a('0x1a')]?_0x33baaf[_0xae3a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33baaf[_0xae3a('0x1a')]?_0x33baaf[_0xae3a('0x1a')][_0xae3a('0x1b')]||null:null,'attributes':_0x33baaf[_0xae3a('0x1a')]?_0x33baaf[_0xae3a('0x1a')]['attributes']||null:null,'limit':_0x33baaf[_0xae3a('0x1a')]?_0x33baaf[_0xae3a('0x1a')][_0xae3a('0x1c')]||null:null})[_0xae3a('0xc')](function(_0x516f4e){logger[_0xae3a('0xd')]('UpdateMailApplication',_0x33baaf);logger[_0xae3a('0xe')](_0xae3a('0x1d'),_0x33baaf,JSON[_0xae3a('0x11')](_0x516f4e));_0x5d95d1(_0x516f4e);})[_0xae3a('0x17')](function(_0x40433e){logger[_0xae3a('0x12')]('UpdateMailApplication',_0x40433e[_0xae3a('0x15')],_0x33baaf);_0x3835c3(_0x501365['error'](0x1f4,_0x40433e[_0xae3a('0x15')]));});});}; \ No newline at end of file +var _0x841a=['body','options','raw','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UpdateMailApplication','MailApplication','update'];(function(_0x35ecb0,_0x59ecbb){var _0x42ca64=function(_0x25083b){while(--_0x25083b){_0x35ecb0['push'](_0x35ecb0['shift']());}};_0x42ca64(++_0x59ecbb);}(_0x841a,0x1e1));var _0xa841=function(_0x5e6a7a,_0xc4d9ae){_0x5e6a7a=_0x5e6a7a-0x0;var _0x750ddc=_0x841a[_0x5e6a7a];return _0x750ddc;};'use strict';var _=require(_0xa841('0x0'));var util=require(_0xa841('0x1'));var moment=require('moment');var BPromise=require(_0xa841('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa841('0x3'));var logger=require(_0xa841('0x4'))(_0xa841('0x5'));var config=require('../../config/environment');var jayson=require(_0xa841('0x6'));var client=jayson[_0xa841('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e041f,_0x323285,_0xecbe0d){return new BPromise(function(_0x2c03d4,_0x537b6d){return client['request'](_0x4e041f,_0xecbe0d)[_0xa841('0x8')](function(_0x134c86){logger['info'](_0xa841('0x9'),_0x323285,_0xa841('0xa'));logger[_0xa841('0xb')](_0xa841('0xc'),_0x323285,_0xa841('0xa'),JSON[_0xa841('0xd')](_0x134c86));if(_0x134c86['error']){if(_0x134c86['error'][_0xa841('0xe')]===0x1f4){logger[_0xa841('0xf')](_0xa841('0x9'),_0x323285,_0x134c86['error'][_0xa841('0x10')]);return _0x537b6d(_0x134c86[_0xa841('0xf')][_0xa841('0x10')]);}logger[_0xa841('0xf')](_0xa841('0x9'),_0x323285,_0x134c86['error'][_0xa841('0x10')]);return _0x2c03d4(_0x134c86[_0xa841('0xf')][_0xa841('0x10')]);}else{logger[_0xa841('0x11')](_0xa841('0x9'),_0x323285,_0xa841('0xa'));_0x2c03d4(_0x134c86[_0xa841('0x12')][_0xa841('0x10')]);}})[_0xa841('0x13')](function(_0x45a5a3){logger[_0xa841('0xf')](_0xa841('0x9'),_0x323285,_0x45a5a3);_0x537b6d(_0x45a5a3);});});}exports[_0xa841('0x14')]=function(_0x3d6dd2){var _0x4424c6=this;return new Promise(function(_0x4e7a40,_0x2a647d){return db[_0xa841('0x15')][_0xa841('0x16')](_0x3d6dd2[_0xa841('0x17')],{'raw':_0x3d6dd2[_0xa841('0x18')]?_0x3d6dd2['options'][_0xa841('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6dd2[_0xa841('0x18')]?_0x3d6dd2[_0xa841('0x18')]['where']||null:null,'attributes':_0x3d6dd2['options']?_0x3d6dd2[_0xa841('0x18')][_0xa841('0x1a')]||null:null,'limit':_0x3d6dd2[_0xa841('0x18')]?_0x3d6dd2[_0xa841('0x18')][_0xa841('0x1b')]||null:null})[_0xa841('0x8')](function(_0x55e9fe){logger[_0xa841('0x11')](_0xa841('0x14'),_0x3d6dd2);logger[_0xa841('0xb')](_0xa841('0x14'),_0x3d6dd2,JSON[_0xa841('0xd')](_0x55e9fe));_0x4e7a40(_0x55e9fe);})[_0xa841('0x13')](function(_0x5b5cc9){logger[_0xa841('0xf')](_0xa841('0x14'),_0x5b5cc9[_0xa841('0x10')],_0x3d6dd2);_0x2a647d(_0x4424c6[_0xa841('0xf')](0x1f4,_0x5b5cc9[_0xa841('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ea5a9b2..869010d 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 _0x947c=['mail','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x145480,_0x5d46c2){var _0x5d0753=function(_0x57567d){while(--_0x57567d){_0x145480['push'](_0x145480['shift']());}};_0x5d0753(++_0x5d46c2);}(_0x947c,0x14a));var _0xc947=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x947c[_0x2ae2ad];return _0x26dbd7;};'use strict';var express=require(_0xc947('0x0'));var router=express['Router']();var auth=require(_0xc947('0x1'));var interaction=require(_0xc947('0x2'));var controller=require(_0xc947('0x3'));router[_0xc947('0x4')]('/',auth[_0xc947('0x5')](),controller[_0xc947('0x6')]);router[_0xc947('0x4')](_0xc947('0x7'),auth[_0xc947('0x5')](),controller[_0xc947('0x8')]);router['get'](_0xc947('0x9'),auth[_0xc947('0x5')](),controller[_0xc947('0xa')]);router[_0xc947('0x4')](_0xc947('0xb'),auth[_0xc947('0x5')](),controller[_0xc947('0xc')]);router[_0xc947('0x4')](_0xc947('0xd'),auth[_0xc947('0x5')](),controller[_0xc947('0xe')]);router[_0xc947('0xf')]('/',auth['isAuthenticated'](),controller[_0xc947('0x10')]);router[_0xc947('0xf')](_0xc947('0xb'),auth['isAuthenticated'](),controller[_0xc947('0x11')]);router['post']('/:id/tags',auth[_0xc947('0x5')](),interaction['tracked'](_0xc947('0x12'),_0xc947('0x13')),controller[_0xc947('0x14')]);router['put'](_0xc947('0x9'),auth[_0xc947('0x5')](),interaction[_0xc947('0x15')](_0xc947('0x12'),_0xc947('0x16')),controller[_0xc947('0x17')]);router['delete']('/:id',auth[_0xc947('0x5')](),interaction[_0xc947('0x15')](_0xc947('0x12'),_0xc947('0x18')),controller[_0xc947('0x19')]);router['delete'](_0xc947('0x1a'),auth[_0xc947('0x5')](),controller[_0xc947('0x1b')]);module[_0xc947('0x1c')]=router; \ No newline at end of file +var _0x02b7=['mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','destroy','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x02b7,0x13e));var _0x702b=function(_0x28d2fa,_0x5630fe){_0x28d2fa=_0x28d2fa-0x0;var _0x183bde=_0x02b7[_0x28d2fa];return _0x183bde;};'use strict';var express=require('express');var router=express[_0x702b('0x0')]();var auth=require(_0x702b('0x1'));var interaction=require(_0x702b('0x2'));var controller=require(_0x702b('0x3'));router[_0x702b('0x4')]('/',auth[_0x702b('0x5')](),controller[_0x702b('0x6')]);router[_0x702b('0x4')](_0x702b('0x7'),auth['isAuthenticated'](),controller[_0x702b('0x8')]);router[_0x702b('0x4')](_0x702b('0x9'),auth[_0x702b('0x5')](),controller[_0x702b('0xa')]);router[_0x702b('0x4')](_0x702b('0xb'),auth[_0x702b('0x5')](),controller[_0x702b('0xc')]);router[_0x702b('0x4')](_0x702b('0xd'),auth[_0x702b('0x5')](),controller[_0x702b('0xe')]);router['post']('/',auth[_0x702b('0x5')](),controller[_0x702b('0xf')]);router[_0x702b('0x10')](_0x702b('0xb'),auth['isAuthenticated'](),controller['addMessage']);router[_0x702b('0x10')](_0x702b('0x11'),auth[_0x702b('0x5')](),interaction['tracked'](_0x702b('0x12'),_0x702b('0x13')),controller[_0x702b('0x14')]);router[_0x702b('0x15')](_0x702b('0x9'),auth[_0x702b('0x5')](),interaction[_0x702b('0x16')](_0x702b('0x12'),_0x702b('0x17')),controller[_0x702b('0x18')]);router[_0x702b('0x19')](_0x702b('0x9'),auth[_0x702b('0x5')](),interaction[_0x702b('0x16')](_0x702b('0x12'),'mailinteraction:destroy'),controller[_0x702b('0x1a')]);router['delete'](_0x702b('0x11'),auth[_0x702b('0x5')](),controller['removeTags']);module[_0x702b('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 9f90e54..bcd8827 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 _0xe06c=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','INTEGER'];(function(_0x135188,_0x1afd71){var _0x371f9e=function(_0x48a4bf){while(--_0x48a4bf){_0x135188['push'](_0x135188['shift']());}};_0x371f9e(++_0x1afd71);}(_0xe06c,0x1d9));var _0xce06=function(_0x5be6c3,_0xb930ec){_0x5be6c3=_0x5be6c3-0x0;var _0x11aeb7=_0xe06c[_0x5be6c3];return _0x11aeb7;};'use strict';var Sequelize=require(_0xce06('0x0'));var iconv=require(_0xce06('0x1'));module[_0xce06('0x2')]={'closed':{'type':Sequelize[_0xce06('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce06('0x4')]},'disposition':{'type':Sequelize[_0xce06('0x5')]},'secondDisposition':{'type':Sequelize[_0xce06('0x5')]},'thirdDisposition':{'type':Sequelize[_0xce06('0x5')]},'note':{'type':Sequelize[_0xce06('0x5')]},'inReplyTo':{'type':Sequelize[_0xce06('0x5')](0x1fe)},'to':{'type':Sequelize[_0xce06('0x5')]},'cc':{'type':Sequelize['TEXT'](_0xce06('0x6'))},'subject':{'type':Sequelize[_0xce06('0x7')]()},'attach':{'type':Sequelize[_0xce06('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xce06('0x4')]},'substatus':{'type':Sequelize[_0xce06('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xce06('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xce06('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce06('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xce06('0x8')]('in',_0xce06('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xce06('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xce06('0xa')]}}; \ No newline at end of file +var _0xde7a=['out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x13b751,_0x328583){var _0x22d062=function(_0x3fc5e3){while(--_0x3fc5e3){_0x13b751['push'](_0x13b751['shift']());}};_0x22d062(++_0x328583);}(_0xde7a,0x1a9));var _0xade7=function(_0x562596,_0x531979){_0x562596=_0x562596-0x0;var _0x146954=_0xde7a[_0x562596];return _0x146954;};'use strict';var Sequelize=require(_0xade7('0x0'));var iconv=require(_0xade7('0x1'));module[_0xade7('0x2')]={'closed':{'type':Sequelize[_0xade7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xade7('0x4')]},'disposition':{'type':Sequelize[_0xade7('0x5')]},'secondDisposition':{'type':Sequelize[_0xade7('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xade7('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xade7('0x5')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xade7('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xade7('0x4')]},'substatus':{'type':Sequelize[_0xade7('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xade7('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xade7('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xade7('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xade7('0x6')]('in',_0xade7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xade7('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xade7('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b14e4e6..bfc2c39 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 _0x4606=['send','index','map','MailInteraction','type','key','getOptions','findAll','mail','query','user','catch','show','model','keys','intersection','fields','length','includeAll','include','options','create','body','update','find','params','describe','addMessage','omit','ids','getMessages','findOne','MailMessage','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','MailInteractionId','merge','filter','$gte','split','format','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','from','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','then','destroy','stack','name'];(function(_0x103d17,_0x4830d3){var _0x513ff6=function(_0x9ec229){while(--_0x9ec229){_0x103d17['push'](_0x103d17['shift']());}};_0x513ff6(++_0x4830d3);}(_0x4606,0x146));var _0x6460=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4606[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x6460('0x0'));var rimraf=require(_0x6460('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x6460('0x2'));var util=require(_0x6460('0x3'));var path=require(_0x6460('0x4'));var fs=require('fs');var _=require(_0x6460('0x5'));var juice=require('juice');var Redis=require(_0x6460('0x6'));var interaction=require(_0x6460('0x7'));var qs=require(_0x6460('0x8'));var logger=require(_0x6460('0x9'))(_0x6460('0xa'));var config=require(_0x6460('0xb'));var db=require(_0x6460('0xc'))['db'];var htmlEntities=require(_0x6460('0xd'));config[_0x6460('0xe')]=_[_0x6460('0xf')](config[_0x6460('0xe')],{'host':_0x6460('0x10'),'port':0x18eb});var socket=require(_0x6460('0x11'))(new Redis(config[_0x6460('0xe')]));require(_0x6460('0x12'))[_0x6460('0x13')](socket);function respondWithStatusCode(_0x25f672,_0x48cdae){_0x48cdae=_0x48cdae||0xcc;return function(_0x145e8d){if(_0x145e8d){return _0x25f672[_0x6460('0x14')](_0x48cdae);}return _0x25f672[_0x6460('0x15')](_0x48cdae)[_0x6460('0x16')]();};}function respondWithResult(_0x9883aa,_0x476e10){_0x476e10=_0x476e10||0xc8;return function(_0x551ac5){if(_0x551ac5){return _0x9883aa[_0x6460('0x15')](_0x476e10)['json'](_0x551ac5);}};}function respondWithFilteredResult(_0x445f0e,_0x3157db){return function(_0x423d93){if(_0x423d93){var _0x22adf2=typeof _0x3157db['offset']===_0x6460('0x17')&&typeof _0x3157db[_0x6460('0x18')]==='undefined';var _0x4faa4d=_0x423d93[_0x6460('0x19')];var _0x1ad522=_0x22adf2?0x0:_0x3157db[_0x6460('0x1a')];var _0xae2e48=_0x22adf2?_0x423d93[_0x6460('0x19')]:_0x3157db[_0x6460('0x1a')]+_0x3157db[_0x6460('0x18')];var _0x3a0735;if(_0xae2e48>=_0x4faa4d){_0xae2e48=_0x4faa4d;_0x3a0735=0xc8;}else{_0x3a0735=0xce;}_0x445f0e[_0x6460('0x15')](_0x3a0735);return _0x445f0e[_0x6460('0x1b')](_0x6460('0x1c'),_0x1ad522+'-'+_0xae2e48+'/'+_0x4faa4d)[_0x6460('0x1d')](_0x423d93);}return null;};}function saveUpdates(_0x29cce6){return function(_0x1aac47){if(_0x1aac47){return _0x1aac47['update'](_0x29cce6)[_0x6460('0x1e')](function(_0x1d1286){return _0x1d1286;});}return null;};}function removeEntity(_0x14dde1){return function(_0x3042e3){if(_0x3042e3){return _0x3042e3[_0x6460('0x1f')]()[_0x6460('0x1e')](function(){_0x14dde1[_0x6460('0x15')](0xcc)[_0x6460('0x16')]();});}};}function handleEntityNotFound(_0x552f8a){return function(_0x1b380d){if(!_0x1b380d){_0x552f8a[_0x6460('0x14')](0x194);}return _0x1b380d;};}function handleError(_0x452115,_0x1878bd){_0x1878bd=_0x1878bd||0x1f4;return function(_0x35d70e){logger['error'](_0x35d70e[_0x6460('0x20')]);if(_0x35d70e[_0x6460('0x21')]){delete _0x35d70e[_0x6460('0x21')];}_0x452115[_0x6460('0x15')](_0x1878bd)[_0x6460('0x22')](_0x35d70e);};}exports[_0x6460('0x23')]=function(_0x7ef130,_0x277753){var _0x2d732f={};var _0x5c4687=_[_0x6460('0x24')](db[_0x6460('0x25')]['rawAttributes'],function(_0x43f02c){return{'name':_0x43f02c['fieldName'],'type':_0x43f02c[_0x6460('0x26')][_0x6460('0x27')]};});_0x2d732f=qs[_0x6460('0x28')](_0x5c4687,_0x7ef130);return interaction[_0x6460('0x29')](_0x6460('0x2a'),_0x7ef130[_0x6460('0x2b')],_0x7ef130[_0x6460('0x2c')],_0x2d732f,_0x5c4687)[_0x6460('0x1e')](respondWithFilteredResult(_0x277753,_0x2d732f))[_0x6460('0x2d')](handleError(_0x277753,null));};exports[_0x6460('0x2e')]=function(_0x25a4a0,_0x36712d){var _0x1f6937={'raw':![],'where':{'id':_0x25a4a0['params']['id']}},_0x1fff47={};_0x1fff47[_0x6460('0x2f')]=_[_0x6460('0x30')](db[_0x6460('0x25')]['rawAttributes']);_0x1fff47[_0x6460('0x2b')]=_[_0x6460('0x30')](_0x25a4a0[_0x6460('0x2b')]);_0x1fff47['filters']=_[_0x6460('0x31')](_0x1fff47['model'],_0x1fff47[_0x6460('0x2b')]);_0x1f6937['attributes']=_[_0x6460('0x31')](_0x1fff47[_0x6460('0x2f')],qs[_0x6460('0x32')](_0x25a4a0[_0x6460('0x2b')][_0x6460('0x32')]));_0x1f6937['attributes']=_0x1f6937['attributes'][_0x6460('0x33')]?_0x1f6937['attributes']:_0x1fff47[_0x6460('0x2f')];if(_0x25a4a0[_0x6460('0x2b')][_0x6460('0x34')]){_0x1f6937[_0x6460('0x35')]=[{'all':!![]}];}_0x1f6937=_['merge']({},_0x1f6937,_0x25a4a0[_0x6460('0x36')]);return db[_0x6460('0x25')]['find'](_0x1f6937)[_0x6460('0x1e')](handleEntityNotFound(_0x36712d,null))[_0x6460('0x1e')](respondWithResult(_0x36712d,null))[_0x6460('0x2d')](handleError(_0x36712d,null));};exports['create']=function(_0x3dc843,_0x4f8b2b){return db[_0x6460('0x25')][_0x6460('0x37')](_0x3dc843[_0x6460('0x38')],{})[_0x6460('0x1e')](respondWithResult(_0x4f8b2b,0xc9))[_0x6460('0x2d')](handleError(_0x4f8b2b,null));};exports[_0x6460('0x39')]=function(_0x3cf4de,_0x45865b){if(_0x3cf4de[_0x6460('0x38')]['id']){delete _0x3cf4de[_0x6460('0x38')]['id'];}return db[_0x6460('0x25')][_0x6460('0x3a')]({'where':{'id':_0x3cf4de[_0x6460('0x3b')]['id']}})['then'](handleEntityNotFound(_0x45865b,null))[_0x6460('0x1e')](saveUpdates(_0x3cf4de[_0x6460('0x38')],null))[_0x6460('0x1e')](respondWithResult(_0x45865b,null))['catch'](handleError(_0x45865b,null));};exports['destroy']=function(_0x1b0a16,_0x27f12b){return db[_0x6460('0x25')][_0x6460('0x3a')]({'where':{'id':_0x1b0a16[_0x6460('0x3b')]['id']}})[_0x6460('0x1e')](handleEntityNotFound(_0x27f12b,null))[_0x6460('0x1e')](removeEntity(_0x27f12b,null))[_0x6460('0x2d')](handleError(_0x27f12b,null));};exports['describe']=function(_0x4c450d,_0x42b322){return db[_0x6460('0x25')][_0x6460('0x3c')]()[_0x6460('0x1e')](respondWithResult(_0x42b322,null))[_0x6460('0x2d')](handleError(_0x42b322,null));};exports[_0x6460('0x3d')]=function(_0x18f422,_0x2b6cb4){return db['MailMessage'][_0x6460('0x3a')]({'where':{'id':_0x18f422[_0x6460('0x3b')]['id']}})[_0x6460('0x1e')](handleEntityNotFound(_0x2b6cb4,null))[_0x6460('0x1e')](function(_0x14be59){if(_0x14be59){return _0x14be59[_0x6460('0x3d')](_0x18f422[_0x6460('0x38')]['ids'],_[_0x6460('0x3e')](_0x18f422[_0x6460('0x38')],[_0x6460('0x3f'),'id'])||{});}})[_0x6460('0x1e')](respondWithResult(_0x2b6cb4,null))[_0x6460('0x2d')](handleError(_0x2b6cb4,null));};exports[_0x6460('0x40')]=function(_0x438bcb,_0x43eb35){var _0x20c148={'raw':![],'where':{}};var _0x699e2d={};var _0x118c00={'count':0x0,'rows':[]};return db[_0x6460('0x25')][_0x6460('0x41')]({'where':{'id':_0x438bcb['params']['id']}})[_0x6460('0x1e')](handleEntityNotFound(_0x43eb35,null))[_0x6460('0x1e')](function(_0x7df81a){if(_0x7df81a){_0x699e2d[_0x6460('0x2f')]=_['keys'](db[_0x6460('0x42')]['rawAttributes']);_0x699e2d[_0x6460('0x2b')]=_[_0x6460('0x30')](_0x438bcb[_0x6460('0x2b')]);_0x699e2d['filters']=_[_0x6460('0x31')](_0x699e2d[_0x6460('0x2f')],_0x699e2d['query']);_0x20c148[_0x6460('0x43')]=_[_0x6460('0x31')](_0x699e2d[_0x6460('0x2f')],qs[_0x6460('0x32')](_0x438bcb[_0x6460('0x2b')]['fields']));_0x20c148[_0x6460('0x43')]=_0x20c148['attributes'][_0x6460('0x33')]?_0x20c148[_0x6460('0x43')]:_0x699e2d[_0x6460('0x2f')];if(!_0x438bcb[_0x6460('0x2b')][_0x6460('0x44')](_0x6460('0x45'))){_0x20c148[_0x6460('0x18')]=qs[_0x6460('0x18')](_0x438bcb['query'][_0x6460('0x18')]);_0x20c148[_0x6460('0x1a')]=qs['offset'](_0x438bcb[_0x6460('0x2b')][_0x6460('0x1a')]);}_0x20c148[_0x6460('0x46')]=qs[_0x6460('0x47')](_0x438bcb[_0x6460('0x2b')][_0x6460('0x47')]);_0x20c148[_0x6460('0x48')]=qs[_0x6460('0x49')](_[_0x6460('0x4a')](_0x438bcb['query'],_0x699e2d[_0x6460('0x49')]));_0x20c148[_0x6460('0x48')][_0x6460('0x4b')]=_0x7df81a['id'];if(_0x438bcb[_0x6460('0x2b')]['filter']){_0x20c148['where']=_[_0x6460('0x4c')](_0x20c148[_0x6460('0x48')],{'$or':_['map'](_0x20c148['attributes'],function(_0xbdf742){var _0x3c053e={};_0x3c053e[_0xbdf742]={'$like':'%'+_0x438bcb[_0x6460('0x2b')][_0x6460('0x4d')]+'%'};return _0x3c053e;})});}if(_0x438bcb[_0x6460('0x2b')]['$gte']){var _0x5bf97c=_0x438bcb[_0x6460('0x2b')][_0x6460('0x4e')][_0x6460('0x4f')](',');var _0x5e45d1={};_0x5e45d1[_0x5bf97c[0x0]]={'$gte':moment(_0x5bf97c[0x1])[_0x6460('0x50')]('YYYY-MM-DD\x20HH:mm:ss')};_0x20c148[_0x6460('0x48')]=_['merge'](_0x20c148['where'],_0x5e45d1);}_0x20c148=_[_0x6460('0x4c')]({},_0x20c148,_0x438bcb[_0x6460('0x36')]);return db[_0x6460('0x42')]['count']({'where':_0x20c148[_0x6460('0x48')]})[_0x6460('0x1e')](function(_0x2187f2){_0x118c00[_0x6460('0x19')]=_0x2187f2;if(_0x438bcb[_0x6460('0x2b')]['includeAll']){_0x20c148[_0x6460('0x35')]=[{'all':!![]}];}return db[_0x6460('0x42')][_0x6460('0x29')](_0x20c148);})['then'](function(_0x3cf96e){if(_0x438bcb[_0x6460('0x2b')][_0x6460('0x51')]===_0x6460('0x52')){for(var _0x19d413=0x0;_0x19d413<_0x3cf96e['length'];_0x19d413++){_0x3cf96e[_0x19d413][_0x6460('0x38')]=juice(_0x3cf96e[_0x19d413][_0x6460('0x38')]);}}_0x118c00[_0x6460('0x53')]=_0x3cf96e;return _0x118c00;});}})['then'](respondWithFilteredResult(_0x43eb35,_0x20c148))[_0x6460('0x2d')](handleError(_0x43eb35,null));};exports[_0x6460('0x54')]=function(_0x3c2d2c,_0x1b1e46){return db[_0x6460('0x25')][_0x6460('0x3a')]({'where':{'id':_0x3c2d2c['params']['id']}})[_0x6460('0x1e')](handleEntityNotFound(_0x1b1e46,null))[_0x6460('0x1e')](function(_0xd45ec8){if(_0xd45ec8){return _0xd45ec8[_0x6460('0x55')](_0x3c2d2c[_0x6460('0x38')][_0x6460('0x3f')],_[_0x6460('0x3e')](_0x3c2d2c[_0x6460('0x38')],[_0x6460('0x3f'),'id'])||{})[_0x6460('0x56')](function(){return db[_0x6460('0x57')][_0x6460('0x29')]({'attributes':['id','name','color'],'where':{'id':_0x3c2d2c[_0x6460('0x38')]['ids']}});})[_0x6460('0x1e')](function(_0x122c4a){socket[_0x6460('0x58')](_0x6460('0x59'),{'id':Number(_0x3c2d2c[_0x6460('0x3b')]['id']),'tags':_0x122c4a||[]});return{'id':Number(_0x3c2d2c[_0x6460('0x3b')]['id']),'tags':_0x122c4a||[]};});}})[_0x6460('0x1e')](respondWithResult(_0x1b1e46,null))[_0x6460('0x2d')](handleError(_0x1b1e46,null));};exports[_0x6460('0x5a')]=function(_0x20aeb3,_0x1aba7d){return db['MailInteraction']['find']({'where':{'id':_0x20aeb3[_0x6460('0x3b')]['id']}})[_0x6460('0x1e')](handleEntityNotFound(_0x1aba7d,null))[_0x6460('0x1e')](function(_0xf51dc1){if(_0xf51dc1){return _0xf51dc1[_0x6460('0x5a')](_0x20aeb3['query'][_0x6460('0x3f')]);}})[_0x6460('0x1e')](respondWithStatusCode(_0x1aba7d,null))[_0x6460('0x2d')](handleError(_0x1aba7d,null));};exports[_0x6460('0x5b')]=function(_0x2109d4,_0x34791c){var _0x591bbd=moment()[_0x6460('0x5c')]()[_0x6460('0x5d')]();var _0x5881a3=path[_0x6460('0x5e')](config[_0x6460('0x5f')],_0x6460('0x60'),_0x6460('0x61'),_0x6460('0x62'));var _0x32cf93=path[_0x6460('0x5e')](config[_0x6460('0x5f')],'server','files',_0x6460('0x63'));var _0x597008=path[_0x6460('0x5e')](_0x5881a3,_0x591bbd);var _0x465971=util[_0x6460('0x50')]('transcript-%d-%s.zip',_0x2109d4['params']['id'],_0x591bbd);var _0x5a3764=path[_0x6460('0x5e')](_0x5881a3,_0x465971);var _0x3ced7c=[];if(_0x2109d4[_0x6460('0x2b')][_0x6460('0x63')]){_0x3ced7c[_0x6460('0x64')]({'model':db[_0x6460('0x65')],'as':'Attachments','raw':!![]});}var _0x158f5a=[{'model':db[_0x6460('0x42')],'as':_0x6460('0x66'),'attributes':['id',_0x6460('0x38'),_0x6460('0x67'),'to','cc',_0x6460('0x68'),_0x6460('0x69'),_0x6460('0x6a')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x3ced7c}];return db[_0x6460('0x25')][_0x6460('0x3a')]({'where':{'id':_0x2109d4[_0x6460('0x3b')]['id']},'include':_0x158f5a})[_0x6460('0x1e')](handleEntityNotFound(_0x34791c,null))[_0x6460('0x1e')](function(_0x38e73f){if(_0x38e73f&&_0x38e73f[_0x6460('0x66')]){var _0x3a7538=_0x38e73f['get']({'plain':!![]});fs[_0x6460('0x6b')](_0x597008);return BPromise[_0x6460('0x6c')](_0x3a7538[_0x6460('0x66')],function(_0x454920,_0x4a3311){var _0x5d9f09={'from':_0x454920['from'],'to':_0x454920['to']||_0x6460('0x6d'),'subject':_0x454920[_0x6460('0x69')],'html':htmlEntities['decode'](_0x454920[_0x6460('0x38')]),'headers':{'Date':moment(_0x454920['createdAt'])['format'](_0x6460('0x6e'))},'attachments':[]};if(_0x454920['cc']){_0x5d9f09[_0x6460('0x6f')]['Cc']=_0x454920['cc'];}if(_0x454920[_0x6460('0x68')]){_0x5d9f09['headers'][_0x6460('0x70')]=_0x454920[_0x6460('0x68')];}return new BPromise(function(_0x393ba3,_0x8a3a21){if(_0x454920[_0x6460('0x71')]){for(var _0x200144=0x0;_0x200144<_0x454920[_0x6460('0x71')][_0x6460('0x33')];_0x200144++){var _0x5c58e3=_0x454920['Attachments'][_0x200144];var _0x124611=path['join'](_0x32cf93,_0x5c58e3['basename']);if(fs[_0x6460('0x72')](_0x124611)){_0x5d9f09['attachments'][_0x6460('0x64')]({'name':_0x5c58e3['name'],'contentType':_0x5c58e3['type'],'data':fs[_0x6460('0x73')](_0x124611)});}}}emlformat[_0x6460('0x74')](_0x5d9f09,function(_0x235dcd,_0x24b87e){if(_0x235dcd)return _0x8a3a21(_0x235dcd);fs[_0x6460('0x75')](path[_0x6460('0x5e')](_0x597008,util[_0x6460('0x50')](_0x6460('0x76'),_0x4a3311)),_0x24b87e);return _0x393ba3(_0x24b87e);});});})[_0x6460('0x1e')](function(){return new BPromise(function(_0x47575d,_0x1e1518){zipdir(_0x597008,{'saveTo':_0x5a3764},function(_0x460915,_0x2aac70){if(_0x460915)return _0x1e1518(_0x460915);return _0x47575d(_0x2aac70);});})[_0x6460('0x1e')](function(){return new BPromise(function(_0x36b9aa,_0x181c62){rimraf(_0x597008,function(_0x1bbe50){if(_0x1bbe50)_0x181c62(_0x1bbe50);return _0x36b9aa();});});})[_0x6460('0x1e')](function(){return _0x34791c[_0x6460('0x5b')](_0x5a3764,_0x465971,function(_0xa758c2){if(!_0xa758c2)fs[_0x6460('0x77')](_0x5a3764);});});});}else{return _0x34791c[_0x6460('0x14')](0xc8);}})[_0x6460('0x2d')](handleError(_0x34791c,null));}; \ No newline at end of file +var _0x9867=['include','options','find','create','body','describe','addMessage','ids','omit','findOne','MailMessage','length','hasOwnProperty','order','sort','where','pick','MailInteractionId','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','missing.recipient@your.company.com','decode','headers','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','findAll','mail','query','user','catch','params','keys','filters','intersection','model','attributes','fields','includeAll'];(function(_0x38b5f1,_0x3e9caa){var _0x72d7d9=function(_0x36a18f){while(--_0x36a18f){_0x38b5f1['push'](_0x38b5f1['shift']());}};_0x72d7d9(++_0x3e9caa);}(_0x9867,0x11a));var _0x7986=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9867[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7986('0x0'));var rimraf=require(_0x7986('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x7986('0x2'));var util=require(_0x7986('0x3'));var path=require(_0x7986('0x4'));var fs=require('fs');var _=require(_0x7986('0x5'));var juice=require('juice');var Redis=require(_0x7986('0x6'));var interaction=require(_0x7986('0x7'));var qs=require(_0x7986('0x8'));var logger=require(_0x7986('0x9'))(_0x7986('0xa'));var config=require(_0x7986('0xb'));var db=require(_0x7986('0xc'))['db'];var htmlEntities=require(_0x7986('0xd'));config[_0x7986('0xe')]=_[_0x7986('0xf')](config[_0x7986('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7986('0x10'))(new Redis(config[_0x7986('0xe')]));require(_0x7986('0x11'))[_0x7986('0x12')](socket);function respondWithStatusCode(_0x1fc5df,_0x22d269){_0x22d269=_0x22d269||0xcc;return function(_0x4e720a){if(_0x4e720a){return _0x1fc5df['sendStatus'](_0x22d269);}return _0x1fc5df[_0x7986('0x13')](_0x22d269)[_0x7986('0x14')]();};}function respondWithResult(_0x4bba05,_0x30079d){_0x30079d=_0x30079d||0xc8;return function(_0x5e2bf9){if(_0x5e2bf9){return _0x4bba05[_0x7986('0x13')](_0x30079d)[_0x7986('0x15')](_0x5e2bf9);}};}function respondWithFilteredResult(_0x29113a,_0x1081c1){return function(_0x21f642){if(_0x21f642){var _0x51c83e=typeof _0x1081c1[_0x7986('0x16')]==='undefined'&&typeof _0x1081c1['limit']===_0x7986('0x17');var _0x485e62=_0x21f642['count'];var _0x1f0d04=_0x51c83e?0x0:_0x1081c1[_0x7986('0x16')];var _0x4bee8c=_0x51c83e?_0x21f642[_0x7986('0x18')]:_0x1081c1[_0x7986('0x16')]+_0x1081c1[_0x7986('0x19')];var _0x4b95a7;if(_0x4bee8c>=_0x485e62){_0x4bee8c=_0x485e62;_0x4b95a7=0xc8;}else{_0x4b95a7=0xce;}_0x29113a[_0x7986('0x13')](_0x4b95a7);return _0x29113a[_0x7986('0x1a')](_0x7986('0x1b'),_0x1f0d04+'-'+_0x4bee8c+'/'+_0x485e62)[_0x7986('0x15')](_0x21f642);}return null;};}function saveUpdates(_0xb51f0a){return function(_0x1d6803){if(_0x1d6803){return _0x1d6803[_0x7986('0x1c')](_0xb51f0a)[_0x7986('0x1d')](function(_0x249db6){return _0x249db6;});}return null;};}function removeEntity(_0x5754d7){return function(_0x87ff5d){if(_0x87ff5d){return _0x87ff5d[_0x7986('0x1e')]()['then'](function(){_0x5754d7[_0x7986('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a16d){return function(_0x103a56){if(!_0x103a56){_0x16a16d[_0x7986('0x1f')](0x194);}return _0x103a56;};}function handleError(_0x2ac483,_0x8df04a){_0x8df04a=_0x8df04a||0x1f4;return function(_0x379fb5){logger['error'](_0x379fb5[_0x7986('0x20')]);if(_0x379fb5[_0x7986('0x21')]){delete _0x379fb5['name'];}_0x2ac483['status'](_0x8df04a)[_0x7986('0x22')](_0x379fb5);};}exports[_0x7986('0x23')]=function(_0x10f735,_0x264f01){var _0x32dc48={};var _0x26401e=_[_0x7986('0x24')](db[_0x7986('0x25')][_0x7986('0x26')],function(_0x18d4f5){return{'name':_0x18d4f5[_0x7986('0x27')],'type':_0x18d4f5['type'][_0x7986('0x28')]};});_0x32dc48=qs['getOptions'](_0x26401e,_0x10f735);return interaction[_0x7986('0x29')](_0x7986('0x2a'),_0x10f735[_0x7986('0x2b')],_0x10f735[_0x7986('0x2c')],_0x32dc48,_0x26401e)[_0x7986('0x1d')](respondWithFilteredResult(_0x264f01,_0x32dc48))[_0x7986('0x2d')](handleError(_0x264f01,null));};exports['show']=function(_0x500349,_0x2637a1){var _0x230ec1={'raw':![],'where':{'id':_0x500349[_0x7986('0x2e')]['id']}},_0x1743ed={};_0x1743ed['model']=_[_0x7986('0x2f')](db[_0x7986('0x25')][_0x7986('0x26')]);_0x1743ed['query']=_[_0x7986('0x2f')](_0x500349[_0x7986('0x2b')]);_0x1743ed[_0x7986('0x30')]=_[_0x7986('0x31')](_0x1743ed[_0x7986('0x32')],_0x1743ed[_0x7986('0x2b')]);_0x230ec1[_0x7986('0x33')]=_[_0x7986('0x31')](_0x1743ed[_0x7986('0x32')],qs[_0x7986('0x34')](_0x500349[_0x7986('0x2b')][_0x7986('0x34')]));_0x230ec1['attributes']=_0x230ec1[_0x7986('0x33')]['length']?_0x230ec1[_0x7986('0x33')]:_0x1743ed[_0x7986('0x32')];if(_0x500349[_0x7986('0x2b')][_0x7986('0x35')]){_0x230ec1[_0x7986('0x36')]=[{'all':!![]}];}_0x230ec1=_['merge']({},_0x230ec1,_0x500349[_0x7986('0x37')]);return db[_0x7986('0x25')][_0x7986('0x38')](_0x230ec1)['then'](handleEntityNotFound(_0x2637a1,null))[_0x7986('0x1d')](respondWithResult(_0x2637a1,null))[_0x7986('0x2d')](handleError(_0x2637a1,null));};exports[_0x7986('0x39')]=function(_0x283158,_0x1c4857){return db[_0x7986('0x25')][_0x7986('0x39')](_0x283158[_0x7986('0x3a')],{})[_0x7986('0x1d')](respondWithResult(_0x1c4857,0xc9))[_0x7986('0x2d')](handleError(_0x1c4857,null));};exports[_0x7986('0x1c')]=function(_0x5cda10,_0x3c2b6c){if(_0x5cda10[_0x7986('0x3a')]['id']){delete _0x5cda10[_0x7986('0x3a')]['id'];}return db[_0x7986('0x25')][_0x7986('0x38')]({'where':{'id':_0x5cda10[_0x7986('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3c2b6c,null))[_0x7986('0x1d')](saveUpdates(_0x5cda10[_0x7986('0x3a')],null))[_0x7986('0x1d')](respondWithResult(_0x3c2b6c,null))['catch'](handleError(_0x3c2b6c,null));};exports[_0x7986('0x1e')]=function(_0x1f22c2,_0x2519bd){return db['MailInteraction']['find']({'where':{'id':_0x1f22c2[_0x7986('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2519bd,null))[_0x7986('0x1d')](removeEntity(_0x2519bd,null))[_0x7986('0x2d')](handleError(_0x2519bd,null));};exports[_0x7986('0x3b')]=function(_0x3694eb,_0x32104f){return db[_0x7986('0x25')]['describe']()[_0x7986('0x1d')](respondWithResult(_0x32104f,null))['catch'](handleError(_0x32104f,null));};exports['addMessage']=function(_0x19d8b5,_0x2b4fbf){return db['MailMessage'][_0x7986('0x38')]({'where':{'id':_0x19d8b5[_0x7986('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2b4fbf,null))[_0x7986('0x1d')](function(_0x30864b){if(_0x30864b){return _0x30864b[_0x7986('0x3c')](_0x19d8b5[_0x7986('0x3a')][_0x7986('0x3d')],_[_0x7986('0x3e')](_0x19d8b5[_0x7986('0x3a')],[_0x7986('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x2b4fbf,null))[_0x7986('0x2d')](handleError(_0x2b4fbf,null));};exports['getMessages']=function(_0x12c8c7,_0x35e86b){var _0x3b3dfb={'raw':![],'where':{}};var _0x3e0cce={};var _0x26c1b3={'count':0x0,'rows':[]};return db[_0x7986('0x25')][_0x7986('0x3f')]({'where':{'id':_0x12c8c7[_0x7986('0x2e')]['id']}})[_0x7986('0x1d')](handleEntityNotFound(_0x35e86b,null))[_0x7986('0x1d')](function(_0xb5edd2){if(_0xb5edd2){_0x3e0cce[_0x7986('0x32')]=_['keys'](db[_0x7986('0x40')][_0x7986('0x26')]);_0x3e0cce[_0x7986('0x2b')]=_[_0x7986('0x2f')](_0x12c8c7[_0x7986('0x2b')]);_0x3e0cce['filters']=_['intersection'](_0x3e0cce['model'],_0x3e0cce[_0x7986('0x2b')]);_0x3b3dfb['attributes']=_[_0x7986('0x31')](_0x3e0cce[_0x7986('0x32')],qs[_0x7986('0x34')](_0x12c8c7[_0x7986('0x2b')][_0x7986('0x34')]));_0x3b3dfb[_0x7986('0x33')]=_0x3b3dfb[_0x7986('0x33')][_0x7986('0x41')]?_0x3b3dfb[_0x7986('0x33')]:_0x3e0cce[_0x7986('0x32')];if(!_0x12c8c7[_0x7986('0x2b')][_0x7986('0x42')]('nolimit')){_0x3b3dfb[_0x7986('0x19')]=qs[_0x7986('0x19')](_0x12c8c7[_0x7986('0x2b')][_0x7986('0x19')]);_0x3b3dfb['offset']=qs[_0x7986('0x16')](_0x12c8c7['query'][_0x7986('0x16')]);}_0x3b3dfb[_0x7986('0x43')]=qs[_0x7986('0x44')](_0x12c8c7[_0x7986('0x2b')][_0x7986('0x44')]);_0x3b3dfb[_0x7986('0x45')]=qs[_0x7986('0x30')](_[_0x7986('0x46')](_0x12c8c7[_0x7986('0x2b')],_0x3e0cce['filters']));_0x3b3dfb[_0x7986('0x45')][_0x7986('0x47')]=_0xb5edd2['id'];if(_0x12c8c7['query']['filter']){_0x3b3dfb['where']=_[_0x7986('0x48')](_0x3b3dfb['where'],{'$or':_[_0x7986('0x24')](_0x3b3dfb[_0x7986('0x33')],function(_0x5a5c83){var _0x52a1e8={};_0x52a1e8[_0x5a5c83]={'$like':'%'+_0x12c8c7['query']['filter']+'%'};return _0x52a1e8;})});}if(_0x12c8c7[_0x7986('0x2b')][_0x7986('0x49')]){var _0x5a16e4=_0x12c8c7[_0x7986('0x2b')]['$gte'][_0x7986('0x4a')](',');var _0x48c6d0={};_0x48c6d0[_0x5a16e4[0x0]]={'$gte':moment(_0x5a16e4[0x1])[_0x7986('0x4b')](_0x7986('0x4c'))};_0x3b3dfb[_0x7986('0x45')]=_['merge'](_0x3b3dfb[_0x7986('0x45')],_0x48c6d0);}_0x3b3dfb=_[_0x7986('0x48')]({},_0x3b3dfb,_0x12c8c7[_0x7986('0x37')]);return db['MailMessage'][_0x7986('0x18')]({'where':_0x3b3dfb['where']})['then'](function(_0x27badb){_0x26c1b3[_0x7986('0x18')]=_0x27badb;if(_0x12c8c7[_0x7986('0x2b')][_0x7986('0x35')]){_0x3b3dfb[_0x7986('0x36')]=[{'all':!![]}];}return db['MailMessage'][_0x7986('0x29')](_0x3b3dfb);})['then'](function(_0x242b51){if(_0x12c8c7['query'][_0x7986('0x4d')]==='true'){for(var _0x59fcbc=0x0;_0x59fcbc<_0x242b51[_0x7986('0x41')];_0x59fcbc++){_0x242b51[_0x59fcbc][_0x7986('0x3a')]=juice(_0x242b51[_0x59fcbc]['body']);}}_0x26c1b3[_0x7986('0x4e')]=_0x242b51;return _0x26c1b3;});}})[_0x7986('0x1d')](respondWithFilteredResult(_0x35e86b,_0x3b3dfb))[_0x7986('0x2d')](handleError(_0x35e86b,null));};exports[_0x7986('0x4f')]=function(_0x1b3bcd,_0x480ffc){return db[_0x7986('0x25')][_0x7986('0x38')]({'where':{'id':_0x1b3bcd[_0x7986('0x2e')]['id']}})[_0x7986('0x1d')](handleEntityNotFound(_0x480ffc,null))[_0x7986('0x1d')](function(_0x2da6ed){if(_0x2da6ed){return _0x2da6ed[_0x7986('0x50')](_0x1b3bcd[_0x7986('0x3a')][_0x7986('0x3d')],_[_0x7986('0x3e')](_0x1b3bcd[_0x7986('0x3a')],[_0x7986('0x3d'),'id'])||{})[_0x7986('0x51')](function(){return db[_0x7986('0x52')][_0x7986('0x29')]({'attributes':['id',_0x7986('0x21'),_0x7986('0x53')],'where':{'id':_0x1b3bcd[_0x7986('0x3a')][_0x7986('0x3d')]}});})[_0x7986('0x1d')](function(_0x1bb625){socket[_0x7986('0x54')](_0x7986('0x55'),{'id':Number(_0x1b3bcd['params']['id']),'tags':_0x1bb625||[]});return{'id':Number(_0x1b3bcd[_0x7986('0x2e')]['id']),'tags':_0x1bb625||[]};});}})['then'](respondWithResult(_0x480ffc,null))['catch'](handleError(_0x480ffc,null));};exports[_0x7986('0x56')]=function(_0x387292,_0x246284){return db[_0x7986('0x25')][_0x7986('0x38')]({'where':{'id':_0x387292[_0x7986('0x2e')]['id']}})[_0x7986('0x1d')](handleEntityNotFound(_0x246284,null))[_0x7986('0x1d')](function(_0x3c0afb){if(_0x3c0afb){return _0x3c0afb[_0x7986('0x56')](_0x387292[_0x7986('0x2b')][_0x7986('0x3d')]);}})[_0x7986('0x1d')](respondWithStatusCode(_0x246284,null))[_0x7986('0x2d')](handleError(_0x246284,null));};exports[_0x7986('0x57')]=function(_0x25071e,_0x156e0e){var _0x1889ff=moment()[_0x7986('0x58')]()[_0x7986('0x59')]();var _0x22c000=path[_0x7986('0x5a')](config[_0x7986('0x5b')],_0x7986('0x5c'),_0x7986('0x5d'),'tmp');var _0x2eea12=path[_0x7986('0x5a')](config[_0x7986('0x5b')],'server',_0x7986('0x5d'),'attachments');var _0x4d91e4=path['join'](_0x22c000,_0x1889ff);var _0x1d0f48=util[_0x7986('0x4b')]('transcript-%d-%s.zip',_0x25071e[_0x7986('0x2e')]['id'],_0x1889ff);var _0x27a5c3=path[_0x7986('0x5a')](_0x22c000,_0x1d0f48);var _0xb2fd17=[];if(_0x25071e[_0x7986('0x2b')][_0x7986('0x5e')]){_0xb2fd17[_0x7986('0x5f')]({'model':db[_0x7986('0x60')],'as':_0x7986('0x61'),'raw':!![]});}var _0x140a67=[{'model':db[_0x7986('0x40')],'as':_0x7986('0x62'),'attributes':['id',_0x7986('0x3a'),_0x7986('0x63'),'to','cc',_0x7986('0x64'),_0x7986('0x65'),_0x7986('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xb2fd17}];return db['MailInteraction'][_0x7986('0x38')]({'where':{'id':_0x25071e[_0x7986('0x2e')]['id']},'include':_0x140a67})[_0x7986('0x1d')](handleEntityNotFound(_0x156e0e,null))['then'](function(_0x344f65){if(_0x344f65&&_0x344f65[_0x7986('0x62')]){var _0x33f8fa=_0x344f65['get']({'plain':!![]});fs['mkdirSync'](_0x4d91e4);return BPromise['each'](_0x33f8fa[_0x7986('0x62')],function(_0x47ad9c,_0xb1c3b5){var _0xbf296b={'from':_0x47ad9c[_0x7986('0x63')],'to':_0x47ad9c['to']||_0x7986('0x67'),'subject':_0x47ad9c[_0x7986('0x65')],'html':htmlEntities[_0x7986('0x68')](_0x47ad9c['body']),'headers':{'Date':moment(_0x47ad9c[_0x7986('0x66')])[_0x7986('0x4b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x47ad9c['cc']){_0xbf296b['headers']['Cc']=_0x47ad9c['cc'];}if(_0x47ad9c['bcc']){_0xbf296b[_0x7986('0x69')]['Bcc']=_0x47ad9c[_0x7986('0x64')];}return new BPromise(function(_0x7a62bf,_0x2f9b73){if(_0x47ad9c[_0x7986('0x61')]){for(var _0x5a1211=0x0;_0x5a1211<_0x47ad9c[_0x7986('0x61')]['length'];_0x5a1211++){var _0x39c080=_0x47ad9c[_0x7986('0x61')][_0x5a1211];var _0x3c9cb2=path[_0x7986('0x5a')](_0x2eea12,_0x39c080[_0x7986('0x6a')]);if(fs[_0x7986('0x6b')](_0x3c9cb2)){_0xbf296b[_0x7986('0x5e')][_0x7986('0x5f')]({'name':_0x39c080[_0x7986('0x21')],'contentType':_0x39c080['type'],'data':fs[_0x7986('0x6c')](_0x3c9cb2)});}}}emlformat['build'](_0xbf296b,function(_0xaf29b,_0x4af234){if(_0xaf29b)return _0x2f9b73(_0xaf29b);fs[_0x7986('0x6d')](path['join'](_0x4d91e4,util[_0x7986('0x4b')](_0x7986('0x6e'),_0xb1c3b5)),_0x4af234);return _0x7a62bf(_0x4af234);});});})['then'](function(){return new BPromise(function(_0x2d8ba9,_0x4f39ec){zipdir(_0x4d91e4,{'saveTo':_0x27a5c3},function(_0x1a032c,_0x499bab){if(_0x1a032c)return _0x4f39ec(_0x1a032c);return _0x2d8ba9(_0x499bab);});})[_0x7986('0x1d')](function(){return new BPromise(function(_0x5c15c3,_0x5dfb40){rimraf(_0x4d91e4,function(_0x5bd86f){if(_0x5bd86f)_0x5dfb40(_0x5bd86f);return _0x5c15c3();});});})[_0x7986('0x1d')](function(){return _0x156e0e['download'](_0x27a5c3,_0x1d0f48,function(_0x3b06d8){if(!_0x3b06d8)fs[_0x7986('0x6f')](_0x27a5c3);});});});}else{return _0x156e0e[_0x7986('0x1f')](0xc8);}})[_0x7986('0x2d')](handleError(_0x156e0e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 775e5f9..e99e63f 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 _0x7909=['emit','MailInteraction','../../mysqldb','MailMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0xa6e448,_0x44f842){var _0x62952a=function(_0x3c7d35){while(--_0x3c7d35){_0xa6e448['push'](_0xa6e448['shift']());}};_0x62952a(++_0x44f842);}(_0x7909,0x143));var _0x9790=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7909[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x9790('0x0')];var MailMessage=require(_0x9790('0x1'))['db'][_0x9790('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9790('0x3'),'afterUpdate':'update','afterDestroy':_0x9790('0x4')};function emitEvent(_0x41e921){return function(_0x1ba984,_0xd807b1,_0x4efd2b){_0x1ba984[_0x9790('0x5')]({'attributes':['id'],'raw':!![]})[_0x9790('0x6')](function(_0x27eb87){_0x1ba984[_0x9790('0x7')](_0x9790('0x8'),_0x27eb87[_0x9790('0x9')](function(_0x4d911b){return{'id':_0x4d911b['id']};}));return MailMessage[_0x9790('0xa')]({'where':{'MailInteractionId':_0x1ba984['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4b3eca){_0x1ba984[_0x9790('0x7')](_0x9790('0xb'),_0x4b3eca[_0x9790('0xc')]);MailInteractionEvents[_0x9790('0xd')](_0x41e921+':'+_0x1ba984['id'],_0x1ba984);MailInteractionEvents[_0x9790('0xd')](_0x41e921,_0x1ba984);_0x4efd2b(null);})['catch'](_0x4efd2b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x5c90=['emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','remove','getUsers','then','map','setDataValue','length'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x5c90,0x6e));var _0x05c9=function(_0x1d2ed0,_0x2908f1){_0x1d2ed0=_0x1d2ed0-0x0;var _0x545a0e=_0x5c90[_0x1d2ed0];return _0x545a0e;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x05c9('0x0'))['db'][_0x05c9('0x1')];var MailMessage=require(_0x05c9('0x0'))['db'][_0x05c9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05c9('0x3'),'afterUpdate':'update','afterDestroy':_0x05c9('0x4')};function emitEvent(_0x30519a){return function(_0x2cc70c,_0x1add05,_0x3cf715){_0x2cc70c[_0x05c9('0x5')]({'attributes':['id'],'raw':!![]})[_0x05c9('0x6')](function(_0x4997fb){_0x2cc70c['setDataValue']('Users',_0x4997fb[_0x05c9('0x7')](function(_0x5ee8f0){return{'id':_0x5ee8f0['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2cc70c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x05c9('0x6')](function(_0x4d08fe){_0x2cc70c[_0x05c9('0x8')]('unreadMessages',_0x4d08fe[_0x05c9('0x9')]);MailInteractionEvents[_0x05c9('0xa')](_0x30519a+':'+_0x2cc70c['id'],_0x2cc70c);MailInteractionEvents['emit'](_0x30519a,_0x2cc70c);_0x3cf715(null);})[_0x05c9('0xb')](_0x3cf715(null));};}for(var e in events){if(events[_0x05c9('0xc')](e)){var event=events[e];MailInteraction[_0x05c9('0xd')](e,emitEvent(event));}}module[_0x05c9('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3237d85..8bb817c 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 _0x0de4=['subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','format','closed','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0xdfcf72,_0x3b8140){var _0x5b056c=function(_0x2fb55a){while(--_0x2fb55a){_0xdfcf72['push'](_0xdfcf72['shift']());}};_0x5b056c(++_0x3b8140);}(_0x0de4,0x153));var _0x40de=function(_0x1371c0,_0x390fad){_0x1371c0=_0x1371c0-0x0;var _0x28b779=_0x0de4[_0x1371c0];return _0x28b779;};'use strict';var _=require('lodash');var util=require(_0x40de('0x0'));var logger=require(_0x40de('0x1'))(_0x40de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x40de('0x3'));var fs=require('fs');var path=require(_0x40de('0x4'));var rimraf=require(_0x40de('0x5'));var config=require(_0x40de('0x6'));var attributes=require(_0x40de('0x7'));module[_0x40de('0x8')]=function(_0x1b248e,_0x5ed85a){return _0x1b248e['define'](_0x40de('0x9'),attributes,{'tableName':_0x40de('0xa'),'paranoid':![],'indexes':[{'name':_0x40de('0xb'),'fields':[_0x40de('0xc'),'to'],'type':_0x40de('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33b9ff,_0x3765ba,_0x2f743f){if(_0x33b9ff[_0x40de('0xe')]){_0x33b9ff[_0x40de('0xf')]=moment()['format'](_0x40de('0x10'));}if(_0x33b9ff['closed']){_0x33b9ff[_0x40de('0x11')]=moment()['format'](_0x40de('0x10'));}_0x2f743f(null,_0x3765ba);},'beforeUpdate':function(_0x3cc435,_0x40e59e,_0x490106){if(_0x3cc435[_0x40de('0x12')](_0x40de('0xe'))){_0x3cc435[_0x40de('0xf')]=_0x3cc435['substatus']?moment()[_0x40de('0x13')](_0x40de('0x10')):null;}if(_0x3cc435[_0x40de('0x12')](_0x40de('0x14'))){_0x3cc435['closedAt']=moment()[_0x40de('0x13')](_0x40de('0x10'));_0x3cc435[_0x40de('0xe')]=null;_0x3cc435[_0x40de('0xf')]=null;}_0x490106(null,_0x3cc435);},'afterUpdate':function(_0x2a0103,_0x1cbbb9,_0x450a14){var _0x3e9ce9=_0x1b248e['models'];var _0x203980=_0x2a0103['get']({'plain':!![]});if(_0x203980[_0x40de('0x14')]){return _0x3e9ce9[_0x40de('0x15')][_0x40de('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x203980['id']}})[_0x40de('0x17')](function(){_0x450a14();})[_0x40de('0x18')](function(_0x5b2248){_0x450a14(_0x5b2248);});}else{_0x450a14();}}},'charset':_0x40de('0x19'),'collate':_0x40de('0x1a')});}; \ No newline at end of file +var _0x833a=['format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt'];(function(_0x2b7cb1,_0xaad523){var _0x22cc5d=function(_0x491f2a){while(--_0x491f2a){_0x2b7cb1['push'](_0x2b7cb1['shift']());}};_0x22cc5d(++_0xaad523);}(_0x833a,0x12b));var _0xa833=function(_0xdeded3,_0x3d0318){_0xdeded3=_0xdeded3-0x0;var _0x57b55a=_0x833a[_0xdeded3];return _0x57b55a;};'use strict';var _=require(_0xa833('0x0'));var util=require(_0xa833('0x1'));var logger=require(_0xa833('0x2'))('api');var moment=require(_0xa833('0x3'));var BPromise=require('bluebird');var rp=require(_0xa833('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa833('0x5'));var attributes=require(_0xa833('0x6'));module['exports']=function(_0x203faa,_0x2f7cb8){return _0x203faa['define'](_0xa833('0x7'),attributes,{'tableName':_0xa833('0x8'),'paranoid':![],'indexes':[{'name':_0xa833('0x9'),'fields':[_0xa833('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2894fc,_0x34d5f2,_0x1f6ad2){if(_0x2894fc[_0xa833('0xb')]){_0x2894fc[_0xa833('0xc')]=moment()[_0xa833('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2894fc['closed']){_0x2894fc[_0xa833('0xe')]=moment()[_0xa833('0xd')](_0xa833('0xf'));}_0x1f6ad2(null,_0x34d5f2);},'beforeUpdate':function(_0x15c6b1,_0xbfcdf1,_0x4764e4){if(_0x15c6b1[_0xa833('0x10')](_0xa833('0xb'))){_0x15c6b1[_0xa833('0xc')]=_0x15c6b1[_0xa833('0xb')]?moment()[_0xa833('0xd')](_0xa833('0xf')):null;}if(_0x15c6b1[_0xa833('0x10')](_0xa833('0x11'))){_0x15c6b1[_0xa833('0xe')]=moment()[_0xa833('0xd')](_0xa833('0xf'));_0x15c6b1[_0xa833('0xb')]=null;_0x15c6b1[_0xa833('0xc')]=null;}_0x4764e4(null,_0x15c6b1);},'afterUpdate':function(_0x2a2e68,_0x58de60,_0x5bd4f0){var _0x141c3d=_0x203faa['models'];var _0x102bec=_0x2a2e68[_0xa833('0x12')]({'plain':!![]});if(_0x102bec[_0xa833('0x11')]){return _0x141c3d[_0xa833('0x13')][_0xa833('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x102bec['id']}})[_0xa833('0x15')](function(){_0x5bd4f0();})[_0xa833('0x16')](function(_0x56756c){_0x5bd4f0(_0x56756c);});}else{_0x5bd4f0();}}},'charset':_0xa833('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index eef1ecf..2b19b32 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 _0xd325=['defaults','localhost','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','AddTagsToMailInteraction','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis'];(function(_0x29a30a,_0x515269){var _0x2fcedf=function(_0xeb1513){while(--_0xeb1513){_0x29a30a['push'](_0x29a30a['shift']());}};_0x2fcedf(++_0x515269);}(_0xd325,0x1f3));var _0x5d32=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xd325[_0x32f6b9];return _0x267d52;};'use strict';var _=require(_0x5d32('0x0'));var util=require(_0x5d32('0x1'));var moment=require('moment');var BPromise=require(_0x5d32('0x2'));var rs=require(_0x5d32('0x3'));var fs=require('fs');var Redis=require(_0x5d32('0x4'));var db=require(_0x5d32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d32('0x6'))(_0x5d32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d32('0x8')][_0x5d32('0x9')]({'port':0x232a});config[_0x5d32('0xa')]=_[_0x5d32('0xb')](config[_0x5d32('0xa')],{'host':_0x5d32('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d32('0xa')]));require(_0x5d32('0xd'))[_0x5d32('0xe')](socket);function respondWithRpcPromise(_0x2c1674,_0x89b862,_0x512588){return new BPromise(function(_0x569646,_0x53884d){return client['request'](_0x2c1674,_0x512588)[_0x5d32('0xf')](function(_0x4da5c5){logger[_0x5d32('0x10')](_0x5d32('0x11'),_0x89b862,'request\x20sent');logger[_0x5d32('0x12')](_0x5d32('0x13'),_0x89b862,_0x5d32('0x14'),JSON[_0x5d32('0x15')](_0x4da5c5));if(_0x4da5c5[_0x5d32('0x16')]){if(_0x4da5c5[_0x5d32('0x16')]['code']===0x1f4){logger[_0x5d32('0x16')](_0x5d32('0x11'),_0x89b862,_0x4da5c5[_0x5d32('0x16')][_0x5d32('0x17')]);return _0x53884d(_0x4da5c5[_0x5d32('0x16')][_0x5d32('0x17')]);}logger[_0x5d32('0x16')](_0x5d32('0x11'),_0x89b862,_0x4da5c5['error'][_0x5d32('0x17')]);return _0x569646(_0x4da5c5[_0x5d32('0x16')][_0x5d32('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x89b862,'request\x20sent');_0x569646(_0x4da5c5['result'][_0x5d32('0x17')]);}})[_0x5d32('0x18')](function(_0x215879){logger[_0x5d32('0x16')](_0x5d32('0x11'),_0x89b862,_0x215879);_0x53884d(_0x215879);});});}exports[_0x5d32('0x19')]=function(_0x327583){var _0x477d9a=this;return new Promise(function(_0x3d8bc7,_0xbd8f3c){return db[_0x5d32('0x1a')]['update'](_0x327583[_0x5d32('0x1b')],{'raw':_0x327583[_0x5d32('0x1c')]?_0x327583['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x327583[_0x5d32('0x1c')]?_0x327583[_0x5d32('0x1c')][_0x5d32('0x1d')]||null:null,'attributes':_0x327583[_0x5d32('0x1c')]?_0x327583['options']['attributes']||null:null,'limit':_0x327583[_0x5d32('0x1c')]?_0x327583[_0x5d32('0x1c')]['limit']||null:null})['then'](function(_0x390dd1){logger['info'](_0x5d32('0x19'),_0x327583);logger[_0x5d32('0x12')](_0x5d32('0x19'),_0x327583,JSON['stringify'](_0x390dd1));_0x3d8bc7(_0x390dd1);})[_0x5d32('0x18')](function(_0x2cc354){logger['error'](_0x5d32('0x19'),_0x2cc354[_0x5d32('0x17')],_0x327583);_0xbd8f3c(_0x477d9a[_0x5d32('0x16')](0x1f4,_0x2cc354[_0x5d32('0x17')]));});});};exports[_0x5d32('0x1e')]=function(_0x3d2c81){return new Promise(function(_0x5146d3,_0x4b9d87){return db[_0x5d32('0x1a')]['find']({'where':_0x3d2c81[_0x5d32('0x1c')]?_0x3d2c81['options'][_0x5d32('0x1d')]||null:null})[_0x5d32('0xf')](function(_0x362e29){if(_0x362e29){return _0x362e29[_0x5d32('0x1f')](_0x3d2c81[_0x5d32('0x1b')][_0x5d32('0x20')],_['omit'](_0x3d2c81['body'],['ids','id'])||{});}})['spread'](function(_0x3e3622){logger[_0x5d32('0x10')](_0x5d32('0x21'),_0x3d2c81);logger['debug']('AddTags',_0x3d2c81,JSON[_0x5d32('0x15')](_0x3e3622));_0x5146d3(_0x3e3622);})[_0x5d32('0x18')](function(_0x4fab1d){logger[_0x5d32('0x16')]('AddTags',_0x4fab1d['message'],_0x3d2c81);_0x4b9d87(_this[_0x5d32('0x16')](0x1f4,_0x4fab1d[_0x5d32('0x17')]));});});}; \ No newline at end of file +var _0x2293=['info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','then'];(function(_0x425db8,_0x5f44ff){var _0x49ce72=function(_0x49bf97){while(--_0x49bf97){_0x425db8['push'](_0x425db8['shift']());}};_0x49ce72(++_0x5f44ff);}(_0x2293,0x6d));var _0x3229=function(_0x10a3de,_0xe01c71){_0x10a3de=_0x10a3de-0x0;var _0x1bd457=_0x2293[_0x10a3de];return _0x1bd457;};'use strict';var _=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var moment=require(_0x3229('0x2'));var BPromise=require(_0x3229('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3229('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3229('0x5'));var logger=require(_0x3229('0x6'))(_0x3229('0x7'));var config=require(_0x3229('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3229('0x9')]({'port':0x232a});config['redis']=_[_0x3229('0xa')](config['redis'],{'host':_0x3229('0xb'),'port':0x18eb});var socket=require(_0x3229('0xc'))(new Redis(config[_0x3229('0xd')]));require(_0x3229('0xe'))[_0x3229('0xf')](socket);function respondWithRpcPromise(_0x719d3c,_0x16eabd,_0x81be5f){return new BPromise(function(_0x113ee4,_0x17b3dc){return client['request'](_0x719d3c,_0x81be5f)[_0x3229('0x10')](function(_0x48a4db){logger[_0x3229('0x11')]('MailInteraction,\x20%s,\x20%s',_0x16eabd,_0x3229('0x12'));logger[_0x3229('0x13')](_0x3229('0x14'),_0x16eabd,'request\x20sent',JSON[_0x3229('0x15')](_0x48a4db));if(_0x48a4db[_0x3229('0x16')]){if(_0x48a4db['error'][_0x3229('0x17')]===0x1f4){logger[_0x3229('0x16')]('MailInteraction,\x20%s,\x20%s',_0x16eabd,_0x48a4db[_0x3229('0x16')][_0x3229('0x18')]);return _0x17b3dc(_0x48a4db['error']['message']);}logger[_0x3229('0x16')](_0x3229('0x19'),_0x16eabd,_0x48a4db[_0x3229('0x16')][_0x3229('0x18')]);return _0x113ee4(_0x48a4db['error']['message']);}else{logger['info'](_0x3229('0x19'),_0x16eabd,_0x3229('0x12'));_0x113ee4(_0x48a4db[_0x3229('0x1a')][_0x3229('0x18')]);}})[_0x3229('0x1b')](function(_0x1b3c55){logger['error'](_0x3229('0x19'),_0x16eabd,_0x1b3c55);_0x17b3dc(_0x1b3c55);});});}exports[_0x3229('0x1c')]=function(_0x9b0bae){var _0x3f211a=this;return new Promise(function(_0x32f267,_0x139cd3){return db['MailInteraction'][_0x3229('0x1d')](_0x9b0bae[_0x3229('0x1e')],{'raw':_0x9b0bae[_0x3229('0x1f')]?_0x9b0bae[_0x3229('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9b0bae[_0x3229('0x1f')]?_0x9b0bae[_0x3229('0x1f')][_0x3229('0x20')]||null:null,'attributes':_0x9b0bae['options']?_0x9b0bae[_0x3229('0x1f')][_0x3229('0x21')]||null:null,'limit':_0x9b0bae[_0x3229('0x1f')]?_0x9b0bae[_0x3229('0x1f')][_0x3229('0x22')]||null:null})[_0x3229('0x10')](function(_0x2d2a21){logger['info'](_0x3229('0x1c'),_0x9b0bae);logger[_0x3229('0x13')]('UpdateMailInteraction',_0x9b0bae,JSON[_0x3229('0x15')](_0x2d2a21));_0x32f267(_0x2d2a21);})['catch'](function(_0x57d06e){logger[_0x3229('0x16')]('UpdateMailInteraction',_0x57d06e[_0x3229('0x18')],_0x9b0bae);_0x139cd3(_0x3f211a[_0x3229('0x16')](0x1f4,_0x57d06e[_0x3229('0x18')]));});});};exports[_0x3229('0x23')]=function(_0x431e1d){return new Promise(function(_0xc47ba8,_0x422b9c){return db[_0x3229('0x24')][_0x3229('0x25')]({'where':_0x431e1d[_0x3229('0x1f')]?_0x431e1d[_0x3229('0x1f')][_0x3229('0x20')]||null:null})['then'](function(_0xc7e13f){if(_0xc7e13f){return _0xc7e13f['addTags'](_0x431e1d['body'][_0x3229('0x26')],_[_0x3229('0x27')](_0x431e1d['body'],[_0x3229('0x26'),'id'])||{});}})[_0x3229('0x28')](function(_0x59eafd){logger[_0x3229('0x11')](_0x3229('0x29'),_0x431e1d);logger[_0x3229('0x13')](_0x3229('0x29'),_0x431e1d,JSON['stringify'](_0x59eafd));_0xc47ba8(_0x59eafd);})[_0x3229('0x1b')](function(_0x21bafb){logger[_0x3229('0x16')]('AddTags',_0x21bafb[_0x3229('0x18')],_0x431e1d);_0x422b9c(_this[_0x3229('0x16')](0x1f4,_0x21bafb[_0x3229('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1799675..47846a8 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 _0xf256=['remove','update','register','length','./mailInteraction.events','save'];(function(_0x188d31,_0x54b2d7){var _0x1b5bd7=function(_0x597293){while(--_0x597293){_0x188d31['push'](_0x188d31['shift']());}};_0x1b5bd7(++_0x54b2d7);}(_0xf256,0xd0));var _0x6f25=function(_0x48a6c6,_0x518b86){_0x48a6c6=_0x48a6c6-0x0;var _0xec8c3a=_0xf256[_0x48a6c6];return _0xec8c3a;};'use strict';var MailInteractionEvents=require(_0x6f25('0x0'));var events=[_0x6f25('0x1'),_0x6f25('0x2'),_0x6f25('0x3')];function createListener(_0x5b4a38,_0x531f5b){return function(_0x3800a6){_0x531f5b['emit'](_0x5b4a38,_0x3800a6);};}function removeListener(_0x41c910,_0x217d14){return function(){MailInteractionEvents['removeListener'](_0x41c910,_0x217d14);};}exports[_0x6f25('0x4')]=function(_0x1c0f97){for(var _0x143e52=0x0,_0x4c18a9=events[_0x6f25('0x5')];_0x143e52<_0x4c18a9;_0x143e52++){var _0x102ac4=events[_0x143e52];var _0x566c72=createListener('mailInteraction:'+_0x102ac4,_0x1c0f97);MailInteractionEvents['on'](_0x102ac4,_0x566c72);}}; \ No newline at end of file +var _0xfa6a=['length','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xfa6a,0x79));var _0xafa6=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfa6a[_0x29d94e];return _0x106237;};'use strict';var MailInteractionEvents=require(_0xafa6('0x0'));var events=[_0xafa6('0x1'),_0xafa6('0x2'),'update'];function createListener(_0x80d007,_0x3748eb){return function(_0x911555){_0x3748eb[_0xafa6('0x3')](_0x80d007,_0x911555);};}function removeListener(_0x1fe8d5,_0x54f3d9){return function(){MailInteractionEvents[_0xafa6('0x4')](_0x1fe8d5,_0x54f3d9);};}exports['register']=function(_0x2e51d1){for(var _0xc8bdf9=0x0,_0x32dbf1=events[_0xafa6('0x5')];_0xc8bdf9<_0x32dbf1;_0xc8bdf9++){var _0x5cc727=events[_0xc8bdf9];var _0x29ed8b=createListener('mailInteraction:'+_0x5cc727,_0x2e51d1);MailInteractionEvents['on'](_0x5cc727,_0x29ed8b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 466bd35..c8b2731 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 _0xc263=['get','/describe','describe','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0xb2af00,_0x4b53fd){var _0x5caf30=function(_0x5170b1){while(--_0x5170b1){_0xb2af00['push'](_0xb2af00['shift']());}};_0x5caf30(++_0x4b53fd);}(_0xc263,0x171));var _0x3c26=function(_0x5dfe9c,_0x283962){_0x5dfe9c=_0x5dfe9c-0x0;var _0x1b2591=_0xc263[_0x5dfe9c];return _0x1b2591;};'use strict';var multer=require(_0x3c26('0x0'));var util=require('util');var path=require(_0x3c26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c26('0x2'));var router=express[_0x3c26('0x3')]();var fs_extra=require(_0x3c26('0x4'));var auth=require(_0x3c26('0x5'));var interaction=require(_0x3c26('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x3c26('0x7')](),controller[_0x3c26('0x8')]);router[_0x3c26('0x9')](_0x3c26('0xa'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xb')]);router[_0x3c26('0x9')]('/:id',auth[_0x3c26('0x7')](),controller[_0x3c26('0xc')]);router[_0x3c26('0x9')](_0x3c26('0xd'),auth[_0x3c26('0x7')](),controller[_0x3c26('0xe')]);router[_0x3c26('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3c26('0x10'),_0x3c26('0x11')),controller[_0x3c26('0x12')]);router[_0x3c26('0x13')](_0x3c26('0x14'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x15')]);router[_0x3c26('0x13')](_0x3c26('0x16'),auth[_0x3c26('0x7')](),controller[_0x3c26('0x17')]);router[_0x3c26('0x13')]('/:id/reject',auth[_0x3c26('0x7')](),controller[_0x3c26('0x18')]);router['delete'](_0x3c26('0x14'),auth['isAuthenticated'](),controller[_0x3c26('0x19')]);module[_0x3c26('0x1a')]=router; \ No newline at end of file +var _0x153f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x153f,0x15b));var _0xf153=function(_0x2ce383,_0x5380cf){_0x2ce383=_0x2ce383-0x0;var _0xdf09c8=_0x153f[_0x2ce383];return _0xdf09c8;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),interaction[_0xf153('0x11')](_0xf153('0x12'),'mailmessage:create'),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x15')]);router[_0xf153('0x14')](_0xf153('0x16'),auth[_0xf153('0xa')](),controller[_0xf153('0x17')]);router['put'](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module[_0xf153('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8503a64..8a62cf3 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 _0xd049=['DATE','ENUM','Email','Chat','sequelize','exports','long','TEXT','medium','BOOLEAN','out','STRING','INTEGER'];(function(_0x3a22e1,_0xc071b8){var _0x3c02fb=function(_0x4f6c08){while(--_0x4f6c08){_0x3a22e1['push'](_0x3a22e1['shift']());}};_0x3c02fb(++_0xc071b8);}(_0xd049,0x108));var _0x9d04=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd049[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x9d04('0x0'));var _=require('lodash');module[_0x9d04('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9d04('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x4'))},'read':{'type':Sequelize[_0x9d04('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9d04('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9d04('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x9d04('0x2'))},'cc':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x2'))},'bcc':{'type':Sequelize[_0x9d04('0x3')](_0x9d04('0x2'))},'subject':{'type':Sequelize[_0x9d04('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x9d04('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9d04('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9d04('0x9')]},'originTo':{'type':Sequelize[_0x9d04('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x9d04('0x2'))},'originChannel':{'type':Sequelize[_0x9d04('0xa')](_0x9d04('0xb'),_0x9d04('0xc')),'defaultValue':_0x9d04('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x57f0=['DATE','ENUM','Chat','Email','sequelize','lodash','exports','TEXT','long','BOOLEAN','STRING'];(function(_0x1b1252,_0x35686e){var _0x253b7b=function(_0x5c405e){while(--_0x5c405e){_0x1b1252['push'](_0x1b1252['shift']());}};_0x253b7b(++_0x35686e);}(_0x57f0,0x164));var _0x057f=function(_0x33ccaf,_0x192235){_0x33ccaf=_0x33ccaf-0x0;var _0x30abf6=_0x57f0[_0x33ccaf];return _0x30abf6;};'use strict';var Sequelize=require(_0x057f('0x0'));var _=require(_0x057f('0x1'));module[_0x057f('0x2')]={'body':{'type':Sequelize[_0x057f('0x3')](_0x057f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x057f('0x3')]('medium')},'read':{'type':Sequelize[_0x057f('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x057f('0x6')](0x1fe)},'from':{'type':Sequelize[_0x057f('0x6')]},'to':{'type':Sequelize[_0x057f('0x3')]('long')},'cc':{'type':Sequelize[_0x057f('0x3')](_0x057f('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x057f('0x4'))},'subject':{'type':Sequelize[_0x057f('0x3')]},'sentAt':{'type':Sequelize[_0x057f('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x057f('0x3')](_0x057f('0x4'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x057f('0x8')]('Email',_0x057f('0x9')),'defaultValue':_0x057f('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b57dc46..79acbb2 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 _0x2e28=['includeAll','include','findAll','rows','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','SIP/%s','channel','motionChannel','accept','fromString','EventManager','reject','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','event','unix','server','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','defaults','redis','localhost','socket.io-emitter','register','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','MailMessage','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x4cc9e2,_0x777206){var _0x520761=function(_0x5a4a73){while(--_0x5a4a73){_0x4cc9e2['push'](_0x4cc9e2['shift']());}};_0x520761(++_0x777206);}(_0x2e28,0x192));var _0x82e2=function(_0x516cc8,_0xfc6c86){_0x516cc8=_0x516cc8-0x0;var _0x97a26c=_0x2e28[_0x516cc8];return _0x97a26c;};'use strict';var emlformat=require(_0x82e2('0x0'));var moment=require('moment');var BPromise=require(_0x82e2('0x1'));var util=require(_0x82e2('0x2'));var path=require(_0x82e2('0x3'));var fs=require('fs');var _=require(_0x82e2('0x4'));var Redis=require(_0x82e2('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x82e2('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x82e2('0x7'))(_0x82e2('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x82e2('0x9')](config[_0x82e2('0xa')],{'host':_0x82e2('0xb'),'port':0x18eb});var socket=require(_0x82e2('0xc'))(new Redis(config[_0x82e2('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x82e2('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x82e2('0xe')][_0x82e2('0xf')]({'port':0x232c});var client9003=jayson[_0x82e2('0xe')][_0x82e2('0xf')]({'port':0x232b});var client9002=jayson[_0x82e2('0xe')][_0x82e2('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1f08ec,_0x5a8155,_0x413ae1,_0x130e75){return new BPromise(function(_0x4f0117,_0xd7a665){var _0x25bd14=_0x130e75||client;return _0x25bd14['request'](_0x1f08ec,_0x413ae1)[_0x82e2('0x10')](function(_0x32bb1e){logger[_0x82e2('0x11')]('MailMessage,\x20%s,\x20%s',_0x5a8155,_0x82e2('0x12'));logger[_0x82e2('0x13')](_0x82e2('0x14'),_0x5a8155,_0x82e2('0x12'),JSON[_0x82e2('0x15')](_0x32bb1e));if(_0x32bb1e['error']){if(_0x32bb1e[_0x82e2('0x16')][_0x82e2('0x17')]===0x1f4){logger[_0x82e2('0x16')]('MailMessage,\x20%s,\x20%s',_0x5a8155,_0x32bb1e[_0x82e2('0x16')][_0x82e2('0x18')]);return _0xd7a665(_0x32bb1e[_0x82e2('0x16')][_0x82e2('0x18')]);}logger[_0x82e2('0x16')](_0x82e2('0x19'),_0x5a8155,_0x32bb1e['error'][_0x82e2('0x18')]);return _0x4f0117(_0x32bb1e['error'][_0x82e2('0x18')]);}else{logger['info'](_0x82e2('0x19'),_0x5a8155,_0x82e2('0x12'));_0x4f0117(_0x32bb1e[_0x82e2('0x1a')]['message']);}})[_0x82e2('0x1b')](function(_0x2259a9){logger[_0x82e2('0x16')](_0x82e2('0x19'),_0x5a8155,_0x2259a9);_0xd7a665(_0x2259a9);});});}function respondWithResult(_0x40c484,_0x17cb31){_0x17cb31=_0x17cb31||0xc8;return function(_0x546dc0){if(_0x546dc0){return _0x40c484[_0x82e2('0x1c')](_0x17cb31)[_0x82e2('0x1d')](_0x546dc0);}};}function respondWithFilteredResult(_0x1047ba,_0x361450){return function(_0x12e460){if(_0x12e460){var _0x497f36=typeof _0x361450[_0x82e2('0x1e')]===_0x82e2('0x1f')&&typeof _0x361450[_0x82e2('0x20')]===_0x82e2('0x1f');var _0x1b1449=_0x12e460['count'];var _0x5c9335=_0x497f36?0x0:_0x361450['offset'];var _0x4a79f5=_0x497f36?_0x12e460[_0x82e2('0x21')]:_0x361450['offset']+_0x361450[_0x82e2('0x20')];var _0x306c9d;if(_0x4a79f5>=_0x1b1449){_0x4a79f5=_0x1b1449;_0x306c9d=0xc8;}else{_0x306c9d=0xce;}_0x1047ba[_0x82e2('0x1c')](_0x306c9d);return _0x1047ba[_0x82e2('0x22')](_0x82e2('0x23'),_0x5c9335+'-'+_0x4a79f5+'/'+_0x1b1449)[_0x82e2('0x1d')](_0x12e460);}return null;};}function saveUpdates(_0x485dc0){return function(_0x8552f){if(_0x8552f){return _0x8552f[_0x82e2('0x24')](_0x485dc0)[_0x82e2('0x10')](function(_0xc1dde0){return _0xc1dde0;});}return null;};}function removeEntity(_0x245e95){return function(_0x4e2038){if(_0x4e2038){return _0x4e2038[_0x82e2('0x25')]()['then'](function(){_0x245e95[_0x82e2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db557){return function(_0x527a83){if(!_0x527a83){_0x2db557['sendStatus'](0x194);}return _0x527a83;};}function handleError(_0x26d3c6,_0x3915c5){_0x3915c5=_0x3915c5||0x1f4;return function(_0x10af13){logger[_0x82e2('0x16')](_0x10af13[_0x82e2('0x26')]);if(_0x10af13['name']){delete _0x10af13[_0x82e2('0x27')];}_0x26d3c6[_0x82e2('0x1c')](_0x3915c5)['send'](_0x10af13);};}exports['index']=function(_0x25847f,_0x59af15){var _0x1ee6e2={},_0xc40b65={},_0x51a056={'count':0x0,'rows':[]};var _0x4abd93=_['map'](db[_0x82e2('0x28')]['rawAttributes'],function(_0x63b51d){return{'name':_0x63b51d[_0x82e2('0x29')],'type':_0x63b51d[_0x82e2('0x2a')][_0x82e2('0x2b')]};});_0xc40b65[_0x82e2('0x2c')]=_[_0x82e2('0x2d')](_0x4abd93,_0x82e2('0x27'));_0xc40b65[_0x82e2('0x2e')]=_[_0x82e2('0x2f')](_0x25847f['query']);_0xc40b65[_0x82e2('0x30')]=_['intersection'](_0xc40b65[_0x82e2('0x2c')],_0xc40b65['query']);_0x1ee6e2[_0x82e2('0x31')]=_[_0x82e2('0x32')](_0xc40b65[_0x82e2('0x2c')],qs[_0x82e2('0x33')](_0x25847f[_0x82e2('0x2e')][_0x82e2('0x33')]));_0x1ee6e2[_0x82e2('0x31')]=_0x1ee6e2[_0x82e2('0x31')]['length']?_0x1ee6e2[_0x82e2('0x31')]:_0xc40b65[_0x82e2('0x2c')];if(!_0x25847f[_0x82e2('0x2e')]['hasOwnProperty'](_0x82e2('0x34'))){_0x1ee6e2[_0x82e2('0x20')]=qs['limit'](_0x25847f[_0x82e2('0x2e')]['limit']);_0x1ee6e2['offset']=qs['offset'](_0x25847f['query'][_0x82e2('0x1e')]);}_0x1ee6e2[_0x82e2('0x35')]=qs[_0x82e2('0x36')](_0x25847f[_0x82e2('0x2e')]['sort']);_0x1ee6e2[_0x82e2('0x37')]=qs[_0x82e2('0x30')](_[_0x82e2('0x38')](_0x25847f[_0x82e2('0x2e')],_0xc40b65['filters']),_0x4abd93);if(_0x25847f[_0x82e2('0x2e')][_0x82e2('0x39')]){_0x1ee6e2[_0x82e2('0x37')]=_[_0x82e2('0x3a')](_0x1ee6e2[_0x82e2('0x37')],{'$or':_['map'](_0x4abd93,function(_0x2378c6){if(_0x2378c6[_0x82e2('0x2a')]!=='VIRTUAL'){var _0x4ae868={};_0x4ae868[_0x2378c6[_0x82e2('0x27')]]={'$like':'%'+_0x25847f[_0x82e2('0x2e')][_0x82e2('0x39')]+'%'};return _0x4ae868;}})});}_0x1ee6e2=_['merge']({},_0x1ee6e2,_0x25847f[_0x82e2('0x3b')]);var _0x1b0a07={'where':_0x1ee6e2['where']};return db[_0x82e2('0x28')][_0x82e2('0x21')](_0x1b0a07)['then'](function(_0x7815ce){_0x51a056[_0x82e2('0x21')]=_0x7815ce;if(_0x25847f[_0x82e2('0x2e')][_0x82e2('0x3c')]){_0x1ee6e2[_0x82e2('0x3d')]=[{'all':!![]}];}return db['MailMessage'][_0x82e2('0x3e')](_0x1ee6e2);})['then'](function(_0x5d78bd){_0x51a056[_0x82e2('0x3f')]=_0x5d78bd;return _0x51a056;})[_0x82e2('0x10')](respondWithFilteredResult(_0x59af15,_0x1ee6e2))['catch'](handleError(_0x59af15,null));};exports[_0x82e2('0x40')]=function(_0x57be45,_0x5720ae){var _0x16c465={'raw':!![],'where':{'id':_0x57be45[_0x82e2('0x41')]['id']}},_0x3c4255={};_0x3c4255[_0x82e2('0x2c')]=_[_0x82e2('0x2f')](db[_0x82e2('0x28')]['rawAttributes']);_0x3c4255[_0x82e2('0x2e')]=_[_0x82e2('0x2f')](_0x57be45[_0x82e2('0x2e')]);_0x3c4255[_0x82e2('0x30')]=_[_0x82e2('0x32')](_0x3c4255[_0x82e2('0x2c')],_0x3c4255[_0x82e2('0x2e')]);_0x16c465[_0x82e2('0x31')]=_[_0x82e2('0x32')](_0x3c4255[_0x82e2('0x2c')],qs[_0x82e2('0x33')](_0x57be45[_0x82e2('0x2e')][_0x82e2('0x33')]));_0x16c465[_0x82e2('0x31')]=_0x16c465[_0x82e2('0x31')][_0x82e2('0x42')]?_0x16c465[_0x82e2('0x31')]:_0x3c4255[_0x82e2('0x2c')];if(_0x57be45[_0x82e2('0x2e')]['includeAll']){_0x16c465[_0x82e2('0x3d')]=[{'all':!![]}];}_0x16c465=_[_0x82e2('0x3a')]({},_0x16c465,_0x57be45[_0x82e2('0x3b')]);return db[_0x82e2('0x28')][_0x82e2('0x43')](_0x16c465)[_0x82e2('0x10')](handleEntityNotFound(_0x5720ae,null))[_0x82e2('0x10')](respondWithResult(_0x5720ae,null))['catch'](handleError(_0x5720ae,null));};exports[_0x82e2('0x24')]=function(_0x17fafa,_0x194f27){if(_0x17fafa[_0x82e2('0x44')]['id']){delete _0x17fafa['body']['id'];}return db[_0x82e2('0x28')]['find']({'where':{'id':_0x17fafa[_0x82e2('0x41')]['id']}})[_0x82e2('0x10')](handleEntityNotFound(_0x194f27,null))[_0x82e2('0x10')](saveUpdates(_0x17fafa[_0x82e2('0x44')],null))[_0x82e2('0x10')](respondWithResult(_0x194f27,null))['catch'](handleError(_0x194f27,null));};exports[_0x82e2('0x25')]=function(_0x3bd402,_0x7e8be3){return db['MailMessage'][_0x82e2('0x43')]({'where':{'id':_0x3bd402['params']['id']}})[_0x82e2('0x10')](handleEntityNotFound(_0x7e8be3,null))[_0x82e2('0x10')](removeEntity(_0x7e8be3,null))[_0x82e2('0x1b')](handleError(_0x7e8be3,null));};exports['describe']=function(_0x1bc84d,_0x440577){return db['MailMessage'][_0x82e2('0x45')]()[_0x82e2('0x10')](respondWithResult(_0x440577,null))[_0x82e2('0x1b')](handleError(_0x440577,null));};exports[_0x82e2('0x46')]=function(_0x556237,_0x59b9e0){return db[_0x82e2('0x28')]['create'](_0x556237[_0x82e2('0x44')])[_0x82e2('0x10')](function(_0x42609f){if(_0x42609f){if(_0x42609f[_0x82e2('0x47')]===_0x82e2('0x48')&&!_0x42609f[_0x82e2('0x49')]){var _0x57c055,_0x35dc36,_0x18ac01;if(_0x556237[_0x82e2('0x44')]['to']){_0x35dc36=_0x556237[_0x82e2('0x44')]['to'][_0x82e2('0x4a')](',')[0x0];}return db[_0x82e2('0x4b')][_0x82e2('0x4c')]({'where':{'id':_0x42609f[_0x82e2('0x4d')]},'include':[{'model':db[_0x82e2('0x4e')],'as':_0x82e2('0x4f'),'include':[{'model':db[_0x82e2('0x50')],'as':_0x82e2('0x51'),'where':{'email':_0x35dc36},'limit':0x1,'order':[[_0x82e2('0x52'),'DESC']]}]},{'model':db[_0x82e2('0x53')],'as':_0x82e2('0x54'),'raw':!![],'include':[{'model':db[_0x82e2('0x55')],'as':_0x82e2('0x55'),'raw':!![]}]}]})[_0x82e2('0x10')](function(_0x1059f3){_0x57c055=_0x1059f3;if(!_0x57c055||!_0x57c055[_0x82e2('0x54')])return;var _0x32aa78=_0x57c055[_0x82e2('0x56')]();if(_0x556237[_0x82e2('0x44')]['attachments']&&_0x556237[_0x82e2('0x44')][_0x82e2('0x57')][_0x82e2('0x42')]){for(var _0x9b042d=0x0;_0x9b042d<_0x556237[_0x82e2('0x44')][_0x82e2('0x57')][_0x82e2('0x42')];_0x9b042d+=0x1){_0x556237[_0x82e2('0x44')]['attachments'][_0x9b042d]={'filename':_0x556237[_0x82e2('0x44')][_0x82e2('0x57')][_0x9b042d][_0x82e2('0x27')],'path':path[_0x82e2('0x58')](config[_0x82e2('0x59')],_0x82e2('0x5a'),_0x556237[_0x82e2('0x44')][_0x82e2('0x57')][_0x9b042d][_0x82e2('0x5b')])};}}_0x18ac01={'account':_0x32aa78,'message':_0x556237[_0x82e2('0x44')]};return;})[_0x82e2('0x10')](function(){if(_0x57c055[_0x82e2('0x4f')]){if(_0x57c055[_0x82e2('0x4f')]['Contacts'][_0x82e2('0x42')]){return _0x57c055[_0x82e2('0x4f')][_0x82e2('0x51')][0x0];}else{return db[_0x82e2('0x50')]['create'](_['defaults'](_0x556237['body'],{'firstName':_0x556237[_0x82e2('0x44')]['to'],'email':_0x556237['body']['to'],'phone':_0x556237['body']['to'],'ListId':_0x57c055[_0x82e2('0x5c')]}));}}else{throw new Error(_0x82e2('0x5d'));}})[_0x82e2('0x10')](function(){if(_0x18ac01){return respondWithRpcPromise(_0x82e2('0x5e'),_0x82e2('0x5f'),_0x18ac01,client9003)[_0x82e2('0x10')](function(_0x45ee86){return _0x42609f[_0x82e2('0x24')]({'read':!![],'messageId':_0x45ee86[_0x82e2('0x60')],'sentAt':moment()[_0x82e2('0x61')](_0x82e2('0x62'))});})[_0x82e2('0x1b')](function(_0x5aa38a){logger[_0x82e2('0x16')]('%s',JSON[_0x82e2('0x15')](_0x5aa38a));return _0x42609f;});}return _0x42609f;});}return _0x42609f;}})['then'](respondWithResult(_0x59b9e0,0xc9))['catch'](handleError(_0x59b9e0,null));};exports['accept']=function(_0x5917d1,_0x491e77){var _0x1114f8={'agent':{},'channel':_0x82e2('0x63')};if(_0x5917d1[_0x82e2('0x44')]['id']){delete _0x5917d1['body']['id'];}_0x5917d1[_0x82e2('0x44')][_0x82e2('0x64')]=!![];_0x5917d1['body']['readAt']=moment()[_0x82e2('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x5917d1[_0x82e2('0x44')]['UserId']=_0x5917d1[_0x82e2('0x44')][_0x82e2('0x65')]||_0x5917d1[_0x82e2('0x66')]['id'];_0x1114f8[_0x82e2('0x67')]['id']=_0x5917d1[_0x82e2('0x44')][_0x82e2('0x65')];return db[_0x82e2('0x28')][_0x82e2('0x43')]({'where':{'id':_0x5917d1[_0x82e2('0x41')]['id'],'UserId':null}})[_0x82e2('0x10')](handleEntityNotFound(_0x491e77,null))[_0x82e2('0x10')](saveUpdates(_0x5917d1[_0x82e2('0x44')],null))[_0x82e2('0x10')](function(_0x5afb57){if(_0x5afb57){_0x1114f8[_0x82e2('0x18')]=_0x5afb57[_0x82e2('0x68')]({'plain':!![]});return db[_0x82e2('0x69')][_0x82e2('0x43')]({'where':{'id':_0x5afb57[_0x82e2('0x6a')]}});}return null;})[_0x82e2('0x10')](handleEntityNotFound(_0x491e77,null))[_0x82e2('0x10')](function(_0x3fffe4){if(_0x3fffe4){return _0x3fffe4['update']({'UserId':_0x5917d1[_0x82e2('0x44')]['UserId'],'read1stAt':_[_0x82e2('0x6b')](_0x3fffe4[_0x82e2('0x6c')])?moment()['format'](_0x82e2('0x62')):undefined});}return null;})[_0x82e2('0x10')](function(_0x262285){if(_0x262285){_0x1114f8['interaction']=_0x262285['get']({'plain':!![]});interaction_log[_0x82e2('0x11')](_0x82e2('0x6d'),_0x5917d1[_0x82e2('0x66')]['id'],_0x5917d1['user'][_0x82e2('0x27')],_0x5917d1[_0x82e2('0x66')]['role'],_0x1114f8[_0x82e2('0x6e')]['id'],_0x5917d1['body']?JSON[_0x82e2('0x15')](_0x5917d1[_0x82e2('0x44')]):_0x82e2('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1114f8);}return null;})[_0x82e2('0x10')](function(_0x1918d9){var _0x9aead4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1918d9[_0x82e2('0x18')][_0x82e2('0x70')];return db[_0x82e2('0x71')][_0x82e2('0x2e')](_0x9aead4,{'type':db[_0x82e2('0x72')][_0x82e2('0x73')][_0x82e2('0x74')],'raw':!![]})[_0x82e2('0x10')](function(_0x1dc474){return _0x1dc474;});})['then'](function(_0x109cc0){if(_0x109cc0){_0x1114f8[_0x82e2('0x18')][_0x82e2('0x75')]=_0x109cc0[0x0];if(!_0x5917d1[_0x82e2('0x44')][_0x82e2('0x65')])return;return db['User'][_0x82e2('0x43')]({'where':{'id':_0x5917d1[_0x82e2('0x44')][_0x82e2('0x65')],'role':_0x82e2('0x67')},'attributes':['id',_0x82e2('0x27'),_0x82e2('0x76'),_0x82e2('0x77'),'internal'],'raw':!![]});}return null;})[_0x82e2('0x10')](function(_0x14f69c){if(!_0x14f69c)return null;_0x1114f8[_0x82e2('0x18')][_0x82e2('0x67')]=_0x14f69c;return _0x1114f8;})[_0x82e2('0x10')](function(_0x30829a){if(_0x30829a){if(_0x5917d1[_0x82e2('0x44')]['manual']){_0x1114f8['message'][_0x82e2('0x78')]=util[_0x82e2('0x61')](_0x82e2('0x79'),_0x5917d1[_0x82e2('0x66')][_0x82e2('0x27')]);_0x1114f8[_0x82e2('0x18')]['channel']=_0x1114f8[_0x82e2('0x7a')];_0x1114f8['message'][_0x82e2('0x7b')]=_0x1114f8[_0x82e2('0x7a')];_0x1114f8[_0x82e2('0x18')]['event']=_0x82e2('0x7c');_0x1114f8[_0x82e2('0x18')][_0x82e2('0x44')]=htmlToText[_0x82e2('0x7d')](_0x1114f8[_0x82e2('0x18')][_0x82e2('0x44')]);return respondWithRpcPromise(_0x82e2('0x7e'),_0x82e2('0x7e'),{'event':'acceptmessage','message':_0x1114f8[_0x82e2('0x18')]},client9002)['then'](function(){return _0x1114f8;});}return _0x1114f8;}return null;})['then'](respondWithResult(_0x491e77,null))['catch'](handleError(_0x491e77,null));};exports[_0x82e2('0x7f')]=function(_0xf75ca2,_0x6f612e){var _0x56ebff={'agent':{},'channel':_0x82e2('0x63')};if(_0xf75ca2[_0x82e2('0x44')]['id']){delete _0xf75ca2['body']['id'];}_0xf75ca2[_0x82e2('0x44')]['UserId']=_0xf75ca2[_0x82e2('0x44')][_0x82e2('0x65')]||_0xf75ca2[_0x82e2('0x66')]['id'];_0x56ebff['agent']['id']=_0xf75ca2['body']['UserId'];return db[_0x82e2('0x28')][_0x82e2('0x43')]({'where':{'id':_0xf75ca2[_0x82e2('0x41')]['id'],'UserId':null}})[_0x82e2('0x10')](handleEntityNotFound(_0x6f612e,null))[_0x82e2('0x10')](function(_0x5036f8){if(_0x5036f8){_0x56ebff[_0x82e2('0x18')]=_0x5036f8[_0x82e2('0x68')]({'plain':!![]});return db[_0x82e2('0x69')]['find']({'where':{'id':_0x5036f8['MailInteractionId']}});}return null;})[_0x82e2('0x10')](handleEntityNotFound(_0x6f612e,null))['then'](function(_0x16fb17){if(_0x16fb17){_0x56ebff[_0x82e2('0x6e')]=_0x16fb17[_0x82e2('0x68')]({'plain':!![]});interaction_log[_0x82e2('0x11')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf75ca2[_0x82e2('0x66')]['id'],_0xf75ca2[_0x82e2('0x66')]['name'],_0xf75ca2[_0x82e2('0x66')][_0x82e2('0x80')],_0x56ebff[_0x82e2('0x6e')]['id'],_0xf75ca2['body']?JSON['stringify'](_0xf75ca2[_0x82e2('0x44')]):_0x82e2('0x6f'));return respondWithRpcPromise(_0x82e2('0x81'),_0x82e2('0x82'),_0x56ebff);}return null;})['then'](function(_0x5da88e){var _0x5e90d2=_0x82e2('0x83')+_0x5da88e[_0x82e2('0x18')][_0x82e2('0x70')];return db[_0x82e2('0x71')]['query'](_0x5e90d2,{'type':db[_0x82e2('0x72')][_0x82e2('0x73')][_0x82e2('0x74')],'raw':!![]})[_0x82e2('0x10')](function(_0x3a3d2c){return _0x3a3d2c;});})[_0x82e2('0x10')](function(_0x3446a7){if(_0x3446a7){_0x56ebff[_0x82e2('0x18')]['contact']=_0x3446a7[0x0];if(!_0xf75ca2[_0x82e2('0x44')][_0x82e2('0x65')])return;return db['User']['find']({'where':{'id':_0xf75ca2[_0x82e2('0x44')][_0x82e2('0x65')],'role':_0x82e2('0x67')},'attributes':['id',_0x82e2('0x27'),_0x82e2('0x76'),'email',_0x82e2('0x84')],'raw':!![]});}return null;})[_0x82e2('0x10')](function(_0x557c70){if(!_0x557c70)return null;_0x56ebff[_0x82e2('0x18')][_0x82e2('0x67')]=_0x557c70;return _0x56ebff;})['then'](function(_0x3d57d1){if(_0x3d57d1){_0x3d57d1['message']['interface']=util[_0x82e2('0x61')](_0x82e2('0x79'),_0xf75ca2[_0x82e2('0x66')]['name']);_0x3d57d1[_0x82e2('0x18')][_0x82e2('0x7a')]=_0x56ebff[_0x82e2('0x7a')];_0x3d57d1[_0x82e2('0x18')][_0x82e2('0x7b')]=_0x56ebff[_0x82e2('0x7a')];_0x3d57d1[_0x82e2('0x18')][_0x82e2('0x85')]='reject';_0x3d57d1[_0x82e2('0x18')][_0x82e2('0x44')]=htmlToText['fromString'](_0x56ebff[_0x82e2('0x18')]['body']);respondWithRpcPromise(_0x82e2('0x7e'),_0x82e2('0x7e'),{'event':'rejectmessage','message':_0x3d57d1[_0x82e2('0x18')]},client9002);return _0x56ebff;}return null;})[_0x82e2('0x10')](respondWithResult(_0x6f612e,null))['catch'](handleError(_0x6f612e,null));};exports['download']=function(_0x30eaf0,_0x7b4e16){var _0x5365b0=moment()[_0x82e2('0x86')]()['toString']();var _0x553015=path[_0x82e2('0x58')](config[_0x82e2('0x59')],_0x82e2('0x87'),'files','tmp');var _0x20e6b0=path[_0x82e2('0x58')](config[_0x82e2('0x59')],_0x82e2('0x87'),'files','attachments');var _0x3895f3=util[_0x82e2('0x61')](_0x82e2('0x88'),_0x5365b0);return db[_0x82e2('0x28')][_0x82e2('0x43')]({'where':{'id':_0x30eaf0['params']['id']},'attributes':['id',_0x82e2('0x44'),_0x82e2('0x89'),'to','cc',_0x82e2('0x8a'),_0x82e2('0x8b'),'createdAt'],'include':_0x30eaf0[_0x82e2('0x2e')][_0x82e2('0x57')]?[{'model':db[_0x82e2('0x8c')],'as':_0x82e2('0x8d')}]:undefined})[_0x82e2('0x10')](handleEntityNotFound(_0x7b4e16,null))[_0x82e2('0x10')](function(_0x1c54da){if(_0x1c54da){var _0xbce54c=_0x1c54da;var _0x3f9c15={'from':_0xbce54c[_0x82e2('0x89')],'to':_0xbce54c['to'],'subject':_0xbce54c['subject'],'html':htmlEntities[_0x82e2('0x8e')](_0xbce54c[_0x82e2('0x44')]),'headers':{'Date':moment(_0xbce54c[_0x82e2('0x8f')])[_0x82e2('0x61')](_0x82e2('0x90'))},'attachments':[]};if(_0x1c54da['cc']){_0x3f9c15[_0x82e2('0x91')]['Cc']=_0x1c54da['cc'];}if(_0x1c54da[_0x82e2('0x8a')]){_0x3f9c15[_0x82e2('0x91')][_0x82e2('0x92')]=_0x1c54da[_0x82e2('0x8a')];}return new BPromise(function(_0x37c5ee,_0xa3b9){if(_0x1c54da['Attachments']){for(var _0x3cbdab=0x0;_0x3cbdab<_0x1c54da[_0x82e2('0x8d')]['length'];_0x3cbdab++){var _0x498cd5=_0x1c54da['Attachments'][_0x3cbdab];var _0x504800=path[_0x82e2('0x58')](_0x20e6b0,_0x498cd5['basename']);if(fs[_0x82e2('0x93')](_0x504800)){_0x3f9c15[_0x82e2('0x57')][_0x82e2('0x94')]({'name':_0x498cd5[_0x82e2('0x27')],'contentType':_0x498cd5[_0x82e2('0x2a')],'data':fs[_0x82e2('0x95')](_0x504800)});}}}emlformat[_0x82e2('0x96')](_0x3f9c15,function(_0x465998,_0x98cb11){if(_0x465998)return _0xa3b9(_0x465998);fs[_0x82e2('0x97')](path['join'](_0x553015,_0x3895f3),_0x98cb11);return _0x37c5ee(_0x98cb11);});});}})[_0x82e2('0x10')](function(_0x3ec959){if(_0x3ec959){return _0x7b4e16[_0x82e2('0x98')](path[_0x82e2('0x58')](_0x553015,_0x3895f3),_0x3895f3,function(_0x4dab3d){if(!_0x4dab3d)fs[_0x82e2('0x99')](path[_0x82e2('0x58')](_0x553015,_0x3895f3));});}})[_0x82e2('0x1b')](handleError(_0x7b4e16,null));}; \ No newline at end of file +var _0x301e=['List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','motionChannel','rejectmessage','unix','toString','join','root','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','update','destroy','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','basename'];(function(_0x144b74,_0x3fda27){var _0x11bffd=function(_0x2e6d01){while(--_0x2e6d01){_0x144b74['push'](_0x144b74['shift']());}};_0x11bffd(++_0x3fda27);}(_0x301e,0x189));var _0xe301=function(_0x1e3a4f,_0x32b823){_0x1e3a4f=_0x1e3a4f-0x0;var _0x54d1c9=_0x301e[_0x1e3a4f];return _0x54d1c9;};'use strict';var emlformat=require(_0xe301('0x0'));var moment=require(_0xe301('0x1'));var BPromise=require(_0xe301('0x2'));var util=require('util');var path=require(_0xe301('0x3'));var fs=require('fs');var _=require(_0xe301('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xe301('0x5'));var qs=require(_0xe301('0x6'));var logger=require(_0xe301('0x7'))(_0xe301('0x8'));var interaction_log=require(_0xe301('0x7'))(_0xe301('0x9'));var config=require(_0xe301('0xa'));var db=require(_0xe301('0xb'))['db'];config[_0xe301('0xc')]=_[_0xe301('0xd')](config['redis'],{'host':_0xe301('0xe'),'port':0x18eb});var socket=require(_0xe301('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xe301('0x10'));require(_0xe301('0x11'))[_0xe301('0x12')](socket);var jayson=require(_0xe301('0x13'));var client=jayson[_0xe301('0x14')][_0xe301('0x15')]({'port':0x232c});var client9003=jayson[_0xe301('0x14')][_0xe301('0x15')]({'port':0x232b});var client9002=jayson['client'][_0xe301('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x38b6d6,_0x5c34f6,_0x237f34,_0x1a9b0e){return new BPromise(function(_0x5d24e7,_0x142644){var _0x4418b8=_0x1a9b0e||client;return _0x4418b8['request'](_0x38b6d6,_0x237f34)[_0xe301('0x16')](function(_0x2bd0d9){logger[_0xe301('0x17')](_0xe301('0x18'),_0x5c34f6,_0xe301('0x19'));logger[_0xe301('0x1a')](_0xe301('0x1b'),_0x5c34f6,_0xe301('0x19'),JSON[_0xe301('0x1c')](_0x2bd0d9));if(_0x2bd0d9[_0xe301('0x1d')]){if(_0x2bd0d9[_0xe301('0x1d')]['code']===0x1f4){logger[_0xe301('0x1d')](_0xe301('0x18'),_0x5c34f6,_0x2bd0d9[_0xe301('0x1d')]['message']);return _0x142644(_0x2bd0d9[_0xe301('0x1d')][_0xe301('0x1e')]);}logger[_0xe301('0x1d')](_0xe301('0x18'),_0x5c34f6,_0x2bd0d9['error'][_0xe301('0x1e')]);return _0x5d24e7(_0x2bd0d9[_0xe301('0x1d')][_0xe301('0x1e')]);}else{logger[_0xe301('0x17')](_0xe301('0x18'),_0x5c34f6,'request\x20sent');_0x5d24e7(_0x2bd0d9[_0xe301('0x1f')]['message']);}})[_0xe301('0x20')](function(_0x303d80){logger['error'](_0xe301('0x18'),_0x5c34f6,_0x303d80);_0x142644(_0x303d80);});});}function respondWithResult(_0x484763,_0x1a71b9){_0x1a71b9=_0x1a71b9||0xc8;return function(_0x3e1ff1){if(_0x3e1ff1){return _0x484763['status'](_0x1a71b9)[_0xe301('0x21')](_0x3e1ff1);}};}function respondWithFilteredResult(_0x4a2a47,_0x5246da){return function(_0x14e3dc){if(_0x14e3dc){var _0x542426=typeof _0x5246da[_0xe301('0x22')]===_0xe301('0x23')&&typeof _0x5246da['limit']===_0xe301('0x23');var _0x37b249=_0x14e3dc[_0xe301('0x24')];var _0x56d178=_0x542426?0x0:_0x5246da['offset'];var _0x5b83eb=_0x542426?_0x14e3dc[_0xe301('0x24')]:_0x5246da[_0xe301('0x22')]+_0x5246da[_0xe301('0x25')];var _0x5c584b;if(_0x5b83eb>=_0x37b249){_0x5b83eb=_0x37b249;_0x5c584b=0xc8;}else{_0x5c584b=0xce;}_0x4a2a47[_0xe301('0x26')](_0x5c584b);return _0x4a2a47[_0xe301('0x27')](_0xe301('0x28'),_0x56d178+'-'+_0x5b83eb+'/'+_0x37b249)['json'](_0x14e3dc);}return null;};}function saveUpdates(_0x412ba7){return function(_0x45bf3a){if(_0x45bf3a){return _0x45bf3a[_0xe301('0x29')](_0x412ba7)['then'](function(_0xa5ad12){return _0xa5ad12;});}return null;};}function removeEntity(_0x272404){return function(_0x5bebe4){if(_0x5bebe4){return _0x5bebe4[_0xe301('0x2a')]()[_0xe301('0x16')](function(){_0x272404[_0xe301('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7696c){return function(_0x57d4dc){if(!_0x57d4dc){_0xb7696c['sendStatus'](0x194);}return _0x57d4dc;};}function handleError(_0x581a8c,_0x37814a){_0x37814a=_0x37814a||0x1f4;return function(_0x192dae){logger[_0xe301('0x1d')](_0x192dae[_0xe301('0x2b')]);if(_0x192dae['name']){delete _0x192dae[_0xe301('0x2c')];}_0x581a8c['status'](_0x37814a)[_0xe301('0x2d')](_0x192dae);};}exports[_0xe301('0x2e')]=function(_0x34b7aa,_0x2d8d90){var _0x19970f={},_0x41e062={},_0xfa24c3={'count':0x0,'rows':[]};var _0x1a2bd0=_['map'](db[_0xe301('0x2f')][_0xe301('0x30')],function(_0x15e842){return{'name':_0x15e842[_0xe301('0x31')],'type':_0x15e842['type'][_0xe301('0x32')]};});_0x41e062[_0xe301('0x33')]=_['map'](_0x1a2bd0,_0xe301('0x2c'));_0x41e062[_0xe301('0x34')]=_['keys'](_0x34b7aa['query']);_0x41e062[_0xe301('0x35')]=_[_0xe301('0x36')](_0x41e062[_0xe301('0x33')],_0x41e062[_0xe301('0x34')]);_0x19970f['attributes']=_[_0xe301('0x36')](_0x41e062['model'],qs[_0xe301('0x37')](_0x34b7aa['query'][_0xe301('0x37')]));_0x19970f[_0xe301('0x38')]=_0x19970f[_0xe301('0x38')][_0xe301('0x39')]?_0x19970f['attributes']:_0x41e062[_0xe301('0x33')];if(!_0x34b7aa[_0xe301('0x34')][_0xe301('0x3a')]('nolimit')){_0x19970f['limit']=qs[_0xe301('0x25')](_0x34b7aa[_0xe301('0x34')][_0xe301('0x25')]);_0x19970f[_0xe301('0x22')]=qs[_0xe301('0x22')](_0x34b7aa[_0xe301('0x34')][_0xe301('0x22')]);}_0x19970f['order']=qs['sort'](_0x34b7aa[_0xe301('0x34')]['sort']);_0x19970f['where']=qs[_0xe301('0x35')](_['pick'](_0x34b7aa[_0xe301('0x34')],_0x41e062[_0xe301('0x35')]),_0x1a2bd0);if(_0x34b7aa[_0xe301('0x34')]['filter']){_0x19970f[_0xe301('0x3b')]=_[_0xe301('0x3c')](_0x19970f['where'],{'$or':_['map'](_0x1a2bd0,function(_0x553801){if(_0x553801[_0xe301('0x3d')]!==_0xe301('0x3e')){var _0x55ea45={};_0x55ea45[_0x553801[_0xe301('0x2c')]]={'$like':'%'+_0x34b7aa[_0xe301('0x34')]['filter']+'%'};return _0x55ea45;}})});}_0x19970f=_[_0xe301('0x3c')]({},_0x19970f,_0x34b7aa[_0xe301('0x3f')]);var _0x350b1d={'where':_0x19970f['where']};return db[_0xe301('0x2f')][_0xe301('0x24')](_0x350b1d)[_0xe301('0x16')](function(_0x3567a2){_0xfa24c3[_0xe301('0x24')]=_0x3567a2;if(_0x34b7aa[_0xe301('0x34')][_0xe301('0x40')]){_0x19970f['include']=[{'all':!![]}];}return db[_0xe301('0x2f')][_0xe301('0x41')](_0x19970f);})[_0xe301('0x16')](function(_0x19c627){_0xfa24c3[_0xe301('0x42')]=_0x19c627;return _0xfa24c3;})[_0xe301('0x16')](respondWithFilteredResult(_0x2d8d90,_0x19970f))[_0xe301('0x20')](handleError(_0x2d8d90,null));};exports[_0xe301('0x43')]=function(_0x19befe,_0x5e7584){var _0x2defff={'raw':!![],'where':{'id':_0x19befe[_0xe301('0x44')]['id']}},_0x3b0ca7={};_0x3b0ca7[_0xe301('0x33')]=_[_0xe301('0x45')](db['MailMessage']['rawAttributes']);_0x3b0ca7[_0xe301('0x34')]=_[_0xe301('0x45')](_0x19befe[_0xe301('0x34')]);_0x3b0ca7[_0xe301('0x35')]=_[_0xe301('0x36')](_0x3b0ca7[_0xe301('0x33')],_0x3b0ca7[_0xe301('0x34')]);_0x2defff[_0xe301('0x38')]=_[_0xe301('0x36')](_0x3b0ca7[_0xe301('0x33')],qs[_0xe301('0x37')](_0x19befe[_0xe301('0x34')]['fields']));_0x2defff[_0xe301('0x38')]=_0x2defff['attributes'][_0xe301('0x39')]?_0x2defff['attributes']:_0x3b0ca7[_0xe301('0x33')];if(_0x19befe['query'][_0xe301('0x40')]){_0x2defff['include']=[{'all':!![]}];}_0x2defff=_[_0xe301('0x3c')]({},_0x2defff,_0x19befe[_0xe301('0x3f')]);return db[_0xe301('0x2f')][_0xe301('0x46')](_0x2defff)[_0xe301('0x16')](handleEntityNotFound(_0x5e7584,null))['then'](respondWithResult(_0x5e7584,null))[_0xe301('0x20')](handleError(_0x5e7584,null));};exports[_0xe301('0x29')]=function(_0x5399cd,_0x29e1e7){if(_0x5399cd['body']['id']){delete _0x5399cd[_0xe301('0x47')]['id'];}return db['MailMessage'][_0xe301('0x46')]({'where':{'id':_0x5399cd['params']['id']}})[_0xe301('0x16')](handleEntityNotFound(_0x29e1e7,null))[_0xe301('0x16')](saveUpdates(_0x5399cd[_0xe301('0x47')],null))[_0xe301('0x16')](respondWithResult(_0x29e1e7,null))[_0xe301('0x20')](handleError(_0x29e1e7,null));};exports['destroy']=function(_0xfcbc3c,_0x5b94ad){return db[_0xe301('0x2f')][_0xe301('0x46')]({'where':{'id':_0xfcbc3c[_0xe301('0x44')]['id']}})[_0xe301('0x16')](handleEntityNotFound(_0x5b94ad,null))['then'](removeEntity(_0x5b94ad,null))[_0xe301('0x20')](handleError(_0x5b94ad,null));};exports[_0xe301('0x48')]=function(_0x3aa91c,_0x3e5f0f){return db['MailMessage'][_0xe301('0x48')]()[_0xe301('0x16')](respondWithResult(_0x3e5f0f,null))[_0xe301('0x20')](handleError(_0x3e5f0f,null));};exports[_0xe301('0x49')]=function(_0xf60d02,_0x1365a2){return db['MailMessage'][_0xe301('0x49')](_0xf60d02[_0xe301('0x47')])[_0xe301('0x16')](function(_0x497d4e){if(_0x497d4e){if(_0x497d4e[_0xe301('0x4a')]===_0xe301('0x4b')&&!_0x497d4e['secret']){var _0x3934c8,_0x58da2b,_0x4ecf0a;if(_0xf60d02['body']['to']){_0x58da2b=_0xf60d02['body']['to'][_0xe301('0x4c')](',')[0x0];}return db[_0xe301('0x4d')][_0xe301('0x4e')]({'where':{'id':_0x497d4e[_0xe301('0x4f')]},'include':[{'model':db[_0xe301('0x50')],'as':_0xe301('0x51'),'include':[{'model':db[_0xe301('0x52')],'as':_0xe301('0x53'),'where':{'email':_0x58da2b},'limit':0x1,'order':[[_0xe301('0x54'),_0xe301('0x55')]]}]},{'model':db[_0xe301('0x56')],'as':_0xe301('0x57'),'raw':!![],'include':[{'model':db[_0xe301('0x58')],'as':'CloudProvider','raw':!![]}]}]})[_0xe301('0x16')](function(_0x5d7218){_0x3934c8=_0x5d7218;if(!_0x3934c8||!_0x3934c8[_0xe301('0x57')])return;var _0x2b92a7=_0x3934c8[_0xe301('0x59')]();if(_0xf60d02[_0xe301('0x47')]['attachments']&&_0xf60d02['body']['attachments']['length']){for(var _0x3b89e4=0x0;_0x3b89e4<_0xf60d02[_0xe301('0x47')][_0xe301('0x5a')][_0xe301('0x39')];_0x3b89e4+=0x1){_0xf60d02[_0xe301('0x47')][_0xe301('0x5a')][_0x3b89e4]={'filename':_0xf60d02[_0xe301('0x47')][_0xe301('0x5a')][_0x3b89e4][_0xe301('0x2c')],'path':path['join'](config['root'],_0xe301('0x5b'),_0xf60d02[_0xe301('0x47')][_0xe301('0x5a')][_0x3b89e4][_0xe301('0x5c')])};}}_0x4ecf0a={'account':_0x2b92a7,'message':_0xf60d02[_0xe301('0x47')]};return;})[_0xe301('0x16')](function(){if(_0x3934c8[_0xe301('0x51')]){if(_0x3934c8[_0xe301('0x51')][_0xe301('0x53')]['length']){return _0x3934c8[_0xe301('0x51')][_0xe301('0x53')][0x0];}else{return db[_0xe301('0x52')][_0xe301('0x49')](_['defaults'](_0xf60d02[_0xe301('0x47')],{'firstName':_0xf60d02[_0xe301('0x47')]['to'],'email':_0xf60d02['body']['to'],'phone':_0xf60d02[_0xe301('0x47')]['to'],'ListId':_0x3934c8['ListId']}));}}else{throw new Error(_0xe301('0x5d'));}})['then'](function(){if(_0x4ecf0a){return respondWithRpcPromise(_0xe301('0x5e'),_0xe301('0x5f'),_0x4ecf0a,client9003)[_0xe301('0x16')](function(_0x4b7766){return _0x497d4e[_0xe301('0x29')]({'read':!![],'messageId':_0x4b7766[_0xe301('0x60')],'sentAt':moment()[_0xe301('0x61')](_0xe301('0x62'))});})[_0xe301('0x20')](function(_0x57fe05){logger[_0xe301('0x1d')]('%s',JSON['stringify'](_0x57fe05));return _0x497d4e;});}return _0x497d4e;});}return _0x497d4e;}})[_0xe301('0x16')](respondWithResult(_0x1365a2,0xc9))[_0xe301('0x20')](handleError(_0x1365a2,null));};exports['accept']=function(_0x3f192d,_0x2f5a59){var _0x54ce6b={'agent':{},'channel':_0xe301('0x63')};if(_0x3f192d[_0xe301('0x47')]['id']){delete _0x3f192d[_0xe301('0x47')]['id'];}_0x3f192d[_0xe301('0x47')][_0xe301('0x64')]=!![];_0x3f192d[_0xe301('0x47')]['readAt']=moment()[_0xe301('0x61')](_0xe301('0x62'));_0x3f192d[_0xe301('0x47')]['UserId']=_0x3f192d['body']['UserId']||_0x3f192d['user']['id'];_0x54ce6b['agent']['id']=_0x3f192d[_0xe301('0x47')][_0xe301('0x65')];return db[_0xe301('0x2f')][_0xe301('0x46')]({'where':{'id':_0x3f192d[_0xe301('0x44')]['id'],'UserId':null}})[_0xe301('0x16')](handleEntityNotFound(_0x2f5a59,null))[_0xe301('0x16')](saveUpdates(_0x3f192d[_0xe301('0x47')],null))[_0xe301('0x16')](function(_0x10a8e3){if(_0x10a8e3){_0x54ce6b[_0xe301('0x1e')]=_0x10a8e3[_0xe301('0x66')]({'plain':!![]});return db[_0xe301('0x67')][_0xe301('0x46')]({'where':{'id':_0x10a8e3[_0xe301('0x68')]}});}return null;})[_0xe301('0x16')](handleEntityNotFound(_0x2f5a59,null))[_0xe301('0x16')](function(_0x1071d1){if(_0x1071d1){return _0x1071d1['update']({'UserId':_0x3f192d['body'][_0xe301('0x65')],'read1stAt':_['isNil'](_0x1071d1[_0xe301('0x69')])?moment()[_0xe301('0x61')](_0xe301('0x62')):undefined});}return null;})[_0xe301('0x16')](function(_0x3b8b41){if(_0x3b8b41){_0x54ce6b[_0xe301('0x6a')]=_0x3b8b41['get']({'plain':!![]});interaction_log['info'](_0xe301('0x6b'),_0x3f192d[_0xe301('0x6c')]['id'],_0x3f192d[_0xe301('0x6c')][_0xe301('0x2c')],_0x3f192d[_0xe301('0x6c')]['role'],_0x54ce6b['interaction']['id'],_0x3f192d[_0xe301('0x47')]?JSON[_0xe301('0x1c')](_0x3f192d[_0xe301('0x47')]):_0xe301('0x6d'));return respondWithRpcPromise(_0xe301('0x6e'),_0xe301('0x6f'),_0x54ce6b);}return null;})[_0xe301('0x16')](function(_0xa1bca9){var _0x1c48fb=_0xe301('0x70')+_0xa1bca9[_0xe301('0x1e')][_0xe301('0x71')];return db[_0xe301('0x72')]['query'](_0x1c48fb,{'type':db['Sequelize'][_0xe301('0x73')][_0xe301('0x74')],'raw':!![]})[_0xe301('0x16')](function(_0xdd2adf){return _0xdd2adf;});})[_0xe301('0x16')](function(_0x259d60){if(_0x259d60){_0x54ce6b[_0xe301('0x1e')][_0xe301('0x75')]=_0x259d60[0x0];if(!_0x3f192d[_0xe301('0x47')][_0xe301('0x65')])return;return db[_0xe301('0x76')][_0xe301('0x46')]({'where':{'id':_0x3f192d[_0xe301('0x47')][_0xe301('0x65')],'role':'agent'},'attributes':['id',_0xe301('0x2c'),_0xe301('0x77'),_0xe301('0x78'),_0xe301('0x79')],'raw':!![]});}return null;})[_0xe301('0x16')](function(_0x1f16b4){if(!_0x1f16b4)return null;_0x54ce6b[_0xe301('0x1e')][_0xe301('0x7a')]=_0x1f16b4;return _0x54ce6b;})[_0xe301('0x16')](function(_0x1a70db){if(_0x1a70db){if(_0x3f192d[_0xe301('0x47')][_0xe301('0x7b')]){_0x54ce6b[_0xe301('0x1e')][_0xe301('0x7c')]=util[_0xe301('0x61')](_0xe301('0x7d'),_0x3f192d[_0xe301('0x6c')][_0xe301('0x2c')]);_0x54ce6b[_0xe301('0x1e')][_0xe301('0x7e')]=_0x54ce6b[_0xe301('0x7e')];_0x54ce6b['message']['motionChannel']=_0x54ce6b[_0xe301('0x7e')];_0x54ce6b[_0xe301('0x1e')][_0xe301('0x7f')]=_0xe301('0x80');_0x54ce6b[_0xe301('0x1e')][_0xe301('0x47')]=htmlToText[_0xe301('0x81')](_0x54ce6b[_0xe301('0x1e')][_0xe301('0x47')]);return respondWithRpcPromise(_0xe301('0x82'),_0xe301('0x82'),{'event':'acceptmessage','message':_0x54ce6b[_0xe301('0x1e')]},client9002)['then'](function(){return _0x54ce6b;});}return _0x54ce6b;}return null;})[_0xe301('0x16')](respondWithResult(_0x2f5a59,null))[_0xe301('0x20')](handleError(_0x2f5a59,null));};exports[_0xe301('0x83')]=function(_0x20aade,_0x210833){var _0x38a5e5={'agent':{},'channel':_0xe301('0x63')};if(_0x20aade[_0xe301('0x47')]['id']){delete _0x20aade['body']['id'];}_0x20aade[_0xe301('0x47')]['UserId']=_0x20aade[_0xe301('0x47')][_0xe301('0x65')]||_0x20aade[_0xe301('0x6c')]['id'];_0x38a5e5['agent']['id']=_0x20aade[_0xe301('0x47')][_0xe301('0x65')];return db[_0xe301('0x2f')][_0xe301('0x46')]({'where':{'id':_0x20aade[_0xe301('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x210833,null))[_0xe301('0x16')](function(_0x27bff7){if(_0x27bff7){_0x38a5e5['message']=_0x27bff7['get']({'plain':!![]});return db[_0xe301('0x67')][_0xe301('0x46')]({'where':{'id':_0x27bff7['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x210833,null))['then'](function(_0x5c16ed){if(_0x5c16ed){_0x38a5e5[_0xe301('0x6a')]=_0x5c16ed[_0xe301('0x66')]({'plain':!![]});interaction_log['info'](_0xe301('0x84'),_0x20aade['user']['id'],_0x20aade[_0xe301('0x6c')][_0xe301('0x2c')],_0x20aade['user'][_0xe301('0x85')],_0x38a5e5['interaction']['id'],_0x20aade[_0xe301('0x47')]?JSON['stringify'](_0x20aade[_0xe301('0x47')]):_0xe301('0x6d'));return respondWithRpcPromise(_0xe301('0x86'),_0xe301('0x87'),_0x38a5e5);}return null;})[_0xe301('0x16')](function(_0x3dbcd3){var _0x1d9442=_0xe301('0x70')+_0x3dbcd3[_0xe301('0x1e')][_0xe301('0x71')];return db[_0xe301('0x72')]['query'](_0x1d9442,{'type':db[_0xe301('0x88')][_0xe301('0x73')][_0xe301('0x74')],'raw':!![]})[_0xe301('0x16')](function(_0x47676e){return _0x47676e;});})[_0xe301('0x16')](function(_0xc0ef8b){if(_0xc0ef8b){_0x38a5e5['message'][_0xe301('0x75')]=_0xc0ef8b[0x0];if(!_0x20aade['body'][_0xe301('0x65')])return;return db['User']['find']({'where':{'id':_0x20aade[_0xe301('0x47')]['UserId'],'role':_0xe301('0x7a')},'attributes':['id',_0xe301('0x2c'),_0xe301('0x77'),_0xe301('0x78'),_0xe301('0x79')],'raw':!![]});}return null;})['then'](function(_0x548402){if(!_0x548402)return null;_0x38a5e5[_0xe301('0x1e')][_0xe301('0x7a')]=_0x548402;return _0x38a5e5;})[_0xe301('0x16')](function(_0x5c1cc0){if(_0x5c1cc0){_0x5c1cc0[_0xe301('0x1e')][_0xe301('0x7c')]=util['format']('SIP/%s',_0x20aade['user']['name']);_0x5c1cc0[_0xe301('0x1e')]['channel']=_0x38a5e5[_0xe301('0x7e')];_0x5c1cc0[_0xe301('0x1e')][_0xe301('0x89')]=_0x38a5e5[_0xe301('0x7e')];_0x5c1cc0[_0xe301('0x1e')][_0xe301('0x7f')]=_0xe301('0x83');_0x5c1cc0['message'][_0xe301('0x47')]=htmlToText[_0xe301('0x81')](_0x38a5e5[_0xe301('0x1e')][_0xe301('0x47')]);respondWithRpcPromise(_0xe301('0x82'),'EventManager',{'event':_0xe301('0x8a'),'message':_0x5c1cc0[_0xe301('0x1e')]},client9002);return _0x38a5e5;}return null;})['then'](respondWithResult(_0x210833,null))['catch'](handleError(_0x210833,null));};exports['download']=function(_0x4dcbc6,_0x235e35){var _0x4b57a7=moment()[_0xe301('0x8b')]()[_0xe301('0x8c')]();var _0x514d3b=path[_0xe301('0x8d')](config[_0xe301('0x8e')],_0xe301('0x8f'),_0xe301('0x90'),_0xe301('0x91'));var _0xda96be=path[_0xe301('0x8d')](config['root'],_0xe301('0x8f'),_0xe301('0x90'),'attachments');var _0x3cfeeb=util['format'](_0xe301('0x92'),_0x4b57a7);return db[_0xe301('0x2f')][_0xe301('0x46')]({'where':{'id':_0x4dcbc6['params']['id']},'attributes':['id',_0xe301('0x47'),_0xe301('0x93'),'to','cc','bcc',_0xe301('0x94'),_0xe301('0x95')],'include':_0x4dcbc6[_0xe301('0x34')][_0xe301('0x5a')]?[{'model':db[_0xe301('0x96')],'as':_0xe301('0x97')}]:undefined})[_0xe301('0x16')](handleEntityNotFound(_0x235e35,null))[_0xe301('0x16')](function(_0x35260a){if(_0x35260a){var _0x4941aa=_0x35260a;var _0x5b576f={'from':_0x4941aa[_0xe301('0x93')],'to':_0x4941aa['to'],'subject':_0x4941aa[_0xe301('0x94')],'html':htmlEntities['decode'](_0x4941aa[_0xe301('0x47')]),'headers':{'Date':moment(_0x4941aa[_0xe301('0x95')])['format'](_0xe301('0x98'))},'attachments':[]};if(_0x35260a['cc']){_0x5b576f[_0xe301('0x99')]['Cc']=_0x35260a['cc'];}if(_0x35260a['bcc']){_0x5b576f[_0xe301('0x99')]['Bcc']=_0x35260a[_0xe301('0x9a')];}return new BPromise(function(_0x57e754,_0x591cb7){if(_0x35260a[_0xe301('0x97')]){for(var _0x203ee1=0x0;_0x203ee1<_0x35260a[_0xe301('0x97')][_0xe301('0x39')];_0x203ee1++){var _0x32993b=_0x35260a['Attachments'][_0x203ee1];var _0x1464a7=path[_0xe301('0x8d')](_0xda96be,_0x32993b[_0xe301('0x5c')]);if(fs[_0xe301('0x9b')](_0x1464a7)){_0x5b576f[_0xe301('0x5a')][_0xe301('0x9c')]({'name':_0x32993b[_0xe301('0x2c')],'contentType':_0x32993b[_0xe301('0x3d')],'data':fs[_0xe301('0x9d')](_0x1464a7)});}}}emlformat[_0xe301('0x9e')](_0x5b576f,function(_0x256570,_0x5b1d04){if(_0x256570)return _0x591cb7(_0x256570);fs[_0xe301('0x9f')](path[_0xe301('0x8d')](_0x514d3b,_0x3cfeeb),_0x5b1d04);return _0x57e754(_0x5b1d04);});});}})['then'](function(_0x344334){if(_0x344334){return _0x235e35[_0xe301('0xa0')](path[_0xe301('0x8d')](_0x514d3b,_0x3cfeeb),_0x3cfeeb,function(_0x3c6278){if(!_0x3c6278)fs[_0xe301('0xa1')](path[_0xe301('0x8d')](_0x514d3b,_0x3cfeeb));});}})[_0xe301('0x20')](handleError(_0x235e35,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 2f4624a..31f1729 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 _0xae1a=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','save','emit'];(function(_0x13bc32,_0x273ca8){var _0x25aeeb=function(_0x7be26e){while(--_0x7be26e){_0x13bc32['push'](_0x13bc32['shift']());}};_0x25aeeb(++_0x273ca8);}(_0xae1a,0xd3));var _0xaae1=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xae1a[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xaae1('0x0'));var MailMessage=require(_0xaae1('0x1'))['db'][_0xaae1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaae1('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d8ec0){return function(_0x760875,_0x5b3e73,_0x4b3ad2){MailMessageEvents[_0xaae1('0x4')](_0x2d8ec0+':'+_0x760875['id'],_0x760875);MailMessageEvents[_0xaae1('0x4')](_0x2d8ec0,_0x760875);_0x4b3ad2(null);};}for(var e in events){if(events[_0xaae1('0x5')](e)){var event=events[e];MailMessage[_0xaae1('0x6')](e,emitEvent(event));}}module[_0xaae1('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x1913=['update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0x1f717f,_0x2fc837){var _0x20bf18=function(_0x181efb){while(--_0x181efb){_0x1f717f['push'](_0x1f717f['shift']());}};_0x20bf18(++_0x2fc837);}(_0x1913,0x114));var _0x3191=function(_0x514ee0,_0x311784){_0x514ee0=_0x514ee0-0x0;var _0x594b99=_0x1913[_0x514ee0];return _0x594b99;};'use strict';var EventEmitter=require(_0x3191('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x3191('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3191('0x2')](0x0);var events={'afterCreate':_0x3191('0x3'),'afterUpdate':_0x3191('0x4'),'afterDestroy':_0x3191('0x5')};function emitEvent(_0x2cdbb6){return function(_0xb825d9,_0x424fac,_0x1daeb3){MailMessageEvents[_0x3191('0x6')](_0x2cdbb6+':'+_0xb825d9['id'],_0xb825d9);MailMessageEvents[_0x3191('0x6')](_0x2cdbb6,_0xb825d9);_0x1daeb3(null);};}for(var e in events){if(events[_0x3191('0x7')](e)){var event=events[e];MailMessage[_0x3191('0x8')](e,emitEvent(event));}}module[_0x3191('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 51a1ce6..0fe2948 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 _0xb178=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','exports','define','messageId','fti_mail_messages','plainBody','subject','toLowerCase','direction','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update'];(function(_0x55adaa,_0x13b5b2){var _0x3a747b=function(_0x520eb9){while(--_0x520eb9){_0x55adaa['push'](_0x55adaa['shift']());}};_0x3a747b(++_0x13b5b2);}(_0xb178,0x6f));var _0x8b17=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0xb178[_0xd2e2ab];return _0x1703a2;};'use strict';var _=require(_0x8b17('0x0'));var util=require(_0x8b17('0x1'));var logger=require('../../config/logger')(_0x8b17('0x2'));var moment=require(_0x8b17('0x3'));var BPromise=require(_0x8b17('0x4'));var rp=require(_0x8b17('0x5'));var htmlToText=require(_0x8b17('0x6'));var fs=require('fs');var path=require(_0x8b17('0x7'));var rimraf=require(_0x8b17('0x8'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x8b17('0x9')]=function(_0x43f53c,_0x5d5eeb){return _0x43f53c[_0x8b17('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x8b17('0xb'),'fields':[_0x8b17('0xb')]},{'name':_0x8b17('0xc'),'fields':[_0x8b17('0xd'),_0x8b17('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5dd88b,_0x1921a1,_0x2de6cb){if(_0x5dd88b['body']){_0x5dd88b[_0x8b17('0xd')]=htmlToText['fromString'](_0x5dd88b['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2de6cb(null,_0x1921a1);},'afterCreate':function(_0x15b622,_0x925846,_0x506549){var _0x4208ce=_0x43f53c['models'];var _0x542655=_0x15b622['get']({'plain':!![]});if(_0x542655['direction'][_0x8b17('0xf')]()==='in'||_0x542655[_0x8b17('0x10')]['toLowerCase']()==='out'&&!_0x542655['secret']&&!_[_0x8b17('0x11')](_0x542655[_0x8b17('0x12')])){_0x4208ce[_0x8b17('0x13')][_0x8b17('0x14')]({'where':{'id':_0x542655[_0x8b17('0x15')]}})[_0x8b17('0x16')](function(_0x3b11bb){if(_0x3b11bb){_0x3b11bb[_0x8b17('0x17')]({'lastMsgAt':_0x542655['createdAt'],'lastMsgDirection':_0x542655[_0x8b17('0x10')][_0x8b17('0xf')]()});}})[_0x8b17('0x18')](function(_0x49f99b){console['error'](_0x49f99b);});}_0x506549();}},'charset':_0x8b17('0x19'),'collate':_0x8b17('0x1a')});}; \ No newline at end of file +var _0xf0ac=['MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define'];(function(_0x3684a1,_0xb154f8){var _0x53e818=function(_0x18eda0){while(--_0x18eda0){_0x3684a1['push'](_0x3684a1['shift']());}};_0x53e818(++_0xb154f8);}(_0xf0ac,0x14b));var _0xcf0a=function(_0x3c638a,_0x180157){_0x3c638a=_0x3c638a-0x0;var _0xc5bb=_0xf0ac[_0x3c638a];return _0xc5bb;};'use strict';var _=require('lodash');var util=require(_0xcf0a('0x0'));var logger=require(_0xcf0a('0x1'))(_0xcf0a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf0a('0x3'));var htmlToText=require(_0xcf0a('0x4'));var fs=require('fs');var path=require(_0xcf0a('0x5'));var rimraf=require(_0xcf0a('0x6'));var config=require(_0xcf0a('0x7'));var attributes=require('./mailMessage.attributes');module[_0xcf0a('0x8')]=function(_0x10bcae,_0xb938cf){return _0x10bcae[_0xcf0a('0x9')](_0xcf0a('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xcf0a('0xb'),'fields':[_0xcf0a('0xb')]},{'name':_0xcf0a('0xc'),'fields':[_0xcf0a('0xd'),_0xcf0a('0xe')],'type':_0xcf0a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3375d9,_0x34b4fc,_0x1ad688){if(_0x3375d9['body']){_0x3375d9['plainBody']=htmlToText[_0xcf0a('0x10')](_0x3375d9[_0xcf0a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ad688(null,_0x34b4fc);},'afterCreate':function(_0x3aede0,_0x53b6f0,_0x1a841f){var _0x5b3a7a=_0x10bcae['models'];var _0x2caaa0=_0x3aede0[_0xcf0a('0x12')]({'plain':!![]});if(_0x2caaa0[_0xcf0a('0x13')][_0xcf0a('0x14')]()==='in'||_0x2caaa0[_0xcf0a('0x13')]['toLowerCase']()===_0xcf0a('0x15')&&!_0x2caaa0[_0xcf0a('0x16')]&&!_[_0xcf0a('0x17')](_0x2caaa0['UserId'])){_0x5b3a7a[_0xcf0a('0x18')][_0xcf0a('0x19')]({'where':{'id':_0x2caaa0[_0xcf0a('0x1a')]}})[_0xcf0a('0x1b')](function(_0x821f40){if(_0x821f40){_0x821f40[_0xcf0a('0x1c')]({'lastMsgAt':_0x2caaa0[_0xcf0a('0x1d')],'lastMsgDirection':_0x2caaa0['direction'][_0xcf0a('0x14')]()});}})['catch'](function(_0x11359c){console['error'](_0x11359c);});}_0x1a841f();}},'charset':'utf8mb4','collate':_0xcf0a('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 57b6ebd..feceb3b 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 _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x44e0f0,_0x2e5340){var _0x3e31eb=function(_0x23e780){while(--_0x23e780){_0x44e0f0['push'](_0x44e0f0['shift']());}};_0x3e31eb(++_0x2e5340);}(_0x5f2f,0x73));var _0xf5f2=function(_0x157125,_0x11455d){_0x157125=_0x157125-0x0;var _0x4ffb8e=_0x5f2f[_0x157125];return _0x4ffb8e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./mailMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x4e2e=['socket.io-emitter','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x4f86d7,_0x123cd4){_0x4f86d7=_0x4f86d7-0x0;var _0x571d60=_0x4e2e[_0x4f86d7];return _0x571d60;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});config[_0xe4e2('0xb')]=_[_0xe4e2('0xc')](config[_0xe4e2('0xb')],{'host':_0xe4e2('0xd'),'port':0x18eb});var socket=require(_0xe4e2('0xe'))(new Redis(config[_0xe4e2('0xb')]));require(_0xe4e2('0xf'))['register'](socket);function respondWithRpcPromise(_0xd81011,_0x14fe0d,_0xa4df88){return new BPromise(function(_0x5b7889,_0x1954f8){return client[_0xe4e2('0x10')](_0xd81011,_0xa4df88)[_0xe4e2('0x11')](function(_0x107816){logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));logger[_0xe4e2('0x14')](_0xe4e2('0x15'),_0x14fe0d,_0xe4e2('0x13'),JSON['stringify'](_0x107816));if(_0x107816[_0xe4e2('0x16')]){if(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x17')]===0x1f4){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816['error']['message']);return _0x1954f8(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816[_0xe4e2('0x16')]['message']);return _0x5b7889(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}else{logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));_0x5b7889(_0x107816['result'][_0xe4e2('0x19')]);}})[_0xe4e2('0x1a')](function(_0x7a47c3){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x7a47c3);_0x1954f8(_0x7a47c3);});});}exports[_0xe4e2('0x1b')]=function(_0x339d00){var _0x3c4e90=this;return new Promise(function(_0x4769dd,_0x362741){return db['MailMessage'][_0xe4e2('0x1c')](_0x339d00[_0xe4e2('0x1d')],{'raw':_0x339d00[_0xe4e2('0x1e')]?_0x339d00[_0xe4e2('0x1e')][_0xe4e2('0x1f')]===undefined?!![]:![]:!![]})[_0xe4e2('0x11')](function(_0x16f14b){logger['info'](_0xe4e2('0x1b'),_0x339d00);logger[_0xe4e2('0x14')](_0xe4e2('0x1b'),_0x339d00,JSON['stringify'](_0x16f14b));_0x4769dd(_0x16f14b);})[_0xe4e2('0x1a')](function(_0x12ad33){logger['error'](_0xe4e2('0x1b'),_0x12ad33[_0xe4e2('0x19')],_0x339d00);_0x362741(_0x3c4e90[_0xe4e2('0x16')](0x1f4,_0x12ad33[_0xe4e2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dda2845..4db11e4 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 _0x22cb=['./mailMessage.events','save','remove','emit','removeListener','length','mailMessage:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22cb,0x149));var _0xb22c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x22cb[_0x8c43de];return _0xa6591b;};'use strict';var MailMessageEvents=require(_0xb22c('0x0'));var events=[_0xb22c('0x1'),_0xb22c('0x2'),'update'];function createListener(_0x51ddaf,_0x29b7bb){return function(_0x1c6663){_0x29b7bb[_0xb22c('0x3')](_0x51ddaf,_0x1c6663);};}function removeListener(_0x3919e6,_0x7d9222){return function(){MailMessageEvents[_0xb22c('0x4')](_0x3919e6,_0x7d9222);};}exports['register']=function(_0x5da13f){for(var _0x2e12e6=0x0,_0x2021f6=events[_0xb22c('0x5')];_0x2e12e6<_0x2021f6;_0x2e12e6++){var _0x205090=events[_0x2e12e6];var _0xbe11e7=createListener(_0xb22c('0x6')+_0x205090,_0x5da13f);MailMessageEvents['on'](_0x205090,_0xbe11e7);}}; \ No newline at end of file +var _0x5129=['length','save','update','emit'];(function(_0x49db32,_0x181049){var _0x1486c7=function(_0x34b637){while(--_0x34b637){_0x49db32['push'](_0x49db32['shift']());}};_0x1486c7(++_0x181049);}(_0x5129,0xb5));var _0x9512=function(_0x16c9b5,_0x4100fb){_0x16c9b5=_0x16c9b5-0x0;var _0xf48d6f=_0x5129[_0x16c9b5];return _0xf48d6f;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x9512('0x0'),'remove',_0x9512('0x1')];function createListener(_0x1f3e28,_0x73364c){return function(_0x157914){_0x73364c[_0x9512('0x2')](_0x1f3e28,_0x157914);};}function removeListener(_0x2d740b,_0x4ed740){return function(){MailMessageEvents['removeListener'](_0x2d740b,_0x4ed740);};}exports['register']=function(_0x116845){for(var _0x2b8c58=0x0,_0x5778f7=events[_0x9512('0x3')];_0x2b8c58<_0x5778f7;_0x2b8c58++){var _0x26a7a5=events[_0x2b8c58];var _0x3e34c0=createListener('mailMessage:'+_0x26a7a5,_0x116845);MailMessageEvents['on'](_0x26a7a5,_0x3e34c0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a935d38..4d9cf28 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 _0xba0c=['addTeams','addAgents','put','destroy','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x137bda,_0x2b4b52){var _0x3258d6=function(_0x80824f){while(--_0x80824f){_0x137bda['push'](_0x137bda['shift']());}};_0x3258d6(++_0x2b4b52);}(_0xba0c,0x1c7));var _0xcba0=function(_0x6d5e77,_0x55fc83){_0x6d5e77=_0x6d5e77-0x0;var _0x3e4c19=_0xba0c[_0x6d5e77];return _0x3e4c19;};'use strict';var multer=require(_0xcba0('0x0'));var util=require(_0xcba0('0x1'));var path=require('path');var timeout=require(_0xcba0('0x2'));var express=require(_0xcba0('0x3'));var router=express[_0xcba0('0x4')]();var fs_extra=require(_0xcba0('0x5'));var auth=require(_0xcba0('0x6'));var interaction=require(_0xcba0('0x7'));var config=require(_0xcba0('0x8'));var controller=require(_0xcba0('0x9'));router[_0xcba0('0xa')]('/',auth[_0xcba0('0xb')](),controller[_0xcba0('0xc')]);router[_0xcba0('0xa')]('/describe',auth[_0xcba0('0xb')](),controller[_0xcba0('0xd')]);router[_0xcba0('0xa')](_0xcba0('0xe'),auth[_0xcba0('0xb')](),controller['show']);router[_0xcba0('0xa')]('/:id/members',auth[_0xcba0('0xb')](),controller['getMembers']);router[_0xcba0('0xa')](_0xcba0('0xf'),auth[_0xcba0('0xb')](),controller[_0xcba0('0x10')]);router[_0xcba0('0xa')](_0xcba0('0x11'),auth[_0xcba0('0xb')](),controller[_0xcba0('0x12')]);router[_0xcba0('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xcba0('0xf'),auth[_0xcba0('0xb')](),controller[_0xcba0('0x14')]);router['post'](_0xcba0('0x11'),auth[_0xcba0('0xb')](),controller[_0xcba0('0x15')]);router[_0xcba0('0x16')](_0xcba0('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xcba0('0xb')](),controller[_0xcba0('0x17')]);router['delete'](_0xcba0('0xf'),auth[_0xcba0('0xb')](),controller['removeTeams']);router[_0xcba0('0x18')](_0xcba0('0x11'),auth[_0xcba0('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x791f=['addAgents','put','/:id','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','/:id/members','/:id/teams','post','create','/:id/users'];(function(_0x4749b5,_0x3033aa){var _0x1ef30a=function(_0x3b2eac){while(--_0x3b2eac){_0x4749b5['push'](_0x4749b5['shift']());}};_0x1ef30a(++_0x3033aa);}(_0x791f,0x1c9));var _0xf791=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x791f[_0x50f0a9];return _0x5a33d9;};'use strict';var multer=require(_0xf791('0x0'));var util=require('util');var path=require(_0xf791('0x1'));var timeout=require(_0xf791('0x2'));var express=require(_0xf791('0x3'));var router=express['Router']();var fs_extra=require(_0xf791('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf791('0x5'));var config=require(_0xf791('0x6'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xf791('0x7')](),controller[_0xf791('0x8')]);router['get'](_0xf791('0x9'),auth[_0xf791('0x7')](),controller[_0xf791('0xa')]);router[_0xf791('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf791('0xc')]);router[_0xf791('0xb')](_0xf791('0xd'),auth[_0xf791('0x7')](),controller['getMembers']);router['get'](_0xf791('0xe'),auth[_0xf791('0x7')](),controller['getTeams']);router['get']('/:id/users',auth[_0xf791('0x7')](),controller['getAgents']);router[_0xf791('0xf')]('/',auth[_0xf791('0x7')](),controller[_0xf791('0x10')]);router[_0xf791('0xf')](_0xf791('0xe'),auth[_0xf791('0x7')](),controller['addTeams']);router[_0xf791('0xf')](_0xf791('0x11'),auth[_0xf791('0x7')](),controller[_0xf791('0x12')]);router[_0xf791('0x13')](_0xf791('0x14'),auth['isAuthenticated'](),controller[_0xf791('0x15')]);router[_0xf791('0x16')]('/:id',auth[_0xf791('0x7')](),controller[_0xf791('0x17')]);router[_0xf791('0x16')](_0xf791('0xe'),auth[_0xf791('0x7')](),controller[_0xf791('0x18')]);router[_0xf791('0x16')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9459a1e..8625aaf 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 _0x563c=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x45b0a9,_0x530e3e){var _0x2c3548=function(_0x319e5d){while(--_0x319e5d){_0x45b0a9['push'](_0x45b0a9['shift']());}};_0x2c3548(++_0x530e3e);}(_0x563c,0x1b5));var _0xc563=function(_0x17c547,_0x2d96bc){_0x17c547=_0x17c547-0x0;var _0x1e5fa1=_0x563c[_0x17c547];return _0x1e5fa1;};'use strict';var Sequelize=require(_0xc563('0x0'));module[_0xc563('0x1')]={'name':{'type':Sequelize[_0xc563('0x2')],'unique':_0xc563('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc563('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc563('0x5')]('rrmemory',_0xc563('0x6'),_0xc563('0x7'))}}; \ No newline at end of file +var _0x7a8f=['sequelize','exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x82a7ee,_0x56c35c){var _0x283369=function(_0x12fe8a){while(--_0x12fe8a){_0x82a7ee['push'](_0x82a7ee['shift']());}};_0x283369(++_0x56c35c);}(_0x7a8f,0xf5));var _0xf7a8=function(_0x3c73b3,_0x4618bb){_0x3c73b3=_0x3c73b3-0x0;var _0x5ac5e8=_0x7a8f[_0x3c73b3];return _0x5ac5e8;};'use strict';var Sequelize=require(_0xf7a8('0x0'));module[_0xf7a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf7a8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf7a8('0x3')](_0xf7a8('0x4'),_0xf7a8('0x5'),_0xf7a8('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b426ac9..0a09036 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 _0x6517=['omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','where','query','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','include','options','create','body','get','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','merge','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','SIP','getTeams','Team','findAll','online','voicePause','interface','flatMap','Agents','addTeams','findOrCreate','userMailQueue:save','removeTeams','ids','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents'];(function(_0x2a38e9,_0x316543){var _0x4f09d3=function(_0x457767){while(--_0x457767){_0x2a38e9['push'](_0x2a38e9['shift']());}};_0x4f09d3(++_0x316543);}(_0x6517,0x1e4));var _0x7651=function(_0x51e89c,_0x5df9a5){_0x51e89c=_0x51e89c-0x0;var _0x5a651c=_0x6517[_0x51e89c];return _0x5a651c;};'use strict';var BPromise=require(_0x7651('0x0'));var util=require('util');var _=require(_0x7651('0x1'));var squel=require(_0x7651('0x2'));var Redis=require(_0x7651('0x3'));var qs=require(_0x7651('0x4'));var logger=require('../../config/logger')(_0x7651('0x5'));var config=require(_0x7651('0x6'));var db=require('../../mysqldb')['db'];config[_0x7651('0x7')]=_['defaults'](config['redis'],{'host':_0x7651('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7651('0x9'))[_0x7651('0xa')](socket);function respondWithStatusCode(_0x403cc5,_0x316d75){_0x316d75=_0x316d75||0xcc;return function(_0x5c362e){if(_0x5c362e){return _0x403cc5['sendStatus'](_0x316d75);}return _0x403cc5[_0x7651('0xb')](_0x316d75)[_0x7651('0xc')]();};}function respondWithResult(_0x37b9b0,_0x416fd7){_0x416fd7=_0x416fd7||0xc8;return function(_0x13bdff){if(_0x13bdff){return _0x37b9b0[_0x7651('0xb')](_0x416fd7)[_0x7651('0xd')](_0x13bdff);}};}function respondWithFilteredResult(_0x43b655,_0x2f3f44){return function(_0x2cef43){if(_0x2cef43){var _0x1912a1=typeof _0x2f3f44[_0x7651('0xe')]===_0x7651('0xf')&&typeof _0x2f3f44[_0x7651('0x10')]===_0x7651('0xf');var _0x4a5e48=_0x2cef43[_0x7651('0x11')];var _0x5277ff=_0x1912a1?0x0:_0x2f3f44['offset'];var _0x1ccab1=_0x1912a1?_0x2cef43['count']:_0x2f3f44[_0x7651('0xe')]+_0x2f3f44[_0x7651('0x10')];var _0x494fbb;if(_0x1ccab1>=_0x4a5e48){_0x1ccab1=_0x4a5e48;_0x494fbb=0xc8;}else{_0x494fbb=0xce;}_0x43b655[_0x7651('0xb')](_0x494fbb);return _0x43b655[_0x7651('0x12')](_0x7651('0x13'),_0x5277ff+'-'+_0x1ccab1+'/'+_0x4a5e48)[_0x7651('0xd')](_0x2cef43);}return null;};}function saveUpdates(_0x5d58f0){return function(_0x476073){if(_0x476073){return _0x476073['update'](_0x5d58f0)[_0x7651('0x14')](function(_0x2b6567){return _0x2b6567;});}return null;};}function removeEntity(_0x1570a3){return function(_0x39fe50){if(_0x39fe50){return _0x39fe50['destroy']()[_0x7651('0x14')](function(){var _0x3b02be=_0x39fe50['get']({'plain':!![]});var _0x8388b5=_0x7651('0x15');return db[_0x7651('0x16')]['destroy']({'where':{'type':_0x8388b5,'resourceId':_0x3b02be['id']}})[_0x7651('0x14')](function(){return _0x39fe50;});})[_0x7651('0x14')](function(){_0x1570a3[_0x7651('0xb')](0xcc)[_0x7651('0xc')]();});}};}function handleEntityNotFound(_0x1bdd50){return function(_0x2f2e16){if(!_0x2f2e16){_0x1bdd50['sendStatus'](0x194);}return _0x2f2e16;};}function handleError(_0x430ab8,_0xb60dbd){_0xb60dbd=_0xb60dbd||0x1f4;return function(_0x962221){logger[_0x7651('0x17')](_0x962221[_0x7651('0x18')]);if(_0x962221[_0x7651('0x19')]){delete _0x962221[_0x7651('0x19')];}_0x430ab8[_0x7651('0xb')](_0xb60dbd)[_0x7651('0x1a')](_0x962221);};}exports[_0x7651('0x1b')]=function(_0x4cf0cd,_0x57c4f2){var _0x5d1421={};var _0x54637c={'count':0x0,'rows':[]};var _0x11756f=_[_0x7651('0x1c')](db[_0x7651('0x1d')][_0x7651('0x1e')],function(_0x411b8c){return{'name':_0x411b8c[_0x7651('0x1f')],'type':_0x411b8c[_0x7651('0x20')]['key']};});_0x5d1421=qs[_0x7651('0x21')](_0x11756f,_0x4cf0cd);var _0x3f9741={'where':_0x5d1421[_0x7651('0x22')]};return db[_0x7651('0x1d')][_0x7651('0x11')](_0x3f9741)[_0x7651('0x14')](function(_0x1945a0){_0x54637c[_0x7651('0x11')]=_0x1945a0;_0x5d1421['include']=qs['include'](_0x4cf0cd[_0x7651('0x23')]);return db[_0x7651('0x1d')]['findAll'](_0x5d1421);})[_0x7651('0x14')](function(_0x1c5625){_0x54637c['rows']=_0x1c5625;return _0x54637c;})[_0x7651('0x14')](respondWithFilteredResult(_0x57c4f2,_0x5d1421))[_0x7651('0x24')](handleError(_0x57c4f2,null));};exports[_0x7651('0x25')]=function(_0x49e552,_0x387ee6){var _0x2e81fa={'raw':!![],'where':{'id':_0x49e552[_0x7651('0x26')]['id']}},_0x68e987={};_0x68e987['model']=_[_0x7651('0x27')](db[_0x7651('0x1d')]['rawAttributes']);_0x68e987[_0x7651('0x23')]=_[_0x7651('0x27')](_0x49e552[_0x7651('0x23')]);_0x68e987['filters']=_[_0x7651('0x28')](_0x68e987[_0x7651('0x29')],_0x68e987[_0x7651('0x23')]);_0x2e81fa[_0x7651('0x2a')]=_[_0x7651('0x28')](_0x68e987[_0x7651('0x29')],qs[_0x7651('0x2b')](_0x49e552[_0x7651('0x23')][_0x7651('0x2b')]));_0x2e81fa[_0x7651('0x2a')]=_0x2e81fa[_0x7651('0x2a')][_0x7651('0x2c')]?_0x2e81fa['attributes']:_0x68e987[_0x7651('0x29')];if(_0x49e552[_0x7651('0x23')][_0x7651('0x2d')]){_0x2e81fa[_0x7651('0x2e')]=[{'all':!![]}];}_0x2e81fa=_['merge']({},_0x2e81fa,_0x49e552[_0x7651('0x2f')]);return db[_0x7651('0x1d')]['find'](_0x2e81fa)['then'](handleEntityNotFound(_0x387ee6,null))['then'](respondWithResult(_0x387ee6,null))['catch'](handleError(_0x387ee6,null));};exports[_0x7651('0x30')]=function(_0x128ed3,_0x42aca3){return db[_0x7651('0x1d')][_0x7651('0x30')](_0x128ed3[_0x7651('0x31')],{})['then'](function(_0x448cfe){var _0x4b30eb=_0x128ed3['user'][_0x7651('0x32')]({'plain':!![]});if(!_0x4b30eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b30eb[_0x7651('0x33')]==='user'){var _0x113252=_0x448cfe[_0x7651('0x32')]({'plain':!![]});var _0x5c0df8=_0x7651('0x15');return db[_0x7651('0x34')][_0x7651('0x35')]({'where':{'name':_0x5c0df8,'userProfileId':_0x4b30eb[_0x7651('0x36')]},'raw':!![]})['then'](function(_0x38dd40){if(_0x38dd40&&_0x38dd40['autoAssociation']===0x0){return db['UserProfileResource'][_0x7651('0x30')]({'name':_0x113252[_0x7651('0x19')],'resourceId':_0x113252['id'],'type':_0x38dd40['name'],'sectionId':_0x38dd40['id']},{})[_0x7651('0x14')](function(){return _0x448cfe;});}else{return _0x448cfe;}})[_0x7651('0x24')](function(_0x3d273d){logger[_0x7651('0x17')](_0x7651('0x37'),_0x3d273d);throw _0x3d273d;});}return _0x448cfe;})[_0x7651('0x14')](respondWithResult(_0x42aca3,0xc9))[_0x7651('0x24')](handleError(_0x42aca3,null));};exports[_0x7651('0x38')]=function(_0x2d798d,_0x1af1b5){if(_0x2d798d[_0x7651('0x31')]['id']){delete _0x2d798d[_0x7651('0x31')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x2d798d[_0x7651('0x26')]['id']}})[_0x7651('0x14')](handleEntityNotFound(_0x1af1b5,null))[_0x7651('0x14')](saveUpdates(_0x2d798d[_0x7651('0x31')],null))[_0x7651('0x14')](respondWithResult(_0x1af1b5,null))['catch'](handleError(_0x1af1b5,null));};exports[_0x7651('0x39')]=function(_0x1ae399,_0x261d7a){return db[_0x7651('0x1d')][_0x7651('0x35')]({'where':{'id':_0x1ae399[_0x7651('0x26')]['id']}})[_0x7651('0x14')](handleEntityNotFound(_0x261d7a,null))[_0x7651('0x14')](removeEntity(_0x261d7a,null))[_0x7651('0x24')](handleError(_0x261d7a,null));};exports[_0x7651('0x3a')]=function(_0x1f491e,_0x52d2f0){return db[_0x7651('0x1d')][_0x7651('0x3a')]()[_0x7651('0x14')](respondWithResult(_0x52d2f0,null))[_0x7651('0x24')](handleError(_0x52d2f0,null));};exports[_0x7651('0x3b')]=function(_0xdf729a,_0x4791d9){var _0x40a09f={'raw':!![],'where':{}},_0x2b634a={},_0x132db8;return db[_0x7651('0x1d')][_0x7651('0x3c')]({'where':{'id':_0xdf729a[_0x7651('0x26')]['id']}})[_0x7651('0x14')](handleEntityNotFound(_0x4791d9,null))[_0x7651('0x14')](function(_0x3c4664){if(_0x3c4664){_0x132db8=_0x3c4664['get']({'plain':!![]});_0x2b634a[_0x7651('0x29')]=_['keys'](db['UserMailQueue'][_0x7651('0x1e')]);_0x2b634a[_0x7651('0x23')]=_['keys'](_0xdf729a[_0x7651('0x23')]);_0x2b634a[_0x7651('0x3d')]=_[_0x7651('0x28')](_0x2b634a[_0x7651('0x29')],_0x2b634a[_0x7651('0x23')]);_0x40a09f[_0x7651('0x2a')]=_[_0x7651('0x28')](_0x2b634a[_0x7651('0x29')],qs[_0x7651('0x2b')](_0xdf729a[_0x7651('0x23')][_0x7651('0x2b')]));_0x40a09f[_0x7651('0x2a')]=_0x40a09f[_0x7651('0x2a')]['length']?_0x40a09f[_0x7651('0x2a')]:_0x2b634a[_0x7651('0x29')];if(!_0xdf729a[_0x7651('0x23')][_0x7651('0x3e')](_0x7651('0x3f'))){_0x40a09f['limit']=qs[_0x7651('0x10')](_0xdf729a[_0x7651('0x23')]['limit']);_0x40a09f[_0x7651('0xe')]=qs[_0x7651('0xe')](_0xdf729a['query'][_0x7651('0xe')]);}_0x40a09f[_0x7651('0x40')]=qs[_0x7651('0x41')](_0xdf729a[_0x7651('0x23')][_0x7651('0x41')]);_0x40a09f[_0x7651('0x22')]=qs[_0x7651('0x3d')](_[_0x7651('0x42')](_0xdf729a[_0x7651('0x23')],_0x2b634a[_0x7651('0x3d')]));_0x40a09f[_0x7651('0x22')][_0x7651('0x43')]=_0x3c4664['id'];if(_0xdf729a[_0x7651('0x23')][_0x7651('0x44')]){_0x40a09f['where']=_[_0x7651('0x45')](_0x40a09f[_0x7651('0x22')],{'$or':_[_0x7651('0x1c')](_0x40a09f[_0x7651('0x2a')],function(_0x404242){var _0x30e848={};_0x30e848[_0x404242]={'$like':'%'+_0xdf729a[_0x7651('0x23')]['filter']+'%'};return _0x30e848;})});}_0x40a09f=_[_0x7651('0x45')]({},_0x40a09f,_0xdf729a[_0x7651('0x2f')]);return db[_0x7651('0x46')]['findAll'](_0x40a09f);}})[_0x7651('0x14')](function(_0x5341cf){if(_0x5341cf){return db[_0x7651('0x47')][_0x7651('0x48')]({'where':{'id':_[_0x7651('0x1c')](_0x5341cf,_0x7651('0x49')),'role':_0x7651('0x4a')},'attributes':['id',_0x7651('0x19'),_0x7651('0x4b'),_0x7651('0x4c'),_0x7651('0x4d')]});}})['then'](function(_0x1de24a){if(_0x1de24a){return{'count':_0x1de24a[_0x7651('0x11')],'rows':_['map'](_0x1de24a[_0x7651('0x4e')],function(_0x8c1e5d){return{'membername':_0x8c1e5d['name'],'UserId':_0x8c1e5d['id'],'queue_name':_0x132db8[_0x7651('0x19')],'MailQueueId':_0x132db8['id'],'interface':util['format']('%s/%s',_0x7651('0x4f'),_0x8c1e5d['name']),'penalty':0x0,'paused':_0x8c1e5d[_0x7651('0x4b')],'createdAt':_0x8c1e5d[_0x7651('0x4d')],'updatedAt':_0x8c1e5d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7651('0x14')](respondWithFilteredResult(_0x4791d9,_0x40a09f))[_0x7651('0x24')](handleError(_0x4791d9,null));};exports[_0x7651('0x50')]=function(_0x399fbd,_0x233909){var _0x1f8fa0={};var _0x4f8db3={};var _0x39a01b;var _0x345e6e;return db[_0x7651('0x1d')][_0x7651('0x3c')]({'where':{'id':_0x399fbd[_0x7651('0x26')]['id']}})['then'](handleEntityNotFound(_0x233909,null))['then'](function(_0x42c6cb){if(_0x42c6cb){_0x39a01b=_0x42c6cb;_0x4f8db3[_0x7651('0x29')]=_[_0x7651('0x27')](db[_0x7651('0x51')][_0x7651('0x1e')]);_0x4f8db3['query']=_['keys'](_0x399fbd[_0x7651('0x23')]);_0x4f8db3['filters']=_[_0x7651('0x28')](_0x4f8db3['model'],_0x4f8db3['query']);_0x1f8fa0['attributes']=_[_0x7651('0x28')](_0x4f8db3[_0x7651('0x29')],qs[_0x7651('0x2b')](_0x399fbd[_0x7651('0x23')][_0x7651('0x2b')]));_0x1f8fa0['attributes']=_0x1f8fa0[_0x7651('0x2a')][_0x7651('0x2c')]?_0x1f8fa0[_0x7651('0x2a')]:_0x4f8db3[_0x7651('0x29')];_0x1f8fa0[_0x7651('0x40')]=qs['sort'](_0x399fbd[_0x7651('0x23')][_0x7651('0x41')]);_0x1f8fa0['where']=qs[_0x7651('0x3d')](_[_0x7651('0x42')](_0x399fbd['query'],_0x4f8db3[_0x7651('0x3d')]));if(_0x399fbd[_0x7651('0x23')][_0x7651('0x44')]){_0x1f8fa0[_0x7651('0x22')]=_['merge'](_0x1f8fa0[_0x7651('0x22')],{'$or':_['map'](_0x1f8fa0['attributes'],function(_0x2dd11f){var _0x3e62fa={};_0x3e62fa[_0x2dd11f]={'$like':'%'+_0x399fbd[_0x7651('0x23')]['filter']+'%'};return _0x3e62fa;})});}_0x1f8fa0=_[_0x7651('0x45')]({},_0x1f8fa0,_0x399fbd[_0x7651('0x2f')]);return _0x39a01b[_0x7651('0x50')](_0x1f8fa0);}})[_0x7651('0x14')](function(_0x2edae1){if(_0x2edae1){_0x345e6e=_0x2edae1[_0x7651('0x2c')];if(!_0x399fbd['query'][_0x7651('0x3e')](_0x7651('0x3f'))){_0x1f8fa0['limit']=qs[_0x7651('0x10')](_0x399fbd['query'][_0x7651('0x10')]);_0x1f8fa0[_0x7651('0xe')]=qs[_0x7651('0xe')](_0x399fbd['query'][_0x7651('0xe')]);}return _0x39a01b[_0x7651('0x50')](_0x1f8fa0);}})[_0x7651('0x14')](function(_0x44f0ab){if(_0x44f0ab){return _0x44f0ab?{'count':_0x345e6e,'rows':_0x44f0ab}:null;}})[_0x7651('0x14')](respondWithResult(_0x233909,null))[_0x7651('0x24')](handleError(_0x233909,null));};exports['addTeams']=function(_0x537500,_0x348a20){var _0x57baae=_0x537500[_0x7651('0x31')]['ids'];return db[_0x7651('0x51')][_0x7651('0x52')]({'where':{'id':_0x57baae},'attributes':['id'],'include':[{'model':db[_0x7651('0x47')],'as':'Agents','attributes':['id','name',_0x7651('0x53'),_0x7651('0x54'),_0x7651('0x55')],'raw':!![]}]})[_0x7651('0x14')](function(_0x5613ae){if(_0x5613ae){var _0x2eb0cb=_[_0x7651('0x56')](_0x5613ae,function(_0xc81d0f){var _0x1b99f6=_0xc81d0f['get']({'plain':!![]});return _0x1b99f6[_0x7651('0x57')];});return db[_0x7651('0x1d')][_0x7651('0x35')]({'where':{'id':_0x537500[_0x7651('0x26')]['id']}})[_0x7651('0x14')](function(_0x533ed2){return db['sequelize']['transaction'](function(_0x69651f){return _0x533ed2[_0x7651('0x58')](_0x57baae,{'transaction':_0x69651f})['then'](function(){return BPromise['each'](_0x2eb0cb,function(_0x575849){return db[_0x7651('0x46')][_0x7651('0x59')]({'where':{'UserId':_0x575849['id'],'MailQueueId':_0x537500['params']['id']},'transaction':_0x69651f});});})[_0x7651('0x14')](function(){_0x2eb0cb['forEach'](function(_0x3cd137){socket['emit'](_0x7651('0x5a'),{'UserId':_0x3cd137['id'],'MailQueueId':_0x533ed2['id']});});});});});}})[_0x7651('0x14')](respondWithStatusCode(_0x348a20,null))['catch'](handleError(_0x348a20,null));};exports[_0x7651('0x5b')]=function(_0x4b2ee3,_0x286d8c){return db[_0x7651('0x51')][_0x7651('0x52')]({'where':{'id':_0x4b2ee3[_0x7651('0x23')][_0x7651('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x7651('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x286d8c,null))[_0x7651('0x14')](function(_0x3dd696){var _0x287f46=_['map'](_0x3dd696,'id');var _0x57ea16=[];var _0x198581=[];var _0x31627f=squel[_0x7651('0x5d')]();_0x31627f['field'](_0x7651('0x5e'))['from'](_0x7651('0x5f'),'tq')[_0x7651('0x60')](_0x7651('0x61'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x4b2ee3[_0x7651('0x26')]['id']);for(var _0x58dea0=0x0;_0x58dea0<_0x3dd696[_0x7651('0x2c')];_0x58dea0+=0x1){let _0x5b15bd=_0x3dd696[_0x58dea0];for(var _0x587546=0x0;_0x587546<_0x5b15bd[_0x7651('0x57')][_0x7651('0x2c')];_0x587546+=0x1){let _0x11e0d3=_0x5b15bd[_0x7651('0x57')][_0x587546];var _0x55fcfc=_0x31627f[_0x7651('0x62')]();_0x55fcfc[_0x7651('0x22')](_0x7651('0x63'),_0x11e0d3['id']);_0x198581['push'](db[_0x7651('0x64')][_0x7651('0x23')](_0x55fcfc['toString'](),{'type':db[_0x7651('0x64')][_0x7651('0x65')][_0x7651('0x66')]})[_0x7651('0x14')](function(_0x52c935){if(_0x52c935[_0x7651('0x2c')]===0x1){return _0x11e0d3['id'];}else{var _0x27efd8=_[_0x7651('0x67')](_[_0x7651('0x1c')](_0x52c935,_0x7651('0x68')),function(_0xcd505){return _[_0x7651('0x69')](_0x287f46,_0xcd505);});if(_0x27efd8){return _0x11e0d3['id'];}}}));}}return BPromise[_0x7651('0x6a')](_0x198581)[_0x7651('0x14')](function(_0x15a8d7){_0x57ea16=_(_0x57ea16)[_0x7651('0x6b')](_0x15a8d7)[_0x7651('0x6c')]()[_0x7651('0x6d')]();return db[_0x7651('0x1d')][_0x7651('0x35')]({'where':{'id':_0x4b2ee3[_0x7651('0x26')]['id']}})[_0x7651('0x14')](function(_0x1a3ad9){return db[_0x7651('0x64')][_0x7651('0x6e')](function(_0x253680){return _0x1a3ad9['removeTeams'](_0x4b2ee3[_0x7651('0x23')]['ids'],{'transaction':_0x253680})[_0x7651('0x14')](function(){if(!_[_0x7651('0x6f')](_0x57ea16)){return _0x1a3ad9[_0x7651('0x70')](_0x57ea16,{'transaction':_0x253680});}})[_0x7651('0x14')](function(){_0x57ea16['forEach'](function(_0x4cd6c6){socket[_0x7651('0x71')](_0x7651('0x72'),{'UserId':_0x4cd6c6,'MailQueueId':_0x1a3ad9['id']});});});});});});})['then'](respondWithStatusCode(_0x286d8c,null))['catch'](handleError(_0x286d8c,null));};exports[_0x7651('0x73')]=function(_0x8e9c8b,_0x712a41){return db[_0x7651('0x1d')][_0x7651('0x35')]({'where':{'id':_0x8e9c8b[_0x7651('0x26')]['id']}})['then'](handleEntityNotFound(_0x712a41,null))[_0x7651('0x14')](function(_0x258ea2){if(_0x258ea2){return _0x258ea2[_0x7651('0x73')](_0x8e9c8b[_0x7651('0x31')][_0x7651('0x5c')],_[_0x7651('0x74')](_0x8e9c8b[_0x7651('0x31')],[_0x7651('0x5c'),'id'])||{})[_0x7651('0x75')](function(_0x4cdab7){for(var _0x34bb58=0x0;_0x34bb58<_0x8e9c8b['body']['ids']['length'];_0x34bb58+=0x1){socket[_0x7651('0x71')](_0x7651('0x5a'),{'UserId':Number(_0x8e9c8b[_0x7651('0x31')]['ids'][_0x34bb58]),'MailQueueId':Number(_0x8e9c8b['params']['id'])});}return _0x4cdab7;});}})[_0x7651('0x14')](respondWithResult(_0x712a41,null))[_0x7651('0x24')](handleError(_0x712a41,null));};exports[_0x7651('0x70')]=function(_0x137154,_0x2b1519){return db[_0x7651('0x1d')][_0x7651('0x35')]({'where':{'id':_0x137154[_0x7651('0x26')]['id']}})[_0x7651('0x14')](handleEntityNotFound(_0x2b1519,null))[_0x7651('0x14')](function(_0x56b86c){if(_0x56b86c){return _0x56b86c[_0x7651('0x70')](_0x137154[_0x7651('0x23')][_0x7651('0x5c')])[_0x7651('0x14')](function(){if(_[_0x7651('0x76')](_0x137154[_0x7651('0x23')][_0x7651('0x5c')])){for(var _0x54414e=0x0;_0x54414e<_0x137154[_0x7651('0x23')]['ids'][_0x7651('0x2c')];_0x54414e+=0x1){socket[_0x7651('0x71')](_0x7651('0x72'),{'UserId':Number(_0x137154[_0x7651('0x23')][_0x7651('0x5c')][_0x54414e]),'MailQueueId':Number(_0x137154[_0x7651('0x26')]['id'])});}}else{socket[_0x7651('0x71')](_0x7651('0x72'),{'UserId':Number(_0x137154[_0x7651('0x23')]['ids']),'MailQueueId':Number(_0x137154[_0x7651('0x26')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b1519,null))[_0x7651('0x24')](handleError(_0x2b1519,null));};exports['getAgents']=function(_0x366a7f,_0xf47e97){var _0x5e8d9a={};var _0x38a73b={};var _0x5eda3b;var _0x442714;return db[_0x7651('0x1d')][_0x7651('0x3c')]({'where':{'id':_0x366a7f['params']['id']}})[_0x7651('0x14')](handleEntityNotFound(_0xf47e97,null))['then'](function(_0x293811){if(_0x293811){_0x5eda3b=_0x293811;_0x38a73b[_0x7651('0x29')]=_['keys'](db[_0x7651('0x47')][_0x7651('0x1e')]);_0x38a73b[_0x7651('0x23')]=_[_0x7651('0x27')](_0x366a7f[_0x7651('0x23')]);_0x38a73b[_0x7651('0x3d')]=_[_0x7651('0x28')](_0x38a73b[_0x7651('0x29')],_0x38a73b[_0x7651('0x23')]);_0x5e8d9a['attributes']=_['intersection'](_0x38a73b[_0x7651('0x29')],qs[_0x7651('0x2b')](_0x366a7f[_0x7651('0x23')][_0x7651('0x2b')]));_0x5e8d9a['attributes']=_0x5e8d9a[_0x7651('0x2a')][_0x7651('0x2c')]?_0x5e8d9a[_0x7651('0x2a')]:_0x38a73b[_0x7651('0x29')];_0x5e8d9a['order']=qs['sort'](_0x366a7f[_0x7651('0x23')][_0x7651('0x41')]);_0x5e8d9a[_0x7651('0x22')]=qs[_0x7651('0x3d')](_[_0x7651('0x42')](_0x366a7f['query'],_0x38a73b['filters']));if(_0x366a7f[_0x7651('0x23')][_0x7651('0x44')]){_0x5e8d9a[_0x7651('0x22')]=_['merge'](_0x5e8d9a['where'],{'$or':_[_0x7651('0x1c')](_0x5e8d9a['attributes'],function(_0x5921ad){var _0x56354e={};_0x56354e[_0x5921ad]={'$like':'%'+_0x366a7f[_0x7651('0x23')]['filter']+'%'};return _0x56354e;})});}_0x5e8d9a=_['merge']({},_0x5e8d9a,_0x366a7f['options']);return _0x5eda3b[_0x7651('0x77')](_0x5e8d9a);}})[_0x7651('0x14')](function(_0x4a05f4){if(_0x4a05f4){_0x442714=_0x4a05f4[_0x7651('0x2c')];if(!_0x366a7f[_0x7651('0x23')][_0x7651('0x3e')](_0x7651('0x3f'))){_0x5e8d9a['limit']=qs[_0x7651('0x10')](_0x366a7f[_0x7651('0x23')][_0x7651('0x10')]);_0x5e8d9a[_0x7651('0xe')]=qs[_0x7651('0xe')](_0x366a7f[_0x7651('0x23')][_0x7651('0xe')]);}return _0x5eda3b[_0x7651('0x77')](_0x5e8d9a);}})[_0x7651('0x14')](function(_0x41c3d6){if(_0x41c3d6){return _0x41c3d6?{'count':_0x442714,'rows':_0x41c3d6}:null;}})[_0x7651('0x14')](respondWithResult(_0xf47e97,null))[_0x7651('0x24')](handleError(_0xf47e97,null));}; \ No newline at end of file +var _0xd364=['rawAttributes','key','getOptions','where','include','rows','catch','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','filter','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','findAll','online','voicePause','interface','flatMap','Agents','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','all','union','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue'];(function(_0xc41365,_0x35d774){var _0x388102=function(_0x44a91a){while(--_0x44a91a){_0xc41365['push'](_0xc41365['shift']());}};_0x388102(++_0x35d774);}(_0xd364,0x1be));var _0x4d36=function(_0x2e18e8,_0x39c516){_0x2e18e8=_0x2e18e8-0x0;var _0x3e3b0d=_0xd364[_0x2e18e8];return _0x3e3b0d;};'use strict';var BPromise=require('bluebird');var util=require(_0x4d36('0x0'));var _=require(_0x4d36('0x1'));var squel=require('squel');var Redis=require(_0x4d36('0x2'));var qs=require(_0x4d36('0x3'));var logger=require('../../config/logger')(_0x4d36('0x4'));var config=require('../../config/environment');var db=require(_0x4d36('0x5'))['db'];config[_0x4d36('0x6')]=_[_0x4d36('0x7')](config[_0x4d36('0x6')],{'host':_0x4d36('0x8'),'port':0x18eb});var socket=require(_0x4d36('0x9'))(new Redis(config[_0x4d36('0x6')]));require(_0x4d36('0xa'))[_0x4d36('0xb')](socket);function respondWithStatusCode(_0x3e2f44,_0x8e8db){_0x8e8db=_0x8e8db||0xcc;return function(_0x671e06){if(_0x671e06){return _0x3e2f44[_0x4d36('0xc')](_0x8e8db);}return _0x3e2f44[_0x4d36('0xd')](_0x8e8db)[_0x4d36('0xe')]();};}function respondWithResult(_0x48dd26,_0x154e37){_0x154e37=_0x154e37||0xc8;return function(_0x18e299){if(_0x18e299){return _0x48dd26[_0x4d36('0xd')](_0x154e37)[_0x4d36('0xf')](_0x18e299);}};}function respondWithFilteredResult(_0xf50bc,_0x249168){return function(_0x2fbf4f){if(_0x2fbf4f){var _0x50e8b8=typeof _0x249168[_0x4d36('0x10')]===_0x4d36('0x11')&&typeof _0x249168['limit']===_0x4d36('0x11');var _0x19c18c=_0x2fbf4f['count'];var _0x697e77=_0x50e8b8?0x0:_0x249168[_0x4d36('0x10')];var _0x393480=_0x50e8b8?_0x2fbf4f[_0x4d36('0x12')]:_0x249168['offset']+_0x249168[_0x4d36('0x13')];var _0x11313f;if(_0x393480>=_0x19c18c){_0x393480=_0x19c18c;_0x11313f=0xc8;}else{_0x11313f=0xce;}_0xf50bc[_0x4d36('0xd')](_0x11313f);return _0xf50bc['set'](_0x4d36('0x14'),_0x697e77+'-'+_0x393480+'/'+_0x19c18c)[_0x4d36('0xf')](_0x2fbf4f);}return null;};}function saveUpdates(_0x3e9b94){return function(_0x5d3888){if(_0x5d3888){return _0x5d3888[_0x4d36('0x15')](_0x3e9b94)[_0x4d36('0x16')](function(_0x41a453){return _0x41a453;});}return null;};}function removeEntity(_0x13a4b9){return function(_0x9245a0){if(_0x9245a0){return _0x9245a0['destroy']()[_0x4d36('0x16')](function(){var _0x3a22ec=_0x9245a0[_0x4d36('0x17')]({'plain':!![]});var _0x17eae3=_0x4d36('0x18');return db[_0x4d36('0x19')][_0x4d36('0x1a')]({'where':{'type':_0x17eae3,'resourceId':_0x3a22ec['id']}})[_0x4d36('0x16')](function(){return _0x9245a0;});})[_0x4d36('0x16')](function(){_0x13a4b9['status'](0xcc)[_0x4d36('0xe')]();});}};}function handleEntityNotFound(_0x443cdb){return function(_0x27a8a7){if(!_0x27a8a7){_0x443cdb[_0x4d36('0xc')](0x194);}return _0x27a8a7;};}function handleError(_0xcd44f6,_0x2107e8){_0x2107e8=_0x2107e8||0x1f4;return function(_0x50a6a4){logger[_0x4d36('0x1b')](_0x50a6a4[_0x4d36('0x1c')]);if(_0x50a6a4['name']){delete _0x50a6a4[_0x4d36('0x1d')];}_0xcd44f6[_0x4d36('0xd')](_0x2107e8)[_0x4d36('0x1e')](_0x50a6a4);};}exports[_0x4d36('0x1f')]=function(_0x187d9c,_0x447ba7){var _0x193003={};var _0x11531c={'count':0x0,'rows':[]};var _0x3cc2d0=_[_0x4d36('0x20')](db[_0x4d36('0x21')][_0x4d36('0x22')],function(_0x38f02d){return{'name':_0x38f02d['fieldName'],'type':_0x38f02d['type'][_0x4d36('0x23')]};});_0x193003=qs[_0x4d36('0x24')](_0x3cc2d0,_0x187d9c);var _0x4cdfb1={'where':_0x193003[_0x4d36('0x25')]};return db[_0x4d36('0x21')][_0x4d36('0x12')](_0x4cdfb1)['then'](function(_0x3b2ba4){_0x11531c[_0x4d36('0x12')]=_0x3b2ba4;_0x193003[_0x4d36('0x26')]=qs[_0x4d36('0x26')](_0x187d9c['query']);return db[_0x4d36('0x21')]['findAll'](_0x193003);})['then'](function(_0x2081c0){_0x11531c[_0x4d36('0x27')]=_0x2081c0;return _0x11531c;})['then'](respondWithFilteredResult(_0x447ba7,_0x193003))[_0x4d36('0x28')](handleError(_0x447ba7,null));};exports['show']=function(_0x2654ba,_0x1efd57){var _0x5d48a5={'raw':!![],'where':{'id':_0x2654ba[_0x4d36('0x29')]['id']}},_0xf0ff0b={};_0xf0ff0b[_0x4d36('0x2a')]=_[_0x4d36('0x2b')](db[_0x4d36('0x21')][_0x4d36('0x22')]);_0xf0ff0b['query']=_[_0x4d36('0x2b')](_0x2654ba[_0x4d36('0x2c')]);_0xf0ff0b[_0x4d36('0x2d')]=_['intersection'](_0xf0ff0b[_0x4d36('0x2a')],_0xf0ff0b[_0x4d36('0x2c')]);_0x5d48a5[_0x4d36('0x2e')]=_[_0x4d36('0x2f')](_0xf0ff0b[_0x4d36('0x2a')],qs[_0x4d36('0x30')](_0x2654ba[_0x4d36('0x2c')][_0x4d36('0x30')]));_0x5d48a5[_0x4d36('0x2e')]=_0x5d48a5[_0x4d36('0x2e')][_0x4d36('0x31')]?_0x5d48a5['attributes']:_0xf0ff0b[_0x4d36('0x2a')];if(_0x2654ba[_0x4d36('0x2c')][_0x4d36('0x32')]){_0x5d48a5['include']=[{'all':!![]}];}_0x5d48a5=_[_0x4d36('0x33')]({},_0x5d48a5,_0x2654ba[_0x4d36('0x34')]);return db[_0x4d36('0x21')][_0x4d36('0x35')](_0x5d48a5)[_0x4d36('0x16')](handleEntityNotFound(_0x1efd57,null))[_0x4d36('0x16')](respondWithResult(_0x1efd57,null))[_0x4d36('0x28')](handleError(_0x1efd57,null));};exports[_0x4d36('0x36')]=function(_0x1c5792,_0x240ed7){return db[_0x4d36('0x21')][_0x4d36('0x36')](_0x1c5792[_0x4d36('0x37')],{})['then'](function(_0x25c610){var _0x2ec6d5=_0x1c5792[_0x4d36('0x38')][_0x4d36('0x17')]({'plain':!![]});if(!_0x2ec6d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec6d5[_0x4d36('0x39')]===_0x4d36('0x38')){var _0x35cc59=_0x25c610[_0x4d36('0x17')]({'plain':!![]});var _0x1a3079=_0x4d36('0x18');return db[_0x4d36('0x3a')][_0x4d36('0x35')]({'where':{'name':_0x1a3079,'userProfileId':_0x2ec6d5[_0x4d36('0x3b')]},'raw':!![]})[_0x4d36('0x16')](function(_0x1e9412){if(_0x1e9412&&_0x1e9412[_0x4d36('0x3c')]===0x0){return db[_0x4d36('0x19')]['create']({'name':_0x35cc59[_0x4d36('0x1d')],'resourceId':_0x35cc59['id'],'type':_0x1e9412[_0x4d36('0x1d')],'sectionId':_0x1e9412['id']},{})[_0x4d36('0x16')](function(){return _0x25c610;});}else{return _0x25c610;}})['catch'](function(_0x544072){logger[_0x4d36('0x1b')](_0x4d36('0x3d'),_0x544072);throw _0x544072;});}return _0x25c610;})[_0x4d36('0x16')](respondWithResult(_0x240ed7,0xc9))[_0x4d36('0x28')](handleError(_0x240ed7,null));};exports[_0x4d36('0x15')]=function(_0x5455a7,_0xcd571a){if(_0x5455a7[_0x4d36('0x37')]['id']){delete _0x5455a7[_0x4d36('0x37')]['id'];}return db[_0x4d36('0x21')]['find']({'where':{'id':_0x5455a7[_0x4d36('0x29')]['id']}})[_0x4d36('0x16')](handleEntityNotFound(_0xcd571a,null))['then'](saveUpdates(_0x5455a7[_0x4d36('0x37')],null))[_0x4d36('0x16')](respondWithResult(_0xcd571a,null))[_0x4d36('0x28')](handleError(_0xcd571a,null));};exports['destroy']=function(_0x3feea1,_0x25baef){return db['MailQueue'][_0x4d36('0x35')]({'where':{'id':_0x3feea1[_0x4d36('0x29')]['id']}})[_0x4d36('0x16')](handleEntityNotFound(_0x25baef,null))[_0x4d36('0x16')](removeEntity(_0x25baef,null))[_0x4d36('0x28')](handleError(_0x25baef,null));};exports[_0x4d36('0x3e')]=function(_0x418dd3,_0x148e2d){return db[_0x4d36('0x21')]['describe']()[_0x4d36('0x16')](respondWithResult(_0x148e2d,null))[_0x4d36('0x28')](handleError(_0x148e2d,null));};exports['getMembers']=function(_0x1ddc07,_0x5a8450){var _0x43adb6={'raw':!![],'where':{}},_0x284c74={},_0x468349;return db[_0x4d36('0x21')][_0x4d36('0x3f')]({'where':{'id':_0x1ddc07['params']['id']}})[_0x4d36('0x16')](handleEntityNotFound(_0x5a8450,null))[_0x4d36('0x16')](function(_0x58677a){if(_0x58677a){_0x468349=_0x58677a[_0x4d36('0x17')]({'plain':!![]});_0x284c74[_0x4d36('0x2a')]=_[_0x4d36('0x2b')](db[_0x4d36('0x40')][_0x4d36('0x22')]);_0x284c74[_0x4d36('0x2c')]=_['keys'](_0x1ddc07[_0x4d36('0x2c')]);_0x284c74['filters']=_['intersection'](_0x284c74[_0x4d36('0x2a')],_0x284c74[_0x4d36('0x2c')]);_0x43adb6[_0x4d36('0x2e')]=_[_0x4d36('0x2f')](_0x284c74[_0x4d36('0x2a')],qs[_0x4d36('0x30')](_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x30')]));_0x43adb6[_0x4d36('0x2e')]=_0x43adb6[_0x4d36('0x2e')][_0x4d36('0x31')]?_0x43adb6['attributes']:_0x284c74[_0x4d36('0x2a')];if(!_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x41')](_0x4d36('0x42'))){_0x43adb6['limit']=qs['limit'](_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x13')]);_0x43adb6['offset']=qs[_0x4d36('0x10')](_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x10')]);}_0x43adb6[_0x4d36('0x43')]=qs[_0x4d36('0x44')](_0x1ddc07[_0x4d36('0x2c')]['sort']);_0x43adb6[_0x4d36('0x25')]=qs[_0x4d36('0x2d')](_[_0x4d36('0x45')](_0x1ddc07[_0x4d36('0x2c')],_0x284c74[_0x4d36('0x2d')]));_0x43adb6['where']['MailQueueId']=_0x58677a['id'];if(_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x46')]){_0x43adb6['where']=_[_0x4d36('0x33')](_0x43adb6[_0x4d36('0x25')],{'$or':_['map'](_0x43adb6['attributes'],function(_0x464c8f){var _0x7fb98c={};_0x7fb98c[_0x464c8f]={'$like':'%'+_0x1ddc07[_0x4d36('0x2c')][_0x4d36('0x46')]+'%'};return _0x7fb98c;})});}_0x43adb6=_['merge']({},_0x43adb6,_0x1ddc07[_0x4d36('0x34')]);return db[_0x4d36('0x40')]['findAll'](_0x43adb6);}})[_0x4d36('0x16')](function(_0x7a1063){if(_0x7a1063){return db[_0x4d36('0x47')]['findAndCountAll']({'where':{'id':_[_0x4d36('0x20')](_0x7a1063,_0x4d36('0x48')),'role':_0x4d36('0x49')},'attributes':['id','name',_0x4d36('0x4a'),_0x4d36('0x4b'),_0x4d36('0x4c')]});}})[_0x4d36('0x16')](function(_0x21244a){if(_0x21244a){return{'count':_0x21244a[_0x4d36('0x12')],'rows':_[_0x4d36('0x20')](_0x21244a['rows'],function(_0x34f780){return{'membername':_0x34f780['name'],'UserId':_0x34f780['id'],'queue_name':_0x468349[_0x4d36('0x1d')],'MailQueueId':_0x468349['id'],'interface':util[_0x4d36('0x4d')](_0x4d36('0x4e'),_0x4d36('0x4f'),_0x34f780['name']),'penalty':0x0,'paused':_0x34f780[_0x4d36('0x4a')],'createdAt':_0x34f780[_0x4d36('0x4c')],'updatedAt':_0x34f780['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4d36('0x16')](respondWithFilteredResult(_0x5a8450,_0x43adb6))[_0x4d36('0x28')](handleError(_0x5a8450,null));};exports[_0x4d36('0x50')]=function(_0x42e35b,_0x22bdca){var _0x5cbaeb={};var _0x17d135={};var _0x232ef5;var _0xc30cd6;return db[_0x4d36('0x21')][_0x4d36('0x3f')]({'where':{'id':_0x42e35b[_0x4d36('0x29')]['id']}})[_0x4d36('0x16')](handleEntityNotFound(_0x22bdca,null))[_0x4d36('0x16')](function(_0x219b87){if(_0x219b87){_0x232ef5=_0x219b87;_0x17d135[_0x4d36('0x2a')]=_[_0x4d36('0x2b')](db[_0x4d36('0x51')][_0x4d36('0x22')]);_0x17d135['query']=_[_0x4d36('0x2b')](_0x42e35b['query']);_0x17d135[_0x4d36('0x2d')]=_[_0x4d36('0x2f')](_0x17d135[_0x4d36('0x2a')],_0x17d135[_0x4d36('0x2c')]);_0x5cbaeb[_0x4d36('0x2e')]=_[_0x4d36('0x2f')](_0x17d135[_0x4d36('0x2a')],qs[_0x4d36('0x30')](_0x42e35b[_0x4d36('0x2c')]['fields']));_0x5cbaeb['attributes']=_0x5cbaeb[_0x4d36('0x2e')][_0x4d36('0x31')]?_0x5cbaeb[_0x4d36('0x2e')]:_0x17d135['model'];_0x5cbaeb['order']=qs['sort'](_0x42e35b[_0x4d36('0x2c')][_0x4d36('0x44')]);_0x5cbaeb[_0x4d36('0x25')]=qs[_0x4d36('0x2d')](_[_0x4d36('0x45')](_0x42e35b[_0x4d36('0x2c')],_0x17d135[_0x4d36('0x2d')]));if(_0x42e35b['query'][_0x4d36('0x46')]){_0x5cbaeb['where']=_[_0x4d36('0x33')](_0x5cbaeb['where'],{'$or':_[_0x4d36('0x20')](_0x5cbaeb[_0x4d36('0x2e')],function(_0x395313){var _0xd72a7e={};_0xd72a7e[_0x395313]={'$like':'%'+_0x42e35b[_0x4d36('0x2c')][_0x4d36('0x46')]+'%'};return _0xd72a7e;})});}_0x5cbaeb=_[_0x4d36('0x33')]({},_0x5cbaeb,_0x42e35b[_0x4d36('0x34')]);return _0x232ef5[_0x4d36('0x50')](_0x5cbaeb);}})[_0x4d36('0x16')](function(_0x2bb36c){if(_0x2bb36c){_0xc30cd6=_0x2bb36c[_0x4d36('0x31')];if(!_0x42e35b[_0x4d36('0x2c')]['hasOwnProperty'](_0x4d36('0x42'))){_0x5cbaeb['limit']=qs[_0x4d36('0x13')](_0x42e35b['query'][_0x4d36('0x13')]);_0x5cbaeb[_0x4d36('0x10')]=qs[_0x4d36('0x10')](_0x42e35b[_0x4d36('0x2c')][_0x4d36('0x10')]);}return _0x232ef5[_0x4d36('0x50')](_0x5cbaeb);}})['then'](function(_0x2d2e41){if(_0x2d2e41){return _0x2d2e41?{'count':_0xc30cd6,'rows':_0x2d2e41}:null;}})[_0x4d36('0x16')](respondWithResult(_0x22bdca,null))[_0x4d36('0x28')](handleError(_0x22bdca,null));};exports['addTeams']=function(_0x4e3573,_0x3070c5){var _0x5f3faf=_0x4e3573[_0x4d36('0x37')][_0x4d36('0x52')];return db[_0x4d36('0x51')][_0x4d36('0x53')]({'where':{'id':_0x5f3faf},'attributes':['id'],'include':[{'model':db[_0x4d36('0x47')],'as':'Agents','attributes':['id',_0x4d36('0x1d'),_0x4d36('0x54'),_0x4d36('0x55'),_0x4d36('0x56')],'raw':!![]}]})[_0x4d36('0x16')](function(_0x1dd05e){if(_0x1dd05e){var _0x1a6087=_[_0x4d36('0x57')](_0x1dd05e,function(_0x84485b){var _0x15795c=_0x84485b[_0x4d36('0x17')]({'plain':!![]});return _0x15795c[_0x4d36('0x58')];});return db[_0x4d36('0x21')][_0x4d36('0x35')]({'where':{'id':_0x4e3573[_0x4d36('0x29')]['id']}})['then'](function(_0xa38d63){return db['sequelize'][_0x4d36('0x59')](function(_0x1a0cfd){return _0xa38d63[_0x4d36('0x5a')](_0x5f3faf,{'transaction':_0x1a0cfd})[_0x4d36('0x16')](function(){return BPromise[_0x4d36('0x5b')](_0x1a6087,function(_0x1cf46c){return db[_0x4d36('0x40')][_0x4d36('0x5c')]({'where':{'UserId':_0x1cf46c['id'],'MailQueueId':_0x4e3573[_0x4d36('0x29')]['id']},'transaction':_0x1a0cfd});});})[_0x4d36('0x16')](function(){_0x1a6087[_0x4d36('0x5d')](function(_0x43bb4f){socket[_0x4d36('0x5e')](_0x4d36('0x5f'),{'UserId':_0x43bb4f['id'],'MailQueueId':_0xa38d63['id']});});});});});}})[_0x4d36('0x16')](respondWithStatusCode(_0x3070c5,null))[_0x4d36('0x28')](handleError(_0x3070c5,null));};exports[_0x4d36('0x60')]=function(_0x4a6586,_0x5bc453){return db[_0x4d36('0x51')][_0x4d36('0x53')]({'where':{'id':_0x4a6586['query'][_0x4d36('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4d36('0x58'),'attributes':['id'],'raw':!![]}]})[_0x4d36('0x16')](handleEntityNotFound(_0x5bc453,null))[_0x4d36('0x16')](function(_0x20fd2b){var _0x543481=_[_0x4d36('0x20')](_0x20fd2b,'id');var _0x36b3be=[];var _0x5ac718=[];var _0x39046c=squel[_0x4d36('0x61')]();_0x39046c[_0x4d36('0x62')](_0x4d36('0x63'))[_0x4d36('0x64')]('team_has_mail_queues','tq')[_0x4d36('0x65')](_0x4d36('0x66'),'ut',_0x4d36('0x67'))[_0x4d36('0x25')](_0x4d36('0x68'),_0x4a6586[_0x4d36('0x29')]['id']);for(var _0x33e9b8=0x0;_0x33e9b8<_0x20fd2b[_0x4d36('0x31')];_0x33e9b8+=0x1){let _0x3bac47=_0x20fd2b[_0x33e9b8];for(var _0x1191eb=0x0;_0x1191eb<_0x3bac47['Agents']['length'];_0x1191eb+=0x1){let _0x4b7867=_0x3bac47[_0x4d36('0x58')][_0x1191eb];var _0x4cb119=_0x39046c['clone']();_0x4cb119[_0x4d36('0x25')](_0x4d36('0x69'),_0x4b7867['id']);_0x5ac718['push'](db[_0x4d36('0x6a')][_0x4d36('0x2c')](_0x4cb119['toString'](),{'type':db[_0x4d36('0x6a')][_0x4d36('0x6b')][_0x4d36('0x6c')]})[_0x4d36('0x16')](function(_0x3c9cf8){if(_0x3c9cf8[_0x4d36('0x31')]===0x1){return _0x4b7867['id'];}else{var _0x42edbe=_[_0x4d36('0x6d')](_[_0x4d36('0x20')](_0x3c9cf8,_0x4d36('0x6e')),function(_0x103b71){return _['includes'](_0x543481,_0x103b71);});if(_0x42edbe){return _0x4b7867['id'];}}}));}}return BPromise[_0x4d36('0x6f')](_0x5ac718)['then'](function(_0x463d7d){_0x36b3be=_(_0x36b3be)[_0x4d36('0x70')](_0x463d7d)['compact']()['value']();return db[_0x4d36('0x21')][_0x4d36('0x35')]({'where':{'id':_0x4a6586[_0x4d36('0x29')]['id']}})[_0x4d36('0x16')](function(_0x8e49e5){return db[_0x4d36('0x6a')][_0x4d36('0x59')](function(_0x2f0d4c){return _0x8e49e5['removeTeams'](_0x4a6586[_0x4d36('0x2c')][_0x4d36('0x52')],{'transaction':_0x2f0d4c})[_0x4d36('0x16')](function(){if(!_['isEmpty'](_0x36b3be)){return _0x8e49e5['removeAgents'](_0x36b3be,{'transaction':_0x2f0d4c});}})[_0x4d36('0x16')](function(){_0x36b3be[_0x4d36('0x5d')](function(_0x57ff7b){socket['emit'](_0x4d36('0x71'),{'UserId':_0x57ff7b,'MailQueueId':_0x8e49e5['id']});});});});});});})[_0x4d36('0x16')](respondWithStatusCode(_0x5bc453,null))[_0x4d36('0x28')](handleError(_0x5bc453,null));};exports[_0x4d36('0x72')]=function(_0x161f03,_0x1e4ddd){return db[_0x4d36('0x21')][_0x4d36('0x35')]({'where':{'id':_0x161f03[_0x4d36('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e4ddd,null))[_0x4d36('0x16')](function(_0x552206){if(_0x552206){return _0x552206[_0x4d36('0x72')](_0x161f03[_0x4d36('0x37')][_0x4d36('0x52')],_[_0x4d36('0x73')](_0x161f03[_0x4d36('0x37')],[_0x4d36('0x52'),'id'])||{})[_0x4d36('0x74')](function(_0x3ddbab){for(var _0x3f96a4=0x0;_0x3f96a4<_0x161f03['body']['ids'][_0x4d36('0x31')];_0x3f96a4+=0x1){socket['emit'](_0x4d36('0x5f'),{'UserId':Number(_0x161f03[_0x4d36('0x37')][_0x4d36('0x52')][_0x3f96a4]),'MailQueueId':Number(_0x161f03[_0x4d36('0x29')]['id'])});}return _0x3ddbab;});}})[_0x4d36('0x16')](respondWithResult(_0x1e4ddd,null))[_0x4d36('0x28')](handleError(_0x1e4ddd,null));};exports[_0x4d36('0x75')]=function(_0x115675,_0x83fa18){return db['MailQueue'][_0x4d36('0x35')]({'where':{'id':_0x115675['params']['id']}})['then'](handleEntityNotFound(_0x83fa18,null))[_0x4d36('0x16')](function(_0xfce3f4){if(_0xfce3f4){return _0xfce3f4[_0x4d36('0x75')](_0x115675[_0x4d36('0x2c')][_0x4d36('0x52')])['then'](function(){if(_[_0x4d36('0x76')](_0x115675[_0x4d36('0x2c')][_0x4d36('0x52')])){for(var _0x2c4286=0x0;_0x2c4286<_0x115675['query'][_0x4d36('0x52')][_0x4d36('0x31')];_0x2c4286+=0x1){socket[_0x4d36('0x5e')](_0x4d36('0x71'),{'UserId':Number(_0x115675[_0x4d36('0x2c')][_0x4d36('0x52')][_0x2c4286]),'MailQueueId':Number(_0x115675['params']['id'])});}}else{socket[_0x4d36('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x115675[_0x4d36('0x2c')][_0x4d36('0x52')]),'MailQueueId':Number(_0x115675[_0x4d36('0x29')]['id'])});}});}})[_0x4d36('0x16')](respondWithStatusCode(_0x83fa18,null))['catch'](handleError(_0x83fa18,null));};exports['getAgents']=function(_0x35ccda,_0x1f8778){var _0x2a6e05={};var _0x2a2e2d={};var _0x13b4d7;var _0x22e462;return db[_0x4d36('0x21')][_0x4d36('0x3f')]({'where':{'id':_0x35ccda[_0x4d36('0x29')]['id']}})[_0x4d36('0x16')](handleEntityNotFound(_0x1f8778,null))[_0x4d36('0x16')](function(_0x3146b2){if(_0x3146b2){_0x13b4d7=_0x3146b2;_0x2a2e2d[_0x4d36('0x2a')]=_[_0x4d36('0x2b')](db[_0x4d36('0x47')][_0x4d36('0x22')]);_0x2a2e2d[_0x4d36('0x2c')]=_[_0x4d36('0x2b')](_0x35ccda[_0x4d36('0x2c')]);_0x2a2e2d[_0x4d36('0x2d')]=_[_0x4d36('0x2f')](_0x2a2e2d['model'],_0x2a2e2d[_0x4d36('0x2c')]);_0x2a6e05[_0x4d36('0x2e')]=_[_0x4d36('0x2f')](_0x2a2e2d[_0x4d36('0x2a')],qs[_0x4d36('0x30')](_0x35ccda[_0x4d36('0x2c')][_0x4d36('0x30')]));_0x2a6e05['attributes']=_0x2a6e05[_0x4d36('0x2e')][_0x4d36('0x31')]?_0x2a6e05[_0x4d36('0x2e')]:_0x2a2e2d[_0x4d36('0x2a')];_0x2a6e05['order']=qs['sort'](_0x35ccda[_0x4d36('0x2c')][_0x4d36('0x44')]);_0x2a6e05[_0x4d36('0x25')]=qs[_0x4d36('0x2d')](_[_0x4d36('0x45')](_0x35ccda['query'],_0x2a2e2d[_0x4d36('0x2d')]));if(_0x35ccda[_0x4d36('0x2c')][_0x4d36('0x46')]){_0x2a6e05[_0x4d36('0x25')]=_[_0x4d36('0x33')](_0x2a6e05[_0x4d36('0x25')],{'$or':_[_0x4d36('0x20')](_0x2a6e05[_0x4d36('0x2e')],function(_0x46eac2){var _0x201fb2={};_0x201fb2[_0x46eac2]={'$like':'%'+_0x35ccda[_0x4d36('0x2c')][_0x4d36('0x46')]+'%'};return _0x201fb2;})});}_0x2a6e05=_[_0x4d36('0x33')]({},_0x2a6e05,_0x35ccda[_0x4d36('0x34')]);return _0x13b4d7[_0x4d36('0x77')](_0x2a6e05);}})['then'](function(_0x9c3ca2){if(_0x9c3ca2){_0x22e462=_0x9c3ca2[_0x4d36('0x31')];if(!_0x35ccda['query'][_0x4d36('0x41')](_0x4d36('0x42'))){_0x2a6e05[_0x4d36('0x13')]=qs[_0x4d36('0x13')](_0x35ccda[_0x4d36('0x2c')][_0x4d36('0x13')]);_0x2a6e05[_0x4d36('0x10')]=qs[_0x4d36('0x10')](_0x35ccda['query'][_0x4d36('0x10')]);}return _0x13b4d7['getAgents'](_0x2a6e05);}})[_0x4d36('0x16')](function(_0x32eb5e){if(_0x32eb5e){return _0x32eb5e?{'count':_0x22e462,'rows':_0x32eb5e}:null;}})[_0x4d36('0x16')](respondWithResult(_0x1f8778,null))['catch'](handleError(_0x1f8778,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 882a44a..5acebdc 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 _0x9772=['exports','events','../../mysqldb','MailQueue','setMaxListeners','update','hook'];(function(_0x1f17a1,_0x2481ee){var _0x2f7a25=function(_0x156215){while(--_0x156215){_0x1f17a1['push'](_0x1f17a1['shift']());}};_0x2f7a25(++_0x2481ee);}(_0x9772,0x1ba));var _0x2977=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9772[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0x2977('0x0'));var MailQueue=require(_0x2977('0x1'))['db'][_0x2977('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2977('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2977('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7e5419){return function(_0x4bcd41,_0x52e747,_0x476bcd){MailQueueEvents['emit'](_0x7e5419+':'+_0x4bcd41['id'],_0x4bcd41);MailQueueEvents['emit'](_0x7e5419,_0x4bcd41);_0x476bcd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x2977('0x5')](e,emitEvent(event));}}module[_0x2977('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x80fa=['update','emit','hasOwnProperty','hook','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x80fa,0x90));var _0xa80f=function(_0x52c508,_0x299e3d){_0x52c508=_0x52c508-0x0;var _0x40ae38=_0x80fa[_0x52c508];return _0x40ae38;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xa80f('0x0'))['db'][_0xa80f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa80f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa80f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x273d27){return function(_0x5e241e,_0x1f38be,_0x12f221){MailQueueEvents[_0xa80f('0x4')](_0x273d27+':'+_0x5e241e['id'],_0x5e241e);MailQueueEvents[_0xa80f('0x4')](_0x273d27,_0x5e241e);_0x12f221(null);};}for(var e in events){if(events[_0xa80f('0x5')](e)){var event=events[e];MailQueue[_0xa80f('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e6a35ae..dc9ac94 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 _0x852c=['path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45f197,_0x5a621d){var _0x4d5552=function(_0x47af88){while(--_0x47af88){_0x45f197['push'](_0x45f197['shift']());}};_0x4d5552(++_0x5a621d);}(_0x852c,0x1db));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc852('0x0'));var logger=require(_0xc852('0x1'))(_0xc852('0x2'));var moment=require(_0xc852('0x3'));var BPromise=require(_0xc852('0x4'));var rp=require(_0xc852('0x5'));var fs=require('fs');var path=require(_0xc852('0x6'));var rimraf=require(_0xc852('0x7'));var config=require(_0xc852('0x8'));var attributes=require('./mailQueue.attributes');module[_0xc852('0x9')]=function(_0x48b610,_0x3f704a){return _0x48b610[_0xc852('0xa')](_0xc852('0xb'),attributes,{'tableName':_0xc852('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6560=['bluebird','rimraf','../../config/environment','define','MailQueue','mail_queues','util','api'];(function(_0x5d9d16,_0x119ca8){var _0xc771d1=function(_0x5b063e){while(--_0x5b063e){_0x5d9d16['push'](_0x5d9d16['shift']());}};_0xc771d1(++_0x119ca8);}(_0x6560,0x1c6));var _0x0656=function(_0x4e7754,_0x197523){_0x4e7754=_0x4e7754-0x0;var _0x3eeb3e=_0x6560[_0x4e7754];return _0x3eeb3e;};'use strict';var _=require('lodash');var util=require(_0x0656('0x0'));var logger=require('../../config/logger')(_0x0656('0x1'));var moment=require('moment');var BPromise=require(_0x0656('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0656('0x3'));var config=require(_0x0656('0x4'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x365c4a,_0x3a147d){return _0x365c4a[_0x0656('0x5')](_0x0656('0x6'),attributes,{'tableName':_0x0656('0x7'),'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 9fceacb..09528f5 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 _0x280f=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','include','map','model','ShowMailQueue','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x28e4dc,_0x386a63){var _0x5e0e08=function(_0x5b9535){while(--_0x5b9535){_0x28e4dc['push'](_0x28e4dc['shift']());}};_0x5e0e08(++_0x386a63);}(_0x280f,0xe2));var _0xf280=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x280f[_0x2ef8f1];return _0x17498d;};'use strict';var _=require(_0xf280('0x0'));var util=require('util');var moment=require(_0xf280('0x1'));var BPromise=require(_0xf280('0x2'));var rs=require(_0xf280('0x3'));var fs=require('fs');var Redis=require(_0xf280('0x4'));var db=require(_0xf280('0x5'))['db'];var utils=require(_0xf280('0x6'));var logger=require(_0xf280('0x7'))('rpc');var config=require(_0xf280('0x8'));var jayson=require(_0xf280('0x9'));var client=jayson[_0xf280('0xa')][_0xf280('0xb')]({'port':0x232a});config[_0xf280('0xc')]=_['defaults'](config[_0xf280('0xc')],{'host':_0xf280('0xd'),'port':0x18eb});var socket=require(_0xf280('0xe'))(new Redis(config[_0xf280('0xc')]));require(_0xf280('0xf'))[_0xf280('0x10')](socket);function respondWithRpcPromise(_0x5360c3,_0x2447c6,_0x3d13c5){return new BPromise(function(_0x1f580a,_0x3e58af){return client[_0xf280('0x11')](_0x5360c3,_0x3d13c5)[_0xf280('0x12')](function(_0x10ccbe){logger[_0xf280('0x13')](_0xf280('0x14'),_0x2447c6,_0xf280('0x15'));logger[_0xf280('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2447c6,_0xf280('0x15'),JSON[_0xf280('0x17')](_0x10ccbe));if(_0x10ccbe[_0xf280('0x18')]){if(_0x10ccbe[_0xf280('0x18')][_0xf280('0x19')]===0x1f4){logger[_0xf280('0x18')]('MailQueue,\x20%s,\x20%s',_0x2447c6,_0x10ccbe[_0xf280('0x18')][_0xf280('0x1a')]);return _0x3e58af(_0x10ccbe[_0xf280('0x18')][_0xf280('0x1a')]);}logger[_0xf280('0x18')](_0xf280('0x14'),_0x2447c6,_0x10ccbe[_0xf280('0x18')]['message']);return _0x1f580a(_0x10ccbe['error']['message']);}else{logger[_0xf280('0x13')]('MailQueue,\x20%s,\x20%s',_0x2447c6,_0xf280('0x15'));_0x1f580a(_0x10ccbe['result'][_0xf280('0x1a')]);}})[_0xf280('0x1b')](function(_0x5328ae){logger[_0xf280('0x18')]('MailQueue,\x20%s,\x20%s',_0x2447c6,_0x5328ae);_0x3e58af(_0x5328ae);});});}exports[_0xf280('0x1c')]=function(_0x26c705){var _0x114364=this;return new Promise(function(_0x21e99b,_0x11db7d){return db[_0xf280('0x1d')][_0xf280('0x1e')]({'raw':_0x26c705[_0xf280('0x1f')]?_0x26c705[_0xf280('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x26c705[_0xf280('0x1f')]?_0x26c705[_0xf280('0x1f')][_0xf280('0x20')]||null:null,'attributes':_0x26c705[_0xf280('0x1f')]?_0x26c705[_0xf280('0x1f')][_0xf280('0x21')]||null:null,'limit':_0x26c705[_0xf280('0x1f')]?_0x26c705[_0xf280('0x1f')]['limit']||null:null,'include':_0x26c705[_0xf280('0x1f')]?_0x26c705[_0xf280('0x1f')][_0xf280('0x22')]?_[_0xf280('0x23')](_0x26c705[_0xf280('0x1f')][_0xf280('0x22')],function(_0x4509c1){return{'model':db[_0x4509c1[_0xf280('0x24')]],'as':_0x4509c1['as'],'attributes':_0x4509c1['attributes'],'include':_0x4509c1[_0xf280('0x22')]?_[_0xf280('0x23')](_0x4509c1[_0xf280('0x22')],function(_0xf9ac1c){return{'model':db[_0xf9ac1c['model']],'as':_0xf9ac1c['as'],'attributes':_0xf9ac1c['attributes'],'include':_0xf9ac1c['include']?_['map'](_0xf9ac1c['include'],function(_0x3da40e){return{'model':db[_0x3da40e[_0xf280('0x24')]],'as':_0x3da40e['as'],'attributes':_0x3da40e[_0xf280('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf280('0x12')](function(_0x545ccf){logger[_0xf280('0x13')]('GetMailQueue',_0x26c705);logger[_0xf280('0x16')](_0xf280('0x1c'),_0x26c705,JSON['stringify'](_0x545ccf));_0x21e99b(_0x545ccf);})[_0xf280('0x1b')](function(_0x7bbbd){logger[_0xf280('0x18')](_0xf280('0x1c'),_0x7bbbd['message'],_0x26c705);_0x11db7d(_0x114364[_0xf280('0x18')](0x1f4,_0x7bbbd[_0xf280('0x1a')]));});});};exports[_0xf280('0x25')]=function(_0x20aee4){var _0x9e9dc2=this;return new Promise(function(_0xa6e2ca,_0x45a2cf){return db[_0xf280('0x1d')]['find']({'raw':_0x20aee4[_0xf280('0x1f')]?_0x20aee4[_0xf280('0x1f')][_0xf280('0x26')]===undefined?!![]:![]:!![],'where':_0x20aee4[_0xf280('0x1f')]?_0x20aee4['options']['where']||null:null,'attributes':_0x20aee4[_0xf280('0x1f')]?_0x20aee4['options'][_0xf280('0x21')]||null:null,'include':_0x20aee4[_0xf280('0x1f')]?_0x20aee4[_0xf280('0x1f')][_0xf280('0x22')]?_[_0xf280('0x23')](_0x20aee4['options']['include'],function(_0x5c34a3){return{'model':db[_0x5c34a3[_0xf280('0x24')]],'as':_0x5c34a3['as'],'attributes':_0x5c34a3['attributes'],'include':_0x5c34a3[_0xf280('0x22')]?_[_0xf280('0x23')](_0x5c34a3['include'],function(_0x36a914){return{'model':db[_0x36a914[_0xf280('0x24')]],'as':_0x36a914['as'],'attributes':_0x36a914[_0xf280('0x21')],'include':_0x36a914[_0xf280('0x22')]?_[_0xf280('0x23')](_0x36a914[_0xf280('0x22')],function(_0x286b48){return{'model':db[_0x286b48[_0xf280('0x24')]],'as':_0x286b48['as'],'attributes':_0x286b48[_0xf280('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf280('0x12')](function(_0x4ddd4a){logger[_0xf280('0x13')](_0xf280('0x25'),_0x20aee4);logger[_0xf280('0x16')](_0xf280('0x25'),_0x20aee4,JSON[_0xf280('0x17')](_0x4ddd4a));_0xa6e2ca(_0x4ddd4a);})['catch'](function(_0x1c85b4){logger[_0xf280('0x18')]('ShowMailQueue',_0x1c85b4[_0xf280('0x1a')],_0x20aee4);_0x45a2cf(_0x9e9dc2[_0xf280('0x18')](0x1f4,_0x1c85b4[_0xf280('0x1a')]));});});}; \ No newline at end of file +var _0xd293=['GetMailQueue','debug','find','ShowMailQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','attributes','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd293,0x10e));var _0x3d29=function(_0x26d09b,_0x527c98){_0x26d09b=_0x26d09b-0x0;var _0xd1d02e=_0xd293[_0x26d09b];return _0xd1d02e;};'use strict';var _=require(_0x3d29('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3d29('0x1'));var fs=require('fs');var Redis=require(_0x3d29('0x2'));var db=require(_0x3d29('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d29('0x4'))(_0x3d29('0x5'));var config=require(_0x3d29('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d29('0x7')]['http']({'port':0x232a});config[_0x3d29('0x8')]=_[_0x3d29('0x9')](config[_0x3d29('0x8')],{'host':_0x3d29('0xa'),'port':0x18eb});var socket=require(_0x3d29('0xb'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x3d29('0xc')](socket);function respondWithRpcPromise(_0x18565f,_0x24528f,_0x4b85b8){return new BPromise(function(_0x2dab3b,_0x56de3f){return client[_0x3d29('0xd')](_0x18565f,_0x4b85b8)[_0x3d29('0xe')](function(_0x21c9ef){logger[_0x3d29('0xf')](_0x3d29('0x10'),_0x24528f,_0x3d29('0x11'));logger['debug'](_0x3d29('0x12'),_0x24528f,_0x3d29('0x11'),JSON[_0x3d29('0x13')](_0x21c9ef));if(_0x21c9ef[_0x3d29('0x14')]){if(_0x21c9ef[_0x3d29('0x14')][_0x3d29('0x15')]===0x1f4){logger[_0x3d29('0x14')](_0x3d29('0x10'),_0x24528f,_0x21c9ef[_0x3d29('0x14')][_0x3d29('0x16')]);return _0x56de3f(_0x21c9ef[_0x3d29('0x14')][_0x3d29('0x16')]);}logger[_0x3d29('0x14')](_0x3d29('0x10'),_0x24528f,_0x21c9ef[_0x3d29('0x14')][_0x3d29('0x16')]);return _0x2dab3b(_0x21c9ef['error'][_0x3d29('0x16')]);}else{logger[_0x3d29('0xf')](_0x3d29('0x10'),_0x24528f,_0x3d29('0x11'));_0x2dab3b(_0x21c9ef[_0x3d29('0x17')][_0x3d29('0x16')]);}})[_0x3d29('0x18')](function(_0x5f1a2a){logger[_0x3d29('0x14')](_0x3d29('0x10'),_0x24528f,_0x5f1a2a);_0x56de3f(_0x5f1a2a);});});}exports['GetMailQueue']=function(_0x2296b5){var _0x21eb2f=this;return new Promise(function(_0x3f403a,_0x1430f2){return db[_0x3d29('0x19')][_0x3d29('0x1a')]({'raw':_0x2296b5[_0x3d29('0x1b')]?_0x2296b5['options'][_0x3d29('0x1c')]===undefined?!![]:![]:!![],'where':_0x2296b5[_0x3d29('0x1b')]?_0x2296b5[_0x3d29('0x1b')][_0x3d29('0x1d')]||null:null,'attributes':_0x2296b5['options']?_0x2296b5['options'][_0x3d29('0x1e')]||null:null,'limit':_0x2296b5['options']?_0x2296b5[_0x3d29('0x1b')]['limit']||null:null,'include':_0x2296b5[_0x3d29('0x1b')]?_0x2296b5[_0x3d29('0x1b')][_0x3d29('0x1f')]?_[_0x3d29('0x20')](_0x2296b5[_0x3d29('0x1b')][_0x3d29('0x1f')],function(_0x19d851){return{'model':db[_0x19d851[_0x3d29('0x21')]],'as':_0x19d851['as'],'attributes':_0x19d851['attributes'],'include':_0x19d851[_0x3d29('0x1f')]?_[_0x3d29('0x20')](_0x19d851[_0x3d29('0x1f')],function(_0x16c856){return{'model':db[_0x16c856['model']],'as':_0x16c856['as'],'attributes':_0x16c856[_0x3d29('0x1e')],'include':_0x16c856[_0x3d29('0x1f')]?_[_0x3d29('0x20')](_0x16c856['include'],function(_0x5a342e){return{'model':db[_0x5a342e[_0x3d29('0x21')]],'as':_0x5a342e['as'],'attributes':_0x5a342e[_0x3d29('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22449e){logger[_0x3d29('0xf')](_0x3d29('0x22'),_0x2296b5);logger[_0x3d29('0x23')](_0x3d29('0x22'),_0x2296b5,JSON[_0x3d29('0x13')](_0x22449e));_0x3f403a(_0x22449e);})[_0x3d29('0x18')](function(_0x21d4b2){logger[_0x3d29('0x14')](_0x3d29('0x22'),_0x21d4b2['message'],_0x2296b5);_0x1430f2(_0x21eb2f[_0x3d29('0x14')](0x1f4,_0x21d4b2[_0x3d29('0x16')]));});});};exports['ShowMailQueue']=function(_0x4e7b38){var _0x465838=this;return new Promise(function(_0x4d8087,_0x368465){return db[_0x3d29('0x19')][_0x3d29('0x24')]({'raw':_0x4e7b38[_0x3d29('0x1b')]?_0x4e7b38['options'][_0x3d29('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e7b38['options']?_0x4e7b38['options'][_0x3d29('0x1d')]||null:null,'attributes':_0x4e7b38[_0x3d29('0x1b')]?_0x4e7b38['options'][_0x3d29('0x1e')]||null:null,'include':_0x4e7b38[_0x3d29('0x1b')]?_0x4e7b38[_0x3d29('0x1b')][_0x3d29('0x1f')]?_['map'](_0x4e7b38['options'][_0x3d29('0x1f')],function(_0xa8cbdc){return{'model':db[_0xa8cbdc[_0x3d29('0x21')]],'as':_0xa8cbdc['as'],'attributes':_0xa8cbdc[_0x3d29('0x1e')],'include':_0xa8cbdc[_0x3d29('0x1f')]?_[_0x3d29('0x20')](_0xa8cbdc[_0x3d29('0x1f')],function(_0x324eaf){return{'model':db[_0x324eaf[_0x3d29('0x21')]],'as':_0x324eaf['as'],'attributes':_0x324eaf[_0x3d29('0x1e')],'include':_0x324eaf[_0x3d29('0x1f')]?_[_0x3d29('0x20')](_0x324eaf[_0x3d29('0x1f')],function(_0x4a2326){return{'model':db[_0x4a2326[_0x3d29('0x21')]],'as':_0x4a2326['as'],'attributes':_0x4a2326['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ea757){logger[_0x3d29('0xf')](_0x3d29('0x25'),_0x4e7b38);logger[_0x3d29('0x23')](_0x3d29('0x25'),_0x4e7b38,JSON['stringify'](_0x1ea757));_0x4d8087(_0x1ea757);})[_0x3d29('0x18')](function(_0x52b363){logger[_0x3d29('0x14')](_0x3d29('0x25'),_0x52b363[_0x3d29('0x16')],_0x4e7b38);_0x368465(_0x465838[_0x3d29('0x14')](0x1f4,_0x52b363['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d2368a7..27b269b 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 _0xc6bf=['./mailQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x51e1b4,_0xee0b0c){var _0x35128=function(_0x9b8e7b){while(--_0x9b8e7b){_0x51e1b4['push'](_0x51e1b4['shift']());}};_0x35128(++_0xee0b0c);}(_0xc6bf,0x118));var _0xfc6b=function(_0x1c9f90,_0x538898){_0x1c9f90=_0x1c9f90-0x0;var _0x2e0c4c=_0xc6bf[_0x1c9f90];return _0x2e0c4c;};'use strict';var MailQueueEvents=require(_0xfc6b('0x0'));var events=[_0xfc6b('0x1'),_0xfc6b('0x2'),'update'];function createListener(_0x1253a1,_0x1577a2){return function(_0x95209f){_0x1577a2[_0xfc6b('0x3')](_0x1253a1,_0x95209f);};}function removeListener(_0x25fac6,_0x2074a6){return function(){MailQueueEvents[_0xfc6b('0x4')](_0x25fac6,_0x2074a6);};}exports[_0xfc6b('0x5')]=function(_0x5685d0){for(var _0x27147a=0x0,_0x3a65df=events[_0xfc6b('0x6')];_0x27147a<_0x3a65df;_0x27147a++){var _0x3b7196=events[_0x27147a];var _0x41ff99=createListener('mailQueue:'+_0x3b7196,_0x5685d0);MailQueueEvents['on'](_0x3b7196,_0x41ff99);}}; \ No newline at end of file +var _0xac7a=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x1722df,_0x3239e0){var _0xac3a2=function(_0x2c707a){while(--_0x2c707a){_0x1722df['push'](_0x1722df['shift']());}};_0xac3a2(++_0x3239e0);}(_0xac7a,0x1f4));var _0xaac7=function(_0xef38a7,_0x30e4e6){_0xef38a7=_0xef38a7-0x0;var _0xcc98c6=_0xac7a[_0xef38a7];return _0xcc98c6;};'use strict';var MailQueueEvents=require(_0xaac7('0x0'));var events=[_0xaac7('0x1'),_0xaac7('0x2'),_0xaac7('0x3')];function createListener(_0x42a3de,_0x372f8d){return function(_0x293c57){_0x372f8d['emit'](_0x42a3de,_0x293c57);};}function removeListener(_0x379ec8,_0x5dedb7){return function(){MailQueueEvents[_0xaac7('0x4')](_0x379ec8,_0x5dedb7);};}exports[_0xaac7('0x5')]=function(_0x5a0c51){for(var _0x3be9c1=0x0,_0x4a7171=events[_0xaac7('0x6')];_0x3be9c1<_0x4a7171;_0x3be9c1++){var _0x535f8a=events[_0x3be9c1];var _0x16e0a3=createListener(_0xaac7('0x7')+_0x535f8a,_0x5a0c51);MailQueueEvents['on'](_0x535f8a,_0x16e0a3);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 660a034..4ed5ba1 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 _0xb098=['post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','show'];(function(_0x594e16,_0x21080b){var _0x5969f4=function(_0x2279df){while(--_0x2279df){_0x594e16['push'](_0x594e16['shift']());}};_0x5969f4(++_0x21080b);}(_0xb098,0x1d4));var _0x8b09=function(_0x3bf051,_0x561e8a){_0x3bf051=_0x3bf051-0x0;var _0x1d2e06=_0xb098[_0x3bf051];return _0x1d2e06;};'use strict';var multer=require(_0x8b09('0x0'));var util=require(_0x8b09('0x1'));var path=require(_0x8b09('0x2'));var timeout=require(_0x8b09('0x3'));var express=require(_0x8b09('0x4'));var router=express[_0x8b09('0x5')]();var fs_extra=require(_0x8b09('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b09('0x7'));var config=require(_0x8b09('0x8'));var controller=require(_0x8b09('0x9'));router[_0x8b09('0xa')]('/',auth[_0x8b09('0xb')](),controller[_0x8b09('0xc')]);router[_0x8b09('0xa')]('/describe',auth[_0x8b09('0xb')](),controller[_0x8b09('0xd')]);router[_0x8b09('0xa')]('/:id',auth[_0x8b09('0xb')](),controller[_0x8b09('0xe')]);router[_0x8b09('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b09('0x10')]);router[_0x8b09('0x11')](_0x8b09('0x12'),auth[_0x8b09('0xb')](),controller[_0x8b09('0x13')]);router['delete']('/:id',auth[_0x8b09('0xb')](),controller[_0x8b09('0x14')]);module['exports']=router; \ No newline at end of file +var _0x045d=['/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x045d,0x7f));var _0xd045=function(_0x2baaab,_0x2d744a){_0x2baaab=_0x2baaab-0x0;var _0x2ddfb4=_0x045d[_0x2baaab];return _0x2ddfb4;};'use strict';var multer=require(_0xd045('0x0'));var util=require(_0xd045('0x1'));var path=require('path');var timeout=require(_0xd045('0x2'));var express=require(_0xd045('0x3'));var router=express['Router']();var fs_extra=require(_0xd045('0x4'));var auth=require(_0xd045('0x5'));var interaction=require(_0xd045('0x6'));var config=require('../../config/environment');var controller=require(_0xd045('0x7'));router['get']('/',auth[_0xd045('0x8')](),controller[_0xd045('0x9')]);router['get'](_0xd045('0xa'),auth[_0xd045('0x8')](),controller[_0xd045('0xb')]);router[_0xd045('0xc')](_0xd045('0xd'),auth[_0xd045('0x8')](),controller[_0xd045('0xe')]);router[_0xd045('0xf')]('/',auth[_0xd045('0x8')](),controller['create']);router[_0xd045('0x10')]('/:id',auth[_0xd045('0x8')](),controller['update']);router[_0xd045('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd045('0x12')]);module[_0xd045('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 08d8733..9c0cf51 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 _0x8076=['exports','DATE','STRING','sequelize'];(function(_0x3a1aff,_0x4257c7){var _0x5c4a0d=function(_0x3b61f5){while(--_0x3b61f5){_0x3a1aff['push'](_0x3a1aff['shift']());}};_0x5c4a0d(++_0x4257c7);}(_0x8076,0x1eb));var _0x6807=function(_0x63e93d,_0x5ea679){_0x63e93d=_0x63e93d-0x0;var _0x1eb75b=_0x8076[_0x63e93d];return _0x1eb75b;};'use strict';var moment=require('moment');var Sequelize=require(_0x6807('0x0'));module[_0x6807('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6807('0x2')]},'leaveAt':{'type':Sequelize[_0x6807('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6807('0x3')]}}; \ No newline at end of file +var _0x7e31=['moment','sequelize','exports','STRING','DATE'];(function(_0x29f488,_0xdb9923){var _0x400d65=function(_0x26f4b4){while(--_0x26f4b4){_0x29f488['push'](_0x29f488['shift']());}};_0x400d65(++_0xdb9923);}(_0x7e31,0x6e));var _0x17e3=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0x7e31[_0x3b08de];return _0x53fbe4;};'use strict';var moment=require(_0x17e3('0x0'));var Sequelize=require(_0x17e3('0x1'));module[_0x17e3('0x2')]={'uniqueid':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x17e3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x17e3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x17e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a869d62..a0775d3 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 _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x2e6732,_0x5d0640){var _0x557de3=function(_0x684778){while(--_0x684778){_0x2e6732['push'](_0x2e6732['shift']());}};_0x557de3(++_0x5d0640);}(_0x81c6,0x1d5));var _0x681c=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x81c6[_0x18c44d];return _0x71abcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0x2a07=['index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0x2a07[_0x1db863];return _0x18b578;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['MailQueueReport'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['MailQueueReport']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a6f77cf..80b1f9f 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 _0xab29=['../../config/logger','path','../../config/environment','./mailQueueReport.attributes','report_mail_queue','uniqueid','lodash','util'];(function(_0x5ee61c,_0x534bd5){var _0x5cdf32=function(_0x398e04){while(--_0x398e04){_0x5ee61c['push'](_0x5ee61c['shift']());}};_0x5cdf32(++_0x534bd5);}(_0xab29,0x196));var _0x9ab2=function(_0x4618e9,_0x1922c7){_0x4618e9=_0x4618e9-0x0;var _0x1bcdb9=_0xab29[_0x4618e9];return _0x1bcdb9;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab2('0x3'));var rimraf=require('rimraf');var config=require(_0x9ab2('0x4'));var attributes=require(_0x9ab2('0x5'));module['exports']=function(_0x1c4633,_0x2fd8b3){return _0x1c4633['define']('MailQueueReport',attributes,{'tableName':_0x9ab2('0x6'),'paranoid':![],'indexes':[{'name':_0x9ab2('0x7'),'fields':[_0x9ab2('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd33=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define'];(function(_0x1ec6ea,_0x265db4){var _0x3bbcc8=function(_0x8cd2a3){while(--_0x8cd2a3){_0x1ec6ea['push'](_0x1ec6ea['shift']());}};_0x3bbcc8(++_0x265db4);}(_0xbd33,0x13b));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3bd3('0x0'));var util=require(_0x3bd3('0x1'));var logger=require(_0x3bd3('0x2'))(_0x3bd3('0x3'));var moment=require('moment');var BPromise=require(_0x3bd3('0x4'));var rp=require(_0x3bd3('0x5'));var fs=require('fs');var path=require(_0x3bd3('0x6'));var rimraf=require(_0x3bd3('0x7'));var config=require('../../config/environment');var attributes=require(_0x3bd3('0x8'));module['exports']=function(_0x43f2a8,_0x2159a8){return _0x43f2a8[_0x3bd3('0x9')](_0x3bd3('0xa'),attributes,{'tableName':_0x3bd3('0xb'),'paranoid':![],'indexes':[{'name':_0x3bd3('0xc'),'fields':[_0x3bd3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d994ef8..9c67445 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 _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(_0x10676c,_0x9cc786){var _0x3386ca=function(_0x802aaf){while(--_0x802aaf){_0x10676c['push'](_0x10676c['shift']());}};_0x3386ca(++_0x9cc786);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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 +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x32c2a3,_0x3ebdf5){var _0x3a9599=function(_0x2b4689){while(--_0x2b4689){_0x32c2a3['push'](_0x32c2a3['shift']());}};_0x3a9599(++_0x3ebdf5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x200536,_0x4f2c05){_0x200536=_0x200536-0x0;var _0x6dcde5=_0x5f2f[_0x200536];return _0x6dcde5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 24e9634..91f9457 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a1d85,_0x54af7f){var _0x485f74=function(_0xbba3c1){while(--_0xbba3c1){_0x4a1d85['push'](_0x4a1d85['shift']());}};_0x485f74(++_0x54af7f);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8b895fa..10adf3c 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 _0xe779=['BOOLEAN','INBOX','INTEGER','STRING'];(function(_0xcc5c72,_0x41a732){var _0x49a018=function(_0x5bb823){while(--_0x5bb823){_0xcc5c72['push'](_0xcc5c72['shift']());}};_0x49a018(++_0x41a732);}(_0xe779,0x7b));var _0x9e77=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe779[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x9e77('0x0')]},'host':{'type':Sequelize[_0x9e77('0x0')]},'authentication':{'type':Sequelize[_0x9e77('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9e77('0x0')]},'password':{'type':Sequelize[_0x9e77('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x9e77('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9e77('0x0')],'defaultValue':_0x9e77('0x2')},'connTimeout':{'type':Sequelize[_0x9e77('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x9e77('0x0')]},'modernAuthentication':{'type':Sequelize[_0x9e77('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x767b=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x1ff82c,_0x28789e){var _0x5c61fb=function(_0x57941f){while(--_0x57941f){_0x1ff82c['push'](_0x1ff82c['shift']());}};_0x5c61fb(++_0x28789e);}(_0x767b,0x124));var _0xb767=function(_0x2929f5,_0x585578){_0x2929f5=_0x2929f5-0x0;var _0x3f460e=_0x767b[_0x2929f5];return _0x3f460e;};'use strict';var Sequelize=require(_0xb767('0x0'));module[_0xb767('0x1')]={'description':{'type':Sequelize[_0xb767('0x2')]},'host':{'type':Sequelize[_0xb767('0x2')]},'authentication':{'type':Sequelize[_0xb767('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb767('0x2')]},'password':{'type':Sequelize[_0xb767('0x2')]},'port':{'type':Sequelize[_0xb767('0x4')]},'tls':{'type':Sequelize[_0xb767('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb767('0x2')],'defaultValue':_0xb767('0x5')},'connTimeout':{'type':Sequelize[_0xb767('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb767('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb767('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb767('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 2aacfb2..27c985f 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 _0x0e08=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x1171b5,_0xb14670){var _0x5f3629=function(_0x1006c1){while(--_0x1006c1){_0x1171b5['push'](_0x1171b5['shift']());}};_0x5f3629(++_0xb14670);}(_0x0e08,0x121));var _0x80e0=function(_0x261b16,_0x1630a3){_0x261b16=_0x261b16-0x0;var _0x198809=_0x0e08[_0x261b16];return _0x198809;};'use strict';var _=require(_0x80e0('0x0'));var util=require(_0x80e0('0x1'));var logger=require(_0x80e0('0x2'))(_0x80e0('0x3'));var moment=require(_0x80e0('0x4'));var BPromise=require(_0x80e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80e0('0x6'));var rimraf=require(_0x80e0('0x7'));var config=require(_0x80e0('0x8'));var attributes=require(_0x80e0('0x9'));module['exports']=function(_0x283ba4,_0x58a7fa){return _0x283ba4[_0x80e0('0xa')](_0x80e0('0xb'),attributes,{'tableName':_0x80e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa249=['api','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x4ee012,_0x403592){var _0x250a82=function(_0x190ebc){while(--_0x190ebc){_0x4ee012['push'](_0x4ee012['shift']());}};_0x250a82(++_0x403592);}(_0xa249,0x152));var _0x9a24=function(_0x40dfea,_0x44f5b7){_0x40dfea=_0x40dfea-0x0;var _0x57022a=_0xa249[_0x40dfea];return _0x57022a;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var logger=require(_0x9a24('0x2'))(_0x9a24('0x3'));var moment=require('moment');var BPromise=require(_0x9a24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a24('0x5'));var rimraf=require(_0x9a24('0x6'));var config=require(_0x9a24('0x7'));var attributes=require(_0x9a24('0x8'));module['exports']=function(_0x4371a4,_0x3ffecb){return _0x4371a4['define'](_0x9a24('0x9'),attributes,{'tableName':_0x9a24('0xa'),'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 a98d9f9..4c446eb 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 _0xc4a7=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0xc4a7,0x132));var _0x7c4a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc4a7[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7c4a('0x0'));var util=require(_0x7c4a('0x1'));var moment=require(_0x7c4a('0x2'));var BPromise=require(_0x7c4a('0x3'));var rs=require(_0x7c4a('0x4'));var fs=require('fs');var Redis=require(_0x7c4a('0x5'));var db=require(_0x7c4a('0x6'))['db'];var utils=require(_0x7c4a('0x7'));var logger=require(_0x7c4a('0x8'))('rpc');var config=require(_0x7c4a('0x9'));var jayson=require(_0x7c4a('0xa'));var client=jayson[_0x7c4a('0xb')][_0x7c4a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x476976,_0x94493,_0x4c5c6c){return new BPromise(function(_0x19a858,_0x466b4e){return client[_0x7c4a('0xd')](_0x476976,_0x4c5c6c)[_0x7c4a('0xe')](function(_0x18491d){logger[_0x7c4a('0xf')]('MailServerIn,\x20%s,\x20%s',_0x94493,_0x7c4a('0x10'));logger[_0x7c4a('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x94493,_0x7c4a('0x10'),JSON['stringify'](_0x18491d));if(_0x18491d[_0x7c4a('0x12')]){if(_0x18491d[_0x7c4a('0x12')]['code']===0x1f4){logger[_0x7c4a('0x12')]('MailServerIn,\x20%s,\x20%s',_0x94493,_0x18491d[_0x7c4a('0x12')]['message']);return _0x466b4e(_0x18491d[_0x7c4a('0x12')][_0x7c4a('0x13')]);}logger[_0x7c4a('0x12')](_0x7c4a('0x14'),_0x94493,_0x18491d[_0x7c4a('0x12')][_0x7c4a('0x13')]);return _0x19a858(_0x18491d['error']['message']);}else{logger[_0x7c4a('0xf')](_0x7c4a('0x14'),_0x94493,_0x7c4a('0x10'));_0x19a858(_0x18491d[_0x7c4a('0x15')][_0x7c4a('0x13')]);}})[_0x7c4a('0x16')](function(_0x35bf34){logger[_0x7c4a('0x12')]('MailServerIn,\x20%s,\x20%s',_0x94493,_0x35bf34);_0x466b4e(_0x35bf34);});});}exports[_0x7c4a('0x17')]=function(_0x29eac5){var _0x4b8131=this;return new Promise(function(_0x7719d9,_0x400149){return db[_0x7c4a('0x18')][_0x7c4a('0x19')]({'raw':_0x29eac5['options']?_0x29eac5[_0x7c4a('0x1a')][_0x7c4a('0x1b')]===undefined?!![]:![]:!![],'where':_0x29eac5[_0x7c4a('0x1a')]?_0x29eac5[_0x7c4a('0x1a')][_0x7c4a('0x1c')]||null:null,'attributes':_0x29eac5[_0x7c4a('0x1a')]?_0x29eac5[_0x7c4a('0x1a')][_0x7c4a('0x1d')]||null:null,'limit':_0x29eac5['options']?_0x29eac5['options'][_0x7c4a('0x1e')]||null:null,'include':_0x29eac5['options']?_0x29eac5[_0x7c4a('0x1a')][_0x7c4a('0x1f')]?_['map'](_0x29eac5[_0x7c4a('0x1a')]['include'],function(_0x2a8967){return{'model':db[_0x2a8967[_0x7c4a('0x20')]],'as':_0x2a8967['as'],'attributes':_0x2a8967[_0x7c4a('0x1d')],'include':_0x2a8967[_0x7c4a('0x1f')]?_[_0x7c4a('0x21')](_0x2a8967[_0x7c4a('0x1f')],function(_0x42abb7){return{'model':db[_0x42abb7['model']],'as':_0x42abb7['as'],'attributes':_0x42abb7[_0x7c4a('0x1d')],'include':_0x42abb7[_0x7c4a('0x1f')]?_[_0x7c4a('0x21')](_0x42abb7[_0x7c4a('0x1f')],function(_0x2d10bf){return{'model':db[_0x2d10bf['model']],'as':_0x2d10bf['as'],'attributes':_0x2d10bf[_0x7c4a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7c4a('0xe')](function(_0x588bf3){logger['info'](_0x7c4a('0x17'),_0x29eac5);logger['debug'](_0x7c4a('0x17'),_0x29eac5,JSON[_0x7c4a('0x22')](_0x588bf3));_0x7719d9(_0x588bf3);})[_0x7c4a('0x16')](function(_0x195c2b){logger[_0x7c4a('0x12')](_0x7c4a('0x17'),_0x195c2b[_0x7c4a('0x13')],_0x29eac5);_0x400149(_0x4b8131[_0x7c4a('0x12')](0x1f4,_0x195c2b[_0x7c4a('0x13')]));});});}; \ No newline at end of file +var _0xb98f=['result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x27c6b5,_0x5589f4){var _0x28007d=function(_0x4b71f6){while(--_0x4b71f6){_0x27c6b5['push'](_0x27c6b5['shift']());}};_0x28007d(++_0x5589f4);}(_0xb98f,0xce));var _0xfb98=function(_0x512032,_0x44fab7){_0x512032=_0x512032-0x0;var _0xfb6a1d=_0xb98f[_0x512032];return _0xfb6a1d;};'use strict';var _=require(_0xfb98('0x0'));var util=require(_0xfb98('0x1'));var moment=require(_0xfb98('0x2'));var BPromise=require(_0xfb98('0x3'));var rs=require(_0xfb98('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb98('0x5'))(_0xfb98('0x6'));var config=require(_0xfb98('0x7'));var jayson=require(_0xfb98('0x8'));var client=jayson['client'][_0xfb98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6af9,_0x5683e3,_0x27b394){return new BPromise(function(_0x4d06fc,_0x5b7b33){return client['request'](_0x4a6af9,_0x27b394)['then'](function(_0x4c5e32){logger[_0xfb98('0xa')](_0xfb98('0xb'),_0x5683e3,'request\x20sent');logger['debug'](_0xfb98('0xc'),_0x5683e3,'request\x20sent',JSON[_0xfb98('0xd')](_0x4c5e32));if(_0x4c5e32[_0xfb98('0xe')]){if(_0x4c5e32[_0xfb98('0xe')][_0xfb98('0xf')]===0x1f4){logger[_0xfb98('0xe')](_0xfb98('0xb'),_0x5683e3,_0x4c5e32[_0xfb98('0xe')][_0xfb98('0x10')]);return _0x5b7b33(_0x4c5e32[_0xfb98('0xe')][_0xfb98('0x10')]);}logger[_0xfb98('0xe')](_0xfb98('0xb'),_0x5683e3,_0x4c5e32[_0xfb98('0xe')][_0xfb98('0x10')]);return _0x4d06fc(_0x4c5e32['error'][_0xfb98('0x10')]);}else{logger['info'](_0xfb98('0xb'),_0x5683e3,_0xfb98('0x11'));_0x4d06fc(_0x4c5e32[_0xfb98('0x12')][_0xfb98('0x10')]);}})[_0xfb98('0x13')](function(_0x4c030a){logger[_0xfb98('0xe')](_0xfb98('0xb'),_0x5683e3,_0x4c030a);_0x5b7b33(_0x4c030a);});});}exports[_0xfb98('0x14')]=function(_0x14b206){var _0x1ba04e=this;return new Promise(function(_0x15c4fa,_0x416b02){return db[_0xfb98('0x15')][_0xfb98('0x16')]({'raw':_0x14b206[_0xfb98('0x17')]?_0x14b206[_0xfb98('0x17')][_0xfb98('0x18')]===undefined?!![]:![]:!![],'where':_0x14b206[_0xfb98('0x17')]?_0x14b206[_0xfb98('0x17')][_0xfb98('0x19')]||null:null,'attributes':_0x14b206[_0xfb98('0x17')]?_0x14b206[_0xfb98('0x17')]['attributes']||null:null,'limit':_0x14b206[_0xfb98('0x17')]?_0x14b206[_0xfb98('0x17')][_0xfb98('0x1a')]||null:null,'include':_0x14b206[_0xfb98('0x17')]?_0x14b206['options'][_0xfb98('0x1b')]?_[_0xfb98('0x1c')](_0x14b206[_0xfb98('0x17')]['include'],function(_0x568d6c){return{'model':db[_0x568d6c[_0xfb98('0x1d')]],'as':_0x568d6c['as'],'attributes':_0x568d6c[_0xfb98('0x1e')],'include':_0x568d6c['include']?_[_0xfb98('0x1c')](_0x568d6c['include'],function(_0x383057){return{'model':db[_0x383057[_0xfb98('0x1d')]],'as':_0x383057['as'],'attributes':_0x383057['attributes'],'include':_0x383057['include']?_[_0xfb98('0x1c')](_0x383057[_0xfb98('0x1b')],function(_0x5136a3){return{'model':db[_0x5136a3[_0xfb98('0x1d')]],'as':_0x5136a3['as'],'attributes':_0x5136a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb98('0x1f')](function(_0x11e0bc){logger[_0xfb98('0xa')](_0xfb98('0x14'),_0x14b206);logger['debug'](_0xfb98('0x14'),_0x14b206,JSON[_0xfb98('0xd')](_0x11e0bc));_0x15c4fa(_0x11e0bc);})['catch'](function(_0x3c6e77){logger['error']('GetMailServerIn',_0x3c6e77['message'],_0x14b206);_0x416b02(_0x1ba04e['error'](0x1f4,_0x3c6e77['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f255099..3466f4c 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x128cbc,_0x206392){_0x128cbc=_0x128cbc-0x0;var _0x4a5286=_0x7a54[_0x128cbc];return _0x4a5286;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 83217d9..132c3fa 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 _0x236c=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x236c,0x155));var _0xc236=function(_0xa5b761,_0x392215){_0xa5b761=_0xa5b761-0x0;var _0x2acc86=_0x236c[_0xa5b761];return _0x2acc86;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'description':{'type':Sequelize[_0xc236('0x1')]},'host':{'type':Sequelize[_0xc236('0x1')]},'user':{'type':Sequelize[_0xc236('0x1')]},'pass':{'type':Sequelize[_0xc236('0x1')]},'port':{'type':Sequelize[_0xc236('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xc236('0x1')]},'authentication':{'type':Sequelize[_0xc236('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xc236('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe511=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x244946,_0x3916d1){var _0x4d1912=function(_0x2f4f85){while(--_0x2f4f85){_0x244946['push'](_0x244946['shift']());}};_0x4d1912(++_0x3916d1);}(_0xe511,0x16f));var _0x1e51=function(_0x126977,_0x25df7f){_0x126977=_0x126977-0x0;var _0x15e83e=_0xe511[_0x126977];return _0x15e83e;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1e51('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1e51('0x2')]},'port':{'type':Sequelize[_0x1e51('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x1e51('0x2')]},'authentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x1e51('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8b19d5d..c8fb655 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 _0xc981=['order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','error','stack','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x119e6a,_0x12172a){var _0x1ec5d7=function(_0x2f6e9a){while(--_0x2f6e9a){_0x119e6a['push'](_0x119e6a['shift']());}};_0x1ec5d7(++_0x12172a);}(_0xc981,0xee));var _0x1c98=function(_0xf7a27a,_0x36bdbb){_0xf7a27a=_0xf7a27a-0x0;var _0x2eea29=_0xc981[_0xf7a27a];return _0x2eea29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c98('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c98('0x1'));var rp=require(_0x1c98('0x2'));var moment=require(_0x1c98('0x3'));var BPromise=require(_0x1c98('0x4'));var Mustache=require(_0x1c98('0x5'));var util=require(_0x1c98('0x6'));var path=require('path');var sox=require(_0x1c98('0x7'));var csv=require(_0x1c98('0x8'));var ejs=require(_0x1c98('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c98('0xa'));var squel=require(_0x1c98('0xb'));var crypto=require(_0x1c98('0xc'));var jsforce=require(_0x1c98('0xd'));var deskjs=require(_0x1c98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1c98('0xf'));var Papa=require(_0x1c98('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c98('0x11'));var hardwareService=require(_0x1c98('0x12'));var logger=require(_0x1c98('0x13'))(_0x1c98('0x14'));var utils=require(_0x1c98('0x15'));var config=require(_0x1c98('0x16'));var licenseUtil=require(_0x1c98('0x17'));var db=require(_0x1c98('0x18'))['db'];function respondWithStatusCode(_0x5a71a0,_0x31bfb7){_0x31bfb7=_0x31bfb7||0xcc;return function(_0x451f96){if(_0x451f96){return _0x5a71a0[_0x1c98('0x19')](_0x31bfb7);}return _0x5a71a0[_0x1c98('0x1a')](_0x31bfb7)[_0x1c98('0x1b')]();};}function respondWithResult(_0xda8999,_0x18c85d){_0x18c85d=_0x18c85d||0xc8;return function(_0x4722b7){if(_0x4722b7){return _0xda8999[_0x1c98('0x1a')](_0x18c85d)['json'](_0x4722b7);}};}function respondWithFilteredResult(_0x7c1e8b,_0x569880){return function(_0x27c728){if(_0x27c728){var _0x40c186=typeof _0x569880[_0x1c98('0x1c')]===_0x1c98('0x1d')&&typeof _0x569880[_0x1c98('0x1e')]===_0x1c98('0x1d');var _0x5ecf23=_0x27c728[_0x1c98('0x1f')];var _0x4b23b5=_0x40c186?0x0:_0x569880[_0x1c98('0x1c')];var _0x20c7a0=_0x40c186?_0x27c728['count']:_0x569880['offset']+_0x569880[_0x1c98('0x1e')];var _0x2ab9db;if(_0x20c7a0>=_0x5ecf23){_0x20c7a0=_0x5ecf23;_0x2ab9db=0xc8;}else{_0x2ab9db=0xce;}_0x7c1e8b['status'](_0x2ab9db);return _0x7c1e8b[_0x1c98('0x20')](_0x1c98('0x21'),_0x4b23b5+'-'+_0x20c7a0+'/'+_0x5ecf23)[_0x1c98('0x22')](_0x27c728);}return null;};}function patchUpdates(_0x4ea487){return function(_0x3987a8){try{jsonpatch[_0x1c98('0x23')](_0x3987a8,_0x4ea487,!![]);}catch(_0x9f5ff5){return BPromise[_0x1c98('0x24')](_0x9f5ff5);}return _0x3987a8[_0x1c98('0x25')]();};}function saveUpdates(_0x5f2640,_0x4d7724){return function(_0x561487){if(_0x561487){return _0x561487[_0x1c98('0x26')](_0x5f2640)['then'](function(_0x4724c9){return _0x4724c9;});}return null;};}function removeEntity(_0x5ce366,_0x4e8b4f){return function(_0x2d575c){if(_0x2d575c){return _0x2d575c['destroy']()[_0x1c98('0x27')](function(){_0x5ce366[_0x1c98('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd9118f,_0x5e205b){return function(_0x15d209){if(!_0x15d209){_0xd9118f[_0x1c98('0x19')](0x194);}return _0x15d209;};}function handleError(_0x493d6b,_0x443ba0){_0x443ba0=_0x443ba0||0x1f4;return function(_0x1211b6){logger[_0x1c98('0x28')](_0x1211b6[_0x1c98('0x29')]);if(_0x1211b6[_0x1c98('0x2a')]){delete _0x1211b6['name'];}_0x493d6b[_0x1c98('0x1a')](_0x443ba0)[_0x1c98('0x2b')](_0x1211b6);};}exports['index']=function(_0x33c90e,_0x18c62c){var _0x4329d6={},_0x29cfb7={},_0x533baa={'count':0x0,'rows':[]};var _0x5795fa=_[_0x1c98('0x2c')](db[_0x1c98('0x2d')]['rawAttributes'],function(_0x43e944){return{'name':_0x43e944[_0x1c98('0x2e')],'type':_0x43e944[_0x1c98('0x2f')][_0x1c98('0x30')]};});_0x29cfb7[_0x1c98('0x31')]=_[_0x1c98('0x2c')](_0x5795fa,_0x1c98('0x2a'));_0x29cfb7[_0x1c98('0x32')]=_[_0x1c98('0x33')](_0x33c90e['query']);_0x29cfb7[_0x1c98('0x34')]=_[_0x1c98('0x35')](_0x29cfb7['model'],_0x29cfb7['query']);_0x4329d6[_0x1c98('0x36')]=_[_0x1c98('0x35')](_0x29cfb7['model'],qs[_0x1c98('0x37')](_0x33c90e[_0x1c98('0x32')]['fields']));_0x4329d6['attributes']=_0x4329d6[_0x1c98('0x36')][_0x1c98('0x38')]?_0x4329d6[_0x1c98('0x36')]:_0x29cfb7[_0x1c98('0x31')];if(!_0x33c90e[_0x1c98('0x32')][_0x1c98('0x39')]('nolimit')){_0x4329d6[_0x1c98('0x1e')]=qs[_0x1c98('0x1e')](_0x33c90e[_0x1c98('0x32')][_0x1c98('0x1e')]);_0x4329d6[_0x1c98('0x1c')]=qs['offset'](_0x33c90e[_0x1c98('0x32')]['offset']);}_0x4329d6[_0x1c98('0x3a')]=qs[_0x1c98('0x3b')](_0x33c90e[_0x1c98('0x32')]['sort']);_0x4329d6[_0x1c98('0x3c')]=qs[_0x1c98('0x34')](_[_0x1c98('0x3d')](_0x33c90e['query'],_0x29cfb7[_0x1c98('0x34')]),_0x5795fa);if(_0x33c90e[_0x1c98('0x32')][_0x1c98('0x3e')]){_0x4329d6[_0x1c98('0x3c')]=_[_0x1c98('0x3f')](_0x4329d6[_0x1c98('0x3c')],{'$or':_[_0x1c98('0x2c')](_0x5795fa,function(_0x1cb545){if(_0x1cb545['type']!=='VIRTUAL'){var _0x1496d8={};_0x1496d8[_0x1cb545[_0x1c98('0x2a')]]={'$like':'%'+_0x33c90e['query'][_0x1c98('0x3e')]+'%'};return _0x1496d8;}})});}_0x4329d6=_[_0x1c98('0x3f')]({},_0x4329d6,_0x33c90e[_0x1c98('0x40')]);var _0x5e6d0e={'where':_0x4329d6[_0x1c98('0x3c')]};return db[_0x1c98('0x2d')][_0x1c98('0x1f')](_0x5e6d0e)[_0x1c98('0x27')](function(_0x37a6be){_0x533baa[_0x1c98('0x1f')]=_0x37a6be;if(_0x33c90e['query'][_0x1c98('0x41')]){_0x4329d6['include']=[{'all':!![]}];}return db[_0x1c98('0x2d')][_0x1c98('0x42')](_0x4329d6);})[_0x1c98('0x27')](function(_0x3435ce){_0x533baa['rows']=_0x3435ce;return _0x533baa;})[_0x1c98('0x27')](respondWithFilteredResult(_0x18c62c,_0x4329d6))[_0x1c98('0x43')](handleError(_0x18c62c,null));};exports['show']=function(_0x5ae87a,_0x964d2d){var _0x129090={'raw':!![],'where':{'id':_0x5ae87a['params']['id']}},_0x3adecc={};_0x3adecc[_0x1c98('0x31')]=_[_0x1c98('0x33')](db[_0x1c98('0x2d')][_0x1c98('0x44')]);_0x3adecc['query']=_[_0x1c98('0x33')](_0x5ae87a[_0x1c98('0x32')]);_0x3adecc['filters']=_[_0x1c98('0x35')](_0x3adecc[_0x1c98('0x31')],_0x3adecc[_0x1c98('0x32')]);_0x129090[_0x1c98('0x36')]=_[_0x1c98('0x35')](_0x3adecc[_0x1c98('0x31')],qs['fields'](_0x5ae87a[_0x1c98('0x32')][_0x1c98('0x37')]));_0x129090[_0x1c98('0x36')]=_0x129090['attributes'][_0x1c98('0x38')]?_0x129090[_0x1c98('0x36')]:_0x3adecc['model'];if(_0x5ae87a[_0x1c98('0x32')][_0x1c98('0x41')]){_0x129090[_0x1c98('0x45')]=[{'all':!![]}];}_0x129090=_[_0x1c98('0x3f')]({},_0x129090,_0x5ae87a['options']);return db[_0x1c98('0x2d')][_0x1c98('0x46')](_0x129090)[_0x1c98('0x27')](handleEntityNotFound(_0x964d2d,null))[_0x1c98('0x27')](respondWithResult(_0x964d2d,null))['catch'](handleError(_0x964d2d,null));};exports[_0x1c98('0x47')]=function(_0x2bd87a,_0x1694ab){return db[_0x1c98('0x2d')]['create'](_0x2bd87a[_0x1c98('0x48')],{})['then'](respondWithResult(_0x1694ab,0xc9))[_0x1c98('0x43')](handleError(_0x1694ab,null));};exports[_0x1c98('0x26')]=function(_0x530ad3,_0x1217d8){if(_0x530ad3[_0x1c98('0x48')]['id']){delete _0x530ad3[_0x1c98('0x48')]['id'];}return db[_0x1c98('0x2d')]['find']({'where':{'id':_0x530ad3['params']['id']}})[_0x1c98('0x27')](handleEntityNotFound(_0x1217d8,null))[_0x1c98('0x27')](saveUpdates(_0x530ad3[_0x1c98('0x48')],null))['then'](respondWithResult(_0x1217d8,null))[_0x1c98('0x43')](handleError(_0x1217d8,null));};exports[_0x1c98('0x49')]=function(_0x428246,_0x89b224){return db[_0x1c98('0x2d')][_0x1c98('0x46')]({'where':{'id':_0x428246['params']['id']}})[_0x1c98('0x27')](handleEntityNotFound(_0x89b224,null))[_0x1c98('0x27')](removeEntity(_0x89b224,null))[_0x1c98('0x43')](handleError(_0x89b224,null));}; \ No newline at end of file +var _0xe31d=['query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','include','findAll','rows','catch','params','includeAll','options','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x41f33a,_0x328340){var _0x2d2ef3=function(_0x4d1076){while(--_0x4d1076){_0x41f33a['push'](_0x41f33a['shift']());}};_0x2d2ef3(++_0x328340);}(_0xe31d,0x191));var _0xde31=function(_0xdfde88,_0x5b9306){_0xdfde88=_0xdfde88-0x0;var _0x48383d=_0xe31d[_0xdfde88];return _0x48383d;};'use strict';var emlformat=require(_0xde31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde31('0x1'));var rp=require(_0xde31('0x2'));var moment=require('moment');var BPromise=require(_0xde31('0x3'));var Mustache=require(_0xde31('0x4'));var util=require(_0xde31('0x5'));var path=require(_0xde31('0x6'));var sox=require(_0xde31('0x7'));var csv=require(_0xde31('0x8'));var ejs=require(_0xde31('0x9'));var fs=require('fs');var fs_extra=require(_0xde31('0xa'));var _=require(_0xde31('0xb'));var squel=require(_0xde31('0xc'));var crypto=require(_0xde31('0xd'));var jsforce=require(_0xde31('0xe'));var deskjs=require(_0xde31('0xf'));var toCsv=require(_0xde31('0x8'));var querystring=require('querystring');var Papa=require(_0xde31('0x10'));var Redis=require(_0xde31('0x11'));var authService=require(_0xde31('0x12'));var qs=require(_0xde31('0x13'));var as=require(_0xde31('0x14'));var hardwareService=require(_0xde31('0x15'));var logger=require('../../config/logger')(_0xde31('0x16'));var utils=require(_0xde31('0x17'));var config=require(_0xde31('0x18'));var licenseUtil=require(_0xde31('0x19'));var db=require(_0xde31('0x1a'))['db'];function respondWithStatusCode(_0x5205db,_0x10312b){_0x10312b=_0x10312b||0xcc;return function(_0x6badfe){if(_0x6badfe){return _0x5205db[_0xde31('0x1b')](_0x10312b);}return _0x5205db[_0xde31('0x1c')](_0x10312b)[_0xde31('0x1d')]();};}function respondWithResult(_0x5446f3,_0x33c2a2){_0x33c2a2=_0x33c2a2||0xc8;return function(_0x3e0449){if(_0x3e0449){return _0x5446f3['status'](_0x33c2a2)[_0xde31('0x1e')](_0x3e0449);}};}function respondWithFilteredResult(_0x2aee21,_0x18cc3c){return function(_0x4b7194){if(_0x4b7194){var _0x4433b0=typeof _0x18cc3c[_0xde31('0x1f')]===_0xde31('0x20')&&typeof _0x18cc3c['limit']===_0xde31('0x20');var _0x305b1c=_0x4b7194['count'];var _0x589d5f=_0x4433b0?0x0:_0x18cc3c[_0xde31('0x1f')];var _0x34020c=_0x4433b0?_0x4b7194[_0xde31('0x21')]:_0x18cc3c[_0xde31('0x1f')]+_0x18cc3c[_0xde31('0x22')];var _0x13936a;if(_0x34020c>=_0x305b1c){_0x34020c=_0x305b1c;_0x13936a=0xc8;}else{_0x13936a=0xce;}_0x2aee21['status'](_0x13936a);return _0x2aee21[_0xde31('0x23')](_0xde31('0x24'),_0x589d5f+'-'+_0x34020c+'/'+_0x305b1c)['json'](_0x4b7194);}return null;};}function patchUpdates(_0x127103){return function(_0x3f9c53){try{jsonpatch['apply'](_0x3f9c53,_0x127103,!![]);}catch(_0x27ad37){return BPromise[_0xde31('0x25')](_0x27ad37);}return _0x3f9c53[_0xde31('0x26')]();};}function saveUpdates(_0xacb594,_0x2122e6){return function(_0x1d72bf){if(_0x1d72bf){return _0x1d72bf[_0xde31('0x27')](_0xacb594)[_0xde31('0x28')](function(_0x5abac7){return _0x5abac7;});}return null;};}function removeEntity(_0x5476ab,_0x1ad1b2){return function(_0x56dfb6){if(_0x56dfb6){return _0x56dfb6[_0xde31('0x29')]()[_0xde31('0x28')](function(){_0x5476ab[_0xde31('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574996,_0x5a8865){return function(_0x2755e6){if(!_0x2755e6){_0x574996[_0xde31('0x1b')](0x194);}return _0x2755e6;};}function handleError(_0x24df0d,_0xd02600){_0xd02600=_0xd02600||0x1f4;return function(_0x549db3){logger['error'](_0x549db3[_0xde31('0x2a')]);if(_0x549db3[_0xde31('0x2b')]){delete _0x549db3[_0xde31('0x2b')];}_0x24df0d[_0xde31('0x1c')](_0xd02600)[_0xde31('0x2c')](_0x549db3);};}exports['index']=function(_0x506ca5,_0x14e075){var _0x5325d9={},_0x5ce876={},_0xe9564d={'count':0x0,'rows':[]};var _0x338bcd=_[_0xde31('0x2d')](db['MailServerOut'][_0xde31('0x2e')],function(_0x54b90){return{'name':_0x54b90[_0xde31('0x2f')],'type':_0x54b90[_0xde31('0x30')]['key']};});_0x5ce876['model']=_[_0xde31('0x2d')](_0x338bcd,_0xde31('0x2b'));_0x5ce876[_0xde31('0x31')]=_[_0xde31('0x32')](_0x506ca5[_0xde31('0x31')]);_0x5ce876[_0xde31('0x33')]=_[_0xde31('0x34')](_0x5ce876[_0xde31('0x35')],_0x5ce876[_0xde31('0x31')]);_0x5325d9['attributes']=_[_0xde31('0x34')](_0x5ce876['model'],qs[_0xde31('0x36')](_0x506ca5[_0xde31('0x31')][_0xde31('0x36')]));_0x5325d9[_0xde31('0x37')]=_0x5325d9[_0xde31('0x37')][_0xde31('0x38')]?_0x5325d9['attributes']:_0x5ce876[_0xde31('0x35')];if(!_0x506ca5[_0xde31('0x31')]['hasOwnProperty']('nolimit')){_0x5325d9[_0xde31('0x22')]=qs[_0xde31('0x22')](_0x506ca5[_0xde31('0x31')][_0xde31('0x22')]);_0x5325d9[_0xde31('0x1f')]=qs[_0xde31('0x1f')](_0x506ca5[_0xde31('0x31')][_0xde31('0x1f')]);}_0x5325d9[_0xde31('0x39')]=qs[_0xde31('0x3a')](_0x506ca5[_0xde31('0x31')][_0xde31('0x3a')]);_0x5325d9[_0xde31('0x3b')]=qs[_0xde31('0x33')](_[_0xde31('0x3c')](_0x506ca5[_0xde31('0x31')],_0x5ce876[_0xde31('0x33')]),_0x338bcd);if(_0x506ca5[_0xde31('0x31')][_0xde31('0x3d')]){_0x5325d9[_0xde31('0x3b')]=_[_0xde31('0x3e')](_0x5325d9[_0xde31('0x3b')],{'$or':_[_0xde31('0x2d')](_0x338bcd,function(_0x5ab8c){if(_0x5ab8c[_0xde31('0x30')]!==_0xde31('0x3f')){var _0x77ef21={};_0x77ef21[_0x5ab8c[_0xde31('0x2b')]]={'$like':'%'+_0x506ca5[_0xde31('0x31')][_0xde31('0x3d')]+'%'};return _0x77ef21;}})});}_0x5325d9=_[_0xde31('0x3e')]({},_0x5325d9,_0x506ca5['options']);var _0x4f992c={'where':_0x5325d9[_0xde31('0x3b')]};return db[_0xde31('0x40')][_0xde31('0x21')](_0x4f992c)[_0xde31('0x28')](function(_0xcabe25){_0xe9564d['count']=_0xcabe25;if(_0x506ca5[_0xde31('0x31')]['includeAll']){_0x5325d9[_0xde31('0x41')]=[{'all':!![]}];}return db[_0xde31('0x40')][_0xde31('0x42')](_0x5325d9);})['then'](function(_0x1f7980){_0xe9564d[_0xde31('0x43')]=_0x1f7980;return _0xe9564d;})[_0xde31('0x28')](respondWithFilteredResult(_0x14e075,_0x5325d9))[_0xde31('0x44')](handleError(_0x14e075,null));};exports['show']=function(_0x5c2940,_0x406c97){var _0x12d70d={'raw':!![],'where':{'id':_0x5c2940[_0xde31('0x45')]['id']}},_0xf8a960={};_0xf8a960[_0xde31('0x35')]=_['keys'](db['MailServerOut'][_0xde31('0x2e')]);_0xf8a960[_0xde31('0x31')]=_[_0xde31('0x32')](_0x5c2940[_0xde31('0x31')]);_0xf8a960[_0xde31('0x33')]=_[_0xde31('0x34')](_0xf8a960['model'],_0xf8a960['query']);_0x12d70d[_0xde31('0x37')]=_[_0xde31('0x34')](_0xf8a960[_0xde31('0x35')],qs[_0xde31('0x36')](_0x5c2940[_0xde31('0x31')][_0xde31('0x36')]));_0x12d70d[_0xde31('0x37')]=_0x12d70d[_0xde31('0x37')][_0xde31('0x38')]?_0x12d70d[_0xde31('0x37')]:_0xf8a960[_0xde31('0x35')];if(_0x5c2940[_0xde31('0x31')][_0xde31('0x46')]){_0x12d70d['include']=[{'all':!![]}];}_0x12d70d=_['merge']({},_0x12d70d,_0x5c2940[_0xde31('0x47')]);return db[_0xde31('0x40')][_0xde31('0x48')](_0x12d70d)[_0xde31('0x28')](handleEntityNotFound(_0x406c97,null))['then'](respondWithResult(_0x406c97,null))[_0xde31('0x44')](handleError(_0x406c97,null));};exports[_0xde31('0x49')]=function(_0x484a18,_0x18600f){return db[_0xde31('0x40')][_0xde31('0x49')](_0x484a18['body'],{})['then'](respondWithResult(_0x18600f,0xc9))[_0xde31('0x44')](handleError(_0x18600f,null));};exports[_0xde31('0x27')]=function(_0x36afeb,_0x543606){if(_0x36afeb[_0xde31('0x4a')]['id']){delete _0x36afeb[_0xde31('0x4a')]['id'];}return db['MailServerOut'][_0xde31('0x48')]({'where':{'id':_0x36afeb[_0xde31('0x45')]['id']}})[_0xde31('0x28')](handleEntityNotFound(_0x543606,null))['then'](saveUpdates(_0x36afeb['body'],null))['then'](respondWithResult(_0x543606,null))[_0xde31('0x44')](handleError(_0x543606,null));};exports[_0xde31('0x29')]=function(_0x48ee19,_0x53565b){return db[_0xde31('0x40')][_0xde31('0x48')]({'where':{'id':_0x48ee19['params']['id']}})[_0xde31('0x28')](handleEntityNotFound(_0x53565b,null))[_0xde31('0x28')](removeEntity(_0x53565b,null))['catch'](handleError(_0x53565b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 62c5ac1..bb00d5f 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 _0xbbc9=['bluebird','path','./mailServerOut.attributes','mail_servers_out','lodash','util','../../config/logger','moment'];(function(_0x341c79,_0x28316d){var _0x1b893b=function(_0x183726){while(--_0x183726){_0x341c79['push'](_0x341c79['shift']());}};_0x1b893b(++_0x28316d);}(_0xbbc9,0x18c));var _0x9bbc=function(_0x7f4a3,_0x1bc525){_0x7f4a3=_0x7f4a3-0x0;var _0x333567=_0xbbc9[_0x7f4a3];return _0x333567;};'use strict';var _=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var logger=require(_0x9bbc('0x2'))('api');var moment=require(_0x9bbc('0x3'));var BPromise=require(_0x9bbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bbc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9bbc('0x6'));module['exports']=function(_0x57411d,_0x33aa29){return _0x57411d['define']('MailServerOut',attributes,{'tableName':_0x9bbc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b3=['MailServerOut','mail_servers_out','util','api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','define'];(function(_0x5b46be,_0x1b24f1){var _0xb01664=function(_0x6a4b70){while(--_0x6a4b70){_0x5b46be['push'](_0x5b46be['shift']());}};_0xb01664(++_0x1b24f1);}(_0x32b3,0xa2));var _0x332b=function(_0x4e0ab8,_0x401afb){_0x4e0ab8=_0x4e0ab8-0x0;var _0x4c1f40=_0x32b3[_0x4e0ab8];return _0x4c1f40;};'use strict';var _=require('lodash');var util=require(_0x332b('0x0'));var logger=require('../../config/logger')(_0x332b('0x1'));var moment=require(_0x332b('0x2'));var BPromise=require(_0x332b('0x3'));var rp=require(_0x332b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x332b('0x5'));var attributes=require(_0x332b('0x6'));module['exports']=function(_0x4ea6fb,_0x217364){return _0x4ea6fb[_0x332b('0x7')](_0x332b('0x8'),attributes,{'tableName':_0x332b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2bee4ba..277ab7c 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(_0x28038f,_0x492076){var _0x3b16b8=function(_0x55f30e){while(--_0x55f30e){_0x28038f['push'](_0x28038f['shift']());}};_0x3b16b8(++_0x492076);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c4c02,_0x48bdfb){_0x2c4c02=_0x2c4c02-0x0;var _0x364263=_0x2ef3[_0x2c4c02];return _0x364263;};'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(_0x41f96e,_0x333851){var _0x48a4ac=function(_0xdad934){while(--_0xdad934){_0x41f96e['push'](_0x41f96e['shift']());}};_0x48a4ac(++_0x333851);}(_0x1261,0x144));var _0x1126=function(_0x752005,_0x14dc74){_0x752005=_0x752005-0x0;var _0x40629c=_0x1261[_0x752005];return _0x40629c;};'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 6e63f80..f80f656 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 _0xbdc3=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x22739c,_0x575983){var _0x5ebbca=function(_0x510793){while(--_0x510793){_0x22739c['push'](_0x22739c['shift']());}};_0x5ebbca(++_0x575983);}(_0xbdc3,0x111));var _0x3bdc=function(_0x58c330,_0x4351c4){_0x58c330=_0x58c330-0x0;var _0xc4405e=_0xbdc3[_0x58c330];return _0xc4405e;};'use strict';var multer=require(_0x3bdc('0x0'));var util=require(_0x3bdc('0x1'));var path=require(_0x3bdc('0x2'));var timeout=require(_0x3bdc('0x3'));var express=require(_0x3bdc('0x4'));var router=express['Router']();var fs_extra=require(_0x3bdc('0x5'));var auth=require(_0x3bdc('0x6'));var interaction=require(_0x3bdc('0x7'));var config=require(_0x3bdc('0x8'));var controller=require(_0x3bdc('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3bdc('0xa')]);router[_0x3bdc('0xb')](_0x3bdc('0xc'),auth[_0x3bdc('0xd')](),controller[_0x3bdc('0xe')]);router[_0x3bdc('0xb')](_0x3bdc('0xf'),auth[_0x3bdc('0xd')](),controller[_0x3bdc('0x10')]);router[_0x3bdc('0x11')]('/',auth['isAuthenticated'](),controller[_0x3bdc('0x12')]);router[_0x3bdc('0x13')](_0x3bdc('0xf'),auth[_0x3bdc('0xd')](),controller[_0x3bdc('0x14')]);router[_0x3bdc('0x15')](_0x3bdc('0xf'),auth[_0x3bdc('0xd')](),controller[_0x3bdc('0x16')]);module[_0x3bdc('0x17')]=router; \ No newline at end of file +var _0x6b8d=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id'];(function(_0x5c63d8,_0x2842f1){var _0x2ea4a6=function(_0x3d7153){while(--_0x3d7153){_0x5c63d8['push'](_0x5c63d8['shift']());}};_0x2ea4a6(++_0x2842f1);}(_0x6b8d,0x1f2));var _0xd6b8=function(_0x101380,_0x1d7c22){_0x101380=_0x101380-0x0;var _0x39e846=_0x6b8d[_0x101380];return _0x39e846;};'use strict';var multer=require('multer');var util=require(_0xd6b8('0x0'));var path=require(_0xd6b8('0x1'));var timeout=require(_0xd6b8('0x2'));var express=require('express');var router=express[_0xd6b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd6b8('0x4'));var interaction=require(_0xd6b8('0x5'));var config=require('../../config/environment');var controller=require(_0xd6b8('0x6'));router[_0xd6b8('0x7')]('/',auth[_0xd6b8('0x8')](),controller['index']);router[_0xd6b8('0x7')](_0xd6b8('0x9'),auth[_0xd6b8('0x8')](),controller[_0xd6b8('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd6b8('0xb')]);router[_0xd6b8('0xc')]('/',auth[_0xd6b8('0x8')](),controller['create']);router[_0xd6b8('0xd')](_0xd6b8('0xe'),auth[_0xd6b8('0x8')](),controller[_0xd6b8('0xf')]);router[_0xd6b8('0x10')](_0xd6b8('0xe'),auth[_0xd6b8('0x8')](),controller[_0xd6b8('0x11')]);module[_0xd6b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index d337ac1..777af7d 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 _0x814b=['STRING','name','sequelize','exports'];(function(_0x4978b9,_0x20ed2f){var _0x2723b8=function(_0x142314){while(--_0x142314){_0x4978b9['push'](_0x4978b9['shift']());}};_0x2723b8(++_0x20ed2f);}(_0x814b,0x1a2));var _0xb814=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x814b[_0x423e15];return _0x184279;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file +var _0xb091=['exports','STRING','name'];(function(_0x3dd93c,_0x773411){var _0x3b2d49=function(_0x309467){while(--_0x309467){_0x3dd93c['push'](_0x3dd93c['shift']());}};_0x3b2d49(++_0x773411);}(_0xb091,0x16e));var _0x1b09=function(_0x162d8d,_0x4a3518){_0x162d8d=_0x162d8d-0x0;var _0x55aa45=_0xb091[_0x162d8d];return _0x55aa45;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 076cca9..95152d8 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 _0x4b93=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','index','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs'];(function(_0x4c2a8b,_0x450bc9){var _0x3e1be1=function(_0x2bfab8){while(--_0x2bfab8){_0x4c2a8b['push'](_0x4c2a8b['shift']());}};_0x3e1be1(++_0x450bc9);}(_0x4b93,0x11e));var _0x34b9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4b93[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x34b9('0x0'));var rimraf=require(_0x34b9('0x1'));var zipdir=require(_0x34b9('0x2'));var jsonpatch=require(_0x34b9('0x3'));var rp=require(_0x34b9('0x4'));var moment=require('moment');var BPromise=require(_0x34b9('0x5'));var Mustache=require(_0x34b9('0x6'));var util=require('util');var path=require(_0x34b9('0x7'));var sox=require('sox');var csv=require(_0x34b9('0x8'));var ejs=require(_0x34b9('0x9'));var fs=require('fs');var fs_extra=require(_0x34b9('0xa'));var _=require(_0x34b9('0xb'));var squel=require(_0x34b9('0xc'));var crypto=require(_0x34b9('0xd'));var jsforce=require(_0x34b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x34b9('0x8'));var querystring=require(_0x34b9('0xf'));var Papa=require(_0x34b9('0x10'));var Redis=require(_0x34b9('0x11'));var authService=require(_0x34b9('0x12'));var qs=require(_0x34b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34b9('0x14'));var logger=require(_0x34b9('0x15'))(_0x34b9('0x16'));var utils=require('../../config/utils');var config=require(_0x34b9('0x17'));var licenseUtil=require(_0x34b9('0x18'));var db=require(_0x34b9('0x19'))['db'];function respondWithStatusCode(_0x167004,_0x6510c7){_0x6510c7=_0x6510c7||0xcc;return function(_0x4b4ac0){if(_0x4b4ac0){return _0x167004[_0x34b9('0x1a')](_0x6510c7);}return _0x167004[_0x34b9('0x1b')](_0x6510c7)[_0x34b9('0x1c')]();};}function respondWithResult(_0x6972a1,_0x130de8){_0x130de8=_0x130de8||0xc8;return function(_0x158060){if(_0x158060){return _0x6972a1['status'](_0x130de8)[_0x34b9('0x1d')](_0x158060);}};}function respondWithFilteredResult(_0x239e32,_0x2acc4b){return function(_0x3387b4){if(_0x3387b4){var _0x4b1435=typeof _0x2acc4b[_0x34b9('0x1e')]===_0x34b9('0x1f')&&typeof _0x2acc4b[_0x34b9('0x20')]===_0x34b9('0x1f');var _0x1a89fa=_0x3387b4[_0x34b9('0x21')];var _0x37e06e=_0x4b1435?0x0:_0x2acc4b[_0x34b9('0x1e')];var _0x3aa8a5=_0x4b1435?_0x3387b4['count']:_0x2acc4b[_0x34b9('0x1e')]+_0x2acc4b[_0x34b9('0x20')];var _0x535cb2;if(_0x3aa8a5>=_0x1a89fa){_0x3aa8a5=_0x1a89fa;_0x535cb2=0xc8;}else{_0x535cb2=0xce;}_0x239e32[_0x34b9('0x1b')](_0x535cb2);return _0x239e32[_0x34b9('0x22')](_0x34b9('0x23'),_0x37e06e+'-'+_0x3aa8a5+'/'+_0x1a89fa)[_0x34b9('0x1d')](_0x3387b4);}return null;};}function patchUpdates(_0x420413){return function(_0x8b6ca5){try{jsonpatch[_0x34b9('0x24')](_0x8b6ca5,_0x420413,!![]);}catch(_0x1debc7){return BPromise['reject'](_0x1debc7);}return _0x8b6ca5['save']();};}function saveUpdates(_0x191305,_0x577f18){return function(_0x5ad578){if(_0x5ad578){return _0x5ad578[_0x34b9('0x25')](_0x191305)[_0x34b9('0x26')](function(_0x53b07c){return _0x53b07c;});}return null;};}function removeEntity(_0x3f9001,_0x5e290a){return function(_0x4ad8dc){if(_0x4ad8dc){return _0x4ad8dc[_0x34b9('0x27')]()[_0x34b9('0x26')](function(){_0x3f9001[_0x34b9('0x1b')](0xcc)[_0x34b9('0x1c')]();});}};}function handleEntityNotFound(_0x56eb2a,_0x7a3913){return function(_0x3f852e){if(!_0x3f852e){_0x56eb2a[_0x34b9('0x1a')](0x194);}return _0x3f852e;};}function handleError(_0x188ba5,_0x43092b){_0x43092b=_0x43092b||0x1f4;return function(_0xef6102){logger['error'](_0xef6102['stack']);if(_0xef6102[_0x34b9('0x28')]){delete _0xef6102[_0x34b9('0x28')];}_0x188ba5['status'](_0x43092b)['send'](_0xef6102);};}exports[_0x34b9('0x29')]=function(_0x122d87,_0x5d00eb){var _0x592023={},_0x6b6dc9={},_0x52657d={'count':0x0,'rows':[]};var _0x549072=_['map'](db[_0x34b9('0x2a')][_0x34b9('0x2b')],function(_0x4b0a27){return{'name':_0x4b0a27['fieldName'],'type':_0x4b0a27[_0x34b9('0x2c')][_0x34b9('0x2d')]};});_0x6b6dc9[_0x34b9('0x2e')]=_['map'](_0x549072,_0x34b9('0x28'));_0x6b6dc9[_0x34b9('0x2f')]=_[_0x34b9('0x30')](_0x122d87['query']);_0x6b6dc9[_0x34b9('0x31')]=_[_0x34b9('0x32')](_0x6b6dc9[_0x34b9('0x2e')],_0x6b6dc9[_0x34b9('0x2f')]);_0x592023[_0x34b9('0x33')]=_[_0x34b9('0x32')](_0x6b6dc9[_0x34b9('0x2e')],qs[_0x34b9('0x34')](_0x122d87[_0x34b9('0x2f')][_0x34b9('0x34')]));_0x592023['attributes']=_0x592023[_0x34b9('0x33')][_0x34b9('0x35')]?_0x592023[_0x34b9('0x33')]:_0x6b6dc9[_0x34b9('0x2e')];if(!_0x122d87[_0x34b9('0x2f')][_0x34b9('0x36')]('nolimit')){_0x592023[_0x34b9('0x20')]=qs[_0x34b9('0x20')](_0x122d87['query'][_0x34b9('0x20')]);_0x592023['offset']=qs[_0x34b9('0x1e')](_0x122d87[_0x34b9('0x2f')][_0x34b9('0x1e')]);}_0x592023[_0x34b9('0x37')]=qs['sort'](_0x122d87[_0x34b9('0x2f')][_0x34b9('0x38')]);_0x592023[_0x34b9('0x39')]=qs[_0x34b9('0x31')](_['pick'](_0x122d87[_0x34b9('0x2f')],_0x6b6dc9['filters']),_0x549072);if(_0x122d87[_0x34b9('0x2f')][_0x34b9('0x3a')]){_0x592023[_0x34b9('0x39')]=_['merge'](_0x592023[_0x34b9('0x39')],{'$or':_[_0x34b9('0x3b')](_0x549072,function(_0xc19998){if(_0xc19998[_0x34b9('0x2c')]!==_0x34b9('0x3c')){var _0x379155={};_0x379155[_0xc19998[_0x34b9('0x28')]]={'$like':'%'+_0x122d87[_0x34b9('0x2f')][_0x34b9('0x3a')]+'%'};return _0x379155;}})});}_0x592023=_[_0x34b9('0x3d')]({},_0x592023,_0x122d87[_0x34b9('0x3e')]);var _0x3cae0e={'where':_0x592023[_0x34b9('0x39')]};return db[_0x34b9('0x2a')][_0x34b9('0x21')](_0x3cae0e)['then'](function(_0x536cb2){_0x52657d[_0x34b9('0x21')]=_0x536cb2;if(_0x122d87[_0x34b9('0x2f')][_0x34b9('0x3f')]){_0x592023[_0x34b9('0x40')]=[{'all':!![]}];}return db[_0x34b9('0x2a')][_0x34b9('0x41')](_0x592023);})[_0x34b9('0x26')](function(_0x4217c3){_0x52657d[_0x34b9('0x42')]=_0x4217c3;return _0x52657d;})[_0x34b9('0x26')](respondWithFilteredResult(_0x5d00eb,_0x592023))[_0x34b9('0x43')](handleError(_0x5d00eb,null));};exports[_0x34b9('0x44')]=function(_0x1a43a0,_0x3da920){var _0x382b05={'raw':!![],'where':{'id':_0x1a43a0['params']['id']}},_0x48a75e={};_0x48a75e[_0x34b9('0x2e')]=_[_0x34b9('0x30')](db[_0x34b9('0x2a')][_0x34b9('0x2b')]);_0x48a75e[_0x34b9('0x2f')]=_[_0x34b9('0x30')](_0x1a43a0[_0x34b9('0x2f')]);_0x48a75e[_0x34b9('0x31')]=_[_0x34b9('0x32')](_0x48a75e[_0x34b9('0x2e')],_0x48a75e[_0x34b9('0x2f')]);_0x382b05[_0x34b9('0x33')]=_[_0x34b9('0x32')](_0x48a75e[_0x34b9('0x2e')],qs['fields'](_0x1a43a0['query'][_0x34b9('0x34')]));_0x382b05['attributes']=_0x382b05[_0x34b9('0x33')][_0x34b9('0x35')]?_0x382b05['attributes']:_0x48a75e[_0x34b9('0x2e')];if(_0x1a43a0[_0x34b9('0x2f')]['includeAll']){_0x382b05['include']=[{'all':!![]}];}_0x382b05=_[_0x34b9('0x3d')]({},_0x382b05,_0x1a43a0[_0x34b9('0x3e')]);return db['MailSubstatus']['find'](_0x382b05)[_0x34b9('0x26')](handleEntityNotFound(_0x3da920,null))[_0x34b9('0x26')](respondWithResult(_0x3da920,null))['catch'](handleError(_0x3da920,null));};exports[_0x34b9('0x45')]=function(_0x4c3acf,_0x3e7e80){return db[_0x34b9('0x2a')][_0x34b9('0x45')](_0x4c3acf[_0x34b9('0x46')],{})[_0x34b9('0x26')](respondWithResult(_0x3e7e80,0xc9))['catch'](handleError(_0x3e7e80,null));};exports[_0x34b9('0x25')]=function(_0x448ad8,_0x386085){if(_0x448ad8[_0x34b9('0x46')]['id']){delete _0x448ad8['body']['id'];}return db[_0x34b9('0x2a')][_0x34b9('0x47')]({'where':{'id':_0x448ad8[_0x34b9('0x48')]['id']}})[_0x34b9('0x26')](handleEntityNotFound(_0x386085,null))[_0x34b9('0x26')](saveUpdates(_0x448ad8['body'],null))[_0x34b9('0x26')](respondWithResult(_0x386085,null))[_0x34b9('0x43')](handleError(_0x386085,null));};exports[_0x34b9('0x27')]=function(_0x16591f,_0x4e6543){return db['MailSubstatus'][_0x34b9('0x47')]({'where':{'id':_0x16591f[_0x34b9('0x48')]['id']}})[_0x34b9('0x26')](handleEntityNotFound(_0x4e6543,null))[_0x34b9('0x26')](removeEntity(_0x4e6543,null))[_0x34b9('0x43')](handleError(_0x4e6543,null));};exports[_0x34b9('0x49')]=function(_0x3fe43c,_0x99d6a4){return db[_0x34b9('0x2a')][_0x34b9('0x49')]()[_0x34b9('0x26')](respondWithResult(_0x99d6a4,null))[_0x34b9('0x43')](handleError(_0x99d6a4,null));}; \ No newline at end of file +var _0x5df6=['type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','MailSubstatus','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName'];(function(_0x2afc0a,_0x3d5a9c){var _0x1f95fb=function(_0x5a550c){while(--_0x5a550c){_0x2afc0a['push'](_0x2afc0a['shift']());}};_0x1f95fb(++_0x3d5a9c);}(_0x5df6,0x1df));var _0x65df=function(_0x6ee324,_0x2d83ee){_0x6ee324=_0x6ee324-0x0;var _0x315fec=_0x5df6[_0x6ee324];return _0x315fec;};'use strict';var emlformat=require(_0x65df('0x0'));var rimraf=require(_0x65df('0x1'));var zipdir=require(_0x65df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65df('0x3'));var moment=require(_0x65df('0x4'));var BPromise=require(_0x65df('0x5'));var Mustache=require(_0x65df('0x6'));var util=require('util');var path=require(_0x65df('0x7'));var sox=require(_0x65df('0x8'));var csv=require('to-csv');var ejs=require(_0x65df('0x9'));var fs=require('fs');var fs_extra=require(_0x65df('0xa'));var _=require(_0x65df('0xb'));var squel=require('squel');var crypto=require(_0x65df('0xc'));var jsforce=require(_0x65df('0xd'));var deskjs=require(_0x65df('0xe'));var toCsv=require(_0x65df('0xf'));var querystring=require('querystring');var Papa=require(_0x65df('0x10'));var Redis=require(_0x65df('0x11'));var authService=require(_0x65df('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65df('0x14'))('api');var utils=require(_0x65df('0x15'));var config=require(_0x65df('0x16'));var licenseUtil=require(_0x65df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2747ab,_0x4c92b5){_0x4c92b5=_0x4c92b5||0xcc;return function(_0x17657a){if(_0x17657a){return _0x2747ab[_0x65df('0x18')](_0x4c92b5);}return _0x2747ab[_0x65df('0x19')](_0x4c92b5)[_0x65df('0x1a')]();};}function respondWithResult(_0x300d12,_0xfda560){_0xfda560=_0xfda560||0xc8;return function(_0x1f95f6){if(_0x1f95f6){return _0x300d12[_0x65df('0x19')](_0xfda560)[_0x65df('0x1b')](_0x1f95f6);}};}function respondWithFilteredResult(_0x5b541d,_0x449e8f){return function(_0x169947){if(_0x169947){var _0x1c7312=typeof _0x449e8f[_0x65df('0x1c')]===_0x65df('0x1d')&&typeof _0x449e8f['limit']===_0x65df('0x1d');var _0xc505b8=_0x169947[_0x65df('0x1e')];var _0x302620=_0x1c7312?0x0:_0x449e8f['offset'];var _0xf7a105=_0x1c7312?_0x169947['count']:_0x449e8f[_0x65df('0x1c')]+_0x449e8f[_0x65df('0x1f')];var _0x6589a3;if(_0xf7a105>=_0xc505b8){_0xf7a105=_0xc505b8;_0x6589a3=0xc8;}else{_0x6589a3=0xce;}_0x5b541d[_0x65df('0x19')](_0x6589a3);return _0x5b541d[_0x65df('0x20')](_0x65df('0x21'),_0x302620+'-'+_0xf7a105+'/'+_0xc505b8)[_0x65df('0x1b')](_0x169947);}return null;};}function patchUpdates(_0x44196a){return function(_0x47e7fc){try{jsonpatch[_0x65df('0x22')](_0x47e7fc,_0x44196a,!![]);}catch(_0x37075a){return BPromise['reject'](_0x37075a);}return _0x47e7fc[_0x65df('0x23')]();};}function saveUpdates(_0x1aa371,_0x29f1f8){return function(_0x3f64cb){if(_0x3f64cb){return _0x3f64cb[_0x65df('0x24')](_0x1aa371)[_0x65df('0x25')](function(_0x37b1b1){return _0x37b1b1;});}return null;};}function removeEntity(_0x18dbd9,_0x3a094a){return function(_0x270934){if(_0x270934){return _0x270934[_0x65df('0x26')]()['then'](function(){_0x18dbd9[_0x65df('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbb975a,_0x431584){return function(_0x499f41){if(!_0x499f41){_0xbb975a[_0x65df('0x18')](0x194);}return _0x499f41;};}function handleError(_0x3bab80,_0x1e2d8e){_0x1e2d8e=_0x1e2d8e||0x1f4;return function(_0x3048be){logger[_0x65df('0x27')](_0x3048be[_0x65df('0x28')]);if(_0x3048be[_0x65df('0x29')]){delete _0x3048be['name'];}_0x3bab80[_0x65df('0x19')](_0x1e2d8e)[_0x65df('0x2a')](_0x3048be);};}exports['index']=function(_0x1bb011,_0x48029f){var _0x2dee44={},_0x320154={},_0x32f2d7={'count':0x0,'rows':[]};var _0x1e7c4d=_[_0x65df('0x2b')](db['MailSubstatus'][_0x65df('0x2c')],function(_0x4f4c03){return{'name':_0x4f4c03[_0x65df('0x2d')],'type':_0x4f4c03[_0x65df('0x2e')][_0x65df('0x2f')]};});_0x320154[_0x65df('0x30')]=_[_0x65df('0x2b')](_0x1e7c4d,_0x65df('0x29'));_0x320154[_0x65df('0x31')]=_[_0x65df('0x32')](_0x1bb011[_0x65df('0x31')]);_0x320154[_0x65df('0x33')]=_[_0x65df('0x34')](_0x320154[_0x65df('0x30')],_0x320154[_0x65df('0x31')]);_0x2dee44[_0x65df('0x35')]=_[_0x65df('0x34')](_0x320154[_0x65df('0x30')],qs['fields'](_0x1bb011['query']['fields']));_0x2dee44[_0x65df('0x35')]=_0x2dee44[_0x65df('0x35')][_0x65df('0x36')]?_0x2dee44[_0x65df('0x35')]:_0x320154[_0x65df('0x30')];if(!_0x1bb011[_0x65df('0x31')][_0x65df('0x37')](_0x65df('0x38'))){_0x2dee44[_0x65df('0x1f')]=qs[_0x65df('0x1f')](_0x1bb011[_0x65df('0x31')][_0x65df('0x1f')]);_0x2dee44[_0x65df('0x1c')]=qs[_0x65df('0x1c')](_0x1bb011['query']['offset']);}_0x2dee44[_0x65df('0x39')]=qs[_0x65df('0x3a')](_0x1bb011[_0x65df('0x31')][_0x65df('0x3a')]);_0x2dee44[_0x65df('0x3b')]=qs['filters'](_['pick'](_0x1bb011[_0x65df('0x31')],_0x320154[_0x65df('0x33')]),_0x1e7c4d);if(_0x1bb011[_0x65df('0x31')][_0x65df('0x3c')]){_0x2dee44[_0x65df('0x3b')]=_['merge'](_0x2dee44['where'],{'$or':_[_0x65df('0x2b')](_0x1e7c4d,function(_0x52e920){if(_0x52e920['type']!==_0x65df('0x3d')){var _0x1e4477={};_0x1e4477[_0x52e920[_0x65df('0x29')]]={'$like':'%'+_0x1bb011[_0x65df('0x31')][_0x65df('0x3c')]+'%'};return _0x1e4477;}})});}_0x2dee44=_[_0x65df('0x3e')]({},_0x2dee44,_0x1bb011[_0x65df('0x3f')]);var _0x3babe8={'where':_0x2dee44['where']};return db[_0x65df('0x40')]['count'](_0x3babe8)[_0x65df('0x25')](function(_0x511971){_0x32f2d7[_0x65df('0x1e')]=_0x511971;if(_0x1bb011['query'][_0x65df('0x41')]){_0x2dee44[_0x65df('0x42')]=[{'all':!![]}];}return db[_0x65df('0x40')][_0x65df('0x43')](_0x2dee44);})[_0x65df('0x25')](function(_0x3c7bf4){_0x32f2d7['rows']=_0x3c7bf4;return _0x32f2d7;})[_0x65df('0x25')](respondWithFilteredResult(_0x48029f,_0x2dee44))[_0x65df('0x44')](handleError(_0x48029f,null));};exports[_0x65df('0x45')]=function(_0x4962be,_0x336bc9){var _0x100f63={'raw':!![],'where':{'id':_0x4962be[_0x65df('0x46')]['id']}},_0x27ba4e={};_0x27ba4e[_0x65df('0x30')]=_[_0x65df('0x32')](db[_0x65df('0x40')][_0x65df('0x2c')]);_0x27ba4e[_0x65df('0x31')]=_[_0x65df('0x32')](_0x4962be['query']);_0x27ba4e['filters']=_['intersection'](_0x27ba4e['model'],_0x27ba4e[_0x65df('0x31')]);_0x100f63[_0x65df('0x35')]=_[_0x65df('0x34')](_0x27ba4e[_0x65df('0x30')],qs[_0x65df('0x47')](_0x4962be[_0x65df('0x31')][_0x65df('0x47')]));_0x100f63[_0x65df('0x35')]=_0x100f63['attributes'][_0x65df('0x36')]?_0x100f63[_0x65df('0x35')]:_0x27ba4e[_0x65df('0x30')];if(_0x4962be[_0x65df('0x31')][_0x65df('0x41')]){_0x100f63[_0x65df('0x42')]=[{'all':!![]}];}_0x100f63=_[_0x65df('0x3e')]({},_0x100f63,_0x4962be['options']);return db[_0x65df('0x40')][_0x65df('0x48')](_0x100f63)[_0x65df('0x25')](handleEntityNotFound(_0x336bc9,null))[_0x65df('0x25')](respondWithResult(_0x336bc9,null))[_0x65df('0x44')](handleError(_0x336bc9,null));};exports['create']=function(_0x43eeb4,_0xdfc6de){return db['MailSubstatus'][_0x65df('0x49')](_0x43eeb4[_0x65df('0x4a')],{})[_0x65df('0x25')](respondWithResult(_0xdfc6de,0xc9))[_0x65df('0x44')](handleError(_0xdfc6de,null));};exports[_0x65df('0x24')]=function(_0x534e6e,_0x32bdfa){if(_0x534e6e[_0x65df('0x4a')]['id']){delete _0x534e6e[_0x65df('0x4a')]['id'];}return db[_0x65df('0x40')][_0x65df('0x48')]({'where':{'id':_0x534e6e[_0x65df('0x46')]['id']}})['then'](handleEntityNotFound(_0x32bdfa,null))[_0x65df('0x25')](saveUpdates(_0x534e6e['body'],null))[_0x65df('0x25')](respondWithResult(_0x32bdfa,null))[_0x65df('0x44')](handleError(_0x32bdfa,null));};exports['destroy']=function(_0xee7a77,_0xf10cb1){return db[_0x65df('0x40')]['find']({'where':{'id':_0xee7a77['params']['id']}})[_0x65df('0x25')](handleEntityNotFound(_0xf10cb1,null))[_0x65df('0x25')](removeEntity(_0xf10cb1,null))['catch'](handleError(_0xf10cb1,null));};exports['describe']=function(_0x2564c2,_0x4d5f58){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x4d5f58,null))[_0x65df('0x44')](handleError(_0x4d5f58,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 8ba37bf..e7ffe37 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 _0xe17e=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','update','emit'];(function(_0x124755,_0x4b774e){var _0x3fd751=function(_0x20d35d){while(--_0x20d35d){_0x124755['push'](_0x124755['shift']());}};_0x3fd751(++_0x4b774e);}(_0xe17e,0x17b));var _0xee17=function(_0x312820,_0x2ef133){_0x312820=_0x312820-0x0;var _0x29fd18=_0xe17e[_0x312820];return _0x29fd18;};'use strict';var EventEmitter=require(_0xee17('0x0'));var MailSubstatus=require(_0xee17('0x1'))['db'][_0xee17('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xee17('0x3')};function emitEvent(_0x59672b){return function(_0x3c70d8,_0x57587a,_0x41403a){MailSubstatusEvents[_0xee17('0x4')](_0x59672b+':'+_0x3c70d8['id'],_0x3c70d8);MailSubstatusEvents['emit'](_0x59672b,_0x3c70d8);_0x41403a(null);};}for(var e in events){if(events[_0xee17('0x5')](e)){var event=events[e];MailSubstatus[_0xee17('0x6')](e,emitEvent(event));}}module[_0xee17('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xdca7=['events','setMaxListeners','update','hasOwnProperty','exports'];(function(_0x542291,_0x2d360a){var _0x48681f=function(_0x22d824){while(--_0x22d824){_0x542291['push'](_0x542291['shift']());}};_0x48681f(++_0x2d360a);}(_0xdca7,0xe1));var _0x7dca=function(_0xc40e38,_0x5e39b2){_0xc40e38=_0xc40e38-0x0;var _0x448ddc=_0xdca7[_0xc40e38];return _0x448ddc;};'use strict';var EventEmitter=require(_0x7dca('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7dca('0x1')](0x0);var events={'afterUpdate':_0x7dca('0x2')};function emitEvent(_0x21ac6b){return function(_0x14b7e0,_0xb4d4e0,_0xf0c9c){MailSubstatusEvents['emit'](_0x21ac6b+':'+_0x14b7e0['id'],_0x14b7e0);MailSubstatusEvents['emit'](_0x21ac6b,_0x14b7e0);_0xf0c9c(null);};}for(var e in events){if(events[_0x7dca('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x7dca('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index faa1708..aca506c 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 _0xd6a7=['name','then','catch','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues'];(function(_0x5d2a9d,_0x469ccc){var _0x147449=function(_0x5b3e4b){while(--_0x5b3e4b){_0x5d2a9d['push'](_0x5d2a9d['shift']());}};_0x147449(++_0x469ccc);}(_0xd6a7,0x18f));var _0x7d6a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd6a7[_0x3ab51d];return _0x29a04e;};'use strict';var attributes=require(_0x7d6a('0x0'));module['exports']=function(_0xf6d743){var _0x41b199=_0xf6d743['models'];return _0xf6d743[_0x7d6a('0x1')](_0x7d6a('0x2'),attributes,{'tableName':_0x7d6a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x266bb7,_0x531c88,_0x8e29db){return _0x41b199[_0x7d6a('0x4')][_0x7d6a('0x5')]({'value':_0x266bb7['name']},{'where':{'field':_0x7d6a('0x6'),'value':_0x266bb7[_0x7d6a('0x7')][_0x7d6a('0x8')]}})[_0x7d6a('0x9')](function(){_0x8e29db();})[_0x7d6a('0xa')](function(_0x263bdc){_0x8e29db(_0x263bdc);});}}});}; \ No newline at end of file +var _0x759e=['update','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition'];(function(_0x51061c,_0x483c5d){var _0x11f827=function(_0x1c16ab){while(--_0x1c16ab){_0x51061c['push'](_0x51061c['shift']());}};_0x11f827(++_0x483c5d);}(_0x759e,0xd1));var _0xe759=function(_0x1f30b9,_0x3cd8a7){_0x1f30b9=_0x1f30b9-0x0;var _0x1ccd3f=_0x759e[_0x1f30b9];return _0x1ccd3f;};'use strict';var attributes=require(_0xe759('0x0'));module[_0xe759('0x1')]=function(_0x4e71da){var _0x8a0e24=_0x4e71da[_0xe759('0x2')];return _0x4e71da[_0xe759('0x3')](_0xe759('0x4'),attributes,{'tableName':_0xe759('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x21998e,_0x11450f,_0x33e669){return _0x8a0e24[_0xe759('0x6')][_0xe759('0x7')]({'value':_0x21998e['name']},{'where':{'field':'mailSubstatus','value':_0x21998e[_0xe759('0x8')][_0xe759('0x9')]}})[_0xe759('0xa')](function(){_0x33e669();})[_0xe759('0xb')](function(_0x27515e){_0x33e669(_0x27515e);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a6b6e68..71a69a0 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 _0x7698=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x7698,0x1e3));var _0x8769=function(_0x311073,_0x108dd4){_0x311073=_0x311073-0x0;var _0x29e2bf=_0x7698[_0x311073];return _0x29e2bf;};'use strict';var _=require(_0x8769('0x0'));var util=require(_0x8769('0x1'));var moment=require(_0x8769('0x2'));var BPromise=require(_0x8769('0x3'));var rs=require(_0x8769('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8769('0x5'));var logger=require(_0x8769('0x6'))('rpc');var config=require(_0x8769('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8769('0x8')][_0x8769('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49aec9,_0x1b2941,_0x5c526d){return new BPromise(function(_0x15fbe7,_0x1eb125){return client['request'](_0x49aec9,_0x5c526d)[_0x8769('0xa')](function(_0x2a442a){logger[_0x8769('0xb')](_0x8769('0xc'),_0x1b2941,_0x8769('0xd'));logger[_0x8769('0xe')](_0x8769('0xf'),_0x1b2941,'request\x20sent',JSON['stringify'](_0x2a442a));if(_0x2a442a[_0x8769('0x10')]){if(_0x2a442a[_0x8769('0x10')][_0x8769('0x11')]===0x1f4){logger[_0x8769('0x10')](_0x8769('0xc'),_0x1b2941,_0x2a442a['error'][_0x8769('0x12')]);return _0x1eb125(_0x2a442a[_0x8769('0x10')][_0x8769('0x12')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1b2941,_0x2a442a['error'][_0x8769('0x12')]);return _0x15fbe7(_0x2a442a[_0x8769('0x10')][_0x8769('0x12')]);}else{logger[_0x8769('0xb')](_0x8769('0xc'),_0x1b2941,_0x8769('0xd'));_0x15fbe7(_0x2a442a[_0x8769('0x13')][_0x8769('0x12')]);}})[_0x8769('0x14')](function(_0x2009b3){logger[_0x8769('0x10')](_0x8769('0xc'),_0x1b2941,_0x2009b3);_0x1eb125(_0x2009b3);});});} \ No newline at end of file +var _0x9eab=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x9eab,0xd1));var _0xb9ea=function(_0x41b2e6,_0x25c830){_0x41b2e6=_0x41b2e6-0x0;var _0x287d65=_0x9eab[_0x41b2e6];return _0x287d65;};'use strict';var _=require('lodash');var util=require(_0xb9ea('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ea('0x1'));var db=require(_0xb9ea('0x2'))['db'];var utils=require(_0xb9ea('0x3'));var logger=require(_0xb9ea('0x4'))('rpc');var config=require(_0xb9ea('0x5'));var jayson=require(_0xb9ea('0x6'));var client=jayson['client'][_0xb9ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a56b6,_0x11b8c6,_0x144df6){return new BPromise(function(_0x165406,_0x321f4c){return client[_0xb9ea('0x8')](_0x1a56b6,_0x144df6)[_0xb9ea('0x9')](function(_0x398c12){logger[_0xb9ea('0xa')](_0xb9ea('0xb'),_0x11b8c6,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x11b8c6,_0xb9ea('0xc'),JSON[_0xb9ea('0xd')](_0x398c12));if(_0x398c12[_0xb9ea('0xe')]){if(_0x398c12['error'][_0xb9ea('0xf')]===0x1f4){logger[_0xb9ea('0xe')](_0xb9ea('0xb'),_0x11b8c6,_0x398c12[_0xb9ea('0xe')][_0xb9ea('0x10')]);return _0x321f4c(_0x398c12[_0xb9ea('0xe')][_0xb9ea('0x10')]);}logger['error'](_0xb9ea('0xb'),_0x11b8c6,_0x398c12[_0xb9ea('0xe')][_0xb9ea('0x10')]);return _0x165406(_0x398c12[_0xb9ea('0xe')][_0xb9ea('0x10')]);}else{logger[_0xb9ea('0xa')](_0xb9ea('0xb'),_0x11b8c6,'request\x20sent');_0x165406(_0x398c12[_0xb9ea('0x11')][_0xb9ea('0x10')]);}})[_0xb9ea('0x12')](function(_0x547bed){logger[_0xb9ea('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x11b8c6,_0x547bed);_0x321f4c(_0x547bed);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9b34c43..82d3fae 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 _0xa7b3=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0xa7b3,0x139));var _0x3a7b=function(_0x350b0f,_0x3e6207){_0x350b0f=_0x350b0f-0x0;var _0x1fefe0=_0xa7b3[_0x350b0f];return _0x1fefe0;};'use strict';var multer=require(_0x3a7b('0x0'));var util=require(_0x3a7b('0x1'));var path=require('path');var timeout=require(_0x3a7b('0x2'));var express=require(_0x3a7b('0x3'));var router=express[_0x3a7b('0x4')]();var fs_extra=require(_0x3a7b('0x5'));var auth=require(_0x3a7b('0x6'));var interaction=require(_0x3a7b('0x7'));var config=require(_0x3a7b('0x8'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x3a7b('0x9')](),controller[_0x3a7b('0xa')]);router[_0x3a7b('0xb')](_0x3a7b('0xc'),auth[_0x3a7b('0x9')](),controller['describe']);router[_0x3a7b('0xb')](_0x3a7b('0xd'),auth['isAuthenticated'](),controller[_0x3a7b('0xe')]);router[_0x3a7b('0xf')]('/',auth[_0x3a7b('0x9')](),controller['create']);router['put'](_0x3a7b('0xd'),auth[_0x3a7b('0x9')](),controller[_0x3a7b('0x10')]);router[_0x3a7b('0x11')](_0x3a7b('0xd'),auth['isAuthenticated'](),controller[_0x3a7b('0x12')]);module[_0x3a7b('0x13')]=router; \ No newline at end of file +var _0x2a40=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a40,0x150));var _0x02a4=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x2a40[_0x59b2a1];return _0x4908d1;};'use strict';var multer=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var path=require('path');var timeout=require(_0x02a4('0x2'));var express=require(_0x02a4('0x3'));var router=express['Router']();var fs_extra=require(_0x02a4('0x4'));var auth=require(_0x02a4('0x5'));var interaction=require(_0x02a4('0x6'));var config=require(_0x02a4('0x7'));var controller=require('./mailTransferReport.controller');router[_0x02a4('0x8')]('/',auth[_0x02a4('0x9')](),controller[_0x02a4('0xa')]);router[_0x02a4('0x8')]('/describe',auth[_0x02a4('0x9')](),controller[_0x02a4('0xb')]);router[_0x02a4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x02a4('0xc')]);router[_0x02a4('0xd')]('/',auth[_0x02a4('0x9')](),controller[_0x02a4('0xe')]);router['put'](_0x02a4('0xf'),auth[_0x02a4('0x9')](),controller[_0x02a4('0x10')]);router[_0x02a4('0x11')](_0x02a4('0xf'),auth[_0x02a4('0x9')](),controller[_0x02a4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4b59998..1fbb4de 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x166421,_0x5940e6){var _0x3f9834=function(_0xc947d0){while(--_0xc947d0){_0x166421['push'](_0x166421['shift']());}};_0x3f9834(++_0x5940e6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xcb91[_0x5712f8];return _0x14a364;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x218681,_0x16971b){var _0x56c5de=function(_0x34b75a){while(--_0x34b75a){_0x218681['push'](_0x218681['shift']());}};_0x56c5de(++_0x16971b);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6b570fe..5f60258 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 _0xa8eb=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailTransferReport','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x14d7e3,_0x3435e0){var _0x5edcea=function(_0x1bccfe){while(--_0x1bccfe){_0x14d7e3['push'](_0x14d7e3['shift']());}};_0x5edcea(++_0x3435e0);}(_0xa8eb,0xd2));var _0xba8e=function(_0x2bbe21,_0x37eed2){_0x2bbe21=_0x2bbe21-0x0;var _0x267896=_0xa8eb[_0x2bbe21];return _0x267896;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba8e('0x0'));var zipdir=require(_0xba8e('0x1'));var jsonpatch=require(_0xba8e('0x2'));var rp=require('request-promise');var moment=require(_0xba8e('0x3'));var BPromise=require(_0xba8e('0x4'));var Mustache=require(_0xba8e('0x5'));var util=require(_0xba8e('0x6'));var path=require(_0xba8e('0x7'));var sox=require(_0xba8e('0x8'));var csv=require(_0xba8e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba8e('0xa'));var _=require('lodash');var squel=require(_0xba8e('0xb'));var crypto=require(_0xba8e('0xc'));var jsforce=require(_0xba8e('0xd'));var deskjs=require(_0xba8e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xba8e('0xf'));var Papa=require(_0xba8e('0x10'));var Redis=require(_0xba8e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xba8e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba8e('0x13'));var logger=require('../../config/logger')(_0xba8e('0x14'));var utils=require(_0xba8e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xba8e('0x16'));var db=require(_0xba8e('0x17'))['db'];function respondWithStatusCode(_0x1705d5,_0x5a69d4){_0x5a69d4=_0x5a69d4||0xcc;return function(_0x1f546b){if(_0x1f546b){return _0x1705d5[_0xba8e('0x18')](_0x5a69d4);}return _0x1705d5[_0xba8e('0x19')](_0x5a69d4)[_0xba8e('0x1a')]();};}function respondWithResult(_0x45b636,_0x52c3ba){_0x52c3ba=_0x52c3ba||0xc8;return function(_0x1edf2a){if(_0x1edf2a){return _0x45b636[_0xba8e('0x19')](_0x52c3ba)['json'](_0x1edf2a);}};}function respondWithFilteredResult(_0x58f861,_0x15286b){return function(_0x452cc5){if(_0x452cc5){var _0x558c27=typeof _0x15286b[_0xba8e('0x1b')]===_0xba8e('0x1c')&&typeof _0x15286b['limit']==='undefined';var _0x4305cb=_0x452cc5[_0xba8e('0x1d')];var _0x17109d=_0x558c27?0x0:_0x15286b[_0xba8e('0x1b')];var _0x1044bd=_0x558c27?_0x452cc5[_0xba8e('0x1d')]:_0x15286b[_0xba8e('0x1b')]+_0x15286b[_0xba8e('0x1e')];var _0x59e78c;if(_0x1044bd>=_0x4305cb){_0x1044bd=_0x4305cb;_0x59e78c=0xc8;}else{_0x59e78c=0xce;}_0x58f861['status'](_0x59e78c);return _0x58f861[_0xba8e('0x1f')](_0xba8e('0x20'),_0x17109d+'-'+_0x1044bd+'/'+_0x4305cb)[_0xba8e('0x21')](_0x452cc5);}return null;};}function patchUpdates(_0x8295d5){return function(_0x3dc03e){try{jsonpatch[_0xba8e('0x22')](_0x3dc03e,_0x8295d5,!![]);}catch(_0x59ebef){return BPromise[_0xba8e('0x23')](_0x59ebef);}return _0x3dc03e[_0xba8e('0x24')]();};}function saveUpdates(_0x1a3348,_0x39fb72){return function(_0x5b6bac){if(_0x5b6bac){return _0x5b6bac[_0xba8e('0x25')](_0x1a3348)[_0xba8e('0x26')](function(_0x44ff21){return _0x44ff21;});}return null;};}function removeEntity(_0x3a846a,_0x242622){return function(_0x29f266){if(_0x29f266){return _0x29f266[_0xba8e('0x27')]()[_0xba8e('0x26')](function(){_0x3a846a['status'](0xcc)[_0xba8e('0x1a')]();});}};}function handleEntityNotFound(_0x46099f,_0x5b3697){return function(_0x46a13e){if(!_0x46a13e){_0x46099f[_0xba8e('0x18')](0x194);}return _0x46a13e;};}function handleError(_0x1834a8,_0x57d786){_0x57d786=_0x57d786||0x1f4;return function(_0x2feaaa){logger[_0xba8e('0x28')](_0x2feaaa[_0xba8e('0x29')]);if(_0x2feaaa[_0xba8e('0x2a')]){delete _0x2feaaa['name'];}_0x1834a8[_0xba8e('0x19')](_0x57d786)['send'](_0x2feaaa);};}exports[_0xba8e('0x2b')]=function(_0x488c06,_0x229d30){var _0x893994={},_0x252882={},_0x10b1ee={'count':0x0,'rows':[]};var _0x364f37=_['map'](db['MailTransferReport'][_0xba8e('0x2c')],function(_0x4db2f2){return{'name':_0x4db2f2[_0xba8e('0x2d')],'type':_0x4db2f2[_0xba8e('0x2e')][_0xba8e('0x2f')]};});_0x252882[_0xba8e('0x30')]=_[_0xba8e('0x31')](_0x364f37,_0xba8e('0x2a'));_0x252882[_0xba8e('0x32')]=_['keys'](_0x488c06['query']);_0x252882[_0xba8e('0x33')]=_[_0xba8e('0x34')](_0x252882[_0xba8e('0x30')],_0x252882[_0xba8e('0x32')]);_0x893994['attributes']=_[_0xba8e('0x34')](_0x252882[_0xba8e('0x30')],qs[_0xba8e('0x35')](_0x488c06[_0xba8e('0x32')][_0xba8e('0x35')]));_0x893994[_0xba8e('0x36')]=_0x893994[_0xba8e('0x36')][_0xba8e('0x37')]?_0x893994['attributes']:_0x252882[_0xba8e('0x30')];if(!_0x488c06[_0xba8e('0x32')][_0xba8e('0x38')](_0xba8e('0x39'))){_0x893994[_0xba8e('0x1e')]=qs[_0xba8e('0x1e')](_0x488c06[_0xba8e('0x32')][_0xba8e('0x1e')]);_0x893994[_0xba8e('0x1b')]=qs[_0xba8e('0x1b')](_0x488c06[_0xba8e('0x32')][_0xba8e('0x1b')]);}_0x893994[_0xba8e('0x3a')]=qs[_0xba8e('0x3b')](_0x488c06[_0xba8e('0x32')]['sort']);_0x893994[_0xba8e('0x3c')]=qs['filters'](_[_0xba8e('0x3d')](_0x488c06['query'],_0x252882[_0xba8e('0x33')]),_0x364f37);if(_0x488c06['query'][_0xba8e('0x3e')]){_0x893994[_0xba8e('0x3c')]=_[_0xba8e('0x3f')](_0x893994['where'],{'$or':_[_0xba8e('0x31')](_0x364f37,function(_0xd747a9){if(_0xd747a9[_0xba8e('0x2e')]!=='VIRTUAL'){var _0x3e0418={};_0x3e0418[_0xd747a9[_0xba8e('0x2a')]]={'$like':'%'+_0x488c06[_0xba8e('0x32')][_0xba8e('0x3e')]+'%'};return _0x3e0418;}})});}_0x893994=_[_0xba8e('0x3f')]({},_0x893994,_0x488c06['options']);var _0x14ff52={'where':_0x893994['where']};return db[_0xba8e('0x40')][_0xba8e('0x1d')](_0x14ff52)[_0xba8e('0x26')](function(_0x56f1ad){_0x10b1ee[_0xba8e('0x1d')]=_0x56f1ad;if(_0x488c06[_0xba8e('0x32')][_0xba8e('0x41')]){_0x893994[_0xba8e('0x42')]=[{'all':!![]}];}return db[_0xba8e('0x40')][_0xba8e('0x43')](_0x893994);})[_0xba8e('0x26')](function(_0x30c145){_0x10b1ee[_0xba8e('0x44')]=_0x30c145;return _0x10b1ee;})[_0xba8e('0x26')](respondWithFilteredResult(_0x229d30,_0x893994))[_0xba8e('0x45')](handleError(_0x229d30,null));};exports[_0xba8e('0x46')]=function(_0x5de21d,_0x11b968){var _0x11430a={'raw':!![],'where':{'id':_0x5de21d['params']['id']}},_0x2020fc={};_0x2020fc[_0xba8e('0x30')]=_['keys'](db[_0xba8e('0x40')]['rawAttributes']);_0x2020fc['query']=_['keys'](_0x5de21d['query']);_0x2020fc[_0xba8e('0x33')]=_[_0xba8e('0x34')](_0x2020fc[_0xba8e('0x30')],_0x2020fc[_0xba8e('0x32')]);_0x11430a[_0xba8e('0x36')]=_[_0xba8e('0x34')](_0x2020fc[_0xba8e('0x30')],qs[_0xba8e('0x35')](_0x5de21d[_0xba8e('0x32')][_0xba8e('0x35')]));_0x11430a[_0xba8e('0x36')]=_0x11430a[_0xba8e('0x36')]['length']?_0x11430a[_0xba8e('0x36')]:_0x2020fc[_0xba8e('0x30')];if(_0x5de21d[_0xba8e('0x32')][_0xba8e('0x41')]){_0x11430a[_0xba8e('0x42')]=[{'all':!![]}];}_0x11430a=_[_0xba8e('0x3f')]({},_0x11430a,_0x5de21d[_0xba8e('0x47')]);return db[_0xba8e('0x40')]['find'](_0x11430a)['then'](handleEntityNotFound(_0x11b968,null))[_0xba8e('0x26')](respondWithResult(_0x11b968,null))[_0xba8e('0x45')](handleError(_0x11b968,null));};exports[_0xba8e('0x48')]=function(_0xaf80b9,_0xd99652){return db['MailTransferReport'][_0xba8e('0x48')](_0xaf80b9[_0xba8e('0x49')],{})['then'](respondWithResult(_0xd99652,0xc9))[_0xba8e('0x45')](handleError(_0xd99652,null));};exports['update']=function(_0x4794eb,_0x48ea4e){if(_0x4794eb[_0xba8e('0x49')]['id']){delete _0x4794eb['body']['id'];}return db['MailTransferReport'][_0xba8e('0x4a')]({'where':{'id':_0x4794eb[_0xba8e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48ea4e,null))[_0xba8e('0x26')](saveUpdates(_0x4794eb[_0xba8e('0x49')],null))[_0xba8e('0x26')](respondWithResult(_0x48ea4e,null))[_0xba8e('0x45')](handleError(_0x48ea4e,null));};exports[_0xba8e('0x27')]=function(_0x474aa3,_0x38e4bc){return db[_0xba8e('0x40')][_0xba8e('0x4a')]({'where':{'id':_0x474aa3[_0xba8e('0x4b')]['id']}})[_0xba8e('0x26')](handleEntityNotFound(_0x38e4bc,null))['then'](removeEntity(_0x38e4bc,null))[_0xba8e('0x45')](handleError(_0x38e4bc,null));};exports[_0xba8e('0x4c')]=function(_0x319da9,_0x9740f9){return db[_0xba8e('0x40')]['describe']()[_0xba8e('0x26')](respondWithResult(_0x9740f9,null))[_0xba8e('0x45')](handleError(_0x9740f9,null));}; \ No newline at end of file +var _0xfe38=['zip-dir','fast-json-patch','request-promise','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','merge','VIRTUAL','filter','options','MailTransferReport','findAll','rows','show','params','rawAttributes','includeAll','include','catch','create','body','find','destroy','describe','eml-format'];(function(_0x14e749,_0x577378){var _0x30c94a=function(_0x56addb){while(--_0x56addb){_0x14e749['push'](_0x14e749['shift']());}};_0x30c94a(++_0x577378);}(_0xfe38,0x171));var _0x8fe3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe38[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x8fe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe3('0x1'));var jsonpatch=require(_0x8fe3('0x2'));var rp=require(_0x8fe3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8fe3('0x4'));var path=require(_0x8fe3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8fe3('0x6'));var fs=require('fs');var fs_extra=require(_0x8fe3('0x7'));var _=require(_0x8fe3('0x8'));var squel=require(_0x8fe3('0x9'));var crypto=require(_0x8fe3('0xa'));var jsforce=require(_0x8fe3('0xb'));var deskjs=require(_0x8fe3('0xc'));var toCsv=require(_0x8fe3('0xd'));var querystring=require(_0x8fe3('0xe'));var Papa=require(_0x8fe3('0xf'));var Redis=require(_0x8fe3('0x10'));var authService=require(_0x8fe3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8fe3('0x12'));var hardwareService=require(_0x8fe3('0x13'));var logger=require(_0x8fe3('0x14'))(_0x8fe3('0x15'));var utils=require(_0x8fe3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8fe3('0x17'));var db=require(_0x8fe3('0x18'))['db'];function respondWithStatusCode(_0x42c11c,_0x2fa142){_0x2fa142=_0x2fa142||0xcc;return function(_0x9fed06){if(_0x9fed06){return _0x42c11c[_0x8fe3('0x19')](_0x2fa142);}return _0x42c11c[_0x8fe3('0x1a')](_0x2fa142)[_0x8fe3('0x1b')]();};}function respondWithResult(_0x4d32ed,_0x45aad1){_0x45aad1=_0x45aad1||0xc8;return function(_0x2e7edd){if(_0x2e7edd){return _0x4d32ed[_0x8fe3('0x1a')](_0x45aad1)['json'](_0x2e7edd);}};}function respondWithFilteredResult(_0x2fb6bb,_0x317a17){return function(_0x494252){if(_0x494252){var _0x5c9ff6=typeof _0x317a17[_0x8fe3('0x1c')]===_0x8fe3('0x1d')&&typeof _0x317a17['limit']===_0x8fe3('0x1d');var _0x3e29b9=_0x494252[_0x8fe3('0x1e')];var _0x23d739=_0x5c9ff6?0x0:_0x317a17[_0x8fe3('0x1c')];var _0x3a621a=_0x5c9ff6?_0x494252[_0x8fe3('0x1e')]:_0x317a17[_0x8fe3('0x1c')]+_0x317a17[_0x8fe3('0x1f')];var _0x19d1e8;if(_0x3a621a>=_0x3e29b9){_0x3a621a=_0x3e29b9;_0x19d1e8=0xc8;}else{_0x19d1e8=0xce;}_0x2fb6bb['status'](_0x19d1e8);return _0x2fb6bb['set'](_0x8fe3('0x20'),_0x23d739+'-'+_0x3a621a+'/'+_0x3e29b9)[_0x8fe3('0x21')](_0x494252);}return null;};}function patchUpdates(_0x3f3349){return function(_0x4563a7){try{jsonpatch['apply'](_0x4563a7,_0x3f3349,!![]);}catch(_0x29e855){return BPromise[_0x8fe3('0x22')](_0x29e855);}return _0x4563a7[_0x8fe3('0x23')]();};}function saveUpdates(_0x3faeec,_0x79b345){return function(_0x5908da){if(_0x5908da){return _0x5908da[_0x8fe3('0x24')](_0x3faeec)['then'](function(_0x189d2d){return _0x189d2d;});}return null;};}function removeEntity(_0xd2613,_0x134494){return function(_0x1cff8a){if(_0x1cff8a){return _0x1cff8a['destroy']()[_0x8fe3('0x25')](function(){_0xd2613[_0x8fe3('0x1a')](0xcc)[_0x8fe3('0x1b')]();});}};}function handleEntityNotFound(_0x5edf9c,_0x2f8678){return function(_0x4ee66e){if(!_0x4ee66e){_0x5edf9c[_0x8fe3('0x19')](0x194);}return _0x4ee66e;};}function handleError(_0x1e2402,_0x55b673){_0x55b673=_0x55b673||0x1f4;return function(_0x4554fa){logger['error'](_0x4554fa[_0x8fe3('0x26')]);if(_0x4554fa['name']){delete _0x4554fa[_0x8fe3('0x27')];}_0x1e2402[_0x8fe3('0x1a')](_0x55b673)['send'](_0x4554fa);};}exports[_0x8fe3('0x28')]=function(_0x29d202,_0xaeda35){var _0x55da5b={},_0x59b3c5={},_0x10c921={'count':0x0,'rows':[]};var _0x4573f2=_[_0x8fe3('0x29')](db['MailTransferReport']['rawAttributes'],function(_0x3abbde){return{'name':_0x3abbde[_0x8fe3('0x2a')],'type':_0x3abbde[_0x8fe3('0x2b')][_0x8fe3('0x2c')]};});_0x59b3c5[_0x8fe3('0x2d')]=_[_0x8fe3('0x29')](_0x4573f2,_0x8fe3('0x27'));_0x59b3c5[_0x8fe3('0x2e')]=_[_0x8fe3('0x2f')](_0x29d202[_0x8fe3('0x2e')]);_0x59b3c5['filters']=_['intersection'](_0x59b3c5[_0x8fe3('0x2d')],_0x59b3c5[_0x8fe3('0x2e')]);_0x55da5b[_0x8fe3('0x30')]=_[_0x8fe3('0x31')](_0x59b3c5[_0x8fe3('0x2d')],qs['fields'](_0x29d202[_0x8fe3('0x2e')][_0x8fe3('0x32')]));_0x55da5b['attributes']=_0x55da5b[_0x8fe3('0x30')][_0x8fe3('0x33')]?_0x55da5b[_0x8fe3('0x30')]:_0x59b3c5[_0x8fe3('0x2d')];if(!_0x29d202[_0x8fe3('0x2e')]['hasOwnProperty'](_0x8fe3('0x34'))){_0x55da5b[_0x8fe3('0x1f')]=qs[_0x8fe3('0x1f')](_0x29d202[_0x8fe3('0x2e')]['limit']);_0x55da5b['offset']=qs['offset'](_0x29d202[_0x8fe3('0x2e')][_0x8fe3('0x1c')]);}_0x55da5b[_0x8fe3('0x35')]=qs[_0x8fe3('0x36')](_0x29d202['query'][_0x8fe3('0x36')]);_0x55da5b['where']=qs[_0x8fe3('0x37')](_['pick'](_0x29d202[_0x8fe3('0x2e')],_0x59b3c5[_0x8fe3('0x37')]),_0x4573f2);if(_0x29d202[_0x8fe3('0x2e')]['filter']){_0x55da5b['where']=_[_0x8fe3('0x38')](_0x55da5b['where'],{'$or':_[_0x8fe3('0x29')](_0x4573f2,function(_0x143cb2){if(_0x143cb2['type']!==_0x8fe3('0x39')){var _0x925be6={};_0x925be6[_0x143cb2[_0x8fe3('0x27')]]={'$like':'%'+_0x29d202[_0x8fe3('0x2e')][_0x8fe3('0x3a')]+'%'};return _0x925be6;}})});}_0x55da5b=_[_0x8fe3('0x38')]({},_0x55da5b,_0x29d202[_0x8fe3('0x3b')]);var _0x345b51={'where':_0x55da5b['where']};return db[_0x8fe3('0x3c')][_0x8fe3('0x1e')](_0x345b51)[_0x8fe3('0x25')](function(_0x4289d5){_0x10c921[_0x8fe3('0x1e')]=_0x4289d5;if(_0x29d202[_0x8fe3('0x2e')]['includeAll']){_0x55da5b['include']=[{'all':!![]}];}return db[_0x8fe3('0x3c')][_0x8fe3('0x3d')](_0x55da5b);})[_0x8fe3('0x25')](function(_0x5e3324){_0x10c921[_0x8fe3('0x3e')]=_0x5e3324;return _0x10c921;})[_0x8fe3('0x25')](respondWithFilteredResult(_0xaeda35,_0x55da5b))['catch'](handleError(_0xaeda35,null));};exports[_0x8fe3('0x3f')]=function(_0x9f5c60,_0x40dc99){var _0x766d94={'raw':!![],'where':{'id':_0x9f5c60[_0x8fe3('0x40')]['id']}},_0xf87445={};_0xf87445[_0x8fe3('0x2d')]=_['keys'](db[_0x8fe3('0x3c')][_0x8fe3('0x41')]);_0xf87445[_0x8fe3('0x2e')]=_[_0x8fe3('0x2f')](_0x9f5c60[_0x8fe3('0x2e')]);_0xf87445[_0x8fe3('0x37')]=_[_0x8fe3('0x31')](_0xf87445[_0x8fe3('0x2d')],_0xf87445[_0x8fe3('0x2e')]);_0x766d94[_0x8fe3('0x30')]=_['intersection'](_0xf87445[_0x8fe3('0x2d')],qs[_0x8fe3('0x32')](_0x9f5c60[_0x8fe3('0x2e')][_0x8fe3('0x32')]));_0x766d94[_0x8fe3('0x30')]=_0x766d94[_0x8fe3('0x30')][_0x8fe3('0x33')]?_0x766d94[_0x8fe3('0x30')]:_0xf87445[_0x8fe3('0x2d')];if(_0x9f5c60[_0x8fe3('0x2e')][_0x8fe3('0x42')]){_0x766d94[_0x8fe3('0x43')]=[{'all':!![]}];}_0x766d94=_[_0x8fe3('0x38')]({},_0x766d94,_0x9f5c60[_0x8fe3('0x3b')]);return db[_0x8fe3('0x3c')]['find'](_0x766d94)['then'](handleEntityNotFound(_0x40dc99,null))['then'](respondWithResult(_0x40dc99,null))[_0x8fe3('0x44')](handleError(_0x40dc99,null));};exports[_0x8fe3('0x45')]=function(_0x33d3c3,_0x2dde6f){return db[_0x8fe3('0x3c')][_0x8fe3('0x45')](_0x33d3c3[_0x8fe3('0x46')],{})[_0x8fe3('0x25')](respondWithResult(_0x2dde6f,0xc9))[_0x8fe3('0x44')](handleError(_0x2dde6f,null));};exports[_0x8fe3('0x24')]=function(_0x46b14a,_0x53890a){if(_0x46b14a[_0x8fe3('0x46')]['id']){delete _0x46b14a['body']['id'];}return db['MailTransferReport'][_0x8fe3('0x47')]({'where':{'id':_0x46b14a[_0x8fe3('0x40')]['id']}})[_0x8fe3('0x25')](handleEntityNotFound(_0x53890a,null))['then'](saveUpdates(_0x46b14a[_0x8fe3('0x46')],null))[_0x8fe3('0x25')](respondWithResult(_0x53890a,null))[_0x8fe3('0x44')](handleError(_0x53890a,null));};exports[_0x8fe3('0x48')]=function(_0x1de56c,_0x1b5ec0){return db[_0x8fe3('0x3c')][_0x8fe3('0x47')]({'where':{'id':_0x1de56c[_0x8fe3('0x40')]['id']}})[_0x8fe3('0x25')](handleEntityNotFound(_0x1b5ec0,null))['then'](removeEntity(_0x1b5ec0,null))['catch'](handleError(_0x1b5ec0,null));};exports[_0x8fe3('0x49')]=function(_0x1a862a,_0x5dcaa8){return db[_0x8fe3('0x3c')]['describe']()[_0x8fe3('0x25')](respondWithResult(_0x5dcaa8,null))[_0x8fe3('0x44')](handleError(_0x5dcaa8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 89b1094..55859a6 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 _0x0f3c=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','bluebird'];(function(_0x456cb7,_0x3237d7){var _0x5eb574=function(_0x1dfc70){while(--_0x1dfc70){_0x456cb7['push'](_0x456cb7['shift']());}};_0x5eb574(++_0x3237d7);}(_0x0f3c,0x189));var _0xc0f3=function(_0x5e62e8,_0x3d4975){_0x5e62e8=_0x5e62e8-0x0;var _0x2eb445=_0x0f3c[_0x5e62e8];return _0x2eb445;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc0f3('0x2'));var rp=require(_0xc0f3('0x3'));var fs=require('fs');var path=require(_0xc0f3('0x4'));var rimraf=require(_0xc0f3('0x5'));var config=require(_0xc0f3('0x6'));var attributes=require(_0xc0f3('0x7'));module[_0xc0f3('0x8')]=function(_0x256643,_0x4b76a0){return _0x256643[_0xc0f3('0x9')](_0xc0f3('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xc0f3('0xb'),'fields':[_0xc0f3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4491=['uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x5ba549,_0x425afd){var _0x36e3a1=function(_0x464308){while(--_0x464308){_0x5ba549['push'](_0x5ba549['shift']());}};_0x36e3a1(++_0x425afd);}(_0x4491,0x1bb));var _0x1449=function(_0x232f9c,_0x3ae9df){_0x232f9c=_0x232f9c-0x0;var _0x24bb71=_0x4491[_0x232f9c];return _0x24bb71;};'use strict';var _=require(_0x1449('0x0'));var util=require('util');var logger=require(_0x1449('0x1'))('api');var moment=require(_0x1449('0x2'));var BPromise=require(_0x1449('0x3'));var rp=require(_0x1449('0x4'));var fs=require('fs');var path=require(_0x1449('0x5'));var rimraf=require(_0x1449('0x6'));var config=require(_0x1449('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x1449('0x8')]=function(_0x557482,_0x1d45eb){return _0x557482[_0x1449('0x9')](_0x1449('0xa'),attributes,{'tableName':_0x1449('0xb'),'paranoid':![],'indexes':[{'name':_0x1449('0xc'),'fields':[_0x1449('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ca96945..c13d3e6 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 _0x5ee6=['rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ee6,0x1dc));var _0x65ee=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5ee6[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x65ee('0x0'));var util=require(_0x65ee('0x1'));var moment=require(_0x65ee('0x2'));var BPromise=require(_0x65ee('0x3'));var rs=require(_0x65ee('0x4'));var fs=require('fs');var Redis=require(_0x65ee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x65ee('0x6'));var logger=require('../../config/logger')(_0x65ee('0x7'));var config=require(_0x65ee('0x8'));var jayson=require(_0x65ee('0x9'));var client=jayson[_0x65ee('0xa')][_0x65ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92b9d7,_0x3209d6,_0x3918d5){return new BPromise(function(_0x139d6f,_0xd2c0cb){return client[_0x65ee('0xc')](_0x92b9d7,_0x3918d5)['then'](function(_0xa0faa7){logger[_0x65ee('0xd')](_0x65ee('0xe'),_0x3209d6,_0x65ee('0xf'));logger[_0x65ee('0x10')](_0x65ee('0x11'),_0x3209d6,_0x65ee('0xf'),JSON['stringify'](_0xa0faa7));if(_0xa0faa7[_0x65ee('0x12')]){if(_0xa0faa7[_0x65ee('0x12')][_0x65ee('0x13')]===0x1f4){logger[_0x65ee('0x12')](_0x65ee('0xe'),_0x3209d6,_0xa0faa7['error'][_0x65ee('0x14')]);return _0xd2c0cb(_0xa0faa7[_0x65ee('0x12')][_0x65ee('0x14')]);}logger[_0x65ee('0x12')](_0x65ee('0xe'),_0x3209d6,_0xa0faa7[_0x65ee('0x12')][_0x65ee('0x14')]);return _0x139d6f(_0xa0faa7[_0x65ee('0x12')][_0x65ee('0x14')]);}else{logger[_0x65ee('0xd')](_0x65ee('0xe'),_0x3209d6,_0x65ee('0xf'));_0x139d6f(_0xa0faa7[_0x65ee('0x15')][_0x65ee('0x14')]);}})[_0x65ee('0x16')](function(_0x107abc){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x3209d6,_0x107abc);_0xd2c0cb(_0x107abc);});});} \ No newline at end of file +var _0x2a6f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2d13a0,_0x571ae1){var _0x5ae242=function(_0x3e0fa3){while(--_0x3e0fa3){_0x2d13a0['push'](_0x2d13a0['shift']());}};_0x5ae242(++_0x571ae1);}(_0x2a6f,0x15b));var _0xf2a6=function(_0x3a97fe,_0x2c33e2){_0x3a97fe=_0x3a97fe-0x0;var _0x182b1a=_0x2a6f[_0x3a97fe];return _0x182b1a;};'use strict';var _=require(_0xf2a6('0x0'));var util=require(_0xf2a6('0x1'));var moment=require(_0xf2a6('0x2'));var BPromise=require(_0xf2a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2a6('0x4'));var db=require(_0xf2a6('0x5'))['db'];var utils=require(_0xf2a6('0x6'));var logger=require(_0xf2a6('0x7'))(_0xf2a6('0x8'));var config=require(_0xf2a6('0x9'));var jayson=require(_0xf2a6('0xa'));var client=jayson[_0xf2a6('0xb')][_0xf2a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c3fae,_0x4dce99,_0x4537be){return new BPromise(function(_0x1a0df5,_0x4817ea){return client[_0xf2a6('0xd')](_0x2c3fae,_0x4537be)[_0xf2a6('0xe')](function(_0x316d64){logger[_0xf2a6('0xf')](_0xf2a6('0x10'),_0x4dce99,'request\x20sent');logger[_0xf2a6('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4dce99,_0xf2a6('0x12'),JSON[_0xf2a6('0x13')](_0x316d64));if(_0x316d64['error']){if(_0x316d64[_0xf2a6('0x14')][_0xf2a6('0x15')]===0x1f4){logger[_0xf2a6('0x14')](_0xf2a6('0x10'),_0x4dce99,_0x316d64['error'][_0xf2a6('0x16')]);return _0x4817ea(_0x316d64[_0xf2a6('0x14')][_0xf2a6('0x16')]);}logger[_0xf2a6('0x14')](_0xf2a6('0x10'),_0x4dce99,_0x316d64[_0xf2a6('0x14')]['message']);return _0x1a0df5(_0x316d64['error'][_0xf2a6('0x16')]);}else{logger[_0xf2a6('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4dce99,_0xf2a6('0x12'));_0x1a0df5(_0x316d64[_0xf2a6('0x17')][_0xf2a6('0x16')]);}})[_0xf2a6('0x18')](function(_0x38069f){logger[_0xf2a6('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x4dce99,_0x38069f);_0x4817ea(_0x38069f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index fa3247d..3252e84 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 _0x79e5=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x2c4bd9,_0x572ce6){var _0x5ad8d5=function(_0x5627b3){while(--_0x5627b3){_0x2c4bd9['push'](_0x2c4bd9['shift']());}};_0x5ad8d5(++_0x572ce6);}(_0x79e5,0x1a2));var _0x579e=function(_0x22b0f1,_0x1dc86e){_0x22b0f1=_0x22b0f1-0x0;var _0x3fe3ba=_0x79e5[_0x22b0f1];return _0x3fe3ba;};'use strict';var multer=require('multer');var util=require(_0x579e('0x0'));var path=require(_0x579e('0x1'));var timeout=require('connect-timeout');var express=require(_0x579e('0x2'));var router=express[_0x579e('0x3')]();var fs_extra=require(_0x579e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x579e('0x5'));var config=require(_0x579e('0x6'));var controller=require(_0x579e('0x7'));router[_0x579e('0x8')]('/',auth['isAuthenticated'](),controller[_0x579e('0x9')]);router[_0x579e('0x8')](_0x579e('0xa'),auth[_0x579e('0xb')](),controller[_0x579e('0xc')]);router[_0x579e('0x8')](_0x579e('0xd'),auth[_0x579e('0xb')](),controller[_0x579e('0xe')]);router[_0x579e('0xf')]('/',auth[_0x579e('0xb')](),controller[_0x579e('0x10')]);router[_0x579e('0x11')](_0x579e('0xd'),auth[_0x579e('0xb')](),controller['update']);router[_0x579e('0x12')](_0x579e('0xd'),auth[_0x579e('0xb')](),controller[_0x579e('0x13')]);module[_0x579e('0x14')]=router; \ No newline at end of file +var _0x6e81=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x6e81,0x161));var _0x16e8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6e81[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x16e8('0x0'));var util=require('util');var path=require(_0x16e8('0x1'));var timeout=require(_0x16e8('0x2'));var express=require(_0x16e8('0x3'));var router=express[_0x16e8('0x4')]();var fs_extra=require(_0x16e8('0x5'));var auth=require(_0x16e8('0x6'));var interaction=require(_0x16e8('0x7'));var config=require(_0x16e8('0x8'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x16e8('0x9')]);router[_0x16e8('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x16e8('0xa')](_0x16e8('0xb'),auth[_0x16e8('0xc')](),controller[_0x16e8('0xd')]);router[_0x16e8('0xe')]('/',auth[_0x16e8('0xc')](),controller[_0x16e8('0xf')]);router[_0x16e8('0x10')](_0x16e8('0xb'),auth[_0x16e8('0xc')](),controller[_0x16e8('0x11')]);router[_0x16e8('0x12')](_0x16e8('0xb'),auth[_0x16e8('0xc')](),controller[_0x16e8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7caf9ed..7095365 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 _0x524c=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','INTEGER','sequelize','moment','exports','STRING'];(function(_0x4a5f06,_0x10b1c5){var _0x16d163=function(_0x17ce0b){while(--_0x17ce0b){_0x4a5f06['push'](_0x4a5f06['shift']());}};_0x16d163(++_0x10b1c5);}(_0x524c,0x183));var _0xc524=function(_0x40605b,_0x3b9e3f){_0x40605b=_0x40605b-0x0;var _0x470eac=_0x524c[_0x40605b];return _0x470eac;};'use strict';var Sequelize=require(_0xc524('0x0'));var moment=require(_0xc524('0x1'));module[_0xc524('0x2')]={'channel':{'type':Sequelize[_0xc524('0x3')]},'membername':{'type':Sequelize[_0xc524('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc524('0x3')],'defaultValue':_0xc524('0x4'),'comment':_0xc524('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xc524('0x6')]},'exitAt':{'type':Sequelize[_0xc524('0x6')],'set':function(_0x4f3d1b){var _0x4af51c=moment(_0x4f3d1b);var _0x45c6a4=moment(this[_0xc524('0x7')](_0xc524('0x8')));var _0xba19ea=_0x4af51c['diff'](_0x45c6a4,_0xc524('0x9'));this[_0xc524('0xa')](_0xc524('0xb'),_0x4f3d1b);this[_0xc524('0xa')](_0xc524('0xc'),_0xba19ea>=0x0?_0xba19ea:null);}},'data1':{'type':Sequelize[_0xc524('0x3')],'comment':_0xc524('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xc524('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xc524('0xf')},'data4':{'type':Sequelize[_0xc524('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xc524('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xc524('0x3')]},'internal':{'type':Sequelize[_0xc524('0x10')]},'uniqueid':{'type':Sequelize[_0xc524('0x3')]}}; \ No newline at end of file +var _0xba6d=['getDataValue','enterAt','diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xba6d,0xfb));var _0xdba6=function(_0x103ad9,_0x52cbb7){_0x103ad9=_0x103ad9-0x0;var _0x1ca422=_0xba6d[_0x103ad9];return _0x1ca422;};'use strict';var Sequelize=require(_0xdba6('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xdba6('0x1')]},'membername':{'type':Sequelize[_0xdba6('0x1')]},'interface':{'type':Sequelize[_0xdba6('0x1')]},'type':{'type':Sequelize[_0xdba6('0x1')],'defaultValue':_0xdba6('0x2'),'comment':_0xdba6('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdba6('0x4')],'set':function(_0x318f19){var _0xa1e964=moment(_0x318f19);var _0x4e32a3=moment(this[_0xdba6('0x5')](_0xdba6('0x6')));var _0x4f6e5f=_0xa1e964[_0xdba6('0x7')](_0x4e32a3,_0xdba6('0x8'));this['setDataValue'](_0xdba6('0x9'),_0x318f19);this[_0xdba6('0xa')]('duration',_0x4f6e5f>=0x0?_0x4f6e5f:null);}},'data1':{'type':Sequelize[_0xdba6('0x1')],'comment':_0xdba6('0xb')},'data2':{'type':Sequelize[_0xdba6('0x1')],'comment':_0xdba6('0xc')},'data3':{'type':Sequelize[_0xdba6('0x1')],'comment':_0xdba6('0xd')},'data4':{'type':Sequelize[_0xdba6('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xdba6('0x1')],'comment':_0xdba6('0xe')},'role':{'type':Sequelize[_0xdba6('0x1')]},'internal':{'type':Sequelize[_0xdba6('0xf')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 09a65e0..0b4b2b9 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5628b8,_0x145582){var _0x3ce423=function(_0x114c97){while(--_0x114c97){_0x5628b8['push'](_0x5628b8['shift']());}};_0x3ce423(++_0x145582);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _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(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x34e8,0x12c));var _0x834e=function(_0x1624ec,_0x70ed95){_0x1624ec=_0x1624ec-0x0;var _0xf1f7a0=_0x34e8[_0x1624ec];return _0xf1f7a0;};'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 0067610..95634a6 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 _0x6114=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport'];(function(_0xe21e1e,_0x42314b){var _0x4a1193=function(_0x26048c){while(--_0x26048c){_0xe21e1e['push'](_0xe21e1e['shift']());}};_0x4a1193(++_0x42314b);}(_0x6114,0x6d));var _0x4611=function(_0x1f2c15,_0x202189){_0x1f2c15=_0x1f2c15-0x0;var _0x16a8bf=_0x6114[_0x1f2c15];return _0x16a8bf;};'use strict';var _=require(_0x4611('0x0'));var util=require(_0x4611('0x1'));var logger=require(_0x4611('0x2'))(_0x4611('0x3'));var moment=require(_0x4611('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4611('0x5'));var rimraf=require('rimraf');var config=require(_0x4611('0x6'));var attributes=require(_0x4611('0x7'));module[_0x4611('0x8')]=function(_0x5382da,_0x58f54d){return _0x5382da[_0x4611('0x9')](_0x4611('0xa'),attributes,{'tableName':_0x4611('0xb'),'paranoid':![],'indexes':[{'name':_0x4611('0xc'),'fields':[_0x4611('0xd'),_0x4611('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8002=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','moment'];(function(_0x489811,_0x284fe2){var _0x490591=function(_0x1776f0){while(--_0x1776f0){_0x489811['push'](_0x489811['shift']());}};_0x490591(++_0x284fe2);}(_0x8002,0xf9));var _0x2800=function(_0x3760ae,_0x3760c5){_0x3760ae=_0x3760ae-0x0;var _0x4b0a59=_0x8002[_0x3760ae];return _0x4b0a59;};'use strict';var _=require(_0x2800('0x0'));var util=require('util');var logger=require(_0x2800('0x1'))('api');var moment=require(_0x2800('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2800('0x3'));var rimraf=require(_0x2800('0x4'));var config=require(_0x2800('0x5'));var attributes=require(_0x2800('0x6'));module[_0x2800('0x7')]=function(_0x9348ad,_0x30245b){return _0x9348ad[_0x2800('0x8')](_0x2800('0x9'),attributes,{'tableName':_0x2800('0xa'),'paranoid':![],'indexes':[{'name':_0x2800('0xb'),'fields':[_0x2800('0xc'),_0x2800('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 b9baaa4..af9e3ef 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 _0xf96b=['code','message','result','GetMemberReport','MemberReport','findAll','options','raw','attributes','include','map','model','catch','CreateMemberReport','body','UpdateMemberReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x46962c,_0x1d1ed9){var _0x49d075=function(_0x3e5974){while(--_0x3e5974){_0x46962c['push'](_0x46962c['shift']());}};_0x49d075(++_0x1d1ed9);}(_0xf96b,0x109));var _0xbf96=function(_0x1b3ac3,_0x2aba71){_0x1b3ac3=_0x1b3ac3-0x0;var _0x178f63=_0xf96b[_0x1b3ac3];return _0x178f63;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var moment=require(_0xbf96('0x2'));var BPromise=require(_0xbf96('0x3'));var rs=require(_0xbf96('0x4'));var fs=require('fs');var Redis=require(_0xbf96('0x5'));var db=require(_0xbf96('0x6'))['db'];var utils=require(_0xbf96('0x7'));var logger=require(_0xbf96('0x8'))(_0xbf96('0x9'));var config=require(_0xbf96('0xa'));var jayson=require(_0xbf96('0xb'));var client=jayson[_0xbf96('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8271,_0x9270ca,_0x260da0){return new BPromise(function(_0x88b9fa,_0x56d77d){return client[_0xbf96('0xd')](_0x3e8271,_0x260da0)[_0xbf96('0xe')](function(_0x1ffe6b){logger[_0xbf96('0xf')](_0xbf96('0x10'),_0x9270ca,_0xbf96('0x11'));logger[_0xbf96('0x12')](_0xbf96('0x13'),_0x9270ca,'request\x20sent',JSON[_0xbf96('0x14')](_0x1ffe6b));if(_0x1ffe6b[_0xbf96('0x15')]){if(_0x1ffe6b['error'][_0xbf96('0x16')]===0x1f4){logger[_0xbf96('0x15')](_0xbf96('0x10'),_0x9270ca,_0x1ffe6b['error'][_0xbf96('0x17')]);return _0x56d77d(_0x1ffe6b[_0xbf96('0x15')][_0xbf96('0x17')]);}logger[_0xbf96('0x15')](_0xbf96('0x10'),_0x9270ca,_0x1ffe6b[_0xbf96('0x15')]['message']);return _0x88b9fa(_0x1ffe6b[_0xbf96('0x15')][_0xbf96('0x17')]);}else{logger[_0xbf96('0xf')](_0xbf96('0x10'),_0x9270ca,_0xbf96('0x11'));_0x88b9fa(_0x1ffe6b[_0xbf96('0x18')][_0xbf96('0x17')]);}})['catch'](function(_0x3296a7){logger['error'](_0xbf96('0x10'),_0x9270ca,_0x3296a7);_0x56d77d(_0x3296a7);});});}exports[_0xbf96('0x19')]=function(_0x568425){var _0x1e9707=this;return new Promise(function(_0x64b2f9,_0x597e5d){return db[_0xbf96('0x1a')][_0xbf96('0x1b')]({'raw':_0x568425[_0xbf96('0x1c')]?_0x568425[_0xbf96('0x1c')][_0xbf96('0x1d')]===undefined?!![]:![]:!![],'where':_0x568425[_0xbf96('0x1c')]?_0x568425[_0xbf96('0x1c')]['where']||null:null,'attributes':_0x568425[_0xbf96('0x1c')]?_0x568425['options'][_0xbf96('0x1e')]||null:null,'limit':_0x568425[_0xbf96('0x1c')]?_0x568425[_0xbf96('0x1c')]['limit']||null:null,'include':_0x568425[_0xbf96('0x1c')]?_0x568425['options'][_0xbf96('0x1f')]?_[_0xbf96('0x20')](_0x568425[_0xbf96('0x1c')]['include'],function(_0x1c92f9){return{'model':db[_0x1c92f9[_0xbf96('0x21')]],'as':_0x1c92f9['as'],'attributes':_0x1c92f9['attributes'],'include':_0x1c92f9['include']?_[_0xbf96('0x20')](_0x1c92f9[_0xbf96('0x1f')],function(_0x363379){return{'model':db[_0x363379['model']],'as':_0x363379['as'],'attributes':_0x363379[_0xbf96('0x1e')],'include':_0x363379['include']?_['map'](_0x363379[_0xbf96('0x1f')],function(_0x30f345){return{'model':db[_0x30f345[_0xbf96('0x21')]],'as':_0x30f345['as'],'attributes':_0x30f345[_0xbf96('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2f86){logger[_0xbf96('0xf')](_0xbf96('0x19'),_0x568425);logger[_0xbf96('0x12')]('GetMemberReport',_0x568425,JSON['stringify'](_0x3c2f86));_0x64b2f9(_0x3c2f86);})[_0xbf96('0x22')](function(_0x1366e6){logger[_0xbf96('0x15')](_0xbf96('0x19'),_0x1366e6[_0xbf96('0x17')],_0x568425);_0x597e5d(_0x1e9707[_0xbf96('0x15')](0x1f4,_0x1366e6[_0xbf96('0x17')]));});});};exports[_0xbf96('0x23')]=function(_0x4da3e6){var _0x2725cf=this;return new Promise(function(_0x24eef8,_0x29fcde){return db['MemberReport']['create'](_0x4da3e6[_0xbf96('0x24')],{'raw':_0x4da3e6['options']?_0x4da3e6[_0xbf96('0x1c')][_0xbf96('0x1d')]===undefined?!![]:![]:!![]})[_0xbf96('0xe')](function(_0x39e086){logger[_0xbf96('0xf')](_0xbf96('0x23'),_0x4da3e6);logger[_0xbf96('0x12')](_0xbf96('0x23'),_0x4da3e6,JSON[_0xbf96('0x14')](_0x39e086));_0x24eef8(_0x39e086);})['catch'](function(_0x446f5b){logger['error'](_0xbf96('0x23'),_0x446f5b[_0xbf96('0x17')],_0x4da3e6);_0x29fcde(_0x2725cf[_0xbf96('0x15')](0x1f4,_0x446f5b['message']));});});};exports[_0xbf96('0x25')]=function(_0x16c68e){var _0xb8cd93=this;return new Promise(function(_0x18b592,_0x138dbd){return db[_0xbf96('0x1a')][_0xbf96('0x26')](_0x16c68e[_0xbf96('0x24')],{'raw':_0x16c68e['options']?_0x16c68e[_0xbf96('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16c68e[_0xbf96('0x1c')]?_0x16c68e[_0xbf96('0x1c')][_0xbf96('0x27')]||null:null,'attributes':_0x16c68e[_0xbf96('0x1c')]?_0x16c68e[_0xbf96('0x1c')]['attributes']||null:null,'limit':_0x16c68e[_0xbf96('0x1c')]?_0x16c68e['options'][_0xbf96('0x28')]||null:null})[_0xbf96('0xe')](function(_0x44adfa){logger[_0xbf96('0xf')](_0xbf96('0x25'),_0x16c68e);logger[_0xbf96('0x12')]('UpdateMemberReport',_0x16c68e,JSON[_0xbf96('0x14')](_0x44adfa));_0x18b592(_0x44adfa);})['catch'](function(_0x2f367e){logger[_0xbf96('0x15')](_0xbf96('0x25'),_0x2f367e['message'],_0x16c68e);_0x138dbd(_0xb8cd93[_0xbf96('0x15')](0x1f4,_0x2f367e[_0xbf96('0x17')]));});});}; \ No newline at end of file +var _0x965d=['where','limit','include','model','attributes','map','stringify','create','body','CreateMemberReport','UpdateMemberReport','MemberReport','update','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','code','error','message','MemberReport,\x20%s,\x20%s','result','GetMemberReport','options','raw'];(function(_0x38f023,_0x2d7137){var _0x36ecbd=function(_0x3f135a){while(--_0x3f135a){_0x38f023['push'](_0x38f023['shift']());}};_0x36ecbd(++_0x2d7137);}(_0x965d,0x1be));var _0xd965=function(_0x5d376e,_0x144b52){_0x5d376e=_0x5d376e-0x0;var _0xa472f5=_0x965d[_0x5d376e];return _0xa472f5;};'use strict';var _=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rs=require(_0xd965('0x3'));var fs=require('fs');var Redis=require(_0xd965('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd965('0x5'));var logger=require(_0xd965('0x6'))(_0xd965('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9b86,_0x368f36,_0x5772e3){return new BPromise(function(_0x427868,_0x563c33){return client[_0xd965('0x8')](_0x2f9b86,_0x5772e3)[_0xd965('0x9')](function(_0xa4f9f9){logger[_0xd965('0xa')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xd965('0xb'));logger[_0xd965('0xc')](_0xd965('0xd'),_0x368f36,'request\x20sent',JSON['stringify'](_0xa4f9f9));if(_0xa4f9f9['error']){if(_0xa4f9f9['error'][_0xd965('0xe')]===0x1f4){logger[_0xd965('0xf')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x563c33(_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);}logger[_0xd965('0xf')]('MemberReport,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x427868(_0xa4f9f9['error']['message']);}else{logger['info'](_0xd965('0x11'),_0x368f36,_0xd965('0xb'));_0x427868(_0xa4f9f9[_0xd965('0x12')][_0xd965('0x10')]);}})['catch'](function(_0x439eca){logger[_0xd965('0xf')](_0xd965('0x11'),_0x368f36,_0x439eca);_0x563c33(_0x439eca);});});}exports[_0xd965('0x13')]=function(_0x45f930){var _0x5dbaff=this;return new Promise(function(_0x1321c1,_0x5e4659){return db['MemberReport']['findAll']({'raw':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')][_0xd965('0x15')]===undefined?!![]:![]:!![],'where':_0x45f930[_0xd965('0x14')]?_0x45f930['options'][_0xd965('0x16')]||null:null,'attributes':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')]['attributes']||null:null,'limit':_0x45f930['options']?_0x45f930['options'][_0xd965('0x17')]||null:null,'include':_0x45f930['options']?_0x45f930[_0xd965('0x14')][_0xd965('0x18')]?_['map'](_0x45f930['options'][_0xd965('0x18')],function(_0x140000){return{'model':db[_0x140000[_0xd965('0x19')]],'as':_0x140000['as'],'attributes':_0x140000[_0xd965('0x1a')],'include':_0x140000[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x140000[_0xd965('0x18')],function(_0x1a7367){return{'model':db[_0x1a7367[_0xd965('0x19')]],'as':_0x1a7367['as'],'attributes':_0x1a7367[_0xd965('0x1a')],'include':_0x1a7367[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x1a7367['include'],function(_0x3d8899){return{'model':db[_0x3d8899[_0xd965('0x19')]],'as':_0x3d8899['as'],'attributes':_0x3d8899['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6a07){logger['info']('GetMemberReport',_0x45f930);logger[_0xd965('0xc')](_0xd965('0x13'),_0x45f930,JSON[_0xd965('0x1c')](_0x4d6a07));_0x1321c1(_0x4d6a07);})['catch'](function(_0x20b8b9){logger[_0xd965('0xf')](_0xd965('0x13'),_0x20b8b9['message'],_0x45f930);_0x5e4659(_0x5dbaff[_0xd965('0xf')](0x1f4,_0x20b8b9['message']));});});};exports['CreateMemberReport']=function(_0x5ac01e){var _0x26379d=this;return new Promise(function(_0x5d2d32,_0x29b600){return db['MemberReport'][_0xd965('0x1d')](_0x5ac01e[_0xd965('0x1e')],{'raw':_0x5ac01e[_0xd965('0x14')]?_0x5ac01e[_0xd965('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xd965('0x9')](function(_0x1eb100){logger['info'](_0xd965('0x1f'),_0x5ac01e);logger[_0xd965('0xc')]('CreateMemberReport',_0x5ac01e,JSON[_0xd965('0x1c')](_0x1eb100));_0x5d2d32(_0x1eb100);})['catch'](function(_0x3c3246){logger[_0xd965('0xf')](_0xd965('0x1f'),_0x3c3246[_0xd965('0x10')],_0x5ac01e);_0x29b600(_0x26379d['error'](0x1f4,_0x3c3246[_0xd965('0x10')]));});});};exports[_0xd965('0x20')]=function(_0x4e974a){var _0x259543=this;return new Promise(function(_0x15286,_0x3dd72d){return db[_0xd965('0x21')][_0xd965('0x22')](_0x4e974a[_0xd965('0x1e')],{'raw':_0x4e974a['options']?_0x4e974a[_0xd965('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')]['where']||null:null,'attributes':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')][_0xd965('0x1a')]||null:null,'limit':_0x4e974a[_0xd965('0x14')]?_0x4e974a[_0xd965('0x14')][_0xd965('0x17')]||null:null})[_0xd965('0x9')](function(_0xdd22bb){logger[_0xd965('0xa')](_0xd965('0x20'),_0x4e974a);logger['debug'](_0xd965('0x20'),_0x4e974a,JSON[_0xd965('0x1c')](_0xdd22bb));_0x15286(_0xdd22bb);})[_0xd965('0x23')](function(_0x48115b){logger['error']('UpdateMemberReport',_0x48115b[_0xd965('0x10')],_0x4e974a);_0x3dd72d(_0x259543[_0xd965('0xf')](0x1f4,_0x48115b[_0xd965('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9c3fe9a..f568312 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 _0xccd1=['get','index','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x53dccc,_0xad9fb1){var _0x17241e=function(_0x25391e){while(--_0x25391e){_0x53dccc['push'](_0x53dccc['shift']());}};_0x17241e(++_0xad9fb1);}(_0xccd1,0x66));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1ccd('0x0'));var util=require(_0x1ccd('0x1'));var path=require(_0x1ccd('0x2'));var timeout=require(_0x1ccd('0x3'));var express=require(_0x1ccd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ccd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x1ccd('0x6')]('/',controller[_0x1ccd('0x7')]);module[_0x1ccd('0x8')]=router; \ No newline at end of file +var _0x138b=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x4d3e41,_0x4129c8){var _0x3e6447=function(_0xdb7e41){while(--_0xdb7e41){_0x4d3e41['push'](_0x4d3e41['shift']());}};_0x3e6447(++_0x4129c8);}(_0x138b,0x156));var _0xb138=function(_0x326c8a,_0xab4390){_0x326c8a=_0x326c8a-0x0;var _0x449e8f=_0x138b[_0x326c8a];return _0x449e8f;};'use strict';var multer=require('multer');var util=require(_0xb138('0x0'));var path=require(_0xb138('0x1'));var timeout=require(_0xb138('0x2'));var express=require(_0xb138('0x3'));var router=express[_0xb138('0x4')]();var fs_extra=require(_0xb138('0x5'));var auth=require(_0xb138('0x6'));var interaction=require(_0xb138('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xb138('0x8')]('/',controller[_0xb138('0x9')]);module[_0xb138('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 d1d5fa2..f9b145e 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 _0x4f28=['version','sequelize','exports'];(function(_0xcf69e4,_0x22359f){var _0x3ae183=function(_0x34d0fc){while(--_0x34d0fc){_0xcf69e4['push'](_0xcf69e4['shift']());}};_0x3ae183(++_0x22359f);}(_0x4f28,0x1ab));var _0x84f2=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x4f28[_0x3d78d7];return _0x4b6784;};'use strict';var Sequelize=require(_0x84f2('0x0'));module[_0x84f2('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x84f2('0x2')}}; \ No newline at end of file +var _0xf3c5=['STRING','version','sequelize','exports'];(function(_0x3373df,_0x4b1d7c){var _0x5bf2f2=function(_0x59384b){while(--_0x59384b){_0x3373df['push'](_0x3373df['shift']());}};_0x5bf2f2(++_0x4b1d7c);}(_0xf3c5,0x176));var _0x5f3c=function(_0x1c0781,_0x4a19f1){_0x1c0781=_0x1c0781-0x0;var _0x1f577e=_0xf3c5[_0x1c0781];return _0x1f577e;};'use strict';var Sequelize=require(_0x5f3c('0x0'));module[_0x5f3c('0x1')]={'version':{'type':Sequelize[_0x5f3c('0x2')],'unique':_0x5f3c('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f884a2d..5f67ebb 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 _0x8914=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','Migration','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8914,0xcc));var _0x4891=function(_0x2a7712,_0x31104c){_0x2a7712=_0x2a7712-0x0;var _0x273547=_0x8914[_0x2a7712];return _0x273547;};'use strict';var emlformat=require(_0x4891('0x0'));var rimraf=require(_0x4891('0x1'));var zipdir=require(_0x4891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4891('0x3'));var moment=require(_0x4891('0x4'));var BPromise=require(_0x4891('0x5'));var Mustache=require(_0x4891('0x6'));var util=require(_0x4891('0x7'));var path=require(_0x4891('0x8'));var sox=require(_0x4891('0x9'));var csv=require(_0x4891('0xa'));var ejs=require(_0x4891('0xb'));var fs=require('fs');var fs_extra=require(_0x4891('0xc'));var _=require(_0x4891('0xd'));var squel=require(_0x4891('0xe'));var crypto=require(_0x4891('0xf'));var jsforce=require(_0x4891('0x10'));var deskjs=require(_0x4891('0x11'));var toCsv=require(_0x4891('0xa'));var querystring=require(_0x4891('0x12'));var Papa=require(_0x4891('0x13'));var Redis=require('ioredis');var authService=require(_0x4891('0x14'));var qs=require(_0x4891('0x15'));var as=require(_0x4891('0x16'));var hardwareService=require(_0x4891('0x17'));var logger=require(_0x4891('0x18'))(_0x4891('0x19'));var utils=require(_0x4891('0x1a'));var config=require(_0x4891('0x1b'));var licenseUtil=require(_0x4891('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588615,_0x56ea02){_0x56ea02=_0x56ea02||0xcc;return function(_0x5bfc69){if(_0x5bfc69){return _0x588615['sendStatus'](_0x56ea02);}return _0x588615[_0x4891('0x1d')](_0x56ea02)[_0x4891('0x1e')]();};}function respondWithResult(_0x980e79,_0x32d4f4){_0x32d4f4=_0x32d4f4||0xc8;return function(_0x820e7d){if(_0x820e7d){return _0x980e79['status'](_0x32d4f4)[_0x4891('0x1f')](_0x820e7d);}};}function respondWithFilteredResult(_0x5417ba,_0x12e85f){return function(_0x46daf5){if(_0x46daf5){var _0x2ef78a=typeof _0x12e85f[_0x4891('0x20')]===_0x4891('0x21')&&typeof _0x12e85f['limit']===_0x4891('0x21');var _0x5a9589=_0x46daf5[_0x4891('0x22')];var _0x53f82b=_0x2ef78a?0x0:_0x12e85f['offset'];var _0x408bc8=_0x2ef78a?_0x46daf5['count']:_0x12e85f[_0x4891('0x20')]+_0x12e85f[_0x4891('0x23')];var _0xdc2b33;if(_0x408bc8>=_0x5a9589){_0x408bc8=_0x5a9589;_0xdc2b33=0xc8;}else{_0xdc2b33=0xce;}_0x5417ba['status'](_0xdc2b33);return _0x5417ba['set'](_0x4891('0x24'),_0x53f82b+'-'+_0x408bc8+'/'+_0x5a9589)[_0x4891('0x1f')](_0x46daf5);}return null;};}function patchUpdates(_0x179e27){return function(_0x2ff296){try{jsonpatch[_0x4891('0x25')](_0x2ff296,_0x179e27,!![]);}catch(_0x37730d){return BPromise[_0x4891('0x26')](_0x37730d);}return _0x2ff296[_0x4891('0x27')]();};}function saveUpdates(_0x5a13b8,_0x3d5124){return function(_0x1cb0df){if(_0x1cb0df){return _0x1cb0df[_0x4891('0x28')](_0x5a13b8)['then'](function(_0x111a48){return _0x111a48;});}return null;};}function removeEntity(_0x4560b7,_0x7169c7){return function(_0x1998ba){if(_0x1998ba){return _0x1998ba['destroy']()[_0x4891('0x29')](function(){_0x4560b7[_0x4891('0x1d')](0xcc)[_0x4891('0x1e')]();});}};}function handleEntityNotFound(_0x26fdba,_0x5f3466){return function(_0x5b3d49){if(!_0x5b3d49){_0x26fdba['sendStatus'](0x194);}return _0x5b3d49;};}function handleError(_0x4b326c,_0x3a3027){_0x3a3027=_0x3a3027||0x1f4;return function(_0x22d174){logger[_0x4891('0x2a')](_0x22d174[_0x4891('0x2b')]);if(_0x22d174[_0x4891('0x2c')]){delete _0x22d174['name'];}_0x4b326c[_0x4891('0x1d')](_0x3a3027)[_0x4891('0x2d')](_0x22d174);};}exports['index']=function(_0x2dde63,_0x59ab48){var _0xf6d8a1={},_0x3916dc={},_0x2236af={'count':0x0,'rows':[]};var _0x3c1517=_[_0x4891('0x2e')](db[_0x4891('0x2f')][_0x4891('0x30')],function(_0x27b668){return{'name':_0x27b668['fieldName'],'type':_0x27b668['type'][_0x4891('0x31')]};});_0x3916dc[_0x4891('0x32')]=_['map'](_0x3c1517,_0x4891('0x2c'));_0x3916dc[_0x4891('0x33')]=_[_0x4891('0x34')](_0x2dde63[_0x4891('0x33')]);_0x3916dc['filters']=_[_0x4891('0x35')](_0x3916dc[_0x4891('0x32')],_0x3916dc[_0x4891('0x33')]);_0xf6d8a1[_0x4891('0x36')]=_[_0x4891('0x35')](_0x3916dc[_0x4891('0x32')],qs[_0x4891('0x37')](_0x2dde63[_0x4891('0x33')][_0x4891('0x37')]));_0xf6d8a1['attributes']=_0xf6d8a1['attributes']['length']?_0xf6d8a1['attributes']:_0x3916dc[_0x4891('0x32')];if(!_0x2dde63['query'][_0x4891('0x38')](_0x4891('0x39'))){_0xf6d8a1[_0x4891('0x23')]=qs[_0x4891('0x23')](_0x2dde63[_0x4891('0x33')]['limit']);_0xf6d8a1[_0x4891('0x20')]=qs[_0x4891('0x20')](_0x2dde63[_0x4891('0x33')][_0x4891('0x20')]);}_0xf6d8a1[_0x4891('0x3a')]=qs[_0x4891('0x3b')](_0x2dde63[_0x4891('0x33')][_0x4891('0x3b')]);_0xf6d8a1['where']=qs[_0x4891('0x3c')](_['pick'](_0x2dde63[_0x4891('0x33')],_0x3916dc[_0x4891('0x3c')]),_0x3c1517);if(_0x2dde63[_0x4891('0x33')]['filter']){_0xf6d8a1[_0x4891('0x3d')]=_['merge'](_0xf6d8a1[_0x4891('0x3d')],{'$or':_['map'](_0x3c1517,function(_0x47f737){if(_0x47f737[_0x4891('0x3e')]!==_0x4891('0x3f')){var _0x44bb3f={};_0x44bb3f[_0x47f737['name']]={'$like':'%'+_0x2dde63[_0x4891('0x33')][_0x4891('0x40')]+'%'};return _0x44bb3f;}})});}_0xf6d8a1=_[_0x4891('0x41')]({},_0xf6d8a1,_0x2dde63['options']);var _0x8b2577={'where':_0xf6d8a1[_0x4891('0x3d')]};return db[_0x4891('0x2f')][_0x4891('0x22')](_0x8b2577)[_0x4891('0x29')](function(_0x40a64a){_0x2236af['count']=_0x40a64a;if(_0x2dde63[_0x4891('0x33')][_0x4891('0x42')]){_0xf6d8a1[_0x4891('0x43')]=[{'all':!![]}];}return db[_0x4891('0x2f')][_0x4891('0x44')](_0xf6d8a1);})['then'](function(_0x5b1c5d){_0x2236af[_0x4891('0x45')]=_0x5b1c5d;return _0x2236af;})[_0x4891('0x29')](respondWithFilteredResult(_0x59ab48,_0xf6d8a1))[_0x4891('0x46')](handleError(_0x59ab48,null));}; \ No newline at end of file +var _0x0290=['error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0x0290,0x67));var _0x0029=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0290[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x0029('0x0'));var rimraf=require(_0x0029('0x1'));var zipdir=require(_0x0029('0x2'));var jsonpatch=require(_0x0029('0x3'));var rp=require(_0x0029('0x4'));var moment=require(_0x0029('0x5'));var BPromise=require(_0x0029('0x6'));var Mustache=require(_0x0029('0x7'));var util=require(_0x0029('0x8'));var path=require(_0x0029('0x9'));var sox=require(_0x0029('0xa'));var csv=require(_0x0029('0xb'));var ejs=require(_0x0029('0xc'));var fs=require('fs');var fs_extra=require(_0x0029('0xd'));var _=require(_0x0029('0xe'));var squel=require('squel');var crypto=require(_0x0029('0xf'));var jsforce=require(_0x0029('0x10'));var deskjs=require(_0x0029('0x11'));var toCsv=require(_0x0029('0xb'));var querystring=require(_0x0029('0x12'));var Papa=require('papaparse');var Redis=require(_0x0029('0x13'));var authService=require(_0x0029('0x14'));var qs=require(_0x0029('0x15'));var as=require(_0x0029('0x16'));var hardwareService=require(_0x0029('0x17'));var logger=require(_0x0029('0x18'))('api');var utils=require(_0x0029('0x19'));var config=require(_0x0029('0x1a'));var licenseUtil=require(_0x0029('0x1b'));var db=require(_0x0029('0x1c'))['db'];function respondWithStatusCode(_0x15cc14,_0x475a3e){_0x475a3e=_0x475a3e||0xcc;return function(_0x18a31f){if(_0x18a31f){return _0x15cc14['sendStatus'](_0x475a3e);}return _0x15cc14[_0x0029('0x1d')](_0x475a3e)[_0x0029('0x1e')]();};}function respondWithResult(_0x251935,_0x23cb49){_0x23cb49=_0x23cb49||0xc8;return function(_0x135f67){if(_0x135f67){return _0x251935[_0x0029('0x1d')](_0x23cb49)['json'](_0x135f67);}};}function respondWithFilteredResult(_0x27c238,_0xe0fcf7){return function(_0x234e12){if(_0x234e12){var _0x1dd1a5=typeof _0xe0fcf7[_0x0029('0x1f')]===_0x0029('0x20')&&typeof _0xe0fcf7[_0x0029('0x21')]===_0x0029('0x20');var _0xf088b1=_0x234e12[_0x0029('0x22')];var _0x36ecf6=_0x1dd1a5?0x0:_0xe0fcf7[_0x0029('0x1f')];var _0x13cc81=_0x1dd1a5?_0x234e12[_0x0029('0x22')]:_0xe0fcf7['offset']+_0xe0fcf7[_0x0029('0x21')];var _0x592899;if(_0x13cc81>=_0xf088b1){_0x13cc81=_0xf088b1;_0x592899=0xc8;}else{_0x592899=0xce;}_0x27c238['status'](_0x592899);return _0x27c238[_0x0029('0x23')](_0x0029('0x24'),_0x36ecf6+'-'+_0x13cc81+'/'+_0xf088b1)[_0x0029('0x25')](_0x234e12);}return null;};}function patchUpdates(_0x338717){return function(_0x4a39f2){try{jsonpatch['apply'](_0x4a39f2,_0x338717,!![]);}catch(_0x41170a){return BPromise[_0x0029('0x26')](_0x41170a);}return _0x4a39f2[_0x0029('0x27')]();};}function saveUpdates(_0x30276d,_0x20bab3){return function(_0x1802e6){if(_0x1802e6){return _0x1802e6[_0x0029('0x28')](_0x30276d)[_0x0029('0x29')](function(_0x520fdf){return _0x520fdf;});}return null;};}function removeEntity(_0x2b9549,_0x23f7e6){return function(_0x477525){if(_0x477525){return _0x477525['destroy']()[_0x0029('0x29')](function(){_0x2b9549[_0x0029('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0cd4,_0x8921fe){return function(_0x4ef018){if(!_0x4ef018){_0x4f0cd4[_0x0029('0x2a')](0x194);}return _0x4ef018;};}function handleError(_0x42c296,_0x565193){_0x565193=_0x565193||0x1f4;return function(_0x4fd301){logger[_0x0029('0x2b')](_0x4fd301[_0x0029('0x2c')]);if(_0x4fd301[_0x0029('0x2d')]){delete _0x4fd301[_0x0029('0x2d')];}_0x42c296['status'](_0x565193)[_0x0029('0x2e')](_0x4fd301);};}exports[_0x0029('0x2f')]=function(_0x33bb48,_0x5ad6f4){var _0x4ff2b6={},_0x104207={},_0x388148={'count':0x0,'rows':[]};var _0x5d3b0a=_[_0x0029('0x30')](db['Migration'][_0x0029('0x31')],function(_0x2f4545){return{'name':_0x2f4545[_0x0029('0x32')],'type':_0x2f4545[_0x0029('0x33')]['key']};});_0x104207[_0x0029('0x34')]=_[_0x0029('0x30')](_0x5d3b0a,_0x0029('0x2d'));_0x104207[_0x0029('0x35')]=_[_0x0029('0x36')](_0x33bb48[_0x0029('0x35')]);_0x104207[_0x0029('0x37')]=_[_0x0029('0x38')](_0x104207[_0x0029('0x34')],_0x104207[_0x0029('0x35')]);_0x4ff2b6['attributes']=_[_0x0029('0x38')](_0x104207[_0x0029('0x34')],qs[_0x0029('0x39')](_0x33bb48['query'][_0x0029('0x39')]));_0x4ff2b6['attributes']=_0x4ff2b6[_0x0029('0x3a')]['length']?_0x4ff2b6[_0x0029('0x3a')]:_0x104207[_0x0029('0x34')];if(!_0x33bb48[_0x0029('0x35')][_0x0029('0x3b')]('nolimit')){_0x4ff2b6[_0x0029('0x21')]=qs[_0x0029('0x21')](_0x33bb48[_0x0029('0x35')][_0x0029('0x21')]);_0x4ff2b6[_0x0029('0x1f')]=qs[_0x0029('0x1f')](_0x33bb48[_0x0029('0x35')]['offset']);}_0x4ff2b6['order']=qs[_0x0029('0x3c')](_0x33bb48['query'][_0x0029('0x3c')]);_0x4ff2b6[_0x0029('0x3d')]=qs[_0x0029('0x37')](_[_0x0029('0x3e')](_0x33bb48[_0x0029('0x35')],_0x104207[_0x0029('0x37')]),_0x5d3b0a);if(_0x33bb48[_0x0029('0x35')][_0x0029('0x3f')]){_0x4ff2b6[_0x0029('0x3d')]=_[_0x0029('0x40')](_0x4ff2b6[_0x0029('0x3d')],{'$or':_[_0x0029('0x30')](_0x5d3b0a,function(_0x3be656){if(_0x3be656['type']!==_0x0029('0x41')){var _0x579ae5={};_0x579ae5[_0x3be656[_0x0029('0x2d')]]={'$like':'%'+_0x33bb48['query'][_0x0029('0x3f')]+'%'};return _0x579ae5;}})});}_0x4ff2b6=_[_0x0029('0x40')]({},_0x4ff2b6,_0x33bb48[_0x0029('0x42')]);var _0x1bf524={'where':_0x4ff2b6[_0x0029('0x3d')]};return db[_0x0029('0x43')][_0x0029('0x22')](_0x1bf524)['then'](function(_0x1af8f8){_0x388148[_0x0029('0x22')]=_0x1af8f8;if(_0x33bb48[_0x0029('0x35')][_0x0029('0x44')]){_0x4ff2b6[_0x0029('0x45')]=[{'all':!![]}];}return db['Migration'][_0x0029('0x46')](_0x4ff2b6);})[_0x0029('0x29')](function(_0x5a6177){_0x388148[_0x0029('0x47')]=_0x5a6177;return _0x388148;})[_0x0029('0x29')](respondWithFilteredResult(_0x5ad6f4,_0x4ff2b6))[_0x0029('0x48')](handleError(_0x5ad6f4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6c67e20..85d84cc 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 _0x0c4d=['bluebird','request-promise','path','exports','Migration','lodash','util','../../config/logger','api','moment'];(function(_0x10967a,_0x3e38a7){var _0x1bcbe9=function(_0x36e42d){while(--_0x36e42d){_0x10967a['push'](_0x10967a['shift']());}};_0x1bcbe9(++_0x3e38a7);}(_0x0c4d,0xff));var _0xd0c4=function(_0x5a3ecf,_0x349e49){_0x5a3ecf=_0x5a3ecf-0x0;var _0x2414b4=_0x0c4d[_0x5a3ecf];return _0x2414b4;};'use strict';var _=require(_0xd0c4('0x0'));var util=require(_0xd0c4('0x1'));var logger=require(_0xd0c4('0x2'))(_0xd0c4('0x3'));var moment=require(_0xd0c4('0x4'));var BPromise=require(_0xd0c4('0x5'));var rp=require(_0xd0c4('0x6'));var fs=require('fs');var path=require(_0xd0c4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xd0c4('0x8')]=function(_0x38849c,_0x54bfb0){return _0x38849c['define'](_0xd0c4('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38f1=['Migration','migrations','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./migration.attributes','define'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x38f1,0x1ba));var _0x138f=function(_0x1a2f93,_0x507838){_0x1a2f93=_0x1a2f93-0x0;var _0x269749=_0x38f1[_0x1a2f93];return _0x269749;};'use strict';var _=require(_0x138f('0x0'));var util=require(_0x138f('0x1'));var logger=require(_0x138f('0x2'))('api');var moment=require(_0x138f('0x3'));var BPromise=require(_0x138f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x138f('0x5'));var rimraf=require('rimraf');var config=require(_0x138f('0x6'));var attributes=require(_0x138f('0x7'));module['exports']=function(_0x1c9e31,_0x5f4911){return _0x1c9e31[_0x138f('0x8')](_0x138f('0x9'),attributes,{'tableName':_0x138f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ed585c7..3fc827b 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 _0x8cfd=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34d408,_0x32ec83){var _0x20366c=function(_0xde1d40){while(--_0xde1d40){_0x34d408['push'](_0x34d408['shift']());}};_0x20366c(++_0x32ec83);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x9ba307,_0x570631){_0x9ba307=_0x9ba307-0x0;var _0x335d04=_0x8cfd[_0x9ba307];return _0x335d04;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require(_0xd8cf('0x4'));var fs=require('fs');var Redis=require(_0xd8cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require(_0xd8cf('0xa'));var client=jayson[_0xd8cf('0xb')][_0xd8cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b41b7,_0x5cfd20,_0x3fe2d2){return new BPromise(function(_0xa5b446,_0x37b91b){return client[_0xd8cf('0xd')](_0x4b41b7,_0x3fe2d2)[_0xd8cf('0xe')](function(_0x668d6c){logger['info'](_0xd8cf('0xf'),_0x5cfd20,_0xd8cf('0x10'));logger[_0xd8cf('0x11')](_0xd8cf('0x12'),_0x5cfd20,_0xd8cf('0x10'),JSON[_0xd8cf('0x13')](_0x668d6c));if(_0x668d6c[_0xd8cf('0x14')]){if(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x15')]===0x1f4){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c[_0xd8cf('0x14')]['message']);return _0x37b91b(_0x668d6c[_0xd8cf('0x14')]['message']);}logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c['error'][_0xd8cf('0x16')]);return _0xa5b446(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x16')]);}else{logger['info'](_0xd8cf('0xf'),_0x5cfd20,'request\x20sent');_0xa5b446(_0x668d6c[_0xd8cf('0x17')][_0xd8cf('0x16')]);}})[_0xd8cf('0x18')](function(_0x55018c){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x55018c);_0x37b91b(_0x55018c);});});} \ No newline at end of file +var _0x6a00=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0x36a620,_0x567fb1){var _0x59fb45=function(_0x428909){while(--_0x428909){_0x36a620['push'](_0x36a620['shift']());}};_0x59fb45(++_0x567fb1);}(_0x6a00,0xc9));var _0x06a0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6a00[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x06a0('0x0'));var util=require(_0x06a0('0x1'));var moment=require('moment');var BPromise=require(_0x06a0('0x2'));var rs=require(_0x06a0('0x3'));var fs=require('fs');var Redis=require(_0x06a0('0x4'));var db=require(_0x06a0('0x5'))['db'];var utils=require(_0x06a0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x06a0('0x7'));var jayson=require(_0x06a0('0x8'));var client=jayson[_0x06a0('0x9')][_0x06a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa78ab8,_0x1b8019,_0x51dc49){return new BPromise(function(_0xac416d,_0x22d146){return client[_0x06a0('0xb')](_0xa78ab8,_0x51dc49)[_0x06a0('0xc')](function(_0x38a7d3){logger[_0x06a0('0xd')](_0x06a0('0xe'),_0x1b8019,_0x06a0('0xf'));logger[_0x06a0('0x10')](_0x06a0('0x11'),_0x1b8019,_0x06a0('0xf'),JSON['stringify'](_0x38a7d3));if(_0x38a7d3['error']){if(_0x38a7d3[_0x06a0('0x12')][_0x06a0('0x13')]===0x1f4){logger[_0x06a0('0x12')](_0x06a0('0xe'),_0x1b8019,_0x38a7d3[_0x06a0('0x12')][_0x06a0('0x14')]);return _0x22d146(_0x38a7d3[_0x06a0('0x12')][_0x06a0('0x14')]);}logger['error'](_0x06a0('0xe'),_0x1b8019,_0x38a7d3[_0x06a0('0x12')][_0x06a0('0x14')]);return _0xac416d(_0x38a7d3['error'][_0x06a0('0x14')]);}else{logger[_0x06a0('0xd')](_0x06a0('0xe'),_0x1b8019,'request\x20sent');_0xac416d(_0x38a7d3[_0x06a0('0x15')][_0x06a0('0x14')]);}})['catch'](function(_0x578f39){logger[_0x06a0('0x12')](_0x06a0('0xe'),_0x1b8019,_0x578f39);_0x22d146(_0x578f39);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c7e3e11..f6436b2 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 _0x1af1=['post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x55c22b,_0x13b084){var _0x2d3b2a=function(_0x1e9ed8){while(--_0x1e9ed8){_0x55c22b['push'](_0x55c22b['shift']());}};_0x2d3b2a(++_0x13b084);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var path=require(_0x11af('0x2'));var timeout=require(_0x11af('0x3'));var express=require(_0x11af('0x4'));var router=express[_0x11af('0x5')]();var fs_extra=require(_0x11af('0x6'));var auth=require(_0x11af('0x7'));var interaction=require(_0x11af('0x8'));var config=require(_0x11af('0x9'));var controller=require('./network.controller');router[_0x11af('0xa')]('/',auth['isAuthenticated'](),controller[_0x11af('0xb')]);router['get']('/:id',auth[_0x11af('0xc')](),controller['show']);router[_0x11af('0xd')]('/',auth['isAuthenticated'](),controller[_0x11af('0xe')]);router[_0x11af('0xf')](_0x11af('0x10'),auth[_0x11af('0xc')](),controller['update']);router[_0x11af('0x11')](_0x11af('0x10'),auth[_0x11af('0xc')](),controller[_0x11af('0x12')]);module[_0x11af('0x13')]=router; \ No newline at end of file +var _0xe24e=['get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x1d8b97,_0x50c67b){var _0x42ab7d=function(_0x3b4034){while(--_0x3b4034){_0x1d8b97['push'](_0x1d8b97['shift']());}};_0x42ab7d(++_0x50c67b);}(_0xe24e,0x15f));var _0xee24=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xe24e[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var path=require(_0xee24('0x2'));var timeout=require(_0xee24('0x3'));var express=require(_0xee24('0x4'));var router=express[_0xee24('0x5')]();var fs_extra=require(_0xee24('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xee24('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0xee24('0x8')](),controller[_0xee24('0x9')]);router[_0xee24('0xa')](_0xee24('0xb'),auth[_0xee24('0x8')](),controller['show']);router[_0xee24('0xc')]('/',auth[_0xee24('0x8')](),controller[_0xee24('0xd')]);router[_0xee24('0xe')](_0xee24('0xb'),auth[_0xee24('0x8')](),controller[_0xee24('0xf')]);router[_0xee24('0x10')]('/:id',auth[_0xee24('0x8')](),controller[_0xee24('0x11')]);module[_0xee24('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 397ecae..65dacc9 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 _0x22a0=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0xd9cfb0,_0x213a37){var _0x876ea6=function(_0x171a7b){while(--_0x171a7b){_0xd9cfb0['push'](_0xd9cfb0['shift']());}};_0x876ea6(++_0x213a37);}(_0x22a0,0x15a));var _0x022a=function(_0x502ce2,_0x36cb80){_0x502ce2=_0x502ce2-0x0;var _0x166a17=_0x22a0[_0x502ce2];return _0x166a17;};'use strict';var Sequelize=require(_0x022a('0x0'));module[_0x022a('0x1')]={'type':{'type':Sequelize[_0x022a('0x2')](_0x022a('0x3'),_0x022a('0x4'),_0x022a('0x5'),_0x022a('0x6'))},'value':{'type':Sequelize[_0x022a('0x7')]},'username':{'type':Sequelize[_0x022a('0x7')]},'password':{'type':Sequelize[_0x022a('0x7')]}}; \ No newline at end of file +var _0x4926=['exports','ENUM','localnet','stun','turn','STRING','sequelize'];(function(_0x3b08d7,_0x2eb072){var _0x5ad40b=function(_0x318deb){while(--_0x318deb){_0x3b08d7['push'](_0x3b08d7['shift']());}};_0x5ad40b(++_0x2eb072);}(_0x4926,0x1e2));var _0x6492=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x4926[_0x10dc60];return _0x47dec5;};'use strict';var Sequelize=require(_0x6492('0x0'));module[_0x6492('0x1')]={'type':{'type':Sequelize[_0x6492('0x2')](_0x6492('0x3'),'externip',_0x6492('0x4'),_0x6492('0x5'))},'value':{'type':Sequelize[_0x6492('0x6')]},'username':{'type':Sequelize[_0x6492('0x6')]},'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 52aea0c..54483c0 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 _0x4894=['Network','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','name','options','includeAll','include','findAll','rows','params','length','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','utf8','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','undefined','limit','offset','count','set','Content-Range','update','destroy','end','sendStatus','stack','send','index','map'];(function(_0x1473f5,_0x60940a){var _0x1c8fc4=function(_0x517ec1){while(--_0x517ec1){_0x1473f5['push'](_0x1473f5['shift']());}};_0x1c8fc4(++_0x60940a);}(_0x4894,0x1d5));var _0x4489=function(_0x5eb7e9,_0x4a86a0){_0x5eb7e9=_0x5eb7e9-0x0;var _0x11901a=_0x4894[_0x5eb7e9];return _0x11901a;};'use strict';var util=require(_0x4489('0x0'));var path=require(_0x4489('0x1'));var ejs=require(_0x4489('0x2'));var fs=require('fs');var _=require(_0x4489('0x3'));var qs=require(_0x4489('0x4'));var logger=require('../../config/logger')(_0x4489('0x5'));var config=require(_0x4489('0x6'));var db=require(_0x4489('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x397fb5,_0x4e1f07,_0x2a734f,_0x4622a4){return new Promise(function(_0x519d50,_0x3179c6){var _0x5b1a92=_0x4622a4||client;return _0x5b1a92[_0x4489('0x8')](_0x397fb5,_0x2a734f)[_0x4489('0x9')](function(_0x1f2f63){logger[_0x4489('0xa')](_0x4489('0xb'),_0x4e1f07,_0x4489('0xc'));logger[_0x4489('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x4e1f07,_0x4489('0xc'),JSON[_0x4489('0xe')](_0x1f2f63));if(_0x1f2f63[_0x4489('0xf')]){if(_0x1f2f63[_0x4489('0xf')][_0x4489('0x10')]===0x1f4){logger['error'](_0x4489('0xb'),_0x4e1f07,_0x1f2f63[_0x4489('0xf')]['message']);return _0x3179c6(_0x1f2f63[_0x4489('0xf')][_0x4489('0x11')]);}logger[_0x4489('0xf')](_0x4489('0xb'),_0x4e1f07,_0x1f2f63['error'][_0x4489('0x11')]);return _0x519d50(_0x1f2f63[_0x4489('0xf')][_0x4489('0x11')]);}else{logger[_0x4489('0xa')](_0x4489('0xb'),_0x4e1f07,'request\x20sent');_0x519d50(_0x1f2f63['result'][_0x4489('0x11')]);}})[_0x4489('0x12')](function(_0x5d2d78){logger[_0x4489('0xf')]('Network,\x20%s,\x20%s',_0x4e1f07,_0x5d2d78);_0x3179c6(_0x5d2d78);});});}function respondWithResult(_0x53933f,_0x346bd7){_0x346bd7=_0x346bd7||0xc8;return function(_0x4f1008){if(_0x4f1008){return _0x53933f[_0x4489('0x13')](_0x346bd7)[_0x4489('0x14')](_0x4f1008);}};}function respondWithFilteredResult(_0x54fb8b,_0x5ee9a1){return function(_0x517339){if(_0x517339){var _0x15fcdb=typeof _0x5ee9a1['offset']===_0x4489('0x15')&&typeof _0x5ee9a1[_0x4489('0x16')]===_0x4489('0x15');var _0x2ae244=_0x517339['count'];var _0x5dd5e1=_0x15fcdb?0x0:_0x5ee9a1[_0x4489('0x17')];var _0x591a9d=_0x15fcdb?_0x517339[_0x4489('0x18')]:_0x5ee9a1[_0x4489('0x17')]+_0x5ee9a1[_0x4489('0x16')];var _0x3ffe4a;if(_0x591a9d>=_0x2ae244){_0x591a9d=_0x2ae244;_0x3ffe4a=0xc8;}else{_0x3ffe4a=0xce;}_0x54fb8b['status'](_0x3ffe4a);return _0x54fb8b[_0x4489('0x19')](_0x4489('0x1a'),_0x5dd5e1+'-'+_0x591a9d+'/'+_0x2ae244)[_0x4489('0x14')](_0x517339);}return null;};}function saveUpdates(_0x62f0ad){return function(_0x149f53){if(_0x149f53){return _0x149f53[_0x4489('0x1b')](_0x62f0ad)[_0x4489('0x9')](function(_0x54d4d4){return _0x54d4d4;});}return null;};}function removeEntity(_0x31a7af){return function(_0xdb5151){if(_0xdb5151){return _0xdb5151[_0x4489('0x1c')]()[_0x4489('0x9')](function(){_0x31a7af[_0x4489('0x13')](0xcc)[_0x4489('0x1d')]();});}};}function handleEntityNotFound(_0x3947ec){return function(_0x24be31){if(!_0x24be31){_0x3947ec[_0x4489('0x1e')](0x194);}return _0x24be31;};}function handleError(_0xf81935,_0x1da4fe){_0x1da4fe=_0x1da4fe||0x1f4;return function(_0x2ac7a0){logger[_0x4489('0xf')](_0x2ac7a0[_0x4489('0x1f')]);if(_0x2ac7a0['name']){delete _0x2ac7a0['name'];}_0xf81935[_0x4489('0x13')](_0x1da4fe)[_0x4489('0x20')](_0x2ac7a0);};}exports[_0x4489('0x21')]=function(_0x3b86b3,_0x7ebf6a){var _0x2cbc5c={},_0x27691b={},_0x5b938d={'count':0x0,'rows':[]};var _0x355520=_[_0x4489('0x22')](db[_0x4489('0x23')][_0x4489('0x24')],function(_0x15d8e0){return{'name':_0x15d8e0[_0x4489('0x25')],'type':_0x15d8e0['type']['key']};});_0x27691b[_0x4489('0x26')]=_[_0x4489('0x22')](_0x355520,'name');_0x27691b[_0x4489('0x27')]=_[_0x4489('0x28')](_0x3b86b3[_0x4489('0x27')]);_0x27691b['filters']=_['intersection'](_0x27691b['model'],_0x27691b[_0x4489('0x27')]);_0x2cbc5c[_0x4489('0x29')]=_[_0x4489('0x2a')](_0x27691b[_0x4489('0x26')],qs[_0x4489('0x2b')](_0x3b86b3[_0x4489('0x27')]['fields']));_0x2cbc5c[_0x4489('0x29')]=_0x2cbc5c[_0x4489('0x29')]['length']?_0x2cbc5c['attributes']:_0x27691b[_0x4489('0x26')];if(!_0x3b86b3[_0x4489('0x27')][_0x4489('0x2c')]('nolimit')){_0x2cbc5c[_0x4489('0x16')]=qs[_0x4489('0x16')](_0x3b86b3['query'][_0x4489('0x16')]);_0x2cbc5c[_0x4489('0x17')]=qs[_0x4489('0x17')](_0x3b86b3[_0x4489('0x27')][_0x4489('0x17')]);}_0x2cbc5c[_0x4489('0x2d')]=qs[_0x4489('0x2e')](_0x3b86b3['query']['sort']);_0x2cbc5c['where']=qs[_0x4489('0x2f')](_[_0x4489('0x30')](_0x3b86b3[_0x4489('0x27')],_0x27691b[_0x4489('0x2f')]),_0x355520);if(_0x3b86b3[_0x4489('0x27')][_0x4489('0x31')]){_0x2cbc5c[_0x4489('0x32')]=_[_0x4489('0x33')](_0x2cbc5c['where'],{'$or':_[_0x4489('0x22')](_0x355520,function(_0x4c1b85){if(_0x4c1b85[_0x4489('0x34')]!=='VIRTUAL'){var _0x1e9ee6={};_0x1e9ee6[_0x4c1b85[_0x4489('0x35')]]={'$like':'%'+_0x3b86b3[_0x4489('0x27')][_0x4489('0x31')]+'%'};return _0x1e9ee6;}})});}_0x2cbc5c=_[_0x4489('0x33')]({},_0x2cbc5c,_0x3b86b3[_0x4489('0x36')]);var _0x1b7d29={'where':_0x2cbc5c['where']};return db[_0x4489('0x23')]['count'](_0x1b7d29)['then'](function(_0x56ecd5){_0x5b938d[_0x4489('0x18')]=_0x56ecd5;if(_0x3b86b3[_0x4489('0x27')][_0x4489('0x37')]){_0x2cbc5c[_0x4489('0x38')]=[{'all':!![]}];}return db[_0x4489('0x23')][_0x4489('0x39')](_0x2cbc5c);})[_0x4489('0x9')](function(_0x24ee7b){_0x5b938d[_0x4489('0x3a')]=_0x24ee7b;return _0x5b938d;})[_0x4489('0x9')](respondWithFilteredResult(_0x7ebf6a,_0x2cbc5c))[_0x4489('0x12')](handleError(_0x7ebf6a,null));};exports['show']=function(_0x51e688,_0x6028c8){var _0xb632e4={'raw':!![],'where':{'id':_0x51e688[_0x4489('0x3b')]['id']}},_0x5a0890={};_0x5a0890['model']=_[_0x4489('0x28')](db['Network'][_0x4489('0x24')]);_0x5a0890[_0x4489('0x27')]=_[_0x4489('0x28')](_0x51e688[_0x4489('0x27')]);_0x5a0890[_0x4489('0x2f')]=_[_0x4489('0x2a')](_0x5a0890['model'],_0x5a0890[_0x4489('0x27')]);_0xb632e4['attributes']=_['intersection'](_0x5a0890[_0x4489('0x26')],qs[_0x4489('0x2b')](_0x51e688[_0x4489('0x27')][_0x4489('0x2b')]));_0xb632e4[_0x4489('0x29')]=_0xb632e4[_0x4489('0x29')][_0x4489('0x3c')]?_0xb632e4[_0x4489('0x29')]:_0x5a0890[_0x4489('0x26')];if(_0x51e688[_0x4489('0x27')][_0x4489('0x37')]){_0xb632e4['include']=[{'all':!![]}];}_0xb632e4=_[_0x4489('0x33')]({},_0xb632e4,_0x51e688[_0x4489('0x36')]);return db[_0x4489('0x23')][_0x4489('0x3d')](_0xb632e4)[_0x4489('0x9')](handleEntityNotFound(_0x6028c8,null))[_0x4489('0x9')](respondWithResult(_0x6028c8,null))[_0x4489('0x12')](handleError(_0x6028c8,null));};exports[_0x4489('0x3e')]=function(_0x22fda7,_0x4b1e14){var _0x4dbdd3;return db['Network'][_0x4489('0x3e')](_0x22fda7[_0x4489('0x3f')],{'raw':!![]})[_0x4489('0x9')](function(_0x57b4a7){_0x4dbdd3=_0x57b4a7;return db[_0x4489('0x23')][_0x4489('0x39')]({'where':{'type':_0x22fda7[_0x4489('0x3f')][_0x4489('0x34')]},'raw':!![]});})['then'](function(_0xafae52){if(_0x4dbdd3['type'][_0x4489('0x40')]()==_0x4489('0x41')){var _0x3adfbe=fs['readFileSync'](path[_0x4489('0x42')](config[_0x4489('0x43')],_0x4489('0x44')),'utf8');var _0x326a3b=ejs[_0x4489('0x45')](_0x3adfbe,{'networks':_0xafae52||[]});fs['writeFileSync'](_0x4489('0x46'),_0x326a3b);return respondWithRpcPromise(_0x4489('0x47'),'create',{'module':_0x4489('0x48')});}else if(_0x4dbdd3['type'][_0x4489('0x40')]()==_0x4489('0x49')){var _0x3baba7=fs['readFileSync'](path['join'](config[_0x4489('0x43')],_0x4489('0x4a')),'utf8');var _0x569b4c=ejs[_0x4489('0x45')](_0x3baba7,{'networks':_0xafae52||[]});fs['writeFileSync'](_0x4489('0x4b'),_0x569b4c);return respondWithRpcPromise(_0x4489('0x47'),_0x4489('0x3e'),{'module':_0x4489('0x48')});}else{var _0x357351=fs[_0x4489('0x4c')](path[_0x4489('0x42')](config[_0x4489('0x43')],_0x4489('0x4d')),_0x4489('0x4e'));var _0x29b1f1=ejs[_0x4489('0x45')](_0x357351,{'networks':_0xafae52||[]});fs[_0x4489('0x4f')](util[_0x4489('0x50')](_0x4489('0x51'),_0x22fda7['body'][_0x4489('0x34')][_0x4489('0x52')]()),_0x29b1f1);return respondWithRpcPromise(_0x4489('0x47'),_0x4489('0x3e'),{'module':_0x4489('0x53')});}})[_0x4489('0x9')](function(){return _0x4dbdd3;})['then'](respondWithResult(_0x4b1e14,0xc9))[_0x4489('0x12')](handleError(_0x4b1e14,null));};exports[_0x4489('0x1b')]=function(_0x588d92,_0x45138d){var _0x31642b;return db[_0x4489('0x23')][_0x4489('0x3d')]({'where':{'id':_0x588d92['params']['id']}})[_0x4489('0x9')](handleEntityNotFound(_0x45138d,null))[_0x4489('0x9')](saveUpdates(_0x588d92[_0x4489('0x3f')],null))[_0x4489('0x9')](function(_0x2cc95b){if(_0x2cc95b){_0x31642b=_0x2cc95b;return db['Network'][_0x4489('0x39')]({'where':{'type':_0x31642b[_0x4489('0x34')]},'raw':!![]});}return null;})[_0x4489('0x9')](function(_0x46b529){if(_0x31642b[_0x4489('0x34')][_0x4489('0x40')]()==_0x4489('0x41')){var _0x534580=fs[_0x4489('0x4c')](path[_0x4489('0x42')](config[_0x4489('0x43')],_0x4489('0x44')),'utf8');var _0x318b64=ejs[_0x4489('0x45')](_0x534580,{'networks':_0x46b529||[]});fs[_0x4489('0x4f')]('/etc/asterisk/stun_xcally.conf',_0x318b64);return respondWithRpcPromise(_0x4489('0x47'),_0x4489('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x31642b[_0x4489('0x34')][_0x4489('0x40')]()=='TURN'){var _0x106819=fs['readFileSync'](path[_0x4489('0x42')](config[_0x4489('0x43')],'server/files/templates/turn_multiple.ejs'),_0x4489('0x4e'));var _0x4bc5e1=ejs[_0x4489('0x45')](_0x106819,{'networks':_0x46b529||[]});fs[_0x4489('0x4f')](_0x4489('0x4b'),_0x4bc5e1);return respondWithRpcPromise(_0x4489('0x47'),'update',{'module':_0x4489('0x48')});}else{var _0x2355bd=fs[_0x4489('0x4c')](path[_0x4489('0x42')](config[_0x4489('0x43')],_0x4489('0x4d')),_0x4489('0x4e'));var _0x39fb50=ejs['render'](_0x2355bd,{'networks':_0x46b529||[]});fs['writeFileSync'](util[_0x4489('0x50')](_0x4489('0x51'),_0x588d92['body'][_0x4489('0x34')]['toLowerCase']()),_0x39fb50);return respondWithRpcPromise(_0x4489('0x47'),_0x4489('0x1b'),{'module':_0x4489('0x53')});}})[_0x4489('0x9')](function(_0x4c6b03){if(_0x4c6b03){return _0x31642b;}return null;})[_0x4489('0x9')](respondWithResult(_0x45138d,null))[_0x4489('0x12')](handleError(_0x45138d,null));};exports['destroy']=function(_0x4bcf0e,_0x34a1d5){var _0x1bcdf7;return db[_0x4489('0x23')]['find']({'where':{'id':_0x4bcf0e[_0x4489('0x3b')]['id']}})['then'](function(_0x105e75){_0x1bcdf7=_0x105e75;return _0x105e75;})[_0x4489('0x9')](handleEntityNotFound(_0x34a1d5,null))['then'](removeEntity(_0x34a1d5,null))[_0x4489('0x9')](function(){if(_0x1bcdf7){return db[_0x4489('0x23')][_0x4489('0x39')]({'where':{'type':_0x1bcdf7[_0x4489('0x34')]},'raw':!![]});}})['then'](function(_0x4367f6){if(_0x1bcdf7[_0x4489('0x34')][_0x4489('0x40')]()==_0x4489('0x41')){var _0x4a6250=fs[_0x4489('0x4c')](path['join'](config[_0x4489('0x43')],'server/files/templates/stun_multiple.ejs'),_0x4489('0x4e'));var _0x1aa7e6=ejs[_0x4489('0x45')](_0x4a6250,{'networks':_0x4367f6||[]});fs[_0x4489('0x4f')](_0x4489('0x46'),_0x1aa7e6);return respondWithRpcPromise(_0x4489('0x47'),_0x4489('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x1bcdf7['type'][_0x4489('0x40')]()==_0x4489('0x49')){var _0x2ab858=fs[_0x4489('0x4c')](path['join'](config[_0x4489('0x43')],_0x4489('0x4a')),_0x4489('0x4e'));var _0x15d693=ejs['render'](_0x2ab858,{'networks':_0x4367f6||[]});fs[_0x4489('0x4f')](_0x4489('0x4b'),_0x15d693);return respondWithRpcPromise('Reload','destroy',{'module':_0x4489('0x48')});}else{var _0x483c60=fs[_0x4489('0x4c')](path['join'](config[_0x4489('0x43')],'server/files/templates/network.ejs'),_0x4489('0x4e'));var _0x3e84fd=ejs[_0x4489('0x45')](_0x483c60,{'networks':_0x4367f6||[]});fs[_0x4489('0x4f')](util['format'](_0x4489('0x51'),_0x1bcdf7[_0x4489('0x34')]['toLowerCase']()),_0x3e84fd);return respondWithRpcPromise('Reload',_0x4489('0x1c'),{'module':'chan_sip.so'});}})[_0x4489('0x12')](handleError(_0x34a1d5,null));}; \ No newline at end of file +var _0x713e=['then','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','STUN','server/files/templates/stun_multiple.ejs','toUpperCase','format','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','json','undefined','offset','count','limit','set','Content-Range'];(function(_0x3c7426,_0x53d4a6){var _0xdde032=function(_0x1e4fe0){while(--_0x1e4fe0){_0x3c7426['push'](_0x3c7426['shift']());}};_0xdde032(++_0x53d4a6);}(_0x713e,0x197));var _0xe713=function(_0x3f0cb4,_0x49ec71){_0x3f0cb4=_0x3f0cb4-0x0;var _0x5f33b0=_0x713e[_0x3f0cb4];return _0x5f33b0;};'use strict';var util=require('util');var path=require(_0xe713('0x0'));var ejs=require(_0xe713('0x1'));var fs=require('fs');var _=require(_0xe713('0x2'));var qs=require(_0xe713('0x3'));var logger=require(_0xe713('0x4'))(_0xe713('0x5'));var config=require(_0xe713('0x6'));var db=require(_0xe713('0x7'))['db'];var jayson=require(_0xe713('0x8'));var client=jayson[_0xe713('0x9')][_0xe713('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d84df,_0x45c3e0,_0x1c8c22,_0x37ca97){return new Promise(function(_0x1d3db6,_0x423608){var _0x2baacd=_0x37ca97||client;return _0x2baacd[_0xe713('0xb')](_0x5d84df,_0x1c8c22)['then'](function(_0x43b5be){logger[_0xe713('0xc')](_0xe713('0xd'),_0x45c3e0,_0xe713('0xe'));logger[_0xe713('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x45c3e0,_0xe713('0xe'),JSON['stringify'](_0x43b5be));if(_0x43b5be[_0xe713('0x10')]){if(_0x43b5be['error']['code']===0x1f4){logger[_0xe713('0x10')](_0xe713('0xd'),_0x45c3e0,_0x43b5be[_0xe713('0x10')]['message']);return _0x423608(_0x43b5be[_0xe713('0x10')][_0xe713('0x11')]);}logger[_0xe713('0x10')](_0xe713('0xd'),_0x45c3e0,_0x43b5be[_0xe713('0x10')][_0xe713('0x11')]);return _0x1d3db6(_0x43b5be[_0xe713('0x10')][_0xe713('0x11')]);}else{logger[_0xe713('0xc')](_0xe713('0xd'),_0x45c3e0,_0xe713('0xe'));_0x1d3db6(_0x43b5be[_0xe713('0x12')][_0xe713('0x11')]);}})[_0xe713('0x13')](function(_0x25384b){logger[_0xe713('0x10')]('Network,\x20%s,\x20%s',_0x45c3e0,_0x25384b);_0x423608(_0x25384b);});});}function respondWithResult(_0x26094e,_0xe535b9){_0xe535b9=_0xe535b9||0xc8;return function(_0x46abb2){if(_0x46abb2){return _0x26094e[_0xe713('0x14')](_0xe535b9)[_0xe713('0x15')](_0x46abb2);}};}function respondWithFilteredResult(_0x4b977c,_0x1f3e1e){return function(_0x527b25){if(_0x527b25){var _0x4d77e8=typeof _0x1f3e1e['offset']===_0xe713('0x16')&&typeof _0x1f3e1e['limit']===_0xe713('0x16');var _0x41d1d5=_0x527b25['count'];var _0x1f2f7a=_0x4d77e8?0x0:_0x1f3e1e[_0xe713('0x17')];var _0x367f0a=_0x4d77e8?_0x527b25[_0xe713('0x18')]:_0x1f3e1e[_0xe713('0x17')]+_0x1f3e1e[_0xe713('0x19')];var _0x48c14f;if(_0x367f0a>=_0x41d1d5){_0x367f0a=_0x41d1d5;_0x48c14f=0xc8;}else{_0x48c14f=0xce;}_0x4b977c[_0xe713('0x14')](_0x48c14f);return _0x4b977c[_0xe713('0x1a')](_0xe713('0x1b'),_0x1f2f7a+'-'+_0x367f0a+'/'+_0x41d1d5)[_0xe713('0x15')](_0x527b25);}return null;};}function saveUpdates(_0xce509a){return function(_0x398fc9){if(_0x398fc9){return _0x398fc9['update'](_0xce509a)[_0xe713('0x1c')](function(_0xdf78f7){return _0xdf78f7;});}return null;};}function removeEntity(_0x5ea8a8){return function(_0x155a06){if(_0x155a06){return _0x155a06[_0xe713('0x1d')]()[_0xe713('0x1c')](function(){_0x5ea8a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1387){return function(_0x40a383){if(!_0x40a383){_0x2b1387[_0xe713('0x1e')](0x194);}return _0x40a383;};}function handleError(_0x27a6ad,_0x497e74){_0x497e74=_0x497e74||0x1f4;return function(_0x59eb0a){logger[_0xe713('0x10')](_0x59eb0a[_0xe713('0x1f')]);if(_0x59eb0a[_0xe713('0x20')]){delete _0x59eb0a[_0xe713('0x20')];}_0x27a6ad[_0xe713('0x14')](_0x497e74)[_0xe713('0x21')](_0x59eb0a);};}exports[_0xe713('0x22')]=function(_0x2f43ac,_0xcdf804){var _0x394ce8={},_0xedd623={},_0x4d40be={'count':0x0,'rows':[]};var _0x291bfd=_[_0xe713('0x23')](db[_0xe713('0x24')][_0xe713('0x25')],function(_0x1e1540){return{'name':_0x1e1540['fieldName'],'type':_0x1e1540[_0xe713('0x26')][_0xe713('0x27')]};});_0xedd623[_0xe713('0x28')]=_[_0xe713('0x23')](_0x291bfd,_0xe713('0x20'));_0xedd623[_0xe713('0x29')]=_[_0xe713('0x2a')](_0x2f43ac['query']);_0xedd623[_0xe713('0x2b')]=_[_0xe713('0x2c')](_0xedd623[_0xe713('0x28')],_0xedd623[_0xe713('0x29')]);_0x394ce8[_0xe713('0x2d')]=_['intersection'](_0xedd623[_0xe713('0x28')],qs[_0xe713('0x2e')](_0x2f43ac['query'][_0xe713('0x2e')]));_0x394ce8[_0xe713('0x2d')]=_0x394ce8['attributes'][_0xe713('0x2f')]?_0x394ce8[_0xe713('0x2d')]:_0xedd623[_0xe713('0x28')];if(!_0x2f43ac[_0xe713('0x29')][_0xe713('0x30')](_0xe713('0x31'))){_0x394ce8[_0xe713('0x19')]=qs[_0xe713('0x19')](_0x2f43ac[_0xe713('0x29')][_0xe713('0x19')]);_0x394ce8[_0xe713('0x17')]=qs[_0xe713('0x17')](_0x2f43ac[_0xe713('0x29')]['offset']);}_0x394ce8['order']=qs[_0xe713('0x32')](_0x2f43ac['query'][_0xe713('0x32')]);_0x394ce8[_0xe713('0x33')]=qs[_0xe713('0x2b')](_[_0xe713('0x34')](_0x2f43ac['query'],_0xedd623[_0xe713('0x2b')]),_0x291bfd);if(_0x2f43ac[_0xe713('0x29')][_0xe713('0x35')]){_0x394ce8[_0xe713('0x33')]=_[_0xe713('0x36')](_0x394ce8['where'],{'$or':_[_0xe713('0x23')](_0x291bfd,function(_0x57376b){if(_0x57376b[_0xe713('0x26')]!==_0xe713('0x37')){var _0x1b5b7d={};_0x1b5b7d[_0x57376b[_0xe713('0x20')]]={'$like':'%'+_0x2f43ac[_0xe713('0x29')][_0xe713('0x35')]+'%'};return _0x1b5b7d;}})});}_0x394ce8=_['merge']({},_0x394ce8,_0x2f43ac['options']);var _0x490cae={'where':_0x394ce8['where']};return db[_0xe713('0x24')]['count'](_0x490cae)['then'](function(_0x8210b5){_0x4d40be['count']=_0x8210b5;if(_0x2f43ac['query'][_0xe713('0x38')]){_0x394ce8[_0xe713('0x39')]=[{'all':!![]}];}return db['Network'][_0xe713('0x3a')](_0x394ce8);})['then'](function(_0x131526){_0x4d40be[_0xe713('0x3b')]=_0x131526;return _0x4d40be;})[_0xe713('0x1c')](respondWithFilteredResult(_0xcdf804,_0x394ce8))[_0xe713('0x13')](handleError(_0xcdf804,null));};exports[_0xe713('0x3c')]=function(_0x27eacb,_0x30c673){var _0x4f6ebd={'raw':!![],'where':{'id':_0x27eacb[_0xe713('0x3d')]['id']}},_0x28258d={};_0x28258d[_0xe713('0x28')]=_['keys'](db[_0xe713('0x24')][_0xe713('0x25')]);_0x28258d[_0xe713('0x29')]=_[_0xe713('0x2a')](_0x27eacb[_0xe713('0x29')]);_0x28258d['filters']=_[_0xe713('0x2c')](_0x28258d[_0xe713('0x28')],_0x28258d[_0xe713('0x29')]);_0x4f6ebd['attributes']=_['intersection'](_0x28258d[_0xe713('0x28')],qs['fields'](_0x27eacb[_0xe713('0x29')]['fields']));_0x4f6ebd[_0xe713('0x2d')]=_0x4f6ebd[_0xe713('0x2d')][_0xe713('0x2f')]?_0x4f6ebd['attributes']:_0x28258d[_0xe713('0x28')];if(_0x27eacb['query'][_0xe713('0x38')]){_0x4f6ebd['include']=[{'all':!![]}];}_0x4f6ebd=_[_0xe713('0x36')]({},_0x4f6ebd,_0x27eacb[_0xe713('0x3e')]);return db[_0xe713('0x24')]['find'](_0x4f6ebd)[_0xe713('0x1c')](handleEntityNotFound(_0x30c673,null))['then'](respondWithResult(_0x30c673,null))[_0xe713('0x13')](handleError(_0x30c673,null));};exports['create']=function(_0x1a9d8c,_0x32b5f3){var _0x118a79;return db[_0xe713('0x24')][_0xe713('0x3f')](_0x1a9d8c[_0xe713('0x40')],{'raw':!![]})[_0xe713('0x1c')](function(_0x2cd76d){_0x118a79=_0x2cd76d;return db[_0xe713('0x24')][_0xe713('0x3a')]({'where':{'type':_0x1a9d8c['body'][_0xe713('0x26')]},'raw':!![]});})[_0xe713('0x1c')](function(_0x6a7e9f){if(_0x118a79['type']['toUpperCase']()=='STUN'){var _0x211225=fs[_0xe713('0x41')](path[_0xe713('0x42')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe713('0x43'));var _0x13a82e=ejs[_0xe713('0x44')](_0x211225,{'networks':_0x6a7e9f||[]});fs[_0xe713('0x45')](_0xe713('0x46'),_0x13a82e);return respondWithRpcPromise(_0xe713('0x47'),'create',{'module':_0xe713('0x48')});}else if(_0x118a79[_0xe713('0x26')]['toUpperCase']()==_0xe713('0x49')){var _0x15afff=fs[_0xe713('0x41')](path[_0xe713('0x42')](config[_0xe713('0x4a')],_0xe713('0x4b')),_0xe713('0x43'));var _0x535725=ejs[_0xe713('0x44')](_0x15afff,{'networks':_0x6a7e9f||[]});fs[_0xe713('0x45')](_0xe713('0x4c'),_0x535725);return respondWithRpcPromise(_0xe713('0x47'),_0xe713('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x140efa=fs[_0xe713('0x41')](path['join'](config[_0xe713('0x4a')],_0xe713('0x4d')),_0xe713('0x43'));var _0x20fb66=ejs[_0xe713('0x44')](_0x140efa,{'networks':_0x6a7e9f||[]});fs['writeFileSync'](util['format'](_0xe713('0x4e'),_0x1a9d8c['body'][_0xe713('0x26')][_0xe713('0x4f')]()),_0x20fb66);return respondWithRpcPromise(_0xe713('0x47'),_0xe713('0x3f'),{'module':_0xe713('0x50')});}})['then'](function(){return _0x118a79;})['then'](respondWithResult(_0x32b5f3,0xc9))[_0xe713('0x13')](handleError(_0x32b5f3,null));};exports[_0xe713('0x51')]=function(_0x522672,_0x1ba2d3){var _0x2da67a;return db['Network'][_0xe713('0x52')]({'where':{'id':_0x522672['params']['id']}})[_0xe713('0x1c')](handleEntityNotFound(_0x1ba2d3,null))[_0xe713('0x1c')](saveUpdates(_0x522672[_0xe713('0x40')],null))[_0xe713('0x1c')](function(_0x2249c0){if(_0x2249c0){_0x2da67a=_0x2249c0;return db[_0xe713('0x24')][_0xe713('0x3a')]({'where':{'type':_0x2da67a[_0xe713('0x26')]},'raw':!![]});}return null;})[_0xe713('0x1c')](function(_0x1d7c07){if(_0x2da67a['type']['toUpperCase']()==_0xe713('0x53')){var _0x57badb=fs[_0xe713('0x41')](path[_0xe713('0x42')](config[_0xe713('0x4a')],_0xe713('0x54')),_0xe713('0x43'));var _0x2a91fd=ejs['render'](_0x57badb,{'networks':_0x1d7c07||[]});fs['writeFileSync'](_0xe713('0x46'),_0x2a91fd);return respondWithRpcPromise(_0xe713('0x47'),_0xe713('0x51'),{'module':_0xe713('0x48')});}else if(_0x2da67a[_0xe713('0x26')][_0xe713('0x55')]()==_0xe713('0x49')){var _0x4603d9=fs['readFileSync'](path['join'](config[_0xe713('0x4a')],'server/files/templates/turn_multiple.ejs'),_0xe713('0x43'));var _0x3dadec=ejs[_0xe713('0x44')](_0x4603d9,{'networks':_0x1d7c07||[]});fs[_0xe713('0x45')](_0xe713('0x4c'),_0x3dadec);return respondWithRpcPromise('Reload','update',{'module':_0xe713('0x48')});}else{var _0x31580b=fs['readFileSync'](path[_0xe713('0x42')](config[_0xe713('0x4a')],_0xe713('0x4d')),_0xe713('0x43'));var _0x3e2540=ejs[_0xe713('0x44')](_0x31580b,{'networks':_0x1d7c07||[]});fs[_0xe713('0x45')](util[_0xe713('0x56')]('/etc/asterisk/sip_xcally_%s.conf',_0x522672['body']['type'][_0xe713('0x4f')]()),_0x3e2540);return respondWithRpcPromise(_0xe713('0x47'),_0xe713('0x51'),{'module':_0xe713('0x50')});}})[_0xe713('0x1c')](function(_0x3ac173){if(_0x3ac173){return _0x2da67a;}return null;})['then'](respondWithResult(_0x1ba2d3,null))[_0xe713('0x13')](handleError(_0x1ba2d3,null));};exports[_0xe713('0x1d')]=function(_0x5b66fa,_0x146cfb){var _0x225220;return db[_0xe713('0x24')]['find']({'where':{'id':_0x5b66fa[_0xe713('0x3d')]['id']}})['then'](function(_0x270aa6){_0x225220=_0x270aa6;return _0x270aa6;})[_0xe713('0x1c')](handleEntityNotFound(_0x146cfb,null))['then'](removeEntity(_0x146cfb,null))[_0xe713('0x1c')](function(){if(_0x225220){return db[_0xe713('0x24')][_0xe713('0x3a')]({'where':{'type':_0x225220[_0xe713('0x26')]},'raw':!![]});}})[_0xe713('0x1c')](function(_0x3b03a7){if(_0x225220[_0xe713('0x26')][_0xe713('0x55')]()==_0xe713('0x53')){var _0x4e5832=fs[_0xe713('0x41')](path[_0xe713('0x42')](config['root'],_0xe713('0x54')),_0xe713('0x43'));var _0x226787=ejs[_0xe713('0x44')](_0x4e5832,{'networks':_0x3b03a7||[]});fs['writeFileSync'](_0xe713('0x46'),_0x226787);return respondWithRpcPromise(_0xe713('0x47'),_0xe713('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x225220[_0xe713('0x26')][_0xe713('0x55')]()==_0xe713('0x49')){var _0x144a3c=fs[_0xe713('0x41')](path[_0xe713('0x42')](config['root'],_0xe713('0x4b')),'utf8');var _0x561933=ejs[_0xe713('0x44')](_0x144a3c,{'networks':_0x3b03a7||[]});fs[_0xe713('0x45')]('/etc/asterisk/turn_xcally.conf',_0x561933);return respondWithRpcPromise(_0xe713('0x47'),'destroy',{'module':_0xe713('0x48')});}else{var _0x1968d2=fs[_0xe713('0x41')](path[_0xe713('0x42')](config['root'],_0xe713('0x4d')),_0xe713('0x43'));var _0x18cea7=ejs[_0xe713('0x44')](_0x1968d2,{'networks':_0x3b03a7||[]});fs[_0xe713('0x45')](util['format'](_0xe713('0x4e'),_0x225220['type'][_0xe713('0x4f')]()),_0x18cea7);return respondWithRpcPromise('Reload',_0xe713('0x1d'),{'module':_0xe713('0x50')});}})[_0xe713('0x13')](handleError(_0x146cfb,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9926ed6..a0500a5 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 _0x1306=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x31ffd9,_0x5c508b){var _0x62eaa6=function(_0x36c550){while(--_0x36c550){_0x31ffd9['push'](_0x31ffd9['shift']());}};_0x62eaa6(++_0x5c508b);}(_0x1306,0x17a));var _0x6130=function(_0x36b73a,_0x9ab02e){_0x36b73a=_0x36b73a-0x0;var _0x727d6=_0x1306[_0x36b73a];return _0x727d6;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var logger=require(_0x6130('0x2'))(_0x6130('0x3'));var moment=require(_0x6130('0x4'));var BPromise=require(_0x6130('0x5'));var rp=require(_0x6130('0x6'));var fs=require('fs');var path=require(_0x6130('0x7'));var rimraf=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var attributes=require(_0x6130('0xa'));module[_0x6130('0xb')]=function(_0x213e6a,_0x2b965d){return _0x213e6a[_0x6130('0xc')](_0x6130('0xd'),attributes,{'tableName':_0x6130('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9434=['api','moment','bluebird','path','rimraf','./network.attributes','exports','network','lodash','util','../../config/logger'];(function(_0x4fb79d,_0x35e772){var _0x152cc6=function(_0x271193){while(--_0x271193){_0x4fb79d['push'](_0x4fb79d['shift']());}};_0x152cc6(++_0x35e772);}(_0x9434,0x168));var _0x4943=function(_0x21e1bb,_0xf2f6bf){_0x21e1bb=_0x21e1bb-0x0;var _0x479fc7=_0x9434[_0x21e1bb];return _0x479fc7;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var logger=require(_0x4943('0x2'))(_0x4943('0x3'));var moment=require(_0x4943('0x4'));var BPromise=require(_0x4943('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4943('0x6'));var rimraf=require(_0x4943('0x7'));var config=require('../../config/environment');var attributes=require(_0x4943('0x8'));module[_0x4943('0x9')]=function(_0x4f930e,_0x394d9d){return _0x4f930e['define']('Network',attributes,{'tableName':_0x4943('0xa'),'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 a46e592..afc8bf4 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 _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(_0x3cba39,_0x476c98){var _0x3b63f2=function(_0x1ac768){while(--_0x1ac768){_0x3cba39['push'](_0x3cba39['shift']());}};_0x3b63f2(++_0x476c98);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 +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(_0x2c55c6,_0x46591d){var _0x5a8a79=function(_0x3f4943){while(--_0x3f4943){_0x2c55c6['push'](_0x2c55c6['shift']());}};_0x5a8a79(++_0x46591d);}(_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 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 f83efee..c184345 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 _0xd2ad=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','addDisposition','/:id/notify','notify','post','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelAccount.controller'];(function(_0x3f87c5,_0x311cdc){var _0x26a80d=function(_0x222667){while(--_0x222667){_0x3f87c5['push'](_0x3f87c5['shift']());}};_0x26a80d(++_0x311cdc);}(_0xd2ad,0x128));var _0xdd2a=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0xd2ad[_0x5a7f64];return _0x3d30f1;};'use strict';var multer=require(_0xdd2a('0x0'));var util=require(_0xdd2a('0x1'));var path=require(_0xdd2a('0x2'));var timeout=require(_0xdd2a('0x3'));var express=require(_0xdd2a('0x4'));var router=express['Router']();var fs_extra=require(_0xdd2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd2a('0x6'));var config=require('../../config/environment');var controller=require(_0xdd2a('0x7'));router[_0xdd2a('0x8')]('/',auth[_0xdd2a('0x9')](),controller[_0xdd2a('0xa')]);router[_0xdd2a('0x8')](_0xdd2a('0xb'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0xc')]);router[_0xdd2a('0x8')](_0xdd2a('0xd'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0xe')]);router[_0xdd2a('0x8')](_0xdd2a('0xf'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x10')]);router[_0xdd2a('0x8')](_0xdd2a('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xdd2a('0x12'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x13')]);router[_0xdd2a('0x8')](_0xdd2a('0x14'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x15')]);router['get']('/:id/users',auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x16')]);router['post']('/',auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x17')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdd2a('0x18')]);router['post'](_0xdd2a('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xdd2a('0x19'),controller[_0xdd2a('0x1a')]);router[_0xdd2a('0x1b')](_0xdd2a('0x12'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x1c')]);router[_0xdd2a('0x1b')]('/:id/users',auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x1d')]);router[_0xdd2a('0x1b')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xdd2a('0x1e')](_0xdd2a('0xd'),auth['isAuthenticated'](),controller[_0xdd2a('0x1f')]);router[_0xdd2a('0x20')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xdd2a('0xf'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x21')]);router[_0xdd2a('0x20')](_0xdd2a('0x11'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x22')]);router[_0xdd2a('0x20')](_0xdd2a('0x23'),auth[_0xdd2a('0x9')](),controller[_0xdd2a('0x24')]);module[_0xdd2a('0x25')]=router; \ No newline at end of file +var _0xc2b5=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','/:id','update','destroy','removeDispositions','delete','removeAnswers','/:id/users','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x75a103,_0x406e69){var _0x10ec8a=function(_0x3c17fc){while(--_0x3c17fc){_0x75a103['push'](_0x75a103['shift']());}};_0x10ec8a(++_0x406e69);}(_0xc2b5,0x19c));var _0x5c2b=function(_0xe7082a,_0xd0d68f){_0xe7082a=_0xe7082a-0x0;var _0x92f6a8=_0xc2b5[_0xe7082a];return _0x92f6a8;};'use strict';var multer=require(_0x5c2b('0x0'));var util=require(_0x5c2b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c2b('0x2'));var router=express[_0x5c2b('0x3')]();var fs_extra=require(_0x5c2b('0x4'));var auth=require(_0x5c2b('0x5'));var interaction=require(_0x5c2b('0x6'));var config=require('../../config/environment');var controller=require(_0x5c2b('0x7'));router[_0x5c2b('0x8')]('/',auth['isAuthenticated'](),controller[_0x5c2b('0x9')]);router[_0x5c2b('0x8')](_0x5c2b('0xa'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0xc')]);router['get']('/:id',auth[_0x5c2b('0xb')](),controller[_0x5c2b('0xd')]);router[_0x5c2b('0x8')](_0x5c2b('0xe'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0xf')]);router[_0x5c2b('0x8')](_0x5c2b('0x10'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x11')]);router[_0x5c2b('0x8')](_0x5c2b('0x12'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x13')]);router[_0x5c2b('0x8')](_0x5c2b('0x14'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x15')]);router[_0x5c2b('0x8')]('/:id/users',auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x16')]);router[_0x5c2b('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5c2b('0x17')](_0x5c2b('0xe'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x18')]);router['post']('/:id/canned_answers',auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x19')]);router[_0x5c2b('0x17')](_0x5c2b('0x1a'),controller[_0x5c2b('0x1b')]);router[_0x5c2b('0x17')](_0x5c2b('0x12'),auth[_0x5c2b('0xb')](),controller['addApplications']);router['post']('/:id/users',auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x1c')]);router[_0x5c2b('0x17')](_0x5c2b('0x1d'),auth['isAuthenticated'](),controller[_0x5c2b('0x1e')]);router['put'](_0x5c2b('0x1f'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x20')]);router['delete']('/:id',auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x21')]);router['delete'](_0x5c2b('0xe'),auth['isAuthenticated'](),controller[_0x5c2b('0x22')]);router[_0x5c2b('0x23')](_0x5c2b('0x10'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x24')]);router[_0x5c2b('0x23')](_0x5c2b('0x25'),auth[_0x5c2b('0xb')](),controller[_0x5c2b('0x26')]);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 a18af5e..1881e42 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 _0xa431=['mandatoryDisposition','sequelize','exports','name','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x56c802,_0x51f08d){var _0x2221c9=function(_0x201b0c){while(--_0x201b0c){_0x56c802['push'](_0x56c802['shift']());}};_0x2221c9(++_0x51f08d);}(_0xa431,0x153));var _0x1a43=function(_0x4c4c81,_0x575457){_0x4c4c81=_0x4c4c81-0x0;var _0xebc4f5=_0xa431[_0x4c4c81];return _0xebc4f5;};'use strict';var Sequelize=require(_0x1a43('0x0'));var rs=require('randomstring');module[_0x1a43('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1a43('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1a43('0x3')]},'token':{'type':Sequelize[_0x1a43('0x3')],'defaultValue':function(){return rs[_0x1a43('0x4')]();}},'replyUri':{'type':Sequelize[_0x1a43('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1a43('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1a43('0x5');}},'notificationSound':{'type':Sequelize[_0x1a43('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a43('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1a43('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1a43('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a43('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a43('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1a43('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1a43('0x6')],'defaultValue':![],'comment':_0x1a43('0x9'),'set':function(_0x22b66a){if(!_0x22b66a)this[_0x1a43('0xa')](_0x1a43('0xb'),null);this[_0x1a43('0xa')](_0x1a43('0xc'),_0x22b66a);}}}; \ No newline at end of file +var _0xd872=['sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x507838,_0xb2d0df){var _0x3ab6d7=function(_0x3d946e){while(--_0x3d946e){_0x507838['push'](_0x507838['shift']());}};_0x3ab6d7(++_0xb2d0df);}(_0xd872,0xee));var _0x2d87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd872[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2d87('0x0'));var rs=require(_0x2d87('0x1'));module[_0x2d87('0x2')]={'name':{'type':Sequelize[_0x2d87('0x3')],'unique':_0x2d87('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2d87('0x3')],'defaultValue':function(){return rs[_0x2d87('0x5')]();}},'replyUri':{'type':Sequelize[_0x2d87('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2d87('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2d87('0x6')],'defaultValue':function(){return _0x2d87('0x7');}},'notificationSound':{'type':Sequelize[_0x2d87('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d87('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2d87('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2d87('0x3')]},'queueTransfer':{'type':Sequelize[_0x2d87('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d87('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d87('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d87('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2d87('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x2d87('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x2d87('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b221d){if(!_0x4b221d)this[_0x2d87('0xb')](_0x2d87('0xc'),null);this[_0x2d87('0xb')](_0x2d87('0xd'),_0x4b221d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d9aedfd..6d60ec1 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 _0xe5e3=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','include','rows','show','params','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','firstName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','rimraf','zip-dir','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x516954,_0x122293){_0x516954=_0x516954-0x0;var _0x293d86=_0xe5e3[_0x516954];return _0x293d86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5e('0x0'));var zipdir=require(_0x3e5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e5e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3e5e('0x3'));var util=require(_0x3e5e('0x4'));var path=require('path');var sox=require(_0x3e5e('0x5'));var csv=require(_0x3e5e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5e('0x7'));var _=require('lodash');var squel=require(_0x3e5e('0x8'));var crypto=require('crypto');var jsforce=require(_0x3e5e('0x9'));var deskjs=require(_0x3e5e('0xa'));var toCsv=require(_0x3e5e('0x6'));var querystring=require(_0x3e5e('0xb'));var Papa=require(_0x3e5e('0xc'));var Redis=require(_0x3e5e('0xd'));var authService=require(_0x3e5e('0xe'));var qs=require(_0x3e5e('0xf'));var as=require(_0x3e5e('0x10'));var hardwareService=require(_0x3e5e('0x11'));var logger=require(_0x3e5e('0x12'))('api');var utils=require(_0x3e5e('0x13'));var config=require(_0x3e5e('0x14'));var licenseUtil=require(_0x3e5e('0x15'));var db=require(_0x3e5e('0x16'))['db'];config[_0x3e5e('0x17')]=_[_0x3e5e('0x18')](config[_0x3e5e('0x17')],{'host':_0x3e5e('0x19'),'port':0x18eb});var socket=require(_0x3e5e('0x1a'))(new Redis(config[_0x3e5e('0x17')]));require(_0x3e5e('0x1b'))[_0x3e5e('0x1c')](socket);var jayson=require(_0x3e5e('0x1d'));var client=jayson[_0x3e5e('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x3e5e('0x1e')][_0x3e5e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x580aae,_0x5dea39,_0x15f414,_0x106218){return new BPromise(function(_0x1b9a8a,_0x445648){var _0x4d144e=_0x106218||client;return _0x4d144e[_0x3e5e('0x20')](_0x580aae,_0x15f414)[_0x3e5e('0x21')](function(_0x5d84b7){logger[_0x3e5e('0x22')](_0x3e5e('0x23'),_0x5dea39,_0x3e5e('0x24'));logger[_0x3e5e('0x25')](_0x3e5e('0x26'),_0x5dea39,_0x3e5e('0x24'),JSON[_0x3e5e('0x27')](_0x5d84b7));if(_0x5d84b7['error']){if(_0x5d84b7['error']['code']===0x1f4){logger[_0x3e5e('0x28')](_0x3e5e('0x23'),_0x5dea39,_0x5d84b7['error']['message']);return _0x445648(_0x5d84b7[_0x3e5e('0x28')][_0x3e5e('0x29')]);}logger[_0x3e5e('0x28')](_0x3e5e('0x23'),_0x5dea39,_0x5d84b7[_0x3e5e('0x28')][_0x3e5e('0x29')]);return _0x1b9a8a(_0x5d84b7[_0x3e5e('0x28')][_0x3e5e('0x29')]);}else{logger[_0x3e5e('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5dea39,_0x3e5e('0x24'));_0x1b9a8a(_0x5d84b7[_0x3e5e('0x2a')][_0x3e5e('0x29')]);}})[_0x3e5e('0x2b')](function(_0x4c4067){logger[_0x3e5e('0x28')](_0x3e5e('0x23'),_0x5dea39,_0x4c4067);_0x445648(_0x4c4067);});});}function respondWithStatusCode(_0xdcc088,_0x31b570){_0x31b570=_0x31b570||0xcc;return function(_0x28af5e){if(_0x28af5e){return _0xdcc088[_0x3e5e('0x2c')](_0x31b570);}return _0xdcc088[_0x3e5e('0x2d')](_0x31b570)[_0x3e5e('0x2e')]();};}function respondWithResult(_0x5dabb1,_0x5a018f){_0x5a018f=_0x5a018f||0xc8;return function(_0x652822){if(_0x652822){return _0x5dabb1[_0x3e5e('0x2d')](_0x5a018f)[_0x3e5e('0x2f')](_0x652822);}};}function respondWithFilteredResult(_0x48cf5f,_0xa3f069){return function(_0x5c4f71){if(_0x5c4f71){var _0x412b2c=typeof _0xa3f069[_0x3e5e('0x30')]===_0x3e5e('0x31')&&typeof _0xa3f069[_0x3e5e('0x32')]===_0x3e5e('0x31');var _0x3990c1=_0x5c4f71[_0x3e5e('0x33')];var _0x166097=_0x412b2c?0x0:_0xa3f069[_0x3e5e('0x30')];var _0x37fac5=_0x412b2c?_0x5c4f71[_0x3e5e('0x33')]:_0xa3f069[_0x3e5e('0x30')]+_0xa3f069['limit'];var _0x29aae1;if(_0x37fac5>=_0x3990c1){_0x37fac5=_0x3990c1;_0x29aae1=0xc8;}else{_0x29aae1=0xce;}_0x48cf5f[_0x3e5e('0x2d')](_0x29aae1);return _0x48cf5f[_0x3e5e('0x34')](_0x3e5e('0x35'),_0x166097+'-'+_0x37fac5+'/'+_0x3990c1)['json'](_0x5c4f71);}return null;};}function patchUpdates(_0x203ac2){return function(_0x406371){try{jsonpatch['apply'](_0x406371,_0x203ac2,!![]);}catch(_0x486c98){return BPromise[_0x3e5e('0x36')](_0x486c98);}return _0x406371[_0x3e5e('0x37')]();};}function saveUpdates(_0x328de9,_0x585703){return function(_0x14eba2){if(_0x14eba2){return _0x14eba2[_0x3e5e('0x38')](_0x328de9)[_0x3e5e('0x21')](function(_0x781e97){return _0x781e97;});}return null;};}function removeEntity(_0xe49921,_0x5cc097){return function(_0x5774a9){if(_0x5774a9){return _0x5774a9[_0x3e5e('0x39')]()[_0x3e5e('0x21')](function(){var _0x469e5f=_0x5774a9['get']({'plain':!![]});var _0x166d9c=_0x3e5e('0x3a');return db[_0x3e5e('0x3b')]['destroy']({'where':{'type':_0x166d9c,'resourceId':_0x469e5f['id']}})[_0x3e5e('0x21')](function(){return _0x5774a9;});})[_0x3e5e('0x21')](function(){_0xe49921['status'](0xcc)[_0x3e5e('0x2e')]();});}};}function handleEntityNotFound(_0x20dde0,_0x1a4b83){return function(_0x30d258){if(!_0x30d258){_0x20dde0[_0x3e5e('0x2c')](0x194);}return _0x30d258;};}function handleError(_0xd08696,_0x299c9c){_0x299c9c=_0x299c9c||0x1f4;return function(_0x87c3f9){logger[_0x3e5e('0x28')](_0x87c3f9['stack']);if(_0x87c3f9[_0x3e5e('0x3c')]){delete _0x87c3f9['name'];}_0xd08696[_0x3e5e('0x2d')](_0x299c9c)[_0x3e5e('0x3d')](_0x87c3f9);};}exports[_0x3e5e('0x3e')]=function(_0x54c832,_0x4fc9fe){var _0x3d4f8e={'include':[{'model':db[_0x3e5e('0x3f')],'as':_0x3e5e('0x40')}]},_0x51b11c={},_0x2d43e5={'count':0x0,'rows':[]};var _0x19f2fe=_['map'](db[_0x3e5e('0x41')][_0x3e5e('0x42')],function(_0x18414b){return{'name':_0x18414b['fieldName'],'type':_0x18414b['type'][_0x3e5e('0x43')]};});_0x51b11c[_0x3e5e('0x44')]=_[_0x3e5e('0x45')](_0x19f2fe,_0x3e5e('0x3c'));_0x51b11c['query']=_[_0x3e5e('0x46')](_0x54c832['query']);_0x51b11c['filters']=_[_0x3e5e('0x47')](_0x51b11c[_0x3e5e('0x44')],_0x51b11c[_0x3e5e('0x48')]);_0x3d4f8e[_0x3e5e('0x49')]=_['intersection'](_0x51b11c['model'],qs[_0x3e5e('0x4a')](_0x54c832[_0x3e5e('0x48')][_0x3e5e('0x4a')]));_0x3d4f8e[_0x3e5e('0x49')]=_0x3d4f8e['attributes'][_0x3e5e('0x4b')]?_0x3d4f8e['attributes']:_0x51b11c['model'];if(!_0x54c832[_0x3e5e('0x48')][_0x3e5e('0x4c')](_0x3e5e('0x4d'))){_0x3d4f8e['limit']=qs[_0x3e5e('0x32')](_0x54c832[_0x3e5e('0x48')]['limit']);_0x3d4f8e[_0x3e5e('0x30')]=qs['offset'](_0x54c832[_0x3e5e('0x48')][_0x3e5e('0x30')]);}_0x3d4f8e[_0x3e5e('0x4e')]=qs[_0x3e5e('0x4f')](_0x54c832['query'][_0x3e5e('0x4f')]);_0x3d4f8e[_0x3e5e('0x50')]=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x54c832['query'],_0x51b11c['filters']),_0x19f2fe);if(_0x54c832[_0x3e5e('0x48')][_0x3e5e('0x53')]){_0x3d4f8e[_0x3e5e('0x50')]=_['merge'](_0x3d4f8e[_0x3e5e('0x50')],{'$or':_[_0x3e5e('0x45')](_0x19f2fe,function(_0x4b8885){if(_0x4b8885[_0x3e5e('0x54')]!=='VIRTUAL'){var _0x1eb289={};_0x1eb289[_0x4b8885[_0x3e5e('0x3c')]]={'$like':'%'+_0x54c832[_0x3e5e('0x48')][_0x3e5e('0x53')]+'%'};return _0x1eb289;}})});}_0x3d4f8e=_[_0x3e5e('0x55')]({},_0x3d4f8e,_0x54c832[_0x3e5e('0x56')]);var _0x30dc5f={'where':_0x3d4f8e[_0x3e5e('0x50')]};return db[_0x3e5e('0x41')][_0x3e5e('0x33')](_0x30dc5f)[_0x3e5e('0x21')](function(_0x4bce56){_0x2d43e5[_0x3e5e('0x33')]=_0x4bce56;if(_0x54c832[_0x3e5e('0x48')]['includeAll']){_0x3d4f8e[_0x3e5e('0x57')]=[{'all':!![]}];}return db[_0x3e5e('0x41')]['findAll'](_0x3d4f8e);})['then'](function(_0x120cb9){_0x2d43e5[_0x3e5e('0x58')]=_0x120cb9;return _0x2d43e5;})[_0x3e5e('0x21')](respondWithFilteredResult(_0x4fc9fe,_0x3d4f8e))[_0x3e5e('0x2b')](handleError(_0x4fc9fe,null));};exports[_0x3e5e('0x59')]=function(_0x4fe205,_0xbf8f42){var _0x2b03e5={'raw':![],'where':{'id':_0x4fe205[_0x3e5e('0x5a')]['id']},'include':[{'model':db[_0x3e5e('0x3f')],'as':_0x3e5e('0x40')}]},_0x511b78={};_0x511b78[_0x3e5e('0x44')]=_[_0x3e5e('0x46')](db[_0x3e5e('0x41')][_0x3e5e('0x42')]);_0x511b78[_0x3e5e('0x48')]=_['keys'](_0x4fe205['query']);_0x511b78[_0x3e5e('0x51')]=_[_0x3e5e('0x47')](_0x511b78[_0x3e5e('0x44')],_0x511b78[_0x3e5e('0x48')]);_0x2b03e5[_0x3e5e('0x49')]=_[_0x3e5e('0x47')](_0x511b78[_0x3e5e('0x44')],qs[_0x3e5e('0x4a')](_0x4fe205[_0x3e5e('0x48')][_0x3e5e('0x4a')]));_0x2b03e5[_0x3e5e('0x49')]=_0x2b03e5[_0x3e5e('0x49')]['length']?_0x2b03e5[_0x3e5e('0x49')]:_0x511b78[_0x3e5e('0x44')];if(_0x4fe205[_0x3e5e('0x48')][_0x3e5e('0x5b')]){_0x2b03e5[_0x3e5e('0x57')]=[{'all':!![]}];}_0x2b03e5=_[_0x3e5e('0x55')]({},_0x2b03e5,_0x4fe205[_0x3e5e('0x56')]);return db['OpenchannelAccount'][_0x3e5e('0x5c')](_0x2b03e5)[_0x3e5e('0x21')](handleEntityNotFound(_0xbf8f42,null))[_0x3e5e('0x21')](respondWithResult(_0xbf8f42,null))[_0x3e5e('0x2b')](handleError(_0xbf8f42,null));};exports[_0x3e5e('0x5d')]=function(_0x561e0e,_0x4ce9de){return db[_0x3e5e('0x41')][_0x3e5e('0x5d')](_0x561e0e[_0x3e5e('0x5e')],{})['then'](function(_0x7aa2b4){var _0x47d261=_0x561e0e['user'][_0x3e5e('0x5f')]({'plain':!![]});if(!_0x47d261)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47d261[_0x3e5e('0x60')]===_0x3e5e('0x61')){var _0x1aa351=_0x7aa2b4['get']({'plain':!![]});var _0x40dc49='OpenchannelAccounts';return db[_0x3e5e('0x62')][_0x3e5e('0x5c')]({'where':{'name':_0x40dc49,'userProfileId':_0x47d261[_0x3e5e('0x63')]},'raw':!![]})[_0x3e5e('0x21')](function(_0x4fa295){if(_0x4fa295&&_0x4fa295['autoAssociation']===0x0){return db[_0x3e5e('0x3b')][_0x3e5e('0x5d')]({'name':_0x1aa351[_0x3e5e('0x3c')],'resourceId':_0x1aa351['id'],'type':_0x4fa295[_0x3e5e('0x3c')],'sectionId':_0x4fa295['id']},{})[_0x3e5e('0x21')](function(){return _0x7aa2b4;});}else{return _0x7aa2b4;}})[_0x3e5e('0x2b')](function(_0x5f188e){logger[_0x3e5e('0x28')](_0x3e5e('0x64'),_0x5f188e);throw _0x5f188e;});}return _0x7aa2b4;})[_0x3e5e('0x21')](respondWithResult(_0x4ce9de,0xc9))[_0x3e5e('0x2b')](handleError(_0x4ce9de,null));};exports[_0x3e5e('0x38')]=function(_0x1e5769,_0x526cf7){if(_0x1e5769[_0x3e5e('0x5e')]['id']){delete _0x1e5769[_0x3e5e('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x1e5769[_0x3e5e('0x5a')]['id']},'include':[{'model':db[_0x3e5e('0x3f')],'as':_0x3e5e('0x40')}]})[_0x3e5e('0x21')](handleEntityNotFound(_0x526cf7,null))['then'](saveUpdates(_0x1e5769['body'],null))[_0x3e5e('0x21')](respondWithResult(_0x526cf7,null))['catch'](handleError(_0x526cf7,null));};exports['destroy']=function(_0x1f083a,_0x4b7c4d){return db[_0x3e5e('0x41')][_0x3e5e('0x5c')]({'where':{'id':_0x1f083a[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x4b7c4d,null))[_0x3e5e('0x21')](removeEntity(_0x4b7c4d,null))['catch'](handleError(_0x4b7c4d,null));};exports[_0x3e5e('0x65')]=function(_0x23d86a,_0x40e809){return db['OpenchannelAccount'][_0x3e5e('0x65')]()['then'](respondWithResult(_0x40e809,null))[_0x3e5e('0x2b')](handleError(_0x40e809,null));};exports[_0x3e5e('0x66')]=function(_0xf04470,_0x29008f,_0x13b1eb){if(_0xf04470[_0x3e5e('0x5e')]['id']){delete _0xf04470[_0x3e5e('0x5e')]['id'];}return db['OpenchannelAccount'][_0x3e5e('0x5c')]({'where':{'id':_0xf04470['params']['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x29008f,null))['then'](function(_0x142067){if(_0x142067){_0xf04470[_0x3e5e('0x5e')][_0x3e5e('0x67')]=_0x142067['id'];return db[_0x3e5e('0x68')][_0x3e5e('0x5d')](_0xf04470[_0x3e5e('0x5e')]);}})[_0x3e5e('0x21')](respondWithResult(_0x29008f,null))[_0x3e5e('0x2b')](handleError(_0x29008f,null));};exports[_0x3e5e('0x69')]=function(_0x1200b0,_0x2a9151,_0x4c7c67){var _0x5d1bbd={'raw':![],'where':{}};var _0x1bb96c={};var _0x46f747={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1200b0['params']['id']}})['then'](handleEntityNotFound(_0x2a9151,null))['then'](function(_0x16ad26){if(_0x16ad26){_0x1bb96c['model']=_[_0x3e5e('0x46')](db[_0x3e5e('0x68')][_0x3e5e('0x42')]);_0x1bb96c[_0x3e5e('0x48')]=_[_0x3e5e('0x46')](_0x1200b0[_0x3e5e('0x48')]);_0x1bb96c[_0x3e5e('0x51')]=_[_0x3e5e('0x47')](_0x1bb96c['model'],_0x1bb96c[_0x3e5e('0x48')]);_0x5d1bbd[_0x3e5e('0x49')]=_[_0x3e5e('0x47')](_0x1bb96c['model'],qs[_0x3e5e('0x4a')](_0x1200b0[_0x3e5e('0x48')][_0x3e5e('0x4a')]));_0x5d1bbd['attributes']=_0x5d1bbd['attributes'][_0x3e5e('0x4b')]?_0x5d1bbd[_0x3e5e('0x49')]:_0x1bb96c[_0x3e5e('0x44')];if(!_0x1200b0[_0x3e5e('0x48')]['hasOwnProperty'](_0x3e5e('0x4d'))){_0x5d1bbd[_0x3e5e('0x32')]=qs[_0x3e5e('0x32')](_0x1200b0[_0x3e5e('0x48')]['limit']);_0x5d1bbd[_0x3e5e('0x30')]=qs[_0x3e5e('0x30')](_0x1200b0[_0x3e5e('0x48')]['offset']);}_0x5d1bbd[_0x3e5e('0x4e')]=qs[_0x3e5e('0x4f')](_0x1200b0[_0x3e5e('0x48')][_0x3e5e('0x4f')]);_0x5d1bbd[_0x3e5e('0x50')]=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x1200b0[_0x3e5e('0x48')],_0x1bb96c['filters']));_0x5d1bbd[_0x3e5e('0x50')][_0x3e5e('0x67')]=_0x16ad26['id'];if(_0x1200b0['query'][_0x3e5e('0x53')]){_0x5d1bbd[_0x3e5e('0x50')]=_[_0x3e5e('0x55')](_0x5d1bbd[_0x3e5e('0x50')],{'$or':_['map'](_0x5d1bbd[_0x3e5e('0x49')],function(_0x4666eb){var _0x44991d={};_0x44991d[_0x4666eb]={'$like':'%'+_0x1200b0[_0x3e5e('0x48')][_0x3e5e('0x53')]+'%'};return _0x44991d;})});}_0x5d1bbd=_[_0x3e5e('0x55')]({},_0x5d1bbd,_0x1200b0[_0x3e5e('0x56')]);return db['Disposition'][_0x3e5e('0x33')]({'where':_0x5d1bbd['where']})[_0x3e5e('0x21')](function(_0x2d281e){_0x46f747[_0x3e5e('0x33')]=_0x2d281e;if(_0x1200b0[_0x3e5e('0x48')][_0x3e5e('0x5b')]){_0x5d1bbd[_0x3e5e('0x57')]=[{'all':!![]}];}return db[_0x3e5e('0x68')][_0x3e5e('0x6a')](_0x5d1bbd);})[_0x3e5e('0x21')](function(_0x367999){_0x46f747['rows']=_0x367999;return _0x46f747;});}})['then'](respondWithFilteredResult(_0x2a9151,_0x5d1bbd))[_0x3e5e('0x2b')](handleError(_0x2a9151,null));};exports[_0x3e5e('0x6b')]=function(_0x3a7bd3,_0x5c8a5b,_0x52d0ea){return db[_0x3e5e('0x41')]['find']({'where':{'id':_0x3a7bd3[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x5c8a5b,null))[_0x3e5e('0x21')](function(_0x38ddfe){if(_0x38ddfe){return _0x38ddfe[_0x3e5e('0x6b')](_0x3a7bd3['query'][_0x3e5e('0x6c')]);}})[_0x3e5e('0x21')](respondWithStatusCode(_0x5c8a5b,null))[_0x3e5e('0x2b')](handleError(_0x5c8a5b,null));};exports['addAnswer']=function(_0x30d39b,_0x54bb88,_0x185fe3){if(_0x30d39b[_0x3e5e('0x5e')]['id']){delete _0x30d39b['body']['id'];}return db['OpenchannelAccount'][_0x3e5e('0x5c')]({'where':{'id':_0x30d39b[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x54bb88,null))[_0x3e5e('0x21')](function(_0x2b4df0){if(_0x2b4df0){_0x30d39b[_0x3e5e('0x5e')][_0x3e5e('0x67')]=_0x2b4df0['id'];return db[_0x3e5e('0x6d')]['create'](_0x30d39b[_0x3e5e('0x5e')]);}})['then'](respondWithResult(_0x54bb88,null))[_0x3e5e('0x2b')](handleError(_0x54bb88,null));};exports['getAnswers']=function(_0x1a952b,_0x891df3,_0x2c95bf){var _0x3c25e5={'raw':![],'where':{}};var _0x17276b={};var _0x42cb11={'count':0x0,'rows':[]};return db[_0x3e5e('0x41')]['findOne']({'where':{'id':_0x1a952b['params']['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x891df3,null))[_0x3e5e('0x21')](function(_0x5abd60){if(_0x5abd60){_0x17276b[_0x3e5e('0x44')]=_[_0x3e5e('0x46')](db['CannedAnswer'][_0x3e5e('0x42')]);_0x17276b[_0x3e5e('0x48')]=_[_0x3e5e('0x46')](_0x1a952b[_0x3e5e('0x48')]);_0x17276b[_0x3e5e('0x51')]=_[_0x3e5e('0x47')](_0x17276b[_0x3e5e('0x44')],_0x17276b[_0x3e5e('0x48')]);_0x3c25e5[_0x3e5e('0x49')]=_[_0x3e5e('0x47')](_0x17276b[_0x3e5e('0x44')],qs[_0x3e5e('0x4a')](_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x4a')]));_0x3c25e5[_0x3e5e('0x49')]=_0x3c25e5['attributes'][_0x3e5e('0x4b')]?_0x3c25e5['attributes']:_0x17276b['model'];if(!_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x4c')]('nolimit')){_0x3c25e5[_0x3e5e('0x32')]=qs[_0x3e5e('0x32')](_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x32')]);_0x3c25e5['offset']=qs[_0x3e5e('0x30')](_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x30')]);}_0x3c25e5['order']=qs['sort'](_0x1a952b['query'][_0x3e5e('0x4f')]);_0x3c25e5[_0x3e5e('0x50')]=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x1a952b['query'],_0x17276b[_0x3e5e('0x51')]));_0x3c25e5[_0x3e5e('0x50')][_0x3e5e('0x67')]=_0x5abd60['id'];if(_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x53')]){_0x3c25e5[_0x3e5e('0x50')]=_['merge'](_0x3c25e5['where'],{'$or':_['map'](_0x3c25e5['attributes'],function(_0x154b28){var _0x408a7f={};_0x408a7f[_0x154b28]={'$like':'%'+_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x53')]+'%'};return _0x408a7f;})});}_0x3c25e5=_[_0x3e5e('0x55')]({},_0x3c25e5,_0x1a952b[_0x3e5e('0x56')]);return db[_0x3e5e('0x6d')]['count']({'where':_0x3c25e5[_0x3e5e('0x50')]})['then'](function(_0x3ac49b){_0x42cb11['count']=_0x3ac49b;if(_0x1a952b[_0x3e5e('0x48')][_0x3e5e('0x5b')]){_0x3c25e5[_0x3e5e('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3e5e('0x6a')](_0x3c25e5);})['then'](function(_0x49c42a){_0x42cb11[_0x3e5e('0x58')]=_0x49c42a;return _0x42cb11;});}})[_0x3e5e('0x21')](respondWithFilteredResult(_0x891df3,_0x3c25e5))[_0x3e5e('0x2b')](handleError(_0x891df3,null));};exports[_0x3e5e('0x6e')]=function(_0x5ba383,_0x26e703,_0x731e99){return db['OpenchannelAccount'][_0x3e5e('0x5c')]({'where':{'id':_0x5ba383[_0x3e5e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x26e703,null))[_0x3e5e('0x21')](function(_0x18099b){if(_0x18099b){return _0x18099b['removeAnswers'](_0x5ba383[_0x3e5e('0x48')][_0x3e5e('0x6c')]);}})[_0x3e5e('0x21')](respondWithStatusCode(_0x26e703,null))[_0x3e5e('0x2b')](handleError(_0x26e703,null));};exports[_0x3e5e('0x6f')]=function(_0x4392a7,_0xe144cf,_0x247cd3){var _0x543bdf={'body':_0x4392a7['body'],'channel':_0x3e5e('0x70')};var _0x17983e=[];var _0x1ae747=[];var _0x57b8bc={};var _0x3d4f2f=![];return db[_0x3e5e('0x71')][_0x3e5e('0x65')]()[_0x3e5e('0x21')](function(_0x9367f5){if(!_0x9367f5){throw new db[(_0x3e5e('0x72'))][(_0x3e5e('0x73'))](_0x3e5e('0x74'));}_0x17983e=_[_0x3e5e('0x75')](_['keys'](_0x9367f5),[_0x3e5e('0x76'),_0x3e5e('0x77')]);_0x1ae747=_[_0x3e5e('0x75')](_['keys'](_0x9367f5),['createdAt','updatedAt',_0x3e5e('0x78'),_0x3e5e('0x79')]);if(_0x4392a7[_0x3e5e('0x5e')]['id']){delete _0x4392a7[_0x3e5e('0x5e')]['id'];}if(_[_0x3e5e('0x7a')](_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7b')])){throw new db[(_0x3e5e('0x72'))]['ValidationError'](_0x3e5e('0x7c'));}if(_['isNil'](_0x4392a7[_0x3e5e('0x5e')]['body'])||_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x5e')]===''){throw new db[(_0x3e5e('0x72'))][(_0x3e5e('0x73'))](_0x3e5e('0x7d'));}if(_[_0x3e5e('0x7a')](_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7e')])){throw new db[(_0x3e5e('0x72'))]['ValidationError'](_0x3e5e('0x7f')+_0x1ae747);}if(!_['includes'](_0x1ae747,_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7e')])){throw new db[(_0x3e5e('0x72'))][(_0x3e5e('0x73'))](_0x3e5e('0x80')+_0x1ae747);}_0x57b8bc[_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7e')]]=_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7b')];})[_0x3e5e('0x21')](function(){return db[_0x3e5e('0x41')][_0x3e5e('0x5c')]({'where':{'id':_0x4392a7[_0x3e5e('0x5a')]['id']},'include':[{'model':db[_0x3e5e('0x81')],'as':_0x3e5e('0x82'),'include':[{'model':db[_0x3e5e('0x71')],'as':_0x3e5e('0x83'),'where':_0x57b8bc,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3e5e('0x84')],'as':_0x3e5e('0x85')}]});})[_0x3e5e('0x21')](handleEntityNotFound(_0xe144cf,null))[_0x3e5e('0x21')](function(_0x3cccfb){if(_0x3cccfb&&_0x3cccfb[_0x3e5e('0x82')]){_0x543bdf[_0x3e5e('0x86')]=_0x3cccfb;_0x543bdf[_0x3e5e('0x87')]=_0x3cccfb['Applications'];_0x543bdf[_0x3e5e('0x88')]=_0x3cccfb['List'];_0x543bdf['applications']=_[_0x3e5e('0x89')](_0x543bdf[_0x3e5e('0x87')],['priority'],[_0x3e5e('0x8a')]);if(_0x543bdf[_0x3e5e('0x86')][_0x3e5e('0x85')]){delete _0x543bdf[_0x3e5e('0x86')][_0x3e5e('0x85')];}if(_0x543bdf[_0x3e5e('0x86')][_0x3e5e('0x82')]&&_0x543bdf['account']['List'][_0x3e5e('0x83')][_0x3e5e('0x4b')]){return _0x543bdf['account']['List'][_0x3e5e('0x83')][0x0];}var _0x45d3bf=_['defaults'](_0x4392a7[_0x3e5e('0x5e')],{'firstName':_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7b')],'ListId':_0x3cccfb[_0x3e5e('0x79')]});_0x45d3bf[_0x4392a7[_0x3e5e('0x5e')]['mapKey']]=_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x7b')];return db[_0x3e5e('0x71')][_0x3e5e('0x5d')](_0x45d3bf,{'fields':_0x17983e,'raw':!![]});}})[_0x3e5e('0x21')](handleEntityNotFound(_0xe144cf,null))[_0x3e5e('0x21')](function(_0xd29f3){_0x543bdf['contact']=_0xd29f3;if(_0xd29f3){var _0x4f6e65={'ContactId':_0xd29f3['id'],'OpenchannelAccountId':_0x4392a7['params']['id'],'from':(_0xd29f3['firstName']||'')+'\x20'+(_0xd29f3[_0x3e5e('0x8b')]||'')};var _0x22221c={'OpenchannelAccountId':_0x4392a7[_0x3e5e('0x5a')]['id'],'closed':![]};if(_0x4392a7[_0x3e5e('0x5e')]['threadId']){_0x22221c[_0x3e5e('0x8c')]=_0x4392a7[_0x3e5e('0x5e')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x22221c})[_0x3e5e('0x21')](function(_0x246a43){if(_0x246a43){return[_0x246a43,![]];}_0x4f6e65[_0x3e5e('0x8c')]=_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x8c')];_0x4f6e65[_0x3e5e('0x8d')]=_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x8d')];return db[_0x3e5e('0x8e')][_0x3e5e('0x5d')](_0x4f6e65)['then'](function(_0x19e289){return[_0x19e289,!![]];});});}else{_0x22221c[_0x3e5e('0x8c')]=null;}_0x22221c[_0x3e5e('0x8f')]=_0xd29f3['id'];return db[_0x3e5e('0x8e')][_0x3e5e('0x5c')]({'where':_0x22221c})['then'](function(_0x13bd6e){if(_0x13bd6e){return[_0x13bd6e,![]];}return db[_0x3e5e('0x8e')][_0x3e5e('0x5d')](_0x4f6e65)[_0x3e5e('0x21')](function(_0xea5ddf){return[_0xea5ddf,!![]];});});}})[_0x3e5e('0x90')](function(_0x1a89c7,_0x175216){if(_0x1a89c7){_0x3d4f2f=_0x175216;if(!_0x175216){var _0xed8498={'from':(_0x543bdf[_0x3e5e('0x91')][_0x3e5e('0x92')]||'')+'\x20'+(_0x543bdf[_0x3e5e('0x91')][_0x3e5e('0x8b')]||'')};if(_0x4392a7['body'][_0x3e5e('0x8c')]&&_0x4392a7['body'][_0x3e5e('0x93')]&&_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x8c')]!=_0x4392a7[_0x3e5e('0x5e')]['messageId']){_0xed8498[_0x3e5e('0x8c')]=_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x93')];}return _0x1a89c7[_0x3e5e('0x38')](_0xed8498);}else{return _0x1a89c7;}}})[_0x3e5e('0x21')](function(_0x15a9c3){_0x543bdf[_0x3e5e('0x94')]=_0x15a9c3[_0x3e5e('0x5f')]({'plain':!![]});_0x543bdf[_0x3e5e('0x94')][_0x3e5e('0x95')]=_0x3d4f2f;if(_0x543bdf[_0x3e5e('0x94')][_0x3e5e('0x95')]){if(_0x543bdf[_0x3e5e('0x86')]['autoclose']){_0x543bdf['applications'][_0x3e5e('0x96')]({'id':0x0,'priority':_0x543bdf[_0x3e5e('0x87')][_0x3e5e('0x4b')]+0x1,'app':'close','appdata':_0x3e5e('0x97'),'interval':_0x3e5e('0x98')});}}return db[_0x3e5e('0x99')][_0x3e5e('0x5d')]({'body':_0x4392a7[_0x3e5e('0x5e')][_0x3e5e('0x5e')],'OpenchannelAccountId':_0x4392a7[_0x3e5e('0x5a')]['id'],'OpenchannelInteractionId':_0x15a9c3['id'],'direction':'in','ContactId':_0x543bdf[_0x3e5e('0x91')]['id'],'AttachmentId':_0x4392a7['body'][_0x3e5e('0x9a')]});})[_0x3e5e('0x21')](function(_0x476b5c){_0x543bdf[_0x3e5e('0x29')]=_0x476b5c;if(!_0x543bdf[_0x3e5e('0x94')][_0x3e5e('0x9b')])return;return db[_0x3e5e('0x9c')][_0x3e5e('0x5c')]({'attributes':['id',_0x3e5e('0x3c')],'where':{'id':_0x543bdf['interaction'][_0x3e5e('0x9b')]}});})[_0x3e5e('0x21')](function(_0x5c95cc){if(_0x5c95cc){_0x543bdf['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3e5e('0x9d'),'appdata':_0x5c95cc[_0x3e5e('0x3c')]+','+(_0x543bdf[_0x3e5e('0x86')][_0x3e5e('0x9e')]||0xa),'interval':_0x3e5e('0x98')});}if(!_0x543bdf['interaction'][_0x3e5e('0x9f')])return;return db[_0x3e5e('0xa0')][_0x3e5e('0x5c')]({'attributes':['id',_0x3e5e('0x3c')],'where':{'id':_0x543bdf['interaction'][_0x3e5e('0x9f')]}});})[_0x3e5e('0x21')](function(_0x55edbf){if(_0x55edbf){_0x543bdf[_0x3e5e('0x87')][_0x3e5e('0xa1')]({'id':0x0,'priority':0x1,'app':_0x3e5e('0xa2'),'appdata':_0x55edbf['name']+','+(_0x543bdf[_0x3e5e('0x86')][_0x3e5e('0xa3')]||0x12c),'interval':_0x3e5e('0x98')});}return respondWithRpcPromise('Start',_0x3e5e('0xa4'),_0x543bdf);})[_0x3e5e('0x21')](function(_0x33b916){respondWithRpcPromise('EventManager',_0x3e5e('0xa5'),{'event':'notify','message':_0x33b916},client9002);return _0x33b916;})[_0x3e5e('0x21')](respondWithResult(_0xe144cf,null))[_0x3e5e('0x2b')](handleError(_0xe144cf,null));};exports[_0x3e5e('0xa6')]=function(_0x2b6261,_0x30ce40){var _0x51985a=_0x2b6261[_0x3e5e('0x5a')]['id'];var _0x48a6d2=_0x2b6261['body'];var _0xd1c6e7=0xc8;var _0x5e50b1=null;return db[_0x3e5e('0xa7')]['transaction']({'isolationLevel':db[_0x3e5e('0xa7')][_0x3e5e('0xa8')][_0x3e5e('0xa9')][_0x3e5e('0xaa')]},function(_0x1d1ac8){return db['OpenchannelAccount'][_0x3e5e('0xab')]({'where':{'id':_0x51985a},'transaction':_0x1d1ac8})['then'](function(_0x186de2){if(_0x186de2){return db[_0x3e5e('0x84')][_0x3e5e('0x39')]({'where':{'OpenchannelAccountId':_0x51985a},'transaction':_0x1d1ac8})['then'](function(){var _0xd969a2=_[_0x3e5e('0x45')](_0x48a6d2,function(_0x516aaa){_0x516aaa[_0x3e5e('0x67')]=_0x51985a;return _0x516aaa;});return db[_0x3e5e('0x84')][_0x3e5e('0xac')](_0xd969a2,{'transaction':_0x1d1ac8});});}else{_0xd1c6e7=0x194;_0x5e50b1=[];}});})['then'](function(){if(_0xd1c6e7!==0x194){return db[_0x3e5e('0x84')][_0x3e5e('0xad')]({'where':{'OpenchannelAccountId':_0x51985a},'order':_0x3e5e('0xae')})['then'](function(_0x399732){_0x5e50b1=_0x399732;});}})[_0x3e5e('0x2b')](function(_0x133fa6){_0xd1c6e7=0x1f4;logger[_0x3e5e('0x28')](_0x133fa6[_0x3e5e('0xaf')]);if(_0x133fa6['name']){delete _0x133fa6[_0x3e5e('0x3c')];}_0x5e50b1=_0x133fa6;})[_0x3e5e('0xb0')](function(){if(_0x5e50b1===null){_0x30ce40[_0x3e5e('0x2c')](_0xd1c6e7);}else{if(_0xd1c6e7===0x1f4){_0x30ce40[_0x3e5e('0x2d')](_0xd1c6e7)['send'](_0x5e50b1);}else{_0x30ce40[_0x3e5e('0x2d')](_0xd1c6e7)['json'](_0x5e50b1);}}});};exports[_0x3e5e('0xb1')]=function(_0x3a054a,_0x5eb920,_0x485176){var _0x4786a6={};var _0x2396c6={};var _0x53949b;var _0x65fe80;return db['OpenchannelAccount'][_0x3e5e('0xab')]({'where':{'id':_0x3a054a[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x5eb920,null))[_0x3e5e('0x21')](function(_0x3dc9f5){if(_0x3dc9f5){_0x53949b=_0x3dc9f5;_0x2396c6[_0x3e5e('0x44')]=_[_0x3e5e('0x46')](db['OpenchannelApplication'][_0x3e5e('0x42')]);_0x2396c6[_0x3e5e('0x48')]=_['keys'](_0x3a054a[_0x3e5e('0x48')]);_0x2396c6[_0x3e5e('0x51')]=_[_0x3e5e('0x47')](_0x2396c6['model'],_0x2396c6[_0x3e5e('0x48')]);_0x4786a6['attributes']=_[_0x3e5e('0x47')](_0x2396c6[_0x3e5e('0x44')],qs['fields'](_0x3a054a['query']['fields']));_0x4786a6[_0x3e5e('0x49')]=_0x4786a6['attributes'][_0x3e5e('0x4b')]?_0x4786a6[_0x3e5e('0x49')]:_0x2396c6[_0x3e5e('0x44')];_0x4786a6[_0x3e5e('0x4e')]=qs['sort'](_0x3a054a[_0x3e5e('0x48')]['sort']);_0x4786a6[_0x3e5e('0x50')]=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x3a054a['query'],_0x2396c6['filters']));if(_0x3a054a[_0x3e5e('0x48')][_0x3e5e('0x53')]){_0x4786a6[_0x3e5e('0x50')]=_[_0x3e5e('0x55')](_0x4786a6[_0x3e5e('0x50')],{'$or':_[_0x3e5e('0x45')](_0x4786a6[_0x3e5e('0x49')],function(_0x2ba401){var _0x6cd7cf={};_0x6cd7cf[_0x2ba401]={'$like':'%'+_0x3a054a['query'][_0x3e5e('0x53')]+'%'};return _0x6cd7cf;})});}_0x4786a6=_[_0x3e5e('0x55')]({},_0x4786a6,_0x3a054a[_0x3e5e('0x56')]);return _0x53949b[_0x3e5e('0xb1')](_0x4786a6);}})['then'](function(_0x5e2d46){if(_0x5e2d46){_0x65fe80=_0x5e2d46[_0x3e5e('0x4b')];if(!_0x3a054a[_0x3e5e('0x48')][_0x3e5e('0x4c')](_0x3e5e('0x4d'))){_0x4786a6['limit']=qs['limit'](_0x3a054a[_0x3e5e('0x48')][_0x3e5e('0x32')]);_0x4786a6[_0x3e5e('0x30')]=qs['offset'](_0x3a054a[_0x3e5e('0x48')][_0x3e5e('0x30')]);}return _0x53949b[_0x3e5e('0xb1')](_0x4786a6);}})[_0x3e5e('0x21')](function(_0x19da48){if(_0x19da48){return _0x19da48?{'count':_0x65fe80,'rows':_0x19da48}:null;}})['then'](respondWithResult(_0x5eb920,null))['catch'](handleError(_0x5eb920,null));};exports[_0x3e5e('0xb2')]=function(_0x51330a,_0xca9d57,_0x1fae3e){var _0x5ef64d={'raw':![],'where':{}};var _0x8659f4={};var _0x15c265={'count':0x0,'rows':[]};return db[_0x3e5e('0x41')][_0x3e5e('0xab')]({'where':{'id':_0x51330a[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0xca9d57,null))[_0x3e5e('0x21')](function(_0x4a06ee){if(_0x4a06ee){_0x8659f4[_0x3e5e('0x44')]=_[_0x3e5e('0x46')](db['OpenchannelInteraction'][_0x3e5e('0x42')]);_0x8659f4[_0x3e5e('0x48')]=_[_0x3e5e('0x46')](_0x51330a[_0x3e5e('0x48')]);_0x8659f4[_0x3e5e('0x51')]=_[_0x3e5e('0x47')](_0x8659f4['model'],_0x8659f4[_0x3e5e('0x48')]);_0x5ef64d[_0x3e5e('0x49')]=_[_0x3e5e('0x47')](_0x8659f4[_0x3e5e('0x44')],qs[_0x3e5e('0x4a')](_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x4a')]));_0x5ef64d[_0x3e5e('0x49')]=_0x5ef64d['attributes'][_0x3e5e('0x4b')]?_0x5ef64d[_0x3e5e('0x49')]:_0x8659f4[_0x3e5e('0x44')];if(!_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x4c')](_0x3e5e('0x4d'))){_0x5ef64d['limit']=qs[_0x3e5e('0x32')](_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x32')]);_0x5ef64d[_0x3e5e('0x30')]=qs[_0x3e5e('0x30')](_0x51330a['query']['offset']);}_0x5ef64d[_0x3e5e('0x4e')]=qs[_0x3e5e('0x4f')](_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x4f')]);_0x5ef64d[_0x3e5e('0x50')]=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x51330a[_0x3e5e('0x48')],_0x8659f4[_0x3e5e('0x51')]));_0x5ef64d[_0x3e5e('0x50')][_0x3e5e('0x67')]=_0x4a06ee['id'];if(_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x53')]){_0x5ef64d[_0x3e5e('0x50')]=_[_0x3e5e('0x55')](_0x5ef64d['where'],{'$or':_[_0x3e5e('0x45')](_0x5ef64d['attributes'],function(_0x529538){var _0x24d676={};_0x24d676[_0x529538]={'$like':'%'+_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x53')]+'%'};return _0x24d676;})});}_0x5ef64d=_[_0x3e5e('0x55')]({},_0x5ef64d,_0x51330a['options']);return db[_0x3e5e('0x8e')][_0x3e5e('0x33')]({'where':_0x5ef64d[_0x3e5e('0x50')]})[_0x3e5e('0x21')](function(_0x3be886){_0x15c265[_0x3e5e('0x33')]=_0x3be886;if(_0x51330a[_0x3e5e('0x48')][_0x3e5e('0x5b')]){_0x5ef64d[_0x3e5e('0x57')]=[{'model':db[_0x3e5e('0x71')],'as':_0x3e5e('0xb3'),'required':![]},{'model':db['User'],'as':_0x3e5e('0xb4'),'attributes':[_0x3e5e('0x3c'),_0x3e5e('0xb5'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3e5e('0xb6'),'attributes':['id','name',_0x3e5e('0xb7')],'where':_0x51330a['query'][_0x3e5e('0xb8')]?{'id':_0x51330a[_0x3e5e('0x48')][_0x3e5e('0xb8')]}:undefined,'required':_0x51330a[_0x3e5e('0x48')][_0x3e5e('0xb8')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x3e5e('0x6a')](_0x5ef64d);})[_0x3e5e('0x21')](function(_0x42490b){_0x15c265[_0x3e5e('0x58')]=_0x42490b;return _0x15c265;});}})[_0x3e5e('0x21')](respondWithFilteredResult(_0xca9d57,_0x5ef64d))[_0x3e5e('0x2b')](handleError(_0xca9d57,null));};exports['addAgents']=function(_0x35b604,_0xdd867,_0x2a2924){return db['OpenchannelAccount'][_0x3e5e('0x5c')]({'where':{'id':_0x35b604[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0xdd867,null))[_0x3e5e('0x21')](function(_0x2652c5){if(_0x2652c5){return _0x2652c5['addAgents'](_0x35b604[_0x3e5e('0x5e')]['ids'],_[_0x3e5e('0xb9')](_0x35b604[_0x3e5e('0x5e')],['ids','id'])||{})[_0x3e5e('0x90')](function(_0x23c6e6){for(var _0x341573=0x0;_0x341573<_0x35b604[_0x3e5e('0x5e')][_0x3e5e('0x6c')]['length'];_0x341573+=0x1){socket[_0x3e5e('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0x35b604[_0x3e5e('0x5e')][_0x3e5e('0x6c')][_0x341573]),'OpenchannelAccountId':Number(_0x35b604[_0x3e5e('0x5a')]['id'])});}return _0x23c6e6;});}})[_0x3e5e('0x21')](respondWithResult(_0xdd867,null))['catch'](handleError(_0xdd867,null));};exports[_0x3e5e('0xbb')]=function(_0x43b3b6,_0x1a41f8,_0x480b3b){return db[_0x3e5e('0x41')][_0x3e5e('0x5c')]({'where':{'id':_0x43b3b6[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x1a41f8,null))[_0x3e5e('0x21')](function(_0x32e3e3){if(_0x32e3e3){return _0x32e3e3[_0x3e5e('0xbb')](_0x43b3b6[_0x3e5e('0x48')][_0x3e5e('0x6c')])[_0x3e5e('0x21')](function(){if(_[_0x3e5e('0xbc')](_0x43b3b6['query'][_0x3e5e('0x6c')])){for(var _0x134627=0x0;_0x134627<_0x43b3b6[_0x3e5e('0x48')][_0x3e5e('0x6c')]['length'];_0x134627+=0x1){socket[_0x3e5e('0xba')](_0x3e5e('0xbd'),{'UserId':Number(_0x43b3b6['query'][_0x3e5e('0x6c')][_0x134627]),'OpenchannelAccountId':Number(_0x43b3b6['params']['id'])});}}else{socket[_0x3e5e('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x43b3b6[_0x3e5e('0x48')]['ids']),'OpenchannelAccountId':Number(_0x43b3b6[_0x3e5e('0x5a')]['id'])});}});}})[_0x3e5e('0x21')](respondWithStatusCode(_0x1a41f8,null))[_0x3e5e('0x2b')](handleError(_0x1a41f8,null));};exports[_0x3e5e('0xbe')]=function(_0x31285f,_0x495c33,_0x1fa048){var _0x8ce27c={};var _0xe5754c={};var _0x4c56a7;var _0x37278d;return db[_0x3e5e('0x41')][_0x3e5e('0xab')]({'where':{'id':_0x31285f[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x495c33,null))[_0x3e5e('0x21')](function(_0x23dba2){if(_0x23dba2){_0x4c56a7=_0x23dba2;_0xe5754c[_0x3e5e('0x44')]=_[_0x3e5e('0x46')](db[_0x3e5e('0x9c')][_0x3e5e('0x42')]);_0xe5754c['query']=_['keys'](_0x31285f[_0x3e5e('0x48')]);_0xe5754c[_0x3e5e('0x51')]=_['intersection'](_0xe5754c['model'],_0xe5754c['query']);_0x8ce27c[_0x3e5e('0x49')]=_[_0x3e5e('0x47')](_0xe5754c[_0x3e5e('0x44')],qs['fields'](_0x31285f[_0x3e5e('0x48')]['fields']));_0x8ce27c[_0x3e5e('0x49')]=_0x8ce27c[_0x3e5e('0x49')][_0x3e5e('0x4b')]?_0x8ce27c[_0x3e5e('0x49')]:_0xe5754c[_0x3e5e('0x44')];_0x8ce27c[_0x3e5e('0x4e')]=qs['sort'](_0x31285f[_0x3e5e('0x48')]['sort']);_0x8ce27c['where']=qs[_0x3e5e('0x51')](_[_0x3e5e('0x52')](_0x31285f[_0x3e5e('0x48')],_0xe5754c[_0x3e5e('0x51')]));if(_0x31285f['query'][_0x3e5e('0x53')]){_0x8ce27c[_0x3e5e('0x50')]=_[_0x3e5e('0x55')](_0x8ce27c['where'],{'$or':_[_0x3e5e('0x45')](_0x8ce27c['attributes'],function(_0x433e93){var _0x2861ff={};_0x2861ff[_0x433e93]={'$like':'%'+_0x31285f['query']['filter']+'%'};return _0x2861ff;})});}_0x8ce27c=_[_0x3e5e('0x55')]({},_0x8ce27c,_0x31285f[_0x3e5e('0x56')]);return _0x4c56a7[_0x3e5e('0xbe')](_0x8ce27c);}})['then'](function(_0x53a861){if(_0x53a861){_0x37278d=_0x53a861[_0x3e5e('0x4b')];if(!_0x31285f[_0x3e5e('0x48')]['hasOwnProperty']('nolimit')){_0x8ce27c[_0x3e5e('0x32')]=qs[_0x3e5e('0x32')](_0x31285f[_0x3e5e('0x48')][_0x3e5e('0x32')]);_0x8ce27c[_0x3e5e('0x30')]=qs[_0x3e5e('0x30')](_0x31285f[_0x3e5e('0x48')][_0x3e5e('0x30')]);}return _0x4c56a7[_0x3e5e('0xbe')](_0x8ce27c);}})[_0x3e5e('0x21')](function(_0x36d9b0){if(_0x36d9b0){return _0x36d9b0?{'count':_0x37278d,'rows':_0x36d9b0}:null;}})['then'](respondWithResult(_0x495c33,null))[_0x3e5e('0x2b')](handleError(_0x495c33,null));};exports[_0x3e5e('0x3d')]=function(_0x32006c,_0x38be86,_0x2b03c8){var _0x158e5d,_0x551004,_0x3a048e;if(_[_0x3e5e('0x7a')](_0x32006c[_0x3e5e('0x5e')][_0x3e5e('0x5e')])||_0x32006c[_0x3e5e('0x5e')][_0x3e5e('0x5e')]===''){throw new db[(_0x3e5e('0x72'))][(_0x3e5e('0x73'))](_0x3e5e('0x7d'));}if(_['isNil'](_0x32006c[_0x3e5e('0x5e')]['to'])){}_0x158e5d=_0x32006c[_0x3e5e('0x5e')]['to'];return db[_0x3e5e('0x41')][_0x3e5e('0xab')]({'where':{'id':_0x32006c[_0x3e5e('0x5a')]['id']}})[_0x3e5e('0x21')](handleEntityNotFound(_0x38be86,null))[_0x3e5e('0x21')](function(_0x3a83f0){if(_0x3a83f0){return db['OpenchannelAccount'][_0x3e5e('0x5c')]({'where':{'id':_0x3a83f0['id']},'include':[{'model':db[_0x3e5e('0x81')],'as':'List','include':[{'model':db[_0x3e5e('0x71')],'as':'Contacts','where':{[_0x3a83f0[_0x3e5e('0x7e')]]:_0x158e5d},'limit':0x1,'order':[[_0x3e5e('0x77'),_0x3e5e('0xbf')]]}]}]})[_0x3e5e('0x21')](handleEntityNotFound(_0x38be86,null))[_0x3e5e('0x21')](function(_0x428227){if(_0x428227&&_0x428227[_0x3e5e('0x82')]){_0x551004=_0x428227['get']({'plain':!![]});if(_0x551004['List']&&_0x551004[_0x3e5e('0x82')]['Contacts'][_0x3e5e('0x4b')]){return _0x551004[_0x3e5e('0x82')][_0x3e5e('0x83')][0x0];}return db[_0x3e5e('0x71')][_0x3e5e('0x5d')](_[_0x3e5e('0x18')](_0x32006c[_0x3e5e('0x5e')],{'firstName':_0x158e5d,[_0x428227[_0x3e5e('0x7e')]]:_0x158e5d,'phone':_0x158e5d,'ListId':_0x551004[_0x3e5e('0x79')]}));}})['then'](handleEntityNotFound(_0x38be86,null))[_0x3e5e('0x21')](function(_0x6029ae){if(_0x6029ae){_0x3a048e=_0x6029ae;return db[_0x3e5e('0x8e')]['find']({'where':{'ContactId':_0x3a048e['id'],'closed':![],'OpenchannelAccountId':_0x551004['id']}})[_0x3e5e('0x21')](function(_0x3cfff9){if(_0x3cfff9){return[_0x3cfff9,![]];}return db['OpenchannelInteraction'][_0x3e5e('0x5d')]({'UserId':_0x32006c['user']['id'],'ContactId':_0x3a048e['id'],'OpenchannelAccountId':_0x551004['id'],'lastMsgDirection':_0x3e5e('0xc0'),'firstMsgDirection':_0x3e5e('0xc0'),'Messages':[_[_0x3e5e('0x55')](_0x32006c['body'],{'read':![],'body':_0x32006c[_0x3e5e('0x5e')][_0x3e5e('0x5e')],'OpenchannelAccountId':_0x551004['id'],'UserId':_0x32006c[_0x3e5e('0x61')]['id'],'ContactId':_0x3a048e['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x3e5e('0x21')](function(_0x33eb43){return[_0x33eb43,!![]];});});}})[_0x3e5e('0x90')](function(_0x47e714,_0xd9df5f){if(_0xd9df5f){return _0x47e714;}return db[_0x3e5e('0x99')][_0x3e5e('0x5d')](_['merge'](_0x32006c[_0x3e5e('0x5e')],{'read':![],'body':_0x32006c[_0x3e5e('0x5e')]['body'],'OpenchannelAccountId':_0x551004['id'],'OpenchannelInteractionId':_0x47e714['id'],'UserId':_0x32006c[_0x3e5e('0x61')]['id'],'ContactId':_0x3a048e['id']}))[_0x3e5e('0x21')](function(_0x4116ab){_0x47e714[_0x3e5e('0xc1')]['Messages']=[];_0x47e714['dataValues'][_0x3e5e('0xc2')][_0x3e5e('0x96')](_0x4116ab[_0x3e5e('0xc1')]);return _0x47e714;});});}})[_0x3e5e('0x21')](respondWithResult(_0x38be86,null))[_0x3e5e('0x2b')](handleError(_0x38be86,null));}; \ No newline at end of file +var _0xaf1b=['removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','Contacts','DESC','OpenchannelApplication','List','account','Applications','list','applications','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','*,*,*,*','AttachmentId','User','UserId','unshift','agent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','map'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x17bde3,_0x2c17bd){_0x17bde3=_0x17bde3-0x0;var _0x2046f1=_0xaf1b[_0x17bde3];return _0x2046f1;};'use strict';var emlformat=require(_0xbaf1('0x0'));var rimraf=require(_0xbaf1('0x1'));var zipdir=require(_0xbaf1('0x2'));var jsonpatch=require(_0xbaf1('0x3'));var rp=require(_0xbaf1('0x4'));var moment=require(_0xbaf1('0x5'));var BPromise=require(_0xbaf1('0x6'));var Mustache=require(_0xbaf1('0x7'));var util=require(_0xbaf1('0x8'));var path=require(_0xbaf1('0x9'));var sox=require(_0xbaf1('0xa'));var csv=require(_0xbaf1('0xb'));var ejs=require(_0xbaf1('0xc'));var fs=require('fs');var fs_extra=require(_0xbaf1('0xd'));var _=require('lodash');var squel=require(_0xbaf1('0xe'));var crypto=require('crypto');var jsforce=require(_0xbaf1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbaf1('0xb'));var querystring=require(_0xbaf1('0x10'));var Papa=require(_0xbaf1('0x11'));var Redis=require('ioredis');var authService=require(_0xbaf1('0x12'));var qs=require(_0xbaf1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaf1('0x14'));var logger=require('../../config/logger')(_0xbaf1('0x15'));var utils=require(_0xbaf1('0x16'));var config=require(_0xbaf1('0x17'));var licenseUtil=require(_0xbaf1('0x18'));var db=require(_0xbaf1('0x19'))['db'];config[_0xbaf1('0x1a')]=_['defaults'](config['redis'],{'host':_0xbaf1('0x1b'),'port':0x18eb});var socket=require(_0xbaf1('0x1c'))(new Redis(config[_0xbaf1('0x1a')]));require(_0xbaf1('0x1d'))[_0xbaf1('0x1e')](socket);var jayson=require(_0xbaf1('0x1f'));var client=jayson[_0xbaf1('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xbaf1('0x20')][_0xbaf1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb9ac72,_0x342c11,_0x305c91,_0x25458f){return new BPromise(function(_0x199252,_0x18b8aa){var _0x58d217=_0x25458f||client;return _0x58d217[_0xbaf1('0x22')](_0xb9ac72,_0x305c91)['then'](function(_0xfee892){logger[_0xbaf1('0x23')](_0xbaf1('0x24'),_0x342c11,_0xbaf1('0x25'));logger['debug'](_0xbaf1('0x26'),_0x342c11,'request\x20sent',JSON[_0xbaf1('0x27')](_0xfee892));if(_0xfee892[_0xbaf1('0x28')]){if(_0xfee892['error'][_0xbaf1('0x29')]===0x1f4){logger[_0xbaf1('0x28')](_0xbaf1('0x24'),_0x342c11,_0xfee892[_0xbaf1('0x28')][_0xbaf1('0x2a')]);return _0x18b8aa(_0xfee892[_0xbaf1('0x28')]['message']);}logger['error'](_0xbaf1('0x24'),_0x342c11,_0xfee892[_0xbaf1('0x28')][_0xbaf1('0x2a')]);return _0x199252(_0xfee892['error'][_0xbaf1('0x2a')]);}else{logger[_0xbaf1('0x23')](_0xbaf1('0x24'),_0x342c11,'request\x20sent');_0x199252(_0xfee892[_0xbaf1('0x2b')]['message']);}})[_0xbaf1('0x2c')](function(_0x181c9d){logger[_0xbaf1('0x28')](_0xbaf1('0x24'),_0x342c11,_0x181c9d);_0x18b8aa(_0x181c9d);});});}function respondWithStatusCode(_0x18bdb6,_0x480835){_0x480835=_0x480835||0xcc;return function(_0x5d13d4){if(_0x5d13d4){return _0x18bdb6[_0xbaf1('0x2d')](_0x480835);}return _0x18bdb6[_0xbaf1('0x2e')](_0x480835)[_0xbaf1('0x2f')]();};}function respondWithResult(_0x1bba2c,_0x4f202f){_0x4f202f=_0x4f202f||0xc8;return function(_0xa313ec){if(_0xa313ec){return _0x1bba2c['status'](_0x4f202f)[_0xbaf1('0x30')](_0xa313ec);}};}function respondWithFilteredResult(_0x23d96a,_0x35fdc){return function(_0x17f2ea){if(_0x17f2ea){var _0x2ccd80=typeof _0x35fdc[_0xbaf1('0x31')]===_0xbaf1('0x32')&&typeof _0x35fdc['limit']===_0xbaf1('0x32');var _0xbf1154=_0x17f2ea[_0xbaf1('0x33')];var _0x29f528=_0x2ccd80?0x0:_0x35fdc[_0xbaf1('0x31')];var _0x19d08f=_0x2ccd80?_0x17f2ea[_0xbaf1('0x33')]:_0x35fdc[_0xbaf1('0x31')]+_0x35fdc['limit'];var _0x467aca;if(_0x19d08f>=_0xbf1154){_0x19d08f=_0xbf1154;_0x467aca=0xc8;}else{_0x467aca=0xce;}_0x23d96a[_0xbaf1('0x2e')](_0x467aca);return _0x23d96a[_0xbaf1('0x34')](_0xbaf1('0x35'),_0x29f528+'-'+_0x19d08f+'/'+_0xbf1154)['json'](_0x17f2ea);}return null;};}function patchUpdates(_0x19976c){return function(_0x533cdd){try{jsonpatch[_0xbaf1('0x36')](_0x533cdd,_0x19976c,!![]);}catch(_0x582f19){return BPromise[_0xbaf1('0x37')](_0x582f19);}return _0x533cdd[_0xbaf1('0x38')]();};}function saveUpdates(_0x3546b7,_0x3ae641){return function(_0x4a150e){if(_0x4a150e){return _0x4a150e[_0xbaf1('0x39')](_0x3546b7)[_0xbaf1('0x3a')](function(_0x40eccd){return _0x40eccd;});}return null;};}function removeEntity(_0x204888,_0x40e328){return function(_0x1483e8){if(_0x1483e8){return _0x1483e8[_0xbaf1('0x3b')]()['then'](function(){var _0xfe738f=_0x1483e8[_0xbaf1('0x3c')]({'plain':!![]});var _0x1278e6=_0xbaf1('0x3d');return db[_0xbaf1('0x3e')][_0xbaf1('0x3b')]({'where':{'type':_0x1278e6,'resourceId':_0xfe738f['id']}})[_0xbaf1('0x3a')](function(){return _0x1483e8;});})['then'](function(){_0x204888[_0xbaf1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363ecf,_0xcd28ce){return function(_0x3889b3){if(!_0x3889b3){_0x363ecf[_0xbaf1('0x2d')](0x194);}return _0x3889b3;};}function handleError(_0x2a1486,_0x5c9fd4){_0x5c9fd4=_0x5c9fd4||0x1f4;return function(_0x9bf5c0){logger[_0xbaf1('0x28')](_0x9bf5c0[_0xbaf1('0x3f')]);if(_0x9bf5c0['name']){delete _0x9bf5c0['name'];}_0x2a1486['status'](_0x5c9fd4)[_0xbaf1('0x40')](_0x9bf5c0);};}exports[_0xbaf1('0x41')]=function(_0x49e0cb,_0x2adc26){var _0x40da9d={'include':[{'model':db[_0xbaf1('0x42')],'as':_0xbaf1('0x43')}]},_0x31475a={},_0x49dc0b={'count':0x0,'rows':[]};var _0x3d2302=_['map'](db[_0xbaf1('0x44')][_0xbaf1('0x45')],function(_0x52775b){return{'name':_0x52775b['fieldName'],'type':_0x52775b[_0xbaf1('0x46')]['key']};});_0x31475a['model']=_['map'](_0x3d2302,_0xbaf1('0x47'));_0x31475a[_0xbaf1('0x48')]=_[_0xbaf1('0x49')](_0x49e0cb[_0xbaf1('0x48')]);_0x31475a[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x31475a[_0xbaf1('0x4c')],_0x31475a[_0xbaf1('0x48')]);_0x40da9d['attributes']=_[_0xbaf1('0x4b')](_0x31475a[_0xbaf1('0x4c')],qs[_0xbaf1('0x4d')](_0x49e0cb[_0xbaf1('0x48')]['fields']));_0x40da9d[_0xbaf1('0x4e')]=_0x40da9d['attributes'][_0xbaf1('0x4f')]?_0x40da9d[_0xbaf1('0x4e')]:_0x31475a[_0xbaf1('0x4c')];if(!_0x49e0cb['query'][_0xbaf1('0x50')](_0xbaf1('0x51'))){_0x40da9d[_0xbaf1('0x52')]=qs['limit'](_0x49e0cb[_0xbaf1('0x48')]['limit']);_0x40da9d['offset']=qs['offset'](_0x49e0cb[_0xbaf1('0x48')][_0xbaf1('0x31')]);}_0x40da9d[_0xbaf1('0x53')]=qs[_0xbaf1('0x54')](_0x49e0cb[_0xbaf1('0x48')][_0xbaf1('0x54')]);_0x40da9d['where']=qs[_0xbaf1('0x4a')](_[_0xbaf1('0x55')](_0x49e0cb[_0xbaf1('0x48')],_0x31475a[_0xbaf1('0x4a')]),_0x3d2302);if(_0x49e0cb[_0xbaf1('0x48')][_0xbaf1('0x56')]){_0x40da9d['where']=_[_0xbaf1('0x57')](_0x40da9d['where'],{'$or':_['map'](_0x3d2302,function(_0x300f67){if(_0x300f67[_0xbaf1('0x46')]!==_0xbaf1('0x58')){var _0x43a8a1={};_0x43a8a1[_0x300f67[_0xbaf1('0x47')]]={'$like':'%'+_0x49e0cb['query'][_0xbaf1('0x56')]+'%'};return _0x43a8a1;}})});}_0x40da9d=_['merge']({},_0x40da9d,_0x49e0cb[_0xbaf1('0x59')]);var _0x3f3b0d={'where':_0x40da9d[_0xbaf1('0x5a')]};return db[_0xbaf1('0x44')][_0xbaf1('0x33')](_0x3f3b0d)[_0xbaf1('0x3a')](function(_0x2fc4a9){_0x49dc0b[_0xbaf1('0x33')]=_0x2fc4a9;if(_0x49e0cb[_0xbaf1('0x48')][_0xbaf1('0x5b')]){_0x40da9d[_0xbaf1('0x5c')]=[{'all':!![]}];}return db[_0xbaf1('0x44')][_0xbaf1('0x5d')](_0x40da9d);})[_0xbaf1('0x3a')](function(_0x364309){_0x49dc0b[_0xbaf1('0x5e')]=_0x364309;return _0x49dc0b;})['then'](respondWithFilteredResult(_0x2adc26,_0x40da9d))[_0xbaf1('0x2c')](handleError(_0x2adc26,null));};exports[_0xbaf1('0x5f')]=function(_0x1715a3,_0x1de5f3){var _0x55aa1e={'raw':![],'where':{'id':_0x1715a3[_0xbaf1('0x60')]['id']},'include':[{'model':db[_0xbaf1('0x42')],'as':_0xbaf1('0x43')}]},_0x7117bf={};_0x7117bf[_0xbaf1('0x4c')]=_[_0xbaf1('0x49')](db['OpenchannelAccount'][_0xbaf1('0x45')]);_0x7117bf[_0xbaf1('0x48')]=_[_0xbaf1('0x49')](_0x1715a3[_0xbaf1('0x48')]);_0x7117bf[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x7117bf['model'],_0x7117bf[_0xbaf1('0x48')]);_0x55aa1e['attributes']=_[_0xbaf1('0x4b')](_0x7117bf[_0xbaf1('0x4c')],qs[_0xbaf1('0x4d')](_0x1715a3[_0xbaf1('0x48')][_0xbaf1('0x4d')]));_0x55aa1e[_0xbaf1('0x4e')]=_0x55aa1e[_0xbaf1('0x4e')][_0xbaf1('0x4f')]?_0x55aa1e[_0xbaf1('0x4e')]:_0x7117bf[_0xbaf1('0x4c')];if(_0x1715a3[_0xbaf1('0x48')]['includeAll']){_0x55aa1e[_0xbaf1('0x5c')]=[{'all':!![]}];}_0x55aa1e=_['merge']({},_0x55aa1e,_0x1715a3['options']);return db['OpenchannelAccount'][_0xbaf1('0x61')](_0x55aa1e)['then'](handleEntityNotFound(_0x1de5f3,null))['then'](respondWithResult(_0x1de5f3,null))[_0xbaf1('0x2c')](handleError(_0x1de5f3,null));};exports[_0xbaf1('0x62')]=function(_0x4cc1bc,_0xdacb07){return db[_0xbaf1('0x44')][_0xbaf1('0x62')](_0x4cc1bc[_0xbaf1('0x63')],{})[_0xbaf1('0x3a')](function(_0x291e0d){var _0x1784d8=_0x4cc1bc[_0xbaf1('0x64')][_0xbaf1('0x3c')]({'plain':!![]});if(!_0x1784d8)throw new Error(_0xbaf1('0x65'));if(_0x1784d8['role']===_0xbaf1('0x64')){var _0x51129a=_0x291e0d[_0xbaf1('0x3c')]({'plain':!![]});var _0x53ba22=_0xbaf1('0x3d');return db[_0xbaf1('0x66')][_0xbaf1('0x61')]({'where':{'name':_0x53ba22,'userProfileId':_0x1784d8[_0xbaf1('0x67')]},'raw':!![]})[_0xbaf1('0x3a')](function(_0x1026b2){if(_0x1026b2&&_0x1026b2[_0xbaf1('0x68')]===0x0){return db[_0xbaf1('0x3e')][_0xbaf1('0x62')]({'name':_0x51129a[_0xbaf1('0x47')],'resourceId':_0x51129a['id'],'type':_0x1026b2[_0xbaf1('0x47')],'sectionId':_0x1026b2['id']},{})['then'](function(){return _0x291e0d;});}else{return _0x291e0d;}})[_0xbaf1('0x2c')](function(_0x4e42b0){logger[_0xbaf1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e42b0);throw _0x4e42b0;});}return _0x291e0d;})[_0xbaf1('0x3a')](respondWithResult(_0xdacb07,0xc9))[_0xbaf1('0x2c')](handleError(_0xdacb07,null));};exports[_0xbaf1('0x39')]=function(_0x26bccd,_0x243ddf){if(_0x26bccd['body']['id']){delete _0x26bccd[_0xbaf1('0x63')]['id'];}return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x26bccd['params']['id']},'include':[{'model':db[_0xbaf1('0x42')],'as':_0xbaf1('0x43')}]})[_0xbaf1('0x3a')](handleEntityNotFound(_0x243ddf,null))[_0xbaf1('0x3a')](saveUpdates(_0x26bccd[_0xbaf1('0x63')],null))[_0xbaf1('0x3a')](respondWithResult(_0x243ddf,null))['catch'](handleError(_0x243ddf,null));};exports[_0xbaf1('0x3b')]=function(_0x2d19d0,_0x3e80a9){return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x2d19d0[_0xbaf1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e80a9,null))[_0xbaf1('0x3a')](removeEntity(_0x3e80a9,null))[_0xbaf1('0x2c')](handleError(_0x3e80a9,null));};exports[_0xbaf1('0x69')]=function(_0x5d4825,_0x54b317){return db[_0xbaf1('0x44')][_0xbaf1('0x69')]()[_0xbaf1('0x3a')](respondWithResult(_0x54b317,null))['catch'](handleError(_0x54b317,null));};exports[_0xbaf1('0x6a')]=function(_0x3fea6e,_0x3ea68b,_0x3c5952){if(_0x3fea6e[_0xbaf1('0x63')]['id']){delete _0x3fea6e['body']['id'];}return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x3fea6e[_0xbaf1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3ea68b,null))['then'](function(_0x41a25f){if(_0x41a25f){_0x3fea6e[_0xbaf1('0x63')][_0xbaf1('0x6b')]=_0x41a25f['id'];return db['Disposition'][_0xbaf1('0x62')](_0x3fea6e[_0xbaf1('0x63')]);}})[_0xbaf1('0x3a')](respondWithResult(_0x3ea68b,null))['catch'](handleError(_0x3ea68b,null));};exports[_0xbaf1('0x6c')]=function(_0x41afbd,_0x50e9dd,_0x4b6b38){var _0x2a48bb={'raw':![],'where':{}};var _0x17a39f={};var _0x5d0909={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xbaf1('0x6d')]({'where':{'id':_0x41afbd['params']['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x50e9dd,null))[_0xbaf1('0x3a')](function(_0x1d12da){if(_0x1d12da){_0x17a39f[_0xbaf1('0x4c')]=_[_0xbaf1('0x49')](db[_0xbaf1('0x6e')][_0xbaf1('0x45')]);_0x17a39f['query']=_['keys'](_0x41afbd['query']);_0x17a39f[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x17a39f[_0xbaf1('0x4c')],_0x17a39f['query']);_0x2a48bb[_0xbaf1('0x4e')]=_[_0xbaf1('0x4b')](_0x17a39f[_0xbaf1('0x4c')],qs[_0xbaf1('0x4d')](_0x41afbd['query'][_0xbaf1('0x4d')]));_0x2a48bb[_0xbaf1('0x4e')]=_0x2a48bb[_0xbaf1('0x4e')][_0xbaf1('0x4f')]?_0x2a48bb[_0xbaf1('0x4e')]:_0x17a39f['model'];if(!_0x41afbd['query']['hasOwnProperty'](_0xbaf1('0x51'))){_0x2a48bb[_0xbaf1('0x52')]=qs['limit'](_0x41afbd[_0xbaf1('0x48')]['limit']);_0x2a48bb[_0xbaf1('0x31')]=qs['offset'](_0x41afbd[_0xbaf1('0x48')][_0xbaf1('0x31')]);}_0x2a48bb['order']=qs[_0xbaf1('0x54')](_0x41afbd[_0xbaf1('0x48')][_0xbaf1('0x54')]);_0x2a48bb[_0xbaf1('0x5a')]=qs[_0xbaf1('0x4a')](_['pick'](_0x41afbd[_0xbaf1('0x48')],_0x17a39f[_0xbaf1('0x4a')]));_0x2a48bb['where'][_0xbaf1('0x6b')]=_0x1d12da['id'];if(_0x41afbd[_0xbaf1('0x48')]['filter']){_0x2a48bb[_0xbaf1('0x5a')]=_[_0xbaf1('0x57')](_0x2a48bb[_0xbaf1('0x5a')],{'$or':_[_0xbaf1('0x6f')](_0x2a48bb[_0xbaf1('0x4e')],function(_0xf389f){var _0x8e0399={};_0x8e0399[_0xf389f]={'$like':'%'+_0x41afbd[_0xbaf1('0x48')][_0xbaf1('0x56')]+'%'};return _0x8e0399;})});}_0x2a48bb=_[_0xbaf1('0x57')]({},_0x2a48bb,_0x41afbd[_0xbaf1('0x59')]);return db[_0xbaf1('0x6e')]['count']({'where':_0x2a48bb[_0xbaf1('0x5a')]})['then'](function(_0x9799e9){_0x5d0909[_0xbaf1('0x33')]=_0x9799e9;if(_0x41afbd[_0xbaf1('0x48')][_0xbaf1('0x5b')]){_0x2a48bb[_0xbaf1('0x5c')]=[{'all':!![]}];}return db[_0xbaf1('0x6e')][_0xbaf1('0x5d')](_0x2a48bb);})[_0xbaf1('0x3a')](function(_0x43af79){_0x5d0909['rows']=_0x43af79;return _0x5d0909;});}})[_0xbaf1('0x3a')](respondWithFilteredResult(_0x50e9dd,_0x2a48bb))['catch'](handleError(_0x50e9dd,null));};exports['removeDispositions']=function(_0x40a884,_0x1481b3,_0x345bbe){return db['OpenchannelAccount']['find']({'where':{'id':_0x40a884[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x1481b3,null))['then'](function(_0x451d6c){if(_0x451d6c){return _0x451d6c[_0xbaf1('0x70')](_0x40a884[_0xbaf1('0x48')][_0xbaf1('0x71')]);}})[_0xbaf1('0x3a')](respondWithStatusCode(_0x1481b3,null))['catch'](handleError(_0x1481b3,null));};exports['addAnswer']=function(_0x5e7f4f,_0x516da1,_0x1e1ba0){if(_0x5e7f4f[_0xbaf1('0x63')]['id']){delete _0x5e7f4f[_0xbaf1('0x63')]['id'];}return db[_0xbaf1('0x44')]['find']({'where':{'id':_0x5e7f4f[_0xbaf1('0x60')]['id']}})['then'](handleEntityNotFound(_0x516da1,null))[_0xbaf1('0x3a')](function(_0x537ce3){if(_0x537ce3){_0x5e7f4f[_0xbaf1('0x63')]['OpenchannelAccountId']=_0x537ce3['id'];return db[_0xbaf1('0x72')][_0xbaf1('0x62')](_0x5e7f4f[_0xbaf1('0x63')]);}})[_0xbaf1('0x3a')](respondWithResult(_0x516da1,null))['catch'](handleError(_0x516da1,null));};exports[_0xbaf1('0x73')]=function(_0x12c371,_0x55cd4a,_0x3a712a){var _0x563255={'raw':![],'where':{}};var _0x46d111={};var _0x11ee42={'count':0x0,'rows':[]};return db[_0xbaf1('0x44')][_0xbaf1('0x6d')]({'where':{'id':_0x12c371[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x55cd4a,null))['then'](function(_0x3834dc){if(_0x3834dc){_0x46d111[_0xbaf1('0x4c')]=_[_0xbaf1('0x49')](db['CannedAnswer'][_0xbaf1('0x45')]);_0x46d111[_0xbaf1('0x48')]=_[_0xbaf1('0x49')](_0x12c371[_0xbaf1('0x48')]);_0x46d111[_0xbaf1('0x4a')]=_['intersection'](_0x46d111[_0xbaf1('0x4c')],_0x46d111[_0xbaf1('0x48')]);_0x563255[_0xbaf1('0x4e')]=_[_0xbaf1('0x4b')](_0x46d111['model'],qs[_0xbaf1('0x4d')](_0x12c371['query'][_0xbaf1('0x4d')]));_0x563255[_0xbaf1('0x4e')]=_0x563255['attributes'][_0xbaf1('0x4f')]?_0x563255['attributes']:_0x46d111[_0xbaf1('0x4c')];if(!_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x50')](_0xbaf1('0x51'))){_0x563255[_0xbaf1('0x52')]=qs[_0xbaf1('0x52')](_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x52')]);_0x563255[_0xbaf1('0x31')]=qs['offset'](_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x31')]);}_0x563255[_0xbaf1('0x53')]=qs[_0xbaf1('0x54')](_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x54')]);_0x563255[_0xbaf1('0x5a')]=qs[_0xbaf1('0x4a')](_[_0xbaf1('0x55')](_0x12c371[_0xbaf1('0x48')],_0x46d111[_0xbaf1('0x4a')]));_0x563255[_0xbaf1('0x5a')][_0xbaf1('0x6b')]=_0x3834dc['id'];if(_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x56')]){_0x563255[_0xbaf1('0x5a')]=_[_0xbaf1('0x57')](_0x563255[_0xbaf1('0x5a')],{'$or':_['map'](_0x563255[_0xbaf1('0x4e')],function(_0xd4d82a){var _0x1564f4={};_0x1564f4[_0xd4d82a]={'$like':'%'+_0x12c371[_0xbaf1('0x48')]['filter']+'%'};return _0x1564f4;})});}_0x563255=_[_0xbaf1('0x57')]({},_0x563255,_0x12c371[_0xbaf1('0x59')]);return db[_0xbaf1('0x72')]['count']({'where':_0x563255[_0xbaf1('0x5a')]})[_0xbaf1('0x3a')](function(_0x280f35){_0x11ee42[_0xbaf1('0x33')]=_0x280f35;if(_0x12c371[_0xbaf1('0x48')][_0xbaf1('0x5b')]){_0x563255[_0xbaf1('0x5c')]=[{'all':!![]}];}return db[_0xbaf1('0x72')]['findAll'](_0x563255);})['then'](function(_0x19abdd){_0x11ee42[_0xbaf1('0x5e')]=_0x19abdd;return _0x11ee42;});}})[_0xbaf1('0x3a')](respondWithFilteredResult(_0x55cd4a,_0x563255))['catch'](handleError(_0x55cd4a,null));};exports[_0xbaf1('0x74')]=function(_0x931dfb,_0x1728cf,_0x4afdbe){return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x931dfb[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x1728cf,null))[_0xbaf1('0x3a')](function(_0x1129fd){if(_0x1129fd){return _0x1129fd[_0xbaf1('0x74')](_0x931dfb[_0xbaf1('0x48')][_0xbaf1('0x71')]);}})[_0xbaf1('0x3a')](respondWithStatusCode(_0x1728cf,null))['catch'](handleError(_0x1728cf,null));};exports[_0xbaf1('0x75')]=function(_0x5aefa2,_0x45bc36,_0x41e4e9){var _0x5a53a0={'body':_0x5aefa2[_0xbaf1('0x63')],'channel':'openchannel'};var _0x39009c=[];var _0x5cd66e=[];var _0x565015={};var _0xb8286f=![];return db[_0xbaf1('0x76')][_0xbaf1('0x69')]()[_0xbaf1('0x3a')](function(_0x5f448c){if(!_0x5f448c){throw new db[(_0xbaf1('0x77'))]['ValidationError'](_0xbaf1('0x78'));}_0x39009c=_['difference'](_[_0xbaf1('0x49')](_0x5f448c),[_0xbaf1('0x79'),_0xbaf1('0x7a')]);_0x5cd66e=_['difference'](_[_0xbaf1('0x49')](_0x5f448c),[_0xbaf1('0x79'),_0xbaf1('0x7a'),_0xbaf1('0x7b'),_0xbaf1('0x7c')]);if(_0x5aefa2['body']['id']){delete _0x5aefa2[_0xbaf1('0x63')]['id'];}if(_[_0xbaf1('0x7d')](_0x5aefa2[_0xbaf1('0x63')]['from'])){throw new db[(_0xbaf1('0x77'))][(_0xbaf1('0x7e'))](_0xbaf1('0x7f'));}if(_['isNil'](_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x63')])||_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x63')]===''){throw new db[(_0xbaf1('0x77'))][(_0xbaf1('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbaf1('0x7d')](_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x80')])){throw new db[(_0xbaf1('0x77'))][(_0xbaf1('0x7e'))](_0xbaf1('0x81')+_0x5cd66e);}if(!_[_0xbaf1('0x82')](_0x5cd66e,_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x80')])){throw new db[(_0xbaf1('0x77'))][(_0xbaf1('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cd66e);}_0x565015[_0x5aefa2['body'][_0xbaf1('0x80')]]=_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x83')];})[_0xbaf1('0x3a')](function(){return db[_0xbaf1('0x44')]['find']({'where':{'id':_0x5aefa2[_0xbaf1('0x60')]['id']},'include':[{'model':db[_0xbaf1('0x84')],'as':'List','include':[{'model':db['CmContact'],'as':_0xbaf1('0x85'),'where':_0x565015,'limit':0x1,'order':[[_0xbaf1('0x7a'),_0xbaf1('0x86')]]}]},{'model':db[_0xbaf1('0x87')],'as':'Applications'}]});})[_0xbaf1('0x3a')](handleEntityNotFound(_0x45bc36,null))[_0xbaf1('0x3a')](function(_0x539dd1){if(_0x539dd1&&_0x539dd1[_0xbaf1('0x88')]){_0x5a53a0[_0xbaf1('0x89')]=_0x539dd1;_0x5a53a0['applications']=_0x539dd1[_0xbaf1('0x8a')];_0x5a53a0[_0xbaf1('0x8b')]=_0x539dd1[_0xbaf1('0x88')];_0x5a53a0[_0xbaf1('0x8c')]=_['orderBy'](_0x5a53a0[_0xbaf1('0x8c')],[_0xbaf1('0x8d')],[_0xbaf1('0x8e')]);if(_0x5a53a0[_0xbaf1('0x89')]['Applications']){delete _0x5a53a0[_0xbaf1('0x89')][_0xbaf1('0x8a')];}if(_0x5a53a0['account']['List']&&_0x5a53a0['account'][_0xbaf1('0x88')]['Contacts']['length']){return _0x5a53a0['account'][_0xbaf1('0x88')][_0xbaf1('0x85')][0x0];}var _0x18c786=_[_0xbaf1('0x8f')](_0x5aefa2[_0xbaf1('0x63')],{'firstName':_0x5aefa2[_0xbaf1('0x63')]['from'],'ListId':_0x539dd1[_0xbaf1('0x7c')]});_0x18c786[_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x80')]]=_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x83')];return db[_0xbaf1('0x76')][_0xbaf1('0x62')](_0x18c786,{'fields':_0x39009c,'raw':!![]});}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x45bc36,null))[_0xbaf1('0x3a')](function(_0x13647e){_0x5a53a0[_0xbaf1('0x90')]=_0x13647e;if(_0x13647e){var _0x55827d={'ContactId':_0x13647e['id'],'OpenchannelAccountId':_0x5aefa2[_0xbaf1('0x60')]['id'],'from':(_0x13647e[_0xbaf1('0x91')]||'')+'\x20'+(_0x13647e[_0xbaf1('0x92')]||'')};var _0x561c3a={'OpenchannelAccountId':_0x5aefa2[_0xbaf1('0x60')]['id'],'closed':![]};if(_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x93')]){_0x561c3a[_0xbaf1('0x93')]=_0x5aefa2['body']['threadId'];return db[_0xbaf1('0x94')][_0xbaf1('0x61')]({'where':_0x561c3a})[_0xbaf1('0x3a')](function(_0x3bcf19){if(_0x3bcf19){return[_0x3bcf19,![]];}_0x55827d[_0xbaf1('0x93')]=_0x5aefa2['body']['threadId'];_0x55827d[_0xbaf1('0x95')]=_0x5aefa2[_0xbaf1('0x63')]['externalUrl'];return db['OpenchannelInteraction'][_0xbaf1('0x62')](_0x55827d)['then'](function(_0x572e59){return[_0x572e59,!![]];});});}else{_0x561c3a['threadId']=null;}_0x561c3a[_0xbaf1('0x96')]=_0x13647e['id'];return db[_0xbaf1('0x94')][_0xbaf1('0x61')]({'where':_0x561c3a})[_0xbaf1('0x3a')](function(_0x3aa2fd){if(_0x3aa2fd){return[_0x3aa2fd,![]];}return db[_0xbaf1('0x94')][_0xbaf1('0x62')](_0x55827d)[_0xbaf1('0x3a')](function(_0x536cfb){return[_0x536cfb,!![]];});});}})[_0xbaf1('0x97')](function(_0x8a83b,_0x382dcb){if(_0x8a83b){_0xb8286f=_0x382dcb;if(!_0x382dcb){var _0x53df5d={'from':(_0x5a53a0[_0xbaf1('0x90')][_0xbaf1('0x91')]||'')+'\x20'+(_0x5a53a0['contact'][_0xbaf1('0x92')]||'')};if(_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x93')]&&_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x98')]&&_0x5aefa2[_0xbaf1('0x63')]['threadId']!=_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x98')]){_0x53df5d['threadId']=_0x5aefa2[_0xbaf1('0x63')]['messageId'];}return _0x8a83b[_0xbaf1('0x39')](_0x53df5d);}else{return _0x8a83b;}}})[_0xbaf1('0x3a')](function(_0x5159f3){_0x5a53a0['interaction']=_0x5159f3[_0xbaf1('0x3c')]({'plain':!![]});_0x5a53a0[_0xbaf1('0x99')][_0xbaf1('0x9a')]=_0xb8286f;if(_0x5a53a0[_0xbaf1('0x99')][_0xbaf1('0x9a')]){if(_0x5a53a0[_0xbaf1('0x89')][_0xbaf1('0x9b')]){_0x5a53a0['applications']['push']({'id':0x0,'priority':_0x5a53a0[_0xbaf1('0x8c')][_0xbaf1('0x4f')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xbaf1('0x9c')});}}return db['OpenchannelMessage'][_0xbaf1('0x62')]({'body':_0x5aefa2[_0xbaf1('0x63')][_0xbaf1('0x63')],'OpenchannelAccountId':_0x5aefa2[_0xbaf1('0x60')]['id'],'OpenchannelInteractionId':_0x5159f3['id'],'direction':'in','ContactId':_0x5a53a0[_0xbaf1('0x90')]['id'],'AttachmentId':_0x5aefa2['body'][_0xbaf1('0x9d')]});})[_0xbaf1('0x3a')](function(_0x25977b){_0x5a53a0[_0xbaf1('0x2a')]=_0x25977b;if(!_0x5a53a0[_0xbaf1('0x99')]['UserId'])return;return db[_0xbaf1('0x9e')][_0xbaf1('0x61')]({'attributes':['id',_0xbaf1('0x47')],'where':{'id':_0x5a53a0['interaction'][_0xbaf1('0x9f')]}});})[_0xbaf1('0x3a')](function(_0x334c8f){if(_0x334c8f){_0x5a53a0[_0xbaf1('0x8c')][_0xbaf1('0xa0')]({'id':0x0,'priority':0x0,'app':_0xbaf1('0xa1'),'appdata':_0x334c8f[_0xbaf1('0x47')]+','+(_0x5a53a0[_0xbaf1('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xbaf1('0x9c')});}if(!_0x5a53a0[_0xbaf1('0x99')][_0xbaf1('0xa2')])return;return db[_0xbaf1('0xa3')][_0xbaf1('0x61')]({'attributes':['id',_0xbaf1('0x47')],'where':{'id':_0x5a53a0['interaction'][_0xbaf1('0xa2')]}});})['then'](function(_0x3df463){if(_0x3df463){_0x5a53a0['applications'][_0xbaf1('0xa0')]({'id':0x0,'priority':0x1,'app':_0xbaf1('0xa4'),'appdata':_0x3df463[_0xbaf1('0x47')]+','+(_0x5a53a0[_0xbaf1('0x89')][_0xbaf1('0xa5')]||0x12c),'interval':_0xbaf1('0x9c')});}return respondWithRpcPromise(_0xbaf1('0xa6'),_0xbaf1('0xa7'),_0x5a53a0);})[_0xbaf1('0x3a')](function(_0x3f0d0){respondWithRpcPromise(_0xbaf1('0xa8'),'EventManager',{'event':'notify','message':_0x3f0d0},client9002);return _0x3f0d0;})['then'](respondWithResult(_0x45bc36,null))['catch'](handleError(_0x45bc36,null));};exports[_0xbaf1('0xa9')]=function(_0x2bae4d,_0x2a45e4){var _0x536617=_0x2bae4d[_0xbaf1('0x60')]['id'];var _0x1bb2b9=_0x2bae4d[_0xbaf1('0x63')];var _0x32c788=0xc8;var _0x5a399d=null;return db[_0xbaf1('0xaa')][_0xbaf1('0xab')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xbaf1('0xac')]},function(_0x551372){return db[_0xbaf1('0x44')][_0xbaf1('0x6d')]({'where':{'id':_0x536617},'transaction':_0x551372})[_0xbaf1('0x3a')](function(_0x42c74a){if(_0x42c74a){return db[_0xbaf1('0x87')][_0xbaf1('0x3b')]({'where':{'OpenchannelAccountId':_0x536617},'transaction':_0x551372})['then'](function(){var _0x314236=_[_0xbaf1('0x6f')](_0x1bb2b9,function(_0x3650c9){_0x3650c9['OpenchannelAccountId']=_0x536617;return _0x3650c9;});return db[_0xbaf1('0x87')]['bulkCreate'](_0x314236,{'transaction':_0x551372});});}else{_0x32c788=0x194;_0x5a399d=[];}});})[_0xbaf1('0x3a')](function(){if(_0x32c788!==0x194){return db[_0xbaf1('0x87')][_0xbaf1('0xad')]({'where':{'OpenchannelAccountId':_0x536617},'order':'priority'})['then'](function(_0x521037){_0x5a399d=_0x521037;});}})[_0xbaf1('0x2c')](function(_0x3b8bc9){_0x32c788=0x1f4;logger[_0xbaf1('0x28')](_0x3b8bc9[_0xbaf1('0x3f')]);if(_0x3b8bc9[_0xbaf1('0x47')]){delete _0x3b8bc9[_0xbaf1('0x47')];}_0x5a399d=_0x3b8bc9;})[_0xbaf1('0xae')](function(){if(_0x5a399d===null){_0x2a45e4['sendStatus'](_0x32c788);}else{if(_0x32c788===0x1f4){_0x2a45e4[_0xbaf1('0x2e')](_0x32c788)['send'](_0x5a399d);}else{_0x2a45e4['status'](_0x32c788)[_0xbaf1('0x30')](_0x5a399d);}}});};exports['getApplications']=function(_0x389ed9,_0xc9287d,_0x5805eb){var _0x74ff51={};var _0x54143f={};var _0x329b88;var _0x44c331;return db[_0xbaf1('0x44')][_0xbaf1('0x6d')]({'where':{'id':_0x389ed9[_0xbaf1('0x60')]['id']}})['then'](handleEntityNotFound(_0xc9287d,null))[_0xbaf1('0x3a')](function(_0x53322e){if(_0x53322e){_0x329b88=_0x53322e;_0x54143f['model']=_[_0xbaf1('0x49')](db[_0xbaf1('0x87')]['rawAttributes']);_0x54143f['query']=_[_0xbaf1('0x49')](_0x389ed9[_0xbaf1('0x48')]);_0x54143f[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x54143f[_0xbaf1('0x4c')],_0x54143f[_0xbaf1('0x48')]);_0x74ff51[_0xbaf1('0x4e')]=_[_0xbaf1('0x4b')](_0x54143f[_0xbaf1('0x4c')],qs[_0xbaf1('0x4d')](_0x389ed9['query']['fields']));_0x74ff51[_0xbaf1('0x4e')]=_0x74ff51[_0xbaf1('0x4e')][_0xbaf1('0x4f')]?_0x74ff51[_0xbaf1('0x4e')]:_0x54143f['model'];_0x74ff51[_0xbaf1('0x53')]=qs[_0xbaf1('0x54')](_0x389ed9['query']['sort']);_0x74ff51[_0xbaf1('0x5a')]=qs['filters'](_[_0xbaf1('0x55')](_0x389ed9[_0xbaf1('0x48')],_0x54143f[_0xbaf1('0x4a')]));if(_0x389ed9['query']['filter']){_0x74ff51['where']=_[_0xbaf1('0x57')](_0x74ff51[_0xbaf1('0x5a')],{'$or':_[_0xbaf1('0x6f')](_0x74ff51[_0xbaf1('0x4e')],function(_0x7638b6){var _0x54fc67={};_0x54fc67[_0x7638b6]={'$like':'%'+_0x389ed9[_0xbaf1('0x48')]['filter']+'%'};return _0x54fc67;})});}_0x74ff51=_[_0xbaf1('0x57')]({},_0x74ff51,_0x389ed9[_0xbaf1('0x59')]);return _0x329b88[_0xbaf1('0xaf')](_0x74ff51);}})[_0xbaf1('0x3a')](function(_0x5c5c02){if(_0x5c5c02){_0x44c331=_0x5c5c02['length'];if(!_0x389ed9['query'][_0xbaf1('0x50')](_0xbaf1('0x51'))){_0x74ff51[_0xbaf1('0x52')]=qs['limit'](_0x389ed9[_0xbaf1('0x48')][_0xbaf1('0x52')]);_0x74ff51[_0xbaf1('0x31')]=qs[_0xbaf1('0x31')](_0x389ed9[_0xbaf1('0x48')][_0xbaf1('0x31')]);}return _0x329b88[_0xbaf1('0xaf')](_0x74ff51);}})[_0xbaf1('0x3a')](function(_0x105c11){if(_0x105c11){return _0x105c11?{'count':_0x44c331,'rows':_0x105c11}:null;}})['then'](respondWithResult(_0xc9287d,null))[_0xbaf1('0x2c')](handleError(_0xc9287d,null));};exports['getInteractions']=function(_0x2f08d9,_0x58db14,_0x12de80){var _0x3ef983={'raw':![],'where':{}};var _0x441b15={};var _0xa48e36={'count':0x0,'rows':[]};return db[_0xbaf1('0x44')]['findOne']({'where':{'id':_0x2f08d9['params']['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x58db14,null))[_0xbaf1('0x3a')](function(_0x55ed52){if(_0x55ed52){_0x441b15[_0xbaf1('0x4c')]=_['keys'](db[_0xbaf1('0x94')][_0xbaf1('0x45')]);_0x441b15['query']=_[_0xbaf1('0x49')](_0x2f08d9[_0xbaf1('0x48')]);_0x441b15[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x441b15[_0xbaf1('0x4c')],_0x441b15[_0xbaf1('0x48')]);_0x3ef983[_0xbaf1('0x4e')]=_['intersection'](_0x441b15[_0xbaf1('0x4c')],qs[_0xbaf1('0x4d')](_0x2f08d9['query'][_0xbaf1('0x4d')]));_0x3ef983[_0xbaf1('0x4e')]=_0x3ef983[_0xbaf1('0x4e')][_0xbaf1('0x4f')]?_0x3ef983[_0xbaf1('0x4e')]:_0x441b15[_0xbaf1('0x4c')];if(!_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x50')]('nolimit')){_0x3ef983[_0xbaf1('0x52')]=qs[_0xbaf1('0x52')](_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x52')]);_0x3ef983['offset']=qs['offset'](_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x31')]);}_0x3ef983[_0xbaf1('0x53')]=qs[_0xbaf1('0x54')](_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x54')]);_0x3ef983[_0xbaf1('0x5a')]=qs['filters'](_[_0xbaf1('0x55')](_0x2f08d9[_0xbaf1('0x48')],_0x441b15['filters']));_0x3ef983[_0xbaf1('0x5a')][_0xbaf1('0x6b')]=_0x55ed52['id'];if(_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x56')]){_0x3ef983['where']=_[_0xbaf1('0x57')](_0x3ef983[_0xbaf1('0x5a')],{'$or':_[_0xbaf1('0x6f')](_0x3ef983[_0xbaf1('0x4e')],function(_0x14735a){var _0x45a6f9={};_0x45a6f9[_0x14735a]={'$like':'%'+_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x56')]+'%'};return _0x45a6f9;})});}_0x3ef983=_[_0xbaf1('0x57')]({},_0x3ef983,_0x2f08d9[_0xbaf1('0x59')]);return db[_0xbaf1('0x94')][_0xbaf1('0x33')]({'where':_0x3ef983[_0xbaf1('0x5a')]})[_0xbaf1('0x3a')](function(_0x4a03a2){_0xa48e36[_0xbaf1('0x33')]=_0x4a03a2;if(_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0x5b')]){_0x3ef983['include']=[{'model':db['CmContact'],'as':_0xbaf1('0xb0'),'required':![]},{'model':db[_0xbaf1('0x9e')],'as':_0xbaf1('0xb1'),'attributes':[_0xbaf1('0x47'),_0xbaf1('0xb2'),_0xbaf1('0xb3')],'required':![]},{'model':db['Tag'],'as':_0xbaf1('0xb4'),'attributes':['id',_0xbaf1('0x47'),_0xbaf1('0xb5')],'where':_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0xb6')]?{'id':_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0xb6')]}:undefined,'required':_0x2f08d9[_0xbaf1('0x48')][_0xbaf1('0xb6')]?!![]:![]}];}return db[_0xbaf1('0x94')][_0xbaf1('0x5d')](_0x3ef983);})[_0xbaf1('0x3a')](function(_0x17e949){_0xa48e36[_0xbaf1('0x5e')]=_0x17e949;return _0xa48e36;});}})[_0xbaf1('0x3a')](respondWithFilteredResult(_0x58db14,_0x3ef983))[_0xbaf1('0x2c')](handleError(_0x58db14,null));};exports['addAgents']=function(_0x1a9efc,_0x5670cc,_0x12f20b){return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x1a9efc[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x5670cc,null))[_0xbaf1('0x3a')](function(_0x29fa54){if(_0x29fa54){return _0x29fa54[_0xbaf1('0xb7')](_0x1a9efc[_0xbaf1('0x63')][_0xbaf1('0x71')],_[_0xbaf1('0xb8')](_0x1a9efc[_0xbaf1('0x63')],[_0xbaf1('0x71'),'id'])||{})[_0xbaf1('0x97')](function(_0x5328ea){for(var _0x4d3680=0x0;_0x4d3680<_0x1a9efc['body']['ids'][_0xbaf1('0x4f')];_0x4d3680+=0x1){socket[_0xbaf1('0xb9')](_0xbaf1('0xba'),{'UserId':Number(_0x1a9efc['body'][_0xbaf1('0x71')][_0x4d3680]),'OpenchannelAccountId':Number(_0x1a9efc[_0xbaf1('0x60')]['id'])});}return _0x5328ea;});}})[_0xbaf1('0x3a')](respondWithResult(_0x5670cc,null))[_0xbaf1('0x2c')](handleError(_0x5670cc,null));};exports[_0xbaf1('0xbb')]=function(_0x5729,_0x35c45e,_0x4bfbad){return db['OpenchannelAccount'][_0xbaf1('0x61')]({'where':{'id':_0x5729[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x35c45e,null))['then'](function(_0x50c424){if(_0x50c424){return _0x50c424[_0xbaf1('0xbb')](_0x5729['query'][_0xbaf1('0x71')])[_0xbaf1('0x3a')](function(){if(_[_0xbaf1('0xbc')](_0x5729[_0xbaf1('0x48')][_0xbaf1('0x71')])){for(var _0x4d5a04=0x0;_0x4d5a04<_0x5729[_0xbaf1('0x48')]['ids'][_0xbaf1('0x4f')];_0x4d5a04+=0x1){socket[_0xbaf1('0xb9')](_0xbaf1('0xbd'),{'UserId':Number(_0x5729[_0xbaf1('0x48')][_0xbaf1('0x71')][_0x4d5a04]),'OpenchannelAccountId':Number(_0x5729[_0xbaf1('0x60')]['id'])});}}else{socket[_0xbaf1('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5729['query'][_0xbaf1('0x71')]),'OpenchannelAccountId':Number(_0x5729[_0xbaf1('0x60')]['id'])});}});}})[_0xbaf1('0x3a')](respondWithStatusCode(_0x35c45e,null))['catch'](handleError(_0x35c45e,null));};exports[_0xbaf1('0xbe')]=function(_0x896af4,_0x131f74,_0x44e928){var _0x1c3b12={};var _0x415df7={};var _0x734759;var _0x141a15;return db['OpenchannelAccount'][_0xbaf1('0x6d')]({'where':{'id':_0x896af4[_0xbaf1('0x60')]['id']}})['then'](handleEntityNotFound(_0x131f74,null))[_0xbaf1('0x3a')](function(_0xef5244){if(_0xef5244){_0x734759=_0xef5244;_0x415df7[_0xbaf1('0x4c')]=_[_0xbaf1('0x49')](db[_0xbaf1('0x9e')]['rawAttributes']);_0x415df7[_0xbaf1('0x48')]=_['keys'](_0x896af4['query']);_0x415df7[_0xbaf1('0x4a')]=_[_0xbaf1('0x4b')](_0x415df7['model'],_0x415df7[_0xbaf1('0x48')]);_0x1c3b12[_0xbaf1('0x4e')]=_[_0xbaf1('0x4b')](_0x415df7['model'],qs[_0xbaf1('0x4d')](_0x896af4[_0xbaf1('0x48')][_0xbaf1('0x4d')]));_0x1c3b12[_0xbaf1('0x4e')]=_0x1c3b12['attributes'][_0xbaf1('0x4f')]?_0x1c3b12[_0xbaf1('0x4e')]:_0x415df7[_0xbaf1('0x4c')];_0x1c3b12[_0xbaf1('0x53')]=qs[_0xbaf1('0x54')](_0x896af4['query'][_0xbaf1('0x54')]);_0x1c3b12[_0xbaf1('0x5a')]=qs[_0xbaf1('0x4a')](_[_0xbaf1('0x55')](_0x896af4[_0xbaf1('0x48')],_0x415df7['filters']));if(_0x896af4[_0xbaf1('0x48')]['filter']){_0x1c3b12[_0xbaf1('0x5a')]=_[_0xbaf1('0x57')](_0x1c3b12[_0xbaf1('0x5a')],{'$or':_['map'](_0x1c3b12[_0xbaf1('0x4e')],function(_0x107aab){var _0x580a35={};_0x580a35[_0x107aab]={'$like':'%'+_0x896af4[_0xbaf1('0x48')][_0xbaf1('0x56')]+'%'};return _0x580a35;})});}_0x1c3b12=_[_0xbaf1('0x57')]({},_0x1c3b12,_0x896af4['options']);return _0x734759[_0xbaf1('0xbe')](_0x1c3b12);}})[_0xbaf1('0x3a')](function(_0x2b1806){if(_0x2b1806){_0x141a15=_0x2b1806['length'];if(!_0x896af4[_0xbaf1('0x48')]['hasOwnProperty'](_0xbaf1('0x51'))){_0x1c3b12[_0xbaf1('0x52')]=qs[_0xbaf1('0x52')](_0x896af4[_0xbaf1('0x48')]['limit']);_0x1c3b12[_0xbaf1('0x31')]=qs[_0xbaf1('0x31')](_0x896af4[_0xbaf1('0x48')][_0xbaf1('0x31')]);}return _0x734759[_0xbaf1('0xbe')](_0x1c3b12);}})['then'](function(_0x223315){if(_0x223315){return _0x223315?{'count':_0x141a15,'rows':_0x223315}:null;}})['then'](respondWithResult(_0x131f74,null))[_0xbaf1('0x2c')](handleError(_0x131f74,null));};exports[_0xbaf1('0x40')]=function(_0x1ca8c4,_0x3deada,_0x22c1ec){var _0x480bbf,_0x4e63b5,_0x1088fa;if(_[_0xbaf1('0x7d')](_0x1ca8c4[_0xbaf1('0x63')]['body'])||_0x1ca8c4[_0xbaf1('0x63')][_0xbaf1('0x63')]===''){throw new db[(_0xbaf1('0x77'))][(_0xbaf1('0x7e'))](_0xbaf1('0xbf'));}if(_['isNil'](_0x1ca8c4[_0xbaf1('0x63')]['to'])){}_0x480bbf=_0x1ca8c4[_0xbaf1('0x63')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1ca8c4[_0xbaf1('0x60')]['id']}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x3deada,null))[_0xbaf1('0x3a')](function(_0x366639){if(_0x366639){return db[_0xbaf1('0x44')][_0xbaf1('0x61')]({'where':{'id':_0x366639['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xbaf1('0x76')],'as':_0xbaf1('0x85'),'where':{[_0x366639['mapKey']]:_0x480bbf},'limit':0x1,'order':[[_0xbaf1('0x7a'),_0xbaf1('0x86')]]}]}]})[_0xbaf1('0x3a')](handleEntityNotFound(_0x3deada,null))[_0xbaf1('0x3a')](function(_0x22955d){if(_0x22955d&&_0x22955d[_0xbaf1('0x88')]){_0x4e63b5=_0x22955d[_0xbaf1('0x3c')]({'plain':!![]});if(_0x4e63b5[_0xbaf1('0x88')]&&_0x4e63b5[_0xbaf1('0x88')][_0xbaf1('0x85')]['length']){return _0x4e63b5['List']['Contacts'][0x0];}return db['CmContact'][_0xbaf1('0x62')](_[_0xbaf1('0x8f')](_0x1ca8c4[_0xbaf1('0x63')],{'firstName':_0x480bbf,[_0x22955d[_0xbaf1('0x80')]]:_0x480bbf,'phone':_0x480bbf,'ListId':_0x4e63b5[_0xbaf1('0x7c')]}));}})[_0xbaf1('0x3a')](handleEntityNotFound(_0x3deada,null))['then'](function(_0x276639){if(_0x276639){_0x1088fa=_0x276639;return db[_0xbaf1('0x94')]['find']({'where':{'ContactId':_0x1088fa['id'],'closed':![],'OpenchannelAccountId':_0x4e63b5['id']}})['then'](function(_0x5ad523){if(_0x5ad523){return[_0x5ad523,![]];}return db[_0xbaf1('0x94')][_0xbaf1('0x62')]({'UserId':_0x1ca8c4[_0xbaf1('0x64')]['id'],'ContactId':_0x1088fa['id'],'OpenchannelAccountId':_0x4e63b5['id'],'lastMsgDirection':_0xbaf1('0xc0'),'firstMsgDirection':_0xbaf1('0xc0'),'Messages':[_['merge'](_0x1ca8c4[_0xbaf1('0x63')],{'read':![],'body':_0x1ca8c4[_0xbaf1('0x63')][_0xbaf1('0x63')],'OpenchannelAccountId':_0x4e63b5['id'],'UserId':_0x1ca8c4[_0xbaf1('0x64')]['id'],'ContactId':_0x1088fa['id']})]},{'include':[{'model':db[_0xbaf1('0xc1')],'as':_0xbaf1('0xc2')}]})['then'](function(_0x9fb022){return[_0x9fb022,!![]];});});}})[_0xbaf1('0x97')](function(_0x4c9bfa,_0x24960d){if(_0x24960d){return _0x4c9bfa;}return db['OpenchannelMessage'][_0xbaf1('0x62')](_[_0xbaf1('0x57')](_0x1ca8c4[_0xbaf1('0x63')],{'read':![],'body':_0x1ca8c4[_0xbaf1('0x63')][_0xbaf1('0x63')],'OpenchannelAccountId':_0x4e63b5['id'],'OpenchannelInteractionId':_0x4c9bfa['id'],'UserId':_0x1ca8c4['user']['id'],'ContactId':_0x1088fa['id']}))['then'](function(_0x241a7c){_0x4c9bfa['dataValues'][_0xbaf1('0xc2')]=[];_0x4c9bfa[_0xbaf1('0xc3')][_0xbaf1('0xc2')][_0xbaf1('0xc4')](_0x241a7c[_0xbaf1('0xc3')]);return _0x4c9bfa;});});}})[_0xbaf1('0x3a')](respondWithResult(_0x3deada,null))[_0xbaf1('0x2c')](handleError(_0x3deada,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0c0d62a..fce1291 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 _0xee5b=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x2113fe,_0x4205ed){var _0x396d6f=function(_0x4a3224){while(--_0x4a3224){_0x2113fe['push'](_0x2113fe['shift']());}};_0x396d6f(++_0x4205ed);}(_0xee5b,0x1f4));var _0xbee5=function(_0x558ca6,_0x1e20c2){_0x558ca6=_0x558ca6-0x0;var _0x4a6e79=_0xee5b[_0x558ca6];return _0x4a6e79;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbee5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbee5('0x3'),'afterDestroy':_0xbee5('0x4')};function emitEvent(_0x2eb857){return function(_0x210159,_0x4bd202,_0x5200b1){OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857+':'+_0x210159['id'],_0x210159);OpenchannelAccountEvents[_0xbee5('0x5')](_0x2eb857,_0x210159);_0x5200b1(null);};}for(var e in events){if(events[_0xbee5('0x6')](e)){var event=events[e];OpenchannelAccount[_0xbee5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x1a15cc,_0x289973){var _0x197eca=function(_0x964d4d){while(--_0x964d4d){_0x1a15cc['push'](_0x1a15cc['shift']());}};_0x197eca(++_0x289973);}(_0x70e0,0x17b));var _0x070e=function(_0x46eda7,_0x59f137){_0x46eda7=_0x46eda7-0x0;var _0x496e4f=_0x70e0[_0x46eda7];return _0x496e4f;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 104563a..9403d08 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(_0x100277,_0x3a6e26){var _0x1007b7=function(_0x1811dc){while(--_0x1811dc){_0x100277['push'](_0x100277['shift']());}};_0x1007b7(++_0x3a6e26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x53b032,_0x4fd1fd){var _0x2f718e=function(_0x3a64f1){while(--_0x3a64f1){_0x53b032['push'](_0x53b032['shift']());}};_0x2f718e(++_0x4fd1fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 1940257..a44345c 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 _0x9d9b=['./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x5b84cd,_0x3b77b0){var _0x5ec99f=function(_0x3282d2){while(--_0x3282d2){_0x5b84cd['push'](_0x5b84cd['shift']());}};_0x5ec99f(++_0x3b77b0);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x4bac5c,_0x29b31f){_0x4bac5c=_0x4bac5c-0x0;var _0x5cf2f5=_0x9d9b[_0x4bac5c];return _0x5cf2f5;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});config['redis']=_[_0xb9d9('0x9')](config[_0xb9d9('0xa')],{'host':_0xb9d9('0xb'),'port':0x18eb});var socket=require(_0xb9d9('0xc'))(new Redis(config[_0xb9d9('0xa')]));require(_0xb9d9('0xd'))[_0xb9d9('0xe')](socket);function respondWithRpcPromise(_0x5a9c18,_0x5b591e,_0x5f14e7){return new BPromise(function(_0x4cde40,_0x45f507){return client[_0xb9d9('0xf')](_0x5a9c18,_0x5f14e7)[_0xb9d9('0x10')](function(_0x5e226e){logger[_0xb9d9('0x11')](_0xb9d9('0x12'),_0x5b591e,'request\x20sent');logger[_0xb9d9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'),JSON[_0xb9d9('0x15')](_0x5e226e));if(_0x5e226e[_0xb9d9('0x16')]){if(_0x5e226e[_0xb9d9('0x16')][_0xb9d9('0x17')]===0x1f4){logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x45f507(_0x5e226e['error'][_0xb9d9('0x18')]);}logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x4cde40(_0x5e226e['error'][_0xb9d9('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'));_0x4cde40(_0x5e226e[_0xb9d9('0x19')][_0xb9d9('0x18')]);}})['catch'](function(_0x473b89){logger[_0xb9d9('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0x473b89);_0x45f507(_0x473b89);});});} \ No newline at end of file +var _0x9354=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','catch'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9354,0x96));var _0x4935=function(_0x40162a,_0x265b0c){_0x40162a=_0x40162a-0x0;var _0x488161=_0x9354[_0x40162a];return _0x488161;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});config[_0x4935('0xb')]=_[_0x4935('0xc')](config[_0x4935('0xb')],{'host':_0x4935('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4935('0xb')]));require('./openchannelAccount.socket')[_0x4935('0xe')](socket);function respondWithRpcPromise(_0x38de96,_0xd5b117,_0x22a83f){return new BPromise(function(_0x261462,_0x319b72){return client['request'](_0x38de96,_0x22a83f)['then'](function(_0x2ebd4c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xd5b117,_0x4935('0xf'));logger[_0x4935('0x10')](_0x4935('0x11'),_0xd5b117,_0x4935('0xf'),JSON[_0x4935('0x12')](_0x2ebd4c));if(_0x2ebd4c[_0x4935('0x13')]){if(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x14')]===0x1f4){logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);return _0x319b72(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);}logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x2ebd4c['error'][_0x4935('0x16')]);return _0x261462(_0x2ebd4c[_0x4935('0x13')][_0x4935('0x16')]);}else{logger[_0x4935('0x17')](_0x4935('0x15'),_0xd5b117,_0x4935('0xf'));_0x261462(_0x2ebd4c['result'][_0x4935('0x16')]);}})[_0x4935('0x18')](function(_0x4fe356){logger[_0x4935('0x13')](_0x4935('0x15'),_0xd5b117,_0x4fe356);_0x319b72(_0x4fe356);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b24874a..99a361e 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 _0xedd9=['removeListener','register','length','openchannelAccount:','save','remove','update','emit'];(function(_0x4bd87d,_0x5da319){var _0x184421=function(_0x1a887b){while(--_0x1a887b){_0x4bd87d['push'](_0x4bd87d['shift']());}};_0x184421(++_0x5da319);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e2219,_0x490ba9){_0x2e2219=_0x2e2219-0x0;var _0x1f5937=_0xedd9[_0x2e2219];return _0x1f5937;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){OpenchannelAccountEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);OpenchannelAccountEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x9532=['emit','removeListener','./openchannelAccount.events','save','remove','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9532,0x8c));var _0x2953=function(_0xad9aaf,_0x562cd2){_0xad9aaf=_0xad9aaf-0x0;var _0x28f510=_0x9532[_0xad9aaf];return _0x28f510;};'use strict';var OpenchannelAccountEvents=require(_0x2953('0x0'));var events=[_0x2953('0x1'),_0x2953('0x2'),_0x2953('0x3')];function createListener(_0x3f89d9,_0xabd12e){return function(_0x51aa45){_0xabd12e[_0x2953('0x4')](_0x3f89d9,_0x51aa45);};}function removeListener(_0x3058d6,_0x5dceda){return function(){OpenchannelAccountEvents[_0x2953('0x5')](_0x3058d6,_0x5dceda);};}exports['register']=function(_0x12de4a){for(var _0x451c3c=0x0,_0x5b2aea=events['length'];_0x451c3c<_0x5b2aea;_0x451c3c++){var _0x21a76a=events[_0x451c3c];var _0x5cbdaa=createListener('openchannelAccount:'+_0x21a76a,_0x12de4a);OpenchannelAccountEvents['on'](_0x21a76a,_0x5cbdaa);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8309483..e8e49e9 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 _0x0d2a=['../../components/auth/service','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x40b725,_0x18b164){var _0x1972ed=function(_0x4713c4){while(--_0x4713c4){_0x40b725['push'](_0x40b725['shift']());}};_0x1972ed(++_0x18b164);}(_0x0d2a,0xfc));var _0xa0d2=function(_0x258652,_0x3d6235){_0x258652=_0x258652-0x0;var _0x1c94a7=_0x0d2a[_0x258652];return _0x1c94a7;};'use strict';var multer=require(_0xa0d2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa0d2('0x1'));var express=require('express');var router=express[_0xa0d2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa0d2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0xa0d2('0x4')](),controller[_0xa0d2('0x5')]);router[_0xa0d2('0x6')](_0xa0d2('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xa0d2('0x8')]('/',auth[_0xa0d2('0x4')](),controller[_0xa0d2('0x9')]);router[_0xa0d2('0xa')](_0xa0d2('0x7'),auth['isAuthenticated'](),controller[_0xa0d2('0xb')]);router[_0xa0d2('0xc')](_0xa0d2('0x7'),auth['isAuthenticated'](),controller[_0xa0d2('0xd')]);module[_0xa0d2('0xe')]=router; \ No newline at end of file +var _0x1d6e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x5c4abf,_0x4abad1){var _0xe536f7=function(_0x4575a7){while(--_0x4575a7){_0x5c4abf['push'](_0x5c4abf['shift']());}};_0xe536f7(++_0x4abad1);}(_0x1d6e,0x75));var _0xe1d6=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x1d6e[_0x2a8860];return _0x2f47a4;};'use strict';var multer=require(_0xe1d6('0x0'));var util=require('util');var path=require(_0xe1d6('0x1'));var timeout=require(_0xe1d6('0x2'));var express=require(_0xe1d6('0x3'));var router=express[_0xe1d6('0x4')]();var fs_extra=require(_0xe1d6('0x5'));var auth=require(_0xe1d6('0x6'));var interaction=require(_0xe1d6('0x7'));var config=require(_0xe1d6('0x8'));var controller=require(_0xe1d6('0x9'));router[_0xe1d6('0xa')]('/',auth[_0xe1d6('0xb')](),controller[_0xe1d6('0xc')]);router[_0xe1d6('0xa')](_0xe1d6('0xd'),auth[_0xe1d6('0xb')](),controller[_0xe1d6('0xe')]);router[_0xe1d6('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe1d6('0x10')]('/:id',auth[_0xe1d6('0xb')](),controller[_0xe1d6('0x11')]);router[_0xe1d6('0x12')](_0xe1d6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe1d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7c42876..92fbc55 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 _0x6c12=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x24af78,_0x138455){var _0x125cd2=function(_0x5d1921){while(--_0x5d1921){_0x24af78['push'](_0x24af78['shift']());}};_0x125cd2(++_0x138455);}(_0x6c12,0x1a6));var _0x26c1=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x6c12[_0x33554b];return _0x256954;};'use strict';var Sequelize=require('sequelize');module[_0x26c1('0x0')]={'priority':{'type':Sequelize[_0x26c1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x26c1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x26c1('0x2')]},'interval':{'type':Sequelize[_0x26c1('0x2')],'defaultValue':_0x26c1('0x3')}}; \ No newline at end of file +var _0x0c65=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c65,0x127));var _0x50c6=function(_0x4e8f8b,_0x5c7b1d){_0x4e8f8b=_0x4e8f8b-0x0;var _0x7f6ee8=_0x0c65[_0x4e8f8b];return _0x7f6ee8;};'use strict';var Sequelize=require(_0x50c6('0x0'));module[_0x50c6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x50c6('0x2')],'allowNull':![],'defaultValue':_0x50c6('0x3')},'appdata':{'type':Sequelize[_0x50c6('0x4')]()},'description':{'type':Sequelize[_0x50c6('0x2')]},'interval':{'type':Sequelize[_0x50c6('0x2')],'defaultValue':_0x50c6('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b0b5f36..aa93918 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 _0xaa9e=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x2ee8f6,_0x14587c){var _0x28948d=function(_0x4e3202){while(--_0x4e3202){_0x2ee8f6['push'](_0x2ee8f6['shift']());}};_0x28948d(++_0x14587c);}(_0xaa9e,0x1b6));var _0xeaa9=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xaa9e[_0x4c0622];return _0x1799d8;};'use strict';var emlformat=require(_0xeaa9('0x0'));var rimraf=require(_0xeaa9('0x1'));var zipdir=require(_0xeaa9('0x2'));var jsonpatch=require(_0xeaa9('0x3'));var rp=require(_0xeaa9('0x4'));var moment=require('moment');var BPromise=require(_0xeaa9('0x5'));var Mustache=require(_0xeaa9('0x6'));var util=require(_0xeaa9('0x7'));var path=require('path');var sox=require(_0xeaa9('0x8'));var csv=require(_0xeaa9('0x9'));var ejs=require(_0xeaa9('0xa'));var fs=require('fs');var fs_extra=require(_0xeaa9('0xb'));var _=require(_0xeaa9('0xc'));var squel=require(_0xeaa9('0xd'));var crypto=require(_0xeaa9('0xe'));var jsforce=require(_0xeaa9('0xf'));var deskjs=require(_0xeaa9('0x10'));var toCsv=require(_0xeaa9('0x9'));var querystring=require(_0xeaa9('0x11'));var Papa=require('papaparse');var Redis=require(_0xeaa9('0x12'));var authService=require(_0xeaa9('0x13'));var qs=require(_0xeaa9('0x14'));var as=require(_0xeaa9('0x15'));var hardwareService=require(_0xeaa9('0x16'));var logger=require(_0xeaa9('0x17'))(_0xeaa9('0x18'));var utils=require('../../config/utils');var config=require(_0xeaa9('0x19'));var licenseUtil=require(_0xeaa9('0x1a'));var db=require(_0xeaa9('0x1b'))['db'];function respondWithStatusCode(_0x1cbe08,_0x4a9ae9){_0x4a9ae9=_0x4a9ae9||0xcc;return function(_0x4642df){if(_0x4642df){return _0x1cbe08[_0xeaa9('0x1c')](_0x4a9ae9);}return _0x1cbe08['status'](_0x4a9ae9)['end']();};}function respondWithResult(_0x37f440,_0x3bf70e){_0x3bf70e=_0x3bf70e||0xc8;return function(_0xc12a50){if(_0xc12a50){return _0x37f440['status'](_0x3bf70e)[_0xeaa9('0x1d')](_0xc12a50);}};}function respondWithFilteredResult(_0x57b29e,_0x58efff){return function(_0x1d3568){if(_0x1d3568){var _0x3b03cb=typeof _0x58efff[_0xeaa9('0x1e')]===_0xeaa9('0x1f')&&typeof _0x58efff[_0xeaa9('0x20')]===_0xeaa9('0x1f');var _0x311247=_0x1d3568[_0xeaa9('0x21')];var _0x1a9d71=_0x3b03cb?0x0:_0x58efff[_0xeaa9('0x1e')];var _0x1deb63=_0x3b03cb?_0x1d3568[_0xeaa9('0x21')]:_0x58efff['offset']+_0x58efff[_0xeaa9('0x20')];var _0x3e8fea;if(_0x1deb63>=_0x311247){_0x1deb63=_0x311247;_0x3e8fea=0xc8;}else{_0x3e8fea=0xce;}_0x57b29e[_0xeaa9('0x22')](_0x3e8fea);return _0x57b29e['set']('Content-Range',_0x1a9d71+'-'+_0x1deb63+'/'+_0x311247)[_0xeaa9('0x1d')](_0x1d3568);}return null;};}function patchUpdates(_0x298896){return function(_0x572b67){try{jsonpatch['apply'](_0x572b67,_0x298896,!![]);}catch(_0x158cc4){return BPromise[_0xeaa9('0x23')](_0x158cc4);}return _0x572b67['save']();};}function saveUpdates(_0x16858e,_0x197dc5){return function(_0x2e35e7){if(_0x2e35e7){return _0x2e35e7[_0xeaa9('0x24')](_0x16858e)[_0xeaa9('0x25')](function(_0x4ab036){return _0x4ab036;});}return null;};}function removeEntity(_0x798fea,_0x2677b6){return function(_0xa02f05){if(_0xa02f05){return _0xa02f05[_0xeaa9('0x26')]()['then'](function(){_0x798fea[_0xeaa9('0x22')](0xcc)[_0xeaa9('0x27')]();});}};}function handleEntityNotFound(_0xf3e665,_0x67f9f0){return function(_0x6feca3){if(!_0x6feca3){_0xf3e665[_0xeaa9('0x1c')](0x194);}return _0x6feca3;};}function handleError(_0x3ee07f,_0x2b72e3){_0x2b72e3=_0x2b72e3||0x1f4;return function(_0x265d51){logger[_0xeaa9('0x28')](_0x265d51[_0xeaa9('0x29')]);if(_0x265d51[_0xeaa9('0x2a')]){delete _0x265d51['name'];}_0x3ee07f[_0xeaa9('0x22')](_0x2b72e3)['send'](_0x265d51);};}exports[_0xeaa9('0x2b')]=function(_0x1cd555,_0x8957de){var _0x2e665f={},_0x262458={},_0x103536={'count':0x0,'rows':[]};var _0x4e9b4e=_[_0xeaa9('0x2c')](db[_0xeaa9('0x2d')][_0xeaa9('0x2e')],function(_0xd265e0){return{'name':_0xd265e0['fieldName'],'type':_0xd265e0[_0xeaa9('0x2f')][_0xeaa9('0x30')]};});_0x262458[_0xeaa9('0x31')]=_[_0xeaa9('0x2c')](_0x4e9b4e,_0xeaa9('0x2a'));_0x262458[_0xeaa9('0x32')]=_[_0xeaa9('0x33')](_0x1cd555['query']);_0x262458[_0xeaa9('0x34')]=_[_0xeaa9('0x35')](_0x262458['model'],_0x262458[_0xeaa9('0x32')]);_0x2e665f[_0xeaa9('0x36')]=_['intersection'](_0x262458[_0xeaa9('0x31')],qs[_0xeaa9('0x37')](_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x37')]));_0x2e665f[_0xeaa9('0x36')]=_0x2e665f['attributes'][_0xeaa9('0x38')]?_0x2e665f[_0xeaa9('0x36')]:_0x262458['model'];if(!_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x39')]('nolimit')){_0x2e665f[_0xeaa9('0x20')]=qs[_0xeaa9('0x20')](_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x20')]);_0x2e665f[_0xeaa9('0x1e')]=qs[_0xeaa9('0x1e')](_0x1cd555['query'][_0xeaa9('0x1e')]);}_0x2e665f[_0xeaa9('0x3a')]=qs['sort'](_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x3b')]);_0x2e665f[_0xeaa9('0x3c')]=qs[_0xeaa9('0x34')](_['pick'](_0x1cd555['query'],_0x262458['filters']),_0x4e9b4e);if(_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x3d')]){_0x2e665f['where']=_[_0xeaa9('0x3e')](_0x2e665f[_0xeaa9('0x3c')],{'$or':_[_0xeaa9('0x2c')](_0x4e9b4e,function(_0x5325aa){if(_0x5325aa['type']!=='VIRTUAL'){var _0x56ea7c={};_0x56ea7c[_0x5325aa['name']]={'$like':'%'+_0x1cd555['query'][_0xeaa9('0x3d')]+'%'};return _0x56ea7c;}})});}_0x2e665f=_[_0xeaa9('0x3e')]({},_0x2e665f,_0x1cd555[_0xeaa9('0x3f')]);var _0x1c04d2={'where':_0x2e665f[_0xeaa9('0x3c')]};return db[_0xeaa9('0x2d')][_0xeaa9('0x21')](_0x1c04d2)[_0xeaa9('0x25')](function(_0x8e3e9){_0x103536[_0xeaa9('0x21')]=_0x8e3e9;if(_0x1cd555[_0xeaa9('0x32')][_0xeaa9('0x40')]){_0x2e665f[_0xeaa9('0x41')]=[{'all':!![]}];}return db[_0xeaa9('0x2d')][_0xeaa9('0x42')](_0x2e665f);})[_0xeaa9('0x25')](function(_0x1f5edc){_0x103536[_0xeaa9('0x43')]=_0x1f5edc;return _0x103536;})[_0xeaa9('0x25')](respondWithFilteredResult(_0x8957de,_0x2e665f))['catch'](handleError(_0x8957de,null));};exports[_0xeaa9('0x44')]=function(_0x3f494e,_0x3f62d3){var _0xca5b17={'raw':!![],'where':{'id':_0x3f494e[_0xeaa9('0x45')]['id']}},_0x43fffd={};_0x43fffd[_0xeaa9('0x31')]=_[_0xeaa9('0x33')](db[_0xeaa9('0x2d')][_0xeaa9('0x2e')]);_0x43fffd[_0xeaa9('0x32')]=_[_0xeaa9('0x33')](_0x3f494e[_0xeaa9('0x32')]);_0x43fffd[_0xeaa9('0x34')]=_[_0xeaa9('0x35')](_0x43fffd['model'],_0x43fffd[_0xeaa9('0x32')]);_0xca5b17['attributes']=_[_0xeaa9('0x35')](_0x43fffd[_0xeaa9('0x31')],qs[_0xeaa9('0x37')](_0x3f494e['query'][_0xeaa9('0x37')]));_0xca5b17[_0xeaa9('0x36')]=_0xca5b17[_0xeaa9('0x36')][_0xeaa9('0x38')]?_0xca5b17['attributes']:_0x43fffd[_0xeaa9('0x31')];if(_0x3f494e[_0xeaa9('0x32')]['includeAll']){_0xca5b17[_0xeaa9('0x41')]=[{'all':!![]}];}_0xca5b17=_[_0xeaa9('0x3e')]({},_0xca5b17,_0x3f494e[_0xeaa9('0x3f')]);return db[_0xeaa9('0x2d')]['find'](_0xca5b17)[_0xeaa9('0x25')](handleEntityNotFound(_0x3f62d3,null))[_0xeaa9('0x25')](respondWithResult(_0x3f62d3,null))[_0xeaa9('0x46')](handleError(_0x3f62d3,null));};exports[_0xeaa9('0x47')]=function(_0xe475a6,_0x2eba0c){return db[_0xeaa9('0x2d')]['create'](_0xe475a6['body'],{})[_0xeaa9('0x25')](respondWithResult(_0x2eba0c,0xc9))[_0xeaa9('0x46')](handleError(_0x2eba0c,null));};exports[_0xeaa9('0x24')]=function(_0xc5d2fd,_0x3c6050){if(_0xc5d2fd[_0xeaa9('0x48')]['id']){delete _0xc5d2fd['body']['id'];}return db[_0xeaa9('0x2d')][_0xeaa9('0x49')]({'where':{'id':_0xc5d2fd[_0xeaa9('0x45')]['id']}})[_0xeaa9('0x25')](handleEntityNotFound(_0x3c6050,null))[_0xeaa9('0x25')](saveUpdates(_0xc5d2fd['body'],null))['then'](respondWithResult(_0x3c6050,null))[_0xeaa9('0x46')](handleError(_0x3c6050,null));};exports['destroy']=function(_0x561dcf,_0x3c71e7){return db['OpenchannelApplication']['find']({'where':{'id':_0x561dcf['params']['id']}})[_0xeaa9('0x25')](handleEntityNotFound(_0x3c71e7,null))[_0xeaa9('0x25')](removeEntity(_0x3c71e7,null))[_0xeaa9('0x46')](handleError(_0x3c71e7,null));}; \ No newline at end of file +var _0x7362=['show','find','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0xd35184,_0x46dc7a){var _0x42daa4=function(_0x3430b7){while(--_0x3430b7){_0xd35184['push'](_0xd35184['shift']());}};_0x42daa4(++_0x46dc7a);}(_0x7362,0x171));var _0x2736=function(_0x22fa21,_0x2d83ab){_0x22fa21=_0x22fa21-0x0;var _0x5aa566=_0x7362[_0x22fa21];return _0x5aa566;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2736('0x0'));var zipdir=require(_0x2736('0x1'));var jsonpatch=require(_0x2736('0x2'));var rp=require(_0x2736('0x3'));var moment=require(_0x2736('0x4'));var BPromise=require(_0x2736('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2736('0x6'));var sox=require(_0x2736('0x7'));var csv=require(_0x2736('0x8'));var ejs=require(_0x2736('0x9'));var fs=require('fs');var fs_extra=require(_0x2736('0xa'));var _=require('lodash');var squel=require(_0x2736('0xb'));var crypto=require('crypto');var jsforce=require(_0x2736('0xc'));var deskjs=require(_0x2736('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2736('0xe'));var Redis=require(_0x2736('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2736('0x10'));var as=require(_0x2736('0x11'));var hardwareService=require(_0x2736('0x12'));var logger=require('../../config/logger')(_0x2736('0x13'));var utils=require(_0x2736('0x14'));var config=require(_0x2736('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2736('0x16'))['db'];function respondWithStatusCode(_0x4e6c21,_0x5bef66){_0x5bef66=_0x5bef66||0xcc;return function(_0x3629ee){if(_0x3629ee){return _0x4e6c21[_0x2736('0x17')](_0x5bef66);}return _0x4e6c21[_0x2736('0x18')](_0x5bef66)[_0x2736('0x19')]();};}function respondWithResult(_0x17301b,_0x2f4d66){_0x2f4d66=_0x2f4d66||0xc8;return function(_0x55f842){if(_0x55f842){return _0x17301b[_0x2736('0x18')](_0x2f4d66)[_0x2736('0x1a')](_0x55f842);}};}function respondWithFilteredResult(_0x5e1ed6,_0xf2654a){return function(_0x31ae21){if(_0x31ae21){var _0x6dcabf=typeof _0xf2654a[_0x2736('0x1b')]==='undefined'&&typeof _0xf2654a['limit']===_0x2736('0x1c');var _0x287583=_0x31ae21[_0x2736('0x1d')];var _0x48b466=_0x6dcabf?0x0:_0xf2654a['offset'];var _0x38e77a=_0x6dcabf?_0x31ae21[_0x2736('0x1d')]:_0xf2654a[_0x2736('0x1b')]+_0xf2654a[_0x2736('0x1e')];var _0x10657a;if(_0x38e77a>=_0x287583){_0x38e77a=_0x287583;_0x10657a=0xc8;}else{_0x10657a=0xce;}_0x5e1ed6[_0x2736('0x18')](_0x10657a);return _0x5e1ed6[_0x2736('0x1f')](_0x2736('0x20'),_0x48b466+'-'+_0x38e77a+'/'+_0x287583)[_0x2736('0x1a')](_0x31ae21);}return null;};}function patchUpdates(_0xcbdade){return function(_0x370a58){try{jsonpatch['apply'](_0x370a58,_0xcbdade,!![]);}catch(_0x41dada){return BPromise[_0x2736('0x21')](_0x41dada);}return _0x370a58[_0x2736('0x22')]();};}function saveUpdates(_0x1c0c91,_0xea79a0){return function(_0x1f4d5e){if(_0x1f4d5e){return _0x1f4d5e[_0x2736('0x23')](_0x1c0c91)[_0x2736('0x24')](function(_0x2e755f){return _0x2e755f;});}return null;};}function removeEntity(_0x2d56d8,_0x2a33f0){return function(_0x3653ef){if(_0x3653ef){return _0x3653ef[_0x2736('0x25')]()[_0x2736('0x24')](function(){_0x2d56d8[_0x2736('0x18')](0xcc)[_0x2736('0x19')]();});}};}function handleEntityNotFound(_0xed2557,_0x1635ba){return function(_0x359e79){if(!_0x359e79){_0xed2557[_0x2736('0x17')](0x194);}return _0x359e79;};}function handleError(_0x83e395,_0x969762){_0x969762=_0x969762||0x1f4;return function(_0x483c63){logger[_0x2736('0x26')](_0x483c63['stack']);if(_0x483c63[_0x2736('0x27')]){delete _0x483c63[_0x2736('0x27')];}_0x83e395['status'](_0x969762)['send'](_0x483c63);};}exports[_0x2736('0x28')]=function(_0x5e1b5d,_0x1db432){var _0x500251={},_0x254e7a={},_0x1886bd={'count':0x0,'rows':[]};var _0x43bb4c=_[_0x2736('0x29')](db[_0x2736('0x2a')][_0x2736('0x2b')],function(_0x3f25cf){return{'name':_0x3f25cf[_0x2736('0x2c')],'type':_0x3f25cf['type'][_0x2736('0x2d')]};});_0x254e7a['model']=_[_0x2736('0x29')](_0x43bb4c,'name');_0x254e7a[_0x2736('0x2e')]=_[_0x2736('0x2f')](_0x5e1b5d[_0x2736('0x2e')]);_0x254e7a[_0x2736('0x30')]=_[_0x2736('0x31')](_0x254e7a['model'],_0x254e7a[_0x2736('0x2e')]);_0x500251['attributes']=_[_0x2736('0x31')](_0x254e7a[_0x2736('0x32')],qs['fields'](_0x5e1b5d['query'][_0x2736('0x33')]));_0x500251['attributes']=_0x500251[_0x2736('0x34')][_0x2736('0x35')]?_0x500251[_0x2736('0x34')]:_0x254e7a[_0x2736('0x32')];if(!_0x5e1b5d[_0x2736('0x2e')][_0x2736('0x36')](_0x2736('0x37'))){_0x500251['limit']=qs['limit'](_0x5e1b5d['query'][_0x2736('0x1e')]);_0x500251[_0x2736('0x1b')]=qs[_0x2736('0x1b')](_0x5e1b5d[_0x2736('0x2e')][_0x2736('0x1b')]);}_0x500251[_0x2736('0x38')]=qs[_0x2736('0x39')](_0x5e1b5d[_0x2736('0x2e')][_0x2736('0x39')]);_0x500251['where']=qs[_0x2736('0x30')](_['pick'](_0x5e1b5d[_0x2736('0x2e')],_0x254e7a[_0x2736('0x30')]),_0x43bb4c);if(_0x5e1b5d[_0x2736('0x2e')][_0x2736('0x3a')]){_0x500251[_0x2736('0x3b')]=_['merge'](_0x500251[_0x2736('0x3b')],{'$or':_[_0x2736('0x29')](_0x43bb4c,function(_0x43a693){if(_0x43a693[_0x2736('0x3c')]!==_0x2736('0x3d')){var _0x4e3709={};_0x4e3709[_0x43a693[_0x2736('0x27')]]={'$like':'%'+_0x5e1b5d[_0x2736('0x2e')][_0x2736('0x3a')]+'%'};return _0x4e3709;}})});}_0x500251=_[_0x2736('0x3e')]({},_0x500251,_0x5e1b5d[_0x2736('0x3f')]);var _0x311fbb={'where':_0x500251[_0x2736('0x3b')]};return db[_0x2736('0x2a')][_0x2736('0x1d')](_0x311fbb)[_0x2736('0x24')](function(_0x5e58de){_0x1886bd[_0x2736('0x1d')]=_0x5e58de;if(_0x5e1b5d['query'][_0x2736('0x40')]){_0x500251[_0x2736('0x41')]=[{'all':!![]}];}return db[_0x2736('0x2a')][_0x2736('0x42')](_0x500251);})[_0x2736('0x24')](function(_0x16555f){_0x1886bd[_0x2736('0x43')]=_0x16555f;return _0x1886bd;})['then'](respondWithFilteredResult(_0x1db432,_0x500251))[_0x2736('0x44')](handleError(_0x1db432,null));};exports[_0x2736('0x45')]=function(_0x5d8894,_0x824927){var _0x461f9f={'raw':!![],'where':{'id':_0x5d8894['params']['id']}},_0x1a5e4a={};_0x1a5e4a[_0x2736('0x32')]=_[_0x2736('0x2f')](db[_0x2736('0x2a')][_0x2736('0x2b')]);_0x1a5e4a[_0x2736('0x2e')]=_[_0x2736('0x2f')](_0x5d8894['query']);_0x1a5e4a['filters']=_[_0x2736('0x31')](_0x1a5e4a[_0x2736('0x32')],_0x1a5e4a[_0x2736('0x2e')]);_0x461f9f['attributes']=_[_0x2736('0x31')](_0x1a5e4a[_0x2736('0x32')],qs[_0x2736('0x33')](_0x5d8894[_0x2736('0x2e')][_0x2736('0x33')]));_0x461f9f[_0x2736('0x34')]=_0x461f9f[_0x2736('0x34')]['length']?_0x461f9f['attributes']:_0x1a5e4a[_0x2736('0x32')];if(_0x5d8894['query']['includeAll']){_0x461f9f[_0x2736('0x41')]=[{'all':!![]}];}_0x461f9f=_['merge']({},_0x461f9f,_0x5d8894[_0x2736('0x3f')]);return db[_0x2736('0x2a')][_0x2736('0x46')](_0x461f9f)[_0x2736('0x24')](handleEntityNotFound(_0x824927,null))[_0x2736('0x24')](respondWithResult(_0x824927,null))[_0x2736('0x44')](handleError(_0x824927,null));};exports['create']=function(_0x29cec0,_0x749d89){return db['OpenchannelApplication']['create'](_0x29cec0['body'],{})[_0x2736('0x24')](respondWithResult(_0x749d89,0xc9))[_0x2736('0x44')](handleError(_0x749d89,null));};exports[_0x2736('0x23')]=function(_0x58bbb4,_0x14a10c){if(_0x58bbb4[_0x2736('0x47')]['id']){delete _0x58bbb4[_0x2736('0x47')]['id'];}return db['OpenchannelApplication'][_0x2736('0x46')]({'where':{'id':_0x58bbb4[_0x2736('0x48')]['id']}})[_0x2736('0x24')](handleEntityNotFound(_0x14a10c,null))[_0x2736('0x24')](saveUpdates(_0x58bbb4['body'],null))[_0x2736('0x24')](respondWithResult(_0x14a10c,null))[_0x2736('0x44')](handleError(_0x14a10c,null));};exports[_0x2736('0x25')]=function(_0x2628b6,_0x23f4b3){return db[_0x2736('0x2a')]['find']({'where':{'id':_0x2628b6['params']['id']}})[_0x2736('0x24')](handleEntityNotFound(_0x23f4b3,null))[_0x2736('0x24')](removeEntity(_0x23f4b3,null))['catch'](handleError(_0x23f4b3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 644e999..28c00dd 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 _0x671d=['api','moment','request-promise','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','../../config/logger'];(function(_0x155451,_0x41f52c){var _0x2be379=function(_0x8daaea){while(--_0x8daaea){_0x155451['push'](_0x155451['shift']());}};_0x2be379(++_0x41f52c);}(_0x671d,0x8b));var _0xd671=function(_0xd2ba55,_0x21b25a){_0xd2ba55=_0xd2ba55-0x0;var _0x3f0763=_0x671d[_0xd2ba55];return _0x3f0763;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd671('0x0'))(_0xd671('0x1'));var moment=require(_0xd671('0x2'));var BPromise=require('bluebird');var rp=require(_0xd671('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd671('0x4'));var attributes=require(_0xd671('0x5'));module[_0xd671('0x6')]=function(_0x393264,_0x2bbc44){return _0x393264[_0xd671('0x7')](_0xd671('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd671('0x9')});}; \ No newline at end of file +var _0x9140=['utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','./openchannelApplication.attributes','define','openchannel_applications'];(function(_0x480586,_0x25abcb){var _0x2c0b08=function(_0x189883){while(--_0x189883){_0x480586['push'](_0x480586['shift']());}};_0x2c0b08(++_0x25abcb);}(_0x9140,0x106));var _0x0914=function(_0x627e0a,_0x204738){_0x627e0a=_0x627e0a-0x0;var _0x4b12cb=_0x9140[_0x627e0a];return _0x4b12cb;};'use strict';var _=require(_0x0914('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0914('0x1'));var moment=require(_0x0914('0x2'));var BPromise=require(_0x0914('0x3'));var rp=require(_0x0914('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0914('0x5'));module['exports']=function(_0x41833c,_0x261dfd){return _0x41833c[_0x0914('0x6')]('OpenchannelApplication',attributes,{'tableName':_0x0914('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0914('0x8')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5c41b0b..b76f725 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 _0xd874=['limit','bluebird','ioredis','../../config/utils','rpc','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes'];(function(_0x36c405,_0x5d9124){var _0x5517e1=function(_0x10bef7){while(--_0x10bef7){_0x36c405['push'](_0x36c405['shift']());}};_0x5517e1(++_0x5d9124);}(_0xd874,0x153));var _0x4d87=function(_0x320a69,_0x9aeb8b){_0x320a69=_0x320a69-0x0;var _0x515a95=_0xd874[_0x320a69];return _0x515a95;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4d87('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d87('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d87('0x2'));var logger=require('../../config/logger')(_0x4d87('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d87('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d01c5,_0x2fe89f,_0x43292c){return new BPromise(function(_0x1a0075,_0x1a9da0){return client[_0x4d87('0x5')](_0x5d01c5,_0x43292c)[_0x4d87('0x6')](function(_0x2297da){logger['info'](_0x4d87('0x7'),_0x2fe89f,_0x4d87('0x8'));logger[_0x4d87('0x9')](_0x4d87('0xa'),_0x2fe89f,_0x4d87('0x8'),JSON[_0x4d87('0xb')](_0x2297da));if(_0x2297da['error']){if(_0x2297da[_0x4d87('0xc')][_0x4d87('0xd')]===0x1f4){logger[_0x4d87('0xc')](_0x4d87('0x7'),_0x2fe89f,_0x2297da['error'][_0x4d87('0xe')]);return _0x1a9da0(_0x2297da['error'][_0x4d87('0xe')]);}logger[_0x4d87('0xc')](_0x4d87('0x7'),_0x2fe89f,_0x2297da[_0x4d87('0xc')][_0x4d87('0xe')]);return _0x1a0075(_0x2297da[_0x4d87('0xc')]['message']);}else{logger[_0x4d87('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2fe89f,_0x4d87('0x8'));_0x1a0075(_0x2297da[_0x4d87('0x10')][_0x4d87('0xe')]);}})[_0x4d87('0x11')](function(_0x1b6272){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2fe89f,_0x1b6272);_0x1a9da0(_0x1b6272);});});}exports[_0x4d87('0x12')]=function(_0x4343fb){var _0x145aa6=this;return new Promise(function(_0x40813c,_0x59d364){return db['OpenchannelApplication'][_0x4d87('0x13')](_0x4343fb[_0x4d87('0x14')],{'raw':_0x4343fb[_0x4d87('0x15')]?_0x4343fb[_0x4d87('0x15')][_0x4d87('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4343fb[_0x4d87('0x15')]?_0x4343fb['options'][_0x4d87('0x17')]||null:null,'attributes':_0x4343fb[_0x4d87('0x15')]?_0x4343fb[_0x4d87('0x15')][_0x4d87('0x18')]||null:null,'limit':_0x4343fb[_0x4d87('0x15')]?_0x4343fb[_0x4d87('0x15')][_0x4d87('0x19')]||null:null})[_0x4d87('0x6')](function(_0x2f9f29){logger['info'](_0x4d87('0x12'),_0x4343fb);logger['debug'](_0x4d87('0x12'),_0x4343fb,JSON[_0x4d87('0xb')](_0x2f9f29));_0x40813c(_0x2f9f29);})['catch'](function(_0xc69a49){logger[_0x4d87('0xc')](_0x4d87('0x12'),_0xc69a49[_0x4d87('0xe')],_0x4343fb);_0x59d364(_0x145aa6['error'](0x1f4,_0xc69a49[_0x4d87('0xe')]));});});}; \ No newline at end of file +var _0xdf87=['info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x43ce05,_0x2719e8){var _0x2b3911=function(_0x5ec24c){while(--_0x5ec24c){_0x43ce05['push'](_0x43ce05['shift']());}};_0x2b3911(++_0x2719e8);}(_0xdf87,0xb1));var _0x7df8=function(_0x40b7c8,_0x5587e1){_0x40b7c8=_0x40b7c8-0x0;var _0x1bc629=_0xdf87[_0x40b7c8];return _0x1bc629;};'use strict';var _=require(_0x7df8('0x0'));var util=require(_0x7df8('0x1'));var moment=require(_0x7df8('0x2'));var BPromise=require(_0x7df8('0x3'));var rs=require(_0x7df8('0x4'));var fs=require('fs');var Redis=require(_0x7df8('0x5'));var db=require(_0x7df8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7df8('0x7'))('rpc');var config=require(_0x7df8('0x8'));var jayson=require(_0x7df8('0x9'));var client=jayson[_0x7df8('0xa')][_0x7df8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41107d,_0x48c82e,_0x416b9a){return new BPromise(function(_0x2585b2,_0x352027){return client['request'](_0x41107d,_0x416b9a)['then'](function(_0xa5e7a6){logger[_0x7df8('0xc')](_0x7df8('0xd'),_0x48c82e,'request\x20sent');logger['debug'](_0x7df8('0xe'),_0x48c82e,'request\x20sent',JSON[_0x7df8('0xf')](_0xa5e7a6));if(_0xa5e7a6['error']){if(_0xa5e7a6[_0x7df8('0x10')]['code']===0x1f4){logger[_0x7df8('0x10')](_0x7df8('0xd'),_0x48c82e,_0xa5e7a6[_0x7df8('0x10')][_0x7df8('0x11')]);return _0x352027(_0xa5e7a6['error']['message']);}logger[_0x7df8('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x48c82e,_0xa5e7a6['error']['message']);return _0x2585b2(_0xa5e7a6[_0x7df8('0x10')][_0x7df8('0x11')]);}else{logger[_0x7df8('0xc')](_0x7df8('0xd'),_0x48c82e,_0x7df8('0x12'));_0x2585b2(_0xa5e7a6['result']['message']);}})[_0x7df8('0x13')](function(_0x265e46){logger[_0x7df8('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x48c82e,_0x265e46);_0x352027(_0x265e46);});});}exports[_0x7df8('0x14')]=function(_0x32b66c){var _0x4598d0=this;return new Promise(function(_0x3eecab,_0x29b7ef){return db[_0x7df8('0x15')]['update'](_0x32b66c[_0x7df8('0x16')],{'raw':_0x32b66c[_0x7df8('0x17')]?_0x32b66c[_0x7df8('0x17')][_0x7df8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32b66c[_0x7df8('0x17')]?_0x32b66c[_0x7df8('0x17')]['where']||null:null,'attributes':_0x32b66c[_0x7df8('0x17')]?_0x32b66c[_0x7df8('0x17')]['attributes']||null:null,'limit':_0x32b66c[_0x7df8('0x17')]?_0x32b66c[_0x7df8('0x17')][_0x7df8('0x19')]||null:null})['then'](function(_0x743080){logger[_0x7df8('0xc')]('UpdateOpenchannelApplication',_0x32b66c);logger[_0x7df8('0x1a')](_0x7df8('0x14'),_0x32b66c,JSON[_0x7df8('0xf')](_0x743080));_0x3eecab(_0x743080);})['catch'](function(_0x4aa5a8){logger[_0x7df8('0x10')](_0x7df8('0x14'),_0x4aa5a8[_0x7df8('0x11')],_0x32b66c);_0x29b7ef(_0x4598d0[_0x7df8('0x10')](0x1f4,_0x4aa5a8[_0x7df8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a8c85b7..3bbea79 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 _0x6e2b=['show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','openchannel','openchannelinteraction:addtags','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5ee6bf,_0x28eb2e){var _0x6f02df=function(_0xed68eb){while(--_0xed68eb){_0x5ee6bf['push'](_0x5ee6bf['shift']());}};_0x6f02df(++_0x28eb2e);}(_0x6e2b,0x12f));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb6e2('0x0'));var util=require(_0xb6e2('0x1'));var path=require(_0xb6e2('0x2'));var timeout=require(_0xb6e2('0x3'));var express=require(_0xb6e2('0x4'));var router=express[_0xb6e2('0x5')]();var fs_extra=require(_0xb6e2('0x6'));var auth=require(_0xb6e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb6e2('0x8'));var controller=require(_0xb6e2('0x9'));router[_0xb6e2('0xa')]('/',auth[_0xb6e2('0xb')](),controller[_0xb6e2('0xc')]);router[_0xb6e2('0xa')](_0xb6e2('0xd'),auth[_0xb6e2('0xb')](),controller[_0xb6e2('0xe')]);router[_0xb6e2('0xa')](_0xb6e2('0xf'),auth[_0xb6e2('0xb')](),controller[_0xb6e2('0x10')]);router[_0xb6e2('0xa')](_0xb6e2('0x11'),auth[_0xb6e2('0xb')](),controller[_0xb6e2('0x12')]);router[_0xb6e2('0xa')](_0xb6e2('0x13'),auth['isAuthenticated'](),controller[_0xb6e2('0x14')]);router['post']('/',auth[_0xb6e2('0xb')](),controller[_0xb6e2('0x15')]);router['post'](_0xb6e2('0x11'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xb6e2('0x16'),auth[_0xb6e2('0xb')](),interaction['tracked'](_0xb6e2('0x17'),_0xb6e2('0x18')),controller['addTags']);router['put'](_0xb6e2('0xf'),auth['isAuthenticated'](),interaction[_0xb6e2('0x19')]('openchannel',_0xb6e2('0x1a')),controller['update']);router[_0xb6e2('0x1b')](_0xb6e2('0xf'),auth[_0xb6e2('0xb')](),interaction[_0xb6e2('0x19')](_0xb6e2('0x17'),_0xb6e2('0x1c')),controller['destroy']);router[_0xb6e2('0x1b')]('/:id/tags',auth[_0xb6e2('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x2c41=['openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','get','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x4399f4,_0xd5ac1a){var _0x5e7341=function(_0x5a64a7){while(--_0x5a64a7){_0x4399f4['push'](_0x4399f4['shift']());}};_0x5e7341(++_0xd5ac1a);}(_0x2c41,0xe1));var _0x12c4=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x2c41[_0x44039a];return _0x525de5;};'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[_0x12c4('0x4')]();var fs_extra=require(_0x12c4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x12c4('0x6'));var config=require(_0x12c4('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x12c4('0x8')](),controller[_0x12c4('0x9')]);router['get'](_0x12c4('0xa'),auth[_0x12c4('0x8')](),controller[_0x12c4('0xb')]);router['get'](_0x12c4('0xc'),auth[_0x12c4('0x8')](),controller['show']);router[_0x12c4('0xd')](_0x12c4('0xe'),auth[_0x12c4('0x8')](),controller[_0x12c4('0xf')]);router['get'](_0x12c4('0x10'),auth['isAuthenticated'](),controller[_0x12c4('0x11')]);router[_0x12c4('0x12')]('/',auth[_0x12c4('0x8')](),controller[_0x12c4('0x13')]);router[_0x12c4('0x12')]('/:id/messages',auth[_0x12c4('0x8')](),controller[_0x12c4('0x14')]);router[_0x12c4('0x12')](_0x12c4('0x15'),auth['isAuthenticated'](),interaction[_0x12c4('0x16')](_0x12c4('0x17'),_0x12c4('0x18')),controller[_0x12c4('0x19')]);router['put'](_0x12c4('0xc'),auth['isAuthenticated'](),interaction[_0x12c4('0x16')](_0x12c4('0x17'),_0x12c4('0x1a')),controller[_0x12c4('0x1b')]);router[_0x12c4('0x1c')](_0x12c4('0xc'),auth[_0x12c4('0x8')](),interaction[_0x12c4('0x16')](_0x12c4('0x17'),_0x12c4('0x1d')),controller['destroy']);router[_0x12c4('0x1c')]('/:id/tags',auth[_0x12c4('0x8')](),controller[_0x12c4('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5df8fb9..aa852ac 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 _0x02ce=['DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','STRING'];(function(_0x4721e9,_0x1b221f){var _0x2171e0=function(_0x4a8ee9){while(--_0x4a8ee9){_0x4721e9['push'](_0x4721e9['shift']());}};_0x2171e0(++_0x1b221f);}(_0x02ce,0x1ac));var _0xe02c=function(_0xf2f0e8,_0x1dfedd){_0xf2f0e8=_0xf2f0e8-0x0;var _0x203212=_0x02ce[_0xf2f0e8];return _0x203212;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'closed':{'type':Sequelize[_0xe02c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe02c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe02c('0x3')]},'note':{'type':Sequelize[_0xe02c('0x3')]},'read1stAt':{'type':Sequelize[_0xe02c('0x4')]},'threadId':{'type':Sequelize[_0xe02c('0x3')]},'externalUrl':{'type':Sequelize[_0xe02c('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe02c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe02c('0x5')]('in',_0xe02c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe02c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xe02c('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe02c('0x7')]}}; \ No newline at end of file +var _0x0e24=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0x0e24,0x1da));var _0x40e2=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0e24[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x40e2('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x40e2('0x1')]},'disposition':{'type':Sequelize[_0x40e2('0x2')]},'secondDisposition':{'type':Sequelize[_0x40e2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x40e2('0x2')]},'note':{'type':Sequelize[_0x40e2('0x2')]},'read1stAt':{'type':Sequelize[_0x40e2('0x1')]},'threadId':{'type':Sequelize[_0x40e2('0x2')]},'externalUrl':{'type':Sequelize[_0x40e2('0x2')]},'lastMsgAt':{'type':Sequelize[_0x40e2('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x40e2('0x3')]('in',_0x40e2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x40e2('0x3')]('in',_0x40e2('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x40e2('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x40e2('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7a7cd4a..3d04009 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 _0x165e=['renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','index','OpenchannelInteraction','fieldName','type','getOptions','openchannel','catch','query','params','keys','filters','model','attributes','intersection','fields','includeAll','include','merge','options','find','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','rawAttributes','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','User','push','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','N.A.','createdAt','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value'];(function(_0xea9e1c,_0x577088){var _0x3bdb61=function(_0x35e3c1){while(--_0x35e3c1){_0xea9e1c['push'](_0xea9e1c['shift']());}};_0x3bdb61(++_0x577088);}(_0x165e,0x85));var _0xe165=function(_0x3a05cc,_0x2ea1f1){_0x3a05cc=_0x3a05cc-0x0;var _0x3d63a1=_0x165e[_0x3a05cc];return _0x3d63a1;};'use strict';var rimraf=require(_0xe165('0x0'));var zipdir=require(_0xe165('0x1'));var moment=require(_0xe165('0x2'));var util=require(_0xe165('0x3'));var path=require('path');var ejs=require(_0xe165('0x4'));var fs=require('fs');var _=require(_0xe165('0x5'));var Redis=require(_0xe165('0x6'));var interaction=require(_0xe165('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe165('0x8'));var logger=require(_0xe165('0x9'))('api');var config=require('../../config/environment');var db=require(_0xe165('0xa'))['db'];config[_0xe165('0xb')]=_['defaults'](config[_0xe165('0xb')],{'host':_0xe165('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe165('0xb')]));require(_0xe165('0xd'))[_0xe165('0xe')](socket);function respondWithStatusCode(_0x56c7b6,_0x250474){_0x250474=_0x250474||0xcc;return function(_0x10ef66){if(_0x10ef66){return _0x56c7b6['sendStatus'](_0x250474);}return _0x56c7b6[_0xe165('0xf')](_0x250474)[_0xe165('0x10')]();};}function respondWithResult(_0x1fc581,_0x82bbbf){_0x82bbbf=_0x82bbbf||0xc8;return function(_0x464d6e){if(_0x464d6e){return _0x1fc581['status'](_0x82bbbf)[_0xe165('0x11')](_0x464d6e);}};}function respondWithFilteredResult(_0x86eea9,_0x54cdd6){return function(_0xb4e5db){if(_0xb4e5db){var _0x2455bd=typeof _0x54cdd6[_0xe165('0x12')]===_0xe165('0x13')&&typeof _0x54cdd6[_0xe165('0x14')]==='undefined';var _0x37e2eb=_0xb4e5db[_0xe165('0x15')];var _0xc626d8=_0x2455bd?0x0:_0x54cdd6[_0xe165('0x12')];var _0x58d325=_0x2455bd?_0xb4e5db['count']:_0x54cdd6[_0xe165('0x12')]+_0x54cdd6[_0xe165('0x14')];var _0xbf8267;if(_0x58d325>=_0x37e2eb){_0x58d325=_0x37e2eb;_0xbf8267=0xc8;}else{_0xbf8267=0xce;}_0x86eea9['status'](_0xbf8267);return _0x86eea9[_0xe165('0x16')](_0xe165('0x17'),_0xc626d8+'-'+_0x58d325+'/'+_0x37e2eb)[_0xe165('0x11')](_0xb4e5db);}return null;};}function saveUpdates(_0x954243){return function(_0x51872a){if(_0x51872a){return _0x51872a['update'](_0x954243)[_0xe165('0x18')](function(_0x5beeab){return _0x5beeab;});}return null;};}function removeEntity(_0x2664f5){return function(_0x4e0b63){if(_0x4e0b63){return _0x4e0b63['destroy']()[_0xe165('0x18')](function(){_0x2664f5[_0xe165('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe43d67){return function(_0x41a73e){if(!_0x41a73e){_0xe43d67['sendStatus'](0x194);}return _0x41a73e;};}function handleError(_0x5eba6d,_0x27b422){_0x27b422=_0x27b422||0x1f4;return function(_0x5d8375){logger[_0xe165('0x19')](_0x5d8375[_0xe165('0x1a')]);if(_0x5d8375['name']){delete _0x5d8375[_0xe165('0x1b')];}_0x5eba6d['status'](_0x27b422)['send'](_0x5d8375);};}exports[_0xe165('0x1c')]=function(_0x56fb5f,_0x308324){var _0x3cd281={};var _0x54bdee=_['map'](db[_0xe165('0x1d')]['rawAttributes'],function(_0x3e6449){return{'name':_0x3e6449[_0xe165('0x1e')],'type':_0x3e6449[_0xe165('0x1f')]['key']};});_0x3cd281=qs[_0xe165('0x20')](_0x54bdee,_0x56fb5f);return interaction['findAll'](_0xe165('0x21'),_0x56fb5f['query'],_0x56fb5f['user'],_0x3cd281,_0x54bdee)[_0xe165('0x18')](respondWithFilteredResult(_0x308324,_0x3cd281))[_0xe165('0x22')](handleError(_0x308324,null));};exports['show']=function(_0x434bad,_0x4316db){var _0x3b9831={};if(_0x434bad[_0xe165('0x23')][_0xe165('0x1f')]&&_0x434bad['query']['type']==='from'){_0x3b9831['from']=_0x434bad[_0xe165('0x24')]['id'];}else{_0x3b9831['id']=_0x434bad[_0xe165('0x24')]['id'];}var _0x25ee1c={'raw':![],'where':_0x3b9831},_0xf472e={};_0xf472e['model']=_[_0xe165('0x25')](db['OpenchannelInteraction']['rawAttributes']);_0xf472e[_0xe165('0x23')]=_['keys'](_0x434bad[_0xe165('0x23')]);_0xf472e[_0xe165('0x26')]=_['intersection'](_0xf472e[_0xe165('0x27')],_0xf472e[_0xe165('0x23')]);_0x25ee1c[_0xe165('0x28')]=_[_0xe165('0x29')](_0xf472e[_0xe165('0x27')],qs[_0xe165('0x2a')](_0x434bad['query'][_0xe165('0x2a')]));_0x25ee1c['attributes']=_0x25ee1c[_0xe165('0x28')]['length']?_0x25ee1c[_0xe165('0x28')]:_0xf472e[_0xe165('0x27')];if(_0x434bad[_0xe165('0x23')][_0xe165('0x2b')]){_0x25ee1c[_0xe165('0x2c')]=[{'all':!![]}];}_0x25ee1c=_[_0xe165('0x2d')]({},_0x25ee1c,_0x434bad[_0xe165('0x2e')]);return db[_0xe165('0x1d')][_0xe165('0x2f')](_0x25ee1c)[_0xe165('0x18')](handleEntityNotFound(_0x4316db,null))[_0xe165('0x18')](respondWithResult(_0x4316db,null))[_0xe165('0x22')](handleError(_0x4316db,null));};exports['create']=function(_0x2a1193,_0x36baac){return db['OpenchannelInteraction']['create'](_0x2a1193['body'],{})['then'](respondWithResult(_0x36baac,0xc9))[_0xe165('0x22')](handleError(_0x36baac,null));};exports['update']=function(_0x29b96a,_0x2701ad){if(_0x29b96a[_0xe165('0x30')]['id']){delete _0x29b96a[_0xe165('0x30')]['id'];}return db[_0xe165('0x1d')][_0xe165('0x2f')]({'where':{'id':_0x29b96a[_0xe165('0x24')]['id']}})[_0xe165('0x18')](handleEntityNotFound(_0x2701ad,null))[_0xe165('0x18')](saveUpdates(_0x29b96a[_0xe165('0x30')],null))[_0xe165('0x18')](respondWithResult(_0x2701ad,null))[_0xe165('0x22')](handleError(_0x2701ad,null));};exports['destroy']=function(_0x4530f9,_0x5a68aa){return db[_0xe165('0x1d')][_0xe165('0x2f')]({'where':{'id':_0x4530f9[_0xe165('0x24')]['id']}})[_0xe165('0x18')](handleEntityNotFound(_0x5a68aa,null))[_0xe165('0x18')](removeEntity(_0x5a68aa,null))[_0xe165('0x22')](handleError(_0x5a68aa,null));};exports[_0xe165('0x31')]=function(_0x54b39c,_0x279c8b){return db[_0xe165('0x1d')]['describe']()[_0xe165('0x18')](respondWithResult(_0x279c8b,null))['catch'](handleError(_0x279c8b,null));};exports[_0xe165('0x32')]=function(_0x5b7ed5,_0x1a0b7b){return db['OpenchannelMessage'][_0xe165('0x2f')]({'where':{'id':_0x5b7ed5[_0xe165('0x24')]['id']}})[_0xe165('0x18')](handleEntityNotFound(_0x1a0b7b,null))[_0xe165('0x18')](function(_0x166b04){if(_0x166b04){return _0x166b04[_0xe165('0x32')](_0x5b7ed5['body'][_0xe165('0x33')],_[_0xe165('0x34')](_0x5b7ed5[_0xe165('0x30')],[_0xe165('0x33'),'id'])||{});}})[_0xe165('0x18')](respondWithResult(_0x1a0b7b,null))[_0xe165('0x22')](handleError(_0x1a0b7b,null));};exports[_0xe165('0x35')]=function(_0x4bbe8b,_0x19a6dd){var _0x292b2a={'raw':![],'where':{}};var _0x1a2425={};var _0x2d21a0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xe165('0x36')]({'where':{'id':_0x4bbe8b[_0xe165('0x24')]['id']}})['then'](handleEntityNotFound(_0x19a6dd,null))[_0xe165('0x18')](function(_0x400187){if(_0x400187){_0x1a2425['model']=_[_0xe165('0x25')](db[_0xe165('0x37')][_0xe165('0x38')]);_0x1a2425[_0xe165('0x23')]=_[_0xe165('0x25')](_0x4bbe8b[_0xe165('0x23')]);_0x1a2425[_0xe165('0x26')]=_[_0xe165('0x29')](_0x1a2425['model'],_0x1a2425[_0xe165('0x23')]);_0x292b2a[_0xe165('0x28')]=_[_0xe165('0x29')](_0x1a2425['model'],qs[_0xe165('0x2a')](_0x4bbe8b[_0xe165('0x23')]['fields']));_0x292b2a[_0xe165('0x28')]=_0x292b2a['attributes'][_0xe165('0x39')]?_0x292b2a[_0xe165('0x28')]:_0x1a2425[_0xe165('0x27')];if(!_0x4bbe8b['query'][_0xe165('0x3a')](_0xe165('0x3b'))){_0x292b2a[_0xe165('0x14')]=qs['limit'](_0x4bbe8b[_0xe165('0x23')][_0xe165('0x14')]);_0x292b2a[_0xe165('0x12')]=qs[_0xe165('0x12')](_0x4bbe8b['query']['offset']);}_0x292b2a[_0xe165('0x3c')]=qs['sort'](_0x4bbe8b[_0xe165('0x23')][_0xe165('0x3d')]);_0x292b2a[_0xe165('0x3e')]=qs['filters'](_['pick'](_0x4bbe8b[_0xe165('0x23')],_0x1a2425[_0xe165('0x26')]));_0x292b2a['where'][_0xe165('0x3f')]=_0x400187['id'];if(_0x4bbe8b[_0xe165('0x23')][_0xe165('0x40')]){_0x292b2a['where']=_['merge'](_0x292b2a[_0xe165('0x3e')],{'$or':_[_0xe165('0x41')](_0x292b2a[_0xe165('0x28')],function(_0x370e89){var _0x25fd9f={};_0x25fd9f[_0x370e89]={'$like':'%'+_0x4bbe8b['query']['filter']+'%'};return _0x25fd9f;})});}if(_0x4bbe8b['query'][_0xe165('0x42')]){var _0x77fb4f=_0x4bbe8b[_0xe165('0x23')][_0xe165('0x42')][_0xe165('0x43')](',');var _0x481a85={};_0x481a85[_0x77fb4f[0x0]]={'$gte':moment(_0x77fb4f[0x1])[_0xe165('0x44')](_0xe165('0x45'))};_0x292b2a['where']=_[_0xe165('0x2d')](_0x292b2a[_0xe165('0x3e')],_0x481a85);}_0x292b2a=_['merge']({},_0x292b2a,_0x4bbe8b[_0xe165('0x2e')]);return db[_0xe165('0x37')][_0xe165('0x15')]({'where':_0x292b2a[_0xe165('0x3e')]})[_0xe165('0x18')](function(_0x2cff54){_0x2d21a0[_0xe165('0x15')]=_0x2cff54;if(_0x4bbe8b['query']['includeAll']){_0x292b2a[_0xe165('0x2c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe165('0x46')](_0x292b2a);})[_0xe165('0x18')](function(_0x402747){_0x2d21a0['rows']=_0x402747;return _0x2d21a0;});}})[_0xe165('0x18')](respondWithFilteredResult(_0x19a6dd,_0x292b2a))['catch'](handleError(_0x19a6dd,null));};exports[_0xe165('0x47')]=function(_0x4440e2,_0xc92218){return db[_0xe165('0x1d')][_0xe165('0x2f')]({'where':{'id':_0x4440e2['params']['id']}})[_0xe165('0x18')](handleEntityNotFound(_0xc92218,null))[_0xe165('0x18')](function(_0x23ed93){if(_0x23ed93){return _0x23ed93[_0xe165('0x48')](_0x4440e2['body'][_0xe165('0x33')],_[_0xe165('0x34')](_0x4440e2[_0xe165('0x30')],[_0xe165('0x33'),'id'])||{})[_0xe165('0x49')](function(){return db[_0xe165('0x4a')][_0xe165('0x46')]({'attributes':['id','name',_0xe165('0x4b')],'where':{'id':_0x4440e2[_0xe165('0x30')][_0xe165('0x33')]}});})[_0xe165('0x18')](function(_0x3d7071){socket[_0xe165('0x4c')]('openchannelInteractionTags:save',{'id':Number(_0x4440e2[_0xe165('0x24')]['id']),'tags':_0x3d7071||[]});return{'id':Number(_0x4440e2[_0xe165('0x24')]['id']),'tags':_0x3d7071||[]};});}})[_0xe165('0x18')](respondWithResult(_0xc92218,null))['catch'](handleError(_0xc92218,null));};exports[_0xe165('0x4d')]=function(_0xe4eedb,_0x132d3b){return db[_0xe165('0x1d')][_0xe165('0x2f')]({'where':{'id':_0xe4eedb[_0xe165('0x24')]['id']}})[_0xe165('0x18')](handleEntityNotFound(_0x132d3b,null))[_0xe165('0x18')](function(_0x2adc87){if(_0x2adc87){return _0x2adc87[_0xe165('0x4d')](_0xe4eedb[_0xe165('0x23')][_0xe165('0x33')]);}})[_0xe165('0x18')](respondWithStatusCode(_0x132d3b,null))['catch'](handleError(_0x132d3b,null));};exports[_0xe165('0x4e')]=function(_0x594f12,_0x476eb0){var _0x8abb9e=moment()[_0xe165('0x4f')]()[_0xe165('0x50')]();var _0x31f4eb=path[_0xe165('0x51')](config[_0xe165('0x52')],_0xe165('0x53'),_0xe165('0x54'),_0xe165('0x55'));var _0x3d15ab=path[_0xe165('0x51')](config['root'],_0xe165('0x53'),_0xe165('0x54'),_0xe165('0x56'));var _0x4ab668=path[_0xe165('0x51')](_0x31f4eb,_0x8abb9e);var _0x185b80=util[_0xe165('0x44')]('transcript-%d-%s.zip',_0x594f12['params']['id'],_0x8abb9e);var _0x799818=path[_0xe165('0x51')](_0x31f4eb,_0x185b80);var _0xaccac6=[];_0xaccac6['push']({'model':db['User'],'as':_0xe165('0x57'),'attributes':['id','fullname'],'raw':!![]});_0xaccac6[_0xe165('0x58')]({'model':db['CmContact'],'as':_0xe165('0x59'),'attributes':['id',_0xe165('0x5a'),_0xe165('0x5b')],'raw':!![]});if(_0x594f12['query'][_0xe165('0x56')]){_0xaccac6[_0xe165('0x58')]({'model':db[_0xe165('0x5c')],'as':_0xe165('0x5c'),'raw':!![]});}var _0x394795=[{'model':db[_0xe165('0x37')],'as':_0xe165('0x5d'),'attributes':['id',_0xe165('0x30'),'createdAt',_0xe165('0x5e'),_0xe165('0x5f'),_0xe165('0x60')],'include':_0xaccac6}];_0x394795[_0xe165('0x58')]({'model':db[_0xe165('0x61')],'as':_0xe165('0x62'),'attributes':['id',_0xe165('0x1b')]});_0x394795[_0xe165('0x58')]({'model':db[_0xe165('0x57')],'as':_0xe165('0x63'),'attributes':['id',_0xe165('0x64')]});return db[_0xe165('0x1d')]['find']({'where':{'id':_0x594f12[_0xe165('0x24')]['id']},'include':_0x394795})[_0xe165('0x18')](handleEntityNotFound(_0x476eb0,null))['then'](function(_0x10edeb){if(_0x10edeb){var _0x282ff6=_0x10edeb[_0xe165('0x65')]({'plain':!![]});fs[_0xe165('0x66')](_0x4ab668);var _0xdd123e={'channel':_0xe165('0x67'),'account':_0x282ff6[_0xe165('0x62')]['name'],'agent':_0x282ff6[_0xe165('0x63')]?_0x282ff6[_0xe165('0x63')][_0xe165('0x64')]:_0xe165('0x68'),'createdAt':moment(_0x282ff6[_0xe165('0x69')])[_0xe165('0x44')](_0xe165('0x45'))[_0xe165('0x50')](),'closedAt':_0x282ff6[_0xe165('0x6a')]?moment(_0x282ff6[_0xe165('0x6b')])[_0xe165('0x44')](_0xe165('0x45'))[_0xe165('0x50')]():'','disposition':_0x282ff6['disposition'],'visibility':_0x282ff6[_0xe165('0x6c')]?_0xe165('0x6d'):_0xe165('0x6e'),'messages':_(_0x282ff6['Messages'])[_0xe165('0x40')]({'secret':![]})[_0xe165('0x41')](function(_0x1fe7ff){if(_0x1fe7ff[_0xe165('0x5c')]){var _0x19d028=path[_0xe165('0x51')](_0x3d15ab,_0x1fe7ff['Attachment'][_0xe165('0x6f')]);if(fs[_0xe165('0x70')](_0x19d028)){fs[_0xe165('0x71')](_0x19d028)[_0xe165('0x72')](fs[_0xe165('0x73')](path[_0xe165('0x51')](_0x4ab668,_0x1fe7ff[_0xe165('0x5c')]['basename'])));}}return{'date':moment(_0x1fe7ff['createdAt'])[_0xe165('0x44')](_0xe165('0x45'))[_0xe165('0x50')](),'sender':_0x1fe7ff[_0xe165('0x5e')]===_0xe165('0x74')?_0x1fe7ff[_0xe165('0x57')]?_0x1fe7ff['User'][_0xe165('0x64')]:_0xe165('0x75'):_0x1fe7ff[_0xe165('0x59')][_0xe165('0x5a')]+(_0x1fe7ff[_0xe165('0x59')][_0xe165('0x5b')]?'\x20'+_0x1fe7ff[_0xe165('0x59')][_0xe165('0x5b')]:''),'body':_0x1fe7ff[_0xe165('0x5c')]?_0x1fe7ff['Attachment']['basename']:_0x1fe7ff[_0xe165('0x30')],'direction':_0x1fe7ff[_0xe165('0x5e')]===_0xe165('0x74')?'A':'C','secret':_0x1fe7ff[_0xe165('0x5f')],'read':_0x1fe7ff[_0xe165('0x60')],'attachment':_0x1fe7ff[_0xe165('0x5c')]};})[_0xe165('0x76')]()};return ejs[_0xe165('0x77')](path[_0xe165('0x51')](config[_0xe165('0x52')],_0xe165('0x53'),_0xe165('0x78'),'downloadInteraction.ejs'),{'interaction':_0xdd123e})[_0xe165('0x18')](function(_0x5916fa){var _0x44c7cc=path[_0xe165('0x51')](_0x4ab668,_0xe165('0x79')+_0x282ff6['id']+'-'+_0x8abb9e+_0xe165('0x7a'));var _0x55c5dd={'path':_0x44c7cc,'channel':'Openchannel','interactionId':_0x282ff6['id']};return pdf[_0xe165('0x7b')](_0x5916fa,_0x55c5dd);})[_0xe165('0x18')](function(){return new Promise(function(_0x52a265,_0x4519e1){zipdir(_0x4ab668,{'saveTo':_0x799818},function(_0x15c179,_0x1dcce4){if(_0x15c179)return _0x4519e1(_0x15c179);return _0x52a265(_0x1dcce4);});})['then'](function(){return new Promise(function(_0x3e1b5b,_0x5225b0){rimraf(_0x4ab668,function(_0x2e06b6){if(_0x2e06b6)_0x5225b0(_0x2e06b6);return _0x3e1b5b();});});})[_0xe165('0x18')](function(){return _0x476eb0[_0xe165('0x4e')](_0x799818,_0x185b80,function(_0x6b8284){if(_0x6b8284){logger[_0xe165('0x19')](_0xe165('0x7c'),_0x6b8284);}else{fs['unlinkSync'](_0x799818);}});});});}else{return _0x476eb0[_0xe165('0x7d')](0xc8);}})[_0xe165('0x22')](handleError(_0x476eb0,null));}; \ No newline at end of file +var _0xc6f0=['closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','openchannel','user','catch','show','query','from','params','keys','filters','attributes','intersection','model','fields','include','merge','create','body','find','describe','OpenchannelMessage','ids','getMessages','length','order','pick','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','setTags','spread','Tag','emit','removeTags','download','toString','join','root','files','server','attachments','format','User','fullname','CmContact','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closed'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc6f0,0x10f));var _0x0c6f=function(_0x5b215f,_0x1ebfaf){_0x5b215f=_0x5b215f-0x0;var _0xa5c17b=_0xc6f0[_0x5b215f];return _0xa5c17b;};'use strict';var rimraf=require(_0x0c6f('0x0'));var zipdir=require(_0x0c6f('0x1'));var moment=require(_0x0c6f('0x2'));var util=require(_0x0c6f('0x3'));var path=require(_0x0c6f('0x4'));var ejs=require(_0x0c6f('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0c6f('0x6'));var interaction=require(_0x0c6f('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0c6f('0x8'));var logger=require(_0x0c6f('0x9'))(_0x0c6f('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0c6f('0xb')](config['redis'],{'host':_0x0c6f('0xc'),'port':0x18eb});var socket=require(_0x0c6f('0xd'))(new Redis(config[_0x0c6f('0xe')]));require(_0x0c6f('0xf'))['register'](socket);function respondWithStatusCode(_0x399fae,_0x1ee041){_0x1ee041=_0x1ee041||0xcc;return function(_0x21174a){if(_0x21174a){return _0x399fae[_0x0c6f('0x10')](_0x1ee041);}return _0x399fae[_0x0c6f('0x11')](_0x1ee041)[_0x0c6f('0x12')]();};}function respondWithResult(_0x436d10,_0x1534bb){_0x1534bb=_0x1534bb||0xc8;return function(_0x43cdff){if(_0x43cdff){return _0x436d10[_0x0c6f('0x11')](_0x1534bb)['json'](_0x43cdff);}};}function respondWithFilteredResult(_0x5af0a4,_0x10b457){return function(_0x53f5ba){if(_0x53f5ba){var _0x3b7f0e=typeof _0x10b457[_0x0c6f('0x13')]===_0x0c6f('0x14')&&typeof _0x10b457[_0x0c6f('0x15')]===_0x0c6f('0x14');var _0x1b8721=_0x53f5ba[_0x0c6f('0x16')];var _0xd1f439=_0x3b7f0e?0x0:_0x10b457['offset'];var _0xc183ba=_0x3b7f0e?_0x53f5ba[_0x0c6f('0x16')]:_0x10b457[_0x0c6f('0x13')]+_0x10b457[_0x0c6f('0x15')];var _0x43f167;if(_0xc183ba>=_0x1b8721){_0xc183ba=_0x1b8721;_0x43f167=0xc8;}else{_0x43f167=0xce;}_0x5af0a4[_0x0c6f('0x11')](_0x43f167);return _0x5af0a4['set'](_0x0c6f('0x17'),_0xd1f439+'-'+_0xc183ba+'/'+_0x1b8721)[_0x0c6f('0x18')](_0x53f5ba);}return null;};}function saveUpdates(_0x316871){return function(_0x200420){if(_0x200420){return _0x200420[_0x0c6f('0x19')](_0x316871)[_0x0c6f('0x1a')](function(_0x3ee4ff){return _0x3ee4ff;});}return null;};}function removeEntity(_0x77b92c){return function(_0x226a9a){if(_0x226a9a){return _0x226a9a[_0x0c6f('0x1b')]()[_0x0c6f('0x1a')](function(){_0x77b92c[_0x0c6f('0x11')](0xcc)[_0x0c6f('0x12')]();});}};}function handleEntityNotFound(_0x4bced3){return function(_0x2e0ed0){if(!_0x2e0ed0){_0x4bced3[_0x0c6f('0x10')](0x194);}return _0x2e0ed0;};}function handleError(_0x57c600,_0x4c8845){_0x4c8845=_0x4c8845||0x1f4;return function(_0xed9c5a){logger[_0x0c6f('0x1c')](_0xed9c5a[_0x0c6f('0x1d')]);if(_0xed9c5a[_0x0c6f('0x1e')]){delete _0xed9c5a[_0x0c6f('0x1e')];}_0x57c600[_0x0c6f('0x11')](_0x4c8845)[_0x0c6f('0x1f')](_0xed9c5a);};}exports[_0x0c6f('0x20')]=function(_0x14740d,_0xdf0e04){var _0x1866d8={};var _0x5283b0=_[_0x0c6f('0x21')](db[_0x0c6f('0x22')][_0x0c6f('0x23')],function(_0x1621a5){return{'name':_0x1621a5[_0x0c6f('0x24')],'type':_0x1621a5[_0x0c6f('0x25')][_0x0c6f('0x26')]};});_0x1866d8=qs[_0x0c6f('0x27')](_0x5283b0,_0x14740d);return interaction['findAll'](_0x0c6f('0x28'),_0x14740d['query'],_0x14740d[_0x0c6f('0x29')],_0x1866d8,_0x5283b0)[_0x0c6f('0x1a')](respondWithFilteredResult(_0xdf0e04,_0x1866d8))[_0x0c6f('0x2a')](handleError(_0xdf0e04,null));};exports[_0x0c6f('0x2b')]=function(_0xfe336,_0xc6b108){var _0x15a369={};if(_0xfe336[_0x0c6f('0x2c')]['type']&&_0xfe336[_0x0c6f('0x2c')][_0x0c6f('0x25')]==='from'){_0x15a369[_0x0c6f('0x2d')]=_0xfe336[_0x0c6f('0x2e')]['id'];}else{_0x15a369['id']=_0xfe336['params']['id'];}var _0x32008f={'raw':![],'where':_0x15a369},_0x420718={};_0x420718['model']=_['keys'](db[_0x0c6f('0x22')][_0x0c6f('0x23')]);_0x420718[_0x0c6f('0x2c')]=_[_0x0c6f('0x2f')](_0xfe336[_0x0c6f('0x2c')]);_0x420718[_0x0c6f('0x30')]=_['intersection'](_0x420718['model'],_0x420718[_0x0c6f('0x2c')]);_0x32008f[_0x0c6f('0x31')]=_[_0x0c6f('0x32')](_0x420718[_0x0c6f('0x33')],qs[_0x0c6f('0x34')](_0xfe336['query'][_0x0c6f('0x34')]));_0x32008f[_0x0c6f('0x31')]=_0x32008f[_0x0c6f('0x31')]['length']?_0x32008f['attributes']:_0x420718[_0x0c6f('0x33')];if(_0xfe336[_0x0c6f('0x2c')]['includeAll']){_0x32008f[_0x0c6f('0x35')]=[{'all':!![]}];}_0x32008f=_[_0x0c6f('0x36')]({},_0x32008f,_0xfe336['options']);return db[_0x0c6f('0x22')]['find'](_0x32008f)[_0x0c6f('0x1a')](handleEntityNotFound(_0xc6b108,null))[_0x0c6f('0x1a')](respondWithResult(_0xc6b108,null))[_0x0c6f('0x2a')](handleError(_0xc6b108,null));};exports[_0x0c6f('0x37')]=function(_0x5c5b5c,_0x546efd){return db[_0x0c6f('0x22')][_0x0c6f('0x37')](_0x5c5b5c[_0x0c6f('0x38')],{})[_0x0c6f('0x1a')](respondWithResult(_0x546efd,0xc9))[_0x0c6f('0x2a')](handleError(_0x546efd,null));};exports[_0x0c6f('0x19')]=function(_0x2b165c,_0x79decc){if(_0x2b165c[_0x0c6f('0x38')]['id']){delete _0x2b165c[_0x0c6f('0x38')]['id'];}return db[_0x0c6f('0x22')][_0x0c6f('0x39')]({'where':{'id':_0x2b165c['params']['id']}})[_0x0c6f('0x1a')](handleEntityNotFound(_0x79decc,null))[_0x0c6f('0x1a')](saveUpdates(_0x2b165c[_0x0c6f('0x38')],null))['then'](respondWithResult(_0x79decc,null))[_0x0c6f('0x2a')](handleError(_0x79decc,null));};exports['destroy']=function(_0x46852b,_0x2e5932){return db[_0x0c6f('0x22')][_0x0c6f('0x39')]({'where':{'id':_0x46852b['params']['id']}})[_0x0c6f('0x1a')](handleEntityNotFound(_0x2e5932,null))[_0x0c6f('0x1a')](removeEntity(_0x2e5932,null))[_0x0c6f('0x2a')](handleError(_0x2e5932,null));};exports['describe']=function(_0x46356a,_0x17903b){return db['OpenchannelInteraction'][_0x0c6f('0x3a')]()[_0x0c6f('0x1a')](respondWithResult(_0x17903b,null))[_0x0c6f('0x2a')](handleError(_0x17903b,null));};exports['addMessage']=function(_0xdc2d84,_0x5be25b){return db[_0x0c6f('0x3b')]['find']({'where':{'id':_0xdc2d84['params']['id']}})[_0x0c6f('0x1a')](handleEntityNotFound(_0x5be25b,null))['then'](function(_0x550d25){if(_0x550d25){return _0x550d25['addMessage'](_0xdc2d84['body'][_0x0c6f('0x3c')],_['omit'](_0xdc2d84[_0x0c6f('0x38')],[_0x0c6f('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x5be25b,null))[_0x0c6f('0x2a')](handleError(_0x5be25b,null));};exports[_0x0c6f('0x3d')]=function(_0x3fabac,_0x1a557c){var _0x3308d3={'raw':![],'where':{}};var _0x2d1487={};var _0x4e4fc6={'count':0x0,'rows':[]};return db[_0x0c6f('0x22')]['findOne']({'where':{'id':_0x3fabac[_0x0c6f('0x2e')]['id']}})[_0x0c6f('0x1a')](handleEntityNotFound(_0x1a557c,null))['then'](function(_0x1b05e0){if(_0x1b05e0){_0x2d1487[_0x0c6f('0x33')]=_[_0x0c6f('0x2f')](db[_0x0c6f('0x3b')][_0x0c6f('0x23')]);_0x2d1487[_0x0c6f('0x2c')]=_['keys'](_0x3fabac['query']);_0x2d1487[_0x0c6f('0x30')]=_['intersection'](_0x2d1487['model'],_0x2d1487[_0x0c6f('0x2c')]);_0x3308d3['attributes']=_[_0x0c6f('0x32')](_0x2d1487[_0x0c6f('0x33')],qs['fields'](_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x34')]));_0x3308d3['attributes']=_0x3308d3['attributes'][_0x0c6f('0x3e')]?_0x3308d3['attributes']:_0x2d1487[_0x0c6f('0x33')];if(!_0x3fabac[_0x0c6f('0x2c')]['hasOwnProperty']('nolimit')){_0x3308d3['limit']=qs['limit'](_0x3fabac['query'][_0x0c6f('0x15')]);_0x3308d3[_0x0c6f('0x13')]=qs[_0x0c6f('0x13')](_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x13')]);}_0x3308d3[_0x0c6f('0x3f')]=qs['sort'](_0x3fabac[_0x0c6f('0x2c')]['sort']);_0x3308d3['where']=qs['filters'](_[_0x0c6f('0x40')](_0x3fabac[_0x0c6f('0x2c')],_0x2d1487[_0x0c6f('0x30')]));_0x3308d3[_0x0c6f('0x41')]['OpenchannelInteractionId']=_0x1b05e0['id'];if(_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x42')]){_0x3308d3[_0x0c6f('0x41')]=_[_0x0c6f('0x36')](_0x3308d3[_0x0c6f('0x41')],{'$or':_['map'](_0x3308d3['attributes'],function(_0x1166b7){var _0x5d4b94={};_0x5d4b94[_0x1166b7]={'$like':'%'+_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x42')]+'%'};return _0x5d4b94;})});}if(_0x3fabac[_0x0c6f('0x2c')]['$gte']){var _0x396e5d=_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x43')]['split'](',');var _0x5cf4da={};_0x5cf4da[_0x396e5d[0x0]]={'$gte':moment(_0x396e5d[0x1])['format'](_0x0c6f('0x44'))};_0x3308d3[_0x0c6f('0x41')]=_[_0x0c6f('0x36')](_0x3308d3[_0x0c6f('0x41')],_0x5cf4da);}_0x3308d3=_['merge']({},_0x3308d3,_0x3fabac[_0x0c6f('0x45')]);return db[_0x0c6f('0x3b')][_0x0c6f('0x16')]({'where':_0x3308d3[_0x0c6f('0x41')]})[_0x0c6f('0x1a')](function(_0x4d8fe7){_0x4e4fc6[_0x0c6f('0x16')]=_0x4d8fe7;if(_0x3fabac[_0x0c6f('0x2c')][_0x0c6f('0x46')]){_0x3308d3[_0x0c6f('0x35')]=[{'all':!![]}];}return db[_0x0c6f('0x3b')][_0x0c6f('0x47')](_0x3308d3);})[_0x0c6f('0x1a')](function(_0x4c268f){_0x4e4fc6[_0x0c6f('0x48')]=_0x4c268f;return _0x4e4fc6;});}})[_0x0c6f('0x1a')](respondWithFilteredResult(_0x1a557c,_0x3308d3))['catch'](handleError(_0x1a557c,null));};exports[_0x0c6f('0x49')]=function(_0x31044e,_0x1e7066){return db[_0x0c6f('0x22')]['find']({'where':{'id':_0x31044e['params']['id']}})['then'](handleEntityNotFound(_0x1e7066,null))['then'](function(_0x5ec793){if(_0x5ec793){return _0x5ec793[_0x0c6f('0x4a')](_0x31044e[_0x0c6f('0x38')][_0x0c6f('0x3c')],_['omit'](_0x31044e[_0x0c6f('0x38')],[_0x0c6f('0x3c'),'id'])||{})[_0x0c6f('0x4b')](function(){return db[_0x0c6f('0x4c')][_0x0c6f('0x47')]({'attributes':['id',_0x0c6f('0x1e'),'color'],'where':{'id':_0x31044e[_0x0c6f('0x38')][_0x0c6f('0x3c')]}});})[_0x0c6f('0x1a')](function(_0x51f6bb){socket[_0x0c6f('0x4d')]('openchannelInteractionTags:save',{'id':Number(_0x31044e[_0x0c6f('0x2e')]['id']),'tags':_0x51f6bb||[]});return{'id':Number(_0x31044e[_0x0c6f('0x2e')]['id']),'tags':_0x51f6bb||[]};});}})[_0x0c6f('0x1a')](respondWithResult(_0x1e7066,null))[_0x0c6f('0x2a')](handleError(_0x1e7066,null));};exports[_0x0c6f('0x4e')]=function(_0x205bfb,_0x4299d7){return db[_0x0c6f('0x22')][_0x0c6f('0x39')]({'where':{'id':_0x205bfb[_0x0c6f('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4299d7,null))[_0x0c6f('0x1a')](function(_0x2997e7){if(_0x2997e7){return _0x2997e7[_0x0c6f('0x4e')](_0x205bfb[_0x0c6f('0x2c')][_0x0c6f('0x3c')]);}})[_0x0c6f('0x1a')](respondWithStatusCode(_0x4299d7,null))[_0x0c6f('0x2a')](handleError(_0x4299d7,null));};exports[_0x0c6f('0x4f')]=function(_0x5ede4d,_0x59df71){var _0x5cd2a4=moment()['unix']()[_0x0c6f('0x50')]();var _0x4ecede=path[_0x0c6f('0x51')](config[_0x0c6f('0x52')],'server',_0x0c6f('0x53'),'tmp');var _0xa40893=path[_0x0c6f('0x51')](config[_0x0c6f('0x52')],_0x0c6f('0x54'),_0x0c6f('0x53'),_0x0c6f('0x55'));var _0x3909d8=path[_0x0c6f('0x51')](_0x4ecede,_0x5cd2a4);var _0x546025=util[_0x0c6f('0x56')]('transcript-%d-%s.zip',_0x5ede4d[_0x0c6f('0x2e')]['id'],_0x5cd2a4);var _0x3395c8=path[_0x0c6f('0x51')](_0x4ecede,_0x546025);var _0x28c1d2=[];_0x28c1d2['push']({'model':db[_0x0c6f('0x57')],'as':_0x0c6f('0x57'),'attributes':['id',_0x0c6f('0x58')],'raw':!![]});_0x28c1d2['push']({'model':db[_0x0c6f('0x59')],'as':_0x0c6f('0x5a'),'attributes':['id',_0x0c6f('0x5b'),_0x0c6f('0x5c')],'raw':!![]});if(_0x5ede4d[_0x0c6f('0x2c')][_0x0c6f('0x55')]){_0x28c1d2[_0x0c6f('0x5d')]({'model':db['Attachment'],'as':_0x0c6f('0x5e'),'raw':!![]});}var _0x26bcdb=[{'model':db[_0x0c6f('0x3b')],'as':_0x0c6f('0x5f'),'attributes':['id','body',_0x0c6f('0x60'),_0x0c6f('0x61'),_0x0c6f('0x62'),_0x0c6f('0x63')],'include':_0x28c1d2}];_0x26bcdb['push']({'model':db[_0x0c6f('0x64')],'as':_0x0c6f('0x65'),'attributes':['id',_0x0c6f('0x1e')]});_0x26bcdb[_0x0c6f('0x5d')]({'model':db['User'],'as':_0x0c6f('0x66'),'attributes':['id',_0x0c6f('0x58')]});return db['OpenchannelInteraction'][_0x0c6f('0x39')]({'where':{'id':_0x5ede4d[_0x0c6f('0x2e')]['id']},'include':_0x26bcdb})[_0x0c6f('0x1a')](handleEntityNotFound(_0x59df71,null))['then'](function(_0xd2705a){if(_0xd2705a){var _0x2c2013=_0xd2705a[_0x0c6f('0x67')]({'plain':!![]});fs['mkdirSync'](_0x3909d8);var _0x42bfcb={'channel':_0x0c6f('0x68'),'account':_0x2c2013['Account']['name'],'agent':_0x2c2013[_0x0c6f('0x66')]?_0x2c2013[_0x0c6f('0x66')][_0x0c6f('0x58')]:_0x0c6f('0x69'),'createdAt':moment(_0x2c2013[_0x0c6f('0x60')])[_0x0c6f('0x56')](_0x0c6f('0x44'))[_0x0c6f('0x50')](),'closedAt':_0x2c2013[_0x0c6f('0x6a')]?moment(_0x2c2013[_0x0c6f('0x6b')])[_0x0c6f('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0c6f('0x50')]():'','disposition':_0x2c2013[_0x0c6f('0x6c')],'visibility':_0x2c2013[_0x0c6f('0x6d')]?_0x0c6f('0x6e'):'Private','messages':_(_0x2c2013[_0x0c6f('0x5f')])[_0x0c6f('0x42')]({'secret':![]})[_0x0c6f('0x21')](function(_0x31e9a8){if(_0x31e9a8[_0x0c6f('0x5e')]){var _0x29fd1d=path[_0x0c6f('0x51')](_0xa40893,_0x31e9a8[_0x0c6f('0x5e')][_0x0c6f('0x6f')]);if(fs[_0x0c6f('0x70')](_0x29fd1d)){fs[_0x0c6f('0x71')](_0x29fd1d)[_0x0c6f('0x72')](fs[_0x0c6f('0x73')](path[_0x0c6f('0x51')](_0x3909d8,_0x31e9a8[_0x0c6f('0x5e')][_0x0c6f('0x6f')])));}}return{'date':moment(_0x31e9a8['createdAt'])[_0x0c6f('0x56')](_0x0c6f('0x44'))['toString'](),'sender':_0x31e9a8[_0x0c6f('0x61')]===_0x0c6f('0x74')?_0x31e9a8[_0x0c6f('0x57')]?_0x31e9a8[_0x0c6f('0x57')][_0x0c6f('0x58')]:_0x0c6f('0x75'):_0x31e9a8[_0x0c6f('0x5a')][_0x0c6f('0x5b')]+(_0x31e9a8['Contact']['lastName']?'\x20'+_0x31e9a8[_0x0c6f('0x5a')][_0x0c6f('0x5c')]:''),'body':_0x31e9a8[_0x0c6f('0x5e')]?_0x31e9a8[_0x0c6f('0x5e')]['basename']:_0x31e9a8['body'],'direction':_0x31e9a8['direction']===_0x0c6f('0x74')?'A':'C','secret':_0x31e9a8[_0x0c6f('0x62')],'read':_0x31e9a8['read'],'attachment':_0x31e9a8[_0x0c6f('0x5e')]};})[_0x0c6f('0x76')]()};return ejs[_0x0c6f('0x77')](path['join'](config[_0x0c6f('0x52')],_0x0c6f('0x54'),_0x0c6f('0x78'),_0x0c6f('0x79')),{'interaction':_0x42bfcb})[_0x0c6f('0x1a')](function(_0x24a8c1){var _0x13a3a9=path['join'](_0x3909d8,_0x0c6f('0x7a')+_0x2c2013['id']+'-'+_0x5cd2a4+_0x0c6f('0x7b'));var _0x413cc4={'path':_0x13a3a9,'channel':_0x0c6f('0x68'),'interactionId':_0x2c2013['id']};return pdf['createPdfFromHTML'](_0x24a8c1,_0x413cc4);})['then'](function(){return new Promise(function(_0xcd52b9,_0x390ab7){zipdir(_0x3909d8,{'saveTo':_0x3395c8},function(_0x1d3f87,_0x5082c2){if(_0x1d3f87)return _0x390ab7(_0x1d3f87);return _0xcd52b9(_0x5082c2);});})['then'](function(){return new Promise(function(_0x304323,_0x182ca7){rimraf(_0x3909d8,function(_0x45587a){if(_0x45587a)_0x182ca7(_0x45587a);return _0x304323();});});})[_0x0c6f('0x1a')](function(){return _0x59df71['download'](_0x3395c8,_0x546025,function(_0xd3c1e7){if(_0xd3c1e7){logger[_0x0c6f('0x1c')](_0x0c6f('0x7c'),_0xd3c1e7);}else{fs[_0x0c6f('0x7d')](_0x3395c8);}});});});}else{return _0x59df71['sendStatus'](0xc8);}})['catch'](handleError(_0x59df71,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b176378..090ff24 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 _0x1709=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x4e0eb6,_0x240784){var _0x46e432=function(_0x24b973){while(--_0x24b973){_0x4e0eb6['push'](_0x4e0eb6['shift']());}};_0x46e432(++_0x240784);}(_0x1709,0x107));var _0x9170=function(_0x19a562,_0x4b669f){_0x19a562=_0x19a562-0x0;var _0x3bd3f3=_0x1709[_0x19a562];return _0x3bd3f3;};'use strict';var EventEmitter=require(_0x9170('0x0'));var OpenchannelInteraction=require(_0x9170('0x1'))['db'][_0x9170('0x2')];var OpenchannelMessage=require(_0x9170('0x1'))['db'][_0x9170('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9170('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9170('0x5'),'afterDestroy':_0x9170('0x6')};function emitEvent(_0x3b51b7){return function(_0x212776,_0x93e35a,_0x41b454){_0x212776[_0x9170('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3fb3c0){_0x212776[_0x9170('0x8')](_0x9170('0x9'),_0x3fb3c0[_0x9170('0xa')](function(_0x2aa9a8){return{'id':_0x2aa9a8['id']};}));return OpenchannelMessage[_0x9170('0xb')]({'where':{'OpenchannelInteractionId':_0x212776['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9170('0xc')](function(_0x38fa46){_0x212776[_0x9170('0x8')](_0x9170('0xd'),_0x38fa46[_0x9170('0xe')]);OpenchannelInteractionEvents[_0x9170('0xf')](_0x3b51b7+':'+_0x212776['id'],_0x212776);OpenchannelInteractionEvents[_0x9170('0xf')](_0x3b51b7,_0x212776);_0x41b454(null);})[_0x9170('0x10')](_0x41b454(null));};}for(var e in events){if(events[_0x9170('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x9170('0x12')](e,emitEvent(event));}}module[_0x9170('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4b61=['then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x2754c2,_0x10ceb4){var _0x4d5454=function(_0x4e90d2){while(--_0x4e90d2){_0x2754c2['push'](_0x2754c2['shift']());}};_0x4d5454(++_0x10ceb4);}(_0x4b61,0x1d7));var _0x14b6=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x4b61[_0x599e60];return _0x468e19;};'use strict';var EventEmitter=require(_0x14b6('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x14b6('0x1')];var OpenchannelMessage=require(_0x14b6('0x2'))['db'][_0x14b6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x14b6('0x4')](0x0);var events={'afterCreate':_0x14b6('0x5'),'afterUpdate':_0x14b6('0x6'),'afterDestroy':_0x14b6('0x7')};function emitEvent(_0x47a561){return function(_0x28bd2c,_0x13ef3a,_0x2ee963){_0x28bd2c[_0x14b6('0x8')]({'attributes':['id'],'raw':!![]})[_0x14b6('0x9')](function(_0x4cf128){_0x28bd2c[_0x14b6('0xa')](_0x14b6('0xb'),_0x4cf128['map'](function(_0x4bf900){return{'id':_0x4bf900['id']};}));return OpenchannelMessage[_0x14b6('0xc')]({'where':{'OpenchannelInteractionId':_0x28bd2c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c2c1f){_0x28bd2c[_0x14b6('0xa')](_0x14b6('0xd'),_0x5c2c1f[_0x14b6('0xe')]);OpenchannelInteractionEvents['emit'](_0x47a561+':'+_0x28bd2c['id'],_0x28bd2c);OpenchannelInteractionEvents[_0x14b6('0xf')](_0x47a561,_0x28bd2c);_0x2ee963(null);})[_0x14b6('0x10')](_0x2ee963(null));};}for(var e in events){if(events[_0x14b6('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x14b6('0x12')](e,emitEvent(event));}}module[_0x14b6('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5c158d4..054e50e 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 _0xd7d6=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','utf8mb4','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x312e00,_0x442eaf){var _0x52b9ae=function(_0x5262e5){while(--_0x5262e5){_0x312e00['push'](_0x312e00['shift']());}};_0x52b9ae(++_0x442eaf);}(_0xd7d6,0xb5));var _0x6d7d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd7d6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6d7d('0x0'));var util=require(_0x6d7d('0x1'));var logger=require(_0x6d7d('0x2'))(_0x6d7d('0x3'));var moment=require(_0x6d7d('0x4'));var BPromise=require(_0x6d7d('0x5'));var rp=require(_0x6d7d('0x6'));var fs=require('fs');var path=require(_0x6d7d('0x7'));var rimraf=require(_0x6d7d('0x8'));var config=require(_0x6d7d('0x9'));var attributes=require(_0x6d7d('0xa'));module['exports']=function(_0x36ff5c,_0x1122e6){return _0x36ff5c['define'](_0x6d7d('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d7d('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x47b7f1,_0x474ae7,_0x5195a9){if(_0x47b7f1['changed'](_0x6d7d('0xd'))){_0x47b7f1[_0x6d7d('0xe')]=moment()[_0x6d7d('0xf')](_0x6d7d('0x10'));}_0x5195a9(null,_0x47b7f1);}}});}; \ No newline at end of file +var _0xd764=['exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x3fa813,_0x295ac7){var _0x3cbab1=function(_0x5b2451){while(--_0x5b2451){_0x3fa813['push'](_0x3fa813['shift']());}};_0x3cbab1(++_0x295ac7);}(_0xd764,0x1cd));var _0x4d76=function(_0xb83b50,_0x493061){_0xb83b50=_0xb83b50-0x0;var _0x4689cd=_0xd764[_0xb83b50];return _0x4689cd;};'use strict';var _=require(_0x4d76('0x0'));var util=require(_0x4d76('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d76('0x2'));var BPromise=require(_0x4d76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d76('0x4'));var config=require(_0x4d76('0x5'));var attributes=require(_0x4d76('0x6'));module[_0x4d76('0x7')]=function(_0x2d4a7a,_0xac8e0e){return _0x2d4a7a[_0x4d76('0x8')](_0x4d76('0x9'),attributes,{'tableName':_0x4d76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d76('0xb'),'collate':_0x4d76('0xc'),'hooks':{'beforeUpdate':function(_0x583bb9,_0x3180cf,_0x4aa772){if(_0x583bb9[_0x4d76('0xd')](_0x4d76('0xe'))){_0x583bb9[_0x4d76('0xf')]=moment()[_0x4d76('0x10')](_0x4d76('0x11'));}_0x4aa772(null,_0x583bb9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 50e31dc..7ffc7c6 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 _0xe8d0=['defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x31bf4a,_0x51eb5f){var _0x2265ec=function(_0x482a5a){while(--_0x482a5a){_0x31bf4a['push'](_0x31bf4a['shift']());}};_0x2265ec(++_0x51eb5f);}(_0xe8d0,0x1a2));var _0x0e8d=function(_0xf66a57,_0x33033f){_0xf66a57=_0xf66a57-0x0;var _0x1ec530=_0xe8d0[_0xf66a57];return _0x1ec530;};'use strict';var _=require(_0x0e8d('0x0'));var util=require('util');var moment=require(_0x0e8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e8d('0x2'));var fs=require('fs');var Redis=require(_0x0e8d('0x3'));var db=require(_0x0e8d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e8d('0x5'))(_0x0e8d('0x6'));var config=require(_0x0e8d('0x7'));var jayson=require(_0x0e8d('0x8'));var client=jayson[_0x0e8d('0x9')][_0x0e8d('0xa')]({'port':0x232a});config[_0x0e8d('0xb')]=_[_0x0e8d('0xc')](config['redis'],{'host':_0x0e8d('0xd'),'port':0x18eb});var socket=require(_0x0e8d('0xe'))(new Redis(config[_0x0e8d('0xb')]));require(_0x0e8d('0xf'))[_0x0e8d('0x10')](socket);function respondWithRpcPromise(_0x21b303,_0x4c7798,_0x6bcb12){return new BPromise(function(_0x318b94,_0x1de901){return client['request'](_0x21b303,_0x6bcb12)[_0x0e8d('0x11')](function(_0x454338){logger[_0x0e8d('0x12')](_0x0e8d('0x13'),_0x4c7798,_0x0e8d('0x14'));logger[_0x0e8d('0x15')](_0x0e8d('0x16'),_0x4c7798,'request\x20sent',JSON[_0x0e8d('0x17')](_0x454338));if(_0x454338[_0x0e8d('0x18')]){if(_0x454338[_0x0e8d('0x18')][_0x0e8d('0x19')]===0x1f4){logger[_0x0e8d('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4c7798,_0x454338[_0x0e8d('0x18')][_0x0e8d('0x1a')]);return _0x1de901(_0x454338[_0x0e8d('0x18')][_0x0e8d('0x1a')]);}logger[_0x0e8d('0x18')](_0x0e8d('0x13'),_0x4c7798,_0x454338[_0x0e8d('0x18')][_0x0e8d('0x1a')]);return _0x318b94(_0x454338['error']['message']);}else{logger[_0x0e8d('0x12')](_0x0e8d('0x13'),_0x4c7798,_0x0e8d('0x14'));_0x318b94(_0x454338[_0x0e8d('0x1b')][_0x0e8d('0x1a')]);}})[_0x0e8d('0x1c')](function(_0x308579){logger[_0x0e8d('0x18')](_0x0e8d('0x13'),_0x4c7798,_0x308579);_0x1de901(_0x308579);});});}exports[_0x0e8d('0x1d')]=function(_0xb004c){var _0x36e2d5=this;return new Promise(function(_0x59c406,_0x4cdcef){return db[_0x0e8d('0x1e')][_0x0e8d('0x1f')](_0xb004c['body'],{'raw':_0xb004c[_0x0e8d('0x20')]?_0xb004c['options'][_0x0e8d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb004c[_0x0e8d('0x20')]?_0xb004c['options'][_0x0e8d('0x22')]||null:null,'attributes':_0xb004c['options']?_0xb004c['options'][_0x0e8d('0x23')]||null:null,'limit':_0xb004c[_0x0e8d('0x20')]?_0xb004c[_0x0e8d('0x20')]['limit']||null:null})['then'](function(_0x547a27){logger['info'](_0x0e8d('0x1d'),_0xb004c);logger[_0x0e8d('0x15')](_0x0e8d('0x1d'),_0xb004c,JSON[_0x0e8d('0x17')](_0x547a27));_0x59c406(_0x547a27);})[_0x0e8d('0x1c')](function(_0x33cfb7){logger['error'](_0x0e8d('0x1d'),_0x33cfb7[_0x0e8d('0x1a')],_0xb004c);_0x4cdcef(_0x36e2d5[_0x0e8d('0x18')](0x1f4,_0x33cfb7['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x47d6ec){return new Promise(function(_0x181bb3,_0x3b4e49){return db[_0x0e8d('0x1e')][_0x0e8d('0x24')]({'where':_0x47d6ec[_0x0e8d('0x20')]?_0x47d6ec['options'][_0x0e8d('0x22')]||null:null})[_0x0e8d('0x11')](function(_0x3096fb){if(_0x3096fb){return _0x3096fb[_0x0e8d('0x25')](_0x47d6ec[_0x0e8d('0x26')][_0x0e8d('0x27')],_[_0x0e8d('0x28')](_0x47d6ec[_0x0e8d('0x26')],[_0x0e8d('0x27'),'id'])||{});}})[_0x0e8d('0x29')](function(_0x555d7d){logger[_0x0e8d('0x12')](_0x0e8d('0x2a'),_0x47d6ec);logger[_0x0e8d('0x15')]('AddTags',_0x47d6ec,JSON[_0x0e8d('0x17')](_0x555d7d));_0x181bb3(_0x555d7d);})[_0x0e8d('0x1c')](function(_0x198c28){logger[_0x0e8d('0x18')]('AddTags',_0x198c28['message'],_0x47d6ec);_0x3b4e49(_this[_0x0e8d('0x18')](0x1f4,_0x198c28[_0x0e8d('0x1a')]));});});}; \ No newline at end of file +var _0x198b=['then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','raw','options','where','attributes','debug','catch','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x4cd00b,_0x483633){var _0x488623=function(_0xe10309){while(--_0xe10309){_0x4cd00b['push'](_0x4cd00b['shift']());}};_0x488623(++_0x483633);}(_0x198b,0x137));var _0xb198=function(_0x198919,_0x2fa3a7){_0x198919=_0x198919-0x0;var _0xd39f78=_0x198b[_0x198919];return _0xd39f78;};'use strict';var _=require(_0xb198('0x0'));var util=require(_0xb198('0x1'));var moment=require(_0xb198('0x2'));var BPromise=require(_0xb198('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb198('0x4'));var db=require(_0xb198('0x5'))['db'];var utils=require(_0xb198('0x6'));var logger=require(_0xb198('0x7'))('rpc');var config=require(_0xb198('0x8'));var jayson=require(_0xb198('0x9'));var client=jayson[_0xb198('0xa')][_0xb198('0xb')]({'port':0x232a});config[_0xb198('0xc')]=_[_0xb198('0xd')](config[_0xb198('0xc')],{'host':_0xb198('0xe'),'port':0x18eb});var socket=require(_0xb198('0xf'))(new Redis(config[_0xb198('0xc')]));require('./openchannelInteraction.socket')[_0xb198('0x10')](socket);function respondWithRpcPromise(_0x2b07cd,_0xec9532,_0x1ec65b){return new BPromise(function(_0x4ef9d6,_0x540917){return client['request'](_0x2b07cd,_0x1ec65b)[_0xb198('0x11')](function(_0x1befb6){logger[_0xb198('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0xec9532,_0xb198('0x13'));logger['debug'](_0xb198('0x14'),_0xec9532,_0xb198('0x13'),JSON[_0xb198('0x15')](_0x1befb6));if(_0x1befb6[_0xb198('0x16')]){if(_0x1befb6['error'][_0xb198('0x17')]===0x1f4){logger[_0xb198('0x16')](_0xb198('0x18'),_0xec9532,_0x1befb6['error'][_0xb198('0x19')]);return _0x540917(_0x1befb6[_0xb198('0x16')]['message']);}logger[_0xb198('0x16')](_0xb198('0x18'),_0xec9532,_0x1befb6['error'][_0xb198('0x19')]);return _0x4ef9d6(_0x1befb6[_0xb198('0x16')][_0xb198('0x19')]);}else{logger[_0xb198('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0xec9532,_0xb198('0x13'));_0x4ef9d6(_0x1befb6[_0xb198('0x1a')]['message']);}})['catch'](function(_0x1b7a09){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xec9532,_0x1b7a09);_0x540917(_0x1b7a09);});});}exports[_0xb198('0x1b')]=function(_0x43e0e0){var _0x37c9ed=this;return new Promise(function(_0x4a6e01,_0x2b77de){return db[_0xb198('0x1c')]['update'](_0x43e0e0[_0xb198('0x1d')],{'raw':_0x43e0e0['options']?_0x43e0e0['options'][_0xb198('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e0e0[_0xb198('0x1f')]?_0x43e0e0[_0xb198('0x1f')][_0xb198('0x20')]||null:null,'attributes':_0x43e0e0[_0xb198('0x1f')]?_0x43e0e0[_0xb198('0x1f')][_0xb198('0x21')]||null:null,'limit':_0x43e0e0[_0xb198('0x1f')]?_0x43e0e0['options']['limit']||null:null})[_0xb198('0x11')](function(_0x52627f){logger['info'](_0xb198('0x1b'),_0x43e0e0);logger[_0xb198('0x22')]('UpdateOpenchannelInteraction',_0x43e0e0,JSON[_0xb198('0x15')](_0x52627f));_0x4a6e01(_0x52627f);})[_0xb198('0x23')](function(_0x1c1340){logger[_0xb198('0x16')]('UpdateOpenchannelInteraction',_0x1c1340[_0xb198('0x19')],_0x43e0e0);_0x2b77de(_0x37c9ed[_0xb198('0x16')](0x1f4,_0x1c1340[_0xb198('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4e71b1){return new Promise(function(_0xe7b7ff,_0x1a5594){return db[_0xb198('0x1c')][_0xb198('0x24')]({'where':_0x4e71b1['options']?_0x4e71b1['options'][_0xb198('0x20')]||null:null})[_0xb198('0x11')](function(_0x18202f){if(_0x18202f){return _0x18202f[_0xb198('0x25')](_0x4e71b1[_0xb198('0x1d')][_0xb198('0x26')],_[_0xb198('0x27')](_0x4e71b1[_0xb198('0x1d')],[_0xb198('0x26'),'id'])||{});}})['spread'](function(_0x2dcd10){logger['info']('AddTags',_0x4e71b1);logger[_0xb198('0x22')]('AddTags',_0x4e71b1,JSON[_0xb198('0x15')](_0x2dcd10));_0xe7b7ff(_0x2dcd10);})['catch'](function(_0x58c1e3){logger[_0xb198('0x16')](_0xb198('0x28'),_0x58c1e3[_0xb198('0x19')],_0x4e71b1);_0x1a5594(_this[_0xb198('0x16')](0x1f4,_0x58c1e3[_0xb198('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index fcdc3b6..88839bf 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 _0xa4de=['removeListener','register','length','./openchannelInteraction.events','update','emit'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa4de,0x1e9));var _0xea4d=function(_0x53ef61,_0x44cda6){_0x53ef61=_0x53ef61-0x0;var _0x4e4207=_0xa4de[_0x53ef61];return _0x4e4207;};'use strict';var OpenchannelInteractionEvents=require(_0xea4d('0x0'));var events=['save','remove',_0xea4d('0x1')];function createListener(_0x551abf,_0x3c3ca7){return function(_0x29fdd3){_0x3c3ca7[_0xea4d('0x2')](_0x551abf,_0x29fdd3);};}function removeListener(_0x40f483,_0x345fb6){return function(){OpenchannelInteractionEvents[_0xea4d('0x3')](_0x40f483,_0x345fb6);};}exports[_0xea4d('0x4')]=function(_0x441959){for(var _0x360e67=0x0,_0x1029f3=events[_0xea4d('0x5')];_0x360e67<_0x1029f3;_0x360e67++){var _0x5e3602=events[_0x360e67];var _0x5a96d9=createListener('openchannelInteraction:'+_0x5e3602,_0x441959);OpenchannelInteractionEvents['on'](_0x5e3602,_0x5a96d9);}}; \ No newline at end of file +var _0x1a94=['save','remove','update','register','length','openchannelInteraction:'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1a94,0x1da));var _0x41a9=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x1a94[_0x102e37];return _0x35a07c;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x41a9('0x0'),_0x41a9('0x1'),_0x41a9('0x2')];function createListener(_0x52fa18,_0x5e4ceb){return function(_0x565c58){_0x5e4ceb['emit'](_0x52fa18,_0x565c58);};}function removeListener(_0x50c30b,_0x1cb22d){return function(){OpenchannelInteractionEvents['removeListener'](_0x50c30b,_0x1cb22d);};}exports[_0x41a9('0x3')]=function(_0x1023ea){for(var _0x2d2af3=0x0,_0x292262=events[_0x41a9('0x4')];_0x2d2af3<_0x292262;_0x2d2af3++){var _0x4634c2=events[_0x2d2af3];var _0xa90617=createListener(_0x41a9('0x5')+_0x4634c2,_0x1023ea);OpenchannelInteractionEvents['on'](_0x4634c2,_0xa90617);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index db3c0fc..660220f 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x46cfda,_0x9d3f8b){var _0x3a4943=function(_0x148a91){while(--_0x148a91){_0x46cfda['push'](_0x46cfda['shift']());}};_0x3a4943(++_0x9d3f8b);}(_0xe706,0xa3));var _0x6e70=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xe706[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xfb7ebc,_0x10a55c){var _0x33c10a=function(_0x4f30a6){while(--_0x4f30a6){_0xfb7ebc['push'](_0xfb7ebc['shift']());}};_0x33c10a(++_0x10a55c);}(_0xedd9,0xfc));var _0x9edd=function(_0x13ca44,_0x56a27d){_0x13ca44=_0x13ca44-0x0;var _0x62f21f=_0xedd9[_0x13ca44];return _0x62f21f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ed3493e..50e7a08 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 _0x7275=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1b43d0,_0x4d4c90){var _0x15b8b1=function(_0x6305e7){while(--_0x6305e7){_0x1b43d0['push'](_0x1b43d0['shift']());}};_0x15b8b1(++_0x4d4c90);}(_0x7275,0x143));var _0x5727=function(_0x1ab0b5,_0x3cf535){_0x1ab0b5=_0x1ab0b5-0x0;var _0x41ffef=_0x7275[_0x1ab0b5];return _0x41ffef;};'use strict';var Sequelize=require(_0x5727('0x0'));module[_0x5727('0x1')]={'body':{'type':Sequelize[_0x5727('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5727('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5727('0x4')]('in',_0x5727('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x5727('0x6')]},'providerName':{'type':Sequelize[_0x5727('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x75dc=['DATE','STRING','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x75dc,0x1d7));var _0xc75d=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x75dc[_0x2726ad];return _0xd87993;};'use strict';var Sequelize=require(_0xc75d('0x0'));module[_0xc75d('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc75d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc75d('0x3')]('in',_0xc75d('0x4')),'defaultValue':_0xc75d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc75d('0x5')]},'providerName':{'type':Sequelize[_0xc75d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 34d8432..4662383 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 _0xa786=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','stack','name','send','map','OpenchannelMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','contact','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa786,0x71));var _0x6a78=function(_0x2a1e2c,_0x3a3bb8){_0x2a1e2c=_0x2a1e2c-0x0;var _0x483974=_0xa786[_0x2a1e2c];return _0x483974;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];config[_0x6a78('0x1a')]=_['defaults'](config[_0x6a78('0x1a')],{'host':_0x6a78('0x1b'),'port':0x18eb});var socket=require(_0x6a78('0x1c'))(new Redis(config['redis']));require(_0x6a78('0x1d'))[_0x6a78('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6a78('0x1f')][_0x6a78('0x20')]({'port':0x232c});var client9002=jayson[_0x6a78('0x1f')][_0x6a78('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3deede,_0x36e824,_0x4e9031,_0x27d687){return new BPromise(function(_0x122362,_0x4746c0){var _0x265f90=_0x27d687||client;return _0x265f90['request'](_0x3deede,_0x4e9031)['then'](function(_0x460991){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x36e824,'request\x20sent');logger[_0x6a78('0x21')](_0x6a78('0x22'),_0x36e824,_0x6a78('0x23'),JSON['stringify'](_0x460991));if(_0x460991['error']){if(_0x460991[_0x6a78('0x24')][_0x6a78('0x25')]===0x1f4){logger[_0x6a78('0x24')](_0x6a78('0x26'),_0x36e824,_0x460991['error']['message']);return _0x4746c0(_0x460991['error'][_0x6a78('0x27')]);}logger['error'](_0x6a78('0x26'),_0x36e824,_0x460991[_0x6a78('0x24')][_0x6a78('0x27')]);return _0x122362(_0x460991['error'][_0x6a78('0x27')]);}else{logger[_0x6a78('0x28')](_0x6a78('0x26'),_0x36e824,_0x6a78('0x23'));_0x122362(_0x460991[_0x6a78('0x29')][_0x6a78('0x27')]);}})[_0x6a78('0x2a')](function(_0xefaa55){logger['error'](_0x6a78('0x26'),_0x36e824,_0xefaa55);_0x4746c0(_0xefaa55);});});}function respondWithStatusCode(_0xf17e35,_0x1e91ad){_0x1e91ad=_0x1e91ad||0xcc;return function(_0x57a859){if(_0x57a859){return _0xf17e35[_0x6a78('0x2b')](_0x1e91ad);}return _0xf17e35['status'](_0x1e91ad)[_0x6a78('0x2c')]();};}function respondWithResult(_0x196b81,_0x5cef13){_0x5cef13=_0x5cef13||0xc8;return function(_0x1154d2){if(_0x1154d2){return _0x196b81[_0x6a78('0x2d')](_0x5cef13)[_0x6a78('0x2e')](_0x1154d2);}};}function respondWithFilteredResult(_0x149105,_0x5942c0){return function(_0x8bc302){if(_0x8bc302){var _0x125ca2=typeof _0x5942c0[_0x6a78('0x2f')]===_0x6a78('0x30')&&typeof _0x5942c0['limit']===_0x6a78('0x30');var _0x9bc18=_0x8bc302[_0x6a78('0x31')];var _0x4cc569=_0x125ca2?0x0:_0x5942c0[_0x6a78('0x2f')];var _0x35d2be=_0x125ca2?_0x8bc302['count']:_0x5942c0[_0x6a78('0x2f')]+_0x5942c0[_0x6a78('0x32')];var _0x232c1c;if(_0x35d2be>=_0x9bc18){_0x35d2be=_0x9bc18;_0x232c1c=0xc8;}else{_0x232c1c=0xce;}_0x149105[_0x6a78('0x2d')](_0x232c1c);return _0x149105[_0x6a78('0x33')]('Content-Range',_0x4cc569+'-'+_0x35d2be+'/'+_0x9bc18)[_0x6a78('0x2e')](_0x8bc302);}return null;};}function patchUpdates(_0x261954){return function(_0x50e187){try{jsonpatch[_0x6a78('0x34')](_0x50e187,_0x261954,!![]);}catch(_0x25cdf6){return BPromise[_0x6a78('0x35')](_0x25cdf6);}return _0x50e187[_0x6a78('0x36')]();};}function saveUpdates(_0x2ecd5c,_0x2a383f){return function(_0x49fc83){if(_0x49fc83){return _0x49fc83[_0x6a78('0x37')](_0x2ecd5c)['then'](function(_0x23d91f){return _0x23d91f;});}return null;};}function removeEntity(_0x237ae9,_0x1f9bee){return function(_0x19d9be){if(_0x19d9be){return _0x19d9be[_0x6a78('0x38')]()[_0x6a78('0x39')](function(){_0x237ae9[_0x6a78('0x2d')](0xcc)[_0x6a78('0x2c')]();});}};}function handleEntityNotFound(_0x444757,_0x49c2fd){return function(_0x506a79){if(!_0x506a79){_0x444757[_0x6a78('0x2b')](0x194);}return _0x506a79;};}function handleError(_0x58b724,_0x1aa21d){_0x1aa21d=_0x1aa21d||0x1f4;return function(_0x50cc5b){logger[_0x6a78('0x24')](_0x50cc5b[_0x6a78('0x3a')]);if(_0x50cc5b[_0x6a78('0x3b')]){delete _0x50cc5b[_0x6a78('0x3b')];}_0x58b724[_0x6a78('0x2d')](_0x1aa21d)[_0x6a78('0x3c')](_0x50cc5b);};}exports['index']=function(_0x34cb3a,_0xab029){var _0x20e6d1={},_0x4d2ce1={},_0x7f3bf={'count':0x0,'rows':[]};var _0x54f811=_[_0x6a78('0x3d')](db[_0x6a78('0x3e')][_0x6a78('0x3f')],function(_0xe180fb){return{'name':_0xe180fb['fieldName'],'type':_0xe180fb['type']['key']};});_0x4d2ce1[_0x6a78('0x40')]=_[_0x6a78('0x3d')](_0x54f811,'name');_0x4d2ce1[_0x6a78('0x41')]=_[_0x6a78('0x42')](_0x34cb3a[_0x6a78('0x41')]);_0x4d2ce1[_0x6a78('0x43')]=_[_0x6a78('0x44')](_0x4d2ce1[_0x6a78('0x40')],_0x4d2ce1['query']);_0x20e6d1[_0x6a78('0x45')]=_[_0x6a78('0x44')](_0x4d2ce1[_0x6a78('0x40')],qs[_0x6a78('0x46')](_0x34cb3a[_0x6a78('0x41')][_0x6a78('0x46')]));_0x20e6d1[_0x6a78('0x45')]=_0x20e6d1['attributes'][_0x6a78('0x47')]?_0x20e6d1['attributes']:_0x4d2ce1[_0x6a78('0x40')];if(!_0x34cb3a['query']['hasOwnProperty'](_0x6a78('0x48'))){_0x20e6d1[_0x6a78('0x32')]=qs['limit'](_0x34cb3a[_0x6a78('0x41')][_0x6a78('0x32')]);_0x20e6d1[_0x6a78('0x2f')]=qs[_0x6a78('0x2f')](_0x34cb3a[_0x6a78('0x41')]['offset']);}_0x20e6d1['order']=qs[_0x6a78('0x49')](_0x34cb3a[_0x6a78('0x41')][_0x6a78('0x49')]);_0x20e6d1[_0x6a78('0x4a')]=qs[_0x6a78('0x43')](_[_0x6a78('0x4b')](_0x34cb3a[_0x6a78('0x41')],_0x4d2ce1['filters']),_0x54f811);if(_0x34cb3a[_0x6a78('0x41')][_0x6a78('0x4c')]){_0x20e6d1['where']=_[_0x6a78('0x4d')](_0x20e6d1[_0x6a78('0x4a')],{'$or':_[_0x6a78('0x3d')](_0x54f811,function(_0x4732b7){if(_0x4732b7[_0x6a78('0x4e')]!==_0x6a78('0x4f')){var _0x543d21={};_0x543d21[_0x4732b7[_0x6a78('0x3b')]]={'$like':'%'+_0x34cb3a[_0x6a78('0x41')][_0x6a78('0x4c')]+'%'};return _0x543d21;}})});}_0x20e6d1=_[_0x6a78('0x4d')]({},_0x20e6d1,_0x34cb3a[_0x6a78('0x50')]);var _0x548186={'where':_0x20e6d1[_0x6a78('0x4a')]};return db['OpenchannelMessage'][_0x6a78('0x31')](_0x548186)[_0x6a78('0x39')](function(_0x5c75dd){_0x7f3bf[_0x6a78('0x31')]=_0x5c75dd;if(_0x34cb3a['query'][_0x6a78('0x51')]){_0x20e6d1[_0x6a78('0x52')]=[{'all':!![]}];}return db[_0x6a78('0x3e')][_0x6a78('0x53')](_0x20e6d1);})[_0x6a78('0x39')](function(_0x5cb8dc){_0x7f3bf['rows']=_0x5cb8dc;return _0x7f3bf;})[_0x6a78('0x39')](respondWithFilteredResult(_0xab029,_0x20e6d1))[_0x6a78('0x2a')](handleError(_0xab029,null));};exports[_0x6a78('0x54')]=function(_0xd8204e,_0x5e70b3){var _0x3655e9={'raw':!![],'where':{'id':_0xd8204e[_0x6a78('0x55')]['id']}},_0x348542={};_0x348542['model']=_['keys'](db[_0x6a78('0x3e')]['rawAttributes']);_0x348542['query']=_[_0x6a78('0x42')](_0xd8204e[_0x6a78('0x41')]);_0x348542[_0x6a78('0x43')]=_[_0x6a78('0x44')](_0x348542[_0x6a78('0x40')],_0x348542['query']);_0x3655e9['attributes']=_['intersection'](_0x348542[_0x6a78('0x40')],qs[_0x6a78('0x46')](_0xd8204e[_0x6a78('0x41')]['fields']));_0x3655e9[_0x6a78('0x45')]=_0x3655e9[_0x6a78('0x45')]['length']?_0x3655e9[_0x6a78('0x45')]:_0x348542[_0x6a78('0x40')];if(_0xd8204e[_0x6a78('0x41')][_0x6a78('0x51')]){_0x3655e9[_0x6a78('0x52')]=[{'all':!![]}];}_0x3655e9=_[_0x6a78('0x4d')]({},_0x3655e9,_0xd8204e[_0x6a78('0x50')]);return db['OpenchannelMessage']['find'](_0x3655e9)['then'](handleEntityNotFound(_0x5e70b3,null))[_0x6a78('0x39')](respondWithResult(_0x5e70b3,null))['catch'](handleError(_0x5e70b3,null));};exports[_0x6a78('0x56')]=function(_0x28c0b4,_0x27a62b){return db[_0x6a78('0x3e')]['create'](_0x28c0b4[_0x6a78('0x57')],{})[_0x6a78('0x39')](respondWithResult(_0x27a62b,0xc9))['catch'](handleError(_0x27a62b,null));};exports[_0x6a78('0x37')]=function(_0x20a99d,_0x19501b){if(_0x20a99d[_0x6a78('0x57')]['id']){delete _0x20a99d[_0x6a78('0x57')]['id'];}return db['OpenchannelMessage'][_0x6a78('0x58')]({'where':{'id':_0x20a99d[_0x6a78('0x55')]['id']}})[_0x6a78('0x39')](handleEntityNotFound(_0x19501b,null))['then'](saveUpdates(_0x20a99d['body'],null))[_0x6a78('0x39')](respondWithResult(_0x19501b,null))[_0x6a78('0x2a')](handleError(_0x19501b,null));};exports['destroy']=function(_0xcef87,_0x178c77){return db[_0x6a78('0x3e')][_0x6a78('0x58')]({'where':{'id':_0xcef87[_0x6a78('0x55')]['id']}})[_0x6a78('0x39')](handleEntityNotFound(_0x178c77,null))['then'](removeEntity(_0x178c77,null))['catch'](handleError(_0x178c77,null));};exports[_0x6a78('0x59')]=function(_0x9fd4f3,_0x174fef){return db[_0x6a78('0x3e')][_0x6a78('0x59')]()[_0x6a78('0x39')](respondWithResult(_0x174fef,null))[_0x6a78('0x2a')](handleError(_0x174fef,null));};var interaction_log=require(_0x6a78('0x15'))(_0x6a78('0x5a'));exports[_0x6a78('0x5b')]=function(_0x317eb3,_0x5e812a,_0xec7051){var _0x21a62f={'agent':{},'channel':_0x6a78('0x5c')};if(_0x317eb3[_0x6a78('0x57')]['id']){delete _0x317eb3[_0x6a78('0x57')]['id'];}_0x317eb3['body'][_0x6a78('0x5d')]=!![];_0x317eb3[_0x6a78('0x57')][_0x6a78('0x5e')]=moment()[_0x6a78('0x5f')](_0x6a78('0x60'));_0x317eb3[_0x6a78('0x57')][_0x6a78('0x61')]=_0x317eb3[_0x6a78('0x57')][_0x6a78('0x61')]||_0x317eb3['user']['id'];_0x21a62f[_0x6a78('0x62')]['id']=_0x317eb3[_0x6a78('0x57')][_0x6a78('0x61')];return db[_0x6a78('0x3e')][_0x6a78('0x58')]({'where':{'id':_0x317eb3[_0x6a78('0x55')]['id'],'UserId':null}})[_0x6a78('0x39')](handleEntityNotFound(_0x5e812a,null))[_0x6a78('0x39')](saveUpdates(_0x317eb3[_0x6a78('0x57')],null))[_0x6a78('0x39')](function(_0xe6eb8e){if(_0xe6eb8e){_0x21a62f[_0x6a78('0x27')]=_0xe6eb8e[_0x6a78('0x63')]({'plain':!![]});return db[_0x6a78('0x64')]['find']({'where':{'id':_0xe6eb8e[_0x6a78('0x65')]}});}return null;})[_0x6a78('0x39')](handleEntityNotFound(_0x5e812a,null))[_0x6a78('0x39')](function(_0x4089c8){if(_0x4089c8){return _0x4089c8['update']({'UserId':_0x317eb3['body'][_0x6a78('0x61')],'read1stAt':_[_0x6a78('0x66')](_0x4089c8[_0x6a78('0x67')])?moment()[_0x6a78('0x5f')](_0x6a78('0x60')):undefined});}return null;})['then'](function(_0x14dacf){if(_0x14dacf){_0x21a62f[_0x6a78('0x68')]=_0x14dacf[_0x6a78('0x63')]({'plain':!![]});interaction_log[_0x6a78('0x28')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x317eb3[_0x6a78('0x69')]['id'],_0x317eb3[_0x6a78('0x69')][_0x6a78('0x3b')],_0x317eb3['user']['role'],_0x21a62f[_0x6a78('0x68')]['id'],_0x317eb3['body']?JSON[_0x6a78('0x6a')](_0x317eb3[_0x6a78('0x57')]):_0x6a78('0x6b'));return respondWithRpcPromise(_0x6a78('0x6c'),_0x6a78('0x6d'),_0x21a62f);}return null;})[_0x6a78('0x39')](function(_0x2e01bd){var _0x52f125=_0x6a78('0x6e')+_0x2e01bd[_0x6a78('0x27')][_0x6a78('0x6f')];return db[_0x6a78('0x70')][_0x6a78('0x41')](_0x52f125,{'type':db[_0x6a78('0x71')][_0x6a78('0x72')][_0x6a78('0x73')],'raw':!![]})[_0x6a78('0x39')](function(_0x191866){return _0x191866;});})['then'](function(_0x420d23){if(_0x420d23){_0x21a62f[_0x6a78('0x27')]['contact']=_0x420d23[0x0];if(!_0x317eb3[_0x6a78('0x57')][_0x6a78('0x61')])return;return db['User'][_0x6a78('0x58')]({'where':{'id':_0x317eb3['body'][_0x6a78('0x61')],'role':'agent'},'attributes':['id',_0x6a78('0x3b'),_0x6a78('0x74'),_0x6a78('0x75'),_0x6a78('0x76')],'raw':!![]});}return null;})[_0x6a78('0x39')](function(_0x59f51e){if(!_0x59f51e)return null;_0x21a62f['message'][_0x6a78('0x62')]=_0x59f51e;return _0x21a62f;})[_0x6a78('0x39')](function(_0x389b40){if(_0x389b40){if(_0x317eb3[_0x6a78('0x57')][_0x6a78('0x77')]){_0x21a62f['message'][_0x6a78('0x78')]=util[_0x6a78('0x5f')]('SIP/%s',_0x317eb3[_0x6a78('0x69')][_0x6a78('0x3b')]);_0x21a62f['message'][_0x6a78('0x79')]=_0x21a62f[_0x6a78('0x79')];_0x21a62f[_0x6a78('0x27')][_0x6a78('0x7a')]=_0x21a62f[_0x6a78('0x79')];_0x21a62f[_0x6a78('0x27')][_0x6a78('0x7b')]=_0x6a78('0x5b');return respondWithRpcPromise(_0x6a78('0x7c'),_0x6a78('0x7c'),{'event':'acceptmessage','message':_0x21a62f['message']},client9002)[_0x6a78('0x39')](function(){return _0x21a62f;});}return _0x21a62f;}return null;})['then'](respondWithResult(_0x5e812a,null))[_0x6a78('0x2a')](handleError(_0x5e812a,null));};var interaction_log=require(_0x6a78('0x15'))(_0x6a78('0x5a'));exports[_0x6a78('0x35')]=function(_0x3f7b8f,_0xff493,_0x233a81){var _0x5707a0={'agent':{},'channel':_0x6a78('0x5c')};if(_0x3f7b8f[_0x6a78('0x57')]['id']){delete _0x3f7b8f[_0x6a78('0x57')]['id'];}_0x3f7b8f['body'][_0x6a78('0x61')]=_0x3f7b8f[_0x6a78('0x57')][_0x6a78('0x61')]||_0x3f7b8f[_0x6a78('0x69')]['id'];_0x5707a0[_0x6a78('0x62')]['id']=_0x3f7b8f[_0x6a78('0x57')][_0x6a78('0x61')];return db[_0x6a78('0x3e')][_0x6a78('0x58')]({'where':{'id':_0x3f7b8f[_0x6a78('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xff493,null))['then'](function(_0x4b59ef){if(_0x4b59ef){_0x5707a0[_0x6a78('0x27')]=_0x4b59ef[_0x6a78('0x63')]({'plain':!![]});return db[_0x6a78('0x64')][_0x6a78('0x58')]({'where':{'id':_0x4b59ef[_0x6a78('0x65')]}});}return null;})[_0x6a78('0x39')](handleEntityNotFound(_0xff493,null))['then'](function(_0x1d4117){if(_0x1d4117){_0x5707a0[_0x6a78('0x68')]=_0x1d4117[_0x6a78('0x63')]({'plain':!![]});interaction_log[_0x6a78('0x28')](_0x6a78('0x7d'),_0x3f7b8f[_0x6a78('0x69')]['id'],_0x3f7b8f[_0x6a78('0x69')]['name'],_0x3f7b8f[_0x6a78('0x69')][_0x6a78('0x7e')],_0x5707a0['interaction']['id'],_0x3f7b8f[_0x6a78('0x57')]?JSON[_0x6a78('0x6a')](_0x3f7b8f[_0x6a78('0x57')]):_0x6a78('0x6b'));return respondWithRpcPromise('RejectMessage',_0x6a78('0x7f'),_0x5707a0);}return null;})[_0x6a78('0x39')](function(_0x58d209){var _0x4b65b3=_0x6a78('0x6e')+_0x58d209[_0x6a78('0x27')][_0x6a78('0x6f')];return db['sequelize']['query'](_0x4b65b3,{'type':db[_0x6a78('0x71')]['QueryTypes'][_0x6a78('0x73')],'raw':!![]})[_0x6a78('0x39')](function(_0x332d95){return _0x332d95;});})[_0x6a78('0x39')](function(_0x6409af){if(_0x6409af){_0x5707a0['message'][_0x6a78('0x80')]=_0x6409af[0x0];if(!_0x3f7b8f[_0x6a78('0x57')][_0x6a78('0x61')])return;return db['User'][_0x6a78('0x58')]({'where':{'id':_0x3f7b8f['body'][_0x6a78('0x61')],'role':_0x6a78('0x62')},'attributes':['id',_0x6a78('0x3b'),_0x6a78('0x74'),_0x6a78('0x75'),_0x6a78('0x76')],'raw':!![]});}return null;})[_0x6a78('0x39')](function(_0x26391){if(!_0x26391)return null;_0x5707a0[_0x6a78('0x27')][_0x6a78('0x62')]=_0x26391;return _0x5707a0;})[_0x6a78('0x39')](function(_0x51227a){if(_0x51227a){_0x51227a[_0x6a78('0x27')][_0x6a78('0x78')]=util[_0x6a78('0x5f')](_0x6a78('0x81'),_0x3f7b8f[_0x6a78('0x69')][_0x6a78('0x3b')]);_0x51227a[_0x6a78('0x27')][_0x6a78('0x79')]=_0x5707a0[_0x6a78('0x79')];_0x51227a[_0x6a78('0x27')][_0x6a78('0x7a')]=_0x5707a0[_0x6a78('0x79')];_0x51227a[_0x6a78('0x27')][_0x6a78('0x7b')]='reject';respondWithRpcPromise(_0x6a78('0x7c'),_0x6a78('0x7c'),{'event':_0x6a78('0x82'),'message':_0x51227a[_0x6a78('0x27')]},client9002);return _0x5707a0;}return null;})['then'](respondWithResult(_0xff493,null))[_0x6a78('0x2a')](handleError(_0xff493,null));}; \ No newline at end of file +var _0x5cae=['filters','merge','filter','options','findAll','rows','show','include','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','email','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','json','reject','save','update','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','offset','order','sort','where'];(function(_0x11fc8b,_0x4ee51d){var _0x4ea86e=function(_0x50e5bf){while(--_0x50e5bf){_0x11fc8b['push'](_0x11fc8b['shift']());}};_0x4ea86e(++_0x4ee51d);}(_0x5cae,0xb1));var _0xe5ca=function(_0xf8a7f,_0x19433f){_0xf8a7f=_0xf8a7f-0x0;var _0x51ecff=_0x5cae[_0xf8a7f];return _0x51ecff;};'use strict';var emlformat=require(_0xe5ca('0x0'));var rimraf=require(_0xe5ca('0x1'));var zipdir=require(_0xe5ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5ca('0x3'));var moment=require(_0xe5ca('0x4'));var BPromise=require(_0xe5ca('0x5'));var Mustache=require(_0xe5ca('0x6'));var util=require(_0xe5ca('0x7'));var path=require(_0xe5ca('0x8'));var sox=require(_0xe5ca('0x9'));var csv=require(_0xe5ca('0xa'));var ejs=require(_0xe5ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe5ca('0xc'));var crypto=require(_0xe5ca('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe5ca('0xa'));var querystring=require(_0xe5ca('0xe'));var Papa=require(_0xe5ca('0xf'));var Redis=require(_0xe5ca('0x10'));var authService=require(_0xe5ca('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5ca('0x12'));var logger=require(_0xe5ca('0x13'))('api');var utils=require(_0xe5ca('0x14'));var config=require(_0xe5ca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5ca('0x16'))['db'];config[_0xe5ca('0x17')]=_['defaults'](config[_0xe5ca('0x17')],{'host':_0xe5ca('0x18'),'port':0x18eb});var socket=require(_0xe5ca('0x19'))(new Redis(config[_0xe5ca('0x17')]));require(_0xe5ca('0x1a'))[_0xe5ca('0x1b')](socket);var jayson=require(_0xe5ca('0x1c'));var client=jayson[_0xe5ca('0x1d')][_0xe5ca('0x1e')]({'port':0x232c});var client9002=jayson[_0xe5ca('0x1d')][_0xe5ca('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x364d74,_0x38568e,_0x22d80f,_0x5f0a44){return new BPromise(function(_0x2d9434,_0x2cf85f){var _0x23676c=_0x5f0a44||client;return _0x23676c[_0xe5ca('0x1f')](_0x364d74,_0x22d80f)[_0xe5ca('0x20')](function(_0x19d6c9){logger[_0xe5ca('0x21')](_0xe5ca('0x22'),_0x38568e,_0xe5ca('0x23'));logger[_0xe5ca('0x24')](_0xe5ca('0x25'),_0x38568e,_0xe5ca('0x23'),JSON[_0xe5ca('0x26')](_0x19d6c9));if(_0x19d6c9[_0xe5ca('0x27')]){if(_0x19d6c9['error']['code']===0x1f4){logger[_0xe5ca('0x27')](_0xe5ca('0x22'),_0x38568e,_0x19d6c9[_0xe5ca('0x27')]['message']);return _0x2cf85f(_0x19d6c9[_0xe5ca('0x27')]['message']);}logger[_0xe5ca('0x27')](_0xe5ca('0x22'),_0x38568e,_0x19d6c9[_0xe5ca('0x27')][_0xe5ca('0x28')]);return _0x2d9434(_0x19d6c9[_0xe5ca('0x27')][_0xe5ca('0x28')]);}else{logger[_0xe5ca('0x21')](_0xe5ca('0x22'),_0x38568e,'request\x20sent');_0x2d9434(_0x19d6c9[_0xe5ca('0x29')]['message']);}})[_0xe5ca('0x2a')](function(_0x127eee){logger[_0xe5ca('0x27')](_0xe5ca('0x22'),_0x38568e,_0x127eee);_0x2cf85f(_0x127eee);});});}function respondWithStatusCode(_0x7c9f29,_0x1723c1){_0x1723c1=_0x1723c1||0xcc;return function(_0x273bfe){if(_0x273bfe){return _0x7c9f29[_0xe5ca('0x2b')](_0x1723c1);}return _0x7c9f29[_0xe5ca('0x2c')](_0x1723c1)[_0xe5ca('0x2d')]();};}function respondWithResult(_0x2b3212,_0x425d37){_0x425d37=_0x425d37||0xc8;return function(_0x402355){if(_0x402355){return _0x2b3212['status'](_0x425d37)['json'](_0x402355);}};}function respondWithFilteredResult(_0x1abebe,_0x5418ef){return function(_0x13c5ee){if(_0x13c5ee){var _0x51ae2c=typeof _0x5418ef['offset']===_0xe5ca('0x2e')&&typeof _0x5418ef[_0xe5ca('0x2f')]===_0xe5ca('0x2e');var _0x8e2dcc=_0x13c5ee[_0xe5ca('0x30')];var _0x92426e=_0x51ae2c?0x0:_0x5418ef['offset'];var _0x386af9=_0x51ae2c?_0x13c5ee[_0xe5ca('0x30')]:_0x5418ef['offset']+_0x5418ef[_0xe5ca('0x2f')];var _0x371b9d;if(_0x386af9>=_0x8e2dcc){_0x386af9=_0x8e2dcc;_0x371b9d=0xc8;}else{_0x371b9d=0xce;}_0x1abebe['status'](_0x371b9d);return _0x1abebe['set']('Content-Range',_0x92426e+'-'+_0x386af9+'/'+_0x8e2dcc)[_0xe5ca('0x31')](_0x13c5ee);}return null;};}function patchUpdates(_0x44fdc9){return function(_0x1b1db3){try{jsonpatch['apply'](_0x1b1db3,_0x44fdc9,!![]);}catch(_0xe11117){return BPromise[_0xe5ca('0x32')](_0xe11117);}return _0x1b1db3[_0xe5ca('0x33')]();};}function saveUpdates(_0x59ad62,_0x10f4c4){return function(_0x3454c1){if(_0x3454c1){return _0x3454c1[_0xe5ca('0x34')](_0x59ad62)[_0xe5ca('0x20')](function(_0x4b947e){return _0x4b947e;});}return null;};}function removeEntity(_0x4f8627,_0x4dfed1){return function(_0x40e784){if(_0x40e784){return _0x40e784[_0xe5ca('0x35')]()['then'](function(){_0x4f8627[_0xe5ca('0x2c')](0xcc)[_0xe5ca('0x2d')]();});}};}function handleEntityNotFound(_0x58616b,_0x566f70){return function(_0x49847f){if(!_0x49847f){_0x58616b[_0xe5ca('0x2b')](0x194);}return _0x49847f;};}function handleError(_0x2f83d0,_0x41dd15){_0x41dd15=_0x41dd15||0x1f4;return function(_0x5031a4){logger['error'](_0x5031a4['stack']);if(_0x5031a4['name']){delete _0x5031a4[_0xe5ca('0x36')];}_0x2f83d0[_0xe5ca('0x2c')](_0x41dd15)['send'](_0x5031a4);};}exports[_0xe5ca('0x37')]=function(_0x3427b3,_0x1050d6){var _0x1aa3a6={},_0x5d17c3={},_0xfc47a3={'count':0x0,'rows':[]};var _0x29167e=_[_0xe5ca('0x38')](db[_0xe5ca('0x39')][_0xe5ca('0x3a')],function(_0x2bd3e2){return{'name':_0x2bd3e2[_0xe5ca('0x3b')],'type':_0x2bd3e2[_0xe5ca('0x3c')][_0xe5ca('0x3d')]};});_0x5d17c3[_0xe5ca('0x3e')]=_['map'](_0x29167e,_0xe5ca('0x36'));_0x5d17c3[_0xe5ca('0x3f')]=_[_0xe5ca('0x40')](_0x3427b3[_0xe5ca('0x3f')]);_0x5d17c3['filters']=_[_0xe5ca('0x41')](_0x5d17c3[_0xe5ca('0x3e')],_0x5d17c3[_0xe5ca('0x3f')]);_0x1aa3a6[_0xe5ca('0x42')]=_[_0xe5ca('0x41')](_0x5d17c3['model'],qs[_0xe5ca('0x43')](_0x3427b3[_0xe5ca('0x3f')][_0xe5ca('0x43')]));_0x1aa3a6[_0xe5ca('0x42')]=_0x1aa3a6[_0xe5ca('0x42')]['length']?_0x1aa3a6[_0xe5ca('0x42')]:_0x5d17c3[_0xe5ca('0x3e')];if(!_0x3427b3['query']['hasOwnProperty'](_0xe5ca('0x44'))){_0x1aa3a6['limit']=qs[_0xe5ca('0x2f')](_0x3427b3[_0xe5ca('0x3f')][_0xe5ca('0x2f')]);_0x1aa3a6[_0xe5ca('0x45')]=qs[_0xe5ca('0x45')](_0x3427b3['query'][_0xe5ca('0x45')]);}_0x1aa3a6[_0xe5ca('0x46')]=qs['sort'](_0x3427b3[_0xe5ca('0x3f')][_0xe5ca('0x47')]);_0x1aa3a6[_0xe5ca('0x48')]=qs[_0xe5ca('0x49')](_['pick'](_0x3427b3['query'],_0x5d17c3[_0xe5ca('0x49')]),_0x29167e);if(_0x3427b3[_0xe5ca('0x3f')]['filter']){_0x1aa3a6[_0xe5ca('0x48')]=_[_0xe5ca('0x4a')](_0x1aa3a6[_0xe5ca('0x48')],{'$or':_['map'](_0x29167e,function(_0xbd0394){if(_0xbd0394['type']!=='VIRTUAL'){var _0x3b5080={};_0x3b5080[_0xbd0394['name']]={'$like':'%'+_0x3427b3['query'][_0xe5ca('0x4b')]+'%'};return _0x3b5080;}})});}_0x1aa3a6=_[_0xe5ca('0x4a')]({},_0x1aa3a6,_0x3427b3[_0xe5ca('0x4c')]);var _0x32d97b={'where':_0x1aa3a6[_0xe5ca('0x48')]};return db[_0xe5ca('0x39')][_0xe5ca('0x30')](_0x32d97b)[_0xe5ca('0x20')](function(_0x1f252a){_0xfc47a3[_0xe5ca('0x30')]=_0x1f252a;if(_0x3427b3['query']['includeAll']){_0x1aa3a6['include']=[{'all':!![]}];}return db[_0xe5ca('0x39')][_0xe5ca('0x4d')](_0x1aa3a6);})[_0xe5ca('0x20')](function(_0x3b6992){_0xfc47a3[_0xe5ca('0x4e')]=_0x3b6992;return _0xfc47a3;})[_0xe5ca('0x20')](respondWithFilteredResult(_0x1050d6,_0x1aa3a6))[_0xe5ca('0x2a')](handleError(_0x1050d6,null));};exports[_0xe5ca('0x4f')]=function(_0x3ffda4,_0x1ed978){var _0x1b2ecc={'raw':!![],'where':{'id':_0x3ffda4['params']['id']}},_0x8a1e5c={};_0x8a1e5c[_0xe5ca('0x3e')]=_[_0xe5ca('0x40')](db[_0xe5ca('0x39')][_0xe5ca('0x3a')]);_0x8a1e5c[_0xe5ca('0x3f')]=_[_0xe5ca('0x40')](_0x3ffda4[_0xe5ca('0x3f')]);_0x8a1e5c['filters']=_[_0xe5ca('0x41')](_0x8a1e5c[_0xe5ca('0x3e')],_0x8a1e5c[_0xe5ca('0x3f')]);_0x1b2ecc[_0xe5ca('0x42')]=_[_0xe5ca('0x41')](_0x8a1e5c[_0xe5ca('0x3e')],qs[_0xe5ca('0x43')](_0x3ffda4[_0xe5ca('0x3f')][_0xe5ca('0x43')]));_0x1b2ecc[_0xe5ca('0x42')]=_0x1b2ecc[_0xe5ca('0x42')]['length']?_0x1b2ecc[_0xe5ca('0x42')]:_0x8a1e5c[_0xe5ca('0x3e')];if(_0x3ffda4[_0xe5ca('0x3f')]['includeAll']){_0x1b2ecc[_0xe5ca('0x50')]=[{'all':!![]}];}_0x1b2ecc=_[_0xe5ca('0x4a')]({},_0x1b2ecc,_0x3ffda4['options']);return db[_0xe5ca('0x39')][_0xe5ca('0x51')](_0x1b2ecc)[_0xe5ca('0x20')](handleEntityNotFound(_0x1ed978,null))[_0xe5ca('0x20')](respondWithResult(_0x1ed978,null))['catch'](handleError(_0x1ed978,null));};exports[_0xe5ca('0x52')]=function(_0x198ff4,_0x458e49){return db[_0xe5ca('0x39')][_0xe5ca('0x52')](_0x198ff4[_0xe5ca('0x53')],{})['then'](respondWithResult(_0x458e49,0xc9))[_0xe5ca('0x2a')](handleError(_0x458e49,null));};exports['update']=function(_0x3e5128,_0x3fce6f){if(_0x3e5128[_0xe5ca('0x53')]['id']){delete _0x3e5128['body']['id'];}return db[_0xe5ca('0x39')][_0xe5ca('0x51')]({'where':{'id':_0x3e5128['params']['id']}})['then'](handleEntityNotFound(_0x3fce6f,null))[_0xe5ca('0x20')](saveUpdates(_0x3e5128[_0xe5ca('0x53')],null))['then'](respondWithResult(_0x3fce6f,null))[_0xe5ca('0x2a')](handleError(_0x3fce6f,null));};exports['destroy']=function(_0x302caf,_0x916865){return db[_0xe5ca('0x39')][_0xe5ca('0x51')]({'where':{'id':_0x302caf[_0xe5ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x916865,null))['then'](removeEntity(_0x916865,null))[_0xe5ca('0x2a')](handleError(_0x916865,null));};exports[_0xe5ca('0x55')]=function(_0x14e337,_0x50f8c0){return db['OpenchannelMessage'][_0xe5ca('0x55')]()[_0xe5ca('0x20')](respondWithResult(_0x50f8c0,null))[_0xe5ca('0x2a')](handleError(_0x50f8c0,null));};var interaction_log=require(_0xe5ca('0x13'))(_0xe5ca('0x56'));exports[_0xe5ca('0x57')]=function(_0x5436b8,_0x169829,_0x29ec43){var _0x5aaa68={'agent':{},'channel':_0xe5ca('0x58')};if(_0x5436b8[_0xe5ca('0x53')]['id']){delete _0x5436b8[_0xe5ca('0x53')]['id'];}_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x59')]=!![];_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x5a')]=moment()[_0xe5ca('0x5b')](_0xe5ca('0x5c'));_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x5d')]=_0x5436b8['body'][_0xe5ca('0x5d')]||_0x5436b8[_0xe5ca('0x5e')]['id'];_0x5aaa68[_0xe5ca('0x5f')]['id']=_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x5d')];return db[_0xe5ca('0x39')][_0xe5ca('0x51')]({'where':{'id':_0x5436b8['params']['id'],'UserId':null}})[_0xe5ca('0x20')](handleEntityNotFound(_0x169829,null))['then'](saveUpdates(_0x5436b8['body'],null))[_0xe5ca('0x20')](function(_0x361f1a){if(_0x361f1a){_0x5aaa68['message']=_0x361f1a[_0xe5ca('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xe5ca('0x51')]({'where':{'id':_0x361f1a[_0xe5ca('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x169829,null))[_0xe5ca('0x20')](function(_0x370a3d){if(_0x370a3d){return _0x370a3d[_0xe5ca('0x34')]({'UserId':_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x5d')],'read1stAt':_['isNil'](_0x370a3d[_0xe5ca('0x62')])?moment()[_0xe5ca('0x5b')](_0xe5ca('0x5c')):undefined});}return null;})[_0xe5ca('0x20')](function(_0x21f88e){if(_0x21f88e){_0x5aaa68[_0xe5ca('0x63')]=_0x21f88e['get']({'plain':!![]});interaction_log[_0xe5ca('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5436b8[_0xe5ca('0x5e')]['id'],_0x5436b8[_0xe5ca('0x5e')][_0xe5ca('0x36')],_0x5436b8[_0xe5ca('0x5e')][_0xe5ca('0x64')],_0x5aaa68[_0xe5ca('0x63')]['id'],_0x5436b8[_0xe5ca('0x53')]?JSON[_0xe5ca('0x26')](_0x5436b8[_0xe5ca('0x53')]):_0xe5ca('0x65'));return respondWithRpcPromise(_0xe5ca('0x66'),_0xe5ca('0x67'),_0x5aaa68);}return null;})[_0xe5ca('0x20')](function(_0x9d41d9){var _0x2be3c4=_0xe5ca('0x68')+_0x9d41d9[_0xe5ca('0x28')]['ContactId'];return db[_0xe5ca('0x69')]['query'](_0x2be3c4,{'type':db['Sequelize'][_0xe5ca('0x6a')][_0xe5ca('0x6b')],'raw':!![]})['then'](function(_0x3be899){return _0x3be899;});})['then'](function(_0x5f4d72){if(_0x5f4d72){_0x5aaa68[_0xe5ca('0x28')][_0xe5ca('0x6c')]=_0x5f4d72[0x0];if(!_0x5436b8[_0xe5ca('0x53')][_0xe5ca('0x5d')])return;return db[_0xe5ca('0x6d')][_0xe5ca('0x51')]({'where':{'id':_0x5436b8['body']['UserId'],'role':_0xe5ca('0x5f')},'attributes':['id',_0xe5ca('0x36'),_0xe5ca('0x6e'),'email',_0xe5ca('0x6f')],'raw':!![]});}return null;})['then'](function(_0x5789ff){if(!_0x5789ff)return null;_0x5aaa68[_0xe5ca('0x28')]['agent']=_0x5789ff;return _0x5aaa68;})[_0xe5ca('0x20')](function(_0x4e8b00){if(_0x4e8b00){if(_0x5436b8['body'][_0xe5ca('0x70')]){_0x5aaa68[_0xe5ca('0x28')][_0xe5ca('0x71')]=util[_0xe5ca('0x5b')](_0xe5ca('0x72'),_0x5436b8[_0xe5ca('0x5e')][_0xe5ca('0x36')]);_0x5aaa68[_0xe5ca('0x28')][_0xe5ca('0x73')]=_0x5aaa68['channel'];_0x5aaa68[_0xe5ca('0x28')]['motionChannel']=_0x5aaa68[_0xe5ca('0x73')];_0x5aaa68['message'][_0xe5ca('0x74')]='accept';return respondWithRpcPromise(_0xe5ca('0x75'),_0xe5ca('0x75'),{'event':'acceptmessage','message':_0x5aaa68[_0xe5ca('0x28')]},client9002)[_0xe5ca('0x20')](function(){return _0x5aaa68;});}return _0x5aaa68;}return null;})[_0xe5ca('0x20')](respondWithResult(_0x169829,null))[_0xe5ca('0x2a')](handleError(_0x169829,null));};var interaction_log=require(_0xe5ca('0x13'))(_0xe5ca('0x56'));exports['reject']=function(_0x3986b7,_0x1a2e7e,_0x57910b){var _0x117deb={'agent':{},'channel':_0xe5ca('0x58')};if(_0x3986b7['body']['id']){delete _0x3986b7['body']['id'];}_0x3986b7[_0xe5ca('0x53')][_0xe5ca('0x5d')]=_0x3986b7[_0xe5ca('0x53')][_0xe5ca('0x5d')]||_0x3986b7['user']['id'];_0x117deb[_0xe5ca('0x5f')]['id']=_0x3986b7[_0xe5ca('0x53')][_0xe5ca('0x5d')];return db['OpenchannelMessage'][_0xe5ca('0x51')]({'where':{'id':_0x3986b7[_0xe5ca('0x54')]['id'],'UserId':null}})[_0xe5ca('0x20')](handleEntityNotFound(_0x1a2e7e,null))['then'](function(_0x35b6c3){if(_0x35b6c3){_0x117deb[_0xe5ca('0x28')]=_0x35b6c3[_0xe5ca('0x60')]({'plain':!![]});return db[_0xe5ca('0x76')][_0xe5ca('0x51')]({'where':{'id':_0x35b6c3['OpenchannelInteractionId']}});}return null;})[_0xe5ca('0x20')](handleEntityNotFound(_0x1a2e7e,null))[_0xe5ca('0x20')](function(_0x3e988e){if(_0x3e988e){_0x117deb[_0xe5ca('0x63')]=_0x3e988e[_0xe5ca('0x60')]({'plain':!![]});interaction_log['info'](_0xe5ca('0x77'),_0x3986b7[_0xe5ca('0x5e')]['id'],_0x3986b7[_0xe5ca('0x5e')][_0xe5ca('0x36')],_0x3986b7[_0xe5ca('0x5e')][_0xe5ca('0x64')],_0x117deb[_0xe5ca('0x63')]['id'],_0x3986b7[_0xe5ca('0x53')]?JSON[_0xe5ca('0x26')](_0x3986b7[_0xe5ca('0x53')]):'null');return respondWithRpcPromise('RejectMessage',_0xe5ca('0x78'),_0x117deb);}return null;})[_0xe5ca('0x20')](function(_0x29bcba){var _0xebd50d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29bcba[_0xe5ca('0x28')]['ContactId'];return db[_0xe5ca('0x69')][_0xe5ca('0x3f')](_0xebd50d,{'type':db[_0xe5ca('0x79')][_0xe5ca('0x6a')][_0xe5ca('0x6b')],'raw':!![]})[_0xe5ca('0x20')](function(_0x121cb0){return _0x121cb0;});})[_0xe5ca('0x20')](function(_0x5c355a){if(_0x5c355a){_0x117deb[_0xe5ca('0x28')][_0xe5ca('0x6c')]=_0x5c355a[0x0];if(!_0x3986b7[_0xe5ca('0x53')]['UserId'])return;return db[_0xe5ca('0x6d')][_0xe5ca('0x51')]({'where':{'id':_0x3986b7[_0xe5ca('0x53')][_0xe5ca('0x5d')],'role':_0xe5ca('0x5f')},'attributes':['id',_0xe5ca('0x36'),_0xe5ca('0x6e'),_0xe5ca('0x7a'),_0xe5ca('0x6f')],'raw':!![]});}return null;})[_0xe5ca('0x20')](function(_0x344ff8){if(!_0x344ff8)return null;_0x117deb['message'][_0xe5ca('0x5f')]=_0x344ff8;return _0x117deb;})[_0xe5ca('0x20')](function(_0x25a2d9){if(_0x25a2d9){_0x25a2d9[_0xe5ca('0x28')][_0xe5ca('0x71')]=util['format']('SIP/%s',_0x3986b7[_0xe5ca('0x5e')]['name']);_0x25a2d9[_0xe5ca('0x28')]['channel']=_0x117deb['channel'];_0x25a2d9['message'][_0xe5ca('0x7b')]=_0x117deb[_0xe5ca('0x73')];_0x25a2d9[_0xe5ca('0x28')][_0xe5ca('0x74')]=_0xe5ca('0x32');respondWithRpcPromise('EventManager',_0xe5ca('0x75'),{'event':_0xe5ca('0x7c'),'message':_0x25a2d9[_0xe5ca('0x28')]},client9002);return _0x117deb;}return null;})['then'](respondWithResult(_0x1a2e7e,null))[_0xe5ca('0x2a')](handleError(_0x1a2e7e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 19261db..d82d604 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 _0x13e2=['OpenchannelMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x340e24,_0xde71e){var _0x1808a=function(_0x2a602e){while(--_0x2a602e){_0x340e24['push'](_0x340e24['shift']());}};_0x1808a(++_0xde71e);}(_0x13e2,0x13f));var _0x213e=function(_0x3e7eed,_0x4e34f2){_0x3e7eed=_0x3e7eed-0x0;var _0x3abb58=_0x13e2[_0x3e7eed];return _0x3abb58;};'use strict';var EventEmitter=require(_0x213e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x213e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x213e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x213e('0x3')};function emitEvent(_0x3ee5fa){return function(_0x407b79,_0xfde52d,_0x369247){OpenchannelMessageEvents[_0x213e('0x4')](_0x3ee5fa+':'+_0x407b79['id'],_0x407b79);OpenchannelMessageEvents[_0x213e('0x4')](_0x3ee5fa,_0x407b79);_0x369247(null);};}for(var e in events){if(events[_0x213e('0x5')](e)){var event=events[e];OpenchannelMessage[_0x213e('0x6')](e,emitEvent(event));}}module[_0x213e('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x05bc=['hook','exports','events','OpenchannelMessage','save','remove','emit','hasOwnProperty'];(function(_0x20d994,_0x4f8973){var _0x468771=function(_0x1483bd){while(--_0x1483bd){_0x20d994['push'](_0x20d994['shift']());}};_0x468771(++_0x4f8973);}(_0x05bc,0x1d2));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc05b('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xc05b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc05b('0x2'),'afterUpdate':'update','afterDestroy':_0xc05b('0x3')};function emitEvent(_0x17878d){return function(_0x14743f,_0x1f4e67,_0x5083b4){OpenchannelMessageEvents[_0xc05b('0x4')](_0x17878d+':'+_0x14743f['id'],_0x14743f);OpenchannelMessageEvents[_0xc05b('0x4')](_0x17878d,_0x14743f);_0x5083b4(null);};}for(var e in events){if(events[_0xc05b('0x5')](e)){var event=events[e];OpenchannelMessage[_0xc05b('0x6')](e,emitEvent(event));}}module[_0xc05b('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4536ccb..78a0d2e 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 _0xf087=['OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info'];(function(_0x53562d,_0x341ba8){var _0x3ae3f9=function(_0x387ad2){while(--_0x387ad2){_0x53562d['push'](_0x53562d['shift']());}};_0x3ae3f9(++_0x341ba8);}(_0xf087,0x165));var _0x7f08=function(_0x2de541,_0x2e21a7){_0x2de541=_0x2de541-0x0;var _0x21ce9c=_0xf087[_0x2de541];return _0x21ce9c;};'use strict';var _=require(_0x7f08('0x0'));var util=require('util');var logger=require(_0x7f08('0x1'))(_0x7f08('0x2'));var moment=require('moment');var BPromise=require(_0x7f08('0x3'));var rp=require(_0x7f08('0x4'));var fs=require('fs');var path=require(_0x7f08('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x7f08('0x6')]=function(_0x2f555e,_0x30ec3c){return _0x2f555e['define'](_0x7f08('0x7'),attributes,{'tableName':_0x7f08('0x8'),'paranoid':![],'indexes':[{'name':_0x7f08('0x9'),'fields':['body'],'type':_0x7f08('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d5506,_0x2f1eba,_0x4f64e8){var _0x304f5c=_0x2f555e[_0x7f08('0xb')];var _0x39cb25=_0x4d5506[_0x7f08('0xc')]({'plain':!![]});if(_0x39cb25['direction'][_0x7f08('0xd')]()==='in'||_0x39cb25[_0x7f08('0xe')][_0x7f08('0xd')]()===_0x7f08('0xf')&&!_0x39cb25[_0x7f08('0x10')]&&!_['isNil'](_0x39cb25[_0x7f08('0x11')])){_0x304f5c[_0x7f08('0x12')]['findOne']({'where':{'id':_0x39cb25[_0x7f08('0x13')]}})[_0x7f08('0x14')](function(_0x5dc35a){if(_0x5dc35a){_0x5dc35a[_0x7f08('0x15')]({'lastMsgAt':_0x39cb25[_0x7f08('0x16')],'lastMsgDirection':_0x39cb25[_0x7f08('0xe')][_0x7f08('0xd')]()});}})[_0x7f08('0x17')](function(_0x2c50a5){console[_0x7f08('0x18')](_0x2c50a5);});}if(_0x39cb25[_0x7f08('0xe')]===_0x7f08('0xf')&&!_0x39cb25['secret']){var _0x1e2e19;_0x304f5c[_0x7f08('0x19')][_0x7f08('0x1a')]()[_0x7f08('0x14')](function(_0x1abf2d){return _0x304f5c[_0x7f08('0x1b')][_0x7f08('0x1c')]({'where':{'id':_0x39cb25[_0x7f08('0x1d')]},'include':[{'model':_0x304f5c[_0x7f08('0x12')],'as':_0x7f08('0x1e'),'where':{'id':_0x39cb25[_0x7f08('0x13')]},'limit':0x1,'include':[{'model':_0x304f5c[_0x7f08('0x19')],'as':_0x7f08('0x1f'),'attributes':_[_0x7f08('0x20')](_0x1abf2d)}]}]});})[_0x7f08('0x14')](function(_0x84d208){_0x1e2e19=_0x84d208[_0x7f08('0xc')]({'plain':!![]});if(_0x1e2e19&&_0x1e2e19[_0x7f08('0x21')]){logger[_0x7f08('0x22')](_0x7f08('0x23'),'afterCreate',util[_0x7f08('0x24')](_0x7f08('0x25'),_0x39cb25['id'],_0x1e2e19[_0x7f08('0x21')]));if(_0x1e2e19[_0x7f08('0x1e')]&&_0x1e2e19[_0x7f08('0x1e')]['length']){_0x39cb25[_0x7f08('0x26')]=_[_0x7f08('0x27')](_0x1e2e19[_0x7f08('0x1e')][0x0],'Contact');_0x39cb25[_0x7f08('0x1f')]=_0x1e2e19[_0x7f08('0x1e')][0x0][_0x7f08('0x1f')];}var _0x2f1eba={'method':_0x7f08('0x28'),'uri':encodeURI(_0x1e2e19[_0x7f08('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2f1eba[_0x7f08('0x29')]){case _0x7f08('0x2a'):_0x2f1eba['qs']=_0x39cb25;break;case _0x7f08('0x28'):_0x2f1eba[_0x7f08('0x2b')]=_0x39cb25;break;}return rp(_0x2f1eba)[_0x7f08('0x14')](function(_0x484162){logger['info'](_0x7f08('0x23'),'afterCreate',util[_0x7f08('0x24')](_0x7f08('0x2c'),_0x39cb25['id'],_0x1e2e19[_0x7f08('0x21')]));if(_0x484162[_0x7f08('0x2b')][_0x7f08('0x2d')]&&_0x484162[_0x7f08('0x2b')][_0x7f08('0x2d')]!=_0x39cb25[_0x7f08('0x26')][_0x7f08('0x2d')]){return _0x304f5c[_0x7f08('0x12')]['update']({'threadId':_0x484162[_0x7f08('0x2b')][_0x7f08('0x2d')]},{'where':{'id':_0x39cb25[_0x7f08('0x26')]['id']}});}else{return;}})[_0x7f08('0x14')](function(){return _0x4d5506[_0x7f08('0x15')]({'read':!![]});})['catch'](function(_0x99211a){logger['error'](_0x7f08('0x23'),'afterCreate',util[_0x7f08('0x2e')](_0x99211a,{'showHidden':![],'depth':null}));_0x4f64e8();});}else{_0x4f64e8();}})[_0x7f08('0x2f')](function(){_0x4f64e8();});}else{_0x4f64e8();}}},'charset':_0x7f08('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe0e3=['then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','CmContact','describe'];(function(_0x68ac0,_0x55efce){var _0x297f69=function(_0x53ac41){while(--_0x53ac41){_0x68ac0['push'](_0x68ac0['shift']());}};_0x297f69(++_0x55efce);}(_0xe0e3,0x1ea));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0e('0x0'));var util=require(_0x3e0e('0x1'));var logger=require(_0x3e0e('0x2'))(_0x3e0e('0x3'));var moment=require(_0x3e0e('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e0e('0x5'));var fs=require('fs');var path=require(_0x3e0e('0x6'));var rimraf=require(_0x3e0e('0x7'));var config=require(_0x3e0e('0x8'));var attributes=require(_0x3e0e('0x9'));module[_0x3e0e('0xa')]=function(_0x3a2139,_0x2022c8){return _0x3a2139[_0x3e0e('0xb')]('OpenchannelMessage',attributes,{'tableName':_0x3e0e('0xc'),'paranoid':![],'indexes':[{'name':_0x3e0e('0xd'),'fields':[_0x3e0e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11433a,_0x221732,_0x577c67){var _0x5b0662=_0x3a2139['models'];var _0x59acd0=_0x11433a[_0x3e0e('0xf')]({'plain':!![]});if(_0x59acd0[_0x3e0e('0x10')][_0x3e0e('0x11')]()==='in'||_0x59acd0[_0x3e0e('0x10')][_0x3e0e('0x11')]()===_0x3e0e('0x12')&&!_0x59acd0[_0x3e0e('0x13')]&&!_[_0x3e0e('0x14')](_0x59acd0[_0x3e0e('0x15')])){_0x5b0662[_0x3e0e('0x16')][_0x3e0e('0x17')]({'where':{'id':_0x59acd0[_0x3e0e('0x18')]}})['then'](function(_0x36cc4c){if(_0x36cc4c){_0x36cc4c[_0x3e0e('0x19')]({'lastMsgAt':_0x59acd0['createdAt'],'lastMsgDirection':_0x59acd0['direction'][_0x3e0e('0x11')]()});}})[_0x3e0e('0x1a')](function(_0x588544){console[_0x3e0e('0x1b')](_0x588544);});}if(_0x59acd0[_0x3e0e('0x10')]===_0x3e0e('0x12')&&!_0x59acd0[_0x3e0e('0x13')]){var _0x531dae;_0x5b0662[_0x3e0e('0x1c')][_0x3e0e('0x1d')]()[_0x3e0e('0x1e')](function(_0x354dc9){return _0x5b0662[_0x3e0e('0x1f')][_0x3e0e('0x20')]({'where':{'id':_0x59acd0[_0x3e0e('0x21')]},'include':[{'model':_0x5b0662[_0x3e0e('0x16')],'as':_0x3e0e('0x22'),'where':{'id':_0x59acd0[_0x3e0e('0x18')]},'limit':0x1,'include':[{'model':_0x5b0662['CmContact'],'as':_0x3e0e('0x23'),'attributes':_[_0x3e0e('0x24')](_0x354dc9)}]}]});})[_0x3e0e('0x1e')](function(_0x3f238c){_0x531dae=_0x3f238c['get']({'plain':!![]});if(_0x531dae&&_0x531dae[_0x3e0e('0x25')]){logger['info'](_0x3e0e('0x26'),_0x3e0e('0x27'),util[_0x3e0e('0x28')](_0x3e0e('0x29'),_0x59acd0['id'],_0x531dae[_0x3e0e('0x25')]));if(_0x531dae[_0x3e0e('0x22')]&&_0x531dae[_0x3e0e('0x22')][_0x3e0e('0x2a')]){_0x59acd0[_0x3e0e('0x2b')]=_[_0x3e0e('0x2c')](_0x531dae[_0x3e0e('0x22')][0x0],_0x3e0e('0x23'));_0x59acd0[_0x3e0e('0x23')]=_0x531dae[_0x3e0e('0x22')][0x0][_0x3e0e('0x23')];}var _0x221732={'method':'POST','uri':encodeURI(_0x531dae[_0x3e0e('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x221732['method']){case'GET':_0x221732['qs']=_0x59acd0;break;case _0x3e0e('0x2d'):_0x221732[_0x3e0e('0xe')]=_0x59acd0;break;}return rp(_0x221732)['then'](function(_0x351bc2){logger[_0x3e0e('0x2e')](_0x3e0e('0x26'),_0x3e0e('0x27'),util[_0x3e0e('0x28')](_0x3e0e('0x2f'),_0x59acd0['id'],_0x531dae[_0x3e0e('0x25')]));if(_0x351bc2[_0x3e0e('0xe')][_0x3e0e('0x30')]&&_0x351bc2['body'][_0x3e0e('0x30')]!=_0x59acd0[_0x3e0e('0x2b')][_0x3e0e('0x30')]){return _0x5b0662[_0x3e0e('0x16')][_0x3e0e('0x19')]({'threadId':_0x351bc2['body'][_0x3e0e('0x30')]},{'where':{'id':_0x59acd0['Interaction']['id']}});}else{return;}})[_0x3e0e('0x1e')](function(){return _0x11433a[_0x3e0e('0x19')]({'read':!![]});})['catch'](function(_0x53b712){logger[_0x3e0e('0x1b')](_0x3e0e('0x26'),_0x3e0e('0x27'),util[_0x3e0e('0x31')](_0x53b712,{'showHidden':![],'depth':null}));_0x577c67();});}else{_0x577c67();}})[_0x3e0e('0x32')](function(){_0x577c67();});}else{_0x577c67();}}},'charset':'utf8mb4','collate':_0x3e0e('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8502319..1cd9f06 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xec6420,_0x354833){var _0x57cb19=function(_0x5054c8){while(--_0x5054c8){_0xec6420['push'](_0xec6420['shift']());}};_0x57cb19(++_0x354833);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b3127,_0x51cdc5){_0x3b3127=_0x3b3127-0x0;var _0x19c58f=_0x5f2f[_0x3b3127];return _0x19c58f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x233c5e,_0xc9ec7b){var _0x3e926=function(_0x5332ae){while(--_0x5332ae){_0x233c5e['push'](_0x233c5e['shift']());}};_0x3e926(++_0xc9ec7b);}(_0xadb5,0xad));var _0x5adb=function(_0x5d536d,_0x59ef0e){_0x5d536d=_0x5d536d-0x0;var _0x36d8ab=_0xadb5[_0x5d536d];return _0x36d8ab;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8e64335..4f301bc 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 _0x1d01=['register','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x9f99d5,_0x4dce75){var _0x4254d2=function(_0x35eeaf){while(--_0x35eeaf){_0x9f99d5['push'](_0x9f99d5['shift']());}};_0x4254d2(++_0x4dce75);}(_0x1d01,0xb7));var _0x11d0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d01[_0x2641f9];return _0x585741;};'use strict';var OpenchannelMessageEvents=require(_0x11d0('0x0'));var events=[_0x11d0('0x1'),_0x11d0('0x2'),_0x11d0('0x3')];function createListener(_0x222d4a,_0x1580f7){return function(_0x467b74){_0x1580f7[_0x11d0('0x4')](_0x222d4a,_0x467b74);};}function removeListener(_0xcf9d78,_0x31ce1b){return function(){OpenchannelMessageEvents[_0x11d0('0x5')](_0xcf9d78,_0x31ce1b);};}exports[_0x11d0('0x6')]=function(_0x3617ab){for(var _0x56d9c5=0x0,_0x4ec0e4=events['length'];_0x56d9c5<_0x4ec0e4;_0x56d9c5++){var _0x583243=events[_0x56d9c5];var _0x5a35db=createListener('openchannelMessage:'+_0x583243,_0x3617ab);OpenchannelMessageEvents['on'](_0x583243,_0x5a35db);}}; \ No newline at end of file +var _0xa53e=['remove','update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x3c8df7,_0x1606d8){var _0x2ba7ed=function(_0x3de15a){while(--_0x3de15a){_0x3c8df7['push'](_0x3c8df7['shift']());}};_0x2ba7ed(++_0x1606d8);}(_0xa53e,0xe6));var _0xea53=function(_0x336e2b,_0x5a01a5){_0x336e2b=_0x336e2b-0x0;var _0x58f2b8=_0xa53e[_0x336e2b];return _0x58f2b8;};'use strict';var OpenchannelMessageEvents=require(_0xea53('0x0'));var events=['save',_0xea53('0x1'),_0xea53('0x2')];function createListener(_0x5da833,_0x31dbb){return function(_0x3ad2cc){_0x31dbb['emit'](_0x5da833,_0x3ad2cc);};}function removeListener(_0x2b11f7,_0x5b46b6){return function(){OpenchannelMessageEvents[_0xea53('0x3')](_0x2b11f7,_0x5b46b6);};}exports[_0xea53('0x4')]=function(_0x599f62){for(var _0x299106=0x0,_0x1877c1=events[_0xea53('0x5')];_0x299106<_0x1877c1;_0x299106++){var _0x5baa34=events[_0x299106];var _0x1a4e70=createListener(_0xea53('0x6')+_0x5baa34,_0x599f62);OpenchannelMessageEvents['on'](_0x5baa34,_0x1a4e70);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2b491cd..c5e5b4c 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 _0x495d=['fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x495d,0x144));var _0xd495=function(_0x25260d,_0x50a767){_0x25260d=_0x25260d-0x0;var _0x1adee3=_0x495d[_0x25260d];return _0x1adee3;};'use strict';var multer=require(_0xd495('0x0'));var util=require(_0xd495('0x1'));var path=require(_0xd495('0x2'));var timeout=require(_0xd495('0x3'));var express=require(_0xd495('0x4'));var router=express[_0xd495('0x5')]();var fs_extra=require(_0xd495('0x6'));var auth=require(_0xd495('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd495('0x8'));var controller=require(_0xd495('0x9'));router['get']('/',auth[_0xd495('0xa')](),controller[_0xd495('0xb')]);router[_0xd495('0xc')](_0xd495('0xd'),auth[_0xd495('0xa')](),controller[_0xd495('0xe')]);router[_0xd495('0xc')]('/:id',auth[_0xd495('0xa')](),controller[_0xd495('0xf')]);router['get'](_0xd495('0x10'),auth[_0xd495('0xa')](),controller[_0xd495('0x11')]);router[_0xd495('0xc')](_0xd495('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd495('0xc')](_0xd495('0x13'),auth[_0xd495('0xa')](),controller[_0xd495('0x14')]);router[_0xd495('0x15')]('/',auth[_0xd495('0xa')](),controller['create']);router['post'](_0xd495('0x12'),auth[_0xd495('0xa')](),controller[_0xd495('0x16')]);router['post'](_0xd495('0x13'),auth[_0xd495('0xa')](),controller['addAgents']);router[_0xd495('0x17')](_0xd495('0x18'),auth[_0xd495('0xa')](),controller[_0xd495('0x19')]);router[_0xd495('0x1a')](_0xd495('0x18'),auth[_0xd495('0xa')](),controller[_0xd495('0x1b')]);router[_0xd495('0x1a')](_0xd495('0x12'),auth[_0xd495('0xa')](),controller['removeTeams']);router[_0xd495('0x1a')](_0xd495('0x13'),auth[_0xd495('0xa')](),controller[_0xd495('0x1c')]);module[_0xd495('0x1d')]=router; \ No newline at end of file +var _0x5240=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x247f36,_0x333e5b){var _0x4e5abd=function(_0xb3371f){while(--_0xb3371f){_0x247f36['push'](_0x247f36['shift']());}};_0x4e5abd(++_0x333e5b);}(_0x5240,0x18b));var _0x0524=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0x5240[_0x368c85];return _0x3477c2;};'use strict';var multer=require(_0x0524('0x0'));var util=require(_0x0524('0x1'));var path=require('path');var timeout=require(_0x0524('0x2'));var express=require(_0x0524('0x3'));var router=express['Router']();var fs_extra=require(_0x0524('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0524('0x5'));var config=require(_0x0524('0x6'));var controller=require(_0x0524('0x7'));router[_0x0524('0x8')]('/',auth[_0x0524('0x9')](),controller[_0x0524('0xa')]);router[_0x0524('0x8')](_0x0524('0xb'),auth['isAuthenticated'](),controller[_0x0524('0xc')]);router[_0x0524('0x8')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller[_0x0524('0xe')]);router[_0x0524('0x8')](_0x0524('0xf'),auth[_0x0524('0x9')](),controller[_0x0524('0x10')]);router[_0x0524('0x8')](_0x0524('0x11'),auth[_0x0524('0x9')](),controller[_0x0524('0x12')]);router['get'](_0x0524('0x13'),auth[_0x0524('0x9')](),controller[_0x0524('0x14')]);router[_0x0524('0x15')]('/',auth['isAuthenticated'](),controller[_0x0524('0x16')]);router[_0x0524('0x15')](_0x0524('0x11'),auth[_0x0524('0x9')](),controller[_0x0524('0x17')]);router[_0x0524('0x15')]('/:id/users',auth[_0x0524('0x9')](),controller[_0x0524('0x18')]);router[_0x0524('0x19')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller['update']);router[_0x0524('0x1a')](_0x0524('0xd'),auth[_0x0524('0x9')](),controller[_0x0524('0x1b')]);router['delete'](_0x0524('0x11'),auth[_0x0524('0x9')](),controller[_0x0524('0x1c')]);router['delete']('/:id/users',auth[_0x0524('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c7050c8..9e9b0f4 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 _0xe07f=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x2ce749,_0x424d84){var _0x14c15f=function(_0x49f5dc){while(--_0x49f5dc){_0x2ce749['push'](_0x2ce749['shift']());}};_0x14c15f(++_0x424d84);}(_0xe07f,0x1ea));var _0xfe07=function(_0x370300,_0x512b14){_0x370300=_0x370300-0x0;var _0x373e05=_0xe07f[_0x370300];return _0x373e05;};'use strict';var Sequelize=require(_0xfe07('0x0'));module[_0xfe07('0x1')]={'name':{'type':Sequelize[_0xfe07('0x2')],'unique':_0xfe07('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe07('0x2')]},'timeout':{'type':Sequelize[_0xfe07('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfe07('0x5'),_0xfe07('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xcd06=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x3fd256,_0x254b92){var _0x58f65f=function(_0x530544){while(--_0x530544){_0x3fd256['push'](_0x3fd256['shift']());}};_0x58f65f(++_0x254b92);}(_0xcd06,0x1a1));var _0x6cd0=function(_0x24f5e0,_0x400a2e){_0x24f5e0=_0x24f5e0-0x0;var _0x3e9cab=_0xcd06[_0x24f5e0];return _0x3e9cab;};'use strict';var Sequelize=require(_0x6cd0('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cd0('0x1')],'unique':_0x6cd0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cd0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cd0('0x3')](_0x6cd0('0x4'),_0x6cd0('0x5'),_0x6cd0('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 60b1d1c..bbb6b33 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 _0x27fd=['localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','User','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','nolimit','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','squel','../../components/parsers/qs','api','../../config/environment','redis'];(function(_0x12f72a,_0x78d97f){var _0x344514=function(_0x54d7ba){while(--_0x54d7ba){_0x12f72a['push'](_0x12f72a['shift']());}};_0x344514(++_0x78d97f);}(_0x27fd,0x6e));var _0xd27f=function(_0x24eab8,_0x2f471c){_0x24eab8=_0x24eab8-0x0;var _0x41d883=_0x27fd[_0x24eab8];return _0x41d883;};'use strict';var BPromise=require(_0xd27f('0x0'));var util=require('util');var _=require(_0xd27f('0x1'));var squel=require(_0xd27f('0x2'));var Redis=require('ioredis');var qs=require(_0xd27f('0x3'));var logger=require('../../config/logger')(_0xd27f('0x4'));var config=require(_0xd27f('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd27f('0x6')],{'host':_0xd27f('0x7'),'port':0x18eb});var socket=require(_0xd27f('0x8'))(new Redis(config[_0xd27f('0x6')]));require(_0xd27f('0x9'))['register'](socket);function respondWithStatusCode(_0x3e9e3e,_0x11af55){_0x11af55=_0x11af55||0xcc;return function(_0x1ca96d){if(_0x1ca96d){return _0x3e9e3e[_0xd27f('0xa')](_0x11af55);}return _0x3e9e3e[_0xd27f('0xb')](_0x11af55)[_0xd27f('0xc')]();};}function respondWithResult(_0x18ab25,_0x4cffed){_0x4cffed=_0x4cffed||0xc8;return function(_0x1904d3){if(_0x1904d3){return _0x18ab25['status'](_0x4cffed)[_0xd27f('0xd')](_0x1904d3);}};}function respondWithFilteredResult(_0x4ffce9,_0x236005){return function(_0x1a0f9a){if(_0x1a0f9a){var _0x2cf4a1=typeof _0x236005[_0xd27f('0xe')]===_0xd27f('0xf')&&typeof _0x236005[_0xd27f('0x10')]===_0xd27f('0xf');var _0xe3b2e4=_0x1a0f9a['count'];var _0x41ee70=_0x2cf4a1?0x0:_0x236005[_0xd27f('0xe')];var _0x48139b=_0x2cf4a1?_0x1a0f9a[_0xd27f('0x11')]:_0x236005[_0xd27f('0xe')]+_0x236005[_0xd27f('0x10')];var _0x34cf55;if(_0x48139b>=_0xe3b2e4){_0x48139b=_0xe3b2e4;_0x34cf55=0xc8;}else{_0x34cf55=0xce;}_0x4ffce9[_0xd27f('0xb')](_0x34cf55);return _0x4ffce9[_0xd27f('0x12')](_0xd27f('0x13'),_0x41ee70+'-'+_0x48139b+'/'+_0xe3b2e4)[_0xd27f('0xd')](_0x1a0f9a);}return null;};}function saveUpdates(_0x569369){return function(_0x32e096){if(_0x32e096){return _0x32e096['update'](_0x569369)[_0xd27f('0x14')](function(_0x12dcca){return _0x12dcca;});}return null;};}function removeEntity(_0x2576cb){return function(_0x1294d9){if(_0x1294d9){return _0x1294d9[_0xd27f('0x15')]()[_0xd27f('0x14')](function(){var _0x1c5d76=_0x1294d9[_0xd27f('0x16')]({'plain':!![]});var _0x5f0164='OpenchannelQueues';return db[_0xd27f('0x17')]['destroy']({'where':{'type':_0x5f0164,'resourceId':_0x1c5d76['id']}})[_0xd27f('0x14')](function(){return _0x1294d9;});})[_0xd27f('0x14')](function(){_0x2576cb['status'](0xcc)[_0xd27f('0xc')]();});}};}function handleEntityNotFound(_0x2ed200){return function(_0x11f465){if(!_0x11f465){_0x2ed200['sendStatus'](0x194);}return _0x11f465;};}function handleError(_0x42ac0b,_0x3fc6b9){_0x3fc6b9=_0x3fc6b9||0x1f4;return function(_0x23cd55){logger['error'](_0x23cd55[_0xd27f('0x18')]);if(_0x23cd55[_0xd27f('0x19')]){delete _0x23cd55[_0xd27f('0x19')];}_0x42ac0b[_0xd27f('0xb')](_0x3fc6b9)['send'](_0x23cd55);};}exports['index']=function(_0x39b9f5,_0x552333){var _0x3440e8={};var _0xc0615d={'count':0x0,'rows':[]};var _0x2111c7=_[_0xd27f('0x1a')](db[_0xd27f('0x1b')][_0xd27f('0x1c')],function(_0x57640d){return{'name':_0x57640d[_0xd27f('0x1d')],'type':_0x57640d[_0xd27f('0x1e')]['key']};});_0x3440e8=qs['getOptions'](_0x2111c7,_0x39b9f5);var _0x1639d4={'where':_0x3440e8[_0xd27f('0x1f')]};return db[_0xd27f('0x1b')][_0xd27f('0x11')](_0x1639d4)[_0xd27f('0x14')](function(_0x28f246){_0xc0615d[_0xd27f('0x11')]=_0x28f246;_0x3440e8[_0xd27f('0x20')]=qs[_0xd27f('0x20')](_0x39b9f5[_0xd27f('0x21')]);return db[_0xd27f('0x1b')][_0xd27f('0x22')](_0x3440e8);})['then'](function(_0x3432ba){_0xc0615d[_0xd27f('0x23')]=_0x3432ba;return _0xc0615d;})[_0xd27f('0x14')](respondWithFilteredResult(_0x552333,_0x3440e8))[_0xd27f('0x24')](handleError(_0x552333,null));};exports[_0xd27f('0x25')]=function(_0x1eb692,_0x43da5b){var _0x43139b={'raw':!![],'where':{'id':_0x1eb692[_0xd27f('0x26')]['id']}},_0x1d46d5={};_0x1d46d5[_0xd27f('0x27')]=_[_0xd27f('0x28')](db['OpenchannelQueue'][_0xd27f('0x1c')]);_0x1d46d5[_0xd27f('0x21')]=_['keys'](_0x1eb692[_0xd27f('0x21')]);_0x1d46d5[_0xd27f('0x29')]=_[_0xd27f('0x2a')](_0x1d46d5[_0xd27f('0x27')],_0x1d46d5[_0xd27f('0x21')]);_0x43139b[_0xd27f('0x2b')]=_[_0xd27f('0x2a')](_0x1d46d5[_0xd27f('0x27')],qs[_0xd27f('0x2c')](_0x1eb692[_0xd27f('0x21')][_0xd27f('0x2c')]));_0x43139b[_0xd27f('0x2b')]=_0x43139b[_0xd27f('0x2b')][_0xd27f('0x2d')]?_0x43139b[_0xd27f('0x2b')]:_0x1d46d5[_0xd27f('0x27')];if(_0x1eb692[_0xd27f('0x21')][_0xd27f('0x2e')]){_0x43139b[_0xd27f('0x20')]=[{'all':!![]}];}_0x43139b=_[_0xd27f('0x2f')]({},_0x43139b,_0x1eb692[_0xd27f('0x30')]);return db[_0xd27f('0x1b')][_0xd27f('0x31')](_0x43139b)['then'](handleEntityNotFound(_0x43da5b,null))['then'](respondWithResult(_0x43da5b,null))[_0xd27f('0x24')](handleError(_0x43da5b,null));};exports[_0xd27f('0x32')]=function(_0x17e95a,_0x4b3744){return db[_0xd27f('0x1b')][_0xd27f('0x32')](_0x17e95a[_0xd27f('0x33')],{})[_0xd27f('0x14')](function(_0x35d89d){var _0x232e13=_0x17e95a[_0xd27f('0x34')]['get']({'plain':!![]});if(!_0x232e13)throw new Error(_0xd27f('0x35'));if(_0x232e13[_0xd27f('0x36')]==='user'){var _0x3212ec=_0x35d89d['get']({'plain':!![]});var _0xfb39a=_0xd27f('0x37');return db['UserProfileSection'][_0xd27f('0x31')]({'where':{'name':_0xfb39a,'userProfileId':_0x232e13[_0xd27f('0x38')]},'raw':!![]})[_0xd27f('0x14')](function(_0x284625){if(_0x284625&&_0x284625[_0xd27f('0x39')]===0x0){return db[_0xd27f('0x17')][_0xd27f('0x32')]({'name':_0x3212ec[_0xd27f('0x19')],'resourceId':_0x3212ec['id'],'type':_0x284625['name'],'sectionId':_0x284625['id']},{})[_0xd27f('0x14')](function(){return _0x35d89d;});}else{return _0x35d89d;}})[_0xd27f('0x24')](function(_0x1a27f8){logger[_0xd27f('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a27f8);throw _0x1a27f8;});}return _0x35d89d;})[_0xd27f('0x14')](respondWithResult(_0x4b3744,0xc9))['catch'](handleError(_0x4b3744,null));};exports[_0xd27f('0x3b')]=function(_0x13e42b,_0x2eff45){if(_0x13e42b['body']['id']){delete _0x13e42b[_0xd27f('0x33')]['id'];}return db[_0xd27f('0x1b')]['find']({'where':{'id':_0x13e42b[_0xd27f('0x26')]['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x2eff45,null))[_0xd27f('0x14')](saveUpdates(_0x13e42b[_0xd27f('0x33')],null))[_0xd27f('0x14')](respondWithResult(_0x2eff45,null))[_0xd27f('0x24')](handleError(_0x2eff45,null));};exports[_0xd27f('0x15')]=function(_0x5eb9ee,_0x811098){return db['OpenchannelQueue'][_0xd27f('0x31')]({'where':{'id':_0x5eb9ee['params']['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x811098,null))['then'](removeEntity(_0x811098,null))[_0xd27f('0x24')](handleError(_0x811098,null));};exports[_0xd27f('0x3c')]=function(_0x4c5c35,_0xb6a7e){return db[_0xd27f('0x1b')][_0xd27f('0x3c')]()[_0xd27f('0x14')](respondWithResult(_0xb6a7e,null))['catch'](handleError(_0xb6a7e,null));};exports[_0xd27f('0x3d')]=function(_0x9a3fd0,_0x531a21){var _0x51de99={'raw':!![],'where':{}},_0x34f075={},_0x4538e3;return db[_0xd27f('0x1b')][_0xd27f('0x3e')]({'where':{'id':_0x9a3fd0[_0xd27f('0x26')]['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x531a21,null))[_0xd27f('0x14')](function(_0x43f908){if(_0x43f908){_0x4538e3=_0x43f908[_0xd27f('0x16')]({'plain':!![]});_0x34f075['model']=_['keys'](db[_0xd27f('0x3f')][_0xd27f('0x1c')]);_0x34f075['query']=_[_0xd27f('0x28')](_0x9a3fd0[_0xd27f('0x21')]);_0x34f075[_0xd27f('0x29')]=_[_0xd27f('0x2a')](_0x34f075[_0xd27f('0x27')],_0x34f075[_0xd27f('0x21')]);_0x51de99['attributes']=_[_0xd27f('0x2a')](_0x34f075['model'],qs[_0xd27f('0x2c')](_0x9a3fd0[_0xd27f('0x21')]['fields']));_0x51de99[_0xd27f('0x2b')]=_0x51de99['attributes'][_0xd27f('0x2d')]?_0x51de99[_0xd27f('0x2b')]:_0x34f075[_0xd27f('0x27')];if(!_0x9a3fd0['query'][_0xd27f('0x40')]('nolimit')){_0x51de99[_0xd27f('0x10')]=qs['limit'](_0x9a3fd0[_0xd27f('0x21')][_0xd27f('0x10')]);_0x51de99['offset']=qs[_0xd27f('0xe')](_0x9a3fd0[_0xd27f('0x21')]['offset']);}_0x51de99[_0xd27f('0x41')]=qs[_0xd27f('0x42')](_0x9a3fd0['query'][_0xd27f('0x42')]);_0x51de99[_0xd27f('0x1f')]=qs[_0xd27f('0x29')](_[_0xd27f('0x43')](_0x9a3fd0[_0xd27f('0x21')],_0x34f075['filters']));_0x51de99['where'][_0xd27f('0x44')]=_0x43f908['id'];if(_0x9a3fd0[_0xd27f('0x21')][_0xd27f('0x45')]){_0x51de99[_0xd27f('0x1f')]=_[_0xd27f('0x2f')](_0x51de99[_0xd27f('0x1f')],{'$or':_[_0xd27f('0x1a')](_0x51de99['attributes'],function(_0x255492){var _0x505152={};_0x505152[_0x255492]={'$like':'%'+_0x9a3fd0[_0xd27f('0x21')][_0xd27f('0x45')]+'%'};return _0x505152;})});}_0x51de99=_[_0xd27f('0x2f')]({},_0x51de99,_0x9a3fd0[_0xd27f('0x30')]);return db['UserOpenchannelQueue'][_0xd27f('0x22')](_0x51de99);}})['then'](function(_0x384125){if(_0x384125){return db[_0xd27f('0x46')]['findAndCountAll']({'where':{'id':_[_0xd27f('0x1a')](_0x384125,_0xd27f('0x47')),'role':'agent'},'attributes':['id',_0xd27f('0x19'),_0xd27f('0x48'),_0xd27f('0x49'),_0xd27f('0x4a')]});}})[_0xd27f('0x14')](function(_0x2644f1){if(_0x2644f1){return{'count':_0x2644f1[_0xd27f('0x11')],'rows':_[_0xd27f('0x1a')](_0x2644f1[_0xd27f('0x23')],function(_0x4baeb6){return{'membername':_0x4baeb6[_0xd27f('0x19')],'UserId':_0x4baeb6['id'],'queue_name':_0x4538e3[_0xd27f('0x19')],'OpenchannelQueueId':_0x4538e3['id'],'interface':util[_0xd27f('0x4b')](_0xd27f('0x4c'),'SIP',_0x4baeb6[_0xd27f('0x19')]),'penalty':0x0,'paused':_0x4baeb6[_0xd27f('0x48')],'createdAt':_0x4baeb6[_0xd27f('0x4a')],'updatedAt':_0x4baeb6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd27f('0x14')](respondWithFilteredResult(_0x531a21,_0x51de99))[_0xd27f('0x24')](handleError(_0x531a21,null));};exports[_0xd27f('0x4d')]=function(_0xe1af06,_0x174844){var _0x3c8e61={};var _0x2d2fa1={};var _0x307a59;var _0x5c3bae;return db[_0xd27f('0x1b')][_0xd27f('0x3e')]({'where':{'id':_0xe1af06[_0xd27f('0x26')]['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x174844,null))[_0xd27f('0x14')](function(_0x3a9ca0){if(_0x3a9ca0){_0x307a59=_0x3a9ca0;_0x2d2fa1[_0xd27f('0x27')]=_['keys'](db['Team'][_0xd27f('0x1c')]);_0x2d2fa1[_0xd27f('0x21')]=_[_0xd27f('0x28')](_0xe1af06[_0xd27f('0x21')]);_0x2d2fa1[_0xd27f('0x29')]=_['intersection'](_0x2d2fa1['model'],_0x2d2fa1['query']);_0x3c8e61[_0xd27f('0x2b')]=_[_0xd27f('0x2a')](_0x2d2fa1[_0xd27f('0x27')],qs[_0xd27f('0x2c')](_0xe1af06[_0xd27f('0x21')]['fields']));_0x3c8e61[_0xd27f('0x2b')]=_0x3c8e61[_0xd27f('0x2b')][_0xd27f('0x2d')]?_0x3c8e61[_0xd27f('0x2b')]:_0x2d2fa1[_0xd27f('0x27')];_0x3c8e61['order']=qs['sort'](_0xe1af06[_0xd27f('0x21')][_0xd27f('0x42')]);_0x3c8e61['where']=qs[_0xd27f('0x29')](_[_0xd27f('0x43')](_0xe1af06[_0xd27f('0x21')],_0x2d2fa1['filters']));if(_0xe1af06[_0xd27f('0x21')][_0xd27f('0x45')]){_0x3c8e61[_0xd27f('0x1f')]=_[_0xd27f('0x2f')](_0x3c8e61[_0xd27f('0x1f')],{'$or':_[_0xd27f('0x1a')](_0x3c8e61[_0xd27f('0x2b')],function(_0x10ade1){var _0x3824b6={};_0x3824b6[_0x10ade1]={'$like':'%'+_0xe1af06[_0xd27f('0x21')][_0xd27f('0x45')]+'%'};return _0x3824b6;})});}_0x3c8e61=_[_0xd27f('0x2f')]({},_0x3c8e61,_0xe1af06[_0xd27f('0x30')]);return _0x307a59['getTeams'](_0x3c8e61);}})[_0xd27f('0x14')](function(_0x157640){if(_0x157640){_0x5c3bae=_0x157640[_0xd27f('0x2d')];if(!_0xe1af06['query']['hasOwnProperty'](_0xd27f('0x4e'))){_0x3c8e61[_0xd27f('0x10')]=qs[_0xd27f('0x10')](_0xe1af06[_0xd27f('0x21')][_0xd27f('0x10')]);_0x3c8e61[_0xd27f('0xe')]=qs[_0xd27f('0xe')](_0xe1af06[_0xd27f('0x21')][_0xd27f('0xe')]);}return _0x307a59[_0xd27f('0x4d')](_0x3c8e61);}})['then'](function(_0x388724){if(_0x388724){return _0x388724?{'count':_0x5c3bae,'rows':_0x388724}:null;}})[_0xd27f('0x14')](respondWithResult(_0x174844,null))[_0xd27f('0x24')](handleError(_0x174844,null));};exports[_0xd27f('0x4f')]=function(_0x483977,_0x15865b){var _0x3a657b=_0x483977[_0xd27f('0x33')][_0xd27f('0x50')];return db[_0xd27f('0x51')][_0xd27f('0x22')]({'where':{'id':_0x3a657b},'attributes':['id'],'include':[{'model':db[_0xd27f('0x46')],'as':_0xd27f('0x52'),'attributes':['id',_0xd27f('0x19'),'online',_0xd27f('0x53'),_0xd27f('0x54')],'raw':!![]}]})['then'](function(_0x474b3e){if(_0x474b3e){var _0x3655b0=_[_0xd27f('0x55')](_0x474b3e,function(_0x396cc5){var _0x1c8d92=_0x396cc5[_0xd27f('0x16')]({'plain':!![]});return _0x1c8d92['Agents'];});return db[_0xd27f('0x1b')][_0xd27f('0x31')]({'where':{'id':_0x483977[_0xd27f('0x26')]['id']}})[_0xd27f('0x14')](function(_0x3aabd4){return db[_0xd27f('0x56')]['transaction'](function(_0x32a681){return _0x3aabd4[_0xd27f('0x4f')](_0x3a657b,{'transaction':_0x32a681})[_0xd27f('0x14')](function(){return BPromise[_0xd27f('0x57')](_0x3655b0,function(_0x452bc3){return db[_0xd27f('0x3f')][_0xd27f('0x58')]({'where':{'UserId':_0x452bc3['id'],'OpenchannelQueueId':_0x483977[_0xd27f('0x26')]['id']},'transaction':_0x32a681});});})[_0xd27f('0x14')](function(){_0x3655b0[_0xd27f('0x59')](function(_0x5863da){socket[_0xd27f('0x5a')](_0xd27f('0x5b'),{'UserId':_0x5863da['id'],'OpenchannelQueueId':_0x3aabd4['id']});});});});});}})['then'](respondWithStatusCode(_0x15865b,null))[_0xd27f('0x24')](handleError(_0x15865b,null));};exports[_0xd27f('0x5c')]=function(_0xa759c7,_0x39c2e4){return db[_0xd27f('0x51')][_0xd27f('0x22')]({'where':{'id':_0xa759c7[_0xd27f('0x21')][_0xd27f('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd27f('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39c2e4,null))[_0xd27f('0x14')](function(_0x28965b){var _0x5d2f86=_['map'](_0x28965b,'id');var _0x774c9f=[];var _0x2289e0=[];var _0x46b819=squel[_0xd27f('0x5d')]();_0x46b819['field'](_0xd27f('0x5e'))[_0xd27f('0x5f')]('team_has_openchannel_queues','tq')['join'](_0xd27f('0x60'),'ut',_0xd27f('0x61'))[_0xd27f('0x1f')](_0xd27f('0x62'),_0xa759c7[_0xd27f('0x26')]['id']);for(var _0x12105d=0x0;_0x12105d<_0x28965b[_0xd27f('0x2d')];_0x12105d+=0x1){let _0x172296=_0x28965b[_0x12105d];for(var _0xd176da=0x0;_0xd176da<_0x172296[_0xd27f('0x52')]['length'];_0xd176da+=0x1){let _0x7276d1=_0x172296[_0xd27f('0x52')][_0xd176da];var _0x313ac8=_0x46b819[_0xd27f('0x63')]();_0x313ac8[_0xd27f('0x1f')](_0xd27f('0x64'),_0x7276d1['id']);_0x2289e0[_0xd27f('0x65')](db[_0xd27f('0x56')][_0xd27f('0x21')](_0x313ac8[_0xd27f('0x66')](),{'type':db[_0xd27f('0x56')]['QueryTypes'][_0xd27f('0x67')]})[_0xd27f('0x14')](function(_0x229b32){if(_0x229b32['length']===0x1){return _0x7276d1['id'];}else{var _0x4baf46=_['every'](_[_0xd27f('0x1a')](_0x229b32,'TeamId'),function(_0x5ed043){return _['includes'](_0x5d2f86,_0x5ed043);});if(_0x4baf46){return _0x7276d1['id'];}}}));}}return BPromise[_0xd27f('0x68')](_0x2289e0)[_0xd27f('0x14')](function(_0xf9ff8e){_0x774c9f=_(_0x774c9f)[_0xd27f('0x69')](_0xf9ff8e)[_0xd27f('0x6a')]()[_0xd27f('0x6b')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xa759c7['params']['id']}})[_0xd27f('0x14')](function(_0x4f88ab){return db[_0xd27f('0x56')][_0xd27f('0x6c')](function(_0x15fdff){return _0x4f88ab[_0xd27f('0x5c')](_0xa759c7[_0xd27f('0x21')][_0xd27f('0x50')],{'transaction':_0x15fdff})[_0xd27f('0x14')](function(){if(!_[_0xd27f('0x6d')](_0x774c9f)){return _0x4f88ab[_0xd27f('0x6e')](_0x774c9f,{'transaction':_0x15fdff});}})[_0xd27f('0x14')](function(){_0x774c9f[_0xd27f('0x59')](function(_0x1e9d38){socket[_0xd27f('0x5a')]('userOpenchannelQueue:remove',{'UserId':_0x1e9d38,'OpenchannelQueueId':_0x4f88ab['id']});});});});});});})[_0xd27f('0x14')](respondWithStatusCode(_0x39c2e4,null))['catch'](handleError(_0x39c2e4,null));};exports[_0xd27f('0x6f')]=function(_0x29434e,_0x46c5c2){return db[_0xd27f('0x1b')][_0xd27f('0x31')]({'where':{'id':_0x29434e['params']['id']}})['then'](handleEntityNotFound(_0x46c5c2,null))[_0xd27f('0x14')](function(_0x2c52d6){if(_0x2c52d6){return _0x2c52d6[_0xd27f('0x6f')](_0x29434e[_0xd27f('0x33')][_0xd27f('0x50')],_[_0xd27f('0x70')](_0x29434e[_0xd27f('0x33')],['ids','id'])||{})[_0xd27f('0x71')](function(_0x5e2b46){for(var _0x8a2267=0x0;_0x8a2267<_0x29434e[_0xd27f('0x33')]['ids']['length'];_0x8a2267+=0x1){socket[_0xd27f('0x5a')](_0xd27f('0x5b'),{'UserId':Number(_0x29434e[_0xd27f('0x33')][_0xd27f('0x50')][_0x8a2267]),'OpenchannelQueueId':Number(_0x29434e[_0xd27f('0x26')]['id'])});}return _0x5e2b46;});}})[_0xd27f('0x14')](respondWithResult(_0x46c5c2,null))[_0xd27f('0x24')](handleError(_0x46c5c2,null));};exports[_0xd27f('0x6e')]=function(_0x4da090,_0x4396f3){return db[_0xd27f('0x1b')][_0xd27f('0x31')]({'where':{'id':_0x4da090['params']['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x4396f3,null))[_0xd27f('0x14')](function(_0x1eddc7){if(_0x1eddc7){return _0x1eddc7[_0xd27f('0x6e')](_0x4da090[_0xd27f('0x21')][_0xd27f('0x50')])[_0xd27f('0x14')](function(){if(_[_0xd27f('0x72')](_0x4da090[_0xd27f('0x21')]['ids'])){for(var _0x4775bd=0x0;_0x4775bd<_0x4da090[_0xd27f('0x21')][_0xd27f('0x50')]['length'];_0x4775bd+=0x1){socket[_0xd27f('0x5a')](_0xd27f('0x73'),{'UserId':Number(_0x4da090[_0xd27f('0x21')][_0xd27f('0x50')][_0x4775bd]),'OpenchannelQueueId':Number(_0x4da090['params']['id'])});}}else{socket[_0xd27f('0x5a')](_0xd27f('0x73'),{'UserId':Number(_0x4da090[_0xd27f('0x21')][_0xd27f('0x50')]),'OpenchannelQueueId':Number(_0x4da090['params']['id'])});}});}})[_0xd27f('0x14')](respondWithStatusCode(_0x4396f3,null))[_0xd27f('0x24')](handleError(_0x4396f3,null));};exports[_0xd27f('0x74')]=function(_0x103f62,_0x98bd7c){var _0x4e43b5={};var _0x4cfade={};var _0x1adf3e;var _0xe88957;return db[_0xd27f('0x1b')][_0xd27f('0x3e')]({'where':{'id':_0x103f62[_0xd27f('0x26')]['id']}})[_0xd27f('0x14')](handleEntityNotFound(_0x98bd7c,null))[_0xd27f('0x14')](function(_0x49452c){if(_0x49452c){_0x1adf3e=_0x49452c;_0x4cfade[_0xd27f('0x27')]=_[_0xd27f('0x28')](db[_0xd27f('0x46')][_0xd27f('0x1c')]);_0x4cfade[_0xd27f('0x21')]=_[_0xd27f('0x28')](_0x103f62[_0xd27f('0x21')]);_0x4cfade[_0xd27f('0x29')]=_[_0xd27f('0x2a')](_0x4cfade[_0xd27f('0x27')],_0x4cfade[_0xd27f('0x21')]);_0x4e43b5[_0xd27f('0x2b')]=_[_0xd27f('0x2a')](_0x4cfade[_0xd27f('0x27')],qs[_0xd27f('0x2c')](_0x103f62[_0xd27f('0x21')][_0xd27f('0x2c')]));_0x4e43b5['attributes']=_0x4e43b5[_0xd27f('0x2b')][_0xd27f('0x2d')]?_0x4e43b5['attributes']:_0x4cfade[_0xd27f('0x27')];_0x4e43b5[_0xd27f('0x41')]=qs[_0xd27f('0x42')](_0x103f62[_0xd27f('0x21')][_0xd27f('0x42')]);_0x4e43b5[_0xd27f('0x1f')]=qs[_0xd27f('0x29')](_[_0xd27f('0x43')](_0x103f62[_0xd27f('0x21')],_0x4cfade['filters']));if(_0x103f62[_0xd27f('0x21')][_0xd27f('0x45')]){_0x4e43b5[_0xd27f('0x1f')]=_[_0xd27f('0x2f')](_0x4e43b5['where'],{'$or':_[_0xd27f('0x1a')](_0x4e43b5[_0xd27f('0x2b')],function(_0x55964a){var _0x69ba41={};_0x69ba41[_0x55964a]={'$like':'%'+_0x103f62[_0xd27f('0x21')][_0xd27f('0x45')]+'%'};return _0x69ba41;})});}_0x4e43b5=_['merge']({},_0x4e43b5,_0x103f62[_0xd27f('0x30')]);return _0x1adf3e[_0xd27f('0x74')](_0x4e43b5);}})[_0xd27f('0x14')](function(_0x320b84){if(_0x320b84){_0xe88957=_0x320b84[_0xd27f('0x2d')];if(!_0x103f62[_0xd27f('0x21')]['hasOwnProperty'](_0xd27f('0x4e'))){_0x4e43b5[_0xd27f('0x10')]=qs[_0xd27f('0x10')](_0x103f62[_0xd27f('0x21')][_0xd27f('0x10')]);_0x4e43b5[_0xd27f('0xe')]=qs[_0xd27f('0xe')](_0x103f62[_0xd27f('0x21')][_0xd27f('0xe')]);}return _0x1adf3e[_0xd27f('0x74')](_0x4e43b5);}})[_0xd27f('0x14')](function(_0xdaa237){if(_0xdaa237){return _0xdaa237?{'count':_0xe88957,'rows':_0xdaa237}:null;}})[_0xd27f('0x14')](respondWithResult(_0x98bd7c,null))[_0xd27f('0x24')](handleError(_0x98bd7c,null));}; \ No newline at end of file +var _0x9771=['key','getOptions','where','include','query','rows','catch','show','params','keys','filters','intersection','attributes','model','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserOpenchannelQueue','nolimit','sort','pick','filter','merge','findAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','order','hasOwnProperty','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','User','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','OpenchannelQueues','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type'];(function(_0x7a3956,_0x38d1e8){var _0x4a53b8=function(_0x260c90){while(--_0x260c90){_0x7a3956['push'](_0x7a3956['shift']());}};_0x4a53b8(++_0x38d1e8);}(_0x9771,0xc9));var _0x1977=function(_0x1a6032,_0x45c1c7){_0x1a6032=_0x1a6032-0x0;var _0x352265=_0x9771[_0x1a6032];return _0x352265;};'use strict';var BPromise=require(_0x1977('0x0'));var util=require(_0x1977('0x1'));var _=require(_0x1977('0x2'));var squel=require(_0x1977('0x3'));var Redis=require(_0x1977('0x4'));var qs=require(_0x1977('0x5'));var logger=require(_0x1977('0x6'))(_0x1977('0x7'));var config=require(_0x1977('0x8'));var db=require('../../mysqldb')['db'];config[_0x1977('0x9')]=_['defaults'](config['redis'],{'host':_0x1977('0xa'),'port':0x18eb});var socket=require(_0x1977('0xb'))(new Redis(config[_0x1977('0x9')]));require(_0x1977('0xc'))[_0x1977('0xd')](socket);function respondWithStatusCode(_0xcb7f3a,_0x2d403d){_0x2d403d=_0x2d403d||0xcc;return function(_0x32af44){if(_0x32af44){return _0xcb7f3a[_0x1977('0xe')](_0x2d403d);}return _0xcb7f3a['status'](_0x2d403d)[_0x1977('0xf')]();};}function respondWithResult(_0x23fb94,_0x3bd2eb){_0x3bd2eb=_0x3bd2eb||0xc8;return function(_0x396f9d){if(_0x396f9d){return _0x23fb94[_0x1977('0x10')](_0x3bd2eb)[_0x1977('0x11')](_0x396f9d);}};}function respondWithFilteredResult(_0x414809,_0x3c67e4){return function(_0x398f41){if(_0x398f41){var _0x9b27d=typeof _0x3c67e4[_0x1977('0x12')]===_0x1977('0x13')&&typeof _0x3c67e4[_0x1977('0x14')]===_0x1977('0x13');var _0x1f01ab=_0x398f41[_0x1977('0x15')];var _0x455600=_0x9b27d?0x0:_0x3c67e4[_0x1977('0x12')];var _0x20628d=_0x9b27d?_0x398f41[_0x1977('0x15')]:_0x3c67e4['offset']+_0x3c67e4[_0x1977('0x14')];var _0x567a69;if(_0x20628d>=_0x1f01ab){_0x20628d=_0x1f01ab;_0x567a69=0xc8;}else{_0x567a69=0xce;}_0x414809[_0x1977('0x10')](_0x567a69);return _0x414809[_0x1977('0x16')](_0x1977('0x17'),_0x455600+'-'+_0x20628d+'/'+_0x1f01ab)['json'](_0x398f41);}return null;};}function saveUpdates(_0x375c86){return function(_0x262f2f){if(_0x262f2f){return _0x262f2f['update'](_0x375c86)[_0x1977('0x18')](function(_0xd71647){return _0xd71647;});}return null;};}function removeEntity(_0x4e9f40){return function(_0x7a9c81){if(_0x7a9c81){return _0x7a9c81[_0x1977('0x19')]()[_0x1977('0x18')](function(){var _0x3e9d85=_0x7a9c81[_0x1977('0x1a')]({'plain':!![]});var _0x2c45c6=_0x1977('0x1b');return db['UserProfileResource'][_0x1977('0x19')]({'where':{'type':_0x2c45c6,'resourceId':_0x3e9d85['id']}})[_0x1977('0x18')](function(){return _0x7a9c81;});})[_0x1977('0x18')](function(){_0x4e9f40[_0x1977('0x10')](0xcc)[_0x1977('0xf')]();});}};}function handleEntityNotFound(_0xd089b6){return function(_0x1cab3f){if(!_0x1cab3f){_0xd089b6['sendStatus'](0x194);}return _0x1cab3f;};}function handleError(_0x5e89bf,_0x354e68){_0x354e68=_0x354e68||0x1f4;return function(_0x5f36d7){logger['error'](_0x5f36d7['stack']);if(_0x5f36d7[_0x1977('0x1c')]){delete _0x5f36d7[_0x1977('0x1c')];}_0x5e89bf[_0x1977('0x10')](_0x354e68)[_0x1977('0x1d')](_0x5f36d7);};}exports['index']=function(_0x12201f,_0x1c3f63){var _0x1869ad={};var _0x373eae={'count':0x0,'rows':[]};var _0x2eceab=_[_0x1977('0x1e')](db[_0x1977('0x1f')][_0x1977('0x20')],function(_0x3f8922){return{'name':_0x3f8922[_0x1977('0x21')],'type':_0x3f8922[_0x1977('0x22')][_0x1977('0x23')]};});_0x1869ad=qs[_0x1977('0x24')](_0x2eceab,_0x12201f);var _0x1ed2a7={'where':_0x1869ad[_0x1977('0x25')]};return db[_0x1977('0x1f')][_0x1977('0x15')](_0x1ed2a7)[_0x1977('0x18')](function(_0x3f4b94){_0x373eae[_0x1977('0x15')]=_0x3f4b94;_0x1869ad[_0x1977('0x26')]=qs[_0x1977('0x26')](_0x12201f[_0x1977('0x27')]);return db[_0x1977('0x1f')]['findAll'](_0x1869ad);})[_0x1977('0x18')](function(_0x50b2d4){_0x373eae[_0x1977('0x28')]=_0x50b2d4;return _0x373eae;})[_0x1977('0x18')](respondWithFilteredResult(_0x1c3f63,_0x1869ad))[_0x1977('0x29')](handleError(_0x1c3f63,null));};exports[_0x1977('0x2a')]=function(_0xd0e69c,_0xd81407){var _0x5b8ce1={'raw':!![],'where':{'id':_0xd0e69c[_0x1977('0x2b')]['id']}},_0x302b60={};_0x302b60['model']=_[_0x1977('0x2c')](db[_0x1977('0x1f')]['rawAttributes']);_0x302b60[_0x1977('0x27')]=_[_0x1977('0x2c')](_0xd0e69c[_0x1977('0x27')]);_0x302b60[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x302b60['model'],_0x302b60[_0x1977('0x27')]);_0x5b8ce1[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x302b60[_0x1977('0x30')],qs[_0x1977('0x31')](_0xd0e69c[_0x1977('0x27')]['fields']));_0x5b8ce1[_0x1977('0x2f')]=_0x5b8ce1[_0x1977('0x2f')][_0x1977('0x32')]?_0x5b8ce1[_0x1977('0x2f')]:_0x302b60[_0x1977('0x30')];if(_0xd0e69c[_0x1977('0x27')]['includeAll']){_0x5b8ce1[_0x1977('0x26')]=[{'all':!![]}];}_0x5b8ce1=_['merge']({},_0x5b8ce1,_0xd0e69c[_0x1977('0x33')]);return db['OpenchannelQueue'][_0x1977('0x34')](_0x5b8ce1)[_0x1977('0x18')](handleEntityNotFound(_0xd81407,null))[_0x1977('0x18')](respondWithResult(_0xd81407,null))['catch'](handleError(_0xd81407,null));};exports[_0x1977('0x35')]=function(_0x135e07,_0x623cd7){return db[_0x1977('0x1f')][_0x1977('0x35')](_0x135e07['body'],{})[_0x1977('0x18')](function(_0x279062){var _0x44be91=_0x135e07[_0x1977('0x36')]['get']({'plain':!![]});if(!_0x44be91)throw new Error(_0x1977('0x37'));if(_0x44be91['role']===_0x1977('0x36')){var _0x441242=_0x279062[_0x1977('0x1a')]({'plain':!![]});var _0x122a74=_0x1977('0x1b');return db[_0x1977('0x38')][_0x1977('0x34')]({'where':{'name':_0x122a74,'userProfileId':_0x44be91[_0x1977('0x39')]},'raw':!![]})[_0x1977('0x18')](function(_0x337b39){if(_0x337b39&&_0x337b39[_0x1977('0x3a')]===0x0){return db[_0x1977('0x3b')][_0x1977('0x35')]({'name':_0x441242[_0x1977('0x1c')],'resourceId':_0x441242['id'],'type':_0x337b39[_0x1977('0x1c')],'sectionId':_0x337b39['id']},{})['then'](function(){return _0x279062;});}else{return _0x279062;}})[_0x1977('0x29')](function(_0x3df01a){logger[_0x1977('0x3c')](_0x1977('0x3d'),_0x3df01a);throw _0x3df01a;});}return _0x279062;})['then'](respondWithResult(_0x623cd7,0xc9))[_0x1977('0x29')](handleError(_0x623cd7,null));};exports[_0x1977('0x3e')]=function(_0x388cee,_0x4920ef){if(_0x388cee['body']['id']){delete _0x388cee[_0x1977('0x3f')]['id'];}return db[_0x1977('0x1f')]['find']({'where':{'id':_0x388cee[_0x1977('0x2b')]['id']}})[_0x1977('0x18')](handleEntityNotFound(_0x4920ef,null))[_0x1977('0x18')](saveUpdates(_0x388cee[_0x1977('0x3f')],null))['then'](respondWithResult(_0x4920ef,null))[_0x1977('0x29')](handleError(_0x4920ef,null));};exports['destroy']=function(_0x113f23,_0x29cd52){return db[_0x1977('0x1f')][_0x1977('0x34')]({'where':{'id':_0x113f23[_0x1977('0x2b')]['id']}})['then'](handleEntityNotFound(_0x29cd52,null))[_0x1977('0x18')](removeEntity(_0x29cd52,null))['catch'](handleError(_0x29cd52,null));};exports[_0x1977('0x40')]=function(_0x380ef8,_0x2b4a39){return db[_0x1977('0x1f')][_0x1977('0x40')]()[_0x1977('0x18')](respondWithResult(_0x2b4a39,null))[_0x1977('0x29')](handleError(_0x2b4a39,null));};exports[_0x1977('0x41')]=function(_0x5d7804,_0x39987f){var _0x319e79={'raw':!![],'where':{}},_0x1a5378={},_0x32de46;return db[_0x1977('0x1f')]['findOne']({'where':{'id':_0x5d7804[_0x1977('0x2b')]['id']}})[_0x1977('0x18')](handleEntityNotFound(_0x39987f,null))[_0x1977('0x18')](function(_0x3f9060){if(_0x3f9060){_0x32de46=_0x3f9060[_0x1977('0x1a')]({'plain':!![]});_0x1a5378[_0x1977('0x30')]=_[_0x1977('0x2c')](db[_0x1977('0x42')]['rawAttributes']);_0x1a5378[_0x1977('0x27')]=_['keys'](_0x5d7804['query']);_0x1a5378[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x1a5378[_0x1977('0x30')],_0x1a5378['query']);_0x319e79['attributes']=_[_0x1977('0x2e')](_0x1a5378['model'],qs[_0x1977('0x31')](_0x5d7804[_0x1977('0x27')][_0x1977('0x31')]));_0x319e79[_0x1977('0x2f')]=_0x319e79[_0x1977('0x2f')][_0x1977('0x32')]?_0x319e79[_0x1977('0x2f')]:_0x1a5378[_0x1977('0x30')];if(!_0x5d7804[_0x1977('0x27')]['hasOwnProperty'](_0x1977('0x43'))){_0x319e79[_0x1977('0x14')]=qs[_0x1977('0x14')](_0x5d7804[_0x1977('0x27')][_0x1977('0x14')]);_0x319e79[_0x1977('0x12')]=qs['offset'](_0x5d7804['query'][_0x1977('0x12')]);}_0x319e79['order']=qs[_0x1977('0x44')](_0x5d7804[_0x1977('0x27')][_0x1977('0x44')]);_0x319e79[_0x1977('0x25')]=qs[_0x1977('0x2d')](_[_0x1977('0x45')](_0x5d7804[_0x1977('0x27')],_0x1a5378[_0x1977('0x2d')]));_0x319e79[_0x1977('0x25')]['OpenchannelQueueId']=_0x3f9060['id'];if(_0x5d7804[_0x1977('0x27')][_0x1977('0x46')]){_0x319e79[_0x1977('0x25')]=_[_0x1977('0x47')](_0x319e79[_0x1977('0x25')],{'$or':_[_0x1977('0x1e')](_0x319e79['attributes'],function(_0x156f08){var _0x3881bc={};_0x3881bc[_0x156f08]={'$like':'%'+_0x5d7804[_0x1977('0x27')][_0x1977('0x46')]+'%'};return _0x3881bc;})});}_0x319e79=_[_0x1977('0x47')]({},_0x319e79,_0x5d7804['options']);return db[_0x1977('0x42')][_0x1977('0x48')](_0x319e79);}})[_0x1977('0x18')](function(_0x4009fe){if(_0x4009fe){return db['User']['findAndCountAll']({'where':{'id':_[_0x1977('0x1e')](_0x4009fe,'UserId'),'role':'agent'},'attributes':['id',_0x1977('0x1c'),'openchannelPause',_0x1977('0x49'),_0x1977('0x4a')]});}})[_0x1977('0x18')](function(_0x90e3ae){if(_0x90e3ae){return{'count':_0x90e3ae[_0x1977('0x15')],'rows':_[_0x1977('0x1e')](_0x90e3ae[_0x1977('0x28')],function(_0x23f330){return{'membername':_0x23f330['name'],'UserId':_0x23f330['id'],'queue_name':_0x32de46[_0x1977('0x1c')],'OpenchannelQueueId':_0x32de46['id'],'interface':util[_0x1977('0x4b')](_0x1977('0x4c'),_0x1977('0x4d'),_0x23f330[_0x1977('0x1c')]),'penalty':0x0,'paused':_0x23f330['openchannelPause'],'createdAt':_0x23f330[_0x1977('0x4a')],'updatedAt':_0x23f330[_0x1977('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1977('0x18')](respondWithFilteredResult(_0x39987f,_0x319e79))[_0x1977('0x29')](handleError(_0x39987f,null));};exports[_0x1977('0x4e')]=function(_0x345c02,_0x501d6d){var _0x152cca={};var _0x412adf={};var _0x5517bb;var _0x680291;return db[_0x1977('0x1f')][_0x1977('0x4f')]({'where':{'id':_0x345c02[_0x1977('0x2b')]['id']}})['then'](handleEntityNotFound(_0x501d6d,null))[_0x1977('0x18')](function(_0x2181de){if(_0x2181de){_0x5517bb=_0x2181de;_0x412adf[_0x1977('0x30')]=_[_0x1977('0x2c')](db[_0x1977('0x50')]['rawAttributes']);_0x412adf['query']=_['keys'](_0x345c02[_0x1977('0x27')]);_0x412adf[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x412adf['model'],_0x412adf['query']);_0x152cca[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x412adf['model'],qs[_0x1977('0x31')](_0x345c02[_0x1977('0x27')][_0x1977('0x31')]));_0x152cca[_0x1977('0x2f')]=_0x152cca['attributes'][_0x1977('0x32')]?_0x152cca[_0x1977('0x2f')]:_0x412adf['model'];_0x152cca[_0x1977('0x51')]=qs[_0x1977('0x44')](_0x345c02[_0x1977('0x27')][_0x1977('0x44')]);_0x152cca[_0x1977('0x25')]=qs[_0x1977('0x2d')](_[_0x1977('0x45')](_0x345c02[_0x1977('0x27')],_0x412adf[_0x1977('0x2d')]));if(_0x345c02[_0x1977('0x27')]['filter']){_0x152cca['where']=_[_0x1977('0x47')](_0x152cca['where'],{'$or':_['map'](_0x152cca[_0x1977('0x2f')],function(_0x253a4d){var _0xaf47e9={};_0xaf47e9[_0x253a4d]={'$like':'%'+_0x345c02[_0x1977('0x27')][_0x1977('0x46')]+'%'};return _0xaf47e9;})});}_0x152cca=_[_0x1977('0x47')]({},_0x152cca,_0x345c02[_0x1977('0x33')]);return _0x5517bb[_0x1977('0x4e')](_0x152cca);}})[_0x1977('0x18')](function(_0x34cedb){if(_0x34cedb){_0x680291=_0x34cedb['length'];if(!_0x345c02[_0x1977('0x27')][_0x1977('0x52')](_0x1977('0x43'))){_0x152cca['limit']=qs[_0x1977('0x14')](_0x345c02[_0x1977('0x27')][_0x1977('0x14')]);_0x152cca[_0x1977('0x12')]=qs[_0x1977('0x12')](_0x345c02['query'][_0x1977('0x12')]);}return _0x5517bb[_0x1977('0x4e')](_0x152cca);}})[_0x1977('0x18')](function(_0x379d33){if(_0x379d33){return _0x379d33?{'count':_0x680291,'rows':_0x379d33}:null;}})[_0x1977('0x18')](respondWithResult(_0x501d6d,null))[_0x1977('0x29')](handleError(_0x501d6d,null));};exports['addTeams']=function(_0xf114c6,_0x4d5342){var _0x5f38dc=_0xf114c6[_0x1977('0x3f')][_0x1977('0x53')];return db[_0x1977('0x50')]['findAll']({'where':{'id':_0x5f38dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1977('0x54'),'attributes':['id',_0x1977('0x1c'),_0x1977('0x55'),_0x1977('0x56'),'interface'],'raw':!![]}]})[_0x1977('0x18')](function(_0x9f9dd5){if(_0x9f9dd5){var _0x499fa8=_[_0x1977('0x57')](_0x9f9dd5,function(_0xcfba18){var _0x4dbfb3=_0xcfba18[_0x1977('0x1a')]({'plain':!![]});return _0x4dbfb3['Agents'];});return db[_0x1977('0x1f')][_0x1977('0x34')]({'where':{'id':_0xf114c6[_0x1977('0x2b')]['id']}})['then'](function(_0x499adb){return db[_0x1977('0x58')][_0x1977('0x59')](function(_0x38c360){return _0x499adb['addTeams'](_0x5f38dc,{'transaction':_0x38c360})[_0x1977('0x18')](function(){return BPromise[_0x1977('0x5a')](_0x499fa8,function(_0x47cc79){return db['UserOpenchannelQueue'][_0x1977('0x5b')]({'where':{'UserId':_0x47cc79['id'],'OpenchannelQueueId':_0xf114c6[_0x1977('0x2b')]['id']},'transaction':_0x38c360});});})[_0x1977('0x18')](function(){_0x499fa8[_0x1977('0x5c')](function(_0x24bb1b){socket['emit'](_0x1977('0x5d'),{'UserId':_0x24bb1b['id'],'OpenchannelQueueId':_0x499adb['id']});});});});});}})[_0x1977('0x18')](respondWithStatusCode(_0x4d5342,null))['catch'](handleError(_0x4d5342,null));};exports[_0x1977('0x5e')]=function(_0x4b76cf,_0x34fd09){return db[_0x1977('0x50')][_0x1977('0x48')]({'where':{'id':_0x4b76cf[_0x1977('0x27')][_0x1977('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1977('0x54'),'attributes':['id'],'raw':!![]}]})[_0x1977('0x18')](handleEntityNotFound(_0x34fd09,null))[_0x1977('0x18')](function(_0x3c218e){var _0x2ab96e=_[_0x1977('0x1e')](_0x3c218e,'id');var _0x60828a=[];var _0x5e32f7=[];var _0x5211e1=squel[_0x1977('0x5f')]();_0x5211e1['field']('tq.TeamId')[_0x1977('0x60')](_0x1977('0x61'),'tq')[_0x1977('0x62')](_0x1977('0x63'),'ut',_0x1977('0x64'))[_0x1977('0x25')]('OpenchannelQueueId\x20=\x20?',_0x4b76cf[_0x1977('0x2b')]['id']);for(var _0x49c2cc=0x0;_0x49c2cc<_0x3c218e[_0x1977('0x32')];_0x49c2cc+=0x1){let _0x2758bb=_0x3c218e[_0x49c2cc];for(var _0x5f354e=0x0;_0x5f354e<_0x2758bb[_0x1977('0x54')][_0x1977('0x32')];_0x5f354e+=0x1){let _0x274a7b=_0x2758bb[_0x1977('0x54')][_0x5f354e];var _0x4663bd=_0x5211e1[_0x1977('0x65')]();_0x4663bd[_0x1977('0x25')](_0x1977('0x66'),_0x274a7b['id']);_0x5e32f7[_0x1977('0x67')](db[_0x1977('0x58')][_0x1977('0x27')](_0x4663bd['toString'](),{'type':db[_0x1977('0x58')][_0x1977('0x68')][_0x1977('0x69')]})[_0x1977('0x18')](function(_0x1dbce9){if(_0x1dbce9[_0x1977('0x32')]===0x1){return _0x274a7b['id'];}else{var _0x2f4747=_['every'](_[_0x1977('0x1e')](_0x1dbce9,_0x1977('0x6a')),function(_0x3d8ed2){return _['includes'](_0x2ab96e,_0x3d8ed2);});if(_0x2f4747){return _0x274a7b['id'];}}}));}}return BPromise['all'](_0x5e32f7)[_0x1977('0x18')](function(_0x3c83fd){_0x60828a=_(_0x60828a)['union'](_0x3c83fd)[_0x1977('0x6b')]()[_0x1977('0x6c')]();return db[_0x1977('0x1f')]['find']({'where':{'id':_0x4b76cf[_0x1977('0x2b')]['id']}})[_0x1977('0x18')](function(_0x20d648){return db[_0x1977('0x58')][_0x1977('0x59')](function(_0x4540d9){return _0x20d648[_0x1977('0x5e')](_0x4b76cf[_0x1977('0x27')]['ids'],{'transaction':_0x4540d9})['then'](function(){if(!_['isEmpty'](_0x60828a)){return _0x20d648[_0x1977('0x6d')](_0x60828a,{'transaction':_0x4540d9});}})['then'](function(){_0x60828a[_0x1977('0x5c')](function(_0x3125fb){socket[_0x1977('0x6e')](_0x1977('0x6f'),{'UserId':_0x3125fb,'OpenchannelQueueId':_0x20d648['id']});});});});});});})['then'](respondWithStatusCode(_0x34fd09,null))[_0x1977('0x29')](handleError(_0x34fd09,null));};exports[_0x1977('0x70')]=function(_0x101e6e,_0x58ab6a){return db['OpenchannelQueue']['find']({'where':{'id':_0x101e6e[_0x1977('0x2b')]['id']}})[_0x1977('0x18')](handleEntityNotFound(_0x58ab6a,null))[_0x1977('0x18')](function(_0x3fa513){if(_0x3fa513){return _0x3fa513[_0x1977('0x70')](_0x101e6e['body'][_0x1977('0x53')],_[_0x1977('0x71')](_0x101e6e[_0x1977('0x3f')],[_0x1977('0x53'),'id'])||{})[_0x1977('0x72')](function(_0x5ca997){for(var _0x542911=0x0;_0x542911<_0x101e6e[_0x1977('0x3f')][_0x1977('0x53')]['length'];_0x542911+=0x1){socket[_0x1977('0x6e')](_0x1977('0x5d'),{'UserId':Number(_0x101e6e['body'][_0x1977('0x53')][_0x542911]),'OpenchannelQueueId':Number(_0x101e6e['params']['id'])});}return _0x5ca997;});}})[_0x1977('0x18')](respondWithResult(_0x58ab6a,null))[_0x1977('0x29')](handleError(_0x58ab6a,null));};exports[_0x1977('0x6d')]=function(_0x3dc982,_0x124c92){return db['OpenchannelQueue']['find']({'where':{'id':_0x3dc982[_0x1977('0x2b')]['id']}})[_0x1977('0x18')](handleEntityNotFound(_0x124c92,null))[_0x1977('0x18')](function(_0x5c21f2){if(_0x5c21f2){return _0x5c21f2[_0x1977('0x6d')](_0x3dc982[_0x1977('0x27')]['ids'])['then'](function(){if(_[_0x1977('0x73')](_0x3dc982[_0x1977('0x27')][_0x1977('0x53')])){for(var _0xbbad14=0x0;_0xbbad14<_0x3dc982[_0x1977('0x27')]['ids'][_0x1977('0x32')];_0xbbad14+=0x1){socket[_0x1977('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3dc982[_0x1977('0x27')][_0x1977('0x53')][_0xbbad14]),'OpenchannelQueueId':Number(_0x3dc982[_0x1977('0x2b')]['id'])});}}else{socket['emit'](_0x1977('0x6f'),{'UserId':Number(_0x3dc982[_0x1977('0x27')]['ids']),'OpenchannelQueueId':Number(_0x3dc982[_0x1977('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x124c92,null))[_0x1977('0x29')](handleError(_0x124c92,null));};exports[_0x1977('0x74')]=function(_0x3476c9,_0x4fb41e){var _0x10aac1={};var _0x4ae377={};var _0x451f7f;var _0x3b8af5;return db[_0x1977('0x1f')][_0x1977('0x4f')]({'where':{'id':_0x3476c9['params']['id']}})['then'](handleEntityNotFound(_0x4fb41e,null))[_0x1977('0x18')](function(_0xfaa199){if(_0xfaa199){_0x451f7f=_0xfaa199;_0x4ae377['model']=_[_0x1977('0x2c')](db[_0x1977('0x75')][_0x1977('0x20')]);_0x4ae377[_0x1977('0x27')]=_['keys'](_0x3476c9[_0x1977('0x27')]);_0x4ae377[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x4ae377['model'],_0x4ae377[_0x1977('0x27')]);_0x10aac1['attributes']=_[_0x1977('0x2e')](_0x4ae377[_0x1977('0x30')],qs[_0x1977('0x31')](_0x3476c9['query']['fields']));_0x10aac1[_0x1977('0x2f')]=_0x10aac1[_0x1977('0x2f')][_0x1977('0x32')]?_0x10aac1[_0x1977('0x2f')]:_0x4ae377[_0x1977('0x30')];_0x10aac1[_0x1977('0x51')]=qs[_0x1977('0x44')](_0x3476c9[_0x1977('0x27')][_0x1977('0x44')]);_0x10aac1['where']=qs['filters'](_[_0x1977('0x45')](_0x3476c9[_0x1977('0x27')],_0x4ae377['filters']));if(_0x3476c9[_0x1977('0x27')][_0x1977('0x46')]){_0x10aac1[_0x1977('0x25')]=_['merge'](_0x10aac1[_0x1977('0x25')],{'$or':_[_0x1977('0x1e')](_0x10aac1[_0x1977('0x2f')],function(_0x303529){var _0x25fb89={};_0x25fb89[_0x303529]={'$like':'%'+_0x3476c9[_0x1977('0x27')][_0x1977('0x46')]+'%'};return _0x25fb89;})});}_0x10aac1=_[_0x1977('0x47')]({},_0x10aac1,_0x3476c9[_0x1977('0x33')]);return _0x451f7f[_0x1977('0x74')](_0x10aac1);}})['then'](function(_0x532bed){if(_0x532bed){_0x3b8af5=_0x532bed[_0x1977('0x32')];if(!_0x3476c9['query'][_0x1977('0x52')](_0x1977('0x43'))){_0x10aac1[_0x1977('0x14')]=qs[_0x1977('0x14')](_0x3476c9[_0x1977('0x27')]['limit']);_0x10aac1[_0x1977('0x12')]=qs[_0x1977('0x12')](_0x3476c9['query'][_0x1977('0x12')]);}return _0x451f7f[_0x1977('0x74')](_0x10aac1);}})[_0x1977('0x18')](function(_0xa87ff3){if(_0xa87ff3){return _0xa87ff3?{'count':_0x3b8af5,'rows':_0xa87ff3}:null;}})[_0x1977('0x18')](respondWithResult(_0x4fb41e,null))[_0x1977('0x29')](handleError(_0x4fb41e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2d7f43f..c20b5e4 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 _0xe80f=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','emit','hook'];(function(_0x4040b1,_0x104274){var _0x3133bf=function(_0x214573){while(--_0x214573){_0x4040b1['push'](_0x4040b1['shift']());}};_0x3133bf(++_0x104274);}(_0xe80f,0x71));var _0xfe80=function(_0x149154,_0x51a0d8){_0x149154=_0x149154-0x0;var _0x334a99=_0xe80f[_0x149154];return _0x334a99;};'use strict';var EventEmitter=require(_0xfe80('0x0'));var OpenchannelQueue=require(_0xfe80('0x1'))['db'][_0xfe80('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfe80('0x3')](0x0);var events={'afterCreate':_0xfe80('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4d0429){return function(_0x413d84,_0x360239,_0x4a43f9){OpenchannelQueueEvents['emit'](_0x4d0429+':'+_0x413d84['id'],_0x413d84);OpenchannelQueueEvents[_0xfe80('0x5')](_0x4d0429,_0x413d84);_0x4a43f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xfe80('0x6')](e,emitEvent(event));}}module[_0xfe80('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2b7f=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d6778,_0x518abf){var _0x5a3d02=function(_0x2d681d){while(--_0x2d681d){_0x4d6778['push'](_0x4d6778['shift']());}};_0x5a3d02(++_0x518abf);}(_0x2b7f,0x1a1));var _0xf2b7=function(_0x224ac5,_0x3ffe7b){_0x224ac5=_0x224ac5-0x0;var _0x2361aa=_0x2b7f[_0x224ac5];return _0x2361aa;};'use strict';var EventEmitter=require(_0xf2b7('0x0'));var OpenchannelQueue=require(_0xf2b7('0x1'))['db'][_0xf2b7('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf2b7('0x3')](0x0);var events={'afterCreate':_0xf2b7('0x4'),'afterUpdate':_0xf2b7('0x5'),'afterDestroy':_0xf2b7('0x6')};function emitEvent(_0x31cc97){return function(_0x5cbd15,_0x2f30c2,_0xb1ee54){OpenchannelQueueEvents[_0xf2b7('0x7')](_0x31cc97+':'+_0x5cbd15['id'],_0x5cbd15);OpenchannelQueueEvents[_0xf2b7('0x7')](_0x31cc97,_0x5cbd15);_0xb1ee54(null);};}for(var e in events){if(events[_0xf2b7('0x8')](e)){var event=events[e];OpenchannelQueue[_0xf2b7('0x9')](e,emitEvent(event));}}module[_0xf2b7('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c6c7804..8f8c9ea 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 _0xf0a1=['rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4046b4,_0x3413b3){var _0x4d9940=function(_0x4dd1df){while(--_0x4dd1df){_0x4046b4['push'](_0x4046b4['shift']());}};_0x4d9940(++_0x3413b3);}(_0xf0a1,0x15a));var _0x1f0a=function(_0x179e32,_0x5abc2c){_0x179e32=_0x179e32-0x0;var _0x1180cc=_0xf0a1[_0x179e32];return _0x1180cc;};'use strict';var _=require(_0x1f0a('0x0'));var util=require('util');var logger=require(_0x1f0a('0x1'))(_0x1f0a('0x2'));var moment=require(_0x1f0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f0a('0x5'));var config=require(_0x1f0a('0x6'));var attributes=require(_0x1f0a('0x7'));module['exports']=function(_0x228390,_0x45ed8a){return _0x228390['define'](_0x1f0a('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2376=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues'];(function(_0x40d078,_0x210a77){var _0x46fc81=function(_0x3673da){while(--_0x3673da){_0x40d078['push'](_0x40d078['shift']());}};_0x46fc81(++_0x210a77);}(_0x2376,0xc3));var _0x6237=function(_0x4a8d8e,_0x38f4f9){_0x4a8d8e=_0x4a8d8e-0x0;var _0x53884f=_0x2376[_0x4a8d8e];return _0x53884f;};'use strict';var _=require(_0x6237('0x0'));var util=require(_0x6237('0x1'));var logger=require(_0x6237('0x2'))(_0x6237('0x3'));var moment=require(_0x6237('0x4'));var BPromise=require(_0x6237('0x5'));var rp=require(_0x6237('0x6'));var fs=require('fs');var path=require(_0x6237('0x7'));var rimraf=require(_0x6237('0x8'));var config=require('../../config/environment');var attributes=require(_0x6237('0x9'));module[_0x6237('0xa')]=function(_0xd5d636,_0x4e7c50){return _0xd5d636['define'](_0x6237('0xb'),attributes,{'tableName':_0x6237('0xc'),'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 899d5b9..0dce84e 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 _0xdc19=['ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','include','map','model'];(function(_0x3d3c7c,_0x55bb76){var _0xa0a5df=function(_0x9bcab8){while(--_0x9bcab8){_0x3d3c7c['push'](_0x3d3c7c['shift']());}};_0xa0a5df(++_0x55bb76);}(_0xdc19,0x92));var _0x9dc1=function(_0xaa8595,_0xcfe9ac){_0xaa8595=_0xaa8595-0x0;var _0x303a38=_0xdc19[_0xaa8595];return _0x303a38;};'use strict';var _=require(_0x9dc1('0x0'));var util=require(_0x9dc1('0x1'));var moment=require(_0x9dc1('0x2'));var BPromise=require(_0x9dc1('0x3'));var rs=require(_0x9dc1('0x4'));var fs=require('fs');var Redis=require(_0x9dc1('0x5'));var db=require(_0x9dc1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9dc1('0x7'))(_0x9dc1('0x8'));var config=require('../../config/environment');var jayson=require(_0x9dc1('0x9'));var client=jayson['client'][_0x9dc1('0xa')]({'port':0x232a});config[_0x9dc1('0xb')]=_[_0x9dc1('0xc')](config[_0x9dc1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dc1('0xb')]));require(_0x9dc1('0xd'))['register'](socket);function respondWithRpcPromise(_0x165a9f,_0x4fef77,_0x390ad8){return new BPromise(function(_0x40e373,_0x2e92b5){return client[_0x9dc1('0xe')](_0x165a9f,_0x390ad8)[_0x9dc1('0xf')](function(_0x3034ff){logger['info'](_0x9dc1('0x10'),_0x4fef77,_0x9dc1('0x11'));logger[_0x9dc1('0x12')](_0x9dc1('0x13'),_0x4fef77,'request\x20sent',JSON[_0x9dc1('0x14')](_0x3034ff));if(_0x3034ff[_0x9dc1('0x15')]){if(_0x3034ff[_0x9dc1('0x15')]['code']===0x1f4){logger[_0x9dc1('0x15')](_0x9dc1('0x10'),_0x4fef77,_0x3034ff[_0x9dc1('0x15')][_0x9dc1('0x16')]);return _0x2e92b5(_0x3034ff[_0x9dc1('0x15')][_0x9dc1('0x16')]);}logger[_0x9dc1('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4fef77,_0x3034ff[_0x9dc1('0x15')][_0x9dc1('0x16')]);return _0x40e373(_0x3034ff[_0x9dc1('0x15')]['message']);}else{logger[_0x9dc1('0x17')](_0x9dc1('0x10'),_0x4fef77,_0x9dc1('0x11'));_0x40e373(_0x3034ff['result'][_0x9dc1('0x16')]);}})[_0x9dc1('0x18')](function(_0x4a8852){logger[_0x9dc1('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4fef77,_0x4a8852);_0x2e92b5(_0x4a8852);});});}exports[_0x9dc1('0x19')]=function(_0x50c030){var _0xdcf696=this;return new Promise(function(_0x3dd19a,_0x22d1a4){return db[_0x9dc1('0x1a')][_0x9dc1('0x1b')]({'raw':_0x50c030[_0x9dc1('0x1c')]?_0x50c030['options']['raw']===undefined?!![]:![]:!![],'where':_0x50c030[_0x9dc1('0x1c')]?_0x50c030['options'][_0x9dc1('0x1d')]||null:null,'attributes':_0x50c030[_0x9dc1('0x1c')]?_0x50c030['options'][_0x9dc1('0x1e')]||null:null,'limit':_0x50c030[_0x9dc1('0x1c')]?_0x50c030[_0x9dc1('0x1c')]['limit']||null:null,'include':_0x50c030[_0x9dc1('0x1c')]?_0x50c030[_0x9dc1('0x1c')][_0x9dc1('0x1f')]?_['map'](_0x50c030[_0x9dc1('0x1c')]['include'],function(_0x1dca74){return{'model':db[_0x1dca74['model']],'as':_0x1dca74['as'],'attributes':_0x1dca74[_0x9dc1('0x1e')],'include':_0x1dca74[_0x9dc1('0x1f')]?_[_0x9dc1('0x20')](_0x1dca74[_0x9dc1('0x1f')],function(_0x5ec433){return{'model':db[_0x5ec433[_0x9dc1('0x21')]],'as':_0x5ec433['as'],'attributes':_0x5ec433[_0x9dc1('0x1e')],'include':_0x5ec433[_0x9dc1('0x1f')]?_[_0x9dc1('0x20')](_0x5ec433[_0x9dc1('0x1f')],function(_0x418ef4){return{'model':db[_0x418ef4[_0x9dc1('0x21')]],'as':_0x418ef4['as'],'attributes':_0x418ef4[_0x9dc1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57f0a2){logger[_0x9dc1('0x17')](_0x9dc1('0x19'),_0x50c030);logger[_0x9dc1('0x12')](_0x9dc1('0x19'),_0x50c030,JSON[_0x9dc1('0x14')](_0x57f0a2));_0x3dd19a(_0x57f0a2);})['catch'](function(_0x4d2748){logger[_0x9dc1('0x15')](_0x9dc1('0x19'),_0x4d2748['message'],_0x50c030);_0x22d1a4(_0xdcf696['error'](0x1f4,_0x4d2748[_0x9dc1('0x16')]));});});};exports[_0x9dc1('0x22')]=function(_0x4a178b){var _0x493ec2=this;return new Promise(function(_0xa6a6f0,_0x3c7807){return db['OpenchannelQueue'][_0x9dc1('0x23')]({'raw':_0x4a178b[_0x9dc1('0x1c')]?_0x4a178b[_0x9dc1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4a178b[_0x9dc1('0x1c')]?_0x4a178b[_0x9dc1('0x1c')][_0x9dc1('0x1d')]||null:null,'attributes':_0x4a178b['options']?_0x4a178b[_0x9dc1('0x1c')][_0x9dc1('0x1e')]||null:null,'include':_0x4a178b[_0x9dc1('0x1c')]?_0x4a178b['options']['include']?_[_0x9dc1('0x20')](_0x4a178b[_0x9dc1('0x1c')]['include'],function(_0x39638e){return{'model':db[_0x39638e[_0x9dc1('0x21')]],'as':_0x39638e['as'],'attributes':_0x39638e[_0x9dc1('0x1e')],'include':_0x39638e[_0x9dc1('0x1f')]?_[_0x9dc1('0x20')](_0x39638e[_0x9dc1('0x1f')],function(_0x45a844){return{'model':db[_0x45a844['model']],'as':_0x45a844['as'],'attributes':_0x45a844[_0x9dc1('0x1e')],'include':_0x45a844[_0x9dc1('0x1f')]?_[_0x9dc1('0x20')](_0x45a844[_0x9dc1('0x1f')],function(_0x5d5a47){return{'model':db[_0x5d5a47[_0x9dc1('0x21')]],'as':_0x5d5a47['as'],'attributes':_0x5d5a47[_0x9dc1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9dc1('0xf')](function(_0xec23d6){logger[_0x9dc1('0x17')](_0x9dc1('0x22'),_0x4a178b);logger['debug'](_0x9dc1('0x22'),_0x4a178b,JSON[_0x9dc1('0x14')](_0xec23d6));_0xa6a6f0(_0xec23d6);})[_0x9dc1('0x18')](function(_0x1eb4fa){logger[_0x9dc1('0x15')](_0x9dc1('0x22'),_0x1eb4fa[_0x9dc1('0x16')],_0x4a178b);_0x3c7807(_0x493ec2['error'](0x1f4,_0x1eb4fa[_0x9dc1('0x16')]));});});}; \ No newline at end of file +var _0x6353=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','then','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x6353,0x7b));var _0x3635=function(_0x48eaa7,_0x11e271){_0x48eaa7=_0x48eaa7-0x0;var _0x25bf3e=_0x6353[_0x48eaa7];return _0x25bf3e;};'use strict';var _=require(_0x3635('0x0'));var util=require(_0x3635('0x1'));var moment=require(_0x3635('0x2'));var BPromise=require(_0x3635('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3635('0x4'));var db=require(_0x3635('0x5'))['db'];var utils=require(_0x3635('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3635('0x7'));var jayson=require(_0x3635('0x8'));var client=jayson[_0x3635('0x9')][_0x3635('0xa')]({'port':0x232a});config[_0x3635('0xb')]=_[_0x3635('0xc')](config[_0x3635('0xb')],{'host':_0x3635('0xd'),'port':0x18eb});var socket=require(_0x3635('0xe'))(new Redis(config[_0x3635('0xb')]));require(_0x3635('0xf'))[_0x3635('0x10')](socket);function respondWithRpcPromise(_0x2d0539,_0x4e87e8,_0x254239){return new BPromise(function(_0x50e5cf,_0xbc12ea){return client[_0x3635('0x11')](_0x2d0539,_0x254239)['then'](function(_0x31deb6){logger[_0x3635('0x12')](_0x3635('0x13'),_0x4e87e8,'request\x20sent');logger[_0x3635('0x14')](_0x3635('0x15'),_0x4e87e8,'request\x20sent',JSON['stringify'](_0x31deb6));if(_0x31deb6[_0x3635('0x16')]){if(_0x31deb6[_0x3635('0x16')][_0x3635('0x17')]===0x1f4){logger[_0x3635('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x4e87e8,_0x31deb6[_0x3635('0x16')][_0x3635('0x18')]);return _0xbc12ea(_0x31deb6[_0x3635('0x16')][_0x3635('0x18')]);}logger['error'](_0x3635('0x13'),_0x4e87e8,_0x31deb6['error'][_0x3635('0x18')]);return _0x50e5cf(_0x31deb6[_0x3635('0x16')][_0x3635('0x18')]);}else{logger[_0x3635('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4e87e8,_0x3635('0x19'));_0x50e5cf(_0x31deb6[_0x3635('0x1a')][_0x3635('0x18')]);}})[_0x3635('0x1b')](function(_0x3b3882){logger[_0x3635('0x16')](_0x3635('0x13'),_0x4e87e8,_0x3b3882);_0xbc12ea(_0x3b3882);});});}exports['GetOpenchannelQueue']=function(_0x94cf42){var _0xc983b2=this;return new Promise(function(_0x4cc33c,_0xb02533){return db['OpenchannelQueue'][_0x3635('0x1c')]({'raw':_0x94cf42[_0x3635('0x1d')]?_0x94cf42[_0x3635('0x1d')][_0x3635('0x1e')]===undefined?!![]:![]:!![],'where':_0x94cf42[_0x3635('0x1d')]?_0x94cf42[_0x3635('0x1d')][_0x3635('0x1f')]||null:null,'attributes':_0x94cf42[_0x3635('0x1d')]?_0x94cf42[_0x3635('0x1d')][_0x3635('0x20')]||null:null,'limit':_0x94cf42[_0x3635('0x1d')]?_0x94cf42[_0x3635('0x1d')][_0x3635('0x21')]||null:null,'include':_0x94cf42[_0x3635('0x1d')]?_0x94cf42['options']['include']?_[_0x3635('0x22')](_0x94cf42['options'][_0x3635('0x23')],function(_0x373a26){return{'model':db[_0x373a26[_0x3635('0x24')]],'as':_0x373a26['as'],'attributes':_0x373a26[_0x3635('0x20')],'include':_0x373a26[_0x3635('0x23')]?_['map'](_0x373a26[_0x3635('0x23')],function(_0x49f556){return{'model':db[_0x49f556[_0x3635('0x24')]],'as':_0x49f556['as'],'attributes':_0x49f556[_0x3635('0x20')],'include':_0x49f556[_0x3635('0x23')]?_[_0x3635('0x22')](_0x49f556[_0x3635('0x23')],function(_0x3f6cb1){return{'model':db[_0x3f6cb1[_0x3635('0x24')]],'as':_0x3f6cb1['as'],'attributes':_0x3f6cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3635('0x25')](function(_0x12f2ec){logger[_0x3635('0x12')]('GetOpenchannelQueue',_0x94cf42);logger[_0x3635('0x14')](_0x3635('0x26'),_0x94cf42,JSON[_0x3635('0x27')](_0x12f2ec));_0x4cc33c(_0x12f2ec);})['catch'](function(_0x40d02e){logger[_0x3635('0x16')]('GetOpenchannelQueue',_0x40d02e['message'],_0x94cf42);_0xb02533(_0xc983b2[_0x3635('0x16')](0x1f4,_0x40d02e[_0x3635('0x18')]));});});};exports[_0x3635('0x28')]=function(_0x560a77){var _0x55e24f=this;return new Promise(function(_0x360ef0,_0xb3e5d3){return db[_0x3635('0x29')][_0x3635('0x2a')]({'raw':_0x560a77[_0x3635('0x1d')]?_0x560a77['options'][_0x3635('0x1e')]===undefined?!![]:![]:!![],'where':_0x560a77['options']?_0x560a77[_0x3635('0x1d')][_0x3635('0x1f')]||null:null,'attributes':_0x560a77[_0x3635('0x1d')]?_0x560a77['options'][_0x3635('0x20')]||null:null,'include':_0x560a77[_0x3635('0x1d')]?_0x560a77[_0x3635('0x1d')]['include']?_[_0x3635('0x22')](_0x560a77['options'][_0x3635('0x23')],function(_0x228d3d){return{'model':db[_0x228d3d['model']],'as':_0x228d3d['as'],'attributes':_0x228d3d['attributes'],'include':_0x228d3d[_0x3635('0x23')]?_[_0x3635('0x22')](_0x228d3d[_0x3635('0x23')],function(_0x8c9a2){return{'model':db[_0x8c9a2[_0x3635('0x24')]],'as':_0x8c9a2['as'],'attributes':_0x8c9a2[_0x3635('0x20')],'include':_0x8c9a2[_0x3635('0x23')]?_['map'](_0x8c9a2[_0x3635('0x23')],function(_0x57a18c){return{'model':db[_0x57a18c['model']],'as':_0x57a18c['as'],'attributes':_0x57a18c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ef72){logger[_0x3635('0x12')](_0x3635('0x28'),_0x560a77);logger[_0x3635('0x14')](_0x3635('0x28'),_0x560a77,JSON[_0x3635('0x27')](_0x19ef72));_0x360ef0(_0x19ef72);})[_0x3635('0x1b')](function(_0x242ea6){logger[_0x3635('0x16')]('ShowOpenchannelQueue',_0x242ea6[_0x3635('0x18')],_0x560a77);_0xb3e5d3(_0x55e24f['error'](0x1f4,_0x242ea6[_0x3635('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e28bc12..dfe3603 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 _0x852e=['save','remove','update','emit','register','length','./openchannelQueue.events'];(function(_0x2ab0fb,_0xf21f9e){var _0x578c50=function(_0x1223b3){while(--_0x1223b3){_0x2ab0fb['push'](_0x2ab0fb['shift']());}};_0x578c50(++_0xf21f9e);}(_0x852e,0x16b));var _0xe852=function(_0x403494,_0x3e00a5){_0x403494=_0x403494-0x0;var _0x52fb8c=_0x852e[_0x403494];return _0x52fb8c;};'use strict';var OpenchannelQueueEvents=require(_0xe852('0x0'));var events=[_0xe852('0x1'),_0xe852('0x2'),_0xe852('0x3')];function createListener(_0x4c2ce1,_0x1fb242){return function(_0x4bea57){_0x1fb242[_0xe852('0x4')](_0x4c2ce1,_0x4bea57);};}function removeListener(_0x572992,_0x16b458){return function(){OpenchannelQueueEvents['removeListener'](_0x572992,_0x16b458);};}exports[_0xe852('0x5')]=function(_0xa0d2bc){for(var _0x45cae1=0x0,_0x314ba9=events[_0xe852('0x6')];_0x45cae1<_0x314ba9;_0x45cae1++){var _0x262d3f=events[_0x45cae1];var _0x4a6661=createListener('openchannelQueue:'+_0x262d3f,_0xa0d2bc);OpenchannelQueueEvents['on'](_0x262d3f,_0x4a6661);}}; \ No newline at end of file +var _0x29d2=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x29d2,0x7e));var _0x229d=function(_0x5ab43b,_0xa94faf){_0x5ab43b=_0x5ab43b-0x0;var _0x402615=_0x29d2[_0x5ab43b];return _0x402615;};'use strict';var OpenchannelQueueEvents=require(_0x229d('0x0'));var events=[_0x229d('0x1'),_0x229d('0x2'),_0x229d('0x3')];function createListener(_0x5b93ca,_0x5b41e0){return function(_0x40dcda){_0x5b41e0[_0x229d('0x4')](_0x5b93ca,_0x40dcda);};}function removeListener(_0x569e15,_0x129eab){return function(){OpenchannelQueueEvents[_0x229d('0x5')](_0x569e15,_0x129eab);};}exports[_0x229d('0x6')]=function(_0x48b4b1){for(var _0xc02b4a=0x0,_0x1cd4d4=events[_0x229d('0x7')];_0xc02b4a<_0x1cd4d4;_0xc02b4a++){var _0x51eff5=events[_0xc02b4a];var _0x24cae1=createListener(_0x229d('0x8')+_0x51eff5,_0x48b4b1);OpenchannelQueueEvents['on'](_0x51eff5,_0x24cae1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b2ebbc9..ab8c9bf 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 _0xc394=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc394,0x161));var _0x4c39=function(_0x2cf69d,_0x71927){_0x2cf69d=_0x2cf69d-0x0;var _0xdcf070=_0xc394[_0x2cf69d];return _0xdcf070;};'use strict';var multer=require(_0x4c39('0x0'));var util=require(_0x4c39('0x1'));var path=require(_0x4c39('0x2'));var timeout=require(_0x4c39('0x3'));var express=require(_0x4c39('0x4'));var router=express['Router']();var fs_extra=require(_0x4c39('0x5'));var auth=require(_0x4c39('0x6'));var interaction=require(_0x4c39('0x7'));var config=require(_0x4c39('0x8'));var controller=require(_0x4c39('0x9'));router[_0x4c39('0xa')]('/',auth['isAuthenticated'](),controller[_0x4c39('0xb')]);router[_0x4c39('0xa')]('/describe',auth[_0x4c39('0xc')](),controller['describe']);router[_0x4c39('0xa')](_0x4c39('0xd'),auth[_0x4c39('0xc')](),controller['show']);router[_0x4c39('0xe')]('/',auth[_0x4c39('0xc')](),controller[_0x4c39('0xf')]);router['put']('/:id',auth[_0x4c39('0xc')](),controller[_0x4c39('0x10')]);router[_0x4c39('0x11')](_0x4c39('0xd'),auth[_0x4c39('0xc')](),controller[_0x4c39('0x12')]);module[_0x4c39('0x13')]=router; \ No newline at end of file +var _0xdecb=['./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5b4722,_0x4c948e){var _0x1b61d1=function(_0x56db7a){while(--_0x56db7a){_0x5b4722['push'](_0x5b4722['shift']());}};_0x1b61d1(++_0x4c948e);}(_0xdecb,0x14f));var _0xbdec=function(_0xa1daa1,_0x17b58b){_0xa1daa1=_0xa1daa1-0x0;var _0x4e5081=_0xdecb[_0xa1daa1];return _0x4e5081;};'use strict';var multer=require(_0xbdec('0x0'));var util=require(_0xbdec('0x1'));var path=require('path');var timeout=require(_0xbdec('0x2'));var express=require('express');var router=express[_0xbdec('0x3')]();var fs_extra=require(_0xbdec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var controller=require(_0xbdec('0x7'));router['get']('/',auth[_0xbdec('0x8')](),controller[_0xbdec('0x9')]);router[_0xbdec('0xa')](_0xbdec('0xb'),auth[_0xbdec('0x8')](),controller[_0xbdec('0xc')]);router[_0xbdec('0xa')](_0xbdec('0xd'),auth[_0xbdec('0x8')](),controller[_0xbdec('0xe')]);router[_0xbdec('0xf')]('/',auth[_0xbdec('0x8')](),controller['create']);router['put'](_0xbdec('0xd'),auth[_0xbdec('0x8')](),controller[_0xbdec('0x10')]);router[_0xbdec('0x11')](_0xbdec('0xd'),auth['isAuthenticated'](),controller[_0xbdec('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ac4f76e..98c209c 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 _0xd07e=['DATE','moment','sequelize','exports','STRING'];(function(_0x546d36,_0xdc647d){var _0x33bd1f=function(_0x5b5cfa){while(--_0x5b5cfa){_0x546d36['push'](_0x546d36['shift']());}};_0x33bd1f(++_0xdc647d);}(_0xd07e,0x10a));var _0xed07=function(_0x3a5f0f,_0x2091f6){_0x3a5f0f=_0x3a5f0f-0x0;var _0x264c31=_0xd07e[_0x3a5f0f];return _0x264c31;};'use strict';var moment=require(_0xed07('0x0'));var Sequelize=require(_0xed07('0x1'));module[_0xed07('0x2')]={'uniqueid':{'type':Sequelize[_0xed07('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xed07('0x3')]},'joinAt':{'type':Sequelize[_0xed07('0x4')]},'leaveAt':{'type':Sequelize[_0xed07('0x4')]},'acceptAt':{'type':Sequelize[_0xed07('0x4')]},'exitAt':{'type':Sequelize[_0xed07('0x4')]},'reason':{'type':Sequelize[_0xed07('0x3')]}}; \ No newline at end of file +var _0x6f6b=['sequelize','STRING','DATE','moment'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x6f6b,0x77));var _0xb6f6=function(_0x91cc04,_0x48e6a6){_0x91cc04=_0x91cc04-0x0;var _0x26b085=_0x6f6b[_0x91cc04];return _0x26b085;};'use strict';var moment=require(_0xb6f6('0x0'));var Sequelize=require(_0xb6f6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb6f6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb6f6('0x2')]},'joinAt':{'type':Sequelize[_0xb6f6('0x3')]},'leaveAt':{'type':Sequelize[_0xb6f6('0x3')]},'acceptAt':{'type':Sequelize[_0xb6f6('0x3')]},'exitAt':{'type':Sequelize[_0xb6f6('0x3')]},'reason':{'type':Sequelize[_0xb6f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 74add95..7f8c50c 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 _0x6991=['to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','undefined','set','Content-Range','apply','reject','then','stack','name','send','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','filter','options','OpenchannelQueueReport','count','includeAll','include','findAll','keys','catch','create','body','update','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox'];(function(_0x2bae7f,_0x4dabe4){var _0x248a0b=function(_0x307c22){while(--_0x307c22){_0x2bae7f['push'](_0x2bae7f['shift']());}};_0x248a0b(++_0x4dabe4);}(_0x6991,0x13e));var _0x1699=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6991[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1699('0x0'));var zipdir=require(_0x1699('0x1'));var jsonpatch=require(_0x1699('0x2'));var rp=require('request-promise');var moment=require(_0x1699('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1699('0x4'));var util=require(_0x1699('0x5'));var path=require('path');var sox=require(_0x1699('0x6'));var csv=require(_0x1699('0x7'));var ejs=require(_0x1699('0x8'));var fs=require('fs');var fs_extra=require(_0x1699('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1699('0xa'));var deskjs=require(_0x1699('0xb'));var toCsv=require(_0x1699('0x7'));var querystring=require(_0x1699('0xc'));var Papa=require(_0x1699('0xd'));var Redis=require('ioredis');var authService=require(_0x1699('0xe'));var qs=require(_0x1699('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1699('0x10'));var logger=require(_0x1699('0x11'))(_0x1699('0x12'));var utils=require('../../config/utils');var config=require(_0x1699('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542362,_0x102ed6){_0x102ed6=_0x102ed6||0xcc;return function(_0x44c60e){if(_0x44c60e){return _0x542362['sendStatus'](_0x102ed6);}return _0x542362[_0x1699('0x14')](_0x102ed6)[_0x1699('0x15')]();};}function respondWithResult(_0x1faacc,_0xc483b){_0xc483b=_0xc483b||0xc8;return function(_0xaae928){if(_0xaae928){return _0x1faacc[_0x1699('0x14')](_0xc483b)[_0x1699('0x16')](_0xaae928);}};}function respondWithFilteredResult(_0x91d227,_0x4094a1){return function(_0x5b3800){if(_0x5b3800){var _0x37ebc8=typeof _0x4094a1[_0x1699('0x17')]===_0x1699('0x18')&&typeof _0x4094a1['limit']===_0x1699('0x18');var _0x1f7842=_0x5b3800['count'];var _0x2f1c25=_0x37ebc8?0x0:_0x4094a1[_0x1699('0x17')];var _0x4cf68c=_0x37ebc8?_0x5b3800['count']:_0x4094a1[_0x1699('0x17')]+_0x4094a1['limit'];var _0x123b7f;if(_0x4cf68c>=_0x1f7842){_0x4cf68c=_0x1f7842;_0x123b7f=0xc8;}else{_0x123b7f=0xce;}_0x91d227[_0x1699('0x14')](_0x123b7f);return _0x91d227[_0x1699('0x19')](_0x1699('0x1a'),_0x2f1c25+'-'+_0x4cf68c+'/'+_0x1f7842)[_0x1699('0x16')](_0x5b3800);}return null;};}function patchUpdates(_0x1a2759){return function(_0x1c8c2e){try{jsonpatch[_0x1699('0x1b')](_0x1c8c2e,_0x1a2759,!![]);}catch(_0x5e23c4){return BPromise[_0x1699('0x1c')](_0x5e23c4);}return _0x1c8c2e['save']();};}function saveUpdates(_0x3ae62f,_0x3683cf){return function(_0x2a2cea){if(_0x2a2cea){return _0x2a2cea['update'](_0x3ae62f)[_0x1699('0x1d')](function(_0x1f9333){return _0x1f9333;});}return null;};}function removeEntity(_0x3c18a4,_0x2f9d63){return function(_0x320aea){if(_0x320aea){return _0x320aea['destroy']()[_0x1699('0x1d')](function(){_0x3c18a4[_0x1699('0x14')](0xcc)[_0x1699('0x15')]();});}};}function handleEntityNotFound(_0x1cb2c3,_0x58cd50){return function(_0x7140e1){if(!_0x7140e1){_0x1cb2c3['sendStatus'](0x194);}return _0x7140e1;};}function handleError(_0x1cc7a8,_0x46f52d){_0x46f52d=_0x46f52d||0x1f4;return function(_0x1d4764){logger['error'](_0x1d4764[_0x1699('0x1e')]);if(_0x1d4764['name']){delete _0x1d4764[_0x1699('0x1f')];}_0x1cc7a8[_0x1699('0x14')](_0x46f52d)[_0x1699('0x20')](_0x1d4764);};}exports['index']=function(_0x566ffe,_0x115f03){var _0x32a831={},_0x2b514d={},_0x469da5={'count':0x0,'rows':[]};var _0x5413f8=_[_0x1699('0x21')](db['OpenchannelQueueReport'][_0x1699('0x22')],function(_0x2e9f79){return{'name':_0x2e9f79['fieldName'],'type':_0x2e9f79[_0x1699('0x23')]['key']};});_0x2b514d[_0x1699('0x24')]=_[_0x1699('0x21')](_0x5413f8,_0x1699('0x1f'));_0x2b514d['query']=_['keys'](_0x566ffe[_0x1699('0x25')]);_0x2b514d[_0x1699('0x26')]=_['intersection'](_0x2b514d[_0x1699('0x24')],_0x2b514d['query']);_0x32a831[_0x1699('0x27')]=_[_0x1699('0x28')](_0x2b514d[_0x1699('0x24')],qs[_0x1699('0x29')](_0x566ffe['query']['fields']));_0x32a831[_0x1699('0x27')]=_0x32a831['attributes'][_0x1699('0x2a')]?_0x32a831['attributes']:_0x2b514d['model'];if(!_0x566ffe[_0x1699('0x25')]['hasOwnProperty'](_0x1699('0x2b'))){_0x32a831[_0x1699('0x2c')]=qs[_0x1699('0x2c')](_0x566ffe[_0x1699('0x25')]['limit']);_0x32a831[_0x1699('0x17')]=qs[_0x1699('0x17')](_0x566ffe[_0x1699('0x25')][_0x1699('0x17')]);}_0x32a831[_0x1699('0x2d')]=qs[_0x1699('0x2e')](_0x566ffe[_0x1699('0x25')][_0x1699('0x2e')]);_0x32a831[_0x1699('0x2f')]=qs[_0x1699('0x26')](_['pick'](_0x566ffe[_0x1699('0x25')],_0x2b514d['filters']),_0x5413f8);if(_0x566ffe[_0x1699('0x25')]['filter']){_0x32a831['where']=_[_0x1699('0x30')](_0x32a831[_0x1699('0x2f')],{'$or':_[_0x1699('0x21')](_0x5413f8,function(_0x11b055){if(_0x11b055[_0x1699('0x23')]!=='VIRTUAL'){var _0x303727={};_0x303727[_0x11b055[_0x1699('0x1f')]]={'$like':'%'+_0x566ffe['query'][_0x1699('0x31')]+'%'};return _0x303727;}})});}_0x32a831=_[_0x1699('0x30')]({},_0x32a831,_0x566ffe[_0x1699('0x32')]);var _0x577dc9={'where':_0x32a831[_0x1699('0x2f')]};return db[_0x1699('0x33')][_0x1699('0x34')](_0x577dc9)['then'](function(_0x5df915){_0x469da5[_0x1699('0x34')]=_0x5df915;if(_0x566ffe[_0x1699('0x25')][_0x1699('0x35')]){_0x32a831[_0x1699('0x36')]=[{'all':!![]}];}return db[_0x1699('0x33')][_0x1699('0x37')](_0x32a831);})['then'](function(_0x1960af){_0x469da5['rows']=_0x1960af;return _0x469da5;})[_0x1699('0x1d')](respondWithFilteredResult(_0x115f03,_0x32a831))['catch'](handleError(_0x115f03,null));};exports['show']=function(_0x3c893f,_0x5caf68){var _0x50aced={'raw':!![],'where':{'id':_0x3c893f['params']['id']}},_0x51383f={};_0x51383f[_0x1699('0x24')]=_['keys'](db[_0x1699('0x33')][_0x1699('0x22')]);_0x51383f[_0x1699('0x25')]=_[_0x1699('0x38')](_0x3c893f[_0x1699('0x25')]);_0x51383f[_0x1699('0x26')]=_[_0x1699('0x28')](_0x51383f[_0x1699('0x24')],_0x51383f[_0x1699('0x25')]);_0x50aced[_0x1699('0x27')]=_[_0x1699('0x28')](_0x51383f[_0x1699('0x24')],qs[_0x1699('0x29')](_0x3c893f[_0x1699('0x25')]['fields']));_0x50aced['attributes']=_0x50aced[_0x1699('0x27')][_0x1699('0x2a')]?_0x50aced[_0x1699('0x27')]:_0x51383f['model'];if(_0x3c893f[_0x1699('0x25')]['includeAll']){_0x50aced[_0x1699('0x36')]=[{'all':!![]}];}_0x50aced=_[_0x1699('0x30')]({},_0x50aced,_0x3c893f['options']);return db[_0x1699('0x33')]['find'](_0x50aced)[_0x1699('0x1d')](handleEntityNotFound(_0x5caf68,null))[_0x1699('0x1d')](respondWithResult(_0x5caf68,null))[_0x1699('0x39')](handleError(_0x5caf68,null));};exports[_0x1699('0x3a')]=function(_0x59d3bd,_0x8325f9){return db[_0x1699('0x33')][_0x1699('0x3a')](_0x59d3bd[_0x1699('0x3b')],{})[_0x1699('0x1d')](respondWithResult(_0x8325f9,0xc9))[_0x1699('0x39')](handleError(_0x8325f9,null));};exports[_0x1699('0x3c')]=function(_0x57606b,_0xa0db4b){if(_0x57606b['body']['id']){delete _0x57606b[_0x1699('0x3b')]['id'];}return db[_0x1699('0x33')][_0x1699('0x3d')]({'where':{'id':_0x57606b[_0x1699('0x3e')]['id']}})[_0x1699('0x1d')](handleEntityNotFound(_0xa0db4b,null))['then'](saveUpdates(_0x57606b['body'],null))[_0x1699('0x1d')](respondWithResult(_0xa0db4b,null))[_0x1699('0x39')](handleError(_0xa0db4b,null));};exports[_0x1699('0x3f')]=function(_0x9fb58c,_0x549080){return db[_0x1699('0x33')][_0x1699('0x3d')]({'where':{'id':_0x9fb58c[_0x1699('0x3e')]['id']}})[_0x1699('0x1d')](handleEntityNotFound(_0x549080,null))[_0x1699('0x1d')](removeEntity(_0x549080,null))[_0x1699('0x39')](handleError(_0x549080,null));};exports[_0x1699('0x40')]=function(_0xf4f825,_0x1a05e8){return db[_0x1699('0x33')][_0x1699('0x40')]()['then'](respondWithResult(_0x1a05e8,null))[_0x1699('0x39')](handleError(_0x1a05e8,null));}; \ No newline at end of file +var _0x6c80=['key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x6c80,0x153));var _0x06c8=function(_0x473d04,_0x5047e3){_0x473d04=_0x473d04-0x0;var _0x593977=_0x6c80[_0x473d04];return _0x593977;};'use strict';var emlformat=require(_0x06c8('0x0'));var rimraf=require(_0x06c8('0x1'));var zipdir=require(_0x06c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x06c8('0x3'));var Mustache=require(_0x06c8('0x4'));var util=require(_0x06c8('0x5'));var path=require(_0x06c8('0x6'));var sox=require(_0x06c8('0x7'));var csv=require(_0x06c8('0x8'));var ejs=require(_0x06c8('0x9'));var fs=require('fs');var fs_extra=require(_0x06c8('0xa'));var _=require(_0x06c8('0xb'));var squel=require(_0x06c8('0xc'));var crypto=require(_0x06c8('0xd'));var jsforce=require(_0x06c8('0xe'));var deskjs=require(_0x06c8('0xf'));var toCsv=require(_0x06c8('0x8'));var querystring=require(_0x06c8('0x10'));var Papa=require(_0x06c8('0x11'));var Redis=require(_0x06c8('0x12'));var authService=require(_0x06c8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x06c8('0x14'));var hardwareService=require(_0x06c8('0x15'));var logger=require(_0x06c8('0x16'))(_0x06c8('0x17'));var utils=require(_0x06c8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x06c8('0x19'));var db=require(_0x06c8('0x1a'))['db'];function respondWithStatusCode(_0x3ebbaa,_0x197ae7){_0x197ae7=_0x197ae7||0xcc;return function(_0x2792dc){if(_0x2792dc){return _0x3ebbaa[_0x06c8('0x1b')](_0x197ae7);}return _0x3ebbaa[_0x06c8('0x1c')](_0x197ae7)[_0x06c8('0x1d')]();};}function respondWithResult(_0x1f7e6f,_0x7908c3){_0x7908c3=_0x7908c3||0xc8;return function(_0x5ca2de){if(_0x5ca2de){return _0x1f7e6f['status'](_0x7908c3)[_0x06c8('0x1e')](_0x5ca2de);}};}function respondWithFilteredResult(_0x48e9b0,_0x4845b6){return function(_0x5209bb){if(_0x5209bb){var _0x3fd5f6=typeof _0x4845b6[_0x06c8('0x1f')]===_0x06c8('0x20')&&typeof _0x4845b6['limit']===_0x06c8('0x20');var _0x1d7e75=_0x5209bb[_0x06c8('0x21')];var _0x17e4c2=_0x3fd5f6?0x0:_0x4845b6[_0x06c8('0x1f')];var _0x37f2f2=_0x3fd5f6?_0x5209bb[_0x06c8('0x21')]:_0x4845b6[_0x06c8('0x1f')]+_0x4845b6[_0x06c8('0x22')];var _0x299c46;if(_0x37f2f2>=_0x1d7e75){_0x37f2f2=_0x1d7e75;_0x299c46=0xc8;}else{_0x299c46=0xce;}_0x48e9b0[_0x06c8('0x1c')](_0x299c46);return _0x48e9b0[_0x06c8('0x23')](_0x06c8('0x24'),_0x17e4c2+'-'+_0x37f2f2+'/'+_0x1d7e75)['json'](_0x5209bb);}return null;};}function patchUpdates(_0x54ba87){return function(_0x254ddd){try{jsonpatch[_0x06c8('0x25')](_0x254ddd,_0x54ba87,!![]);}catch(_0x278335){return BPromise['reject'](_0x278335);}return _0x254ddd[_0x06c8('0x26')]();};}function saveUpdates(_0x508038,_0x241dc1){return function(_0x3984ca){if(_0x3984ca){return _0x3984ca[_0x06c8('0x27')](_0x508038)[_0x06c8('0x28')](function(_0x3a21ee){return _0x3a21ee;});}return null;};}function removeEntity(_0x32d46e,_0x55907d){return function(_0x7db4d0){if(_0x7db4d0){return _0x7db4d0[_0x06c8('0x29')]()[_0x06c8('0x28')](function(){_0x32d46e[_0x06c8('0x1c')](0xcc)[_0x06c8('0x1d')]();});}};}function handleEntityNotFound(_0x37b354,_0x29d025){return function(_0xc726ed){if(!_0xc726ed){_0x37b354[_0x06c8('0x1b')](0x194);}return _0xc726ed;};}function handleError(_0x103ed2,_0x86b172){_0x86b172=_0x86b172||0x1f4;return function(_0x262278){logger[_0x06c8('0x2a')](_0x262278[_0x06c8('0x2b')]);if(_0x262278[_0x06c8('0x2c')]){delete _0x262278['name'];}_0x103ed2['status'](_0x86b172)['send'](_0x262278);};}exports[_0x06c8('0x2d')]=function(_0x22dd3e,_0x472e24){var _0x20dac3={},_0x52e06e={},_0x18a6a6={'count':0x0,'rows':[]};var _0x699acf=_[_0x06c8('0x2e')](db[_0x06c8('0x2f')][_0x06c8('0x30')],function(_0x6b612d){return{'name':_0x6b612d[_0x06c8('0x31')],'type':_0x6b612d[_0x06c8('0x32')][_0x06c8('0x33')]};});_0x52e06e[_0x06c8('0x34')]=_[_0x06c8('0x2e')](_0x699acf,_0x06c8('0x2c'));_0x52e06e[_0x06c8('0x35')]=_['keys'](_0x22dd3e[_0x06c8('0x35')]);_0x52e06e['filters']=_[_0x06c8('0x36')](_0x52e06e[_0x06c8('0x34')],_0x52e06e['query']);_0x20dac3['attributes']=_[_0x06c8('0x36')](_0x52e06e[_0x06c8('0x34')],qs[_0x06c8('0x37')](_0x22dd3e[_0x06c8('0x35')][_0x06c8('0x37')]));_0x20dac3[_0x06c8('0x38')]=_0x20dac3[_0x06c8('0x38')][_0x06c8('0x39')]?_0x20dac3[_0x06c8('0x38')]:_0x52e06e['model'];if(!_0x22dd3e['query'][_0x06c8('0x3a')](_0x06c8('0x3b'))){_0x20dac3['limit']=qs[_0x06c8('0x22')](_0x22dd3e[_0x06c8('0x35')]['limit']);_0x20dac3[_0x06c8('0x1f')]=qs[_0x06c8('0x1f')](_0x22dd3e[_0x06c8('0x35')][_0x06c8('0x1f')]);}_0x20dac3['order']=qs[_0x06c8('0x3c')](_0x22dd3e[_0x06c8('0x35')]['sort']);_0x20dac3[_0x06c8('0x3d')]=qs['filters'](_[_0x06c8('0x3e')](_0x22dd3e[_0x06c8('0x35')],_0x52e06e[_0x06c8('0x3f')]),_0x699acf);if(_0x22dd3e['query'][_0x06c8('0x40')]){_0x20dac3[_0x06c8('0x3d')]=_['merge'](_0x20dac3[_0x06c8('0x3d')],{'$or':_[_0x06c8('0x2e')](_0x699acf,function(_0x5b00b5){if(_0x5b00b5[_0x06c8('0x32')]!=='VIRTUAL'){var _0x1f4d93={};_0x1f4d93[_0x5b00b5['name']]={'$like':'%'+_0x22dd3e['query'][_0x06c8('0x40')]+'%'};return _0x1f4d93;}})});}_0x20dac3=_[_0x06c8('0x41')]({},_0x20dac3,_0x22dd3e[_0x06c8('0x42')]);var _0x59e677={'where':_0x20dac3['where']};return db['OpenchannelQueueReport']['count'](_0x59e677)[_0x06c8('0x28')](function(_0x5d1ae8){_0x18a6a6['count']=_0x5d1ae8;if(_0x22dd3e[_0x06c8('0x35')][_0x06c8('0x43')]){_0x20dac3[_0x06c8('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x06c8('0x45')](_0x20dac3);})[_0x06c8('0x28')](function(_0x4fba4c){_0x18a6a6[_0x06c8('0x46')]=_0x4fba4c;return _0x18a6a6;})['then'](respondWithFilteredResult(_0x472e24,_0x20dac3))[_0x06c8('0x47')](handleError(_0x472e24,null));};exports['show']=function(_0x2fa19a,_0x1e0bce){var _0x3d70ae={'raw':!![],'where':{'id':_0x2fa19a[_0x06c8('0x48')]['id']}},_0x60c434={};_0x60c434[_0x06c8('0x34')]=_[_0x06c8('0x49')](db[_0x06c8('0x2f')][_0x06c8('0x30')]);_0x60c434[_0x06c8('0x35')]=_[_0x06c8('0x49')](_0x2fa19a[_0x06c8('0x35')]);_0x60c434['filters']=_[_0x06c8('0x36')](_0x60c434[_0x06c8('0x34')],_0x60c434[_0x06c8('0x35')]);_0x3d70ae['attributes']=_['intersection'](_0x60c434['model'],qs[_0x06c8('0x37')](_0x2fa19a[_0x06c8('0x35')][_0x06c8('0x37')]));_0x3d70ae[_0x06c8('0x38')]=_0x3d70ae[_0x06c8('0x38')][_0x06c8('0x39')]?_0x3d70ae[_0x06c8('0x38')]:_0x60c434[_0x06c8('0x34')];if(_0x2fa19a[_0x06c8('0x35')][_0x06c8('0x43')]){_0x3d70ae['include']=[{'all':!![]}];}_0x3d70ae=_[_0x06c8('0x41')]({},_0x3d70ae,_0x2fa19a['options']);return db[_0x06c8('0x2f')][_0x06c8('0x4a')](_0x3d70ae)[_0x06c8('0x28')](handleEntityNotFound(_0x1e0bce,null))[_0x06c8('0x28')](respondWithResult(_0x1e0bce,null))[_0x06c8('0x47')](handleError(_0x1e0bce,null));};exports[_0x06c8('0x4b')]=function(_0x465259,_0x2b4100){return db['OpenchannelQueueReport'][_0x06c8('0x4b')](_0x465259[_0x06c8('0x4c')],{})['then'](respondWithResult(_0x2b4100,0xc9))[_0x06c8('0x47')](handleError(_0x2b4100,null));};exports[_0x06c8('0x27')]=function(_0x5a9ef6,_0x4a04fd){if(_0x5a9ef6[_0x06c8('0x4c')]['id']){delete _0x5a9ef6[_0x06c8('0x4c')]['id'];}return db[_0x06c8('0x2f')][_0x06c8('0x4a')]({'where':{'id':_0x5a9ef6[_0x06c8('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a04fd,null))[_0x06c8('0x28')](saveUpdates(_0x5a9ef6['body'],null))[_0x06c8('0x28')](respondWithResult(_0x4a04fd,null))['catch'](handleError(_0x4a04fd,null));};exports['destroy']=function(_0x58f5e7,_0x1075b5){return db[_0x06c8('0x2f')]['find']({'where':{'id':_0x58f5e7[_0x06c8('0x48')]['id']}})[_0x06c8('0x28')](handleEntityNotFound(_0x1075b5,null))[_0x06c8('0x28')](removeEntity(_0x1075b5,null))[_0x06c8('0x47')](handleError(_0x1075b5,null));};exports['describe']=function(_0x1543ca,_0x423782){return db[_0x06c8('0x2f')][_0x06c8('0x4d')]()['then'](respondWithResult(_0x423782,null))[_0x06c8('0x47')](handleError(_0x423782,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4f5c313..e2d206b 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2944c6,_0x333074){var _0x294d8e=function(_0x310926){while(--_0x310926){_0x2944c6['push'](_0x2944c6['shift']());}};_0x294d8e(++_0x333074);}(_0x1261,0x144));var _0x1126=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0x1261[_0x5c96eb];return _0x4ddbad;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x814b,0x1a2));var _0xb814=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x814b[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 88ec5f7..23823b3 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 _0x5a13=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5858f5,_0x256189){var _0x495eef=function(_0x2c43fd){while(--_0x2c43fd){_0x5858f5['push'](_0x5858f5['shift']());}};_0x495eef(++_0x256189);}(_0x5a13,0x145));var _0x35a1=function(_0x34b00f,_0x25b4e2){_0x34b00f=_0x34b00f-0x0;var _0x1c257a=_0x5a13[_0x34b00f];return _0x1c257a;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')](_0x1de373[_0x35a1('0x1a')],{'raw':_0x1de373[_0x35a1('0x1b')]?_0x1de373[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![]})[_0x35a1('0xd')](function(_0x5929e5){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger['debug'](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x5929e5));_0x3b17dc(_0x5929e5);})['catch'](function(_0xc13bad){logger['error'](_0x35a1('0x17'),_0xc13bad[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0xc13bad['message']));});});};exports[_0x35a1('0x1d')]=function(_0x2b87a1){var _0x48f1bd=this;return new Promise(function(_0x4c41ce,_0x5303b4){return db[_0x35a1('0x18')]['update'](_0x2b87a1['body'],{'raw':_0x2b87a1['options']?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')]['where']||null:null,'attributes':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1e')]||null:null,'limit':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1f')]||null:null})[_0x35a1('0xd')](function(_0x24bb2d){logger[_0x35a1('0x14')](_0x35a1('0x1d'),_0x2b87a1);logger[_0x35a1('0x20')](_0x35a1('0x1d'),_0x2b87a1,JSON[_0x35a1('0x10')](_0x24bb2d));_0x4c41ce(_0x24bb2d);})[_0x35a1('0x16')](function(_0x2ae0ca){logger['error'](_0x35a1('0x1d'),_0x2ae0ca[_0x35a1('0x12')],_0x2b87a1);_0x5303b4(_0x48f1bd[_0x35a1('0x13')](0x1f4,_0x2ae0ca[_0x35a1('0x12')]));});});}; \ No newline at end of file +var _0xa478=['../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','OpenchannelQueueReport','where','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ef042,_0x1a71fc){var _0x33db2b=function(_0xab5a34){while(--_0xab5a34){_0x1ef042['push'](_0x1ef042['shift']());}};_0x33db2b(++_0x1a71fc);}(_0xa478,0x136));var _0x8a47=function(_0x155413,_0x1c89b4){_0x155413=_0x155413-0x0;var _0x434c71=_0xa478[_0x155413];return _0x434c71;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}exports[_0x8a47('0x17')]=function(_0x3f9093){var _0x5f5884=this;return new Promise(function(_0x341089,_0x5c62eb){return db['OpenchannelQueueReport'][_0x8a47('0x18')](_0x3f9093[_0x8a47('0x19')],{'raw':_0x3f9093[_0x8a47('0x1a')]?_0x3f9093[_0x8a47('0x1a')][_0x8a47('0x1b')]===undefined?!![]:![]:!![]})[_0x8a47('0xd')](function(_0x44e119){logger[_0x8a47('0xe')](_0x8a47('0x17'),_0x3f9093);logger[_0x8a47('0x10')]('CreateOpenchannelQueueReport',_0x3f9093,JSON[_0x8a47('0x1c')](_0x44e119));_0x341089(_0x44e119);})['catch'](function(_0x289f28){logger[_0x8a47('0x11')](_0x8a47('0x17'),_0x289f28[_0x8a47('0x13')],_0x3f9093);_0x5c62eb(_0x5f5884['error'](0x1f4,_0x289f28[_0x8a47('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x50f6ba){var _0x4d71f4=this;return new Promise(function(_0x4cbd83,_0xf46d2c){return db[_0x8a47('0x1d')]['update'](_0x50f6ba[_0x8a47('0x19')],{'raw':_0x50f6ba[_0x8a47('0x1a')]?_0x50f6ba[_0x8a47('0x1a')][_0x8a47('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50f6ba[_0x8a47('0x1a')]?_0x50f6ba[_0x8a47('0x1a')][_0x8a47('0x1e')]||null:null,'attributes':_0x50f6ba['options']?_0x50f6ba[_0x8a47('0x1a')]['attributes']||null:null,'limit':_0x50f6ba[_0x8a47('0x1a')]?_0x50f6ba[_0x8a47('0x1a')]['limit']||null:null})[_0x8a47('0xd')](function(_0x526571){logger['info'](_0x8a47('0x1f'),_0x50f6ba);logger[_0x8a47('0x10')](_0x8a47('0x1f'),_0x50f6ba,JSON[_0x8a47('0x1c')](_0x526571));_0x4cbd83(_0x526571);})[_0x8a47('0x16')](function(_0x18bfd3){logger['error'](_0x8a47('0x1f'),_0x18bfd3['message'],_0x50f6ba);_0xf46d2c(_0x4d71f4['error'](0x1f4,_0x18bfd3[_0x8a47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cf0bc5f..13175f2 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 _0xa39d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4a2ff1,_0x13de3b){var _0x106aa7=function(_0x433dca){while(--_0x433dca){_0x4a2ff1['push'](_0x4a2ff1['shift']());}};_0x106aa7(++_0x13de3b);}(_0xa39d,0x1b5));var _0xda39=function(_0x22cdc7,_0x474115){_0x22cdc7=_0x22cdc7-0x0;var _0xb5b746=_0xa39d[_0x22cdc7];return _0xb5b746;};'use strict';var multer=require('multer');var util=require(_0xda39('0x0'));var path=require('path');var timeout=require(_0xda39('0x1'));var express=require(_0xda39('0x2'));var router=express[_0xda39('0x3')]();var fs_extra=require(_0xda39('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xda39('0x5'));var config=require(_0xda39('0x6'));var controller=require(_0xda39('0x7'));router['get']('/',auth[_0xda39('0x8')](),controller['index']);router['get'](_0xda39('0x9'),auth[_0xda39('0x8')](),controller[_0xda39('0xa')]);router[_0xda39('0xb')](_0xda39('0xc'),auth[_0xda39('0x8')](),controller[_0xda39('0xd')]);router['post']('/',auth[_0xda39('0x8')](),controller[_0xda39('0xe')]);router[_0xda39('0xf')]('/:id',auth[_0xda39('0x8')](),controller[_0xda39('0x10')]);router[_0xda39('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xda39('0x12')]);module[_0xda39('0x13')]=router; \ No newline at end of file +var _0xe2da=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x4572de,_0x2c38f2){var _0x38f0ee=function(_0x40f556){while(--_0x40f556){_0x4572de['push'](_0x4572de['shift']());}};_0x38f0ee(++_0x2c38f2);}(_0xe2da,0x1b8));var _0xae2d=function(_0x3bbfd8,_0x205e09){_0x3bbfd8=_0x3bbfd8-0x0;var _0x1f3454=_0xe2da[_0x3bbfd8];return _0x1f3454;};'use strict';var multer=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var path=require(_0xae2d('0x2'));var timeout=require(_0xae2d('0x3'));var express=require(_0xae2d('0x4'));var router=express[_0xae2d('0x5')]();var fs_extra=require(_0xae2d('0x6'));var auth=require(_0xae2d('0x7'));var interaction=require(_0xae2d('0x8'));var config=require(_0xae2d('0x9'));var controller=require(_0xae2d('0xa'));router[_0xae2d('0xb')]('/',auth['isAuthenticated'](),controller[_0xae2d('0xc')]);router['get'](_0xae2d('0xd'),auth[_0xae2d('0xe')](),controller[_0xae2d('0xf')]);router[_0xae2d('0xb')](_0xae2d('0x10'),auth[_0xae2d('0xe')](),controller['show']);router[_0xae2d('0x11')]('/',auth[_0xae2d('0xe')](),controller[_0xae2d('0x12')]);router[_0xae2d('0x13')](_0xae2d('0x10'),auth[_0xae2d('0xe')](),controller[_0xae2d('0x14')]);router['delete'](_0xae2d('0x10'),auth[_0xae2d('0xe')](),controller[_0xae2d('0x15')]);module[_0xae2d('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 27a64be..a5f8a92 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x37222f,_0x25a5ab){var _0x5c5a6d=function(_0x27218b){while(--_0x27218b){_0x37222f['push'](_0x37222f['shift']());}};_0x5c5a6d(++_0x25a5ab);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5079c3,_0x9e8444){var _0x22d5d8=function(_0x58047f){while(--_0x58047f){_0x5079c3['push'](_0x5079c3['shift']());}};_0x22d5d8(++_0x9e8444);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 7311b96..ecd1c1b 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 _0x68bd=['options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x68bd,0xe9));var _0xd68b=function(_0x2ae099,_0x1d9376){_0x2ae099=_0x2ae099-0x0;var _0x2ce323=_0x68bd[_0x2ae099];return _0x2ce323;};'use strict';var emlformat=require(_0xd68b('0x0'));var rimraf=require(_0xd68b('0x1'));var zipdir=require(_0xd68b('0x2'));var jsonpatch=require(_0xd68b('0x3'));var rp=require(_0xd68b('0x4'));var moment=require(_0xd68b('0x5'));var BPromise=require(_0xd68b('0x6'));var Mustache=require(_0xd68b('0x7'));var util=require(_0xd68b('0x8'));var path=require(_0xd68b('0x9'));var sox=require('sox');var csv=require(_0xd68b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd68b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd68b('0xc'));var jsforce=require(_0xd68b('0xd'));var deskjs=require(_0xd68b('0xe'));var toCsv=require(_0xd68b('0xa'));var querystring=require(_0xd68b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd68b('0x10'));var qs=require(_0xd68b('0x11'));var as=require(_0xd68b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd68b('0x13'))(_0xd68b('0x14'));var utils=require(_0xd68b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd68b('0x16'));var db=require(_0xd68b('0x17'))['db'];function respondWithStatusCode(_0x4d9212,_0x5cb6ad){_0x5cb6ad=_0x5cb6ad||0xcc;return function(_0x5d1318){if(_0x5d1318){return _0x4d9212['sendStatus'](_0x5cb6ad);}return _0x4d9212[_0xd68b('0x18')](_0x5cb6ad)[_0xd68b('0x19')]();};}function respondWithResult(_0x4902e0,_0x56a455){_0x56a455=_0x56a455||0xc8;return function(_0x197224){if(_0x197224){return _0x4902e0['status'](_0x56a455)[_0xd68b('0x1a')](_0x197224);}};}function respondWithFilteredResult(_0x3d2b59,_0x1c8511){return function(_0x111dc1){if(_0x111dc1){var _0x49e26e=typeof _0x1c8511[_0xd68b('0x1b')]==='undefined'&&typeof _0x1c8511[_0xd68b('0x1c')]==='undefined';var _0xbdae31=_0x111dc1[_0xd68b('0x1d')];var _0x3de116=_0x49e26e?0x0:_0x1c8511[_0xd68b('0x1b')];var _0x11cd90=_0x49e26e?_0x111dc1[_0xd68b('0x1d')]:_0x1c8511[_0xd68b('0x1b')]+_0x1c8511[_0xd68b('0x1c')];var _0x41203d;if(_0x11cd90>=_0xbdae31){_0x11cd90=_0xbdae31;_0x41203d=0xc8;}else{_0x41203d=0xce;}_0x3d2b59[_0xd68b('0x18')](_0x41203d);return _0x3d2b59[_0xd68b('0x1e')](_0xd68b('0x1f'),_0x3de116+'-'+_0x11cd90+'/'+_0xbdae31)[_0xd68b('0x1a')](_0x111dc1);}return null;};}function patchUpdates(_0x138eaa){return function(_0x141cab){try{jsonpatch[_0xd68b('0x20')](_0x141cab,_0x138eaa,!![]);}catch(_0x167528){return BPromise[_0xd68b('0x21')](_0x167528);}return _0x141cab[_0xd68b('0x22')]();};}function saveUpdates(_0x55b7c5,_0x16249a){return function(_0x297187){if(_0x297187){return _0x297187[_0xd68b('0x23')](_0x55b7c5)[_0xd68b('0x24')](function(_0x19d8dd){return _0x19d8dd;});}return null;};}function removeEntity(_0x161ceb,_0x56d77d){return function(_0x5afdc7){if(_0x5afdc7){return _0x5afdc7[_0xd68b('0x25')]()[_0xd68b('0x24')](function(){_0x161ceb[_0xd68b('0x18')](0xcc)[_0xd68b('0x19')]();});}};}function handleEntityNotFound(_0x15eeb2,_0x20a0e4){return function(_0x47c1b8){if(!_0x47c1b8){_0x15eeb2['sendStatus'](0x194);}return _0x47c1b8;};}function handleError(_0x2fcd8f,_0x5269bf){_0x5269bf=_0x5269bf||0x1f4;return function(_0x19eae9){logger[_0xd68b('0x26')](_0x19eae9['stack']);if(_0x19eae9[_0xd68b('0x27')]){delete _0x19eae9[_0xd68b('0x27')];}_0x2fcd8f['status'](_0x5269bf)[_0xd68b('0x28')](_0x19eae9);};}exports[_0xd68b('0x29')]=function(_0x157d7c,_0x2a839b){var _0x23f8e8={},_0x14d1bc={},_0x23b6f0={'count':0x0,'rows':[]};var _0x4a3a93=_[_0xd68b('0x2a')](db[_0xd68b('0x2b')][_0xd68b('0x2c')],function(_0x4fafab){return{'name':_0x4fafab[_0xd68b('0x2d')],'type':_0x4fafab[_0xd68b('0x2e')][_0xd68b('0x2f')]};});_0x14d1bc[_0xd68b('0x30')]=_[_0xd68b('0x2a')](_0x4a3a93,_0xd68b('0x27'));_0x14d1bc['query']=_[_0xd68b('0x31')](_0x157d7c[_0xd68b('0x32')]);_0x14d1bc[_0xd68b('0x33')]=_[_0xd68b('0x34')](_0x14d1bc[_0xd68b('0x30')],_0x14d1bc[_0xd68b('0x32')]);_0x23f8e8[_0xd68b('0x35')]=_['intersection'](_0x14d1bc[_0xd68b('0x30')],qs['fields'](_0x157d7c[_0xd68b('0x32')][_0xd68b('0x36')]));_0x23f8e8[_0xd68b('0x35')]=_0x23f8e8[_0xd68b('0x35')][_0xd68b('0x37')]?_0x23f8e8['attributes']:_0x14d1bc[_0xd68b('0x30')];if(!_0x157d7c[_0xd68b('0x32')][_0xd68b('0x38')]('nolimit')){_0x23f8e8[_0xd68b('0x1c')]=qs[_0xd68b('0x1c')](_0x157d7c[_0xd68b('0x32')][_0xd68b('0x1c')]);_0x23f8e8[_0xd68b('0x1b')]=qs[_0xd68b('0x1b')](_0x157d7c[_0xd68b('0x32')][_0xd68b('0x1b')]);}_0x23f8e8[_0xd68b('0x39')]=qs['sort'](_0x157d7c[_0xd68b('0x32')]['sort']);_0x23f8e8['where']=qs['filters'](_[_0xd68b('0x3a')](_0x157d7c[_0xd68b('0x32')],_0x14d1bc[_0xd68b('0x33')]),_0x4a3a93);if(_0x157d7c['query'][_0xd68b('0x3b')]){_0x23f8e8[_0xd68b('0x3c')]=_[_0xd68b('0x3d')](_0x23f8e8['where'],{'$or':_[_0xd68b('0x2a')](_0x4a3a93,function(_0x20b9e3){if(_0x20b9e3[_0xd68b('0x2e')]!==_0xd68b('0x3e')){var _0x34a49f={};_0x34a49f[_0x20b9e3[_0xd68b('0x27')]]={'$like':'%'+_0x157d7c[_0xd68b('0x32')][_0xd68b('0x3b')]+'%'};return _0x34a49f;}})});}_0x23f8e8=_[_0xd68b('0x3d')]({},_0x23f8e8,_0x157d7c[_0xd68b('0x3f')]);var _0x227de1={'where':_0x23f8e8[_0xd68b('0x3c')]};return db[_0xd68b('0x2b')]['count'](_0x227de1)[_0xd68b('0x24')](function(_0x45e9e3){_0x23b6f0[_0xd68b('0x1d')]=_0x45e9e3;if(_0x157d7c['query'][_0xd68b('0x40')]){_0x23f8e8['include']=[{'all':!![]}];}return db[_0xd68b('0x2b')][_0xd68b('0x41')](_0x23f8e8);})[_0xd68b('0x24')](function(_0xd9e10e){_0x23b6f0['rows']=_0xd9e10e;return _0x23b6f0;})[_0xd68b('0x24')](respondWithFilteredResult(_0x2a839b,_0x23f8e8))[_0xd68b('0x42')](handleError(_0x2a839b,null));};exports[_0xd68b('0x43')]=function(_0x3d289d,_0x1abcb4){var _0x58457a={'raw':!![],'where':{'id':_0x3d289d[_0xd68b('0x44')]['id']}},_0x56cb10={};_0x56cb10[_0xd68b('0x30')]=_[_0xd68b('0x31')](db['OpenchannelTransferReport'][_0xd68b('0x2c')]);_0x56cb10['query']=_['keys'](_0x3d289d[_0xd68b('0x32')]);_0x56cb10['filters']=_[_0xd68b('0x34')](_0x56cb10['model'],_0x56cb10[_0xd68b('0x32')]);_0x58457a[_0xd68b('0x35')]=_['intersection'](_0x56cb10[_0xd68b('0x30')],qs['fields'](_0x3d289d['query'][_0xd68b('0x36')]));_0x58457a['attributes']=_0x58457a['attributes'][_0xd68b('0x37')]?_0x58457a['attributes']:_0x56cb10[_0xd68b('0x30')];if(_0x3d289d[_0xd68b('0x32')][_0xd68b('0x40')]){_0x58457a[_0xd68b('0x45')]=[{'all':!![]}];}_0x58457a=_[_0xd68b('0x3d')]({},_0x58457a,_0x3d289d[_0xd68b('0x3f')]);return db[_0xd68b('0x2b')][_0xd68b('0x46')](_0x58457a)[_0xd68b('0x24')](handleEntityNotFound(_0x1abcb4,null))['then'](respondWithResult(_0x1abcb4,null))[_0xd68b('0x42')](handleError(_0x1abcb4,null));};exports[_0xd68b('0x47')]=function(_0x18e47e,_0x3d53c3){return db[_0xd68b('0x2b')]['create'](_0x18e47e[_0xd68b('0x48')],{})['then'](respondWithResult(_0x3d53c3,0xc9))[_0xd68b('0x42')](handleError(_0x3d53c3,null));};exports[_0xd68b('0x23')]=function(_0x5f26cc,_0x839588){if(_0x5f26cc[_0xd68b('0x48')]['id']){delete _0x5f26cc[_0xd68b('0x48')]['id'];}return db['OpenchannelTransferReport'][_0xd68b('0x46')]({'where':{'id':_0x5f26cc[_0xd68b('0x44')]['id']}})[_0xd68b('0x24')](handleEntityNotFound(_0x839588,null))['then'](saveUpdates(_0x5f26cc['body'],null))[_0xd68b('0x24')](respondWithResult(_0x839588,null))[_0xd68b('0x42')](handleError(_0x839588,null));};exports[_0xd68b('0x25')]=function(_0x1b7567,_0x2ea20a){return db[_0xd68b('0x2b')]['find']({'where':{'id':_0x1b7567[_0xd68b('0x44')]['id']}})[_0xd68b('0x24')](handleEntityNotFound(_0x2ea20a,null))[_0xd68b('0x24')](removeEntity(_0x2ea20a,null))[_0xd68b('0x42')](handleError(_0x2ea20a,null));};exports[_0xd68b('0x49')]=function(_0x51015c,_0x468712){return db[_0xd68b('0x2b')][_0xd68b('0x49')]()[_0xd68b('0x24')](respondWithResult(_0x468712,null))[_0xd68b('0x42')](handleError(_0x468712,null));}; \ No newline at end of file +var _0x3827=['then','destroy','stack','name','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x564aeb,_0x1f264a){var _0x57bd99=function(_0x2f7297){while(--_0x2f7297){_0x564aeb['push'](_0x564aeb['shift']());}};_0x57bd99(++_0x1f264a);}(_0x3827,0x1db));var _0x7382=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x3827[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0x7382('0x0'));var rimraf=require(_0x7382('0x1'));var zipdir=require(_0x7382('0x2'));var jsonpatch=require(_0x7382('0x3'));var rp=require('request-promise');var moment=require(_0x7382('0x4'));var BPromise=require(_0x7382('0x5'));var Mustache=require('mustache');var util=require(_0x7382('0x6'));var path=require(_0x7382('0x7'));var sox=require(_0x7382('0x8'));var csv=require(_0x7382('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7382('0xa'));var _=require(_0x7382('0xb'));var squel=require(_0x7382('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7382('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7382('0xe'));var Papa=require(_0x7382('0xf'));var Redis=require(_0x7382('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7382('0x11'));var hardwareService=require(_0x7382('0x12'));var logger=require(_0x7382('0x13'))(_0x7382('0x14'));var utils=require(_0x7382('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7382('0x16'));var db=require(_0x7382('0x17'))['db'];function respondWithStatusCode(_0x4c546d,_0x4f7d83){_0x4f7d83=_0x4f7d83||0xcc;return function(_0x22948d){if(_0x22948d){return _0x4c546d[_0x7382('0x18')](_0x4f7d83);}return _0x4c546d['status'](_0x4f7d83)[_0x7382('0x19')]();};}function respondWithResult(_0x153467,_0x9130fd){_0x9130fd=_0x9130fd||0xc8;return function(_0x98721){if(_0x98721){return _0x153467[_0x7382('0x1a')](_0x9130fd)[_0x7382('0x1b')](_0x98721);}};}function respondWithFilteredResult(_0x51d90e,_0x1acfc9){return function(_0x54ef31){if(_0x54ef31){var _0x586464=typeof _0x1acfc9[_0x7382('0x1c')]===_0x7382('0x1d')&&typeof _0x1acfc9[_0x7382('0x1e')]===_0x7382('0x1d');var _0xf4434c=_0x54ef31[_0x7382('0x1f')];var _0xec2ff5=_0x586464?0x0:_0x1acfc9[_0x7382('0x1c')];var _0x36bc75=_0x586464?_0x54ef31['count']:_0x1acfc9['offset']+_0x1acfc9[_0x7382('0x1e')];var _0x3abe5a;if(_0x36bc75>=_0xf4434c){_0x36bc75=_0xf4434c;_0x3abe5a=0xc8;}else{_0x3abe5a=0xce;}_0x51d90e['status'](_0x3abe5a);return _0x51d90e['set'](_0x7382('0x20'),_0xec2ff5+'-'+_0x36bc75+'/'+_0xf4434c)[_0x7382('0x1b')](_0x54ef31);}return null;};}function patchUpdates(_0x168297){return function(_0x498aad){try{jsonpatch[_0x7382('0x21')](_0x498aad,_0x168297,!![]);}catch(_0x5c5505){return BPromise[_0x7382('0x22')](_0x5c5505);}return _0x498aad[_0x7382('0x23')]();};}function saveUpdates(_0x414ff8,_0x2fbdbc){return function(_0x33250c){if(_0x33250c){return _0x33250c['update'](_0x414ff8)[_0x7382('0x24')](function(_0x13b561){return _0x13b561;});}return null;};}function removeEntity(_0x239340,_0x5b0102){return function(_0x2e3e96){if(_0x2e3e96){return _0x2e3e96[_0x7382('0x25')]()[_0x7382('0x24')](function(){_0x239340[_0x7382('0x1a')](0xcc)[_0x7382('0x19')]();});}};}function handleEntityNotFound(_0x5281fc,_0x360cde){return function(_0x537ef6){if(!_0x537ef6){_0x5281fc[_0x7382('0x18')](0x194);}return _0x537ef6;};}function handleError(_0x390dc7,_0x137b28){_0x137b28=_0x137b28||0x1f4;return function(_0x4dbb7a){logger['error'](_0x4dbb7a[_0x7382('0x26')]);if(_0x4dbb7a[_0x7382('0x27')]){delete _0x4dbb7a[_0x7382('0x27')];}_0x390dc7[_0x7382('0x1a')](_0x137b28)['send'](_0x4dbb7a);};}exports['index']=function(_0x525aec,_0x3a4642){var _0x3cc78f={},_0x4c0469={},_0x158f82={'count':0x0,'rows':[]};var _0x3e0efd=_[_0x7382('0x28')](db[_0x7382('0x29')][_0x7382('0x2a')],function(_0x34f400){return{'name':_0x34f400['fieldName'],'type':_0x34f400['type'][_0x7382('0x2b')]};});_0x4c0469[_0x7382('0x2c')]=_[_0x7382('0x28')](_0x3e0efd,_0x7382('0x27'));_0x4c0469[_0x7382('0x2d')]=_[_0x7382('0x2e')](_0x525aec[_0x7382('0x2d')]);_0x4c0469[_0x7382('0x2f')]=_[_0x7382('0x30')](_0x4c0469[_0x7382('0x2c')],_0x4c0469[_0x7382('0x2d')]);_0x3cc78f[_0x7382('0x31')]=_[_0x7382('0x30')](_0x4c0469[_0x7382('0x2c')],qs[_0x7382('0x32')](_0x525aec[_0x7382('0x2d')][_0x7382('0x32')]));_0x3cc78f[_0x7382('0x31')]=_0x3cc78f[_0x7382('0x31')][_0x7382('0x33')]?_0x3cc78f['attributes']:_0x4c0469[_0x7382('0x2c')];if(!_0x525aec[_0x7382('0x2d')][_0x7382('0x34')]('nolimit')){_0x3cc78f[_0x7382('0x1e')]=qs['limit'](_0x525aec['query']['limit']);_0x3cc78f[_0x7382('0x1c')]=qs['offset'](_0x525aec['query'][_0x7382('0x1c')]);}_0x3cc78f[_0x7382('0x35')]=qs[_0x7382('0x36')](_0x525aec['query']['sort']);_0x3cc78f[_0x7382('0x37')]=qs['filters'](_[_0x7382('0x38')](_0x525aec[_0x7382('0x2d')],_0x4c0469[_0x7382('0x2f')]),_0x3e0efd);if(_0x525aec[_0x7382('0x2d')]['filter']){_0x3cc78f[_0x7382('0x37')]=_[_0x7382('0x39')](_0x3cc78f[_0x7382('0x37')],{'$or':_[_0x7382('0x28')](_0x3e0efd,function(_0x12576e){if(_0x12576e['type']!==_0x7382('0x3a')){var _0x100c54={};_0x100c54[_0x12576e[_0x7382('0x27')]]={'$like':'%'+_0x525aec[_0x7382('0x2d')][_0x7382('0x3b')]+'%'};return _0x100c54;}})});}_0x3cc78f=_[_0x7382('0x39')]({},_0x3cc78f,_0x525aec[_0x7382('0x3c')]);var _0x4a8234={'where':_0x3cc78f[_0x7382('0x37')]};return db[_0x7382('0x29')][_0x7382('0x1f')](_0x4a8234)[_0x7382('0x24')](function(_0x140f5a){_0x158f82[_0x7382('0x1f')]=_0x140f5a;if(_0x525aec[_0x7382('0x2d')]['includeAll']){_0x3cc78f[_0x7382('0x3d')]=[{'all':!![]}];}return db[_0x7382('0x29')][_0x7382('0x3e')](_0x3cc78f);})[_0x7382('0x24')](function(_0x2cb2e1){_0x158f82[_0x7382('0x3f')]=_0x2cb2e1;return _0x158f82;})['then'](respondWithFilteredResult(_0x3a4642,_0x3cc78f))[_0x7382('0x40')](handleError(_0x3a4642,null));};exports[_0x7382('0x41')]=function(_0x420634,_0x3f896a){var _0x471ea4={'raw':!![],'where':{'id':_0x420634['params']['id']}},_0x15d517={};_0x15d517['model']=_[_0x7382('0x2e')](db[_0x7382('0x29')][_0x7382('0x2a')]);_0x15d517[_0x7382('0x2d')]=_[_0x7382('0x2e')](_0x420634[_0x7382('0x2d')]);_0x15d517['filters']=_[_0x7382('0x30')](_0x15d517['model'],_0x15d517[_0x7382('0x2d')]);_0x471ea4[_0x7382('0x31')]=_[_0x7382('0x30')](_0x15d517[_0x7382('0x2c')],qs[_0x7382('0x32')](_0x420634[_0x7382('0x2d')][_0x7382('0x32')]));_0x471ea4['attributes']=_0x471ea4[_0x7382('0x31')][_0x7382('0x33')]?_0x471ea4[_0x7382('0x31')]:_0x15d517['model'];if(_0x420634[_0x7382('0x2d')][_0x7382('0x42')]){_0x471ea4['include']=[{'all':!![]}];}_0x471ea4=_[_0x7382('0x39')]({},_0x471ea4,_0x420634[_0x7382('0x3c')]);return db['OpenchannelTransferReport'][_0x7382('0x43')](_0x471ea4)['then'](handleEntityNotFound(_0x3f896a,null))[_0x7382('0x24')](respondWithResult(_0x3f896a,null))['catch'](handleError(_0x3f896a,null));};exports[_0x7382('0x44')]=function(_0xb79d34,_0xe34d93){return db['OpenchannelTransferReport']['create'](_0xb79d34[_0x7382('0x45')],{})['then'](respondWithResult(_0xe34d93,0xc9))[_0x7382('0x40')](handleError(_0xe34d93,null));};exports[_0x7382('0x46')]=function(_0x2f07bc,_0x31076e){if(_0x2f07bc[_0x7382('0x45')]['id']){delete _0x2f07bc[_0x7382('0x45')]['id'];}return db[_0x7382('0x29')][_0x7382('0x43')]({'where':{'id':_0x2f07bc['params']['id']}})['then'](handleEntityNotFound(_0x31076e,null))[_0x7382('0x24')](saveUpdates(_0x2f07bc[_0x7382('0x45')],null))[_0x7382('0x24')](respondWithResult(_0x31076e,null))[_0x7382('0x40')](handleError(_0x31076e,null));};exports[_0x7382('0x25')]=function(_0x3c6fa7,_0x928161){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3c6fa7[_0x7382('0x47')]['id']}})[_0x7382('0x24')](handleEntityNotFound(_0x928161,null))['then'](removeEntity(_0x928161,null))[_0x7382('0x40')](handleError(_0x928161,null));};exports['describe']=function(_0x50ebb6,_0x38a61c){return db[_0x7382('0x29')][_0x7382('0x48')]()[_0x7382('0x24')](respondWithResult(_0x38a61c,null))['catch'](handleError(_0x38a61c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9af39ea..6815cba 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 _0x1194=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x443d17,_0x47e66d){var _0x5e2439=function(_0x33a7c9){while(--_0x33a7c9){_0x443d17['push'](_0x443d17['shift']());}};_0x5e2439(++_0x47e66d);}(_0x1194,0x1bd));var _0x4119=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0x1194[_0x2f32c4];return _0x95b5dc;};'use strict';var _=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var logger=require(_0x4119('0x2'))(_0x4119('0x3'));var moment=require(_0x4119('0x4'));var BPromise=require(_0x4119('0x5'));var rp=require(_0x4119('0x6'));var fs=require('fs');var path=require(_0x4119('0x7'));var rimraf=require(_0x4119('0x8'));var config=require(_0x4119('0x9'));var attributes=require('./openchannelTransferReport.attributes');module[_0x4119('0xa')]=function(_0x3f271f,_0x486ea4){return _0x3f271f[_0x4119('0xb')](_0x4119('0xc'),attributes,{'tableName':_0x4119('0xd'),'paranoid':![],'indexes':[{'name':_0x4119('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3556=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x367fc0,_0x350d53){var _0x39d237=function(_0x1a4ac9){while(--_0x1a4ac9){_0x367fc0['push'](_0x367fc0['shift']());}};_0x39d237(++_0x350d53);}(_0x3556,0xab));var _0x6355=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x3556[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0x6355('0x0'));var logger=require('../../config/logger')(_0x6355('0x1'));var moment=require('moment');var BPromise=require(_0x6355('0x2'));var rp=require(_0x6355('0x3'));var fs=require('fs');var path=require(_0x6355('0x4'));var rimraf=require(_0x6355('0x5'));var config=require(_0x6355('0x6'));var attributes=require(_0x6355('0x7'));module[_0x6355('0x8')]=function(_0x433ca8,_0x580991){return _0x433ca8['define'](_0x6355('0x9'),attributes,{'tableName':_0x6355('0xa'),'paranoid':![],'indexes':[{'name':_0x6355('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 225106b..94c57ec 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 _0x02a7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','util','randomstring','ioredis','../../mysqldb'];(function(_0x12f0f2,_0x1977dc){var _0x3a8e91=function(_0x486a37){while(--_0x486a37){_0x12f0f2['push'](_0x12f0f2['shift']());}};_0x3a8e91(++_0x1977dc);}(_0x02a7,0x7a));var _0x702a=function(_0x42fa97,_0xe64a2d){_0x42fa97=_0x42fa97-0x0;var _0x2379bc=_0x02a7[_0x42fa97];return _0x2379bc;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b25e,_0x1aa2c2,_0x3f2954){return new BPromise(function(_0x161dee,_0x430cf3){return client[_0x702a('0x9')](_0x26b25e,_0x3f2954)[_0x702a('0xa')](function(_0x48469e){logger[_0x702a('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1aa2c2,'request\x20sent');logger[_0x702a('0xc')](_0x702a('0xd'),_0x1aa2c2,_0x702a('0xe'),JSON[_0x702a('0xf')](_0x48469e));if(_0x48469e['error']){if(_0x48469e[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x48469e[_0x702a('0x10')][_0x702a('0x13')]);return _0x430cf3(_0x48469e[_0x702a('0x10')]['message']);}logger['error'](_0x702a('0x12'),_0x1aa2c2,_0x48469e['error']['message']);return _0x161dee(_0x48469e['error']['message']);}else{logger['info'](_0x702a('0x12'),_0x1aa2c2,_0x702a('0xe'));_0x161dee(_0x48469e[_0x702a('0x14')]['message']);}})['catch'](function(_0x506772){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x506772);_0x430cf3(_0x506772);});});} \ No newline at end of file +var _0x1224=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d6b55,_0x43ab65){var _0x1751f9=function(_0x22cc1b){while(--_0x22cc1b){_0x1d6b55['push'](_0x1d6b55['shift']());}};_0x1751f9(++_0x43ab65);}(_0x1224,0x10d));var _0x4122=function(_0x2c61f8,_0xb8a4dd){_0x2c61f8=_0x2c61f8-0x0;var _0x4badd1=_0x1224[_0x2c61f8];return _0x4badd1;};'use strict';var _=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var moment=require(_0x4122('0x2'));var BPromise=require(_0x4122('0x3'));var rs=require(_0x4122('0x4'));var fs=require('fs');var Redis=require(_0x4122('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4122('0x6'));var logger=require(_0x4122('0x7'))(_0x4122('0x8'));var config=require('../../config/environment');var jayson=require(_0x4122('0x9'));var client=jayson[_0x4122('0xa')][_0x4122('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b5e4,_0x2a952c,_0x431470){return new BPromise(function(_0x2444a3,_0x17b352){return client[_0x4122('0xc')](_0x40b5e4,_0x431470)[_0x4122('0xd')](function(_0x230663){logger[_0x4122('0xe')](_0x4122('0xf'),_0x2a952c,_0x4122('0x10'));logger[_0x4122('0x11')](_0x4122('0x12'),_0x2a952c,_0x4122('0x10'),JSON[_0x4122('0x13')](_0x230663));if(_0x230663[_0x4122('0x14')]){if(_0x230663[_0x4122('0x14')][_0x4122('0x15')]===0x1f4){logger[_0x4122('0x14')](_0x4122('0xf'),_0x2a952c,_0x230663[_0x4122('0x14')][_0x4122('0x16')]);return _0x17b352(_0x230663[_0x4122('0x14')][_0x4122('0x16')]);}logger[_0x4122('0x14')](_0x4122('0xf'),_0x2a952c,_0x230663[_0x4122('0x14')][_0x4122('0x16')]);return _0x2444a3(_0x230663['error'][_0x4122('0x16')]);}else{logger[_0x4122('0xe')](_0x4122('0xf'),_0x2a952c,_0x4122('0x10'));_0x2444a3(_0x230663['result'][_0x4122('0x16')]);}})[_0x4122('0x17')](function(_0x507b70){logger[_0x4122('0x14')](_0x4122('0xf'),_0x2a952c,_0x507b70);_0x17b352(_0x507b70);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c9eae5b..38c8167 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 _0xaaee=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x218b9c,_0x204113){var _0x4df62c=function(_0x45374a){while(--_0x45374a){_0x218b9c['push'](_0x218b9c['shift']());}};_0x4df62c(++_0x204113);}(_0xaaee,0x158));var _0xeaae=function(_0x1483ae,_0x7db3f2){_0x1483ae=_0x1483ae-0x0;var _0x9dd33c=_0xaaee[_0x1483ae];return _0x9dd33c;};'use strict';var multer=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var path=require(_0xeaae('0x2'));var timeout=require(_0xeaae('0x3'));var express=require('express');var router=express[_0xeaae('0x4')]();var fs_extra=require(_0xeaae('0x5'));var auth=require(_0xeaae('0x6'));var interaction=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var controller=require('./pause.controller');router[_0xeaae('0x9')]('/',auth[_0xeaae('0xa')](),controller[_0xeaae('0xb')]);router[_0xeaae('0x9')](_0xeaae('0xc'),auth[_0xeaae('0xa')](),controller[_0xeaae('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeaae('0xe')]);router[_0xeaae('0xf')](_0xeaae('0xc'),auth[_0xeaae('0xa')](),controller[_0xeaae('0x10')]);router['delete']('/:id',auth[_0xeaae('0xa')](),controller[_0xeaae('0x11')]);module[_0xeaae('0x12')]=router; \ No newline at end of file +var _0x5bc4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1c65d6,_0x10a38c){var _0x3209d6=function(_0x2121ba){while(--_0x2121ba){_0x1c65d6['push'](_0x1c65d6['shift']());}};_0x3209d6(++_0x10a38c);}(_0x5bc4,0x104));var _0x45bc=function(_0x3ec285,_0x5c264d){_0x3ec285=_0x3ec285-0x0;var _0x1197c0=_0x5bc4[_0x3ec285];return _0x1197c0;};'use strict';var multer=require(_0x45bc('0x0'));var util=require(_0x45bc('0x1'));var path=require(_0x45bc('0x2'));var timeout=require(_0x45bc('0x3'));var express=require('express');var router=express[_0x45bc('0x4')]();var fs_extra=require(_0x45bc('0x5'));var auth=require(_0x45bc('0x6'));var interaction=require(_0x45bc('0x7'));var config=require(_0x45bc('0x8'));var controller=require(_0x45bc('0x9'));router[_0x45bc('0xa')]('/',auth[_0x45bc('0xb')](),controller[_0x45bc('0xc')]);router[_0x45bc('0xa')]('/:id',auth[_0x45bc('0xb')](),controller[_0x45bc('0xd')]);router[_0x45bc('0xe')]('/',auth[_0x45bc('0xb')](),controller[_0x45bc('0xf')]);router['put']('/:id',auth[_0x45bc('0xb')](),controller[_0x45bc('0x10')]);router[_0x45bc('0x11')](_0x45bc('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5b2cbbb..bd15f94 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 _0xcad4=['name','STRING','sequelize','exports'];(function(_0x534475,_0x47dfcd){var _0x58dcbb=function(_0xf4c02f){while(--_0xf4c02f){_0x534475['push'](_0x534475['shift']());}};_0x58dcbb(++_0x47dfcd);}(_0xcad4,0x12e));var _0x4cad=function(_0x340a9c,_0xa611a0){_0x340a9c=_0x340a9c-0x0;var _0x3e0fa3=_0xcad4[_0x340a9c];return _0x3e0fa3;};'use strict';var Sequelize=require(_0x4cad('0x0'));module[_0x4cad('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4cad('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4cad('0x3')]}}; \ No newline at end of file +var _0x7a18=['STRING','name','exports'];(function(_0x52008f,_0x8da628){var _0x341e5d=function(_0x165a3f){while(--_0x165a3f){_0x52008f['push'](_0x52008f['shift']());}};_0x341e5d(++_0x8da628);}(_0x7a18,0x86));var _0x87a1=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x7a18[_0x506d2f];return _0x101255;};'use strict';var Sequelize=require('sequelize');module[_0x87a1('0x0')]={'name':{'type':Sequelize[_0x87a1('0x1')],'unique':_0x87a1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x87a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c624733..cace5f1 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 _0x12d8=['fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','Pauses','UserProfileResource','sendStatus','error','stack','name','map','Pause'];(function(_0x5ec3c5,_0x45162c){var _0x152273=function(_0x1a0395){while(--_0x1a0395){_0x5ec3c5['push'](_0x5ec3c5['shift']());}};_0x152273(++_0x45162c);}(_0x12d8,0x1b2));var _0x812d=function(_0x63da39,_0x3b5682){_0x63da39=_0x63da39-0x0;var _0x5d517e=_0x12d8[_0x63da39];return _0x5d517e;};'use strict';var emlformat=require(_0x812d('0x0'));var rimraf=require(_0x812d('0x1'));var zipdir=require(_0x812d('0x2'));var jsonpatch=require(_0x812d('0x3'));var rp=require(_0x812d('0x4'));var moment=require(_0x812d('0x5'));var BPromise=require(_0x812d('0x6'));var Mustache=require(_0x812d('0x7'));var util=require(_0x812d('0x8'));var path=require('path');var sox=require(_0x812d('0x9'));var csv=require(_0x812d('0xa'));var ejs=require(_0x812d('0xb'));var fs=require('fs');var fs_extra=require(_0x812d('0xc'));var _=require('lodash');var squel=require(_0x812d('0xd'));var crypto=require('crypto');var jsforce=require(_0x812d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x812d('0xf'));var Papa=require(_0x812d('0x10'));var Redis=require(_0x812d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x812d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x812d('0x13'));var logger=require(_0x812d('0x14'))(_0x812d('0x15'));var utils=require('../../config/utils');var config=require(_0x812d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x812d('0x17'))['db'];function respondWithStatusCode(_0x538ed3,_0x13c8ff){_0x13c8ff=_0x13c8ff||0xcc;return function(_0x48e8c9){if(_0x48e8c9){return _0x538ed3['sendStatus'](_0x13c8ff);}return _0x538ed3['status'](_0x13c8ff)[_0x812d('0x18')]();};}function respondWithResult(_0x4073a4,_0x19059a){_0x19059a=_0x19059a||0xc8;return function(_0x414d15){if(_0x414d15){return _0x4073a4[_0x812d('0x19')](_0x19059a)[_0x812d('0x1a')](_0x414d15);}};}function respondWithFilteredResult(_0x16d6db,_0x3d84ea){return function(_0x1e672c){if(_0x1e672c){var _0x369849=typeof _0x3d84ea[_0x812d('0x1b')]==='undefined'&&typeof _0x3d84ea[_0x812d('0x1c')]===_0x812d('0x1d');var _0x4e9e37=_0x1e672c['count'];var _0x29a698=_0x369849?0x0:_0x3d84ea[_0x812d('0x1b')];var _0x219d71=_0x369849?_0x1e672c[_0x812d('0x1e')]:_0x3d84ea[_0x812d('0x1b')]+_0x3d84ea[_0x812d('0x1c')];var _0x1bac29;if(_0x219d71>=_0x4e9e37){_0x219d71=_0x4e9e37;_0x1bac29=0xc8;}else{_0x1bac29=0xce;}_0x16d6db[_0x812d('0x19')](_0x1bac29);return _0x16d6db[_0x812d('0x1f')](_0x812d('0x20'),_0x29a698+'-'+_0x219d71+'/'+_0x4e9e37)[_0x812d('0x1a')](_0x1e672c);}return null;};}function patchUpdates(_0x570e9c){return function(_0x1ad6c2){try{jsonpatch[_0x812d('0x21')](_0x1ad6c2,_0x570e9c,!![]);}catch(_0x1ad8e4){return BPromise[_0x812d('0x22')](_0x1ad8e4);}return _0x1ad6c2[_0x812d('0x23')]();};}function saveUpdates(_0x52bb29,_0x37ebc0){return function(_0x1c6cd2){if(_0x1c6cd2){return _0x1c6cd2[_0x812d('0x24')](_0x52bb29)[_0x812d('0x25')](function(_0x45946c){return _0x45946c;});}return null;};}function removeEntity(_0x10bb9f,_0x14a82a){return function(_0x5e5df3){if(_0x5e5df3){return _0x5e5df3['destroy']()[_0x812d('0x25')](function(){var _0x55ef8d=_0x5e5df3['get']({'plain':!![]});var _0x3e09f2=_0x812d('0x26');return db[_0x812d('0x27')]['destroy']({'where':{'type':_0x3e09f2,'resourceId':_0x55ef8d['id']}})[_0x812d('0x25')](function(){return _0x5e5df3;});})[_0x812d('0x25')](function(){_0x10bb9f['status'](0xcc)[_0x812d('0x18')]();});}};}function handleEntityNotFound(_0x3d9ed0,_0x435823){return function(_0x3bdc4d){if(!_0x3bdc4d){_0x3d9ed0[_0x812d('0x28')](0x194);}return _0x3bdc4d;};}function handleError(_0x149b5b,_0x519984){_0x519984=_0x519984||0x1f4;return function(_0xe28801){logger[_0x812d('0x29')](_0xe28801[_0x812d('0x2a')]);if(_0xe28801['name']){delete _0xe28801[_0x812d('0x2b')];}_0x149b5b[_0x812d('0x19')](_0x519984)['send'](_0xe28801);};}exports['index']=function(_0x3f0383,_0x1ecbbb){var _0x3c3c89={},_0xb75860={},_0x1e19cc={'count':0x0,'rows':[]};var _0x4aa05d=_[_0x812d('0x2c')](db[_0x812d('0x2d')]['rawAttributes'],function(_0x486b34){return{'name':_0x486b34[_0x812d('0x2e')],'type':_0x486b34[_0x812d('0x2f')]['key']};});_0xb75860[_0x812d('0x30')]=_[_0x812d('0x2c')](_0x4aa05d,_0x812d('0x2b'));_0xb75860[_0x812d('0x31')]=_[_0x812d('0x32')](_0x3f0383[_0x812d('0x31')]);_0xb75860[_0x812d('0x33')]=_['intersection'](_0xb75860[_0x812d('0x30')],_0xb75860[_0x812d('0x31')]);_0x3c3c89[_0x812d('0x34')]=_['intersection'](_0xb75860['model'],qs['fields'](_0x3f0383[_0x812d('0x31')][_0x812d('0x35')]));_0x3c3c89[_0x812d('0x34')]=_0x3c3c89[_0x812d('0x34')][_0x812d('0x36')]?_0x3c3c89[_0x812d('0x34')]:_0xb75860['model'];if(!_0x3f0383[_0x812d('0x31')][_0x812d('0x37')](_0x812d('0x38'))){_0x3c3c89[_0x812d('0x1c')]=qs['limit'](_0x3f0383[_0x812d('0x31')][_0x812d('0x1c')]);_0x3c3c89[_0x812d('0x1b')]=qs['offset'](_0x3f0383[_0x812d('0x31')][_0x812d('0x1b')]);}_0x3c3c89[_0x812d('0x39')]=qs[_0x812d('0x3a')](_0x3f0383[_0x812d('0x31')]['sort']);_0x3c3c89[_0x812d('0x3b')]=qs['filters'](_[_0x812d('0x3c')](_0x3f0383['query'],_0xb75860[_0x812d('0x33')]),_0x4aa05d);if(_0x3f0383[_0x812d('0x31')][_0x812d('0x3d')]){_0x3c3c89[_0x812d('0x3b')]=_[_0x812d('0x3e')](_0x3c3c89['where'],{'$or':_['map'](_0x4aa05d,function(_0x4df549){if(_0x4df549[_0x812d('0x2f')]!=='VIRTUAL'){var _0x2300dd={};_0x2300dd[_0x4df549[_0x812d('0x2b')]]={'$like':'%'+_0x3f0383['query'][_0x812d('0x3d')]+'%'};return _0x2300dd;}})});}_0x3c3c89=_[_0x812d('0x3e')]({},_0x3c3c89,_0x3f0383[_0x812d('0x3f')]);var _0x4ce624={'where':_0x3c3c89[_0x812d('0x3b')]};return db['Pause'][_0x812d('0x1e')](_0x4ce624)[_0x812d('0x25')](function(_0x5b09b1){_0x1e19cc['count']=_0x5b09b1;if(_0x3f0383[_0x812d('0x31')][_0x812d('0x40')]){_0x3c3c89[_0x812d('0x41')]=[{'all':!![]}];}return db[_0x812d('0x2d')]['findAll'](_0x3c3c89);})[_0x812d('0x25')](function(_0x4641d0){_0x1e19cc['rows']=_0x4641d0;return _0x1e19cc;})[_0x812d('0x25')](respondWithFilteredResult(_0x1ecbbb,_0x3c3c89))[_0x812d('0x42')](handleError(_0x1ecbbb,null));};exports[_0x812d('0x43')]=function(_0x4997b6,_0xa8965d){var _0x305b49={'raw':!![],'where':{'id':_0x4997b6[_0x812d('0x44')]['id']}},_0x4c4665={};_0x4c4665['model']=_[_0x812d('0x32')](db[_0x812d('0x2d')][_0x812d('0x45')]);_0x4c4665[_0x812d('0x31')]=_[_0x812d('0x32')](_0x4997b6[_0x812d('0x31')]);_0x4c4665['filters']=_[_0x812d('0x46')](_0x4c4665[_0x812d('0x30')],_0x4c4665['query']);_0x305b49[_0x812d('0x34')]=_[_0x812d('0x46')](_0x4c4665[_0x812d('0x30')],qs[_0x812d('0x35')](_0x4997b6[_0x812d('0x31')][_0x812d('0x35')]));_0x305b49[_0x812d('0x34')]=_0x305b49['attributes'][_0x812d('0x36')]?_0x305b49['attributes']:_0x4c4665[_0x812d('0x30')];if(_0x4997b6[_0x812d('0x31')][_0x812d('0x40')]){_0x305b49[_0x812d('0x41')]=[{'all':!![]}];}_0x305b49=_[_0x812d('0x3e')]({},_0x305b49,_0x4997b6['options']);return db[_0x812d('0x2d')][_0x812d('0x47')](_0x305b49)[_0x812d('0x25')](handleEntityNotFound(_0xa8965d,null))[_0x812d('0x25')](respondWithResult(_0xa8965d,null))['catch'](handleError(_0xa8965d,null));};exports[_0x812d('0x48')]=function(_0x2e75c0,_0x31e316){return db[_0x812d('0x2d')][_0x812d('0x48')](_0x2e75c0[_0x812d('0x49')],{})['then'](function(_0x30674f){var _0x3c8df9=_0x2e75c0['user'][_0x812d('0x4a')]({'plain':!![]});if(!_0x3c8df9)throw new Error(_0x812d('0x4b'));if(_0x3c8df9[_0x812d('0x4c')]===_0x812d('0x4d')){var _0x2c2742=_0x30674f[_0x812d('0x4a')]({'plain':!![]});var _0x807004=_0x812d('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x807004,'userProfileId':_0x3c8df9[_0x812d('0x4e')]},'raw':!![]})[_0x812d('0x25')](function(_0x3816b1){if(_0x3816b1&&_0x3816b1['autoAssociation']===0x0){return db[_0x812d('0x27')][_0x812d('0x48')]({'name':_0x2c2742[_0x812d('0x2b')],'resourceId':_0x2c2742['id'],'type':_0x3816b1[_0x812d('0x2b')],'sectionId':_0x3816b1['id']},{})[_0x812d('0x25')](function(){return _0x30674f;});}else{return _0x30674f;}})['catch'](function(_0xaaf1de){logger[_0x812d('0x29')](_0x812d('0x4f'),_0xaaf1de);throw _0xaaf1de;});}return _0x30674f;})[_0x812d('0x25')](respondWithResult(_0x31e316,0xc9))[_0x812d('0x42')](handleError(_0x31e316,null));};exports[_0x812d('0x24')]=function(_0x4a2429,_0x5e3717){if(_0x4a2429[_0x812d('0x49')]['id']){delete _0x4a2429[_0x812d('0x49')]['id'];}return db[_0x812d('0x2d')]['find']({'where':{'id':_0x4a2429['params']['id']}})[_0x812d('0x25')](handleEntityNotFound(_0x5e3717,null))[_0x812d('0x25')](saveUpdates(_0x4a2429[_0x812d('0x49')],null))[_0x812d('0x25')](respondWithResult(_0x5e3717,null))[_0x812d('0x42')](handleError(_0x5e3717,null));};exports['destroy']=function(_0x4f5f8c,_0x53b18e){return db[_0x812d('0x2d')]['find']({'where':{'id':_0x4f5f8c[_0x812d('0x44')]['id']}})[_0x812d('0x25')](handleEntityNotFound(_0x53b18e,null))[_0x812d('0x25')](removeEntity(_0x53b18e,null))[_0x812d('0x42')](handleError(_0x53b18e,null));}; \ No newline at end of file +var _0x1201=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x441948,_0x41a46c){var _0x1af0ad=function(_0x158f80){while(--_0x158f80){_0x441948['push'](_0x441948['shift']());}};_0x1af0ad(++_0x41a46c);}(_0x1201,0x11f));var _0x1120=function(_0x48a836,_0xa1d010){_0x48a836=_0x48a836-0x0;var _0x249dc8=_0x1201[_0x48a836];return _0x249dc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1120('0x0'));var zipdir=require(_0x1120('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1120('0x2'));var Mustache=require(_0x1120('0x3'));var util=require(_0x1120('0x4'));var path=require('path');var sox=require(_0x1120('0x5'));var csv=require(_0x1120('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1120('0x7'));var _=require(_0x1120('0x8'));var squel=require('squel');var crypto=require(_0x1120('0x9'));var jsforce=require(_0x1120('0xa'));var deskjs=require(_0x1120('0xb'));var toCsv=require(_0x1120('0x6'));var querystring=require('querystring');var Papa=require(_0x1120('0xc'));var Redis=require(_0x1120('0xd'));var authService=require(_0x1120('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1120('0xf'));var hardwareService=require(_0x1120('0x10'));var logger=require(_0x1120('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1120('0x12'));var db=require(_0x1120('0x13'))['db'];function respondWithStatusCode(_0x4a552f,_0x3be725){_0x3be725=_0x3be725||0xcc;return function(_0x4255b4){if(_0x4255b4){return _0x4a552f[_0x1120('0x14')](_0x3be725);}return _0x4a552f[_0x1120('0x15')](_0x3be725)[_0x1120('0x16')]();};}function respondWithResult(_0x208a57,_0x24704c){_0x24704c=_0x24704c||0xc8;return function(_0x3346da){if(_0x3346da){return _0x208a57[_0x1120('0x15')](_0x24704c)[_0x1120('0x17')](_0x3346da);}};}function respondWithFilteredResult(_0x2a4e5a,_0x19b497){return function(_0x412795){if(_0x412795){var _0x3317e0=typeof _0x19b497[_0x1120('0x18')]===_0x1120('0x19')&&typeof _0x19b497['limit']===_0x1120('0x19');var _0x151bd9=_0x412795[_0x1120('0x1a')];var _0x150d15=_0x3317e0?0x0:_0x19b497[_0x1120('0x18')];var _0x55db4b=_0x3317e0?_0x412795[_0x1120('0x1a')]:_0x19b497[_0x1120('0x18')]+_0x19b497[_0x1120('0x1b')];var _0x12fc51;if(_0x55db4b>=_0x151bd9){_0x55db4b=_0x151bd9;_0x12fc51=0xc8;}else{_0x12fc51=0xce;}_0x2a4e5a['status'](_0x12fc51);return _0x2a4e5a[_0x1120('0x1c')]('Content-Range',_0x150d15+'-'+_0x55db4b+'/'+_0x151bd9)['json'](_0x412795);}return null;};}function patchUpdates(_0x2d3f73){return function(_0x14cfdb){try{jsonpatch[_0x1120('0x1d')](_0x14cfdb,_0x2d3f73,!![]);}catch(_0x3892e1){return BPromise[_0x1120('0x1e')](_0x3892e1);}return _0x14cfdb['save']();};}function saveUpdates(_0x2c980a,_0xadb1fd){return function(_0x356652){if(_0x356652){return _0x356652[_0x1120('0x1f')](_0x2c980a)['then'](function(_0x36fee7){return _0x36fee7;});}return null;};}function removeEntity(_0x5bab6f,_0xae4f2c){return function(_0x14d71a){if(_0x14d71a){return _0x14d71a[_0x1120('0x20')]()[_0x1120('0x21')](function(){var _0x5bcea3=_0x14d71a[_0x1120('0x22')]({'plain':!![]});var _0x1996f1=_0x1120('0x23');return db[_0x1120('0x24')][_0x1120('0x20')]({'where':{'type':_0x1996f1,'resourceId':_0x5bcea3['id']}})[_0x1120('0x21')](function(){return _0x14d71a;});})[_0x1120('0x21')](function(){_0x5bab6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26711b,_0x5cb4ba){return function(_0x45a190){if(!_0x45a190){_0x26711b[_0x1120('0x14')](0x194);}return _0x45a190;};}function handleError(_0x1912b6,_0x4e53cf){_0x4e53cf=_0x4e53cf||0x1f4;return function(_0x36b93a){logger[_0x1120('0x25')](_0x36b93a['stack']);if(_0x36b93a['name']){delete _0x36b93a[_0x1120('0x26')];}_0x1912b6[_0x1120('0x15')](_0x4e53cf)[_0x1120('0x27')](_0x36b93a);};}exports[_0x1120('0x28')]=function(_0x54cf6a,_0xd7e10f){var _0xb80e5={},_0x117cde={},_0x5f574a={'count':0x0,'rows':[]};var _0xf21db4=_[_0x1120('0x29')](db[_0x1120('0x2a')][_0x1120('0x2b')],function(_0x17a4ab){return{'name':_0x17a4ab['fieldName'],'type':_0x17a4ab['type']['key']};});_0x117cde[_0x1120('0x2c')]=_['map'](_0xf21db4,_0x1120('0x26'));_0x117cde[_0x1120('0x2d')]=_[_0x1120('0x2e')](_0x54cf6a[_0x1120('0x2d')]);_0x117cde[_0x1120('0x2f')]=_[_0x1120('0x30')](_0x117cde[_0x1120('0x2c')],_0x117cde[_0x1120('0x2d')]);_0xb80e5['attributes']=_[_0x1120('0x30')](_0x117cde['model'],qs[_0x1120('0x31')](_0x54cf6a['query'][_0x1120('0x31')]));_0xb80e5[_0x1120('0x32')]=_0xb80e5[_0x1120('0x32')][_0x1120('0x33')]?_0xb80e5['attributes']:_0x117cde['model'];if(!_0x54cf6a[_0x1120('0x2d')][_0x1120('0x34')]('nolimit')){_0xb80e5[_0x1120('0x1b')]=qs[_0x1120('0x1b')](_0x54cf6a[_0x1120('0x2d')][_0x1120('0x1b')]);_0xb80e5['offset']=qs[_0x1120('0x18')](_0x54cf6a['query']['offset']);}_0xb80e5[_0x1120('0x35')]=qs[_0x1120('0x36')](_0x54cf6a[_0x1120('0x2d')][_0x1120('0x36')]);_0xb80e5[_0x1120('0x37')]=qs[_0x1120('0x2f')](_[_0x1120('0x38')](_0x54cf6a[_0x1120('0x2d')],_0x117cde[_0x1120('0x2f')]),_0xf21db4);if(_0x54cf6a[_0x1120('0x2d')]['filter']){_0xb80e5[_0x1120('0x37')]=_[_0x1120('0x39')](_0xb80e5[_0x1120('0x37')],{'$or':_[_0x1120('0x29')](_0xf21db4,function(_0x4829fb){if(_0x4829fb['type']!=='VIRTUAL'){var _0x3ea5ff={};_0x3ea5ff[_0x4829fb['name']]={'$like':'%'+_0x54cf6a[_0x1120('0x2d')]['filter']+'%'};return _0x3ea5ff;}})});}_0xb80e5=_[_0x1120('0x39')]({},_0xb80e5,_0x54cf6a[_0x1120('0x3a')]);var _0x5f2f3c={'where':_0xb80e5['where']};return db['Pause'][_0x1120('0x1a')](_0x5f2f3c)[_0x1120('0x21')](function(_0x3e1b2f){_0x5f574a['count']=_0x3e1b2f;if(_0x54cf6a[_0x1120('0x2d')][_0x1120('0x3b')]){_0xb80e5[_0x1120('0x3c')]=[{'all':!![]}];}return db[_0x1120('0x2a')][_0x1120('0x3d')](_0xb80e5);})['then'](function(_0x5211c6){_0x5f574a[_0x1120('0x3e')]=_0x5211c6;return _0x5f574a;})[_0x1120('0x21')](respondWithFilteredResult(_0xd7e10f,_0xb80e5))[_0x1120('0x3f')](handleError(_0xd7e10f,null));};exports[_0x1120('0x40')]=function(_0x47effb,_0x5b79f2){var _0x3a4d17={'raw':!![],'where':{'id':_0x47effb[_0x1120('0x41')]['id']}},_0x3491bc={};_0x3491bc[_0x1120('0x2c')]=_[_0x1120('0x2e')](db[_0x1120('0x2a')][_0x1120('0x2b')]);_0x3491bc[_0x1120('0x2d')]=_[_0x1120('0x2e')](_0x47effb[_0x1120('0x2d')]);_0x3491bc[_0x1120('0x2f')]=_['intersection'](_0x3491bc[_0x1120('0x2c')],_0x3491bc[_0x1120('0x2d')]);_0x3a4d17['attributes']=_['intersection'](_0x3491bc['model'],qs[_0x1120('0x31')](_0x47effb[_0x1120('0x2d')][_0x1120('0x31')]));_0x3a4d17[_0x1120('0x32')]=_0x3a4d17[_0x1120('0x32')]['length']?_0x3a4d17[_0x1120('0x32')]:_0x3491bc[_0x1120('0x2c')];if(_0x47effb[_0x1120('0x2d')][_0x1120('0x3b')]){_0x3a4d17[_0x1120('0x3c')]=[{'all':!![]}];}_0x3a4d17=_[_0x1120('0x39')]({},_0x3a4d17,_0x47effb[_0x1120('0x3a')]);return db[_0x1120('0x2a')][_0x1120('0x42')](_0x3a4d17)[_0x1120('0x21')](handleEntityNotFound(_0x5b79f2,null))[_0x1120('0x21')](respondWithResult(_0x5b79f2,null))['catch'](handleError(_0x5b79f2,null));};exports['create']=function(_0x25e9ef,_0x15eac9){return db['Pause']['create'](_0x25e9ef[_0x1120('0x43')],{})[_0x1120('0x21')](function(_0x152c7c){var _0x38fdba=_0x25e9ef[_0x1120('0x44')]['get']({'plain':!![]});if(!_0x38fdba)throw new Error(_0x1120('0x45'));if(_0x38fdba['role']==='user'){var _0x398df6=_0x152c7c[_0x1120('0x22')]({'plain':!![]});var _0x164923=_0x1120('0x23');return db[_0x1120('0x46')][_0x1120('0x42')]({'where':{'name':_0x164923,'userProfileId':_0x38fdba[_0x1120('0x47')]},'raw':!![]})[_0x1120('0x21')](function(_0x503bc7){if(_0x503bc7&&_0x503bc7[_0x1120('0x48')]===0x0){return db[_0x1120('0x24')][_0x1120('0x49')]({'name':_0x398df6[_0x1120('0x26')],'resourceId':_0x398df6['id'],'type':_0x503bc7[_0x1120('0x26')],'sectionId':_0x503bc7['id']},{})[_0x1120('0x21')](function(){return _0x152c7c;});}else{return _0x152c7c;}})[_0x1120('0x3f')](function(_0x2da9ad){logger[_0x1120('0x25')](_0x1120('0x4a'),_0x2da9ad);throw _0x2da9ad;});}return _0x152c7c;})[_0x1120('0x21')](respondWithResult(_0x15eac9,0xc9))[_0x1120('0x3f')](handleError(_0x15eac9,null));};exports[_0x1120('0x1f')]=function(_0x37bafb,_0x3aa108){if(_0x37bafb[_0x1120('0x43')]['id']){delete _0x37bafb[_0x1120('0x43')]['id'];}return db['Pause']['find']({'where':{'id':_0x37bafb[_0x1120('0x41')]['id']}})[_0x1120('0x21')](handleEntityNotFound(_0x3aa108,null))[_0x1120('0x21')](saveUpdates(_0x37bafb[_0x1120('0x43')],null))[_0x1120('0x21')](respondWithResult(_0x3aa108,null))[_0x1120('0x3f')](handleError(_0x3aa108,null));};exports['destroy']=function(_0x277ba2,_0x5711d3){return db['Pause']['find']({'where':{'id':_0x277ba2[_0x1120('0x41')]['id']}})[_0x1120('0x21')](handleEntityNotFound(_0x5711d3,null))[_0x1120('0x21')](removeEntity(_0x5711d3,null))[_0x1120('0x3f')](handleError(_0x5711d3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6a317bf..84131ce 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x550d45,_0x1664ab){var _0xbe20bd=function(_0x233f5f){while(--_0x233f5f){_0x550d45['push'](_0x550d45['shift']());}};_0xbe20bd(++_0x1664ab);}(_0xe14b,0x93));var _0xbe14=function(_0x5a8795,_0x462f13){_0x5a8795=_0x5a8795-0x0;var _0x140a4e=_0xe14b[_0x5a8795];return _0x140a4e;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x98a5e5,_0xa3c46b){var _0x5e1502=function(_0x14ba59){while(--_0x14ba59){_0x98a5e5['push'](_0x98a5e5['shift']());}};_0x5e1502(++_0xa3c46b);}(_0xf494,0x1c6));var _0x4f49=function(_0x694a,_0x157418){_0x694a=_0x694a-0x0;var _0x22f089=_0xf494[_0x694a];return _0x22f089;};'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')]('Pause',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 108356c..33b1f92 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x44bb36,_0x2802d2){var _0x108e11=function(_0x2c6021){while(--_0x2c6021){_0x44bb36['push'](_0x44bb36['shift']());}};_0x108e11(++_0x2802d2);}(_0x7a54,0x106));var _0x47a5=function(_0x64351c,_0x4c601e){_0x64351c=_0x64351c-0x0;var _0x4318a4=_0x7a54[_0x64351c];return _0x4318a4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1a3efe,_0x2ff877){var _0xf1a735=function(_0xb190a4){while(--_0xb190a4){_0x1a3efe['push'](_0x1a3efe['shift']());}};_0xf1a735(++_0x2ff877);}(_0x7a54,0x106));var _0x47a5=function(_0x50bc5e,_0x12e77e){_0x50bc5e=_0x50bc5e-0x0;var _0x25caa7=_0x7a54[_0x50bc5e];return _0x25caa7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 382a572..d857a4c 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 _0xed1f=['basename','originalname','now','extname','single','upload','post','webhookPost','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','server/files/plugins','replace','format'];(function(_0x299591,_0x16660d){var _0x4e8f12=function(_0x21f962){while(--_0x21f962){_0x299591['push'](_0x299591['shift']());}};_0x4e8f12(++_0x16660d);}(_0xed1f,0x6a));var _0xfed1=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xed1f[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),controller[_0xfed1('0xf')]);router[_0xfed1('0xb')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x10')]);router['get'](_0xfed1('0x11'),auth[_0xfed1('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xfed1('0x12')]({'destination':function(_0x48c338,_0x1c3f40,_0x234f4e){_0x234f4e(null,path['join'](config['root'],_0xfed1('0x13')));},'filename':function(_0xe84ba6,_0x569a6e,_0x17f4fe){_0x569a6e['originalname']=_0x569a6e['originalname'][_0xfed1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17f4fe(null,util[_0xfed1('0x15')]('%s-%s%s',path[_0xfed1('0x16')](_0x569a6e['originalname'],path['extname'](_0x569a6e[_0xfed1('0x17')])),Date[_0xfed1('0x18')](),path[_0xfed1('0x19')](_0x569a6e[_0xfed1('0x17')])));}})});router['post']('/',upload[_0xfed1('0x1a')]('file'),controller[_0xfed1('0x1b')]);router[_0xfed1('0x1c')]('/webhook',controller[_0xfed1('0x1d')]);router[_0xfed1('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfed1('0x1f')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0a9a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','webhookGet','/:id','show','download','root','originalname','replace','format','basename','extname','now','post','upload','/webhook','webhookPost','update','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x387f15,_0x40a6b8){var _0x335547=function(_0x33be87){while(--_0x33be87){_0x387f15['push'](_0x387f15['shift']());}};_0x335547(++_0x40a6b8);}(_0x0a9a,0x183));var _0xa0a9=function(_0x57c59a,_0x305cb7){_0x57c59a=_0x57c59a-0x0;var _0x2161b8=_0x0a9a[_0x57c59a];return _0x2161b8;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./plugin.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/webhook',controller[_0xa0a9('0xa')]);router['get'](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0x7')]('/:id/download',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5909cf,_0x13dc4a,_0x33f54f){_0x33f54f(null,path['join'](config[_0xa0a9('0xe')],'server/files/plugins'));},'filename':function(_0x1c39ff,_0x4b7913,_0xb87a94){_0x4b7913[_0xa0a9('0xf')]=_0x4b7913[_0xa0a9('0xf')][_0xa0a9('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb87a94(null,util[_0xa0a9('0x11')]('%s-%s%s',path[_0xa0a9('0x12')](_0x4b7913[_0xa0a9('0xf')],path[_0xa0a9('0x13')](_0x4b7913[_0xa0a9('0xf')])),Date[_0xa0a9('0x14')](),path[_0xa0a9('0x13')](_0x4b7913['originalname'])));}})});router[_0xa0a9('0x15')]('/',upload['single']('file'),controller[_0xa0a9('0x16')]);router[_0xa0a9('0x15')](_0xa0a9('0x17'),controller[_0xa0a9('0x18')]);router['put'](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x19')]);router[_0xa0a9('0x1a')](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller['delete']);module[_0xa0a9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8693db8..9d3c437 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 _0x9528=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x9528,0x84));var _0x8952=function(_0x3ef633,_0x5d92d2){_0x3ef633=_0x3ef633-0x0;var _0x3ecfd6=_0x9528[_0x3ef633];return _0x3ecfd6;};'use strict';var Sequelize=require(_0x8952('0x0'));module[_0x8952('0x1')]={'name':{'type':Sequelize[_0x8952('0x2')]},'type':{'type':Sequelize[_0x8952('0x3')](_0x8952('0x4'),_0x8952('0x5'))},'description':{'type':Sequelize[_0x8952('0x6')]},'version':{'type':Sequelize[_0x8952('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x8952('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x8952('0x3')](_0x8952('0x8'),_0x8952('0x9'),_0x8952('0xa'),_0x8952('0xb')),'defaultValue':_0x8952('0xa'),'comment':_0x8952('0xc')},'icon':{'type':Sequelize[_0x8952('0x2')]},'adminUrl':{'type':Sequelize[_0x8952('0x2')]},'agentUrl':{'type':Sequelize[_0x8952('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe2fe=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0xe2fe,0x179));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module[_0xee2f('0x1')]={'name':{'type':Sequelize[_0xee2f('0x2')]},'type':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4'),_0xee2f('0x5'))},'description':{'type':Sequelize[_0xee2f('0x6')]},'version':{'type':Sequelize[_0xee2f('0x6')]},'path':{'type':Sequelize[_0xee2f('0x2')],'comment':_0xee2f('0x7')},'active':{'type':Sequelize[_0xee2f('0x8')],'defaultValue':0x0,'comment':_0xee2f('0x9')},'sidebar':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0xa'),'agentOnly',_0xee2f('0xb'),'never'),'defaultValue':_0xee2f('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xee2f('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xee2f('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5a3b67b..23dc24e 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 _0x23cb=['Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20invalid\x20type','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','%s%s','headers','content-type','statusCode','webhookPost','encoding','content-length','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','Plugins','UserProfileResource','sendStatus','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','download','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','lstatSync'];(function(_0x4032d4,_0x3db57f){var _0x4763f4=function(_0x3e0264){while(--_0x3e0264){_0x4032d4['push'](_0x4032d4['shift']());}};_0x4763f4(++_0x3db57f);}(_0x23cb,0x180));var _0xb23c=function(_0x20a089,_0x158776){_0x20a089=_0x20a089-0x0;var _0x4521e9=_0x23cb[_0x20a089];return _0x4521e9;};'use strict';var emlformat=require(_0xb23c('0x0'));var rimraf=require(_0xb23c('0x1'));var zipdir=require(_0xb23c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb23c('0x3'));var moment=require(_0xb23c('0x4'));var BPromise=require(_0xb23c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb23c('0x6'));var sox=require(_0xb23c('0x7'));var csv=require(_0xb23c('0x8'));var ejs=require(_0xb23c('0x9'));var fs=require('fs');var fs_extra=require(_0xb23c('0xa'));var _=require('lodash');var squel=require(_0xb23c('0xb'));var crypto=require('crypto');var jsforce=require(_0xb23c('0xc'));var deskjs=require(_0xb23c('0xd'));var toCsv=require(_0xb23c('0x8'));var querystring=require(_0xb23c('0xe'));var Papa=require(_0xb23c('0xf'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xb23c('0x10'));var qs=require(_0xb23c('0x11'));var as=require(_0xb23c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb23c('0x13'))(_0xb23c('0x14'));var utils=require(_0xb23c('0x15'));var config=require(_0xb23c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb23c('0x17')]=_[_0xb23c('0x18')](config[_0xb23c('0x17')],{'host':_0xb23c('0x19'),'port':0x18eb});var socket=require(_0xb23c('0x1a'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x383b5b,_0x32238e){_0x32238e=_0x32238e||0xcc;return function(_0x712528){if(_0x712528){return _0x383b5b['sendStatus'](_0x32238e);}return _0x383b5b[_0xb23c('0x1b')](_0x32238e)[_0xb23c('0x1c')]();};}function respondWithResult(_0x285758,_0x239cdc){_0x239cdc=_0x239cdc||0xc8;return function(_0x5b7625){if(_0x5b7625){return _0x285758[_0xb23c('0x1b')](_0x239cdc)[_0xb23c('0x1d')](_0x5b7625);}};}function respondWithFilteredResult(_0x4eb741,_0x494f61){return function(_0x110f56){if(_0x110f56){var _0x1ed3a3=typeof _0x494f61[_0xb23c('0x1e')]==='undefined'&&typeof _0x494f61[_0xb23c('0x1f')]==='undefined';var _0xffddca=_0x110f56['count'];var _0x3e1c62=_0x1ed3a3?0x0:_0x494f61[_0xb23c('0x1e')];var _0x27b755=_0x1ed3a3?_0x110f56[_0xb23c('0x20')]:_0x494f61[_0xb23c('0x1e')]+_0x494f61[_0xb23c('0x1f')];var _0x390172;if(_0x27b755>=_0xffddca){_0x27b755=_0xffddca;_0x390172=0xc8;}else{_0x390172=0xce;}_0x4eb741[_0xb23c('0x1b')](_0x390172);return _0x4eb741[_0xb23c('0x21')](_0xb23c('0x22'),_0x3e1c62+'-'+_0x27b755+'/'+_0xffddca)[_0xb23c('0x1d')](_0x110f56);}return null;};}function patchUpdates(_0x2a7fa8){return function(_0x2560f8){try{jsonpatch[_0xb23c('0x23')](_0x2560f8,_0x2a7fa8,!![]);}catch(_0x3d8a45){return BPromise[_0xb23c('0x24')](_0x3d8a45);}return _0x2560f8['save']();};}function saveUpdates(_0x4b598f,_0x2bf8a8){return function(_0x40f1a7){if(_0x40f1a7){return _0x40f1a7['update'](_0x4b598f)[_0xb23c('0x25')](function(_0x45e49a){return _0x45e49a;});}return null;};}function removeEntity(_0x4b5979,_0x902107){return function(_0x4f819c){if(_0x4f819c){return _0x4f819c[_0xb23c('0x26')]()[_0xb23c('0x25')](function(){var _0x5331bd=_0x4f819c['get']({'plain':!![]});var _0xe0e775=_0xb23c('0x27');return db[_0xb23c('0x28')]['destroy']({'where':{'type':_0xe0e775,'resourceId':_0x5331bd['id']}})[_0xb23c('0x25')](function(){return _0x4f819c;});})[_0xb23c('0x25')](function(){_0x4b5979[_0xb23c('0x1b')](0xcc)[_0xb23c('0x1c')]();});}};}function handleEntityNotFound(_0x516ce7,_0x4c9ab0){return function(_0x115dfe){if(!_0x115dfe){_0x516ce7[_0xb23c('0x29')](0x194);}return _0x115dfe;};}function handleError(_0x524266,_0xb7f239){_0xb7f239=_0xb7f239||0x1f4;return function(_0x52aab5){logger[_0xb23c('0x2a')](_0x52aab5[_0xb23c('0x2b')]);if(_0x52aab5[_0xb23c('0x2c')]){delete _0x52aab5['name'];}_0x524266['status'](_0xb7f239)['send'](_0x52aab5);};}exports[_0xb23c('0x2d')]=function(_0x387335,_0x9b8acd){var _0x567842={},_0x654989={},_0x1eedd8={'count':0x0,'rows':[]};var _0x25bcb4=_[_0xb23c('0x2e')](db[_0xb23c('0x2f')][_0xb23c('0x30')],function(_0x21b945){return{'name':_0x21b945[_0xb23c('0x31')],'type':_0x21b945[_0xb23c('0x32')][_0xb23c('0x33')]};});_0x654989[_0xb23c('0x34')]=_[_0xb23c('0x2e')](_0x25bcb4,_0xb23c('0x2c'));_0x654989[_0xb23c('0x35')]=_['keys'](_0x387335[_0xb23c('0x35')]);_0x654989[_0xb23c('0x36')]=_[_0xb23c('0x37')](_0x654989[_0xb23c('0x34')],_0x654989['query']);_0x567842[_0xb23c('0x38')]=_[_0xb23c('0x37')](_0x654989['model'],qs[_0xb23c('0x39')](_0x387335[_0xb23c('0x35')][_0xb23c('0x39')]));_0x567842[_0xb23c('0x38')]=_0x567842[_0xb23c('0x38')][_0xb23c('0x3a')]?_0x567842['attributes']:_0x654989[_0xb23c('0x34')];if(!_0x387335[_0xb23c('0x35')][_0xb23c('0x3b')]('nolimit')){_0x567842[_0xb23c('0x1f')]=qs[_0xb23c('0x1f')](_0x387335['query'][_0xb23c('0x1f')]);_0x567842['offset']=qs['offset'](_0x387335[_0xb23c('0x35')][_0xb23c('0x1e')]);}_0x567842['order']=qs['sort'](_0x387335[_0xb23c('0x35')][_0xb23c('0x3c')]);_0x567842[_0xb23c('0x3d')]=qs[_0xb23c('0x36')](_['pick'](_0x387335['query'],_0x654989['filters']),_0x25bcb4);if(_0x387335[_0xb23c('0x35')][_0xb23c('0x3e')]){_0x567842[_0xb23c('0x3d')]=_[_0xb23c('0x3f')](_0x567842[_0xb23c('0x3d')],{'$or':_[_0xb23c('0x2e')](_0x25bcb4,function(_0x4cfb8d){if(_0x4cfb8d[_0xb23c('0x32')]!==_0xb23c('0x40')){var _0xd4fa6e={};_0xd4fa6e[_0x4cfb8d['name']]={'$like':'%'+_0x387335[_0xb23c('0x35')][_0xb23c('0x3e')]+'%'};return _0xd4fa6e;}})});}_0x567842=_[_0xb23c('0x3f')]({},_0x567842,_0x387335[_0xb23c('0x41')]);var _0x35416e={'where':_0x567842[_0xb23c('0x3d')]};return db[_0xb23c('0x2f')][_0xb23c('0x20')](_0x35416e)[_0xb23c('0x25')](function(_0x362a4d){_0x1eedd8[_0xb23c('0x20')]=_0x362a4d;if(_0x387335[_0xb23c('0x35')][_0xb23c('0x42')]){_0x567842[_0xb23c('0x43')]=[{'all':!![]}];}return db[_0xb23c('0x2f')]['findAll'](_0x567842);})['then'](function(_0x2a580e){_0x1eedd8[_0xb23c('0x44')]=_0x2a580e;return _0x1eedd8;})[_0xb23c('0x25')](respondWithFilteredResult(_0x9b8acd,_0x567842))[_0xb23c('0x45')](handleError(_0x9b8acd,null));};exports[_0xb23c('0x46')]=function(_0x4ea493,_0x5453c1){var _0x472727={'raw':!![],'where':{'id':_0x4ea493[_0xb23c('0x47')]['id']}},_0x43e14c={};_0x43e14c[_0xb23c('0x34')]=_[_0xb23c('0x48')](db['Plugin'][_0xb23c('0x30')]);_0x43e14c[_0xb23c('0x35')]=_[_0xb23c('0x48')](_0x4ea493[_0xb23c('0x35')]);_0x43e14c[_0xb23c('0x36')]=_[_0xb23c('0x37')](_0x43e14c['model'],_0x43e14c[_0xb23c('0x35')]);_0x472727['attributes']=_[_0xb23c('0x37')](_0x43e14c[_0xb23c('0x34')],qs[_0xb23c('0x39')](_0x4ea493[_0xb23c('0x35')]['fields']));_0x472727[_0xb23c('0x38')]=_0x472727['attributes'][_0xb23c('0x3a')]?_0x472727[_0xb23c('0x38')]:_0x43e14c['model'];if(_0x4ea493[_0xb23c('0x35')][_0xb23c('0x42')]){_0x472727['include']=[{'all':!![]}];}_0x472727=_['merge']({},_0x472727,_0x4ea493[_0xb23c('0x41')]);return db[_0xb23c('0x2f')][_0xb23c('0x49')](_0x472727)[_0xb23c('0x25')](handleEntityNotFound(_0x5453c1,null))[_0xb23c('0x25')](respondWithResult(_0x5453c1,null))[_0xb23c('0x45')](handleError(_0x5453c1,null));};exports[_0xb23c('0x4a')]=function(_0xbb22b4,_0x5332d5,_0xd262d3){return db[_0xb23c('0x2f')][_0xb23c('0x49')]({'where':{'id':_0xbb22b4[_0xb23c('0x47')]['id']},'attributes':[_0xb23c('0x2c'),_0xb23c('0x6')],'raw':!![]})[_0xb23c('0x25')](handleEntityNotFound(_0x5332d5,null))[_0xb23c('0x25')](function(_0x4ab537){if(_0x4ab537){var _0x2a8eab=path['join'](config[_0xb23c('0x4b')],_0xb23c('0x4c'),util[_0xb23c('0x4d')](_0xb23c('0x4e'),path[_0xb23c('0x4f')](_0x4ab537[_0xb23c('0x6')])));var _0xb546cf=fs['createWriteStream'](_0x2a8eab);var _0x56e177=archiver(_0xb23c('0x50'),{'zlib':{'level':0x9}});_0x56e177['on'](_0xb23c('0x51'),function(_0x29a573){if(_0x29a573[_0xb23c('0x52')]==='ENOENT'){logger[_0xb23c('0x2a')](_0x29a573);}else{throw new db[(_0xb23c('0x53'))][(_0xb23c('0x54'))](_0xb23c('0x55'));}});_0x56e177['on']('error',function(_0x283306){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x56e177[_0xb23c('0x56')](_0xb546cf);_0x56e177[_0xb23c('0x57')](_0xb23c('0x58'),{'cwd':path[_0xb23c('0x59')](config[_0xb23c('0x4b')],_0xb23c('0x4c'),path[_0xb23c('0x5a')](_0x4ab537[_0xb23c('0x6')])),'ignore':[path[_0xb23c('0x59')](path[_0xb23c('0x4f')](_0x4ab537[_0xb23c('0x6')]),_0xb23c('0x5b')),path[_0xb23c('0x59')](path['basename'](_0x4ab537[_0xb23c('0x6')]),_0xb23c('0x5c'))],'nodir':!![]})[_0xb23c('0x5d')]();_0xb546cf['on'](_0xb23c('0x5e'),function(){if(!fs['existsSync'](_0x2a8eab)){throw new db['Sequelize'][(_0xb23c('0x54'))](_0xb23c('0x5f'));}return _0x5332d5[_0xb23c('0x4a')](_0x2a8eab,util['format'](_0xb23c('0x4e'),path[_0xb23c('0x4f')](_0x4ab537[_0xb23c('0x6')])),function(_0x2afa55){if(_0x2afa55){throw new db['Sequelize'][(_0xb23c('0x54'))](_0xb23c('0x60'));}fs[_0xb23c('0x61')](_0x2a8eab);logger[_0xb23c('0x62')](_0xb23c('0x63'));logger[_0xb23c('0x62')](_0xb23c('0x64'));});});}return null;})[_0xb23c('0x45')](handleError(_0x5332d5,null));};exports['upload']=function(_0x4d3893,_0x4fd884,_0x2778b4){var _0x1275d5=path[_0xb23c('0x4f')](_0x4d3893[_0xb23c('0x65')][_0xb23c('0x66')],path[_0xb23c('0x67')](_0x4d3893[_0xb23c('0x65')][_0xb23c('0x66')]));var _0x5c512b=path[_0xb23c('0x59')](config[_0xb23c('0x4b')],'server/files/plugins',_0x4d3893[_0xb23c('0x65')][_0xb23c('0x66')]);var _0x28f6f9=path[_0xb23c('0x59')](config['root'],'server/files/plugins',_0x1275d5);logger[_0xb23c('0x62')](_0xb23c('0x68'),_0x5c512b);logger['info'](_0xb23c('0x69'),_0x28f6f9);try{fs[_0xb23c('0x6a')](_0x5c512b,parseInt('0777',0x8));extract(_0x5c512b,{'dir':_0x28f6f9},function(_0x14ed47){if(_0x14ed47){logger[_0xb23c('0x2a')](_0x14ed47);handleError(_0x14ed47,!![]);};var _0x79455e=fs['readdirSync'](_0x28f6f9);if(_0x79455e[_0xb23c('0x3a')]>0x1){removeReferences(_0x5c512b,_0x28f6f9);logger['error']('Invalid\x20plugin\x20structure');return _0x2778b4(new Error('Invalid\x20plugin\x20structure'));}var _0x5c4ce2=fs[_0xb23c('0x6b')](path['join'](_0x28f6f9,_0x79455e[0x0]));if(_0x5c4ce2['isFile']()){removeReferences(_0x5c512b,_0x28f6f9);logger[_0xb23c('0x2a')](_0xb23c('0x6c'));return _0x2778b4(new Error(_0xb23c('0x6c')));}if(_0x5c4ce2[_0xb23c('0x6d')]()){var _0x30db34=fs[_0xb23c('0x6e')](path[_0xb23c('0x59')](_0x28f6f9,_0x79455e[0x0]));if(_0x30db34[_0xb23c('0x3a')]===0x0){removeReferences(_0x5c512b,_0x28f6f9);logger[_0xb23c('0x2a')]('Invalid\x20plugin\x20structure');return _0x2778b4(new Error('Invalid\x20plugin\x20structure'));}var _0x5687f3=_0x30db34[_0xb23c('0x6f')](function(_0x58c036){return _0x58c036==='manifest.json';});if(!_0x5687f3){return _0x2778b4(new Error(_0xb23c('0x70')));}var _0xe23a5b=fs[_0xb23c('0x71')](path[_0xb23c('0x59')](_0x28f6f9,_0x79455e[0x0],_0xb23c('0x72')));var _0xa747a5=JSON['parse'](_0xe23a5b);if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x2c')]){return _0x2778b4(new Error(_0xb23c('0x74')));}if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x32')]){return _0x2778b4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x75')]){return _0x2778b4(new Error(_0xb23c('0x76')));}if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x77')]){return _0x2778b4(new Error(_0xb23c('0x78')));}if(_0xa747a5['type']===_0xb23c('0x79')){if('undefined'==typeof _0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')]){return _0x2778b4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x77')]['views'][_0xb23c('0x7b')]&&'undefined'==typeof _0xa747a5[_0xb23c('0x77')]['views'][_0xb23c('0x7c')]){return _0x2778b4(new Error(_0xb23c('0x7d')));}}else if(_0xa747a5[_0xb23c('0x32')]===_0xb23c('0x7e')){if(_0xb23c('0x73')==typeof _0xa747a5['parameters'][_0xb23c('0x7f')]){return _0x2778b4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb23c('0x73')==typeof _0xa747a5[_0xb23c('0x77')]['scriptPath']){return _0x2778b4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2778b4(new Error(_0xb23c('0x80')));}var _0x580c09=_0xa747a5[_0xb23c('0x2c')];var _0x1c1120=_0xa747a5['description'];var _0x16819a=_0xa747a5[_0xb23c('0x32')];var _0x368d48=_0xa747a5['sidebar']?_0xa747a5['sidebar']:_0xb23c('0x81');var _0x8f793=_0xa747a5[_0xb23c('0x82')]?_0xa747a5[_0xb23c('0x82')]:_0xb23c('0x83');var _0x43679a='';var _0x260dc0='';var _0x1c00e6='';var _0x52756a='';var _0x15a904=_0xa747a5['version'];if(_0x16819a===_0xb23c('0x79')){if('undefined'!=typeof _0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')][_0xb23c('0x7b')]){var _0x24461c=_0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')][_0xb23c('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x84')](_0x24461c)){_0x43679a=path['join'](_0xb23c('0x85'),_0x1275d5,_0x79455e[0x0],_0x24461c);}else{_0x43679a=_0x24461c;}}else{logger[_0xb23c('0x62')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb23c('0x73')!=typeof _0xa747a5['parameters'][_0xb23c('0x7a')][_0xb23c('0x7c')]){var _0x812deb=_0xa747a5[_0xb23c('0x77')]['views'][_0xb23c('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x84')](_0x812deb)){_0x260dc0=path[_0xb23c('0x59')](_0xb23c('0x85'),_0x1275d5,_0x79455e[0x0],_0x812deb);}else{_0x260dc0=_0x812deb;}}else{logger[_0xb23c('0x62')](_0xb23c('0x86'));}}else if(_0x16819a===_0xb23c('0x7e')){_0x1c00e6=_0xa747a5['parameters'][_0xb23c('0x7f')];_0x52756a=_0xa747a5['parameters'][_0xb23c('0x87')];if('undefined'!=typeof _0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')]){if(_0xb23c('0x73')!=typeof _0xa747a5[_0xb23c('0x77')]['views'][_0xb23c('0x7b')]){var _0x24461c=_0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')][_0xb23c('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x84')](_0x24461c)){_0x43679a=path[_0xb23c('0x59')](_0xb23c('0x85'),_0x1275d5,_0x79455e[0x0],_0x24461c);}else{_0x43679a=_0x24461c;}}if('undefined'!=typeof _0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')][_0xb23c('0x7c')]){var _0x812deb=_0xa747a5[_0xb23c('0x77')][_0xb23c('0x7a')][_0xb23c('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xb23c('0x84')](_0x812deb)){_0x260dc0=path[_0xb23c('0x59')](_0xb23c('0x85'),_0x1275d5,_0x79455e[0x0],_0x812deb);}else{_0x260dc0=_0x812deb;}}}}var _0x215f3d={'name':_0x580c09,'description':_0x1c1120,'path':path[_0xb23c('0x59')](_0x1275d5,_0x79455e[0x0]),'type':_0x16819a,'sidebar':_0x368d48,'icon':_0x8f793,'adminUrl':_0x43679a,'agentUrl':_0x260dc0,'scriptName':_0x1c00e6,'scriptPath':_0x52756a,'version':_0x15a904};removeReferences(_0x5c512b,null);return db[_0xb23c('0x2f')]['create'](_0x215f3d)[_0xb23c('0x25')](function(_0x598ce8){var _0x30d98c={'role':_0x4d3893[_0xb23c('0x88')][_0xb23c('0x89')],'userProfileId':_0x4d3893[_0xb23c('0x88')][_0xb23c('0x8a')]};if(!_0x30d98c)throw new Error(_0xb23c('0x8b'));if(_0x30d98c[_0xb23c('0x89')]===_0xb23c('0x8c')){var _0x48924c=_0x598ce8[_0xb23c('0x8d')]({'plain':!![]});return db[_0xb23c('0x8e')][_0xb23c('0x49')]({'where':{'name':_0xb23c('0x27'),'userProfileId':_0x30d98c[_0xb23c('0x8a')]},'raw':!![]})[_0xb23c('0x25')](function(_0x8902f2){if(_0x8902f2&&_0x8902f2['autoAssociation']===0x0){return db[_0xb23c('0x28')][_0xb23c('0x8f')]({'name':_0x48924c[_0xb23c('0x2c')],'resourceId':_0x48924c['id'],'type':_0x8902f2[_0xb23c('0x2c')],'sectionId':_0x8902f2['id']},{})[_0xb23c('0x25')](function(){return _0x598ce8;});}else{return _0x598ce8;}})['catch'](function(_0x24b3a1){logger[_0xb23c('0x2a')](_0xb23c('0x90'),_0x24b3a1);throw _0x24b3a1;});}return _0x598ce8;})[_0xb23c('0x25')](respondWithResult(_0x4fd884,null))[_0xb23c('0x45')](handleError(_0x4fd884,null));}});}catch(_0x25be72){_0x4fd884[_0xb23c('0x1b')](0x1f4)[_0xb23c('0x91')](_0x25be72);}};function removeReferences(_0x2053f8,_0x5aeca5){try{if(_0x2053f8){fs[_0xb23c('0x61')](_0x2053f8);logger[_0xb23c('0x62')](_0xb23c('0x92'));}if(_0x5aeca5){rimraf(_0x5aeca5,function(){});logger[_0xb23c('0x62')]('Extracted\x20folder\x20removed');}}catch(_0x55da37){logger[_0xb23c('0x2a')](_0x55da37);}}exports[_0xb23c('0x93')]=function(_0x5e20c0,_0x364995,_0x17ef0c){return db[_0xb23c('0x2f')][_0xb23c('0x49')]({'where':{'id':_0x5e20c0[_0xb23c('0x47')]['id']}})[_0xb23c('0x25')](handleEntityNotFound(_0x364995,null))[_0xb23c('0x25')](saveUpdates(_0x5e20c0['body'],null))[_0xb23c('0x25')](respondWithResult(_0x364995,null))[_0xb23c('0x45')](handleError(_0x364995,null));};exports[_0xb23c('0x94')]=function(_0x31ed22,_0x414ce1,_0x448039){return db['Plugin']['find']({'where':{'id':_0x31ed22[_0xb23c('0x47')]['id']}})[_0xb23c('0x25')](function(_0x1956c2){if(_0x1956c2){return _0x1956c2['destroy']();}})['then'](function(_0xdd3437){rimraf(path[_0xb23c('0x59')](config[_0xb23c('0x4b')],_0xb23c('0x4c'),path['dirname'](_0xdd3437[_0xb23c('0x6')])),function(){});return _0xdd3437;})[_0xb23c('0x25')](handleEntityNotFound(_0x414ce1,null))[_0xb23c('0x25')](respondWithStatusCode(_0x414ce1,null))[_0xb23c('0x45')](handleError(_0x414ce1,null));};exports[_0xb23c('0x95')]=function(_0x3675db,_0x3b0812,_0x28e672){return BPromise[_0xb23c('0x96')]()[_0xb23c('0x25')](function(){if(!_0x3675db[_0xb23c('0x35')][_0xb23c('0x6')]){throw new Error(_0xb23c('0x97'));}if(!_0x3675db['query'][_0xb23c('0x98')]){throw new Error(_0xb23c('0x99'));}var _0x4a3fe6=_0x3675db['query'][_0xb23c('0x9a')]?_0x3675db['query']['hostname']+':'+_0x3675db['query'][_0xb23c('0x98')]:_0xb23c('0x9b')+_0x3675db[_0xb23c('0x35')][_0xb23c('0x98')];var _0x2869d5=_0x3675db[_0xb23c('0x35')][_0xb23c('0x1d')]?_0x3675db['query'][_0xb23c('0x1d')]:!![];var _0x187aaf=_0x3675db['query']['encoding']?_0x3675db['query']['encoding']:null;var _0x5c7fc5={'method':_0x3675db[_0xb23c('0x9c')],'uri':util[_0xb23c('0x4d')](_0xb23c('0x9d'),_0x4a3fe6,_0x3675db[_0xb23c('0x35')]['path']),'json':_0x2869d5,'resolveWithFullResponse':!![],'encoding':_0x187aaf,'qs':_0x3675db[_0xb23c('0x35')]};if(_0x3675db['headers']){_0x5c7fc5['headers']=_0x3675db['headers'];if(_0x5c7fc5[_0xb23c('0x9e')]['content-length']){delete _0x5c7fc5['headers']['content-length'];}}if(_0x5c7fc5[_0xb23c('0x9e')][_0xb23c('0x9f')]){delete _0x5c7fc5[_0xb23c('0x9e')]['content-type'];}return rp(_0x5c7fc5);})['then'](function(_0x2a1ae3){if(_0x2a1ae3){_0x3b0812[_0xb23c('0x21')](_0x2a1ae3['headers']);logger[_0xb23c('0x62')](_0x2a1ae3[_0xb23c('0x88')]);if(_['endsWith'](_0x3675db[_0xb23c('0x35')][_0xb23c('0x6')],'download')&&_0x2a1ae3[_0xb23c('0xa0')]==0x1f4){return _0x3b0812['sendStatus'](_0x2a1ae3[_0xb23c('0xa0')]);}else{return _0x3b0812[_0xb23c('0x1b')](_0x2a1ae3[_0xb23c('0xa0')])[_0xb23c('0x91')](_0x2a1ae3[_0xb23c('0x88')]);}}else{return _0x3b0812[_0xb23c('0x29')](0xc8);}})[_0xb23c('0x45')](handleError(_0x3b0812,null));};exports[_0xb23c('0xa1')]=function(_0x1024c5,_0x5734e4,_0x3ae2d9){return BPromise['resolve']()[_0xb23c('0x25')](function(){if(!_0x1024c5[_0xb23c('0x35')][_0xb23c('0x6')]){throw new Error(_0xb23c('0x97'));}if(!_0x1024c5[_0xb23c('0x35')][_0xb23c('0x98')]){throw new Error(_0xb23c('0x99'));}var _0x47b1d9=_0x1024c5[_0xb23c('0x35')][_0xb23c('0x9a')]?_0x1024c5['query'][_0xb23c('0x9a')]+':'+_0x1024c5[_0xb23c('0x35')]['port']:_0xb23c('0x9b')+_0x1024c5[_0xb23c('0x35')][_0xb23c('0x98')];var _0x30dd83=_0x1024c5[_0xb23c('0x35')][_0xb23c('0x1d')]?_0x1024c5[_0xb23c('0x35')][_0xb23c('0x1d')]:!![];var _0x53f3c7=_0x1024c5['query'][_0xb23c('0xa2')]?_0x1024c5[_0xb23c('0x35')][_0xb23c('0xa2')]:null;var _0x227f47={'method':_0x1024c5[_0xb23c('0x9c')],'uri':util[_0xb23c('0x4d')](_0xb23c('0x9d'),_0x47b1d9,_0x1024c5[_0xb23c('0x35')][_0xb23c('0x6')]),'json':_0x30dd83,'resolveWithFullResponse':!![],'encoding':_0x53f3c7,'body':_0x1024c5[_0xb23c('0x88')]};if(_0x1024c5[_0xb23c('0x9e')]){_0x227f47[_0xb23c('0x9e')]=_0x1024c5['headers'];if(_0x227f47[_0xb23c('0x9e')][_0xb23c('0xa3')]){delete _0x227f47[_0xb23c('0x9e')]['content-length'];}}if(_0x227f47['headers'][_0xb23c('0x9f')]){delete _0x227f47[_0xb23c('0x9e')]['content-type'];}return rp(_0x227f47);})[_0xb23c('0x25')](function(_0x4f6a13){if(_0x4f6a13){_0x5734e4['set'](_0x4f6a13[_0xb23c('0x9e')]);logger['info'](_0x4f6a13[_0xb23c('0x88')]);return _0x5734e4['status'](_0x4f6a13['statusCode'])[_0xb23c('0x91')](_0x4f6a13[_0xb23c('0x88')]);}else{return _0x5734e4[_0xb23c('0x29')](0xc8);}})[_0xb23c('0x45')](handleError(_0x5734e4,null));}; \ No newline at end of file +var _0x527e=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','download','find','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x527e,0x13d));var _0xe527=function(_0x1a6306,_0xeb7474){_0x1a6306=_0x1a6306-0x0;var _0x488a4d=_0x527e[_0x1a6306];return _0x488a4d;};'use strict';var emlformat=require(_0xe527('0x0'));var rimraf=require(_0xe527('0x1'));var zipdir=require(_0xe527('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe527('0x3'));var moment=require(_0xe527('0x4'));var BPromise=require(_0xe527('0x5'));var Mustache=require(_0xe527('0x6'));var util=require(_0xe527('0x7'));var path=require(_0xe527('0x8'));var sox=require(_0xe527('0x9'));var csv=require(_0xe527('0xa'));var ejs=require(_0xe527('0xb'));var fs=require('fs');var fs_extra=require(_0xe527('0xc'));var _=require('lodash');var squel=require(_0xe527('0xd'));var crypto=require('crypto');var jsforce=require(_0xe527('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe527('0xa'));var querystring=require('querystring');var Papa=require(_0xe527('0xf'));var extract=require(_0xe527('0x10'));var rimraf=require('rimraf');var archiver=require(_0xe527('0x11'));var Redis=require(_0xe527('0x12'));var authService=require(_0xe527('0x13'));var qs=require(_0xe527('0x14'));var as=require(_0xe527('0x15'));var hardwareService=require(_0xe527('0x16'));var logger=require(_0xe527('0x17'))(_0xe527('0x18'));var utils=require(_0xe527('0x19'));var config=require(_0xe527('0x1a'));var licenseUtil=require(_0xe527('0x1b'));var db=require(_0xe527('0x1c'))['db'];config[_0xe527('0x1d')]=_[_0xe527('0x1e')](config[_0xe527('0x1d')],{'host':_0xe527('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe527('0x1d')]));require(_0xe527('0x20'))['register'](socket);function respondWithStatusCode(_0x420893,_0x3a404c){_0x3a404c=_0x3a404c||0xcc;return function(_0x54c84e){if(_0x54c84e){return _0x420893[_0xe527('0x21')](_0x3a404c);}return _0x420893[_0xe527('0x22')](_0x3a404c)[_0xe527('0x23')]();};}function respondWithResult(_0x2150bc,_0x3e25bf){_0x3e25bf=_0x3e25bf||0xc8;return function(_0x5c573a){if(_0x5c573a){return _0x2150bc['status'](_0x3e25bf)[_0xe527('0x24')](_0x5c573a);}};}function respondWithFilteredResult(_0x3011ed,_0x5d90f1){return function(_0x5bbbd6){if(_0x5bbbd6){var _0x595416=typeof _0x5d90f1['offset']===_0xe527('0x25')&&typeof _0x5d90f1[_0xe527('0x26')]===_0xe527('0x25');var _0x2d3e05=_0x5bbbd6['count'];var _0x1538ed=_0x595416?0x0:_0x5d90f1['offset'];var _0x873f93=_0x595416?_0x5bbbd6[_0xe527('0x27')]:_0x5d90f1[_0xe527('0x28')]+_0x5d90f1[_0xe527('0x26')];var _0x3d8974;if(_0x873f93>=_0x2d3e05){_0x873f93=_0x2d3e05;_0x3d8974=0xc8;}else{_0x3d8974=0xce;}_0x3011ed[_0xe527('0x22')](_0x3d8974);return _0x3011ed['set'](_0xe527('0x29'),_0x1538ed+'-'+_0x873f93+'/'+_0x2d3e05)[_0xe527('0x24')](_0x5bbbd6);}return null;};}function patchUpdates(_0x53ab2a){return function(_0x1bed2c){try{jsonpatch['apply'](_0x1bed2c,_0x53ab2a,!![]);}catch(_0x5daf16){return BPromise[_0xe527('0x2a')](_0x5daf16);}return _0x1bed2c[_0xe527('0x2b')]();};}function saveUpdates(_0x10f672,_0x38958b){return function(_0x2e68ed){if(_0x2e68ed){return _0x2e68ed[_0xe527('0x2c')](_0x10f672)[_0xe527('0x2d')](function(_0x15cbfd){return _0x15cbfd;});}return null;};}function removeEntity(_0x48c4b3,_0x25371c){return function(_0x212242){if(_0x212242){return _0x212242[_0xe527('0x2e')]()[_0xe527('0x2d')](function(){var _0x3ea739=_0x212242[_0xe527('0x2f')]({'plain':!![]});var _0x329c54='Plugins';return db[_0xe527('0x30')][_0xe527('0x2e')]({'where':{'type':_0x329c54,'resourceId':_0x3ea739['id']}})[_0xe527('0x2d')](function(){return _0x212242;});})[_0xe527('0x2d')](function(){_0x48c4b3['status'](0xcc)[_0xe527('0x23')]();});}};}function handleEntityNotFound(_0xc3abc6,_0x36f811){return function(_0x4b21c2){if(!_0x4b21c2){_0xc3abc6['sendStatus'](0x194);}return _0x4b21c2;};}function handleError(_0x51fc4d,_0x21ceba){_0x21ceba=_0x21ceba||0x1f4;return function(_0x5bd351){logger[_0xe527('0x31')](_0x5bd351[_0xe527('0x32')]);if(_0x5bd351[_0xe527('0x33')]){delete _0x5bd351[_0xe527('0x33')];}_0x51fc4d[_0xe527('0x22')](_0x21ceba)[_0xe527('0x34')](_0x5bd351);};}exports[_0xe527('0x35')]=function(_0x156ad5,_0x259e0a){var _0xa79d2f={},_0x5d690a={},_0x23ed92={'count':0x0,'rows':[]};var _0x8f9b63=_['map'](db[_0xe527('0x36')][_0xe527('0x37')],function(_0xcf12a4){return{'name':_0xcf12a4[_0xe527('0x38')],'type':_0xcf12a4['type'][_0xe527('0x39')]};});_0x5d690a[_0xe527('0x3a')]=_[_0xe527('0x3b')](_0x8f9b63,_0xe527('0x33'));_0x5d690a[_0xe527('0x3c')]=_[_0xe527('0x3d')](_0x156ad5['query']);_0x5d690a[_0xe527('0x3e')]=_[_0xe527('0x3f')](_0x5d690a['model'],_0x5d690a[_0xe527('0x3c')]);_0xa79d2f['attributes']=_['intersection'](_0x5d690a[_0xe527('0x3a')],qs[_0xe527('0x40')](_0x156ad5[_0xe527('0x3c')][_0xe527('0x40')]));_0xa79d2f[_0xe527('0x41')]=_0xa79d2f[_0xe527('0x41')][_0xe527('0x42')]?_0xa79d2f[_0xe527('0x41')]:_0x5d690a[_0xe527('0x3a')];if(!_0x156ad5[_0xe527('0x3c')][_0xe527('0x43')](_0xe527('0x44'))){_0xa79d2f['limit']=qs[_0xe527('0x26')](_0x156ad5[_0xe527('0x3c')]['limit']);_0xa79d2f[_0xe527('0x28')]=qs[_0xe527('0x28')](_0x156ad5['query']['offset']);}_0xa79d2f[_0xe527('0x45')]=qs[_0xe527('0x46')](_0x156ad5[_0xe527('0x3c')][_0xe527('0x46')]);_0xa79d2f[_0xe527('0x47')]=qs[_0xe527('0x3e')](_[_0xe527('0x48')](_0x156ad5[_0xe527('0x3c')],_0x5d690a[_0xe527('0x3e')]),_0x8f9b63);if(_0x156ad5['query'][_0xe527('0x49')]){_0xa79d2f[_0xe527('0x47')]=_['merge'](_0xa79d2f[_0xe527('0x47')],{'$or':_[_0xe527('0x3b')](_0x8f9b63,function(_0x2702c5){if(_0x2702c5[_0xe527('0x4a')]!==_0xe527('0x4b')){var _0x171d3f={};_0x171d3f[_0x2702c5[_0xe527('0x33')]]={'$like':'%'+_0x156ad5[_0xe527('0x3c')][_0xe527('0x49')]+'%'};return _0x171d3f;}})});}_0xa79d2f=_[_0xe527('0x4c')]({},_0xa79d2f,_0x156ad5[_0xe527('0x4d')]);var _0x1a3281={'where':_0xa79d2f['where']};return db[_0xe527('0x36')][_0xe527('0x27')](_0x1a3281)[_0xe527('0x2d')](function(_0x212ecc){_0x23ed92['count']=_0x212ecc;if(_0x156ad5['query'][_0xe527('0x4e')]){_0xa79d2f[_0xe527('0x4f')]=[{'all':!![]}];}return db[_0xe527('0x36')][_0xe527('0x50')](_0xa79d2f);})[_0xe527('0x2d')](function(_0x1c5a8c){_0x23ed92[_0xe527('0x51')]=_0x1c5a8c;return _0x23ed92;})[_0xe527('0x2d')](respondWithFilteredResult(_0x259e0a,_0xa79d2f))[_0xe527('0x52')](handleError(_0x259e0a,null));};exports['show']=function(_0x2f7270,_0x42964e){var _0x1c69cd={'raw':!![],'where':{'id':_0x2f7270['params']['id']}},_0x14708f={};_0x14708f[_0xe527('0x3a')]=_[_0xe527('0x3d')](db['Plugin']['rawAttributes']);_0x14708f[_0xe527('0x3c')]=_['keys'](_0x2f7270[_0xe527('0x3c')]);_0x14708f['filters']=_[_0xe527('0x3f')](_0x14708f['model'],_0x14708f['query']);_0x1c69cd[_0xe527('0x41')]=_[_0xe527('0x3f')](_0x14708f['model'],qs[_0xe527('0x40')](_0x2f7270['query'][_0xe527('0x40')]));_0x1c69cd[_0xe527('0x41')]=_0x1c69cd['attributes'][_0xe527('0x42')]?_0x1c69cd[_0xe527('0x41')]:_0x14708f[_0xe527('0x3a')];if(_0x2f7270[_0xe527('0x3c')]['includeAll']){_0x1c69cd[_0xe527('0x4f')]=[{'all':!![]}];}_0x1c69cd=_[_0xe527('0x4c')]({},_0x1c69cd,_0x2f7270[_0xe527('0x4d')]);return db[_0xe527('0x36')]['find'](_0x1c69cd)[_0xe527('0x2d')](handleEntityNotFound(_0x42964e,null))[_0xe527('0x2d')](respondWithResult(_0x42964e,null))['catch'](handleError(_0x42964e,null));};exports[_0xe527('0x53')]=function(_0x584121,_0x35b5dd,_0x4b950a){return db[_0xe527('0x36')][_0xe527('0x54')]({'where':{'id':_0x584121[_0xe527('0x55')]['id']},'attributes':[_0xe527('0x33'),'path'],'raw':!![]})[_0xe527('0x2d')](handleEntityNotFound(_0x35b5dd,null))[_0xe527('0x2d')](function(_0x13beb4){if(_0x13beb4){var _0x33c3fc=path[_0xe527('0x56')](config[_0xe527('0x57')],_0xe527('0x58'),util[_0xe527('0x59')](_0xe527('0x5a'),path[_0xe527('0x5b')](_0x13beb4[_0xe527('0x8')])));var _0x1a1d5e=fs[_0xe527('0x5c')](_0x33c3fc);var _0x214140=archiver(_0xe527('0x5d'),{'zlib':{'level':0x9}});_0x214140['on'](_0xe527('0x5e'),function(_0x316596){if(_0x316596[_0xe527('0x5f')]===_0xe527('0x60')){logger[_0xe527('0x31')](_0x316596);}else{throw new db[(_0xe527('0x61'))][(_0xe527('0x62'))](_0xe527('0x63'));}});_0x214140['on'](_0xe527('0x31'),function(_0x4e5db8){throw new db[(_0xe527('0x61'))]['Error'](_0xe527('0x63'));});_0x214140[_0xe527('0x64')](_0x1a1d5e);_0x214140[_0xe527('0x65')]('**/*',{'cwd':path[_0xe527('0x56')](config[_0xe527('0x57')],'server/files/plugins',path[_0xe527('0x66')](_0x13beb4['path'])),'ignore':[path[_0xe527('0x56')](path[_0xe527('0x5b')](_0x13beb4[_0xe527('0x8')]),'node_modules/**/*'),path[_0xe527('0x56')](path[_0xe527('0x5b')](_0x13beb4['path']),_0xe527('0x67'))],'nodir':!![]})[_0xe527('0x68')]();_0x1a1d5e['on'](_0xe527('0x69'),function(){if(!fs['existsSync'](_0x33c3fc)){throw new db[(_0xe527('0x61'))]['Error'](_0xe527('0x6a'));}return _0x35b5dd[_0xe527('0x53')](_0x33c3fc,util[_0xe527('0x59')](_0xe527('0x5a'),path['basename'](_0x13beb4[_0xe527('0x8')])),function(_0x59456c){if(_0x59456c){throw new db[(_0xe527('0x61'))][(_0xe527('0x62'))](_0xe527('0x6b'));}fs[_0xe527('0x6c')](_0x33c3fc);logger[_0xe527('0x6d')]('Download\x20completed');logger['info'](_0xe527('0x6e'));});});}return null;})[_0xe527('0x52')](handleError(_0x35b5dd,null));};exports['upload']=function(_0x30d95f,_0xd8a933,_0x122c61){var _0x193bb5=path[_0xe527('0x5b')](_0x30d95f[_0xe527('0x6f')]['filename'],path['extname'](_0x30d95f['file']['filename']));var _0x5003b0=path[_0xe527('0x56')](config[_0xe527('0x57')],_0xe527('0x58'),_0x30d95f['file']['filename']);var _0x42e939=path[_0xe527('0x56')](config[_0xe527('0x57')],_0xe527('0x58'),_0x193bb5);logger[_0xe527('0x6d')](_0xe527('0x70'),_0x5003b0);logger['info'](_0xe527('0x71'),_0x42e939);try{fs[_0xe527('0x72')](_0x5003b0,parseInt(_0xe527('0x73'),0x8));extract(_0x5003b0,{'dir':_0x42e939},function(_0x371404){if(_0x371404){logger[_0xe527('0x31')](_0x371404);handleError(_0x371404,!![]);};var _0x370889=fs[_0xe527('0x74')](_0x42e939);if(_0x370889[_0xe527('0x42')]>0x1){removeReferences(_0x5003b0,_0x42e939);logger[_0xe527('0x31')](_0xe527('0x75'));return _0x122c61(new Error(_0xe527('0x75')));}var _0x5f3bce=fs['lstatSync'](path['join'](_0x42e939,_0x370889[0x0]));if(_0x5f3bce[_0xe527('0x76')]()){removeReferences(_0x5003b0,_0x42e939);logger['error']('Invalid\x20plugin\x20structure');return _0x122c61(new Error(_0xe527('0x75')));}if(_0x5f3bce[_0xe527('0x77')]()){var _0x199eca=fs[_0xe527('0x74')](path[_0xe527('0x56')](_0x42e939,_0x370889[0x0]));if(_0x199eca[_0xe527('0x42')]===0x0){removeReferences(_0x5003b0,_0x42e939);logger['error']('Invalid\x20plugin\x20structure');return _0x122c61(new Error(_0xe527('0x75')));}var _0x2e8abd=_0x199eca['some'](function(_0xbc0903){return _0xbc0903===_0xe527('0x78');});if(!_0x2e8abd){return _0x122c61(new Error(_0xe527('0x79')));}var _0x3fba1e=fs[_0xe527('0x7a')](path[_0xe527('0x56')](_0x42e939,_0x370889[0x0],_0xe527('0x78')));var _0x4edd1b=JSON[_0xe527('0x7b')](_0x3fba1e);if('undefined'==typeof _0x4edd1b[_0xe527('0x33')]){return _0x122c61(new Error(_0xe527('0x7c')));}if(_0xe527('0x25')==typeof _0x4edd1b[_0xe527('0x4a')]){return _0x122c61(new Error(_0xe527('0x7d')));}if(_0xe527('0x25')==typeof _0x4edd1b[_0xe527('0x7e')]){return _0x122c61(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe527('0x25')==typeof _0x4edd1b['parameters']){return _0x122c61(new Error(_0xe527('0x7f')));}if(_0x4edd1b[_0xe527('0x4a')]===_0xe527('0x80')){if(_0xe527('0x25')==typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')]){return _0x122c61(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xe527('0x25')==typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')]['admin']&&'undefined'==typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x83')]){return _0x122c61(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4edd1b[_0xe527('0x4a')]==='script'){if('undefined'==typeof _0x4edd1b['parameters'][_0xe527('0x84')]){return _0x122c61(new Error(_0xe527('0x85')));}if(_0xe527('0x25')==typeof _0x4edd1b['parameters'][_0xe527('0x86')]){return _0x122c61(new Error(_0xe527('0x87')));}}else{return _0x122c61(new Error(_0xe527('0x88')));}var _0x19ee61=_0x4edd1b['name'];var _0x5f5ca0=_0x4edd1b[_0xe527('0x89')];var _0x257fed=_0x4edd1b[_0xe527('0x4a')];var _0x5a8906=_0x4edd1b['sidebar']?_0x4edd1b[_0xe527('0x8a')]:_0xe527('0x8b');var _0x89d237=_0x4edd1b['icon']?_0x4edd1b['icon']:'icon-apps';var _0x3b6559='';var _0xc629f8='';var _0x1206d2='';var _0x22131b='';var _0x3319f9=_0x4edd1b[_0xe527('0x7e')];if(_0x257fed===_0xe527('0x80')){if(_0xe527('0x25')!=typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x8c')]){var _0x1811db=_0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1811db)){_0x3b6559=path[_0xe527('0x56')](_0xe527('0x8d'),_0x193bb5,_0x370889[0x0],_0x1811db);}else{_0x3b6559=_0x1811db;}}else{logger[_0xe527('0x6d')](_0xe527('0x8e'));}if(_0xe527('0x25')!=typeof _0x4edd1b['parameters'][_0xe527('0x82')][_0xe527('0x83')]){var _0x2fe82f=_0x4edd1b['parameters'][_0xe527('0x82')][_0xe527('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe527('0x8f')](_0x2fe82f)){_0xc629f8=path[_0xe527('0x56')](_0xe527('0x8d'),_0x193bb5,_0x370889[0x0],_0x2fe82f);}else{_0xc629f8=_0x2fe82f;}}else{logger['info'](_0xe527('0x90'));}}else if(_0x257fed==='script'){_0x1206d2=_0x4edd1b['parameters'][_0xe527('0x84')];_0x22131b=_0x4edd1b[_0xe527('0x81')][_0xe527('0x86')];if(_0xe527('0x25')!=typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')]){if(_0xe527('0x25')!=typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x8c')]){var _0x1811db=_0x4edd1b[_0xe527('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1811db)){_0x3b6559=path[_0xe527('0x56')](_0xe527('0x8d'),_0x193bb5,_0x370889[0x0],_0x1811db);}else{_0x3b6559=_0x1811db;}}if('undefined'!=typeof _0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x83')]){var _0x2fe82f=_0x4edd1b[_0xe527('0x81')][_0xe527('0x82')][_0xe527('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe527('0x8f')](_0x2fe82f)){_0xc629f8=path[_0xe527('0x56')](_0xe527('0x8d'),_0x193bb5,_0x370889[0x0],_0x2fe82f);}else{_0xc629f8=_0x2fe82f;}}}}var _0x3bc6a8={'name':_0x19ee61,'description':_0x5f5ca0,'path':path[_0xe527('0x56')](_0x193bb5,_0x370889[0x0]),'type':_0x257fed,'sidebar':_0x5a8906,'icon':_0x89d237,'adminUrl':_0x3b6559,'agentUrl':_0xc629f8,'scriptName':_0x1206d2,'scriptPath':_0x22131b,'version':_0x3319f9};removeReferences(_0x5003b0,null);return db[_0xe527('0x36')][_0xe527('0x91')](_0x3bc6a8)[_0xe527('0x2d')](function(_0x2a5171){var _0x27cd8e={'role':_0x30d95f[_0xe527('0x92')][_0xe527('0x93')],'userProfileId':_0x30d95f[_0xe527('0x92')][_0xe527('0x94')]};if(!_0x27cd8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27cd8e[_0xe527('0x93')]===_0xe527('0x95')){var _0x3e615a=_0x2a5171[_0xe527('0x2f')]({'plain':!![]});return db[_0xe527('0x96')][_0xe527('0x54')]({'where':{'name':_0xe527('0x97'),'userProfileId':_0x27cd8e[_0xe527('0x94')]},'raw':!![]})[_0xe527('0x2d')](function(_0x5562d8){if(_0x5562d8&&_0x5562d8[_0xe527('0x98')]===0x0){return db[_0xe527('0x30')][_0xe527('0x91')]({'name':_0x3e615a[_0xe527('0x33')],'resourceId':_0x3e615a['id'],'type':_0x5562d8['name'],'sectionId':_0x5562d8['id']},{})[_0xe527('0x2d')](function(){return _0x2a5171;});}else{return _0x2a5171;}})['catch'](function(_0x47dc6b){logger[_0xe527('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47dc6b);throw _0x47dc6b;});}return _0x2a5171;})['then'](respondWithResult(_0xd8a933,null))['catch'](handleError(_0xd8a933,null));}});}catch(_0xd3769e){_0xd8a933[_0xe527('0x22')](0x1f4)[_0xe527('0x34')](_0xd3769e);}};function removeReferences(_0xa943b3,_0x2b0dd4){try{if(_0xa943b3){fs[_0xe527('0x6c')](_0xa943b3);logger[_0xe527('0x6d')](_0xe527('0x99'));}if(_0x2b0dd4){rimraf(_0x2b0dd4,function(){});logger[_0xe527('0x6d')](_0xe527('0x9a'));}}catch(_0x2fd0f3){logger[_0xe527('0x31')](_0x2fd0f3);}}exports[_0xe527('0x2c')]=function(_0x257390,_0x24c9af,_0x55b1b3){return db[_0xe527('0x36')][_0xe527('0x54')]({'where':{'id':_0x257390[_0xe527('0x55')]['id']}})[_0xe527('0x2d')](handleEntityNotFound(_0x24c9af,null))[_0xe527('0x2d')](saveUpdates(_0x257390['body'],null))['then'](respondWithResult(_0x24c9af,null))[_0xe527('0x52')](handleError(_0x24c9af,null));};exports[_0xe527('0x9b')]=function(_0x20f52f,_0x214e3f,_0x2cc79b){return db[_0xe527('0x36')][_0xe527('0x54')]({'where':{'id':_0x20f52f[_0xe527('0x55')]['id']}})[_0xe527('0x2d')](function(_0x4b3137){if(_0x4b3137){return _0x4b3137['destroy']();}})[_0xe527('0x2d')](function(_0x48cf9f){rimraf(path[_0xe527('0x56')](config[_0xe527('0x57')],_0xe527('0x58'),path['dirname'](_0x48cf9f['path'])),function(){});return _0x48cf9f;})[_0xe527('0x2d')](handleEntityNotFound(_0x214e3f,null))[_0xe527('0x2d')](respondWithStatusCode(_0x214e3f,null))[_0xe527('0x52')](handleError(_0x214e3f,null));};exports[_0xe527('0x9c')]=function(_0x1fa519,_0x5d3f28,_0x2c9d95){return BPromise['resolve']()['then'](function(){if(!_0x1fa519[_0xe527('0x3c')]['path']){throw new Error(_0xe527('0x9d'));}if(!_0x1fa519['query'][_0xe527('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3dbdd5=_0x1fa519['query'][_0xe527('0x9f')]?_0x1fa519[_0xe527('0x3c')]['hostname']+':'+_0x1fa519[_0xe527('0x3c')][_0xe527('0x9e')]:_0xe527('0xa0')+_0x1fa519[_0xe527('0x3c')]['port'];var _0x106677=_0x1fa519[_0xe527('0x3c')][_0xe527('0x24')]?_0x1fa519[_0xe527('0x3c')][_0xe527('0x24')]:!![];var _0x36ad28=_0x1fa519[_0xe527('0x3c')][_0xe527('0xa1')]?_0x1fa519[_0xe527('0x3c')]['encoding']:null;var _0x1d20bc={'method':_0x1fa519[_0xe527('0xa2')],'uri':util[_0xe527('0x59')](_0xe527('0xa3'),_0x3dbdd5,_0x1fa519[_0xe527('0x3c')]['path']),'json':_0x106677,'resolveWithFullResponse':!![],'encoding':_0x36ad28,'qs':_0x1fa519['query']};if(_0x1fa519[_0xe527('0xa4')]){_0x1d20bc[_0xe527('0xa4')]=_0x1fa519[_0xe527('0xa4')];if(_0x1d20bc['headers'][_0xe527('0xa5')]){delete _0x1d20bc[_0xe527('0xa4')][_0xe527('0xa5')];}}if(_0x1d20bc['headers'][_0xe527('0xa6')]){delete _0x1d20bc[_0xe527('0xa4')][_0xe527('0xa6')];}return rp(_0x1d20bc);})[_0xe527('0x2d')](function(_0x102d08){if(_0x102d08){_0x5d3f28['set'](_0x102d08[_0xe527('0xa4')]);logger['info'](_0x102d08[_0xe527('0x92')]);if(_['endsWith'](_0x1fa519[_0xe527('0x3c')][_0xe527('0x8')],_0xe527('0x53'))&&_0x102d08[_0xe527('0xa7')]==0x1f4){return _0x5d3f28[_0xe527('0x21')](_0x102d08[_0xe527('0xa7')]);}else{return _0x5d3f28[_0xe527('0x22')](_0x102d08[_0xe527('0xa7')])[_0xe527('0x34')](_0x102d08['body']);}}else{return _0x5d3f28['sendStatus'](0xc8);}})['catch'](handleError(_0x5d3f28,null));};exports[_0xe527('0xa8')]=function(_0x3274f7,_0x26146d,_0x47125f){return BPromise['resolve']()['then'](function(){if(!_0x3274f7['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3274f7[_0xe527('0x3c')][_0xe527('0x9e')]){throw new Error(_0xe527('0xa9'));}var _0x4a6e3f=_0x3274f7[_0xe527('0x3c')]['hostname']?_0x3274f7['query'][_0xe527('0x9f')]+':'+_0x3274f7[_0xe527('0x3c')]['port']:_0xe527('0xa0')+_0x3274f7[_0xe527('0x3c')][_0xe527('0x9e')];var _0x324bb6=_0x3274f7[_0xe527('0x3c')][_0xe527('0x24')]?_0x3274f7['query'][_0xe527('0x24')]:!![];var _0x20d5e7=_0x3274f7[_0xe527('0x3c')][_0xe527('0xa1')]?_0x3274f7[_0xe527('0x3c')][_0xe527('0xa1')]:null;var _0x38b10a={'method':_0x3274f7['method'],'uri':util[_0xe527('0x59')](_0xe527('0xa3'),_0x4a6e3f,_0x3274f7[_0xe527('0x3c')][_0xe527('0x8')]),'json':_0x324bb6,'resolveWithFullResponse':!![],'encoding':_0x20d5e7,'body':_0x3274f7[_0xe527('0x92')]};if(_0x3274f7[_0xe527('0xa4')]){_0x38b10a[_0xe527('0xa4')]=_0x3274f7[_0xe527('0xa4')];if(_0x38b10a[_0xe527('0xa4')][_0xe527('0xa5')]){delete _0x38b10a['headers'][_0xe527('0xa5')];}}if(_0x38b10a[_0xe527('0xa4')]['content-type']){delete _0x38b10a[_0xe527('0xa4')][_0xe527('0xa6')];}return rp(_0x38b10a);})[_0xe527('0x2d')](function(_0x36fc34){if(_0x36fc34){_0x26146d['set'](_0x36fc34['headers']);logger[_0xe527('0x6d')](_0x36fc34[_0xe527('0x92')]);return _0x26146d['status'](_0x36fc34['statusCode'])[_0xe527('0x34')](_0x36fc34[_0xe527('0x92')]);}else{return _0x26146d[_0xe527('0x21')](0xc8);}})['catch'](handleError(_0x26146d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3556225..20982af 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 _0xa6b0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x1282ec,_0x2bba8a){_0x1282ec=_0x1282ec-0x0;var _0x57d621=_0xa6b0[_0x1282ec];return _0x57d621;};'use strict';var EventEmitter=require(_0x0a6b('0x0'));var Plugin=require(_0x0a6b('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a6b('0x2'),'afterUpdate':_0x0a6b('0x3'),'afterDestroy':_0x0a6b('0x4')};function emitEvent(_0x4c9a84){return function(_0x29ff80,_0x33e8c3,_0x195697){PluginEvents[_0x0a6b('0x5')](_0x4c9a84+':'+_0x29ff80['id'],_0x29ff80);PluginEvents[_0x0a6b('0x5')](_0x4c9a84,_0x29ff80);_0x195697(null);};}for(var e in events){if(events[_0x0a6b('0x6')](e)){var event=events[e];Plugin[_0x0a6b('0x7')](e,emitEvent(event));}}module[_0x0a6b('0x8')]=PluginEvents; \ No newline at end of file +var _0x6869=['hook','exports','events','../../mysqldb','Plugin','save','emit','hasOwnProperty'];(function(_0x540c3f,_0x2355c2){var _0x281cf7=function(_0x16b9c1){while(--_0x16b9c1){_0x540c3f['push'](_0x540c3f['shift']());}};_0x281cf7(++_0x2355c2);}(_0x6869,0xe2));var _0x9686=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6869[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x9686('0x0'));var Plugin=require(_0x9686('0x1'))['db'][_0x9686('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9686('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10b5dd){return function(_0x1214bf,_0x3afe82,_0x2a1a62){PluginEvents[_0x9686('0x4')](_0x10b5dd+':'+_0x1214bf['id'],_0x1214bf);PluginEvents['emit'](_0x10b5dd,_0x1214bf);_0x2a1a62(null);};}for(var e in events){if(events[_0x9686('0x5')](e)){var event=events[e];Plugin[_0x9686('0x6')](e,emitEvent(event));}}module[_0x9686('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c99e5a8..8cd561a 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 _0x3d68=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x4ff449,_0x148232){var _0x4e57d9=function(_0x3619e7){while(--_0x3619e7){_0x4ff449['push'](_0x4ff449['shift']());}};_0x4e57d9(++_0x148232);}(_0x3d68,0x107));var _0x83d6=function(_0x33a499,_0x3a2e5a){_0x33a499=_0x33a499-0x0;var _0x2dc9ba=_0x3d68[_0x33a499];return _0x2dc9ba;};'use strict';var _=require(_0x83d6('0x0'));var util=require(_0x83d6('0x1'));var logger=require(_0x83d6('0x2'))(_0x83d6('0x3'));var moment=require(_0x83d6('0x4'));var BPromise=require(_0x83d6('0x5'));var rp=require(_0x83d6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83d6('0x7'));var config=require('../../config/environment');var attributes=require(_0x83d6('0x8'));module[_0x83d6('0x9')]=function(_0x2e9b0c,_0x19faa0){return _0x2e9b0c['define'](_0x83d6('0xa'),attributes,{'tableName':_0x83d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff3c=['moment','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','api'];(function(_0x5b40a7,_0x2dbc68){var _0x4a9605=function(_0x8a74b7){while(--_0x8a74b7){_0x5b40a7['push'](_0x5b40a7['shift']());}};_0x4a9605(++_0x2dbc68);}(_0xff3c,0x179));var _0xcff3=function(_0x32b27e,_0x39c1de){_0x32b27e=_0x32b27e-0x0;var _0x11ed70=_0xff3c[_0x32b27e];return _0x11ed70;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var logger=require('../../config/logger')(_0xcff3('0x2'));var moment=require(_0xcff3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff3('0x4'));var rimraf=require(_0xcff3('0x5'));var config=require(_0xcff3('0x6'));var attributes=require(_0xcff3('0x7'));module[_0xcff3('0x8')]=function(_0x308a82,_0x47b899){return _0x308a82['define'](_0xcff3('0x9'),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 780b747..e28a6cc 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 _0x9bc3=['Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then'];(function(_0x502ec7,_0x8e99b3){var _0x362b0f=function(_0x379598){while(--_0x379598){_0x502ec7['push'](_0x502ec7['shift']());}};_0x362b0f(++_0x8e99b3);}(_0x9bc3,0x137));var _0x39bc=function(_0x47bd1b,_0x5af56c){_0x47bd1b=_0x47bd1b-0x0;var _0x4705d4=_0x9bc3[_0x47bd1b];return _0x4705d4;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var moment=require(_0x39bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x39bc('0x3'));var fs=require('fs');var Redis=require(_0x39bc('0x4'));var db=require(_0x39bc('0x5'))['db'];var utils=require(_0x39bc('0x6'));var logger=require('../../config/logger')(_0x39bc('0x7'));var config=require(_0x39bc('0x8'));var jayson=require(_0x39bc('0x9'));var client=jayson[_0x39bc('0xa')]['http']({'port':0x232a});config[_0x39bc('0xb')]=_[_0x39bc('0xc')](config[_0x39bc('0xb')],{'host':_0x39bc('0xd'),'port':0x18eb});var socket=require(_0x39bc('0xe'))(new Redis(config[_0x39bc('0xb')]));require(_0x39bc('0xf'))[_0x39bc('0x10')](socket);function respondWithRpcPromise(_0x4e9b81,_0x15ff81,_0x237044){return new BPromise(function(_0x1e2fc8,_0x3396af){return client[_0x39bc('0x11')](_0x4e9b81,_0x237044)[_0x39bc('0x12')](function(_0x4a4305){logger['info'](_0x39bc('0x13'),_0x15ff81,_0x39bc('0x14'));logger['debug'](_0x39bc('0x15'),_0x15ff81,_0x39bc('0x14'),JSON[_0x39bc('0x16')](_0x4a4305));if(_0x4a4305['error']){if(_0x4a4305['error']['code']===0x1f4){logger[_0x39bc('0x17')]('Plugin,\x20%s,\x20%s',_0x15ff81,_0x4a4305['error'][_0x39bc('0x18')]);return _0x3396af(_0x4a4305[_0x39bc('0x17')]['message']);}logger['error'](_0x39bc('0x13'),_0x15ff81,_0x4a4305[_0x39bc('0x17')][_0x39bc('0x18')]);return _0x1e2fc8(_0x4a4305['error'][_0x39bc('0x18')]);}else{logger[_0x39bc('0x19')](_0x39bc('0x13'),_0x15ff81,_0x39bc('0x14'));_0x1e2fc8(_0x4a4305[_0x39bc('0x1a')][_0x39bc('0x18')]);}})[_0x39bc('0x1b')](function(_0x486757){logger[_0x39bc('0x17')](_0x39bc('0x13'),_0x15ff81,_0x486757);_0x3396af(_0x486757);});});}exports[_0x39bc('0x1c')]=function(_0x65ee0e){var _0x47ee88=this;return new Promise(function(_0xbd165,_0x4ad3ef){return db[_0x39bc('0x1d')]['create'](_0x65ee0e[_0x39bc('0x1e')],{'raw':_0x65ee0e[_0x39bc('0x1f')]?_0x65ee0e[_0x39bc('0x1f')][_0x39bc('0x20')]===undefined?!![]:![]:!![]})[_0x39bc('0x12')](function(_0x5e3d5e){logger[_0x39bc('0x19')](_0x39bc('0x1c'),_0x65ee0e);logger['debug'](_0x39bc('0x1c'),_0x65ee0e,JSON[_0x39bc('0x16')](_0x5e3d5e));_0xbd165(_0x5e3d5e);})['catch'](function(_0x5b2e62){logger[_0x39bc('0x17')](_0x39bc('0x1c'),_0x5b2e62['message'],_0x65ee0e);_0x4ad3ef(_0x47ee88[_0x39bc('0x17')](0x1f4,_0x5b2e62[_0x39bc('0x18')]));});});}; \ No newline at end of file +var _0xa7eb=['body','options','raw','then','debug','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','request','info','request\x20sent','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0xa7eb,0x1d5));var _0xba7e=function(_0xaca083,_0x43e3d3){_0xaca083=_0xaca083-0x0;var _0x115c65=_0xa7eb[_0xaca083];return _0x115c65;};'use strict';var _=require(_0xba7e('0x0'));var util=require('util');var moment=require(_0xba7e('0x1'));var BPromise=require(_0xba7e('0x2'));var rs=require(_0xba7e('0x3'));var fs=require('fs');var Redis=require(_0xba7e('0x4'));var db=require(_0xba7e('0x5'))['db'];var utils=require(_0xba7e('0x6'));var logger=require(_0xba7e('0x7'))(_0xba7e('0x8'));var config=require(_0xba7e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xba7e('0xa')][_0xba7e('0xb')]({'port':0x232a});config['redis']=_[_0xba7e('0xc')](config[_0xba7e('0xd')],{'host':_0xba7e('0xe'),'port':0x18eb});var socket=require(_0xba7e('0xf'))(new Redis(config[_0xba7e('0xd')]));require(_0xba7e('0x10'))['register'](socket);function respondWithRpcPromise(_0x43a084,_0xf08a32,_0x4c65dd){return new BPromise(function(_0x947757,_0x1e7db7){return client[_0xba7e('0x11')](_0x43a084,_0x4c65dd)['then'](function(_0x12d26c){logger[_0xba7e('0x12')]('Plugin,\x20%s,\x20%s',_0xf08a32,_0xba7e('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0xf08a32,_0xba7e('0x13'),JSON['stringify'](_0x12d26c));if(_0x12d26c[_0xba7e('0x14')]){if(_0x12d26c[_0xba7e('0x14')][_0xba7e('0x15')]===0x1f4){logger['error'](_0xba7e('0x16'),_0xf08a32,_0x12d26c['error']['message']);return _0x1e7db7(_0x12d26c[_0xba7e('0x14')][_0xba7e('0x17')]);}logger[_0xba7e('0x14')](_0xba7e('0x16'),_0xf08a32,_0x12d26c[_0xba7e('0x14')][_0xba7e('0x17')]);return _0x947757(_0x12d26c[_0xba7e('0x14')][_0xba7e('0x17')]);}else{logger[_0xba7e('0x12')]('Plugin,\x20%s,\x20%s',_0xf08a32,_0xba7e('0x13'));_0x947757(_0x12d26c[_0xba7e('0x18')]['message']);}})['catch'](function(_0x29fb9a){logger[_0xba7e('0x14')](_0xba7e('0x16'),_0xf08a32,_0x29fb9a);_0x1e7db7(_0x29fb9a);});});}exports[_0xba7e('0x19')]=function(_0x2a9b4c){var _0x73208b=this;return new Promise(function(_0x3854ad,_0x3978a6){return db['Plugin']['create'](_0x2a9b4c[_0xba7e('0x1a')],{'raw':_0x2a9b4c[_0xba7e('0x1b')]?_0x2a9b4c[_0xba7e('0x1b')][_0xba7e('0x1c')]===undefined?!![]:![]:!![]})[_0xba7e('0x1d')](function(_0x185820){logger[_0xba7e('0x12')](_0xba7e('0x19'),_0x2a9b4c);logger[_0xba7e('0x1e')](_0xba7e('0x19'),_0x2a9b4c,JSON[_0xba7e('0x1f')](_0x185820));_0x3854ad(_0x185820);})[_0xba7e('0x20')](function(_0x5c0a74){logger[_0xba7e('0x14')](_0xba7e('0x19'),_0x5c0a74[_0xba7e('0x17')],_0x2a9b4c);_0x3978a6(_0x73208b[_0xba7e('0x14')](0x1f4,_0x5c0a74[_0xba7e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4fab548..4148afb 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 _0x4005=['removeListener','register','length','plugin:','save','update','emit'];(function(_0x220195,_0x28d2d3){var _0x570832=function(_0x5ec852){while(--_0x5ec852){_0x220195['push'](_0x220195['shift']());}};_0x570832(++_0x28d2d3);}(_0x4005,0x74));var _0x5400=function(_0x558a88,_0x409ab9){_0x558a88=_0x558a88-0x0;var _0x4a337a=_0x4005[_0x558a88];return _0x4a337a;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5400('0x0'),'remove',_0x5400('0x1')];function createListener(_0x127358,_0x33cfa8){return function(_0xbae867){_0x33cfa8[_0x5400('0x2')](_0x127358,_0xbae867);};}function removeListener(_0x14f655,_0x367ea5){return function(){PluginEvents[_0x5400('0x3')](_0x14f655,_0x367ea5);};}exports[_0x5400('0x4')]=function(_0x1723d8){for(var _0x1b8475=0x0,_0x4dbc09=events[_0x5400('0x5')];_0x1b8475<_0x4dbc09;_0x1b8475++){var _0x4b1b5b=events[_0x1b8475];var _0x41bb22=createListener(_0x5400('0x6')+_0x4b1b5b,_0x1723d8);PluginEvents['on'](_0x4b1b5b,_0x41bb22);}}; \ No newline at end of file +var _0xf49f=['length','plugin:','save','update','emit','register'];(function(_0x5b1ec7,_0x4904ba){var _0x11d210=function(_0x349451){while(--_0x349451){_0x5b1ec7['push'](_0x5b1ec7['shift']());}};_0x11d210(++_0x4904ba);}(_0xf49f,0x152));var _0xff49=function(_0x4c64f7,_0x5c8f2e){_0x4c64f7=_0x4c64f7-0x0;var _0x35f962=_0xf49f[_0x4c64f7];return _0x35f962;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xff49('0x0'),'remove',_0xff49('0x1')];function createListener(_0x368553,_0x4b7a7a){return function(_0x5aa4a8){_0x4b7a7a[_0xff49('0x2')](_0x368553,_0x5aa4a8);};}function removeListener(_0x500818,_0x175431){return function(){PluginEvents['removeListener'](_0x500818,_0x175431);};}exports[_0xff49('0x3')]=function(_0x88153f){for(var _0x253cc9=0x0,_0x2fec68=events[_0xff49('0x4')];_0x253cc9<_0x2fec68;_0x253cc9++){var _0x11117e=events[_0x253cc9];var _0x14c7fe=createListener(_0xff49('0x5')+_0x11117e,_0x88153f);PluginEvents['on'](_0x11117e,_0x14c7fe);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4aa85aa..f35c1f7 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(_0xd55444,_0x18220b){var _0x29dc54=function(_0xc5d932){while(--_0xc5d932){_0xd55444['push'](_0xd55444['shift']());}};_0x29dc54(++_0x18220b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x46de5e,_0x377b6a){var _0x4902f0=function(_0x3f6130){while(--_0x3f6130){_0x46de5e['push'](_0x46de5e['shift']());}};_0x4902f0(++_0x377b6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 fc16514..074b42d 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 _0xec56=['reject','express','length','then','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list'];(function(_0x2b2be9,_0x3d87ec){var _0x21d918=function(_0x3473e2){while(--_0x3473e2){_0x2b2be9['push'](_0x2b2be9['shift']());}};_0x21d918(++_0x3d87ec);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2b3a3a,_0xcf8c27){_0x2b3a3a=_0x2b3a3a-0x0;var _0x4d5a87=_0xec56[_0x2b3a3a];return _0x4d5a87;};'use strict';var _=require(_0x6ec5('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x6ec5('0x1'));var path=require(_0x6ec5('0x2'));var exec=require(_0x6ec5('0x3'))[_0x6ec5('0x4')];var BPromise=require(_0x6ec5('0x5'));function handleEntityNotFound(_0x399441,_0x469679){return function(_0x173aeb){if(!_0x173aeb){_0x399441[_0x6ec5('0x6')](0x194);;}return _0x173aeb;};}function respondWithResult(_0x28b12b,_0x2d0a93){_0x2d0a93=_0x2d0a93||0xc8;return function(_0x3bb683){if(_0x3bb683){return _0x28b12b[_0x6ec5('0x7')](_0x2d0a93)[_0x6ec5('0x8')](_0x3bb683);}return null;};}function handleError(_0x3dd891,_0x225d2f){_0x225d2f=_0x225d2f||0x1f4;return function(_0x17bcf0){logger[_0x6ec5('0x9')](_0x17bcf0[_0x6ec5('0xa')]);if(_0x17bcf0['name']){delete _0x17bcf0[_0x6ec5('0xb')];}_0x3dd891[_0x6ec5('0x7')](_0x225d2f)[_0x6ec5('0xc')](_0x17bcf0);};}function execChildProcess(){return new BPromise(function(_0x1964ae,_0x143b09){exec(_0x6ec5('0xd'),function(_0x1d5b76,_0x50eb2d,_0x2d4eca){logger[_0x6ec5('0xe')](_0x50eb2d);logger[_0x6ec5('0xe')](_0x2d4eca);if(_0x1d5b76){logger[_0x6ec5('0x9')](_0x1d5b76);return _0x143b09(_0x1d5b76);}return _0x1964ae(_0x50eb2d);});});}exports[_0x6ec5('0xf')]=function(_0x2890fb,_0x2f4c5d){return pm2[_0x6ec5('0x10')]()['then'](function(_0x3ed07a){if(_0x3ed07a){var _0x4d1510=_[_0x6ec5('0x11')](_0x3ed07a,function(_0x287542){return _0x287542[_0x6ec5('0xb')]===_0x6ec5('0x12')||_0x287542[_0x6ec5('0xb')]==='motion2';});return{'rows':_0x4d1510,'count':_0x4d1510[_0x6ec5('0x13')]};}return null;})[_0x6ec5('0x14')](respondWithResult(_0x2f4c5d,null))[_0x6ec5('0x15')](handleError(_0x2f4c5d,null));};exports[_0x6ec5('0x16')]=function(_0x23b3e3,_0x42b690){return pm2[_0x6ec5('0x17')](_0x23b3e3[_0x6ec5('0x18')]['id'])[_0x6ec5('0x14')](respondWithResult(_0x42b690,null))[_0x6ec5('0x14')](handleEntityNotFound(_0x42b690,null))[_0x6ec5('0x15')](handleError(_0x42b690,null));};exports[_0x6ec5('0x19')]=function(_0x437f0f,_0x2228dd){if(_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0xb')]&&_0x437f0f[_0x6ec5('0x1a')]['script']){var _0x272532=path[_0x6ec5('0x1b')](__dirname,_0x6ec5('0x1c'),_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0x1d')]);var _0x38a821=process[_0x6ec5('0x1e')]();process['chdir'](path[_0x6ec5('0x1f')](_0x272532));return execChildProcess()[_0x6ec5('0x14')](function(_0x358d18){process[_0x6ec5('0x20')](_0x38a821);return pm2['start']({'name':_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0xb')],'script':_0x272532});})['then'](function(_0x2dc0a7){pm2[_0x6ec5('0x21')]();return _0x2dc0a7[0x0];})[_0x6ec5('0x14')](respondWithResult(_0x2228dd,0xc9))['catch'](handleError(_0x2228dd,null));}else{return _0x2228dd[_0x6ec5('0x7')](0x1f4)[_0x6ec5('0xc')]({'message':_0x6ec5('0x22')});}};exports[_0x6ec5('0x23')]=function(_0x425fac,_0x484847){if(_0x425fac[_0x6ec5('0x1a')]['id']){delete _0x425fac[_0x6ec5('0x1a')]['id'];}var _0x4a9860={'online':_0x6ec5('0x24'),'stopped':_0x6ec5('0x25')};if(_0x4a9860['hasOwnProperty'](_0x425fac[_0x6ec5('0x1a')][_0x6ec5('0x7')])){return pm2[_0x4a9860[_0x425fac[_0x6ec5('0x1a')][_0x6ec5('0x7')]]](_0x425fac[_0x6ec5('0x18')]['id'])['then'](respondWithResult(_0x484847,0xc8))[_0x6ec5('0x15')](handleError(_0x484847,null));}else{return _0x484847[_0x6ec5('0x7')](0x1f4)[_0x6ec5('0xc')]({'message':_0x6ec5('0x26')});}};exports[_0x6ec5('0x27')]=function(_0x22c3d3,_0x394132){if(_0x22c3d3['body']['id']){delete _0x22c3d3[_0x6ec5('0x1a')]['id'];}if(_0x22c3d3['params']['id']){return pm2[_0x6ec5('0x28')](_0x22c3d3['params']['id'])[_0x6ec5('0x14')](function(_0x3115e3){pm2['dump']();return _0x3115e3[0x0];})['then'](respondWithResult(_0x394132,null))[_0x6ec5('0x15')](handleError(_0x394132,null));}else{return _0x394132[_0x6ec5('0x7')](0x1f4)['send']({'message':_0x6ec5('0x29')});}}; \ No newline at end of file +var _0x878f=['dirname','start','dump','restart','stop','hasOwnProperty','params','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','name','info','index','then','express','motion2','length','catch','show','describe','create','body','script','../../files/plugins','cwd','chdir'];(function(_0x4da925,_0x158d7a){var _0x4047b3=function(_0x4d7ca3){while(--_0x4d7ca3){_0x4da925['push'](_0x4da925['shift']());}};_0x4047b3(++_0x158d7a);}(_0x878f,0x173));var _0xf878=function(_0x1eebf3,_0x28e8e4){_0x1eebf3=_0x1eebf3-0x0;var _0x5d3e62=_0x878f[_0x1eebf3];return _0x5d3e62;};'use strict';var _=require('lodash');var pm2=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var path=require(_0xf878('0x3'));var exec=require(_0xf878('0x4'))[_0xf878('0x5')];var BPromise=require(_0xf878('0x6'));function handleEntityNotFound(_0x45a37b,_0x240b48){return function(_0xcf1927){if(!_0xcf1927){_0x45a37b[_0xf878('0x7')](0x194);;}return _0xcf1927;};}function respondWithResult(_0x4bc9aa,_0x4ac8d8){_0x4ac8d8=_0x4ac8d8||0xc8;return function(_0x3c5f5c){if(_0x3c5f5c){return _0x4bc9aa[_0xf878('0x8')](_0x4ac8d8)['json'](_0x3c5f5c);}return null;};}function handleError(_0x52851e,_0x530767){_0x530767=_0x530767||0x1f4;return function(_0x3329df){logger['error'](_0x3329df['stack']);if(_0x3329df[_0xf878('0x9')]){delete _0x3329df[_0xf878('0x9')];}_0x52851e[_0xf878('0x8')](_0x530767)['send'](_0x3329df);};}function execChildProcess(){return new BPromise(function(_0xb2863e,_0x1399a3){exec('npm\x20install',function(_0xdf76,_0x4f7e7f,_0x31d3d2){logger[_0xf878('0xa')](_0x4f7e7f);logger[_0xf878('0xa')](_0x31d3d2);if(_0xdf76){logger['error'](_0xdf76);return _0x1399a3(_0xdf76);}return _0xb2863e(_0x4f7e7f);});});}exports[_0xf878('0xb')]=function(_0x38eddf,_0x39b1bb){return pm2['list']()[_0xf878('0xc')](function(_0x3902f7){if(_0x3902f7){var _0x119e9e=_['reject'](_0x3902f7,function(_0x568a3a){return _0x568a3a[_0xf878('0x9')]===_0xf878('0xd')||_0x568a3a[_0xf878('0x9')]===_0xf878('0xe');});return{'rows':_0x119e9e,'count':_0x119e9e[_0xf878('0xf')]};}return null;})[_0xf878('0xc')](respondWithResult(_0x39b1bb,null))[_0xf878('0x10')](handleError(_0x39b1bb,null));};exports[_0xf878('0x11')]=function(_0x3c5dee,_0x3a55f3){return pm2[_0xf878('0x12')](_0x3c5dee['params']['id'])[_0xf878('0xc')](respondWithResult(_0x3a55f3,null))[_0xf878('0xc')](handleEntityNotFound(_0x3a55f3,null))[_0xf878('0x10')](handleError(_0x3a55f3,null));};exports[_0xf878('0x13')]=function(_0x3714f6,_0x237d15){if(_0x3714f6[_0xf878('0x14')]['name']&&_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]){var _0x250f85=path['join'](__dirname,_0xf878('0x16'),_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]);var _0x392822=process[_0xf878('0x17')]();process[_0xf878('0x18')](path[_0xf878('0x19')](_0x250f85));return execChildProcess()[_0xf878('0xc')](function(_0x212436){process[_0xf878('0x18')](_0x392822);return pm2[_0xf878('0x1a')]({'name':_0x3714f6['body'][_0xf878('0x9')],'script':_0x250f85});})['then'](function(_0xa3d3d3){pm2[_0xf878('0x1b')]();return _0xa3d3d3[0x0];})[_0xf878('0xc')](respondWithResult(_0x237d15,0xc9))[_0xf878('0x10')](handleError(_0x237d15,null));}else{return _0x237d15[_0xf878('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x242926,_0x3baba4){if(_0x242926[_0xf878('0x14')]['id']){delete _0x242926['body']['id'];}var _0xfa3e11={'online':_0xf878('0x1c'),'stopped':_0xf878('0x1d')};if(_0xfa3e11[_0xf878('0x1e')](_0x242926[_0xf878('0x14')]['status'])){return pm2[_0xfa3e11[_0x242926['body'][_0xf878('0x8')]]](_0x242926[_0xf878('0x1f')]['id'])['then'](respondWithResult(_0x3baba4,0xc8))[_0xf878('0x10')](handleError(_0x3baba4,null));}else{return _0x3baba4['status'](0x1f4)[_0xf878('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf878('0x21')]=function(_0x49e66a,_0x2630fb){if(_0x49e66a['body']['id']){delete _0x49e66a[_0xf878('0x14')]['id'];}if(_0x49e66a[_0xf878('0x1f')]['id']){return pm2[_0xf878('0x22')](_0x49e66a[_0xf878('0x1f')]['id'])[_0xf878('0xc')](function(_0x716782){pm2['dump']();return _0x716782[0x0];})[_0xf878('0xc')](respondWithResult(_0x2630fb,null))[_0xf878('0x10')](handleError(_0x2630fb,null));}else{return _0x2630fb[_0xf878('0x8')](0x1f4)[_0xf878('0x20')]({'message':_0xf878('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7308222..3cba6bd 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 _0xc733=['/agents','isAuthenticated','/queues','getQueues','../../components/auth/service','./realtime.controller','get'];(function(_0x42442d,_0x3440f4){var _0x56851e=function(_0x11fc20){while(--_0x11fc20){_0x42442d['push'](_0x42442d['shift']());}};_0x56851e(++_0x3440f4);}(_0xc733,0xba));var _0x3c73=function(_0x5ef1fc,_0x55b180){_0x5ef1fc=_0x5ef1fc-0x0;var _0x36c298=_0xc733[_0x5ef1fc];return _0x36c298;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3c73('0x0'));var controller=require(_0x3c73('0x1'));router[_0x3c73('0x2')](_0x3c73('0x3'),auth[_0x3c73('0x4')](),controller['getAgents']);router[_0x3c73('0x2')](_0x3c73('0x5'),auth[_0x3c73('0x4')](),controller[_0x3c73('0x6')]);module['exports']=router; \ No newline at end of file +var _0xb0aa=['get','/agents','isAuthenticated','getAgents','getQueues','express','Router','../../components/auth/service'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0xb0aa,0x7d));var _0xab0a=function(_0x2df970,_0x32f55b){_0x2df970=_0x2df970-0x0;var _0xf5bd9e=_0xb0aa[_0x2df970];return _0xf5bd9e;};'use strict';var express=require(_0xab0a('0x0'));var router=express[_0xab0a('0x1')]();var auth=require(_0xab0a('0x2'));var controller=require('./realtime.controller');router[_0xab0a('0x3')](_0xab0a('0x4'),auth[_0xab0a('0x5')](),controller[_0xab0a('0x6')]);router[_0xab0a('0x3')]('/queues',auth['isAuthenticated'](),controller[_0xab0a('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 884f4f2..dd69e85 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 _0x189b=['validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','role','agent','raw','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll','rows','map','find','filterAgentAttributes','merge','getAgentStatus','voice','voiceStatus','talking','pause','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','type','name','outbound','dialActive','getOptions','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','initializeQueues','catch','lodash','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','offset','undefined','count','limit','status','set','Content-Range','json','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','resolve','then','channel','isValidChannel','toLowerCase','sort','includes','globalStatus'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x189b,0x13f));var _0xb189=function(_0x34da95,_0x1ce53b){_0x34da95=_0x34da95-0x0;var _0xae9cff=_0x189b[_0x34da95];return _0xae9cff;};'use strict';var _=require(_0xb189('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0xb189('0x1'));var qs=require(_0xb189('0x2'));var utils=require(_0xb189('0x3'));var db=require(_0xb189('0x4'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x26e2c4,_0x8d61d1){return function(_0x29b5f1){if(_0x29b5f1){var _0x33f4ea=typeof _0x8d61d1[_0xb189('0x5')]===_0xb189('0x6')&&typeof _0x8d61d1['limit']===_0xb189('0x6');var _0x81d4ed=_0x29b5f1[_0xb189('0x7')];var _0x529348=_0x33f4ea?0x0:_0x8d61d1['offset'];var _0x5285d5=_0x33f4ea?_0x29b5f1[_0xb189('0x7')]:_0x8d61d1[_0xb189('0x5')]+_0x8d61d1[_0xb189('0x8')];var _0x1252f6;if(_0x5285d5>=_0x81d4ed){_0x5285d5=_0x81d4ed;_0x1252f6=0xc8;}else{_0x1252f6=0xce;}_0x26e2c4[_0xb189('0x9')](_0x1252f6);return _0x26e2c4[_0xb189('0xa')](_0xb189('0xb'),_0x529348+'-'+_0x5285d5+'/'+_0x81d4ed)[_0xb189('0xc')](_0x29b5f1);}return null;};}exports['getAgents']=function(_0x1cc709,_0x43db27){var _0x33a7a6={'count':0x0,'rows':[]};var _0x5ef8e9={};var _0x540036;var _0x56bbd1=utils['getChannels']();var _0x3368bd;var _0x31c0e6;var _0x28daca=_0x1cc709[_0xb189('0xd')][_0xb189('0xe')];var _0x986202=_0x1cc709[_0xb189('0xd')][_0xb189('0xf')];var _0xfe3fcc=_0x1cc709['query'][_0xb189('0x10')];var _0xfa2ef7=_0x986202==='pause'||_0x986202==='*pause'?!![]:![];var _0x40aae4=[];var _0x53b57b;var _0x25d093;Promise[_0xb189('0x11')]()[_0xb189('0x12')](function(){if(_0x1cc709[_0xb189('0xd')][_0xb189('0x13')]){if(!utils[_0xb189('0x14')](_0x1cc709[_0xb189('0xd')][_0xb189('0x13')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1cc709['query'][_0xb189('0x13')]));}_0x540036=_0x1cc709[_0xb189('0xd')][_0xb189('0x13')][_0xb189('0x15')]();}if(!_0x1cc709[_0xb189('0xd')]['sort']||!_0x1cc709['query'][_0xb189('0x16')][_0xb189('0x17')](_0xb189('0x18'))){_0x1cc709[_0xb189('0xd')][_0xb189('0x16')]=rta[_0xb189('0x19')](_0x1cc709['query'][_0xb189('0x16')]);return;}var _0x45524b=rta['getUpdatedSortOptions'](_0x1cc709['query'][_0xb189('0x16')]);_0x1cc709[_0xb189('0xd')][_0xb189('0x16')]=_0x45524b[_0xb189('0x1a')][_0xb189('0x1b')](',');_0x53b57b=_0x45524b[_0xb189('0x1c')];})['then'](function(){if(!_0x28daca){return[];}return rta[_0xb189('0x1d')](_0x28daca,_0x540036);})['then'](function(_0x4b0498){_0x40aae4=_0x4b0498;return rta[_0xb189('0x1e')]();})[_0xb189('0x12')](function(_0x50a1da){_0x31c0e6=_0x50a1da['rows'];if((!_0x986202||_0xfa2ef7)&&!_0x53b57b){return _0x40aae4;}if(_0x53b57b&&!_0x986202){return rta[_0xb189('0x1f')](_0x31c0e6,_0x40aae4,_0x53b57b);}else{return rta[_0xb189('0x20')](_0x31c0e6,_0x40aae4,_0x986202);}})[_0xb189('0x12')](function(_0x6bca47){_0x40aae4=_0x6bca47;var _0x41ceda=![];if(_0x40aae4[_0xb189('0x21')]===0x0){if(_0x28daca||_0x986202){_0x41ceda=!![];}if(_0xfa2ef7){_0x41ceda=![];}}if(_0x41ceda){return _0x33a7a6;}var _0x345489=_['map'](db[_0xb189('0x22')][_0xb189('0x23')],function(_0x36c385){return{'name':_0x36c385[_0xb189('0x24')],'type':_0x36c385['type']['key']};});_0x1cc709[_0xb189('0xd')][_0xb189('0x25')]=_0xb189('0x26');_0x5ef8e9=qs['getOptions'](_0x345489,_0x1cc709);_0x5ef8e9[_0xb189('0x27')]=!![];var _0x318c4e=[];if(_0x40aae4[_0xb189('0x21')]>0x0){_0x318c4e[_0xb189('0x28')]({'id':{'$in':_0x40aae4}});if(_0x53b57b&&!_0x986202){_0x25d093=[db[_0xb189('0x29')][_0xb189('0x2a')](_0xb189('0x2b')+_0x40aae4+')')];_0x5ef8e9[_0xb189('0x1c')]=_0x25d093;}}if(_0xfa2ef7){_0x56bbd1[_0xb189('0x2c')](function(_0x393b9e){var _0x526794=!![];if(_0x986202===_0xb189('0x2d')&&_0x540036!==_0x393b9e){_0x526794=![];}_0x318c4e['push']({[_0x393b9e+'Pause']:_0x526794});});if(_0xfe3fcc){_0x318c4e['push']({'pauseType':_0xfe3fcc});}}else if(_0x986202){_0x56bbd1[_0xb189('0x2c')](function(_0x16e3c3){_0x318c4e[_0xb189('0x28')]({[_0x16e3c3+_0xb189('0x2e')]:![]});});}_0x5ef8e9[_0xb189('0x2f')]=_['merge'](_0x5ef8e9[_0xb189('0x2f')],{'$and':_0x318c4e});if(_0x1cc709[_0xb189('0x30')][_0xb189('0x25')]===_0xb189('0x30')){var _0x40947c={'params':{'id':_0x1cc709['user'][_0xb189('0x31')]},'query':{'section':_0xb189('0x32'),'role':_0xb189('0x26'),'raw':!![],'ids':_0x40aae4,'customSorting':_0x25d093}};if(_0x1cc709[_0xb189('0xd')][_0xb189('0x33')]){_0x40947c[_0xb189('0xd')]['online']=!![];}if(_0xfa2ef7){_0x40947c[_0xb189('0xd')][_0xb189('0x34')]=_0x318c4e;}_0x40947c[_0xb189('0xd')]=Object[_0xb189('0x35')](_0x40947c[_0xb189('0xd')],_0x1cc709[_0xb189('0xd')]);return db[_0xb189('0x36')]['getResources'](_0x40947c);}return db[_0xb189('0x22')][_0xb189('0x37')](_0x5ef8e9);})['then'](function(_0x2c2cf9){_0x33a7a6[_0xb189('0x7')]=_0x2c2cf9[_0xb189('0x7')];_0x3368bd=_0x2c2cf9[_0xb189('0x38')];return _0x3368bd[_0xb189('0x39')](function(_0x5a5dec){var _0x32132d=_[_0xb189('0x3a')](_0x31c0e6,['id',_0x5a5dec['id']]);if(_0x32132d){var _0x1c9713=rta[_0xb189('0x3b')](_0x32132d);_[_0xb189('0x3c')](_0x5a5dec,_0x1c9713);}_0x5a5dec[_0xb189('0x18')]=rta[_0xb189('0x3d')](_0x5a5dec);if(_0x5a5dec[_0xb189('0x18')][_0xb189('0x17')]('pause')){_0x56bbd1[_0xb189('0x2c')](function(_0x558c7d){if(_0x5a5dec[_0x558c7d+_0xb189('0x2e')]){if(_0x558c7d===_0xb189('0x3e')){if(_0x5a5dec[_0xb189('0x3f')]!==_0xb189('0x40')){_0x5a5dec['voiceStatus']=_0xb189('0x41');}}else{_0x5a5dec[_0x558c7d+'Status']=_0xb189('0x41');}}});}return _0x5a5dec;});})[_0xb189('0x12')](function(_0x4c49d7){if(!_0x53b57b||_0x25d093){return _0x4c49d7;}return rta[_0xb189('0x42')](_0x4c49d7,_0x53b57b);})[_0xb189('0x12')](function(_0x3ddbea){var _0x1380d0=rta[_0xb189('0x43')]();_0x33a7a6[_0xb189('0x38')]=_0x3ddbea[_0xb189('0x39')](function(_0x35f524){return _[_0xb189('0x44')](_0x35f524,_0x1380d0);});return _0x33a7a6;})[_0xb189('0x12')](respondWithFilteredResult(_0x43db27,_0x5ef8e9))['catch'](APIHandleError(_0x43db27));};exports[_0xb189('0x45')]=function(_0x4ae42d,_0x205440){var _0x586008={'count':0x0,'rows':[]};var _0x268d3b={};var _0x79db4c;var _0x3a8ab9;var _0x3d09ab;Promise[_0xb189('0x11')]()[_0xb189('0x12')](function(){if(_0x4ae42d[_0xb189('0xd')][_0xb189('0x13')]){if(!utils[_0xb189('0x14')](_0x4ae42d[_0xb189('0xd')]['channel'])){throw new APIBadRequestError(util[_0xb189('0x46')](_0xb189('0x47'),_0x4ae42d['query'][_0xb189('0x13')]));}_0x79db4c=_0x4ae42d[_0xb189('0xd')][_0xb189('0x13')][_0xb189('0x15')]();}var _0x3d6127=_[_0xb189('0x48')](_0x79db4c)+_0xb189('0x49');var _0x359a2c=_['map'](db[_0x3d6127][_0xb189('0x23')],function(_0x4f4389){return{'name':_0x4f4389[_0xb189('0x24')],'type':_0x4f4389[_0xb189('0x4a')]['key']};});if(!_0x4ae42d[_0xb189('0xd')]['fields']){var _0x2f8d09=['id',_0xb189('0x4b')];if(_0x79db4c===_0xb189('0x3e')){_0x2f8d09[_0xb189('0x28')]('type');if(_0x4ae42d[_0xb189('0xd')][_0xb189('0x4a')]===_0xb189('0x4c')){_0x2f8d09['push']([_0xb189('0x4d'),'dialMethod']);}}_0x4ae42d[_0xb189('0xd')][_0xb189('0x1a')]=_0x2f8d09[_0xb189('0x1b')](',');}_0x268d3b=qs[_0xb189('0x4e')](_0x359a2c,_0x4ae42d);if(_0x4ae42d[_0xb189('0x30')][_0xb189('0x25')]==='user'){var _0x32b441={'params':{'id':_0x4ae42d[_0xb189('0x30')][_0xb189('0x31')]},'query':{'section':_0x79db4c===_0xb189('0x3e')&&_0x4ae42d[_0xb189('0xd')][_0xb189('0x4a')]==='outbound'?_0xb189('0x4f'):_[_0xb189('0x48')](_0x79db4c)+_0xb189('0x50'),'type':_0x4ae42d['query'][_0xb189('0x4a')],'nolimit':!![],'sort':_0xb189('0x4b'),'filter':_0x4ae42d[_0xb189('0xd')][_0xb189('0x51')]}};_0x32b441['query']=Object[_0xb189('0x35')](_0x32b441[_0xb189('0xd')],_0x4ae42d[_0xb189('0xd')]);delete _0x32b441[_0xb189('0xd')]['id'];return db[_0xb189('0x36')][_0xb189('0x52')](_0x32b441);}return db[_0x3d6127][_0xb189('0x37')](_0x268d3b);})[_0xb189('0x12')](function(_0x53c183){_0x586008[_0xb189('0x7')]=_0x53c183[_0xb189('0x7')];_0x3a8ab9=_0x53c183[_0xb189('0x38')];return rtq[_0xb189('0x53')](_0x4ae42d,_0x79db4c);})['then'](function(_0x4e047a){_0x3d09ab=_0x4e047a[_0xb189('0x38')];return rtq[_0xb189('0x54')](_0x3a8ab9,_0x3d09ab,_0x79db4c,_0x4ae42d[_0xb189('0xd')][_0xb189('0x4a')]);})[_0xb189('0x12')](function(_0x396950){_0x586008[_0xb189('0x38')]=_0x396950;return _0x586008;})[_0xb189('0x12')](respondWithFilteredResult(_0x205440,_0x268d3b))[_0xb189('0x55')](APIHandleError(_0x205440));}; \ No newline at end of file +var _0x58bb=['limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','getRealtimeAgents','getSortedAgentsIdsByStatus','length','map','fieldName','type','role','getOptions','raw','push','order','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','rows','find','filterAgentAttributes','globalStatus','getAgentStatus','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','rawAttributes','fields','outbound','dialActive','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0x58bb,0x1e3));var _0xb58b=function(_0x99ef8d,_0x1222b8){_0x99ef8d=_0x99ef8d-0x0;var _0x9ccd5d=_0x58bb[_0x99ef8d];return _0x9ccd5d;};'use strict';var _=require('lodash');var util=require(_0xb58b('0x0'));var rta=require(_0xb58b('0x1'));var rtq=require(_0xb58b('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xb58b('0x3'));var db=require(_0xb58b('0x4'))['db'];var APIBadRequestError=require(_0xb58b('0x5'))['APIBadRequestError'];var APIHandleError=require(_0xb58b('0x5'))[_0xb58b('0x6')];function respondWithFilteredResult(_0x50a9a7,_0x16f504){return function(_0x39f7ca){if(_0x39f7ca){var _0x397e18=typeof _0x16f504[_0xb58b('0x7')]===_0xb58b('0x8')&&typeof _0x16f504[_0xb58b('0x9')]===_0xb58b('0x8');var _0x53b71c=_0x39f7ca[_0xb58b('0xa')];var _0xc46322=_0x397e18?0x0:_0x16f504[_0xb58b('0x7')];var _0x50fdfd=_0x397e18?_0x39f7ca[_0xb58b('0xa')]:_0x16f504[_0xb58b('0x7')]+_0x16f504['limit'];var _0xf5d9b7;if(_0x50fdfd>=_0x53b71c){_0x50fdfd=_0x53b71c;_0xf5d9b7=0xc8;}else{_0xf5d9b7=0xce;}_0x50a9a7[_0xb58b('0xb')](_0xf5d9b7);return _0x50a9a7[_0xb58b('0xc')](_0xb58b('0xd'),_0xc46322+'-'+_0x50fdfd+'/'+_0x53b71c)[_0xb58b('0xe')](_0x39f7ca);}return null;};}exports[_0xb58b('0xf')]=function(_0x49af2d,_0x2306e3){var _0x271fc9={'count':0x0,'rows':[]};var _0x2ab52={};var _0xde53cb;var _0x284f18=utils[_0xb58b('0x10')]();var _0x209e53;var _0x4f9dc6;var _0x22e4a8=_0x49af2d[_0xb58b('0x11')][_0xb58b('0x12')];var _0x323156=_0x49af2d[_0xb58b('0x11')][_0xb58b('0x13')];var _0x213044=_0x49af2d[_0xb58b('0x11')][_0xb58b('0x14')];var _0x501860=_0x323156==='pause'||_0x323156===_0xb58b('0x15')?!![]:![];var _0x3d6585=[];var _0x508c78;var _0x215ce6;Promise[_0xb58b('0x16')]()[_0xb58b('0x17')](function(){if(_0x49af2d[_0xb58b('0x11')][_0xb58b('0x18')]){if(!utils['isValidChannel'](_0x49af2d[_0xb58b('0x11')][_0xb58b('0x18')])){throw new APIBadRequestError(util['format'](_0xb58b('0x19'),_0x49af2d[_0xb58b('0x11')][_0xb58b('0x18')]));}_0xde53cb=_0x49af2d['query']['channel'][_0xb58b('0x1a')]();}if(!_0x49af2d[_0xb58b('0x11')]['sort']||!_0x49af2d['query'][_0xb58b('0x1b')][_0xb58b('0x1c')]('globalStatus')){_0x49af2d['query'][_0xb58b('0x1b')]=rta[_0xb58b('0x1d')](_0x49af2d[_0xb58b('0x11')][_0xb58b('0x1b')]);return;}var _0x5856fb=rta[_0xb58b('0x1e')](_0x49af2d[_0xb58b('0x11')][_0xb58b('0x1b')]);_0x49af2d[_0xb58b('0x11')]['sort']=_0x5856fb['fields']['join'](',');_0x508c78=_0x5856fb['order'];})[_0xb58b('0x17')](function(){if(!_0x22e4a8){return[];}return rta['getAgentIdsByQueues'](_0x22e4a8,_0xde53cb);})['then'](function(_0x4aa54d){_0x3d6585=_0x4aa54d;return rta[_0xb58b('0x1f')]();})[_0xb58b('0x17')](function(_0x811619){_0x4f9dc6=_0x811619['rows'];if((!_0x323156||_0x501860)&&!_0x508c78){return _0x3d6585;}if(_0x508c78&&!_0x323156){return rta[_0xb58b('0x20')](_0x4f9dc6,_0x3d6585,_0x508c78);}else{return rta['getAgentIdsByStatus'](_0x4f9dc6,_0x3d6585,_0x323156);}})[_0xb58b('0x17')](function(_0x28f587){_0x3d6585=_0x28f587;var _0x38b05d=![];if(_0x3d6585[_0xb58b('0x21')]===0x0){if(_0x22e4a8||_0x323156){_0x38b05d=!![];}if(_0x501860){_0x38b05d=![];}}if(_0x38b05d){return _0x271fc9;}var _0x3c5eb5=_[_0xb58b('0x22')](db['User']['rawAttributes'],function(_0x335beb){return{'name':_0x335beb[_0xb58b('0x23')],'type':_0x335beb[_0xb58b('0x24')]['key']};});_0x49af2d[_0xb58b('0x11')][_0xb58b('0x25')]='agent';_0x2ab52=qs[_0xb58b('0x26')](_0x3c5eb5,_0x49af2d);_0x2ab52[_0xb58b('0x27')]=!![];var _0xaee6c4=[];if(_0x3d6585['length']>0x0){_0xaee6c4[_0xb58b('0x28')]({'id':{'$in':_0x3d6585}});if(_0x508c78&&!_0x323156){_0x215ce6=[db['sequelize']['literal']('FIELD(id,'+_0x3d6585+')')];_0x2ab52[_0xb58b('0x29')]=_0x215ce6;}}if(_0x501860){_0x284f18[_0xb58b('0x2a')](function(_0x2b1c6e){var _0x866701=!![];if(_0x323156===_0xb58b('0x15')&&_0xde53cb!==_0x2b1c6e){_0x866701=![];}_0xaee6c4['push']({[_0x2b1c6e+_0xb58b('0x2b')]:_0x866701});});if(_0x213044){_0xaee6c4[_0xb58b('0x28')]({'pauseType':_0x213044});}}else if(_0x323156){_0x284f18['forEach'](function(_0x11889b){_0xaee6c4[_0xb58b('0x28')]({[_0x11889b+_0xb58b('0x2b')]:![]});});}_0x2ab52[_0xb58b('0x2c')]=_[_0xb58b('0x2d')](_0x2ab52[_0xb58b('0x2c')],{'$and':_0xaee6c4});if(_0x49af2d['user'][_0xb58b('0x25')]==='user'){var _0x5a2c9e={'params':{'id':_0x49af2d[_0xb58b('0x2e')][_0xb58b('0x2f')]},'query':{'section':_0xb58b('0x30'),'role':'agent','raw':!![],'ids':_0x3d6585,'customSorting':_0x215ce6}};if(_0x49af2d['query'][_0xb58b('0x31')]){_0x5a2c9e[_0xb58b('0x11')][_0xb58b('0x31')]=!![];}if(_0x501860){_0x5a2c9e[_0xb58b('0x11')][_0xb58b('0x32')]=_0xaee6c4;}_0x5a2c9e[_0xb58b('0x11')]=Object[_0xb58b('0x33')](_0x5a2c9e[_0xb58b('0x11')],_0x49af2d[_0xb58b('0x11')]);return db[_0xb58b('0x34')][_0xb58b('0x35')](_0x5a2c9e);}return db[_0xb58b('0x36')][_0xb58b('0x37')](_0x2ab52);})[_0xb58b('0x17')](function(_0x4f1d65){_0x271fc9[_0xb58b('0xa')]=_0x4f1d65[_0xb58b('0xa')];_0x209e53=_0x4f1d65[_0xb58b('0x38')];return _0x209e53['map'](function(_0x4d6b37){var _0x165175=_[_0xb58b('0x39')](_0x4f9dc6,['id',_0x4d6b37['id']]);if(_0x165175){var _0x75fe8f=rta[_0xb58b('0x3a')](_0x165175);_[_0xb58b('0x2d')](_0x4d6b37,_0x75fe8f);}_0x4d6b37[_0xb58b('0x3b')]=rta[_0xb58b('0x3c')](_0x4d6b37);if(_0x4d6b37[_0xb58b('0x3b')][_0xb58b('0x1c')](_0xb58b('0x3d'))){_0x284f18[_0xb58b('0x2a')](function(_0x376ad4){if(_0x4d6b37[_0x376ad4+'Pause']){if(_0x376ad4===_0xb58b('0x3e')){if(_0x4d6b37[_0xb58b('0x3f')]!==_0xb58b('0x40')){_0x4d6b37['voiceStatus']='pause';}}else{_0x4d6b37[_0x376ad4+_0xb58b('0x41')]=_0xb58b('0x3d');}}});}return _0x4d6b37;});})[_0xb58b('0x17')](function(_0x497413){if(!_0x508c78||_0x215ce6){return _0x497413;}return rta[_0xb58b('0x42')](_0x497413,_0x508c78);})['then'](function(_0x2c79be){var _0x21e414=rta[_0xb58b('0x43')]();_0x271fc9['rows']=_0x2c79be['map'](function(_0xc1d0fb){return _[_0xb58b('0x44')](_0xc1d0fb,_0x21e414);});return _0x271fc9;})[_0xb58b('0x17')](respondWithFilteredResult(_0x2306e3,_0x2ab52))[_0xb58b('0x45')](APIHandleError(_0x2306e3));};exports[_0xb58b('0x46')]=function(_0x869adf,_0xf0daf8){var _0x4bdd22={'count':0x0,'rows':[]};var _0x55ce6b={};var _0x48eb36;var _0x1ad555;var _0x5604fb;Promise[_0xb58b('0x16')]()[_0xb58b('0x17')](function(){if(_0x869adf[_0xb58b('0x11')]['channel']){if(!utils['isValidChannel'](_0x869adf[_0xb58b('0x11')][_0xb58b('0x18')])){throw new APIBadRequestError(util['format'](_0xb58b('0x19'),_0x869adf[_0xb58b('0x11')][_0xb58b('0x18')]));}_0x48eb36=_0x869adf[_0xb58b('0x11')][_0xb58b('0x18')][_0xb58b('0x1a')]();}var _0x117a90=_[_0xb58b('0x47')](_0x48eb36)+_0xb58b('0x48');var _0x18d731=_['map'](db[_0x117a90][_0xb58b('0x49')],function(_0x1d7fc6){return{'name':_0x1d7fc6[_0xb58b('0x23')],'type':_0x1d7fc6[_0xb58b('0x24')]['key']};});if(!_0x869adf[_0xb58b('0x11')][_0xb58b('0x4a')]){var _0x216f35=['id','name'];if(_0x48eb36===_0xb58b('0x3e')){_0x216f35['push'](_0xb58b('0x24'));if(_0x869adf[_0xb58b('0x11')][_0xb58b('0x24')]===_0xb58b('0x4b')){_0x216f35[_0xb58b('0x28')]([_0xb58b('0x4c'),'dialMethod']);}}_0x869adf[_0xb58b('0x11')][_0xb58b('0x4a')]=_0x216f35['join'](',');}_0x55ce6b=qs[_0xb58b('0x26')](_0x18d731,_0x869adf);if(_0x869adf[_0xb58b('0x2e')]['role']===_0xb58b('0x2e')){var _0x39f14e={'params':{'id':_0x869adf[_0xb58b('0x2e')][_0xb58b('0x2f')]},'query':{'section':_0x48eb36==='voice'&&_0x869adf[_0xb58b('0x11')][_0xb58b('0x24')]==='outbound'?_0xb58b('0x4d'):_[_0xb58b('0x47')](_0x48eb36)+_0xb58b('0x4e'),'type':_0x869adf['query'][_0xb58b('0x24')],'nolimit':!![],'sort':'name','filter':_0x869adf[_0xb58b('0x11')][_0xb58b('0x4f')]}};_0x39f14e[_0xb58b('0x11')]=Object[_0xb58b('0x33')](_0x39f14e[_0xb58b('0x11')],_0x869adf[_0xb58b('0x11')]);delete _0x39f14e[_0xb58b('0x11')]['id'];return db[_0xb58b('0x34')][_0xb58b('0x35')](_0x39f14e);}return db[_0x117a90][_0xb58b('0x37')](_0x55ce6b);})[_0xb58b('0x17')](function(_0x2be0b2){_0x4bdd22['count']=_0x2be0b2[_0xb58b('0xa')];_0x1ad555=_0x2be0b2[_0xb58b('0x38')];return rtq[_0xb58b('0x50')](_0x869adf,_0x48eb36);})[_0xb58b('0x17')](function(_0x2db302){_0x5604fb=_0x2db302['rows'];return rtq[_0xb58b('0x51')](_0x1ad555,_0x5604fb,_0x48eb36,_0x869adf[_0xb58b('0x11')][_0xb58b('0x24')]);})['then'](function(_0x39cd2c){_0x4bdd22['rows']=_0x39cd2c;return _0x4bdd22;})['then'](respondWithFilteredResult(_0xf0daf8,_0x55ce6b))[_0xb58b('0x45')](APIHandleError(_0xf0daf8));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 3e1432f..db51596 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55e28f,_0x20cedb){var _0xee48e9=function(_0x1de3df){while(--_0x1de3df){_0x55e28f['push'](_0x55e28f['shift']());}};_0xee48e9(++_0x20cedb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1472f4,_0x25f732){var _0xf372e7=function(_0x5d1660){while(--_0x5d1660){_0x1472f4['push'](_0x1472f4['shift']());}};_0xf372e7(++_0x25f732);}(_0xe706,0xa3));var _0x6e70=function(_0x48b4f9,_0xbbe897){_0x48b4f9=_0x48b4f9-0x0;var _0x30dda9=_0xe706[_0x48b4f9];return _0x30dda9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b2bec5e..dfb9f03 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 _0x744c=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x744c,0xa0));var _0xc744=function(_0x5ef539,_0x4217c9){_0x5ef539=_0x5ef539-0x0;var _0x2be138=_0x744c[_0x5ef539];return _0x2be138;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'state':{'type':Sequelize[_0xc744('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc744('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc744('0x3')]},'starttime':{'type':Sequelize[_0xc744('0x4')]},'responsetime':{'type':Sequelize[_0xc744('0x4')]},'ringtime':{'type':Sequelize[_0xc744('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc744('0x3')]}}; \ No newline at end of file +var _0x7217=['STRING','DATE','sequelize','INTEGER'];(function(_0x1b1324,_0x4128e6){var _0x19b15d=function(_0x3ac2b5){while(--_0x3ac2b5){_0x1b1324['push'](_0x1b1324['shift']());}};_0x19b15d(++_0x4128e6);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'state':{'type':Sequelize[_0x7721('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7721('0x2')]},'scheduledat':{'type':Sequelize[_0x7721('0x3')]},'uniqueid':{'type':Sequelize[_0x7721('0x2')]},'starttime':{'type':Sequelize[_0x7721('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7721('0x2')]},'campaigntype':{'type':Sequelize[_0x7721('0x2')]},'membername':{'type':Sequelize[_0x7721('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0fa9ee7..9d43db5 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 _0x929f=['rimraf','exports','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','path'];(function(_0x477e43,_0x580445){var _0x1f0635=function(_0x362392){while(--_0x362392){_0x477e43['push'](_0x477e43['shift']());}};_0x1f0635(++_0x580445);}(_0x929f,0xbc));var _0xf929=function(_0x34470b,_0x584b60){_0x34470b=_0x34470b-0x0;var _0xdf5767=_0x929f[_0x34470b];return _0xdf5767;};'use strict';var _=require('lodash');var util=require(_0xf929('0x0'));var logger=require(_0xf929('0x1'))(_0xf929('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf929('0x3'));var rimraf=require(_0xf929('0x4'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xf929('0x5')]=function(_0x527c07,_0x4b17bf){return _0x527c07['define'](_0xf929('0x6'),attributes,{'tableName':_0xf929('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf12f=['exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x44809f,_0x11183f){var _0x35b7ea=function(_0x1d5101){while(--_0x1d5101){_0x44809f['push'](_0x44809f['shift']());}};_0x35b7ea(++_0x11183f);}(_0xf12f,0xa9));var _0xff12=function(_0x5437ca,_0x106fda){_0x5437ca=_0x5437ca-0x0;var _0x160be9=_0xf12f[_0x5437ca];return _0x160be9;};'use strict';var _=require(_0xff12('0x0'));var util=require('util');var logger=require(_0xff12('0x1'))('api');var moment=require(_0xff12('0x2'));var BPromise=require(_0xff12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff12('0x4'));var config=require(_0xff12('0x5'));var attributes=require(_0xff12('0x6'));module[_0xff12('0x7')]=function(_0x45ce78,_0xe14e70){return _0x45ce78[_0xff12('0x8')](_0xff12('0x9'),attributes,{'tableName':_0xff12('0xa'),'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 dc6a2a3..adb9a10 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 _0x039f=['result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x1e5851,_0x429dd4){var _0x490574=function(_0x42e304){while(--_0x42e304){_0x1e5851['push'](_0x1e5851['shift']());}};_0x490574(++_0x429dd4);}(_0x039f,0x67));var _0xf039=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x039f[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf039('0x0'));var BPromise=require('bluebird');var rs=require(_0xf039('0x1'));var fs=require('fs');var Redis=require(_0xf039('0x2'));var db=require(_0xf039('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf039('0x4'));var jayson=require(_0xf039('0x5'));var client=jayson[_0xf039('0x6')][_0xf039('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xca2365,_0x4be8ea,_0x190d77){return new BPromise(function(_0x5c0cef,_0x13bade){return client[_0xf039('0x8')](_0xca2365,_0x190d77)[_0xf039('0x9')](function(_0x4c2895){logger[_0xf039('0xa')](_0xf039('0xb'),_0x4be8ea,'request\x20sent');logger[_0xf039('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4be8ea,'request\x20sent',JSON[_0xf039('0xd')](_0x4c2895));if(_0x4c2895[_0xf039('0xe')]){if(_0x4c2895[_0xf039('0xe')][_0xf039('0xf')]===0x1f4){logger['error'](_0xf039('0xb'),_0x4be8ea,_0x4c2895['error']['message']);return _0x13bade(_0x4c2895['error'][_0xf039('0x10')]);}logger[_0xf039('0xe')](_0xf039('0xb'),_0x4be8ea,_0x4c2895['error'][_0xf039('0x10')]);return _0x5c0cef(_0x4c2895[_0xf039('0xe')][_0xf039('0x10')]);}else{logger[_0xf039('0xa')](_0xf039('0xb'),_0x4be8ea,'request\x20sent');_0x5c0cef(_0x4c2895[_0xf039('0x11')]['message']);}})[_0xf039('0x12')](function(_0x4cbaff){logger[_0xf039('0xe')](_0xf039('0xb'),_0x4be8ea,_0x4cbaff);_0x13bade(_0x4cbaff);});});}exports[_0xf039('0x13')]=function(_0x5d346c){var _0x525cd8=this;return new Promise(function(_0x4d24bd,_0x23bc27){return db[_0xf039('0x14')]['create'](_0x5d346c[_0xf039('0x15')],{'raw':_0x5d346c[_0xf039('0x16')]?_0x5d346c[_0xf039('0x16')][_0xf039('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x17c775){logger[_0xf039('0xa')](_0xf039('0x13'),_0x5d346c);logger[_0xf039('0xc')](_0xf039('0x13'),_0x5d346c,JSON['stringify'](_0x17c775));_0x4d24bd(_0x17c775);})[_0xf039('0x12')](function(_0x507546){logger['error'](_0xf039('0x13'),_0x507546[_0xf039('0x10')],_0x5d346c);_0x23bc27(_0x525cd8[_0xf039('0xe')](0x1f4,_0x507546[_0xf039('0x10')]));});});}; \ No newline at end of file +var _0xf773=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x589f82,_0x46ce05){var _0x29615f=function(_0xc04a44){while(--_0xc04a44){_0x589f82['push'](_0x589f82['shift']());}};_0x29615f(++_0x46ce05);}(_0xf773,0x154));var _0x3f77=function(_0x53dc1c,_0xa62198){_0x53dc1c=_0x53dc1c-0x0;var _0x2aff50=_0xf773[_0x53dc1c];return _0x2aff50;};'use strict';var _=require(_0x3f77('0x0'));var util=require(_0x3f77('0x1'));var moment=require(_0x3f77('0x2'));var BPromise=require(_0x3f77('0x3'));var rs=require(_0x3f77('0x4'));var fs=require('fs');var Redis=require(_0x3f77('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f77('0x6'))('rpc');var config=require(_0x3f77('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3f77('0x8')][_0x3f77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c4049,_0x4ecbd0,_0x3cbc43){return new BPromise(function(_0x2a855a,_0x2f215d){return client[_0x3f77('0xa')](_0x4c4049,_0x3cbc43)['then'](function(_0x5c7cee){logger[_0x3f77('0xb')](_0x3f77('0xc'),_0x4ecbd0,_0x3f77('0xd'));logger[_0x3f77('0xe')](_0x3f77('0xf'),_0x4ecbd0,'request\x20sent',JSON[_0x3f77('0x10')](_0x5c7cee));if(_0x5c7cee[_0x3f77('0x11')]){if(_0x5c7cee[_0x3f77('0x11')]['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4ecbd0,_0x5c7cee['error']['message']);return _0x2f215d(_0x5c7cee[_0x3f77('0x11')][_0x3f77('0x12')]);}logger[_0x3f77('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ecbd0,_0x5c7cee[_0x3f77('0x11')][_0x3f77('0x12')]);return _0x2a855a(_0x5c7cee[_0x3f77('0x11')][_0x3f77('0x12')]);}else{logger[_0x3f77('0xb')](_0x3f77('0xc'),_0x4ecbd0,'request\x20sent');_0x2a855a(_0x5c7cee[_0x3f77('0x13')][_0x3f77('0x12')]);}})['catch'](function(_0x24adba){logger[_0x3f77('0x11')](_0x3f77('0xc'),_0x4ecbd0,_0x24adba);_0x2f215d(_0x24adba);});});}exports[_0x3f77('0x14')]=function(_0x327eb4){var _0x4eef1a=this;return new Promise(function(_0x1aedaf,_0x1e8d7d){return db[_0x3f77('0x15')][_0x3f77('0x16')](_0x327eb4[_0x3f77('0x17')],{'raw':_0x327eb4[_0x3f77('0x18')]?_0x327eb4['options'][_0x3f77('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x37ef47){logger[_0x3f77('0xb')](_0x3f77('0x14'),_0x327eb4);logger[_0x3f77('0xe')](_0x3f77('0x14'),_0x327eb4,JSON[_0x3f77('0x10')](_0x37ef47));_0x1aedaf(_0x37ef47);})['catch'](function(_0x5303c9){logger['error'](_0x3f77('0x14'),_0x5303c9[_0x3f77('0x12')],_0x327eb4);_0x1e8d7d(_0x4eef1a[_0x3f77('0x11')](0x1f4,_0x5303c9[_0x3f77('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 50d1628..3fa7e02 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 _0x1624=['/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/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','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x3d47b4,_0x19034c){var _0x45728f=function(_0x389641){while(--_0x389641){_0x3d47b4['push'](_0x3d47b4['shift']());}};_0x45728f(++_0x19034c);}(_0x1624,0x100));var _0x4162=function(_0x2431f7,_0x3ae3a1){_0x2431f7=_0x2431f7-0x0;var _0x3379a0=_0x1624[_0x2431f7];return _0x3379a0;};'use strict';var multer=require(_0x4162('0x0'));var util=require(_0x4162('0x1'));var path=require(_0x4162('0x2'));var express=require(_0x4162('0x3'));var router=express['Router']();var auth=require(_0x4162('0x4'));var controller=require('./rpc.controller');router[_0x4162('0x5')](_0x4162('0x6'),auth[_0x4162('0x7')](),controller[_0x4162('0x8')]);router[_0x4162('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x4162('0x7')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4162('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x4162('0x5')](_0x4162('0x9'),auth[_0x4162('0x7')](),controller['voiceQueues']);router[_0x4162('0x5')](_0x4162('0xa'),auth[_0x4162('0x7')](),controller[_0x4162('0xb')]);router[_0x4162('0x5')]('/mail/queues',auth[_0x4162('0x7')](),controller[_0x4162('0xc')]);router['get'](_0x4162('0xd'),auth[_0x4162('0x7')](),controller[_0x4162('0xe')]);router[_0x4162('0x5')](_0x4162('0xf'),auth[_0x4162('0x7')](),controller[_0x4162('0x10')]);router[_0x4162('0x5')](_0x4162('0x11'),auth[_0x4162('0x7')](),controller[_0x4162('0x12')]);router[_0x4162('0x5')](_0x4162('0x13'),auth['isAuthenticated'](),controller[_0x4162('0x14')]);router[_0x4162('0x5')](_0x4162('0x15'),auth[_0x4162('0x7')](),controller[_0x4162('0x16')]);router['get'](_0x4162('0x17'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x4162('0x5')](_0x4162('0x18'),auth[_0x4162('0x7')](),controller[_0x4162('0x19')]);router['get'](_0x4162('0x1a'),auth[_0x4162('0x7')](),controller[_0x4162('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x4162('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0x4162('0x1c'),auth[_0x4162('0x7')](),controller[_0x4162('0x1d')]);router[_0x4162('0x5')](_0x4162('0x1e'),auth[_0x4162('0x7')](),controller[_0x4162('0x1f')]);router['put'](_0x4162('0x1e'),auth[_0x4162('0x7')](),controller[_0x4162('0x20')]);router['get'](_0x4162('0x21'),auth[_0x4162('0x7')](),controller[_0x4162('0x22')]);router['get'](_0x4162('0x23'),auth['isAuthenticated'](),controller[_0x4162('0x24')]);router[_0x4162('0x5')](_0x4162('0x25'),auth['isAuthenticated'](),controller[_0x4162('0x26')]);router[_0x4162('0x27')](_0x4162('0x28'),auth[_0x4162('0x7')](),controller[_0x4162('0x29')]);router[_0x4162('0x5')](_0x4162('0x2a'),auth[_0x4162('0x7')](),controller['telephones']);router[_0x4162('0x5')](_0x4162('0x2b'),auth[_0x4162('0x7')](),controller[_0x4162('0x2c')]);router['get'](_0x4162('0x2d'),auth['isAuthenticated'](),controller[_0x4162('0x2e')]);router['get'](_0x4162('0x2f'),auth[_0x4162('0x7')](),controller[_0x4162('0x30')]);router[_0x4162('0x5')](_0x4162('0x31'),auth[_0x4162('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x4162('0x5')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x4162('0x32')]);router[_0x4162('0x5')](_0x4162('0x33'),auth[_0x4162('0x7')](),controller[_0x4162('0x34')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x4162('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x4162('0x5')](_0x4162('0x35'),auth['isAuthenticated'](),controller[_0x4162('0x36')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x4162('0x37')]);router['get'](_0x4162('0x38'),auth[_0x4162('0x7')](),controller[_0x4162('0x39')]);router[_0x4162('0x3a')](_0x4162('0x3b'),auth['isAuthenticated'](),controller[_0x4162('0x3c')]('mail'));router[_0x4162('0x5')](_0x4162('0x3d'),auth['isAuthenticated'](),controller[_0x4162('0x3e')]);router[_0x4162('0x3a')](_0x4162('0x3f'),auth[_0x4162('0x7')](),controller[_0x4162('0x3c')]('chat'));router[_0x4162('0x5')](_0x4162('0x40'),auth['isAuthenticated'](),controller[_0x4162('0x41')]);router[_0x4162('0x3a')]('/fax/queues/:id/notify',auth[_0x4162('0x7')](),controller[_0x4162('0x3c')]('fax'));router['get'](_0x4162('0x42'),auth['isAuthenticated'](),controller[_0x4162('0x43')]);router[_0x4162('0x3a')]('/openchannel/queues/:id/notify',auth[_0x4162('0x7')](),controller['queueNotify'](_0x4162('0x44')));router['get']('/openchannel/queues/:id',auth[_0x4162('0x7')](),controller[_0x4162('0x45')]);router[_0x4162('0x3a')]('/sms/queues/:id/notify',auth[_0x4162('0x7')](),controller['queueNotify'](_0x4162('0x46')));router['post'](_0x4162('0x47'),auth[_0x4162('0x7')](),controller[_0x4162('0x3c')](_0x4162('0x48')));router[_0x4162('0x5')](_0x4162('0x49'),auth['isAuthenticated'](),controller[_0x4162('0x4a')]);router[_0x4162('0x5')]('/whatsapp/queues/:id',auth[_0x4162('0x7')](),controller[_0x4162('0x4b')]);router['post'](_0x4162('0x4c'),auth[_0x4162('0x7')](),controller['agentNotify']);module[_0x4162('0x4d')]=router; \ No newline at end of file +var _0xd76b=['/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','./rpc.controller','get','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues'];(function(_0x145acc,_0x4fb273){var _0x4d3c2e=function(_0xa9100e){while(--_0xa9100e){_0x145acc['push'](_0x145acc['shift']());}};_0x4d3c2e(++_0x4fb273);}(_0xd76b,0x11a));var _0xbd76=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd76b[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xbd76('0x0'));var util=require(_0xbd76('0x1'));var path=require('path');var express=require(_0xbd76('0x2'));var router=express[_0xbd76('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xbd76('0x4'));router[_0xbd76('0x5')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router[_0xbd76('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xbd76('0x6')](),controller[_0xbd76('0x7')]);router[_0xbd76('0x5')](_0xbd76('0x8'),auth[_0xbd76('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xbd76('0x5')](_0xbd76('0x9'),auth[_0xbd76('0x6')](),controller['voiceQueues']);router[_0xbd76('0x5')](_0xbd76('0xa'),auth[_0xbd76('0x6')](),controller[_0xbd76('0xb')]);router[_0xbd76('0x5')]('/mail/queues',auth[_0xbd76('0x6')](),controller[_0xbd76('0xc')]);router['get'](_0xbd76('0xd'),auth[_0xbd76('0x6')](),controller[_0xbd76('0xe')]);router[_0xbd76('0x5')](_0xbd76('0xf'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x10')]);router[_0xbd76('0x5')](_0xbd76('0x11'),auth[_0xbd76('0x6')](),controller['smsQueues']);router[_0xbd76('0x5')](_0xbd76('0x12'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x13')]);router[_0xbd76('0x5')]('/fax/queues',auth[_0xbd76('0x6')](),controller[_0xbd76('0x14')]);router[_0xbd76('0x5')](_0xbd76('0x15'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x16')]);router[_0xbd76('0x5')](_0xbd76('0x17'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x18')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xbd76('0x6')](),controller[_0xbd76('0x19')]);router[_0xbd76('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xbd76('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xbd76('0x5')](_0xbd76('0x1a'),auth['isAuthenticated'](),controller[_0xbd76('0x1b')]);router['get'](_0xbd76('0x1c'),auth['isAuthenticated'](),controller[_0xbd76('0x1d')]);router[_0xbd76('0x1e')](_0xbd76('0x1c'),auth[_0xbd76('0x6')](),controller['updateVoiceQueue']);router[_0xbd76('0x5')]('/outbound',auth[_0xbd76('0x6')](),controller[_0xbd76('0x1f')]);router['get'](_0xbd76('0x20'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x21')]);router['get'](_0xbd76('0x22'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x23')]);router[_0xbd76('0x1e')](_0xbd76('0x24'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x25')]);router[_0xbd76('0x5')]('/telephones',auth[_0xbd76('0x6')](),controller[_0xbd76('0x26')]);router[_0xbd76('0x5')]('/trunks',auth[_0xbd76('0x6')](),controller[_0xbd76('0x27')]);router[_0xbd76('0x5')](_0xbd76('0x28'),auth[_0xbd76('0x6')](),controller['campaigns']);router['get'](_0xbd76('0x29'),auth['isAuthenticated'](),controller[_0xbd76('0x2a')]);router['get']('/chat/queues/waitinginteractions',auth[_0xbd76('0x6')](),controller[_0xbd76('0x2b')]);router[_0xbd76('0x5')]('/mail/queues/waitinginteractions',auth[_0xbd76('0x6')](),controller[_0xbd76('0x2c')]);router['get'](_0xbd76('0x2d'),auth[_0xbd76('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0xbd76('0x5')](_0xbd76('0x2e'),auth[_0xbd76('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xbd76('0x5')](_0xbd76('0x2f'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x30')]);router[_0xbd76('0x5')](_0xbd76('0x31'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x32')]);router[_0xbd76('0x5')](_0xbd76('0x33'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x34')]);router['post'](_0xbd76('0x35'),auth[_0xbd76('0x6')](),controller['queueNotify'](_0xbd76('0x36')));router['get'](_0xbd76('0x37'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x38')]);router['post'](_0xbd76('0x39'),auth['isAuthenticated'](),controller[_0xbd76('0x3a')]('chat'));router[_0xbd76('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0xbd76('0x3b')](_0xbd76('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0xbd76('0x3d')));router[_0xbd76('0x5')](_0xbd76('0x3e'),auth['isAuthenticated'](),controller[_0xbd76('0x3f')]);router[_0xbd76('0x3b')](_0xbd76('0x40'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x3a')]('openchannel'));router[_0xbd76('0x5')](_0xbd76('0x41'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x42')]);router[_0xbd76('0x3b')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xbd76('0x3a')](_0xbd76('0x43')));router[_0xbd76('0x3b')]('/whatsapp/queues/:id/notify',auth[_0xbd76('0x6')](),controller[_0xbd76('0x3a')]('whatsapp'));router['get'](_0xbd76('0x44'),auth[_0xbd76('0x6')](),controller['showSmsQueues']);router['get'](_0xbd76('0x45'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x46')]);router[_0xbd76('0x3b')](_0xbd76('0x47'),auth[_0xbd76('0x6')](),controller[_0xbd76('0x48')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7404429..95fa251 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5aee36,_0x2f8708){var _0x882541=function(_0x5bdb43){while(--_0x5bdb43){_0x5aee36['push'](_0x5aee36['shift']());}};_0x882541(++_0x2f8708);}(_0xe706,0xa3));var _0x6e70=function(_0x530f50,_0x5da7d6){_0x530f50=_0x530f50-0x0;var _0x373031=_0xe706[_0x530f50];return _0x373031;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5e97c7,_0xc6a8ed){var _0x1f5eee=function(_0x1b1c30){while(--_0x1b1c30){_0x5e97c7['push'](_0x5e97c7['shift']());}};_0x1f5eee(++_0xc6a8ed);}(_0xe706,0xa3));var _0x6e70=function(_0x14d992,_0xa6ea84){_0x14d992=_0x14d992-0x0;var _0x10a29f=_0xe706[_0x14d992];return _0x10a29f;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index eb07d55..1e935bb 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 _0xc895=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./schedule.controller','isAuthenticated','index','get','show','/:id/run','post','create','put'];(function(_0x3c7243,_0x71d866){var _0x5e8bdb=function(_0x244cd9){while(--_0x244cd9){_0x3c7243['push'](_0x3c7243['shift']());}};_0x5e8bdb(++_0x71d866);}(_0xc895,0xcb));var _0x5c89=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xc895[_0x4394b6];return _0x360244;};'use strict';var multer=require(_0x5c89('0x0'));var util=require(_0x5c89('0x1'));var path=require(_0x5c89('0x2'));var timeout=require(_0x5c89('0x3'));var express=require(_0x5c89('0x4'));var router=express[_0x5c89('0x5')]();var fs_extra=require(_0x5c89('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c89('0x7'));var controller=require(_0x5c89('0x8'));router['get']('/',auth[_0x5c89('0x9')](),controller[_0x5c89('0xa')]);router[_0x5c89('0xb')]('/:id',auth[_0x5c89('0x9')](),controller[_0x5c89('0xc')]);router['get'](_0x5c89('0xd'),auth[_0x5c89('0x9')](),controller['run']);router[_0x5c89('0xe')]('/',auth[_0x5c89('0x9')](),controller[_0x5c89('0xf')]);router[_0x5c89('0x10')](_0x5c89('0x11'),auth[_0x5c89('0x9')](),controller[_0x5c89('0x12')]);router[_0x5c89('0x13')](_0x5c89('0x11'),auth['isAuthenticated'](),controller[_0x5c89('0x14')]);module[_0x5c89('0x15')]=router; \ No newline at end of file +var _0xa6c4=['./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ecde7,_0x44b804){var _0x3e08bb=function(_0x571d4c){while(--_0x571d4c){_0x3ecde7['push'](_0x3ecde7['shift']());}};_0x3e08bb(++_0x44b804);}(_0xa6c4,0x141));var _0x4a6c=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xa6c4[_0x685346];return _0x52e15b;};'use strict';var multer=require(_0x4a6c('0x0'));var util=require(_0x4a6c('0x1'));var path=require(_0x4a6c('0x2'));var timeout=require(_0x4a6c('0x3'));var express=require(_0x4a6c('0x4'));var router=express['Router']();var fs_extra=require(_0x4a6c('0x5'));var auth=require(_0x4a6c('0x6'));var interaction=require(_0x4a6c('0x7'));var config=require(_0x4a6c('0x8'));var controller=require(_0x4a6c('0x9'));router[_0x4a6c('0xa')]('/',auth[_0x4a6c('0xb')](),controller[_0x4a6c('0xc')]);router['get'](_0x4a6c('0xd'),auth[_0x4a6c('0xb')](),controller[_0x4a6c('0xe')]);router[_0x4a6c('0xa')](_0x4a6c('0xf'),auth[_0x4a6c('0xb')](),controller[_0x4a6c('0x10')]);router['post']('/',auth[_0x4a6c('0xb')](),controller[_0x4a6c('0x11')]);router[_0x4a6c('0x12')]('/:id',auth[_0x4a6c('0xb')](),controller['update']);router[_0x4a6c('0x13')](_0x4a6c('0xd'),auth[_0x4a6c('0xb')](),controller[_0x4a6c('0x14')]);module[_0x4a6c('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e96722a..5ed5071 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 _0xd468=['csv','custom','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','hours','minutes','ENUM','pdf'];(function(_0xaebfd8,_0x3f8cab){var _0x28ed06=function(_0x3f0398){while(--_0x3f0398){_0xaebfd8['push'](_0xaebfd8['shift']());}};_0x28ed06(++_0x3f8cab);}(_0xd468,0xf2));var _0x8d46=function(_0x204536,_0x1541d1){_0x204536=_0x204536-0x0;var _0x3f724e=_0xd468[_0x204536];return _0x3f724e;};'use strict';var Sequelize=require(_0x8d46('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d46('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8d46('0x1')]},'active':{'type':Sequelize[_0x8d46('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8d46('0x1')],'allowNull':![],'defaultValue':_0x8d46('0x3')},'startAt':{'type':Sequelize[_0x8d46('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8d46('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8d46('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x8d46('0x6'),_0x8d46('0x7'),_0x8d46('0x8'),_0x8d46('0x9'),'days',_0x8d46('0xa'),_0x8d46('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x8d46('0xc')]('csv',_0x8d46('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x8d46('0xe')},'type':{'type':Sequelize[_0x8d46('0xc')]('custom','default'),'allowNull':![],'defaultValue':_0x8d46('0xf')},'sendMail':{'type':Sequelize[_0x8d46('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8d46('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4825=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','days','hours','minutes','csv','pdf','xlsx','custom'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4825,0x134));var _0x5482=function(_0x210542,_0xbd23f9){_0x210542=_0x210542-0x0;var _0x207977=_0x4825[_0x210542];return _0x207977;};'use strict';var Sequelize=require(_0x5482('0x0'));module[_0x5482('0x1')]={'name':{'type':Sequelize[_0x5482('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5482('0x2')]},'active':{'type':Sequelize[_0x5482('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5482('0x2')],'allowNull':![],'defaultValue':_0x5482('0x4')},'startAt':{'type':Sequelize[_0x5482('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5482('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5482('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5482('0x7')]('years','quarters',_0x5482('0x8'),'weeks',_0x5482('0x9'),_0x5482('0xa'),_0x5482('0xb')),'allowNull':![],'defaultValue':_0x5482('0x9')},'output':{'type':Sequelize[_0x5482('0x7')](_0x5482('0xc'),_0x5482('0xd'),_0x5482('0xe')),'allowNull':![],'defaultValue':_0x5482('0xc')},'type':{'type':Sequelize[_0x5482('0x7')](_0x5482('0xf'),_0x5482('0x10')),'allowNull':![],'defaultValue':_0x5482('0xf')},'sendMail':{'type':Sequelize[_0x5482('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5482('0x2')]},'cc':{'type':Sequelize[_0x5482('0x11')]},'bcc':{'type':Sequelize[_0x5482('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x5482('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index cc40d6b..9aabf21 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 _0x83c5=['Schedule','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','includeAll','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map'];(function(_0x31b7fd,_0x320a69){var _0x354c3f=function(_0x1dbf1f){while(--_0x1dbf1f){_0x31b7fd['push'](_0x31b7fd['shift']());}};_0x354c3f(++_0x320a69);}(_0x83c5,0xca));var _0x583c=function(_0x59605e,_0xb51758){_0x59605e=_0x59605e-0x0;var _0x56807d=_0x83c5[_0x59605e];return _0x56807d;};'use strict';var emlformat=require(_0x583c('0x0'));var rimraf=require(_0x583c('0x1'));var zipdir=require(_0x583c('0x2'));var jsonpatch=require(_0x583c('0x3'));var rp=require('request-promise');var moment=require(_0x583c('0x4'));var BPromise=require(_0x583c('0x5'));var Mustache=require(_0x583c('0x6'));var util=require(_0x583c('0x7'));var path=require(_0x583c('0x8'));var sox=require(_0x583c('0x9'));var csv=require(_0x583c('0xa'));var ejs=require(_0x583c('0xb'));var fs=require('fs');var fs_extra=require(_0x583c('0xc'));var _=require(_0x583c('0xd'));var squel=require(_0x583c('0xe'));var crypto=require('crypto');var jsforce=require(_0x583c('0xf'));var deskjs=require(_0x583c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x583c('0x11'));var Papa=require(_0x583c('0x12'));var Redis=require(_0x583c('0x13'));var authService=require(_0x583c('0x14'));var qs=require(_0x583c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x583c('0x16'));var utils=require(_0x583c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x583c('0x18'))['db'];function respondWithStatusCode(_0x1d8925,_0x1228e7){_0x1228e7=_0x1228e7||0xcc;return function(_0x4f8c4b){if(_0x4f8c4b){return _0x1d8925['sendStatus'](_0x1228e7);}return _0x1d8925[_0x583c('0x19')](_0x1228e7)[_0x583c('0x1a')]();};}function respondWithResult(_0xca7e36,_0x15c467){_0x15c467=_0x15c467||0xc8;return function(_0x3a1469){if(_0x3a1469){return _0xca7e36[_0x583c('0x19')](_0x15c467)[_0x583c('0x1b')](_0x3a1469);}};}function respondWithFilteredResult(_0x177a1d,_0x391793){return function(_0xc825dc){if(_0xc825dc){var _0x4e7c74=typeof _0x391793[_0x583c('0x1c')]===_0x583c('0x1d')&&typeof _0x391793[_0x583c('0x1e')]===_0x583c('0x1d');var _0xb5985e=_0xc825dc[_0x583c('0x1f')];var _0x5d4532=_0x4e7c74?0x0:_0x391793['offset'];var _0x3f9956=_0x4e7c74?_0xc825dc[_0x583c('0x1f')]:_0x391793[_0x583c('0x1c')]+_0x391793['limit'];var _0x380787;if(_0x3f9956>=_0xb5985e){_0x3f9956=_0xb5985e;_0x380787=0xc8;}else{_0x380787=0xce;}_0x177a1d[_0x583c('0x19')](_0x380787);return _0x177a1d[_0x583c('0x20')](_0x583c('0x21'),_0x5d4532+'-'+_0x3f9956+'/'+_0xb5985e)[_0x583c('0x1b')](_0xc825dc);}return null;};}function patchUpdates(_0x424ff1){return function(_0x288312){try{jsonpatch[_0x583c('0x22')](_0x288312,_0x424ff1,!![]);}catch(_0x54f4a9){return BPromise[_0x583c('0x23')](_0x54f4a9);}return _0x288312['save']();};}function saveUpdates(_0x25f442,_0x29c3da){return function(_0x1962bc){if(_0x1962bc){return _0x1962bc[_0x583c('0x24')](_0x25f442)[_0x583c('0x25')](function(_0x36f909){return _0x36f909;});}return null;};}function removeEntity(_0x39af84,_0x490798){return function(_0x3bb323){if(_0x3bb323){return _0x3bb323['destroy']()['then'](function(){var _0x31146c=_0x3bb323['get']({'plain':!![]});var _0x3c8892=_0x583c('0x26');return db[_0x583c('0x27')][_0x583c('0x28')]({'where':{'type':_0x3c8892,'resourceId':_0x31146c['id']}})['then'](function(){return _0x3bb323;});})[_0x583c('0x25')](function(){_0x39af84[_0x583c('0x19')](0xcc)[_0x583c('0x1a')]();});}};}function handleEntityNotFound(_0x5bca61,_0x40fc50){return function(_0xd92a27){if(!_0xd92a27){_0x5bca61['sendStatus'](0x194);}return _0xd92a27;};}function handleError(_0x3cb53c,_0x5b0d2c){_0x5b0d2c=_0x5b0d2c||0x1f4;return function(_0x31f209){logger[_0x583c('0x29')](_0x31f209[_0x583c('0x2a')]);if(_0x31f209[_0x583c('0x2b')]){delete _0x31f209[_0x583c('0x2b')];}_0x3cb53c[_0x583c('0x19')](_0x5b0d2c)[_0x583c('0x2c')](_0x31f209);};}exports[_0x583c('0x2d')]=function(_0x4a9b64,_0x2ec057){var _0x2c878c={},_0x3651c6={},_0x2457f3={'count':0x0,'rows':[]};var _0x3b0fa1=_[_0x583c('0x2e')](db[_0x583c('0x2f')][_0x583c('0x30')],function(_0x12fb88){return{'name':_0x12fb88[_0x583c('0x31')],'type':_0x12fb88['type']['key']};});_0x3651c6[_0x583c('0x32')]=_[_0x583c('0x2e')](_0x3b0fa1,_0x583c('0x2b'));_0x3651c6['query']=_[_0x583c('0x33')](_0x4a9b64[_0x583c('0x34')]);_0x3651c6[_0x583c('0x35')]=_[_0x583c('0x36')](_0x3651c6['model'],_0x3651c6['query']);_0x2c878c[_0x583c('0x37')]=_[_0x583c('0x36')](_0x3651c6['model'],qs['fields'](_0x4a9b64['query'][_0x583c('0x38')]));_0x2c878c[_0x583c('0x37')]=_0x2c878c[_0x583c('0x37')][_0x583c('0x39')]?_0x2c878c[_0x583c('0x37')]:_0x3651c6[_0x583c('0x32')];if(!_0x4a9b64[_0x583c('0x34')][_0x583c('0x3a')](_0x583c('0x3b'))){_0x2c878c[_0x583c('0x1e')]=qs[_0x583c('0x1e')](_0x4a9b64[_0x583c('0x34')]['limit']);_0x2c878c[_0x583c('0x1c')]=qs[_0x583c('0x1c')](_0x4a9b64[_0x583c('0x34')][_0x583c('0x1c')]);}_0x2c878c['order']=qs[_0x583c('0x3c')](_0x4a9b64[_0x583c('0x34')][_0x583c('0x3c')]);_0x2c878c[_0x583c('0x3d')]=qs[_0x583c('0x35')](_[_0x583c('0x3e')](_0x4a9b64[_0x583c('0x34')],_0x3651c6[_0x583c('0x35')]),_0x3b0fa1);if(_0x4a9b64[_0x583c('0x34')][_0x583c('0x3f')]){_0x2c878c[_0x583c('0x3d')]=_[_0x583c('0x40')](_0x2c878c[_0x583c('0x3d')],{'$or':_[_0x583c('0x2e')](_0x3b0fa1,function(_0x1de916){if(_0x1de916['type']!==_0x583c('0x41')){var _0x42ea5b={};_0x42ea5b[_0x1de916['name']]={'$like':'%'+_0x4a9b64[_0x583c('0x34')][_0x583c('0x3f')]+'%'};return _0x42ea5b;}})});}_0x2c878c=_[_0x583c('0x40')]({},_0x2c878c,_0x4a9b64['options']);var _0x11864c={'where':_0x2c878c[_0x583c('0x3d')]};return db[_0x583c('0x2f')][_0x583c('0x1f')](_0x11864c)[_0x583c('0x25')](function(_0x1b2315){_0x2457f3[_0x583c('0x1f')]=_0x1b2315;if(_0x4a9b64[_0x583c('0x34')]['includeAll']){_0x2c878c[_0x583c('0x42')]=[{'all':!![]}];}return db[_0x583c('0x2f')]['findAll'](_0x2c878c);})[_0x583c('0x25')](function(_0x5d2447){_0x2457f3['rows']=_0x5d2447;return _0x2457f3;})[_0x583c('0x25')](respondWithFilteredResult(_0x2ec057,_0x2c878c))[_0x583c('0x43')](handleError(_0x2ec057,null));};exports[_0x583c('0x44')]=function(_0x1b2477,_0xf38675){var _0x4692ec={'raw':![],'where':{'id':_0x1b2477['params']['id']}},_0x58b715={};_0x58b715[_0x583c('0x32')]=_[_0x583c('0x33')](db[_0x583c('0x2f')][_0x583c('0x30')]);_0x58b715[_0x583c('0x34')]=_[_0x583c('0x33')](_0x1b2477['query']);_0x58b715[_0x583c('0x35')]=_['intersection'](_0x58b715['model'],_0x58b715['query']);_0x4692ec['attributes']=_[_0x583c('0x36')](_0x58b715['model'],qs['fields'](_0x1b2477[_0x583c('0x34')][_0x583c('0x38')]));_0x4692ec[_0x583c('0x37')]=_0x4692ec[_0x583c('0x37')][_0x583c('0x39')]?_0x4692ec['attributes']:_0x58b715[_0x583c('0x32')];if(_0x1b2477[_0x583c('0x34')][_0x583c('0x45')]){_0x4692ec[_0x583c('0x42')]=[{'all':!![]}];}_0x4692ec=_[_0x583c('0x40')]({},_0x4692ec,_0x1b2477[_0x583c('0x46')]);return db['Schedule'][_0x583c('0x47')](_0x4692ec)[_0x583c('0x25')](handleEntityNotFound(_0xf38675,null))['then'](respondWithResult(_0xf38675,null))[_0x583c('0x43')](handleError(_0xf38675,null));};exports[_0x583c('0x48')]=function(_0x2b8f50,_0x375ee6){return db['Schedule'][_0x583c('0x48')](_0x2b8f50['body'],{})[_0x583c('0x25')](function(_0x2d406c){var _0x47382f=_0x2b8f50['user'][_0x583c('0x49')]({'plain':!![]});if(!_0x47382f)throw new Error(_0x583c('0x4a'));if(_0x47382f[_0x583c('0x4b')]===_0x583c('0x4c')){var _0x44d8a1=_0x2d406c[_0x583c('0x49')]({'plain':!![]});var _0x247a3f='Scheduler';return db[_0x583c('0x4d')][_0x583c('0x47')]({'where':{'name':_0x247a3f,'userProfileId':_0x47382f['userProfileId']},'raw':!![]})[_0x583c('0x25')](function(_0x1ea401){if(_0x1ea401&&_0x1ea401[_0x583c('0x4e')]===0x0){return db[_0x583c('0x27')][_0x583c('0x48')]({'name':_0x44d8a1[_0x583c('0x2b')],'resourceId':_0x44d8a1['id'],'type':_0x1ea401['name'],'sectionId':_0x1ea401['id']},{})[_0x583c('0x25')](function(){return _0x2d406c;});}else{return _0x2d406c;}})[_0x583c('0x43')](function(_0x581a43){logger[_0x583c('0x29')](_0x583c('0x4f'),_0x581a43);throw _0x581a43;});}return _0x2d406c;})[_0x583c('0x25')](respondWithResult(_0x375ee6,0xc9))[_0x583c('0x43')](handleError(_0x375ee6,null));};exports[_0x583c('0x24')]=function(_0x2316a4,_0x7dd5dc){if(_0x2316a4[_0x583c('0x50')]['id']){delete _0x2316a4[_0x583c('0x50')]['id'];}return db[_0x583c('0x2f')][_0x583c('0x47')]({'where':{'id':_0x2316a4['params']['id']}})['then'](handleEntityNotFound(_0x7dd5dc,null))[_0x583c('0x25')](saveUpdates(_0x2316a4[_0x583c('0x50')],null))[_0x583c('0x25')](respondWithResult(_0x7dd5dc,null))['catch'](handleError(_0x7dd5dc,null));};exports[_0x583c('0x28')]=function(_0x11f1ed,_0x237594){return db[_0x583c('0x2f')][_0x583c('0x47')]({'where':{'id':_0x11f1ed['params']['id']}})[_0x583c('0x25')](handleEntityNotFound(_0x237594,null))[_0x583c('0x25')](removeEntity(_0x237594,null))['catch'](handleError(_0x237594,null));};exports[_0x583c('0x51')]=function(_0x968fe8,_0x254020,_0x392a31){var _0x37dd03=require('../../config/schedule');return db[_0x583c('0x2f')][_0x583c('0x47')]({'where':{'id':_0x968fe8[_0x583c('0x52')]['id']},'raw':!![]})[_0x583c('0x25')](handleEntityNotFound(_0x254020,null))[_0x583c('0x25')](function(){_0x37dd03['run'](_0x968fe8[_0x583c('0x52')]['id']);})['then'](respondWithStatusCode(_0x254020,null))[_0x583c('0x43')](handleError(_0x254020,null));}; \ No newline at end of file +var _0x4f85=['type','VIRTUAL','merge','includeAll','rows','catch','show','params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','request-promise','mustache','path','sox','ejs','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Scheduler','name','send','index','map','Schedule','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f85,0xb3));var _0x54f8=function(_0xdc506b,_0x133ab6){_0xdc506b=_0xdc506b-0x0;var _0x504d53=_0x4f85[_0xdc506b];return _0x504d53;};'use strict';var emlformat=require(_0x54f8('0x0'));var rimraf=require(_0x54f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x54f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54f8('0x3'));var util=require('util');var path=require(_0x54f8('0x4'));var sox=require(_0x54f8('0x5'));var csv=require('to-csv');var ejs=require(_0x54f8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54f8('0x7'));var squel=require(_0x54f8('0x8'));var crypto=require('crypto');var jsforce=require(_0x54f8('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x54f8('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x54f8('0xb'));var as=require(_0x54f8('0xc'));var hardwareService=require(_0x54f8('0xd'));var logger=require(_0x54f8('0xe'))(_0x54f8('0xf'));var utils=require(_0x54f8('0x10'));var config=require(_0x54f8('0x11'));var licenseUtil=require(_0x54f8('0x12'));var db=require(_0x54f8('0x13'))['db'];function respondWithStatusCode(_0xc9b47e,_0x23e736){_0x23e736=_0x23e736||0xcc;return function(_0xd06ca9){if(_0xd06ca9){return _0xc9b47e[_0x54f8('0x14')](_0x23e736);}return _0xc9b47e[_0x54f8('0x15')](_0x23e736)[_0x54f8('0x16')]();};}function respondWithResult(_0x5dda28,_0x272d38){_0x272d38=_0x272d38||0xc8;return function(_0x1bda06){if(_0x1bda06){return _0x5dda28['status'](_0x272d38)[_0x54f8('0x17')](_0x1bda06);}};}function respondWithFilteredResult(_0x14cf6f,_0x59b73b){return function(_0x53c18b){if(_0x53c18b){var _0xe814dd=typeof _0x59b73b[_0x54f8('0x18')]===_0x54f8('0x19')&&typeof _0x59b73b[_0x54f8('0x1a')]==='undefined';var _0x247ff6=_0x53c18b['count'];var _0x3d45f3=_0xe814dd?0x0:_0x59b73b[_0x54f8('0x18')];var _0x543530=_0xe814dd?_0x53c18b[_0x54f8('0x1b')]:_0x59b73b[_0x54f8('0x18')]+_0x59b73b[_0x54f8('0x1a')];var _0x11171e;if(_0x543530>=_0x247ff6){_0x543530=_0x247ff6;_0x11171e=0xc8;}else{_0x11171e=0xce;}_0x14cf6f[_0x54f8('0x15')](_0x11171e);return _0x14cf6f[_0x54f8('0x1c')](_0x54f8('0x1d'),_0x3d45f3+'-'+_0x543530+'/'+_0x247ff6)[_0x54f8('0x17')](_0x53c18b);}return null;};}function patchUpdates(_0x29edbc){return function(_0x12254a){try{jsonpatch[_0x54f8('0x1e')](_0x12254a,_0x29edbc,!![]);}catch(_0x2d8488){return BPromise['reject'](_0x2d8488);}return _0x12254a[_0x54f8('0x1f')]();};}function saveUpdates(_0x1d826b,_0xb52609){return function(_0x19465d){if(_0x19465d){return _0x19465d[_0x54f8('0x20')](_0x1d826b)['then'](function(_0x2ed53d){return _0x2ed53d;});}return null;};}function removeEntity(_0x531492,_0x495aab){return function(_0x373d1f){if(_0x373d1f){return _0x373d1f[_0x54f8('0x21')]()[_0x54f8('0x22')](function(){var _0x579da8=_0x373d1f[_0x54f8('0x23')]({'plain':!![]});var _0x44990b=_0x54f8('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x44990b,'resourceId':_0x579da8['id']}})['then'](function(){return _0x373d1f;});})['then'](function(){_0x531492['status'](0xcc)[_0x54f8('0x16')]();});}};}function handleEntityNotFound(_0x56288a,_0x1141da){return function(_0xc5261c){if(!_0xc5261c){_0x56288a[_0x54f8('0x14')](0x194);}return _0xc5261c;};}function handleError(_0x34d06d,_0x552440){_0x552440=_0x552440||0x1f4;return function(_0x44a20e){logger['error'](_0x44a20e['stack']);if(_0x44a20e['name']){delete _0x44a20e[_0x54f8('0x25')];}_0x34d06d[_0x54f8('0x15')](_0x552440)[_0x54f8('0x26')](_0x44a20e);};}exports[_0x54f8('0x27')]=function(_0xab7e81,_0x392aa4){var _0x48a696={},_0x401b5e={},_0x1ee8a0={'count':0x0,'rows':[]};var _0x61c447=_[_0x54f8('0x28')](db[_0x54f8('0x29')][_0x54f8('0x2a')],function(_0x186644){return{'name':_0x186644['fieldName'],'type':_0x186644['type'][_0x54f8('0x2b')]};});_0x401b5e[_0x54f8('0x2c')]=_['map'](_0x61c447,_0x54f8('0x25'));_0x401b5e[_0x54f8('0x2d')]=_[_0x54f8('0x2e')](_0xab7e81[_0x54f8('0x2d')]);_0x401b5e[_0x54f8('0x2f')]=_[_0x54f8('0x30')](_0x401b5e[_0x54f8('0x2c')],_0x401b5e['query']);_0x48a696[_0x54f8('0x31')]=_[_0x54f8('0x30')](_0x401b5e['model'],qs[_0x54f8('0x32')](_0xab7e81[_0x54f8('0x2d')]['fields']));_0x48a696[_0x54f8('0x31')]=_0x48a696[_0x54f8('0x31')][_0x54f8('0x33')]?_0x48a696[_0x54f8('0x31')]:_0x401b5e[_0x54f8('0x2c')];if(!_0xab7e81['query'][_0x54f8('0x34')](_0x54f8('0x35'))){_0x48a696[_0x54f8('0x1a')]=qs[_0x54f8('0x1a')](_0xab7e81['query']['limit']);_0x48a696[_0x54f8('0x18')]=qs['offset'](_0xab7e81['query'][_0x54f8('0x18')]);}_0x48a696['order']=qs[_0x54f8('0x36')](_0xab7e81['query'][_0x54f8('0x36')]);_0x48a696['where']=qs[_0x54f8('0x2f')](_[_0x54f8('0x37')](_0xab7e81['query'],_0x401b5e[_0x54f8('0x2f')]),_0x61c447);if(_0xab7e81[_0x54f8('0x2d')][_0x54f8('0x38')]){_0x48a696[_0x54f8('0x39')]=_['merge'](_0x48a696[_0x54f8('0x39')],{'$or':_['map'](_0x61c447,function(_0x302c70){if(_0x302c70[_0x54f8('0x3a')]!==_0x54f8('0x3b')){var _0x457921={};_0x457921[_0x302c70['name']]={'$like':'%'+_0xab7e81[_0x54f8('0x2d')]['filter']+'%'};return _0x457921;}})});}_0x48a696=_[_0x54f8('0x3c')]({},_0x48a696,_0xab7e81['options']);var _0x5ef93f={'where':_0x48a696[_0x54f8('0x39')]};return db[_0x54f8('0x29')]['count'](_0x5ef93f)[_0x54f8('0x22')](function(_0x3d6071){_0x1ee8a0[_0x54f8('0x1b')]=_0x3d6071;if(_0xab7e81[_0x54f8('0x2d')][_0x54f8('0x3d')]){_0x48a696['include']=[{'all':!![]}];}return db[_0x54f8('0x29')]['findAll'](_0x48a696);})[_0x54f8('0x22')](function(_0x581dd8){_0x1ee8a0[_0x54f8('0x3e')]=_0x581dd8;return _0x1ee8a0;})[_0x54f8('0x22')](respondWithFilteredResult(_0x392aa4,_0x48a696))[_0x54f8('0x3f')](handleError(_0x392aa4,null));};exports[_0x54f8('0x40')]=function(_0x2971ef,_0x33a819){var _0x40cc89={'raw':![],'where':{'id':_0x2971ef[_0x54f8('0x41')]['id']}},_0x2e4bbd={};_0x2e4bbd[_0x54f8('0x2c')]=_[_0x54f8('0x2e')](db[_0x54f8('0x29')][_0x54f8('0x2a')]);_0x2e4bbd[_0x54f8('0x2d')]=_['keys'](_0x2971ef[_0x54f8('0x2d')]);_0x2e4bbd['filters']=_[_0x54f8('0x30')](_0x2e4bbd[_0x54f8('0x2c')],_0x2e4bbd[_0x54f8('0x2d')]);_0x40cc89[_0x54f8('0x31')]=_[_0x54f8('0x30')](_0x2e4bbd[_0x54f8('0x2c')],qs['fields'](_0x2971ef[_0x54f8('0x2d')]['fields']));_0x40cc89['attributes']=_0x40cc89[_0x54f8('0x31')][_0x54f8('0x33')]?_0x40cc89['attributes']:_0x2e4bbd[_0x54f8('0x2c')];if(_0x2971ef[_0x54f8('0x2d')][_0x54f8('0x3d')]){_0x40cc89[_0x54f8('0x42')]=[{'all':!![]}];}_0x40cc89=_[_0x54f8('0x3c')]({},_0x40cc89,_0x2971ef[_0x54f8('0x43')]);return db[_0x54f8('0x29')][_0x54f8('0x44')](_0x40cc89)[_0x54f8('0x22')](handleEntityNotFound(_0x33a819,null))[_0x54f8('0x22')](respondWithResult(_0x33a819,null))[_0x54f8('0x3f')](handleError(_0x33a819,null));};exports[_0x54f8('0x45')]=function(_0x28b25d,_0x2b29ab){return db['Schedule'][_0x54f8('0x45')](_0x28b25d[_0x54f8('0x46')],{})[_0x54f8('0x22')](function(_0x35f7a3){var _0x4ed6da=_0x28b25d['user'][_0x54f8('0x23')]({'plain':!![]});if(!_0x4ed6da)throw new Error(_0x54f8('0x47'));if(_0x4ed6da[_0x54f8('0x48')]==='user'){var _0x176bf8=_0x35f7a3[_0x54f8('0x23')]({'plain':!![]});var _0x4f01df=_0x54f8('0x24');return db[_0x54f8('0x49')]['find']({'where':{'name':_0x4f01df,'userProfileId':_0x4ed6da[_0x54f8('0x4a')]},'raw':!![]})[_0x54f8('0x22')](function(_0x2de2e8){if(_0x2de2e8&&_0x2de2e8['autoAssociation']===0x0){return db[_0x54f8('0x4b')][_0x54f8('0x45')]({'name':_0x176bf8[_0x54f8('0x25')],'resourceId':_0x176bf8['id'],'type':_0x2de2e8[_0x54f8('0x25')],'sectionId':_0x2de2e8['id']},{})['then'](function(){return _0x35f7a3;});}else{return _0x35f7a3;}})[_0x54f8('0x3f')](function(_0x15e8b5){logger['error'](_0x54f8('0x4c'),_0x15e8b5);throw _0x15e8b5;});}return _0x35f7a3;})[_0x54f8('0x22')](respondWithResult(_0x2b29ab,0xc9))['catch'](handleError(_0x2b29ab,null));};exports[_0x54f8('0x20')]=function(_0x3e38a2,_0x36aba4){if(_0x3e38a2[_0x54f8('0x46')]['id']){delete _0x3e38a2[_0x54f8('0x46')]['id'];}return db[_0x54f8('0x29')][_0x54f8('0x44')]({'where':{'id':_0x3e38a2[_0x54f8('0x41')]['id']}})[_0x54f8('0x22')](handleEntityNotFound(_0x36aba4,null))['then'](saveUpdates(_0x3e38a2[_0x54f8('0x46')],null))[_0x54f8('0x22')](respondWithResult(_0x36aba4,null))['catch'](handleError(_0x36aba4,null));};exports['destroy']=function(_0xe33075,_0x1b7377){return db[_0x54f8('0x29')]['find']({'where':{'id':_0xe33075['params']['id']}})['then'](handleEntityNotFound(_0x1b7377,null))[_0x54f8('0x22')](removeEntity(_0x1b7377,null))[_0x54f8('0x3f')](handleError(_0x1b7377,null));};exports[_0x54f8('0x4d')]=function(_0x40ede6,_0x57fe90,_0x27a97){var _0x4456f9=require(_0x54f8('0x4e'));return db[_0x54f8('0x29')][_0x54f8('0x44')]({'where':{'id':_0x40ede6[_0x54f8('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x57fe90,null))[_0x54f8('0x22')](function(){_0x4456f9[_0x54f8('0x4d')](_0x40ede6[_0x54f8('0x41')]['id']);})[_0x54f8('0x22')](respondWithStatusCode(_0x57fe90,null))['catch'](handleError(_0x57fe90,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1e8cd25..92f0a6c 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 _0xe5dd=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x217d09,_0x49df9d){var _0x1330f6=function(_0x51856e){while(--_0x51856e){_0x217d09['push'](_0x217d09['shift']());}};_0x1330f6(++_0x49df9d);}(_0xe5dd,0x84));var _0xde5d=function(_0xedc9a4,_0x51c60e){_0xedc9a4=_0xedc9a4-0x0;var _0x296d51=_0xe5dd[_0xedc9a4];return _0x296d51;};'use strict';var _=require(_0xde5d('0x0'));var util=require(_0xde5d('0x1'));var logger=require(_0xde5d('0x2'))(_0xde5d('0x3'));var moment=require(_0xde5d('0x4'));var BPromise=require(_0xde5d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde5d('0x6'));var rimraf=require(_0xde5d('0x7'));var config=require(_0xde5d('0x8'));var attributes=require(_0xde5d('0x9'));module[_0xde5d('0xa')]=function(_0x5b7b0f,_0x5a678a){return _0x5b7b0f['define'](_0xde5d('0xb'),attributes,{'tableName':_0xde5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','define','Schedule','tools_schedules'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x9fc9,0x8f));var _0x99fc=function(_0x52a3a9,_0x3008c5){_0x52a3a9=_0x52a3a9-0x0;var _0x4f97f8=_0x9fc9[_0x52a3a9];return _0x4f97f8;};'use strict';var _=require(_0x99fc('0x0'));var util=require(_0x99fc('0x1'));var logger=require(_0x99fc('0x2'))(_0x99fc('0x3'));var moment=require(_0x99fc('0x4'));var BPromise=require(_0x99fc('0x5'));var rp=require(_0x99fc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99fc('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x59b22f,_0x50334c){return _0x59b22f[_0x99fc('0x8')](_0x99fc('0x9'),attributes,{'tableName':_0x99fc('0xa'),'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 ad75ceb..187fc48 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 _0x9e8c=['request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','Schedule,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x437868,_0x37d1ed){var _0x2b76e2=function(_0x308812){while(--_0x308812){_0x437868['push'](_0x437868['shift']());}};_0x2b76e2(++_0x37d1ed);}(_0x9e8c,0xc6));var _0xc9e8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9e8c[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xc9e8('0x0'));var moment=require(_0xc9e8('0x1'));var BPromise=require(_0xc9e8('0x2'));var rs=require(_0xc9e8('0x3'));var fs=require('fs');var Redis=require(_0xc9e8('0x4'));var db=require(_0xc9e8('0x5'))['db'];var utils=require(_0xc9e8('0x6'));var logger=require(_0xc9e8('0x7'))(_0xc9e8('0x8'));var config=require('../../config/environment');var jayson=require(_0xc9e8('0x9'));var client=jayson[_0xc9e8('0xa')][_0xc9e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x471e42,_0x5337b4,_0x452f7e){return new BPromise(function(_0x3b907a,_0x2687bd){return client[_0xc9e8('0xc')](_0x471e42,_0x452f7e)['then'](function(_0x9344b4){logger[_0xc9e8('0xd')]('Schedule,\x20%s,\x20%s',_0x5337b4,'request\x20sent');logger[_0xc9e8('0xe')](_0xc9e8('0xf'),_0x5337b4,_0xc9e8('0x10'),JSON['stringify'](_0x9344b4));if(_0x9344b4[_0xc9e8('0x11')]){if(_0x9344b4['error']['code']===0x1f4){logger[_0xc9e8('0x11')](_0xc9e8('0x12'),_0x5337b4,_0x9344b4[_0xc9e8('0x11')][_0xc9e8('0x13')]);return _0x2687bd(_0x9344b4['error'][_0xc9e8('0x13')]);}logger[_0xc9e8('0x11')]('Schedule,\x20%s,\x20%s',_0x5337b4,_0x9344b4['error']['message']);return _0x3b907a(_0x9344b4['error'][_0xc9e8('0x13')]);}else{logger[_0xc9e8('0xd')](_0xc9e8('0x12'),_0x5337b4,'request\x20sent');_0x3b907a(_0x9344b4[_0xc9e8('0x14')][_0xc9e8('0x13')]);}})['catch'](function(_0x12a7b5){logger[_0xc9e8('0x11')](_0xc9e8('0x12'),_0x5337b4,_0x12a7b5);_0x2687bd(_0x12a7b5);});});} \ No newline at end of file +var _0xfe7d=['info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x1c400a,_0x322504){var _0x3801ee=function(_0xa57f8c){while(--_0xa57f8c){_0x1c400a['push'](_0x1c400a['shift']());}};_0x3801ee(++_0x322504);}(_0xfe7d,0x121));var _0xdfe7=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0xfe7d[_0x42bafd];return _0x2ed705;};'use strict';var _=require(_0xdfe7('0x0'));var util=require('util');var moment=require(_0xdfe7('0x1'));var BPromise=require(_0xdfe7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfe7('0x3'));var db=require(_0xdfe7('0x4'))['db'];var utils=require(_0xdfe7('0x5'));var logger=require('../../config/logger')(_0xdfe7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdfe7('0x7')][_0xdfe7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5152d9,_0x4c9365,_0x4e929b){return new BPromise(function(_0x3e233f,_0x33322f){return client[_0xdfe7('0x9')](_0x5152d9,_0x4e929b)[_0xdfe7('0xa')](function(_0x3e6156){logger[_0xdfe7('0xb')](_0xdfe7('0xc'),_0x4c9365,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x4c9365,_0xdfe7('0xd'),JSON[_0xdfe7('0xe')](_0x3e6156));if(_0x3e6156[_0xdfe7('0xf')]){if(_0x3e6156['error'][_0xdfe7('0x10')]===0x1f4){logger[_0xdfe7('0xf')]('Schedule,\x20%s,\x20%s',_0x4c9365,_0x3e6156[_0xdfe7('0xf')][_0xdfe7('0x11')]);return _0x33322f(_0x3e6156[_0xdfe7('0xf')]['message']);}logger[_0xdfe7('0xf')]('Schedule,\x20%s,\x20%s',_0x4c9365,_0x3e6156[_0xdfe7('0xf')]['message']);return _0x3e233f(_0x3e6156[_0xdfe7('0xf')][_0xdfe7('0x11')]);}else{logger[_0xdfe7('0xb')](_0xdfe7('0xc'),_0x4c9365,_0xdfe7('0xd'));_0x3e233f(_0x3e6156[_0xdfe7('0x12')][_0xdfe7('0x11')]);}})[_0xdfe7('0x13')](function(_0x2aca12){logger[_0xdfe7('0xf')](_0xdfe7('0xc'),_0x4c9365,_0x2aca12);_0x33322f(_0x2aca12);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e441135..0e3b5ac 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 _0xe94a=['describe','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe'];(function(_0xdd199d,_0x5d3566){var _0x2de6be=function(_0x288bcf){while(--_0x288bcf){_0xdd199d['push'](_0xdd199d['shift']());}};_0x2de6be(++_0x5d3566);}(_0xe94a,0xe3));var _0xae94=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xe94a[_0x15cdcb];return _0x37b069;};'use strict';var multer=require('multer');var util=require(_0xae94('0x0'));var path=require(_0xae94('0x1'));var timeout=require(_0xae94('0x2'));var express=require(_0xae94('0x3'));var router=express[_0xae94('0x4')]();var fs_extra=require(_0xae94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae94('0x6'));var config=require(_0xae94('0x7'));var controller=require(_0xae94('0x8'));router['get']('/',auth[_0xae94('0x9')](),controller[_0xae94('0xa')]);router[_0xae94('0xb')](_0xae94('0xc'),auth[_0xae94('0x9')](),controller[_0xae94('0xd')]);router['get'](_0xae94('0xe'),auth[_0xae94('0x9')](),controller[_0xae94('0xf')]);router['get'](_0xae94('0x10'),auth[_0xae94('0x9')](),controller[_0xae94('0x11')]);router[_0xae94('0x12')]('/',auth[_0xae94('0x9')](),controller[_0xae94('0x13')]);router[_0xae94('0x14')]('/:id',auth[_0xae94('0x9')](),controller['update']);router[_0xae94('0x15')](_0xae94('0xe'),auth[_0xae94('0x9')](),controller[_0xae94('0x16')]);module[_0xae94('0x17')]=router; \ No newline at end of file +var _0xcfd9=['index','/describe','describe','/:id','show','/:id/download','download','post','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xcfd9,0x89));var _0x9cfd=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xcfd9[_0x34933a];return _0x36abb4;};'use strict';var multer=require(_0x9cfd('0x0'));var util=require(_0x9cfd('0x1'));var path=require('path');var timeout=require(_0x9cfd('0x2'));var express=require('express');var router=express[_0x9cfd('0x3')]();var fs_extra=require(_0x9cfd('0x4'));var auth=require(_0x9cfd('0x5'));var interaction=require(_0x9cfd('0x6'));var config=require(_0x9cfd('0x7'));var controller=require('./screenRecording.controller');router[_0x9cfd('0x8')]('/',auth[_0x9cfd('0x9')](),controller[_0x9cfd('0xa')]);router[_0x9cfd('0x8')](_0x9cfd('0xb'),auth[_0x9cfd('0x9')](),controller[_0x9cfd('0xc')]);router[_0x9cfd('0x8')](_0x9cfd('0xd'),auth['isAuthenticated'](),controller[_0x9cfd('0xe')]);router['get'](_0x9cfd('0xf'),auth[_0x9cfd('0x9')](),controller[_0x9cfd('0x10')]);router[_0x9cfd('0x11')]('/',auth[_0x9cfd('0x9')](),controller['create']);router[_0x9cfd('0x12')]('/:id',auth[_0x9cfd('0x9')](),controller[_0x9cfd('0x13')]);router['delete'](_0x9cfd('0xd'),auth[_0x9cfd('0x9')](),controller['destroy']);module[_0x9cfd('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6f4e697..e3ba902 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 _0xab54=['setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','STRING','replace'];(function(_0x13722d,_0x275f21){var _0x3362c4=function(_0x2dcd48){while(--_0x2dcd48){_0x13722d['push'](_0x13722d['shift']());}};_0x3362c4(++_0x275f21);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4ab5('0x0'));var path=require(_0x4ab5('0x1'));var config=require(_0x4ab5('0x2'));module[_0x4ab5('0x3')]={'format':{'type':Sequelize[_0x4ab5('0x4')],'get':function(){return this['getDataValue'](_0x4ab5('0x5'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x4ab5('0x6')]},'channel':{'type':Sequelize[_0x4ab5('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2c39fe){var _0x5c8c61=_0x2c39fe[_0x4ab5('0x7')](/\\/g,'/');this[_0x4ab5('0x8')](_0x4ab5('0x5'),_0x5c8c61);}},'rating':{'type':Sequelize[_0x4ab5('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x58e6a7){this['setDataValue'](_0x4ab5('0xa'),moment()[_0x4ab5('0xb')](_0x58e6a7,'ms'));this['setDataValue'](_0x4ab5('0xc'),moment());this[_0x4ab5('0x8')]('duration',_0x58e6a7);}},'startedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xa')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'closedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xc')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')]('createdAt'))[_0x4ab5('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ab5('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x4ab5('0x12')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}}}; \ No newline at end of file +var _0x583c=['STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x583c,0x12b));var _0xc583=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x583c[_0x37d0bc];return _0x170e60;};'use strict';var Sequelize=require(_0xc583('0x0'));var moment=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var config=require(_0xc583('0x3'));module['exports']={'format':{'type':Sequelize[_0xc583('0x4')],'get':function(){return this[_0xc583('0x5')]('value')?path['extname'](this[_0xc583('0x5')](_0xc583('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc583('0x7')]},'value':{'type':Sequelize[_0xc583('0x7')],'set':function(_0x2719df){var _0x1dd37c=_0x2719df['replace'](/\\/g,'/');this[_0xc583('0x8')](_0xc583('0x6'),_0x1dd37c);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc583('0x9')],'set':function(_0x24ab4f){this[_0xc583('0x8')](_0xc583('0xa'),moment()[_0xc583('0xb')](_0x24ab4f,'ms'));this['setDataValue'](_0xc583('0xc'),moment());this[_0xc583('0x8')]('duration',_0x24ab4f);}},'startedAt':{'type':Sequelize[_0xc583('0xd')],'get':function(){return moment(this[_0xc583('0x5')]('startedAt'))[_0xc583('0xe')](_0xc583('0xf'))[_0xc583('0x10')]();}},'closedAt':{'type':Sequelize[_0xc583('0xd')],'get':function(){return moment(this[_0xc583('0x5')](_0xc583('0xc')))[_0xc583('0xe')](_0xc583('0xf'))[_0xc583('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc583('0x5')]('createdAt'))[_0xc583('0xe')](_0xc583('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc583('0xd')],'get':function(){return moment(this[_0xc583('0x5')]('updatedAt'))[_0xc583('0xe')](_0xc583('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8aa0b49..a75a2b7 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 _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0xcb374e,_0x4aa3e3){var _0x2eae9b=function(_0x21942c){while(--_0x21942c){_0xcb374e['push'](_0xcb374e['shift']());}};_0x2eae9b(++_0x4aa3e3);}(_0x3e74,0x175));var _0x43e7=function(_0x1fb97f,_0x1b688e){_0x1fb97f=_0x1fb97f-0x0;var _0x25a9e1=_0x3e74[_0x1fb97f];return _0x25a9e1;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file +var _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xae24,0x182));var _0x4ae2=function(_0x2d24f5,_0x402b94){_0x2d24f5=_0x2d24f5-0x0;var _0x12a852=_0xae24[_0x2d24f5];return _0x12a852;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0bb8dd8..afdadff 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 _0xa501=['./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x592cea,_0x4e72f1){var _0x1e9cc6=function(_0x166217){while(--_0x166217){_0x592cea['push'](_0x592cea['shift']());}};_0x1e9cc6(++_0x4e72f1);}(_0xa501,0x12b));var _0x1a50=function(_0x45ada9,_0xf311f3){_0x45ada9=_0x45ada9-0x0;var _0x5b5dd7=_0xa501[_0x45ada9];return _0x5b5dd7;};'use strict';var _=require(_0x1a50('0x0'));var util=require(_0x1a50('0x1'));var logger=require(_0x1a50('0x2'))(_0x1a50('0x3'));var moment=require(_0x1a50('0x4'));var BPromise=require('bluebird');var rp=require(_0x1a50('0x5'));var fs=require('fs');var path=require(_0x1a50('0x6'));var rimraf=require(_0x1a50('0x7'));var config=require(_0x1a50('0x8'));var attributes=require(_0x1a50('0x9'));module['exports']=function(_0x37e6fd,_0x48f7a2){return _0x37e6fd[_0x1a50('0xa')](_0x1a50('0xb'),attributes,{'tableName':_0x1a50('0xc'),'paranoid':![],'indexes':[{'name':_0x1a50('0xd'),'fields':[_0x1a50('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d10=['ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports'];(function(_0x2bbcb8,_0x411619){var _0xc67a3a=function(_0x41e7b6){while(--_0x41e7b6){_0x2bbcb8['push'](_0x2bbcb8['shift']());}};_0xc67a3a(++_0x411619);}(_0x7d10,0x6b));var _0x07d1=function(_0x31d8f3,_0x1924ce){_0x31d8f3=_0x31d8f3-0x0;var _0x1c1fa4=_0x7d10[_0x31d8f3];return _0x1c1fa4;};'use strict';var _=require(_0x07d1('0x0'));var util=require('util');var logger=require(_0x07d1('0x1'))(_0x07d1('0x2'));var moment=require(_0x07d1('0x3'));var BPromise=require(_0x07d1('0x4'));var rp=require(_0x07d1('0x5'));var fs=require('fs');var path=require(_0x07d1('0x6'));var rimraf=require(_0x07d1('0x7'));var config=require('../../config/environment');var attributes=require(_0x07d1('0x8'));module[_0x07d1('0x9')]=function(_0x29e0bc,_0x2955e0){return _0x29e0bc['define'](_0x07d1('0xa'),attributes,{'tableName':_0x07d1('0xb'),'paranoid':![],'indexes':[{'name':_0x07d1('0xc'),'fields':[_0x07d1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 86524bf..2f0c3fb 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 _0x1394=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x34e7d2,_0x2c1122){var _0x1bf9ea=function(_0x45d3df){while(--_0x45d3df){_0x34e7d2['push'](_0x34e7d2['shift']());}};_0x1bf9ea(++_0x2c1122);}(_0x1394,0x18b));var _0x4139=function(_0x468fa2,_0x157040){_0x468fa2=_0x468fa2-0x0;var _0x14f849=_0x1394[_0x468fa2];return _0x14f849;};'use strict';var _=require('lodash');var util=require(_0x4139('0x0'));var moment=require(_0x4139('0x1'));var BPromise=require(_0x4139('0x2'));var rs=require(_0x4139('0x3'));var fs=require('fs');var Redis=require(_0x4139('0x4'));var db=require(_0x4139('0x5'))['db'];var utils=require(_0x4139('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4139('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4139('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21c717,_0x15ee9b,_0x49a98f){return new BPromise(function(_0x21df26,_0x25b066){return client[_0x4139('0x9')](_0x21c717,_0x49a98f)[_0x4139('0xa')](function(_0x1b7ec0){logger[_0x4139('0xb')](_0x4139('0xc'),_0x15ee9b,_0x4139('0xd'));logger[_0x4139('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x15ee9b,'request\x20sent',JSON[_0x4139('0xf')](_0x1b7ec0));if(_0x1b7ec0['error']){if(_0x1b7ec0[_0x4139('0x10')][_0x4139('0x11')]===0x1f4){logger[_0x4139('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x15ee9b,_0x1b7ec0[_0x4139('0x10')][_0x4139('0x12')]);return _0x25b066(_0x1b7ec0[_0x4139('0x10')][_0x4139('0x12')]);}logger[_0x4139('0x10')](_0x4139('0xc'),_0x15ee9b,_0x1b7ec0[_0x4139('0x10')][_0x4139('0x12')]);return _0x21df26(_0x1b7ec0['error']['message']);}else{logger[_0x4139('0xb')](_0x4139('0xc'),_0x15ee9b,'request\x20sent');_0x21df26(_0x1b7ec0[_0x4139('0x13')][_0x4139('0x12')]);}})['catch'](function(_0x46a6a4){logger[_0x4139('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x15ee9b,_0x46a6a4);_0x25b066(_0x46a6a4);});});} \ No newline at end of file +var _0xaec9=['error','code','ScreenRecording,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x34b14b,_0x16bebe){var _0x413891=function(_0x577266){while(--_0x577266){_0x34b14b['push'](_0x34b14b['shift']());}};_0x413891(++_0x16bebe);}(_0xaec9,0xc3));var _0x9aec=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xaec9[_0x4c3070];return _0x536a44;};'use strict';var _=require(_0x9aec('0x0'));var util=require('util');var moment=require(_0x9aec('0x1'));var BPromise=require(_0x9aec('0x2'));var rs=require(_0x9aec('0x3'));var fs=require('fs');var Redis=require(_0x9aec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9aec('0x5'));var logger=require('../../config/logger')(_0x9aec('0x6'));var config=require('../../config/environment');var jayson=require(_0x9aec('0x7'));var client=jayson[_0x9aec('0x8')][_0x9aec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c340,_0x4d9b3a,_0x536aa){return new BPromise(function(_0x14df99,_0x34ff63){return client[_0x9aec('0xa')](_0x40c340,_0x536aa)['then'](function(_0xe12c9e){logger[_0x9aec('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x4d9b3a,_0x9aec('0xc'));logger['debug'](_0x9aec('0xd'),_0x4d9b3a,_0x9aec('0xc'),JSON['stringify'](_0xe12c9e));if(_0xe12c9e[_0x9aec('0xe')]){if(_0xe12c9e[_0x9aec('0xe')][_0x9aec('0xf')]===0x1f4){logger[_0x9aec('0xe')](_0x9aec('0x10'),_0x4d9b3a,_0xe12c9e[_0x9aec('0xe')][_0x9aec('0x11')]);return _0x34ff63(_0xe12c9e['error']['message']);}logger[_0x9aec('0xe')](_0x9aec('0x10'),_0x4d9b3a,_0xe12c9e[_0x9aec('0xe')]['message']);return _0x14df99(_0xe12c9e[_0x9aec('0xe')][_0x9aec('0x11')]);}else{logger['info'](_0x9aec('0x10'),_0x4d9b3a,'request\x20sent');_0x14df99(_0xe12c9e['result'][_0x9aec('0x11')]);}})[_0x9aec('0x12')](function(_0x38abb1){logger[_0x9aec('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4d9b3a,_0x38abb1);_0x34ff63(_0x38abb1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 3d7ee3c..da2dfa0 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 _0x5dd9=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','index','get','/now','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','diskStorage','root','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path'];(function(_0x3b1e6f,_0x17e752){var _0x5760a2=function(_0x271694){while(--_0x271694){_0x3b1e6f['push'](_0x3b1e6f['shift']());}};_0x5760a2(++_0x17e752);}(_0x5dd9,0x1e9));var _0x95dd=function(_0x2d3bf9,_0x316601){_0x2d3bf9=_0x2d3bf9-0x0;var _0x150076=_0x5dd9[_0x2d3bf9];return _0x150076;};'use strict';var multer=require(_0x95dd('0x0'));var util=require(_0x95dd('0x1'));var path=require(_0x95dd('0x2'));var timeout=require(_0x95dd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x95dd('0x4'));var auth=require(_0x95dd('0x5'));var interaction=require(_0x95dd('0x6'));var config=require(_0x95dd('0x7'));var controller=require(_0x95dd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x95dd('0x9')]);router[_0x95dd('0xa')](_0x95dd('0xb'),controller['getDate']);router[_0x95dd('0xa')](_0x95dd('0xc'),controller[_0x95dd('0xd')]);router[_0x95dd('0xa')](_0x95dd('0xe'),controller[_0x95dd('0xf')]);router['get']('/:id/logo_login',controller[_0x95dd('0x10')]);router[_0x95dd('0xa')](_0x95dd('0x11'),controller['gdpr']);router[_0x95dd('0xa')]('/:id/preferred',controller[_0x95dd('0x12')]);router[_0x95dd('0xa')](_0x95dd('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29f456,_0x269310,_0x22f063){_0x22f063(null,path[_0x95dd('0x14')](config['root'],_0x95dd('0x15')));},'filename':function(_0x21368a,_0x4c66d9,_0x59dfd8){_0x59dfd8(null,util[_0x95dd('0x16')](_0x95dd('0x17'),'logo',path[_0x95dd('0x18')](_0x4c66d9[_0x95dd('0x19')])));}})});router[_0x95dd('0x1a')]('/:id/logo',upload[_0x95dd('0x1b')](_0x95dd('0x1c')),controller[_0x95dd('0x1d')]);var upload=multer({'storage':multer[_0x95dd('0x1e')]({'destination':function(_0x5cea1b,_0xa40f66,_0x2fb4b1){_0x2fb4b1(null,path[_0x95dd('0x14')](config[_0x95dd('0x1f')],'server/files/images/logos/'));},'filename':function(_0x4fff5d,_0x4203d8,_0x639d63){_0x639d63(null,util[_0x95dd('0x16')]('%s%s','logologin',path[_0x95dd('0x18')](_0x4203d8[_0x95dd('0x19')])));}})});router['post'](_0x95dd('0x20'),upload[_0x95dd('0x1b')](_0x95dd('0x1c')),controller[_0x95dd('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x365858,_0x2fb820,_0x423947){_0x423947(null,path[_0x95dd('0x14')](config[_0x95dd('0x1f')],_0x95dd('0x15')));},'filename':function(_0x41b4c3,_0x136435,_0x1ee31d){_0x1ee31d(null,util[_0x95dd('0x16')](_0x95dd('0x17'),_0x95dd('0x22'),path[_0x95dd('0x18')](_0x136435['originalname'])));}})});router['post']('/:id/preferred',upload[_0x95dd('0x1b')](_0x95dd('0x1c')),controller[_0x95dd('0x23')]);var upload=multer({'storage':multer[_0x95dd('0x1e')]({'destination':function(_0xab9f90,_0x35c156,_0x26b828){_0x26b828(null,path['join'](config[_0x95dd('0x1f')],_0x95dd('0x15')));},'filename':function(_0x195342,_0x39a423,_0x38391a){_0x38391a(null,util[_0x95dd('0x16')]('%s%s',_0x95dd('0x24'),path[_0x95dd('0x18')](_0x39a423[_0x95dd('0x19')])));}})});router[_0x95dd('0x1a')](_0x95dd('0x13'),upload[_0x95dd('0x1b')](_0x95dd('0x1c')),controller[_0x95dd('0x25')]);router[_0x95dd('0x26')](_0x95dd('0xc'),auth['isAuthenticated'](),controller[_0x95dd('0x27')]);module[_0x95dd('0x28')]=router; \ No newline at end of file +var _0x38fb=['/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','logologin','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','addFavicon','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/logo','getLogoLogin'];(function(_0x190310,_0x5be988){var _0x4cb929=function(_0x9f6d2a){while(--_0x9f6d2a){_0x190310['push'](_0x190310['shift']());}};_0x4cb929(++_0x5be988);}(_0x38fb,0x183));var _0xb38f=function(_0x21e034,_0x59fc14){_0x21e034=_0x21e034-0x0;var _0x1faab3=_0x38fb[_0x21e034];return _0x1faab3;};'use strict';var multer=require(_0xb38f('0x0'));var util=require('util');var path=require(_0xb38f('0x1'));var timeout=require(_0xb38f('0x2'));var express=require(_0xb38f('0x3'));var router=express[_0xb38f('0x4')]();var fs_extra=require(_0xb38f('0x5'));var auth=require(_0xb38f('0x6'));var interaction=require(_0xb38f('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xb38f('0x8')]('/',auth[_0xb38f('0x9')](),controller[_0xb38f('0xa')]);router['get']('/now',controller['getDate']);router[_0xb38f('0x8')]('/:id',controller['show']);router['get'](_0xb38f('0xb'),controller['getLogo']);router['get']('/:id/logo_login',controller[_0xb38f('0xc')]);router[_0xb38f('0x8')](_0xb38f('0xd'),controller[_0xb38f('0xe')]);router[_0xb38f('0x8')](_0xb38f('0xf'),controller[_0xb38f('0x10')]);router[_0xb38f('0x8')](_0xb38f('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb38f('0x12')]({'destination':function(_0x4c5613,_0x397385,_0x4d912c){_0x4d912c(null,path[_0xb38f('0x13')](config[_0xb38f('0x14')],_0xb38f('0x15')));},'filename':function(_0x1f39b0,_0x4c1d14,_0x2a94aa){_0x2a94aa(null,util[_0xb38f('0x16')](_0xb38f('0x17'),_0xb38f('0x18'),path[_0xb38f('0x19')](_0x4c1d14['originalname'])));}})});router[_0xb38f('0x1a')](_0xb38f('0xb'),upload[_0xb38f('0x1b')](_0xb38f('0x1c')),controller[_0xb38f('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x175dd6,_0x111836,_0x116446){_0x116446(null,path[_0xb38f('0x13')](config['root'],_0xb38f('0x15')));},'filename':function(_0x3f9791,_0x488da0,_0xadfa54){_0xadfa54(null,util['format'](_0xb38f('0x17'),_0xb38f('0x1e'),path['extname'](_0x488da0[_0xb38f('0x1f')])));}})});router[_0xb38f('0x1a')](_0xb38f('0x20'),upload[_0xb38f('0x1b')](_0xb38f('0x1c')),controller[_0xb38f('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x447a4a,_0x70a1c5,_0x8b6130){_0x8b6130(null,path['join'](config[_0xb38f('0x14')],_0xb38f('0x15')));},'filename':function(_0xd35e1a,_0x378a0f,_0x3ca895){_0x3ca895(null,util[_0xb38f('0x16')](_0xb38f('0x17'),_0xb38f('0x22'),path[_0xb38f('0x19')](_0x378a0f['originalname'])));}})});router[_0xb38f('0x1a')](_0xb38f('0xf'),upload[_0xb38f('0x1b')]('file'),controller[_0xb38f('0x23')]);var upload=multer({'storage':multer[_0xb38f('0x12')]({'destination':function(_0xc33798,_0x379e32,_0x4ed08a){_0x4ed08a(null,path[_0xb38f('0x13')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1f9bac,_0x3867cc,_0x744372){_0x744372(null,util[_0xb38f('0x16')](_0xb38f('0x17'),'favicon',path['extname'](_0x3867cc[_0xb38f('0x1f')])));}})});router[_0xb38f('0x1a')]('/:id/favicon',upload[_0xb38f('0x1b')](_0xb38f('0x1c')),controller[_0xb38f('0x24')]);router['put'](_0xb38f('0x25'),auth['isAuthenticated'](),controller[_0xb38f('0x26')]);module[_0xb38f('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 05b05ed..b2882bd 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(_0x30d142,_0x29a0a1){var _0x52f888=function(_0x5222b9){while(--_0x5222b9){_0x30d142['push'](_0x30d142['shift']());}};_0x52f888(++_0x29a0a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x10f6b7,_0x59ad9c){var _0x2dc6c9=function(_0x476623){while(--_0x476623){_0x10f6b7['push'](_0x10f6b7['shift']());}};_0x2dc6c9(++_0x59ad9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 919fdbf..1118318 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 _0x65ff=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','Sequelize','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce'];(function(_0x9acbfe,_0x8a60ed){var _0x136eba=function(_0x3d9be3){while(--_0x3d9be3){_0x9acbfe['push'](_0x9acbfe['shift']());}};_0x136eba(++_0x8a60ed);}(_0x65ff,0x1dd));var _0xf65f=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x65ff[_0x20d08e];return _0x2cbd12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf65f('0x0'));var zipdir=require(_0xf65f('0x1'));var jsonpatch=require(_0xf65f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf65f('0x3'));var Mustache=require(_0xf65f('0x4'));var util=require(_0xf65f('0x5'));var path=require('path');var sox=require(_0xf65f('0x6'));var csv=require('to-csv');var ejs=require(_0xf65f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf65f('0x8'));var squel=require('squel');var crypto=require(_0xf65f('0x9'));var jsforce=require(_0xf65f('0xa'));var deskjs=require(_0xf65f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf65f('0xc'));var Papa=require(_0xf65f('0xd'));var Redis=require(_0xf65f('0xe'));var authService=require(_0xf65f('0xf'));var qs=require(_0xf65f('0x10'));var as=require(_0xf65f('0x11'));var hardwareService=require(_0xf65f('0x12'));var logger=require(_0xf65f('0x13'))(_0xf65f('0x14'));var utils=require(_0xf65f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf65f('0x16'))['db'];var jayson=require(_0xf65f('0x17'));var client=jayson[_0xf65f('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae0c4,_0x3640a2,_0x53b2b1,_0xb775d6){return new BPromise(function(_0x3e502a,_0x23967b){var _0x3da443=_0xb775d6||client;return _0x3da443[_0xf65f('0x19')](_0x3ae0c4,_0x53b2b1)[_0xf65f('0x1a')](function(_0x193830){logger[_0xf65f('0x1b')](_0xf65f('0x1c'),_0x3640a2,_0xf65f('0x1d'));logger[_0xf65f('0x1e')](_0xf65f('0x1f'),_0x3640a2,_0xf65f('0x1d'),JSON[_0xf65f('0x20')](_0x193830));if(_0x193830[_0xf65f('0x21')]){if(_0x193830['error'][_0xf65f('0x22')]===0x1f4){logger[_0xf65f('0x21')](_0xf65f('0x1c'),_0x3640a2,_0x193830[_0xf65f('0x21')][_0xf65f('0x23')]);return _0x23967b(_0x193830[_0xf65f('0x21')][_0xf65f('0x23')]);}logger[_0xf65f('0x21')]('Setting,\x20%s,\x20%s',_0x3640a2,_0x193830['error'][_0xf65f('0x23')]);return _0x3e502a(_0x193830[_0xf65f('0x21')]['message']);}else{logger[_0xf65f('0x1b')](_0xf65f('0x1c'),_0x3640a2,_0xf65f('0x1d'));_0x3e502a(_0x193830['result'][_0xf65f('0x23')]);}})[_0xf65f('0x24')](function(_0x18ac2c){logger[_0xf65f('0x21')](_0xf65f('0x1c'),_0x3640a2,_0x18ac2c);_0x23967b(_0x18ac2c);});});}function respondWithStatusCode(_0x364c6f,_0x38098e){_0x38098e=_0x38098e||0xcc;return function(_0x1584ba){if(_0x1584ba){return _0x364c6f['sendStatus'](_0x38098e);}return _0x364c6f[_0xf65f('0x25')](_0x38098e)[_0xf65f('0x26')]();};}function respondWithResult(_0x1867ae,_0x42bc73){_0x42bc73=_0x42bc73||0xc8;return function(_0xfb2389){if(_0xfb2389){return _0x1867ae[_0xf65f('0x25')](_0x42bc73)[_0xf65f('0x27')](_0xfb2389);}};}function respondWithFilteredResult(_0x5aafc,_0x48cd69){return function(_0x1a9053){if(_0x1a9053){var _0x27901f=typeof _0x48cd69[_0xf65f('0x28')]===_0xf65f('0x29')&&typeof _0x48cd69[_0xf65f('0x2a')]==='undefined';var _0x1d679e=_0x1a9053[_0xf65f('0x2b')];var _0x112d3e=_0x27901f?0x0:_0x48cd69['offset'];var _0x2263f0=_0x27901f?_0x1a9053['count']:_0x48cd69[_0xf65f('0x28')]+_0x48cd69[_0xf65f('0x2a')];var _0x5d526c;if(_0x2263f0>=_0x1d679e){_0x2263f0=_0x1d679e;_0x5d526c=0xc8;}else{_0x5d526c=0xce;}_0x5aafc[_0xf65f('0x25')](_0x5d526c);return _0x5aafc['set'](_0xf65f('0x2c'),_0x112d3e+'-'+_0x2263f0+'/'+_0x1d679e)['json'](_0x1a9053);}return null;};}function patchUpdates(_0x17f75a){return function(_0x53b5f5){try{jsonpatch[_0xf65f('0x2d')](_0x53b5f5,_0x17f75a,!![]);}catch(_0x1e041f){return BPromise[_0xf65f('0x2e')](_0x1e041f);}return _0x53b5f5[_0xf65f('0x2f')]();};}function saveUpdates(_0x7fc8b4,_0x53b9b4){return function(_0xaf2406){if(_0xaf2406){return _0xaf2406[_0xf65f('0x30')](_0x7fc8b4)[_0xf65f('0x1a')](function(_0x1a2545){return _0x1a2545;});}return null;};}function removeEntity(_0x3c7696,_0x2baf1b){return function(_0x33b362){if(_0x33b362){return _0x33b362['destroy']()[_0xf65f('0x1a')](function(){_0x3c7696[_0xf65f('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x514bc1,_0x301688){return function(_0x42fbe1){if(!_0x42fbe1){_0x514bc1[_0xf65f('0x31')](0x194);}return _0x42fbe1;};}function handleError(_0x139754,_0x4d24f7){_0x4d24f7=_0x4d24f7||0x1f4;return function(_0x57da66){logger['error'](_0x57da66[_0xf65f('0x32')]);if(_0x57da66[_0xf65f('0x33')]){delete _0x57da66[_0xf65f('0x33')];}_0x139754[_0xf65f('0x25')](_0x4d24f7)[_0xf65f('0x34')](_0x57da66);};}exports[_0xf65f('0x35')]=function(_0x4bd069,_0xbd8ad5){var _0x5a8229={},_0x5b0e25={},_0x369963={'count':0x0,'rows':[]};var _0x486903=_[_0xf65f('0x36')](db[_0xf65f('0x37')][_0xf65f('0x38')],function(_0x5b6a5c){return{'name':_0x5b6a5c[_0xf65f('0x39')],'type':_0x5b6a5c['type'][_0xf65f('0x3a')]};});_0x5b0e25[_0xf65f('0x3b')]=_[_0xf65f('0x36')](_0x486903,_0xf65f('0x33'));_0x5b0e25['query']=_[_0xf65f('0x3c')](_0x4bd069[_0xf65f('0x3d')]);_0x5b0e25[_0xf65f('0x3e')]=_[_0xf65f('0x3f')](_0x5b0e25[_0xf65f('0x3b')],_0x5b0e25[_0xf65f('0x3d')]);_0x5a8229[_0xf65f('0x40')]=_[_0xf65f('0x3f')](_0x5b0e25[_0xf65f('0x3b')],qs[_0xf65f('0x41')](_0x4bd069[_0xf65f('0x3d')][_0xf65f('0x41')]));_0x5a8229[_0xf65f('0x40')]=_0x5a8229['attributes'][_0xf65f('0x42')]?_0x5a8229[_0xf65f('0x40')]:_0x5b0e25['model'];if(!_0x4bd069[_0xf65f('0x3d')]['hasOwnProperty']('nolimit')){_0x5a8229[_0xf65f('0x2a')]=qs[_0xf65f('0x2a')](_0x4bd069[_0xf65f('0x3d')][_0xf65f('0x2a')]);_0x5a8229[_0xf65f('0x28')]=qs[_0xf65f('0x28')](_0x4bd069['query'][_0xf65f('0x28')]);}_0x5a8229['order']=qs[_0xf65f('0x43')](_0x4bd069[_0xf65f('0x3d')][_0xf65f('0x43')]);_0x5a8229[_0xf65f('0x44')]=qs[_0xf65f('0x3e')](_[_0xf65f('0x45')](_0x4bd069[_0xf65f('0x3d')],_0x5b0e25[_0xf65f('0x3e')]),_0x486903);if(_0x4bd069[_0xf65f('0x3d')]['filter']){_0x5a8229[_0xf65f('0x44')]=_[_0xf65f('0x46')](_0x5a8229[_0xf65f('0x44')],{'$or':_[_0xf65f('0x36')](_0x486903,function(_0x541f00){if(_0x541f00[_0xf65f('0x47')]!==_0xf65f('0x48')){var _0x4b25b9={};_0x4b25b9[_0x541f00['name']]={'$like':'%'+_0x4bd069[_0xf65f('0x3d')][_0xf65f('0x49')]+'%'};return _0x4b25b9;}})});}_0x5a8229=_[_0xf65f('0x46')]({},_0x5a8229,_0x4bd069['options']);var _0x601a1c={'where':_0x5a8229[_0xf65f('0x44')]};return db[_0xf65f('0x37')]['count'](_0x601a1c)[_0xf65f('0x1a')](function(_0x543dc3){_0x369963['count']=_0x543dc3;if(_0x4bd069[_0xf65f('0x3d')]['includeAll']){_0x5a8229[_0xf65f('0x4a')]=[{'all':!![]}];}return db[_0xf65f('0x37')][_0xf65f('0x4b')](_0x5a8229);})[_0xf65f('0x1a')](function(_0x93c2f1){_0x369963[_0xf65f('0x4c')]=_0x93c2f1;return _0x369963;})['then'](respondWithFilteredResult(_0xbd8ad5,_0x5a8229))[_0xf65f('0x24')](handleError(_0xbd8ad5,null));};exports[_0xf65f('0x4d')]=function(_0x37b877,_0x2709d1){var _0x389cb6={'raw':![],'where':{'id':_0x37b877[_0xf65f('0x4e')]['id']}},_0x574c0a={};_0x574c0a[_0xf65f('0x3b')]=_[_0xf65f('0x3c')](db['Setting'][_0xf65f('0x38')]);_0x574c0a[_0xf65f('0x3d')]=_[_0xf65f('0x3c')](_0x37b877[_0xf65f('0x3d')]);_0x574c0a[_0xf65f('0x3e')]=_[_0xf65f('0x3f')](_0x574c0a[_0xf65f('0x3b')],_0x574c0a[_0xf65f('0x3d')]);_0x389cb6[_0xf65f('0x40')]=_[_0xf65f('0x3f')](_0x574c0a[_0xf65f('0x3b')],qs[_0xf65f('0x41')](_0x37b877['query'][_0xf65f('0x41')]));_0x389cb6['attributes']=_0x389cb6[_0xf65f('0x40')][_0xf65f('0x42')]?_0x389cb6['attributes']:_0x574c0a[_0xf65f('0x3b')];if(_0x37b877['query'][_0xf65f('0x4f')]){_0x389cb6['include']=[{'all':!![]}];}_0x389cb6=_[_0xf65f('0x46')]({},_0x389cb6,_0x37b877['options']);return db[_0xf65f('0x37')][_0xf65f('0x50')](_0x389cb6)[_0xf65f('0x1a')](handleEntityNotFound(_0x2709d1,null))[_0xf65f('0x1a')](respondWithResult(_0x2709d1,null))[_0xf65f('0x24')](handleError(_0x2709d1,null));};exports[_0xf65f('0x30')]=function(_0x13dc32,_0x2be180){if(_0x13dc32['body']['id']){delete _0x13dc32[_0xf65f('0x51')]['id'];}return db['Setting'][_0xf65f('0x50')]({'where':{'id':_0x13dc32['params']['id']}})[_0xf65f('0x1a')](handleEntityNotFound(_0x2be180,null))[_0xf65f('0x1a')](saveUpdates(_0x13dc32[_0xf65f('0x51')],null))[_0xf65f('0x1a')](respondWithResult(_0x2be180,null))[_0xf65f('0x24')](handleError(_0x2be180,null));};exports[_0xf65f('0x52')]=function(_0x45a4c0,_0x2e9119,_0x52cd02){if(_0x45a4c0[_0xf65f('0x53')]&&_0x45a4c0[_0xf65f('0x53')][_0xf65f('0x54')]){_0x45a4c0['body']['logo']=_0x45a4c0[_0xf65f('0x53')][_0xf65f('0x54')];}return db['Setting'][_0xf65f('0x50')]({'where':{'id':_0x45a4c0[_0xf65f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e9119,null))[_0xf65f('0x1a')](saveUpdates(_0x45a4c0[_0xf65f('0x51')],null))[_0xf65f('0x1a')](respondWithResult(_0x2e9119,null))[_0xf65f('0x24')](handleError(_0x2e9119,null));};exports['addLogoLogin']=function(_0x3d1d0d,_0x4e517f,_0x32bea4){if(_0x3d1d0d[_0xf65f('0x53')]&&_0x3d1d0d[_0xf65f('0x53')]['filename']){_0x3d1d0d[_0xf65f('0x51')][_0xf65f('0x55')]=_0x3d1d0d[_0xf65f('0x53')][_0xf65f('0x54')];}return db[_0xf65f('0x37')][_0xf65f('0x50')]({'where':{'id':_0x3d1d0d['params']['id']}})[_0xf65f('0x1a')](handleEntityNotFound(_0x4e517f,null))[_0xf65f('0x1a')](saveUpdates(_0x3d1d0d[_0xf65f('0x51')],null))[_0xf65f('0x1a')](respondWithResult(_0x4e517f,null))['catch'](handleError(_0x4e517f,null));};var utilLicense=require(_0xf65f('0x56'));exports[_0xf65f('0x57')]=function(_0x50f3fc,_0x5e2127,_0x479456){var _0x338d83=_0xf65f('0x58');var _0x150756={'custom':![]};return utilLicense[_0xf65f('0x59')]()[_0xf65f('0x1a')](function(_0x18846e){if(_0x18846e){_0x150756=_0x18846e;}return db[_0xf65f('0x37')][_0xf65f('0x50')]({'where':{'id':_0x50f3fc[_0xf65f('0x4e')]['id']},'attributes':['logo',_0xf65f('0x55'),_0xf65f('0x5a'),_0xf65f('0x5b'),'defaultLogo',_0xf65f('0x5c'),_0xf65f('0x5d'),_0xf65f('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x5e2127,null))['then'](function(_0xfefb7){if(_0xfefb7){var _0x587cec=_0xfefb7[_0xf65f('0x5f')]&&fs[_0xf65f('0x60')](path['join'](config[_0xf65f('0x61')],_0x338d83,_[_0xf65f('0x62')](_0xfefb7[_0xf65f('0x5f')])))?path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x338d83,_[_0xf65f('0x62')](_0xfefb7[_0xf65f('0x5f')])):path['join'](config['root'],_0x338d83,_['toLower'](_0xf65f('0x64')));var _0x42f93d=_0xf65f('0x65')+_[_0xf65f('0x66')](_0xf65f('0x5f'));if(_0xfefb7[_0x42f93d]||!_0x150756[_0xf65f('0x67')]){_0x587cec=path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x338d83,_[_0xf65f('0x62')]('default_logo.svg'));}if(!fs['existsSync'](_0x587cec)){throw new db['Sequelize'][(_0xf65f('0x68'))](_[_0xf65f('0x66')]('logo')+_0xf65f('0x69'));}return _0x5e2127[_0xf65f('0x6a')](_0x587cec);}})[_0xf65f('0x24')](handleError(_0x5e2127,null));};var utilLicense=require(_0xf65f('0x56'));exports[_0xf65f('0x6b')]=function(_0x14a8c0,_0x8828f4,_0x17f1f8){var _0x1f8c02=_0xf65f('0x58');var _0x5f309c={'custom':![]};return utilLicense[_0xf65f('0x59')]()[_0xf65f('0x1a')](function(_0x599a97){if(_0x599a97){_0x5f309c=_0x599a97;}return db[_0xf65f('0x37')][_0xf65f('0x50')]({'where':{'id':_0x14a8c0[_0xf65f('0x4e')]['id']},'attributes':[_0xf65f('0x5f'),_0xf65f('0x55'),'preferred','favicon',_0xf65f('0x6c'),_0xf65f('0x5c'),_0xf65f('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xf65f('0x1a')](handleEntityNotFound(_0x8828f4,null))['then'](function(_0x41a148){if(_0x41a148){var _0x24da11=_0x41a148[_0xf65f('0x55')]&&fs[_0xf65f('0x60')](path[_0xf65f('0x63')](config['root'],_0x1f8c02,_['toLower'](_0x41a148[_0xf65f('0x55')])))?path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x1f8c02,_['toLower'](_0x41a148[_0xf65f('0x55')])):path['join'](config[_0xf65f('0x61')],_0x1f8c02,_['toLower'](_0xf65f('0x6d')));var _0x17c45f=_0xf65f('0x65')+_[_0xf65f('0x66')](_0xf65f('0x55'));if(_0x41a148[_0x17c45f]||!_0x5f309c[_0xf65f('0x67')]){_0x24da11=path['join'](config[_0xf65f('0x61')],_0x1f8c02,_['toLower'](_0xf65f('0x6d')));}if(!fs['existsSync'](_0x24da11)){throw new db[(_0xf65f('0x6e'))]['ValidationError'](_[_0xf65f('0x66')](_0xf65f('0x55'))+_0xf65f('0x69'));}return _0x8828f4[_0xf65f('0x6a')](_0x24da11);}})[_0xf65f('0x24')](handleError(_0x8828f4,null));};exports[_0xf65f('0x6f')]=function(_0x4fafab,_0x1f936f){return db['Setting'][_0xf65f('0x50')]({'where':{'id':_0x4fafab[_0xf65f('0x4e')]['id']},'attributes':['securePassword']})[_0xf65f('0x1a')](respondWithResult(_0x1f936f,null))['catch'](handleError(_0x1f936f,null));};exports[_0xf65f('0x70')]=function(_0x3ae214,_0x3e66e1,_0x2ffb1d){if(_0x3ae214[_0xf65f('0x53')]&&_0x3ae214[_0xf65f('0x53')][_0xf65f('0x54')]){_0x3ae214[_0xf65f('0x51')][_0xf65f('0x5a')]=_0x3ae214[_0xf65f('0x53')][_0xf65f('0x54')];}return db[_0xf65f('0x37')]['find']({'where':{'id':_0x3ae214[_0xf65f('0x4e')]['id']}})[_0xf65f('0x1a')](handleEntityNotFound(_0x3e66e1,null))[_0xf65f('0x1a')](saveUpdates(_0x3ae214[_0xf65f('0x51')],null))[_0xf65f('0x1a')](respondWithResult(_0x3e66e1,null))[_0xf65f('0x24')](handleError(_0x3e66e1,null));};var utilLicense=require('../../config/license/util');exports[_0xf65f('0x71')]=function(_0x5a4b4a,_0x15c5c7,_0x5eabc6){var _0x20c39f=_0xf65f('0x58');var _0x342a80={'custom':![]};return utilLicense[_0xf65f('0x59')]()[_0xf65f('0x1a')](function(_0x356adb){if(_0x356adb){_0x342a80=_0x356adb;}return db[_0xf65f('0x37')][_0xf65f('0x50')]({'where':{'id':_0x5a4b4a[_0xf65f('0x4e')]['id']},'attributes':[_0xf65f('0x5f'),_0xf65f('0x55'),_0xf65f('0x5a'),_0xf65f('0x5b'),_0xf65f('0x6c'),'defaultLoginLogo','defaultPreferred',_0xf65f('0x5e')],'raw':!![]});})[_0xf65f('0x1a')](handleEntityNotFound(_0x15c5c7,null))['then'](function(_0x304c0b){if(_0x304c0b){var _0x3d088c=_0x304c0b[_0xf65f('0x5a')]&&fs[_0xf65f('0x60')](path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x20c39f,_['toLower'](_0x304c0b[_0xf65f('0x5a')])))?path[_0xf65f('0x63')](config['root'],_0x20c39f,_[_0xf65f('0x62')](_0x304c0b['preferred'])):path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x20c39f,_[_0xf65f('0x62')]('default_preferred.png'));var _0x5a19f9=_0xf65f('0x65')+_['upperFirst'](_0xf65f('0x5a'));if(_0x304c0b[_0x5a19f9]||!_0x342a80[_0xf65f('0x67')]||!_0x342a80[_0xf65f('0x5a')]){_0x3d088c=path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x20c39f,_[_0xf65f('0x62')](_0xf65f('0x72')));}if(!fs['existsSync'](_0x3d088c)){throw new db[(_0xf65f('0x6e'))][(_0xf65f('0x68'))](_['upperFirst'](_0xf65f('0x5a'))+'\x20not\x20found');}return _0x15c5c7['download'](_0x3d088c);}})[_0xf65f('0x24')](handleError(_0x15c5c7,null));};exports[_0xf65f('0x73')]=function(_0x3dac13,_0x37e45d,_0x11c779){if(_0x3dac13[_0xf65f('0x53')]&&_0x3dac13['file'][_0xf65f('0x54')]){_0x3dac13[_0xf65f('0x51')]['favicon']=_0x3dac13[_0xf65f('0x53')]['filename'];}return db[_0xf65f('0x37')][_0xf65f('0x50')]({'where':{'id':_0x3dac13['params']['id']}})['then'](handleEntityNotFound(_0x37e45d,null))[_0xf65f('0x1a')](saveUpdates(_0x3dac13[_0xf65f('0x51')],null))[_0xf65f('0x1a')](respondWithResult(_0x37e45d,null))[_0xf65f('0x24')](handleError(_0x37e45d,null));};var utilLicense=require('../../config/license/util');exports[_0xf65f('0x74')]=function(_0x43acc4,_0x236bab,_0x4cd9ea){var _0x185301='server/files/images/logos';var _0x59f776={'custom':![]};return utilLicense['getLicense']()[_0xf65f('0x1a')](function(_0x19ece0){if(_0x19ece0){_0x59f776=_0x19ece0;}return db['Setting'][_0xf65f('0x50')]({'where':{'id':_0x43acc4['params']['id']},'attributes':[_0xf65f('0x5f'),_0xf65f('0x55'),'preferred','favicon',_0xf65f('0x6c'),'defaultLoginLogo',_0xf65f('0x5d'),_0xf65f('0x5e')],'raw':!![]});})[_0xf65f('0x1a')](handleEntityNotFound(_0x236bab,null))['then'](function(_0xc37302){if(_0xc37302){var _0xe292df=_0xc37302[_0xf65f('0x5b')]&&fs['existsSync'](path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x185301,_['toLower'](_0xc37302[_0xf65f('0x5b')])))?path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x185301,_[_0xf65f('0x62')](_0xc37302[_0xf65f('0x5b')])):path[_0xf65f('0x63')](config[_0xf65f('0x61')],_0x185301,_[_0xf65f('0x62')](_0xf65f('0x75')));var _0x5814ae='default'+_[_0xf65f('0x66')](_0xf65f('0x5b'));if(_0xc37302[_0x5814ae]||!_0x59f776['custom']){_0xe292df=path['join'](config[_0xf65f('0x61')],_0x185301,_[_0xf65f('0x62')](_0xf65f('0x75')));}if(!fs[_0xf65f('0x60')](_0xe292df)){throw new db[(_0xf65f('0x6e'))][(_0xf65f('0x68'))](_['upperFirst'](_0xf65f('0x5b'))+_0xf65f('0x69'));}return _0x236bab['download'](_0xe292df);}})[_0xf65f('0x24')](handleError(_0x236bab,null));};exports['getDate']=function(_0x32db4a,_0x4ab230){var _0x1bc51a={'offset':moment()[_0xf65f('0x76')]()};_0x1bc51a[_0xf65f('0x77')]=moment()[_0xf65f('0x76')](_0x1bc51a['offset'])[_0xf65f('0x78')](_0xf65f('0x79'));return _0x4ab230[_0xf65f('0x25')](0xc8)['send'](_0x1bc51a);}; \ No newline at end of file +var _0x4471=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','body','addLogo','file','logo','filename','find','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','../../config/license/util','server/files/images/logos','default_loginLogo.svg','addPreferred','getPreferred','default_preferred.png','Sequelize','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end'];(function(_0x1e0b23,_0x447f13){var _0x9e049c=function(_0x41f9e3){while(--_0x41f9e3){_0x1e0b23['push'](_0x1e0b23['shift']());}};_0x9e049c(++_0x447f13);}(_0x4471,0x151));var _0x1447=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4471[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x1447('0x0'));var rimraf=require(_0x1447('0x1'));var zipdir=require(_0x1447('0x2'));var jsonpatch=require(_0x1447('0x3'));var rp=require(_0x1447('0x4'));var moment=require(_0x1447('0x5'));var BPromise=require(_0x1447('0x6'));var Mustache=require(_0x1447('0x7'));var util=require(_0x1447('0x8'));var path=require(_0x1447('0x9'));var sox=require(_0x1447('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1447('0xb'));var _=require(_0x1447('0xc'));var squel=require(_0x1447('0xd'));var crypto=require(_0x1447('0xe'));var jsforce=require(_0x1447('0xf'));var deskjs=require(_0x1447('0x10'));var toCsv=require(_0x1447('0x11'));var querystring=require(_0x1447('0x12'));var Papa=require(_0x1447('0x13'));var Redis=require(_0x1447('0x14'));var authService=require(_0x1447('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1447('0x16'));var logger=require('../../config/logger')(_0x1447('0x17'));var utils=require(_0x1447('0x18'));var config=require(_0x1447('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1447('0x1a'))['db'];var jayson=require(_0x1447('0x1b'));var client=jayson['client'][_0x1447('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x57f26e,_0x1ff900,_0x5cbaa3,_0x34291c){return new BPromise(function(_0x251b00,_0x221817){var _0x45587e=_0x34291c||client;return _0x45587e[_0x1447('0x1d')](_0x57f26e,_0x5cbaa3)['then'](function(_0x3a8cfb){logger[_0x1447('0x1e')](_0x1447('0x1f'),_0x1ff900,_0x1447('0x20'));logger['debug'](_0x1447('0x21'),_0x1ff900,_0x1447('0x20'),JSON['stringify'](_0x3a8cfb));if(_0x3a8cfb[_0x1447('0x22')]){if(_0x3a8cfb['error'][_0x1447('0x23')]===0x1f4){logger[_0x1447('0x22')](_0x1447('0x1f'),_0x1ff900,_0x3a8cfb[_0x1447('0x22')]['message']);return _0x221817(_0x3a8cfb['error'][_0x1447('0x24')]);}logger[_0x1447('0x22')](_0x1447('0x1f'),_0x1ff900,_0x3a8cfb['error'][_0x1447('0x24')]);return _0x251b00(_0x3a8cfb[_0x1447('0x22')][_0x1447('0x24')]);}else{logger[_0x1447('0x1e')](_0x1447('0x1f'),_0x1ff900,_0x1447('0x20'));_0x251b00(_0x3a8cfb['result'][_0x1447('0x24')]);}})[_0x1447('0x25')](function(_0x3a07b7){logger['error'](_0x1447('0x1f'),_0x1ff900,_0x3a07b7);_0x221817(_0x3a07b7);});});}function respondWithStatusCode(_0x5d6303,_0x1b6e03){_0x1b6e03=_0x1b6e03||0xcc;return function(_0x320e70){if(_0x320e70){return _0x5d6303[_0x1447('0x26')](_0x1b6e03);}return _0x5d6303[_0x1447('0x27')](_0x1b6e03)[_0x1447('0x28')]();};}function respondWithResult(_0x49523c,_0x4dbf5d){_0x4dbf5d=_0x4dbf5d||0xc8;return function(_0x409ae1){if(_0x409ae1){return _0x49523c[_0x1447('0x27')](_0x4dbf5d)[_0x1447('0x29')](_0x409ae1);}};}function respondWithFilteredResult(_0x12eb09,_0x3ece4a){return function(_0x4f034f){if(_0x4f034f){var _0x347daa=typeof _0x3ece4a[_0x1447('0x2a')]===_0x1447('0x2b')&&typeof _0x3ece4a[_0x1447('0x2c')]===_0x1447('0x2b');var _0x171fbd=_0x4f034f[_0x1447('0x2d')];var _0x149ee2=_0x347daa?0x0:_0x3ece4a['offset'];var _0x10cc6a=_0x347daa?_0x4f034f[_0x1447('0x2d')]:_0x3ece4a[_0x1447('0x2a')]+_0x3ece4a['limit'];var _0x392797;if(_0x10cc6a>=_0x171fbd){_0x10cc6a=_0x171fbd;_0x392797=0xc8;}else{_0x392797=0xce;}_0x12eb09[_0x1447('0x27')](_0x392797);return _0x12eb09[_0x1447('0x2e')](_0x1447('0x2f'),_0x149ee2+'-'+_0x10cc6a+'/'+_0x171fbd)[_0x1447('0x29')](_0x4f034f);}return null;};}function patchUpdates(_0x1806d4){return function(_0x8183ac){try{jsonpatch[_0x1447('0x30')](_0x8183ac,_0x1806d4,!![]);}catch(_0x553cb0){return BPromise['reject'](_0x553cb0);}return _0x8183ac[_0x1447('0x31')]();};}function saveUpdates(_0x6857e,_0x1f5b7b){return function(_0x320d7d){if(_0x320d7d){return _0x320d7d[_0x1447('0x32')](_0x6857e)[_0x1447('0x33')](function(_0x34029a){return _0x34029a;});}return null;};}function removeEntity(_0x1e063c,_0x1364af){return function(_0x563a13){if(_0x563a13){return _0x563a13[_0x1447('0x34')]()[_0x1447('0x33')](function(){_0x1e063c['status'](0xcc)[_0x1447('0x28')]();});}};}function handleEntityNotFound(_0x1dbe2f,_0x7ca4b1){return function(_0x437553){if(!_0x437553){_0x1dbe2f[_0x1447('0x26')](0x194);}return _0x437553;};}function handleError(_0x26c4a8,_0x44c613){_0x44c613=_0x44c613||0x1f4;return function(_0x3eab75){logger['error'](_0x3eab75[_0x1447('0x35')]);if(_0x3eab75[_0x1447('0x36')]){delete _0x3eab75[_0x1447('0x36')];}_0x26c4a8[_0x1447('0x27')](_0x44c613)[_0x1447('0x37')](_0x3eab75);};}exports[_0x1447('0x38')]=function(_0x1aada2,_0x1163b5){var _0x59d68c={},_0x53acc8={},_0x260817={'count':0x0,'rows':[]};var _0x5ab623=_[_0x1447('0x39')](db[_0x1447('0x3a')][_0x1447('0x3b')],function(_0x2df3c9){return{'name':_0x2df3c9[_0x1447('0x3c')],'type':_0x2df3c9['type'][_0x1447('0x3d')]};});_0x53acc8[_0x1447('0x3e')]=_[_0x1447('0x39')](_0x5ab623,'name');_0x53acc8[_0x1447('0x3f')]=_[_0x1447('0x40')](_0x1aada2[_0x1447('0x3f')]);_0x53acc8[_0x1447('0x41')]=_[_0x1447('0x42')](_0x53acc8[_0x1447('0x3e')],_0x53acc8[_0x1447('0x3f')]);_0x59d68c[_0x1447('0x43')]=_[_0x1447('0x42')](_0x53acc8[_0x1447('0x3e')],qs[_0x1447('0x44')](_0x1aada2[_0x1447('0x3f')][_0x1447('0x44')]));_0x59d68c['attributes']=_0x59d68c['attributes']['length']?_0x59d68c[_0x1447('0x43')]:_0x53acc8[_0x1447('0x3e')];if(!_0x1aada2[_0x1447('0x3f')][_0x1447('0x45')](_0x1447('0x46'))){_0x59d68c['limit']=qs['limit'](_0x1aada2['query']['limit']);_0x59d68c[_0x1447('0x2a')]=qs[_0x1447('0x2a')](_0x1aada2[_0x1447('0x3f')][_0x1447('0x2a')]);}_0x59d68c[_0x1447('0x47')]=qs[_0x1447('0x48')](_0x1aada2[_0x1447('0x3f')][_0x1447('0x48')]);_0x59d68c['where']=qs[_0x1447('0x41')](_[_0x1447('0x49')](_0x1aada2[_0x1447('0x3f')],_0x53acc8[_0x1447('0x41')]),_0x5ab623);if(_0x1aada2[_0x1447('0x3f')][_0x1447('0x4a')]){_0x59d68c[_0x1447('0x4b')]=_[_0x1447('0x4c')](_0x59d68c[_0x1447('0x4b')],{'$or':_[_0x1447('0x39')](_0x5ab623,function(_0x4db961){if(_0x4db961[_0x1447('0x4d')]!==_0x1447('0x4e')){var _0x5899ec={};_0x5899ec[_0x4db961[_0x1447('0x36')]]={'$like':'%'+_0x1aada2[_0x1447('0x3f')][_0x1447('0x4a')]+'%'};return _0x5899ec;}})});}_0x59d68c=_[_0x1447('0x4c')]({},_0x59d68c,_0x1aada2[_0x1447('0x4f')]);var _0x38572c={'where':_0x59d68c[_0x1447('0x4b')]};return db[_0x1447('0x3a')][_0x1447('0x2d')](_0x38572c)[_0x1447('0x33')](function(_0x5c676e){_0x260817[_0x1447('0x2d')]=_0x5c676e;if(_0x1aada2[_0x1447('0x3f')][_0x1447('0x50')]){_0x59d68c[_0x1447('0x51')]=[{'all':!![]}];}return db[_0x1447('0x3a')][_0x1447('0x52')](_0x59d68c);})[_0x1447('0x33')](function(_0x536027){_0x260817[_0x1447('0x53')]=_0x536027;return _0x260817;})[_0x1447('0x33')](respondWithFilteredResult(_0x1163b5,_0x59d68c))[_0x1447('0x25')](handleError(_0x1163b5,null));};exports[_0x1447('0x54')]=function(_0x5f427c,_0x58ce7d){var _0x25d3bf={'raw':![],'where':{'id':_0x5f427c[_0x1447('0x55')]['id']}},_0x1c3a9f={};_0x1c3a9f['model']=_[_0x1447('0x40')](db['Setting'][_0x1447('0x3b')]);_0x1c3a9f[_0x1447('0x3f')]=_[_0x1447('0x40')](_0x5f427c[_0x1447('0x3f')]);_0x1c3a9f['filters']=_[_0x1447('0x42')](_0x1c3a9f[_0x1447('0x3e')],_0x1c3a9f[_0x1447('0x3f')]);_0x25d3bf[_0x1447('0x43')]=_[_0x1447('0x42')](_0x1c3a9f['model'],qs['fields'](_0x5f427c['query'][_0x1447('0x44')]));_0x25d3bf['attributes']=_0x25d3bf[_0x1447('0x43')][_0x1447('0x56')]?_0x25d3bf[_0x1447('0x43')]:_0x1c3a9f['model'];if(_0x5f427c['query'][_0x1447('0x50')]){_0x25d3bf['include']=[{'all':!![]}];}_0x25d3bf=_[_0x1447('0x4c')]({},_0x25d3bf,_0x5f427c[_0x1447('0x4f')]);return db[_0x1447('0x3a')]['find'](_0x25d3bf)[_0x1447('0x33')](handleEntityNotFound(_0x58ce7d,null))['then'](respondWithResult(_0x58ce7d,null))['catch'](handleError(_0x58ce7d,null));};exports[_0x1447('0x32')]=function(_0x5793f7,_0x3cc712){if(_0x5793f7[_0x1447('0x57')]['id']){delete _0x5793f7[_0x1447('0x57')]['id'];}return db[_0x1447('0x3a')]['find']({'where':{'id':_0x5793f7['params']['id']}})[_0x1447('0x33')](handleEntityNotFound(_0x3cc712,null))[_0x1447('0x33')](saveUpdates(_0x5793f7['body'],null))[_0x1447('0x33')](respondWithResult(_0x3cc712,null))[_0x1447('0x25')](handleError(_0x3cc712,null));};exports[_0x1447('0x58')]=function(_0x4d192e,_0x22b7a4,_0x5736bb){if(_0x4d192e[_0x1447('0x59')]&&_0x4d192e[_0x1447('0x59')]['filename']){_0x4d192e[_0x1447('0x57')][_0x1447('0x5a')]=_0x4d192e['file'][_0x1447('0x5b')];}return db['Setting'][_0x1447('0x5c')]({'where':{'id':_0x4d192e['params']['id']}})[_0x1447('0x33')](handleEntityNotFound(_0x22b7a4,null))[_0x1447('0x33')](saveUpdates(_0x4d192e[_0x1447('0x57')],null))['then'](respondWithResult(_0x22b7a4,null))[_0x1447('0x25')](handleError(_0x22b7a4,null));};exports['addLogoLogin']=function(_0x345de4,_0x3d50c4,_0x3ce2b9){if(_0x345de4['file']&&_0x345de4[_0x1447('0x59')][_0x1447('0x5b')]){_0x345de4[_0x1447('0x57')][_0x1447('0x5d')]=_0x345de4[_0x1447('0x59')]['filename'];}return db[_0x1447('0x3a')][_0x1447('0x5c')]({'where':{'id':_0x345de4[_0x1447('0x55')]['id']}})[_0x1447('0x33')](handleEntityNotFound(_0x3d50c4,null))['then'](saveUpdates(_0x345de4[_0x1447('0x57')],null))[_0x1447('0x33')](respondWithResult(_0x3d50c4,null))[_0x1447('0x25')](handleError(_0x3d50c4,null));};var utilLicense=require('../../config/license/util');exports[_0x1447('0x5e')]=function(_0x3b544c,_0x321278,_0x7e8968){var _0x4c1c0a='server/files/images/logos';var _0x5d3e29={'custom':![]};return utilLicense[_0x1447('0x5f')]()[_0x1447('0x33')](function(_0x1c3227){if(_0x1c3227){_0x5d3e29=_0x1c3227;}return db[_0x1447('0x3a')][_0x1447('0x5c')]({'where':{'id':_0x3b544c[_0x1447('0x55')]['id']},'attributes':[_0x1447('0x5a'),_0x1447('0x5d'),_0x1447('0x60'),_0x1447('0x61'),_0x1447('0x62'),_0x1447('0x63'),_0x1447('0x64'),_0x1447('0x65')],'raw':!![]});})[_0x1447('0x33')](handleEntityNotFound(_0x321278,null))[_0x1447('0x33')](function(_0x574c27){if(_0x574c27){var _0xa1fda7=_0x574c27[_0x1447('0x5a')]&&fs[_0x1447('0x66')](path[_0x1447('0x67')](config['root'],_0x4c1c0a,_[_0x1447('0x68')](_0x574c27['logo'])))?path[_0x1447('0x67')](config[_0x1447('0x69')],_0x4c1c0a,_['toLower'](_0x574c27[_0x1447('0x5a')])):path[_0x1447('0x67')](config[_0x1447('0x69')],_0x4c1c0a,_[_0x1447('0x68')](_0x1447('0x6a')));var _0x3d34be=_0x1447('0x6b')+_[_0x1447('0x6c')](_0x1447('0x5a'));if(_0x574c27[_0x3d34be]||!_0x5d3e29[_0x1447('0x6d')]){_0xa1fda7=path['join'](config[_0x1447('0x69')],_0x4c1c0a,_['toLower'](_0x1447('0x6a')));}if(!fs[_0x1447('0x66')](_0xa1fda7)){throw new db['Sequelize'][(_0x1447('0x6e'))](_[_0x1447('0x6c')](_0x1447('0x5a'))+_0x1447('0x6f'));}return _0x321278[_0x1447('0x70')](_0xa1fda7);}})[_0x1447('0x25')](handleError(_0x321278,null));};var utilLicense=require(_0x1447('0x71'));exports['getLogoLogin']=function(_0x5f0e82,_0x539832,_0x43b3a9){var _0x38542f=_0x1447('0x72');var _0x197fd1={'custom':![]};return utilLicense[_0x1447('0x5f')]()[_0x1447('0x33')](function(_0x1a13cc){if(_0x1a13cc){_0x197fd1=_0x1a13cc;}return db[_0x1447('0x3a')][_0x1447('0x5c')]({'where':{'id':_0x5f0e82[_0x1447('0x55')]['id']},'attributes':[_0x1447('0x5a'),_0x1447('0x5d'),_0x1447('0x60'),_0x1447('0x61'),'defaultLogo',_0x1447('0x63'),_0x1447('0x64'),_0x1447('0x65')],'raw':!![]});})[_0x1447('0x33')](handleEntityNotFound(_0x539832,null))[_0x1447('0x33')](function(_0x2ec678){if(_0x2ec678){var _0x4c1f18=_0x2ec678[_0x1447('0x5d')]&&fs[_0x1447('0x66')](path[_0x1447('0x67')](config[_0x1447('0x69')],_0x38542f,_['toLower'](_0x2ec678[_0x1447('0x5d')])))?path[_0x1447('0x67')](config[_0x1447('0x69')],_0x38542f,_[_0x1447('0x68')](_0x2ec678[_0x1447('0x5d')])):path['join'](config[_0x1447('0x69')],_0x38542f,_[_0x1447('0x68')](_0x1447('0x73')));var _0x37cb51=_0x1447('0x6b')+_[_0x1447('0x6c')](_0x1447('0x5d'));if(_0x2ec678[_0x37cb51]||!_0x197fd1[_0x1447('0x6d')]){_0x4c1f18=path['join'](config['root'],_0x38542f,_[_0x1447('0x68')](_0x1447('0x73')));}if(!fs['existsSync'](_0x4c1f18)){throw new db['Sequelize'][(_0x1447('0x6e'))](_[_0x1447('0x6c')]('loginLogo')+'\x20not\x20found');}return _0x539832['download'](_0x4c1f18);}})[_0x1447('0x25')](handleError(_0x539832,null));};exports['gdpr']=function(_0x15422e,_0x3e685c){return db[_0x1447('0x3a')][_0x1447('0x5c')]({'where':{'id':_0x15422e[_0x1447('0x55')]['id']},'attributes':['securePassword']})[_0x1447('0x33')](respondWithResult(_0x3e685c,null))[_0x1447('0x25')](handleError(_0x3e685c,null));};exports[_0x1447('0x74')]=function(_0x461495,_0x5bc7cb,_0x50f929){if(_0x461495[_0x1447('0x59')]&&_0x461495['file']['filename']){_0x461495[_0x1447('0x57')][_0x1447('0x60')]=_0x461495[_0x1447('0x59')][_0x1447('0x5b')];}return db['Setting'][_0x1447('0x5c')]({'where':{'id':_0x461495[_0x1447('0x55')]['id']}})[_0x1447('0x33')](handleEntityNotFound(_0x5bc7cb,null))[_0x1447('0x33')](saveUpdates(_0x461495[_0x1447('0x57')],null))[_0x1447('0x33')](respondWithResult(_0x5bc7cb,null))['catch'](handleError(_0x5bc7cb,null));};var utilLicense=require(_0x1447('0x71'));exports[_0x1447('0x75')]=function(_0x2e2d59,_0x3769c8,_0x40dd7d){var _0x1a2128=_0x1447('0x72');var _0x29aaa4={'custom':![]};return utilLicense['getLicense']()[_0x1447('0x33')](function(_0x62c4a6){if(_0x62c4a6){_0x29aaa4=_0x62c4a6;}return db['Setting'][_0x1447('0x5c')]({'where':{'id':_0x2e2d59['params']['id']},'attributes':[_0x1447('0x5a'),_0x1447('0x5d'),_0x1447('0x60'),_0x1447('0x61'),_0x1447('0x62'),_0x1447('0x63'),'defaultPreferred',_0x1447('0x65')],'raw':!![]});})[_0x1447('0x33')](handleEntityNotFound(_0x3769c8,null))['then'](function(_0xddb0d6){if(_0xddb0d6){var _0x365ec1=_0xddb0d6[_0x1447('0x60')]&&fs[_0x1447('0x66')](path[_0x1447('0x67')](config[_0x1447('0x69')],_0x1a2128,_[_0x1447('0x68')](_0xddb0d6[_0x1447('0x60')])))?path['join'](config[_0x1447('0x69')],_0x1a2128,_['toLower'](_0xddb0d6[_0x1447('0x60')])):path[_0x1447('0x67')](config['root'],_0x1a2128,_[_0x1447('0x68')](_0x1447('0x76')));var _0x2c677d=_0x1447('0x6b')+_[_0x1447('0x6c')]('preferred');if(_0xddb0d6[_0x2c677d]||!_0x29aaa4[_0x1447('0x6d')]||!_0x29aaa4[_0x1447('0x60')]){_0x365ec1=path[_0x1447('0x67')](config[_0x1447('0x69')],_0x1a2128,_['toLower'](_0x1447('0x76')));}if(!fs['existsSync'](_0x365ec1)){throw new db[(_0x1447('0x77'))][(_0x1447('0x6e'))](_[_0x1447('0x6c')](_0x1447('0x60'))+_0x1447('0x6f'));}return _0x3769c8[_0x1447('0x70')](_0x365ec1);}})[_0x1447('0x25')](handleError(_0x3769c8,null));};exports['addFavicon']=function(_0x1a8c53,_0x1f51bd,_0x204dbc){if(_0x1a8c53['file']&&_0x1a8c53[_0x1447('0x59')][_0x1447('0x5b')]){_0x1a8c53[_0x1447('0x57')][_0x1447('0x61')]=_0x1a8c53[_0x1447('0x59')][_0x1447('0x5b')];}return db['Setting'][_0x1447('0x5c')]({'where':{'id':_0x1a8c53[_0x1447('0x55')]['id']}})[_0x1447('0x33')](handleEntityNotFound(_0x1f51bd,null))['then'](saveUpdates(_0x1a8c53[_0x1447('0x57')],null))[_0x1447('0x33')](respondWithResult(_0x1f51bd,null))[_0x1447('0x25')](handleError(_0x1f51bd,null));};var utilLicense=require(_0x1447('0x71'));exports[_0x1447('0x78')]=function(_0x5397ce,_0x5e5220,_0x1f2321){var _0x209ae0=_0x1447('0x72');var _0x13017f={'custom':![]};return utilLicense[_0x1447('0x5f')]()[_0x1447('0x33')](function(_0x4d8727){if(_0x4d8727){_0x13017f=_0x4d8727;}return db[_0x1447('0x3a')][_0x1447('0x5c')]({'where':{'id':_0x5397ce[_0x1447('0x55')]['id']},'attributes':[_0x1447('0x5a'),_0x1447('0x5d'),_0x1447('0x60'),'favicon','defaultLogo',_0x1447('0x63'),_0x1447('0x64'),'defaultFavicon'],'raw':!![]});})[_0x1447('0x33')](handleEntityNotFound(_0x5e5220,null))[_0x1447('0x33')](function(_0x8c00){if(_0x8c00){var _0x12cbf8=_0x8c00['favicon']&&fs['existsSync'](path[_0x1447('0x67')](config['root'],_0x209ae0,_['toLower'](_0x8c00[_0x1447('0x61')])))?path[_0x1447('0x67')](config[_0x1447('0x69')],_0x209ae0,_[_0x1447('0x68')](_0x8c00[_0x1447('0x61')])):path[_0x1447('0x67')](config[_0x1447('0x69')],_0x209ae0,_['toLower'](_0x1447('0x79')));var _0xbb9ade=_0x1447('0x6b')+_[_0x1447('0x6c')](_0x1447('0x61'));if(_0x8c00[_0xbb9ade]||!_0x13017f[_0x1447('0x6d')]){_0x12cbf8=path['join'](config[_0x1447('0x69')],_0x209ae0,_[_0x1447('0x68')](_0x1447('0x79')));}if(!fs[_0x1447('0x66')](_0x12cbf8)){throw new db['Sequelize'][(_0x1447('0x6e'))](_[_0x1447('0x6c')](_0x1447('0x61'))+_0x1447('0x6f'));}return _0x5e5220[_0x1447('0x70')](_0x12cbf8);}})['catch'](handleError(_0x5e5220,null));};exports[_0x1447('0x7a')]=function(_0x5557d4,_0x9c9a68){var _0x3cd2ba={'offset':moment()[_0x1447('0x7b')]()};_0x3cd2ba['now']=moment()[_0x1447('0x7b')](_0x3cd2ba[_0x1447('0x2a')])[_0x1447('0x7c')](_0x1447('0x7d'));return _0x9c9a68[_0x1447('0x27')](0xc8)['send'](_0x3cd2ba);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b6ac761..23e88bc 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x324661,_0x3fb798){var _0x135bed=function(_0x15aed6){while(--_0x15aed6){_0x324661['push'](_0x324661['shift']());}};_0x135bed(++_0x3fb798);}(_0x008c,0x188));var _0xc008=function(_0x55107e,_0x210c83){_0x55107e=_0x55107e-0x0;var _0x118ef9=_0x008c[_0x55107e];return _0x118ef9;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x123f6c,_0x3e34bc){var _0x1a35d0=function(_0x5efb66){while(--_0x5efb66){_0x123f6c['push'](_0x123f6c['shift']());}};_0x1a35d0(++_0x3e34bc);}(_0x3e74,0x175));var _0x43e7=function(_0x2ea7b1,_0x9c1fd8){_0x2ea7b1=_0x2ea7b1-0x0;var _0x2960e3=_0x3e74[_0x2ea7b1];return _0x2960e3;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 385fcc4..2db46d4 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 _0x612b=['model','attributes','ShowSetting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','where','include','map'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x612b,0x10c));var _0xb612=function(_0x33ecd7,_0x27a21d){_0x33ecd7=_0x33ecd7-0x0;var _0xbab453=_0x612b[_0x33ecd7];return _0xbab453;};'use strict';var _=require(_0xb612('0x0'));var util=require(_0xb612('0x1'));var moment=require(_0xb612('0x2'));var BPromise=require(_0xb612('0x3'));var rs=require(_0xb612('0x4'));var fs=require('fs');var Redis=require(_0xb612('0x5'));var db=require(_0xb612('0x6'))['db'];var utils=require(_0xb612('0x7'));var logger=require(_0xb612('0x8'))('rpc');var config=require(_0xb612('0x9'));var jayson=require(_0xb612('0xa'));var client=jayson[_0xb612('0xb')][_0xb612('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dee65,_0x437d5b,_0x231e9c){return new BPromise(function(_0x257691,_0x4176b5){return client[_0xb612('0xd')](_0x3dee65,_0x231e9c)[_0xb612('0xe')](function(_0x2060b7){logger[_0xb612('0xf')](_0xb612('0x10'),_0x437d5b,_0xb612('0x11'));logger[_0xb612('0x12')](_0xb612('0x13'),_0x437d5b,_0xb612('0x11'),JSON[_0xb612('0x14')](_0x2060b7));if(_0x2060b7[_0xb612('0x15')]){if(_0x2060b7[_0xb612('0x15')][_0xb612('0x16')]===0x1f4){logger[_0xb612('0x15')]('Setting,\x20%s,\x20%s',_0x437d5b,_0x2060b7[_0xb612('0x15')][_0xb612('0x17')]);return _0x4176b5(_0x2060b7[_0xb612('0x15')][_0xb612('0x17')]);}logger[_0xb612('0x15')](_0xb612('0x10'),_0x437d5b,_0x2060b7[_0xb612('0x15')][_0xb612('0x17')]);return _0x257691(_0x2060b7[_0xb612('0x15')][_0xb612('0x17')]);}else{logger[_0xb612('0xf')](_0xb612('0x10'),_0x437d5b,'request\x20sent');_0x257691(_0x2060b7[_0xb612('0x18')][_0xb612('0x17')]);}})['catch'](function(_0xd63740){logger[_0xb612('0x15')](_0xb612('0x10'),_0x437d5b,_0xd63740);_0x4176b5(_0xd63740);});});}exports['ShowSetting']=function(_0xbdb998){var _0xd05b1f=this;return new Promise(function(_0x17be0e,_0x3d5c4b){return db['Setting']['find']({'raw':_0xbdb998[_0xb612('0x19')]?_0xbdb998['options']['raw']===undefined?!![]:![]:!![],'where':_0xbdb998[_0xb612('0x19')]?_0xbdb998[_0xb612('0x19')][_0xb612('0x1a')]||null:null,'attributes':_0xbdb998[_0xb612('0x19')]?_0xbdb998[_0xb612('0x19')]['attributes']||null:null,'include':_0xbdb998['options']?_0xbdb998[_0xb612('0x19')][_0xb612('0x1b')]?_[_0xb612('0x1c')](_0xbdb998['options'][_0xb612('0x1b')],function(_0x4137d1){return{'model':db[_0x4137d1[_0xb612('0x1d')]],'as':_0x4137d1['as'],'attributes':_0x4137d1['attributes'],'include':_0x4137d1[_0xb612('0x1b')]?_['map'](_0x4137d1['include'],function(_0x553f27){return{'model':db[_0x553f27['model']],'as':_0x553f27['as'],'attributes':_0x553f27['attributes'],'include':_0x553f27[_0xb612('0x1b')]?_[_0xb612('0x1c')](_0x553f27['include'],function(_0x4300d5){return{'model':db[_0x4300d5['model']],'as':_0x4300d5['as'],'attributes':_0x4300d5[_0xb612('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb612('0xe')](function(_0x2e7b2c){logger['info'](_0xb612('0x1f'),_0xbdb998);logger[_0xb612('0x12')](_0xb612('0x1f'),_0xbdb998,JSON['stringify'](_0x2e7b2c));_0x17be0e(_0x2e7b2c);})[_0xb612('0x20')](function(_0x325b94){logger['error'](_0xb612('0x1f'),_0x325b94[_0xb612('0x17')],_0xbdb998);_0x3d5c4b(_0xd05b1f[_0xb612('0x15')](0x1f4,_0x325b94[_0xb612('0x17')]));});});}; \ No newline at end of file +var _0xf411=['stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x5879d2,_0x30bf5e){var _0x3194a5=function(_0x118202){while(--_0x118202){_0x5879d2['push'](_0x5879d2['shift']());}};_0x3194a5(++_0x30bf5e);}(_0xf411,0x19c));var _0x1f41=function(_0x128d75,_0x7ef83c){_0x128d75=_0x128d75-0x0;var _0x2034e3=_0xf411[_0x128d75];return _0x2034e3;};'use strict';var _=require(_0x1f41('0x0'));var util=require(_0x1f41('0x1'));var moment=require('moment');var BPromise=require(_0x1f41('0x2'));var rs=require(_0x1f41('0x3'));var fs=require('fs');var Redis=require(_0x1f41('0x4'));var db=require(_0x1f41('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f41('0x6'))(_0x1f41('0x7'));var config=require(_0x1f41('0x8'));var jayson=require(_0x1f41('0x9'));var client=jayson[_0x1f41('0xa')][_0x1f41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x198f99,_0x58f885,_0x2133fc){return new BPromise(function(_0x941f3d,_0x8ebd88){return client[_0x1f41('0xc')](_0x198f99,_0x2133fc)[_0x1f41('0xd')](function(_0x4356e9){logger[_0x1f41('0xe')](_0x1f41('0xf'),_0x58f885,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x58f885,_0x1f41('0x10'),JSON[_0x1f41('0x11')](_0x4356e9));if(_0x4356e9[_0x1f41('0x12')]){if(_0x4356e9[_0x1f41('0x12')]['code']===0x1f4){logger[_0x1f41('0x12')](_0x1f41('0xf'),_0x58f885,_0x4356e9[_0x1f41('0x12')][_0x1f41('0x13')]);return _0x8ebd88(_0x4356e9[_0x1f41('0x12')][_0x1f41('0x13')]);}logger[_0x1f41('0x12')](_0x1f41('0xf'),_0x58f885,_0x4356e9['error'][_0x1f41('0x13')]);return _0x941f3d(_0x4356e9[_0x1f41('0x12')][_0x1f41('0x13')]);}else{logger['info'](_0x1f41('0xf'),_0x58f885,_0x1f41('0x10'));_0x941f3d(_0x4356e9[_0x1f41('0x14')][_0x1f41('0x13')]);}})[_0x1f41('0x15')](function(_0x191a0e){logger['error'](_0x1f41('0xf'),_0x58f885,_0x191a0e);_0x8ebd88(_0x191a0e);});});}exports[_0x1f41('0x16')]=function(_0xdd3a37){var _0x131c70=this;return new Promise(function(_0x5ab54f,_0x3b586f){return db[_0x1f41('0x17')][_0x1f41('0x18')]({'raw':_0xdd3a37[_0x1f41('0x19')]?_0xdd3a37[_0x1f41('0x19')][_0x1f41('0x1a')]===undefined?!![]:![]:!![],'where':_0xdd3a37[_0x1f41('0x19')]?_0xdd3a37[_0x1f41('0x19')][_0x1f41('0x1b')]||null:null,'attributes':_0xdd3a37[_0x1f41('0x19')]?_0xdd3a37[_0x1f41('0x19')][_0x1f41('0x1c')]||null:null,'include':_0xdd3a37[_0x1f41('0x19')]?_0xdd3a37[_0x1f41('0x19')][_0x1f41('0x1d')]?_[_0x1f41('0x1e')](_0xdd3a37[_0x1f41('0x19')]['include'],function(_0x20d3a5){return{'model':db[_0x20d3a5['model']],'as':_0x20d3a5['as'],'attributes':_0x20d3a5['attributes'],'include':_0x20d3a5[_0x1f41('0x1d')]?_[_0x1f41('0x1e')](_0x20d3a5['include'],function(_0x2e0f0d){return{'model':db[_0x2e0f0d[_0x1f41('0x1f')]],'as':_0x2e0f0d['as'],'attributes':_0x2e0f0d[_0x1f41('0x1c')],'include':_0x2e0f0d[_0x1f41('0x1d')]?_[_0x1f41('0x1e')](_0x2e0f0d[_0x1f41('0x1d')],function(_0x3d5c1){return{'model':db[_0x3d5c1[_0x1f41('0x1f')]],'as':_0x3d5c1['as'],'attributes':_0x3d5c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f41('0xd')](function(_0x3afc89){logger[_0x1f41('0xe')](_0x1f41('0x16'),_0xdd3a37);logger[_0x1f41('0x20')](_0x1f41('0x16'),_0xdd3a37,JSON[_0x1f41('0x11')](_0x3afc89));_0x5ab54f(_0x3afc89);})[_0x1f41('0x15')](function(_0x788420){logger[_0x1f41('0x12')](_0x1f41('0x16'),_0x788420[_0x1f41('0x13')],_0xdd3a37);_0x3b586f(_0x131c70[_0x1f41('0x12')](0x1f4,_0x788420['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f74902f..564962a 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 _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(_0x4ceb13,_0x5e70f7){var _0x11f6e7=function(_0x1ffe46){while(--_0x1ffe46){_0x4ceb13['push'](_0x4ceb13['shift']());}};_0x11f6e7(++_0x5e70f7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var 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 +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(_0xd4dfdd,_0x1118ff){var _0x37264f=function(_0xf5889f){while(--_0xf5889f){_0xd4dfdd['push'](_0xd4dfdd['shift']());}};_0x37264f(++_0x1118ff);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 67b76b0..d45801e 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 _0x24fe=['intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24fe,0x8c));var _0xe24f=function(_0x42afae,_0x60b43){_0x42afae=_0x42afae-0x0;var _0x40e11f=_0x24fe[_0x42afae];return _0x40e11f;};'use strict';var Sequelize=require(_0xe24f('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xe24f('0x1')],'unique':_0xe24f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xe24f('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xe24f('0x1')],'defaultValue':function(){return rs[_0xe24f('0x3')]();}},'phone':{'type':Sequelize[_0xe24f('0x1')]},'type':{'type':Sequelize[_0xe24f('0x4')](_0xe24f('0x5'),_0xe24f('0x6'),_0xe24f('0x7'),_0xe24f('0x8'),_0xe24f('0x9'),_0xe24f('0xa'),_0xe24f('0xb'),_0xe24f('0xc'),_0xe24f('0xd'),_0xe24f('0xe'))},'accountSid':{'type':Sequelize[_0xe24f('0x1')]},'authId':{'type':Sequelize[_0xe24f('0x1')]},'authToken':{'type':Sequelize[_0xe24f('0x1')]},'smsMethod':{'type':Sequelize[_0xe24f('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe24f('0x1')]},'password':{'type':Sequelize[_0xe24f('0x1')]},'apiKey':{'type':Sequelize[_0xe24f('0x1')]},'applicationId':{'type':Sequelize[_0xe24f('0x1')]},'accountId':{'type':Sequelize[_0xe24f('0x1')]},'senderString':{'type':Sequelize[_0xe24f('0x1')]},'deliveryReport':{'type':Sequelize[_0xe24f('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xe24f('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe24f('0x10')],'defaultValue':function(){return _0xe24f('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe24f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe24f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe24f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe24f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe24f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe24f('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe24f('0x13'),'set':function(_0x52a84c){if(!_0x52a84c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe24f('0x14')](_0xe24f('0x15'),_0x52a84c);}}}; \ No newline at end of file +var _0x7e59=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x56de4d,_0x3453c6){var _0x425fb5=function(_0x5c6aeb){while(--_0x5c6aeb){_0x56de4d['push'](_0x56de4d['shift']());}};_0x425fb5(++_0x3453c6);}(_0x7e59,0x1b8));var _0x97e5=function(_0x3bb79f,_0x2584e6){_0x3bb79f=_0x3bb79f-0x0;var _0x3fb160=_0x7e59[_0x3bb79f];return _0x3fb160;};'use strict';var Sequelize=require(_0x97e5('0x0'));var rs=require('randomstring');module[_0x97e5('0x1')]={'name':{'type':Sequelize[_0x97e5('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x97e5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x97e5('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x97e5('0x3')]();}},'phone':{'type':Sequelize[_0x97e5('0x2')]},'type':{'type':Sequelize[_0x97e5('0x4')](_0x97e5('0x5'),'skebby',_0x97e5('0x6'),_0x97e5('0x7'),_0x97e5('0x8'),_0x97e5('0x9'),_0x97e5('0xa'),_0x97e5('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x97e5('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x97e5('0x2')]},'smsMethod':{'type':Sequelize[_0x97e5('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x97e5('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x97e5('0x2')]},'applicationId':{'type':Sequelize[_0x97e5('0x2')]},'accountId':{'type':Sequelize[_0x97e5('0x2')]},'senderString':{'type':Sequelize[_0x97e5('0x2')]},'deliveryReport':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x97e5('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x97e5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x97e5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x97e5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x97e5('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x97e5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x97e5('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x37f981){if(!_0x37f981)this[_0x97e5('0x10')](_0x97e5('0x11'),null);this['setDataValue'](_0x97e5('0x12'),_0x37f981);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4e2cd8b..0714024 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 _0xb46f=['createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','send','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','internal','Tag','Tags','tag','List','out','Messages','dataValues','push','inspect','skebby','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','bandwidth','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','keys','query','model','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','SmsAccount','findAll','rows','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','addDisposition','Disposition','findOne','pick','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','describe','Sequelize','ValidationError','difference'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0xb46f,0x66));var _0xfb46=function(_0x3dc6fa,_0x245908){_0x3dc6fa=_0x3dc6fa-0x0;var _0x1c368c=_0xb46f[_0x3dc6fa];return _0x1c368c;};'use strict';var emlformat=require(_0xfb46('0x0'));var rimraf=require(_0xfb46('0x1'));var zipdir=require(_0xfb46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb46('0x3'));var moment=require(_0xfb46('0x4'));var BPromise=require(_0xfb46('0x5'));var Mustache=require(_0xfb46('0x6'));var util=require(_0xfb46('0x7'));var path=require(_0xfb46('0x8'));var sox=require(_0xfb46('0x9'));var csv=require(_0xfb46('0xa'));var ejs=require(_0xfb46('0xb'));var fs=require('fs');var fs_extra=require(_0xfb46('0xc'));var _=require(_0xfb46('0xd'));var squel=require(_0xfb46('0xe'));var crypto=require(_0xfb46('0xf'));var jsforce=require(_0xfb46('0x10'));var deskjs=require(_0xfb46('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb46('0x12'));var Redis=require(_0xfb46('0x13'));var authService=require(_0xfb46('0x14'));var qs=require(_0xfb46('0x15'));var as=require(_0xfb46('0x16'));var hardwareService=require(_0xfb46('0x17'));var logger=require(_0xfb46('0x18'))(_0xfb46('0x19'));var utils=require(_0xfb46('0x1a'));var config=require(_0xfb46('0x1b'));var licenseUtil=require(_0xfb46('0x1c'));var db=require(_0xfb46('0x1d'))['db'];config[_0xfb46('0x1e')]=_[_0xfb46('0x1f')](config[_0xfb46('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb46('0x20'))(new Redis(config[_0xfb46('0x1e')]));require(_0xfb46('0x21'))['register'](socket);var jayson=require(_0xfb46('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x539772,_0x1cdcbf,_0x417b3d,_0x1feb0e){return new BPromise(function(_0x448236,_0x30651d){var _0x425a56=_0x1feb0e||client;return _0x425a56[_0xfb46('0x23')](_0x539772,_0x417b3d)[_0xfb46('0x24')](function(_0x2b7d75){logger['info'](_0xfb46('0x25'),_0x1cdcbf,_0xfb46('0x26'));logger[_0xfb46('0x27')](_0xfb46('0x28'),_0x1cdcbf,_0xfb46('0x26'),JSON[_0xfb46('0x29')](_0x2b7d75));if(_0x2b7d75[_0xfb46('0x2a')]){if(_0x2b7d75['error'][_0xfb46('0x2b')]===0x1f4){logger[_0xfb46('0x2a')](_0xfb46('0x25'),_0x1cdcbf,_0x2b7d75[_0xfb46('0x2a')]['message']);return _0x30651d(_0x2b7d75[_0xfb46('0x2a')]['message']);}logger['error'](_0xfb46('0x25'),_0x1cdcbf,_0x2b7d75[_0xfb46('0x2a')][_0xfb46('0x2c')]);return _0x448236(_0x2b7d75[_0xfb46('0x2a')][_0xfb46('0x2c')]);}else{logger[_0xfb46('0x2d')]('SmsAccount,\x20%s,\x20%s',_0x1cdcbf,_0xfb46('0x26'));_0x448236(_0x2b7d75['result'][_0xfb46('0x2c')]);}})[_0xfb46('0x2e')](function(_0x732b86){logger[_0xfb46('0x2a')](_0xfb46('0x25'),_0x1cdcbf,_0x732b86);_0x30651d(_0x732b86);});});}function respondWithStatusCode(_0x35f4ac,_0x406f0f){_0x406f0f=_0x406f0f||0xcc;return function(_0x1e3f4f){if(_0x1e3f4f){return _0x35f4ac[_0xfb46('0x2f')](_0x406f0f);}return _0x35f4ac[_0xfb46('0x30')](_0x406f0f)[_0xfb46('0x31')]();};}function respondWithResult(_0x4025c1,_0x26566b){_0x26566b=_0x26566b||0xc8;return function(_0x34d864){if(_0x34d864){return _0x4025c1[_0xfb46('0x30')](_0x26566b)[_0xfb46('0x32')](_0x34d864);}};}function respondWithFilteredResult(_0x382c6c,_0x441173){return function(_0x4529d4){if(_0x4529d4){var _0x5aabf2=typeof _0x441173[_0xfb46('0x33')]===_0xfb46('0x34')&&typeof _0x441173[_0xfb46('0x35')]===_0xfb46('0x34');var _0x1b816b=_0x4529d4[_0xfb46('0x36')];var _0x130bc2=_0x5aabf2?0x0:_0x441173[_0xfb46('0x33')];var _0x40cd6d=_0x5aabf2?_0x4529d4['count']:_0x441173[_0xfb46('0x33')]+_0x441173[_0xfb46('0x35')];var _0x561fbf;if(_0x40cd6d>=_0x1b816b){_0x40cd6d=_0x1b816b;_0x561fbf=0xc8;}else{_0x561fbf=0xce;}_0x382c6c[_0xfb46('0x30')](_0x561fbf);return _0x382c6c[_0xfb46('0x37')]('Content-Range',_0x130bc2+'-'+_0x40cd6d+'/'+_0x1b816b)['json'](_0x4529d4);}return null;};}function patchUpdates(_0x2bb498){return function(_0x440cfd){try{jsonpatch['apply'](_0x440cfd,_0x2bb498,!![]);}catch(_0x32f3d8){return BPromise[_0xfb46('0x38')](_0x32f3d8);}return _0x440cfd[_0xfb46('0x39')]();};}function saveUpdates(_0x720cba,_0x1791a8){return function(_0x1714a1){if(_0x1714a1){return _0x1714a1[_0xfb46('0x3a')](_0x720cba)[_0xfb46('0x24')](function(_0x245a3d){return _0x245a3d;});}return null;};}function removeEntity(_0x5239c9,_0xcd41fe){return function(_0x18d29b){if(_0x18d29b){return _0x18d29b['destroy']()[_0xfb46('0x24')](function(){var _0x3ef46a=_0x18d29b[_0xfb46('0x3b')]({'plain':!![]});var _0x22e4f5='SmsAccounts';return db[_0xfb46('0x3c')][_0xfb46('0x3d')]({'where':{'type':_0x22e4f5,'resourceId':_0x3ef46a['id']}})[_0xfb46('0x24')](function(){return _0x18d29b;});})[_0xfb46('0x24')](function(){_0x5239c9[_0xfb46('0x30')](0xcc)[_0xfb46('0x31')]();});}};}function handleEntityNotFound(_0xa42f6,_0x4ebbf9){return function(_0x5039eb){if(!_0x5039eb){_0xa42f6[_0xfb46('0x2f')](0x194);}return _0x5039eb;};}function handleError(_0x2f0b39,_0x5b773d){_0x5b773d=_0x5b773d||0x1f4;return function(_0x5da58e){logger[_0xfb46('0x2a')](_0x5da58e[_0xfb46('0x3e')]);if(_0x5da58e[_0xfb46('0x3f')]){delete _0x5da58e['name'];}_0x2f0b39[_0xfb46('0x30')](_0x5b773d)['send'](_0x5da58e);};}exports[_0xfb46('0x40')]=function(_0x28d35e,_0x156521){var _0x508999={'include':[{'model':db[_0xfb46('0x41')],'as':_0xfb46('0x42')}]},_0x334f5a={},_0x1c27c5={'count':0x0,'rows':[]};var _0x428d19=_[_0xfb46('0x43')](db['SmsAccount'][_0xfb46('0x44')],function(_0x2a5fb5){return{'name':_0x2a5fb5[_0xfb46('0x45')],'type':_0x2a5fb5[_0xfb46('0x46')]['key']};});_0x334f5a['model']=_['map'](_0x428d19,'name');_0x334f5a['query']=_[_0xfb46('0x47')](_0x28d35e[_0xfb46('0x48')]);_0x334f5a['filters']=_['intersection'](_0x334f5a[_0xfb46('0x49')],_0x334f5a[_0xfb46('0x48')]);_0x508999['attributes']=_[_0xfb46('0x4a')](_0x334f5a[_0xfb46('0x49')],qs[_0xfb46('0x4b')](_0x28d35e[_0xfb46('0x48')][_0xfb46('0x4b')]));_0x508999[_0xfb46('0x4c')]=_0x508999[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x508999['attributes']:_0x334f5a['model'];if(!_0x28d35e[_0xfb46('0x48')]['hasOwnProperty'](_0xfb46('0x4e'))){_0x508999[_0xfb46('0x35')]=qs[_0xfb46('0x35')](_0x28d35e[_0xfb46('0x48')]['limit']);_0x508999[_0xfb46('0x33')]=qs['offset'](_0x28d35e[_0xfb46('0x48')][_0xfb46('0x33')]);}_0x508999[_0xfb46('0x4f')]=qs[_0xfb46('0x50')](_0x28d35e[_0xfb46('0x48')][_0xfb46('0x50')]);_0x508999[_0xfb46('0x51')]=qs[_0xfb46('0x52')](_['pick'](_0x28d35e['query'],_0x334f5a[_0xfb46('0x52')]),_0x428d19);if(_0x28d35e[_0xfb46('0x48')][_0xfb46('0x53')]){_0x508999[_0xfb46('0x51')]=_[_0xfb46('0x54')](_0x508999[_0xfb46('0x51')],{'$or':_[_0xfb46('0x43')](_0x428d19,function(_0x5bfc81){if(_0x5bfc81[_0xfb46('0x46')]!==_0xfb46('0x55')){var _0xc38add={};_0xc38add[_0x5bfc81[_0xfb46('0x3f')]]={'$like':'%'+_0x28d35e['query'][_0xfb46('0x53')]+'%'};return _0xc38add;}})});}_0x508999=_[_0xfb46('0x54')]({},_0x508999,_0x28d35e[_0xfb46('0x56')]);var _0x949acb={'where':_0x508999[_0xfb46('0x51')]};return db['SmsAccount']['count'](_0x949acb)[_0xfb46('0x24')](function(_0x5d1223){_0x1c27c5[_0xfb46('0x36')]=_0x5d1223;if(_0x28d35e[_0xfb46('0x48')]['includeAll']){_0x508999[_0xfb46('0x57')]=[{'all':!![]}];}return db[_0xfb46('0x58')][_0xfb46('0x59')](_0x508999);})['then'](function(_0x45443d){_0x1c27c5[_0xfb46('0x5a')]=_0x45443d;return _0x1c27c5;})[_0xfb46('0x24')](respondWithFilteredResult(_0x156521,_0x508999))[_0xfb46('0x2e')](handleError(_0x156521,null));};exports[_0xfb46('0x5b')]=function(_0x9baa06,_0x47a4dd){var _0x33f78a={'raw':![],'where':{'id':_0x9baa06['params']['id']},'include':[{'model':db[_0xfb46('0x41')],'as':_0xfb46('0x42')}]},_0x2bf1bb={};_0x2bf1bb['model']=_[_0xfb46('0x47')](db[_0xfb46('0x58')]['rawAttributes']);_0x2bf1bb[_0xfb46('0x48')]=_[_0xfb46('0x47')](_0x9baa06[_0xfb46('0x48')]);_0x2bf1bb[_0xfb46('0x52')]=_[_0xfb46('0x4a')](_0x2bf1bb['model'],_0x2bf1bb[_0xfb46('0x48')]);_0x33f78a[_0xfb46('0x4c')]=_[_0xfb46('0x4a')](_0x2bf1bb[_0xfb46('0x49')],qs['fields'](_0x9baa06[_0xfb46('0x48')][_0xfb46('0x4b')]));_0x33f78a[_0xfb46('0x4c')]=_0x33f78a[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x33f78a[_0xfb46('0x4c')]:_0x2bf1bb[_0xfb46('0x49')];if(_0x9baa06['query'][_0xfb46('0x5c')]){_0x33f78a['include']=[{'all':!![]}];}_0x33f78a=_[_0xfb46('0x54')]({},_0x33f78a,_0x9baa06['options']);return db[_0xfb46('0x58')][_0xfb46('0x5d')](_0x33f78a)[_0xfb46('0x24')](handleEntityNotFound(_0x47a4dd,null))[_0xfb46('0x24')](respondWithResult(_0x47a4dd,null))[_0xfb46('0x2e')](handleError(_0x47a4dd,null));};exports[_0xfb46('0x5e')]=function(_0x56c29e,_0x101e52){return db[_0xfb46('0x58')][_0xfb46('0x5e')](_0x56c29e['body'],{})[_0xfb46('0x24')](function(_0x3fe414){var _0x31731f=_0x56c29e[_0xfb46('0x5f')][_0xfb46('0x3b')]({'plain':!![]});if(!_0x31731f)throw new Error(_0xfb46('0x60'));if(_0x31731f['role']===_0xfb46('0x5f')){var _0x73ccb=_0x3fe414[_0xfb46('0x3b')]({'plain':!![]});var _0x23a291=_0xfb46('0x61');return db['UserProfileSection'][_0xfb46('0x5d')]({'where':{'name':_0x23a291,'userProfileId':_0x31731f[_0xfb46('0x62')]},'raw':!![]})['then'](function(_0x29fdd7){if(_0x29fdd7&&_0x29fdd7[_0xfb46('0x63')]===0x0){return db[_0xfb46('0x3c')]['create']({'name':_0x73ccb[_0xfb46('0x3f')],'resourceId':_0x73ccb['id'],'type':_0x29fdd7[_0xfb46('0x3f')],'sectionId':_0x29fdd7['id']},{})['then'](function(){return _0x3fe414;});}else{return _0x3fe414;}})['catch'](function(_0x1a7d64){logger[_0xfb46('0x2a')](_0xfb46('0x64'),_0x1a7d64);throw _0x1a7d64;});}return _0x3fe414;})[_0xfb46('0x24')](respondWithResult(_0x101e52,0xc9))[_0xfb46('0x2e')](handleError(_0x101e52,null));};exports[_0xfb46('0x3a')]=function(_0x4ed85c,_0x2d0379){if(_0x4ed85c['body']['id']){delete _0x4ed85c['body']['id'];}return db[_0xfb46('0x58')][_0xfb46('0x5d')]({'where':{'id':_0x4ed85c[_0xfb46('0x65')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2d0379,null))[_0xfb46('0x24')](saveUpdates(_0x4ed85c[_0xfb46('0x66')],null))[_0xfb46('0x24')](respondWithResult(_0x2d0379,null))['catch'](handleError(_0x2d0379,null));};exports[_0xfb46('0x3d')]=function(_0x105db1,_0xb53a60){return db[_0xfb46('0x58')][_0xfb46('0x5d')]({'where':{'id':_0x105db1[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0xb53a60,null))[_0xfb46('0x24')](removeEntity(_0xb53a60,null))['catch'](handleError(_0xb53a60,null));};exports['describe']=function(_0x48f3ae,_0x33fe7c){return db[_0xfb46('0x58')]['describe']()[_0xfb46('0x24')](respondWithResult(_0x33fe7c,null))[_0xfb46('0x2e')](handleError(_0x33fe7c,null));};exports[_0xfb46('0x67')]=function(_0x5ae508,_0x42ca38,_0x2464c2){if(_0x5ae508['body']['id']){delete _0x5ae508[_0xfb46('0x66')]['id'];}return db['SmsAccount'][_0xfb46('0x5d')]({'where':{'id':_0x5ae508['params']['id']}})['then'](handleEntityNotFound(_0x42ca38,null))[_0xfb46('0x24')](function(_0x59fb47){if(_0x59fb47){_0x5ae508[_0xfb46('0x66')]['SmsAccountId']=_0x59fb47['id'];return db[_0xfb46('0x68')][_0xfb46('0x5e')](_0x5ae508[_0xfb46('0x66')]);}})['then'](respondWithResult(_0x42ca38,null))[_0xfb46('0x2e')](handleError(_0x42ca38,null));};exports['getDispositions']=function(_0x26382f,_0x5a06e4,_0x7fadbf){var _0xcdc959={'raw':![],'where':{}};var _0x9d8e57={};var _0x48f2a0={'count':0x0,'rows':[]};return db[_0xfb46('0x58')][_0xfb46('0x69')]({'where':{'id':_0x26382f[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x5a06e4,null))['then'](function(_0x6858){if(_0x6858){_0x9d8e57['model']=_['keys'](db[_0xfb46('0x68')]['rawAttributes']);_0x9d8e57['query']=_['keys'](_0x26382f[_0xfb46('0x48')]);_0x9d8e57[_0xfb46('0x52')]=_[_0xfb46('0x4a')](_0x9d8e57[_0xfb46('0x49')],_0x9d8e57[_0xfb46('0x48')]);_0xcdc959['attributes']=_['intersection'](_0x9d8e57[_0xfb46('0x49')],qs[_0xfb46('0x4b')](_0x26382f[_0xfb46('0x48')][_0xfb46('0x4b')]));_0xcdc959['attributes']=_0xcdc959[_0xfb46('0x4c')]['length']?_0xcdc959['attributes']:_0x9d8e57[_0xfb46('0x49')];if(!_0x26382f[_0xfb46('0x48')]['hasOwnProperty']('nolimit')){_0xcdc959[_0xfb46('0x35')]=qs[_0xfb46('0x35')](_0x26382f[_0xfb46('0x48')][_0xfb46('0x35')]);_0xcdc959[_0xfb46('0x33')]=qs[_0xfb46('0x33')](_0x26382f[_0xfb46('0x48')][_0xfb46('0x33')]);}_0xcdc959[_0xfb46('0x4f')]=qs[_0xfb46('0x50')](_0x26382f['query'][_0xfb46('0x50')]);_0xcdc959['where']=qs[_0xfb46('0x52')](_[_0xfb46('0x6a')](_0x26382f[_0xfb46('0x48')],_0x9d8e57[_0xfb46('0x52')]));_0xcdc959[_0xfb46('0x51')][_0xfb46('0x6b')]=_0x6858['id'];if(_0x26382f[_0xfb46('0x48')][_0xfb46('0x53')]){_0xcdc959[_0xfb46('0x51')]=_[_0xfb46('0x54')](_0xcdc959[_0xfb46('0x51')],{'$or':_['map'](_0xcdc959[_0xfb46('0x4c')],function(_0x29ed49){var _0x3c8311={};_0x3c8311[_0x29ed49]={'$like':'%'+_0x26382f[_0xfb46('0x48')]['filter']+'%'};return _0x3c8311;})});}_0xcdc959=_[_0xfb46('0x54')]({},_0xcdc959,_0x26382f[_0xfb46('0x56')]);return db['Disposition'][_0xfb46('0x36')]({'where':_0xcdc959[_0xfb46('0x51')]})[_0xfb46('0x24')](function(_0x2873df){_0x48f2a0[_0xfb46('0x36')]=_0x2873df;if(_0x26382f[_0xfb46('0x48')][_0xfb46('0x5c')]){_0xcdc959[_0xfb46('0x57')]=[{'all':!![]}];}return db[_0xfb46('0x68')][_0xfb46('0x59')](_0xcdc959);})[_0xfb46('0x24')](function(_0x18943d){_0x48f2a0[_0xfb46('0x5a')]=_0x18943d;return _0x48f2a0;});}})['then'](respondWithFilteredResult(_0x5a06e4,_0xcdc959))[_0xfb46('0x2e')](handleError(_0x5a06e4,null));};exports[_0xfb46('0x6c')]=function(_0x4aac21,_0x2f4826,_0x3cf39a){return db[_0xfb46('0x58')][_0xfb46('0x5d')]({'where':{'id':_0x4aac21[_0xfb46('0x65')]['id']}})['then'](handleEntityNotFound(_0x2f4826,null))[_0xfb46('0x24')](function(_0x36ec83){if(_0x36ec83){return _0x36ec83[_0xfb46('0x6c')](_0x4aac21[_0xfb46('0x48')][_0xfb46('0x6d')]);}})[_0xfb46('0x24')](respondWithStatusCode(_0x2f4826,null))[_0xfb46('0x2e')](handleError(_0x2f4826,null));};exports[_0xfb46('0x6e')]=function(_0x4bf159,_0x4d1a99,_0x2ddd38){if(_0x4bf159[_0xfb46('0x66')]['id']){delete _0x4bf159['body']['id'];}return db[_0xfb46('0x58')]['find']({'where':{'id':_0x4bf159['params']['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x4d1a99,null))[_0xfb46('0x24')](function(_0x245aef){if(_0x245aef){_0x4bf159['body'][_0xfb46('0x6b')]=_0x245aef['id'];return db[_0xfb46('0x6f')][_0xfb46('0x5e')](_0x4bf159[_0xfb46('0x66')]);}})['then'](respondWithResult(_0x4d1a99,null))[_0xfb46('0x2e')](handleError(_0x4d1a99,null));};exports['getAnswers']=function(_0x3bb728,_0x4ee351,_0x1800f2){var _0x5bc539={'raw':![],'where':{}};var _0x4cdc0a={};var _0x8e3070={'count':0x0,'rows':[]};return db[_0xfb46('0x58')][_0xfb46('0x69')]({'where':{'id':_0x3bb728[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x4ee351,null))[_0xfb46('0x24')](function(_0x3a9925){if(_0x3a9925){_0x4cdc0a[_0xfb46('0x49')]=_[_0xfb46('0x47')](db['CannedAnswer'][_0xfb46('0x44')]);_0x4cdc0a[_0xfb46('0x48')]=_[_0xfb46('0x47')](_0x3bb728[_0xfb46('0x48')]);_0x4cdc0a[_0xfb46('0x52')]=_['intersection'](_0x4cdc0a[_0xfb46('0x49')],_0x4cdc0a[_0xfb46('0x48')]);_0x5bc539[_0xfb46('0x4c')]=_['intersection'](_0x4cdc0a[_0xfb46('0x49')],qs[_0xfb46('0x4b')](_0x3bb728['query'][_0xfb46('0x4b')]));_0x5bc539[_0xfb46('0x4c')]=_0x5bc539[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x5bc539[_0xfb46('0x4c')]:_0x4cdc0a['model'];if(!_0x3bb728[_0xfb46('0x48')][_0xfb46('0x70')](_0xfb46('0x4e'))){_0x5bc539[_0xfb46('0x35')]=qs[_0xfb46('0x35')](_0x3bb728['query'][_0xfb46('0x35')]);_0x5bc539[_0xfb46('0x33')]=qs[_0xfb46('0x33')](_0x3bb728[_0xfb46('0x48')]['offset']);}_0x5bc539[_0xfb46('0x4f')]=qs[_0xfb46('0x50')](_0x3bb728[_0xfb46('0x48')][_0xfb46('0x50')]);_0x5bc539[_0xfb46('0x51')]=qs['filters'](_[_0xfb46('0x6a')](_0x3bb728[_0xfb46('0x48')],_0x4cdc0a[_0xfb46('0x52')]));_0x5bc539[_0xfb46('0x51')][_0xfb46('0x6b')]=_0x3a9925['id'];if(_0x3bb728[_0xfb46('0x48')]['filter']){_0x5bc539[_0xfb46('0x51')]=_[_0xfb46('0x54')](_0x5bc539[_0xfb46('0x51')],{'$or':_[_0xfb46('0x43')](_0x5bc539[_0xfb46('0x4c')],function(_0x969003){var _0x59f32b={};_0x59f32b[_0x969003]={'$like':'%'+_0x3bb728[_0xfb46('0x48')][_0xfb46('0x53')]+'%'};return _0x59f32b;})});}_0x5bc539=_[_0xfb46('0x54')]({},_0x5bc539,_0x3bb728[_0xfb46('0x56')]);return db['CannedAnswer'][_0xfb46('0x36')]({'where':_0x5bc539[_0xfb46('0x51')]})['then'](function(_0x5c8993){_0x8e3070[_0xfb46('0x36')]=_0x5c8993;if(_0x3bb728['query'][_0xfb46('0x5c')]){_0x5bc539[_0xfb46('0x57')]=[{'all':!![]}];}return db[_0xfb46('0x6f')][_0xfb46('0x59')](_0x5bc539);})['then'](function(_0x342fb8){_0x8e3070[_0xfb46('0x5a')]=_0x342fb8;return _0x8e3070;});}})[_0xfb46('0x24')](respondWithFilteredResult(_0x4ee351,_0x5bc539))[_0xfb46('0x2e')](handleError(_0x4ee351,null));};exports['removeAnswers']=function(_0x5d6008,_0x2d5c53,_0x510852){return db[_0xfb46('0x58')]['find']({'where':{'id':_0x5d6008[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x2d5c53,null))[_0xfb46('0x24')](function(_0xbef3b0){if(_0xbef3b0){return _0xbef3b0[_0xfb46('0x71')](_0x5d6008[_0xfb46('0x48')][_0xfb46('0x6d')]);}})[_0xfb46('0x24')](respondWithStatusCode(_0x2d5c53,null))[_0xfb46('0x2e')](handleError(_0x2d5c53,null));};exports[_0xfb46('0x72')]=function(_0x110202,_0x2584f0,_0x4c84c2){var _0xc6ac3a={'channel':'sms'};var _0x114a16=[];var _0x235357=[];var _0x44ae7a={};return db[_0xfb46('0x58')]['find']({'where':{'id':_0x110202[_0xfb46('0x65')]['id']},'include':[{'model':db[_0xfb46('0x73')],'as':_0xfb46('0x74')}]})['then'](handleEntityNotFound(_0x2584f0,null))[_0xfb46('0x24')](function(_0x53367d){_0xc6ac3a[_0xfb46('0x75')]=_0x53367d;_0xc6ac3a[_0xfb46('0x76')]=_[_0xfb46('0x77')](_0x53367d['Applications'],[_0xfb46('0x78')],['asc']);if(_0xc6ac3a['account'][_0xfb46('0x74')]){delete _0xc6ac3a[_0xfb46('0x75')][_0xfb46('0x74')];}return db[_0xfb46('0x79')][_0xfb46('0x7a')]();})[_0xfb46('0x24')](function(_0x1150a1){if(!_0x1150a1){throw new db[(_0xfb46('0x7b'))][(_0xfb46('0x7c'))]('no\x20available\x20attributes');}_0x114a16=_[_0xfb46('0x7d')](_['keys'](_0x1150a1),[_0xfb46('0x7e'),'updatedAt']);_0x235357=_[_0xfb46('0x7d')](_[_0xfb46('0x47')](_0x1150a1),[_0xfb46('0x7e'),_0xfb46('0x7f'),_0xfb46('0x80'),_0xfb46('0x81')]);_0xc6ac3a[_0xfb46('0x66')]={'mapKey':'mobile'};if(_0xc6ac3a[_0xfb46('0x75')][_0xfb46('0x46')]){switch(_0xc6ac3a['account']['type']){case _0xfb46('0x82'):_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x83')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x84')];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x66')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x85')];_0xc6ac3a['body'][_0xfb46('0x86')]=_0x110202['body'][_0xfb46('0x87')];break;case'skebby':_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x83')]='+'+_0x110202['body'][_0xfb46('0x88')];_0xc6ac3a['body']['body']=_0x110202[_0xfb46('0x66')][_0xfb46('0x89')];break;case _0xfb46('0x8a'):_0xc6ac3a[_0xfb46('0x66')]['from']=_0x110202[_0xfb46('0x66')][_0xfb46('0x83')];_0xc6ac3a[_0xfb46('0x66')]['body']=_0x110202[_0xfb46('0x66')][_0xfb46('0x2c')];break;case'clicksend':_0xc6ac3a['body'][_0xfb46('0x83')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x83')];_0xc6ac3a['body'][_0xfb46('0x66')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x66')];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x86')]=_0x110202['body'][_0xfb46('0x8b')];break;case _0xfb46('0x8c'):_0xc6ac3a[_0xfb46('0x66')]['from']=_0x110202[_0xfb46('0x66')]['From'];_0xc6ac3a['body'][_0xfb46('0x66')]=_0x110202[_0xfb46('0x66')]['Text'];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x86')]=_0x110202['body'][_0xfb46('0x8d')];break;case _0xfb46('0x8e'):_0xc6ac3a['body'][_0xfb46('0x83')]='+'+_0x110202[_0xfb46('0x66')][_0xfb46('0x8f')][0x0][_0xfb46('0x83')];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x66')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x8f')][0x0][_0xfb46('0x89')];_0xc6ac3a[_0xfb46('0x66')]['messageId']=_0x110202['body'][_0xfb46('0x8f')][0x0][_0xfb46('0x86')];break;case _0xfb46('0x90'):_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x83')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x91')];_0xc6ac3a[_0xfb46('0x66')]['body']=_0x110202[_0xfb46('0x66')][_0xfb46('0x92')][_0xfb46('0x2c')];break;case _0xfb46('0x93'):_0xc6ac3a[_0xfb46('0x66')]['from']=_0x110202[_0xfb46('0x66')]['fromNumber'];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x66')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x89')];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x86')]=_0x110202['body'][_0xfb46('0x94')];break;case'bandwidth':_0xc6ac3a[_0xfb46('0x66')]['messageId']=_0x110202[_0xfb46('0x66')][0x0][_0xfb46('0x2c')]['id'];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x83')]=_0x110202['body'][0x0][_0xfb46('0x2c')][_0xfb46('0x83')];_0xc6ac3a[_0xfb46('0x66')]['body']=_0x110202[_0xfb46('0x66')][0x0][_0xfb46('0x2c')][_0xfb46('0x89')];break;case _0xfb46('0x95'):_0xc6ac3a[_0xfb46('0x66')]['from']=_0x110202[_0xfb46('0x66')][_0xfb46('0x83')];_0xc6ac3a['body'][_0xfb46('0x66')]=_0x110202['body']['message'];_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x86')]=_0x110202[_0xfb46('0x66')][_0xfb46('0x96')];break;}}if(_0xc6ac3a['body']['id']){delete _0xc6ac3a['body']['id'];}if(_[_0xfb46('0x97')](_0xc6ac3a['body']['from'])){throw new db['Sequelize'][(_0xfb46('0x7c'))](_0xfb46('0x98'));}if(_[_0xfb46('0x97')](_0xc6ac3a['body'][_0xfb46('0x66')])||_0xc6ac3a['body'][_0xfb46('0x66')]===''){throw new db[(_0xfb46('0x7b'))]['ValidationError'](_0xfb46('0x99'));}if(_[_0xfb46('0x97')](_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x9a')])){throw new db['Sequelize'][(_0xfb46('0x7c'))](_0xfb46('0x9b')+_0x235357);}if(!_[_0xfb46('0x9c')](_0x235357,_0xc6ac3a['body'][_0xfb46('0x9a')])){throw new db['Sequelize'][(_0xfb46('0x7c'))](_0xfb46('0x9d')+_0x235357);}_0x44ae7a[_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x9a')]]=_0xc6ac3a[_0xfb46('0x66')]['from'];return db[_0xfb46('0x9e')][_0xfb46('0x5d')]({'where':{'id':_0xc6ac3a['account'][_0xfb46('0x81')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x44ae7a,'limit':0x1,'order':[[_0xfb46('0x7f'),_0xfb46('0x9f')]]}]});})[_0xfb46('0x24')](handleEntityNotFound(_0x2584f0,null))[_0xfb46('0x24')](function(_0x292446){if(_0x292446){_0xc6ac3a[_0xfb46('0xa0')]=_['omit'](_0x292446,[_0xfb46('0xa1')]);if(_0x292446[_0xfb46('0xa1')][_0xfb46('0x4d')]){return _0x292446[_0xfb46('0xa1')][0x0];}var _0xdea6ed=_[_0xfb46('0x1f')](_0xc6ac3a['body'],{'firstName':_0xc6ac3a['body'][_0xfb46('0x83')],'ListId':_0x292446['id']});_0xdea6ed[_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x9a')]]=_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x83')];return db[_0xfb46('0x79')][_0xfb46('0x5e')](_0xdea6ed,{'fields':_0x114a16,'raw':!![]});}})[_0xfb46('0x24')](handleEntityNotFound(_0x2584f0,null))[_0xfb46('0x24')](function(_0x264745){if(_0x264745){_0xc6ac3a['contact']=_0x264745;var _0x23e66a={'ContactId':_0x264745['id'],'phone':_0xc6ac3a['body'][_0xfb46('0x83')],'SmsAccountId':_0x110202[_0xfb46('0x65')]['id']};var _0x22d59c={'ContactId':_0x264745['id'],'SmsAccountId':_0x110202['params']['id'],'closed':![]};return db[_0xfb46('0xa2')][_0xfb46('0x5d')]({'where':_0x22d59c})[_0xfb46('0x24')](function(_0x24dd49){if(_0x24dd49){return[_0x24dd49,![]];}return db[_0xfb46('0xa2')][_0xfb46('0x5e')](_0x23e66a)[_0xfb46('0x24')](function(_0x42ce17){return[_0x42ce17,!![]];});});}})[_0xfb46('0xa3')](function(_0x3ea7e6,_0xa4d44f){_0xc6ac3a[_0xfb46('0xa4')]=_0x3ea7e6['get']({'plain':!![]});_0xc6ac3a[_0xfb46('0xa4')][_0xfb46('0xa5')]=![];if(_0xa4d44f){if(_0xc6ac3a[_0xfb46('0x75')][_0xfb46('0xa6')]){_0xc6ac3a[_0xfb46('0x76')]['push']({'id':0x0,'priority':_0xc6ac3a[_0xfb46('0x76')][_0xfb46('0x4d')]+0x1,'app':_0xfb46('0xa7'),'appdata':_0xfb46('0xa8'),'interval':_0xfb46('0xa9')});}_0xc6ac3a[_0xfb46('0xa4')]['created']=!![];}return db[_0xfb46('0xaa')][_0xfb46('0x5e')]({'phone':_0xc6ac3a[_0xfb46('0x66')]['from'],'messageId':_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0x86')],'body':_0xc6ac3a['body'][_0xfb46('0x66')],'SmsAccountId':_0x110202[_0xfb46('0x65')]['id'],'SmsInteractionId':_0x3ea7e6['id'],'direction':'in','ContactId':_0x3ea7e6[_0xfb46('0xab')],'AttachmentId':_0xc6ac3a[_0xfb46('0x66')][_0xfb46('0xac')]});})[_0xfb46('0x24')](function(_0x568641){_0xc6ac3a[_0xfb46('0x2c')]=_0x568641;if(!_0xc6ac3a['interaction'][_0xfb46('0xad')])return;return db[_0xfb46('0xae')][_0xfb46('0x5d')]({'attributes':['id',_0xfb46('0x3f')],'where':{'id':_0xc6ac3a[_0xfb46('0xa4')][_0xfb46('0xad')]}});})['then'](function(_0x4a44f3){if(_0x4a44f3){_0xc6ac3a[_0xfb46('0x76')][_0xfb46('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a44f3[_0xfb46('0x3f')]+','+(_0xc6ac3a[_0xfb46('0x75')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0xc6ac3a['interaction'][_0xfb46('0xb0')])return;return db[_0xfb46('0xb1')]['find']({'attributes':['id','name'],'where':{'id':_0xc6ac3a['interaction'][_0xfb46('0xb0')]}});})[_0xfb46('0x24')](function(_0x57d398){if(_0x57d398){_0xc6ac3a[_0xfb46('0x76')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x57d398[_0xfb46('0x3f')]+','+(_0xc6ac3a[_0xfb46('0x75')][_0xfb46('0xb2')]||0x12c),'interval':_0xfb46('0xa9')});}return respondWithRpcPromise('Start',_0xfb46('0xb3'),_0xc6ac3a);})[_0xfb46('0x24')](function(_0x42b3b4){if(_0x42b3b4){var _0xe6ee0f=0xc8;var _0x4dc887=_0xfb46('0xb4');logger[_0xfb46('0x2d')](_0xfb46('0x28'),_0x4dc887,_0xe6ee0f,_0xfb46('0xb5'));logger['debug'](_0xfb46('0xb6'),_0x4dc887,_0xe6ee0f,_0xfb46('0xb5'),JSON[_0xfb46('0x29')](_0x42b3b4));if(_0xc6ac3a['account'][_0xfb46('0x46')]===_0xfb46('0x82')){return _0x2584f0[_0xfb46('0x30')](_0xe6ee0f)[_0xfb46('0x37')]('Content-Type','text/xml')[_0xfb46('0xb7')](_0xfb46('0xb8'));}else{return _0x2584f0[_0xfb46('0x30')](_0xe6ee0f)[_0xfb46('0x32')](_0x42b3b4);}}})[_0xfb46('0x2e')](handleError(_0x2584f0,null));};exports[_0xfb46('0xb9')]=function(_0x15e937,_0x14618b){var _0x3be648=_0x15e937[_0xfb46('0x65')]['id'];var _0x5ad4b7=_0x15e937[_0xfb46('0x66')];var _0x13478d=0xc8;var _0x3c1eac=null;return db[_0xfb46('0xba')][_0xfb46('0xbb')]({'isolationLevel':db[_0xfb46('0xba')]['Transaction']['ISOLATION_LEVELS'][_0xfb46('0xbc')]},function(_0x55213f){return db[_0xfb46('0x58')][_0xfb46('0x69')]({'where':{'id':_0x3be648},'transaction':_0x55213f})[_0xfb46('0x24')](function(_0x16efaf){if(_0x16efaf){return db['SmsApplication'][_0xfb46('0x3d')]({'where':{'SmsAccountId':_0x3be648},'transaction':_0x55213f})['then'](function(){var _0x24e837=_[_0xfb46('0x43')](_0x5ad4b7,function(_0x511fe8){_0x511fe8[_0xfb46('0x6b')]=_0x3be648;return _0x511fe8;});return db[_0xfb46('0x73')][_0xfb46('0xbd')](_0x24e837,{'transaction':_0x55213f});});}else{_0x13478d=0x194;_0x3c1eac=[];}});})['then'](function(){if(_0x13478d!==0x194){return db[_0xfb46('0x73')][_0xfb46('0xbe')]({'where':{'SmsAccountId':_0x3be648},'order':_0xfb46('0x78')})['then'](function(_0xaa5b8e){_0x3c1eac=_0xaa5b8e;});}})[_0xfb46('0x2e')](function(_0x332cf3){_0x13478d=0x1f4;logger[_0xfb46('0x2a')](_0x332cf3[_0xfb46('0x3e')]);if(_0x332cf3[_0xfb46('0x3f')]){delete _0x332cf3[_0xfb46('0x3f')];}_0x3c1eac=_0x332cf3;})[_0xfb46('0xbf')](function(){if(_0x3c1eac===null){_0x14618b[_0xfb46('0x2f')](_0x13478d);}else{if(_0x13478d===0x1f4){_0x14618b[_0xfb46('0x30')](_0x13478d)['send'](_0x3c1eac);}else{_0x14618b[_0xfb46('0x30')](_0x13478d)[_0xfb46('0x32')](_0x3c1eac);}}});};exports[_0xfb46('0xc0')]=function(_0x2e93b7,_0x34f7d0,_0x4cb9f7){var _0x3bbeb2={};var _0x2b5c1d={};var _0x25f7e3;var _0x37a6df;return db['SmsAccount'][_0xfb46('0x69')]({'where':{'id':_0x2e93b7[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x34f7d0,null))[_0xfb46('0x24')](function(_0x11225f){if(_0x11225f){_0x25f7e3=_0x11225f;_0x2b5c1d[_0xfb46('0x49')]=_[_0xfb46('0x47')](db[_0xfb46('0x73')][_0xfb46('0x44')]);_0x2b5c1d[_0xfb46('0x48')]=_['keys'](_0x2e93b7[_0xfb46('0x48')]);_0x2b5c1d[_0xfb46('0x52')]=_[_0xfb46('0x4a')](_0x2b5c1d[_0xfb46('0x49')],_0x2b5c1d['query']);_0x3bbeb2[_0xfb46('0x4c')]=_[_0xfb46('0x4a')](_0x2b5c1d['model'],qs['fields'](_0x2e93b7[_0xfb46('0x48')][_0xfb46('0x4b')]));_0x3bbeb2[_0xfb46('0x4c')]=_0x3bbeb2[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x3bbeb2[_0xfb46('0x4c')]:_0x2b5c1d['model'];_0x3bbeb2['order']=qs['sort'](_0x2e93b7['query'][_0xfb46('0x50')]);_0x3bbeb2[_0xfb46('0x51')]=qs[_0xfb46('0x52')](_[_0xfb46('0x6a')](_0x2e93b7['query'],_0x2b5c1d[_0xfb46('0x52')]));if(_0x2e93b7[_0xfb46('0x48')]['filter']){_0x3bbeb2['where']=_[_0xfb46('0x54')](_0x3bbeb2[_0xfb46('0x51')],{'$or':_[_0xfb46('0x43')](_0x3bbeb2[_0xfb46('0x4c')],function(_0x521d50){var _0x544194={};_0x544194[_0x521d50]={'$like':'%'+_0x2e93b7[_0xfb46('0x48')][_0xfb46('0x53')]+'%'};return _0x544194;})});}_0x3bbeb2=_['merge']({},_0x3bbeb2,_0x2e93b7['options']);return _0x25f7e3[_0xfb46('0xc0')](_0x3bbeb2);}})[_0xfb46('0x24')](function(_0x168765){if(_0x168765){_0x37a6df=_0x168765[_0xfb46('0x4d')];if(!_0x2e93b7[_0xfb46('0x48')][_0xfb46('0x70')](_0xfb46('0x4e'))){_0x3bbeb2[_0xfb46('0x35')]=qs[_0xfb46('0x35')](_0x2e93b7[_0xfb46('0x48')][_0xfb46('0x35')]);_0x3bbeb2[_0xfb46('0x33')]=qs[_0xfb46('0x33')](_0x2e93b7['query'][_0xfb46('0x33')]);}return _0x25f7e3['getApplications'](_0x3bbeb2);}})['then'](function(_0x12cb91){if(_0x12cb91){return _0x12cb91?{'count':_0x37a6df,'rows':_0x12cb91}:null;}})[_0xfb46('0x24')](respondWithResult(_0x34f7d0,null))[_0xfb46('0x2e')](handleError(_0x34f7d0,null));};exports[_0xfb46('0xc1')]=function(_0x3438d2,_0x52f9ce,_0x4e6d03){var _0x1a415d={'raw':![],'where':{}};var _0x2adfc1={};var _0x524539={'count':0x0,'rows':[]};return db[_0xfb46('0x58')]['findOne']({'where':{'id':_0x3438d2['params']['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x52f9ce,null))[_0xfb46('0x24')](function(_0x43c244){if(_0x43c244){_0x2adfc1[_0xfb46('0x49')]=_[_0xfb46('0x47')](db['SmsInteraction'][_0xfb46('0x44')]);_0x2adfc1['query']=_[_0xfb46('0x47')](_0x3438d2['query']);_0x2adfc1[_0xfb46('0x52')]=_[_0xfb46('0x4a')](_0x2adfc1['model'],_0x2adfc1['query']);_0x1a415d[_0xfb46('0x4c')]=_[_0xfb46('0x4a')](_0x2adfc1[_0xfb46('0x49')],qs[_0xfb46('0x4b')](_0x3438d2['query'][_0xfb46('0x4b')]));_0x1a415d[_0xfb46('0x4c')]=_0x1a415d[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x1a415d[_0xfb46('0x4c')]:_0x2adfc1[_0xfb46('0x49')];if(!_0x3438d2[_0xfb46('0x48')][_0xfb46('0x70')](_0xfb46('0x4e'))){_0x1a415d[_0xfb46('0x35')]=qs[_0xfb46('0x35')](_0x3438d2[_0xfb46('0x48')][_0xfb46('0x35')]);_0x1a415d[_0xfb46('0x33')]=qs[_0xfb46('0x33')](_0x3438d2[_0xfb46('0x48')][_0xfb46('0x33')]);}_0x1a415d[_0xfb46('0x4f')]=qs[_0xfb46('0x50')](_0x3438d2[_0xfb46('0x48')]['sort']);_0x1a415d[_0xfb46('0x51')]=qs[_0xfb46('0x52')](_[_0xfb46('0x6a')](_0x3438d2[_0xfb46('0x48')],_0x2adfc1[_0xfb46('0x52')]));_0x1a415d[_0xfb46('0x51')]['SmsAccountId']=_0x43c244['id'];if(_0x3438d2[_0xfb46('0x48')]['filter']){_0x1a415d[_0xfb46('0x51')]=_[_0xfb46('0x54')](_0x1a415d[_0xfb46('0x51')],{'$or':_[_0xfb46('0x43')](_0x1a415d['attributes'],function(_0x195fc7){var _0x1a3b84={};_0x1a3b84[_0x195fc7]={'$like':'%'+_0x3438d2[_0xfb46('0x48')][_0xfb46('0x53')]+'%'};return _0x1a3b84;})});}_0x1a415d=_[_0xfb46('0x54')]({},_0x1a415d,_0x3438d2[_0xfb46('0x56')]);return db['SmsInteraction'][_0xfb46('0x36')]({'where':_0x1a415d['where']})['then'](function(_0x129886){_0x524539[_0xfb46('0x36')]=_0x129886;if(_0x3438d2[_0xfb46('0x48')][_0xfb46('0x5c')]){_0x1a415d['include']=[{'model':db[_0xfb46('0x79')],'as':_0xfb46('0xc2'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xfb46('0x3f'),'fullname',_0xfb46('0xc3')],'required':![]},{'model':db[_0xfb46('0xc4')],'as':_0xfb46('0xc5'),'attributes':['id','name','color'],'where':_0x3438d2[_0xfb46('0x48')][_0xfb46('0xc6')]?{'id':_0x3438d2[_0xfb46('0x48')][_0xfb46('0xc6')]}:undefined,'required':_0x3438d2[_0xfb46('0x48')][_0xfb46('0xc6')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x1a415d);})[_0xfb46('0x24')](function(_0x17a49d){_0x524539[_0xfb46('0x5a')]=_0x17a49d;return _0x524539;});}})[_0xfb46('0x24')](respondWithFilteredResult(_0x52f9ce,_0x1a415d))[_0xfb46('0x2e')](handleError(_0x52f9ce,null));};exports[_0xfb46('0xb7')]=function(_0x5dcdd2,_0x1b2b32,_0x15c99d){var _0x3b8726,_0x2e8285,_0x346273;if(_[_0xfb46('0x97')](_0x5dcdd2[_0xfb46('0x66')][_0xfb46('0x66')])||_0x5dcdd2[_0xfb46('0x66')]['body']===''){throw new db[(_0xfb46('0x7b'))][(_0xfb46('0x7c'))](_0xfb46('0x99'));}if(_[_0xfb46('0x97')](_0x5dcdd2['body']['to'])){throw new db['Sequelize'][(_0xfb46('0x7c'))]('to\x20is\x20mandatory');}_0x3b8726=_0x5dcdd2[_0xfb46('0x66')]['to'];return db[_0xfb46('0x58')][_0xfb46('0x5d')]({'where':{'id':_0x5dcdd2[_0xfb46('0x65')]['id']},'include':[{'model':db[_0xfb46('0x9e')],'as':_0xfb46('0xc7'),'include':[{'model':db[_0xfb46('0x79')],'as':_0xfb46('0xa1'),'where':{'mobile':_0x3b8726},'limit':0x1,'order':[[_0xfb46('0x7f'),_0xfb46('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x1b2b32,null))['then'](function(_0x1ffda0){if(_0x1ffda0&&_0x1ffda0[_0xfb46('0xc7')]){_0x2e8285=_0x1ffda0[_0xfb46('0x3b')]({'plain':!![]});if(_0x2e8285[_0xfb46('0xc7')]&&_0x2e8285['List'][_0xfb46('0xa1')][_0xfb46('0x4d')]){return _0x2e8285['List']['Contacts'][0x0];}return db[_0xfb46('0x79')]['create'](_[_0xfb46('0x1f')](_0x5dcdd2[_0xfb46('0x66')],{'firstName':_0x3b8726,'mobile':_0x3b8726,'phone':_0x3b8726,'ListId':_0x2e8285[_0xfb46('0x81')]}));}})[_0xfb46('0x24')](handleEntityNotFound(_0x1b2b32,null))[_0xfb46('0x24')](function(_0x258bc1){if(_0x258bc1){_0x346273=_0x258bc1;return db['SmsInteraction'][_0xfb46('0x5d')]({'where':{'ContactId':_0x346273['id'],'closed':![],'SmsAccountId':_0x2e8285['id']}})[_0xfb46('0x24')](function(_0x22421e){if(_0x22421e){return[_0x22421e,![]];}return db[_0xfb46('0xa2')][_0xfb46('0x5e')]({'UserId':_0x5dcdd2[_0xfb46('0x5f')]['id'],'ContactId':_0x346273['id'],'SmsAccountId':_0x2e8285['id'],'phone':_0x3b8726,'firstMsgDirection':_0xfb46('0xc8'),'Messages':[_[_0xfb46('0x54')](_0x5dcdd2[_0xfb46('0x66')],{'read':![],'body':_0x5dcdd2['body'][_0xfb46('0x66')],'phone':_0x3b8726,'SmsAccountId':_0x2e8285['id'],'UserId':_0x5dcdd2[_0xfb46('0x5f')]['id'],'ContactId':_0x346273['id']})]},{'include':[{'model':db[_0xfb46('0xaa')],'as':_0xfb46('0xc9')}]})[_0xfb46('0x24')](function(_0x238162){return[_0x238162,!![]];});});}})[_0xfb46('0xa3')](function(_0x1776ea,_0xfed68b){if(_0xfed68b){return _0x1776ea;}return db[_0xfb46('0xaa')][_0xfb46('0x5e')](_[_0xfb46('0x54')](_0x5dcdd2[_0xfb46('0x66')],{'read':![],'body':_0x5dcdd2['body'][_0xfb46('0x66')],'phone':_0x3b8726,'SmsAccountId':_0x2e8285['id'],'SmsInteractionId':_0x1776ea['id'],'UserId':_0x5dcdd2[_0xfb46('0x5f')]['id'],'ContactId':_0x346273['id']}))[_0xfb46('0x24')](function(_0x4d3395){_0x1776ea[_0xfb46('0xca')][_0xfb46('0xc9')]=[];_0x1776ea[_0xfb46('0xca')]['Messages'][_0xfb46('0xcb')](_0x4d3395[_0xfb46('0xca')]);return _0x1776ea;});})['then'](respondWithResult(_0x1b2b32,null))['catch'](handleError(_0x1b2b32,null));};exports[_0xfb46('0x30')]=function(_0x44ca1e,_0x31e7a6,_0x1ee462){if(_0x44ca1e[_0xfb46('0x66')]['id']){delete _0x44ca1e[_0xfb46('0x66')]['id'];}var _0x1273b6,_0x1ab7f2,_0x176475;return db['SmsAccount']['find']({'where':{'id':_0x44ca1e[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x31e7a6,null))['then'](function(_0x1ab79a){if(_0x1ab79a){_0x176475=_0x1ab79a;logger[_0xfb46('0x27')](_0xfb46('0x28'),_0xfb46('0x30'),'received\x20delivery\x20report\x20from',_0x1ab79a['type'],util[_0xfb46('0xcc')](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));switch(_0x1ab79a['type']){case _0xfb46('0xcd'):if(_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xce')]&&_0x44ca1e['body'][_0xfb46('0x30')]){_0x1ab7f2=_0x44ca1e[_0xfb46('0x66')]['status'];return db[_0xfb46('0xaa')][_0xfb46('0x5d')]({'where':{'messageId':_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xce')]}});}break;case _0xfb46('0x8a'):if(_0x44ca1e[_0xfb46('0x66')]['requestid']&&_0x44ca1e['body'][_0xfb46('0xcf')]){_0x1ab7f2=_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xcf')];return db['SmsMessage']['find']({'where':{'messageId':_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xd0')]}});}break;case _0xfb46('0xd1'):if(_0x44ca1e[_0xfb46('0x66')][_0xfb46('0x8b')]&&_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xd2')]){_0x1ab7f2=_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xd2')];return db['SmsMessage'][_0xfb46('0x5d')]({'where':{'messageId':_0x44ca1e[_0xfb46('0x66')][_0xfb46('0x8b')]}});}break;case _0xfb46('0x8e'):var _0x418ee0=_0x44ca1e[_0xfb46('0x66')][_0xfb46('0x8f')][0x0];if(_0x418ee0[_0xfb46('0x86')]&&_0x418ee0[_0xfb46('0x30')][_0xfb46('0xd3')]==='DELIVERED'){_0x1ab7f2=_0x418ee0['status'][_0xfb46('0xd3')];return db[_0xfb46('0xaa')][_0xfb46('0x5d')]({'where':{'messageId':_0x418ee0[_0xfb46('0x86')]}});}break;case _0xfb46('0x93'):if(_0x44ca1e[_0xfb46('0x66')][_0xfb46('0x86')]&&_0x44ca1e['body'][_0xfb46('0x30')]){_0x1ab7f2=_0x44ca1e[_0xfb46('0x66')][_0xfb46('0x30')];return db[_0xfb46('0xaa')]['find']({'where':{'messageId':_0x44ca1e['body'][_0xfb46('0x86')]}});}break;case _0xfb46('0xd4'):if(_0x44ca1e[_0xfb46('0x66')][0x0][_0xfb46('0x2c')]['id']){_0x1ab7f2=_0x44ca1e[_0xfb46('0x66')][0x0][_0xfb46('0x46')];return db[_0xfb46('0xaa')][_0xfb46('0x5d')]({'where':{'messageId':_0x44ca1e[_0xfb46('0x66')][0x0][_0xfb46('0x2c')]['id']}});}break;case _0xfb46('0x95'):if(_0x44ca1e['body'][_0xfb46('0xd5')]&&_0x44ca1e[_0xfb46('0x66')]['status']){_0x1ab7f2=_0x44ca1e['body'][_0xfb46('0x30')];return db[_0xfb46('0xaa')]['find']({'where':{'messageId':_0x44ca1e['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x31e7a6,null))['then'](function(_0x28e59a){if(_0x28e59a){_0x1273b6=_0x28e59a;switch(_0x176475[_0xfb46('0x46')]){case _0xfb46('0xcd'):if(_0x1ab7f2===_0xfb46('0xd6')){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),_0xfb46('0x30'),_0xfb46('0xcd'),util[_0xfb46('0xcc')](_0x44ca1e['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1ab7f2==='1'){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),_0xfb46('0x30'),_0xfb46('0xcd'),util['inspect'](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));}break;case _0xfb46('0xd1'):if(!_0x44ca1e[_0xfb46('0x66')][_0xfb46('0xd7')]&&_0x1ab7f2>=0xc8&&_0x1ab7f2<=0xce){return _0x1273b6['update']({'read':!![]});}else{logger['error'](_0xfb46('0x28'),_0xfb46('0x30'),'clicksend',util['inspect'](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x167ab1=_0x44ca1e['body'][_0xfb46('0x8f')][0x0];if(_0x167ab1[_0xfb46('0x30')][_0xfb46('0xd3')]===_0xfb46('0xd6')){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger['error'](_0xfb46('0x28'),_0xfb46('0x30'),_0xfb46('0x8e'),util[_0xfb46('0xcc')](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1ab7f2==_0xfb46('0xd8')||_0x1ab7f2=='RECEIVED_BY_RECIPIENT'){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),_0xfb46('0x30'),_0xfb46('0x93'),util[_0xfb46('0xcc')](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1ab7f2=='message-delivered'){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),'status',_0xfb46('0xd4'),util['inspect'](_0x44ca1e['body'],{'showHidden':![],'depth':null}));}break;case _0xfb46('0x95'):if(_0x1ab7f2==='DELIVRD'||_0x1ab7f2===_0xfb46('0xd9')){return _0x1273b6[_0xfb46('0x3a')]({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),_0xfb46('0x30'),'intelepeer',util['inspect'](_0x44ca1e[_0xfb46('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x1273b6;}})['then'](respondWithResult(_0x31e7a6,null))[_0xfb46('0x2e')](handleError(_0x31e7a6,null));};exports[_0xfb46('0xda')]=function(_0x279092,_0x3c9a16,_0xbea661){var _0x3c47ed,_0x2c203d,_0x426166;return db[_0xfb46('0x58')]['find']({'where':{'id':_0x279092[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x3c9a16,null))[_0xfb46('0x24')](function(_0x1de846){if(_0x1de846){_0x426166=_0x1de846;logger[_0xfb46('0x27')](_0xfb46('0x28'),_0xfb46('0x30'),_0xfb46('0xdb'),_0x1de846[_0xfb46('0x46')],util['inspect'](_0x279092[_0xfb46('0x48')],{'showHidden':![],'depth':null}));switch(_0x1de846['type']){case _0xfb46('0x90'):if(_0x279092[_0xfb46('0x48')][_0xfb46('0xdc')]&&_0x279092['query'][_0xfb46('0xdd')]){_0x2c203d=_0x279092[_0xfb46('0x48')][_0xfb46('0xdd')];return db[_0xfb46('0xaa')][_0xfb46('0x5d')]({'where':{'messageId':_0x279092['query'][_0xfb46('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x3c9a16,null))[_0xfb46('0x24')](function(_0x311857){if(_0x311857){_0x3c47ed=_0x311857;switch(_0x426166['type']){case _0xfb46('0x90'):if(_0x2c203d==='2'||_0x2c203d==='6'){return _0x3c47ed['update']({'read':!![]});}else{logger[_0xfb46('0x2a')](_0xfb46('0x28'),'status',_0xfb46('0x90'),util[_0xfb46('0xcc')](_0x279092['query'],{'showHidden':![],'depth':null}));};break;}return _0x3c47ed;}})[_0xfb46('0x24')](respondWithResult(_0x3c9a16,null))[_0xfb46('0x2e')](handleError(_0x3c9a16,null));};exports[_0xfb46('0xde')]=function(_0xc9711,_0xe751d0,_0x4fcdd1){return db['SmsAccount'][_0xfb46('0x5d')]({'where':{'id':_0xc9711[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0xe751d0,null))[_0xfb46('0x24')](function(_0x1ddec8){if(_0x1ddec8){return _0x1ddec8[_0xfb46('0xde')](_0xc9711[_0xfb46('0x66')][_0xfb46('0x6d')],_[_0xfb46('0xdf')](_0xc9711[_0xfb46('0x66')],[_0xfb46('0x6d'),'id'])||{})[_0xfb46('0xa3')](function(_0x4d30d9){for(var _0x20fc54=0x0;_0x20fc54<_0xc9711[_0xfb46('0x66')]['ids'][_0xfb46('0x4d')];_0x20fc54+=0x1){socket[_0xfb46('0xe0')]('userSmsAccount:save',{'UserId':Number(_0xc9711[_0xfb46('0x66')][_0xfb46('0x6d')][_0x20fc54]),'SmsAccountId':Number(_0xc9711['params']['id'])});}return _0x4d30d9;});}})['then'](respondWithResult(_0xe751d0,null))[_0xfb46('0x2e')](handleError(_0xe751d0,null));};exports[_0xfb46('0xe1')]=function(_0x34e74b,_0x36a4d0,_0x2193af){return db[_0xfb46('0x58')][_0xfb46('0x5d')]({'where':{'id':_0x34e74b[_0xfb46('0x65')]['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x36a4d0,null))[_0xfb46('0x24')](function(_0x58ccd2){if(_0x58ccd2){return _0x58ccd2['removeAgents'](_0x34e74b[_0xfb46('0x48')][_0xfb46('0x6d')])[_0xfb46('0x24')](function(){if(_[_0xfb46('0xe2')](_0x34e74b[_0xfb46('0x48')][_0xfb46('0x6d')])){for(var _0xdf2f41=0x0;_0xdf2f41<_0x34e74b[_0xfb46('0x48')][_0xfb46('0x6d')][_0xfb46('0x4d')];_0xdf2f41+=0x1){socket[_0xfb46('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x34e74b[_0xfb46('0x48')][_0xfb46('0x6d')][_0xdf2f41]),'SmsAccountId':Number(_0x34e74b[_0xfb46('0x65')]['id'])});}}else{socket[_0xfb46('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x34e74b[_0xfb46('0x48')][_0xfb46('0x6d')]),'SmsAccountId':Number(_0x34e74b[_0xfb46('0x65')]['id'])});}});}})[_0xfb46('0x24')](respondWithStatusCode(_0x36a4d0,null))['catch'](handleError(_0x36a4d0,null));};exports['getAgents']=function(_0x40148d,_0x18eca8,_0x42647c){var _0x4e179d={};var _0x38f9ca={};var _0x1b2497;var _0x3555ad;return db['SmsAccount']['findOne']({'where':{'id':_0x40148d['params']['id']}})[_0xfb46('0x24')](handleEntityNotFound(_0x18eca8,null))['then'](function(_0x2f43df){if(_0x2f43df){_0x1b2497=_0x2f43df;_0x38f9ca[_0xfb46('0x49')]=_[_0xfb46('0x47')](db[_0xfb46('0xae')][_0xfb46('0x44')]);_0x38f9ca[_0xfb46('0x48')]=_[_0xfb46('0x47')](_0x40148d[_0xfb46('0x48')]);_0x38f9ca['filters']=_[_0xfb46('0x4a')](_0x38f9ca[_0xfb46('0x49')],_0x38f9ca[_0xfb46('0x48')]);_0x4e179d['attributes']=_[_0xfb46('0x4a')](_0x38f9ca[_0xfb46('0x49')],qs['fields'](_0x40148d[_0xfb46('0x48')][_0xfb46('0x4b')]));_0x4e179d[_0xfb46('0x4c')]=_0x4e179d[_0xfb46('0x4c')][_0xfb46('0x4d')]?_0x4e179d[_0xfb46('0x4c')]:_0x38f9ca[_0xfb46('0x49')];_0x4e179d[_0xfb46('0x4f')]=qs['sort'](_0x40148d['query'][_0xfb46('0x50')]);_0x4e179d[_0xfb46('0x51')]=qs[_0xfb46('0x52')](_[_0xfb46('0x6a')](_0x40148d[_0xfb46('0x48')],_0x38f9ca[_0xfb46('0x52')]));if(_0x40148d['query']['filter']){_0x4e179d[_0xfb46('0x51')]=_['merge'](_0x4e179d[_0xfb46('0x51')],{'$or':_[_0xfb46('0x43')](_0x4e179d[_0xfb46('0x4c')],function(_0x390256){var _0x3a869b={};_0x3a869b[_0x390256]={'$like':'%'+_0x40148d[_0xfb46('0x48')][_0xfb46('0x53')]+'%'};return _0x3a869b;})});}_0x4e179d=_['merge']({},_0x4e179d,_0x40148d['options']);return _0x1b2497[_0xfb46('0xe3')](_0x4e179d);}})['then'](function(_0x205c82){if(_0x205c82){_0x3555ad=_0x205c82[_0xfb46('0x4d')];if(!_0x40148d[_0xfb46('0x48')][_0xfb46('0x70')](_0xfb46('0x4e'))){_0x4e179d['limit']=qs[_0xfb46('0x35')](_0x40148d[_0xfb46('0x48')][_0xfb46('0x35')]);_0x4e179d[_0xfb46('0x33')]=qs['offset'](_0x40148d[_0xfb46('0x48')][_0xfb46('0x33')]);}return _0x1b2497[_0xfb46('0xe3')](_0x4e179d);}})['then'](function(_0x2a9590){if(_0x2a9590){return _0x2a9590?{'count':_0x3555ad,'rows':_0x2a9590}:null;}})[_0xfb46('0x24')](respondWithResult(_0x18eca8,null))[_0xfb46('0x2e')](handleError(_0x18eca8,null));}; \ No newline at end of file +var _0x9224=['update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','twilio','Body','messageId','MessageSid','skebby','from','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','SmsInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','SmsQueue','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','addApplications','transaction','sequelize','Transaction','findAndCountAll','priority','send','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','inspect','error_code','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','defaults','redis','localhost','./smsAccount.socket','jayson/promise','client','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','keys','find','body','user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xe45099,_0xdad514){var _0x381d2f=function(_0x81a5c5){while(--_0x81a5c5){_0xe45099['push'](_0xe45099['shift']());}};_0x381d2f(++_0xdad514);}(_0x9224,0x85));var _0x4922=function(_0x1560a9,_0x3d5e52){_0x1560a9=_0x1560a9-0x0;var _0x2cda8d=_0x9224[_0x1560a9];return _0x2cda8d;};'use strict';var emlformat=require(_0x4922('0x0'));var rimraf=require(_0x4922('0x1'));var zipdir=require(_0x4922('0x2'));var jsonpatch=require(_0x4922('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4922('0x4'));var util=require(_0x4922('0x5'));var path=require('path');var sox=require(_0x4922('0x6'));var csv=require(_0x4922('0x7'));var ejs=require(_0x4922('0x8'));var fs=require('fs');var fs_extra=require(_0x4922('0x9'));var _=require(_0x4922('0xa'));var squel=require(_0x4922('0xb'));var crypto=require(_0x4922('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4922('0xd'));var toCsv=require(_0x4922('0x7'));var querystring=require(_0x4922('0xe'));var Papa=require(_0x4922('0xf'));var Redis=require(_0x4922('0x10'));var authService=require(_0x4922('0x11'));var qs=require(_0x4922('0x12'));var as=require(_0x4922('0x13'));var hardwareService=require(_0x4922('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4922('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4922('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4922('0x17')](config[_0x4922('0x18')],{'host':_0x4922('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4922('0x18')]));require(_0x4922('0x1a'))['register'](socket);var jayson=require(_0x4922('0x1b'));var client=jayson[_0x4922('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x48e680,_0x4bdfeb,_0x7f092b,_0x532542){return new BPromise(function(_0x79a48c,_0x1f9b26){var _0x28e7c1=_0x532542||client;return _0x28e7c1[_0x4922('0x1d')](_0x48e680,_0x7f092b)[_0x4922('0x1e')](function(_0x466790){logger[_0x4922('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x4bdfeb,'request\x20sent');logger[_0x4922('0x20')](_0x4922('0x21'),_0x4bdfeb,_0x4922('0x22'),JSON[_0x4922('0x23')](_0x466790));if(_0x466790[_0x4922('0x24')]){if(_0x466790[_0x4922('0x24')][_0x4922('0x25')]===0x1f4){logger['error'](_0x4922('0x26'),_0x4bdfeb,_0x466790['error'][_0x4922('0x27')]);return _0x1f9b26(_0x466790[_0x4922('0x24')]['message']);}logger[_0x4922('0x24')](_0x4922('0x26'),_0x4bdfeb,_0x466790[_0x4922('0x24')][_0x4922('0x27')]);return _0x79a48c(_0x466790['error']['message']);}else{logger['info'](_0x4922('0x26'),_0x4bdfeb,'request\x20sent');_0x79a48c(_0x466790['result'][_0x4922('0x27')]);}})[_0x4922('0x28')](function(_0xa53f25){logger[_0x4922('0x24')](_0x4922('0x26'),_0x4bdfeb,_0xa53f25);_0x1f9b26(_0xa53f25);});});}function respondWithStatusCode(_0x461d26,_0x26dd45){_0x26dd45=_0x26dd45||0xcc;return function(_0x196ebc){if(_0x196ebc){return _0x461d26[_0x4922('0x29')](_0x26dd45);}return _0x461d26['status'](_0x26dd45)[_0x4922('0x2a')]();};}function respondWithResult(_0x134085,_0x30aa09){_0x30aa09=_0x30aa09||0xc8;return function(_0x5f4bca){if(_0x5f4bca){return _0x134085[_0x4922('0x2b')](_0x30aa09)[_0x4922('0x2c')](_0x5f4bca);}};}function respondWithFilteredResult(_0x3803d4,_0x1e1687){return function(_0x145a17){if(_0x145a17){var _0x5319db=typeof _0x1e1687[_0x4922('0x2d')]===_0x4922('0x2e')&&typeof _0x1e1687[_0x4922('0x2f')]===_0x4922('0x2e');var _0xb118ec=_0x145a17[_0x4922('0x30')];var _0x487022=_0x5319db?0x0:_0x1e1687['offset'];var _0x194e8e=_0x5319db?_0x145a17[_0x4922('0x30')]:_0x1e1687[_0x4922('0x2d')]+_0x1e1687[_0x4922('0x2f')];var _0x15c4ee;if(_0x194e8e>=_0xb118ec){_0x194e8e=_0xb118ec;_0x15c4ee=0xc8;}else{_0x15c4ee=0xce;}_0x3803d4[_0x4922('0x2b')](_0x15c4ee);return _0x3803d4['set'](_0x4922('0x31'),_0x487022+'-'+_0x194e8e+'/'+_0xb118ec)[_0x4922('0x2c')](_0x145a17);}return null;};}function patchUpdates(_0x219a29){return function(_0x5e8492){try{jsonpatch[_0x4922('0x32')](_0x5e8492,_0x219a29,!![]);}catch(_0x96f061){return BPromise[_0x4922('0x33')](_0x96f061);}return _0x5e8492[_0x4922('0x34')]();};}function saveUpdates(_0x251fc4,_0x5c39b2){return function(_0xc97531){if(_0xc97531){return _0xc97531['update'](_0x251fc4)[_0x4922('0x1e')](function(_0x4ce174){return _0x4ce174;});}return null;};}function removeEntity(_0x4a760d,_0x5bbd81){return function(_0x3932ec){if(_0x3932ec){return _0x3932ec[_0x4922('0x35')]()['then'](function(){var _0x211bc0=_0x3932ec[_0x4922('0x36')]({'plain':!![]});var _0x43109e=_0x4922('0x37');return db[_0x4922('0x38')][_0x4922('0x35')]({'where':{'type':_0x43109e,'resourceId':_0x211bc0['id']}})['then'](function(){return _0x3932ec;});})[_0x4922('0x1e')](function(){_0x4a760d[_0x4922('0x2b')](0xcc)[_0x4922('0x2a')]();});}};}function handleEntityNotFound(_0x321687,_0x4a1ec4){return function(_0x1a63ed){if(!_0x1a63ed){_0x321687[_0x4922('0x29')](0x194);}return _0x1a63ed;};}function handleError(_0x5a7f2a,_0x4665f7){_0x4665f7=_0x4665f7||0x1f4;return function(_0x9b5d2c){logger[_0x4922('0x24')](_0x9b5d2c[_0x4922('0x39')]);if(_0x9b5d2c[_0x4922('0x3a')]){delete _0x9b5d2c[_0x4922('0x3a')];}_0x5a7f2a[_0x4922('0x2b')](_0x4665f7)['send'](_0x9b5d2c);};}exports[_0x4922('0x3b')]=function(_0x43eb32,_0x34290b){var _0x50463e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4c4959={},_0x48586c={'count':0x0,'rows':[]};var _0x19bdf3=_['map'](db[_0x4922('0x3c')][_0x4922('0x3d')],function(_0x2561a0){return{'name':_0x2561a0[_0x4922('0x3e')],'type':_0x2561a0[_0x4922('0x3f')][_0x4922('0x40')]};});_0x4c4959[_0x4922('0x41')]=_[_0x4922('0x42')](_0x19bdf3,_0x4922('0x3a'));_0x4c4959['query']=_['keys'](_0x43eb32[_0x4922('0x43')]);_0x4c4959[_0x4922('0x44')]=_['intersection'](_0x4c4959['model'],_0x4c4959[_0x4922('0x43')]);_0x50463e[_0x4922('0x45')]=_[_0x4922('0x46')](_0x4c4959[_0x4922('0x41')],qs[_0x4922('0x47')](_0x43eb32[_0x4922('0x43')][_0x4922('0x47')]));_0x50463e['attributes']=_0x50463e[_0x4922('0x45')][_0x4922('0x48')]?_0x50463e[_0x4922('0x45')]:_0x4c4959[_0x4922('0x41')];if(!_0x43eb32['query']['hasOwnProperty']('nolimit')){_0x50463e['limit']=qs['limit'](_0x43eb32[_0x4922('0x43')][_0x4922('0x2f')]);_0x50463e['offset']=qs[_0x4922('0x2d')](_0x43eb32[_0x4922('0x43')]['offset']);}_0x50463e[_0x4922('0x49')]=qs[_0x4922('0x4a')](_0x43eb32[_0x4922('0x43')]['sort']);_0x50463e[_0x4922('0x4b')]=qs[_0x4922('0x44')](_[_0x4922('0x4c')](_0x43eb32[_0x4922('0x43')],_0x4c4959[_0x4922('0x44')]),_0x19bdf3);if(_0x43eb32[_0x4922('0x43')][_0x4922('0x4d')]){_0x50463e[_0x4922('0x4b')]=_[_0x4922('0x4e')](_0x50463e[_0x4922('0x4b')],{'$or':_['map'](_0x19bdf3,function(_0x43a510){if(_0x43a510[_0x4922('0x3f')]!==_0x4922('0x4f')){var _0x363477={};_0x363477[_0x43a510[_0x4922('0x3a')]]={'$like':'%'+_0x43eb32[_0x4922('0x43')][_0x4922('0x4d')]+'%'};return _0x363477;}})});}_0x50463e=_[_0x4922('0x4e')]({},_0x50463e,_0x43eb32[_0x4922('0x50')]);var _0x2a3198={'where':_0x50463e[_0x4922('0x4b')]};return db['SmsAccount'][_0x4922('0x30')](_0x2a3198)['then'](function(_0x43ca1f){_0x48586c[_0x4922('0x30')]=_0x43ca1f;if(_0x43eb32['query'][_0x4922('0x51')]){_0x50463e[_0x4922('0x52')]=[{'all':!![]}];}return db[_0x4922('0x3c')]['findAll'](_0x50463e);})[_0x4922('0x1e')](function(_0x1e80ef){_0x48586c[_0x4922('0x53')]=_0x1e80ef;return _0x48586c;})[_0x4922('0x1e')](respondWithFilteredResult(_0x34290b,_0x50463e))['catch'](handleError(_0x34290b,null));};exports[_0x4922('0x54')]=function(_0x25c5db,_0x451149){var _0x541c29={'raw':![],'where':{'id':_0x25c5db[_0x4922('0x55')]['id']},'include':[{'model':db[_0x4922('0x56')],'as':_0x4922('0x57')}]},_0x47f610={};_0x47f610['model']=_['keys'](db[_0x4922('0x3c')]['rawAttributes']);_0x47f610[_0x4922('0x43')]=_[_0x4922('0x58')](_0x25c5db[_0x4922('0x43')]);_0x47f610[_0x4922('0x44')]=_[_0x4922('0x46')](_0x47f610[_0x4922('0x41')],_0x47f610[_0x4922('0x43')]);_0x541c29[_0x4922('0x45')]=_[_0x4922('0x46')](_0x47f610[_0x4922('0x41')],qs[_0x4922('0x47')](_0x25c5db[_0x4922('0x43')]['fields']));_0x541c29['attributes']=_0x541c29['attributes']['length']?_0x541c29[_0x4922('0x45')]:_0x47f610[_0x4922('0x41')];if(_0x25c5db[_0x4922('0x43')][_0x4922('0x51')]){_0x541c29[_0x4922('0x52')]=[{'all':!![]}];}_0x541c29=_[_0x4922('0x4e')]({},_0x541c29,_0x25c5db[_0x4922('0x50')]);return db['SmsAccount'][_0x4922('0x59')](_0x541c29)[_0x4922('0x1e')](handleEntityNotFound(_0x451149,null))[_0x4922('0x1e')](respondWithResult(_0x451149,null))[_0x4922('0x28')](handleError(_0x451149,null));};exports['create']=function(_0x4b5b2c,_0x5dfdb4){return db[_0x4922('0x3c')]['create'](_0x4b5b2c[_0x4922('0x5a')],{})['then'](function(_0x24bc8f){var _0x6f208f=_0x4b5b2c[_0x4922('0x5b')][_0x4922('0x36')]({'plain':!![]});if(!_0x6f208f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6f208f[_0x4922('0x5c')]===_0x4922('0x5b')){var _0x42348c=_0x24bc8f['get']({'plain':!![]});var _0x7ce6f7=_0x4922('0x37');return db[_0x4922('0x5d')][_0x4922('0x59')]({'where':{'name':_0x7ce6f7,'userProfileId':_0x6f208f[_0x4922('0x5e')]},'raw':!![]})[_0x4922('0x1e')](function(_0x419f6d){if(_0x419f6d&&_0x419f6d['autoAssociation']===0x0){return db[_0x4922('0x38')][_0x4922('0x5f')]({'name':_0x42348c[_0x4922('0x3a')],'resourceId':_0x42348c['id'],'type':_0x419f6d[_0x4922('0x3a')],'sectionId':_0x419f6d['id']},{})[_0x4922('0x1e')](function(){return _0x24bc8f;});}else{return _0x24bc8f;}})[_0x4922('0x28')](function(_0x10057c){logger[_0x4922('0x24')](_0x4922('0x60'),_0x10057c);throw _0x10057c;});}return _0x24bc8f;})['then'](respondWithResult(_0x5dfdb4,0xc9))[_0x4922('0x28')](handleError(_0x5dfdb4,null));};exports[_0x4922('0x61')]=function(_0x158dd4,_0x27cba6){if(_0x158dd4[_0x4922('0x5a')]['id']){delete _0x158dd4[_0x4922('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x158dd4['params']['id']},'include':[{'model':db[_0x4922('0x56')],'as':_0x4922('0x57')}]})['then'](handleEntityNotFound(_0x27cba6,null))[_0x4922('0x1e')](saveUpdates(_0x158dd4['body'],null))[_0x4922('0x1e')](respondWithResult(_0x27cba6,null))['catch'](handleError(_0x27cba6,null));};exports['destroy']=function(_0x3c75b8,_0x3de2c5){return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x3c75b8[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x3de2c5,null))[_0x4922('0x1e')](removeEntity(_0x3de2c5,null))[_0x4922('0x28')](handleError(_0x3de2c5,null));};exports[_0x4922('0x62')]=function(_0x677ab5,_0x2c08a1){return db[_0x4922('0x3c')][_0x4922('0x62')]()[_0x4922('0x1e')](respondWithResult(_0x2c08a1,null))[_0x4922('0x28')](handleError(_0x2c08a1,null));};exports[_0x4922('0x63')]=function(_0x525ccf,_0x217eb3,_0x5b3241){if(_0x525ccf[_0x4922('0x5a')]['id']){delete _0x525ccf[_0x4922('0x5a')]['id'];}return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x525ccf[_0x4922('0x55')]['id']}})['then'](handleEntityNotFound(_0x217eb3,null))[_0x4922('0x1e')](function(_0x339182){if(_0x339182){_0x525ccf['body'][_0x4922('0x64')]=_0x339182['id'];return db[_0x4922('0x65')][_0x4922('0x5f')](_0x525ccf[_0x4922('0x5a')]);}})[_0x4922('0x1e')](respondWithResult(_0x217eb3,null))[_0x4922('0x28')](handleError(_0x217eb3,null));};exports[_0x4922('0x66')]=function(_0x11f3fd,_0x42bcfe,_0x3ceee0){var _0x38657c={'raw':![],'where':{}};var _0x432536={};var _0x54a09c={'count':0x0,'rows':[]};return db[_0x4922('0x3c')]['findOne']({'where':{'id':_0x11f3fd[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x42bcfe,null))[_0x4922('0x1e')](function(_0x47ee0c){if(_0x47ee0c){_0x432536[_0x4922('0x41')]=_[_0x4922('0x58')](db['Disposition']['rawAttributes']);_0x432536[_0x4922('0x43')]=_['keys'](_0x11f3fd['query']);_0x432536[_0x4922('0x44')]=_['intersection'](_0x432536[_0x4922('0x41')],_0x432536[_0x4922('0x43')]);_0x38657c[_0x4922('0x45')]=_['intersection'](_0x432536[_0x4922('0x41')],qs['fields'](_0x11f3fd[_0x4922('0x43')][_0x4922('0x47')]));_0x38657c[_0x4922('0x45')]=_0x38657c[_0x4922('0x45')][_0x4922('0x48')]?_0x38657c[_0x4922('0x45')]:_0x432536[_0x4922('0x41')];if(!_0x11f3fd[_0x4922('0x43')][_0x4922('0x67')](_0x4922('0x68'))){_0x38657c[_0x4922('0x2f')]=qs[_0x4922('0x2f')](_0x11f3fd[_0x4922('0x43')]['limit']);_0x38657c[_0x4922('0x2d')]=qs[_0x4922('0x2d')](_0x11f3fd[_0x4922('0x43')][_0x4922('0x2d')]);}_0x38657c[_0x4922('0x49')]=qs[_0x4922('0x4a')](_0x11f3fd[_0x4922('0x43')][_0x4922('0x4a')]);_0x38657c[_0x4922('0x4b')]=qs[_0x4922('0x44')](_[_0x4922('0x4c')](_0x11f3fd[_0x4922('0x43')],_0x432536[_0x4922('0x44')]));_0x38657c[_0x4922('0x4b')][_0x4922('0x64')]=_0x47ee0c['id'];if(_0x11f3fd['query'][_0x4922('0x4d')]){_0x38657c[_0x4922('0x4b')]=_[_0x4922('0x4e')](_0x38657c[_0x4922('0x4b')],{'$or':_[_0x4922('0x42')](_0x38657c['attributes'],function(_0x5158ee){var _0x50bc19={};_0x50bc19[_0x5158ee]={'$like':'%'+_0x11f3fd[_0x4922('0x43')][_0x4922('0x4d')]+'%'};return _0x50bc19;})});}_0x38657c=_['merge']({},_0x38657c,_0x11f3fd[_0x4922('0x50')]);return db[_0x4922('0x65')][_0x4922('0x30')]({'where':_0x38657c['where']})[_0x4922('0x1e')](function(_0x573215){_0x54a09c[_0x4922('0x30')]=_0x573215;if(_0x11f3fd[_0x4922('0x43')][_0x4922('0x51')]){_0x38657c['include']=[{'all':!![]}];}return db[_0x4922('0x65')][_0x4922('0x69')](_0x38657c);})[_0x4922('0x1e')](function(_0x32a1c7){_0x54a09c['rows']=_0x32a1c7;return _0x54a09c;});}})[_0x4922('0x1e')](respondWithFilteredResult(_0x42bcfe,_0x38657c))[_0x4922('0x28')](handleError(_0x42bcfe,null));};exports[_0x4922('0x6a')]=function(_0x100282,_0x6d1eca,_0x510399){return db['SmsAccount'][_0x4922('0x59')]({'where':{'id':_0x100282[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x6d1eca,null))[_0x4922('0x1e')](function(_0x1c7497){if(_0x1c7497){return _0x1c7497[_0x4922('0x6a')](_0x100282['query'][_0x4922('0x6b')]);}})[_0x4922('0x1e')](respondWithStatusCode(_0x6d1eca,null))[_0x4922('0x28')](handleError(_0x6d1eca,null));};exports[_0x4922('0x6c')]=function(_0xdee1ed,_0x5bedd1,_0x483e2d){if(_0xdee1ed[_0x4922('0x5a')]['id']){delete _0xdee1ed['body']['id'];}return db[_0x4922('0x3c')]['find']({'where':{'id':_0xdee1ed[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x5bedd1,null))[_0x4922('0x1e')](function(_0x1ac8e5){if(_0x1ac8e5){_0xdee1ed[_0x4922('0x5a')][_0x4922('0x64')]=_0x1ac8e5['id'];return db[_0x4922('0x6d')][_0x4922('0x5f')](_0xdee1ed[_0x4922('0x5a')]);}})['then'](respondWithResult(_0x5bedd1,null))[_0x4922('0x28')](handleError(_0x5bedd1,null));};exports[_0x4922('0x6e')]=function(_0x16271c,_0xeea955,_0x571ae4){var _0x10e7cd={'raw':![],'where':{}};var _0x5edeac={};var _0x4b2be8={'count':0x0,'rows':[]};return db[_0x4922('0x3c')][_0x4922('0x6f')]({'where':{'id':_0x16271c[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0xeea955,null))[_0x4922('0x1e')](function(_0x163343){if(_0x163343){_0x5edeac[_0x4922('0x41')]=_[_0x4922('0x58')](db[_0x4922('0x6d')][_0x4922('0x3d')]);_0x5edeac[_0x4922('0x43')]=_[_0x4922('0x58')](_0x16271c[_0x4922('0x43')]);_0x5edeac[_0x4922('0x44')]=_['intersection'](_0x5edeac[_0x4922('0x41')],_0x5edeac['query']);_0x10e7cd['attributes']=_[_0x4922('0x46')](_0x5edeac[_0x4922('0x41')],qs[_0x4922('0x47')](_0x16271c[_0x4922('0x43')]['fields']));_0x10e7cd[_0x4922('0x45')]=_0x10e7cd[_0x4922('0x45')][_0x4922('0x48')]?_0x10e7cd[_0x4922('0x45')]:_0x5edeac[_0x4922('0x41')];if(!_0x16271c[_0x4922('0x43')]['hasOwnProperty'](_0x4922('0x68'))){_0x10e7cd[_0x4922('0x2f')]=qs[_0x4922('0x2f')](_0x16271c['query'][_0x4922('0x2f')]);_0x10e7cd['offset']=qs['offset'](_0x16271c['query']['offset']);}_0x10e7cd[_0x4922('0x49')]=qs['sort'](_0x16271c[_0x4922('0x43')][_0x4922('0x4a')]);_0x10e7cd[_0x4922('0x4b')]=qs[_0x4922('0x44')](_['pick'](_0x16271c[_0x4922('0x43')],_0x5edeac['filters']));_0x10e7cd['where']['SmsAccountId']=_0x163343['id'];if(_0x16271c['query'][_0x4922('0x4d')]){_0x10e7cd[_0x4922('0x4b')]=_[_0x4922('0x4e')](_0x10e7cd[_0x4922('0x4b')],{'$or':_[_0x4922('0x42')](_0x10e7cd['attributes'],function(_0xe2f3a4){var _0x21d5d2={};_0x21d5d2[_0xe2f3a4]={'$like':'%'+_0x16271c[_0x4922('0x43')][_0x4922('0x4d')]+'%'};return _0x21d5d2;})});}_0x10e7cd=_['merge']({},_0x10e7cd,_0x16271c[_0x4922('0x50')]);return db['CannedAnswer']['count']({'where':_0x10e7cd['where']})['then'](function(_0x24e299){_0x4b2be8['count']=_0x24e299;if(_0x16271c[_0x4922('0x43')][_0x4922('0x51')]){_0x10e7cd[_0x4922('0x52')]=[{'all':!![]}];}return db[_0x4922('0x6d')][_0x4922('0x69')](_0x10e7cd);})[_0x4922('0x1e')](function(_0x18aa61){_0x4b2be8['rows']=_0x18aa61;return _0x4b2be8;});}})[_0x4922('0x1e')](respondWithFilteredResult(_0xeea955,_0x10e7cd))[_0x4922('0x28')](handleError(_0xeea955,null));};exports['removeAnswers']=function(_0x1b83af,_0x156cb9,_0x1f54e2){return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x1b83af[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x156cb9,null))[_0x4922('0x1e')](function(_0x26d6ed){if(_0x26d6ed){return _0x26d6ed[_0x4922('0x70')](_0x1b83af[_0x4922('0x43')][_0x4922('0x6b')]);}})[_0x4922('0x1e')](respondWithStatusCode(_0x156cb9,null))[_0x4922('0x28')](handleError(_0x156cb9,null));};exports[_0x4922('0x71')]=function(_0x1c1fae,_0x3b09a2,_0x3afc3b){var _0x78e64f={'channel':_0x4922('0x72')};var _0x75b926=[];var _0x5ba543=[];var _0x2eaed3={};return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x1c1fae[_0x4922('0x55')]['id']},'include':[{'model':db[_0x4922('0x73')],'as':_0x4922('0x74')}]})[_0x4922('0x1e')](handleEntityNotFound(_0x3b09a2,null))['then'](function(_0x275bcf){_0x78e64f['account']=_0x275bcf;_0x78e64f[_0x4922('0x75')]=_[_0x4922('0x76')](_0x275bcf[_0x4922('0x74')],['priority'],['asc']);if(_0x78e64f['account']['Applications']){delete _0x78e64f[_0x4922('0x77')]['Applications'];}return db[_0x4922('0x78')][_0x4922('0x62')]();})[_0x4922('0x1e')](function(_0x337ff0){if(!_0x337ff0){throw new db[(_0x4922('0x79'))][(_0x4922('0x7a'))](_0x4922('0x7b'));}_0x75b926=_['difference'](_[_0x4922('0x58')](_0x337ff0),[_0x4922('0x7c'),_0x4922('0x7d')]);_0x5ba543=_[_0x4922('0x7e')](_[_0x4922('0x58')](_0x337ff0),[_0x4922('0x7c'),_0x4922('0x7d'),'CompanyId',_0x4922('0x7f')]);_0x78e64f['body']={'mapKey':'mobile'};if(_0x78e64f[_0x4922('0x77')]['type']){switch(_0x78e64f[_0x4922('0x77')][_0x4922('0x3f')]){case _0x4922('0x80'):_0x78e64f[_0x4922('0x5a')]['from']=_0x1c1fae[_0x4922('0x5a')]['From'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x81')];_0x78e64f[_0x4922('0x5a')][_0x4922('0x82')]=_0x1c1fae['body'][_0x4922('0x83')];break;case _0x4922('0x84'):_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]='+'+_0x1c1fae[_0x4922('0x5a')]['sender'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x86')];break;case _0x4922('0x87'):_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]=_0x1c1fae[_0x4922('0x5a')]['from'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')]['message'];break;case _0x4922('0x88'):_0x78e64f['body'][_0x4922('0x85')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x85')];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae['body'][_0x4922('0x5a')];_0x78e64f[_0x4922('0x5a')][_0x4922('0x82')]=_0x1c1fae['body'][_0x4922('0x89')];break;case _0x4922('0x8a'):_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]=_0x1c1fae['body'][_0x4922('0x8b')];_0x78e64f[_0x4922('0x5a')]['body']=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x8c')];_0x78e64f[_0x4922('0x5a')]['messageId']=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x8d')];break;case'infobip':_0x78e64f[_0x4922('0x5a')]['from']='+'+_0x1c1fae['body'][_0x4922('0x8e')][0x0]['from'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x8e')][0x0][_0x4922('0x86')];_0x78e64f['body']['messageId']=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x8e')][0x0][_0x4922('0x82')];break;case _0x4922('0x8f'):_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x90')];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x91')]['message'];break;case _0x4922('0x92'):_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x93')];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae['body']['text'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x82')]=_0x1c1fae['body']['replyMessageId'];break;case _0x4922('0x94'):_0x78e64f['body'][_0x4922('0x82')]=_0x1c1fae[_0x4922('0x5a')][0x0]['message']['id'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')]=_0x1c1fae['body'][0x0][_0x4922('0x27')]['from'];_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][0x0][_0x4922('0x27')][_0x4922('0x86')];break;case _0x4922('0x95'):_0x78e64f[_0x4922('0x5a')]['from']=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x85')];_0x78e64f['body'][_0x4922('0x5a')]=_0x1c1fae[_0x4922('0x5a')][_0x4922('0x27')];_0x78e64f[_0x4922('0x5a')]['messageId']=_0x1c1fae['body'][_0x4922('0x96')];break;}}if(_0x78e64f[_0x4922('0x5a')]['id']){delete _0x78e64f['body']['id'];}if(_['isNil'](_0x78e64f['body'][_0x4922('0x85')])){throw new db['Sequelize'][(_0x4922('0x7a'))](_0x4922('0x97'));}if(_[_0x4922('0x98')](_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')])||_0x78e64f['body']['body']===''){throw new db[(_0x4922('0x79'))][(_0x4922('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4922('0x98')](_0x78e64f[_0x4922('0x5a')][_0x4922('0x99')])){throw new db['Sequelize'][(_0x4922('0x7a'))](_0x4922('0x9a')+_0x5ba543);}if(!_[_0x4922('0x9b')](_0x5ba543,_0x78e64f[_0x4922('0x5a')]['mapKey'])){throw new db[(_0x4922('0x79'))][(_0x4922('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ba543);}_0x2eaed3[_0x78e64f['body']['mapKey']]=_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')];return db[_0x4922('0x9c')]['find']({'where':{'id':_0x78e64f[_0x4922('0x77')][_0x4922('0x7f')]},'include':[{'model':db[_0x4922('0x78')],'as':_0x4922('0x9d'),'where':_0x2eaed3,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x4922('0x1e')](handleEntityNotFound(_0x3b09a2,null))[_0x4922('0x1e')](function(_0x30c737){if(_0x30c737){_0x78e64f[_0x4922('0x9e')]=_[_0x4922('0x9f')](_0x30c737,[_0x4922('0x9d')]);if(_0x30c737['Contacts'][_0x4922('0x48')]){return _0x30c737[_0x4922('0x9d')][0x0];}var _0x26418c=_[_0x4922('0x17')](_0x78e64f['body'],{'firstName':_0x78e64f['body']['from'],'ListId':_0x30c737['id']});_0x26418c[_0x78e64f[_0x4922('0x5a')]['mapKey']]=_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')];return db['CmContact'][_0x4922('0x5f')](_0x26418c,{'fields':_0x75b926,'raw':!![]});}})[_0x4922('0x1e')](handleEntityNotFound(_0x3b09a2,null))[_0x4922('0x1e')](function(_0x10758f){if(_0x10758f){_0x78e64f['contact']=_0x10758f;var _0x3bb96c={'ContactId':_0x10758f['id'],'phone':_0x78e64f[_0x4922('0x5a')][_0x4922('0x85')],'SmsAccountId':_0x1c1fae[_0x4922('0x55')]['id']};var _0x4654f1={'ContactId':_0x10758f['id'],'SmsAccountId':_0x1c1fae[_0x4922('0x55')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x4654f1})[_0x4922('0x1e')](function(_0x120d2e){if(_0x120d2e){return[_0x120d2e,![]];}return db[_0x4922('0xa0')][_0x4922('0x5f')](_0x3bb96c)[_0x4922('0x1e')](function(_0x5d6db8){return[_0x5d6db8,!![]];});});}})['spread'](function(_0x1d62ff,_0x1224a9){_0x78e64f[_0x4922('0xa1')]=_0x1d62ff[_0x4922('0x36')]({'plain':!![]});_0x78e64f['interaction']['created']=![];if(_0x1224a9){if(_0x78e64f[_0x4922('0x77')][_0x4922('0xa2')]){_0x78e64f[_0x4922('0x75')][_0x4922('0xa3')]({'id':0x0,'priority':_0x78e64f[_0x4922('0x75')]['length']+0x1,'app':_0x4922('0xa4'),'appdata':_0x4922('0xa5'),'interval':_0x4922('0xa6')});}_0x78e64f[_0x4922('0xa1')][_0x4922('0xa7')]=!![];}return db[_0x4922('0xa8')][_0x4922('0x5f')]({'phone':_0x78e64f[_0x4922('0x5a')]['from'],'messageId':_0x78e64f[_0x4922('0x5a')][_0x4922('0x82')],'body':_0x78e64f[_0x4922('0x5a')][_0x4922('0x5a')],'SmsAccountId':_0x1c1fae['params']['id'],'SmsInteractionId':_0x1d62ff['id'],'direction':'in','ContactId':_0x1d62ff['ContactId'],'AttachmentId':_0x78e64f[_0x4922('0x5a')][_0x4922('0xa9')]});})[_0x4922('0x1e')](function(_0x178fe0){_0x78e64f[_0x4922('0x27')]=_0x178fe0;if(!_0x78e64f['interaction'][_0x4922('0xaa')])return;return db[_0x4922('0xab')][_0x4922('0x59')]({'attributes':['id',_0x4922('0x3a')],'where':{'id':_0x78e64f['interaction']['UserId']}});})[_0x4922('0x1e')](function(_0x4a1d35){if(_0x4a1d35){_0x78e64f['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a1d35[_0x4922('0x3a')]+','+(_0x78e64f[_0x4922('0x77')][_0x4922('0xac')]||0xa),'interval':'*,*,*,*'});}if(!_0x78e64f[_0x4922('0xa1')]['queueId'])return;return db[_0x4922('0xad')][_0x4922('0x59')]({'attributes':['id',_0x4922('0x3a')],'where':{'id':_0x78e64f[_0x4922('0xa1')][_0x4922('0xae')]}});})[_0x4922('0x1e')](function(_0x28cccd){if(_0x28cccd){_0x78e64f[_0x4922('0x75')][_0x4922('0xaf')]({'id':0x0,'priority':0x1,'app':_0x4922('0xb0'),'appdata':_0x28cccd[_0x4922('0x3a')]+','+(_0x78e64f[_0x4922('0x77')][_0x4922('0xb1')]||0x12c),'interval':_0x4922('0xa6')});}return respondWithRpcPromise('Start',_0x4922('0xb2'),_0x78e64f);})[_0x4922('0x1e')](function(_0x1bba6f){if(_0x1bba6f){var _0x3e96c5=0xc8;var _0x13ba86=_0x4922('0xb3');logger[_0x4922('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x13ba86,_0x3e96c5,_0x4922('0xb4'));logger[_0x4922('0x20')](_0x4922('0xb5'),_0x13ba86,_0x3e96c5,_0x4922('0xb4'),JSON[_0x4922('0x23')](_0x1bba6f));if(_0x78e64f[_0x4922('0x77')][_0x4922('0x3f')]==='twilio'){return _0x3b09a2[_0x4922('0x2b')](_0x3e96c5)[_0x4922('0xb6')]('Content-Type',_0x4922('0xb7'))['send']('\x0a');}else{return _0x3b09a2[_0x4922('0x2b')](_0x3e96c5)[_0x4922('0x2c')](_0x1bba6f);}}})[_0x4922('0x28')](handleError(_0x3b09a2,null));};exports[_0x4922('0xb8')]=function(_0x19dd66,_0x87ff57){var _0x6beeb0=_0x19dd66[_0x4922('0x55')]['id'];var _0xfbcc5e=_0x19dd66[_0x4922('0x5a')];var _0x4be522=0xc8;var _0xf1d602=null;return db['sequelize'][_0x4922('0xb9')]({'isolationLevel':db[_0x4922('0xba')][_0x4922('0xbb')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x13fbc4){return db[_0x4922('0x3c')][_0x4922('0x6f')]({'where':{'id':_0x6beeb0},'transaction':_0x13fbc4})[_0x4922('0x1e')](function(_0x13c938){if(_0x13c938){return db[_0x4922('0x73')]['destroy']({'where':{'SmsAccountId':_0x6beeb0},'transaction':_0x13fbc4})[_0x4922('0x1e')](function(){var _0x468fc9=_[_0x4922('0x42')](_0xfbcc5e,function(_0x5df41c){_0x5df41c['SmsAccountId']=_0x6beeb0;return _0x5df41c;});return db[_0x4922('0x73')]['bulkCreate'](_0x468fc9,{'transaction':_0x13fbc4});});}else{_0x4be522=0x194;_0xf1d602=[];}});})[_0x4922('0x1e')](function(){if(_0x4be522!==0x194){return db[_0x4922('0x73')][_0x4922('0xbc')]({'where':{'SmsAccountId':_0x6beeb0},'order':_0x4922('0xbd')})[_0x4922('0x1e')](function(_0x2aa791){_0xf1d602=_0x2aa791;});}})[_0x4922('0x28')](function(_0x328f95){_0x4be522=0x1f4;logger[_0x4922('0x24')](_0x328f95[_0x4922('0x39')]);if(_0x328f95['name']){delete _0x328f95[_0x4922('0x3a')];}_0xf1d602=_0x328f95;})['finally'](function(){if(_0xf1d602===null){_0x87ff57[_0x4922('0x29')](_0x4be522);}else{if(_0x4be522===0x1f4){_0x87ff57['status'](_0x4be522)[_0x4922('0xbe')](_0xf1d602);}else{_0x87ff57[_0x4922('0x2b')](_0x4be522)[_0x4922('0x2c')](_0xf1d602);}}});};exports[_0x4922('0xbf')]=function(_0x45d5e2,_0x302bba,_0x4cf1e1){var _0x374264={};var _0x3b5964={};var _0xcbdfd9;var _0x5db2ef;return db[_0x4922('0x3c')]['findOne']({'where':{'id':_0x45d5e2[_0x4922('0x55')]['id']}})['then'](handleEntityNotFound(_0x302bba,null))[_0x4922('0x1e')](function(_0xcd8795){if(_0xcd8795){_0xcbdfd9=_0xcd8795;_0x3b5964[_0x4922('0x41')]=_[_0x4922('0x58')](db[_0x4922('0x73')][_0x4922('0x3d')]);_0x3b5964[_0x4922('0x43')]=_['keys'](_0x45d5e2[_0x4922('0x43')]);_0x3b5964[_0x4922('0x44')]=_[_0x4922('0x46')](_0x3b5964[_0x4922('0x41')],_0x3b5964[_0x4922('0x43')]);_0x374264[_0x4922('0x45')]=_[_0x4922('0x46')](_0x3b5964['model'],qs['fields'](_0x45d5e2['query'][_0x4922('0x47')]));_0x374264[_0x4922('0x45')]=_0x374264[_0x4922('0x45')]['length']?_0x374264[_0x4922('0x45')]:_0x3b5964[_0x4922('0x41')];_0x374264[_0x4922('0x49')]=qs['sort'](_0x45d5e2[_0x4922('0x43')][_0x4922('0x4a')]);_0x374264[_0x4922('0x4b')]=qs['filters'](_[_0x4922('0x4c')](_0x45d5e2[_0x4922('0x43')],_0x3b5964[_0x4922('0x44')]));if(_0x45d5e2[_0x4922('0x43')][_0x4922('0x4d')]){_0x374264[_0x4922('0x4b')]=_[_0x4922('0x4e')](_0x374264[_0x4922('0x4b')],{'$or':_[_0x4922('0x42')](_0x374264[_0x4922('0x45')],function(_0x3f1720){var _0xf14ec7={};_0xf14ec7[_0x3f1720]={'$like':'%'+_0x45d5e2[_0x4922('0x43')]['filter']+'%'};return _0xf14ec7;})});}_0x374264=_[_0x4922('0x4e')]({},_0x374264,_0x45d5e2['options']);return _0xcbdfd9[_0x4922('0xbf')](_0x374264);}})[_0x4922('0x1e')](function(_0x19a9c3){if(_0x19a9c3){_0x5db2ef=_0x19a9c3[_0x4922('0x48')];if(!_0x45d5e2[_0x4922('0x43')]['hasOwnProperty'](_0x4922('0x68'))){_0x374264[_0x4922('0x2f')]=qs['limit'](_0x45d5e2['query'][_0x4922('0x2f')]);_0x374264[_0x4922('0x2d')]=qs[_0x4922('0x2d')](_0x45d5e2['query'][_0x4922('0x2d')]);}return _0xcbdfd9[_0x4922('0xbf')](_0x374264);}})[_0x4922('0x1e')](function(_0x484867){if(_0x484867){return _0x484867?{'count':_0x5db2ef,'rows':_0x484867}:null;}})['then'](respondWithResult(_0x302bba,null))[_0x4922('0x28')](handleError(_0x302bba,null));};exports['getInteractions']=function(_0x4d913c,_0x2194ee,_0x52e7db){var _0x5ba90e={'raw':![],'where':{}};var _0x4c4db9={};var _0x2f8867={'count':0x0,'rows':[]};return db[_0x4922('0x3c')][_0x4922('0x6f')]({'where':{'id':_0x4d913c[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x2194ee,null))['then'](function(_0x512ce9){if(_0x512ce9){_0x4c4db9[_0x4922('0x41')]=_['keys'](db[_0x4922('0xa0')][_0x4922('0x3d')]);_0x4c4db9[_0x4922('0x43')]=_[_0x4922('0x58')](_0x4d913c[_0x4922('0x43')]);_0x4c4db9[_0x4922('0x44')]=_[_0x4922('0x46')](_0x4c4db9[_0x4922('0x41')],_0x4c4db9['query']);_0x5ba90e[_0x4922('0x45')]=_[_0x4922('0x46')](_0x4c4db9[_0x4922('0x41')],qs['fields'](_0x4d913c[_0x4922('0x43')][_0x4922('0x47')]));_0x5ba90e[_0x4922('0x45')]=_0x5ba90e[_0x4922('0x45')]['length']?_0x5ba90e['attributes']:_0x4c4db9[_0x4922('0x41')];if(!_0x4d913c[_0x4922('0x43')][_0x4922('0x67')](_0x4922('0x68'))){_0x5ba90e[_0x4922('0x2f')]=qs[_0x4922('0x2f')](_0x4d913c[_0x4922('0x43')][_0x4922('0x2f')]);_0x5ba90e[_0x4922('0x2d')]=qs['offset'](_0x4d913c[_0x4922('0x43')][_0x4922('0x2d')]);}_0x5ba90e[_0x4922('0x49')]=qs['sort'](_0x4d913c[_0x4922('0x43')][_0x4922('0x4a')]);_0x5ba90e[_0x4922('0x4b')]=qs[_0x4922('0x44')](_[_0x4922('0x4c')](_0x4d913c[_0x4922('0x43')],_0x4c4db9[_0x4922('0x44')]));_0x5ba90e['where'][_0x4922('0x64')]=_0x512ce9['id'];if(_0x4d913c[_0x4922('0x43')][_0x4922('0x4d')]){_0x5ba90e['where']=_[_0x4922('0x4e')](_0x5ba90e[_0x4922('0x4b')],{'$or':_[_0x4922('0x42')](_0x5ba90e[_0x4922('0x45')],function(_0x3dacc9){var _0x3869f2={};_0x3869f2[_0x3dacc9]={'$like':'%'+_0x4d913c['query'][_0x4922('0x4d')]+'%'};return _0x3869f2;})});}_0x5ba90e=_[_0x4922('0x4e')]({},_0x5ba90e,_0x4d913c[_0x4922('0x50')]);return db[_0x4922('0xa0')][_0x4922('0x30')]({'where':_0x5ba90e['where']})[_0x4922('0x1e')](function(_0x476f64){_0x2f8867[_0x4922('0x30')]=_0x476f64;if(_0x4d913c[_0x4922('0x43')]['includeAll']){_0x5ba90e[_0x4922('0x52')]=[{'model':db[_0x4922('0x78')],'as':_0x4922('0xc0'),'required':![]},{'model':db[_0x4922('0xab')],'as':_0x4922('0xc1'),'attributes':[_0x4922('0x3a'),_0x4922('0xc2'),_0x4922('0xc3')],'required':![]},{'model':db[_0x4922('0xc4')],'as':'Tags','attributes':['id',_0x4922('0x3a'),_0x4922('0xc5')],'where':_0x4d913c[_0x4922('0x43')]['tag']?{'id':_0x4d913c[_0x4922('0x43')][_0x4922('0xc6')]}:undefined,'required':_0x4d913c[_0x4922('0x43')][_0x4922('0xc6')]?!![]:![]}];}return db[_0x4922('0xa0')][_0x4922('0x69')](_0x5ba90e);})['then'](function(_0x5b5750){_0x2f8867[_0x4922('0x53')]=_0x5b5750;return _0x2f8867;});}})[_0x4922('0x1e')](respondWithFilteredResult(_0x2194ee,_0x5ba90e))[_0x4922('0x28')](handleError(_0x2194ee,null));};exports[_0x4922('0xbe')]=function(_0x3f4499,_0x514dae,_0x2cce39){var _0x5be441,_0x348b96,_0x337403;if(_[_0x4922('0x98')](_0x3f4499[_0x4922('0x5a')]['body'])||_0x3f4499['body']['body']===''){throw new db[(_0x4922('0x79'))][(_0x4922('0x7a'))](_0x4922('0xc7'));}if(_[_0x4922('0x98')](_0x3f4499[_0x4922('0x5a')]['to'])){throw new db[(_0x4922('0x79'))][(_0x4922('0x7a'))](_0x4922('0xc8'));}_0x5be441=_0x3f4499['body']['to'];return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x3f4499['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x4922('0x9d'),'where':{'mobile':_0x5be441},'limit':0x1,'order':[[_0x4922('0x7d'),_0x4922('0xc9')]]}]}]})['then'](handleEntityNotFound(_0x514dae,null))[_0x4922('0x1e')](function(_0x44d633){if(_0x44d633&&_0x44d633[_0x4922('0xca')]){_0x348b96=_0x44d633[_0x4922('0x36')]({'plain':!![]});if(_0x348b96[_0x4922('0xca')]&&_0x348b96['List'][_0x4922('0x9d')]['length']){return _0x348b96[_0x4922('0xca')][_0x4922('0x9d')][0x0];}return db[_0x4922('0x78')][_0x4922('0x5f')](_['defaults'](_0x3f4499[_0x4922('0x5a')],{'firstName':_0x5be441,'mobile':_0x5be441,'phone':_0x5be441,'ListId':_0x348b96['ListId']}));}})['then'](handleEntityNotFound(_0x514dae,null))[_0x4922('0x1e')](function(_0x268842){if(_0x268842){_0x337403=_0x268842;return db[_0x4922('0xa0')][_0x4922('0x59')]({'where':{'ContactId':_0x337403['id'],'closed':![],'SmsAccountId':_0x348b96['id']}})[_0x4922('0x1e')](function(_0x5da0a5){if(_0x5da0a5){return[_0x5da0a5,![]];}return db[_0x4922('0xa0')][_0x4922('0x5f')]({'UserId':_0x3f4499[_0x4922('0x5b')]['id'],'ContactId':_0x337403['id'],'SmsAccountId':_0x348b96['id'],'phone':_0x5be441,'firstMsgDirection':'out','Messages':[_['merge'](_0x3f4499[_0x4922('0x5a')],{'read':![],'body':_0x3f4499[_0x4922('0x5a')]['body'],'phone':_0x5be441,'SmsAccountId':_0x348b96['id'],'UserId':_0x3f4499['user']['id'],'ContactId':_0x337403['id']})]},{'include':[{'model':db[_0x4922('0xa8')],'as':_0x4922('0xcb')}]})[_0x4922('0x1e')](function(_0x13abd1){return[_0x13abd1,!![]];});});}})[_0x4922('0xcc')](function(_0x54cc23,_0x26b45f){if(_0x26b45f){return _0x54cc23;}return db['SmsMessage']['create'](_[_0x4922('0x4e')](_0x3f4499[_0x4922('0x5a')],{'read':![],'body':_0x3f4499[_0x4922('0x5a')]['body'],'phone':_0x5be441,'SmsAccountId':_0x348b96['id'],'SmsInteractionId':_0x54cc23['id'],'UserId':_0x3f4499[_0x4922('0x5b')]['id'],'ContactId':_0x337403['id']}))[_0x4922('0x1e')](function(_0x61ed96){_0x54cc23['dataValues'][_0x4922('0xcb')]=[];_0x54cc23[_0x4922('0xcd')]['Messages'][_0x4922('0xa3')](_0x61ed96[_0x4922('0xcd')]);return _0x54cc23;});})[_0x4922('0x1e')](respondWithResult(_0x514dae,null))['catch'](handleError(_0x514dae,null));};exports[_0x4922('0x2b')]=function(_0x10eef9,_0x39e452,_0x39dc35){if(_0x10eef9[_0x4922('0x5a')]['id']){delete _0x10eef9['body']['id'];}var _0x381ce2,_0x51b7cd,_0x192a1d;return db['SmsAccount'][_0x4922('0x59')]({'where':{'id':_0x10eef9[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x39e452,null))[_0x4922('0x1e')](function(_0x5f0a6e){if(_0x5f0a6e){_0x192a1d=_0x5f0a6e;logger['debug'](_0x4922('0x21'),'status',_0x4922('0xce'),_0x5f0a6e[_0x4922('0x3f')],util['inspect'](_0x10eef9['body'],{'showHidden':![],'depth':null}));switch(_0x5f0a6e['type']){case'skebby':if(_0x10eef9[_0x4922('0x5a')][_0x4922('0xcf')]&&_0x10eef9['body'][_0x4922('0x2b')]){_0x51b7cd=_0x10eef9[_0x4922('0x5a')]['status'];return db[_0x4922('0xa8')]['find']({'where':{'messageId':_0x10eef9[_0x4922('0x5a')][_0x4922('0xcf')]}});}break;case _0x4922('0x87'):if(_0x10eef9[_0x4922('0x5a')][_0x4922('0xd0')]&&_0x10eef9['body'][_0x4922('0xd1')]){_0x51b7cd=_0x10eef9[_0x4922('0x5a')][_0x4922('0xd1')];return db['SmsMessage'][_0x4922('0x59')]({'where':{'messageId':_0x10eef9[_0x4922('0x5a')]['requestid']}});}break;case _0x4922('0x88'):if(_0x10eef9['body'][_0x4922('0x89')]&&_0x10eef9[_0x4922('0x5a')][_0x4922('0xd2')]){_0x51b7cd=_0x10eef9[_0x4922('0x5a')]['status_code'];return db[_0x4922('0xa8')][_0x4922('0x59')]({'where':{'messageId':_0x10eef9['body'][_0x4922('0x89')]}});}break;case _0x4922('0xd3'):var _0x3d1a85=_0x10eef9[_0x4922('0x5a')]['results'][0x0];if(_0x3d1a85['messageId']&&_0x3d1a85['status'][_0x4922('0xd4')]===_0x4922('0xd5')){_0x51b7cd=_0x3d1a85['status'][_0x4922('0xd4')];return db['SmsMessage'][_0x4922('0x59')]({'where':{'messageId':_0x3d1a85[_0x4922('0x82')]}});}break;case'clickatell':if(_0x10eef9[_0x4922('0x5a')][_0x4922('0x82')]&&_0x10eef9[_0x4922('0x5a')][_0x4922('0x2b')]){_0x51b7cd=_0x10eef9[_0x4922('0x5a')][_0x4922('0x2b')];return db[_0x4922('0xa8')][_0x4922('0x59')]({'where':{'messageId':_0x10eef9[_0x4922('0x5a')]['messageId']}});}break;case _0x4922('0x94'):if(_0x10eef9['body'][0x0]['message']['id']){_0x51b7cd=_0x10eef9[_0x4922('0x5a')][0x0]['type'];return db['SmsMessage'][_0x4922('0x59')]({'where':{'messageId':_0x10eef9[_0x4922('0x5a')][0x0][_0x4922('0x27')]['id']}});}break;case _0x4922('0x95'):if(_0x10eef9[_0x4922('0x5a')][_0x4922('0xd6')]&&_0x10eef9[_0x4922('0x5a')][_0x4922('0x2b')]){_0x51b7cd=_0x10eef9['body'][_0x4922('0x2b')];return db[_0x4922('0xa8')][_0x4922('0x59')]({'where':{'messageId':_0x10eef9[_0x4922('0x5a')]['redif']}});}break;}}})[_0x4922('0x1e')](handleEntityNotFound(_0x39e452,null))['then'](function(_0x20258a){if(_0x20258a){_0x381ce2=_0x20258a;switch(_0x192a1d[_0x4922('0x3f')]){case _0x4922('0x84'):if(_0x51b7cd===_0x4922('0xd5')){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),_0x4922('0x2b'),_0x4922('0x84'),util[_0x4922('0xd7')](_0x10eef9['body'],{'showHidden':![],'depth':null}));}break;case _0x4922('0x87'):if(_0x51b7cd==='1'){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger['error'](_0x4922('0x21'),_0x4922('0x2b'),'skebby',util[_0x4922('0xd7')](_0x10eef9[_0x4922('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x10eef9[_0x4922('0x5a')][_0x4922('0xd8')]&&_0x51b7cd>=0xc8&&_0x51b7cd<=0xce){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),_0x4922('0x2b'),'clicksend',util['inspect'](_0x10eef9[_0x4922('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x4922('0xd3'):var _0x5a1e27=_0x10eef9[_0x4922('0x5a')][_0x4922('0x8e')][0x0];if(_0x5a1e27['status'][_0x4922('0xd4')]===_0x4922('0xd5')){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),_0x4922('0x2b'),_0x4922('0xd3'),util[_0x4922('0xd7')](_0x10eef9[_0x4922('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x4922('0x92'):if(_0x51b7cd=='DELIVERED_TO_GATEWAY'||_0x51b7cd=='RECEIVED_BY_RECIPIENT'){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),'status',_0x4922('0x92'),util[_0x4922('0xd7')](_0x10eef9[_0x4922('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x4922('0x94'):if(_0x51b7cd==_0x4922('0xd9')){return _0x381ce2['update']({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),'status','bandwidth',util[_0x4922('0xd7')](_0x10eef9[_0x4922('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x4922('0x95'):if(_0x51b7cd===_0x4922('0xda')||_0x51b7cd===_0x4922('0xdb')){return _0x381ce2[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),_0x4922('0x2b'),'intelepeer',util['inspect'](_0x10eef9['body'],{'showHidden':![],'depth':null}));}break;}return _0x381ce2;}})[_0x4922('0x1e')](respondWithResult(_0x39e452,null))['catch'](handleError(_0x39e452,null));};exports[_0x4922('0xdc')]=function(_0x1be6c1,_0x212753,_0x33855c){var _0x39974d,_0x14ea83,_0xeb4fac;return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x1be6c1[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x212753,null))['then'](function(_0x1c68ae){if(_0x1c68ae){_0xeb4fac=_0x1c68ae;logger['debug'](_0x4922('0x21'),'status','received\x20delivery\x20report\x20from',_0x1c68ae[_0x4922('0x3f')],util[_0x4922('0xd7')](_0x1be6c1[_0x4922('0x43')],{'showHidden':![],'depth':null}));switch(_0x1c68ae['type']){case _0x4922('0x8f'):if(_0x1be6c1[_0x4922('0x43')][_0x4922('0xdd')]&&_0x1be6c1[_0x4922('0x43')][_0x4922('0xde')]){_0x14ea83=_0x1be6c1[_0x4922('0x43')]['state'];return db[_0x4922('0xa8')]['find']({'where':{'messageId':_0x1be6c1[_0x4922('0x43')][_0x4922('0xdd')]}});}break;}}})[_0x4922('0x1e')](handleEntityNotFound(_0x212753,null))['then'](function(_0x3f8a72){if(_0x3f8a72){_0x39974d=_0x3f8a72;switch(_0xeb4fac['type']){case _0x4922('0x8f'):if(_0x14ea83==='2'||_0x14ea83==='6'){return _0x39974d[_0x4922('0x61')]({'read':!![]});}else{logger[_0x4922('0x24')](_0x4922('0x21'),_0x4922('0x2b'),_0x4922('0x8f'),util[_0x4922('0xd7')](_0x1be6c1[_0x4922('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x39974d;}})[_0x4922('0x1e')](respondWithResult(_0x212753,null))[_0x4922('0x28')](handleError(_0x212753,null));};exports[_0x4922('0xdf')]=function(_0x26cd57,_0x4af046,_0xca384d){return db[_0x4922('0x3c')][_0x4922('0x59')]({'where':{'id':_0x26cd57[_0x4922('0x55')]['id']}})['then'](handleEntityNotFound(_0x4af046,null))[_0x4922('0x1e')](function(_0x2b73f2){if(_0x2b73f2){return _0x2b73f2[_0x4922('0xdf')](_0x26cd57[_0x4922('0x5a')][_0x4922('0x6b')],_['omit'](_0x26cd57['body'],[_0x4922('0x6b'),'id'])||{})[_0x4922('0xcc')](function(_0x1d70b6){for(var _0x41bdfe=0x0;_0x41bdfe<_0x26cd57[_0x4922('0x5a')][_0x4922('0x6b')][_0x4922('0x48')];_0x41bdfe+=0x1){socket['emit'](_0x4922('0xe0'),{'UserId':Number(_0x26cd57[_0x4922('0x5a')][_0x4922('0x6b')][_0x41bdfe]),'SmsAccountId':Number(_0x26cd57['params']['id'])});}return _0x1d70b6;});}})['then'](respondWithResult(_0x4af046,null))['catch'](handleError(_0x4af046,null));};exports['removeAgents']=function(_0x50e14a,_0x8f7fbc,_0x4fb573){return db[_0x4922('0x3c')]['find']({'where':{'id':_0x50e14a[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x8f7fbc,null))[_0x4922('0x1e')](function(_0x3791d3){if(_0x3791d3){return _0x3791d3[_0x4922('0xe1')](_0x50e14a['query'][_0x4922('0x6b')])[_0x4922('0x1e')](function(){if(_[_0x4922('0xe2')](_0x50e14a['query']['ids'])){for(var _0x104902=0x0;_0x104902<_0x50e14a[_0x4922('0x43')][_0x4922('0x6b')]['length'];_0x104902+=0x1){socket[_0x4922('0xe3')](_0x4922('0xe4'),{'UserId':Number(_0x50e14a[_0x4922('0x43')][_0x4922('0x6b')][_0x104902]),'SmsAccountId':Number(_0x50e14a['params']['id'])});}}else{socket[_0x4922('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x50e14a['query']['ids']),'SmsAccountId':Number(_0x50e14a[_0x4922('0x55')]['id'])});}});}})[_0x4922('0x1e')](respondWithStatusCode(_0x8f7fbc,null))[_0x4922('0x28')](handleError(_0x8f7fbc,null));};exports[_0x4922('0xe5')]=function(_0x470596,_0x30321d,_0x1c6cc7){var _0x297de2={};var _0x58045e={};var _0x4b116d;var _0x4f5b58;return db[_0x4922('0x3c')][_0x4922('0x6f')]({'where':{'id':_0x470596[_0x4922('0x55')]['id']}})[_0x4922('0x1e')](handleEntityNotFound(_0x30321d,null))[_0x4922('0x1e')](function(_0x41b564){if(_0x41b564){_0x4b116d=_0x41b564;_0x58045e[_0x4922('0x41')]=_[_0x4922('0x58')](db['User']['rawAttributes']);_0x58045e['query']=_[_0x4922('0x58')](_0x470596[_0x4922('0x43')]);_0x58045e['filters']=_['intersection'](_0x58045e[_0x4922('0x41')],_0x58045e[_0x4922('0x43')]);_0x297de2['attributes']=_['intersection'](_0x58045e[_0x4922('0x41')],qs['fields'](_0x470596[_0x4922('0x43')]['fields']));_0x297de2['attributes']=_0x297de2['attributes'][_0x4922('0x48')]?_0x297de2[_0x4922('0x45')]:_0x58045e[_0x4922('0x41')];_0x297de2[_0x4922('0x49')]=qs[_0x4922('0x4a')](_0x470596[_0x4922('0x43')]['sort']);_0x297de2[_0x4922('0x4b')]=qs[_0x4922('0x44')](_[_0x4922('0x4c')](_0x470596[_0x4922('0x43')],_0x58045e[_0x4922('0x44')]));if(_0x470596[_0x4922('0x43')][_0x4922('0x4d')]){_0x297de2[_0x4922('0x4b')]=_[_0x4922('0x4e')](_0x297de2['where'],{'$or':_['map'](_0x297de2['attributes'],function(_0x37732d){var _0x12dc73={};_0x12dc73[_0x37732d]={'$like':'%'+_0x470596['query'][_0x4922('0x4d')]+'%'};return _0x12dc73;})});}_0x297de2=_[_0x4922('0x4e')]({},_0x297de2,_0x470596[_0x4922('0x50')]);return _0x4b116d[_0x4922('0xe5')](_0x297de2);}})[_0x4922('0x1e')](function(_0x94f03a){if(_0x94f03a){_0x4f5b58=_0x94f03a[_0x4922('0x48')];if(!_0x470596[_0x4922('0x43')]['hasOwnProperty'](_0x4922('0x68'))){_0x297de2['limit']=qs[_0x4922('0x2f')](_0x470596['query']['limit']);_0x297de2[_0x4922('0x2d')]=qs[_0x4922('0x2d')](_0x470596[_0x4922('0x43')][_0x4922('0x2d')]);}return _0x4b116d[_0x4922('0xe5')](_0x297de2);}})['then'](function(_0x8464a5){if(_0x8464a5){return _0x8464a5?{'count':_0x4f5b58,'rows':_0x8464a5}:null;}})[_0x4922('0x1e')](respondWithResult(_0x30321d,null))[_0x4922('0x28')](handleError(_0x30321d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 6662d36..5f0f311 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 _0x9e03=['setMaxListeners','save','emit','hook','events','SmsAccount'];(function(_0xcbb15b,_0x222866){var _0x581c3d=function(_0x112c93){while(--_0x112c93){_0xcbb15b['push'](_0xcbb15b['shift']());}};_0x581c3d(++_0x222866);}(_0x9e03,0x124));var _0x39e0=function(_0x2c92aa,_0x43c053){_0x2c92aa=_0x2c92aa-0x0;var _0x5b8a6b=_0x9e03[_0x2c92aa];return _0x5b8a6b;};'use strict';var EventEmitter=require(_0x39e0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x39e0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x39e0('0x2')](0x0);var events={'afterCreate':_0x39e0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3af583){return function(_0x291f6e,_0x76914d,_0x1419d2){SmsAccountEvents[_0x39e0('0x4')](_0x3af583+':'+_0x291f6e['id'],_0x291f6e);SmsAccountEvents['emit'](_0x3af583,_0x291f6e);_0x1419d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x39e0('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xb52d=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb52d,0x12b));var _0xdb52=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb52d[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require(_0xdb52('0x0'));var SmsAccount=require(_0xdb52('0x1'))['db'][_0xdb52('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdb52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb52('0x4'),'afterDestroy':_0xdb52('0x5')};function emitEvent(_0x11cfee){return function(_0x113474,_0x4e934b,_0x57e0b4){SmsAccountEvents[_0xdb52('0x6')](_0x11cfee+':'+_0x113474['id'],_0x113474);SmsAccountEvents[_0xdb52('0x6')](_0x11cfee,_0x113474);_0x57e0b4(null);};}for(var e in events){if(events[_0xdb52('0x7')](e)){var event=events[e];SmsAccount[_0xdb52('0x8')](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 033330a..3025edf 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 _0x8493=['rimraf','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3f926a,_0x31629b){var _0x5eaf35=function(_0x41e7ee){while(--_0x41e7ee){_0x3f926a['push'](_0x3f926a['shift']());}};_0x5eaf35(++_0x31629b);}(_0x8493,0x9f));var _0x3849=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x8493[_0x3a19d4];return _0x5b858b;};'use strict';var _=require(_0x3849('0x0'));var util=require(_0x3849('0x1'));var logger=require(_0x3849('0x2'))('api');var moment=require(_0x3849('0x3'));var BPromise=require(_0x3849('0x4'));var rp=require(_0x3849('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3849('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x3849('0x7')]=function(_0x5187d9,_0x427511){return _0x5187d9[_0x3849('0x8')](_0x3849('0x9'),attributes,{'tableName':_0x3849('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4247=['rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14e019,_0x458908){var _0x51ef59=function(_0x518358){while(--_0x518358){_0x14e019['push'](_0x14e019['shift']());}};_0x51ef59(++_0x458908);}(_0x4247,0x17a));var _0x7424=function(_0x36954e,_0x4f7dc2){_0x36954e=_0x36954e-0x0;var _0x21ae16=_0x4247[_0x36954e];return _0x21ae16;};'use strict';var _=require('lodash');var util=require(_0x7424('0x0'));var logger=require(_0x7424('0x1'))(_0x7424('0x2'));var moment=require(_0x7424('0x3'));var BPromise=require('bluebird');var rp=require(_0x7424('0x4'));var fs=require('fs');var path=require(_0x7424('0x5'));var rimraf=require(_0x7424('0x6'));var config=require(_0x7424('0x7'));var attributes=require(_0x7424('0x8'));module[_0x7424('0x9')]=function(_0x117aa1,_0xac7039){return _0x117aa1['define'](_0x7424('0xa'),attributes,{'tableName':_0x7424('0xb'),'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 7f89e8b..6109467 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 _0x024f=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x024f,0x120));var _0xf024=function(_0x23112d,_0x39b467){_0x23112d=_0x23112d-0x0;var _0x550e5d=_0x024f[_0x23112d];return _0x550e5d;};'use strict';var _=require(_0xf024('0x0'));var util=require(_0xf024('0x1'));var moment=require('moment');var BPromise=require(_0xf024('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf024('0x3'));var db=require(_0xf024('0x4'))['db'];var utils=require(_0xf024('0x5'));var logger=require(_0xf024('0x6'))(_0xf024('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf024('0x8')]({'port':0x232a});config[_0xf024('0x9')]=_[_0xf024('0xa')](config[_0xf024('0x9')],{'host':_0xf024('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf024('0x9')]));require(_0xf024('0xc'))[_0xf024('0xd')](socket);function respondWithRpcPromise(_0x4d361b,_0x6ff771,_0x2f3f7e){return new BPromise(function(_0x38a07d,_0x2540aa){return client[_0xf024('0xe')](_0x4d361b,_0x2f3f7e)[_0xf024('0xf')](function(_0x4745e4){logger[_0xf024('0x10')](_0xf024('0x11'),_0x6ff771,_0xf024('0x12'));logger[_0xf024('0x13')](_0xf024('0x14'),_0x6ff771,_0xf024('0x12'),JSON[_0xf024('0x15')](_0x4745e4));if(_0x4745e4[_0xf024('0x16')]){if(_0x4745e4['error']['code']===0x1f4){logger['error'](_0xf024('0x11'),_0x6ff771,_0x4745e4[_0xf024('0x16')][_0xf024('0x17')]);return _0x2540aa(_0x4745e4[_0xf024('0x16')][_0xf024('0x17')]);}logger['error'](_0xf024('0x11'),_0x6ff771,_0x4745e4[_0xf024('0x16')][_0xf024('0x17')]);return _0x38a07d(_0x4745e4['error'][_0xf024('0x17')]);}else{logger[_0xf024('0x10')]('SmsAccount,\x20%s,\x20%s',_0x6ff771,_0xf024('0x12'));_0x38a07d(_0x4745e4[_0xf024('0x18')][_0xf024('0x17')]);}})[_0xf024('0x19')](function(_0x266d6a){logger['error']('SmsAccount,\x20%s,\x20%s',_0x6ff771,_0x266d6a);_0x2540aa(_0x266d6a);});});}exports['ShowSmsAccount']=function(_0x15241c){var _0x1b36f1=this;return new Promise(function(_0x555795,_0x1aadf3){return db[_0xf024('0x1a')][_0xf024('0x1b')]({'raw':_0x15241c[_0xf024('0x1c')]?_0x15241c[_0xf024('0x1c')][_0xf024('0x1d')]===undefined?!![]:![]:!![],'where':_0x15241c[_0xf024('0x1c')]?_0x15241c[_0xf024('0x1c')][_0xf024('0x1e')]||null:null,'attributes':_0x15241c[_0xf024('0x1c')]?_0x15241c[_0xf024('0x1c')][_0xf024('0x1f')]||null:null,'include':_0x15241c[_0xf024('0x1c')]?_0x15241c[_0xf024('0x1c')][_0xf024('0x20')]?_[_0xf024('0x21')](_0x15241c[_0xf024('0x1c')][_0xf024('0x20')],function(_0xd31d78){return{'model':db[_0xd31d78['model']],'as':_0xd31d78['as'],'attributes':_0xd31d78[_0xf024('0x1f')],'include':_0xd31d78[_0xf024('0x20')]?_[_0xf024('0x21')](_0xd31d78['include'],function(_0x297459){return{'model':db[_0x297459[_0xf024('0x22')]],'as':_0x297459['as'],'attributes':_0x297459[_0xf024('0x1f')],'include':_0x297459[_0xf024('0x20')]?_[_0xf024('0x21')](_0x297459[_0xf024('0x20')],function(_0xffb230){return{'model':db[_0xffb230[_0xf024('0x22')]],'as':_0xffb230['as'],'attributes':_0xffb230[_0xf024('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf024('0xf')](function(_0x19265c){logger[_0xf024('0x10')](_0xf024('0x23'),_0x15241c);logger['debug']('ShowSmsAccount',_0x15241c,JSON[_0xf024('0x15')](_0x19265c));_0x555795(_0x19265c);})[_0xf024('0x19')](function(_0x296146){logger['error'](_0xf024('0x23'),_0x296146[_0xf024('0x17')],_0x15241c);_0x1aadf3(_0x1b36f1['error'](0x1f4,_0x296146['message']));});});}; \ No newline at end of file +var _0x251c=['error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','model','include','map','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./smsAccount.socket','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24b17e,_0x3b9d60){var _0x23051d=function(_0x544cf1){while(--_0x544cf1){_0x24b17e['push'](_0x24b17e['shift']());}};_0x23051d(++_0x3b9d60);}(_0x251c,0xe8));var _0xc251=function(_0x37a540,_0x507576){_0x37a540=_0x37a540-0x0;var _0x4602be=_0x251c[_0x37a540];return _0x4602be;};'use strict';var _=require(_0xc251('0x0'));var util=require('util');var moment=require(_0xc251('0x1'));var BPromise=require(_0xc251('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc251('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc251('0x4'))(_0xc251('0x5'));var config=require(_0xc251('0x6'));var jayson=require(_0xc251('0x7'));var client=jayson['client'][_0xc251('0x8')]({'port':0x232a});config[_0xc251('0x9')]=_[_0xc251('0xa')](config[_0xc251('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc251('0x9')]));require(_0xc251('0xb'))[_0xc251('0xc')](socket);function respondWithRpcPromise(_0x4ae205,_0xeb05,_0x2d2bce){return new BPromise(function(_0x550add,_0x485f84){return client[_0xc251('0xd')](_0x4ae205,_0x2d2bce)[_0xc251('0xe')](function(_0x49d07f){logger[_0xc251('0xf')]('SmsAccount,\x20%s,\x20%s',_0xeb05,_0xc251('0x10'));logger[_0xc251('0x11')](_0xc251('0x12'),_0xeb05,_0xc251('0x10'),JSON[_0xc251('0x13')](_0x49d07f));if(_0x49d07f[_0xc251('0x14')]){if(_0x49d07f[_0xc251('0x14')][_0xc251('0x15')]===0x1f4){logger[_0xc251('0x14')](_0xc251('0x16'),_0xeb05,_0x49d07f[_0xc251('0x14')]['message']);return _0x485f84(_0x49d07f[_0xc251('0x14')][_0xc251('0x17')]);}logger[_0xc251('0x14')](_0xc251('0x16'),_0xeb05,_0x49d07f[_0xc251('0x14')][_0xc251('0x17')]);return _0x550add(_0x49d07f[_0xc251('0x14')][_0xc251('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xeb05,_0xc251('0x10'));_0x550add(_0x49d07f[_0xc251('0x18')]['message']);}})[_0xc251('0x19')](function(_0x2bf29c){logger[_0xc251('0x14')]('SmsAccount,\x20%s,\x20%s',_0xeb05,_0x2bf29c);_0x485f84(_0x2bf29c);});});}exports[_0xc251('0x1a')]=function(_0x3bb036){var _0x188957=this;return new Promise(function(_0x4c57f5,_0x30607e){return db[_0xc251('0x1b')][_0xc251('0x1c')]({'raw':_0x3bb036[_0xc251('0x1d')]?_0x3bb036[_0xc251('0x1d')][_0xc251('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bb036[_0xc251('0x1d')]?_0x3bb036[_0xc251('0x1d')][_0xc251('0x1f')]||null:null,'attributes':_0x3bb036['options']?_0x3bb036['options'][_0xc251('0x20')]||null:null,'include':_0x3bb036[_0xc251('0x1d')]?_0x3bb036[_0xc251('0x1d')]['include']?_['map'](_0x3bb036[_0xc251('0x1d')]['include'],function(_0x14a26d){return{'model':db[_0x14a26d[_0xc251('0x21')]],'as':_0x14a26d['as'],'attributes':_0x14a26d[_0xc251('0x20')],'include':_0x14a26d[_0xc251('0x22')]?_[_0xc251('0x23')](_0x14a26d[_0xc251('0x22')],function(_0x39f6a3){return{'model':db[_0x39f6a3[_0xc251('0x21')]],'as':_0x39f6a3['as'],'attributes':_0x39f6a3[_0xc251('0x20')],'include':_0x39f6a3[_0xc251('0x22')]?_[_0xc251('0x23')](_0x39f6a3[_0xc251('0x22')],function(_0x25743a){return{'model':db[_0x25743a[_0xc251('0x21')]],'as':_0x25743a['as'],'attributes':_0x25743a[_0xc251('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a6cba){logger['info'](_0xc251('0x1a'),_0x3bb036);logger[_0xc251('0x11')](_0xc251('0x1a'),_0x3bb036,JSON['stringify'](_0x5a6cba));_0x4c57f5(_0x5a6cba);})[_0xc251('0x19')](function(_0x571400){logger[_0xc251('0x14')](_0xc251('0x1a'),_0x571400[_0xc251('0x17')],_0x3bb036);_0x30607e(_0x188957['error'](0x1f4,_0x571400[_0xc251('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 71f68e9..429c165 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 1550761..544fcaf 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5e9af9,_0x1f42be){var _0x343a15=function(_0x5aac26){while(--_0x5aac26){_0x5e9af9['push'](_0x5e9af9['shift']());}};_0x343a15(++_0x1f42be);}(_0xedd9,0xfc));var _0x9edd=function(_0x518399,_0x1de68c){_0x518399=_0x518399-0x0;var _0x434626=_0xedd9[_0x518399];return _0x434626;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x41847b,_0x23a9e6){var _0x2cf93d=function(_0xce3da5){while(--_0xce3da5){_0x41847b['push'](_0x41847b['shift']());}};_0x2cf93d(++_0x23a9e6);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d961b,_0x472432){_0x5d961b=_0x5d961b-0x0;var _0x52e0b4=_0xedd9[_0x5d961b];return _0x52e0b4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7e4f2c1..ec9f382 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 _0xbffa=['INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x165e9a,_0x110fcc){var _0x3af7c6=function(_0x4f0c90){while(--_0x4f0c90){_0x165e9a['push'](_0x165e9a['shift']());}};_0x3af7c6(++_0x110fcc);}(_0xbffa,0x149));var _0xabff=function(_0x3bded8,_0x4cbb26){_0x3bded8=_0x3bded8-0x0;var _0x5e6421=_0xbffa[_0x3bded8];return _0x5e6421;};'use strict';var Sequelize=require(_0xabff('0x0'));module['exports']={'priority':{'type':Sequelize[_0xabff('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xabff('0x2')]()},'description':{'type':Sequelize[_0xabff('0x3')]},'interval':{'type':Sequelize[_0xabff('0x3')],'defaultValue':_0xabff('0x4')}}; \ No newline at end of file +var _0x7962=['INTEGER','STRING','sequelize'];(function(_0x506636,_0x37f92c){var _0x81b1c7=function(_0x265e7c){while(--_0x265e7c){_0x506636['push'](_0x506636['shift']());}};_0x81b1c7(++_0x37f92c);}(_0x7962,0x7a));var _0x2796=function(_0x183abb,_0x511fea){_0x183abb=_0x183abb-0x0;var _0x21e2bf=_0x7962[_0x183abb];return _0x21e2bf;};'use strict';var Sequelize=require(_0x2796('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2796('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2796('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2796('0x2')]},'interval':{'type':Sequelize[_0x2796('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f2b3eb2..b5c3b7c 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 _0x0284=['name','send','map','SmsApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','keys','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x18e49a,_0x5bf163){var _0x1397b5=function(_0x28dfb0){while(--_0x28dfb0){_0x18e49a['push'](_0x18e49a['shift']());}};_0x1397b5(++_0x5bf163);}(_0x0284,0x1a0));var _0x4028=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0284[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0x4028('0x0'));var rimraf=require(_0x4028('0x1'));var zipdir=require(_0x4028('0x2'));var jsonpatch=require(_0x4028('0x3'));var rp=require(_0x4028('0x4'));var moment=require(_0x4028('0x5'));var BPromise=require(_0x4028('0x6'));var Mustache=require(_0x4028('0x7'));var util=require(_0x4028('0x8'));var path=require(_0x4028('0x9'));var sox=require(_0x4028('0xa'));var csv=require(_0x4028('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4028('0xc'));var _=require(_0x4028('0xd'));var squel=require(_0x4028('0xe'));var crypto=require(_0x4028('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4028('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4028('0x11'));var Papa=require(_0x4028('0x12'));var Redis=require(_0x4028('0x13'));var authService=require(_0x4028('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4028('0x15'));var hardwareService=require(_0x4028('0x16'));var logger=require(_0x4028('0x17'))(_0x4028('0x18'));var utils=require(_0x4028('0x19'));var config=require(_0x4028('0x1a'));var licenseUtil=require(_0x4028('0x1b'));var db=require(_0x4028('0x1c'))['db'];function respondWithStatusCode(_0x304b56,_0x3eb48a){_0x3eb48a=_0x3eb48a||0xcc;return function(_0x5c09b4){if(_0x5c09b4){return _0x304b56[_0x4028('0x1d')](_0x3eb48a);}return _0x304b56[_0x4028('0x1e')](_0x3eb48a)[_0x4028('0x1f')]();};}function respondWithResult(_0x748568,_0x3d314c){_0x3d314c=_0x3d314c||0xc8;return function(_0x1a27dd){if(_0x1a27dd){return _0x748568[_0x4028('0x1e')](_0x3d314c)[_0x4028('0x20')](_0x1a27dd);}};}function respondWithFilteredResult(_0x2361dc,_0x496c88){return function(_0x5964b0){if(_0x5964b0){var _0x371c5e=typeof _0x496c88[_0x4028('0x21')]===_0x4028('0x22')&&typeof _0x496c88[_0x4028('0x23')]==='undefined';var _0x52f760=_0x5964b0[_0x4028('0x24')];var _0x432f8a=_0x371c5e?0x0:_0x496c88['offset'];var _0x2e93c7=_0x371c5e?_0x5964b0[_0x4028('0x24')]:_0x496c88['offset']+_0x496c88['limit'];var _0x205a5d;if(_0x2e93c7>=_0x52f760){_0x2e93c7=_0x52f760;_0x205a5d=0xc8;}else{_0x205a5d=0xce;}_0x2361dc['status'](_0x205a5d);return _0x2361dc[_0x4028('0x25')](_0x4028('0x26'),_0x432f8a+'-'+_0x2e93c7+'/'+_0x52f760)['json'](_0x5964b0);}return null;};}function patchUpdates(_0x3fdf88){return function(_0x5802d5){try{jsonpatch[_0x4028('0x27')](_0x5802d5,_0x3fdf88,!![]);}catch(_0x598c8e){return BPromise[_0x4028('0x28')](_0x598c8e);}return _0x5802d5[_0x4028('0x29')]();};}function saveUpdates(_0x22536c,_0x99f1e9){return function(_0x119d95){if(_0x119d95){return _0x119d95[_0x4028('0x2a')](_0x22536c)[_0x4028('0x2b')](function(_0x3e7d4e){return _0x3e7d4e;});}return null;};}function removeEntity(_0x23acb0,_0x2459d9){return function(_0x1296a4){if(_0x1296a4){return _0x1296a4[_0x4028('0x2c')]()[_0x4028('0x2b')](function(){_0x23acb0[_0x4028('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc8bd,_0x242f32){return function(_0x3b9613){if(!_0x3b9613){_0x2dc8bd[_0x4028('0x1d')](0x194);}return _0x3b9613;};}function handleError(_0x485821,_0x363b37){_0x363b37=_0x363b37||0x1f4;return function(_0x3ae08d){logger[_0x4028('0x2d')](_0x3ae08d['stack']);if(_0x3ae08d[_0x4028('0x2e')]){delete _0x3ae08d[_0x4028('0x2e')];}_0x485821['status'](_0x363b37)[_0x4028('0x2f')](_0x3ae08d);};}exports['index']=function(_0x29a0d3,_0x52447a){var _0x4c0824={},_0x33cfa7={},_0x3f9e00={'count':0x0,'rows':[]};var _0x302eb4=_[_0x4028('0x30')](db[_0x4028('0x31')][_0x4028('0x32')],function(_0x345cbb){return{'name':_0x345cbb[_0x4028('0x33')],'type':_0x345cbb[_0x4028('0x34')]['key']};});_0x33cfa7[_0x4028('0x35')]=_[_0x4028('0x30')](_0x302eb4,_0x4028('0x2e'));_0x33cfa7['query']=_['keys'](_0x29a0d3[_0x4028('0x36')]);_0x33cfa7[_0x4028('0x37')]=_[_0x4028('0x38')](_0x33cfa7['model'],_0x33cfa7[_0x4028('0x36')]);_0x4c0824[_0x4028('0x39')]=_[_0x4028('0x38')](_0x33cfa7[_0x4028('0x35')],qs[_0x4028('0x3a')](_0x29a0d3['query'][_0x4028('0x3a')]));_0x4c0824[_0x4028('0x39')]=_0x4c0824[_0x4028('0x39')][_0x4028('0x3b')]?_0x4c0824[_0x4028('0x39')]:_0x33cfa7[_0x4028('0x35')];if(!_0x29a0d3[_0x4028('0x36')]['hasOwnProperty']('nolimit')){_0x4c0824[_0x4028('0x23')]=qs[_0x4028('0x23')](_0x29a0d3[_0x4028('0x36')][_0x4028('0x23')]);_0x4c0824[_0x4028('0x21')]=qs['offset'](_0x29a0d3[_0x4028('0x36')][_0x4028('0x21')]);}_0x4c0824[_0x4028('0x3c')]=qs[_0x4028('0x3d')](_0x29a0d3['query']['sort']);_0x4c0824[_0x4028('0x3e')]=qs['filters'](_[_0x4028('0x3f')](_0x29a0d3[_0x4028('0x36')],_0x33cfa7[_0x4028('0x37')]),_0x302eb4);if(_0x29a0d3['query'][_0x4028('0x40')]){_0x4c0824[_0x4028('0x3e')]=_[_0x4028('0x41')](_0x4c0824[_0x4028('0x3e')],{'$or':_[_0x4028('0x30')](_0x302eb4,function(_0x524649){if(_0x524649[_0x4028('0x34')]!=='VIRTUAL'){var _0x4e4e7c={};_0x4e4e7c[_0x524649['name']]={'$like':'%'+_0x29a0d3[_0x4028('0x36')][_0x4028('0x40')]+'%'};return _0x4e4e7c;}})});}_0x4c0824=_[_0x4028('0x41')]({},_0x4c0824,_0x29a0d3['options']);var _0x196194={'where':_0x4c0824[_0x4028('0x3e')]};return db[_0x4028('0x31')]['count'](_0x196194)[_0x4028('0x2b')](function(_0x1d31d3){_0x3f9e00[_0x4028('0x24')]=_0x1d31d3;if(_0x29a0d3['query'][_0x4028('0x42')]){_0x4c0824[_0x4028('0x43')]=[{'all':!![]}];}return db[_0x4028('0x31')][_0x4028('0x44')](_0x4c0824);})['then'](function(_0x34c0ef){_0x3f9e00['rows']=_0x34c0ef;return _0x3f9e00;})[_0x4028('0x2b')](respondWithFilteredResult(_0x52447a,_0x4c0824))['catch'](handleError(_0x52447a,null));};exports[_0x4028('0x45')]=function(_0x2eb69b,_0x1c2f20){var _0x1ddb65={'raw':!![],'where':{'id':_0x2eb69b['params']['id']}},_0x119a5e={};_0x119a5e[_0x4028('0x35')]=_[_0x4028('0x46')](db[_0x4028('0x31')][_0x4028('0x32')]);_0x119a5e[_0x4028('0x36')]=_[_0x4028('0x46')](_0x2eb69b[_0x4028('0x36')]);_0x119a5e[_0x4028('0x37')]=_[_0x4028('0x38')](_0x119a5e[_0x4028('0x35')],_0x119a5e[_0x4028('0x36')]);_0x1ddb65[_0x4028('0x39')]=_[_0x4028('0x38')](_0x119a5e['model'],qs[_0x4028('0x3a')](_0x2eb69b[_0x4028('0x36')][_0x4028('0x3a')]));_0x1ddb65['attributes']=_0x1ddb65[_0x4028('0x39')]['length']?_0x1ddb65['attributes']:_0x119a5e['model'];if(_0x2eb69b[_0x4028('0x36')][_0x4028('0x42')]){_0x1ddb65[_0x4028('0x43')]=[{'all':!![]}];}_0x1ddb65=_[_0x4028('0x41')]({},_0x1ddb65,_0x2eb69b[_0x4028('0x47')]);return db[_0x4028('0x31')][_0x4028('0x48')](_0x1ddb65)[_0x4028('0x2b')](handleEntityNotFound(_0x1c2f20,null))['then'](respondWithResult(_0x1c2f20,null))[_0x4028('0x49')](handleError(_0x1c2f20,null));};exports[_0x4028('0x4a')]=function(_0x786b25,_0x12575e){return db[_0x4028('0x31')]['create'](_0x786b25[_0x4028('0x4b')],{})['then'](respondWithResult(_0x12575e,0xc9))[_0x4028('0x49')](handleError(_0x12575e,null));};exports[_0x4028('0x2a')]=function(_0x2cd1e0,_0x521246){if(_0x2cd1e0[_0x4028('0x4b')]['id']){delete _0x2cd1e0[_0x4028('0x4b')]['id'];}return db[_0x4028('0x31')][_0x4028('0x48')]({'where':{'id':_0x2cd1e0[_0x4028('0x4c')]['id']}})[_0x4028('0x2b')](handleEntityNotFound(_0x521246,null))[_0x4028('0x2b')](saveUpdates(_0x2cd1e0['body'],null))['then'](respondWithResult(_0x521246,null))[_0x4028('0x49')](handleError(_0x521246,null));};exports['destroy']=function(_0x352a30,_0xf53ff){return db[_0x4028('0x31')][_0x4028('0x48')]({'where':{'id':_0x352a30[_0x4028('0x4c')]['id']}})[_0x4028('0x2b')](handleEntityNotFound(_0xf53ff,null))[_0x4028('0x2b')](removeEntity(_0xf53ff,null))[_0x4028('0x49')](handleError(_0xf53ff,null));}; \ No newline at end of file +var _0x9a91=['update','then','stack','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save'];(function(_0x4c057f,_0x1ed571){var _0x154bbd=function(_0x390c4e){while(--_0x390c4e){_0x4c057f['push'](_0x4c057f['shift']());}};_0x154bbd(++_0x1ed571);}(_0x9a91,0x184));var _0x19a9=function(_0x173f7f,_0x40a968){_0x173f7f=_0x173f7f-0x0;var _0x16b0dc=_0x9a91[_0x173f7f];return _0x16b0dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19a9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19a9('0x1'));var rp=require('request-promise');var moment=require(_0x19a9('0x2'));var BPromise=require(_0x19a9('0x3'));var Mustache=require('mustache');var util=require(_0x19a9('0x4'));var path=require(_0x19a9('0x5'));var sox=require(_0x19a9('0x6'));var csv=require(_0x19a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19a9('0x8'));var _=require(_0x19a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x19a9('0xa'));var deskjs=require(_0x19a9('0xb'));var toCsv=require(_0x19a9('0x7'));var querystring=require(_0x19a9('0xc'));var Papa=require(_0x19a9('0xd'));var Redis=require(_0x19a9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x19a9('0xf'));var as=require(_0x19a9('0x10'));var hardwareService=require(_0x19a9('0x11'));var logger=require('../../config/logger')(_0x19a9('0x12'));var utils=require(_0x19a9('0x13'));var config=require(_0x19a9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x19a9('0x15'))['db'];function respondWithStatusCode(_0x4ba582,_0x7e59b){_0x7e59b=_0x7e59b||0xcc;return function(_0x516c7f){if(_0x516c7f){return _0x4ba582[_0x19a9('0x16')](_0x7e59b);}return _0x4ba582[_0x19a9('0x17')](_0x7e59b)['end']();};}function respondWithResult(_0x3720eb,_0x3c0718){_0x3c0718=_0x3c0718||0xc8;return function(_0x52aa4d){if(_0x52aa4d){return _0x3720eb[_0x19a9('0x17')](_0x3c0718)[_0x19a9('0x18')](_0x52aa4d);}};}function respondWithFilteredResult(_0x1fee0a,_0x3ea8c5){return function(_0x41e778){if(_0x41e778){var _0x1454c3=typeof _0x3ea8c5[_0x19a9('0x19')]===_0x19a9('0x1a')&&typeof _0x3ea8c5['limit']===_0x19a9('0x1a');var _0x199276=_0x41e778[_0x19a9('0x1b')];var _0x344029=_0x1454c3?0x0:_0x3ea8c5['offset'];var _0x46214a=_0x1454c3?_0x41e778[_0x19a9('0x1b')]:_0x3ea8c5[_0x19a9('0x19')]+_0x3ea8c5['limit'];var _0x155efd;if(_0x46214a>=_0x199276){_0x46214a=_0x199276;_0x155efd=0xc8;}else{_0x155efd=0xce;}_0x1fee0a[_0x19a9('0x17')](_0x155efd);return _0x1fee0a[_0x19a9('0x1c')](_0x19a9('0x1d'),_0x344029+'-'+_0x46214a+'/'+_0x199276)[_0x19a9('0x18')](_0x41e778);}return null;};}function patchUpdates(_0x1fe45f){return function(_0x21245d){try{jsonpatch['apply'](_0x21245d,_0x1fe45f,!![]);}catch(_0x17fa10){return BPromise[_0x19a9('0x1e')](_0x17fa10);}return _0x21245d[_0x19a9('0x1f')]();};}function saveUpdates(_0x1154b0,_0x926faa){return function(_0x1377e2){if(_0x1377e2){return _0x1377e2[_0x19a9('0x20')](_0x1154b0)['then'](function(_0x2ca540){return _0x2ca540;});}return null;};}function removeEntity(_0x4a766b,_0x4b8c18){return function(_0xf674a8){if(_0xf674a8){return _0xf674a8['destroy']()[_0x19a9('0x21')](function(){_0x4a766b[_0x19a9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x88901d,_0x27ea3e){return function(_0x3da539){if(!_0x3da539){_0x88901d[_0x19a9('0x16')](0x194);}return _0x3da539;};}function handleError(_0x1f1ed0,_0x470e22){_0x470e22=_0x470e22||0x1f4;return function(_0x35a307){logger['error'](_0x35a307[_0x19a9('0x22')]);if(_0x35a307['name']){delete _0x35a307['name'];}_0x1f1ed0['status'](_0x470e22)[_0x19a9('0x23')](_0x35a307);};}exports[_0x19a9('0x24')]=function(_0x2fbd97,_0x1beaac){var _0x2725e0={},_0x442c41={},_0x390bcf={'count':0x0,'rows':[]};var _0x18d754=_[_0x19a9('0x25')](db[_0x19a9('0x26')][_0x19a9('0x27')],function(_0x43dbcd){return{'name':_0x43dbcd[_0x19a9('0x28')],'type':_0x43dbcd[_0x19a9('0x29')][_0x19a9('0x2a')]};});_0x442c41[_0x19a9('0x2b')]=_['map'](_0x18d754,_0x19a9('0x2c'));_0x442c41[_0x19a9('0x2d')]=_[_0x19a9('0x2e')](_0x2fbd97['query']);_0x442c41[_0x19a9('0x2f')]=_[_0x19a9('0x30')](_0x442c41[_0x19a9('0x2b')],_0x442c41['query']);_0x2725e0[_0x19a9('0x31')]=_['intersection'](_0x442c41[_0x19a9('0x2b')],qs[_0x19a9('0x32')](_0x2fbd97[_0x19a9('0x2d')][_0x19a9('0x32')]));_0x2725e0['attributes']=_0x2725e0['attributes']['length']?_0x2725e0[_0x19a9('0x31')]:_0x442c41['model'];if(!_0x2fbd97['query'][_0x19a9('0x33')]('nolimit')){_0x2725e0[_0x19a9('0x34')]=qs[_0x19a9('0x34')](_0x2fbd97[_0x19a9('0x2d')][_0x19a9('0x34')]);_0x2725e0[_0x19a9('0x19')]=qs['offset'](_0x2fbd97[_0x19a9('0x2d')]['offset']);}_0x2725e0[_0x19a9('0x35')]=qs[_0x19a9('0x36')](_0x2fbd97[_0x19a9('0x2d')][_0x19a9('0x36')]);_0x2725e0[_0x19a9('0x37')]=qs[_0x19a9('0x2f')](_['pick'](_0x2fbd97[_0x19a9('0x2d')],_0x442c41['filters']),_0x18d754);if(_0x2fbd97[_0x19a9('0x2d')]['filter']){_0x2725e0['where']=_[_0x19a9('0x38')](_0x2725e0[_0x19a9('0x37')],{'$or':_[_0x19a9('0x25')](_0x18d754,function(_0x4bc25d){if(_0x4bc25d[_0x19a9('0x29')]!==_0x19a9('0x39')){var _0x4a2138={};_0x4a2138[_0x4bc25d[_0x19a9('0x2c')]]={'$like':'%'+_0x2fbd97['query']['filter']+'%'};return _0x4a2138;}})});}_0x2725e0=_['merge']({},_0x2725e0,_0x2fbd97['options']);var _0x274ec0={'where':_0x2725e0['where']};return db['SmsApplication'][_0x19a9('0x1b')](_0x274ec0)[_0x19a9('0x21')](function(_0x459a56){_0x390bcf[_0x19a9('0x1b')]=_0x459a56;if(_0x2fbd97[_0x19a9('0x2d')][_0x19a9('0x3a')]){_0x2725e0[_0x19a9('0x3b')]=[{'all':!![]}];}return db[_0x19a9('0x26')][_0x19a9('0x3c')](_0x2725e0);})[_0x19a9('0x21')](function(_0x24a106){_0x390bcf[_0x19a9('0x3d')]=_0x24a106;return _0x390bcf;})[_0x19a9('0x21')](respondWithFilteredResult(_0x1beaac,_0x2725e0))[_0x19a9('0x3e')](handleError(_0x1beaac,null));};exports[_0x19a9('0x3f')]=function(_0x5ccf90,_0x23b3d7){var _0x3f675d={'raw':!![],'where':{'id':_0x5ccf90[_0x19a9('0x40')]['id']}},_0x1a8f60={};_0x1a8f60[_0x19a9('0x2b')]=_[_0x19a9('0x2e')](db[_0x19a9('0x26')][_0x19a9('0x27')]);_0x1a8f60[_0x19a9('0x2d')]=_[_0x19a9('0x2e')](_0x5ccf90[_0x19a9('0x2d')]);_0x1a8f60[_0x19a9('0x2f')]=_[_0x19a9('0x30')](_0x1a8f60['model'],_0x1a8f60[_0x19a9('0x2d')]);_0x3f675d['attributes']=_[_0x19a9('0x30')](_0x1a8f60[_0x19a9('0x2b')],qs[_0x19a9('0x32')](_0x5ccf90['query']['fields']));_0x3f675d['attributes']=_0x3f675d[_0x19a9('0x31')]['length']?_0x3f675d[_0x19a9('0x31')]:_0x1a8f60[_0x19a9('0x2b')];if(_0x5ccf90[_0x19a9('0x2d')]['includeAll']){_0x3f675d[_0x19a9('0x3b')]=[{'all':!![]}];}_0x3f675d=_['merge']({},_0x3f675d,_0x5ccf90[_0x19a9('0x41')]);return db[_0x19a9('0x26')][_0x19a9('0x42')](_0x3f675d)[_0x19a9('0x21')](handleEntityNotFound(_0x23b3d7,null))[_0x19a9('0x21')](respondWithResult(_0x23b3d7,null))['catch'](handleError(_0x23b3d7,null));};exports[_0x19a9('0x43')]=function(_0x53d346,_0x53a90b){return db[_0x19a9('0x26')]['create'](_0x53d346[_0x19a9('0x44')],{})[_0x19a9('0x21')](respondWithResult(_0x53a90b,0xc9))[_0x19a9('0x3e')](handleError(_0x53a90b,null));};exports['update']=function(_0x123510,_0x244cbb){if(_0x123510[_0x19a9('0x44')]['id']){delete _0x123510['body']['id'];}return db[_0x19a9('0x26')]['find']({'where':{'id':_0x123510[_0x19a9('0x40')]['id']}})[_0x19a9('0x21')](handleEntityNotFound(_0x244cbb,null))[_0x19a9('0x21')](saveUpdates(_0x123510[_0x19a9('0x44')],null))[_0x19a9('0x21')](respondWithResult(_0x244cbb,null))['catch'](handleError(_0x244cbb,null));};exports[_0x19a9('0x45')]=function(_0x337eb4,_0x177348){return db['SmsApplication'][_0x19a9('0x42')]({'where':{'id':_0x337eb4['params']['id']}})['then'](handleEntityNotFound(_0x177348,null))[_0x19a9('0x21')](removeEntity(_0x177348,null))[_0x19a9('0x3e')](handleError(_0x177348,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1c46dc6..190f3ca 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 _0x0c96=['../../config/logger','api','moment','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4114e8,_0x57dc99){var _0x3500bb=function(_0x25dd9f){while(--_0x25dd9f){_0x4114e8['push'](_0x4114e8['shift']());}};_0x3500bb(++_0x57dc99);}(_0x0c96,0x177));var _0x60c9=function(_0x2f287e,_0x1566c1){_0x2f287e=_0x2f287e-0x0;var _0x1e65e9=_0x0c96[_0x2f287e];return _0x1e65e9;};'use strict';var _=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var logger=require(_0x60c9('0x2'))(_0x60c9('0x3'));var moment=require(_0x60c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c9('0x5'));var fs=require('fs');var path=require(_0x60c9('0x6'));var rimraf=require(_0x60c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x60c9('0x8'));module['exports']=function(_0x3c6667,_0x14d56e){return _0x3c6667[_0x60c9('0x9')](_0x60c9('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60c9('0xb'),'collate':_0x60c9('0xc')});}; \ No newline at end of file +var _0xf53f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x545c78,_0x3e73b8){var _0x4a5221=function(_0x5ae23d){while(--_0x5ae23d){_0x545c78['push'](_0x545c78['shift']());}};_0x4a5221(++_0x3e73b8);}(_0xf53f,0x8d));var _0xff53=function(_0x520bc2,_0x59362f){_0x520bc2=_0x520bc2-0x0;var _0x5eb5ab=_0xf53f[_0x520bc2];return _0x5eb5ab;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var moment=require(_0xff53('0x4'));var BPromise=require(_0xff53('0x5'));var rp=require(_0xff53('0x6'));var fs=require('fs');var path=require(_0xff53('0x7'));var rimraf=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var attributes=require(_0xff53('0xa'));module[_0xff53('0xb')]=function(_0x54d39c,_0x54e637){return _0x54d39c[_0xff53('0xc')]('SmsApplication',attributes,{'tableName':_0xff53('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff53('0xe'),'collate':_0xff53('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 76eefd7..8c3f6b1 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 _0xb4f8=['client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x415c90,_0x206a47){var _0x35e3ea=function(_0x2b1d30){while(--_0x2b1d30){_0x415c90['push'](_0x415c90['shift']());}};_0x35e3ea(++_0x206a47);}(_0xb4f8,0x83));var _0x8b4f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xb4f8[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var moment=require(_0x8b4f('0x1'));var BPromise=require(_0x8b4f('0x2'));var rs=require(_0x8b4f('0x3'));var fs=require('fs');var Redis=require(_0x8b4f('0x4'));var db=require(_0x8b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b4f('0x6'))('rpc');var config=require(_0x8b4f('0x7'));var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eefde,_0x557bc0,_0x2dfe1c){return new BPromise(function(_0xa91c09,_0x40042b){return client['request'](_0x2eefde,_0x2dfe1c)[_0x8b4f('0xb')](function(_0x13d37a){logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,_0x8b4f('0xe'));logger['debug'](_0x8b4f('0xf'),_0x557bc0,_0x8b4f('0xe'),JSON['stringify'](_0x13d37a));if(_0x13d37a[_0x8b4f('0x10')]){if(_0x13d37a[_0x8b4f('0x10')]['code']===0x1f4){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x13d37a['error'][_0x8b4f('0x11')]);return _0x40042b(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}logger[_0x8b4f('0x10')]('SmsApplication,\x20%s,\x20%s',_0x557bc0,_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);return _0xa91c09(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}else{logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,'request\x20sent');_0xa91c09(_0x13d37a[_0x8b4f('0x12')][_0x8b4f('0x11')]);}})[_0x8b4f('0x13')](function(_0x1b4b9f){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x1b4b9f);_0x40042b(_0x1b4b9f);});});} \ No newline at end of file +var _0x11c1=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash'];(function(_0x410726,_0x3dece9){var _0x4abd91=function(_0xe54c06){while(--_0xe54c06){_0x410726['push'](_0x410726['shift']());}};_0x4abd91(++_0x3dece9);}(_0x11c1,0x1cb));var _0x111c=function(_0x3d7fb3,_0x24eb74){_0x3d7fb3=_0x3d7fb3-0x0;var _0x3dbaa5=_0x11c1[_0x3d7fb3];return _0x3dbaa5;};'use strict';var _=require(_0x111c('0x0'));var util=require('util');var moment=require(_0x111c('0x1'));var BPromise=require(_0x111c('0x2'));var rs=require(_0x111c('0x3'));var fs=require('fs');var Redis=require(_0x111c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x111c('0x5'));var logger=require(_0x111c('0x6'))(_0x111c('0x7'));var config=require(_0x111c('0x8'));var jayson=require(_0x111c('0x9'));var client=jayson[_0x111c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd1221b,_0x223fb1,_0x696d06){return new BPromise(function(_0x30c58a,_0x8fc75f){return client[_0x111c('0xb')](_0xd1221b,_0x696d06)[_0x111c('0xc')](function(_0x14dc02){logger[_0x111c('0xd')](_0x111c('0xe'),_0x223fb1,_0x111c('0xf'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x223fb1,'request\x20sent',JSON['stringify'](_0x14dc02));if(_0x14dc02[_0x111c('0x10')]){if(_0x14dc02[_0x111c('0x10')][_0x111c('0x11')]===0x1f4){logger[_0x111c('0x10')](_0x111c('0xe'),_0x223fb1,_0x14dc02[_0x111c('0x10')][_0x111c('0x12')]);return _0x8fc75f(_0x14dc02[_0x111c('0x10')][_0x111c('0x12')]);}logger[_0x111c('0x10')](_0x111c('0xe'),_0x223fb1,_0x14dc02[_0x111c('0x10')][_0x111c('0x12')]);return _0x30c58a(_0x14dc02[_0x111c('0x10')][_0x111c('0x12')]);}else{logger[_0x111c('0xd')](_0x111c('0xe'),_0x223fb1,_0x111c('0xf'));_0x30c58a(_0x14dc02[_0x111c('0x13')]['message']);}})['catch'](function(_0x51ffc7){logger[_0x111c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x223fb1,_0x51ffc7);_0x8fc75f(_0x51ffc7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6b87143..ad2e8fb 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 _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x39acc3,_0xf36e44){var _0x8a77ef=function(_0x4366e6){while(--_0x4366e6){_0x39acc3['push'](_0x39acc3['shift']());}};_0x8a77ef(++_0xf36e44);}(_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('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file +var _0x8f4c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x18254d,_0x5a5ee5){var _0x1f487f=function(_0xd96731){while(--_0xd96731){_0x18254d['push'](_0x18254d['shift']());}};_0x1f487f(++_0x5a5ee5);}(_0x8f4c,0x113));var _0xc8f4=function(_0x47191a,_0x312948){_0x47191a=_0x47191a-0x0;var _0x140ef7=_0x8f4c[_0x47191a];return _0x140ef7;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./smsInteraction.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/download',auth[_0xc8f4('0xd')](),controller['download']);router[_0xc8f4('0x11')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x11')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),'smsinteraction:addtags'),controller[_0xc8f4('0x17')]);router[_0xc8f4('0x18')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')]('sms',_0xc8f4('0x19')),controller['update']);router['delete'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),interaction[_0xc8f4('0x15')](_0xc8f4('0x16'),_0xc8f4('0x1a')),controller[_0xc8f4('0x1b')]);router[_0xc8f4('0x1c')](_0xc8f4('0x14'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1d')]);module[_0xc8f4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c7c562f..a98f199 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 _0x0b7f=['STRING','DATE','ENUM','out','INTEGER','sequelize','moment','BOOLEAN'];(function(_0x550500,_0x8dd443){var _0x113660=function(_0x4d97d3){while(--_0x4d97d3){_0x550500['push'](_0x550500['shift']());}};_0x113660(++_0x8dd443);}(_0x0b7f,0x115));var _0xf0b7=function(_0x2e8860,_0x5de6db){_0x2e8860=_0x2e8860-0x0;var _0x449410=_0x0b7f[_0x2e8860];return _0x449410;};'use strict';var Sequelize=require(_0xf0b7('0x0'));var moment=require(_0xf0b7('0x1'));module['exports']={'closed':{'type':Sequelize[_0xf0b7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf0b7('0x3')]},'secondDisposition':{'type':Sequelize[_0xf0b7('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf0b7('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf0b7('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf0b7('0x5')]('in',_0xf0b7('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf0b7('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf0b7('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf0b7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf0b7('0x7')]}}; \ No newline at end of file +var _0x3266=['out','ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x336a01,_0x25ed3f){var _0x413e61=function(_0xa56d3e){while(--_0xa56d3e){_0x336a01['push'](_0x336a01['shift']());}};_0x413e61(++_0x25ed3f);}(_0x3266,0x6a));var _0x6326=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x3266[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x6326('0x0'));var moment=require(_0x6326('0x1'));module[_0x6326('0x2')]={'closed':{'type':Sequelize[_0x6326('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6326('0x4')]},'disposition':{'type':Sequelize[_0x6326('0x5')]},'secondDisposition':{'type':Sequelize[_0x6326('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6326('0x5')]},'note':{'type':Sequelize[_0x6326('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6326('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6326('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6326('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6326('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6326('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c2ab89e..7b179ff 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 _0x21a2=['value','renderFile','.pdf','Sms','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','stack','index','map','SmsInteraction','rawAttributes','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','include','merge','options','create','body','find','destroy','describe','addMessage','ids','omit','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','setTags','Tag','name','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','read','get','mkdirSync','Owner','closed','closedAt','disposition','direction','out','System','lastName'];(function(_0x174f7e,_0x501f15){var _0x3a09fa=function(_0x328d67){while(--_0x328d67){_0x174f7e['push'](_0x174f7e['shift']());}};_0x3a09fa(++_0x501f15);}(_0x21a2,0xf8));var _0x221a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x21a2[_0x465028];return _0xb783d4;};'use strict';var rimraf=require(_0x221a('0x0'));var zipdir=require(_0x221a('0x1'));var moment=require('moment');var BPromise=require(_0x221a('0x2'));var util=require(_0x221a('0x3'));var path=require(_0x221a('0x4'));var ejs=require(_0x221a('0x5'));var fs=require('fs');var _=require(_0x221a('0x6'));var Redis=require(_0x221a('0x7'));var interaction=require(_0x221a('0x8'));var qs=require(_0x221a('0x9'));var pdf=require(_0x221a('0xa'));var logger=require(_0x221a('0xb'))(_0x221a('0xc'));var config=require(_0x221a('0xd'));var db=require(_0x221a('0xe'))['db'];config[_0x221a('0xf')]=_[_0x221a('0x10')](config[_0x221a('0xf')],{'host':_0x221a('0x11'),'port':0x18eb});var socket=require(_0x221a('0x12'))(new Redis(config[_0x221a('0xf')]));require(_0x221a('0x13'))[_0x221a('0x14')](socket);function respondWithStatusCode(_0x5ef88a,_0x3dd8fe){_0x3dd8fe=_0x3dd8fe||0xcc;return function(_0x56963d){if(_0x56963d){return _0x5ef88a[_0x221a('0x15')](_0x3dd8fe);}return _0x5ef88a[_0x221a('0x16')](_0x3dd8fe)[_0x221a('0x17')]();};}function respondWithResult(_0x3b9ecb,_0x32de07){_0x32de07=_0x32de07||0xc8;return function(_0x41c9a0){if(_0x41c9a0){return _0x3b9ecb[_0x221a('0x16')](_0x32de07)['json'](_0x41c9a0);}};}function respondWithFilteredResult(_0x3cfabe,_0x366143){return function(_0x3ed5db){if(_0x3ed5db){var _0x2114f5=typeof _0x366143[_0x221a('0x18')]===_0x221a('0x19')&&typeof _0x366143[_0x221a('0x1a')]===_0x221a('0x19');var _0x455222=_0x3ed5db[_0x221a('0x1b')];var _0x402033=_0x2114f5?0x0:_0x366143[_0x221a('0x18')];var _0x584c22=_0x2114f5?_0x3ed5db[_0x221a('0x1b')]:_0x366143[_0x221a('0x18')]+_0x366143[_0x221a('0x1a')];var _0x4f36d5;if(_0x584c22>=_0x455222){_0x584c22=_0x455222;_0x4f36d5=0xc8;}else{_0x4f36d5=0xce;}_0x3cfabe['status'](_0x4f36d5);return _0x3cfabe[_0x221a('0x1c')](_0x221a('0x1d'),_0x402033+'-'+_0x584c22+'/'+_0x455222)[_0x221a('0x1e')](_0x3ed5db);}return null;};}function saveUpdates(_0x46aa5e){return function(_0x2f0292){if(_0x2f0292){return _0x2f0292[_0x221a('0x1f')](_0x46aa5e)['then'](function(_0x3842c8){return _0x3842c8;});}return null;};}function removeEntity(_0x597d2b){return function(_0xe15a42){if(_0xe15a42){return _0xe15a42['destroy']()[_0x221a('0x20')](function(){_0x597d2b[_0x221a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401577){return function(_0x43d9d8){if(!_0x43d9d8){_0x401577[_0x221a('0x15')](0x194);}return _0x43d9d8;};}function handleError(_0x61615b,_0x3e2aa9){_0x3e2aa9=_0x3e2aa9||0x1f4;return function(_0xaeb353){logger['error'](_0xaeb353[_0x221a('0x21')]);if(_0xaeb353['name']){delete _0xaeb353['name'];}_0x61615b[_0x221a('0x16')](_0x3e2aa9)['send'](_0xaeb353);};}exports[_0x221a('0x22')]=function(_0x188a6d,_0x316518){var _0x14acdb={};var _0x9756ab=_[_0x221a('0x23')](db[_0x221a('0x24')][_0x221a('0x25')],function(_0x54e946){return{'name':_0x54e946['fieldName'],'type':_0x54e946[_0x221a('0x26')][_0x221a('0x27')]};});_0x14acdb=qs[_0x221a('0x28')](_0x9756ab,_0x188a6d);return interaction[_0x221a('0x29')](_0x221a('0x2a'),_0x188a6d[_0x221a('0x2b')],_0x188a6d[_0x221a('0x2c')],_0x14acdb,_0x9756ab)['then'](respondWithFilteredResult(_0x316518,_0x14acdb))[_0x221a('0x2d')](handleError(_0x316518,null));};exports[_0x221a('0x2e')]=function(_0x17d5cf,_0x2835b5){var _0x1ce18a={'raw':![],'where':{'id':_0x17d5cf[_0x221a('0x2f')]['id']}},_0x10606c={};_0x10606c[_0x221a('0x30')]=_[_0x221a('0x31')](db[_0x221a('0x24')][_0x221a('0x25')]);_0x10606c[_0x221a('0x2b')]=_['keys'](_0x17d5cf[_0x221a('0x2b')]);_0x10606c[_0x221a('0x32')]=_[_0x221a('0x33')](_0x10606c[_0x221a('0x30')],_0x10606c[_0x221a('0x2b')]);_0x1ce18a[_0x221a('0x34')]=_['intersection'](_0x10606c[_0x221a('0x30')],qs[_0x221a('0x35')](_0x17d5cf[_0x221a('0x2b')][_0x221a('0x35')]));_0x1ce18a[_0x221a('0x34')]=_0x1ce18a[_0x221a('0x34')]['length']?_0x1ce18a[_0x221a('0x34')]:_0x10606c[_0x221a('0x30')];if(_0x17d5cf[_0x221a('0x2b')]['includeAll']){_0x1ce18a[_0x221a('0x36')]=[{'all':!![]}];}_0x1ce18a=_[_0x221a('0x37')]({},_0x1ce18a,_0x17d5cf[_0x221a('0x38')]);return db['SmsInteraction']['find'](_0x1ce18a)[_0x221a('0x20')](handleEntityNotFound(_0x2835b5,null))[_0x221a('0x20')](respondWithResult(_0x2835b5,null))[_0x221a('0x2d')](handleError(_0x2835b5,null));};exports['create']=function(_0x5f2a09,_0x41f3c0){return db[_0x221a('0x24')][_0x221a('0x39')](_0x5f2a09[_0x221a('0x3a')],{})[_0x221a('0x20')](respondWithResult(_0x41f3c0,0xc9))[_0x221a('0x2d')](handleError(_0x41f3c0,null));};exports[_0x221a('0x1f')]=function(_0x228962,_0x24130b){if(_0x228962[_0x221a('0x3a')]['id']){delete _0x228962[_0x221a('0x3a')]['id'];}return db[_0x221a('0x24')][_0x221a('0x3b')]({'where':{'id':_0x228962['params']['id']}})['then'](handleEntityNotFound(_0x24130b,null))['then'](saveUpdates(_0x228962[_0x221a('0x3a')],null))['then'](respondWithResult(_0x24130b,null))[_0x221a('0x2d')](handleError(_0x24130b,null));};exports[_0x221a('0x3c')]=function(_0x58c221,_0x159b99){return db[_0x221a('0x24')][_0x221a('0x3b')]({'where':{'id':_0x58c221[_0x221a('0x2f')]['id']}})[_0x221a('0x20')](handleEntityNotFound(_0x159b99,null))[_0x221a('0x20')](removeEntity(_0x159b99,null))[_0x221a('0x2d')](handleError(_0x159b99,null));};exports[_0x221a('0x3d')]=function(_0x366c3a,_0x372779){return db[_0x221a('0x24')][_0x221a('0x3d')]()[_0x221a('0x20')](respondWithResult(_0x372779,null))[_0x221a('0x2d')](handleError(_0x372779,null));};exports[_0x221a('0x3e')]=function(_0x4e6bb5,_0x20e93d){return db['SmsMessage'][_0x221a('0x3b')]({'where':{'id':_0x4e6bb5[_0x221a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x20e93d,null))['then'](function(_0x374f24){if(_0x374f24){return _0x374f24[_0x221a('0x3e')](_0x4e6bb5[_0x221a('0x3a')][_0x221a('0x3f')],_[_0x221a('0x40')](_0x4e6bb5[_0x221a('0x3a')],[_0x221a('0x3f'),'id'])||{});}})[_0x221a('0x20')](respondWithResult(_0x20e93d,null))[_0x221a('0x2d')](handleError(_0x20e93d,null));};exports['getMessages']=function(_0x17e36d,_0x39fc63){var _0x458a7d={'raw':![],'where':{}};var _0x548d48={};var _0x4dafaa={'count':0x0,'rows':[]};return db[_0x221a('0x24')][_0x221a('0x41')]({'where':{'id':_0x17e36d[_0x221a('0x2f')]['id']}})[_0x221a('0x20')](handleEntityNotFound(_0x39fc63,null))[_0x221a('0x20')](function(_0x47d76e){if(_0x47d76e){_0x548d48[_0x221a('0x30')]=_[_0x221a('0x31')](db[_0x221a('0x42')][_0x221a('0x25')]);_0x548d48['query']=_[_0x221a('0x31')](_0x17e36d['query']);_0x548d48['filters']=_[_0x221a('0x33')](_0x548d48[_0x221a('0x30')],_0x548d48[_0x221a('0x2b')]);_0x458a7d['attributes']=_['intersection'](_0x548d48[_0x221a('0x30')],qs['fields'](_0x17e36d[_0x221a('0x2b')][_0x221a('0x35')]));_0x458a7d[_0x221a('0x34')]=_0x458a7d[_0x221a('0x34')]['length']?_0x458a7d[_0x221a('0x34')]:_0x548d48[_0x221a('0x30')];if(!_0x17e36d['query'][_0x221a('0x43')](_0x221a('0x44'))){_0x458a7d[_0x221a('0x1a')]=qs[_0x221a('0x1a')](_0x17e36d['query'][_0x221a('0x1a')]);_0x458a7d[_0x221a('0x18')]=qs[_0x221a('0x18')](_0x17e36d['query'][_0x221a('0x18')]);}_0x458a7d[_0x221a('0x45')]=qs['sort'](_0x17e36d[_0x221a('0x2b')][_0x221a('0x46')]);_0x458a7d[_0x221a('0x47')]=qs[_0x221a('0x32')](_[_0x221a('0x48')](_0x17e36d['query'],_0x548d48[_0x221a('0x32')]));_0x458a7d['where']['SmsInteractionId']=_0x47d76e['id'];if(_0x17e36d['query']['filter']){_0x458a7d[_0x221a('0x47')]=_['merge'](_0x458a7d[_0x221a('0x47')],{'$or':_[_0x221a('0x23')](_0x458a7d[_0x221a('0x34')],function(_0xed45c1){var _0x151048={};_0x151048[_0xed45c1]={'$like':'%'+_0x17e36d[_0x221a('0x2b')][_0x221a('0x49')]+'%'};return _0x151048;})});}if(_0x17e36d['query'][_0x221a('0x4a')]){var _0x1a5301=_0x17e36d[_0x221a('0x2b')]['$gte'][_0x221a('0x4b')](',');var _0x23d860={};_0x23d860[_0x1a5301[0x0]]={'$gte':moment(_0x1a5301[0x1])[_0x221a('0x4c')](_0x221a('0x4d'))};_0x458a7d['where']=_[_0x221a('0x37')](_0x458a7d[_0x221a('0x47')],_0x23d860);}_0x458a7d=_[_0x221a('0x37')]({},_0x458a7d,_0x17e36d[_0x221a('0x38')]);return db[_0x221a('0x42')]['count']({'where':_0x458a7d[_0x221a('0x47')]})['then'](function(_0x48fc26){_0x4dafaa[_0x221a('0x1b')]=_0x48fc26;if(_0x17e36d['query'][_0x221a('0x4e')]){_0x458a7d[_0x221a('0x36')]=[{'all':!![]}];}return db['SmsMessage'][_0x221a('0x29')](_0x458a7d);})['then'](function(_0x4cc1c0){_0x4dafaa['rows']=_0x4cc1c0;return _0x4dafaa;});}})[_0x221a('0x20')](respondWithFilteredResult(_0x39fc63,_0x458a7d))[_0x221a('0x2d')](handleError(_0x39fc63,null));};exports['addTags']=function(_0x4a2652,_0x819cc6){return db[_0x221a('0x24')][_0x221a('0x3b')]({'where':{'id':_0x4a2652['params']['id']}})['then'](handleEntityNotFound(_0x819cc6,null))[_0x221a('0x20')](function(_0x961502){if(_0x961502){return _0x961502[_0x221a('0x4f')](_0x4a2652[_0x221a('0x3a')][_0x221a('0x3f')],_[_0x221a('0x40')](_0x4a2652[_0x221a('0x3a')],['ids','id'])||{})['spread'](function(){return db[_0x221a('0x50')][_0x221a('0x29')]({'attributes':['id',_0x221a('0x51'),_0x221a('0x52')],'where':{'id':_0x4a2652['body'][_0x221a('0x3f')]}});})[_0x221a('0x20')](function(_0x4951b7){socket[_0x221a('0x53')](_0x221a('0x54'),{'id':Number(_0x4a2652['params']['id']),'tags':_0x4951b7||[]});return{'id':Number(_0x4a2652[_0x221a('0x2f')]['id']),'tags':_0x4951b7||[]};});}})[_0x221a('0x20')](respondWithResult(_0x819cc6,null))[_0x221a('0x2d')](handleError(_0x819cc6,null));};exports['removeTags']=function(_0x786ff0,_0x2bf671){return db[_0x221a('0x24')]['find']({'where':{'id':_0x786ff0[_0x221a('0x2f')]['id']}})[_0x221a('0x20')](handleEntityNotFound(_0x2bf671,null))['then'](function(_0xec673e){if(_0xec673e){return _0xec673e[_0x221a('0x55')](_0x786ff0[_0x221a('0x2b')][_0x221a('0x3f')]);}})[_0x221a('0x20')](respondWithStatusCode(_0x2bf671,null))[_0x221a('0x2d')](handleError(_0x2bf671,null));};exports['download']=function(_0x3bd329,_0x4d918e){var _0x360669=moment()[_0x221a('0x56')]()[_0x221a('0x57')]();var _0x3b17a5=path[_0x221a('0x58')](config[_0x221a('0x59')],_0x221a('0x5a'),_0x221a('0x5b'),'tmp');var _0x4a05a6=path[_0x221a('0x58')](_0x3b17a5,_0x360669);var _0x11da85=util[_0x221a('0x4c')](_0x221a('0x5c'),_0x3bd329['params']['id'],_0x360669);var _0x2138fc=path[_0x221a('0x58')](_0x3b17a5,_0x11da85);var _0x3ab337=[];_0x3ab337['push']({'model':db[_0x221a('0x5d')],'as':_0x221a('0x5d'),'attributes':['id',_0x221a('0x5e')],'raw':!![]});_0x3ab337[_0x221a('0x5f')]({'model':db[_0x221a('0x60')],'as':_0x221a('0x61'),'attributes':['id',_0x221a('0x62'),'lastName'],'raw':!![]});var _0x4fb84b=[{'model':db[_0x221a('0x42')],'as':_0x221a('0x63'),'attributes':['id',_0x221a('0x3a'),_0x221a('0x64'),'direction','secret',_0x221a('0x65')],'include':_0x3ab337}];_0x4fb84b[_0x221a('0x5f')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x221a('0x51')]});_0x4fb84b[_0x221a('0x5f')]({'model':db[_0x221a('0x5d')],'as':'Owner','attributes':['id','fullname']});return db[_0x221a('0x24')]['find']({'where':{'id':_0x3bd329[_0x221a('0x2f')]['id']},'include':_0x4fb84b})['then'](handleEntityNotFound(_0x4d918e,null))[_0x221a('0x20')](function(_0x4ef34e){if(_0x4ef34e){var _0x4fd0f8=_0x4ef34e[_0x221a('0x66')]({'plain':!![]});fs[_0x221a('0x67')](_0x4a05a6);var _0x4c6cf2={'channel':'Sms','account':_0x4fd0f8['Account'][_0x221a('0x51')],'agent':_0x4fd0f8[_0x221a('0x68')]?_0x4fd0f8[_0x221a('0x68')][_0x221a('0x5e')]:'N.A.','createdAt':moment(_0x4fd0f8[_0x221a('0x64')])[_0x221a('0x4c')](_0x221a('0x4d'))[_0x221a('0x57')](),'closedAt':_0x4fd0f8[_0x221a('0x69')]?moment(_0x4fd0f8[_0x221a('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x221a('0x57')]():'','disposition':_0x4fd0f8[_0x221a('0x6b')],'messages':_(_0x4fd0f8[_0x221a('0x63')])[_0x221a('0x49')]({'secret':![]})['map'](function(_0x23a321){return{'date':moment(_0x23a321['createdAt'])['format'](_0x221a('0x4d'))[_0x221a('0x57')](),'sender':_0x23a321[_0x221a('0x6c')]===_0x221a('0x6d')?_0x23a321['User']?_0x23a321['User']['fullname']:_0x221a('0x6e'):_0x23a321[_0x221a('0x61')]['firstName']+(_0x23a321[_0x221a('0x61')][_0x221a('0x6f')]?'\x20'+_0x23a321[_0x221a('0x61')]['lastName']:''),'body':_0x23a321[_0x221a('0x3a')],'direction':_0x23a321[_0x221a('0x6c')]===_0x221a('0x6d')?'A':'C','secret':_0x23a321['secret'],'read':_0x23a321[_0x221a('0x65')]};})[_0x221a('0x70')]()};return ejs[_0x221a('0x71')](path[_0x221a('0x58')](config[_0x221a('0x59')],_0x221a('0x5a'),'views','downloadInteraction.ejs'),{'interaction':_0x4c6cf2})[_0x221a('0x20')](function(_0xb83d82){var _0xf9fb33=path['join'](_0x4a05a6,'transcript-'+_0x4fd0f8['id']+'-'+_0x360669+_0x221a('0x72'));var _0x55743c={'path':_0xf9fb33,'channel':_0x221a('0x73'),'interactionId':_0x4fd0f8['id']};return pdf[_0x221a('0x74')](_0xb83d82,_0x55743c);})['then'](function(){return new BPromise(function(_0x33762e,_0x575a57){zipdir(_0x4a05a6,{'saveTo':_0x2138fc},function(_0xdee55a,_0x496e03){if(_0xdee55a)return _0x575a57(_0xdee55a);return _0x33762e(_0x496e03);});})['then'](function(){return new BPromise(function(_0x5986aa,_0x3eafbb){rimraf(_0x4a05a6,function(_0x34e852){if(_0x34e852)_0x3eafbb(_0x34e852);return _0x5986aa();});});})[_0x221a('0x20')](function(){return _0x4d918e[_0x221a('0x75')](_0x2138fc,_0x11da85,function(_0x168549){if(_0x168549){console[_0x221a('0x76')]('err',_0x168549);}else{fs[_0x221a('0x77')](_0x2138fc);}});});});}else{return _0x4d918e[_0x221a('0x15')](0xc8);}})[_0x221a('0x2d')](handleError(_0x4d918e,null));}; \ No newline at end of file +var _0xc4d3=['omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','direction','secret','read','SmsAccount','Account','Owner','Sms','N.A.','createdAt','closed','disposition','Messages','map','System','value','renderFile','views','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','index','rawAttributes','fieldName','type','findAll','sms','query','user','keys','SmsInteraction','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','body','catch','params','destroy','describe','addMessage','SmsMessage'];(function(_0x584991,_0x20c113){var _0x372087=function(_0x13dabe){while(--_0x13dabe){_0x584991['push'](_0x584991['shift']());}};_0x372087(++_0x20c113);}(_0xc4d3,0x1b3));var _0x3c4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4d3[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x3c4d('0x0'));var zipdir=require(_0x3c4d('0x1'));var moment=require(_0x3c4d('0x2'));var BPromise=require(_0x3c4d('0x3'));var util=require('util');var path=require(_0x3c4d('0x4'));var ejs=require(_0x3c4d('0x5'));var fs=require('fs');var _=require(_0x3c4d('0x6'));var Redis=require('ioredis');var interaction=require(_0x3c4d('0x7'));var qs=require(_0x3c4d('0x8'));var pdf=require(_0x3c4d('0x9'));var logger=require(_0x3c4d('0xa'))(_0x3c4d('0xb'));var config=require(_0x3c4d('0xc'));var db=require(_0x3c4d('0xd'))['db'];config[_0x3c4d('0xe')]=_['defaults'](config[_0x3c4d('0xe')],{'host':_0x3c4d('0xf'),'port':0x18eb});var socket=require(_0x3c4d('0x10'))(new Redis(config[_0x3c4d('0xe')]));require(_0x3c4d('0x11'))[_0x3c4d('0x12')](socket);function respondWithStatusCode(_0x1fdcee,_0x45e750){_0x45e750=_0x45e750||0xcc;return function(_0x1e0c9d){if(_0x1e0c9d){return _0x1fdcee[_0x3c4d('0x13')](_0x45e750);}return _0x1fdcee[_0x3c4d('0x14')](_0x45e750)[_0x3c4d('0x15')]();};}function respondWithResult(_0x4308f0,_0x3b8148){_0x3b8148=_0x3b8148||0xc8;return function(_0x29ea91){if(_0x29ea91){return _0x4308f0[_0x3c4d('0x14')](_0x3b8148)[_0x3c4d('0x16')](_0x29ea91);}};}function respondWithFilteredResult(_0x367132,_0x51095f){return function(_0x1fa7b6){if(_0x1fa7b6){var _0x6c894b=typeof _0x51095f[_0x3c4d('0x17')]==='undefined'&&typeof _0x51095f['limit']===_0x3c4d('0x18');var _0x21ecee=_0x1fa7b6['count'];var _0x41cae1=_0x6c894b?0x0:_0x51095f['offset'];var _0x433d25=_0x6c894b?_0x1fa7b6[_0x3c4d('0x19')]:_0x51095f[_0x3c4d('0x17')]+_0x51095f[_0x3c4d('0x1a')];var _0x55dc0f;if(_0x433d25>=_0x21ecee){_0x433d25=_0x21ecee;_0x55dc0f=0xc8;}else{_0x55dc0f=0xce;}_0x367132[_0x3c4d('0x14')](_0x55dc0f);return _0x367132[_0x3c4d('0x1b')](_0x3c4d('0x1c'),_0x41cae1+'-'+_0x433d25+'/'+_0x21ecee)['json'](_0x1fa7b6);}return null;};}function saveUpdates(_0x1a3c64){return function(_0x2917a6){if(_0x2917a6){return _0x2917a6[_0x3c4d('0x1d')](_0x1a3c64)[_0x3c4d('0x1e')](function(_0x83050b){return _0x83050b;});}return null;};}function removeEntity(_0x5dde0a){return function(_0x5e3979){if(_0x5e3979){return _0x5e3979['destroy']()['then'](function(){_0x5dde0a[_0x3c4d('0x14')](0xcc)[_0x3c4d('0x15')]();});}};}function handleEntityNotFound(_0x4a0eef){return function(_0x226c2a){if(!_0x226c2a){_0x4a0eef['sendStatus'](0x194);}return _0x226c2a;};}function handleError(_0x346491,_0xb4d4b4){_0xb4d4b4=_0xb4d4b4||0x1f4;return function(_0x3f360c){logger[_0x3c4d('0x1f')](_0x3f360c[_0x3c4d('0x20')]);if(_0x3f360c[_0x3c4d('0x21')]){delete _0x3f360c[_0x3c4d('0x21')];}_0x346491[_0x3c4d('0x14')](_0xb4d4b4)['send'](_0x3f360c);};}exports[_0x3c4d('0x22')]=function(_0x1bb705,_0xbfc7b5){var _0x4267b3={};var _0x195cf8=_['map'](db['SmsInteraction'][_0x3c4d('0x23')],function(_0x11dc1c){return{'name':_0x11dc1c[_0x3c4d('0x24')],'type':_0x11dc1c[_0x3c4d('0x25')]['key']};});_0x4267b3=qs['getOptions'](_0x195cf8,_0x1bb705);return interaction[_0x3c4d('0x26')](_0x3c4d('0x27'),_0x1bb705[_0x3c4d('0x28')],_0x1bb705[_0x3c4d('0x29')],_0x4267b3,_0x195cf8)[_0x3c4d('0x1e')](respondWithFilteredResult(_0xbfc7b5,_0x4267b3))['catch'](handleError(_0xbfc7b5,null));};exports['show']=function(_0x3f75ce,_0x563494){var _0x1b659f={'raw':![],'where':{'id':_0x3f75ce['params']['id']}},_0x485173={};_0x485173['model']=_[_0x3c4d('0x2a')](db[_0x3c4d('0x2b')]['rawAttributes']);_0x485173[_0x3c4d('0x28')]=_[_0x3c4d('0x2a')](_0x3f75ce[_0x3c4d('0x28')]);_0x485173['filters']=_[_0x3c4d('0x2c')](_0x485173[_0x3c4d('0x2d')],_0x485173[_0x3c4d('0x28')]);_0x1b659f[_0x3c4d('0x2e')]=_[_0x3c4d('0x2c')](_0x485173['model'],qs['fields'](_0x3f75ce[_0x3c4d('0x28')][_0x3c4d('0x2f')]));_0x1b659f['attributes']=_0x1b659f['attributes'][_0x3c4d('0x30')]?_0x1b659f[_0x3c4d('0x2e')]:_0x485173[_0x3c4d('0x2d')];if(_0x3f75ce[_0x3c4d('0x28')][_0x3c4d('0x31')]){_0x1b659f[_0x3c4d('0x32')]=[{'all':!![]}];}_0x1b659f=_[_0x3c4d('0x33')]({},_0x1b659f,_0x3f75ce['options']);return db[_0x3c4d('0x2b')][_0x3c4d('0x34')](_0x1b659f)[_0x3c4d('0x1e')](handleEntityNotFound(_0x563494,null))[_0x3c4d('0x1e')](respondWithResult(_0x563494,null))['catch'](handleError(_0x563494,null));};exports[_0x3c4d('0x35')]=function(_0x491bc4,_0x332a3e){return db[_0x3c4d('0x2b')][_0x3c4d('0x35')](_0x491bc4[_0x3c4d('0x36')],{})[_0x3c4d('0x1e')](respondWithResult(_0x332a3e,0xc9))[_0x3c4d('0x37')](handleError(_0x332a3e,null));};exports[_0x3c4d('0x1d')]=function(_0x1c6a90,_0x30fa8e){if(_0x1c6a90['body']['id']){delete _0x1c6a90['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x1c6a90[_0x3c4d('0x38')]['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0x30fa8e,null))[_0x3c4d('0x1e')](saveUpdates(_0x1c6a90['body'],null))['then'](respondWithResult(_0x30fa8e,null))['catch'](handleError(_0x30fa8e,null));};exports[_0x3c4d('0x39')]=function(_0x2d8b3,_0x337a15){return db['SmsInteraction'][_0x3c4d('0x34')]({'where':{'id':_0x2d8b3['params']['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0x337a15,null))[_0x3c4d('0x1e')](removeEntity(_0x337a15,null))[_0x3c4d('0x37')](handleError(_0x337a15,null));};exports[_0x3c4d('0x3a')]=function(_0xe236c2,_0x1f83aa){return db[_0x3c4d('0x2b')][_0x3c4d('0x3a')]()['then'](respondWithResult(_0x1f83aa,null))[_0x3c4d('0x37')](handleError(_0x1f83aa,null));};exports[_0x3c4d('0x3b')]=function(_0x24c187,_0xc839a6){return db[_0x3c4d('0x3c')]['find']({'where':{'id':_0x24c187['params']['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0xc839a6,null))[_0x3c4d('0x1e')](function(_0x2f1eae){if(_0x2f1eae){return _0x2f1eae['addMessage'](_0x24c187[_0x3c4d('0x36')]['ids'],_[_0x3c4d('0x3d')](_0x24c187[_0x3c4d('0x36')],[_0x3c4d('0x3e'),'id'])||{});}})[_0x3c4d('0x1e')](respondWithResult(_0xc839a6,null))['catch'](handleError(_0xc839a6,null));};exports[_0x3c4d('0x3f')]=function(_0x16afa0,_0x533325){var _0x2556b1={'raw':![],'where':{}};var _0x27f8da={};var _0x2cc14b={'count':0x0,'rows':[]};return db[_0x3c4d('0x2b')][_0x3c4d('0x40')]({'where':{'id':_0x16afa0[_0x3c4d('0x38')]['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0x533325,null))[_0x3c4d('0x1e')](function(_0x2c1176){if(_0x2c1176){_0x27f8da['model']=_['keys'](db['SmsMessage'][_0x3c4d('0x23')]);_0x27f8da['query']=_[_0x3c4d('0x2a')](_0x16afa0['query']);_0x27f8da['filters']=_['intersection'](_0x27f8da[_0x3c4d('0x2d')],_0x27f8da[_0x3c4d('0x28')]);_0x2556b1[_0x3c4d('0x2e')]=_['intersection'](_0x27f8da[_0x3c4d('0x2d')],qs['fields'](_0x16afa0['query']['fields']));_0x2556b1[_0x3c4d('0x2e')]=_0x2556b1['attributes']['length']?_0x2556b1['attributes']:_0x27f8da[_0x3c4d('0x2d')];if(!_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x41')](_0x3c4d('0x42'))){_0x2556b1[_0x3c4d('0x1a')]=qs[_0x3c4d('0x1a')](_0x16afa0[_0x3c4d('0x28')]['limit']);_0x2556b1[_0x3c4d('0x17')]=qs[_0x3c4d('0x17')](_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x17')]);}_0x2556b1[_0x3c4d('0x43')]=qs[_0x3c4d('0x44')](_0x16afa0['query'][_0x3c4d('0x44')]);_0x2556b1[_0x3c4d('0x45')]=qs[_0x3c4d('0x46')](_[_0x3c4d('0x47')](_0x16afa0['query'],_0x27f8da[_0x3c4d('0x46')]));_0x2556b1[_0x3c4d('0x45')][_0x3c4d('0x48')]=_0x2c1176['id'];if(_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x49')]){_0x2556b1['where']=_[_0x3c4d('0x33')](_0x2556b1[_0x3c4d('0x45')],{'$or':_['map'](_0x2556b1[_0x3c4d('0x2e')],function(_0x279a3b){var _0x124752={};_0x124752[_0x279a3b]={'$like':'%'+_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x49')]+'%'};return _0x124752;})});}if(_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x4a')]){var _0x34607c=_0x16afa0['query'][_0x3c4d('0x4a')][_0x3c4d('0x4b')](',');var _0x331526={};_0x331526[_0x34607c[0x0]]={'$gte':moment(_0x34607c[0x1])[_0x3c4d('0x4c')](_0x3c4d('0x4d'))};_0x2556b1['where']=_[_0x3c4d('0x33')](_0x2556b1[_0x3c4d('0x45')],_0x331526);}_0x2556b1=_[_0x3c4d('0x33')]({},_0x2556b1,_0x16afa0[_0x3c4d('0x4e')]);return db[_0x3c4d('0x3c')][_0x3c4d('0x19')]({'where':_0x2556b1['where']})['then'](function(_0x155d4a){_0x2cc14b[_0x3c4d('0x19')]=_0x155d4a;if(_0x16afa0[_0x3c4d('0x28')][_0x3c4d('0x31')]){_0x2556b1[_0x3c4d('0x32')]=[{'all':!![]}];}return db[_0x3c4d('0x3c')]['findAll'](_0x2556b1);})[_0x3c4d('0x1e')](function(_0x3ced36){_0x2cc14b[_0x3c4d('0x4f')]=_0x3ced36;return _0x2cc14b;});}})[_0x3c4d('0x1e')](respondWithFilteredResult(_0x533325,_0x2556b1))['catch'](handleError(_0x533325,null));};exports[_0x3c4d('0x50')]=function(_0x55d1d8,_0x489672){return db[_0x3c4d('0x2b')][_0x3c4d('0x34')]({'where':{'id':_0x55d1d8['params']['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0x489672,null))[_0x3c4d('0x1e')](function(_0x1c4335){if(_0x1c4335){return _0x1c4335[_0x3c4d('0x51')](_0x55d1d8[_0x3c4d('0x36')][_0x3c4d('0x3e')],_[_0x3c4d('0x3d')](_0x55d1d8['body'],['ids','id'])||{})[_0x3c4d('0x52')](function(){return db[_0x3c4d('0x53')][_0x3c4d('0x26')]({'attributes':['id',_0x3c4d('0x21'),_0x3c4d('0x54')],'where':{'id':_0x55d1d8[_0x3c4d('0x36')]['ids']}});})[_0x3c4d('0x1e')](function(_0x52495d){socket[_0x3c4d('0x55')](_0x3c4d('0x56'),{'id':Number(_0x55d1d8['params']['id']),'tags':_0x52495d||[]});return{'id':Number(_0x55d1d8[_0x3c4d('0x38')]['id']),'tags':_0x52495d||[]};});}})[_0x3c4d('0x1e')](respondWithResult(_0x489672,null))[_0x3c4d('0x37')](handleError(_0x489672,null));};exports[_0x3c4d('0x57')]=function(_0x146a48,_0x5b62c5){return db[_0x3c4d('0x2b')]['find']({'where':{'id':_0x146a48['params']['id']}})[_0x3c4d('0x1e')](handleEntityNotFound(_0x5b62c5,null))['then'](function(_0x1fea9f){if(_0x1fea9f){return _0x1fea9f[_0x3c4d('0x57')](_0x146a48[_0x3c4d('0x28')]['ids']);}})[_0x3c4d('0x1e')](respondWithStatusCode(_0x5b62c5,null))[_0x3c4d('0x37')](handleError(_0x5b62c5,null));};exports['download']=function(_0x4d4e3d,_0x53492f){var _0x1f6dc6=moment()[_0x3c4d('0x58')]()[_0x3c4d('0x59')]();var _0x2a8e38=path[_0x3c4d('0x5a')](config[_0x3c4d('0x5b')],_0x3c4d('0x5c'),_0x3c4d('0x5d'),_0x3c4d('0x5e'));var _0x441e1a=path[_0x3c4d('0x5a')](_0x2a8e38,_0x1f6dc6);var _0x1ea5f3=util['format'](_0x3c4d('0x5f'),_0x4d4e3d[_0x3c4d('0x38')]['id'],_0x1f6dc6);var _0xe7ff51=path['join'](_0x2a8e38,_0x1ea5f3);var _0x38f8c5=[];_0x38f8c5[_0x3c4d('0x60')]({'model':db[_0x3c4d('0x61')],'as':_0x3c4d('0x61'),'attributes':['id',_0x3c4d('0x62')],'raw':!![]});_0x38f8c5[_0x3c4d('0x60')]({'model':db[_0x3c4d('0x63')],'as':_0x3c4d('0x64'),'attributes':['id',_0x3c4d('0x65'),_0x3c4d('0x66')],'raw':!![]});var _0x45af62=[{'model':db[_0x3c4d('0x3c')],'as':'Messages','attributes':['id','body','createdAt',_0x3c4d('0x67'),_0x3c4d('0x68'),_0x3c4d('0x69')],'include':_0x38f8c5}];_0x45af62['push']({'model':db[_0x3c4d('0x6a')],'as':_0x3c4d('0x6b'),'attributes':['id',_0x3c4d('0x21')]});_0x45af62[_0x3c4d('0x60')]({'model':db[_0x3c4d('0x61')],'as':_0x3c4d('0x6c'),'attributes':['id',_0x3c4d('0x62')]});return db[_0x3c4d('0x2b')]['find']({'where':{'id':_0x4d4e3d[_0x3c4d('0x38')]['id']},'include':_0x45af62})[_0x3c4d('0x1e')](handleEntityNotFound(_0x53492f,null))['then'](function(_0x403e79){if(_0x403e79){var _0x2d7ccc=_0x403e79['get']({'plain':!![]});fs['mkdirSync'](_0x441e1a);var _0x486ce0={'channel':_0x3c4d('0x6d'),'account':_0x2d7ccc[_0x3c4d('0x6b')][_0x3c4d('0x21')],'agent':_0x2d7ccc[_0x3c4d('0x6c')]?_0x2d7ccc['Owner']['fullname']:_0x3c4d('0x6e'),'createdAt':moment(_0x2d7ccc[_0x3c4d('0x6f')])[_0x3c4d('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3c4d('0x59')](),'closedAt':_0x2d7ccc[_0x3c4d('0x70')]?moment(_0x2d7ccc['closedAt'])[_0x3c4d('0x4c')](_0x3c4d('0x4d'))[_0x3c4d('0x59')]():'','disposition':_0x2d7ccc[_0x3c4d('0x71')],'messages':_(_0x2d7ccc[_0x3c4d('0x72')])[_0x3c4d('0x49')]({'secret':![]})[_0x3c4d('0x73')](function(_0x3467e9){return{'date':moment(_0x3467e9[_0x3c4d('0x6f')])[_0x3c4d('0x4c')](_0x3c4d('0x4d'))[_0x3c4d('0x59')](),'sender':_0x3467e9[_0x3c4d('0x67')]==='out'?_0x3467e9[_0x3c4d('0x61')]?_0x3467e9['User'][_0x3c4d('0x62')]:_0x3c4d('0x74'):_0x3467e9[_0x3c4d('0x64')]['firstName']+(_0x3467e9[_0x3c4d('0x64')][_0x3c4d('0x66')]?'\x20'+_0x3467e9[_0x3c4d('0x64')][_0x3c4d('0x66')]:''),'body':_0x3467e9['body'],'direction':_0x3467e9['direction']==='out'?'A':'C','secret':_0x3467e9['secret'],'read':_0x3467e9[_0x3c4d('0x69')]};})[_0x3c4d('0x75')]()};return ejs[_0x3c4d('0x76')](path[_0x3c4d('0x5a')](config[_0x3c4d('0x5b')],'server',_0x3c4d('0x77'),'downloadInteraction.ejs'),{'interaction':_0x486ce0})[_0x3c4d('0x1e')](function(_0x1ec1b4){var _0x48b7b7=path[_0x3c4d('0x5a')](_0x441e1a,'transcript-'+_0x2d7ccc['id']+'-'+_0x1f6dc6+'.pdf');var _0x5d53aa={'path':_0x48b7b7,'channel':_0x3c4d('0x6d'),'interactionId':_0x2d7ccc['id']};return pdf['createPdfFromHTML'](_0x1ec1b4,_0x5d53aa);})['then'](function(){return new BPromise(function(_0x299734,_0x4b2c07){zipdir(_0x441e1a,{'saveTo':_0xe7ff51},function(_0x5657a0,_0x3f8e8c){if(_0x5657a0)return _0x4b2c07(_0x5657a0);return _0x299734(_0x3f8e8c);});})[_0x3c4d('0x1e')](function(){return new BPromise(function(_0x14a1d0,_0x49208d){rimraf(_0x441e1a,function(_0x2b9c77){if(_0x2b9c77)_0x49208d(_0x2b9c77);return _0x14a1d0();});});})[_0x3c4d('0x1e')](function(){return _0x53492f[_0x3c4d('0x78')](_0xe7ff51,_0x1ea5f3,function(_0x7ba466){if(_0x7ba466){console[_0x3c4d('0x79')](_0x3c4d('0x7a'),_0x7ba466);}else{fs[_0x3c4d('0x7b')](_0xe7ff51);}});});});}else{return _0x53492f[_0x3c4d('0x13')](0xc8);}})[_0x3c4d('0x37')](handleError(_0x53492f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 23e9099..80f15df 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 _0x1a37=['events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x5c0682,_0xd09abf){var _0x58110b=function(_0x378aac){while(--_0x378aac){_0x5c0682['push'](_0x5c0682['shift']());}};_0x58110b(++_0xd09abf);}(_0x1a37,0xb4));var _0x71a3=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1a37[_0x59c301];return _0x3866b9;};'use strict';var EventEmitter=require(_0x71a3('0x0'));var SmsInteraction=require(_0x71a3('0x1'))['db'][_0x71a3('0x2')];var SmsMessage=require(_0x71a3('0x1'))['db'][_0x71a3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x71a3('0x4')](0x0);var events={'afterCreate':_0x71a3('0x5'),'afterUpdate':_0x71a3('0x6'),'afterDestroy':_0x71a3('0x7')};function emitEvent(_0x100181){return function(_0x4af5b4,_0x11e8a8,_0x4f6b7a){_0x4af5b4[_0x71a3('0x8')]({'attributes':['id'],'raw':!![]})[_0x71a3('0x9')](function(_0x231ea7){_0x4af5b4[_0x71a3('0xa')]('Users',_0x231ea7['map'](function(_0x56c351){return{'id':_0x56c351['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4af5b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x71a3('0x9')](function(_0x18320a){_0x4af5b4[_0x71a3('0xa')](_0x71a3('0xb'),_0x18320a[_0x71a3('0xc')]);SmsInteractionEvents[_0x71a3('0xd')](_0x100181+':'+_0x4af5b4['id'],_0x4af5b4);SmsInteractionEvents[_0x71a3('0xd')](_0x100181,_0x4af5b4);_0x4f6b7a(null);})[_0x71a3('0xe')](_0x4f6b7a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x2da6=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x2da6,0x1dd));var _0x62da=function(_0x34a1e3,_0x513708){_0x34a1e3=_0x34a1e3-0x0;var _0x1e4743=_0x2da6[_0x34a1e3];return _0x1e4743;};'use strict';var EventEmitter=require(_0x62da('0x0'));var SmsInteraction=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var SmsMessage=require(_0x62da('0x1'))['db'][_0x62da('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x62da('0x4')](0x0);var events={'afterCreate':_0x62da('0x5'),'afterUpdate':_0x62da('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4a8428){return function(_0xe28204,_0x3163df,_0x3a59f8){_0xe28204[_0x62da('0x7')]({'attributes':['id'],'raw':!![]})[_0x62da('0x8')](function(_0x9d9139){_0xe28204[_0x62da('0x9')](_0x62da('0xa'),_0x9d9139[_0x62da('0xb')](function(_0x4cfc5d){return{'id':_0x4cfc5d['id']};}));return SmsMessage[_0x62da('0xc')]({'where':{'SmsInteractionId':_0xe28204['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62da('0x8')](function(_0x2a3d7c){_0xe28204[_0x62da('0x9')]('unreadMessages',_0x2a3d7c[_0x62da('0xd')]);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428+':'+_0xe28204['id'],_0xe28204);SmsInteractionEvents[_0x62da('0xe')](_0x4a8428,_0xe28204);_0x3a59f8(null);})[_0x62da('0xf')](_0x3a59f8(null));};}for(var e in events){if(events[_0x62da('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x62da('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0fc9d75..3130fbc 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 _0xe3dc=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3dc,0xca));var _0xce3d=function(_0x472ecb,_0x3818bd){_0x472ecb=_0x472ecb-0x0;var _0x57e037=_0xe3dc[_0x472ecb];return _0x57e037;};'use strict';var _=require(_0xce3d('0x0'));var util=require('util');var logger=require(_0xce3d('0x1'))(_0xce3d('0x2'));var moment=require('moment');var BPromise=require(_0xce3d('0x3'));var rp=require(_0xce3d('0x4'));var fs=require('fs');var path=require(_0xce3d('0x5'));var rimraf=require(_0xce3d('0x6'));var config=require(_0xce3d('0x7'));var attributes=require(_0xce3d('0x8'));module[_0xce3d('0x9')]=function(_0x2d3569,_0x52344a){return _0x2d3569[_0xce3d('0xa')](_0xce3d('0xb'),attributes,{'tableName':_0xce3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x273866,_0x99f8f,_0x7ff552){if(_0x273866[_0xce3d('0xd')](_0xce3d('0xe'))){_0x273866[_0xce3d('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x7ff552(null,_0x273866);}}});}; \ No newline at end of file +var _0xac9a=['changed','closed','lodash','util','../../config/logger','api','bluebird','path','rimraf','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x1bfc25,_0x49cde8){var _0x3efea6=function(_0xfc23e7){while(--_0xfc23e7){_0x1bfc25['push'](_0x1bfc25['shift']());}};_0x3efea6(++_0x49cde8);}(_0xac9a,0x17b));var _0xaac9=function(_0x55f5ef,_0x1b8176){_0x55f5ef=_0x55f5ef-0x0;var _0x3947e4=_0xac9a[_0x55f5ef];return _0x3947e4;};'use strict';var _=require(_0xaac9('0x0'));var util=require(_0xaac9('0x1'));var logger=require(_0xaac9('0x2'))(_0xaac9('0x3'));var moment=require('moment');var BPromise=require(_0xaac9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaac9('0x5'));var rimraf=require(_0xaac9('0x6'));var config=require('../../config/environment');var attributes=require(_0xaac9('0x7'));module[_0xaac9('0x8')]=function(_0x59d27c,_0x5caf71){return _0x59d27c[_0xaac9('0x9')]('SmsInteraction',attributes,{'tableName':_0xaac9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc3bc5c,_0x36107d,_0x51697b){if(_0xc3bc5c[_0xaac9('0xb')](_0xaac9('0xc'))){_0xc3bc5c['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x51697b(null,_0xc3bc5c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3d85c7b..b7d23bd 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 _0xd2ec=['ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','SmsInteraction','update','body','options','where','attributes','limit','then','debug','UpdateSmsInteraction','stringify','catch','find','addTags','omit'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0xd2ec,0x1bb));var _0xcd2e=function(_0x2fbcd3,_0xbb2e27){_0x2fbcd3=_0x2fbcd3-0x0;var _0x201573=_0xd2ec[_0x2fbcd3];return _0x201573;};'use strict';var _=require(_0xcd2e('0x0'));var util=require(_0xcd2e('0x1'));var moment=require(_0xcd2e('0x2'));var BPromise=require(_0xcd2e('0x3'));var rs=require(_0xcd2e('0x4'));var fs=require('fs');var Redis=require(_0xcd2e('0x5'));var db=require(_0xcd2e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd2e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcd2e('0x8'));var client=jayson[_0xcd2e('0x9')][_0xcd2e('0xa')]({'port':0x232a});config[_0xcd2e('0xb')]=_[_0xcd2e('0xc')](config[_0xcd2e('0xb')],{'host':_0xcd2e('0xd'),'port':0x18eb});var socket=require(_0xcd2e('0xe'))(new Redis(config['redis']));require(_0xcd2e('0xf'))[_0xcd2e('0x10')](socket);function respondWithRpcPromise(_0x345680,_0x598057,_0x276949){return new BPromise(function(_0x8590dc,_0x2b4a35){return client[_0xcd2e('0x11')](_0x345680,_0x276949)['then'](function(_0x4b512f){logger['info'](_0xcd2e('0x12'),_0x598057,_0xcd2e('0x13'));logger['debug'](_0xcd2e('0x14'),_0x598057,_0xcd2e('0x13'),JSON['stringify'](_0x4b512f));if(_0x4b512f[_0xcd2e('0x15')]){if(_0x4b512f['error'][_0xcd2e('0x16')]===0x1f4){logger['error'](_0xcd2e('0x12'),_0x598057,_0x4b512f[_0xcd2e('0x15')]['message']);return _0x2b4a35(_0x4b512f['error'][_0xcd2e('0x17')]);}logger[_0xcd2e('0x15')](_0xcd2e('0x12'),_0x598057,_0x4b512f[_0xcd2e('0x15')][_0xcd2e('0x17')]);return _0x8590dc(_0x4b512f[_0xcd2e('0x15')][_0xcd2e('0x17')]);}else{logger[_0xcd2e('0x18')](_0xcd2e('0x12'),_0x598057,_0xcd2e('0x13'));_0x8590dc(_0x4b512f[_0xcd2e('0x19')][_0xcd2e('0x17')]);}})['catch'](function(_0x6dc179){logger[_0xcd2e('0x15')](_0xcd2e('0x12'),_0x598057,_0x6dc179);_0x2b4a35(_0x6dc179);});});}exports['UpdateSmsInteraction']=function(_0x585bc2){var _0x8b4d79=this;return new Promise(function(_0x4004f8,_0x1b3e18){return db[_0xcd2e('0x1a')][_0xcd2e('0x1b')](_0x585bc2[_0xcd2e('0x1c')],{'raw':_0x585bc2['options']?_0x585bc2[_0xcd2e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585bc2[_0xcd2e('0x1d')]?_0x585bc2[_0xcd2e('0x1d')][_0xcd2e('0x1e')]||null:null,'attributes':_0x585bc2['options']?_0x585bc2['options'][_0xcd2e('0x1f')]||null:null,'limit':_0x585bc2[_0xcd2e('0x1d')]?_0x585bc2[_0xcd2e('0x1d')][_0xcd2e('0x20')]||null:null})[_0xcd2e('0x21')](function(_0x252cbb){logger[_0xcd2e('0x18')]('UpdateSmsInteraction',_0x585bc2);logger[_0xcd2e('0x22')](_0xcd2e('0x23'),_0x585bc2,JSON[_0xcd2e('0x24')](_0x252cbb));_0x4004f8(_0x252cbb);})[_0xcd2e('0x25')](function(_0x5119fd){logger[_0xcd2e('0x15')](_0xcd2e('0x23'),_0x5119fd['message'],_0x585bc2);_0x1b3e18(_0x8b4d79[_0xcd2e('0x15')](0x1f4,_0x5119fd['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x48bcb3){return new Promise(function(_0x246261,_0x10d116){return db['SmsInteraction'][_0xcd2e('0x26')]({'where':_0x48bcb3[_0xcd2e('0x1d')]?_0x48bcb3[_0xcd2e('0x1d')][_0xcd2e('0x1e')]||null:null})[_0xcd2e('0x21')](function(_0x4ad983){if(_0x4ad983){return _0x4ad983[_0xcd2e('0x27')](_0x48bcb3['body']['ids'],_[_0xcd2e('0x28')](_0x48bcb3['body'],[_0xcd2e('0x29'),'id'])||{});}})[_0xcd2e('0x2a')](function(_0x1e6fbe){logger[_0xcd2e('0x18')](_0xcd2e('0x2b'),_0x48bcb3);logger[_0xcd2e('0x22')](_0xcd2e('0x2b'),_0x48bcb3,JSON[_0xcd2e('0x24')](_0x1e6fbe));_0x246261(_0x1e6fbe);})[_0xcd2e('0x25')](function(_0x4737f2){logger[_0xcd2e('0x15')](_0xcd2e('0x2b'),_0x4737f2[_0xcd2e('0x17')],_0x48bcb3);_0x10d116(_this[_0xcd2e('0x15')](0x1f4,_0x4737f2[_0xcd2e('0x17')]));});});}; \ No newline at end of file +var _0x477f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x5650c5,_0x7879b1){var _0x302946=function(_0x2db5d0){while(--_0x2db5d0){_0x5650c5['push'](_0x5650c5['shift']());}};_0x302946(++_0x7879b1);}(_0x477f,0x147));var _0xf477=function(_0x5f5a0a,_0x1e0e28){_0x5f5a0a=_0x5f5a0a-0x0;var _0x435e4a=_0x477f[_0x5f5a0a];return _0x435e4a;};'use strict';var _=require(_0xf477('0x0'));var util=require(_0xf477('0x1'));var moment=require(_0xf477('0x2'));var BPromise=require(_0xf477('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf477('0x4'));var db=require(_0xf477('0x5'))['db'];var utils=require(_0xf477('0x6'));var logger=require(_0xf477('0x7'))(_0xf477('0x8'));var config=require(_0xf477('0x9'));var jayson=require(_0xf477('0xa'));var client=jayson[_0xf477('0xb')][_0xf477('0xc')]({'port':0x232a});config[_0xf477('0xd')]=_[_0xf477('0xe')](config[_0xf477('0xd')],{'host':_0xf477('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf477('0x10'))['register'](socket);function respondWithRpcPromise(_0x2fb638,_0x25b7d7,_0x3f1777){return new BPromise(function(_0x1d2ae3,_0x888b38){return client['request'](_0x2fb638,_0x3f1777)[_0xf477('0x11')](function(_0xfdd861){logger['info'](_0xf477('0x12'),_0x25b7d7,_0xf477('0x13'));logger[_0xf477('0x14')](_0xf477('0x15'),_0x25b7d7,_0xf477('0x13'),JSON[_0xf477('0x16')](_0xfdd861));if(_0xfdd861[_0xf477('0x17')]){if(_0xfdd861[_0xf477('0x17')]['code']===0x1f4){logger[_0xf477('0x17')](_0xf477('0x12'),_0x25b7d7,_0xfdd861[_0xf477('0x17')][_0xf477('0x18')]);return _0x888b38(_0xfdd861[_0xf477('0x17')][_0xf477('0x18')]);}logger[_0xf477('0x17')](_0xf477('0x12'),_0x25b7d7,_0xfdd861[_0xf477('0x17')][_0xf477('0x18')]);return _0x1d2ae3(_0xfdd861['error'][_0xf477('0x18')]);}else{logger[_0xf477('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x25b7d7,_0xf477('0x13'));_0x1d2ae3(_0xfdd861['result'][_0xf477('0x18')]);}})['catch'](function(_0x5e4c1f){logger[_0xf477('0x17')](_0xf477('0x12'),_0x25b7d7,_0x5e4c1f);_0x888b38(_0x5e4c1f);});});}exports[_0xf477('0x1a')]=function(_0x108fd1){var _0x1bb071=this;return new Promise(function(_0x1ab0ab,_0x465d6f){return db[_0xf477('0x1b')][_0xf477('0x1c')](_0x108fd1[_0xf477('0x1d')],{'raw':_0x108fd1[_0xf477('0x1e')]?_0x108fd1['options'][_0xf477('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108fd1[_0xf477('0x1e')]?_0x108fd1['options'][_0xf477('0x20')]||null:null,'attributes':_0x108fd1[_0xf477('0x1e')]?_0x108fd1[_0xf477('0x1e')][_0xf477('0x21')]||null:null,'limit':_0x108fd1['options']?_0x108fd1['options'][_0xf477('0x22')]||null:null})['then'](function(_0x2ccf1d){logger[_0xf477('0x19')](_0xf477('0x1a'),_0x108fd1);logger[_0xf477('0x14')](_0xf477('0x1a'),_0x108fd1,JSON[_0xf477('0x16')](_0x2ccf1d));_0x1ab0ab(_0x2ccf1d);})[_0xf477('0x23')](function(_0x26385c){logger[_0xf477('0x17')]('UpdateSmsInteraction',_0x26385c['message'],_0x108fd1);_0x465d6f(_0x1bb071[_0xf477('0x17')](0x1f4,_0x26385c[_0xf477('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4e97da){return new Promise(function(_0x1b1c24,_0x4ecbcb){return db[_0xf477('0x1b')]['find']({'where':_0x4e97da[_0xf477('0x1e')]?_0x4e97da[_0xf477('0x1e')][_0xf477('0x20')]||null:null})[_0xf477('0x11')](function(_0xe3f649){if(_0xe3f649){return _0xe3f649[_0xf477('0x24')](_0x4e97da[_0xf477('0x1d')][_0xf477('0x25')],_[_0xf477('0x26')](_0x4e97da[_0xf477('0x1d')],[_0xf477('0x25'),'id'])||{});}})[_0xf477('0x27')](function(_0x5d4eb8){logger[_0xf477('0x19')]('AddTags',_0x4e97da);logger[_0xf477('0x14')](_0xf477('0x28'),_0x4e97da,JSON[_0xf477('0x16')](_0x5d4eb8));_0x1b1c24(_0x5d4eb8);})[_0xf477('0x23')](function(_0x39a119){logger[_0xf477('0x17')](_0xf477('0x28'),_0x39a119[_0xf477('0x18')],_0x4e97da);_0x4ecbcb(_this[_0xf477('0x17')](0x1f4,_0x39a119[_0xf477('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f9a082d..750ab67 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 _0xa348=['./smsInteraction.events','save','update','removeListener','register','length','smsInteraction:'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xa348,0x118));var _0x8a34=function(_0x246baa,_0x11c460){_0x246baa=_0x246baa-0x0;var _0x4444c2=_0xa348[_0x246baa];return _0x4444c2;};'use strict';var SmsInteractionEvents=require(_0x8a34('0x0'));var events=[_0x8a34('0x1'),'remove',_0x8a34('0x2')];function createListener(_0x1ab64e,_0x3bbafc){return function(_0x805dee){_0x3bbafc['emit'](_0x1ab64e,_0x805dee);};}function removeListener(_0x3c9111,_0x5184a2){return function(){SmsInteractionEvents[_0x8a34('0x3')](_0x3c9111,_0x5184a2);};}exports[_0x8a34('0x4')]=function(_0x5d53bf){for(var _0x3fced5=0x0,_0x11ca23=events[_0x8a34('0x5')];_0x3fced5<_0x11ca23;_0x3fced5++){var _0x5d5628=events[_0x3fced5];var _0x3af1be=createListener(_0x8a34('0x6')+_0x5d5628,_0x5d53bf);SmsInteractionEvents['on'](_0x5d5628,_0x3af1be);}}; \ No newline at end of file +var _0x2603=['save','remove','update','removeListener','length','smsInteraction:'];(function(_0x102ac0,_0x142f22){var _0x322b9e=function(_0x45c5a1){while(--_0x45c5a1){_0x102ac0['push'](_0x102ac0['shift']());}};_0x322b9e(++_0x142f22);}(_0x2603,0xa8));var _0x3260=function(_0x382e58,_0x3060d9){_0x382e58=_0x382e58-0x0;var _0x34ef18=_0x2603[_0x382e58];return _0x34ef18;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x3260('0x0'),_0x3260('0x1'),_0x3260('0x2')];function createListener(_0x2a4622,_0x308429){return function(_0x5e95a4){_0x308429['emit'](_0x2a4622,_0x5e95a4);};}function removeListener(_0x4db2e5,_0x385b38){return function(){SmsInteractionEvents[_0x3260('0x3')](_0x4db2e5,_0x385b38);};}exports['register']=function(_0x10e051){for(var _0xd75ece=0x0,_0x1bbdbe=events[_0x3260('0x4')];_0xd75ece<_0x1bbdbe;_0xd75ece++){var _0x3c17a7=events[_0xd75ece];var _0x37f55f=createListener(_0x3260('0x5')+_0x3c17a7,_0x10e051);SmsInteractionEvents['on'](_0x3c17a7,_0x37f55f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index effa2b7..582d311 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 _0x9f7c=['describe','/:id','post','tracked','sms','/:id/status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x31120b,_0x150c1c){var _0x579754=function(_0x5286d5){while(--_0x5286d5){_0x31120b['push'](_0x31120b['shift']());}};_0x579754(++_0x150c1c);}(_0x9f7c,0x113));var _0xc9f7=function(_0x817fd,_0x328ef5){_0x817fd=_0x817fd-0x0;var _0x7ca3af=_0x9f7c[_0x817fd];return _0x7ca3af;};'use strict';var multer=require(_0xc9f7('0x0'));var util=require(_0xc9f7('0x1'));var path=require(_0xc9f7('0x2'));var timeout=require(_0xc9f7('0x3'));var express=require(_0xc9f7('0x4'));var router=express[_0xc9f7('0x5')]();var fs_extra=require(_0xc9f7('0x6'));var auth=require(_0xc9f7('0x7'));var interaction=require(_0xc9f7('0x8'));var config=require(_0xc9f7('0x9'));var controller=require(_0xc9f7('0xa'));router[_0xc9f7('0xb')]('/',auth[_0xc9f7('0xc')](),controller[_0xc9f7('0xd')]);router[_0xc9f7('0xb')](_0xc9f7('0xe'),auth[_0xc9f7('0xc')](),controller[_0xc9f7('0xf')]);router[_0xc9f7('0xb')](_0xc9f7('0x10'),auth[_0xc9f7('0xc')](),controller['show']);router[_0xc9f7('0x11')]('/',auth['isAuthenticated'](),interaction[_0xc9f7('0x12')](_0xc9f7('0x13'),'smsmessage:create'),controller['create']);router[_0xc9f7('0x11')](_0xc9f7('0x14'),controller['status']);router[_0xc9f7('0x15')](_0xc9f7('0x10'),auth[_0xc9f7('0xc')](),controller[_0xc9f7('0x16')]);router[_0xc9f7('0x15')]('/:id/accept',auth[_0xc9f7('0xc')](),controller[_0xc9f7('0x17')]);router['put'](_0xc9f7('0x18'),auth[_0xc9f7('0xc')](),controller[_0xc9f7('0x19')]);router[_0xc9f7('0x1a')]('/:id',auth[_0xc9f7('0xc')](),controller[_0xc9f7('0x1b')]);module[_0xc9f7('0x1c')]=router; \ No newline at end of file +var _0x0060=['sms','smsmessage:create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x489b57,_0x3d5441){var _0x41c9b8=function(_0x163ba9){while(--_0x163ba9){_0x489b57['push'](_0x489b57['shift']());}};_0x41c9b8(++_0x3d5441);}(_0x0060,0x11e));var _0x0006=function(_0x13fb4f,_0x42f6af){_0x13fb4f=_0x13fb4f-0x0;var _0x298a4e=_0x0060[_0x13fb4f];return _0x298a4e;};'use strict';var multer=require(_0x0006('0x0'));var util=require(_0x0006('0x1'));var path=require('path');var timeout=require(_0x0006('0x2'));var express=require(_0x0006('0x3'));var router=express['Router']();var fs_extra=require(_0x0006('0x4'));var auth=require(_0x0006('0x5'));var interaction=require(_0x0006('0x6'));var config=require('../../config/environment');var controller=require(_0x0006('0x7'));router[_0x0006('0x8')]('/',auth[_0x0006('0x9')](),controller['index']);router[_0x0006('0x8')]('/describe',auth[_0x0006('0x9')](),controller[_0x0006('0xa')]);router['get'](_0x0006('0xb'),auth[_0x0006('0x9')](),controller[_0x0006('0xc')]);router[_0x0006('0xd')]('/',auth[_0x0006('0x9')](),interaction['tracked'](_0x0006('0xe'),_0x0006('0xf')),controller['create']);router[_0x0006('0xd')](_0x0006('0x10'),controller['status']);router[_0x0006('0x11')](_0x0006('0xb'),auth[_0x0006('0x9')](),controller[_0x0006('0x12')]);router['put'](_0x0006('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x0006('0x11')](_0x0006('0x14'),auth[_0x0006('0x9')](),controller[_0x0006('0x15')]);router[_0x0006('0x16')](_0x0006('0xb'),auth[_0x0006('0x9')](),controller[_0x0006('0x17')]);module[_0x0006('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8d0633b..22ed14c 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 _0xd2fe=['DATE','TEXT','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x8178f9,_0x5e799b){var _0x1655ce=function(_0x299aac){while(--_0x299aac){_0x8178f9['push'](_0x8178f9['shift']());}};_0x1655ce(++_0x5e799b);}(_0xd2fe,0xea));var _0xed2f=function(_0x282193,_0x33f614){_0x282193=_0x282193-0x0;var _0x2c4434=_0xd2fe[_0x282193];return _0x2c4434;};'use strict';var Sequelize=require('sequelize');module[_0xed2f('0x0')]={'body':{'type':Sequelize['TEXT'](_0xed2f('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xed2f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xed2f('0x3')]('in',_0xed2f('0x4')),'defaultValue':_0xed2f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xed2f('0x5')](0xbe)},'phone':{'type':Sequelize[_0xed2f('0x5')]},'readAt':{'type':Sequelize[_0xed2f('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xed2f('0x5')]},'providerResponse':{'type':Sequelize[_0xed2f('0x7')]}}; \ No newline at end of file +var _0xcb75=['STRING','DATE','TEXT','exports','medium','BOOLEAN','ENUM','out'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0xcb75,0x183));var _0x5cb7=function(_0x5151cb,_0x43fb84){_0x5151cb=_0x5151cb-0x0;var _0x2ecc2d=_0xcb75[_0x5151cb];return _0x2ecc2d;};'use strict';var Sequelize=require('sequelize');module[_0x5cb7('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5cb7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5cb7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5cb7('0x3')]('in',_0x5cb7('0x4')),'defaultValue':_0x5cb7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5cb7('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5cb7('0x5')]},'readAt':{'type':Sequelize[_0x5cb7('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5cb7('0x5')]},'providerResponse':{'type':Sequelize[_0x5cb7('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b08116b..8b10e2b 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 _0xd945=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','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','end','offset','undefined','limit','count','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','length','find','create','body','params','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','fullname','internal','interface','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x76ced3,_0x8abc01){var _0x4fea70=function(_0x519c04){while(--_0x519c04){_0x76ced3['push'](_0x76ced3['shift']());}};_0x4fea70(++_0x8abc01);}(_0xd945,0x84));var _0x5d94=function(_0x17d54c,_0x33228a){_0x17d54c=_0x17d54c-0x0;var _0x34e8f2=_0xd945[_0x17d54c];return _0x34e8f2;};'use strict';var emlformat=require(_0x5d94('0x0'));var rimraf=require(_0x5d94('0x1'));var zipdir=require(_0x5d94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d94('0x3'));var moment=require(_0x5d94('0x4'));var BPromise=require(_0x5d94('0x5'));var Mustache=require(_0x5d94('0x6'));var util=require(_0x5d94('0x7'));var path=require('path');var sox=require(_0x5d94('0x8'));var csv=require(_0x5d94('0x9'));var ejs=require(_0x5d94('0xa'));var fs=require('fs');var fs_extra=require(_0x5d94('0xb'));var _=require(_0x5d94('0xc'));var squel=require('squel');var crypto=require(_0x5d94('0xd'));var jsforce=require(_0x5d94('0xe'));var deskjs=require(_0x5d94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d94('0x10'));var Papa=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d94('0x15'))(_0x5d94('0x16'));var utils=require(_0x5d94('0x17'));var config=require(_0x5d94('0x18'));var licenseUtil=require(_0x5d94('0x19'));var db=require(_0x5d94('0x1a'))['db'];config[_0x5d94('0x1b')]=_[_0x5d94('0x1c')](config[_0x5d94('0x1b')],{'host':_0x5d94('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d94('0x1b')]));require(_0x5d94('0x1e'))['register'](socket);var jayson=require(_0x5d94('0x1f'));var client=jayson[_0x5d94('0x20')][_0x5d94('0x21')]({'port':0x232c});var client9002=jayson[_0x5d94('0x20')][_0x5d94('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x452a88,_0x5c4d65,_0x555419,_0x541ef1){return new BPromise(function(_0x38d3c7,_0x470c8b){var _0x1ef529=_0x541ef1||client;return _0x1ef529[_0x5d94('0x22')](_0x452a88,_0x555419)[_0x5d94('0x23')](function(_0x47ea45){logger[_0x5d94('0x24')](_0x5d94('0x25'),_0x5c4d65,_0x5d94('0x26'));logger[_0x5d94('0x27')](_0x5d94('0x28'),_0x5c4d65,_0x5d94('0x26'),JSON[_0x5d94('0x29')](_0x47ea45));if(_0x47ea45[_0x5d94('0x2a')]){if(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2b')]===0x1f4){logger[_0x5d94('0x2a')](_0x5d94('0x25'),_0x5c4d65,_0x47ea45[_0x5d94('0x2a')]['message']);return _0x470c8b(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);}logger[_0x5d94('0x2a')](_0x5d94('0x25'),_0x5c4d65,_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);return _0x38d3c7(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);}else{logger[_0x5d94('0x24')](_0x5d94('0x25'),_0x5c4d65,_0x5d94('0x26'));_0x38d3c7(_0x47ea45[_0x5d94('0x2d')][_0x5d94('0x2c')]);}})[_0x5d94('0x2e')](function(_0x1c1344){logger['error'](_0x5d94('0x25'),_0x5c4d65,_0x1c1344);_0x470c8b(_0x1c1344);});});}function respondWithStatusCode(_0x452ad7,_0x3c8cc2){_0x3c8cc2=_0x3c8cc2||0xcc;return function(_0x390e01){if(_0x390e01){return _0x452ad7[_0x5d94('0x2f')](_0x3c8cc2);}return _0x452ad7[_0x5d94('0x30')](_0x3c8cc2)[_0x5d94('0x31')]();};}function respondWithResult(_0x140f8a,_0x2f3b3e){_0x2f3b3e=_0x2f3b3e||0xc8;return function(_0x456c59){if(_0x456c59){return _0x140f8a[_0x5d94('0x30')](_0x2f3b3e)['json'](_0x456c59);}};}function respondWithFilteredResult(_0x5a117f,_0xbf0bc6){return function(_0x54d4df){if(_0x54d4df){var _0x19ef72=typeof _0xbf0bc6[_0x5d94('0x32')]===_0x5d94('0x33')&&typeof _0xbf0bc6[_0x5d94('0x34')]===_0x5d94('0x33');var _0x27a401=_0x54d4df[_0x5d94('0x35')];var _0x12a145=_0x19ef72?0x0:_0xbf0bc6[_0x5d94('0x32')];var _0x150f56=_0x19ef72?_0x54d4df['count']:_0xbf0bc6['offset']+_0xbf0bc6[_0x5d94('0x34')];var _0x34569a;if(_0x150f56>=_0x27a401){_0x150f56=_0x27a401;_0x34569a=0xc8;}else{_0x34569a=0xce;}_0x5a117f[_0x5d94('0x30')](_0x34569a);return _0x5a117f['set']('Content-Range',_0x12a145+'-'+_0x150f56+'/'+_0x27a401)['json'](_0x54d4df);}return null;};}function patchUpdates(_0x31acb6){return function(_0x4e4bc0){try{jsonpatch[_0x5d94('0x36')](_0x4e4bc0,_0x31acb6,!![]);}catch(_0x21008a){return BPromise[_0x5d94('0x37')](_0x21008a);}return _0x4e4bc0[_0x5d94('0x38')]();};}function saveUpdates(_0x460e4e,_0x12066c){return function(_0x30d3f8){if(_0x30d3f8){return _0x30d3f8[_0x5d94('0x39')](_0x460e4e)['then'](function(_0x41067a){return _0x41067a;});}return null;};}function removeEntity(_0x247056,_0x315a58){return function(_0x1f95ca){if(_0x1f95ca){return _0x1f95ca['destroy']()['then'](function(){_0x247056[_0x5d94('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f186a,_0x1655b7){return function(_0x45495f){if(!_0x45495f){_0x5f186a['sendStatus'](0x194);}return _0x45495f;};}function handleError(_0x56ada6,_0x41b06c){_0x41b06c=_0x41b06c||0x1f4;return function(_0x41709c){logger['error'](_0x41709c[_0x5d94('0x3a')]);if(_0x41709c[_0x5d94('0x3b')]){delete _0x41709c[_0x5d94('0x3b')];}_0x56ada6[_0x5d94('0x30')](_0x41b06c)[_0x5d94('0x3c')](_0x41709c);};}exports[_0x5d94('0x3d')]=function(_0x3f4d4c,_0xc73dcd){var _0x3ff75f={},_0x12c118={},_0x4f16e6={'count':0x0,'rows':[]};var _0xd15523=_[_0x5d94('0x3e')](db[_0x5d94('0x3f')][_0x5d94('0x40')],function(_0x4aa034){return{'name':_0x4aa034[_0x5d94('0x41')],'type':_0x4aa034[_0x5d94('0x42')]['key']};});_0x12c118['model']=_[_0x5d94('0x3e')](_0xd15523,_0x5d94('0x3b'));_0x12c118[_0x5d94('0x43')]=_[_0x5d94('0x44')](_0x3f4d4c[_0x5d94('0x43')]);_0x12c118['filters']=_[_0x5d94('0x45')](_0x12c118[_0x5d94('0x46')],_0x12c118[_0x5d94('0x43')]);_0x3ff75f[_0x5d94('0x47')]=_['intersection'](_0x12c118[_0x5d94('0x46')],qs[_0x5d94('0x48')](_0x3f4d4c[_0x5d94('0x43')]['fields']));_0x3ff75f[_0x5d94('0x47')]=_0x3ff75f['attributes']['length']?_0x3ff75f['attributes']:_0x12c118[_0x5d94('0x46')];if(!_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x49')](_0x5d94('0x4a'))){_0x3ff75f['limit']=qs[_0x5d94('0x34')](_0x3f4d4c[_0x5d94('0x43')]['limit']);_0x3ff75f['offset']=qs[_0x5d94('0x32')](_0x3f4d4c[_0x5d94('0x43')]['offset']);}_0x3ff75f[_0x5d94('0x4b')]=qs['sort'](_0x3f4d4c[_0x5d94('0x43')]['sort']);_0x3ff75f[_0x5d94('0x4c')]=qs[_0x5d94('0x4d')](_[_0x5d94('0x4e')](_0x3f4d4c[_0x5d94('0x43')],_0x12c118[_0x5d94('0x4d')]),_0xd15523);if(_0x3f4d4c[_0x5d94('0x43')]['filter']){_0x3ff75f[_0x5d94('0x4c')]=_[_0x5d94('0x4f')](_0x3ff75f[_0x5d94('0x4c')],{'$or':_[_0x5d94('0x3e')](_0xd15523,function(_0x55a34d){if(_0x55a34d[_0x5d94('0x42')]!=='VIRTUAL'){var _0x4aa243={};_0x4aa243[_0x55a34d[_0x5d94('0x3b')]]={'$like':'%'+_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x50')]+'%'};return _0x4aa243;}})});}_0x3ff75f=_[_0x5d94('0x4f')]({},_0x3ff75f,_0x3f4d4c[_0x5d94('0x51')]);var _0x16c8a4={'where':_0x3ff75f['where']};return db['SmsMessage'][_0x5d94('0x35')](_0x16c8a4)[_0x5d94('0x23')](function(_0x12f893){_0x4f16e6[_0x5d94('0x35')]=_0x12f893;if(_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x52')]){_0x3ff75f[_0x5d94('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x5d94('0x54')](_0x3ff75f);})[_0x5d94('0x23')](function(_0x5c6521){_0x4f16e6[_0x5d94('0x55')]=_0x5c6521;return _0x4f16e6;})[_0x5d94('0x23')](respondWithFilteredResult(_0xc73dcd,_0x3ff75f))[_0x5d94('0x2e')](handleError(_0xc73dcd,null));};exports[_0x5d94('0x56')]=function(_0x40e595,_0x12e049){var _0x195463={'raw':!![],'where':{'id':_0x40e595['params']['id']}},_0x2b7c09={};_0x2b7c09['model']=_[_0x5d94('0x44')](db[_0x5d94('0x3f')][_0x5d94('0x40')]);_0x2b7c09[_0x5d94('0x43')]=_['keys'](_0x40e595[_0x5d94('0x43')]);_0x2b7c09[_0x5d94('0x4d')]=_[_0x5d94('0x45')](_0x2b7c09['model'],_0x2b7c09[_0x5d94('0x43')]);_0x195463[_0x5d94('0x47')]=_[_0x5d94('0x45')](_0x2b7c09[_0x5d94('0x46')],qs['fields'](_0x40e595[_0x5d94('0x43')][_0x5d94('0x48')]));_0x195463[_0x5d94('0x47')]=_0x195463['attributes'][_0x5d94('0x57')]?_0x195463[_0x5d94('0x47')]:_0x2b7c09[_0x5d94('0x46')];if(_0x40e595['query'][_0x5d94('0x52')]){_0x195463[_0x5d94('0x53')]=[{'all':!![]}];}_0x195463=_[_0x5d94('0x4f')]({},_0x195463,_0x40e595[_0x5d94('0x51')]);return db[_0x5d94('0x3f')][_0x5d94('0x58')](_0x195463)[_0x5d94('0x23')](handleEntityNotFound(_0x12e049,null))[_0x5d94('0x23')](respondWithResult(_0x12e049,null))[_0x5d94('0x2e')](handleError(_0x12e049,null));};exports[_0x5d94('0x59')]=function(_0x503bac,_0x287464){return db[_0x5d94('0x3f')][_0x5d94('0x59')](_0x503bac[_0x5d94('0x5a')],{})[_0x5d94('0x23')](respondWithResult(_0x287464,0xc9))[_0x5d94('0x2e')](handleError(_0x287464,null));};exports['update']=function(_0x1381f1,_0x469fa4){if(_0x1381f1[_0x5d94('0x5a')]['id']){delete _0x1381f1[_0x5d94('0x5a')]['id'];}return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x1381f1[_0x5d94('0x5b')]['id']}})[_0x5d94('0x23')](handleEntityNotFound(_0x469fa4,null))[_0x5d94('0x23')](saveUpdates(_0x1381f1['body'],null))['then'](respondWithResult(_0x469fa4,null))[_0x5d94('0x2e')](handleError(_0x469fa4,null));};exports['destroy']=function(_0x6a9625,_0x13ab17){return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x6a9625[_0x5d94('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13ab17,null))['then'](removeEntity(_0x13ab17,null))[_0x5d94('0x2e')](handleError(_0x13ab17,null));};exports['describe']=function(_0x4203f7,_0x12aec2){return db[_0x5d94('0x3f')][_0x5d94('0x5c')]()[_0x5d94('0x23')](respondWithResult(_0x12aec2,null))['catch'](handleError(_0x12aec2,null));};var interaction_log=require(_0x5d94('0x15'))('sms-interactions');exports[_0x5d94('0x5d')]=function(_0x17e08d,_0x64c270,_0x1d47d2){var _0x3ffd95={'agent':{},'channel':_0x5d94('0x5e')};if(_0x17e08d[_0x5d94('0x5a')]['id']){delete _0x17e08d[_0x5d94('0x5a')]['id'];}_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x5f')]=!![];_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x60')]=moment()[_0x5d94('0x61')](_0x5d94('0x62'));_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')]=_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')]||_0x17e08d[_0x5d94('0x64')]['id'];_0x3ffd95[_0x5d94('0x65')]['id']=_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')];return db['SmsMessage'][_0x5d94('0x58')]({'where':{'id':_0x17e08d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x64c270,null))[_0x5d94('0x23')](saveUpdates(_0x17e08d[_0x5d94('0x5a')],null))['then'](function(_0x56149a){if(_0x56149a){_0x3ffd95[_0x5d94('0x2c')]=_0x56149a[_0x5d94('0x66')]({'plain':!![]});return db[_0x5d94('0x67')][_0x5d94('0x58')]({'where':{'id':_0x56149a[_0x5d94('0x68')]}});}return null;})[_0x5d94('0x23')](handleEntityNotFound(_0x64c270,null))[_0x5d94('0x23')](function(_0x21111f){if(_0x21111f){return _0x21111f[_0x5d94('0x39')]({'UserId':_0x17e08d[_0x5d94('0x5a')]['UserId'],'read1stAt':_[_0x5d94('0x69')](_0x21111f[_0x5d94('0x6a')])?moment()[_0x5d94('0x61')](_0x5d94('0x62')):undefined});}return null;})[_0x5d94('0x23')](function(_0x51dedb){if(_0x51dedb){_0x3ffd95[_0x5d94('0x6b')]=_0x51dedb[_0x5d94('0x66')]({'plain':!![]});interaction_log[_0x5d94('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17e08d['user']['id'],_0x17e08d[_0x5d94('0x64')]['name'],_0x17e08d[_0x5d94('0x64')][_0x5d94('0x6c')],_0x3ffd95[_0x5d94('0x6b')]['id'],_0x17e08d[_0x5d94('0x5a')]?JSON[_0x5d94('0x29')](_0x17e08d[_0x5d94('0x5a')]):_0x5d94('0x6d'));return respondWithRpcPromise(_0x5d94('0x6e'),_0x5d94('0x6f'),_0x3ffd95);}return null;})['then'](function(_0x59ef0b){var _0x47c058=_0x5d94('0x70')+_0x59ef0b[_0x5d94('0x2c')][_0x5d94('0x71')];return db[_0x5d94('0x72')][_0x5d94('0x43')](_0x47c058,{'type':db['Sequelize']['QueryTypes'][_0x5d94('0x73')],'raw':!![]})[_0x5d94('0x23')](function(_0x65bacd){return _0x65bacd;});})[_0x5d94('0x23')](function(_0x2fd6b8){if(_0x2fd6b8){_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x74')]=_0x2fd6b8[0x0];if(!_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')])return;return db['User'][_0x5d94('0x58')]({'where':{'id':_0x17e08d[_0x5d94('0x5a')]['UserId'],'role':_0x5d94('0x65')},'attributes':['id','name','fullname',_0x5d94('0x75'),'internal'],'raw':!![]});}return null;})[_0x5d94('0x23')](function(_0x195dd8){if(!_0x195dd8)return null;_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x65')]=_0x195dd8;return _0x3ffd95;})[_0x5d94('0x23')](function(_0x5c8f5c){if(_0x5c8f5c){if(_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x76')]){_0x3ffd95[_0x5d94('0x2c')]['interface']=util[_0x5d94('0x61')](_0x5d94('0x77'),_0x17e08d['user'][_0x5d94('0x3b')]);_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x78')]=_0x3ffd95['channel'];_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x79')]=_0x3ffd95['channel'];_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x7a')]=_0x5d94('0x5d');return respondWithRpcPromise('EventManager',_0x5d94('0x7b'),{'event':_0x5d94('0x7c'),'message':_0x3ffd95[_0x5d94('0x2c')]},client9002)['then'](function(){return _0x3ffd95;});}return _0x3ffd95;}return null;})[_0x5d94('0x23')](respondWithResult(_0x64c270,null))[_0x5d94('0x2e')](handleError(_0x64c270,null));};var interaction_log=require(_0x5d94('0x15'))(_0x5d94('0x7d'));exports[_0x5d94('0x37')]=function(_0x10b926,_0x213cf8,_0x32418e){var _0x5efb3b={'agent':{},'channel':_0x5d94('0x5e')};if(_0x10b926['body']['id']){delete _0x10b926[_0x5d94('0x5a')]['id'];}_0x10b926['body']['UserId']=_0x10b926[_0x5d94('0x5a')][_0x5d94('0x63')]||_0x10b926[_0x5d94('0x64')]['id'];_0x5efb3b[_0x5d94('0x65')]['id']=_0x10b926[_0x5d94('0x5a')][_0x5d94('0x63')];return db['SmsMessage']['find']({'where':{'id':_0x10b926[_0x5d94('0x5b')]['id'],'UserId':null}})[_0x5d94('0x23')](handleEntityNotFound(_0x213cf8,null))[_0x5d94('0x23')](function(_0x2c9f60){if(_0x2c9f60){_0x5efb3b[_0x5d94('0x2c')]=_0x2c9f60[_0x5d94('0x66')]({'plain':!![]});return db[_0x5d94('0x67')]['find']({'where':{'id':_0x2c9f60[_0x5d94('0x68')]}});}return null;})[_0x5d94('0x23')](handleEntityNotFound(_0x213cf8,null))[_0x5d94('0x23')](function(_0x2b8715){if(_0x2b8715){_0x5efb3b[_0x5d94('0x6b')]=_0x2b8715['get']({'plain':!![]});interaction_log[_0x5d94('0x24')](_0x5d94('0x7e'),_0x10b926[_0x5d94('0x64')]['id'],_0x10b926[_0x5d94('0x64')]['name'],_0x10b926[_0x5d94('0x64')][_0x5d94('0x6c')],_0x5efb3b[_0x5d94('0x6b')]['id'],_0x10b926[_0x5d94('0x5a')]?JSON[_0x5d94('0x29')](_0x10b926[_0x5d94('0x5a')]):_0x5d94('0x6d'));return respondWithRpcPromise(_0x5d94('0x7f'),_0x5d94('0x80'),_0x5efb3b);}return null;})[_0x5d94('0x23')](function(_0x4078ba){var _0x151891=_0x5d94('0x70')+_0x4078ba['message']['ContactId'];return db[_0x5d94('0x72')][_0x5d94('0x43')](_0x151891,{'type':db[_0x5d94('0x81')][_0x5d94('0x82')][_0x5d94('0x73')],'raw':!![]})[_0x5d94('0x23')](function(_0x2f37e3){return _0x2f37e3;});})[_0x5d94('0x23')](function(_0x411b1b){if(_0x411b1b){_0x5efb3b[_0x5d94('0x2c')]['contact']=_0x411b1b[0x0];if(!_0x10b926['body'][_0x5d94('0x63')])return;return db['User']['find']({'where':{'id':_0x10b926['body']['UserId'],'role':_0x5d94('0x65')},'attributes':['id','name',_0x5d94('0x83'),'email',_0x5d94('0x84')],'raw':!![]});}return null;})[_0x5d94('0x23')](function(_0x3b8904){if(!_0x3b8904)return null;_0x5efb3b[_0x5d94('0x2c')]['agent']=_0x3b8904;return _0x5efb3b;})[_0x5d94('0x23')](function(_0x54530f){if(_0x54530f){_0x54530f[_0x5d94('0x2c')][_0x5d94('0x85')]=util[_0x5d94('0x61')](_0x5d94('0x77'),_0x10b926['user'][_0x5d94('0x3b')]);_0x54530f[_0x5d94('0x2c')][_0x5d94('0x78')]=_0x5efb3b[_0x5d94('0x78')];_0x54530f[_0x5d94('0x2c')][_0x5d94('0x79')]=_0x5efb3b['channel'];_0x54530f[_0x5d94('0x2c')][_0x5d94('0x7a')]=_0x5d94('0x37');respondWithRpcPromise('EventManager',_0x5d94('0x7b'),{'event':_0x5d94('0x86'),'message':_0x54530f[_0x5d94('0x2c')]},client9002);return _0x5efb3b;}return null;})[_0x5d94('0x23')](respondWithResult(_0x213cf8,null))[_0x5d94('0x2e')](handleError(_0x213cf8,null));};exports['status']=function(_0x5026de,_0xa324ac,_0x391d76){if(_0x5026de['body']['id']){delete _0x5026de[_0x5d94('0x5a')]['id'];}var _0x6381da;return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x5026de['params']['id']}})[_0x5d94('0x23')](handleEntityNotFound(_0xa324ac,null))[_0x5d94('0x23')](function(_0x59462f){if(_0x59462f){_0x6381da=_0x59462f;return db['SmsAccount'][_0x5d94('0x58')]({'where':{'id':_0x59462f[_0x5d94('0x87')]}});}})[_0x5d94('0x23')](handleEntityNotFound(_0xa324ac,null))[_0x5d94('0x23')](function(_0x138922){if(_0x138922){logger[_0x5d94('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x5d94('0x88'),_0x138922[_0x5d94('0x42')],util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));switch(_0x138922[_0x5d94('0x42')]){case _0x5d94('0x8a'):if(_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8b')]&&_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8b')]===_0x6381da[_0x5d94('0x8c')]){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger['error'](_0x5d94('0x8d'),'status',_0x5d94('0x8a'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x5d94('0x8e'):if(_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8f')]&&_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8f')]===_0x6381da[_0x5d94('0x8c')]&&_[_0x5d94('0x90')](['sent',_0x5d94('0x91')],_0x5026de[_0x5d94('0x5a')][_0x5d94('0x92')])>=0x0){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger[_0x5d94('0x2a')](_0x5d94('0x8d'),_0x5d94('0x30'),_0x5d94('0x93'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x5d94('0x94'):var _0x2b6ce5=_0x5026de[_0x5d94('0x5a')]['results'][0x0];if(_0x2b6ce5[_0x5d94('0x30')][_0x5d94('0x95')]==='DELIVERED'){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger['error'](_0x5d94('0x8d'),'status',_0x5d94('0x94'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x6381da;}})[_0x5d94('0x23')](respondWithResult(_0xa324ac,null))[_0x5d94('0x2e')](handleError(_0xa324ac,null));}; \ No newline at end of file +var _0x2d07=['[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','SIP/%s','event','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','SmsMessage','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','params','rawAttributes','keys','options','find','create','body','destroy','describe','../../config/logger','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','agent','interface','format','channel','motionChannel','EventManager','SmsInteractionId'];(function(_0x41f392,_0x2aa23c){var _0x3b42ae=function(_0x43711b){while(--_0x43711b){_0x41f392['push'](_0x41f392['shift']());}};_0x3b42ae(++_0x2aa23c);}(_0x2d07,0x13a));var _0x72d0=function(_0x1accf6,_0x4a9854){_0x1accf6=_0x1accf6-0x0;var _0x24e446=_0x2d07[_0x1accf6];return _0x24e446;};'use strict';var emlformat=require(_0x72d0('0x0'));var rimraf=require(_0x72d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d0('0x2'));var rp=require(_0x72d0('0x3'));var moment=require('moment');var BPromise=require(_0x72d0('0x4'));var Mustache=require(_0x72d0('0x5'));var util=require(_0x72d0('0x6'));var path=require(_0x72d0('0x7'));var sox=require(_0x72d0('0x8'));var csv=require(_0x72d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d0('0xa'));var _=require(_0x72d0('0xb'));var squel=require(_0x72d0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x72d0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72d0('0xe'));var authService=require(_0x72d0('0xf'));var qs=require(_0x72d0('0x10'));var as=require(_0x72d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x72d0('0x12'));var config=require(_0x72d0('0x13'));var licenseUtil=require(_0x72d0('0x14'));var db=require(_0x72d0('0x15'))['db'];config[_0x72d0('0x16')]=_['defaults'](config[_0x72d0('0x16')],{'host':_0x72d0('0x17'),'port':0x18eb});var socket=require(_0x72d0('0x18'))(new Redis(config['redis']));require(_0x72d0('0x19'))[_0x72d0('0x1a')](socket);var jayson=require(_0x72d0('0x1b'));var client=jayson[_0x72d0('0x1c')][_0x72d0('0x1d')]({'port':0x232c});var client9002=jayson[_0x72d0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2089,_0x197179,_0x1ea03f,_0x1ff740){return new BPromise(function(_0x2a761c,_0x1609aa){var _0x35184d=_0x1ff740||client;return _0x35184d[_0x72d0('0x1e')](_0x1e2089,_0x1ea03f)[_0x72d0('0x1f')](function(_0x4a9367){logger[_0x72d0('0x20')](_0x72d0('0x21'),_0x197179,_0x72d0('0x22'));logger[_0x72d0('0x23')](_0x72d0('0x24'),_0x197179,_0x72d0('0x22'),JSON['stringify'](_0x4a9367));if(_0x4a9367[_0x72d0('0x25')]){if(_0x4a9367['error']['code']===0x1f4){logger['error'](_0x72d0('0x21'),_0x197179,_0x4a9367[_0x72d0('0x25')]['message']);return _0x1609aa(_0x4a9367[_0x72d0('0x25')][_0x72d0('0x26')]);}logger['error'](_0x72d0('0x21'),_0x197179,_0x4a9367[_0x72d0('0x25')]['message']);return _0x2a761c(_0x4a9367[_0x72d0('0x25')][_0x72d0('0x26')]);}else{logger[_0x72d0('0x20')]('SmsMessage,\x20%s,\x20%s',_0x197179,_0x72d0('0x22'));_0x2a761c(_0x4a9367[_0x72d0('0x27')][_0x72d0('0x26')]);}})[_0x72d0('0x28')](function(_0x4bc137){logger[_0x72d0('0x25')](_0x72d0('0x21'),_0x197179,_0x4bc137);_0x1609aa(_0x4bc137);});});}function respondWithStatusCode(_0x1a11a1,_0x1c7627){_0x1c7627=_0x1c7627||0xcc;return function(_0x160e8f){if(_0x160e8f){return _0x1a11a1[_0x72d0('0x29')](_0x1c7627);}return _0x1a11a1[_0x72d0('0x2a')](_0x1c7627)['end']();};}function respondWithResult(_0x2ff68a,_0x4d8340){_0x4d8340=_0x4d8340||0xc8;return function(_0x20b9d){if(_0x20b9d){return _0x2ff68a[_0x72d0('0x2a')](_0x4d8340)[_0x72d0('0x2b')](_0x20b9d);}};}function respondWithFilteredResult(_0x2191db,_0xf53e37){return function(_0x4d4790){if(_0x4d4790){var _0x12a92b=typeof _0xf53e37[_0x72d0('0x2c')]==='undefined'&&typeof _0xf53e37[_0x72d0('0x2d')]===_0x72d0('0x2e');var _0x21e265=_0x4d4790['count'];var _0x3471e1=_0x12a92b?0x0:_0xf53e37[_0x72d0('0x2c')];var _0x4b5b0a=_0x12a92b?_0x4d4790[_0x72d0('0x2f')]:_0xf53e37['offset']+_0xf53e37[_0x72d0('0x2d')];var _0x2b2eb6;if(_0x4b5b0a>=_0x21e265){_0x4b5b0a=_0x21e265;_0x2b2eb6=0xc8;}else{_0x2b2eb6=0xce;}_0x2191db[_0x72d0('0x2a')](_0x2b2eb6);return _0x2191db[_0x72d0('0x30')](_0x72d0('0x31'),_0x3471e1+'-'+_0x4b5b0a+'/'+_0x21e265)[_0x72d0('0x2b')](_0x4d4790);}return null;};}function patchUpdates(_0x3b4459){return function(_0x3021a7){try{jsonpatch[_0x72d0('0x32')](_0x3021a7,_0x3b4459,!![]);}catch(_0x24437a){return BPromise[_0x72d0('0x33')](_0x24437a);}return _0x3021a7[_0x72d0('0x34')]();};}function saveUpdates(_0x4d6b63,_0x226235){return function(_0x313cad){if(_0x313cad){return _0x313cad[_0x72d0('0x35')](_0x4d6b63)[_0x72d0('0x1f')](function(_0x38b953){return _0x38b953;});}return null;};}function removeEntity(_0x28f0b3,_0x799946){return function(_0x129735){if(_0x129735){return _0x129735['destroy']()[_0x72d0('0x1f')](function(){_0x28f0b3[_0x72d0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8185,_0x28c1b9){return function(_0x38e712){if(!_0x38e712){_0x4f8185[_0x72d0('0x29')](0x194);}return _0x38e712;};}function handleError(_0x37b4a8,_0x1ffd9a){_0x1ffd9a=_0x1ffd9a||0x1f4;return function(_0xe79457){logger[_0x72d0('0x25')](_0xe79457[_0x72d0('0x36')]);if(_0xe79457[_0x72d0('0x37')]){delete _0xe79457[_0x72d0('0x37')];}_0x37b4a8[_0x72d0('0x2a')](_0x1ffd9a)[_0x72d0('0x38')](_0xe79457);};}exports[_0x72d0('0x39')]=function(_0xbb98c1,_0x4ae4fd){var _0x5266d2={},_0x37fa7f={},_0x1f2edb={'count':0x0,'rows':[]};var _0x5986e3=_[_0x72d0('0x3a')](db[_0x72d0('0x3b')]['rawAttributes'],function(_0x3a8a76){return{'name':_0x3a8a76[_0x72d0('0x3c')],'type':_0x3a8a76[_0x72d0('0x3d')]['key']};});_0x37fa7f[_0x72d0('0x3e')]=_['map'](_0x5986e3,'name');_0x37fa7f[_0x72d0('0x3f')]=_['keys'](_0xbb98c1[_0x72d0('0x3f')]);_0x37fa7f[_0x72d0('0x40')]=_[_0x72d0('0x41')](_0x37fa7f[_0x72d0('0x3e')],_0x37fa7f[_0x72d0('0x3f')]);_0x5266d2['attributes']=_[_0x72d0('0x41')](_0x37fa7f['model'],qs[_0x72d0('0x42')](_0xbb98c1[_0x72d0('0x3f')][_0x72d0('0x42')]));_0x5266d2[_0x72d0('0x43')]=_0x5266d2['attributes'][_0x72d0('0x44')]?_0x5266d2[_0x72d0('0x43')]:_0x37fa7f[_0x72d0('0x3e')];if(!_0xbb98c1[_0x72d0('0x3f')][_0x72d0('0x45')]('nolimit')){_0x5266d2['limit']=qs[_0x72d0('0x2d')](_0xbb98c1[_0x72d0('0x3f')]['limit']);_0x5266d2[_0x72d0('0x2c')]=qs[_0x72d0('0x2c')](_0xbb98c1['query'][_0x72d0('0x2c')]);}_0x5266d2[_0x72d0('0x46')]=qs[_0x72d0('0x47')](_0xbb98c1[_0x72d0('0x3f')][_0x72d0('0x47')]);_0x5266d2[_0x72d0('0x48')]=qs[_0x72d0('0x40')](_[_0x72d0('0x49')](_0xbb98c1[_0x72d0('0x3f')],_0x37fa7f[_0x72d0('0x40')]),_0x5986e3);if(_0xbb98c1['query']['filter']){_0x5266d2[_0x72d0('0x48')]=_['merge'](_0x5266d2['where'],{'$or':_[_0x72d0('0x3a')](_0x5986e3,function(_0x3dc0be){if(_0x3dc0be['type']!==_0x72d0('0x4a')){var _0x148531={};_0x148531[_0x3dc0be[_0x72d0('0x37')]]={'$like':'%'+_0xbb98c1['query']['filter']+'%'};return _0x148531;}})});}_0x5266d2=_[_0x72d0('0x4b')]({},_0x5266d2,_0xbb98c1['options']);var _0x3d02ae={'where':_0x5266d2['where']};return db[_0x72d0('0x3b')][_0x72d0('0x2f')](_0x3d02ae)[_0x72d0('0x1f')](function(_0x18d5bd){_0x1f2edb[_0x72d0('0x2f')]=_0x18d5bd;if(_0xbb98c1[_0x72d0('0x3f')][_0x72d0('0x4c')]){_0x5266d2[_0x72d0('0x4d')]=[{'all':!![]}];}return db[_0x72d0('0x3b')][_0x72d0('0x4e')](_0x5266d2);})['then'](function(_0x309b59){_0x1f2edb[_0x72d0('0x4f')]=_0x309b59;return _0x1f2edb;})['then'](respondWithFilteredResult(_0x4ae4fd,_0x5266d2))[_0x72d0('0x28')](handleError(_0x4ae4fd,null));};exports['show']=function(_0x2082bf,_0x586638){var _0x5c20d9={'raw':!![],'where':{'id':_0x2082bf[_0x72d0('0x50')]['id']}},_0x2b130f={};_0x2b130f[_0x72d0('0x3e')]=_['keys'](db[_0x72d0('0x3b')][_0x72d0('0x51')]);_0x2b130f['query']=_[_0x72d0('0x52')](_0x2082bf[_0x72d0('0x3f')]);_0x2b130f[_0x72d0('0x40')]=_[_0x72d0('0x41')](_0x2b130f[_0x72d0('0x3e')],_0x2b130f[_0x72d0('0x3f')]);_0x5c20d9[_0x72d0('0x43')]=_[_0x72d0('0x41')](_0x2b130f[_0x72d0('0x3e')],qs['fields'](_0x2082bf[_0x72d0('0x3f')]['fields']));_0x5c20d9['attributes']=_0x5c20d9[_0x72d0('0x43')][_0x72d0('0x44')]?_0x5c20d9[_0x72d0('0x43')]:_0x2b130f['model'];if(_0x2082bf[_0x72d0('0x3f')][_0x72d0('0x4c')]){_0x5c20d9[_0x72d0('0x4d')]=[{'all':!![]}];}_0x5c20d9=_[_0x72d0('0x4b')]({},_0x5c20d9,_0x2082bf[_0x72d0('0x53')]);return db[_0x72d0('0x3b')][_0x72d0('0x54')](_0x5c20d9)[_0x72d0('0x1f')](handleEntityNotFound(_0x586638,null))[_0x72d0('0x1f')](respondWithResult(_0x586638,null))[_0x72d0('0x28')](handleError(_0x586638,null));};exports[_0x72d0('0x55')]=function(_0x8ce6f3,_0x1d38cc){return db[_0x72d0('0x3b')][_0x72d0('0x55')](_0x8ce6f3['body'],{})[_0x72d0('0x1f')](respondWithResult(_0x1d38cc,0xc9))[_0x72d0('0x28')](handleError(_0x1d38cc,null));};exports[_0x72d0('0x35')]=function(_0x171c2d,_0x3c4cec){if(_0x171c2d[_0x72d0('0x56')]['id']){delete _0x171c2d[_0x72d0('0x56')]['id'];}return db[_0x72d0('0x3b')][_0x72d0('0x54')]({'where':{'id':_0x171c2d[_0x72d0('0x50')]['id']}})[_0x72d0('0x1f')](handleEntityNotFound(_0x3c4cec,null))['then'](saveUpdates(_0x171c2d[_0x72d0('0x56')],null))[_0x72d0('0x1f')](respondWithResult(_0x3c4cec,null))['catch'](handleError(_0x3c4cec,null));};exports[_0x72d0('0x57')]=function(_0x1abb7d,_0x4aeeca){return db['SmsMessage'][_0x72d0('0x54')]({'where':{'id':_0x1abb7d['params']['id']}})[_0x72d0('0x1f')](handleEntityNotFound(_0x4aeeca,null))[_0x72d0('0x1f')](removeEntity(_0x4aeeca,null))[_0x72d0('0x28')](handleError(_0x4aeeca,null));};exports[_0x72d0('0x58')]=function(_0x31d74e,_0x3b0590){return db[_0x72d0('0x3b')][_0x72d0('0x58')]()[_0x72d0('0x1f')](respondWithResult(_0x3b0590,null))[_0x72d0('0x28')](handleError(_0x3b0590,null));};var interaction_log=require(_0x72d0('0x59'))('sms-interactions');exports[_0x72d0('0x5a')]=function(_0x3f5a38,_0x43536c,_0x1761ed){var _0x12d5fe={'agent':{},'channel':_0x72d0('0x5b')};if(_0x3f5a38['body']['id']){delete _0x3f5a38[_0x72d0('0x56')]['id'];}_0x3f5a38[_0x72d0('0x56')][_0x72d0('0x5c')]=!![];_0x3f5a38[_0x72d0('0x56')]['readAt']=moment()['format'](_0x72d0('0x5d'));_0x3f5a38[_0x72d0('0x56')][_0x72d0('0x5e')]=_0x3f5a38['body'][_0x72d0('0x5e')]||_0x3f5a38[_0x72d0('0x5f')]['id'];_0x12d5fe['agent']['id']=_0x3f5a38['body']['UserId'];return db[_0x72d0('0x3b')][_0x72d0('0x54')]({'where':{'id':_0x3f5a38['params']['id'],'UserId':null}})[_0x72d0('0x1f')](handleEntityNotFound(_0x43536c,null))[_0x72d0('0x1f')](saveUpdates(_0x3f5a38[_0x72d0('0x56')],null))[_0x72d0('0x1f')](function(_0x42dc4a){if(_0x42dc4a){_0x12d5fe[_0x72d0('0x26')]=_0x42dc4a[_0x72d0('0x60')]({'plain':!![]});return db[_0x72d0('0x61')][_0x72d0('0x54')]({'where':{'id':_0x42dc4a['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x43536c,null))['then'](function(_0x346947){if(_0x346947){return _0x346947[_0x72d0('0x35')]({'UserId':_0x3f5a38[_0x72d0('0x56')][_0x72d0('0x5e')],'read1stAt':_['isNil'](_0x346947['read1stAt'])?moment()['format'](_0x72d0('0x5d')):undefined});}return null;})[_0x72d0('0x1f')](function(_0x1e5b4b){if(_0x1e5b4b){_0x12d5fe[_0x72d0('0x62')]=_0x1e5b4b[_0x72d0('0x60')]({'plain':!![]});interaction_log['info'](_0x72d0('0x63'),_0x3f5a38[_0x72d0('0x5f')]['id'],_0x3f5a38['user'][_0x72d0('0x37')],_0x3f5a38['user'][_0x72d0('0x64')],_0x12d5fe['interaction']['id'],_0x3f5a38[_0x72d0('0x56')]?JSON[_0x72d0('0x65')](_0x3f5a38[_0x72d0('0x56')]):_0x72d0('0x66'));return respondWithRpcPromise(_0x72d0('0x67'),_0x72d0('0x68'),_0x12d5fe);}return null;})[_0x72d0('0x1f')](function(_0x4c5136){var _0x5359e0=_0x72d0('0x69')+_0x4c5136[_0x72d0('0x26')][_0x72d0('0x6a')];return db[_0x72d0('0x6b')][_0x72d0('0x3f')](_0x5359e0,{'type':db[_0x72d0('0x6c')][_0x72d0('0x6d')][_0x72d0('0x6e')],'raw':!![]})['then'](function(_0x3508d6){return _0x3508d6;});})['then'](function(_0x1b6b66){if(_0x1b6b66){_0x12d5fe[_0x72d0('0x26')]['contact']=_0x1b6b66[0x0];if(!_0x3f5a38[_0x72d0('0x56')]['UserId'])return;return db[_0x72d0('0x6f')]['find']({'where':{'id':_0x3f5a38[_0x72d0('0x56')][_0x72d0('0x5e')],'role':'agent'},'attributes':['id',_0x72d0('0x37'),_0x72d0('0x70'),'email',_0x72d0('0x71')],'raw':!![]});}return null;})[_0x72d0('0x1f')](function(_0x331788){if(!_0x331788)return null;_0x12d5fe['message'][_0x72d0('0x72')]=_0x331788;return _0x12d5fe;})[_0x72d0('0x1f')](function(_0x4b3cd7){if(_0x4b3cd7){if(_0x3f5a38[_0x72d0('0x56')]['manual']){_0x12d5fe['message'][_0x72d0('0x73')]=util[_0x72d0('0x74')]('SIP/%s',_0x3f5a38[_0x72d0('0x5f')][_0x72d0('0x37')]);_0x12d5fe[_0x72d0('0x26')]['channel']=_0x12d5fe[_0x72d0('0x75')];_0x12d5fe[_0x72d0('0x26')][_0x72d0('0x76')]=_0x12d5fe[_0x72d0('0x75')];_0x12d5fe[_0x72d0('0x26')]['event']=_0x72d0('0x5a');return respondWithRpcPromise(_0x72d0('0x77'),_0x72d0('0x77'),{'event':'acceptmessage','message':_0x12d5fe[_0x72d0('0x26')]},client9002)[_0x72d0('0x1f')](function(){return _0x12d5fe;});}return _0x12d5fe;}return null;})[_0x72d0('0x1f')](respondWithResult(_0x43536c,null))[_0x72d0('0x28')](handleError(_0x43536c,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x72d0('0x33')]=function(_0x21e86b,_0x31cb17,_0x596181){var _0x2b5e7d={'agent':{},'channel':_0x72d0('0x5b')};if(_0x21e86b[_0x72d0('0x56')]['id']){delete _0x21e86b[_0x72d0('0x56')]['id'];}_0x21e86b[_0x72d0('0x56')][_0x72d0('0x5e')]=_0x21e86b[_0x72d0('0x56')][_0x72d0('0x5e')]||_0x21e86b['user']['id'];_0x2b5e7d[_0x72d0('0x72')]['id']=_0x21e86b[_0x72d0('0x56')][_0x72d0('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x21e86b['params']['id'],'UserId':null}})[_0x72d0('0x1f')](handleEntityNotFound(_0x31cb17,null))[_0x72d0('0x1f')](function(_0x36d307){if(_0x36d307){_0x2b5e7d[_0x72d0('0x26')]=_0x36d307[_0x72d0('0x60')]({'plain':!![]});return db[_0x72d0('0x61')][_0x72d0('0x54')]({'where':{'id':_0x36d307[_0x72d0('0x78')]}});}return null;})[_0x72d0('0x1f')](handleEntityNotFound(_0x31cb17,null))[_0x72d0('0x1f')](function(_0x560b62){if(_0x560b62){_0x2b5e7d['interaction']=_0x560b62[_0x72d0('0x60')]({'plain':!![]});interaction_log[_0x72d0('0x20')](_0x72d0('0x79'),_0x21e86b[_0x72d0('0x5f')]['id'],_0x21e86b[_0x72d0('0x5f')][_0x72d0('0x37')],_0x21e86b[_0x72d0('0x5f')][_0x72d0('0x64')],_0x2b5e7d[_0x72d0('0x62')]['id'],_0x21e86b['body']?JSON[_0x72d0('0x65')](_0x21e86b[_0x72d0('0x56')]):'null');return respondWithRpcPromise(_0x72d0('0x7a'),_0x72d0('0x7b'),_0x2b5e7d);}return null;})[_0x72d0('0x1f')](function(_0x8e21eb){var _0x2b0bb4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x8e21eb[_0x72d0('0x26')][_0x72d0('0x6a')];return db['sequelize'][_0x72d0('0x3f')](_0x2b0bb4,{'type':db['Sequelize'][_0x72d0('0x6d')][_0x72d0('0x6e')],'raw':!![]})[_0x72d0('0x1f')](function(_0x595bca){return _0x595bca;});})[_0x72d0('0x1f')](function(_0x26fe1a){if(_0x26fe1a){_0x2b5e7d[_0x72d0('0x26')]['contact']=_0x26fe1a[0x0];if(!_0x21e86b[_0x72d0('0x56')]['UserId'])return;return db[_0x72d0('0x6f')][_0x72d0('0x54')]({'where':{'id':_0x21e86b[_0x72d0('0x56')][_0x72d0('0x5e')],'role':_0x72d0('0x72')},'attributes':['id',_0x72d0('0x37'),'fullname',_0x72d0('0x7c'),_0x72d0('0x71')],'raw':!![]});}return null;})[_0x72d0('0x1f')](function(_0x4524f8){if(!_0x4524f8)return null;_0x2b5e7d[_0x72d0('0x26')][_0x72d0('0x72')]=_0x4524f8;return _0x2b5e7d;})[_0x72d0('0x1f')](function(_0x1de4c){if(_0x1de4c){_0x1de4c[_0x72d0('0x26')][_0x72d0('0x73')]=util[_0x72d0('0x74')](_0x72d0('0x7d'),_0x21e86b['user'][_0x72d0('0x37')]);_0x1de4c[_0x72d0('0x26')][_0x72d0('0x75')]=_0x2b5e7d[_0x72d0('0x75')];_0x1de4c['message'][_0x72d0('0x76')]=_0x2b5e7d[_0x72d0('0x75')];_0x1de4c['message'][_0x72d0('0x7e')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x1de4c[_0x72d0('0x26')]},client9002);return _0x2b5e7d;}return null;})[_0x72d0('0x1f')](respondWithResult(_0x31cb17,null))[_0x72d0('0x28')](handleError(_0x31cb17,null));};exports[_0x72d0('0x2a')]=function(_0x254550,_0x1a70c1,_0x555ebd){if(_0x254550[_0x72d0('0x56')]['id']){delete _0x254550[_0x72d0('0x56')]['id'];}var _0xfa27e5;return db[_0x72d0('0x3b')]['find']({'where':{'id':_0x254550[_0x72d0('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a70c1,null))[_0x72d0('0x1f')](function(_0x2159f8){if(_0x2159f8){_0xfa27e5=_0x2159f8;return db[_0x72d0('0x7f')][_0x72d0('0x54')]({'where':{'id':_0x2159f8[_0x72d0('0x80')]}});}})[_0x72d0('0x1f')](handleEntityNotFound(_0x1a70c1,null))['then'](function(_0x36e4f4){if(_0x36e4f4){logger[_0x72d0('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72d0('0x2a'),_0x72d0('0x81'),_0x36e4f4[_0x72d0('0x3d')],util['inspect'](_0x254550['body'],{'showHidden':![],'depth':null}));switch(_0x36e4f4['type']){case _0x72d0('0x82'):if(_0x254550[_0x72d0('0x56')][_0x72d0('0x83')]&&_0x254550['body'][_0x72d0('0x83')]===_0xfa27e5[_0x72d0('0x84')]){return _0xfa27e5[_0x72d0('0x35')]({'read':!![]});}else{logger[_0x72d0('0x25')](_0x72d0('0x85'),'status',_0x72d0('0x82'),util[_0x72d0('0x86')](_0x254550['body'],{'showHidden':![],'depth':null}));}break;case _0x72d0('0x87'):if(_0x254550[_0x72d0('0x56')]['MessageUUID']&&_0x254550[_0x72d0('0x56')][_0x72d0('0x88')]===_0xfa27e5['messageId']&&_[_0x72d0('0x89')]([_0x72d0('0x8a'),_0x72d0('0x8b')],_0x254550['body'][_0x72d0('0x8c')])>=0x0){return _0xfa27e5[_0x72d0('0x35')]({'read':!![]});}else{logger[_0x72d0('0x25')](_0x72d0('0x85'),_0x72d0('0x2a'),_0x72d0('0x8d'),util[_0x72d0('0x86')](_0x254550[_0x72d0('0x56')],{'showHidden':![],'depth':null}));}break;case _0x72d0('0x8e'):var _0x2252a1=_0x254550[_0x72d0('0x56')][_0x72d0('0x8f')][0x0];if(_0x2252a1['status'][_0x72d0('0x90')]==='DELIVERED'){return _0xfa27e5['update']({'read':!![]});}else{logger[_0x72d0('0x25')](_0x72d0('0x85'),_0x72d0('0x2a'),_0x72d0('0x8e'),util[_0x72d0('0x86')](_0x254550[_0x72d0('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xfa27e5;}})['then'](respondWithResult(_0x1a70c1,null))['catch'](handleError(_0x1a70c1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a434a3a..ca1c2a3 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 _0x2499=['update','remove','emit','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x2680f5,_0x5162f2){var _0xf6e72c=function(_0x561a5e){while(--_0x561a5e){_0x2680f5['push'](_0x2680f5['shift']());}};_0xf6e72c(++_0x5162f2);}(_0x2499,0x154));var _0x9249=function(_0x579d2b,_0x361e3e){_0x579d2b=_0x579d2b-0x0;var _0x1582c7=_0x2499[_0x579d2b];return _0x1582c7;};'use strict';var EventEmitter=require(_0x9249('0x0'));var SmsMessage=require(_0x9249('0x1'))['db'][_0x9249('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9249('0x3'),'afterUpdate':_0x9249('0x4'),'afterDestroy':_0x9249('0x5')};function emitEvent(_0x17ac4f){return function(_0x4d9608,_0x6270ba,_0x2ec75b){SmsMessageEvents[_0x9249('0x6')](_0x17ac4f+':'+_0x4d9608['id'],_0x4d9608);SmsMessageEvents[_0x9249('0x6')](_0x17ac4f,_0x4d9608);_0x2ec75b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9249('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x0f98=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x0f98,0x16b));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x80f9('0x0'));var SmsMessage=require(_0x80f9('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x80f9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x80f9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x393daf){return function(_0x26b1d2,_0xce03db,_0x1aa2bc){SmsMessageEvents[_0x80f9('0x4')](_0x393daf+':'+_0x26b1d2['id'],_0x26b1d2);SmsMessageEvents[_0x80f9('0x4')](_0x393daf,_0x26b1d2);_0x1aa2bc(null);};}for(var e in events){if(events[_0x80f9('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x80f9('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1850ff5..7f22221 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 _0x5c76=['Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','md5','digest','hex','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','models','get','direction','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','toLowerCase','catch','error','SmsAccount','SmsAccountId','type','twilio','phone','authToken','messages','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','read','inspect','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','base64','data','queued_count','head','message_id','clickSend','plivo','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','remote','IBSSO\x20'];(function(_0x16373a,_0x153a03){var _0x2d114f=function(_0x3de29a){while(--_0x3de29a){_0x16373a['push'](_0x16373a['shift']());}};_0x2d114f(++_0x153a03);}(_0x5c76,0x112));var _0x65c7=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x5c76[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x65c7('0x0'));var util=require(_0x65c7('0x1'));var logger=require(_0x65c7('0x2'))(_0x65c7('0x3'));var moment=require(_0x65c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x65c7('0x5'));var rimraf=require(_0x65c7('0x6'));var config=require(_0x65c7('0x7'));var attributes=require(_0x65c7('0x8'));module[_0x65c7('0x9')]=function(_0x57d80c,_0x2c6d65){return _0x57d80c[_0x65c7('0xa')]('SmsMessage',attributes,{'tableName':_0x65c7('0xb'),'paranoid':![],'indexes':[{'name':_0x65c7('0xc'),'fields':['messageId']},{'name':_0x65c7('0xd'),'fields':[_0x65c7('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e4d3a,_0x3988cf,_0x55fd44){var _0x3ca59e=_0x57d80c[_0x65c7('0xf')];var _0x14bcb6=_0x3e4d3a[_0x65c7('0x10')]({'plain':!![]});if(_0x14bcb6[_0x65c7('0x11')]['toLowerCase']()==='in'||_0x14bcb6[_0x65c7('0x11')]['toLowerCase']()===_0x65c7('0x12')&&!_0x14bcb6[_0x65c7('0x13')]&&!_['isNil'](_0x14bcb6[_0x65c7('0x14')])&&!_[_0x65c7('0x15')](_0x14bcb6[_0x65c7('0x16')])){_0x3ca59e[_0x65c7('0x17')][_0x65c7('0x18')]({'where':{'id':_0x14bcb6[_0x65c7('0x16')]}})[_0x65c7('0x19')](function(_0x1d929c){if(_0x1d929c){_0x1d929c[_0x65c7('0x1a')]({'lastMsgAt':_0x14bcb6[_0x65c7('0x1b')],'lastMsgDirection':_0x14bcb6[_0x65c7('0x11')][_0x65c7('0x1c')]()});}})[_0x65c7('0x1d')](function(_0x553e57){console[_0x65c7('0x1e')](_0x553e57);});}if(_0x14bcb6['direction']==='out'&&!_0x14bcb6[_0x65c7('0x13')]){var _0x4b324c;_0x3ca59e[_0x65c7('0x1f')]['find']({'where':{'id':_0x14bcb6[_0x65c7('0x20')]},'raw':!![]})[_0x65c7('0x19')](function(_0x36f540){_0x4b324c=_0x36f540;if(_0x4b324c&&_0x4b324c[_0x65c7('0x21')]){switch(_0x4b324c[_0x65c7('0x21')]){case _0x65c7('0x22'):var _0x2a8706=require(_0x65c7('0x22'));if(_0x4b324c['accountSid']&&_0x4b324c['authToken']&&_0x4b324c[_0x65c7('0x23')]){var _0x2582e6=new _0x2a8706(_0x4b324c['accountSid'],_0x4b324c[_0x65c7('0x24')]);_0x2582e6[_0x65c7('0x25')]['create']({'body':_0x14bcb6[_0x65c7('0xe')],'to':_0x14bcb6[_0x65c7('0x23')],'from':_0x4b324c[_0x65c7('0x23')],'statusCallback':_0x4b324c['remote']+_0x65c7('0x26')+_0x14bcb6['id']+'/status?token='+_0x4b324c[_0x65c7('0x27')]})[_0x65c7('0x19')](function(_0x55a335){if(_0x55a335[_0x65c7('0x28')]){return _0x3e4d3a['update']({'messageId':_0x55a335[_0x65c7('0x28')]});}})[_0x65c7('0x1d')](function(_0x30deac){logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x22'),util['inspect'](_0x30deac,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c7('0x2a'),'twilio',_0x65c7('0x2b'));}break;case'skebby':var _0x2e4532='https://api.skebby.it/API/v1.0/REST/';if(_0x4b324c[_0x65c7('0x2c')]&&_0x4b324c[_0x65c7('0x2d')]){var _0x53af7d={'recipient':[_0x14bcb6[_0x65c7('0x23')]],'message':_0x14bcb6[_0x65c7('0xe')],'message_type':_0x4b324c[_0x65c7('0x2e')]};if(_0x4b324c[_0x65c7('0x2e')]&&_0x4b324c[_0x65c7('0x2e')]!=='SI'){_0x53af7d[_0x65c7('0x2f')]=_0x4b324c['phone'];}var _0x53844f={'url':_0x2e4532+_0x65c7('0x30')+_0x4b324c[_0x65c7('0x2c')]+_0x65c7('0x31')+_0x4b324c['password'],'method':'GET'};rp(_0x53844f)[_0x65c7('0x19')](function(_0x12823b){var _0xf70dd4=_0x12823b[_0x65c7('0x32')](';');var _0x45216c={'user_key':_0xf70dd4[0x0],'session_key':_0xf70dd4[0x1]};_0x53844f={'url':_0x2e4532+_0x65c7('0x33'),'method':_0x65c7('0x34'),'headers':{'user_key':_0x45216c['user_key'],'Session_key':_0x45216c[_0x65c7('0x35')]},'json':!![],'body':_0x53af7d};return rp(_0x53844f);})[_0x65c7('0x19')](function(_0x5add9c){if(_0x5add9c[_0x65c7('0x36')]>=0x1){var _0x52cfda={'messageId':_0x5add9c[_0x65c7('0x37')]};if(_0x4b324c['smsMethod']!=='GP'||!_0x4b324c['deliveryReport']){_0x52cfda[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x52cfda);}else{return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),'skebby',util[_0x65c7('0x39')](_0x5add9c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1fc5b8){return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x3a'),util[_0x65c7('0x39')](_0x1fc5b8,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c7('0x2a'),_0x65c7('0x3a'),_0x65c7('0x3b'));}break;case _0x65c7('0x3c'):if(_0x4b324c[_0x65c7('0x24')]){var _0xc7b212={'recipient':_0x14bcb6[_0x65c7('0x23')],'message':_0x14bcb6[_0x65c7('0xe')],'sender':_0x4b324c[_0x65c7('0x3d')]||_0x4b324c[_0x65c7('0x23')],'authorization':_0x4b324c[_0x65c7('0x24')]};var _0x3988cf={'method':_0x65c7('0x34'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xc7b212,'json':!![]};rp(_0x3988cf)[_0x65c7('0x19')](function(_0x18dd8c){var _0x25a0eb={'messageId':_0x18dd8c['requestid']};if(!_0x4b324c[_0x65c7('0x3e')]){_0x25a0eb[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x25a0eb);})[_0x65c7('0x1d')](function(_0x3cf47e){logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x3c'),util[_0x65c7('0x39')](_0x3cf47e,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x3c'),_0x65c7('0x3f'));}break;case _0x65c7('0x40'):if(_0x4b324c['username']&&_0x4b324c[_0x65c7('0x2d')]){var _0xc7b212={'messages':[{'source':_0x65c7('0x41'),'to':_0x14bcb6[_0x65c7('0x23')],'body':_0x14bcb6['body'],'from':_0x4b324c[_0x65c7('0x3d')]||_0x4b324c[_0x65c7('0x23')]}]};var _0x599066=util[_0x65c7('0x42')](_0x65c7('0x43'),_0x4b324c[_0x65c7('0x2c')],_0x4b324c[_0x65c7('0x2d')]);var _0x3988cf={'method':_0x65c7('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xc7b212,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x599066)['toString'](_0x65c7('0x44')))},'json':!![]};rp(_0x3988cf)[_0x65c7('0x19')](function(_0x38c0f9){if(_0x38c0f9['http_code']>=0xc8&&_0x38c0f9['http_code']<=0xce){if(_0x38c0f9[_0x65c7('0x45')]&&_0x38c0f9[_0x65c7('0x45')][_0x65c7('0x46')]>0x0){var _0x137e05=_[_0x65c7('0x47')](_0x38c0f9[_0x65c7('0x45')]['messages']);var _0x524b62={'messageId':_0x137e05[_0x65c7('0x48')]};if(!_0x4b324c[_0x65c7('0x3e')]){_0x524b62[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x524b62);}else{logger[_0x65c7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65c7('0x49'),util[_0x65c7('0x39')](_0x38c0f9,{'showHidden':![],'depth':null}));}}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x49'),util['inspect'](_0x38c0f9,{'showHidden':![],'depth':null}));}})[_0x65c7('0x1d')](function(_0x37b06e){logger['error'](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x49'),util['inspect'](_0x37b06e,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x49'),_0x65c7('0x3b'));}break;case _0x65c7('0x4a'):if(_0x4b324c['authId']&&_0x4b324c[_0x65c7('0x24')]){var _0xc7b212={'dst':_0x14bcb6[_0x65c7('0x23')],'text':_0x14bcb6[_0x65c7('0xe')],'src':_0x4b324c['senderString']||_0x4b324c['phone'],'url':_0x4b324c['remote']+'/api/sms/messages/'+_0x14bcb6['id']+_0x65c7('0x4b')+_0x4b324c[_0x65c7('0x27')]};var _0x599066=util[_0x65c7('0x42')](_0x65c7('0x43'),_0x4b324c[_0x65c7('0x4c')],_0x4b324c[_0x65c7('0x24')]);var _0x3988cf={'method':_0x65c7('0x34'),'uri':util[_0x65c7('0x42')](_0x65c7('0x4d'),_0x4b324c[_0x65c7('0x4c')]),'body':_0xc7b212,'headers':{'Authorization':util[_0x65c7('0x42')](_0x65c7('0x4e'),new Buffer(_0x599066)[_0x65c7('0x4f')](_0x65c7('0x44')))},'json':!![]};rp(_0x3988cf)['then'](function(_0x23936a){var _0x4dfdd1={'messageId':_0x23936a['message_uuid'][0x0]};return _0x3e4d3a[_0x65c7('0x1a')](_0x4dfdd1);})[_0x65c7('0x1d')](function(_0xeaccac){logger['error'](_0x65c7('0x29'),'afterCreate','plivo',util[_0x65c7('0x39')](_0xeaccac,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c7('0x2a'),'plivo',_0x65c7('0x50'));}break;case _0x65c7('0x51'):if(_0x4b324c[_0x65c7('0x2c')]&&_0x4b324c[_0x65c7('0x2d')]){if(_0x4b324c[_0x65c7('0x52')]){var _0x136694={'method':_0x65c7('0x34'),'uri':_0x4b324c[_0x65c7('0x52')]+'/auth/1/session','body':{'username':_0x4b324c[_0x65c7('0x2c')],'password':_0x4b324c['password']},'json':!![]};return rp(_0x136694)[_0x65c7('0x19')](function(_0x52c178){var _0xc5f4ab={'method':_0x65c7('0x34'),'uri':_0x4b324c[_0x65c7('0x52')]+_0x65c7('0x53'),'body':{'messages':[{'from':_0x4b324c['phone'],'destinations':[{'to':_0x14bcb6[_0x65c7('0x23')]}],'text':_0x14bcb6['body'],'notifyUrl':_0x4b324c[_0x65c7('0x54')]+_0x65c7('0x26')+_0x14bcb6['id']+_0x65c7('0x4b')+_0x4b324c[_0x65c7('0x27')],'notifyContentType':'application/json','callbackData':_0x4b324c[_0x65c7('0x23')]+';'+_0x14bcb6[_0x65c7('0xe')]}]},'headers':{'Authorization':_0x65c7('0x55')+_0x52c178[_0x65c7('0x27')]},'json':!![]};return rp(_0xc5f4ab)[_0x65c7('0x19')](function(_0x151318){if(_0x151318[_0x65c7('0x25')]){var _0x54e067={'messageId':_0x151318[_0x65c7('0x25')][0x0][_0x65c7('0xc')]};if(!_0x4b324c[_0x65c7('0x3e')]){_0x54e067[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x54e067);}else{return logger['error'](_0x65c7('0x29'),'afterCreate',_0x65c7('0x51'),util[_0x65c7('0x39')](_0x151318,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x585c94){return logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x51'),util[_0x65c7('0x39')](_0x585c94,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x51'),_0x65c7('0x56'));}}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x51'),_0x65c7('0x3b'));}break;case _0x65c7('0x57'):var _0xd34c70=require(_0x65c7('0x58'));if(_0x4b324c[_0x65c7('0x59')]){var _0x5e2056={};_0x5e2056[_0x65c7('0x5a')]=_0x4b324c['username'];_0x5e2056[_0x65c7('0x23')]=_0x14bcb6[_0x65c7('0x23')];_0x5e2056['sender']=_0x4b324c[_0x65c7('0x23')];_0x5e2056[_0x65c7('0x5b')]=_0x14bcb6[_0x65c7('0xe')];_0x5e2056[_0x65c7('0x5c')]=+new Date();var _0x3f2830='';var _0xacac33='';var _0x336385=Object[_0x65c7('0x5d')](_0x5e2056);_0x336385[_0x65c7('0x5e')]();for(var _0x2126b0=0x0;_0x2126b0<_0x336385['length'];_0x2126b0++){if(_0x3f2830!=''){_0x3f2830+='&';}_0x3f2830+=_0x336385[_0x2126b0]+'='+encodeURIComponent(_0x5e2056[_0x336385[_0x2126b0]]);_0xacac33+=_0x5e2056[_0x336385[_0x2126b0]];}_0xacac33+=_0x4b324c[_0x65c7('0x59')];_0xacac33=_0xd34c70['createHash'](_0x65c7('0x5f'))[_0x65c7('0x1a')](_0xacac33)[_0x65c7('0x60')](_0x65c7('0x61'));if(_0x3f2830!==''){_0x3f2830+='&';}_0x3f2830+=_0x65c7('0x62')+_0xacac33;var _0x53844f={'method':_0x65c7('0x63'),'uri':_0x4b324c[_0x65c7('0x52')]+'/external/get/send.php?'+_0x3f2830,'json':!![]};return rp(_0x53844f)['then'](function(_0x40936a){var _0x4fc76d=Object['keys'](_0x40936a);if(_0x40936a[_0x4fc76d[0x0]]['error']&&parseInt(_0x40936a[_0x4fc76d[0x0]]['error'])===0x0){var _0x5f5de5={'messageId':_0x40936a[_0x4fc76d[0x0]][_0x65c7('0x64')]};if(!_0x4b324c[_0x65c7('0x3e')]){_0x5f5de5[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x5f5de5);}else{return logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x57'),util['inspect'](_0x40936a['error'],{'showHidden':![],'depth':null}));}})[_0x65c7('0x1d')](function(_0x35f5fe){return logger['error'](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x57'),util[_0x65c7('0x39')](_0x35f5fe,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x57'),_0x65c7('0x65'));}break;case _0x65c7('0x66'):if(_0x4b324c[_0x65c7('0x59')]){var _0x4e9d68={'method':_0x65c7('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4b324c['apiKey']},'body':{'content':_0x14bcb6[_0x65c7('0xe')],'to':[_0x14bcb6['phone']],'from':_0x4b324c[_0x65c7('0x23')],'binary':![],'clientMessageId':_0x65c7('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x4e9d68)['then'](function(_0x2cbbe2){if(!_0x2cbbe2['error']){var _0x3e0212={'messageId':_0x2cbbe2[_0x65c7('0x25')][0x0][_0x65c7('0x68')]};if(!_0x4b324c[_0x65c7('0x3e')]){_0x3e0212[_0x65c7('0x38')]=!![];}return _0x3e4d3a[_0x65c7('0x1a')](_0x3e0212);}else{return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x66'),util[_0x65c7('0x39')](_0x2cbbe2['error'],{'showHidden':![],'depth':null}));}})[_0x65c7('0x1d')](function(_0x20f77b){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c7('0x2a'),_0x65c7('0x66'),util[_0x65c7('0x39')](_0x20f77b,{'showHidden':![],'depth':null}));});}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x66'),_0x65c7('0x65'));}break;case _0x65c7('0x69'):if(_0x4b324c['username']&&_0x4b324c[_0x65c7('0x2d')]){var _0x599066=util['format'](_0x65c7('0x43'),_0x4b324c[_0x65c7('0x2c')],_0x4b324c[_0x65c7('0x2d')]);var _0x3988cf={'method':_0x65c7('0x34'),'uri':_0x65c7('0x6a')+_0x4b324c[_0x65c7('0x6b')]+_0x65c7('0x6c'),'body':{'to':[_0x14bcb6['phone']],'text':_0x14bcb6[_0x65c7('0xe')],'from':_0x4b324c[_0x65c7('0x23')],'applicationId':_0x4b324c['applicationId']},'headers':{'Authorization':util[_0x65c7('0x42')](_0x65c7('0x4e'),new Buffer(_0x599066)[_0x65c7('0x4f')](_0x65c7('0x44')))},'json':!![]};rp(_0x3988cf)[_0x65c7('0x19')](function(_0x278c21){if(_0x278c21['id']){var _0x362571={'messageId':_0x278c21['id']};return _0x3e4d3a[_0x65c7('0x1a')](_0x362571);}else{logger[_0x65c7('0x1e')](_0x65c7('0x29'),'afterCreate',_0x65c7('0x69'),util[_0x65c7('0x39')](_0x278c21,{'showHidden':![],'depth':null}));}})[_0x65c7('0x1d')](function(_0xa28cd8){logger[_0x65c7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65c7('0x69'),util['inspect'](_0xa28cd8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65c7('0x69'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x65c7('0x6d'):if(_0x4b324c[_0x65c7('0x59')]){var _0xc68d32={};var _0x53844f={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x65c7('0x6e')+_0x4b324c[_0x65c7('0x59')],'Content-Type':_0x65c7('0x6f')},'body':{'from':_0x4b324c[_0x65c7('0x23')],'to':_0x14bcb6[_0x65c7('0x23')],'text':_0x14bcb6[_0x65c7('0xe')]},'json':!![]};return rp(_0x53844f)[_0x65c7('0x19')](function(_0x5064f6){if(_0x5064f6['code']==0xca){_0xc68d32[_0x65c7('0x70')]=_0x5064f6;var _0x2dc9f9={'method':'POST','uri':_0x65c7('0x71'),'headers':{'Authorization':_0x65c7('0x6e')+_0x4b324c['apiKey'],'Content-Type':_0x65c7('0x6f')},'body':{'refid':_0xc68d32['message'][_0x65c7('0x72')]},'json':!![]};return rp(_0x2dc9f9)[_0x65c7('0x19')](function(_0x124496){_0xc68d32[_0x65c7('0x73')]=_0x124496;var _0x3c43a4={'messageId':_0xc68d32[_0x65c7('0x70')][_0x65c7('0x72')],'read':!![]};return _0x3e4d3a['update'](_0x3c43a4);});}else{return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x6d'),util[_0x65c7('0x39')](_0x5064f6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49583d){return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),'intelepeer',util[_0x65c7('0x39')](_0x49583d,{'showHidden':![],'depth':null}));});}else{return logger[_0x65c7('0x1e')](_0x65c7('0x29'),_0x65c7('0x2a'),_0x65c7('0x6d'),_0x65c7('0x74'));}break;}}})[_0x65c7('0x75')](function(){_0x55fd44();});}else{_0x55fd44();}}},'charset':_0x65c7('0x76'),'collate':_0x65c7('0x77')});}; \ No newline at end of file +var _0x2eb0=['plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','login','text','timestamp','keys','sort','length','digest','hex','signature=','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','/messages','applicationId','Basic\x20%s','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','models','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','xCALLY\x20Motion','format','%s:%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x2eb0,0x9b));var _0x02eb=function(_0x109093,_0x4ee9cb){_0x109093=_0x109093-0x0;var _0x5047ac=_0x2eb0[_0x109093];return _0x5047ac;};'use strict';var _=require(_0x02eb('0x0'));var util=require('util');var logger=require(_0x02eb('0x1'))(_0x02eb('0x2'));var moment=require('moment');var BPromise=require(_0x02eb('0x3'));var rp=require(_0x02eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x02eb('0x5'));module['exports']=function(_0x220e97,_0x45d1b1){return _0x220e97[_0x02eb('0x6')](_0x02eb('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x02eb('0x8'),'fields':['messageId']},{'name':_0x02eb('0x9'),'fields':[_0x02eb('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b4187,_0x45a208,_0x58fcbd){var _0x1055f7=_0x220e97[_0x02eb('0xb')];var _0x4240a3=_0x4b4187['get']({'plain':!![]});if(_0x4240a3[_0x02eb('0xc')][_0x02eb('0xd')]()==='in'||_0x4240a3[_0x02eb('0xc')][_0x02eb('0xd')]()==='out'&&!_0x4240a3[_0x02eb('0xe')]&&!_[_0x02eb('0xf')](_0x4240a3[_0x02eb('0x10')])&&!_['isNil'](_0x4240a3[_0x02eb('0x11')])){_0x1055f7[_0x02eb('0x12')][_0x02eb('0x13')]({'where':{'id':_0x4240a3[_0x02eb('0x11')]}})[_0x02eb('0x14')](function(_0xd4cf46){if(_0xd4cf46){_0xd4cf46[_0x02eb('0x15')]({'lastMsgAt':_0x4240a3['createdAt'],'lastMsgDirection':_0x4240a3['direction']['toLowerCase']()});}})['catch'](function(_0x3641f3){console[_0x02eb('0x16')](_0x3641f3);});}if(_0x4240a3['direction']==='out'&&!_0x4240a3['secret']){var _0x3c534c;_0x1055f7[_0x02eb('0x17')]['find']({'where':{'id':_0x4240a3[_0x02eb('0x18')]},'raw':!![]})[_0x02eb('0x14')](function(_0x227c69){_0x3c534c=_0x227c69;if(_0x3c534c&&_0x3c534c[_0x02eb('0x19')]){switch(_0x3c534c['type']){case _0x02eb('0x1a'):var _0x525e87=require(_0x02eb('0x1a'));if(_0x3c534c[_0x02eb('0x1b')]&&_0x3c534c[_0x02eb('0x1c')]&&_0x3c534c[_0x02eb('0x1d')]){var _0x14617e=new _0x525e87(_0x3c534c[_0x02eb('0x1b')],_0x3c534c[_0x02eb('0x1c')]);_0x14617e[_0x02eb('0x1e')]['create']({'body':_0x4240a3[_0x02eb('0xa')],'to':_0x4240a3['phone'],'from':_0x3c534c[_0x02eb('0x1d')],'statusCallback':_0x3c534c[_0x02eb('0x1f')]+_0x02eb('0x20')+_0x4240a3['id']+_0x02eb('0x21')+_0x3c534c[_0x02eb('0x22')]})[_0x02eb('0x14')](function(_0x4d64e5){if(_0x4d64e5[_0x02eb('0x23')]){return _0x4b4187[_0x02eb('0x15')]({'messageId':_0x4d64e5[_0x02eb('0x23')]});}})[_0x02eb('0x24')](function(_0x16520b){logger[_0x02eb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x02eb('0x1a'),util['inspect'](_0x16520b,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x02eb('0x27'):var _0x5697de=_0x02eb('0x28');if(_0x3c534c['username']&&_0x3c534c[_0x02eb('0x29')]){var _0x2768e2={'recipient':[_0x4240a3[_0x02eb('0x1d')]],'message':_0x4240a3[_0x02eb('0xa')],'message_type':_0x3c534c[_0x02eb('0x2a')]};if(_0x3c534c[_0x02eb('0x2a')]&&_0x3c534c[_0x02eb('0x2a')]!=='SI'){_0x2768e2[_0x02eb('0x2b')]=_0x3c534c[_0x02eb('0x1d')];}var _0x1d4398={'url':_0x5697de+_0x02eb('0x2c')+_0x3c534c[_0x02eb('0x2d')]+_0x02eb('0x2e')+_0x3c534c['password'],'method':_0x02eb('0x2f')};rp(_0x1d4398)[_0x02eb('0x14')](function(_0x9d5565){var _0x42d5c8=_0x9d5565[_0x02eb('0x30')](';');var _0x2d41a1={'user_key':_0x42d5c8[0x0],'session_key':_0x42d5c8[0x1]};_0x1d4398={'url':_0x5697de+_0x02eb('0x31'),'method':_0x02eb('0x32'),'headers':{'user_key':_0x2d41a1[_0x02eb('0x33')],'Session_key':_0x2d41a1['session_key']},'json':!![],'body':_0x2768e2};return rp(_0x1d4398);})['then'](function(_0x182e4f){if(_0x182e4f[_0x02eb('0x34')]>=0x1){var _0x317415={'messageId':_0x182e4f[_0x02eb('0x35')]};if(_0x3c534c[_0x02eb('0x2a')]!=='GP'||!_0x3c534c[_0x02eb('0x36')]){_0x317415['read']=!![];}return _0x4b4187[_0x02eb('0x15')](_0x317415);}else{return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x27'),util[_0x02eb('0x37')](_0x182e4f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x11f3eb){return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x27'),util[_0x02eb('0x37')](_0x11f3eb,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x27'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x02eb('0x38'):if(_0x3c534c[_0x02eb('0x1c')]){var _0x119b65={'recipient':_0x4240a3[_0x02eb('0x1d')],'message':_0x4240a3['body'],'sender':_0x3c534c[_0x02eb('0x39')]||_0x3c534c['phone'],'authorization':_0x3c534c[_0x02eb('0x1c')]};var _0x45a208={'method':'POST','uri':_0x02eb('0x3a'),'body':_0x119b65,'json':!![]};rp(_0x45a208)['then'](function(_0x42238e){var _0x26237a={'messageId':_0x42238e[_0x02eb('0x3b')]};if(!_0x3c534c[_0x02eb('0x36')]){_0x26237a[_0x02eb('0x3c')]=!![];}return _0x4b4187[_0x02eb('0x15')](_0x26237a);})[_0x02eb('0x24')](function(_0x57a560){logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'connectel',util[_0x02eb('0x37')](_0x57a560,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x38'),'Missing\x20parameters:\x20authToken');}break;case _0x02eb('0x3d'):if(_0x3c534c[_0x02eb('0x2d')]&&_0x3c534c[_0x02eb('0x29')]){var _0x119b65={'messages':[{'source':_0x02eb('0x3e'),'to':_0x4240a3[_0x02eb('0x1d')],'body':_0x4240a3[_0x02eb('0xa')],'from':_0x3c534c[_0x02eb('0x39')]||_0x3c534c[_0x02eb('0x1d')]}]};var _0x30cb1a=util[_0x02eb('0x3f')](_0x02eb('0x40'),_0x3c534c[_0x02eb('0x2d')],_0x3c534c[_0x02eb('0x29')]);var _0x45a208={'method':_0x02eb('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x119b65,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x30cb1a)[_0x02eb('0x41')](_0x02eb('0x42')))},'json':!![]};rp(_0x45a208)[_0x02eb('0x14')](function(_0x190e55){if(_0x190e55[_0x02eb('0x43')]>=0xc8&&_0x190e55[_0x02eb('0x43')]<=0xce){if(_0x190e55[_0x02eb('0x44')]&&_0x190e55['data'][_0x02eb('0x45')]>0x0){var _0xbfa937=_[_0x02eb('0x46')](_0x190e55[_0x02eb('0x44')]['messages']);var _0x5dbd18={'messageId':_0xbfa937[_0x02eb('0x47')]};if(!_0x3c534c[_0x02eb('0x36')]){_0x5dbd18[_0x02eb('0x3c')]=!![];}return _0x4b4187['update'](_0x5dbd18);}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x48'),util[_0x02eb('0x37')](_0x190e55,{'showHidden':![],'depth':null}));}}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x48'),util[_0x02eb('0x37')](_0x190e55,{'showHidden':![],'depth':null}));}})[_0x02eb('0x24')](function(_0xc3abc9){logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'clickSend',util[_0x02eb('0x37')](_0xc3abc9,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x02eb('0x49'):if(_0x3c534c[_0x02eb('0x4a')]&&_0x3c534c[_0x02eb('0x1c')]){var _0x119b65={'dst':_0x4240a3['phone'],'text':_0x4240a3[_0x02eb('0xa')],'src':_0x3c534c[_0x02eb('0x39')]||_0x3c534c[_0x02eb('0x1d')],'url':_0x3c534c[_0x02eb('0x1f')]+_0x02eb('0x20')+_0x4240a3['id']+_0x02eb('0x21')+_0x3c534c['token']};var _0x30cb1a=util['format']('%s:%s',_0x3c534c[_0x02eb('0x4a')],_0x3c534c[_0x02eb('0x1c')]);var _0x45a208={'method':'POST','uri':util['format'](_0x02eb('0x4b'),_0x3c534c['authId']),'body':_0x119b65,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x30cb1a)[_0x02eb('0x41')]('base64'))},'json':!![]};rp(_0x45a208)[_0x02eb('0x14')](function(_0x3bf814){var _0x129e3c={'messageId':_0x3bf814['message_uuid'][0x0]};return _0x4b4187['update'](_0x129e3c);})[_0x02eb('0x24')](function(_0x52e17d){logger[_0x02eb('0x16')](_0x02eb('0x25'),'afterCreate',_0x02eb('0x49'),util[_0x02eb('0x37')](_0x52e17d,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x02eb('0x4c'):if(_0x3c534c[_0x02eb('0x2d')]&&_0x3c534c[_0x02eb('0x29')]){if(_0x3c534c[_0x02eb('0x4d')]){var _0x1f40cb={'method':'POST','uri':_0x3c534c[_0x02eb('0x4d')]+_0x02eb('0x4e'),'body':{'username':_0x3c534c[_0x02eb('0x2d')],'password':_0x3c534c[_0x02eb('0x29')]},'json':!![]};return rp(_0x1f40cb)[_0x02eb('0x14')](function(_0x5bbb35){var _0x54457a={'method':'POST','uri':_0x3c534c[_0x02eb('0x4d')]+_0x02eb('0x4f'),'body':{'messages':[{'from':_0x3c534c[_0x02eb('0x1d')],'destinations':[{'to':_0x4240a3['phone']}],'text':_0x4240a3[_0x02eb('0xa')],'notifyUrl':_0x3c534c['remote']+_0x02eb('0x20')+_0x4240a3['id']+_0x02eb('0x21')+_0x3c534c[_0x02eb('0x22')],'notifyContentType':_0x02eb('0x50'),'callbackData':_0x3c534c[_0x02eb('0x1d')]+';'+_0x4240a3[_0x02eb('0xa')]}]},'headers':{'Authorization':_0x02eb('0x51')+_0x5bbb35[_0x02eb('0x22')]},'json':!![]};return rp(_0x54457a)[_0x02eb('0x14')](function(_0x286036){if(_0x286036[_0x02eb('0x1e')]){var _0x204351={'messageId':_0x286036[_0x02eb('0x1e')][0x0]['messageId']};if(!_0x3c534c[_0x02eb('0x36')]){_0x204351[_0x02eb('0x3c')]=!![];}return _0x4b4187[_0x02eb('0x15')](_0x204351);}else{return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x4c'),util['inspect'](_0x286036,{'showHidden':![],'depth':null}));}});})[_0x02eb('0x24')](function(_0x109748){return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x4c'),util[_0x02eb('0x37')](_0x109748,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),'afterCreate',_0x02eb('0x4c'),_0x02eb('0x52'));}}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'infobip',_0x02eb('0x53'));}break;case'csc':var _0xc2b760=require('crypto');if(_0x3c534c['apiKey']){var _0x18f7ae={};_0x18f7ae[_0x02eb('0x54')]=_0x3c534c['username'];_0x18f7ae['phone']=_0x4240a3['phone'];_0x18f7ae[_0x02eb('0x2b')]=_0x3c534c[_0x02eb('0x1d')];_0x18f7ae[_0x02eb('0x55')]=_0x4240a3[_0x02eb('0xa')];_0x18f7ae[_0x02eb('0x56')]=+new Date();var _0xddd1b9='';var _0x1a1d4d='';var _0x15ff54=Object[_0x02eb('0x57')](_0x18f7ae);_0x15ff54[_0x02eb('0x58')]();for(var _0x90933a=0x0;_0x90933a<_0x15ff54[_0x02eb('0x59')];_0x90933a++){if(_0xddd1b9!=''){_0xddd1b9+='&';}_0xddd1b9+=_0x15ff54[_0x90933a]+'='+encodeURIComponent(_0x18f7ae[_0x15ff54[_0x90933a]]);_0x1a1d4d+=_0x18f7ae[_0x15ff54[_0x90933a]];}_0x1a1d4d+=_0x3c534c['apiKey'];_0x1a1d4d=_0xc2b760['createHash']('md5')[_0x02eb('0x15')](_0x1a1d4d)[_0x02eb('0x5a')](_0x02eb('0x5b'));if(_0xddd1b9!==''){_0xddd1b9+='&';}_0xddd1b9+=_0x02eb('0x5c')+_0x1a1d4d;var _0x1d4398={'method':_0x02eb('0x2f'),'uri':_0x3c534c[_0x02eb('0x4d')]+'/external/get/send.php?'+_0xddd1b9,'json':!![]};return rp(_0x1d4398)[_0x02eb('0x14')](function(_0x4cf97f){var _0x2b52cc=Object['keys'](_0x4cf97f);if(_0x4cf97f[_0x2b52cc[0x0]][_0x02eb('0x16')]&&parseInt(_0x4cf97f[_0x2b52cc[0x0]][_0x02eb('0x16')])===0x0){var _0x573ec7={'messageId':_0x4cf97f[_0x2b52cc[0x0]][_0x02eb('0x5d')]};if(!_0x3c534c[_0x02eb('0x36')]){_0x573ec7['read']=!![];}return _0x4b4187['update'](_0x573ec7);}else{return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x5e'),util[_0x02eb('0x37')](_0x4cf97f[_0x02eb('0x16')],{'showHidden':![],'depth':null}));}})[_0x02eb('0x24')](function(_0x36f272){return logger[_0x02eb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x02eb('0x26'),_0x02eb('0x5e'),util[_0x02eb('0x37')](_0x36f272,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x02eb('0x26'),_0x02eb('0x5e'),_0x02eb('0x5f'));}break;case _0x02eb('0x60'):if(_0x3c534c[_0x02eb('0x61')]){var _0x24e633={'method':'POST','uri':_0x02eb('0x62'),'headers':{'Authorization':_0x3c534c[_0x02eb('0x61')]},'body':{'content':_0x4240a3[_0x02eb('0xa')],'to':[_0x4240a3[_0x02eb('0x1d')]],'from':_0x3c534c[_0x02eb('0x1d')],'binary':![],'clientMessageId':_0x02eb('0x63'),'charset':_0x02eb('0x64')},'json':!![]};rp(_0x24e633)[_0x02eb('0x14')](function(_0x9ed6eb){if(!_0x9ed6eb[_0x02eb('0x16')]){var _0x51be67={'messageId':_0x9ed6eb['messages'][0x0]['apiMessageId']};if(!_0x3c534c[_0x02eb('0x36')]){_0x51be67[_0x02eb('0x3c')]=!![];}return _0x4b4187['update'](_0x51be67);}else{return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'clickatell',util['inspect'](_0x9ed6eb[_0x02eb('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xdff9b1){return logger[_0x02eb('0x16')](_0x02eb('0x25'),'afterCreate',_0x02eb('0x60'),util[_0x02eb('0x37')](_0xdff9b1,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x02eb('0x26'),_0x02eb('0x60'),_0x02eb('0x5f'));}break;case'bandwidth':if(_0x3c534c[_0x02eb('0x2d')]&&_0x3c534c[_0x02eb('0x29')]){var _0x30cb1a=util['format'](_0x02eb('0x40'),_0x3c534c[_0x02eb('0x2d')],_0x3c534c[_0x02eb('0x29')]);var _0x45a208={'method':_0x02eb('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3c534c['accountId']+_0x02eb('0x65'),'body':{'to':[_0x4240a3['phone']],'text':_0x4240a3['body'],'from':_0x3c534c['phone'],'applicationId':_0x3c534c[_0x02eb('0x66')]},'headers':{'Authorization':util[_0x02eb('0x3f')](_0x02eb('0x67'),new Buffer(_0x30cb1a)[_0x02eb('0x41')](_0x02eb('0x42')))},'json':!![]};rp(_0x45a208)[_0x02eb('0x14')](function(_0x43dba8){if(_0x43dba8['id']){var _0x2f15c1={'messageId':_0x43dba8['id']};return _0x4b4187[_0x02eb('0x15')](_0x2f15c1);}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x68'),util[_0x02eb('0x37')](_0x43dba8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ad7ce){logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'bandwidth',util['inspect'](_0x3ad7ce,{'showHidden':![],'depth':null}));});}else{logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x02eb('0x69'):if(_0x3c534c[_0x02eb('0x61')]){var _0xf487bb={};var _0x1d4398={'method':_0x02eb('0x32'),'uri':_0x02eb('0x6a'),'headers':{'Authorization':_0x02eb('0x6b')+_0x3c534c['apiKey'],'Content-Type':_0x02eb('0x50')},'body':{'from':_0x3c534c['phone'],'to':_0x4240a3[_0x02eb('0x1d')],'text':_0x4240a3['body']},'json':!![]};return rp(_0x1d4398)[_0x02eb('0x14')](function(_0x3cf902){if(_0x3cf902[_0x02eb('0x6c')]==0xca){_0xf487bb[_0x02eb('0x6d')]=_0x3cf902;var _0x425784={'method':_0x02eb('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x02eb('0x6b')+_0x3c534c[_0x02eb('0x61')],'Content-Type':_0x02eb('0x50')},'body':{'refid':_0xf487bb[_0x02eb('0x6d')][_0x02eb('0x6e')]},'json':!![]};return rp(_0x425784)[_0x02eb('0x14')](function(_0x242a6c){_0xf487bb['status']=_0x242a6c;var _0x2732f3={'messageId':_0xf487bb[_0x02eb('0x6d')][_0x02eb('0x6e')],'read':!![]};return _0x4b4187[_0x02eb('0x15')](_0x2732f3);});}else{return logger[_0x02eb('0x16')](_0x02eb('0x25'),_0x02eb('0x26'),'intelepeer',util[_0x02eb('0x37')](_0x3cf902,{'showHidden':![],'depth':null}));}})[_0x02eb('0x24')](function(_0x48066e){return logger['error'](_0x02eb('0x25'),_0x02eb('0x26'),_0x02eb('0x69'),util[_0x02eb('0x37')](_0x48066e,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x02eb('0x26'),'intelepeer',_0x02eb('0x6f'));}break;}}})['finally'](function(){_0x58fcbd();});}else{_0x58fcbd();}}},'charset':_0x02eb('0x70'),'collate':_0x02eb('0x71')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index febb5cb..4b10c49 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 _0x1fb7=['CreateSmsMessage','SmsMessage','create','body','options','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','info','result'];(function(_0x1577a7,_0x542b54){var _0x3618e2=function(_0x3300b6){while(--_0x3300b6){_0x1577a7['push'](_0x1577a7['shift']());}};_0x3618e2(++_0x542b54);}(_0x1fb7,0x17b));var _0x71fb=function(_0x52e9a1,_0x5ea77e){_0x52e9a1=_0x52e9a1-0x0;var _0x2d41aa=_0x1fb7[_0x52e9a1];return _0x2d41aa;};'use strict';var _=require(_0x71fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x71fb('0x1'));var rs=require(_0x71fb('0x2'));var fs=require('fs');var Redis=require(_0x71fb('0x3'));var db=require(_0x71fb('0x4'))['db'];var utils=require(_0x71fb('0x5'));var logger=require(_0x71fb('0x6'))(_0x71fb('0x7'));var config=require('../../config/environment');var jayson=require(_0x71fb('0x8'));var client=jayson[_0x71fb('0x9')][_0x71fb('0xa')]({'port':0x232a});config['redis']=_[_0x71fb('0xb')](config['redis'],{'host':_0x71fb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71fb('0xd')]));require(_0x71fb('0xe'))[_0x71fb('0xf')](socket);function respondWithRpcPromise(_0x5980ef,_0x4782df,_0x493e18){return new BPromise(function(_0x1769ad,_0x2b7c83){return client['request'](_0x5980ef,_0x493e18)[_0x71fb('0x10')](function(_0x614b7e){logger['info']('SmsMessage,\x20%s,\x20%s',_0x4782df,'request\x20sent');logger['debug'](_0x71fb('0x11'),_0x4782df,'request\x20sent',JSON['stringify'](_0x614b7e));if(_0x614b7e['error']){if(_0x614b7e[_0x71fb('0x12')][_0x71fb('0x13')]===0x1f4){logger['error'](_0x71fb('0x14'),_0x4782df,_0x614b7e['error'][_0x71fb('0x15')]);return _0x2b7c83(_0x614b7e[_0x71fb('0x12')][_0x71fb('0x15')]);}logger['error'](_0x71fb('0x14'),_0x4782df,_0x614b7e['error'][_0x71fb('0x15')]);return _0x1769ad(_0x614b7e['error'][_0x71fb('0x15')]);}else{logger[_0x71fb('0x16')](_0x71fb('0x14'),_0x4782df,'request\x20sent');_0x1769ad(_0x614b7e[_0x71fb('0x17')][_0x71fb('0x15')]);}})['catch'](function(_0x156c95){logger[_0x71fb('0x12')](_0x71fb('0x14'),_0x4782df,_0x156c95);_0x2b7c83(_0x156c95);});});}exports[_0x71fb('0x18')]=function(_0x4055af){var _0x3d0529=this;return new Promise(function(_0x2780d7,_0x23d5eb){return db[_0x71fb('0x19')][_0x71fb('0x1a')](_0x4055af[_0x71fb('0x1b')],{'raw':_0x4055af[_0x71fb('0x1c')]?_0x4055af[_0x71fb('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x58a4de){logger[_0x71fb('0x16')]('CreateSmsMessage',_0x4055af);logger[_0x71fb('0x1d')]('CreateSmsMessage',_0x4055af,JSON[_0x71fb('0x1e')](_0x58a4de));_0x2780d7(_0x58a4de);})['catch'](function(_0x2b152f){logger[_0x71fb('0x12')]('CreateSmsMessage',_0x2b152f['message'],_0x4055af);_0x23d5eb(_0x3d0529[_0x71fb('0x12')](0x1f4,_0x2b152f[_0x71fb('0x15')]));});});}; \ No newline at end of file +var _0xfb6a=['catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xfb6a,0x8e));var _0xafb6=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0xfb6a[_0x380af2];return _0x1789dc;};'use strict';var _=require(_0xafb6('0x0'));var util=require(_0xafb6('0x1'));var moment=require(_0xafb6('0x2'));var BPromise=require(_0xafb6('0x3'));var rs=require(_0xafb6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafb6('0x5'));var logger=require(_0xafb6('0x6'))(_0xafb6('0x7'));var config=require(_0xafb6('0x8'));var jayson=require(_0xafb6('0x9'));var client=jayson['client'][_0xafb6('0xa')]({'port':0x232a});config[_0xafb6('0xb')]=_[_0xafb6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xafb6('0xd'))(new Redis(config[_0xafb6('0xb')]));require(_0xafb6('0xe'))[_0xafb6('0xf')](socket);function respondWithRpcPromise(_0x3f6f18,_0x28ff54,_0x1c7156){return new BPromise(function(_0x5b3bd3,_0x497228){return client[_0xafb6('0x10')](_0x3f6f18,_0x1c7156)[_0xafb6('0x11')](function(_0x3cdd5d){logger[_0xafb6('0x12')](_0xafb6('0x13'),_0x28ff54,_0xafb6('0x14'));logger[_0xafb6('0x15')](_0xafb6('0x16'),_0x28ff54,_0xafb6('0x14'),JSON[_0xafb6('0x17')](_0x3cdd5d));if(_0x3cdd5d[_0xafb6('0x18')]){if(_0x3cdd5d[_0xafb6('0x18')][_0xafb6('0x19')]===0x1f4){logger[_0xafb6('0x18')](_0xafb6('0x13'),_0x28ff54,_0x3cdd5d[_0xafb6('0x18')][_0xafb6('0x1a')]);return _0x497228(_0x3cdd5d[_0xafb6('0x18')]['message']);}logger[_0xafb6('0x18')](_0xafb6('0x13'),_0x28ff54,_0x3cdd5d[_0xafb6('0x18')]['message']);return _0x5b3bd3(_0x3cdd5d[_0xafb6('0x18')][_0xafb6('0x1a')]);}else{logger[_0xafb6('0x12')]('SmsMessage,\x20%s,\x20%s',_0x28ff54,_0xafb6('0x14'));_0x5b3bd3(_0x3cdd5d[_0xafb6('0x1b')][_0xafb6('0x1a')]);}})[_0xafb6('0x1c')](function(_0x4c1f91){logger[_0xafb6('0x18')](_0xafb6('0x13'),_0x28ff54,_0x4c1f91);_0x497228(_0x4c1f91);});});}exports[_0xafb6('0x1d')]=function(_0x3d6e51){var _0x336ea9=this;return new Promise(function(_0x67465a,_0x170392){return db[_0xafb6('0x1e')][_0xafb6('0x1f')](_0x3d6e51[_0xafb6('0x20')],{'raw':_0x3d6e51[_0xafb6('0x21')]?_0x3d6e51['options']['raw']===undefined?!![]:![]:!![]})[_0xafb6('0x11')](function(_0x3c76a5){logger[_0xafb6('0x12')](_0xafb6('0x1d'),_0x3d6e51);logger[_0xafb6('0x15')](_0xafb6('0x1d'),_0x3d6e51,JSON[_0xafb6('0x17')](_0x3c76a5));_0x67465a(_0x3c76a5);})[_0xafb6('0x1c')](function(_0x2d404a){logger[_0xafb6('0x18')]('CreateSmsMessage',_0x2d404a[_0xafb6('0x1a')],_0x3d6e51);_0x170392(_0x336ea9['error'](0x1f4,_0x2d404a[_0xafb6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 15f1bd8..aa070d6 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 _0xdc1f=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x1c2a06,_0x36f834){var _0x1b9177=function(_0x2eacce){while(--_0x2eacce){_0x1c2a06['push'](_0x1c2a06['shift']());}};_0x1b9177(++_0x36f834);}(_0xdc1f,0x7b));var _0xfdc1=function(_0x178749,_0x535e4d){_0x178749=_0x178749-0x0;var _0x469359=_0xdc1f[_0x178749];return _0x469359;};'use strict';var SmsMessageEvents=require(_0xfdc1('0x0'));var events=[_0xfdc1('0x1'),_0xfdc1('0x2'),_0xfdc1('0x3')];function createListener(_0x1e358e,_0x34c8cf){return function(_0x1e6b49){_0x34c8cf[_0xfdc1('0x4')](_0x1e358e,_0x1e6b49);};}function removeListener(_0x31357b,_0x1c79e1){return function(){SmsMessageEvents[_0xfdc1('0x5')](_0x31357b,_0x1c79e1);};}exports[_0xfdc1('0x6')]=function(_0xdedb6){for(var _0x221184=0x0,_0x3280d4=events[_0xfdc1('0x7')];_0x221184<_0x3280d4;_0x221184++){var _0xff844e=events[_0x221184];var _0x589e1b=createListener(_0xfdc1('0x8')+_0xff844e,_0xdedb6);SmsMessageEvents['on'](_0xff844e,_0x589e1b);}}; \ No newline at end of file +var _0x8d30=['update','register','./smsMessage.events'];(function(_0x43b23b,_0x527248){var _0x52371c=function(_0x3637eb){while(--_0x3637eb){_0x43b23b['push'](_0x43b23b['shift']());}};_0x52371c(++_0x527248);}(_0x8d30,0xe3));var _0x08d3=function(_0x4794b5,_0x34efd1){_0x4794b5=_0x4794b5-0x0;var _0x1ff218=_0x8d30[_0x4794b5];return _0x1ff218;};'use strict';var SmsMessageEvents=require(_0x08d3('0x0'));var events=['save','remove',_0x08d3('0x1')];function createListener(_0x4a8f61,_0x4d85fb){return function(_0x487560){_0x4d85fb['emit'](_0x4a8f61,_0x487560);};}function removeListener(_0x6f79ba,_0x29c8b7){return function(){SmsMessageEvents['removeListener'](_0x6f79ba,_0x29c8b7);};}exports[_0x08d3('0x2')]=function(_0x3e63f7){for(var _0x3feea0=0x0,_0x1be40f=events['length'];_0x3feea0<_0x1be40f;_0x3feea0++){var _0x5d8777=events[_0x3feea0];var _0x33519b=createListener('smsMessage:'+_0x5d8777,_0x3e63f7);SmsMessageEvents['on'](_0x5d8777,_0x33519b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ff034be..9393beb 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 _0xf263=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x114236,_0x180266){var _0x569d0f=function(_0x21fc85){while(--_0x21fc85){_0x114236['push'](_0x114236['shift']());}};_0x569d0f(++_0x180266);}(_0xf263,0x12e));var _0x3f26=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0xf263[_0xf89c3];return _0x274fc8;};'use strict';var multer=require('multer');var util=require(_0x3f26('0x0'));var path=require(_0x3f26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f26('0x2'));var router=express[_0x3f26('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f26('0x4'));var interaction=require(_0x3f26('0x5'));var config=require(_0x3f26('0x6'));var controller=require('./smsQueue.controller');router[_0x3f26('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f26('0x8')]);router[_0x3f26('0x7')](_0x3f26('0x9'),auth[_0x3f26('0xa')](),controller[_0x3f26('0xb')]);router[_0x3f26('0x7')](_0x3f26('0xc'),auth[_0x3f26('0xa')](),controller['show']);router[_0x3f26('0x7')](_0x3f26('0xd'),auth[_0x3f26('0xa')](),controller[_0x3f26('0xe')]);router[_0x3f26('0x7')](_0x3f26('0xf'),auth['isAuthenticated'](),controller[_0x3f26('0x10')]);router[_0x3f26('0x7')](_0x3f26('0x11'),auth[_0x3f26('0xa')](),controller[_0x3f26('0x12')]);router[_0x3f26('0x13')]('/',auth['isAuthenticated'](),controller[_0x3f26('0x14')]);router[_0x3f26('0x13')]('/:id/teams',auth[_0x3f26('0xa')](),controller['addTeams']);router[_0x3f26('0x13')](_0x3f26('0x11'),auth[_0x3f26('0xa')](),controller[_0x3f26('0x15')]);router[_0x3f26('0x16')](_0x3f26('0xc'),auth[_0x3f26('0xa')](),controller[_0x3f26('0x17')]);router[_0x3f26('0x18')](_0x3f26('0xc'),auth[_0x3f26('0xa')](),controller[_0x3f26('0x19')]);router[_0x3f26('0x18')](_0x3f26('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3f26('0x18')](_0x3f26('0x11'),auth[_0x3f26('0xa')](),controller[_0x3f26('0x1a')]);module[_0x3f26('0x1b')]=router; \ No newline at end of file +var _0x00b4=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','multer','path','express','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x00b4,0x6d));var _0x400b=function(_0x57d5f2,_0x2685cd){_0x57d5f2=_0x57d5f2-0x0;var _0x37c74b=_0x00b4[_0x57d5f2];return _0x37c74b;};'use strict';var multer=require(_0x400b('0x0'));var util=require('util');var path=require(_0x400b('0x1'));var timeout=require('connect-timeout');var express=require(_0x400b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x400b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x400b('0x4')]('/',auth['isAuthenticated'](),controller[_0x400b('0x5')]);router[_0x400b('0x4')](_0x400b('0x6'),auth[_0x400b('0x7')](),controller[_0x400b('0x8')]);router[_0x400b('0x4')](_0x400b('0x9'),auth[_0x400b('0x7')](),controller[_0x400b('0xa')]);router[_0x400b('0x4')]('/:id/members',auth[_0x400b('0x7')](),controller[_0x400b('0xb')]);router[_0x400b('0x4')](_0x400b('0xc'),auth[_0x400b('0x7')](),controller[_0x400b('0xd')]);router[_0x400b('0x4')]('/:id/users',auth[_0x400b('0x7')](),controller[_0x400b('0xe')]);router[_0x400b('0xf')]('/',auth['isAuthenticated'](),controller[_0x400b('0x10')]);router[_0x400b('0xf')](_0x400b('0xc'),auth[_0x400b('0x7')](),controller[_0x400b('0x11')]);router[_0x400b('0xf')](_0x400b('0x12'),auth[_0x400b('0x7')](),controller[_0x400b('0x13')]);router['put'](_0x400b('0x9'),auth[_0x400b('0x7')](),controller[_0x400b('0x14')]);router['delete'](_0x400b('0x9'),auth[_0x400b('0x7')](),controller['destroy']);router[_0x400b('0x15')](_0x400b('0xc'),auth[_0x400b('0x7')](),controller[_0x400b('0x16')]);router[_0x400b('0x15')](_0x400b('0x12'),auth[_0x400b('0x7')](),controller[_0x400b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4e87c04..0b7173a 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 _0x9df2=['roundrobin','sequelize','exports','name','STRING','rrmemory'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x9df2,0x79));var _0x29df=function(_0x5363ff,_0x210df6){_0x5363ff=_0x5363ff-0x0;var _0x345c53=_0x9df2[_0x5363ff];return _0x345c53;};'use strict';var Sequelize=require(_0x29df('0x0'));module[_0x29df('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x29df('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x29df('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x29df('0x4'),'beepall',_0x29df('0x5'))}}; \ No newline at end of file +var _0xd7e8=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x245e44,_0x45aa22){var _0x4a005c=function(_0x2d34ee){while(--_0x2d34ee){_0x245e44['push'](_0x245e44['shift']());}};_0x4a005c(++_0x45aa22);}(_0xd7e8,0x1f0));var _0x8d7e=function(_0x878697,_0x40f4d4){_0x878697=_0x878697-0x0;var _0x1f125c=_0xd7e8[_0x878697];return _0x1f125c;};'use strict';var Sequelize=require(_0x8d7e('0x0'));module[_0x8d7e('0x1')]={'name':{'type':Sequelize[_0x8d7e('0x2')],'unique':_0x8d7e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8d7e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8d7e('0x5')](_0x8d7e('0x6'),_0x8d7e('0x7'),_0x8d7e('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 03117ad..08fcb7d 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x15210c,_0x317297){var _0x5809ee=function(_0x2b88dd){while(--_0x2b88dd){_0x15210c['push'](_0x15210c['shift']());}};_0x5809ee(++_0x317297);}(_0xdb28,0x106));var _0x8db2=function(_0x529d6f,_0x445e17){_0x529d6f=_0x529d6f-0x0;var _0x9fbf07=_0xdb28[_0x529d6f];return _0x9fbf07;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x1a574a,_0x5c1b4f){var _0x1d3ccb=function(_0x2d265a){while(--_0x2d265a){_0x1a574a['push'](_0x1a574a['shift']());}};_0x1d3ccb(++_0x5c1b4f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a649b,_0x3291c5){_0x4a649b=_0x4a649b-0x0;var _0x2dd32c=_0x5f2f[_0x4a649b];return _0x2dd32c;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index bfa1958..6a9a5fc 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 _0x91bf=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update'];(function(_0x53a65b,_0x4ab00c){var _0x544186=function(_0x5ba4e0){while(--_0x5ba4e0){_0x53a65b['push'](_0x53a65b['shift']());}};_0x544186(++_0x4ab00c);}(_0x91bf,0x165));var _0xf91b=function(_0x2f0158,_0x53eeda){_0x2f0158=_0x2f0158-0x0;var _0x528afe=_0x91bf[_0x2f0158];return _0x528afe;};'use strict';var EventEmitter=require(_0xf91b('0x0'));var SmsQueue=require(_0xf91b('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf91b('0x2'),'afterDestroy':_0xf91b('0x3')};function emitEvent(_0x59aa4e){return function(_0x130268,_0x497050,_0x3c1107){SmsQueueEvents[_0xf91b('0x4')](_0x59aa4e+':'+_0x130268['id'],_0x130268);SmsQueueEvents[_0xf91b('0x4')](_0x59aa4e,_0x130268);_0x3c1107(null);};}for(var e in events){if(events[_0xf91b('0x5')](e)){var event=events[e];SmsQueue[_0xf91b('0x6')](e,emitEvent(event));}}module[_0xf91b('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x30f2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove'];(function(_0x4b824a,_0x275d05){var _0x3779ab=function(_0x3de4e5){while(--_0x3de4e5){_0x4b824a['push'](_0x4b824a['shift']());}};_0x3779ab(++_0x275d05);}(_0x30f2,0x180));var _0x230f=function(_0x217e90,_0x149a52){_0x217e90=_0x217e90-0x0;var _0x23ffdf=_0x30f2[_0x217e90];return _0x23ffdf;};'use strict';var EventEmitter=require(_0x230f('0x0'));var SmsQueue=require(_0x230f('0x1'))['db'][_0x230f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x230f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x230f('0x4'),'afterDestroy':_0x230f('0x5')};function emitEvent(_0x5743f6){return function(_0x20d332,_0x2cfe01,_0x4c2ae1){SmsQueueEvents[_0x230f('0x6')](_0x5743f6+':'+_0x20d332['id'],_0x20d332);SmsQueueEvents[_0x230f('0x6')](_0x5743f6,_0x20d332);_0x4c2ae1(null);};}for(var e in events){if(events[_0x230f('0x7')](e)){var event=events[e];SmsQueue[_0x230f('0x8')](e,emitEvent(event));}}module[_0x230f('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 7513819..562d049 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 _0x7c50=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x7c50,0x135));var _0x07c5=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7c50[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x07c5('0x0'));var util=require(_0x07c5('0x1'));var logger=require(_0x07c5('0x2'))('api');var moment=require(_0x07c5('0x3'));var BPromise=require(_0x07c5('0x4'));var rp=require(_0x07c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07c5('0x6'));var config=require(_0x07c5('0x7'));var attributes=require(_0x07c5('0x8'));module[_0x07c5('0x9')]=function(_0x4c737a,_0x391993){return _0x4c737a['define'](_0x07c5('0xa'),attributes,{'tableName':_0x07c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x901e=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','api','bluebird','path'];(function(_0x1a5659,_0x1c48ef){var _0x1db53e=function(_0x172825){while(--_0x172825){_0x1a5659['push'](_0x1a5659['shift']());}};_0x1db53e(++_0x1c48ef);}(_0x901e,0x1b4));var _0xe901=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x901e[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xe901('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe901('0x1'));var moment=require('moment');var BPromise=require(_0xe901('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe901('0x3'));var rimraf=require('rimraf');var config=require(_0xe901('0x4'));var attributes=require(_0xe901('0x5'));module[_0xe901('0x6')]=function(_0x14018a,_0x332e44){return _0x14018a[_0xe901('0x7')](_0xe901('0x8'),attributes,{'tableName':_0xe901('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 19bbad2..bab1268 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 _0x0d8d=['model','GetSmsQueue','catch','ShowSmsQueue','SmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','findAll','options','raw','where','limit','include','map','attributes'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x0d8d,0x1e5));var _0xd0d8=function(_0x323878,_0x185d97){_0x323878=_0x323878-0x0;var _0xda4c45=_0x0d8d[_0x323878];return _0xda4c45;};'use strict';var _=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var moment=require(_0xd0d8('0x2'));var BPromise=require(_0xd0d8('0x3'));var rs=require(_0xd0d8('0x4'));var fs=require('fs');var Redis=require(_0xd0d8('0x5'));var db=require(_0xd0d8('0x6'))['db'];var utils=require(_0xd0d8('0x7'));var logger=require(_0xd0d8('0x8'))(_0xd0d8('0x9'));var config=require(_0xd0d8('0xa'));var jayson=require(_0xd0d8('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xd0d8('0xc')]=_[_0xd0d8('0xd')](config['redis'],{'host':_0xd0d8('0xe'),'port':0x18eb});var socket=require(_0xd0d8('0xf'))(new Redis(config[_0xd0d8('0xc')]));require('./smsQueue.socket')[_0xd0d8('0x10')](socket);function respondWithRpcPromise(_0x12acb6,_0x285c18,_0x51c000){return new BPromise(function(_0x2c9f55,_0x4beb75){return client[_0xd0d8('0x11')](_0x12acb6,_0x51c000)[_0xd0d8('0x12')](function(_0xcf3761){logger[_0xd0d8('0x13')](_0xd0d8('0x14'),_0x285c18,_0xd0d8('0x15'));logger[_0xd0d8('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x285c18,'request\x20sent',JSON[_0xd0d8('0x17')](_0xcf3761));if(_0xcf3761['error']){if(_0xcf3761[_0xd0d8('0x18')][_0xd0d8('0x19')]===0x1f4){logger[_0xd0d8('0x18')](_0xd0d8('0x14'),_0x285c18,_0xcf3761[_0xd0d8('0x18')][_0xd0d8('0x1a')]);return _0x4beb75(_0xcf3761[_0xd0d8('0x18')][_0xd0d8('0x1a')]);}logger[_0xd0d8('0x18')](_0xd0d8('0x14'),_0x285c18,_0xcf3761[_0xd0d8('0x18')][_0xd0d8('0x1a')]);return _0x2c9f55(_0xcf3761['error'][_0xd0d8('0x1a')]);}else{logger[_0xd0d8('0x13')](_0xd0d8('0x14'),_0x285c18,'request\x20sent');_0x2c9f55(_0xcf3761['result'][_0xd0d8('0x1a')]);}})['catch'](function(_0x131980){logger[_0xd0d8('0x18')](_0xd0d8('0x14'),_0x285c18,_0x131980);_0x4beb75(_0x131980);});});}exports['GetSmsQueue']=function(_0x57941b){var _0xd6ccb5=this;return new Promise(function(_0x2c30de,_0x4548ea){return db['SmsQueue'][_0xd0d8('0x1b')]({'raw':_0x57941b[_0xd0d8('0x1c')]?_0x57941b[_0xd0d8('0x1c')][_0xd0d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x57941b[_0xd0d8('0x1c')]?_0x57941b[_0xd0d8('0x1c')][_0xd0d8('0x1e')]||null:null,'attributes':_0x57941b[_0xd0d8('0x1c')]?_0x57941b[_0xd0d8('0x1c')]['attributes']||null:null,'limit':_0x57941b['options']?_0x57941b[_0xd0d8('0x1c')][_0xd0d8('0x1f')]||null:null,'include':_0x57941b[_0xd0d8('0x1c')]?_0x57941b['options'][_0xd0d8('0x20')]?_[_0xd0d8('0x21')](_0x57941b[_0xd0d8('0x1c')][_0xd0d8('0x20')],function(_0x2233d2){return{'model':db[_0x2233d2['model']],'as':_0x2233d2['as'],'attributes':_0x2233d2[_0xd0d8('0x22')],'include':_0x2233d2[_0xd0d8('0x20')]?_[_0xd0d8('0x21')](_0x2233d2['include'],function(_0x41ff72){return{'model':db[_0x41ff72[_0xd0d8('0x23')]],'as':_0x41ff72['as'],'attributes':_0x41ff72[_0xd0d8('0x22')],'include':_0x41ff72['include']?_[_0xd0d8('0x21')](_0x41ff72[_0xd0d8('0x20')],function(_0x531ce2){return{'model':db[_0x531ce2[_0xd0d8('0x23')]],'as':_0x531ce2['as'],'attributes':_0x531ce2[_0xd0d8('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd0d8('0x12')](function(_0x3225c5){logger[_0xd0d8('0x13')](_0xd0d8('0x24'),_0x57941b);logger[_0xd0d8('0x16')](_0xd0d8('0x24'),_0x57941b,JSON[_0xd0d8('0x17')](_0x3225c5));_0x2c30de(_0x3225c5);})[_0xd0d8('0x25')](function(_0x4fc5e0){logger[_0xd0d8('0x18')](_0xd0d8('0x24'),_0x4fc5e0[_0xd0d8('0x1a')],_0x57941b);_0x4548ea(_0xd6ccb5[_0xd0d8('0x18')](0x1f4,_0x4fc5e0['message']));});});};exports[_0xd0d8('0x26')]=function(_0x4f00f3){var _0x57f890=this;return new Promise(function(_0x4638dc,_0x52939d){return db[_0xd0d8('0x27')]['find']({'raw':_0x4f00f3[_0xd0d8('0x1c')]?_0x4f00f3[_0xd0d8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4f00f3[_0xd0d8('0x1c')]?_0x4f00f3[_0xd0d8('0x1c')]['where']||null:null,'attributes':_0x4f00f3['options']?_0x4f00f3[_0xd0d8('0x1c')][_0xd0d8('0x22')]||null:null,'include':_0x4f00f3['options']?_0x4f00f3['options']['include']?_['map'](_0x4f00f3[_0xd0d8('0x1c')][_0xd0d8('0x20')],function(_0x1b740c){return{'model':db[_0x1b740c[_0xd0d8('0x23')]],'as':_0x1b740c['as'],'attributes':_0x1b740c[_0xd0d8('0x22')],'include':_0x1b740c[_0xd0d8('0x20')]?_['map'](_0x1b740c[_0xd0d8('0x20')],function(_0x4d11d7){return{'model':db[_0x4d11d7[_0xd0d8('0x23')]],'as':_0x4d11d7['as'],'attributes':_0x4d11d7[_0xd0d8('0x22')],'include':_0x4d11d7[_0xd0d8('0x20')]?_['map'](_0x4d11d7['include'],function(_0x3507bd){return{'model':db[_0x3507bd[_0xd0d8('0x23')]],'as':_0x3507bd['as'],'attributes':_0x3507bd[_0xd0d8('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd0d8('0x12')](function(_0x2c0bf7){logger[_0xd0d8('0x13')](_0xd0d8('0x26'),_0x4f00f3);logger[_0xd0d8('0x16')](_0xd0d8('0x26'),_0x4f00f3,JSON[_0xd0d8('0x17')](_0x2c0bf7));_0x4638dc(_0x2c0bf7);})[_0xd0d8('0x25')](function(_0x280432){logger[_0xd0d8('0x18')](_0xd0d8('0x26'),_0x280432[_0xd0d8('0x1a')],_0x4f00f3);_0x52939d(_0x57f890[_0xd0d8('0x18')](0x1f4,_0x280432['message']));});});}; \ No newline at end of file +var _0x1420=['defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetSmsQueue','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x42cfea,_0x481fd1){var _0x1e2127=function(_0x524935){while(--_0x524935){_0x42cfea['push'](_0x42cfea['shift']());}};_0x1e2127(++_0x481fd1);}(_0x1420,0x1eb));var _0x0142=function(_0x5a7414,_0x925ad1){_0x5a7414=_0x5a7414-0x0;var _0xe6834a=_0x1420[_0x5a7414];return _0xe6834a;};'use strict';var _=require(_0x0142('0x0'));var util=require('util');var moment=require(_0x0142('0x1'));var BPromise=require(_0x0142('0x2'));var rs=require(_0x0142('0x3'));var fs=require('fs');var Redis=require(_0x0142('0x4'));var db=require(_0x0142('0x5'))['db'];var utils=require(_0x0142('0x6'));var logger=require(_0x0142('0x7'))('rpc');var config=require(_0x0142('0x8'));var jayson=require(_0x0142('0x9'));var client=jayson[_0x0142('0xa')][_0x0142('0xb')]({'port':0x232a});config[_0x0142('0xc')]=_[_0x0142('0xd')](config['redis'],{'host':_0x0142('0xe'),'port':0x18eb});var socket=require(_0x0142('0xf'))(new Redis(config[_0x0142('0xc')]));require(_0x0142('0x10'))[_0x0142('0x11')](socket);function respondWithRpcPromise(_0x3221e3,_0x22701,_0x180f80){return new BPromise(function(_0x48e087,_0x18d59c){return client['request'](_0x3221e3,_0x180f80)[_0x0142('0x12')](function(_0x49d688){logger[_0x0142('0x13')](_0x0142('0x14'),_0x22701,_0x0142('0x15'));logger[_0x0142('0x16')](_0x0142('0x17'),_0x22701,_0x0142('0x15'),JSON[_0x0142('0x18')](_0x49d688));if(_0x49d688['error']){if(_0x49d688[_0x0142('0x19')][_0x0142('0x1a')]===0x1f4){logger[_0x0142('0x19')]('SmsQueue,\x20%s,\x20%s',_0x22701,_0x49d688[_0x0142('0x19')]['message']);return _0x18d59c(_0x49d688[_0x0142('0x19')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x22701,_0x49d688[_0x0142('0x19')][_0x0142('0x1b')]);return _0x48e087(_0x49d688['error'][_0x0142('0x1b')]);}else{logger[_0x0142('0x13')](_0x0142('0x14'),_0x22701,_0x0142('0x15'));_0x48e087(_0x49d688[_0x0142('0x1c')]['message']);}})[_0x0142('0x1d')](function(_0x2434f3){logger[_0x0142('0x19')](_0x0142('0x14'),_0x22701,_0x2434f3);_0x18d59c(_0x2434f3);});});}exports['GetSmsQueue']=function(_0x536d94){var _0x437eb3=this;return new Promise(function(_0x2ee5b1,_0x487d5e){return db['SmsQueue'][_0x0142('0x1e')]({'raw':_0x536d94[_0x0142('0x1f')]?_0x536d94[_0x0142('0x1f')][_0x0142('0x20')]===undefined?!![]:![]:!![],'where':_0x536d94[_0x0142('0x1f')]?_0x536d94[_0x0142('0x1f')][_0x0142('0x21')]||null:null,'attributes':_0x536d94[_0x0142('0x1f')]?_0x536d94[_0x0142('0x1f')][_0x0142('0x22')]||null:null,'limit':_0x536d94[_0x0142('0x1f')]?_0x536d94[_0x0142('0x1f')][_0x0142('0x23')]||null:null,'include':_0x536d94[_0x0142('0x1f')]?_0x536d94[_0x0142('0x1f')]['include']?_['map'](_0x536d94[_0x0142('0x1f')][_0x0142('0x24')],function(_0x2d127a){return{'model':db[_0x2d127a[_0x0142('0x25')]],'as':_0x2d127a['as'],'attributes':_0x2d127a['attributes'],'include':_0x2d127a['include']?_[_0x0142('0x26')](_0x2d127a[_0x0142('0x24')],function(_0x56fb30){return{'model':db[_0x56fb30['model']],'as':_0x56fb30['as'],'attributes':_0x56fb30[_0x0142('0x22')],'include':_0x56fb30[_0x0142('0x24')]?_[_0x0142('0x26')](_0x56fb30[_0x0142('0x24')],function(_0x1549ec){return{'model':db[_0x1549ec['model']],'as':_0x1549ec['as'],'attributes':_0x1549ec[_0x0142('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0142('0x12')](function(_0x222454){logger[_0x0142('0x13')](_0x0142('0x27'),_0x536d94);logger['debug'](_0x0142('0x27'),_0x536d94,JSON[_0x0142('0x18')](_0x222454));_0x2ee5b1(_0x222454);})['catch'](function(_0x145d3f){logger[_0x0142('0x19')](_0x0142('0x27'),_0x145d3f[_0x0142('0x1b')],_0x536d94);_0x487d5e(_0x437eb3[_0x0142('0x19')](0x1f4,_0x145d3f[_0x0142('0x1b')]));});});};exports[_0x0142('0x28')]=function(_0x3a967b){var _0x5dce60=this;return new Promise(function(_0x1afc54,_0xf176be){return db['SmsQueue'][_0x0142('0x29')]({'raw':_0x3a967b[_0x0142('0x1f')]?_0x3a967b[_0x0142('0x1f')][_0x0142('0x20')]===undefined?!![]:![]:!![],'where':_0x3a967b[_0x0142('0x1f')]?_0x3a967b[_0x0142('0x1f')]['where']||null:null,'attributes':_0x3a967b[_0x0142('0x1f')]?_0x3a967b[_0x0142('0x1f')]['attributes']||null:null,'include':_0x3a967b['options']?_0x3a967b[_0x0142('0x1f')][_0x0142('0x24')]?_['map'](_0x3a967b[_0x0142('0x1f')][_0x0142('0x24')],function(_0x295f9c){return{'model':db[_0x295f9c[_0x0142('0x25')]],'as':_0x295f9c['as'],'attributes':_0x295f9c[_0x0142('0x22')],'include':_0x295f9c[_0x0142('0x24')]?_[_0x0142('0x26')](_0x295f9c['include'],function(_0x538e59){return{'model':db[_0x538e59['model']],'as':_0x538e59['as'],'attributes':_0x538e59['attributes'],'include':_0x538e59[_0x0142('0x24')]?_[_0x0142('0x26')](_0x538e59[_0x0142('0x24')],function(_0x2c67f9){return{'model':db[_0x2c67f9[_0x0142('0x25')]],'as':_0x2c67f9['as'],'attributes':_0x2c67f9[_0x0142('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0142('0x12')](function(_0x5b535c){logger['info']('ShowSmsQueue',_0x3a967b);logger['debug'](_0x0142('0x28'),_0x3a967b,JSON['stringify'](_0x5b535c));_0x1afc54(_0x5b535c);})['catch'](function(_0x5c5a44){logger[_0x0142('0x19')](_0x0142('0x28'),_0x5c5a44[_0x0142('0x1b')],_0x3a967b);_0xf176be(_0x5dce60[_0x0142('0x19')](0x1f4,_0x5c5a44['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index fd8a304..0212474 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 _0xf0ec=['removeListener','length','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf0ec,0x1bb));var _0xcf0e=function(_0x50d6d6,_0x189c68){_0x50d6d6=_0x50d6d6-0x0;var _0x5d9bb4=_0xf0ec[_0x50d6d6];return _0x5d9bb4;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0xcf0e('0x0')];function createListener(_0x3dc41a,_0x3c5445){return function(_0x56a930){_0x3c5445['emit'](_0x3dc41a,_0x56a930);};}function removeListener(_0x592c47,_0x4b13cf){return function(){SmsQueueEvents[_0xcf0e('0x1')](_0x592c47,_0x4b13cf);};}exports['register']=function(_0x2a0325){for(var _0x382b77=0x0,_0x416287=events[_0xcf0e('0x2')];_0x382b77<_0x416287;_0x382b77++){var _0x28ad3f=events[_0x382b77];var _0x23772b=createListener('smsQueue:'+_0x28ad3f,_0x2a0325);SmsQueueEvents['on'](_0x28ad3f,_0x23772b);}}; \ No newline at end of file +var _0x90b5=['save','update','removeListener','register'];(function(_0x4e92ce,_0xf2753e){var _0x41b8f3=function(_0x14665d){while(--_0x14665d){_0x4e92ce['push'](_0x4e92ce['shift']());}};_0x41b8f3(++_0xf2753e);}(_0x90b5,0x68));var _0x590b=function(_0x59400c,_0x364897){_0x59400c=_0x59400c-0x0;var _0x51508d=_0x90b5[_0x59400c];return _0x51508d;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x590b('0x0'),'remove',_0x590b('0x1')];function createListener(_0x28f102,_0x14cc2c){return function(_0x2dffa5){_0x14cc2c['emit'](_0x28f102,_0x2dffa5);};}function removeListener(_0xc55462,_0x59f4a5){return function(){SmsQueueEvents[_0x590b('0x2')](_0xc55462,_0x59f4a5);};}exports[_0x590b('0x3')]=function(_0x14ab34){for(var _0x370150=0x0,_0x190010=events['length'];_0x370150<_0x190010;_0x370150++){var _0x3ae895=events[_0x370150];var _0x4764ad=createListener('smsQueue:'+_0x3ae895,_0x14ab34);SmsQueueEvents['on'](_0x3ae895,_0x4764ad);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9d0db6b..dc1a0be 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 _0x3161=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0xce7051,_0x4d81a){var _0x45f395=function(_0x5056ab){while(--_0x5056ab){_0xce7051['push'](_0xce7051['shift']());}};_0x45f395(++_0x4d81a);}(_0x3161,0xd8));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1316('0x0'));var util=require(_0x1316('0x1'));var path=require(_0x1316('0x2'));var timeout=require(_0x1316('0x3'));var express=require(_0x1316('0x4'));var router=express[_0x1316('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1316('0x6'));var interaction=require(_0x1316('0x7'));var config=require('../../config/environment');var controller=require(_0x1316('0x8'));router[_0x1316('0x9')]('/',auth['isAuthenticated'](),controller[_0x1316('0xa')]);router['get'](_0x1316('0xb'),auth[_0x1316('0xc')](),controller['describe']);router[_0x1316('0x9')](_0x1316('0xd'),auth[_0x1316('0xc')](),controller[_0x1316('0xe')]);router[_0x1316('0xf')]('/',auth[_0x1316('0xc')](),controller[_0x1316('0x10')]);router[_0x1316('0x11')](_0x1316('0xd'),auth[_0x1316('0xc')](),controller[_0x1316('0x12')]);router['delete'](_0x1316('0xd'),auth['isAuthenticated'](),controller[_0x1316('0x13')]);module[_0x1316('0x14')]=router; \ No newline at end of file +var _0xe202=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2f7159,_0x5e3905){var _0x574689=function(_0x2a0950){while(--_0x2a0950){_0x2f7159['push'](_0x2f7159['shift']());}};_0x574689(++_0x5e3905);}(_0xe202,0x194));var _0x2e20=function(_0x46ffa8,_0x137778){_0x46ffa8=_0x46ffa8-0x0;var _0x203241=_0xe202[_0x46ffa8];return _0x203241;};'use strict';var multer=require(_0x2e20('0x0'));var util=require(_0x2e20('0x1'));var path=require(_0x2e20('0x2'));var timeout=require(_0x2e20('0x3'));var express=require(_0x2e20('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e20('0x5'));var interaction=require(_0x2e20('0x6'));var config=require('../../config/environment');var controller=require(_0x2e20('0x7'));router[_0x2e20('0x8')]('/',auth[_0x2e20('0x9')](),controller[_0x2e20('0xa')]);router[_0x2e20('0x8')]('/describe',auth[_0x2e20('0x9')](),controller['describe']);router[_0x2e20('0x8')](_0x2e20('0xb'),auth[_0x2e20('0x9')](),controller[_0x2e20('0xc')]);router[_0x2e20('0xd')]('/',auth['isAuthenticated'](),controller[_0x2e20('0xe')]);router[_0x2e20('0xf')](_0x2e20('0xb'),auth[_0x2e20('0x9')](),controller[_0x2e20('0x10')]);router['delete'](_0x2e20('0xb'),auth['isAuthenticated'](),controller[_0x2e20('0x11')]);module[_0x2e20('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6e7eeb9..f846e56 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 _0xd9a9=['sequelize','STRING','DATE'];(function(_0x476b81,_0x6be0b5){var _0x1dbe23=function(_0x5e3f6f){while(--_0x5e3f6f){_0x476b81['push'](_0x476b81['shift']());}};_0x1dbe23(++_0x6be0b5);}(_0xd9a9,0x17d));var _0x9d9a=function(_0x45bc06,_0x1dfb7d){_0x45bc06=_0x45bc06-0x0;var _0x3ac2b6=_0xd9a9[_0x45bc06];return _0x3ac2b6;};'use strict';var moment=require('moment');var Sequelize=require(_0x9d9a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9d9a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9d9a('0x1')]},'joinAt':{'type':Sequelize[_0x9d9a('0x2')]},'leaveAt':{'type':Sequelize[_0x9d9a('0x2')]},'acceptAt':{'type':Sequelize[_0x9d9a('0x2')]},'exitAt':{'type':Sequelize[_0x9d9a('0x2')]},'reason':{'type':Sequelize[_0x9d9a('0x1')]}}; \ No newline at end of file +var _0xec8d=['DATE','moment','sequelize','exports','STRING'];(function(_0x29e182,_0x450abc){var _0x3a0bb8=function(_0x219991){while(--_0x219991){_0x29e182['push'](_0x29e182['shift']());}};_0x3a0bb8(++_0x450abc);}(_0xec8d,0xba));var _0xdec8=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xec8d[_0xac151d];return _0x111dba;};'use strict';var moment=require(_0xdec8('0x0'));var Sequelize=require(_0xdec8('0x1'));module[_0xdec8('0x2')]={'uniqueid':{'type':Sequelize[_0xdec8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdec8('0x3')]},'joinAt':{'type':Sequelize[_0xdec8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdec8('0x4')]},'exitAt':{'type':Sequelize[_0xdec8('0x4')]},'reason':{'type':Sequelize[_0xdec8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index eeaf93e..97b8941 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 _0xfe09=['apply','reject','save','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','findAll','catch','params','include','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','set','Content-Range','json'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfe09,0x79));var _0x9fe0=function(_0x3be9e3,_0x3a7bed){_0x3be9e3=_0x3be9e3-0x0;var _0x337a54=_0xfe09[_0x3be9e3];return _0x337a54;};'use strict';var emlformat=require(_0x9fe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fe0('0x1'));var jsonpatch=require(_0x9fe0('0x2'));var rp=require(_0x9fe0('0x3'));var moment=require(_0x9fe0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fe0('0x5'));var util=require(_0x9fe0('0x6'));var path=require('path');var sox=require(_0x9fe0('0x7'));var csv=require(_0x9fe0('0x8'));var ejs=require(_0x9fe0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fe0('0xa'));var squel=require(_0x9fe0('0xb'));var crypto=require(_0x9fe0('0xc'));var jsforce=require(_0x9fe0('0xd'));var deskjs=require(_0x9fe0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9fe0('0xf'));var Papa=require(_0x9fe0('0x10'));var Redis=require('ioredis');var authService=require(_0x9fe0('0x11'));var qs=require(_0x9fe0('0x12'));var as=require(_0x9fe0('0x13'));var hardwareService=require(_0x9fe0('0x14'));var logger=require(_0x9fe0('0x15'))(_0x9fe0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9fe0('0x17'));var db=require(_0x9fe0('0x18'))['db'];function respondWithStatusCode(_0x2f0e61,_0x4b0090){_0x4b0090=_0x4b0090||0xcc;return function(_0x111521){if(_0x111521){return _0x2f0e61['sendStatus'](_0x4b0090);}return _0x2f0e61['status'](_0x4b0090)[_0x9fe0('0x19')]();};}function respondWithResult(_0x300b4e,_0x337831){_0x337831=_0x337831||0xc8;return function(_0x10dd84){if(_0x10dd84){return _0x300b4e[_0x9fe0('0x1a')](_0x337831)['json'](_0x10dd84);}};}function respondWithFilteredResult(_0x121dc7,_0x5b98a7){return function(_0x44ecaf){if(_0x44ecaf){var _0x4f9bce=typeof _0x5b98a7[_0x9fe0('0x1b')]===_0x9fe0('0x1c')&&typeof _0x5b98a7['limit']===_0x9fe0('0x1c');var _0x161f4e=_0x44ecaf['count'];var _0x5862b3=_0x4f9bce?0x0:_0x5b98a7[_0x9fe0('0x1b')];var _0x571263=_0x4f9bce?_0x44ecaf[_0x9fe0('0x1d')]:_0x5b98a7[_0x9fe0('0x1b')]+_0x5b98a7['limit'];var _0x59ca05;if(_0x571263>=_0x161f4e){_0x571263=_0x161f4e;_0x59ca05=0xc8;}else{_0x59ca05=0xce;}_0x121dc7[_0x9fe0('0x1a')](_0x59ca05);return _0x121dc7[_0x9fe0('0x1e')](_0x9fe0('0x1f'),_0x5862b3+'-'+_0x571263+'/'+_0x161f4e)[_0x9fe0('0x20')](_0x44ecaf);}return null;};}function patchUpdates(_0x2b161c){return function(_0x59f90d){try{jsonpatch[_0x9fe0('0x21')](_0x59f90d,_0x2b161c,!![]);}catch(_0x2f68a7){return BPromise[_0x9fe0('0x22')](_0x2f68a7);}return _0x59f90d[_0x9fe0('0x23')]();};}function saveUpdates(_0x2056cd,_0x378a81){return function(_0x486de5){if(_0x486de5){return _0x486de5['update'](_0x2056cd)['then'](function(_0x1ec5b8){return _0x1ec5b8;});}return null;};}function removeEntity(_0x4bc069,_0x49085d){return function(_0x4bddaf){if(_0x4bddaf){return _0x4bddaf[_0x9fe0('0x24')]()[_0x9fe0('0x25')](function(){_0x4bc069[_0x9fe0('0x1a')](0xcc)[_0x9fe0('0x19')]();});}};}function handleEntityNotFound(_0x29426a,_0x1fc13e){return function(_0x1d3b31){if(!_0x1d3b31){_0x29426a[_0x9fe0('0x26')](0x194);}return _0x1d3b31;};}function handleError(_0x42dc81,_0x145bcd){_0x145bcd=_0x145bcd||0x1f4;return function(_0x486a25){logger['error'](_0x486a25[_0x9fe0('0x27')]);if(_0x486a25[_0x9fe0('0x28')]){delete _0x486a25['name'];}_0x42dc81[_0x9fe0('0x1a')](_0x145bcd)[_0x9fe0('0x29')](_0x486a25);};}exports[_0x9fe0('0x2a')]=function(_0x16fbad,_0x4eb7f7){var _0x2811a1={},_0x148dff={},_0x34df59={'count':0x0,'rows':[]};var _0x43f1a5=_[_0x9fe0('0x2b')](db['SmsQueueReport'][_0x9fe0('0x2c')],function(_0x178aa6){return{'name':_0x178aa6[_0x9fe0('0x2d')],'type':_0x178aa6[_0x9fe0('0x2e')][_0x9fe0('0x2f')]};});_0x148dff[_0x9fe0('0x30')]=_[_0x9fe0('0x2b')](_0x43f1a5,_0x9fe0('0x28'));_0x148dff[_0x9fe0('0x31')]=_[_0x9fe0('0x32')](_0x16fbad[_0x9fe0('0x31')]);_0x148dff[_0x9fe0('0x33')]=_[_0x9fe0('0x34')](_0x148dff[_0x9fe0('0x30')],_0x148dff[_0x9fe0('0x31')]);_0x2811a1[_0x9fe0('0x35')]=_[_0x9fe0('0x34')](_0x148dff[_0x9fe0('0x30')],qs[_0x9fe0('0x36')](_0x16fbad[_0x9fe0('0x31')][_0x9fe0('0x36')]));_0x2811a1[_0x9fe0('0x35')]=_0x2811a1[_0x9fe0('0x35')][_0x9fe0('0x37')]?_0x2811a1[_0x9fe0('0x35')]:_0x148dff[_0x9fe0('0x30')];if(!_0x16fbad[_0x9fe0('0x31')][_0x9fe0('0x38')](_0x9fe0('0x39'))){_0x2811a1['limit']=qs[_0x9fe0('0x3a')](_0x16fbad[_0x9fe0('0x31')]['limit']);_0x2811a1['offset']=qs[_0x9fe0('0x1b')](_0x16fbad['query'][_0x9fe0('0x1b')]);}_0x2811a1[_0x9fe0('0x3b')]=qs[_0x9fe0('0x3c')](_0x16fbad['query'][_0x9fe0('0x3c')]);_0x2811a1[_0x9fe0('0x3d')]=qs[_0x9fe0('0x33')](_[_0x9fe0('0x3e')](_0x16fbad[_0x9fe0('0x31')],_0x148dff[_0x9fe0('0x33')]),_0x43f1a5);if(_0x16fbad['query'][_0x9fe0('0x3f')]){_0x2811a1[_0x9fe0('0x3d')]=_['merge'](_0x2811a1[_0x9fe0('0x3d')],{'$or':_[_0x9fe0('0x2b')](_0x43f1a5,function(_0x17b279){if(_0x17b279[_0x9fe0('0x2e')]!=='VIRTUAL'){var _0x45ec8c={};_0x45ec8c[_0x17b279[_0x9fe0('0x28')]]={'$like':'%'+_0x16fbad[_0x9fe0('0x31')][_0x9fe0('0x3f')]+'%'};return _0x45ec8c;}})});}_0x2811a1=_[_0x9fe0('0x40')]({},_0x2811a1,_0x16fbad[_0x9fe0('0x41')]);var _0x2d1db1={'where':_0x2811a1['where']};return db[_0x9fe0('0x42')][_0x9fe0('0x1d')](_0x2d1db1)[_0x9fe0('0x25')](function(_0x300f07){_0x34df59[_0x9fe0('0x1d')]=_0x300f07;if(_0x16fbad[_0x9fe0('0x31')][_0x9fe0('0x43')]){_0x2811a1['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x9fe0('0x44')](_0x2811a1);})[_0x9fe0('0x25')](function(_0x1e2974){_0x34df59['rows']=_0x1e2974;return _0x34df59;})[_0x9fe0('0x25')](respondWithFilteredResult(_0x4eb7f7,_0x2811a1))[_0x9fe0('0x45')](handleError(_0x4eb7f7,null));};exports['show']=function(_0x562c95,_0x376a1a){var _0x32cf5a={'raw':!![],'where':{'id':_0x562c95[_0x9fe0('0x46')]['id']}},_0x553250={};_0x553250[_0x9fe0('0x30')]=_[_0x9fe0('0x32')](db[_0x9fe0('0x42')][_0x9fe0('0x2c')]);_0x553250[_0x9fe0('0x31')]=_[_0x9fe0('0x32')](_0x562c95[_0x9fe0('0x31')]);_0x553250['filters']=_['intersection'](_0x553250[_0x9fe0('0x30')],_0x553250[_0x9fe0('0x31')]);_0x32cf5a['attributes']=_[_0x9fe0('0x34')](_0x553250[_0x9fe0('0x30')],qs[_0x9fe0('0x36')](_0x562c95[_0x9fe0('0x31')][_0x9fe0('0x36')]));_0x32cf5a['attributes']=_0x32cf5a[_0x9fe0('0x35')][_0x9fe0('0x37')]?_0x32cf5a[_0x9fe0('0x35')]:_0x553250[_0x9fe0('0x30')];if(_0x562c95[_0x9fe0('0x31')][_0x9fe0('0x43')]){_0x32cf5a[_0x9fe0('0x47')]=[{'all':!![]}];}_0x32cf5a=_['merge']({},_0x32cf5a,_0x562c95[_0x9fe0('0x41')]);return db['SmsQueueReport'][_0x9fe0('0x48')](_0x32cf5a)[_0x9fe0('0x25')](handleEntityNotFound(_0x376a1a,null))[_0x9fe0('0x25')](respondWithResult(_0x376a1a,null))['catch'](handleError(_0x376a1a,null));};exports['create']=function(_0x106579,_0x88dafa){return db['SmsQueueReport'][_0x9fe0('0x49')](_0x106579['body'],{})[_0x9fe0('0x25')](respondWithResult(_0x88dafa,0xc9))[_0x9fe0('0x45')](handleError(_0x88dafa,null));};exports[_0x9fe0('0x4a')]=function(_0x4f34fb,_0x354b59){if(_0x4f34fb[_0x9fe0('0x4b')]['id']){delete _0x4f34fb['body']['id'];}return db[_0x9fe0('0x42')][_0x9fe0('0x48')]({'where':{'id':_0x4f34fb[_0x9fe0('0x46')]['id']}})[_0x9fe0('0x25')](handleEntityNotFound(_0x354b59,null))[_0x9fe0('0x25')](saveUpdates(_0x4f34fb[_0x9fe0('0x4b')],null))[_0x9fe0('0x25')](respondWithResult(_0x354b59,null))['catch'](handleError(_0x354b59,null));};exports[_0x9fe0('0x24')]=function(_0x4c7f53,_0x559d3a){return db[_0x9fe0('0x42')][_0x9fe0('0x48')]({'where':{'id':_0x4c7f53[_0x9fe0('0x46')]['id']}})[_0x9fe0('0x25')](handleEntityNotFound(_0x559d3a,null))['then'](removeEntity(_0x559d3a,null))['catch'](handleError(_0x559d3a,null));};exports[_0x9fe0('0x4c')]=function(_0x1d9730,_0x49ee80){return db['SmsQueueReport'][_0x9fe0('0x4c')]()[_0x9fe0('0x25')](respondWithResult(_0x49ee80,null))[_0x9fe0('0x45')](handleError(_0x49ee80,null));}; \ No newline at end of file +var _0x9a01=['where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','index','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter'];(function(_0x49198f,_0x376c90){var _0x456a48=function(_0x233c77){while(--_0x233c77){_0x49198f['push'](_0x49198f['shift']());}};_0x456a48(++_0x376c90);}(_0x9a01,0x17c));var _0x19a0=function(_0x58bba3,_0x4aaf89){_0x58bba3=_0x58bba3-0x0;var _0x5be649=_0x9a01[_0x58bba3];return _0x5be649;};'use strict';var emlformat=require(_0x19a0('0x0'));var rimraf=require(_0x19a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19a0('0x2'));var rp=require('request-promise');var moment=require(_0x19a0('0x3'));var BPromise=require(_0x19a0('0x4'));var Mustache=require(_0x19a0('0x5'));var util=require(_0x19a0('0x6'));var path=require(_0x19a0('0x7'));var sox=require(_0x19a0('0x8'));var csv=require(_0x19a0('0x9'));var ejs=require(_0x19a0('0xa'));var fs=require('fs');var fs_extra=require(_0x19a0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x19a0('0xc'));var deskjs=require(_0x19a0('0xd'));var toCsv=require(_0x19a0('0x9'));var querystring=require(_0x19a0('0xe'));var Papa=require(_0x19a0('0xf'));var Redis=require(_0x19a0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x19a0('0x11'));var as=require(_0x19a0('0x12'));var hardwareService=require(_0x19a0('0x13'));var logger=require(_0x19a0('0x14'))(_0x19a0('0x15'));var utils=require(_0x19a0('0x16'));var config=require(_0x19a0('0x17'));var licenseUtil=require(_0x19a0('0x18'));var db=require(_0x19a0('0x19'))['db'];function respondWithStatusCode(_0x4d2d7a,_0x17a825){_0x17a825=_0x17a825||0xcc;return function(_0x304df3){if(_0x304df3){return _0x4d2d7a[_0x19a0('0x1a')](_0x17a825);}return _0x4d2d7a[_0x19a0('0x1b')](_0x17a825)[_0x19a0('0x1c')]();};}function respondWithResult(_0xcccbd8,_0x3010a3){_0x3010a3=_0x3010a3||0xc8;return function(_0x463f11){if(_0x463f11){return _0xcccbd8['status'](_0x3010a3)[_0x19a0('0x1d')](_0x463f11);}};}function respondWithFilteredResult(_0x31ce1c,_0x18c35c){return function(_0x119af4){if(_0x119af4){var _0x136946=typeof _0x18c35c['offset']===_0x19a0('0x1e')&&typeof _0x18c35c[_0x19a0('0x1f')]===_0x19a0('0x1e');var _0x52b1e3=_0x119af4[_0x19a0('0x20')];var _0x316516=_0x136946?0x0:_0x18c35c[_0x19a0('0x21')];var _0x4e6e95=_0x136946?_0x119af4[_0x19a0('0x20')]:_0x18c35c[_0x19a0('0x21')]+_0x18c35c['limit'];var _0x1b53b8;if(_0x4e6e95>=_0x52b1e3){_0x4e6e95=_0x52b1e3;_0x1b53b8=0xc8;}else{_0x1b53b8=0xce;}_0x31ce1c[_0x19a0('0x1b')](_0x1b53b8);return _0x31ce1c[_0x19a0('0x22')](_0x19a0('0x23'),_0x316516+'-'+_0x4e6e95+'/'+_0x52b1e3)[_0x19a0('0x1d')](_0x119af4);}return null;};}function patchUpdates(_0x49e23e){return function(_0x239164){try{jsonpatch[_0x19a0('0x24')](_0x239164,_0x49e23e,!![]);}catch(_0xd61676){return BPromise['reject'](_0xd61676);}return _0x239164[_0x19a0('0x25')]();};}function saveUpdates(_0x194fcc,_0x3f2975){return function(_0x261d75){if(_0x261d75){return _0x261d75['update'](_0x194fcc)[_0x19a0('0x26')](function(_0x21a324){return _0x21a324;});}return null;};}function removeEntity(_0x1b0ade,_0x6a1658){return function(_0x22405f){if(_0x22405f){return _0x22405f[_0x19a0('0x27')]()['then'](function(){_0x1b0ade['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44fcdd,_0x145b76){return function(_0x3c14bc){if(!_0x3c14bc){_0x44fcdd[_0x19a0('0x1a')](0x194);}return _0x3c14bc;};}function handleError(_0x306643,_0x93280){_0x93280=_0x93280||0x1f4;return function(_0x344839){logger[_0x19a0('0x28')](_0x344839['stack']);if(_0x344839[_0x19a0('0x29')]){delete _0x344839[_0x19a0('0x29')];}_0x306643[_0x19a0('0x1b')](_0x93280)['send'](_0x344839);};}exports[_0x19a0('0x2a')]=function(_0x13afc7,_0x5e00d0){var _0x37d9dc={},_0x396f3e={},_0x496448={'count':0x0,'rows':[]};var _0x15d694=_['map'](db[_0x19a0('0x2b')][_0x19a0('0x2c')],function(_0x59593a){return{'name':_0x59593a[_0x19a0('0x2d')],'type':_0x59593a['type']['key']};});_0x396f3e[_0x19a0('0x2e')]=_['map'](_0x15d694,_0x19a0('0x29'));_0x396f3e[_0x19a0('0x2f')]=_[_0x19a0('0x30')](_0x13afc7['query']);_0x396f3e[_0x19a0('0x31')]=_[_0x19a0('0x32')](_0x396f3e['model'],_0x396f3e['query']);_0x37d9dc[_0x19a0('0x33')]=_['intersection'](_0x396f3e['model'],qs[_0x19a0('0x34')](_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x34')]));_0x37d9dc[_0x19a0('0x33')]=_0x37d9dc['attributes'][_0x19a0('0x35')]?_0x37d9dc[_0x19a0('0x33')]:_0x396f3e[_0x19a0('0x2e')];if(!_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x36')]('nolimit')){_0x37d9dc['limit']=qs[_0x19a0('0x1f')](_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x1f')]);_0x37d9dc[_0x19a0('0x21')]=qs[_0x19a0('0x21')](_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x21')]);}_0x37d9dc['order']=qs[_0x19a0('0x37')](_0x13afc7['query'][_0x19a0('0x37')]);_0x37d9dc['where']=qs[_0x19a0('0x31')](_[_0x19a0('0x38')](_0x13afc7[_0x19a0('0x2f')],_0x396f3e['filters']),_0x15d694);if(_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x39')]){_0x37d9dc[_0x19a0('0x3a')]=_[_0x19a0('0x3b')](_0x37d9dc[_0x19a0('0x3a')],{'$or':_[_0x19a0('0x3c')](_0x15d694,function(_0x10bfc0){if(_0x10bfc0['type']!==_0x19a0('0x3d')){var _0x6539b4={};_0x6539b4[_0x10bfc0[_0x19a0('0x29')]]={'$like':'%'+_0x13afc7['query'][_0x19a0('0x39')]+'%'};return _0x6539b4;}})});}_0x37d9dc=_[_0x19a0('0x3b')]({},_0x37d9dc,_0x13afc7[_0x19a0('0x3e')]);var _0x4d0dc6={'where':_0x37d9dc[_0x19a0('0x3a')]};return db['SmsQueueReport'][_0x19a0('0x20')](_0x4d0dc6)['then'](function(_0x5572d5){_0x496448[_0x19a0('0x20')]=_0x5572d5;if(_0x13afc7[_0x19a0('0x2f')][_0x19a0('0x3f')]){_0x37d9dc[_0x19a0('0x40')]=[{'all':!![]}];}return db[_0x19a0('0x2b')][_0x19a0('0x41')](_0x37d9dc);})[_0x19a0('0x26')](function(_0x4ced52){_0x496448['rows']=_0x4ced52;return _0x496448;})['then'](respondWithFilteredResult(_0x5e00d0,_0x37d9dc))[_0x19a0('0x42')](handleError(_0x5e00d0,null));};exports['show']=function(_0x265847,_0x167fb0){var _0x41a887={'raw':!![],'where':{'id':_0x265847['params']['id']}},_0x5d3273={};_0x5d3273[_0x19a0('0x2e')]=_[_0x19a0('0x30')](db[_0x19a0('0x2b')]['rawAttributes']);_0x5d3273[_0x19a0('0x2f')]=_[_0x19a0('0x30')](_0x265847[_0x19a0('0x2f')]);_0x5d3273['filters']=_[_0x19a0('0x32')](_0x5d3273[_0x19a0('0x2e')],_0x5d3273[_0x19a0('0x2f')]);_0x41a887['attributes']=_[_0x19a0('0x32')](_0x5d3273[_0x19a0('0x2e')],qs[_0x19a0('0x34')](_0x265847[_0x19a0('0x2f')][_0x19a0('0x34')]));_0x41a887['attributes']=_0x41a887['attributes'][_0x19a0('0x35')]?_0x41a887['attributes']:_0x5d3273[_0x19a0('0x2e')];if(_0x265847['query'][_0x19a0('0x3f')]){_0x41a887[_0x19a0('0x40')]=[{'all':!![]}];}_0x41a887=_[_0x19a0('0x3b')]({},_0x41a887,_0x265847[_0x19a0('0x3e')]);return db['SmsQueueReport'][_0x19a0('0x43')](_0x41a887)['then'](handleEntityNotFound(_0x167fb0,null))[_0x19a0('0x26')](respondWithResult(_0x167fb0,null))[_0x19a0('0x42')](handleError(_0x167fb0,null));};exports[_0x19a0('0x44')]=function(_0x3d5854,_0x46dcfe){return db[_0x19a0('0x2b')][_0x19a0('0x44')](_0x3d5854[_0x19a0('0x45')],{})['then'](respondWithResult(_0x46dcfe,0xc9))[_0x19a0('0x42')](handleError(_0x46dcfe,null));};exports[_0x19a0('0x46')]=function(_0x4ac4e3,_0x7c6704){if(_0x4ac4e3[_0x19a0('0x45')]['id']){delete _0x4ac4e3[_0x19a0('0x45')]['id'];}return db[_0x19a0('0x2b')][_0x19a0('0x43')]({'where':{'id':_0x4ac4e3[_0x19a0('0x47')]['id']}})[_0x19a0('0x26')](handleEntityNotFound(_0x7c6704,null))[_0x19a0('0x26')](saveUpdates(_0x4ac4e3[_0x19a0('0x45')],null))[_0x19a0('0x26')](respondWithResult(_0x7c6704,null))[_0x19a0('0x42')](handleError(_0x7c6704,null));};exports[_0x19a0('0x27')]=function(_0x3a8c95,_0x3962f1){return db['SmsQueueReport'][_0x19a0('0x43')]({'where':{'id':_0x3a8c95[_0x19a0('0x47')]['id']}})[_0x19a0('0x26')](handleEntityNotFound(_0x3962f1,null))[_0x19a0('0x26')](removeEntity(_0x3962f1,null))[_0x19a0('0x42')](handleError(_0x3962f1,null));};exports[_0x19a0('0x48')]=function(_0xb2b7a7,_0x479b55){return db[_0x19a0('0x2b')][_0x19a0('0x48')]()[_0x19a0('0x26')](respondWithResult(_0x479b55,null))[_0x19a0('0x42')](handleError(_0x479b55,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c340c1a..995655f 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x5d57fc,_0x49f7d6){var _0x2729c9=function(_0xb5463e){while(--_0xb5463e){_0x5d57fc['push'](_0x5d57fc['shift']());}};_0x2729c9(++_0x49f7d6);}(_0xe706,0xa3));var _0x6e70=function(_0x356beb,_0x308032){_0x356beb=_0x356beb-0x0;var _0x4e2281=_0xe706[_0x356beb];return _0x4e2281;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x6487e3,_0x3ef5ac){var _0x4c1f77=function(_0x63f9e0){while(--_0x63f9e0){_0x6487e3['push'](_0x6487e3['shift']());}};_0x4c1f77(++_0x3ef5ac);}(_0xe706,0xa3));var _0x6e70=function(_0x5b7f24,_0x52a1a8){_0x5b7f24=_0x5b7f24-0x0;var _0x4c1ec9=_0xe706[_0x5b7f24];return _0x4c1ec9;};'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 a10e9a3..4d5ef54 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 _0xfd49=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','debug','catch','UpdateSmsQueueReport','update','where','attributes','limit','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x41f6cb,_0x3b48ac){var _0x3d444c=function(_0x116a8f){while(--_0x116a8f){_0x41f6cb['push'](_0x41f6cb['shift']());}};_0x3d444c(++_0x3b48ac);}(_0xfd49,0xc7));var _0x9fd4=function(_0x4afc57,_0x207719){_0x4afc57=_0x4afc57-0x0;var _0x3fccf7=_0xfd49[_0x4afc57];return _0x3fccf7;};'use strict';var _=require('lodash');var util=require(_0x9fd4('0x0'));var moment=require(_0x9fd4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fd4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fd4('0x3'))(_0x9fd4('0x4'));var config=require(_0x9fd4('0x5'));var jayson=require(_0x9fd4('0x6'));var client=jayson[_0x9fd4('0x7')][_0x9fd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x71f771,_0x25b76e,_0x2de4c8){return new BPromise(function(_0x242747,_0x1c4a28){return client['request'](_0x71f771,_0x2de4c8)[_0x9fd4('0x9')](function(_0x4ec1a5){logger[_0x9fd4('0xa')](_0x9fd4('0xb'),_0x25b76e,_0x9fd4('0xc'));logger['debug'](_0x9fd4('0xd'),_0x25b76e,_0x9fd4('0xc'),JSON[_0x9fd4('0xe')](_0x4ec1a5));if(_0x4ec1a5['error']){if(_0x4ec1a5[_0x9fd4('0xf')]['code']===0x1f4){logger[_0x9fd4('0xf')](_0x9fd4('0xb'),_0x25b76e,_0x4ec1a5['error']['message']);return _0x1c4a28(_0x4ec1a5['error']['message']);}logger[_0x9fd4('0xf')](_0x9fd4('0xb'),_0x25b76e,_0x4ec1a5[_0x9fd4('0xf')][_0x9fd4('0x10')]);return _0x242747(_0x4ec1a5[_0x9fd4('0xf')][_0x9fd4('0x10')]);}else{logger[_0x9fd4('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x25b76e,_0x9fd4('0xc'));_0x242747(_0x4ec1a5[_0x9fd4('0x11')][_0x9fd4('0x10')]);}})['catch'](function(_0x3e221c){logger[_0x9fd4('0xf')](_0x9fd4('0xb'),_0x25b76e,_0x3e221c);_0x1c4a28(_0x3e221c);});});}exports[_0x9fd4('0x12')]=function(_0x4f2812){var _0x37efc5=this;return new Promise(function(_0x14ede0,_0x42573d){return db[_0x9fd4('0x13')]['create'](_0x4f2812[_0x9fd4('0x14')],{'raw':_0x4f2812[_0x9fd4('0x15')]?_0x4f2812[_0x9fd4('0x15')][_0x9fd4('0x16')]===undefined?!![]:![]:!![]})[_0x9fd4('0x9')](function(_0x5022b4){logger[_0x9fd4('0xa')](_0x9fd4('0x12'),_0x4f2812);logger[_0x9fd4('0x17')](_0x9fd4('0x12'),_0x4f2812,JSON[_0x9fd4('0xe')](_0x5022b4));_0x14ede0(_0x5022b4);})[_0x9fd4('0x18')](function(_0x3794c8){logger['error']('CreateSmsQueueReport',_0x3794c8['message'],_0x4f2812);_0x42573d(_0x37efc5[_0x9fd4('0xf')](0x1f4,_0x3794c8[_0x9fd4('0x10')]));});});};exports[_0x9fd4('0x19')]=function(_0x2c1deb){var _0x361ae5=this;return new Promise(function(_0x9242c2,_0x28f6ea){return db['SmsQueueReport'][_0x9fd4('0x1a')](_0x2c1deb[_0x9fd4('0x14')],{'raw':_0x2c1deb['options']?_0x2c1deb[_0x9fd4('0x15')][_0x9fd4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1deb['options']?_0x2c1deb[_0x9fd4('0x15')][_0x9fd4('0x1b')]||null:null,'attributes':_0x2c1deb[_0x9fd4('0x15')]?_0x2c1deb[_0x9fd4('0x15')][_0x9fd4('0x1c')]||null:null,'limit':_0x2c1deb['options']?_0x2c1deb[_0x9fd4('0x15')][_0x9fd4('0x1d')]||null:null})['then'](function(_0x124702){logger[_0x9fd4('0xa')](_0x9fd4('0x19'),_0x2c1deb);logger[_0x9fd4('0x17')]('UpdateSmsQueueReport',_0x2c1deb,JSON['stringify'](_0x124702));_0x9242c2(_0x124702);})[_0x9fd4('0x18')](function(_0x598423){logger[_0x9fd4('0xf')](_0x9fd4('0x19'),_0x598423[_0x9fd4('0x10')],_0x2c1deb);_0x28f6ea(_0x361ae5['error'](0x1f4,_0x598423[_0x9fd4('0x10')]));});});}; \ No newline at end of file +var _0xcfc6=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x1dcbd5,_0x4403d3){var _0x35e746=function(_0x5b60e3){while(--_0x5b60e3){_0x1dcbd5['push'](_0x1dcbd5['shift']());}};_0x35e746(++_0x4403d3);}(_0xcfc6,0x69));var _0x6cfc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfc6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6cfc('0x0'));var util=require('util');var moment=require(_0x6cfc('0x1'));var BPromise=require(_0x6cfc('0x2'));var rs=require(_0x6cfc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cfc('0x4'))['db'];var utils=require(_0x6cfc('0x5'));var logger=require(_0x6cfc('0x6'))(_0x6cfc('0x7'));var config=require('../../config/environment');var jayson=require(_0x6cfc('0x8'));var client=jayson['client'][_0x6cfc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff239,_0x5ecb3d,_0x24d524){return new BPromise(function(_0x4738c6,_0x424110){return client['request'](_0x1ff239,_0x24d524)[_0x6cfc('0xa')](function(_0x1873d8){logger['info'](_0x6cfc('0xb'),_0x5ecb3d,_0x6cfc('0xc'));logger[_0x6cfc('0xd')](_0x6cfc('0xe'),_0x5ecb3d,'request\x20sent',JSON['stringify'](_0x1873d8));if(_0x1873d8[_0x6cfc('0xf')]){if(_0x1873d8[_0x6cfc('0xf')][_0x6cfc('0x10')]===0x1f4){logger[_0x6cfc('0xf')](_0x6cfc('0xb'),_0x5ecb3d,_0x1873d8[_0x6cfc('0xf')][_0x6cfc('0x11')]);return _0x424110(_0x1873d8['error'][_0x6cfc('0x11')]);}logger[_0x6cfc('0xf')](_0x6cfc('0xb'),_0x5ecb3d,_0x1873d8['error'][_0x6cfc('0x11')]);return _0x4738c6(_0x1873d8[_0x6cfc('0xf')][_0x6cfc('0x11')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5ecb3d,_0x6cfc('0xc'));_0x4738c6(_0x1873d8[_0x6cfc('0x12')][_0x6cfc('0x11')]);}})[_0x6cfc('0x13')](function(_0x592df3){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5ecb3d,_0x592df3);_0x424110(_0x592df3);});});}exports['CreateSmsQueueReport']=function(_0x4daed2){var _0x2ee630=this;return new Promise(function(_0x1bdbf7,_0x5ebb88){return db['SmsQueueReport'][_0x6cfc('0x14')](_0x4daed2[_0x6cfc('0x15')],{'raw':_0x4daed2[_0x6cfc('0x16')]?_0x4daed2[_0x6cfc('0x16')][_0x6cfc('0x17')]===undefined?!![]:![]:!![]})[_0x6cfc('0xa')](function(_0xb95a2a){logger['info'](_0x6cfc('0x18'),_0x4daed2);logger[_0x6cfc('0xd')](_0x6cfc('0x18'),_0x4daed2,JSON['stringify'](_0xb95a2a));_0x1bdbf7(_0xb95a2a);})[_0x6cfc('0x13')](function(_0x538e9e){logger[_0x6cfc('0xf')]('CreateSmsQueueReport',_0x538e9e[_0x6cfc('0x11')],_0x4daed2);_0x5ebb88(_0x2ee630[_0x6cfc('0xf')](0x1f4,_0x538e9e[_0x6cfc('0x11')]));});});};exports[_0x6cfc('0x19')]=function(_0x2774f2){var _0x5a7ad5=this;return new Promise(function(_0x5c139d,_0x450ba8){return db[_0x6cfc('0x1a')][_0x6cfc('0x1b')](_0x2774f2[_0x6cfc('0x15')],{'raw':_0x2774f2['options']?_0x2774f2[_0x6cfc('0x16')][_0x6cfc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2774f2[_0x6cfc('0x16')]?_0x2774f2['options'][_0x6cfc('0x1c')]||null:null,'attributes':_0x2774f2[_0x6cfc('0x16')]?_0x2774f2['options']['attributes']||null:null,'limit':_0x2774f2[_0x6cfc('0x16')]?_0x2774f2['options']['limit']||null:null})['then'](function(_0x49df69){logger['info'](_0x6cfc('0x19'),_0x2774f2);logger[_0x6cfc('0xd')](_0x6cfc('0x19'),_0x2774f2,JSON['stringify'](_0x49df69));_0x5c139d(_0x49df69);})[_0x6cfc('0x13')](function(_0x26bf04){logger['error'](_0x6cfc('0x19'),_0x26bf04[_0x6cfc('0x11')],_0x2774f2);_0x450ba8(_0x5a7ad5[_0x6cfc('0xf')](0x1f4,_0x26bf04[_0x6cfc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2dcfd08..a337ea4 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 _0xfa2b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x3c29e3,_0x43f921){var _0x536b6c=function(_0x691600){while(--_0x691600){_0x3c29e3['push'](_0x3c29e3['shift']());}};_0x536b6c(++_0x43f921);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x4938c9,_0x140bff){_0x4938c9=_0x4938c9-0x0;var _0x54fa11=_0xfa2b[_0x4938c9];return _0x54fa11;};'use strict';var multer=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var timeout=require(_0xbfa2('0x3'));var express=require(_0xbfa2('0x4'));var router=express[_0xbfa2('0x5')]();var fs_extra=require(_0xbfa2('0x6'));var auth=require(_0xbfa2('0x7'));var interaction=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var controller=require(_0xbfa2('0xa'));router[_0xbfa2('0xb')]('/',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0xd')]);router[_0xbfa2('0xb')](_0xbfa2('0xe'),auth['isAuthenticated'](),controller[_0xbfa2('0xf')]);router['get'](_0xbfa2('0x10'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x11')]);router[_0xbfa2('0x12')]('/',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x13')]);router[_0xbfa2('0x14')](_0xbfa2('0x10'),auth[_0xbfa2('0xc')](),controller['update']);router['delete']('/:id',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x15')]);module[_0xbfa2('0x16')]=router; \ No newline at end of file +var _0x84e7=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e7,0x122));var _0x784e=function(_0x239dce,_0x2b36e3){_0x239dce=_0x239dce-0x0;var _0x20d060=_0x84e7[_0x239dce];return _0x20d060;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x784e('0x4'));var interaction=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var controller=require(_0x784e('0x7'));router[_0x784e('0x8')]('/',auth[_0x784e('0x9')](),controller['index']);router[_0x784e('0x8')]('/describe',auth[_0x784e('0x9')](),controller[_0x784e('0xa')]);router['get'](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0xc')]);router[_0x784e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x784e('0xe')](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0xf')]);router['delete'](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0x10')]);module[_0x784e('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d5a6c4a..620d8e0 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3e0068,_0x12e7a0){var _0x1899a0=function(_0x4b753b){while(--_0x4b753b){_0x3e0068['push'](_0x3e0068['shift']());}};_0x1899a0(++_0x12e7a0);}(_0xaa88,0x137));var _0x8aa8=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xaa88[_0x45fc6a];return _0x14bcfd;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x9bde,0xe1));var _0xe9bd=function(_0xe4ec28,_0x32b842){_0xe4ec28=_0xe4ec28-0x0;var _0x402b41=_0x9bde[_0xe4ec28];return _0x402b41;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index cd5bf82..d903bee 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 _0xa0ce=['update','then','destroy','stack','name','send','index','map','SmsTransferReport','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save'];(function(_0x245c79,_0x50406b){var _0x3aab1d=function(_0xeca544){while(--_0xeca544){_0x245c79['push'](_0x245c79['shift']());}};_0x3aab1d(++_0x50406b);}(_0xa0ce,0x10b));var _0xea0c=function(_0x221b01,_0x34f7b5){_0x221b01=_0x221b01-0x0;var _0x349ac6=_0xa0ce[_0x221b01];return _0x349ac6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea0c('0x0'));var zipdir=require(_0xea0c('0x1'));var jsonpatch=require(_0xea0c('0x2'));var rp=require(_0xea0c('0x3'));var moment=require('moment');var BPromise=require(_0xea0c('0x4'));var Mustache=require(_0xea0c('0x5'));var util=require('util');var path=require(_0xea0c('0x6'));var sox=require(_0xea0c('0x7'));var csv=require(_0xea0c('0x8'));var ejs=require(_0xea0c('0x9'));var fs=require('fs');var fs_extra=require(_0xea0c('0xa'));var _=require(_0xea0c('0xb'));var squel=require('squel');var crypto=require(_0xea0c('0xc'));var jsforce=require(_0xea0c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea0c('0x8'));var querystring=require(_0xea0c('0xe'));var Papa=require(_0xea0c('0xf'));var Redis=require(_0xea0c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xea0c('0x11'));var as=require(_0xea0c('0x12'));var hardwareService=require(_0xea0c('0x13'));var logger=require('../../config/logger')(_0xea0c('0x14'));var utils=require(_0xea0c('0x15'));var config=require(_0xea0c('0x16'));var licenseUtil=require(_0xea0c('0x17'));var db=require(_0xea0c('0x18'))['db'];function respondWithStatusCode(_0x25f59f,_0x4107fa){_0x4107fa=_0x4107fa||0xcc;return function(_0x11bc94){if(_0x11bc94){return _0x25f59f[_0xea0c('0x19')](_0x4107fa);}return _0x25f59f['status'](_0x4107fa)[_0xea0c('0x1a')]();};}function respondWithResult(_0x1755c1,_0x34c6ce){_0x34c6ce=_0x34c6ce||0xc8;return function(_0x3caa37){if(_0x3caa37){return _0x1755c1[_0xea0c('0x1b')](_0x34c6ce)[_0xea0c('0x1c')](_0x3caa37);}};}function respondWithFilteredResult(_0x4f18aa,_0x56561d){return function(_0x3f11cc){if(_0x3f11cc){var _0x13d43e=typeof _0x56561d[_0xea0c('0x1d')]===_0xea0c('0x1e')&&typeof _0x56561d['limit']===_0xea0c('0x1e');var _0x4c5f38=_0x3f11cc[_0xea0c('0x1f')];var _0x4be4cf=_0x13d43e?0x0:_0x56561d[_0xea0c('0x1d')];var _0x32bfa0=_0x13d43e?_0x3f11cc['count']:_0x56561d['offset']+_0x56561d[_0xea0c('0x20')];var _0x38745d;if(_0x32bfa0>=_0x4c5f38){_0x32bfa0=_0x4c5f38;_0x38745d=0xc8;}else{_0x38745d=0xce;}_0x4f18aa['status'](_0x38745d);return _0x4f18aa[_0xea0c('0x21')]('Content-Range',_0x4be4cf+'-'+_0x32bfa0+'/'+_0x4c5f38)[_0xea0c('0x1c')](_0x3f11cc);}return null;};}function patchUpdates(_0x4c8a92){return function(_0xeb5fbd){try{jsonpatch[_0xea0c('0x22')](_0xeb5fbd,_0x4c8a92,!![]);}catch(_0x2dc027){return BPromise[_0xea0c('0x23')](_0x2dc027);}return _0xeb5fbd[_0xea0c('0x24')]();};}function saveUpdates(_0xabd156,_0x2bed85){return function(_0x440870){if(_0x440870){return _0x440870[_0xea0c('0x25')](_0xabd156)[_0xea0c('0x26')](function(_0x3dede0){return _0x3dede0;});}return null;};}function removeEntity(_0x4767e8,_0x53e823){return function(_0x8d002b){if(_0x8d002b){return _0x8d002b[_0xea0c('0x27')]()[_0xea0c('0x26')](function(){_0x4767e8[_0xea0c('0x1b')](0xcc)[_0xea0c('0x1a')]();});}};}function handleEntityNotFound(_0x1d098c,_0x42f3c1){return function(_0x790bf2){if(!_0x790bf2){_0x1d098c[_0xea0c('0x19')](0x194);}return _0x790bf2;};}function handleError(_0x11825c,_0x4104a0){_0x4104a0=_0x4104a0||0x1f4;return function(_0x3ae418){logger['error'](_0x3ae418[_0xea0c('0x28')]);if(_0x3ae418[_0xea0c('0x29')]){delete _0x3ae418[_0xea0c('0x29')];}_0x11825c[_0xea0c('0x1b')](_0x4104a0)[_0xea0c('0x2a')](_0x3ae418);};}exports[_0xea0c('0x2b')]=function(_0x193c03,_0x30deeb){var _0x30a8a5={},_0x4b6512={},_0x586d2f={'count':0x0,'rows':[]};var _0x2c25e4=_[_0xea0c('0x2c')](db[_0xea0c('0x2d')]['rawAttributes'],function(_0x115242){return{'name':_0x115242['fieldName'],'type':_0x115242[_0xea0c('0x2e')]['key']};});_0x4b6512[_0xea0c('0x2f')]=_[_0xea0c('0x2c')](_0x2c25e4,'name');_0x4b6512['query']=_[_0xea0c('0x30')](_0x193c03['query']);_0x4b6512[_0xea0c('0x31')]=_[_0xea0c('0x32')](_0x4b6512['model'],_0x4b6512[_0xea0c('0x33')]);_0x30a8a5[_0xea0c('0x34')]=_['intersection'](_0x4b6512['model'],qs['fields'](_0x193c03[_0xea0c('0x33')][_0xea0c('0x35')]));_0x30a8a5[_0xea0c('0x34')]=_0x30a8a5[_0xea0c('0x34')][_0xea0c('0x36')]?_0x30a8a5[_0xea0c('0x34')]:_0x4b6512[_0xea0c('0x2f')];if(!_0x193c03[_0xea0c('0x33')][_0xea0c('0x37')](_0xea0c('0x38'))){_0x30a8a5[_0xea0c('0x20')]=qs['limit'](_0x193c03[_0xea0c('0x33')][_0xea0c('0x20')]);_0x30a8a5[_0xea0c('0x1d')]=qs[_0xea0c('0x1d')](_0x193c03[_0xea0c('0x33')][_0xea0c('0x1d')]);}_0x30a8a5[_0xea0c('0x39')]=qs['sort'](_0x193c03[_0xea0c('0x33')][_0xea0c('0x3a')]);_0x30a8a5[_0xea0c('0x3b')]=qs[_0xea0c('0x31')](_['pick'](_0x193c03[_0xea0c('0x33')],_0x4b6512[_0xea0c('0x31')]),_0x2c25e4);if(_0x193c03[_0xea0c('0x33')][_0xea0c('0x3c')]){_0x30a8a5[_0xea0c('0x3b')]=_[_0xea0c('0x3d')](_0x30a8a5['where'],{'$or':_[_0xea0c('0x2c')](_0x2c25e4,function(_0x31b3be){if(_0x31b3be[_0xea0c('0x2e')]!==_0xea0c('0x3e')){var _0x2584dc={};_0x2584dc[_0x31b3be[_0xea0c('0x29')]]={'$like':'%'+_0x193c03[_0xea0c('0x33')][_0xea0c('0x3c')]+'%'};return _0x2584dc;}})});}_0x30a8a5=_[_0xea0c('0x3d')]({},_0x30a8a5,_0x193c03[_0xea0c('0x3f')]);var _0x4f7d3f={'where':_0x30a8a5[_0xea0c('0x3b')]};return db[_0xea0c('0x2d')]['count'](_0x4f7d3f)[_0xea0c('0x26')](function(_0x3de267){_0x586d2f[_0xea0c('0x1f')]=_0x3de267;if(_0x193c03[_0xea0c('0x33')][_0xea0c('0x40')]){_0x30a8a5[_0xea0c('0x41')]=[{'all':!![]}];}return db[_0xea0c('0x2d')][_0xea0c('0x42')](_0x30a8a5);})['then'](function(_0x4d20a6){_0x586d2f[_0xea0c('0x43')]=_0x4d20a6;return _0x586d2f;})[_0xea0c('0x26')](respondWithFilteredResult(_0x30deeb,_0x30a8a5))['catch'](handleError(_0x30deeb,null));};exports[_0xea0c('0x44')]=function(_0x107ac7,_0x1ebc35){var _0x538f8d={'raw':!![],'where':{'id':_0x107ac7[_0xea0c('0x45')]['id']}},_0x16718f={};_0x16718f[_0xea0c('0x2f')]=_['keys'](db['SmsTransferReport'][_0xea0c('0x46')]);_0x16718f[_0xea0c('0x33')]=_[_0xea0c('0x30')](_0x107ac7[_0xea0c('0x33')]);_0x16718f[_0xea0c('0x31')]=_[_0xea0c('0x32')](_0x16718f[_0xea0c('0x2f')],_0x16718f[_0xea0c('0x33')]);_0x538f8d[_0xea0c('0x34')]=_['intersection'](_0x16718f[_0xea0c('0x2f')],qs['fields'](_0x107ac7[_0xea0c('0x33')][_0xea0c('0x35')]));_0x538f8d[_0xea0c('0x34')]=_0x538f8d[_0xea0c('0x34')][_0xea0c('0x36')]?_0x538f8d[_0xea0c('0x34')]:_0x16718f[_0xea0c('0x2f')];if(_0x107ac7[_0xea0c('0x33')][_0xea0c('0x40')]){_0x538f8d['include']=[{'all':!![]}];}_0x538f8d=_['merge']({},_0x538f8d,_0x107ac7['options']);return db[_0xea0c('0x2d')][_0xea0c('0x47')](_0x538f8d)[_0xea0c('0x26')](handleEntityNotFound(_0x1ebc35,null))[_0xea0c('0x26')](respondWithResult(_0x1ebc35,null))[_0xea0c('0x48')](handleError(_0x1ebc35,null));};exports['create']=function(_0x284fca,_0x1c1f07){return db[_0xea0c('0x2d')][_0xea0c('0x49')](_0x284fca[_0xea0c('0x4a')],{})['then'](respondWithResult(_0x1c1f07,0xc9))[_0xea0c('0x48')](handleError(_0x1c1f07,null));};exports[_0xea0c('0x25')]=function(_0x170fc7,_0x29e3c0){if(_0x170fc7['body']['id']){delete _0x170fc7[_0xea0c('0x4a')]['id'];}return db[_0xea0c('0x2d')][_0xea0c('0x47')]({'where':{'id':_0x170fc7['params']['id']}})['then'](handleEntityNotFound(_0x29e3c0,null))[_0xea0c('0x26')](saveUpdates(_0x170fc7[_0xea0c('0x4a')],null))[_0xea0c('0x26')](respondWithResult(_0x29e3c0,null))[_0xea0c('0x48')](handleError(_0x29e3c0,null));};exports[_0xea0c('0x27')]=function(_0x2ee33e,_0x4af8f9){return db['SmsTransferReport']['find']({'where':{'id':_0x2ee33e[_0xea0c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4af8f9,null))[_0xea0c('0x26')](removeEntity(_0x4af8f9,null))[_0xea0c('0x48')](handleError(_0x4af8f9,null));};exports[_0xea0c('0x4b')]=function(_0x5b41ca,_0x367739){return db['SmsTransferReport'][_0xea0c('0x4b')]()[_0xea0c('0x26')](respondWithResult(_0x367739,null))[_0xea0c('0x48')](handleError(_0x367739,null));}; \ No newline at end of file +var _0x6066=['hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','SmsTransferReport','count','includeAll','include','findAll','rows','catch','params','intersection','length','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','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','sendStatus','status','end','offset','undefined','limit','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','query','attributes','fields'];(function(_0x3ac0fd,_0x2dfb0c){var _0x2670a9=function(_0x1bc374){while(--_0x1bc374){_0x3ac0fd['push'](_0x3ac0fd['shift']());}};_0x2670a9(++_0x2dfb0c);}(_0x6066,0x180));var _0x6606=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x6066[_0x5fa520];return _0x1bf6c4;};'use strict';var emlformat=require(_0x6606('0x0'));var rimraf=require(_0x6606('0x1'));var zipdir=require(_0x6606('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6606('0x3'));var moment=require(_0x6606('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6606('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6606('0x6'));var ejs=require(_0x6606('0x7'));var fs=require('fs');var fs_extra=require(_0x6606('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6606('0x9'));var deskjs=require(_0x6606('0xa'));var toCsv=require(_0x6606('0x6'));var querystring=require(_0x6606('0xb'));var Papa=require(_0x6606('0xc'));var Redis=require('ioredis');var authService=require(_0x6606('0xd'));var qs=require(_0x6606('0xe'));var as=require(_0x6606('0xf'));var hardwareService=require(_0x6606('0x10'));var logger=require(_0x6606('0x11'))(_0x6606('0x12'));var utils=require(_0x6606('0x13'));var config=require(_0x6606('0x14'));var licenseUtil=require(_0x6606('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5be610,_0x218876){_0x218876=_0x218876||0xcc;return function(_0x464665){if(_0x464665){return _0x5be610[_0x6606('0x16')](_0x218876);}return _0x5be610[_0x6606('0x17')](_0x218876)[_0x6606('0x18')]();};}function respondWithResult(_0x56e3ce,_0x122a27){_0x122a27=_0x122a27||0xc8;return function(_0x357673){if(_0x357673){return _0x56e3ce[_0x6606('0x17')](_0x122a27)['json'](_0x357673);}};}function respondWithFilteredResult(_0x4eee21,_0x20013b){return function(_0x1c94f3){if(_0x1c94f3){var _0x1d761d=typeof _0x20013b[_0x6606('0x19')]===_0x6606('0x1a')&&typeof _0x20013b[_0x6606('0x1b')]===_0x6606('0x1a');var _0x246fef=_0x1c94f3['count'];var _0x5eae03=_0x1d761d?0x0:_0x20013b[_0x6606('0x19')];var _0x16420c=_0x1d761d?_0x1c94f3['count']:_0x20013b[_0x6606('0x19')]+_0x20013b[_0x6606('0x1b')];var _0x5dcbba;if(_0x16420c>=_0x246fef){_0x16420c=_0x246fef;_0x5dcbba=0xc8;}else{_0x5dcbba=0xce;}_0x4eee21[_0x6606('0x17')](_0x5dcbba);return _0x4eee21['set'](_0x6606('0x1c'),_0x5eae03+'-'+_0x16420c+'/'+_0x246fef)[_0x6606('0x1d')](_0x1c94f3);}return null;};}function patchUpdates(_0x22a8c8){return function(_0x29fc66){try{jsonpatch['apply'](_0x29fc66,_0x22a8c8,!![]);}catch(_0x4baddf){return BPromise[_0x6606('0x1e')](_0x4baddf);}return _0x29fc66[_0x6606('0x1f')]();};}function saveUpdates(_0x184818,_0x1d556e){return function(_0x4d1b38){if(_0x4d1b38){return _0x4d1b38[_0x6606('0x20')](_0x184818)[_0x6606('0x21')](function(_0x1063d9){return _0x1063d9;});}return null;};}function removeEntity(_0x5f118f,_0x5a8a81){return function(_0x35bf9d){if(_0x35bf9d){return _0x35bf9d[_0x6606('0x22')]()[_0x6606('0x21')](function(){_0x5f118f['status'](0xcc)[_0x6606('0x18')]();});}};}function handleEntityNotFound(_0xbaeec0,_0xebd15f){return function(_0x23c536){if(!_0x23c536){_0xbaeec0[_0x6606('0x16')](0x194);}return _0x23c536;};}function handleError(_0x353fac,_0x4f27e6){_0x4f27e6=_0x4f27e6||0x1f4;return function(_0x23ac3c){logger['error'](_0x23ac3c['stack']);if(_0x23ac3c[_0x6606('0x23')]){delete _0x23ac3c[_0x6606('0x23')];}_0x353fac[_0x6606('0x17')](_0x4f27e6)[_0x6606('0x24')](_0x23ac3c);};}exports[_0x6606('0x25')]=function(_0x22f024,_0x5b5e7b){var _0x140e26={},_0x2490b={},_0x436ea3={'count':0x0,'rows':[]};var _0x55f7d2=_[_0x6606('0x26')](db['SmsTransferReport'][_0x6606('0x27')],function(_0x4aad65){return{'name':_0x4aad65[_0x6606('0x28')],'type':_0x4aad65['type'][_0x6606('0x29')]};});_0x2490b[_0x6606('0x2a')]=_['map'](_0x55f7d2,_0x6606('0x23'));_0x2490b['query']=_[_0x6606('0x2b')](_0x22f024['query']);_0x2490b[_0x6606('0x2c')]=_['intersection'](_0x2490b[_0x6606('0x2a')],_0x2490b[_0x6606('0x2d')]);_0x140e26[_0x6606('0x2e')]=_['intersection'](_0x2490b['model'],qs[_0x6606('0x2f')](_0x22f024[_0x6606('0x2d')][_0x6606('0x2f')]));_0x140e26[_0x6606('0x2e')]=_0x140e26['attributes']['length']?_0x140e26[_0x6606('0x2e')]:_0x2490b[_0x6606('0x2a')];if(!_0x22f024[_0x6606('0x2d')][_0x6606('0x30')](_0x6606('0x31'))){_0x140e26['limit']=qs['limit'](_0x22f024[_0x6606('0x2d')][_0x6606('0x1b')]);_0x140e26[_0x6606('0x19')]=qs[_0x6606('0x19')](_0x22f024[_0x6606('0x2d')]['offset']);}_0x140e26[_0x6606('0x32')]=qs[_0x6606('0x33')](_0x22f024[_0x6606('0x2d')][_0x6606('0x33')]);_0x140e26[_0x6606('0x34')]=qs[_0x6606('0x2c')](_[_0x6606('0x35')](_0x22f024[_0x6606('0x2d')],_0x2490b['filters']),_0x55f7d2);if(_0x22f024[_0x6606('0x2d')]['filter']){_0x140e26[_0x6606('0x34')]=_[_0x6606('0x36')](_0x140e26[_0x6606('0x34')],{'$or':_[_0x6606('0x26')](_0x55f7d2,function(_0x3fb12c){if(_0x3fb12c[_0x6606('0x37')]!=='VIRTUAL'){var _0x3b5c09={};_0x3b5c09[_0x3fb12c[_0x6606('0x23')]]={'$like':'%'+_0x22f024['query'][_0x6606('0x38')]+'%'};return _0x3b5c09;}})});}_0x140e26=_[_0x6606('0x36')]({},_0x140e26,_0x22f024[_0x6606('0x39')]);var _0x1e21a3={'where':_0x140e26[_0x6606('0x34')]};return db[_0x6606('0x3a')][_0x6606('0x3b')](_0x1e21a3)[_0x6606('0x21')](function(_0x14dd0e){_0x436ea3[_0x6606('0x3b')]=_0x14dd0e;if(_0x22f024[_0x6606('0x2d')][_0x6606('0x3c')]){_0x140e26[_0x6606('0x3d')]=[{'all':!![]}];}return db[_0x6606('0x3a')][_0x6606('0x3e')](_0x140e26);})[_0x6606('0x21')](function(_0xb49352){_0x436ea3[_0x6606('0x3f')]=_0xb49352;return _0x436ea3;})[_0x6606('0x21')](respondWithFilteredResult(_0x5b5e7b,_0x140e26))[_0x6606('0x40')](handleError(_0x5b5e7b,null));};exports['show']=function(_0x295a41,_0x58c18){var _0x3ab0bd={'raw':!![],'where':{'id':_0x295a41[_0x6606('0x41')]['id']}},_0x517d11={};_0x517d11[_0x6606('0x2a')]=_[_0x6606('0x2b')](db[_0x6606('0x3a')][_0x6606('0x27')]);_0x517d11[_0x6606('0x2d')]=_['keys'](_0x295a41[_0x6606('0x2d')]);_0x517d11[_0x6606('0x2c')]=_[_0x6606('0x42')](_0x517d11[_0x6606('0x2a')],_0x517d11[_0x6606('0x2d')]);_0x3ab0bd[_0x6606('0x2e')]=_[_0x6606('0x42')](_0x517d11[_0x6606('0x2a')],qs[_0x6606('0x2f')](_0x295a41[_0x6606('0x2d')][_0x6606('0x2f')]));_0x3ab0bd[_0x6606('0x2e')]=_0x3ab0bd['attributes'][_0x6606('0x43')]?_0x3ab0bd[_0x6606('0x2e')]:_0x517d11[_0x6606('0x2a')];if(_0x295a41['query']['includeAll']){_0x3ab0bd['include']=[{'all':!![]}];}_0x3ab0bd=_[_0x6606('0x36')]({},_0x3ab0bd,_0x295a41[_0x6606('0x39')]);return db[_0x6606('0x3a')]['find'](_0x3ab0bd)[_0x6606('0x21')](handleEntityNotFound(_0x58c18,null))[_0x6606('0x21')](respondWithResult(_0x58c18,null))[_0x6606('0x40')](handleError(_0x58c18,null));};exports[_0x6606('0x44')]=function(_0x36cbd4,_0x3d7cf4){return db[_0x6606('0x3a')][_0x6606('0x44')](_0x36cbd4[_0x6606('0x45')],{})[_0x6606('0x21')](respondWithResult(_0x3d7cf4,0xc9))[_0x6606('0x40')](handleError(_0x3d7cf4,null));};exports[_0x6606('0x20')]=function(_0x2fa44d,_0x1e30a2){if(_0x2fa44d[_0x6606('0x45')]['id']){delete _0x2fa44d[_0x6606('0x45')]['id'];}return db[_0x6606('0x3a')][_0x6606('0x46')]({'where':{'id':_0x2fa44d[_0x6606('0x41')]['id']}})[_0x6606('0x21')](handleEntityNotFound(_0x1e30a2,null))[_0x6606('0x21')](saveUpdates(_0x2fa44d[_0x6606('0x45')],null))[_0x6606('0x21')](respondWithResult(_0x1e30a2,null))[_0x6606('0x40')](handleError(_0x1e30a2,null));};exports[_0x6606('0x22')]=function(_0x454b5,_0x31c5e3){return db[_0x6606('0x3a')][_0x6606('0x46')]({'where':{'id':_0x454b5['params']['id']}})['then'](handleEntityNotFound(_0x31c5e3,null))[_0x6606('0x21')](removeEntity(_0x31c5e3,null))[_0x6606('0x40')](handleError(_0x31c5e3,null));};exports['describe']=function(_0x4fc1c2,_0x517e42){return db[_0x6606('0x3a')][_0x6606('0x47')]()['then'](respondWithResult(_0x517e42,null))[_0x6606('0x40')](handleError(_0x517e42,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 003a2ab..75cdfd9 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 _0xf61e=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','util'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xf61e,0x82));var _0xef61=function(_0x4193f9,_0x273160){_0x4193f9=_0x4193f9-0x0;var _0x361aa8=_0xf61e[_0x4193f9];return _0x361aa8;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))('api');var moment=require('moment');var BPromise=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var fs=require('fs');var path=require(_0xef61('0x5'));var rimraf=require(_0xef61('0x6'));var config=require(_0xef61('0x7'));var attributes=require(_0xef61('0x8'));module[_0xef61('0x9')]=function(_0x1ceb22,_0x367310){return _0x1ceb22['define'](_0xef61('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xef61('0xb'),'fields':[_0xef61('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf16=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x4bfa5a,_0x5ab9f5){var _0x145a06=function(_0x264f7d){while(--_0x264f7d){_0x4bfa5a['push'](_0x4bfa5a['shift']());}};_0x145a06(++_0x5ab9f5);}(_0xbf16,0x73));var _0x6bf1=function(_0x5bea52,_0x10ab10){_0x5bea52=_0x5bea52-0x0;var _0x348aaa=_0xbf16[_0x5bea52];return _0x348aaa;};'use strict';var _=require(_0x6bf1('0x0'));var util=require(_0x6bf1('0x1'));var logger=require(_0x6bf1('0x2'))('api');var moment=require(_0x6bf1('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bf1('0x4'));var fs=require('fs');var path=require(_0x6bf1('0x5'));var rimraf=require(_0x6bf1('0x6'));var config=require(_0x6bf1('0x7'));var attributes=require(_0x6bf1('0x8'));module['exports']=function(_0x200657,_0x379d93){return _0x200657[_0x6bf1('0x9')](_0x6bf1('0xa'),attributes,{'tableName':_0x6bf1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6bf1('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 6ebaed7..0723d5d 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 _0xf987=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','SmsTransferReport,\x20%s,\x20%s','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x460af8,_0x127368){var _0x3ff99b=function(_0x178b5a){while(--_0x178b5a){_0x460af8['push'](_0x460af8['shift']());}};_0x3ff99b(++_0x127368);}(_0xf987,0x18a));var _0x7f98=function(_0x3e4f94,_0x738a66){_0x3e4f94=_0x3e4f94-0x0;var _0x565c8b=_0xf987[_0x3e4f94];return _0x565c8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f98('0x0'));var BPromise=require(_0x7f98('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f98('0x2'));var db=require(_0x7f98('0x3'))['db'];var utils=require(_0x7f98('0x4'));var logger=require(_0x7f98('0x5'))(_0x7f98('0x6'));var config=require(_0x7f98('0x7'));var jayson=require(_0x7f98('0x8'));var client=jayson[_0x7f98('0x9')][_0x7f98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25001e,_0x3e25d9,_0x290763){return new BPromise(function(_0x5bb41e,_0x2ab24d){return client[_0x7f98('0xb')](_0x25001e,_0x290763)[_0x7f98('0xc')](function(_0xc579d0){logger[_0x7f98('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3e25d9,_0x7f98('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3e25d9,_0x7f98('0xe'),JSON[_0x7f98('0xf')](_0xc579d0));if(_0xc579d0[_0x7f98('0x10')]){if(_0xc579d0[_0x7f98('0x10')]['code']===0x1f4){logger[_0x7f98('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3e25d9,_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);return _0x2ab24d(_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);}logger[_0x7f98('0x10')](_0x7f98('0x12'),_0x3e25d9,_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);return _0x5bb41e(_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);}else{logger[_0x7f98('0xd')](_0x7f98('0x12'),_0x3e25d9,'request\x20sent');_0x5bb41e(_0xc579d0[_0x7f98('0x13')]['message']);}})['catch'](function(_0x3ac563){logger[_0x7f98('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3e25d9,_0x3ac563);_0x2ab24d(_0x3ac563);});});} \ No newline at end of file +var _0xb138=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xb138,0x1dd));var _0x8b13=function(_0x4d3b39,_0x4ec5ad){_0x4d3b39=_0x4d3b39-0x0;var _0x3f92ca=_0xb138[_0x4d3b39];return _0x3f92ca;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){return client[_0x8b13('0xc')](_0x5d51b1,_0x33d1a7)[_0x8b13('0xd')](function(_0x58683a){logger['info'](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));logger[_0x8b13('0x10')](_0x8b13('0x11'),_0x3fdf4d,_0x8b13('0xf'),JSON['stringify'](_0x58683a));if(_0x58683a[_0x8b13('0x12')]){if(_0x58683a[_0x8b13('0x12')][_0x8b13('0x13')]===0x1f4){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x58683a[_0x8b13('0x12')]['message']);return _0x498832(_0x58683a['error'][_0x8b13('0x14')]);}logger[_0x8b13('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x3fdf4d,_0x58683a['error']['message']);return _0x22e157(_0x58683a[_0x8b13('0x12')][_0x8b13('0x14')]);}else{logger[_0x8b13('0x15')](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));_0x22e157(_0x58683a['result'][_0x8b13('0x14')]);}})[_0x8b13('0x16')](function(_0x393bc1){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x393bc1);_0x498832(_0x393bc1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index eec8b7c..e345b4a 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 _0x5a8f=['originalname','format','%s-%s%s','basename','now','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root'];(function(_0x36a919,_0x46fa5f){var _0x5ef2b1=function(_0x4cfb60){while(--_0x4cfb60){_0x36a919['push'](_0x36a919['shift']());}};_0x5ef2b1(++_0x46fa5f);}(_0x5a8f,0x1be));var _0xf5a8=function(_0x54a69d,_0x2e4c47){_0x54a69d=_0x54a69d-0x0;var _0x2b69f0=_0x5a8f[_0x54a69d];return _0x2b69f0;};'use strict';var multer=require(_0xf5a8('0x0'));var util=require(_0xf5a8('0x1'));var path=require(_0xf5a8('0x2'));var timeout=require(_0xf5a8('0x3'));var express=require('express');var router=express[_0xf5a8('0x4')]();var fs_extra=require(_0xf5a8('0x5'));var auth=require(_0xf5a8('0x6'));var interaction=require(_0xf5a8('0x7'));var config=require(_0xf5a8('0x8'));var controller=require('./sound.controller');router[_0xf5a8('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5a8('0xa')]);router[_0xf5a8('0x9')](_0xf5a8('0xb'),auth[_0xf5a8('0xc')](),controller[_0xf5a8('0xd')]);router[_0xf5a8('0x9')](_0xf5a8('0xe'),auth[_0xf5a8('0xc')](),controller[_0xf5a8('0xf')]);var upload=multer({'storage':multer[_0xf5a8('0x10')]({'destination':function(_0xab7d5,_0x22ad75,_0x1bc8b3){_0x1bc8b3(null,path[_0xf5a8('0x11')](config[_0xf5a8('0x12')],'server/files/sounds/original/'));},'filename':function(_0x58d846,_0x2da3e3,_0x40be32){_0x2da3e3[_0xf5a8('0x13')]=_0x2da3e3[_0xf5a8('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40be32(null,util[_0xf5a8('0x14')](_0xf5a8('0x15'),path[_0xf5a8('0x16')](_0x2da3e3['originalname'],path['extname'](_0x2da3e3[_0xf5a8('0x13')])),Date[_0xf5a8('0x17')](),path['extname'](_0x2da3e3[_0xf5a8('0x13')])));}})});router['post']('/',upload[_0xf5a8('0x18')](_0xf5a8('0x19')),controller[_0xf5a8('0x1a')]);router[_0xf5a8('0x1b')](_0xf5a8('0xb'),auth[_0xf5a8('0xc')](),controller[_0xf5a8('0x1c')]);router[_0xf5a8('0x1d')](_0xf5a8('0xb'),auth[_0xf5a8('0xc')](),controller['delete']);module[_0xf5a8('0x1e')]=router; \ No newline at end of file +var _0x930d=['Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','post','single','file','delete','exports','multer','util','connect-timeout','express'];(function(_0x2f5a92,_0x7bacc4){var _0x4dff36=function(_0x5135bd){while(--_0x5135bd){_0x2f5a92['push'](_0x2f5a92['shift']());}};_0x4dff36(++_0x7bacc4);}(_0x930d,0x11a));var _0xd930=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x930d[_0x4706a6];return _0x1bb705;};'use strict';var multer=require(_0xd930('0x0'));var util=require(_0xd930('0x1'));var path=require('path');var timeout=require(_0xd930('0x2'));var express=require(_0xd930('0x3'));var router=express[_0xd930('0x4')]();var fs_extra=require(_0xd930('0x5'));var auth=require(_0xd930('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd930('0x7'));router[_0xd930('0x8')]('/',auth[_0xd930('0x9')](),controller[_0xd930('0xa')]);router[_0xd930('0x8')](_0xd930('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd930('0x8')](_0xd930('0xc'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xd930('0xd')]({'destination':function(_0x4bab5d,_0x464a5d,_0x1ec547){_0x1ec547(null,path[_0xd930('0xe')](config[_0xd930('0xf')],_0xd930('0x10')));},'filename':function(_0x36f9e7,_0x1ba907,_0xf7806c){_0x1ba907[_0xd930('0x11')]=_0x1ba907['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf7806c(null,util[_0xd930('0x12')](_0xd930('0x13'),path['basename'](_0x1ba907['originalname'],path['extname'](_0x1ba907[_0xd930('0x11')])),Date[_0xd930('0x14')](),path['extname'](_0x1ba907[_0xd930('0x11')])));}})});router[_0xd930('0x15')]('/',upload[_0xd930('0x16')](_0xd930('0x17')),controller['create']);router['put']('/:id',auth[_0xd930('0x9')](),controller['update']);router[_0xd930('0x18')]('/:id',auth[_0xd930('0x9')](),controller[_0xd930('0x18')]);module[_0xd930('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d7e8d4f..6b1459f 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 _0x8572=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x5c9cae,_0x4f5f0a){var _0x49173c=function(_0x1cc64f){while(--_0x1cc64f){_0x5c9cae['push'](_0x5c9cae['shift']());}};_0x49173c(++_0x4f5f0a);}(_0x8572,0x142));var _0x2857=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x8572[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x2857('0x0'));module[_0x2857('0x1')]={'name':{'type':Sequelize[_0x2857('0x2')],'unique':_0x2857('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2857('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2857('0x2')]},'original_format':{'type':Sequelize[_0x2857('0x2')]},'original_duration':{'type':Sequelize[_0x2857('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2857('0x5')]},'original_channelCount':{'type':Sequelize[_0x2857('0x6')]},'original_bitRate':{'type':Sequelize[_0x2857('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2857('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x2857('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2857('0x5')]},'converted_channelCount':{'type':Sequelize[_0x2857('0x6')]},'converted_bitRate':{'type':Sequelize[_0x2857('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2857('0x6')]}}; \ No newline at end of file +var _0x8cf5=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x50a54e,_0x54f318){var _0x3216e5=function(_0x33d96b){while(--_0x33d96b){_0x50a54e['push'](_0x50a54e['shift']());}};_0x3216e5(++_0x54f318);}(_0x8cf5,0x12d));var _0x58cf=function(_0x28c453,_0x36cadb){_0x28c453=_0x28c453-0x0;var _0x436509=_0x8cf5[_0x28c453];return _0x436509;};'use strict';var Sequelize=require(_0x58cf('0x0'));module[_0x58cf('0x1')]={'name':{'type':Sequelize[_0x58cf('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x58cf('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x58cf('0x2')]},'original_format':{'type':Sequelize[_0x58cf('0x2')]},'original_duration':{'type':Sequelize[_0x58cf('0x3')]},'original_sampleCount':{'type':Sequelize[_0x58cf('0x4')]},'original_channelCount':{'type':Sequelize[_0x58cf('0x5')]},'original_bitRate':{'type':Sequelize[_0x58cf('0x4')]},'original_sampleRate':{'type':Sequelize[_0x58cf('0x5')]},'converted_format':{'type':Sequelize[_0x58cf('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x58cf('0x5')]},'converted_bitRate':{'type':Sequelize[_0x58cf('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x58cf('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 834db2f..efcc1b6 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 _0x01b7=['type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','Sound','includeAll','findAll','catch','show','params','include','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','sampleCount','original_channelCount','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','body','role','user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','rawAttributes'];(function(_0x1f535b,_0xc42523){var _0x5bb329=function(_0xcaa78d){while(--_0xcaa78d){_0x1f535b['push'](_0x1f535b['shift']());}};_0x5bb329(++_0xc42523);}(_0x01b7,0xc2));var _0x701b=function(_0x419a97,_0x19fe2f){_0x419a97=_0x419a97-0x0;var _0x421d39=_0x01b7[_0x419a97];return _0x421d39;};'use strict';var emlformat=require(_0x701b('0x0'));var rimraf=require(_0x701b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x701b('0x2'));var rp=require(_0x701b('0x3'));var moment=require(_0x701b('0x4'));var BPromise=require(_0x701b('0x5'));var Mustache=require(_0x701b('0x6'));var util=require(_0x701b('0x7'));var path=require('path');var sox=require(_0x701b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x701b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x701b('0xa'));var jsforce=require(_0x701b('0xb'));var deskjs=require(_0x701b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x701b('0xd'));var Papa=require('papaparse');var Redis=require(_0x701b('0xe'));var authService=require(_0x701b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x701b('0x10'));var hardwareService=require(_0x701b('0x11'));var logger=require(_0x701b('0x12'))(_0x701b('0x13'));var utils=require(_0x701b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x269c7b,_0x1e0710){_0x1e0710=_0x1e0710||0xcc;return function(_0x11a922){if(_0x11a922){return _0x269c7b['sendStatus'](_0x1e0710);}return _0x269c7b['status'](_0x1e0710)['end']();};}function respondWithResult(_0xc839db,_0x28a61d){_0x28a61d=_0x28a61d||0xc8;return function(_0x64c688){if(_0x64c688){return _0xc839db[_0x701b('0x15')](_0x28a61d)[_0x701b('0x16')](_0x64c688);}};}function respondWithFilteredResult(_0x54e217,_0x354769){return function(_0x29eaf5){if(_0x29eaf5){var _0xa539d5=typeof _0x354769[_0x701b('0x17')]===_0x701b('0x18')&&typeof _0x354769[_0x701b('0x19')]===_0x701b('0x18');var _0x9bfd8f=_0x29eaf5[_0x701b('0x1a')];var _0x435b64=_0xa539d5?0x0:_0x354769[_0x701b('0x17')];var _0x79dae5=_0xa539d5?_0x29eaf5['count']:_0x354769[_0x701b('0x17')]+_0x354769['limit'];var _0x225e64;if(_0x79dae5>=_0x9bfd8f){_0x79dae5=_0x9bfd8f;_0x225e64=0xc8;}else{_0x225e64=0xce;}_0x54e217[_0x701b('0x15')](_0x225e64);return _0x54e217[_0x701b('0x1b')](_0x701b('0x1c'),_0x435b64+'-'+_0x79dae5+'/'+_0x9bfd8f)[_0x701b('0x16')](_0x29eaf5);}return null;};}function patchUpdates(_0x377b8d){return function(_0x54e5a8){try{jsonpatch[_0x701b('0x1d')](_0x54e5a8,_0x377b8d,!![]);}catch(_0x484106){return BPromise[_0x701b('0x1e')](_0x484106);}return _0x54e5a8['save']();};}function saveUpdates(_0x582aea,_0x2a623d){return function(_0x7decb0){if(_0x7decb0){return _0x7decb0['update'](_0x582aea)[_0x701b('0x1f')](function(_0x31c7f9){return _0x31c7f9;});}return null;};}function removeEntity(_0x416ba9,_0x1e6550){return function(_0x5ed596){if(_0x5ed596){return _0x5ed596[_0x701b('0x20')]()[_0x701b('0x1f')](function(){var _0x4b280b=_0x5ed596['get']({'plain':!![]});var _0x287831=_0x701b('0x21');return db[_0x701b('0x22')][_0x701b('0x20')]({'where':{'type':_0x287831,'resourceId':_0x4b280b['id']}})['then'](function(){return _0x5ed596;});})['then'](function(){_0x416ba9[_0x701b('0x15')](0xcc)[_0x701b('0x23')]();});}};}function handleEntityNotFound(_0x3e1f16,_0x27cd89){return function(_0x79471a){if(!_0x79471a){_0x3e1f16[_0x701b('0x24')](0x194);}return _0x79471a;};}function handleError(_0x2fea98,_0x445c6b){_0x445c6b=_0x445c6b||0x1f4;return function(_0x13d04c){logger[_0x701b('0x25')](_0x13d04c[_0x701b('0x26')]);if(_0x13d04c[_0x701b('0x27')]){delete _0x13d04c[_0x701b('0x27')];}_0x2fea98[_0x701b('0x15')](_0x445c6b)[_0x701b('0x28')](_0x13d04c);};}exports['index']=function(_0xb5c808,_0x3fc5ca){var _0x59da90={},_0x1e304f={},_0x54e359={'count':0x0,'rows':[]};var _0x5aeca2=_['map'](db['Sound'][_0x701b('0x29')],function(_0x4aecbf){return{'name':_0x4aecbf['fieldName'],'type':_0x4aecbf[_0x701b('0x2a')]['key']};});_0x1e304f[_0x701b('0x2b')]=_[_0x701b('0x2c')](_0x5aeca2,_0x701b('0x27'));_0x1e304f[_0x701b('0x2d')]=_[_0x701b('0x2e')](_0xb5c808['query']);_0x1e304f[_0x701b('0x2f')]=_['intersection'](_0x1e304f[_0x701b('0x2b')],_0x1e304f[_0x701b('0x2d')]);_0x59da90[_0x701b('0x30')]=_[_0x701b('0x31')](_0x1e304f['model'],qs[_0x701b('0x32')](_0xb5c808[_0x701b('0x2d')]['fields']));_0x59da90[_0x701b('0x30')]=_0x59da90[_0x701b('0x30')][_0x701b('0x33')]?_0x59da90['attributes']:_0x1e304f['model'];if(!_0xb5c808[_0x701b('0x2d')][_0x701b('0x34')]('nolimit')){_0x59da90['limit']=qs['limit'](_0xb5c808['query'][_0x701b('0x19')]);_0x59da90[_0x701b('0x17')]=qs['offset'](_0xb5c808[_0x701b('0x2d')][_0x701b('0x17')]);}_0x59da90[_0x701b('0x35')]=qs[_0x701b('0x36')](_0xb5c808[_0x701b('0x2d')]['sort']);_0x59da90['where']=qs[_0x701b('0x2f')](_['pick'](_0xb5c808[_0x701b('0x2d')],_0x1e304f[_0x701b('0x2f')]),_0x5aeca2);if(_0xb5c808[_0x701b('0x2d')][_0x701b('0x37')]){_0x59da90[_0x701b('0x38')]=_[_0x701b('0x39')](_0x59da90['where'],{'$or':_['map'](_0x5aeca2,function(_0x298379){if(_0x298379[_0x701b('0x2a')]!=='VIRTUAL'){var _0x403b2b={};_0x403b2b[_0x298379[_0x701b('0x27')]]={'$like':'%'+_0xb5c808[_0x701b('0x2d')][_0x701b('0x37')]+'%'};return _0x403b2b;}})});}_0x59da90=_['merge']({},_0x59da90,_0xb5c808[_0x701b('0x3a')]);var _0x553741={'where':_0x59da90[_0x701b('0x38')]};return db[_0x701b('0x3b')][_0x701b('0x1a')](_0x553741)[_0x701b('0x1f')](function(_0x35714b){_0x54e359['count']=_0x35714b;if(_0xb5c808[_0x701b('0x2d')][_0x701b('0x3c')]){_0x59da90['include']=[{'all':!![]}];}return db['Sound'][_0x701b('0x3d')](_0x59da90);})[_0x701b('0x1f')](function(_0x1bb478){_0x54e359['rows']=_0x1bb478;return _0x54e359;})[_0x701b('0x1f')](respondWithFilteredResult(_0x3fc5ca,_0x59da90))[_0x701b('0x3e')](handleError(_0x3fc5ca,null));};exports[_0x701b('0x3f')]=function(_0x1eccf4,_0xbe3556){var _0x5119e8={'raw':!![],'where':{'id':_0x1eccf4[_0x701b('0x40')]['id']}},_0xe3e37={};_0xe3e37[_0x701b('0x2b')]=_[_0x701b('0x2e')](db[_0x701b('0x3b')][_0x701b('0x29')]);_0xe3e37[_0x701b('0x2d')]=_[_0x701b('0x2e')](_0x1eccf4[_0x701b('0x2d')]);_0xe3e37[_0x701b('0x2f')]=_['intersection'](_0xe3e37[_0x701b('0x2b')],_0xe3e37['query']);_0x5119e8['attributes']=_['intersection'](_0xe3e37[_0x701b('0x2b')],qs[_0x701b('0x32')](_0x1eccf4[_0x701b('0x2d')][_0x701b('0x32')]));_0x5119e8['attributes']=_0x5119e8[_0x701b('0x30')][_0x701b('0x33')]?_0x5119e8[_0x701b('0x30')]:_0xe3e37['model'];if(_0x1eccf4[_0x701b('0x2d')][_0x701b('0x3c')]){_0x5119e8[_0x701b('0x41')]=[{'all':!![]}];}_0x5119e8=_['merge']({},_0x5119e8,_0x1eccf4['options']);return db[_0x701b('0x3b')]['find'](_0x5119e8)[_0x701b('0x1f')](handleEntityNotFound(_0xbe3556,null))['then'](respondWithResult(_0xbe3556,null))[_0x701b('0x3e')](handleError(_0xbe3556,null));};exports[_0x701b('0x42')]=function(_0x2800b4,_0x470708,_0x202be0){return db[_0x701b('0x3b')]['find']({'where':{'id':_0x2800b4[_0x701b('0x40')]['id']},'attributes':[_0x701b('0x27'),_0x701b('0x43'),_0x701b('0x44')],'raw':!![]})[_0x701b('0x1f')](handleEntityNotFound(_0x470708,null))['then'](function(_0x24fa04){if(_0x24fa04){if(!fs[_0x701b('0x45')](path[_0x701b('0x46')](config[_0x701b('0x47')],'server/files/sounds/converted',_0x24fa04[_0x701b('0x43')]+'.'+_0x24fa04[_0x701b('0x44')]))){throw new db[(_0x701b('0x48'))][(_0x701b('0x49'))]('Sound\x20not\x20found');}return _0x470708[_0x701b('0x42')](path[_0x701b('0x46')](config[_0x701b('0x47')],_0x701b('0x4a'),util[_0x701b('0x4b')](_0x701b('0x4c'),_0x24fa04[_0x701b('0x43')],_0x24fa04[_0x701b('0x44')])),util[_0x701b('0x4b')]('%s.%s',_0x24fa04['name'],_0x24fa04[_0x701b('0x44')]));}return null;})['catch'](handleError(_0x470708,null));};exports[_0x701b('0x4d')]=function(_0x9d9a46,_0x791ebd,_0x5cee21){var _0x15b817={'name':path[_0x701b('0x4e')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x50')],path[_0x701b('0x51')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x50')])),'save_name':path[_0x701b('0x4e')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x52')],path[_0x701b('0x51')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x52')])),'original_format':path[_0x701b('0x51')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x50')])[_0x701b('0x53')](0x1),'converted_format':_0x701b('0x54')};var _0x2de4a5=path[_0x701b('0x46')](config[_0x701b('0x47')],_0x701b('0x55'),_0x9d9a46[_0x701b('0x4f')][_0x701b('0x52')]);var _0x402b7f=path[_0x701b('0x46')](config[_0x701b('0x47')],_0x701b('0x4a'),util[_0x701b('0x4b')](_0x701b('0x4c'),path[_0x701b('0x4e')](_0x9d9a46[_0x701b('0x4f')][_0x701b('0x52')],path[_0x701b('0x51')](_0x9d9a46['file']['filename'])),_0x15b817['converted_format']));logger[_0x701b('0x56')](_0x701b('0x57'),_0x2de4a5);logger[_0x701b('0x56')](_0x701b('0x58'),_0x402b7f);try{fs[_0x701b('0x59')](_0x2de4a5,parseInt(_0x701b('0x5a'),0x8));var _0x223902=sox[_0x701b('0x5b')](_0x2de4a5,_0x402b7f,{'sampleRate':0x1f40,'format':_0x701b('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x223902['on'](_0x701b('0x25'),function(_0x290490){fs[_0x701b('0x5c')](_0x2de4a5);_0x791ebd['status'](0x1f4)[_0x701b('0x28')](_0x290490);});_0x223902['on']('src',function(_0x3e6092){_0x15b817[_0x701b('0x5d')]=isNaN(_0x3e6092[_0x701b('0x5e')])?null:_0x3e6092[_0x701b('0x5e')]*0x3e8;_0x15b817['original_sampleCount']=isNaN(_0x3e6092[_0x701b('0x5f')])?null:_0x3e6092[_0x701b('0x5f')];_0x15b817[_0x701b('0x60')]=isNaN(_0x3e6092['channelCount'])?null:_0x3e6092['channelCount'];_0x15b817['original_bitRate']=isNaN(_0x3e6092[_0x701b('0x61')])?null:_0x3e6092[_0x701b('0x61')];_0x15b817['original_sampleRate']=isNaN(_0x3e6092['sampleRate'])?null:_0x3e6092[_0x701b('0x62')];});_0x223902['on']('dest',function(_0x2226cd){_0x15b817[_0x701b('0x63')]=isNaN(_0x2226cd[_0x701b('0x5e')])?null:_0x2226cd[_0x701b('0x5e')]*0x3e8;_0x15b817[_0x701b('0x64')]=isNaN(_0x2226cd[_0x701b('0x5f')])?null:_0x2226cd[_0x701b('0x5f')];_0x15b817[_0x701b('0x65')]=isNaN(_0x2226cd[_0x701b('0x66')])?null:_0x2226cd[_0x701b('0x66')];_0x15b817[_0x701b('0x67')]=isNaN(_0x2226cd[_0x701b('0x61')])?null:_0x2226cd[_0x701b('0x61')];_0x15b817[_0x701b('0x68')]=isNaN(_0x2226cd['sampleRate'])?null:_0x2226cd[_0x701b('0x62')];});_0x223902['on'](_0x701b('0x23'),function(){fs[_0x701b('0x59')](_0x402b7f,parseInt(_0x701b('0x5a'),0x8));return db[_0x701b('0x3b')][_0x701b('0x4d')](_0x15b817)['then'](function(_0x49a211){var _0x9b3ef7={'role':_0x9d9a46[_0x701b('0x69')][_0x701b('0x6a')],'userProfileId':_0x9d9a46[_0x701b('0x69')]['userProfileId']};if(!_0x9b3ef7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9b3ef7[_0x701b('0x6a')]===_0x701b('0x6b')){var _0x2b820d=_0x49a211[_0x701b('0x6c')]({'plain':!![]});return db['UserProfileSection'][_0x701b('0x6d')]({'where':{'name':'Sounds','userProfileId':_0x9b3ef7[_0x701b('0x6e')]},'raw':!![]})['then'](function(_0x29d5a6){if(_0x29d5a6&&_0x29d5a6[_0x701b('0x6f')]===0x0){return db[_0x701b('0x22')][_0x701b('0x4d')]({'name':_0x2b820d[_0x701b('0x27')],'resourceId':_0x2b820d['id'],'type':_0x29d5a6[_0x701b('0x27')],'sectionId':_0x29d5a6['id']},{})[_0x701b('0x1f')](function(){return _0x49a211;});}else{return _0x49a211;}})['catch'](function(_0x256daa){logger[_0x701b('0x25')](_0x701b('0x70'),_0x256daa);throw _0x256daa;});}return _0x49a211;})[_0x701b('0x1f')](respondWithResult(_0x791ebd,null))[_0x701b('0x3e')](handleError(_0x791ebd,null));});_0x223902[_0x701b('0x71')]();}catch(_0x22be86){_0x791ebd[_0x701b('0x15')](0x1f4)[_0x701b('0x28')](_0x22be86);}};exports['update']=function(_0x27bf60,_0xa17602,_0x40f458){return db[_0x701b('0x3b')][_0x701b('0x6d')]({'where':{'id':_0x27bf60['params']['id']}})[_0x701b('0x1f')](handleEntityNotFound(_0xa17602,null))[_0x701b('0x1f')](saveUpdates(_[_0x701b('0x72')](_0x27bf60['body'],['name',_0x701b('0x73')]),null))['then'](respondWithResult(_0xa17602,null))[_0x701b('0x3e')](handleError(_0xa17602,null));};exports[_0x701b('0x74')]=function(_0x557b9d,_0x573a68,_0x5b66b6){return db['Sound'][_0x701b('0x6d')]({'where':{'id':_0x557b9d[_0x701b('0x40')]['id']}})[_0x701b('0x1f')](function(_0x165516){if(_0x165516){return _0x165516[_0x701b('0x20')]();}})['then'](function(_0x1c0563){var _0x31a717=path[_0x701b('0x46')](config['root'],_0x701b('0x55'),util[_0x701b('0x4b')](_0x701b('0x4c'),_0x1c0563[_0x701b('0x43')],_0x1c0563[_0x701b('0x75')]));var _0x25ce6f=path[_0x701b('0x46')](config[_0x701b('0x47')],'server/files/sounds/converted',util[_0x701b('0x4b')](_0x701b('0x4c'),_0x1c0563[_0x701b('0x43')],_0x1c0563[_0x701b('0x44')]));fs[_0x701b('0x5c')](_0x31a717);fs[_0x701b('0x5c')](_0x25ce6f);return _0x1c0563;})[_0x701b('0x1f')](function(_0x23ab52){if(_0x23ab52){return _0x573a68[_0x701b('0x15')](0xcc)[_0x701b('0x23')]();}})[_0x701b('0x1f')](handleEntityNotFound(_0x573a68,null))[_0x701b('0x3e')](handleError(_0x573a68,null));}; \ No newline at end of file +var _0x540b=['server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','Sound','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','params','save_name','converted_format','join'];(function(_0x319aa0,_0x5c5ef6){var _0x2c54c5=function(_0x51d9be){while(--_0x51d9be){_0x319aa0['push'](_0x319aa0['shift']());}};_0x2c54c5(++_0x5c5ef6);}(_0x540b,0xaa));var _0xb540=function(_0x3ad72b,_0x3d0114){_0x3ad72b=_0x3ad72b-0x0;var _0x5ab513=_0x540b[_0x3ad72b];return _0x5ab513;};'use strict';var emlformat=require(_0xb540('0x0'));var rimraf=require(_0xb540('0x1'));var zipdir=require(_0xb540('0x2'));var jsonpatch=require(_0xb540('0x3'));var rp=require(_0xb540('0x4'));var moment=require(_0xb540('0x5'));var BPromise=require(_0xb540('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb540('0x7'));var sox=require(_0xb540('0x8'));var csv=require('to-csv');var ejs=require(_0xb540('0x9'));var fs=require('fs');var fs_extra=require(_0xb540('0xa'));var _=require('lodash');var squel=require(_0xb540('0xb'));var crypto=require(_0xb540('0xc'));var jsforce=require(_0xb540('0xd'));var deskjs=require(_0xb540('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb540('0xf'));var Papa=require(_0xb540('0x10'));var Redis=require(_0xb540('0x11'));var authService=require(_0xb540('0x12'));var qs=require(_0xb540('0x13'));var as=require(_0xb540('0x14'));var hardwareService=require(_0xb540('0x15'));var logger=require(_0xb540('0x16'))(_0xb540('0x17'));var utils=require(_0xb540('0x18'));var config=require(_0xb540('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb540('0x1a'))['db'];function respondWithStatusCode(_0x4848d3,_0x4d119f){_0x4d119f=_0x4d119f||0xcc;return function(_0x570d86){if(_0x570d86){return _0x4848d3[_0xb540('0x1b')](_0x4d119f);}return _0x4848d3[_0xb540('0x1c')](_0x4d119f)[_0xb540('0x1d')]();};}function respondWithResult(_0x720429,_0x3549d1){_0x3549d1=_0x3549d1||0xc8;return function(_0x5a936c){if(_0x5a936c){return _0x720429['status'](_0x3549d1)[_0xb540('0x1e')](_0x5a936c);}};}function respondWithFilteredResult(_0x45f146,_0x1c6d35){return function(_0x3db20f){if(_0x3db20f){var _0x2e1d8c=typeof _0x1c6d35['offset']===_0xb540('0x1f')&&typeof _0x1c6d35[_0xb540('0x20')]==='undefined';var _0x13dc5b=_0x3db20f[_0xb540('0x21')];var _0x50838b=_0x2e1d8c?0x0:_0x1c6d35[_0xb540('0x22')];var _0x1e61c6=_0x2e1d8c?_0x3db20f[_0xb540('0x21')]:_0x1c6d35[_0xb540('0x22')]+_0x1c6d35[_0xb540('0x20')];var _0x12cdf4;if(_0x1e61c6>=_0x13dc5b){_0x1e61c6=_0x13dc5b;_0x12cdf4=0xc8;}else{_0x12cdf4=0xce;}_0x45f146[_0xb540('0x1c')](_0x12cdf4);return _0x45f146[_0xb540('0x23')](_0xb540('0x24'),_0x50838b+'-'+_0x1e61c6+'/'+_0x13dc5b)['json'](_0x3db20f);}return null;};}function patchUpdates(_0x8504af){return function(_0x14f114){try{jsonpatch['apply'](_0x14f114,_0x8504af,!![]);}catch(_0x194379){return BPromise[_0xb540('0x25')](_0x194379);}return _0x14f114[_0xb540('0x26')]();};}function saveUpdates(_0x439b5f,_0x36e73d){return function(_0x21885f){if(_0x21885f){return _0x21885f[_0xb540('0x27')](_0x439b5f)['then'](function(_0x4d9af4){return _0x4d9af4;});}return null;};}function removeEntity(_0x3c2094,_0x167c9f){return function(_0x306b0e){if(_0x306b0e){return _0x306b0e[_0xb540('0x28')]()[_0xb540('0x29')](function(){var _0x2fb0c0=_0x306b0e[_0xb540('0x2a')]({'plain':!![]});var _0x2ee385=_0xb540('0x2b');return db[_0xb540('0x2c')][_0xb540('0x28')]({'where':{'type':_0x2ee385,'resourceId':_0x2fb0c0['id']}})[_0xb540('0x29')](function(){return _0x306b0e;});})[_0xb540('0x29')](function(){_0x3c2094[_0xb540('0x1c')](0xcc)[_0xb540('0x1d')]();});}};}function handleEntityNotFound(_0x3ef338,_0x248018){return function(_0x94154){if(!_0x94154){_0x3ef338['sendStatus'](0x194);}return _0x94154;};}function handleError(_0x18b6d6,_0x282845){_0x282845=_0x282845||0x1f4;return function(_0x45a96b){logger[_0xb540('0x2d')](_0x45a96b[_0xb540('0x2e')]);if(_0x45a96b[_0xb540('0x2f')]){delete _0x45a96b[_0xb540('0x2f')];}_0x18b6d6['status'](_0x282845)[_0xb540('0x30')](_0x45a96b);};}exports['index']=function(_0x432fce,_0x9b1ad9){var _0x52d8d7={},_0x3d090b={},_0x44a49a={'count':0x0,'rows':[]};var _0x575930=_[_0xb540('0x31')](db['Sound']['rawAttributes'],function(_0x392b86){return{'name':_0x392b86[_0xb540('0x32')],'type':_0x392b86[_0xb540('0x33')][_0xb540('0x34')]};});_0x3d090b[_0xb540('0x35')]=_[_0xb540('0x31')](_0x575930,_0xb540('0x2f'));_0x3d090b[_0xb540('0x36')]=_['keys'](_0x432fce['query']);_0x3d090b[_0xb540('0x37')]=_['intersection'](_0x3d090b[_0xb540('0x35')],_0x3d090b[_0xb540('0x36')]);_0x52d8d7[_0xb540('0x38')]=_[_0xb540('0x39')](_0x3d090b[_0xb540('0x35')],qs[_0xb540('0x3a')](_0x432fce['query'][_0xb540('0x3a')]));_0x52d8d7[_0xb540('0x38')]=_0x52d8d7[_0xb540('0x38')]['length']?_0x52d8d7[_0xb540('0x38')]:_0x3d090b['model'];if(!_0x432fce['query']['hasOwnProperty']('nolimit')){_0x52d8d7[_0xb540('0x20')]=qs[_0xb540('0x20')](_0x432fce[_0xb540('0x36')][_0xb540('0x20')]);_0x52d8d7[_0xb540('0x22')]=qs[_0xb540('0x22')](_0x432fce[_0xb540('0x36')][_0xb540('0x22')]);}_0x52d8d7[_0xb540('0x3b')]=qs[_0xb540('0x3c')](_0x432fce[_0xb540('0x36')][_0xb540('0x3c')]);_0x52d8d7[_0xb540('0x3d')]=qs[_0xb540('0x37')](_[_0xb540('0x3e')](_0x432fce[_0xb540('0x36')],_0x3d090b[_0xb540('0x37')]),_0x575930);if(_0x432fce['query'][_0xb540('0x3f')]){_0x52d8d7[_0xb540('0x3d')]=_[_0xb540('0x40')](_0x52d8d7[_0xb540('0x3d')],{'$or':_[_0xb540('0x31')](_0x575930,function(_0x3b9c9a){if(_0x3b9c9a[_0xb540('0x33')]!==_0xb540('0x41')){var _0x1f396b={};_0x1f396b[_0x3b9c9a[_0xb540('0x2f')]]={'$like':'%'+_0x432fce[_0xb540('0x36')][_0xb540('0x3f')]+'%'};return _0x1f396b;}})});}_0x52d8d7=_['merge']({},_0x52d8d7,_0x432fce['options']);var _0xaef67d={'where':_0x52d8d7[_0xb540('0x3d')]};return db[_0xb540('0x42')][_0xb540('0x21')](_0xaef67d)['then'](function(_0x3234f9){_0x44a49a[_0xb540('0x21')]=_0x3234f9;if(_0x432fce['query'][_0xb540('0x43')]){_0x52d8d7[_0xb540('0x44')]=[{'all':!![]}];}return db[_0xb540('0x42')][_0xb540('0x45')](_0x52d8d7);})[_0xb540('0x29')](function(_0xc0f468){_0x44a49a[_0xb540('0x46')]=_0xc0f468;return _0x44a49a;})[_0xb540('0x29')](respondWithFilteredResult(_0x9b1ad9,_0x52d8d7))[_0xb540('0x47')](handleError(_0x9b1ad9,null));};exports[_0xb540('0x48')]=function(_0x23f259,_0x1efd5a){var _0x289352={'raw':!![],'where':{'id':_0x23f259['params']['id']}},_0x5ba2f7={};_0x5ba2f7[_0xb540('0x35')]=_[_0xb540('0x49')](db[_0xb540('0x42')][_0xb540('0x4a')]);_0x5ba2f7[_0xb540('0x36')]=_[_0xb540('0x49')](_0x23f259['query']);_0x5ba2f7[_0xb540('0x37')]=_[_0xb540('0x39')](_0x5ba2f7['model'],_0x5ba2f7[_0xb540('0x36')]);_0x289352[_0xb540('0x38')]=_['intersection'](_0x5ba2f7[_0xb540('0x35')],qs[_0xb540('0x3a')](_0x23f259[_0xb540('0x36')]['fields']));_0x289352['attributes']=_0x289352['attributes']['length']?_0x289352[_0xb540('0x38')]:_0x5ba2f7[_0xb540('0x35')];if(_0x23f259[_0xb540('0x36')][_0xb540('0x43')]){_0x289352['include']=[{'all':!![]}];}_0x289352=_[_0xb540('0x40')]({},_0x289352,_0x23f259['options']);return db['Sound'][_0xb540('0x4b')](_0x289352)['then'](handleEntityNotFound(_0x1efd5a,null))['then'](respondWithResult(_0x1efd5a,null))[_0xb540('0x47')](handleError(_0x1efd5a,null));};exports['download']=function(_0x364524,_0xbf4341,_0x158d6a){return db[_0xb540('0x42')][_0xb540('0x4b')]({'where':{'id':_0x364524[_0xb540('0x4c')]['id']},'attributes':[_0xb540('0x2f'),_0xb540('0x4d'),_0xb540('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0xbf4341,null))['then'](function(_0x3e439c){if(_0x3e439c){if(!fs['existsSync'](path[_0xb540('0x4f')](config['root'],_0xb540('0x50'),_0x3e439c[_0xb540('0x4d')]+'.'+_0x3e439c[_0xb540('0x4e')]))){throw new db[(_0xb540('0x51'))][(_0xb540('0x52'))](_0xb540('0x53'));}return _0xbf4341['download'](path[_0xb540('0x4f')](config[_0xb540('0x54')],_0xb540('0x50'),util[_0xb540('0x55')](_0xb540('0x56'),_0x3e439c[_0xb540('0x4d')],_0x3e439c['converted_format'])),util[_0xb540('0x55')](_0xb540('0x56'),_0x3e439c['name'],_0x3e439c[_0xb540('0x4e')]));}return null;})['catch'](handleError(_0xbf4341,null));};exports[_0xb540('0x57')]=function(_0x3085a9,_0x4acd12,_0x3e0e2f){var _0x1c033b={'name':path[_0xb540('0x58')](_0x3085a9[_0xb540('0x59')][_0xb540('0x5a')],path[_0xb540('0x5b')](_0x3085a9[_0xb540('0x59')][_0xb540('0x5a')])),'save_name':path[_0xb540('0x58')](_0x3085a9[_0xb540('0x59')]['filename'],path[_0xb540('0x5b')](_0x3085a9[_0xb540('0x59')][_0xb540('0x5c')])),'original_format':path['extname'](_0x3085a9['file'][_0xb540('0x5a')])['substring'](0x1),'converted_format':_0xb540('0x5d')};var _0x51913f=path[_0xb540('0x4f')](config[_0xb540('0x54')],_0xb540('0x5e'),_0x3085a9['file'][_0xb540('0x5c')]);var _0x7051e3=path[_0xb540('0x4f')](config[_0xb540('0x54')],'server/files/sounds/converted',util[_0xb540('0x55')]('%s.%s',path[_0xb540('0x58')](_0x3085a9[_0xb540('0x59')][_0xb540('0x5c')],path[_0xb540('0x5b')](_0x3085a9[_0xb540('0x59')][_0xb540('0x5c')])),_0x1c033b[_0xb540('0x4e')]));logger[_0xb540('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x51913f);logger[_0xb540('0x5f')](_0xb540('0x60'),_0x7051e3);try{fs[_0xb540('0x61')](_0x51913f,parseInt(_0xb540('0x62'),0x8));var _0xf25573=sox[_0xb540('0x63')](_0x51913f,_0x7051e3,{'sampleRate':0x1f40,'format':_0xb540('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf25573['on'](_0xb540('0x2d'),function(_0x1e50e2){fs[_0xb540('0x64')](_0x51913f);_0x4acd12['status'](0x1f4)['send'](_0x1e50e2);});_0xf25573['on'](_0xb540('0x65'),function(_0xcd896c){_0x1c033b['original_duration']=isNaN(_0xcd896c[_0xb540('0x66')])?null:_0xcd896c[_0xb540('0x66')]*0x3e8;_0x1c033b['original_sampleCount']=isNaN(_0xcd896c[_0xb540('0x67')])?null:_0xcd896c[_0xb540('0x67')];_0x1c033b[_0xb540('0x68')]=isNaN(_0xcd896c[_0xb540('0x69')])?null:_0xcd896c[_0xb540('0x69')];_0x1c033b[_0xb540('0x6a')]=isNaN(_0xcd896c[_0xb540('0x6b')])?null:_0xcd896c['bitRate'];_0x1c033b[_0xb540('0x6c')]=isNaN(_0xcd896c['sampleRate'])?null:_0xcd896c['sampleRate'];});_0xf25573['on'](_0xb540('0x6d'),function(_0x196f32){_0x1c033b[_0xb540('0x6e')]=isNaN(_0x196f32[_0xb540('0x66')])?null:_0x196f32[_0xb540('0x66')]*0x3e8;_0x1c033b[_0xb540('0x6f')]=isNaN(_0x196f32[_0xb540('0x67')])?null:_0x196f32['sampleCount'];_0x1c033b[_0xb540('0x70')]=isNaN(_0x196f32[_0xb540('0x69')])?null:_0x196f32[_0xb540('0x69')];_0x1c033b[_0xb540('0x71')]=isNaN(_0x196f32[_0xb540('0x6b')])?null:_0x196f32[_0xb540('0x6b')];_0x1c033b[_0xb540('0x72')]=isNaN(_0x196f32[_0xb540('0x73')])?null:_0x196f32[_0xb540('0x73')];});_0xf25573['on']('end',function(){fs[_0xb540('0x61')](_0x7051e3,parseInt(_0xb540('0x62'),0x8));return db[_0xb540('0x42')][_0xb540('0x57')](_0x1c033b)['then'](function(_0x3ce621){var _0x251315={'role':_0x3085a9[_0xb540('0x74')][_0xb540('0x75')],'userProfileId':_0x3085a9[_0xb540('0x74')][_0xb540('0x76')]};if(!_0x251315)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251315['role']===_0xb540('0x77')){var _0x3c0c7c=_0x3ce621[_0xb540('0x2a')]({'plain':!![]});return db[_0xb540('0x78')][_0xb540('0x4b')]({'where':{'name':_0xb540('0x2b'),'userProfileId':_0x251315[_0xb540('0x76')]},'raw':!![]})['then'](function(_0x3887a4){if(_0x3887a4&&_0x3887a4['autoAssociation']===0x0){return db[_0xb540('0x2c')][_0xb540('0x57')]({'name':_0x3c0c7c[_0xb540('0x2f')],'resourceId':_0x3c0c7c['id'],'type':_0x3887a4[_0xb540('0x2f')],'sectionId':_0x3887a4['id']},{})[_0xb540('0x29')](function(){return _0x3ce621;});}else{return _0x3ce621;}})[_0xb540('0x47')](function(_0x56723b){logger[_0xb540('0x2d')](_0xb540('0x79'),_0x56723b);throw _0x56723b;});}return _0x3ce621;})[_0xb540('0x29')](respondWithResult(_0x4acd12,null))[_0xb540('0x47')](handleError(_0x4acd12,null));});_0xf25573[_0xb540('0x7a')]();}catch(_0x1051c8){_0x4acd12[_0xb540('0x1c')](0x1f4)[_0xb540('0x30')](_0x1051c8);}};exports[_0xb540('0x27')]=function(_0x5e05ad,_0x17bd26,_0x5a1a67){return db[_0xb540('0x42')][_0xb540('0x4b')]({'where':{'id':_0x5e05ad['params']['id']}})[_0xb540('0x29')](handleEntityNotFound(_0x17bd26,null))[_0xb540('0x29')](saveUpdates(_[_0xb540('0x3e')](_0x5e05ad[_0xb540('0x74')],['name',_0xb540('0x7b')]),null))[_0xb540('0x29')](respondWithResult(_0x17bd26,null))['catch'](handleError(_0x17bd26,null));};exports['delete']=function(_0x37b683,_0x39bbe4,_0x9099ac){return db[_0xb540('0x42')][_0xb540('0x4b')]({'where':{'id':_0x37b683[_0xb540('0x4c')]['id']}})[_0xb540('0x29')](function(_0x22c286){if(_0x22c286){return _0x22c286[_0xb540('0x28')]();}})[_0xb540('0x29')](function(_0x4dbc03){var _0x33ac70=path['join'](config[_0xb540('0x54')],_0xb540('0x5e'),util['format'](_0xb540('0x56'),_0x4dbc03[_0xb540('0x4d')],_0x4dbc03[_0xb540('0x7c')]));var _0x42cabe=path[_0xb540('0x4f')](config[_0xb540('0x54')],'server/files/sounds/converted',util[_0xb540('0x55')](_0xb540('0x56'),_0x4dbc03['save_name'],_0x4dbc03[_0xb540('0x4e')]));fs[_0xb540('0x64')](_0x33ac70);fs['unlinkSync'](_0x42cabe);return _0x4dbc03;})[_0xb540('0x29')](function(_0x537c5b){if(_0x537c5b){return _0x39bbe4[_0xb540('0x1c')](0xcc)[_0xb540('0x1d')]();}})[_0xb540('0x29')](handleEntityNotFound(_0x39bbe4,null))[_0xb540('0x47')](handleError(_0x39bbe4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 02d3e04..28a4de8 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 _0x863c=['tools_sounds','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x863c,0x1d5));var _0xc863=function(_0x215991,_0x4331f2){_0x215991=_0x215991-0x0;var _0x44a588=_0x863c[_0x215991];return _0x44a588;};'use strict';var _=require(_0xc863('0x0'));var util=require(_0xc863('0x1'));var logger=require('../../config/logger')(_0xc863('0x2'));var moment=require(_0xc863('0x3'));var BPromise=require(_0xc863('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc863('0x5'));var config=require(_0xc863('0x6'));var attributes=require(_0xc863('0x7'));module[_0xc863('0x8')]=function(_0x45ea2a,_0x39468a){return _0x45ea2a[_0xc863('0x9')](_0xc863('0xa'),attributes,{'tableName':_0xc863('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dad=['Sound','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x2c6147,_0x30daee){var _0x4bdee8=function(_0x4f8ee3){while(--_0x4f8ee3){_0x2c6147['push'](_0x2c6147['shift']());}};_0x4bdee8(++_0x30daee);}(_0x8dad,0x1bd));var _0xd8da=function(_0x565ead,_0x2003a4){_0x565ead=_0x565ead-0x0;var _0x2d5b53=_0x8dad[_0x565ead];return _0x2d5b53;};'use strict';var _=require(_0xd8da('0x0'));var util=require(_0xd8da('0x1'));var logger=require(_0xd8da('0x2'))(_0xd8da('0x3'));var moment=require(_0xd8da('0x4'));var BPromise=require('bluebird');var rp=require(_0xd8da('0x5'));var fs=require('fs');var path=require(_0xd8da('0x6'));var rimraf=require(_0xd8da('0x7'));var config=require(_0xd8da('0x8'));var attributes=require(_0xd8da('0x9'));module[_0xd8da('0xa')]=function(_0x37ceb7,_0x4d2ba1){return _0x37ceb7['define'](_0xd8da('0xb'),attributes,{'tableName':'tools_sounds','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 d83f398..1cdecfd 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 _0x8751=['result','catch','Sound','options','where','attributes','include','model','map','ShowSound','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x44c4c4,_0x24b65d){var _0x9db6b1=function(_0x43192f){while(--_0x43192f){_0x44c4c4['push'](_0x44c4c4['shift']());}};_0x9db6b1(++_0x24b65d);}(_0x8751,0x160));var _0x1875=function(_0x4f53a9,_0x5c88b0){_0x4f53a9=_0x4f53a9-0x0;var _0x3f6105=_0x8751[_0x4f53a9];return _0x3f6105;};'use strict';var _=require(_0x1875('0x0'));var util=require(_0x1875('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1875('0x2'));var fs=require('fs');var Redis=require(_0x1875('0x3'));var db=require(_0x1875('0x4'))['db'];var utils=require(_0x1875('0x5'));var logger=require(_0x1875('0x6'))(_0x1875('0x7'));var config=require(_0x1875('0x8'));var jayson=require(_0x1875('0x9'));var client=jayson[_0x1875('0xa')][_0x1875('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b535b,_0x159a01,_0x2506fd){return new BPromise(function(_0x199682,_0x570f85){return client[_0x1875('0xc')](_0x1b535b,_0x2506fd)[_0x1875('0xd')](function(_0x40e95b){logger['info'](_0x1875('0xe'),_0x159a01,_0x1875('0xf'));logger[_0x1875('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x159a01,'request\x20sent',JSON['stringify'](_0x40e95b));if(_0x40e95b['error']){if(_0x40e95b[_0x1875('0x11')][_0x1875('0x12')]===0x1f4){logger[_0x1875('0x11')](_0x1875('0xe'),_0x159a01,_0x40e95b['error'][_0x1875('0x13')]);return _0x570f85(_0x40e95b[_0x1875('0x11')]['message']);}logger[_0x1875('0x11')]('Sound,\x20%s,\x20%s',_0x159a01,_0x40e95b['error']['message']);return _0x199682(_0x40e95b[_0x1875('0x11')][_0x1875('0x13')]);}else{logger['info'](_0x1875('0xe'),_0x159a01,_0x1875('0xf'));_0x199682(_0x40e95b[_0x1875('0x14')]['message']);}})[_0x1875('0x15')](function(_0x322463){logger[_0x1875('0x11')]('Sound,\x20%s,\x20%s',_0x159a01,_0x322463);_0x570f85(_0x322463);});});}exports['ShowSound']=function(_0x3ca8d5){var _0x36180f=this;return new Promise(function(_0x4ba379,_0x2e83fe){return db[_0x1875('0x16')]['find']({'raw':_0x3ca8d5[_0x1875('0x17')]?_0x3ca8d5[_0x1875('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3ca8d5[_0x1875('0x17')]?_0x3ca8d5[_0x1875('0x17')][_0x1875('0x18')]||null:null,'attributes':_0x3ca8d5[_0x1875('0x17')]?_0x3ca8d5['options'][_0x1875('0x19')]||null:null,'include':_0x3ca8d5[_0x1875('0x17')]?_0x3ca8d5['options'][_0x1875('0x1a')]?_['map'](_0x3ca8d5[_0x1875('0x17')][_0x1875('0x1a')],function(_0x49fab5){return{'model':db[_0x49fab5[_0x1875('0x1b')]],'as':_0x49fab5['as'],'attributes':_0x49fab5[_0x1875('0x19')],'include':_0x49fab5[_0x1875('0x1a')]?_[_0x1875('0x1c')](_0x49fab5[_0x1875('0x1a')],function(_0x59e5b7){return{'model':db[_0x59e5b7[_0x1875('0x1b')]],'as':_0x59e5b7['as'],'attributes':_0x59e5b7[_0x1875('0x19')],'include':_0x59e5b7[_0x1875('0x1a')]?_[_0x1875('0x1c')](_0x59e5b7[_0x1875('0x1a')],function(_0x2f9963){return{'model':db[_0x2f9963[_0x1875('0x1b')]],'as':_0x2f9963['as'],'attributes':_0x2f9963[_0x1875('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1875('0xd')](function(_0x231f25){logger['info'](_0x1875('0x1d'),_0x3ca8d5);logger[_0x1875('0x10')](_0x1875('0x1d'),_0x3ca8d5,JSON[_0x1875('0x1e')](_0x231f25));_0x4ba379(_0x231f25);})['catch'](function(_0x396386){logger[_0x1875('0x11')]('ShowSound',_0x396386['message'],_0x3ca8d5);_0x2e83fe(_0x36180f[_0x1875('0x11')](0x1f4,_0x396386[_0x1875('0x13')]));});});}; \ No newline at end of file +var _0x2271=['result','catch','ShowSound','Sound','find','options','include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2271,0xbf));var _0x1227=function(_0x5354b2,_0x1b3716){_0x5354b2=_0x5354b2-0x0;var _0x1442f6=_0x2271[_0x5354b2];return _0x1442f6;};'use strict';var _=require(_0x1227('0x0'));var util=require(_0x1227('0x1'));var moment=require(_0x1227('0x2'));var BPromise=require(_0x1227('0x3'));var rs=require(_0x1227('0x4'));var fs=require('fs');var Redis=require(_0x1227('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1227('0x6'));var logger=require(_0x1227('0x7'))('rpc');var config=require(_0x1227('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1227('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36915b,_0x43f221,_0x3e991b){return new BPromise(function(_0x3cbed6,_0x3ad7e1){return client[_0x1227('0xa')](_0x36915b,_0x3e991b)['then'](function(_0x26648e){logger[_0x1227('0xb')]('Sound,\x20%s,\x20%s',_0x43f221,_0x1227('0xc'));logger['debug'](_0x1227('0xd'),_0x43f221,_0x1227('0xc'),JSON[_0x1227('0xe')](_0x26648e));if(_0x26648e[_0x1227('0xf')]){if(_0x26648e[_0x1227('0xf')][_0x1227('0x10')]===0x1f4){logger[_0x1227('0xf')](_0x1227('0x11'),_0x43f221,_0x26648e['error']['message']);return _0x3ad7e1(_0x26648e[_0x1227('0xf')][_0x1227('0x12')]);}logger[_0x1227('0xf')](_0x1227('0x11'),_0x43f221,_0x26648e[_0x1227('0xf')][_0x1227('0x12')]);return _0x3cbed6(_0x26648e[_0x1227('0xf')][_0x1227('0x12')]);}else{logger[_0x1227('0xb')](_0x1227('0x11'),_0x43f221,_0x1227('0xc'));_0x3cbed6(_0x26648e[_0x1227('0x13')][_0x1227('0x12')]);}})[_0x1227('0x14')](function(_0x2b0cf4){logger['error'](_0x1227('0x11'),_0x43f221,_0x2b0cf4);_0x3ad7e1(_0x2b0cf4);});});}exports[_0x1227('0x15')]=function(_0x2e4409){var _0x502a15=this;return new Promise(function(_0xd942cb,_0x136f69){return db[_0x1227('0x16')][_0x1227('0x17')]({'raw':_0x2e4409[_0x1227('0x18')]?_0x2e4409[_0x1227('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e4409['options']?_0x2e4409[_0x1227('0x18')]['where']||null:null,'attributes':_0x2e4409[_0x1227('0x18')]?_0x2e4409['options']['attributes']||null:null,'include':_0x2e4409['options']?_0x2e4409['options'][_0x1227('0x19')]?_[_0x1227('0x1a')](_0x2e4409[_0x1227('0x18')][_0x1227('0x19')],function(_0x169cff){return{'model':db[_0x169cff[_0x1227('0x1b')]],'as':_0x169cff['as'],'attributes':_0x169cff[_0x1227('0x1c')],'include':_0x169cff[_0x1227('0x19')]?_[_0x1227('0x1a')](_0x169cff[_0x1227('0x19')],function(_0x1f83c6){return{'model':db[_0x1f83c6[_0x1227('0x1b')]],'as':_0x1f83c6['as'],'attributes':_0x1f83c6[_0x1227('0x1c')],'include':_0x1f83c6[_0x1227('0x19')]?_[_0x1227('0x1a')](_0x1f83c6[_0x1227('0x19')],function(_0x36a08e){return{'model':db[_0x36a08e[_0x1227('0x1b')]],'as':_0x36a08e['as'],'attributes':_0x36a08e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aad58){logger['info']('ShowSound',_0x2e4409);logger[_0x1227('0x1d')](_0x1227('0x15'),_0x2e4409,JSON[_0x1227('0xe')](_0x4aad58));_0xd942cb(_0x4aad58);})['catch'](function(_0x5238b2){logger['error'](_0x1227('0x15'),_0x5238b2['message'],_0x2e4409);_0x136f69(_0x502a15[_0x1227('0xf')](0x1f4,_0x5238b2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index eba348a..06f8885 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x7450d2,_0x46afc8){var _0x5987aa=function(_0x5cd719){while(--_0x5cd719){_0x7450d2['push'](_0x7450d2['shift']());}};_0x5987aa(++_0x46afc8);}(_0x2032,0xd9));var _0x2203=function(_0x55e529,_0x50661a){_0x55e529=_0x55e529-0x0;var _0x5870f8=_0x2032[_0x55e529];return _0x5870f8;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0x0b0e[_0x38de33];return _0x40f16d;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ae9d0ae..4629748 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 _0xefab=['ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xefab,0x110));var _0xbefa=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xefab[_0x1a6363];return _0xd22157;};'use strict';var Sequelize=require(_0xbefa('0x0'));module[_0xbefa('0x1')]={'uniqueid':{'type':Sequelize[_0xbefa('0x2')]},'body':{'type':Sequelize[_0xbefa('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xbefa('0x4')]('in','out'),'defaultValue':_0xbefa('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xbefa('0x2')]},'providerResponse':{'type':Sequelize[_0xbefa('0x3')]}}; \ No newline at end of file +var _0x81ef=['medium','out','sequelize','exports','TEXT'];(function(_0x179ac4,_0x4752f2){var _0x29263a=function(_0x5bb364){while(--_0x5bb364){_0x179ac4['push'](_0x179ac4['shift']());}};_0x29263a(++_0x4752f2);}(_0x81ef,0x1dd));var _0xf81e=function(_0x5b2c66,_0x188f9d){_0x5b2c66=_0x5b2c66-0x0;var _0x1b1e53=_0x81ef[_0x5b2c66];return _0x1b1e53;};'use strict';var Sequelize=require(_0xf81e('0x0'));module[_0xf81e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf81e('0x2')](_0xf81e('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf81e('0x4')),'defaultValue':_0xf81e('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf81e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 840f0be..8e5a5aa 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 _0x74e6=['where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','error','stack','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2c3048,_0x58b4fb){var _0x5c844d=function(_0x1886fa){while(--_0x1886fa){_0x2c3048['push'](_0x2c3048['shift']());}};_0x5c844d(++_0x58b4fb);}(_0x74e6,0xed));var _0x674e=function(_0x4ea4d3,_0x459c9c){_0x4ea4d3=_0x4ea4d3-0x0;var _0x25dd47=_0x74e6[_0x4ea4d3];return _0x25dd47;};'use strict';var emlformat=require(_0x674e('0x0'));var rimraf=require(_0x674e('0x1'));var zipdir=require(_0x674e('0x2'));var jsonpatch=require(_0x674e('0x3'));var rp=require('request-promise');var moment=require(_0x674e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x674e('0x5'));var util=require(_0x674e('0x6'));var path=require(_0x674e('0x7'));var sox=require(_0x674e('0x8'));var csv=require('to-csv');var ejs=require(_0x674e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x674e('0xa'));var squel=require(_0x674e('0xb'));var crypto=require(_0x674e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x674e('0xd'));var querystring=require('querystring');var Papa=require(_0x674e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x674e('0xf'));var as=require(_0x674e('0x10'));var hardwareService=require(_0x674e('0x11'));var logger=require(_0x674e('0x12'))(_0x674e('0x13'));var utils=require(_0x674e('0x14'));var config=require(_0x674e('0x15'));var licenseUtil=require(_0x674e('0x16'));var db=require(_0x674e('0x17'))['db'];function respondWithStatusCode(_0x5458dd,_0x259ae3){_0x259ae3=_0x259ae3||0xcc;return function(_0x24a8c0){if(_0x24a8c0){return _0x5458dd[_0x674e('0x18')](_0x259ae3);}return _0x5458dd['status'](_0x259ae3)['end']();};}function respondWithResult(_0xc863b3,_0x10037d){_0x10037d=_0x10037d||0xc8;return function(_0x4c559e){if(_0x4c559e){return _0xc863b3['status'](_0x10037d)[_0x674e('0x19')](_0x4c559e);}};}function respondWithFilteredResult(_0xb063c,_0x649460){return function(_0x50beb4){if(_0x50beb4){var _0x4c00d0=typeof _0x649460[_0x674e('0x1a')]===_0x674e('0x1b')&&typeof _0x649460[_0x674e('0x1c')]==='undefined';var _0x52eaa8=_0x50beb4['count'];var _0x397cb0=_0x4c00d0?0x0:_0x649460[_0x674e('0x1a')];var _0x32b08=_0x4c00d0?_0x50beb4[_0x674e('0x1d')]:_0x649460[_0x674e('0x1a')]+_0x649460[_0x674e('0x1c')];var _0x13fe1b;if(_0x32b08>=_0x52eaa8){_0x32b08=_0x52eaa8;_0x13fe1b=0xc8;}else{_0x13fe1b=0xce;}_0xb063c[_0x674e('0x1e')](_0x13fe1b);return _0xb063c[_0x674e('0x1f')]('Content-Range',_0x397cb0+'-'+_0x32b08+'/'+_0x52eaa8)['json'](_0x50beb4);}return null;};}function patchUpdates(_0x59c426){return function(_0x36f49b){try{jsonpatch[_0x674e('0x20')](_0x36f49b,_0x59c426,!![]);}catch(_0x1fc50f){return BPromise[_0x674e('0x21')](_0x1fc50f);}return _0x36f49b[_0x674e('0x22')]();};}function saveUpdates(_0x473309,_0x513662){return function(_0x588929){if(_0x588929){return _0x588929[_0x674e('0x23')](_0x473309)[_0x674e('0x24')](function(_0x2c596a){return _0x2c596a;});}return null;};}function removeEntity(_0x3e816e,_0x5dfbf7){return function(_0x496edd){if(_0x496edd){return _0x496edd['destroy']()['then'](function(){_0x3e816e[_0x674e('0x1e')](0xcc)[_0x674e('0x25')]();});}};}function handleEntityNotFound(_0x4674d2,_0x2f37a0){return function(_0x55aaf1){if(!_0x55aaf1){_0x4674d2[_0x674e('0x18')](0x194);}return _0x55aaf1;};}function handleError(_0x4d7fde,_0x243b2f){_0x243b2f=_0x243b2f||0x1f4;return function(_0x8de59e){logger[_0x674e('0x26')](_0x8de59e[_0x674e('0x27')]);if(_0x8de59e['name']){delete _0x8de59e[_0x674e('0x28')];}_0x4d7fde[_0x674e('0x1e')](_0x243b2f)['send'](_0x8de59e);};}exports[_0x674e('0x29')]=function(_0x5d1f5b,_0x27ee32){var _0x483d13={},_0x45f960={},_0x349d91={'count':0x0,'rows':[]};var _0x54ccaa=_['map'](db[_0x674e('0x2a')][_0x674e('0x2b')],function(_0x57031d){return{'name':_0x57031d[_0x674e('0x2c')],'type':_0x57031d[_0x674e('0x2d')][_0x674e('0x2e')]};});_0x45f960[_0x674e('0x2f')]=_[_0x674e('0x30')](_0x54ccaa,_0x674e('0x28'));_0x45f960[_0x674e('0x31')]=_[_0x674e('0x32')](_0x5d1f5b[_0x674e('0x31')]);_0x45f960[_0x674e('0x33')]=_[_0x674e('0x34')](_0x45f960['model'],_0x45f960[_0x674e('0x31')]);_0x483d13[_0x674e('0x35')]=_[_0x674e('0x34')](_0x45f960[_0x674e('0x2f')],qs['fields'](_0x5d1f5b[_0x674e('0x31')][_0x674e('0x36')]));_0x483d13[_0x674e('0x35')]=_0x483d13[_0x674e('0x35')][_0x674e('0x37')]?_0x483d13[_0x674e('0x35')]:_0x45f960[_0x674e('0x2f')];if(!_0x5d1f5b[_0x674e('0x31')][_0x674e('0x38')]('nolimit')){_0x483d13['limit']=qs[_0x674e('0x1c')](_0x5d1f5b['query'][_0x674e('0x1c')]);_0x483d13[_0x674e('0x1a')]=qs[_0x674e('0x1a')](_0x5d1f5b[_0x674e('0x31')][_0x674e('0x1a')]);}_0x483d13[_0x674e('0x39')]=qs[_0x674e('0x3a')](_0x5d1f5b[_0x674e('0x31')]['sort']);_0x483d13[_0x674e('0x3b')]=qs['filters'](_[_0x674e('0x3c')](_0x5d1f5b[_0x674e('0x31')],_0x45f960[_0x674e('0x33')]),_0x54ccaa);if(_0x5d1f5b[_0x674e('0x31')][_0x674e('0x3d')]){_0x483d13[_0x674e('0x3b')]=_[_0x674e('0x3e')](_0x483d13['where'],{'$or':_[_0x674e('0x30')](_0x54ccaa,function(_0x4fd117){if(_0x4fd117['type']!==_0x674e('0x3f')){var _0x564a0e={};_0x564a0e[_0x4fd117[_0x674e('0x28')]]={'$like':'%'+_0x5d1f5b[_0x674e('0x31')][_0x674e('0x3d')]+'%'};return _0x564a0e;}})});}_0x483d13=_['merge']({},_0x483d13,_0x5d1f5b[_0x674e('0x40')]);var _0x5385e6={'where':_0x483d13[_0x674e('0x3b')]};return db['SquareMessage'][_0x674e('0x1d')](_0x5385e6)[_0x674e('0x24')](function(_0x5e5d2b){_0x349d91[_0x674e('0x1d')]=_0x5e5d2b;if(_0x5d1f5b[_0x674e('0x31')][_0x674e('0x41')]){_0x483d13['include']=[{'all':!![]}];}return db[_0x674e('0x2a')]['findAll'](_0x483d13);})[_0x674e('0x24')](function(_0x57fe71){_0x349d91[_0x674e('0x42')]=_0x57fe71;return _0x349d91;})[_0x674e('0x24')](respondWithFilteredResult(_0x27ee32,_0x483d13))[_0x674e('0x43')](handleError(_0x27ee32,null));};exports[_0x674e('0x44')]=function(_0x4ae225,_0x3b8282){var _0x598a82={'raw':!![],'where':{'id':_0x4ae225['params']['id']}},_0x2a3d36={};_0x2a3d36['model']=_['keys'](db[_0x674e('0x2a')]['rawAttributes']);_0x2a3d36[_0x674e('0x31')]=_[_0x674e('0x32')](_0x4ae225['query']);_0x2a3d36[_0x674e('0x33')]=_[_0x674e('0x34')](_0x2a3d36[_0x674e('0x2f')],_0x2a3d36[_0x674e('0x31')]);_0x598a82['attributes']=_[_0x674e('0x34')](_0x2a3d36[_0x674e('0x2f')],qs[_0x674e('0x36')](_0x4ae225['query']['fields']));_0x598a82[_0x674e('0x35')]=_0x598a82[_0x674e('0x35')]['length']?_0x598a82[_0x674e('0x35')]:_0x2a3d36[_0x674e('0x2f')];if(_0x4ae225[_0x674e('0x31')][_0x674e('0x41')]){_0x598a82['include']=[{'all':!![]}];}_0x598a82=_[_0x674e('0x3e')]({},_0x598a82,_0x4ae225[_0x674e('0x40')]);return db['SquareMessage'][_0x674e('0x45')](_0x598a82)[_0x674e('0x24')](handleEntityNotFound(_0x3b8282,null))[_0x674e('0x24')](respondWithResult(_0x3b8282,null))['catch'](handleError(_0x3b8282,null));};exports[_0x674e('0x46')]=function(_0x2f1f71,_0x121657){return db['SquareMessage']['create'](_0x2f1f71[_0x674e('0x47')],{})[_0x674e('0x24')](respondWithResult(_0x121657,0xc9))[_0x674e('0x43')](handleError(_0x121657,null));};exports[_0x674e('0x23')]=function(_0x1c359d,_0xf832ed){if(_0x1c359d[_0x674e('0x47')]['id']){delete _0x1c359d['body']['id'];}return db[_0x674e('0x2a')][_0x674e('0x45')]({'where':{'id':_0x1c359d['params']['id']}})['then'](handleEntityNotFound(_0xf832ed,null))[_0x674e('0x24')](saveUpdates(_0x1c359d['body'],null))[_0x674e('0x24')](respondWithResult(_0xf832ed,null))[_0x674e('0x43')](handleError(_0xf832ed,null));};exports[_0x674e('0x48')]=function(_0x47f786,_0x19e956){return db[_0x674e('0x2a')][_0x674e('0x45')]({'where':{'id':_0x47f786[_0x674e('0x49')]['id']}})[_0x674e('0x24')](handleEntityNotFound(_0x19e956,null))[_0x674e('0x24')](removeEntity(_0x19e956,null))[_0x674e('0x43')](handleError(_0x19e956,null));}; \ No newline at end of file +var _0x056b=['send','SquareMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x056b,0xb6));var _0xb056=function(_0x1992cd,_0x57d364){_0x1992cd=_0x1992cd-0x0;var _0x33c636=_0x056b[_0x1992cd];return _0x33c636;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a14f,_0x10b9b3){return function(_0x5c39db){if(!_0x5c39db){_0x44a14f[_0xb056('0x1b')](0x194);}return _0x5c39db;};}function handleError(_0x265782,_0x2ae873){_0x2ae873=_0x2ae873||0x1f4;return function(_0x1d2c66){logger[_0xb056('0x28')](_0x1d2c66[_0xb056('0x29')]);if(_0x1d2c66[_0xb056('0x2a')]){delete _0x1d2c66[_0xb056('0x2a')];}_0x265782['status'](_0x2ae873)[_0xb056('0x2b')](_0x1d2c66);};}exports['index']=function(_0x3d83d3,_0x9c6f4a){var _0x294874={},_0x488185={},_0xd53267={'count':0x0,'rows':[]};var _0x264569=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x329eaa){return{'name':_0x329eaa[_0xb056('0x2e')],'type':_0x329eaa[_0xb056('0x2f')]['key']};});_0x488185[_0xb056('0x30')]=_[_0xb056('0x31')](_0x264569,_0xb056('0x2a'));_0x488185[_0xb056('0x32')]=_[_0xb056('0x33')](_0x3d83d3['query']);_0x488185[_0xb056('0x34')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],_0x488185[_0xb056('0x32')]);_0x294874[_0xb056('0x36')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],qs[_0xb056('0x37')](_0x3d83d3['query'][_0xb056('0x37')]));_0x294874['attributes']=_0x294874[_0xb056('0x36')]['length']?_0x294874['attributes']:_0x488185[_0xb056('0x30')];if(!_0x3d83d3[_0xb056('0x32')][_0xb056('0x38')](_0xb056('0x39'))){_0x294874[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x3d83d3[_0xb056('0x32')]['limit']);_0x294874[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x3d83d3['query']['offset']);}_0x294874[_0xb056('0x3a')]=qs[_0xb056('0x3b')](_0x3d83d3[_0xb056('0x32')]['sort']);_0x294874[_0xb056('0x3c')]=qs[_0xb056('0x34')](_[_0xb056('0x3d')](_0x3d83d3[_0xb056('0x32')],_0x488185[_0xb056('0x34')]),_0x264569);if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]){_0x294874[_0xb056('0x3c')]=_[_0xb056('0x3f')](_0x294874[_0xb056('0x3c')],{'$or':_[_0xb056('0x31')](_0x264569,function(_0x1afc7f){if(_0x1afc7f['type']!==_0xb056('0x40')){var _0x4acc94={};_0x4acc94[_0x1afc7f[_0xb056('0x2a')]]={'$like':'%'+_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]+'%'};return _0x4acc94;}})});}_0x294874=_[_0xb056('0x3f')]({},_0x294874,_0x3d83d3[_0xb056('0x41')]);var _0x661784={'where':_0x294874[_0xb056('0x3c')]};return db[_0xb056('0x2c')]['count'](_0x661784)[_0xb056('0x26')](function(_0x21a34b){_0xd53267[_0xb056('0x21')]=_0x21a34b;if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x42')]){_0x294874['include']=[{'all':!![]}];}return db[_0xb056('0x2c')][_0xb056('0x43')](_0x294874);})[_0xb056('0x26')](function(_0x216f72){_0xd53267[_0xb056('0x44')]=_0x216f72;return _0xd53267;})[_0xb056('0x26')](respondWithFilteredResult(_0x9c6f4a,_0x294874))['catch'](handleError(_0x9c6f4a,null));};exports[_0xb056('0x45')]=function(_0x5040f6,_0x3bcc3d){var _0xc729f3={'raw':!![],'where':{'id':_0x5040f6[_0xb056('0x46')]['id']}},_0x21d98e={};_0x21d98e[_0xb056('0x30')]=_[_0xb056('0x33')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0x21d98e[_0xb056('0x32')]=_[_0xb056('0x33')](_0x5040f6['query']);_0x21d98e[_0xb056('0x34')]=_[_0xb056('0x35')](_0x21d98e[_0xb056('0x30')],_0x21d98e['query']);_0xc729f3[_0xb056('0x36')]=_[_0xb056('0x35')](_0x21d98e['model'],qs['fields'](_0x5040f6[_0xb056('0x32')][_0xb056('0x37')]));_0xc729f3[_0xb056('0x36')]=_0xc729f3[_0xb056('0x36')]['length']?_0xc729f3['attributes']:_0x21d98e['model'];if(_0x5040f6['query']['includeAll']){_0xc729f3['include']=[{'all':!![]}];}_0xc729f3=_[_0xb056('0x3f')]({},_0xc729f3,_0x5040f6['options']);return db[_0xb056('0x2c')][_0xb056('0x47')](_0xc729f3)[_0xb056('0x26')](handleEntityNotFound(_0x3bcc3d,null))[_0xb056('0x26')](respondWithResult(_0x3bcc3d,null))[_0xb056('0x48')](handleError(_0x3bcc3d,null));};exports[_0xb056('0x49')]=function(_0x45b4aa,_0x1d3f86){return db['SquareMessage'][_0xb056('0x49')](_0x45b4aa[_0xb056('0x4a')],{})['then'](respondWithResult(_0x1d3f86,0xc9))[_0xb056('0x48')](handleError(_0x1d3f86,null));};exports[_0xb056('0x25')]=function(_0xe40439,_0x2f2d22){if(_0xe40439[_0xb056('0x4a')]['id']){delete _0xe40439[_0xb056('0x4a')]['id'];}return db['SquareMessage'][_0xb056('0x47')]({'where':{'id':_0xe40439['params']['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x2f2d22,null))[_0xb056('0x26')](saveUpdates(_0xe40439[_0xb056('0x4a')],null))[_0xb056('0x26')](respondWithResult(_0x2f2d22,null))[_0xb056('0x48')](handleError(_0x2f2d22,null));};exports[_0xb056('0x27')]=function(_0x2b6733,_0x25bb16){return db['SquareMessage'][_0xb056('0x47')]({'where':{'id':_0x2b6733[_0xb056('0x46')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x25bb16,null))[_0xb056('0x26')](removeEntity(_0x25bb16,null))[_0xb056('0x48')](handleError(_0x25bb16,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 56af4a6..e9d4ed4 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 _0x6c35=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash'];(function(_0x47153e,_0x5234fb){var _0xd69fb4=function(_0x3d05fa){while(--_0x3d05fa){_0x47153e['push'](_0x47153e['shift']());}};_0xd69fb4(++_0x5234fb);}(_0x6c35,0xcf));var _0x56c3=function(_0x30349a,_0x205e99){_0x30349a=_0x30349a-0x0;var _0x5b93fc=_0x6c35[_0x30349a];return _0x5b93fc;};'use strict';var _=require(_0x56c3('0x0'));var util=require(_0x56c3('0x1'));var logger=require(_0x56c3('0x2'))(_0x56c3('0x3'));var moment=require(_0x56c3('0x4'));var BPromise=require(_0x56c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56c3('0x6'));var rimraf=require(_0x56c3('0x7'));var config=require(_0x56c3('0x8'));var attributes=require(_0x56c3('0x9'));module[_0x56c3('0xa')]=function(_0x16f1cb,_0x4c5bca){return _0x16f1cb['define'](_0x56c3('0xb'),attributes,{'tableName':_0x56c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf780=['util','../../config/logger','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash'];(function(_0x2841c6,_0xdbe3bb){var _0x2e00a9=function(_0x48f1d7){while(--_0x48f1d7){_0x2841c6['push'](_0x2841c6['shift']());}};_0x2e00a9(++_0xdbe3bb);}(_0xf780,0x19d));var _0x0f78=function(_0x450d70,_0x47646e){_0x450d70=_0x450d70-0x0;var _0x4acdab=_0xf780[_0x450d70];return _0x4acdab;};'use strict';var _=require(_0x0f78('0x0'));var util=require(_0x0f78('0x1'));var logger=require(_0x0f78('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f78('0x3'));var config=require(_0x0f78('0x4'));var attributes=require('./squareMessage.attributes');module[_0x0f78('0x5')]=function(_0x46c544,_0x21d0d0){return _0x46c544[_0x0f78('0x6')](_0x0f78('0x7'),attributes,{'tableName':_0x0f78('0x8'),'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 667bf5e..78dec8f 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 _0x9e31=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch'];(function(_0x4f270d,_0x34fd38){var _0x3bf171=function(_0x355e1b){while(--_0x355e1b){_0x4f270d['push'](_0x4f270d['shift']());}};_0x3bf171(++_0x34fd38);}(_0x9e31,0xd9));var _0x19e3=function(_0xd86cb7,_0x56014d){_0xd86cb7=_0xd86cb7-0x0;var _0x40cb66=_0x9e31[_0xd86cb7];return _0x40cb66;};'use strict';var _=require(_0x19e3('0x0'));var util=require(_0x19e3('0x1'));var moment=require(_0x19e3('0x2'));var BPromise=require(_0x19e3('0x3'));var rs=require(_0x19e3('0x4'));var fs=require('fs');var Redis=require(_0x19e3('0x5'));var db=require(_0x19e3('0x6'))['db'];var utils=require(_0x19e3('0x7'));var logger=require(_0x19e3('0x8'))(_0x19e3('0x9'));var config=require(_0x19e3('0xa'));var jayson=require(_0x19e3('0xb'));var client=jayson['client'][_0x19e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x485615,_0x42f990,_0x43ae0d){return new BPromise(function(_0x21f187,_0x356e30){return client[_0x19e3('0xd')](_0x485615,_0x43ae0d)[_0x19e3('0xe')](function(_0x2be15b){logger[_0x19e3('0xf')](_0x19e3('0x10'),_0x42f990,_0x19e3('0x11'));logger[_0x19e3('0x12')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x42f990,_0x19e3('0x11'),JSON[_0x19e3('0x13')](_0x2be15b));if(_0x2be15b[_0x19e3('0x14')]){if(_0x2be15b[_0x19e3('0x14')][_0x19e3('0x15')]===0x1f4){logger[_0x19e3('0x14')](_0x19e3('0x10'),_0x42f990,_0x2be15b[_0x19e3('0x14')][_0x19e3('0x16')]);return _0x356e30(_0x2be15b[_0x19e3('0x14')][_0x19e3('0x16')]);}logger[_0x19e3('0x14')](_0x19e3('0x10'),_0x42f990,_0x2be15b[_0x19e3('0x14')][_0x19e3('0x16')]);return _0x21f187(_0x2be15b[_0x19e3('0x14')][_0x19e3('0x16')]);}else{logger[_0x19e3('0xf')](_0x19e3('0x10'),_0x42f990,_0x19e3('0x11'));_0x21f187(_0x2be15b[_0x19e3('0x17')]['message']);}})['catch'](function(_0xec4511){logger[_0x19e3('0x14')](_0x19e3('0x10'),_0x42f990,_0xec4511);_0x356e30(_0xec4511);});});}exports[_0x19e3('0x18')]=function(_0x1bdb2c){var _0x30100d=this;return new Promise(function(_0x4cfc28,_0x1569e5){return db[_0x19e3('0x19')][_0x19e3('0x1a')](_0x1bdb2c[_0x19e3('0x1b')],{'raw':_0x1bdb2c[_0x19e3('0x1c')]?_0x1bdb2c[_0x19e3('0x1c')][_0x19e3('0x1d')]===undefined?!![]:![]:!![]})[_0x19e3('0xe')](function(_0xde7d17){logger[_0x19e3('0xf')](_0x19e3('0x18'),_0x1bdb2c);logger[_0x19e3('0x12')](_0x19e3('0x18'),_0x1bdb2c,JSON['stringify'](_0xde7d17));_0x4cfc28(_0xde7d17);})[_0x19e3('0x1e')](function(_0x44a83d){logger[_0x19e3('0x14')](_0x19e3('0x18'),_0x44a83d[_0x19e3('0x16')],_0x1bdb2c);_0x1569e5(_0x30100d[_0x19e3('0x14')](0x1f4,_0x44a83d[_0x19e3('0x16')]));});});}; \ No newline at end of file +var _0x88a1=['result','CreateSquareMessage','SquareMessage','body','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x1eb2e4,_0x5acde7){var _0xc49e23=function(_0x404ae5){while(--_0x404ae5){_0x1eb2e4['push'](_0x1eb2e4['shift']());}};_0xc49e23(++_0x5acde7);}(_0x88a1,0x18b));var _0x188a=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x88a1[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0x188a('0x0'));var util=require(_0x188a('0x1'));var moment=require(_0x188a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x188a('0x3'));var db=require(_0x188a('0x4'))['db'];var utils=require(_0x188a('0x5'));var logger=require('../../config/logger')(_0x188a('0x6'));var config=require(_0x188a('0x7'));var jayson=require(_0x188a('0x8'));var client=jayson[_0x188a('0x9')][_0x188a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277189,_0x332868,_0x4a814c){return new BPromise(function(_0x13e16f,_0xd852a6){return client[_0x188a('0xb')](_0x277189,_0x4a814c)[_0x188a('0xc')](function(_0x59793d){logger[_0x188a('0xd')](_0x188a('0xe'),_0x332868,'request\x20sent');logger[_0x188a('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x332868,'request\x20sent',JSON[_0x188a('0x10')](_0x59793d));if(_0x59793d[_0x188a('0x11')]){if(_0x59793d[_0x188a('0x11')][_0x188a('0x12')]===0x1f4){logger[_0x188a('0x11')](_0x188a('0xe'),_0x332868,_0x59793d[_0x188a('0x11')][_0x188a('0x13')]);return _0xd852a6(_0x59793d['error'][_0x188a('0x13')]);}logger[_0x188a('0x11')](_0x188a('0xe'),_0x332868,_0x59793d['error'][_0x188a('0x13')]);return _0x13e16f(_0x59793d['error'][_0x188a('0x13')]);}else{logger[_0x188a('0xd')](_0x188a('0xe'),_0x332868,_0x188a('0x14'));_0x13e16f(_0x59793d[_0x188a('0x15')]['message']);}})['catch'](function(_0x24d420){logger[_0x188a('0x11')]('SquareMessage,\x20%s,\x20%s',_0x332868,_0x24d420);_0xd852a6(_0x24d420);});});}exports[_0x188a('0x16')]=function(_0x2cf9ba){var _0x5225c8=this;return new Promise(function(_0x1f2706,_0x4d9231){return db[_0x188a('0x17')]['create'](_0x2cf9ba[_0x188a('0x18')],{'raw':_0x2cf9ba['options']?_0x2cf9ba[_0x188a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x188a('0xc')](function(_0x2f4a6d){logger[_0x188a('0xd')](_0x188a('0x16'),_0x2cf9ba);logger[_0x188a('0xf')](_0x188a('0x16'),_0x2cf9ba,JSON['stringify'](_0x2f4a6d));_0x1f2706(_0x2f4a6d);})['catch'](function(_0xd8f7d2){logger[_0x188a('0x11')](_0x188a('0x16'),_0xd8f7d2[_0x188a('0x13')],_0x2cf9ba);_0x4d9231(_0x5225c8[_0x188a('0x11')](0x1f4,_0xd8f7d2[_0x188a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 702d8cf..a84b1d3 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 _0x3268=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','show','/:id/test','isAuthenticated','test','create','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x29f4ad,_0xdc2925){var _0x346709=function(_0x8a0af8){while(--_0x8a0af8){_0x29f4ad['push'](_0x29f4ad['shift']());}};_0x346709(++_0xdc2925);}(_0x3268,0x1b4));var _0x8326=function(_0x28e86d,_0x3f4840){_0x28e86d=_0x28e86d-0x0;var _0xe7ff23=_0x3268[_0x28e86d];return _0xe7ff23;};'use strict';var multer=require(_0x8326('0x0'));var util=require(_0x8326('0x1'));var path=require(_0x8326('0x2'));var timeout=require(_0x8326('0x3'));var express=require(_0x8326('0x4'));var router=express[_0x8326('0x5')]();var fs_extra=require(_0x8326('0x6'));var auth=require(_0x8326('0x7'));var interaction=require(_0x8326('0x8'));var config=require(_0x8326('0x9'));var controller=require(_0x8326('0xa'));router[_0x8326('0xb')]('/',auth['isAuthenticated'](),controller[_0x8326('0xc')]);router[_0x8326('0xb')](_0x8326('0xd'),auth['isAuthenticated'](),controller[_0x8326('0xe')]);router[_0x8326('0xb')](_0x8326('0xf'),auth[_0x8326('0x10')](),timeout('15s'),controller[_0x8326('0x11')]);router['post']('/',auth[_0x8326('0x10')](),controller[_0x8326('0x12')]);router['put'](_0x8326('0xd'),auth[_0x8326('0x10')](),controller['update']);router[_0x8326('0x13')](_0x8326('0xd'),auth[_0x8326('0x10')](),controller['destroy']);module[_0x8326('0x14')]=router; \ No newline at end of file +var _0x3d83=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','test','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d83,0x87));var _0x33d8=function(_0x464122,_0x255c34){_0x464122=_0x464122-0x0;var _0x148acf=_0x3d83[_0x464122];return _0x148acf;};'use strict';var multer=require(_0x33d8('0x0'));var util=require(_0x33d8('0x1'));var path=require(_0x33d8('0x2'));var timeout=require('connect-timeout');var express=require(_0x33d8('0x3'));var router=express[_0x33d8('0x4')]();var fs_extra=require(_0x33d8('0x5'));var auth=require(_0x33d8('0x6'));var interaction=require(_0x33d8('0x7'));var config=require(_0x33d8('0x8'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x33d8('0x9')](),controller[_0x33d8('0xa')]);router[_0x33d8('0xb')](_0x33d8('0xc'),auth[_0x33d8('0x9')](),controller[_0x33d8('0xd')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0x33d8('0xe')]);router[_0x33d8('0xf')]('/',auth[_0x33d8('0x9')](),controller[_0x33d8('0x10')]);router['put']('/:id',auth[_0x33d8('0x9')](),controller[_0x33d8('0x11')]);router['delete'](_0x33d8('0xc'),auth[_0x33d8('0x9')](),controller['destroy']);module[_0x33d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 566af2d..35d367e 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 _0xa2bd=['name','sequelize','STRING'];(function(_0x11261f,_0x2039d8){var _0x13d878=function(_0x58d08f){while(--_0x58d08f){_0x11261f['push'](_0x11261f['shift']());}};_0x13d878(++_0x2039d8);}(_0xa2bd,0xa9));var _0xda2b=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xa2bd[_0x4a7e98];return _0x27d10d;};'use strict';var Sequelize=require(_0xda2b('0x0'));module['exports']={'name':{'type':Sequelize[_0xda2b('0x1')],'unique':_0xda2b('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xda2b('0x1')]},'description':{'type':Sequelize[_0xda2b('0x1')]}}; \ No newline at end of file +var _0xe5a3=['STRING','sequelize','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe5a3,0xfd));var _0x3e5a=function(_0x2ab84c,_0x30ac94){_0x2ab84c=_0x2ab84c-0x0;var _0x2e85b0=_0xe5a3[_0x2ab84c];return _0x2e85b0;};'use strict';var Sequelize=require(_0x3e5a('0x0'));module[_0x3e5a('0x1')]={'name':{'type':Sequelize[_0x3e5a('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x3e5a('0x2')]},'description':{'type':Sequelize[_0x3e5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0b1b033..2d9a67d 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 _0xc940=['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','sendStatus','json','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','end','stack','name','send','SquareOdbc','rawAttributes','type','model','map','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','intersection','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc940,0x1ab));var _0x0c94=function(_0x25e94c,_0x5390be){_0x25e94c=_0x25e94c-0x0;var _0xccb68=_0xc940[_0x25e94c];return _0xccb68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c94('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c94('0x1'));var rp=require(_0x0c94('0x2'));var moment=require(_0x0c94('0x3'));var BPromise=require(_0x0c94('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0c94('0x5'));var sox=require('sox');var csv=require(_0x0c94('0x6'));var ejs=require(_0x0c94('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c94('0x8'));var squel=require(_0x0c94('0x9'));var crypto=require(_0x0c94('0xa'));var jsforce=require(_0x0c94('0xb'));var deskjs=require(_0x0c94('0xc'));var toCsv=require(_0x0c94('0x6'));var querystring=require(_0x0c94('0xd'));var Papa=require(_0x0c94('0xe'));var Redis=require(_0x0c94('0xf'));var authService=require(_0x0c94('0x10'));var qs=require(_0x0c94('0x11'));var as=require(_0x0c94('0x12'));var hardwareService=require(_0x0c94('0x13'));var logger=require(_0x0c94('0x14'))(_0x0c94('0x15'));var utils=require(_0x0c94('0x16'));var config=require(_0x0c94('0x17'));var licenseUtil=require(_0x0c94('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eda8f,_0x125bac){_0x125bac=_0x125bac||0xcc;return function(_0xa5291){if(_0xa5291){return _0x4eda8f[_0x0c94('0x19')](_0x125bac);}return _0x4eda8f['status'](_0x125bac)['end']();};}function respondWithResult(_0x76754,_0x39dbc2){_0x39dbc2=_0x39dbc2||0xc8;return function(_0x14d754){if(_0x14d754){return _0x76754['status'](_0x39dbc2)[_0x0c94('0x1a')](_0x14d754);}};}function respondWithFilteredResult(_0x3da91d,_0x3ae8c8){return function(_0x18ee1a){if(_0x18ee1a){var _0x177b53=typeof _0x3ae8c8['offset']==='undefined'&&typeof _0x3ae8c8[_0x0c94('0x1b')]==='undefined';var _0x1c34b6=_0x18ee1a[_0x0c94('0x1c')];var _0x3a236f=_0x177b53?0x0:_0x3ae8c8[_0x0c94('0x1d')];var _0x380f08=_0x177b53?_0x18ee1a['count']:_0x3ae8c8[_0x0c94('0x1d')]+_0x3ae8c8[_0x0c94('0x1b')];var _0x572af8;if(_0x380f08>=_0x1c34b6){_0x380f08=_0x1c34b6;_0x572af8=0xc8;}else{_0x572af8=0xce;}_0x3da91d[_0x0c94('0x1e')](_0x572af8);return _0x3da91d[_0x0c94('0x1f')](_0x0c94('0x20'),_0x3a236f+'-'+_0x380f08+'/'+_0x1c34b6)[_0x0c94('0x1a')](_0x18ee1a);}return null;};}function patchUpdates(_0x1e9360){return function(_0x48c3e6){try{jsonpatch[_0x0c94('0x21')](_0x48c3e6,_0x1e9360,!![]);}catch(_0x6a5b73){return BPromise[_0x0c94('0x22')](_0x6a5b73);}return _0x48c3e6[_0x0c94('0x23')]();};}function saveUpdates(_0x40921d,_0x592e9b){return function(_0x2a022c){if(_0x2a022c){return _0x2a022c[_0x0c94('0x24')](_0x40921d)['then'](function(_0x57242c){return _0x57242c;});}return null;};}function removeEntity(_0x4fcfc7,_0x364b63){return function(_0x103f5c){if(_0x103f5c){return _0x103f5c[_0x0c94('0x25')]()[_0x0c94('0x26')](function(){var _0x379101=_0x103f5c[_0x0c94('0x27')]({'plain':!![]});var _0x20c5e3=_0x0c94('0x28');return db[_0x0c94('0x29')][_0x0c94('0x25')]({'where':{'type':_0x20c5e3,'resourceId':_0x379101['id']}})[_0x0c94('0x26')](function(){return _0x103f5c;});})[_0x0c94('0x26')](function(){_0x4fcfc7[_0x0c94('0x1e')](0xcc)[_0x0c94('0x2a')]();});}};}function handleEntityNotFound(_0x5e0d63,_0x3c004c){return function(_0x1a2478){if(!_0x1a2478){_0x5e0d63['sendStatus'](0x194);}return _0x1a2478;};}function handleError(_0x200c9c,_0x1e58df){_0x1e58df=_0x1e58df||0x1f4;return function(_0x339c5a){logger['error'](_0x339c5a[_0x0c94('0x2b')]);if(_0x339c5a['name']){delete _0x339c5a[_0x0c94('0x2c')];}_0x200c9c[_0x0c94('0x1e')](_0x1e58df)[_0x0c94('0x2d')](_0x339c5a);};}exports['index']=function(_0x24531e,_0x2b7bd1){var _0x4cdcd1={},_0x2fcf3b={},_0x20ffec={'count':0x0,'rows':[]};var _0x37abd1=_['map'](db[_0x0c94('0x2e')][_0x0c94('0x2f')],function(_0x15a798){return{'name':_0x15a798['fieldName'],'type':_0x15a798[_0x0c94('0x30')]['key']};});_0x2fcf3b[_0x0c94('0x31')]=_[_0x0c94('0x32')](_0x37abd1,'name');_0x2fcf3b['query']=_['keys'](_0x24531e[_0x0c94('0x33')]);_0x2fcf3b['filters']=_['intersection'](_0x2fcf3b['model'],_0x2fcf3b[_0x0c94('0x33')]);_0x4cdcd1[_0x0c94('0x34')]=_['intersection'](_0x2fcf3b[_0x0c94('0x31')],qs['fields'](_0x24531e[_0x0c94('0x33')][_0x0c94('0x35')]));_0x4cdcd1['attributes']=_0x4cdcd1[_0x0c94('0x34')]['length']?_0x4cdcd1['attributes']:_0x2fcf3b[_0x0c94('0x31')];if(!_0x24531e[_0x0c94('0x33')][_0x0c94('0x36')](_0x0c94('0x37'))){_0x4cdcd1[_0x0c94('0x1b')]=qs[_0x0c94('0x1b')](_0x24531e[_0x0c94('0x33')][_0x0c94('0x1b')]);_0x4cdcd1['offset']=qs['offset'](_0x24531e['query'][_0x0c94('0x1d')]);}_0x4cdcd1[_0x0c94('0x38')]=qs[_0x0c94('0x39')](_0x24531e['query'][_0x0c94('0x39')]);_0x4cdcd1[_0x0c94('0x3a')]=qs[_0x0c94('0x3b')](_['pick'](_0x24531e[_0x0c94('0x33')],_0x2fcf3b['filters']),_0x37abd1);if(_0x24531e[_0x0c94('0x33')]['filter']){_0x4cdcd1['where']=_[_0x0c94('0x3c')](_0x4cdcd1[_0x0c94('0x3a')],{'$or':_[_0x0c94('0x32')](_0x37abd1,function(_0x18ec8c){if(_0x18ec8c[_0x0c94('0x30')]!==_0x0c94('0x3d')){var _0x3ad44={};_0x3ad44[_0x18ec8c['name']]={'$like':'%'+_0x24531e[_0x0c94('0x33')][_0x0c94('0x3e')]+'%'};return _0x3ad44;}})});}_0x4cdcd1=_[_0x0c94('0x3c')]({},_0x4cdcd1,_0x24531e[_0x0c94('0x3f')]);var _0x258b03={'where':_0x4cdcd1[_0x0c94('0x3a')]};return db[_0x0c94('0x2e')][_0x0c94('0x1c')](_0x258b03)['then'](function(_0x55e2b8){_0x20ffec[_0x0c94('0x1c')]=_0x55e2b8;if(_0x24531e['query'][_0x0c94('0x40')]){_0x4cdcd1[_0x0c94('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x0c94('0x42')](_0x4cdcd1);})['then'](function(_0x1b558b){_0x20ffec['rows']=_0x1b558b;return _0x20ffec;})[_0x0c94('0x26')](respondWithFilteredResult(_0x2b7bd1,_0x4cdcd1))['catch'](handleError(_0x2b7bd1,null));};exports[_0x0c94('0x43')]=function(_0x59e512,_0x638c7c){var _0x26cdf3={'raw':!![],'where':{'id':_0x59e512[_0x0c94('0x44')]['id']}},_0x445f97={};_0x445f97[_0x0c94('0x31')]=_['keys'](db[_0x0c94('0x2e')][_0x0c94('0x2f')]);_0x445f97[_0x0c94('0x33')]=_[_0x0c94('0x45')](_0x59e512[_0x0c94('0x33')]);_0x445f97['filters']=_[_0x0c94('0x46')](_0x445f97[_0x0c94('0x31')],_0x445f97['query']);_0x26cdf3[_0x0c94('0x34')]=_[_0x0c94('0x46')](_0x445f97[_0x0c94('0x31')],qs[_0x0c94('0x35')](_0x59e512['query'][_0x0c94('0x35')]));_0x26cdf3[_0x0c94('0x34')]=_0x26cdf3[_0x0c94('0x34')][_0x0c94('0x47')]?_0x26cdf3['attributes']:_0x445f97[_0x0c94('0x31')];if(_0x59e512[_0x0c94('0x33')][_0x0c94('0x40')]){_0x26cdf3[_0x0c94('0x41')]=[{'all':!![]}];}_0x26cdf3=_[_0x0c94('0x3c')]({},_0x26cdf3,_0x59e512[_0x0c94('0x3f')]);return db['SquareOdbc'][_0x0c94('0x48')](_0x26cdf3)['then'](handleEntityNotFound(_0x638c7c,null))['then'](respondWithResult(_0x638c7c,null))[_0x0c94('0x49')](handleError(_0x638c7c,null));};exports[_0x0c94('0x4a')]=function(_0x746ef8,_0x221c03){return db[_0x0c94('0x2e')][_0x0c94('0x4a')](_0x746ef8['body'],{})[_0x0c94('0x26')](function(_0x2c4243){var _0x114187=_0x746ef8['user'][_0x0c94('0x27')]({'plain':!![]});if(!_0x114187)throw new Error(_0x0c94('0x4b'));if(_0x114187['role']===_0x0c94('0x4c')){var _0x1e183e=_0x2c4243['get']({'plain':!![]});var _0xec078d=_0x0c94('0x28');return db[_0x0c94('0x4d')]['find']({'where':{'name':_0xec078d,'userProfileId':_0x114187[_0x0c94('0x4e')]},'raw':!![]})['then'](function(_0x2cf264){if(_0x2cf264&&_0x2cf264['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1e183e[_0x0c94('0x2c')],'resourceId':_0x1e183e['id'],'type':_0x2cf264[_0x0c94('0x2c')],'sectionId':_0x2cf264['id']},{})[_0x0c94('0x26')](function(){return _0x2c4243;});}else{return _0x2c4243;}})[_0x0c94('0x49')](function(_0x2e1249){logger[_0x0c94('0x4f')](_0x0c94('0x50'),_0x2e1249);throw _0x2e1249;});}return _0x2c4243;})[_0x0c94('0x26')](respondWithResult(_0x221c03,0xc9))[_0x0c94('0x49')](handleError(_0x221c03,null));};exports[_0x0c94('0x24')]=function(_0x214d05,_0x2d2595){if(_0x214d05[_0x0c94('0x51')]['id']){delete _0x214d05[_0x0c94('0x51')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x214d05[_0x0c94('0x44')]['id']}})[_0x0c94('0x26')](handleEntityNotFound(_0x2d2595,null))['then'](saveUpdates(_0x214d05[_0x0c94('0x51')],null))[_0x0c94('0x26')](respondWithResult(_0x2d2595,null))[_0x0c94('0x49')](handleError(_0x2d2595,null));};exports[_0x0c94('0x25')]=function(_0x10b4df,_0x359f64){return db[_0x0c94('0x2e')][_0x0c94('0x48')]({'where':{'id':_0x10b4df[_0x0c94('0x44')]['id']}})[_0x0c94('0x26')](handleEntityNotFound(_0x359f64,null))[_0x0c94('0x26')](removeEntity(_0x359f64,null))[_0x0c94('0x49')](handleError(_0x359f64,null));};exports[_0x0c94('0x52')]=function(_0x26b16f,_0x3aceac,_0x2706e1){var _0x22e4e8;return db['SquareOdbc'][_0x0c94('0x48')]({'where':{'id':_0x26b16f[_0x0c94('0x44')]['id']},'attributes':['id',_0x0c94('0x53')]})[_0x0c94('0x26')](handleEntityNotFound(_0x3aceac,null))[_0x0c94('0x26')](function(_0x5d59eb){if(_0x5d59eb){var _0x22fbc8=require(_0x0c94('0x54'))();_0x22fbc8[_0x0c94('0x55')](_0x5d59eb[_0x0c94('0x53')]);_0x22fbc8[_0x0c94('0x56')]();return _0x5d59eb;}})[_0x0c94('0x26')](respondWithResult(_0x3aceac,null))[_0x0c94('0x49')](handleError(_0x3aceac,null));}; \ No newline at end of file +var _0xf483=['rimraf','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','openSync','eml-format'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xf483,0xa9));var _0x3f48=function(_0x4f6efd,_0x587db0){_0x4f6efd=_0x4f6efd-0x0;var _0x5ddd3d=_0xf483[_0x4f6efd];return _0x5ddd3d;};'use strict';var emlformat=require(_0x3f48('0x0'));var rimraf=require(_0x3f48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f48('0x2'));var moment=require(_0x3f48('0x3'));var BPromise=require(_0x3f48('0x4'));var Mustache=require(_0x3f48('0x5'));var util=require('util');var path=require(_0x3f48('0x6'));var sox=require(_0x3f48('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f48('0x8'));var _=require('lodash');var squel=require(_0x3f48('0x9'));var crypto=require(_0x3f48('0xa'));var jsforce=require(_0x3f48('0xb'));var deskjs=require(_0x3f48('0xc'));var toCsv=require(_0x3f48('0xd'));var querystring=require(_0x3f48('0xe'));var Papa=require(_0x3f48('0xf'));var Redis=require(_0x3f48('0x10'));var authService=require(_0x3f48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3f48('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f48('0x13'))(_0x3f48('0x14'));var utils=require(_0x3f48('0x15'));var config=require(_0x3f48('0x16'));var licenseUtil=require(_0x3f48('0x17'));var db=require(_0x3f48('0x18'))['db'];function respondWithStatusCode(_0x341118,_0x370bdc){_0x370bdc=_0x370bdc||0xcc;return function(_0x493a3e){if(_0x493a3e){return _0x341118[_0x3f48('0x19')](_0x370bdc);}return _0x341118['status'](_0x370bdc)[_0x3f48('0x1a')]();};}function respondWithResult(_0x4885e1,_0x12241b){_0x12241b=_0x12241b||0xc8;return function(_0x29faab){if(_0x29faab){return _0x4885e1[_0x3f48('0x1b')](_0x12241b)[_0x3f48('0x1c')](_0x29faab);}};}function respondWithFilteredResult(_0x2c5f91,_0xd44574){return function(_0x278a0e){if(_0x278a0e){var _0x53dec0=typeof _0xd44574['offset']==='undefined'&&typeof _0xd44574[_0x3f48('0x1d')]===_0x3f48('0x1e');var _0x4146cf=_0x278a0e[_0x3f48('0x1f')];var _0x57ec13=_0x53dec0?0x0:_0xd44574[_0x3f48('0x20')];var _0x4c8072=_0x53dec0?_0x278a0e[_0x3f48('0x1f')]:_0xd44574['offset']+_0xd44574[_0x3f48('0x1d')];var _0x69b41a;if(_0x4c8072>=_0x4146cf){_0x4c8072=_0x4146cf;_0x69b41a=0xc8;}else{_0x69b41a=0xce;}_0x2c5f91['status'](_0x69b41a);return _0x2c5f91[_0x3f48('0x21')](_0x3f48('0x22'),_0x57ec13+'-'+_0x4c8072+'/'+_0x4146cf)['json'](_0x278a0e);}return null;};}function patchUpdates(_0x516024){return function(_0x270313){try{jsonpatch[_0x3f48('0x23')](_0x270313,_0x516024,!![]);}catch(_0x1da377){return BPromise['reject'](_0x1da377);}return _0x270313[_0x3f48('0x24')]();};}function saveUpdates(_0x1b5b82,_0x38d607){return function(_0x92a88c){if(_0x92a88c){return _0x92a88c[_0x3f48('0x25')](_0x1b5b82)[_0x3f48('0x26')](function(_0x227fe4){return _0x227fe4;});}return null;};}function removeEntity(_0x57a2ac,_0x4eedf4){return function(_0x581ba1){if(_0x581ba1){return _0x581ba1[_0x3f48('0x27')]()[_0x3f48('0x26')](function(){var _0x695cef=_0x581ba1[_0x3f48('0x28')]({'plain':!![]});var _0x5cd6e2=_0x3f48('0x29');return db[_0x3f48('0x2a')]['destroy']({'where':{'type':_0x5cd6e2,'resourceId':_0x695cef['id']}})['then'](function(){return _0x581ba1;});})[_0x3f48('0x26')](function(){_0x57a2ac[_0x3f48('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350b49,_0x2671f4){return function(_0x56f16e){if(!_0x56f16e){_0x350b49['sendStatus'](0x194);}return _0x56f16e;};}function handleError(_0x5751f1,_0x2dd5f9){_0x2dd5f9=_0x2dd5f9||0x1f4;return function(_0x149f5b){logger[_0x3f48('0x2b')](_0x149f5b['stack']);if(_0x149f5b[_0x3f48('0x2c')]){delete _0x149f5b[_0x3f48('0x2c')];}_0x5751f1[_0x3f48('0x1b')](_0x2dd5f9)[_0x3f48('0x2d')](_0x149f5b);};}exports[_0x3f48('0x2e')]=function(_0xb244fa,_0x15ba29){var _0x4868d9={},_0x41cb23={},_0x59d202={'count':0x0,'rows':[]};var _0x45771b=_[_0x3f48('0x2f')](db[_0x3f48('0x30')][_0x3f48('0x31')],function(_0x350f92){return{'name':_0x350f92['fieldName'],'type':_0x350f92['type'][_0x3f48('0x32')]};});_0x41cb23['model']=_[_0x3f48('0x2f')](_0x45771b,_0x3f48('0x2c'));_0x41cb23[_0x3f48('0x33')]=_[_0x3f48('0x34')](_0xb244fa[_0x3f48('0x33')]);_0x41cb23[_0x3f48('0x35')]=_[_0x3f48('0x36')](_0x41cb23['model'],_0x41cb23[_0x3f48('0x33')]);_0x4868d9['attributes']=_[_0x3f48('0x36')](_0x41cb23[_0x3f48('0x37')],qs[_0x3f48('0x38')](_0xb244fa['query'][_0x3f48('0x38')]));_0x4868d9[_0x3f48('0x39')]=_0x4868d9['attributes'][_0x3f48('0x3a')]?_0x4868d9[_0x3f48('0x39')]:_0x41cb23['model'];if(!_0xb244fa['query'][_0x3f48('0x3b')](_0x3f48('0x3c'))){_0x4868d9[_0x3f48('0x1d')]=qs[_0x3f48('0x1d')](_0xb244fa[_0x3f48('0x33')][_0x3f48('0x1d')]);_0x4868d9[_0x3f48('0x20')]=qs[_0x3f48('0x20')](_0xb244fa['query'][_0x3f48('0x20')]);}_0x4868d9['order']=qs[_0x3f48('0x3d')](_0xb244fa[_0x3f48('0x33')]['sort']);_0x4868d9[_0x3f48('0x3e')]=qs['filters'](_[_0x3f48('0x3f')](_0xb244fa[_0x3f48('0x33')],_0x41cb23[_0x3f48('0x35')]),_0x45771b);if(_0xb244fa['query']['filter']){_0x4868d9[_0x3f48('0x3e')]=_[_0x3f48('0x40')](_0x4868d9[_0x3f48('0x3e')],{'$or':_[_0x3f48('0x2f')](_0x45771b,function(_0x4b3726){if(_0x4b3726[_0x3f48('0x41')]!==_0x3f48('0x42')){var _0x5c5e90={};_0x5c5e90[_0x4b3726['name']]={'$like':'%'+_0xb244fa['query'][_0x3f48('0x43')]+'%'};return _0x5c5e90;}})});}_0x4868d9=_['merge']({},_0x4868d9,_0xb244fa[_0x3f48('0x44')]);var _0x1511b9={'where':_0x4868d9[_0x3f48('0x3e')]};return db[_0x3f48('0x30')][_0x3f48('0x1f')](_0x1511b9)[_0x3f48('0x26')](function(_0x51e595){_0x59d202['count']=_0x51e595;if(_0xb244fa['query']['includeAll']){_0x4868d9[_0x3f48('0x45')]=[{'all':!![]}];}return db[_0x3f48('0x30')][_0x3f48('0x46')](_0x4868d9);})['then'](function(_0x51549a){_0x59d202[_0x3f48('0x47')]=_0x51549a;return _0x59d202;})[_0x3f48('0x26')](respondWithFilteredResult(_0x15ba29,_0x4868d9))['catch'](handleError(_0x15ba29,null));};exports['show']=function(_0xf22627,_0x256d25){var _0x22e459={'raw':!![],'where':{'id':_0xf22627['params']['id']}},_0x5f478e={};_0x5f478e[_0x3f48('0x37')]=_[_0x3f48('0x34')](db['SquareOdbc'][_0x3f48('0x31')]);_0x5f478e[_0x3f48('0x33')]=_[_0x3f48('0x34')](_0xf22627[_0x3f48('0x33')]);_0x5f478e['filters']=_['intersection'](_0x5f478e[_0x3f48('0x37')],_0x5f478e['query']);_0x22e459['attributes']=_[_0x3f48('0x36')](_0x5f478e[_0x3f48('0x37')],qs[_0x3f48('0x38')](_0xf22627['query']['fields']));_0x22e459[_0x3f48('0x39')]=_0x22e459['attributes'][_0x3f48('0x3a')]?_0x22e459[_0x3f48('0x39')]:_0x5f478e[_0x3f48('0x37')];if(_0xf22627[_0x3f48('0x33')][_0x3f48('0x48')]){_0x22e459['include']=[{'all':!![]}];}_0x22e459=_['merge']({},_0x22e459,_0xf22627[_0x3f48('0x44')]);return db[_0x3f48('0x30')][_0x3f48('0x49')](_0x22e459)[_0x3f48('0x26')](handleEntityNotFound(_0x256d25,null))[_0x3f48('0x26')](respondWithResult(_0x256d25,null))[_0x3f48('0x4a')](handleError(_0x256d25,null));};exports[_0x3f48('0x4b')]=function(_0x460edd,_0x3a997a){return db[_0x3f48('0x30')][_0x3f48('0x4b')](_0x460edd['body'],{})[_0x3f48('0x26')](function(_0x463ee1){var _0x397076=_0x460edd['user'][_0x3f48('0x28')]({'plain':!![]});if(!_0x397076)throw new Error(_0x3f48('0x4c'));if(_0x397076['role']===_0x3f48('0x4d')){var _0x265120=_0x463ee1[_0x3f48('0x28')]({'plain':!![]});var _0x585674=_0x3f48('0x29');return db['UserProfileSection'][_0x3f48('0x49')]({'where':{'name':_0x585674,'userProfileId':_0x397076[_0x3f48('0x4e')]},'raw':!![]})['then'](function(_0x455d60){if(_0x455d60&&_0x455d60['autoAssociation']===0x0){return db[_0x3f48('0x2a')][_0x3f48('0x4b')]({'name':_0x265120[_0x3f48('0x2c')],'resourceId':_0x265120['id'],'type':_0x455d60[_0x3f48('0x2c')],'sectionId':_0x455d60['id']},{})[_0x3f48('0x26')](function(){return _0x463ee1;});}else{return _0x463ee1;}})[_0x3f48('0x4a')](function(_0x310766){logger['error'](_0x3f48('0x4f'),_0x310766);throw _0x310766;});}return _0x463ee1;})[_0x3f48('0x26')](respondWithResult(_0x3a997a,0xc9))[_0x3f48('0x4a')](handleError(_0x3a997a,null));};exports[_0x3f48('0x25')]=function(_0xf0504e,_0x5afead){if(_0xf0504e['body']['id']){delete _0xf0504e[_0x3f48('0x50')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0xf0504e['params']['id']}})[_0x3f48('0x26')](handleEntityNotFound(_0x5afead,null))[_0x3f48('0x26')](saveUpdates(_0xf0504e[_0x3f48('0x50')],null))[_0x3f48('0x26')](respondWithResult(_0x5afead,null))[_0x3f48('0x4a')](handleError(_0x5afead,null));};exports[_0x3f48('0x27')]=function(_0x4eacab,_0x3b7c60){return db[_0x3f48('0x30')]['find']({'where':{'id':_0x4eacab[_0x3f48('0x51')]['id']}})[_0x3f48('0x26')](handleEntityNotFound(_0x3b7c60,null))[_0x3f48('0x26')](removeEntity(_0x3b7c60,null))['catch'](handleError(_0x3b7c60,null));};exports[_0x3f48('0x52')]=function(_0x519449,_0x443ce4,_0x12f968){var _0x3995a7;return db[_0x3f48('0x30')][_0x3f48('0x49')]({'where':{'id':_0x519449[_0x3f48('0x51')]['id']},'attributes':['id',_0x3f48('0x53')]})[_0x3f48('0x26')](handleEntityNotFound(_0x443ce4,null))[_0x3f48('0x26')](function(_0x76d40a){if(_0x76d40a){var _0x2390ff=require('odbc')();_0x2390ff[_0x3f48('0x54')](_0x76d40a[_0x3f48('0x53')]);_0x2390ff['closeSync']();return _0x76d40a;}})['then'](respondWithResult(_0x443ce4,null))[_0x3f48('0x4a')](handleError(_0x443ce4,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c7488a4..0ef9f7f 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 _0x555e=['SquareOdbc','square_odbc','lodash','util','api','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x47b18e,_0x2c84af){var _0x5df4e2=function(_0x391d27){while(--_0x391d27){_0x47b18e['push'](_0x47b18e['shift']());}};_0x5df4e2(++_0x2c84af);}(_0x555e,0x1f1));var _0xe555=function(_0x5b5060,_0x5839a1){_0x5b5060=_0x5b5060-0x0;var _0x1f6062=_0x555e[_0x5b5060];return _0x1f6062;};'use strict';var _=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var logger=require('../../config/logger')(_0xe555('0x2'));var moment=require('moment');var BPromise=require(_0xe555('0x3'));var rp=require(_0xe555('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe555('0x5'));var attributes=require(_0xe555('0x6'));module[_0xe555('0x7')]=function(_0x173727,_0x45f9f9){return _0x173727[_0xe555('0x8')](_0xe555('0x9'),attributes,{'tableName':_0xe555('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec9a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SquareOdbc','square_odbc','util'];(function(_0x3a7d94,_0x570851){var _0x26b2cb=function(_0x324a86){while(--_0x324a86){_0x3a7d94['push'](_0x3a7d94['shift']());}};_0x26b2cb(++_0x570851);}(_0xec9a,0xef));var _0xaec9=function(_0x5584d8,_0x30707e){_0x5584d8=_0x5584d8-0x0;var _0xee9357=_0xec9a[_0x5584d8];return _0xee9357;};'use strict';var _=require('lodash');var util=require(_0xaec9('0x0'));var logger=require(_0xaec9('0x1'))('api');var moment=require(_0xaec9('0x2'));var BPromise=require(_0xaec9('0x3'));var rp=require(_0xaec9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaec9('0x5'));var config=require(_0xaec9('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xaec9('0x7')]=function(_0x5241f4,_0x2d1b5a){return _0x5241f4['define'](_0xaec9('0x8'),attributes,{'tableName':_0xaec9('0x9'),'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 d7b1434..33f4427 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 _0xdbe7=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash'];(function(_0x40141d,_0x57c961){var _0x24cae9=function(_0x3e3e16){while(--_0x3e3e16){_0x40141d['push'](_0x40141d['shift']());}};_0x24cae9(++_0x57c961);}(_0xdbe7,0x11f));var _0x7dbe=function(_0x12ef83,_0x54eab7){_0x12ef83=_0x12ef83-0x0;var _0x279f0e=_0xdbe7[_0x12ef83];return _0x279f0e;};'use strict';var _=require(_0x7dbe('0x0'));var util=require('util');var moment=require(_0x7dbe('0x1'));var BPromise=require(_0x7dbe('0x2'));var rs=require(_0x7dbe('0x3'));var fs=require('fs');var Redis=require(_0x7dbe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dbe('0x5'));var logger=require('../../config/logger')(_0x7dbe('0x6'));var config=require(_0x7dbe('0x7'));var jayson=require(_0x7dbe('0x8'));var client=jayson[_0x7dbe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eeae8,_0x41721c,_0x5dffc4){return new BPromise(function(_0x4158b3,_0x13cd0f){return client[_0x7dbe('0xa')](_0x2eeae8,_0x5dffc4)[_0x7dbe('0xb')](function(_0x486469){logger[_0x7dbe('0xc')](_0x7dbe('0xd'),_0x41721c,_0x7dbe('0xe'));logger[_0x7dbe('0xf')](_0x7dbe('0x10'),_0x41721c,_0x7dbe('0xe'),JSON[_0x7dbe('0x11')](_0x486469));if(_0x486469[_0x7dbe('0x12')]){if(_0x486469[_0x7dbe('0x12')][_0x7dbe('0x13')]===0x1f4){logger[_0x7dbe('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x41721c,_0x486469['error'][_0x7dbe('0x14')]);return _0x13cd0f(_0x486469['error'][_0x7dbe('0x14')]);}logger[_0x7dbe('0x12')](_0x7dbe('0xd'),_0x41721c,_0x486469[_0x7dbe('0x12')][_0x7dbe('0x14')]);return _0x4158b3(_0x486469[_0x7dbe('0x12')][_0x7dbe('0x14')]);}else{logger[_0x7dbe('0xc')](_0x7dbe('0xd'),_0x41721c,_0x7dbe('0xe'));_0x4158b3(_0x486469[_0x7dbe('0x15')][_0x7dbe('0x14')]);}})[_0x7dbe('0x16')](function(_0x3280fa){logger[_0x7dbe('0x12')](_0x7dbe('0xd'),_0x41721c,_0x3280fa);_0x13cd0f(_0x3280fa);});});}exports[_0x7dbe('0x17')]=function(_0x5d56c6){var _0x15972a=this;return new Promise(function(_0xfe3510,_0x56fe0){return db[_0x7dbe('0x18')][_0x7dbe('0x19')]({'raw':_0x5d56c6[_0x7dbe('0x1a')]?_0x5d56c6[_0x7dbe('0x1a')][_0x7dbe('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d56c6['options']?_0x5d56c6[_0x7dbe('0x1a')]['where']||null:null,'attributes':_0x5d56c6[_0x7dbe('0x1a')]?_0x5d56c6[_0x7dbe('0x1a')][_0x7dbe('0x1c')]||null:null,'include':_0x5d56c6['options']?_0x5d56c6[_0x7dbe('0x1a')][_0x7dbe('0x1d')]?_[_0x7dbe('0x1e')](_0x5d56c6[_0x7dbe('0x1a')][_0x7dbe('0x1d')],function(_0x29bc8f){return{'model':db[_0x29bc8f[_0x7dbe('0x1f')]],'as':_0x29bc8f['as'],'attributes':_0x29bc8f['attributes'],'include':_0x29bc8f['include']?_['map'](_0x29bc8f[_0x7dbe('0x1d')],function(_0x269c3e){return{'model':db[_0x269c3e[_0x7dbe('0x1f')]],'as':_0x269c3e['as'],'attributes':_0x269c3e['attributes'],'include':_0x269c3e[_0x7dbe('0x1d')]?_['map'](_0x269c3e[_0x7dbe('0x1d')],function(_0x3c5dc1){return{'model':db[_0x3c5dc1[_0x7dbe('0x1f')]],'as':_0x3c5dc1['as'],'attributes':_0x3c5dc1[_0x7dbe('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3afa09){logger[_0x7dbe('0xc')](_0x7dbe('0x17'),_0x5d56c6);logger[_0x7dbe('0xf')]('ShowSquareOdbc',_0x5d56c6,JSON[_0x7dbe('0x11')](_0x3afa09));_0xfe3510(_0x3afa09);})[_0x7dbe('0x16')](function(_0x332dc4){logger[_0x7dbe('0x12')]('ShowSquareOdbc',_0x332dc4['message'],_0x5d56c6);_0x56fe0(_0x15972a['error'](0x1f4,_0x332dc4['message']));});});}; \ No newline at end of file +var _0xa057=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw','map','model','attributes','include','ShowSquareOdbc','lodash','moment'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xa057,0x10c));var _0x7a05=function(_0x4adc06,_0x3d0d2c){_0x4adc06=_0x4adc06-0x0;var _0x2b5501=_0xa057[_0x4adc06];return _0x2b5501;};'use strict';var _=require(_0x7a05('0x0'));var util=require('util');var moment=require(_0x7a05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a05('0x2'));var db=require(_0x7a05('0x3'))['db'];var utils=require(_0x7a05('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a05('0x5'));var jayson=require(_0x7a05('0x6'));var client=jayson[_0x7a05('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45a3d2,_0x3f0862,_0x507cf4){return new BPromise(function(_0x1d64e6,_0x1558ba){return client[_0x7a05('0x8')](_0x45a3d2,_0x507cf4)[_0x7a05('0x9')](function(_0x4e1ab0){logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x3f0862,_0x7a05('0xc'));logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x3f0862,_0x7a05('0xc'),JSON[_0x7a05('0xf')](_0x4e1ab0));if(_0x4e1ab0[_0x7a05('0x10')]){if(_0x4e1ab0[_0x7a05('0x10')][_0x7a05('0x11')]===0x1f4){logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x3f0862,_0x4e1ab0['error'][_0x7a05('0x12')]);return _0x1558ba(_0x4e1ab0['error'][_0x7a05('0x12')]);}logger[_0x7a05('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3f0862,_0x4e1ab0[_0x7a05('0x10')][_0x7a05('0x12')]);return _0x1d64e6(_0x4e1ab0[_0x7a05('0x10')][_0x7a05('0x12')]);}else{logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x3f0862,_0x7a05('0xc'));_0x1d64e6(_0x4e1ab0[_0x7a05('0x13')]['message']);}})[_0x7a05('0x14')](function(_0x446b47){logger['error'](_0x7a05('0xb'),_0x3f0862,_0x446b47);_0x1558ba(_0x446b47);});});}exports['ShowSquareOdbc']=function(_0x426772){var _0x56ea0c=this;return new Promise(function(_0x10a5a3,_0xf80b9e){return db[_0x7a05('0x15')][_0x7a05('0x16')]({'raw':_0x426772[_0x7a05('0x17')]?_0x426772[_0x7a05('0x17')][_0x7a05('0x18')]===undefined?!![]:![]:!![],'where':_0x426772['options']?_0x426772['options']['where']||null:null,'attributes':_0x426772[_0x7a05('0x17')]?_0x426772[_0x7a05('0x17')]['attributes']||null:null,'include':_0x426772['options']?_0x426772[_0x7a05('0x17')]['include']?_[_0x7a05('0x19')](_0x426772[_0x7a05('0x17')]['include'],function(_0x13a781){return{'model':db[_0x13a781[_0x7a05('0x1a')]],'as':_0x13a781['as'],'attributes':_0x13a781[_0x7a05('0x1b')],'include':_0x13a781['include']?_[_0x7a05('0x19')](_0x13a781['include'],function(_0xbdae92){return{'model':db[_0xbdae92[_0x7a05('0x1a')]],'as':_0xbdae92['as'],'attributes':_0xbdae92[_0x7a05('0x1b')],'include':_0xbdae92[_0x7a05('0x1c')]?_[_0x7a05('0x19')](_0xbdae92[_0x7a05('0x1c')],function(_0x42383e){return{'model':db[_0x42383e[_0x7a05('0x1a')]],'as':_0x42383e['as'],'attributes':_0x42383e[_0x7a05('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7a05('0x9')](function(_0x398f48){logger[_0x7a05('0xa')]('ShowSquareOdbc',_0x426772);logger[_0x7a05('0xd')](_0x7a05('0x1d'),_0x426772,JSON['stringify'](_0x398f48));_0x10a5a3(_0x398f48);})[_0x7a05('0x14')](function(_0x302322){logger['error'](_0x7a05('0x1d'),_0x302322[_0x7a05('0x12')],_0x426772);_0xf80b9e(_0x56ea0c[_0x7a05('0x10')](0x1f4,_0x302322[_0x7a05('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a41ef98..66ee7ea 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 _0xb609=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller'];(function(_0x46d217,_0x549065){var _0x1da1d5=function(_0x4e0dc8){while(--_0x4e0dc8){_0x46d217['push'](_0x46d217['shift']());}};_0x1da1d5(++_0x549065);}(_0xb609,0x129));var _0x9b60=function(_0x2ff6b5,_0xa79330){_0x2ff6b5=_0x2ff6b5-0x0;var _0x4f326c=_0xb609[_0x2ff6b5];return _0x4f326c;};'use strict';var multer=require(_0x9b60('0x0'));var util=require(_0x9b60('0x1'));var path=require(_0x9b60('0x2'));var timeout=require(_0x9b60('0x3'));var express=require(_0x9b60('0x4'));var router=express[_0x9b60('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9b60('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b60('0x7'));var controller=require(_0x9b60('0x8'));router['get']('/',auth[_0x9b60('0x9')](),controller['index']);router['get'](_0x9b60('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9b60('0xb')]('/',auth[_0x9b60('0x9')](),controller[_0x9b60('0xc')]);router[_0x9b60('0xd')](_0x9b60('0xa'),auth[_0x9b60('0x9')](),controller[_0x9b60('0xe')]);router[_0x9b60('0xf')](_0x9b60('0xa'),auth[_0x9b60('0x9')](),controller[_0x9b60('0x10')]);module[_0x9b60('0x11')]=router; \ No newline at end of file +var _0xb752=['../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3ca6d6,_0x1e644c){var _0xc88cfc=function(_0x4d77be){while(--_0x4d77be){_0x3ca6d6['push'](_0x3ca6d6['shift']());}};_0xc88cfc(++_0x1e644c);}(_0xb752,0x177));var _0x2b75=function(_0x42f24b,_0xd74942){_0x42f24b=_0x42f24b-0x0;var _0x50f7d1=_0xb752[_0x42f24b];return _0x50f7d1;};'use strict';var multer=require(_0x2b75('0x0'));var util=require(_0x2b75('0x1'));var path=require('path');var timeout=require(_0x2b75('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2b75('0x3'));var auth=require(_0x2b75('0x4'));var interaction=require(_0x2b75('0x5'));var config=require(_0x2b75('0x6'));var controller=require(_0x2b75('0x7'));router[_0x2b75('0x8')]('/',auth[_0x2b75('0x9')](),controller[_0x2b75('0xa')]);router['get'](_0x2b75('0xb'),auth[_0x2b75('0x9')](),controller[_0x2b75('0xc')]);router[_0x2b75('0xd')]('/',auth[_0x2b75('0x9')](),controller[_0x2b75('0xe')]);router[_0x2b75('0xf')](_0x2b75('0xb'),auth[_0x2b75('0x9')](),controller[_0x2b75('0x10')]);router[_0x2b75('0x11')](_0x2b75('0xb'),auth[_0x2b75('0x9')](),controller[_0x2b75('0x12')]);module[_0x2b75('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d713db4..665afc1 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 _0xbdc1=['production','toString','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x19f20a,_0x4e4797){var _0x4c9b9a=function(_0x237b06){while(--_0x237b06){_0x19f20a['push'](_0x19f20a['shift']());}};_0x4c9b9a(++_0x4e4797);}(_0xbdc1,0x147));var _0x1bdc=function(_0x2c8765,_0x197b6b){_0x2c8765=_0x2c8765-0x0;var _0x17ea19=_0xbdc1[_0x2c8765];return _0x17ea19;};'use strict';var Sequelize=require(_0x1bdc('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bdc('0x1')],'unique':_0x1bdc('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1bdc('0x1')]},'notes':{'type':Sequelize[_0x1bdc('0x3')]},'preproduction':{'type':Sequelize[_0x1bdc('0x4')](_0x1bdc('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x1bdc('0x6')](_0x1bdc('0x7'))['toString'](_0x1bdc('0x8'));}}},'production':{'type':Sequelize[_0x1bdc('0x4')](_0x1bdc('0x5')),'get':function(){if(this[_0x1bdc('0x6')](_0x1bdc('0x9'))){return this[_0x1bdc('0x6')](_0x1bdc('0x9'))[_0x1bdc('0xa')](_0x1bdc('0x8'));}}},'savedAt':{'type':Sequelize[_0x1bdc('0xb')]},'publishedAt':{'type':Sequelize[_0x1bdc('0xb')]}}; \ No newline at end of file +var _0x9341=['toString','utf8','long','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction'];(function(_0x4063fa,_0x3c7f60){var _0x5c1972=function(_0x5204a1){while(--_0x5204a1){_0x4063fa['push'](_0x4063fa['shift']());}};_0x5c1972(++_0x3c7f60);}(_0x9341,0xc8));var _0x1934=function(_0x5250cd,_0x56a31a){_0x5250cd=_0x5250cd-0x0;var _0x556944=_0x9341[_0x5250cd];return _0x556944;};'use strict';var Sequelize=require(_0x1934('0x0'));module[_0x1934('0x1')]={'name':{'type':Sequelize[_0x1934('0x2')],'unique':_0x1934('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x1934('0x4')]},'preproduction':{'type':Sequelize[_0x1934('0x5')]('long'),'get':function(){if(this[_0x1934('0x6')](_0x1934('0x7'))){return this['getDataValue']('preproduction')[_0x1934('0x8')](_0x1934('0x9'));}}},'production':{'type':Sequelize[_0x1934('0x5')](_0x1934('0xa')),'get':function(){if(this[_0x1934('0x6')](_0x1934('0xb'))){return this[_0x1934('0x6')](_0x1934('0xb'))[_0x1934('0x8')](_0x1934('0x9'));}}},'savedAt':{'type':Sequelize[_0x1934('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1297460..30b0d76 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 _0xbabc=['params','keys','find','create','body','user','role','get','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','count','set','Content-Range','json','update','then','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','stack','name','send','map','SquareProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x4726b1,_0xa03991){var _0x3c2877=function(_0x5c92be){while(--_0x5c92be){_0x4726b1['push'](_0x4726b1['shift']());}};_0x3c2877(++_0xa03991);}(_0xbabc,0x1ef));var _0xcbab=function(_0x47b180,_0x1b8704){_0x47b180=_0x47b180-0x0;var _0x1b99eb=_0xbabc[_0x47b180];return _0x1b99eb;};'use strict';var _=require(_0xcbab('0x0'));var Redis=require(_0xcbab('0x1'));var qs=require(_0xcbab('0x2'));var logger=require(_0xcbab('0x3'))('api');var config=require(_0xcbab('0x4'));var db=require(_0xcbab('0x5'))['db'];config[_0xcbab('0x6')]=_['defaults'](config[_0xcbab('0x6')],{'host':_0xcbab('0x7'),'port':0x18eb});var socket=require(_0xcbab('0x8'))(new Redis(config[_0xcbab('0x6')]));require(_0xcbab('0x9'))[_0xcbab('0xa')](socket);function respondWithResult(_0x3c89f1,_0x987de5){_0x987de5=_0x987de5||0xc8;return function(_0x23e9b1){if(_0x23e9b1){return _0x3c89f1[_0xcbab('0xb')](_0x987de5)['json'](_0x23e9b1);}};}function respondWithFilteredResult(_0x4952a6,_0x128a48){return function(_0x45d720){if(_0x45d720){var _0x3c8968=typeof _0x128a48[_0xcbab('0xc')]==='undefined'&&typeof _0x128a48[_0xcbab('0xd')]==='undefined';var _0x6fab38=_0x45d720[_0xcbab('0xe')];var _0xc8e2d4=_0x3c8968?0x0:_0x128a48['offset'];var _0x3f643a=_0x3c8968?_0x45d720['count']:_0x128a48[_0xcbab('0xc')]+_0x128a48[_0xcbab('0xd')];var _0x1e159f;if(_0x3f643a>=_0x6fab38){_0x3f643a=_0x6fab38;_0x1e159f=0xc8;}else{_0x1e159f=0xce;}_0x4952a6['status'](_0x1e159f);return _0x4952a6[_0xcbab('0xf')](_0xcbab('0x10'),_0xc8e2d4+'-'+_0x3f643a+'/'+_0x6fab38)[_0xcbab('0x11')](_0x45d720);}return null;};}function saveUpdates(_0x41906a){return function(_0x557288){if(_0x557288){return _0x557288[_0xcbab('0x12')](_0x41906a)['then'](function(_0x73e6dc){return _0x73e6dc;});}return null;};}function removeEntity(_0x58aaf5){return function(_0x84e0e6){if(_0x84e0e6){return _0x84e0e6['destroy']()[_0xcbab('0x13')](function(){var _0x3040c7=_0x84e0e6['get']({'plain':!![]});var _0x17253a=_0xcbab('0x14');return db[_0xcbab('0x15')][_0xcbab('0x16')]({'where':{'type':_0x17253a,'resourceId':_0x3040c7['id']}})[_0xcbab('0x13')](function(){return _0x84e0e6;});})[_0xcbab('0x13')](function(){var _0xaeeed2=new Redis(config[_0xcbab('0x6')]);_0xaeeed2[_0xcbab('0x17')](_0xcbab('0x18'),JSON[_0xcbab('0x19')]({'id':_0x84e0e6['id'],'deleted':!![]}));})[_0xcbab('0x13')](function(){_0x58aaf5[_0xcbab('0xb')](0xcc)[_0xcbab('0x1a')]();});}};}function handleEntityNotFound(_0x44bbfe){return function(_0x560771){if(!_0x560771){_0x44bbfe[_0xcbab('0x1b')](0x194);}return _0x560771;};}function handleError(_0x279fc0,_0x3883e4){_0x3883e4=_0x3883e4||0x1f4;return function(_0x478acd){logger['error'](_0x478acd[_0xcbab('0x1c')]);if(_0x478acd['name']){delete _0x478acd[_0xcbab('0x1d')];}_0x279fc0[_0xcbab('0xb')](_0x3883e4)[_0xcbab('0x1e')](_0x478acd);};}exports['index']=function(_0x591d84,_0x2c4589){var _0x3e9eca={},_0x4f0c60={},_0x187fc3={'count':0x0,'rows':[]};var _0x342de5=_[_0xcbab('0x1f')](db[_0xcbab('0x20')]['rawAttributes'],function(_0x3cb94b){return{'name':_0x3cb94b[_0xcbab('0x21')],'type':_0x3cb94b[_0xcbab('0x22')][_0xcbab('0x23')]};});_0x4f0c60[_0xcbab('0x24')]=_[_0xcbab('0x1f')](_0x342de5,'name');_0x4f0c60['query']=_['keys'](_0x591d84[_0xcbab('0x25')]);_0x4f0c60[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0x4f0c60[_0xcbab('0x24')],_0x4f0c60[_0xcbab('0x25')]);_0x3e9eca[_0xcbab('0x28')]=_[_0xcbab('0x27')](_0x4f0c60[_0xcbab('0x24')],qs[_0xcbab('0x29')](_0x591d84['query']['fields']));_0x3e9eca[_0xcbab('0x28')]=_0x3e9eca[_0xcbab('0x28')][_0xcbab('0x2a')]?_0x3e9eca[_0xcbab('0x28')]:_0x4f0c60[_0xcbab('0x24')];if(!_0x591d84[_0xcbab('0x25')][_0xcbab('0x2b')](_0xcbab('0x2c'))){_0x3e9eca[_0xcbab('0xd')]=qs[_0xcbab('0xd')](_0x591d84[_0xcbab('0x25')]['limit']);_0x3e9eca[_0xcbab('0xc')]=qs[_0xcbab('0xc')](_0x591d84[_0xcbab('0x25')][_0xcbab('0xc')]);}_0x3e9eca[_0xcbab('0x2d')]=qs['sort'](_0x591d84[_0xcbab('0x25')][_0xcbab('0x2e')]);_0x3e9eca['where']=qs[_0xcbab('0x26')](_[_0xcbab('0x2f')](_0x591d84[_0xcbab('0x25')],_0x4f0c60[_0xcbab('0x26')]),_0x342de5);if(_0x591d84[_0xcbab('0x25')][_0xcbab('0x30')]){_0x3e9eca[_0xcbab('0x31')]=_[_0xcbab('0x32')](_0x3e9eca[_0xcbab('0x31')],{'$or':_['map'](_0x342de5,function(_0x4f0cdf){if(_0x4f0cdf[_0xcbab('0x22')]!==_0xcbab('0x33')){var _0x4baf0d={};_0x4baf0d[_0x4f0cdf[_0xcbab('0x1d')]]={'$like':'%'+_0x591d84['query']['filter']+'%'};return _0x4baf0d;}})});}_0x3e9eca=_[_0xcbab('0x32')]({},_0x3e9eca,_0x591d84[_0xcbab('0x34')]);var _0x3db635={'where':_0x3e9eca[_0xcbab('0x31')]};return db[_0xcbab('0x20')][_0xcbab('0xe')](_0x3db635)['then'](function(_0x1964b1){_0x187fc3[_0xcbab('0xe')]=_0x1964b1;if(_0x591d84[_0xcbab('0x25')][_0xcbab('0x35')]){_0x3e9eca[_0xcbab('0x36')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x3e9eca);})[_0xcbab('0x13')](function(_0x4d99be){_0x187fc3[_0xcbab('0x37')]=_0x4d99be;return _0x187fc3;})[_0xcbab('0x13')](respondWithFilteredResult(_0x2c4589,_0x3e9eca))[_0xcbab('0x38')](handleError(_0x2c4589,null));};exports['show']=function(_0x52db13,_0x339ab1){var _0x2c961f={'raw':![],'where':{'id':_0x52db13[_0xcbab('0x39')]['id']}},_0x3f990a={};_0x3f990a[_0xcbab('0x24')]=_[_0xcbab('0x3a')](db['SquareProject']['rawAttributes']);_0x3f990a[_0xcbab('0x25')]=_[_0xcbab('0x3a')](_0x52db13[_0xcbab('0x25')]);_0x3f990a[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0x3f990a[_0xcbab('0x24')],_0x3f990a[_0xcbab('0x25')]);_0x2c961f['attributes']=_['intersection'](_0x3f990a[_0xcbab('0x24')],qs[_0xcbab('0x29')](_0x52db13['query'][_0xcbab('0x29')]));_0x2c961f['attributes']=_0x2c961f['attributes']['length']?_0x2c961f[_0xcbab('0x28')]:_0x3f990a[_0xcbab('0x24')];if(_0x52db13[_0xcbab('0x25')][_0xcbab('0x35')]){_0x2c961f[_0xcbab('0x36')]=[{'all':!![]}];}_0x2c961f=_[_0xcbab('0x32')]({},_0x2c961f,_0x52db13['options']);return db[_0xcbab('0x20')][_0xcbab('0x3b')](_0x2c961f)[_0xcbab('0x13')](handleEntityNotFound(_0x339ab1,null))['then'](respondWithResult(_0x339ab1,null))[_0xcbab('0x38')](handleError(_0x339ab1,null));};exports[_0xcbab('0x3c')]=function(_0x501b1c,_0x18a9bb){return db[_0xcbab('0x20')]['create'](_0x501b1c[_0xcbab('0x3d')],{})[_0xcbab('0x13')](function(_0x4df47d){var _0x37f868=_0x501b1c[_0xcbab('0x3e')]['get']({'plain':!![]});if(!_0x37f868)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37f868[_0xcbab('0x3f')]==='user'){var _0x4f5caa=_0x4df47d[_0xcbab('0x40')]({'plain':!![]});var _0xa11e5a=_0xcbab('0x14');return db['UserProfileSection'][_0xcbab('0x3b')]({'where':{'name':_0xa11e5a,'userProfileId':_0x37f868['userProfileId']},'raw':!![]})[_0xcbab('0x13')](function(_0x22dbd0){if(_0x22dbd0&&_0x22dbd0[_0xcbab('0x41')]===0x0){return db['UserProfileResource'][_0xcbab('0x3c')]({'name':_0x4f5caa[_0xcbab('0x1d')],'resourceId':_0x4f5caa['id'],'type':_0x22dbd0[_0xcbab('0x1d')],'sectionId':_0x22dbd0['id']},{})[_0xcbab('0x13')](function(){return _0x4df47d;});}else{return _0x4df47d;}})['catch'](function(_0x257601){logger[_0xcbab('0x42')](_0xcbab('0x43'),_0x257601);throw _0x257601;});}return _0x4df47d;})['then'](respondWithResult(_0x18a9bb,0xc9))[_0xcbab('0x38')](handleError(_0x18a9bb,null));};exports[_0xcbab('0x12')]=function(_0x485cde,_0x2f833){if(_0x485cde[_0xcbab('0x3d')]['id']){delete _0x485cde[_0xcbab('0x3d')]['id'];}return db[_0xcbab('0x20')][_0xcbab('0x3b')]({'where':{'id':_0x485cde[_0xcbab('0x39')]['id']}})[_0xcbab('0x13')](handleEntityNotFound(_0x2f833,null))[_0xcbab('0x13')](saveUpdates(_0x485cde[_0xcbab('0x3d')],null))[_0xcbab('0x13')](function(_0x591c20){if(!_0x591c20)return;var _0x2e435f=_0x591c20['get']({'plain':!![]});return _0x2e435f;})[_0xcbab('0x13')](function(_0xa4685a){var _0x3c6aa6=new Redis(config['redis']);_0x3c6aa6['publish'](_0xcbab('0x18'),JSON[_0xcbab('0x19')](_[_0xcbab('0x2f')](_0xa4685a,['id','name',_0xcbab('0x44')])));return _0xa4685a;})['then'](respondWithResult(_0x2f833,null))[_0xcbab('0x38')](handleError(_0x2f833,null));};exports[_0xcbab('0x16')]=function(_0x4d81d1,_0x572ce4){return db['SquareProject']['find']({'where':{'id':_0x4d81d1[_0xcbab('0x39')]['id']}})[_0xcbab('0x13')](handleEntityNotFound(_0x572ce4,null))['then'](removeEntity(_0x572ce4,null))[_0xcbab('0x38')](handleError(_0x572ce4,null));}; \ No newline at end of file +var _0x627d=['then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','offset','undefined','count','limit','set','Content-Range','json','update'];(function(_0x5cf93f,_0x37258d){var _0x2eb2d0=function(_0x55db53){while(--_0x55db53){_0x5cf93f['push'](_0x5cf93f['shift']());}};_0x2eb2d0(++_0x37258d);}(_0x627d,0x7e));var _0xd627=function(_0x1ee666,_0x3b81ae){_0x1ee666=_0x1ee666-0x0;var _0x61890f=_0x627d[_0x1ee666];return _0x61890f;};'use strict';var _=require(_0xd627('0x0'));var Redis=require(_0xd627('0x1'));var qs=require(_0xd627('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xd627('0x3'));var db=require('../../mysqldb')['db'];config[_0xd627('0x4')]=_[_0xd627('0x5')](config[_0xd627('0x4')],{'host':_0xd627('0x6'),'port':0x18eb});var socket=require(_0xd627('0x7'))(new Redis(config[_0xd627('0x4')]));require(_0xd627('0x8'))['register'](socket);function respondWithResult(_0xcced21,_0x11a0b7){_0x11a0b7=_0x11a0b7||0xc8;return function(_0x4dce99){if(_0x4dce99){return _0xcced21[_0xd627('0x9')](_0x11a0b7)['json'](_0x4dce99);}};}function respondWithFilteredResult(_0xa25af9,_0x4b73ce){return function(_0x192d46){if(_0x192d46){var _0x51ccf5=typeof _0x4b73ce[_0xd627('0xa')]===_0xd627('0xb')&&typeof _0x4b73ce['limit']===_0xd627('0xb');var _0x5686c6=_0x192d46['count'];var _0x531c8b=_0x51ccf5?0x0:_0x4b73ce[_0xd627('0xa')];var _0x9a334=_0x51ccf5?_0x192d46[_0xd627('0xc')]:_0x4b73ce[_0xd627('0xa')]+_0x4b73ce[_0xd627('0xd')];var _0x41da22;if(_0x9a334>=_0x5686c6){_0x9a334=_0x5686c6;_0x41da22=0xc8;}else{_0x41da22=0xce;}_0xa25af9[_0xd627('0x9')](_0x41da22);return _0xa25af9[_0xd627('0xe')](_0xd627('0xf'),_0x531c8b+'-'+_0x9a334+'/'+_0x5686c6)[_0xd627('0x10')](_0x192d46);}return null;};}function saveUpdates(_0x5927e6){return function(_0x38ef40){if(_0x38ef40){return _0x38ef40[_0xd627('0x11')](_0x5927e6)[_0xd627('0x12')](function(_0x3cd872){return _0x3cd872;});}return null;};}function removeEntity(_0x4b9723){return function(_0x492a1f){if(_0x492a1f){return _0x492a1f[_0xd627('0x13')]()['then'](function(){var _0x83d547=_0x492a1f[_0xd627('0x14')]({'plain':!![]});var _0xcbfbc4=_0xd627('0x15');return db[_0xd627('0x16')][_0xd627('0x13')]({'where':{'type':_0xcbfbc4,'resourceId':_0x83d547['id']}})[_0xd627('0x12')](function(){return _0x492a1f;});})['then'](function(){var _0x19c5f0=new Redis(config['redis']);_0x19c5f0[_0xd627('0x17')](_0xd627('0x18'),JSON[_0xd627('0x19')]({'id':_0x492a1f['id'],'deleted':!![]}));})['then'](function(){_0x4b9723[_0xd627('0x9')](0xcc)[_0xd627('0x1a')]();});}};}function handleEntityNotFound(_0x44a868){return function(_0x149b86){if(!_0x149b86){_0x44a868[_0xd627('0x1b')](0x194);}return _0x149b86;};}function handleError(_0x5f1149,_0x690b6a){_0x690b6a=_0x690b6a||0x1f4;return function(_0x135d38){logger[_0xd627('0x1c')](_0x135d38[_0xd627('0x1d')]);if(_0x135d38[_0xd627('0x1e')]){delete _0x135d38['name'];}_0x5f1149[_0xd627('0x9')](_0x690b6a)[_0xd627('0x1f')](_0x135d38);};}exports[_0xd627('0x20')]=function(_0x27d019,_0x491985){var _0x292017={},_0x1b3e92={},_0x2edcfe={'count':0x0,'rows':[]};var _0x3062d3=_[_0xd627('0x21')](db[_0xd627('0x22')]['rawAttributes'],function(_0x3d53db){return{'name':_0x3d53db[_0xd627('0x23')],'type':_0x3d53db[_0xd627('0x24')][_0xd627('0x25')]};});_0x1b3e92['model']=_[_0xd627('0x21')](_0x3062d3,'name');_0x1b3e92[_0xd627('0x26')]=_[_0xd627('0x27')](_0x27d019[_0xd627('0x26')]);_0x1b3e92[_0xd627('0x28')]=_[_0xd627('0x29')](_0x1b3e92['model'],_0x1b3e92[_0xd627('0x26')]);_0x292017[_0xd627('0x2a')]=_['intersection'](_0x1b3e92['model'],qs[_0xd627('0x2b')](_0x27d019[_0xd627('0x26')][_0xd627('0x2b')]));_0x292017[_0xd627('0x2a')]=_0x292017[_0xd627('0x2a')]['length']?_0x292017[_0xd627('0x2a')]:_0x1b3e92[_0xd627('0x2c')];if(!_0x27d019[_0xd627('0x26')][_0xd627('0x2d')]('nolimit')){_0x292017[_0xd627('0xd')]=qs['limit'](_0x27d019[_0xd627('0x26')]['limit']);_0x292017[_0xd627('0xa')]=qs[_0xd627('0xa')](_0x27d019[_0xd627('0x26')]['offset']);}_0x292017[_0xd627('0x2e')]=qs[_0xd627('0x2f')](_0x27d019[_0xd627('0x26')][_0xd627('0x2f')]);_0x292017[_0xd627('0x30')]=qs['filters'](_[_0xd627('0x31')](_0x27d019[_0xd627('0x26')],_0x1b3e92['filters']),_0x3062d3);if(_0x27d019[_0xd627('0x26')][_0xd627('0x32')]){_0x292017['where']=_[_0xd627('0x33')](_0x292017[_0xd627('0x30')],{'$or':_['map'](_0x3062d3,function(_0x343252){if(_0x343252['type']!=='VIRTUAL'){var _0x4427e7={};_0x4427e7[_0x343252['name']]={'$like':'%'+_0x27d019[_0xd627('0x26')][_0xd627('0x32')]+'%'};return _0x4427e7;}})});}_0x292017=_[_0xd627('0x33')]({},_0x292017,_0x27d019[_0xd627('0x34')]);var _0x2ccd74={'where':_0x292017[_0xd627('0x30')]};return db['SquareProject'][_0xd627('0xc')](_0x2ccd74)[_0xd627('0x12')](function(_0xdfaa8d){_0x2edcfe[_0xd627('0xc')]=_0xdfaa8d;if(_0x27d019[_0xd627('0x26')][_0xd627('0x35')]){_0x292017[_0xd627('0x36')]=[{'all':!![]}];}return db['SquareProject'][_0xd627('0x37')](_0x292017);})['then'](function(_0x1fd698){_0x2edcfe[_0xd627('0x38')]=_0x1fd698;return _0x2edcfe;})[_0xd627('0x12')](respondWithFilteredResult(_0x491985,_0x292017))[_0xd627('0x39')](handleError(_0x491985,null));};exports[_0xd627('0x3a')]=function(_0x4b8d17,_0x20cf4a){var _0x12971d={'raw':![],'where':{'id':_0x4b8d17[_0xd627('0x3b')]['id']}},_0x4c8628={};_0x4c8628[_0xd627('0x2c')]=_[_0xd627('0x27')](db['SquareProject'][_0xd627('0x3c')]);_0x4c8628[_0xd627('0x26')]=_['keys'](_0x4b8d17[_0xd627('0x26')]);_0x4c8628['filters']=_['intersection'](_0x4c8628[_0xd627('0x2c')],_0x4c8628[_0xd627('0x26')]);_0x12971d[_0xd627('0x2a')]=_[_0xd627('0x29')](_0x4c8628[_0xd627('0x2c')],qs[_0xd627('0x2b')](_0x4b8d17['query'][_0xd627('0x2b')]));_0x12971d[_0xd627('0x2a')]=_0x12971d[_0xd627('0x2a')][_0xd627('0x3d')]?_0x12971d[_0xd627('0x2a')]:_0x4c8628[_0xd627('0x2c')];if(_0x4b8d17['query'][_0xd627('0x35')]){_0x12971d['include']=[{'all':!![]}];}_0x12971d=_['merge']({},_0x12971d,_0x4b8d17[_0xd627('0x34')]);return db['SquareProject'][_0xd627('0x3e')](_0x12971d)['then'](handleEntityNotFound(_0x20cf4a,null))[_0xd627('0x12')](respondWithResult(_0x20cf4a,null))['catch'](handleError(_0x20cf4a,null));};exports[_0xd627('0x3f')]=function(_0x28d6b9,_0x29d21c){return db[_0xd627('0x22')][_0xd627('0x3f')](_0x28d6b9['body'],{})[_0xd627('0x12')](function(_0x3bd2dd){var _0x53cc2b=_0x28d6b9[_0xd627('0x40')][_0xd627('0x14')]({'plain':!![]});if(!_0x53cc2b)throw new Error(_0xd627('0x41'));if(_0x53cc2b[_0xd627('0x42')]===_0xd627('0x40')){var _0x32a1df=_0x3bd2dd[_0xd627('0x14')]({'plain':!![]});var _0x1d18fe=_0xd627('0x15');return db[_0xd627('0x43')][_0xd627('0x3e')]({'where':{'name':_0x1d18fe,'userProfileId':_0x53cc2b[_0xd627('0x44')]},'raw':!![]})['then'](function(_0x3d932f){if(_0x3d932f&&_0x3d932f[_0xd627('0x45')]===0x0){return db[_0xd627('0x16')][_0xd627('0x3f')]({'name':_0x32a1df[_0xd627('0x1e')],'resourceId':_0x32a1df['id'],'type':_0x3d932f['name'],'sectionId':_0x3d932f['id']},{})['then'](function(){return _0x3bd2dd;});}else{return _0x3bd2dd;}})['catch'](function(_0x47dfe9){logger['error'](_0xd627('0x46'),_0x47dfe9);throw _0x47dfe9;});}return _0x3bd2dd;})['then'](respondWithResult(_0x29d21c,0xc9))[_0xd627('0x39')](handleError(_0x29d21c,null));};exports['update']=function(_0x42dcd3,_0x6f6cc1){if(_0x42dcd3[_0xd627('0x47')]['id']){delete _0x42dcd3[_0xd627('0x47')]['id'];}return db['SquareProject'][_0xd627('0x3e')]({'where':{'id':_0x42dcd3[_0xd627('0x3b')]['id']}})['then'](handleEntityNotFound(_0x6f6cc1,null))[_0xd627('0x12')](saveUpdates(_0x42dcd3['body'],null))['then'](function(_0x19a19f){if(!_0x19a19f)return;var _0x141bc6=_0x19a19f[_0xd627('0x14')]({'plain':!![]});return _0x141bc6;})[_0xd627('0x12')](function(_0x4f3c4e){var _0x2a9f45=new Redis(config[_0xd627('0x4')]);_0x2a9f45[_0xd627('0x17')](_0xd627('0x18'),JSON[_0xd627('0x19')](_[_0xd627('0x31')](_0x4f3c4e,['id','name','production'])));return _0x4f3c4e;})['then'](respondWithResult(_0x6f6cc1,null))[_0xd627('0x39')](handleError(_0x6f6cc1,null));};exports['destroy']=function(_0x3a033a,_0x2b9944){return db['SquareProject']['find']({'where':{'id':_0x3a033a[_0xd627('0x3b')]['id']}})[_0xd627('0x12')](handleEntityNotFound(_0x2b9944,null))['then'](removeEntity(_0x2b9944,null))[_0xd627('0x39')](handleError(_0x2b9944,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0fb8166..cd986c5 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 _0x8bc1=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x3eda5d,_0x2320c4){var _0x5cdebc=function(_0x1de022){while(--_0x1de022){_0x3eda5d['push'](_0x3eda5d['shift']());}};_0x5cdebc(++_0x2320c4);}(_0x8bc1,0x19c));var _0x18bc=function(_0x52dfbc,_0x17ae35){_0x52dfbc=_0x52dfbc-0x0;var _0x44df03=_0x8bc1[_0x52dfbc];return _0x44df03;};'use strict';var EventEmitter=require(_0x18bc('0x0'));var SquareProject=require(_0x18bc('0x1'))['db'][_0x18bc('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x18bc('0x3')](0x0);var events={'afterCreate':_0x18bc('0x4'),'afterUpdate':_0x18bc('0x5'),'afterDestroy':_0x18bc('0x6')};function emitEvent(_0x7bd1dc){return function(_0x5c3c1a,_0x1caddb,_0x2fae3f){SquareProjectEvents[_0x18bc('0x7')](_0x7bd1dc+':'+_0x5c3c1a['id'],_0x5c3c1a);SquareProjectEvents['emit'](_0x7bd1dc,_0x5c3c1a);_0x2fae3f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x18bc('0x8')](e,emitEvent(event));}}module[_0x18bc('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x55cb=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1e7367,_0x5754fa){var _0x5bcb4e=function(_0x18e7aa){while(--_0x18e7aa){_0x1e7367['push'](_0x1e7367['shift']());}};_0x5bcb4e(++_0x5754fa);}(_0x55cb,0x6f));var _0xb55c=function(_0x3da144,_0x578cbd){_0x3da144=_0x3da144-0x0;var _0x13fdc7=_0x55cb[_0x3da144];return _0x13fdc7;};'use strict';var EventEmitter=require(_0xb55c('0x0'));var SquareProject=require(_0xb55c('0x1'))['db'][_0xb55c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb55c('0x3')](0x0);var events={'afterCreate':_0xb55c('0x4'),'afterUpdate':_0xb55c('0x5'),'afterDestroy':_0xb55c('0x6')};function emitEvent(_0x58e4b5){return function(_0x4b537d,_0x3a0c1b,_0x1ea524){SquareProjectEvents[_0xb55c('0x7')](_0x58e4b5+':'+_0x4b537d['id'],_0x4b537d);SquareProjectEvents[_0xb55c('0x7')](_0x58e4b5,_0x4b537d);_0x1ea524(null);};}for(var e in events){if(events[_0xb55c('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xb55c('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6088602..ded18be 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 _0x7c58=['square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x34b8cb,_0x5a8b2f){var _0x1dca7b=function(_0x1a2f92){while(--_0x1a2f92){_0x34b8cb['push'](_0x34b8cb['shift']());}};_0x1dca7b(++_0x5a8b2f);}(_0x7c58,0x119));var _0x87c5=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x7c58[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x87c5('0x0'));var util=require(_0x87c5('0x1'));var logger=require(_0x87c5('0x2'))(_0x87c5('0x3'));var moment=require(_0x87c5('0x4'));var BPromise=require(_0x87c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87c5('0x6'));var rimraf=require(_0x87c5('0x7'));var config=require(_0x87c5('0x8'));var attributes=require(_0x87c5('0x9'));module[_0x87c5('0xa')]=function(_0x120bc4,_0x1fad7e){return _0x120bc4[_0x87c5('0xb')](_0x87c5('0xc'),attributes,{'tableName':_0x87c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x280747,_0x191154,_0x34db5b){if(_0x280747[_0x87c5('0xe')](_0x87c5('0xf'))){_0x280747[_0x87c5('0x10')]=moment()[_0x87c5('0x11')](_0x87c5('0x12'));}if(_0x280747[_0x87c5('0xe')](_0x87c5('0x13'))){_0x280747[_0x87c5('0x14')]=moment()[_0x87c5('0x11')](_0x87c5('0x12'));}_0x34db5b(null,_0x280747);}}});}; \ No newline at end of file +var _0x8e9c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','publishedAt','lodash','util','../../config/logger'];(function(_0xe5a326,_0x2a1455){var _0x590f41=function(_0x2dc628){while(--_0x2dc628){_0xe5a326['push'](_0xe5a326['shift']());}};_0x590f41(++_0x2a1455);}(_0x8e9c,0x177));var _0xc8e9=function(_0x5a58c0,_0x423e0d){_0x5a58c0=_0x5a58c0-0x0;var _0x18f14e=_0x8e9c[_0x5a58c0];return _0x18f14e;};'use strict';var _=require(_0xc8e9('0x0'));var util=require(_0xc8e9('0x1'));var logger=require(_0xc8e9('0x2'))('api');var moment=require(_0xc8e9('0x3'));var BPromise=require(_0xc8e9('0x4'));var rp=require(_0xc8e9('0x5'));var fs=require('fs');var path=require(_0xc8e9('0x6'));var rimraf=require(_0xc8e9('0x7'));var config=require(_0xc8e9('0x8'));var attributes=require(_0xc8e9('0x9'));module[_0xc8e9('0xa')]=function(_0x4c7e0d,_0x3075e3){return _0x4c7e0d['define'](_0xc8e9('0xb'),attributes,{'tableName':_0xc8e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16e3aa,_0x25c51b,_0x439164){if(_0x16e3aa[_0xc8e9('0xd')](_0xc8e9('0xe'))){_0x16e3aa[_0xc8e9('0xf')]=moment()[_0xc8e9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x16e3aa[_0xc8e9('0xd')]('production')){_0x16e3aa[_0xc8e9('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x439164(null,_0x16e3aa);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 53f5f73..6916101 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 _0xb15e=['lodash','ioredis','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','limit','include','model','attributes','map','info','debug','stringify','error','message','ShowSquareProject','SquareProject','find','then','catch'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb15e,0xae));var _0xeb15=function(_0x75912a,_0x303a12){_0x75912a=_0x75912a-0x0;var _0x10fbed=_0xb15e[_0x75912a];return _0x10fbed;};'use strict';var _=require(_0xeb15('0x0'));var Redis=require(_0xeb15('0x1'));var db=require(_0xeb15('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xeb15('0x3'));config[_0xeb15('0x4')]=_[_0xeb15('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb15('0x6'))(new Redis(config[_0xeb15('0x4')]));require(_0xeb15('0x7'))[_0xeb15('0x8')](socket);exports[_0xeb15('0x9')]=function(_0x2e88d4){var _0x5e59a5=this;return new Promise(function(_0x429ad3,_0x360463){return db['SquareProject'][_0xeb15('0xa')]({'raw':_0x2e88d4[_0xeb15('0xb')]?_0x2e88d4[_0xeb15('0xb')][_0xeb15('0xc')]===undefined?!![]:![]:!![],'where':_0x2e88d4[_0xeb15('0xb')]?_0x2e88d4[_0xeb15('0xb')][_0xeb15('0xd')]||null:null,'attributes':_0x2e88d4[_0xeb15('0xb')]?_0x2e88d4[_0xeb15('0xb')]['attributes']||null:null,'limit':_0x2e88d4[_0xeb15('0xb')]?_0x2e88d4['options'][_0xeb15('0xe')]||null:null,'include':_0x2e88d4[_0xeb15('0xb')]?_0x2e88d4[_0xeb15('0xb')]['include']?_['map'](_0x2e88d4[_0xeb15('0xb')][_0xeb15('0xf')],function(_0x13ed22){return{'model':db[_0x13ed22[_0xeb15('0x10')]],'as':_0x13ed22['as'],'attributes':_0x13ed22['attributes'],'include':_0x13ed22['include']?_['map'](_0x13ed22[_0xeb15('0xf')],function(_0x595202){return{'model':db[_0x595202['model']],'as':_0x595202['as'],'attributes':_0x595202[_0xeb15('0x11')],'include':_0x595202[_0xeb15('0xf')]?_[_0xeb15('0x12')](_0x595202[_0xeb15('0xf')],function(_0x22bac8){return{'model':db[_0x22bac8['model']],'as':_0x22bac8['as'],'attributes':_0x22bac8[_0xeb15('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d344b){logger[_0xeb15('0x13')]('GetSquareProjects',_0x2e88d4);logger[_0xeb15('0x14')](_0xeb15('0x9'),_0x2e88d4,JSON[_0xeb15('0x15')](_0x5d344b));_0x429ad3(_0x5d344b);})['catch'](function(_0x4c853e){logger[_0xeb15('0x16')](_0xeb15('0x9'),_0x4c853e[_0xeb15('0x17')],_0x2e88d4);_0x360463(_0x5e59a5[_0xeb15('0x16')](0x1f4,_0x4c853e['message']));});});};exports[_0xeb15('0x18')]=function(_0x5247a4){var _0x1978a2=this;return new Promise(function(_0x8f824f,_0x4cf072){return db[_0xeb15('0x19')][_0xeb15('0x1a')]({'raw':_0x5247a4[_0xeb15('0xb')]?_0x5247a4[_0xeb15('0xb')][_0xeb15('0xc')]===undefined?!![]:![]:!![],'where':_0x5247a4[_0xeb15('0xb')]?_0x5247a4['options'][_0xeb15('0xd')]||null:null,'attributes':_0x5247a4[_0xeb15('0xb')]?_0x5247a4[_0xeb15('0xb')][_0xeb15('0x11')]||null:null,'include':_0x5247a4[_0xeb15('0xb')]?_0x5247a4['options']['include']?_['map'](_0x5247a4[_0xeb15('0xb')][_0xeb15('0xf')],function(_0x16e314){return{'model':db[_0x16e314[_0xeb15('0x10')]],'as':_0x16e314['as'],'attributes':_0x16e314['attributes'],'include':_0x16e314[_0xeb15('0xf')]?_[_0xeb15('0x12')](_0x16e314[_0xeb15('0xf')],function(_0x51a4b0){return{'model':db[_0x51a4b0[_0xeb15('0x10')]],'as':_0x51a4b0['as'],'attributes':_0x51a4b0[_0xeb15('0x11')],'include':_0x51a4b0[_0xeb15('0xf')]?_[_0xeb15('0x12')](_0x51a4b0[_0xeb15('0xf')],function(_0x1ec9c8){return{'model':db[_0x1ec9c8[_0xeb15('0x10')]],'as':_0x1ec9c8['as'],'attributes':_0x1ec9c8[_0xeb15('0x11')]};}):[]};}):[]};}):[]:[]})[_0xeb15('0x1b')](function(_0x4fa6c9){logger[_0xeb15('0x13')](_0xeb15('0x18'),_0x5247a4);logger[_0xeb15('0x14')](_0xeb15('0x18'),_0x5247a4,JSON[_0xeb15('0x15')](_0x4fa6c9));_0x8f824f(_0x4fa6c9);})[_0xeb15('0x1c')](function(_0x502d4c){logger[_0xeb15('0x16')]('ShowSquareProject',_0x502d4c[_0xeb15('0x17')],_0x5247a4);_0x4cf072(_0x1978a2[_0xeb15('0x16')](0x1f4,_0x502d4c['message']));});});}; \ No newline at end of file +var _0x23b9=['./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','where','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x5595bf,_0x1d95f4){var _0x3183d4=function(_0x3d9fd8){while(--_0x3d9fd8){_0x5595bf['push'](_0x5595bf['shift']());}};_0x3183d4(++_0x1d95f4);}(_0x23b9,0xbd));var _0x923b=function(_0x548e7a,_0x4584d1){_0x548e7a=_0x548e7a-0x0;var _0x17d602=_0x23b9[_0x548e7a];return _0x17d602;};'use strict';var _=require('lodash');var Redis=require(_0x923b('0x0'));var db=require(_0x923b('0x1'))['db'];var logger=require(_0x923b('0x2'))('rpc');var config=require(_0x923b('0x3'));config['redis']=_['defaults'](config[_0x923b('0x4')],{'host':_0x923b('0x5'),'port':0x18eb});var socket=require(_0x923b('0x6'))(new Redis(config[_0x923b('0x4')]));require(_0x923b('0x7'))[_0x923b('0x8')](socket);exports[_0x923b('0x9')]=function(_0x29fe6e){var _0x33995c=this;return new Promise(function(_0x47bfe8,_0x2c1fed){return db[_0x923b('0xa')][_0x923b('0xb')]({'raw':_0x29fe6e[_0x923b('0xc')]?_0x29fe6e[_0x923b('0xc')][_0x923b('0xd')]===undefined?!![]:![]:!![],'where':_0x29fe6e[_0x923b('0xc')]?_0x29fe6e[_0x923b('0xc')]['where']||null:null,'attributes':_0x29fe6e[_0x923b('0xc')]?_0x29fe6e[_0x923b('0xc')][_0x923b('0xe')]||null:null,'limit':_0x29fe6e['options']?_0x29fe6e[_0x923b('0xc')]['limit']||null:null,'include':_0x29fe6e[_0x923b('0xc')]?_0x29fe6e[_0x923b('0xc')][_0x923b('0xf')]?_[_0x923b('0x10')](_0x29fe6e['options']['include'],function(_0x28a8ef){return{'model':db[_0x28a8ef[_0x923b('0x11')]],'as':_0x28a8ef['as'],'attributes':_0x28a8ef['attributes'],'include':_0x28a8ef[_0x923b('0xf')]?_[_0x923b('0x10')](_0x28a8ef[_0x923b('0xf')],function(_0x15e6d4){return{'model':db[_0x15e6d4[_0x923b('0x11')]],'as':_0x15e6d4['as'],'attributes':_0x15e6d4[_0x923b('0xe')],'include':_0x15e6d4[_0x923b('0xf')]?_[_0x923b('0x10')](_0x15e6d4[_0x923b('0xf')],function(_0x499318){return{'model':db[_0x499318[_0x923b('0x11')]],'as':_0x499318['as'],'attributes':_0x499318[_0x923b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x923b('0x12')](function(_0x3c3c65){logger[_0x923b('0x13')](_0x923b('0x9'),_0x29fe6e);logger[_0x923b('0x14')]('GetSquareProjects',_0x29fe6e,JSON[_0x923b('0x15')](_0x3c3c65));_0x47bfe8(_0x3c3c65);})[_0x923b('0x16')](function(_0x1f1fdf){logger[_0x923b('0x17')](_0x923b('0x9'),_0x1f1fdf['message'],_0x29fe6e);_0x2c1fed(_0x33995c[_0x923b('0x17')](0x1f4,_0x1f1fdf[_0x923b('0x18')]));});});};exports[_0x923b('0x19')]=function(_0x45a4c5){var _0x5bb6d7=this;return new Promise(function(_0x3e51b0,_0x73b8b7){return db['SquareProject'][_0x923b('0x1a')]({'raw':_0x45a4c5['options']?_0x45a4c5[_0x923b('0xc')][_0x923b('0xd')]===undefined?!![]:![]:!![],'where':_0x45a4c5[_0x923b('0xc')]?_0x45a4c5[_0x923b('0xc')][_0x923b('0x1b')]||null:null,'attributes':_0x45a4c5['options']?_0x45a4c5[_0x923b('0xc')]['attributes']||null:null,'include':_0x45a4c5[_0x923b('0xc')]?_0x45a4c5['options'][_0x923b('0xf')]?_[_0x923b('0x10')](_0x45a4c5[_0x923b('0xc')][_0x923b('0xf')],function(_0x2677df){return{'model':db[_0x2677df[_0x923b('0x11')]],'as':_0x2677df['as'],'attributes':_0x2677df[_0x923b('0xe')],'include':_0x2677df['include']?_[_0x923b('0x10')](_0x2677df[_0x923b('0xf')],function(_0x3325d3){return{'model':db[_0x3325d3['model']],'as':_0x3325d3['as'],'attributes':_0x3325d3[_0x923b('0xe')],'include':_0x3325d3[_0x923b('0xf')]?_[_0x923b('0x10')](_0x3325d3[_0x923b('0xf')],function(_0x32f030){return{'model':db[_0x32f030[_0x923b('0x11')]],'as':_0x32f030['as'],'attributes':_0x32f030[_0x923b('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x261b51){logger[_0x923b('0x13')](_0x923b('0x19'),_0x45a4c5);logger[_0x923b('0x14')](_0x923b('0x19'),_0x45a4c5,JSON['stringify'](_0x261b51));_0x3e51b0(_0x261b51);})[_0x923b('0x16')](function(_0x4d1534){logger[_0x923b('0x17')](_0x923b('0x19'),_0x4d1534[_0x923b('0x18')],_0x45a4c5);_0x73b8b7(_0x5bb6d7[_0x923b('0x17')](0x1f4,_0x4d1534[_0x923b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fc13490..fab7c9e 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 _0x3f89=['length','squareProject:','./squareProject.events','save','remove','emit','removeListener','register'];(function(_0x3b27a2,_0x26be85){var _0x4d0878=function(_0x39925b){while(--_0x39925b){_0x3b27a2['push'](_0x3b27a2['shift']());}};_0x4d0878(++_0x26be85);}(_0x3f89,0x1e2));var _0x93f8=function(_0x34af2e,_0x5604a6){_0x34af2e=_0x34af2e-0x0;var _0x4dc837=_0x3f89[_0x34af2e];return _0x4dc837;};'use strict';var SquareProjectEvents=require(_0x93f8('0x0'));var events=[_0x93f8('0x1'),_0x93f8('0x2'),'update'];function createListener(_0x26fade,_0x3b644d){return function(_0x322214){_0x3b644d[_0x93f8('0x3')](_0x26fade,_0x322214);};}function removeListener(_0x1c5755,_0x56c3d2){return function(){SquareProjectEvents[_0x93f8('0x4')](_0x1c5755,_0x56c3d2);};}exports[_0x93f8('0x5')]=function(_0x2846e8){for(var _0x51aea7=0x0,_0x1e620d=events[_0x93f8('0x6')];_0x51aea7<_0x1e620d;_0x51aea7++){var _0xbafe01=events[_0x51aea7];var _0x263828=createListener(_0x93f8('0x7')+_0xbafe01,_0x2846e8);SquareProjectEvents['on'](_0xbafe01,_0x263828);}}; \ No newline at end of file +var _0x83e5=['removeListener','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x37e900,_0xcc0e40){var _0x2108d6=function(_0x1b251c){while(--_0x1b251c){_0x37e900['push'](_0x37e900['shift']());}};_0x2108d6(++_0xcc0e40);}(_0x83e5,0x106));var _0x583e=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x83e5[_0x146484];return _0x4c7aa3;};'use strict';var SquareProjectEvents=require(_0x583e('0x0'));var events=[_0x583e('0x1'),_0x583e('0x2'),_0x583e('0x3')];function createListener(_0x53ce7f,_0x269e12){return function(_0x2e42f5){_0x269e12['emit'](_0x53ce7f,_0x2e42f5);};}function removeListener(_0x43b24e,_0x171687){return function(){SquareProjectEvents[_0x583e('0x4')](_0x43b24e,_0x171687);};}exports['register']=function(_0xeaa230){for(var _0x191e7a=0x0,_0xcc1cd3=events[_0x583e('0x5')];_0x191e7a<_0xcc1cd3;_0x191e7a++){var _0x45d129=events[_0x191e7a];var _0x1d48ff=createListener(_0x583e('0x6')+_0x45d129,_0xeaa230);SquareProjectEvents['on'](_0x45d129,_0x1d48ff);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f9f1444..427b2f7 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x5095bf,_0x4f5aab){var _0x756dd1=function(_0x5e2e55){while(--_0x5e2e55){_0x5095bf['push'](_0x5095bf['shift']());}};_0x756dd1(++_0x4f5aab);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5fc3[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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(_0x3d31e7,_0x57e187){var _0x25c924=function(_0x5e5f12){while(--_0x5e5f12){_0x3d31e7['push'](_0x3d31e7['shift']());}};_0x25c924(++_0x57e187);}(_0x1cb9,0x14e));var _0x91cb=function(_0x51e0fa,_0x71d0c2){_0x51e0fa=_0x51e0fa-0x0;var _0x5b7d46=_0x1cb9[_0x51e0fa];return _0x5b7d46;};'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 32f1254..8cf0ac2 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 _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x2980b0,_0x375959){var _0x23b3de=function(_0x55608c){while(--_0x55608c){_0x2980b0['push'](_0x2980b0['shift']());}};_0x23b3de(++_0x375959);}(_0x31f0,0xb7));var _0x031f=function(_0x1c7b4b,_0x2ba3ce){_0x1c7b4b=_0x1c7b4b-0x0;var _0x30c2c9=_0x31f0[_0x1c7b4b];return _0x30c2c9;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file +var _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x1db125,_0x581090){var _0x3bc1c3=function(_0xced04c){while(--_0xced04c){_0x1db125['push'](_0x1db125['shift']());}};_0x3bc1c3(++_0x581090);}(_0xe14b,0x93));var _0xbe14=function(_0x307717,_0xb1c3e7){_0x307717=_0x307717-0x0;var _0x1dba86=_0xe14b[_0x307717];return _0x1dba86;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9900263..2653a21 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 _0x383b=['savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','extname','unlink','Not\x20found','destroy','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','SquareRecording','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','download','../../components/encryptor','uniqueid'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x383b,0x132));var _0xb383=function(_0x53a785,_0x49bc70){_0x53a785=_0x53a785-0x0;var _0x2d1d71=_0x383b[_0x53a785];return _0x2d1d71;};'use strict';var emlformat=require(_0xb383('0x0'));var rimraf=require(_0xb383('0x1'));var zipdir=require(_0xb383('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb383('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb383('0x4'));var util=require(_0xb383('0x5'));var path=require(_0xb383('0x6'));var sox=require(_0xb383('0x7'));var csv=require('to-csv');var ejs=require(_0xb383('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb383('0x9'));var crypto=require('crypto');var jsforce=require(_0xb383('0xa'));var deskjs=require(_0xb383('0xb'));var toCsv=require(_0xb383('0xc'));var querystring=require(_0xb383('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb383('0xe'));var qs=require(_0xb383('0xf'));var as=require(_0xb383('0x10'));var hardwareService=require(_0xb383('0x11'));var logger=require(_0xb383('0x12'))(_0xb383('0x13'));var utils=require(_0xb383('0x14'));var config=require(_0xb383('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb383('0x16'))['db'];function respondWithStatusCode(_0x2337a0,_0x4425e1){_0x4425e1=_0x4425e1||0xcc;return function(_0x5be548){if(_0x5be548){return _0x2337a0[_0xb383('0x17')](_0x4425e1);}return _0x2337a0[_0xb383('0x18')](_0x4425e1)['end']();};}function respondWithResult(_0x4a324c,_0x5542e1){_0x5542e1=_0x5542e1||0xc8;return function(_0x1b815a){if(_0x1b815a){return _0x4a324c[_0xb383('0x18')](_0x5542e1)['json'](_0x1b815a);}};}function respondWithFilteredResult(_0x516400,_0x356eff){return function(_0x272737){if(_0x272737){var _0x1cb49f=typeof _0x356eff[_0xb383('0x19')]===_0xb383('0x1a')&&typeof _0x356eff[_0xb383('0x1b')]===_0xb383('0x1a');var _0x5f339c=_0x272737[_0xb383('0x1c')];var _0xef8375=_0x1cb49f?0x0:_0x356eff[_0xb383('0x19')];var _0x3286f0=_0x1cb49f?_0x272737[_0xb383('0x1c')]:_0x356eff['offset']+_0x356eff[_0xb383('0x1b')];var _0x1209d2;if(_0x3286f0>=_0x5f339c){_0x3286f0=_0x5f339c;_0x1209d2=0xc8;}else{_0x1209d2=0xce;}_0x516400[_0xb383('0x18')](_0x1209d2);return _0x516400[_0xb383('0x1d')](_0xb383('0x1e'),_0xef8375+'-'+_0x3286f0+'/'+_0x5f339c)[_0xb383('0x1f')](_0x272737);}return null;};}function patchUpdates(_0x5ac224){return function(_0x551be2){try{jsonpatch[_0xb383('0x20')](_0x551be2,_0x5ac224,!![]);}catch(_0x98f194){return BPromise[_0xb383('0x21')](_0x98f194);}return _0x551be2[_0xb383('0x22')]();};}function saveUpdates(_0x5527f8,_0x1fbfe4){return function(_0xc24573){if(_0xc24573){return _0xc24573[_0xb383('0x23')](_0x5527f8)[_0xb383('0x24')](function(_0x453528){return _0x453528;});}return null;};}function removeEntity(_0x1568bb,_0x5ac813){return function(_0x247daf){if(_0x247daf){return _0x247daf['destroy']()[_0xb383('0x24')](function(){_0x1568bb[_0xb383('0x18')](0xcc)[_0xb383('0x25')]();});}};}function handleEntityNotFound(_0x3a0e93,_0x25bbab){return function(_0x4ee4f8){if(!_0x4ee4f8){_0x3a0e93[_0xb383('0x17')](0x194);}return _0x4ee4f8;};}function handleError(_0x1c3941,_0x120eb5){_0x120eb5=_0x120eb5||0x1f4;return function(_0x5c1458){logger[_0xb383('0x26')](_0x5c1458['stack']);if(_0x5c1458[_0xb383('0x27')]){delete _0x5c1458[_0xb383('0x27')];}_0x1c3941['status'](_0x120eb5)[_0xb383('0x28')](_0x5c1458);};}exports[_0xb383('0x29')]=function(_0x18d235,_0x9376c8){var _0x4f95c9={},_0x11cbb9={},_0x1abfc0={'count':0x0,'rows':[]};var _0x30bb91=_[_0xb383('0x2a')](db['SquareRecording']['rawAttributes'],function(_0x558c19){return{'name':_0x558c19[_0xb383('0x2b')],'type':_0x558c19['type'][_0xb383('0x2c')]};});_0x11cbb9['model']=_[_0xb383('0x2a')](_0x30bb91,'name');_0x11cbb9[_0xb383('0x2d')]=_[_0xb383('0x2e')](_0x18d235['query']);_0x11cbb9[_0xb383('0x2f')]=_[_0xb383('0x30')](_0x11cbb9[_0xb383('0x31')],_0x11cbb9[_0xb383('0x2d')]);_0x4f95c9[_0xb383('0x32')]=_[_0xb383('0x30')](_0x11cbb9[_0xb383('0x31')],qs[_0xb383('0x33')](_0x18d235[_0xb383('0x2d')][_0xb383('0x33')]));_0x4f95c9['attributes']=_0x4f95c9[_0xb383('0x32')][_0xb383('0x34')]?_0x4f95c9[_0xb383('0x32')]:_0x11cbb9[_0xb383('0x31')];if(!_0x18d235[_0xb383('0x2d')][_0xb383('0x35')](_0xb383('0x36'))){_0x4f95c9['limit']=qs['limit'](_0x18d235[_0xb383('0x2d')][_0xb383('0x1b')]);_0x4f95c9[_0xb383('0x19')]=qs[_0xb383('0x19')](_0x18d235[_0xb383('0x2d')][_0xb383('0x19')]);}_0x4f95c9[_0xb383('0x37')]=qs[_0xb383('0x38')](_0x18d235[_0xb383('0x2d')][_0xb383('0x38')]);_0x4f95c9[_0xb383('0x39')]=qs[_0xb383('0x2f')](_['pick'](_0x18d235['query'],_0x11cbb9[_0xb383('0x2f')]),_0x30bb91);if(_0x18d235[_0xb383('0x2d')][_0xb383('0x3a')]){_0x4f95c9[_0xb383('0x39')]=_[_0xb383('0x3b')](_0x4f95c9['where'],{'$or':_[_0xb383('0x2a')](_0x30bb91,function(_0x14937b){if(_0x14937b[_0xb383('0x3c')]!==_0xb383('0x3d')){var _0x226007={};_0x226007[_0x14937b[_0xb383('0x27')]]={'$like':'%'+_0x18d235['query'][_0xb383('0x3a')]+'%'};return _0x226007;}})});}_0x4f95c9=_['merge']({},_0x4f95c9,_0x18d235[_0xb383('0x3e')]);var _0x2407c0={'where':_0x4f95c9[_0xb383('0x39')]};return db['SquareRecording'][_0xb383('0x1c')](_0x2407c0)[_0xb383('0x24')](function(_0x314f06){_0x1abfc0[_0xb383('0x1c')]=_0x314f06;if(_0x18d235['query'][_0xb383('0x3f')]){_0x4f95c9['include']=[{'all':!![]}];}return db[_0xb383('0x40')][_0xb383('0x41')](_0x4f95c9);})[_0xb383('0x24')](function(_0x1ce916){_0x1abfc0[_0xb383('0x42')]=_0x1ce916;return _0x1abfc0;})[_0xb383('0x24')](respondWithFilteredResult(_0x9376c8,_0x4f95c9))[_0xb383('0x43')](handleError(_0x9376c8,null));};exports[_0xb383('0x44')]=function(_0x1f9650,_0x290aca){var _0x8c881c={'raw':!![],'where':{'id':_0x1f9650['params']['id']}},_0x2ba773={};_0x2ba773[_0xb383('0x31')]=_['keys'](db[_0xb383('0x40')][_0xb383('0x45')]);_0x2ba773[_0xb383('0x2d')]=_[_0xb383('0x2e')](_0x1f9650['query']);_0x2ba773[_0xb383('0x2f')]=_[_0xb383('0x30')](_0x2ba773[_0xb383('0x31')],_0x2ba773[_0xb383('0x2d')]);_0x8c881c[_0xb383('0x32')]=_[_0xb383('0x30')](_0x2ba773['model'],qs[_0xb383('0x33')](_0x1f9650['query'][_0xb383('0x33')]));_0x8c881c['attributes']=_0x8c881c[_0xb383('0x32')][_0xb383('0x34')]?_0x8c881c['attributes']:_0x2ba773[_0xb383('0x31')];if(_0x1f9650[_0xb383('0x2d')][_0xb383('0x3f')]){_0x8c881c[_0xb383('0x46')]=[{'all':!![]}];}_0x8c881c=_[_0xb383('0x3b')]({},_0x8c881c,_0x1f9650['options']);return db[_0xb383('0x40')][_0xb383('0x47')](_0x8c881c)[_0xb383('0x24')](handleEntityNotFound(_0x290aca,null))[_0xb383('0x24')](respondWithResult(_0x290aca,null))[_0xb383('0x43')](handleError(_0x290aca,null));};exports[_0xb383('0x48')]=function(_0x4bc4f0,_0x240ba1){return db['SquareRecording'][_0xb383('0x48')](_0x4bc4f0[_0xb383('0x49')],{})[_0xb383('0x24')](respondWithResult(_0x240ba1,0xc9))[_0xb383('0x43')](handleError(_0x240ba1,null));};exports[_0xb383('0x23')]=function(_0x5949bd,_0x5d0ad0){if(_0x5949bd[_0xb383('0x49')]['id']){delete _0x5949bd[_0xb383('0x49')]['id'];}return db['SquareRecording'][_0xb383('0x47')]({'where':{'id':_0x5949bd[_0xb383('0x4a')]['id']}})[_0xb383('0x24')](handleEntityNotFound(_0x5d0ad0,null))[_0xb383('0x24')](saveUpdates(_0x5949bd[_0xb383('0x49')],null))[_0xb383('0x24')](respondWithResult(_0x5d0ad0,null))[_0xb383('0x43')](handleError(_0x5d0ad0,null));};exports[_0xb383('0x4b')]=function(_0x225833,_0x5ed64e,_0x392ab2){var _0x427da0=require(_0xb383('0x4c'));var _0x4385b3=![];var _0x5e75f4={};if(_0x225833[_0xb383('0x2d')][_0xb383('0x3c')]&&_0x225833[_0xb383('0x2d')]['type']===_0xb383('0x4d')){_0x5e75f4[_0xb383('0x4d')]=_0x225833[_0xb383('0x4a')]['id'];}else{_0x5e75f4['id']=_0x225833[_0xb383('0x4a')]['id'];}return db[_0xb383('0x40')][_0xb383('0x47')]({'where':_0x5e75f4,'attributes':['id',_0xb383('0x4e'),_0xb383('0x4f')],'raw':!![]})[_0xb383('0x24')](handleEntityNotFound(_0x5ed64e,null))['then'](function(_0x2df1f3){if(_0x2df1f3){var _0x31cc1b=_0x2df1f3[_0xb383('0x4e')];var _0x476bb4=util[_0xb383('0x50')](_0xb383('0x51'),_0x31cc1b);if(fs[_0xb383('0x52')](_0x476bb4)){_0x4385b3=!![];return _0x427da0['decryptFile'](_0x476bb4,_0x31cc1b,config['secrets'][_0xb383('0x53')])[_0xb383('0x24')](function(){return _0x2df1f3;});}return _0x2df1f3;}})[_0xb383('0x24')](function(_0x3f3b14){if(_0x3f3b14){var _0x3f0eed=_0x3f3b14[_0xb383('0x4e')];if(!fs['existsSync'](_0x3f0eed)){throw new db[(_0xb383('0x54'))][(_0xb383('0x55'))]('SquareRecording\x20not\x20found');}if(_0x3f3b14[_0xb383('0x4f')]){return _0x5ed64e[_0xb383('0x4b')](_0x3f0eed,_0x3f3b14[_0xb383('0x4f')]+path[_0xb383('0x56')](_0x3f0eed),function(){if(_0x4385b3){fs[_0xb383('0x57')](_0x3f0eed);}});}else{return _0x5ed64e['download'](_0x3f0eed,function(_0x112ba5){if(_0x4385b3){fs['unlink'](_0x3f0eed);}});}}})[_0xb383('0x43')](function(_0x25b183){if(_0x25b183['message']==='SquareRecording\x20not\x20found'){_0x5ed64e[_0xb383('0x18')](0x194)[_0xb383('0x28')](_0xb383('0x58'));}else{return handleError(_0x5ed64e,null);}});};exports[_0xb383('0x59')]=function(_0x2e5953,_0x300118){return db[_0xb383('0x40')][_0xb383('0x47')]({'where':{'id':_0x2e5953[_0xb383('0x4a')]['id']}})[_0xb383('0x24')](function(_0x420f8b){if(_['isNil'](_0x420f8b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x420f8b;})[_0xb383('0x24')](function(_0x417693){var _0x1f74ab=_0x417693['savePath'];logger[_0xb383('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f74ab);if(!_['isNil'](_0x417693[_0xb383('0x4e')])&&fs[_0xb383('0x52')](_0x1f74ab)){logger['info'](_0xb383('0x5b')+_0x1f74ab+_0xb383('0x5c'));fs[_0xb383('0x5d')](_0x1f74ab);}_0x1f74ab=_0x1f74ab+_0xb383('0x5e');if(!_[_0xb383('0x5f')](_0x417693[_0xb383('0x4e')])&&fs['existsSync'](_0x1f74ab)){logger[_0xb383('0x5a')]('File:\x20\x22'+_0x1f74ab+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb383('0x5d')](_0x1f74ab);}return _0x417693;})['then'](function(_0x330e9c){if(!_0x330e9c)throw new InternalError();return _0x330e9c['destroy']();})['then'](function(){_0x300118[_0xb383('0x18')](0xcc)[_0xb383('0x25')]();})[_0xb383('0x43')](handleError(_0x300118,null));}; \ No newline at end of file +var _0x99c1=['then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','update'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x99c1,0xa1));var _0x199c=function(_0x36922d,_0x365651){_0x36922d=_0x36922d-0x0;var _0x38b3c8=_0x99c1[_0x36922d];return _0x38b3c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x199c('0x0'));var zipdir=require(_0x199c('0x1'));var jsonpatch=require(_0x199c('0x2'));var rp=require(_0x199c('0x3'));var moment=require(_0x199c('0x4'));var BPromise=require(_0x199c('0x5'));var Mustache=require(_0x199c('0x6'));var util=require(_0x199c('0x7'));var path=require(_0x199c('0x8'));var sox=require(_0x199c('0x9'));var csv=require('to-csv');var ejs=require(_0x199c('0xa'));var fs=require('fs');var fs_extra=require(_0x199c('0xb'));var _=require(_0x199c('0xc'));var squel=require('squel');var crypto=require(_0x199c('0xd'));var jsforce=require(_0x199c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x199c('0xf'));var querystring=require(_0x199c('0x10'));var Papa=require(_0x199c('0x11'));var Redis=require(_0x199c('0x12'));var authService=require(_0x199c('0x13'));var qs=require(_0x199c('0x14'));var as=require(_0x199c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x199c('0x16'))(_0x199c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x199c('0x18'));var db=require(_0x199c('0x19'))['db'];function respondWithStatusCode(_0x352969,_0x3ba79f){_0x3ba79f=_0x3ba79f||0xcc;return function(_0x33e94c){if(_0x33e94c){return _0x352969[_0x199c('0x1a')](_0x3ba79f);}return _0x352969[_0x199c('0x1b')](_0x3ba79f)[_0x199c('0x1c')]();};}function respondWithResult(_0xdf3555,_0x6d1bce){_0x6d1bce=_0x6d1bce||0xc8;return function(_0x4d2a42){if(_0x4d2a42){return _0xdf3555[_0x199c('0x1b')](_0x6d1bce)['json'](_0x4d2a42);}};}function respondWithFilteredResult(_0x203a2e,_0x55fa6e){return function(_0x3a8f1e){if(_0x3a8f1e){var _0x5ef49c=typeof _0x55fa6e[_0x199c('0x1d')]==='undefined'&&typeof _0x55fa6e[_0x199c('0x1e')]==='undefined';var _0x1baca8=_0x3a8f1e[_0x199c('0x1f')];var _0x5b611c=_0x5ef49c?0x0:_0x55fa6e[_0x199c('0x1d')];var _0x514cee=_0x5ef49c?_0x3a8f1e[_0x199c('0x1f')]:_0x55fa6e[_0x199c('0x1d')]+_0x55fa6e['limit'];var _0x1b5bff;if(_0x514cee>=_0x1baca8){_0x514cee=_0x1baca8;_0x1b5bff=0xc8;}else{_0x1b5bff=0xce;}_0x203a2e[_0x199c('0x1b')](_0x1b5bff);return _0x203a2e[_0x199c('0x20')](_0x199c('0x21'),_0x5b611c+'-'+_0x514cee+'/'+_0x1baca8)[_0x199c('0x22')](_0x3a8f1e);}return null;};}function patchUpdates(_0x583620){return function(_0x546fd7){try{jsonpatch['apply'](_0x546fd7,_0x583620,!![]);}catch(_0x305f04){return BPromise[_0x199c('0x23')](_0x305f04);}return _0x546fd7['save']();};}function saveUpdates(_0x354533,_0x4e6b67){return function(_0xcb8725){if(_0xcb8725){return _0xcb8725[_0x199c('0x24')](_0x354533)[_0x199c('0x25')](function(_0xb9f2c7){return _0xb9f2c7;});}return null;};}function removeEntity(_0x36a54a,_0x965df9){return function(_0x5a6409){if(_0x5a6409){return _0x5a6409[_0x199c('0x26')]()[_0x199c('0x25')](function(){_0x36a54a['status'](0xcc)[_0x199c('0x1c')]();});}};}function handleEntityNotFound(_0x15169e,_0xd6a93a){return function(_0xea377d){if(!_0xea377d){_0x15169e[_0x199c('0x1a')](0x194);}return _0xea377d;};}function handleError(_0x5837f1,_0x574b3f){_0x574b3f=_0x574b3f||0x1f4;return function(_0x1e607b){logger[_0x199c('0x27')](_0x1e607b[_0x199c('0x28')]);if(_0x1e607b[_0x199c('0x29')]){delete _0x1e607b['name'];}_0x5837f1['status'](_0x574b3f)[_0x199c('0x2a')](_0x1e607b);};}exports[_0x199c('0x2b')]=function(_0x564eb8,_0x20113d){var _0x1c74e0={},_0x2b8787={},_0x5e3d2a={'count':0x0,'rows':[]};var _0x1d1d86=_[_0x199c('0x2c')](db[_0x199c('0x2d')][_0x199c('0x2e')],function(_0x3ee6bf){return{'name':_0x3ee6bf[_0x199c('0x2f')],'type':_0x3ee6bf['type'][_0x199c('0x30')]};});_0x2b8787['model']=_[_0x199c('0x2c')](_0x1d1d86,_0x199c('0x29'));_0x2b8787[_0x199c('0x31')]=_[_0x199c('0x32')](_0x564eb8['query']);_0x2b8787['filters']=_[_0x199c('0x33')](_0x2b8787[_0x199c('0x34')],_0x2b8787[_0x199c('0x31')]);_0x1c74e0[_0x199c('0x35')]=_[_0x199c('0x33')](_0x2b8787[_0x199c('0x34')],qs[_0x199c('0x36')](_0x564eb8['query']['fields']));_0x1c74e0[_0x199c('0x35')]=_0x1c74e0[_0x199c('0x35')][_0x199c('0x37')]?_0x1c74e0[_0x199c('0x35')]:_0x2b8787[_0x199c('0x34')];if(!_0x564eb8[_0x199c('0x31')][_0x199c('0x38')](_0x199c('0x39'))){_0x1c74e0[_0x199c('0x1e')]=qs['limit'](_0x564eb8[_0x199c('0x31')][_0x199c('0x1e')]);_0x1c74e0[_0x199c('0x1d')]=qs[_0x199c('0x1d')](_0x564eb8[_0x199c('0x31')]['offset']);}_0x1c74e0[_0x199c('0x3a')]=qs['sort'](_0x564eb8[_0x199c('0x31')][_0x199c('0x3b')]);_0x1c74e0[_0x199c('0x3c')]=qs[_0x199c('0x3d')](_[_0x199c('0x3e')](_0x564eb8[_0x199c('0x31')],_0x2b8787[_0x199c('0x3d')]),_0x1d1d86);if(_0x564eb8[_0x199c('0x31')][_0x199c('0x3f')]){_0x1c74e0[_0x199c('0x3c')]=_['merge'](_0x1c74e0['where'],{'$or':_[_0x199c('0x2c')](_0x1d1d86,function(_0x249e42){if(_0x249e42[_0x199c('0x40')]!==_0x199c('0x41')){var _0xd435f8={};_0xd435f8[_0x249e42['name']]={'$like':'%'+_0x564eb8['query'][_0x199c('0x3f')]+'%'};return _0xd435f8;}})});}_0x1c74e0=_[_0x199c('0x42')]({},_0x1c74e0,_0x564eb8[_0x199c('0x43')]);var _0x4f748e={'where':_0x1c74e0[_0x199c('0x3c')]};return db[_0x199c('0x2d')][_0x199c('0x1f')](_0x4f748e)[_0x199c('0x25')](function(_0x1c15b0){_0x5e3d2a[_0x199c('0x1f')]=_0x1c15b0;if(_0x564eb8[_0x199c('0x31')][_0x199c('0x44')]){_0x1c74e0['include']=[{'all':!![]}];}return db[_0x199c('0x2d')][_0x199c('0x45')](_0x1c74e0);})[_0x199c('0x25')](function(_0x14e24d){_0x5e3d2a[_0x199c('0x46')]=_0x14e24d;return _0x5e3d2a;})[_0x199c('0x25')](respondWithFilteredResult(_0x20113d,_0x1c74e0))[_0x199c('0x47')](handleError(_0x20113d,null));};exports['show']=function(_0x58d1f8,_0x206d94){var _0x1a9f6f={'raw':!![],'where':{'id':_0x58d1f8[_0x199c('0x48')]['id']}},_0x329367={};_0x329367['model']=_['keys'](db[_0x199c('0x2d')]['rawAttributes']);_0x329367['query']=_[_0x199c('0x32')](_0x58d1f8[_0x199c('0x31')]);_0x329367[_0x199c('0x3d')]=_[_0x199c('0x33')](_0x329367[_0x199c('0x34')],_0x329367['query']);_0x1a9f6f['attributes']=_[_0x199c('0x33')](_0x329367['model'],qs['fields'](_0x58d1f8[_0x199c('0x31')][_0x199c('0x36')]));_0x1a9f6f[_0x199c('0x35')]=_0x1a9f6f['attributes'][_0x199c('0x37')]?_0x1a9f6f[_0x199c('0x35')]:_0x329367[_0x199c('0x34')];if(_0x58d1f8[_0x199c('0x31')][_0x199c('0x44')]){_0x1a9f6f['include']=[{'all':!![]}];}_0x1a9f6f=_[_0x199c('0x42')]({},_0x1a9f6f,_0x58d1f8[_0x199c('0x43')]);return db['SquareRecording'][_0x199c('0x49')](_0x1a9f6f)['then'](handleEntityNotFound(_0x206d94,null))[_0x199c('0x25')](respondWithResult(_0x206d94,null))[_0x199c('0x47')](handleError(_0x206d94,null));};exports[_0x199c('0x4a')]=function(_0x1806ea,_0x4f59d1){return db[_0x199c('0x2d')][_0x199c('0x4a')](_0x1806ea[_0x199c('0x4b')],{})[_0x199c('0x25')](respondWithResult(_0x4f59d1,0xc9))[_0x199c('0x47')](handleError(_0x4f59d1,null));};exports[_0x199c('0x24')]=function(_0x154557,_0x1999f5){if(_0x154557[_0x199c('0x4b')]['id']){delete _0x154557['body']['id'];}return db[_0x199c('0x2d')][_0x199c('0x49')]({'where':{'id':_0x154557[_0x199c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1999f5,null))['then'](saveUpdates(_0x154557[_0x199c('0x4b')],null))[_0x199c('0x25')](respondWithResult(_0x1999f5,null))[_0x199c('0x47')](handleError(_0x1999f5,null));};exports[_0x199c('0x4c')]=function(_0x4b294b,_0x1131c6,_0x39651d){var _0x3a312b=require(_0x199c('0x4d'));var _0x58781c=![];var _0x4ecf3f={};if(_0x4b294b[_0x199c('0x31')]['type']&&_0x4b294b[_0x199c('0x31')][_0x199c('0x40')]==='uniqueid'){_0x4ecf3f[_0x199c('0x4e')]=_0x4b294b[_0x199c('0x48')]['id'];}else{_0x4ecf3f['id']=_0x4b294b[_0x199c('0x48')]['id'];}return db[_0x199c('0x2d')][_0x199c('0x49')]({'where':_0x4ecf3f,'attributes':['id',_0x199c('0x4f'),_0x199c('0x50')],'raw':!![]})[_0x199c('0x25')](handleEntityNotFound(_0x1131c6,null))[_0x199c('0x25')](function(_0x382c2e){if(_0x382c2e){var _0x23b531=_0x382c2e['savePath'];var _0x3c99af=util['format'](_0x199c('0x51'),_0x23b531);if(fs[_0x199c('0x52')](_0x3c99af)){_0x58781c=!![];return _0x3a312b[_0x199c('0x53')](_0x3c99af,_0x23b531,config[_0x199c('0x54')][_0x199c('0x55')])[_0x199c('0x25')](function(){return _0x382c2e;});}return _0x382c2e;}})[_0x199c('0x25')](function(_0xbed156){if(_0xbed156){var _0x4f4c5e=_0xbed156[_0x199c('0x4f')];if(!fs[_0x199c('0x52')](_0x4f4c5e)){throw new db[(_0x199c('0x56'))][(_0x199c('0x57'))](_0x199c('0x58'));}if(_0xbed156[_0x199c('0x50')]){return _0x1131c6[_0x199c('0x4c')](_0x4f4c5e,_0xbed156[_0x199c('0x50')]+path[_0x199c('0x59')](_0x4f4c5e),function(){if(_0x58781c){fs[_0x199c('0x5a')](_0x4f4c5e);}});}else{return _0x1131c6['download'](_0x4f4c5e,function(_0x3ce62b){if(_0x58781c){fs[_0x199c('0x5a')](_0x4f4c5e);}});}}})[_0x199c('0x47')](function(_0x258c26){if(_0x258c26[_0x199c('0x5b')]===_0x199c('0x58')){_0x1131c6[_0x199c('0x1b')](0x194)[_0x199c('0x2a')](_0x199c('0x5c'));}else{return handleError(_0x1131c6,null);}});};exports['destroy']=function(_0x414c1a,_0xaac02b){return db[_0x199c('0x2d')][_0x199c('0x49')]({'where':{'id':_0x414c1a[_0x199c('0x48')]['id']}})[_0x199c('0x25')](function(_0x916800){if(_[_0x199c('0x5d')](_0x916800)){throw new ReferenceError(_0x199c('0x5e'));}return _0x916800;})[_0x199c('0x25')](function(_0x15cc7e){var _0x1eea00=_0x15cc7e[_0x199c('0x4f')];logger[_0x199c('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x1eea00);if(!_['isNil'](_0x15cc7e[_0x199c('0x4f')])&&fs[_0x199c('0x52')](_0x1eea00)){logger['info']('File:\x20\x22'+_0x1eea00+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1eea00);}_0x1eea00=_0x1eea00+_0x199c('0x60');if(!_['isNil'](_0x15cc7e[_0x199c('0x4f')])&&fs['existsSync'](_0x1eea00)){logger[_0x199c('0x5f')]('File:\x20\x22'+_0x1eea00+_0x199c('0x61'));fs[_0x199c('0x62')](_0x1eea00);}return _0x15cc7e;})[_0x199c('0x25')](function(_0x4e395a){if(!_0x4e395a)throw new InternalError();return _0x4e395a[_0x199c('0x26')]();})[_0x199c('0x25')](function(){_0xaac02b[_0x199c('0x1b')](0xcc)[_0x199c('0x1c')]();})['catch'](handleError(_0xaac02b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9c055a0..49b0e5f 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 _0x2515=['rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3086c8,_0x5d1940){var _0x26ff3c=function(_0x9e553e){while(--_0x9e553e){_0x3086c8['push'](_0x3086c8['shift']());}};_0x26ff3c(++_0x5d1940);}(_0x2515,0x1c2));var _0x5251=function(_0x199b64,_0x5d1120){_0x199b64=_0x199b64-0x0;var _0x42b220=_0x2515[_0x199b64];return _0x42b220;};'use strict';var _=require(_0x5251('0x0'));var util=require(_0x5251('0x1'));var logger=require('../../config/logger')(_0x5251('0x2'));var moment=require(_0x5251('0x3'));var BPromise=require(_0x5251('0x4'));var rp=require(_0x5251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5251('0x6'));var config=require(_0x5251('0x7'));var attributes=require('./squareRecording.attributes');module[_0x5251('0x8')]=function(_0xa2b768,_0x228dcd){return _0xa2b768[_0x5251('0x9')](_0x5251('0xa'),attributes,{'tableName':_0x5251('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5f9=['rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1aa4c8,_0x59ed2d){var _0x16df98=function(_0x545dfe){while(--_0x545dfe){_0x1aa4c8['push'](_0x1aa4c8['shift']());}};_0x16df98(++_0x59ed2d);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x51f40e,_0x14e8ea){_0x51f40e=_0x51f40e-0x0;var _0xb37761=_0xd5f9[_0x51f40e];return _0xb37761;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var logger=require(_0x9d5f('0x2'))(_0x9d5f('0x3'));var moment=require('moment');var BPromise=require(_0x9d5f('0x4'));var rp=require(_0x9d5f('0x5'));var fs=require('fs');var path=require(_0x9d5f('0x6'));var rimraf=require(_0x9d5f('0x7'));var config=require(_0x9d5f('0x8'));var attributes=require(_0x9d5f('0x9'));module['exports']=function(_0x546c04,_0x58edae){return _0x546c04[_0x9d5f('0xa')](_0x9d5f('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 67152d3..a14d83f 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 _0x5ce3=['util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','SquareRecording','create','body','options','then','CreateSquareRecording','catch','lodash'];(function(_0x30ffc1,_0x556cd6){var _0x586b40=function(_0x2b0bed){while(--_0x2b0bed){_0x30ffc1['push'](_0x30ffc1['shift']());}};_0x586b40(++_0x556cd6);}(_0x5ce3,0x16b));var _0x35ce=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x5ce3[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require(_0x35ce('0x0'));var util=require(_0x35ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35ce('0x3'));var logger=require('../../config/logger')(_0x35ce('0x4'));var config=require(_0x35ce('0x5'));var jayson=require(_0x35ce('0x6'));var client=jayson[_0x35ce('0x7')][_0x35ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59cf56,_0x11be78,_0x65cc7d){return new BPromise(function(_0x87b92c,_0x5bac95){return client[_0x35ce('0x9')](_0x59cf56,_0x65cc7d)['then'](function(_0x475b0f){logger[_0x35ce('0xa')]('SquareRecording,\x20%s,\x20%s',_0x11be78,_0x35ce('0xb'));logger[_0x35ce('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x11be78,_0x35ce('0xb'),JSON[_0x35ce('0xd')](_0x475b0f));if(_0x475b0f['error']){if(_0x475b0f[_0x35ce('0xe')][_0x35ce('0xf')]===0x1f4){logger[_0x35ce('0xe')](_0x35ce('0x10'),_0x11be78,_0x475b0f[_0x35ce('0xe')][_0x35ce('0x11')]);return _0x5bac95(_0x475b0f[_0x35ce('0xe')][_0x35ce('0x11')]);}logger[_0x35ce('0xe')](_0x35ce('0x10'),_0x11be78,_0x475b0f[_0x35ce('0xe')][_0x35ce('0x11')]);return _0x87b92c(_0x475b0f['error']['message']);}else{logger['info'](_0x35ce('0x10'),_0x11be78,'request\x20sent');_0x87b92c(_0x475b0f[_0x35ce('0x12')]['message']);}})['catch'](function(_0x4a405a){logger[_0x35ce('0xe')](_0x35ce('0x10'),_0x11be78,_0x4a405a);_0x5bac95(_0x4a405a);});});}exports['CreateSquareRecording']=function(_0x54676a){var _0x2df43d=this;return new Promise(function(_0x2d2bd4,_0x5a3a6f){return db[_0x35ce('0x13')][_0x35ce('0x14')](_0x54676a[_0x35ce('0x15')],{'raw':_0x54676a[_0x35ce('0x16')]?_0x54676a[_0x35ce('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x35ce('0x17')](function(_0x2cf8b7){logger[_0x35ce('0xa')](_0x35ce('0x18'),_0x54676a);logger['debug'](_0x35ce('0x18'),_0x54676a,JSON[_0x35ce('0xd')](_0x2cf8b7));_0x2d2bd4(_0x2cf8b7);})[_0x35ce('0x19')](function(_0x5e6ba2){logger['error'](_0x35ce('0x18'),_0x5e6ba2[_0x35ce('0x11')],_0x54676a);_0x5a3a6f(_0x2df43d['error'](0x1f4,_0x5e6ba2[_0x35ce('0x11')]));});});}; \ No newline at end of file +var _0xa2e4=['client','http','request','info','request\x20sent','debug','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','create','body','options','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xa2e4,0x197));var _0x4a2e=function(_0x1993d4,_0x19d988){_0x1993d4=_0x1993d4-0x0;var _0x12b9ab=_0xa2e4[_0x1993d4];return _0x12b9ab;};'use strict';var _=require(_0x4a2e('0x0'));var util=require(_0x4a2e('0x1'));var moment=require('moment');var BPromise=require(_0x4a2e('0x2'));var rs=require(_0x4a2e('0x3'));var fs=require('fs');var Redis=require(_0x4a2e('0x4'));var db=require(_0x4a2e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a2e('0x6'))(_0x4a2e('0x7'));var config=require(_0x4a2e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a2e('0x9')][_0x4a2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e9647,_0x3e9574,_0x20381a){return new BPromise(function(_0x46ea31,_0x4540da){return client[_0x4a2e('0xb')](_0x2e9647,_0x20381a)['then'](function(_0x2a4fd5){logger[_0x4a2e('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3e9574,_0x4a2e('0xd'));logger[_0x4a2e('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3e9574,_0x4a2e('0xd'),JSON[_0x4a2e('0xf')](_0x2a4fd5));if(_0x2a4fd5[_0x4a2e('0x10')]){if(_0x2a4fd5['error']['code']===0x1f4){logger[_0x4a2e('0x10')](_0x4a2e('0x11'),_0x3e9574,_0x2a4fd5[_0x4a2e('0x10')][_0x4a2e('0x12')]);return _0x4540da(_0x2a4fd5[_0x4a2e('0x10')][_0x4a2e('0x12')]);}logger[_0x4a2e('0x10')](_0x4a2e('0x11'),_0x3e9574,_0x2a4fd5[_0x4a2e('0x10')][_0x4a2e('0x12')]);return _0x46ea31(_0x2a4fd5[_0x4a2e('0x10')][_0x4a2e('0x12')]);}else{logger[_0x4a2e('0xc')](_0x4a2e('0x11'),_0x3e9574,_0x4a2e('0xd'));_0x46ea31(_0x2a4fd5[_0x4a2e('0x13')]['message']);}})[_0x4a2e('0x14')](function(_0x4fe67b){logger['error'](_0x4a2e('0x11'),_0x3e9574,_0x4fe67b);_0x4540da(_0x4fe67b);});});}exports[_0x4a2e('0x15')]=function(_0x5f435b){var _0x4a3890=this;return new Promise(function(_0x31f8aa,_0x89a204){return db['SquareRecording'][_0x4a2e('0x16')](_0x5f435b[_0x4a2e('0x17')],{'raw':_0x5f435b['options']?_0x5f435b[_0x4a2e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4a2e('0x19')](function(_0x3c20da){logger['info'](_0x4a2e('0x15'),_0x5f435b);logger['debug'](_0x4a2e('0x15'),_0x5f435b,JSON[_0x4a2e('0xf')](_0x3c20da));_0x31f8aa(_0x3c20da);})[_0x4a2e('0x14')](function(_0x352bbf){logger[_0x4a2e('0x10')](_0x4a2e('0x15'),_0x352bbf[_0x4a2e('0x12')],_0x5f435b);_0x89a204(_0x4a3890[_0x4a2e('0x10')](0x1f4,_0x352bbf[_0x4a2e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a6dd7cd..30c0528 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x85ea04,_0x2dcc1d){var _0x1b6c94=function(_0x432f35){while(--_0x432f35){_0x85ea04['push'](_0x85ea04['shift']());}};_0x1b6c94(++_0x2dcc1d);}(_0xe706,0xa3));var _0x6e70=function(_0x200ced,_0x503efa){_0x200ced=_0x200ced-0x0;var _0x28e175=_0xe706[_0x200ced];return _0x28e175;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index bc5242b..6211409 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 _0x758a=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x5a74f5,_0x51f826){var _0x1cedc8=function(_0x298635){while(--_0x298635){_0x5a74f5['push'](_0x5a74f5['shift']());}};_0x1cedc8(++_0x51f826);}(_0x758a,0x179));var _0xa758=function(_0x3496e8,_0x1c9de9){_0x3496e8=_0x3496e8-0x0;var _0x3ee1c6=_0x758a[_0x3496e8];return _0x3ee1c6;};'use strict';var Sequelize=require(_0xa758('0x0'));module[_0xa758('0x1')]={'network':{'type':Sequelize[_0xa758('0x2')]},'network_script':{'type':Sequelize[_0xa758('0x2')]},'request':{'type':Sequelize[_0xa758('0x2')]},'channel':{'type':Sequelize[_0xa758('0x2')]},'language':{'type':Sequelize[_0xa758('0x2')]},'type':{'type':Sequelize[_0xa758('0x2')]},'uniqueid':{'type':Sequelize[_0xa758('0x2')]},'version':{'type':Sequelize[_0xa758('0x2')]},'callerid':{'type':Sequelize[_0xa758('0x2')]},'calleridname':{'type':Sequelize[_0xa758('0x2')]},'callingpres':{'type':Sequelize[_0xa758('0x2')]},'callingani2':{'type':Sequelize[_0xa758('0x2')]},'callington':{'type':Sequelize[_0xa758('0x2')]},'callingtns':{'type':Sequelize[_0xa758('0x2')]},'dnid':{'type':Sequelize[_0xa758('0x2')]},'rdnis':{'type':Sequelize[_0xa758('0x2')]},'context':{'type':Sequelize[_0xa758('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa758('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa758('0x2')]},'threadid':{'type':Sequelize[_0xa758('0x2')]},'project_name':{'type':Sequelize[_0xa758('0x2')]},'joinAt':{'type':Sequelize[_0xa758('0x3')]},'leaveAt':{'type':Sequelize[_0xa758('0x3')]},'bot':{'type':Sequelize[_0xa758('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x32d3=['DATE','sequelize','STRING'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x32d3,0xee));var _0x332d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32d3[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x332d('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x332d('0x1')]},'language':{'type':Sequelize[_0x332d('0x1')]},'type':{'type':Sequelize[_0x332d('0x1')]},'uniqueid':{'type':Sequelize[_0x332d('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x332d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x332d('0x1')]},'callingani2':{'type':Sequelize[_0x332d('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x332d('0x1')]},'rdnis':{'type':Sequelize[_0x332d('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x332d('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x332d('0x1')]},'accountcode':{'type':Sequelize[_0x332d('0x1')]},'threadid':{'type':Sequelize[_0x332d('0x1')]},'project_name':{'type':Sequelize[_0x332d('0x1')]},'joinAt':{'type':Sequelize[_0x332d('0x2')]},'leaveAt':{'type':Sequelize[_0x332d('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ee24e17..f4c7c42 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 _0xe8fa=['fields','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','stack','index','map','SquareReport','rawAttributes','type','key','name','query','filters','intersection','model','attributes'];(function(_0x42e6c0,_0x58355a){var _0x19ff2a=function(_0x446902){while(--_0x446902){_0x42e6c0['push'](_0x42e6c0['shift']());}};_0x19ff2a(++_0x58355a);}(_0xe8fa,0x135));var _0xae8f=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xe8fa[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0xae8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae8f('0x2'));var moment=require(_0xae8f('0x3'));var BPromise=require(_0xae8f('0x4'));var Mustache=require(_0xae8f('0x5'));var util=require(_0xae8f('0x6'));var path=require(_0xae8f('0x7'));var sox=require('sox');var csv=require(_0xae8f('0x8'));var ejs=require(_0xae8f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae8f('0xa'));var squel=require(_0xae8f('0xb'));var crypto=require(_0xae8f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae8f('0xd'));var toCsv=require(_0xae8f('0x8'));var querystring=require(_0xae8f('0xe'));var Papa=require(_0xae8f('0xf'));var Redis=require('ioredis');var authService=require(_0xae8f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xae8f('0x11'));var hardwareService=require(_0xae8f('0x12'));var logger=require(_0xae8f('0x13'))(_0xae8f('0x14'));var utils=require(_0xae8f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xae8f('0x16'));var db=require(_0xae8f('0x17'))['db'];function respondWithStatusCode(_0x19ba78,_0x367f1a){_0x367f1a=_0x367f1a||0xcc;return function(_0x361ba4){if(_0x361ba4){return _0x19ba78[_0xae8f('0x18')](_0x367f1a);}return _0x19ba78[_0xae8f('0x19')](_0x367f1a)[_0xae8f('0x1a')]();};}function respondWithResult(_0x43daba,_0x1202a2){_0x1202a2=_0x1202a2||0xc8;return function(_0x6f3fda){if(_0x6f3fda){return _0x43daba[_0xae8f('0x19')](_0x1202a2)['json'](_0x6f3fda);}};}function respondWithFilteredResult(_0x36ffb7,_0x3feca4){return function(_0x2cfcc3){if(_0x2cfcc3){var _0x5cbaae=typeof _0x3feca4[_0xae8f('0x1b')]===_0xae8f('0x1c')&&typeof _0x3feca4[_0xae8f('0x1d')]===_0xae8f('0x1c');var _0x1efb97=_0x2cfcc3[_0xae8f('0x1e')];var _0x4ef13d=_0x5cbaae?0x0:_0x3feca4['offset'];var _0x34d40a=_0x5cbaae?_0x2cfcc3['count']:_0x3feca4[_0xae8f('0x1b')]+_0x3feca4[_0xae8f('0x1d')];var _0x48ea;if(_0x34d40a>=_0x1efb97){_0x34d40a=_0x1efb97;_0x48ea=0xc8;}else{_0x48ea=0xce;}_0x36ffb7[_0xae8f('0x19')](_0x48ea);return _0x36ffb7['set'](_0xae8f('0x1f'),_0x4ef13d+'-'+_0x34d40a+'/'+_0x1efb97)[_0xae8f('0x20')](_0x2cfcc3);}return null;};}function patchUpdates(_0x1357ee){return function(_0x3db469){try{jsonpatch[_0xae8f('0x21')](_0x3db469,_0x1357ee,!![]);}catch(_0x460cbc){return BPromise[_0xae8f('0x22')](_0x460cbc);}return _0x3db469[_0xae8f('0x23')]();};}function saveUpdates(_0x503adb,_0xf1c421){return function(_0xbb53ce){if(_0xbb53ce){return _0xbb53ce[_0xae8f('0x24')](_0x503adb)[_0xae8f('0x25')](function(_0x535e0c){return _0x535e0c;});}return null;};}function removeEntity(_0xfc0476,_0x57a3e2){return function(_0x3b79e7){if(_0x3b79e7){return _0x3b79e7['destroy']()[_0xae8f('0x25')](function(){_0xfc0476[_0xae8f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218526,_0x183d4f){return function(_0x19b176){if(!_0x19b176){_0x218526[_0xae8f('0x18')](0x194);}return _0x19b176;};}function handleError(_0x486a69,_0x424168){_0x424168=_0x424168||0x1f4;return function(_0x3306a2){logger['error'](_0x3306a2[_0xae8f('0x26')]);if(_0x3306a2['name']){delete _0x3306a2['name'];}_0x486a69[_0xae8f('0x19')](_0x424168)['send'](_0x3306a2);};}exports[_0xae8f('0x27')]=function(_0x1f7aca,_0x3b3bbe){var _0x476aa3={},_0x4ac47d={},_0x4e981b={'count':0x0,'rows':[]};var _0x533e5f=_[_0xae8f('0x28')](db[_0xae8f('0x29')][_0xae8f('0x2a')],function(_0x1c28d0){return{'name':_0x1c28d0['fieldName'],'type':_0x1c28d0[_0xae8f('0x2b')][_0xae8f('0x2c')]};});_0x4ac47d['model']=_['map'](_0x533e5f,_0xae8f('0x2d'));_0x4ac47d[_0xae8f('0x2e')]=_['keys'](_0x1f7aca[_0xae8f('0x2e')]);_0x4ac47d[_0xae8f('0x2f')]=_[_0xae8f('0x30')](_0x4ac47d[_0xae8f('0x31')],_0x4ac47d[_0xae8f('0x2e')]);_0x476aa3[_0xae8f('0x32')]=_[_0xae8f('0x30')](_0x4ac47d[_0xae8f('0x31')],qs[_0xae8f('0x33')](_0x1f7aca['query']['fields']));_0x476aa3['attributes']=_0x476aa3[_0xae8f('0x32')]['length']?_0x476aa3[_0xae8f('0x32')]:_0x4ac47d['model'];if(!_0x1f7aca[_0xae8f('0x2e')]['hasOwnProperty']('nolimit')){_0x476aa3[_0xae8f('0x1d')]=qs[_0xae8f('0x1d')](_0x1f7aca[_0xae8f('0x2e')][_0xae8f('0x1d')]);_0x476aa3[_0xae8f('0x1b')]=qs[_0xae8f('0x1b')](_0x1f7aca[_0xae8f('0x2e')][_0xae8f('0x1b')]);}_0x476aa3[_0xae8f('0x34')]=qs[_0xae8f('0x35')](_0x1f7aca[_0xae8f('0x2e')][_0xae8f('0x35')]);_0x476aa3[_0xae8f('0x36')]=qs['filters'](_[_0xae8f('0x37')](_0x1f7aca['query'],_0x4ac47d[_0xae8f('0x2f')]),_0x533e5f);if(_0x1f7aca['query'][_0xae8f('0x38')]){_0x476aa3[_0xae8f('0x36')]=_[_0xae8f('0x39')](_0x476aa3[_0xae8f('0x36')],{'$or':_[_0xae8f('0x28')](_0x533e5f,function(_0x494ff1){if(_0x494ff1[_0xae8f('0x2b')]!=='VIRTUAL'){var _0x1e59ab={};_0x1e59ab[_0x494ff1['name']]={'$like':'%'+_0x1f7aca[_0xae8f('0x2e')][_0xae8f('0x38')]+'%'};return _0x1e59ab;}})});}_0x476aa3=_[_0xae8f('0x39')]({},_0x476aa3,_0x1f7aca[_0xae8f('0x3a')]);var _0x321c3e={'where':_0x476aa3[_0xae8f('0x36')]};return db[_0xae8f('0x29')]['count'](_0x321c3e)[_0xae8f('0x25')](function(_0x5e02ce){_0x4e981b[_0xae8f('0x1e')]=_0x5e02ce;if(_0x1f7aca[_0xae8f('0x2e')][_0xae8f('0x3b')]){_0x476aa3['include']=[{'all':!![]}];}return db[_0xae8f('0x29')][_0xae8f('0x3c')](_0x476aa3);})['then'](function(_0x142ccc){_0x4e981b[_0xae8f('0x3d')]=_0x142ccc;return _0x4e981b;})[_0xae8f('0x25')](respondWithFilteredResult(_0x3b3bbe,_0x476aa3))[_0xae8f('0x3e')](handleError(_0x3b3bbe,null));};exports[_0xae8f('0x3f')]=function(_0x43bbbf,_0x596d5f){var _0x3f2ccf={'raw':!![],'where':{'id':_0x43bbbf[_0xae8f('0x40')]['id']}},_0xf2aa0d={};_0xf2aa0d[_0xae8f('0x31')]=_[_0xae8f('0x41')](db[_0xae8f('0x29')][_0xae8f('0x2a')]);_0xf2aa0d[_0xae8f('0x2e')]=_['keys'](_0x43bbbf[_0xae8f('0x2e')]);_0xf2aa0d['filters']=_[_0xae8f('0x30')](_0xf2aa0d[_0xae8f('0x31')],_0xf2aa0d[_0xae8f('0x2e')]);_0x3f2ccf[_0xae8f('0x32')]=_[_0xae8f('0x30')](_0xf2aa0d['model'],qs['fields'](_0x43bbbf['query'][_0xae8f('0x33')]));_0x3f2ccf['attributes']=_0x3f2ccf[_0xae8f('0x32')][_0xae8f('0x42')]?_0x3f2ccf[_0xae8f('0x32')]:_0xf2aa0d['model'];if(_0x43bbbf[_0xae8f('0x2e')][_0xae8f('0x3b')]){_0x3f2ccf[_0xae8f('0x43')]=[{'all':!![]}];}_0x3f2ccf=_[_0xae8f('0x39')]({},_0x3f2ccf,_0x43bbbf[_0xae8f('0x3a')]);return db['SquareReport']['find'](_0x3f2ccf)[_0xae8f('0x25')](handleEntityNotFound(_0x596d5f,null))[_0xae8f('0x25')](respondWithResult(_0x596d5f,null))[_0xae8f('0x3e')](handleError(_0x596d5f,null));};exports[_0xae8f('0x44')]=function(_0x5b6776,_0x1610b2){return db[_0xae8f('0x29')][_0xae8f('0x44')](_0x5b6776[_0xae8f('0x45')],{})[_0xae8f('0x25')](respondWithResult(_0x1610b2,0xc9))[_0xae8f('0x3e')](handleError(_0x1610b2,null));};exports[_0xae8f('0x24')]=function(_0x31695a,_0x1f0bb0){if(_0x31695a[_0xae8f('0x45')]['id']){delete _0x31695a[_0xae8f('0x45')]['id'];}return db[_0xae8f('0x29')]['find']({'where':{'id':_0x31695a[_0xae8f('0x40')]['id']}})[_0xae8f('0x25')](handleEntityNotFound(_0x1f0bb0,null))[_0xae8f('0x25')](saveUpdates(_0x31695a['body'],null))['then'](respondWithResult(_0x1f0bb0,null))['catch'](handleError(_0x1f0bb0,null));};exports['destroy']=function(_0x5ba84d,_0x143342){return db[_0xae8f('0x29')][_0xae8f('0x46')]({'where':{'id':_0x5ba84d[_0xae8f('0x40')]['id']}})[_0xae8f('0x25')](handleEntityNotFound(_0x143342,null))[_0xae8f('0x25')](removeEntity(_0x143342,null))[_0xae8f('0x3e')](handleError(_0x143342,null));};exports['describe']=function(_0xcd4a16,_0x5733a0){return db[_0xae8f('0x29')][_0xae8f('0x47')]()['then'](respondWithResult(_0x5733a0,null))[_0xae8f('0x3e')](handleError(_0x5733a0,null));}; \ No newline at end of file +var _0xf643=['params','rawAttributes','include','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','name','index','map','SquareReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','includeAll','findAll','then','rows','catch','show'];(function(_0x2ad7ec,_0x2af92b){var _0x228f07=function(_0x459edc){while(--_0x459edc){_0x2ad7ec['push'](_0x2ad7ec['shift']());}};_0x228f07(++_0x2af92b);}(_0xf643,0x11b));var _0x3f64=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xf643[_0xd0cd0b];return _0x59cced;};'use strict';var emlformat=require(_0x3f64('0x0'));var rimraf=require(_0x3f64('0x1'));var zipdir=require(_0x3f64('0x2'));var jsonpatch=require(_0x3f64('0x3'));var rp=require('request-promise');var moment=require(_0x3f64('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f64('0x5'));var util=require(_0x3f64('0x6'));var path=require(_0x3f64('0x7'));var sox=require(_0x3f64('0x8'));var csv=require(_0x3f64('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f64('0xa'));var _=require('lodash');var squel=require(_0x3f64('0xb'));var crypto=require(_0x3f64('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3f64('0x9'));var querystring=require(_0x3f64('0xd'));var Papa=require(_0x3f64('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f64('0xf'));var as=require(_0x3f64('0x10'));var hardwareService=require(_0x3f64('0x11'));var logger=require('../../config/logger')(_0x3f64('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f64('0x13'))['db'];function respondWithStatusCode(_0x280345,_0x19e326){_0x19e326=_0x19e326||0xcc;return function(_0x1e4f2f){if(_0x1e4f2f){return _0x280345[_0x3f64('0x14')](_0x19e326);}return _0x280345[_0x3f64('0x15')](_0x19e326)[_0x3f64('0x16')]();};}function respondWithResult(_0x2748f8,_0x563fe5){_0x563fe5=_0x563fe5||0xc8;return function(_0x271dab){if(_0x271dab){return _0x2748f8[_0x3f64('0x15')](_0x563fe5)[_0x3f64('0x17')](_0x271dab);}};}function respondWithFilteredResult(_0x1b91a6,_0x135d5c){return function(_0x50f49a){if(_0x50f49a){var _0x10686d=typeof _0x135d5c[_0x3f64('0x18')]==='undefined'&&typeof _0x135d5c[_0x3f64('0x19')]===_0x3f64('0x1a');var _0x4fe07d=_0x50f49a[_0x3f64('0x1b')];var _0x272134=_0x10686d?0x0:_0x135d5c[_0x3f64('0x18')];var _0x3d666b=_0x10686d?_0x50f49a[_0x3f64('0x1b')]:_0x135d5c['offset']+_0x135d5c[_0x3f64('0x19')];var _0x47e6af;if(_0x3d666b>=_0x4fe07d){_0x3d666b=_0x4fe07d;_0x47e6af=0xc8;}else{_0x47e6af=0xce;}_0x1b91a6[_0x3f64('0x15')](_0x47e6af);return _0x1b91a6[_0x3f64('0x1c')](_0x3f64('0x1d'),_0x272134+'-'+_0x3d666b+'/'+_0x4fe07d)[_0x3f64('0x17')](_0x50f49a);}return null;};}function patchUpdates(_0x32e5eb){return function(_0x3cda44){try{jsonpatch[_0x3f64('0x1e')](_0x3cda44,_0x32e5eb,!![]);}catch(_0x3ce49f){return BPromise['reject'](_0x3ce49f);}return _0x3cda44[_0x3f64('0x1f')]();};}function saveUpdates(_0x4f4635,_0x378d42){return function(_0x552c4e){if(_0x552c4e){return _0x552c4e[_0x3f64('0x20')](_0x4f4635)['then'](function(_0x58fed8){return _0x58fed8;});}return null;};}function removeEntity(_0x10dd51,_0x142c11){return function(_0x4468ba){if(_0x4468ba){return _0x4468ba[_0x3f64('0x21')]()['then'](function(){_0x10dd51[_0x3f64('0x15')](0xcc)[_0x3f64('0x16')]();});}};}function handleEntityNotFound(_0x3b0369,_0x894a18){return function(_0x480971){if(!_0x480971){_0x3b0369[_0x3f64('0x14')](0x194);}return _0x480971;};}function handleError(_0x262c16,_0x573e10){_0x573e10=_0x573e10||0x1f4;return function(_0x479092){logger['error'](_0x479092['stack']);if(_0x479092[_0x3f64('0x22')]){delete _0x479092['name'];}_0x262c16[_0x3f64('0x15')](_0x573e10)['send'](_0x479092);};}exports[_0x3f64('0x23')]=function(_0x5ca228,_0x37c5cd){var _0x49cb9c={},_0x1dbb97={},_0x45da98={'count':0x0,'rows':[]};var _0x54732c=_[_0x3f64('0x24')](db[_0x3f64('0x25')]['rawAttributes'],function(_0x197d0f){return{'name':_0x197d0f[_0x3f64('0x26')],'type':_0x197d0f[_0x3f64('0x27')]['key']};});_0x1dbb97[_0x3f64('0x28')]=_[_0x3f64('0x24')](_0x54732c,_0x3f64('0x22'));_0x1dbb97[_0x3f64('0x29')]=_[_0x3f64('0x2a')](_0x5ca228['query']);_0x1dbb97['filters']=_[_0x3f64('0x2b')](_0x1dbb97[_0x3f64('0x28')],_0x1dbb97[_0x3f64('0x29')]);_0x49cb9c[_0x3f64('0x2c')]=_[_0x3f64('0x2b')](_0x1dbb97[_0x3f64('0x28')],qs['fields'](_0x5ca228['query'][_0x3f64('0x2d')]));_0x49cb9c[_0x3f64('0x2c')]=_0x49cb9c[_0x3f64('0x2c')][_0x3f64('0x2e')]?_0x49cb9c[_0x3f64('0x2c')]:_0x1dbb97[_0x3f64('0x28')];if(!_0x5ca228['query'][_0x3f64('0x2f')](_0x3f64('0x30'))){_0x49cb9c[_0x3f64('0x19')]=qs['limit'](_0x5ca228['query'][_0x3f64('0x19')]);_0x49cb9c['offset']=qs['offset'](_0x5ca228['query']['offset']);}_0x49cb9c[_0x3f64('0x31')]=qs[_0x3f64('0x32')](_0x5ca228[_0x3f64('0x29')][_0x3f64('0x32')]);_0x49cb9c[_0x3f64('0x33')]=qs['filters'](_[_0x3f64('0x34')](_0x5ca228[_0x3f64('0x29')],_0x1dbb97[_0x3f64('0x35')]),_0x54732c);if(_0x5ca228[_0x3f64('0x29')]['filter']){_0x49cb9c[_0x3f64('0x33')]=_[_0x3f64('0x36')](_0x49cb9c['where'],{'$or':_[_0x3f64('0x24')](_0x54732c,function(_0x2e44c5){if(_0x2e44c5[_0x3f64('0x27')]!=='VIRTUAL'){var _0x40ef4a={};_0x40ef4a[_0x2e44c5[_0x3f64('0x22')]]={'$like':'%'+_0x5ca228['query'][_0x3f64('0x37')]+'%'};return _0x40ef4a;}})});}_0x49cb9c=_[_0x3f64('0x36')]({},_0x49cb9c,_0x5ca228['options']);var _0x70e8c7={'where':_0x49cb9c[_0x3f64('0x33')]};return db[_0x3f64('0x25')]['count'](_0x70e8c7)['then'](function(_0x5397fe){_0x45da98[_0x3f64('0x1b')]=_0x5397fe;if(_0x5ca228[_0x3f64('0x29')][_0x3f64('0x38')]){_0x49cb9c['include']=[{'all':!![]}];}return db[_0x3f64('0x25')][_0x3f64('0x39')](_0x49cb9c);})[_0x3f64('0x3a')](function(_0x2997f8){_0x45da98[_0x3f64('0x3b')]=_0x2997f8;return _0x45da98;})[_0x3f64('0x3a')](respondWithFilteredResult(_0x37c5cd,_0x49cb9c))[_0x3f64('0x3c')](handleError(_0x37c5cd,null));};exports[_0x3f64('0x3d')]=function(_0x43dd2e,_0x3c8954){var _0x3f41bf={'raw':!![],'where':{'id':_0x43dd2e[_0x3f64('0x3e')]['id']}},_0xbeb9c3={};_0xbeb9c3[_0x3f64('0x28')]=_[_0x3f64('0x2a')](db['SquareReport'][_0x3f64('0x3f')]);_0xbeb9c3[_0x3f64('0x29')]=_['keys'](_0x43dd2e[_0x3f64('0x29')]);_0xbeb9c3[_0x3f64('0x35')]=_[_0x3f64('0x2b')](_0xbeb9c3['model'],_0xbeb9c3[_0x3f64('0x29')]);_0x3f41bf['attributes']=_['intersection'](_0xbeb9c3[_0x3f64('0x28')],qs[_0x3f64('0x2d')](_0x43dd2e[_0x3f64('0x29')][_0x3f64('0x2d')]));_0x3f41bf[_0x3f64('0x2c')]=_0x3f41bf[_0x3f64('0x2c')]['length']?_0x3f41bf['attributes']:_0xbeb9c3[_0x3f64('0x28')];if(_0x43dd2e[_0x3f64('0x29')][_0x3f64('0x38')]){_0x3f41bf[_0x3f64('0x40')]=[{'all':!![]}];}_0x3f41bf=_['merge']({},_0x3f41bf,_0x43dd2e[_0x3f64('0x41')]);return db[_0x3f64('0x25')][_0x3f64('0x42')](_0x3f41bf)['then'](handleEntityNotFound(_0x3c8954,null))[_0x3f64('0x3a')](respondWithResult(_0x3c8954,null))[_0x3f64('0x3c')](handleError(_0x3c8954,null));};exports['create']=function(_0x1a0e28,_0x2a9c6b){return db[_0x3f64('0x25')]['create'](_0x1a0e28[_0x3f64('0x43')],{})['then'](respondWithResult(_0x2a9c6b,0xc9))[_0x3f64('0x3c')](handleError(_0x2a9c6b,null));};exports[_0x3f64('0x20')]=function(_0x235c7a,_0x16b0ce){if(_0x235c7a['body']['id']){delete _0x235c7a[_0x3f64('0x43')]['id'];}return db[_0x3f64('0x25')][_0x3f64('0x42')]({'where':{'id':_0x235c7a[_0x3f64('0x3e')]['id']}})['then'](handleEntityNotFound(_0x16b0ce,null))[_0x3f64('0x3a')](saveUpdates(_0x235c7a['body'],null))[_0x3f64('0x3a')](respondWithResult(_0x16b0ce,null))[_0x3f64('0x3c')](handleError(_0x16b0ce,null));};exports[_0x3f64('0x21')]=function(_0x10f5de,_0x3428de){return db[_0x3f64('0x25')][_0x3f64('0x42')]({'where':{'id':_0x10f5de[_0x3f64('0x3e')]['id']}})[_0x3f64('0x3a')](handleEntityNotFound(_0x3428de,null))['then'](removeEntity(_0x3428de,null))['catch'](handleError(_0x3428de,null));};exports['describe']=function(_0x326009,_0x492dc3){return db['SquareReport'][_0x3f64('0x44')]()[_0x3f64('0x3a')](respondWithResult(_0x492dc3,null))[_0x3f64('0x3c')](handleError(_0x492dc3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index bc28e5e..94f3db1 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 _0x97bf=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','project_name','leaveAt','lodash'];(function(_0x4ecd28,_0x5a7356){var _0x12b7b2=function(_0x375b3d){while(--_0x375b3d){_0x4ecd28['push'](_0x4ecd28['shift']());}};_0x12b7b2(++_0x5a7356);}(_0x97bf,0x1cd));var _0xf97b=function(_0x5bfe01,_0x55447e){_0x5bfe01=_0x5bfe01-0x0;var _0x332c29=_0x97bf[_0x5bfe01];return _0x332c29;};'use strict';var _=require(_0xf97b('0x0'));var util=require(_0xf97b('0x1'));var logger=require('../../config/logger')(_0xf97b('0x2'));var moment=require(_0xf97b('0x3'));var BPromise=require(_0xf97b('0x4'));var rp=require(_0xf97b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf97b('0x6'));var config=require(_0xf97b('0x7'));var attributes=require(_0xf97b('0x8'));module[_0xf97b('0x9')]=function(_0x3f7350,_0x120c4b){return _0x3f7350[_0xf97b('0xa')](_0xf97b('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xf97b('0xc')]},{'name':_0xf97b('0xd'),'fields':[_0xf97b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6508=['moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6508,0x8d));var _0x8650=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x6508[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0x8650('0x0'));var util=require('util');var logger=require(_0x8650('0x1'))(_0x8650('0x2'));var moment=require(_0x8650('0x3'));var BPromise=require(_0x8650('0x4'));var rp=require(_0x8650('0x5'));var fs=require('fs');var path=require(_0x8650('0x6'));var rimraf=require('rimraf');var config=require(_0x8650('0x7'));var attributes=require(_0x8650('0x8'));module[_0x8650('0x9')]=function(_0x535ac5,_0x3ff74f){return _0x535ac5[_0x8650('0xa')](_0x8650('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x8650('0xc'),'fields':[_0x8650('0xd'),_0x8650('0xe')]},{'name':_0x8650('0xf'),'fields':[_0x8650('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index be2f93c..6bdf3da 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 _0x9a6d=['options','raw','UpdateSquareReport','update','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','SquareReport','body'];(function(_0x26931e,_0xae640f){var _0x114aa0=function(_0x739e91){while(--_0x739e91){_0x26931e['push'](_0x26931e['shift']());}};_0x114aa0(++_0xae640f);}(_0x9a6d,0x139));var _0xd9a6=function(_0x1ed60a,_0x456c80){_0x1ed60a=_0x1ed60a-0x0;var _0x3fcc36=_0x9a6d[_0x1ed60a];return _0x3fcc36;};'use strict';var _=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var moment=require(_0xd9a6('0x2'));var BPromise=require(_0xd9a6('0x3'));var rs=require(_0xd9a6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9a6('0x5'))['db'];var utils=require(_0xd9a6('0x6'));var logger=require(_0xd9a6('0x7'))(_0xd9a6('0x8'));var config=require(_0xd9a6('0x9'));var jayson=require(_0xd9a6('0xa'));var client=jayson[_0xd9a6('0xb')][_0xd9a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58687f,_0x427a83,_0x539c2b){return new BPromise(function(_0x2ce230,_0x4f28bb){return client[_0xd9a6('0xd')](_0x58687f,_0x539c2b)[_0xd9a6('0xe')](function(_0x1523a2){logger[_0xd9a6('0xf')](_0xd9a6('0x10'),_0x427a83,_0xd9a6('0x11'));logger[_0xd9a6('0x12')](_0xd9a6('0x13'),_0x427a83,_0xd9a6('0x11'),JSON['stringify'](_0x1523a2));if(_0x1523a2['error']){if(_0x1523a2[_0xd9a6('0x14')]['code']===0x1f4){logger[_0xd9a6('0x14')]('SquareReport,\x20%s,\x20%s',_0x427a83,_0x1523a2['error']['message']);return _0x4f28bb(_0x1523a2['error'][_0xd9a6('0x15')]);}logger[_0xd9a6('0x14')](_0xd9a6('0x10'),_0x427a83,_0x1523a2[_0xd9a6('0x14')][_0xd9a6('0x15')]);return _0x2ce230(_0x1523a2[_0xd9a6('0x14')]['message']);}else{logger[_0xd9a6('0xf')](_0xd9a6('0x10'),_0x427a83,_0xd9a6('0x11'));_0x2ce230(_0x1523a2[_0xd9a6('0x16')][_0xd9a6('0x15')]);}})[_0xd9a6('0x17')](function(_0x477762){logger[_0xd9a6('0x14')](_0xd9a6('0x10'),_0x427a83,_0x477762);_0x4f28bb(_0x477762);});});}exports[_0xd9a6('0x18')]=function(_0x361354){var _0x10055c=this;return new Promise(function(_0x3ec4b2,_0x4c96d8){return db[_0xd9a6('0x19')]['create'](_0x361354[_0xd9a6('0x1a')],{'raw':_0x361354[_0xd9a6('0x1b')]?_0x361354[_0xd9a6('0x1b')][_0xd9a6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3b487c){logger[_0xd9a6('0xf')]('CreateSquareReport',_0x361354);logger[_0xd9a6('0x12')](_0xd9a6('0x18'),_0x361354,JSON['stringify'](_0x3b487c));_0x3ec4b2(_0x3b487c);})[_0xd9a6('0x17')](function(_0x3700e8){logger[_0xd9a6('0x14')](_0xd9a6('0x18'),_0x3700e8[_0xd9a6('0x15')],_0x361354);_0x4c96d8(_0x10055c[_0xd9a6('0x14')](0x1f4,_0x3700e8[_0xd9a6('0x15')]));});});};exports[_0xd9a6('0x1d')]=function(_0x544c97){var _0x4a7178=this;return new Promise(function(_0x4815d3,_0x87a234){return db[_0xd9a6('0x19')][_0xd9a6('0x1e')](_0x544c97['body'],{'raw':_0x544c97[_0xd9a6('0x1b')]?_0x544c97['options'][_0xd9a6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x544c97[_0xd9a6('0x1b')]?_0x544c97['options'][_0xd9a6('0x1f')]||null:null,'attributes':_0x544c97['options']?_0x544c97[_0xd9a6('0x1b')][_0xd9a6('0x20')]||null:null,'limit':_0x544c97[_0xd9a6('0x1b')]?_0x544c97[_0xd9a6('0x1b')]['limit']||null:null})[_0xd9a6('0xe')](function(_0x3f2c64){logger[_0xd9a6('0xf')](_0xd9a6('0x1d'),_0x544c97);logger[_0xd9a6('0x12')](_0xd9a6('0x1d'),_0x544c97,JSON[_0xd9a6('0x21')](_0x3f2c64));_0x4815d3(_0x3f2c64);})[_0xd9a6('0x17')](function(_0xf541a6){logger[_0xd9a6('0x14')]('UpdateSquareReport',_0xf541a6[_0xd9a6('0x15')],_0x544c97);_0x87a234(_0x4a7178[_0xd9a6('0x14')](0x1f4,_0xf541a6[_0xd9a6('0x15')]));});});}; \ No newline at end of file +var _0x8402=['update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0x8402,0x18f));var _0x2840=function(_0x152c48,_0x57ea1d){_0x152c48=_0x152c48-0x0;var _0x1812c2=_0x8402[_0x152c48];return _0x1812c2;};'use strict';var _=require('lodash');var util=require(_0x2840('0x0'));var moment=require(_0x2840('0x1'));var BPromise=require(_0x2840('0x2'));var rs=require(_0x2840('0x3'));var fs=require('fs');var Redis=require(_0x2840('0x4'));var db=require(_0x2840('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2840('0x6'))(_0x2840('0x7'));var config=require(_0x2840('0x8'));var jayson=require(_0x2840('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x323dd3,_0x171998,_0x18e525){return new BPromise(function(_0x35ce55,_0x4a7c9f){return client[_0x2840('0xa')](_0x323dd3,_0x18e525)[_0x2840('0xb')](function(_0x4f4c9c){logger[_0x2840('0xc')]('SquareReport,\x20%s,\x20%s',_0x171998,_0x2840('0xd'));logger[_0x2840('0xe')](_0x2840('0xf'),_0x171998,_0x2840('0xd'),JSON[_0x2840('0x10')](_0x4f4c9c));if(_0x4f4c9c[_0x2840('0x11')]){if(_0x4f4c9c[_0x2840('0x11')][_0x2840('0x12')]===0x1f4){logger[_0x2840('0x11')](_0x2840('0x13'),_0x171998,_0x4f4c9c[_0x2840('0x11')][_0x2840('0x14')]);return _0x4a7c9f(_0x4f4c9c[_0x2840('0x11')][_0x2840('0x14')]);}logger[_0x2840('0x11')](_0x2840('0x13'),_0x171998,_0x4f4c9c[_0x2840('0x11')][_0x2840('0x14')]);return _0x35ce55(_0x4f4c9c[_0x2840('0x11')][_0x2840('0x14')]);}else{logger['info'](_0x2840('0x13'),_0x171998,'request\x20sent');_0x35ce55(_0x4f4c9c[_0x2840('0x15')]['message']);}})['catch'](function(_0x2a1d75){logger[_0x2840('0x11')](_0x2840('0x13'),_0x171998,_0x2a1d75);_0x4a7c9f(_0x2a1d75);});});}exports[_0x2840('0x16')]=function(_0x2114bd){var _0x23fe75=this;return new Promise(function(_0x4ad409,_0x25e84f){return db[_0x2840('0x17')][_0x2840('0x18')](_0x2114bd[_0x2840('0x19')],{'raw':_0x2114bd[_0x2840('0x1a')]?_0x2114bd[_0x2840('0x1a')][_0x2840('0x1b')]===undefined?!![]:![]:!![]})[_0x2840('0xb')](function(_0x533e7d){logger[_0x2840('0xc')](_0x2840('0x16'),_0x2114bd);logger[_0x2840('0xe')](_0x2840('0x16'),_0x2114bd,JSON['stringify'](_0x533e7d));_0x4ad409(_0x533e7d);})[_0x2840('0x1c')](function(_0x1e6e72){logger[_0x2840('0x11')](_0x2840('0x16'),_0x1e6e72[_0x2840('0x14')],_0x2114bd);_0x25e84f(_0x23fe75[_0x2840('0x11')](0x1f4,_0x1e6e72['message']));});});};exports[_0x2840('0x1d')]=function(_0x17e4f9){var _0x242cd9=this;return new Promise(function(_0x217e7f,_0x52e4fc){return db[_0x2840('0x17')][_0x2840('0x1e')](_0x17e4f9[_0x2840('0x19')],{'raw':_0x17e4f9['options']?_0x17e4f9[_0x2840('0x1a')][_0x2840('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e4f9[_0x2840('0x1a')]?_0x17e4f9[_0x2840('0x1a')][_0x2840('0x1f')]||null:null,'attributes':_0x17e4f9[_0x2840('0x1a')]?_0x17e4f9[_0x2840('0x1a')]['attributes']||null:null,'limit':_0x17e4f9[_0x2840('0x1a')]?_0x17e4f9[_0x2840('0x1a')][_0x2840('0x20')]||null:null})[_0x2840('0xb')](function(_0x5b40a9){logger[_0x2840('0xc')](_0x2840('0x1d'),_0x17e4f9);logger['debug'](_0x2840('0x1d'),_0x17e4f9,JSON[_0x2840('0x10')](_0x5b40a9));_0x217e7f(_0x5b40a9);})[_0x2840('0x1c')](function(_0x2dea5d){logger[_0x2840('0x11')](_0x2840('0x1d'),_0x2dea5d[_0x2840('0x14')],_0x17e4f9);_0x52e4fc(_0x242cd9[_0x2840('0x11')](0x1f4,_0x2dea5d[_0x2840('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index eeaa7bd..436112d 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 _0x87cf=['delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x3630b1,_0x396a0e){var _0x1022b1=function(_0x4d0e38){while(--_0x4d0e38){_0x3630b1['push'](_0x3630b1['shift']());}};_0x1022b1(++_0x396a0e);}(_0x87cf,0x1e9));var _0xf87c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x87cf[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0xf87c('0x0'));var path=require(_0xf87c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf87c('0x2')]();var fs_extra=require(_0xf87c('0x3'));var auth=require(_0xf87c('0x4'));var interaction=require(_0xf87c('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf87c('0x6')]('/',auth[_0xf87c('0x7')](),controller['index']);router[_0xf87c('0x6')]('/describe',auth[_0xf87c('0x7')](),controller[_0xf87c('0x8')]);router[_0xf87c('0x6')](_0xf87c('0x9'),auth[_0xf87c('0x7')](),controller[_0xf87c('0xa')]);router[_0xf87c('0xb')]('/',auth[_0xf87c('0x7')](),controller[_0xf87c('0xc')]);router[_0xf87c('0xd')](_0xf87c('0x9'),auth[_0xf87c('0x7')](),controller[_0xf87c('0xe')]);router[_0xf87c('0xf')](_0xf87c('0x9'),auth[_0xf87c('0x7')](),controller[_0xf87c('0x10')]);module[_0xf87c('0x11')]=router; \ No newline at end of file +var _0xc36c=['isAuthenticated','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','get','index','/describe'];(function(_0x7564a5,_0x45db50){var _0x15bea3=function(_0x3f2f0f){while(--_0x3f2f0f){_0x7564a5['push'](_0x7564a5['shift']());}};_0x15bea3(++_0x45db50);}(_0xc36c,0x1ac));var _0xcc36=function(_0x3c43cb,_0x137c41){_0x3c43cb=_0x3c43cb-0x0;var _0x45c60c=_0xc36c[_0x3c43cb];return _0x45c60c;};'use strict';var multer=require(_0xcc36('0x0'));var util=require(_0xcc36('0x1'));var path=require(_0xcc36('0x2'));var timeout=require(_0xcc36('0x3'));var express=require(_0xcc36('0x4'));var router=express[_0xcc36('0x5')]();var fs_extra=require(_0xcc36('0x6'));var auth=require(_0xcc36('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc36('0x8'));router[_0xcc36('0x9')]('/',auth['isAuthenticated'](),controller[_0xcc36('0xa')]);router['get'](_0xcc36('0xb'),auth[_0xcc36('0xc')](),controller[_0xcc36('0xd')]);router[_0xcc36('0x9')](_0xcc36('0xe'),auth[_0xcc36('0xc')](),controller[_0xcc36('0xf')]);router[_0xcc36('0x10')]('/',auth[_0xcc36('0xc')](),controller[_0xcc36('0x11')]);router[_0xcc36('0x12')]('/:id',auth[_0xcc36('0xc')](),controller['update']);router['delete']('/:id',auth[_0xcc36('0xc')](),controller['destroy']);module[_0xcc36('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index fb70bec..46e993f 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 _0xecfa=['TEXT','sequelize','exports','STRING'];(function(_0x5b15c9,_0x5f4cb7){var _0x2b10f1=function(_0x55fc94){while(--_0x55fc94){_0x5b15c9['push'](_0x5b15c9['shift']());}};_0x2b10f1(++_0x5f4cb7);}(_0xecfa,0x8d));var _0xaecf=function(_0xf96b70,_0x17a54d){_0xf96b70=_0xf96b70-0x0;var _0x21d08b=_0xecfa[_0xf96b70];return _0x21d08b;};'use strict';var Sequelize=require(_0xaecf('0x0'));module[_0xaecf('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xaecf('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xaecf('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaecf('0x2')]}}; \ No newline at end of file +var _0x7743=['sequelize','exports','STRING'];(function(_0x21c06d,_0x4295ac){var _0xd6db96=function(_0x25c168){while(--_0x25c168){_0x21c06d['push'](_0x21c06d['shift']());}};_0xd6db96(++_0x4295ac);}(_0x7743,0xd8));var _0x3774=function(_0x37de9d,_0x26d1af){_0x37de9d=_0x37de9d-0x0;var _0x1cda8d=_0x7743[_0x37de9d];return _0x1cda8d;};'use strict';var Sequelize=require(_0x3774('0x0'));module[_0x3774('0x1')]={'uniqueid':{'type':Sequelize[_0x3774('0x2')]},'node':{'type':Sequelize[_0x3774('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3774('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 8ec750f..685a531 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 _0xe007=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','limit','status','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareDetailsReport','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3ff6ee,_0x4a2ce8){var _0x3e3d57=function(_0x19aa85){while(--_0x19aa85){_0x3ff6ee['push'](_0x3ff6ee['shift']());}};_0x3e3d57(++_0x4a2ce8);}(_0xe007,0x17c));var _0x7e00=function(_0x3d2695,_0x3ef159){_0x3d2695=_0x3d2695-0x0;var _0x5d549b=_0xe007[_0x3d2695];return _0x5d549b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e00('0x0'));var zipdir=require(_0x7e00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e00('0x2'));var moment=require(_0x7e00('0x3'));var BPromise=require(_0x7e00('0x4'));var Mustache=require(_0x7e00('0x5'));var util=require(_0x7e00('0x6'));var path=require('path');var sox=require(_0x7e00('0x7'));var csv=require(_0x7e00('0x8'));var ejs=require(_0x7e00('0x9'));var fs=require('fs');var fs_extra=require(_0x7e00('0xa'));var _=require(_0x7e00('0xb'));var squel=require(_0x7e00('0xc'));var crypto=require(_0x7e00('0xd'));var jsforce=require(_0x7e00('0xe'));var deskjs=require(_0x7e00('0xf'));var toCsv=require(_0x7e00('0x8'));var querystring=require(_0x7e00('0x10'));var Papa=require(_0x7e00('0x11'));var Redis=require('ioredis');var authService=require(_0x7e00('0x12'));var qs=require(_0x7e00('0x13'));var as=require(_0x7e00('0x14'));var hardwareService=require(_0x7e00('0x15'));var logger=require(_0x7e00('0x16'))(_0x7e00('0x17'));var utils=require('../../config/utils');var config=require(_0x7e00('0x18'));var licenseUtil=require(_0x7e00('0x19'));var db=require(_0x7e00('0x1a'))['db'];function respondWithStatusCode(_0x52eaa5,_0x4c5124){_0x4c5124=_0x4c5124||0xcc;return function(_0x26afaa){if(_0x26afaa){return _0x52eaa5['sendStatus'](_0x4c5124);}return _0x52eaa5['status'](_0x4c5124)[_0x7e00('0x1b')]();};}function respondWithResult(_0x3e0c0a,_0x4477a2){_0x4477a2=_0x4477a2||0xc8;return function(_0x45c3fa){if(_0x45c3fa){return _0x3e0c0a['status'](_0x4477a2)[_0x7e00('0x1c')](_0x45c3fa);}};}function respondWithFilteredResult(_0x1475dc,_0x1809a9){return function(_0x4dbff0){if(_0x4dbff0){var _0x147b81=typeof _0x1809a9['offset']===_0x7e00('0x1d')&&typeof _0x1809a9['limit']===_0x7e00('0x1d');var _0x2e2b84=_0x4dbff0['count'];var _0xfc6a4c=_0x147b81?0x0:_0x1809a9['offset'];var _0x18ab2f=_0x147b81?_0x4dbff0[_0x7e00('0x1e')]:_0x1809a9['offset']+_0x1809a9[_0x7e00('0x1f')];var _0x2a41d3;if(_0x18ab2f>=_0x2e2b84){_0x18ab2f=_0x2e2b84;_0x2a41d3=0xc8;}else{_0x2a41d3=0xce;}_0x1475dc[_0x7e00('0x20')](_0x2a41d3);return _0x1475dc[_0x7e00('0x21')](_0x7e00('0x22'),_0xfc6a4c+'-'+_0x18ab2f+'/'+_0x2e2b84)[_0x7e00('0x1c')](_0x4dbff0);}return null;};}function patchUpdates(_0xa90517){return function(_0x33f339){try{jsonpatch['apply'](_0x33f339,_0xa90517,!![]);}catch(_0x5b3296){return BPromise[_0x7e00('0x23')](_0x5b3296);}return _0x33f339[_0x7e00('0x24')]();};}function saveUpdates(_0x2e4663,_0x587411){return function(_0x2b192d){if(_0x2b192d){return _0x2b192d[_0x7e00('0x25')](_0x2e4663)[_0x7e00('0x26')](function(_0x5cebc9){return _0x5cebc9;});}return null;};}function removeEntity(_0x54e0ed,_0x3c46d4){return function(_0x535ca9){if(_0x535ca9){return _0x535ca9[_0x7e00('0x27')]()[_0x7e00('0x26')](function(){_0x54e0ed['status'](0xcc)[_0x7e00('0x1b')]();});}};}function handleEntityNotFound(_0x27e077,_0x196c56){return function(_0x4f60a7){if(!_0x4f60a7){_0x27e077[_0x7e00('0x28')](0x194);}return _0x4f60a7;};}function handleError(_0x4f2b66,_0x1d5677){_0x1d5677=_0x1d5677||0x1f4;return function(_0x2648e5){logger[_0x7e00('0x29')](_0x2648e5[_0x7e00('0x2a')]);if(_0x2648e5[_0x7e00('0x2b')]){delete _0x2648e5['name'];}_0x4f2b66[_0x7e00('0x20')](_0x1d5677)[_0x7e00('0x2c')](_0x2648e5);};}exports[_0x7e00('0x2d')]=function(_0x1a66bc,_0x4160c7){var _0x515826={},_0x1e79d4={},_0x282626={'count':0x0,'rows':[]};var _0x32d4fc=_['map'](db[_0x7e00('0x2e')][_0x7e00('0x2f')],function(_0x829018){return{'name':_0x829018['fieldName'],'type':_0x829018[_0x7e00('0x30')][_0x7e00('0x31')]};});_0x1e79d4[_0x7e00('0x32')]=_['map'](_0x32d4fc,_0x7e00('0x2b'));_0x1e79d4['query']=_['keys'](_0x1a66bc['query']);_0x1e79d4['filters']=_[_0x7e00('0x33')](_0x1e79d4[_0x7e00('0x32')],_0x1e79d4[_0x7e00('0x34')]);_0x515826[_0x7e00('0x35')]=_[_0x7e00('0x33')](_0x1e79d4['model'],qs[_0x7e00('0x36')](_0x1a66bc[_0x7e00('0x34')]['fields']));_0x515826[_0x7e00('0x35')]=_0x515826[_0x7e00('0x35')][_0x7e00('0x37')]?_0x515826[_0x7e00('0x35')]:_0x1e79d4[_0x7e00('0x32')];if(!_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x38')](_0x7e00('0x39'))){_0x515826['limit']=qs[_0x7e00('0x1f')](_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x1f')]);_0x515826[_0x7e00('0x3a')]=qs[_0x7e00('0x3a')](_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x3a')]);}_0x515826[_0x7e00('0x3b')]=qs['sort'](_0x1a66bc['query'][_0x7e00('0x3c')]);_0x515826[_0x7e00('0x3d')]=qs[_0x7e00('0x3e')](_['pick'](_0x1a66bc[_0x7e00('0x34')],_0x1e79d4[_0x7e00('0x3e')]),_0x32d4fc);if(_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x3f')]){_0x515826[_0x7e00('0x3d')]=_[_0x7e00('0x40')](_0x515826['where'],{'$or':_[_0x7e00('0x41')](_0x32d4fc,function(_0xbb17f){if(_0xbb17f[_0x7e00('0x30')]!==_0x7e00('0x42')){var _0x3f4825={};_0x3f4825[_0xbb17f[_0x7e00('0x2b')]]={'$like':'%'+_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x3f')]+'%'};return _0x3f4825;}})});}_0x515826=_[_0x7e00('0x40')]({},_0x515826,_0x1a66bc[_0x7e00('0x43')]);var _0x3e21a8={'where':_0x515826[_0x7e00('0x3d')]};return db['SquareDetailsReport'][_0x7e00('0x1e')](_0x3e21a8)[_0x7e00('0x26')](function(_0x2a3cdd){_0x282626['count']=_0x2a3cdd;if(_0x1a66bc[_0x7e00('0x34')][_0x7e00('0x44')]){_0x515826['include']=[{'all':!![]}];}return db[_0x7e00('0x2e')][_0x7e00('0x45')](_0x515826);})[_0x7e00('0x26')](function(_0x1a491f){_0x282626[_0x7e00('0x46')]=_0x1a491f;return _0x282626;})[_0x7e00('0x26')](respondWithFilteredResult(_0x4160c7,_0x515826))[_0x7e00('0x47')](handleError(_0x4160c7,null));};exports[_0x7e00('0x48')]=function(_0x566ccb,_0x36a4ca){var _0x47b59b={'raw':!![],'where':{'id':_0x566ccb['params']['id']}},_0x41c424={};_0x41c424['model']=_[_0x7e00('0x49')](db['SquareDetailsReport']['rawAttributes']);_0x41c424[_0x7e00('0x34')]=_['keys'](_0x566ccb[_0x7e00('0x34')]);_0x41c424[_0x7e00('0x3e')]=_['intersection'](_0x41c424[_0x7e00('0x32')],_0x41c424['query']);_0x47b59b[_0x7e00('0x35')]=_[_0x7e00('0x33')](_0x41c424[_0x7e00('0x32')],qs[_0x7e00('0x36')](_0x566ccb[_0x7e00('0x34')]['fields']));_0x47b59b['attributes']=_0x47b59b[_0x7e00('0x35')][_0x7e00('0x37')]?_0x47b59b['attributes']:_0x41c424['model'];if(_0x566ccb[_0x7e00('0x34')][_0x7e00('0x44')]){_0x47b59b['include']=[{'all':!![]}];}_0x47b59b=_[_0x7e00('0x40')]({},_0x47b59b,_0x566ccb[_0x7e00('0x43')]);return db[_0x7e00('0x2e')]['find'](_0x47b59b)[_0x7e00('0x26')](handleEntityNotFound(_0x36a4ca,null))['then'](respondWithResult(_0x36a4ca,null))[_0x7e00('0x47')](handleError(_0x36a4ca,null));};exports['create']=function(_0x4a9338,_0x5d9d9d){return db[_0x7e00('0x2e')][_0x7e00('0x4a')](_0x4a9338[_0x7e00('0x4b')],{})[_0x7e00('0x26')](respondWithResult(_0x5d9d9d,0xc9))[_0x7e00('0x47')](handleError(_0x5d9d9d,null));};exports['update']=function(_0x242c6f,_0x2cb447){if(_0x242c6f['body']['id']){delete _0x242c6f[_0x7e00('0x4b')]['id'];}return db[_0x7e00('0x2e')][_0x7e00('0x4c')]({'where':{'id':_0x242c6f[_0x7e00('0x4d')]['id']}})[_0x7e00('0x26')](handleEntityNotFound(_0x2cb447,null))[_0x7e00('0x26')](saveUpdates(_0x242c6f[_0x7e00('0x4b')],null))[_0x7e00('0x26')](respondWithResult(_0x2cb447,null))[_0x7e00('0x47')](handleError(_0x2cb447,null));};exports[_0x7e00('0x27')]=function(_0x2b090b,_0x520aa5){return db[_0x7e00('0x2e')][_0x7e00('0x4c')]({'where':{'id':_0x2b090b[_0x7e00('0x4d')]['id']}})[_0x7e00('0x26')](handleEntityNotFound(_0x520aa5,null))[_0x7e00('0x26')](removeEntity(_0x520aa5,null))['catch'](handleError(_0x520aa5,null));};exports[_0x7e00('0x4e')]=function(_0x540048,_0x3c326e){return db[_0x7e00('0x2e')][_0x7e00('0x4e')]()[_0x7e00('0x26')](respondWithResult(_0x3c326e,null))[_0x7e00('0x47')](handleError(_0x3c326e,null));}; \ No newline at end of file +var _0x42bd=['request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','SquareDetailsReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','zip-dir','fast-json-patch'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x42bd,0xd9));var _0xd42b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x42bd[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd42b('0x0'));var jsonpatch=require(_0xd42b('0x1'));var rp=require(_0xd42b('0x2'));var moment=require(_0xd42b('0x3'));var BPromise=require(_0xd42b('0x4'));var Mustache=require(_0xd42b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd42b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd42b('0x7'));var _=require(_0xd42b('0x8'));var squel=require(_0xd42b('0x9'));var crypto=require(_0xd42b('0xa'));var jsforce=require(_0xd42b('0xb'));var deskjs=require(_0xd42b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd42b('0xd'));var Papa=require(_0xd42b('0xe'));var Redis=require(_0xd42b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd42b('0x10'));var as=require(_0xd42b('0x11'));var hardwareService=require(_0xd42b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd42b('0x13'));var config=require(_0xd42b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd42b('0x15'))['db'];function respondWithStatusCode(_0x201a0c,_0x3a6117){_0x3a6117=_0x3a6117||0xcc;return function(_0x507185){if(_0x507185){return _0x201a0c['sendStatus'](_0x3a6117);}return _0x201a0c[_0xd42b('0x16')](_0x3a6117)[_0xd42b('0x17')]();};}function respondWithResult(_0x5acba1,_0x53f658){_0x53f658=_0x53f658||0xc8;return function(_0x267a08){if(_0x267a08){return _0x5acba1[_0xd42b('0x16')](_0x53f658)['json'](_0x267a08);}};}function respondWithFilteredResult(_0x5126a7,_0x16f2c0){return function(_0x3b8593){if(_0x3b8593){var _0x323352=typeof _0x16f2c0[_0xd42b('0x18')]===_0xd42b('0x19')&&typeof _0x16f2c0[_0xd42b('0x1a')]===_0xd42b('0x19');var _0x43c6ac=_0x3b8593['count'];var _0x18a722=_0x323352?0x0:_0x16f2c0['offset'];var _0x359a6f=_0x323352?_0x3b8593[_0xd42b('0x1b')]:_0x16f2c0[_0xd42b('0x18')]+_0x16f2c0[_0xd42b('0x1a')];var _0xd2bc9a;if(_0x359a6f>=_0x43c6ac){_0x359a6f=_0x43c6ac;_0xd2bc9a=0xc8;}else{_0xd2bc9a=0xce;}_0x5126a7[_0xd42b('0x16')](_0xd2bc9a);return _0x5126a7[_0xd42b('0x1c')](_0xd42b('0x1d'),_0x18a722+'-'+_0x359a6f+'/'+_0x43c6ac)[_0xd42b('0x1e')](_0x3b8593);}return null;};}function patchUpdates(_0x4295d0){return function(_0x150b53){try{jsonpatch['apply'](_0x150b53,_0x4295d0,!![]);}catch(_0x177a86){return BPromise[_0xd42b('0x1f')](_0x177a86);}return _0x150b53[_0xd42b('0x20')]();};}function saveUpdates(_0x4429df,_0x254fad){return function(_0x3a4909){if(_0x3a4909){return _0x3a4909[_0xd42b('0x21')](_0x4429df)[_0xd42b('0x22')](function(_0x2e7c87){return _0x2e7c87;});}return null;};}function removeEntity(_0x956b4c,_0x2b3d3c){return function(_0x2a8f3c){if(_0x2a8f3c){return _0x2a8f3c[_0xd42b('0x23')]()['then'](function(){_0x956b4c['status'](0xcc)[_0xd42b('0x17')]();});}};}function handleEntityNotFound(_0x292b60,_0x553f9d){return function(_0x153c26){if(!_0x153c26){_0x292b60[_0xd42b('0x24')](0x194);}return _0x153c26;};}function handleError(_0x19ffa6,_0x30d921){_0x30d921=_0x30d921||0x1f4;return function(_0xc78cc){logger[_0xd42b('0x25')](_0xc78cc[_0xd42b('0x26')]);if(_0xc78cc['name']){delete _0xc78cc[_0xd42b('0x27')];}_0x19ffa6[_0xd42b('0x16')](_0x30d921)[_0xd42b('0x28')](_0xc78cc);};}exports['index']=function(_0x5c426f,_0x42a79c){var _0x2cacab={},_0x38197f={},_0x37c09a={'count':0x0,'rows':[]};var _0x39a452=_['map'](db[_0xd42b('0x29')][_0xd42b('0x2a')],function(_0x3916a7){return{'name':_0x3916a7['fieldName'],'type':_0x3916a7[_0xd42b('0x2b')]['key']};});_0x38197f[_0xd42b('0x2c')]=_[_0xd42b('0x2d')](_0x39a452,'name');_0x38197f[_0xd42b('0x2e')]=_[_0xd42b('0x2f')](_0x5c426f[_0xd42b('0x2e')]);_0x38197f[_0xd42b('0x30')]=_[_0xd42b('0x31')](_0x38197f[_0xd42b('0x2c')],_0x38197f[_0xd42b('0x2e')]);_0x2cacab[_0xd42b('0x32')]=_['intersection'](_0x38197f['model'],qs[_0xd42b('0x33')](_0x5c426f[_0xd42b('0x2e')]['fields']));_0x2cacab['attributes']=_0x2cacab[_0xd42b('0x32')][_0xd42b('0x34')]?_0x2cacab[_0xd42b('0x32')]:_0x38197f[_0xd42b('0x2c')];if(!_0x5c426f[_0xd42b('0x2e')][_0xd42b('0x35')](_0xd42b('0x36'))){_0x2cacab[_0xd42b('0x1a')]=qs['limit'](_0x5c426f[_0xd42b('0x2e')][_0xd42b('0x1a')]);_0x2cacab[_0xd42b('0x18')]=qs[_0xd42b('0x18')](_0x5c426f['query'][_0xd42b('0x18')]);}_0x2cacab[_0xd42b('0x37')]=qs[_0xd42b('0x38')](_0x5c426f[_0xd42b('0x2e')][_0xd42b('0x38')]);_0x2cacab[_0xd42b('0x39')]=qs[_0xd42b('0x30')](_['pick'](_0x5c426f[_0xd42b('0x2e')],_0x38197f[_0xd42b('0x30')]),_0x39a452);if(_0x5c426f[_0xd42b('0x2e')][_0xd42b('0x3a')]){_0x2cacab[_0xd42b('0x39')]=_[_0xd42b('0x3b')](_0x2cacab[_0xd42b('0x39')],{'$or':_[_0xd42b('0x2d')](_0x39a452,function(_0x3f00c5){if(_0x3f00c5[_0xd42b('0x2b')]!==_0xd42b('0x3c')){var _0x3d9d5d={};_0x3d9d5d[_0x3f00c5[_0xd42b('0x27')]]={'$like':'%'+_0x5c426f['query'][_0xd42b('0x3a')]+'%'};return _0x3d9d5d;}})});}_0x2cacab=_[_0xd42b('0x3b')]({},_0x2cacab,_0x5c426f[_0xd42b('0x3d')]);var _0x411bbe={'where':_0x2cacab['where']};return db[_0xd42b('0x29')][_0xd42b('0x1b')](_0x411bbe)[_0xd42b('0x22')](function(_0x1bc9a4){_0x37c09a[_0xd42b('0x1b')]=_0x1bc9a4;if(_0x5c426f['query'][_0xd42b('0x3e')]){_0x2cacab[_0xd42b('0x3f')]=[{'all':!![]}];}return db[_0xd42b('0x29')][_0xd42b('0x40')](_0x2cacab);})['then'](function(_0x4cedb6){_0x37c09a[_0xd42b('0x41')]=_0x4cedb6;return _0x37c09a;})[_0xd42b('0x22')](respondWithFilteredResult(_0x42a79c,_0x2cacab))['catch'](handleError(_0x42a79c,null));};exports[_0xd42b('0x42')]=function(_0x42740d,_0x536443){var _0x241c80={'raw':!![],'where':{'id':_0x42740d[_0xd42b('0x43')]['id']}},_0x3b2afc={};_0x3b2afc[_0xd42b('0x2c')]=_[_0xd42b('0x2f')](db['SquareDetailsReport']['rawAttributes']);_0x3b2afc[_0xd42b('0x2e')]=_[_0xd42b('0x2f')](_0x42740d[_0xd42b('0x2e')]);_0x3b2afc['filters']=_['intersection'](_0x3b2afc[_0xd42b('0x2c')],_0x3b2afc[_0xd42b('0x2e')]);_0x241c80['attributes']=_['intersection'](_0x3b2afc[_0xd42b('0x2c')],qs['fields'](_0x42740d[_0xd42b('0x2e')][_0xd42b('0x33')]));_0x241c80[_0xd42b('0x32')]=_0x241c80[_0xd42b('0x32')][_0xd42b('0x34')]?_0x241c80['attributes']:_0x3b2afc[_0xd42b('0x2c')];if(_0x42740d[_0xd42b('0x2e')][_0xd42b('0x3e')]){_0x241c80[_0xd42b('0x3f')]=[{'all':!![]}];}_0x241c80=_[_0xd42b('0x3b')]({},_0x241c80,_0x42740d[_0xd42b('0x3d')]);return db[_0xd42b('0x29')][_0xd42b('0x44')](_0x241c80)['then'](handleEntityNotFound(_0x536443,null))[_0xd42b('0x22')](respondWithResult(_0x536443,null))[_0xd42b('0x45')](handleError(_0x536443,null));};exports[_0xd42b('0x46')]=function(_0x4908f1,_0x1691b8){return db['SquareDetailsReport'][_0xd42b('0x46')](_0x4908f1['body'],{})['then'](respondWithResult(_0x1691b8,0xc9))['catch'](handleError(_0x1691b8,null));};exports[_0xd42b('0x21')]=function(_0x17b3e2,_0xfad38){if(_0x17b3e2[_0xd42b('0x47')]['id']){delete _0x17b3e2[_0xd42b('0x47')]['id'];}return db[_0xd42b('0x29')][_0xd42b('0x44')]({'where':{'id':_0x17b3e2[_0xd42b('0x43')]['id']}})[_0xd42b('0x22')](handleEntityNotFound(_0xfad38,null))[_0xd42b('0x22')](saveUpdates(_0x17b3e2[_0xd42b('0x47')],null))[_0xd42b('0x22')](respondWithResult(_0xfad38,null))['catch'](handleError(_0xfad38,null));};exports[_0xd42b('0x23')]=function(_0x425ad5,_0x232abd){return db[_0xd42b('0x29')]['find']({'where':{'id':_0x425ad5[_0xd42b('0x43')]['id']}})[_0xd42b('0x22')](handleEntityNotFound(_0x232abd,null))['then'](removeEntity(_0x232abd,null))[_0xd42b('0x45')](handleError(_0x232abd,null));};exports['describe']=function(_0x2d6e14,_0x4c9c94){return db['SquareDetailsReport'][_0xd42b('0x48')]()['then'](respondWithResult(_0x4c9c94,null))[_0xd42b('0x45')](handleError(_0x4c9c94,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index fd6b8e5..6b523bb 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 _0x7200=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details'];(function(_0xd81acb,_0xe171a8){var _0x5d92a7=function(_0x46dd29){while(--_0x46dd29){_0xd81acb['push'](_0xd81acb['shift']());}};_0x5d92a7(++_0xe171a8);}(_0x7200,0x9c));var _0x0720=function(_0x309cbc,_0x543e8f){_0x309cbc=_0x309cbc-0x0;var _0x2ac832=_0x7200[_0x309cbc];return _0x2ac832;};'use strict';var _=require(_0x0720('0x0'));var util=require(_0x0720('0x1'));var logger=require(_0x0720('0x2'))(_0x0720('0x3'));var moment=require(_0x0720('0x4'));var BPromise=require(_0x0720('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0720('0x6'));var rimraf=require(_0x0720('0x7'));var config=require(_0x0720('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x0720('0x9')]=function(_0x97a5c7,_0x848246){return _0x97a5c7[_0x0720('0xa')](_0x0720('0xb'),attributes,{'tableName':_0x0720('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7072=['define','SquareDetailsReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','./squareReportDetail.attributes','exports'];(function(_0x12ca0c,_0x20f5f9){var _0x51da43=function(_0x2bedc2){while(--_0x2bedc2){_0x12ca0c['push'](_0x12ca0c['shift']());}};_0x51da43(++_0x20f5f9);}(_0x7072,0x65));var _0x2707=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x7072[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x2707('0x0'));var util=require(_0x2707('0x1'));var logger=require(_0x2707('0x2'))(_0x2707('0x3'));var moment=require('moment');var BPromise=require(_0x2707('0x4'));var rp=require(_0x2707('0x5'));var fs=require('fs');var path=require(_0x2707('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2707('0x7'));module[_0x2707('0x8')]=function(_0x2bd6e2,_0x149b6f){return _0x2bd6e2[_0x2707('0x9')](_0x2707('0xa'),attributes,{'tableName':'report_square_details','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 7acb4c6..2c54baa 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 _0xa478=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x223af1,_0x1c9e78){var _0x4cd71a=function(_0x396c6a){while(--_0x396c6a){_0x223af1['push'](_0x223af1['shift']());}};_0x4cd71a(++_0x1c9e78);}(_0xa478,0x136));var _0x8a47=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0xa478[_0x3ae2b2];return _0x1dbf00;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}exports[_0x8a47('0x17')]=function(_0x3f9093){var _0x5f5884=this;return new Promise(function(_0x341089,_0x5c62eb){return db['SquareDetailsReport'][_0x8a47('0x18')](_0x3f9093[_0x8a47('0x19')],{'raw':_0x3f9093[_0x8a47('0x1a')]?_0x3f9093[_0x8a47('0x1a')][_0x8a47('0x1b')]===undefined?!![]:![]:!![]})[_0x8a47('0xd')](function(_0x44e119){logger[_0x8a47('0xe')](_0x8a47('0x17'),_0x3f9093);logger[_0x8a47('0x10')]('CreateSquareDetailsReport',_0x3f9093,JSON[_0x8a47('0x1c')](_0x44e119));_0x341089(_0x44e119);})['catch'](function(_0x289f28){logger[_0x8a47('0x11')](_0x8a47('0x17'),_0x289f28[_0x8a47('0x13')],_0x3f9093);_0x5c62eb(_0x5f5884['error'](0x1f4,_0x289f28[_0x8a47('0x13')]));});});}; \ No newline at end of file +var _0x0647=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x47bdc6,_0x4333f2){var _0x9b9033=function(_0x5c3d43){while(--_0x5c3d43){_0x47bdc6['push'](_0x47bdc6['shift']());}};_0x9b9033(++_0x4333f2);}(_0x0647,0xd0));var _0x7064=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x0647[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require(_0x7064('0x1'));var BPromise=require(_0x7064('0x2'));var rs=require(_0x7064('0x3'));var fs=require('fs');var Redis=require(_0x7064('0x4'));var db=require(_0x7064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require(_0x7064('0x8'));var client=jayson[_0x7064('0x9')][_0x7064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1101e4,_0x58186b,_0x536336){return new BPromise(function(_0x1c85b1,_0x39b7e3){return client[_0x7064('0xb')](_0x1101e4,_0x536336)['then'](function(_0x38c195){logger[_0x7064('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x58186b,_0x7064('0xd'));logger[_0x7064('0xe')](_0x7064('0xf'),_0x58186b,'request\x20sent',JSON[_0x7064('0x10')](_0x38c195));if(_0x38c195[_0x7064('0x11')]){if(_0x38c195[_0x7064('0x11')][_0x7064('0x12')]===0x1f4){logger['error'](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);return _0x39b7e3(_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);}logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')]['message']);return _0x1c85b1(_0x38c195['error']['message']);}else{logger[_0x7064('0xc')](_0x7064('0x13'),_0x58186b,_0x7064('0xd'));_0x1c85b1(_0x38c195['result'][_0x7064('0x14')]);}})[_0x7064('0x15')](function(_0x5bb1cc){logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x5bb1cc);_0x39b7e3(_0x5bb1cc);});});}exports[_0x7064('0x16')]=function(_0x203633){var _0x181ca0=this;return new Promise(function(_0x17f306,_0x3f3695){return db[_0x7064('0x17')][_0x7064('0x18')](_0x203633[_0x7064('0x19')],{'raw':_0x203633[_0x7064('0x1a')]?_0x203633[_0x7064('0x1a')][_0x7064('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x431fac){logger[_0x7064('0xc')](_0x7064('0x16'),_0x203633);logger[_0x7064('0xe')]('CreateSquareDetailsReport',_0x203633,JSON[_0x7064('0x10')](_0x431fac));_0x17f306(_0x431fac);})['catch'](function(_0x446730){logger[_0x7064('0x11')]('CreateSquareDetailsReport',_0x446730[_0x7064('0x14')],_0x203633);_0x3f3695(_0x181ca0[_0x7064('0x11')](0x1f4,_0x446730[_0x7064('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 4cf636c..9188372 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 _0xddd8=['exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0xe9e939,_0x4936b7){var _0x4cf393=function(_0x5e0d2b){while(--_0x5e0d2b){_0xe9e939['push'](_0xe9e939['shift']());}};_0x4cf393(++_0x4936b7);}(_0xddd8,0x1e9));var _0x8ddd=function(_0x206b24,_0x1a06a5){_0x206b24=_0x206b24-0x0;var _0x386464=_0xddd8[_0x206b24];return _0x386464;};'use strict';var express=require('express');var router=express[_0x8ddd('0x0')]();var auth=require(_0x8ddd('0x1'));var controller=require(_0x8ddd('0x2'));router[_0x8ddd('0x3')]('/',auth[_0x8ddd('0x4')](),controller['index']);router[_0x8ddd('0x3')](_0x8ddd('0x5'),auth[_0x8ddd('0x4')](),controller[_0x8ddd('0x6')]);module[_0x8ddd('0x7')]=router; \ No newline at end of file +var _0x0b28=['index','isAuthenticated','killProcess','express','../../components/auth/service','./system.controller','get'];(function(_0x5321fc,_0x21ebec){var _0x4209df=function(_0x128239){while(--_0x128239){_0x5321fc['push'](_0x5321fc['shift']());}};_0x4209df(++_0x21ebec);}(_0x0b28,0x1a0));var _0x80b2=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x0b28[_0xd0a847];return _0x2536ec;};'use strict';var express=require(_0x80b2('0x0'));var router=express['Router']();var auth=require(_0x80b2('0x1'));var controller=require(_0x80b2('0x2'));router[_0x80b2('0x3')]('/',auth['isAuthenticated'](),controller[_0x80b2('0x4')]);router[_0x80b2('0x3')]('/process/:pid/kill',auth[_0x80b2('0x5')](),controller[_0x80b2('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 410e30e..d381e8e 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 _0x0986=['killProcess','systeminformation','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status','send','getAllData','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch'];(function(_0x34aee8,_0x475e35){var _0x162c33=function(_0x2f94c5){while(--_0x2f94c5){_0x34aee8['push'](_0x34aee8['shift']());}};_0x162c33(++_0x475e35);}(_0x0986,0x1bb));var _0x6098=function(_0xba9302,_0x12252e){_0xba9302=_0xba9302-0x0;var _0x46f55f=_0x0986[_0xba9302];return _0x46f55f;};'use strict';var info=require(_0x6098('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x6098('0x1'))(_0x6098('0x2'));var util=require(_0x6098('0x3'));var BPromise=require(_0x6098('0x4'));var _=require(_0x6098('0x5'));function handleError(_0x41ec3e,_0x453da6,_0x403e54){_0x453da6=_0x453da6||0x1f4;return function(_0x297718){logger[_0x6098('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x403e54,_0x453da6,util[_0x6098('0x7')](_0x297718,{'showHidden':![],'depth':null}));delete _0x297718[_0x6098('0x8')];_0x41ec3e[_0x6098('0x9')](_0x453da6)[_0x6098('0xa')](_0x297718);};}exports['index']=function(_0x312fd7,_0x3173c7){return info[_0x6098('0xb')]()['then'](function(_0x5661bc){return _0x3173c7[_0x6098('0x9')](0xc8)[_0x6098('0xc')](_0x5661bc);})['catch'](function(_0x48fa1d){return _0x3173c7[_0x6098('0x9')](0x1f4)[_0x6098('0xc')](_0x48fa1d);});};exports['killProcess']=function(_0x5df322,_0x2e7b59){var _0x16e19f=[_0x6098('0xd')];return new BPromise(function(_0x2fc578,_0x182c46){return exec(util[_0x6098('0xe')](_0x6098('0xf'),_0x5df322[_0x6098('0x10')][_0x6098('0x11')]),function(_0x1b1102,_0x25ed4f,_0x4490c6){if(_0x1b1102){return _0x182c46(_0x1b1102);}return _0x2fc578(_0x25ed4f);});})['then'](function(_0x3d2be1){var _0x4faf40=![];var _0x4f6a96=_0x3d2be1['split'](/\n/);for(var _0x576f08=0x0,_0x481697=_0x16e19f[_0x6098('0x12')];_0x576f08<_0x481697,_0x4faf40===![];_0x576f08+=0x1){if(_0x3d2be1[_0x6098('0x13')](_0x16e19f[_0x576f08])>=0x0){_0x4faf40=!![];}}if(!_0x4faf40){throw new Error(util[_0x6098('0xe')](_0x6098('0x14'),_0x5df322[_0x6098('0x10')][_0x6098('0x11')]));}process[_0x6098('0x15')](_0x5df322[_0x6098('0x10')]['pid'],_0x6098('0x16'));return _0x2e7b59[_0x6098('0x9')](0xc8)['json']({'message':util[_0x6098('0xe')](_0x6098('0x17'),_0x5df322[_0x6098('0x10')][_0x6098('0x11')])});})[_0x6098('0x18')](handleError(_0x2e7b59,null,_0x6098('0x19')));}; \ No newline at end of file +var _0x8ccb=['pid','split','length','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','util','error','inspect','name','status','send','index','then','json','components/import/cm','params'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8ccb,0xed));var _0xb8cc=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8ccb[_0x44bcb0];return _0xfaf881;};'use strict';var info=require(_0xb8cc('0x0'));var exec=require(_0xb8cc('0x1'))[_0xb8cc('0x2')];var logger=require(_0xb8cc('0x3'))('api');var util=require(_0xb8cc('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x124c21,_0x48b647,_0x1e160d){_0x48b647=_0x48b647||0x1f4;return function(_0x378a34){logger[_0xb8cc('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1e160d,_0x48b647,util[_0xb8cc('0x6')](_0x378a34,{'showHidden':![],'depth':null}));delete _0x378a34[_0xb8cc('0x7')];_0x124c21[_0xb8cc('0x8')](_0x48b647)[_0xb8cc('0x9')](_0x378a34);};}exports[_0xb8cc('0xa')]=function(_0x495b11,_0x480c54){return info['getAllData']()[_0xb8cc('0xb')](function(_0x22acbc){return _0x480c54[_0xb8cc('0x8')](0xc8)[_0xb8cc('0xc')](_0x22acbc);})['catch'](function(_0x48ab62){return _0x480c54[_0xb8cc('0x8')](0x1f4)[_0xb8cc('0xc')](_0x48ab62);});};exports['killProcess']=function(_0x3c8613,_0x56659e){var _0x925f97=[_0xb8cc('0xd')];return new BPromise(function(_0x1da21f,_0x5ceb82){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3c8613[_0xb8cc('0xe')][_0xb8cc('0xf')]),function(_0x2f665c,_0x2c25fd,_0x521d9a){if(_0x2f665c){return _0x5ceb82(_0x2f665c);}return _0x1da21f(_0x2c25fd);});})[_0xb8cc('0xb')](function(_0x5d63a9){var _0xc7fc62=![];var _0xace043=_0x5d63a9[_0xb8cc('0x10')](/\n/);for(var _0x187a11=0x0,_0x387b28=_0x925f97[_0xb8cc('0x11')];_0x187a11<_0x387b28,_0xc7fc62===![];_0x187a11+=0x1){if(_0x5d63a9['indexOf'](_0x925f97[_0x187a11])>=0x0){_0xc7fc62=!![];}}if(!_0xc7fc62){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3c8613[_0xb8cc('0xe')][_0xb8cc('0xf')]));}process['kill'](_0x3c8613['params'][_0xb8cc('0xf')],_0xb8cc('0x12'));return _0x56659e[_0xb8cc('0x8')](0xc8)['json']({'message':util['format'](_0xb8cc('0x13'),_0x3c8613[_0xb8cc('0xe')]['pid'])});})[_0xb8cc('0x14')](handleError(_0x56659e,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c35d5cb..549b5b1 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 _0xae4b=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x42982e,_0x183612){var _0x7fce85=function(_0x11fcc0){while(--_0x11fcc0){_0x42982e['push'](_0x42982e['shift']());}};_0x7fce85(++_0x183612);}(_0xae4b,0x17e));var _0xbae4=function(_0x387fe9,_0x2db3e2){_0x387fe9=_0x387fe9-0x0;var _0x55ed6b=_0xae4b[_0x387fe9];return _0x55ed6b;};'use strict';var multer=require(_0xbae4('0x0'));var util=require('util');var path=require(_0xbae4('0x1'));var timeout=require(_0xbae4('0x2'));var express=require(_0xbae4('0x3'));var router=express[_0xbae4('0x4')]();var fs_extra=require(_0xbae4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbae4('0x6'));var controller=require(_0xbae4('0x7'));router[_0xbae4('0x8')]('/',auth[_0xbae4('0x9')](),controller[_0xbae4('0xa')]);router['get'](_0xbae4('0xb'),auth[_0xbae4('0x9')](),controller[_0xbae4('0xc')]);router[_0xbae4('0xd')]('/',auth[_0xbae4('0x9')](),controller[_0xbae4('0xe')]);router['put'](_0xbae4('0xb'),auth[_0xbae4('0x9')](),controller[_0xbae4('0xf')]);router[_0xbae4('0x10')](_0xbae4('0xb'),auth['isAuthenticated'](),controller[_0xbae4('0x11')]);module[_0xbae4('0x12')]=router; \ No newline at end of file +var _0x0c01=['post','create','put','/:id','update','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x36f5ae,_0x53960b){var _0x10c86c=function(_0x597583){while(--_0x597583){_0x36f5ae['push'](_0x36f5ae['shift']());}};_0x10c86c(++_0x53960b);}(_0x0c01,0x10f));var _0x10c0=function(_0xbd43d7,_0x2c2165){_0xbd43d7=_0xbd43d7-0x0;var _0x2a5814=_0x0c01[_0xbd43d7];return _0x2a5814;};'use strict';var multer=require(_0x10c0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x10c0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10c0('0x2'));var auth=require(_0x10c0('0x3'));var interaction=require(_0x10c0('0x4'));var config=require(_0x10c0('0x5'));var controller=require(_0x10c0('0x6'));router[_0x10c0('0x7')]('/',auth[_0x10c0('0x8')](),controller['index']);router[_0x10c0('0x7')]('/:id',auth[_0x10c0('0x8')](),controller['show']);router[_0x10c0('0x9')]('/',auth[_0x10c0('0x8')](),controller[_0x10c0('0xa')]);router[_0x10c0('0xb')](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller[_0x10c0('0xd')]);router['delete'](_0x10c0('0xc'),auth[_0x10c0('0x8')](),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 9a06b64..b157616 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 _0xf1f9=['name','sequelize','exports','STRING'];(function(_0x32b418,_0x5aa7a3){var _0x4fa982=function(_0x2c2f25){while(--_0x2c2f25){_0x32b418['push'](_0x32b418['shift']());}};_0x4fa982(++_0x5aa7a3);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x423c11,_0x3f907a){_0x423c11=_0x423c11-0x0;var _0x21ec62=_0xf1f9[_0x423c11];return _0x21ec62;};'use strict';var Sequelize=require(_0x9f1f('0x0'));module[_0x9f1f('0x1')]={'name':{'type':Sequelize[_0x9f1f('0x2')],'unique':_0x9f1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x9f1f('0x2')]}}; \ No newline at end of file +var _0x8a9d=['STRING','sequelize','exports','name'];(function(_0x2f6b43,_0x5bde39){var _0x2c67c5=function(_0x2d5e21){while(--_0x2d5e21){_0x2f6b43['push'](_0x2f6b43['shift']());}};_0x2c67c5(++_0x5bde39);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x2fc130,_0x1e4dc0){_0x2fc130=_0x2fc130-0x0;var _0xd5a6d1=_0x8a9d[_0x2fc130];return _0xd5a6d1;};'use strict';var Sequelize=require(_0xd8a9('0x0'));module[_0xd8a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8a9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd8a9('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xd8a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9f8f421..ca94251 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','include','options','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x5c5611,_0xfd1585){var _0x38a187=function(_0x27b737){while(--_0x27b737){_0x5c5611['push'](_0x5c5611['shift']());}};_0x38a187(++_0xfd1585);}(_0xb43b,0xbf));var _0xbb43=function(_0x1eeb64,_0x450ac4){_0x1eeb64=_0x1eeb64-0x0;var _0x32165d=_0xb43b[_0x1eeb64];return _0x32165d;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=typeof _0x199726[_0xbb43('0x1a')]===_0xbb43('0x1b')&&typeof _0x199726[_0xbb43('0x1c')]===_0xbb43('0x1b');var _0x209c9c=_0x32425c[_0xbb43('0x1d')];var _0x4c223b=_0x15182b?0x0:_0x199726[_0xbb43('0x1a')];var _0x4cb0b2=_0x15182b?_0x32425c[_0xbb43('0x1d')]:_0x199726['offset']+_0x199726[_0xbb43('0x1c')];var _0x5f4b4f;if(_0x4cb0b2>=_0x209c9c){_0x4cb0b2=_0x209c9c;_0x5f4b4f=0xc8;}else{_0x5f4b4f=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x5f4b4f);return _0x4ac25c[_0xbb43('0x1e')]('Content-Range',_0x4c223b+'-'+_0x4cb0b2+'/'+_0x209c9c)[_0xbb43('0x19')](_0x32425c);}return null;};}function patchUpdates(_0x6cdc26){return function(_0x398ce5){try{jsonpatch[_0xbb43('0x1f')](_0x398ce5,_0x6cdc26,!![]);}catch(_0x22c5d1){return BPromise[_0xbb43('0x20')](_0x22c5d1);}return _0x398ce5[_0xbb43('0x21')]();};}function saveUpdates(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')](_0x1e83cd)[_0xbb43('0x23')](function(_0x36992f){return _0x36992f;});}return null;};}function removeEntity(_0x37beb0,_0x500af4){return function(_0x28b3e4){if(_0x28b3e4){return _0x28b3e4[_0xbb43('0x24')]()['then'](function(){var _0x464b4a=_0x28b3e4[_0xbb43('0x25')]({'plain':!![]});var _0x25279b='Tags';return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x25279b,'resourceId':_0x464b4a['id']}})[_0xbb43('0x23')](function(){return _0x28b3e4;});})['then'](function(){_0x37beb0['status'](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0xb9fe3b,_0x268fb5){return function(_0x4bb859){if(!_0x4bb859){_0xb9fe3b[_0xbb43('0x26')](0x194);}return _0x4bb859;};}function handleError(_0x426cec,_0x2dcc60){_0x2dcc60=_0x2dcc60||0x1f4;return function(_0x1a6e2b){logger['error'](_0x1a6e2b[_0xbb43('0x27')]);if(_0x1a6e2b[_0xbb43('0x28')]){delete _0x1a6e2b[_0xbb43('0x28')];}_0x426cec[_0xbb43('0x17')](_0x2dcc60)[_0xbb43('0x29')](_0x1a6e2b);};}exports[_0xbb43('0x2a')]=function(_0x2860d8,_0x48986d){var _0x3b2290={},_0x209244={},_0x3c46c6={'count':0x0,'rows':[]};var _0x5b8a7d=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')],function(_0x168374){return{'name':_0x168374[_0xbb43('0x2e')],'type':_0x168374[_0xbb43('0x2f')][_0xbb43('0x30')]};});_0x209244[_0xbb43('0x31')]=_[_0xbb43('0x2b')](_0x5b8a7d,'name');_0x209244['query']=_['keys'](_0x2860d8['query']);_0x209244[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],_0x209244[_0xbb43('0x34')]);_0x3b2290[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2860d8['query'][_0xbb43('0x36')]));_0x3b2290[_0xbb43('0x35')]=_0x3b2290[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3b2290['attributes']:_0x209244[_0xbb43('0x31')];if(!_0x2860d8[_0xbb43('0x34')][_0xbb43('0x38')](_0xbb43('0x39'))){_0x3b2290['limit']=qs[_0xbb43('0x1c')](_0x2860d8['query'][_0xbb43('0x1c')]);_0x3b2290[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x1a')]);}_0x3b2290[_0xbb43('0x3a')]=qs[_0xbb43('0x3b')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3b')]);_0x3b2290[_0xbb43('0x3c')]=qs[_0xbb43('0x32')](_[_0xbb43('0x3d')](_0x2860d8['query'],_0x209244[_0xbb43('0x32')]),_0x5b8a7d);if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]){_0x3b2290[_0xbb43('0x3c')]=_[_0xbb43('0x3f')](_0x3b2290[_0xbb43('0x3c')],{'$or':_[_0xbb43('0x2b')](_0x5b8a7d,function(_0x3d7d56){if(_0x3d7d56[_0xbb43('0x2f')]!==_0xbb43('0x40')){var _0x1fe204={};_0x1fe204[_0x3d7d56[_0xbb43('0x28')]]={'$like':'%'+_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]+'%'};return _0x1fe204;}})});}_0x3b2290=_[_0xbb43('0x3f')]({},_0x3b2290,_0x2860d8['options']);var _0x4807a3={'where':_0x3b2290[_0xbb43('0x3c')]};return db[_0xbb43('0x2c')][_0xbb43('0x1d')](_0x4807a3)[_0xbb43('0x23')](function(_0x4b32c9){_0x3c46c6['count']=_0x4b32c9;if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x41')]){_0x3b2290['include']=[{'all':!![]}];}return db['Tag'][_0xbb43('0x42')](_0x3b2290);})[_0xbb43('0x23')](function(_0x26aa10){_0x3c46c6[_0xbb43('0x43')]=_0x26aa10;return _0x3c46c6;})[_0xbb43('0x23')](respondWithFilteredResult(_0x48986d,_0x3b2290))['catch'](handleError(_0x48986d,null));};exports['show']=function(_0x2ea37b,_0x41fed6){var _0x3f48a1={'raw':!![],'where':{'id':_0x2ea37b[_0xbb43('0x44')]['id']}},_0x2d1256={};_0x2d1256[_0xbb43('0x31')]=_[_0xbb43('0x45')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x2d1256[_0xbb43('0x34')]=_['keys'](_0x2ea37b['query']);_0x2d1256[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x2d1256['model'],_0x2d1256[_0xbb43('0x34')]);_0x3f48a1[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x2d1256[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2ea37b[_0xbb43('0x34')][_0xbb43('0x36')]));_0x3f48a1['attributes']=_0x3f48a1[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3f48a1['attributes']:_0x2d1256[_0xbb43('0x31')];if(_0x2ea37b[_0xbb43('0x34')]['includeAll']){_0x3f48a1[_0xbb43('0x46')]=[{'all':!![]}];}_0x3f48a1=_[_0xbb43('0x3f')]({},_0x3f48a1,_0x2ea37b[_0xbb43('0x47')]);return db[_0xbb43('0x2c')][_0xbb43('0x48')](_0x3f48a1)[_0xbb43('0x23')](handleEntityNotFound(_0x41fed6,null))[_0xbb43('0x23')](respondWithResult(_0x41fed6,null))[_0xbb43('0x49')](handleError(_0x41fed6,null));};exports[_0xbb43('0x4a')]=function(_0x2f044f,_0x38cc4d){return db[_0xbb43('0x2c')]['create'](_0x2f044f[_0xbb43('0x4b')],{})[_0xbb43('0x23')](function(_0x50096a){var _0x7089bb=_0x2f044f['user'][_0xbb43('0x25')]({'plain':!![]});if(!_0x7089bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7089bb[_0xbb43('0x4c')]==='user'){var _0x21f78b=_0x50096a[_0xbb43('0x25')]({'plain':!![]});var _0x26586c='Tags';return db[_0xbb43('0x4d')][_0xbb43('0x48')]({'where':{'name':_0x26586c,'userProfileId':_0x7089bb[_0xbb43('0x4e')]},'raw':!![]})['then'](function(_0xd485c7){if(_0xd485c7&&_0xd485c7[_0xbb43('0x4f')]===0x0){return db['UserProfileResource'][_0xbb43('0x4a')]({'name':_0x21f78b['name'],'resourceId':_0x21f78b['id'],'type':_0xd485c7[_0xbb43('0x28')],'sectionId':_0xd485c7['id']},{})[_0xbb43('0x23')](function(){return _0x50096a;});}else{return _0x50096a;}})['catch'](function(_0x13731d){logger[_0xbb43('0x50')](_0xbb43('0x51'),_0x13731d);throw _0x13731d;});}return _0x50096a;})['then'](respondWithResult(_0x38cc4d,0xc9))[_0xbb43('0x49')](handleError(_0x38cc4d,null));};exports['update']=function(_0x3433ff,_0x451007){if(_0x3433ff[_0xbb43('0x4b')]['id']){delete _0x3433ff['body']['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x3433ff['params']['id']}})['then'](handleEntityNotFound(_0x451007,null))[_0xbb43('0x23')](saveUpdates(_0x3433ff[_0xbb43('0x4b')],null))['then'](respondWithResult(_0x451007,null))['catch'](handleError(_0x451007,null));};exports[_0xbb43('0x24')]=function(_0x51ca4f,_0x30908e){return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x51ca4f['params']['id']}})['then'](handleEntityNotFound(_0x30908e,null))['then'](removeEntity(_0x30908e,null))['catch'](handleError(_0x30908e,null));}; \ No newline at end of file +var _0xda65=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','stack','name','send','index','map','Tag','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','attributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xda65,0x1d0));var _0x5da6=function(_0x4e4d3b,_0x37aaa0){_0x4e4d3b=_0x4e4d3b-0x0;var _0x872a82=_0xda65[_0x4e4d3b];return _0x872a82;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require(_0x5da6('0x1'));var zipdir=require(_0x5da6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5da6('0x3'));var moment=require(_0x5da6('0x4'));var BPromise=require(_0x5da6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5da6('0x6'));var sox=require(_0x5da6('0x7'));var csv=require(_0x5da6('0x8'));var ejs=require(_0x5da6('0x9'));var fs=require('fs');var fs_extra=require(_0x5da6('0xa'));var _=require('lodash');var squel=require(_0x5da6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5da6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5da6('0xd'));var Papa=require(_0x5da6('0xe'));var Redis=require(_0x5da6('0xf'));var authService=require(_0x5da6('0x10'));var qs=require(_0x5da6('0x11'));var as=require(_0x5da6('0x12'));var hardwareService=require(_0x5da6('0x13'));var logger=require(_0x5da6('0x14'))('api');var utils=require(_0x5da6('0x15'));var config=require(_0x5da6('0x16'));var licenseUtil=require(_0x5da6('0x17'));var db=require(_0x5da6('0x18'))['db'];function respondWithStatusCode(_0x3500c6,_0x40ace1){_0x40ace1=_0x40ace1||0xcc;return function(_0x351340){if(_0x351340){return _0x3500c6[_0x5da6('0x19')](_0x40ace1);}return _0x3500c6[_0x5da6('0x1a')](_0x40ace1)['end']();};}function respondWithResult(_0x423665,_0x3e4dd6){_0x3e4dd6=_0x3e4dd6||0xc8;return function(_0xdb1066){if(_0xdb1066){return _0x423665[_0x5da6('0x1a')](_0x3e4dd6)[_0x5da6('0x1b')](_0xdb1066);}};}function respondWithFilteredResult(_0x47798b,_0x32a16a){return function(_0x1c28b7){if(_0x1c28b7){var _0x4f594e=typeof _0x32a16a[_0x5da6('0x1c')]==='undefined'&&typeof _0x32a16a['limit']===_0x5da6('0x1d');var _0x31b743=_0x1c28b7[_0x5da6('0x1e')];var _0x4c3b2d=_0x4f594e?0x0:_0x32a16a[_0x5da6('0x1c')];var _0x4b42e4=_0x4f594e?_0x1c28b7[_0x5da6('0x1e')]:_0x32a16a[_0x5da6('0x1c')]+_0x32a16a[_0x5da6('0x1f')];var _0x3c93e2;if(_0x4b42e4>=_0x31b743){_0x4b42e4=_0x31b743;_0x3c93e2=0xc8;}else{_0x3c93e2=0xce;}_0x47798b['status'](_0x3c93e2);return _0x47798b[_0x5da6('0x20')](_0x5da6('0x21'),_0x4c3b2d+'-'+_0x4b42e4+'/'+_0x31b743)[_0x5da6('0x1b')](_0x1c28b7);}return null;};}function patchUpdates(_0x24500d){return function(_0x747f9f){try{jsonpatch[_0x5da6('0x22')](_0x747f9f,_0x24500d,!![]);}catch(_0x163f8a){return BPromise[_0x5da6('0x23')](_0x163f8a);}return _0x747f9f['save']();};}function saveUpdates(_0x317cdb,_0x5ad81b){return function(_0x92171e){if(_0x92171e){return _0x92171e[_0x5da6('0x24')](_0x317cdb)[_0x5da6('0x25')](function(_0xdbaece){return _0xdbaece;});}return null;};}function removeEntity(_0x115098,_0x22b261){return function(_0x1d394e){if(_0x1d394e){return _0x1d394e[_0x5da6('0x26')]()['then'](function(){var _0x51a428=_0x1d394e[_0x5da6('0x27')]({'plain':!![]});var _0x256073='Tags';return db['UserProfileResource'][_0x5da6('0x26')]({'where':{'type':_0x256073,'resourceId':_0x51a428['id']}})[_0x5da6('0x25')](function(){return _0x1d394e;});})[_0x5da6('0x25')](function(){_0x115098[_0x5da6('0x1a')](0xcc)[_0x5da6('0x28')]();});}};}function handleEntityNotFound(_0x495138,_0x471873){return function(_0x1bc214){if(!_0x1bc214){_0x495138[_0x5da6('0x19')](0x194);}return _0x1bc214;};}function handleError(_0x573b0c,_0x41dab8){_0x41dab8=_0x41dab8||0x1f4;return function(_0x2b3be1){logger['error'](_0x2b3be1[_0x5da6('0x29')]);if(_0x2b3be1[_0x5da6('0x2a')]){delete _0x2b3be1[_0x5da6('0x2a')];}_0x573b0c[_0x5da6('0x1a')](_0x41dab8)[_0x5da6('0x2b')](_0x2b3be1);};}exports[_0x5da6('0x2c')]=function(_0x26cb1a,_0x25e8ae){var _0x46541d={},_0x46ed01={},_0x24149d={'count':0x0,'rows':[]};var _0x19dc67=_[_0x5da6('0x2d')](db[_0x5da6('0x2e')]['rawAttributes'],function(_0x42af0d){return{'name':_0x42af0d[_0x5da6('0x2f')],'type':_0x42af0d[_0x5da6('0x30')]['key']};});_0x46ed01[_0x5da6('0x31')]=_[_0x5da6('0x2d')](_0x19dc67,_0x5da6('0x2a'));_0x46ed01[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x26cb1a[_0x5da6('0x32')]);_0x46ed01[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x46ed01[_0x5da6('0x31')],_0x46ed01['query']);_0x46541d['attributes']=_[_0x5da6('0x35')](_0x46ed01['model'],qs['fields'](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x36')]));_0x46541d['attributes']=_0x46541d['attributes'][_0x5da6('0x37')]?_0x46541d['attributes']:_0x46ed01['model'];if(!_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x38')]('nolimit')){_0x46541d[_0x5da6('0x1f')]=qs[_0x5da6('0x1f')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1f')]);_0x46541d['offset']=qs[_0x5da6('0x1c')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x1c')]);}_0x46541d['order']=qs[_0x5da6('0x39')](_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x39')]);_0x46541d[_0x5da6('0x3a')]=qs[_0x5da6('0x34')](_[_0x5da6('0x3b')](_0x26cb1a['query'],_0x46ed01[_0x5da6('0x34')]),_0x19dc67);if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]){_0x46541d['where']=_['merge'](_0x46541d['where'],{'$or':_[_0x5da6('0x2d')](_0x19dc67,function(_0x4ffe15){if(_0x4ffe15[_0x5da6('0x30')]!=='VIRTUAL'){var _0x2afd1e={};_0x2afd1e[_0x4ffe15['name']]={'$like':'%'+_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3c')]+'%'};return _0x2afd1e;}})});}_0x46541d=_['merge']({},_0x46541d,_0x26cb1a[_0x5da6('0x3d')]);var _0x4255ae={'where':_0x46541d[_0x5da6('0x3a')]};return db[_0x5da6('0x2e')][_0x5da6('0x1e')](_0x4255ae)[_0x5da6('0x25')](function(_0x2de3e7){_0x24149d[_0x5da6('0x1e')]=_0x2de3e7;if(_0x26cb1a[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x46541d[_0x5da6('0x3f')]=[{'all':!![]}];}return db[_0x5da6('0x2e')][_0x5da6('0x40')](_0x46541d);})[_0x5da6('0x25')](function(_0x9d38b0){_0x24149d[_0x5da6('0x41')]=_0x9d38b0;return _0x24149d;})[_0x5da6('0x25')](respondWithFilteredResult(_0x25e8ae,_0x46541d))['catch'](handleError(_0x25e8ae,null));};exports[_0x5da6('0x42')]=function(_0x313a24,_0xf9cfa5){var _0x3cac43={'raw':!![],'where':{'id':_0x313a24[_0x5da6('0x43')]['id']}},_0x5e01d2={};_0x5e01d2[_0x5da6('0x31')]=_[_0x5da6('0x33')](db[_0x5da6('0x2e')]['rawAttributes']);_0x5e01d2[_0x5da6('0x32')]=_[_0x5da6('0x33')](_0x313a24[_0x5da6('0x32')]);_0x5e01d2[_0x5da6('0x34')]=_[_0x5da6('0x35')](_0x5e01d2[_0x5da6('0x31')],_0x5e01d2[_0x5da6('0x32')]);_0x3cac43[_0x5da6('0x44')]=_[_0x5da6('0x35')](_0x5e01d2['model'],qs[_0x5da6('0x36')](_0x313a24[_0x5da6('0x32')][_0x5da6('0x36')]));_0x3cac43['attributes']=_0x3cac43['attributes'][_0x5da6('0x37')]?_0x3cac43[_0x5da6('0x44')]:_0x5e01d2[_0x5da6('0x31')];if(_0x313a24[_0x5da6('0x32')][_0x5da6('0x3e')]){_0x3cac43['include']=[{'all':!![]}];}_0x3cac43=_['merge']({},_0x3cac43,_0x313a24['options']);return db[_0x5da6('0x2e')][_0x5da6('0x45')](_0x3cac43)[_0x5da6('0x25')](handleEntityNotFound(_0xf9cfa5,null))[_0x5da6('0x25')](respondWithResult(_0xf9cfa5,null))[_0x5da6('0x46')](handleError(_0xf9cfa5,null));};exports[_0x5da6('0x47')]=function(_0x4a8da1,_0xce1fdc){return db[_0x5da6('0x2e')][_0x5da6('0x47')](_0x4a8da1['body'],{})['then'](function(_0xf77d73){var _0x375ea8=_0x4a8da1['user'][_0x5da6('0x27')]({'plain':!![]});if(!_0x375ea8)throw new Error(_0x5da6('0x48'));if(_0x375ea8[_0x5da6('0x49')]==='user'){var _0x2c90e2=_0xf77d73['get']({'plain':!![]});var _0xabf041=_0x5da6('0x4a');return db[_0x5da6('0x4b')][_0x5da6('0x45')]({'where':{'name':_0xabf041,'userProfileId':_0x375ea8[_0x5da6('0x4c')]},'raw':!![]})[_0x5da6('0x25')](function(_0x3e936a){if(_0x3e936a&&_0x3e936a[_0x5da6('0x4d')]===0x0){return db[_0x5da6('0x4e')][_0x5da6('0x47')]({'name':_0x2c90e2[_0x5da6('0x2a')],'resourceId':_0x2c90e2['id'],'type':_0x3e936a[_0x5da6('0x2a')],'sectionId':_0x3e936a['id']},{})['then'](function(){return _0xf77d73;});}else{return _0xf77d73;}})[_0x5da6('0x46')](function(_0x467b0e){logger['error'](_0x5da6('0x4f'),_0x467b0e);throw _0x467b0e;});}return _0xf77d73;})[_0x5da6('0x25')](respondWithResult(_0xce1fdc,0xc9))[_0x5da6('0x46')](handleError(_0xce1fdc,null));};exports[_0x5da6('0x24')]=function(_0x4d3141,_0x4bea76){if(_0x4d3141['body']['id']){delete _0x4d3141[_0x5da6('0x50')]['id'];}return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4d3141['params']['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x4bea76,null))[_0x5da6('0x25')](saveUpdates(_0x4d3141[_0x5da6('0x50')],null))[_0x5da6('0x25')](respondWithResult(_0x4bea76,null))[_0x5da6('0x46')](handleError(_0x4bea76,null));};exports[_0x5da6('0x26')]=function(_0x4bc620,_0x23fe40){return db[_0x5da6('0x2e')][_0x5da6('0x45')]({'where':{'id':_0x4bc620[_0x5da6('0x43')]['id']}})[_0x5da6('0x25')](handleEntityNotFound(_0x23fe40,null))[_0x5da6('0x25')](removeEntity(_0x23fe40,null))[_0x5da6('0x46')](handleError(_0x23fe40,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 82082fa..107fdc1 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 _0x2ffa=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x49b8a5,_0x54c960){var _0x2febbf=function(_0xe68e1d){while(--_0xe68e1d){_0x49b8a5['push'](_0x49b8a5['shift']());}};_0x2febbf(++_0x54c960);}(_0x2ffa,0x16e));var _0xa2ff=function(_0x3b899d,_0x416add){_0x3b899d=_0x3b899d-0x0;var _0x5691bf=_0x2ffa[_0x3b899d];return _0x5691bf;};'use strict';var _=require(_0xa2ff('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa2ff('0x1'));var BPromise=require(_0xa2ff('0x2'));var rp=require(_0xa2ff('0x3'));var fs=require('fs');var path=require(_0xa2ff('0x4'));var rimraf=require(_0xa2ff('0x5'));var config=require(_0xa2ff('0x6'));var attributes=require(_0xa2ff('0x7'));module[_0xa2ff('0x8')]=function(_0x48c9bc,_0x41a4b7){return _0x48c9bc[_0xa2ff('0x9')](_0xa2ff('0xa'),attributes,{'tableName':_0xa2ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd06e=['Tag','tools_tags','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0xd06e,0x122));var _0xed06=function(_0xd77ced,_0x4c419d){_0xd77ced=_0xd77ced-0x0;var _0x4bb0a1=_0xd06e[_0xd77ced];return _0x4bb0a1;};'use strict';var _=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var logger=require('../../config/logger')(_0xed06('0x2'));var moment=require(_0xed06('0x3'));var BPromise=require('bluebird');var rp=require(_0xed06('0x4'));var fs=require('fs');var path=require(_0xed06('0x5'));var rimraf=require(_0xed06('0x6'));var config=require(_0xed06('0x7'));var attributes=require(_0xed06('0x8'));module[_0xed06('0x9')]=function(_0x26d0b9,_0x455e03){return _0x26d0b9['define'](_0xed06('0xa'),attributes,{'tableName':_0xed06('0xb'),'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 5c76172..dd818cd 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 _0x66fa=['../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a9fa8,_0x39871c){var _0x2c8445=function(_0x3ffb6e){while(--_0x3ffb6e){_0x5a9fa8['push'](_0x5a9fa8['shift']());}};_0x2c8445(++_0x39871c);}(_0x66fa,0x168));var _0xa66f=function(_0x571969,_0xc8101c){_0x571969=_0x571969-0x0;var _0xe31cb4=_0x66fa[_0x571969];return _0xe31cb4;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var jayson=require(_0xa66f('0x9'));var client=jayson[_0xa66f('0xa')][_0xa66f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33bd0d,_0x150f73,_0x5b7cf7){return new BPromise(function(_0x1cf624,_0x5ec156){return client[_0xa66f('0xc')](_0x33bd0d,_0x5b7cf7)[_0xa66f('0xd')](function(_0x5ad336){logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,_0xa66f('0x10'));logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x150f73,_0xa66f('0x10'),JSON['stringify'](_0x5ad336));if(_0x5ad336['error']){if(_0x5ad336[_0xa66f('0x13')]['code']===0x1f4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')]['message']);return _0x5ec156(_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);}logger['error'](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);return _0x1cf624(_0x5ad336[_0xa66f('0x13')]['message']);}else{logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,'request\x20sent');_0x1cf624(_0x5ad336[_0xa66f('0x15')][_0xa66f('0x14')]);}})[_0xa66f('0x16')](function(_0x76af81){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x76af81);_0x5ec156(_0x76af81);});});} \ No newline at end of file +var _0x4c6d=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x498e63,_0x3191cc){var _0x59b8d7=function(_0x345334){while(--_0x345334){_0x498e63['push'](_0x498e63['shift']());}};_0x59b8d7(++_0x3191cc);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2fa781,_0x3484fa){_0x2fa781=_0x2fa781-0x0;var _0x25f8fe=_0x4c6d[_0x2fa781];return _0x25f8fe;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var moment=require(_0xd4c6('0x2'));var BPromise=require(_0xd4c6('0x3'));var rs=require(_0xd4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c6('0x5'))['db'];var utils=require(_0xd4c6('0x6'));var logger=require(_0xd4c6('0x7'))('rpc');var config=require(_0xd4c6('0x8'));var jayson=require(_0xd4c6('0x9'));var client=jayson['client'][_0xd4c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316314,_0x4329e3,_0x5d4fce){return new BPromise(function(_0x440ee3,_0x19ce1c){return client[_0xd4c6('0xb')](_0x316314,_0x5d4fce)['then'](function(_0xe2f90b){logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,'request\x20sent');logger[_0xd4c6('0xe')](_0xd4c6('0xf'),_0x4329e3,_0xd4c6('0x10'),JSON[_0xd4c6('0x11')](_0xe2f90b));if(_0xe2f90b[_0xd4c6('0x12')]){if(_0xe2f90b[_0xd4c6('0x12')]['code']===0x1f4){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b['error'][_0xd4c6('0x13')]);return _0x19ce1c(_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);}logger[_0xd4c6('0x12')](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);return _0x440ee3(_0xe2f90b['error']['message']);}else{logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,_0xd4c6('0x10'));_0x440ee3(_0xe2f90b[_0xd4c6('0x14')][_0xd4c6('0x13')]);}})[_0xd4c6('0x15')](function(_0xe52075){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe52075);_0x19ce1c(_0xe52075);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index e88cb1a..73de56a 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 d9c031b..63c66e5 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 _0x0713=['STRING','name'];(function(_0x5d6223,_0x56bd7a){var _0x39ef33=function(_0x3171fd){while(--_0x3171fd){_0x5d6223['push'](_0x5d6223['shift']());}};_0x39ef33(++_0x56bd7a);}(_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 _0xb10b=['name','sequelize','STRING'];(function(_0x2985b4,_0x83d973){var _0x1948a3=function(_0x1727fb){while(--_0x1727fb){_0x2985b4['push'](_0x2985b4['shift']());}};_0x1948a3(++_0x83d973);}(_0xb10b,0x12a));var _0xbb10=function(_0x32179c,_0x32fb68){_0x32179c=_0x32179c-0x0;var _0xad3766=_0xb10b[_0x32179c];return _0xad3766;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f339533..3b05739 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 _0x3a85=['nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','count','then','includeAll','include','findAll','rows','show','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','catch','body','find','params','destroy','transaction','sequelize','Sequelize','SELECT','UserId','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Fax','through','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','removeAgents','Sms','Openchannel','Whatsapp','Queue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','limit','offset','set','Content-Range','json','apply','reject','update','error','name','send','index','map','Team','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x3fb495,_0x24379a){var _0x1aa39f=function(_0xedd012){while(--_0xedd012){_0x3fb495['push'](_0x3fb495['shift']());}};_0x1aa39f(++_0x24379a);}(_0x3a85,0x64));var _0x53a8=function(_0x343187,_0x18f3b6){_0x343187=_0x343187-0x0;var _0xd86880=_0x3a85[_0x343187];return _0xd86880;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53a8('0x1'));var rp=require(_0x53a8('0x2'));var moment=require(_0x53a8('0x3'));var BPromise=require(_0x53a8('0x4'));var Mustache=require('mustache');var util=require(_0x53a8('0x5'));var path=require(_0x53a8('0x6'));var sox=require(_0x53a8('0x7'));var csv=require(_0x53a8('0x8'));var ejs=require(_0x53a8('0x9'));var fs=require('fs');var fs_extra=require(_0x53a8('0xa'));var _=require(_0x53a8('0xb'));var squel=require(_0x53a8('0xc'));var crypto=require(_0x53a8('0xd'));var jsforce=require(_0x53a8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53a8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53a8('0x11'));var logger=require(_0x53a8('0x12'))(_0x53a8('0x13'));var utils=require('../../config/utils');var config=require(_0x53a8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x53a8('0x15'))['db'];config[_0x53a8('0x16')]=_[_0x53a8('0x17')](config[_0x53a8('0x16')],{'host':_0x53a8('0x18'),'port':0x18eb});var socket=require(_0x53a8('0x19'))(new Redis(config[_0x53a8('0x16')]));require(_0x53a8('0x1a'))[_0x53a8('0x1b')](socket);function respondWithStatusCode(_0x15ddec,_0x303ea7){_0x303ea7=_0x303ea7||0xcc;return function(_0x1236fb){if(_0x1236fb){return _0x15ddec[_0x53a8('0x1c')](_0x303ea7);}return _0x15ddec[_0x53a8('0x1d')](_0x303ea7)[_0x53a8('0x1e')]();};}function respondWithResult(_0x5abc38,_0x4b621e){_0x4b621e=_0x4b621e||0xc8;return function(_0xbfd3f2){if(_0xbfd3f2){return _0x5abc38[_0x53a8('0x1d')](_0x4b621e)['json'](_0xbfd3f2);}};}function respondWithFilteredResult(_0x528151,_0x29a54a){return function(_0x51e9f9){if(_0x51e9f9){var _0x2b2196=typeof _0x29a54a['offset']==='undefined'&&typeof _0x29a54a[_0x53a8('0x1f')]==='undefined';var _0x285ff1=_0x51e9f9['count'];var _0x94bc6b=_0x2b2196?0x0:_0x29a54a[_0x53a8('0x20')];var _0x14119c=_0x2b2196?_0x51e9f9['count']:_0x29a54a[_0x53a8('0x20')]+_0x29a54a[_0x53a8('0x1f')];var _0xa7742e;if(_0x14119c>=_0x285ff1){_0x14119c=_0x285ff1;_0xa7742e=0xc8;}else{_0xa7742e=0xce;}_0x528151[_0x53a8('0x1d')](_0xa7742e);return _0x528151[_0x53a8('0x21')](_0x53a8('0x22'),_0x94bc6b+'-'+_0x14119c+'/'+_0x285ff1)[_0x53a8('0x23')](_0x51e9f9);}return null;};}function patchUpdates(_0x165ea2){return function(_0x491c59){try{jsonpatch[_0x53a8('0x24')](_0x491c59,_0x165ea2,!![]);}catch(_0x54fd5f){return BPromise[_0x53a8('0x25')](_0x54fd5f);}return _0x491c59['save']();};}function saveUpdates(_0x248abc,_0x59a65c){return function(_0x42e8a6){if(_0x42e8a6){return _0x42e8a6[_0x53a8('0x26')](_0x248abc)['then'](function(_0x5e9ec5){return _0x5e9ec5;});}return null;};}function handleEntityNotFound(_0x2f88b6,_0x2279a4){return function(_0x9b14e3){if(!_0x9b14e3){_0x2f88b6['sendStatus'](0x194);}return _0x9b14e3;};}function handleError(_0xdc9c7f,_0x2ea09b){_0x2ea09b=_0x2ea09b||0x1f4;return function(_0x77ea1f){logger[_0x53a8('0x27')](_0x77ea1f['stack']);if(_0x77ea1f[_0x53a8('0x28')]){delete _0x77ea1f['name'];}_0xdc9c7f[_0x53a8('0x1d')](_0x2ea09b)[_0x53a8('0x29')](_0x77ea1f);};}exports[_0x53a8('0x2a')]=function(_0x38a22a,_0x13407d){var _0x3dc0cc={},_0x1c139d={},_0x7fa5d={'count':0x0,'rows':[]};var _0x3b80e4=_[_0x53a8('0x2b')](db[_0x53a8('0x2c')][_0x53a8('0x2d')],function(_0x4eb5e9){return{'name':_0x4eb5e9['fieldName'],'type':_0x4eb5e9['type'][_0x53a8('0x2e')]};});_0x1c139d[_0x53a8('0x2f')]=_['map'](_0x3b80e4,_0x53a8('0x28'));_0x1c139d[_0x53a8('0x30')]=_[_0x53a8('0x31')](_0x38a22a[_0x53a8('0x30')]);_0x1c139d['filters']=_[_0x53a8('0x32')](_0x1c139d[_0x53a8('0x2f')],_0x1c139d[_0x53a8('0x30')]);_0x3dc0cc[_0x53a8('0x33')]=_[_0x53a8('0x32')](_0x1c139d[_0x53a8('0x2f')],qs['fields'](_0x38a22a[_0x53a8('0x30')][_0x53a8('0x34')]));_0x3dc0cc['attributes']=_0x3dc0cc[_0x53a8('0x33')]['length']?_0x3dc0cc[_0x53a8('0x33')]:_0x1c139d['model'];if(!_0x38a22a[_0x53a8('0x30')][_0x53a8('0x35')](_0x53a8('0x36'))){_0x3dc0cc[_0x53a8('0x1f')]=qs[_0x53a8('0x1f')](_0x38a22a[_0x53a8('0x30')]['limit']);_0x3dc0cc[_0x53a8('0x20')]=qs['offset'](_0x38a22a['query'][_0x53a8('0x20')]);}_0x3dc0cc[_0x53a8('0x37')]=qs[_0x53a8('0x38')](_0x38a22a['query']['sort']);_0x3dc0cc[_0x53a8('0x39')]=qs[_0x53a8('0x3a')](_[_0x53a8('0x3b')](_0x38a22a[_0x53a8('0x30')],_0x1c139d[_0x53a8('0x3a')]),_0x3b80e4);if(_0x38a22a['query']['filter']){_0x3dc0cc[_0x53a8('0x39')]=_[_0x53a8('0x3c')](_0x3dc0cc['where'],{'$or':_['map'](_0x3b80e4,function(_0x482f7a){if(_0x482f7a[_0x53a8('0x3d')]!==_0x53a8('0x3e')){var _0x493f27={};_0x493f27[_0x482f7a[_0x53a8('0x28')]]={'$like':'%'+_0x38a22a[_0x53a8('0x30')][_0x53a8('0x3f')]+'%'};return _0x493f27;}})});}_0x3dc0cc=_[_0x53a8('0x3c')]({},_0x3dc0cc,_0x38a22a[_0x53a8('0x40')]);var _0x16cd1f={'where':_0x3dc0cc[_0x53a8('0x39')]};return db[_0x53a8('0x2c')][_0x53a8('0x41')](_0x16cd1f)[_0x53a8('0x42')](function(_0x5947a9){_0x7fa5d[_0x53a8('0x41')]=_0x5947a9;if(_0x38a22a[_0x53a8('0x30')][_0x53a8('0x43')]){_0x3dc0cc[_0x53a8('0x44')]=[{'all':!![]}];}return db['Team'][_0x53a8('0x45')](_0x3dc0cc);})[_0x53a8('0x42')](function(_0xc390fa){_0x7fa5d[_0x53a8('0x46')]=_0xc390fa;return _0x7fa5d;})[_0x53a8('0x42')](respondWithFilteredResult(_0x13407d,_0x3dc0cc))['catch'](handleError(_0x13407d,null));};exports[_0x53a8('0x47')]=function(_0x4b413e,_0x2e11b8){var _0x1fcbeb={'raw':![],'where':{'id':_0x4b413e['params']['id']}},_0x37023e={};_0x37023e[_0x53a8('0x2f')]=_['keys'](db[_0x53a8('0x2c')][_0x53a8('0x2d')]);_0x37023e[_0x53a8('0x30')]=_[_0x53a8('0x31')](_0x4b413e['query']);_0x37023e[_0x53a8('0x3a')]=_[_0x53a8('0x32')](_0x37023e['model'],_0x37023e[_0x53a8('0x30')]);_0x1fcbeb[_0x53a8('0x33')]=_['intersection'](_0x37023e[_0x53a8('0x2f')],qs[_0x53a8('0x34')](_0x4b413e[_0x53a8('0x30')][_0x53a8('0x34')]));_0x1fcbeb['attributes']=_0x1fcbeb[_0x53a8('0x33')][_0x53a8('0x48')]?_0x1fcbeb[_0x53a8('0x33')]:_0x37023e[_0x53a8('0x2f')];if(_0x4b413e[_0x53a8('0x30')][_0x53a8('0x43')]){_0x1fcbeb['include']=[{'all':!![]}];}_0x1fcbeb=_['merge']({},_0x1fcbeb,_0x4b413e['options']);return db[_0x53a8('0x2c')]['find'](_0x1fcbeb)[_0x53a8('0x42')](handleEntityNotFound(_0x2e11b8,null))[_0x53a8('0x42')](respondWithResult(_0x2e11b8,null))['catch'](handleError(_0x2e11b8,null));};exports[_0x53a8('0x49')]=function(_0x1fafe2,_0x542d81){return db['Team'][_0x53a8('0x49')](_0x1fafe2['body'],{})[_0x53a8('0x42')](function(_0x2525bf){var _0x132ff1=_0x1fafe2[_0x53a8('0x4a')][_0x53a8('0x4b')]({'plain':!![]});if(!_0x132ff1)throw new Error(_0x53a8('0x4c'));if(_0x132ff1[_0x53a8('0x4d')]===_0x53a8('0x4a')){var _0x3c9ffb=_0x2525bf['get']({'plain':!![]});var _0x2a3cd2=_0x53a8('0x4e');return db[_0x53a8('0x4f')]['find']({'where':{'name':_0x2a3cd2,'userProfileId':_0x132ff1['userProfileId']},'raw':!![]})[_0x53a8('0x42')](function(_0x83d61b){if(_0x83d61b&&_0x83d61b[_0x53a8('0x50')]===0x0){return db[_0x53a8('0x51')][_0x53a8('0x49')]({'name':_0x3c9ffb[_0x53a8('0x28')],'resourceId':_0x3c9ffb['id'],'type':_0x83d61b[_0x53a8('0x28')],'sectionId':_0x83d61b['id']},{})['then'](function(){return _0x2525bf;});}else{return _0x2525bf;}})[_0x53a8('0x52')](function(_0x37774e){logger[_0x53a8('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37774e);throw _0x37774e;});}return _0x2525bf;})[_0x53a8('0x42')](respondWithResult(_0x542d81,0xc9))[_0x53a8('0x52')](handleError(_0x542d81,null));};exports[_0x53a8('0x26')]=function(_0x4eac69,_0x40757d){if(_0x4eac69[_0x53a8('0x53')]['id']){delete _0x4eac69[_0x53a8('0x53')]['id'];}return db[_0x53a8('0x2c')][_0x53a8('0x54')]({'where':{'id':_0x4eac69[_0x53a8('0x55')]['id']}})[_0x53a8('0x42')](handleEntityNotFound(_0x40757d,null))['then'](saveUpdates(_0x4eac69[_0x53a8('0x53')],null))[_0x53a8('0x42')](respondWithResult(_0x40757d,null))[_0x53a8('0x52')](handleError(_0x40757d,null));};exports[_0x53a8('0x56')]=function(_0x55ba26,_0x58d1d5){var _0x1cf29d=_0x55ba26[_0x53a8('0x55')]['id'];var _0x7c6982=[];return db['sequelize'][_0x53a8('0x57')](function(_0x483fbb){var _0x4e4cd4='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1cf29d;return db[_0x53a8('0x58')][_0x53a8('0x30')](_0x4e4cd4,{'type':db[_0x53a8('0x59')]['QueryTypes'][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb})[_0x53a8('0x42')](function(_0x776128){_0x7c6982=_[_0x53a8('0x2b')](_0x776128,function(_0x330249){return Number(_0x330249[_0x53a8('0x5b')]);});})[_0x53a8('0x42')](function(){var _0x5f4059='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1cf29d;return db['sequelize']['query'](_0x5f4059,{'type':db[_0x53a8('0x59')][_0x53a8('0x5c')]['SELECT'],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x5f5586){var _0x257b65=_['map'](_0x5f5586,function(_0x124551){return Number(_0x124551[_0x53a8('0x5d')]);});return db[_0x53a8('0x5e')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'VoiceQueueId':{'$in':_0x257b65}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0x130c6b=_0x53a8('0x5f')+_0x1cf29d;return db[_0x53a8('0x58')][_0x53a8('0x30')](_0x130c6b,{'type':db[_0x53a8('0x59')]['QueryTypes'][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0xec6f14){var _0x24b3a7=_['map'](_0xec6f14,function(_0x469884){return Number(_0x469884[_0x53a8('0x60')]);});return db['UserMailQueue'][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'MailQueueId':{'$in':_0x24b3a7}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0x1de07c=_0x53a8('0x61')+_0x1cf29d;return db['sequelize'][_0x53a8('0x30')](_0x1de07c,{'type':db['Sequelize'][_0x53a8('0x5c')]['SELECT'],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x5ea2f8){var _0x1f2664=_['map'](_0x5ea2f8,function(_0xc6a833){return Number(_0xc6a833[_0x53a8('0x62')]);});return db[_0x53a8('0x63')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'SmsQueueId':{'$in':_0x1f2664}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0x561914=_0x53a8('0x64')+_0x1cf29d;return db['sequelize'][_0x53a8('0x30')](_0x561914,{'type':db[_0x53a8('0x59')][_0x53a8('0x5c')][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x8b712e){var _0x2b4d85=_[_0x53a8('0x2b')](_0x8b712e,function(_0x15f41b){return Number(_0x15f41b[_0x53a8('0x65')]);});return db[_0x53a8('0x66')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'ChatQueueId':{'$in':_0x2b4d85}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0x2d476e=_0x53a8('0x67')+_0x1cf29d;return db['sequelize'][_0x53a8('0x30')](_0x2d476e,{'type':db[_0x53a8('0x59')]['QueryTypes'][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x1d5fb7){var _0x2c4317=_['map'](_0x1d5fb7,function(_0x2822fa){return Number(_0x2822fa[_0x53a8('0x68')]);});return db[_0x53a8('0x69')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'FaxQueueId':{'$in':_0x2c4317}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0x1c00b1=_0x53a8('0x6a')+_0x1cf29d;return db[_0x53a8('0x58')]['query'](_0x1c00b1,{'type':db[_0x53a8('0x59')][_0x53a8('0x5c')][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x253b61){var _0x26828b=_[_0x53a8('0x2b')](_0x253b61,function(_0x67b1ed){return Number(_0x67b1ed[_0x53a8('0x6b')]);});return db[_0x53a8('0x6c')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'OpenchannelQueueId':{'$in':_0x26828b}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){var _0xc58b53=_0x53a8('0x6d')+_0x1cf29d;return db[_0x53a8('0x58')][_0x53a8('0x30')](_0xc58b53,{'type':db[_0x53a8('0x59')][_0x53a8('0x5c')][_0x53a8('0x5a')],'raw':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x401dbf){var _0x4a9a7d=_[_0x53a8('0x2b')](_0x401dbf,function(_0xde8820){return Number(_0xde8820[_0x53a8('0x6e')]);});return db[_0x53a8('0x6f')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'WhatsappQueueId':{'$in':_0x4a9a7d}},'transaction':_0x483fbb});})[_0x53a8('0x42')](function(){return db[_0x53a8('0x70')][_0x53a8('0x54')]({'where':{'TeamId':_0x1cf29d}});})[_0x53a8('0x42')](function(_0x51c34b){if(_0x51c34b===null){return;}return db[_0x53a8('0x71')][_0x53a8('0x56')]({'where':{'UserId':{'$in':_0x7c6982},'VoicePrefixId':_0x51c34b[_0x53a8('0x72')]},'transaction':_0x483fbb});})['then'](function(){return db[_0x53a8('0x2c')][_0x53a8('0x56')]({'where':{'id':_0x1cf29d},'cascade':!![],'transaction':_0x483fbb});})[_0x53a8('0x42')](function(_0x3f38e2){if(_0x3f38e2===0x0){_0x58d1d5[_0x53a8('0x1c')](0x194);}else{return db[_0x53a8('0x51')]['destroy']({'where':{'type':_0x53a8('0x4e'),'resourceId':_0x1cf29d},'cascade':!![],'transaction':_0x483fbb})[_0x53a8('0x42')](function(){_0x58d1d5[_0x53a8('0x1d')](0xcc)[_0x53a8('0x1e')]();});}})[_0x53a8('0x52')](function(_0x3cfa08){_0x58d1d5['status'](0x1f4)[_0x53a8('0x29')](_0x3cfa08);});});};exports['getQueues']=function(_0x894f6d,_0x2d5653,_0x593fd8){return db[_0x53a8('0x2c')]['findOne']({'where':{'id':_0x894f6d[_0x53a8('0x55')]['id']}})[_0x53a8('0x42')](handleEntityNotFound(_0x2d5653,null))[_0x53a8('0x42')](function(_0x1a073e){if(!_0x894f6d[_0x53a8('0x30')][_0x53a8('0x73')]||!utils[_0x53a8('0x74')](_0x894f6d[_0x53a8('0x30')][_0x53a8('0x73')])){throw new db[(_0x53a8('0x59'))][(_0x53a8('0x75'))](_0x53a8('0x76'));}var _0x10d828={};var _0x188885={};_0x188885[_0x53a8('0x2f')]=_[_0x53a8('0x31')](db[_[_0x53a8('0x77')](_0x894f6d[_0x53a8('0x30')][_0x53a8('0x73')][_0x53a8('0x78')]())+_0x53a8('0x79')][_0x53a8('0x2d')]);_0x188885[_0x53a8('0x30')]=_[_0x53a8('0x31')](_0x894f6d[_0x53a8('0x30')]);_0x188885[_0x53a8('0x3a')]=_[_0x53a8('0x32')](_0x188885[_0x53a8('0x2f')],_0x188885[_0x53a8('0x30')]);_0x10d828[_0x53a8('0x33')]=_[_0x53a8('0x32')](_0x188885['model'],qs[_0x53a8('0x34')](_0x894f6d['query'][_0x53a8('0x34')]));_0x10d828[_0x53a8('0x33')]=_0x10d828[_0x53a8('0x33')]['length']?_0x10d828[_0x53a8('0x33')]:_0x188885[_0x53a8('0x2f')];_0x10d828[_0x53a8('0x1f')]=qs[_0x53a8('0x1f')](_0x894f6d['query'][_0x53a8('0x1f')]);_0x10d828[_0x53a8('0x20')]=qs['offset'](_0x894f6d[_0x53a8('0x30')][_0x53a8('0x20')]);_0x10d828[_0x53a8('0x37')]=qs[_0x53a8('0x38')](_0x894f6d[_0x53a8('0x30')][_0x53a8('0x38')]);_0x10d828['where']=qs[_0x53a8('0x3a')](_[_0x53a8('0x3b')](_0x894f6d[_0x53a8('0x30')],_0x188885[_0x53a8('0x3a')]));_0x10d828=_['merge']({},_0x10d828,_0x894f6d[_0x53a8('0x40')]);return _0x1a073e[_0x53a8('0x4b')+_[_0x53a8('0x77')](_0x894f6d[_0x53a8('0x30')][_0x53a8('0x73')][_0x53a8('0x78')]())+_0x53a8('0x7a')](_0x10d828);})[_0x53a8('0x42')](respondWithResult(_0x2d5653,null))[_0x53a8('0x52')](handleError(_0x2d5653,null));};exports['addQueues']=function(_0xd23e02,_0x4f1bd6,_0x1be3c9){return db[_0x53a8('0x2c')][_0x53a8('0x7b')]({'where':{'id':_0xd23e02[_0x53a8('0x55')]['id']}})['then'](function(_0x97d7ad){if(_0x97d7ad){if(!_0xd23e02[_0x53a8('0x53')][_0x53a8('0x73')]||!utils['isValidChannel'](_0xd23e02[_0x53a8('0x53')]['channel'])){throw new db[(_0x53a8('0x59'))][(_0x53a8('0x75'))](_0x53a8('0x76'));}return _0x97d7ad[_0x53a8('0x7c')+_['capitalize'](_0xd23e02[_0x53a8('0x53')]['channel'][_0x53a8('0x78')]())+_0x53a8('0x7a')](_0xd23e02[_0x53a8('0x53')][_0x53a8('0x7d')]);}return null;})[_0x53a8('0x42')](handleEntityNotFound(_0x4f1bd6,null))[_0x53a8('0x42')](respondWithStatusCode(_0x4f1bd6,null))[_0x53a8('0x52')](handleError(_0x4f1bd6,null));};exports[_0x53a8('0x7e')]=function(_0x3b2193,_0x456e61,_0x4c15fc){return db['Team'][_0x53a8('0x7b')]({'where':{'id':_0x3b2193[_0x53a8('0x55')]['id']}})[_0x53a8('0x42')](function(_0x2825c3){if(_0x2825c3){if(!_0x3b2193[_0x53a8('0x30')]['channel']||!utils['isValidChannel'](_0x3b2193['query'][_0x53a8('0x73')])){throw new db['Sequelize'][(_0x53a8('0x75'))](_0x53a8('0x76'));}return _0x2825c3['remove'+_['capitalize'](_0x3b2193[_0x53a8('0x30')][_0x53a8('0x73')]['toLowerCase']())+_0x53a8('0x7a')](_0x3b2193['query'][_0x53a8('0x7d')]);}return null;})[_0x53a8('0x42')](handleEntityNotFound(_0x456e61,null))[_0x53a8('0x42')](respondWithStatusCode(_0x456e61,null))[_0x53a8('0x52')](handleError(_0x456e61,null));};exports[_0x53a8('0x7f')]=function(_0x54f61c,_0x4b83b9){var _0x37a192=_[_0x53a8('0x80')](_0x54f61c['body'][_0x53a8('0x7d')])?_0x54f61c[_0x53a8('0x53')][_0x53a8('0x7d')]:[_0x54f61c[_0x53a8('0x53')][_0x53a8('0x7d')]];var _0x6f8de6=_0x54f61c[_0x53a8('0x55')]['id'];return db['Team']['find']({'where':{'id':_0x6f8de6}})[_0x53a8('0x42')](handleEntityNotFound(_0x4b83b9,null))[_0x53a8('0x42')](function(_0x4def83){if(_0x4def83){var _0x4af5e8=[_0x53a8('0x81'),_0x53a8('0x82'),_0x53a8('0x83'),'Sms',_0x53a8('0x84'),'Openchannel','Whatsapp'];return db[_0x53a8('0x58')]['transaction'](function(_0xd31c46){var _0xdef0a4=_[_0x53a8('0x2b')](_0x4af5e8,function(_0x1054e1){var _0x355aa3={'attributes':['id',_0x53a8('0x28')]};if(_0x1054e1===_0x53a8('0x81')){_0x355aa3[_0x53a8('0x85')]={'attributes':['penalty']};}return _0x4def83['get'+_0x1054e1+_0x53a8('0x7a')](_0x355aa3)[_0x53a8('0x42')](function(_0x4ba47a){var _0x4907bd=_[_0x53a8('0x2b')](_0x4ba47a,function(_0x2c8ec4){var _0x2bdfc4=_[_0x53a8('0x2b')](_0x37a192,function(_0x27de77){var _0x35b4d6={'where':{'UserId':_0x27de77,[_0x1054e1+'QueueId']:_0x2c8ec4['id']},'transaction':_0xd31c46};if(_0x1054e1===_0x53a8('0x81')){_0x35b4d6[_0x53a8('0x17')]={'penalty':_0x2c8ec4[_0x53a8('0x86')][_0x53a8('0x87')]};}return db[_0x53a8('0x88')+_0x1054e1+'Queue'][_0x53a8('0x89')](_0x35b4d6)[_0x53a8('0x42')](function(){socket['emit'](_0x53a8('0x4a')+_0x1054e1+_0x53a8('0x8a'),{'UserId':_0x27de77,[_0x1054e1+_0x53a8('0x8b')]:_0x2c8ec4['id']});if(_0x1054e1!=='Voice'){return;}return db[_0x53a8('0x88')][_0x53a8('0x45')]({'where':{'id':_0x37a192,'online':0x1},'attributes':['id','name','online',_0x53a8('0x8c'),_0x53a8('0x8d')],'raw':!![]})[_0x53a8('0x42')](function(_0xf6ab5b){var _0x11401e=_[_0x53a8('0x2b')](_0xf6ab5b,function(_0x5a134d){return db[_0x53a8('0x8e')]['upsert']({'membername':_0x5a134d[_0x53a8('0x28')],'UserId':_0x5a134d['id'],'queue_name':_0x2c8ec4[_0x53a8('0x28')],'VoiceQueueId':_0x2c8ec4['id'],'interface':_[_0x53a8('0x8f')](_0x5a134d['interface'])?util[_0x53a8('0x90')](_0x53a8('0x91'),_0x5a134d[_0x53a8('0x28')]):_0x5a134d[_0x53a8('0x8d')],'paused':_0x5a134d['voicePause']||![],'penalty':_0x2c8ec4[_0x53a8('0x86')][_0x53a8('0x87')]},{'transaction':_0xd31c46});});return Promise[_0x53a8('0x92')](_0x11401e);});});});return Promise[_0x53a8('0x92')](_0x2bdfc4);});return Promise[_0x53a8('0x92')](_0x4907bd);})[_0x53a8('0x42')](function(){return db[_0x53a8('0x70')]['findOne']({'where':{'teamId':_0x6f8de6}})['then'](function(_0xb2e46b){if(_0xb2e46b){var _0x3ca026=_[_0x53a8('0x2b')](_0x37a192,function(_0x5c725f){db[_0x53a8('0x71')][_0x53a8('0x93')]({'UserId':_0x5c725f,'VoicePrefixId':_0xb2e46b['VoicePrefixId']});});return Promise[_0x53a8('0x92')](_0x3ca026);}});});});return Promise['all'](_0xdef0a4)['then'](function(){return _0x4def83['addAgents'](_0x37a192,{'transaction':_0xd31c46})['spread'](function(_0x5a9b7e){return _0x5a9b7e;});});});}})[_0x53a8('0x42')](respondWithResult(_0x4b83b9,null))['catch'](handleError(_0x4b83b9,null));};exports[_0x53a8('0x94')]=function(_0x320655,_0x2f846a){var _0x2ddbfb=_[_0x53a8('0x80')](_0x320655[_0x53a8('0x30')][_0x53a8('0x7d')])?_0x320655[_0x53a8('0x30')]['ids']:[_0x320655[_0x53a8('0x30')][_0x53a8('0x7d')]];var _0x5892b4=_0x320655[_0x53a8('0x55')]['id'];return db[_0x53a8('0x2c')][_0x53a8('0x54')]({'where':{'id':_0x5892b4}})[_0x53a8('0x42')](handleEntityNotFound(_0x2f846a,null))[_0x53a8('0x42')](function(_0x5e8082){if(_0x5e8082){var _0x1fe8f6=[_0x53a8('0x81'),_0x53a8('0x82'),_0x53a8('0x83'),_0x53a8('0x95'),_0x53a8('0x84'),_0x53a8('0x96'),_0x53a8('0x97')];return db[_0x53a8('0x58')][_0x53a8('0x57')](function(_0x195e51){var _0x3031dc=_[_0x53a8('0x2b')](_0x1fe8f6,function(_0x3739a4){var _0x486bb2={'attributes':['id',_0x53a8('0x28')]};return _0x5e8082[_0x53a8('0x4b')+_0x3739a4+'Queues'](_0x486bb2)[_0x53a8('0x42')](function(_0x412bfc){var _0x55a008=_[_0x53a8('0x2b')](_0x412bfc,function(_0xda6c7d){return _0xda6c7d[_0x53a8('0x94')](_0x2ddbfb,{'transaction':_0x195e51})[_0x53a8('0x42')](function(){var _0x17ce80=_[_0x53a8('0x2b')](_0x2ddbfb,function(_0x32595f){socket['emit']('user'+_0x3739a4+_0x53a8('0x98'),{'UserId':Number(_0x32595f),[_0x3739a4+_0x53a8('0x8b')]:_0xda6c7d['id']});if(_0x3739a4!==_0x53a8('0x81')){return;}return db[_0x53a8('0x8e')][_0x53a8('0x56')]({'where':{'VoiceQueueId':_0xda6c7d['id'],'UserId':_0x32595f},'transaction':_0x195e51});});return Promise[_0x53a8('0x92')](_0x17ce80);});});return Promise['all'](_0x55a008);});});return Promise['all'](_0x3031dc)['then'](function(){return _0x5e8082[_0x53a8('0x94')](_0x2ddbfb,{'transaction':_0x195e51});})[_0x53a8('0x42')](function(){return db['TeamVoicePrefix'][_0x53a8('0x7b')]({'where':{'teamId':_0x5892b4}})['then'](function(_0x35ed44){if(_0x35ed44){var _0x5358dc=_[_0x53a8('0x2b')](_0x2ddbfb,function(_0x581a61){db['UserVoicePrefix'][_0x53a8('0x56')]({'where':{'UserId':_0x581a61,'VoicePrefixId':_0x35ed44[_0x53a8('0x72')]}});});return Promise[_0x53a8('0x92')](_0x5358dc);}});});});}})[_0x53a8('0x42')](respondWithStatusCode(_0x2f846a,null))[_0x53a8('0x52')](handleError(_0x2f846a,null));};exports['getAgents']=function(_0x135539,_0x3022a4,_0x5dc3d0){var _0x227c04={};var _0x2588f9={};var _0x2c76cc;var _0x546cc5;return db[_0x53a8('0x2c')][_0x53a8('0x7b')]({'where':{'id':_0x135539['params']['id']}})[_0x53a8('0x42')](handleEntityNotFound(_0x3022a4,null))[_0x53a8('0x42')](function(_0x358aee){if(_0x358aee){_0x2c76cc=_0x358aee;_0x2588f9[_0x53a8('0x2f')]=_[_0x53a8('0x31')](db[_0x53a8('0x88')]['rawAttributes']);_0x2588f9[_0x53a8('0x30')]=_[_0x53a8('0x31')](_0x135539['query']);_0x2588f9['filters']=_[_0x53a8('0x32')](_0x2588f9[_0x53a8('0x2f')],_0x2588f9['query']);_0x227c04[_0x53a8('0x33')]=_['intersection'](_0x2588f9[_0x53a8('0x2f')],qs[_0x53a8('0x34')](_0x135539[_0x53a8('0x30')][_0x53a8('0x34')]));_0x227c04[_0x53a8('0x33')]=_0x227c04[_0x53a8('0x33')][_0x53a8('0x48')]?_0x227c04[_0x53a8('0x33')]:_0x2588f9['model'];_0x227c04['order']=qs[_0x53a8('0x38')](_0x135539[_0x53a8('0x30')][_0x53a8('0x38')]);_0x227c04[_0x53a8('0x39')]=qs['filters'](_[_0x53a8('0x3b')](_0x135539[_0x53a8('0x30')],_0x2588f9[_0x53a8('0x3a')]));if(_0x135539[_0x53a8('0x30')][_0x53a8('0x3f')]){_0x227c04[_0x53a8('0x39')]=_[_0x53a8('0x3c')](_0x227c04[_0x53a8('0x39')],{'$or':_[_0x53a8('0x2b')](_0x227c04['attributes'],function(_0x5094be){var _0x58d7fd={};_0x58d7fd[_0x5094be]={'$like':'%'+_0x135539[_0x53a8('0x30')][_0x53a8('0x3f')]+'%'};return _0x58d7fd;})});}_0x227c04=_[_0x53a8('0x3c')]({},_0x227c04,_0x135539[_0x53a8('0x40')]);return _0x2c76cc['getAgents'](_0x227c04);}})[_0x53a8('0x42')](function(_0x2947ca){if(_0x2947ca){_0x546cc5=_0x2947ca[_0x53a8('0x48')];if(!_0x135539[_0x53a8('0x30')]['hasOwnProperty'](_0x53a8('0x36'))){_0x227c04[_0x53a8('0x1f')]=qs[_0x53a8('0x1f')](_0x135539[_0x53a8('0x30')]['limit']);_0x227c04[_0x53a8('0x20')]=qs[_0x53a8('0x20')](_0x135539[_0x53a8('0x30')][_0x53a8('0x20')]);}return _0x2c76cc[_0x53a8('0x99')](_0x227c04);}})['then'](function(_0x33f2b2){if(_0x33f2b2){return _0x33f2b2?{'count':_0x546cc5,'rows':_0x33f2b2}:null;}})[_0x53a8('0x42')](respondWithResult(_0x3022a4,null))[_0x53a8('0x52')](handleError(_0x3022a4,null));}; \ No newline at end of file +var _0x36fa=['update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','UserProfileResource','destroy','params','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','FaxQueueId','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','send','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','all','TeamVoicePrefix','UserVoicePrefix','addAgents','spread','isArray','removeAgents','emit','Queue:remove','VoicePrefixId','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2398c3,_0x4befca){var _0x1e2669=function(_0x143222){while(--_0x143222){_0x2398c3['push'](_0x2398c3['shift']());}};_0x1e2669(++_0x4befca);}(_0x36fa,0x1aa));var _0xa36f=function(_0x266a41,_0x3c6959){_0x266a41=_0x266a41-0x0;var _0x56e6f6=_0x36fa[_0x266a41];return _0x56e6f6;};'use strict';var emlformat=require(_0xa36f('0x0'));var rimraf=require(_0xa36f('0x1'));var zipdir=require(_0xa36f('0x2'));var jsonpatch=require(_0xa36f('0x3'));var rp=require(_0xa36f('0x4'));var moment=require(_0xa36f('0x5'));var BPromise=require(_0xa36f('0x6'));var Mustache=require(_0xa36f('0x7'));var util=require(_0xa36f('0x8'));var path=require(_0xa36f('0x9'));var sox=require('sox');var csv=require(_0xa36f('0xa'));var ejs=require(_0xa36f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa36f('0xc'));var squel=require(_0xa36f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa36f('0xe'));var toCsv=require(_0xa36f('0xa'));var querystring=require(_0xa36f('0xf'));var Papa=require(_0xa36f('0x10'));var Redis=require(_0xa36f('0x11'));var authService=require(_0xa36f('0x12'));var qs=require(_0xa36f('0x13'));var as=require(_0xa36f('0x14'));var hardwareService=require(_0xa36f('0x15'));var logger=require('../../config/logger')(_0xa36f('0x16'));var utils=require(_0xa36f('0x17'));var config=require(_0xa36f('0x18'));var licenseUtil=require(_0xa36f('0x19'));var db=require(_0xa36f('0x1a'))['db'];config['redis']=_[_0xa36f('0x1b')](config[_0xa36f('0x1c')],{'host':_0xa36f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa36f('0x1c')]));require(_0xa36f('0x1e'))[_0xa36f('0x1f')](socket);function respondWithStatusCode(_0x3b3231,_0x434fd0){_0x434fd0=_0x434fd0||0xcc;return function(_0x9821a3){if(_0x9821a3){return _0x3b3231[_0xa36f('0x20')](_0x434fd0);}return _0x3b3231[_0xa36f('0x21')](_0x434fd0)[_0xa36f('0x22')]();};}function respondWithResult(_0x7eb621,_0x3677c1){_0x3677c1=_0x3677c1||0xc8;return function(_0x5a8d25){if(_0x5a8d25){return _0x7eb621['status'](_0x3677c1)[_0xa36f('0x23')](_0x5a8d25);}};}function respondWithFilteredResult(_0x20adbf,_0x579646){return function(_0x2e43ef){if(_0x2e43ef){var _0x32b268=typeof _0x579646[_0xa36f('0x24')]===_0xa36f('0x25')&&typeof _0x579646[_0xa36f('0x26')]===_0xa36f('0x25');var _0x5f0f31=_0x2e43ef[_0xa36f('0x27')];var _0x4ca19a=_0x32b268?0x0:_0x579646[_0xa36f('0x24')];var _0x5157dc=_0x32b268?_0x2e43ef[_0xa36f('0x27')]:_0x579646[_0xa36f('0x24')]+_0x579646[_0xa36f('0x26')];var _0x4a0988;if(_0x5157dc>=_0x5f0f31){_0x5157dc=_0x5f0f31;_0x4a0988=0xc8;}else{_0x4a0988=0xce;}_0x20adbf[_0xa36f('0x21')](_0x4a0988);return _0x20adbf[_0xa36f('0x28')](_0xa36f('0x29'),_0x4ca19a+'-'+_0x5157dc+'/'+_0x5f0f31)[_0xa36f('0x23')](_0x2e43ef);}return null;};}function patchUpdates(_0x257eaa){return function(_0x463511){try{jsonpatch[_0xa36f('0x2a')](_0x463511,_0x257eaa,!![]);}catch(_0x1e5e1d){return BPromise[_0xa36f('0x2b')](_0x1e5e1d);}return _0x463511[_0xa36f('0x2c')]();};}function saveUpdates(_0x3771a1,_0x3343cf){return function(_0x4b9c63){if(_0x4b9c63){return _0x4b9c63[_0xa36f('0x2d')](_0x3771a1)[_0xa36f('0x2e')](function(_0x2a0a63){return _0x2a0a63;});}return null;};}function handleEntityNotFound(_0x3766df,_0x924afb){return function(_0x2d7714){if(!_0x2d7714){_0x3766df[_0xa36f('0x20')](0x194);}return _0x2d7714;};}function handleError(_0x3d8a70,_0x2e12a8){_0x2e12a8=_0x2e12a8||0x1f4;return function(_0x566443){logger[_0xa36f('0x2f')](_0x566443[_0xa36f('0x30')]);if(_0x566443['name']){delete _0x566443[_0xa36f('0x31')];}_0x3d8a70[_0xa36f('0x21')](_0x2e12a8)['send'](_0x566443);};}exports[_0xa36f('0x32')]=function(_0xba9069,_0x102f7e){var _0x3a9147={},_0x2b2512={},_0x13c3f3={'count':0x0,'rows':[]};var _0x37e760=_[_0xa36f('0x33')](db['Team'][_0xa36f('0x34')],function(_0x41a510){return{'name':_0x41a510[_0xa36f('0x35')],'type':_0x41a510[_0xa36f('0x36')]['key']};});_0x2b2512[_0xa36f('0x37')]=_[_0xa36f('0x33')](_0x37e760,_0xa36f('0x31'));_0x2b2512['query']=_['keys'](_0xba9069[_0xa36f('0x38')]);_0x2b2512['filters']=_[_0xa36f('0x39')](_0x2b2512[_0xa36f('0x37')],_0x2b2512[_0xa36f('0x38')]);_0x3a9147['attributes']=_[_0xa36f('0x39')](_0x2b2512[_0xa36f('0x37')],qs['fields'](_0xba9069[_0xa36f('0x38')][_0xa36f('0x3a')]));_0x3a9147[_0xa36f('0x3b')]=_0x3a9147['attributes'][_0xa36f('0x3c')]?_0x3a9147[_0xa36f('0x3b')]:_0x2b2512[_0xa36f('0x37')];if(!_0xba9069['query']['hasOwnProperty'](_0xa36f('0x3d'))){_0x3a9147[_0xa36f('0x26')]=qs[_0xa36f('0x26')](_0xba9069['query'][_0xa36f('0x26')]);_0x3a9147[_0xa36f('0x24')]=qs['offset'](_0xba9069['query']['offset']);}_0x3a9147[_0xa36f('0x3e')]=qs[_0xa36f('0x3f')](_0xba9069[_0xa36f('0x38')][_0xa36f('0x3f')]);_0x3a9147[_0xa36f('0x40')]=qs[_0xa36f('0x41')](_['pick'](_0xba9069[_0xa36f('0x38')],_0x2b2512[_0xa36f('0x41')]),_0x37e760);if(_0xba9069[_0xa36f('0x38')][_0xa36f('0x42')]){_0x3a9147[_0xa36f('0x40')]=_[_0xa36f('0x43')](_0x3a9147[_0xa36f('0x40')],{'$or':_['map'](_0x37e760,function(_0x38804f){if(_0x38804f['type']!==_0xa36f('0x44')){var _0x5a4801={};_0x5a4801[_0x38804f[_0xa36f('0x31')]]={'$like':'%'+_0xba9069[_0xa36f('0x38')][_0xa36f('0x42')]+'%'};return _0x5a4801;}})});}_0x3a9147=_[_0xa36f('0x43')]({},_0x3a9147,_0xba9069[_0xa36f('0x45')]);var _0x367fad={'where':_0x3a9147['where']};return db[_0xa36f('0x46')][_0xa36f('0x27')](_0x367fad)[_0xa36f('0x2e')](function(_0x489d1f){_0x13c3f3[_0xa36f('0x27')]=_0x489d1f;if(_0xba9069[_0xa36f('0x38')][_0xa36f('0x47')]){_0x3a9147[_0xa36f('0x48')]=[{'all':!![]}];}return db['Team'][_0xa36f('0x49')](_0x3a9147);})[_0xa36f('0x2e')](function(_0x4e74c7){_0x13c3f3['rows']=_0x4e74c7;return _0x13c3f3;})['then'](respondWithFilteredResult(_0x102f7e,_0x3a9147))[_0xa36f('0x4a')](handleError(_0x102f7e,null));};exports[_0xa36f('0x4b')]=function(_0x12e10b,_0x175916){var _0x2d4efa={'raw':![],'where':{'id':_0x12e10b['params']['id']}},_0x3c154d={};_0x3c154d[_0xa36f('0x37')]=_[_0xa36f('0x4c')](db[_0xa36f('0x46')][_0xa36f('0x34')]);_0x3c154d[_0xa36f('0x38')]=_[_0xa36f('0x4c')](_0x12e10b[_0xa36f('0x38')]);_0x3c154d['filters']=_[_0xa36f('0x39')](_0x3c154d[_0xa36f('0x37')],_0x3c154d[_0xa36f('0x38')]);_0x2d4efa[_0xa36f('0x3b')]=_[_0xa36f('0x39')](_0x3c154d['model'],qs[_0xa36f('0x3a')](_0x12e10b['query'][_0xa36f('0x3a')]));_0x2d4efa[_0xa36f('0x3b')]=_0x2d4efa[_0xa36f('0x3b')][_0xa36f('0x3c')]?_0x2d4efa[_0xa36f('0x3b')]:_0x3c154d[_0xa36f('0x37')];if(_0x12e10b[_0xa36f('0x38')][_0xa36f('0x47')]){_0x2d4efa['include']=[{'all':!![]}];}_0x2d4efa=_['merge']({},_0x2d4efa,_0x12e10b[_0xa36f('0x45')]);return db['Team'][_0xa36f('0x4d')](_0x2d4efa)[_0xa36f('0x2e')](handleEntityNotFound(_0x175916,null))[_0xa36f('0x2e')](respondWithResult(_0x175916,null))[_0xa36f('0x4a')](handleError(_0x175916,null));};exports[_0xa36f('0x4e')]=function(_0x3b20b3,_0x2b9228){return db[_0xa36f('0x46')][_0xa36f('0x4e')](_0x3b20b3[_0xa36f('0x4f')],{})[_0xa36f('0x2e')](function(_0x247d1e){var _0x257967=_0x3b20b3[_0xa36f('0x50')][_0xa36f('0x51')]({'plain':!![]});if(!_0x257967)throw new Error(_0xa36f('0x52'));if(_0x257967[_0xa36f('0x53')]==='user'){var _0x5854ea=_0x247d1e[_0xa36f('0x51')]({'plain':!![]});var _0xaaaa1d=_0xa36f('0x54');return db['UserProfileSection'][_0xa36f('0x4d')]({'where':{'name':_0xaaaa1d,'userProfileId':_0x257967[_0xa36f('0x55')]},'raw':!![]})[_0xa36f('0x2e')](function(_0x3ea380){if(_0x3ea380&&_0x3ea380['autoAssociation']===0x0){return db[_0xa36f('0x56')][_0xa36f('0x4e')]({'name':_0x5854ea[_0xa36f('0x31')],'resourceId':_0x5854ea['id'],'type':_0x3ea380[_0xa36f('0x31')],'sectionId':_0x3ea380['id']},{})['then'](function(){return _0x247d1e;});}else{return _0x247d1e;}})['catch'](function(_0x2f05f9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f05f9);throw _0x2f05f9;});}return _0x247d1e;})[_0xa36f('0x2e')](respondWithResult(_0x2b9228,0xc9))[_0xa36f('0x4a')](handleError(_0x2b9228,null));};exports[_0xa36f('0x2d')]=function(_0x104ffe,_0x1020d1){if(_0x104ffe['body']['id']){delete _0x104ffe[_0xa36f('0x4f')]['id'];}return db[_0xa36f('0x46')]['find']({'where':{'id':_0x104ffe['params']['id']}})[_0xa36f('0x2e')](handleEntityNotFound(_0x1020d1,null))['then'](saveUpdates(_0x104ffe[_0xa36f('0x4f')],null))[_0xa36f('0x2e')](respondWithResult(_0x1020d1,null))[_0xa36f('0x4a')](handleError(_0x1020d1,null));};exports[_0xa36f('0x57')]=function(_0x14d018,_0x558fd2){var _0x1d3b8b=_0x14d018[_0xa36f('0x58')]['id'];var _0x5523dc=[];return db['sequelize'][_0xa36f('0x59')](function(_0x32a65a){var _0x3146ce='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1d3b8b;return db['sequelize'][_0xa36f('0x38')](_0x3146ce,{'type':db[_0xa36f('0x5a')]['QueryTypes'][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a})['then'](function(_0x1e9b68){_0x5523dc=_['map'](_0x1e9b68,function(_0x3e8ff4){return Number(_0x3e8ff4[_0xa36f('0x5c')]);});})['then'](function(){var _0x1b5bea=_0xa36f('0x5d')+_0x1d3b8b;return db[_0xa36f('0x5e')]['query'](_0x1b5bea,{'type':db[_0xa36f('0x5a')][_0xa36f('0x5f')]['SELECT'],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x29d7cf){var _0xd5132d=_[_0xa36f('0x33')](_0x29d7cf,function(_0x4327a2){return Number(_0x4327a2[_0xa36f('0x60')]);});return db[_0xa36f('0x61')][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'VoiceQueueId':{'$in':_0xd5132d}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0x421c71=_0xa36f('0x62')+_0x1d3b8b;return db[_0xa36f('0x5e')][_0xa36f('0x38')](_0x421c71,{'type':db[_0xa36f('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x4fe8a3){var _0x54a2d0=_[_0xa36f('0x33')](_0x4fe8a3,function(_0x2f47ce){return Number(_0x2f47ce[_0xa36f('0x63')]);});return db['UserMailQueue'][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'MailQueueId':{'$in':_0x54a2d0}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0x3d38ba=_0xa36f('0x64')+_0x1d3b8b;return db['sequelize'][_0xa36f('0x38')](_0x3d38ba,{'type':db['Sequelize'][_0xa36f('0x5f')][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x6a32bc){var _0x28fa87=_[_0xa36f('0x33')](_0x6a32bc,function(_0x3e6135){return Number(_0x3e6135[_0xa36f('0x65')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x5523dc},'SmsQueueId':{'$in':_0x28fa87}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0xfe62bf=_0xa36f('0x66')+_0x1d3b8b;return db[_0xa36f('0x5e')][_0xa36f('0x38')](_0xfe62bf,{'type':db['Sequelize']['QueryTypes'][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x105123){var _0x221646=_[_0xa36f('0x33')](_0x105123,function(_0x500076){return Number(_0x500076[_0xa36f('0x67')]);});return db[_0xa36f('0x68')][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'ChatQueueId':{'$in':_0x221646}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0x10ab06=_0xa36f('0x69')+_0x1d3b8b;return db[_0xa36f('0x5e')][_0xa36f('0x38')](_0x10ab06,{'type':db['Sequelize']['QueryTypes'][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x3c8c24){var _0x2843c3=_[_0xa36f('0x33')](_0x3c8c24,function(_0x4d290a){return Number(_0x4d290a[_0xa36f('0x6a')]);});return db[_0xa36f('0x6b')][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'FaxQueueId':{'$in':_0x2843c3}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0x25af01=_0xa36f('0x6c')+_0x1d3b8b;return db[_0xa36f('0x5e')][_0xa36f('0x38')](_0x25af01,{'type':db[_0xa36f('0x5a')][_0xa36f('0x5f')][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x5efc79){var _0x487ed2=_[_0xa36f('0x33')](_0x5efc79,function(_0x252fd7){return Number(_0x252fd7[_0xa36f('0x6d')]);});return db['UserOpenchannelQueue'][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'OpenchannelQueueId':{'$in':_0x487ed2}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){var _0xdaedf7=_0xa36f('0x6e')+_0x1d3b8b;return db[_0xa36f('0x5e')]['query'](_0xdaedf7,{'type':db[_0xa36f('0x5a')][_0xa36f('0x5f')][_0xa36f('0x5b')],'raw':!![],'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(_0x3506e7){var _0x15d46d=_[_0xa36f('0x33')](_0x3506e7,function(_0x57f6fe){return Number(_0x57f6fe[_0xa36f('0x6f')]);});return db['UserWhatsappQueue'][_0xa36f('0x57')]({'where':{'UserId':{'$in':_0x5523dc},'WhatsappQueueId':{'$in':_0x15d46d}},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){return db['TeamVoicePrefix'][_0xa36f('0x4d')]({'where':{'TeamId':_0x1d3b8b}});})[_0xa36f('0x2e')](function(_0x3a2199){if(_0x3a2199===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x5523dc},'VoicePrefixId':_0x3a2199['VoicePrefixId']},'transaction':_0x32a65a});})[_0xa36f('0x2e')](function(){return db[_0xa36f('0x46')][_0xa36f('0x57')]({'where':{'id':_0x1d3b8b},'cascade':!![],'transaction':_0x32a65a});})['then'](function(_0x4cba3b){if(_0x4cba3b===0x0){_0x558fd2[_0xa36f('0x20')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xa36f('0x54'),'resourceId':_0x1d3b8b},'cascade':!![],'transaction':_0x32a65a})[_0xa36f('0x2e')](function(){_0x558fd2[_0xa36f('0x21')](0xcc)[_0xa36f('0x22')]();});}})[_0xa36f('0x4a')](function(_0x20a776){_0x558fd2[_0xa36f('0x21')](0x1f4)[_0xa36f('0x70')](_0x20a776);});});};exports['getQueues']=function(_0x38045b,_0x235493,_0x4fbbfb){return db[_0xa36f('0x46')][_0xa36f('0x71')]({'where':{'id':_0x38045b[_0xa36f('0x58')]['id']}})[_0xa36f('0x2e')](handleEntityNotFound(_0x235493,null))[_0xa36f('0x2e')](function(_0x169e5e){if(!_0x38045b[_0xa36f('0x38')][_0xa36f('0x72')]||!utils[_0xa36f('0x73')](_0x38045b[_0xa36f('0x38')][_0xa36f('0x72')])){throw new db[(_0xa36f('0x5a'))][(_0xa36f('0x74'))](_0xa36f('0x75'));}var _0xbb58ef={};var _0x2bb656={};_0x2bb656[_0xa36f('0x37')]=_[_0xa36f('0x4c')](db[_[_0xa36f('0x76')](_0x38045b[_0xa36f('0x38')][_0xa36f('0x72')][_0xa36f('0x77')]())+_0xa36f('0x78')][_0xa36f('0x34')]);_0x2bb656['query']=_[_0xa36f('0x4c')](_0x38045b[_0xa36f('0x38')]);_0x2bb656[_0xa36f('0x41')]=_[_0xa36f('0x39')](_0x2bb656[_0xa36f('0x37')],_0x2bb656['query']);_0xbb58ef['attributes']=_[_0xa36f('0x39')](_0x2bb656[_0xa36f('0x37')],qs['fields'](_0x38045b[_0xa36f('0x38')][_0xa36f('0x3a')]));_0xbb58ef[_0xa36f('0x3b')]=_0xbb58ef[_0xa36f('0x3b')][_0xa36f('0x3c')]?_0xbb58ef[_0xa36f('0x3b')]:_0x2bb656[_0xa36f('0x37')];_0xbb58ef[_0xa36f('0x26')]=qs[_0xa36f('0x26')](_0x38045b['query'][_0xa36f('0x26')]);_0xbb58ef[_0xa36f('0x24')]=qs['offset'](_0x38045b[_0xa36f('0x38')][_0xa36f('0x24')]);_0xbb58ef[_0xa36f('0x3e')]=qs[_0xa36f('0x3f')](_0x38045b[_0xa36f('0x38')][_0xa36f('0x3f')]);_0xbb58ef[_0xa36f('0x40')]=qs[_0xa36f('0x41')](_['pick'](_0x38045b[_0xa36f('0x38')],_0x2bb656[_0xa36f('0x41')]));_0xbb58ef=_[_0xa36f('0x43')]({},_0xbb58ef,_0x38045b[_0xa36f('0x45')]);return _0x169e5e[_0xa36f('0x51')+_[_0xa36f('0x76')](_0x38045b['query']['channel'][_0xa36f('0x77')]())+'Queues'](_0xbb58ef);})[_0xa36f('0x2e')](respondWithResult(_0x235493,null))['catch'](handleError(_0x235493,null));};exports[_0xa36f('0x79')]=function(_0x5cb2ea,_0x36d935,_0x11f6e4){return db[_0xa36f('0x46')][_0xa36f('0x71')]({'where':{'id':_0x5cb2ea[_0xa36f('0x58')]['id']}})[_0xa36f('0x2e')](function(_0x2deaf9){if(_0x2deaf9){if(!_0x5cb2ea[_0xa36f('0x4f')][_0xa36f('0x72')]||!utils[_0xa36f('0x73')](_0x5cb2ea['body'][_0xa36f('0x72')])){throw new db[(_0xa36f('0x5a'))][(_0xa36f('0x74'))]('Unknown\x20channel');}return _0x2deaf9[_0xa36f('0x7a')+_[_0xa36f('0x76')](_0x5cb2ea['body'][_0xa36f('0x72')]['toLowerCase']())+_0xa36f('0x7b')](_0x5cb2ea['body'][_0xa36f('0x7c')]);}return null;})[_0xa36f('0x2e')](handleEntityNotFound(_0x36d935,null))[_0xa36f('0x2e')](respondWithStatusCode(_0x36d935,null))['catch'](handleError(_0x36d935,null));};exports['removeQueues']=function(_0x3ba65f,_0x25922d,_0x428b94){return db[_0xa36f('0x46')][_0xa36f('0x71')]({'where':{'id':_0x3ba65f[_0xa36f('0x58')]['id']}})[_0xa36f('0x2e')](function(_0x4cd58d){if(_0x4cd58d){if(!_0x3ba65f['query'][_0xa36f('0x72')]||!utils[_0xa36f('0x73')](_0x3ba65f[_0xa36f('0x38')][_0xa36f('0x72')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x4cd58d['remove'+_[_0xa36f('0x76')](_0x3ba65f['query'][_0xa36f('0x72')][_0xa36f('0x77')]())+_0xa36f('0x7b')](_0x3ba65f[_0xa36f('0x38')][_0xa36f('0x7c')]);}return null;})[_0xa36f('0x2e')](handleEntityNotFound(_0x25922d,null))[_0xa36f('0x2e')](respondWithStatusCode(_0x25922d,null))[_0xa36f('0x4a')](handleError(_0x25922d,null));};exports['addAgents']=function(_0xf91019,_0x1bb336){var _0xe8e768=_['isArray'](_0xf91019[_0xa36f('0x4f')][_0xa36f('0x7c')])?_0xf91019[_0xa36f('0x4f')][_0xa36f('0x7c')]:[_0xf91019[_0xa36f('0x4f')][_0xa36f('0x7c')]];var _0x4bc51b=_0xf91019['params']['id'];return db[_0xa36f('0x46')][_0xa36f('0x4d')]({'where':{'id':_0x4bc51b}})[_0xa36f('0x2e')](handleEntityNotFound(_0x1bb336,null))[_0xa36f('0x2e')](function(_0x4867de){if(_0x4867de){var _0x1ddffe=[_0xa36f('0x7d'),_0xa36f('0x7e'),_0xa36f('0x7f'),_0xa36f('0x80'),_0xa36f('0x81'),_0xa36f('0x82'),_0xa36f('0x83')];return db[_0xa36f('0x5e')]['transaction'](function(_0x23310f){var _0x5bdce2=_[_0xa36f('0x33')](_0x1ddffe,function(_0x81789e){var _0x163743={'attributes':['id',_0xa36f('0x31')]};if(_0x81789e===_0xa36f('0x7d')){_0x163743['through']={'attributes':[_0xa36f('0x84')]};}return _0x4867de[_0xa36f('0x51')+_0x81789e+'Queues'](_0x163743)[_0xa36f('0x2e')](function(_0x345323){var _0x4b7c05=_[_0xa36f('0x33')](_0x345323,function(_0x1a9b69){var _0x273485=_[_0xa36f('0x33')](_0xe8e768,function(_0x4661c4){var _0xd7a7a1={'where':{'UserId':_0x4661c4,[_0x81789e+_0xa36f('0x85')]:_0x1a9b69['id']},'transaction':_0x23310f};if(_0x81789e===_0xa36f('0x7d')){_0xd7a7a1['defaults']={'penalty':_0x1a9b69[_0xa36f('0x86')]['penalty']};}return db[_0xa36f('0x87')+_0x81789e+'Queue'][_0xa36f('0x88')](_0xd7a7a1)[_0xa36f('0x2e')](function(){socket['emit']('user'+_0x81789e+_0xa36f('0x89'),{'UserId':_0x4661c4,[_0x81789e+_0xa36f('0x85')]:_0x1a9b69['id']});if(_0x81789e!=='Voice'){return;}return db[_0xa36f('0x87')][_0xa36f('0x49')]({'where':{'id':_0xe8e768,'online':0x1},'attributes':['id',_0xa36f('0x31'),'online','voicePause','interface'],'raw':!![]})['then'](function(_0x677f61){var _0x159bba=_['map'](_0x677f61,function(_0x4ec9b3){return db[_0xa36f('0x8a')][_0xa36f('0x8b')]({'membername':_0x4ec9b3[_0xa36f('0x31')],'UserId':_0x4ec9b3['id'],'queue_name':_0x1a9b69[_0xa36f('0x31')],'VoiceQueueId':_0x1a9b69['id'],'interface':_[_0xa36f('0x8c')](_0x4ec9b3[_0xa36f('0x8d')])?util[_0xa36f('0x8e')](_0xa36f('0x8f'),_0x4ec9b3[_0xa36f('0x31')]):_0x4ec9b3[_0xa36f('0x8d')],'paused':_0x4ec9b3[_0xa36f('0x90')]||![],'penalty':_0x1a9b69['TeamVoiceQueue'][_0xa36f('0x84')]},{'transaction':_0x23310f});});return Promise[_0xa36f('0x91')](_0x159bba);});});});return Promise[_0xa36f('0x91')](_0x273485);});return Promise[_0xa36f('0x91')](_0x4b7c05);})[_0xa36f('0x2e')](function(){return db[_0xa36f('0x92')][_0xa36f('0x71')]({'where':{'teamId':_0x4bc51b}})[_0xa36f('0x2e')](function(_0x76d9fe){if(_0x76d9fe){var _0x426b9f=_[_0xa36f('0x33')](_0xe8e768,function(_0xdda532){db[_0xa36f('0x93')]['upsert']({'UserId':_0xdda532,'VoicePrefixId':_0x76d9fe['VoicePrefixId']});});return Promise[_0xa36f('0x91')](_0x426b9f);}});});});return Promise[_0xa36f('0x91')](_0x5bdce2)[_0xa36f('0x2e')](function(){return _0x4867de[_0xa36f('0x94')](_0xe8e768,{'transaction':_0x23310f})[_0xa36f('0x95')](function(_0x5747b4){return _0x5747b4;});});});}})[_0xa36f('0x2e')](respondWithResult(_0x1bb336,null))[_0xa36f('0x4a')](handleError(_0x1bb336,null));};exports['removeAgents']=function(_0x3ca587,_0x516663){var _0x10af8d=_[_0xa36f('0x96')](_0x3ca587['query'][_0xa36f('0x7c')])?_0x3ca587[_0xa36f('0x38')][_0xa36f('0x7c')]:[_0x3ca587[_0xa36f('0x38')]['ids']];var _0x2c5812=_0x3ca587[_0xa36f('0x58')]['id'];return db[_0xa36f('0x46')][_0xa36f('0x4d')]({'where':{'id':_0x2c5812}})[_0xa36f('0x2e')](handleEntityNotFound(_0x516663,null))[_0xa36f('0x2e')](function(_0xf2703b){if(_0xf2703b){var _0x3aa2c6=[_0xa36f('0x7d'),'Chat',_0xa36f('0x7f'),_0xa36f('0x80'),_0xa36f('0x81'),_0xa36f('0x82'),_0xa36f('0x83')];return db[_0xa36f('0x5e')][_0xa36f('0x59')](function(_0x234042){var _0x33e8ba=_[_0xa36f('0x33')](_0x3aa2c6,function(_0x2b08f8){var _0x5cca1a={'attributes':['id','name']};return _0xf2703b[_0xa36f('0x51')+_0x2b08f8+'Queues'](_0x5cca1a)[_0xa36f('0x2e')](function(_0x3ebedd){var _0x1d196a=_[_0xa36f('0x33')](_0x3ebedd,function(_0x2a4f87){return _0x2a4f87[_0xa36f('0x97')](_0x10af8d,{'transaction':_0x234042})[_0xa36f('0x2e')](function(){var _0x1cf4c7=_[_0xa36f('0x33')](_0x10af8d,function(_0x42821f){socket[_0xa36f('0x98')](_0xa36f('0x50')+_0x2b08f8+_0xa36f('0x99'),{'UserId':Number(_0x42821f),[_0x2b08f8+'QueueId']:_0x2a4f87['id']});if(_0x2b08f8!==_0xa36f('0x7d')){return;}return db[_0xa36f('0x8a')][_0xa36f('0x57')]({'where':{'VoiceQueueId':_0x2a4f87['id'],'UserId':_0x42821f},'transaction':_0x234042});});return Promise[_0xa36f('0x91')](_0x1cf4c7);});});return Promise[_0xa36f('0x91')](_0x1d196a);});});return Promise['all'](_0x33e8ba)[_0xa36f('0x2e')](function(){return _0xf2703b[_0xa36f('0x97')](_0x10af8d,{'transaction':_0x234042});})[_0xa36f('0x2e')](function(){return db[_0xa36f('0x92')]['findOne']({'where':{'teamId':_0x2c5812}})[_0xa36f('0x2e')](function(_0x359ed2){if(_0x359ed2){var _0x6c9827=_[_0xa36f('0x33')](_0x10af8d,function(_0x3c0551){db['UserVoicePrefix'][_0xa36f('0x57')]({'where':{'UserId':_0x3c0551,'VoicePrefixId':_0x359ed2[_0xa36f('0x9a')]}});});return Promise[_0xa36f('0x91')](_0x6c9827);}});});});}})[_0xa36f('0x2e')](respondWithStatusCode(_0x516663,null))[_0xa36f('0x4a')](handleError(_0x516663,null));};exports[_0xa36f('0x9b')]=function(_0x2c5aec,_0x4eef45,_0x128f23){var _0x420d41={};var _0x3111b9={};var _0x59786f;var _0x23b3b5;return db[_0xa36f('0x46')][_0xa36f('0x71')]({'where':{'id':_0x2c5aec['params']['id']}})[_0xa36f('0x2e')](handleEntityNotFound(_0x4eef45,null))[_0xa36f('0x2e')](function(_0x31b61c){if(_0x31b61c){_0x59786f=_0x31b61c;_0x3111b9[_0xa36f('0x37')]=_[_0xa36f('0x4c')](db[_0xa36f('0x87')]['rawAttributes']);_0x3111b9['query']=_[_0xa36f('0x4c')](_0x2c5aec[_0xa36f('0x38')]);_0x3111b9[_0xa36f('0x41')]=_[_0xa36f('0x39')](_0x3111b9[_0xa36f('0x37')],_0x3111b9['query']);_0x420d41[_0xa36f('0x3b')]=_['intersection'](_0x3111b9['model'],qs['fields'](_0x2c5aec[_0xa36f('0x38')][_0xa36f('0x3a')]));_0x420d41[_0xa36f('0x3b')]=_0x420d41[_0xa36f('0x3b')]['length']?_0x420d41[_0xa36f('0x3b')]:_0x3111b9[_0xa36f('0x37')];_0x420d41[_0xa36f('0x3e')]=qs[_0xa36f('0x3f')](_0x2c5aec['query']['sort']);_0x420d41['where']=qs[_0xa36f('0x41')](_[_0xa36f('0x9c')](_0x2c5aec['query'],_0x3111b9[_0xa36f('0x41')]));if(_0x2c5aec[_0xa36f('0x38')][_0xa36f('0x42')]){_0x420d41[_0xa36f('0x40')]=_[_0xa36f('0x43')](_0x420d41[_0xa36f('0x40')],{'$or':_[_0xa36f('0x33')](_0x420d41['attributes'],function(_0x231a4f){var _0x783c05={};_0x783c05[_0x231a4f]={'$like':'%'+_0x2c5aec[_0xa36f('0x38')][_0xa36f('0x42')]+'%'};return _0x783c05;})});}_0x420d41=_[_0xa36f('0x43')]({},_0x420d41,_0x2c5aec[_0xa36f('0x45')]);return _0x59786f[_0xa36f('0x9b')](_0x420d41);}})[_0xa36f('0x2e')](function(_0x30d4b1){if(_0x30d4b1){_0x23b3b5=_0x30d4b1[_0xa36f('0x3c')];if(!_0x2c5aec[_0xa36f('0x38')]['hasOwnProperty'](_0xa36f('0x3d'))){_0x420d41[_0xa36f('0x26')]=qs[_0xa36f('0x26')](_0x2c5aec['query']['limit']);_0x420d41[_0xa36f('0x24')]=qs[_0xa36f('0x24')](_0x2c5aec[_0xa36f('0x38')][_0xa36f('0x24')]);}return _0x59786f[_0xa36f('0x9b')](_0x420d41);}})['then'](function(_0xb1980c){if(_0xb1980c){return _0xb1980c?{'count':_0x23b3b5,'rows':_0xb1980c}:null;}})['then'](respondWithResult(_0x4eef45,null))[_0xa36f('0x4a')](handleError(_0x4eef45,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d9bc4fd..4d1edc9 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 _0xc3a9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3a9,0x6f));var _0x9c3a=function(_0x3e5c7c,_0x4bbb61){_0x3e5c7c=_0x3e5c7c-0x0;var _0x110533=_0xc3a9[_0x3e5c7c];return _0x110533;};'use strict';var EventEmitter=require('events');var Team=require(_0x9c3a('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9c3a('0x1')](0x0);var events={'afterCreate':_0x9c3a('0x2'),'afterUpdate':'update','afterDestroy':_0x9c3a('0x3')};function emitEvent(_0x3ad813){return function(_0x2b1d39,_0x571dde,_0x453133){TeamEvents[_0x9c3a('0x4')](_0x3ad813+':'+_0x2b1d39['id'],_0x2b1d39);TeamEvents[_0x9c3a('0x4')](_0x3ad813,_0x2b1d39);_0x453133(null);};}for(var e in events){if(events[_0x9c3a('0x5')](e)){var event=events[e];Team[_0x9c3a('0x6')](e,emitEvent(event));}}module[_0x9c3a('0x7')]=TeamEvents; \ No newline at end of file +var _0xfc47=['../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x352666,_0x58f27){var _0x365571=function(_0x492ee5){while(--_0x492ee5){_0x352666['push'](_0x352666['shift']());}};_0x365571(++_0x58f27);}(_0xfc47,0x1cb));var _0x7fc4=function(_0x5018bd,_0x24b200){_0x5018bd=_0x5018bd-0x0;var _0x5cb7c7=_0xfc47[_0x5018bd];return _0x5cb7c7;};'use strict';var EventEmitter=require(_0x7fc4('0x0'));var Team=require(_0x7fc4('0x1'))['db'][_0x7fc4('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x7fc4('0x3')](0x0);var events={'afterCreate':_0x7fc4('0x4'),'afterUpdate':_0x7fc4('0x5'),'afterDestroy':_0x7fc4('0x6')};function emitEvent(_0x5829e2){return function(_0x12b414,_0x3cbe38,_0x407709){TeamEvents[_0x7fc4('0x7')](_0x5829e2+':'+_0x12b414['id'],_0x12b414);TeamEvents[_0x7fc4('0x7')](_0x5829e2,_0x12b414);_0x407709(null);};}for(var e in events){if(events[_0x7fc4('0x8')](e)){var event=events[e];Team[_0x7fc4('0x9')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2451851..427f403 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 _0x77f3=['resolve','map','all','lodash','./team.attributes','Queues','then','setDataValue','catch','exports','define','Team','Chat','Fax','Openchannel','Sms','Whatsapp'];(function(_0x505a7d,_0x25e11f){var _0x17d880=function(_0x213c2){while(--_0x213c2){_0x505a7d['push'](_0x505a7d['shift']());}};_0x17d880(++_0x25e11f);}(_0x77f3,0x19b));var _0x377f=function(_0x1ca1b3,_0x47a9ae){_0x1ca1b3=_0x1ca1b3-0x0;var _0x5a56ca=_0x77f3[_0x1ca1b3];return _0x5a56ca;};'use strict';var _=require(_0x377f('0x0'));var attributes=require(_0x377f('0x1'));function getQueuesByChannel(_0x589f09,_0x10a15e){var _0x119a5f='get'+_0x10a15e+_0x377f('0x2');return _0x589f09[_0x119a5f]()[_0x377f('0x3')](function(_0x335fbb){return _['map'](_0x335fbb,function(_0x5e525c){_0x5e525c[_0x377f('0x4')]('channel',_0x10a15e);return _0x5e525c;});})[_0x377f('0x5')](function(_0x46e67b){throw _0x46e67b;});}module[_0x377f('0x6')]=function(_0x416356){return _0x416356[_0x377f('0x7')](_0x377f('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xbc9717=this;var _0x149dcb=[_0x377f('0x9'),_0x377f('0xa'),'Mail',_0x377f('0xb'),_0x377f('0xc'),'Voice',_0x377f('0xd')];return Promise[_0x377f('0xe')]()[_0x377f('0x3')](function(){var _0x48dd02=_[_0x377f('0xf')](_0x149dcb,function(_0x57d68b){return getQueuesByChannel(_0xbc9717,_0x57d68b);});return Promise[_0x377f('0x10')](_0x48dd02);})[_0x377f('0x5')](function(_0x1e31c5){throw _0x1e31c5;});}}});}; \ No newline at end of file +var _0x3f31=['Openchannel','Sms','Voice','Whatsapp','all','lodash','./team.attributes','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax'];(function(_0x2d8382,_0x399f26){var _0x549776=function(_0x99d299){while(--_0x99d299){_0x2d8382['push'](_0x2d8382['shift']());}};_0x549776(++_0x399f26);}(_0x3f31,0x9e));var _0x13f3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f31[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x13f3('0x0'));var attributes=require(_0x13f3('0x1'));function getQueuesByChannel(_0x51de3b,_0x2da469){var _0x253876='get'+_0x2da469+'Queues';return _0x51de3b[_0x253876]()['then'](function(_0x281e32){return _[_0x13f3('0x2')](_0x281e32,function(_0x108767){_0x108767[_0x13f3('0x3')](_0x13f3('0x4'),_0x2da469);return _0x108767;});})[_0x13f3('0x5')](function(_0x2d6170){throw _0x2d6170;});}module[_0x13f3('0x6')]=function(_0x526ebc){return _0x526ebc[_0x13f3('0x7')](_0x13f3('0x8'),attributes,{'tableName':_0x13f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x185eb2=this;var _0x36530e=[_0x13f3('0xa'),_0x13f3('0xb'),'Mail',_0x13f3('0xc'),_0x13f3('0xd'),_0x13f3('0xe'),_0x13f3('0xf')];return Promise['resolve']()['then'](function(){var _0x154d6c=_[_0x13f3('0x2')](_0x36530e,function(_0x433cb3){return getQueuesByChannel(_0x185eb2,_0x433cb3);});return Promise[_0x13f3('0x10')](_0x154d6c);})[_0x13f3('0x5')](function(_0x445fdb){throw _0x445fdb;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 043b7b7..5cf7f98 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 _0x8da5=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20509d,_0x2bdf9d){var _0x3d5142=function(_0x23b002){while(--_0x23b002){_0x20509d['push'](_0x20509d['shift']());}};_0x3d5142(++_0x2bdf9d);}(_0x8da5,0x82));var _0x58da=function(_0x29dab8,_0x180f43){_0x29dab8=_0x29dab8-0x0;var _0x4a75cd=_0x8da5[_0x29dab8];return _0x4a75cd;};'use strict';var _=require(_0x58da('0x0'));var util=require(_0x58da('0x1'));var moment=require(_0x58da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58da('0x3'));var db=require(_0x58da('0x4'))['db'];var utils=require(_0x58da('0x5'));var logger=require(_0x58da('0x6'))('rpc');var config=require(_0x58da('0x7'));var jayson=require(_0x58da('0x8'));var client=jayson[_0x58da('0x9')][_0x58da('0xa')]({'port':0x232a});config[_0x58da('0xb')]=_[_0x58da('0xc')](config[_0x58da('0xb')],{'host':_0x58da('0xd'),'port':0x18eb});var socket=require(_0x58da('0xe'))(new Redis(config['redis']));require(_0x58da('0xf'))[_0x58da('0x10')](socket);function respondWithRpcPromise(_0x2cd9b5,_0xcb6cae,_0x12cbb9){return new BPromise(function(_0x5e990d,_0x2234e1){return client[_0x58da('0x11')](_0x2cd9b5,_0x12cbb9)['then'](function(_0x5eb78f){logger[_0x58da('0x12')](_0x58da('0x13'),_0xcb6cae,'request\x20sent');logger[_0x58da('0x14')](_0x58da('0x15'),_0xcb6cae,_0x58da('0x16'),JSON[_0x58da('0x17')](_0x5eb78f));if(_0x5eb78f[_0x58da('0x18')]){if(_0x5eb78f['error']['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0xcb6cae,_0x5eb78f[_0x58da('0x18')]['message']);return _0x2234e1(_0x5eb78f[_0x58da('0x18')][_0x58da('0x19')]);}logger[_0x58da('0x18')](_0x58da('0x13'),_0xcb6cae,_0x5eb78f[_0x58da('0x18')]['message']);return _0x5e990d(_0x5eb78f[_0x58da('0x18')]['message']);}else{logger[_0x58da('0x12')](_0x58da('0x13'),_0xcb6cae,_0x58da('0x16'));_0x5e990d(_0x5eb78f[_0x58da('0x1a')][_0x58da('0x19')]);}})[_0x58da('0x1b')](function(_0x497163){logger[_0x58da('0x18')]('Team,\x20%s,\x20%s',_0xcb6cae,_0x497163);_0x2234e1(_0x497163);});});} \ No newline at end of file +var _0x3c2f=['error','code','Team,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./team.socket','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x3c2f,0x91));var _0xf3c2=function(_0xc0374e,_0x2de1fc){_0xc0374e=_0xc0374e-0x0;var _0x3cabe1=_0x3c2f[_0xc0374e];return _0x3cabe1;};'use strict';var _=require(_0xf3c2('0x0'));var util=require('util');var moment=require(_0xf3c2('0x1'));var BPromise=require(_0xf3c2('0x2'));var rs=require(_0xf3c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3c2('0x5'))(_0xf3c2('0x6'));var config=require('../../config/environment');var jayson=require(_0xf3c2('0x7'));var client=jayson[_0xf3c2('0x8')][_0xf3c2('0x9')]({'port':0x232a});config[_0xf3c2('0xa')]=_['defaults'](config[_0xf3c2('0xa')],{'host':_0xf3c2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3c2('0xa')]));require(_0xf3c2('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b9ec5,_0x3d7597,_0x518f7a){return new BPromise(function(_0x5b3b7a,_0x196011){return client['request'](_0x5b9ec5,_0x518f7a)['then'](function(_0xb6905d){logger['info']('Team,\x20%s,\x20%s',_0x3d7597,'request\x20sent');logger['debug'](_0xf3c2('0xd'),_0x3d7597,_0xf3c2('0xe'),JSON[_0xf3c2('0xf')](_0xb6905d));if(_0xb6905d[_0xf3c2('0x10')]){if(_0xb6905d[_0xf3c2('0x10')][_0xf3c2('0x11')]===0x1f4){logger[_0xf3c2('0x10')](_0xf3c2('0x12'),_0x3d7597,_0xb6905d[_0xf3c2('0x10')][_0xf3c2('0x13')]);return _0x196011(_0xb6905d['error'][_0xf3c2('0x13')]);}logger[_0xf3c2('0x10')](_0xf3c2('0x12'),_0x3d7597,_0xb6905d[_0xf3c2('0x10')][_0xf3c2('0x13')]);return _0x5b3b7a(_0xb6905d[_0xf3c2('0x10')][_0xf3c2('0x13')]);}else{logger[_0xf3c2('0x14')](_0xf3c2('0x12'),_0x3d7597,'request\x20sent');_0x5b3b7a(_0xb6905d[_0xf3c2('0x15')][_0xf3c2('0x13')]);}})[_0xf3c2('0x16')](function(_0x50dea7){logger[_0xf3c2('0x10')](_0xf3c2('0x12'),_0x3d7597,_0x50dea7);_0x196011(_0x50dea7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4abc9cc..8a64200 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 _0xeea2=['./team.events','emit','removeListener','register','length','team:'];(function(_0x418bcb,_0x30826b){var _0x2351cf=function(_0x4eb9f2){while(--_0x4eb9f2){_0x418bcb['push'](_0x418bcb['shift']());}};_0x2351cf(++_0x30826b);}(_0xeea2,0x192));var _0x2eea=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xeea2[_0x1deb03];return _0x189fe7;};'use strict';var TeamEvents=require(_0x2eea('0x0'));var events=['save','remove','update'];function createListener(_0x32cb09,_0x10d7a7){return function(_0x33ec50){_0x10d7a7[_0x2eea('0x1')](_0x32cb09,_0x33ec50);};}function removeListener(_0x1180d5,_0x142cbf){return function(){TeamEvents[_0x2eea('0x2')](_0x1180d5,_0x142cbf);};}exports[_0x2eea('0x3')]=function(_0xa9626f){for(var _0x283447=0x0,_0x22085e=events[_0x2eea('0x4')];_0x283447<_0x22085e;_0x283447++){var _0x4ca727=events[_0x283447];var _0xe90267=createListener(_0x2eea('0x5')+_0x4ca727,_0xa9626f);TeamEvents['on'](_0x4ca727,_0xe90267);}}; \ No newline at end of file +var _0x2036=['length','team:','./team.events','save','remove','emit','removeListener','register'];(function(_0x536567,_0x5beecf){var _0x58077a=function(_0x315c2e){while(--_0x315c2e){_0x536567['push'](_0x536567['shift']());}};_0x58077a(++_0x5beecf);}(_0x2036,0x19a));var _0x6203=function(_0x1cfba1,_0xceafc){_0x1cfba1=_0x1cfba1-0x0;var _0x4fd6aa=_0x2036[_0x1cfba1];return _0x4fd6aa;};'use strict';var TeamEvents=require(_0x6203('0x0'));var events=[_0x6203('0x1'),_0x6203('0x2'),'update'];function createListener(_0x5f5d9c,_0x591739){return function(_0x1d970a){_0x591739[_0x6203('0x3')](_0x5f5d9c,_0x1d970a);};}function removeListener(_0x1f9cee,_0x358177){return function(){TeamEvents[_0x6203('0x4')](_0x1f9cee,_0x358177);};}exports[_0x6203('0x5')]=function(_0x444d4e){for(var _0x4c50ac=0x0,_0x6a647=events[_0x6203('0x6')];_0x4c50ac<_0x6a647;_0x4c50ac++){var _0x455035=events[_0x4c50ac];var _0x134874=createListener(_0x6203('0x7')+_0x455035,_0x444d4e);TeamEvents['on'](_0x455035,_0x134874);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 2fc69ac..182ae59 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 _0xb7fc=['INTEGER','sequelize'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0xb82940,_0x530318){_0xb82940=_0xb82940-0x0;var _0x2e152a=_0xb7fc[_0xb82940];return _0x2e152a;};'use strict';var Sequelize=require(_0xcb7f('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xcb7f('0x1')]}}; \ No newline at end of file +var _0xfad0=['exports','INTEGER'];(function(_0xabc65e,_0x2c6fb2){var _0x19d15d=function(_0x17e36a){while(--_0x17e36a){_0xabc65e['push'](_0xabc65e['shift']());}};_0x19d15d(++_0x2c6fb2);}(_0xfad0,0xb0));var _0x0fad=function(_0x29252b,_0x465a2a){_0x29252b=_0x29252b-0x0;var _0xa95162=_0xfad0[_0x29252b];return _0xa95162;};'use strict';var Sequelize=require('sequelize');module[_0x0fad('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0fad('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index da38108..6b8b8f4 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 _0x2116=['./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1abf92,_0x2d531e){var _0x2ab09b=function(_0x51afa3){while(--_0x51afa3){_0x1abf92['push'](_0x1abf92['shift']());}};_0x2ab09b(++_0x2d531e);}(_0x2116,0x67));var _0x6211=function(_0x2aa8ae,_0x10963b){_0x2aa8ae=_0x2aa8ae-0x0;var _0xca728f=_0x2116[_0x2aa8ae];return _0xca728f;};'use strict';var _=require('lodash');var util=require(_0x6211('0x0'));var logger=require('../../config/logger')(_0x6211('0x1'));var moment=require(_0x6211('0x2'));var BPromise=require(_0x6211('0x3'));var rp=require(_0x6211('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6211('0x5'));var config=require(_0x6211('0x6'));var attributes=require(_0x6211('0x7'));module[_0x6211('0x8')]=function(_0x5cac18,_0x37d71a){return _0x5cac18['define'](_0x6211('0x9'),attributes,{'tableName':_0x6211('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8efc=['exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf','./teamVoicePrefix.attributes'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x8efc,0xb3));var _0xc8ef=function(_0x934754,_0x15bd40){_0x934754=_0x934754-0x0;var _0x5cf1fc=_0x8efc[_0x934754];return _0x5cf1fc;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var logger=require(_0xc8ef('0x1'))(_0xc8ef('0x2'));var moment=require(_0xc8ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ef('0x4'));var fs=require('fs');var path=require(_0xc8ef('0x5'));var rimraf=require(_0xc8ef('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8ef('0x7'));module[_0xc8ef('0x8')]=function(_0x1cd466,_0x13b433){return _0x1cd466['define'](_0xc8ef('0x9'),attributes,{'tableName':_0xc8ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2f49e06..b3ead84 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(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1e7823,_0x539017){var _0x2a8aa7=function(_0x2bbd9b){while(--_0x2bbd9b){_0x1e7823['push'](_0x1e7823['shift']());}};_0x2a8aa7(++_0x539017);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2150c83..2009ef7 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 _0x2f38=['INTEGER','sequelize'];(function(_0x516016,_0x57f166){var _0x32a189=function(_0x42b048){while(--_0x42b048){_0x516016['push'](_0x516016['shift']());}};_0x32a189(++_0x57f166);}(_0x2f38,0x95));var _0x82f3=function(_0x4fae24,_0x1e3406){_0x4fae24=_0x4fae24-0x0;var _0x1f0403=_0x2f38[_0x4fae24];return _0x1f0403;};'use strict';var Sequelize=require(_0x82f3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x82f3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d29=['sequelize'];(function(_0x8ec04e,_0x2c9ed0){var _0x4c2208=function(_0x5a10db){while(--_0x5a10db){_0x8ec04e['push'](_0x8ec04e['shift']());}};_0x4c2208(++_0x2c9ed0);}(_0x4d29,0x13c));var _0x94d2=function(_0x3034e1,_0x5d10e5){_0x3034e1=_0x3034e1-0x0;var _0x5ca62d=_0x4d29[_0x3034e1];return _0x5ca62d;};'use strict';var Sequelize=require(_0x94d2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 80f616b..f304f3d 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 _0x83d3=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x13d527,_0x281954){var _0x5d51a7=function(_0x3916db){while(--_0x3916db){_0x13d527['push'](_0x13d527['shift']());}};_0x5d51a7(++_0x281954);}(_0x83d3,0x17c));var _0x383d=function(_0x148bd2,_0x3338c6){_0x148bd2=_0x148bd2-0x0;var _0x38c56f=_0x83d3[_0x148bd2];return _0x38c56f;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9009=['path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x41e265,_0x54b072){var _0x58a49f=function(_0x5cf93b){while(--_0x5cf93b){_0x41e265['push'](_0x41e265['shift']());}};_0x58a49f(++_0x54b072);}(_0x9009,0x1d4));var _0x9900=function(_0x199b02,_0x38806c){_0x199b02=_0x199b02-0x0;var _0x11b50a=_0x9009[_0x199b02];return _0x11b50a;};'use strict';var _=require(_0x9900('0x0'));var util=require('util');var logger=require(_0x9900('0x1'))(_0x9900('0x2'));var moment=require('moment');var BPromise=require(_0x9900('0x3'));var rp=require(_0x9900('0x4'));var fs=require('fs');var path=require(_0x9900('0x5'));var rimraf=require(_0x9900('0x6'));var config=require('../../config/environment');var attributes=require(_0x9900('0x7'));module[_0x9900('0x8')]=function(_0x502dac,_0x59dd25){return _0x502dac[_0x9900('0x9')](_0x9900('0xa'),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 7bf997c..0d0fd96 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 _0x48fb=['then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x3a2b33,_0x4cc8a3){var _0x30dd48=function(_0x2c17a9){while(--_0x2c17a9){_0x3a2b33['push'](_0x3a2b33['shift']());}};_0x30dd48(++_0x4cc8a3);}(_0x48fb,0xad));var _0xb48f=function(_0x14284e,_0x57c0f4){_0x14284e=_0x14284e-0x0;var _0x33ca89=_0x48fb[_0x14284e];return _0x33ca89;};'use strict';var _=require(_0xb48f('0x0'));var util=require(_0xb48f('0x1'));var moment=require(_0xb48f('0x2'));var BPromise=require(_0xb48f('0x3'));var rs=require(_0xb48f('0x4'));var fs=require('fs');var Redis=require(_0xb48f('0x5'));var db=require(_0xb48f('0x6'))['db'];var utils=require(_0xb48f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb48f('0x8'));var jayson=require(_0xb48f('0x9'));var client=jayson['client'][_0xb48f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x560d8c,_0x22bc9c,_0x80ab5c){return new BPromise(function(_0x4b97db,_0x467f0a){return client['request'](_0x560d8c,_0x80ab5c)[_0xb48f('0xb')](function(_0x4b9404){logger[_0xb48f('0xc')](_0xb48f('0xd'),_0x22bc9c,'request\x20sent');logger[_0xb48f('0xe')](_0xb48f('0xf'),_0x22bc9c,_0xb48f('0x10'),JSON[_0xb48f('0x11')](_0x4b9404));if(_0x4b9404[_0xb48f('0x12')]){if(_0x4b9404[_0xb48f('0x12')][_0xb48f('0x13')]===0x1f4){logger[_0xb48f('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x22bc9c,_0x4b9404[_0xb48f('0x12')][_0xb48f('0x14')]);return _0x467f0a(_0x4b9404[_0xb48f('0x12')][_0xb48f('0x14')]);}logger[_0xb48f('0x12')](_0xb48f('0xd'),_0x22bc9c,_0x4b9404[_0xb48f('0x12')][_0xb48f('0x14')]);return _0x4b97db(_0x4b9404['error'][_0xb48f('0x14')]);}else{logger['info'](_0xb48f('0xd'),_0x22bc9c,_0xb48f('0x10'));_0x4b97db(_0x4b9404[_0xb48f('0x15')]['message']);}})[_0xb48f('0x16')](function(_0x2b5e33){logger[_0xb48f('0x12')](_0xb48f('0xd'),_0x22bc9c,_0x2b5e33);_0x467f0a(_0x2b5e33);});});} \ No newline at end of file +var _0x3ee5=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x956279,_0x2ddd55){var _0x37ba3a=function(_0x20c560){while(--_0x20c560){_0x956279['push'](_0x956279['shift']());}};_0x37ba3a(++_0x2ddd55);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x2bb989,_0x430def){_0x2bb989=_0x2bb989-0x0;var _0x2b1934=_0x3ee5[_0x2bb989];return _0x2b1934;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var moment=require(_0x53ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require(_0x53ee('0x3'));var db=require(_0x53ee('0x4'))['db'];var utils=require(_0x53ee('0x5'));var logger=require(_0x53ee('0x6'))(_0x53ee('0x7'));var config=require(_0x53ee('0x8'));var jayson=require(_0x53ee('0x9'));var client=jayson[_0x53ee('0xa')][_0x53ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3173b2,_0x48bc62,_0x299b23){return new BPromise(function(_0x235c9f,_0x1ec296){return client[_0x53ee('0xc')](_0x3173b2,_0x299b23)[_0x53ee('0xd')](function(_0x3b1252){logger[_0x53ee('0xe')](_0x53ee('0xf'),_0x48bc62,_0x53ee('0x10'));logger[_0x53ee('0x11')](_0x53ee('0x12'),_0x48bc62,_0x53ee('0x10'),JSON['stringify'](_0x3b1252));if(_0x3b1252['error']){if(_0x3b1252[_0x53ee('0x13')][_0x53ee('0x14')]===0x1f4){logger[_0x53ee('0x13')](_0x53ee('0xf'),_0x48bc62,_0x3b1252[_0x53ee('0x13')]['message']);return _0x1ec296(_0x3b1252['error'][_0x53ee('0x15')]);}logger[_0x53ee('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x48bc62,_0x3b1252['error'][_0x53ee('0x15')]);return _0x235c9f(_0x3b1252[_0x53ee('0x13')][_0x53ee('0x15')]);}else{logger['info'](_0x53ee('0xf'),_0x48bc62,_0x53ee('0x10'));_0x235c9f(_0x3b1252[_0x53ee('0x16')][_0x53ee('0x15')]);}})[_0x53ee('0x17')](function(_0x2fb3cd){logger['error'](_0x53ee('0xf'),_0x48bc62,_0x2fb3cd);_0x1ec296(_0x2fb3cd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 51adb1c..7a9cfa4 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 _0x84c6=['index','/:id','show','create','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x84c6,0xe7));var _0x684c=function(_0x597e5d,_0x2954d5){_0x597e5d=_0x597e5d-0x0;var _0x6a6659=_0x84c6[_0x597e5d];return _0x6a6659;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x684c('0x0'));var timeout=require(_0x684c('0x1'));var express=require(_0x684c('0x2'));var router=express['Router']();var fs_extra=require(_0x684c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x684c('0x4'));var config=require(_0x684c('0x5'));var controller=require(_0x684c('0x6'));router[_0x684c('0x7')]('/',auth[_0x684c('0x8')](),controller[_0x684c('0x9')]);router[_0x684c('0x7')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller[_0x684c('0xb')]);router['post']('/',auth[_0x684c('0x8')](),controller[_0x684c('0xc')]);router['put'](_0x684c('0xa'),auth['isAuthenticated'](),controller[_0x684c('0xd')]);router[_0x684c('0xe')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller[_0x684c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9672=['index','get','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x3b1b15,_0x3f06e7){var _0x7ef41e=function(_0x5aaac0){while(--_0x5aaac0){_0x3b1b15['push'](_0x3b1b15['shift']());}};_0x7ef41e(++_0x3f06e7);}(_0x9672,0xee));var _0x2967=function(_0x2bb7f3,_0x115f68){_0x2bb7f3=_0x2bb7f3-0x0;var _0x5f32b4=_0x9672[_0x2bb7f3];return _0x5f32b4;};'use strict';var multer=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var path=require('path');var timeout=require(_0x2967('0x2'));var express=require(_0x2967('0x3'));var router=express[_0x2967('0x4')]();var fs_extra=require(_0x2967('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var controller=require(_0x2967('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2967('0x9')]);router[_0x2967('0xa')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0xd')]);router[_0x2967('0xe')]('/',auth[_0x2967('0xc')](),controller[_0x2967('0xf')]);router['put'](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0x10')]);router[_0x2967('0x11')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller['destroy']);module[_0x2967('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f95b449..246ff3d 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 _0x4f65=['TEXT','exports','STRING'];(function(_0xfdaa90,_0x1436fd){var _0xfac4bd=function(_0x38dd72){while(--_0x38dd72){_0xfdaa90['push'](_0xfdaa90['shift']());}};_0xfac4bd(++_0x1436fd);}(_0x4f65,0x190));var _0x54f6=function(_0x649ab2,_0x4a19ff){_0x649ab2=_0x649ab2-0x0;var _0x1f58ff=_0x4f65[_0x649ab2];return _0x1f58ff;};'use strict';var Sequelize=require('sequelize');module[_0x54f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x54f6('0x1')]},'html':{'type':Sequelize[_0x54f6('0x2')]}}; \ No newline at end of file +var _0x911a=['STRING','TEXT','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x911a,0xc2));var _0xa911=function(_0x2e6208,_0x276106){_0x2e6208=_0x2e6208-0x0;var _0x299024=_0x911a[_0x2e6208];return _0x299024;};'use strict';var Sequelize=require(_0xa911('0x0'));module[_0xa911('0x1')]={'name':{'type':Sequelize[_0xa911('0x2')]},'description':{'type':Sequelize[_0xa911('0x2')]},'html':{'type':Sequelize[_0xa911('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b3ae100..9f4bd46 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 _0x9654=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','find','eml-format','rimraf','request-promise','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x2d8fef,_0x218e69){var _0x4b794d=function(_0x1005fd){while(--_0x1005fd){_0x2d8fef['push'](_0x2d8fef['shift']());}};_0x4b794d(++_0x218e69);}(_0x9654,0x1db));var _0x4965=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0x9654[_0x4b64a4];return _0xd19b0e;};'use strict';var emlformat=require(_0x4965('0x0'));var rimraf=require(_0x4965('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4965('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4965('0x3'));var path=require(_0x4965('0x4'));var sox=require(_0x4965('0x5'));var csv=require(_0x4965('0x6'));var ejs=require(_0x4965('0x7'));var fs=require('fs');var fs_extra=require(_0x4965('0x8'));var _=require(_0x4965('0x9'));var squel=require(_0x4965('0xa'));var crypto=require(_0x4965('0xb'));var jsforce=require(_0x4965('0xc'));var deskjs=require(_0x4965('0xd'));var toCsv=require(_0x4965('0x6'));var querystring=require(_0x4965('0xe'));var Papa=require(_0x4965('0xf'));var Redis=require(_0x4965('0x10'));var authService=require(_0x4965('0x11'));var qs=require(_0x4965('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4965('0x13'))(_0x4965('0x14'));var utils=require(_0x4965('0x15'));var config=require(_0x4965('0x16'));var licenseUtil=require(_0x4965('0x17'));var db=require(_0x4965('0x18'))['db'];function respondWithStatusCode(_0x1f6b82,_0xc3145c){_0xc3145c=_0xc3145c||0xcc;return function(_0xa4182f){if(_0xa4182f){return _0x1f6b82[_0x4965('0x19')](_0xc3145c);}return _0x1f6b82[_0x4965('0x1a')](_0xc3145c)[_0x4965('0x1b')]();};}function respondWithResult(_0x5a6038,_0x186134){_0x186134=_0x186134||0xc8;return function(_0x3d14fc){if(_0x3d14fc){return _0x5a6038['status'](_0x186134)[_0x4965('0x1c')](_0x3d14fc);}};}function respondWithFilteredResult(_0x34a209,_0x33d667){return function(_0x49d5ba){if(_0x49d5ba){var _0x3018c1=typeof _0x33d667[_0x4965('0x1d')]===_0x4965('0x1e')&&typeof _0x33d667[_0x4965('0x1f')]==='undefined';var _0xa9d84d=_0x49d5ba[_0x4965('0x20')];var _0x491945=_0x3018c1?0x0:_0x33d667[_0x4965('0x1d')];var _0x5a340a=_0x3018c1?_0x49d5ba[_0x4965('0x20')]:_0x33d667['offset']+_0x33d667[_0x4965('0x1f')];var _0x16b686;if(_0x5a340a>=_0xa9d84d){_0x5a340a=_0xa9d84d;_0x16b686=0xc8;}else{_0x16b686=0xce;}_0x34a209['status'](_0x16b686);return _0x34a209[_0x4965('0x21')](_0x4965('0x22'),_0x491945+'-'+_0x5a340a+'/'+_0xa9d84d)['json'](_0x49d5ba);}return null;};}function patchUpdates(_0x42367b){return function(_0x3515dd){try{jsonpatch['apply'](_0x3515dd,_0x42367b,!![]);}catch(_0x1be395){return BPromise[_0x4965('0x23')](_0x1be395);}return _0x3515dd[_0x4965('0x24')]();};}function saveUpdates(_0x37f994,_0x5c16e3){return function(_0x2d813c){if(_0x2d813c){return _0x2d813c[_0x4965('0x25')](_0x37f994)[_0x4965('0x26')](function(_0x46e693){return _0x46e693;});}return null;};}function removeEntity(_0xf45197,_0x10f2fd){return function(_0x44977d){if(_0x44977d){return _0x44977d[_0x4965('0x27')]()[_0x4965('0x26')](function(){var _0x429920=_0x44977d[_0x4965('0x28')]({'plain':!![]});var _0x2f7727=_0x4965('0x29');return db[_0x4965('0x2a')][_0x4965('0x27')]({'where':{'type':_0x2f7727,'resourceId':_0x429920['id']}})['then'](function(){return _0x44977d;});})[_0x4965('0x26')](function(){_0xf45197[_0x4965('0x1a')](0xcc)[_0x4965('0x1b')]();});}};}function handleEntityNotFound(_0x427160,_0x46af3d){return function(_0x2ed8ec){if(!_0x2ed8ec){_0x427160['sendStatus'](0x194);}return _0x2ed8ec;};}function handleError(_0x4ac8af,_0x5c78ac){_0x5c78ac=_0x5c78ac||0x1f4;return function(_0xd0fb09){logger[_0x4965('0x2b')](_0xd0fb09[_0x4965('0x2c')]);if(_0xd0fb09[_0x4965('0x2d')]){delete _0xd0fb09[_0x4965('0x2d')];}_0x4ac8af[_0x4965('0x1a')](_0x5c78ac)[_0x4965('0x2e')](_0xd0fb09);};}exports[_0x4965('0x2f')]=function(_0x4de475,_0x5e7ca6){var _0x21f58c={},_0x58ffe0={},_0x18bca7={'count':0x0,'rows':[]};var _0x5c7d54=_[_0x4965('0x30')](db[_0x4965('0x31')][_0x4965('0x32')],function(_0xed5b60){return{'name':_0xed5b60[_0x4965('0x33')],'type':_0xed5b60[_0x4965('0x34')][_0x4965('0x35')]};});_0x58ffe0[_0x4965('0x36')]=_['map'](_0x5c7d54,_0x4965('0x2d'));_0x58ffe0[_0x4965('0x37')]=_[_0x4965('0x38')](_0x4de475[_0x4965('0x37')]);_0x58ffe0[_0x4965('0x39')]=_['intersection'](_0x58ffe0[_0x4965('0x36')],_0x58ffe0[_0x4965('0x37')]);_0x21f58c['attributes']=_[_0x4965('0x3a')](_0x58ffe0['model'],qs[_0x4965('0x3b')](_0x4de475[_0x4965('0x37')][_0x4965('0x3b')]));_0x21f58c['attributes']=_0x21f58c[_0x4965('0x3c')][_0x4965('0x3d')]?_0x21f58c[_0x4965('0x3c')]:_0x58ffe0[_0x4965('0x36')];if(!_0x4de475['query']['hasOwnProperty']('nolimit')){_0x21f58c[_0x4965('0x1f')]=qs[_0x4965('0x1f')](_0x4de475[_0x4965('0x37')]['limit']);_0x21f58c[_0x4965('0x1d')]=qs['offset'](_0x4de475[_0x4965('0x37')]['offset']);}_0x21f58c[_0x4965('0x3e')]=qs[_0x4965('0x3f')](_0x4de475['query'][_0x4965('0x3f')]);_0x21f58c['where']=qs[_0x4965('0x39')](_[_0x4965('0x40')](_0x4de475[_0x4965('0x37')],_0x58ffe0[_0x4965('0x39')]),_0x5c7d54);if(_0x4de475[_0x4965('0x37')][_0x4965('0x41')]){_0x21f58c['where']=_[_0x4965('0x42')](_0x21f58c[_0x4965('0x43')],{'$or':_['map'](_0x5c7d54,function(_0x2b691a){if(_0x2b691a[_0x4965('0x34')]!==_0x4965('0x44')){var _0x41b669={};_0x41b669[_0x2b691a[_0x4965('0x2d')]]={'$like':'%'+_0x4de475['query'][_0x4965('0x41')]+'%'};return _0x41b669;}})});}_0x21f58c=_['merge']({},_0x21f58c,_0x4de475['options']);var _0x4ba1d6={'where':_0x21f58c[_0x4965('0x43')]};return db[_0x4965('0x31')]['count'](_0x4ba1d6)[_0x4965('0x26')](function(_0x422eda){_0x18bca7[_0x4965('0x20')]=_0x422eda;if(_0x4de475[_0x4965('0x37')][_0x4965('0x45')]){_0x21f58c['include']=[{'all':!![]}];}return db[_0x4965('0x31')][_0x4965('0x46')](_0x21f58c);})[_0x4965('0x26')](function(_0x251177){_0x18bca7[_0x4965('0x47')]=_0x251177;return _0x18bca7;})[_0x4965('0x26')](respondWithFilteredResult(_0x5e7ca6,_0x21f58c))[_0x4965('0x48')](handleError(_0x5e7ca6,null));};exports[_0x4965('0x49')]=function(_0x554c05,_0xaab359){var _0x2cef46={'raw':!![],'where':{'id':_0x554c05[_0x4965('0x4a')]['id']}},_0x2e5abb={};_0x2e5abb[_0x4965('0x36')]=_['keys'](db[_0x4965('0x31')][_0x4965('0x32')]);_0x2e5abb['query']=_[_0x4965('0x38')](_0x554c05[_0x4965('0x37')]);_0x2e5abb['filters']=_['intersection'](_0x2e5abb[_0x4965('0x36')],_0x2e5abb['query']);_0x2cef46['attributes']=_[_0x4965('0x3a')](_0x2e5abb[_0x4965('0x36')],qs[_0x4965('0x3b')](_0x554c05[_0x4965('0x37')][_0x4965('0x3b')]));_0x2cef46[_0x4965('0x3c')]=_0x2cef46[_0x4965('0x3c')][_0x4965('0x3d')]?_0x2cef46['attributes']:_0x2e5abb['model'];if(_0x554c05['query'][_0x4965('0x45')]){_0x2cef46['include']=[{'all':!![]}];}_0x2cef46=_['merge']({},_0x2cef46,_0x554c05[_0x4965('0x4b')]);return db[_0x4965('0x31')]['find'](_0x2cef46)[_0x4965('0x26')](handleEntityNotFound(_0xaab359,null))[_0x4965('0x26')](respondWithResult(_0xaab359,null))[_0x4965('0x48')](handleError(_0xaab359,null));};exports[_0x4965('0x4c')]=function(_0x134318,_0x39ccbf){return db[_0x4965('0x31')][_0x4965('0x4c')](_0x134318[_0x4965('0x4d')],{})['then'](function(_0xfaea9c){var _0x4e1209=_0x134318['user'][_0x4965('0x28')]({'plain':!![]});if(!_0x4e1209)throw new Error(_0x4965('0x4e'));if(_0x4e1209[_0x4965('0x4f')]===_0x4965('0x50')){var _0x24a9a2=_0xfaea9c['get']({'plain':!![]});var _0x527951=_0x4965('0x29');return db[_0x4965('0x51')]['find']({'where':{'name':_0x527951,'userProfileId':_0x4e1209['userProfileId']},'raw':!![]})[_0x4965('0x26')](function(_0x56717a){if(_0x56717a&&_0x56717a[_0x4965('0x52')]===0x0){return db[_0x4965('0x2a')][_0x4965('0x4c')]({'name':_0x24a9a2['name'],'resourceId':_0x24a9a2['id'],'type':_0x56717a[_0x4965('0x2d')],'sectionId':_0x56717a['id']},{})[_0x4965('0x26')](function(){return _0xfaea9c;});}else{return _0xfaea9c;}})[_0x4965('0x48')](function(_0xf2452c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf2452c);throw _0xf2452c;});}return _0xfaea9c;})['then'](respondWithResult(_0x39ccbf,0xc9))['catch'](handleError(_0x39ccbf,null));};exports[_0x4965('0x25')]=function(_0x17608a,_0x4e46aa){if(_0x17608a[_0x4965('0x4d')]['id']){delete _0x17608a['body']['id'];}return db['Template']['find']({'where':{'id':_0x17608a['params']['id']}})[_0x4965('0x26')](handleEntityNotFound(_0x4e46aa,null))[_0x4965('0x26')](saveUpdates(_0x17608a[_0x4965('0x4d')],null))[_0x4965('0x26')](respondWithResult(_0x4e46aa,null))['catch'](handleError(_0x4e46aa,null));};exports['destroy']=function(_0x3cae91,_0x31c93d){return db['Template'][_0x4965('0x53')]({'where':{'id':_0x3cae91['params']['id']}})['then'](handleEntityNotFound(_0x31c93d,null))[_0x4965('0x26')](removeEntity(_0x31c93d,null))[_0x4965('0x48')](handleError(_0x31c93d,null));}; \ No newline at end of file +var _0x6a95=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','index','map','Template','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','params','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','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'];(function(_0x1c7377,_0x8a8698){var _0x5d03e3=function(_0x1d7bb1){while(--_0x1d7bb1){_0x1c7377['push'](_0x1c7377['shift']());}};_0x5d03e3(++_0x8a8698);}(_0x6a95,0xdb));var _0x56a9=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6a95[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x56a9('0x2'));var moment=require('moment');var BPromise=require(_0x56a9('0x3'));var Mustache=require(_0x56a9('0x4'));var util=require(_0x56a9('0x5'));var path=require(_0x56a9('0x6'));var sox=require(_0x56a9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56a9('0x8'));var _=require(_0x56a9('0x9'));var squel=require(_0x56a9('0xa'));var crypto=require(_0x56a9('0xb'));var jsforce=require(_0x56a9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x56a9('0xd'));var Papa=require(_0x56a9('0xe'));var Redis=require('ioredis');var authService=require(_0x56a9('0xf'));var qs=require(_0x56a9('0x10'));var as=require(_0x56a9('0x11'));var hardwareService=require(_0x56a9('0x12'));var logger=require(_0x56a9('0x13'))(_0x56a9('0x14'));var utils=require(_0x56a9('0x15'));var config=require(_0x56a9('0x16'));var licenseUtil=require(_0x56a9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16d236,_0x3e4f58){_0x3e4f58=_0x3e4f58||0xcc;return function(_0x715055){if(_0x715055){return _0x16d236[_0x56a9('0x18')](_0x3e4f58);}return _0x16d236[_0x56a9('0x19')](_0x3e4f58)[_0x56a9('0x1a')]();};}function respondWithResult(_0x5967ba,_0x18663d){_0x18663d=_0x18663d||0xc8;return function(_0x3c6f7f){if(_0x3c6f7f){return _0x5967ba['status'](_0x18663d)[_0x56a9('0x1b')](_0x3c6f7f);}};}function respondWithFilteredResult(_0x47fb97,_0x303a93){return function(_0x27824e){if(_0x27824e){var _0x30c352=typeof _0x303a93[_0x56a9('0x1c')]===_0x56a9('0x1d')&&typeof _0x303a93[_0x56a9('0x1e')]===_0x56a9('0x1d');var _0x4428ae=_0x27824e[_0x56a9('0x1f')];var _0x54c4f0=_0x30c352?0x0:_0x303a93[_0x56a9('0x1c')];var _0x53153e=_0x30c352?_0x27824e[_0x56a9('0x1f')]:_0x303a93['offset']+_0x303a93['limit'];var _0x4a40f2;if(_0x53153e>=_0x4428ae){_0x53153e=_0x4428ae;_0x4a40f2=0xc8;}else{_0x4a40f2=0xce;}_0x47fb97[_0x56a9('0x19')](_0x4a40f2);return _0x47fb97[_0x56a9('0x20')](_0x56a9('0x21'),_0x54c4f0+'-'+_0x53153e+'/'+_0x4428ae)[_0x56a9('0x1b')](_0x27824e);}return null;};}function patchUpdates(_0x212b3e){return function(_0x4e6fe4){try{jsonpatch[_0x56a9('0x22')](_0x4e6fe4,_0x212b3e,!![]);}catch(_0x3b71a6){return BPromise[_0x56a9('0x23')](_0x3b71a6);}return _0x4e6fe4['save']();};}function saveUpdates(_0x5810fc,_0x18b5dd){return function(_0x183bb1){if(_0x183bb1){return _0x183bb1[_0x56a9('0x24')](_0x5810fc)[_0x56a9('0x25')](function(_0x6bb9ed){return _0x6bb9ed;});}return null;};}function removeEntity(_0x445f00,_0x56bece){return function(_0x5ca7dd){if(_0x5ca7dd){return _0x5ca7dd['destroy']()[_0x56a9('0x25')](function(){var _0x1c5759=_0x5ca7dd[_0x56a9('0x26')]({'plain':!![]});var _0x4b4637=_0x56a9('0x27');return db[_0x56a9('0x28')][_0x56a9('0x29')]({'where':{'type':_0x4b4637,'resourceId':_0x1c5759['id']}})['then'](function(){return _0x5ca7dd;});})[_0x56a9('0x25')](function(){_0x445f00[_0x56a9('0x19')](0xcc)[_0x56a9('0x1a')]();});}};}function handleEntityNotFound(_0x355bab,_0x3c048e){return function(_0x321fae){if(!_0x321fae){_0x355bab[_0x56a9('0x18')](0x194);}return _0x321fae;};}function handleError(_0xbbb4b,_0x5cea56){_0x5cea56=_0x5cea56||0x1f4;return function(_0x12034e){logger[_0x56a9('0x2a')](_0x12034e[_0x56a9('0x2b')]);if(_0x12034e[_0x56a9('0x2c')]){delete _0x12034e['name'];}_0xbbb4b['status'](_0x5cea56)[_0x56a9('0x2d')](_0x12034e);};}exports[_0x56a9('0x2e')]=function(_0x361706,_0x344cd7){var _0x3ce574={},_0x1e9502={},_0x1e764d={'count':0x0,'rows':[]};var _0x566323=_[_0x56a9('0x2f')](db[_0x56a9('0x30')][_0x56a9('0x31')],function(_0x2c9b16){return{'name':_0x2c9b16['fieldName'],'type':_0x2c9b16['type']['key']};});_0x1e9502['model']=_[_0x56a9('0x2f')](_0x566323,_0x56a9('0x2c'));_0x1e9502[_0x56a9('0x32')]=_[_0x56a9('0x33')](_0x361706['query']);_0x1e9502[_0x56a9('0x34')]=_[_0x56a9('0x35')](_0x1e9502[_0x56a9('0x36')],_0x1e9502['query']);_0x3ce574[_0x56a9('0x37')]=_['intersection'](_0x1e9502[_0x56a9('0x36')],qs[_0x56a9('0x38')](_0x361706[_0x56a9('0x32')][_0x56a9('0x38')]));_0x3ce574['attributes']=_0x3ce574[_0x56a9('0x37')][_0x56a9('0x39')]?_0x3ce574[_0x56a9('0x37')]:_0x1e9502[_0x56a9('0x36')];if(!_0x361706[_0x56a9('0x32')][_0x56a9('0x3a')](_0x56a9('0x3b'))){_0x3ce574[_0x56a9('0x1e')]=qs[_0x56a9('0x1e')](_0x361706['query'][_0x56a9('0x1e')]);_0x3ce574[_0x56a9('0x1c')]=qs[_0x56a9('0x1c')](_0x361706['query'][_0x56a9('0x1c')]);}_0x3ce574[_0x56a9('0x3c')]=qs[_0x56a9('0x3d')](_0x361706[_0x56a9('0x32')]['sort']);_0x3ce574['where']=qs['filters'](_[_0x56a9('0x3e')](_0x361706['query'],_0x1e9502['filters']),_0x566323);if(_0x361706[_0x56a9('0x32')][_0x56a9('0x3f')]){_0x3ce574[_0x56a9('0x40')]=_[_0x56a9('0x41')](_0x3ce574[_0x56a9('0x40')],{'$or':_['map'](_0x566323,function(_0x2566db){if(_0x2566db[_0x56a9('0x42')]!==_0x56a9('0x43')){var _0xd12c60={};_0xd12c60[_0x2566db['name']]={'$like':'%'+_0x361706[_0x56a9('0x32')][_0x56a9('0x3f')]+'%'};return _0xd12c60;}})});}_0x3ce574=_[_0x56a9('0x41')]({},_0x3ce574,_0x361706[_0x56a9('0x44')]);var _0x162c09={'where':_0x3ce574[_0x56a9('0x40')]};return db[_0x56a9('0x30')][_0x56a9('0x1f')](_0x162c09)[_0x56a9('0x25')](function(_0x398647){_0x1e764d[_0x56a9('0x1f')]=_0x398647;if(_0x361706[_0x56a9('0x32')][_0x56a9('0x45')]){_0x3ce574[_0x56a9('0x46')]=[{'all':!![]}];}return db[_0x56a9('0x30')]['findAll'](_0x3ce574);})[_0x56a9('0x25')](function(_0x37c32a){_0x1e764d[_0x56a9('0x47')]=_0x37c32a;return _0x1e764d;})['then'](respondWithFilteredResult(_0x344cd7,_0x3ce574))['catch'](handleError(_0x344cd7,null));};exports['show']=function(_0x230f91,_0xea1d42){var _0x3a156e={'raw':!![],'where':{'id':_0x230f91[_0x56a9('0x48')]['id']}},_0x1fbed2={};_0x1fbed2['model']=_[_0x56a9('0x33')](db[_0x56a9('0x30')][_0x56a9('0x31')]);_0x1fbed2[_0x56a9('0x32')]=_[_0x56a9('0x33')](_0x230f91[_0x56a9('0x32')]);_0x1fbed2['filters']=_[_0x56a9('0x35')](_0x1fbed2[_0x56a9('0x36')],_0x1fbed2[_0x56a9('0x32')]);_0x3a156e[_0x56a9('0x37')]=_['intersection'](_0x1fbed2[_0x56a9('0x36')],qs[_0x56a9('0x38')](_0x230f91[_0x56a9('0x32')]['fields']));_0x3a156e[_0x56a9('0x37')]=_0x3a156e[_0x56a9('0x37')]['length']?_0x3a156e[_0x56a9('0x37')]:_0x1fbed2[_0x56a9('0x36')];if(_0x230f91[_0x56a9('0x32')][_0x56a9('0x45')]){_0x3a156e[_0x56a9('0x46')]=[{'all':!![]}];}_0x3a156e=_[_0x56a9('0x41')]({},_0x3a156e,_0x230f91[_0x56a9('0x44')]);return db[_0x56a9('0x30')][_0x56a9('0x49')](_0x3a156e)['then'](handleEntityNotFound(_0xea1d42,null))[_0x56a9('0x25')](respondWithResult(_0xea1d42,null))[_0x56a9('0x4a')](handleError(_0xea1d42,null));};exports['create']=function(_0x480ef0,_0x57271e){return db[_0x56a9('0x30')]['create'](_0x480ef0[_0x56a9('0x4b')],{})[_0x56a9('0x25')](function(_0x1d8d71){var _0x490626=_0x480ef0['user'][_0x56a9('0x26')]({'plain':!![]});if(!_0x490626)throw new Error(_0x56a9('0x4c'));if(_0x490626['role']===_0x56a9('0x4d')){var _0x8668e5=_0x1d8d71[_0x56a9('0x26')]({'plain':!![]});var _0x2ba9df='Templates';return db[_0x56a9('0x4e')][_0x56a9('0x49')]({'where':{'name':_0x2ba9df,'userProfileId':_0x490626[_0x56a9('0x4f')]},'raw':!![]})['then'](function(_0x746239){if(_0x746239&&_0x746239['autoAssociation']===0x0){return db[_0x56a9('0x28')][_0x56a9('0x50')]({'name':_0x8668e5[_0x56a9('0x2c')],'resourceId':_0x8668e5['id'],'type':_0x746239[_0x56a9('0x2c')],'sectionId':_0x746239['id']},{})[_0x56a9('0x25')](function(){return _0x1d8d71;});}else{return _0x1d8d71;}})[_0x56a9('0x4a')](function(_0x526b77){logger[_0x56a9('0x2a')](_0x56a9('0x51'),_0x526b77);throw _0x526b77;});}return _0x1d8d71;})[_0x56a9('0x25')](respondWithResult(_0x57271e,0xc9))[_0x56a9('0x4a')](handleError(_0x57271e,null));};exports[_0x56a9('0x24')]=function(_0x557526,_0x58d764){if(_0x557526[_0x56a9('0x4b')]['id']){delete _0x557526[_0x56a9('0x4b')]['id'];}return db[_0x56a9('0x30')]['find']({'where':{'id':_0x557526[_0x56a9('0x48')]['id']}})[_0x56a9('0x25')](handleEntityNotFound(_0x58d764,null))['then'](saveUpdates(_0x557526[_0x56a9('0x4b')],null))[_0x56a9('0x25')](respondWithResult(_0x58d764,null))[_0x56a9('0x4a')](handleError(_0x58d764,null));};exports[_0x56a9('0x29')]=function(_0x14bed3,_0x4799e4){return db[_0x56a9('0x30')]['find']({'where':{'id':_0x14bed3[_0x56a9('0x48')]['id']}})[_0x56a9('0x25')](handleEntityNotFound(_0x4799e4,null))['then'](removeEntity(_0x4799e4,null))[_0x56a9('0x4a')](handleError(_0x4799e4,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c520439..e1c82b3 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 _0x4f28=['bluebird','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','util','moment'];(function(_0x7d73ca,_0x515830){var _0x30fe39=function(_0x1a632f){while(--_0x1a632f){_0x7d73ca['push'](_0x7d73ca['shift']());}};_0x30fe39(++_0x515830);}(_0x4f28,0xee));var _0x84f2=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x4f28[_0x2fdce0];return _0x36f07e;};'use strict';var _=require('lodash');var util=require(_0x84f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x84f2('0x1'));var BPromise=require(_0x84f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84f2('0x3'));var rimraf=require(_0x84f2('0x4'));var config=require(_0x84f2('0x5'));var attributes=require(_0x84f2('0x6'));module[_0x84f2('0x7')]=function(_0x134c0e,_0x238f00){return _0x134c0e['define'](_0x84f2('0x8'),attributes,{'tableName':_0x84f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb582=['Template','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x3a3184,_0x47dc78){var _0x41a3de=function(_0x1cdee0){while(--_0x1cdee0){_0x3a3184['push'](_0x3a3184['shift']());}};_0x41a3de(++_0x47dc78);}(_0xb582,0x16e));var _0x2b58=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb582[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x2b58('0x0'));var logger=require(_0x2b58('0x1'))(_0x2b58('0x2'));var moment=require(_0x2b58('0x3'));var BPromise=require(_0x2b58('0x4'));var rp=require(_0x2b58('0x5'));var fs=require('fs');var path=require(_0x2b58('0x6'));var rimraf=require(_0x2b58('0x7'));var config=require(_0x2b58('0x8'));var attributes=require(_0x2b58('0x9'));module[_0x2b58('0xa')]=function(_0x336dd8,_0x9cd1f7){return _0x336dd8[_0x2b58('0xb')](_0x2b58('0xc'),attributes,{'tableName':_0x2b58('0xd'),'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 3b555bc..f99b135 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 _0x1e52=['then','info','debug','stringify','code','error','Template,\x20%s,\x20%s','message','request\x20sent','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x4f0895,_0x570376){var _0x198821=function(_0x5c82da){while(--_0x5c82da){_0x4f0895['push'](_0x4f0895['shift']());}};_0x198821(++_0x570376);}(_0x1e52,0x15f));var _0x21e5=function(_0x279229,_0x1d69d9){_0x279229=_0x279229-0x0;var _0x195ca7=_0x1e52[_0x279229];return _0x195ca7;};'use strict';var _=require(_0x21e5('0x0'));var util=require(_0x21e5('0x1'));var moment=require(_0x21e5('0x2'));var BPromise=require(_0x21e5('0x3'));var rs=require(_0x21e5('0x4'));var fs=require('fs');var Redis=require(_0x21e5('0x5'));var db=require(_0x21e5('0x6'))['db'];var utils=require(_0x21e5('0x7'));var logger=require('../../config/logger')(_0x21e5('0x8'));var config=require('../../config/environment');var jayson=require(_0x21e5('0x9'));var client=jayson[_0x21e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699273,_0x4b452a,_0x432f98){return new BPromise(function(_0x4ce390,_0x4ab3ad){return client[_0x21e5('0xb')](_0x699273,_0x432f98)[_0x21e5('0xc')](function(_0x308808){logger[_0x21e5('0xd')]('Template,\x20%s,\x20%s',_0x4b452a,'request\x20sent');logger[_0x21e5('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4b452a,'request\x20sent',JSON[_0x21e5('0xf')](_0x308808));if(_0x308808['error']){if(_0x308808['error'][_0x21e5('0x10')]===0x1f4){logger[_0x21e5('0x11')](_0x21e5('0x12'),_0x4b452a,_0x308808[_0x21e5('0x11')]['message']);return _0x4ab3ad(_0x308808[_0x21e5('0x11')][_0x21e5('0x13')]);}logger[_0x21e5('0x11')](_0x21e5('0x12'),_0x4b452a,_0x308808[_0x21e5('0x11')][_0x21e5('0x13')]);return _0x4ce390(_0x308808[_0x21e5('0x11')][_0x21e5('0x13')]);}else{logger[_0x21e5('0xd')](_0x21e5('0x12'),_0x4b452a,_0x21e5('0x14'));_0x4ce390(_0x308808[_0x21e5('0x15')][_0x21e5('0x13')]);}})[_0x21e5('0x16')](function(_0x3032ff){logger['error'](_0x21e5('0x12'),_0x4b452a,_0x3032ff);_0x4ab3ad(_0x3032ff);});});}exports[_0x21e5('0x17')]=function(_0x45f4fe){var _0x57edd4=this;return new Promise(function(_0x1a7e7b,_0x3af7e6){return db[_0x21e5('0x18')][_0x21e5('0x19')]({'raw':_0x45f4fe[_0x21e5('0x1a')]?_0x45f4fe['options'][_0x21e5('0x1b')]===undefined?!![]:![]:!![],'where':_0x45f4fe[_0x21e5('0x1a')]?_0x45f4fe['options']['where']||null:null,'attributes':_0x45f4fe['options']?_0x45f4fe[_0x21e5('0x1a')][_0x21e5('0x1c')]||null:null,'limit':_0x45f4fe[_0x21e5('0x1a')]?_0x45f4fe[_0x21e5('0x1a')][_0x21e5('0x1d')]||null:null,'include':_0x45f4fe[_0x21e5('0x1a')]?_0x45f4fe[_0x21e5('0x1a')][_0x21e5('0x1e')]?_['map'](_0x45f4fe['options'][_0x21e5('0x1e')],function(_0x16dc2e){return{'model':db[_0x16dc2e[_0x21e5('0x1f')]],'as':_0x16dc2e['as'],'attributes':_0x16dc2e['attributes'],'include':_0x16dc2e['include']?_[_0x21e5('0x20')](_0x16dc2e[_0x21e5('0x1e')],function(_0x23d67a){return{'model':db[_0x23d67a[_0x21e5('0x1f')]],'as':_0x23d67a['as'],'attributes':_0x23d67a[_0x21e5('0x1c')],'include':_0x23d67a[_0x21e5('0x1e')]?_[_0x21e5('0x20')](_0x23d67a[_0x21e5('0x1e')],function(_0x3d6c16){return{'model':db[_0x3d6c16[_0x21e5('0x1f')]],'as':_0x3d6c16['as'],'attributes':_0x3d6c16[_0x21e5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21e5('0xc')](function(_0x52f413){logger[_0x21e5('0xd')](_0x21e5('0x17'),_0x45f4fe);logger[_0x21e5('0xe')](_0x21e5('0x17'),_0x45f4fe,JSON[_0x21e5('0xf')](_0x52f413));_0x1a7e7b(_0x52f413);})[_0x21e5('0x16')](function(_0x41eb40){logger['error']('GetTemplate',_0x41eb40['message'],_0x45f4fe);_0x3af7e6(_0x57edd4[_0x21e5('0x11')](0x1f4,_0x41eb40[_0x21e5('0x13')]));});});}; \ No newline at end of file +var _0xd7da=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTemplate','Template','options','raw','attributes','limit','map','include','model','moment','bluebird','randomstring','ioredis'];(function(_0x1adb5d,_0x1e36cc){var _0x3acc58=function(_0x30a5ac){while(--_0x30a5ac){_0x1adb5d['push'](_0x1adb5d['shift']());}};_0x3acc58(++_0x1e36cc);}(_0xd7da,0xec));var _0xad7d=function(_0x9f897b,_0x2bc0f7){_0x9f897b=_0x9f897b-0x0;var _0x595177=_0xd7da[_0x9f897b];return _0x595177;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xad7d('0x0'));var BPromise=require(_0xad7d('0x1'));var rs=require(_0xad7d('0x2'));var fs=require('fs');var Redis=require(_0xad7d('0x3'));var db=require(_0xad7d('0x4'))['db'];var utils=require(_0xad7d('0x5'));var logger=require(_0xad7d('0x6'))(_0xad7d('0x7'));var config=require('../../config/environment');var jayson=require(_0xad7d('0x8'));var client=jayson[_0xad7d('0x9')][_0xad7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa96a62,_0x4c3a67,_0x23459c){return new BPromise(function(_0x2f3370,_0xe5c245){return client[_0xad7d('0xb')](_0xa96a62,_0x23459c)['then'](function(_0x16e396){logger[_0xad7d('0xc')](_0xad7d('0xd'),_0x4c3a67,_0xad7d('0xe'));logger[_0xad7d('0xf')](_0xad7d('0x10'),_0x4c3a67,_0xad7d('0xe'),JSON['stringify'](_0x16e396));if(_0x16e396['error']){if(_0x16e396[_0xad7d('0x11')]['code']===0x1f4){logger[_0xad7d('0x11')](_0xad7d('0xd'),_0x4c3a67,_0x16e396[_0xad7d('0x11')][_0xad7d('0x12')]);return _0xe5c245(_0x16e396[_0xad7d('0x11')][_0xad7d('0x12')]);}logger[_0xad7d('0x11')](_0xad7d('0xd'),_0x4c3a67,_0x16e396[_0xad7d('0x11')][_0xad7d('0x12')]);return _0x2f3370(_0x16e396[_0xad7d('0x11')][_0xad7d('0x12')]);}else{logger['info'](_0xad7d('0xd'),_0x4c3a67,_0xad7d('0xe'));_0x2f3370(_0x16e396[_0xad7d('0x13')][_0xad7d('0x12')]);}})[_0xad7d('0x14')](function(_0x783ca3){logger[_0xad7d('0x11')](_0xad7d('0xd'),_0x4c3a67,_0x783ca3);_0xe5c245(_0x783ca3);});});}exports[_0xad7d('0x15')]=function(_0x19972b){var _0x34074b=this;return new Promise(function(_0x383117,_0x25ab28){return db[_0xad7d('0x16')]['findAll']({'raw':_0x19972b[_0xad7d('0x17')]?_0x19972b[_0xad7d('0x17')][_0xad7d('0x18')]===undefined?!![]:![]:!![],'where':_0x19972b[_0xad7d('0x17')]?_0x19972b['options']['where']||null:null,'attributes':_0x19972b['options']?_0x19972b['options'][_0xad7d('0x19')]||null:null,'limit':_0x19972b[_0xad7d('0x17')]?_0x19972b[_0xad7d('0x17')][_0xad7d('0x1a')]||null:null,'include':_0x19972b[_0xad7d('0x17')]?_0x19972b[_0xad7d('0x17')]['include']?_[_0xad7d('0x1b')](_0x19972b['options'][_0xad7d('0x1c')],function(_0x5872ab){return{'model':db[_0x5872ab[_0xad7d('0x1d')]],'as':_0x5872ab['as'],'attributes':_0x5872ab[_0xad7d('0x19')],'include':_0x5872ab[_0xad7d('0x1c')]?_[_0xad7d('0x1b')](_0x5872ab['include'],function(_0x2577b3){return{'model':db[_0x2577b3['model']],'as':_0x2577b3['as'],'attributes':_0x2577b3['attributes'],'include':_0x2577b3[_0xad7d('0x1c')]?_[_0xad7d('0x1b')](_0x2577b3[_0xad7d('0x1c')],function(_0x36a8c7){return{'model':db[_0x36a8c7['model']],'as':_0x36a8c7['as'],'attributes':_0x36a8c7[_0xad7d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x135b72){logger[_0xad7d('0xc')]('GetTemplate',_0x19972b);logger['debug'](_0xad7d('0x15'),_0x19972b,JSON['stringify'](_0x135b72));_0x383117(_0x135b72);})[_0xad7d('0x14')](function(_0x5b5ae6){logger[_0xad7d('0x11')]('GetTemplate',_0x5b5ae6['message'],_0x19972b);_0x25ab28(_0x34074b[_0xad7d('0x11')](0x1f4,_0x5b5ae6[_0xad7d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4b5fba0..828fba6 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 _0x5217=['/:id/any_conditions','getActions','create','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','/:id','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','isAuthenticated','show','/:id/all_conditions','getAllConditions'];(function(_0x345f64,_0x212060){var _0x175695=function(_0x45b95e){while(--_0x45b95e){_0x345f64['push'](_0x345f64['shift']());}};_0x175695(++_0x212060);}(_0x5217,0xbb));var _0x7521=function(_0x121d4,_0x4a116f){_0x121d4=_0x121d4-0x0;var _0x1060b3=_0x5217[_0x121d4];return _0x1060b3;};'use strict';var multer=require(_0x7521('0x0'));var util=require('util');var path=require(_0x7521('0x1'));var timeout=require('connect-timeout');var express=require(_0x7521('0x2'));var router=express[_0x7521('0x3')]();var fs_extra=require(_0x7521('0x4'));var auth=require(_0x7521('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7521('0x6'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7521('0x7')]);router[_0x7521('0x8')]('/:id',auth[_0x7521('0x9')](),controller[_0x7521('0xa')]);router['get'](_0x7521('0xb'),auth[_0x7521('0x9')](),controller[_0x7521('0xc')]);router[_0x7521('0x8')](_0x7521('0xd'),auth[_0x7521('0x9')](),controller['getAnyConditions']);router[_0x7521('0x8')]('/:id/actions',auth[_0x7521('0x9')](),controller[_0x7521('0xe')]);router['post']('/',auth[_0x7521('0x9')](),controller[_0x7521('0xf')]);router[_0x7521('0x10')](_0x7521('0xb'),auth['isAuthenticated'](),controller[_0x7521('0x11')]);router[_0x7521('0x10')](_0x7521('0xd'),auth[_0x7521('0x9')](),controller[_0x7521('0x12')]);router[_0x7521('0x10')](_0x7521('0x13'),auth[_0x7521('0x9')](),controller[_0x7521('0x14')]);router[_0x7521('0x15')]('/:id',auth[_0x7521('0x9')](),controller[_0x7521('0x16')]);router['delete'](_0x7521('0x17'),auth['isAuthenticated'](),controller[_0x7521('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8081=['addAllCondition','addAnyCondition','addAction','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create'];(function(_0x266abe,_0x498b10){var _0x1885d0=function(_0x4ee9d5){while(--_0x4ee9d5){_0x266abe['push'](_0x266abe['shift']());}};_0x1885d0(++_0x498b10);}(_0x8081,0xbc));var _0x1808=function(_0x367a61,_0x153579){_0x367a61=_0x367a61-0x0;var _0xd97c8b=_0x8081[_0x367a61];return _0xd97c8b;};'use strict';var multer=require(_0x1808('0x0'));var util=require('util');var path=require(_0x1808('0x1'));var timeout=require(_0x1808('0x2'));var express=require(_0x1808('0x3'));var router=express['Router']();var fs_extra=require(_0x1808('0x4'));var auth=require(_0x1808('0x5'));var interaction=require(_0x1808('0x6'));var config=require(_0x1808('0x7'));var controller=require(_0x1808('0x8'));router[_0x1808('0x9')]('/',auth[_0x1808('0xa')](),controller['index']);router[_0x1808('0x9')](_0x1808('0xb'),auth[_0x1808('0xa')](),controller[_0x1808('0xc')]);router[_0x1808('0x9')]('/:id/all_conditions',auth[_0x1808('0xa')](),controller[_0x1808('0xd')]);router[_0x1808('0x9')](_0x1808('0xe'),auth['isAuthenticated'](),controller[_0x1808('0xf')]);router[_0x1808('0x9')](_0x1808('0x10'),auth['isAuthenticated'](),controller[_0x1808('0x11')]);router[_0x1808('0x12')]('/',auth['isAuthenticated'](),controller[_0x1808('0x13')]);router[_0x1808('0x12')]('/:id/all_conditions',auth[_0x1808('0xa')](),controller[_0x1808('0x14')]);router['post'](_0x1808('0xe'),auth[_0x1808('0xa')](),controller[_0x1808('0x15')]);router[_0x1808('0x12')](_0x1808('0x10'),auth[_0x1808('0xa')](),controller[_0x1808('0x16')]);router[_0x1808('0x17')](_0x1808('0xb'),auth[_0x1808('0xa')](),controller['update']);router[_0x1808('0x18')](_0x1808('0xb'),auth[_0x1808('0xa')](),controller[_0x1808('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d268a45..41cfa22 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 _0xb84b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2329fc,_0x44840a){var _0x6b358f=function(_0x4786cb){while(--_0x4786cb){_0x2329fc['push'](_0x2329fc['shift']());}};_0x6b358f(++_0x44840a);}(_0xb84b,0x1a2));var _0xbb84=function(_0x3b625f,_0x26dcb9){_0x3b625f=_0x3b625f-0x0;var _0xdfba0e=_0xb84b[_0x3b625f];return _0xdfba0e;};'use strict';var Sequelize=require(_0xbb84('0x0'));module[_0xbb84('0x1')]={'name':{'type':Sequelize[_0xbb84('0x2')]},'channel':{'type':Sequelize[_0xbb84('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbb84('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf0c0=['BOOLEAN','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf0c0,0xee));var _0x0f0c=function(_0x305e0b,_0x59c540){_0x305e0b=_0x305e0b-0x0;var _0x1c18b1=_0xf0c0[_0x305e0b];return _0x1c18b1;};'use strict';var Sequelize=require('sequelize');module[_0x0f0c('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f0c('0x1')]},'status':{'type':Sequelize[_0x0f0c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ea869d0..fd7b23e 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 _0xf573=['apply','then','destroy','get','Triggers','stack','name','send','index','Trigger','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','create','error','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','length','nolimit','getAnyConditions','findOne','addAction','Action','rimraf','zip-dir','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x13c0d2,_0x19f665){var _0x4eb43a=function(_0x3220da){while(--_0x3220da){_0x13c0d2['push'](_0x13c0d2['shift']());}};_0x4eb43a(++_0x19f665);}(_0xf573,0x1ad));var _0x3f57=function(_0x2b9c62,_0x2ac2f6){_0x2b9c62=_0x2b9c62-0x0;var _0x4ff9de=_0xf573[_0x2b9c62];return _0x4ff9de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f57('0x0'));var zipdir=require(_0x3f57('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3f57('0x2'));var BPromise=require(_0x3f57('0x3'));var Mustache=require(_0x3f57('0x4'));var util=require('util');var path=require(_0x3f57('0x5'));var sox=require(_0x3f57('0x6'));var csv=require(_0x3f57('0x7'));var ejs=require(_0x3f57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f57('0x9'));var squel=require(_0x3f57('0xa'));var crypto=require(_0x3f57('0xb'));var jsforce=require(_0x3f57('0xc'));var deskjs=require(_0x3f57('0xd'));var toCsv=require(_0x3f57('0x7'));var querystring=require(_0x3f57('0xe'));var Papa=require(_0x3f57('0xf'));var Redis=require(_0x3f57('0x10'));var authService=require(_0x3f57('0x11'));var qs=require(_0x3f57('0x12'));var as=require(_0x3f57('0x13'));var hardwareService=require(_0x3f57('0x14'));var logger=require(_0x3f57('0x15'))(_0x3f57('0x16'));var utils=require(_0x3f57('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3f57('0x18'));var db=require(_0x3f57('0x19'))['db'];function respondWithStatusCode(_0x3e5f58,_0x518440){_0x518440=_0x518440||0xcc;return function(_0xd52956){if(_0xd52956){return _0x3e5f58[_0x3f57('0x1a')](_0x518440);}return _0x3e5f58[_0x3f57('0x1b')](_0x518440)[_0x3f57('0x1c')]();};}function respondWithResult(_0x39bd94,_0x520830){_0x520830=_0x520830||0xc8;return function(_0x4566d1){if(_0x4566d1){return _0x39bd94['status'](_0x520830)[_0x3f57('0x1d')](_0x4566d1);}};}function respondWithFilteredResult(_0x1a8e73,_0x33d5a8){return function(_0x49f8d5){if(_0x49f8d5){var _0x39a3b5=typeof _0x33d5a8[_0x3f57('0x1e')]==='undefined'&&typeof _0x33d5a8[_0x3f57('0x1f')]===_0x3f57('0x20');var _0x269acd=_0x49f8d5[_0x3f57('0x21')];var _0x29a89f=_0x39a3b5?0x0:_0x33d5a8['offset'];var _0x291633=_0x39a3b5?_0x49f8d5[_0x3f57('0x21')]:_0x33d5a8[_0x3f57('0x1e')]+_0x33d5a8[_0x3f57('0x1f')];var _0x15d600;if(_0x291633>=_0x269acd){_0x291633=_0x269acd;_0x15d600=0xc8;}else{_0x15d600=0xce;}_0x1a8e73[_0x3f57('0x1b')](_0x15d600);return _0x1a8e73[_0x3f57('0x22')](_0x3f57('0x23'),_0x29a89f+'-'+_0x291633+'/'+_0x269acd)['json'](_0x49f8d5);}return null;};}function patchUpdates(_0x432aa4){return function(_0x123083){try{jsonpatch[_0x3f57('0x24')](_0x123083,_0x432aa4,!![]);}catch(_0x153eae){return BPromise['reject'](_0x153eae);}return _0x123083['save']();};}function saveUpdates(_0x8b850b,_0x5d2da3){return function(_0x26383a){if(_0x26383a){return _0x26383a['update'](_0x8b850b)[_0x3f57('0x25')](function(_0x18810e){return _0x18810e;});}return null;};}function removeEntity(_0x878031,_0x303c0d){return function(_0x50886a){if(_0x50886a){return _0x50886a[_0x3f57('0x26')]()[_0x3f57('0x25')](function(){var _0x4be5cb=_0x50886a[_0x3f57('0x27')]({'plain':!![]});var _0x25a324=_0x3f57('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a324,'resourceId':_0x4be5cb['id']}})[_0x3f57('0x25')](function(){return _0x50886a;});})[_0x3f57('0x25')](function(){_0x878031[_0x3f57('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0d728,_0xf9fa59){return function(_0x152eb6){if(!_0x152eb6){_0xd0d728['sendStatus'](0x194);}return _0x152eb6;};}function handleError(_0x497590,_0x4069d3){_0x4069d3=_0x4069d3||0x1f4;return function(_0x54c268){logger['error'](_0x54c268[_0x3f57('0x29')]);if(_0x54c268[_0x3f57('0x2a')]){delete _0x54c268['name'];}_0x497590[_0x3f57('0x1b')](_0x4069d3)[_0x3f57('0x2b')](_0x54c268);};}exports[_0x3f57('0x2c')]=function(_0x5af93f,_0x32aadb){var _0x5b4372={},_0x345e9e={},_0x5324d0={'count':0x0,'rows':[]};var _0x12e141=_['map'](db[_0x3f57('0x2d')][_0x3f57('0x2e')],function(_0x6e9fa5){return{'name':_0x6e9fa5[_0x3f57('0x2f')],'type':_0x6e9fa5['type'][_0x3f57('0x30')]};});_0x345e9e['model']=_[_0x3f57('0x31')](_0x12e141,'name');_0x345e9e['query']=_[_0x3f57('0x32')](_0x5af93f[_0x3f57('0x33')]);_0x345e9e[_0x3f57('0x34')]=_['intersection'](_0x345e9e['model'],_0x345e9e[_0x3f57('0x33')]);_0x5b4372['attributes']=_[_0x3f57('0x35')](_0x345e9e[_0x3f57('0x36')],qs[_0x3f57('0x37')](_0x5af93f[_0x3f57('0x33')][_0x3f57('0x37')]));_0x5b4372[_0x3f57('0x38')]=_0x5b4372['attributes']['length']?_0x5b4372[_0x3f57('0x38')]:_0x345e9e[_0x3f57('0x36')];if(!_0x5af93f[_0x3f57('0x33')][_0x3f57('0x39')]('nolimit')){_0x5b4372[_0x3f57('0x1f')]=qs[_0x3f57('0x1f')](_0x5af93f['query'][_0x3f57('0x1f')]);_0x5b4372['offset']=qs[_0x3f57('0x1e')](_0x5af93f[_0x3f57('0x33')][_0x3f57('0x1e')]);}_0x5b4372[_0x3f57('0x3a')]=qs[_0x3f57('0x3b')](_0x5af93f[_0x3f57('0x33')][_0x3f57('0x3b')]);_0x5b4372[_0x3f57('0x3c')]=qs[_0x3f57('0x34')](_[_0x3f57('0x3d')](_0x5af93f['query'],_0x345e9e[_0x3f57('0x34')]),_0x12e141);if(_0x5af93f[_0x3f57('0x33')][_0x3f57('0x3e')]){_0x5b4372[_0x3f57('0x3c')]=_[_0x3f57('0x3f')](_0x5b4372[_0x3f57('0x3c')],{'$or':_[_0x3f57('0x31')](_0x12e141,function(_0x49749e){if(_0x49749e['type']!==_0x3f57('0x40')){var _0x4e2510={};_0x4e2510[_0x49749e['name']]={'$like':'%'+_0x5af93f[_0x3f57('0x33')]['filter']+'%'};return _0x4e2510;}})});}_0x5b4372=_[_0x3f57('0x3f')]({},_0x5b4372,_0x5af93f[_0x3f57('0x41')]);var _0x1515ce={'where':_0x5b4372['where']};return db['Trigger'][_0x3f57('0x21')](_0x1515ce)['then'](function(_0x44fa57){_0x5324d0['count']=_0x44fa57;if(_0x5af93f['query'][_0x3f57('0x42')]){_0x5b4372[_0x3f57('0x43')]=[{'all':!![]}];}return db[_0x3f57('0x2d')][_0x3f57('0x44')](_0x5b4372);})['then'](function(_0x16e811){_0x5324d0[_0x3f57('0x45')]=_0x16e811;return _0x5324d0;})[_0x3f57('0x25')](respondWithFilteredResult(_0x32aadb,_0x5b4372))[_0x3f57('0x46')](handleError(_0x32aadb,null));};exports['show']=function(_0x590a82,_0x3d3bb5){var _0x5a8585={'raw':![],'where':{'id':_0x590a82[_0x3f57('0x47')]['id']}},_0x319fac={};_0x319fac[_0x3f57('0x36')]=_[_0x3f57('0x32')](db['Trigger'][_0x3f57('0x2e')]);_0x319fac['query']=_[_0x3f57('0x32')](_0x590a82[_0x3f57('0x33')]);_0x319fac[_0x3f57('0x34')]=_[_0x3f57('0x35')](_0x319fac['model'],_0x319fac['query']);_0x5a8585[_0x3f57('0x38')]=_['intersection'](_0x319fac[_0x3f57('0x36')],qs['fields'](_0x590a82[_0x3f57('0x33')][_0x3f57('0x37')]));_0x5a8585['attributes']=_0x5a8585[_0x3f57('0x38')]['length']?_0x5a8585[_0x3f57('0x38')]:_0x319fac[_0x3f57('0x36')];if(_0x590a82['query'][_0x3f57('0x42')]){_0x5a8585[_0x3f57('0x43')]=[{'all':!![]}];}_0x5a8585=_['merge']({},_0x5a8585,_0x590a82['options']);return db['Trigger'][_0x3f57('0x48')](_0x5a8585)[_0x3f57('0x25')](handleEntityNotFound(_0x3d3bb5,null))['then'](respondWithResult(_0x3d3bb5,null))[_0x3f57('0x46')](handleError(_0x3d3bb5,null));};exports['create']=function(_0x497785,_0x2ef698){return db[_0x3f57('0x2d')]['create'](_0x497785[_0x3f57('0x49')],{})[_0x3f57('0x25')](function(_0x4f7b7d){var _0x458d14=_0x497785[_0x3f57('0x4a')][_0x3f57('0x27')]({'plain':!![]});if(!_0x458d14)throw new Error(_0x3f57('0x4b'));if(_0x458d14['role']===_0x3f57('0x4a')){var _0x16d0d9=_0x4f7b7d['get']({'plain':!![]});var _0x1b11b2=_0x3f57('0x28');return db[_0x3f57('0x4c')][_0x3f57('0x48')]({'where':{'name':_0x1b11b2,'userProfileId':_0x458d14['userProfileId']},'raw':!![]})[_0x3f57('0x25')](function(_0x29802b){if(_0x29802b&&_0x29802b[_0x3f57('0x4d')]===0x0){return db[_0x3f57('0x4e')][_0x3f57('0x4f')]({'name':_0x16d0d9['name'],'resourceId':_0x16d0d9['id'],'type':_0x29802b[_0x3f57('0x2a')],'sectionId':_0x29802b['id']},{})[_0x3f57('0x25')](function(){return _0x4f7b7d;});}else{return _0x4f7b7d;}})[_0x3f57('0x46')](function(_0x378b5d){logger[_0x3f57('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x378b5d);throw _0x378b5d;});}return _0x4f7b7d;})[_0x3f57('0x25')](respondWithResult(_0x2ef698,0xc9))[_0x3f57('0x46')](handleError(_0x2ef698,null));};exports['update']=function(_0x54bd77,_0x3a7310){if(_0x54bd77[_0x3f57('0x49')]['id']){delete _0x54bd77['body']['id'];}return db[_0x3f57('0x2d')]['find']({'where':{'id':_0x54bd77[_0x3f57('0x47')]['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0x3a7310,null))['then'](saveUpdates(_0x54bd77['body'],null))[_0x3f57('0x25')](respondWithResult(_0x3a7310,null))[_0x3f57('0x46')](handleError(_0x3a7310,null));};exports[_0x3f57('0x26')]=function(_0x3a19cd,_0x27bb32){return db[_0x3f57('0x2d')]['find']({'where':{'id':_0x3a19cd[_0x3f57('0x47')]['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0x27bb32,null))[_0x3f57('0x25')](removeEntity(_0x27bb32,null))[_0x3f57('0x46')](handleError(_0x27bb32,null));};exports[_0x3f57('0x51')]=function(_0xe5ab2e,_0x265e46,_0x3e6cee){if(_0xe5ab2e['body']['id']){delete _0xe5ab2e[_0x3f57('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0xe5ab2e[_0x3f57('0x47')]['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0x265e46,null))[_0x3f57('0x25')](function(_0x197711){if(_0x197711){_0xe5ab2e[_0x3f57('0x49')][_0x3f57('0x52')]=_0x197711['id'];return db[_0x3f57('0x53')]['create'](_0xe5ab2e[_0x3f57('0x49')]);}})['then'](respondWithResult(_0x265e46,null))['catch'](handleError(_0x265e46,null));};exports[_0x3f57('0x54')]=function(_0x52437a,_0x2c48bf,_0x4fdc34){if(_0x52437a['body']['id']){delete _0x52437a[_0x3f57('0x49')]['id'];}return db[_0x3f57('0x2d')][_0x3f57('0x48')]({'where':{'id':_0x52437a[_0x3f57('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c48bf,null))['then'](function(_0x1613ed){if(_0x1613ed){_0x52437a[_0x3f57('0x49')][_0x3f57('0x55')]=_0x1613ed['id'];return db[_0x3f57('0x53')][_0x3f57('0x4f')](_0x52437a[_0x3f57('0x49')]);}})[_0x3f57('0x25')](respondWithResult(_0x2c48bf,null))[_0x3f57('0x46')](handleError(_0x2c48bf,null));};exports[_0x3f57('0x56')]=function(_0x5f5075,_0x5ded71,_0x12dfb8){var _0x223ddd={};var _0x449ad6={};var _0xd95594;var _0x112048;return db[_0x3f57('0x2d')]['findOne']({'where':{'id':_0x5f5075[_0x3f57('0x47')]['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0x5ded71,null))[_0x3f57('0x25')](function(_0x4400d0){if(_0x4400d0){_0xd95594=_0x4400d0;_0x449ad6[_0x3f57('0x36')]=_['keys'](db[_0x3f57('0x53')][_0x3f57('0x2e')]);_0x449ad6[_0x3f57('0x33')]=_[_0x3f57('0x32')](_0x5f5075[_0x3f57('0x33')]);_0x449ad6[_0x3f57('0x34')]=_['intersection'](_0x449ad6[_0x3f57('0x36')],_0x449ad6['query']);_0x223ddd[_0x3f57('0x38')]=_['intersection'](_0x449ad6[_0x3f57('0x36')],qs['fields'](_0x5f5075[_0x3f57('0x33')][_0x3f57('0x37')]));_0x223ddd[_0x3f57('0x38')]=_0x223ddd[_0x3f57('0x38')][_0x3f57('0x57')]?_0x223ddd[_0x3f57('0x38')]:_0x449ad6[_0x3f57('0x36')];_0x223ddd[_0x3f57('0x3a')]=qs[_0x3f57('0x3b')](_0x5f5075[_0x3f57('0x33')][_0x3f57('0x3b')]);_0x223ddd[_0x3f57('0x3c')]=qs[_0x3f57('0x34')](_['pick'](_0x5f5075[_0x3f57('0x33')],_0x449ad6[_0x3f57('0x34')]));if(_0x5f5075[_0x3f57('0x33')][_0x3f57('0x3e')]){_0x223ddd[_0x3f57('0x3c')]=_[_0x3f57('0x3f')](_0x223ddd['where'],{'$or':_['map'](_0x223ddd[_0x3f57('0x38')],function(_0x42b0de){var _0x17f9bd={};_0x17f9bd[_0x42b0de]={'$like':'%'+_0x5f5075[_0x3f57('0x33')][_0x3f57('0x3e')]+'%'};return _0x17f9bd;})});}_0x223ddd=_[_0x3f57('0x3f')]({},_0x223ddd,_0x5f5075[_0x3f57('0x41')]);return _0xd95594['getAllConditions'](_0x223ddd);}})[_0x3f57('0x25')](function(_0x141e45){if(_0x141e45){_0x112048=_0x141e45[_0x3f57('0x57')];if(!_0x5f5075['query']['hasOwnProperty'](_0x3f57('0x58'))){_0x223ddd['limit']=qs[_0x3f57('0x1f')](_0x5f5075[_0x3f57('0x33')][_0x3f57('0x1f')]);_0x223ddd[_0x3f57('0x1e')]=qs['offset'](_0x5f5075[_0x3f57('0x33')][_0x3f57('0x1e')]);}return _0xd95594['getAllConditions'](_0x223ddd);}})[_0x3f57('0x25')](function(_0x220146){if(_0x220146){return _0x220146?{'count':_0x112048,'rows':_0x220146}:null;}})[_0x3f57('0x25')](respondWithResult(_0x5ded71,null))[_0x3f57('0x46')](handleError(_0x5ded71,null));};exports[_0x3f57('0x59')]=function(_0x37c6ed,_0x53848c,_0x492450){var _0x247ef3={};var _0x1ef1d6={};var _0x29efac;var _0x36aefc;return db[_0x3f57('0x2d')][_0x3f57('0x5a')]({'where':{'id':_0x37c6ed[_0x3f57('0x47')]['id']}})['then'](handleEntityNotFound(_0x53848c,null))[_0x3f57('0x25')](function(_0x169a95){if(_0x169a95){_0x29efac=_0x169a95;_0x1ef1d6[_0x3f57('0x36')]=_[_0x3f57('0x32')](db['Condition']['rawAttributes']);_0x1ef1d6[_0x3f57('0x33')]=_[_0x3f57('0x32')](_0x37c6ed[_0x3f57('0x33')]);_0x1ef1d6[_0x3f57('0x34')]=_['intersection'](_0x1ef1d6[_0x3f57('0x36')],_0x1ef1d6[_0x3f57('0x33')]);_0x247ef3[_0x3f57('0x38')]=_[_0x3f57('0x35')](_0x1ef1d6[_0x3f57('0x36')],qs[_0x3f57('0x37')](_0x37c6ed[_0x3f57('0x33')][_0x3f57('0x37')]));_0x247ef3[_0x3f57('0x38')]=_0x247ef3[_0x3f57('0x38')][_0x3f57('0x57')]?_0x247ef3[_0x3f57('0x38')]:_0x1ef1d6[_0x3f57('0x36')];_0x247ef3['order']=qs[_0x3f57('0x3b')](_0x37c6ed[_0x3f57('0x33')][_0x3f57('0x3b')]);_0x247ef3[_0x3f57('0x3c')]=qs[_0x3f57('0x34')](_[_0x3f57('0x3d')](_0x37c6ed[_0x3f57('0x33')],_0x1ef1d6['filters']));if(_0x37c6ed[_0x3f57('0x33')][_0x3f57('0x3e')]){_0x247ef3[_0x3f57('0x3c')]=_[_0x3f57('0x3f')](_0x247ef3[_0x3f57('0x3c')],{'$or':_[_0x3f57('0x31')](_0x247ef3['attributes'],function(_0x45be56){var _0x1f9e24={};_0x1f9e24[_0x45be56]={'$like':'%'+_0x37c6ed[_0x3f57('0x33')]['filter']+'%'};return _0x1f9e24;})});}_0x247ef3=_[_0x3f57('0x3f')]({},_0x247ef3,_0x37c6ed['options']);return _0x29efac[_0x3f57('0x59')](_0x247ef3);}})[_0x3f57('0x25')](function(_0x4172c6){if(_0x4172c6){_0x36aefc=_0x4172c6[_0x3f57('0x57')];if(!_0x37c6ed[_0x3f57('0x33')][_0x3f57('0x39')](_0x3f57('0x58'))){_0x247ef3[_0x3f57('0x1f')]=qs[_0x3f57('0x1f')](_0x37c6ed[_0x3f57('0x33')]['limit']);_0x247ef3[_0x3f57('0x1e')]=qs[_0x3f57('0x1e')](_0x37c6ed[_0x3f57('0x33')][_0x3f57('0x1e')]);}return _0x29efac[_0x3f57('0x59')](_0x247ef3);}})['then'](function(_0x1716b7){if(_0x1716b7){return _0x1716b7?{'count':_0x36aefc,'rows':_0x1716b7}:null;}})['then'](respondWithResult(_0x53848c,null))[_0x3f57('0x46')](handleError(_0x53848c,null));};exports[_0x3f57('0x5b')]=function(_0x5b8f29,_0xd87ba,_0x2ed6bf){if(_0x5b8f29[_0x3f57('0x49')]['id']){delete _0x5b8f29[_0x3f57('0x49')]['id'];}return db[_0x3f57('0x2d')][_0x3f57('0x48')]({'where':{'id':_0x5b8f29[_0x3f57('0x47')]['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0xd87ba,null))[_0x3f57('0x25')](function(_0x3f13f1){if(_0x3f13f1){_0x5b8f29[_0x3f57('0x49')]['TriggerId']=_0x3f13f1['id'];return db[_0x3f57('0x5c')][_0x3f57('0x4f')](_0x5b8f29['body']);}})['then'](respondWithResult(_0xd87ba,null))['catch'](handleError(_0xd87ba,null));};exports['getActions']=function(_0x942599,_0x19b352,_0x37ff3f){var _0x3c0fdb={};var _0x2a79f0={};var _0xd4c26b;var _0x2f93ac;return db[_0x3f57('0x2d')][_0x3f57('0x5a')]({'where':{'id':_0x942599['params']['id']}})[_0x3f57('0x25')](handleEntityNotFound(_0x19b352,null))['then'](function(_0x466aff){if(_0x466aff){_0xd4c26b=_0x466aff;_0x2a79f0[_0x3f57('0x36')]=_['keys'](db[_0x3f57('0x5c')][_0x3f57('0x2e')]);_0x2a79f0[_0x3f57('0x33')]=_[_0x3f57('0x32')](_0x942599[_0x3f57('0x33')]);_0x2a79f0[_0x3f57('0x34')]=_[_0x3f57('0x35')](_0x2a79f0[_0x3f57('0x36')],_0x2a79f0[_0x3f57('0x33')]);_0x3c0fdb[_0x3f57('0x38')]=_[_0x3f57('0x35')](_0x2a79f0[_0x3f57('0x36')],qs[_0x3f57('0x37')](_0x942599[_0x3f57('0x33')][_0x3f57('0x37')]));_0x3c0fdb[_0x3f57('0x38')]=_0x3c0fdb[_0x3f57('0x38')][_0x3f57('0x57')]?_0x3c0fdb[_0x3f57('0x38')]:_0x2a79f0[_0x3f57('0x36')];_0x3c0fdb[_0x3f57('0x3a')]=qs[_0x3f57('0x3b')](_0x942599[_0x3f57('0x33')][_0x3f57('0x3b')]);_0x3c0fdb[_0x3f57('0x3c')]=qs['filters'](_['pick'](_0x942599['query'],_0x2a79f0[_0x3f57('0x34')]));if(_0x942599[_0x3f57('0x33')][_0x3f57('0x3e')]){_0x3c0fdb[_0x3f57('0x3c')]=_[_0x3f57('0x3f')](_0x3c0fdb[_0x3f57('0x3c')],{'$or':_[_0x3f57('0x31')](_0x3c0fdb['attributes'],function(_0x31365c){var _0x2be40f={};_0x2be40f[_0x31365c]={'$like':'%'+_0x942599['query'][_0x3f57('0x3e')]+'%'};return _0x2be40f;})});}_0x3c0fdb=_[_0x3f57('0x3f')]({},_0x3c0fdb,_0x942599[_0x3f57('0x41')]);return _0xd4c26b['getActions'](_0x3c0fdb);}})[_0x3f57('0x25')](function(_0x51bacc){if(_0x51bacc){_0x2f93ac=_0x51bacc[_0x3f57('0x57')];if(!_0x942599['query']['hasOwnProperty'](_0x3f57('0x58'))){_0x3c0fdb[_0x3f57('0x1f')]=qs['limit'](_0x942599['query'][_0x3f57('0x1f')]);_0x3c0fdb[_0x3f57('0x1e')]=qs['offset'](_0x942599[_0x3f57('0x33')][_0x3f57('0x1e')]);}return _0xd4c26b['getActions'](_0x3c0fdb);}})['then'](function(_0x204939){if(_0x204939){return _0x204939?{'count':_0x2f93ac,'rows':_0x204939}:null;}})[_0x3f57('0x25')](respondWithResult(_0x19b352,null))[_0x3f57('0x46')](handleError(_0x19b352,null));}; \ No newline at end of file +var _0xff5a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','then','sendStatus','stack','name','index','Trigger','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes'];(function(_0x1c0afe,_0x4ea219){var _0x5078bd=function(_0x2b0170){while(--_0x2b0170){_0x1c0afe['push'](_0x1c0afe['shift']());}};_0x5078bd(++_0x4ea219);}(_0xff5a,0x8a));var _0xaff5=function(_0x42f418,_0xe91c3e){_0x42f418=_0x42f418-0x0;var _0x3c858f=_0xff5a[_0x42f418];return _0x3c858f;};'use strict';var emlformat=require(_0xaff5('0x0'));var rimraf=require(_0xaff5('0x1'));var zipdir=require(_0xaff5('0x2'));var jsonpatch=require(_0xaff5('0x3'));var rp=require(_0xaff5('0x4'));var moment=require(_0xaff5('0x5'));var BPromise=require(_0xaff5('0x6'));var Mustache=require(_0xaff5('0x7'));var util=require(_0xaff5('0x8'));var path=require('path');var sox=require(_0xaff5('0x9'));var csv=require(_0xaff5('0xa'));var ejs=require(_0xaff5('0xb'));var fs=require('fs');var fs_extra=require(_0xaff5('0xc'));var _=require(_0xaff5('0xd'));var squel=require(_0xaff5('0xe'));var crypto=require(_0xaff5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xaff5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaff5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaff5('0x12'));var hardwareService=require(_0xaff5('0x13'));var logger=require('../../config/logger')(_0xaff5('0x14'));var utils=require(_0xaff5('0x15'));var config=require(_0xaff5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff5('0x17'))['db'];function respondWithStatusCode(_0xb7902c,_0x3985e8){_0x3985e8=_0x3985e8||0xcc;return function(_0x2d3f41){if(_0x2d3f41){return _0xb7902c['sendStatus'](_0x3985e8);}return _0xb7902c[_0xaff5('0x18')](_0x3985e8)[_0xaff5('0x19')]();};}function respondWithResult(_0x33fe96,_0x4461dd){_0x4461dd=_0x4461dd||0xc8;return function(_0x93bb10){if(_0x93bb10){return _0x33fe96[_0xaff5('0x18')](_0x4461dd)[_0xaff5('0x1a')](_0x93bb10);}};}function respondWithFilteredResult(_0x515888,_0x5d33a5){return function(_0x2816ab){if(_0x2816ab){var _0x2a3dee=typeof _0x5d33a5[_0xaff5('0x1b')]==='undefined'&&typeof _0x5d33a5['limit']===_0xaff5('0x1c');var _0x3d094b=_0x2816ab['count'];var _0x1a3e86=_0x2a3dee?0x0:_0x5d33a5[_0xaff5('0x1b')];var _0x5e797e=_0x2a3dee?_0x2816ab[_0xaff5('0x1d')]:_0x5d33a5['offset']+_0x5d33a5[_0xaff5('0x1e')];var _0x26ab71;if(_0x5e797e>=_0x3d094b){_0x5e797e=_0x3d094b;_0x26ab71=0xc8;}else{_0x26ab71=0xce;}_0x515888[_0xaff5('0x18')](_0x26ab71);return _0x515888['set'](_0xaff5('0x1f'),_0x1a3e86+'-'+_0x5e797e+'/'+_0x3d094b)[_0xaff5('0x1a')](_0x2816ab);}return null;};}function patchUpdates(_0x396584){return function(_0x1827a0){try{jsonpatch[_0xaff5('0x20')](_0x1827a0,_0x396584,!![]);}catch(_0x56cfa6){return BPromise[_0xaff5('0x21')](_0x56cfa6);}return _0x1827a0[_0xaff5('0x22')]();};}function saveUpdates(_0x19bcec,_0x23c5fa){return function(_0x39a7e2){if(_0x39a7e2){return _0x39a7e2[_0xaff5('0x23')](_0x19bcec)['then'](function(_0x49f0d9){return _0x49f0d9;});}return null;};}function removeEntity(_0x4868cb,_0x5d75e8){return function(_0x3a9155){if(_0x3a9155){return _0x3a9155[_0xaff5('0x24')]()['then'](function(){var _0x5b4d1a=_0x3a9155[_0xaff5('0x25')]({'plain':!![]});var _0x298c8b='Triggers';return db['UserProfileResource'][_0xaff5('0x24')]({'where':{'type':_0x298c8b,'resourceId':_0x5b4d1a['id']}})[_0xaff5('0x26')](function(){return _0x3a9155;});})[_0xaff5('0x26')](function(){_0x4868cb[_0xaff5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cf27,_0x167c73){return function(_0x2e4b9d){if(!_0x2e4b9d){_0x41cf27[_0xaff5('0x27')](0x194);}return _0x2e4b9d;};}function handleError(_0x36b975,_0x24911d){_0x24911d=_0x24911d||0x1f4;return function(_0xa354b9){logger['error'](_0xa354b9[_0xaff5('0x28')]);if(_0xa354b9[_0xaff5('0x29')]){delete _0xa354b9['name'];}_0x36b975[_0xaff5('0x18')](_0x24911d)['send'](_0xa354b9);};}exports[_0xaff5('0x2a')]=function(_0x366dba,_0x5b6a11){var _0x35849b={},_0x4fd5dc={},_0x57f143={'count':0x0,'rows':[]};var _0x4dc4be=_['map'](db[_0xaff5('0x2b')][_0xaff5('0x2c')],function(_0x2d0247){return{'name':_0x2d0247['fieldName'],'type':_0x2d0247[_0xaff5('0x2d')]['key']};});_0x4fd5dc['model']=_[_0xaff5('0x2e')](_0x4dc4be,_0xaff5('0x29'));_0x4fd5dc[_0xaff5('0x2f')]=_[_0xaff5('0x30')](_0x366dba[_0xaff5('0x2f')]);_0x4fd5dc[_0xaff5('0x31')]=_['intersection'](_0x4fd5dc['model'],_0x4fd5dc['query']);_0x35849b['attributes']=_[_0xaff5('0x32')](_0x4fd5dc[_0xaff5('0x33')],qs[_0xaff5('0x34')](_0x366dba[_0xaff5('0x2f')][_0xaff5('0x34')]));_0x35849b['attributes']=_0x35849b[_0xaff5('0x35')][_0xaff5('0x36')]?_0x35849b[_0xaff5('0x35')]:_0x4fd5dc[_0xaff5('0x33')];if(!_0x366dba['query'][_0xaff5('0x37')](_0xaff5('0x38'))){_0x35849b[_0xaff5('0x1e')]=qs[_0xaff5('0x1e')](_0x366dba[_0xaff5('0x2f')]['limit']);_0x35849b['offset']=qs[_0xaff5('0x1b')](_0x366dba[_0xaff5('0x2f')][_0xaff5('0x1b')]);}_0x35849b[_0xaff5('0x39')]=qs[_0xaff5('0x3a')](_0x366dba[_0xaff5('0x2f')][_0xaff5('0x3a')]);_0x35849b[_0xaff5('0x3b')]=qs[_0xaff5('0x31')](_[_0xaff5('0x3c')](_0x366dba['query'],_0x4fd5dc[_0xaff5('0x31')]),_0x4dc4be);if(_0x366dba['query'][_0xaff5('0x3d')]){_0x35849b[_0xaff5('0x3b')]=_[_0xaff5('0x3e')](_0x35849b[_0xaff5('0x3b')],{'$or':_['map'](_0x4dc4be,function(_0x204eda){if(_0x204eda['type']!==_0xaff5('0x3f')){var _0x505e7f={};_0x505e7f[_0x204eda[_0xaff5('0x29')]]={'$like':'%'+_0x366dba[_0xaff5('0x2f')]['filter']+'%'};return _0x505e7f;}})});}_0x35849b=_[_0xaff5('0x3e')]({},_0x35849b,_0x366dba[_0xaff5('0x40')]);var _0x226f52={'where':_0x35849b[_0xaff5('0x3b')]};return db[_0xaff5('0x2b')][_0xaff5('0x1d')](_0x226f52)['then'](function(_0x368f7d){_0x57f143[_0xaff5('0x1d')]=_0x368f7d;if(_0x366dba[_0xaff5('0x2f')][_0xaff5('0x41')]){_0x35849b[_0xaff5('0x42')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x35849b);})['then'](function(_0x35d5b4){_0x57f143[_0xaff5('0x43')]=_0x35d5b4;return _0x57f143;})[_0xaff5('0x26')](respondWithFilteredResult(_0x5b6a11,_0x35849b))[_0xaff5('0x44')](handleError(_0x5b6a11,null));};exports[_0xaff5('0x45')]=function(_0x48ce20,_0x24094f){var _0x1d592e={'raw':![],'where':{'id':_0x48ce20[_0xaff5('0x46')]['id']}},_0x333228={};_0x333228[_0xaff5('0x33')]=_['keys'](db[_0xaff5('0x2b')][_0xaff5('0x2c')]);_0x333228[_0xaff5('0x2f')]=_['keys'](_0x48ce20[_0xaff5('0x2f')]);_0x333228[_0xaff5('0x31')]=_[_0xaff5('0x32')](_0x333228[_0xaff5('0x33')],_0x333228[_0xaff5('0x2f')]);_0x1d592e[_0xaff5('0x35')]=_[_0xaff5('0x32')](_0x333228[_0xaff5('0x33')],qs[_0xaff5('0x34')](_0x48ce20['query'][_0xaff5('0x34')]));_0x1d592e[_0xaff5('0x35')]=_0x1d592e[_0xaff5('0x35')][_0xaff5('0x36')]?_0x1d592e[_0xaff5('0x35')]:_0x333228[_0xaff5('0x33')];if(_0x48ce20[_0xaff5('0x2f')][_0xaff5('0x41')]){_0x1d592e[_0xaff5('0x42')]=[{'all':!![]}];}_0x1d592e=_['merge']({},_0x1d592e,_0x48ce20[_0xaff5('0x40')]);return db[_0xaff5('0x2b')][_0xaff5('0x47')](_0x1d592e)[_0xaff5('0x26')](handleEntityNotFound(_0x24094f,null))['then'](respondWithResult(_0x24094f,null))[_0xaff5('0x44')](handleError(_0x24094f,null));};exports[_0xaff5('0x48')]=function(_0x373df0,_0x1295c3){return db[_0xaff5('0x2b')][_0xaff5('0x48')](_0x373df0[_0xaff5('0x49')],{})[_0xaff5('0x26')](function(_0xf5316f){var _0x29d658=_0x373df0[_0xaff5('0x4a')][_0xaff5('0x25')]({'plain':!![]});if(!_0x29d658)throw new Error(_0xaff5('0x4b'));if(_0x29d658[_0xaff5('0x4c')]===_0xaff5('0x4a')){var _0x473a5f=_0xf5316f[_0xaff5('0x25')]({'plain':!![]});var _0x405718=_0xaff5('0x4d');return db[_0xaff5('0x4e')][_0xaff5('0x47')]({'where':{'name':_0x405718,'userProfileId':_0x29d658[_0xaff5('0x4f')]},'raw':!![]})['then'](function(_0x5209d2){if(_0x5209d2&&_0x5209d2[_0xaff5('0x50')]===0x0){return db[_0xaff5('0x51')][_0xaff5('0x48')]({'name':_0x473a5f[_0xaff5('0x29')],'resourceId':_0x473a5f['id'],'type':_0x5209d2[_0xaff5('0x29')],'sectionId':_0x5209d2['id']},{})[_0xaff5('0x26')](function(){return _0xf5316f;});}else{return _0xf5316f;}})[_0xaff5('0x44')](function(_0x3277d7){logger[_0xaff5('0x52')](_0xaff5('0x53'),_0x3277d7);throw _0x3277d7;});}return _0xf5316f;})[_0xaff5('0x26')](respondWithResult(_0x1295c3,0xc9))[_0xaff5('0x44')](handleError(_0x1295c3,null));};exports[_0xaff5('0x23')]=function(_0x20f991,_0x41ab82){if(_0x20f991[_0xaff5('0x49')]['id']){delete _0x20f991[_0xaff5('0x49')]['id'];}return db[_0xaff5('0x2b')][_0xaff5('0x47')]({'where':{'id':_0x20f991[_0xaff5('0x46')]['id']}})['then'](handleEntityNotFound(_0x41ab82,null))[_0xaff5('0x26')](saveUpdates(_0x20f991[_0xaff5('0x49')],null))['then'](respondWithResult(_0x41ab82,null))[_0xaff5('0x44')](handleError(_0x41ab82,null));};exports['destroy']=function(_0x2c3aa4,_0x1fe0e8){return db[_0xaff5('0x2b')]['find']({'where':{'id':_0x2c3aa4[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0x1fe0e8,null))[_0xaff5('0x26')](removeEntity(_0x1fe0e8,null))[_0xaff5('0x44')](handleError(_0x1fe0e8,null));};exports[_0xaff5('0x54')]=function(_0x178d5e,_0x636410,_0x4200d2){if(_0x178d5e['body']['id']){delete _0x178d5e[_0xaff5('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x178d5e[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0x636410,null))['then'](function(_0x192690){if(_0x192690){_0x178d5e[_0xaff5('0x49')][_0xaff5('0x55')]=_0x192690['id'];return db[_0xaff5('0x56')][_0xaff5('0x48')](_0x178d5e[_0xaff5('0x49')]);}})[_0xaff5('0x26')](respondWithResult(_0x636410,null))[_0xaff5('0x44')](handleError(_0x636410,null));};exports[_0xaff5('0x57')]=function(_0x43fe25,_0x5ba253,_0xeae3a4){if(_0x43fe25[_0xaff5('0x49')]['id']){delete _0x43fe25[_0xaff5('0x49')]['id'];}return db['Trigger'][_0xaff5('0x47')]({'where':{'id':_0x43fe25[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0x5ba253,null))[_0xaff5('0x26')](function(_0x216c48){if(_0x216c48){_0x43fe25[_0xaff5('0x49')][_0xaff5('0x58')]=_0x216c48['id'];return db[_0xaff5('0x56')][_0xaff5('0x48')](_0x43fe25['body']);}})['then'](respondWithResult(_0x5ba253,null))[_0xaff5('0x44')](handleError(_0x5ba253,null));};exports[_0xaff5('0x59')]=function(_0x43a1ec,_0xda3e6b,_0xb509a2){var _0xf81c29={};var _0x2460cf={};var _0x279847;var _0x2dc1d2;return db[_0xaff5('0x2b')][_0xaff5('0x5a')]({'where':{'id':_0x43a1ec[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0xda3e6b,null))[_0xaff5('0x26')](function(_0x3dc35b){if(_0x3dc35b){_0x279847=_0x3dc35b;_0x2460cf['model']=_[_0xaff5('0x30')](db[_0xaff5('0x56')][_0xaff5('0x2c')]);_0x2460cf[_0xaff5('0x2f')]=_[_0xaff5('0x30')](_0x43a1ec[_0xaff5('0x2f')]);_0x2460cf[_0xaff5('0x31')]=_[_0xaff5('0x32')](_0x2460cf[_0xaff5('0x33')],_0x2460cf[_0xaff5('0x2f')]);_0xf81c29[_0xaff5('0x35')]=_[_0xaff5('0x32')](_0x2460cf['model'],qs[_0xaff5('0x34')](_0x43a1ec['query'][_0xaff5('0x34')]));_0xf81c29[_0xaff5('0x35')]=_0xf81c29[_0xaff5('0x35')][_0xaff5('0x36')]?_0xf81c29[_0xaff5('0x35')]:_0x2460cf[_0xaff5('0x33')];_0xf81c29[_0xaff5('0x39')]=qs[_0xaff5('0x3a')](_0x43a1ec['query']['sort']);_0xf81c29[_0xaff5('0x3b')]=qs[_0xaff5('0x31')](_[_0xaff5('0x3c')](_0x43a1ec['query'],_0x2460cf[_0xaff5('0x31')]));if(_0x43a1ec[_0xaff5('0x2f')][_0xaff5('0x3d')]){_0xf81c29[_0xaff5('0x3b')]=_[_0xaff5('0x3e')](_0xf81c29[_0xaff5('0x3b')],{'$or':_[_0xaff5('0x2e')](_0xf81c29[_0xaff5('0x35')],function(_0x2473dd){var _0x5c387c={};_0x5c387c[_0x2473dd]={'$like':'%'+_0x43a1ec[_0xaff5('0x2f')]['filter']+'%'};return _0x5c387c;})});}_0xf81c29=_[_0xaff5('0x3e')]({},_0xf81c29,_0x43a1ec[_0xaff5('0x40')]);return _0x279847[_0xaff5('0x59')](_0xf81c29);}})[_0xaff5('0x26')](function(_0x5e155f){if(_0x5e155f){_0x2dc1d2=_0x5e155f[_0xaff5('0x36')];if(!_0x43a1ec['query'][_0xaff5('0x37')](_0xaff5('0x38'))){_0xf81c29[_0xaff5('0x1e')]=qs[_0xaff5('0x1e')](_0x43a1ec['query'][_0xaff5('0x1e')]);_0xf81c29[_0xaff5('0x1b')]=qs[_0xaff5('0x1b')](_0x43a1ec[_0xaff5('0x2f')][_0xaff5('0x1b')]);}return _0x279847['getAllConditions'](_0xf81c29);}})[_0xaff5('0x26')](function(_0x4538b4){if(_0x4538b4){return _0x4538b4?{'count':_0x2dc1d2,'rows':_0x4538b4}:null;}})[_0xaff5('0x26')](respondWithResult(_0xda3e6b,null))['catch'](handleError(_0xda3e6b,null));};exports[_0xaff5('0x5b')]=function(_0x22d718,_0x12aa4d,_0x19f231){var _0x127e94={};var _0x237015={};var _0x5aa000;var _0x2dd6fa;return db[_0xaff5('0x2b')][_0xaff5('0x5a')]({'where':{'id':_0x22d718[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0x12aa4d,null))[_0xaff5('0x26')](function(_0x10a343){if(_0x10a343){_0x5aa000=_0x10a343;_0x237015[_0xaff5('0x33')]=_[_0xaff5('0x30')](db[_0xaff5('0x56')]['rawAttributes']);_0x237015['query']=_[_0xaff5('0x30')](_0x22d718[_0xaff5('0x2f')]);_0x237015[_0xaff5('0x31')]=_[_0xaff5('0x32')](_0x237015[_0xaff5('0x33')],_0x237015[_0xaff5('0x2f')]);_0x127e94[_0xaff5('0x35')]=_[_0xaff5('0x32')](_0x237015[_0xaff5('0x33')],qs[_0xaff5('0x34')](_0x22d718[_0xaff5('0x2f')][_0xaff5('0x34')]));_0x127e94[_0xaff5('0x35')]=_0x127e94['attributes'][_0xaff5('0x36')]?_0x127e94[_0xaff5('0x35')]:_0x237015[_0xaff5('0x33')];_0x127e94[_0xaff5('0x39')]=qs[_0xaff5('0x3a')](_0x22d718[_0xaff5('0x2f')][_0xaff5('0x3a')]);_0x127e94[_0xaff5('0x3b')]=qs['filters'](_[_0xaff5('0x3c')](_0x22d718[_0xaff5('0x2f')],_0x237015[_0xaff5('0x31')]));if(_0x22d718[_0xaff5('0x2f')][_0xaff5('0x3d')]){_0x127e94[_0xaff5('0x3b')]=_[_0xaff5('0x3e')](_0x127e94[_0xaff5('0x3b')],{'$or':_['map'](_0x127e94['attributes'],function(_0x4594f2){var _0x4904e6={};_0x4904e6[_0x4594f2]={'$like':'%'+_0x22d718[_0xaff5('0x2f')][_0xaff5('0x3d')]+'%'};return _0x4904e6;})});}_0x127e94=_['merge']({},_0x127e94,_0x22d718['options']);return _0x5aa000[_0xaff5('0x5b')](_0x127e94);}})[_0xaff5('0x26')](function(_0x6b7cd2){if(_0x6b7cd2){_0x2dd6fa=_0x6b7cd2[_0xaff5('0x36')];if(!_0x22d718['query'][_0xaff5('0x37')](_0xaff5('0x38'))){_0x127e94[_0xaff5('0x1e')]=qs[_0xaff5('0x1e')](_0x22d718[_0xaff5('0x2f')][_0xaff5('0x1e')]);_0x127e94['offset']=qs['offset'](_0x22d718['query'][_0xaff5('0x1b')]);}return _0x5aa000[_0xaff5('0x5b')](_0x127e94);}})['then'](function(_0x2868c1){if(_0x2868c1){return _0x2868c1?{'count':_0x2dd6fa,'rows':_0x2868c1}:null;}})['then'](respondWithResult(_0x12aa4d,null))[_0xaff5('0x44')](handleError(_0x12aa4d,null));};exports[_0xaff5('0x5c')]=function(_0x28472a,_0x36083c,_0x66c2){if(_0x28472a[_0xaff5('0x49')]['id']){delete _0x28472a['body']['id'];}return db[_0xaff5('0x2b')][_0xaff5('0x47')]({'where':{'id':_0x28472a[_0xaff5('0x46')]['id']}})[_0xaff5('0x26')](handleEntityNotFound(_0x36083c,null))[_0xaff5('0x26')](function(_0x44405d){if(_0x44405d){_0x28472a[_0xaff5('0x49')][_0xaff5('0x5d')]=_0x44405d['id'];return db['Action'][_0xaff5('0x48')](_0x28472a[_0xaff5('0x49')]);}})['then'](respondWithResult(_0x36083c,null))[_0xaff5('0x44')](handleError(_0x36083c,null));};exports[_0xaff5('0x5e')]=function(_0x306956,_0x15cdd6,_0x5bcaac){var _0x24f1be={};var _0x573892={};var _0x12c09d;var _0x1864e6;return db[_0xaff5('0x2b')][_0xaff5('0x5a')]({'where':{'id':_0x306956[_0xaff5('0x46')]['id']}})['then'](handleEntityNotFound(_0x15cdd6,null))['then'](function(_0x480727){if(_0x480727){_0x12c09d=_0x480727;_0x573892['model']=_[_0xaff5('0x30')](db[_0xaff5('0x5f')][_0xaff5('0x2c')]);_0x573892[_0xaff5('0x2f')]=_[_0xaff5('0x30')](_0x306956[_0xaff5('0x2f')]);_0x573892[_0xaff5('0x31')]=_[_0xaff5('0x32')](_0x573892[_0xaff5('0x33')],_0x573892[_0xaff5('0x2f')]);_0x24f1be[_0xaff5('0x35')]=_[_0xaff5('0x32')](_0x573892[_0xaff5('0x33')],qs['fields'](_0x306956[_0xaff5('0x2f')]['fields']));_0x24f1be[_0xaff5('0x35')]=_0x24f1be[_0xaff5('0x35')][_0xaff5('0x36')]?_0x24f1be[_0xaff5('0x35')]:_0x573892[_0xaff5('0x33')];_0x24f1be[_0xaff5('0x39')]=qs[_0xaff5('0x3a')](_0x306956[_0xaff5('0x2f')][_0xaff5('0x3a')]);_0x24f1be[_0xaff5('0x3b')]=qs[_0xaff5('0x31')](_[_0xaff5('0x3c')](_0x306956[_0xaff5('0x2f')],_0x573892[_0xaff5('0x31')]));if(_0x306956[_0xaff5('0x2f')]['filter']){_0x24f1be[_0xaff5('0x3b')]=_[_0xaff5('0x3e')](_0x24f1be[_0xaff5('0x3b')],{'$or':_[_0xaff5('0x2e')](_0x24f1be['attributes'],function(_0x1f87df){var _0x4163ba={};_0x4163ba[_0x1f87df]={'$like':'%'+_0x306956[_0xaff5('0x2f')][_0xaff5('0x3d')]+'%'};return _0x4163ba;})});}_0x24f1be=_['merge']({},_0x24f1be,_0x306956[_0xaff5('0x40')]);return _0x12c09d[_0xaff5('0x5e')](_0x24f1be);}})[_0xaff5('0x26')](function(_0x589a99){if(_0x589a99){_0x1864e6=_0x589a99[_0xaff5('0x36')];if(!_0x306956['query'][_0xaff5('0x37')](_0xaff5('0x38'))){_0x24f1be['limit']=qs[_0xaff5('0x1e')](_0x306956[_0xaff5('0x2f')][_0xaff5('0x1e')]);_0x24f1be['offset']=qs[_0xaff5('0x1b')](_0x306956['query'][_0xaff5('0x1b')]);}return _0x12c09d[_0xaff5('0x5e')](_0x24f1be);}})[_0xaff5('0x26')](function(_0x5918a3){if(_0x5918a3){return _0x5918a3?{'count':_0x1864e6,'rows':_0x5918a3}:null;}})['then'](respondWithResult(_0x15cdd6,null))[_0xaff5('0x44')](handleError(_0x15cdd6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2cb9f67..1aa94d2 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 _0xce9b=['exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes'];(function(_0x55fc03,_0x43ce48){var _0x5bf429=function(_0xa06468){while(--_0xa06468){_0x55fc03['push'](_0x55fc03['shift']());}};_0x5bf429(++_0x43ce48);}(_0xce9b,0xc6));var _0xbce9=function(_0x32e3ab,_0x1cc9ce){_0x32e3ab=_0x32e3ab-0x0;var _0x3fd142=_0xce9b[_0x32e3ab];return _0x3fd142;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))(_0xbce9('0x3'));var moment=require(_0xbce9('0x4'));var BPromise=require(_0xbce9('0x5'));var rp=require(_0xbce9('0x6'));var fs=require('fs');var path=require(_0xbce9('0x7'));var rimraf=require('rimraf');var config=require(_0xbce9('0x8'));var attributes=require(_0xbce9('0x9'));module[_0xbce9('0xa')]=function(_0x256ce6,_0x1c40fa){return _0x256ce6[_0xbce9('0xb')](_0xbce9('0xc'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6658=['../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25bbb9,_0x5a4bc4){var _0x38f504=function(_0x121955){while(--_0x121955){_0x25bbb9['push'](_0x25bbb9['shift']());}};_0x38f504(++_0x5a4bc4);}(_0x6658,0x198));var _0x8665=function(_0x52f39b,_0x548102){_0x52f39b=_0x52f39b-0x0;var _0x107177=_0x6658[_0x52f39b];return _0x107177;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 2781b7b..78cab32 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 _0x8af6=['attributes','limit','include','model','map','then','GetTrigger','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','Trigger','findAll','options','raw'];(function(_0x5bcfcb,_0x59d1ab){var _0x135d9d=function(_0x280e23){while(--_0x280e23){_0x5bcfcb['push'](_0x5bcfcb['shift']());}};_0x135d9d(++_0x59d1ab);}(_0x8af6,0x76));var _0x68af=function(_0x4ff4dd,_0x40c53d){_0x4ff4dd=_0x4ff4dd-0x0;var _0x1dfabe=_0x8af6[_0x4ff4dd];return _0x1dfabe;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var moment=require(_0x68af('0x2'));var BPromise=require(_0x68af('0x3'));var rs=require(_0x68af('0x4'));var fs=require('fs');var Redis=require(_0x68af('0x5'));var db=require(_0x68af('0x6'))['db'];var utils=require(_0x68af('0x7'));var logger=require(_0x68af('0x8'))(_0x68af('0x9'));var config=require('../../config/environment');var jayson=require(_0x68af('0xa'));var client=jayson['client'][_0x68af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be0c1,_0x89146f,_0x1e77b0){return new BPromise(function(_0x3c6018,_0x20d61c){return client[_0x68af('0xc')](_0x2be0c1,_0x1e77b0)['then'](function(_0x56bc37){logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,'request\x20sent');logger[_0x68af('0xf')](_0x68af('0x10'),_0x89146f,_0x68af('0x11'),JSON[_0x68af('0x12')](_0x56bc37));if(_0x56bc37[_0x68af('0x13')]){if(_0x56bc37[_0x68af('0x13')]['code']===0x1f4){logger['error'](_0x68af('0xe'),_0x89146f,_0x56bc37['error']['message']);return _0x20d61c(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}logger[_0x68af('0x13')]('Trigger,\x20%s,\x20%s',_0x89146f,_0x56bc37[_0x68af('0x13')]['message']);return _0x3c6018(_0x56bc37[_0x68af('0x13')][_0x68af('0x14')]);}else{logger[_0x68af('0xd')](_0x68af('0xe'),_0x89146f,_0x68af('0x11'));_0x3c6018(_0x56bc37['result'][_0x68af('0x14')]);}})[_0x68af('0x15')](function(_0x326b12){logger[_0x68af('0x13')]('Trigger,\x20%s,\x20%s',_0x89146f,_0x326b12);_0x20d61c(_0x326b12);});});}exports['GetTrigger']=function(_0x3aa998){var _0x29ddbf=this;return new Promise(function(_0x4e1c41,_0x9ad23){return db[_0x68af('0x16')][_0x68af('0x17')]({'raw':_0x3aa998[_0x68af('0x18')]?_0x3aa998['options'][_0x68af('0x19')]===undefined?!![]:![]:!![],'where':_0x3aa998[_0x68af('0x18')]?_0x3aa998['options']['where']||null:null,'attributes':_0x3aa998[_0x68af('0x18')]?_0x3aa998[_0x68af('0x18')][_0x68af('0x1a')]||null:null,'limit':_0x3aa998[_0x68af('0x18')]?_0x3aa998[_0x68af('0x18')][_0x68af('0x1b')]||null:null,'include':_0x3aa998['options']?_0x3aa998[_0x68af('0x18')][_0x68af('0x1c')]?_['map'](_0x3aa998[_0x68af('0x18')]['include'],function(_0x13af7b){return{'model':db[_0x13af7b[_0x68af('0x1d')]],'as':_0x13af7b['as'],'attributes':_0x13af7b[_0x68af('0x1a')],'include':_0x13af7b[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x13af7b[_0x68af('0x1c')],function(_0x5851b9){return{'model':db[_0x5851b9[_0x68af('0x1d')]],'as':_0x5851b9['as'],'attributes':_0x5851b9[_0x68af('0x1a')],'include':_0x5851b9[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x5851b9[_0x68af('0x1c')],function(_0x375d38){return{'model':db[_0x375d38[_0x68af('0x1d')]],'as':_0x375d38['as'],'attributes':_0x375d38[_0x68af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x68af('0x1f')](function(_0x5417e9){logger[_0x68af('0xd')](_0x68af('0x20'),_0x3aa998);logger[_0x68af('0xf')](_0x68af('0x20'),_0x3aa998,JSON['stringify'](_0x5417e9));_0x4e1c41(_0x5417e9);})['catch'](function(_0x128d5d){logger[_0x68af('0x13')](_0x68af('0x20'),_0x128d5d['message'],_0x3aa998);_0x9ad23(_0x29ddbf['error'](0x1f4,_0x128d5d[_0x68af('0x14')]));});});};exports[_0x68af('0x21')]=function(_0x5c0adb){var _0x718b39=this;return new Promise(function(_0x2d5aac,_0x21b677){return db[_0x68af('0x16')][_0x68af('0x22')]({'raw':_0x5c0adb[_0x68af('0x18')]?_0x5c0adb[_0x68af('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c0adb[_0x68af('0x18')]?_0x5c0adb[_0x68af('0x18')][_0x68af('0x23')]||null:null,'attributes':_0x5c0adb['options']?_0x5c0adb[_0x68af('0x18')][_0x68af('0x1a')]||null:null,'include':_0x5c0adb['options']?_0x5c0adb[_0x68af('0x18')][_0x68af('0x1c')]?_['map'](_0x5c0adb[_0x68af('0x18')]['include'],function(_0x48c8b4){return{'model':db[_0x48c8b4[_0x68af('0x1d')]],'as':_0x48c8b4['as'],'attributes':_0x48c8b4[_0x68af('0x1a')],'include':_0x48c8b4[_0x68af('0x1c')]?_[_0x68af('0x1e')](_0x48c8b4[_0x68af('0x1c')],function(_0x39152a){return{'model':db[_0x39152a['model']],'as':_0x39152a['as'],'attributes':_0x39152a['attributes'],'include':_0x39152a['include']?_[_0x68af('0x1e')](_0x39152a[_0x68af('0x1c')],function(_0x47c527){return{'model':db[_0x47c527[_0x68af('0x1d')]],'as':_0x47c527['as'],'attributes':_0x47c527[_0x68af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x68af('0x1f')](function(_0x486242){logger[_0x68af('0xd')](_0x68af('0x21'),_0x5c0adb);logger[_0x68af('0xf')](_0x68af('0x21'),_0x5c0adb,JSON[_0x68af('0x12')](_0x486242));_0x2d5aac(_0x486242);})['catch'](function(_0x1a8c0d){logger[_0x68af('0x13')](_0x68af('0x21'),_0x1a8c0d[_0x68af('0x14')],_0x5c0adb);_0x21b677(_0x718b39[_0x68af('0x13')](0x1f4,_0x1a8c0d[_0x68af('0x14')]));});});}; \ No newline at end of file +var _0xb3de=['map','include','model','stringify','find','raw','ShowTrigger','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrigger','Trigger','options','where','attributes','limit'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xb3de,0x142));var _0xeb3d=function(_0x3eaef1,_0x322753){_0x3eaef1=_0x3eaef1-0x0;var _0x4e4385=_0xb3de[_0x3eaef1];return _0x4e4385;};'use strict';var _=require(_0xeb3d('0x0'));var util=require(_0xeb3d('0x1'));var moment=require('moment');var BPromise=require(_0xeb3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb3d('0x3'));var db=require(_0xeb3d('0x4'))['db'];var utils=require(_0xeb3d('0x5'));var logger=require('../../config/logger')(_0xeb3d('0x6'));var config=require(_0xeb3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb3d('0x8')][_0xeb3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2d39,_0x427ae6,_0x136b43){return new BPromise(function(_0x193ec0,_0x30efb6){return client[_0xeb3d('0xa')](_0x2b2d39,_0x136b43)[_0xeb3d('0xb')](function(_0x4a2db0){logger[_0xeb3d('0xc')](_0xeb3d('0xd'),_0x427ae6,'request\x20sent');logger[_0xeb3d('0xe')](_0xeb3d('0xf'),_0x427ae6,_0xeb3d('0x10'),JSON['stringify'](_0x4a2db0));if(_0x4a2db0[_0xeb3d('0x11')]){if(_0x4a2db0['error'][_0xeb3d('0x12')]===0x1f4){logger[_0xeb3d('0x11')](_0xeb3d('0xd'),_0x427ae6,_0x4a2db0['error'][_0xeb3d('0x13')]);return _0x30efb6(_0x4a2db0['error'][_0xeb3d('0x13')]);}logger['error'](_0xeb3d('0xd'),_0x427ae6,_0x4a2db0[_0xeb3d('0x11')][_0xeb3d('0x13')]);return _0x193ec0(_0x4a2db0[_0xeb3d('0x11')][_0xeb3d('0x13')]);}else{logger[_0xeb3d('0xc')](_0xeb3d('0xd'),_0x427ae6,'request\x20sent');_0x193ec0(_0x4a2db0[_0xeb3d('0x14')][_0xeb3d('0x13')]);}})[_0xeb3d('0x15')](function(_0x211797){logger[_0xeb3d('0x11')](_0xeb3d('0xd'),_0x427ae6,_0x211797);_0x30efb6(_0x211797);});});}exports[_0xeb3d('0x16')]=function(_0x53342c){var _0x1d4b85=this;return new Promise(function(_0x459b04,_0x5225fb){return db[_0xeb3d('0x17')]['findAll']({'raw':_0x53342c[_0xeb3d('0x18')]?_0x53342c[_0xeb3d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x53342c[_0xeb3d('0x18')]?_0x53342c['options'][_0xeb3d('0x19')]||null:null,'attributes':_0x53342c[_0xeb3d('0x18')]?_0x53342c[_0xeb3d('0x18')][_0xeb3d('0x1a')]||null:null,'limit':_0x53342c[_0xeb3d('0x18')]?_0x53342c[_0xeb3d('0x18')][_0xeb3d('0x1b')]||null:null,'include':_0x53342c[_0xeb3d('0x18')]?_0x53342c['options']['include']?_[_0xeb3d('0x1c')](_0x53342c[_0xeb3d('0x18')][_0xeb3d('0x1d')],function(_0x554f9d){return{'model':db[_0x554f9d[_0xeb3d('0x1e')]],'as':_0x554f9d['as'],'attributes':_0x554f9d[_0xeb3d('0x1a')],'include':_0x554f9d[_0xeb3d('0x1d')]?_['map'](_0x554f9d[_0xeb3d('0x1d')],function(_0x1051bc){return{'model':db[_0x1051bc['model']],'as':_0x1051bc['as'],'attributes':_0x1051bc[_0xeb3d('0x1a')],'include':_0x1051bc[_0xeb3d('0x1d')]?_['map'](_0x1051bc[_0xeb3d('0x1d')],function(_0x5acd3f){return{'model':db[_0x5acd3f[_0xeb3d('0x1e')]],'as':_0x5acd3f['as'],'attributes':_0x5acd3f['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb3d('0xb')](function(_0x3cf896){logger[_0xeb3d('0xc')]('GetTrigger',_0x53342c);logger['debug'](_0xeb3d('0x16'),_0x53342c,JSON[_0xeb3d('0x1f')](_0x3cf896));_0x459b04(_0x3cf896);})['catch'](function(_0x2a70ed){logger[_0xeb3d('0x11')](_0xeb3d('0x16'),_0x2a70ed['message'],_0x53342c);_0x5225fb(_0x1d4b85['error'](0x1f4,_0x2a70ed[_0xeb3d('0x13')]));});});};exports['ShowTrigger']=function(_0x39bc8e){var _0x312f43=this;return new Promise(function(_0x4510e8,_0x530908){return db['Trigger'][_0xeb3d('0x20')]({'raw':_0x39bc8e['options']?_0x39bc8e[_0xeb3d('0x18')][_0xeb3d('0x21')]===undefined?!![]:![]:!![],'where':_0x39bc8e['options']?_0x39bc8e[_0xeb3d('0x18')]['where']||null:null,'attributes':_0x39bc8e[_0xeb3d('0x18')]?_0x39bc8e[_0xeb3d('0x18')][_0xeb3d('0x1a')]||null:null,'include':_0x39bc8e[_0xeb3d('0x18')]?_0x39bc8e['options']['include']?_[_0xeb3d('0x1c')](_0x39bc8e[_0xeb3d('0x18')][_0xeb3d('0x1d')],function(_0x25fbea){return{'model':db[_0x25fbea['model']],'as':_0x25fbea['as'],'attributes':_0x25fbea[_0xeb3d('0x1a')],'include':_0x25fbea[_0xeb3d('0x1d')]?_[_0xeb3d('0x1c')](_0x25fbea[_0xeb3d('0x1d')],function(_0x2898e2){return{'model':db[_0x2898e2[_0xeb3d('0x1e')]],'as':_0x2898e2['as'],'attributes':_0x2898e2[_0xeb3d('0x1a')],'include':_0x2898e2[_0xeb3d('0x1d')]?_[_0xeb3d('0x1c')](_0x2898e2[_0xeb3d('0x1d')],function(_0x26023b){return{'model':db[_0x26023b[_0xeb3d('0x1e')]],'as':_0x26023b['as'],'attributes':_0x26023b[_0xeb3d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeb3d('0xb')](function(_0x40da3b){logger['info'](_0xeb3d('0x22'),_0x39bc8e);logger[_0xeb3d('0xe')]('ShowTrigger',_0x39bc8e,JSON['stringify'](_0x40da3b));_0x4510e8(_0x40da3b);})[_0xeb3d('0x15')](function(_0x2e5e21){logger[_0xeb3d('0x11')](_0xeb3d('0x22'),_0x2e5e21[_0xeb3d('0x13')],_0x39bc8e);_0x530908(_0x312f43['error'](0x1f4,_0x2e5e21[_0xeb3d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6093d1a..57411ce 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 _0x32e3=['post','/:id/clone','clone','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','index','show'];(function(_0x34bfb3,_0x1ce089){var _0x3f7ece=function(_0x39eb42){while(--_0x39eb42){_0x34bfb3['push'](_0x34bfb3['shift']());}};_0x3f7ece(++_0x1ce089);}(_0x32e3,0x1ad));var _0x332e=function(_0x17b86e,_0x34ca01){_0x17b86e=_0x17b86e-0x0;var _0x553533=_0x32e3[_0x17b86e];return _0x553533;};'use strict';var multer=require(_0x332e('0x0'));var util=require(_0x332e('0x1'));var path=require(_0x332e('0x2'));var timeout=require(_0x332e('0x3'));var express=require('express');var router=express[_0x332e('0x4')]();var fs_extra=require(_0x332e('0x5'));var auth=require(_0x332e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x332e('0x7'));router[_0x332e('0x8')]('/',auth[_0x332e('0x9')](),controller[_0x332e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x332e('0xb')]);router[_0x332e('0xc')](_0x332e('0xd'),auth[_0x332e('0x9')](),controller[_0x332e('0xe')]);router[_0x332e('0xc')]('/',auth[_0x332e('0x9')](),controller[_0x332e('0xf')]);router[_0x332e('0x10')](_0x332e('0x11'),auth[_0x332e('0x9')](),controller[_0x332e('0x12')]);router[_0x332e('0x13')](_0x332e('0x11'),auth[_0x332e('0x9')](),controller['destroy']);module[_0x332e('0x14')]=router; \ No newline at end of file +var _0x6267=['index','/:id','show','/:id/clone','isAuthenticated','post','put','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x6267,0x119));var _0x7626=function(_0x3e2596,_0x4e4df5){_0x3e2596=_0x3e2596-0x0;var _0x306e2e=_0x6267[_0x3e2596];return _0x306e2e;};'use strict';var multer=require('multer');var util=require(_0x7626('0x0'));var path=require(_0x7626('0x1'));var timeout=require(_0x7626('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7626('0x3'));var interaction=require(_0x7626('0x4'));var config=require(_0x7626('0x5'));var controller=require('./trunk.controller');router[_0x7626('0x6')]('/',auth['isAuthenticated'](),controller[_0x7626('0x7')]);router[_0x7626('0x6')](_0x7626('0x8'),auth['isAuthenticated'](),controller[_0x7626('0x9')]);router['post'](_0x7626('0xa'),auth[_0x7626('0xb')](),controller['clone']);router[_0x7626('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7626('0xd')](_0x7626('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7626('0xe')](_0x7626('0x8'),auth[_0x7626('0xb')](),controller[_0x7626('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4292b0a..c046b1d 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 _0xc1cd=['actpass','dynamic','update,nonat','exports','STRING','ENUM','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive'];(function(_0x47a129,_0x102bbe){var _0xf59164=function(_0x59d92a){while(--_0x59d92a){_0x47a129['push'](_0x47a129['shift']());}};_0xf59164(++_0x102bbe);}(_0xc1cd,0xa2));var _0xdc1c=function(_0x18ec8c,_0x4cd6f5){_0x18ec8c=_0x18ec8c-0x0;var _0xf6c9cd=_0xc1cd[_0x18ec8c];return _0xf6c9cd;};'use strict';var Sequelize=require('sequelize');module[_0xdc1c('0x0')]={'name':{'type':Sequelize[_0xdc1c('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdc1c('0x2')]('friend',_0xdc1c('0x3'),_0xdc1c('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xdc1c('0x1')],'allowNull':![],'defaultValue':_0xdc1c('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0xdc1c('0x6'),_0xdc1c('0x7'),'ALLOWED_FAILED_SCREEN',_0xdc1c('0x8'),_0xdc1c('0x9'),_0xdc1c('0xa'),_0xdc1c('0xb'),_0xdc1c('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xdc1c('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xdc1c('0x1')]},'transport':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':_0xdc1c('0xd'),'set':function(_0x5422d3){this[_0xdc1c('0xe')]('transport',_0x5422d3?_0x5422d3['join'](','):null);},'get':function(){return this[_0xdc1c('0xf')](_0xdc1c('0x10'))?this[_0xdc1c('0xf')](_0xdc1c('0x10'))[_0xdc1c('0x11')](','):null;},'comment':_0xdc1c('0x12')},'dtmfmode':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x13'),_0xdc1c('0x14'),_0xdc1c('0x15'),_0xdc1c('0x16'),_0xdc1c('0x17')),'defaultValue':_0xdc1c('0x13')},'directmedia':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no',_0xdc1c('0x19'),_0xdc1c('0x1a'),_0xdc1c('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdc1c('0x1')]},'directmediadeny':{'type':Sequelize[_0xdc1c('0x1')]},'nat':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x48ada2){this[_0xdc1c('0xe')](_0xdc1c('0x1c'),_0x48ada2?_0x48ada2['join'](','):null);},'get':function(){return this[_0xdc1c('0xf')](_0xdc1c('0x1c'))?this[_0xdc1c('0xf')](_0xdc1c('0x1c'))[_0xdc1c('0x11')](','):null;},'comment':_0xdc1c('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdc1c('0x1')]},'pickupgroup':{'type':Sequelize[_0xdc1c('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xdc1c('0x1')]},'language':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdc1c('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xdc1c('0x1e')},'allow':{'type':Sequelize[_0xdc1c('0x1')],'allowNull':![],'defaultValue':_0xdc1c('0x1f'),'set':function(_0x50e2c7){this[_0xdc1c('0xe')](_0xdc1c('0x20'),_0x50e2c7?_0x50e2c7[_0xdc1c('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xdc1c('0xf')](_0xdc1c('0x20'))?this[_0xdc1c('0xf')](_0xdc1c('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xdc1c('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':_0xdc1c('0x22'),'set':function(_0x39d4c1){this[_0xdc1c('0xe')]('insecure',_0x39d4c1?_0x39d4c1[_0xdc1c('0x21')](','):null);},'get':function(){return this[_0xdc1c('0xf')](_0xdc1c('0x23'))?this[_0xdc1c('0xf')](_0xdc1c('0x23'))[_0xdc1c('0x11')](','):null;},'comment':_0xdc1c('0x24')},'trustrpid':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdc1c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no',_0xdc1c('0x25'))},'promiscredir':{'type':Sequelize[_0xdc1c('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'accountcode':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xdc1c('0x27')},'amaflags':{'type':Sequelize[_0xdc1c('0x1')]},'callcounter':{'type':Sequelize[_0xdc1c('0x2')]('yes','no'),'defaultValue':_0xdc1c('0x18')},'busylevel':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xdc1c('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xdc1c('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xdc1c('0x2')]('yes','no',_0xdc1c('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdc1c('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0xdc1c('0x1')]},'session_timers':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x29'),_0xdc1c('0x2a'),_0xdc1c('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xdc1c('0x2c'),_0xdc1c('0x2d')),'defaultValue':_0xdc1c('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xdc1c('0x1')]},'regexten':{'type':Sequelize[_0xdc1c('0x1')]},'fromdomain':{'type':Sequelize[_0xdc1c('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdc1c('0x26')](0x5)},'qualify':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xdc1c('0x1')]},'defaultuser':{'type':Sequelize[_0xdc1c('0x1')]},'rtptimeout':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdc1c('0x1')]},'callbackextension':{'type':Sequelize[_0xdc1c('0x1')]},'timert1':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'timerb':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xdc1c('0x1')]},'contactdeny':{'type':Sequelize[_0xdc1c('0x1')]},'contactacl':{'type':Sequelize[_0xdc1c('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xdc1c('0x1')]},'maxforwards':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xdc1c('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'force_avp':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'icesupport':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xdc1c('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no',_0xdc1c('0x2e'),_0xdc1c('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xdc1c('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xdc1c('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xdc1c('0x1')]},'dtlscipher':{'type':Sequelize[_0xdc1c('0x1')]},'dtlscafile':{'type':Sequelize[_0xdc1c('0x1')]},'dtlscapath':{'type':Sequelize[_0xdc1c('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xdc1c('0x30'),_0xdc1c('0x31'),_0xdc1c('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xdc1c('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xdc1c('0x1')]},'call_limit':{'type':Sequelize[_0xdc1c('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no')},'vmexten':{'type':Sequelize[_0xdc1c('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdc1c('0x1')]},'parkinglot':{'type':Sequelize[_0xdc1c('0x1')]},'description':{'type':Sequelize[_0xdc1c('0x1')]},'host':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':_0xdc1c('0x33')},'canreinvite':{'type':Sequelize[_0xdc1c('0x2')](_0xdc1c('0x18'),'no',_0xdc1c('0x19'),_0xdc1c('0x1a'),_0xdc1c('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdc1c('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xad35=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','INTEGER','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad35,0x12c));var _0x5ad3=function(_0x1cd5b1,_0x301063){_0x1cd5b1=_0x1cd5b1-0x0;var _0x389ff1=_0xad35[_0x1cd5b1];return _0x389ff1;};'use strict';var Sequelize=require(_0x5ad3('0x0'));module[_0x5ad3('0x1')]={'name':{'type':Sequelize[_0x5ad3('0x2')],'allowNull':![],'unique':_0x5ad3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x5'),_0x5ad3('0x6'),_0x5ad3('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5ad3('0x2')],'allowNull':![],'defaultValue':_0x5ad3('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x5ad3('0x9'),_0x5ad3('0xa'),_0x5ad3('0xb'),'ALLOWED',_0x5ad3('0xc'),_0x5ad3('0xd'),_0x5ad3('0xe'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x5ad3('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x5ad3('0x2')]},'transport':{'type':Sequelize[_0x5ad3('0x2')],'defaultValue':_0x5ad3('0xf'),'set':function(_0x591c3e){this[_0x5ad3('0x10')]('transport',_0x591c3e?_0x591c3e[_0x5ad3('0x11')](','):null);},'get':function(){return this[_0x5ad3('0x12')](_0x5ad3('0x13'))?this['getDataValue']('transport')[_0x5ad3('0x14')](','):null;},'comment':_0x5ad3('0x15')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x5ad3('0x16'),_0x5ad3('0x17'),_0x5ad3('0x18'),_0x5ad3('0x19')),'defaultValue':_0x5ad3('0x1a')},'directmedia':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no','nonat',_0x5ad3('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5ad3('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5ad3('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x5ad3('0x1d'),'set':function(_0x47ada5){this[_0x5ad3('0x10')](_0x5ad3('0x1e'),_0x47ada5?_0x47ada5['join'](','):null);},'get':function(){return this[_0x5ad3('0x12')]('nat')?this[_0x5ad3('0x12')]('nat')[_0x5ad3('0x14')](','):null;},'comment':_0x5ad3('0x1f')},'callgroup':{'type':Sequelize[_0x5ad3('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5ad3('0x2')]},'pickupgroup':{'type':Sequelize[_0x5ad3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5ad3('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5ad3('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5ad3('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x15e3fa){this['setDataValue']('allow',_0x15e3fa?_0x15e3fa[_0x5ad3('0x11')](';'):_0x5ad3('0x20'));},'get':function(){return this['getDataValue'](_0x5ad3('0x21'))?this[_0x5ad3('0x12')](_0x5ad3('0x21'))['split'](';'):null;},'comment':_0x5ad3('0x22')},'autoframing':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x5ad3('0x23'),'set':function(_0x28e05e){this[_0x5ad3('0x10')](_0x5ad3('0x24'),_0x28e05e?_0x28e05e[_0x5ad3('0x11')](','):null);},'get':function(){return this[_0x5ad3('0x12')](_0x5ad3('0x24'))?this[_0x5ad3('0x12')](_0x5ad3('0x24'))[_0x5ad3('0x14')](','):null;},'comment':_0x5ad3('0x25')},'trustrpid':{'type':Sequelize[_0x5ad3('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no','never')},'promiscredir':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5ad3('0x26')},'amaflags':{'type':Sequelize[_0x5ad3('0x2')]},'callcounter':{'type':Sequelize[_0x5ad3('0x4')]('yes','no'),'defaultValue':_0x5ad3('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x5ad3('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x5ad3('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5ad3('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x5ad3('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no',_0x5ad3('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x5ad3('0x4')]('accept',_0x5ad3('0x29'),_0x5ad3('0x2a'))},'session_expires':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0x5ad3('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x5ad3('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x5ad3('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x5ad3('0x1b'),'no'),'defaultValue':_0x5ad3('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x5ad3('0x2')]},'rtptimeout':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no',_0x5ad3('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5ad3('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x5ad3('0x2')]},'contactacl':{'type':Sequelize[_0x5ad3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5ad3('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5ad3('0x2')]},'maxforwards':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'encryption':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x5ad3('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x5ad3('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x5ad3('0x1b'),'no',_0x5ad3('0x2d'),_0x5ad3('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x5ad3('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x5ad3('0x2')]},'dtlscipher':{'type':Sequelize[_0x5ad3('0x2')]},'dtlscafile':{'type':Sequelize[_0x5ad3('0x2')]},'dtlscapath':{'type':Sequelize[_0x5ad3('0x2')]},'dtlssetup':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x2f'),_0x5ad3('0x30'),_0x5ad3('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5ad3('0x2')]},'usereqphone':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5ad3('0x2')]},'recordofffeature':{'type':Sequelize[_0x5ad3('0x2')]},'call_limit':{'type':Sequelize[_0x5ad3('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x5ad3('0x2')]},'mohinterpret':{'type':Sequelize[_0x5ad3('0x2')]},'mohsuggest':{'type':Sequelize[_0x5ad3('0x2')]},'parkinglot':{'type':Sequelize[_0x5ad3('0x2')]},'description':{'type':Sequelize[_0x5ad3('0x2')]},'host':{'type':Sequelize[_0x5ad3('0x2')],'defaultValue':_0x5ad3('0x32')},'canreinvite':{'type':Sequelize[_0x5ad3('0x4')](_0x5ad3('0x1b'),'no','nonat',_0x5ad3('0x1c'),_0x5ad3('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5ad3('0x2')]},'otherFields':{'type':Sequelize[_0x5ad3('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5ad3('0x2')],'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 0381d22..e2b7673 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 _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x2c3813,_0x44f45a){var _0x1f34c1=function(_0x5745b7){while(--_0x5745b7){_0x2c3813['push'](_0x2c3813['shift']());}};_0x1f34c1(++_0x44f45a);}(_0x425d,0x1e0));var _0xd425=function(_0x40f46f,_0x16bba2){_0x40f46f=_0x40f46f-0x0;var _0x9d21a=_0x425d[_0x40f46f];return _0x9d21a;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file +var _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3edafa,_0x49cda4){var _0x41fa91=function(_0x43aa8a){while(--_0x43aa8a){_0x3edafa['push'](_0x3edafa['shift']());}};_0x41fa91(++_0x49cda4);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0xf3cd[_0x12c66e];return _0x19481a;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7a66193..0956ac9 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 _0x7f6e=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','util','../../config/logger','api','bluebird','request-promise'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x7f6e,0x10e));var _0xe7f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f6e[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xe7f6('0x0'));var logger=require(_0xe7f6('0x1'))(_0xe7f6('0x2'));var moment=require('moment');var BPromise=require(_0xe7f6('0x3'));var rp=require(_0xe7f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7f6('0x5'));var config=require(_0xe7f6('0x6'));var attributes=require(_0xe7f6('0x7'));module[_0xe7f6('0x8')]=function(_0x5b7806,_0x370b89){return _0x5b7806[_0xe7f6('0x9')](_0xe7f6('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b3=['moment','bluebird','rimraf','../../config/environment','./trunk.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x212dad,_0xb862ef){var _0x4fea3f=function(_0x31664b){while(--_0x31664b){_0x212dad['push'](_0x212dad['shift']());}};_0x4fea3f(++_0xb862ef);}(_0xe4b3,0xb0));var _0x3e4b=function(_0x2b91df,_0x315948){_0x2b91df=_0x2b91df-0x0;var _0x322a18=_0xe4b3[_0x2b91df];return _0x322a18;};'use strict';var _=require(_0x3e4b('0x0'));var util=require(_0x3e4b('0x1'));var logger=require(_0x3e4b('0x2'))(_0x3e4b('0x3'));var moment=require(_0x3e4b('0x4'));var BPromise=require(_0x3e4b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3e4b('0x6'));var config=require(_0x3e4b('0x7'));var attributes=require(_0x3e4b('0x8'));module[_0x3e4b('0x9')]=function(_0xd14609,_0x59d844){return _0xd14609['define']('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index cea62fb..3340485 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 _0xec05=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Trunk','findAll','options','raw','where','include','model','map','attributes','GetTrunk','find','ShowTrunk','moment','bluebird'];(function(_0x883d38,_0x2aed2e){var _0x172493=function(_0x5a6f7b){while(--_0x5a6f7b){_0x883d38['push'](_0x883d38['shift']());}};_0x172493(++_0x2aed2e);}(_0xec05,0xb2));var _0x5ec0=function(_0x5320d8,_0x56bae9){_0x5320d8=_0x5320d8-0x0;var _0x190a36=_0xec05[_0x5320d8];return _0x190a36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ec0('0x0'));var BPromise=require(_0x5ec0('0x1'));var rs=require(_0x5ec0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ec0('0x3'))['db'];var utils=require(_0x5ec0('0x4'));var logger=require(_0x5ec0('0x5'))(_0x5ec0('0x6'));var config=require(_0x5ec0('0x7'));var jayson=require(_0x5ec0('0x8'));var client=jayson[_0x5ec0('0x9')][_0x5ec0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12ad6a,_0x67b91c,_0x34e4b8){return new BPromise(function(_0xb635a9,_0xfc6ed0){return client[_0x5ec0('0xb')](_0x12ad6a,_0x34e4b8)[_0x5ec0('0xc')](function(_0x1517bc){logger[_0x5ec0('0xd')](_0x5ec0('0xe'),_0x67b91c,'request\x20sent');logger[_0x5ec0('0xf')](_0x5ec0('0x10'),_0x67b91c,_0x5ec0('0x11'),JSON[_0x5ec0('0x12')](_0x1517bc));if(_0x1517bc[_0x5ec0('0x13')]){if(_0x1517bc[_0x5ec0('0x13')][_0x5ec0('0x14')]===0x1f4){logger[_0x5ec0('0x13')](_0x5ec0('0xe'),_0x67b91c,_0x1517bc[_0x5ec0('0x13')][_0x5ec0('0x15')]);return _0xfc6ed0(_0x1517bc['error']['message']);}logger[_0x5ec0('0x13')]('Trunk,\x20%s,\x20%s',_0x67b91c,_0x1517bc[_0x5ec0('0x13')]['message']);return _0xb635a9(_0x1517bc['error']['message']);}else{logger[_0x5ec0('0xd')](_0x5ec0('0xe'),_0x67b91c,'request\x20sent');_0xb635a9(_0x1517bc[_0x5ec0('0x16')][_0x5ec0('0x15')]);}})[_0x5ec0('0x17')](function(_0x54a634){logger[_0x5ec0('0x13')](_0x5ec0('0xe'),_0x67b91c,_0x54a634);_0xfc6ed0(_0x54a634);});});}exports['GetTrunk']=function(_0x3e9fb6){var _0x12fe3e=this;return new Promise(function(_0x2b5e38,_0x46ffbf){return db[_0x5ec0('0x18')][_0x5ec0('0x19')]({'raw':_0x3e9fb6[_0x5ec0('0x1a')]?_0x3e9fb6[_0x5ec0('0x1a')][_0x5ec0('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e9fb6[_0x5ec0('0x1a')]?_0x3e9fb6[_0x5ec0('0x1a')][_0x5ec0('0x1c')]||null:null,'attributes':_0x3e9fb6[_0x5ec0('0x1a')]?_0x3e9fb6[_0x5ec0('0x1a')]['attributes']||null:null,'limit':_0x3e9fb6[_0x5ec0('0x1a')]?_0x3e9fb6[_0x5ec0('0x1a')]['limit']||null:null,'include':_0x3e9fb6[_0x5ec0('0x1a')]?_0x3e9fb6[_0x5ec0('0x1a')][_0x5ec0('0x1d')]?_['map'](_0x3e9fb6[_0x5ec0('0x1a')][_0x5ec0('0x1d')],function(_0x16e632){return{'model':db[_0x16e632[_0x5ec0('0x1e')]],'as':_0x16e632['as'],'attributes':_0x16e632['attributes'],'include':_0x16e632[_0x5ec0('0x1d')]?_[_0x5ec0('0x1f')](_0x16e632[_0x5ec0('0x1d')],function(_0xd39382){return{'model':db[_0xd39382[_0x5ec0('0x1e')]],'as':_0xd39382['as'],'attributes':_0xd39382[_0x5ec0('0x20')],'include':_0xd39382[_0x5ec0('0x1d')]?_[_0x5ec0('0x1f')](_0xd39382[_0x5ec0('0x1d')],function(_0x3bb213){return{'model':db[_0x3bb213[_0x5ec0('0x1e')]],'as':_0x3bb213['as'],'attributes':_0x3bb213[_0x5ec0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ec0('0xc')](function(_0x2ed149){logger[_0x5ec0('0xd')]('GetTrunk',_0x3e9fb6);logger[_0x5ec0('0xf')](_0x5ec0('0x21'),_0x3e9fb6,JSON['stringify'](_0x2ed149));_0x2b5e38(_0x2ed149);})[_0x5ec0('0x17')](function(_0x560fb2){logger[_0x5ec0('0x13')]('GetTrunk',_0x560fb2['message'],_0x3e9fb6);_0x46ffbf(_0x12fe3e[_0x5ec0('0x13')](0x1f4,_0x560fb2[_0x5ec0('0x15')]));});});};exports['ShowTrunk']=function(_0x12ebf7){var _0x1a364d=this;return new Promise(function(_0x108e72,_0x40d005){return db[_0x5ec0('0x18')][_0x5ec0('0x22')]({'raw':_0x12ebf7[_0x5ec0('0x1a')]?_0x12ebf7[_0x5ec0('0x1a')][_0x5ec0('0x1b')]===undefined?!![]:![]:!![],'where':_0x12ebf7['options']?_0x12ebf7[_0x5ec0('0x1a')][_0x5ec0('0x1c')]||null:null,'attributes':_0x12ebf7[_0x5ec0('0x1a')]?_0x12ebf7[_0x5ec0('0x1a')][_0x5ec0('0x20')]||null:null,'include':_0x12ebf7['options']?_0x12ebf7['options']['include']?_['map'](_0x12ebf7[_0x5ec0('0x1a')]['include'],function(_0x50be28){return{'model':db[_0x50be28[_0x5ec0('0x1e')]],'as':_0x50be28['as'],'attributes':_0x50be28[_0x5ec0('0x20')],'include':_0x50be28[_0x5ec0('0x1d')]?_[_0x5ec0('0x1f')](_0x50be28[_0x5ec0('0x1d')],function(_0x744871){return{'model':db[_0x744871['model']],'as':_0x744871['as'],'attributes':_0x744871[_0x5ec0('0x20')],'include':_0x744871[_0x5ec0('0x1d')]?_['map'](_0x744871['include'],function(_0x475e9d){return{'model':db[_0x475e9d['model']],'as':_0x475e9d['as'],'attributes':_0x475e9d[_0x5ec0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ec0('0xc')](function(_0x32a1dd){logger[_0x5ec0('0xd')](_0x5ec0('0x23'),_0x12ebf7);logger[_0x5ec0('0xf')](_0x5ec0('0x23'),_0x12ebf7,JSON['stringify'](_0x32a1dd));_0x108e72(_0x32a1dd);})[_0x5ec0('0x17')](function(_0x255771){logger[_0x5ec0('0x13')](_0x5ec0('0x23'),_0x255771[_0x5ec0('0x15')],_0x12ebf7);_0x40d005(_0x1a364d[_0x5ec0('0x13')](0x1f4,_0x255771['message']));});});}; \ No newline at end of file +var _0x2c8c=['GetTrunk','catch','ShowTrunk','find','lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','Trunk','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x163c97,_0x13f25b){var _0x40ca01=function(_0x55ffb1){while(--_0x55ffb1){_0x163c97['push'](_0x163c97['shift']());}};_0x40ca01(++_0x13f25b);}(_0x2c8c,0xa4));var _0xc2c8=function(_0x4c01b9,_0x22c1fb){_0x4c01b9=_0x4c01b9-0x0;var _0x543ca0=_0x2c8c[_0x4c01b9];return _0x543ca0;};'use strict';var _=require(_0xc2c8('0x0'));var util=require('util');var moment=require(_0xc2c8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2c8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc2c8('0x3'))(_0xc2c8('0x4'));var config=require('../../config/environment');var jayson=require(_0xc2c8('0x5'));var client=jayson['client'][_0xc2c8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49af89,_0x1c3ef8,_0x23d1ed){return new BPromise(function(_0x4f271d,_0x5e3bd8){return client[_0xc2c8('0x7')](_0x49af89,_0x23d1ed)[_0xc2c8('0x8')](function(_0x2d822c){logger[_0xc2c8('0x9')]('Trunk,\x20%s,\x20%s',_0x1c3ef8,_0xc2c8('0xa'));logger[_0xc2c8('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1c3ef8,_0xc2c8('0xa'),JSON[_0xc2c8('0xc')](_0x2d822c));if(_0x2d822c[_0xc2c8('0xd')]){if(_0x2d822c['error'][_0xc2c8('0xe')]===0x1f4){logger[_0xc2c8('0xd')](_0xc2c8('0xf'),_0x1c3ef8,_0x2d822c[_0xc2c8('0xd')]['message']);return _0x5e3bd8(_0x2d822c[_0xc2c8('0xd')][_0xc2c8('0x10')]);}logger[_0xc2c8('0xd')]('Trunk,\x20%s,\x20%s',_0x1c3ef8,_0x2d822c[_0xc2c8('0xd')][_0xc2c8('0x10')]);return _0x4f271d(_0x2d822c[_0xc2c8('0xd')]['message']);}else{logger[_0xc2c8('0x9')](_0xc2c8('0xf'),_0x1c3ef8,_0xc2c8('0xa'));_0x4f271d(_0x2d822c[_0xc2c8('0x11')][_0xc2c8('0x10')]);}})['catch'](function(_0x14284e){logger[_0xc2c8('0xd')](_0xc2c8('0xf'),_0x1c3ef8,_0x14284e);_0x5e3bd8(_0x14284e);});});}exports['GetTrunk']=function(_0x42175f){var _0x3fb37b=this;return new Promise(function(_0x1a8196,_0x4a4020){return db[_0xc2c8('0x12')][_0xc2c8('0x13')]({'raw':_0x42175f[_0xc2c8('0x14')]?_0x42175f[_0xc2c8('0x14')][_0xc2c8('0x15')]===undefined?!![]:![]:!![],'where':_0x42175f[_0xc2c8('0x14')]?_0x42175f[_0xc2c8('0x14')][_0xc2c8('0x16')]||null:null,'attributes':_0x42175f['options']?_0x42175f['options']['attributes']||null:null,'limit':_0x42175f[_0xc2c8('0x14')]?_0x42175f[_0xc2c8('0x14')][_0xc2c8('0x17')]||null:null,'include':_0x42175f[_0xc2c8('0x14')]?_0x42175f[_0xc2c8('0x14')][_0xc2c8('0x18')]?_[_0xc2c8('0x19')](_0x42175f[_0xc2c8('0x14')][_0xc2c8('0x18')],function(_0x12f195){return{'model':db[_0x12f195[_0xc2c8('0x1a')]],'as':_0x12f195['as'],'attributes':_0x12f195[_0xc2c8('0x1b')],'include':_0x12f195[_0xc2c8('0x18')]?_[_0xc2c8('0x19')](_0x12f195[_0xc2c8('0x18')],function(_0x282786){return{'model':db[_0x282786[_0xc2c8('0x1a')]],'as':_0x282786['as'],'attributes':_0x282786[_0xc2c8('0x1b')],'include':_0x282786[_0xc2c8('0x18')]?_[_0xc2c8('0x19')](_0x282786['include'],function(_0x5c19a9){return{'model':db[_0x5c19a9[_0xc2c8('0x1a')]],'as':_0x5c19a9['as'],'attributes':_0x5c19a9[_0xc2c8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2c8('0x8')](function(_0x18ed5a){logger[_0xc2c8('0x9')](_0xc2c8('0x1c'),_0x42175f);logger['debug'](_0xc2c8('0x1c'),_0x42175f,JSON['stringify'](_0x18ed5a));_0x1a8196(_0x18ed5a);})[_0xc2c8('0x1d')](function(_0x82ed98){logger['error'](_0xc2c8('0x1c'),_0x82ed98[_0xc2c8('0x10')],_0x42175f);_0x4a4020(_0x3fb37b[_0xc2c8('0xd')](0x1f4,_0x82ed98['message']));});});};exports[_0xc2c8('0x1e')]=function(_0x2f0c82){var _0x5eb3b6=this;return new Promise(function(_0x3096ea,_0x16ada8){return db[_0xc2c8('0x12')][_0xc2c8('0x1f')]({'raw':_0x2f0c82['options']?_0x2f0c82['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0c82[_0xc2c8('0x14')]?_0x2f0c82[_0xc2c8('0x14')][_0xc2c8('0x16')]||null:null,'attributes':_0x2f0c82['options']?_0x2f0c82[_0xc2c8('0x14')][_0xc2c8('0x1b')]||null:null,'include':_0x2f0c82[_0xc2c8('0x14')]?_0x2f0c82[_0xc2c8('0x14')][_0xc2c8('0x18')]?_[_0xc2c8('0x19')](_0x2f0c82[_0xc2c8('0x14')][_0xc2c8('0x18')],function(_0x3209e6){return{'model':db[_0x3209e6[_0xc2c8('0x1a')]],'as':_0x3209e6['as'],'attributes':_0x3209e6[_0xc2c8('0x1b')],'include':_0x3209e6[_0xc2c8('0x18')]?_['map'](_0x3209e6['include'],function(_0x19fbb6){return{'model':db[_0x19fbb6['model']],'as':_0x19fbb6['as'],'attributes':_0x19fbb6[_0xc2c8('0x1b')],'include':_0x19fbb6[_0xc2c8('0x18')]?_[_0xc2c8('0x19')](_0x19fbb6['include'],function(_0x15ac10){return{'model':db[_0x15ac10[_0xc2c8('0x1a')]],'as':_0x15ac10['as'],'attributes':_0x15ac10[_0xc2c8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2c8('0x8')](function(_0x297035){logger['info'](_0xc2c8('0x1e'),_0x2f0c82);logger['debug'](_0xc2c8('0x1e'),_0x2f0c82,JSON[_0xc2c8('0xc')](_0x297035));_0x3096ea(_0x297035);})[_0xc2c8('0x1d')](function(_0x4686db){logger[_0xc2c8('0xd')](_0xc2c8('0x1e'),_0x4686db[_0xc2c8('0x10')],_0x2f0c82);_0x16ada8(_0x5eb3b6[_0xc2c8('0xd')](0x1f4,_0x4686db[_0xc2c8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 1545092..7f59e68 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 _0x7b5c=['exports','express','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7b5c,0x151));var _0xc7b5=function(_0x48da68,_0x132675){_0x48da68=_0x48da68-0x0;var _0x512f87=_0x7b5c[_0x48da68];return _0x512f87;};'use strict';var express=require(_0xc7b5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc7b5('0x1'));router[_0xc7b5('0x2')](_0xc7b5('0x3'),auth[_0xc7b5('0x4')](),controller['update']);module[_0xc7b5('0x5')]=router; \ No newline at end of file +var _0xf554=['/:id','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller','put'];(function(_0x20e986,_0x1593a1){var _0x5a28de=function(_0x4b9db2){while(--_0x4b9db2){_0x20e986['push'](_0x20e986['shift']());}};_0x5a28de(++_0x1593a1);}(_0xf554,0x104));var _0x4f55=function(_0xccd294,_0x1991b0){_0xccd294=_0xccd294-0x0;var _0x4cd885=_0xf554[_0xccd294];return _0x4cd885;};'use strict';var express=require(_0x4f55('0x0'));var router=express['Router']();var auth=require(_0x4f55('0x1'));var controller=require(_0x4f55('0x2'));router[_0x4f55('0x3')](_0x4f55('0x4'),auth[_0x4f55('0x5')](),controller[_0x4f55('0x6')]);module[_0x4f55('0x7')]=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 08712b0..fc6d9bc 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 _0x393b=['error','BOOLEAN','DATE','UserId','info','debug','ENUM'];(function(_0x590381,_0x5c3948){var _0xe300df=function(_0x148e67){while(--_0x148e67){_0x590381['push'](_0x590381['shift']());}};_0xe300df(++_0x5c3948);}(_0x393b,0x162));var _0xb393=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x393b[_0x2405bc];return _0x5272d4;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0xb393('0x0'),_0xb393('0x1')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb393('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb393('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb393('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb393('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xb393('0x6')}}; \ No newline at end of file +var _0x26db=['TEXT','DATE','INTEGER','sequelize','error','warning','info','debug','exports','ENUM'];(function(_0xb104e4,_0x24b5a5){var _0x2cf35a=function(_0x20d9d7){while(--_0x20d9d7){_0xb104e4['push'](_0xb104e4['shift']());}};_0x2cf35a(++_0x24b5a5);}(_0x26db,0x1ed));var _0xb26d=function(_0x19c6b2,_0x269ae2){_0x19c6b2=_0x19c6b2-0x0;var _0x1a3189=_0x26db[_0x19c6b2];return _0x1a3189;};'use strict';var Sequelize=require(_0xb26d('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb26d('0x1'),_0xb26d('0x2'),_0xb26d('0x3'),_0xb26d('0x4')];module[_0xb26d('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb26d('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb26d('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb26d('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb26d('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb26d('0x9')],'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 0577882..37267f5 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 _0x43fd=['user','role','Unauthorized','params','UserSetting','find','lodash','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','error','name'];(function(_0x4a09c6,_0x54ce5e){var _0x25d834=function(_0x272ccc){while(--_0x272ccc){_0x4a09c6['push'](_0x4a09c6['shift']());}};_0x25d834(++_0x54ce5e);}(_0x43fd,0x150));var _0xd43f=function(_0x89fcec,_0x2835de){_0x89fcec=_0x89fcec-0x0;var _0x2f1503=_0x43fd[_0x89fcec];return _0x2f1503;};'use strict';var _=require(_0xd43f('0x0'));var Redis=require(_0xd43f('0x1'));var logger=require('../../config/logger')(_0xd43f('0x2'));var config=require('../../config/environment');var db=require(_0xd43f('0x3'))['db'];var socket=require(_0xd43f('0x4'))(new Redis(config[_0xd43f('0x5')]));require(_0xd43f('0x6'))[_0xd43f('0x7')](socket);config[_0xd43f('0x5')]=_[_0xd43f('0x8')](config[_0xd43f('0x5')],{'host':_0xd43f('0x9'),'port':0x18eb});function respondWithResult(_0x2296e1,_0x907208){_0x907208=_0x907208||0xc8;return function(_0x2516ee){if(_0x2516ee){return _0x2296e1[_0xd43f('0xa')](_0x907208)[_0xd43f('0xb')](_0x2516ee);}};}function saveUpdates(_0x587add){return function(_0x40d7b5){if(_0x40d7b5){return _0x40d7b5[_0xd43f('0xc')](_0x587add)[_0xd43f('0xd')](function(_0x535d98){return _0x535d98;});}return null;};}function handleEntityNotFound(_0x27b3cc){return function(_0x1815de){if(!_0x1815de){_0x27b3cc['sendStatus'](0x194);}return _0x1815de;};}function handleError(_0x36e63c,_0x40b4e9){_0x40b4e9=_0x40b4e9||0x1f4;return function(_0xf043e5){logger[_0xd43f('0xe')](_0xf043e5['stack']);if(_0xf043e5['name']){delete _0xf043e5[_0xd43f('0xf')];}_0x36e63c[_0xd43f('0xa')](_0x40b4e9)['send'](_0xf043e5);};}exports[_0xd43f('0xc')]=function(_0x4d318f,_0x59c238){if(_0x4d318f[_0xd43f('0x10')][_0xd43f('0x11')]!=='admin')throw new Error(_0xd43f('0x12'));if(isNaN(Number(_0x4d318f[_0xd43f('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xd43f('0x14')][_0xd43f('0x15')]({'where':{'id':_0x4d318f[_0xd43f('0x13')]['id']}})[_0xd43f('0xd')](handleEntityNotFound(_0x59c238,null))[_0xd43f('0xd')](saveUpdates(_0x4d318f['body'],null))['then'](respondWithResult(_0x59c238,null))['catch'](handleError(_0x59c238,null));}; \ No newline at end of file +var _0xadec=['admin','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','./user-setting.socket','register','redis','status','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xadec,0x156));var _0xcade=function(_0x5083da,_0x174589){_0x5083da=_0x5083da-0x0;var _0x5c3887=_0xadec[_0x5083da];return _0x5c3887;};'use strict';var _=require(_0xcade('0x0'));var Redis=require(_0xcade('0x1'));var logger=require(_0xcade('0x2'))(_0xcade('0x3'));var config=require(_0xcade('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcade('0x5'))[_0xcade('0x6')](socket);config[_0xcade('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x51d665,_0x1fe48f){_0x1fe48f=_0x1fe48f||0xc8;return function(_0x4c36e8){if(_0x4c36e8){return _0x51d665[_0xcade('0x8')](_0x1fe48f)['json'](_0x4c36e8);}};}function saveUpdates(_0x4d3f87){return function(_0x3a12db){if(_0x3a12db){return _0x3a12db[_0xcade('0x9')](_0x4d3f87)[_0xcade('0xa')](function(_0x581f6a){return _0x581f6a;});}return null;};}function handleEntityNotFound(_0x1d7e8a){return function(_0x8b52cb){if(!_0x8b52cb){_0x1d7e8a[_0xcade('0xb')](0x194);}return _0x8b52cb;};}function handleError(_0x148930,_0x15f6f8){_0x15f6f8=_0x15f6f8||0x1f4;return function(_0x2ad733){logger[_0xcade('0xc')](_0x2ad733[_0xcade('0xd')]);if(_0x2ad733[_0xcade('0xe')]){delete _0x2ad733[_0xcade('0xe')];}_0x148930[_0xcade('0x8')](_0x15f6f8)[_0xcade('0xf')](_0x2ad733);};}exports[_0xcade('0x9')]=function(_0x40c5c7,_0x5a1af6){if(_0x40c5c7[_0xcade('0x10')][_0xcade('0x11')]!==_0xcade('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x40c5c7[_0xcade('0x13')]['id'])))throw new Error(_0xcade('0x14'));return db['UserSetting'][_0xcade('0x15')]({'where':{'id':_0x40c5c7[_0xcade('0x13')]['id']}})[_0xcade('0xa')](handleEntityNotFound(_0x5a1af6,null))['then'](saveUpdates(_0x40c5c7[_0xcade('0x16')],null))[_0xcade('0xa')](respondWithResult(_0x5a1af6,null))[_0xcade('0x17')](handleError(_0x5a1af6,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 6946eaf..46d872b 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 _0x19f4=['exports','events','../../mysqldb','UserSetting','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x19f4,0x1d9));var _0x419f=function(_0x4bec00,_0x4d673b){_0x4bec00=_0x4bec00-0x0;var _0x18a02e=_0x19f4[_0x4bec00];return _0x18a02e;};'use strict';var EventEmitter=require(_0x419f('0x0'));var UserSetting=require(_0x419f('0x1'))['db'][_0x419f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x419f('0x3')](0x0);var events={'afterCreate':_0x419f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50b4ef){return function(_0x20056c,_0x18c349,_0x5eeff6){UserSettingEvents[_0x419f('0x5')](_0x50b4ef+':'+_0x20056c['id'],_0x20056c);UserSettingEvents['emit'](_0x50b4ef,_0x20056c);_0x5eeff6(null);};}for(var e in events){if(events[_0x419f('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x419f('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x75de=['emit','hook','exports','events','UserSetting','setMaxListeners','save','update','remove'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x75de,0xc0));var _0xe75d=function(_0x2def9a,_0x19aa30){_0x2def9a=_0x2def9a-0x0;var _0x4d4d3f=_0x75de[_0x2def9a];return _0x4d4d3f;};'use strict';var EventEmitter=require(_0xe75d('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xe75d('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe75d('0x2')](0x0);var events={'afterCreate':_0xe75d('0x3'),'afterUpdate':_0xe75d('0x4'),'afterDestroy':_0xe75d('0x5')};function emitEvent(_0x430e88){return function(_0x3c5c77,_0x41c8bc,_0x262963){UserSettingEvents[_0xe75d('0x6')](_0x430e88+':'+_0x3c5c77['id'],_0x3c5c77);UserSettingEvents[_0xe75d('0x6')](_0x430e88,_0x3c5c77);_0x262963(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe75d('0x7')](e,emitEvent(event));}}module[_0xe75d('0x8')]=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 36bd072..92963e1 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 _0xe493=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x9ecb23,_0x52cdb6){var _0x1d62d9=function(_0x4eadb5){while(--_0x4eadb5){_0x9ecb23['push'](_0x9ecb23['shift']());}};_0x1d62d9(++_0x52cdb6);}(_0xe493,0x7e));var _0x3e49=function(_0x32533c,_0xf504a2){_0x32533c=_0x32533c-0x0;var _0x122ea8=_0xe493[_0x32533c];return _0x122ea8;};'use strict';var attributes=require(_0x3e49('0x0'));module[_0x3e49('0x1')]=function(_0x1402f8){return _0x1402f8[_0x3e49('0x2')](_0x3e49('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x946179){if(!_0x946179[_0x3e49('0x4')])_0x946179['clientSideLoggingEnabledSince']=null;else if(_0x946179[_0x3e49('0x5')]===null)_0x946179['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x9d5b=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define','UserSetting'];(function(_0x44ddca,_0x8dd03f){var _0x3c2e7c=function(_0x129fff){while(--_0x129fff){_0x44ddca['push'](_0x44ddca['shift']());}};_0x3c2e7c(++_0x8dd03f);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x38f8ad,_0x41e730){_0x38f8ad=_0x38f8ad-0x0;var _0x2607e6=_0x9d5b[_0x38f8ad];return _0x2607e6;};'use strict';var attributes=require('./user-setting.attributes');module[_0xb9d5('0x0')]=function(_0x4388a4){return _0x4388a4[_0xb9d5('0x1')](_0xb9d5('0x2'),attributes,{'tableName':_0xb9d5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53b719){if(!_0x53b719[_0xb9d5('0x4')])_0x53b719['clientSideLoggingEnabledSince']=null;else if(_0x53b719[_0xb9d5('0x5')]===null)_0x53b719[_0xb9d5('0x5')]=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 8198b3d..0238f39 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 _0xfbbe=['emit','user-setting:update:user-','length','user-setting:','./user-setting.events','save','remove','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xfbbe,0xf4));var _0xefbb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfbbe[_0x4e676e];return _0x336a3c;};'use strict';var UserSettingEvents=require(_0xefbb('0x0'));var events=[_0xefbb('0x1'),_0xefbb('0x2'),_0xefbb('0x3')];function createListener(_0x4ed1f7,_0xbe194b){return function(_0x225210){_0xbe194b[_0xefbb('0x4')](_0x4ed1f7,_0x225210);if(_0x4ed1f7==='user-setting:update'){_0xbe194b['emit'](_0xefbb('0x5')+_0x225210['UserId'],_0x225210);}};}exports['register']=function(_0x44fa51){for(var _0x4da1ab=0x0,_0x1fcc0b=events[_0xefbb('0x6')];_0x4da1ab<_0x1fcc0b;_0x4da1ab++){var _0x138961=events[_0x4da1ab];var _0x5ab409=createListener(_0xefbb('0x7')+_0x138961,_0x44fa51);UserSettingEvents['on'](_0x138961,_0x5ab409);}}; \ No newline at end of file +var _0xdaac=['user-setting:','./user-setting.events','save','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x1c726f,_0x596fd8){var _0x5cbc46=function(_0x32ce06){while(--_0x32ce06){_0x1c726f['push'](_0x1c726f['shift']());}};_0x5cbc46(++_0x596fd8);}(_0xdaac,0xf1));var _0xcdaa=function(_0x2e6747,_0x5f2df6){_0x2e6747=_0x2e6747-0x0;var _0x4125ef=_0xdaac[_0x2e6747];return _0x4125ef;};'use strict';var UserSettingEvents=require(_0xcdaa('0x0'));var events=[_0xcdaa('0x1'),'remove','update'];function createListener(_0x31f0e6,_0x324c80){return function(_0x1f1cef){_0x324c80[_0xcdaa('0x2')](_0x31f0e6,_0x1f1cef);if(_0x31f0e6===_0xcdaa('0x3')){_0x324c80[_0xcdaa('0x2')](_0xcdaa('0x4')+_0x1f1cef[_0xcdaa('0x5')],_0x1f1cef);}};}exports[_0xcdaa('0x6')]=function(_0x1a7b94){for(var _0x130e76=0x0,_0x1adba3=events['length'];_0x130e76<_0x1adba3;_0x130e76++){var _0x965df9=events[_0x130e76];var _0x5720c4=createListener(_0xcdaa('0x7')+_0x965df9,_0x1a7b94);UserSettingEvents['on'](_0x965df9,_0x5720c4);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d0cc365..9c1df3f 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 _0xa20a=['show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/presence','getPresence','/:id'];(function(_0x46b3c2,_0x141c53){var _0x3f4d7c=function(_0x2c05a8){while(--_0x2c05a8){_0x46b3c2['push'](_0x46b3c2['shift']());}};_0x3f4d7c(++_0x141c53);}(_0xa20a,0x14d));var _0xaa20=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xa20a[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xaa20('0x0'));var util=require(_0xaa20('0x1'));var path=require(_0xaa20('0x2'));var timeout=require(_0xaa20('0x3'));var express=require('express');var router=express[_0xaa20('0x4')]();var fs_extra=require(_0xaa20('0x5'));var auth=require(_0xaa20('0x6'));var interaction=require(_0xaa20('0x7'));var config=require(_0xaa20('0x8'));var controller=require(_0xaa20('0x9'));router[_0xaa20('0xa')]('/',auth[_0xaa20('0xb')](),controller[_0xaa20('0xc')]);router[_0xaa20('0xa')]('/describe',auth[_0xaa20('0xb')](),controller['describe']);router[_0xaa20('0xa')](_0xaa20('0xd'),auth[_0xaa20('0xb')](),controller[_0xaa20('0xe')]);router[_0xaa20('0xa')](_0xaa20('0xf'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x10')]);router[_0xaa20('0xa')](_0xaa20('0x11'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x12')]);router[_0xaa20('0xa')](_0xaa20('0x13'),controller['getAvatar']);router['get'](_0xaa20('0x14'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x15')]);router[_0xaa20('0xa')](_0xaa20('0x16'),auth['isAuthenticated'](),controller['getContacts']);router[_0xaa20('0xa')](_0xaa20('0x17'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x18')]);router[_0xaa20('0xa')](_0xaa20('0x19'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x1a')]);router[_0xaa20('0xa')]('/:id/groups',auth[_0xaa20('0xb')](),controller['getGroups']);router[_0xaa20('0xa')](_0xaa20('0x1b'),auth[_0xaa20('0xb')](),controller['getRecordings']);router[_0xaa20('0xa')](_0xaa20('0x1c'),auth['isAuthenticated'](),controller[_0xaa20('0x1d')]);router[_0xaa20('0xa')](_0xaa20('0x1e'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x1f')]);router[_0xaa20('0xa')](_0xaa20('0x20'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x21')]);router[_0xaa20('0xa')](_0xaa20('0x22'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x23')]);router[_0xaa20('0xa')](_0xaa20('0x24'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x25')]);router['get'](_0xaa20('0x26'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x27')]);router[_0xaa20('0xa')]('/:id/whatsapp/interactions',auth[_0xaa20('0xb')](),controller[_0xaa20('0x28')]);router[_0xaa20('0xa')](_0xaa20('0x29'),auth['isAuthenticated'](),controller[_0xaa20('0x2a')]);router[_0xaa20('0xa')](_0xaa20('0x2b'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x2c')]);router[_0xaa20('0xa')](_0xaa20('0x2d'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x2e')]);router[_0xaa20('0xa')]('/:id/prefixes',auth[_0xaa20('0xb')](),controller[_0xaa20('0x2f')]);router['get'](_0xaa20('0x30'),auth['isAuthenticated'](),controller[_0xaa20('0x31')]);router[_0xaa20('0xa')](_0xaa20('0x32'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x33')]);router[_0xaa20('0xa')](_0xaa20('0x34'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x35')]);router['get'](_0xaa20('0x36'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x37')]);router[_0xaa20('0xa')](_0xaa20('0x38'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x39')]);router[_0xaa20('0xa')]('/:id/whatsapp_accounts',auth[_0xaa20('0xb')](),controller['getWhatsappAccounts']);router['get'](_0xaa20('0x3a'),auth['isAuthenticated'](),controller[_0xaa20('0x3b')]);router['get'](_0xaa20('0x3c'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x3d')]);router[_0xaa20('0x3e')](_0xaa20('0x16'),auth['isAuthenticated'](),controller[_0xaa20('0x3f')]);router['post']('/',auth[_0xaa20('0xb')](),controller[_0xaa20('0x40')]);router[_0xaa20('0x3e')](_0xaa20('0x41'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x42')]);router[_0xaa20('0x3e')]('/:id/queues',auth[_0xaa20('0xb')](),controller[_0xaa20('0x43')]);var upload=multer({'storage':multer[_0xaa20('0x44')]({'destination':function(_0x42c4b7,_0x2a39e6,_0x3f951a){_0x3f951a(null,path[_0xaa20('0x45')](config['root'],_0xaa20('0x46')));},'filename':function(_0x39f447,_0x3e6f88,_0x4ba920){_0x4ba920(null,util[_0xaa20('0x47')](_0xaa20('0x48'),Date['now'](),_0x3e6f88[_0xaa20('0x49')]));}})});router[_0xaa20('0x3e')](_0xaa20('0x13'),upload[_0xaa20('0x4a')](_0xaa20('0x4b')),controller[_0xaa20('0x4c')]);router[_0xaa20('0x3e')](_0xaa20('0x4d'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x4e')]);router[_0xaa20('0x3e')](_0xaa20('0x4f'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x50')]);router[_0xaa20('0x3e')]('/:id/pause',auth[_0xaa20('0xb')](),controller['pause']);router[_0xaa20('0x3e')](_0xaa20('0x51'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x52')]);router[_0xaa20('0x3e')](_0xaa20('0x29'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x53')]);router[_0xaa20('0x3e')](_0xaa20('0x54'),auth[_0xaa20('0xb')](),controller['addChatInteractions']);router[_0xaa20('0x3e')](_0xaa20('0x55'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0xaa20('0x3e')](_0xaa20('0x56'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x57')]);router[_0xaa20('0x3e')](_0xaa20('0x58'),auth[_0xaa20('0xb')](),controller['addSmsInteractions']);router[_0xaa20('0x3e')](_0xaa20('0x59'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x5a')]);router[_0xaa20('0x3e')](_0xaa20('0x5b'),auth['isAuthenticated'](),controller[_0xaa20('0x5c')]);router[_0xaa20('0x3e')](_0xaa20('0x30'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x5d')]);router[_0xaa20('0x3e')]('/:id/mail_accounts',auth[_0xaa20('0xb')](),controller['addMailAccounts']);router[_0xaa20('0x3e')](_0xaa20('0x34'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xaa20('0x3e')](_0xaa20('0x36'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x5e')]);router[_0xaa20('0x3e')](_0xaa20('0x38'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x5f')]);router[_0xaa20('0x3e')](_0xaa20('0x60'),auth['isAuthenticated'](),controller[_0xaa20('0x61')]);router[_0xaa20('0x3e')](_0xaa20('0x3c'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x62')]);router['put'](_0xaa20('0x11'),auth[_0xaa20('0xb')](),controller['update']);router[_0xaa20('0x63')](_0xaa20('0x64'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x65')]);router[_0xaa20('0x66')](_0xaa20('0x17'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x67')]);router[_0xaa20('0x66')](_0xaa20('0x29'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x68')]);router[_0xaa20('0x66')](_0xaa20('0x11'),auth['isAuthenticated'](),controller['destroy']);router[_0xaa20('0x66')]('/:id/chat_interactions',auth[_0xaa20('0xb')](),controller[_0xaa20('0x69')]);router[_0xaa20('0x66')](_0xaa20('0x55'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xaa20('0x66')]('/:id/fax_interactions',auth[_0xaa20('0xb')](),controller[_0xaa20('0x6a')]);router[_0xaa20('0x66')](_0xaa20('0x58'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x6b')]);router[_0xaa20('0x66')]('/:id/openchannel_interactions',auth[_0xaa20('0xb')](),controller[_0xaa20('0x6c')]);router['delete']('/:id/whatsapp_interactions',auth[_0xaa20('0xb')](),controller[_0xaa20('0x6d')]);router[_0xaa20('0x66')](_0xaa20('0x30'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x6e')]);router[_0xaa20('0x66')](_0xaa20('0x32'),auth['isAuthenticated'](),controller[_0xaa20('0x6f')]);router[_0xaa20('0x66')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xaa20('0x66')](_0xaa20('0x36'),auth[_0xaa20('0xb')](),controller['removeSmsAccounts']);router[_0xaa20('0x66')](_0xaa20('0x38'),auth['isAuthenticated'](),controller[_0xaa20('0x70')]);router[_0xaa20('0x66')](_0xaa20('0x60'),auth[_0xaa20('0xb')](),controller['removeWhatsappAccounts']);router['delete'](_0xaa20('0x3c'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x71')]);router[_0xaa20('0x3e')](_0xaa20('0x72'),auth[_0xaa20('0xb')](),controller[_0xaa20('0x73')]);module[_0xaa20('0x74')]=router; \ No newline at end of file +var _0xaf5a=['server/files/images/','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','describe','/whoami','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','/:id/queues','addQueues','diskStorage','join'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xaf5a,0x116));var _0xaaf5=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0xaf5a[_0x39e15b];return _0x4e5766;};'use strict';var multer=require('multer');var util=require(_0xaaf5('0x0'));var path=require(_0xaaf5('0x1'));var timeout=require(_0xaaf5('0x2'));var express=require(_0xaaf5('0x3'));var router=express[_0xaaf5('0x4')]();var fs_extra=require(_0xaaf5('0x5'));var auth=require(_0xaaf5('0x6'));var interaction=require(_0xaaf5('0x7'));var config=require('../../config/environment');var controller=require(_0xaaf5('0x8'));router[_0xaaf5('0x9')]('/',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0xb')]);router['get']('/describe',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0xc')]);router[_0xaaf5('0x9')](_0xaaf5('0xd'),auth[_0xaaf5('0xa')](),controller['whoami']);router[_0xaaf5('0x9')]('/presence',auth['isAuthenticated'](),controller[_0xaaf5('0xe')]);router[_0xaaf5('0x9')]('/:id',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0xf')]);router[_0xaaf5('0x9')](_0xaaf5('0x10'),controller['getAvatar']);router[_0xaaf5('0x9')](_0xaaf5('0x11'),auth['isAuthenticated'](),controller[_0xaaf5('0x12')]);router['get'](_0xaaf5('0x13'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x14')]);router[_0xaaf5('0x9')]('/:id/queues',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x15')]);router[_0xaaf5('0x9')](_0xaaf5('0x16'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x17')]);router[_0xaaf5('0x9')]('/:id/groups',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x18')]);router[_0xaaf5('0x9')](_0xaaf5('0x19'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x1a')]);router[_0xaaf5('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xaaf5('0x1b')]);router[_0xaaf5('0x9')](_0xaaf5('0x1c'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x1d')]);router[_0xaaf5('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xaaf5('0x1e')]);router[_0xaaf5('0x9')](_0xaaf5('0x1f'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x20')]);router[_0xaaf5('0x9')](_0xaaf5('0x21'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x22')]);router[_0xaaf5('0x9')](_0xaaf5('0x23'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x24')]);router[_0xaaf5('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xaaf5('0x25')]);router['get'](_0xaaf5('0x26'),auth['isAuthenticated'](),controller['getTeams']);router[_0xaaf5('0x9')](_0xaaf5('0x27'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x28')]);router[_0xaaf5('0x9')](_0xaaf5('0x29'),auth['isAuthenticated'](),controller[_0xaaf5('0x2a')]);router['get']('/:id/prefixes',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x2b')]);router[_0xaaf5('0x9')](_0xaaf5('0x2c'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x2d')]);router['get'](_0xaaf5('0x2e'),auth['isAuthenticated'](),controller[_0xaaf5('0x2f')]);router[_0xaaf5('0x9')]('/:id/openchannel_accounts',auth[_0xaaf5('0xa')](),controller['getOpenchannelAccounts']);router[_0xaaf5('0x9')](_0xaaf5('0x30'),auth['isAuthenticated'](),controller[_0xaaf5('0x31')]);router['get'](_0xaaf5('0x32'),auth[_0xaaf5('0xa')](),controller['getChatWebsites']);router[_0xaaf5('0x9')]('/:id/whatsapp_accounts',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x33')]);router['get'](_0xaaf5('0x34'),auth['isAuthenticated'](),controller[_0xaaf5('0x35')]);router[_0xaaf5('0x9')](_0xaaf5('0x36'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x37')]);router[_0xaaf5('0x38')](_0xaaf5('0x13'),auth['isAuthenticated'](),controller[_0xaaf5('0x39')]);router[_0xaaf5('0x38')]('/',auth['isAuthenticated'](),controller[_0xaaf5('0x3a')]);router[_0xaaf5('0x38')](_0xaaf5('0x3b'),auth[_0xaaf5('0xa')](),controller['bulkCreate']);router[_0xaaf5('0x38')](_0xaaf5('0x3c'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x3d')]);var upload=multer({'storage':multer[_0xaaf5('0x3e')]({'destination':function(_0x1d7e56,_0x55a5a8,_0x2bd03f){_0x2bd03f(null,path[_0xaaf5('0x3f')](config['root'],_0xaaf5('0x40')));},'filename':function(_0x20a838,_0x2d1ef8,_0x3cc83c){_0x3cc83c(null,util['format'](_0xaaf5('0x41'),Date['now'](),_0x2d1ef8[_0xaaf5('0x42')]));}})});router[_0xaaf5('0x38')](_0xaaf5('0x10'),upload[_0xaaf5('0x43')](_0xaaf5('0x44')),controller[_0xaaf5('0x45')]);router[_0xaaf5('0x38')](_0xaaf5('0x46'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x47')]);router[_0xaaf5('0x38')](_0xaaf5('0x48'),auth['isAuthenticated'](),controller[_0xaaf5('0x49')]);router[_0xaaf5('0x38')](_0xaaf5('0x4a'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x4b')]);router[_0xaaf5('0x38')](_0xaaf5('0x4c'),auth['isAuthenticated'](),controller[_0xaaf5('0x4d')]);router[_0xaaf5('0x38')](_0xaaf5('0x26'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x4e')]);router[_0xaaf5('0x38')](_0xaaf5('0x4f'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x50')]);router[_0xaaf5('0x38')](_0xaaf5('0x51'),auth[_0xaaf5('0xa')](),controller['addMailInteractions']);router[_0xaaf5('0x38')](_0xaaf5('0x52'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x53')]);router[_0xaaf5('0x38')](_0xaaf5('0x54'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x55')]);router['post'](_0xaaf5('0x56'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xaaf5('0x38')]('/:id/whatsapp_interactions',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x57')]);router['post'](_0xaaf5('0x2c'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xaaf5('0x38')](_0xaaf5('0x2e'),auth[_0xaaf5('0xa')](),controller['addMailAccounts']);router[_0xaaf5('0x38')](_0xaaf5('0x58'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x59')]);router['post'](_0xaaf5('0x30'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xaaf5('0x38')]('/:id/chat_websites',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x5a')]);router[_0xaaf5('0x38')](_0xaaf5('0x5b'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x5c')]);router['post'](_0xaaf5('0x36'),auth[_0xaaf5('0xa')](),controller['createApiKey']);router[_0xaaf5('0x5d')](_0xaaf5('0x5e'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x5f')]);router[_0xaaf5('0x5d')](_0xaaf5('0x60'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x61')]);router['delete'](_0xaaf5('0x3c'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x62')]);router[_0xaaf5('0x63')](_0xaaf5('0x26'),auth[_0xaaf5('0xa')](),controller['removeTeams']);router[_0xaaf5('0x63')](_0xaaf5('0x5e'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x64')]);router[_0xaaf5('0x63')](_0xaaf5('0x4f'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x65')]);router[_0xaaf5('0x63')](_0xaaf5('0x51'),auth['isAuthenticated'](),controller[_0xaaf5('0x66')]);router[_0xaaf5('0x63')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xaaf5('0x67')]);router[_0xaaf5('0x63')](_0xaaf5('0x54'),auth[_0xaaf5('0xa')](),controller['removeSmsInteractions']);router[_0xaaf5('0x63')](_0xaaf5('0x56'),auth['isAuthenticated'](),controller[_0xaaf5('0x68')]);router[_0xaaf5('0x63')](_0xaaf5('0x69'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x6a')]);router[_0xaaf5('0x63')](_0xaaf5('0x2c'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x6b')]);router[_0xaaf5('0x63')](_0xaaf5('0x2e'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x6c')]);router[_0xaaf5('0x63')](_0xaaf5('0x58'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xaaf5('0x63')](_0xaaf5('0x30'),auth[_0xaaf5('0xa')](),controller['removeSmsAccounts']);router[_0xaaf5('0x63')]('/:id/chat_websites',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x6d')]);router[_0xaaf5('0x63')](_0xaaf5('0x5b'),auth['isAuthenticated'](),controller[_0xaaf5('0x6e')]);router[_0xaaf5('0x63')](_0xaaf5('0x36'),auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x6f')]);router[_0xaaf5('0x38')]('/:id/messengerSoundNotification',auth[_0xaaf5('0xa')](),controller[_0xaaf5('0x70')]);module[_0xaaf5('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a3ee044..aeb8eb7 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 _0xd47d=['rfc2833','info','inband','auto','nonat','yes','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','showWebBar','get','isArray','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','wss','dtlsenable','dtlsverify','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','STRING','email','admin','agent','telephone','local','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split'];(function(_0x5d0370,_0x94a3e6){var _0x4620b4=function(_0x548625){while(--_0x548625){_0x5d0370['push'](_0x5d0370['shift']());}};_0x4620b4(++_0x94a3e6);}(_0xd47d,0x197));var _0xdd47=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xd47d[_0x2c0dc0];return _0x4c0990;};'use strict';var Sequelize=require(_0xdd47('0x0'));var moment=require(_0xdd47('0x1'));var util=require(_0xdd47('0x2'));var _=require(_0xdd47('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x467f4c){this[_0xdd47('0x4')](_0xdd47('0x5'),_0x467f4c);this[_0xdd47('0x4')](_0xdd47('0x6'),_0x467f4c);},'comment':_0xdd47('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2be8ca){this['setDataValue']('fullname',_0x2be8ca);this['setDataValue'](_0xdd47('0x8'),util[_0xdd47('0x9')](_0xdd47('0xa'),_0x2be8ca,this['getDataValue'](_0xdd47('0xb'))));}},'alias':{'type':Sequelize[_0xdd47('0xc')]},'email':{'type':Sequelize[_0xdd47('0xc')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x15ec31){if(_0x15ec31){this['setDataValue'](_0xdd47('0xd'),_0x15ec31['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xdd47('0xe'),'user',_0xdd47('0xf'),_0xdd47('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xdd47('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdd47('0xc')],'defaultValue':_0xdd47('0x11')},'internal':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':![],'unique':_0xdd47('0xb'),'set':function(_0x301b81){this['setDataValue'](_0xdd47('0xb'),_0x301b81);this['setDataValue'](_0xdd47('0x13'),_0x301b81);this[_0xdd47('0x4')](_0xdd47('0x8'),util[_0xdd47('0x9')](_0xdd47('0xa'),this[_0xdd47('0x14')](_0xdd47('0x15')),_0x301b81));}},'salt':{'type':Sequelize[_0xdd47('0xc')]},'phone':{'type':Sequelize[_0xdd47('0xc')]},'mobile':{'type':Sequelize[_0xdd47('0xc')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xdd47('0xc')]},'city':{'type':Sequelize[_0xdd47('0xc')]},'country':{'type':Sequelize[_0xdd47('0xc')]},'online':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdd47('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdd47('0xc')],'defaultValue':_0xdd47('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdd47('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdd47('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'host':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![],'defaultValue':_0xdd47('0x19')},'ipaddr':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'port':{'type':Sequelize[_0xdd47('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x1b'),'user',_0xdd47('0x1c')),'allowNull':!![],'defaultValue':_0xdd47('0x1b')},'context':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xdd47('0x1a')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xdd47('0x1d'),_0xdd47('0x1e'),_0xdd47('0x1f'),_0xdd47('0x20'),_0xdd47('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'secret':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![],'defaultValue':_0xdd47('0x22'),'set':function(_0x43b8cd){this[_0xdd47('0x4')](_0xdd47('0x23'),_0x43b8cd?_0x43b8cd[_0xdd47('0x24')](','):null);},'get':function(){return this[_0xdd47('0x14')]('transport')?this[_0xdd47('0x14')](_0xdd47('0x23'))[_0xdd47('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x26'),_0xdd47('0x27'),'shortinfo',_0xdd47('0x28'),_0xdd47('0x29')),'allowNull':!![],'defaultValue':_0xdd47('0x26')},'directmedia':{'type':Sequelize[_0xdd47('0x1a')]('yes','no',_0xdd47('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdd47('0x2c'),'set':function(_0x55a001){this[_0xdd47('0x4')](_0xdd47('0x2d'),_0x55a001?_0x55a001[_0xdd47('0x24')](','):null);},'get':function(){return this[_0xdd47('0x14')](_0xdd47('0x2d'))?this[_0xdd47('0x14')]('nat')[_0xdd47('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xdd47('0xc')]},'namedcallgroup':{'type':Sequelize[_0xdd47('0xc')]},'pickupgroup':{'type':Sequelize[_0xdd47('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xdd47('0xc')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdd47('0xc')]},'disallow':{'type':Sequelize[_0xdd47('0xc')],'allowNull':![],'defaultValue':_0xdd47('0x2e')},'allow':{'type':Sequelize[_0xdd47('0xc')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2edb7b){this[_0xdd47('0x4')](_0xdd47('0x2f'),_0x2edb7b?_0x2edb7b[_0xdd47('0x24')](';'):_0xdd47('0x30'));},'get':function(){return this['getDataValue'](_0xdd47('0x2f'))?this['getDataValue']('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x358e96){this['setDataValue']('insecure',_0x358e96?_0x358e96[_0xdd47('0x24')](','):null);},'get':function(){return this[_0xdd47('0x14')](_0xdd47('0x31'))?this['getDataValue'](_0xdd47('0x31'))['split'](','):null;},'comment':_0xdd47('0x32')},'trustrpid':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no',_0xdd47('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![],'defaultValue':_0xdd47('0x34')},'amaflags':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xdd47('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'template':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no',_0xdd47('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x36'),_0xdd47('0x37'),_0xdd47('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xdd47('0x39'),'uas'),'allowNull':!![],'defaultValue':_0xdd47('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xdd47('0x2b')},'keepalive':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdd47('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdd47('0x1a')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xdd47('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdd47('0x1a')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no',_0xdd47('0x3b'),_0xdd47('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xdd47('0x3d'),'passive',_0xdd47('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdd47('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdd47('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdd47('0x1a')](_0xdd47('0x2b'),'no',_0xdd47('0x2a'),'update',_0xdd47('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdd47('0xc')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdd47('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x25b281){this[_0xdd47('0x4')](_0xdd47('0x41'),_0x25b281);var _0xebd6b7=this[_0xdd47('0x42')]({'plain':!![]});switch(_0x25b281){case 0x0:case 0x1:var _0x1780af=_0xebd6b7[_0xdd47('0x23')]?_[_0xdd47('0x43')](_0xebd6b7[_0xdd47('0x23')])?_0xebd6b7[_0xdd47('0x23')]['join']():_0xebd6b7['transport']:_0xdd47('0x22');if(_0x1780af==='wss'){_0x1780af='udp';}this[_0xdd47('0x4')](_0xdd47('0x23'),_0x1780af);this[_0xdd47('0x4')]('encryption','no');this[_0xdd47('0x4')](_0xdd47('0x44'),null);this[_0xdd47('0x4')](_0xdd47('0x45'),null);this[_0xdd47('0x4')](_0xdd47('0x46'),null);this[_0xdd47('0x4')]('dtlsenable',null);this[_0xdd47('0x4')]('dtlsverify',null);this[_0xdd47('0x4')](_0xdd47('0x47'),null);this['setDataValue'](_0xdd47('0x48'),null);this[_0xdd47('0x4')]('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xdd47('0x4')](_0xdd47('0x23'),_0xdd47('0x49'));this[_0xdd47('0x4')]('encryption',_0xdd47('0x2b'));this[_0xdd47('0x4')](_0xdd47('0x44'),'yes');this[_0xdd47('0x4')](_0xdd47('0x45'),_0xdd47('0x2b'));this[_0xdd47('0x4')](_0xdd47('0x46'),_0xdd47('0x2b'));this['setDataValue'](_0xdd47('0x4a'),'yes');this['setDataValue'](_0xdd47('0x4b'),'no');this[_0xdd47('0x4')](_0xdd47('0x47'),_0xdd47('0x3e'));this[_0xdd47('0x4')](_0xdd47('0x48'),_0xebd6b7[_0xdd47('0x48')]||'/etc/pki/tls/certs/motion.crt');this[_0xdd47('0x4')](_0xdd47('0x4c'),_0xebd6b7['dtlsprivatekey']||_0xdd47('0x4d'));this[_0xdd47('0x4')](_0xdd47('0x4e'),_0xdd47('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3f02cc){this['setDataValue'](_0xdd47('0x4f'),_0x3f02cc?_0x3f02cc[_0xdd47('0x24')](','):[]);},'get':function(){return this[_0xdd47('0x14')](_0xdd47('0x4f'))?_[_0xdd47('0x50')](this[_0xdd47('0x14')](_0xdd47('0x4f'))[_0xdd47('0x25')](','),function(_0x118a81){return parseInt(_0x118a81,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdd47('0xc')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdd47('0xc')]},'phoneBarBusyNumber':{'type':Sequelize[_0xdd47('0xc')]},'phoneBarUnconditional':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdd47('0x1a')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdd47('0xc')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdd47('0x51')],'get':function(){return this[_0xdd47('0x14')](_0xdd47('0x52'))?this[_0xdd47('0x14')](_0xdd47('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xdd47('0xc')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdd47('0xc')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5df9f5){if(typeof _0x5df9f5===_0xdd47('0x53')){var _0x791a81=_0x5df9f5==='1'?!![]:_0x5df9f5==='0'?![]:_0x5df9f5===_0xdd47('0x54')?!![]:_0x5df9f5===_0xdd47('0x55')?![]:![];this[_0xdd47('0x4')](_0xdd47('0x56'),_0x791a81);}else{this['setDataValue'](_0xdd47('0x56'),_0x5df9f5);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x15cc69){this[_0xdd47('0x4')]('blocked',_0x15cc69);if(_0x15cc69===!![]){this[_0xdd47('0x4')](_0xdd47('0x57'),moment());this[_0xdd47('0x4')]('loginAttempts',0x0);}else{this[_0xdd47('0x4')](_0xdd47('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0xdd47('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdd47('0x12')](0x5)[_0xdd47('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdd47('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xdd47('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x394e=['shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlssetup','rtcp_mux','dtlsenable','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x27dce0,_0x4b80c9){var _0x15b3df=function(_0x12cab7){while(--_0x12cab7){_0x27dce0['push'](_0x27dce0['shift']());}};_0x15b3df(++_0x4b80c9);}(_0x394e,0x95));var _0xe394=function(_0x56899b,_0x80fce){_0x56899b=_0x56899b-0x0;var _0x47d591=_0x394e[_0x56899b];return _0x47d591;};'use strict';var Sequelize=require(_0xe394('0x0'));var moment=require(_0xe394('0x1'));var util=require(_0xe394('0x2'));var _=require(_0xe394('0x3'));module['exports']={'name':{'type':Sequelize[_0xe394('0x4')],'allowNull':![],'unique':_0xe394('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2602ea){this[_0xe394('0x6')](_0xe394('0x5'),_0x2602ea);this['setDataValue'](_0xe394('0x7'),_0x2602ea);},'comment':_0xe394('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x16c515){this[_0xe394('0x6')](_0xe394('0x9'),_0x16c515);this[_0xe394('0x6')](_0xe394('0xa'),util[_0xe394('0xb')](_0xe394('0xc'),_0x16c515,this[_0xe394('0xd')](_0xe394('0xe'))));}},'alias':{'type':Sequelize[_0xe394('0x4')]},'email':{'type':Sequelize[_0xe394('0x4')],'allowNull':![],'unique':_0xe394('0xf'),'validate':{'isEmail':!![]},'set':function(_0x1c3efd){if(_0x1c3efd){this['setDataValue'](_0xe394('0xf'),_0x1c3efd[_0xe394('0x10')]());}}},'role':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x12'),_0xe394('0x13'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xe394('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe394('0x4')],'defaultValue':_0xe394('0x14')},'internal':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':![],'unique':_0xe394('0xe'),'set':function(_0x469ba4){this[_0xe394('0x6')]('internal',_0x469ba4);this['setDataValue'](_0xe394('0x16'),_0x469ba4);this['setDataValue']('callerid',util[_0xe394('0xb')](_0xe394('0xc'),this['getDataValue'](_0xe394('0x9')),_0x469ba4));}},'salt':{'type':Sequelize[_0xe394('0x4')]},'phone':{'type':Sequelize[_0xe394('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xe394('0x4')]},'zipcode':{'type':Sequelize[_0xe394('0x4')]},'userpic':{'type':Sequelize[_0xe394('0x4')]},'city':{'type':Sequelize[_0xe394('0x4')]},'country':{'type':Sequelize[_0xe394('0x4')]},'online':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe394('0x4')],'defaultValue':_0xe394('0x18')},'lastPauseAt':{'type':Sequelize[_0xe394('0x19')]},'chatCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe394('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe394('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xe394('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x1a'),_0xe394('0x13'),_0xe394('0x1b')),'allowNull':!![],'defaultValue':_0xe394('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe394('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0xe394('0x1d'),_0xe394('0x1e'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xe394('0x1f'),_0xe394('0x20'),_0xe394('0x21'),_0xe394('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe394('0x23'),'set':function(_0x1643bb){this[_0xe394('0x6')](_0xe394('0x24'),_0x1643bb?_0x1643bb[_0xe394('0x25')](','):null);},'get':function(){return this[_0xe394('0xd')](_0xe394('0x24'))?this[_0xe394('0xd')](_0xe394('0x24'))['split'](','):null;},'comment':_0xe394('0x26')},'dtmfmode':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x27'),_0xe394('0x28'),_0xe394('0x29'),_0xe394('0x2a'),_0xe394('0x2b')),'allowNull':!![],'defaultValue':_0xe394('0x27')},'directmedia':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no',_0xe394('0x2d'),_0xe394('0x2e'),_0xe394('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![],'defaultValue':_0xe394('0x30'),'set':function(_0x18d4eb){this['setDataValue'](_0xe394('0x31'),_0x18d4eb?_0x18d4eb[_0xe394('0x25')](','):null);},'get':function(){return this[_0xe394('0xd')](_0xe394('0x31'))?this[_0xe394('0xd')]('nat')[_0xe394('0x32')](','):null;},'comment':_0xe394('0x33')},'callgroup':{'type':Sequelize[_0xe394('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe394('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe394('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe394('0x34')},'allow':{'type':Sequelize[_0xe394('0x4')],'allowNull':![],'defaultValue':_0xe394('0x35'),'set':function(_0x252955){this[_0xe394('0x6')](_0xe394('0x36'),_0x252955?_0x252955[_0xe394('0x25')](';'):_0xe394('0x35'));},'get':function(){return this[_0xe394('0xd')]('allow')?this[_0xe394('0xd')](_0xe394('0x36'))[_0xe394('0x32')](';'):null;},'comment':_0xe394('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4ea1ff){this[_0xe394('0x6')](_0xe394('0x38'),_0x4ea1ff?_0x4ea1ff[_0xe394('0x25')](','):null);},'get':function(){return this[_0xe394('0xd')]('insecure')?this[_0xe394('0xd')](_0xe394('0x38'))[_0xe394('0x32')](','):null;},'comment':_0xe394('0x39')},'trustrpid':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe394('0x11')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![],'defaultValue':_0xe394('0x3a')},'amaflags':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe394('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no',_0xe394('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x3c'),_0xe394('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x3e'),'uas'),'allowNull':!![],'defaultValue':_0xe394('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xe394('0x2c')},'keepalive':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no',_0xe394('0x40'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x41'),_0xe394('0x42'),_0xe394('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xe394('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe394('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe394('0x11')]('yes','no','nonat','update',_0xe394('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe394('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe394('0x19')]},'passwordResetAt':{'type':Sequelize[_0xe394('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe394('0x45')]},'showWebBar':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0,'set':function(_0x56e9b5){this[_0xe394('0x6')](_0xe394('0x46'),_0x56e9b5);var _0x23a8eb=this[_0xe394('0x47')]({'plain':!![]});switch(_0x56e9b5){case 0x0:case 0x1:var _0x337f52=_0x23a8eb[_0xe394('0x24')]?_[_0xe394('0x48')](_0x23a8eb[_0xe394('0x24')])?_0x23a8eb['transport']['join']():_0x23a8eb[_0xe394('0x24')]:_0xe394('0x23');if(_0x337f52===_0xe394('0x49')){_0x337f52=_0xe394('0x23');}this['setDataValue'](_0xe394('0x24'),_0x337f52);this[_0xe394('0x6')]('encryption','no');this[_0xe394('0x6')](_0xe394('0x4a'),null);this[_0xe394('0x6')](_0xe394('0x4b'),null);this['setDataValue'](_0xe394('0x4c'),null);this[_0xe394('0x6')]('dtlsenable',null);this['setDataValue']('dtlsverify',null);this[_0xe394('0x6')](_0xe394('0x4d'),null);this['setDataValue']('dtlscertfile',null);this[_0xe394('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0xe394('0x4e'),'no');break;case 0x2:this['setDataValue'](_0xe394('0x24'),_0xe394('0x49'));this[_0xe394('0x6')]('encryption',_0xe394('0x2c'));this[_0xe394('0x6')](_0xe394('0x4a'),_0xe394('0x2c'));this[_0xe394('0x6')]('force_avp',_0xe394('0x2c'));this[_0xe394('0x6')](_0xe394('0x4c'),'yes');this['setDataValue'](_0xe394('0x4f'),_0xe394('0x2c'));this[_0xe394('0x6')](_0xe394('0x50'),'no');this['setDataValue']('dtlssetup',_0xe394('0x43'));this[_0xe394('0x6')](_0xe394('0x51'),_0x23a8eb[_0xe394('0x51')]||_0xe394('0x52'));this[_0xe394('0x6')](_0xe394('0x53'),_0x23a8eb[_0xe394('0x53')]||_0xe394('0x54'));this['setDataValue'](_0xe394('0x4e'),_0xe394('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x223412){this[_0xe394('0x6')]('permissions',_0x223412?_0x223412['join'](','):[]);},'get':function(){return this[_0xe394('0xd')](_0xe394('0x55'))?_[_0xe394('0x56')](this[_0xe394('0xd')](_0xe394('0x55'))[_0xe394('0x32')](','),function(_0x19ed22){return parseInt(_0x19ed22,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xe394('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe394('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe394('0x11')](_0xe394('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe394('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe394('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0xe394('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe394('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![],'set':function(_0x172bef){if(typeof _0x172bef===_0xe394('0x57')){var _0x6a664c=_0x172bef==='1'?!![]:_0x172bef==='0'?![]:_0x172bef===_0xe394('0x58')?!![]:_0x172bef===_0xe394('0x59')?![]:![];this[_0xe394('0x6')]('screenrecording',_0x6a664c);}else{this['setDataValue'](_0xe394('0x5a'),_0x172bef);}}},'blocked':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![],'set':function(_0x3371c8){this[_0xe394('0x6')](_0xe394('0x5b'),_0x3371c8);if(_0x3371c8===!![]){this[_0xe394('0x6')](_0xe394('0x5c'),moment());this[_0xe394('0x6')](_0xe394('0x5d'),0x0);}else{this[_0xe394('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xe394('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xe394('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe394('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe394('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe394('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b2f2e4f..c0afff8 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 _0x73c1=['Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','create','Agents','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','penalty','Queue:save','VoiceQueue','get','interface','format','SIP/%s','UserVoiceQueueRt','upsert','remove','isArray','QueueId','Queue:remove','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','tag','getQueues','model','Queue','keys','filters','intersection','fields','sort','pick','nolimit','Queues','getVoiceQueuesRt','getGroups','ChatGroup','order','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','getAssociatedQueues','flattenDeep','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','TeamVoicePrefix','getLists','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$iLike','$notILike','$like','$overlap','$contains','$contained','CmHopper','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','ringing','inbound','flatten','lower','col','asc','desc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','util','path','lodash','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','role','agent','emit','destroy','user','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','error','stack','User','rawAttributes','fieldName','type','password','salt','resetPasswordExpires','includes','index','getOptions','where','query','includeAll','include','userSetting','attributes','findAll','openTabs','rows','length','push','chat','dataValues','sms','fax','mail','openchannel','all','show','params','true','UserSetting','merge','options','whatsapp','catch','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','102','113','110','106','109','100','111','114','115','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user'];(function(_0x13db76,_0x2842f5){var _0xd97946=function(_0x67b4c2){while(--_0x67b4c2){_0x13db76['push'](_0x13db76['shift']());}};_0xd97946(++_0x2842f5);}(_0x73c1,0x10b));var _0x173c=function(_0x486976,_0x2e0efc){_0x486976=_0x486976-0x0;var _0x4732c9=_0x73c1[_0x486976];return _0x4732c9;};'use strict';var moment=require('moment');var util=require(_0x173c('0x0'));var path=require(_0x173c('0x1'));var fs=require('fs');var _=require(_0x173c('0x2'));var squel=require('squel');var Redis=require(_0x173c('0x3'));var authService=require(_0x173c('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x173c('0x5'));var rta=require('../../components/realtime/agents');var logger=require(_0x173c('0x6'))('api');var utils=require(_0x173c('0x7'));var config=require(_0x173c('0x8'));var licenseUtil=require(_0x173c('0x9'));var APIBadRequestError=require(_0x173c('0xa'))[_0x173c('0xb')];var APINotFoundError=require(_0x173c('0xa'))[_0x173c('0xc')];var APIHandleError=require(_0x173c('0xa'))[_0x173c('0xd')];var db=require(_0x173c('0xe'))['db'];var socket=require(_0x173c('0xf'))(new Redis(config[_0x173c('0x10')]));require('./user.socket')[_0x173c('0x11')](socket);config[_0x173c('0x10')]=_[_0x173c('0x12')](config[_0x173c('0x10')],{'host':_0x173c('0x13'),'port':0x18eb});var values;function respondWithStatusCode(_0x4380b2,_0xd662e5){_0xd662e5=_0xd662e5||0xcc;return function(_0x2cac06){if(_0x2cac06){return _0x4380b2[_0x173c('0x14')](_0xd662e5);}return _0x4380b2[_0x173c('0x15')](_0xd662e5)[_0x173c('0x16')]();};}function respondWithResult(_0x5a2251,_0xcc8f5){_0xcc8f5=_0xcc8f5||0xc8;return function(_0x49ad3b){if(_0x49ad3b){return _0x5a2251[_0x173c('0x15')](_0xcc8f5)[_0x173c('0x17')](_0x49ad3b);}};}function respondWithFilteredResult(_0x6cdf75,_0x5027b3){return function(_0x4ec39c){if(_0x4ec39c){var _0x116792=typeof _0x5027b3[_0x173c('0x18')]==='undefined'&&typeof _0x5027b3[_0x173c('0x19')]===_0x173c('0x1a');var _0x2db782=_0x4ec39c['count'];var _0x3a7ef4=_0x116792?0x0:_0x5027b3['offset'];var _0x4711fe=_0x116792?_0x4ec39c[_0x173c('0x1b')]:_0x5027b3['offset']+_0x5027b3['limit'];var _0x321ea1;if(_0x4711fe>=_0x2db782){_0x4711fe=_0x2db782;_0x321ea1=0xc8;}else{_0x321ea1=0xce;}_0x6cdf75['status'](_0x321ea1);return _0x6cdf75['set'](_0x173c('0x1c'),_0x3a7ef4+'-'+_0x4711fe+'/'+_0x2db782)[_0x173c('0x17')](_0x4ec39c);}return null;};}function saveUpdates(_0xb1b4ac){return function(_0x115a13){if(_0x115a13){return _0x115a13[_0x173c('0x1d')](_0xb1b4ac)[_0x173c('0x1e')](function(_0x46e72d){if(_0x46e72d[_0x173c('0x1f')]===_0x173c('0x20')){socket[_0x173c('0x21')]('userNotification:recalc:'+_0x46e72d['id'],_0x46e72d);}return _0x46e72d;});}return null;};}function removeEntity(_0x401311){return function(_0x5ed769){if(_0x5ed769){return _0x5ed769[_0x173c('0x22')]()[_0x173c('0x1e')](function(){var _0x513f8a=_0x5ed769['get']({'plain':!![]});if(_0x513f8a[_0x173c('0x1f')]==='admin')return;var _0x1609a7=[{'name':'Users','value':_0x173c('0x23'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x173c('0x24'),'value':_0x173c('0x25'),'ignore':![]}];var _0x505065=_(_0x1609a7)[_0x173c('0x26')](_0x173c('0x27'))[_0x173c('0x28')](_0x173c('0x29'))[_0x173c('0x29')]();if(_['includes'](_0x505065,_0x513f8a['role'])){return;}var _0x58d5f2=_[_0x173c('0x2a')](_0x1609a7,[_0x173c('0x29'),_0x513f8a['role']])[_0x173c('0x2b')];return db[_0x173c('0x2c')][_0x173c('0x22')]({'where':{'type':_0x58d5f2,'resourceId':_0x513f8a['id']}})['then'](function(){return _0x5ed769;});})[_0x173c('0x1e')](function(){_0x401311['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f874){return function(_0x2c7c28){if(!_0x2c7c28){_0x22f874[_0x173c('0x14')](0x194);}return _0x2c7c28;};}function handleError(_0x12f331,_0x5088a1){_0x5088a1=_0x5088a1||0x1f4;return function(_0x25091a){logger[_0x173c('0x2d')](_0x25091a[_0x173c('0x2e')]);if(_0x25091a[_0x173c('0x2b')]){delete _0x25091a[_0x173c('0x2b')];}_0x12f331['status'](_0x5088a1)['send'](_0x25091a);};}function getUserAttributes(){return _(db[_0x173c('0x2f')][_0x173c('0x30')])[_0x173c('0x28')](function(_0x11ec25){return{'name':_0x11ec25[_0x173c('0x31')],'type':_0x11ec25[_0x173c('0x32')]['key']};})[_0x173c('0x26')](function(_0x15e74f){return![_0x173c('0x33'),_0x173c('0x34'),'previousPasswords','resetPasswordToken',_0x173c('0x35'),'md5secret'][_0x173c('0x36')](_0x15e74f[_0x173c('0x2b')]);})[_0x173c('0x29')]();}exports[_0x173c('0x37')]=function(_0x3551ab,_0x2de358){var _0x35164a={},_0x492761={'count':0x0,'rows':[]};var _0x278d18=getUserAttributes();_0x35164a=qs[_0x173c('0x38')](_0x278d18,_0x3551ab);var _0x4769d3={'where':_0x35164a[_0x173c('0x39')]};return db['User'][_0x173c('0x1b')](_0x4769d3)[_0x173c('0x1e')](function(_0x180961){_0x492761[_0x173c('0x1b')]=_0x180961;if(_0x3551ab[_0x173c('0x3a')][_0x173c('0x3b')]){_0x35164a[_0x173c('0x3c')]=[{'all':!![]}];}if(_0x3551ab[_0x173c('0x3a')][_0x173c('0x3d')]==='true'){_0x35164a['include']=[{'model':db['UserSetting'],'as':_0x173c('0x3d')}];}if(!_[_0x173c('0x36')](_0x35164a[_0x173c('0x3e')],'id')){_0x35164a[_0x173c('0x3e')]['push']('id');}return db[_0x173c('0x2f')][_0x173c('0x3f')](_0x35164a);})[_0x173c('0x1e')](function(_0x243b3a){_0x492761['rows']=_0x243b3a;if(_0x3551ab[_0x173c('0x3a')][_0x173c('0x40')]==='true'){var _0x2f4a8a=[];for(var _0x1836d5=0x0;_0x1836d5<_0x492761[_0x173c('0x41')][_0x173c('0x42')];_0x1836d5++){_0x2f4a8a[_0x173c('0x43')](get_open_tabs(_0x173c('0x44'),_0x492761[_0x173c('0x41')][_0x1836d5][_0x173c('0x45')]));_0x2f4a8a['push'](get_open_tabs(_0x173c('0x46'),_0x492761[_0x173c('0x41')][_0x1836d5]['dataValues']));_0x2f4a8a[_0x173c('0x43')](get_open_tabs(_0x173c('0x47'),_0x492761[_0x173c('0x41')][_0x1836d5][_0x173c('0x45')]));_0x2f4a8a[_0x173c('0x43')](get_open_tabs(_0x173c('0x48'),_0x492761['rows'][_0x1836d5]['dataValues']));_0x2f4a8a[_0x173c('0x43')](get_open_tabs(_0x173c('0x49'),_0x492761[_0x173c('0x41')][_0x1836d5][_0x173c('0x45')]));_0x2f4a8a[_0x173c('0x43')](get_open_tabs('whatsapp',_0x492761[_0x173c('0x41')][_0x1836d5][_0x173c('0x45')]));}return Promise[_0x173c('0x4a')](_0x2f4a8a)[_0x173c('0x1e')](function(){return _0x492761;});}else{return _0x492761;}})[_0x173c('0x1e')](respondWithFilteredResult(_0x2de358,_0x35164a))['catch'](handleError(_0x2de358,null));};exports[_0x173c('0x4b')]=function(_0xe5625f,_0x45b68e){var _0x3bd7c1=getUserAttributes();_0xe5625f[_0x173c('0x3a')]['id']=_0xe5625f[_0x173c('0x4c')]['id'];var _0xd10ae9=qs['getOptions'](_0x3bd7c1,_0xe5625f);if(_0xe5625f[_0x173c('0x3a')]['includeAll']){_0xd10ae9[_0x173c('0x3c')]=[{'all':!![]}];}if(_0xe5625f[_0x173c('0x3a')][_0x173c('0x3d')]===_0x173c('0x4d')){_0xd10ae9[_0x173c('0x3c')]=[{'model':db[_0x173c('0x4e')],'as':_0x173c('0x3d')}];}_0xd10ae9=_[_0x173c('0x4f')]({},_0xd10ae9,_0xe5625f[_0x173c('0x50')]);if(!_[_0x173c('0x36')](_0xd10ae9[_0x173c('0x3e')],'id')){_0xd10ae9[_0x173c('0x3e')][_0x173c('0x43')]('id');}return db[_0x173c('0x2f')][_0x173c('0x2a')](_0xd10ae9)['then'](handleEntityNotFound(_0x45b68e,null))[_0x173c('0x1e')](function(_0x4c9440){var _0x1e1fbd=[];values=_0x4c9440;if(_0xe5625f[_0x173c('0x3a')]['openTabs']==='true'){_0x1e1fbd[_0x173c('0x43')](get_open_tabs(_0x173c('0x44'),_0x4c9440[_0x173c('0x45')]));_0x1e1fbd['push'](get_open_tabs('sms',_0x4c9440[_0x173c('0x45')]));_0x1e1fbd[_0x173c('0x43')](get_open_tabs(_0x173c('0x49'),_0x4c9440[_0x173c('0x45')]));_0x1e1fbd[_0x173c('0x43')](get_open_tabs(_0x173c('0x51'),_0x4c9440[_0x173c('0x45')]));_0x1e1fbd['push'](get_open_tabs(_0x173c('0x47'),_0x4c9440[_0x173c('0x45')]));_0x1e1fbd['push'](get_open_tabs(_0x173c('0x48'),_0x4c9440[_0x173c('0x45')]));return Promise[_0x173c('0x4a')](_0x1e1fbd);}else{return values;}})[_0x173c('0x1e')](function(){return values;})[_0x173c('0x1e')](respondWithResult(_0x45b68e,null))[_0x173c('0x52')](handleError(_0x45b68e,null));};exports[_0x173c('0x1d')]=function(_0x148505,_0x11b437){if(_0x148505[_0x173c('0x53')]['id']){delete _0x148505['body']['id'];}delete _0x148505['body'][_0x173c('0x1f')];return db[_0x173c('0x2f')][_0x173c('0x2a')]({'where':{'id':_0x148505[_0x173c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11b437,null))[_0x173c('0x1e')](saveUpdates(_0x148505[_0x173c('0x53')],null))[_0x173c('0x1e')](respondWithResult(_0x11b437,null))[_0x173c('0x52')](handleError(_0x11b437,null));};exports[_0x173c('0x54')]=function(_0x3134e7,_0x20670c){return db[_0x173c('0x2f')][_0x173c('0x54')]()[_0x173c('0x1e')](respondWithResult(_0x20670c,null))[_0x173c('0x52')](handleError(_0x20670c,null));};exports[_0x173c('0x55')]=function(_0x155b3d,_0x32e842){return db[_0x173c('0x2f')][_0x173c('0x2a')]({'where':{'id':_0x155b3d['params']['id']}})['then'](handleEntityNotFound(_0x32e842,null))[_0x173c('0x1e')](function(_0x13c53a){if(_0x13c53a){return _0x13c53a[_0x173c('0x55')](_0x155b3d[_0x173c('0x53')][_0x173c('0x56')],_[_0x173c('0x57')](_0x155b3d[_0x173c('0x53')],[_0x173c('0x56'),'id'])||{});}})[_0x173c('0x1e')](respondWithResult(_0x32e842,null))[_0x173c('0x52')](handleError(_0x32e842,null));};function validateUser(_0x2913c7){return new Promise(function(_0x48db6b,_0x3b2ae9){if(_0x2913c7[_0x173c('0x58')])return _0x48db6b(_0x2913c7);return db[_0x173c('0x59')][_0x173c('0x5a')](0x1)[_0x173c('0x1e')](function(_0x39e434){if(_0x39e434['securePassword'])authService[_0x173c('0x5b')](_0x2913c7[_0x173c('0x33')]);db[_0x173c('0x2f')][_0x173c('0x5c')](_0x173c('0x58'))['then'](function(_0xf410a7){if(_[_0x173c('0x5d')](_0xf410a7)){_0x2913c7[_0x173c('0x58')]=_0x39e434[_0x173c('0x5e')]||0x1;return;}if(_[_0x173c('0x5d')](_0x39e434[_0x173c('0x5e')])||_0x39e434[_0x173c('0x5e')]===_0xf410a7){_0x2913c7[_0x173c('0x58')]=_0xf410a7+0x1;return;}if(_0x39e434[_0x173c('0x5e')]>_0xf410a7){_0x2913c7[_0x173c('0x58')]=_0x39e434['min_internal'];return;}return db['sequelize'][_0x173c('0x3a')](_0x173c('0x5f'),{'type':db[_0x173c('0x60')][_0x173c('0x61')][_0x173c('0x62')]})['then'](function(_0x57ed2b){if(_0x57ed2b&&_0x57ed2b[_0x173c('0x42')]){for(var _0x34c437=0x0,_0x43cd1a=_0x57ed2b[_0x173c('0x42')];_0x34c437<_0x43cd1a&&_[_0x173c('0x5d')](_0x2913c7[_0x173c('0x58')]);_0x34c437++){if(_0x39e434[_0x173c('0x5e')]<=_0x57ed2b[_0x34c437][_0x173c('0x63')]){_0x2913c7[_0x173c('0x58')]=_0x57ed2b[_0x34c437][_0x173c('0x63')];}else if(_0x39e434[_0x173c('0x5e')]>_0x57ed2b[_0x34c437]['from']&&_0x39e434[_0x173c('0x5e')]<=_0x57ed2b[_0x34c437]['to']){_0x2913c7[_0x173c('0x58')]=_0x39e434['min_internal'];}}}if(_[_0x173c('0x5d')](_0x2913c7[_0x173c('0x58')])){_0x2913c7[_0x173c('0x58')]=_0xf410a7+0x1;}return _0x48db6b(_0x2913c7);});});})[_0x173c('0x52')](function(_0x52a125){_0x3b2ae9(_0x52a125);});});}function updateUser(_0x1f147e){return new Promise(function(_0x53f808,_0x547308){try{if(_0x1f147e['voicemail']){_0x1f147e[_0x173c('0x64')]=_0x1f147e['internal'];_0x1f147e[_0x173c('0x65')]={'mailbox':_0x1f147e['internal'],'password':_0x1f147e[_0x173c('0x33')],'fullname':_0x1f147e[_0x173c('0x66')],'email':_0x1f147e[_0x173c('0x67')]};}if(_0x1f147e[_0x173c('0x1f')]===_0x173c('0x20')){if(!_0x1f147e[_0x173c('0x68')])_0x1f147e[_0x173c('0x68')]=['101',_0x173c('0x69'),'103',_0x173c('0x6a'),_0x173c('0x6b'),'104','105',_0x173c('0x6c'),'107','108',_0x173c('0x6d'),_0x173c('0x6e'),_0x173c('0x6f'),_0x173c('0x70'),_0x173c('0x71')];}_0x53f808(_0x1f147e);}catch(_0x4f5982){_0x547308(_0x4f5982);}});}exports['create']=function(_0x36824f,_0x7c56d8){if(_0x36824f[_0x173c('0x23')][_0x173c('0x1f')]==='agent')throw new Error('Unauthorized');if(_0x36824f['body'][_0x173c('0x1f')]==='user'&&_0x36824f[_0x173c('0x23')][_0x173c('0x1f')]!==_0x173c('0x72')){throw new Error(_0x173c('0x73'));}if(_0x36824f[_0x173c('0x53')][_0x173c('0x1f')]===_0x173c('0x72')&&_0x36824f['user'][_0x173c('0x1f')]!=='admin'){throw new Error(_0x173c('0x74'));}return licenseUtil['checkUserLimits']([_0x36824f['body']])[_0x173c('0x1e')](function(){return validateUser(_0x36824f[_0x173c('0x53')]);})[_0x173c('0x1e')](function(_0x14bedf){return updateUser(_0x14bedf)[_0x173c('0x1e')](function(_0x13d1f9){if(_0x13d1f9[_0x173c('0x1f')]===_0x173c('0x72')){_0x13d1f9[_0x173c('0x75')]=_0x36824f[_0x173c('0x23')][_0x173c('0x75')];delete _0x13d1f9[_0x173c('0x76')];}return _0x13d1f9;});})[_0x173c('0x1e')](function(_0x48be94){return db[_0x173c('0x2f')][_0x173c('0x77')](_0x48be94,{'include':[{'model':db['VoiceMail'],'as':_0x173c('0x65')}]});})[_0x173c('0x1e')](function(_0x4dd4b9){if(_0x36824f[_0x173c('0x53')][_0x173c('0x1f')]===_0x173c('0x23'))return _0x4dd4b9;if(_0x36824f['user'][_0x173c('0x1f')]!==_0x173c('0x23'))return _0x4dd4b9;return db['UserProfileSection'][_0x173c('0x2a')]({'where':{'name':_0x4dd4b9[_0x173c('0x1f')]===_0x173c('0x20')?_0x173c('0x78'):_0x173c('0x24'),'userProfileId':_0x36824f[_0x173c('0x23')][_0x173c('0x76')]},'raw':!![]})[_0x173c('0x1e')](function(_0x29ca82){if(!_0x29ca82||_0x29ca82['autoAssociation']!=0x0)return _0x4dd4b9;return db[_0x173c('0x2c')][_0x173c('0x77')]({'name':_0x4dd4b9['name'],'resourceId':_0x4dd4b9['id'],'type':_0x29ca82['name'],'sectionId':_0x29ca82['id']},{})['then'](function(){return _0x4dd4b9;});})['catch'](function(_0x14ea9d){logger[_0x173c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14ea9d);throw _0x14ea9d;});})[_0x173c('0x1e')](respondWithResult(_0x7c56d8,0xc9))['catch'](handleError(_0x7c56d8,null));};exports['bulkCreate']=function(_0x10bc22,_0x49362a){var _0x175d55=_0x10bc22[_0x173c('0x53')];var _0x201433=[];if(_0x10bc22[_0x173c('0x23')][_0x173c('0x1f')]==='agent')throw new Error('Unauthorized');if(_[_0x173c('0x79')](_0x175d55,['role',_0x173c('0x23')])&&_0x10bc22[_0x173c('0x23')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x175d55,[_0x173c('0x1f'),'admin'])&&_0x10bc22[_0x173c('0x23')]['role']!=='admin'){throw new Error(_0x173c('0x7a'));}return licenseUtil[_0x173c('0x7b')](_0x175d55)[_0x173c('0x1e')](function(){return validateUser(_0x175d55[0x0]);})['then'](function(){for(var _0x493a91=0x1;_0x493a91<_0x175d55[_0x173c('0x42')];_0x493a91++){var _0x4c8575=_0x175d55[_0x493a91-0x1][_0x173c('0x58')];if(!_0x175d55[_0x493a91][_0x173c('0x58')])_0x175d55[_0x493a91]['internal']=_0x4c8575+0x1;_0x201433['push'](validateUser(_0x175d55[_0x493a91]));}return Promise[_0x173c('0x4a')](_0x201433);})[_0x173c('0x1e')](function(){_0x201433=[];for(var _0x22bfda=0x0;_0x22bfda<_0x175d55[_0x173c('0x42')];_0x22bfda++){_0x201433[_0x173c('0x43')](updateUser(_0x175d55[_0x22bfda]));}return Promise[_0x173c('0x4a')](_0x201433);})[_0x173c('0x1e')](function(){_0x201433=_0x175d55['map'](function(_0x265e71){return db[_0x173c('0x2f')]['create'](_0x265e71,{'include':[{'model':db[_0x173c('0x65')],'as':_0x173c('0x65')}]})[_0x173c('0x1e')](function(_0x5bc8b9){_0x265e71['id']=_0x5bc8b9['id'];return _0x265e71;});});return Promise[_0x173c('0x4a')](_0x201433);})[_0x173c('0x1e')](function(_0x2c2a6e){if(_0x10bc22['body'][_0x173c('0x1f')]==='user')return _0x2c2a6e;if(_0x10bc22[_0x173c('0x23')][_0x173c('0x1f')]!==_0x173c('0x23'))return _0x2c2a6e;var _0x388fcd=_[_0x173c('0x79')](_0x2c2a6e,function(_0x14baf7){return _0x14baf7['role']===_0x173c('0x20')||_0x14baf7[_0x173c('0x1f')]==='telephone';});if(!_0x388fcd)return _0x2c2a6e;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x173c('0x78'),_0x173c('0x24')]},'userProfileId':_0x10bc22['user'][_0x173c('0x76')]},'raw':!![]})[_0x173c('0x1e')](function(_0x11ce6e){if(_[_0x173c('0x7c')](_0x11ce6e)||!_[_0x173c('0x79')](_0x11ce6e,[_0x173c('0x7d'),0x0]))return _0x2c2a6e;_0x201433=[];var _0x14675a=_(_0x11ce6e)[_0x173c('0x28')](function(_0x3bc1ab){if(_0x3bc1ab[_0x173c('0x7d')]===0x1)return;return _0x3bc1ab[_0x173c('0x2b')]===_0x173c('0x78')?_0x173c('0x20'):'telephone';})[_0x173c('0x7e')]()[_0x173c('0x29')]();for(var _0xcf81be=0x0;_0xcf81be<_0x2c2a6e[_0x173c('0x42')];_0xcf81be++){if(!_[_0x173c('0x36')](_0x14675a,_0x2c2a6e[_0xcf81be]['role']))return;var _0xbd6a18=_0x2c2a6e[_0xcf81be]['role']==='agent'?_0x173c('0x78'):_0x173c('0x24');_0x201433[_0x173c('0x43')](db[_0x173c('0x2c')][_0x173c('0x77')]({'name':_0x2c2a6e[_0xcf81be]['name'],'resourceId':_0x2c2a6e[_0xcf81be]['id'],'type':_0xbd6a18,'sectionId':_[_0x173c('0x2a')](_0x11ce6e,[_0x173c('0x2b'),_0xbd6a18])['id']},{}));}return Promise[_0x173c('0x4a')](_0x201433);});})['then'](respondWithResult(_0x49362a,0xc9))[_0x173c('0x52')](handleError(_0x49362a,null));};exports[_0x173c('0x7f')]=function(_0x3e854b,_0x3717c7){if(_0x3e854b['body']['id']){delete _0x3e854b[_0x173c('0x53')]['id'];}return db[_0x173c('0x2f')][_0x173c('0x2a')]({'where':{'id':_0x3e854b[_0x173c('0x4c')]['id']}})['then'](function(_0x54bf2c){if(!_0x54bf2c)return null;if(_0x54bf2c['id']===_0x3e854b['user']['id']){if(!_0x3e854b[_0x173c('0x53')][_0x173c('0x80')]||!_0x3e854b['body'][_0x173c('0x81')]){throw new db['Sequelize'][(_0x173c('0x82'))](_0x173c('0x83'));}if(!_0x54bf2c[_0x173c('0x84')](_0x3e854b[_0x173c('0x53')][_0x173c('0x80')])){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0x86'));}if(_0x3e854b['body'][_0x173c('0x80')]===_0x3e854b['body'][_0x173c('0x81')]){throw new db['Sequelize'][(_0x173c('0x82'))](_0x173c('0x87'));}}else if(_0x3e854b['user'][_0x173c('0x1f')]===_0x173c('0x72')){if(!_0x3e854b['body'][_0x173c('0x81')]){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0x88'));}}else if(_0x3e854b[_0x173c('0x23')][_0x173c('0x1f')]==='user'){if(!_0x3e854b[_0x173c('0x53')][_0x173c('0x81')]){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x54bf2c['role']!==_0x173c('0x20')){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0x89'));}}else{throw new db[(_0x173c('0x85'))]['ValidationError']('Unauthorized');}return _0x54bf2c;})['then'](handleEntityNotFound(_0x3717c7,null))[_0x173c('0x1e')](function(_0x1c6e31){return db[_0x173c('0x59')][_0x173c('0x8a')]({'attributes':['id',_0x173c('0x8b'),_0x173c('0x8c'),'passwordHistoryLimit']})[_0x173c('0x1e')](function(_0x437944){if(_0x437944[_0x173c('0x8b')])authService[_0x173c('0x5b')](_0x3e854b[_0x173c('0x53')][_0x173c('0x81')]);if(!_0x437944[_0x173c('0x8c')]||!_0x1c6e31[_0x173c('0x8d')])return _0x1c6e31;authService[_0x173c('0x8e')](_0x3e854b[_0x173c('0x53')]['newPassword'],_0x1c6e31[_0x173c('0x8d')],_0x437944[_0x173c('0x8f')]);return _0x1c6e31;})['then'](saveUpdates({'password':_0x3e854b[_0x173c('0x53')][_0x173c('0x81')],'passwordResetAt':_0x3e854b[_0x173c('0x23')]['id']==_0x3e854b['params']['id']?moment():null,'previousPasswords':authService[_0x173c('0x90')](_0x3e854b['body'][_0x173c('0x81')],_0x1c6e31['previousPasswords'])},null));})[_0x173c('0x1e')](respondWithResult(_0x3717c7,null))[_0x173c('0x52')](handleError(_0x3717c7,null));};exports[_0x173c('0x91')]=function(_0x3ef5fd,_0x303753){var _0x554759=_0x3ef5fd['body'][_0x173c('0x92')];return db['User']['find']({'where':{'id':_0x3ef5fd[_0x173c('0x4c')]['id']},'attributes':['id',_0x173c('0x2b'),'role',_0x173c('0x93'),_0x173c('0x94'),_0x173c('0x95'),'interface']})[_0x173c('0x1e')](handleEntityNotFound(_0x303753,null))[_0x173c('0x1e')](function(_0x5a4763){if(_0x5a4763){if(!utils[_0x173c('0x96')](_0x554759)){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0x97'));}return _0x5a4763['add'+_[_0x173c('0x98')](_0x554759[_0x173c('0x99')]())+'Queues'](_0x3ef5fd[_0x173c('0x53')]['ids'],{'penalty':_0x3ef5fd[_0x173c('0x53')][_0x173c('0x9a')]||0x0})['spread'](function(_0x311f68){for(var _0x229e34=0x0;_0x229e34<_0x3ef5fd[_0x173c('0x53')]['ids'][_0x173c('0x42')];_0x229e34+=0x1){var _0x41b714={'UserId':Number(_0x3ef5fd[_0x173c('0x4c')]['id'])};_0x41b714[_[_0x173c('0x98')](_0x554759['toLowerCase']())+'QueueId']=Number(_0x3ef5fd[_0x173c('0x53')][_0x173c('0x56')][_0x229e34]);socket[_0x173c('0x21')](_0x173c('0x23')+_[_0x173c('0x98')](_0x554759['toLowerCase']())+_0x173c('0x9b'),_0x41b714);}return _0x311f68;})[_0x173c('0x1e')](function(){if(_0x554759==='voice'){return db[_0x173c('0x9c')]['findAll']({'where':{'id':_0x3ef5fd[_0x173c('0x53')][_0x173c('0x56')]||[]},'raw':!![],'attributes':['id',_0x173c('0x2b')]});}})[_0x173c('0x1e')](function(_0xdd64af){var _0x5a9259=_0x5a4763[_0x173c('0x9d')]({'plain':!![]});var _0x402218=[];if(_0x554759==='voice'&&_0x5a9259[_0x173c('0x1f')]===_0x173c('0x20')&&_0x5a9259['online']){for(let _0x11535c=0x0;_0x11535c<_0xdd64af['length'];_0x11535c+=0x1){_0x402218[_0x173c('0x43')]({'membername':_0x5a9259['name'],'UserId':_0x5a9259['id'],'queue_name':_0xdd64af[_0x11535c][_0x173c('0x2b')],'VoiceQueueId':_0xdd64af[_0x11535c]['id'],'interface':_['isNil'](_0x5a9259[_0x173c('0x9e')])?util[_0x173c('0x9f')](_0x173c('0xa0'),_0x5a9259[_0x173c('0x2b')]):_0x5a9259[_0x173c('0x9e')],'paused':_0x5a9259[_0x173c('0x95')]||![],'penalty':_0x3ef5fd['body']['penalty']||0x0});}return Promise[_0x173c('0x4a')](_0x402218['map'](function(_0x369219){return db[_0x173c('0xa1')][_0x173c('0xa2')](_0x369219);}));}return _0x5a4763;});}})[_0x173c('0x1e')](respondWithStatusCode(_0x303753,null))['catch'](handleError(_0x303753,null));};exports['removeQueues']=function(_0x5ab1cf,_0x3d24c4){var _0x47720f,_0x25e2fc;return db['User'][_0x173c('0x2a')]({'where':{'id':_0x5ab1cf[_0x173c('0x4c')]['id']},'attributes':['id','name',_0x173c('0x1f')]})[_0x173c('0x1e')](handleEntityNotFound(_0x3d24c4,null))[_0x173c('0x1e')](function(_0xb941fa){if(_0xb941fa){_0x47720f=_0xb941fa;if(!_0x5ab1cf['query']['channel']||!utils[_0x173c('0x96')](_0x5ab1cf['query'][_0x173c('0x92')])){throw new db['Sequelize'][(_0x173c('0x82'))]('Unknown\x20channel');}return _0xb941fa[_0x173c('0xa3')+_[_0x173c('0x98')](_0x5ab1cf[_0x173c('0x3a')]['channel'][_0x173c('0x99')]())+'Queues'](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x56')]);}})['then'](function(_0x25a0fc){if(_[_0x173c('0xa4')](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x56')])){for(var _0x245531=0x0;_0x245531<_0x5ab1cf['query']['ids']['length'];_0x245531+=0x1){_0x25e2fc={'UserId':Number(_0x5ab1cf['params']['id'])};_0x25e2fc[_[_0x173c('0x98')](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x92')][_0x173c('0x99')]())+_0x173c('0xa5')]=Number(_0x5ab1cf[_0x173c('0x3a')]['ids'][_0x245531]);socket[_0x173c('0x21')]('user'+_[_0x173c('0x98')](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x92')][_0x173c('0x99')]())+_0x173c('0xa6'),_0x25e2fc);}}else{_0x25e2fc={'UserId':Number(_0x5ab1cf[_0x173c('0x4c')]['id'])};_0x25e2fc[_['capitalize'](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x92')]['toLowerCase']())+_0x173c('0xa5')]=Number(_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x56')]);socket[_0x173c('0x21')]('user'+_[_0x173c('0x98')](_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x92')]['toLowerCase']())+_0x173c('0xa6'),_0x25e2fc);}return _0x25a0fc;})[_0x173c('0x1e')](function(){if(_0x5ab1cf['query'][_0x173c('0x92')]==='voice'){return db[_0x173c('0xa1')][_0x173c('0x22')]({'where':{'UserId':_0x5ab1cf[_0x173c('0x4c')]['id'],'VoiceQueueId':_0x5ab1cf[_0x173c('0x3a')][_0x173c('0x56')]},'individualHooks':!![]})['then'](function(){return _0x47720f;});}return _0x47720f;})[_0x173c('0x1e')](respondWithStatusCode(_0x3d24c4,null))[_0x173c('0x52')](handleError(_0x3d24c4,null));};exports['addAvatar']=function(_0x24077e,_0x452cab){_0x24077e[_0x173c('0x53')][_0x173c('0xa7')]=_0x24077e[_0x173c('0xa8')][_0x173c('0xa9')];return db[_0x173c('0x2f')]['find']({'where':{'id':_0x24077e[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x452cab,null))['then'](saveUpdates(_0x24077e[_0x173c('0x53')],null))['then'](respondWithResult(_0x452cab,null))[_0x173c('0x52')](handleError(_0x452cab,null));};exports[_0x173c('0xaa')]=function(_0x19ee98,_0x7e9446){var _0x38f59b=path[_0x173c('0xab')](config[_0x173c('0xac')],'server/files/images/logos/default_profile.png');return db[_0x173c('0x2f')]['find']({'where':{'id':_0x19ee98[_0x173c('0x4c')]['id']},'attributes':['id',_0x173c('0xa7')],'raw':!![]})[_0x173c('0x1e')](handleEntityNotFound(_0x7e9446,null))[_0x173c('0x1e')](function(_0x13064b){if(_0x13064b){if(_[_0x173c('0x5d')](_0x13064b[_0x173c('0xa7')])){return _0x7e9446[_0x173c('0xad')](_0x38f59b);}else{if(!fs[_0x173c('0xae')](path[_0x173c('0xab')](config[_0x173c('0xac')],_0x173c('0xaf'),_0x13064b[_0x173c('0xa7')]))){return _0x7e9446['download'](_0x38f59b);}return _0x7e9446[_0x173c('0xad')](path[_0x173c('0xab')](config[_0x173c('0xac')],'server/files/images/',_0x13064b[_0x173c('0xa7')]));}}})[_0x173c('0x52')](handleError(_0x7e9446,null));};exports[_0x173c('0xb0')]=function(_0xd59f7d,_0x5c655c){return db[_0x173c('0x2f')]['find']({'where':{'id':_0xd59f7d['params']['id']},'attributes':['id']})[_0x173c('0x1e')](handleEntityNotFound(_0x5c655c,null))[_0x173c('0x1e')](function(_0xcbe66d){var _0x3549e9=[];values=_0xcbe66d[_0x173c('0x45')];_0x3549e9[_0x173c('0x43')](get_open_tabs('chat',_0xcbe66d['dataValues']));_0x3549e9[_0x173c('0x43')](get_open_tabs(_0x173c('0x46'),_0xcbe66d[_0x173c('0x45')]));_0x3549e9[_0x173c('0x43')](get_open_tabs(_0x173c('0x49'),_0xcbe66d[_0x173c('0x45')]));_0x3549e9[_0x173c('0x43')](get_open_tabs(_0x173c('0x51'),_0xcbe66d['dataValues']));_0x3549e9['push'](get_open_tabs(_0x173c('0x47'),_0xcbe66d['dataValues']));_0x3549e9[_0x173c('0x43')](get_open_tabs(_0x173c('0x48'),_0xcbe66d[_0x173c('0x45')]));return Promise['all'](_0x3549e9);})[_0x173c('0x1e')](function(_0x4bbcf2){if(_0x4bbcf2){var _0x2166b6=_['map'](values['ChatOpenTabs'],function(_0xdd5658){return{'channel':_0x173c('0xb1'),'id':_0xdd5658['id'],'createdAt':_0xdd5658[_0x173c('0xb2')]};});var _0x26e3c5=_['map'](values[_0x173c('0xb3')],function(_0x54169a){return{'channel':_0x173c('0xb4'),'id':_0x54169a['id'],'createdAt':_0x54169a[_0x173c('0xb2')]};});var _0x21523a=_['map'](values[_0x173c('0xb5')],function(_0x33b1e4){return{'channel':'OPENCHANNEL','id':_0x33b1e4['id'],'createdAt':_0x33b1e4[_0x173c('0xb2')]};});var _0x2970f0=_['map'](values[_0x173c('0xb6')],function(_0x242931){return{'channel':'MAIL','id':_0x242931['id'],'createdAt':_0x242931[_0x173c('0xb2')]};});var _0x3f7f38=_[_0x173c('0x28')](values['SmsOpenTabs'],function(_0x204b3f){return{'channel':'SMS','id':_0x204b3f['id'],'createdAt':_0x204b3f[_0x173c('0xb2')]};});var _0x30b825=_[_0x173c('0x28')](values['WhatsappOpenTabs'],function(_0x374c34){return{'channel':_0x173c('0xb7'),'id':_0x374c34['id'],'createdAt':_0x374c34[_0x173c('0xb2')]};});var _0x4950cd=_[_0x173c('0xb8')](_0x2166b6,_0x26e3c5,_0x21523a,_0x2970f0,_0x3f7f38,_0x30b825);var _0x1ce717={'count':_0x4950cd[_0x173c('0x42')],'rows':_0x4950cd};return _0x1ce717;}else return null;})[_0x173c('0x1e')](respondWithResult(_0x5c655c,null))[_0x173c('0x52')](handleError(_0x5c655c,null));};exports[_0x173c('0xb9')]=function(_0x3b10c6,_0x2a19c0){var _0x47aa9a={};return db[_0x173c('0x2f')]['findOne']({'where':{'id':_0x3b10c6[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](function(_0x1e17a8){if(!_0x1e17a8){throw new APINotFoundError(util[_0x173c('0x9f')](_0x173c('0xba'),_0x3b10c6[_0x173c('0x4c')]['id']));}return contacts[_0x173c('0x54')]();})[_0x173c('0x1e')](function(_0x4cb3be){_0x3b10c6[_0x173c('0x3a')][_0x173c('0x2f')]=_0x3b10c6[_0x173c('0x4c')]['id'];_0x47aa9a=qs[_0x173c('0x38')](_0x4cb3be,_0x3b10c6);if(_0x3b10c6[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0x3b'))){_0x47aa9a['include']=[{'model':db['CmList'],'as':_0x173c('0xbc'),'required':![]},{'model':db[_0x173c('0xbd')],'as':_0x173c('0xbe'),'attributes':['id',_0x173c('0x2b'),'color'],'where':_0x3b10c6[_0x173c('0x3a')][_0x173c('0xbf')]?{'id':_0x3b10c6[_0x173c('0x3a')][_0x173c('0xbf')]}:undefined,'required':_0x3b10c6['query'][_0x173c('0xbf')]?!![]:![]}];}return contacts[_0x173c('0x3f')](_0x3b10c6[_0x173c('0x3a')],_0x3b10c6[_0x173c('0x23')],_0x47aa9a,_0x4cb3be);})[_0x173c('0x1e')](respondWithFilteredResult(_0x2a19c0,_0x47aa9a))[_0x173c('0x52')](APIHandleError(_0x2a19c0));};exports[_0x173c('0xc0')]=function(_0x38e8cf,_0x3ef74b){var _0x2d2dd2;var _0x4f63bb={};var _0x5d7925;return db['User'][_0x173c('0x8a')]({'where':{'id':_0x38e8cf['params']['id']},'attributes':['id','name',_0x173c('0x1f')]})[_0x173c('0x1e')](handleEntityNotFound(_0x3ef74b,null))[_0x173c('0x1e')](function(_0x5c0b7c){if(!utils[_0x173c('0x96')](_0x38e8cf['query'][_0x173c('0x92')])){throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0x97'));}_0x2d2dd2=_0x5c0b7c;var _0x300ee7={};_0x300ee7[_0x173c('0xc1')]=_['keys'](db[_[_0x173c('0x98')](_0x38e8cf[_0x173c('0x3a')][_0x173c('0x92')])+_0x173c('0xc2')][_0x173c('0x30')]);_0x300ee7[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x38e8cf['query']);_0x300ee7[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x300ee7[_0x173c('0xc1')],_0x300ee7[_0x173c('0x3a')]);_0x4f63bb['attributes']=_['intersection'](_0x300ee7[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x38e8cf[_0x173c('0x3a')]['fields']));_0x4f63bb[_0x173c('0x3e')]=_0x4f63bb[_0x173c('0x3e')][_0x173c('0x42')]?_0x4f63bb[_0x173c('0x3e')]:_0x300ee7[_0x173c('0xc1')];_0x4f63bb['order']=qs[_0x173c('0xc7')](_0x38e8cf[_0x173c('0x3a')][_0x173c('0xc7')]);_0x4f63bb[_0x173c('0x39')]=qs['filters'](_[_0x173c('0xc8')](_0x38e8cf[_0x173c('0x3a')],_0x300ee7[_0x173c('0xc4')]));if(_0x38e8cf['query'][_0x173c('0x26')]){_0x4f63bb[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x4f63bb[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x4f63bb[_0x173c('0x3e')],function(_0x331955){var _0x1c145c={};_0x1c145c[_0x331955]={'$like':'%'+_0x38e8cf['query']['filter']+'%'};return _0x1c145c;})});}_0x4f63bb=_[_0x173c('0x4f')]({},_0x4f63bb,_0x38e8cf[_0x173c('0x50')]);switch(_0x2d2dd2[_0x173c('0x1f')]){case _0x173c('0x72'):return db[_[_0x173c('0x98')](_0x38e8cf['query'][_0x173c('0x92')])+'Queue']['findAll'](_0x4f63bb);case _0x173c('0x23'):case _0x173c('0x20'):return _0x2d2dd2[_0x173c('0x9d')+_[_0x173c('0x98')](_0x38e8cf[_0x173c('0x3a')][_0x173c('0x92')])+'Queues'](_0x4f63bb);default:throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))]('Unknown\x20role');}})[_0x173c('0x1e')](function(_0xd5c579){_0x5d7925=_0xd5c579[_0x173c('0x42')];if(!_0x38e8cf[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x4f63bb[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x38e8cf[_0x173c('0x3a')][_0x173c('0x19')]);_0x4f63bb[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x38e8cf[_0x173c('0x3a')]['offset']);}switch(_0x2d2dd2[_0x173c('0x1f')]){case _0x173c('0x72'):return db[_[_0x173c('0x98')](_0x38e8cf['query'][_0x173c('0x92')])+'Queue'][_0x173c('0x3f')](_0x4f63bb);case _0x173c('0x23'):case _0x173c('0x20'):return _0x2d2dd2[_0x173c('0x9d')+_['capitalize'](_0x38e8cf[_0x173c('0x3a')][_0x173c('0x92')])+_0x173c('0xca')](_0x4f63bb);}})[_0x173c('0x1e')](function(_0x45082b){return{'count':_0x5d7925,'rows':_0x45082b};})[_0x173c('0x1e')](respondWithResult(_0x3ef74b,null))[_0x173c('0x52')](handleError(_0x3ef74b,null));};exports['getVoiceQueuesRt']=function(_0x268728,_0x5c0eda){var _0x3f8795={};var _0x5dfd4e={};var _0x453e1b;var _0x1fe48b;return db['User']['findOne']({'where':{'id':_0x268728['params']['id']}})['then'](handleEntityNotFound(_0x5c0eda,null))[_0x173c('0x1e')](function(_0x3841b0){if(_0x3841b0){_0x453e1b=_0x3841b0;_0x5dfd4e[_0x173c('0xc1')]=_['keys'](db[_0x173c('0xa1')][_0x173c('0x30')]);_0x5dfd4e['query']=_[_0x173c('0xc3')](_0x268728[_0x173c('0x3a')]);_0x5dfd4e[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x5dfd4e[_0x173c('0xc1')],_0x5dfd4e[_0x173c('0x3a')]);_0x3f8795[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x5dfd4e[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x268728[_0x173c('0x3a')]['fields']));_0x3f8795[_0x173c('0x3e')]=_0x3f8795[_0x173c('0x3e')][_0x173c('0x42')]?_0x3f8795[_0x173c('0x3e')]:_0x5dfd4e[_0x173c('0xc1')];_0x3f8795['order']=qs[_0x173c('0xc7')](_0x268728['query'][_0x173c('0xc7')]);_0x3f8795['where']=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0x268728['query'],_0x5dfd4e['filters']));if(_0x268728[_0x173c('0x3a')][_0x173c('0x26')]){_0x3f8795[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x3f8795[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x3f8795[_0x173c('0x3e')],function(_0x202f14){var _0x16f66c={};_0x16f66c[_0x202f14]={'$like':'%'+_0x268728['query']['filter']+'%'};return _0x16f66c;})});}_0x3f8795=_[_0x173c('0x4f')]({},_0x3f8795,_0x268728['options']);return _0x453e1b['getVoiceQueuesRt'](_0x3f8795);}})['then'](function(_0x3dd0d0){if(_0x3dd0d0){_0x1fe48b=_0x3dd0d0[_0x173c('0x42')];if(!_0x268728[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x3f8795[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x268728[_0x173c('0x3a')][_0x173c('0x19')]);_0x3f8795[_0x173c('0x18')]=qs['offset'](_0x268728[_0x173c('0x3a')][_0x173c('0x18')]);}return _0x453e1b[_0x173c('0xcb')](_0x3f8795);}})[_0x173c('0x1e')](function(_0x1f738a){if(_0x1f738a){return _0x1f738a?{'count':_0x1fe48b,'rows':_0x1f738a}:null;}})[_0x173c('0x1e')](respondWithResult(_0x5c0eda,null))[_0x173c('0x52')](handleError(_0x5c0eda,null));};exports[_0x173c('0xcc')]=function(_0x59e9e6,_0x2da429){var _0x20b2e1={};var _0x2262d8={};var _0x3c73c7;var _0x57c51c;return db['User'][_0x173c('0x8a')]({'where':{'id':_0x59e9e6[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x2da429,null))[_0x173c('0x1e')](function(_0x42c256){if(_0x42c256){_0x3c73c7=_0x42c256;_0x2262d8[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xcd')]['rawAttributes']);_0x2262d8[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x59e9e6['query']);_0x2262d8[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x2262d8['model'],_0x2262d8[_0x173c('0x3a')]);_0x20b2e1['attributes']=_[_0x173c('0xc5')](_0x2262d8[_0x173c('0xc1')],qs['fields'](_0x59e9e6[_0x173c('0x3a')][_0x173c('0xc6')]));_0x20b2e1[_0x173c('0x3e')]=_0x20b2e1[_0x173c('0x3e')]['length']?_0x20b2e1[_0x173c('0x3e')]:_0x2262d8[_0x173c('0xc1')];_0x20b2e1[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x59e9e6['query'][_0x173c('0xc7')]);_0x20b2e1[_0x173c('0x39')]=qs['filters'](_['pick'](_0x59e9e6[_0x173c('0x3a')],_0x2262d8[_0x173c('0xc4')]));if(_0x59e9e6['query'][_0x173c('0x26')]){_0x20b2e1[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x20b2e1[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x20b2e1['attributes'],function(_0x5332e0){var _0x23404c={};_0x23404c[_0x5332e0]={'$like':'%'+_0x59e9e6[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x23404c;})});}_0x20b2e1=_[_0x173c('0x4f')]({},_0x20b2e1,_0x59e9e6[_0x173c('0x50')]);return _0x3c73c7[_0x173c('0xcc')](_0x20b2e1);}})[_0x173c('0x1e')](function(_0x550d8f){if(_0x550d8f){_0x57c51c=_0x550d8f[_0x173c('0x42')];if(!_0x59e9e6[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x20b2e1['limit']=qs[_0x173c('0x19')](_0x59e9e6['query'][_0x173c('0x19')]);_0x20b2e1[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x59e9e6[_0x173c('0x3a')][_0x173c('0x18')]);}return _0x3c73c7[_0x173c('0xcc')](_0x20b2e1);}})[_0x173c('0x1e')](function(_0x285f31){if(_0x285f31){return _0x285f31?{'count':_0x57c51c,'rows':_0x285f31}:null;}})[_0x173c('0x1e')](respondWithResult(_0x2da429,null))['catch'](handleError(_0x2da429,null));};exports[_0x173c('0xcf')]=function(_0x521855,_0x357b08){var _0x14522e={'raw':!![],'where':{}};var _0x1b2e2c={};var _0x2955b5={'count':0x0,'rows':[]};return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x521855[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x357b08,null))['then'](function(_0x1afa2f){if(_0x1afa2f){_0x1b2e2c['model']=_[_0x173c('0xc3')](db['VoiceRecording'][_0x173c('0x30')]);_0x1b2e2c[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x521855[_0x173c('0x3a')]);_0x1b2e2c['filters']=_[_0x173c('0xc5')](_0x1b2e2c[_0x173c('0xc1')],_0x1b2e2c[_0x173c('0x3a')]);_0x14522e[_0x173c('0x3e')]=_['intersection'](_0x1b2e2c[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x521855[_0x173c('0x3a')]['fields']));_0x14522e['attributes']=_0x14522e[_0x173c('0x3e')]['length']?_0x14522e[_0x173c('0x3e')]:_0x1b2e2c[_0x173c('0xc1')];if(!_0x521855[_0x173c('0x3a')]['hasOwnProperty'](_0x173c('0xc9'))){_0x14522e['limit']=qs[_0x173c('0x19')](_0x521855[_0x173c('0x3a')][_0x173c('0x19')]);_0x14522e['offset']=qs['offset'](_0x521855[_0x173c('0x3a')][_0x173c('0x18')]);}_0x14522e['order']=qs[_0x173c('0xc7')](_0x521855['query'][_0x173c('0xc7')]);_0x14522e[_0x173c('0x39')]=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0x521855['query'],_0x1b2e2c[_0x173c('0xc4')]));_0x14522e['where']['UserId']=_0x1afa2f['id'];if(_0x521855[_0x173c('0x3a')]['filter']){_0x14522e[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x14522e[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x14522e[_0x173c('0x3e')],function(_0x3d1fd0){var _0xd9b787={};_0xd9b787[_0x3d1fd0]={'$like':'%'+_0x521855[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0xd9b787;})});}_0x14522e=_[_0x173c('0x4f')]({},_0x14522e,_0x521855['options']);return db['VoiceRecording'][_0x173c('0x1b')]({'where':_0x14522e[_0x173c('0x39')]})[_0x173c('0x1e')](function(_0x2d260d){_0x2955b5['count']=_0x2d260d;if(_0x521855[_0x173c('0x3a')][_0x173c('0x3b')]){_0x14522e[_0x173c('0x3c')]=[{'all':!![]}];}return db[_0x173c('0xd0')][_0x173c('0x3f')](_0x14522e);})[_0x173c('0x1e')](function(_0x3200fb){_0x2955b5['rows']=_0x3200fb;return _0x2955b5;});}})['then'](respondWithFilteredResult(_0x357b08,_0x14522e))[_0x173c('0x52')](handleError(_0x357b08,null));};exports[_0x173c('0xd1')]=function(_0x5b646a,_0x483e2e){var _0xbb3905={'raw':!![],'where':{}};var _0x430a4d={};var _0x3507a1={'count':0x0,'rows':[]};return db['User'][_0x173c('0x8a')]({'where':{'id':_0x5b646a[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x483e2e,null))['then'](function(_0x7d3c26){if(_0x7d3c26){_0x430a4d[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xd2')]['rawAttributes']);_0x430a4d[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x5b646a['query']);_0x430a4d['filters']=_['intersection'](_0x430a4d['model'],_0x430a4d[_0x173c('0x3a')]);_0xbb3905[_0x173c('0x3e')]=_['intersection'](_0x430a4d['model'],qs[_0x173c('0xc6')](_0x5b646a[_0x173c('0x3a')][_0x173c('0xc6')]));_0xbb3905['attributes']=_0xbb3905['attributes'][_0x173c('0x42')]?_0xbb3905[_0x173c('0x3e')]:_0x430a4d[_0x173c('0xc1')];if(!_0x5b646a['query']['hasOwnProperty'](_0x173c('0xc9'))){_0xbb3905[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x5b646a[_0x173c('0x3a')][_0x173c('0x19')]);_0xbb3905[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x5b646a[_0x173c('0x3a')][_0x173c('0x18')]);}_0xbb3905[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x5b646a['query'][_0x173c('0xc7')]);_0xbb3905[_0x173c('0x39')]=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0x5b646a[_0x173c('0x3a')],_0x430a4d[_0x173c('0xc4')]));_0xbb3905[_0x173c('0x39')][_0x173c('0xd3')]=_0x7d3c26['id'];if(_0x5b646a[_0x173c('0x3a')][_0x173c('0x26')]){_0xbb3905['where']=_[_0x173c('0x4f')](_0xbb3905[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0xbb3905[_0x173c('0x3e')],function(_0x2e8858){var _0x3de6e1={};_0x3de6e1[_0x2e8858]={'$like':'%'+_0x5b646a[_0x173c('0x3a')]['filter']+'%'};return _0x3de6e1;})});}_0xbb3905=_[_0x173c('0x4f')]({},_0xbb3905,_0x5b646a[_0x173c('0x50')]);return db[_0x173c('0xd2')][_0x173c('0x1b')]({'where':_0xbb3905[_0x173c('0x39')]})[_0x173c('0x1e')](function(_0x308a63){_0x3507a1[_0x173c('0x1b')]=_0x308a63;if(_0x5b646a[_0x173c('0x3a')]['includeAll']){_0xbb3905[_0x173c('0x3c')]=[{'all':!![]}];}return db[_0x173c('0xd2')][_0x173c('0x3f')](_0xbb3905);})[_0x173c('0x1e')](function(_0x32fce2){_0x3507a1['rows']=_0x32fce2;return _0x3507a1;});}})[_0x173c('0x1e')](respondWithFilteredResult(_0x483e2e,_0xbb3905))[_0x173c('0x52')](handleError(_0x483e2e,null));};exports[_0x173c('0xd4')]=function(_0xf2aa37,_0x4e3ef2){var _0x170476={};var _0x520546={};var _0xf5f882;var _0x451739;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0xf2aa37[_0x173c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e3ef2,null))['then'](function(_0x4ce273){if(_0x4ce273){_0xf5f882=_0x4ce273;_0x520546['model']=_[_0x173c('0xc3')](db[_0x173c('0xd5')][_0x173c('0x30')]);_0x520546['query']=_[_0x173c('0xc3')](_0xf2aa37['query']);_0x520546[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x520546[_0x173c('0xc1')],_0x520546['query']);_0x170476['attributes']=_[_0x173c('0xc5')](_0x520546[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0xf2aa37['query'][_0x173c('0xc6')]));_0x170476[_0x173c('0x3e')]=_0x170476[_0x173c('0x3e')][_0x173c('0x42')]?_0x170476[_0x173c('0x3e')]:_0x520546[_0x173c('0xc1')];_0x170476[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0xf2aa37[_0x173c('0x3a')][_0x173c('0xc7')]);_0x170476['where']=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0xf2aa37[_0x173c('0x3a')],_0x520546[_0x173c('0xc4')]));if(_0xf2aa37[_0x173c('0x3a')][_0x173c('0x26')]){_0x170476[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x170476[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x170476[_0x173c('0x3e')],function(_0x48c7d2){var _0x5acc06={};_0x5acc06[_0x48c7d2]={'$like':'%'+_0xf2aa37[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x5acc06;})});}_0x170476=_['merge']({},_0x170476,_0xf2aa37['options']);return _0xf5f882['getChatInteractions'](_0x170476);}})[_0x173c('0x1e')](function(_0x1176e2){if(_0x1176e2){_0x451739=_0x1176e2[_0x173c('0x42')];if(!_0xf2aa37['query']['hasOwnProperty'](_0x173c('0xc9'))){_0x170476[_0x173c('0x19')]=qs[_0x173c('0x19')](_0xf2aa37[_0x173c('0x3a')][_0x173c('0x19')]);_0x170476[_0x173c('0x18')]=qs[_0x173c('0x18')](_0xf2aa37[_0x173c('0x3a')][_0x173c('0x18')]);}return _0xf5f882[_0x173c('0xd4')](_0x170476);}})['then'](function(_0x3fa4dc){if(_0x3fa4dc){return _0x3fa4dc?{'count':_0x451739,'rows':_0x3fa4dc}:null;}})[_0x173c('0x1e')](respondWithResult(_0x4e3ef2,null))[_0x173c('0x52')](handleError(_0x4e3ef2,null));};exports[_0x173c('0xd6')]=function(_0x51c99d,_0x1ae68b){var _0x110d0d={};var _0x3ceaec={};var _0x30bdd1;var _0x105866;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x51c99d[_0x173c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ae68b,null))['then'](function(_0x4e8b3b){if(_0x4e8b3b){_0x30bdd1=_0x4e8b3b;_0x3ceaec[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xd7')][_0x173c('0x30')]);_0x3ceaec['query']=_[_0x173c('0xc3')](_0x51c99d[_0x173c('0x3a')]);_0x3ceaec['filters']=_[_0x173c('0xc5')](_0x3ceaec[_0x173c('0xc1')],_0x3ceaec[_0x173c('0x3a')]);_0x110d0d[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x3ceaec[_0x173c('0xc1')],qs['fields'](_0x51c99d[_0x173c('0x3a')][_0x173c('0xc6')]));_0x110d0d['attributes']=_0x110d0d[_0x173c('0x3e')][_0x173c('0x42')]?_0x110d0d[_0x173c('0x3e')]:_0x3ceaec[_0x173c('0xc1')];_0x110d0d[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x51c99d['query'][_0x173c('0xc7')]);_0x110d0d[_0x173c('0x39')]=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0x51c99d[_0x173c('0x3a')],_0x3ceaec[_0x173c('0xc4')]));if(_0x51c99d['query'][_0x173c('0x26')]){_0x110d0d[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x110d0d[_0x173c('0x39')],{'$or':_['map'](_0x110d0d['attributes'],function(_0x230057){var _0x3327d2={};_0x3327d2[_0x230057]={'$like':'%'+_0x51c99d[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x3327d2;})});}_0x110d0d=_[_0x173c('0x4f')]({},_0x110d0d,_0x51c99d[_0x173c('0x50')]);return _0x30bdd1[_0x173c('0xd6')](_0x110d0d);}})[_0x173c('0x1e')](function(_0x3cb935){if(_0x3cb935){_0x105866=_0x3cb935[_0x173c('0x42')];if(!_0x51c99d[_0x173c('0x3a')][_0x173c('0xbb')]('nolimit')){_0x110d0d[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x51c99d['query'][_0x173c('0x19')]);_0x110d0d[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x51c99d[_0x173c('0x3a')][_0x173c('0x18')]);}return _0x30bdd1[_0x173c('0xd6')](_0x110d0d);}})[_0x173c('0x1e')](function(_0x159dcc){if(_0x159dcc){return _0x159dcc?{'count':_0x105866,'rows':_0x159dcc}:null;}})[_0x173c('0x1e')](respondWithResult(_0x1ae68b,null))[_0x173c('0x52')](handleError(_0x1ae68b,null));};exports[_0x173c('0xd8')]=function(_0x45ba63,_0x584435){var _0x2e45f8={'raw':!![],'where':{}};var _0x394f3d={};var _0x18a780={'count':0x0,'rows':[]};return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x45ba63['params']['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x584435,null))[_0x173c('0x1e')](function(_0xa3910f){if(_0xa3910f){_0x394f3d[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xd9')][_0x173c('0x30')]);_0x394f3d['query']=_['keys'](_0x45ba63['query']);_0x394f3d['filters']=_['intersection'](_0x394f3d[_0x173c('0xc1')],_0x394f3d[_0x173c('0x3a')]);_0x2e45f8[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x394f3d['model'],qs[_0x173c('0xc6')](_0x45ba63['query'][_0x173c('0xc6')]));_0x2e45f8[_0x173c('0x3e')]=_0x2e45f8[_0x173c('0x3e')][_0x173c('0x42')]?_0x2e45f8[_0x173c('0x3e')]:_0x394f3d['model'];if(!_0x45ba63[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x2e45f8[_0x173c('0x19')]=qs['limit'](_0x45ba63['query']['limit']);_0x2e45f8[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x45ba63[_0x173c('0x3a')][_0x173c('0x18')]);}_0x2e45f8[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x45ba63[_0x173c('0x3a')][_0x173c('0xc7')]);_0x2e45f8[_0x173c('0x39')]=qs[_0x173c('0xc4')](_['pick'](_0x45ba63[_0x173c('0x3a')],_0x394f3d[_0x173c('0xc4')]));_0x2e45f8[_0x173c('0x39')][_0x173c('0xd3')]=_0xa3910f['id'];if(_0x45ba63[_0x173c('0x3a')][_0x173c('0x26')]){_0x2e45f8[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x2e45f8[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x2e45f8[_0x173c('0x3e')],function(_0x7cfcac){var _0x95b656={};_0x95b656[_0x7cfcac]={'$like':'%'+_0x45ba63[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x95b656;})});}_0x2e45f8=_[_0x173c('0x4f')]({},_0x2e45f8,_0x45ba63[_0x173c('0x50')]);return db[_0x173c('0xd9')]['count']({'where':_0x2e45f8['where']})['then'](function(_0x1be0b9){_0x18a780[_0x173c('0x1b')]=_0x1be0b9;if(_0x45ba63[_0x173c('0x3a')][_0x173c('0x3b')]){_0x2e45f8[_0x173c('0x3c')]=[{'all':!![]}];}return db[_0x173c('0xd9')][_0x173c('0x3f')](_0x2e45f8);})['then'](function(_0x574d00){_0x18a780[_0x173c('0x41')]=_0x574d00;return _0x18a780;});}})[_0x173c('0x1e')](respondWithFilteredResult(_0x584435,_0x2e45f8))['catch'](handleError(_0x584435,null));};exports['getSmsInteractions']=function(_0x4e17fd,_0x5bc342){var _0x10873c={};var _0x2b0f30={};var _0x2e120f;var _0x2598b1;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x4e17fd[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x5bc342,null))[_0x173c('0x1e')](function(_0x5c4e3d){if(_0x5c4e3d){_0x2e120f=_0x5c4e3d;_0x2b0f30['model']=_[_0x173c('0xc3')](db[_0x173c('0xda')][_0x173c('0x30')]);_0x2b0f30[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x4e17fd[_0x173c('0x3a')]);_0x2b0f30[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x2b0f30['model'],_0x2b0f30[_0x173c('0x3a')]);_0x10873c[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x2b0f30[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x4e17fd[_0x173c('0x3a')][_0x173c('0xc6')]));_0x10873c[_0x173c('0x3e')]=_0x10873c[_0x173c('0x3e')][_0x173c('0x42')]?_0x10873c[_0x173c('0x3e')]:_0x2b0f30[_0x173c('0xc1')];_0x10873c['order']=qs['sort'](_0x4e17fd['query'][_0x173c('0xc7')]);_0x10873c[_0x173c('0x39')]=qs['filters'](_['pick'](_0x4e17fd[_0x173c('0x3a')],_0x2b0f30['filters']));if(_0x4e17fd[_0x173c('0x3a')]['filter']){_0x10873c[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x10873c['where'],{'$or':_[_0x173c('0x28')](_0x10873c[_0x173c('0x3e')],function(_0x53081d){var _0x383383={};_0x383383[_0x53081d]={'$like':'%'+_0x4e17fd[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x383383;})});}_0x10873c=_[_0x173c('0x4f')]({},_0x10873c,_0x4e17fd['options']);return _0x2e120f['getSmsInteractions'](_0x10873c);}})[_0x173c('0x1e')](function(_0x2c931b){if(_0x2c931b){_0x2598b1=_0x2c931b[_0x173c('0x42')];if(!_0x4e17fd['query'][_0x173c('0xbb')]('nolimit')){_0x10873c[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x4e17fd['query'][_0x173c('0x19')]);_0x10873c['offset']=qs[_0x173c('0x18')](_0x4e17fd[_0x173c('0x3a')]['offset']);}return _0x2e120f[_0x173c('0xdb')](_0x10873c);}})[_0x173c('0x1e')](function(_0x3ce34a){if(_0x3ce34a){return _0x3ce34a?{'count':_0x2598b1,'rows':_0x3ce34a}:null;}})[_0x173c('0x1e')](respondWithResult(_0x5bc342,null))['catch'](handleError(_0x5bc342,null));};exports[_0x173c('0xdc')]=function(_0x25569e,_0x276926){var _0x2a936c={};var _0x222534={};var _0x12557e;var _0x34c4d4;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x25569e[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x276926,null))['then'](function(_0xbe1ab0){if(_0xbe1ab0){_0x12557e=_0xbe1ab0;_0x222534[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xdd')][_0x173c('0x30')]);_0x222534[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x25569e['query']);_0x222534[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x222534['model'],_0x222534[_0x173c('0x3a')]);_0x2a936c['attributes']=_[_0x173c('0xc5')](_0x222534[_0x173c('0xc1')],qs['fields'](_0x25569e[_0x173c('0x3a')][_0x173c('0xc6')]));_0x2a936c['attributes']=_0x2a936c[_0x173c('0x3e')][_0x173c('0x42')]?_0x2a936c[_0x173c('0x3e')]:_0x222534[_0x173c('0xc1')];_0x2a936c[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x25569e[_0x173c('0x3a')][_0x173c('0xc7')]);_0x2a936c[_0x173c('0x39')]=qs[_0x173c('0xc4')](_[_0x173c('0xc8')](_0x25569e[_0x173c('0x3a')],_0x222534[_0x173c('0xc4')]));if(_0x25569e[_0x173c('0x3a')][_0x173c('0x26')]){_0x2a936c['where']=_[_0x173c('0x4f')](_0x2a936c[_0x173c('0x39')],{'$or':_[_0x173c('0x28')](_0x2a936c[_0x173c('0x3e')],function(_0xe30448){var _0x4924e3={};_0x4924e3[_0xe30448]={'$like':'%'+_0x25569e[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x4924e3;})});}_0x2a936c=_[_0x173c('0x4f')]({},_0x2a936c,_0x25569e[_0x173c('0x50')]);return _0x12557e[_0x173c('0xdc')](_0x2a936c);}})['then'](function(_0x2402cf){if(_0x2402cf){_0x34c4d4=_0x2402cf['length'];if(!_0x25569e[_0x173c('0x3a')][_0x173c('0xbb')]('nolimit')){_0x2a936c[_0x173c('0x19')]=qs['limit'](_0x25569e[_0x173c('0x3a')][_0x173c('0x19')]);_0x2a936c[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x25569e['query']['offset']);}return _0x12557e['getFaxInteractions'](_0x2a936c);}})['then'](function(_0x1387bf){if(_0x1387bf){return _0x1387bf?{'count':_0x34c4d4,'rows':_0x1387bf}:null;}})['then'](respondWithResult(_0x276926,null))[_0x173c('0x52')](handleError(_0x276926,null));};exports['getWhatsappInteractions']=function(_0x383c46,_0x484ca6){var _0x2f2d95={};var _0x5c732a={};var _0x32f2a8;var _0x3345c7;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x383c46[_0x173c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x484ca6,null))[_0x173c('0x1e')](function(_0x43d8a1){if(_0x43d8a1){_0x32f2a8=_0x43d8a1;_0x5c732a[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0xde')][_0x173c('0x30')]);_0x5c732a[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x383c46['query']);_0x5c732a['filters']=_[_0x173c('0xc5')](_0x5c732a[_0x173c('0xc1')],_0x5c732a['query']);_0x2f2d95[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x5c732a['model'],qs['fields'](_0x383c46[_0x173c('0x3a')][_0x173c('0xc6')]));_0x2f2d95['attributes']=_0x2f2d95[_0x173c('0x3e')][_0x173c('0x42')]?_0x2f2d95['attributes']:_0x5c732a[_0x173c('0xc1')];_0x2f2d95[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x383c46[_0x173c('0x3a')][_0x173c('0xc7')]);_0x2f2d95['where']=qs['filters'](_[_0x173c('0xc8')](_0x383c46['query'],_0x5c732a['filters']));if(_0x383c46[_0x173c('0x3a')][_0x173c('0x26')]){_0x2f2d95[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x2f2d95[_0x173c('0x39')],{'$or':_['map'](_0x2f2d95['attributes'],function(_0x207bf7){var _0x29faba={};_0x29faba[_0x207bf7]={'$like':'%'+_0x383c46[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x29faba;})});}_0x2f2d95=_[_0x173c('0x4f')]({},_0x2f2d95,_0x383c46[_0x173c('0x50')]);return _0x32f2a8['getWhatsappInteractions'](_0x2f2d95);}})['then'](function(_0x276e00){if(_0x276e00){_0x3345c7=_0x276e00['length'];if(!_0x383c46[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x2f2d95[_0x173c('0x19')]=qs['limit'](_0x383c46[_0x173c('0x3a')][_0x173c('0x19')]);_0x2f2d95['offset']=qs[_0x173c('0x18')](_0x383c46[_0x173c('0x3a')][_0x173c('0x18')]);}return _0x32f2a8[_0x173c('0xdf')](_0x2f2d95);}})[_0x173c('0x1e')](function(_0x349639){if(_0x349639){return _0x349639?{'count':_0x3345c7,'rows':_0x349639}:null;}})[_0x173c('0x1e')](respondWithResult(_0x484ca6,null))['catch'](handleError(_0x484ca6,null));};exports[_0x173c('0xe0')]=function(_0x20a449,_0x1f9bdd,_0x1d4759){var _0x555dbb;var _0x278814;var _0x2c3344;var _0x15e4c0=!_[_0x173c('0x5d')](_0x20a449[_0x173c('0x4c')]['id'])?_0x20a449[_0x173c('0x4c')]['id']:!_['isNil'](_0x20a449[_0x173c('0x23')]['id'])?_0x20a449[_0x173c('0x23')]['id']:null;return db[_0x173c('0x2f')]['find']({'where':{'id':_0x15e4c0,'role':{'$or':[_0x173c('0x72'),'user',_0x173c('0x20')]}},'attributes':['id',_0x173c('0x2b'),_0x173c('0xe1'),_0x173c('0xe2'),_0x173c('0x1f'),_0x173c('0x58'),_0x173c('0x94')]})[_0x173c('0x1e')](function(_0x29dbf4){if(_0x29dbf4){if(_0x29dbf4[_0x173c('0x1f')]===_0x173c('0x20')){_0x555dbb=_0x29dbf4;if(_0x20a449['body'][_0x173c('0x9e')]){_0x2c3344=util[_0x173c('0x9f')](_0x173c('0xe3'),_0x555dbb[_0x20a449[_0x173c('0x53')][_0x173c('0x9e')]]);}else if(_0x20a449[_0x173c('0x53')]['intrf']){_0x2c3344=util['format']('SIP/%s',_0x20a449[_0x173c('0x53')][_0x173c('0xe4')]);}else{_0x2c3344=util['format'](_0x173c('0xa0'),_0x555dbb[_0x173c('0x2b')]);}socket['to'](util[_0x173c('0x9f')]('user:%s',_0x555dbb[_0x173c('0x2b')]))['emit'](_0x173c('0xe5'),{'user':{'id':_0x555dbb['id'],'name':_0x555dbb[_0x173c('0x2b')]},'ip':_0x20a449[_0x173c('0xe6')][_0x173c('0xe7')]||_0x20a449['connection'][_0x173c('0xe8')]||_0x20a449[_0x173c('0xe9')][_0x173c('0xe8')]||_0x20a449[_0x173c('0xea')]['socket'][_0x173c('0xe8')]});return db[_0x173c('0xa1')]['destroy']({'where':{'membername':_0x555dbb['name']},'individualHooks':!![]});}}else{throw new db[(_0x173c('0x85'))][(_0x173c('0x82'))](_0x173c('0xeb'));}})['then'](function(){if(_0x555dbb){return _0x555dbb[_0x173c('0xec')]({'raw':!![]});}})['then'](function(_0x30aa37){if(_0x555dbb){if(_0x30aa37){_0x278814=_0x30aa37;if(_0x278814[_0x173c('0x42')]){var _0x4b3919=_0x278814['map'](function(_0x313269){var _0x32aa30={'membername':_0x555dbb[_0x173c('0x2b')],'UserId':_0x555dbb['id'],'queue_name':_0x313269[_0x173c('0x2b')],'VoiceQueueId':_0x313269['id'],'interface':_0x2c3344,'paused':_0x555dbb['loginInPause']||![],'penalty':_0x313269[_0x173c('0xed')]||0x0};return db[_0x173c('0xa1')][_0x173c('0xa2')](_0x32aa30);});return Promise[_0x173c('0x4a')](_0x4b3919);}}}})['then'](function(){if(_0x555dbb){return db['MemberReport'][_0x173c('0x3f')]({'where':{'membername':_0x555dbb['name'],'exitAt':null}});}})[_0x173c('0x1e')](function(_0x28c93a){if(_0x555dbb){var _0x3657b3=[];_0x28c93a[_0x173c('0xee')](function(_0x5592e8){_0x3657b3[_0x173c('0x43')](_0x5592e8['update']({'exitAt':moment()[_0x173c('0x9f')](_0x173c('0xef'))}));});return Promise['all'](_0x3657b3);}})[_0x173c('0x1e')](function(){if(_0x555dbb){var _0x21269e=[];var _0x2dace8=[];var _0x391dce=utils[_0x173c('0xf0')]();var _0x58a0c4={'membername':_0x555dbb[_0x173c('0x2b')],'interface':_0x2c3344,'enterAt':moment()[_0x173c('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x555dbb[_0x173c('0x1f')],'internal':_0x555dbb[_0x173c('0x58')]};_0x391dce['forEach'](function(_0x3d9c35){_0x21269e[_0x173c('0x43')](_[_0x173c('0x4f')]({'channel':_0x3d9c35,'type':_0x173c('0xf1'),'data1':_0x20a449[_0x173c('0x53')][_0x173c('0xf2')],'data2':_0x2c3344},_0x58a0c4));if(_0x555dbb['loginInPause']){_0x2dace8[_0x173c('0x43')](_['merge']({'channel':_0x3d9c35,'type':_0x173c('0xf3'),'data1':_0x173c('0xf4')},_0x58a0c4));}});return db[_0x173c('0xf5')][_0x173c('0xf6')](_0x21269e[_0x173c('0xb8')](_0x2dace8),{'individualHooks':!![]});}})[_0x173c('0x1e')](function(){if(_0x555dbb){return _0x555dbb[_0x173c('0x1d')]({'online':!![],'lastLoginAt':moment()[_0x173c('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x555dbb['loginInPause']||![],'mailPause':_0x555dbb[_0x173c('0x94')]||![],'chatPause':_0x555dbb[_0x173c('0x94')]||![],'faxPause':_0x555dbb[_0x173c('0x94')]||![],'smsPause':_0x555dbb[_0x173c('0x94')]||![],'openchannelPause':_0x555dbb[_0x173c('0x94')]||![],'whatsappPause':_0x555dbb['loginInPause']||![],'pauseType':_0x555dbb[_0x173c('0x94')]?_0x173c('0xf4'):null,'interface':_0x2c3344,'lastPauseAt':moment()[_0x173c('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x173c('0x1e')](function(_0x2bcc44){if(_0x20a449[_0x173c('0xf7')]){return _0x1d4759();}else{return Promise[_0x173c('0xf8')](_0x2bcc44)[_0x173c('0x1e')](respondWithResult(_0x1f9bdd,null));}})[_0x173c('0x52')](handleError(_0x1f9bdd,null));};exports[_0x173c('0xf9')]=function(_0x113d11,_0x4cf7c0){var _0x4b981c;return db[_0x173c('0x2f')][_0x173c('0x2a')]({'where':{'id':_0x113d11['params']['id'],'role':_0x173c('0x20')},'attributes':['id',_0x173c('0x2b'),_0x173c('0x1f')]})[_0x173c('0x1e')](handleEntityNotFound(_0x4cf7c0,null))[_0x173c('0x1e')](function(_0x2c2c3e){if(_0x2c2c3e){_0x4b981c=_0x2c2c3e;return db['UserVoiceQueueRt'][_0x173c('0x22')]({'where':{'membername':_0x4b981c[_0x173c('0x2b')]},'individualHooks':!![]});}})[_0x173c('0x1e')](function(){return db['MemberReport'][_0x173c('0x3f')]({'where':{'membername':_0x4b981c[_0x173c('0x2b')],'exitAt':null}});})[_0x173c('0x1e')](function(_0x1dcd8b){var _0x13d6aa=[];_0x1dcd8b['forEach'](function(_0x45c09a){_0x13d6aa['push'](_0x45c09a[_0x173c('0x1d')]({'exitAt':moment()[_0x173c('0x9f')](_0x173c('0xef'))}));});return Promise['all'](_0x13d6aa);})[_0x173c('0x1e')](function(){return _0x4b981c[_0x173c('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x173c('0x1e')](respondWithResult(_0x4cf7c0,null))[_0x173c('0x52')](handleError(_0x4cf7c0,null));};exports[_0x173c('0xfa')]=function(_0x2a39a3,_0x402fe5){var _0x58b049;return db[_0x173c('0xa1')][_0x173c('0x1d')]({'paused':0x1},{'where':{'UserId':_0x2a39a3[_0x173c('0x4c')]['id']},'individualHooks':!![]})[_0x173c('0x1e')](function(){return db['User']['find']({'where':{'id':_0x2a39a3['params']['id'],'role':'agent'},'attributes':['id',_0x173c('0x2b'),'role',_0x173c('0x58'),_0x173c('0x9e'),_0x173c('0x93')]});})[_0x173c('0x1e')](handleEntityNotFound(_0x402fe5,null))[_0x173c('0x1e')](function(_0x1a45c6){if(_0x1a45c6){_0x58b049=_0x1a45c6;return db[_0x173c('0xf5')][_0x173c('0x3f')]({'where':{'membername':_0x58b049['name'],'type':_0x173c('0xf3'),'exitAt':null}});}})[_0x173c('0x1e')](function(_0x2d0356){if(_0x2d0356[_0x173c('0x42')]){var _0x2f35af=moment()[_0x173c('0x9f')](_0x173c('0xef'));for(var _0x25dcde=0x0,_0x5f1de5=_0x2d0356[_0x173c('0x42')];_0x25dcde<_0x5f1de5;_0x25dcde++){_0x2d0356[_0x25dcde][_0x173c('0xfb')]({'exitAt':_0x2f35af});}}})['then'](function(){var _0x527cb8=[];var _0x370ff3=utils[_0x173c('0xf0')]();_0x370ff3[_0x173c('0xee')](function(_0x5417b9){_0x527cb8[_0x173c('0x43')]({'channel':_0x5417b9,'membername':_0x58b049[_0x173c('0x2b')],'interface':_[_0x173c('0x5d')](_0x58b049['interface'])?util[_0x173c('0x9f')](_0x173c('0xa0'),_0x58b049[_0x173c('0x2b')]):_0x58b049['interface'],'type':_0x173c('0xf3'),'enterAt':moment()[_0x173c('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2a39a3[_0x173c('0x53')][_0x173c('0x32')]||'DEFAULT\x20PAUSE','role':_0x58b049[_0x173c('0x1f')],'internal':_0x58b049[_0x173c('0x58')]});});return db['MemberReport']['bulkCreate'](_0x527cb8,{'individualHooks':!![]});})[_0x173c('0x1e')](function(){return _0x58b049[_0x173c('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2a39a3[_0x173c('0x53')][_0x173c('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x173c('0x9f')](_0x173c('0xef'))});})[_0x173c('0x1e')](respondWithResult(_0x402fe5,null))['catch'](handleError(_0x402fe5,null));};exports[_0x173c('0xfc')]=function(_0x244c58,_0x1bf817){if(_0x244c58[_0x173c('0x53')][_0x173c('0x92')]&&!utils[_0x173c('0x96')](_0x244c58['body'][_0x173c('0x92')])){throw new APIBadRequestError(util[_0x173c('0x9f')](_0x173c('0xfd'),_0x244c58[_0x173c('0x53')]['channel']));}return db[_0x173c('0x2f')][_0x173c('0x2a')]({'where':{'id':_0x244c58[_0x173c('0x4c')]['id']},'attributes':['id','name',_0x173c('0x1f'),'internal',_0x173c('0x9e'),'online','voicePause',_0x173c('0xfe'),_0x173c('0xff'),_0x173c('0x100'),_0x173c('0x101'),_0x173c('0x102'),_0x173c('0x103'),_0x173c('0x104'),_0x173c('0x105')]})[_0x173c('0x1e')](function(_0x551e01){if(!_0x551e01){throw new APINotFoundError(util[_0x173c('0x9f')](_0x173c('0xba'),_0x244c58[_0x173c('0x4c')]['id']));}return _0x551e01[_0x173c('0xfc')](_0x244c58['body'][_0x173c('0x92')]);})[_0x173c('0x1e')](respondWithResult(_0x1bf817,null))[_0x173c('0x52')](APIHandleError(_0x1bf817));};exports['getTeams']=function(_0x35d4c9,_0x21d078){var _0xbaf27c={};var _0xf1d180={};var _0x3a9666;var _0xc9d759;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x35d4c9[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x21d078,null))[_0x173c('0x1e')](function(_0x29523a){if(_0x29523a){_0x3a9666=_0x29523a;_0xf1d180[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0x106')][_0x173c('0x30')]);_0xf1d180['query']=_[_0x173c('0xc3')](_0x35d4c9[_0x173c('0x3a')]);_0xf1d180[_0x173c('0xc4')]=_['intersection'](_0xf1d180[_0x173c('0xc1')],_0xf1d180[_0x173c('0x3a')]);_0xbaf27c[_0x173c('0x3e')]=_['intersection'](_0xf1d180[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x35d4c9['query']['fields']));_0xbaf27c[_0x173c('0x3e')]=_0xbaf27c[_0x173c('0x3e')][_0x173c('0x42')]?_0xbaf27c[_0x173c('0x3e')]:_0xf1d180[_0x173c('0xc1')];_0xbaf27c[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x35d4c9['query'][_0x173c('0xc7')]);_0xbaf27c[_0x173c('0x39')]=qs['filters'](_[_0x173c('0xc8')](_0x35d4c9['query'],_0xf1d180['filters']));if(_0x35d4c9['query'][_0x173c('0x26')]){_0xbaf27c['where']=_[_0x173c('0x4f')](_0xbaf27c['where'],{'$or':_[_0x173c('0x28')](_0xbaf27c[_0x173c('0x3e')],function(_0x47dfc0){var _0x5b2a={};_0x5b2a[_0x47dfc0]={'$like':'%'+_0x35d4c9[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x5b2a;})});}_0xbaf27c=_[_0x173c('0x4f')]({},_0xbaf27c,_0x35d4c9[_0x173c('0x50')]);return _0x3a9666[_0x173c('0x107')](_0xbaf27c);}})[_0x173c('0x1e')](function(_0x2ef6d2){if(_0x2ef6d2){_0xc9d759=_0x2ef6d2[_0x173c('0x42')];if(!_0x35d4c9[_0x173c('0x3a')][_0x173c('0xbb')]('nolimit')){_0xbaf27c[_0x173c('0x19')]=qs['limit'](_0x35d4c9[_0x173c('0x3a')]['limit']);_0xbaf27c[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x35d4c9[_0x173c('0x3a')][_0x173c('0x18')]);}return _0x3a9666['getTeams'](_0xbaf27c);}})['then'](function(_0x46abf9){if(_0x46abf9){return _0x46abf9?{'count':_0xc9d759,'rows':_0x46abf9}:null;}})[_0x173c('0x1e')](respondWithResult(_0x21d078,null))['catch'](handleError(_0x21d078,null));};exports['addTeams']=function(_0x9c1178,_0x39a74f){var _0x40428f=_0x9c1178[_0x173c('0x4c')]['id'];var _0x5117e9=_0x9c1178[_0x173c('0x53')]?_0x9c1178[_0x173c('0x53')][_0x173c('0x56')]:null;var _0x9a5ba0=[];return Promise[_0x173c('0xf8')]()[_0x173c('0x1e')](function(){if(!_0x5117e9)throw new APIBadRequestError(_0x173c('0x108'));})[_0x173c('0x1e')](function(){return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x40428f}});})[_0x173c('0x1e')](function(_0x25fee4){if(!_0x25fee4)throw new APINotFoundError(util['format'](_0x173c('0xba'),_0x9c1178[_0x173c('0x4c')]['id']));return db[_0x173c('0x60')]['transaction'](function(_0x37a61e){return _0x25fee4[_0x173c('0x109')](_0x5117e9,{'transaction':_0x37a61e})['then'](function(){return db[_0x173c('0x106')][_0x173c('0x3f')]({'where':{'id':{'$in':_0x5117e9}}});})[_0x173c('0x1e')](function(_0x804b2a){var _0x23c7a3=_[_0x173c('0x28')](_0x804b2a,function(_0x404390){return _0x404390[_0x173c('0x10a')]();});return Promise[_0x173c('0x4a')](_0x23c7a3);})[_0x173c('0x1e')](function(_0x47aae0){_0x9a5ba0=_[_0x173c('0x10b')](_0x47aae0);var _0x55ea4a=_['map'](_0x9a5ba0,function(_0x3d63ff){return _0x3d63ff['addAgent'](_0x25fee4['id'],{'transaction':_0x37a61e});});return Promise[_0x173c('0x4a')](_0x55ea4a);})[_0x173c('0x1e')](function(){if(!_0x25fee4[_0x173c('0x93')])return;var _0x3e2a95=_[_0x173c('0x26')](_0x9a5ba0,function(_0x43d075){return _0x43d075[_0x173c('0x10c')](_0x173c('0x92'))===_0x173c('0x10d');});var _0x3b5a0f=_[_0x173c('0x28')](_0x3e2a95,function(_0x42e4eb){return db[_0x173c('0xa1')][_0x173c('0xa2')]({'membername':_0x25fee4['name'],'UserId':_0x25fee4['id'],'queue_name':_0x42e4eb[_0x173c('0x2b')],'VoiceQueueId':_0x42e4eb['id'],'interface':_['isNil'](_0x25fee4['interface'])?util[_0x173c('0x9f')]('SIP/%s',_0x25fee4[_0x173c('0x2b')]):_0x25fee4[_0x173c('0x9e')],'paused':_0x25fee4[_0x173c('0x95')]||![],'penalty':_0x25fee4['penalty']},{'transaction':_0x37a61e});});return Promise[_0x173c('0x4a')](_0x3b5a0f);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x5117e9}}});})[_0x173c('0x1e')](function(_0x3f5e8e){var _0x1c6c2f=_[_0x173c('0x28')](_0x3f5e8e,function(_0x6208f4){return db[_0x173c('0x10e')][_0x173c('0x77')]({'UserId':_0x25fee4['id'],'VoicePrefixId':_0x6208f4[_0x173c('0x10f')]},{'transaction':_0x37a61e});});return Promise[_0x173c('0x4a')](_0x1c6c2f);});});})[_0x173c('0x1e')](function(){for(var _0xa019b9=0x0;_0xa019b9<_0x9a5ba0[_0x173c('0x42')];_0xa019b9++){var _0x895960=_0x9a5ba0[_0xa019b9][_0x173c('0x10c')](_0x173c('0x92'));var _0x43619d=_0x895960+_0x173c('0xa5');socket['emit']('user'+_0x895960+_0x173c('0x9b'),{'UserId':_0x40428f,['queueField']:_0x9a5ba0[_0xa019b9]['id']});}})[_0x173c('0x1e')](respondWithStatusCode(_0x39a74f,null))['catch'](APIHandleError(_0x39a74f));};exports[_0x173c('0x110')]=function(_0x1a497e,_0x23ed8c){var _0x923d3b=_0x1a497e['params']['id'];var _0x5e2485=null;if(_0x1a497e[_0x173c('0x3a')][_0x173c('0x56')]){_0x5e2485=_[_0x173c('0xa4')](_0x1a497e[_0x173c('0x3a')][_0x173c('0x56')])?_0x1a497e[_0x173c('0x3a')][_0x173c('0x56')]:[_0x1a497e['query'][_0x173c('0x56')]];}var _0x1cdb6f=[];return Promise[_0x173c('0xf8')]()[_0x173c('0x1e')](function(){if(!_0x5e2485)throw new APIBadRequestError(_0x173c('0x111'));})['then'](function(){return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x923d3b}});})[_0x173c('0x1e')](function(_0x68584){if(!_0x68584)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1a497e[_0x173c('0x4c')]['id']));return db[_0x173c('0x60')]['transaction'](function(_0x54ec20){return _0x68584[_0x173c('0x110')](_0x5e2485,{'transaction':_0x54ec20})['then'](function(){return db[_0x173c('0x106')]['findAll']({'where':{'id':{'$in':_0x5e2485}}});})[_0x173c('0x1e')](function(_0x4c56e5){var _0x49c19c=_[_0x173c('0x28')](_0x4c56e5,function(_0x2981e1){return _0x2981e1[_0x173c('0x10a')]();});return Promise[_0x173c('0x4a')](_0x49c19c);})[_0x173c('0x1e')](function(_0x589c12){_0x1cdb6f=_['flattenDeep'](_0x589c12);var _0x3ea70e=_[_0x173c('0x28')](_0x1cdb6f,function(_0x772a96){return _0x772a96[_0x173c('0x112')](_0x68584['id'],{'transaction':_0x54ec20});});return Promise['all'](_0x3ea70e);})[_0x173c('0x1e')](function(){if(!_0x68584['online'])return;var _0x2212a5=_[_0x173c('0x26')](_0x1cdb6f,function(_0x4d34e6){return _0x4d34e6[_0x173c('0x10c')](_0x173c('0x92'))===_0x173c('0x10d');});var _0x49cdca=_['map'](_0x2212a5,function(_0x446613){return db[_0x173c('0xa1')]['destroy']({'where':{'VoiceQueueId':_0x446613['id'],'UserId':_0x68584['id']},'transaction':_0x54ec20});});return Promise['all'](_0x49cdca);})[_0x173c('0x1e')](function(){return db[_0x173c('0x113')][_0x173c('0x3f')]({'where':{'teamId':{'$in':_0x5e2485}}});})['then'](function(_0x54d45b){var _0x2a73ec=_['map'](_0x54d45b,function(_0x1f0050){return db[_0x173c('0x10e')][_0x173c('0x22')]({'where':{'UserId':_0x68584['id'],'VoicePrefixId':_0x1f0050[_0x173c('0x10f')]}},{'transaction':_0x54ec20});});return Promise[_0x173c('0x4a')](_0x2a73ec);});});})[_0x173c('0x1e')](function(){for(var _0x491f13=0x0;_0x491f13<_0x1cdb6f[_0x173c('0x42')];_0x491f13++){var _0x4d479b=_0x1cdb6f[_0x491f13][_0x173c('0x10c')](_0x173c('0x92'));var _0xc248c=_0x4d479b+'QueueId';socket['emit'](_0x173c('0x23')+_0x4d479b+'Queue:remove',{'UserId':_0x923d3b,['queueField']:_0x1cdb6f[_0x491f13]['id']});}})['then'](respondWithStatusCode(_0x23ed8c,null))[_0x173c('0x52')](APIHandleError(_0x23ed8c));};exports[_0x173c('0x114')]=function(_0x29d60f,_0x3645ac){var _0x3ce805={};var _0x1c8954={};var _0x1bdbb4;var _0x1fc058;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x29d60f[_0x173c('0x4c')]['id']}})[_0x173c('0x1e')](handleEntityNotFound(_0x3645ac,null))[_0x173c('0x1e')](function(_0x106783){if(_0x106783){_0x1bdbb4=_0x106783;_0x1c8954[_0x173c('0xc1')]=_[_0x173c('0xc3')](db['CmList']['rawAttributes']);_0x1c8954[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x29d60f[_0x173c('0x3a')]);_0x1c8954[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x1c8954[_0x173c('0xc1')],_0x1c8954['query']);_0x3ce805[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x1c8954['model'],qs[_0x173c('0xc6')](_0x29d60f[_0x173c('0x3a')][_0x173c('0xc6')]));_0x3ce805['attributes']=_0x3ce805['attributes'][_0x173c('0x42')]?_0x3ce805[_0x173c('0x3e')]:_0x1c8954['model'];_0x3ce805['order']=qs[_0x173c('0xc7')](_0x29d60f[_0x173c('0x3a')][_0x173c('0xc7')]);_0x3ce805['where']=qs['filters'](_[_0x173c('0xc8')](_0x29d60f['query'],_0x1c8954['filters']));if(_0x29d60f['query'][_0x173c('0x26')]){_0x3ce805['where']=_[_0x173c('0x4f')](_0x3ce805['where'],{'$or':_[_0x173c('0x28')](_0x3ce805['attributes'],function(_0x29a9b8){var _0x3727af={};_0x3727af[_0x29a9b8]={'$like':'%'+_0x29d60f[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x3727af;})});}_0x3ce805=_[_0x173c('0x4f')]({},_0x3ce805,_0x29d60f[_0x173c('0x50')]);return _0x1bdbb4[_0x173c('0x114')](_0x3ce805);}})['then'](function(_0x578e00){if(_0x578e00){_0x1fc058=_0x578e00[_0x173c('0x42')];if(!_0x29d60f[_0x173c('0x3a')][_0x173c('0xbb')](_0x173c('0xc9'))){_0x3ce805[_0x173c('0x19')]=qs[_0x173c('0x19')](_0x29d60f[_0x173c('0x3a')][_0x173c('0x19')]);_0x3ce805[_0x173c('0x18')]=qs[_0x173c('0x18')](_0x29d60f[_0x173c('0x3a')]['offset']);}return _0x1bdbb4['getLists'](_0x3ce805);}})[_0x173c('0x1e')](function(_0x57ffec){if(_0x57ffec){return _0x57ffec?{'count':_0x1fc058,'rows':_0x57ffec}:null;}})['then'](respondWithResult(_0x3645ac,null))[_0x173c('0x52')](handleError(_0x3645ac,null));};exports['getAgents']=function(_0x43252c,_0x5ac571){var _0x3296ff={};var _0x428fcb={};var _0xf28c4a;return db[_0x173c('0x2f')][_0x173c('0x8a')]({'where':{'id':_0x43252c['params']['id']}})['then'](handleEntityNotFound(_0x5ac571,null))[_0x173c('0x1e')](function(_0x4512f4){if(_0x4512f4){_0xf28c4a=_0x4512f4;_0x428fcb[_0x173c('0xc1')]=_[_0x173c('0xc3')](db[_0x173c('0x2f')][_0x173c('0x30')]);_0x428fcb[_0x173c('0x3a')]=_[_0x173c('0xc3')](_0x43252c[_0x173c('0x3a')]);_0x428fcb[_0x173c('0xc4')]=_[_0x173c('0xc5')](_0x428fcb[_0x173c('0xc1')],_0x428fcb[_0x173c('0x3a')]);_0x3296ff[_0x173c('0x3e')]=_[_0x173c('0xc5')](_0x428fcb[_0x173c('0xc1')],qs[_0x173c('0xc6')](_0x43252c[_0x173c('0x3a')][_0x173c('0xc6')]));_0x3296ff[_0x173c('0x3e')]=_0x3296ff['attributes']['length']?_0x3296ff[_0x173c('0x3e')]:_0x428fcb[_0x173c('0xc1')];_0x3296ff[_0x173c('0xce')]=qs[_0x173c('0xc7')](_0x43252c[_0x173c('0x3a')][_0x173c('0xc7')]);_0x3296ff[_0x173c('0x39')]=qs[_0x173c('0xc4')](_['pick'](_0x43252c[_0x173c('0x3a')],_0x428fcb['filters']));if(_0x43252c[_0x173c('0x3a')]['filter']){_0x3296ff[_0x173c('0x39')]=_[_0x173c('0x4f')](_0x3296ff['where'],{'$or':_['map'](_0x3296ff[_0x173c('0x3e')],function(_0x4f2959){var _0x58d7d6={};_0x58d7d6[_0x4f2959]={'$like':'%'+_0x43252c[_0x173c('0x3a')][_0x173c('0x26')]+'%'};return _0x58d7d6;})});}_0x3296ff[_0x173c('0xc1')]=db[_0x173c('0x2f')];_0x3296ff['as']=_0x173c('0x78');_0x3296ff=_[_0x173c('0x4f')]({},_0x3296ff,_0x43252c[_0x173c('0x50')]);return _0xf28c4a[_0x173c('0xec')]({'include':[_0x3296ff]});}})['then'](function(_0x45e77f){if(_0x45e77f){var _0x49699f={},_0x36b570=[];for(var _0x3660c3=0x0;_0x3660c3<_0x45e77f[_0x173c('0x42')];_0x3660c3+=0x1){for(var _0x13b1e6=0x0,_0x477e9d;_0x13b1e6<_0x45e77f[_0x3660c3][_0x173c('0x78')]['length'];_0x13b1e6+=0x1){_0x477e9d=_0x45e77f[_0x3660c3][_0x173c('0x78')][_0x13b1e6]['get']({'plain':!![]});_0x49699f[_0x477e9d['id']]=_0x477e9d;}}_0x49699f=_[_0x173c('0x115')](_0x49699f);for(var _0x14e63f=qs['offset'](_0x43252c[_0x173c('0x3a')][_0x173c('0x18')]);_0x14e63f<_0x49699f[_0x173c('0x42')]&&_0x36b570['length']=_0xfd28d4){_0x401cbc=_0xfd28d4;_0x296e5b=0xc8;}else{_0x296e5b=0xce;}_0x54ad19['status'](_0x296e5b);return _0x54ad19[_0x511d('0x1a')](_0x511d('0x1b'),_0x567e8d+'-'+_0x401cbc+'/'+_0xfd28d4)[_0x511d('0x15')](_0x132c94);}return null;};}function saveUpdates(_0x544e00){return function(_0x3c4013){if(_0x3c4013){return _0x3c4013[_0x511d('0x1c')](_0x544e00)['then'](function(_0xd991fc){if(_0xd991fc['role']===_0x511d('0x1d')){socket[_0x511d('0x1e')](_0x511d('0x1f')+_0xd991fc['id'],_0xd991fc);}return _0xd991fc;});}return null;};}function removeEntity(_0x5872d3){return function(_0xd86af5){if(_0xd86af5){return _0xd86af5[_0x511d('0x20')]()['then'](function(){var _0x3fbdc9=_0xd86af5[_0x511d('0x21')]({'plain':!![]});if(_0x3fbdc9[_0x511d('0x22')]===_0x511d('0x23'))return;var _0x2af956=[{'name':_0x511d('0x24'),'value':'user','ignore':!![]},{'name':_0x511d('0x25'),'value':_0x511d('0x1d'),'ignore':![]},{'name':'Telephones','value':_0x511d('0x26'),'ignore':![]}];var _0x33fbc9=_(_0x2af956)[_0x511d('0x27')](_0x511d('0x28'))[_0x511d('0x29')](_0x511d('0x2a'))[_0x511d('0x2a')]();if(_[_0x511d('0x2b')](_0x33fbc9,_0x3fbdc9[_0x511d('0x22')])){return;}var _0x67434a=_['find'](_0x2af956,[_0x511d('0x2a'),_0x3fbdc9[_0x511d('0x22')]])[_0x511d('0x2c')];return db[_0x511d('0x2d')][_0x511d('0x20')]({'where':{'type':_0x67434a,'resourceId':_0x3fbdc9['id']}})['then'](function(){return _0xd86af5;});})[_0x511d('0x2e')](function(){_0x5872d3[_0x511d('0x14')](0xcc)[_0x511d('0x2f')]();});}};}function handleEntityNotFound(_0x19f9f3){return function(_0x52e597){if(!_0x52e597){_0x19f9f3[_0x511d('0x30')](0x194);}return _0x52e597;};}function handleError(_0x35a656,_0x18e973){_0x18e973=_0x18e973||0x1f4;return function(_0x331368){logger[_0x511d('0x31')](_0x331368['stack']);if(_0x331368[_0x511d('0x2c')]){delete _0x331368['name'];}_0x35a656[_0x511d('0x14')](_0x18e973)[_0x511d('0x32')](_0x331368);};}function getUserAttributes(){return _(db[_0x511d('0x33')][_0x511d('0x34')])[_0x511d('0x29')](function(_0x3fb0f2){return{'name':_0x3fb0f2[_0x511d('0x35')],'type':_0x3fb0f2[_0x511d('0x36')][_0x511d('0x37')]};})[_0x511d('0x27')](function(_0x36a146){return!['password',_0x511d('0x38'),'previousPasswords','resetPasswordToken',_0x511d('0x39'),'md5secret']['includes'](_0x36a146['name']);})[_0x511d('0x2a')]();}exports[_0x511d('0x3a')]=function(_0x15db8e,_0x3db7c9){var _0x1ca955={},_0x5a7e46={'count':0x0,'rows':[]};var _0x401ad6=getUserAttributes();_0x1ca955=qs[_0x511d('0x3b')](_0x401ad6,_0x15db8e);var _0x1dca8e={'where':_0x1ca955[_0x511d('0x3c')]};return db[_0x511d('0x33')][_0x511d('0x19')](_0x1dca8e)['then'](function(_0x44663b){_0x5a7e46[_0x511d('0x19')]=_0x44663b;if(_0x15db8e[_0x511d('0x3d')][_0x511d('0x3e')]){_0x1ca955['include']=[{'all':!![]}];}if(_0x15db8e['query'][_0x511d('0x3f')]==='true'){_0x1ca955[_0x511d('0x40')]=[{'model':db['UserSetting'],'as':_0x511d('0x3f')}];}if(!_[_0x511d('0x2b')](_0x1ca955['attributes'],'id')){_0x1ca955[_0x511d('0x41')][_0x511d('0x42')]('id');}return db[_0x511d('0x33')][_0x511d('0x43')](_0x1ca955);})[_0x511d('0x2e')](function(_0x591421){_0x5a7e46['rows']=_0x591421;if(_0x15db8e[_0x511d('0x3d')][_0x511d('0x44')]===_0x511d('0x45')){var _0x2644d0=[];for(var _0x2753c5=0x0;_0x2753c5<_0x5a7e46[_0x511d('0x46')]['length'];_0x2753c5++){_0x2644d0['push'](get_open_tabs(_0x511d('0x47'),_0x5a7e46['rows'][_0x2753c5][_0x511d('0x48')]));_0x2644d0[_0x511d('0x42')](get_open_tabs(_0x511d('0x49'),_0x5a7e46[_0x511d('0x46')][_0x2753c5][_0x511d('0x48')]));_0x2644d0[_0x511d('0x42')](get_open_tabs(_0x511d('0x4a'),_0x5a7e46[_0x511d('0x46')][_0x2753c5][_0x511d('0x48')]));_0x2644d0['push'](get_open_tabs('mail',_0x5a7e46[_0x511d('0x46')][_0x2753c5][_0x511d('0x48')]));_0x2644d0[_0x511d('0x42')](get_open_tabs(_0x511d('0x4b'),_0x5a7e46[_0x511d('0x46')][_0x2753c5]['dataValues']));_0x2644d0[_0x511d('0x42')](get_open_tabs(_0x511d('0x4c'),_0x5a7e46[_0x511d('0x46')][_0x2753c5][_0x511d('0x48')]));}return Promise[_0x511d('0x4d')](_0x2644d0)[_0x511d('0x2e')](function(){return _0x5a7e46;});}else{return _0x5a7e46;}})[_0x511d('0x2e')](respondWithFilteredResult(_0x3db7c9,_0x1ca955))[_0x511d('0x4e')](handleError(_0x3db7c9,null));};exports[_0x511d('0x4f')]=function(_0xcfd62f,_0x5ea35e){var _0x18b75a=getUserAttributes();_0xcfd62f[_0x511d('0x3d')]['id']=_0xcfd62f[_0x511d('0x50')]['id'];var _0x3491e7=qs[_0x511d('0x3b')](_0x18b75a,_0xcfd62f);if(_0xcfd62f['query'][_0x511d('0x3e')]){_0x3491e7[_0x511d('0x40')]=[{'all':!![]}];}if(_0xcfd62f[_0x511d('0x3d')]['userSetting']===_0x511d('0x45')){_0x3491e7[_0x511d('0x40')]=[{'model':db[_0x511d('0x51')],'as':_0x511d('0x3f')}];}_0x3491e7=_[_0x511d('0x52')]({},_0x3491e7,_0xcfd62f[_0x511d('0x53')]);if(!_['includes'](_0x3491e7[_0x511d('0x41')],'id')){_0x3491e7[_0x511d('0x41')][_0x511d('0x42')]('id');}return db['User'][_0x511d('0x54')](_0x3491e7)['then'](handleEntityNotFound(_0x5ea35e,null))['then'](function(_0x4bf8){var _0x5977f7=[];values=_0x4bf8;if(_0xcfd62f[_0x511d('0x3d')][_0x511d('0x44')]===_0x511d('0x45')){_0x5977f7['push'](get_open_tabs(_0x511d('0x47'),_0x4bf8[_0x511d('0x48')]));_0x5977f7['push'](get_open_tabs(_0x511d('0x49'),_0x4bf8[_0x511d('0x48')]));_0x5977f7[_0x511d('0x42')](get_open_tabs('openchannel',_0x4bf8[_0x511d('0x48')]));_0x5977f7[_0x511d('0x42')](get_open_tabs('whatsapp',_0x4bf8[_0x511d('0x48')]));_0x5977f7[_0x511d('0x42')](get_open_tabs('fax',_0x4bf8['dataValues']));_0x5977f7[_0x511d('0x42')](get_open_tabs('mail',_0x4bf8['dataValues']));return Promise[_0x511d('0x4d')](_0x5977f7);}else{return values;}})[_0x511d('0x2e')](function(){return values;})[_0x511d('0x2e')](respondWithResult(_0x5ea35e,null))[_0x511d('0x4e')](handleError(_0x5ea35e,null));};exports[_0x511d('0x1c')]=function(_0x5dc2b6,_0x26a191){if(_0x5dc2b6[_0x511d('0x55')]['id']){delete _0x5dc2b6[_0x511d('0x55')]['id'];}delete _0x5dc2b6[_0x511d('0x55')][_0x511d('0x22')];return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x5dc2b6[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x26a191,null))['then'](saveUpdates(_0x5dc2b6[_0x511d('0x55')],null))['then'](respondWithResult(_0x26a191,null))['catch'](handleError(_0x26a191,null));};exports['describe']=function(_0x572c94,_0x909857){return db['User'][_0x511d('0x56')]()[_0x511d('0x2e')](respondWithResult(_0x909857,null))['catch'](handleError(_0x909857,null));};exports[_0x511d('0x57')]=function(_0x122c69,_0xf6d731){return db[_0x511d('0x33')]['find']({'where':{'id':_0x122c69[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0xf6d731,null))['then'](function(_0x2ba218){if(_0x2ba218){return _0x2ba218[_0x511d('0x57')](_0x122c69['body'][_0x511d('0x58')],_[_0x511d('0x59')](_0x122c69[_0x511d('0x55')],[_0x511d('0x58'),'id'])||{});}})[_0x511d('0x2e')](respondWithResult(_0xf6d731,null))['catch'](handleError(_0xf6d731,null));};function validateUser(_0x40aedb){return new Promise(function(_0x1810dd,_0x125628){if(_0x40aedb[_0x511d('0x5a')])return _0x1810dd(_0x40aedb);return db[_0x511d('0x5b')][_0x511d('0x5c')](0x1)[_0x511d('0x2e')](function(_0x5f0e91){if(_0x5f0e91[_0x511d('0x5d')])authService[_0x511d('0x5e')](_0x40aedb[_0x511d('0x5f')]);db[_0x511d('0x33')][_0x511d('0x60')]('internal')[_0x511d('0x2e')](function(_0x743661){if(_[_0x511d('0x61')](_0x743661)){_0x40aedb[_0x511d('0x5a')]=_0x5f0e91[_0x511d('0x62')]||0x1;return;}if(_['isNil'](_0x5f0e91[_0x511d('0x62')])||_0x5f0e91[_0x511d('0x62')]===_0x743661){_0x40aedb[_0x511d('0x5a')]=_0x743661+0x1;return;}if(_0x5f0e91[_0x511d('0x62')]>_0x743661){_0x40aedb[_0x511d('0x5a')]=_0x5f0e91[_0x511d('0x62')];return;}return db[_0x511d('0x63')][_0x511d('0x3d')](_0x511d('0x64'),{'type':db['sequelize'][_0x511d('0x65')][_0x511d('0x66')]})[_0x511d('0x2e')](function(_0x260ec8){if(_0x260ec8&&_0x260ec8['length']){for(var _0x41080c=0x0,_0x25f910=_0x260ec8['length'];_0x41080c<_0x25f910&&_[_0x511d('0x61')](_0x40aedb['internal']);_0x41080c++){if(_0x5f0e91[_0x511d('0x62')]<=_0x260ec8[_0x41080c][_0x511d('0x67')]){_0x40aedb[_0x511d('0x5a')]=_0x260ec8[_0x41080c]['from'];}else if(_0x5f0e91[_0x511d('0x62')]>_0x260ec8[_0x41080c][_0x511d('0x67')]&&_0x5f0e91[_0x511d('0x62')]<=_0x260ec8[_0x41080c]['to']){_0x40aedb[_0x511d('0x5a')]=_0x5f0e91[_0x511d('0x62')];}}}if(_[_0x511d('0x61')](_0x40aedb['internal'])){_0x40aedb['internal']=_0x743661+0x1;}return _0x1810dd(_0x40aedb);});});})[_0x511d('0x4e')](function(_0x21bc4a){_0x125628(_0x21bc4a);});});}function updateUser(_0x4dee50){return new Promise(function(_0x2a4811,_0x2d3bf2){try{if(_0x4dee50[_0x511d('0x68')]){_0x4dee50[_0x511d('0x69')]=_0x4dee50[_0x511d('0x5a')];_0x4dee50[_0x511d('0x6a')]={'mailbox':_0x4dee50['internal'],'password':_0x4dee50['password'],'fullname':_0x4dee50[_0x511d('0x6b')],'email':_0x4dee50[_0x511d('0x6c')]};}if(_0x4dee50['role']===_0x511d('0x1d')){if(!_0x4dee50['permissions'])_0x4dee50[_0x511d('0x6d')]=[_0x511d('0x6e'),_0x511d('0x6f'),_0x511d('0x70'),_0x511d('0x71'),'110',_0x511d('0x72'),_0x511d('0x73'),_0x511d('0x74'),'107',_0x511d('0x75'),_0x511d('0x76'),_0x511d('0x77'),_0x511d('0x78'),_0x511d('0x79'),_0x511d('0x7a')];}_0x2a4811(_0x4dee50);}catch(_0x18fbdc){_0x2d3bf2(_0x18fbdc);}});}exports[_0x511d('0x7b')]=function(_0x4eab35,_0x1c5731){if(_0x4eab35[_0x511d('0x7c')][_0x511d('0x22')]===_0x511d('0x1d'))throw new Error(_0x511d('0x7d'));if(_0x4eab35[_0x511d('0x55')][_0x511d('0x22')]===_0x511d('0x7c')&&_0x4eab35['user'][_0x511d('0x22')]!==_0x511d('0x23')){throw new Error(_0x511d('0x7e'));}if(_0x4eab35[_0x511d('0x55')][_0x511d('0x22')]===_0x511d('0x23')&&_0x4eab35[_0x511d('0x7c')]['role']!==_0x511d('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x511d('0x7f')]([_0x4eab35[_0x511d('0x55')]])[_0x511d('0x2e')](function(){return validateUser(_0x4eab35['body']);})[_0x511d('0x2e')](function(_0x326f14){return updateUser(_0x326f14)[_0x511d('0x2e')](function(_0x167f33){if(_0x167f33[_0x511d('0x22')]===_0x511d('0x23')){_0x167f33[_0x511d('0x80')]=_0x4eab35[_0x511d('0x7c')]['settingsEnabled'];delete _0x167f33[_0x511d('0x81')];}return _0x167f33;});})[_0x511d('0x2e')](function(_0x19ee20){return db[_0x511d('0x33')][_0x511d('0x7b')](_0x19ee20,{'include':[{'model':db[_0x511d('0x6a')],'as':_0x511d('0x6a')}]});})['then'](function(_0x5a5c17){if(_0x4eab35[_0x511d('0x55')]['role']==='user')return _0x5a5c17;if(_0x4eab35['user'][_0x511d('0x22')]!==_0x511d('0x7c'))return _0x5a5c17;return db[_0x511d('0x82')][_0x511d('0x54')]({'where':{'name':_0x5a5c17['role']==='agent'?'Agents':'Telephones','userProfileId':_0x4eab35[_0x511d('0x7c')][_0x511d('0x81')]},'raw':!![]})['then'](function(_0x1f4bd1){if(!_0x1f4bd1||_0x1f4bd1[_0x511d('0x83')]!=0x0)return _0x5a5c17;return db[_0x511d('0x2d')][_0x511d('0x7b')]({'name':_0x5a5c17[_0x511d('0x2c')],'resourceId':_0x5a5c17['id'],'type':_0x1f4bd1['name'],'sectionId':_0x1f4bd1['id']},{})['then'](function(){return _0x5a5c17;});})['catch'](function(_0x137e34){logger[_0x511d('0x31')](_0x511d('0x84'),_0x137e34);throw _0x137e34;});})[_0x511d('0x2e')](respondWithResult(_0x1c5731,0xc9))[_0x511d('0x4e')](handleError(_0x1c5731,null));};exports['bulkCreate']=function(_0x3ccd72,_0x38188c){var _0x1b692f=_0x3ccd72['body'];var _0x4c6eb4=[];if(_0x3ccd72['user']['role']===_0x511d('0x1d'))throw new Error(_0x511d('0x7d'));if(_[_0x511d('0x85')](_0x1b692f,[_0x511d('0x22'),_0x511d('0x7c')])&&_0x3ccd72[_0x511d('0x7c')]['role']!==_0x511d('0x23')){throw new Error(_0x511d('0x7e'));}if(_[_0x511d('0x85')](_0x1b692f,['role',_0x511d('0x23')])&&_0x3ccd72[_0x511d('0x7c')][_0x511d('0x22')]!==_0x511d('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x511d('0x7f')](_0x1b692f)[_0x511d('0x2e')](function(){return validateUser(_0x1b692f[0x0]);})[_0x511d('0x2e')](function(){for(var _0x213f9c=0x1;_0x213f9c<_0x1b692f['length'];_0x213f9c++){var _0x585665=_0x1b692f[_0x213f9c-0x1]['internal'];if(!_0x1b692f[_0x213f9c]['internal'])_0x1b692f[_0x213f9c][_0x511d('0x5a')]=_0x585665+0x1;_0x4c6eb4['push'](validateUser(_0x1b692f[_0x213f9c]));}return Promise[_0x511d('0x4d')](_0x4c6eb4);})[_0x511d('0x2e')](function(){_0x4c6eb4=[];for(var _0x14c39d=0x0;_0x14c39d<_0x1b692f[_0x511d('0x86')];_0x14c39d++){_0x4c6eb4[_0x511d('0x42')](updateUser(_0x1b692f[_0x14c39d]));}return Promise['all'](_0x4c6eb4);})['then'](function(){_0x4c6eb4=_0x1b692f[_0x511d('0x29')](function(_0x2d7ebb){return db[_0x511d('0x33')][_0x511d('0x7b')](_0x2d7ebb,{'include':[{'model':db[_0x511d('0x6a')],'as':'VoiceMail'}]})['then'](function(_0x5d302c){_0x2d7ebb['id']=_0x5d302c['id'];return _0x2d7ebb;});});return Promise['all'](_0x4c6eb4);})[_0x511d('0x2e')](function(_0x52ee43){if(_0x3ccd72[_0x511d('0x55')]['role']===_0x511d('0x7c'))return _0x52ee43;if(_0x3ccd72[_0x511d('0x7c')][_0x511d('0x22')]!==_0x511d('0x7c'))return _0x52ee43;var _0xe7b324=_[_0x511d('0x85')](_0x52ee43,function(_0x522933){return _0x522933[_0x511d('0x22')]===_0x511d('0x1d')||_0x522933[_0x511d('0x22')]===_0x511d('0x26');});if(!_0xe7b324)return _0x52ee43;return db[_0x511d('0x82')]['findAll']({'where':{'name':{'$or':[_0x511d('0x25'),_0x511d('0x87')]},'userProfileId':_0x3ccd72[_0x511d('0x7c')][_0x511d('0x81')]},'raw':!![]})['then'](function(_0x4733a9){if(_[_0x511d('0x88')](_0x4733a9)||!_[_0x511d('0x85')](_0x4733a9,[_0x511d('0x83'),0x0]))return _0x52ee43;_0x4c6eb4=[];var _0x19f2a3=_(_0x4733a9)['map'](function(_0x555c68){if(_0x555c68[_0x511d('0x83')]===0x1)return;return _0x555c68[_0x511d('0x2c')]===_0x511d('0x25')?_0x511d('0x1d'):_0x511d('0x26');})[_0x511d('0x89')]()[_0x511d('0x2a')]();for(var _0x18ce11=0x0;_0x18ce11<_0x52ee43[_0x511d('0x86')];_0x18ce11++){if(!_[_0x511d('0x2b')](_0x19f2a3,_0x52ee43[_0x18ce11][_0x511d('0x22')]))return;var _0x7c7b99=_0x52ee43[_0x18ce11][_0x511d('0x22')]===_0x511d('0x1d')?'Agents':_0x511d('0x87');_0x4c6eb4[_0x511d('0x42')](db[_0x511d('0x2d')][_0x511d('0x7b')]({'name':_0x52ee43[_0x18ce11][_0x511d('0x2c')],'resourceId':_0x52ee43[_0x18ce11]['id'],'type':_0x7c7b99,'sectionId':_[_0x511d('0x54')](_0x4733a9,[_0x511d('0x2c'),_0x7c7b99])['id']},{}));}return Promise[_0x511d('0x4d')](_0x4c6eb4);});})[_0x511d('0x2e')](respondWithResult(_0x38188c,0xc9))[_0x511d('0x4e')](handleError(_0x38188c,null));};exports[_0x511d('0x8a')]=function(_0x214de7,_0x5d058c){if(_0x214de7[_0x511d('0x55')]['id']){delete _0x214de7[_0x511d('0x55')]['id'];}return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x214de7[_0x511d('0x50')]['id']}})['then'](function(_0xc5b6ad){if(!_0xc5b6ad)return null;if(_0xc5b6ad['id']===_0x214de7[_0x511d('0x7c')]['id']){if(!_0x214de7[_0x511d('0x55')][_0x511d('0x8b')]||!_0x214de7[_0x511d('0x55')][_0x511d('0x8c')]){throw new db['Sequelize'][(_0x511d('0x8d'))](_0x511d('0x8e'));}if(!_0xc5b6ad[_0x511d('0x8f')](_0x214de7[_0x511d('0x55')][_0x511d('0x8b')])){throw new db['Sequelize']['ValidationError'](_0x511d('0x90'));}if(_0x214de7[_0x511d('0x55')][_0x511d('0x8b')]===_0x214de7[_0x511d('0x55')][_0x511d('0x8c')]){throw new db['Sequelize'][(_0x511d('0x8d'))](_0x511d('0x91'));}}else if(_0x214de7[_0x511d('0x7c')]['role']===_0x511d('0x23')){if(!_0x214de7['body'][_0x511d('0x8c')]){throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))](_0x511d('0x93'));}}else if(_0x214de7[_0x511d('0x7c')][_0x511d('0x22')]==='user'){if(!_0x214de7[_0x511d('0x55')][_0x511d('0x8c')]){throw new db[(_0x511d('0x92'))]['ValidationError'](_0x511d('0x93'));}if(_0xc5b6ad[_0x511d('0x22')]!==_0x511d('0x1d')){throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))](_0x511d('0x7d'));}}else{throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))](_0x511d('0x7d'));}return _0xc5b6ad;})[_0x511d('0x2e')](handleEntityNotFound(_0x5d058c,null))[_0x511d('0x2e')](function(_0x4cf826){return db[_0x511d('0x5b')]['findOne']({'attributes':['id','securePassword',_0x511d('0x94'),_0x511d('0x95')]})['then'](function(_0x2e10c1){if(_0x2e10c1[_0x511d('0x5d')])authService[_0x511d('0x5e')](_0x214de7[_0x511d('0x55')][_0x511d('0x8c')]);if(!_0x2e10c1['enforcePasswordHistory']||!_0x4cf826['previousPasswords'])return _0x4cf826;authService[_0x511d('0x96')](_0x214de7['body'][_0x511d('0x8c')],_0x4cf826[_0x511d('0x97')],_0x2e10c1[_0x511d('0x95')]);return _0x4cf826;})[_0x511d('0x2e')](saveUpdates({'password':_0x214de7[_0x511d('0x55')]['newPassword'],'passwordResetAt':_0x214de7[_0x511d('0x7c')]['id']==_0x214de7['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x214de7[_0x511d('0x55')][_0x511d('0x8c')],_0x4cf826[_0x511d('0x97')])},null));})[_0x511d('0x2e')](respondWithResult(_0x5d058c,null))['catch'](handleError(_0x5d058c,null));};exports[_0x511d('0x98')]=function(_0x2f296e,_0x1887f5){var _0x2bfce5=_0x2f296e[_0x511d('0x55')][_0x511d('0x99')];return db['User'][_0x511d('0x54')]({'where':{'id':_0x2f296e[_0x511d('0x50')]['id']},'attributes':['id',_0x511d('0x2c'),'role',_0x511d('0x9a'),_0x511d('0x9b'),_0x511d('0x9c'),'interface']})[_0x511d('0x2e')](handleEntityNotFound(_0x1887f5,null))[_0x511d('0x2e')](function(_0x2b6132){if(_0x2b6132){if(!utils[_0x511d('0x9d')](_0x2bfce5)){throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))](_0x511d('0x9e'));}return _0x2b6132[_0x511d('0x9f')+_[_0x511d('0xa0')](_0x2bfce5[_0x511d('0xa1')]())+_0x511d('0xa2')](_0x2f296e[_0x511d('0x55')][_0x511d('0x58')],{'penalty':_0x2f296e[_0x511d('0x55')][_0x511d('0xa3')]||0x0})[_0x511d('0xa4')](function(_0x424d5c){for(var _0x404cab=0x0;_0x404cab<_0x2f296e['body'][_0x511d('0x58')][_0x511d('0x86')];_0x404cab+=0x1){var _0x341015={'UserId':Number(_0x2f296e[_0x511d('0x50')]['id'])};_0x341015[_[_0x511d('0xa0')](_0x2bfce5[_0x511d('0xa1')]())+'QueueId']=Number(_0x2f296e[_0x511d('0x55')][_0x511d('0x58')][_0x404cab]);socket[_0x511d('0x1e')](_0x511d('0x7c')+_[_0x511d('0xa0')](_0x2bfce5[_0x511d('0xa1')]())+'Queue:save',_0x341015);}return _0x424d5c;})[_0x511d('0x2e')](function(){if(_0x2bfce5===_0x511d('0xa5')){return db[_0x511d('0xa6')]['findAll']({'where':{'id':_0x2f296e['body'][_0x511d('0x58')]||[]},'raw':!![],'attributes':['id',_0x511d('0x2c')]});}})[_0x511d('0x2e')](function(_0x53fc84){var _0x518b8f=_0x2b6132[_0x511d('0x21')]({'plain':!![]});var _0x12ae72=[];if(_0x2bfce5===_0x511d('0xa5')&&_0x518b8f[_0x511d('0x22')]==='agent'&&_0x518b8f[_0x511d('0x9a')]){for(let _0x4be4bf=0x0;_0x4be4bf<_0x53fc84[_0x511d('0x86')];_0x4be4bf+=0x1){_0x12ae72[_0x511d('0x42')]({'membername':_0x518b8f[_0x511d('0x2c')],'UserId':_0x518b8f['id'],'queue_name':_0x53fc84[_0x4be4bf]['name'],'VoiceQueueId':_0x53fc84[_0x4be4bf]['id'],'interface':_[_0x511d('0x61')](_0x518b8f[_0x511d('0xa7')])?util[_0x511d('0xa8')](_0x511d('0xa9'),_0x518b8f['name']):_0x518b8f[_0x511d('0xa7')],'paused':_0x518b8f[_0x511d('0x9c')]||![],'penalty':_0x2f296e[_0x511d('0x55')][_0x511d('0xa3')]||0x0});}return Promise[_0x511d('0x4d')](_0x12ae72[_0x511d('0x29')](function(_0x117e7f){return db['UserVoiceQueueRt'][_0x511d('0xaa')](_0x117e7f);}));}return _0x2b6132;});}})[_0x511d('0x2e')](respondWithStatusCode(_0x1887f5,null))[_0x511d('0x4e')](handleError(_0x1887f5,null));};exports['removeQueues']=function(_0x167cef,_0x1bc112){var _0x1c4be5,_0x30a22e;return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x167cef['params']['id']},'attributes':['id',_0x511d('0x2c'),'role']})[_0x511d('0x2e')](handleEntityNotFound(_0x1bc112,null))['then'](function(_0x38adf3){if(_0x38adf3){_0x1c4be5=_0x38adf3;if(!_0x167cef[_0x511d('0x3d')][_0x511d('0x99')]||!utils['isValidChannel'](_0x167cef[_0x511d('0x3d')]['channel'])){throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))](_0x511d('0x9e'));}return _0x38adf3[_0x511d('0xab')+_[_0x511d('0xa0')](_0x167cef[_0x511d('0x3d')][_0x511d('0x99')][_0x511d('0xa1')]())+'Queues'](_0x167cef['query'][_0x511d('0x58')]);}})[_0x511d('0x2e')](function(_0x10148c){if(_['isArray'](_0x167cef['query']['ids'])){for(var _0x233106=0x0;_0x233106<_0x167cef[_0x511d('0x3d')][_0x511d('0x58')]['length'];_0x233106+=0x1){_0x30a22e={'UserId':Number(_0x167cef[_0x511d('0x50')]['id'])};_0x30a22e[_[_0x511d('0xa0')](_0x167cef[_0x511d('0x3d')][_0x511d('0x99')][_0x511d('0xa1')]())+_0x511d('0xac')]=Number(_0x167cef['query'][_0x511d('0x58')][_0x233106]);socket['emit'](_0x511d('0x7c')+_[_0x511d('0xa0')](_0x167cef[_0x511d('0x3d')][_0x511d('0x99')]['toLowerCase']())+_0x511d('0xad'),_0x30a22e);}}else{_0x30a22e={'UserId':Number(_0x167cef[_0x511d('0x50')]['id'])};_0x30a22e[_['capitalize'](_0x167cef[_0x511d('0x3d')]['channel'][_0x511d('0xa1')]())+_0x511d('0xac')]=Number(_0x167cef[_0x511d('0x3d')][_0x511d('0x58')]);socket[_0x511d('0x1e')](_0x511d('0x7c')+_['capitalize'](_0x167cef[_0x511d('0x3d')][_0x511d('0x99')][_0x511d('0xa1')]())+_0x511d('0xad'),_0x30a22e);}return _0x10148c;})[_0x511d('0x2e')](function(){if(_0x167cef['query'][_0x511d('0x99')]==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x167cef['params']['id'],'VoiceQueueId':_0x167cef[_0x511d('0x3d')][_0x511d('0x58')]},'individualHooks':!![]})[_0x511d('0x2e')](function(){return _0x1c4be5;});}return _0x1c4be5;})[_0x511d('0x2e')](respondWithStatusCode(_0x1bc112,null))['catch'](handleError(_0x1bc112,null));};exports[_0x511d('0xae')]=function(_0x629219,_0x26ff7b){_0x629219[_0x511d('0x55')][_0x511d('0xaf')]=_0x629219['file']['filename'];return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x629219['params']['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x26ff7b,null))[_0x511d('0x2e')](saveUpdates(_0x629219[_0x511d('0x55')],null))[_0x511d('0x2e')](respondWithResult(_0x26ff7b,null))[_0x511d('0x4e')](handleError(_0x26ff7b,null));};exports[_0x511d('0xb0')]=function(_0xeb4f38,_0x528745){var _0x1734de=path[_0x511d('0xb1')](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x511d('0x54')]({'where':{'id':_0xeb4f38[_0x511d('0x50')]['id']},'attributes':['id',_0x511d('0xaf')],'raw':!![]})[_0x511d('0x2e')](handleEntityNotFound(_0x528745,null))['then'](function(_0x1e8004){if(_0x1e8004){if(_[_0x511d('0x61')](_0x1e8004[_0x511d('0xaf')])){return _0x528745['download'](_0x1734de);}else{if(!fs[_0x511d('0xb2')](path[_0x511d('0xb1')](config[_0x511d('0xb3')],_0x511d('0xb4'),_0x1e8004[_0x511d('0xaf')]))){return _0x528745[_0x511d('0xb5')](_0x1734de);}return _0x528745[_0x511d('0xb5')](path[_0x511d('0xb1')](config['root'],_0x511d('0xb4'),_0x1e8004['userpic']));}}})[_0x511d('0x4e')](handleError(_0x528745,null));};exports[_0x511d('0xb6')]=function(_0x134dac,_0x3ff27d){return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x134dac[_0x511d('0x50')]['id']},'attributes':['id']})[_0x511d('0x2e')](handleEntityNotFound(_0x3ff27d,null))[_0x511d('0x2e')](function(_0x31422f){var _0x4cb854=[];values=_0x31422f[_0x511d('0x48')];_0x4cb854[_0x511d('0x42')](get_open_tabs(_0x511d('0x47'),_0x31422f[_0x511d('0x48')]));_0x4cb854[_0x511d('0x42')](get_open_tabs(_0x511d('0x49'),_0x31422f[_0x511d('0x48')]));_0x4cb854[_0x511d('0x42')](get_open_tabs(_0x511d('0x4b'),_0x31422f[_0x511d('0x48')]));_0x4cb854[_0x511d('0x42')](get_open_tabs('whatsapp',_0x31422f['dataValues']));_0x4cb854['push'](get_open_tabs(_0x511d('0x4a'),_0x31422f[_0x511d('0x48')]));_0x4cb854['push'](get_open_tabs(_0x511d('0xb7'),_0x31422f['dataValues']));return Promise[_0x511d('0x4d')](_0x4cb854);})[_0x511d('0x2e')](function(_0x2cb219){if(_0x2cb219){var _0x15bb99=_[_0x511d('0x29')](values['ChatOpenTabs'],function(_0x3c63f2){return{'channel':_0x511d('0xb8'),'id':_0x3c63f2['id'],'createdAt':_0x3c63f2[_0x511d('0xb9')]};});var _0x3f0af9=_[_0x511d('0x29')](values[_0x511d('0xba')],function(_0x1e1290){return{'channel':_0x511d('0xbb'),'id':_0x1e1290['id'],'createdAt':_0x1e1290[_0x511d('0xb9')]};});var _0x4207d6=_[_0x511d('0x29')](values[_0x511d('0xbc')],function(_0x132225){return{'channel':_0x511d('0xbd'),'id':_0x132225['id'],'createdAt':_0x132225[_0x511d('0xb9')]};});var _0x337ce6=_[_0x511d('0x29')](values['MailOpenTabs'],function(_0x2c7892){return{'channel':'MAIL','id':_0x2c7892['id'],'createdAt':_0x2c7892[_0x511d('0xb9')]};});var _0x3f2608=_[_0x511d('0x29')](values[_0x511d('0xbe')],function(_0x2bf732){return{'channel':_0x511d('0xbf'),'id':_0x2bf732['id'],'createdAt':_0x2bf732[_0x511d('0xb9')]};});var _0x43111a=_[_0x511d('0x29')](values[_0x511d('0xc0')],function(_0xeebae6){return{'channel':'WHATSAPP','id':_0xeebae6['id'],'createdAt':_0xeebae6[_0x511d('0xb9')]};});var _0x5bed68=_[_0x511d('0xc1')](_0x15bb99,_0x3f0af9,_0x4207d6,_0x337ce6,_0x3f2608,_0x43111a);var _0x478eee={'count':_0x5bed68[_0x511d('0x86')],'rows':_0x5bed68};return _0x478eee;}else return null;})[_0x511d('0x2e')](respondWithResult(_0x3ff27d,null))['catch'](handleError(_0x3ff27d,null));};exports['getContacts']=function(_0xadd3d5,_0x1f5841){var _0x7c2f0d={};return db['User'][_0x511d('0xc2')]({'where':{'id':_0xadd3d5[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](function(_0x3953d2){if(!_0x3953d2){throw new APINotFoundError(util[_0x511d('0xa8')](_0x511d('0xc3'),_0xadd3d5[_0x511d('0x50')]['id']));}return contacts[_0x511d('0x56')]();})[_0x511d('0x2e')](function(_0x4f896b){_0xadd3d5[_0x511d('0x3d')][_0x511d('0x33')]=_0xadd3d5[_0x511d('0x50')]['id'];_0x7c2f0d=qs[_0x511d('0x3b')](_0x4f896b,_0xadd3d5);if(_0xadd3d5[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0x3e'))){_0x7c2f0d['include']=[{'model':db[_0x511d('0xc5')],'as':'List','required':![]},{'model':db[_0x511d('0xc6')],'as':_0x511d('0xc7'),'attributes':['id','name','color'],'where':_0xadd3d5[_0x511d('0x3d')][_0x511d('0xc8')]?{'id':_0xadd3d5['query'][_0x511d('0xc8')]}:undefined,'required':_0xadd3d5[_0x511d('0x3d')][_0x511d('0xc8')]?!![]:![]}];}return contacts[_0x511d('0x43')](_0xadd3d5[_0x511d('0x3d')],_0xadd3d5['user'],_0x7c2f0d,_0x4f896b);})[_0x511d('0x2e')](respondWithFilteredResult(_0x1f5841,_0x7c2f0d))[_0x511d('0x4e')](APIHandleError(_0x1f5841));};exports['getQueues']=function(_0x19a4d3,_0x138eaf){var _0x12799c;var _0x21e328={};var _0x5aff0c;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x19a4d3[_0x511d('0x50')]['id']},'attributes':['id',_0x511d('0x2c'),_0x511d('0x22')]})[_0x511d('0x2e')](handleEntityNotFound(_0x138eaf,null))[_0x511d('0x2e')](function(_0x351fe2){if(!utils[_0x511d('0x9d')](_0x19a4d3['query'][_0x511d('0x99')])){throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))]('Unknown\x20channel');}_0x12799c=_0x351fe2;var _0x1232e6={};_0x1232e6[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_[_0x511d('0xa0')](_0x19a4d3['query'][_0x511d('0x99')])+'Queue'][_0x511d('0x34')]);_0x1232e6[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x19a4d3[_0x511d('0x3d')]);_0x1232e6['filters']=_[_0x511d('0xcb')](_0x1232e6['model'],_0x1232e6[_0x511d('0x3d')]);_0x21e328[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x1232e6[_0x511d('0xc9')],qs['fields'](_0x19a4d3['query'][_0x511d('0xcc')]));_0x21e328[_0x511d('0x41')]=_0x21e328[_0x511d('0x41')]['length']?_0x21e328[_0x511d('0x41')]:_0x1232e6[_0x511d('0xc9')];_0x21e328[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x19a4d3[_0x511d('0x3d')]['sort']);_0x21e328[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x19a4d3['query'],_0x1232e6[_0x511d('0xcf')]));if(_0x19a4d3[_0x511d('0x3d')][_0x511d('0x27')]){_0x21e328[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x21e328['where'],{'$or':_['map'](_0x21e328[_0x511d('0x41')],function(_0x5b8d6b){var _0x42dd28={};_0x42dd28[_0x5b8d6b]={'$like':'%'+_0x19a4d3[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x42dd28;})});}_0x21e328=_[_0x511d('0x52')]({},_0x21e328,_0x19a4d3[_0x511d('0x53')]);switch(_0x12799c[_0x511d('0x22')]){case _0x511d('0x23'):return db[_['capitalize'](_0x19a4d3['query']['channel'])+'Queue'][_0x511d('0x43')](_0x21e328);case _0x511d('0x7c'):case'agent':return _0x12799c['get'+_[_0x511d('0xa0')](_0x19a4d3[_0x511d('0x3d')][_0x511d('0x99')])+'Queues'](_0x21e328);default:throw new db[(_0x511d('0x92'))][(_0x511d('0x8d'))]('Unknown\x20role');}})[_0x511d('0x2e')](function(_0xbe5ecf){_0x5aff0c=_0xbe5ecf[_0x511d('0x86')];if(!_0x19a4d3[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0xd1'))){_0x21e328[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x19a4d3[_0x511d('0x3d')][_0x511d('0x18')]);_0x21e328[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x19a4d3[_0x511d('0x3d')][_0x511d('0x16')]);}switch(_0x12799c[_0x511d('0x22')]){case _0x511d('0x23'):return db[_[_0x511d('0xa0')](_0x19a4d3[_0x511d('0x3d')][_0x511d('0x99')])+_0x511d('0xd2')]['findAll'](_0x21e328);case'user':case _0x511d('0x1d'):return _0x12799c[_0x511d('0x21')+_['capitalize'](_0x19a4d3[_0x511d('0x3d')][_0x511d('0x99')])+'Queues'](_0x21e328);}})['then'](function(_0x637542){return{'count':_0x5aff0c,'rows':_0x637542};})[_0x511d('0x2e')](respondWithResult(_0x138eaf,null))['catch'](handleError(_0x138eaf,null));};exports[_0x511d('0xd3')]=function(_0x5e243b,_0x2466b9){var _0x4ba190={};var _0x4927f1={};var _0x504d20;var _0x1d1cec;return db['User'][_0x511d('0xc2')]({'where':{'id':_0x5e243b[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x2466b9,null))[_0x511d('0x2e')](function(_0x1daed8){if(_0x1daed8){_0x504d20=_0x1daed8;_0x4927f1[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xd4')][_0x511d('0x34')]);_0x4927f1[_0x511d('0x3d')]=_['keys'](_0x5e243b[_0x511d('0x3d')]);_0x4927f1['filters']=_[_0x511d('0xcb')](_0x4927f1[_0x511d('0xc9')],_0x4927f1['query']);_0x4ba190[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x4927f1['model'],qs[_0x511d('0xcc')](_0x5e243b[_0x511d('0x3d')][_0x511d('0xcc')]));_0x4ba190[_0x511d('0x41')]=_0x4ba190[_0x511d('0x41')]['length']?_0x4ba190[_0x511d('0x41')]:_0x4927f1[_0x511d('0xc9')];_0x4ba190[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x5e243b[_0x511d('0x3d')]['sort']);_0x4ba190[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x5e243b['query'],_0x4927f1[_0x511d('0xcf')]));if(_0x5e243b[_0x511d('0x3d')][_0x511d('0x27')]){_0x4ba190['where']=_[_0x511d('0x52')](_0x4ba190[_0x511d('0x3c')],{'$or':_['map'](_0x4ba190[_0x511d('0x41')],function(_0x2571c6){var _0x42ac93={};_0x42ac93[_0x2571c6]={'$like':'%'+_0x5e243b[_0x511d('0x3d')]['filter']+'%'};return _0x42ac93;})});}_0x4ba190=_[_0x511d('0x52')]({},_0x4ba190,_0x5e243b['options']);return _0x504d20['getVoiceQueuesRt'](_0x4ba190);}})['then'](function(_0x334903){if(_0x334903){_0x1d1cec=_0x334903[_0x511d('0x86')];if(!_0x5e243b[_0x511d('0x3d')][_0x511d('0xc4')]('nolimit')){_0x4ba190[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x5e243b[_0x511d('0x3d')]['limit']);_0x4ba190[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x5e243b['query']['offset']);}return _0x504d20['getVoiceQueuesRt'](_0x4ba190);}})[_0x511d('0x2e')](function(_0x4f9525){if(_0x4f9525){return _0x4f9525?{'count':_0x1d1cec,'rows':_0x4f9525}:null;}})[_0x511d('0x2e')](respondWithResult(_0x2466b9,null))[_0x511d('0x4e')](handleError(_0x2466b9,null));};exports[_0x511d('0xd5')]=function(_0x266df8,_0x1be517){var _0x109517={};var _0x19c008={};var _0x4a4478;var _0x5e8532;return db[_0x511d('0x33')]['findOne']({'where':{'id':_0x266df8[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x1be517,null))['then'](function(_0x430c8e){if(_0x430c8e){_0x4a4478=_0x430c8e;_0x19c008[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xd6')]['rawAttributes']);_0x19c008[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x266df8[_0x511d('0x3d')]);_0x19c008[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x19c008[_0x511d('0xc9')],_0x19c008[_0x511d('0x3d')]);_0x109517['attributes']=_[_0x511d('0xcb')](_0x19c008[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x266df8['query'][_0x511d('0xcc')]));_0x109517[_0x511d('0x41')]=_0x109517['attributes']['length']?_0x109517[_0x511d('0x41')]:_0x19c008[_0x511d('0xc9')];_0x109517[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x266df8[_0x511d('0x3d')]['sort']);_0x109517[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x266df8[_0x511d('0x3d')],_0x19c008[_0x511d('0xcf')]));if(_0x266df8['query'][_0x511d('0x27')]){_0x109517['where']=_['merge'](_0x109517[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x109517[_0x511d('0x41')],function(_0x20ed51){var _0x5b5672={};_0x5b5672[_0x20ed51]={'$like':'%'+_0x266df8[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x5b5672;})});}_0x109517=_['merge']({},_0x109517,_0x266df8['options']);return _0x4a4478[_0x511d('0xd5')](_0x109517);}})[_0x511d('0x2e')](function(_0x846dbc){if(_0x846dbc){_0x5e8532=_0x846dbc[_0x511d('0x86')];if(!_0x266df8[_0x511d('0x3d')][_0x511d('0xc4')]('nolimit')){_0x109517[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x266df8[_0x511d('0x3d')][_0x511d('0x18')]);_0x109517[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x266df8[_0x511d('0x3d')][_0x511d('0x16')]);}return _0x4a4478[_0x511d('0xd5')](_0x109517);}})['then'](function(_0x798e97){if(_0x798e97){return _0x798e97?{'count':_0x5e8532,'rows':_0x798e97}:null;}})[_0x511d('0x2e')](respondWithResult(_0x1be517,null))[_0x511d('0x4e')](handleError(_0x1be517,null));};exports[_0x511d('0xd7')]=function(_0x1d7e42,_0x2cf97e){var _0x49e3a1={'raw':!![],'where':{}};var _0x41abdd={};var _0x2d2f1c={'count':0x0,'rows':[]};return db['User'][_0x511d('0xc2')]({'where':{'id':_0x1d7e42[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x2cf97e,null))[_0x511d('0x2e')](function(_0x278d1e){if(_0x278d1e){_0x41abdd[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xd8')][_0x511d('0x34')]);_0x41abdd[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x1d7e42[_0x511d('0x3d')]);_0x41abdd[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x41abdd[_0x511d('0xc9')],_0x41abdd[_0x511d('0x3d')]);_0x49e3a1[_0x511d('0x41')]=_['intersection'](_0x41abdd[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x1d7e42[_0x511d('0x3d')][_0x511d('0xcc')]));_0x49e3a1[_0x511d('0x41')]=_0x49e3a1[_0x511d('0x41')][_0x511d('0x86')]?_0x49e3a1['attributes']:_0x41abdd['model'];if(!_0x1d7e42[_0x511d('0x3d')]['hasOwnProperty'](_0x511d('0xd1'))){_0x49e3a1[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x1d7e42[_0x511d('0x3d')][_0x511d('0x18')]);_0x49e3a1[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x1d7e42[_0x511d('0x3d')]['offset']);}_0x49e3a1['order']=qs[_0x511d('0xce')](_0x1d7e42[_0x511d('0x3d')][_0x511d('0xce')]);_0x49e3a1[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x1d7e42[_0x511d('0x3d')],_0x41abdd[_0x511d('0xcf')]));_0x49e3a1[_0x511d('0x3c')][_0x511d('0xd9')]=_0x278d1e['id'];if(_0x1d7e42[_0x511d('0x3d')]['filter']){_0x49e3a1[_0x511d('0x3c')]=_['merge'](_0x49e3a1[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x49e3a1[_0x511d('0x41')],function(_0x43ef1e){var _0x5b1c5f={};_0x5b1c5f[_0x43ef1e]={'$like':'%'+_0x1d7e42[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x5b1c5f;})});}_0x49e3a1=_[_0x511d('0x52')]({},_0x49e3a1,_0x1d7e42[_0x511d('0x53')]);return db[_0x511d('0xd8')]['count']({'where':_0x49e3a1[_0x511d('0x3c')]})['then'](function(_0x13db8a){_0x2d2f1c['count']=_0x13db8a;if(_0x1d7e42[_0x511d('0x3d')][_0x511d('0x3e')]){_0x49e3a1[_0x511d('0x40')]=[{'all':!![]}];}return db[_0x511d('0xd8')][_0x511d('0x43')](_0x49e3a1);})[_0x511d('0x2e')](function(_0x5b29eb){_0x2d2f1c['rows']=_0x5b29eb;return _0x2d2f1c;});}})[_0x511d('0x2e')](respondWithFilteredResult(_0x2cf97e,_0x49e3a1))[_0x511d('0x4e')](handleError(_0x2cf97e,null));};exports[_0x511d('0xda')]=function(_0x396f6d,_0x1c6cf6){var _0x2bb7f3={'raw':!![],'where':{}};var _0xa5e348={};var _0x238be5={'count':0x0,'rows':[]};return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x396f6d['params']['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x1c6cf6,null))[_0x511d('0x2e')](function(_0x1f572c){if(_0x1f572c){_0xa5e348[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xdb')][_0x511d('0x34')]);_0xa5e348[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x396f6d['query']);_0xa5e348[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0xa5e348[_0x511d('0xc9')],_0xa5e348[_0x511d('0x3d')]);_0x2bb7f3[_0x511d('0x41')]=_[_0x511d('0xcb')](_0xa5e348[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x396f6d[_0x511d('0x3d')][_0x511d('0xcc')]));_0x2bb7f3['attributes']=_0x2bb7f3['attributes'][_0x511d('0x86')]?_0x2bb7f3[_0x511d('0x41')]:_0xa5e348[_0x511d('0xc9')];if(!_0x396f6d['query']['hasOwnProperty'](_0x511d('0xd1'))){_0x2bb7f3['limit']=qs[_0x511d('0x18')](_0x396f6d['query'][_0x511d('0x18')]);_0x2bb7f3[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x396f6d['query'][_0x511d('0x16')]);}_0x2bb7f3['order']=qs['sort'](_0x396f6d['query']['sort']);_0x2bb7f3['where']=qs[_0x511d('0xcf')](_['pick'](_0x396f6d[_0x511d('0x3d')],_0xa5e348[_0x511d('0xcf')]));_0x2bb7f3['where'][_0x511d('0xd9')]=_0x1f572c['id'];if(_0x396f6d[_0x511d('0x3d')][_0x511d('0x27')]){_0x2bb7f3[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x2bb7f3[_0x511d('0x3c')],{'$or':_['map'](_0x2bb7f3[_0x511d('0x41')],function(_0x4c3635){var _0x4e1f3e={};_0x4e1f3e[_0x4c3635]={'$like':'%'+_0x396f6d[_0x511d('0x3d')]['filter']+'%'};return _0x4e1f3e;})});}_0x2bb7f3=_[_0x511d('0x52')]({},_0x2bb7f3,_0x396f6d[_0x511d('0x53')]);return db['ScreenRecording'][_0x511d('0x19')]({'where':_0x2bb7f3['where']})['then'](function(_0xc6c4c4){_0x238be5['count']=_0xc6c4c4;if(_0x396f6d[_0x511d('0x3d')][_0x511d('0x3e')]){_0x2bb7f3[_0x511d('0x40')]=[{'all':!![]}];}return db[_0x511d('0xdb')][_0x511d('0x43')](_0x2bb7f3);})[_0x511d('0x2e')](function(_0x44575e){_0x238be5[_0x511d('0x46')]=_0x44575e;return _0x238be5;});}})[_0x511d('0x2e')](respondWithFilteredResult(_0x1c6cf6,_0x2bb7f3))[_0x511d('0x4e')](handleError(_0x1c6cf6,null));};exports[_0x511d('0xdc')]=function(_0x5ebb48,_0x8e297b){var _0x4ff635={};var _0x258d57={};var _0x5e77df;var _0x3b63ca;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x5ebb48[_0x511d('0x50')]['id']}})['then'](handleEntityNotFound(_0x8e297b,null))[_0x511d('0x2e')](function(_0xfd8cfc){if(_0xfd8cfc){_0x5e77df=_0xfd8cfc;_0x258d57[_0x511d('0xc9')]=_['keys'](db[_0x511d('0xdd')]['rawAttributes']);_0x258d57[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x5ebb48[_0x511d('0x3d')]);_0x258d57['filters']=_[_0x511d('0xcb')](_0x258d57['model'],_0x258d57[_0x511d('0x3d')]);_0x4ff635[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x258d57['model'],qs[_0x511d('0xcc')](_0x5ebb48[_0x511d('0x3d')][_0x511d('0xcc')]));_0x4ff635[_0x511d('0x41')]=_0x4ff635[_0x511d('0x41')][_0x511d('0x86')]?_0x4ff635[_0x511d('0x41')]:_0x258d57[_0x511d('0xc9')];_0x4ff635[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x5ebb48['query'][_0x511d('0xce')]);_0x4ff635['where']=qs['filters'](_[_0x511d('0xd0')](_0x5ebb48[_0x511d('0x3d')],_0x258d57[_0x511d('0xcf')]));if(_0x5ebb48[_0x511d('0x3d')][_0x511d('0x27')]){_0x4ff635[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x4ff635[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x4ff635['attributes'],function(_0xa26715){var _0x5f307e={};_0x5f307e[_0xa26715]={'$like':'%'+_0x5ebb48[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x5f307e;})});}_0x4ff635=_[_0x511d('0x52')]({},_0x4ff635,_0x5ebb48['options']);return _0x5e77df['getChatInteractions'](_0x4ff635);}})[_0x511d('0x2e')](function(_0x5c56dc){if(_0x5c56dc){_0x3b63ca=_0x5c56dc[_0x511d('0x86')];if(!_0x5ebb48[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0xd1'))){_0x4ff635['limit']=qs[_0x511d('0x18')](_0x5ebb48['query'][_0x511d('0x18')]);_0x4ff635[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x5ebb48[_0x511d('0x3d')]['offset']);}return _0x5e77df[_0x511d('0xdc')](_0x4ff635);}})[_0x511d('0x2e')](function(_0x53a8e0){if(_0x53a8e0){return _0x53a8e0?{'count':_0x3b63ca,'rows':_0x53a8e0}:null;}})[_0x511d('0x2e')](respondWithResult(_0x8e297b,null))[_0x511d('0x4e')](handleError(_0x8e297b,null));};exports['getOpenchannelInteractions']=function(_0x16a56f,_0x2885b4){var _0xfc92b8={};var _0x5f179a={};var _0xdedc2;var _0x5d3af8;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x16a56f['params']['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x2885b4,null))['then'](function(_0x3ecb3d){if(_0x3ecb3d){_0xdedc2=_0x3ecb3d;_0x5f179a[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xde')][_0x511d('0x34')]);_0x5f179a[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x16a56f[_0x511d('0x3d')]);_0x5f179a[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x5f179a['model'],_0x5f179a[_0x511d('0x3d')]);_0xfc92b8['attributes']=_['intersection'](_0x5f179a[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x16a56f[_0x511d('0x3d')]['fields']));_0xfc92b8[_0x511d('0x41')]=_0xfc92b8[_0x511d('0x41')][_0x511d('0x86')]?_0xfc92b8[_0x511d('0x41')]:_0x5f179a['model'];_0xfc92b8[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x16a56f[_0x511d('0x3d')]['sort']);_0xfc92b8[_0x511d('0x3c')]=qs['filters'](_[_0x511d('0xd0')](_0x16a56f['query'],_0x5f179a['filters']));if(_0x16a56f[_0x511d('0x3d')][_0x511d('0x27')]){_0xfc92b8['where']=_[_0x511d('0x52')](_0xfc92b8[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0xfc92b8['attributes'],function(_0xc381c4){var _0x2f6588={};_0x2f6588[_0xc381c4]={'$like':'%'+_0x16a56f['query'][_0x511d('0x27')]+'%'};return _0x2f6588;})});}_0xfc92b8=_[_0x511d('0x52')]({},_0xfc92b8,_0x16a56f[_0x511d('0x53')]);return _0xdedc2['getOpenchannelInteractions'](_0xfc92b8);}})['then'](function(_0x30e0ae){if(_0x30e0ae){_0x5d3af8=_0x30e0ae['length'];if(!_0x16a56f[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0xd1'))){_0xfc92b8[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x16a56f[_0x511d('0x3d')]['limit']);_0xfc92b8['offset']=qs[_0x511d('0x16')](_0x16a56f[_0x511d('0x3d')]['offset']);}return _0xdedc2['getOpenchannelInteractions'](_0xfc92b8);}})[_0x511d('0x2e')](function(_0x370e17){if(_0x370e17){return _0x370e17?{'count':_0x5d3af8,'rows':_0x370e17}:null;}})[_0x511d('0x2e')](respondWithResult(_0x2885b4,null))['catch'](handleError(_0x2885b4,null));};exports['getMailInteractions']=function(_0x5505fe,_0x298713){var _0x140e48={'raw':!![],'where':{}};var _0x58d758={};var _0x2716de={'count':0x0,'rows':[]};return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x5505fe[_0x511d('0x50')]['id']}})['then'](handleEntityNotFound(_0x298713,null))[_0x511d('0x2e')](function(_0x215b2d){if(_0x215b2d){_0x58d758[_0x511d('0xc9')]=_['keys'](db['MailInteraction'][_0x511d('0x34')]);_0x58d758[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x5505fe['query']);_0x58d758[_0x511d('0xcf')]=_['intersection'](_0x58d758[_0x511d('0xc9')],_0x58d758[_0x511d('0x3d')]);_0x140e48['attributes']=_[_0x511d('0xcb')](_0x58d758[_0x511d('0xc9')],qs['fields'](_0x5505fe[_0x511d('0x3d')][_0x511d('0xcc')]));_0x140e48[_0x511d('0x41')]=_0x140e48[_0x511d('0x41')]['length']?_0x140e48[_0x511d('0x41')]:_0x58d758['model'];if(!_0x5505fe['query'][_0x511d('0xc4')]('nolimit')){_0x140e48[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x5505fe[_0x511d('0x3d')][_0x511d('0x18')]);_0x140e48[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x5505fe['query']['offset']);}_0x140e48['order']=qs[_0x511d('0xce')](_0x5505fe[_0x511d('0x3d')][_0x511d('0xce')]);_0x140e48[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x5505fe[_0x511d('0x3d')],_0x58d758['filters']));_0x140e48[_0x511d('0x3c')][_0x511d('0xd9')]=_0x215b2d['id'];if(_0x5505fe[_0x511d('0x3d')][_0x511d('0x27')]){_0x140e48[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x140e48[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x140e48[_0x511d('0x41')],function(_0x24241f){var _0x3c049f={};_0x3c049f[_0x24241f]={'$like':'%'+_0x5505fe[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x3c049f;})});}_0x140e48=_[_0x511d('0x52')]({},_0x140e48,_0x5505fe['options']);return db[_0x511d('0xdf')][_0x511d('0x19')]({'where':_0x140e48[_0x511d('0x3c')]})[_0x511d('0x2e')](function(_0x164668){_0x2716de[_0x511d('0x19')]=_0x164668;if(_0x5505fe[_0x511d('0x3d')]['includeAll']){_0x140e48[_0x511d('0x40')]=[{'all':!![]}];}return db[_0x511d('0xdf')][_0x511d('0x43')](_0x140e48);})[_0x511d('0x2e')](function(_0x42c498){_0x2716de['rows']=_0x42c498;return _0x2716de;});}})[_0x511d('0x2e')](respondWithFilteredResult(_0x298713,_0x140e48))[_0x511d('0x4e')](handleError(_0x298713,null));};exports['getSmsInteractions']=function(_0x1ea31c,_0x332454){var _0x540307={};var _0x2fafe5={};var _0x2fa1f0;var _0x524824;return db[_0x511d('0x33')]['findOne']({'where':{'id':_0x1ea31c[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x332454,null))['then'](function(_0x442796){if(_0x442796){_0x2fa1f0=_0x442796;_0x2fafe5[_0x511d('0xc9')]=_['keys'](db[_0x511d('0xe0')][_0x511d('0x34')]);_0x2fafe5[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x1ea31c[_0x511d('0x3d')]);_0x2fafe5[_0x511d('0xcf')]=_['intersection'](_0x2fafe5['model'],_0x2fafe5['query']);_0x540307[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x2fafe5[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x1ea31c['query'][_0x511d('0xcc')]));_0x540307[_0x511d('0x41')]=_0x540307[_0x511d('0x41')]['length']?_0x540307[_0x511d('0x41')]:_0x2fafe5[_0x511d('0xc9')];_0x540307[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x1ea31c[_0x511d('0x3d')]['sort']);_0x540307[_0x511d('0x3c')]=qs['filters'](_[_0x511d('0xd0')](_0x1ea31c[_0x511d('0x3d')],_0x2fafe5[_0x511d('0xcf')]));if(_0x1ea31c['query'][_0x511d('0x27')]){_0x540307[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x540307[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x540307[_0x511d('0x41')],function(_0x6fb807){var _0x108f65={};_0x108f65[_0x6fb807]={'$like':'%'+_0x1ea31c[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x108f65;})});}_0x540307=_[_0x511d('0x52')]({},_0x540307,_0x1ea31c[_0x511d('0x53')]);return _0x2fa1f0[_0x511d('0xe1')](_0x540307);}})[_0x511d('0x2e')](function(_0x1a9cf9){if(_0x1a9cf9){_0x524824=_0x1a9cf9[_0x511d('0x86')];if(!_0x1ea31c[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0xd1'))){_0x540307[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x1ea31c[_0x511d('0x3d')][_0x511d('0x18')]);_0x540307[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x1ea31c['query'][_0x511d('0x16')]);}return _0x2fa1f0['getSmsInteractions'](_0x540307);}})[_0x511d('0x2e')](function(_0x223686){if(_0x223686){return _0x223686?{'count':_0x524824,'rows':_0x223686}:null;}})[_0x511d('0x2e')](respondWithResult(_0x332454,null))[_0x511d('0x4e')](handleError(_0x332454,null));};exports[_0x511d('0xe2')]=function(_0x386748,_0x58746e){var _0x1f0a7e={};var _0x470538={};var _0x23b55b;var _0x1880ed;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x386748[_0x511d('0x50')]['id']}})['then'](handleEntityNotFound(_0x58746e,null))[_0x511d('0x2e')](function(_0x2f46e7){if(_0x2f46e7){_0x23b55b=_0x2f46e7;_0x470538[_0x511d('0xc9')]=_['keys'](db[_0x511d('0xe3')][_0x511d('0x34')]);_0x470538['query']=_['keys'](_0x386748[_0x511d('0x3d')]);_0x470538[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x470538['model'],_0x470538[_0x511d('0x3d')]);_0x1f0a7e[_0x511d('0x41')]=_['intersection'](_0x470538[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x386748['query'][_0x511d('0xcc')]));_0x1f0a7e['attributes']=_0x1f0a7e[_0x511d('0x41')][_0x511d('0x86')]?_0x1f0a7e['attributes']:_0x470538[_0x511d('0xc9')];_0x1f0a7e[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x386748[_0x511d('0x3d')]['sort']);_0x1f0a7e[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x386748[_0x511d('0x3d')],_0x470538[_0x511d('0xcf')]));if(_0x386748['query'][_0x511d('0x27')]){_0x1f0a7e[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x1f0a7e['where'],{'$or':_[_0x511d('0x29')](_0x1f0a7e[_0x511d('0x41')],function(_0xd7aba5){var _0x3ab215={};_0x3ab215[_0xd7aba5]={'$like':'%'+_0x386748[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x3ab215;})});}_0x1f0a7e=_[_0x511d('0x52')]({},_0x1f0a7e,_0x386748['options']);return _0x23b55b[_0x511d('0xe2')](_0x1f0a7e);}})['then'](function(_0x54cd9b){if(_0x54cd9b){_0x1880ed=_0x54cd9b[_0x511d('0x86')];if(!_0x386748['query']['hasOwnProperty'](_0x511d('0xd1'))){_0x1f0a7e[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x386748[_0x511d('0x3d')][_0x511d('0x18')]);_0x1f0a7e[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x386748[_0x511d('0x3d')][_0x511d('0x16')]);}return _0x23b55b['getFaxInteractions'](_0x1f0a7e);}})[_0x511d('0x2e')](function(_0x5308cb){if(_0x5308cb){return _0x5308cb?{'count':_0x1880ed,'rows':_0x5308cb}:null;}})['then'](respondWithResult(_0x58746e,null))[_0x511d('0x4e')](handleError(_0x58746e,null));};exports[_0x511d('0xe4')]=function(_0x43697d,_0x4a4be9){var _0x198a0d={};var _0x116538={};var _0x2421e3;var _0x2e2b3f;return db['User']['findOne']({'where':{'id':_0x43697d[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x4a4be9,null))[_0x511d('0x2e')](function(_0x2fbb40){if(_0x2fbb40){_0x2421e3=_0x2fbb40;_0x116538['model']=_[_0x511d('0xca')](db[_0x511d('0xe5')]['rawAttributes']);_0x116538[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x43697d[_0x511d('0x3d')]);_0x116538[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x116538[_0x511d('0xc9')],_0x116538[_0x511d('0x3d')]);_0x198a0d[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x116538[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x43697d[_0x511d('0x3d')][_0x511d('0xcc')]));_0x198a0d[_0x511d('0x41')]=_0x198a0d[_0x511d('0x41')]['length']?_0x198a0d[_0x511d('0x41')]:_0x116538[_0x511d('0xc9')];_0x198a0d[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x43697d[_0x511d('0x3d')]['sort']);_0x198a0d[_0x511d('0x3c')]=qs['filters'](_[_0x511d('0xd0')](_0x43697d[_0x511d('0x3d')],_0x116538[_0x511d('0xcf')]));if(_0x43697d['query'][_0x511d('0x27')]){_0x198a0d['where']=_[_0x511d('0x52')](_0x198a0d['where'],{'$or':_[_0x511d('0x29')](_0x198a0d[_0x511d('0x41')],function(_0x1d887c){var _0x4b24b7={};_0x4b24b7[_0x1d887c]={'$like':'%'+_0x43697d[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x4b24b7;})});}_0x198a0d=_[_0x511d('0x52')]({},_0x198a0d,_0x43697d[_0x511d('0x53')]);return _0x2421e3[_0x511d('0xe4')](_0x198a0d);}})[_0x511d('0x2e')](function(_0x1a9b4c){if(_0x1a9b4c){_0x2e2b3f=_0x1a9b4c[_0x511d('0x86')];if(!_0x43697d[_0x511d('0x3d')]['hasOwnProperty'](_0x511d('0xd1'))){_0x198a0d[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x43697d[_0x511d('0x3d')][_0x511d('0x18')]);_0x198a0d[_0x511d('0x16')]=qs['offset'](_0x43697d[_0x511d('0x3d')]['offset']);}return _0x2421e3['getWhatsappInteractions'](_0x198a0d);}})[_0x511d('0x2e')](function(_0x1f54bd){if(_0x1f54bd){return _0x1f54bd?{'count':_0x2e2b3f,'rows':_0x1f54bd}:null;}})['then'](respondWithResult(_0x4a4be9,null))['catch'](handleError(_0x4a4be9,null));};exports[_0x511d('0xe6')]=function(_0x415a04,_0x30194b,_0x28bb87){var _0x171c1b;var _0x5c7f6c;var _0xe0055f;var _0x84d51f=!_[_0x511d('0x61')](_0x415a04[_0x511d('0x50')]['id'])?_0x415a04['params']['id']:!_[_0x511d('0x61')](_0x415a04['user']['id'])?_0x415a04[_0x511d('0x7c')]['id']:null;return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x84d51f,'role':{'$or':[_0x511d('0x23'),_0x511d('0x7c'),'agent']}},'attributes':['id','name','phone','mobile',_0x511d('0x22'),'internal','loginInPause']})[_0x511d('0x2e')](function(_0x5b4bcc){if(_0x5b4bcc){if(_0x5b4bcc[_0x511d('0x22')]===_0x511d('0x1d')){_0x171c1b=_0x5b4bcc;if(_0x415a04[_0x511d('0x55')][_0x511d('0xa7')]){_0xe0055f=util['format']('LOCAL/%s@from-sip/n',_0x171c1b[_0x415a04[_0x511d('0x55')][_0x511d('0xa7')]]);}else if(_0x415a04[_0x511d('0x55')]['intrf']){_0xe0055f=util['format'](_0x511d('0xa9'),_0x415a04[_0x511d('0x55')]['intrf']);}else{_0xe0055f=util[_0x511d('0xa8')](_0x511d('0xa9'),_0x171c1b[_0x511d('0x2c')]);}socket['to'](util[_0x511d('0xa8')]('user:%s',_0x171c1b[_0x511d('0x2c')]))[_0x511d('0x1e')](_0x511d('0xe7'),{'user':{'id':_0x171c1b['id'],'name':_0x171c1b[_0x511d('0x2c')]},'ip':_0x415a04[_0x511d('0xe8')]['x-forwarded-for']||_0x415a04[_0x511d('0xe9')]['remoteAddress']||_0x415a04['socket']['remoteAddress']||_0x415a04[_0x511d('0xe9')][_0x511d('0xea')][_0x511d('0xeb')]});return db['UserVoiceQueueRt'][_0x511d('0x20')]({'where':{'membername':_0x171c1b[_0x511d('0x2c')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x511d('0xec'));}})[_0x511d('0x2e')](function(){if(_0x171c1b){return _0x171c1b[_0x511d('0xed')]({'raw':!![]});}})[_0x511d('0x2e')](function(_0x42b44d){if(_0x171c1b){if(_0x42b44d){_0x5c7f6c=_0x42b44d;if(_0x5c7f6c['length']){var _0x1b5cba=_0x5c7f6c[_0x511d('0x29')](function(_0x1450eb){var _0x423b9={'membername':_0x171c1b[_0x511d('0x2c')],'UserId':_0x171c1b['id'],'queue_name':_0x1450eb['name'],'VoiceQueueId':_0x1450eb['id'],'interface':_0xe0055f,'paused':_0x171c1b['loginInPause']||![],'penalty':_0x1450eb[_0x511d('0xee')]||0x0};return db[_0x511d('0xd4')][_0x511d('0xaa')](_0x423b9);});return Promise[_0x511d('0x4d')](_0x1b5cba);}}}})['then'](function(){if(_0x171c1b){return db[_0x511d('0xef')]['findAll']({'where':{'membername':_0x171c1b[_0x511d('0x2c')],'exitAt':null}});}})[_0x511d('0x2e')](function(_0x28cbf3){if(_0x171c1b){var _0x4a51ac=[];_0x28cbf3[_0x511d('0xf0')](function(_0x1b0003){_0x4a51ac['push'](_0x1b0003[_0x511d('0x1c')]({'exitAt':moment()[_0x511d('0xa8')](_0x511d('0xf1'))}));});return Promise[_0x511d('0x4d')](_0x4a51ac);}})[_0x511d('0x2e')](function(){if(_0x171c1b){var _0x3a2ee8=[];var _0x2fa2fa=[];var _0x423f51=utils[_0x511d('0xf2')]();var _0xcd643f={'membername':_0x171c1b['name'],'interface':_0xe0055f,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x171c1b['role'],'internal':_0x171c1b['internal']};_0x423f51[_0x511d('0xf0')](function(_0x2c2db3){_0x3a2ee8[_0x511d('0x42')](_[_0x511d('0x52')]({'channel':_0x2c2db3,'type':_0x511d('0xf3'),'data1':_0x415a04['body'][_0x511d('0xf4')],'data2':_0xe0055f},_0xcd643f));if(_0x171c1b['loginInPause']){_0x2fa2fa[_0x511d('0x42')](_[_0x511d('0x52')]({'channel':_0x2c2db3,'type':_0x511d('0xf5'),'data1':_0x511d('0xf6')},_0xcd643f));}});return db[_0x511d('0xef')][_0x511d('0xf7')](_0x3a2ee8['concat'](_0x2fa2fa),{'individualHooks':!![]});}})[_0x511d('0x2e')](function(){if(_0x171c1b){return _0x171c1b[_0x511d('0x1c')]({'online':!![],'lastLoginAt':moment()[_0x511d('0xa8')](_0x511d('0xf1')),'voicePause':_0x171c1b[_0x511d('0x9b')]||![],'mailPause':_0x171c1b[_0x511d('0x9b')]||![],'chatPause':_0x171c1b[_0x511d('0x9b')]||![],'faxPause':_0x171c1b[_0x511d('0x9b')]||![],'smsPause':_0x171c1b[_0x511d('0x9b')]||![],'openchannelPause':_0x171c1b[_0x511d('0x9b')]||![],'whatsappPause':_0x171c1b['loginInPause']||![],'pauseType':_0x171c1b[_0x511d('0x9b')]?_0x511d('0xf6'):null,'interface':_0xe0055f,'lastPauseAt':moment()['format'](_0x511d('0xf1'))});}})[_0x511d('0x2e')](function(_0x49f7df){if(_0x415a04[_0x511d('0xf8')]){return _0x28bb87();}else{return Promise[_0x511d('0xf9')](_0x49f7df)[_0x511d('0x2e')](respondWithResult(_0x30194b,null));}})['catch'](handleError(_0x30194b,null));};exports[_0x511d('0xfa')]=function(_0x5bd18a,_0x48a850){var _0x53de6b;return db[_0x511d('0x33')][_0x511d('0x54')]({'where':{'id':_0x5bd18a[_0x511d('0x50')]['id'],'role':_0x511d('0x1d')},'attributes':['id',_0x511d('0x2c'),_0x511d('0x22')]})[_0x511d('0x2e')](handleEntityNotFound(_0x48a850,null))[_0x511d('0x2e')](function(_0x28f102){if(_0x28f102){_0x53de6b=_0x28f102;return db[_0x511d('0xd4')]['destroy']({'where':{'membername':_0x53de6b['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x511d('0xef')]['findAll']({'where':{'membername':_0x53de6b['name'],'exitAt':null}});})['then'](function(_0x447276){var _0x2c366e=[];_0x447276[_0x511d('0xf0')](function(_0x31ddef){_0x2c366e[_0x511d('0x42')](_0x31ddef[_0x511d('0x1c')]({'exitAt':moment()[_0x511d('0xa8')](_0x511d('0xf1'))}));});return Promise[_0x511d('0x4d')](_0x2c366e);})[_0x511d('0x2e')](function(){return _0x53de6b[_0x511d('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x511d('0x2e')](respondWithResult(_0x48a850,null))['catch'](handleError(_0x48a850,null));};exports[_0x511d('0xfb')]=function(_0x1038c9,_0x4736b4){var _0x8c344e;return db[_0x511d('0xd4')][_0x511d('0x1c')]({'paused':0x1},{'where':{'UserId':_0x1038c9[_0x511d('0x50')]['id']},'individualHooks':!![]})[_0x511d('0x2e')](function(){return db[_0x511d('0x33')]['find']({'where':{'id':_0x1038c9['params']['id'],'role':_0x511d('0x1d')},'attributes':['id',_0x511d('0x2c'),_0x511d('0x22'),_0x511d('0x5a'),'interface',_0x511d('0x9a')]});})[_0x511d('0x2e')](handleEntityNotFound(_0x4736b4,null))[_0x511d('0x2e')](function(_0x1b0244){if(_0x1b0244){_0x8c344e=_0x1b0244;return db[_0x511d('0xef')][_0x511d('0x43')]({'where':{'membername':_0x8c344e[_0x511d('0x2c')],'type':_0x511d('0xf5'),'exitAt':null}});}})[_0x511d('0x2e')](function(_0x2cca15){if(_0x2cca15[_0x511d('0x86')]){var _0x444128=moment()[_0x511d('0xa8')](_0x511d('0xf1'));for(var _0x381589=0x0,_0x1444de=_0x2cca15['length'];_0x381589<_0x1444de;_0x381589++){_0x2cca15[_0x381589][_0x511d('0xfc')]({'exitAt':_0x444128});}}})[_0x511d('0x2e')](function(){var _0x41e6ef=[];var _0x5146a0=utils[_0x511d('0xf2')]();_0x5146a0['forEach'](function(_0x3bc138){_0x41e6ef[_0x511d('0x42')]({'channel':_0x3bc138,'membername':_0x8c344e[_0x511d('0x2c')],'interface':_[_0x511d('0x61')](_0x8c344e[_0x511d('0xa7')])?util[_0x511d('0xa8')](_0x511d('0xa9'),_0x8c344e[_0x511d('0x2c')]):_0x8c344e['interface'],'type':_0x511d('0xf5'),'enterAt':moment()[_0x511d('0xa8')](_0x511d('0xf1')),'data1':_0x1038c9['body'][_0x511d('0x36')]||'DEFAULT\x20PAUSE','role':_0x8c344e['role'],'internal':_0x8c344e['internal']});});return db['MemberReport'][_0x511d('0xf7')](_0x41e6ef,{'individualHooks':!![]});})[_0x511d('0x2e')](function(){return _0x8c344e[_0x511d('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1038c9[_0x511d('0x55')][_0x511d('0x36')]||_0x511d('0xfd'),'lastPauseAt':moment()[_0x511d('0xa8')](_0x511d('0xf1'))});})[_0x511d('0x2e')](respondWithResult(_0x4736b4,null))[_0x511d('0x4e')](handleError(_0x4736b4,null));};exports[_0x511d('0xfe')]=function(_0x1299f8,_0x3abf35){if(_0x1299f8[_0x511d('0x55')][_0x511d('0x99')]&&!utils[_0x511d('0x9d')](_0x1299f8['body'][_0x511d('0x99')])){throw new APIBadRequestError(util['format'](_0x511d('0xff'),_0x1299f8['body'][_0x511d('0x99')]));}return db['User'][_0x511d('0x54')]({'where':{'id':_0x1299f8[_0x511d('0x50')]['id']},'attributes':['id',_0x511d('0x2c'),_0x511d('0x22'),'internal',_0x511d('0xa7'),_0x511d('0x9a'),_0x511d('0x9c'),_0x511d('0x100'),'chatPause',_0x511d('0x101'),'openchannelPause',_0x511d('0x102'),_0x511d('0x103'),_0x511d('0x104'),_0x511d('0x105')]})[_0x511d('0x2e')](function(_0x2e1de1){if(!_0x2e1de1){throw new APINotFoundError(util[_0x511d('0xa8')](_0x511d('0xc3'),_0x1299f8[_0x511d('0x50')]['id']));}return _0x2e1de1[_0x511d('0xfe')](_0x1299f8[_0x511d('0x55')][_0x511d('0x99')]);})['then'](respondWithResult(_0x3abf35,null))[_0x511d('0x4e')](APIHandleError(_0x3abf35));};exports[_0x511d('0x106')]=function(_0x1bcd76,_0x53f2a5){var _0x166894={};var _0x1b19ae={};var _0x530f8a;var _0xbbfecb;return db[_0x511d('0x33')]['findOne']({'where':{'id':_0x1bcd76[_0x511d('0x50')]['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x53f2a5,null))['then'](function(_0x4aa147){if(_0x4aa147){_0x530f8a=_0x4aa147;_0x1b19ae[_0x511d('0xc9')]=_['keys'](db[_0x511d('0x107')]['rawAttributes']);_0x1b19ae[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x1bcd76[_0x511d('0x3d')]);_0x1b19ae[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x1b19ae['model'],_0x1b19ae[_0x511d('0x3d')]);_0x166894['attributes']=_[_0x511d('0xcb')](_0x1b19ae[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x1bcd76[_0x511d('0x3d')]['fields']));_0x166894[_0x511d('0x41')]=_0x166894['attributes'][_0x511d('0x86')]?_0x166894[_0x511d('0x41')]:_0x1b19ae[_0x511d('0xc9')];_0x166894[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x1bcd76['query'][_0x511d('0xce')]);_0x166894[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x1bcd76['query'],_0x1b19ae['filters']));if(_0x1bcd76[_0x511d('0x3d')][_0x511d('0x27')]){_0x166894[_0x511d('0x3c')]=_['merge'](_0x166894['where'],{'$or':_[_0x511d('0x29')](_0x166894[_0x511d('0x41')],function(_0x4d9d11){var _0x3a069c={};_0x3a069c[_0x4d9d11]={'$like':'%'+_0x1bcd76[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x3a069c;})});}_0x166894=_[_0x511d('0x52')]({},_0x166894,_0x1bcd76[_0x511d('0x53')]);return _0x530f8a[_0x511d('0x106')](_0x166894);}})[_0x511d('0x2e')](function(_0x5cf9e7){if(_0x5cf9e7){_0xbbfecb=_0x5cf9e7['length'];if(!_0x1bcd76[_0x511d('0x3d')][_0x511d('0xc4')](_0x511d('0xd1'))){_0x166894[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x1bcd76[_0x511d('0x3d')][_0x511d('0x18')]);_0x166894['offset']=qs[_0x511d('0x16')](_0x1bcd76['query'][_0x511d('0x16')]);}return _0x530f8a[_0x511d('0x106')](_0x166894);}})['then'](function(_0x2c4d66){if(_0x2c4d66){return _0x2c4d66?{'count':_0xbbfecb,'rows':_0x2c4d66}:null;}})[_0x511d('0x2e')](respondWithResult(_0x53f2a5,null))[_0x511d('0x4e')](handleError(_0x53f2a5,null));};exports[_0x511d('0x108')]=function(_0x364fa1,_0x1855f8){var _0x4d86e9=_0x364fa1[_0x511d('0x50')]['id'];var _0x30a03f=_0x364fa1[_0x511d('0x55')]?_0x364fa1['body'][_0x511d('0x58')]:null;var _0x56d676=[];return Promise[_0x511d('0xf9')]()[_0x511d('0x2e')](function(){if(!_0x30a03f)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x511d('0xc2')]({'where':{'id':_0x4d86e9}});})[_0x511d('0x2e')](function(_0x2c40f0){if(!_0x2c40f0)throw new APINotFoundError(util[_0x511d('0xa8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x364fa1[_0x511d('0x50')]['id']));return db[_0x511d('0x63')][_0x511d('0x109')](function(_0x4e8f44){return _0x2c40f0[_0x511d('0x108')](_0x30a03f,{'transaction':_0x4e8f44})[_0x511d('0x2e')](function(){return db[_0x511d('0x107')][_0x511d('0x43')]({'where':{'id':{'$in':_0x30a03f}}});})['then'](function(_0x49cd5c){var _0x48a1fd=_[_0x511d('0x29')](_0x49cd5c,function(_0x118a37){return _0x118a37[_0x511d('0x10a')]();});return Promise[_0x511d('0x4d')](_0x48a1fd);})['then'](function(_0x2b69a1){_0x56d676=_[_0x511d('0x10b')](_0x2b69a1);var _0x31e22b=_[_0x511d('0x29')](_0x56d676,function(_0x21704a){return _0x21704a['addAgent'](_0x2c40f0['id'],{'transaction':_0x4e8f44});});return Promise[_0x511d('0x4d')](_0x31e22b);})[_0x511d('0x2e')](function(){if(!_0x2c40f0[_0x511d('0x9a')])return;var _0x3b44ef=_[_0x511d('0x27')](_0x56d676,function(_0x1718f6){return _0x1718f6[_0x511d('0x10c')](_0x511d('0x99'))===_0x511d('0x10d');});var _0x4d301b=_[_0x511d('0x29')](_0x3b44ef,function(_0x565c40){return db[_0x511d('0xd4')][_0x511d('0xaa')]({'membername':_0x2c40f0[_0x511d('0x2c')],'UserId':_0x2c40f0['id'],'queue_name':_0x565c40[_0x511d('0x2c')],'VoiceQueueId':_0x565c40['id'],'interface':_[_0x511d('0x61')](_0x2c40f0[_0x511d('0xa7')])?util['format']('SIP/%s',_0x2c40f0[_0x511d('0x2c')]):_0x2c40f0['interface'],'paused':_0x2c40f0[_0x511d('0x9c')]||![],'penalty':_0x2c40f0['penalty']},{'transaction':_0x4e8f44});});return Promise[_0x511d('0x4d')](_0x4d301b);})[_0x511d('0x2e')](function(){return db[_0x511d('0x10e')]['findAll']({'where':{'teamId':{'$in':_0x30a03f}}});})[_0x511d('0x2e')](function(_0x239d52){var _0x792fa9=_[_0x511d('0x29')](_0x239d52,function(_0x30553c){return db['UserVoicePrefix'][_0x511d('0x7b')]({'UserId':_0x2c40f0['id'],'VoicePrefixId':_0x30553c[_0x511d('0x10f')]},{'transaction':_0x4e8f44});});return Promise[_0x511d('0x4d')](_0x792fa9);});});})[_0x511d('0x2e')](function(){for(var _0x47a022=0x0;_0x47a022<_0x56d676[_0x511d('0x86')];_0x47a022++){var _0x41ea01=_0x56d676[_0x47a022][_0x511d('0x10c')](_0x511d('0x99'));var _0x267871=_0x41ea01+'QueueId';socket['emit'](_0x511d('0x7c')+_0x41ea01+_0x511d('0x110'),{'UserId':_0x4d86e9,['queueField']:_0x56d676[_0x47a022]['id']});}})[_0x511d('0x2e')](respondWithStatusCode(_0x1855f8,null))[_0x511d('0x4e')](APIHandleError(_0x1855f8));};exports[_0x511d('0x111')]=function(_0x498ce0,_0x4b3154){var _0x55ac5f=_0x498ce0[_0x511d('0x50')]['id'];var _0x3ad483=null;if(_0x498ce0['query'][_0x511d('0x58')]){_0x3ad483=_[_0x511d('0x112')](_0x498ce0['query'][_0x511d('0x58')])?_0x498ce0['query'][_0x511d('0x58')]:[_0x498ce0[_0x511d('0x3d')][_0x511d('0x58')]];}var _0x1453e0=[];return Promise[_0x511d('0xf9')]()[_0x511d('0x2e')](function(){if(!_0x3ad483)throw new APIBadRequestError(_0x511d('0x113'));})['then'](function(){return db[_0x511d('0x33')]['findOne']({'where':{'id':_0x55ac5f}});})['then'](function(_0x8bb09d){if(!_0x8bb09d)throw new APINotFoundError(util[_0x511d('0xa8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x498ce0['params']['id']));return db['sequelize'][_0x511d('0x109')](function(_0x47c38e){return _0x8bb09d['removeTeams'](_0x3ad483,{'transaction':_0x47c38e})['then'](function(){return db[_0x511d('0x107')]['findAll']({'where':{'id':{'$in':_0x3ad483}}});})['then'](function(_0x1f24fb){var _0x498b13=_['map'](_0x1f24fb,function(_0x239b27){return _0x239b27[_0x511d('0x10a')]();});return Promise['all'](_0x498b13);})[_0x511d('0x2e')](function(_0x4fc5b6){_0x1453e0=_[_0x511d('0x10b')](_0x4fc5b6);var _0x157927=_['map'](_0x1453e0,function(_0x238f61){return _0x238f61[_0x511d('0x114')](_0x8bb09d['id'],{'transaction':_0x47c38e});});return Promise[_0x511d('0x4d')](_0x157927);})['then'](function(){if(!_0x8bb09d[_0x511d('0x9a')])return;var _0x33fd99=_[_0x511d('0x27')](_0x1453e0,function(_0xe34d68){return _0xe34d68[_0x511d('0x10c')](_0x511d('0x99'))===_0x511d('0x10d');});var _0x3f70b2=_[_0x511d('0x29')](_0x33fd99,function(_0x58c807){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x58c807['id'],'UserId':_0x8bb09d['id']},'transaction':_0x47c38e});});return Promise['all'](_0x3f70b2);})[_0x511d('0x2e')](function(){return db[_0x511d('0x10e')][_0x511d('0x43')]({'where':{'teamId':{'$in':_0x3ad483}}});})[_0x511d('0x2e')](function(_0x1b91b6){var _0xa6bc56=_[_0x511d('0x29')](_0x1b91b6,function(_0x30db12){return db[_0x511d('0x115')][_0x511d('0x20')]({'where':{'UserId':_0x8bb09d['id'],'VoicePrefixId':_0x30db12['VoicePrefixId']}},{'transaction':_0x47c38e});});return Promise[_0x511d('0x4d')](_0xa6bc56);});});})[_0x511d('0x2e')](function(){for(var _0x434e62=0x0;_0x434e62<_0x1453e0[_0x511d('0x86')];_0x434e62++){var _0x3c2c1f=_0x1453e0[_0x434e62][_0x511d('0x10c')](_0x511d('0x99'));var _0x333b35=_0x3c2c1f+'QueueId';socket[_0x511d('0x1e')](_0x511d('0x7c')+_0x3c2c1f+_0x511d('0xad'),{'UserId':_0x55ac5f,['queueField']:_0x1453e0[_0x434e62]['id']});}})[_0x511d('0x2e')](respondWithStatusCode(_0x4b3154,null))[_0x511d('0x4e')](APIHandleError(_0x4b3154));};exports[_0x511d('0x116')]=function(_0x1e81ed,_0x4d352e){var _0x217065={};var _0x5a3b53={};var _0x1ed4cd;var _0x854523;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x1e81ed['params']['id']}})[_0x511d('0x2e')](handleEntityNotFound(_0x4d352e,null))[_0x511d('0x2e')](function(_0x4e2854){if(_0x4e2854){_0x1ed4cd=_0x4e2854;_0x5a3b53[_0x511d('0xc9')]=_[_0x511d('0xca')](db[_0x511d('0xc5')][_0x511d('0x34')]);_0x5a3b53[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x1e81ed['query']);_0x5a3b53[_0x511d('0xcf')]=_['intersection'](_0x5a3b53['model'],_0x5a3b53[_0x511d('0x3d')]);_0x217065[_0x511d('0x41')]=_['intersection'](_0x5a3b53['model'],qs['fields'](_0x1e81ed['query'][_0x511d('0xcc')]));_0x217065['attributes']=_0x217065[_0x511d('0x41')]['length']?_0x217065[_0x511d('0x41')]:_0x5a3b53[_0x511d('0xc9')];_0x217065['order']=qs['sort'](_0x1e81ed[_0x511d('0x3d')][_0x511d('0xce')]);_0x217065[_0x511d('0x3c')]=qs[_0x511d('0xcf')](_[_0x511d('0xd0')](_0x1e81ed[_0x511d('0x3d')],_0x5a3b53[_0x511d('0xcf')]));if(_0x1e81ed[_0x511d('0x3d')][_0x511d('0x27')]){_0x217065[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x217065['where'],{'$or':_[_0x511d('0x29')](_0x217065[_0x511d('0x41')],function(_0x175c50){var _0x5e6abb={};_0x5e6abb[_0x175c50]={'$like':'%'+_0x1e81ed[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x5e6abb;})});}_0x217065=_['merge']({},_0x217065,_0x1e81ed[_0x511d('0x53')]);return _0x1ed4cd[_0x511d('0x116')](_0x217065);}})['then'](function(_0x1680b5){if(_0x1680b5){_0x854523=_0x1680b5['length'];if(!_0x1e81ed[_0x511d('0x3d')]['hasOwnProperty']('nolimit')){_0x217065[_0x511d('0x18')]=qs[_0x511d('0x18')](_0x1e81ed[_0x511d('0x3d')][_0x511d('0x18')]);_0x217065[_0x511d('0x16')]=qs[_0x511d('0x16')](_0x1e81ed[_0x511d('0x3d')][_0x511d('0x16')]);}return _0x1ed4cd[_0x511d('0x116')](_0x217065);}})[_0x511d('0x2e')](function(_0x2b6798){if(_0x2b6798){return _0x2b6798?{'count':_0x854523,'rows':_0x2b6798}:null;}})[_0x511d('0x2e')](respondWithResult(_0x4d352e,null))[_0x511d('0x4e')](handleError(_0x4d352e,null));};exports['getAgents']=function(_0x2bf219,_0x784036){var _0x192de2={};var _0x172f48={};var _0x4381da;return db[_0x511d('0x33')][_0x511d('0xc2')]({'where':{'id':_0x2bf219[_0x511d('0x50')]['id']}})['then'](handleEntityNotFound(_0x784036,null))[_0x511d('0x2e')](function(_0x5e2642){if(_0x5e2642){_0x4381da=_0x5e2642;_0x172f48['model']=_[_0x511d('0xca')](db[_0x511d('0x33')]['rawAttributes']);_0x172f48[_0x511d('0x3d')]=_[_0x511d('0xca')](_0x2bf219[_0x511d('0x3d')]);_0x172f48[_0x511d('0xcf')]=_[_0x511d('0xcb')](_0x172f48[_0x511d('0xc9')],_0x172f48[_0x511d('0x3d')]);_0x192de2[_0x511d('0x41')]=_[_0x511d('0xcb')](_0x172f48[_0x511d('0xc9')],qs[_0x511d('0xcc')](_0x2bf219[_0x511d('0x3d')][_0x511d('0xcc')]));_0x192de2[_0x511d('0x41')]=_0x192de2['attributes'][_0x511d('0x86')]?_0x192de2[_0x511d('0x41')]:_0x172f48[_0x511d('0xc9')];_0x192de2[_0x511d('0xcd')]=qs[_0x511d('0xce')](_0x2bf219[_0x511d('0x3d')][_0x511d('0xce')]);_0x192de2[_0x511d('0x3c')]=qs['filters'](_['pick'](_0x2bf219[_0x511d('0x3d')],_0x172f48[_0x511d('0xcf')]));if(_0x2bf219['query'][_0x511d('0x27')]){_0x192de2[_0x511d('0x3c')]=_[_0x511d('0x52')](_0x192de2[_0x511d('0x3c')],{'$or':_[_0x511d('0x29')](_0x192de2[_0x511d('0x41')],function(_0xcf3e89){var _0x221dcb={};_0x221dcb[_0xcf3e89]={'$like':'%'+_0x2bf219[_0x511d('0x3d')][_0x511d('0x27')]+'%'};return _0x221dcb;})});}_0x192de2[_0x511d('0xc9')]=db[_0x511d('0x33')];_0x192de2['as']=_0x511d('0x25');_0x192de2=_[_0x511d('0x52')]({},_0x192de2,_0x2bf219[_0x511d('0x53')]);return _0x4381da['getVoiceQueues']({'include':[_0x192de2]});}})['then'](function(_0x407e84){if(_0x407e84){var _0x1063be={},_0x946f5=[];for(var _0x29aaf5=0x0;_0x29aaf5<_0x407e84['length'];_0x29aaf5+=0x1){for(var _0x41f0f0=0x0,_0x4bd9f3;_0x41f0f0<_0x407e84[_0x29aaf5][_0x511d('0x25')][_0x511d('0x86')];_0x41f0f0+=0x1){_0x4bd9f3=_0x407e84[_0x29aaf5][_0x511d('0x25')][_0x41f0f0]['get']({'plain':!![]});_0x1063be[_0x4bd9f3['id']]=_0x4bd9f3;}}_0x1063be=_[_0x511d('0x117')](_0x1063be);for(var _0x3022fc=qs[_0x511d('0x16')](_0x2bf219[_0x511d('0x3d')][_0x511d('0x16')]);_0x3022fc<_0x1063be[_0x511d('0x86')]&&_0x946f5['length']=_0x3936ab[_0x3ff9('0x48')]){throw new Error(_0x3ff9('0x49'));}})['then'](function(){if(_0x4e45a3){return db['UserVoiceQueueRt'][_0x3ff9('0x41')]({'where':{'membername':_0x4e45a3[_0x3ff9('0x1e')]},'individualHooks':!![]});}})[_0x3ff9('0x14')](function(){if(_0x4e45a3){return _0x4e45a3[_0x3ff9('0x4a')]({'raw':!![]});}})['then'](function(_0x251035){if(_0x4e45a3){if(_0x251035){var _0x3f72a6=[];_0x46b544=_0x251035;if(_0x46b544[_0x3ff9('0x25')]){for(var _0x4a9797=0x0;_0x4a9797<_0x46b544[_0x3ff9('0x25')];_0x4a9797++){_0x3f72a6['push'](db[_0x3ff9('0x40')]['upsert']({'membername':_0x4e45a3[_0x3ff9('0x1e')],'UserId':_0x4e45a3['id'],'queue_name':_0x46b544[_0x4a9797][_0x3ff9('0x1e')],'VoiceQueueId':_0x46b544[_0x4a9797]['id'],'interface':_0x483954,'paused':_0x4e45a3[_0x3ff9('0x4b')]||![],'penalty':_0x46b544[_0x4a9797][_0x3ff9('0x4c')]||0x0}));}return BPromise['all'](_0x3f72a6);}}}})[_0x3ff9('0x14')](function(){if(_0x4e45a3){return db[_0x3ff9('0x23')][_0x3ff9('0xc')]({'where':{'membername':_0x4e45a3[_0x3ff9('0x1e')],'exitAt':null}});}})[_0x3ff9('0x14')](function(_0x25222a){if(_0x4e45a3){if(_0x25222a&&_0x25222a[_0x3ff9('0x25')]){var _0x70f70f=[];_0x25222a[_0x3ff9('0x29')](function(_0x534fee){_0x70f70f[_0x3ff9('0x2a')](_0x534fee[_0x3ff9('0x2d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3ff9('0x42')](_0x70f70f);}}})[_0x3ff9('0x14')](function(){if(_0x4e45a3){var _0x4a535d=[];var _0x4bb0a7=[];var _0x4da9ae=utils[_0x3ff9('0x28')]();var _0x536014={'membername':_0x4e45a3[_0x3ff9('0x1e')],'interface':_0x483954,'enterAt':moment()[_0x3ff9('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4e45a3[_0x3ff9('0x1f')],'internal':_0x4e45a3[_0x3ff9('0x20')]};_0x4da9ae[_0x3ff9('0x29')](function(_0xe520e5){_0x4a535d[_0x3ff9('0x2a')](_[_0x3ff9('0x4d')]({'channel':_0xe520e5,'type':'LOGIN','data1':'callysquare','data2':_0x483954},_0x536014));if(_0x4e45a3[_0x3ff9('0x4b')]){_0x4bb0a7['push'](_['merge']({'channel':_0xe520e5,'type':'PAUSE','data1':'LOGININPAUSE'},_0x536014));}});return db[_0x3ff9('0x23')]['bulkCreate'](_0x4a535d['concat'](_0x4bb0a7),{'individualHooks':!![]});}})[_0x3ff9('0x14')](function(){if(_0x4e45a3){return _0x4e45a3[_0x3ff9('0x2d')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4e45a3['loginInPause']||![],'mailPause':_0x4e45a3['loginInPause']||![],'chatPause':_0x4e45a3[_0x3ff9('0x4b')]||![],'faxPause':_0x4e45a3[_0x3ff9('0x4b')]||![],'smsPause':_0x4e45a3['loginInPause']||![],'openchannelPause':_0x4e45a3[_0x3ff9('0x4b')]||![],'pauseType':_0x4e45a3[_0x3ff9('0x4b')]?_0x3ff9('0x4e'):null,'lastPauseAt':moment()[_0x3ff9('0x26')](_0x3ff9('0x27')),'interface':_0x483954});}})[_0x3ff9('0x14')](function(_0x4e53a2){_0x22efe5(_0x4e53a2);})['catch'](function(_0x4aae7d){_0x4ac26f(_0x4b29c3[_0x3ff9('0x19')](0x1f4,_0x4aae7d[_0x3ff9('0x1a')]));});});}; \ No newline at end of file +var _0x029a=['../../mysqldb','../../config/utils','../../config/logger','defaults','redis','./user.socket','register','GetUser','User','findAll','options','raw','where','limit','map','include','model','attributes','then','debug','stringify','error','message','ShowUser','info','catch','find','name','role','internal','format','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','interface','type','DEFAULT\x20PAUSE','body','bulkCreate','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','all','LoginUser','phone','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','ioredis'];(function(_0xa0b8db,_0x1ada0a){var _0x476036=function(_0x2b9525){while(--_0x2b9525){_0xa0b8db['push'](_0xa0b8db['shift']());}};_0x476036(++_0x1ada0a);}(_0x029a,0x198));var _0xa029=function(_0x1dd962,_0xbea5af){_0x1dd962=_0x1dd962-0x0;var _0x5ca2f0=_0x029a[_0x1dd962];return _0x5ca2f0;};'use strict';var _=require(_0xa029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var Redis=require(_0xa029('0x1'));var db=require(_0xa029('0x2'))['db'];var utils=require(_0xa029('0x3'));var logger=require(_0xa029('0x4'))('rpc');var config=require('../../config/environment');config['redis']=_[_0xa029('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa029('0x6')]));require(_0xa029('0x7'))[_0xa029('0x8')](socket);exports[_0xa029('0x9')]=function(_0x137a4e){var _0x231e92=this;return new Promise(function(_0x4a1358,_0x1331c6){return db[_0xa029('0xa')][_0xa029('0xb')]({'raw':_0x137a4e[_0xa029('0xc')]?_0x137a4e[_0xa029('0xc')][_0xa029('0xd')]===undefined?!![]:![]:!![],'where':_0x137a4e[_0xa029('0xc')]?_0x137a4e[_0xa029('0xc')][_0xa029('0xe')]||null:null,'attributes':_0x137a4e['options']?_0x137a4e[_0xa029('0xc')]['attributes']||null:null,'limit':_0x137a4e['options']?_0x137a4e['options'][_0xa029('0xf')]||null:null,'include':_0x137a4e[_0xa029('0xc')]?_0x137a4e['options']['include']?_[_0xa029('0x10')](_0x137a4e[_0xa029('0xc')][_0xa029('0x11')],function(_0xc310a4){return{'model':db[_0xc310a4[_0xa029('0x12')]],'as':_0xc310a4['as'],'attributes':_0xc310a4[_0xa029('0x13')],'include':_0xc310a4['include']?_[_0xa029('0x10')](_0xc310a4['include'],function(_0x11805c){return{'model':db[_0x11805c[_0xa029('0x12')]],'as':_0x11805c['as'],'attributes':_0x11805c[_0xa029('0x13')],'include':_0x11805c[_0xa029('0x11')]?_['map'](_0x11805c[_0xa029('0x11')],function(_0x37e020){return{'model':db[_0x37e020[_0xa029('0x12')]],'as':_0x37e020['as'],'attributes':_0x37e020[_0xa029('0x13')]};}):[]};}):[]};}):[]:[]})[_0xa029('0x14')](function(_0x317018){logger['info'](_0xa029('0x9'),_0x137a4e);logger[_0xa029('0x15')](_0xa029('0x9'),_0x137a4e,JSON[_0xa029('0x16')](_0x317018));_0x4a1358(_0x317018);})['catch'](function(_0x3a11ee){logger[_0xa029('0x17')](_0xa029('0x9'),_0x3a11ee[_0xa029('0x18')],_0x137a4e);_0x1331c6(_0x231e92[_0xa029('0x17')](0x1f4,_0x3a11ee[_0xa029('0x18')]));});});};exports[_0xa029('0x19')]=function(_0x5ab3bc){var _0x5c944f=this;return new Promise(function(_0x2345c7,_0x38e2ed){return db[_0xa029('0xa')]['find']({'raw':_0x5ab3bc[_0xa029('0xc')]?_0x5ab3bc[_0xa029('0xc')][_0xa029('0xd')]===undefined?!![]:![]:!![],'where':_0x5ab3bc[_0xa029('0xc')]?_0x5ab3bc['options'][_0xa029('0xe')]||null:null,'attributes':_0x5ab3bc[_0xa029('0xc')]?_0x5ab3bc['options'][_0xa029('0x13')]||null:null,'include':_0x5ab3bc[_0xa029('0xc')]?_0x5ab3bc[_0xa029('0xc')][_0xa029('0x11')]?_[_0xa029('0x10')](_0x5ab3bc[_0xa029('0xc')][_0xa029('0x11')],function(_0x229162){return{'model':db[_0x229162[_0xa029('0x12')]],'as':_0x229162['as'],'attributes':_0x229162[_0xa029('0x13')],'include':_0x229162['include']?_[_0xa029('0x10')](_0x229162[_0xa029('0x11')],function(_0x23795c){return{'model':db[_0x23795c[_0xa029('0x12')]],'as':_0x23795c['as'],'attributes':_0x23795c[_0xa029('0x13')],'include':_0x23795c[_0xa029('0x11')]?_['map'](_0x23795c[_0xa029('0x11')],function(_0x3522b9){return{'model':db[_0x3522b9['model']],'as':_0x3522b9['as'],'attributes':_0x3522b9[_0xa029('0x13')]};}):[]};}):[]};}):[]:[]})[_0xa029('0x14')](function(_0x42d6ad){logger[_0xa029('0x1a')](_0xa029('0x19'),_0x5ab3bc);logger[_0xa029('0x15')](_0xa029('0x19'),_0x5ab3bc,JSON[_0xa029('0x16')](_0x42d6ad));_0x2345c7(_0x42d6ad);})[_0xa029('0x1b')](function(_0x311fae){logger[_0xa029('0x17')](_0xa029('0x19'),_0x311fae[_0xa029('0x18')],_0x5ab3bc);_0x38e2ed(_0x5c944f[_0xa029('0x17')](0x1f4,_0x311fae[_0xa029('0x18')]));});});};exports['PauseUser']=function(_0x44a1de){var _0x35958a;return db['User'][_0xa029('0x1c')]({'where':_0x44a1de[_0xa029('0xc')]['where']||{},'attributes':['id',_0xa029('0x1d'),_0xa029('0x1e'),_0xa029('0x1f'),'interface']})[_0xa029('0x14')](function(_0x4877f8){if(!_0x4877f8){throw new Error(util[_0xa029('0x20')]('User\x20with\x20id\x20%s\x20not\x20found',_0x44a1de[_0xa029('0x21')]['id']));}_0x35958a=_0x4877f8;return db[_0xa029('0x22')][_0xa029('0x23')]({'paused':0x1},{'where':{'UserId':_0x35958a['id']},'individualHooks':!![]});})[_0xa029('0x14')](function(){return db[_0xa029('0x24')]['findAll']({'where':{'membername':_0x35958a[_0xa029('0x1d')],'type':_0xa029('0x25'),'exitAt':null}});})[_0xa029('0x14')](function(_0x23436a){if(_0x23436a&&_0x23436a[_0xa029('0x26')]){var _0x4c8ed4=moment()[_0xa029('0x20')](_0xa029('0x27'));for(var _0x3ccfbb=0x0,_0x245ef3=_0x23436a[_0xa029('0x26')];_0x3ccfbb<_0x245ef3;_0x3ccfbb++){_0x23436a[_0x3ccfbb][_0xa029('0x28')]({'exitAt':_0x4c8ed4});}}})['then'](function(){var _0x4b5860=[];var _0x17c846=utils[_0xa029('0x29')]();_0x17c846[_0xa029('0x2a')](function(_0x130404){_0x4b5860[_0xa029('0x2b')]({'channel':_0x130404,'membername':_0x35958a[_0xa029('0x1d')],'interface':_['isNil'](_0x35958a[_0xa029('0x2c')])?util[_0xa029('0x20')]('SIP/%s',_0x35958a[_0xa029('0x1d')]):_0x35958a[_0xa029('0x2c')],'type':_0xa029('0x25'),'enterAt':moment()[_0xa029('0x20')](_0xa029('0x27')),'data1':_0x44a1de['body'][_0xa029('0x2d')]||_0xa029('0x2e'),'role':_0x35958a[_0xa029('0x1e')],'internal':_0x35958a[_0xa029('0x1f')],'uniqueid':_0x44a1de[_0xa029('0x2f')]['uniqueid']||null});});return db[_0xa029('0x24')][_0xa029('0x30')](_0x4b5860,{'individualHooks':!![]});})[_0xa029('0x14')](function(){return _0x35958a[_0xa029('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x44a1de['body']['type']||_0xa029('0x2e'),'lastPauseAt':moment()[_0xa029('0x20')](_0xa029('0x27'))});})[_0xa029('0x1b')](function(_0x571baa){throw _0x571baa;});};exports[_0xa029('0x31')]=function(_0x4bbf62){return Promise[_0xa029('0x32')]()[_0xa029('0x14')](function(){if(_0x4bbf62[_0xa029('0x2f')][_0xa029('0x33')]&&!utils['isValidChannel'](_0x4bbf62[_0xa029('0x2f')][_0xa029('0x33')])){throw new Error(util[_0xa029('0x20')](_0xa029('0x34'),_0x4bbf62[_0xa029('0x2f')][_0xa029('0x33')]));}return db[_0xa029('0xa')][_0xa029('0x35')]({'where':_0x4bbf62[_0xa029('0xc')]['where']||{},'attributes':['id',_0xa029('0x1d'),_0xa029('0x1e'),_0xa029('0x1f'),_0xa029('0x2c'),'online','voicePause',_0xa029('0x36'),_0xa029('0x37'),_0xa029('0x38'),'openchannelPause',_0xa029('0x39'),_0xa029('0x3a'),_0xa029('0x3b'),_0xa029('0x3c')]});})[_0xa029('0x14')](function(_0x1f06ea){if(!_0x1f06ea){throw new Error(util[_0xa029('0x20')](_0xa029('0x3d'),_0x4bbf62['params']['id']));}return _0x1f06ea[_0xa029('0x3e')](_0x4bbf62[_0xa029('0x2f')][_0xa029('0x33')],_0xa029('0x3f'));})[_0xa029('0x1b')](function(_0x4bcbf4){throw _0x4bcbf4;});};exports[_0xa029('0x40')]=function(_0xc24a24){var _0x2ea957=this;return new Promise(function(_0x24a741,_0x474a98){var _0x140f2a;return db['User'][_0xa029('0x35')]({'where':_0xc24a24[_0xa029('0xc')][_0xa029('0xe')]||{},'attributes':['id',_0xa029('0x1d')]})[_0xa029('0x14')](function(_0x37d80c){if(_0x37d80c){_0x140f2a=_0x37d80c;return db[_0xa029('0x22')]['destroy']({'where':{'membername':_0x140f2a[_0xa029('0x1d')]},'individualHooks':!![]});}})[_0xa029('0x14')](function(){if(_0x140f2a){return db[_0xa029('0x24')]['findAll']({'where':{'membername':_0x140f2a['name'],'exitAt':null}});}})['then'](function(_0xf2f20){if(_0x140f2a){if(_0xf2f20&&_0xf2f20['length']){var _0x2bd9a1=[];_0xf2f20[_0xa029('0x2a')](function(_0x4981c7){_0x2bd9a1[_0xa029('0x2b')](_0x4981c7[_0xa029('0x23')]({'exitAt':moment()[_0xa029('0x20')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa029('0x41')](_0x2bd9a1);}}})[_0xa029('0x14')](function(){if(_0x140f2a){return _0x140f2a[_0xa029('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa029('0x14')](function(_0x112372){_0x24a741(_0x112372);})[_0xa029('0x1b')](function(_0xe72e77){_0x474a98(_0x2ea957[_0xa029('0x17')](0x1f4,_0xe72e77[_0xa029('0x18')]));});});};exports[_0xa029('0x42')]=function(_0x221aa3){var _0x4607ac=this;return new Promise(function(_0x1b2ca5,_0x5eb107){var _0x5d8672;var _0x51b134;var _0x2f79e7;var _0x442480;return db[_0xa029('0xa')]['findOne']({'where':_0x221aa3[_0xa029('0xc')]['where']||{},'attributes':['id','name',_0xa029('0x1e'),'mobile',_0xa029('0x43'),_0xa029('0x1f'),'loginInPause',_0xa029('0x2c')]})[_0xa029('0x14')](function(_0x3e99bd){if(_0x3e99bd){_0x5d8672=_0x3e99bd;_0x442480=_0x221aa3[_0xa029('0x2f')][_0xa029('0x2c')]?_0x221aa3['body'][_0xa029('0x2c')]:util['format']('SIP/%s',_0x5d8672[_0xa029('0x1d')]);return db['User']['count']({'where':{'role':_0xa029('0x44'),'online':!![],'id':{'$ne':_0x5d8672['id']}}});}})[_0xa029('0x14')](function(_0x426d13){if(_0x426d13){_0x2f79e7=_0x426d13;return require(_0xa029('0x45'))['getLicense']();}})[_0xa029('0x14')](function(_0x4fe371){if(_0x4fe371&&_0x4fe371[_0xa029('0x46')]&&_0x2f79e7>=_0x4fe371[_0xa029('0x46')]){throw new Error(_0xa029('0x47'));}})['then'](function(){if(_0x5d8672){return db[_0xa029('0x22')][_0xa029('0x48')]({'where':{'membername':_0x5d8672[_0xa029('0x1d')]},'individualHooks':!![]});}})[_0xa029('0x14')](function(){if(_0x5d8672){return _0x5d8672[_0xa029('0x49')]({'raw':!![]});}})[_0xa029('0x14')](function(_0x542ca0){if(_0x5d8672){if(_0x542ca0){var _0x41be8f=[];_0x51b134=_0x542ca0;if(_0x51b134[_0xa029('0x26')]){for(var _0x253a61=0x0;_0x253a61<_0x51b134['length'];_0x253a61++){_0x41be8f[_0xa029('0x2b')](db[_0xa029('0x22')][_0xa029('0x4a')]({'membername':_0x5d8672[_0xa029('0x1d')],'UserId':_0x5d8672['id'],'queue_name':_0x51b134[_0x253a61][_0xa029('0x1d')],'VoiceQueueId':_0x51b134[_0x253a61]['id'],'interface':_0x442480,'paused':_0x5d8672[_0xa029('0x4b')]||![],'penalty':_0x51b134[_0x253a61][_0xa029('0x4c')]||0x0}));}return BPromise[_0xa029('0x41')](_0x41be8f);}}}})[_0xa029('0x14')](function(){if(_0x5d8672){return db[_0xa029('0x24')]['findAll']({'where':{'membername':_0x5d8672['name'],'exitAt':null}});}})['then'](function(_0x5debe6){if(_0x5d8672){if(_0x5debe6&&_0x5debe6['length']){var _0xdd871b=[];_0x5debe6[_0xa029('0x2a')](function(_0x19dbdc){_0xdd871b['push'](_0x19dbdc[_0xa029('0x23')]({'exitAt':moment()['format'](_0xa029('0x27'))}));});return BPromise['all'](_0xdd871b);}}})['then'](function(){if(_0x5d8672){var _0x40219a=[];var _0x4e1e33=[];var _0x43028d=utils['getChannels']();var _0x435a5e={'membername':_0x5d8672[_0xa029('0x1d')],'interface':_0x442480,'enterAt':moment()[_0xa029('0x20')](_0xa029('0x27')),'role':_0x5d8672[_0xa029('0x1e')],'internal':_0x5d8672[_0xa029('0x1f')]};_0x43028d[_0xa029('0x2a')](function(_0x5db460){_0x40219a['push'](_[_0xa029('0x4d')]({'channel':_0x5db460,'type':_0xa029('0x4e'),'data1':_0xa029('0x4f'),'data2':_0x442480},_0x435a5e));if(_0x5d8672[_0xa029('0x4b')]){_0x4e1e33[_0xa029('0x2b')](_[_0xa029('0x4d')]({'channel':_0x5db460,'type':_0xa029('0x25'),'data1':_0xa029('0x50')},_0x435a5e));}});return db[_0xa029('0x24')][_0xa029('0x30')](_0x40219a[_0xa029('0x51')](_0x4e1e33),{'individualHooks':!![]});}})[_0xa029('0x14')](function(){if(_0x5d8672){return _0x5d8672['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5d8672[_0xa029('0x4b')]||![],'mailPause':_0x5d8672[_0xa029('0x4b')]||![],'chatPause':_0x5d8672['loginInPause']||![],'faxPause':_0x5d8672['loginInPause']||![],'smsPause':_0x5d8672[_0xa029('0x4b')]||![],'openchannelPause':_0x5d8672[_0xa029('0x4b')]||![],'pauseType':_0x5d8672[_0xa029('0x4b')]?_0xa029('0x50'):null,'lastPauseAt':moment()[_0xa029('0x20')](_0xa029('0x27')),'interface':_0x442480});}})[_0xa029('0x14')](function(_0x5723d7){_0x1b2ca5(_0x5723d7);})[_0xa029('0x1b')](function(_0x37e09e){_0x5eb107(_0x4607ac[_0xa029('0x17')](0x1f4,_0x37e09e[_0xa029('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index cb9213c..1785c07 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 _0x5fd5=['./user.events','remove','emit','removeListener','register','user:'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0x5fd5,0x1d4));var _0x55fd=function(_0x42d4c4,_0x33b0b4){_0x42d4c4=_0x42d4c4-0x0;var _0x1ff9d2=_0x5fd5[_0x42d4c4];return _0x1ff9d2;};'use strict';var UserEvents=require(_0x55fd('0x0'));var events=['save',_0x55fd('0x1'),'update'];function createListener(_0x186a00,_0x230d14){return function(_0x14bdb5){_0x230d14[_0x55fd('0x2')](_0x186a00,_0x14bdb5);};}function removeListener(_0x5dd998,_0x413c9f){return function(){UserEvents[_0x55fd('0x3')](_0x5dd998,_0x413c9f);};}exports[_0x55fd('0x4')]=function(_0x26c17c){for(var _0x374eef=0x0,_0x36012d=events['length'];_0x374eef<_0x36012d;_0x374eef++){var _0x4b0b10=events[_0x374eef];var _0x4dc65c=createListener(_0x55fd('0x5')+_0x4b0b10,_0x26c17c);UserEvents['on'](_0x4b0b10,_0x4dc65c);}}; \ No newline at end of file +var _0x3cb5=['removeListener','register','./user.events','save','remove','update'];(function(_0x153810,_0x4b3117){var _0x3df31a=function(_0x239357){while(--_0x239357){_0x153810['push'](_0x153810['shift']());}};_0x3df31a(++_0x4b3117);}(_0x3cb5,0x1b2));var _0x53cb=function(_0x1fe0a7,_0x52972d){_0x1fe0a7=_0x1fe0a7-0x0;var _0xe244d3=_0x3cb5[_0x1fe0a7];return _0xe244d3;};'use strict';var UserEvents=require(_0x53cb('0x0'));var events=[_0x53cb('0x1'),_0x53cb('0x2'),_0x53cb('0x3')];function createListener(_0x358d,_0x1ef0ac){return function(_0x5784bd){_0x1ef0ac['emit'](_0x358d,_0x5784bd);};}function removeListener(_0x6ad2d7,_0x8c0923){return function(){UserEvents[_0x53cb('0x4')](_0x6ad2d7,_0x8c0923);};}exports[_0x53cb('0x5')]=function(_0xc6cfa7){for(var _0x2132d1=0x0,_0x3c87a9=events['length'];_0x2132d1<_0x3c87a9;_0x2132d1++){var _0x2fbbb4=events[_0x2132d1];var _0x47fcc3=createListener('user:'+_0x2fbbb4,_0xc6cfa7);UserEvents['on'](_0x2fbbb4,_0x47fcc3);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1aad0d1..44a6999 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x37e326,_0x4b18da){var _0x2c1650=function(_0xbae977){while(--_0xbae977){_0x37e326['push'](_0x37e326['shift']());}};_0x2c1650(++_0x4b18da);}(_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(_0x51b72e,_0x408f4f){var _0xa108e1=function(_0x3d879c){while(--_0x3d879c){_0x51b72e['push'](_0x51b72e['shift']());}};_0xa108e1(++_0x408f4f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9af6651..44af503 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 _0xb3be=['sequelize','exports'];(function(_0x3d5cab,_0x5cf978){var _0x4527c1=function(_0x590702){while(--_0x590702){_0x3d5cab['push'](_0x3d5cab['shift']());}};_0x4527c1(++_0x5cf978);}(_0xb3be,0x13c));var _0xeb3b=function(_0x12f90f,_0x2d496d){_0x12f90f=_0x12f90f-0x0;var _0x10f5c1=_0xb3be[_0x12f90f];return _0x10f5c1;};'use strict';var Sequelize=require(_0xeb3b('0x0'));module[_0xeb3b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x15ae=['exports'];(function(_0x27bf27,_0x4cfdfe){var _0x475283=function(_0x23a3b7){while(--_0x23a3b7){_0x27bf27['push'](_0x27bf27['shift']());}};_0x475283(++_0x4cfdfe);}(_0x15ae,0x10f));var _0xe15a=function(_0x3485ee,_0x228f0d){_0x3485ee=_0x3485ee-0x0;var _0x3af50a=_0x15ae[_0x3485ee];return _0x3af50a;};'use strict';var Sequelize=require('sequelize');module[_0xe15a('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index bbd6cbb..195aa2d 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 _0x7804=['user_has_chat_queues','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7804,0xa6));var _0x4780=function(_0x4f882a,_0x562da8){_0x4f882a=_0x4f882a-0x0;var _0x3ac87c=_0x7804[_0x4f882a];return _0x3ac87c;};'use strict';var _=require(_0x4780('0x0'));var util=require(_0x4780('0x1'));var logger=require(_0x4780('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4780('0x3'));var rp=require(_0x4780('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4780('0x5'));var attributes=require(_0x4780('0x6'));module[_0x4780('0x7')]=function(_0x2944c5,_0x160e37){return _0x2944c5[_0x4780('0x8')](_0x4780('0x9'),attributes,{'tableName':_0x4780('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7985=['exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x598597,_0x513cac){var _0x570690=function(_0x37c15c){while(--_0x37c15c){_0x598597['push'](_0x598597['shift']());}};_0x570690(++_0x513cac);}(_0x7985,0x13c));var _0x5798=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0x7985[_0x54a28a];return _0x3da1f1;};'use strict';var _=require('lodash');var util=require(_0x5798('0x0'));var logger=require(_0x5798('0x1'))(_0x5798('0x2'));var moment=require(_0x5798('0x3'));var BPromise=require('bluebird');var rp=require(_0x5798('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5798('0x5'));var config=require(_0x5798('0x6'));var attributes=require(_0x5798('0x7'));module[_0x5798('0x8')]=function(_0x587abb,_0x440a08){return _0x587abb[_0x5798('0x9')](_0x5798('0xa'),attributes,{'tableName':_0x5798('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 11fa765..23eef35 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 _0x5230=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','UserChatQueue,\x20%s,\x20%s','util','moment','bluebird','randomstring'];(function(_0x1d6ea6,_0x2276c6){var _0x4e20ea=function(_0x3f1579){while(--_0x3f1579){_0x1d6ea6['push'](_0x1d6ea6['shift']());}};_0x4e20ea(++_0x2276c6);}(_0x5230,0x14c));var _0x0523=function(_0x4fc561,_0x188f8b){_0x4fc561=_0x4fc561-0x0;var _0x3a1d68=_0x5230[_0x4fc561];return _0x3a1d68;};'use strict';var _=require('lodash');var util=require(_0x0523('0x0'));var moment=require(_0x0523('0x1'));var BPromise=require(_0x0523('0x2'));var rs=require(_0x0523('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0523('0x4'))['db'];var utils=require(_0x0523('0x5'));var logger=require(_0x0523('0x6'))(_0x0523('0x7'));var config=require(_0x0523('0x8'));var jayson=require(_0x0523('0x9'));var client=jayson[_0x0523('0xa')][_0x0523('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5250f1,_0x594abe,_0x1df7fe){return new BPromise(function(_0xb96e30,_0x3245dd){return client[_0x0523('0xc')](_0x5250f1,_0x1df7fe)[_0x0523('0xd')](function(_0x2a6d38){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x594abe,_0x0523('0xe'));logger['debug'](_0x0523('0xf'),_0x594abe,_0x0523('0xe'),JSON['stringify'](_0x2a6d38));if(_0x2a6d38['error']){if(_0x2a6d38['error'][_0x0523('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x594abe,_0x2a6d38[_0x0523('0x11')]['message']);return _0x3245dd(_0x2a6d38['error'][_0x0523('0x12')]);}logger[_0x0523('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x594abe,_0x2a6d38[_0x0523('0x11')][_0x0523('0x12')]);return _0xb96e30(_0x2a6d38[_0x0523('0x11')]['message']);}else{logger[_0x0523('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x594abe,'request\x20sent');_0xb96e30(_0x2a6d38['result'][_0x0523('0x12')]);}})['catch'](function(_0x57c422){logger['error'](_0x0523('0x14'),_0x594abe,_0x57c422);_0x3245dd(_0x57c422);});});} \ No newline at end of file +var _0x1d74=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4d6b44,_0x407176){var _0x517105=function(_0x28f698){while(--_0x28f698){_0x4d6b44['push'](_0x4d6b44['shift']());}};_0x517105(++_0x407176);}(_0x1d74,0xf3));var _0x41d7=function(_0x1f4528,_0x1571f7){_0x1f4528=_0x1f4528-0x0;var _0x15ec4c=_0x1d74[_0x1f4528];return _0x15ec4c;};'use strict';var _=require(_0x41d7('0x0'));var util=require('util');var moment=require(_0x41d7('0x1'));var BPromise=require(_0x41d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41d7('0x3'));var db=require(_0x41d7('0x4'))['db'];var utils=require(_0x41d7('0x5'));var logger=require(_0x41d7('0x6'))('rpc');var config=require(_0x41d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41d7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f73c6,_0x17a1bb,_0xfbcc33){return new BPromise(function(_0x3fadd5,_0x5289d1){return client['request'](_0x2f73c6,_0xfbcc33)[_0x41d7('0x9')](function(_0x413dd1){logger[_0x41d7('0xa')](_0x41d7('0xb'),_0x17a1bb,_0x41d7('0xc'));logger[_0x41d7('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x17a1bb,_0x41d7('0xc'),JSON[_0x41d7('0xe')](_0x413dd1));if(_0x413dd1[_0x41d7('0xf')]){if(_0x413dd1[_0x41d7('0xf')][_0x41d7('0x10')]===0x1f4){logger[_0x41d7('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x17a1bb,_0x413dd1[_0x41d7('0xf')][_0x41d7('0x11')]);return _0x5289d1(_0x413dd1[_0x41d7('0xf')][_0x41d7('0x11')]);}logger[_0x41d7('0xf')](_0x41d7('0xb'),_0x17a1bb,_0x413dd1['error'][_0x41d7('0x11')]);return _0x3fadd5(_0x413dd1['error'][_0x41d7('0x11')]);}else{logger[_0x41d7('0xa')](_0x41d7('0xb'),_0x17a1bb,_0x41d7('0xc'));_0x3fadd5(_0x413dd1[_0x41d7('0x12')][_0x41d7('0x11')]);}})[_0x41d7('0x13')](function(_0x2ad0e0){logger[_0x41d7('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x17a1bb,_0x2ad0e0);_0x5289d1(_0x2ad0e0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cc9739b..f6c7f24 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(_0x478c71,_0x256526){var _0x50c512=function(_0x358f69){while(--_0x358f69){_0x478c71['push'](_0x478c71['shift']());}};_0x50c512(++_0x256526);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x23fdcd,_0x4760a4){var _0x413768=function(_0x2e1f37){while(--_0x2e1f37){_0x23fdcd['push'](_0x23fdcd['shift']());}};_0x413768(++_0x4760a4);}(_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'));module[_0x0a9e('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 daf73de..ca63ffa 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 _0xb722=['sequelize','exports','INTEGER'];(function(_0x284648,_0x1358fc){var _0x272d7f=function(_0x469b25){while(--_0x469b25){_0x284648['push'](_0x284648['shift']());}};_0x272d7f(++_0x1358fc);}(_0xb722,0x180));var _0x2b72=function(_0x260e0d,_0x33f175){_0x260e0d=_0x260e0d-0x0;var _0x3a82b6=_0xb722[_0x260e0d];return _0x3a82b6;};'use strict';var Sequelize=require(_0x2b72('0x0'));module[_0x2b72('0x1')]={'penalty':{'type':Sequelize[_0x2b72('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2b72('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe037=['sequelize','INTEGER'];(function(_0x5624d9,_0x41f9a0){var _0x2ab745=function(_0xf18e8){while(--_0xf18e8){_0x5624d9['push'](_0x5624d9['shift']());}};_0x2ab745(++_0x41f9a0);}(_0xe037,0xc2));var _0x7e03=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0xe037[_0xa522f];return _0x2083b0;};'use strict';var Sequelize=require(_0x7e03('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7e03('0x1')],'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 6db511a..c8df4a9 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 _0x1e53=['exports','define','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','../../config/environment','./userFaxQueue.attributes'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1e53,0x1c5));var _0x31e5=function(_0x5eb4bb,_0xbd4598){_0x5eb4bb=_0x5eb4bb-0x0;var _0x12d25b=_0x1e53[_0x5eb4bb];return _0x12d25b;};'use strict';var _=require('lodash');var util=require(_0x31e5('0x0'));var logger=require(_0x31e5('0x1'))(_0x31e5('0x2'));var moment=require(_0x31e5('0x3'));var BPromise=require(_0x31e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31e5('0x5'));var attributes=require(_0x31e5('0x6'));module[_0x31e5('0x7')]=function(_0x10652f,_0x4b3443){return _0x10652f[_0x31e5('0x8')]('UserFaxQueue',attributes,{'tableName':_0x31e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe47=['bluebird','request-promise','path','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment'];(function(_0xdbb23e,_0x16d64a){var _0xf64cf4=function(_0x4571ce){while(--_0x4571ce){_0xdbb23e['push'](_0xdbb23e['shift']());}};_0xf64cf4(++_0x16d64a);}(_0xbe47,0x130));var _0x7be4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7be4('0x0'));var util=require(_0x7be4('0x1'));var logger=require('../../config/logger')(_0x7be4('0x2'));var moment=require(_0x7be4('0x3'));var BPromise=require(_0x7be4('0x4'));var rp=require(_0x7be4('0x5'));var fs=require('fs');var path=require(_0x7be4('0x6'));var rimraf=require('rimraf');var config=require(_0x7be4('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x7be4('0x8')]=function(_0x36f1d7,_0x3b7226){return _0x36f1d7['define'](_0x7be4('0x9'),attributes,{'tableName':_0x7be4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c567552..baf1058 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 _0x0fa8=['UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x1fed0d,_0x395023){var _0x351f6c=function(_0x1ff3d9){while(--_0x1ff3d9){_0x1fed0d['push'](_0x1fed0d['shift']());}};_0x351f6c(++_0x395023);}(_0x0fa8,0x102));var _0x80fa=function(_0x1cc01a,_0x10e545){_0x1cc01a=_0x1cc01a-0x0;var _0xf401d7=_0x0fa8[_0x1cc01a];return _0xf401d7;};'use strict';var _=require(_0x80fa('0x0'));var util=require(_0x80fa('0x1'));var moment=require(_0x80fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x80fa('0x3'));var fs=require('fs');var Redis=require(_0x80fa('0x4'));var db=require(_0x80fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fa('0x6'));var config=require(_0x80fa('0x7'));var jayson=require(_0x80fa('0x8'));var client=jayson['client'][_0x80fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x185782,_0x1c2422,_0x3e33be){return new BPromise(function(_0x344c05,_0x159684){return client[_0x80fa('0xa')](_0x185782,_0x3e33be)[_0x80fa('0xb')](function(_0x21f649){logger[_0x80fa('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x1c2422,_0x80fa('0xd'));logger[_0x80fa('0xe')](_0x80fa('0xf'),_0x1c2422,_0x80fa('0xd'),JSON['stringify'](_0x21f649));if(_0x21f649['error']){if(_0x21f649[_0x80fa('0x10')][_0x80fa('0x11')]===0x1f4){logger['error'](_0x80fa('0x12'),_0x1c2422,_0x21f649['error'][_0x80fa('0x13')]);return _0x159684(_0x21f649['error'][_0x80fa('0x13')]);}logger[_0x80fa('0x10')](_0x80fa('0x12'),_0x1c2422,_0x21f649['error'][_0x80fa('0x13')]);return _0x344c05(_0x21f649[_0x80fa('0x10')][_0x80fa('0x13')]);}else{logger[_0x80fa('0xc')](_0x80fa('0x12'),_0x1c2422,_0x80fa('0xd'));_0x344c05(_0x21f649['result'][_0x80fa('0x13')]);}})[_0x80fa('0x14')](function(_0x5a12b8){logger[_0x80fa('0x10')](_0x80fa('0x12'),_0x1c2422,_0x5a12b8);_0x159684(_0x5a12b8);});});} \ No newline at end of file +var _0xd476=['request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0xd476,0x193));var _0x6d47=function(_0x33aca9,_0x54dc27){_0x33aca9=_0x33aca9-0x0;var _0x59c757=_0xd476[_0x33aca9];return _0x59c757;};'use strict';var _=require(_0x6d47('0x0'));var util=require(_0x6d47('0x1'));var moment=require(_0x6d47('0x2'));var BPromise=require(_0x6d47('0x3'));var rs=require(_0x6d47('0x4'));var fs=require('fs');var Redis=require(_0x6d47('0x5'));var db=require(_0x6d47('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d47('0x7'))('rpc');var config=require(_0x6d47('0x8'));var jayson=require(_0x6d47('0x9'));var client=jayson[_0x6d47('0xa')][_0x6d47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b3fa5,_0x46cf3f,_0x41a879){return new BPromise(function(_0x5106d3,_0x332817){return client[_0x6d47('0xc')](_0x1b3fa5,_0x41a879)[_0x6d47('0xd')](function(_0x2dbf38){logger['info'](_0x6d47('0xe'),_0x46cf3f,_0x6d47('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x46cf3f,_0x6d47('0xf'),JSON[_0x6d47('0x10')](_0x2dbf38));if(_0x2dbf38[_0x6d47('0x11')]){if(_0x2dbf38[_0x6d47('0x11')][_0x6d47('0x12')]===0x1f4){logger['error'](_0x6d47('0xe'),_0x46cf3f,_0x2dbf38[_0x6d47('0x11')][_0x6d47('0x13')]);return _0x332817(_0x2dbf38[_0x6d47('0x11')]['message']);}logger[_0x6d47('0x11')](_0x6d47('0xe'),_0x46cf3f,_0x2dbf38[_0x6d47('0x11')][_0x6d47('0x13')]);return _0x5106d3(_0x2dbf38[_0x6d47('0x11')][_0x6d47('0x13')]);}else{logger[_0x6d47('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x46cf3f,_0x6d47('0xf'));_0x5106d3(_0x2dbf38[_0x6d47('0x15')][_0x6d47('0x13')]);}})['catch'](function(_0xd726ed){logger['error'](_0x6d47('0xe'),_0x46cf3f,_0xd726ed);_0x332817(_0xd726ed);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e09610c..e2f0c2f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_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'));module[_0x0a9e('0x7')]=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(_0x17ea6a,_0x35a960){var _0x247914=function(_0x3dc46d){while(--_0x3dc46d){_0x17ea6a['push'](_0x17ea6a['shift']());}};_0x247914(++_0x35a960);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a7bae,_0x4725c6){_0x5a7bae=_0x5a7bae-0x0;var _0x43c6c2=_0xedd9[_0x5a7bae];return _0x43c6c2;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 48b4d15..40f58f3 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 _0x08f6=['sequelize'];(function(_0x5f5bde,_0x8535d5){var _0x5d7566=function(_0x58f543){while(--_0x58f543){_0x5f5bde['push'](_0x5f5bde['shift']());}};_0x5d7566(++_0x8535d5);}(_0x08f6,0x110));var _0x608f=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x08f6[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require(_0x608f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9558=['INTEGER','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9558,0x181));var _0x8955=function(_0xa1bf55,_0xc0f3f){_0xa1bf55=_0xa1bf55-0x0;var _0x51a788=_0x9558[_0xa1bf55];return _0x51a788;};'use strict';var Sequelize=require(_0x8955('0x0'));module[_0x8955('0x1')]={'penalty':{'type':Sequelize[_0x8955('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 f4e742e..6f46200 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 _0x6b9a=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x529336,_0x4a591e){var _0x43194e=function(_0x5550b8){while(--_0x5550b8){_0x529336['push'](_0x529336['shift']());}};_0x43194e(++_0x4a591e);}(_0x6b9a,0xd4));var _0xa6b9=function(_0x26a56d,_0xc3cd3){_0x26a56d=_0x26a56d-0x0;var _0x220fe2=_0x6b9a[_0x26a56d];return _0x220fe2;};'use strict';var _=require(_0xa6b9('0x0'));var util=require(_0xa6b9('0x1'));var logger=require(_0xa6b9('0x2'))(_0xa6b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa6b9('0x4'));var fs=require('fs');var path=require(_0xa6b9('0x5'));var rimraf=require(_0xa6b9('0x6'));var config=require(_0xa6b9('0x7'));var attributes=require(_0xa6b9('0x8'));module['exports']=function(_0x39c27e,_0x541d41){return _0x39c27e[_0xa6b9('0x9')](_0xa6b9('0xa'),attributes,{'tableName':_0xa6b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6316=['bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','util','../../config/logger'];(function(_0xf8d2e1,_0x5afbbb){var _0x1e1595=function(_0x1159cb){while(--_0x1159cb){_0xf8d2e1['push'](_0xf8d2e1['shift']());}};_0x1e1595(++_0x5afbbb);}(_0x6316,0x8a));var _0x6631=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6316[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x6631('0x0'));var logger=require(_0x6631('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6631('0x2'));var rp=require(_0x6631('0x3'));var fs=require('fs');var path=require(_0x6631('0x4'));var rimraf=require(_0x6631('0x5'));var config=require('../../config/environment');var attributes=require(_0x6631('0x6'));module[_0x6631('0x7')]=function(_0x1a3767,_0x30f027){return _0x1a3767[_0x6631('0x8')]('UserMailQueue',attributes,{'tableName':_0x6631('0x9'),'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 bbb7ab2..222f6c5 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x22bb93,_0x4570a0){var _0x5dc5be=function(_0x29fe78){while(--_0x29fe78){_0x22bb93['push'](_0x22bb93['shift']());}};_0x5dc5be(++_0x4570a0);}(_0x55ca,0x126));var _0xa55c=function(_0x29379a,_0x16b64f){_0x29379a=_0x29379a-0x0;var _0x125b52=_0x55ca[_0x29379a];return _0x125b52;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x5d64fd,_0x18ad29){var _0x2e1c03=function(_0x326643){while(--_0x326643){_0x5d64fd['push'](_0x5d64fd['shift']());}};_0x2e1c03(++_0x18ad29);}(_0x3e74,0x175));var _0x43e7=function(_0x1a1a0c,_0x2cef0f){_0x1a1a0c=_0x1a1a0c-0x0;var _0x209613=_0x3e74[_0x1a1a0c];return _0x209613;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 489abfa..ff6f061 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 _0x0329=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout'];(function(_0x130e83,_0x4a9ad4){var _0x4ebf75=function(_0x4098e7){while(--_0x4098e7){_0x130e83['push'](_0x130e83['shift']());}};_0x4ebf75(++_0x4a9ad4);}(_0x0329,0xe1));var _0x9032=function(_0x4e5af1,_0x1dfc1f){_0x4e5af1=_0x4e5af1-0x0;var _0x357f9d=_0x0329[_0x4e5af1];return _0x357f9d;};'use strict';var multer=require('multer');var util=require(_0x9032('0x0'));var path=require(_0x9032('0x1'));var timeout=require(_0x9032('0x2'));var express=require(_0x9032('0x3'));var router=express['Router']();var fs_extra=require(_0x9032('0x4'));var auth=require(_0x9032('0x5'));var interaction=require(_0x9032('0x6'));var config=require(_0x9032('0x7'));var controller=require('./userNotification.controller');router[_0x9032('0x8')]('/',auth[_0x9032('0x9')](),controller[_0x9032('0xa')]);module[_0x9032('0xb')]=router; \ No newline at end of file +var _0xce1f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','exports'];(function(_0x29c33d,_0x4b631e){var _0xe2228d=function(_0x48ae44){while(--_0x48ae44){_0x29c33d['push'](_0x29c33d['shift']());}};_0xe2228d(++_0x4b631e);}(_0xce1f,0x114));var _0xfce1=function(_0x3abaa2,_0x21bb51){_0x3abaa2=_0x3abaa2-0x0;var _0x5e224d=_0xce1f[_0x3abaa2];return _0x5e224d;};'use strict';var multer=require(_0xfce1('0x0'));var util=require(_0xfce1('0x1'));var path=require(_0xfce1('0x2'));var timeout=require(_0xfce1('0x3'));var express=require(_0xfce1('0x4'));var router=express[_0xfce1('0x5')]();var fs_extra=require(_0xfce1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfce1('0x7'));var config=require(_0xfce1('0x8'));var controller=require(_0xfce1('0x9'));router['post']('/',auth[_0xfce1('0xa')](),controller['sendUserNotification']);module[_0xfce1('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 8cb10ea..3c16ce5 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 _0xd56f=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x1a0121,_0x4149f8){var _0x4db574=function(_0x1e2575){while(--_0x1e2575){_0x1a0121['push'](_0x1a0121['shift']());}};_0x4db574(++_0x4149f8);}(_0xd56f,0x14c));var _0xfd56=function(_0x114dbf,_0x3dd101){_0x114dbf=_0x114dbf-0x0;var _0x5953c9=_0xd56f[_0x114dbf];return _0x5953c9;};'use strict';var Sequelize=require(_0xfd56('0x0'));module[_0xfd56('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xfd56('0x2')]},'recipientsId':{'type':Sequelize[_0xfd56('0x3')]},'recipientsDescription':{'type':Sequelize[_0xfd56('0x2')]},'beep':{'type':Sequelize[_0xfd56('0x4')]}}; \ No newline at end of file +var _0x4984=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4a02bf,_0x3040bb){var _0x5b3559=function(_0x5b4ac2){while(--_0x5b4ac2){_0x4a02bf['push'](_0x4a02bf['shift']());}};_0x5b3559(++_0x3040bb);}(_0x4984,0x197));var _0x4498=function(_0x1e2354,_0x42567c){_0x1e2354=_0x1e2354-0x0;var _0xe32e0a=_0x4984[_0x1e2354];return _0xe32e0a;};'use strict';var Sequelize=require(_0x4498('0x0'));module[_0x4498('0x1')]={'body':{'type':Sequelize[_0x4498('0x2')]},'senderName':{'type':Sequelize[_0x4498('0x3')]},'recipientsId':{'type':Sequelize[_0x4498('0x2')]},'recipientsDescription':{'type':Sequelize[_0x4498('0x3')]},'beep':{'type':Sequelize[_0x4498('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a44db02..482f385 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 _0x1503=['fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','replace','queue','Queue','push','union','flatten','map','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x6bab25,_0x1eb377){var _0xa36413=function(_0x290e76){while(--_0x290e76){_0x6bab25['push'](_0x6bab25['shift']());}};_0xa36413(++_0x1eb377);}(_0x1503,0x16b));var _0x3150=function(_0x4c8f4a,_0x4462a8){_0x4c8f4a=_0x4c8f4a-0x0;var _0x2ff4da=_0x1503[_0x4c8f4a];return _0x2ff4da;};'use strict';var emlformat=require(_0x3150('0x0'));var rimraf=require(_0x3150('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3150('0x2'));var moment=require(_0x3150('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3150('0x4'));var util=require('util');var path=require(_0x3150('0x5'));var sox=require(_0x3150('0x6'));var csv=require(_0x3150('0x7'));var ejs=require(_0x3150('0x8'));var fs=require('fs');var fs_extra=require(_0x3150('0x9'));var _=require(_0x3150('0xa'));var squel=require(_0x3150('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3150('0xc'));var toCsv=require(_0x3150('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3150('0xd'));var authService=require(_0x3150('0xe'));var qs=require(_0x3150('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3150('0x10'));var logger=require(_0x3150('0x11'))(_0x3150('0x12'));var utils=require(_0x3150('0x13'));var config=require(_0x3150('0x14'));var licenseUtil=require(_0x3150('0x15'));var db=require(_0x3150('0x16'))['db'];config[_0x3150('0x17')]=_[_0x3150('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3150('0x19'))(new Redis(config[_0x3150('0x17')]));require(_0x3150('0x1a'))[_0x3150('0x1b')](socket);function respondWithStatusCode(_0x5032c5,_0x154553){_0x154553=_0x154553||0xcc;return function(_0x36e673){if(_0x36e673){return _0x5032c5[_0x3150('0x1c')](_0x154553);}return _0x5032c5['status'](_0x154553)[_0x3150('0x1d')]();};}function respondWithResult(_0x4b3982,_0x4baaac){_0x4baaac=_0x4baaac||0xc8;return function(_0x2fef76){if(_0x2fef76){return _0x4b3982['status'](_0x4baaac)[_0x3150('0x1e')](_0x2fef76);}};}function respondWithFilteredResult(_0xd4cedb,_0x3e4d52){return function(_0x980aa4){if(_0x980aa4){var _0x41d042=typeof _0x3e4d52['offset']===_0x3150('0x1f')&&typeof _0x3e4d52[_0x3150('0x20')]==='undefined';var _0x37fd31=_0x980aa4[_0x3150('0x21')];var _0x5de54c=_0x41d042?0x0:_0x3e4d52[_0x3150('0x22')];var _0x12f271=_0x41d042?_0x980aa4[_0x3150('0x21')]:_0x3e4d52['offset']+_0x3e4d52[_0x3150('0x20')];var _0xf5fb12;if(_0x12f271>=_0x37fd31){_0x12f271=_0x37fd31;_0xf5fb12=0xc8;}else{_0xf5fb12=0xce;}_0xd4cedb[_0x3150('0x23')](_0xf5fb12);return _0xd4cedb['set'](_0x3150('0x24'),_0x5de54c+'-'+_0x12f271+'/'+_0x37fd31)[_0x3150('0x1e')](_0x980aa4);}return null;};}function patchUpdates(_0x4609d5){return function(_0x533f9c){try{jsonpatch['apply'](_0x533f9c,_0x4609d5,!![]);}catch(_0x45242b){return BPromise['reject'](_0x45242b);}return _0x533f9c['save']();};}function saveUpdates(_0x24f34a,_0x5ed6de){return function(_0x1c9638){if(_0x1c9638){return _0x1c9638[_0x3150('0x25')](_0x24f34a)[_0x3150('0x26')](function(_0x19a10d){return _0x19a10d;});}return null;};}function removeEntity(_0x4f83d3,_0x3d2d82){return function(_0x3179e4){if(_0x3179e4){return _0x3179e4['destroy']()[_0x3150('0x26')](function(){_0x4f83d3[_0x3150('0x23')](0xcc)[_0x3150('0x1d')]();});}};}function handleEntityNotFound(_0x15b1ad,_0x22d735){return function(_0x5dc750){if(!_0x5dc750){_0x15b1ad['sendStatus'](0x194);}return _0x5dc750;};}function handleError(_0x3d9bd8,_0x1afff9){_0x1afff9=_0x1afff9||0x1f4;return function(_0xa8bbe5){logger[_0x3150('0x27')](_0xa8bbe5[_0x3150('0x28')]);if(_0xa8bbe5['name']){delete _0xa8bbe5[_0x3150('0x29')];}_0x3d9bd8[_0x3150('0x23')](_0x1afff9)[_0x3150('0x2a')](_0xa8bbe5);};}exports[_0x3150('0x2b')]=function(_0xf534ab,_0x163a1f,_0x35869c){if(!_0xf534ab['body']['hasOwnProperty']('text')&&!_0xf534ab[_0x3150('0x2c')][_0x3150('0x2d')]('TemplateId')){throw new db[(_0x3150('0x2e'))][(_0x3150('0x2f'))](_0x3150('0x30'));}else{if(_0xf534ab['body']['hasOwnProperty']('TemplateId')&&!_0xf534ab[_0x3150('0x2c')][_0x3150('0x2d')](_0x3150('0x31'))){throw new db[(_0x3150('0x2e'))][(_0x3150('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xf534ab[_0x3150('0x2c')][_0x3150('0x2d')]('recipients')){throw new db[(_0x3150('0x2e'))][(_0x3150('0x2f'))](_0x3150('0x32'));}else{try{var _0x20df22=JSON['parse'](_0xf534ab[_0x3150('0x2c')]['recipients']);}catch(_0x18f5f3){logger['error'](_0x18f5f3);throw new db['Sequelize'][(_0x3150('0x2f'))](_0x3150('0x33'));}var _0x2dc7a7=[_0x3150('0x34'),_0x3150('0x35'),'mailqueue',_0x3150('0x36'),'smsqueue',_0x3150('0x37'),_0x3150('0x38'),_0x3150('0x39'),_0x3150('0x3a')];if(_[_0x3150('0x3b')](_0x20df22,function(_0x234e96){return!_[_0x3150('0x3c')](_0x2dc7a7,_0x234e96[_0x3150('0x3d')][_0x3150('0x3e')]());})){throw new db[(_0x3150('0x2e'))][(_0x3150('0x2f'))](_0x3150('0x3f'));}}}var _0x3feade={};_0x3feade[_0x3150('0x40')]=_0xf534ab[_0x3150('0x2c')][_0x3150('0x2d')](_0x3150('0x40'))?_0xf534ab[_0x3150('0x2c')]['senderName']:_0xf534ab['user']['fullname'];_0x3feade[_0x3150('0x41')]=_[_0x3150('0x42')](_0xf534ab[_0x3150('0x2c')][_0x3150('0x41')])?null:_0xf534ab[_0x3150('0x2c')][_0x3150('0x41')];_0x3feade[_0x3150('0x43')]=_0xf534ab[_0x3150('0x2c')][_0x3150('0x43')]||![];_0x3feade['SenderId']=_0xf534ab[_0x3150('0x3a')]['id'];return getContent(_0xf534ab[_0x3150('0x2c')])[_0x3150('0x26')](function(_0x35f642){_0x3feade[_0x3150('0x2c')]=_0x35f642;return getRecipients(_0x20df22);})[_0x3150('0x26')](function(_0x4f19fa){_0x3feade['recipientsId']=_[_0x3150('0x44')](_0x4f19fa)[_0x3150('0x45')](',');return db[_0x3150('0x46')][_0x3150('0x47')](function(_0x54b233){return db[_0x3150('0x48')]['create'](_0x3feade,{'raw':!![],'transaction':_0x54b233})[_0x3150('0x26')](function(_0x16d5f5){var _0x434319={'sender':_0x3feade[_0x3150('0x40')],'description':_0x3feade['recipientsDescription'],'content':_0x3feade['body'],'beep':_0x3feade['beep']};_0x4f19fa[_0x3150('0x49')](function(_0x451f18){_0x434319[_0x3150('0x4a')]=_0x451f18;socket[_0x3150('0x4b')](_0x3150('0x4c'),_0x434319);});return _0x16d5f5;});});})[_0x3150('0x26')](respondWithResult(_0x163a1f,0xc9))['catch'](handleError(_0x163a1f,null));};function getContent(_0x3272d6){return new BPromise(function(_0x3554ac,_0x170c85){if(_0x3272d6[_0x3150('0x4d')]){_0x3554ac(_0x3272d6['text']);return;}return db[_0x3150('0x4e')][_0x3150('0x4f')]({'attributes':[_0x3150('0x50')],'where':{'id':_0x3272d6['TemplateId']},'raw':!![]})['then'](function(_0x24f9d8){if(!_0x24f9d8)throw new db[(_0x3150('0x2e'))][(_0x3150('0x2f'))](_0x3150('0x51'));var _0x35d9f9=Mustache[_0x3150('0x52')](_0x24f9d8[_0x3150('0x50')],_0x3272d6[_0x3150('0x31')]);_0x3554ac(_0x35d9f9);})['catch'](function(_0xbc1bd7){_0x170c85(_0xbc1bd7);});});}function getRecipients(_0x5067df){return new BPromise(function(_0x34061f,_0x2ae55c){var _0x57aeb3=[];var _0x1c8a5e=[];_0x5067df[_0x3150('0x49')](function(_0x5e2b55){var _0x3c65c0=_[_0x3150('0x53')](_0x5e2b55['model']['toLowerCase']());if(_0x3c65c0===_0x3150('0x54')){_0x57aeb3=_['union'](_0x57aeb3,_0x5e2b55[_0x3150('0x55')]);}else{if(_[_0x3150('0x3c')](_0x3c65c0,'queue'))_0x3c65c0=_0x3c65c0[_0x3150('0x56')](_0x3150('0x57'),_0x3150('0x58'));_0x5e2b55['ids'][_0x3150('0x49')](function(_0x4be848){_0x1c8a5e[_0x3150('0x59')](getAgents(_0x3c65c0,_0x4be848));});}});return BPromise['all'](_0x1c8a5e)[_0x3150('0x26')](function(_0x377c01){_0x57aeb3=_[_0x3150('0x5a')](_0x57aeb3,_[_0x3150('0x5b')](_0x377c01));_0x34061f(_0x57aeb3);})['catch'](function(_0x44a5ce){_0x2ae55c(_0x44a5ce);});});}function getAgents(_0x101d1a,_0x48d0ec){return new BPromise(function(_0x4429ca,_0xc6d8cd){return db[_0x101d1a][_0x3150('0x4f')]({'where':{'id':_0x48d0ec}})[_0x3150('0x26')](function(_0xa91920){return _0xa91920['getAgents']({'attributes':['id'],'raw':!![]})[_0x3150('0x26')](function(_0x10bf02){var _0x2011f9=_[_0x3150('0x5c')](_0x10bf02,'id');_0x4429ca(_0x2011f9);});})['catch'](function(_0x536acb){_0xc6d8cd(_0x536acb);});});} \ No newline at end of file +var _0x2060=['send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','then','join','sequelize','create','forEach','recipient','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','model','union','ids','queue','replace','all','flatten','map','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','end','stack','name'];(function(_0x233014,_0x5140a9){var _0x366e39=function(_0x4e128d){while(--_0x4e128d){_0x233014['push'](_0x233014['shift']());}};_0x366e39(++_0x5140a9);}(_0x2060,0x94));var _0x0206=function(_0x55b0d3,_0x5ee174){_0x55b0d3=_0x55b0d3-0x0;var _0x35a766=_0x2060[_0x55b0d3];return _0x35a766;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0206('0x0'));var zipdir=require(_0x0206('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0206('0x2'));var moment=require(_0x0206('0x3'));var BPromise=require(_0x0206('0x4'));var Mustache=require(_0x0206('0x5'));var util=require('util');var path=require(_0x0206('0x6'));var sox=require('sox');var csv=require(_0x0206('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0206('0x8'));var _=require('lodash');var squel=require(_0x0206('0x9'));var crypto=require('crypto');var jsforce=require(_0x0206('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0206('0x7'));var querystring=require(_0x0206('0xb'));var Papa=require(_0x0206('0xc'));var Redis=require(_0x0206('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0206('0xe'));var hardwareService=require(_0x0206('0xf'));var logger=require(_0x0206('0x10'))('api');var utils=require(_0x0206('0x11'));var config=require(_0x0206('0x12'));var licenseUtil=require(_0x0206('0x13'));var db=require(_0x0206('0x14'))['db'];config[_0x0206('0x15')]=_[_0x0206('0x16')](config[_0x0206('0x15')],{'host':_0x0206('0x17'),'port':0x18eb});var socket=require(_0x0206('0x18'))(new Redis(config[_0x0206('0x15')]));require(_0x0206('0x19'))[_0x0206('0x1a')](socket);function respondWithStatusCode(_0x986773,_0x110d3b){_0x110d3b=_0x110d3b||0xcc;return function(_0x54912f){if(_0x54912f){return _0x986773[_0x0206('0x1b')](_0x110d3b);}return _0x986773[_0x0206('0x1c')](_0x110d3b)['end']();};}function respondWithResult(_0x31f692,_0x33e68d){_0x33e68d=_0x33e68d||0xc8;return function(_0x5d15a2){if(_0x5d15a2){return _0x31f692['status'](_0x33e68d)[_0x0206('0x1d')](_0x5d15a2);}};}function respondWithFilteredResult(_0x8f28e8,_0x18fcbc){return function(_0x3f4cb4){if(_0x3f4cb4){var _0x1a0600=typeof _0x18fcbc['offset']===_0x0206('0x1e')&&typeof _0x18fcbc['limit']===_0x0206('0x1e');var _0x222cbf=_0x3f4cb4[_0x0206('0x1f')];var _0x384282=_0x1a0600?0x0:_0x18fcbc[_0x0206('0x20')];var _0xc369f4=_0x1a0600?_0x3f4cb4[_0x0206('0x1f')]:_0x18fcbc[_0x0206('0x20')]+_0x18fcbc['limit'];var _0x5a74d4;if(_0xc369f4>=_0x222cbf){_0xc369f4=_0x222cbf;_0x5a74d4=0xc8;}else{_0x5a74d4=0xce;}_0x8f28e8[_0x0206('0x1c')](_0x5a74d4);return _0x8f28e8[_0x0206('0x21')](_0x0206('0x22'),_0x384282+'-'+_0xc369f4+'/'+_0x222cbf)['json'](_0x3f4cb4);}return null;};}function patchUpdates(_0x35df97){return function(_0xc801e){try{jsonpatch[_0x0206('0x23')](_0xc801e,_0x35df97,!![]);}catch(_0x54a140){return BPromise[_0x0206('0x24')](_0x54a140);}return _0xc801e[_0x0206('0x25')]();};}function saveUpdates(_0x271167,_0x378c09){return function(_0x1f8178){if(_0x1f8178){return _0x1f8178['update'](_0x271167)['then'](function(_0x5a56f1){return _0x5a56f1;});}return null;};}function removeEntity(_0x1c1558,_0x3aabfd){return function(_0x14f0e2){if(_0x14f0e2){return _0x14f0e2[_0x0206('0x26')]()['then'](function(){_0x1c1558['status'](0xcc)[_0x0206('0x27')]();});}};}function handleEntityNotFound(_0x314cf6,_0x902a61){return function(_0x4b201c){if(!_0x4b201c){_0x314cf6[_0x0206('0x1b')](0x194);}return _0x4b201c;};}function handleError(_0x570bda,_0x1b8a65){_0x1b8a65=_0x1b8a65||0x1f4;return function(_0x1a0065){logger['error'](_0x1a0065[_0x0206('0x28')]);if(_0x1a0065[_0x0206('0x29')]){delete _0x1a0065[_0x0206('0x29')];}_0x570bda[_0x0206('0x1c')](_0x1b8a65)[_0x0206('0x2a')](_0x1a0065);};}exports['sendUserNotification']=function(_0x48fd4e,_0x315735,_0x55de26){if(!_0x48fd4e[_0x0206('0x2b')][_0x0206('0x2c')]('text')&&!_0x48fd4e[_0x0206('0x2b')][_0x0206('0x2c')](_0x0206('0x2d'))){throw new db[(_0x0206('0x2e'))][(_0x0206('0x2f'))](_0x0206('0x30'));}else{if(_0x48fd4e['body'][_0x0206('0x2c')](_0x0206('0x2d'))&&!_0x48fd4e[_0x0206('0x2b')]['hasOwnProperty'](_0x0206('0x31'))){throw new db['Sequelize'][(_0x0206('0x2f'))](_0x0206('0x32'));}if(!_0x48fd4e[_0x0206('0x2b')][_0x0206('0x2c')](_0x0206('0x33'))){throw new db[(_0x0206('0x2e'))]['ValidationError'](_0x0206('0x34'));}else{try{var _0x53ae2d=JSON[_0x0206('0x35')](_0x48fd4e[_0x0206('0x2b')][_0x0206('0x33')]);}catch(_0x546fc6){logger[_0x0206('0x36')](_0x546fc6);throw new db[(_0x0206('0x2e'))][(_0x0206('0x2f'))](_0x0206('0x37'));}var _0x4eb7b5=[_0x0206('0x38'),_0x0206('0x39'),_0x0206('0x3a'),'openchannelqueue',_0x0206('0x3b'),_0x0206('0x3c'),'whatsappqueue',_0x0206('0x3d'),_0x0206('0x3e')];if(_[_0x0206('0x3f')](_0x53ae2d,function(_0x596589){return!_[_0x0206('0x40')](_0x4eb7b5,_0x596589['model'][_0x0206('0x41')]());})){throw new db[(_0x0206('0x2e'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3f3c0f={};_0x3f3c0f[_0x0206('0x42')]=_0x48fd4e[_0x0206('0x2b')][_0x0206('0x2c')]('senderName')?_0x48fd4e['body']['senderName']:_0x48fd4e['user'][_0x0206('0x43')];_0x3f3c0f['recipientsDescription']=_[_0x0206('0x44')](_0x48fd4e[_0x0206('0x2b')]['recipientsDescription'])?null:_0x48fd4e[_0x0206('0x2b')][_0x0206('0x45')];_0x3f3c0f[_0x0206('0x46')]=_0x48fd4e['body'][_0x0206('0x46')]||![];_0x3f3c0f[_0x0206('0x47')]=_0x48fd4e[_0x0206('0x3e')]['id'];return getContent(_0x48fd4e['body'])[_0x0206('0x48')](function(_0x226eea){_0x3f3c0f[_0x0206('0x2b')]=_0x226eea;return getRecipients(_0x53ae2d);})[_0x0206('0x48')](function(_0x5556ef){_0x3f3c0f['recipientsId']=_['sortBy'](_0x5556ef)[_0x0206('0x49')](',');return db[_0x0206('0x4a')]['transaction'](function(_0x351b40){return db['UserNotification'][_0x0206('0x4b')](_0x3f3c0f,{'raw':!![],'transaction':_0x351b40})[_0x0206('0x48')](function(_0x5def1b){var _0x47b7b1={'sender':_0x3f3c0f[_0x0206('0x42')],'description':_0x3f3c0f['recipientsDescription'],'content':_0x3f3c0f[_0x0206('0x2b')],'beep':_0x3f3c0f[_0x0206('0x46')]};_0x5556ef[_0x0206('0x4c')](function(_0x197901){_0x47b7b1[_0x0206('0x4d')]=_0x197901;socket['emit'](_0x0206('0x4e'),_0x47b7b1);});return _0x5def1b;});});})[_0x0206('0x48')](respondWithResult(_0x315735,0xc9))['catch'](handleError(_0x315735,null));};function getContent(_0x39722c){return new BPromise(function(_0x53af04,_0x4a6ee7){if(_0x39722c[_0x0206('0x4f')]){_0x53af04(_0x39722c[_0x0206('0x4f')]);return;}return db[_0x0206('0x50')][_0x0206('0x51')]({'attributes':[_0x0206('0x52')],'where':{'id':_0x39722c['TemplateId']},'raw':!![]})[_0x0206('0x48')](function(_0x4ec8d8){if(!_0x4ec8d8)throw new db['Sequelize'][(_0x0206('0x2f'))](_0x0206('0x53'));var _0x3651b5=Mustache[_0x0206('0x54')](_0x4ec8d8['html'],_0x39722c[_0x0206('0x31')]);_0x53af04(_0x3651b5);})[_0x0206('0x55')](function(_0x2c6a50){_0x4a6ee7(_0x2c6a50);});});}function getRecipients(_0x405f85){return new BPromise(function(_0x5bb38b,_0x26d02c){var _0x526ac5=[];var _0x407bb=[];_0x405f85[_0x0206('0x4c')](function(_0x1db746){var _0x68ff37=_[_0x0206('0x56')](_0x1db746[_0x0206('0x57')][_0x0206('0x41')]());if(_0x68ff37==='User'){_0x526ac5=_[_0x0206('0x58')](_0x526ac5,_0x1db746[_0x0206('0x59')]);}else{if(_[_0x0206('0x40')](_0x68ff37,_0x0206('0x5a')))_0x68ff37=_0x68ff37[_0x0206('0x5b')]('queue','Queue');_0x1db746['ids']['forEach'](function(_0x209331){_0x407bb['push'](getAgents(_0x68ff37,_0x209331));});}});return BPromise[_0x0206('0x5c')](_0x407bb)[_0x0206('0x48')](function(_0x523540){_0x526ac5=_[_0x0206('0x58')](_0x526ac5,_[_0x0206('0x5d')](_0x523540));_0x5bb38b(_0x526ac5);})[_0x0206('0x55')](function(_0x2f0c1a){_0x26d02c(_0x2f0c1a);});});}function getAgents(_0x43da04,_0x1ea989){return new BPromise(function(_0x2aeca0,_0x100335){return db[_0x43da04][_0x0206('0x51')]({'where':{'id':_0x1ea989}})[_0x0206('0x48')](function(_0x4ab65d){return _0x4ab65d['getAgents']({'attributes':['id'],'raw':!![]})[_0x0206('0x48')](function(_0x404277){var _0x269853=_[_0x0206('0x5e')](_0x404277,'id');_0x2aeca0(_0x269853);});})['catch'](function(_0x541529){_0x100335(_0x541529);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 568dcf9..e9b129d 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 _0x2a49=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','save'];(function(_0x27fa56,_0x4def9b){var _0x25b2bc=function(_0x5b98e4){while(--_0x5b98e4){_0x27fa56['push'](_0x27fa56['shift']());}};_0x25b2bc(++_0x4def9b);}(_0x2a49,0x178));var _0x92a4=function(_0x37ab6b,_0xe82cc7){_0x37ab6b=_0x37ab6b-0x0;var _0x5ce752=_0x2a49[_0x37ab6b];return _0x5ce752;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x92a4('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x92a4('0x1'),'afterUpdate':'update','afterDestroy':_0x92a4('0x2')};function emitEvent(_0x3acdbf){return function(_0xc27aa1,_0x23b6b1,_0x2fe3d1){UserNotificationEvents[_0x92a4('0x3')](_0x3acdbf+':'+_0xc27aa1['id'],_0xc27aa1);UserNotificationEvents[_0x92a4('0x3')](_0x3acdbf,_0xc27aa1);_0x2fe3d1(null);};}for(var e in events){if(events[_0x92a4('0x4')](e)){var event=events[e];UserNotification[_0x92a4('0x5')](e,emitEvent(event));}}module[_0x92a4('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x2c8f=['setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb','UserNotification'];(function(_0x1ac69c,_0x114530){var _0x4605f7=function(_0x3a4705){while(--_0x3a4705){_0x1ac69c['push'](_0x1ac69c['shift']());}};_0x4605f7(++_0x114530);}(_0x2c8f,0x8a));var _0xf2c8=function(_0x592916,_0x54bf02){_0x592916=_0x592916-0x0;var _0x24b53a=_0x2c8f[_0x592916];return _0x24b53a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xf2c8('0x0'))['db'][_0xf2c8('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf2c8('0x2')](0x0);var events={'afterCreate':_0xf2c8('0x3'),'afterUpdate':_0xf2c8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3150ee){return function(_0x11972b,_0x5e050d,_0x1aebb9){UserNotificationEvents['emit'](_0x3150ee+':'+_0x11972b['id'],_0x11972b);UserNotificationEvents[_0xf2c8('0x5')](_0x3150ee,_0x11972b);_0x1aebb9(null);};}for(var e in events){if(events[_0xf2c8('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ee69484..68b3b71 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 _0xc703=['api','path','rimraf','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xc703,0x147));var _0x3c70=function(_0x27bca8,_0x191f63){_0x27bca8=_0x27bca8-0x0;var _0x370163=_0xc703[_0x27bca8];return _0x370163;};'use strict';var _=require(_0x3c70('0x0'));var util=require(_0x3c70('0x1'));var logger=require(_0x3c70('0x2'))(_0x3c70('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c70('0x4'));var rimraf=require(_0x3c70('0x5'));var config=require('../../config/environment');var attributes=require(_0x3c70('0x6'));module['exports']=function(_0x2528cc,_0x5794d4){return _0x2528cc[_0x3c70('0x7')](_0x3c70('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c70('0x9'),'collate':_0x3c70('0xa')});}; \ No newline at end of file +var _0x31b3=['exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x31b3,0x198));var _0x331b=function(_0x1ed511,_0x5bd8f0){_0x1ed511=_0x1ed511-0x0;var _0x32ab7b=_0x31b3[_0x1ed511];return _0x32ab7b;};'use strict';var _=require(_0x331b('0x0'));var util=require(_0x331b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x331b('0x2'));var rp=require(_0x331b('0x3'));var fs=require('fs');var path=require(_0x331b('0x4'));var rimraf=require(_0x331b('0x5'));var config=require(_0x331b('0x6'));var attributes=require(_0x331b('0x7'));module[_0x331b('0x8')]=function(_0x715707,_0x3b47e2){return _0x715707[_0x331b('0x9')]('UserNotification',attributes,{'tableName':_0x331b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x331b('0xb'),'collate':_0x331b('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1c05f74..896979b 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 _0xe949=['client','http','redis','defaults','localhost','socket.io-emitter','request','then','UserNotification,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe949,0xac));var _0x9e94=function(_0x54e6f0,_0x122d5d){_0x54e6f0=_0x54e6f0-0x0;var _0x475d57=_0xe949[_0x54e6f0];return _0x475d57;};'use strict';var _=require(_0x9e94('0x0'));var util=require(_0x9e94('0x1'));var moment=require(_0x9e94('0x2'));var BPromise=require(_0x9e94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e94('0x4'));var db=require(_0x9e94('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e94('0x6'))(_0x9e94('0x7'));var config=require(_0x9e94('0x8'));var jayson=require(_0x9e94('0x9'));var client=jayson[_0x9e94('0xa')][_0x9e94('0xb')]({'port':0x232a});config[_0x9e94('0xc')]=_[_0x9e94('0xd')](config[_0x9e94('0xc')],{'host':_0x9e94('0xe'),'port':0x18eb});var socket=require(_0x9e94('0xf'))(new Redis(config[_0x9e94('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x20ce46,_0x54c656,_0x5652f6){return new BPromise(function(_0x32f33b,_0x961cf4){return client[_0x9e94('0x10')](_0x20ce46,_0x5652f6)[_0x9e94('0x11')](function(_0x1a0727){logger['info'](_0x9e94('0x12'),_0x54c656,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x54c656,'request\x20sent',JSON[_0x9e94('0x13')](_0x1a0727));if(_0x1a0727['error']){if(_0x1a0727[_0x9e94('0x14')][_0x9e94('0x15')]===0x1f4){logger[_0x9e94('0x14')]('UserNotification,\x20%s,\x20%s',_0x54c656,_0x1a0727['error'][_0x9e94('0x16')]);return _0x961cf4(_0x1a0727[_0x9e94('0x14')][_0x9e94('0x16')]);}logger['error'](_0x9e94('0x12'),_0x54c656,_0x1a0727[_0x9e94('0x14')][_0x9e94('0x16')]);return _0x32f33b(_0x1a0727[_0x9e94('0x14')][_0x9e94('0x16')]);}else{logger[_0x9e94('0x17')](_0x9e94('0x12'),_0x54c656,'request\x20sent');_0x32f33b(_0x1a0727[_0x9e94('0x18')]['message']);}})[_0x9e94('0x19')](function(_0x26aa5b){logger[_0x9e94('0x14')](_0x9e94('0x12'),_0x54c656,_0x26aa5b);_0x961cf4(_0x26aa5b);});});} \ No newline at end of file +var _0xf7ef=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3befca,_0x430601){var _0x429cb0=function(_0x1f4356){while(--_0x1f4356){_0x3befca['push'](_0x3befca['shift']());}};_0x429cb0(++_0x430601);}(_0xf7ef,0x123));var _0xff7e=function(_0x33572d,_0x5dfb8c){_0x33572d=_0x33572d-0x0;var _0xa1bd06=_0xf7ef[_0x33572d];return _0xa1bd06;};'use strict';var _=require('lodash');var util=require(_0xff7e('0x0'));var moment=require(_0xff7e('0x1'));var BPromise=require(_0xff7e('0x2'));var rs=require(_0xff7e('0x3'));var fs=require('fs');var Redis=require(_0xff7e('0x4'));var db=require(_0xff7e('0x5'))['db'];var utils=require(_0xff7e('0x6'));var logger=require('../../config/logger')(_0xff7e('0x7'));var config=require('../../config/environment');var jayson=require(_0xff7e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xff7e('0x9')]=_[_0xff7e('0xa')](config['redis'],{'host':_0xff7e('0xb'),'port':0x18eb});var socket=require(_0xff7e('0xc'))(new Redis(config[_0xff7e('0x9')]));require(_0xff7e('0xd'))['register'](socket);function respondWithRpcPromise(_0x436818,_0xf6aa0e,_0x1dcb47){return new BPromise(function(_0x27ffcd,_0xf606ba){return client[_0xff7e('0xe')](_0x436818,_0x1dcb47)[_0xff7e('0xf')](function(_0x3f5c64){logger[_0xff7e('0x10')](_0xff7e('0x11'),_0xf6aa0e,'request\x20sent');logger['debug'](_0xff7e('0x12'),_0xf6aa0e,_0xff7e('0x13'),JSON[_0xff7e('0x14')](_0x3f5c64));if(_0x3f5c64[_0xff7e('0x15')]){if(_0x3f5c64[_0xff7e('0x15')][_0xff7e('0x16')]===0x1f4){logger[_0xff7e('0x15')](_0xff7e('0x11'),_0xf6aa0e,_0x3f5c64[_0xff7e('0x15')]['message']);return _0xf606ba(_0x3f5c64[_0xff7e('0x15')]['message']);}logger[_0xff7e('0x15')](_0xff7e('0x11'),_0xf6aa0e,_0x3f5c64[_0xff7e('0x15')]['message']);return _0x27ffcd(_0x3f5c64[_0xff7e('0x15')][_0xff7e('0x17')]);}else{logger[_0xff7e('0x10')](_0xff7e('0x11'),_0xf6aa0e,_0xff7e('0x13'));_0x27ffcd(_0x3f5c64[_0xff7e('0x18')][_0xff7e('0x17')]);}})[_0xff7e('0x19')](function(_0x6a54e4){logger[_0xff7e('0x15')]('UserNotification,\x20%s,\x20%s',_0xf6aa0e,_0x6a54e4);_0xf606ba(_0x6a54e4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index bf2d055..5f8bdad 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 _0x328c=['register','length','userNotification:','./userNotification.events','save','emit','removeListener'];(function(_0x8a5808,_0x128ab3){var _0x223384=function(_0xd29d){while(--_0xd29d){_0x8a5808['push'](_0x8a5808['shift']());}};_0x223384(++_0x128ab3);}(_0x328c,0x10d));var _0xc328=function(_0x2a5183,_0x3c55ae){_0x2a5183=_0x2a5183-0x0;var _0x951654=_0x328c[_0x2a5183];return _0x951654;};'use strict';var UserNotificationEvents=require(_0xc328('0x0'));var events=[_0xc328('0x1'),'remove','update'];function createListener(_0x82dbf2,_0x5ebb55){return function(_0x26390d){_0x5ebb55[_0xc328('0x2')](_0x82dbf2,_0x26390d);};}function removeListener(_0x3533af,_0x27106e){return function(){UserNotificationEvents[_0xc328('0x3')](_0x3533af,_0x27106e);};}exports[_0xc328('0x4')]=function(_0x1dcdc0){for(var _0xe228f6=0x0,_0x4dbc04=events[_0xc328('0x5')];_0xe228f6<_0x4dbc04;_0xe228f6++){var _0x2ef3d9=events[_0xe228f6];var _0x28d5f2=createListener(_0xc328('0x6')+_0x2ef3d9,_0x1dcdc0);UserNotificationEvents['on'](_0x2ef3d9,_0x28d5f2);}}; \ No newline at end of file +var _0x15e7=['update','emit','removeListener','register','userNotification:','./userNotification.events','remove'];(function(_0x2d4028,_0x4fda81){var _0x1dfe84=function(_0x3cf4d4){while(--_0x3cf4d4){_0x2d4028['push'](_0x2d4028['shift']());}};_0x1dfe84(++_0x4fda81);}(_0x15e7,0xb4));var _0x715e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x15e7[_0x3947c9];return _0x2e7871;};'use strict';var UserNotificationEvents=require(_0x715e('0x0'));var events=['save',_0x715e('0x1'),_0x715e('0x2')];function createListener(_0x4eb35c,_0x3a7194){return function(_0x5b13f3){_0x3a7194[_0x715e('0x3')](_0x4eb35c,_0x5b13f3);};}function removeListener(_0x2b7bea,_0x4b3123){return function(){UserNotificationEvents[_0x715e('0x4')](_0x2b7bea,_0x4b3123);};}exports[_0x715e('0x5')]=function(_0x489652){for(var _0x316af1=0x0,_0x1ba74d=events['length'];_0x316af1<_0x1ba74d;_0x316af1++){var _0x2d768e=events[_0x316af1];var _0x31cbef=createListener(_0x715e('0x6')+_0x2d768e,_0x489652);UserNotificationEvents['on'](_0x2d768e,_0x31cbef);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 65bd450..1116ffa 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x18d191,_0x49d54d){var _0x11dd16=function(_0x2f96ae){while(--_0x2f96ae){_0x18d191['push'](_0x18d191['shift']());}};_0x11dd16(++_0x49d54d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4247aa,_0x1c6eb1){var _0x1ebe01=function(_0x41b1c7){while(--_0x41b1c7){_0x4247aa['push'](_0x4247aa['shift']());}};_0x1ebe01(++_0x1c6eb1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xcb91[_0x51bb38];return _0x51c09b;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a2ff126..c682b79 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 _0x7c24=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c24,0xf9));var _0x47c2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7c24[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x47c2('0x0'));module[_0x47c2('0x1')]={'penalty':{'type':Sequelize[_0x47c2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc2c=['exports'];(function(_0x33f7e1,_0x48d209){var _0x23bab4=function(_0xd532b0){while(--_0xd532b0){_0x33f7e1['push'](_0x33f7e1['shift']());}};_0x23bab4(++_0x48d209);}(_0xfc2c,0xa9));var _0xcfc2=function(_0x50991e,_0x232a05){_0x50991e=_0x50991e-0x0;var _0x168e29=_0xfc2c[_0x50991e];return _0x168e29;};'use strict';var Sequelize=require('sequelize');module[_0xcfc2('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d83084b..cecd18f 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 _0x5904=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','lodash','util','../../config/logger','api','bluebird'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x5904,0x181));var _0x4590=function(_0x2c6bdf,_0x126e23){_0x2c6bdf=_0x2c6bdf-0x0;var _0x3f45bb=_0x5904[_0x2c6bdf];return _0x3f45bb;};'use strict';var _=require(_0x4590('0x0'));var util=require(_0x4590('0x1'));var logger=require(_0x4590('0x2'))(_0x4590('0x3'));var moment=require('moment');var BPromise=require(_0x4590('0x4'));var rp=require(_0x4590('0x5'));var fs=require('fs');var path=require(_0x4590('0x6'));var rimraf=require(_0x4590('0x7'));var config=require(_0x4590('0x8'));var attributes=require(_0x4590('0x9'));module['exports']=function(_0x3b48c8,_0xf77e){return _0x3b48c8['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd69=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ed408,_0x22bc68){var _0xf0017d=function(_0x834c09){while(--_0x834c09){_0x3ed408['push'](_0x3ed408['shift']());}};_0xf0017d(++_0x22bc68);}(_0xbd69,0xd8));var _0x9bd6=function(_0xbb6b8,_0x35c4f1){_0xbb6b8=_0xbb6b8-0x0;var _0x57d224=_0xbd69[_0xbb6b8];return _0x57d224;};'use strict';var _=require(_0x9bd6('0x0'));var util=require(_0x9bd6('0x1'));var logger=require(_0x9bd6('0x2'))(_0x9bd6('0x3'));var moment=require(_0x9bd6('0x4'));var BPromise=require(_0x9bd6('0x5'));var rp=require(_0x9bd6('0x6'));var fs=require('fs');var path=require(_0x9bd6('0x7'));var rimraf=require(_0x9bd6('0x8'));var config=require(_0x9bd6('0x9'));var attributes=require(_0x9bd6('0xa'));module[_0x9bd6('0xb')]=function(_0x3c26e7,_0x2fbffd){return _0x3c26e7['define'](_0x9bd6('0xc'),attributes,{'tableName':_0x9bd6('0xd'),'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 c2c76fd..b6dd768 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 _0x8009=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2f328f,_0x370f25){var _0x750d7=function(_0x22cb40){while(--_0x22cb40){_0x2f328f['push'](_0x2f328f['shift']());}};_0x750d7(++_0x370f25);}(_0x8009,0x1ea));var _0x9800=function(_0x3fae66,_0x19790d){_0x3fae66=_0x3fae66-0x0;var _0x421a12=_0x8009[_0x3fae66];return _0x421a12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9800('0x0'));var BPromise=require(_0x9800('0x1'));var rs=require(_0x9800('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9800('0x3'))('rpc');var config=require(_0x9800('0x4'));var jayson=require(_0x9800('0x5'));var client=jayson[_0x9800('0x6')][_0x9800('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x199b3c,_0x13c864,_0xa5c8df){return new BPromise(function(_0x52d92a,_0x50a981){return client[_0x9800('0x8')](_0x199b3c,_0xa5c8df)[_0x9800('0x9')](function(_0x3d0217){logger['info'](_0x9800('0xa'),_0x13c864,_0x9800('0xb'));logger['debug'](_0x9800('0xc'),_0x13c864,_0x9800('0xb'),JSON[_0x9800('0xd')](_0x3d0217));if(_0x3d0217[_0x9800('0xe')]){if(_0x3d0217['error'][_0x9800('0xf')]===0x1f4){logger[_0x9800('0xe')](_0x9800('0xa'),_0x13c864,_0x3d0217[_0x9800('0xe')]['message']);return _0x50a981(_0x3d0217[_0x9800('0xe')]['message']);}logger[_0x9800('0xe')](_0x9800('0xa'),_0x13c864,_0x3d0217[_0x9800('0xe')][_0x9800('0x10')]);return _0x52d92a(_0x3d0217['error'][_0x9800('0x10')]);}else{logger[_0x9800('0x11')](_0x9800('0xa'),_0x13c864,_0x9800('0xb'));_0x52d92a(_0x3d0217[_0x9800('0x12')][_0x9800('0x10')]);}})[_0x9800('0x13')](function(_0x520e5){logger[_0x9800('0xe')](_0x9800('0xa'),_0x13c864,_0x520e5);_0x50a981(_0x520e5);});});} \ No newline at end of file +var _0x34bb=['result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0x34bb,0x144));var _0xb34b=function(_0x2c0439,_0x5dc7e2){_0x2c0439=_0x2c0439-0x0;var _0x51095f=_0x34bb[_0x2c0439];return _0x51095f;};'use strict';var _=require('lodash');var util=require(_0xb34b('0x0'));var moment=require(_0xb34b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb34b('0x2'));var db=require(_0xb34b('0x3'))['db'];var utils=require(_0xb34b('0x4'));var logger=require('../../config/logger')(_0xb34b('0x5'));var config=require(_0xb34b('0x6'));var jayson=require(_0xb34b('0x7'));var client=jayson[_0xb34b('0x8')][_0xb34b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216f9d,_0x555de8,_0x141fa4){return new BPromise(function(_0x2af32d,_0x30016f){return client[_0xb34b('0xa')](_0x216f9d,_0x141fa4)[_0xb34b('0xb')](function(_0x3df02b){logger['info'](_0xb34b('0xc'),_0x555de8,_0xb34b('0xd'));logger[_0xb34b('0xe')](_0xb34b('0xf'),_0x555de8,_0xb34b('0xd'),JSON[_0xb34b('0x10')](_0x3df02b));if(_0x3df02b[_0xb34b('0x11')]){if(_0x3df02b[_0xb34b('0x11')][_0xb34b('0x12')]===0x1f4){logger[_0xb34b('0x11')](_0xb34b('0xc'),_0x555de8,_0x3df02b[_0xb34b('0x11')][_0xb34b('0x13')]);return _0x30016f(_0x3df02b[_0xb34b('0x11')]['message']);}logger[_0xb34b('0x11')](_0xb34b('0xc'),_0x555de8,_0x3df02b[_0xb34b('0x11')][_0xb34b('0x13')]);return _0x2af32d(_0x3df02b[_0xb34b('0x11')][_0xb34b('0x13')]);}else{logger[_0xb34b('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x555de8,_0xb34b('0xd'));_0x2af32d(_0x3df02b[_0xb34b('0x15')][_0xb34b('0x13')]);}})[_0xb34b('0x16')](function(_0x10a7b3){logger[_0xb34b('0x11')](_0xb34b('0xc'),_0x555de8,_0x10a7b3);_0x30016f(_0x10a7b3);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8ed0964..8def917 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 _0x15be=['post','create','/:id/clone','addSections','put','update','delete','removeResources','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sections','/:id/resources','getResources'];(function(_0x249483,_0xea6f82){var _0x1af6a1=function(_0x5ca861){while(--_0x5ca861){_0x249483['push'](_0x249483['shift']());}};_0x1af6a1(++_0xea6f82);}(_0x15be,0xc1));var _0xe15b=function(_0x3f279f,_0xc8c19c){_0x3f279f=_0x3f279f-0x0;var _0x260177=_0x15be[_0x3f279f];return _0x260177;};'use strict';var multer=require(_0xe15b('0x0'));var util=require(_0xe15b('0x1'));var path=require(_0xe15b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe15b('0x3'));var router=express[_0xe15b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe15b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe15b('0x6'));var controller=require('./userProfile.controller');router[_0xe15b('0x7')]('/',auth[_0xe15b('0x8')](),controller[_0xe15b('0x9')]);router['get']('/describe',auth[_0xe15b('0x8')](),controller['describe']);router[_0xe15b('0x7')](_0xe15b('0xa'),auth[_0xe15b('0x8')](),controller['show']);router[_0xe15b('0x7')](_0xe15b('0xb'),auth[_0xe15b('0x8')](),controller['getSections']);router[_0xe15b('0x7')](_0xe15b('0xc'),auth[_0xe15b('0x8')](),controller[_0xe15b('0xd')]);router[_0xe15b('0xe')]('/',auth[_0xe15b('0x8')](),controller[_0xe15b('0xf')]);router[_0xe15b('0xe')](_0xe15b('0x10'),auth[_0xe15b('0x8')](),controller['clone']);router['post'](_0xe15b('0xb'),auth['isAuthenticated'](),controller[_0xe15b('0x11')]);router[_0xe15b('0xe')](_0xe15b('0xc'),auth[_0xe15b('0x8')](),controller['addResources']);router[_0xe15b('0x12')](_0xe15b('0xa'),auth[_0xe15b('0x8')](),controller[_0xe15b('0x13')]);router[_0xe15b('0x14')](_0xe15b('0xa'),auth[_0xe15b('0x8')](),controller['destroy']);router[_0xe15b('0x14')](_0xe15b('0xb'),auth[_0xe15b('0x8')](),controller['removeSections']);router['delete'](_0xe15b('0xc'),auth[_0xe15b('0x8')](),controller[_0xe15b('0x15')]);module[_0xe15b('0x16')]=router; \ No newline at end of file +var _0x9b1a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path'];(function(_0x57cfde,_0x38bfee){var _0x234a16=function(_0x12f7a0){while(--_0x12f7a0){_0x57cfde['push'](_0x57cfde['shift']());}};_0x234a16(++_0x38bfee);}(_0x9b1a,0x66));var _0xa9b1=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x9b1a[_0x26b5ff];return _0x58603e;};'use strict';var multer=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var path=require(_0xa9b1('0x2'));var timeout=require(_0xa9b1('0x3'));var express=require(_0xa9b1('0x4'));var router=express[_0xa9b1('0x5')]();var fs_extra=require(_0xa9b1('0x6'));var auth=require(_0xa9b1('0x7'));var interaction=require(_0xa9b1('0x8'));var config=require(_0xa9b1('0x9'));var controller=require(_0xa9b1('0xa'));router[_0xa9b1('0xb')]('/',auth[_0xa9b1('0xc')](),controller[_0xa9b1('0xd')]);router[_0xa9b1('0xb')](_0xa9b1('0xe'),auth['isAuthenticated'](),controller[_0xa9b1('0xf')]);router[_0xa9b1('0xb')](_0xa9b1('0x10'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x11')]);router[_0xa9b1('0xb')](_0xa9b1('0x12'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x13')]);router['get'](_0xa9b1('0x14'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x15')]);router[_0xa9b1('0x16')]('/',auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x17')]);router[_0xa9b1('0x16')](_0xa9b1('0x18'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x19')]);router[_0xa9b1('0x16')]('/:id/sections',auth['isAuthenticated'](),controller[_0xa9b1('0x1a')]);router['post'](_0xa9b1('0x14'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x1b')]);router[_0xa9b1('0x1c')]('/:id',auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x1d')]);router[_0xa9b1('0x1e')](_0xa9b1('0x10'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x1f')]);router[_0xa9b1('0x1e')](_0xa9b1('0x12'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x20')]);router['delete']('/:id/resources',auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x21')]);module[_0xa9b1('0x22')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a0b65e8..3a6e60c 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 _0x52a2=['join','getDataValue','crudPermissions','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0x52a2,0x10e));var _0x252a=function(_0x5deb0a,_0xc192bb){_0x5deb0a=_0x5deb0a-0x0;var _0x33d0ce=_0x52a2[_0x5deb0a];return _0x33d0ce;};'use strict';var Sequelize=require(_0x252a('0x0'));module['exports']={'name':{'type':Sequelize[_0x252a('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x252a('0x1')],'set':function(_0x324bff){this[_0x252a('0x2')]('crudPermissions',_0x324bff?_0x324bff[_0x252a('0x3')](''):[]);},'get':function(){return this[_0x252a('0x4')]('crudPermissions')?this[_0x252a('0x4')](_0x252a('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x252a('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x252a('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x252a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x252a('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x252a('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x252a('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa9d8=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0xda5ea5,_0x709ed2){var _0x2455d2=function(_0x2d40bc){while(--_0x2d40bc){_0xda5ea5['push'](_0xda5ea5['shift']());}};_0x2455d2(++_0x709ed2);}(_0xa9d8,0x15c));var _0x8a9d=function(_0x2ae071,_0x346bee){_0x2ae071=_0x2ae071-0x0;var _0x1db8f8=_0xa9d8[_0x2ae071];return _0x1db8f8;};'use strict';var Sequelize=require(_0x8a9d('0x0'));module[_0x8a9d('0x1')]={'name':{'type':Sequelize[_0x8a9d('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8a9d('0x2')],'set':function(_0x1b0bc6){this[_0x8a9d('0x3')](_0x8a9d('0x4'),_0x1b0bc6?_0x1b0bc6[_0x8a9d('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x8a9d('0x4'))?this[_0x8a9d('0x6')](_0x8a9d('0x4'))[_0x8a9d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8a9d('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8a9d('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8a9d('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8a9d('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8a9d('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8a9d('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 cdf8eb8..0c0ad7f 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 _0x5223=['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/license/util','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','update','then','error','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','include','get','omit','createdAt','updatedAt','crudPermissions','sequelize','each','autoAssociation','UserProfileResource','sectionId','Resources','UserProfileSection','destroy','transaction','userProfileId','push','removeSections','ids','getSections','includes','isEmpty','subsections','concat','enabled','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0x2bd0fa,_0x5afa9b){var _0x36a9a3=function(_0x406d2a){while(--_0x406d2a){_0x2bd0fa['push'](_0x2bd0fa['shift']());}};_0x36a9a3(++_0x5afa9b);}(_0x5223,0x67));var _0x3522=function(_0x217fbd,_0x113c34){_0x217fbd=_0x217fbd-0x0;var _0x586c94=_0x5223[_0x217fbd];return _0x586c94;};'use strict';var emlformat=require(_0x3522('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3522('0x1'));var jsonpatch=require(_0x3522('0x2'));var rp=require(_0x3522('0x3'));var moment=require(_0x3522('0x4'));var BPromise=require(_0x3522('0x5'));var Mustache=require(_0x3522('0x6'));var util=require('util');var path=require(_0x3522('0x7'));var sox=require(_0x3522('0x8'));var csv=require('to-csv');var ejs=require(_0x3522('0x9'));var fs=require('fs');var fs_extra=require(_0x3522('0xa'));var _=require(_0x3522('0xb'));var squel=require(_0x3522('0xc'));var crypto=require(_0x3522('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3522('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3522('0xf'));var Papa=require(_0x3522('0x10'));var Redis=require(_0x3522('0x11'));var authService=require(_0x3522('0x12'));var qs=require(_0x3522('0x13'));var as=require(_0x3522('0x14'));var hardwareService=require(_0x3522('0x15'));var logger=require(_0x3522('0x16'))(_0x3522('0x17'));var utils=require(_0x3522('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3522('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3522('0x1a')](config[_0x3522('0x1b')],{'host':_0x3522('0x1c'),'port':0x18eb});var socket=require(_0x3522('0x1d'))(new Redis(config['redis']));require(_0x3522('0x1e'))[_0x3522('0x1f')](socket);function respondWithStatusCode(_0x19b17b,_0xa68323){_0xa68323=_0xa68323||0xcc;return function(_0x515473){if(_0x515473){return _0x19b17b[_0x3522('0x20')](_0xa68323);}return _0x19b17b['status'](_0xa68323)[_0x3522('0x21')]();};}function respondWithResult(_0x554f70,_0x1db206){_0x1db206=_0x1db206||0xc8;return function(_0x538c72){if(_0x538c72){return _0x554f70['status'](_0x1db206)[_0x3522('0x22')](_0x538c72);}};}function respondWithFilteredResult(_0x299439,_0x1e196e){return function(_0x1f55ae){if(_0x1f55ae){var _0x4d8bfe=typeof _0x1e196e['offset']===_0x3522('0x23')&&typeof _0x1e196e['limit']==='undefined';var _0xcdeb20=_0x1f55ae[_0x3522('0x24')];var _0x47e29a=_0x4d8bfe?0x0:_0x1e196e[_0x3522('0x25')];var _0x35e09e=_0x4d8bfe?_0x1f55ae[_0x3522('0x24')]:_0x1e196e[_0x3522('0x25')]+_0x1e196e[_0x3522('0x26')];var _0x20a206;if(_0x35e09e>=_0xcdeb20){_0x35e09e=_0xcdeb20;_0x20a206=0xc8;}else{_0x20a206=0xce;}_0x299439[_0x3522('0x27')](_0x20a206);return _0x299439[_0x3522('0x28')](_0x3522('0x29'),_0x47e29a+'-'+_0x35e09e+'/'+_0xcdeb20)[_0x3522('0x22')](_0x1f55ae);}return null;};}function patchUpdates(_0x2c3d28){return function(_0x2fc0dc){try{jsonpatch['apply'](_0x2fc0dc,_0x2c3d28,!![]);}catch(_0x5c6065){return BPromise['reject'](_0x5c6065);}return _0x2fc0dc['save']();};}function saveUpdates(_0x30a23d,_0x3eb3fb){return function(_0xf6f75a){if(_0xf6f75a){return _0xf6f75a[_0x3522('0x2a')](_0x30a23d)[_0x3522('0x2b')](function(_0x10ea83){return _0x10ea83;});}return null;};}function removeEntity(_0x50820a,_0x21691c){return function(_0x3a54da){if(_0x3a54da){return _0x3a54da['destroy']()[_0x3522('0x2b')](function(){_0x50820a[_0x3522('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4097e8,_0x44efba){return function(_0x53a3a9){if(!_0x53a3a9){_0x4097e8[_0x3522('0x20')](0x194);}return _0x53a3a9;};}function handleError(_0x36fd71,_0x128415){_0x128415=_0x128415||0x1f4;return function(_0x7eb59c){logger[_0x3522('0x2c')](_0x7eb59c['stack']);if(_0x7eb59c[_0x3522('0x2d')]){delete _0x7eb59c[_0x3522('0x2d')];}_0x36fd71[_0x3522('0x27')](_0x128415)[_0x3522('0x2e')](_0x7eb59c);};}exports['index']=function(_0x4a4bcf,_0x26c1c9){var _0xdacebd={},_0xae8ea2={},_0x5717a6={'count':0x0,'rows':[]};var _0xddc4ab=_['map'](db[_0x3522('0x2f')][_0x3522('0x30')],function(_0x239095){return{'name':_0x239095[_0x3522('0x31')],'type':_0x239095[_0x3522('0x32')][_0x3522('0x33')]};});_0xae8ea2[_0x3522('0x34')]=_[_0x3522('0x35')](_0xddc4ab,'name');_0xae8ea2[_0x3522('0x36')]=_['keys'](_0x4a4bcf['query']);_0xae8ea2[_0x3522('0x37')]=_[_0x3522('0x38')](_0xae8ea2[_0x3522('0x34')],_0xae8ea2[_0x3522('0x36')]);_0xdacebd[_0x3522('0x39')]=_[_0x3522('0x38')](_0xae8ea2[_0x3522('0x34')],qs[_0x3522('0x3a')](_0x4a4bcf[_0x3522('0x36')][_0x3522('0x3a')]));_0xdacebd[_0x3522('0x39')]=_0xdacebd[_0x3522('0x39')]['length']?_0xdacebd[_0x3522('0x39')]:_0xae8ea2[_0x3522('0x34')];if(!_0x4a4bcf[_0x3522('0x36')][_0x3522('0x3b')](_0x3522('0x3c'))){_0xdacebd[_0x3522('0x26')]=qs[_0x3522('0x26')](_0x4a4bcf[_0x3522('0x36')][_0x3522('0x26')]);_0xdacebd['offset']=qs['offset'](_0x4a4bcf[_0x3522('0x36')]['offset']);}_0xdacebd[_0x3522('0x3d')]=qs[_0x3522('0x3e')](_0x4a4bcf['query']['sort']);_0xdacebd['where']=qs[_0x3522('0x37')](_[_0x3522('0x3f')](_0x4a4bcf[_0x3522('0x36')],_0xae8ea2[_0x3522('0x37')]),_0xddc4ab);if(_0x4a4bcf[_0x3522('0x36')]['filter']){_0xdacebd[_0x3522('0x40')]=_[_0x3522('0x41')](_0xdacebd[_0x3522('0x40')],{'$or':_[_0x3522('0x35')](_0xddc4ab,function(_0x2758aa){if(_0x2758aa['type']!==_0x3522('0x42')){var _0x1ebe6e={};_0x1ebe6e[_0x2758aa[_0x3522('0x2d')]]={'$like':'%'+_0x4a4bcf[_0x3522('0x36')][_0x3522('0x43')]+'%'};return _0x1ebe6e;}})});}_0xdacebd=_[_0x3522('0x41')]({},_0xdacebd,_0x4a4bcf[_0x3522('0x44')]);var _0x2fa2a4={'where':_0xdacebd[_0x3522('0x40')]};return db[_0x3522('0x2f')]['count'](_0x2fa2a4)['then'](function(_0x298fb9){_0x5717a6[_0x3522('0x24')]=_0x298fb9;if(_0x4a4bcf['query'][_0x3522('0x45')]){_0xdacebd['include']=[{'all':!![]}];}return db['UserProfile'][_0x3522('0x46')](_0xdacebd);})[_0x3522('0x2b')](function(_0x564d05){_0x5717a6[_0x3522('0x47')]=_0x564d05;return _0x5717a6;})[_0x3522('0x2b')](respondWithFilteredResult(_0x26c1c9,_0xdacebd))[_0x3522('0x48')](handleError(_0x26c1c9,null));};exports[_0x3522('0x49')]=function(_0x286582,_0x5dd73f){var _0x61e2d4={'raw':![],'where':{'id':_0x286582[_0x3522('0x4a')]['id']}},_0x4e2f3d={};_0x4e2f3d['model']=_[_0x3522('0x4b')](db[_0x3522('0x2f')][_0x3522('0x30')]);_0x4e2f3d['query']=_['keys'](_0x286582[_0x3522('0x36')]);_0x4e2f3d[_0x3522('0x37')]=_[_0x3522('0x38')](_0x4e2f3d['model'],_0x4e2f3d[_0x3522('0x36')]);_0x61e2d4['attributes']=_[_0x3522('0x38')](_0x4e2f3d[_0x3522('0x34')],qs[_0x3522('0x3a')](_0x286582['query'][_0x3522('0x3a')]));_0x61e2d4[_0x3522('0x39')]=_0x61e2d4[_0x3522('0x39')][_0x3522('0x4c')]?_0x61e2d4[_0x3522('0x39')]:_0x4e2f3d['model'];if(_0x286582['query'][_0x3522('0x45')]){_0x61e2d4['include']=[{'all':!![]}];}_0x61e2d4=_['merge']({},_0x61e2d4,_0x286582[_0x3522('0x44')]);return db['UserProfile'][_0x3522('0x4d')](_0x61e2d4)[_0x3522('0x2b')](handleEntityNotFound(_0x5dd73f,null))[_0x3522('0x2b')](respondWithResult(_0x5dd73f,null))[_0x3522('0x48')](handleError(_0x5dd73f,null));};exports[_0x3522('0x4e')]=function(_0x3b0cf3,_0x1ca266){return db[_0x3522('0x2f')][_0x3522('0x4e')](_0x3b0cf3[_0x3522('0x4f')],{})[_0x3522('0x2b')](respondWithResult(_0x1ca266,0xc9))[_0x3522('0x48')](handleError(_0x1ca266,null));};exports['clone']=function(_0x3b6b17,_0x43a225){var _0x5d8d84={'where':{'id':_0x3b6b17[_0x3522('0x4a')]['id']}},_0x2f68df={};_0x2f68df[_0x3522('0x34')]=_['keys'](db['UserProfile']['rawAttributes']);_0x5d8d84['attributes']=_[_0x3522('0x38')](_0x2f68df[_0x3522('0x34')],qs[_0x3522('0x3a')](_0x3b6b17[_0x3522('0x36')][_0x3522('0x3a')]));_0x5d8d84[_0x3522('0x39')]=_0x5d8d84[_0x3522('0x39')][_0x3522('0x4c')]?_0x5d8d84[_0x3522('0x39')]:_0x2f68df['model'];if(_0x3b6b17[_0x3522('0x36')][_0x3522('0x45')]){_0x5d8d84[_0x3522('0x50')]=[{'all':!![]}];}_0x5d8d84=_['merge']({},_0x5d8d84,_0x3b6b17[_0x3522('0x44')]);return db[_0x3522('0x2f')][_0x3522('0x4d')](_0x5d8d84)['then'](handleEntityNotFound(_0x43a225,null))[_0x3522('0x2b')](function(_0x2fc49c){if(_0x2fc49c){var _0x3edca4=_0x2fc49c[_0x3522('0x51')]({'plain':!![]});_0x3edca4=qs[_0x3522('0x52')](_0x3edca4,['id',_0x3522('0x53'),_0x3522('0x54'),_0x3522('0x55')]);_0x3b6b17[_0x3522('0x4f')]=_[_0x3522('0x52')](_0x3b6b17[_0x3522('0x4f')],['id','createdAt','updatedAt']);return db[_0x3522('0x56')]['transaction'](function(_0x46ab41){return db['UserProfile'][_0x3522('0x4e')](_[_0x3522('0x41')](_0x3edca4,_0x3b6b17['body']),{'include':_0x3b6b17['query'][_0x3522('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x46ab41})[_0x3522('0x2b')](function(_0x356c47){var _0x317615=_0x356c47[_0x3522('0x51')]({'plain':!![]});return db['UserProfileSection'][_0x3522('0x46')]({'where':{'userProfileId':_0x3b6b17[_0x3522('0x4a')]['id']},'raw':!![]})['then'](function(_0x575fc2){if(_0x575fc2){return BPromise[_0x3522('0x57')](_0x575fc2,function(_0xdc0921){return new BPromise(function(_0x7994a8,_0x2586b5){if(_0xdc0921[_0x3522('0x58')]===null||_0xdc0921['autoAssociation']===0x1)_0x7994a8(null);return db[_0x3522('0x59')][_0x3522('0x46')]({'where':{'sectionId':_0xdc0921['id']},'raw':!![]})[_0x3522('0x2b')](function(_0x2b15e3){var _0x3ef98c=_[_0x3522('0x35')](_0x2b15e3,function(_0x4c3e4a){return qs[_0x3522('0x52')](_0x4c3e4a,['id',_0x3522('0x53'),'updatedAt',_0x3522('0x5a')]);});_0x7994a8(_0x3ef98c);})['catch'](function(_0x300fee){_0x2586b5(_0x300fee);});})['then'](function(_0x201762){var _0x1695a7=qs[_0x3522('0x52')](_0xdc0921,['id',_0x3522('0x53'),'updatedAt']);_0x1695a7['userProfileId']=_0x317615['id'];if(_0x201762)_0x1695a7[_0x3522('0x5b')]=_0x201762;return _0x1695a7;})[_0x3522('0x2b')](function(_0x26a28d){return db[_0x3522('0x5c')][_0x3522('0x4e')](_0x26a28d,{'include':[{'model':db[_0x3522('0x59')],'as':_0x3522('0x5b')}],'raw':!![],'transaction':_0x46ab41});});})[_0x3522('0x2b')](function(){return _0x317615;});}});});});}})[_0x3522('0x2b')](respondWithResult(_0x43a225,0xc9))[_0x3522('0x48')](handleError(_0x43a225,null));};exports[_0x3522('0x2a')]=function(_0x1598d6,_0x1693bd){if(_0x1598d6['body']['id']){delete _0x1598d6[_0x3522('0x4f')]['id'];}return db['UserProfile'][_0x3522('0x4d')]({'where':{'id':_0x1598d6[_0x3522('0x4a')]['id']}})[_0x3522('0x2b')](handleEntityNotFound(_0x1693bd,null))[_0x3522('0x2b')](saveUpdates(_0x1598d6[_0x3522('0x4f')],null))[_0x3522('0x2b')](respondWithResult(_0x1693bd,null))[_0x3522('0x48')](handleError(_0x1693bd,null));};exports[_0x3522('0x5d')]=function(_0x5c741c,_0x3a2707){return db['UserProfile'][_0x3522('0x4d')]({'where':{'id':_0x5c741c['params']['id']}})[_0x3522('0x2b')](handleEntityNotFound(_0x3a2707,null))[_0x3522('0x2b')](removeEntity(_0x3a2707,null))['catch'](handleError(_0x3a2707,null));};exports['describe']=function(_0x447bf4,_0xe86c1b){return db['UserProfile']['describe']()[_0x3522('0x2b')](respondWithResult(_0xe86c1b,null))[_0x3522('0x48')](handleError(_0xe86c1b,null));};exports['addSections']=function(_0x311baa,_0x138f7d){var _0x44a625=_0x311baa[_0x3522('0x4f')];return db[_0x3522('0x2f')][_0x3522('0x4d')]({'where':{'id':_0x311baa[_0x3522('0x4a')]['id']}})['then'](handleEntityNotFound(_0x138f7d,null))[_0x3522('0x2b')](function(_0x348ba0){if(_0x348ba0){return db[_0x3522('0x56')][_0x3522('0x5e')](function(_0x382b2d){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x311baa[_0x3522('0x4a')]['id'],'sectionId':_[_0x3522('0x35')](_0x44a625,function(_0x4088d7){return _0x4088d7[_0x3522('0x5a')];})},'transaction':_0x382b2d})[_0x3522('0x2b')](function(){var _0x143c6a=_[_0x3522('0x35')](_0x44a625,function(_0x33a0f9){_0x33a0f9[_0x3522('0x5f')]=_0x311baa[_0x3522('0x4a')]['id'];return _0x33a0f9;});var _0x280c67=[];return BPromise[_0x3522('0x57')](_0x143c6a,function(_0x476ba3){return db['UserProfileSection']['create'](_0x476ba3,{'include':[{'model':db[_0x3522('0x59')],'as':_0x3522('0x5b')}],'raw':!![],'transaction':_0x382b2d})[_0x3522('0x2b')](function(_0x3960c0){_0x280c67[_0x3522('0x60')](_0x3960c0[_0x3522('0x51')]({'plain':!![]}));});})[_0x3522('0x2b')](function(){return _0x280c67;});});});}})['then'](function(_0x28dd81){return _0x28dd81;})['then'](respondWithResult(_0x138f7d,null))[_0x3522('0x48')](handleError(_0x138f7d,null));};exports[_0x3522('0x61')]=function(_0x55dcd8,_0xe41373){var _0x55e11b;return db[_0x3522('0x2f')][_0x3522('0x4d')]({'where':{'id':_0x55dcd8[_0x3522('0x4a')]['id']},'attributes':['id',_0x3522('0x2d')]})[_0x3522('0x2b')](handleEntityNotFound(_0xe41373,null))[_0x3522('0x2b')](function(_0xb317e6){if(_0xb317e6){_0x55e11b=_0xb317e6;return db[_0x3522('0x5c')][_0x3522('0x5d')]({'where':{'userProfileId':_0x55dcd8[_0x3522('0x4a')]['id'],'sectionId':_0x55dcd8[_0x3522('0x36')][_0x3522('0x62')]}});}})['then'](function(){return _0x55e11b;})[_0x3522('0x2b')](respondWithStatusCode(_0xe41373,null))['catch'](handleError(_0xe41373,null));};exports[_0x3522('0x63')]=function(_0x4a2fe1,_0x1fced0){var _0x4a27e3=[];var _0x54faa5=[];return db[_0x3522('0x5c')][_0x3522('0x46')]({'where':{'userProfileId':_0x4a2fe1['params']['id']},'raw':!![]})[_0x3522('0x2b')](function(_0x68bf82){_0x4a27e3=_[_0x3522('0x43')](_0x68bf82,function(_0x29e7ae){return _0x29e7ae['enabled']===0x1||_[_0x3522('0x64')]([0x3eb,0x709],_0x29e7ae[_0x3522('0x5a')]);});if(!_[_0x3522('0x65')](_0x4a27e3)){return _['map'](_0x4a27e3,function(_0x565eb5){return _0x565eb5[_0x3522('0x5a')];});}else{return;}})[_0x3522('0x2b')](function(_0x3a2a03){if(_0x3a2a03)_0x54faa5=_0x3a2a03;if(_[_0x3522('0x64')](_0x54faa5,0x64)){var _0x44bb42=_['find'](_0x4a27e3,{'sectionId':0x64});return hasDefaultDashboard(_0x44bb42)[_0x3522('0x2b')](function(_0x432167){return _['map'](_0x4a27e3,function(_0x2f4b78){if(_0x2f4b78[_0x3522('0x5a')]===0x64){_0x2f4b78['subsections']=_0x432167;}return _0x2f4b78;});});}else{return;}})['then'](function(_0x2e27ca){if(_0x2e27ca)_0x4a27e3=_0x2e27ca;if(_[_0x3522('0x64')](_0x54faa5,0x3eb)){var _0x552860=_['find'](_0x4a27e3,{'sectionId':0x3eb});return getCustomDashboards(_0x552860)[_0x3522('0x2b')](function(_0x546ac3){return _['map'](_0x4a27e3,function(_0x5a064a){if(_0x552860['enabled']){if(_0x5a064a[_0x3522('0x5a')]===0x3eb){_0x5a064a['subsections']=_0x546ac3;}}else{if(_0x5a064a[_0x3522('0x5a')]===0x64){if(!_0x5a064a['subsections']){_0x5a064a[_0x3522('0x66')]=[];}_0x5a064a['subsections']=_0x5a064a['subsections'][_0x3522('0x67')](_0x546ac3);}}return _0x5a064a;});});}else{return;}})[_0x3522('0x2b')](function(_0x321c68){if(_0x321c68)_0x4a27e3=_0x321c68;if(_['includes'](_0x54faa5,0x709)){var _0x535445=_[_0x3522('0x4d')](_0x4a27e3,{'sectionId':0x709});return getPlugins(_0x535445)[_0x3522('0x2b')](function(_0x2ee994){if(_0x535445[_0x3522('0x68')]){return _[_0x3522('0x35')](_0x4a27e3,function(_0x4c5dd0){if(_0x4c5dd0[_0x3522('0x5a')]===0x709){_0x4c5dd0[_0x3522('0x66')]=_0x2ee994;}return _0x4c5dd0;});}else{var _0xc505a1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ee994};var _0x2f5f58=_[_0x3522('0x35')](_0x4a27e3);_0x2f5f58[_0x3522('0x60')](_0xc505a1);return _0x2f5f58;}});}else{return;}})[_0x3522('0x2b')](function(_0x30db70){if(_0x30db70)_0x4a27e3=_0x30db70;return _[_0x3522('0x43')](_0x4a27e3,[_0x3522('0x68'),0x1]);})[_0x3522('0x2b')](respondWithResult(_0x1fced0,null))['catch'](handleError(_0x1fced0,null));};function hasDefaultDashboard(_0x374769){var _0x5b9dbd=[0x65];return new BPromise(function(_0x27c25c,_0x3c05d2){try{if(_0x374769['autoAssociation']){_0x27c25c(_0x5b9dbd);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x374769['id']},'raw':!![]})[_0x3522('0x2b')](function(_0x8c9602){_0x8c9602?_0x27c25c(_0x5b9dbd):_0x27c25c();});}}catch(_0x541b67){_0x3c05d2(_0x541b67);}});}function getCustomDashboards(_0x156d21){var _0xf4066=[];return new BPromise(function(_0x23081d,_0x1813ae){try{if(_0x156d21['autoAssociation']){return db['Dashboard'][_0x3522('0x46')]({'raw':!![]})[_0x3522('0x2b')](function(_0x151464){_0x151464[_0x3522('0x69')](function(_0x133f69){_0xf4066[_0x3522('0x60')](_0x133f69['id']+0x1869f);});_0x23081d(_0xf4066);});}else{return db[_0x3522('0x59')][_0x3522('0x46')]({'where':{'sectionId':_0x156d21['id']},'raw':!![]})[_0x3522('0x2b')](function(_0x38761c){_0x38761c[_0x3522('0x69')](function(_0x4e24b8){_0xf4066[_0x3522('0x60')](_0x4e24b8[_0x3522('0x6a')]+0x1869f);});_0x23081d(_0xf4066);});}}catch(_0x550c53){_0x1813ae(_0x550c53);}});}function getPlugins(_0x27e193){var _0x22ddfe=[];return new BPromise(function(_0x3e070e,_0x330415){try{if(_0x27e193[_0x3522('0x58')]){return db[_0x3522('0x6b')][_0x3522('0x46')]({'raw':!![]})[_0x3522('0x2b')](function(_0x16c762){_0x16c762[_0x3522('0x69')](function(_0x4d38a5){_0x22ddfe[_0x3522('0x60')](_0x4d38a5['id']+0x15b38);});_0x3e070e(_0x22ddfe);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x27e193['id']},'raw':!![]})[_0x3522('0x2b')](function(_0x3380d8){_0x3380d8[_0x3522('0x69')](function(_0x5b82cc){_0x22ddfe[_0x3522('0x60')](_0x5b82cc[_0x3522('0x6a')]+0x15b38);});_0x3e070e(_0x22ddfe);});}}catch(_0x27857c){_0x330415(_0x27857c);}});}exports[_0x3522('0x6c')]=function(_0x3bcf9f,_0xd1dca2){return db['UserProfile'][_0x3522('0x4d')]({'where':{'id':_0x3bcf9f[_0x3522('0x4a')]['id']}})[_0x3522('0x2b')](handleEntityNotFound(_0xd1dca2,null))['then'](function(_0x4d4bc6){if(_0x4d4bc6){return db['sequelize'][_0x3522('0x5e')](function(_0x110fb5){return db[_0x3522('0x5c')][_0x3522('0x46')]({'where':{'userProfileId':_0x3bcf9f[_0x3522('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x3522('0x2b')](function(_0x2adadc){if(_0x2adadc){return db[_0x3522('0x5c')][_0x3522('0x5d')]({'where':{'userProfileId':_0x3bcf9f[_0x3522('0x4a')]['id'],'id':_[_0x3522('0x35')](_0x2adadc,function(_0x384dd9){return _0x384dd9['id'];})},'transaction':_0x110fb5});}})[_0x3522('0x2b')](function(_0x45a2ea){var _0x411ad9=_[_0x3522('0x35')](_0x3bcf9f[_0x3522('0x4f')],function(_0x11003d){_0x11003d[_0x3522('0x5f')]=_0x3bcf9f[_0x3522('0x4a')]['id'];return _0x11003d;});return db[_0x3522('0x5c')]['bulkCreate'](_0x411ad9,{'raw':!![],'transaction':_0x110fb5});})[_0x3522('0x2b')](function(_0x54f0eb){var _0x28d366=_['filter'](_['map'](_0x54f0eb,function(_0x416d38){return _0x416d38['get']({'plain':!![]});}),{'includeAll':![]});if(_0x28d366){return db[_0x3522('0x5c')][_0x3522('0x46')]({'where':{'userProfileId':_0x3bcf9f['params']['id'],'sectionId':_['map'](_0x28d366,function(_0x1c6ce6){return _0x1c6ce6[_0x3522('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x3fb97e){var _0xd70679=_[_0x3522('0x35')](_0x3bcf9f['body'],function(_0x1ad6e6){_0x1ad6e6['userProfileId']=_0x3bcf9f[_0x3522('0x4a')]['id'];return _0x1ad6e6;});return db['UserProfileResource'][_0x3522('0x6d')](_0xd70679,{'raw':!![],'transaction':_0x110fb5});});}})[_0x3522('0x48')](handleError(_0xd1dca2,null));});}})[_0x3522('0x2b')](function(_0x360db2){var _0x13cfe2=_[_0x3522('0x35')](_0x360db2,function(_0x3387f3){return _0x3387f3[_0x3522('0x51')]({'plain':!![]});});})[_0x3522('0x2b')](respondWithResult(_0xd1dca2,null))[_0x3522('0x48')](handleError(_0xd1dca2,null));};exports[_0x3522('0x6e')]=function(_0x44f89b,_0x4d1294,_0x18306b){return db[_0x3522('0x2f')][_0x3522('0x4d')]({'where':{'id':_0x44f89b[_0x3522('0x4a')]['id']}})[_0x3522('0x2b')](handleEntityNotFound(_0x4d1294,null))[_0x3522('0x2b')](function(_0x144fc8){if(_0x144fc8){return _0x144fc8[_0x3522('0x6e')](_0x44f89b['query'][_0x3522('0x62')]);}})['then'](respondWithStatusCode(_0x4d1294,null))['catch'](handleError(_0x4d1294,null));};exports[_0x3522('0x6f')]=function(_0x185fc2,_0x353f1e){var _0x52cdfe={};if(!_0x185fc2[_0x3522('0x36')][_0x3522('0x70')])throw new Error(_0x3522('0x71'));if(!_0x185fc2[_0x3522('0x36')][_0x3522('0x3b')]('nolimit')){_0x52cdfe[_0x3522('0x26')]=qs['limit'](_0x185fc2[_0x3522('0x36')][_0x3522('0x26')]);_0x52cdfe[_0x3522('0x25')]=qs[_0x3522('0x25')](_0x185fc2[_0x3522('0x36')][_0x3522('0x25')]);}return db[_0x3522('0x2f')][_0x3522('0x4d')]({'where':{'id':_0x185fc2['params']['id']}})['then'](function(_0x4a78c6){if(!_0x4a78c6)throw new Error(_0x3522('0x72')+_0x185fc2['params']['id']);return db[_0x3522('0x2f')][_0x3522('0x6f')](_0x185fc2);})[_0x3522('0x2b')](respondWithFilteredResult(_0x353f1e,_0x52cdfe))[_0x3522('0x48')](handleError(_0x353f1e,null));}; \ No newline at end of file +var _0xcb66=['enabled','includes','isEmpty','subsections','concat','Dashboard','Plugin','forEach','bulkCreate','removeResources','getResources','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','set','json','apply','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','clone','get','createdAt','updatedAt','crudPermissions','omit','body','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','userProfileId','each','push','removeSections','ids','getSections'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xcb66,0x1d0));var _0x6cb6=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xcb66[_0x3e6729];return _0x535bcd;};'use strict';var emlformat=require(_0x6cb6('0x0'));var rimraf=require(_0x6cb6('0x1'));var zipdir=require(_0x6cb6('0x2'));var jsonpatch=require(_0x6cb6('0x3'));var rp=require('request-promise');var moment=require(_0x6cb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6cb6('0x5'));var util=require(_0x6cb6('0x6'));var path=require('path');var sox=require(_0x6cb6('0x7'));var csv=require(_0x6cb6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cb6('0x9'));var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0x8'));var querystring=require(_0x6cb6('0xf'));var Papa=require(_0x6cb6('0x10'));var Redis=require(_0x6cb6('0x11'));var authService=require(_0x6cb6('0x12'));var qs=require(_0x6cb6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cb6('0x14'));var logger=require(_0x6cb6('0x15'))(_0x6cb6('0x16'));var utils=require(_0x6cb6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x18'));var db=require('../../mysqldb')['db'];config[_0x6cb6('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6cb6('0x1a'))(new Redis(config[_0x6cb6('0x19')]));require('./userProfile.socket')[_0x6cb6('0x1b')](socket);function respondWithStatusCode(_0x5ea96d,_0x286604){_0x286604=_0x286604||0xcc;return function(_0xc80f16){if(_0xc80f16){return _0x5ea96d[_0x6cb6('0x1c')](_0x286604);}return _0x5ea96d[_0x6cb6('0x1d')](_0x286604)[_0x6cb6('0x1e')]();};}function respondWithResult(_0x20e361,_0x1a5387){_0x1a5387=_0x1a5387||0xc8;return function(_0x5bd1ef){if(_0x5bd1ef){return _0x20e361[_0x6cb6('0x1d')](_0x1a5387)['json'](_0x5bd1ef);}};}function respondWithFilteredResult(_0x380fe2,_0x1fb8d2){return function(_0x3973b0){if(_0x3973b0){var _0x19d80d=typeof _0x1fb8d2['offset']===_0x6cb6('0x1f')&&typeof _0x1fb8d2[_0x6cb6('0x20')]===_0x6cb6('0x1f');var _0x207a7b=_0x3973b0[_0x6cb6('0x21')];var _0x4a03ef=_0x19d80d?0x0:_0x1fb8d2['offset'];var _0x4e1ea1=_0x19d80d?_0x3973b0[_0x6cb6('0x21')]:_0x1fb8d2['offset']+_0x1fb8d2['limit'];var _0x4a4c29;if(_0x4e1ea1>=_0x207a7b){_0x4e1ea1=_0x207a7b;_0x4a4c29=0xc8;}else{_0x4a4c29=0xce;}_0x380fe2[_0x6cb6('0x1d')](_0x4a4c29);return _0x380fe2[_0x6cb6('0x22')]('Content-Range',_0x4a03ef+'-'+_0x4e1ea1+'/'+_0x207a7b)[_0x6cb6('0x23')](_0x3973b0);}return null;};}function patchUpdates(_0x27c624){return function(_0x444454){try{jsonpatch[_0x6cb6('0x24')](_0x444454,_0x27c624,!![]);}catch(_0x464719){return BPromise['reject'](_0x464719);}return _0x444454[_0x6cb6('0x25')]();};}function saveUpdates(_0x371eaf,_0x263400){return function(_0x489e7f){if(_0x489e7f){return _0x489e7f['update'](_0x371eaf)[_0x6cb6('0x26')](function(_0x1eafa3){return _0x1eafa3;});}return null;};}function removeEntity(_0x38e8a3,_0xee810e){return function(_0xb99949){if(_0xb99949){return _0xb99949[_0x6cb6('0x27')]()[_0x6cb6('0x26')](function(){_0x38e8a3[_0x6cb6('0x1d')](0xcc)[_0x6cb6('0x1e')]();});}};}function handleEntityNotFound(_0x570e0e,_0x5aad2e){return function(_0x8e8a4){if(!_0x8e8a4){_0x570e0e[_0x6cb6('0x1c')](0x194);}return _0x8e8a4;};}function handleError(_0x1230a,_0x2d4fd8){_0x2d4fd8=_0x2d4fd8||0x1f4;return function(_0x2ac00f){logger[_0x6cb6('0x28')](_0x2ac00f[_0x6cb6('0x29')]);if(_0x2ac00f[_0x6cb6('0x2a')]){delete _0x2ac00f[_0x6cb6('0x2a')];}_0x1230a['status'](_0x2d4fd8)[_0x6cb6('0x2b')](_0x2ac00f);};}exports[_0x6cb6('0x2c')]=function(_0x1027f9,_0x2156e3){var _0x52e3be={},_0x16827d={},_0x1dcbda={'count':0x0,'rows':[]};var _0x3a7fed=_[_0x6cb6('0x2d')](db[_0x6cb6('0x2e')][_0x6cb6('0x2f')],function(_0x3c0294){return{'name':_0x3c0294[_0x6cb6('0x30')],'type':_0x3c0294['type'][_0x6cb6('0x31')]};});_0x16827d[_0x6cb6('0x32')]=_[_0x6cb6('0x2d')](_0x3a7fed,_0x6cb6('0x2a'));_0x16827d[_0x6cb6('0x33')]=_['keys'](_0x1027f9[_0x6cb6('0x33')]);_0x16827d[_0x6cb6('0x34')]=_[_0x6cb6('0x35')](_0x16827d[_0x6cb6('0x32')],_0x16827d[_0x6cb6('0x33')]);_0x52e3be[_0x6cb6('0x36')]=_[_0x6cb6('0x35')](_0x16827d['model'],qs[_0x6cb6('0x37')](_0x1027f9[_0x6cb6('0x33')]['fields']));_0x52e3be[_0x6cb6('0x36')]=_0x52e3be['attributes'][_0x6cb6('0x38')]?_0x52e3be[_0x6cb6('0x36')]:_0x16827d['model'];if(!_0x1027f9['query'][_0x6cb6('0x39')]('nolimit')){_0x52e3be[_0x6cb6('0x20')]=qs[_0x6cb6('0x20')](_0x1027f9['query'][_0x6cb6('0x20')]);_0x52e3be[_0x6cb6('0x3a')]=qs[_0x6cb6('0x3a')](_0x1027f9[_0x6cb6('0x33')][_0x6cb6('0x3a')]);}_0x52e3be[_0x6cb6('0x3b')]=qs[_0x6cb6('0x3c')](_0x1027f9[_0x6cb6('0x33')][_0x6cb6('0x3c')]);_0x52e3be['where']=qs[_0x6cb6('0x34')](_[_0x6cb6('0x3d')](_0x1027f9[_0x6cb6('0x33')],_0x16827d['filters']),_0x3a7fed);if(_0x1027f9[_0x6cb6('0x33')][_0x6cb6('0x3e')]){_0x52e3be['where']=_[_0x6cb6('0x3f')](_0x52e3be[_0x6cb6('0x40')],{'$or':_['map'](_0x3a7fed,function(_0x35fb13){if(_0x35fb13[_0x6cb6('0x41')]!==_0x6cb6('0x42')){var _0x25235f={};_0x25235f[_0x35fb13[_0x6cb6('0x2a')]]={'$like':'%'+_0x1027f9[_0x6cb6('0x33')]['filter']+'%'};return _0x25235f;}})});}_0x52e3be=_[_0x6cb6('0x3f')]({},_0x52e3be,_0x1027f9['options']);var _0x59185f={'where':_0x52e3be[_0x6cb6('0x40')]};return db[_0x6cb6('0x2e')][_0x6cb6('0x21')](_0x59185f)[_0x6cb6('0x26')](function(_0x3d35ab){_0x1dcbda[_0x6cb6('0x21')]=_0x3d35ab;if(_0x1027f9[_0x6cb6('0x33')][_0x6cb6('0x43')]){_0x52e3be[_0x6cb6('0x44')]=[{'all':!![]}];}return db[_0x6cb6('0x2e')][_0x6cb6('0x45')](_0x52e3be);})[_0x6cb6('0x26')](function(_0x3d5a04){_0x1dcbda[_0x6cb6('0x46')]=_0x3d5a04;return _0x1dcbda;})[_0x6cb6('0x26')](respondWithFilteredResult(_0x2156e3,_0x52e3be))[_0x6cb6('0x47')](handleError(_0x2156e3,null));};exports[_0x6cb6('0x48')]=function(_0xda1ad5,_0x7df8bc){var _0x1ad415={'raw':![],'where':{'id':_0xda1ad5[_0x6cb6('0x49')]['id']}},_0x64dcda={};_0x64dcda[_0x6cb6('0x32')]=_['keys'](db[_0x6cb6('0x2e')][_0x6cb6('0x2f')]);_0x64dcda[_0x6cb6('0x33')]=_[_0x6cb6('0x4a')](_0xda1ad5[_0x6cb6('0x33')]);_0x64dcda['filters']=_[_0x6cb6('0x35')](_0x64dcda['model'],_0x64dcda[_0x6cb6('0x33')]);_0x1ad415[_0x6cb6('0x36')]=_[_0x6cb6('0x35')](_0x64dcda[_0x6cb6('0x32')],qs[_0x6cb6('0x37')](_0xda1ad5['query'][_0x6cb6('0x37')]));_0x1ad415[_0x6cb6('0x36')]=_0x1ad415[_0x6cb6('0x36')]['length']?_0x1ad415[_0x6cb6('0x36')]:_0x64dcda[_0x6cb6('0x32')];if(_0xda1ad5[_0x6cb6('0x33')][_0x6cb6('0x43')]){_0x1ad415[_0x6cb6('0x44')]=[{'all':!![]}];}_0x1ad415=_[_0x6cb6('0x3f')]({},_0x1ad415,_0xda1ad5[_0x6cb6('0x4b')]);return db[_0x6cb6('0x2e')][_0x6cb6('0x4c')](_0x1ad415)[_0x6cb6('0x26')](handleEntityNotFound(_0x7df8bc,null))[_0x6cb6('0x26')](respondWithResult(_0x7df8bc,null))['catch'](handleError(_0x7df8bc,null));};exports[_0x6cb6('0x4d')]=function(_0x1be5d5,_0x563df4){return db[_0x6cb6('0x2e')][_0x6cb6('0x4d')](_0x1be5d5['body'],{})['then'](respondWithResult(_0x563df4,0xc9))[_0x6cb6('0x47')](handleError(_0x563df4,null));};exports[_0x6cb6('0x4e')]=function(_0x764f28,_0x12fdb4){var _0x1b4ff7={'where':{'id':_0x764f28[_0x6cb6('0x49')]['id']}},_0x4b64c2={};_0x4b64c2['model']=_[_0x6cb6('0x4a')](db['UserProfile'][_0x6cb6('0x2f')]);_0x1b4ff7[_0x6cb6('0x36')]=_[_0x6cb6('0x35')](_0x4b64c2[_0x6cb6('0x32')],qs[_0x6cb6('0x37')](_0x764f28[_0x6cb6('0x33')]['fields']));_0x1b4ff7[_0x6cb6('0x36')]=_0x1b4ff7[_0x6cb6('0x36')][_0x6cb6('0x38')]?_0x1b4ff7[_0x6cb6('0x36')]:_0x4b64c2[_0x6cb6('0x32')];if(_0x764f28[_0x6cb6('0x33')][_0x6cb6('0x43')]){_0x1b4ff7[_0x6cb6('0x44')]=[{'all':!![]}];}_0x1b4ff7=_['merge']({},_0x1b4ff7,_0x764f28[_0x6cb6('0x4b')]);return db['UserProfile']['find'](_0x1b4ff7)[_0x6cb6('0x26')](handleEntityNotFound(_0x12fdb4,null))['then'](function(_0x821fe4){if(_0x821fe4){var _0x1331ba=_0x821fe4[_0x6cb6('0x4f')]({'plain':!![]});_0x1331ba=qs['omit'](_0x1331ba,['id',_0x6cb6('0x50'),_0x6cb6('0x51'),_0x6cb6('0x52')]);_0x764f28['body']=_[_0x6cb6('0x53')](_0x764f28[_0x6cb6('0x54')],['id',_0x6cb6('0x50'),'updatedAt']);return db[_0x6cb6('0x55')][_0x6cb6('0x56')](function(_0x1790a0){return db[_0x6cb6('0x2e')][_0x6cb6('0x4d')](_[_0x6cb6('0x3f')](_0x1331ba,_0x764f28[_0x6cb6('0x54')]),{'include':_0x764f28[_0x6cb6('0x33')][_0x6cb6('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x1790a0})['then'](function(_0x5cb9e6){var _0x1d34c0=_0x5cb9e6[_0x6cb6('0x4f')]({'plain':!![]});return db[_0x6cb6('0x57')]['findAll']({'where':{'userProfileId':_0x764f28[_0x6cb6('0x49')]['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x3c4bd3){if(_0x3c4bd3){return BPromise['each'](_0x3c4bd3,function(_0x1767b3){return new BPromise(function(_0x1bc9fd,_0x12eaa1){if(_0x1767b3[_0x6cb6('0x58')]===null||_0x1767b3[_0x6cb6('0x58')]===0x1)_0x1bc9fd(null);return db[_0x6cb6('0x59')][_0x6cb6('0x45')]({'where':{'sectionId':_0x1767b3['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x4c9282){var _0xfd4719=_[_0x6cb6('0x2d')](_0x4c9282,function(_0x29fbcc){return qs[_0x6cb6('0x53')](_0x29fbcc,['id',_0x6cb6('0x50'),_0x6cb6('0x51'),_0x6cb6('0x5a')]);});_0x1bc9fd(_0xfd4719);})[_0x6cb6('0x47')](function(_0x216f69){_0x12eaa1(_0x216f69);});})[_0x6cb6('0x26')](function(_0x4b835c){var _0x4ae17f=qs[_0x6cb6('0x53')](_0x1767b3,['id','createdAt',_0x6cb6('0x51')]);_0x4ae17f['userProfileId']=_0x1d34c0['id'];if(_0x4b835c)_0x4ae17f[_0x6cb6('0x5b')]=_0x4b835c;return _0x4ae17f;})[_0x6cb6('0x26')](function(_0x4b1689){return db['UserProfileSection']['create'](_0x4b1689,{'include':[{'model':db[_0x6cb6('0x59')],'as':_0x6cb6('0x5b')}],'raw':!![],'transaction':_0x1790a0});});})[_0x6cb6('0x26')](function(){return _0x1d34c0;});}});});});}})[_0x6cb6('0x26')](respondWithResult(_0x12fdb4,0xc9))['catch'](handleError(_0x12fdb4,null));};exports[_0x6cb6('0x5c')]=function(_0x3a563f,_0x25934e){if(_0x3a563f[_0x6cb6('0x54')]['id']){delete _0x3a563f[_0x6cb6('0x54')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x3a563f[_0x6cb6('0x49')]['id']}})[_0x6cb6('0x26')](handleEntityNotFound(_0x25934e,null))[_0x6cb6('0x26')](saveUpdates(_0x3a563f[_0x6cb6('0x54')],null))[_0x6cb6('0x26')](respondWithResult(_0x25934e,null))[_0x6cb6('0x47')](handleError(_0x25934e,null));};exports[_0x6cb6('0x27')]=function(_0x4e6990,_0x669b43){return db[_0x6cb6('0x2e')][_0x6cb6('0x4c')]({'where':{'id':_0x4e6990[_0x6cb6('0x49')]['id']}})[_0x6cb6('0x26')](handleEntityNotFound(_0x669b43,null))[_0x6cb6('0x26')](removeEntity(_0x669b43,null))[_0x6cb6('0x47')](handleError(_0x669b43,null));};exports[_0x6cb6('0x5d')]=function(_0x128ccc,_0x35e991){return db[_0x6cb6('0x2e')]['describe']()[_0x6cb6('0x26')](respondWithResult(_0x35e991,null))[_0x6cb6('0x47')](handleError(_0x35e991,null));};exports[_0x6cb6('0x5e')]=function(_0x1d4bcf,_0x139851){var _0x34f84e=_0x1d4bcf['body'];return db[_0x6cb6('0x2e')][_0x6cb6('0x4c')]({'where':{'id':_0x1d4bcf[_0x6cb6('0x49')]['id']}})[_0x6cb6('0x26')](handleEntityNotFound(_0x139851,null))[_0x6cb6('0x26')](function(_0x28bc98){if(_0x28bc98){return db[_0x6cb6('0x55')]['transaction'](function(_0x547b70){return db[_0x6cb6('0x57')][_0x6cb6('0x27')]({'where':{'userProfileId':_0x1d4bcf[_0x6cb6('0x49')]['id'],'sectionId':_[_0x6cb6('0x2d')](_0x34f84e,function(_0x35321f){return _0x35321f[_0x6cb6('0x5a')];})},'transaction':_0x547b70})[_0x6cb6('0x26')](function(){var _0x6139a2=_['map'](_0x34f84e,function(_0x30e0c3){_0x30e0c3[_0x6cb6('0x5f')]=_0x1d4bcf['params']['id'];return _0x30e0c3;});var _0x5d8b35=[];return BPromise[_0x6cb6('0x60')](_0x6139a2,function(_0x301769){return db['UserProfileSection'][_0x6cb6('0x4d')](_0x301769,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x547b70})[_0x6cb6('0x26')](function(_0x223729){_0x5d8b35[_0x6cb6('0x61')](_0x223729[_0x6cb6('0x4f')]({'plain':!![]}));});})[_0x6cb6('0x26')](function(){return _0x5d8b35;});});});}})[_0x6cb6('0x26')](function(_0xf8a7b1){return _0xf8a7b1;})['then'](respondWithResult(_0x139851,null))[_0x6cb6('0x47')](handleError(_0x139851,null));};exports[_0x6cb6('0x62')]=function(_0x399a0d,_0x196f39){var _0xad6d5e;return db['UserProfile'][_0x6cb6('0x4c')]({'where':{'id':_0x399a0d[_0x6cb6('0x49')]['id']},'attributes':['id',_0x6cb6('0x2a')]})[_0x6cb6('0x26')](handleEntityNotFound(_0x196f39,null))['then'](function(_0x4689a0){if(_0x4689a0){_0xad6d5e=_0x4689a0;return db[_0x6cb6('0x57')][_0x6cb6('0x27')]({'where':{'userProfileId':_0x399a0d[_0x6cb6('0x49')]['id'],'sectionId':_0x399a0d[_0x6cb6('0x33')][_0x6cb6('0x63')]}});}})[_0x6cb6('0x26')](function(){return _0xad6d5e;})[_0x6cb6('0x26')](respondWithStatusCode(_0x196f39,null))['catch'](handleError(_0x196f39,null));};exports[_0x6cb6('0x64')]=function(_0x491e09,_0x494c17){var _0x5df93f=[];var _0x17b2ae=[];return db[_0x6cb6('0x57')][_0x6cb6('0x45')]({'where':{'userProfileId':_0x491e09[_0x6cb6('0x49')]['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x346123){_0x5df93f=_[_0x6cb6('0x3e')](_0x346123,function(_0x4d2c94){return _0x4d2c94[_0x6cb6('0x65')]===0x1||_[_0x6cb6('0x66')]([0x3eb,0x709],_0x4d2c94[_0x6cb6('0x5a')]);});if(!_[_0x6cb6('0x67')](_0x5df93f)){return _[_0x6cb6('0x2d')](_0x5df93f,function(_0x1a9f11){return _0x1a9f11['sectionId'];});}else{return;}})[_0x6cb6('0x26')](function(_0x4a8d3b){if(_0x4a8d3b)_0x17b2ae=_0x4a8d3b;if(_[_0x6cb6('0x66')](_0x17b2ae,0x64)){var _0x4b1606=_[_0x6cb6('0x4c')](_0x5df93f,{'sectionId':0x64});return hasDefaultDashboard(_0x4b1606)[_0x6cb6('0x26')](function(_0x16efe1){return _[_0x6cb6('0x2d')](_0x5df93f,function(_0x1a5930){if(_0x1a5930[_0x6cb6('0x5a')]===0x64){_0x1a5930['subsections']=_0x16efe1;}return _0x1a5930;});});}else{return;}})[_0x6cb6('0x26')](function(_0x391555){if(_0x391555)_0x5df93f=_0x391555;if(_[_0x6cb6('0x66')](_0x17b2ae,0x3eb)){var _0x6fcb5e=_['find'](_0x5df93f,{'sectionId':0x3eb});return getCustomDashboards(_0x6fcb5e)[_0x6cb6('0x26')](function(_0x1fe039){return _[_0x6cb6('0x2d')](_0x5df93f,function(_0x1c5f0a){if(_0x6fcb5e['enabled']){if(_0x1c5f0a[_0x6cb6('0x5a')]===0x3eb){_0x1c5f0a[_0x6cb6('0x68')]=_0x1fe039;}}else{if(_0x1c5f0a['sectionId']===0x64){if(!_0x1c5f0a[_0x6cb6('0x68')]){_0x1c5f0a[_0x6cb6('0x68')]=[];}_0x1c5f0a[_0x6cb6('0x68')]=_0x1c5f0a[_0x6cb6('0x68')][_0x6cb6('0x69')](_0x1fe039);}}return _0x1c5f0a;});});}else{return;}})[_0x6cb6('0x26')](function(_0xe6ac7){if(_0xe6ac7)_0x5df93f=_0xe6ac7;if(_[_0x6cb6('0x66')](_0x17b2ae,0x709)){var _0x1fb8ee=_[_0x6cb6('0x4c')](_0x5df93f,{'sectionId':0x709});return getPlugins(_0x1fb8ee)[_0x6cb6('0x26')](function(_0x1061ec){if(_0x1fb8ee[_0x6cb6('0x65')]){return _[_0x6cb6('0x2d')](_0x5df93f,function(_0x4f2331){if(_0x4f2331[_0x6cb6('0x5a')]===0x709){_0x4f2331['subsections']=_0x1061ec;}return _0x4f2331;});}else{var _0x2675bb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1061ec};var _0x5e7901=_[_0x6cb6('0x2d')](_0x5df93f);_0x5e7901[_0x6cb6('0x61')](_0x2675bb);return _0x5e7901;}});}else{return;}})[_0x6cb6('0x26')](function(_0x239ec3){if(_0x239ec3)_0x5df93f=_0x239ec3;return _[_0x6cb6('0x3e')](_0x5df93f,[_0x6cb6('0x65'),0x1]);})['then'](respondWithResult(_0x494c17,null))[_0x6cb6('0x47')](handleError(_0x494c17,null));};function hasDefaultDashboard(_0x906cad){var _0x1663c3=[0x65];return new BPromise(function(_0x1602d9,_0x1af9c9){try{if(_0x906cad[_0x6cb6('0x58')]){_0x1602d9(_0x1663c3);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x906cad['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x2d39eb){_0x2d39eb?_0x1602d9(_0x1663c3):_0x1602d9();});}}catch(_0x164cd3){_0x1af9c9(_0x164cd3);}});}function getCustomDashboards(_0x510a3a){var _0x577549=[];return new BPromise(function(_0xe9e792,_0x1ea9c3){try{if(_0x510a3a[_0x6cb6('0x58')]){return db[_0x6cb6('0x6a')][_0x6cb6('0x45')]({'raw':!![]})[_0x6cb6('0x26')](function(_0x56bb0f){_0x56bb0f['forEach'](function(_0x358339){_0x577549[_0x6cb6('0x61')](_0x358339['id']+0x1869f);});_0xe9e792(_0x577549);});}else{return db[_0x6cb6('0x59')][_0x6cb6('0x45')]({'where':{'sectionId':_0x510a3a['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x1d67e1){_0x1d67e1['forEach'](function(_0x1cf6f9){_0x577549['push'](_0x1cf6f9['resourceId']+0x1869f);});_0xe9e792(_0x577549);});}}catch(_0x124403){_0x1ea9c3(_0x124403);}});}function getPlugins(_0x45587a){var _0x17b1a1=[];return new BPromise(function(_0x159496,_0x49ef15){try{if(_0x45587a[_0x6cb6('0x58')]){return db[_0x6cb6('0x6b')][_0x6cb6('0x45')]({'raw':!![]})[_0x6cb6('0x26')](function(_0x12149d){_0x12149d['forEach'](function(_0x223008){_0x17b1a1[_0x6cb6('0x61')](_0x223008['id']+0x15b38);});_0x159496(_0x17b1a1);});}else{return db[_0x6cb6('0x59')][_0x6cb6('0x45')]({'where':{'sectionId':_0x45587a['id']},'raw':!![]})[_0x6cb6('0x26')](function(_0x3c6315){_0x3c6315[_0x6cb6('0x6c')](function(_0x50b9ae){_0x17b1a1[_0x6cb6('0x61')](_0x50b9ae['resourceId']+0x15b38);});_0x159496(_0x17b1a1);});}}catch(_0x663027){_0x49ef15(_0x663027);}});}exports['addResources']=function(_0x274412,_0x17a446){return db[_0x6cb6('0x2e')][_0x6cb6('0x4c')]({'where':{'id':_0x274412[_0x6cb6('0x49')]['id']}})[_0x6cb6('0x26')](handleEntityNotFound(_0x17a446,null))[_0x6cb6('0x26')](function(_0x554aa7){if(_0x554aa7){return db[_0x6cb6('0x55')][_0x6cb6('0x56')](function(_0x1c7d18){return db[_0x6cb6('0x57')][_0x6cb6('0x45')]({'where':{'userProfileId':_0x274412[_0x6cb6('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x500a05){if(_0x500a05){return db[_0x6cb6('0x57')][_0x6cb6('0x27')]({'where':{'userProfileId':_0x274412[_0x6cb6('0x49')]['id'],'id':_['map'](_0x500a05,function(_0x390f51){return _0x390f51['id'];})},'transaction':_0x1c7d18});}})[_0x6cb6('0x26')](function(_0x4b425e){var _0x4d4a43=_[_0x6cb6('0x2d')](_0x274412['body'],function(_0x336477){_0x336477[_0x6cb6('0x5f')]=_0x274412[_0x6cb6('0x49')]['id'];return _0x336477;});return db['UserProfileSection'][_0x6cb6('0x6d')](_0x4d4a43,{'raw':!![],'transaction':_0x1c7d18});})[_0x6cb6('0x26')](function(_0x4264f6){var _0x5e0262=_[_0x6cb6('0x3e')](_[_0x6cb6('0x2d')](_0x4264f6,function(_0x48f4fe){return _0x48f4fe[_0x6cb6('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e0262){return db[_0x6cb6('0x57')][_0x6cb6('0x45')]({'where':{'userProfileId':_0x274412['params']['id'],'sectionId':_[_0x6cb6('0x2d')](_0x5e0262,function(_0x67f1ae){return _0x67f1ae['sectionId'];})},'attributes':['id',_0x6cb6('0x5a')],'raw':!![]})[_0x6cb6('0x26')](function(_0x4b7231){var _0x140323=_['map'](_0x274412['body'],function(_0x3d86d3){_0x3d86d3[_0x6cb6('0x5f')]=_0x274412['params']['id'];return _0x3d86d3;});return db[_0x6cb6('0x59')][_0x6cb6('0x6d')](_0x140323,{'raw':!![],'transaction':_0x1c7d18});});}})[_0x6cb6('0x47')](handleError(_0x17a446,null));});}})[_0x6cb6('0x26')](function(_0x1baae3){var _0x35eb8d=_[_0x6cb6('0x2d')](_0x1baae3,function(_0x443400){return _0x443400[_0x6cb6('0x4f')]({'plain':!![]});});})[_0x6cb6('0x26')](respondWithResult(_0x17a446,null))[_0x6cb6('0x47')](handleError(_0x17a446,null));};exports['removeResources']=function(_0x5a07dc,_0x48e242,_0x1be8fa){return db['UserProfile']['find']({'where':{'id':_0x5a07dc[_0x6cb6('0x49')]['id']}})[_0x6cb6('0x26')](handleEntityNotFound(_0x48e242,null))[_0x6cb6('0x26')](function(_0x23d70a){if(_0x23d70a){return _0x23d70a[_0x6cb6('0x6e')](_0x5a07dc[_0x6cb6('0x33')][_0x6cb6('0x63')]);}})[_0x6cb6('0x26')](respondWithStatusCode(_0x48e242,null))[_0x6cb6('0x47')](handleError(_0x48e242,null));};exports[_0x6cb6('0x6f')]=function(_0x48f658,_0x369ff4){var _0x147119={};if(!_0x48f658['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x48f658[_0x6cb6('0x33')][_0x6cb6('0x39')](_0x6cb6('0x70'))){_0x147119[_0x6cb6('0x20')]=qs[_0x6cb6('0x20')](_0x48f658[_0x6cb6('0x33')]['limit']);_0x147119['offset']=qs['offset'](_0x48f658['query'][_0x6cb6('0x3a')]);}return db['UserProfile'][_0x6cb6('0x4c')]({'where':{'id':_0x48f658['params']['id']}})['then'](function(_0x3a9fb3){if(!_0x3a9fb3)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x48f658['params']['id']);return db[_0x6cb6('0x2e')]['getResources'](_0x48f658);})[_0x6cb6('0x26')](respondWithFilteredResult(_0x369ff4,_0x147119))['catch'](handleError(_0x369ff4,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e28be70..58c0057 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 _0x2bab=['hook','events','../../mysqldb','UserProfile','setMaxListeners','update','remove'];(function(_0x3ea14f,_0x2036fd){var _0x227b7c=function(_0x5071ee){while(--_0x5071ee){_0x3ea14f['push'](_0x3ea14f['shift']());}};_0x227b7c(++_0x2036fd);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x2664bb,_0x5ca61a){_0x2664bb=_0x2664bb-0x0;var _0x687e1d=_0x2bab[_0x2664bb];return _0x687e1d;};'use strict';var EventEmitter=require(_0xb2ba('0x0'));var UserProfile=require(_0xb2ba('0x1'))['db'][_0xb2ba('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb2ba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2ba('0x4'),'afterDestroy':_0xb2ba('0x5')};function emitEvent(_0x1d5064){return function(_0x54d80d,_0x24000c,_0x17466f){UserProfileEvents['emit'](_0x1d5064+':'+_0x54d80d['id'],_0x54d80d);UserProfileEvents['emit'](_0x1d5064,_0x54d80d);_0x17466f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb2ba('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xfb67=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4d4f9a,_0x2d3580){var _0x2ba112=function(_0x2a6ad3){while(--_0x2a6ad3){_0x4d4f9a['push'](_0x4d4f9a['shift']());}};_0x2ba112(++_0x2d3580);}(_0xfb67,0xdd));var _0x7fb6=function(_0x8b16b9,_0x23d601){_0x8b16b9=_0x8b16b9-0x0;var _0x11af48=_0xfb67[_0x8b16b9];return _0x11af48;};'use strict';var EventEmitter=require(_0x7fb6('0x0'));var UserProfile=require(_0x7fb6('0x1'))['db'][_0x7fb6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7fb6('0x3')](0x0);var events={'afterCreate':_0x7fb6('0x4'),'afterUpdate':_0x7fb6('0x5'),'afterDestroy':_0x7fb6('0x6')};function emitEvent(_0x5db5cf){return function(_0x40c3ce,_0x29dadc,_0x1c528e){UserProfileEvents[_0x7fb6('0x7')](_0x5db5cf+':'+_0x40c3ce['id'],_0x40c3ce);UserProfileEvents[_0x7fb6('0x7')](_0x5db5cf,_0x40c3ce);_0x1c528e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x7fb6('0x8')](e,emitEvent(event));}}module[_0x7fb6('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5b71088..baf8dbe 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 _0xd551=['extraQueryConditions','CmContact','Tags','tag','Tag','ThroughTags','color','openTabs','chat','dataValues','sms','fax','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','model','name','resolve','UserProfileResource','map','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','inbound','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','VoiceQueue','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','scheduler','Schedule','sounds','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','union','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','count','rows','ids','customSorting'];(function(_0x462e47,_0x5bc307){var _0x36cb97=function(_0x4d86ed){while(--_0x4d86ed){_0x462e47['push'](_0x462e47['shift']());}};_0x36cb97(++_0x5bc307);}(_0xd551,0xc7));var _0x1d55=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0xd551[_0x1a13b1];return _0x395e05;};'use strict';var _=require(_0x1d55('0x0'));var attributes=require(_0x1d55('0x1'));var squel=require(_0x1d55('0x2'));module[_0x1d55('0x3')]=function(_0x306fd0){var _0x2085bc=_0x306fd0[_0x1d55('0x4')];function _0x306df5(_0x514fdb,_0x430067){return new Promise(function(_0x4a0c2e,_0x2f7e7b){if(!_0x430067)return _0x4a0c2e(null);var _0x25a39a=_0x430067[_0x1d55('0x5')]?{[_0x430067['filter'][_0x1d55('0x6')]]:_0x430067[_0x1d55('0x5')][_0x1d55('0x7')]}:undefined;return _0x2085bc[_0x514fdb][_0x1d55('0x8')]({'where':_0x25a39a,'raw':!![]})[_0x1d55('0x9')](function(_0x4f8bb2){_0x430067[_0x1d55('0xa')]=_['map'](_0x4f8bb2,'id');_0x4a0c2e(_0x430067);})[_0x1d55('0xb')](function(_0x59b085){_0x2f7e7b(_0x59b085);});});}function _0x3c0b8c(_0x364f97,_0xe08619){return new Promise(function(_0x2b87f6,_0x35484b){var _0x24ecae=_0x364f97['filter']?{[_0x364f97[_0x1d55('0x5')][_0x1d55('0x6')]]:_0x364f97[_0x1d55('0x5')][_0x1d55('0x7')]}:undefined;return _0x2085bc[_0x364f97[_0x1d55('0xc')]][_0x1d55('0x8')]({'where':_0x24ecae,'raw':!![]})['then'](function(_0x4e643e){_0xe08619[_0x1d55('0xa')]=_['map'](_0x4e643e,function(_0x2ebab9){return _0x2ebab9[_0x1d55('0xd')];});_0x2b87f6(_0xe08619);})[_0x1d55('0xb')](function(_0x54c660){_0x35484b(_0x54c660);});});}function _0x96af2e(_0x37f225,_0x4af7fc,_0x2a905d){if(!_0x4af7fc)return Promise[_0x1d55('0xe')](null);return new Promise(function(_0x4caf34,_0x49f05a){return _0x2085bc[_0x1d55('0xf')]['findAll']({'where':{'sectionId':_0x4af7fc['id']},'raw':!![]})[_0x1d55('0x9')](function(_0x1bb75c){if(_0x37f225[_0x1d55('0x6')]&&_0x37f225[_0x1d55('0x6')]!=='id'){_0x4af7fc[_0x1d55('0xa')]=_[_0x1d55('0x10')](_0x1bb75c,function(_0x55b3d2){return _0x55b3d2[_0x37f225[_0x1d55('0x6')]];});}else{if(_0x2a905d===_0x1d55('0x11')){_0x4af7fc[_0x1d55('0xa')]=_[_0x1d55('0x10')](_0x1bb75c,function(_0x31b97d){return{'id':_0x31b97d['resourceId'],'type':_0x31b97d[_0x1d55('0x12')]};});}else{_0x4af7fc['associatedResources']=_[_0x1d55('0x10')](_0x1bb75c,function(_0x3373ab){return _0x3373ab[_0x1d55('0x13')];});}}_0x4caf34(_0x4af7fc);})[_0x1d55('0xb')](function(_0x3857b0){_0x49f05a(_0x3857b0);});});}function _0x3dc2fc(_0x311049,_0x17bd61){var _0x121b57={'parentSections':[]};switch(_0x311049[_0x1d55('0x14')]()){case _0x1d55('0x15'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x17');break;case'odbc':_0x121b57[_0x1d55('0x16')]='SquareOdbc';break;case _0x1d55('0x18'):_0x121b57['childModel']=_0x1d55('0x19');_0x121b57[_0x1d55('0x1a')]=[{'name':_0x1d55('0x1b'),'field':_0x1d55('0xd'),'foreignKey':_0x1d55('0x1c')}];break;case _0x1d55('0x1d'):_0x121b57['childModel']=_0x1d55('0x1e');break;case _0x1d55('0x1f'):_0x121b57[_0x1d55('0x16')]='CmContact';_0x121b57[_0x1d55('0x1a')]=[{'name':_0x1d55('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x1d55('0x21'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x22');break;case _0x1d55('0x23'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x24');break;case _0x1d55('0x25'):_0x121b57[_0x1d55('0x16')]='CmCustomField';break;case'chatqueues':_0x121b57[_0x1d55('0x16')]='ChatQueue';break;case _0x1d55('0x26'):_0x121b57['childModel']='ChatWebsite';break;case _0x1d55('0x27'):_0x121b57[_0x1d55('0x16')]='FaxQueue';break;case _0x1d55('0x28'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x29');break;case _0x1d55('0x2a'):case _0x1d55('0x2b'):case _0x1d55('0x2c'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x2d');break;case _0x1d55('0x2e'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x2f');break;case'voicemails':_0x121b57[_0x1d55('0x16')]='VoiceMail';break;case _0x1d55('0x30'):_0x121b57['childModel']=_0x1d55('0x31');_0x121b57['parentSections']=[{'name':_0x1d55('0x32'),'field':_0x1d55('0xd'),'foreignKey':_0x1d55('0x33'),'model':_0x1d55('0x34'),'filter':{'field':_0x1d55('0x35'),'value':[_0x1d55('0x36')]}},{'name':_0x1d55('0x37'),'field':_0x1d55('0xd'),'foreignKey':_0x1d55('0x33'),'model':'User','filter':{'field':_0x1d55('0x35'),'value':[_0x1d55('0x38')]}},{'name':_0x1d55('0x39'),'field':_0x1d55('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x1d55('0x12'),'value':[_0x1d55('0x3a')]}},{'name':'QueueCampaigns','field':_0x1d55('0xd'),'foreignKey':_0x1d55('0x3b'),'model':'VoiceQueue','filter':{'field':_0x1d55('0x12'),'value':['outbound']}}];break;case _0x1d55('0x3c'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x3d');break;case _0x1d55('0x3e'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x3f');break;case'voiceprefixes':_0x121b57[_0x1d55('0x16')]=_0x1d55('0x40');break;case _0x1d55('0x41'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x42');break;case'mailqueues':_0x121b57[_0x1d55('0x16')]=_0x1d55('0x43');break;case _0x1d55('0x44'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x45');break;case _0x1d55('0x46'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x47');break;case _0x1d55('0x48'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x49');break;case _0x1d55('0x4a'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x4b');break;case _0x1d55('0x4c'):_0x121b57[_0x1d55('0x16')]='SmsQueue';break;case _0x1d55('0x4d'):_0x121b57['childModel']='SmsAccount';break;case _0x1d55('0x4e'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x4f');break;case _0x1d55('0x50'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x51');break;case _0x1d55('0x52'):_0x121b57['childModel']='Team';break;case'voicequeues':case'queuecampaigns':_0x121b57['childModel']=_0x1d55('0x53');if(_0x17bd61){_0x121b57[_0x1d55('0x1a')]=[{'name':_0x1d55('0x39')},{'name':'QueueCampaigns'}];}break;case _0x1d55('0x54'):case _0x1d55('0x55'):case _0x1d55('0x56'):_0x121b57[_0x1d55('0x16')]='User';if(_0x17bd61){_0x121b57[_0x1d55('0x1a')]=[{'name':'Users','filter':{'field':_0x1d55('0x35'),'value':[_0x1d55('0x57'),_0x1d55('0x58')]},'ignore':!![]},{'name':_0x1d55('0x32')},{'name':_0x1d55('0x37')}];}break;case _0x1d55('0x59'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x5a');break;case _0x1d55('0x5b'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x5c');break;case'freshdeskaccounts':_0x121b57['childModel']='FreshdeskAccount';break;case _0x1d55('0x5d'):_0x121b57['childModel']=_0x1d55('0x5e');break;case _0x1d55('0x5f'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x60');break;case'zohoaccounts':_0x121b57['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x121b57[_0x1d55('0x16')]='User';break;case _0x1d55('0x61'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x62');break;case _0x1d55('0x63'):_0x121b57['childModel']='Disposition';break;case _0x1d55('0x64'):_0x121b57['childModel']=_0x1d55('0x65');break;case _0x1d55('0x66'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x67');break;case'pauses':_0x121b57[_0x1d55('0x16')]='Pause';break;case _0x1d55('0x68'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x69');break;case _0x1d55('0x6a'):_0x121b57[_0x1d55('0x16')]='Sound';break;case'tags':_0x121b57[_0x1d55('0x16')]='Tag';break;case _0x1d55('0x6b'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x6c');break;case _0x1d55('0x6d'):_0x121b57['childModel']='Trigger';break;case _0x1d55('0x6e'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x6f');break;case _0x1d55('0x70'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x71');break;case _0x1d55('0x72'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x73');break;case _0x1d55('0x74'):_0x121b57[_0x1d55('0x16')]=_0x1d55('0x11');_0x121b57[_0x1d55('0x1a')]=[{'name':_0x1d55('0x75'),'field':'id','foreignKey':_0x1d55('0x76')}];break;case'metrics':_0x121b57['childModel']=_0x1d55('0x77');break;}return _0x121b57;}function _0x2dc5be(_0x33c0c7,_0x190c6f){var _0x4c8f33=_0x33c0c7[_0x1d55('0x78')](0x0)[_0x1d55('0x79')]()+_0x33c0c7[_0x1d55('0x7a')](0x1);var _0x19f642={'type':_0x2085bc[_0x1d55('0x7b')][_0x1d55('0x7c')]['SELECT'],'raw':!![]};return new Promise(function(_0x2a26bd,_0x1e2b37){var _0x1bbaab=squel[_0x1d55('0x7d')]()[_0x1d55('0x6')](_0x1d55('0x7e')+_0x4c8f33+'InteractionId','id')[_0x1d55('0x6')]('ui.createdAt')['from'](_0x1d55('0x7f')+_0x33c0c7+_0x1d55('0x80'),'ui')[_0x1d55('0x81')](_0x1d55('0x82'),_0x190c6f['id']);return _0x2085bc[_0x1d55('0x83')][_0x1d55('0x84')](_0x1bbaab[_0x1d55('0x85')](),_0x19f642)[_0x1d55('0x9')](function(_0x177192){_0x190c6f[_0x4c8f33+'OpenTabs']=_0x177192;_0x2a26bd(_0x177192);})[_0x1d55('0xb')](function(_0x566905){_0x1e2b37(_0x566905);});});}return _0x306fd0['define'](_0x1d55('0x86'),attributes,{'tableName':_0x1d55('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1a4fae){var _0x3d3d63=require('../../components/parsers/qs');var _0x5036ef={'raw':_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x88')],'where':{}};var _0x32ebac={};var _0x1d4aeb={'count':0x0,'rows':[]};var _0x3999c2=_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x89')];var _0x103ff0=_0x1a4fae['query']['mergeResources']||![];var _0x31f4e0=_0x3dc2fc(_0x3999c2,_0x103ff0);if(!_0x31f4e0[_0x1d55('0x16')])throw new Error(_0x1d55('0x8a')+_0x3999c2+'\x27');var _0x16922d=[{'name':_0x3999c2}];if(!_[_0x1d55('0x8b')](_0x31f4e0[_0x1d55('0x1a')]))_0x16922d=_0x31f4e0[_0x1d55('0x1a')];var _0x41c877=[];for(var _0x10ae4b=0x0;_0x10ae4b<_0x16922d[_0x1d55('0x8c')];_0x10ae4b++){_0x41c877[_0x1d55('0x8d')](_0x2085bc[_0x1d55('0x8e')]['find']({'where':{'userProfileId':_0x1a4fae[_0x1d55('0x8f')]['id'],'name':_0x16922d[_0x10ae4b]['name']},'raw':!![]}));}return Promise[_0x1d55('0x90')](_0x41c877)['then'](function(_0x244780){var _0x593635=_[_0x1d55('0x5')](_0x244780,function(_0x5b4863){return _0x5b4863?_0x5b4863:undefined;});var _0x42b4ff=_['filter'](_0x16922d,['ignore',!![]]);var _0x92ffe=_['isEmpty'](_0x593635)&&_[_0x1d55('0x8b')](_0x42b4ff)?null:_[_0x1d55('0x91')](_0x42b4ff,_0x593635);if(!_0x92ffe)return null;var _0x3c2fdb=[];for(var _0x1aff41=0x0;_0x1aff41<_0x92ffe[_0x1d55('0x8c')];_0x1aff41++){var _0x298406=_[_0x1d55('0x92')](_0x16922d,function(_0x39b0f4){return _0x92ffe[_0x1aff41]?_0x39b0f4[_0x1d55('0xd')]===_0x92ffe[_0x1aff41][_0x1d55('0xd')]:null;});if(_0x298406){if(_0x92ffe[_0x1aff41]['ignore']){_0x3c2fdb['push'](_0x306df5(_0x31f4e0[_0x1d55('0x16')],_0x92ffe[_0x1aff41]));}else{if(!_0x92ffe[_0x1aff41][_0x1d55('0x93')]){_0x3c2fdb[_0x1d55('0x8d')](_0x96af2e(_0x298406,_0x92ffe[_0x1aff41],_0x31f4e0[_0x1d55('0x16')]));}else{if(_0x298406[_0x1d55('0xc')]){_0x3c2fdb['push'](_0x3c0b8c(_0x298406,_0x92ffe[_0x1aff41]));}}}}}return Promise[_0x1d55('0x90')](_0x3c2fdb);})[_0x1d55('0x9')](function(_0x26d1d4){var _0x1b53cd=_0x26d1d4;var _0x3a4cdb=null;if(_0x1b53cd){_0x3a4cdb=_0x1b53cd[_0x1d55('0x8c')]===0x1?_0x1b53cd[0x0]:null;}if(!_0x3a4cdb&&!_0x1b53cd)return _0x1d4aeb;var _0x420a28=_0x2085bc[_0x31f4e0[_0x1d55('0x16')]][_0x1d55('0x94')];_0x32ebac[_0x1d55('0xc')]=_[_0x1d55('0x95')](_0x420a28);_0x32ebac[_0x1d55('0x84')]=_[_0x1d55('0x95')](_0x1a4fae[_0x1d55('0x84')]);_0x32ebac[_0x1d55('0x96')]=_[_0x1d55('0x97')](_0x32ebac[_0x1d55('0xc')],_0x32ebac[_0x1d55('0x84')]);_0x5036ef[_0x1d55('0x98')]=_[_0x1d55('0x97')](_0x32ebac['model'],_0x3d3d63[_0x1d55('0x99')](_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x99')]));_0x5036ef[_0x1d55('0x98')]=_0x5036ef[_0x1d55('0x98')]['length']?_0x5036ef[_0x1d55('0x98')]:_0x32ebac[_0x1d55('0xc')];if(!_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x9a')]('nolimit')){_0x5036ef[_0x1d55('0x9b')]=_0x3d3d63[_0x1d55('0x9b')](_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x9b')]);_0x5036ef[_0x1d55('0x9c')]=_0x3d3d63['offset'](_0x1a4fae['query'][_0x1d55('0x9c')]);}_0x5036ef[_0x1d55('0x9d')]=_0x3d3d63[_0x1d55('0x9e')](_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x9e')]);_0x5036ef['where']=_0x3d3d63[_0x1d55('0x96')](_['pick'](_0x1a4fae[_0x1d55('0x84')],_0x32ebac[_0x1d55('0x96')]));if(_0x1a4fae[_0x1d55('0x84')]['filter']){_0x5036ef[_0x1d55('0x81')]=_[_0x1d55('0x9f')](_0x5036ef['where'],{'$or':_['map'](_0x420a28,function(_0x518726){if(_0x518726[_0x1d55('0x12')]['key']!==_0x1d55('0xa0')){var _0x239313={};_0x239313[_0x518726[_0x1d55('0x6')]]={'$like':'%'+_0x1a4fae[_0x1d55('0x84')][_0x1d55('0x5')]+'%'};return _0x239313;}})});}var _0x12e549=[];var _0xce4d70=null;var _0x1e3381={};if(_0x3a4cdb){_0xce4d70=_[_0x1d55('0x92')](_0x16922d,[_0x1d55('0xd'),_0x3a4cdb[_0x1d55('0xd')]]);if(_0xce4d70[_0x1d55('0x6')]){_0x1e3381={};if(_0x31f4e0[_0x1d55('0x16')]===_0x1d55('0x11')){_0x1e3381[_0xce4d70['foreignKey']]=_[_0x1d55('0x10')](_0x3a4cdb[_0x1d55('0xa')],'id');}else{_0x1e3381[_0xce4d70[_0x1d55('0xa1')]]=_0x3a4cdb[_0x1d55('0xa')];}_0x12e549[_0x1d55('0x8d')](_0x1e3381);}else{_0x5036ef['where']['id']=_0x3a4cdb[_0x1d55('0xa')];}}else{for(var _0x9d82f6=0x0;_0x9d82f6<_0x1b53cd['length'];_0x9d82f6++){_0xce4d70=_[_0x1d55('0x92')](_0x16922d,[_0x1d55('0xd'),_0x1b53cd[_0x9d82f6][_0x1d55('0xd')]]);if(_0xce4d70[_0x1d55('0x6')]){_0x1e3381={};_0x1e3381[_0xce4d70[_0x1d55('0xa1')]]=_0x1b53cd[_0x9d82f6][_0x1d55('0xa')];_0x12e549['push'](_0x1e3381);}else{if(!_0x5036ef[_0x1d55('0x81')]['id'])_0x5036ef[_0x1d55('0x81')]['id']=[];_0x1b53cd[_0x9d82f6][_0x1d55('0xa')][_0x1d55('0xa2')](function(_0x2bb58c){_0x5036ef[_0x1d55('0x81')]['id'][_0x1d55('0x8d')](_0x2bb58c);});}}}if(!_[_0x1d55('0x8b')](_0x12e549)){_0x5036ef[_0x1d55('0x81')]=_['merge'](_0x5036ef[_0x1d55('0x81')],{'$and':{'$or':_0x12e549}});}_0x5036ef=_[_0x1d55('0x9f')]({},_0x5036ef,_0x1a4fae[_0x1d55('0xa3')]);if(_0x3a4cdb&&!_0x3a4cdb[_0x1d55('0x93')]&&_0x31f4e0[_0x1d55('0x16')]===_0x1d55('0x11')){if(_0x1a4fae['query'][_0x1d55('0xa4')]){_0x5036ef[_0x1d55('0xa5')]=[{'all':!![]}];}return _0x2085bc[_0x31f4e0[_0x1d55('0x16')]][_0x1d55('0x8')](_0x5036ef)[_0x1d55('0x9')](function(_0xf6c43a){var _0x4cd013=[];_0xf6c43a[_0x1d55('0xa2')](function(_0x47bd20){var _0x364cca;switch(_0x47bd20[_0x1d55('0xa6')]){case'default':_0x364cca=_[_0x1d55('0x92')](_0x3a4cdb[_0x1d55('0xa')],function(_0x3ab3ad){return _0x3ab3ad['id']===_0x47bd20[_0x1d55('0x76')]&&_0x3ab3ad[_0x1d55('0x12')]===_0x1d55('0xa7');});break;case _0x1d55('0xa8'):_0x364cca=_[_0x1d55('0x92')](_0x3a4cdb[_0x1d55('0xa')],function(_0x13aa8e){return _0x13aa8e['id']===_0x47bd20[_0x1d55('0x76')]&&_0x13aa8e[_0x1d55('0x12')]==='CustomReports';});break;}if(_0x364cca)_0x4cd013[_0x1d55('0x8d')](_0x47bd20);});_0x1d4aeb[_0x1d55('0xa9')]=_0x4cd013['length'];_0x1d4aeb[_0x1d55('0xaa')]=_0x4cd013;return _0x1d4aeb;});}else{if(!_[_0x1d55('0x8b')](_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xab')])){_0x5036ef[_0x1d55('0x81')]['id']=_0x5036ef[_0x1d55('0x81')]['id']?_[_0x1d55('0x97')](_0x5036ef[_0x1d55('0x81')]['id'],_0x1a4fae['query'][_0x1d55('0xab')]):_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xab')];if(_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xac')]){_0x5036ef['order']=_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xac')];}}if(_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xad')]){_0x5036ef[_0x1d55('0x81')]=_[_0x1d55('0x9f')](_0x5036ef[_0x1d55('0x81')],{'$and':_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xad')]});}return _0x2085bc[_0x31f4e0[_0x1d55('0x16')]][_0x1d55('0xa9')]({'where':_0x5036ef[_0x1d55('0x81')]})[_0x1d55('0x9')](function(_0x4496c5){_0x1d4aeb[_0x1d55('0xa9')]=_0x4496c5;if(_0x1a4fae[_0x1d55('0x84')]['includeAll']){if(_0x31f4e0[_0x1d55('0x16')]===_0x1d55('0xae')){_0x5036ef['include']=[{'model':_0x2085bc['Tag'],'as':_0x1d55('0xaf'),'attributes':['id','name','color'],'required':_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xb0')]?!![]:![]},{'model':_0x2085bc[_0x1d55('0xb1')],'as':_0x1d55('0xb2'),'attributes':['id',_0x1d55('0xd'),_0x1d55('0xb3')],'through':_0x1a4fae['query'][_0x1d55('0xb0')]?{'attributes':[],'where':{'TagId':_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xb0')]||undefined}}:{},'required':_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xb0')]?!![]:![]}];}else{_0x5036ef[_0x1d55('0xa5')]=[{'all':!![]}];}}return _0x2085bc[_0x31f4e0[_0x1d55('0x16')]][_0x1d55('0x8')](_0x5036ef);})[_0x1d55('0x9')](function(_0x37c80b){_0x1d4aeb[_0x1d55('0xaa')]=_0x37c80b;if(_0x3999c2===_0x1d55('0x32')&&_0x1a4fae[_0x1d55('0x84')][_0x1d55('0xb4')]==='true'){var _0xb7d537=[];for(var _0x19c9d6=0x0;_0x19c9d6<_0x1d4aeb[_0x1d55('0xaa')][_0x1d55('0x8c')];_0x19c9d6++){_0xb7d537[_0x1d55('0x8d')](_0x2dc5be(_0x1d55('0xb5'),_0x1d4aeb['rows'][_0x19c9d6][_0x1d55('0xb6')]));_0xb7d537[_0x1d55('0x8d')](_0x2dc5be(_0x1d55('0xb7'),_0x1d4aeb[_0x1d55('0xaa')][_0x19c9d6][_0x1d55('0xb6')]));_0xb7d537[_0x1d55('0x8d')](_0x2dc5be(_0x1d55('0xb8'),_0x1d4aeb[_0x1d55('0xaa')][_0x19c9d6][_0x1d55('0xb6')]));_0xb7d537['push'](_0x2dc5be('mail',_0x1d4aeb['rows'][_0x19c9d6]['dataValues']));_0xb7d537['push'](_0x2dc5be('openchannel',_0x1d4aeb[_0x1d55('0xaa')][_0x19c9d6][_0x1d55('0xb6')]));_0xb7d537[_0x1d55('0x8d')](_0x2dc5be(_0x1d55('0xb9'),_0x1d4aeb['rows'][_0x19c9d6][_0x1d55('0xb6')]));}return Promise[_0x1d55('0x90')](_0xb7d537)[_0x1d55('0x9')](function(){return _0x1d4aeb;});}return _0x1d4aeb;});}});}}});}; \ No newline at end of file +var _0x9e9d=['ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','catch','model','name','resolve','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','Users','user','zendeskaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','toUpperCase','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','UserProfileSection','params','all','isEmpty','union','length','find','ignore','autoAssociation','push','rawAttributes','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','merge','key','foreignKey','forEach','options','includeAll','include','findAll','reportType','default','DefaultReports','CustomReports','count','rows'];(function(_0x430c2f,_0x140937){var _0x55d1f6=function(_0xfa71a7){while(--_0xfa71a7){_0x430c2f['push'](_0x430c2f['shift']());}};_0x55d1f6(++_0x140937);}(_0x9e9d,0x191));var _0xd9e9=function(_0x2eb647,_0x279ccf){_0x2eb647=_0x2eb647-0x0;var _0x1ab0f1=_0x9e9d[_0x2eb647];return _0x1ab0f1;};'use strict';var _=require('lodash');var attributes=require(_0xd9e9('0x0'));var squel=require(_0xd9e9('0x1'));module[_0xd9e9('0x2')]=function(_0xf04102){var _0x536a90=_0xf04102[_0xd9e9('0x3')];function _0x5e3cb9(_0x5e762e,_0x4f6d0a){return new Promise(function(_0x266fa6,_0x15b791){if(!_0x4f6d0a)return _0x266fa6(null);var _0x561486=_0x4f6d0a[_0xd9e9('0x4')]?{[_0x4f6d0a[_0xd9e9('0x4')][_0xd9e9('0x5')]]:_0x4f6d0a[_0xd9e9('0x4')][_0xd9e9('0x6')]}:undefined;return _0x536a90[_0x5e762e]['findAll']({'where':_0x561486,'raw':!![]})[_0xd9e9('0x7')](function(_0x3b4c74){_0x4f6d0a[_0xd9e9('0x8')]=_[_0xd9e9('0x9')](_0x3b4c74,'id');_0x266fa6(_0x4f6d0a);})[_0xd9e9('0xa')](function(_0x1e8940){_0x15b791(_0x1e8940);});});}function _0x30d81a(_0x53cd6f,_0x1c7f5e){return new Promise(function(_0x44cc24,_0x279b67){var _0x34e2f1=_0x53cd6f[_0xd9e9('0x4')]?{[_0x53cd6f[_0xd9e9('0x4')][_0xd9e9('0x5')]]:_0x53cd6f[_0xd9e9('0x4')][_0xd9e9('0x6')]}:undefined;return _0x536a90[_0x53cd6f[_0xd9e9('0xb')]]['findAll']({'where':_0x34e2f1,'raw':!![]})[_0xd9e9('0x7')](function(_0x598b2c){_0x1c7f5e[_0xd9e9('0x8')]=_[_0xd9e9('0x9')](_0x598b2c,function(_0x385d8c){return _0x385d8c[_0xd9e9('0xc')];});_0x44cc24(_0x1c7f5e);})[_0xd9e9('0xa')](function(_0x5d5890){_0x279b67(_0x5d5890);});});}function _0x3be3a7(_0x58e041,_0x28b87b,_0x45d94c){if(!_0x28b87b)return Promise[_0xd9e9('0xd')](null);return new Promise(function(_0x3d7738,_0x3156a1){return _0x536a90['UserProfileResource']['findAll']({'where':{'sectionId':_0x28b87b['id']},'raw':!![]})['then'](function(_0x7c753e){if(_0x58e041[_0xd9e9('0x5')]&&_0x58e041[_0xd9e9('0x5')]!=='id'){_0x28b87b[_0xd9e9('0x8')]=_['map'](_0x7c753e,function(_0x3ae952){return _0x3ae952[_0x58e041[_0xd9e9('0x5')]];});}else{if(_0x45d94c==='AnalyticExtractedReport'){_0x28b87b[_0xd9e9('0x8')]=_[_0xd9e9('0x9')](_0x7c753e,function(_0x5dd799){return{'id':_0x5dd799[_0xd9e9('0xe')],'type':_0x5dd799[_0xd9e9('0xf')]};});}else{_0x28b87b['associatedResources']=_[_0xd9e9('0x9')](_0x7c753e,function(_0x4c8c63){return _0x4c8c63['resourceId'];});}}_0x3d7738(_0x28b87b);})[_0xd9e9('0xa')](function(_0x14275b){_0x3156a1(_0x14275b);});});}function _0x552eb9(_0x1b1244,_0x565db5){var _0x41d3d9={'parentSections':[]};switch(_0x1b1244[_0xd9e9('0x10')]()){case _0xd9e9('0x11'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x13');break;case'odbc':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x14');break;case'squarerecordings':_0x41d3d9['childModel']=_0xd9e9('0x15');_0x41d3d9[_0xd9e9('0x16')]=[{'name':_0xd9e9('0x17'),'field':_0xd9e9('0xc'),'foreignKey':_0xd9e9('0x18')}];break;case _0xd9e9('0x19'):_0x41d3d9[_0xd9e9('0x12')]='JscriptyProject';break;case _0xd9e9('0x1a'):_0x41d3d9['childModel']='CmContact';_0x41d3d9[_0xd9e9('0x16')]=[{'name':'Lists','field':'id','foreignKey':_0xd9e9('0x1b')}];break;case _0xd9e9('0x1c'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x1d');break;case _0xd9e9('0x1e'):_0x41d3d9['childModel']=_0xd9e9('0x1f');break;case _0xd9e9('0x20'):_0x41d3d9['childModel']=_0xd9e9('0x21');break;case _0xd9e9('0x22'):_0x41d3d9[_0xd9e9('0x12')]='ChatQueue';break;case _0xd9e9('0x23'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x24');break;case'faxqueues':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x25');break;case _0xd9e9('0x26'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x27');break;case _0xd9e9('0x28'):case'internalroutes':case _0xd9e9('0x29'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x2a');break;case _0xd9e9('0x2b'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x2c');break;case _0xd9e9('0x2d'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x2e');break;case _0xd9e9('0x2f'):_0x41d3d9[_0xd9e9('0x12')]='VoiceRecording';_0x41d3d9['parentSections']=[{'name':'Agents','field':_0xd9e9('0xc'),'foreignKey':_0xd9e9('0x30'),'model':_0xd9e9('0x31'),'filter':{'field':_0xd9e9('0x32'),'value':[_0xd9e9('0x33')]}},{'name':_0xd9e9('0x34'),'field':_0xd9e9('0xc'),'foreignKey':_0xd9e9('0x30'),'model':_0xd9e9('0x31'),'filter':{'field':_0xd9e9('0x32'),'value':[_0xd9e9('0x35')]}},{'name':_0xd9e9('0x36'),'field':_0xd9e9('0xc'),'foreignKey':_0xd9e9('0x37'),'model':_0xd9e9('0x38'),'filter':{'field':'type','value':['inbound']}},{'name':_0xd9e9('0x39'),'field':'name','foreignKey':'queue','model':_0xd9e9('0x38'),'filter':{'field':_0xd9e9('0xf'),'value':['outbound']}}];break;case'musiconholds':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x3a');break;case'chanspies':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x3b');break;case _0xd9e9('0x3c'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x3d');break;case _0xd9e9('0x3e'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x3f');break;case _0xd9e9('0x40'):_0x41d3d9['childModel']=_0xd9e9('0x41');break;case _0xd9e9('0x42'):_0x41d3d9[_0xd9e9('0x12')]='MailAccount';break;case _0xd9e9('0x43'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x44');break;case _0xd9e9('0x45'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x46');break;case'openchannelaccounts':_0x41d3d9['childModel']=_0xd9e9('0x47');break;case _0xd9e9('0x48'):_0x41d3d9['childModel']='SmsQueue';break;case _0xd9e9('0x49'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x4a');break;case _0xd9e9('0x4b'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x4c');break;case _0xd9e9('0x4d'):_0x41d3d9[_0xd9e9('0x12')]='WhatsappAccount';break;case _0xd9e9('0x4e'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x4f');break;case _0xd9e9('0x50'):case _0xd9e9('0x51'):_0x41d3d9[_0xd9e9('0x12')]='VoiceQueue';if(_0x565db5){_0x41d3d9[_0xd9e9('0x16')]=[{'name':'VoiceQueues'},{'name':_0xd9e9('0x39')}];}break;case _0xd9e9('0x52'):case'agents':case'telephones':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x31');if(_0x565db5){_0x41d3d9['parentSections']=[{'name':_0xd9e9('0x53'),'filter':{'field':'role','value':['admin',_0xd9e9('0x54')]},'ignore':!![]},{'name':'Agents'},{'name':_0xd9e9('0x34')}];}break;case _0xd9e9('0x55'):_0x41d3d9[_0xd9e9('0x12')]='ZendeskAccount';break;case'salesforceaccounts':_0x41d3d9[_0xd9e9('0x12')]='SalesforceAccount';break;case _0xd9e9('0x56'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x57');break;case _0xd9e9('0x58'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x59');break;case'deskaccounts':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x5a');break;case _0xd9e9('0x5b'):_0x41d3d9[_0xd9e9('0x12')]='ZohoAccount';break;case _0xd9e9('0x5c'):_0x41d3d9[_0xd9e9('0x12')]='User';break;case _0xd9e9('0x5d'):_0x41d3d9['childModel']='CannedAnswer';break;case _0xd9e9('0x5e'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x5f');break;case _0xd9e9('0x60'):_0x41d3d9['childModel']=_0xd9e9('0x61');break;case _0xd9e9('0x62'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x63');break;case _0xd9e9('0x64'):_0x41d3d9[_0xd9e9('0x12')]='Pause';break;case _0xd9e9('0x65'):_0x41d3d9[_0xd9e9('0x12')]='Schedule';break;case _0xd9e9('0x66'):_0x41d3d9['childModel']=_0xd9e9('0x67');break;case'tags':_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x68');break;case _0xd9e9('0x69'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x6a');break;case _0xd9e9('0x6b'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x6c');break;case _0xd9e9('0x6d'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x6e');break;case _0xd9e9('0x6f'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x70');break;case _0xd9e9('0x71'):_0x41d3d9['childModel']=_0xd9e9('0x72');break;case _0xd9e9('0x73'):_0x41d3d9[_0xd9e9('0x12')]=_0xd9e9('0x74');_0x41d3d9[_0xd9e9('0x16')]=[{'name':_0xd9e9('0x75'),'field':'id','foreignKey':_0xd9e9('0x76')}];break;case _0xd9e9('0x77'):_0x41d3d9['childModel']='AnalyticMetric';break;}return _0x41d3d9;}function _0x4b2088(_0x59c72d,_0x323fb3){var _0x370ebe=_0x59c72d['charAt'](0x0)[_0xd9e9('0x78')]()+_0x59c72d['slice'](0x1);var _0x32e705={'type':_0x536a90[_0xd9e9('0x79')]['QueryTypes'][_0xd9e9('0x7a')],'raw':!![]};return new Promise(function(_0x358731,_0x29ee18){var _0x4de9af=squel[_0xd9e9('0x7b')]()[_0xd9e9('0x5')](_0xd9e9('0x7c')+_0x370ebe+_0xd9e9('0x7d'),'id')[_0xd9e9('0x5')](_0xd9e9('0x7e'))[_0xd9e9('0x7f')](_0xd9e9('0x80')+_0x59c72d+'_interactions','ui')[_0xd9e9('0x81')](_0xd9e9('0x82'),_0x323fb3['id']);return _0x536a90['sequelize']['query'](_0x4de9af[_0xd9e9('0x83')](),_0x32e705)[_0xd9e9('0x7')](function(_0xc62ca4){_0x323fb3[_0x370ebe+_0xd9e9('0x84')]=_0xc62ca4;_0x358731(_0xc62ca4);})[_0xd9e9('0xa')](function(_0x26b706){_0x29ee18(_0x26b706);});});}return _0xf04102[_0xd9e9('0x85')](_0xd9e9('0x86'),attributes,{'tableName':_0xd9e9('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x52d5a3){var _0x24a0f4=require(_0xd9e9('0x88'));var _0x83d7c3={'raw':_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0x8a')],'where':{}};var _0x34fc31={};var _0xd2b437={'count':0x0,'rows':[]};var _0x248b52=_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0x8b')];var _0x21fb9e=_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0x8c')]||![];var _0x27d403=_0x552eb9(_0x248b52,_0x21fb9e);if(!_0x27d403[_0xd9e9('0x12')])throw new Error(_0xd9e9('0x8d')+_0x248b52+'\x27');var _0x2205fc=[{'name':_0x248b52}];if(!_['isEmpty'](_0x27d403[_0xd9e9('0x16')]))_0x2205fc=_0x27d403[_0xd9e9('0x16')];var _0xf5d370=[];for(var _0x4132b9=0x0;_0x4132b9<_0x2205fc['length'];_0x4132b9++){_0xf5d370['push'](_0x536a90[_0xd9e9('0x8e')]['find']({'where':{'userProfileId':_0x52d5a3[_0xd9e9('0x8f')]['id'],'name':_0x2205fc[_0x4132b9][_0xd9e9('0xc')]},'raw':!![]}));}return Promise[_0xd9e9('0x90')](_0xf5d370)[_0xd9e9('0x7')](function(_0x4cbd2d){var _0x9c5a9b=_[_0xd9e9('0x4')](_0x4cbd2d,function(_0x141f58){return _0x141f58?_0x141f58:undefined;});var _0x20ad96=_[_0xd9e9('0x4')](_0x2205fc,['ignore',!![]]);var _0x48258f=_[_0xd9e9('0x91')](_0x9c5a9b)&&_[_0xd9e9('0x91')](_0x20ad96)?null:_[_0xd9e9('0x92')](_0x20ad96,_0x9c5a9b);if(!_0x48258f)return null;var _0x53b200=[];for(var _0x2ddbd1=0x0;_0x2ddbd1<_0x48258f[_0xd9e9('0x93')];_0x2ddbd1++){var _0x241150=_[_0xd9e9('0x94')](_0x2205fc,function(_0x51bf13){return _0x48258f[_0x2ddbd1]?_0x51bf13[_0xd9e9('0xc')]===_0x48258f[_0x2ddbd1][_0xd9e9('0xc')]:null;});if(_0x241150){if(_0x48258f[_0x2ddbd1][_0xd9e9('0x95')]){_0x53b200['push'](_0x5e3cb9(_0x27d403['childModel'],_0x48258f[_0x2ddbd1]));}else{if(!_0x48258f[_0x2ddbd1][_0xd9e9('0x96')]){_0x53b200[_0xd9e9('0x97')](_0x3be3a7(_0x241150,_0x48258f[_0x2ddbd1],_0x27d403[_0xd9e9('0x12')]));}else{if(_0x241150[_0xd9e9('0xb')]){_0x53b200[_0xd9e9('0x97')](_0x30d81a(_0x241150,_0x48258f[_0x2ddbd1]));}}}}}return Promise[_0xd9e9('0x90')](_0x53b200);})['then'](function(_0x42cefc){var _0x186a3f=_0x42cefc;var _0x90c241=null;if(_0x186a3f){_0x90c241=_0x186a3f[_0xd9e9('0x93')]===0x1?_0x186a3f[0x0]:null;}if(!_0x90c241&&!_0x186a3f)return _0xd2b437;var _0x407dde=_0x536a90[_0x27d403[_0xd9e9('0x12')]][_0xd9e9('0x98')];_0x34fc31[_0xd9e9('0xb')]=_['keys'](_0x407dde);_0x34fc31['query']=_[_0xd9e9('0x99')](_0x52d5a3[_0xd9e9('0x89')]);_0x34fc31['filters']=_['intersection'](_0x34fc31[_0xd9e9('0xb')],_0x34fc31[_0xd9e9('0x89')]);_0x83d7c3['attributes']=_[_0xd9e9('0x9a')](_0x34fc31[_0xd9e9('0xb')],_0x24a0f4[_0xd9e9('0x9b')](_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0x9b')]));_0x83d7c3[_0xd9e9('0x9c')]=_0x83d7c3[_0xd9e9('0x9c')][_0xd9e9('0x93')]?_0x83d7c3['attributes']:_0x34fc31['model'];if(!_0x52d5a3[_0xd9e9('0x89')]['hasOwnProperty'](_0xd9e9('0x9d'))){_0x83d7c3[_0xd9e9('0x9e')]=_0x24a0f4['limit'](_0x52d5a3['query'][_0xd9e9('0x9e')]);_0x83d7c3[_0xd9e9('0x9f')]=_0x24a0f4[_0xd9e9('0x9f')](_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0x9f')]);}_0x83d7c3[_0xd9e9('0xa0')]=_0x24a0f4[_0xd9e9('0xa1')](_0x52d5a3['query'][_0xd9e9('0xa1')]);_0x83d7c3[_0xd9e9('0x81')]=_0x24a0f4['filters'](_[_0xd9e9('0xa2')](_0x52d5a3[_0xd9e9('0x89')],_0x34fc31[_0xd9e9('0xa3')]));if(_0x52d5a3[_0xd9e9('0x89')]['filter']){_0x83d7c3[_0xd9e9('0x81')]=_[_0xd9e9('0xa4')](_0x83d7c3[_0xd9e9('0x81')],{'$or':_['map'](_0x407dde,function(_0xf1c3e3){if(_0xf1c3e3[_0xd9e9('0xf')][_0xd9e9('0xa5')]!=='VIRTUAL'){var _0x28369b={};_0x28369b[_0xf1c3e3[_0xd9e9('0x5')]]={'$like':'%'+_0x52d5a3['query'][_0xd9e9('0x4')]+'%'};return _0x28369b;}})});}var _0x20089c=[];var _0x12d67c=null;var _0x4b90e0={};if(_0x90c241){_0x12d67c=_['find'](_0x2205fc,[_0xd9e9('0xc'),_0x90c241['name']]);if(_0x12d67c[_0xd9e9('0x5')]){_0x4b90e0={};if(_0x27d403['childModel']==='AnalyticExtractedReport'){_0x4b90e0[_0x12d67c[_0xd9e9('0xa6')]]=_[_0xd9e9('0x9')](_0x90c241[_0xd9e9('0x8')],'id');}else{_0x4b90e0[_0x12d67c['foreignKey']]=_0x90c241['associatedResources'];}_0x20089c[_0xd9e9('0x97')](_0x4b90e0);}else{_0x83d7c3['where']['id']=_0x90c241[_0xd9e9('0x8')];}}else{for(var _0x40c731=0x0;_0x40c731<_0x186a3f[_0xd9e9('0x93')];_0x40c731++){_0x12d67c=_[_0xd9e9('0x94')](_0x2205fc,[_0xd9e9('0xc'),_0x186a3f[_0x40c731]['name']]);if(_0x12d67c[_0xd9e9('0x5')]){_0x4b90e0={};_0x4b90e0[_0x12d67c[_0xd9e9('0xa6')]]=_0x186a3f[_0x40c731]['associatedResources'];_0x20089c[_0xd9e9('0x97')](_0x4b90e0);}else{if(!_0x83d7c3['where']['id'])_0x83d7c3[_0xd9e9('0x81')]['id']=[];_0x186a3f[_0x40c731][_0xd9e9('0x8')][_0xd9e9('0xa7')](function(_0x1ad919){_0x83d7c3[_0xd9e9('0x81')]['id'][_0xd9e9('0x97')](_0x1ad919);});}}}if(!_['isEmpty'](_0x20089c)){_0x83d7c3[_0xd9e9('0x81')]=_[_0xd9e9('0xa4')](_0x83d7c3[_0xd9e9('0x81')],{'$and':{'$or':_0x20089c}});}_0x83d7c3=_[_0xd9e9('0xa4')]({},_0x83d7c3,_0x52d5a3[_0xd9e9('0xa8')]);if(_0x90c241&&!_0x90c241[_0xd9e9('0x96')]&&_0x27d403[_0xd9e9('0x12')]===_0xd9e9('0x74')){if(_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xa9')]){_0x83d7c3[_0xd9e9('0xaa')]=[{'all':!![]}];}return _0x536a90[_0x27d403['childModel']][_0xd9e9('0xab')](_0x83d7c3)[_0xd9e9('0x7')](function(_0x546496){var _0xe0b4d4=[];_0x546496[_0xd9e9('0xa7')](function(_0x153396){var _0x5a2200;switch(_0x153396[_0xd9e9('0xac')]){case _0xd9e9('0xad'):_0x5a2200=_[_0xd9e9('0x94')](_0x90c241[_0xd9e9('0x8')],function(_0x3cfd9e){return _0x3cfd9e['id']===_0x153396[_0xd9e9('0x76')]&&_0x3cfd9e[_0xd9e9('0xf')]===_0xd9e9('0xae');});break;case'custom':_0x5a2200=_[_0xd9e9('0x94')](_0x90c241['associatedResources'],function(_0x5094aa){return _0x5094aa['id']===_0x153396[_0xd9e9('0x76')]&&_0x5094aa[_0xd9e9('0xf')]===_0xd9e9('0xaf');});break;}if(_0x5a2200)_0xe0b4d4[_0xd9e9('0x97')](_0x153396);});_0xd2b437[_0xd9e9('0xb0')]=_0xe0b4d4[_0xd9e9('0x93')];_0xd2b437[_0xd9e9('0xb1')]=_0xe0b4d4;return _0xd2b437;});}else{if(!_[_0xd9e9('0x91')](_0x52d5a3['query'][_0xd9e9('0xb2')])){_0x83d7c3[_0xd9e9('0x81')]['id']=_0x83d7c3['where']['id']?_[_0xd9e9('0x9a')](_0x83d7c3[_0xd9e9('0x81')]['id'],_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xb2')]):_0x52d5a3['query'][_0xd9e9('0xb2')];if(_0x52d5a3['query'][_0xd9e9('0xb3')]){_0x83d7c3[_0xd9e9('0xa0')]=_0x52d5a3['query'][_0xd9e9('0xb3')];}}if(_0x52d5a3[_0xd9e9('0x89')]['extraQueryConditions']){_0x83d7c3[_0xd9e9('0x81')]=_[_0xd9e9('0xa4')](_0x83d7c3[_0xd9e9('0x81')],{'$and':_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xb4')]});}return _0x536a90[_0x27d403['childModel']][_0xd9e9('0xb0')]({'where':_0x83d7c3[_0xd9e9('0x81')]})[_0xd9e9('0x7')](function(_0x16df64){_0xd2b437['count']=_0x16df64;if(_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xa9')]){if(_0x27d403[_0xd9e9('0x12')]===_0xd9e9('0xb5')){_0x83d7c3[_0xd9e9('0xaa')]=[{'model':_0x536a90[_0xd9e9('0x68')],'as':_0xd9e9('0xb6'),'attributes':['id',_0xd9e9('0xc'),_0xd9e9('0xb7')],'required':_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xb8')]?!![]:![]},{'model':_0x536a90[_0xd9e9('0x68')],'as':_0xd9e9('0xb9'),'attributes':['id','name',_0xd9e9('0xb7')],'through':_0x52d5a3[_0xd9e9('0x89')]['tag']?{'attributes':[],'where':{'TagId':_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xb8')]||undefined}}:{},'required':_0x52d5a3[_0xd9e9('0x89')][_0xd9e9('0xb8')]?!![]:![]}];}else{_0x83d7c3[_0xd9e9('0xaa')]=[{'all':!![]}];}}return _0x536a90[_0x27d403[_0xd9e9('0x12')]][_0xd9e9('0xab')](_0x83d7c3);})['then'](function(_0xe8776d){_0xd2b437[_0xd9e9('0xb1')]=_0xe8776d;if(_0x248b52==='Agents'&&_0x52d5a3['query'][_0xd9e9('0xba')]==='true'){var _0x207c2d=[];for(var _0x28bcf2=0x0;_0x28bcf2<_0xd2b437['rows']['length'];_0x28bcf2++){_0x207c2d[_0xd9e9('0x97')](_0x4b2088(_0xd9e9('0xbb'),_0xd2b437[_0xd9e9('0xb1')][_0x28bcf2][_0xd9e9('0xbc')]));_0x207c2d['push'](_0x4b2088(_0xd9e9('0xbd'),_0xd2b437['rows'][_0x28bcf2][_0xd9e9('0xbc')]));_0x207c2d[_0xd9e9('0x97')](_0x4b2088('fax',_0xd2b437[_0xd9e9('0xb1')][_0x28bcf2][_0xd9e9('0xbc')]));_0x207c2d[_0xd9e9('0x97')](_0x4b2088(_0xd9e9('0xbe'),_0xd2b437[_0xd9e9('0xb1')][_0x28bcf2][_0xd9e9('0xbc')]));_0x207c2d['push'](_0x4b2088(_0xd9e9('0xbf'),_0xd2b437[_0xd9e9('0xb1')][_0x28bcf2][_0xd9e9('0xbc')]));_0x207c2d[_0xd9e9('0x97')](_0x4b2088(_0xd9e9('0xc0'),_0xd2b437[_0xd9e9('0xb1')][_0x28bcf2][_0xd9e9('0xbc')]));}return Promise[_0xd9e9('0x90')](_0x207c2d)[_0xd9e9('0x7')](function(){return _0xd2b437;});}return _0xd2b437;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3687f7b..de9f2b9 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 _0x75b6=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x675b('0x1'));var rs=require(_0x675b('0x2'));var fs=require('fs');var Redis=require(_0x675b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x675b('0x4'));var logger=require(_0x675b('0x5'))(_0x675b('0x6'));var config=require('../../config/environment');var jayson=require(_0x675b('0x7'));var client=jayson['client'][_0x675b('0x8')]({'port':0x232a});config[_0x675b('0x9')]=_[_0x675b('0xa')](config['redis'],{'host':_0x675b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x675b('0x9')]));require(_0x675b('0xc'))[_0x675b('0xd')](socket);function respondWithRpcPromise(_0xa32225,_0x3aa1ff,_0x150cce){return new BPromise(function(_0x34afbc,_0xc9347b){return client[_0x675b('0xe')](_0xa32225,_0x150cce)[_0x675b('0xf')](function(_0x4b4e1b){logger[_0x675b('0x10')](_0x675b('0x11'),_0x3aa1ff,_0x675b('0x12'));logger[_0x675b('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3aa1ff,'request\x20sent',JSON['stringify'](_0x4b4e1b));if(_0x4b4e1b['error']){if(_0x4b4e1b['error'][_0x675b('0x14')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x3aa1ff,_0x4b4e1b[_0x675b('0x15')][_0x675b('0x16')]);return _0xc9347b(_0x4b4e1b[_0x675b('0x15')][_0x675b('0x16')]);}logger['error'](_0x675b('0x11'),_0x3aa1ff,_0x4b4e1b[_0x675b('0x15')][_0x675b('0x16')]);return _0x34afbc(_0x4b4e1b[_0x675b('0x15')][_0x675b('0x16')]);}else{logger[_0x675b('0x10')](_0x675b('0x11'),_0x3aa1ff,_0x675b('0x12'));_0x34afbc(_0x4b4e1b['result']['message']);}})[_0x675b('0x17')](function(_0x336d14){logger['error']('UserProfile,\x20%s,\x20%s',_0x3aa1ff,_0x336d14);_0xc9347b(_0x336d14);});});} \ No newline at end of file +var _0x1e82=['redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1e82,0x8b));var _0x21e8=function(_0x8fbabb,_0x434185){_0x8fbabb=_0x8fbabb-0x0;var _0x113f42=_0x1e82[_0x8fbabb];return _0x113f42;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require(_0x21e8('0x4'));var fs=require('fs');var Redis=require(_0x21e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x6'));var logger=require(_0x21e8('0x7'))('rpc');var config=require(_0x21e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});config[_0x21e8('0xb')]=_[_0x21e8('0xc')](config['redis'],{'host':_0x21e8('0xd'),'port':0x18eb});var socket=require(_0x21e8('0xe'))(new Redis(config[_0x21e8('0xb')]));require('./userProfile.socket')[_0x21e8('0xf')](socket);function respondWithRpcPromise(_0x20aae0,_0x2f4a82,_0x3fa1da){return new BPromise(function(_0x5c6d17,_0x4d561a){return client[_0x21e8('0x10')](_0x20aae0,_0x3fa1da)['then'](function(_0x131349){logger[_0x21e8('0x11')]('UserProfile,\x20%s,\x20%s',_0x2f4a82,_0x21e8('0x12'));logger['debug'](_0x21e8('0x13'),_0x2f4a82,_0x21e8('0x12'),JSON[_0x21e8('0x14')](_0x131349));if(_0x131349['error']){if(_0x131349[_0x21e8('0x15')]['code']===0x1f4){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')]['message']);return _0x4d561a(_0x131349['error'][_0x21e8('0x17')]);}logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);return _0x5c6d17(_0x131349[_0x21e8('0x15')][_0x21e8('0x17')]);}else{logger[_0x21e8('0x11')](_0x21e8('0x16'),_0x2f4a82,'request\x20sent');_0x5c6d17(_0x131349[_0x21e8('0x18')]['message']);}})['catch'](function(_0x32ec05){logger[_0x21e8('0x15')](_0x21e8('0x16'),_0x2f4a82,_0x32ec05);_0x4d561a(_0x32ec05);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2189e24..a749ec1 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 _0x255d=['userProfile:','./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x7905e4,_0x30a3b4){var _0x186749=function(_0x577f96){while(--_0x577f96){_0x7905e4['push'](_0x7905e4['shift']());}};_0x186749(++_0x30a3b4);}(_0x255d,0xf1));var _0xd255=function(_0x492fbd,_0x56f184){_0x492fbd=_0x492fbd-0x0;var _0x26c9e3=_0x255d[_0x492fbd];return _0x26c9e3;};'use strict';var UserProfileEvents=require(_0xd255('0x0'));var events=[_0xd255('0x1'),_0xd255('0x2'),_0xd255('0x3')];function createListener(_0xc76f42,_0x500816){return function(_0x54d289){_0x500816['emit'](_0xc76f42,_0x54d289);};}function removeListener(_0x1364e3,_0x5210b6){return function(){UserProfileEvents[_0xd255('0x4')](_0x1364e3,_0x5210b6);};}exports[_0xd255('0x5')]=function(_0x47bd88){for(var _0xb730da=0x0,_0x16c6d9=events[_0xd255('0x6')];_0xb730da<_0x16c6d9;_0xb730da++){var _0x56e8f5=events[_0xb730da];var _0x114a89=createListener(_0xd255('0x7')+_0x56e8f5,_0x47bd88);UserProfileEvents['on'](_0x56e8f5,_0x114a89);}}; \ No newline at end of file +var _0xfef9=['update','emit','removeListener','length','userProfile:','./userProfile.events','remove'];(function(_0x459b3e,_0x5a0c7a){var _0xaf15e4=function(_0x2efa52){while(--_0x2efa52){_0x459b3e['push'](_0x459b3e['shift']());}};_0xaf15e4(++_0x5a0c7a);}(_0xfef9,0x1b0));var _0x9fef=function(_0xbf1132,_0x176b34){_0xbf1132=_0xbf1132-0x0;var _0xe63ce4=_0xfef9[_0xbf1132];return _0xe63ce4;};'use strict';var UserProfileEvents=require(_0x9fef('0x0'));var events=['save',_0x9fef('0x1'),_0x9fef('0x2')];function createListener(_0x12f198,_0x2c411e){return function(_0x2febd3){_0x2c411e[_0x9fef('0x3')](_0x12f198,_0x2febd3);};}function removeListener(_0x5993d6,_0x1731ee){return function(){UserProfileEvents[_0x9fef('0x4')](_0x5993d6,_0x1731ee);};}exports['register']=function(_0x369bee){for(var _0x144786=0x0,_0x4715c8=events[_0x9fef('0x5')];_0x144786<_0x4715c8;_0x144786++){var _0xbed6bb=events[_0x144786];var _0x91c2f8=createListener(_0x9fef('0x6')+_0xbed6bb,_0x369bee);UserProfileEvents['on'](_0xbed6bb,_0x91c2f8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 14300f3..cd9aa9f 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 _0xb1ef=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','/describe','describe','/:id','show','put','update'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0xb1ef,0x146));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require('util');var path=require(_0xfb1e('0x1'));var timeout=require(_0xfb1e('0x2'));var express=require('express');var router=express[_0xfb1e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfb1e('0x4'));var interaction=require(_0xfb1e('0x5'));var config=require('../../config/environment');var controller=require(_0xfb1e('0x6'));router['get']('/',auth[_0xfb1e('0x7')](),controller['index']);router['get'](_0xfb1e('0x8'),auth[_0xfb1e('0x7')](),controller[_0xfb1e('0x9')]);router['get'](_0xfb1e('0xa'),auth[_0xfb1e('0x7')](),controller[_0xfb1e('0xb')]);router['post']('/',auth[_0xfb1e('0x7')](),controller['create']);router[_0xfb1e('0xc')](_0xfb1e('0xa'),auth['isAuthenticated'](),controller[_0xfb1e('0xd')]);router[_0xfb1e('0xe')](_0xfb1e('0xa'),auth[_0xfb1e('0x7')](),controller[_0xfb1e('0xf')]);module[_0xfb1e('0x10')]=router; \ No newline at end of file +var _0x0cbf=['path','express','Router','fs-extra','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','/:id','show','post','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x0cbf,0xbc));var _0xf0cb=function(_0x4adba0,_0x1f8072){_0x4adba0=_0x4adba0-0x0;var _0x14e682=_0x0cbf[_0x4adba0];return _0x14e682;};'use strict';var multer=require(_0xf0cb('0x0'));var util=require(_0xf0cb('0x1'));var path=require(_0xf0cb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0cb('0x3'));var router=express[_0xf0cb('0x4')]();var fs_extra=require(_0xf0cb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0cb('0x6'));var config=require('../../config/environment');var controller=require(_0xf0cb('0x7'));router[_0xf0cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xf0cb('0x9')]);router[_0xf0cb('0x8')](_0xf0cb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xf0cb('0x8')](_0xf0cb('0xb'),auth['isAuthenticated'](),controller[_0xf0cb('0xc')]);router[_0xf0cb('0xd')]('/',auth[_0xf0cb('0xe')](),controller['create']);router['put'](_0xf0cb('0xb'),auth['isAuthenticated'](),controller[_0xf0cb('0xf')]);router[_0xf0cb('0x10')](_0xf0cb('0xb'),auth['isAuthenticated'](),controller[_0xf0cb('0x11')]);module[_0xf0cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 578d137..3635a9a 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 _0xff01=['INTEGER','STRING'];(function(_0x3ab6d8,_0x41c836){var _0x41fe5a=function(_0x3db37f){while(--_0x3db37f){_0x3ab6d8['push'](_0x3ab6d8['shift']());}};_0x41fe5a(++_0x41c836);}(_0xff01,0x10b));var _0x1ff0=function(_0x1eb4d9,_0x53ffda){_0x1eb4d9=_0x1eb4d9-0x0;var _0x29324f=_0xff01[_0x1eb4d9];return _0x29324f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ff0('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1ff0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1ff0('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xe715=['sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe715,0x148));var _0x5e71=function(_0xb0e106,_0x2f7a35){_0xb0e106=_0xb0e106-0x0;var _0x26d51d=_0xe715[_0xb0e106];return _0x26d51d;};'use strict';var Sequelize=require(_0x5e71('0x0'));module[_0x5e71('0x1')]={'name':{'type':Sequelize[_0x5e71('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5e71('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5e71('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a1cf509..3a0a132 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 _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x138bc5,_0xd62a0b){var _0x798269=function(_0x35ea47){while(--_0x35ea47){_0x138bc5['push'](_0x138bc5['shift']());}};_0x798269(++_0xd62a0b);}(_0x524e,0x15e));var _0xe524=function(_0x263df1,_0x1d80c3){_0x263df1=_0x263df1-0x0;var _0x1e6bc0=_0x524e[_0x263df1];return _0x1e6bc0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['UserProfileResource'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['UserProfileResource'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['UserProfileResource'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file +var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x37cba5,_0x1bf325){var _0x30366b=function(_0x5a70b4){while(--_0x5a70b4){_0x37cba5['push'](_0x37cba5['shift']());}};_0x30366b(++_0x1bf325);}(_0xb016,0x159));var _0x6b01=function(_0x163532,_0x18a82c){_0x163532=_0x163532-0x0;var _0x227723=_0xb016[_0x163532];return _0x227723;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e74e943..4bfd4e9 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 _0x94df=['compositeIndex','sectionId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','define','UserProfileResource','user_profile_has_resources'];(function(_0x11d49b,_0xba47b7){var _0x1d2089=function(_0x55b81e){while(--_0x55b81e){_0x11d49b['push'](_0x11d49b['shift']());}};_0x1d2089(++_0xba47b7);}(_0x94df,0x9e));var _0xf94d=function(_0x2f2c4c,_0x19de19){_0x2f2c4c=_0x2f2c4c-0x0;var _0x278d53=_0x94df[_0x2f2c4c];return _0x278d53;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var logger=require(_0xf94d('0x2'))('api');var moment=require(_0xf94d('0x3'));var BPromise=require(_0xf94d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf94d('0x5'));var rimraf=require(_0xf94d('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5307be,_0x55c3da){return _0x5307be[_0xf94d('0x7')](_0xf94d('0x8'),attributes,{'tableName':_0xf94d('0x9'),'paranoid':![],'indexes':[{'name':_0xf94d('0xa'),'fields':['resourceId',_0xf94d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11e9=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x345c3e,_0xf7284e){var _0x1dc2b8=function(_0x44196d){while(--_0x44196d){_0x345c3e['push'](_0x345c3e['shift']());}};_0x1dc2b8(++_0xf7284e);}(_0x11e9,0x1bb));var _0x911e=function(_0x2a42e3,_0x1ecdec){_0x2a42e3=_0x2a42e3-0x0;var _0x5564b=_0x11e9[_0x2a42e3];return _0x5564b;};'use strict';var _=require(_0x911e('0x0'));var util=require('util');var logger=require(_0x911e('0x1'))(_0x911e('0x2'));var moment=require(_0x911e('0x3'));var BPromise=require(_0x911e('0x4'));var rp=require(_0x911e('0x5'));var fs=require('fs');var path=require(_0x911e('0x6'));var rimraf=require(_0x911e('0x7'));var config=require(_0x911e('0x8'));var attributes=require(_0x911e('0x9'));module['exports']=function(_0x534793,_0x29bf98){return _0x534793[_0x911e('0xa')](_0x911e('0xb'),attributes,{'tableName':_0x911e('0xc'),'paranoid':![],'indexes':[{'name':_0x911e('0xd'),'fields':[_0x911e('0xe'),_0x911e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8d54538..771b13c 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 _0x8000=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result'];(function(_0x7598c2,_0x3e0d4a){var _0x72ad3d=function(_0x4a5a8c){while(--_0x4a5a8c){_0x7598c2['push'](_0x7598c2['shift']());}};_0x72ad3d(++_0x3e0d4a);}(_0x8000,0x109));var _0x0800=function(_0x5bf23c,_0x1ef63a){_0x5bf23c=_0x5bf23c-0x0;var _0x4ecaf1=_0x8000[_0x5bf23c];return _0x4ecaf1;};'use strict';var _=require(_0x0800('0x0'));var util=require(_0x0800('0x1'));var moment=require(_0x0800('0x2'));var BPromise=require(_0x0800('0x3'));var rs=require(_0x0800('0x4'));var fs=require('fs');var Redis=require(_0x0800('0x5'));var db=require(_0x0800('0x6'))['db'];var utils=require(_0x0800('0x7'));var logger=require(_0x0800('0x8'))(_0x0800('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0800('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fcbf6,_0x32e0c4,_0x5d8b00){return new BPromise(function(_0x145d6c,_0x57143d){return client['request'](_0x2fcbf6,_0x5d8b00)['then'](function(_0x534ccf){logger[_0x0800('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x32e0c4,_0x0800('0xc'));logger[_0x0800('0xd')](_0x0800('0xe'),_0x32e0c4,'request\x20sent',JSON[_0x0800('0xf')](_0x534ccf));if(_0x534ccf[_0x0800('0x10')]){if(_0x534ccf[_0x0800('0x10')][_0x0800('0x11')]===0x1f4){logger[_0x0800('0x10')](_0x0800('0x12'),_0x32e0c4,_0x534ccf['error'][_0x0800('0x13')]);return _0x57143d(_0x534ccf['error'][_0x0800('0x13')]);}logger[_0x0800('0x10')](_0x0800('0x12'),_0x32e0c4,_0x534ccf[_0x0800('0x10')]['message']);return _0x145d6c(_0x534ccf['error'][_0x0800('0x13')]);}else{logger[_0x0800('0xb')](_0x0800('0x12'),_0x32e0c4,'request\x20sent');_0x145d6c(_0x534ccf[_0x0800('0x14')][_0x0800('0x13')]);}})[_0x0800('0x15')](function(_0x271f1c){logger['error'](_0x0800('0x12'),_0x32e0c4,_0x271f1c);_0x57143d(_0x271f1c);});});} \ No newline at end of file +var _0x66e2=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1ef67e,_0x1cf4e1){var _0x172be7=function(_0x4d3c37){while(--_0x4d3c37){_0x1ef67e['push'](_0x1ef67e['shift']());}};_0x172be7(++_0x1cf4e1);}(_0x66e2,0x77));var _0x266e=function(_0x1e0f42,_0x2567e5){_0x1e0f42=_0x1e0f42-0x0;var _0x4e9c54=_0x66e2[_0x1e0f42];return _0x4e9c54;};'use strict';var _=require('lodash');var util=require(_0x266e('0x0'));var moment=require(_0x266e('0x1'));var BPromise=require(_0x266e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x266e('0x3'));var db=require(_0x266e('0x4'))['db'];var utils=require(_0x266e('0x5'));var logger=require(_0x266e('0x6'))(_0x266e('0x7'));var config=require(_0x266e('0x8'));var jayson=require(_0x266e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5be0c4,_0x2eba70,_0x50c5cb){return new BPromise(function(_0x288bdd,_0x34f038){return client[_0x266e('0xa')](_0x5be0c4,_0x50c5cb)[_0x266e('0xb')](function(_0x457e6e){logger[_0x266e('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2eba70,_0x266e('0xd'));logger['debug'](_0x266e('0xe'),_0x2eba70,'request\x20sent',JSON[_0x266e('0xf')](_0x457e6e));if(_0x457e6e[_0x266e('0x10')]){if(_0x457e6e[_0x266e('0x10')][_0x266e('0x11')]===0x1f4){logger[_0x266e('0x10')](_0x266e('0x12'),_0x2eba70,_0x457e6e[_0x266e('0x10')][_0x266e('0x13')]);return _0x34f038(_0x457e6e[_0x266e('0x10')][_0x266e('0x13')]);}logger['error'](_0x266e('0x12'),_0x2eba70,_0x457e6e[_0x266e('0x10')][_0x266e('0x13')]);return _0x288bdd(_0x457e6e['error'][_0x266e('0x13')]);}else{logger[_0x266e('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2eba70,_0x266e('0xd'));_0x288bdd(_0x457e6e[_0x266e('0x14')][_0x266e('0x13')]);}})[_0x266e('0x15')](function(_0xc1aaf0){logger[_0x266e('0x10')](_0x266e('0x12'),_0x2eba70,_0xc1aaf0);_0x34f038(_0xc1aaf0);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3973552..a1e525d 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 _0x6fbf=['./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d3e9a,_0x3c8859){var _0x3df488=function(_0x2b6fb6){while(--_0x2b6fb6){_0x4d3e9a['push'](_0x4d3e9a['shift']());}};_0x3df488(++_0x3c8859);}(_0x6fbf,0x98));var _0xf6fb=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x6fbf[_0x53f608];return _0x495b7d;};'use strict';var multer=require(_0xf6fb('0x0'));var util=require('util');var path=require(_0xf6fb('0x1'));var timeout=require(_0xf6fb('0x2'));var express=require(_0xf6fb('0x3'));var router=express[_0xf6fb('0x4')]();var fs_extra=require(_0xf6fb('0x5'));var auth=require(_0xf6fb('0x6'));var interaction=require(_0xf6fb('0x7'));var config=require(_0xf6fb('0x8'));var controller=require(_0xf6fb('0x9'));router[_0xf6fb('0xa')]('/',auth[_0xf6fb('0xb')](),controller[_0xf6fb('0xc')]);router['get'](_0xf6fb('0xd'),auth[_0xf6fb('0xb')](),controller[_0xf6fb('0xe')]);router[_0xf6fb('0xa')](_0xf6fb('0xf'),auth[_0xf6fb('0xb')](),controller[_0xf6fb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6fb('0x11')]);router[_0xf6fb('0x12')](_0xf6fb('0xf'),auth[_0xf6fb('0xb')](),controller[_0xf6fb('0x13')]);router[_0xf6fb('0x14')](_0xf6fb('0xf'),auth['isAuthenticated'](),controller[_0xf6fb('0x15')]);module[_0xf6fb('0x16')]=router; \ No newline at end of file +var _0xe791=['create','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x2e9bb0,_0x4a3c05){var _0x288198=function(_0x5c938e){while(--_0x5c938e){_0x2e9bb0['push'](_0x2e9bb0['shift']());}};_0x288198(++_0x4a3c05);}(_0xe791,0x1e0));var _0x1e79=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xe791[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0x1e79('0x0'));var util=require(_0x1e79('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e79('0x2')]();var fs_extra=require(_0x1e79('0x3'));var auth=require(_0x1e79('0x4'));var interaction=require(_0x1e79('0x5'));var config=require('../../config/environment');var controller=require(_0x1e79('0x6'));router[_0x1e79('0x7')]('/',auth['isAuthenticated'](),controller[_0x1e79('0x8')]);router[_0x1e79('0x7')](_0x1e79('0x9'),auth[_0x1e79('0xa')](),controller['describe']);router[_0x1e79('0x7')](_0x1e79('0xb'),auth[_0x1e79('0xa')](),controller[_0x1e79('0xc')]);router[_0x1e79('0xd')]('/',auth[_0x1e79('0xa')](),controller[_0x1e79('0xe')]);router['put'](_0x1e79('0xb'),auth['isAuthenticated'](),controller[_0x1e79('0xf')]);router[_0x1e79('0x10')](_0x1e79('0xb'),auth['isAuthenticated'](),controller[_0x1e79('0x11')]);module[_0x1e79('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0580bb0..70e4bbc 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 _0x2032=['split','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3eacef,_0x2a7aac){var _0x2c6645=function(_0x5960cb){while(--_0x5960cb){_0x3eacef['push'](_0x3eacef['shift']());}};_0x2c6645(++_0x2a7aac);}(_0x2032,0xd9));var _0x2203=function(_0x3cb79d,_0x30dabd){_0x3cb79d=_0x3cb79d-0x0;var _0x29b0ac=_0x2032[_0x3cb79d];return _0x29b0ac;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2203('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2203('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x46c49a){this[_0x2203('0x3')](_0x2203('0x4'),_0x46c49a?_0x46c49a[_0x2203('0x5')](''):[]);},'get':function(){return this[_0x2203('0x6')](_0x2203('0x4'))?this[_0x2203('0x6')](_0x2203('0x4'))[_0x2203('0x7')](''):[];}}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x5a1c5f,_0x776c27){var _0x1e5374=function(_0x5d8a1a){while(--_0x5d8a1a){_0x5a1c5f['push'](_0x5a1c5f['shift']());}};_0x1e5374(++_0x776c27);}(_0x351d,0x90));var _0xd351=function(_0x30d8a7,_0x30a6c3){_0x30d8a7=_0x30d8a7-0x0;var _0x5aff06=_0x351d[_0x30d8a7];return _0x5aff06;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd351('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd351('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd351('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41d16d){this[_0xd351('0x4')]('crudPermissions',_0x41d16d?_0x41d16d[_0xd351('0x5')](''):[]);},'get':function(){return this[_0xd351('0x6')](_0xd351('0x7'))?this['getDataValue'](_0xd351('0x7'))[_0xd351('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 154060b..e9e83ae 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 _0x1f51=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x1f51,0xdd));var _0x11f5=function(_0x151b2c,_0x44d3b7){_0x151b2c=_0x151b2c-0x0;var _0x2e3b10=_0x1f51[_0x151b2c];return _0x2e3b10;};'use strict';var emlformat=require(_0x11f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11f5('0x1'));var jsonpatch=require(_0x11f5('0x2'));var rp=require(_0x11f5('0x3'));var moment=require('moment');var BPromise=require(_0x11f5('0x4'));var Mustache=require(_0x11f5('0x5'));var util=require('util');var path=require(_0x11f5('0x6'));var sox=require(_0x11f5('0x7'));var csv=require(_0x11f5('0x8'));var ejs=require(_0x11f5('0x9'));var fs=require('fs');var fs_extra=require(_0x11f5('0xa'));var _=require(_0x11f5('0xb'));var squel=require(_0x11f5('0xc'));var crypto=require(_0x11f5('0xd'));var jsforce=require(_0x11f5('0xe'));var deskjs=require(_0x11f5('0xf'));var toCsv=require(_0x11f5('0x8'));var querystring=require('querystring');var Papa=require(_0x11f5('0x10'));var Redis=require(_0x11f5('0x11'));var authService=require(_0x11f5('0x12'));var qs=require(_0x11f5('0x13'));var as=require(_0x11f5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11f5('0x15'));var utils=require(_0x11f5('0x16'));var config=require(_0x11f5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x11f5('0x18'))['db'];function respondWithStatusCode(_0x159b35,_0x2ee9cc){_0x2ee9cc=_0x2ee9cc||0xcc;return function(_0x2c5a72){if(_0x2c5a72){return _0x159b35[_0x11f5('0x19')](_0x2ee9cc);}return _0x159b35[_0x11f5('0x1a')](_0x2ee9cc)[_0x11f5('0x1b')]();};}function respondWithResult(_0x41f132,_0x1c0bc7){_0x1c0bc7=_0x1c0bc7||0xc8;return function(_0x5dafd0){if(_0x5dafd0){return _0x41f132[_0x11f5('0x1a')](_0x1c0bc7)[_0x11f5('0x1c')](_0x5dafd0);}};}function respondWithFilteredResult(_0x1cc769,_0x23b8d4){return function(_0x3ea91c){if(_0x3ea91c){var _0x5ca2f3=typeof _0x23b8d4[_0x11f5('0x1d')]===_0x11f5('0x1e')&&typeof _0x23b8d4['limit']==='undefined';var _0x555fc6=_0x3ea91c['count'];var _0x7aa40e=_0x5ca2f3?0x0:_0x23b8d4[_0x11f5('0x1d')];var _0x4629ff=_0x5ca2f3?_0x3ea91c[_0x11f5('0x1f')]:_0x23b8d4[_0x11f5('0x1d')]+_0x23b8d4['limit'];var _0x52249e;if(_0x4629ff>=_0x555fc6){_0x4629ff=_0x555fc6;_0x52249e=0xc8;}else{_0x52249e=0xce;}_0x1cc769['status'](_0x52249e);return _0x1cc769[_0x11f5('0x20')](_0x11f5('0x21'),_0x7aa40e+'-'+_0x4629ff+'/'+_0x555fc6)[_0x11f5('0x1c')](_0x3ea91c);}return null;};}function patchUpdates(_0x1abfa6){return function(_0x4dec51){try{jsonpatch[_0x11f5('0x22')](_0x4dec51,_0x1abfa6,!![]);}catch(_0x2b1a29){return BPromise[_0x11f5('0x23')](_0x2b1a29);}return _0x4dec51[_0x11f5('0x24')]();};}function saveUpdates(_0x403917,_0x522cd9){return function(_0x4e3726){if(_0x4e3726){return _0x4e3726['update'](_0x403917)[_0x11f5('0x25')](function(_0x4ebfb2){return _0x4ebfb2;});}return null;};}function removeEntity(_0x536eb8,_0x4e9617){return function(_0x255e95){if(_0x255e95){return _0x255e95[_0x11f5('0x26')]()[_0x11f5('0x25')](function(){_0x536eb8['status'](0xcc)[_0x11f5('0x1b')]();});}};}function handleEntityNotFound(_0x3a03fd,_0x2ad1d7){return function(_0x12b337){if(!_0x12b337){_0x3a03fd['sendStatus'](0x194);}return _0x12b337;};}function handleError(_0x135359,_0x533ad7){_0x533ad7=_0x533ad7||0x1f4;return function(_0x463b75){logger[_0x11f5('0x27')](_0x463b75['stack']);if(_0x463b75[_0x11f5('0x28')]){delete _0x463b75['name'];}_0x135359['status'](_0x533ad7)[_0x11f5('0x29')](_0x463b75);};}exports[_0x11f5('0x2a')]=function(_0x2f6ca9,_0x2b9595){var _0x380c26={},_0x19beb3={},_0x45b113={'count':0x0,'rows':[]};var _0x512922=_['map'](db[_0x11f5('0x2b')][_0x11f5('0x2c')],function(_0x58497f){return{'name':_0x58497f[_0x11f5('0x2d')],'type':_0x58497f[_0x11f5('0x2e')][_0x11f5('0x2f')]};});_0x19beb3[_0x11f5('0x30')]=_[_0x11f5('0x31')](_0x512922,_0x11f5('0x28'));_0x19beb3[_0x11f5('0x32')]=_[_0x11f5('0x33')](_0x2f6ca9[_0x11f5('0x32')]);_0x19beb3[_0x11f5('0x34')]=_[_0x11f5('0x35')](_0x19beb3[_0x11f5('0x30')],_0x19beb3[_0x11f5('0x32')]);_0x380c26[_0x11f5('0x36')]=_[_0x11f5('0x35')](_0x19beb3[_0x11f5('0x30')],qs[_0x11f5('0x37')](_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x37')]));_0x380c26[_0x11f5('0x36')]=_0x380c26['attributes'][_0x11f5('0x38')]?_0x380c26[_0x11f5('0x36')]:_0x19beb3[_0x11f5('0x30')];if(!_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x39')](_0x11f5('0x3a'))){_0x380c26['limit']=qs[_0x11f5('0x3b')](_0x2f6ca9[_0x11f5('0x32')]['limit']);_0x380c26[_0x11f5('0x1d')]=qs[_0x11f5('0x1d')](_0x2f6ca9['query'][_0x11f5('0x1d')]);}_0x380c26[_0x11f5('0x3c')]=qs[_0x11f5('0x3d')](_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x3d')]);_0x380c26['where']=qs[_0x11f5('0x34')](_[_0x11f5('0x3e')](_0x2f6ca9[_0x11f5('0x32')],_0x19beb3['filters']),_0x512922);if(_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x3f')]){_0x380c26[_0x11f5('0x40')]=_[_0x11f5('0x41')](_0x380c26[_0x11f5('0x40')],{'$or':_[_0x11f5('0x31')](_0x512922,function(_0x2a461d){if(_0x2a461d['type']!=='VIRTUAL'){var _0x4afbea={};_0x4afbea[_0x2a461d[_0x11f5('0x28')]]={'$like':'%'+_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x3f')]+'%'};return _0x4afbea;}})});}_0x380c26=_['merge']({},_0x380c26,_0x2f6ca9[_0x11f5('0x42')]);var _0x147ae6={'where':_0x380c26['where']};return db[_0x11f5('0x2b')][_0x11f5('0x1f')](_0x147ae6)['then'](function(_0x53037a){_0x45b113[_0x11f5('0x1f')]=_0x53037a;if(_0x2f6ca9[_0x11f5('0x32')][_0x11f5('0x43')]){_0x380c26[_0x11f5('0x44')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x380c26);})['then'](function(_0x2086c9){_0x45b113[_0x11f5('0x45')]=_0x2086c9;return _0x45b113;})[_0x11f5('0x25')](respondWithFilteredResult(_0x2b9595,_0x380c26))[_0x11f5('0x46')](handleError(_0x2b9595,null));};exports[_0x11f5('0x47')]=function(_0x4b381e,_0x55f494){var _0x37f74f={'raw':![],'where':{'id':_0x4b381e[_0x11f5('0x48')]['id']}},_0x49b348={};_0x49b348[_0x11f5('0x30')]=_[_0x11f5('0x33')](db['UserProfileSection'][_0x11f5('0x2c')]);_0x49b348['query']=_[_0x11f5('0x33')](_0x4b381e[_0x11f5('0x32')]);_0x49b348['filters']=_['intersection'](_0x49b348[_0x11f5('0x30')],_0x49b348[_0x11f5('0x32')]);_0x37f74f[_0x11f5('0x36')]=_[_0x11f5('0x35')](_0x49b348['model'],qs[_0x11f5('0x37')](_0x4b381e['query'][_0x11f5('0x37')]));_0x37f74f[_0x11f5('0x36')]=_0x37f74f[_0x11f5('0x36')][_0x11f5('0x38')]?_0x37f74f[_0x11f5('0x36')]:_0x49b348['model'];if(_0x4b381e[_0x11f5('0x32')][_0x11f5('0x43')]){_0x37f74f[_0x11f5('0x44')]=[{'all':!![]}];}_0x37f74f=_[_0x11f5('0x41')]({},_0x37f74f,_0x4b381e[_0x11f5('0x42')]);return db[_0x11f5('0x2b')][_0x11f5('0x49')](_0x37f74f)[_0x11f5('0x25')](handleEntityNotFound(_0x55f494,null))['then'](respondWithResult(_0x55f494,null))[_0x11f5('0x46')](handleError(_0x55f494,null));};exports[_0x11f5('0x4a')]=function(_0x3df532,_0x2e55c3){return db[_0x11f5('0x2b')][_0x11f5('0x4a')](_0x3df532[_0x11f5('0x4b')],{})[_0x11f5('0x25')](respondWithResult(_0x2e55c3,0xc9))[_0x11f5('0x46')](handleError(_0x2e55c3,null));};exports[_0x11f5('0x4c')]=function(_0x297f36,_0x422982){if(_0x297f36[_0x11f5('0x4b')]['id']){delete _0x297f36[_0x11f5('0x4b')]['id'];}return db[_0x11f5('0x2b')][_0x11f5('0x49')]({'where':{'id':_0x297f36[_0x11f5('0x48')]['id']}})['then'](handleEntityNotFound(_0x422982,null))[_0x11f5('0x25')](saveUpdates(_0x297f36[_0x11f5('0x4b')],null))[_0x11f5('0x25')](respondWithResult(_0x422982,null))['catch'](handleError(_0x422982,null));};exports[_0x11f5('0x26')]=function(_0x1d89e7,_0x15bc76){return db[_0x11f5('0x2b')][_0x11f5('0x49')]({'where':{'id':_0x1d89e7[_0x11f5('0x48')]['id']}})[_0x11f5('0x25')](handleEntityNotFound(_0x15bc76,null))[_0x11f5('0x25')](removeEntity(_0x15bc76,null))['catch'](handleError(_0x15bc76,null));};exports[_0x11f5('0x4d')]=function(_0x44d0b0,_0x44bd3f){return db['UserProfileSection'][_0x11f5('0x4d')]()[_0x11f5('0x25')](respondWithResult(_0x44bd3f,null))[_0x11f5('0x46')](handleError(_0x44bd3f,null));}; \ No newline at end of file +var _0x512f=['query','keys','filters','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','model','intersection','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','save','update','then','end','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x512f,0x18a));var _0xf512=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x512f[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0xf512('0x0'));var rimraf=require(_0xf512('0x1'));var zipdir=require(_0xf512('0x2'));var jsonpatch=require(_0xf512('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf512('0x4'));var util=require(_0xf512('0x5'));var path=require(_0xf512('0x6'));var sox=require(_0xf512('0x7'));var csv=require(_0xf512('0x8'));var ejs=require(_0xf512('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf512('0xa'));var squel=require(_0xf512('0xb'));var crypto=require(_0xf512('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf512('0xd'));var toCsv=require(_0xf512('0x8'));var querystring=require(_0xf512('0xe'));var Papa=require('papaparse');var Redis=require(_0xf512('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf512('0x10'));var hardwareService=require(_0xf512('0x11'));var logger=require('../../config/logger')(_0xf512('0x12'));var utils=require(_0xf512('0x13'));var config=require(_0xf512('0x14'));var licenseUtil=require(_0xf512('0x15'));var db=require(_0xf512('0x16'))['db'];function respondWithStatusCode(_0x370faf,_0x25b085){_0x25b085=_0x25b085||0xcc;return function(_0x19f13e){if(_0x19f13e){return _0x370faf[_0xf512('0x17')](_0x25b085);}return _0x370faf[_0xf512('0x18')](_0x25b085)['end']();};}function respondWithResult(_0x35142c,_0x43e68e){_0x43e68e=_0x43e68e||0xc8;return function(_0x34a9d7){if(_0x34a9d7){return _0x35142c[_0xf512('0x18')](_0x43e68e)[_0xf512('0x19')](_0x34a9d7);}};}function respondWithFilteredResult(_0x43b635,_0x584977){return function(_0x4ffecb){if(_0x4ffecb){var _0x2d2f2c=typeof _0x584977['offset']===_0xf512('0x1a')&&typeof _0x584977[_0xf512('0x1b')]===_0xf512('0x1a');var _0x37c644=_0x4ffecb['count'];var _0x391e2d=_0x2d2f2c?0x0:_0x584977[_0xf512('0x1c')];var _0x2a0b53=_0x2d2f2c?_0x4ffecb['count']:_0x584977[_0xf512('0x1c')]+_0x584977[_0xf512('0x1b')];var _0x2cd6ed;if(_0x2a0b53>=_0x37c644){_0x2a0b53=_0x37c644;_0x2cd6ed=0xc8;}else{_0x2cd6ed=0xce;}_0x43b635[_0xf512('0x18')](_0x2cd6ed);return _0x43b635[_0xf512('0x1d')]('Content-Range',_0x391e2d+'-'+_0x2a0b53+'/'+_0x37c644)[_0xf512('0x19')](_0x4ffecb);}return null;};}function patchUpdates(_0x33098f){return function(_0x11a6ac){try{jsonpatch[_0xf512('0x1e')](_0x11a6ac,_0x33098f,!![]);}catch(_0x37ffaf){return BPromise['reject'](_0x37ffaf);}return _0x11a6ac[_0xf512('0x1f')]();};}function saveUpdates(_0x1e719d,_0x13c5e2){return function(_0x2d29c3){if(_0x2d29c3){return _0x2d29c3[_0xf512('0x20')](_0x1e719d)[_0xf512('0x21')](function(_0x19055b){return _0x19055b;});}return null;};}function removeEntity(_0x3ff37b,_0x1ea0a3){return function(_0x26ec81){if(_0x26ec81){return _0x26ec81['destroy']()[_0xf512('0x21')](function(){_0x3ff37b['status'](0xcc)[_0xf512('0x22')]();});}};}function handleEntityNotFound(_0x1ceb54,_0x70dae5){return function(_0x141d71){if(!_0x141d71){_0x1ceb54[_0xf512('0x17')](0x194);}return _0x141d71;};}function handleError(_0x41cd37,_0x48e401){_0x48e401=_0x48e401||0x1f4;return function(_0x1a4b67){logger['error'](_0x1a4b67[_0xf512('0x23')]);if(_0x1a4b67[_0xf512('0x24')]){delete _0x1a4b67[_0xf512('0x24')];}_0x41cd37[_0xf512('0x18')](_0x48e401)[_0xf512('0x25')](_0x1a4b67);};}exports[_0xf512('0x26')]=function(_0x2d4512,_0x2fa3be){var _0x2e3a4f={},_0x52db40={},_0x55cfdf={'count':0x0,'rows':[]};var _0x3ec26f=_[_0xf512('0x27')](db[_0xf512('0x28')][_0xf512('0x29')],function(_0x6bd37f){return{'name':_0x6bd37f[_0xf512('0x2a')],'type':_0x6bd37f[_0xf512('0x2b')]['key']};});_0x52db40['model']=_[_0xf512('0x27')](_0x3ec26f,_0xf512('0x24'));_0x52db40[_0xf512('0x2c')]=_[_0xf512('0x2d')](_0x2d4512[_0xf512('0x2c')]);_0x52db40[_0xf512('0x2e')]=_['intersection'](_0x52db40['model'],_0x52db40[_0xf512('0x2c')]);_0x2e3a4f[_0xf512('0x2f')]=_['intersection'](_0x52db40['model'],qs[_0xf512('0x30')](_0x2d4512[_0xf512('0x2c')][_0xf512('0x30')]));_0x2e3a4f[_0xf512('0x2f')]=_0x2e3a4f[_0xf512('0x2f')]['length']?_0x2e3a4f[_0xf512('0x2f')]:_0x52db40['model'];if(!_0x2d4512['query'][_0xf512('0x31')]('nolimit')){_0x2e3a4f[_0xf512('0x1b')]=qs['limit'](_0x2d4512[_0xf512('0x2c')][_0xf512('0x1b')]);_0x2e3a4f['offset']=qs[_0xf512('0x1c')](_0x2d4512['query'][_0xf512('0x1c')]);}_0x2e3a4f['order']=qs['sort'](_0x2d4512[_0xf512('0x2c')][_0xf512('0x32')]);_0x2e3a4f['where']=qs[_0xf512('0x2e')](_[_0xf512('0x33')](_0x2d4512[_0xf512('0x2c')],_0x52db40[_0xf512('0x2e')]),_0x3ec26f);if(_0x2d4512['query']['filter']){_0x2e3a4f[_0xf512('0x34')]=_[_0xf512('0x35')](_0x2e3a4f[_0xf512('0x34')],{'$or':_[_0xf512('0x27')](_0x3ec26f,function(_0x4aeb44){if(_0x4aeb44[_0xf512('0x2b')]!==_0xf512('0x36')){var _0x7703e7={};_0x7703e7[_0x4aeb44[_0xf512('0x24')]]={'$like':'%'+_0x2d4512[_0xf512('0x2c')][_0xf512('0x37')]+'%'};return _0x7703e7;}})});}_0x2e3a4f=_[_0xf512('0x35')]({},_0x2e3a4f,_0x2d4512[_0xf512('0x38')]);var _0x36dcd4={'where':_0x2e3a4f[_0xf512('0x34')]};return db[_0xf512('0x28')][_0xf512('0x39')](_0x36dcd4)[_0xf512('0x21')](function(_0x15fc5d){_0x55cfdf['count']=_0x15fc5d;if(_0x2d4512[_0xf512('0x2c')][_0xf512('0x3a')]){_0x2e3a4f[_0xf512('0x3b')]=[{'all':!![]}];}return db[_0xf512('0x28')][_0xf512('0x3c')](_0x2e3a4f);})[_0xf512('0x21')](function(_0x2d7e9b){_0x55cfdf[_0xf512('0x3d')]=_0x2d7e9b;return _0x55cfdf;})[_0xf512('0x21')](respondWithFilteredResult(_0x2fa3be,_0x2e3a4f))[_0xf512('0x3e')](handleError(_0x2fa3be,null));};exports[_0xf512('0x3f')]=function(_0x2314a8,_0x3c0a7a){var _0x524571={'raw':![],'where':{'id':_0x2314a8[_0xf512('0x40')]['id']}},_0x257149={};_0x257149[_0xf512('0x41')]=_[_0xf512('0x2d')](db[_0xf512('0x28')][_0xf512('0x29')]);_0x257149[_0xf512('0x2c')]=_['keys'](_0x2314a8[_0xf512('0x2c')]);_0x257149[_0xf512('0x2e')]=_[_0xf512('0x42')](_0x257149[_0xf512('0x41')],_0x257149[_0xf512('0x2c')]);_0x524571[_0xf512('0x2f')]=_[_0xf512('0x42')](_0x257149['model'],qs[_0xf512('0x30')](_0x2314a8[_0xf512('0x2c')][_0xf512('0x30')]));_0x524571[_0xf512('0x2f')]=_0x524571['attributes'][_0xf512('0x43')]?_0x524571[_0xf512('0x2f')]:_0x257149[_0xf512('0x41')];if(_0x2314a8['query'][_0xf512('0x3a')]){_0x524571[_0xf512('0x3b')]=[{'all':!![]}];}_0x524571=_[_0xf512('0x35')]({},_0x524571,_0x2314a8[_0xf512('0x38')]);return db[_0xf512('0x28')]['find'](_0x524571)[_0xf512('0x21')](handleEntityNotFound(_0x3c0a7a,null))['then'](respondWithResult(_0x3c0a7a,null))[_0xf512('0x3e')](handleError(_0x3c0a7a,null));};exports[_0xf512('0x44')]=function(_0x1ce9e4,_0x4e1b45){return db['UserProfileSection'][_0xf512('0x44')](_0x1ce9e4['body'],{})[_0xf512('0x21')](respondWithResult(_0x4e1b45,0xc9))[_0xf512('0x3e')](handleError(_0x4e1b45,null));};exports['update']=function(_0x2933b2,_0x57b690){if(_0x2933b2[_0xf512('0x45')]['id']){delete _0x2933b2[_0xf512('0x45')]['id'];}return db[_0xf512('0x28')][_0xf512('0x46')]({'where':{'id':_0x2933b2['params']['id']}})['then'](handleEntityNotFound(_0x57b690,null))[_0xf512('0x21')](saveUpdates(_0x2933b2['body'],null))['then'](respondWithResult(_0x57b690,null))[_0xf512('0x3e')](handleError(_0x57b690,null));};exports[_0xf512('0x47')]=function(_0x59d219,_0x42f105){return db[_0xf512('0x28')][_0xf512('0x46')]({'where':{'id':_0x59d219[_0xf512('0x40')]['id']}})[_0xf512('0x21')](handleEntityNotFound(_0x42f105,null))[_0xf512('0x21')](removeEntity(_0x42f105,null))['catch'](handleError(_0x42f105,null));};exports[_0xf512('0x48')]=function(_0x3d360a,_0x5e068c){return db[_0xf512('0x28')][_0xf512('0x48')]()[_0xf512('0x21')](respondWithResult(_0x5e068c,null))[_0xf512('0x3e')](handleError(_0x5e068c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 071456a..33b7ce9 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 _0xd5ac=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','userProfileId'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xd5ac,0x114));var _0xcd5a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd5ac[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xcd5a('0x0'));var util=require(_0xcd5a('0x1'));var logger=require(_0xcd5a('0x2'))('api');var moment=require(_0xcd5a('0x3'));var BPromise=require(_0xcd5a('0x4'));var rp=require(_0xcd5a('0x5'));var fs=require('fs');var path=require(_0xcd5a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd5a('0x7'));module['exports']=function(_0x1ead61,_0x232f0c){return _0x1ead61[_0xcd5a('0x8')](_0xcd5a('0x9'),attributes,{'tableName':_0xcd5a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xcd5a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8dd=['UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','api','moment','bluebird','path','exports','define'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xa8dd,0x1dd));var _0xda8d=function(_0x482914,_0x3fe08e){_0x482914=_0x482914-0x0;var _0x151f6a=_0xa8dd[_0x482914];return _0x151f6a;};'use strict';var _=require(_0xda8d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda8d('0x1'));var moment=require(_0xda8d('0x2'));var BPromise=require(_0xda8d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda8d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xda8d('0x5')]=function(_0x4084ed,_0x358ad4){return _0x4084ed[_0xda8d('0x6')](_0xda8d('0x7'),attributes,{'tableName':_0xda8d('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xda8d('0x9'),_0xda8d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 053818d..d093c20 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 _0x7cf1=['../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x7bb66a,_0x1747a5){var _0x19c081=function(_0x5082ff){while(--_0x5082ff){_0x7bb66a['push'](_0x7bb66a['shift']());}};_0x19c081(++_0x1747a5);}(_0x7cf1,0x88));var _0x17cf=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x7cf1[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x17cf('0x0'));var util=require(_0x17cf('0x1'));var moment=require(_0x17cf('0x2'));var BPromise=require(_0x17cf('0x3'));var rs=require(_0x17cf('0x4'));var fs=require('fs');var Redis=require(_0x17cf('0x5'));var db=require(_0x17cf('0x6'))['db'];var utils=require(_0x17cf('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x17cf('0x8'));var jayson=require(_0x17cf('0x9'));var client=jayson[_0x17cf('0xa')][_0x17cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x439171,_0x5f1316,_0x1ba8f6){return new BPromise(function(_0x46ceb0,_0x2dd565){return client[_0x17cf('0xc')](_0x439171,_0x1ba8f6)[_0x17cf('0xd')](function(_0x1bc3a0){logger[_0x17cf('0xe')](_0x17cf('0xf'),_0x5f1316,_0x17cf('0x10'));logger[_0x17cf('0x11')](_0x17cf('0x12'),_0x5f1316,'request\x20sent',JSON[_0x17cf('0x13')](_0x1bc3a0));if(_0x1bc3a0['error']){if(_0x1bc3a0[_0x17cf('0x14')]['code']===0x1f4){logger[_0x17cf('0x14')](_0x17cf('0xf'),_0x5f1316,_0x1bc3a0[_0x17cf('0x14')]['message']);return _0x2dd565(_0x1bc3a0[_0x17cf('0x14')][_0x17cf('0x15')]);}logger[_0x17cf('0x14')](_0x17cf('0xf'),_0x5f1316,_0x1bc3a0[_0x17cf('0x14')]['message']);return _0x46ceb0(_0x1bc3a0[_0x17cf('0x14')][_0x17cf('0x15')]);}else{logger[_0x17cf('0xe')](_0x17cf('0xf'),_0x5f1316,_0x17cf('0x10'));_0x46ceb0(_0x1bc3a0[_0x17cf('0x16')][_0x17cf('0x15')]);}})[_0x17cf('0x17')](function(_0x4143b8){logger[_0x17cf('0x14')](_0x17cf('0xf'),_0x5f1316,_0x4143b8);_0x2dd565(_0x4143b8);});});} \ No newline at end of file +var _0x1446=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c5994,_0x58f04){var _0x51ec2e=function(_0x7a8f14){while(--_0x7a8f14){_0x5c5994['push'](_0x5c5994['shift']());}};_0x51ec2e(++_0x58f04);}(_0x1446,0x11b));var _0x6144=function(_0x44323a,_0x1ef158){_0x44323a=_0x44323a-0x0;var _0x7f28c2=_0x1446[_0x44323a];return _0x7f28c2;};'use strict';var _=require(_0x6144('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6144('0x1'));var rs=require(_0x6144('0x2'));var fs=require('fs');var Redis=require(_0x6144('0x3'));var db=require(_0x6144('0x4'))['db'];var utils=require(_0x6144('0x5'));var logger=require(_0x6144('0x6'))(_0x6144('0x7'));var config=require(_0x6144('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6144('0x9')][_0x6144('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4296d6,_0x55fae6,_0x487a26){return new BPromise(function(_0x5109ad,_0x3327a6){return client[_0x6144('0xb')](_0x4296d6,_0x487a26)[_0x6144('0xc')](function(_0x4f6b02){logger['info'](_0x6144('0xd'),_0x55fae6,_0x6144('0xe'));logger[_0x6144('0xf')](_0x6144('0x10'),_0x55fae6,_0x6144('0xe'),JSON[_0x6144('0x11')](_0x4f6b02));if(_0x4f6b02[_0x6144('0x12')]){if(_0x4f6b02[_0x6144('0x12')]['code']===0x1f4){logger['error'](_0x6144('0xd'),_0x55fae6,_0x4f6b02[_0x6144('0x12')]['message']);return _0x3327a6(_0x4f6b02[_0x6144('0x12')]['message']);}logger[_0x6144('0x12')](_0x6144('0xd'),_0x55fae6,_0x4f6b02[_0x6144('0x12')][_0x6144('0x13')]);return _0x5109ad(_0x4f6b02[_0x6144('0x12')][_0x6144('0x13')]);}else{logger[_0x6144('0x14')](_0x6144('0xd'),_0x55fae6,_0x6144('0xe'));_0x5109ad(_0x4f6b02[_0x6144('0x15')]['message']);}})[_0x6144('0x16')](function(_0x168b2c){logger[_0x6144('0x12')](_0x6144('0xd'),_0x55fae6,_0x168b2c);_0x3327a6(_0x168b2c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 422c33e..f3c15fc 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(_0x18474f,_0x51e0f9){var _0xab5297=function(_0x4b2327){while(--_0x4b2327){_0x18474f['push'](_0x18474f['shift']());}};_0xab5297(++_0x51e0f9);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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(_0x8901ce,_0x5e0072){var _0x402ce1=function(_0x3d837a){while(--_0x3d837a){_0x8901ce['push'](_0x8901ce['shift']());}};_0x402ce1(++_0x5e0072);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb91[_0x111e94];return _0x3de107;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8e3ac84..a739486 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 _0xd06e=['INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd06e,0x16b));var _0xed06=function(_0x4567b1,_0x320cb8){_0x4567b1=_0x4567b1-0x0;var _0x42af3b=_0xd06e[_0x4567b1];return _0x42af3b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xed06('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5cae=['sequelize','exports','INTEGER'];(function(_0x45e259,_0x63464e){var _0x4c6e2b=function(_0x15fa66){while(--_0x15fa66){_0x45e259['push'](_0x45e259['shift']());}};_0x4c6e2b(++_0x63464e);}(_0x5cae,0xb1));var _0xe5ca=function(_0x1d7fab,_0x3dfa49){_0x1d7fab=_0x1d7fab-0x0;var _0x1d27f0=_0x5cae[_0x1d7fab];return _0x1d27f0;};'use strict';var Sequelize=require(_0xe5ca('0x0'));module[_0xe5ca('0x1')]={'penalty':{'type':Sequelize[_0xe5ca('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 b3d7249..f743ca1 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x58de71,_0x41661c){var _0x335a2a=function(_0x2dcda4){while(--_0x2dcda4){_0x58de71['push'](_0x58de71['shift']());}};_0x335a2a(++_0x41661c);}(_0xfcf0,0x138));var _0x0fcf=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0xfcf0[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee2c=['rimraf','../../config/environment','exports','define','UserSmsQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x459a8d,_0x2d3379){var _0x1af28d=function(_0x170b81){while(--_0x170b81){_0x459a8d['push'](_0x459a8d['shift']());}};_0x1af28d(++_0x2d3379);}(_0xee2c,0x1c7));var _0xcee2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xee2c[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xcee2('0x0'));var util=require('util');var logger=require(_0xcee2('0x1'))(_0xcee2('0x2'));var moment=require(_0xcee2('0x3'));var BPromise=require(_0xcee2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcee2('0x5'));var config=require(_0xcee2('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xcee2('0x7')]=function(_0x409944,_0x12fa86){return _0x409944[_0xcee2('0x8')](_0xcee2('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f8e6102..ae23d1e 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 _0xdb06=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0xdb06,0x1af));var _0x6db0=function(_0x14db76,_0xec1b0f){_0x14db76=_0x14db76-0x0;var _0x3c3d0c=_0xdb06[_0x14db76];return _0x3c3d0c;};'use strict';var _=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var moment=require(_0x6db0('0x2'));var BPromise=require(_0x6db0('0x3'));var rs=require(_0x6db0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6db0('0x5'))['db'];var utils=require(_0x6db0('0x6'));var logger=require('../../config/logger')(_0x6db0('0x7'));var config=require(_0x6db0('0x8'));var jayson=require(_0x6db0('0x9'));var client=jayson[_0x6db0('0xa')][_0x6db0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x354ac4,_0x212e74,_0xf32875){return new BPromise(function(_0x4caa08,_0x246d83){return client[_0x6db0('0xc')](_0x354ac4,_0xf32875)[_0x6db0('0xd')](function(_0x3e8757){logger[_0x6db0('0xe')](_0x6db0('0xf'),_0x212e74,_0x6db0('0x10'));logger[_0x6db0('0x11')](_0x6db0('0x12'),_0x212e74,'request\x20sent',JSON[_0x6db0('0x13')](_0x3e8757));if(_0x3e8757[_0x6db0('0x14')]){if(_0x3e8757['error'][_0x6db0('0x15')]===0x1f4){logger[_0x6db0('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x212e74,_0x3e8757[_0x6db0('0x14')][_0x6db0('0x16')]);return _0x246d83(_0x3e8757[_0x6db0('0x14')][_0x6db0('0x16')]);}logger['error'](_0x6db0('0xf'),_0x212e74,_0x3e8757[_0x6db0('0x14')]['message']);return _0x4caa08(_0x3e8757[_0x6db0('0x14')][_0x6db0('0x16')]);}else{logger[_0x6db0('0xe')](_0x6db0('0xf'),_0x212e74,_0x6db0('0x10'));_0x4caa08(_0x3e8757['result']['message']);}})[_0x6db0('0x17')](function(_0x5a4f24){logger[_0x6db0('0x14')](_0x6db0('0xf'),_0x212e74,_0x5a4f24);_0x246d83(_0x5a4f24);});});} \ No newline at end of file +var _0xb129=['../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x144c31,_0x4c3e16){var _0x4ba4e0=function(_0x2bca2e){while(--_0x2bca2e){_0x144c31['push'](_0x144c31['shift']());}};_0x4ba4e0(++_0x4c3e16);}(_0xb129,0x1c3));var _0x9b12=function(_0x50bb2b,_0x54f913){_0x50bb2b=_0x50bb2b-0x0;var _0x4e57e8=_0xb129[_0x50bb2b];return _0x4e57e8;};'use strict';var _=require(_0x9b12('0x0'));var util=require(_0x9b12('0x1'));var moment=require(_0x9b12('0x2'));var BPromise=require(_0x9b12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b12('0x4'))['db'];var utils=require(_0x9b12('0x5'));var logger=require('../../config/logger')(_0x9b12('0x6'));var config=require(_0x9b12('0x7'));var jayson=require(_0x9b12('0x8'));var client=jayson['client'][_0x9b12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569895,_0x3b8a02,_0x4edb84){return new BPromise(function(_0x399353,_0x535e26){return client['request'](_0x569895,_0x4edb84)[_0x9b12('0xa')](function(_0x517842){logger[_0x9b12('0xb')](_0x9b12('0xc'),_0x3b8a02,_0x9b12('0xd'));logger['debug'](_0x9b12('0xe'),_0x3b8a02,_0x9b12('0xd'),JSON[_0x9b12('0xf')](_0x517842));if(_0x517842[_0x9b12('0x10')]){if(_0x517842[_0x9b12('0x10')][_0x9b12('0x11')]===0x1f4){logger[_0x9b12('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x3b8a02,_0x517842[_0x9b12('0x10')][_0x9b12('0x12')]);return _0x535e26(_0x517842[_0x9b12('0x10')][_0x9b12('0x12')]);}logger[_0x9b12('0x10')](_0x9b12('0xc'),_0x3b8a02,_0x517842['error'][_0x9b12('0x12')]);return _0x399353(_0x517842[_0x9b12('0x10')][_0x9b12('0x12')]);}else{logger[_0x9b12('0xb')](_0x9b12('0xc'),_0x3b8a02,_0x9b12('0xd'));_0x399353(_0x517842['result']['message']);}})['catch'](function(_0xde3b77){logger['error'](_0x9b12('0xc'),_0x3b8a02,_0xde3b77);_0x535e26(_0xde3b77);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 9674b7e..121c78f 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 _0xd05c=['exports','INTEGER','sequelize'];(function(_0x462470,_0x45109d){var _0x2ff7db=function(_0x5d7999){while(--_0x5d7999){_0x462470['push'](_0x462470['shift']());}};_0x2ff7db(++_0x45109d);}(_0xd05c,0x6e));var _0xcd05=function(_0x37c1c6,_0x46305f){_0x37c1c6=_0x37c1c6-0x0;var _0x5f0ce1=_0xd05c[_0x37c1c6];return _0x5f0ce1;};'use strict';var Sequelize=require(_0xcd05('0x0'));module[_0xcd05('0x1')]={'UserId':{'type':Sequelize[_0xcd05('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xcd05('0x2')]}}; \ No newline at end of file +var _0xbed2=['exports','INTEGER','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbed2,0x18e));var _0x2bed=function(_0x23733d,_0x56f0a1){_0x23733d=_0x23733d-0x0;var _0x4a9cc4=_0xbed2[_0x23733d];return _0x4a9cc4;};'use strict';var Sequelize=require(_0x2bed('0x0'));module[_0x2bed('0x1')]={'UserId':{'type':Sequelize[_0x2bed('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3199ad9..e65223c 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(_0x3a44f0,_0x38fb51){var _0x3cc340=function(_0x167643){while(--_0x167643){_0x3a44f0['push'](_0x3a44f0['shift']());}};_0x3cc340(++_0x38fb51);}(_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 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(_0xa02fa2,_0x460bc0){var _0x3307b8=function(_0x191773){while(--_0x191773){_0xa02fa2['push'](_0xa02fa2['shift']());}};_0x3307b8(++_0x460bc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 a3aa379..44aa74e 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x24c9c0,_0x4e01ad){var _0x31e5e3=function(_0x2141c5){while(--_0x2141c5){_0x24c9c0['push'](_0x24c9c0['shift']());}};_0x31e5e3(++_0x4e01ad);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a2ba2,_0x5901b9){var _0x1d09fd=function(_0x28648b){while(--_0x28648b){_0x4a2ba2['push'](_0x4a2ba2['shift']());}};_0x1d09fd(++_0x5901b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 84fc21c..19294aa 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 _0x89c7=['exports','INTEGER','sequelize'];(function(_0x1555bd,_0x544a8b){var _0x344aac=function(_0x42e4c1){while(--_0x42e4c1){_0x1555bd['push'](_0x1555bd['shift']());}};_0x344aac(++_0x544a8b);}(_0x89c7,0xcb));var _0x789c=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x89c7[_0x304b67];return _0x493afb;};'use strict';var Sequelize=require(_0x789c('0x0'));module[_0x789c('0x1')]={'penalty':{'type':Sequelize[_0x789c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd1c=['sequelize','exports'];(function(_0x5bbc09,_0x35ad76){var _0x57d1de=function(_0x82a143){while(--_0x82a143){_0x5bbc09['push'](_0x5bbc09['shift']());}};_0x57d1de(++_0x35ad76);}(_0xdd1c,0x66));var _0xcdd1=function(_0x715d76,_0x402d60){_0x715d76=_0x715d76-0x0;var _0x48fe88=_0xdd1c[_0x715d76];return _0x48fe88;};'use strict';var Sequelize=require(_0xcdd1('0x0'));module[_0xcdd1('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 6fda689..e20f5d2 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 _0xf130=['path','rimraf','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util','bluebird','request-promise'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xf130,0x137));var _0x0f13=function(_0x3fd7c0,_0x1acce2){_0x3fd7c0=_0x3fd7c0-0x0;var _0x1310cc=_0xf130[_0x3fd7c0];return _0x1310cc;};'use strict';var _=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0f13('0x2'));var rp=require(_0x0f13('0x3'));var fs=require('fs');var path=require(_0x0f13('0x4'));var rimraf=require(_0x0f13('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f13('0x6'));module[_0x0f13('0x7')]=function(_0x3ee117,_0x17db10){return _0x3ee117['define'](_0x0f13('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0885=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','lodash'];(function(_0x23f2b4,_0x4c02ab){var _0x1bbe24=function(_0x22a954){while(--_0x22a954){_0x23f2b4['push'](_0x23f2b4['shift']());}};_0x1bbe24(++_0x4c02ab);}(_0x0885,0x167));var _0x5088=function(_0x446eff,_0x4e88e2){_0x446eff=_0x446eff-0x0;var _0x178fcf=_0x0885[_0x446eff];return _0x178fcf;};'use strict';var _=require(_0x5088('0x0'));var util=require(_0x5088('0x1'));var logger=require(_0x5088('0x2'))(_0x5088('0x3'));var moment=require(_0x5088('0x4'));var BPromise=require(_0x5088('0x5'));var rp=require(_0x5088('0x6'));var fs=require('fs');var path=require(_0x5088('0x7'));var rimraf=require('rimraf');var config=require(_0x5088('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x1f01ca,_0x18843b){return _0x1f01ca[_0x5088('0x9')]('UserVoiceQueue',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 779a361..0db9f95 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 _0x3287=['catch','util','moment','bluebird','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','info','result'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x3287,0x18d));var _0x7328=function(_0x500cb7,_0x9f58fd){_0x500cb7=_0x500cb7-0x0;var _0x5d0657=_0x3287[_0x500cb7];return _0x5d0657;};'use strict';var _=require('lodash');var util=require(_0x7328('0x0'));var moment=require(_0x7328('0x1'));var BPromise=require(_0x7328('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7328('0x3'));var config=require(_0x7328('0x4'));var jayson=require(_0x7328('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x103615,_0x7389d9,_0x576ef8){return new BPromise(function(_0x198a79,_0x1b00cc){return client[_0x7328('0x6')](_0x103615,_0x576ef8)['then'](function(_0x4d98ea){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x7389d9,_0x7328('0x7'));logger[_0x7328('0x8')](_0x7328('0x9'),_0x7389d9,_0x7328('0x7'),JSON[_0x7328('0xa')](_0x4d98ea));if(_0x4d98ea['error']){if(_0x4d98ea[_0x7328('0xb')][_0x7328('0xc')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x7389d9,_0x4d98ea[_0x7328('0xb')][_0x7328('0xd')]);return _0x1b00cc(_0x4d98ea[_0x7328('0xb')][_0x7328('0xd')]);}logger[_0x7328('0xb')](_0x7328('0xe'),_0x7389d9,_0x4d98ea[_0x7328('0xb')][_0x7328('0xd')]);return _0x198a79(_0x4d98ea[_0x7328('0xb')][_0x7328('0xd')]);}else{logger[_0x7328('0xf')](_0x7328('0xe'),_0x7389d9,_0x7328('0x7'));_0x198a79(_0x4d98ea[_0x7328('0x10')][_0x7328('0xd')]);}})[_0x7328('0x11')](function(_0x5a46a9){logger['error'](_0x7328('0xe'),_0x7389d9,_0x5a46a9);_0x1b00cc(_0x5a46a9);});});} \ No newline at end of file +var _0x511b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','util','moment'];(function(_0x780f4,_0x5b45d4){var _0x1a65e4=function(_0xf7f342){while(--_0xf7f342){_0x780f4['push'](_0x780f4['shift']());}};_0x1a65e4(++_0x5b45d4);}(_0x511b,0x18d));var _0xb511=function(_0x2dfe72,_0x51f485){_0x2dfe72=_0x2dfe72-0x0;var _0x3fb8de=_0x511b[_0x2dfe72];return _0x3fb8de;};'use strict';var _=require('lodash');var util=require(_0xb511('0x0'));var moment=require(_0xb511('0x1'));var BPromise=require(_0xb511('0x2'));var rs=require(_0xb511('0x3'));var fs=require('fs');var Redis=require(_0xb511('0x4'));var db=require(_0xb511('0x5'))['db'];var utils=require(_0xb511('0x6'));var logger=require(_0xb511('0x7'))(_0xb511('0x8'));var config=require('../../config/environment');var jayson=require(_0xb511('0x9'));var client=jayson[_0xb511('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47ce6e,_0x3249e5,_0x3b3557){return new BPromise(function(_0x545b3b,_0x193d2e){return client[_0xb511('0xb')](_0x47ce6e,_0x3b3557)[_0xb511('0xc')](function(_0x453221){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3249e5,_0xb511('0xd'));logger[_0xb511('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3249e5,_0xb511('0xd'),JSON[_0xb511('0xf')](_0x453221));if(_0x453221[_0xb511('0x10')]){if(_0x453221[_0xb511('0x10')][_0xb511('0x11')]===0x1f4){logger[_0xb511('0x10')](_0xb511('0x12'),_0x3249e5,_0x453221[_0xb511('0x10')][_0xb511('0x13')]);return _0x193d2e(_0x453221[_0xb511('0x10')][_0xb511('0x13')]);}logger[_0xb511('0x10')](_0xb511('0x12'),_0x3249e5,_0x453221[_0xb511('0x10')][_0xb511('0x13')]);return _0x545b3b(_0x453221[_0xb511('0x10')][_0xb511('0x13')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3249e5,_0xb511('0xd'));_0x545b3b(_0x453221[_0xb511('0x14')][_0xb511('0x13')]);}})['catch'](function(_0x347ef9){logger[_0xb511('0x10')](_0xb511('0x12'),_0x3249e5,_0x347ef9);_0x193d2e(_0x347ef9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e5ab963..c46bd58 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(_0x19691c,_0x492b07){var _0x1edc04=function(_0x16fa88){while(--_0x16fa88){_0x19691c['push'](_0x19691c['shift']());}};_0x1edc04(++_0x492b07);}(_0xe706,0xa3));var _0x6e70=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xe706[_0x44216d];return _0xeca523;};'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(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 37051c3..80f6db2 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 _0x692d=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1a3b6,_0x504aa7){var _0x2f7cc4=function(_0x282eaf){while(--_0x282eaf){_0x1a3b6['push'](_0x1a3b6['shift']());}};_0x2f7cc4(++_0x504aa7);}(_0x692d,0x175));var _0xd692=function(_0x3ee469,_0x45869d){_0x3ee469=_0x3ee469-0x0;var _0x2ded80=_0x692d[_0x3ee469];return _0x2ded80;};'use strict';var Sequelize=require(_0xd692('0x0'));module[_0xd692('0x1')]={'uniqueid':{'type':Sequelize[_0xd692('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd692('0x3')},'membername':{'type':Sequelize[_0xd692('0x4')],'allowNull':![],'comment':_0xd692('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd692('0x4')],'allowNull':![],'unique':_0xd692('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xd692('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd692('0x5'),'comment':_0xd692('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xd692('0x2')](0xb),'defaultValue':0x0,'comment':_0xd692('0x3')}}; \ No newline at end of file +var _0x6746=['queue_interface','sequelize','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x43de99,_0x3b6a96){var _0x38a880=function(_0x119d57){while(--_0x119d57){_0x43de99['push'](_0x43de99['shift']());}};_0x38a880(++_0x3b6a96);}(_0x6746,0xa9));var _0x6674=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x6746[_0x3fb9dd];return _0x20136a;};'use strict';var Sequelize=require(_0x6674('0x0'));module[_0x6674('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x6674('0x2')],'allowNull':![],'comment':_0x6674('0x3')},'UserId':{'type':Sequelize[_0x6674('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6674('0x2')],'allowNull':![],'unique':_0x6674('0x5'),'comment':_0x6674('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6674('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x6674('0x2')],'allowNull':![],'unique':_0x6674('0x5'),'comment':_0x6674('0x3')},'penalty':{'type':Sequelize[_0x6674('0x4')](0xb),'defaultValue':0x0,'comment':_0x6674('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2d7a951..0e3d171 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 _0xe31d=['../../mysqldb','setMaxListeners','save','remove','hasOwnProperty','hook','exports','events'];(function(_0x130d25,_0x2e61a1){var _0x2bb722=function(_0x1350f2){while(--_0x1350f2){_0x130d25['push'](_0x130d25['shift']());}};_0x2bb722(++_0x2e61a1);}(_0xe31d,0x10f));var _0xde31=function(_0x4f090a,_0x56d74d){_0x4f090a=_0x4f090a-0x0;var _0x45145f=_0xe31d[_0x4f090a];return _0x45145f;};'use strict';var EventEmitter=require(_0xde31('0x0'));var UserVoiceQueueRt=require(_0xde31('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xde31('0x2')](0x0);var events={'afterCreate':_0xde31('0x3'),'afterUpdate':'update','afterDestroy':_0xde31('0x4')};function emitEvent(_0x168918){return function(_0x46e5a2,_0x300445,_0x454cf0){UserVoiceQueueRtEvents['emit'](_0x168918+':'+_0x46e5a2['id'],_0x46e5a2);UserVoiceQueueRtEvents['emit'](_0x168918,_0x46e5a2);_0x454cf0(null);};}for(var e in events){if(events[_0xde31('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xde31('0x6')](e,emitEvent(event));}}module[_0xde31('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x608a=['update','emit','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x1a3eaa,_0x5aa4a4){var _0x1031fe=function(_0x5aa54a){while(--_0x5aa54a){_0x1a3eaa['push'](_0x1a3eaa['shift']());}};_0x1031fe(++_0x5aa4a4);}(_0x608a,0x1b3));var _0xa608=function(_0x1a0ca7,_0x57451b){_0x1a0ca7=_0x1a0ca7-0x0;var _0x504fb5=_0x608a[_0x1a0ca7];return _0x504fb5;};'use strict';var EventEmitter=require(_0xa608('0x0'));var UserVoiceQueueRt=require(_0xa608('0x1'))['db'][_0xa608('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa608('0x3')](0x0);var events={'afterCreate':_0xa608('0x4'),'afterUpdate':_0xa608('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4f7993){return function(_0x37617f,_0x451c1d,_0x202321){UserVoiceQueueRtEvents[_0xa608('0x6')](_0x4f7993+':'+_0x37617f['id'],_0x37617f);UserVoiceQueueRtEvents[_0xa608('0x6')](_0x4f7993,_0x37617f);_0x202321(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa608('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index dbd2af2..a7ed7fd 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 _0x565b=['path','../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','request-promise'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x565b,0x191));var _0xb565=function(_0x53758c,_0x5664af){_0x53758c=_0x53758c-0x0;var _0x425eff=_0x565b[_0x53758c];return _0x425eff;};'use strict';var _=require(_0xb565('0x0'));var util=require('util');var logger=require(_0xb565('0x1'))(_0xb565('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb565('0x3'));var fs=require('fs');var path=require(_0xb565('0x4'));var rimraf=require('rimraf');var config=require(_0xb565('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x49da42,_0x2e48f5){return _0x49da42[_0xb565('0x6')](_0xb565('0x7'),attributes,{'tableName':_0xb565('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d08=['path','rimraf','../../config/environment','define','user_has_voice_queues_rt','util','moment','bluebird'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x8d08,0x1dd));var _0x88d0=function(_0x1a9c75,_0xa83750){_0x1a9c75=_0x1a9c75-0x0;var _0xb2f37e=_0x8d08[_0x1a9c75];return _0xb2f37e;};'use strict';var _=require('lodash');var util=require(_0x88d0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x88d0('0x1'));var BPromise=require(_0x88d0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88d0('0x3'));var rimraf=require(_0x88d0('0x4'));var config=require(_0x88d0('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x5de4f2,_0x154d12){return _0x5de4f2[_0x88d0('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0x88d0('0x7'),'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 29e4d2d..cc349b8 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 _0x41d8=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueRtPauses','findAll','options'];(function(_0x2ab251,_0x41f7bb){var _0x4461c4=function(_0x5258bf){while(--_0x5258bf){_0x2ab251['push'](_0x2ab251['shift']());}};_0x4461c4(++_0x41f7bb);}(_0x41d8,0x6d));var _0x841d=function(_0x378f75,_0x13a8ed){_0x378f75=_0x378f75-0x0;var _0x90addc=_0x41d8[_0x378f75];return _0x90addc;};'use strict';var _=require(_0x841d('0x0'));var util=require('util');var moment=require(_0x841d('0x1'));var BPromise=require(_0x841d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x841d('0x3'));var db=require(_0x841d('0x4'))['db'];var utils=require(_0x841d('0x5'));var logger=require(_0x841d('0x6'))(_0x841d('0x7'));var config=require('../../config/environment');var jayson=require(_0x841d('0x8'));var client=jayson['client'][_0x841d('0x9')]({'port':0x232a});config['redis']=_[_0x841d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x841d('0xb'))[_0x841d('0xc')](socket);function respondWithRpcPromise(_0x128173,_0xe039a8,_0xe6819a){return new BPromise(function(_0x23fceb,_0xe26f36){return client[_0x841d('0xd')](_0x128173,_0xe6819a)[_0x841d('0xe')](function(_0x22a620){logger[_0x841d('0xf')](_0x841d('0x10'),_0xe039a8,_0x841d('0x11'));logger[_0x841d('0x12')](_0x841d('0x13'),_0xe039a8,_0x841d('0x11'),JSON[_0x841d('0x14')](_0x22a620));if(_0x22a620[_0x841d('0x15')]){if(_0x22a620[_0x841d('0x15')][_0x841d('0x16')]===0x1f4){logger[_0x841d('0x15')](_0x841d('0x10'),_0xe039a8,_0x22a620[_0x841d('0x15')][_0x841d('0x17')]);return _0xe26f36(_0x22a620[_0x841d('0x15')][_0x841d('0x17')]);}logger[_0x841d('0x15')](_0x841d('0x10'),_0xe039a8,_0x22a620[_0x841d('0x15')]['message']);return _0x23fceb(_0x22a620[_0x841d('0x15')][_0x841d('0x17')]);}else{logger[_0x841d('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xe039a8,_0x841d('0x11'));_0x23fceb(_0x22a620['result'][_0x841d('0x17')]);}})['catch'](function(_0x25a2fe){logger['error'](_0x841d('0x10'),_0xe039a8,_0x25a2fe);_0xe26f36(_0x25a2fe);});});}exports[_0x841d('0x18')]=function(_0x4e91b2){var _0x1fc30b=this;return new Promise(function(_0x47a0e3,_0x596433){return db['UserVoiceQueueRt'][_0x841d('0x19')]({'raw':_0x4e91b2[_0x841d('0x1a')]?_0x4e91b2['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e91b2[_0x841d('0x1a')]?_0x4e91b2[_0x841d('0x1a')][_0x841d('0x1b')]||null:null,'attributes':[[db[_0x841d('0x1c')]['fn'](_0x841d('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x841d('0x1e')](_0x841d('0x1f')))),_0x841d('0x20')]]})[_0x841d('0xe')](function(_0x546f8c){logger[_0x841d('0xf')](_0x841d('0x18'),_0x4e91b2);logger[_0x841d('0x12')](_0x841d('0x18'),_0x4e91b2,JSON[_0x841d('0x14')](_0x546f8c));_0x47a0e3(_0x546f8c);})[_0x841d('0x21')](function(_0x94db8a){logger[_0x841d('0x15')]('GetVoiceQueueRtPauses',_0x94db8a[_0x841d('0x17')],_0x4e91b2);_0x596433(_0x1fc30b[_0x841d('0x15')](0x1f4,_0x94db8a[_0x841d('0x17')]));});});}; \ No newline at end of file +var _0xb76c=['options','raw','literal','outboundQueuePauses','then','GetVoiceQueueRtPauses','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UserVoiceQueueRt'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0xb76c,0xf5));var _0xcb76=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xb76c[_0x10c16d];return _0x5896f4;};'use strict';var _=require(_0xcb76('0x0'));var util=require(_0xcb76('0x1'));var moment=require(_0xcb76('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb76('0x3'));var db=require(_0xcb76('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb76('0x5'))('rpc');var config=require(_0xcb76('0x6'));var jayson=require(_0xcb76('0x7'));var client=jayson['client'][_0xcb76('0x8')]({'port':0x232a});config[_0xcb76('0x9')]=_[_0xcb76('0xa')](config['redis'],{'host':_0xcb76('0xb'),'port':0x18eb});var socket=require(_0xcb76('0xc'))(new Redis(config[_0xcb76('0x9')]));require(_0xcb76('0xd'))[_0xcb76('0xe')](socket);function respondWithRpcPromise(_0x28481b,_0x207364,_0x295308){return new BPromise(function(_0xf9c284,_0x1e8aeb){return client[_0xcb76('0xf')](_0x28481b,_0x295308)['then'](function(_0x198015){logger[_0xcb76('0x10')](_0xcb76('0x11'),_0x207364,_0xcb76('0x12'));logger[_0xcb76('0x13')](_0xcb76('0x14'),_0x207364,_0xcb76('0x12'),JSON['stringify'](_0x198015));if(_0x198015[_0xcb76('0x15')]){if(_0x198015[_0xcb76('0x15')][_0xcb76('0x16')]===0x1f4){logger[_0xcb76('0x15')](_0xcb76('0x11'),_0x207364,_0x198015[_0xcb76('0x15')][_0xcb76('0x17')]);return _0x1e8aeb(_0x198015[_0xcb76('0x15')][_0xcb76('0x17')]);}logger[_0xcb76('0x15')](_0xcb76('0x11'),_0x207364,_0x198015[_0xcb76('0x15')][_0xcb76('0x17')]);return _0xf9c284(_0x198015[_0xcb76('0x15')]['message']);}else{logger['info'](_0xcb76('0x11'),_0x207364,_0xcb76('0x12'));_0xf9c284(_0x198015[_0xcb76('0x18')][_0xcb76('0x17')]);}})[_0xcb76('0x19')](function(_0x3c59db){logger[_0xcb76('0x15')](_0xcb76('0x11'),_0x207364,_0x3c59db);_0x1e8aeb(_0x3c59db);});});}exports['GetVoiceQueueRtPauses']=function(_0x14751c){var _0x4b721a=this;return new Promise(function(_0x16fac2,_0x10406a){return db[_0xcb76('0x1a')]['findAll']({'raw':_0x14751c[_0xcb76('0x1b')]?_0x14751c['options'][_0xcb76('0x1c')]===undefined?!![]:![]:!![],'where':_0x14751c[_0xcb76('0x1b')]?_0x14751c['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xcb76('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0xcb76('0x1e')]]})[_0xcb76('0x1f')](function(_0x3dc224){logger['info'](_0xcb76('0x20'),_0x14751c);logger[_0xcb76('0x13')](_0xcb76('0x20'),_0x14751c,JSON[_0xcb76('0x21')](_0x3dc224));_0x16fac2(_0x3dc224);})['catch'](function(_0x45f7d6){logger['error'](_0xcb76('0x20'),_0x45f7d6[_0xcb76('0x17')],_0x14751c);_0x10406a(_0x4b721a[_0xcb76('0x15')](0x1f4,_0x45f7d6['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9f1a452..fa94b6b 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 _0xfc9b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x136ddd,_0x3c8de3){var _0x2e614a=function(_0x46e882){while(--_0x46e882){_0x136ddd['push'](_0x136ddd['shift']());}};_0x2e614a(++_0x3c8de3);}(_0xfc9b,0x74));var _0xbfc9=function(_0x3c5ebc,_0x1791fe){_0x3c5ebc=_0x3c5ebc-0x0;var _0x46fc64=_0xfc9b[_0x3c5ebc];return _0x46fc64;};'use strict';var UserVoiceQueueRtEvents=require(_0xbfc9('0x0'));var events=[_0xbfc9('0x1'),_0xbfc9('0x2'),_0xbfc9('0x3')];function createListener(_0x29639e,_0x4618f9){return function(_0x397d76){_0x4618f9['emit'](_0x29639e,_0x397d76);};}function removeListener(_0x2eedb4,_0x49e470){return function(){UserVoiceQueueRtEvents[_0xbfc9('0x4')](_0x2eedb4,_0x49e470);};}exports[_0xbfc9('0x5')]=function(_0x523ff1){for(var _0x1dbece=0x0,_0x266c05=events[_0xbfc9('0x6')];_0x1dbece<_0x266c05;_0x1dbece++){var _0xe288d1=events[_0x1dbece];var _0x4e0f74=createListener(_0xbfc9('0x7')+_0xe288d1,_0x523ff1);UserVoiceQueueRtEvents['on'](_0xe288d1,_0x4e0f74);}}; \ No newline at end of file +var _0xe0c1=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','length'];(function(_0x250eab,_0x34c3e1){var _0x3128e0=function(_0x4a61c1){while(--_0x4a61c1){_0x250eab['push'](_0x250eab['shift']());}};_0x3128e0(++_0x34c3e1);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x2f1e8,_0xbff498){_0x2f1e8=_0x2f1e8-0x0;var _0x1f1573=_0xe0c1[_0x2f1e8];return _0x1f1573;};'use strict';var UserVoiceQueueRtEvents=require(_0x1e0c('0x0'));var events=[_0x1e0c('0x1'),_0x1e0c('0x2'),_0x1e0c('0x3')];function createListener(_0x282c76,_0x444afa){return function(_0x3e31dd){_0x444afa['emit'](_0x282c76,_0x3e31dd);};}function removeListener(_0x565573,_0x4ad70a){return function(){UserVoiceQueueRtEvents['removeListener'](_0x565573,_0x4ad70a);};}exports['register']=function(_0x57c88f){for(var _0x935e3b=0x0,_0x3ccad8=events[_0x1e0c('0x4')];_0x935e3b<_0x3ccad8;_0x935e3b++){var _0x3d4bf5=events[_0x935e3b];var _0x21f9d0=createListener(_0x1e0c('0x5')+_0x3d4bf5,_0x57c88f);UserVoiceQueueRtEvents['on'](_0x3d4bf5,_0x21f9d0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 96a1763..56d3df4 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd4cf1e,_0x1467a6){var _0x1940a9=function(_0x36e6df){while(--_0x36e6df){_0xd4cf1e['push'](_0xd4cf1e['shift']());}};_0x1940a9(++_0x1467a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xc731bb,_0x5891d4){var _0xfe197d=function(_0x2cd6a7){while(--_0x2cd6a7){_0xc731bb['push'](_0xc731bb['shift']());}};_0xfe197d(++_0x5891d4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 690db52..d3c5350 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 _0xfb0e=['INTEGER','sequelize','exports'];(function(_0x1e68b3,_0x24c5f7){var _0x1133f7=function(_0x3d2366){while(--_0x3d2366){_0x1e68b3['push'](_0x1e68b3['shift']());}};_0x1133f7(++_0x24c5f7);}(_0xfb0e,0x13c));var _0xefb0=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0xfb0e[_0x4629ee];return _0x47fb5b;};'use strict';var Sequelize=require(_0xefb0('0x0'));module[_0xefb0('0x1')]={'penalty':{'type':Sequelize[_0xefb0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x57a9=['sequelize','exports'];(function(_0x4ec549,_0x4f9df9){var _0x5a5f6c=function(_0x37a4e4){while(--_0x37a4e4){_0x4ec549['push'](_0x4ec549['shift']());}};_0x5a5f6c(++_0x4f9df9);}(_0x57a9,0xcc));var _0x957a=function(_0x35726f,_0xf0516f){_0x35726f=_0x35726f-0x0;var _0x2b9c0c=_0x57a9[_0x35726f];return _0x2b9c0c;};'use strict';var Sequelize=require(_0x957a('0x0'));module[_0x957a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 f9f3950..70faf7b 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 _0xd4be=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','util'];(function(_0x487807,_0x2f7685){var _0x4a3886=function(_0xeba2a){while(--_0xeba2a){_0x487807['push'](_0x487807['shift']());}};_0x4a3886(++_0x2f7685);}(_0xd4be,0xe3));var _0xed4b=function(_0x23662b,_0x1e652a){_0x23662b=_0x23662b-0x0;var _0x22c47e=_0xd4be[_0x23662b];return _0x22c47e;};'use strict';var _=require('lodash');var util=require(_0xed4b('0x0'));var logger=require(_0xed4b('0x1'))(_0xed4b('0x2'));var moment=require(_0xed4b('0x3'));var BPromise=require(_0xed4b('0x4'));var rp=require(_0xed4b('0x5'));var fs=require('fs');var path=require(_0xed4b('0x6'));var rimraf=require('rimraf');var config=require(_0xed4b('0x7'));var attributes=require(_0xed4b('0x8'));module[_0xed4b('0x9')]=function(_0x7d0922,_0xdcd6f2){return _0x7d0922['define'](_0xed4b('0xa'),attributes,{'tableName':_0xed4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a2=['../../config/logger','api','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x47a73b,_0x56a1c3){var _0x5fccad=function(_0x1a427c){while(--_0x1a427c){_0x47a73b['push'](_0x47a73b['shift']());}};_0x5fccad(++_0x56a1c3);}(_0x50a2,0xc5));var _0x250a=function(_0x555c55,_0x11e721){_0x555c55=_0x555c55-0x0;var _0x4d5c53=_0x50a2[_0x555c55];return _0x4d5c53;};'use strict';var _=require(_0x250a('0x0'));var util=require('util');var logger=require(_0x250a('0x1'))(_0x250a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x250a('0x3'));var fs=require('fs');var path=require(_0x250a('0x4'));var rimraf=require(_0x250a('0x5'));var config=require('../../config/environment');var attributes=require(_0x250a('0x6'));module[_0x250a('0x7')]=function(_0x1b9672,_0x7c613e){return _0x1b9672[_0x250a('0x8')](_0x250a('0x9'),attributes,{'tableName':_0x250a('0xa'),'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 71a05d6..76a1bef 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 _0x2670=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x2d93d9,_0x377d13){var _0x419ed8=function(_0x5f3c75){while(--_0x5f3c75){_0x2d93d9['push'](_0x2d93d9['shift']());}};_0x419ed8(++_0x377d13);}(_0x2670,0xf9));var _0x0267=function(_0x24cc4f,_0x11fdd1){_0x24cc4f=_0x24cc4f-0x0;var _0x1f254e=_0x2670[_0x24cc4f];return _0x1f254e;};'use strict';var _=require(_0x0267('0x0'));var util=require(_0x0267('0x1'));var moment=require(_0x0267('0x2'));var BPromise=require(_0x0267('0x3'));var rs=require(_0x0267('0x4'));var fs=require('fs');var Redis=require(_0x0267('0x5'));var db=require(_0x0267('0x6'))['db'];var utils=require(_0x0267('0x7'));var logger=require('../../config/logger')(_0x0267('0x8'));var config=require(_0x0267('0x9'));var jayson=require(_0x0267('0xa'));var client=jayson[_0x0267('0xb')][_0x0267('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45758,_0x727337,_0x19c7f4){return new BPromise(function(_0x51bb57,_0x211026){return client['request'](_0x45758,_0x19c7f4)[_0x0267('0xd')](function(_0x124548){logger[_0x0267('0xe')](_0x0267('0xf'),_0x727337,_0x0267('0x10'));logger[_0x0267('0x11')](_0x0267('0x12'),_0x727337,_0x0267('0x10'),JSON['stringify'](_0x124548));if(_0x124548['error']){if(_0x124548[_0x0267('0x13')][_0x0267('0x14')]===0x1f4){logger['error'](_0x0267('0xf'),_0x727337,_0x124548[_0x0267('0x13')][_0x0267('0x15')]);return _0x211026(_0x124548['error'][_0x0267('0x15')]);}logger[_0x0267('0x13')](_0x0267('0xf'),_0x727337,_0x124548[_0x0267('0x13')][_0x0267('0x15')]);return _0x51bb57(_0x124548[_0x0267('0x13')][_0x0267('0x15')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x727337,_0x0267('0x10'));_0x51bb57(_0x124548[_0x0267('0x16')][_0x0267('0x15')]);}})['catch'](function(_0x422d09){logger[_0x0267('0x13')](_0x0267('0xf'),_0x727337,_0x422d09);_0x211026(_0x422d09);});});} \ No newline at end of file +var _0xfc47=['../../mysqldb','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x23dae2,_0x2d4d43){var _0x5794eb=function(_0x338d2e){while(--_0x338d2e){_0x23dae2['push'](_0x23dae2['shift']());}};_0x5794eb(++_0x2d4d43);}(_0xfc47,0xa7));var _0x7fc4=function(_0x13f729,_0x2689d0){_0x13f729=_0x13f729-0x0;var _0x5d1288=_0xfc47[_0x13f729];return _0x5d1288;};'use strict';var _=require(_0x7fc4('0x0'));var util=require(_0x7fc4('0x1'));var moment=require('moment');var BPromise=require(_0x7fc4('0x2'));var rs=require(_0x7fc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fc4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7fc4('0x5')][_0x7fc4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1ad02d,_0xd63e06,_0x20e830){return new BPromise(function(_0x1fb436,_0x271a49){return client[_0x7fc4('0x7')](_0x1ad02d,_0x20e830)[_0x7fc4('0x8')](function(_0x2a99e2){logger[_0x7fc4('0x9')](_0x7fc4('0xa'),_0xd63e06,_0x7fc4('0xb'));logger['debug'](_0x7fc4('0xc'),_0xd63e06,_0x7fc4('0xb'),JSON[_0x7fc4('0xd')](_0x2a99e2));if(_0x2a99e2['error']){if(_0x2a99e2[_0x7fc4('0xe')][_0x7fc4('0xf')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xd63e06,_0x2a99e2['error'][_0x7fc4('0x10')]);return _0x271a49(_0x2a99e2['error'][_0x7fc4('0x10')]);}logger[_0x7fc4('0xe')](_0x7fc4('0xa'),_0xd63e06,_0x2a99e2[_0x7fc4('0xe')][_0x7fc4('0x10')]);return _0x1fb436(_0x2a99e2['error'][_0x7fc4('0x10')]);}else{logger[_0x7fc4('0x9')](_0x7fc4('0xa'),_0xd63e06,_0x7fc4('0xb'));_0x1fb436(_0x2a99e2[_0x7fc4('0x11')]['message']);}})[_0x7fc4('0x12')](function(_0x5da008){logger[_0x7fc4('0xe')](_0x7fc4('0xa'),_0xd63e06,_0x5da008);_0x271a49(_0x5da008);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9ae5906..967dca0 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 _0x6c6f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x58797a,_0x1907a6){_0x58797a=_0x58797a-0x0;var _0x432bff=_0x6c6f[_0x58797a];return _0x432bff;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var fs_extra=require(_0xf6c6('0x6'));var auth=require(_0xf6c6('0x7'));var interaction=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var controller=require(_0xf6c6('0xa'));router['get']('/',auth[_0xf6c6('0xb')](),controller['index']);router['get'](_0xf6c6('0xc'),auth['isAuthenticated'](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xf')]);router[_0xf6c6('0x10')]('/:id',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x11')]);router['delete'](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbeff=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','put','update','delete','/:id','destroy','exports','util','path'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xbeff,0x8e));var _0xfbef=function(_0x5c58cb,_0x421722){_0x5c58cb=_0x5c58cb-0x0;var _0x35964f=_0xbeff[_0x5c58cb];return _0x35964f;};'use strict';var multer=require('multer');var util=require(_0xfbef('0x0'));var path=require(_0xfbef('0x1'));var timeout=require(_0xfbef('0x2'));var express=require(_0xfbef('0x3'));var router=express[_0xfbef('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbef('0x5'));var config=require(_0xfbef('0x6'));var controller=require(_0xfbef('0x7'));router[_0xfbef('0x8')]('/',auth['isAuthenticated'](),controller[_0xfbef('0x9')]);router[_0xfbef('0x8')]('/:id',auth[_0xfbef('0xa')](),controller[_0xfbef('0xb')]);router['post']('/',auth[_0xfbef('0xa')](),controller['create']);router[_0xfbef('0xc')]('/:id',auth[_0xfbef('0xa')](),controller[_0xfbef('0xd')]);router[_0xfbef('0xe')](_0xfbef('0xf'),auth[_0xfbef('0xa')](),controller[_0xfbef('0x10')]);module[_0xfbef('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d34eb2d..0fbf956 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 _0xb40b=['STRING','sequelize','exports','name'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xb40b,0x119));var _0xbb40=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb40b[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0xbb40('0x0'));module[_0xbb40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbb40('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb40('0x3')]}}; \ No newline at end of file +var _0x424f=['sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x424f,0x94));var _0xf424=function(_0x4d297e,_0x4dbd0e){_0x4d297e=_0x4d297e-0x0;var _0x3efdb9=_0x424f[_0x4d297e];return _0x3efdb9;};'use strict';var Sequelize=require(_0xf424('0x0'));module[_0xf424('0x1')]={'name':{'type':Sequelize[_0xf424('0x2')],'unique':_0xf424('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf424('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 9ae508d..f0a4bfe 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 _0x42d3=['key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','Variable','includeAll','rows','show','keys','length','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','catch','find','params','eml-format','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','then','destroy','Variables','UserProfileResource','error','name','send','map','rawAttributes','fieldName'];(function(_0x4746b6,_0x194f6e){var _0xe6f013=function(_0x448ffa){while(--_0x448ffa){_0x4746b6['push'](_0x4746b6['shift']());}};_0xe6f013(++_0x194f6e);}(_0x42d3,0x6b));var _0x342d=function(_0x54588a,_0x2deca3){_0x54588a=_0x54588a-0x0;var _0xe6dc70=_0x42d3[_0x54588a];return _0xe6dc70;};'use strict';var emlformat=require(_0x342d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x342d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x342d('0x2'));var util=require(_0x342d('0x3'));var path=require('path');var sox=require(_0x342d('0x4'));var csv=require(_0x342d('0x5'));var ejs=require(_0x342d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x342d('0x7'));var squel=require(_0x342d('0x8'));var crypto=require('crypto');var jsforce=require(_0x342d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x342d('0x5'));var querystring=require(_0x342d('0xa'));var Papa=require(_0x342d('0xb'));var Redis=require(_0x342d('0xc'));var authService=require(_0x342d('0xd'));var qs=require(_0x342d('0xe'));var as=require(_0x342d('0xf'));var hardwareService=require(_0x342d('0x10'));var logger=require(_0x342d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x342d('0x12'));var licenseUtil=require(_0x342d('0x13'));var db=require(_0x342d('0x14'))['db'];function respondWithStatusCode(_0x1935aa,_0x2fa708){_0x2fa708=_0x2fa708||0xcc;return function(_0x18c6fa){if(_0x18c6fa){return _0x1935aa[_0x342d('0x15')](_0x2fa708);}return _0x1935aa['status'](_0x2fa708)[_0x342d('0x16')]();};}function respondWithResult(_0x56a344,_0x6ef255){_0x6ef255=_0x6ef255||0xc8;return function(_0x3b3b19){if(_0x3b3b19){return _0x56a344[_0x342d('0x17')](_0x6ef255)['json'](_0x3b3b19);}};}function respondWithFilteredResult(_0x1a5c69,_0x14c7e6){return function(_0x2434a6){if(_0x2434a6){var _0x41928d=typeof _0x14c7e6[_0x342d('0x18')]===_0x342d('0x19')&&typeof _0x14c7e6[_0x342d('0x1a')]===_0x342d('0x19');var _0x4481e4=_0x2434a6[_0x342d('0x1b')];var _0x14af8a=_0x41928d?0x0:_0x14c7e6['offset'];var _0x18e460=_0x41928d?_0x2434a6['count']:_0x14c7e6[_0x342d('0x18')]+_0x14c7e6[_0x342d('0x1a')];var _0x45a6fb;if(_0x18e460>=_0x4481e4){_0x18e460=_0x4481e4;_0x45a6fb=0xc8;}else{_0x45a6fb=0xce;}_0x1a5c69['status'](_0x45a6fb);return _0x1a5c69['set']('Content-Range',_0x14af8a+'-'+_0x18e460+'/'+_0x4481e4)[_0x342d('0x1c')](_0x2434a6);}return null;};}function patchUpdates(_0x22940e){return function(_0x18a492){try{jsonpatch[_0x342d('0x1d')](_0x18a492,_0x22940e,!![]);}catch(_0x244db7){return BPromise[_0x342d('0x1e')](_0x244db7);}return _0x18a492['save']();};}function saveUpdates(_0x30456a,_0x456dcd){return function(_0x5dec9f){if(_0x5dec9f){return _0x5dec9f['update'](_0x30456a)[_0x342d('0x1f')](function(_0x2b3d2e){return _0x2b3d2e;});}return null;};}function removeEntity(_0x5bab87,_0x28b87e){return function(_0x3fc067){if(_0x3fc067){return _0x3fc067[_0x342d('0x20')]()[_0x342d('0x1f')](function(){var _0x30c3d7=_0x3fc067['get']({'plain':!![]});var _0x5c6c89=_0x342d('0x21');return db[_0x342d('0x22')]['destroy']({'where':{'type':_0x5c6c89,'resourceId':_0x30c3d7['id']}})[_0x342d('0x1f')](function(){return _0x3fc067;});})[_0x342d('0x1f')](function(){_0x5bab87[_0x342d('0x17')](0xcc)[_0x342d('0x16')]();});}};}function handleEntityNotFound(_0x26ba15,_0x220f3f){return function(_0x556be3){if(!_0x556be3){_0x26ba15[_0x342d('0x15')](0x194);}return _0x556be3;};}function handleError(_0x2fbde0,_0x2a2b73){_0x2a2b73=_0x2a2b73||0x1f4;return function(_0x598f07){logger[_0x342d('0x23')](_0x598f07['stack']);if(_0x598f07[_0x342d('0x24')]){delete _0x598f07[_0x342d('0x24')];}_0x2fbde0[_0x342d('0x17')](_0x2a2b73)[_0x342d('0x25')](_0x598f07);};}exports['index']=function(_0x124929,_0x45069e){var _0x287905={},_0xcb8db8={},_0x427cec={'count':0x0,'rows':[]};var _0x555af1=_[_0x342d('0x26')](db['Variable'][_0x342d('0x27')],function(_0x4239c1){return{'name':_0x4239c1[_0x342d('0x28')],'type':_0x4239c1['type'][_0x342d('0x29')]};});_0xcb8db8[_0x342d('0x2a')]=_['map'](_0x555af1,_0x342d('0x24'));_0xcb8db8['query']=_['keys'](_0x124929[_0x342d('0x2b')]);_0xcb8db8['filters']=_[_0x342d('0x2c')](_0xcb8db8[_0x342d('0x2a')],_0xcb8db8[_0x342d('0x2b')]);_0x287905[_0x342d('0x2d')]=_[_0x342d('0x2c')](_0xcb8db8['model'],qs[_0x342d('0x2e')](_0x124929[_0x342d('0x2b')][_0x342d('0x2e')]));_0x287905[_0x342d('0x2d')]=_0x287905[_0x342d('0x2d')]['length']?_0x287905[_0x342d('0x2d')]:_0xcb8db8[_0x342d('0x2a')];if(!_0x124929[_0x342d('0x2b')]['hasOwnProperty'](_0x342d('0x2f'))){_0x287905[_0x342d('0x1a')]=qs[_0x342d('0x1a')](_0x124929[_0x342d('0x2b')][_0x342d('0x1a')]);_0x287905['offset']=qs[_0x342d('0x18')](_0x124929[_0x342d('0x2b')][_0x342d('0x18')]);}_0x287905[_0x342d('0x30')]=qs[_0x342d('0x31')](_0x124929[_0x342d('0x2b')]['sort']);_0x287905[_0x342d('0x32')]=qs[_0x342d('0x33')](_['pick'](_0x124929[_0x342d('0x2b')],_0xcb8db8[_0x342d('0x33')]),_0x555af1);if(_0x124929['query'][_0x342d('0x34')]){_0x287905['where']=_[_0x342d('0x35')](_0x287905[_0x342d('0x32')],{'$or':_[_0x342d('0x26')](_0x555af1,function(_0x5b7a63){if(_0x5b7a63[_0x342d('0x36')]!==_0x342d('0x37')){var _0x983846={};_0x983846[_0x5b7a63[_0x342d('0x24')]]={'$like':'%'+_0x124929[_0x342d('0x2b')][_0x342d('0x34')]+'%'};return _0x983846;}})});}_0x287905=_['merge']({},_0x287905,_0x124929[_0x342d('0x38')]);var _0x512448={'where':_0x287905['where']};return db[_0x342d('0x39')][_0x342d('0x1b')](_0x512448)[_0x342d('0x1f')](function(_0xcf4041){_0x427cec[_0x342d('0x1b')]=_0xcf4041;if(_0x124929['query'][_0x342d('0x3a')]){_0x287905['include']=[{'all':!![]}];}return db[_0x342d('0x39')]['findAll'](_0x287905);})[_0x342d('0x1f')](function(_0x454d70){_0x427cec[_0x342d('0x3b')]=_0x454d70;return _0x427cec;})[_0x342d('0x1f')](respondWithFilteredResult(_0x45069e,_0x287905))['catch'](handleError(_0x45069e,null));};exports[_0x342d('0x3c')]=function(_0x1d2061,_0x5e1ddd){var _0x35e50e={'raw':!![],'where':{'id':_0x1d2061['params']['id']}},_0x4dd9e2={};_0x4dd9e2[_0x342d('0x2a')]=_['keys'](db[_0x342d('0x39')]['rawAttributes']);_0x4dd9e2[_0x342d('0x2b')]=_[_0x342d('0x3d')](_0x1d2061[_0x342d('0x2b')]);_0x4dd9e2[_0x342d('0x33')]=_['intersection'](_0x4dd9e2[_0x342d('0x2a')],_0x4dd9e2['query']);_0x35e50e[_0x342d('0x2d')]=_[_0x342d('0x2c')](_0x4dd9e2[_0x342d('0x2a')],qs[_0x342d('0x2e')](_0x1d2061['query'][_0x342d('0x2e')]));_0x35e50e[_0x342d('0x2d')]=_0x35e50e[_0x342d('0x2d')][_0x342d('0x3e')]?_0x35e50e[_0x342d('0x2d')]:_0x4dd9e2[_0x342d('0x2a')];if(_0x1d2061[_0x342d('0x2b')][_0x342d('0x3a')]){_0x35e50e['include']=[{'all':!![]}];}_0x35e50e=_[_0x342d('0x35')]({},_0x35e50e,_0x1d2061['options']);return db[_0x342d('0x39')]['find'](_0x35e50e)[_0x342d('0x1f')](handleEntityNotFound(_0x5e1ddd,null))[_0x342d('0x1f')](respondWithResult(_0x5e1ddd,null))['catch'](handleError(_0x5e1ddd,null));};exports[_0x342d('0x3f')]=function(_0x2401f2,_0x47b937){return db[_0x342d('0x39')][_0x342d('0x3f')](_0x2401f2[_0x342d('0x40')],{})[_0x342d('0x1f')](function(_0x159a1c){var _0xe26546=_0x2401f2[_0x342d('0x41')][_0x342d('0x42')]({'plain':!![]});if(!_0xe26546)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe26546[_0x342d('0x43')]==='user'){var _0x4ea405=_0x159a1c[_0x342d('0x42')]({'plain':!![]});var _0x4ffcfb=_0x342d('0x21');return db[_0x342d('0x44')]['find']({'where':{'name':_0x4ffcfb,'userProfileId':_0xe26546[_0x342d('0x45')]},'raw':!![]})['then'](function(_0x5cc784){if(_0x5cc784&&_0x5cc784[_0x342d('0x46')]===0x0){return db[_0x342d('0x22')][_0x342d('0x3f')]({'name':_0x4ea405[_0x342d('0x24')],'resourceId':_0x4ea405['id'],'type':_0x5cc784[_0x342d('0x24')],'sectionId':_0x5cc784['id']},{})['then'](function(){return _0x159a1c;});}else{return _0x159a1c;}})[_0x342d('0x47')](function(_0x4b34d0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b34d0);throw _0x4b34d0;});}return _0x159a1c;})[_0x342d('0x1f')](respondWithResult(_0x47b937,0xc9))[_0x342d('0x47')](handleError(_0x47b937,null));};exports['update']=function(_0x1fa9c1,_0x1ed4b8){if(_0x1fa9c1[_0x342d('0x40')]['id']){delete _0x1fa9c1['body']['id'];}return db['Variable'][_0x342d('0x48')]({'where':{'id':_0x1fa9c1['params']['id']}})[_0x342d('0x1f')](handleEntityNotFound(_0x1ed4b8,null))[_0x342d('0x1f')](saveUpdates(_0x1fa9c1[_0x342d('0x40')],null))[_0x342d('0x1f')](respondWithResult(_0x1ed4b8,null))[_0x342d('0x47')](handleError(_0x1ed4b8,null));};exports['destroy']=function(_0x41f1f9,_0x17b8ad){return db[_0x342d('0x39')][_0x342d('0x48')]({'where':{'id':_0x41f1f9[_0x342d('0x49')]['id']}})[_0x342d('0x1f')](handleEntityNotFound(_0x17b8ad,null))[_0x342d('0x1f')](removeEntity(_0x17b8ad,null))['catch'](handleError(_0x17b8ad,null));}; \ No newline at end of file +var _0x8211=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','get','UserProfileResource','then','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x588e98,_0x5290d){var _0x4d0cb5=function(_0x462f71){while(--_0x462f71){_0x588e98['push'](_0x588e98['shift']());}};_0x4d0cb5(++_0x5290d);}(_0x8211,0x1d3));var _0x1821=function(_0x131fe2,_0x690fc3){_0x131fe2=_0x131fe2-0x0;var _0x243861=_0x8211[_0x131fe2];return _0x243861;};'use strict';var emlformat=require(_0x1821('0x0'));var rimraf=require(_0x1821('0x1'));var zipdir=require(_0x1821('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1821('0x3'));var BPromise=require(_0x1821('0x4'));var Mustache=require('mustache');var util=require(_0x1821('0x5'));var path=require(_0x1821('0x6'));var sox=require('sox');var csv=require(_0x1821('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1821('0x8'));var _=require(_0x1821('0x9'));var squel=require(_0x1821('0xa'));var crypto=require(_0x1821('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1821('0xc'));var toCsv=require(_0x1821('0x7'));var querystring=require(_0x1821('0xd'));var Papa=require(_0x1821('0xe'));var Redis=require(_0x1821('0xf'));var authService=require(_0x1821('0x10'));var qs=require(_0x1821('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1821('0x12'));var logger=require(_0x1821('0x13'))('api');var utils=require(_0x1821('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1821('0x15'));var db=require(_0x1821('0x16'))['db'];function respondWithStatusCode(_0x54588f,_0x400e2e){_0x400e2e=_0x400e2e||0xcc;return function(_0xbf51ab){if(_0xbf51ab){return _0x54588f[_0x1821('0x17')](_0x400e2e);}return _0x54588f[_0x1821('0x18')](_0x400e2e)[_0x1821('0x19')]();};}function respondWithResult(_0x5d496d,_0x4ba681){_0x4ba681=_0x4ba681||0xc8;return function(_0x191c1c){if(_0x191c1c){return _0x5d496d[_0x1821('0x18')](_0x4ba681)[_0x1821('0x1a')](_0x191c1c);}};}function respondWithFilteredResult(_0x30a922,_0x592311){return function(_0x3af2b2){if(_0x3af2b2){var _0x3b038e=typeof _0x592311['offset']===_0x1821('0x1b')&&typeof _0x592311[_0x1821('0x1c')]==='undefined';var _0x3391c3=_0x3af2b2[_0x1821('0x1d')];var _0x11ca5d=_0x3b038e?0x0:_0x592311[_0x1821('0x1e')];var _0x52ce01=_0x3b038e?_0x3af2b2[_0x1821('0x1d')]:_0x592311['offset']+_0x592311[_0x1821('0x1c')];var _0x4172bd;if(_0x52ce01>=_0x3391c3){_0x52ce01=_0x3391c3;_0x4172bd=0xc8;}else{_0x4172bd=0xce;}_0x30a922[_0x1821('0x18')](_0x4172bd);return _0x30a922[_0x1821('0x1f')](_0x1821('0x20'),_0x11ca5d+'-'+_0x52ce01+'/'+_0x3391c3)[_0x1821('0x1a')](_0x3af2b2);}return null;};}function patchUpdates(_0x2e5d15){return function(_0x989cb4){try{jsonpatch[_0x1821('0x21')](_0x989cb4,_0x2e5d15,!![]);}catch(_0x54e062){return BPromise['reject'](_0x54e062);}return _0x989cb4['save']();};}function saveUpdates(_0x19d5a8,_0x23709b){return function(_0x155967){if(_0x155967){return _0x155967[_0x1821('0x22')](_0x19d5a8)['then'](function(_0x377658){return _0x377658;});}return null;};}function removeEntity(_0x296d5d,_0x21e7a4){return function(_0x50a4b3){if(_0x50a4b3){return _0x50a4b3[_0x1821('0x23')]()['then'](function(){var _0x30407f=_0x50a4b3[_0x1821('0x24')]({'plain':!![]});var _0x41f299='Variables';return db[_0x1821('0x25')]['destroy']({'where':{'type':_0x41f299,'resourceId':_0x30407f['id']}})[_0x1821('0x26')](function(){return _0x50a4b3;});})[_0x1821('0x26')](function(){_0x296d5d[_0x1821('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f068a,_0x131ffb){return function(_0x2d4210){if(!_0x2d4210){_0x1f068a[_0x1821('0x17')](0x194);}return _0x2d4210;};}function handleError(_0x3af92e,_0x159c1d){_0x159c1d=_0x159c1d||0x1f4;return function(_0x32e5be){logger[_0x1821('0x27')](_0x32e5be[_0x1821('0x28')]);if(_0x32e5be[_0x1821('0x29')]){delete _0x32e5be[_0x1821('0x29')];}_0x3af92e['status'](_0x159c1d)[_0x1821('0x2a')](_0x32e5be);};}exports['index']=function(_0x1f712f,_0x40d317){var _0x3b6a92={},_0x2a1bf3={},_0x4b9cdb={'count':0x0,'rows':[]};var _0x265cef=_[_0x1821('0x2b')](db[_0x1821('0x2c')][_0x1821('0x2d')],function(_0x3d51bd){return{'name':_0x3d51bd[_0x1821('0x2e')],'type':_0x3d51bd[_0x1821('0x2f')][_0x1821('0x30')]};});_0x2a1bf3[_0x1821('0x31')]=_[_0x1821('0x2b')](_0x265cef,'name');_0x2a1bf3['query']=_[_0x1821('0x32')](_0x1f712f[_0x1821('0x33')]);_0x2a1bf3[_0x1821('0x34')]=_[_0x1821('0x35')](_0x2a1bf3['model'],_0x2a1bf3[_0x1821('0x33')]);_0x3b6a92['attributes']=_[_0x1821('0x35')](_0x2a1bf3[_0x1821('0x31')],qs['fields'](_0x1f712f['query'][_0x1821('0x36')]));_0x3b6a92['attributes']=_0x3b6a92[_0x1821('0x37')]['length']?_0x3b6a92['attributes']:_0x2a1bf3[_0x1821('0x31')];if(!_0x1f712f[_0x1821('0x33')][_0x1821('0x38')](_0x1821('0x39'))){_0x3b6a92['limit']=qs[_0x1821('0x1c')](_0x1f712f[_0x1821('0x33')][_0x1821('0x1c')]);_0x3b6a92[_0x1821('0x1e')]=qs[_0x1821('0x1e')](_0x1f712f['query']['offset']);}_0x3b6a92[_0x1821('0x3a')]=qs[_0x1821('0x3b')](_0x1f712f[_0x1821('0x33')][_0x1821('0x3b')]);_0x3b6a92[_0x1821('0x3c')]=qs[_0x1821('0x34')](_[_0x1821('0x3d')](_0x1f712f[_0x1821('0x33')],_0x2a1bf3[_0x1821('0x34')]),_0x265cef);if(_0x1f712f[_0x1821('0x33')][_0x1821('0x3e')]){_0x3b6a92[_0x1821('0x3c')]=_[_0x1821('0x3f')](_0x3b6a92[_0x1821('0x3c')],{'$or':_[_0x1821('0x2b')](_0x265cef,function(_0x9c5d4c){if(_0x9c5d4c[_0x1821('0x2f')]!==_0x1821('0x40')){var _0x4d8602={};_0x4d8602[_0x9c5d4c[_0x1821('0x29')]]={'$like':'%'+_0x1f712f[_0x1821('0x33')][_0x1821('0x3e')]+'%'};return _0x4d8602;}})});}_0x3b6a92=_[_0x1821('0x3f')]({},_0x3b6a92,_0x1f712f[_0x1821('0x41')]);var _0x1f197c={'where':_0x3b6a92[_0x1821('0x3c')]};return db[_0x1821('0x2c')][_0x1821('0x1d')](_0x1f197c)[_0x1821('0x26')](function(_0x213db8){_0x4b9cdb[_0x1821('0x1d')]=_0x213db8;if(_0x1f712f[_0x1821('0x33')][_0x1821('0x42')]){_0x3b6a92[_0x1821('0x43')]=[{'all':!![]}];}return db[_0x1821('0x2c')][_0x1821('0x44')](_0x3b6a92);})['then'](function(_0x5b02fd){_0x4b9cdb[_0x1821('0x45')]=_0x5b02fd;return _0x4b9cdb;})[_0x1821('0x26')](respondWithFilteredResult(_0x40d317,_0x3b6a92))[_0x1821('0x46')](handleError(_0x40d317,null));};exports[_0x1821('0x47')]=function(_0x3c05be,_0x134b4c){var _0x1b4502={'raw':!![],'where':{'id':_0x3c05be['params']['id']}},_0x44dd45={};_0x44dd45[_0x1821('0x31')]=_['keys'](db['Variable'][_0x1821('0x2d')]);_0x44dd45[_0x1821('0x33')]=_[_0x1821('0x32')](_0x3c05be[_0x1821('0x33')]);_0x44dd45[_0x1821('0x34')]=_[_0x1821('0x35')](_0x44dd45[_0x1821('0x31')],_0x44dd45[_0x1821('0x33')]);_0x1b4502['attributes']=_['intersection'](_0x44dd45[_0x1821('0x31')],qs[_0x1821('0x36')](_0x3c05be[_0x1821('0x33')][_0x1821('0x36')]));_0x1b4502[_0x1821('0x37')]=_0x1b4502[_0x1821('0x37')]['length']?_0x1b4502['attributes']:_0x44dd45[_0x1821('0x31')];if(_0x3c05be[_0x1821('0x33')][_0x1821('0x42')]){_0x1b4502['include']=[{'all':!![]}];}_0x1b4502=_[_0x1821('0x3f')]({},_0x1b4502,_0x3c05be['options']);return db[_0x1821('0x2c')][_0x1821('0x48')](_0x1b4502)[_0x1821('0x26')](handleEntityNotFound(_0x134b4c,null))[_0x1821('0x26')](respondWithResult(_0x134b4c,null))['catch'](handleError(_0x134b4c,null));};exports[_0x1821('0x49')]=function(_0xd9caa5,_0x890782){return db['Variable'][_0x1821('0x49')](_0xd9caa5[_0x1821('0x4a')],{})[_0x1821('0x26')](function(_0x44c4a3){var _0x539a8f=_0xd9caa5['user']['get']({'plain':!![]});if(!_0x539a8f)throw new Error(_0x1821('0x4b'));if(_0x539a8f[_0x1821('0x4c')]==='user'){var _0x2619af=_0x44c4a3[_0x1821('0x24')]({'plain':!![]});var _0x565358=_0x1821('0x4d');return db[_0x1821('0x4e')][_0x1821('0x48')]({'where':{'name':_0x565358,'userProfileId':_0x539a8f[_0x1821('0x4f')]},'raw':!![]})[_0x1821('0x26')](function(_0x3449cf){if(_0x3449cf&&_0x3449cf['autoAssociation']===0x0){return db[_0x1821('0x25')][_0x1821('0x49')]({'name':_0x2619af['name'],'resourceId':_0x2619af['id'],'type':_0x3449cf[_0x1821('0x29')],'sectionId':_0x3449cf['id']},{})[_0x1821('0x26')](function(){return _0x44c4a3;});}else{return _0x44c4a3;}})[_0x1821('0x46')](function(_0x27644d){logger[_0x1821('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27644d);throw _0x27644d;});}return _0x44c4a3;})[_0x1821('0x26')](respondWithResult(_0x890782,0xc9))['catch'](handleError(_0x890782,null));};exports[_0x1821('0x22')]=function(_0x1b78fd,_0xb6ef28){if(_0x1b78fd[_0x1821('0x4a')]['id']){delete _0x1b78fd[_0x1821('0x4a')]['id'];}return db['Variable'][_0x1821('0x48')]({'where':{'id':_0x1b78fd[_0x1821('0x50')]['id']}})[_0x1821('0x26')](handleEntityNotFound(_0xb6ef28,null))[_0x1821('0x26')](saveUpdates(_0x1b78fd['body'],null))[_0x1821('0x26')](respondWithResult(_0xb6ef28,null))[_0x1821('0x46')](handleError(_0xb6ef28,null));};exports[_0x1821('0x23')]=function(_0xa4f47,_0x133319){return db['Variable'][_0x1821('0x48')]({'where':{'id':_0xa4f47['params']['id']}})[_0x1821('0x26')](handleEntityNotFound(_0x133319,null))[_0x1821('0x26')](removeEntity(_0x133319,null))['catch'](handleError(_0x133319,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 94651ff..4a1c83d 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 _0x4fc6=['./variable.attributes','exports','define','Variable','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9e23ed,_0x3edc42){var _0xc5c8a=function(_0x4f3403){while(--_0x4f3403){_0x9e23ed['push'](_0x9e23ed['shift']());}};_0xc5c8a(++_0x3edc42);}(_0x4fc6,0x184));var _0x64fc=function(_0x2554ef,_0x1a13a4){_0x2554ef=_0x2554ef-0x0;var _0x232366=_0x4fc6[_0x2554ef];return _0x232366;};'use strict';var _=require(_0x64fc('0x0'));var util=require(_0x64fc('0x1'));var logger=require('../../config/logger')(_0x64fc('0x2'));var moment=require('moment');var BPromise=require(_0x64fc('0x3'));var rp=require(_0x64fc('0x4'));var fs=require('fs');var path=require(_0x64fc('0x5'));var rimraf=require(_0x64fc('0x6'));var config=require(_0x64fc('0x7'));var attributes=require(_0x64fc('0x8'));module[_0x64fc('0x9')]=function(_0x44d01f,_0x3ab00a){return _0x44d01f[_0x64fc('0xa')](_0x64fc('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87ba=['lodash','util','moment','bluebird','rimraf','../../config/environment','exports','define','Variable','tools_variables'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x87ba,0x154));var _0xa87b=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x87ba[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0xa87b('0x0'));var util=require(_0xa87b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa87b('0x2'));var BPromise=require(_0xa87b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa87b('0x4'));var config=require(_0xa87b('0x5'));var attributes=require('./variable.attributes');module[_0xa87b('0x6')]=function(_0x7df08e,_0x109ba4){return _0x7df08e[_0xa87b('0x7')](_0xa87b('0x8'),attributes,{'tableName':_0xa87b('0x9'),'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 fe5b7f3..b1f8311 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x326f,0xd1));var _0xf326=function(_0x1c71c6,_0x207904){_0x1c71c6=_0x1c71c6-0x0;var _0x546a46=_0x326f[_0x1c71c6];return _0x546a46;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x39bf66,_0x35c96c){var _0x431030=function(_0x4328ac){while(--_0x4328ac){_0x39bf66['push'](_0x39bf66['shift']());}};_0x431030(++_0x35c96c);}(_0x55ca,0x126));var _0xa55c=function(_0x17d82f,_0x5d9172){_0x17d82f=_0x17d82f-0x0;var _0x58137b=_0x55ca[_0x17d82f];return _0x58137b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6c9c66a..18a0f49 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f05=['/restart','restart','migrations','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x4be888,_0x3ba1a3){var _0x58f940=function(_0x21eade){while(--_0x21eade){_0x4be888['push'](_0x4be888['shift']());}};_0x58f940(++_0x3ba1a3);}(_0x1f05,0x6c));var _0x51f0=function(_0x171089,_0x1e06dc){_0x171089=_0x171089-0x0;var _0x48a97a=_0x1f05[_0x171089];return _0x48a97a;};'use strict';var express=require(_0x51f0('0x0'));var router=express[_0x51f0('0x1')]();var auth=require(_0x51f0('0x2'));var controller=require(_0x51f0('0x3'));router[_0x51f0('0x4')]('/',controller['index']);router['get']('/fetch',auth[_0x51f0('0x5')](),auth[_0x51f0('0x6')](),controller[_0x51f0('0x7')]);router['get'](_0x51f0('0x8'),auth[_0x51f0('0x5')](),auth[_0x51f0('0x6')](),controller[_0x51f0('0x9')]);router[_0x51f0('0x4')](_0x51f0('0xa'),auth['isAuthenticated'](),auth[_0x51f0('0x6')](),controller[_0x51f0('0xb')]);router[_0x51f0('0x4')](_0x51f0('0xc'),auth[_0x51f0('0x5')](),controller[_0x51f0('0xd')]);router['get']('/migrations',controller[_0x51f0('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc8d0=['express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','restart','migrations','exports'];(function(_0x91964a,_0x2dc2f6){var _0x4490b1=function(_0x3ed329){while(--_0x3ed329){_0x91964a['push'](_0x91964a['shift']());}};_0x4490b1(++_0x2dc2f6);}(_0xc8d0,0xa0));var _0x0c8d=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0xc8d0[_0x516ffb];return _0x319667;};'use strict';var express=require(_0x0c8d('0x0'));var router=express[_0x0c8d('0x1')]();var auth=require(_0x0c8d('0x2'));var controller=require(_0x0c8d('0x3'));router[_0x0c8d('0x4')]('/',controller['index']);router['get'](_0x0c8d('0x5'),auth[_0x0c8d('0x6')](),auth[_0x0c8d('0x7')](),controller[_0x0c8d('0x8')]);router['get'](_0x0c8d('0x9'),auth[_0x0c8d('0x6')](),auth['canUpdate'](),controller[_0x0c8d('0xa')]);router[_0x0c8d('0x4')](_0x0c8d('0xb'),auth[_0x0c8d('0x6')](),auth[_0x0c8d('0x7')](),controller['pull']);router[_0x0c8d('0x4')](_0x0c8d('0xc'),auth[_0x0c8d('0x6')](),controller[_0x0c8d('0xd')]);router[_0x0c8d('0x4')]('/migrations',controller[_0x0c8d('0xe')]);module[_0x0c8d('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 63c028b..9c6c3af 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 _0xda06=['sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/logger','update','simple-git','index','query','latest','tags','exports','json','status','fetch','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xda06,0x1e7));var _0x6da0=function(_0x58c6a9,_0x3a0caf){_0x58c6a9=_0x58c6a9-0x0;var _0x394f21=_0xda06[_0x58c6a9];return _0x394f21;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x6da0('0x0'));var pkginfo=require(_0x6da0('0x1'))(module,_0x6da0('0x2'));var compareVersions=require(_0x6da0('0x3'));var exec=require(_0x6da0('0x4'))[_0x6da0('0x5')];var db=require(_0x6da0('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x6da0('0x7'))(_0x6da0('0x8'));var git=require(_0x6da0('0x9'))(config['root']);exports[_0x6da0('0xa')]=function(_0x2cf142,_0x2a4742){var _0x59d051={'current':module['exports'][_0x6da0('0x2')],'phonebar':0x2};if(_0x2cf142[_0x6da0('0xb')]&&_0x2cf142[_0x6da0('0xb')][_0x6da0('0xc')]){return git['fetch']()[_0x6da0('0xd')](function(_0x525190,_0x487daf){_0x59d051[_0x6da0('0xc')]=(_0x525190?module[_0x6da0('0xe')]['version']:_0x487daf[_0x6da0('0xc')])||'2.0.0';return _0x2a4742['status'](0xc8)[_0x6da0('0xf')](_0x59d051);});}else{return _0x2a4742[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')](_0x59d051);}};exports['fetch']=function(_0x472e43,_0x497975){return git[_0x6da0('0x11')]([_0x6da0('0x12'),_0x6da0('0x13')],function(_0x179c6d){if(_0x179c6d){logger['error'](_0x179c6d);return _0x497975[_0x6da0('0x10')](0x1f4)[_0x6da0('0xf')](_0x179c6d);}logger[_0x6da0('0x14')](_0x6da0('0x15'));return _0x497975[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x6da0('0x16')});});};exports[_0x6da0('0x17')]=function(_0x42b542,_0x3344de){return git['reset'](['--hard',_0x6da0('0x18')],function(_0x57c162){if(_0x57c162){logger[_0x6da0('0x19')](_0x57c162);return _0x3344de[_0x6da0('0x10')](0x1f4)[_0x6da0('0xf')](_0x57c162);}logger[_0x6da0('0x14')](_0x6da0('0x1a'));return _0x3344de[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x6da0('0x1b')});});};exports[_0x6da0('0x1c')]=function(_0x4f9382,_0x27ce9d){exec(_0x6da0('0x1d'),function(_0x7d2d78,_0x51d814,_0x25a380){logger[_0x6da0('0x14')](_0x51d814);logger['info'](_0x25a380);if(_0x7d2d78){logger['error'](_0x7d2d78);return _0x27ce9d[_0x6da0('0x10')](0x1f4)['json'](_0x7d2d78);}return _0x27ce9d[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x51d814});});};exports[_0x6da0('0x1e')]=function(_0x547b63,_0x4fe61d){return pm2[_0x6da0('0x1e')](_0x6da0('0x1f'))['then'](function(_0x161ab2){logger[_0x6da0('0x14')](_0x6da0('0x20'),_0x161ab2);return _0x4fe61d[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x6da0('0x21')});})[_0x6da0('0x22')](function(_0xa0f651){logger[_0x6da0('0x19')](_0xa0f651);return _0x4fe61d[_0x6da0('0x10')](0x1f4)[_0x6da0('0xf')](_0xa0f651);});};exports[_0x6da0('0x23')]=function(_0x3c7a83,_0x3f8f74){var _0x366cde=fs[_0x6da0('0x24')](path[_0x6da0('0x25')](config['root'],_0x6da0('0x26'),_0x6da0('0x23')));var _0x48f7ee=[];for(var _0x30696d=0x0;_0x30696d<_0x366cde[_0x6da0('0x27')];_0x30696d++){var _0x9a03bd=_0x366cde[_0x30696d][_0x6da0('0x28')](_0x6da0('0x29'),'');if(compareVersions(module[_0x6da0('0xe')][_0x6da0('0x2')],_0x9a03bd)===-0x1){_0x48f7ee[_0x6da0('0x2a')](_0x9a03bd);}}if(_0x48f7ee['length']){var _0x4691e2=_0x48f7ee[_0x6da0('0x2b')](compareVersions);var _0x157bf5=new Umzug({'storage':_0x6da0('0x2c'),'storageOptions':{'model':db[_0x6da0('0x2d')],'modelName':_0x6da0('0x2d'),'columnName':_0x6da0('0x2')},'migrations':{'params':[db[_0x6da0('0x2c')][_0x6da0('0x2e')](),db[_0x6da0('0x2c')]['constructor'],function(){throw new Error(_0x6da0('0x2f'));}],'path':path[_0x6da0('0x25')](config['root'],_0x6da0('0x26'),_0x6da0('0x23')),'pattern':/\.js$/}});_0x157bf5['up']({'migrations':_['map'](_0x4691e2,function(_0x1e662c){return _0x1e662c+_0x6da0('0x29');})})[_0x6da0('0x30')](function(){return _0x3f8f74[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x6da0('0x31')+module['exports'][_0x6da0('0x2')]+_0x6da0('0x32')+_['last'](_0x4691e2),'migrations':_[_0x6da0('0x25')](_0x4691e2)});})['catch'](function(_0x535f0d){if(_0x535f0d instanceof db[_0x6da0('0x2c')][_0x6da0('0x33')]){return _0x3f8f74[_0x6da0('0x10')](0xc8)['json']({'output':_0x6da0('0x34')});}else{return _0x3f8f74[_0x6da0('0x10')](0x1f4)[_0x6da0('0xf')](_0x535f0d);}});}else{return _0x3f8f74[_0x6da0('0x10')](0xc8)[_0x6da0('0xf')]({'output':_0x6da0('0x34')});}}; \ No newline at end of file +var _0xb69b=['root','query','latest','fetch','tags','exports','json','status','origin','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','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','error','readdirSync','join','server','migrations','length','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update'];(function(_0x548205,_0x1cf711){var _0x2d57a9=function(_0x336602){while(--_0x336602){_0x548205['push'](_0x548205['shift']());}};_0x2d57a9(++_0x1cf711);}(_0xb69b,0x8b));var _0xbb69=function(_0x4f65e2,_0xb58119){_0x4f65e2=_0x4f65e2-0x0;var _0x4177c0=_0xb69b[_0x4f65e2];return _0x4177c0;};'use strict';var Umzug=require(_0xbb69('0x0'));var path=require(_0xbb69('0x1'));var fs=require('fs');var _=require(_0xbb69('0x2'));var pkginfo=require(_0xbb69('0x3'))(module,_0xbb69('0x4'));var compareVersions=require(_0xbb69('0x5'));var exec=require('child_process')['exec'];var db=require(_0xbb69('0x6'))['db'];var config=require(_0xbb69('0x7'));var pm2=require(_0xbb69('0x8'));var logger=require(_0xbb69('0x9'))(_0xbb69('0xa'));var git=require('simple-git')(config[_0xbb69('0xb')]);exports['index']=function(_0x1b3134,_0x289b89){var _0x28caf3={'current':module['exports']['version'],'phonebar':0x2};if(_0x1b3134[_0xbb69('0xc')]&&_0x1b3134['query'][_0xbb69('0xd')]){return git[_0xbb69('0xe')]()[_0xbb69('0xf')](function(_0x4a54b0,_0xab6db5){_0x28caf3[_0xbb69('0xd')]=(_0x4a54b0?module[_0xbb69('0x10')][_0xbb69('0x4')]:_0xab6db5[_0xbb69('0xd')])||'2.0.0';return _0x289b89['status'](0xc8)[_0xbb69('0x11')](_0x28caf3);});}else{return _0x289b89[_0xbb69('0x12')](0xc8)[_0xbb69('0x11')](_0x28caf3);}};exports[_0xbb69('0xe')]=function(_0x15ab6f,_0x159c00){return git[_0xbb69('0xe')]([_0xbb69('0x13'),'master'],function(_0x1f1b6a){if(_0x1f1b6a){logger['error'](_0x1f1b6a);return _0x159c00['status'](0x1f4)[_0xbb69('0x11')](_0x1f1b6a);}logger[_0xbb69('0x14')]('git\x20fetch');return _0x159c00[_0xbb69('0x12')](0xc8)[_0xbb69('0x11')]({'output':_0xbb69('0x15')});});};exports[_0xbb69('0x16')]=function(_0x526b0c,_0x4793d4){return git[_0xbb69('0x16')]([_0xbb69('0x17'),_0xbb69('0x18')],function(_0x227d22){if(_0x227d22){logger['error'](_0x227d22);return _0x4793d4[_0xbb69('0x12')](0x1f4)[_0xbb69('0x11')](_0x227d22);}logger[_0xbb69('0x14')](_0xbb69('0x19'));return _0x4793d4[_0xbb69('0x12')](0xc8)['json']({'output':_0xbb69('0x1a')});});};exports[_0xbb69('0x1b')]=function(_0x262c5b,_0x561ac9){exec(_0xbb69('0x1c'),function(_0x467d21,_0x19bd96,_0x42ed38){logger['info'](_0x19bd96);logger[_0xbb69('0x14')](_0x42ed38);if(_0x467d21){logger['error'](_0x467d21);return _0x561ac9[_0xbb69('0x12')](0x1f4)[_0xbb69('0x11')](_0x467d21);}return _0x561ac9[_0xbb69('0x12')](0xc8)[_0xbb69('0x11')]({'output':_0x19bd96});});};exports[_0xbb69('0x1d')]=function(_0x5453ad,_0x2abd55){return pm2[_0xbb69('0x1d')](_0xbb69('0x1e'))[_0xbb69('0x1f')](function(_0x5015bf){logger[_0xbb69('0x14')](_0xbb69('0x20'),_0x5015bf);return _0x2abd55[_0xbb69('0x12')](0xc8)['json']({'output':_0xbb69('0x21')});})[_0xbb69('0x22')](function(_0x330ed6){logger[_0xbb69('0x23')](_0x330ed6);return _0x2abd55[_0xbb69('0x12')](0x1f4)[_0xbb69('0x11')](_0x330ed6);});};exports['migrations']=function(_0xb73425,_0x535400){var _0x525df4=fs[_0xbb69('0x24')](path[_0xbb69('0x25')](config[_0xbb69('0xb')],_0xbb69('0x26'),_0xbb69('0x27')));var _0x22e82b=[];for(var _0x347813=0x0;_0x347813<_0x525df4[_0xbb69('0x28')];_0x347813++){var _0x2c9b9a=_0x525df4[_0x347813]['replace']('.js','');if(compareVersions(module[_0xbb69('0x10')]['version'],_0x2c9b9a)===-0x1){_0x22e82b[_0xbb69('0x29')](_0x2c9b9a);}}if(_0x22e82b[_0xbb69('0x28')]){var _0xa29e7d=_0x22e82b[_0xbb69('0x2a')](compareVersions);var _0x22f60f=new Umzug({'storage':_0xbb69('0x2b'),'storageOptions':{'model':db[_0xbb69('0x2c')],'modelName':_0xbb69('0x2c'),'columnName':_0xbb69('0x4')},'migrations':{'params':[db[_0xbb69('0x2b')][_0xbb69('0x2d')](),db[_0xbb69('0x2b')]['constructor'],function(){throw new Error(_0xbb69('0x2e'));}],'path':path[_0xbb69('0x25')](config[_0xbb69('0xb')],'server',_0xbb69('0x27')),'pattern':/\.js$/}});_0x22f60f['up']({'migrations':_['map'](_0xa29e7d,function(_0x1cd76c){return _0x1cd76c+'.js';})})[_0xbb69('0x1f')](function(){return _0x535400[_0xbb69('0x12')](0xc8)['json']({'output':_0xbb69('0x2f')+module[_0xbb69('0x10')][_0xbb69('0x4')]+'\x20to\x20'+_[_0xbb69('0x30')](_0xa29e7d),'migrations':_[_0xbb69('0x25')](_0xa29e7d)});})[_0xbb69('0x22')](function(_0x4ce19b){if(_0x4ce19b instanceof db[_0xbb69('0x2b')]['UniqueConstraintError']){return _0x535400[_0xbb69('0x12')](0xc8)[_0xbb69('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x535400[_0xbb69('0x12')](0x1f4)['json'](_0x4ce19b);}});}else{return _0x535400[_0xbb69('0x12')](0xc8)[_0xbb69('0x11')]({'output':_0xbb69('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 36f4b16..f4affe5 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 _0x99ca=['post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2513ad,_0x5c7ac8){var _0x14a6c3=function(_0x37a47c){while(--_0x37a47c){_0x2513ad['push'](_0x2513ad['shift']());}};_0x14a6c3(++_0x5c7ac8);}(_0x99ca,0x1a9));var _0xa99c=function(_0x1c9bff,_0x4ec5c5){_0x1c9bff=_0x1c9bff-0x0;var _0x462024=_0x99ca[_0x1c9bff];return _0x462024;};'use strict';var multer=require(_0xa99c('0x0'));var util=require(_0xa99c('0x1'));var path=require(_0xa99c('0x2'));var timeout=require(_0xa99c('0x3'));var express=require('express');var router=express[_0xa99c('0x4')]();var fs_extra=require(_0xa99c('0x5'));var auth=require(_0xa99c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa99c('0x7'));router[_0xa99c('0x8')]('/',auth[_0xa99c('0x9')](),controller[_0xa99c('0xa')]);router[_0xa99c('0x8')](_0xa99c('0xb'),auth[_0xa99c('0x9')](),controller[_0xa99c('0xc')]);router['get'](_0xa99c('0xd'),auth[_0xa99c('0x9')](),controller[_0xa99c('0xe')]);router[_0xa99c('0xf')]('/',auth[_0xa99c('0x9')](),controller['create']);router[_0xa99c('0x10')](_0xa99c('0xd'),auth[_0xa99c('0x9')](),controller[_0xa99c('0x11')]);router[_0xa99c('0x12')](_0xa99c('0xd'),auth[_0xa99c('0x9')](),controller[_0xa99c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1c0d=['post','create','update','delete','exports','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0xf76607,_0x579f73){var _0x1ef5ed=function(_0x18432e){while(--_0x18432e){_0xf76607['push'](_0xf76607['shift']());}};_0x1ef5ed(++_0x579f73);}(_0x1c0d,0x7c));var _0xd1c0=function(_0x397505,_0x2fa723){_0x397505=_0x397505-0x0;var _0x415036=_0x1c0d[_0x397505];return _0x415036;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd1c0('0x0'));var express=require(_0xd1c0('0x1'));var router=express['Router']();var fs_extra=require(_0xd1c0('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xd1c0('0x3'));var config=require(_0xd1c0('0x4'));var controller=require(_0xd1c0('0x5'));router[_0xd1c0('0x6')]('/',auth[_0xd1c0('0x7')](),controller[_0xd1c0('0x8')]);router[_0xd1c0('0x6')]('/describe',auth[_0xd1c0('0x7')](),controller[_0xd1c0('0x9')]);router[_0xd1c0('0x6')](_0xd1c0('0xa'),auth[_0xd1c0('0x7')](),controller[_0xd1c0('0xb')]);router[_0xd1c0('0xc')]('/',auth[_0xd1c0('0x7')](),controller[_0xd1c0('0xd')]);router['put'](_0xd1c0('0xa'),auth[_0xd1c0('0x7')](),controller[_0xd1c0('0xe')]);router[_0xd1c0('0xf')](_0xd1c0('0xa'),auth[_0xd1c0('0x7')](),controller['destroy']);module[_0xd1c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 218c77b..67f8cd7 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 _0x6f59=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x6f59,0x1be));var _0x96f5=function(_0x447af1,_0x1f0416){_0x447af1=_0x447af1-0x0;var _0x4e152c=_0x6f59[_0x447af1];return _0x4e152c;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'type':{'type':Sequelize[_0x96f5('0x2')]},'uniqueid':{'type':Sequelize[_0x96f5('0x2')]},'calleridnum':{'type':Sequelize[_0x96f5('0x2')]},'calleridname':{'type':Sequelize[_0x96f5('0x2')]},'queue':{'type':Sequelize[_0x96f5('0x2')]},'interface':{'type':Sequelize[_0x96f5('0x2')]},'membername':{'type':Sequelize[_0x96f5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x96f5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x96f5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x96f5('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x96f5('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x96f5('0x5')]},'reason':{'type':Sequelize[_0x96f5('0x2')]},'lastevent':{'type':Sequelize[_0x96f5('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x96f5('0x5')]},'channelstatedesc':{'type':Sequelize[_0x96f5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x96f5('0x2')]},'connectedlinename':{'type':Sequelize[_0x96f5('0x2')]},'language':{'type':Sequelize[_0x96f5('0x2')]},'accountcode':{'type':Sequelize[_0x96f5('0x2')]},'context':{'type':Sequelize[_0x96f5('0x2')]},'exten':{'type':Sequelize[_0x96f5('0x2')]},'priority':{'type':Sequelize[_0x96f5('0x2')]},'destchannel':{'type':Sequelize[_0x96f5('0x2')]},'destchannelstate':{'type':Sequelize[_0x96f5('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x96f5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x96f5('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x96f5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x96f5('0x2')]},'destlanguage':{'type':Sequelize[_0x96f5('0x2')]},'destaccountcode':{'type':Sequelize[_0x96f5('0x2')]},'destcontext':{'type':Sequelize[_0x96f5('0x2')]},'destexten':{'type':Sequelize[_0x96f5('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x96f5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x96f5('0x2')]},'transfer':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x96f5('0x2')],'comment':_0x96f5('0x6')},'transferexten':{'type':Sequelize[_0x96f5('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x96f5('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c2c=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x3c2c,0x160));var _0xc3c2=function(_0x4dc88d,_0x449c69){_0x4dc88d=_0x4dc88d-0x0;var _0x17c5cb=_0x3c2c[_0x4dc88d];return _0x17c5cb;};'use strict';var Sequelize=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]={'type':{'type':Sequelize[_0xc3c2('0x2')]},'uniqueid':{'type':Sequelize[_0xc3c2('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc3c2('0x2')]},'interface':{'type':Sequelize[_0xc3c2('0x2')]},'membername':{'type':Sequelize[_0xc3c2('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc3c2('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xc3c2('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc3c2('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc3c2('0x3')]},'holdtime':{'type':Sequelize[_0xc3c2('0x4')]},'agentcomplete':{'type':Sequelize[_0xc3c2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc3c2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc3c2('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xc3c2('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc3c2('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc3c2('0x2')]},'connectedlinename':{'type':Sequelize[_0xc3c2('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3c2('0x2')]},'context':{'type':Sequelize[_0xc3c2('0x2')]},'exten':{'type':Sequelize[_0xc3c2('0x2')]},'priority':{'type':Sequelize[_0xc3c2('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc3c2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc3c2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc3c2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc3c2('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc3c2('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xc3c2('0x2')]},'destpriority':{'type':Sequelize[_0xc3c2('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc3c2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc3c2('0x2')]},'transfer':{'type':Sequelize[_0xc3c2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc3c2('0x2')],'comment':_0xc3c2('0x6')},'transferexten':{'type':Sequelize[_0xc3c2('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7c1fa57..4761d3e 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(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 6d73e2b..954b950 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 _0x4b84=['rimraf','../../config/environment','VoiceAgentReport','uniqueid','lodash','util','moment','path'];(function(_0x54b536,_0x4777b4){var _0x77c92d=function(_0x81cbdc){while(--_0x81cbdc){_0x54b536['push'](_0x54b536['shift']());}};_0x77c92d(++_0x4777b4);}(_0x4b84,0x1cc));var _0x44b8=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x4b84[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x44b8('0x7'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','lodash','util','moment'];(function(_0x35f901,_0x4f5415){var _0x5ac5cb=function(_0x512b36){while(--_0x512b36){_0x35f901['push'](_0x35f901['shift']());}};_0x5ac5cb(++_0x4f5415);}(_0xe14b,0x93));var _0xbe14=function(_0x2d05d4,_0x439518){_0x2d05d4=_0x2d05d4-0x0;var _0x1ae058=_0xe14b[_0x2d05d4];return _0x1ae058;};'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':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 24ce163..ba390a5 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 _0xbfeb=['VoiceAgentReport','body','options','raw','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','CreateVoiceAgentReport'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0xbfeb,0x153));var _0xbbfe=function(_0x1b1302,_0x41b39d){_0x1b1302=_0x1b1302-0x0;var _0x35def9=_0xbfeb[_0x1b1302];return _0x35def9;};'use strict';var _=require(_0xbbfe('0x0'));var util=require(_0xbbfe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbfe('0x2'));var db=require(_0xbbfe('0x3'))['db'];var utils=require(_0xbbfe('0x4'));var logger=require(_0xbbfe('0x5'))(_0xbbfe('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbbfe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x544268,_0x45e24a,_0x34a016){return new BPromise(function(_0x2dff01,_0x303105){return client[_0xbbfe('0x8')](_0x544268,_0x34a016)[_0xbbfe('0x9')](function(_0x3eed06){logger[_0xbbfe('0xa')](_0xbbfe('0xb'),_0x45e24a,_0xbbfe('0xc'));logger[_0xbbfe('0xd')](_0xbbfe('0xe'),_0x45e24a,_0xbbfe('0xc'),JSON[_0xbbfe('0xf')](_0x3eed06));if(_0x3eed06['error']){if(_0x3eed06['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x45e24a,_0x3eed06['error']['message']);return _0x303105(_0x3eed06['error'][_0xbbfe('0x10')]);}logger[_0xbbfe('0x11')](_0xbbfe('0xb'),_0x45e24a,_0x3eed06[_0xbbfe('0x11')][_0xbbfe('0x10')]);return _0x2dff01(_0x3eed06[_0xbbfe('0x11')]['message']);}else{logger[_0xbbfe('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x45e24a,_0xbbfe('0xc'));_0x2dff01(_0x3eed06[_0xbbfe('0x12')][_0xbbfe('0x10')]);}})[_0xbbfe('0x13')](function(_0xa65d13){logger['error'](_0xbbfe('0xb'),_0x45e24a,_0xa65d13);_0x303105(_0xa65d13);});});}exports[_0xbbfe('0x14')]=function(_0x4f0054){var _0x13ab55=this;return new Promise(function(_0x4a7b63,_0x1499ce){return db[_0xbbfe('0x15')]['create'](_0x4f0054[_0xbbfe('0x16')],{'raw':_0x4f0054['options']?_0x4f0054[_0xbbfe('0x17')][_0xbbfe('0x18')]===undefined?!![]:![]:!![]})[_0xbbfe('0x9')](function(_0x3964a6){logger[_0xbbfe('0xa')]('CreateVoiceAgentReport',_0x4f0054);logger[_0xbbfe('0xd')](_0xbbfe('0x14'),_0x4f0054,JSON[_0xbbfe('0xf')](_0x3964a6));_0x4a7b63(_0x3964a6);})['catch'](function(_0x358e64){logger[_0xbbfe('0x11')]('CreateVoiceAgentReport',_0x358e64[_0xbbfe('0x10')],_0x4f0054);_0x1499ce(_0x13ab55[_0xbbfe('0x11')](0x1f4,_0x358e64[_0xbbfe('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4eb986){var _0x1a1769=this;return new Promise(function(_0x82b5e1,_0x550c9b){return db[_0xbbfe('0x15')][_0xbbfe('0x19')](_0x4eb986['body'],{'raw':_0x4eb986['options']?_0x4eb986[_0xbbfe('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eb986[_0xbbfe('0x17')]?_0x4eb986['options'][_0xbbfe('0x1a')]||null:null,'attributes':_0x4eb986[_0xbbfe('0x17')]?_0x4eb986[_0xbbfe('0x17')][_0xbbfe('0x1b')]||null:null,'limit':_0x4eb986[_0xbbfe('0x17')]?_0x4eb986[_0xbbfe('0x17')][_0xbbfe('0x1c')]||null:null})[_0xbbfe('0x9')](function(_0x536746){logger[_0xbbfe('0xa')](_0xbbfe('0x1d'),_0x4eb986);logger[_0xbbfe('0xd')](_0xbbfe('0x1d'),_0x4eb986,JSON['stringify'](_0x536746));_0x82b5e1(_0x536746);})[_0xbbfe('0x13')](function(_0x25a0f3){logger['error']('UpdateVoiceAgentReport',_0x25a0f3['message'],_0x4eb986);_0x550c9b(_0x1a1769[_0xbbfe('0x11')](0x1f4,_0x25a0f3[_0xbbfe('0x10')]));});});}; \ No newline at end of file +var _0xafc2=['options','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body'];(function(_0x2dd17a,_0x466a4c){var _0x24c1b9=function(_0x496652){while(--_0x496652){_0x2dd17a['push'](_0x2dd17a['shift']());}};_0x24c1b9(++_0x466a4c);}(_0xafc2,0x15b));var _0x2afc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xafc2[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2afc('0x0'));var util=require('util');var moment=require(_0x2afc('0x1'));var BPromise=require(_0x2afc('0x2'));var rs=require(_0x2afc('0x3'));var fs=require('fs');var Redis=require(_0x2afc('0x4'));var db=require(_0x2afc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2afc('0x6'))('rpc');var config=require(_0x2afc('0x7'));var jayson=require(_0x2afc('0x8'));var client=jayson[_0x2afc('0x9')][_0x2afc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b104a,_0x32e295,_0x499c3d){return new BPromise(function(_0x2c6643,_0x2590f5){return client[_0x2afc('0xb')](_0x4b104a,_0x499c3d)[_0x2afc('0xc')](function(_0x341d7a){logger[_0x2afc('0xd')](_0x2afc('0xe'),_0x32e295,_0x2afc('0xf'));logger[_0x2afc('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x32e295,_0x2afc('0xf'),JSON[_0x2afc('0x11')](_0x341d7a));if(_0x341d7a[_0x2afc('0x12')]){if(_0x341d7a[_0x2afc('0x12')][_0x2afc('0x13')]===0x1f4){logger['error'](_0x2afc('0xe'),_0x32e295,_0x341d7a[_0x2afc('0x12')][_0x2afc('0x14')]);return _0x2590f5(_0x341d7a['error'][_0x2afc('0x14')]);}logger[_0x2afc('0x12')](_0x2afc('0xe'),_0x32e295,_0x341d7a[_0x2afc('0x12')][_0x2afc('0x14')]);return _0x2c6643(_0x341d7a['error'][_0x2afc('0x14')]);}else{logger[_0x2afc('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x32e295,_0x2afc('0xf'));_0x2c6643(_0x341d7a[_0x2afc('0x15')][_0x2afc('0x14')]);}})[_0x2afc('0x16')](function(_0xf1f2c3){logger[_0x2afc('0x12')](_0x2afc('0xe'),_0x32e295,_0xf1f2c3);_0x2590f5(_0xf1f2c3);});});}exports[_0x2afc('0x17')]=function(_0x31fb2b){var _0x21a837=this;return new Promise(function(_0x424419,_0x55f848){return db[_0x2afc('0x18')][_0x2afc('0x19')](_0x31fb2b[_0x2afc('0x1a')],{'raw':_0x31fb2b[_0x2afc('0x1b')]?_0x31fb2b[_0x2afc('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2afc('0xc')](function(_0x470df4){logger[_0x2afc('0xd')](_0x2afc('0x17'),_0x31fb2b);logger[_0x2afc('0x10')](_0x2afc('0x17'),_0x31fb2b,JSON['stringify'](_0x470df4));_0x424419(_0x470df4);})[_0x2afc('0x16')](function(_0x42dcfa){logger['error'](_0x2afc('0x17'),_0x42dcfa[_0x2afc('0x14')],_0x31fb2b);_0x55f848(_0x21a837['error'](0x1f4,_0x42dcfa[_0x2afc('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x42e12d){var _0x3f1a4f=this;return new Promise(function(_0x5ebf08,_0x571378){return db[_0x2afc('0x18')][_0x2afc('0x1c')](_0x42e12d['body'],{'raw':_0x42e12d['options']?_0x42e12d[_0x2afc('0x1b')][_0x2afc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42e12d[_0x2afc('0x1b')]?_0x42e12d[_0x2afc('0x1b')][_0x2afc('0x1e')]||null:null,'attributes':_0x42e12d[_0x2afc('0x1b')]?_0x42e12d[_0x2afc('0x1b')][_0x2afc('0x1f')]||null:null,'limit':_0x42e12d[_0x2afc('0x1b')]?_0x42e12d[_0x2afc('0x1b')][_0x2afc('0x20')]||null:null})[_0x2afc('0xc')](function(_0x3d9e85){logger[_0x2afc('0xd')](_0x2afc('0x21'),_0x42e12d);logger[_0x2afc('0x10')](_0x2afc('0x21'),_0x42e12d,JSON['stringify'](_0x3d9e85));_0x5ebf08(_0x3d9e85);})[_0x2afc('0x16')](function(_0xee6940){logger[_0x2afc('0x12')]('UpdateVoiceAgentReport',_0xee6940[_0x2afc('0x14')],_0x42e12d);_0x571378(_0x3f1a4f[_0x2afc('0x12')](0x1f4,_0xee6940[_0x2afc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a558b83..0794f67 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 _0xadb8=['/describe','describe','post','/:id','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0xadb8,0x1d0));var _0x8adb=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0xadb8[_0xca04ff];return _0x6b547;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require(_0x8adb('0x7'));router['get']('/',auth[_0x8adb('0x8')](),controller[_0x8adb('0x9')]);router[_0x8adb('0xa')](_0x8adb('0xb'),auth[_0x8adb('0x8')](),controller[_0x8adb('0xc')]);router[_0x8adb('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8adb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8adb('0xe'),auth[_0x8adb('0x8')](),controller[_0x8adb('0xf')]);router[_0x8adb('0x10')](_0x8adb('0xe'),auth[_0x8adb('0x8')](),controller[_0x8adb('0x11')]);module[_0x8adb('0x12')]=router; \ No newline at end of file +var _0x0faf=['./voiceCallReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e22c1,_0x11b231){var _0x3a2338=function(_0x49a155){while(--_0x49a155){_0x2e22c1['push'](_0x2e22c1['shift']());}};_0x3a2338(++_0x11b231);}(_0x0faf,0x132));var _0xf0fa=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0x0faf[_0x17249c];return _0x324e7b;};'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'),auth[_0xf0fa('0xa')](),controller['describe']);router[_0xf0fa('0xc')](_0xf0fa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xf0fa('0xf')]('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x10')]);router[_0xf0fa('0x11')](_0xf0fa('0xe'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x12')]);router[_0xf0fa('0x13')]('/:id',auth[_0xf0fa('0xa')](),controller['destroy']);module[_0xf0fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index feb0253..3f872b1 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 _0xd190=['exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize'];(function(_0x1147d9,_0x2f1aad){var _0x376733=function(_0x351405){while(--_0x351405){_0x1147d9['push'](_0x1147d9['shift']());}};_0x376733(++_0x2f1aad);}(_0xd190,0xa7));var _0x0d19=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0xd190[_0x4ca6a4];return _0x120555;};'use strict';var Sequelize=require(_0x0d19('0x0'));module[_0x0d19('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0d19('0x2')](_0x0d19('0x3'),_0x0d19('0x4'),_0x0d19('0x5'),_0x0d19('0x6'),_0x0d19('0x7'),'dialer')},'tag':{'type':Sequelize[_0x0d19('0x8')]},'accountcode':{'type':Sequelize[_0x0d19('0x8')]},'source':{'type':Sequelize[_0x0d19('0x8')]},'destination':{'type':Sequelize[_0x0d19('0x8')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d19('0x8')]},'channel':{'type':Sequelize[_0x0d19('0x8')]},'destinationchannel':{'type':Sequelize[_0x0d19('0x8')]},'lastapplication':{'type':Sequelize[_0x0d19('0x8')]},'lastdata':{'type':Sequelize[_0x0d19('0x9')]},'starttime':{'type':Sequelize[_0x0d19('0xa')]},'systemanswertime':{'type':Sequelize[_0x0d19('0xa')]},'answertime':{'type':Sequelize[_0x0d19('0xa')]},'endtime':{'type':Sequelize[_0x0d19('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x0d19('0xb')]},'mohtime':{'type':Sequelize[_0x0d19('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0d19('0x8')]},'amaflags':{'type':Sequelize[_0x0d19('0x8')]},'userfield':{'type':Sequelize[_0x0d19('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0d19('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x0d19('0x8')]},'note':{'type':Sequelize[_0x0d19('0x8')]},'prefix':{'type':Sequelize[_0x0d19('0x8')]},'routeid':{'type':Sequelize[_0x0d19('0xb')]},'sipcallid':{'type':Sequelize[_0x0d19('0x8')]}}; \ No newline at end of file +var _0x8f1a=['inbound','internal','outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x5cb427,_0x4f4f7e){_0x5cb427=_0x5cb427-0x0;var _0x13ca46=_0x8f1a[_0x5cb427];return _0x13ca46;};'use strict';var Sequelize=require(_0xa8f1('0x0'));module[_0xa8f1('0x1')]={'uniqueid':{'type':Sequelize[_0xa8f1('0x2')]},'type':{'type':Sequelize[_0xa8f1('0x3')](_0xa8f1('0x4'),_0xa8f1('0x5'),_0xa8f1('0x6'),_0xa8f1('0x7'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xa8f1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xa8f1('0x2')]},'destination':{'type':Sequelize[_0xa8f1('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa8f1('0x2')]},'channel':{'type':Sequelize[_0xa8f1('0x2')]},'destinationchannel':{'type':Sequelize[_0xa8f1('0x2')]},'lastapplication':{'type':Sequelize[_0xa8f1('0x2')]},'lastdata':{'type':Sequelize[_0xa8f1('0x8')]},'starttime':{'type':Sequelize[_0xa8f1('0x9')]},'systemanswertime':{'type':Sequelize[_0xa8f1('0x9')]},'answertime':{'type':Sequelize[_0xa8f1('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xa8f1('0xa')]},'billableseconds':{'type':Sequelize[_0xa8f1('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa8f1('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa8f1('0x2')]},'userDisposition':{'type':Sequelize[_0xa8f1('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xa8f1('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa8f1('0x2')]},'prefix':{'type':Sequelize[_0xa8f1('0x2')]},'routeid':{'type':Sequelize[_0xa8f1('0xa')]},'sipcallid':{'type':Sequelize[_0xa8f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ec0c3d0..c14d07b 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 _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(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0xadb5,0xad));var _0x5adb=function(_0x14d575,_0x37bd83){_0x14d575=_0x14d575-0x0;var _0x20a96f=_0xadb5[_0x14d575];return _0x20a96f;};'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 +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','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','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0xe5aced,_0x176303){var _0x1360c0=function(_0x48808c){while(--_0x48808c){_0xe5aced['push'](_0xe5aced['shift']());}};_0x1360c0(++_0x176303);}(_0xdb28,0x106));var _0x8db2=function(_0x4cb736,_0x37d026){_0x4cb736=_0x4cb736-0x0;var _0x5cd525=_0xdb28[_0x4cb736];return _0x5cd525;};'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'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 713a8f6..b49d38b 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 _0x1307=['uniqueid','lodash','api','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','report_call'];(function(_0x97567a,_0x374844){var _0x27d1bc=function(_0x32a876){while(--_0x32a876){_0x97567a['push'](_0x97567a['shift']());}};_0x27d1bc(++_0x374844);}(_0x1307,0xa1));var _0x7130=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x1307[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x7130('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7130('0x1'));var moment=require('moment');var BPromise=require(_0x7130('0x2'));var rp=require(_0x7130('0x3'));var fs=require('fs');var path=require(_0x7130('0x4'));var rimraf=require(_0x7130('0x5'));var config=require('../../config/environment');var attributes=require(_0x7130('0x6'));module[_0x7130('0x7')]=function(_0xea5511,_0x45af94){return _0xea5511['define']('VoiceCallReport',attributes,{'tableName':_0x7130('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7130('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2772=['exports','define','VoiceCallReport','report_call','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2abb06,_0x43932a){var _0x2a5cfd=function(_0x136e28){while(--_0x136e28){_0x2abb06['push'](_0x2abb06['shift']());}};_0x2a5cfd(++_0x43932a);}(_0x2772,0x100));var _0x2277=function(_0x130174,_0x59912c){_0x130174=_0x130174-0x0;var _0xd34e7f=_0x2772[_0x130174];return _0xd34e7f;};'use strict';var _=require('lodash');var util=require(_0x2277('0x0'));var logger=require('../../config/logger')(_0x2277('0x1'));var moment=require(_0x2277('0x2'));var BPromise=require(_0x2277('0x3'));var rp=require(_0x2277('0x4'));var fs=require('fs');var path=require(_0x2277('0x5'));var rimraf=require(_0x2277('0x6'));var config=require(_0x2277('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x2277('0x8')]=function(_0x11374a,_0x31d328){return _0x11374a[_0x2277('0x9')](_0x2277('0xa'),attributes,{'tableName':_0x2277('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 7a62088..cc20058 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 _0x7e48=['info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2a7b11,_0x3e5ba1){var _0x4bb40f=function(_0x20b669){while(--_0x20b669){_0x2a7b11['push'](_0x2a7b11['shift']());}};_0x4bb40f(++_0x3e5ba1);}(_0x7e48,0x1d5));var _0x87e4=function(_0x180624,_0x4fe917){_0x180624=_0x180624-0x0;var _0x311409=_0x7e48[_0x180624];return _0x311409;};'use strict';var _=require(_0x87e4('0x0'));var util=require(_0x87e4('0x1'));var moment=require(_0x87e4('0x2'));var BPromise=require(_0x87e4('0x3'));var rs=require(_0x87e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87e4('0x6'))(_0x87e4('0x7'));var config=require(_0x87e4('0x8'));var jayson=require(_0x87e4('0x9'));var client=jayson[_0x87e4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc6a5,_0x362d6b,_0x5bb393){return new BPromise(function(_0x5caf2a,_0x2222e5){return client[_0x87e4('0xb')](_0x5bc6a5,_0x5bb393)['then'](function(_0x2dd84a){logger[_0x87e4('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x362d6b,_0x87e4('0xd'));logger['debug'](_0x87e4('0xe'),_0x362d6b,'request\x20sent',JSON['stringify'](_0x2dd84a));if(_0x2dd84a[_0x87e4('0xf')]){if(_0x2dd84a[_0x87e4('0xf')]['code']===0x1f4){logger[_0x87e4('0xf')](_0x87e4('0x10'),_0x362d6b,_0x2dd84a[_0x87e4('0xf')][_0x87e4('0x11')]);return _0x2222e5(_0x2dd84a[_0x87e4('0xf')][_0x87e4('0x11')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x362d6b,_0x2dd84a[_0x87e4('0xf')][_0x87e4('0x11')]);return _0x5caf2a(_0x2dd84a[_0x87e4('0xf')][_0x87e4('0x11')]);}else{logger[_0x87e4('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x362d6b,_0x87e4('0xd'));_0x5caf2a(_0x2dd84a['result']['message']);}})[_0x87e4('0x12')](function(_0x2a7969){logger[_0x87e4('0xf')](_0x87e4('0x10'),_0x362d6b,_0x2a7969);_0x2222e5(_0x2a7969);});});}exports[_0x87e4('0x13')]=function(_0x13d68f){var _0x13b649=this;return new Promise(function(_0x5ee080,_0x52aac9){return db[_0x87e4('0x14')][_0x87e4('0x15')]({'raw':_0x13d68f[_0x87e4('0x16')]?_0x13d68f[_0x87e4('0x16')][_0x87e4('0x17')]===undefined?!![]:![]:!![],'where':_0x13d68f[_0x87e4('0x16')]?_0x13d68f['options'][_0x87e4('0x18')]||null:null,'attributes':_0x13d68f['options']?_0x13d68f['options'][_0x87e4('0x19')]||null:null,'limit':_0x13d68f['options']?_0x13d68f['options'][_0x87e4('0x1a')]||null:null,'include':_0x13d68f[_0x87e4('0x16')]?_0x13d68f[_0x87e4('0x16')][_0x87e4('0x1b')]?_[_0x87e4('0x1c')](_0x13d68f[_0x87e4('0x16')]['include'],function(_0x3a44c9){return{'model':db[_0x3a44c9[_0x87e4('0x1d')]],'as':_0x3a44c9['as'],'attributes':_0x3a44c9['attributes'],'include':_0x3a44c9[_0x87e4('0x1b')]?_[_0x87e4('0x1c')](_0x3a44c9[_0x87e4('0x1b')],function(_0x382c13){return{'model':db[_0x382c13[_0x87e4('0x1d')]],'as':_0x382c13['as'],'attributes':_0x382c13['attributes'],'include':_0x382c13[_0x87e4('0x1b')]?_[_0x87e4('0x1c')](_0x382c13[_0x87e4('0x1b')],function(_0x37f13a){return{'model':db[_0x37f13a[_0x87e4('0x1d')]],'as':_0x37f13a['as'],'attributes':_0x37f13a['attributes']};}):[]};}):[]};}):[]:[]})[_0x87e4('0x1e')](function(_0x52bd31){logger['info'](_0x87e4('0x13'),_0x13d68f);logger[_0x87e4('0x1f')](_0x87e4('0x13'),_0x13d68f,JSON[_0x87e4('0x20')](_0x52bd31));_0x5ee080(_0x52bd31);})['catch'](function(_0x1ee09b){logger[_0x87e4('0xf')](_0x87e4('0x13'),_0x1ee09b['message'],_0x13d68f);_0x52aac9(_0x13b649['error'](0x1f4,_0x1ee09b[_0x87e4('0x11')]));});});};exports[_0x87e4('0x21')]=function(_0xcb96b0){var _0x58ca6d=this;return new Promise(function(_0x29ad27,_0x49eb47){return db[_0x87e4('0x14')][_0x87e4('0x22')](_0xcb96b0[_0x87e4('0x23')],{'raw':_0xcb96b0[_0x87e4('0x16')]?_0xcb96b0[_0x87e4('0x16')][_0x87e4('0x17')]===undefined?!![]:![]:!![]})[_0x87e4('0x1e')](function(_0x35eb59){logger[_0x87e4('0xc')](_0x87e4('0x21'),_0xcb96b0);logger['debug'](_0x87e4('0x21'),_0xcb96b0,JSON[_0x87e4('0x20')](_0x35eb59));_0x29ad27(_0x35eb59);})['catch'](function(_0x3e2227){logger['error']('CreateVoiceCallReport',_0x3e2227[_0x87e4('0x11')],_0xcb96b0);_0x49eb47(_0x58ca6d[_0x87e4('0xf')](0x1f4,_0x3e2227[_0x87e4('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x2289cf){var _0x374f16=this;return new Promise(function(_0x42eb14,_0x409b87){return db[_0x87e4('0x14')]['update'](_0x2289cf[_0x87e4('0x23')],{'raw':_0x2289cf[_0x87e4('0x16')]?_0x2289cf[_0x87e4('0x16')][_0x87e4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2289cf['options']?_0x2289cf[_0x87e4('0x16')][_0x87e4('0x18')]||null:null,'attributes':_0x2289cf['options']?_0x2289cf['options'][_0x87e4('0x19')]||null:null,'limit':_0x2289cf[_0x87e4('0x16')]?_0x2289cf['options'][_0x87e4('0x1a')]||null:null})[_0x87e4('0x1e')](function(_0x1dcba1){logger['info'](_0x87e4('0x24'),_0x2289cf);logger['debug']('UpdateVoiceCallReport',_0x2289cf,JSON[_0x87e4('0x20')](_0x1dcba1));_0x42eb14(_0x1dcba1);})[_0x87e4('0x12')](function(_0x58f976){logger[_0x87e4('0xf')]('UpdateVoiceCallReport',_0x58f976['message'],_0x2289cf);_0x409b87(_0x374f16[_0x87e4('0xf')](0x1f4,_0x58f976['message']));});});}; \ No newline at end of file +var _0xf0eb=['debug','catch','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model'];(function(_0x110aa3,_0x30c7a6){var _0x1f588e=function(_0x80a8f9){while(--_0x80a8f9){_0x110aa3['push'](_0x110aa3['shift']());}};_0x1f588e(++_0x30c7a6);}(_0xf0eb,0x15b));var _0xbf0e=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xf0eb[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0xbf0e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf0e('0x1'));var rs=require(_0xbf0e('0x2'));var fs=require('fs');var Redis=require(_0xbf0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf0e('0x4'));var logger=require(_0xbf0e('0x5'))('rpc');var config=require(_0xbf0e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbf0e('0x7')][_0xbf0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f1bb3,_0x279e70,_0x10fdbe){return new BPromise(function(_0x4ee15d,_0x1259f6){return client['request'](_0x5f1bb3,_0x10fdbe)[_0xbf0e('0x9')](function(_0x4d2125){logger[_0xbf0e('0xa')](_0xbf0e('0xb'),_0x279e70,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x279e70,_0xbf0e('0xc'),JSON[_0xbf0e('0xd')](_0x4d2125));if(_0x4d2125[_0xbf0e('0xe')]){if(_0x4d2125[_0xbf0e('0xe')][_0xbf0e('0xf')]===0x1f4){logger[_0xbf0e('0xe')](_0xbf0e('0xb'),_0x279e70,_0x4d2125['error'][_0xbf0e('0x10')]);return _0x1259f6(_0x4d2125['error'][_0xbf0e('0x10')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x279e70,_0x4d2125[_0xbf0e('0xe')][_0xbf0e('0x10')]);return _0x4ee15d(_0x4d2125[_0xbf0e('0xe')][_0xbf0e('0x10')]);}else{logger[_0xbf0e('0xa')](_0xbf0e('0xb'),_0x279e70,_0xbf0e('0xc'));_0x4ee15d(_0x4d2125['result'][_0xbf0e('0x10')]);}})['catch'](function(_0x5ef9c2){logger[_0xbf0e('0xe')](_0xbf0e('0xb'),_0x279e70,_0x5ef9c2);_0x1259f6(_0x5ef9c2);});});}exports[_0xbf0e('0x11')]=function(_0x2ec6f){var _0xe684a6=this;return new Promise(function(_0x1fee43,_0x5e2b3c){return db[_0xbf0e('0x12')]['findAll']({'raw':_0x2ec6f[_0xbf0e('0x13')]?_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x14')]===undefined?!![]:![]:!![],'where':_0x2ec6f[_0xbf0e('0x13')]?_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x15')]||null:null,'attributes':_0x2ec6f['options']?_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x16')]||null:null,'limit':_0x2ec6f['options']?_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x17')]||null:null,'include':_0x2ec6f[_0xbf0e('0x13')]?_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x18')]?_[_0xbf0e('0x19')](_0x2ec6f[_0xbf0e('0x13')][_0xbf0e('0x18')],function(_0x3b99b8){return{'model':db[_0x3b99b8['model']],'as':_0x3b99b8['as'],'attributes':_0x3b99b8[_0xbf0e('0x16')],'include':_0x3b99b8[_0xbf0e('0x18')]?_[_0xbf0e('0x19')](_0x3b99b8[_0xbf0e('0x18')],function(_0x415d73){return{'model':db[_0x415d73[_0xbf0e('0x1a')]],'as':_0x415d73['as'],'attributes':_0x415d73[_0xbf0e('0x16')],'include':_0x415d73['include']?_[_0xbf0e('0x19')](_0x415d73[_0xbf0e('0x18')],function(_0x3f6877){return{'model':db[_0x3f6877[_0xbf0e('0x1a')]],'as':_0x3f6877['as'],'attributes':_0x3f6877['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf0e('0x9')](function(_0x26fb2b){logger['info'](_0xbf0e('0x11'),_0x2ec6f);logger[_0xbf0e('0x1b')](_0xbf0e('0x11'),_0x2ec6f,JSON['stringify'](_0x26fb2b));_0x1fee43(_0x26fb2b);})[_0xbf0e('0x1c')](function(_0x3b1abd){logger[_0xbf0e('0xe')](_0xbf0e('0x11'),_0x3b1abd[_0xbf0e('0x10')],_0x2ec6f);_0x5e2b3c(_0xe684a6[_0xbf0e('0xe')](0x1f4,_0x3b1abd[_0xbf0e('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x35479d){var _0x247e11=this;return new Promise(function(_0xd148d5,_0x421d15){return db[_0xbf0e('0x12')][_0xbf0e('0x1d')](_0x35479d['body'],{'raw':_0x35479d['options']?_0x35479d[_0xbf0e('0x13')][_0xbf0e('0x14')]===undefined?!![]:![]:!![]})[_0xbf0e('0x9')](function(_0x4a341c){logger[_0xbf0e('0xa')](_0xbf0e('0x1e'),_0x35479d);logger[_0xbf0e('0x1b')]('CreateVoiceCallReport',_0x35479d,JSON[_0xbf0e('0xd')](_0x4a341c));_0xd148d5(_0x4a341c);})[_0xbf0e('0x1c')](function(_0x113544){logger[_0xbf0e('0xe')](_0xbf0e('0x1e'),_0x113544[_0xbf0e('0x10')],_0x35479d);_0x421d15(_0x247e11['error'](0x1f4,_0x113544['message']));});});};exports[_0xbf0e('0x1f')]=function(_0x53e80e){var _0x120a2c=this;return new Promise(function(_0x4c2048,_0x43e9b5){return db[_0xbf0e('0x12')][_0xbf0e('0x20')](_0x53e80e[_0xbf0e('0x21')],{'raw':_0x53e80e[_0xbf0e('0x13')]?_0x53e80e[_0xbf0e('0x13')][_0xbf0e('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e80e[_0xbf0e('0x13')]?_0x53e80e[_0xbf0e('0x13')][_0xbf0e('0x15')]||null:null,'attributes':_0x53e80e[_0xbf0e('0x13')]?_0x53e80e['options'][_0xbf0e('0x16')]||null:null,'limit':_0x53e80e[_0xbf0e('0x13')]?_0x53e80e[_0xbf0e('0x13')][_0xbf0e('0x17')]||null:null})[_0xbf0e('0x9')](function(_0x3c669f){logger[_0xbf0e('0xa')](_0xbf0e('0x1f'),_0x53e80e);logger['debug'](_0xbf0e('0x1f'),_0x53e80e,JSON['stringify'](_0x3c669f));_0x4c2048(_0x3c669f);})['catch'](function(_0x127e63){logger[_0xbf0e('0xe')](_0xbf0e('0x1f'),_0x127e63[_0xbf0e('0x10')],_0x53e80e);_0x43e9b5(_0x120a2c[_0xbf0e('0xe')](0x1f4,_0x127e63[_0xbf0e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f1c2534..e5db5d1 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 _0xe439=['isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../config/environment','./voiceChanSpy.controller','get','/:id'];(function(_0x3c98c7,_0x5cc20c){var _0x59d663=function(_0x40b5d6){while(--_0x40b5d6){_0x3c98c7['push'](_0x3c98c7['shift']());}};_0x59d663(++_0x5cc20c);}(_0xe439,0x19b));var _0x9e43=function(_0x49b3da,_0x49243e){_0x49b3da=_0x49b3da-0x0;var _0x58ebaf=_0xe439[_0x49b3da];return _0x58ebaf;};'use strict';var multer=require(_0x9e43('0x0'));var util=require('util');var path=require(_0x9e43('0x1'));var timeout=require(_0x9e43('0x2'));var express=require(_0x9e43('0x3'));var router=express[_0x9e43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e43('0x5'));var controller=require(_0x9e43('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9e43('0x7')](_0x9e43('0x8'),auth[_0x9e43('0x9')](),controller['show']);router['post']('/',auth[_0x9e43('0x9')](),controller[_0x9e43('0xa')]);router[_0x9e43('0xb')](_0x9e43('0x8'),auth['isAuthenticated'](),controller[_0x9e43('0xc')]);router[_0x9e43('0xd')](_0x9e43('0x8'),auth[_0x9e43('0x9')](),controller['destroy']);module[_0x9e43('0xe')]=router; \ No newline at end of file +var _0x917d=['isAuthenticated','show','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x46f46d,_0x243927){var _0x51f0fb=function(_0x4e1f41){while(--_0x4e1f41){_0x46f46d['push'](_0x46f46d['shift']());}};_0x51f0fb(++_0x243927);}(_0x917d,0xf5));var _0xd917=function(_0x579931,_0x44a27f){_0x579931=_0x579931-0x0;var _0x3b784a=_0x917d[_0x579931];return _0x3b784a;};'use strict';var multer=require('multer');var util=require(_0xd917('0x0'));var path=require(_0xd917('0x1'));var timeout=require(_0xd917('0x2'));var express=require(_0xd917('0x3'));var router=express[_0xd917('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd917('0x5'));var config=require(_0xd917('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xd917('0x7')]('/',auth['isAuthenticated'](),controller[_0xd917('0x8')]);router[_0xd917('0x7')](_0xd917('0x9'),auth[_0xd917('0xa')](),controller[_0xd917('0xb')]);router['post']('/',auth[_0xd917('0xa')](),controller['create']);router['put'](_0xd917('0x9'),auth[_0xd917('0xa')](),controller['update']);router[_0xd917('0xc')](_0xd917('0x9'),auth[_0xd917('0xa')](),controller[_0xd917('0xd')]);module[_0xd917('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ba72ae6..b0c3347 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 _0x266e=['STRING','name','options','split','BOOLEAN','sequelize','exports'];(function(_0x2512ce,_0x525ffe){var _0x4c5923=function(_0x32d5c1){while(--_0x32d5c1){_0x2512ce['push'](_0x2512ce['shift']());}};_0x4c5923(++_0x525ffe);}(_0x266e,0x132));var _0xe266=function(_0x19144d,_0x342824){_0x19144d=_0x19144d-0x0;var _0xf4934f=_0x266e[_0x19144d];return _0xf4934f;};'use strict';var Sequelize=require(_0xe266('0x0'));module[_0xe266('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe266('0x2')],'unique':_0xe266('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xc43a25){this['setDataValue'](_0xe266('0x4'),_0xc43a25?_0xc43a25['join'](''):[]);},'get':function(){return this['getDataValue'](_0xe266('0x4'))?this['getDataValue'](_0xe266('0x4'))[_0xe266('0x5')](''):[];}},'auth':{'type':Sequelize[_0xe266('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe266('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe266('0x2')]}}; \ No newline at end of file +var _0xd568=['sequelize','exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x567798,_0x6b8731){var _0x15015f=function(_0x4be72d){while(--_0x4be72d){_0x567798['push'](_0x567798['shift']());}};_0x15015f(++_0x6b8731);}(_0xd568,0x99));var _0x8d56=function(_0x3a2cb3,_0x1edf13){_0x3a2cb3=_0x3a2cb3-0x0;var _0x1d3dab=_0xd568[_0x3a2cb3];return _0x1d3dab;};'use strict';var Sequelize=require(_0x8d56('0x0'));module[_0x8d56('0x1')]={'name':{'type':Sequelize[_0x8d56('0x2')]},'prefix':{'type':Sequelize[_0x8d56('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x42a18c){this[_0x8d56('0x3')](_0x8d56('0x4'),_0x42a18c?_0x42a18c[_0x8d56('0x5')](''):[]);},'get':function(){return this[_0x8d56('0x6')](_0x8d56('0x4'))?this[_0x8d56('0x6')](_0x8d56('0x4'))[_0x8d56('0x7')](''):[];}},'auth':{'type':Sequelize[_0x8d56('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x8d56('0x2')]},'record':{'type':Sequelize[_0x8d56('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d56('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ac3e3fd..9cf90ad 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 _0xafe6=['merge','VIRTUAL','options','include','findAll','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','ChanSpies','UserProfileResource','destroy','end','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5d3c09,_0x4c8022){var _0x8674f4=function(_0x5c9f4e){while(--_0x5c9f4e){_0x5d3c09['push'](_0x5d3c09['shift']());}};_0x8674f4(++_0x4c8022);}(_0xafe6,0xac));var _0x6afe=function(_0x141d98,_0x2c8a7d){_0x141d98=_0x141d98-0x0;var _0x3600cd=_0xafe6[_0x141d98];return _0x3600cd;};'use strict';var emlformat=require(_0x6afe('0x0'));var rimraf=require(_0x6afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6afe('0x2'));var moment=require(_0x6afe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6afe('0x4'));var path=require(_0x6afe('0x5'));var sox=require(_0x6afe('0x6'));var csv=require(_0x6afe('0x7'));var ejs=require(_0x6afe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6afe('0x9'));var squel=require(_0x6afe('0xa'));var crypto=require(_0x6afe('0xb'));var jsforce=require(_0x6afe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6afe('0x7'));var querystring=require(_0x6afe('0xd'));var Papa=require(_0x6afe('0xe'));var Redis=require(_0x6afe('0xf'));var authService=require(_0x6afe('0x10'));var qs=require(_0x6afe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6afe('0x12'))(_0x6afe('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6afe('0x14'));var db=require(_0x6afe('0x15'))['db'];function respondWithStatusCode(_0x3e75b5,_0x15ea76){_0x15ea76=_0x15ea76||0xcc;return function(_0x1abd61){if(_0x1abd61){return _0x3e75b5[_0x6afe('0x16')](_0x15ea76);}return _0x3e75b5[_0x6afe('0x17')](_0x15ea76)['end']();};}function respondWithResult(_0x31940b,_0x4061bd){_0x4061bd=_0x4061bd||0xc8;return function(_0x473fc9){if(_0x473fc9){return _0x31940b[_0x6afe('0x17')](_0x4061bd)[_0x6afe('0x18')](_0x473fc9);}};}function respondWithFilteredResult(_0x2d3e7d,_0x94ca1){return function(_0x4deb5b){if(_0x4deb5b){var _0x311b1e=typeof _0x94ca1['offset']==='undefined'&&typeof _0x94ca1[_0x6afe('0x19')]===_0x6afe('0x1a');var _0x393967=_0x4deb5b[_0x6afe('0x1b')];var _0x1bc331=_0x311b1e?0x0:_0x94ca1[_0x6afe('0x1c')];var _0x3699e8=_0x311b1e?_0x4deb5b[_0x6afe('0x1b')]:_0x94ca1['offset']+_0x94ca1['limit'];var _0x450069;if(_0x3699e8>=_0x393967){_0x3699e8=_0x393967;_0x450069=0xc8;}else{_0x450069=0xce;}_0x2d3e7d[_0x6afe('0x17')](_0x450069);return _0x2d3e7d[_0x6afe('0x1d')]('Content-Range',_0x1bc331+'-'+_0x3699e8+'/'+_0x393967)['json'](_0x4deb5b);}return null;};}function patchUpdates(_0x4227f0){return function(_0x18ee9f){try{jsonpatch[_0x6afe('0x1e')](_0x18ee9f,_0x4227f0,!![]);}catch(_0x2d1dd9){return BPromise[_0x6afe('0x1f')](_0x2d1dd9);}return _0x18ee9f[_0x6afe('0x20')]();};}function saveUpdates(_0x1f3436,_0x42e461){return function(_0x2ef577){if(_0x2ef577){return _0x2ef577[_0x6afe('0x21')](_0x1f3436)[_0x6afe('0x22')](function(_0x1af882){return _0x1af882;});}return null;};}function removeEntity(_0x397439,_0x23fc00){return function(_0x93d444){if(_0x93d444){return _0x93d444['destroy']()['then'](function(){var _0x160601=_0x93d444['get']({'plain':!![]});var _0x4b0399=_0x6afe('0x23');return db[_0x6afe('0x24')][_0x6afe('0x25')]({'where':{'type':_0x4b0399,'resourceId':_0x160601['id']}})[_0x6afe('0x22')](function(){return _0x93d444;});})[_0x6afe('0x22')](function(){_0x397439[_0x6afe('0x17')](0xcc)[_0x6afe('0x26')]();});}};}function handleEntityNotFound(_0x10fc9e,_0x338ab8){return function(_0x2c6ac3){if(!_0x2c6ac3){_0x10fc9e[_0x6afe('0x16')](0x194);}return _0x2c6ac3;};}function handleError(_0x1ef7fa,_0x1323c0){_0x1323c0=_0x1323c0||0x1f4;return function(_0x56e480){logger[_0x6afe('0x27')](_0x56e480[_0x6afe('0x28')]);if(_0x56e480[_0x6afe('0x29')]){delete _0x56e480['name'];}_0x1ef7fa[_0x6afe('0x17')](_0x1323c0)['send'](_0x56e480);};}exports[_0x6afe('0x2a')]=function(_0x395c3e,_0x48138c){var _0x5ac797={},_0x14af12={},_0x613477={'count':0x0,'rows':[]};var _0xe6f98f=_[_0x6afe('0x2b')](db[_0x6afe('0x2c')][_0x6afe('0x2d')],function(_0x2c1511){return{'name':_0x2c1511[_0x6afe('0x2e')],'type':_0x2c1511[_0x6afe('0x2f')][_0x6afe('0x30')]};});_0x14af12[_0x6afe('0x31')]=_[_0x6afe('0x2b')](_0xe6f98f,_0x6afe('0x29'));_0x14af12[_0x6afe('0x32')]=_[_0x6afe('0x33')](_0x395c3e[_0x6afe('0x32')]);_0x14af12[_0x6afe('0x34')]=_[_0x6afe('0x35')](_0x14af12[_0x6afe('0x31')],_0x14af12[_0x6afe('0x32')]);_0x5ac797[_0x6afe('0x36')]=_['intersection'](_0x14af12['model'],qs[_0x6afe('0x37')](_0x395c3e[_0x6afe('0x32')][_0x6afe('0x37')]));_0x5ac797[_0x6afe('0x36')]=_0x5ac797[_0x6afe('0x36')]['length']?_0x5ac797[_0x6afe('0x36')]:_0x14af12['model'];if(!_0x395c3e['query'][_0x6afe('0x38')](_0x6afe('0x39'))){_0x5ac797[_0x6afe('0x19')]=qs[_0x6afe('0x19')](_0x395c3e['query']['limit']);_0x5ac797[_0x6afe('0x1c')]=qs[_0x6afe('0x1c')](_0x395c3e[_0x6afe('0x32')]['offset']);}_0x5ac797[_0x6afe('0x3a')]=qs[_0x6afe('0x3b')](_0x395c3e[_0x6afe('0x32')][_0x6afe('0x3b')]);_0x5ac797[_0x6afe('0x3c')]=qs[_0x6afe('0x34')](_[_0x6afe('0x3d')](_0x395c3e['query'],_0x14af12[_0x6afe('0x34')]),_0xe6f98f);if(_0x395c3e[_0x6afe('0x32')]['filter']){_0x5ac797['where']=_[_0x6afe('0x3e')](_0x5ac797['where'],{'$or':_[_0x6afe('0x2b')](_0xe6f98f,function(_0x152367){if(_0x152367[_0x6afe('0x2f')]!==_0x6afe('0x3f')){var _0x25de47={};_0x25de47[_0x152367[_0x6afe('0x29')]]={'$like':'%'+_0x395c3e[_0x6afe('0x32')]['filter']+'%'};return _0x25de47;}})});}_0x5ac797=_['merge']({},_0x5ac797,_0x395c3e[_0x6afe('0x40')]);var _0x7bbec2={'where':_0x5ac797[_0x6afe('0x3c')]};return db['VoiceChanSpy']['count'](_0x7bbec2)[_0x6afe('0x22')](function(_0x59d18c){_0x613477[_0x6afe('0x1b')]=_0x59d18c;if(_0x395c3e['query']['includeAll']){_0x5ac797[_0x6afe('0x41')]=[{'all':!![]}];}return db[_0x6afe('0x2c')][_0x6afe('0x42')](_0x5ac797);})['then'](function(_0x1b4a28){_0x613477['rows']=_0x1b4a28;return _0x613477;})['then'](respondWithFilteredResult(_0x48138c,_0x5ac797))[_0x6afe('0x43')](handleError(_0x48138c,null));};exports[_0x6afe('0x44')]=function(_0x2e21c2,_0x18bba4){var _0x185b96={'raw':![],'where':{'id':_0x2e21c2['params']['id']}},_0x544282={};_0x544282[_0x6afe('0x31')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x544282[_0x6afe('0x32')]=_[_0x6afe('0x33')](_0x2e21c2[_0x6afe('0x32')]);_0x544282[_0x6afe('0x34')]=_['intersection'](_0x544282[_0x6afe('0x31')],_0x544282[_0x6afe('0x32')]);_0x185b96[_0x6afe('0x36')]=_[_0x6afe('0x35')](_0x544282[_0x6afe('0x31')],qs[_0x6afe('0x37')](_0x2e21c2[_0x6afe('0x32')][_0x6afe('0x37')]));_0x185b96[_0x6afe('0x36')]=_0x185b96['attributes']['length']?_0x185b96[_0x6afe('0x36')]:_0x544282[_0x6afe('0x31')];if(_0x2e21c2[_0x6afe('0x32')]['includeAll']){_0x185b96['include']=[{'all':!![]}];}_0x185b96=_['merge']({},_0x185b96,_0x2e21c2[_0x6afe('0x40')]);return db['VoiceChanSpy'][_0x6afe('0x45')](_0x185b96)[_0x6afe('0x22')](handleEntityNotFound(_0x18bba4,null))['then'](respondWithResult(_0x18bba4,null))[_0x6afe('0x43')](handleError(_0x18bba4,null));};exports[_0x6afe('0x46')]=function(_0x2ba25a,_0x4ed252){return db['VoiceChanSpy'][_0x6afe('0x46')](_0x2ba25a['body'],{})[_0x6afe('0x22')](function(_0x4ada00){var _0x4576e8=_0x2ba25a[_0x6afe('0x47')][_0x6afe('0x48')]({'plain':!![]});if(!_0x4576e8)throw new Error(_0x6afe('0x49'));if(_0x4576e8[_0x6afe('0x4a')]===_0x6afe('0x47')){var _0x54c1e3=_0x4ada00[_0x6afe('0x48')]({'plain':!![]});var _0x912c80=_0x6afe('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x912c80,'userProfileId':_0x4576e8['userProfileId']},'raw':!![]})[_0x6afe('0x22')](function(_0x2b03df){if(_0x2b03df&&_0x2b03df['autoAssociation']===0x0){return db[_0x6afe('0x24')][_0x6afe('0x46')]({'name':_0x54c1e3['name'],'resourceId':_0x54c1e3['id'],'type':_0x2b03df['name'],'sectionId':_0x2b03df['id']},{})[_0x6afe('0x22')](function(){return _0x4ada00;});}else{return _0x4ada00;}})[_0x6afe('0x43')](function(_0x1b2cf7){logger['error'](_0x6afe('0x4b'),_0x1b2cf7);throw _0x1b2cf7;});}return _0x4ada00;})[_0x6afe('0x22')](respondWithResult(_0x4ed252,0xc9))[_0x6afe('0x43')](handleError(_0x4ed252,null));};exports['update']=function(_0xe0f161,_0x2b59ec){if(_0xe0f161[_0x6afe('0x4c')]['id']){delete _0xe0f161[_0x6afe('0x4c')]['id'];}return db[_0x6afe('0x2c')][_0x6afe('0x45')]({'where':{'id':_0xe0f161[_0x6afe('0x4d')]['id']}})[_0x6afe('0x22')](handleEntityNotFound(_0x2b59ec,null))[_0x6afe('0x22')](saveUpdates(_0xe0f161[_0x6afe('0x4c')],null))['then'](respondWithResult(_0x2b59ec,null))['catch'](handleError(_0x2b59ec,null));};exports['destroy']=function(_0x5a8ef4,_0x2841e6){return db[_0x6afe('0x2c')][_0x6afe('0x45')]({'where':{'id':_0x5a8ef4[_0x6afe('0x4d')]['id']}})[_0x6afe('0x22')](handleEntityNotFound(_0x2841e6,null))[_0x6afe('0x22')](removeEntity(_0x2841e6,null))[_0x6afe('0x43')](handleError(_0x2841e6,null));}; \ No newline at end of file +var _0xb18e=['api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','find','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x378a10,_0x4795cb){var _0x8c301c=function(_0x5001cc){while(--_0x5001cc){_0x378a10['push'](_0x378a10['shift']());}};_0x8c301c(++_0x4795cb);}(_0xb18e,0x181));var _0xeb18=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb18e[_0x18a79d];return _0x4f8848;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeb18('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb18('0x1'));var moment=require('moment');var BPromise=require(_0xeb18('0x2'));var Mustache=require(_0xeb18('0x3'));var util=require('util');var path=require(_0xeb18('0x4'));var sox=require(_0xeb18('0x5'));var csv=require(_0xeb18('0x6'));var ejs=require(_0xeb18('0x7'));var fs=require('fs');var fs_extra=require(_0xeb18('0x8'));var _=require(_0xeb18('0x9'));var squel=require('squel');var crypto=require(_0xeb18('0xa'));var jsforce=require(_0xeb18('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeb18('0x6'));var querystring=require(_0xeb18('0xc'));var Papa=require(_0xeb18('0xd'));var Redis=require(_0xeb18('0xe'));var authService=require(_0xeb18('0xf'));var qs=require(_0xeb18('0x10'));var as=require(_0xeb18('0x11'));var hardwareService=require(_0xeb18('0x12'));var logger=require(_0xeb18('0x13'))(_0xeb18('0x14'));var utils=require('../../config/utils');var config=require(_0xeb18('0x15'));var licenseUtil=require(_0xeb18('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3df6ea,_0x5399cc){_0x5399cc=_0x5399cc||0xcc;return function(_0x5f0750){if(_0x5f0750){return _0x3df6ea[_0xeb18('0x17')](_0x5399cc);}return _0x3df6ea[_0xeb18('0x18')](_0x5399cc)[_0xeb18('0x19')]();};}function respondWithResult(_0x495162,_0x58700a){_0x58700a=_0x58700a||0xc8;return function(_0x1f1728){if(_0x1f1728){return _0x495162[_0xeb18('0x18')](_0x58700a)['json'](_0x1f1728);}};}function respondWithFilteredResult(_0x2666cc,_0x1d7230){return function(_0x145cc8){if(_0x145cc8){var _0x4b1e93=typeof _0x1d7230[_0xeb18('0x1a')]===_0xeb18('0x1b')&&typeof _0x1d7230[_0xeb18('0x1c')]===_0xeb18('0x1b');var _0x272cd9=_0x145cc8[_0xeb18('0x1d')];var _0x284733=_0x4b1e93?0x0:_0x1d7230['offset'];var _0x30f706=_0x4b1e93?_0x145cc8['count']:_0x1d7230[_0xeb18('0x1a')]+_0x1d7230[_0xeb18('0x1c')];var _0x1ab144;if(_0x30f706>=_0x272cd9){_0x30f706=_0x272cd9;_0x1ab144=0xc8;}else{_0x1ab144=0xce;}_0x2666cc[_0xeb18('0x18')](_0x1ab144);return _0x2666cc[_0xeb18('0x1e')]('Content-Range',_0x284733+'-'+_0x30f706+'/'+_0x272cd9)[_0xeb18('0x1f')](_0x145cc8);}return null;};}function patchUpdates(_0x2f664c){return function(_0xe10651){try{jsonpatch[_0xeb18('0x20')](_0xe10651,_0x2f664c,!![]);}catch(_0x49e9aa){return BPromise[_0xeb18('0x21')](_0x49e9aa);}return _0xe10651[_0xeb18('0x22')]();};}function saveUpdates(_0x22c7e4,_0x862fe3){return function(_0xaa824b){if(_0xaa824b){return _0xaa824b[_0xeb18('0x23')](_0x22c7e4)[_0xeb18('0x24')](function(_0x38f57a){return _0x38f57a;});}return null;};}function removeEntity(_0x1e7ee4,_0x7464fd){return function(_0x4068e9){if(_0x4068e9){return _0x4068e9[_0xeb18('0x25')]()['then'](function(){var _0x23ae71=_0x4068e9['get']({'plain':!![]});var _0x51867f=_0xeb18('0x26');return db[_0xeb18('0x27')][_0xeb18('0x25')]({'where':{'type':_0x51867f,'resourceId':_0x23ae71['id']}})[_0xeb18('0x24')](function(){return _0x4068e9;});})[_0xeb18('0x24')](function(){_0x1e7ee4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x693669,_0x8dc2a4){return function(_0x3312d8){if(!_0x3312d8){_0x693669['sendStatus'](0x194);}return _0x3312d8;};}function handleError(_0xde2775,_0x1c76b9){_0x1c76b9=_0x1c76b9||0x1f4;return function(_0x5d2f33){logger[_0xeb18('0x28')](_0x5d2f33['stack']);if(_0x5d2f33['name']){delete _0x5d2f33['name'];}_0xde2775['status'](_0x1c76b9)['send'](_0x5d2f33);};}exports[_0xeb18('0x29')]=function(_0x29a152,_0x27455b){var _0x20a8fc={},_0x3ad77d={},_0x8b7a1b={'count':0x0,'rows':[]};var _0x52afa9=_[_0xeb18('0x2a')](db[_0xeb18('0x2b')][_0xeb18('0x2c')],function(_0x1445ba){return{'name':_0x1445ba[_0xeb18('0x2d')],'type':_0x1445ba[_0xeb18('0x2e')][_0xeb18('0x2f')]};});_0x3ad77d[_0xeb18('0x30')]=_['map'](_0x52afa9,_0xeb18('0x31'));_0x3ad77d[_0xeb18('0x32')]=_[_0xeb18('0x33')](_0x29a152[_0xeb18('0x32')]);_0x3ad77d[_0xeb18('0x34')]=_[_0xeb18('0x35')](_0x3ad77d[_0xeb18('0x30')],_0x3ad77d['query']);_0x20a8fc[_0xeb18('0x36')]=_['intersection'](_0x3ad77d[_0xeb18('0x30')],qs[_0xeb18('0x37')](_0x29a152[_0xeb18('0x32')][_0xeb18('0x37')]));_0x20a8fc['attributes']=_0x20a8fc[_0xeb18('0x36')][_0xeb18('0x38')]?_0x20a8fc[_0xeb18('0x36')]:_0x3ad77d[_0xeb18('0x30')];if(!_0x29a152[_0xeb18('0x32')][_0xeb18('0x39')]('nolimit')){_0x20a8fc[_0xeb18('0x1c')]=qs[_0xeb18('0x1c')](_0x29a152[_0xeb18('0x32')][_0xeb18('0x1c')]);_0x20a8fc[_0xeb18('0x1a')]=qs[_0xeb18('0x1a')](_0x29a152[_0xeb18('0x32')][_0xeb18('0x1a')]);}_0x20a8fc[_0xeb18('0x3a')]=qs[_0xeb18('0x3b')](_0x29a152[_0xeb18('0x32')][_0xeb18('0x3b')]);_0x20a8fc['where']=qs[_0xeb18('0x34')](_[_0xeb18('0x3c')](_0x29a152[_0xeb18('0x32')],_0x3ad77d[_0xeb18('0x34')]),_0x52afa9);if(_0x29a152[_0xeb18('0x32')]['filter']){_0x20a8fc[_0xeb18('0x3d')]=_[_0xeb18('0x3e')](_0x20a8fc[_0xeb18('0x3d')],{'$or':_[_0xeb18('0x2a')](_0x52afa9,function(_0x1437d1){if(_0x1437d1['type']!==_0xeb18('0x3f')){var _0x54d291={};_0x54d291[_0x1437d1[_0xeb18('0x31')]]={'$like':'%'+_0x29a152[_0xeb18('0x32')][_0xeb18('0x40')]+'%'};return _0x54d291;}})});}_0x20a8fc=_[_0xeb18('0x3e')]({},_0x20a8fc,_0x29a152[_0xeb18('0x41')]);var _0x4e517d={'where':_0x20a8fc[_0xeb18('0x3d')]};return db[_0xeb18('0x2b')][_0xeb18('0x1d')](_0x4e517d)['then'](function(_0x58f478){_0x8b7a1b[_0xeb18('0x1d')]=_0x58f478;if(_0x29a152[_0xeb18('0x32')][_0xeb18('0x42')]){_0x20a8fc[_0xeb18('0x43')]=[{'all':!![]}];}return db[_0xeb18('0x2b')]['findAll'](_0x20a8fc);})['then'](function(_0x4a9a7b){_0x8b7a1b[_0xeb18('0x44')]=_0x4a9a7b;return _0x8b7a1b;})[_0xeb18('0x24')](respondWithFilteredResult(_0x27455b,_0x20a8fc))[_0xeb18('0x45')](handleError(_0x27455b,null));};exports['show']=function(_0x30a4b0,_0xc5e91a){var _0x32f210={'raw':![],'where':{'id':_0x30a4b0[_0xeb18('0x46')]['id']}},_0x26d293={};_0x26d293[_0xeb18('0x30')]=_[_0xeb18('0x33')](db['VoiceChanSpy'][_0xeb18('0x2c')]);_0x26d293[_0xeb18('0x32')]=_[_0xeb18('0x33')](_0x30a4b0[_0xeb18('0x32')]);_0x26d293[_0xeb18('0x34')]=_[_0xeb18('0x35')](_0x26d293[_0xeb18('0x30')],_0x26d293['query']);_0x32f210[_0xeb18('0x36')]=_[_0xeb18('0x35')](_0x26d293[_0xeb18('0x30')],qs[_0xeb18('0x37')](_0x30a4b0[_0xeb18('0x32')][_0xeb18('0x37')]));_0x32f210[_0xeb18('0x36')]=_0x32f210[_0xeb18('0x36')][_0xeb18('0x38')]?_0x32f210[_0xeb18('0x36')]:_0x26d293[_0xeb18('0x30')];if(_0x30a4b0['query']['includeAll']){_0x32f210[_0xeb18('0x43')]=[{'all':!![]}];}_0x32f210=_[_0xeb18('0x3e')]({},_0x32f210,_0x30a4b0['options']);return db[_0xeb18('0x2b')]['find'](_0x32f210)[_0xeb18('0x24')](handleEntityNotFound(_0xc5e91a,null))['then'](respondWithResult(_0xc5e91a,null))[_0xeb18('0x45')](handleError(_0xc5e91a,null));};exports[_0xeb18('0x47')]=function(_0x4b4fb4,_0x3d3b27){return db[_0xeb18('0x2b')][_0xeb18('0x47')](_0x4b4fb4[_0xeb18('0x48')],{})[_0xeb18('0x24')](function(_0x3fb691){var _0x17fb52=_0x4b4fb4[_0xeb18('0x49')]['get']({'plain':!![]});if(!_0x17fb52)throw new Error(_0xeb18('0x4a'));if(_0x17fb52[_0xeb18('0x4b')]==='user'){var _0x2fbcc7=_0x3fb691[_0xeb18('0x4c')]({'plain':!![]});var _0x34ad40='ChanSpies';return db[_0xeb18('0x4d')]['find']({'where':{'name':_0x34ad40,'userProfileId':_0x17fb52[_0xeb18('0x4e')]},'raw':!![]})[_0xeb18('0x24')](function(_0x4877f2){if(_0x4877f2&&_0x4877f2[_0xeb18('0x4f')]===0x0){return db[_0xeb18('0x27')][_0xeb18('0x47')]({'name':_0x2fbcc7[_0xeb18('0x31')],'resourceId':_0x2fbcc7['id'],'type':_0x4877f2[_0xeb18('0x31')],'sectionId':_0x4877f2['id']},{})['then'](function(){return _0x3fb691;});}else{return _0x3fb691;}})['catch'](function(_0x296f27){logger[_0xeb18('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x296f27);throw _0x296f27;});}return _0x3fb691;})[_0xeb18('0x24')](respondWithResult(_0x3d3b27,0xc9))['catch'](handleError(_0x3d3b27,null));};exports[_0xeb18('0x23')]=function(_0x54a934,_0x1588d9){if(_0x54a934[_0xeb18('0x48')]['id']){delete _0x54a934[_0xeb18('0x48')]['id'];}return db[_0xeb18('0x2b')][_0xeb18('0x50')]({'where':{'id':_0x54a934[_0xeb18('0x46')]['id']}})[_0xeb18('0x24')](handleEntityNotFound(_0x1588d9,null))[_0xeb18('0x24')](saveUpdates(_0x54a934[_0xeb18('0x48')],null))[_0xeb18('0x24')](respondWithResult(_0x1588d9,null))['catch'](handleError(_0x1588d9,null));};exports[_0xeb18('0x25')]=function(_0x335bcc,_0x2fa7c4){return db['VoiceChanSpy']['find']({'where':{'id':_0x335bcc[_0xeb18('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fa7c4,null))['then'](removeEntity(_0x2fa7c4,null))[_0xeb18('0x45')](handleError(_0x2fa7c4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5d5c5a7..3dae162 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 _0x8678=['agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','auth','password','ChanSpy','name','options','StopMixMonitor','length','concat','internal','findAll'];(function(_0xfd42ce,_0x28efc6){var _0x366cc0=function(_0x406d31){while(--_0x406d31){_0xfd42ce['push'](_0xfd42ce['shift']());}};_0x366cc0(++_0x28efc6);}(_0x8678,0x1eb));var _0x8867=function(_0x20a303,_0xb22a14){_0x20a303=_0x20a303-0x0;var _0x14c943=_0x8678[_0x20a303];return _0x14c943;};'use strict';var _=require(_0x8867('0x0'));var util=require(_0x8867('0x1'));var BPromise=require('bluebird');var attributes=require(_0x8867('0x2'));var getUserApplications=function(_0x420680,_0x4eaa74,_0x1fab64){var _0x3ae97d=0x1;var _0x5212ae=[];var _0x339845={'context':_0x4eaa74[_0x8867('0x3')]||_0x8867('0x4'),'exten':util[_0x8867('0x5')](_0x8867('0x6'),_0x420680[_0x8867('0x7')],_0x1fab64),'type':_0x8867('0x8'),'isApp':![],'ChanSpyId':_0x420680['id'],'UserId':_0x4eaa74['id']};_0x5212ae['push'](_[_0x8867('0x9')]({'app':_0x8867('0xa'),'appdata':util[_0x8867('0x5')](_0x8867('0xb'),_0x8867('0xc')),'priority':_0x3ae97d++},_0x339845));if(_0x420680[_0x8867('0xd')]){_0x5212ae[_0x8867('0xe')](_[_0x8867('0x9')]({'app':_0x8867('0xf'),'appdata':util[_0x8867('0x5')]('${UNIQUEID}.%s,a',_0x420680[_0x8867('0x10')]),'priority':_0x3ae97d++},_0x339845));}if(_0x420680[_0x8867('0x11')]){_0x5212ae[_0x8867('0xe')](_[_0x8867('0x9')]({'app':'Authenticate','appdata':_0x420680[_0x8867('0x12')],'priority':_0x3ae97d++},_0x339845));}_0x5212ae[_0x8867('0xe')](_['merge']({'app':_0x8867('0x13'),'appdata':util[_0x8867('0x5')]('SIP/%s,%s',_0x4eaa74[_0x8867('0x14')],_0x420680[_0x8867('0x15')]?_0x420680[_0x8867('0x15')]['join'](''):''),'priority':_0x3ae97d++},_0x339845));if(_0x420680[_0x8867('0xd')]){_0x5212ae[_0x8867('0xe')](_[_0x8867('0x9')]({'app':_0x8867('0x16'),'priority':_0x3ae97d++},_0x339845));}return _0x5212ae;};var getChanSpyApplications=function(_0x4cc587,_0x32aee4){var _0x5f4e3a=[];for(var _0x473d62=0x0,_0x4b9c4d=0x1;_0x473d62<_0x32aee4[_0x8867('0x17')];_0x473d62++,_0x4b9c4d=0x1){_0x5f4e3a=_0x5f4e3a[_0x8867('0x18')](getUserApplications(_0x4cc587,_0x32aee4[_0x473d62],_0x32aee4[_0x473d62][_0x8867('0x19')]));if(_0x32aee4[_0x473d62]['internal']!=_0x32aee4[_0x473d62]['name']){_0x5f4e3a=_0x5f4e3a['concat'](getUserApplications(_0x4cc587,_0x32aee4[_0x473d62],_0x32aee4[_0x473d62][_0x8867('0x14')]));}}return _0x5f4e3a;};var getChanSpyPromise=function(_0x359e8b,_0x20d4a2){return new BPromise(function(_0x4cacdb,_0x24df4b){return _0x359e8b['User'][_0x8867('0x1a')]({'attributes':['id',_0x8867('0x14'),_0x8867('0x19')],'where':{'role':_0x8867('0x1b'),'chanspy':!![]},'raw':!![]})[_0x8867('0x1c')](function(_0x550ec4){if(_0x550ec4){return _0x4cacdb(getChanSpyApplications(_0x20d4a2,_0x550ec4));}return _0x4cacdb([]);})[_0x8867('0x1d')](function(_0x58e41b){_0x24df4b(_0x58e41b);});});};module[_0x8867('0x1e')]=function(_0x47ad56,_0x35f48a){var _0x17fca8=_0x47ad56['models'];return _0x47ad56[_0x8867('0x1f')](_0x8867('0x20'),attributes,{'tableName':_0x8867('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ef0a0,_0x272acc,_0x91575e){return getChanSpyPromise(_0x17fca8,_0x5ef0a0)[_0x8867('0x1c')](function(_0x86d160){if(_0x86d160&&_0x86d160[_0x8867('0x17')]){return _0x17fca8[_0x8867('0x22')]['bulkCreate'](_0x86d160);}})['then'](function(){_0x91575e();})['catch'](function(_0x461a08){_0x91575e(_0x461a08);});},'afterUpdate':function(_0x4c4870,_0xc9f4f1,_0x3f76fc){return _0x17fca8[_0x8867('0x22')][_0x8867('0x23')]({'where':{'ChanSpyId':_0x4c4870['id']}})[_0x8867('0x1c')](function(){return getChanSpyPromise(_0x17fca8,_0x4c4870);})[_0x8867('0x1c')](function(_0x5aac51){if(_0x5aac51&&_0x5aac51[_0x8867('0x17')]){return _0x17fca8[_0x8867('0x22')][_0x8867('0x24')](_0x5aac51);}})['then'](function(){_0x3f76fc();})['catch'](function(_0x57a77c){_0x3f76fc(_0x57a77c);});},'afterDestroy':function(_0x466935,_0x2114b6,_0x4f5599){return _0x17fca8['VoiceExtension'][_0x8867('0x23')]({'where':{'ChanSpyId':_0x466935['id']}})['then'](function(){_0x4f5599();})[_0x8867('0x1d')](function(_0x44eadf){_0x4f5599(_0x44eadf);});}}});}; \ No newline at end of file +var _0xc927=['bulkCreate','catch','destroy','lodash','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension'];(function(_0x59bbd9,_0x4be604){var _0x393bc8=function(_0x2792d7){while(--_0x2792d7){_0x59bbd9['push'](_0x59bbd9['shift']());}};_0x393bc8(++_0x4be604);}(_0xc927,0x9b));var _0x7c92=function(_0x43a695,_0x1448d1){_0x43a695=_0x43a695-0x0;var _0x488708=_0xc927[_0x43a695];return _0x488708;};'use strict';var _=require(_0x7c92('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x7c92('0x1'));var getUserApplications=function(_0x390654,_0x561507,_0x5692e7){var _0x5b2403=0x1;var _0x1f8fa1=[];var _0x57d90d={'context':_0x561507[_0x7c92('0x2')]||'from-sip','exten':util[_0x7c92('0x3')](_0x7c92('0x4'),_0x390654[_0x7c92('0x5')],_0x5692e7),'type':_0x7c92('0x6'),'isApp':![],'ChanSpyId':_0x390654['id'],'UserId':_0x561507['id']};_0x1f8fa1['push'](_[_0x7c92('0x7')]({'app':_0x7c92('0x8'),'appdata':util[_0x7c92('0x3')](_0x7c92('0x9'),_0x7c92('0xa')),'priority':_0x5b2403++},_0x57d90d));if(_0x390654[_0x7c92('0xb')]){_0x1f8fa1[_0x7c92('0xc')](_[_0x7c92('0x7')]({'app':_0x7c92('0xd'),'appdata':util[_0x7c92('0x3')](_0x7c92('0xe'),_0x390654[_0x7c92('0xf')]),'priority':_0x5b2403++},_0x57d90d));}if(_0x390654[_0x7c92('0x10')]){_0x1f8fa1[_0x7c92('0xc')](_['merge']({'app':_0x7c92('0x11'),'appdata':_0x390654[_0x7c92('0x12')],'priority':_0x5b2403++},_0x57d90d));}_0x1f8fa1[_0x7c92('0xc')](_[_0x7c92('0x7')]({'app':_0x7c92('0x13'),'appdata':util[_0x7c92('0x3')](_0x7c92('0x14'),_0x561507[_0x7c92('0x15')],_0x390654['options']?_0x390654[_0x7c92('0x16')][_0x7c92('0x17')](''):''),'priority':_0x5b2403++},_0x57d90d));if(_0x390654[_0x7c92('0xb')]){_0x1f8fa1[_0x7c92('0xc')](_[_0x7c92('0x7')]({'app':_0x7c92('0x18'),'priority':_0x5b2403++},_0x57d90d));}return _0x1f8fa1;};var getChanSpyApplications=function(_0x276b2f,_0x26d590){var _0x588425=[];for(var _0x12a390=0x0,_0x463629=0x1;_0x12a390<_0x26d590[_0x7c92('0x19')];_0x12a390++,_0x463629=0x1){_0x588425=_0x588425[_0x7c92('0x1a')](getUserApplications(_0x276b2f,_0x26d590[_0x12a390],_0x26d590[_0x12a390]['internal']));if(_0x26d590[_0x12a390][_0x7c92('0x1b')]!=_0x26d590[_0x12a390]['name']){_0x588425=_0x588425['concat'](getUserApplications(_0x276b2f,_0x26d590[_0x12a390],_0x26d590[_0x12a390][_0x7c92('0x15')]));}}return _0x588425;};var getChanSpyPromise=function(_0x41e27b,_0x40f660){return new BPromise(function(_0x5df06b,_0x28111a){return _0x41e27b['User'][_0x7c92('0x1c')]({'attributes':['id',_0x7c92('0x15'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x7c92('0x1d')](function(_0x16e9f3){if(_0x16e9f3){return _0x5df06b(getChanSpyApplications(_0x40f660,_0x16e9f3));}return _0x5df06b([]);})['catch'](function(_0x233f22){_0x28111a(_0x233f22);});});};module[_0x7c92('0x1e')]=function(_0x16e0fc,_0x210e13){var _0x2796e1=_0x16e0fc[_0x7c92('0x1f')];return _0x16e0fc['define'](_0x7c92('0x20'),attributes,{'tableName':_0x7c92('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x238169,_0x168630,_0x41438a){return getChanSpyPromise(_0x2796e1,_0x238169)[_0x7c92('0x1d')](function(_0x19cba4){if(_0x19cba4&&_0x19cba4[_0x7c92('0x19')]){return _0x2796e1[_0x7c92('0x22')][_0x7c92('0x23')](_0x19cba4);}})[_0x7c92('0x1d')](function(){_0x41438a();})[_0x7c92('0x24')](function(_0x47454b){_0x41438a(_0x47454b);});},'afterUpdate':function(_0x3aa162,_0x5d851b,_0x4defd8){return _0x2796e1['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3aa162['id']}})[_0x7c92('0x1d')](function(){return getChanSpyPromise(_0x2796e1,_0x3aa162);})[_0x7c92('0x1d')](function(_0x291c5e){if(_0x291c5e&&_0x291c5e[_0x7c92('0x19')]){return _0x2796e1[_0x7c92('0x22')][_0x7c92('0x23')](_0x291c5e);}})[_0x7c92('0x1d')](function(){_0x4defd8();})[_0x7c92('0x24')](function(_0x5f07de){_0x4defd8(_0x5f07de);});},'afterDestroy':function(_0xadce7e,_0x4a1ef5,_0x27f73d){return _0x2796e1[_0x7c92('0x22')][_0x7c92('0x25')]({'where':{'ChanSpyId':_0xadce7e['id']}})[_0x7c92('0x1d')](function(){_0x27f73d();})['catch'](function(_0x12c47c){_0x27f73d(_0x12c47c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 10a6e5b..481fe9b 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 _0x2f3a=['http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x459f96,_0x180b63){var _0x34e398=function(_0x55ca00){while(--_0x55ca00){_0x459f96['push'](_0x459f96['shift']());}};_0x34e398(++_0x180b63);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x536cd2,_0x45aeba){_0x536cd2=_0x536cd2-0x0;var _0x504b64=_0x2f3a[_0x536cd2];return _0x504b64;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});} \ No newline at end of file +var _0x131e=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceChanSpy,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x26d034,_0x2c22db){var _0x3015aa=function(_0x282e96){while(--_0x282e96){_0x26d034['push'](_0x26d034['shift']());}};_0x3015aa(++_0x2c22db);}(_0x131e,0x1ec));var _0xe131=function(_0xc493a6,_0x24f615){_0xc493a6=_0xc493a6-0x0;var _0x5f4e99=_0x131e[_0xc493a6];return _0x5f4e99;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index cbdd2d7..9bccc7b 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 _0x5522=['destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','post','update','delete'];(function(_0x25a3cf,_0x3cf968){var _0xce72e0=function(_0x502436){while(--_0x502436){_0x25a3cf['push'](_0x25a3cf['shift']());}};_0xce72e0(++_0x3cf968);}(_0x5522,0xe3));var _0x2552=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5522[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x2552('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2552('0x1'));var express=require('express');var router=express[_0x2552('0x2')]();var fs_extra=require(_0x2552('0x3'));var auth=require(_0x2552('0x4'));var interaction=require(_0x2552('0x5'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router['get']('/',auth[_0x2552('0x6')](),controller[_0x2552('0x7')]);router[_0x2552('0x8')](_0x2552('0x9'),auth[_0x2552('0x6')](),controller['show']);router[_0x2552('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2552('0x9'),auth['isAuthenticated'](),controller[_0x2552('0xb')]);router[_0x2552('0xc')](_0x2552('0x9'),auth['isAuthenticated'](),controller[_0x2552('0xd')]);module[_0x2552('0xe')]=router; \ No newline at end of file +var _0x174a=['destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x39e035,_0x1935e1){var _0x434c89=function(_0x30f321){while(--_0x30f321){_0x39e035['push'](_0x39e035['shift']());}};_0x434c89(++_0x1935e1);}(_0x174a,0xb1));var _0xa174=function(_0x11fc6f,_0x5d595c){_0x11fc6f=_0x11fc6f-0x0;var _0x336d53=_0x174a[_0x11fc6f];return _0x336d53;};'use strict';var multer=require('multer');var util=require(_0xa174('0x0'));var path=require('path');var timeout=require(_0xa174('0x1'));var express=require('express');var router=express[_0xa174('0x2')]();var fs_extra=require(_0xa174('0x3'));var auth=require(_0xa174('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa174('0x5'));var controller=require(_0xa174('0x6'));router[_0xa174('0x7')]('/',auth[_0xa174('0x8')](),controller[_0xa174('0x9')]);router[_0xa174('0x7')](_0xa174('0xa'),auth[_0xa174('0x8')](),controller[_0xa174('0xb')]);router[_0xa174('0xc')]('/',auth['isAuthenticated'](),controller[_0xa174('0xd')]);router['put'](_0xa174('0xa'),auth[_0xa174('0x8')](),controller[_0xa174('0xe')]);router['delete'](_0xa174('0xa'),auth[_0xa174('0x8')](),controller[_0xa174('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7e1e6a5..119a422 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 _0xaf46=['name','BOOLEAN','exports','STRING'];(function(_0x177cf5,_0x470cf0){var _0x2ad5cf=function(_0x1fa876){while(--_0x1fa876){_0x177cf5['push'](_0x177cf5['shift']());}};_0x2ad5cf(++_0x470cf0);}(_0xaf46,0x1be));var _0x6af4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaf46[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x6af4('0x0')]={'name':{'type':Sequelize[_0x6af4('0x1')],'unique':_0x6af4('0x2')},'description':{'type':Sequelize[_0x6af4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6af4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb697=['name','BOOLEAN','sequelize','STRING'];(function(_0x188bdd,_0x143b0f){var _0x37bc52=function(_0x1e0cc3){while(--_0x1e0cc3){_0x188bdd['push'](_0x188bdd['shift']());}};_0x37bc52(++_0x143b0f);}(_0xb697,0x12e));var _0x7b69=function(_0x1cf01e,_0x3cc84a){_0x1cf01e=_0x1cf01e-0x0;var _0x2dc354=_0xb697[_0x1cf01e];return _0x2dc354;};'use strict';var Sequelize=require(_0x7b69('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b69('0x1')],'unique':_0x7b69('0x2')},'description':{'type':Sequelize[_0x7b69('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7b69('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 2a0ebd3..fcd3ddf 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 _0x3624=['body','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','render','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','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','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','VoiceContext','includeAll','findAll','rows','catch','params','find','create'];(function(_0xbced40,_0x2fa5f0){var _0x230f2e=function(_0xc13c1c){while(--_0xc13c1c){_0xbced40['push'](_0xbced40['shift']());}};_0x230f2e(++_0x2fa5f0);}(_0x3624,0xe2));var _0x4362=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x3624[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0x4362('0x0'));var rimraf=require(_0x4362('0x1'));var zipdir=require(_0x4362('0x2'));var jsonpatch=require(_0x4362('0x3'));var rp=require(_0x4362('0x4'));var moment=require('moment');var BPromise=require(_0x4362('0x5'));var Mustache=require(_0x4362('0x6'));var util=require(_0x4362('0x7'));var path=require(_0x4362('0x8'));var sox=require('sox');var csv=require(_0x4362('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4362('0xa'));var squel=require('squel');var crypto=require(_0x4362('0xb'));var jsforce=require(_0x4362('0xc'));var deskjs=require(_0x4362('0xd'));var toCsv=require(_0x4362('0x9'));var querystring=require(_0x4362('0xe'));var Papa=require(_0x4362('0xf'));var Redis=require(_0x4362('0x10'));var authService=require(_0x4362('0x11'));var qs=require(_0x4362('0x12'));var as=require(_0x4362('0x13'));var hardwareService=require(_0x4362('0x14'));var logger=require(_0x4362('0x15'))(_0x4362('0x16'));var utils=require('../../config/utils');var config=require(_0x4362('0x17'));var licenseUtil=require(_0x4362('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4362('0x19'));var client=jayson[_0x4362('0x1a')][_0x4362('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x7f69be,_0x5c8a18,_0x535c67,_0x4674aa){return new BPromise(function(_0x3574ce,_0x4e2e47){var _0x487ea3=_0x4674aa||client;return _0x487ea3['request'](_0x7f69be,_0x535c67)[_0x4362('0x1c')](function(_0x16dba4){logger['info'](_0x4362('0x1d'),_0x5c8a18,'request\x20sent');logger[_0x4362('0x1e')](_0x4362('0x1f'),_0x5c8a18,_0x4362('0x20'),JSON['stringify'](_0x16dba4));if(_0x16dba4[_0x4362('0x21')]){if(_0x16dba4[_0x4362('0x21')][_0x4362('0x22')]===0x1f4){logger[_0x4362('0x21')](_0x4362('0x1d'),_0x5c8a18,_0x16dba4[_0x4362('0x21')][_0x4362('0x23')]);return _0x4e2e47(_0x16dba4[_0x4362('0x21')][_0x4362('0x23')]);}logger[_0x4362('0x21')]('VoiceContext,\x20%s,\x20%s',_0x5c8a18,_0x16dba4[_0x4362('0x21')]['message']);return _0x3574ce(_0x16dba4[_0x4362('0x21')]['message']);}else{logger[_0x4362('0x24')](_0x4362('0x1d'),_0x5c8a18,_0x4362('0x20'));_0x3574ce(_0x16dba4[_0x4362('0x25')][_0x4362('0x23')]);}})['catch'](function(_0x114e44){logger['error'](_0x4362('0x1d'),_0x5c8a18,_0x114e44);_0x4e2e47(_0x114e44);});});}function respondWithStatusCode(_0x441a8e,_0x1c1cdb){_0x1c1cdb=_0x1c1cdb||0xcc;return function(_0x14716c){if(_0x14716c){return _0x441a8e[_0x4362('0x26')](_0x1c1cdb);}return _0x441a8e[_0x4362('0x27')](_0x1c1cdb)[_0x4362('0x28')]();};}function respondWithResult(_0x54c8fa,_0x2f98c6){_0x2f98c6=_0x2f98c6||0xc8;return function(_0x587668){if(_0x587668){return _0x54c8fa['status'](_0x2f98c6)['json'](_0x587668);}};}function respondWithFilteredResult(_0x7cf738,_0x19e4b9){return function(_0x4a74d4){if(_0x4a74d4){var _0x47091c=typeof _0x19e4b9[_0x4362('0x29')]===_0x4362('0x2a')&&typeof _0x19e4b9['limit']===_0x4362('0x2a');var _0x3ba524=_0x4a74d4[_0x4362('0x2b')];var _0x8bd4d5=_0x47091c?0x0:_0x19e4b9[_0x4362('0x29')];var _0x53a069=_0x47091c?_0x4a74d4[_0x4362('0x2b')]:_0x19e4b9['offset']+_0x19e4b9[_0x4362('0x2c')];var _0x4dfb93;if(_0x53a069>=_0x3ba524){_0x53a069=_0x3ba524;_0x4dfb93=0xc8;}else{_0x4dfb93=0xce;}_0x7cf738['status'](_0x4dfb93);return _0x7cf738[_0x4362('0x2d')](_0x4362('0x2e'),_0x8bd4d5+'-'+_0x53a069+'/'+_0x3ba524)[_0x4362('0x2f')](_0x4a74d4);}return null;};}function patchUpdates(_0x42407d){return function(_0x24afe4){try{jsonpatch[_0x4362('0x30')](_0x24afe4,_0x42407d,!![]);}catch(_0xb2d909){return BPromise['reject'](_0xb2d909);}return _0x24afe4[_0x4362('0x31')]();};}function saveUpdates(_0x503688,_0x2b2842){return function(_0x250aee){if(_0x250aee){return _0x250aee[_0x4362('0x32')](_0x503688)[_0x4362('0x1c')](function(_0x4939bb){return _0x4939bb;});}return null;};}function removeEntity(_0x59edc0,_0x113aee){return function(_0x2d5cf1){if(_0x2d5cf1){return _0x2d5cf1['destroy']()[_0x4362('0x1c')](function(){var _0x27fe70=_0x2d5cf1[_0x4362('0x33')]({'plain':!![]});var _0x2c9f4d=_0x4362('0x34');return db[_0x4362('0x35')][_0x4362('0x36')]({'where':{'type':_0x2c9f4d,'resourceId':_0x27fe70['id']}})[_0x4362('0x1c')](function(){return _0x2d5cf1;});})['then'](function(){_0x59edc0['status'](0xcc)[_0x4362('0x28')]();});}};}function handleEntityNotFound(_0x563574,_0x2ab5e8){return function(_0x2c3e09){if(!_0x2c3e09){_0x563574[_0x4362('0x26')](0x194);}return _0x2c3e09;};}function handleError(_0x30e17d,_0x3b1ef6){_0x3b1ef6=_0x3b1ef6||0x1f4;return function(_0x502e86){logger[_0x4362('0x21')](_0x502e86[_0x4362('0x37')]);if(_0x502e86[_0x4362('0x38')]){delete _0x502e86[_0x4362('0x38')];}_0x30e17d['status'](_0x3b1ef6)[_0x4362('0x39')](_0x502e86);};}exports[_0x4362('0x3a')]=function(_0x1799e6,_0x9d1c0c){var _0x39f275={},_0x93a9e6={},_0x3c17da={'count':0x0,'rows':[]};var _0xfeebfe=_[_0x4362('0x3b')](db['VoiceContext'][_0x4362('0x3c')],function(_0x1869fe){return{'name':_0x1869fe[_0x4362('0x3d')],'type':_0x1869fe['type']['key']};});_0x93a9e6[_0x4362('0x3e')]=_[_0x4362('0x3b')](_0xfeebfe,_0x4362('0x38'));_0x93a9e6[_0x4362('0x3f')]=_[_0x4362('0x40')](_0x1799e6[_0x4362('0x3f')]);_0x93a9e6['filters']=_[_0x4362('0x41')](_0x93a9e6[_0x4362('0x3e')],_0x93a9e6[_0x4362('0x3f')]);_0x39f275['attributes']=_['intersection'](_0x93a9e6[_0x4362('0x3e')],qs[_0x4362('0x42')](_0x1799e6[_0x4362('0x3f')][_0x4362('0x42')]));_0x39f275[_0x4362('0x43')]=_0x39f275[_0x4362('0x43')]['length']?_0x39f275[_0x4362('0x43')]:_0x93a9e6['model'];if(!_0x1799e6[_0x4362('0x3f')][_0x4362('0x44')](_0x4362('0x45'))){_0x39f275[_0x4362('0x2c')]=qs['limit'](_0x1799e6[_0x4362('0x3f')]['limit']);_0x39f275[_0x4362('0x29')]=qs[_0x4362('0x29')](_0x1799e6[_0x4362('0x3f')][_0x4362('0x29')]);}_0x39f275['order']=qs[_0x4362('0x46')](_0x1799e6['query'][_0x4362('0x46')]);_0x39f275[_0x4362('0x47')]=qs[_0x4362('0x48')](_[_0x4362('0x49')](_0x1799e6[_0x4362('0x3f')],_0x93a9e6[_0x4362('0x48')]),_0xfeebfe);if(_0x1799e6[_0x4362('0x3f')]['filter']){_0x39f275[_0x4362('0x47')]=_[_0x4362('0x4a')](_0x39f275[_0x4362('0x47')],{'$or':_[_0x4362('0x3b')](_0xfeebfe,function(_0x594613){if(_0x594613[_0x4362('0x4b')]!==_0x4362('0x4c')){var _0x4e671e={};_0x4e671e[_0x594613[_0x4362('0x38')]]={'$like':'%'+_0x1799e6[_0x4362('0x3f')]['filter']+'%'};return _0x4e671e;}})});}_0x39f275=_[_0x4362('0x4a')]({},_0x39f275,_0x1799e6[_0x4362('0x4d')]);var _0x27429a={'where':_0x39f275['where']};return db[_0x4362('0x4e')][_0x4362('0x2b')](_0x27429a)[_0x4362('0x1c')](function(_0x444133){_0x3c17da[_0x4362('0x2b')]=_0x444133;if(_0x1799e6[_0x4362('0x3f')][_0x4362('0x4f')]){_0x39f275['include']=[{'all':!![]}];}return db[_0x4362('0x4e')][_0x4362('0x50')](_0x39f275);})[_0x4362('0x1c')](function(_0x5d6cd7){_0x3c17da[_0x4362('0x51')]=_0x5d6cd7;return _0x3c17da;})[_0x4362('0x1c')](respondWithFilteredResult(_0x9d1c0c,_0x39f275))[_0x4362('0x52')](handleError(_0x9d1c0c,null));};exports['show']=function(_0x392e10,_0x48fbe8){var _0x4baaf7={'raw':![],'where':{'id':_0x392e10[_0x4362('0x53')]['id']}},_0x3a3b8f={};_0x3a3b8f[_0x4362('0x3e')]=_[_0x4362('0x40')](db[_0x4362('0x4e')][_0x4362('0x3c')]);_0x3a3b8f['query']=_[_0x4362('0x40')](_0x392e10['query']);_0x3a3b8f[_0x4362('0x48')]=_['intersection'](_0x3a3b8f[_0x4362('0x3e')],_0x3a3b8f['query']);_0x4baaf7[_0x4362('0x43')]=_[_0x4362('0x41')](_0x3a3b8f[_0x4362('0x3e')],qs[_0x4362('0x42')](_0x392e10['query'][_0x4362('0x42')]));_0x4baaf7[_0x4362('0x43')]=_0x4baaf7[_0x4362('0x43')]['length']?_0x4baaf7[_0x4362('0x43')]:_0x3a3b8f['model'];if(_0x392e10[_0x4362('0x3f')][_0x4362('0x4f')]){_0x4baaf7['include']=[{'all':!![]}];}_0x4baaf7=_['merge']({},_0x4baaf7,_0x392e10['options']);return db[_0x4362('0x4e')][_0x4362('0x54')](_0x4baaf7)[_0x4362('0x1c')](handleEntityNotFound(_0x48fbe8,null))[_0x4362('0x1c')](respondWithResult(_0x48fbe8,null))[_0x4362('0x52')](handleError(_0x48fbe8,null));};exports[_0x4362('0x55')]=function(_0x5ee400,_0x112611,_0x3a9738){var _0x50d085;return db[_0x4362('0x4e')][_0x4362('0x55')](_0x5ee400[_0x4362('0x56')],{'raw':!![]})[_0x4362('0x1c')](function(_0x34f7cb){_0x50d085=_0x34f7cb;return db[_0x4362('0x4e')]['findAll']({'raw':!![]});})[_0x4362('0x1c')](function(_0x5c5afc){var _0x142214=fs['readFileSync'](path[_0x4362('0x57')](config[_0x4362('0x58')],_0x4362('0x59')),_0x4362('0x5a'));var _0x34d9a6=ejs['render'](_0x142214,{'contexts':_0x5c5afc||[]});fs[_0x4362('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34d9a6);})[_0x4362('0x1c')](function(){return respondWithRpcPromise(_0x4362('0x5c'),_0x4362('0x55'),{'module':_0x4362('0x5d')});})['then'](function(){var _0x6d9710=_0x5ee400['user'][_0x4362('0x33')]({'plain':!![]});if(!_0x6d9710)throw new Error(_0x4362('0x5e'));if(_0x6d9710[_0x4362('0x5f')]===_0x4362('0x60')){var _0x4c63a9=_0x50d085[_0x4362('0x33')]({'plain':!![]});return db[_0x4362('0x61')][_0x4362('0x54')]({'where':{'name':_0x4362('0x34'),'userProfileId':_0x6d9710[_0x4362('0x62')]},'raw':!![]})[_0x4362('0x1c')](function(_0x4f4bee){if(_0x4f4bee&&_0x4f4bee[_0x4362('0x63')]===0x0){return db[_0x4362('0x35')][_0x4362('0x55')]({'name':_0x4c63a9[_0x4362('0x38')],'resourceId':_0x4c63a9['id'],'type':_0x4f4bee['name'],'sectionId':_0x4f4bee['id']},{})['then'](function(){return _0x50d085;});}else{return _0x50d085;}})[_0x4362('0x52')](function(_0x4f978a){logger['error'](_0x4362('0x64'),_0x4f978a);throw _0x4f978a;});}return _0x50d085;})[_0x4362('0x1c')](respondWithResult(_0x112611,0xc9))[_0x4362('0x52')](handleError(_0x112611,null));};exports[_0x4362('0x32')]=function(_0x4d2b0c,_0x2622b7,_0x15e41a){var _0x540a7f;return db[_0x4362('0x4e')]['find']({'where':{'id':_0x4d2b0c['params']['id']}})[_0x4362('0x1c')](handleEntityNotFound(_0x2622b7,null))[_0x4362('0x1c')](saveUpdates(_0x4d2b0c[_0x4362('0x56')],null))[_0x4362('0x1c')](function(_0x33cc64){if(_0x33cc64){_0x540a7f=_0x33cc64;return db[_0x4362('0x4e')][_0x4362('0x50')]({'raw':!![]});}})[_0x4362('0x1c')](function(_0x564af6){var _0x55cdf1=fs[_0x4362('0x65')](path[_0x4362('0x57')](config['root'],'server/files/templates/context.ejs'),_0x4362('0x5a'));var _0x2a4f8d=ejs[_0x4362('0x66')](_0x55cdf1,{'contexts':_0x564af6||[]});fs[_0x4362('0x5b')](_0x4362('0x67'),_0x2a4f8d);})['then'](function(){return respondWithRpcPromise(_0x4362('0x5c'),_0x4362('0x32'),{'module':_0x4362('0x5d')});})['then'](function(){return _0x540a7f;})[_0x4362('0x1c')](respondWithResult(_0x2622b7,null))[_0x4362('0x52')](handleError(_0x2622b7,null));};exports[_0x4362('0x36')]=function(_0x3ebd29,_0x42fb5,_0x34d052){var _0x46805f;return db[_0x4362('0x4e')][_0x4362('0x54')]({'where':{'id':_0x3ebd29[_0x4362('0x53')]['id']}})[_0x4362('0x1c')](handleEntityNotFound(_0x42fb5,null))[_0x4362('0x1c')](removeEntity(_0x42fb5,null))[_0x4362('0x1c')](function(){return db[_0x4362('0x4e')][_0x4362('0x50')]({'raw':!![]});})[_0x4362('0x1c')](function(_0x2001a8){var _0x54ff5a=fs[_0x4362('0x65')](path[_0x4362('0x57')](config[_0x4362('0x58')],_0x4362('0x59')),_0x4362('0x5a'));var _0x23f54f=ejs[_0x4362('0x66')](_0x54ff5a,{'contexts':_0x2001a8});fs[_0x4362('0x5b')](_0x4362('0x67'),_0x23f54f);return respondWithRpcPromise('Reload',_0x4362('0x36'),{'module':'chan_sip.so'});})[_0x4362('0x52')](handleError(_0x42fb5,null));}; \ No newline at end of file +var _0x8c5d=['code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','VoiceContext','find','create','body','findAll','readFileSync','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','join','root','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xac62da,_0x18b7b4){var _0x3de8f9=function(_0x209cdb){while(--_0x209cdb){_0xac62da['push'](_0xac62da['shift']());}};_0x3de8f9(++_0x18b7b4);}(_0x8c5d,0x17b));var _0xd8c5=function(_0x5d8446,_0x2aced8){_0x5d8446=_0x5d8446-0x0;var _0x369239=_0x8c5d[_0x5d8446];return _0x369239;};'use strict';var emlformat=require(_0xd8c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8c5('0x1'));var jsonpatch=require(_0xd8c5('0x2'));var rp=require(_0xd8c5('0x3'));var moment=require('moment');var BPromise=require(_0xd8c5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd8c5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8c5('0x6'));var _=require(_0xd8c5('0x7'));var squel=require(_0xd8c5('0x8'));var crypto=require(_0xd8c5('0x9'));var jsforce=require(_0xd8c5('0xa'));var deskjs=require(_0xd8c5('0xb'));var toCsv=require(_0xd8c5('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8c5('0xd'));var authService=require(_0xd8c5('0xe'));var qs=require(_0xd8c5('0xf'));var as=require(_0xd8c5('0x10'));var hardwareService=require(_0xd8c5('0x11'));var logger=require(_0xd8c5('0x12'))(_0xd8c5('0x13'));var utils=require(_0xd8c5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd8c5('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd8c5('0x16'));var client=jayson[_0xd8c5('0x17')][_0xd8c5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3c959d,_0x52ac71,_0x24c3d6,_0x4c3aed){return new BPromise(function(_0x199901,_0x4c9f1f){var _0x5d644b=_0x4c3aed||client;return _0x5d644b[_0xd8c5('0x19')](_0x3c959d,_0x24c3d6)[_0xd8c5('0x1a')](function(_0x2ab14a){logger[_0xd8c5('0x1b')](_0xd8c5('0x1c'),_0x52ac71,_0xd8c5('0x1d'));logger[_0xd8c5('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x52ac71,_0xd8c5('0x1d'),JSON[_0xd8c5('0x1f')](_0x2ab14a));if(_0x2ab14a[_0xd8c5('0x20')]){if(_0x2ab14a[_0xd8c5('0x20')][_0xd8c5('0x21')]===0x1f4){logger[_0xd8c5('0x20')]('VoiceContext,\x20%s,\x20%s',_0x52ac71,_0x2ab14a[_0xd8c5('0x20')][_0xd8c5('0x22')]);return _0x4c9f1f(_0x2ab14a[_0xd8c5('0x20')][_0xd8c5('0x22')]);}logger[_0xd8c5('0x20')](_0xd8c5('0x1c'),_0x52ac71,_0x2ab14a['error'][_0xd8c5('0x22')]);return _0x199901(_0x2ab14a[_0xd8c5('0x20')][_0xd8c5('0x22')]);}else{logger[_0xd8c5('0x1b')](_0xd8c5('0x1c'),_0x52ac71,'request\x20sent');_0x199901(_0x2ab14a[_0xd8c5('0x23')][_0xd8c5('0x22')]);}})[_0xd8c5('0x24')](function(_0x2c22d3){logger[_0xd8c5('0x20')]('VoiceContext,\x20%s,\x20%s',_0x52ac71,_0x2c22d3);_0x4c9f1f(_0x2c22d3);});});}function respondWithStatusCode(_0x4f37f2,_0x5a5a17){_0x5a5a17=_0x5a5a17||0xcc;return function(_0xc5da5b){if(_0xc5da5b){return _0x4f37f2[_0xd8c5('0x25')](_0x5a5a17);}return _0x4f37f2['status'](_0x5a5a17)[_0xd8c5('0x26')]();};}function respondWithResult(_0x325d66,_0x69642e){_0x69642e=_0x69642e||0xc8;return function(_0x4cc27b){if(_0x4cc27b){return _0x325d66[_0xd8c5('0x27')](_0x69642e)[_0xd8c5('0x28')](_0x4cc27b);}};}function respondWithFilteredResult(_0x1bd7c3,_0xf8fe27){return function(_0x384a24){if(_0x384a24){var _0x54d4a3=typeof _0xf8fe27[_0xd8c5('0x29')]===_0xd8c5('0x2a')&&typeof _0xf8fe27['limit']===_0xd8c5('0x2a');var _0x3c31e2=_0x384a24[_0xd8c5('0x2b')];var _0x4df308=_0x54d4a3?0x0:_0xf8fe27[_0xd8c5('0x29')];var _0x3404b5=_0x54d4a3?_0x384a24[_0xd8c5('0x2b')]:_0xf8fe27['offset']+_0xf8fe27['limit'];var _0x47fffa;if(_0x3404b5>=_0x3c31e2){_0x3404b5=_0x3c31e2;_0x47fffa=0xc8;}else{_0x47fffa=0xce;}_0x1bd7c3[_0xd8c5('0x27')](_0x47fffa);return _0x1bd7c3[_0xd8c5('0x2c')](_0xd8c5('0x2d'),_0x4df308+'-'+_0x3404b5+'/'+_0x3c31e2)[_0xd8c5('0x28')](_0x384a24);}return null;};}function patchUpdates(_0x7d60eb){return function(_0x248a81){try{jsonpatch[_0xd8c5('0x2e')](_0x248a81,_0x7d60eb,!![]);}catch(_0x26f563){return BPromise[_0xd8c5('0x2f')](_0x26f563);}return _0x248a81[_0xd8c5('0x30')]();};}function saveUpdates(_0xac51ce,_0x4eb402){return function(_0x4447b5){if(_0x4447b5){return _0x4447b5['update'](_0xac51ce)['then'](function(_0x1e7386){return _0x1e7386;});}return null;};}function removeEntity(_0x1b2beb,_0x3856e4){return function(_0x4c8029){if(_0x4c8029){return _0x4c8029[_0xd8c5('0x31')]()['then'](function(){var _0x2bfbce=_0x4c8029[_0xd8c5('0x32')]({'plain':!![]});var _0x3ef2be='Contexts';return db[_0xd8c5('0x33')][_0xd8c5('0x31')]({'where':{'type':_0x3ef2be,'resourceId':_0x2bfbce['id']}})[_0xd8c5('0x1a')](function(){return _0x4c8029;});})['then'](function(){_0x1b2beb['status'](0xcc)[_0xd8c5('0x26')]();});}};}function handleEntityNotFound(_0x1f6544,_0x26263a){return function(_0x25fa7f){if(!_0x25fa7f){_0x1f6544[_0xd8c5('0x25')](0x194);}return _0x25fa7f;};}function handleError(_0x61f7f3,_0x37798e){_0x37798e=_0x37798e||0x1f4;return function(_0x318028){logger[_0xd8c5('0x20')](_0x318028[_0xd8c5('0x34')]);if(_0x318028['name']){delete _0x318028[_0xd8c5('0x35')];}_0x61f7f3[_0xd8c5('0x27')](_0x37798e)['send'](_0x318028);};}exports[_0xd8c5('0x36')]=function(_0xdc8271,_0x4df79d){var _0x544781={},_0x5ee9e3={},_0x42bb88={'count':0x0,'rows':[]};var _0x58c2b0=_[_0xd8c5('0x37')](db['VoiceContext'][_0xd8c5('0x38')],function(_0x5e48e1){return{'name':_0x5e48e1[_0xd8c5('0x39')],'type':_0x5e48e1[_0xd8c5('0x3a')][_0xd8c5('0x3b')]};});_0x5ee9e3[_0xd8c5('0x3c')]=_[_0xd8c5('0x37')](_0x58c2b0,_0xd8c5('0x35'));_0x5ee9e3['query']=_[_0xd8c5('0x3d')](_0xdc8271[_0xd8c5('0x3e')]);_0x5ee9e3[_0xd8c5('0x3f')]=_[_0xd8c5('0x40')](_0x5ee9e3[_0xd8c5('0x3c')],_0x5ee9e3[_0xd8c5('0x3e')]);_0x544781['attributes']=_[_0xd8c5('0x40')](_0x5ee9e3[_0xd8c5('0x3c')],qs[_0xd8c5('0x41')](_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x41')]));_0x544781['attributes']=_0x544781['attributes'][_0xd8c5('0x42')]?_0x544781[_0xd8c5('0x43')]:_0x5ee9e3[_0xd8c5('0x3c')];if(!_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x44')](_0xd8c5('0x45'))){_0x544781[_0xd8c5('0x46')]=qs[_0xd8c5('0x46')](_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x46')]);_0x544781[_0xd8c5('0x29')]=qs[_0xd8c5('0x29')](_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x29')]);}_0x544781['order']=qs[_0xd8c5('0x47')](_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x47')]);_0x544781[_0xd8c5('0x48')]=qs[_0xd8c5('0x3f')](_[_0xd8c5('0x49')](_0xdc8271[_0xd8c5('0x3e')],_0x5ee9e3['filters']),_0x58c2b0);if(_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x4a')]){_0x544781[_0xd8c5('0x48')]=_['merge'](_0x544781[_0xd8c5('0x48')],{'$or':_[_0xd8c5('0x37')](_0x58c2b0,function(_0x7ff1a0){if(_0x7ff1a0[_0xd8c5('0x3a')]!=='VIRTUAL'){var _0x2f5fbc={};_0x2f5fbc[_0x7ff1a0[_0xd8c5('0x35')]]={'$like':'%'+_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x4a')]+'%'};return _0x2f5fbc;}})});}_0x544781=_[_0xd8c5('0x4b')]({},_0x544781,_0xdc8271[_0xd8c5('0x4c')]);var _0x5c04df={'where':_0x544781[_0xd8c5('0x48')]};return db['VoiceContext'][_0xd8c5('0x2b')](_0x5c04df)[_0xd8c5('0x1a')](function(_0x289006){_0x42bb88['count']=_0x289006;if(_0xdc8271[_0xd8c5('0x3e')][_0xd8c5('0x4d')]){_0x544781[_0xd8c5('0x4e')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x544781);})[_0xd8c5('0x1a')](function(_0x4ac86f){_0x42bb88[_0xd8c5('0x4f')]=_0x4ac86f;return _0x42bb88;})[_0xd8c5('0x1a')](respondWithFilteredResult(_0x4df79d,_0x544781))[_0xd8c5('0x24')](handleError(_0x4df79d,null));};exports[_0xd8c5('0x50')]=function(_0x3bbb7e,_0x39ff6f){var _0xe78ca7={'raw':![],'where':{'id':_0x3bbb7e['params']['id']}},_0x104c9e={};_0x104c9e[_0xd8c5('0x3c')]=_[_0xd8c5('0x3d')](db[_0xd8c5('0x51')][_0xd8c5('0x38')]);_0x104c9e[_0xd8c5('0x3e')]=_[_0xd8c5('0x3d')](_0x3bbb7e[_0xd8c5('0x3e')]);_0x104c9e['filters']=_['intersection'](_0x104c9e[_0xd8c5('0x3c')],_0x104c9e[_0xd8c5('0x3e')]);_0xe78ca7[_0xd8c5('0x43')]=_[_0xd8c5('0x40')](_0x104c9e[_0xd8c5('0x3c')],qs[_0xd8c5('0x41')](_0x3bbb7e[_0xd8c5('0x3e')][_0xd8c5('0x41')]));_0xe78ca7[_0xd8c5('0x43')]=_0xe78ca7[_0xd8c5('0x43')][_0xd8c5('0x42')]?_0xe78ca7[_0xd8c5('0x43')]:_0x104c9e[_0xd8c5('0x3c')];if(_0x3bbb7e[_0xd8c5('0x3e')][_0xd8c5('0x4d')]){_0xe78ca7[_0xd8c5('0x4e')]=[{'all':!![]}];}_0xe78ca7=_['merge']({},_0xe78ca7,_0x3bbb7e[_0xd8c5('0x4c')]);return db[_0xd8c5('0x51')][_0xd8c5('0x52')](_0xe78ca7)[_0xd8c5('0x1a')](handleEntityNotFound(_0x39ff6f,null))['then'](respondWithResult(_0x39ff6f,null))[_0xd8c5('0x24')](handleError(_0x39ff6f,null));};exports[_0xd8c5('0x53')]=function(_0x262c3d,_0x12cfc1,_0x17a0d8){var _0xa8ebf;return db[_0xd8c5('0x51')][_0xd8c5('0x53')](_0x262c3d[_0xd8c5('0x54')],{'raw':!![]})[_0xd8c5('0x1a')](function(_0x4e63a7){_0xa8ebf=_0x4e63a7;return db['VoiceContext'][_0xd8c5('0x55')]({'raw':!![]});})[_0xd8c5('0x1a')](function(_0x4b2695){var _0x3e452f=fs[_0xd8c5('0x56')](path['join'](config['root'],_0xd8c5('0x57')),'utf8');var _0x318e5e=ejs[_0xd8c5('0x58')](_0x3e452f,{'contexts':_0x4b2695||[]});fs[_0xd8c5('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x318e5e);})['then'](function(){return respondWithRpcPromise(_0xd8c5('0x5a'),_0xd8c5('0x53'),{'module':_0xd8c5('0x5b')});})['then'](function(){var _0x18bc11=_0x262c3d['user'][_0xd8c5('0x32')]({'plain':!![]});if(!_0x18bc11)throw new Error(_0xd8c5('0x5c'));if(_0x18bc11[_0xd8c5('0x5d')]===_0xd8c5('0x5e')){var _0x323d9b=_0xa8ebf[_0xd8c5('0x32')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x18bc11[_0xd8c5('0x5f')]},'raw':!![]})[_0xd8c5('0x1a')](function(_0x48c76c){if(_0x48c76c&&_0x48c76c[_0xd8c5('0x60')]===0x0){return db[_0xd8c5('0x33')][_0xd8c5('0x53')]({'name':_0x323d9b[_0xd8c5('0x35')],'resourceId':_0x323d9b['id'],'type':_0x48c76c['name'],'sectionId':_0x48c76c['id']},{})['then'](function(){return _0xa8ebf;});}else{return _0xa8ebf;}})[_0xd8c5('0x24')](function(_0x19e35f){logger[_0xd8c5('0x20')](_0xd8c5('0x61'),_0x19e35f);throw _0x19e35f;});}return _0xa8ebf;})[_0xd8c5('0x1a')](respondWithResult(_0x12cfc1,0xc9))[_0xd8c5('0x24')](handleError(_0x12cfc1,null));};exports[_0xd8c5('0x62')]=function(_0x14f709,_0x218052,_0x17dd37){var _0x362bed;return db[_0xd8c5('0x51')]['find']({'where':{'id':_0x14f709[_0xd8c5('0x63')]['id']}})[_0xd8c5('0x1a')](handleEntityNotFound(_0x218052,null))[_0xd8c5('0x1a')](saveUpdates(_0x14f709[_0xd8c5('0x54')],null))['then'](function(_0x8ce1e4){if(_0x8ce1e4){_0x362bed=_0x8ce1e4;return db[_0xd8c5('0x51')][_0xd8c5('0x55')]({'raw':!![]});}})[_0xd8c5('0x1a')](function(_0x3114b4){var _0x2aff11=fs[_0xd8c5('0x56')](path[_0xd8c5('0x64')](config[_0xd8c5('0x65')],_0xd8c5('0x57')),'utf8');var _0x586f67=ejs[_0xd8c5('0x58')](_0x2aff11,{'contexts':_0x3114b4||[]});fs['writeFileSync'](_0xd8c5('0x66'),_0x586f67);})[_0xd8c5('0x1a')](function(){return respondWithRpcPromise(_0xd8c5('0x5a'),_0xd8c5('0x62'),{'module':'chan_sip.so'});})[_0xd8c5('0x1a')](function(){return _0x362bed;})[_0xd8c5('0x1a')](respondWithResult(_0x218052,null))[_0xd8c5('0x24')](handleError(_0x218052,null));};exports[_0xd8c5('0x31')]=function(_0x2df9d9,_0x2cb5cd,_0x205aa6){var _0x4def1e;return db[_0xd8c5('0x51')][_0xd8c5('0x52')]({'where':{'id':_0x2df9d9['params']['id']}})[_0xd8c5('0x1a')](handleEntityNotFound(_0x2cb5cd,null))[_0xd8c5('0x1a')](removeEntity(_0x2cb5cd,null))['then'](function(){return db[_0xd8c5('0x51')][_0xd8c5('0x55')]({'raw':!![]});})[_0xd8c5('0x1a')](function(_0x5609c3){var _0x23df0b=fs[_0xd8c5('0x56')](path[_0xd8c5('0x64')](config['root'],_0xd8c5('0x57')),'utf8');var _0x24b133=ejs[_0xd8c5('0x58')](_0x23df0b,{'contexts':_0x5609c3});fs[_0xd8c5('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x24b133);return respondWithRpcPromise('Reload',_0xd8c5('0x31'),{'module':_0xd8c5('0x5b')});})['catch'](handleError(_0x2cb5cd,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fdd592d..b858e82 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 _0xb760=['VoiceContext','voice_contexts','util','api','moment','request-promise','path','rimraf','exports'];(function(_0x340354,_0x10a52d){var _0x446c58=function(_0x5dc4d9){while(--_0x5dc4d9){_0x340354['push'](_0x340354['shift']());}};_0x446c58(++_0x10a52d);}(_0xb760,0x161));var _0x0b76=function(_0x407651,_0x3663b2){_0x407651=_0x407651-0x0;var _0x158b7e=_0xb760[_0x407651];return _0x158b7e;};'use strict';var _=require('lodash');var util=require(_0x0b76('0x0'));var logger=require('../../config/logger')(_0x0b76('0x1'));var moment=require(_0x0b76('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b76('0x3'));var fs=require('fs');var path=require(_0x0b76('0x4'));var rimraf=require(_0x0b76('0x5'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x0b76('0x6')]=function(_0x23c0fd,_0x5abba3){return _0x23c0fd['define'](_0x0b76('0x7'),attributes,{'tableName':_0x0b76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4429=['rimraf','../../config/environment','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x4429,0x1ce));var _0x9442=function(_0xcee175,_0x4dd11b){_0xcee175=_0xcee175-0x0;var _0x107cce=_0x4429[_0xcee175];return _0x107cce;};'use strict';var _=require('lodash');var util=require(_0x9442('0x0'));var logger=require(_0x9442('0x1'))(_0x9442('0x2'));var moment=require(_0x9442('0x3'));var BPromise=require('bluebird');var rp=require(_0x9442('0x4'));var fs=require('fs');var path=require(_0x9442('0x5'));var rimraf=require(_0x9442('0x6'));var config=require(_0x9442('0x7'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x4bee35,_0x1a5aa7){return _0x4bee35[_0x9442('0x8')]('VoiceContext',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 2826a5f..6b6c185 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 _0x757c=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0x5ea952,_0xc78c71){var _0x45d14e=function(_0x7f3429){while(--_0x7f3429){_0x5ea952['push'](_0x5ea952['shift']());}};_0x45d14e(++_0xc78c71);}(_0x757c,0x191));var _0xc757=function(_0x18ad0c,_0x2facfa){_0x18ad0c=_0x18ad0c-0x0;var _0x28d4cf=_0x757c[_0x18ad0c];return _0x28d4cf;};'use strict';var _=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var moment=require('moment');var BPromise=require(_0xc757('0x2'));var rs=require(_0xc757('0x3'));var fs=require('fs');var Redis=require(_0xc757('0x4'));var db=require(_0xc757('0x5'))['db'];var utils=require(_0xc757('0x6'));var logger=require(_0xc757('0x7'))(_0xc757('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc757('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fff5d,_0x6a9867,_0x78a1e2){return new BPromise(function(_0x280ca0,_0x112111){return client[_0xc757('0xa')](_0x4fff5d,_0x78a1e2)[_0xc757('0xb')](function(_0x53d71b){logger['info'](_0xc757('0xc'),_0x6a9867,'request\x20sent');logger[_0xc757('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x6a9867,_0xc757('0xe'),JSON['stringify'](_0x53d71b));if(_0x53d71b[_0xc757('0xf')]){if(_0x53d71b[_0xc757('0xf')][_0xc757('0x10')]===0x1f4){logger[_0xc757('0xf')](_0xc757('0xc'),_0x6a9867,_0x53d71b['error'][_0xc757('0x11')]);return _0x112111(_0x53d71b[_0xc757('0xf')][_0xc757('0x11')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x6a9867,_0x53d71b[_0xc757('0xf')][_0xc757('0x11')]);return _0x280ca0(_0x53d71b[_0xc757('0xf')][_0xc757('0x11')]);}else{logger[_0xc757('0x12')]('VoiceContext,\x20%s,\x20%s',_0x6a9867,_0xc757('0xe'));_0x280ca0(_0x53d71b[_0xc757('0x13')][_0xc757('0x11')]);}})['catch'](function(_0x21ed91){logger[_0xc757('0xf')](_0xc757('0xc'),_0x6a9867,_0x21ed91);_0x112111(_0x21ed91);});});} \ No newline at end of file +var _0xdacc=['VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x597953,_0x204753){var _0x57c3e0=function(_0x5620a5){while(--_0x5620a5){_0x597953['push'](_0x597953['shift']());}};_0x57c3e0(++_0x204753);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xcdac('0x0'));var moment=require(_0xcdac('0x1'));var BPromise=require(_0xcdac('0x2'));var rs=require(_0xcdac('0x3'));var fs=require('fs');var Redis=require(_0xcdac('0x4'));var db=require(_0xcdac('0x5'))['db'];var utils=require(_0xcdac('0x6'));var logger=require('../../config/logger')(_0xcdac('0x7'));var config=require(_0xcdac('0x8'));var jayson=require(_0xcdac('0x9'));var client=jayson[_0xcdac('0xa')][_0xcdac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a10a1,_0x20a66e,_0x46ad29){return new BPromise(function(_0xe906b8,_0x213c05){return client[_0xcdac('0xc')](_0x2a10a1,_0x46ad29)[_0xcdac('0xd')](function(_0x33c4af){logger[_0xcdac('0xe')](_0xcdac('0xf'),_0x20a66e,_0xcdac('0x10'));logger['debug'](_0xcdac('0x11'),_0x20a66e,_0xcdac('0x10'),JSON['stringify'](_0x33c4af));if(_0x33c4af[_0xcdac('0x12')]){if(_0x33c4af[_0xcdac('0x12')][_0xcdac('0x13')]===0x1f4){logger[_0xcdac('0x12')](_0xcdac('0xf'),_0x20a66e,_0x33c4af['error']['message']);return _0x213c05(_0x33c4af[_0xcdac('0x12')]['message']);}logger[_0xcdac('0x12')]('VoiceContext,\x20%s,\x20%s',_0x20a66e,_0x33c4af['error'][_0xcdac('0x14')]);return _0xe906b8(_0x33c4af[_0xcdac('0x12')][_0xcdac('0x14')]);}else{logger[_0xcdac('0xe')](_0xcdac('0xf'),_0x20a66e,_0xcdac('0x10'));_0xe906b8(_0x33c4af['result'][_0xcdac('0x14')]);}})[_0xcdac('0x15')](function(_0x542a27){logger[_0xcdac('0x12')](_0xcdac('0xf'),_0x20a66e,_0x542a27);_0x213c05(_0x542a27);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 60385ec..894eab5 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 _0xad36=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','post','put','/:id','destroy','exports','multer','util'];(function(_0x55d016,_0x30fdcf){var _0x57cdc5=function(_0x4a80cc){while(--_0x4a80cc){_0x55d016['push'](_0x55d016['shift']());}};_0x57cdc5(++_0x30fdcf);}(_0xad36,0x1c6));var _0x6ad3=function(_0x523e65,_0x51144b){_0x523e65=_0x523e65-0x0;var _0x7276d0=_0xad36[_0x523e65];return _0x7276d0;};'use strict';var multer=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var path=require(_0x6ad3('0x2'));var timeout=require(_0x6ad3('0x3'));var express=require(_0x6ad3('0x4'));var router=express[_0x6ad3('0x5')]();var fs_extra=require(_0x6ad3('0x6'));var auth=require(_0x6ad3('0x7'));var interaction=require(_0x6ad3('0x8'));var config=require(_0x6ad3('0x9'));var controller=require('./voiceDialReport.controller');router[_0x6ad3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ad3('0xa')](_0x6ad3('0xb'),auth[_0x6ad3('0xc')](),controller[_0x6ad3('0xd')]);router[_0x6ad3('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6ad3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6ad3('0xf')](_0x6ad3('0x10'),auth[_0x6ad3('0xc')](),controller['update']);router['delete']('/:id',auth[_0x6ad3('0xc')](),controller[_0x6ad3('0x11')]);module[_0x6ad3('0x12')]=router; \ No newline at end of file +var _0x2b87=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','destroy','exports','multer'];(function(_0x292ed7,_0x4fe68e){var _0xcfb8a0=function(_0x4d133e){while(--_0x4d133e){_0x292ed7['push'](_0x292ed7['shift']());}};_0xcfb8a0(++_0x4fe68e);}(_0x2b87,0x186));var _0x72b8=function(_0x4158db,_0x5bfff8){_0x4158db=_0x4158db-0x0;var _0x3051dc=_0x2b87[_0x4158db];return _0x3051dc;};'use strict';var multer=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var path=require(_0x72b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x72b8('0x3'));var auth=require(_0x72b8('0x4'));var interaction=require(_0x72b8('0x5'));var config=require(_0x72b8('0x6'));var controller=require(_0x72b8('0x7'));router[_0x72b8('0x8')]('/',auth[_0x72b8('0x9')](),controller[_0x72b8('0xa')]);router['get'](_0x72b8('0xb'),auth[_0x72b8('0x9')](),controller['describe']);router[_0x72b8('0x8')](_0x72b8('0xc'),auth[_0x72b8('0x9')](),controller['show']);router[_0x72b8('0xd')]('/',auth[_0x72b8('0x9')](),controller[_0x72b8('0xe')]);router['put'](_0x72b8('0xc'),auth[_0x72b8('0x9')](),controller['update']);router['delete'](_0x72b8('0xc'),auth['isAuthenticated'](),controller[_0x72b8('0xf')]);module[_0x72b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c520bb6..728cda8 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 _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0xe14d,0x1ee));var _0xde14=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe14d[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9fa9795..4971884 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 _0xecc4=['options','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params'];(function(_0x30e17a,_0x32c456){var _0x4df636=function(_0x973489){while(--_0x973489){_0x30e17a['push'](_0x30e17a['shift']());}};_0x4df636(++_0x32c456);}(_0xecc4,0x9f));var _0x4ecc=function(_0x535896,_0x25b20f){_0x535896=_0x535896-0x0;var _0x25f2d8=_0xecc4[_0x535896];return _0x25f2d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ecc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ecc('0x1'));var rp=require('request-promise');var moment=require(_0x4ecc('0x2'));var BPromise=require(_0x4ecc('0x3'));var Mustache=require('mustache');var util=require(_0x4ecc('0x4'));var path=require(_0x4ecc('0x5'));var sox=require(_0x4ecc('0x6'));var csv=require(_0x4ecc('0x7'));var ejs=require(_0x4ecc('0x8'));var fs=require('fs');var fs_extra=require(_0x4ecc('0x9'));var _=require('lodash');var squel=require(_0x4ecc('0xa'));var crypto=require('crypto');var jsforce=require(_0x4ecc('0xb'));var deskjs=require(_0x4ecc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ecc('0xd'));var Redis=require(_0x4ecc('0xe'));var authService=require(_0x4ecc('0xf'));var qs=require(_0x4ecc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ecc('0x11'));var logger=require(_0x4ecc('0x12'))(_0x4ecc('0x13'));var utils=require(_0x4ecc('0x14'));var config=require(_0x4ecc('0x15'));var licenseUtil=require(_0x4ecc('0x16'));var db=require(_0x4ecc('0x17'))['db'];function respondWithStatusCode(_0x1e00bb,_0x4de494){_0x4de494=_0x4de494||0xcc;return function(_0x4a76fd){if(_0x4a76fd){return _0x1e00bb['sendStatus'](_0x4de494);}return _0x1e00bb[_0x4ecc('0x18')](_0x4de494)[_0x4ecc('0x19')]();};}function respondWithResult(_0x2b4516,_0xd28c52){_0xd28c52=_0xd28c52||0xc8;return function(_0x44e4ce){if(_0x44e4ce){return _0x2b4516[_0x4ecc('0x18')](_0xd28c52)['json'](_0x44e4ce);}};}function respondWithFilteredResult(_0x5b1533,_0x184aa9){return function(_0x27fca7){if(_0x27fca7){var _0x27a5fe=typeof _0x184aa9[_0x4ecc('0x1a')]==='undefined'&&typeof _0x184aa9[_0x4ecc('0x1b')]===_0x4ecc('0x1c');var _0x3ab152=_0x27fca7[_0x4ecc('0x1d')];var _0x397a48=_0x27a5fe?0x0:_0x184aa9['offset'];var _0x588791=_0x27a5fe?_0x27fca7['count']:_0x184aa9['offset']+_0x184aa9[_0x4ecc('0x1b')];var _0x367cea;if(_0x588791>=_0x3ab152){_0x588791=_0x3ab152;_0x367cea=0xc8;}else{_0x367cea=0xce;}_0x5b1533[_0x4ecc('0x18')](_0x367cea);return _0x5b1533[_0x4ecc('0x1e')](_0x4ecc('0x1f'),_0x397a48+'-'+_0x588791+'/'+_0x3ab152)[_0x4ecc('0x20')](_0x27fca7);}return null;};}function patchUpdates(_0x562f6a){return function(_0x5a4d46){try{jsonpatch[_0x4ecc('0x21')](_0x5a4d46,_0x562f6a,!![]);}catch(_0x474544){return BPromise[_0x4ecc('0x22')](_0x474544);}return _0x5a4d46[_0x4ecc('0x23')]();};}function saveUpdates(_0x3d8590,_0x484bce){return function(_0x24282d){if(_0x24282d){return _0x24282d[_0x4ecc('0x24')](_0x3d8590)[_0x4ecc('0x25')](function(_0xe1b0b4){return _0xe1b0b4;});}return null;};}function removeEntity(_0x9746bd,_0x3bc217){return function(_0x5e53bd){if(_0x5e53bd){return _0x5e53bd[_0x4ecc('0x26')]()[_0x4ecc('0x25')](function(){_0x9746bd['status'](0xcc)[_0x4ecc('0x19')]();});}};}function handleEntityNotFound(_0xc22a04,_0x289288){return function(_0x321c9d){if(!_0x321c9d){_0xc22a04[_0x4ecc('0x27')](0x194);}return _0x321c9d;};}function handleError(_0x3c0daa,_0xd5134c){_0xd5134c=_0xd5134c||0x1f4;return function(_0x1751f5){logger[_0x4ecc('0x28')](_0x1751f5[_0x4ecc('0x29')]);if(_0x1751f5['name']){delete _0x1751f5[_0x4ecc('0x2a')];}_0x3c0daa['status'](_0xd5134c)[_0x4ecc('0x2b')](_0x1751f5);};}exports[_0x4ecc('0x2c')]=function(_0x49b629,_0x4f0244){var _0x2e2c70={},_0x55098c={},_0x3a33d6={'count':0x0,'rows':[]};var _0x59ba75=_[_0x4ecc('0x2d')](db[_0x4ecc('0x2e')][_0x4ecc('0x2f')],function(_0x1fb952){return{'name':_0x1fb952[_0x4ecc('0x30')],'type':_0x1fb952['type'][_0x4ecc('0x31')]};});_0x55098c[_0x4ecc('0x32')]=_[_0x4ecc('0x2d')](_0x59ba75,_0x4ecc('0x2a'));_0x55098c[_0x4ecc('0x33')]=_[_0x4ecc('0x34')](_0x49b629['query']);_0x55098c[_0x4ecc('0x35')]=_['intersection'](_0x55098c[_0x4ecc('0x32')],_0x55098c[_0x4ecc('0x33')]);_0x2e2c70[_0x4ecc('0x36')]=_[_0x4ecc('0x37')](_0x55098c[_0x4ecc('0x32')],qs[_0x4ecc('0x38')](_0x49b629[_0x4ecc('0x33')]['fields']));_0x2e2c70[_0x4ecc('0x36')]=_0x2e2c70[_0x4ecc('0x36')][_0x4ecc('0x39')]?_0x2e2c70[_0x4ecc('0x36')]:_0x55098c[_0x4ecc('0x32')];if(!_0x49b629[_0x4ecc('0x33')][_0x4ecc('0x3a')](_0x4ecc('0x3b'))){_0x2e2c70['limit']=qs[_0x4ecc('0x1b')](_0x49b629[_0x4ecc('0x33')][_0x4ecc('0x1b')]);_0x2e2c70[_0x4ecc('0x1a')]=qs[_0x4ecc('0x1a')](_0x49b629[_0x4ecc('0x33')]['offset']);}_0x2e2c70[_0x4ecc('0x3c')]=qs['sort'](_0x49b629[_0x4ecc('0x33')]['sort']);_0x2e2c70[_0x4ecc('0x3d')]=qs[_0x4ecc('0x35')](_[_0x4ecc('0x3e')](_0x49b629[_0x4ecc('0x33')],_0x55098c[_0x4ecc('0x35')]),_0x59ba75);if(_0x49b629[_0x4ecc('0x33')][_0x4ecc('0x3f')]){_0x2e2c70[_0x4ecc('0x3d')]=_[_0x4ecc('0x40')](_0x2e2c70['where'],{'$or':_['map'](_0x59ba75,function(_0x35e879){if(_0x35e879[_0x4ecc('0x41')]!=='VIRTUAL'){var _0x2dcd76={};_0x2dcd76[_0x35e879[_0x4ecc('0x2a')]]={'$like':'%'+_0x49b629[_0x4ecc('0x33')][_0x4ecc('0x3f')]+'%'};return _0x2dcd76;}})});}_0x2e2c70=_[_0x4ecc('0x40')]({},_0x2e2c70,_0x49b629['options']);var _0x575b52={'where':_0x2e2c70[_0x4ecc('0x3d')]};return db[_0x4ecc('0x2e')][_0x4ecc('0x1d')](_0x575b52)['then'](function(_0x22fcc2){_0x3a33d6[_0x4ecc('0x1d')]=_0x22fcc2;if(_0x49b629['query'][_0x4ecc('0x42')]){_0x2e2c70[_0x4ecc('0x43')]=[{'all':!![]}];}return db[_0x4ecc('0x2e')]['findAll'](_0x2e2c70);})['then'](function(_0x29bd22){_0x3a33d6[_0x4ecc('0x44')]=_0x29bd22;return _0x3a33d6;})[_0x4ecc('0x25')](respondWithFilteredResult(_0x4f0244,_0x2e2c70))[_0x4ecc('0x45')](handleError(_0x4f0244,null));};exports[_0x4ecc('0x46')]=function(_0x15fda3,_0x5626ad){var _0x1dc7f7={'raw':!![],'where':{'id':_0x15fda3[_0x4ecc('0x47')]['id']}},_0x45077a={};_0x45077a[_0x4ecc('0x32')]=_[_0x4ecc('0x34')](db[_0x4ecc('0x2e')][_0x4ecc('0x2f')]);_0x45077a[_0x4ecc('0x33')]=_[_0x4ecc('0x34')](_0x15fda3[_0x4ecc('0x33')]);_0x45077a[_0x4ecc('0x35')]=_[_0x4ecc('0x37')](_0x45077a['model'],_0x45077a[_0x4ecc('0x33')]);_0x1dc7f7[_0x4ecc('0x36')]=_[_0x4ecc('0x37')](_0x45077a[_0x4ecc('0x32')],qs['fields'](_0x15fda3[_0x4ecc('0x33')]['fields']));_0x1dc7f7['attributes']=_0x1dc7f7['attributes']['length']?_0x1dc7f7['attributes']:_0x45077a['model'];if(_0x15fda3[_0x4ecc('0x33')][_0x4ecc('0x42')]){_0x1dc7f7[_0x4ecc('0x43')]=[{'all':!![]}];}_0x1dc7f7=_['merge']({},_0x1dc7f7,_0x15fda3[_0x4ecc('0x48')]);return db[_0x4ecc('0x2e')][_0x4ecc('0x49')](_0x1dc7f7)['then'](handleEntityNotFound(_0x5626ad,null))[_0x4ecc('0x25')](respondWithResult(_0x5626ad,null))['catch'](handleError(_0x5626ad,null));};exports[_0x4ecc('0x4a')]=function(_0x3b0547,_0x3c8f95){return db[_0x4ecc('0x2e')][_0x4ecc('0x4a')](_0x3b0547[_0x4ecc('0x4b')],{})['then'](respondWithResult(_0x3c8f95,0xc9))['catch'](handleError(_0x3c8f95,null));};exports[_0x4ecc('0x24')]=function(_0x4e5f44,_0x1737f5){if(_0x4e5f44[_0x4ecc('0x4b')]['id']){delete _0x4e5f44['body']['id'];}return db[_0x4ecc('0x2e')][_0x4ecc('0x49')]({'where':{'id':_0x4e5f44['params']['id']}})[_0x4ecc('0x25')](handleEntityNotFound(_0x1737f5,null))[_0x4ecc('0x25')](saveUpdates(_0x4e5f44['body'],null))[_0x4ecc('0x25')](respondWithResult(_0x1737f5,null))[_0x4ecc('0x45')](handleError(_0x1737f5,null));};exports[_0x4ecc('0x26')]=function(_0x138593,_0x5bfb2d){return db['VoiceDialReport'][_0x4ecc('0x49')]({'where':{'id':_0x138593[_0x4ecc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bfb2d,null))[_0x4ecc('0x25')](removeEntity(_0x5bfb2d,null))[_0x4ecc('0x45')](handleError(_0x5bfb2d,null));};exports[_0x4ecc('0x4c')]=function(_0x351ddb,_0x5e0ae2){return db[_0x4ecc('0x2e')][_0x4ecc('0x4c')]()[_0x4ecc('0x25')](respondWithResult(_0x5e0ae2,null))['catch'](handleError(_0x5e0ae2,null));}; \ No newline at end of file +var _0x7c9a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5bc03d,_0x4b8890){var _0x57b8f2=function(_0x33245d){while(--_0x33245d){_0x5bc03d['push'](_0x5bc03d['shift']());}};_0x57b8f2(++_0x4b8890);}(_0x7c9a,0x161));var _0xa7c9=function(_0x5b6220,_0x1cfa87){_0x5b6220=_0x5b6220-0x0;var _0x1f2561=_0x7c9a[_0x5b6220];return _0x1f2561;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7c9('0x0'));var zipdir=require(_0xa7c9('0x1'));var jsonpatch=require(_0xa7c9('0x2'));var rp=require('request-promise');var moment=require(_0xa7c9('0x3'));var BPromise=require(_0xa7c9('0x4'));var Mustache=require(_0xa7c9('0x5'));var util=require(_0xa7c9('0x6'));var path=require(_0xa7c9('0x7'));var sox=require(_0xa7c9('0x8'));var csv=require('to-csv');var ejs=require(_0xa7c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa7c9('0xa'));var crypto=require(_0xa7c9('0xb'));var jsforce=require(_0xa7c9('0xc'));var deskjs=require(_0xa7c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa7c9('0xe'));var Papa=require(_0xa7c9('0xf'));var Redis=require(_0xa7c9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa7c9('0x11'));var as=require(_0xa7c9('0x12'));var hardwareService=require(_0xa7c9('0x13'));var logger=require(_0xa7c9('0x14'))(_0xa7c9('0x15'));var utils=require(_0xa7c9('0x16'));var config=require(_0xa7c9('0x17'));var licenseUtil=require(_0xa7c9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d89c7,_0x32620e){_0x32620e=_0x32620e||0xcc;return function(_0x478590){if(_0x478590){return _0x5d89c7['sendStatus'](_0x32620e);}return _0x5d89c7[_0xa7c9('0x19')](_0x32620e)['end']();};}function respondWithResult(_0x2b0978,_0x4c6038){_0x4c6038=_0x4c6038||0xc8;return function(_0x4c6b8b){if(_0x4c6b8b){return _0x2b0978[_0xa7c9('0x19')](_0x4c6038)[_0xa7c9('0x1a')](_0x4c6b8b);}};}function respondWithFilteredResult(_0x188b4f,_0x13b85d){return function(_0x22101b){if(_0x22101b){var _0xd966ff=typeof _0x13b85d[_0xa7c9('0x1b')]===_0xa7c9('0x1c')&&typeof _0x13b85d['limit']===_0xa7c9('0x1c');var _0xebd32b=_0x22101b[_0xa7c9('0x1d')];var _0x1ef1a1=_0xd966ff?0x0:_0x13b85d[_0xa7c9('0x1b')];var _0x19c052=_0xd966ff?_0x22101b[_0xa7c9('0x1d')]:_0x13b85d[_0xa7c9('0x1b')]+_0x13b85d['limit'];var _0x1d53a6;if(_0x19c052>=_0xebd32b){_0x19c052=_0xebd32b;_0x1d53a6=0xc8;}else{_0x1d53a6=0xce;}_0x188b4f[_0xa7c9('0x19')](_0x1d53a6);return _0x188b4f['set']('Content-Range',_0x1ef1a1+'-'+_0x19c052+'/'+_0xebd32b)[_0xa7c9('0x1a')](_0x22101b);}return null;};}function patchUpdates(_0x395194){return function(_0x45b430){try{jsonpatch[_0xa7c9('0x1e')](_0x45b430,_0x395194,!![]);}catch(_0x34c855){return BPromise[_0xa7c9('0x1f')](_0x34c855);}return _0x45b430[_0xa7c9('0x20')]();};}function saveUpdates(_0x5b49d1,_0x560a98){return function(_0x5bdbe9){if(_0x5bdbe9){return _0x5bdbe9[_0xa7c9('0x21')](_0x5b49d1)[_0xa7c9('0x22')](function(_0x3f6b40){return _0x3f6b40;});}return null;};}function removeEntity(_0x5e0b58,_0x22f658){return function(_0x1cc1a3){if(_0x1cc1a3){return _0x1cc1a3[_0xa7c9('0x23')]()[_0xa7c9('0x22')](function(){_0x5e0b58[_0xa7c9('0x19')](0xcc)[_0xa7c9('0x24')]();});}};}function handleEntityNotFound(_0x5ad5f7,_0x267cbb){return function(_0x5ba864){if(!_0x5ba864){_0x5ad5f7[_0xa7c9('0x25')](0x194);}return _0x5ba864;};}function handleError(_0x4d52e5,_0x3ab7b2){_0x3ab7b2=_0x3ab7b2||0x1f4;return function(_0x26e185){logger[_0xa7c9('0x26')](_0x26e185['stack']);if(_0x26e185[_0xa7c9('0x27')]){delete _0x26e185['name'];}_0x4d52e5[_0xa7c9('0x19')](_0x3ab7b2)[_0xa7c9('0x28')](_0x26e185);};}exports[_0xa7c9('0x29')]=function(_0x4c4c15,_0x17d569){var _0x310a6c={},_0x1f9bb3={},_0x2f1af0={'count':0x0,'rows':[]};var _0x37d4fa=_[_0xa7c9('0x2a')](db[_0xa7c9('0x2b')][_0xa7c9('0x2c')],function(_0x343868){return{'name':_0x343868[_0xa7c9('0x2d')],'type':_0x343868[_0xa7c9('0x2e')]['key']};});_0x1f9bb3[_0xa7c9('0x2f')]=_['map'](_0x37d4fa,'name');_0x1f9bb3[_0xa7c9('0x30')]=_['keys'](_0x4c4c15[_0xa7c9('0x30')]);_0x1f9bb3[_0xa7c9('0x31')]=_[_0xa7c9('0x32')](_0x1f9bb3[_0xa7c9('0x2f')],_0x1f9bb3[_0xa7c9('0x30')]);_0x310a6c[_0xa7c9('0x33')]=_[_0xa7c9('0x32')](_0x1f9bb3[_0xa7c9('0x2f')],qs[_0xa7c9('0x34')](_0x4c4c15['query'][_0xa7c9('0x34')]));_0x310a6c[_0xa7c9('0x33')]=_0x310a6c[_0xa7c9('0x33')]['length']?_0x310a6c['attributes']:_0x1f9bb3[_0xa7c9('0x2f')];if(!_0x4c4c15[_0xa7c9('0x30')][_0xa7c9('0x35')](_0xa7c9('0x36'))){_0x310a6c[_0xa7c9('0x37')]=qs[_0xa7c9('0x37')](_0x4c4c15[_0xa7c9('0x30')][_0xa7c9('0x37')]);_0x310a6c[_0xa7c9('0x1b')]=qs[_0xa7c9('0x1b')](_0x4c4c15[_0xa7c9('0x30')][_0xa7c9('0x1b')]);}_0x310a6c[_0xa7c9('0x38')]=qs[_0xa7c9('0x39')](_0x4c4c15[_0xa7c9('0x30')][_0xa7c9('0x39')]);_0x310a6c[_0xa7c9('0x3a')]=qs[_0xa7c9('0x31')](_[_0xa7c9('0x3b')](_0x4c4c15[_0xa7c9('0x30')],_0x1f9bb3[_0xa7c9('0x31')]),_0x37d4fa);if(_0x4c4c15[_0xa7c9('0x30')]['filter']){_0x310a6c[_0xa7c9('0x3a')]=_[_0xa7c9('0x3c')](_0x310a6c['where'],{'$or':_['map'](_0x37d4fa,function(_0x22921d){if(_0x22921d[_0xa7c9('0x2e')]!=='VIRTUAL'){var _0x236f9d={};_0x236f9d[_0x22921d['name']]={'$like':'%'+_0x4c4c15['query']['filter']+'%'};return _0x236f9d;}})});}_0x310a6c=_[_0xa7c9('0x3c')]({},_0x310a6c,_0x4c4c15[_0xa7c9('0x3d')]);var _0x308046={'where':_0x310a6c['where']};return db[_0xa7c9('0x2b')][_0xa7c9('0x1d')](_0x308046)[_0xa7c9('0x22')](function(_0x5458e5){_0x2f1af0[_0xa7c9('0x1d')]=_0x5458e5;if(_0x4c4c15[_0xa7c9('0x30')][_0xa7c9('0x3e')]){_0x310a6c[_0xa7c9('0x3f')]=[{'all':!![]}];}return db[_0xa7c9('0x2b')][_0xa7c9('0x40')](_0x310a6c);})[_0xa7c9('0x22')](function(_0x26dda4){_0x2f1af0[_0xa7c9('0x41')]=_0x26dda4;return _0x2f1af0;})[_0xa7c9('0x22')](respondWithFilteredResult(_0x17d569,_0x310a6c))['catch'](handleError(_0x17d569,null));};exports[_0xa7c9('0x42')]=function(_0x5dd8d9,_0xe5fa89){var _0x357c2f={'raw':!![],'where':{'id':_0x5dd8d9[_0xa7c9('0x43')]['id']}},_0x2b691d={};_0x2b691d['model']=_[_0xa7c9('0x44')](db[_0xa7c9('0x2b')][_0xa7c9('0x2c')]);_0x2b691d[_0xa7c9('0x30')]=_['keys'](_0x5dd8d9[_0xa7c9('0x30')]);_0x2b691d[_0xa7c9('0x31')]=_[_0xa7c9('0x32')](_0x2b691d[_0xa7c9('0x2f')],_0x2b691d[_0xa7c9('0x30')]);_0x357c2f[_0xa7c9('0x33')]=_[_0xa7c9('0x32')](_0x2b691d['model'],qs[_0xa7c9('0x34')](_0x5dd8d9[_0xa7c9('0x30')]['fields']));_0x357c2f['attributes']=_0x357c2f[_0xa7c9('0x33')]['length']?_0x357c2f[_0xa7c9('0x33')]:_0x2b691d[_0xa7c9('0x2f')];if(_0x5dd8d9['query']['includeAll']){_0x357c2f[_0xa7c9('0x3f')]=[{'all':!![]}];}_0x357c2f=_[_0xa7c9('0x3c')]({},_0x357c2f,_0x5dd8d9[_0xa7c9('0x3d')]);return db[_0xa7c9('0x2b')][_0xa7c9('0x45')](_0x357c2f)[_0xa7c9('0x22')](handleEntityNotFound(_0xe5fa89,null))[_0xa7c9('0x22')](respondWithResult(_0xe5fa89,null))['catch'](handleError(_0xe5fa89,null));};exports[_0xa7c9('0x46')]=function(_0x569cae,_0x46425b){return db[_0xa7c9('0x2b')][_0xa7c9('0x46')](_0x569cae[_0xa7c9('0x47')],{})[_0xa7c9('0x22')](respondWithResult(_0x46425b,0xc9))['catch'](handleError(_0x46425b,null));};exports[_0xa7c9('0x21')]=function(_0x2830f0,_0x492c9c){if(_0x2830f0[_0xa7c9('0x47')]['id']){delete _0x2830f0['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x2830f0[_0xa7c9('0x43')]['id']}})[_0xa7c9('0x22')](handleEntityNotFound(_0x492c9c,null))['then'](saveUpdates(_0x2830f0[_0xa7c9('0x47')],null))[_0xa7c9('0x22')](respondWithResult(_0x492c9c,null))[_0xa7c9('0x48')](handleError(_0x492c9c,null));};exports[_0xa7c9('0x23')]=function(_0x41453e,_0x1ca399){return db['VoiceDialReport'][_0xa7c9('0x45')]({'where':{'id':_0x41453e[_0xa7c9('0x43')]['id']}})[_0xa7c9('0x22')](handleEntityNotFound(_0x1ca399,null))[_0xa7c9('0x22')](removeEntity(_0x1ca399,null))[_0xa7c9('0x48')](handleError(_0x1ca399,null));};exports[_0xa7c9('0x49')]=function(_0x4cd8de,_0x57a325){return db[_0xa7c9('0x2b')][_0xa7c9('0x49')]()['then'](respondWithResult(_0x57a325,null))['catch'](handleError(_0x57a325,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c02a35e..3352774 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 _0x9275=['exports','define','VoiceDialReport','report_dial','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x9275,0x130));var _0x5927=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x9275[_0x3203a1];return _0x24215e;};'use strict';var _=require('lodash');var util=require(_0x5927('0x0'));var logger=require(_0x5927('0x1'))(_0x5927('0x2'));var moment=require('moment');var BPromise=require(_0x5927('0x3'));var rp=require(_0x5927('0x4'));var fs=require('fs');var path=require(_0x5927('0x5'));var rimraf=require(_0x5927('0x6'));var config=require(_0x5927('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x5927('0x8')]=function(_0x495127,_0x33b925){return _0x495127[_0x5927('0x9')](_0x5927('0xa'),attributes,{'tableName':_0x5927('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cfd=['request-promise','path','rimraf','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xb42568,_0x398da2){var _0x5c508f=function(_0x37b40e){while(--_0x37b40e){_0xb42568['push'](_0xb42568['shift']());}};_0x5c508f(++_0x398da2);}(_0x1cfd,0x1db));var _0xd1cf=function(_0x512c29,_0x3dd890){_0x512c29=_0x512c29-0x0;var _0x162363=_0x1cfd[_0x512c29];return _0x162363;};'use strict';var _=require(_0xd1cf('0x0'));var util=require(_0xd1cf('0x1'));var logger=require(_0xd1cf('0x2'))(_0xd1cf('0x3'));var moment=require(_0xd1cf('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1cf('0x5'));var fs=require('fs');var path=require(_0xd1cf('0x6'));var rimraf=require(_0xd1cf('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xd1cf('0x8')]=function(_0x3f9e80,_0x46ed3b){return _0x3f9e80['define'](_0xd1cf('0x9'),attributes,{'tableName':_0xd1cf('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd1cf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 88bb633..0aa7e46 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 _0x40e2=['stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','update','raw','where','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x41665b,_0x48251d){var _0x3ee30d=function(_0x478160){while(--_0x478160){_0x41665b['push'](_0x41665b['shift']());}};_0x3ee30d(++_0x48251d);}(_0x40e2,0x165));var _0x240e=function(_0x5b2b12,_0x1946d1){_0x5b2b12=_0x5b2b12-0x0;var _0x5a7429=_0x40e2[_0x5b2b12];return _0x5a7429;};'use strict';var _=require(_0x240e('0x0'));var util=require(_0x240e('0x1'));var moment=require(_0x240e('0x2'));var BPromise=require(_0x240e('0x3'));var rs=require(_0x240e('0x4'));var fs=require('fs');var Redis=require(_0x240e('0x5'));var db=require(_0x240e('0x6'))['db'];var utils=require(_0x240e('0x7'));var logger=require('../../config/logger')(_0x240e('0x8'));var config=require(_0x240e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x240e('0xa')][_0x240e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d7bb3,_0xe2f71a,_0x9f2d59){return new BPromise(function(_0x57f0e3,_0x580523){return client['request'](_0x4d7bb3,_0x9f2d59)['then'](function(_0x333598){logger[_0x240e('0xc')](_0x240e('0xd'),_0xe2f71a,_0x240e('0xe'));logger[_0x240e('0xf')](_0x240e('0x10'),_0xe2f71a,'request\x20sent',JSON[_0x240e('0x11')](_0x333598));if(_0x333598['error']){if(_0x333598[_0x240e('0x12')][_0x240e('0x13')]===0x1f4){logger['error'](_0x240e('0xd'),_0xe2f71a,_0x333598[_0x240e('0x12')][_0x240e('0x14')]);return _0x580523(_0x333598[_0x240e('0x12')][_0x240e('0x14')]);}logger[_0x240e('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xe2f71a,_0x333598[_0x240e('0x12')][_0x240e('0x14')]);return _0x57f0e3(_0x333598['error'][_0x240e('0x14')]);}else{logger['info'](_0x240e('0xd'),_0xe2f71a,'request\x20sent');_0x57f0e3(_0x333598[_0x240e('0x15')][_0x240e('0x14')]);}})[_0x240e('0x16')](function(_0xcacddc){logger['error'](_0x240e('0xd'),_0xe2f71a,_0xcacddc);_0x580523(_0xcacddc);});});}exports[_0x240e('0x17')]=function(_0x563bbb){var _0x23cf3c=this;return new Promise(function(_0xb2fb0c,_0x2788b0){return db[_0x240e('0x18')][_0x240e('0x19')](_0x563bbb[_0x240e('0x1a')],{'raw':_0x563bbb['options']?_0x563bbb[_0x240e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x240e('0x1c')](function(_0x202223){logger[_0x240e('0xc')]('CreateVoiceDialReport',_0x563bbb);logger[_0x240e('0xf')]('CreateVoiceDialReport',_0x563bbb,JSON[_0x240e('0x11')](_0x202223));_0xb2fb0c(_0x202223);})[_0x240e('0x16')](function(_0x2e0da8){logger[_0x240e('0x12')](_0x240e('0x17'),_0x2e0da8[_0x240e('0x14')],_0x563bbb);_0x2788b0(_0x23cf3c[_0x240e('0x12')](0x1f4,_0x2e0da8[_0x240e('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x143c90){var _0x1502a0=this;return new Promise(function(_0x34b0e4,_0x30c745){return db['VoiceDialReport'][_0x240e('0x1d')](_0x143c90['body'],{'raw':_0x143c90[_0x240e('0x1b')]?_0x143c90[_0x240e('0x1b')][_0x240e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143c90[_0x240e('0x1b')]?_0x143c90[_0x240e('0x1b')][_0x240e('0x1f')]||null:null,'attributes':_0x143c90[_0x240e('0x1b')]?_0x143c90[_0x240e('0x1b')][_0x240e('0x20')]||null:null,'limit':_0x143c90['options']?_0x143c90[_0x240e('0x1b')]['limit']||null:null})['then'](function(_0x4e1fa3){logger[_0x240e('0xc')](_0x240e('0x21'),_0x143c90);logger[_0x240e('0xf')](_0x240e('0x21'),_0x143c90,JSON[_0x240e('0x11')](_0x4e1fa3));_0x34b0e4(_0x4e1fa3);})[_0x240e('0x16')](function(_0xd2eb1b){logger[_0x240e('0x12')]('UpdateVoiceDialReport',_0xd2eb1b[_0x240e('0x14')],_0x143c90);_0x30c745(_0x1502a0['error'](0x1f4,_0xd2eb1b['message']));});});}; \ No newline at end of file +var _0xc704=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','where','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x482847,_0x1b9359){var _0x66b214=function(_0x1bdedd){while(--_0x1bdedd){_0x482847['push'](_0x482847['shift']());}};_0x66b214(++_0x1b9359);}(_0xc704,0xf0));var _0x4c70=function(_0x565763,_0x50f4d9){_0x565763=_0x565763-0x0;var _0x40d209=_0xc704[_0x565763];return _0x40d209;};'use strict';var _=require(_0x4c70('0x0'));var util=require(_0x4c70('0x1'));var moment=require(_0x4c70('0x2'));var BPromise=require(_0x4c70('0x3'));var rs=require(_0x4c70('0x4'));var fs=require('fs');var Redis=require(_0x4c70('0x5'));var db=require(_0x4c70('0x6'))['db'];var utils=require(_0x4c70('0x7'));var logger=require('../../config/logger')(_0x4c70('0x8'));var config=require(_0x4c70('0x9'));var jayson=require(_0x4c70('0xa'));var client=jayson[_0x4c70('0xb')][_0x4c70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56b713,_0x948f2e,_0x183dcd){return new BPromise(function(_0x4985aa,_0x989023){return client[_0x4c70('0xd')](_0x56b713,_0x183dcd)[_0x4c70('0xe')](function(_0x5752d1){logger[_0x4c70('0xf')](_0x4c70('0x10'),_0x948f2e,'request\x20sent');logger['debug'](_0x4c70('0x11'),_0x948f2e,_0x4c70('0x12'),JSON[_0x4c70('0x13')](_0x5752d1));if(_0x5752d1[_0x4c70('0x14')]){if(_0x5752d1['error']['code']===0x1f4){logger[_0x4c70('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x948f2e,_0x5752d1[_0x4c70('0x14')][_0x4c70('0x15')]);return _0x989023(_0x5752d1[_0x4c70('0x14')][_0x4c70('0x15')]);}logger[_0x4c70('0x14')](_0x4c70('0x10'),_0x948f2e,_0x5752d1[_0x4c70('0x14')]['message']);return _0x4985aa(_0x5752d1[_0x4c70('0x14')][_0x4c70('0x15')]);}else{logger['info'](_0x4c70('0x10'),_0x948f2e,_0x4c70('0x12'));_0x4985aa(_0x5752d1[_0x4c70('0x16')]['message']);}})[_0x4c70('0x17')](function(_0x44db3d){logger[_0x4c70('0x14')](_0x4c70('0x10'),_0x948f2e,_0x44db3d);_0x989023(_0x44db3d);});});}exports['CreateVoiceDialReport']=function(_0x18b1b6){var _0x167998=this;return new Promise(function(_0x141cef,_0x227bda){return db[_0x4c70('0x18')][_0x4c70('0x19')](_0x18b1b6[_0x4c70('0x1a')],{'raw':_0x18b1b6['options']?_0x18b1b6[_0x4c70('0x1b')][_0x4c70('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2fb2aa){logger[_0x4c70('0xf')](_0x4c70('0x1d'),_0x18b1b6);logger[_0x4c70('0x1e')](_0x4c70('0x1d'),_0x18b1b6,JSON[_0x4c70('0x13')](_0x2fb2aa));_0x141cef(_0x2fb2aa);})[_0x4c70('0x17')](function(_0x99456f){logger[_0x4c70('0x14')](_0x4c70('0x1d'),_0x99456f[_0x4c70('0x15')],_0x18b1b6);_0x227bda(_0x167998[_0x4c70('0x14')](0x1f4,_0x99456f[_0x4c70('0x15')]));});});};exports[_0x4c70('0x1f')]=function(_0x5201d6){var _0x5b2c9b=this;return new Promise(function(_0x4569c1,_0x261fbe){return db[_0x4c70('0x18')][_0x4c70('0x20')](_0x5201d6[_0x4c70('0x1a')],{'raw':_0x5201d6[_0x4c70('0x1b')]?_0x5201d6[_0x4c70('0x1b')][_0x4c70('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5201d6[_0x4c70('0x1b')]?_0x5201d6[_0x4c70('0x1b')][_0x4c70('0x21')]||null:null,'attributes':_0x5201d6[_0x4c70('0x1b')]?_0x5201d6['options']['attributes']||null:null,'limit':_0x5201d6[_0x4c70('0x1b')]?_0x5201d6[_0x4c70('0x1b')][_0x4c70('0x22')]||null:null})[_0x4c70('0xe')](function(_0x5ebeac){logger[_0x4c70('0xf')](_0x4c70('0x1f'),_0x5201d6);logger['debug'](_0x4c70('0x1f'),_0x5201d6,JSON[_0x4c70('0x13')](_0x5ebeac));_0x4569c1(_0x5ebeac);})[_0x4c70('0x17')](function(_0x844294){logger['error'](_0x4c70('0x1f'),_0x844294[_0x4c70('0x15')],_0x5201d6);_0x261fbe(_0x5b2c9b[_0x4c70('0x14')](0x1f4,_0x844294[_0x4c70('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d92c204..bb01dfc 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 _0x0bb7=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x40dcd1,_0x5cd1da){var _0x5c056b=function(_0x87a3a7){while(--_0x87a3a7){_0x40dcd1['push'](_0x40dcd1['shift']());}};_0x5c056b(++_0x5cd1da);}(_0x0bb7,0x1e2));var _0x70bb=function(_0x39405c,_0x49a7c6){_0x39405c=_0x39405c-0x0;var _0x3c8c34=_0x0bb7[_0x39405c];return _0x3c8c34;};'use strict';var multer=require(_0x70bb('0x0'));var util=require(_0x70bb('0x1'));var path=require(_0x70bb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x70bb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x70bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x70bb('0x5'));var controller=require(_0x70bb('0x6'));router['get']('/',auth[_0x70bb('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x70bb('0x8')]);router[_0x70bb('0x9')]('/',auth[_0x70bb('0x7')](),controller[_0x70bb('0xa')]);router[_0x70bb('0x9')]('/:id/applications',auth[_0x70bb('0x7')](),controller['addApplications']);router[_0x70bb('0xb')](_0x70bb('0xc'),auth[_0x70bb('0x7')](),controller[_0x70bb('0xd')]);router['delete'](_0x70bb('0xc'),auth[_0x70bb('0x7')](),controller[_0x70bb('0xe')]);module[_0x70bb('0xf')]=router; \ No newline at end of file +var _0x24a9=['/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get'];(function(_0x2d5f36,_0xb24d71){var _0x910218=function(_0x1c71ba){while(--_0x1c71ba){_0x2d5f36['push'](_0x2d5f36['shift']());}};_0x910218(++_0xb24d71);}(_0x24a9,0x88));var _0x924a=function(_0x9ff778,_0x412f23){_0x9ff778=_0x9ff778-0x0;var _0x19d2c3=_0x24a9[_0x9ff778];return _0x19d2c3;};'use strict';var multer=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var path=require('path');var timeout=require(_0x924a('0x2'));var express=require(_0x924a('0x3'));var router=express[_0x924a('0x4')]();var fs_extra=require(_0x924a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x924a('0x6'));var controller=require(_0x924a('0x7'));router['get']('/',auth[_0x924a('0x8')](),controller[_0x924a('0x9')]);router[_0x924a('0xa')](_0x924a('0xb'),auth[_0x924a('0x8')](),controller[_0x924a('0xc')]);router[_0x924a('0xd')]('/',auth[_0x924a('0x8')](),controller['create']);router[_0x924a('0xd')](_0x924a('0xe'),auth[_0x924a('0x8')](),controller[_0x924a('0xf')]);router[_0x924a('0x10')](_0x924a('0xb'),auth[_0x924a('0x8')](),controller[_0x924a('0x11')]);router[_0x924a('0x12')](_0x924a('0xb'),auth[_0x924a('0x8')](),controller[_0x924a('0x13')]);module[_0x924a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0ae63c6..61f6646 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 _0xff0d=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0x5bee55,_0x384f6a){var _0x281265=function(_0xff5e84){while(--_0xff5e84){_0x5bee55['push'](_0x5bee55['shift']());}};_0x281265(++_0x384f6a);}(_0xff0d,0x1e3));var _0xdff0=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xff0d[_0x1e172a];return _0x96338b;};'use strict';var Sequelize=require(_0xdff0('0x0'));module[_0xdff0('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xdff0('0x2')],'allowNull':![],'unique':_0xdff0('0x3')},'priority':{'type':Sequelize[_0xdff0('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xdff0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdff0('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xdff0('0x5')](_0xdff0('0x6'),_0xdff0('0x7'),_0xdff0('0x8'),_0xdff0('0x9'),_0xdff0('0xa'),_0xdff0('0xb'),_0xdff0('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xdff0('0x2')]},'interval':{'type':Sequelize[_0xdff0('0x2')],'allowNull':![],'defaultValue':_0xdff0('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xdff0('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xdff0('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xdff0('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xdff0('0xf')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xdff0('0x10')},'answer':{'type':Sequelize[_0xdff0('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xdff0('0x11')],'get':function(_0xe828a8){return this[_0xdff0('0x12')](_0xdff0('0x13'));}},'alias':{'type':Sequelize[_0xdff0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8eea=['compositeIndex','NoOp','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8eea,0xa3));var _0xa8ee=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x8eea[_0x5bf420];return _0x1c5255;};'use strict';var Sequelize=require(_0xa8ee('0x0'));module['exports']={'context':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':![],'unique':_0xa8ee('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa8ee('0x2')},'priority':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':![],'defaultValue':_0xa8ee('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xa8ee('0x4'),_0xa8ee('0x5'),_0xa8ee('0x6'),_0xa8ee('0x7'),_0xa8ee('0x8'),_0xa8ee('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xa8ee('0x1')]},'interval':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xa8ee('0xa')]},'isApp':{'type':Sequelize[_0xa8ee('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa8ee('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xa8ee('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa8ee('0xa')]},'recordingFormat':{'type':Sequelize[_0xa8ee('0x1')],'defaultValue':_0xa8ee('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x264f55){return this[_0xa8ee('0xd')](_0xa8ee('0xe'));}},'alias':{'type':Sequelize[_0xa8ee('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index c695b3e..3c0041e 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 _0x75ec=['fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','value','includes','type','find','name','UserProfileResource','destroy','error','send','index','map','VoiceExtension','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x75ec,0xe3));var _0xc75e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x75ec[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xc75e('0x0'));var Redis=require(_0xc75e('0x1'));var qs=require(_0xc75e('0x2'));var logger=require(_0xc75e('0x3'))(_0xc75e('0x4'));var config=require(_0xc75e('0x5'));var db=require(_0xc75e('0x6'))['db'];config[_0xc75e('0x7')]=_[_0xc75e('0x8')](config[_0xc75e('0x7')],{'host':_0xc75e('0x9'),'port':0x18eb});var socket=require(_0xc75e('0xa'))(new Redis(config[_0xc75e('0x7')]));require('./voiceExtension.socket')[_0xc75e('0xb')](socket);function respondWithStatusCode(_0x6b4c09,_0x2e1331){_0x2e1331=_0x2e1331||0xcc;return function(_0x504a62){if(_0x504a62){return _0x6b4c09[_0xc75e('0xc')](_0x2e1331);}return _0x6b4c09[_0xc75e('0xd')](_0x2e1331)[_0xc75e('0xe')]();};}function respondWithResult(_0x5f39f2,_0x513d91){_0x513d91=_0x513d91||0xc8;return function(_0x1956fc){if(_0x1956fc){return _0x5f39f2[_0xc75e('0xd')](_0x513d91)[_0xc75e('0xf')](_0x1956fc);}};}function respondWithFilteredResult(_0x18898a,_0x29dbaf){return function(_0x2a8039){if(_0x2a8039){var _0x151e45=typeof _0x29dbaf[_0xc75e('0x10')]===_0xc75e('0x11')&&typeof _0x29dbaf[_0xc75e('0x12')]===_0xc75e('0x11');var _0x307ae1=_0x2a8039[_0xc75e('0x13')];var _0x3620e6=_0x151e45?0x0:_0x29dbaf[_0xc75e('0x10')];var _0x49fb68=_0x151e45?_0x2a8039[_0xc75e('0x13')]:_0x29dbaf[_0xc75e('0x10')]+_0x29dbaf[_0xc75e('0x12')];var _0x20e80e;if(_0x49fb68>=_0x307ae1){_0x49fb68=_0x307ae1;_0x20e80e=0xc8;}else{_0x20e80e=0xce;}_0x18898a[_0xc75e('0xd')](_0x20e80e);return _0x18898a[_0xc75e('0x14')](_0xc75e('0x15'),_0x3620e6+'-'+_0x49fb68+'/'+_0x307ae1)['json'](_0x2a8039);}return null;};}function removeEntity(_0x4f3054){return function(_0x542312){if(_0x542312){return _0x542312['destroy']()[_0xc75e('0x16')](function(){var _0x3b5f57=_0x542312[_0xc75e('0x17')]({'plain':!![]});var _0x6ef77c=[{'name':'InboundRoutes','value':_0xc75e('0x18'),'ignore':![]},{'name':_0xc75e('0x19'),'value':_0xc75e('0x1a'),'ignore':![]},{'name':_0xc75e('0x1b'),'value':'internal','ignore':![]}];var _0x20c0cf=_(_0x6ef77c)[_0xc75e('0x1c')]('ignore')['map'](_0xc75e('0x1d'))[_0xc75e('0x1d')]();if(_[_0xc75e('0x1e')](_0x20c0cf,_0x3b5f57[_0xc75e('0x1f')])){return;}var _0x5c6ecc=_[_0xc75e('0x20')](_0x6ef77c,['value',_0x3b5f57[_0xc75e('0x1f')]])[_0xc75e('0x21')];return db[_0xc75e('0x22')][_0xc75e('0x23')]({'where':{'type':_0x5c6ecc,'resourceId':_0x3b5f57['id']}})['then'](function(){return _0x542312;});})[_0xc75e('0x16')](function(){_0x4f3054['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5617){return function(_0x432ab0){if(!_0x432ab0){_0x2d5617[_0xc75e('0xc')](0x194);}return _0x432ab0;};}function handleError(_0x469887,_0x5efd51){_0x5efd51=_0x5efd51||0x1f4;return function(_0x2bb68c){logger[_0xc75e('0x24')](_0x2bb68c['stack']);if(_0x2bb68c[_0xc75e('0x21')]){delete _0x2bb68c[_0xc75e('0x21')];}_0x469887[_0xc75e('0xd')](_0x5efd51)[_0xc75e('0x25')](_0x2bb68c);};}exports[_0xc75e('0x26')]=function(_0x4efeb3,_0x2ec6db){var _0x5f24f0={},_0x2a259e={},_0x47e5cc={'count':0x0,'rows':[]};var _0xf1311b=_[_0xc75e('0x27')](db[_0xc75e('0x28')][_0xc75e('0x29')],function(_0x4f9ff2){return{'name':_0x4f9ff2[_0xc75e('0x2a')],'type':_0x4f9ff2[_0xc75e('0x1f')]['key']};});_0x2a259e['model']=_[_0xc75e('0x27')](_0xf1311b,'name');_0x2a259e[_0xc75e('0x2b')]=_[_0xc75e('0x2c')](_0x4efeb3[_0xc75e('0x2b')]);_0x2a259e[_0xc75e('0x2d')]=_[_0xc75e('0x2e')](_0x2a259e['model'],_0x2a259e['query']);_0x5f24f0[_0xc75e('0x2f')]=_[_0xc75e('0x2e')](_0x2a259e[_0xc75e('0x30')],qs[_0xc75e('0x31')](_0x4efeb3['query'][_0xc75e('0x31')]));_0x5f24f0[_0xc75e('0x2f')]=_0x5f24f0['attributes'][_0xc75e('0x32')]?_0x5f24f0['attributes']:_0x2a259e[_0xc75e('0x30')];if(!_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x33')](_0xc75e('0x34'))){_0x5f24f0[_0xc75e('0x12')]=qs[_0xc75e('0x12')](_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x12')]);_0x5f24f0[_0xc75e('0x10')]=qs[_0xc75e('0x10')](_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x10')]);}_0x5f24f0['order']=qs['sort'](_0x4efeb3[_0xc75e('0x2b')]['sort']);_0x5f24f0[_0xc75e('0x35')]=qs[_0xc75e('0x2d')](_[_0xc75e('0x36')](_0x4efeb3['query'],_0x2a259e[_0xc75e('0x2d')]),_0xf1311b);if(_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x1c')]){_0x5f24f0['where']=_[_0xc75e('0x37')](_0x5f24f0[_0xc75e('0x35')],{'$or':_[_0xc75e('0x27')](_0xf1311b,function(_0x27aa1c){if(_0x27aa1c[_0xc75e('0x1f')]!==_0xc75e('0x38')){var _0x110036={};_0x110036[_0x27aa1c[_0xc75e('0x21')]]={'$like':'%'+_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x1c')]+'%'};return _0x110036;}})});}_0x5f24f0=_[_0xc75e('0x37')]({},_0x5f24f0,_0x4efeb3[_0xc75e('0x39')]);var _0x4a2074={'where':_0x5f24f0[_0xc75e('0x35')]};return db[_0xc75e('0x28')][_0xc75e('0x13')](_0x4a2074)[_0xc75e('0x16')](function(_0x5e4f86){_0x47e5cc['count']=_0x5e4f86;if(_0x4efeb3[_0xc75e('0x2b')][_0xc75e('0x3a')]){_0x5f24f0['include']=[{'all':!![]}];}return db[_0xc75e('0x28')][_0xc75e('0x3b')](_0x5f24f0);})[_0xc75e('0x16')](function(_0x296d3c){_0x47e5cc[_0xc75e('0x3c')]=_0x296d3c;return _0x47e5cc;})['then'](respondWithFilteredResult(_0x2ec6db,_0x5f24f0))[_0xc75e('0x3d')](handleError(_0x2ec6db,null));};exports['show']=function(_0x11c00a,_0x25d062){var _0x46e077={'raw':![],'where':{'id':_0x11c00a[_0xc75e('0x3e')]['id']}},_0x438c8c={};_0x438c8c[_0xc75e('0x30')]=_['keys'](db[_0xc75e('0x28')][_0xc75e('0x29')]);_0x438c8c[_0xc75e('0x2b')]=_[_0xc75e('0x2c')](_0x11c00a[_0xc75e('0x2b')]);_0x438c8c[_0xc75e('0x2d')]=_[_0xc75e('0x2e')](_0x438c8c[_0xc75e('0x30')],_0x438c8c[_0xc75e('0x2b')]);_0x46e077['attributes']=_['intersection'](_0x438c8c['model'],qs['fields'](_0x11c00a['query'][_0xc75e('0x31')]));_0x46e077[_0xc75e('0x2f')]=_0x46e077[_0xc75e('0x2f')][_0xc75e('0x32')]?_0x46e077[_0xc75e('0x2f')]:_0x438c8c[_0xc75e('0x30')];if(_0x11c00a[_0xc75e('0x2b')][_0xc75e('0x3a')]){_0x46e077[_0xc75e('0x3f')]=[{'all':!![]}];}_0x46e077=_[_0xc75e('0x37')]({},_0x46e077,_0x11c00a['options']);return db[_0xc75e('0x28')][_0xc75e('0x20')](_0x46e077)['then'](handleEntityNotFound(_0x25d062,null))[_0xc75e('0x16')](respondWithResult(_0x25d062,null))[_0xc75e('0x3d')](handleError(_0x25d062,null));};exports[_0xc75e('0x23')]=function(_0x355df9,_0x5bc328){return db['VoiceExtension'][_0xc75e('0x20')]({'where':{'id':_0x355df9[_0xc75e('0x3e')]['id']}})[_0xc75e('0x16')](handleEntityNotFound(_0x5bc328,null))[_0xc75e('0x16')](removeEntity(_0x5bc328,null))['catch'](handleError(_0x5bc328,null));};exports[_0xc75e('0x40')]=function(_0x31b753,_0x28ac89){if(_0x31b753['body'][_0xc75e('0x1f')]==='outbound'&&!_['startsWith'](_0x31b753[_0xc75e('0x41')]['exten'],'_')){_0x31b753[_0xc75e('0x41')][_0xc75e('0x42')]='_'['concat'](_0x31b753['body'][_0xc75e('0x42')]);}return db[_0xc75e('0x28')]['create'](_0x31b753[_0xc75e('0x41')],{'raw':![]})['then'](function(_0x1a2284){var _0x33f4a1=_0x31b753[_0xc75e('0x43')]['get']({'plain':!![]});if(!_0x33f4a1)throw new Error(_0xc75e('0x44'));if(_0x33f4a1[_0xc75e('0x45')]==='user'){var _0x1644c0=_0x1a2284[_0xc75e('0x17')]({'plain':!![]});var _0x5724df=[{'name':'InboundRoutes','value':_0xc75e('0x18')},{'name':_0xc75e('0x19'),'value':_0xc75e('0x1a')},{'name':_0xc75e('0x1b'),'value':'internal'}];var _0x268751=_[_0xc75e('0x20')](_0x5724df,['value',_0x1644c0['type']])[_0xc75e('0x21')];return db['UserProfileSection'][_0xc75e('0x20')]({'where':{'name':_0x268751,'userProfileId':_0x33f4a1[_0xc75e('0x46')]},'raw':!![]})['then'](function(_0x3d0157){if(_0x3d0157&&_0x3d0157['autoAssociation']===0x0){return db['UserProfileResource'][_0xc75e('0x40')]({'name':_0x1644c0[_0xc75e('0x21')],'resourceId':_0x1644c0['id'],'type':_0x3d0157[_0xc75e('0x21')],'sectionId':_0x3d0157['id']},{})['then'](function(){return _0x1a2284;});}else{return _0x1a2284;}})[_0xc75e('0x3d')](function(_0x5e8920){logger[_0xc75e('0x24')](_0xc75e('0x47'),_0x5e8920);throw _0x5e8920;});}return _0x1a2284;})[_0xc75e('0x16')](respondWithResult(_0x28ac89,0xc9))[_0xc75e('0x3d')](handleError(_0x28ac89,null));};exports[_0xc75e('0x48')]=function(_0x5598d8,_0x5d15c2){if(_0x5598d8[_0xc75e('0x41')]['id']){delete _0x5598d8['body']['id'];}return db[_0xc75e('0x28')][_0xc75e('0x20')]({'where':{'id':_0x5598d8[_0xc75e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d15c2,null))['then'](function(_0x419404){if(_0x419404){return db[_0xc75e('0x28')][_0xc75e('0x48')](_[_0xc75e('0x36')](_0x5598d8[_0xc75e('0x41')],[_0xc75e('0x42'),_0xc75e('0x49'),_0xc75e('0x4a'),_0xc75e('0x4b'),_0xc75e('0x4c'),_0xc75e('0x4d'),_0xc75e('0x4e')]),{'where':{'context':_0x419404[_0xc75e('0x49')],'exten':_0x419404[_0xc75e('0x42')]},'individualHooks':!![]})[_0xc75e('0x16')](function(_0x543866){return _0x543866;});}return null;})['then'](respondWithStatusCode(_0x5d15c2,null))[_0xc75e('0x3d')](handleError(_0x5d15c2,null));};exports[_0xc75e('0x4f')]=function(_0x588dcb,_0x29e850){var _0x27fd3b=_0x588dcb[_0xc75e('0x3e')]['id'];var _0x3f9b6c=_0x588dcb['body'];var _0x36d12b=0xc8;var _0xfa7742=null;return db[_0xc75e('0x50')][_0xc75e('0x51')]({'isolationLevel':db[_0xc75e('0x50')][_0xc75e('0x52')][_0xc75e('0x53')][_0xc75e('0x54')]},function(_0x123a06){return db[_0xc75e('0x28')][_0xc75e('0x55')]({'where':{'id':_0x27fd3b},'transaction':_0x123a06})[_0xc75e('0x16')](function(_0x32edd0){if(_0x32edd0){return db[_0xc75e('0x28')][_0xc75e('0x23')]({'where':{'VoiceExtensionId':_0x27fd3b},'transaction':_0x123a06})['then'](function(){var _0x239b4c=_['map'](_0x3f9b6c,function(_0x2df135){_0x2df135['VoiceExtensionId']=_0x27fd3b;_0x2df135[_0xc75e('0x56')]=!![];return _0x2df135;});return _0x32edd0[_0xc75e('0x57')](_0x239b4c);})['then'](function(_0x125531){return db[_0xc75e('0x28')][_0xc75e('0x58')](_0x125531,{'transaction':_0x123a06});});}else{_0x36d12b=0x194;_0xfa7742=[];}});})['then'](function(){if(_0x36d12b!==0x194){return db[_0xc75e('0x28')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x27fd3b},'order':_0xc75e('0x59')})[_0xc75e('0x16')](function(_0x40d968){_0xfa7742=_0x40d968;});}})[_0xc75e('0x3d')](function(_0x377575){_0x36d12b=0x1f4;logger[_0xc75e('0x24')](_0x377575[_0xc75e('0x5a')]);if(_0x377575[_0xc75e('0x21')]){delete _0x377575[_0xc75e('0x21')];}_0xfa7742=_0x377575;})[_0xc75e('0x5b')](function(){if(_0xfa7742===null){_0x29e850[_0xc75e('0xc')](_0x36d12b);}else{if(_0x36d12b===0x1f4){_0x29e850[_0xc75e('0xd')](_0x36d12b)['send'](_0xfa7742);}else{_0x29e850['status'](_0x36d12b)['json'](_0xfa7742);}}});}; \ No newline at end of file +var _0x480a=['sort','where','pick','merge','options','include','findAll','catch','keys','includeAll','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','params','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','VoiceExtension','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit'];(function(_0x91509c,_0x47973e){var _0x3b142e=function(_0x31f9eb){while(--_0x31f9eb){_0x91509c['push'](_0x91509c['shift']());}};_0x3b142e(++_0x47973e);}(_0x480a,0x81));var _0xa480=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x480a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0xa480('0x0'));var qs=require(_0xa480('0x1'));var logger=require('../../config/logger')(_0xa480('0x2'));var config=require(_0xa480('0x3'));var db=require(_0xa480('0x4'))['db'];config[_0xa480('0x5')]=_['defaults'](config[_0xa480('0x5')],{'host':_0xa480('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa480('0x5')]));require(_0xa480('0x7'))[_0xa480('0x8')](socket);function respondWithStatusCode(_0x296f9a,_0x42aafc){_0x42aafc=_0x42aafc||0xcc;return function(_0x3ee66d){if(_0x3ee66d){return _0x296f9a[_0xa480('0x9')](_0x42aafc);}return _0x296f9a[_0xa480('0xa')](_0x42aafc)['end']();};}function respondWithResult(_0x2dab07,_0x3d9b8b){_0x3d9b8b=_0x3d9b8b||0xc8;return function(_0x1b0d1f){if(_0x1b0d1f){return _0x2dab07['status'](_0x3d9b8b)[_0xa480('0xb')](_0x1b0d1f);}};}function respondWithFilteredResult(_0x4fa3da,_0x2d2f35){return function(_0x4fd72a){if(_0x4fd72a){var _0x5d1305=typeof _0x2d2f35['offset']===_0xa480('0xc')&&typeof _0x2d2f35[_0xa480('0xd')]===_0xa480('0xc');var _0x28d8a0=_0x4fd72a[_0xa480('0xe')];var _0x6dccf0=_0x5d1305?0x0:_0x2d2f35[_0xa480('0xf')];var _0x3eb3f7=_0x5d1305?_0x4fd72a[_0xa480('0xe')]:_0x2d2f35[_0xa480('0xf')]+_0x2d2f35[_0xa480('0xd')];var _0x449d07;if(_0x3eb3f7>=_0x28d8a0){_0x3eb3f7=_0x28d8a0;_0x449d07=0xc8;}else{_0x449d07=0xce;}_0x4fa3da[_0xa480('0xa')](_0x449d07);return _0x4fa3da[_0xa480('0x10')]('Content-Range',_0x6dccf0+'-'+_0x3eb3f7+'/'+_0x28d8a0)[_0xa480('0xb')](_0x4fd72a);}return null;};}function removeEntity(_0x767fb5){return function(_0x4f7a53){if(_0x4f7a53){return _0x4f7a53[_0xa480('0x11')]()[_0xa480('0x12')](function(){var _0x304f91=_0x4f7a53[_0xa480('0x13')]({'plain':!![]});var _0x5b18a6=[{'name':_0xa480('0x14'),'value':_0xa480('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0xa480('0x16'),'ignore':![]},{'name':_0xa480('0x17'),'value':_0xa480('0x18'),'ignore':![]}];var _0x48f4ef=_(_0x5b18a6)[_0xa480('0x19')](_0xa480('0x1a'))[_0xa480('0x1b')](_0xa480('0x1c'))[_0xa480('0x1c')]();if(_['includes'](_0x48f4ef,_0x304f91[_0xa480('0x1d')])){return;}var _0x3a8a97=_[_0xa480('0x1e')](_0x5b18a6,[_0xa480('0x1c'),_0x304f91['type']])[_0xa480('0x1f')];return db[_0xa480('0x20')][_0xa480('0x11')]({'where':{'type':_0x3a8a97,'resourceId':_0x304f91['id']}})[_0xa480('0x12')](function(){return _0x4f7a53;});})['then'](function(){_0x767fb5[_0xa480('0xa')](0xcc)[_0xa480('0x21')]();});}};}function handleEntityNotFound(_0x1467e5){return function(_0x2f336d){if(!_0x2f336d){_0x1467e5[_0xa480('0x9')](0x194);}return _0x2f336d;};}function handleError(_0x4f8cf2,_0x2d65f8){_0x2d65f8=_0x2d65f8||0x1f4;return function(_0x4e417d){logger[_0xa480('0x22')](_0x4e417d['stack']);if(_0x4e417d[_0xa480('0x1f')]){delete _0x4e417d[_0xa480('0x1f')];}_0x4f8cf2[_0xa480('0xa')](_0x2d65f8)[_0xa480('0x23')](_0x4e417d);};}exports['index']=function(_0x123a14,_0x24667f){var _0x4d145d={},_0x2f1c80={},_0x3648ea={'count':0x0,'rows':[]};var _0x5d56ae=_[_0xa480('0x1b')](db[_0xa480('0x24')][_0xa480('0x25')],function(_0x2b2ba1){return{'name':_0x2b2ba1[_0xa480('0x26')],'type':_0x2b2ba1[_0xa480('0x1d')]['key']};});_0x2f1c80[_0xa480('0x27')]=_[_0xa480('0x1b')](_0x5d56ae,_0xa480('0x1f'));_0x2f1c80[_0xa480('0x28')]=_['keys'](_0x123a14[_0xa480('0x28')]);_0x2f1c80[_0xa480('0x29')]=_['intersection'](_0x2f1c80[_0xa480('0x27')],_0x2f1c80[_0xa480('0x28')]);_0x4d145d[_0xa480('0x2a')]=_[_0xa480('0x2b')](_0x2f1c80[_0xa480('0x27')],qs[_0xa480('0x2c')](_0x123a14[_0xa480('0x28')][_0xa480('0x2c')]));_0x4d145d[_0xa480('0x2a')]=_0x4d145d[_0xa480('0x2a')][_0xa480('0x2d')]?_0x4d145d['attributes']:_0x2f1c80['model'];if(!_0x123a14[_0xa480('0x28')]['hasOwnProperty'](_0xa480('0x2e'))){_0x4d145d[_0xa480('0xd')]=qs[_0xa480('0xd')](_0x123a14[_0xa480('0x28')][_0xa480('0xd')]);_0x4d145d[_0xa480('0xf')]=qs['offset'](_0x123a14['query']['offset']);}_0x4d145d['order']=qs['sort'](_0x123a14['query'][_0xa480('0x2f')]);_0x4d145d[_0xa480('0x30')]=qs[_0xa480('0x29')](_[_0xa480('0x31')](_0x123a14[_0xa480('0x28')],_0x2f1c80[_0xa480('0x29')]),_0x5d56ae);if(_0x123a14[_0xa480('0x28')][_0xa480('0x19')]){_0x4d145d[_0xa480('0x30')]=_['merge'](_0x4d145d['where'],{'$or':_[_0xa480('0x1b')](_0x5d56ae,function(_0x292685){if(_0x292685[_0xa480('0x1d')]!=='VIRTUAL'){var _0x3fdb5f={};_0x3fdb5f[_0x292685[_0xa480('0x1f')]]={'$like':'%'+_0x123a14[_0xa480('0x28')]['filter']+'%'};return _0x3fdb5f;}})});}_0x4d145d=_[_0xa480('0x32')]({},_0x4d145d,_0x123a14[_0xa480('0x33')]);var _0x1a0559={'where':_0x4d145d[_0xa480('0x30')]};return db[_0xa480('0x24')][_0xa480('0xe')](_0x1a0559)[_0xa480('0x12')](function(_0x567e7c){_0x3648ea[_0xa480('0xe')]=_0x567e7c;if(_0x123a14[_0xa480('0x28')]['includeAll']){_0x4d145d[_0xa480('0x34')]=[{'all':!![]}];}return db[_0xa480('0x24')][_0xa480('0x35')](_0x4d145d);})[_0xa480('0x12')](function(_0x49bd5a){_0x3648ea['rows']=_0x49bd5a;return _0x3648ea;})['then'](respondWithFilteredResult(_0x24667f,_0x4d145d))[_0xa480('0x36')](handleError(_0x24667f,null));};exports['show']=function(_0x5c97a8,_0x39c263){var _0x208e8c={'raw':![],'where':{'id':_0x5c97a8['params']['id']}},_0x106b63={};_0x106b63[_0xa480('0x27')]=_[_0xa480('0x37')](db[_0xa480('0x24')]['rawAttributes']);_0x106b63['query']=_[_0xa480('0x37')](_0x5c97a8[_0xa480('0x28')]);_0x106b63[_0xa480('0x29')]=_[_0xa480('0x2b')](_0x106b63['model'],_0x106b63[_0xa480('0x28')]);_0x208e8c[_0xa480('0x2a')]=_['intersection'](_0x106b63[_0xa480('0x27')],qs[_0xa480('0x2c')](_0x5c97a8[_0xa480('0x28')][_0xa480('0x2c')]));_0x208e8c[_0xa480('0x2a')]=_0x208e8c[_0xa480('0x2a')][_0xa480('0x2d')]?_0x208e8c[_0xa480('0x2a')]:_0x106b63[_0xa480('0x27')];if(_0x5c97a8['query'][_0xa480('0x38')]){_0x208e8c[_0xa480('0x34')]=[{'all':!![]}];}_0x208e8c=_[_0xa480('0x32')]({},_0x208e8c,_0x5c97a8['options']);return db['VoiceExtension'][_0xa480('0x1e')](_0x208e8c)[_0xa480('0x12')](handleEntityNotFound(_0x39c263,null))[_0xa480('0x12')](respondWithResult(_0x39c263,null))[_0xa480('0x36')](handleError(_0x39c263,null));};exports[_0xa480('0x11')]=function(_0xa81a61,_0xfa4983){return db['VoiceExtension'][_0xa480('0x1e')]({'where':{'id':_0xa81a61['params']['id']}})[_0xa480('0x12')](handleEntityNotFound(_0xfa4983,null))['then'](removeEntity(_0xfa4983,null))[_0xa480('0x36')](handleError(_0xfa4983,null));};exports[_0xa480('0x39')]=function(_0x576f0c,_0x6f35fe){if(_0x576f0c[_0xa480('0x3a')][_0xa480('0x1d')]===_0xa480('0x16')&&!_[_0xa480('0x3b')](_0x576f0c[_0xa480('0x3a')][_0xa480('0x3c')],'_')){_0x576f0c[_0xa480('0x3a')][_0xa480('0x3c')]='_'[_0xa480('0x3d')](_0x576f0c[_0xa480('0x3a')][_0xa480('0x3c')]);}return db[_0xa480('0x24')][_0xa480('0x39')](_0x576f0c[_0xa480('0x3a')],{'raw':![]})[_0xa480('0x12')](function(_0x565c8d){var _0x73b03c=_0x576f0c[_0xa480('0x3e')][_0xa480('0x13')]({'plain':!![]});if(!_0x73b03c)throw new Error(_0xa480('0x3f'));if(_0x73b03c[_0xa480('0x40')]===_0xa480('0x3e')){var _0x91430d=_0x565c8d[_0xa480('0x13')]({'plain':!![]});var _0x447f99=[{'name':_0xa480('0x14'),'value':_0xa480('0x15')},{'name':_0xa480('0x41'),'value':_0xa480('0x16')},{'name':'InternalRoutes','value':_0xa480('0x18')}];var _0x2d0912=_[_0xa480('0x1e')](_0x447f99,[_0xa480('0x1c'),_0x91430d['type']])[_0xa480('0x1f')];return db[_0xa480('0x42')][_0xa480('0x1e')]({'where':{'name':_0x2d0912,'userProfileId':_0x73b03c['userProfileId']},'raw':!![]})['then'](function(_0xe661de){if(_0xe661de&&_0xe661de['autoAssociation']===0x0){return db[_0xa480('0x20')][_0xa480('0x39')]({'name':_0x91430d[_0xa480('0x1f')],'resourceId':_0x91430d['id'],'type':_0xe661de[_0xa480('0x1f')],'sectionId':_0xe661de['id']},{})[_0xa480('0x12')](function(){return _0x565c8d;});}else{return _0x565c8d;}})[_0xa480('0x36')](function(_0x3be640){logger[_0xa480('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3be640);throw _0x3be640;});}return _0x565c8d;})[_0xa480('0x12')](respondWithResult(_0x6f35fe,0xc9))[_0xa480('0x36')](handleError(_0x6f35fe,null));};exports['update']=function(_0x499138,_0x3cc37a){if(_0x499138['body']['id']){delete _0x499138['body']['id'];}return db['VoiceExtension'][_0xa480('0x1e')]({'where':{'id':_0x499138['params']['id']}})[_0xa480('0x12')](handleEntityNotFound(_0x3cc37a,null))[_0xa480('0x12')](function(_0x2f9a3d){if(_0x2f9a3d){return db[_0xa480('0x24')][_0xa480('0x43')](_[_0xa480('0x31')](_0x499138['body'],[_0xa480('0x3c'),_0xa480('0x44'),_0xa480('0x45'),_0xa480('0x46'),_0xa480('0x47'),_0xa480('0x48'),'alias']),{'where':{'context':_0x2f9a3d[_0xa480('0x44')],'exten':_0x2f9a3d[_0xa480('0x3c')]},'individualHooks':!![]})[_0xa480('0x12')](function(_0x3555da){return _0x3555da;});}return null;})[_0xa480('0x12')](respondWithStatusCode(_0x3cc37a,null))['catch'](handleError(_0x3cc37a,null));};exports[_0xa480('0x49')]=function(_0x48ecab,_0x10dabb){var _0x3cf81c=_0x48ecab[_0xa480('0x4a')]['id'];var _0x1b4653=_0x48ecab[_0xa480('0x3a')];var _0x20d441=0xc8;var _0x7be788=null;return db[_0xa480('0x4b')][_0xa480('0x4c')]({'isolationLevel':db['sequelize'][_0xa480('0x4d')][_0xa480('0x4e')][_0xa480('0x4f')]},function(_0x158ce4){return db['VoiceExtension'][_0xa480('0x50')]({'where':{'id':_0x3cf81c},'transaction':_0x158ce4})[_0xa480('0x12')](function(_0xf50bdb){if(_0xf50bdb){return db[_0xa480('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x3cf81c},'transaction':_0x158ce4})[_0xa480('0x12')](function(){var _0x3e29cf=_[_0xa480('0x1b')](_0x1b4653,function(_0x45e92d){_0x45e92d[_0xa480('0x51')]=_0x3cf81c;_0x45e92d[_0xa480('0x52')]=!![];return _0x45e92d;});return _0xf50bdb['createRouting'](_0x3e29cf);})[_0xa480('0x12')](function(_0x165a81){return db[_0xa480('0x24')][_0xa480('0x53')](_0x165a81,{'transaction':_0x158ce4});});}else{_0x20d441=0x194;_0x7be788=[];}});})[_0xa480('0x12')](function(){if(_0x20d441!==0x194){return db[_0xa480('0x24')][_0xa480('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3cf81c},'order':_0xa480('0x55')})[_0xa480('0x12')](function(_0x298822){_0x7be788=_0x298822;});}})[_0xa480('0x36')](function(_0x179b3b){_0x20d441=0x1f4;logger['error'](_0x179b3b[_0xa480('0x56')]);if(_0x179b3b[_0xa480('0x1f')]){delete _0x179b3b['name'];}_0x7be788=_0x179b3b;})[_0xa480('0x57')](function(){if(_0x7be788===null){_0x10dabb[_0xa480('0x9')](_0x20d441);}else{if(_0x20d441===0x1f4){_0x10dabb[_0xa480('0xa')](_0x20d441)[_0xa480('0x23')](_0x7be788);}else{_0x10dabb[_0xa480('0xa')](_0x20d441)['json'](_0x7be788);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7637390..925349c 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 _0x219d=['VoiceExtension','save','update','emit','hasOwnProperty','hook'];(function(_0x467932,_0x144d66){var _0xac1803=function(_0x148d95){while(--_0x148d95){_0x467932['push'](_0x467932['shift']());}};_0xac1803(++_0x144d66);}(_0x219d,0xba));var _0xd219=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x219d[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xd219('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd219('0x1'),'afterUpdate':_0xd219('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5263d5){return function(_0x52701b,_0x17227d,_0x38233a){VoiceExtensionEvents[_0xd219('0x3')](_0x5263d5+':'+_0x52701b['id'],_0x52701b);VoiceExtensionEvents[_0xd219('0x3')](_0x5263d5,_0x52701b);_0x38233a(null);};}for(var e in events){if(events[_0xd219('0x4')](e)){var event=events[e];VoiceExtension[_0xd219('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x4847=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x3123cf,_0x6512fe){var _0x3e948c=function(_0x25a940){while(--_0x25a940){_0x3123cf['push'](_0x3123cf['shift']());}};_0x3e948c(++_0x6512fe);}(_0x4847,0x125));var _0x7484=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4847[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require(_0x7484('0x0'));var VoiceExtension=require(_0x7484('0x1'))['db'][_0x7484('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7484('0x3')](0x0);var events={'afterCreate':_0x7484('0x4'),'afterUpdate':_0x7484('0x5'),'afterDestroy':_0x7484('0x6')};function emitEvent(_0x2670a7){return function(_0x466662,_0x21442a,_0x29bb01){VoiceExtensionEvents[_0x7484('0x7')](_0x2670a7+':'+_0x466662['id'],_0x466662);VoiceExtensionEvents['emit'](_0x2670a7,_0x466662);_0x29bb01(null);};}for(var e in events){if(events[_0x7484('0x8')](e)){var event=events[e];VoiceExtension[_0x7484('0x9')](e,emitEvent(event));}}module[_0x7484('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 b1aec57..5d282c0 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 _0x1cbb=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','url','param','split','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','then','length','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','NoOp','alias','No\x20alias\x20set','inbound','push','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)='];(function(_0x1a2c72,_0x53c7f0){var _0x413211=function(_0x91ba8){while(--_0x91ba8){_0x1a2c72['push'](_0x1a2c72['shift']());}};_0x413211(++_0x53c7f0);}(_0x1cbb,0x1c4));var _0xb1cb=function(_0x12824a,_0x48fc2d){_0x12824a=_0x12824a-0x0;var _0x26b616=_0x1cbb[_0x12824a];return _0x26b616;};'use strict';var _=require('lodash');var attributes=require(_0xb1cb('0x0'));module[_0xb1cb('0x1')]=function(_0x4ac978){var _0x7d0111=_0x4ac978['models'];function _0x224133(_0x248b01){var _0x382b99=0x2;var _0x10b0ae=[{'type':_0x248b01[_0xb1cb('0x2')],'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x4')+_0x248b01['type'],'context':_0x248b01[_0xb1cb('0x5')],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']},{'type':_0x248b01[_0xb1cb('0x2')],'app':_0x248b01['alias']?_0xb1cb('0x3'):_0xb1cb('0x7'),'appdata':_0x248b01['alias']?'CDR(routeAlias)='+_0x248b01[_0xb1cb('0x8')]:_0xb1cb('0x9'),'context':_0x248b01[_0xb1cb('0x5')],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']}];if(_0x248b01[_0xb1cb('0x2')]===_0xb1cb('0xa')){_0x10b0ae[_0xb1cb('0xb')]({'type':_0xb1cb('0xa'),'app':'Set','appdata':'CDR(routeid)='+_0x248b01['id'],'context':_0x248b01['context'],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']});}_0x10b0ae[_0xb1cb('0xb')]({'type':_0x248b01['type'],'app':_0xb1cb('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x248b01[_0xb1cb('0x5')],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']},{'type':_0x248b01[_0xb1cb('0x2')],'app':_0xb1cb('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x248b01[_0xb1cb('0x5')],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']},{'type':_0x248b01['type'],'app':'Set','appdata':_0xb1cb('0xc'),'context':_0x248b01[_0xb1cb('0x5')],'exten':_0x248b01[_0xb1cb('0x6')],'priority':_0x382b99++,'VoiceExtensionId':_0x248b01['id']});return _0x10b0ae;}function _0x1114fa(_0x1cf54a){var _0x3a0d0d=0x2;var _0x341251=[{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0xe'),'context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':'outbound','app':_0x1cf54a[_0xb1cb('0x8')]?_0xb1cb('0x3'):_0xb1cb('0x7'),'appdata':_0x1cf54a[_0xb1cb('0x8')]?_0xb1cb('0xf')+_0x1cf54a[_0xb1cb('0x8')]:_0xb1cb('0x9'),'context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x10')+(_0x1cf54a[_0xb1cb('0x11')]?_0xb1cb('0x12')+_0x1cf54a['cutdigits']+'}':_0xb1cb('0x13')),'context':_0x1cf54a['context'],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x14')+_0x1cf54a['id'],'context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x15'),'appdata':_0xb1cb('0x16')+(_0x3a0d0d+0x2)+_0xb1cb('0x17')+(_0x3a0d0d+0x1)+')','context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':'Set','appdata':_0x1cf54a[_0xb1cb('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x1cf54a['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1cf54a['context'],'exten':_0x1cf54a['exten'],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':'Set','appdata':_0xb1cb('0x18'),'context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x19'),'context':_0x1cf54a['context'],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0xc'),'context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':'outboundrouteid='+_0x1cf54a['id'],'context':_0x1cf54a['context'],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']}];if(_0x1cf54a[_0xb1cb('0x1a')]('recordingFormat')&&_0x1cf54a[_0xb1cb('0x1b')]!==_0xb1cb('0x1c')){_0x341251['push']({'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1cf54a['context'],'exten':_0x1cf54a[_0xb1cb('0x6')],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']},{'type':_0xb1cb('0xd'),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x1d')+_0x1cf54a[_0xb1cb('0x1b')]||'wav','context':_0x1cf54a[_0xb1cb('0x5')],'exten':_0x1cf54a['exten'],'priority':_0x3a0d0d++,'VoiceExtensionId':_0x1cf54a['id']});}return _0x341251;}function _0x57cad8(_0x483443,_0x3c264f){var _0x56fc88=[{'name':_0xb1cb('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xb1cb('0x1f'),'param':0x2},{'name':_0xb1cb('0x20'),'param':0x3}];var _0xa2317={};var _0x413d34=_0x3c264f['split'](',');var _0x9fa08b=[];for(var _0x350425=0x0;_0x350425<_0x56fc88['length'];_0x350425++){switch(_0x56fc88[_0x350425]['name']){case _0xb1cb('0x1e'):_0xa2317[_0xb1cb('0x1e')]=_0x413d34[_0x56fc88[_0x350425][_0xb1cb('0x21')]][_0xb1cb('0x22')]('/')[0x1];_0xa2317[_0xb1cb('0x23')]=_0x413d34[_0x56fc88[_0x350425]['param']][_0xb1cb('0x22')]('/')[0x2];_0xa2317[_0xb1cb('0x24')]=_0xa2317[_0xb1cb('0x23')]?_0xa2317[_0xb1cb('0x23')][_0xb1cb('0x22')]('$')[0x0]:undefined;_0xa2317['phone']=_0x483443[_0xb1cb('0x11')]?(_0xa2317[_0xb1cb('0x24')]||'')+'${EXTEN:'+_0x483443[_0xb1cb('0x11')]+'}':(_0xa2317[_0xb1cb('0x24')]||'')+_0xb1cb('0x13');_0x9fa08b[_0x56fc88[_0x350425][_0xb1cb('0x21')]]=[_0xb1cb('0x25'),_0xa2317[_0xb1cb('0x1e')],_0xa2317[_0xb1cb('0x23')]][_0xb1cb('0x26')]('/');break;case _0xb1cb('0x1f'):_0xa2317[_0xb1cb('0x1f')]=_0x413d34[_0x56fc88[_0x350425]['param']];if(_0x483443[_0xb1cb('0x1b')]!==_0xb1cb('0x1c')){if(_0xa2317[_0xb1cb('0x1f')][_0xb1cb('0x27')](_0xb1cb('0x28'))<0x0){_0xa2317['options']+='U(xcally-mixmonitor-context)';}}else{_0xa2317[_0xb1cb('0x1f')]=_0xa2317[_0xb1cb('0x1f')][_0xb1cb('0x29')](_0xb1cb('0x28'),'');}_0x9fa08b[_0x56fc88[_0x350425]['param']]=_0xa2317[_0xb1cb('0x1f')];break;default:_0x9fa08b[_0x56fc88[_0x350425][_0xb1cb('0x21')]]=_0x413d34[_0x56fc88[_0x350425][_0xb1cb('0x21')]];}}return _0x9fa08b[_0xb1cb('0x26')](',');}function _0x1d9f64(_0x195067,_0x1e09f1,_0x31fc9a){return new Promise(function(_0x398942,_0x53a696){var _0x6edaa1=[];if(_['isEmpty'](_0x1e09f1))return _0x398942(_0x6edaa1);_0x7d0111[_0xb1cb('0x2a')][_0xb1cb('0x2b')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xb1cb('0x2c')](function(_0x1c8719){for(var _0x1aa831=0x0,_0x4ff7cf=0x0;_0x1aa831<_0x1e09f1[_0xb1cb('0x2d')];_0x1aa831++,_0x4ff7cf=0x0){var _0x39ba6e=_0x1e09f1[_0x1aa831];var _0xa88666=[];var _0x3bac7d=[];delete _0x39ba6e['id'];if(_0x39ba6e[_0xb1cb('0x2e')]!==_0xb1cb('0x2f')){_0x39ba6e[_0xb1cb('0x30')]=[_0x39ba6e[_0xb1cb('0x2e')]];}else{_0x39ba6e['intervals']=_0x39ba6e[_0xb1cb('0x31')]?_[_0xb1cb('0x32')](_[_0xb1cb('0x33')](_0x1c8719,{'IntervalId':_0x39ba6e[_0xb1cb('0x31')]}),_0xb1cb('0x2e')):[];}_0x39ba6e[_0xb1cb('0x5')]=_0x195067[_0xb1cb('0x5')];_0x39ba6e[_0xb1cb('0x6')]=_0x195067[_0xb1cb('0x6')];if(_0x39ba6e[_0xb1cb('0x2')])_0x39ba6e['type']=_0x39ba6e[_0xb1cb('0x2')][_0xb1cb('0x34')]();if(_0x195067[_0xb1cb('0x2')]===_0xb1cb('0xd')){if(_0x39ba6e[_0xb1cb('0x1a')](_0xb1cb('0x35'))&&_0x39ba6e[_0xb1cb('0x35')]&&_0x39ba6e['tag']!=='--'){_0xa88666[_0xb1cb('0xb')]({'type':_0x39ba6e[_0xb1cb('0x2')][_0xb1cb('0x34')](),'app':_0xb1cb('0x3'),'appdata':'CDR(tag)='+_0x39ba6e[_0xb1cb('0x35')],'context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e['intervals'][_0xb1cb('0x2d')]+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});}_0xa88666[_0xb1cb('0xb')]({'type':_0x39ba6e['type']['toLowerCase'](),'app':_0xb1cb('0x15'),'appdata':_0xb1cb('0x36')+(_0x39ba6e[_0xb1cb('0x37')]?'Set(CALLERID(all)='+_0x39ba6e[_0xb1cb('0x37')]+')':'NoOp(No\x20number\x20available)'),'context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e['intervals'][_0xb1cb('0x2d')]+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});}else{if(_0x39ba6e[_0xb1cb('0x1a')]('answer')){if([_0xb1cb('0x38'),_0xb1cb('0x39')][_0xb1cb('0x3a')](_0x39ba6e[_0xb1cb('0x3b')]['toLowerCase']())&&_0x39ba6e[_0xb1cb('0x3c')]!==_0xb1cb('0x3d')){if(_0x39ba6e[_0xb1cb('0x3e')]){_0xa88666['push']({'type':_0x39ba6e['type']['toLowerCase'](),'app':'ExecIf','appdata':_0xb1cb('0x3f'),'context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e['intervals'][_0xb1cb('0x2d')]+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});_0xa88666['push']({'type':_0x39ba6e['type']['toLowerCase'](),'app':_0xb1cb('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e[_0xb1cb('0x30')]['length']+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});}else{_0xa88666['push']({'type':_0x39ba6e[_0xb1cb('0x2')][_0xb1cb('0x34')](),'app':_0xb1cb('0x15'),'appdata':_0xb1cb('0x40'),'context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e['intervals'][_0xb1cb('0x2d')]+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});_0xa88666['push']({'type':_0x39ba6e[_0xb1cb('0x2')]['toLowerCase'](),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x41'),'context':_0x195067[_0xb1cb('0x5')],'exten':_0x195067['exten'],'priority':_0x39ba6e['intervals']['length']+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});}}}}for(var _0x5632f3=0x0;_0x5632f3<_0x39ba6e[_0xb1cb('0x30')][_0xb1cb('0x2d')];_0x5632f3++){var _0x37d639=_0x31fc9a+_0x39ba6e[_0xb1cb('0x30')][_0xb1cb('0x2d')];var _0x1c20cb=_0x5632f3===_0x39ba6e['intervals']['length']-0x1?_0x31fc9a+_0xa88666['length']+_0x3bac7d['length']+0x2:_0x31fc9a+_0x5632f3+0x1;_0xa88666['splice'](_0x5632f3,0x0,{'type':_0x195067['type'],'app':_0xb1cb('0x42'),'appdata':_0x39ba6e[_0xb1cb('0x30')][_0x5632f3]+'?'+_0x195067[_0xb1cb('0x5')]+_0xb1cb('0x43')+_0x37d639+':'+_0x195067[_0xb1cb('0x5')]+',${EXTEN},'+_0x1c20cb,'exten':_0x195067['exten'],'context':_0x195067[_0xb1cb('0x5')],'priority':_0x31fc9a+_0x5632f3,'VoiceExtensionId':_0x195067['id']});}if(_0x39ba6e[_0xb1cb('0x3c')]==='outboundDial'){_0x39ba6e[_0xb1cb('0x44')]=_0x57cad8(_0x195067,_0x39ba6e[_0xb1cb('0x44')]);}if(_0x39ba6e[_0xb1cb('0x3c')]==='agi'){_0xa88666[_0xb1cb('0xb')]({'type':_0x39ba6e[_0xb1cb('0x2')][_0xb1cb('0x34')](),'app':_0xb1cb('0x3'),'appdata':_0xb1cb('0x45'),'context':_0x195067['context'],'exten':_0x195067[_0xb1cb('0x6')],'priority':_0x39ba6e[_0xb1cb('0x30')]['length']+_0x31fc9a+_0x4ff7cf++,'VoiceExtensionId':_0x195067['id']});}_0x39ba6e[_0xb1cb('0x46')]=_0xa88666[_0xb1cb('0x2d')]?_[_0xb1cb('0x47')](_0xa88666)[_0xb1cb('0x46')]+0x1:_0x31fc9a;_0x6edaa1=_[_0xb1cb('0x48')](_0x6edaa1,_0xa88666,[_0x39ba6e],_0x3bac7d);_0x31fc9a=_[_0xb1cb('0x47')](_0x6edaa1)[_0xb1cb('0x46')]+0x1;}return _0x398942(_0x6edaa1);})[_0xb1cb('0x49')](function(_0x5584f9){_0x53a696(_0x5584f9);});});}return _0x4ac978['define'](_0xb1cb('0x4a'),attributes,{'tableName':_0xb1cb('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x160ade){var _0x1b53e2=this[_0xb1cb('0x4c')]({'plain':!![]});var _0xb16b21=_0x1b53e2[_0xb1cb('0x2')]===_0xb1cb('0xd')?_0x1114fa(_0x1b53e2):_0x224133(_0x1b53e2);return _0x1d9f64(_0x1b53e2,_0x160ade,_[_0xb1cb('0x47')](_0xb16b21)['priority']+0x1)['then'](function(_0x506d7b){var _0x19dfcf=_[_0xb1cb('0x48')](_0xb16b21,_0x506d7b);_0x19dfcf[_0xb1cb('0xb')]({'type':_0x1b53e2['type'],'app':_0xb1cb('0x4d'),'exten':_0x1b53e2[_0xb1cb('0x6')],'context':_0x1b53e2[_0xb1cb('0x5')],'priority':_[_0xb1cb('0x47')](_0x19dfcf)[_0xb1cb('0x46')]+0x1,'VoiceExtensionId':_0x1b53e2['id']});return _0x19dfcf;});}}});}; \ No newline at end of file +var _0x5c12=['${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','voice_extensions','get','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','cutdigits'];(function(_0x1b69a4,_0x3e9f5f){var _0x4ab6a6=function(_0x33697){while(--_0x33697){_0x1b69a4['push'](_0x1b69a4['shift']());}};_0x4ab6a6(++_0x3e9f5f);}(_0x5c12,0x188));var _0x25c1=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0x5c12[_0x2002b3];return _0x2756f0;};'use strict';var _=require('lodash');var attributes=require(_0x25c1('0x0'));module[_0x25c1('0x1')]=function(_0x549b0f){var _0x44bc2e=_0x549b0f[_0x25c1('0x2')];function _0x4042fe(_0x10f10c){var _0x2c5df0=0x2;var _0x21ec20=[{'type':_0x10f10c[_0x25c1('0x3')],'app':'Set','appdata':_0x25c1('0x4')+_0x10f10c[_0x25c1('0x3')],'context':_0x10f10c[_0x25c1('0x5')],'exten':_0x10f10c['exten'],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']},{'type':_0x10f10c['type'],'app':_0x10f10c[_0x25c1('0x6')]?_0x25c1('0x7'):_0x25c1('0x8'),'appdata':_0x10f10c[_0x25c1('0x6')]?_0x25c1('0x9')+_0x10f10c['alias']:_0x25c1('0xa'),'context':_0x10f10c[_0x25c1('0x5')],'exten':_0x10f10c[_0x25c1('0xb')],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']}];if(_0x10f10c[_0x25c1('0x3')]===_0x25c1('0xc')){_0x21ec20['push']({'type':_0x25c1('0xc'),'app':_0x25c1('0x7'),'appdata':'CDR(routeid)='+_0x10f10c['id'],'context':_0x10f10c[_0x25c1('0x5')],'exten':_0x10f10c[_0x25c1('0xb')],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']});}_0x21ec20[_0x25c1('0xd')]({'type':_0x10f10c[_0x25c1('0x3')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x10f10c['context'],'exten':_0x10f10c['exten'],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']},{'type':_0x10f10c[_0x25c1('0x3')],'app':_0x25c1('0x7'),'appdata':_0x25c1('0xe'),'context':_0x10f10c[_0x25c1('0x5')],'exten':_0x10f10c[_0x25c1('0xb')],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']},{'type':_0x10f10c['type'],'app':_0x25c1('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x10f10c['context'],'exten':_0x10f10c['exten'],'priority':_0x2c5df0++,'VoiceExtensionId':_0x10f10c['id']});return _0x21ec20;}function _0x284712(_0x1a08b5){var _0x4dc64b=0x2;var _0x4c55e7=[{'type':_0x25c1('0xf'),'app':'Set','appdata':_0x25c1('0x10'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5['exten'],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':'outbound','app':_0x1a08b5['alias']?_0x25c1('0x7'):_0x25c1('0x8'),'appdata':_0x1a08b5[_0x25c1('0x6')]?_0x25c1('0x9')+_0x1a08b5['alias']:_0x25c1('0xa'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':'Set','appdata':'CDR(destination)='+(_0x1a08b5[_0x25c1('0x11')]?_0x25c1('0x12')+_0x1a08b5[_0x25c1('0x11')]+'}':_0x25c1('0x13')),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x25c1('0x14')+_0x1a08b5['id'],'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4dc64b+0x2)+_0x25c1('0x16')+(_0x4dc64b+0x1)+')','context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x1a08b5[_0x25c1('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x1a08b5[_0x25c1('0x11')]+'}':_0x25c1('0x17'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5['exten'],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x25c1('0xe'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x25c1('0x18'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5['exten'],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':'Set','appdata':'outboundrouteid='+_0x1a08b5['id'],'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']}];if(_0x1a08b5['hasOwnProperty'](_0x25c1('0x19'))&&_0x1a08b5['recordingFormat']!==_0x25c1('0x1a')){_0x4c55e7['push']({'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x25c1('0x1b'),'context':_0x1a08b5[_0x25c1('0x5')],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']},{'type':_0x25c1('0xf'),'app':_0x25c1('0x7'),'appdata':_0x25c1('0x1c')+_0x1a08b5['recordingFormat']||_0x25c1('0x1d'),'context':_0x1a08b5['context'],'exten':_0x1a08b5[_0x25c1('0xb')],'priority':_0x4dc64b++,'VoiceExtensionId':_0x1a08b5['id']});}return _0x4c55e7;}function _0x56de5e(_0x439056,_0x1917e6){var _0x18f10c=[{'name':_0x25c1('0x1e'),'param':0x0},{'name':_0x25c1('0x1f'),'param':0x1},{'name':_0x25c1('0x20'),'param':0x2},{'name':_0x25c1('0x21'),'param':0x3}];var _0x2aa7b2={};var _0x3fced1=_0x1917e6[_0x25c1('0x22')](',');var _0x26ed98=[];for(var _0x3f02f2=0x0;_0x3f02f2<_0x18f10c[_0x25c1('0x23')];_0x3f02f2++){switch(_0x18f10c[_0x3f02f2][_0x25c1('0x24')]){case _0x25c1('0x1e'):_0x2aa7b2[_0x25c1('0x1e')]=_0x3fced1[_0x18f10c[_0x3f02f2][_0x25c1('0x25')]][_0x25c1('0x22')]('/')[0x1];_0x2aa7b2[_0x25c1('0x26')]=_0x3fced1[_0x18f10c[_0x3f02f2][_0x25c1('0x25')]]['split']('/')[0x2];_0x2aa7b2[_0x25c1('0x27')]=_0x2aa7b2[_0x25c1('0x26')]?_0x2aa7b2['phone'][_0x25c1('0x22')]('$')[0x0]:undefined;_0x2aa7b2['phone']=_0x439056[_0x25c1('0x11')]?(_0x2aa7b2['prefix']||'')+_0x25c1('0x12')+_0x439056[_0x25c1('0x11')]+'}':(_0x2aa7b2[_0x25c1('0x27')]||'')+_0x25c1('0x13');_0x26ed98[_0x18f10c[_0x3f02f2][_0x25c1('0x25')]]=['SIP',_0x2aa7b2[_0x25c1('0x1e')],_0x2aa7b2['phone']][_0x25c1('0x28')]('/');break;case _0x25c1('0x20'):_0x2aa7b2[_0x25c1('0x20')]=_0x3fced1[_0x18f10c[_0x3f02f2][_0x25c1('0x25')]];if(_0x439056['recordingFormat']!=='none'){if(_0x2aa7b2['options'][_0x25c1('0x29')](_0x25c1('0x2a'))<0x0){_0x2aa7b2['options']+=_0x25c1('0x2a');}}else{_0x2aa7b2['options']=_0x2aa7b2[_0x25c1('0x20')][_0x25c1('0x2b')](_0x25c1('0x2a'),'');}_0x26ed98[_0x18f10c[_0x3f02f2]['param']]=_0x2aa7b2['options'];break;default:_0x26ed98[_0x18f10c[_0x3f02f2]['param']]=_0x3fced1[_0x18f10c[_0x3f02f2][_0x25c1('0x25')]];}}return _0x26ed98[_0x25c1('0x28')](',');}function _0x4f9f73(_0x3ab903,_0x4c90f6,_0x46cbb9){return new Promise(function(_0x5d8562,_0x5e43dc){var _0x4879ec=[];if(_['isEmpty'](_0x4c90f6))return _0x5d8562(_0x4879ec);_0x44bc2e[_0x25c1('0x2c')][_0x25c1('0x2d')]({'attributes':['id','interval',_0x25c1('0x2e')],'raw':!![]})[_0x25c1('0x2f')](function(_0x1aaedd){for(var _0x2dbe23=0x0,_0x3c9de4=0x0;_0x2dbe23<_0x4c90f6[_0x25c1('0x23')];_0x2dbe23++,_0x3c9de4=0x0){var _0x252a80=_0x4c90f6[_0x2dbe23];var _0x552174=[];var _0x545934=[];delete _0x252a80['id'];if(_0x252a80[_0x25c1('0x30')]!==_0x25c1('0x31')){_0x252a80[_0x25c1('0x32')]=[_0x252a80['interval']];}else{_0x252a80[_0x25c1('0x32')]=_0x252a80[_0x25c1('0x2e')]?_[_0x25c1('0x33')](_[_0x25c1('0x34')](_0x1aaedd,{'IntervalId':_0x252a80['IntervalId']}),_0x25c1('0x30')):[];}_0x252a80[_0x25c1('0x5')]=_0x3ab903[_0x25c1('0x5')];_0x252a80[_0x25c1('0xb')]=_0x3ab903['exten'];if(_0x252a80['type'])_0x252a80[_0x25c1('0x3')]=_0x252a80[_0x25c1('0x3')][_0x25c1('0x35')]();if(_0x3ab903[_0x25c1('0x3')]==='outbound'){if(_0x252a80[_0x25c1('0x36')](_0x25c1('0x37'))&&_0x252a80['tag']&&_0x252a80[_0x25c1('0x37')]!=='--'){_0x552174[_0x25c1('0xd')]({'type':_0x252a80[_0x25c1('0x3')][_0x25c1('0x35')](),'app':'Set','appdata':'CDR(tag)='+_0x252a80[_0x25c1('0x37')],'context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80['intervals'][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});}_0x552174[_0x25c1('0xd')]({'type':_0x252a80['type'][_0x25c1('0x35')](),'app':_0x25c1('0x15'),'appdata':_0x25c1('0x38')+(_0x252a80[_0x25c1('0x39')]?_0x25c1('0x3a')+_0x252a80[_0x25c1('0x39')]+')':_0x25c1('0x3b')),'context':_0x3ab903['context'],'exten':_0x3ab903['exten'],'priority':_0x252a80['intervals'][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});}else{if(_0x252a80['hasOwnProperty'](_0x25c1('0x3c'))){if([_0x25c1('0x3d'),_0x25c1('0x3e')][_0x25c1('0x3f')](_0x252a80[_0x25c1('0x40')][_0x25c1('0x35')]())&&_0x252a80['appType']!==_0x25c1('0x41')){if(_0x252a80[_0x25c1('0x3c')]){_0x552174[_0x25c1('0xd')]({'type':_0x252a80[_0x25c1('0x3')][_0x25c1('0x35')](),'app':_0x25c1('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});_0x552174[_0x25c1('0xd')]({'type':_0x252a80['type'][_0x25c1('0x35')](),'app':_0x25c1('0x7'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});}else{_0x552174[_0x25c1('0xd')]({'type':_0x252a80[_0x25c1('0x3')]['toLowerCase'](),'app':_0x25c1('0x15'),'appdata':_0x25c1('0x42'),'context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});_0x552174[_0x25c1('0xd')]({'type':_0x252a80[_0x25c1('0x3')][_0x25c1('0x35')](),'app':_0x25c1('0x7'),'appdata':_0x25c1('0x43'),'context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80[_0x25c1('0x32')]['length']+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});}}}}for(var _0x3b0815=0x0;_0x3b0815<_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')];_0x3b0815++){var _0x7a1d7a=_0x46cbb9+_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')];var _0xb3cbfc=_0x3b0815===_0x252a80['intervals'][_0x25c1('0x23')]-0x1?_0x46cbb9+_0x552174['length']+_0x545934[_0x25c1('0x23')]+0x2:_0x46cbb9+_0x3b0815+0x1;_0x552174[_0x25c1('0x44')](_0x3b0815,0x0,{'type':_0x3ab903[_0x25c1('0x3')],'app':_0x25c1('0x45'),'appdata':_0x252a80[_0x25c1('0x32')][_0x3b0815]+'?'+_0x3ab903[_0x25c1('0x5')]+_0x25c1('0x46')+_0x7a1d7a+':'+_0x3ab903[_0x25c1('0x5')]+',${EXTEN},'+_0xb3cbfc,'exten':_0x3ab903[_0x25c1('0xb')],'context':_0x3ab903[_0x25c1('0x5')],'priority':_0x46cbb9+_0x3b0815,'VoiceExtensionId':_0x3ab903['id']});}if(_0x252a80[_0x25c1('0x47')]===_0x25c1('0x48')){_0x252a80[_0x25c1('0x49')]=_0x56de5e(_0x3ab903,_0x252a80[_0x25c1('0x49')]);}if(_0x252a80[_0x25c1('0x47')]==='agi'){_0x552174[_0x25c1('0xd')]({'type':_0x252a80['type']['toLowerCase'](),'app':'Set','appdata':_0x25c1('0x4a'),'context':_0x3ab903[_0x25c1('0x5')],'exten':_0x3ab903[_0x25c1('0xb')],'priority':_0x252a80[_0x25c1('0x32')][_0x25c1('0x23')]+_0x46cbb9+_0x3c9de4++,'VoiceExtensionId':_0x3ab903['id']});}_0x252a80['priority']=_0x552174[_0x25c1('0x23')]?_['last'](_0x552174)[_0x25c1('0x4b')]+0x1:_0x46cbb9;_0x4879ec=_[_0x25c1('0x4c')](_0x4879ec,_0x552174,[_0x252a80],_0x545934);_0x46cbb9=_[_0x25c1('0x4d')](_0x4879ec)[_0x25c1('0x4b')]+0x1;}return _0x5d8562(_0x4879ec);})[_0x25c1('0x4e')](function(_0x28a7b6){_0x5e43dc(_0x28a7b6);});});}return _0x549b0f[_0x25c1('0x4f')]('VoiceExtension',attributes,{'tableName':_0x25c1('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x46f71f){var _0x286a8f=this[_0x25c1('0x51')]({'plain':!![]});var _0x242149=_0x286a8f[_0x25c1('0x3')]==='outbound'?_0x284712(_0x286a8f):_0x4042fe(_0x286a8f);return _0x4f9f73(_0x286a8f,_0x46f71f,_[_0x25c1('0x4d')](_0x242149)['priority']+0x1)[_0x25c1('0x2f')](function(_0x4ff3e6){var _0x588b5f=_[_0x25c1('0x4c')](_0x242149,_0x4ff3e6);_0x588b5f['push']({'type':_0x286a8f['type'],'app':'Hangup','exten':_0x286a8f['exten'],'context':_0x286a8f[_0x25c1('0x5')],'priority':_['last'](_0x588b5f)[_0x25c1('0x4b')]+0x1,'VoiceExtensionId':_0x286a8f['id']});return _0x588b5f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5571086..e20aa3c 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 _0xbd10=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceExtension','findAll','options','where','include','map','model','attributes','then','GetVoiceExtension','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','request','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbd10,0x85));var _0x0bd1=function(_0x440cb9,_0xb614b9){_0x440cb9=_0x440cb9-0x0;var _0x5bc706=_0xbd10[_0x440cb9];return _0x5bc706;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd1('0x3'));var fs=require('fs');var Redis=require(_0x0bd1('0x4'));var db=require(_0x0bd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bd1('0x6'))(_0x0bd1('0x7'));var config=require(_0x0bd1('0x8'));var jayson=require(_0x0bd1('0x9'));var client=jayson[_0x0bd1('0xa')][_0x0bd1('0xb')]({'port':0x232a});config['redis']=_[_0x0bd1('0xc')](config['redis'],{'host':_0x0bd1('0xd'),'port':0x18eb});var socket=require(_0x0bd1('0xe'))(new Redis(config[_0x0bd1('0xf')]));require(_0x0bd1('0x10'))['register'](socket);function respondWithRpcPromise(_0x22b38f,_0x631d20,_0x6e9f80){return new BPromise(function(_0x32eedd,_0x154b4f){return client[_0x0bd1('0x11')](_0x22b38f,_0x6e9f80)['then'](function(_0x159b15){logger[_0x0bd1('0x12')](_0x0bd1('0x13'),_0x631d20,_0x0bd1('0x14'));logger[_0x0bd1('0x15')](_0x0bd1('0x16'),_0x631d20,'request\x20sent',JSON[_0x0bd1('0x17')](_0x159b15));if(_0x159b15[_0x0bd1('0x18')]){if(_0x159b15[_0x0bd1('0x18')]['code']===0x1f4){logger['error'](_0x0bd1('0x13'),_0x631d20,_0x159b15[_0x0bd1('0x18')][_0x0bd1('0x19')]);return _0x154b4f(_0x159b15['error']['message']);}logger[_0x0bd1('0x18')](_0x0bd1('0x13'),_0x631d20,_0x159b15[_0x0bd1('0x18')]['message']);return _0x32eedd(_0x159b15[_0x0bd1('0x18')][_0x0bd1('0x19')]);}else{logger[_0x0bd1('0x12')](_0x0bd1('0x13'),_0x631d20,'request\x20sent');_0x32eedd(_0x159b15[_0x0bd1('0x1a')][_0x0bd1('0x19')]);}})['catch'](function(_0x28b18f){logger[_0x0bd1('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x631d20,_0x28b18f);_0x154b4f(_0x28b18f);});});}exports['GetVoiceExtension']=function(_0x5ab684){var _0x134431=this;return new Promise(function(_0x313422,_0x6959b7){return db[_0x0bd1('0x1b')][_0x0bd1('0x1c')]({'raw':_0x5ab684[_0x0bd1('0x1d')]?_0x5ab684[_0x0bd1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5ab684[_0x0bd1('0x1d')]?_0x5ab684[_0x0bd1('0x1d')][_0x0bd1('0x1e')]||null:null,'attributes':_0x5ab684[_0x0bd1('0x1d')]?_0x5ab684[_0x0bd1('0x1d')]['attributes']||null:null,'limit':_0x5ab684[_0x0bd1('0x1d')]?_0x5ab684['options']['limit']||null:null,'include':_0x5ab684[_0x0bd1('0x1d')]?_0x5ab684[_0x0bd1('0x1d')][_0x0bd1('0x1f')]?_[_0x0bd1('0x20')](_0x5ab684[_0x0bd1('0x1d')][_0x0bd1('0x1f')],function(_0x3e0c07){return{'model':db[_0x3e0c07[_0x0bd1('0x21')]],'as':_0x3e0c07['as'],'attributes':_0x3e0c07[_0x0bd1('0x22')],'include':_0x3e0c07['include']?_['map'](_0x3e0c07[_0x0bd1('0x1f')],function(_0x58d9a9){return{'model':db[_0x58d9a9[_0x0bd1('0x21')]],'as':_0x58d9a9['as'],'attributes':_0x58d9a9[_0x0bd1('0x22')],'include':_0x58d9a9['include']?_['map'](_0x58d9a9['include'],function(_0x4b64cb){return{'model':db[_0x4b64cb['model']],'as':_0x4b64cb['as'],'attributes':_0x4b64cb[_0x0bd1('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0bd1('0x23')](function(_0x38e655){logger['info'](_0x0bd1('0x24'),_0x5ab684);logger[_0x0bd1('0x15')]('GetVoiceExtension',_0x5ab684,JSON['stringify'](_0x38e655));_0x313422(_0x38e655);})[_0x0bd1('0x25')](function(_0x4e23d7){logger['error']('GetVoiceExtension',_0x4e23d7[_0x0bd1('0x19')],_0x5ab684);_0x6959b7(_0x134431[_0x0bd1('0x18')](0x1f4,_0x4e23d7[_0x0bd1('0x19')]));});});}; \ No newline at end of file +var _0x00b3=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','limit','include','map','model','attributes','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x00b3,0x157));var _0x300b=function(_0x1f621e,_0x435bb1){_0x1f621e=_0x1f621e-0x0;var _0x101047=_0x00b3[_0x1f621e];return _0x101047;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var rs=require(_0x300b('0x4'));var fs=require('fs');var Redis=require(_0x300b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x6'));var logger=require(_0x300b('0x7'))('rpc');var config=require(_0x300b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x300b('0x9')][_0x300b('0xa')]({'port':0x232a});config[_0x300b('0xb')]=_[_0x300b('0xc')](config[_0x300b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x300b('0xd'))(new Redis(config[_0x300b('0xb')]));require(_0x300b('0xe'))[_0x300b('0xf')](socket);function respondWithRpcPromise(_0x1a8749,_0x5d01e0,_0x5c1ded){return new BPromise(function(_0x25f1cc,_0x2272d5){return client['request'](_0x1a8749,_0x5c1ded)[_0x300b('0x10')](function(_0xfc3ee2){logger['info'](_0x300b('0x11'),_0x5d01e0,_0x300b('0x12'));logger[_0x300b('0x13')](_0x300b('0x14'),_0x5d01e0,_0x300b('0x12'),JSON[_0x300b('0x15')](_0xfc3ee2));if(_0xfc3ee2[_0x300b('0x16')]){if(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x17')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x2272d5(_0xfc3ee2['error']['message']);}logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x25f1cc(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);}else{logger[_0x300b('0x19')](_0x300b('0x11'),_0x5d01e0,'request\x20sent');_0x25f1cc(_0xfc3ee2[_0x300b('0x1a')][_0x300b('0x18')]);}})[_0x300b('0x1b')](function(_0xe804e){logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xe804e);_0x2272d5(_0xe804e);});});}exports['GetVoiceExtension']=function(_0x585113){var _0x4831c5=this;return new Promise(function(_0x42a77d,_0x4491da){return db['VoiceExtension'][_0x300b('0x1c')]({'raw':_0x585113['options']?_0x585113[_0x300b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x585113[_0x300b('0x1d')]?_0x585113[_0x300b('0x1d')]['where']||null:null,'attributes':_0x585113[_0x300b('0x1d')]?_0x585113[_0x300b('0x1d')]['attributes']||null:null,'limit':_0x585113[_0x300b('0x1d')]?_0x585113['options'][_0x300b('0x1e')]||null:null,'include':_0x585113[_0x300b('0x1d')]?_0x585113[_0x300b('0x1d')][_0x300b('0x1f')]?_[_0x300b('0x20')](_0x585113[_0x300b('0x1d')][_0x300b('0x1f')],function(_0x55c2ca){return{'model':db[_0x55c2ca[_0x300b('0x21')]],'as':_0x55c2ca['as'],'attributes':_0x55c2ca[_0x300b('0x22')],'include':_0x55c2ca['include']?_[_0x300b('0x20')](_0x55c2ca['include'],function(_0x3c090b){return{'model':db[_0x3c090b[_0x300b('0x21')]],'as':_0x3c090b['as'],'attributes':_0x3c090b[_0x300b('0x22')],'include':_0x3c090b[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x3c090b[_0x300b('0x1f')],function(_0x2ef468){return{'model':db[_0x2ef468['model']],'as':_0x2ef468['as'],'attributes':_0x2ef468[_0x300b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x300b('0x10')](function(_0x12b2b8){logger[_0x300b('0x19')](_0x300b('0x23'),_0x585113);logger[_0x300b('0x13')]('GetVoiceExtension',_0x585113,JSON[_0x300b('0x15')](_0x12b2b8));_0x42a77d(_0x12b2b8);})[_0x300b('0x1b')](function(_0x363261){logger[_0x300b('0x16')](_0x300b('0x23'),_0x363261['message'],_0x585113);_0x4491da(_0x4831c5[_0x300b('0x16')](0x1f4,_0x363261[_0x300b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1ad385c..3bf170d 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x4b9e94,_0x522304){var _0x5970c2=function(_0x63117d){while(--_0x63117d){_0x4b9e94['push'](_0x4b9e94['shift']());}};_0x5970c2(++_0x522304);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x5fc3[_0x2a276d];return _0x2914cd;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x4a2fc9,_0x45b7cf){var _0x48502d=function(_0x171dd2){while(--_0x171dd2){_0x4a2fc9['push'](_0x4a2fc9['shift']());}};_0x48502d(++_0x45b7cf);}(_0x0295,0x1f0));var _0x5029=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x0295[_0x214266];return _0x568f75;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e2da3dc..1424bed 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 _0xdf55=['/:id/messages','getMessages','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1c16cc,_0x23ed44){var _0x409bd9=function(_0x5b2a8e){while(--_0x5b2a8e){_0x1c16cc['push'](_0x1c16cc['shift']());}};_0x409bd9(++_0x23ed44);}(_0xdf55,0x83));var _0x5df5=function(_0x4344a2,_0x4798ee){_0x4344a2=_0x4344a2-0x0;var _0x3dc2cb=_0xdf55[_0x4344a2];return _0x3dc2cb;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5df5('0xf')]);router['put'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller['update']);router['delete'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1fb99d,_0x5dad59){_0x1fb99d=_0x1fb99d-0x0;var _0x2419ae=_0x5f2f[_0x1fb99d];return _0x2419ae;};'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')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9396853..1bd3eb9 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 _0xdd8a=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xdd8a,0x1d0));var _0xadd8=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xdd8a[_0x99ff94];return _0x1b5bc0;};'use strict';var Sequelize=require(_0xadd8('0x0'));module[_0xadd8('0x1')]={'customer_id':{'type':Sequelize[_0xadd8('0x2')]},'context':{'type':Sequelize[_0xadd8('0x2')],'defaultValue':_0xadd8('0x3'),'unique':_0xadd8('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xadd8('0x4')},'password':{'type':Sequelize[_0xadd8('0x2')]},'fullname':{'type':Sequelize[_0xadd8('0x2')]},'email':{'type':Sequelize[_0xadd8('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ab5c9){this[_0xadd8('0x5')](_0xadd8('0x6'),typeof _0x1ab5c9===_0xadd8('0x7')&&_0x1ab5c9['trim']()?_0x1ab5c9[_0xadd8('0x8')]():null);}},'pager':{'type':Sequelize[_0xadd8('0x2')]},'tz':{'type':Sequelize[_0xadd8('0x2')],'defaultValue':_0xadd8('0x9')},'attach':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':_0xadd8('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xadd8('0xb')](_0xadd8('0xa'),'no'),'defaultValue':_0xadd8('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xadd8('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xadd8('0xb')](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xadd8('0xb')](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xadd8('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xadd8('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xadd8('0xb')](_0xadd8('0xa'),'no'),'defaultValue':_0xadd8('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xadd8('0xa'),'no'),'defaultValue':_0xadd8('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xadd8('0x2')]},'emailbody':{'type':Sequelize[_0xadd8('0x2')]},'maxsecs':{'type':Sequelize[_0xadd8('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xadd8('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xadd8('0xe')],'get':function(){return this[_0xadd8('0xf')](_0xadd8('0x10'))+_0xadd8('0x11')+this['getDataValue'](_0xadd8('0x12'));}}}; \ No newline at end of file +var _0x0718=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','email','trim','central','ENUM','yes','INTEGER','VIRTUAL'];(function(_0x3786dd,_0x5777fc){var _0x4c7a8e=function(_0x119047){while(--_0x119047){_0x3786dd['push'](_0x3786dd['shift']());}};_0x4c7a8e(++_0x5777fc);}(_0x0718,0x1a8));var _0x8071=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0x0718[_0x1903aa];return _0x51fe28;};'use strict';var Sequelize=require(_0x8071('0x0'));module[_0x8071('0x1')]={'customer_id':{'type':Sequelize[_0x8071('0x2')]},'context':{'type':Sequelize[_0x8071('0x2')],'defaultValue':_0x8071('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x8071('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8071('0x2')]},'fullname':{'type':Sequelize[_0x8071('0x2')]},'email':{'type':Sequelize[_0x8071('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c87c5){this['setDataValue'](_0x8071('0x4'),typeof _0x2c87c5==='string'&&_0x2c87c5[_0x8071('0x5')]()?_0x2c87c5[_0x8071('0x5')]():null);}},'pager':{'type':Sequelize[_0x8071('0x2')]},'tz':{'type':Sequelize[_0x8071('0x2')],'defaultValue':_0x8071('0x6')},'attach':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x8071('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8071('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8071('0x8'),'no'),'defaultValue':_0x8071('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8071('0x7')](_0x8071('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8071('0x2')]},'emailbody':{'type':Sequelize[_0x8071('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8071('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8071('0xa')],'get':function(){return this[_0x8071('0xb')](_0x8071('0xc'))+_0x8071('0xd')+this[_0x8071('0xb')](_0x8071('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b74d530..24f29b8 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 _0x0fd9=['ejs','squel','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x29fa94,_0x1118f8){var _0x4aebd6=function(_0x2cd4c7){while(--_0x2cd4c7){_0x29fa94['push'](_0x29fa94['shift']());}};_0x4aebd6(++_0x1118f8);}(_0x0fd9,0xa3));var _0x90fd=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x0fd9[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){var _0x52b066=_0x300262[_0x90fd('0x26')]({'plain':!![]});var _0x18d5b3=_0x90fd('0x27');return db[_0x90fd('0x28')][_0x90fd('0x29')]({'where':{'type':_0x18d5b3,'resourceId':_0x52b066['id']}})['then'](function(){return _0x300262;});})[_0x90fd('0x25')](function(){_0x3ad6c6[_0x90fd('0x19')](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x1cdc38,_0x1c3805){return function(_0x428bc2){if(!_0x428bc2){_0x1cdc38['sendStatus'](0x194);}return _0x428bc2;};}function handleError(_0x5671fc,_0xbf1c9b){_0xbf1c9b=_0xbf1c9b||0x1f4;return function(_0x170cfb){logger[_0x90fd('0x2a')](_0x170cfb[_0x90fd('0x2b')]);if(_0x170cfb[_0x90fd('0x2c')]){delete _0x170cfb['name'];}_0x5671fc['status'](_0xbf1c9b)[_0x90fd('0x2d')](_0x170cfb);};}exports[_0x90fd('0x2e')]=function(_0x228fbc,_0x3a0102){var _0x4a3ae4={},_0x59aede={},_0x12dea4={'count':0x0,'rows':[]};var _0x21a9cf=_[_0x90fd('0x2f')](db[_0x90fd('0x30')]['rawAttributes'],function(_0x2c5204){return{'name':_0x2c5204[_0x90fd('0x31')],'type':_0x2c5204[_0x90fd('0x32')][_0x90fd('0x33')]};});_0x59aede[_0x90fd('0x34')]=_[_0x90fd('0x2f')](_0x21a9cf,_0x90fd('0x2c'));_0x59aede[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x228fbc[_0x90fd('0x35')]);_0x59aede[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x59aede[_0x90fd('0x34')],_0x59aede[_0x90fd('0x35')]);_0x4a3ae4[_0x90fd('0x39')]=_[_0x90fd('0x38')](_0x59aede['model'],qs[_0x90fd('0x3a')](_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x4a3ae4[_0x90fd('0x39')]=_0x4a3ae4[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x4a3ae4[_0x90fd('0x39')]:_0x59aede[_0x90fd('0x34')];if(!_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3c')](_0x90fd('0x3d'))){_0x4a3ae4[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x228fbc['query'][_0x90fd('0x1c')]);_0x4a3ae4[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x228fbc[_0x90fd('0x35')]['offset']);}_0x4a3ae4[_0x90fd('0x3e')]=qs[_0x90fd('0x3f')](_0x228fbc[_0x90fd('0x35')]['sort']);_0x4a3ae4['where']=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x228fbc[_0x90fd('0x35')],_0x59aede[_0x90fd('0x37')]),_0x21a9cf);if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]){_0x4a3ae4[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x4a3ae4[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x21a9cf,function(_0x3265c6){if(_0x3265c6[_0x90fd('0x32')]!==_0x90fd('0x44')){var _0x47856d={};_0x47856d[_0x3265c6[_0x90fd('0x2c')]]={'$like':'%'+_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]+'%'};return _0x47856d;}})});}_0x4a3ae4=_[_0x90fd('0x43')]({},_0x4a3ae4,_0x228fbc['options']);var _0xa5f17={'where':_0x4a3ae4[_0x90fd('0x42')]};return db[_0x90fd('0x30')]['count'](_0xa5f17)['then'](function(_0x47b8c8){_0x12dea4[_0x90fd('0x1d')]=_0x47b8c8;if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x45')]){_0x4a3ae4[_0x90fd('0x46')]=[{'all':!![]}];}return db[_0x90fd('0x30')][_0x90fd('0x47')](_0x4a3ae4);})[_0x90fd('0x25')](function(_0x733d4d){_0x12dea4[_0x90fd('0x48')]=_0x733d4d;return _0x12dea4;})[_0x90fd('0x25')](respondWithFilteredResult(_0x3a0102,_0x4a3ae4))[_0x90fd('0x49')](handleError(_0x3a0102,null));};exports[_0x90fd('0x4a')]=function(_0x4cb682,_0x386a0e){var _0x311cbf={'raw':!![],'where':{'id':_0x4cb682['params']['id']}},_0x50b722={};_0x50b722[_0x90fd('0x34')]=_[_0x90fd('0x36')](db[_0x90fd('0x30')]['rawAttributes']);_0x50b722['query']=_[_0x90fd('0x36')](_0x4cb682[_0x90fd('0x35')]);_0x50b722['filters']=_['intersection'](_0x50b722[_0x90fd('0x34')],_0x50b722[_0x90fd('0x35')]);_0x311cbf['attributes']=_['intersection'](_0x50b722[_0x90fd('0x34')],qs[_0x90fd('0x3a')](_0x4cb682[_0x90fd('0x35')]['fields']));_0x311cbf[_0x90fd('0x39')]=_0x311cbf[_0x90fd('0x39')]['length']?_0x311cbf['attributes']:_0x50b722['model'];if(_0x4cb682[_0x90fd('0x35')][_0x90fd('0x45')]){_0x311cbf['include']=[{'all':!![]}];}_0x311cbf=_[_0x90fd('0x43')]({},_0x311cbf,_0x4cb682[_0x90fd('0x4b')]);return db[_0x90fd('0x30')][_0x90fd('0x4c')](_0x311cbf)[_0x90fd('0x25')](handleEntityNotFound(_0x386a0e,null))['then'](respondWithResult(_0x386a0e,null))['catch'](handleError(_0x386a0e,null));};exports[_0x90fd('0x4d')]=function(_0x326e4d,_0x125874){return db[_0x90fd('0x30')][_0x90fd('0x4d')](_0x326e4d[_0x90fd('0x4e')],{})[_0x90fd('0x25')](function(_0x277751){var _0x31b284=_0x326e4d[_0x90fd('0x4f')]['get']({'plain':!![]});if(!_0x31b284)throw new Error(_0x90fd('0x50'));if(_0x31b284[_0x90fd('0x51')]===_0x90fd('0x4f')){var _0x38021b=_0x277751['get']({'plain':!![]});var _0x4cf061=_0x90fd('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4cf061,'userProfileId':_0x31b284[_0x90fd('0x52')]},'raw':!![]})[_0x90fd('0x25')](function(_0x41f029){if(_0x41f029&&_0x41f029[_0x90fd('0x53')]===0x0){return db[_0x90fd('0x28')][_0x90fd('0x4d')]({'name':_0x38021b[_0x90fd('0x2c')],'resourceId':_0x38021b['id'],'type':_0x41f029['name'],'sectionId':_0x41f029['id']},{})['then'](function(){return _0x277751;});}else{return _0x277751;}})[_0x90fd('0x49')](function(_0x43d076){logger[_0x90fd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d076);throw _0x43d076;});}return _0x277751;})[_0x90fd('0x25')](respondWithResult(_0x125874,0xc9))[_0x90fd('0x49')](handleError(_0x125874,null));};exports[_0x90fd('0x24')]=function(_0x3494f7,_0x437abd){if(_0x3494f7[_0x90fd('0x4e')]['id']){delete _0x3494f7[_0x90fd('0x4e')]['id'];}return db[_0x90fd('0x30')]['find']({'where':{'id':_0x3494f7['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x437abd,null))[_0x90fd('0x25')](saveUpdates(_0x3494f7[_0x90fd('0x4e')],null))['then'](respondWithResult(_0x437abd,null))[_0x90fd('0x49')](handleError(_0x437abd,null));};exports[_0x90fd('0x29')]=function(_0x29b880,_0x24229f){return db[_0x90fd('0x30')][_0x90fd('0x4c')]({'where':{'id':_0x29b880['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x24229f,null))['then'](removeEntity(_0x24229f,null))[_0x90fd('0x49')](handleError(_0x24229f,null));};exports['getMessages']=function(_0x29b7ea,_0x461509,_0x2fb220){return db[_0x90fd('0x30')]['findOne']({'where':{'id':_0x29b7ea[_0x90fd('0x54')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x461509,null))[_0x90fd('0x25')](function(_0x40fea3){var _0x4586e9;var _0x15bca2={},_0x57acf6={};_0x57acf6['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x57acf6[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x29b7ea[_0x90fd('0x35')]);_0x57acf6[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x57acf6['model'],_0x57acf6['query']);_0x15bca2['attributes']=_[_0x90fd('0x38')](_0x57acf6[_0x90fd('0x34')],qs['fields'](_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x15bca2[_0x90fd('0x39')]=_0x15bca2[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x15bca2[_0x90fd('0x39')]:_0x57acf6[_0x90fd('0x34')];if(!_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3c')]('nolimit')){_0x15bca2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x29b7ea[_0x90fd('0x35')]['limit']);_0x15bca2['offset']=qs[_0x90fd('0x1e')](_0x29b7ea[_0x90fd('0x35')]['offset']);}_0x15bca2[_0x90fd('0x3e')]=qs['sort'](_0x29b7ea['query'][_0x90fd('0x3f')]);_0x15bca2[_0x90fd('0x42')]=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x29b7ea[_0x90fd('0x35')],_0x57acf6[_0x90fd('0x37')]));if(_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x41')]){_0x15bca2['where']=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x15bca2['attributes'],function(_0x2d0f4b){var _0x4636d5={};_0x4636d5[_0x2d0f4b]={'$like':'%'+_0x29b7ea['query']['filter']+'%'};return _0x4636d5;})});}_0x15bca2[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'mailboxuser':_0x40fea3['mailbox']});_0x15bca2=_[_0x90fd('0x43')]({},_0x15bca2,_0x29b7ea['options']);return db['VoiceMailMessage'][_0x90fd('0x55')](_0x15bca2)['then'](respondWithFilteredResult(_0x461509,_0x15bca2));})[_0x90fd('0x49')](handleError(_0x461509,null));}; \ No newline at end of file +var _0xda3f=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','length','mailbox','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1330e5,_0x41f1b4){var _0x133c9c=function(_0x32a9d4){while(--_0x32a9d4){_0x1330e5['push'](_0x1330e5['shift']());}};_0x133c9c(++_0x41f1b4);}(_0xda3f,0xec));var _0xfda3=function(_0x59bab8,_0x2c95d7){_0x59bab8=_0x59bab8-0x0;var _0x11bb69=_0xda3f[_0x59bab8];return _0x11bb69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){var _0x2d5b44=_0x16eaa6[_0xfda3('0x24')]({'plain':!![]});var _0x4ae9b9=_0xfda3('0x25');return db[_0xfda3('0x26')][_0xfda3('0x27')]({'where':{'type':_0x4ae9b9,'resourceId':_0x2d5b44['id']}})[_0xfda3('0x23')](function(){return _0x16eaa6;});})[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6d7d,_0x1e87fe){return function(_0x2bef2b){if(!_0x2bef2b){_0x3c6d7d[_0xfda3('0x17')](0x194);}return _0x2bef2b;};}function handleError(_0x33ffd4,_0x5704c7){_0x5704c7=_0x5704c7||0x1f4;return function(_0x3c1549){logger[_0xfda3('0x28')](_0x3c1549[_0xfda3('0x29')]);if(_0x3c1549[_0xfda3('0x2a')]){delete _0x3c1549[_0xfda3('0x2a')];}_0x33ffd4[_0xfda3('0x18')](_0x5704c7)[_0xfda3('0x2b')](_0x3c1549);};}exports['index']=function(_0x56ca3a,_0x3aef3c){var _0x4fd277={},_0x4b9d90={},_0x16b4a2={'count':0x0,'rows':[]};var _0x2a5971=_[_0xfda3('0x2c')](db[_0xfda3('0x2d')][_0xfda3('0x2e')],function(_0x35ec7a){return{'name':_0x35ec7a[_0xfda3('0x2f')],'type':_0x35ec7a[_0xfda3('0x30')][_0xfda3('0x31')]};});_0x4b9d90['model']=_[_0xfda3('0x2c')](_0x2a5971,_0xfda3('0x2a'));_0x4b9d90[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x56ca3a[_0xfda3('0x32')]);_0x4b9d90[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x4b9d90[_0xfda3('0x36')],_0x4b9d90[_0xfda3('0x32')]);_0x4fd277['attributes']=_['intersection'](_0x4b9d90[_0xfda3('0x36')],qs[_0xfda3('0x37')](_0x56ca3a['query'][_0xfda3('0x37')]));_0x4fd277[_0xfda3('0x38')]=_0x4fd277[_0xfda3('0x38')]['length']?_0x4fd277[_0xfda3('0x38')]:_0x4b9d90[_0xfda3('0x36')];if(!_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x39')](_0xfda3('0x3a'))){_0x4fd277['limit']=qs[_0xfda3('0x1b')](_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x1b')]);_0x4fd277['offset']=qs[_0xfda3('0x19')](_0x56ca3a['query'][_0xfda3('0x19')]);}_0x4fd277[_0xfda3('0x3b')]=qs[_0xfda3('0x3c')](_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3c')]);_0x4fd277[_0xfda3('0x3d')]=qs[_0xfda3('0x34')](_[_0xfda3('0x3e')](_0x56ca3a['query'],_0x4b9d90[_0xfda3('0x34')]),_0x2a5971);if(_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3f')]){_0x4fd277[_0xfda3('0x3d')]=_['merge'](_0x4fd277[_0xfda3('0x3d')],{'$or':_[_0xfda3('0x2c')](_0x2a5971,function(_0x590ba5){if(_0x590ba5['type']!=='VIRTUAL'){var _0x31b173={};_0x31b173[_0x590ba5[_0xfda3('0x2a')]]={'$like':'%'+_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3f')]+'%'};return _0x31b173;}})});}_0x4fd277=_[_0xfda3('0x40')]({},_0x4fd277,_0x56ca3a[_0xfda3('0x41')]);var _0x40b814={'where':_0x4fd277[_0xfda3('0x3d')]};return db[_0xfda3('0x2d')][_0xfda3('0x1c')](_0x40b814)['then'](function(_0x27200f){_0x16b4a2[_0xfda3('0x1c')]=_0x27200f;if(_0x56ca3a['query'][_0xfda3('0x42')]){_0x4fd277['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x4fd277);})[_0xfda3('0x23')](function(_0x107fb1){_0x16b4a2[_0xfda3('0x43')]=_0x107fb1;return _0x16b4a2;})[_0xfda3('0x23')](respondWithFilteredResult(_0x3aef3c,_0x4fd277))['catch'](handleError(_0x3aef3c,null));};exports[_0xfda3('0x44')]=function(_0x25b9a6,_0x154ae7){var _0x2ce504={'raw':!![],'where':{'id':_0x25b9a6[_0xfda3('0x45')]['id']}},_0x564ccd={};_0x564ccd[_0xfda3('0x36')]=_[_0xfda3('0x33')](db['VoiceMail']['rawAttributes']);_0x564ccd[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x25b9a6[_0xfda3('0x32')]);_0x564ccd[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x564ccd[_0xfda3('0x36')],_0x564ccd[_0xfda3('0x32')]);_0x2ce504[_0xfda3('0x38')]=_[_0xfda3('0x35')](_0x564ccd[_0xfda3('0x36')],qs[_0xfda3('0x37')](_0x25b9a6[_0xfda3('0x32')][_0xfda3('0x37')]));_0x2ce504[_0xfda3('0x38')]=_0x2ce504['attributes']['length']?_0x2ce504[_0xfda3('0x38')]:_0x564ccd[_0xfda3('0x36')];if(_0x25b9a6[_0xfda3('0x32')][_0xfda3('0x42')]){_0x2ce504[_0xfda3('0x46')]=[{'all':!![]}];}_0x2ce504=_[_0xfda3('0x40')]({},_0x2ce504,_0x25b9a6[_0xfda3('0x41')]);return db[_0xfda3('0x2d')][_0xfda3('0x47')](_0x2ce504)[_0xfda3('0x23')](handleEntityNotFound(_0x154ae7,null))['then'](respondWithResult(_0x154ae7,null))[_0xfda3('0x48')](handleError(_0x154ae7,null));};exports[_0xfda3('0x49')]=function(_0x481356,_0x36aa3a){return db[_0xfda3('0x2d')]['create'](_0x481356[_0xfda3('0x4a')],{})[_0xfda3('0x23')](function(_0x15eb87){var _0x4bcd2b=_0x481356[_0xfda3('0x4b')][_0xfda3('0x24')]({'plain':!![]});if(!_0x4bcd2b)throw new Error(_0xfda3('0x4c'));if(_0x4bcd2b['role']===_0xfda3('0x4b')){var _0x33565d=_0x15eb87[_0xfda3('0x24')]({'plain':!![]});var _0x2f6e62=_0xfda3('0x25');return db['UserProfileSection'][_0xfda3('0x47')]({'where':{'name':_0x2f6e62,'userProfileId':_0x4bcd2b['userProfileId']},'raw':!![]})[_0xfda3('0x23')](function(_0x587eef){if(_0x587eef&&_0x587eef[_0xfda3('0x4d')]===0x0){return db[_0xfda3('0x26')][_0xfda3('0x49')]({'name':_0x33565d[_0xfda3('0x2a')],'resourceId':_0x33565d['id'],'type':_0x587eef['name'],'sectionId':_0x587eef['id']},{})[_0xfda3('0x23')](function(){return _0x15eb87;});}else{return _0x15eb87;}})[_0xfda3('0x48')](function(_0x2f2c32){logger[_0xfda3('0x28')](_0xfda3('0x4e'),_0x2f2c32);throw _0x2f2c32;});}return _0x15eb87;})[_0xfda3('0x23')](respondWithResult(_0x36aa3a,0xc9))[_0xfda3('0x48')](handleError(_0x36aa3a,null));};exports['update']=function(_0x4b1410,_0x4fb214){if(_0x4b1410[_0xfda3('0x4a')]['id']){delete _0x4b1410[_0xfda3('0x4a')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x4b1410[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x4fb214,null))[_0xfda3('0x23')](saveUpdates(_0x4b1410[_0xfda3('0x4a')],null))[_0xfda3('0x23')](respondWithResult(_0x4fb214,null))['catch'](handleError(_0x4fb214,null));};exports[_0xfda3('0x27')]=function(_0x2a30e8,_0x167424){return db[_0xfda3('0x2d')][_0xfda3('0x47')]({'where':{'id':_0x2a30e8[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x167424,null))[_0xfda3('0x23')](removeEntity(_0x167424,null))[_0xfda3('0x48')](handleError(_0x167424,null));};exports[_0xfda3('0x4f')]=function(_0x3ed7c1,_0x1fa27a,_0x5b426b){return db[_0xfda3('0x2d')][_0xfda3('0x50')]({'where':{'id':_0x3ed7c1[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x1fa27a,null))[_0xfda3('0x23')](function(_0x405d7e){var _0x42c7a1;var _0x4ce31c={},_0x5a3a6f={};_0x5a3a6f[_0xfda3('0x36')]=_[_0xfda3('0x33')](db['VoiceMailMessage'][_0xfda3('0x2e')]);_0x5a3a6f[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x3ed7c1[_0xfda3('0x32')]);_0x5a3a6f['filters']=_['intersection'](_0x5a3a6f[_0xfda3('0x36')],_0x5a3a6f[_0xfda3('0x32')]);_0x4ce31c[_0xfda3('0x38')]=_['intersection'](_0x5a3a6f[_0xfda3('0x36')],qs['fields'](_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x37')]));_0x4ce31c[_0xfda3('0x38')]=_0x4ce31c[_0xfda3('0x38')][_0xfda3('0x51')]?_0x4ce31c[_0xfda3('0x38')]:_0x5a3a6f['model'];if(!_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x39')](_0xfda3('0x3a'))){_0x4ce31c[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3ed7c1['query']['limit']);_0x4ce31c[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3ed7c1['query']['offset']);}_0x4ce31c['order']=qs[_0xfda3('0x3c')](_0x3ed7c1[_0xfda3('0x32')]['sort']);_0x4ce31c[_0xfda3('0x3d')]=qs[_0xfda3('0x34')](_[_0xfda3('0x3e')](_0x3ed7c1[_0xfda3('0x32')],_0x5a3a6f['filters']));if(_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x3f')]){_0x4ce31c[_0xfda3('0x3d')]=_[_0xfda3('0x40')](_0x4ce31c[_0xfda3('0x3d')],{'$or':_[_0xfda3('0x2c')](_0x4ce31c['attributes'],function(_0x4e312d){var _0x31d657={};_0x31d657[_0x4e312d]={'$like':'%'+_0x3ed7c1['query'][_0xfda3('0x3f')]+'%'};return _0x31d657;})});}_0x4ce31c[_0xfda3('0x3d')]=_[_0xfda3('0x40')](_0x4ce31c[_0xfda3('0x3d')],{'mailboxuser':_0x405d7e[_0xfda3('0x52')]});_0x4ce31c=_[_0xfda3('0x40')]({},_0x4ce31c,_0x3ed7c1[_0xfda3('0x41')]);return db[_0xfda3('0x53')][_0xfda3('0x54')](_0x4ce31c)[_0xfda3('0x23')](respondWithFilteredResult(_0x1fa27a,_0x4ce31c));})['catch'](handleError(_0x1fa27a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ecca56d..80a3674 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 _0xda3a=['rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','context','util','moment','bluebird','path'];(function(_0x339aa1,_0x2a6089){var _0x1679b9=function(_0x53ee7a){while(--_0x53ee7a){_0x339aa1['push'](_0x339aa1['shift']());}};_0x1679b9(++_0x2a6089);}(_0xda3a,0x6a));var _0xada3=function(_0x27a417,_0x608363){_0x27a417=_0x27a417-0x0;var _0x1762f7=_0xda3a[_0x27a417];return _0x1762f7;};'use strict';var _=require('lodash');var util=require(_0xada3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xada3('0x1'));var BPromise=require(_0xada3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xada3('0x3'));var rimraf=require(_0xada3('0x4'));var config=require(_0xada3('0x5'));var attributes=require(_0xada3('0x6'));module['exports']=function(_0x67cdbd,_0x4cb77a){return _0x67cdbd[_0xada3('0x7')](_0xada3('0x8'),attributes,{'tableName':_0xada3('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xada3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67d0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util'];(function(_0x76b51d,_0x151ea4){var _0x90c99b=function(_0x4db4f2){while(--_0x4db4f2){_0x76b51d['push'](_0x76b51d['shift']());}};_0x90c99b(++_0x151ea4);}(_0x67d0,0x6e));var _0x067d=function(_0x4d2447,_0x35a40c){_0x4d2447=_0x4d2447-0x0;var _0x2a00ce=_0x67d0[_0x4d2447];return _0x2a00ce;};'use strict';var _=require(_0x067d('0x0'));var util=require(_0x067d('0x1'));var logger=require(_0x067d('0x2'))(_0x067d('0x3'));var moment=require(_0x067d('0x4'));var BPromise=require(_0x067d('0x5'));var rp=require(_0x067d('0x6'));var fs=require('fs');var path=require(_0x067d('0x7'));var rimraf=require(_0x067d('0x8'));var config=require(_0x067d('0x9'));var attributes=require('./voiceMail.attributes');module[_0x067d('0xa')]=function(_0x12e189,_0x109090){return _0x12e189[_0x067d('0xb')](_0x067d('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x067d('0xd'),'fields':[_0x067d('0xe'),_0x067d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index faf53be..56b9d1f 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 _0x59fc=['jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0x59fc,0x1b0));var _0xc59f=function(_0x2aa773,_0x20fb0b){_0x2aa773=_0x2aa773-0x0;var _0x475103=_0x59fc[_0x2aa773];return _0x475103;};'use strict';var _=require(_0xc59f('0x0'));var util=require(_0xc59f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc59f('0x2'));var fs=require('fs');var Redis=require(_0xc59f('0x3'));var db=require(_0xc59f('0x4'))['db'];var utils=require(_0xc59f('0x5'));var logger=require('../../config/logger')(_0xc59f('0x6'));var config=require(_0xc59f('0x7'));var jayson=require(_0xc59f('0x8'));var client=jayson[_0xc59f('0x9')][_0xc59f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477f93,_0xe56ef6,_0x2ea249){return new BPromise(function(_0x55961c,_0x159a4e){return client[_0xc59f('0xb')](_0x477f93,_0x2ea249)[_0xc59f('0xc')](function(_0x1742d3){logger[_0xc59f('0xd')]('VoiceMail,\x20%s,\x20%s',_0xe56ef6,_0xc59f('0xe'));logger[_0xc59f('0xf')](_0xc59f('0x10'),_0xe56ef6,'request\x20sent',JSON['stringify'](_0x1742d3));if(_0x1742d3[_0xc59f('0x11')]){if(_0x1742d3[_0xc59f('0x11')][_0xc59f('0x12')]===0x1f4){logger[_0xc59f('0x11')](_0xc59f('0x13'),_0xe56ef6,_0x1742d3[_0xc59f('0x11')]['message']);return _0x159a4e(_0x1742d3[_0xc59f('0x11')][_0xc59f('0x14')]);}logger[_0xc59f('0x11')](_0xc59f('0x13'),_0xe56ef6,_0x1742d3[_0xc59f('0x11')][_0xc59f('0x14')]);return _0x55961c(_0x1742d3[_0xc59f('0x11')][_0xc59f('0x14')]);}else{logger[_0xc59f('0xd')](_0xc59f('0x13'),_0xe56ef6,_0xc59f('0xe'));_0x55961c(_0x1742d3['result'][_0xc59f('0x14')]);}})[_0xc59f('0x15')](function(_0x555dce){logger[_0xc59f('0x11')](_0xc59f('0x13'),_0xe56ef6,_0x555dce);_0x159a4e(_0x555dce);});});} \ No newline at end of file +var _0x0b54=['rpc','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','catch','util','moment','../../mysqldb'];(function(_0x56b90d,_0x3f7119){var _0x24351d=function(_0x35f553){while(--_0x35f553){_0x56b90d['push'](_0x56b90d['shift']());}};_0x24351d(++_0x3f7119);}(_0x0b54,0x1d9));var _0x40b5=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x0b54[_0x5be7aa];return _0x215408;};'use strict';var _=require('lodash');var util=require(_0x40b5('0x0'));var moment=require(_0x40b5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40b5('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x40b5('0x3'));var config=require('../../config/environment');var jayson=require(_0x40b5('0x4'));var client=jayson[_0x40b5('0x5')][_0x40b5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x43b8c1,_0x410315,_0x16a1eb){return new BPromise(function(_0x319fab,_0x55c91e){return client['request'](_0x43b8c1,_0x16a1eb)[_0x40b5('0x7')](function(_0x44cba5){logger['info']('VoiceMail,\x20%s,\x20%s',_0x410315,_0x40b5('0x8'));logger[_0x40b5('0x9')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x410315,_0x40b5('0x8'),JSON[_0x40b5('0xa')](_0x44cba5));if(_0x44cba5['error']){if(_0x44cba5[_0x40b5('0xb')][_0x40b5('0xc')]===0x1f4){logger[_0x40b5('0xb')](_0x40b5('0xd'),_0x410315,_0x44cba5[_0x40b5('0xb')][_0x40b5('0xe')]);return _0x55c91e(_0x44cba5[_0x40b5('0xb')]['message']);}logger[_0x40b5('0xb')](_0x40b5('0xd'),_0x410315,_0x44cba5['error']['message']);return _0x319fab(_0x44cba5['error'][_0x40b5('0xe')]);}else{logger[_0x40b5('0xf')](_0x40b5('0xd'),_0x410315,_0x40b5('0x8'));_0x319fab(_0x44cba5['result'][_0x40b5('0xe')]);}})[_0x40b5('0x10')](function(_0x4cb531){logger[_0x40b5('0xb')](_0x40b5('0xd'),_0x410315,_0x4cb531);_0x55c91e(_0x4cb531);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 79b5e51..7d50b22 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 _0x114b=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','/:id/download','isAuthenticated','download','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd580e2,_0x109182){var _0x4d955f=function(_0x568fff){while(--_0x568fff){_0xd580e2['push'](_0xd580e2['shift']());}};_0x4d955f(++_0x109182);}(_0x114b,0x1db));var _0xb114=function(_0x22ce83,_0x432953){_0x22ce83=_0x22ce83-0x0;var _0x3a16e0=_0x114b[_0x22ce83];return _0x3a16e0;};'use strict';var multer=require(_0xb114('0x0'));var util=require(_0xb114('0x1'));var path=require(_0xb114('0x2'));var timeout=require(_0xb114('0x3'));var express=require(_0xb114('0x4'));var router=express[_0xb114('0x5')]();var fs_extra=require(_0xb114('0x6'));var auth=require(_0xb114('0x7'));var interaction=require(_0xb114('0x8'));var config=require(_0xb114('0x9'));var controller=require(_0xb114('0xa'));router[_0xb114('0xb')]('/',auth['isAuthenticated'](),controller[_0xb114('0xc')]);router[_0xb114('0xb')](_0xb114('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb114('0xb')](_0xb114('0xe'),auth[_0xb114('0xf')](),controller[_0xb114('0x10')]);router['post']('/',auth[_0xb114('0xf')](),controller['create']);router[_0xb114('0x11')](_0xb114('0xd'),auth[_0xb114('0xf')](),controller[_0xb114('0x12')]);router[_0xb114('0x13')](_0xb114('0xd'),auth['isAuthenticated'](),controller[_0xb114('0x14')]);module['exports']=router; \ No newline at end of file +var _0xec64=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','download','post','put','/:id','update','delete','exports','multer'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xec64,0x167));var _0x4ec6=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xec64[_0x35d775];return _0x59384d;};'use strict';var multer=require(_0x4ec6('0x0'));var util=require(_0x4ec6('0x1'));var path=require('path');var timeout=require(_0x4ec6('0x2'));var express=require(_0x4ec6('0x3'));var router=express[_0x4ec6('0x4')]();var fs_extra=require(_0x4ec6('0x5'));var auth=require(_0x4ec6('0x6'));var interaction=require(_0x4ec6('0x7'));var config=require(_0x4ec6('0x8'));var controller=require(_0x4ec6('0x9'));router[_0x4ec6('0xa')]('/',auth[_0x4ec6('0xb')](),controller['index']);router[_0x4ec6('0xa')]('/:id',auth[_0x4ec6('0xb')](),controller[_0x4ec6('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x4ec6('0xd')]);router[_0x4ec6('0xe')]('/',auth[_0x4ec6('0xb')](),controller['create']);router[_0x4ec6('0xf')](_0x4ec6('0x10'),auth['isAuthenticated'](),controller[_0x4ec6('0x11')]);router[_0x4ec6('0x12')](_0x4ec6('0x10'),auth[_0x4ec6('0xb')](),controller['destroy']);module[_0x4ec6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0f9be84..e289a14 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 _0x6c5c=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','STRING','BLOB'];(function(_0x29d5a7,_0x1720b9){var _0x3657e8=function(_0x50cb6d){while(--_0x50cb6d){_0x29d5a7['push'](_0x29d5a7['shift']());}};_0x3657e8(++_0x1720b9);}(_0x6c5c,0xe6));var _0xc6c5=function(_0x320d24,_0x5f04ff){_0x320d24=_0x320d24-0x0;var _0x34beaa=_0x6c5c[_0x320d24];return _0x34beaa;};'use strict';var Sequelize=require('sequelize');module[_0xc6c5('0x0')]={'name':{'type':Sequelize[_0xc6c5('0x1')],'get':function(_0x2667fd){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0xc6c5('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc6c5('0x2')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc6c5('0x4')](_0xc6c5('0x5'))}}; \ No newline at end of file +var _0x5ccf=['getDataValue','STRING','BLOB','long','literal','sequelize'];(function(_0x38842c,_0x5992ce){var _0x191bf3=function(_0x1601d3){while(--_0x1601d3){_0x38842c['push'](_0x38842c['shift']());}};_0x191bf3(++_0x5992ce);}(_0x5ccf,0x167));var _0xf5cc=function(_0x28023d,_0x169cdd){_0x28023d=_0x28023d-0x0;var _0x35316a=_0x5ccf[_0x28023d];return _0x35316a;};'use strict';var Sequelize=require(_0xf5cc('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x33858c){return this[_0xf5cc('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf5cc('0x3')](_0xf5cc('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf5cc('0x2')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf5cc('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 66cc76e..6db6fee 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 _0x222b=['save','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x222b,0x1dc));var _0xb222=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x222b[_0x466af7];return _0x348c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb222('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb222('0x1'));var rp=require('request-promise');var moment=require(_0xb222('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb222('0x3'));var util=require(_0xb222('0x4'));var path=require(_0xb222('0x5'));var sox=require(_0xb222('0x6'));var csv=require(_0xb222('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb222('0x8'));var squel=require(_0xb222('0x9'));var crypto=require('crypto');var jsforce=require(_0xb222('0xa'));var deskjs=require(_0xb222('0xb'));var toCsv=require(_0xb222('0x7'));var querystring=require(_0xb222('0xc'));var Papa=require('papaparse');var Redis=require(_0xb222('0xd'));var authService=require(_0xb222('0xe'));var qs=require(_0xb222('0xf'));var as=require(_0xb222('0x10'));var hardwareService=require(_0xb222('0x11'));var logger=require(_0xb222('0x12'))(_0xb222('0x13'));var utils=require(_0xb222('0x14'));var config=require(_0xb222('0x15'));var licenseUtil=require(_0xb222('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x454c89,_0x113079){_0x113079=_0x113079||0xcc;return function(_0x9ec5d2){if(_0x9ec5d2){return _0x454c89['sendStatus'](_0x113079);}return _0x454c89[_0xb222('0x17')](_0x113079)[_0xb222('0x18')]();};}function respondWithResult(_0x49aa01,_0x1d5186){_0x1d5186=_0x1d5186||0xc8;return function(_0x40d241){if(_0x40d241){return _0x49aa01[_0xb222('0x17')](_0x1d5186)['json'](_0x40d241);}};}function respondWithFilteredResult(_0x527f2d,_0x2936fa){return function(_0x28c81d){if(_0x28c81d){var _0x1a483d=typeof _0x2936fa[_0xb222('0x19')]===_0xb222('0x1a')&&typeof _0x2936fa[_0xb222('0x1b')]===_0xb222('0x1a');var _0x293784=_0x28c81d[_0xb222('0x1c')];var _0x4337e5=_0x1a483d?0x0:_0x2936fa[_0xb222('0x19')];var _0x39c1f7=_0x1a483d?_0x28c81d[_0xb222('0x1c')]:_0x2936fa[_0xb222('0x19')]+_0x2936fa[_0xb222('0x1b')];var _0x13b5ac;if(_0x39c1f7>=_0x293784){_0x39c1f7=_0x293784;_0x13b5ac=0xc8;}else{_0x13b5ac=0xce;}_0x527f2d[_0xb222('0x17')](_0x13b5ac);return _0x527f2d[_0xb222('0x1d')](_0xb222('0x1e'),_0x4337e5+'-'+_0x39c1f7+'/'+_0x293784)[_0xb222('0x1f')](_0x28c81d);}return null;};}function patchUpdates(_0x36060a){return function(_0x5ad19d){try{jsonpatch[_0xb222('0x20')](_0x5ad19d,_0x36060a,!![]);}catch(_0xfd9f04){return BPromise[_0xb222('0x21')](_0xfd9f04);}return _0x5ad19d[_0xb222('0x22')]();};}function saveUpdates(_0xd3b8fa,_0x36da0d){return function(_0x5bce2a){if(_0x5bce2a){return _0x5bce2a[_0xb222('0x23')](_0xd3b8fa)['then'](function(_0x505849){return _0x505849;});}return null;};}function removeEntity(_0xa5c50c,_0x734fe8){return function(_0x30880){if(_0x30880){return _0x30880['destroy']()[_0xb222('0x24')](function(){_0xa5c50c['status'](0xcc)[_0xb222('0x18')]();});}};}function handleEntityNotFound(_0x3d86c7,_0x325de4){return function(_0x4596d2){if(!_0x4596d2){_0x3d86c7['sendStatus'](0x194);}return _0x4596d2;};}function handleError(_0x1444ff,_0x4e80f9){_0x4e80f9=_0x4e80f9||0x1f4;return function(_0x45af42){logger[_0xb222('0x25')](_0x45af42[_0xb222('0x26')]);if(_0x45af42[_0xb222('0x27')]){delete _0x45af42[_0xb222('0x27')];}_0x1444ff[_0xb222('0x17')](_0x4e80f9)[_0xb222('0x28')](_0x45af42);};}exports[_0xb222('0x29')]=function(_0x3bd250,_0x32a047){var _0x1a796d={},_0xb33c83={},_0x389cc9={'count':0x0,'rows':[]};var _0x423cc5=_[_0xb222('0x2a')](db[_0xb222('0x2b')][_0xb222('0x2c')],function(_0x3ce0e1){return{'name':_0x3ce0e1[_0xb222('0x2d')],'type':_0x3ce0e1[_0xb222('0x2e')]['key']};});_0xb33c83[_0xb222('0x2f')]=_[_0xb222('0x30')](_[_0xb222('0x2a')](_0x423cc5,_0xb222('0x27')),['name']);_0xb33c83[_0xb222('0x31')]=_[_0xb222('0x32')](_0x3bd250['query']);_0xb33c83[_0xb222('0x33')]=_[_0xb222('0x34')](_0xb33c83['model'],_0xb33c83['query']);_0x1a796d[_0xb222('0x35')]=_[_0xb222('0x34')](_0xb33c83[_0xb222('0x2f')],qs[_0xb222('0x36')](_0x3bd250[_0xb222('0x31')]['fields']));_0x1a796d['attributes']=_0x1a796d['attributes'][_0xb222('0x37')]?_0x1a796d[_0xb222('0x35')]:_0xb33c83[_0xb222('0x2f')];if(!_0x3bd250['query'][_0xb222('0x38')](_0xb222('0x39'))){_0x1a796d[_0xb222('0x1b')]=qs[_0xb222('0x1b')](_0x3bd250[_0xb222('0x31')][_0xb222('0x1b')]);_0x1a796d[_0xb222('0x19')]=qs[_0xb222('0x19')](_0x3bd250[_0xb222('0x31')][_0xb222('0x19')]);}_0x1a796d[_0xb222('0x3a')]=qs[_0xb222('0x3b')](_0x3bd250['query'][_0xb222('0x3b')]);_0x1a796d[_0xb222('0x3c')]=qs[_0xb222('0x33')](_['pick'](_0x3bd250['query'],_0xb33c83['filters']),_0x423cc5);if(_0x3bd250[_0xb222('0x31')][_0xb222('0x3d')]){_0x1a796d[_0xb222('0x3c')]=_[_0xb222('0x3e')](_0x1a796d[_0xb222('0x3c')],{'$or':_['map'](_0x423cc5,function(_0x4dd018){if(_0x4dd018[_0xb222('0x2e')]!=='VIRTUAL'){var _0x54b002={};_0x54b002[_0x4dd018['name']]={'$like':'%'+_0x3bd250[_0xb222('0x31')][_0xb222('0x3d')]+'%'};return _0x54b002;}})});}_0x1a796d=_[_0xb222('0x3e')]({},_0x1a796d,_0x3bd250[_0xb222('0x3f')]);var _0xb05136={'where':_0x1a796d[_0xb222('0x3c')]};return db[_0xb222('0x2b')][_0xb222('0x1c')](_0xb05136)[_0xb222('0x24')](function(_0x5955b3){_0x389cc9[_0xb222('0x1c')]=_0x5955b3;if(_0x3bd250['query'][_0xb222('0x40')]){_0x1a796d[_0xb222('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x1a796d);})[_0xb222('0x24')](function(_0x58dc7c){_0x389cc9[_0xb222('0x42')]=_0x58dc7c;return _0x389cc9;})[_0xb222('0x24')](respondWithFilteredResult(_0x32a047,_0x1a796d))['catch'](handleError(_0x32a047,null));};exports[_0xb222('0x43')]=function(_0x2acdea,_0x151f6d){var _0x2583f1={'raw':!![],'where':{'id':_0x2acdea[_0xb222('0x44')]['id']}},_0x1b6101={};_0x1b6101[_0xb222('0x2f')]=_[_0xb222('0x32')](db[_0xb222('0x2b')][_0xb222('0x2c')]);_0x1b6101[_0xb222('0x31')]=_['keys'](_0x2acdea[_0xb222('0x31')]);_0x1b6101['filters']=_['intersection'](_0x1b6101[_0xb222('0x2f')],_0x1b6101[_0xb222('0x31')]);_0x2583f1[_0xb222('0x35')]=_[_0xb222('0x34')](_0x1b6101[_0xb222('0x2f')],qs[_0xb222('0x36')](_0x2acdea[_0xb222('0x31')]['fields']));_0x2583f1[_0xb222('0x35')]=_0x2583f1[_0xb222('0x35')][_0xb222('0x37')]?_0x2583f1[_0xb222('0x35')]:_0x1b6101['model'];if(_0x2acdea[_0xb222('0x31')][_0xb222('0x40')]){_0x2583f1[_0xb222('0x41')]=[{'all':!![]}];}_0x2583f1=_['merge']({},_0x2583f1,_0x2acdea[_0xb222('0x3f')]);return db[_0xb222('0x2b')][_0xb222('0x45')](_0x2583f1)[_0xb222('0x24')](handleEntityNotFound(_0x151f6d,null))[_0xb222('0x24')](respondWithResult(_0x151f6d,null))[_0xb222('0x46')](handleError(_0x151f6d,null));};exports[_0xb222('0x47')]=function(_0x55eeda,_0x3ac4f2){return db[_0xb222('0x2b')][_0xb222('0x47')](_0x55eeda['body'],{})[_0xb222('0x24')](respondWithResult(_0x3ac4f2,0xc9))[_0xb222('0x46')](handleError(_0x3ac4f2,null));};exports[_0xb222('0x23')]=function(_0x4e3104,_0x2d197a){if(_0x4e3104[_0xb222('0x48')]['id']){delete _0x4e3104[_0xb222('0x48')]['id'];}return db[_0xb222('0x2b')][_0xb222('0x45')]({'where':{'id':_0x4e3104[_0xb222('0x44')]['id']}})[_0xb222('0x24')](handleEntityNotFound(_0x2d197a,null))['then'](saveUpdates(_0x4e3104[_0xb222('0x48')],null))['then'](respondWithResult(_0x2d197a,null))['catch'](handleError(_0x2d197a,null));};exports[_0xb222('0x49')]=function(_0x11ead2,_0x4cc5bb){return db[_0xb222('0x2b')]['find']({'where':{'id':_0x11ead2['params']['id']}})['then'](handleEntityNotFound(_0x4cc5bb,null))[_0xb222('0x24')](removeEntity(_0x4cc5bb,null))['catch'](handleError(_0x4cc5bb,null));};exports[_0xb222('0x4a')]=function(_0x5cdda3,_0x5d9de4,_0x27fba5){return db['VoiceMailMessage']['find']({'where':{'id':_0x5cdda3[_0xb222('0x44')]['id']},'attributes':['id','recording',_0xb222('0x4b')]})[_0xb222('0x24')](handleEntityNotFound(_0x5d9de4,null))[_0xb222('0x24')](function(_0x96e4db){if(_0x96e4db){if(!_0x96e4db[_0xb222('0x4c')]){throw new db[(_0xb222('0x4d'))][(_0xb222('0x4e'))](_0xb222('0x4f'));}var _0x311b65={'Content-Type':_0xb222('0x50'),'Content-Disposition':_0xb222('0x51')};if(_0x96e4db[_0xb222('0x4b')]){_0x311b65[_0xb222('0x52')]=_0xb222('0x53')+_0x96e4db[_0xb222('0x4b')]+_0xb222('0x54');}_0x5d9de4['set'](_0x311b65);return _0x5d9de4['send'](new Buffer(_0x96e4db[_0xb222('0x4c')]));}})['catch'](handleError(_0x5d9de4,null));}; \ No newline at end of file +var _0x3c83=['Content-Range','apply','update','then','destroy','error','name','send','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','rawAttributes','fields','includeAll','find','create','body','params','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','attachment;\x20filename=\x22','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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'];(function(_0x408b34,_0xb7d872){var _0x1182aa=function(_0x1825c4){while(--_0x1825c4){_0x408b34['push'](_0x408b34['shift']());}};_0x1182aa(++_0xb7d872);}(_0x3c83,0x181));var _0x33c8=function(_0x2b48e7,_0xaca9f3){_0x2b48e7=_0x2b48e7-0x0;var _0x55a9ac=_0x3c83[_0x2b48e7];return _0x55a9ac;};'use strict';var emlformat=require(_0x33c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33c8('0x2'));var moment=require(_0x33c8('0x3'));var BPromise=require(_0x33c8('0x4'));var Mustache=require(_0x33c8('0x5'));var util=require(_0x33c8('0x6'));var path=require(_0x33c8('0x7'));var sox=require(_0x33c8('0x8'));var csv=require(_0x33c8('0x9'));var ejs=require(_0x33c8('0xa'));var fs=require('fs');var fs_extra=require(_0x33c8('0xb'));var _=require('lodash');var squel=require(_0x33c8('0xc'));var crypto=require(_0x33c8('0xd'));var jsforce=require(_0x33c8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x33c8('0x9'));var querystring=require(_0x33c8('0xf'));var Papa=require(_0x33c8('0x10'));var Redis=require('ioredis');var authService=require(_0x33c8('0x11'));var qs=require(_0x33c8('0x12'));var as=require(_0x33c8('0x13'));var hardwareService=require(_0x33c8('0x14'));var logger=require(_0x33c8('0x15'))(_0x33c8('0x16'));var utils=require(_0x33c8('0x17'));var config=require(_0x33c8('0x18'));var licenseUtil=require(_0x33c8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b695b,_0x53ecc7){_0x53ecc7=_0x53ecc7||0xcc;return function(_0xe4b70e){if(_0xe4b70e){return _0x4b695b[_0x33c8('0x1a')](_0x53ecc7);}return _0x4b695b[_0x33c8('0x1b')](_0x53ecc7)[_0x33c8('0x1c')]();};}function respondWithResult(_0x128d3a,_0x96847a){_0x96847a=_0x96847a||0xc8;return function(_0x289538){if(_0x289538){return _0x128d3a[_0x33c8('0x1b')](_0x96847a)[_0x33c8('0x1d')](_0x289538);}};}function respondWithFilteredResult(_0x1bd923,_0x224ac3){return function(_0x3e0354){if(_0x3e0354){var _0x78e4bd=typeof _0x224ac3[_0x33c8('0x1e')]===_0x33c8('0x1f')&&typeof _0x224ac3[_0x33c8('0x20')]==='undefined';var _0x510a07=_0x3e0354[_0x33c8('0x21')];var _0x24d742=_0x78e4bd?0x0:_0x224ac3['offset'];var _0x51e206=_0x78e4bd?_0x3e0354[_0x33c8('0x21')]:_0x224ac3[_0x33c8('0x1e')]+_0x224ac3['limit'];var _0x383f0c;if(_0x51e206>=_0x510a07){_0x51e206=_0x510a07;_0x383f0c=0xc8;}else{_0x383f0c=0xce;}_0x1bd923[_0x33c8('0x1b')](_0x383f0c);return _0x1bd923[_0x33c8('0x22')](_0x33c8('0x23'),_0x24d742+'-'+_0x51e206+'/'+_0x510a07)[_0x33c8('0x1d')](_0x3e0354);}return null;};}function patchUpdates(_0x2f4465){return function(_0x5ce2a7){try{jsonpatch[_0x33c8('0x24')](_0x5ce2a7,_0x2f4465,!![]);}catch(_0x440de0){return BPromise['reject'](_0x440de0);}return _0x5ce2a7['save']();};}function saveUpdates(_0x4236a6,_0x48713f){return function(_0x809878){if(_0x809878){return _0x809878[_0x33c8('0x25')](_0x4236a6)[_0x33c8('0x26')](function(_0x59fbc4){return _0x59fbc4;});}return null;};}function removeEntity(_0x568abc,_0x4f6f54){return function(_0x30bb26){if(_0x30bb26){return _0x30bb26[_0x33c8('0x27')]()[_0x33c8('0x26')](function(){_0x568abc[_0x33c8('0x1b')](0xcc)[_0x33c8('0x1c')]();});}};}function handleEntityNotFound(_0x322a52,_0x2d53c4){return function(_0x186350){if(!_0x186350){_0x322a52[_0x33c8('0x1a')](0x194);}return _0x186350;};}function handleError(_0x25164b,_0x359c93){_0x359c93=_0x359c93||0x1f4;return function(_0xf7d3ff){logger[_0x33c8('0x28')](_0xf7d3ff['stack']);if(_0xf7d3ff[_0x33c8('0x29')]){delete _0xf7d3ff[_0x33c8('0x29')];}_0x25164b['status'](_0x359c93)[_0x33c8('0x2a')](_0xf7d3ff);};}exports[_0x33c8('0x2b')]=function(_0x190bdc,_0x5d686e){var _0x5768c7={},_0x579d9f={},_0xb3991b={'count':0x0,'rows':[]};var _0x122b79=_[_0x33c8('0x2c')](db[_0x33c8('0x2d')]['rawAttributes'],function(_0x28f1ba){return{'name':_0x28f1ba[_0x33c8('0x2e')],'type':_0x28f1ba[_0x33c8('0x2f')][_0x33c8('0x30')]};});_0x579d9f[_0x33c8('0x31')]=_[_0x33c8('0x32')](_['map'](_0x122b79,_0x33c8('0x29')),[_0x33c8('0x29')]);_0x579d9f[_0x33c8('0x33')]=_[_0x33c8('0x34')](_0x190bdc[_0x33c8('0x33')]);_0x579d9f['filters']=_[_0x33c8('0x35')](_0x579d9f[_0x33c8('0x31')],_0x579d9f['query']);_0x5768c7[_0x33c8('0x36')]=_[_0x33c8('0x35')](_0x579d9f[_0x33c8('0x31')],qs['fields'](_0x190bdc[_0x33c8('0x33')]['fields']));_0x5768c7[_0x33c8('0x36')]=_0x5768c7[_0x33c8('0x36')][_0x33c8('0x37')]?_0x5768c7[_0x33c8('0x36')]:_0x579d9f['model'];if(!_0x190bdc[_0x33c8('0x33')][_0x33c8('0x38')](_0x33c8('0x39'))){_0x5768c7[_0x33c8('0x20')]=qs[_0x33c8('0x20')](_0x190bdc['query'][_0x33c8('0x20')]);_0x5768c7[_0x33c8('0x1e')]=qs['offset'](_0x190bdc['query']['offset']);}_0x5768c7[_0x33c8('0x3a')]=qs[_0x33c8('0x3b')](_0x190bdc['query'][_0x33c8('0x3b')]);_0x5768c7[_0x33c8('0x3c')]=qs[_0x33c8('0x3d')](_[_0x33c8('0x3e')](_0x190bdc['query'],_0x579d9f['filters']),_0x122b79);if(_0x190bdc['query']['filter']){_0x5768c7['where']=_[_0x33c8('0x3f')](_0x5768c7['where'],{'$or':_['map'](_0x122b79,function(_0xd18f35){if(_0xd18f35[_0x33c8('0x2f')]!==_0x33c8('0x40')){var _0x266dd7={};_0x266dd7[_0xd18f35[_0x33c8('0x29')]]={'$like':'%'+_0x190bdc[_0x33c8('0x33')][_0x33c8('0x41')]+'%'};return _0x266dd7;}})});}_0x5768c7=_[_0x33c8('0x3f')]({},_0x5768c7,_0x190bdc[_0x33c8('0x42')]);var _0x137e1d={'where':_0x5768c7['where']};return db['VoiceMailMessage'][_0x33c8('0x21')](_0x137e1d)[_0x33c8('0x26')](function(_0x2dce87){_0xb3991b[_0x33c8('0x21')]=_0x2dce87;if(_0x190bdc[_0x33c8('0x33')]['includeAll']){_0x5768c7[_0x33c8('0x43')]=[{'all':!![]}];}return db[_0x33c8('0x2d')][_0x33c8('0x44')](_0x5768c7);})['then'](function(_0x442448){_0xb3991b['rows']=_0x442448;return _0xb3991b;})[_0x33c8('0x26')](respondWithFilteredResult(_0x5d686e,_0x5768c7))[_0x33c8('0x45')](handleError(_0x5d686e,null));};exports[_0x33c8('0x46')]=function(_0x21bfba,_0x15acb4){var _0x3340c7={'raw':!![],'where':{'id':_0x21bfba['params']['id']}},_0x3d1dc7={};_0x3d1dc7[_0x33c8('0x31')]=_['keys'](db[_0x33c8('0x2d')][_0x33c8('0x47')]);_0x3d1dc7['query']=_[_0x33c8('0x34')](_0x21bfba[_0x33c8('0x33')]);_0x3d1dc7[_0x33c8('0x3d')]=_[_0x33c8('0x35')](_0x3d1dc7[_0x33c8('0x31')],_0x3d1dc7[_0x33c8('0x33')]);_0x3340c7[_0x33c8('0x36')]=_[_0x33c8('0x35')](_0x3d1dc7[_0x33c8('0x31')],qs[_0x33c8('0x48')](_0x21bfba[_0x33c8('0x33')]['fields']));_0x3340c7[_0x33c8('0x36')]=_0x3340c7[_0x33c8('0x36')][_0x33c8('0x37')]?_0x3340c7[_0x33c8('0x36')]:_0x3d1dc7[_0x33c8('0x31')];if(_0x21bfba[_0x33c8('0x33')][_0x33c8('0x49')]){_0x3340c7[_0x33c8('0x43')]=[{'all':!![]}];}_0x3340c7=_[_0x33c8('0x3f')]({},_0x3340c7,_0x21bfba['options']);return db[_0x33c8('0x2d')][_0x33c8('0x4a')](_0x3340c7)['then'](handleEntityNotFound(_0x15acb4,null))[_0x33c8('0x26')](respondWithResult(_0x15acb4,null))['catch'](handleError(_0x15acb4,null));};exports[_0x33c8('0x4b')]=function(_0x3170b0,_0x37e351){return db[_0x33c8('0x2d')]['create'](_0x3170b0[_0x33c8('0x4c')],{})[_0x33c8('0x26')](respondWithResult(_0x37e351,0xc9))[_0x33c8('0x45')](handleError(_0x37e351,null));};exports[_0x33c8('0x25')]=function(_0x4101fc,_0x55bd25){if(_0x4101fc[_0x33c8('0x4c')]['id']){delete _0x4101fc[_0x33c8('0x4c')]['id'];}return db[_0x33c8('0x2d')]['find']({'where':{'id':_0x4101fc[_0x33c8('0x4d')]['id']}})[_0x33c8('0x26')](handleEntityNotFound(_0x55bd25,null))[_0x33c8('0x26')](saveUpdates(_0x4101fc[_0x33c8('0x4c')],null))[_0x33c8('0x26')](respondWithResult(_0x55bd25,null))[_0x33c8('0x45')](handleError(_0x55bd25,null));};exports[_0x33c8('0x27')]=function(_0x4cc2d2,_0x1a3c1e){return db[_0x33c8('0x2d')][_0x33c8('0x4a')]({'where':{'id':_0x4cc2d2[_0x33c8('0x4d')]['id']}})[_0x33c8('0x26')](handleEntityNotFound(_0x1a3c1e,null))[_0x33c8('0x26')](removeEntity(_0x1a3c1e,null))['catch'](handleError(_0x1a3c1e,null));};exports['download']=function(_0x4ca5c1,_0x4223a0,_0xb388bf){return db['VoiceMailMessage'][_0x33c8('0x4a')]({'where':{'id':_0x4ca5c1['params']['id']},'attributes':['id','recording','msg_id']})[_0x33c8('0x26')](handleEntityNotFound(_0x4223a0,null))['then'](function(_0x5e6e37){if(_0x5e6e37){if(!_0x5e6e37[_0x33c8('0x4e')]){throw new db[(_0x33c8('0x4f'))][(_0x33c8('0x50'))](_0x33c8('0x51'));}var _0x10b94f={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5e6e37[_0x33c8('0x52')]){_0x10b94f['Content-Disposition']=_0x33c8('0x53')+_0x5e6e37[_0x33c8('0x52')]+'.wav\x22';}_0x4223a0[_0x33c8('0x22')](_0x10b94f);return _0x4223a0[_0x33c8('0x2a')](new Buffer(_0x5e6e37[_0x33c8('0x4e')]));}})[_0x33c8('0x45')](handleError(_0x4223a0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e5fb7bb..08b1302 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 _0x3ad7=['api','request-promise','path','rimraf','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger'];(function(_0x44689f,_0x1fb85f){var _0x5379fd=function(_0x1957c5){while(--_0x1957c5){_0x44689f['push'](_0x44689f['shift']());}};_0x5379fd(++_0x1fb85f);}(_0x3ad7,0x115));var _0x73ad=function(_0x244203,_0x462039){_0x244203=_0x244203-0x0;var _0x354333=_0x3ad7[_0x244203];return _0x354333;};'use strict';var _=require(_0x73ad('0x0'));var util=require(_0x73ad('0x1'));var logger=require(_0x73ad('0x2'))(_0x73ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x73ad('0x4'));var fs=require('fs');var path=require(_0x73ad('0x5'));var rimraf=require(_0x73ad('0x6'));var config=require('../../config/environment');var attributes=require(_0x73ad('0x7'));module['exports']=function(_0x5f0373,_0xeb750f){return _0x5f0373['define'](_0x73ad('0x8'),attributes,{'tableName':_0x73ad('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xcff8=['./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xcff8,0xe2));var _0x8cff=function(_0x13abdf,_0x311422){_0x13abdf=_0x13abdf-0x0;var _0x1bdaba=_0xcff8[_0x13abdf];return _0x1bdaba;};'use strict';var _=require(_0x8cff('0x0'));var util=require('util');var logger=require(_0x8cff('0x1'))('api');var moment=require(_0x8cff('0x2'));var BPromise=require(_0x8cff('0x3'));var rp=require(_0x8cff('0x4'));var fs=require('fs');var path=require(_0x8cff('0x5'));var rimraf=require(_0x8cff('0x6'));var config=require(_0x8cff('0x7'));var attributes=require(_0x8cff('0x8'));module[_0x8cff('0x9')]=function(_0x1188c9,_0x234abb){return _0x1188c9[_0x8cff('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x8cff('0xb'),'paranoid':![],'indexes':[{'name':_0x8cff('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 8b46f62..de8e4e6 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 _0xe4db=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xb3a3ef,_0x3e4b9c){var _0x4b0e62=function(_0x5981da){while(--_0x5981da){_0xb3a3ef['push'](_0xb3a3ef['shift']());}};_0x4b0e62(++_0x3e4b9c);}(_0xe4db,0x18b));var _0xbe4d=function(_0x3db991,_0xa0b4eb){_0x3db991=_0x3db991-0x0;var _0x1d2eca=_0xe4db[_0x3db991];return _0x1d2eca;};'use strict';var _=require(_0xbe4d('0x0'));var util=require(_0xbe4d('0x1'));var moment=require(_0xbe4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe4d('0x3'));var fs=require('fs');var Redis=require(_0xbe4d('0x4'));var db=require(_0xbe4d('0x5'))['db'];var utils=require(_0xbe4d('0x6'));var logger=require('../../config/logger')(_0xbe4d('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe4d('0x8'));var client=jayson[_0xbe4d('0x9')][_0xbe4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df925,_0x22d8f3,_0x2977da){return new BPromise(function(_0x342e97,_0x550c59){return client[_0xbe4d('0xb')](_0x2df925,_0x2977da)[_0xbe4d('0xc')](function(_0x25a885){logger[_0xbe4d('0xd')](_0xbe4d('0xe'),_0x22d8f3,_0xbe4d('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x22d8f3,'request\x20sent',JSON['stringify'](_0x25a885));if(_0x25a885[_0xbe4d('0x10')]){if(_0x25a885[_0xbe4d('0x10')]['code']===0x1f4){logger['error'](_0xbe4d('0xe'),_0x22d8f3,_0x25a885[_0xbe4d('0x10')]['message']);return _0x550c59(_0x25a885[_0xbe4d('0x10')][_0xbe4d('0x11')]);}logger[_0xbe4d('0x10')](_0xbe4d('0xe'),_0x22d8f3,_0x25a885[_0xbe4d('0x10')][_0xbe4d('0x11')]);return _0x342e97(_0x25a885['error'][_0xbe4d('0x11')]);}else{logger[_0xbe4d('0xd')](_0xbe4d('0xe'),_0x22d8f3,_0xbe4d('0xf'));_0x342e97(_0x25a885[_0xbe4d('0x12')][_0xbe4d('0x11')]);}})[_0xbe4d('0x13')](function(_0x480b99){logger['error'](_0xbe4d('0xe'),_0x22d8f3,_0x480b99);_0x550c59(_0x480b99);});});} \ No newline at end of file +var _0xd400=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd400,0xe6));var _0x0d40=function(_0x14b16f,_0x4b2b3a){_0x14b16f=_0x14b16f-0x0;var _0x2d8ddc=_0xd400[_0x14b16f];return _0x2d8ddc;};'use strict';var _=require(_0x0d40('0x0'));var util=require(_0x0d40('0x1'));var moment=require(_0x0d40('0x2'));var BPromise=require(_0x0d40('0x3'));var rs=require(_0x0d40('0x4'));var fs=require('fs');var Redis=require(_0x0d40('0x5'));var db=require(_0x0d40('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d40('0x7'))('rpc');var config=require(_0x0d40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d40('0x9')][_0x0d40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b46ae,_0x315d60,_0x17aa51){return new BPromise(function(_0x9fe198,_0x634566){return client[_0x0d40('0xb')](_0x2b46ae,_0x17aa51)[_0x0d40('0xc')](function(_0x4a098b){logger['info'](_0x0d40('0xd'),_0x315d60,_0x0d40('0xe'));logger[_0x0d40('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x315d60,'request\x20sent',JSON['stringify'](_0x4a098b));if(_0x4a098b[_0x0d40('0x10')]){if(_0x4a098b['error'][_0x0d40('0x11')]===0x1f4){logger[_0x0d40('0x10')](_0x0d40('0xd'),_0x315d60,_0x4a098b['error']['message']);return _0x634566(_0x4a098b[_0x0d40('0x10')][_0x0d40('0x12')]);}logger['error'](_0x0d40('0xd'),_0x315d60,_0x4a098b[_0x0d40('0x10')][_0x0d40('0x12')]);return _0x9fe198(_0x4a098b[_0x0d40('0x10')][_0x0d40('0x12')]);}else{logger[_0x0d40('0x13')](_0x0d40('0xd'),_0x315d60,_0x0d40('0xe'));_0x9fe198(_0x4a098b['result'][_0x0d40('0x12')]);}})[_0x0d40('0x14')](function(_0x47194b){logger[_0x0d40('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x315d60,_0x47194b);_0x634566(_0x47194b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ab0be4c..e7a4839 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 _0xe3bd=['fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','create','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout'];(function(_0xd3e16a,_0x28517e){var _0x449538=function(_0x2a4f10){while(--_0x2a4f10){_0xd3e16a['push'](_0xd3e16a['shift']());}};_0x449538(++_0x28517e);}(_0xe3bd,0xfa));var _0xde3b=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xe3bd[_0xb4cc12];return _0x8593b5;};'use strict';var multer=require(_0xde3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde3b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde3b('0x2'));var auth=require(_0xde3b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xde3b('0x4'));var controller=require(_0xde3b('0x5'));router[_0xde3b('0x6')]('/',auth[_0xde3b('0x7')](),controller[_0xde3b('0x8')]);router['get'](_0xde3b('0x9'),auth['isAuthenticated'](),controller[_0xde3b('0xa')]);router[_0xde3b('0x6')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xde3b('0xb')]);router['post']('/',auth[_0xde3b('0x7')](),controller[_0xde3b('0xc')]);router[_0xde3b('0xd')]('/:id/sounds',auth[_0xde3b('0x7')](),controller['addSound']);router[_0xde3b('0xe')](_0xde3b('0x9'),auth['isAuthenticated'](),controller[_0xde3b('0xf')]);router[_0xde3b('0x10')](_0xde3b('0x9'),auth['isAuthenticated'](),controller[_0xde3b('0x11')]);router[_0xde3b('0x10')](_0xde3b('0x12'),auth['isAuthenticated'](),controller[_0xde3b('0x13')]);module[_0xde3b('0x14')]=router; \ No newline at end of file +var _0x6b48=['show','/:id/sounds','post','create','addSound','put','delete','destroy','removeSound','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id'];(function(_0x4f2eea,_0x475e90){var _0x163800=function(_0x1eceab){while(--_0x1eceab){_0x4f2eea['push'](_0x4f2eea['shift']());}};_0x163800(++_0x475e90);}(_0x6b48,0x1d2));var _0x86b4=function(_0xda4b4b,_0x5bf81f){_0xda4b4b=_0xda4b4b-0x0;var _0xfc676f=_0x6b48[_0xda4b4b];return _0xfc676f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x86b4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86b4('0x1')]();var fs_extra=require(_0x86b4('0x2'));var auth=require(_0x86b4('0x3'));var interaction=require(_0x86b4('0x4'));var config=require('../../config/environment');var controller=require(_0x86b4('0x5'));router[_0x86b4('0x6')]('/',auth[_0x86b4('0x7')](),controller['index']);router['get'](_0x86b4('0x8'),auth[_0x86b4('0x7')](),controller[_0x86b4('0x9')]);router['get'](_0x86b4('0xa'),auth[_0x86b4('0x7')](),controller['getSounds']);router[_0x86b4('0xb')]('/',auth[_0x86b4('0x7')](),controller[_0x86b4('0xc')]);router[_0x86b4('0xb')](_0x86b4('0xa'),auth['isAuthenticated'](),controller[_0x86b4('0xd')]);router[_0x86b4('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x86b4('0xf')](_0x86b4('0x8'),auth['isAuthenticated'](),controller[_0x86b4('0x10')]);router[_0x86b4('0xf')]('/:id/sounds/:id2',auth[_0x86b4('0x7')](),controller[_0x86b4('0x11')]);module[_0x86b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5f73636..e351451 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 _0x90ca=['custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name'];(function(_0x118912,_0x5528a5){var _0x2c9d20=function(_0x4a3e3d){while(--_0x4a3e3d){_0x118912['push'](_0x118912['shift']());}};_0x2c9d20(++_0x5528a5);}(_0x90ca,0xb8));var _0xa90c=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x90ca[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require(_0xa90c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa90c('0x1')],'allowNull':![],'unique':_0xa90c('0x2')},'mode':{'type':Sequelize['ENUM'](_0xa90c('0x3'),_0xa90c('0x4'),'mp3nb',_0xa90c('0x5'),_0xa90c('0x6'),_0xa90c('0x7')),'allowNull':!![],'defaultValue':_0xa90c('0x4')},'directory':{'type':Sequelize[_0xa90c('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xa90c('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa90c('0x1')],'allowNull':!![],'defaultValue':_0xa90c('0x8')},'format':{'type':Sequelize[_0xa90c('0x1')],'allowNull':!![]},'stamp':{'type':_0xa90c('0x9')},'defaultEntry':{'type':Sequelize[_0xa90c('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf2b=['files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0xb38aee,_0x519853){var _0x5c2b20=function(_0x4b4a55){while(--_0x4b4a55){_0xb38aee['push'](_0xb38aee['shift']());}};_0x5c2b20(++_0x519853);}(_0xdf2b,0x1be));var _0xbdf2=function(_0x2fe74a,_0x321c67){_0x2fe74a=_0x2fe74a-0x0;var _0x3556d3=_0xdf2b[_0x2fe74a];return _0x3556d3;};'use strict';var Sequelize=require(_0xbdf2('0x0'));module[_0xbdf2('0x1')]={'name':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':![],'unique':_0xbdf2('0x3')},'mode':{'type':Sequelize[_0xbdf2('0x4')]('custom',_0xbdf2('0x5'),_0xbdf2('0x6'),_0xbdf2('0x7'),_0xbdf2('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xbdf2('0x5')},'directory':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xbdf2('0x2')],'allowNull':!![]},'stamp':{'type':_0xbdf2('0x9')},'defaultEntry':{'type':Sequelize[_0xbdf2('0xa')],'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 1f57a9f..59afac8 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 _0x6cae=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','update','destroy','then','get','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','params','body','find','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','getSounds','length','options','nolimit','eml-format','rimraf','zip-dir'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6cae,0xe3));var _0xe6ca=function(_0x255eca,_0x66652f){_0x255eca=_0x255eca-0x0;var _0x3abb12=_0x6cae[_0x255eca];return _0x3abb12;};'use strict';var emlformat=require(_0xe6ca('0x0'));var rimraf=require(_0xe6ca('0x1'));var zipdir=require(_0xe6ca('0x2'));var jsonpatch=require(_0xe6ca('0x3'));var rp=require(_0xe6ca('0x4'));var moment=require(_0xe6ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe6ca('0x6'));var util=require(_0xe6ca('0x7'));var path=require(_0xe6ca('0x8'));var sox=require(_0xe6ca('0x9'));var csv=require(_0xe6ca('0xa'));var ejs=require(_0xe6ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6ca('0xc'));var squel=require(_0xe6ca('0xd'));var crypto=require(_0xe6ca('0xe'));var jsforce=require(_0xe6ca('0xf'));var deskjs=require(_0xe6ca('0x10'));var toCsv=require(_0xe6ca('0xa'));var querystring=require(_0xe6ca('0x11'));var Papa=require(_0xe6ca('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe6ca('0x13'));var as=require(_0xe6ca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6ca('0x15'))(_0xe6ca('0x16'));var utils=require('../../config/utils');var config=require(_0xe6ca('0x17'));var licenseUtil=require(_0xe6ca('0x18'));var db=require(_0xe6ca('0x19'))['db'];function respondWithStatusCode(_0x55366c,_0x1a0ac3){_0x1a0ac3=_0x1a0ac3||0xcc;return function(_0x42698a){if(_0x42698a){return _0x55366c[_0xe6ca('0x1a')](_0x1a0ac3);}return _0x55366c['status'](_0x1a0ac3)[_0xe6ca('0x1b')]();};}function respondWithResult(_0x18b5ba,_0x2c701e){_0x2c701e=_0x2c701e||0xc8;return function(_0x22fe4e){if(_0x22fe4e){return _0x18b5ba[_0xe6ca('0x1c')](_0x2c701e)[_0xe6ca('0x1d')](_0x22fe4e);}};}function respondWithFilteredResult(_0x2e6a18,_0x3df102){return function(_0x319b4b){if(_0x319b4b){var _0x1fe479=typeof _0x3df102[_0xe6ca('0x1e')]==='undefined'&&typeof _0x3df102[_0xe6ca('0x1f')]==='undefined';var _0x39d48=_0x319b4b['count'];var _0x14cb11=_0x1fe479?0x0:_0x3df102[_0xe6ca('0x1e')];var _0x4aae4f=_0x1fe479?_0x319b4b['count']:_0x3df102[_0xe6ca('0x1e')]+_0x3df102[_0xe6ca('0x1f')];var _0xae6ff;if(_0x4aae4f>=_0x39d48){_0x4aae4f=_0x39d48;_0xae6ff=0xc8;}else{_0xae6ff=0xce;}_0x2e6a18[_0xe6ca('0x1c')](_0xae6ff);return _0x2e6a18[_0xe6ca('0x20')](_0xe6ca('0x21'),_0x14cb11+'-'+_0x4aae4f+'/'+_0x39d48)[_0xe6ca('0x1d')](_0x319b4b);}return null;};}function patchUpdates(_0x8e257b){return function(_0x2357c2){try{jsonpatch['apply'](_0x2357c2,_0x8e257b,!![]);}catch(_0x3fbcff){return BPromise[_0xe6ca('0x22')](_0x3fbcff);}return _0x2357c2['save']();};}function saveUpdates(_0x478b98,_0x55cb45){return function(_0x3e583c){if(_0x3e583c){return _0x3e583c[_0xe6ca('0x23')](_0x478b98)['then'](function(_0x16d44e){return _0x16d44e;});}return null;};}function removeEntity(_0x35bf0e,_0x50c0ea){return function(_0xa92cd6){if(_0xa92cd6){return _0xa92cd6[_0xe6ca('0x24')]()[_0xe6ca('0x25')](function(){var _0x1c14c=_0xa92cd6[_0xe6ca('0x26')]({'plain':!![]});var _0x33c82a='MusicOnHolds';return db['UserProfileResource'][_0xe6ca('0x24')]({'where':{'type':_0x33c82a,'resourceId':_0x1c14c['id']}})[_0xe6ca('0x25')](function(){return _0xa92cd6;});})[_0xe6ca('0x25')](function(){_0x35bf0e[_0xe6ca('0x1c')](0xcc)[_0xe6ca('0x1b')]();});}};}function handleEntityNotFound(_0x1c8b5c,_0x4a9b25){return function(_0x18fe1f){if(!_0x18fe1f){_0x1c8b5c[_0xe6ca('0x1a')](0x194);}return _0x18fe1f;};}function handleError(_0x3074dc,_0x874527){_0x874527=_0x874527||0x1f4;return function(_0x5a41f8){logger['error'](_0x5a41f8[_0xe6ca('0x27')]);if(_0x5a41f8[_0xe6ca('0x28')]){delete _0x5a41f8[_0xe6ca('0x28')];}_0x3074dc[_0xe6ca('0x1c')](_0x874527)[_0xe6ca('0x29')](_0x5a41f8);};}exports[_0xe6ca('0x2a')]=function(_0x2a7df0,_0x560221){var _0x2656fa={},_0x4d0734={},_0x5a144d={'count':0x0,'rows':[]};var _0x4b1ff5=_[_0xe6ca('0x2b')](db[_0xe6ca('0x2c')][_0xe6ca('0x2d')],function(_0xf067a6){return{'name':_0xf067a6[_0xe6ca('0x2e')],'type':_0xf067a6[_0xe6ca('0x2f')][_0xe6ca('0x30')]};});_0x4d0734[_0xe6ca('0x31')]=_[_0xe6ca('0x2b')](_0x4b1ff5,_0xe6ca('0x28'));_0x4d0734[_0xe6ca('0x32')]=_[_0xe6ca('0x33')](_0x2a7df0[_0xe6ca('0x32')]);_0x4d0734['filters']=_[_0xe6ca('0x34')](_0x4d0734[_0xe6ca('0x31')],_0x4d0734[_0xe6ca('0x32')]);_0x2656fa[_0xe6ca('0x35')]=_[_0xe6ca('0x34')](_0x4d0734[_0xe6ca('0x31')],qs['fields'](_0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x36')]));_0x2656fa['attributes']=_0x2656fa['attributes']['length']?_0x2656fa['attributes']:_0x4d0734[_0xe6ca('0x31')];if(!_0x2a7df0['query'][_0xe6ca('0x37')]('nolimit')){_0x2656fa[_0xe6ca('0x1f')]=qs['limit'](_0x2a7df0[_0xe6ca('0x32')]['limit']);_0x2656fa[_0xe6ca('0x1e')]=qs[_0xe6ca('0x1e')](_0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x1e')]);}_0x2656fa[_0xe6ca('0x38')]=qs[_0xe6ca('0x39')](_0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x39')]);delete _0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x39')];_0x2656fa[_0xe6ca('0x3a')]=qs['filters'](_[_0xe6ca('0x3b')](_0x2a7df0[_0xe6ca('0x32')],_0x4d0734[_0xe6ca('0x3c')]),_0x4b1ff5);if(_0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x3d')]){_0x2656fa[_0xe6ca('0x3a')]=_[_0xe6ca('0x3e')](_0x2656fa[_0xe6ca('0x3a')],{'$or':_[_0xe6ca('0x2b')](_0x4b1ff5,function(_0x31c6db){if(_0x31c6db[_0xe6ca('0x2f')]!==_0xe6ca('0x3f')){var _0x250ab6={};_0x250ab6[_0x31c6db[_0xe6ca('0x28')]]={'$like':'%'+_0x2a7df0['query'][_0xe6ca('0x3d')]+'%'};return _0x250ab6;}})});}_0x2656fa=_[_0xe6ca('0x3e')]({},_0x2656fa,_0x2a7df0['options']);var _0x2ec50e={'where':_0x2656fa['where']};return db['VoiceMusicOnHold'][_0xe6ca('0x40')](_0x2ec50e)[_0xe6ca('0x25')](function(_0x1a03fd){_0x5a144d[_0xe6ca('0x40')]=_0x1a03fd;if(_0x2a7df0[_0xe6ca('0x32')][_0xe6ca('0x41')]){_0x2656fa[_0xe6ca('0x42')]=[{'all':!![]}];}return db[_0xe6ca('0x2c')][_0xe6ca('0x43')](_0x2656fa);})[_0xe6ca('0x25')](function(_0xb4c37b){_0x5a144d['rows']=_0xb4c37b;return _0x5a144d;})['then'](respondWithFilteredResult(_0x560221,_0x2656fa))[_0xe6ca('0x44')](handleError(_0x560221,null));};exports['show']=function(_0x2b9b35,_0x3f8462){var _0x3b9b00={'raw':![],'where':{'id':_0x2b9b35[_0xe6ca('0x45')]['id']}},_0x2fd164={};_0x2fd164['model']=_[_0xe6ca('0x33')](db['VoiceMusicOnHold'][_0xe6ca('0x2d')]);_0x2fd164[_0xe6ca('0x32')]=_['keys'](_0x2b9b35[_0xe6ca('0x32')]);_0x2fd164['filters']=_['intersection'](_0x2fd164['model'],_0x2fd164[_0xe6ca('0x32')]);_0x3b9b00[_0xe6ca('0x35')]=_['intersection'](_0x2fd164[_0xe6ca('0x31')],qs[_0xe6ca('0x36')](_0x2b9b35['query'][_0xe6ca('0x36')]));_0x3b9b00[_0xe6ca('0x35')]=_0x3b9b00['attributes']['length']?_0x3b9b00[_0xe6ca('0x35')]:_0x2fd164[_0xe6ca('0x31')];if(_0x2b9b35[_0xe6ca('0x32')][_0xe6ca('0x41')]){_0x3b9b00['include']=[{'all':!![]}];}_0x3b9b00=_['merge']({},_0x3b9b00,_0x2b9b35['options']);return db[_0xe6ca('0x2c')]['find'](_0x3b9b00)['then'](handleEntityNotFound(_0x3f8462,null))[_0xe6ca('0x25')](respondWithResult(_0x3f8462,null))['catch'](handleError(_0x3f8462,null));};exports[_0xe6ca('0x23')]=function(_0x1b901f,_0x452b90){if(_0x1b901f['body']['id']){delete _0x1b901f[_0xe6ca('0x46')]['id'];}return db[_0xe6ca('0x2c')][_0xe6ca('0x47')]({'where':{'id':_0x1b901f[_0xe6ca('0x45')]['id']}})[_0xe6ca('0x25')](handleEntityNotFound(_0x452b90,null))[_0xe6ca('0x25')](saveUpdates(_0x1b901f[_0xe6ca('0x46')],null))['then'](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports[_0xe6ca('0x48')]=function(_0x28b4f8,_0x282069,_0x50c61a){return db[_0xe6ca('0x49')]['transaction'](function(_0x14b9aa){if(_0x28b4f8[_0xe6ca('0x46')][_0xe6ca('0x4a')]===_0xe6ca('0x4b')){_0x28b4f8[_0xe6ca('0x46')][_0xe6ca('0x4c')]=path[_0xe6ca('0x4d')](config[_0xe6ca('0x4e')],_0xe6ca('0x4f'),_0x28b4f8['body'][_0xe6ca('0x28')]);}return db[_0xe6ca('0x2c')]['create'](_0x28b4f8[_0xe6ca('0x46')],{'transaction':_0x14b9aa})[_0xe6ca('0x25')](function(_0x227220){if(_0x28b4f8[_0xe6ca('0x46')][_0xe6ca('0x4a')]===_0xe6ca('0x4b')){fs[_0xe6ca('0x50')](_0x227220['directory'],parseInt(_0xe6ca('0x51'),0x8));}var _0x1a1261=_0x28b4f8[_0xe6ca('0x52')]['get']({'plain':!![]});if(!_0x1a1261)throw new Error(_0xe6ca('0x53'));if(_0x1a1261[_0xe6ca('0x54')]===_0xe6ca('0x52')){var _0xd82f3d=_0x227220[_0xe6ca('0x26')]({'plain':!![]});return db[_0xe6ca('0x55')][_0xe6ca('0x47')]({'where':{'name':_0xe6ca('0x56'),'userProfileId':_0x1a1261[_0xe6ca('0x57')]},'raw':!![]})[_0xe6ca('0x25')](function(_0x5253f4){if(_0x5253f4&&_0x5253f4['autoAssociation']===0x0){return db['UserProfileResource'][_0xe6ca('0x48')]({'name':_0xd82f3d[_0xe6ca('0x28')],'resourceId':_0xd82f3d['id'],'type':_0x5253f4['name'],'sectionId':_0x5253f4['id']},{})[_0xe6ca('0x25')](function(){return _0x227220;});}else{return _0x227220;}})[_0xe6ca('0x44')](function(_0x4c785a){logger[_0xe6ca('0x58')](_0xe6ca('0x59'),_0x4c785a);});}return _0x227220;});})[_0xe6ca('0x25')](respondWithResult(_0x282069,0xc9))[_0xe6ca('0x44')](handleError(_0x282069,null));};exports[_0xe6ca('0x24')]=function(_0x3cf4ef,_0x5a4178,_0x17d271){var _0x2e44c9;return db[_0xe6ca('0x2c')][_0xe6ca('0x47')]({'where':{'id':_0x3cf4ef[_0xe6ca('0x45')]['id']}})[_0xe6ca('0x25')](function(_0x38c798){if(_0x38c798){return db[_0xe6ca('0x49')][_0xe6ca('0x5a')](function(_0x519ebf){return _0x38c798['destroy']({'transaction':_0x519ebf,'raw':!![]})[_0xe6ca('0x25')](function(_0x2c0139){if(_0x2c0139[_0xe6ca('0x4c')]){fs[_0xe6ca('0x5b')](_0x2c0139[_0xe6ca('0x4c')])[_0xe6ca('0x5c')](function(_0x3c84f){fs[_0xe6ca('0x5d')](path[_0xe6ca('0x4d')](_0x2c0139[_0xe6ca('0x4c')],_0x3c84f));});fs[_0xe6ca('0x5e')](_0x2c0139['directory']);}return _0x2c0139;});})[_0xe6ca('0x44')](function(_0x3dc949){throw new db[(_0xe6ca('0x5f'))][(_0xe6ca('0x60'))](_0x3dc949[_0xe6ca('0x61')]);});}})['then'](handleEntityNotFound(_0x5a4178,null))[_0xe6ca('0x25')](removeEntity(_0x5a4178,null))[_0xe6ca('0x44')](handleError(_0x5a4178,null));};exports[_0xe6ca('0x62')]=function(_0x1a1baf,_0x29833e,_0x37eace){return db[_0xe6ca('0x49')][_0xe6ca('0x5a')](function(_0xfcef5b){var _0x584446;return db[_0xe6ca('0x2c')]['find']({'where':{'id':_0x1a1baf['params']['id']}})['then'](function(_0x4fa946){if(_0x4fa946){_0x584446=_0x4fa946;return _0x4fa946['addSound'](_0x1a1baf[_0xe6ca('0x46')]['id'],{'transaction':_0xfcef5b});}})[_0xe6ca('0x25')](function(_0x24e295){if(_0x24e295){return db[_0xe6ca('0x63')][_0xe6ca('0x64')]({'where':{'id':_0x1a1baf['body']['id']},'attributes':['id',_0xe6ca('0x28'),'save_name',_0xe6ca('0x65'),_0xe6ca('0x66')],'raw':!![]});}})[_0xe6ca('0x25')](function(_0x1565c8){if(_0x1565c8){var _0x54d6df=path[_0xe6ca('0x4d')](config[_0xe6ca('0x4e')],'server/files/sounds/converted',util[_0xe6ca('0x67')](_0xe6ca('0x68'),path[_0xe6ca('0x69')](_0x1565c8[_0xe6ca('0x6a')],path[_0xe6ca('0x6b')](_0x1565c8[_0xe6ca('0x6a')])),_0x1565c8['converted_format']));var _0xc0eb8a=path[_0xe6ca('0x4d')](config[_0xe6ca('0x4e')],_0xe6ca('0x4f'),_0x584446['name'],util[_0xe6ca('0x67')](_0xe6ca('0x68'),_0x1565c8['name'],_0x1565c8[_0xe6ca('0x65')]));fs[_0xe6ca('0x6c')](_0x54d6df,_0xc0eb8a);return _0x1565c8;}})[_0xe6ca('0x44')](function(_0x49e67c){throw new db[(_0xe6ca('0x5f'))][(_0xe6ca('0x60'))](_0x49e67c[_0xe6ca('0x61')]);});})[_0xe6ca('0x25')](handleEntityNotFound(_0x29833e,null))['then'](respondWithResult(_0x29833e,0xc9))[_0xe6ca('0x44')](handleError(_0x29833e,null));};exports['removeSound']=function(_0x307e9c,_0x18f723,_0x19484f){return db[_0xe6ca('0x49')][_0xe6ca('0x5a')](function(_0x2f7c17){var _0x4ce4f6;return db[_0xe6ca('0x2c')][_0xe6ca('0x64')]({'where':{'id':_0x307e9c[_0xe6ca('0x45')]['id']}})[_0xe6ca('0x25')](handleEntityNotFound(_0x18f723,null))[_0xe6ca('0x25')](function(_0x3c8e5d){if(_0x3c8e5d){_0x4ce4f6=_0x3c8e5d;return _0x3c8e5d[_0xe6ca('0x6d')](_0x307e9c[_0xe6ca('0x45')][_0xe6ca('0x6e')]);}})[_0xe6ca('0x25')](function(_0x4b2276){if(_0x4b2276){return db[_0xe6ca('0x63')][_0xe6ca('0x64')]({'where':{'id':_0x307e9c[_0xe6ca('0x45')][_0xe6ca('0x6e')]},'attributes':['id',_0xe6ca('0x28'),_0xe6ca('0x6a'),_0xe6ca('0x65'),'createdAt'],'raw':!![]});}})[_0xe6ca('0x25')](function(_0x41751a){if(_0x41751a){fs[_0xe6ca('0x5d')](path[_0xe6ca('0x4d')](_0x4ce4f6[_0xe6ca('0x4c')],util[_0xe6ca('0x67')](_0xe6ca('0x68'),_0x41751a[_0xe6ca('0x28')],_0x41751a['converted_format'])));return _0x41751a;}})[_0xe6ca('0x44')](function(_0x2977ac){throw new db[(_0xe6ca('0x5f'))][(_0xe6ca('0x60'))](_0x2977ac[_0xe6ca('0x61')]);});})[_0xe6ca('0x25')](handleEntityNotFound(_0x18f723,null))[_0xe6ca('0x25')](respondWithStatusCode(_0x18f723,0xcc))[_0xe6ca('0x44')](handleError(_0x18f723,null));};exports[_0xe6ca('0x6f')]=function(_0x4271b1,_0x801919,_0x56dc8f){var _0x5e38b1={};var _0x1965b6={};var _0x131b3f;var _0xb22dec;return db[_0xe6ca('0x2c')][_0xe6ca('0x64')]({'where':{'id':_0x4271b1[_0xe6ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x801919,null))[_0xe6ca('0x25')](function(_0x7d6a60){if(_0x7d6a60){_0x131b3f=_0x7d6a60;_0x1965b6['model']=_['keys'](db[_0xe6ca('0x63')][_0xe6ca('0x2d')]);_0x1965b6['query']=_['keys'](_0x4271b1[_0xe6ca('0x32')]);_0x1965b6[_0xe6ca('0x3c')]=_[_0xe6ca('0x34')](_0x1965b6[_0xe6ca('0x31')],_0x1965b6[_0xe6ca('0x32')]);_0x5e38b1[_0xe6ca('0x35')]=_[_0xe6ca('0x34')](_0x1965b6[_0xe6ca('0x31')],qs[_0xe6ca('0x36')](_0x4271b1[_0xe6ca('0x32')]['fields']));_0x5e38b1[_0xe6ca('0x35')]=_0x5e38b1[_0xe6ca('0x35')][_0xe6ca('0x70')]?_0x5e38b1[_0xe6ca('0x35')]:_0x1965b6[_0xe6ca('0x31')];_0x5e38b1['order']=qs[_0xe6ca('0x39')](_0x4271b1['query'][_0xe6ca('0x39')]);_0x5e38b1['where']=qs[_0xe6ca('0x3c')](_['pick'](_0x4271b1['query'],_0x1965b6[_0xe6ca('0x3c')]));if(_0x4271b1[_0xe6ca('0x32')]['filter']){_0x5e38b1[_0xe6ca('0x3a')]=_[_0xe6ca('0x3e')](_0x5e38b1['where'],{'$or':_['map'](_0x5e38b1['attributes'],function(_0x227dee){var _0x27fa03={};_0x27fa03[_0x227dee]={'$like':'%'+_0x4271b1[_0xe6ca('0x32')][_0xe6ca('0x3d')]+'%'};return _0x27fa03;})});}_0x5e38b1=_[_0xe6ca('0x3e')]({},_0x5e38b1,_0x4271b1[_0xe6ca('0x71')]);return _0x131b3f['getSounds'](_0x5e38b1);}})[_0xe6ca('0x25')](function(_0x2381f5){if(_0x2381f5){_0xb22dec=_0x2381f5[_0xe6ca('0x70')];if(!_0x4271b1['query']['hasOwnProperty'](_0xe6ca('0x72'))){_0x5e38b1[_0xe6ca('0x1f')]=qs[_0xe6ca('0x1f')](_0x4271b1[_0xe6ca('0x32')][_0xe6ca('0x1f')]);_0x5e38b1[_0xe6ca('0x1e')]=qs['offset'](_0x4271b1[_0xe6ca('0x32')][_0xe6ca('0x1e')]);}return _0x131b3f[_0xe6ca('0x6f')](_0x5e38b1);}})[_0xe6ca('0x25')](function(_0x19f590){if(_0x19f590){return _0x19f590?{'count':_0xb22dec,'rows':_0x19f590}:null;}})[_0xe6ca('0x25')](respondWithResult(_0x801919,null))[_0xe6ca('0x44')](handleError(_0x801919,null));}; \ No newline at end of file +var _0x1d29=['createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','id2','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','VoiceMusicOnHold','findAll','rows','catch','show','params','includeAll','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MusicOnHolds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','Sequelize','ValidationError','message','Sound','findOne','save_name','converted_format'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1d29,0x14b));var _0x91d2=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0x1d29[_0x39b51c];return _0x146312;};'use strict';var emlformat=require(_0x91d2('0x0'));var rimraf=require(_0x91d2('0x1'));var zipdir=require(_0x91d2('0x2'));var jsonpatch=require(_0x91d2('0x3'));var rp=require(_0x91d2('0x4'));var moment=require(_0x91d2('0x5'));var BPromise=require(_0x91d2('0x6'));var Mustache=require(_0x91d2('0x7'));var util=require(_0x91d2('0x8'));var path=require(_0x91d2('0x9'));var sox=require(_0x91d2('0xa'));var csv=require(_0x91d2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91d2('0xc'));var jsforce=require(_0x91d2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x91d2('0xe'));var Papa=require(_0x91d2('0xf'));var Redis=require(_0x91d2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x91d2('0x11'));var hardwareService=require(_0x91d2('0x12'));var logger=require(_0x91d2('0x13'))(_0x91d2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x91d2('0x15'));var db=require(_0x91d2('0x16'))['db'];function respondWithStatusCode(_0x5a8ce4,_0x4264e3){_0x4264e3=_0x4264e3||0xcc;return function(_0x4b4755){if(_0x4b4755){return _0x5a8ce4['sendStatus'](_0x4264e3);}return _0x5a8ce4[_0x91d2('0x17')](_0x4264e3)['end']();};}function respondWithResult(_0x4686c9,_0x212da8){_0x212da8=_0x212da8||0xc8;return function(_0x2d8468){if(_0x2d8468){return _0x4686c9[_0x91d2('0x17')](_0x212da8)[_0x91d2('0x18')](_0x2d8468);}};}function respondWithFilteredResult(_0x2244db,_0x30fe26){return function(_0x7beca1){if(_0x7beca1){var _0x2388b4=typeof _0x30fe26[_0x91d2('0x19')]==='undefined'&&typeof _0x30fe26['limit']===_0x91d2('0x1a');var _0x1f35bc=_0x7beca1[_0x91d2('0x1b')];var _0x2fc6f7=_0x2388b4?0x0:_0x30fe26['offset'];var _0xf733fa=_0x2388b4?_0x7beca1['count']:_0x30fe26[_0x91d2('0x19')]+_0x30fe26[_0x91d2('0x1c')];var _0x402aed;if(_0xf733fa>=_0x1f35bc){_0xf733fa=_0x1f35bc;_0x402aed=0xc8;}else{_0x402aed=0xce;}_0x2244db['status'](_0x402aed);return _0x2244db[_0x91d2('0x1d')](_0x91d2('0x1e'),_0x2fc6f7+'-'+_0xf733fa+'/'+_0x1f35bc)['json'](_0x7beca1);}return null;};}function patchUpdates(_0x497747){return function(_0x51be7d){try{jsonpatch['apply'](_0x51be7d,_0x497747,!![]);}catch(_0x309168){return BPromise[_0x91d2('0x1f')](_0x309168);}return _0x51be7d['save']();};}function saveUpdates(_0x43ef30,_0x33cb53){return function(_0x37851a){if(_0x37851a){return _0x37851a['update'](_0x43ef30)[_0x91d2('0x20')](function(_0x49b7e){return _0x49b7e;});}return null;};}function removeEntity(_0x558546,_0x4e7708){return function(_0x2fe4f1){if(_0x2fe4f1){return _0x2fe4f1[_0x91d2('0x21')]()[_0x91d2('0x20')](function(){var _0x1c76b5=_0x2fe4f1[_0x91d2('0x22')]({'plain':!![]});var _0x338dd8='MusicOnHolds';return db[_0x91d2('0x23')][_0x91d2('0x21')]({'where':{'type':_0x338dd8,'resourceId':_0x1c76b5['id']}})[_0x91d2('0x20')](function(){return _0x2fe4f1;});})[_0x91d2('0x20')](function(){_0x558546['status'](0xcc)[_0x91d2('0x24')]();});}};}function handleEntityNotFound(_0x4e8dd7,_0x4fbf5c){return function(_0x5d72be){if(!_0x5d72be){_0x4e8dd7[_0x91d2('0x25')](0x194);}return _0x5d72be;};}function handleError(_0x20efc6,_0xfbd4c2){_0xfbd4c2=_0xfbd4c2||0x1f4;return function(_0x37fc0f){logger[_0x91d2('0x26')](_0x37fc0f[_0x91d2('0x27')]);if(_0x37fc0f[_0x91d2('0x28')]){delete _0x37fc0f['name'];}_0x20efc6[_0x91d2('0x17')](_0xfbd4c2)[_0x91d2('0x29')](_0x37fc0f);};}exports[_0x91d2('0x2a')]=function(_0x2b3a42,_0xe77a84){var _0x4dde5f={},_0x1dd93e={},_0x31d14f={'count':0x0,'rows':[]};var _0x51007a=_[_0x91d2('0x2b')](db['VoiceMusicOnHold'][_0x91d2('0x2c')],function(_0x50387c){return{'name':_0x50387c['fieldName'],'type':_0x50387c[_0x91d2('0x2d')][_0x91d2('0x2e')]};});_0x1dd93e[_0x91d2('0x2f')]=_[_0x91d2('0x2b')](_0x51007a,_0x91d2('0x28'));_0x1dd93e[_0x91d2('0x30')]=_[_0x91d2('0x31')](_0x2b3a42[_0x91d2('0x30')]);_0x1dd93e[_0x91d2('0x32')]=_['intersection'](_0x1dd93e[_0x91d2('0x2f')],_0x1dd93e[_0x91d2('0x30')]);_0x4dde5f['attributes']=_[_0x91d2('0x33')](_0x1dd93e['model'],qs[_0x91d2('0x34')](_0x2b3a42[_0x91d2('0x30')]['fields']));_0x4dde5f[_0x91d2('0x35')]=_0x4dde5f['attributes'][_0x91d2('0x36')]?_0x4dde5f['attributes']:_0x1dd93e[_0x91d2('0x2f')];if(!_0x2b3a42[_0x91d2('0x30')][_0x91d2('0x37')](_0x91d2('0x38'))){_0x4dde5f['limit']=qs[_0x91d2('0x1c')](_0x2b3a42[_0x91d2('0x30')][_0x91d2('0x1c')]);_0x4dde5f[_0x91d2('0x19')]=qs[_0x91d2('0x19')](_0x2b3a42[_0x91d2('0x30')][_0x91d2('0x19')]);}_0x4dde5f[_0x91d2('0x39')]=qs[_0x91d2('0x3a')](_0x2b3a42[_0x91d2('0x30')][_0x91d2('0x3a')]);delete _0x2b3a42[_0x91d2('0x30')]['sort'];_0x4dde5f[_0x91d2('0x3b')]=qs[_0x91d2('0x32')](_['pick'](_0x2b3a42[_0x91d2('0x30')],_0x1dd93e[_0x91d2('0x32')]),_0x51007a);if(_0x2b3a42[_0x91d2('0x30')][_0x91d2('0x3c')]){_0x4dde5f[_0x91d2('0x3b')]=_['merge'](_0x4dde5f[_0x91d2('0x3b')],{'$or':_[_0x91d2('0x2b')](_0x51007a,function(_0x5c1a97){if(_0x5c1a97[_0x91d2('0x2d')]!=='VIRTUAL'){var _0x1561a2={};_0x1561a2[_0x5c1a97[_0x91d2('0x28')]]={'$like':'%'+_0x2b3a42['query']['filter']+'%'};return _0x1561a2;}})});}_0x4dde5f=_[_0x91d2('0x3d')]({},_0x4dde5f,_0x2b3a42[_0x91d2('0x3e')]);var _0x159e4b={'where':_0x4dde5f[_0x91d2('0x3b')]};return db['VoiceMusicOnHold'][_0x91d2('0x1b')](_0x159e4b)['then'](function(_0x21f20c){_0x31d14f[_0x91d2('0x1b')]=_0x21f20c;if(_0x2b3a42[_0x91d2('0x30')]['includeAll']){_0x4dde5f[_0x91d2('0x3f')]=[{'all':!![]}];}return db[_0x91d2('0x40')][_0x91d2('0x41')](_0x4dde5f);})[_0x91d2('0x20')](function(_0xf22de4){_0x31d14f[_0x91d2('0x42')]=_0xf22de4;return _0x31d14f;})[_0x91d2('0x20')](respondWithFilteredResult(_0xe77a84,_0x4dde5f))[_0x91d2('0x43')](handleError(_0xe77a84,null));};exports[_0x91d2('0x44')]=function(_0x52a0c8,_0x2dd45e){var _0xcbb74={'raw':![],'where':{'id':_0x52a0c8[_0x91d2('0x45')]['id']}},_0x4d8420={};_0x4d8420[_0x91d2('0x2f')]=_[_0x91d2('0x31')](db[_0x91d2('0x40')]['rawAttributes']);_0x4d8420[_0x91d2('0x30')]=_[_0x91d2('0x31')](_0x52a0c8[_0x91d2('0x30')]);_0x4d8420[_0x91d2('0x32')]=_['intersection'](_0x4d8420[_0x91d2('0x2f')],_0x4d8420[_0x91d2('0x30')]);_0xcbb74[_0x91d2('0x35')]=_[_0x91d2('0x33')](_0x4d8420[_0x91d2('0x2f')],qs[_0x91d2('0x34')](_0x52a0c8[_0x91d2('0x30')][_0x91d2('0x34')]));_0xcbb74[_0x91d2('0x35')]=_0xcbb74[_0x91d2('0x35')][_0x91d2('0x36')]?_0xcbb74[_0x91d2('0x35')]:_0x4d8420[_0x91d2('0x2f')];if(_0x52a0c8['query'][_0x91d2('0x46')]){_0xcbb74[_0x91d2('0x3f')]=[{'all':!![]}];}_0xcbb74=_[_0x91d2('0x3d')]({},_0xcbb74,_0x52a0c8[_0x91d2('0x3e')]);return db[_0x91d2('0x40')][_0x91d2('0x47')](_0xcbb74)[_0x91d2('0x20')](handleEntityNotFound(_0x2dd45e,null))[_0x91d2('0x20')](respondWithResult(_0x2dd45e,null))[_0x91d2('0x43')](handleError(_0x2dd45e,null));};exports['update']=function(_0x3e7095,_0x3fa3c9){if(_0x3e7095['body']['id']){delete _0x3e7095['body']['id'];}return db['VoiceMusicOnHold'][_0x91d2('0x47')]({'where':{'id':_0x3e7095[_0x91d2('0x45')]['id']}})[_0x91d2('0x20')](handleEntityNotFound(_0x3fa3c9,null))[_0x91d2('0x20')](saveUpdates(_0x3e7095[_0x91d2('0x48')],null))['then'](respondWithResult(_0x3fa3c9,null))[_0x91d2('0x43')](handleError(_0x3fa3c9,null));};exports[_0x91d2('0x49')]=function(_0x2ea1bf,_0x84b08,_0x4841ed){return db['sequelize'][_0x91d2('0x4a')](function(_0x522adb){if(_0x2ea1bf[_0x91d2('0x48')][_0x91d2('0x4b')]===_0x91d2('0x4c')){_0x2ea1bf['body'][_0x91d2('0x4d')]=path[_0x91d2('0x4e')](config[_0x91d2('0x4f')],_0x91d2('0x50'),_0x2ea1bf['body']['name']);}return db[_0x91d2('0x40')][_0x91d2('0x49')](_0x2ea1bf['body'],{'transaction':_0x522adb})['then'](function(_0x459112){if(_0x2ea1bf[_0x91d2('0x48')][_0x91d2('0x4b')]===_0x91d2('0x4c')){fs['mkdirSync'](_0x459112[_0x91d2('0x4d')],parseInt(_0x91d2('0x51'),0x8));}var _0x3d52b0=_0x2ea1bf['user'][_0x91d2('0x22')]({'plain':!![]});if(!_0x3d52b0)throw new Error(_0x91d2('0x52'));if(_0x3d52b0[_0x91d2('0x53')]===_0x91d2('0x54')){var _0x18c852=_0x459112['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x91d2('0x55'),'userProfileId':_0x3d52b0['userProfileId']},'raw':!![]})[_0x91d2('0x20')](function(_0xe0fb0b){if(_0xe0fb0b&&_0xe0fb0b['autoAssociation']===0x0){return db[_0x91d2('0x23')][_0x91d2('0x49')]({'name':_0x18c852[_0x91d2('0x28')],'resourceId':_0x18c852['id'],'type':_0xe0fb0b[_0x91d2('0x28')],'sectionId':_0xe0fb0b['id']},{})[_0x91d2('0x20')](function(){return _0x459112;});}else{return _0x459112;}})[_0x91d2('0x43')](function(_0x1e764c){logger['error'](_0x91d2('0x56'),_0x1e764c);});}return _0x459112;});})[_0x91d2('0x20')](respondWithResult(_0x84b08,0xc9))[_0x91d2('0x43')](handleError(_0x84b08,null));};exports[_0x91d2('0x21')]=function(_0x361708,_0x1be4fe,_0x1270cd){var _0x1cd153;return db[_0x91d2('0x40')][_0x91d2('0x47')]({'where':{'id':_0x361708[_0x91d2('0x45')]['id']}})[_0x91d2('0x20')](function(_0x3d0a61){if(_0x3d0a61){return db[_0x91d2('0x57')]['transaction'](function(_0xb087cb){return _0x3d0a61['destroy']({'transaction':_0xb087cb,'raw':!![]})[_0x91d2('0x20')](function(_0x1fad4f){if(_0x1fad4f[_0x91d2('0x4d')]){fs[_0x91d2('0x58')](_0x1fad4f[_0x91d2('0x4d')])['forEach'](function(_0x2feec2){fs[_0x91d2('0x59')](path[_0x91d2('0x4e')](_0x1fad4f[_0x91d2('0x4d')],_0x2feec2));});fs['rmdirSync'](_0x1fad4f['directory']);}return _0x1fad4f;});})[_0x91d2('0x43')](function(_0x27e6a5){throw new db[(_0x91d2('0x5a'))][(_0x91d2('0x5b'))](_0x27e6a5[_0x91d2('0x5c')]);});}})[_0x91d2('0x20')](handleEntityNotFound(_0x1be4fe,null))['then'](removeEntity(_0x1be4fe,null))[_0x91d2('0x43')](handleError(_0x1be4fe,null));};exports['addSound']=function(_0x24dc39,_0x4c2b01,_0x212e18){return db[_0x91d2('0x57')][_0x91d2('0x4a')](function(_0x2d13e3){var _0x4ef6cf;return db[_0x91d2('0x40')][_0x91d2('0x47')]({'where':{'id':_0x24dc39[_0x91d2('0x45')]['id']}})[_0x91d2('0x20')](function(_0x6adb58){if(_0x6adb58){_0x4ef6cf=_0x6adb58;return _0x6adb58['addSound'](_0x24dc39[_0x91d2('0x48')]['id'],{'transaction':_0x2d13e3});}})[_0x91d2('0x20')](function(_0x219ed4){if(_0x219ed4){return db[_0x91d2('0x5d')][_0x91d2('0x5e')]({'where':{'id':_0x24dc39[_0x91d2('0x48')]['id']},'attributes':['id','name',_0x91d2('0x5f'),_0x91d2('0x60'),_0x91d2('0x61')],'raw':!![]});}})[_0x91d2('0x20')](function(_0x3ff4d1){if(_0x3ff4d1){var _0x181dc6=path[_0x91d2('0x4e')](config[_0x91d2('0x4f')],_0x91d2('0x62'),util[_0x91d2('0x63')](_0x91d2('0x64'),path[_0x91d2('0x65')](_0x3ff4d1[_0x91d2('0x5f')],path[_0x91d2('0x66')](_0x3ff4d1[_0x91d2('0x5f')])),_0x3ff4d1[_0x91d2('0x60')]));var _0x3ad0eb=path[_0x91d2('0x4e')](config[_0x91d2('0x4f')],'server/files/moh',_0x4ef6cf[_0x91d2('0x28')],util[_0x91d2('0x63')](_0x91d2('0x64'),_0x3ff4d1[_0x91d2('0x28')],_0x3ff4d1[_0x91d2('0x60')]));fs[_0x91d2('0x67')](_0x181dc6,_0x3ad0eb);return _0x3ff4d1;}})[_0x91d2('0x43')](function(_0x21d944){throw new db[(_0x91d2('0x5a'))]['ValidationError'](_0x21d944[_0x91d2('0x5c')]);});})['then'](handleEntityNotFound(_0x4c2b01,null))['then'](respondWithResult(_0x4c2b01,0xc9))[_0x91d2('0x43')](handleError(_0x4c2b01,null));};exports['removeSound']=function(_0x413945,_0x5dae9b,_0x4f07d2){return db[_0x91d2('0x57')][_0x91d2('0x4a')](function(_0x20bd4a){var _0x45eb34;return db[_0x91d2('0x40')][_0x91d2('0x5e')]({'where':{'id':_0x413945[_0x91d2('0x45')]['id']}})[_0x91d2('0x20')](handleEntityNotFound(_0x5dae9b,null))['then'](function(_0x59142e){if(_0x59142e){_0x45eb34=_0x59142e;return _0x59142e['removeSound'](_0x413945['params'][_0x91d2('0x68')]);}})[_0x91d2('0x20')](function(_0x145e58){if(_0x145e58){return db[_0x91d2('0x5d')][_0x91d2('0x5e')]({'where':{'id':_0x413945[_0x91d2('0x45')][_0x91d2('0x68')]},'attributes':['id',_0x91d2('0x28'),_0x91d2('0x5f'),_0x91d2('0x60'),'createdAt'],'raw':!![]});}})[_0x91d2('0x20')](function(_0x5c948a){if(_0x5c948a){fs[_0x91d2('0x59')](path['join'](_0x45eb34['directory'],util[_0x91d2('0x63')](_0x91d2('0x64'),_0x5c948a[_0x91d2('0x28')],_0x5c948a[_0x91d2('0x60')])));return _0x5c948a;}})[_0x91d2('0x43')](function(_0x368e00){throw new db[(_0x91d2('0x5a'))]['ValidationError'](_0x368e00['message']);});})['then'](handleEntityNotFound(_0x5dae9b,null))['then'](respondWithStatusCode(_0x5dae9b,0xcc))['catch'](handleError(_0x5dae9b,null));};exports[_0x91d2('0x69')]=function(_0x2e0996,_0x22ac5f,_0x46864d){var _0x270081={};var _0x39bbba={};var _0x2981e7;var _0x433d38;return db['VoiceMusicOnHold'][_0x91d2('0x5e')]({'where':{'id':_0x2e0996[_0x91d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x22ac5f,null))[_0x91d2('0x20')](function(_0x1f8a82){if(_0x1f8a82){_0x2981e7=_0x1f8a82;_0x39bbba['model']=_[_0x91d2('0x31')](db[_0x91d2('0x5d')][_0x91d2('0x2c')]);_0x39bbba[_0x91d2('0x30')]=_[_0x91d2('0x31')](_0x2e0996[_0x91d2('0x30')]);_0x39bbba[_0x91d2('0x32')]=_['intersection'](_0x39bbba['model'],_0x39bbba['query']);_0x270081['attributes']=_[_0x91d2('0x33')](_0x39bbba[_0x91d2('0x2f')],qs['fields'](_0x2e0996[_0x91d2('0x30')][_0x91d2('0x34')]));_0x270081[_0x91d2('0x35')]=_0x270081['attributes']['length']?_0x270081[_0x91d2('0x35')]:_0x39bbba['model'];_0x270081[_0x91d2('0x39')]=qs['sort'](_0x2e0996['query']['sort']);_0x270081[_0x91d2('0x3b')]=qs['filters'](_[_0x91d2('0x6a')](_0x2e0996[_0x91d2('0x30')],_0x39bbba[_0x91d2('0x32')]));if(_0x2e0996[_0x91d2('0x30')]['filter']){_0x270081[_0x91d2('0x3b')]=_['merge'](_0x270081[_0x91d2('0x3b')],{'$or':_['map'](_0x270081[_0x91d2('0x35')],function(_0x205c45){var _0x343e08={};_0x343e08[_0x205c45]={'$like':'%'+_0x2e0996[_0x91d2('0x30')][_0x91d2('0x3c')]+'%'};return _0x343e08;})});}_0x270081=_[_0x91d2('0x3d')]({},_0x270081,_0x2e0996[_0x91d2('0x3e')]);return _0x2981e7['getSounds'](_0x270081);}})[_0x91d2('0x20')](function(_0x48d686){if(_0x48d686){_0x433d38=_0x48d686[_0x91d2('0x36')];if(!_0x2e0996[_0x91d2('0x30')][_0x91d2('0x37')]('nolimit')){_0x270081[_0x91d2('0x1c')]=qs[_0x91d2('0x1c')](_0x2e0996[_0x91d2('0x30')][_0x91d2('0x1c')]);_0x270081[_0x91d2('0x19')]=qs[_0x91d2('0x19')](_0x2e0996[_0x91d2('0x30')][_0x91d2('0x19')]);}return _0x2981e7[_0x91d2('0x69')](_0x270081);}})[_0x91d2('0x20')](function(_0x2de2fc){if(_0x2de2fc){return _0x2de2fc?{'count':_0x433d38,'rows':_0x2de2fc}:null;}})[_0x91d2('0x20')](respondWithResult(_0x22ac5f,null))['catch'](handleError(_0x22ac5f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 470be6a..3fe9f3b 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 _0x6f05=['request-promise','rimraf','../../config/environment','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x415a34,_0xbd82e7){var _0x153083=function(_0x23f79f){while(--_0x23f79f){_0x415a34['push'](_0x415a34['shift']());}};_0x153083(++_0xbd82e7);}(_0x6f05,0x162));var _0x56f0=function(_0x585d2c,_0x367b11){_0x585d2c=_0x585d2c-0x0;var _0x5a5327=_0x6f05[_0x585d2c];return _0x5a5327;};'use strict';var _=require(_0x56f0('0x0'));var util=require(_0x56f0('0x1'));var logger=require(_0x56f0('0x2'))(_0x56f0('0x3'));var moment=require(_0x56f0('0x4'));var BPromise=require(_0x56f0('0x5'));var rp=require(_0x56f0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56f0('0x7'));var config=require(_0x56f0('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0xb61f93,_0x5bf556){return _0xb61f93[_0x56f0('0x9')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5371=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x31436c,_0x5b82b0){var _0x1f6bfe=function(_0x113f63){while(--_0x113f63){_0x31436c['push'](_0x31436c['shift']());}};_0x1f6bfe(++_0x5b82b0);}(_0x5371,0x112));var _0x1537=function(_0xa714dd,_0x832779){_0xa714dd=_0xa714dd-0x0;var _0x2f1a73=_0x5371[_0xa714dd];return _0x2f1a73;};'use strict';var _=require(_0x1537('0x0'));var util=require('util');var logger=require(_0x1537('0x1'))(_0x1537('0x2'));var moment=require(_0x1537('0x3'));var BPromise=require(_0x1537('0x4'));var rp=require(_0x1537('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1537('0x6'));var config=require(_0x1537('0x7'));var attributes=require(_0x1537('0x8'));module[_0x1537('0x9')]=function(_0x43b8eb,_0x5dcce3){return _0x43b8eb[_0x1537('0xa')](_0x1537('0xb'),attributes,{'tableName':_0x1537('0xc'),'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 7ebf266..d121550 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x168314,_0x28a88f){var _0x40c99a=function(_0x44569b){while(--_0x44569b){_0x168314['push'](_0x168314['shift']());}};_0x40c99a(++_0x28a88f);}(_0xe706,0xa3));var _0x6e70=function(_0x3b69e3,_0x40bb88){_0x3b69e3=_0x3b69e3-0x0;var _0x1f5b5e=_0xe706[_0x3b69e3];return _0x1f5b5e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b52d0,_0x3a8002){var _0x48269b=function(_0x3742b8){while(--_0x3742b8){_0x4b52d0['push'](_0x4b52d0['shift']());}};_0x48269b(++_0x3a8002);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b0fdc99..89fb2bc 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 _0xdd41=['../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','get','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','/:id','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x39c4b6,_0x394a3b){var _0x2562ba=function(_0x6c5dd){while(--_0x6c5dd){_0x39c4b6['push'](_0x39c4b6['shift']());}};_0x2562ba(++_0x394a3b);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var path=require(_0x1dd4('0x2'));var timeout=require(_0x1dd4('0x3'));var express=require('express');var router=express[_0x1dd4('0x4')]();var fs_extra=require(_0x1dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dd4('0x6'));var controller=require(_0x1dd4('0x7'));router['get']('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x9')]);router['get'](_0x1dd4('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x1dd4('0x8')](),controller['show']);router[_0x1dd4('0xb')](_0x1dd4('0xc'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0xd')]);router['get'](_0x1dd4('0xe'),auth['isAuthenticated'](),controller[_0x1dd4('0xf')]);router[_0x1dd4('0x10')]('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x11')]);router[_0x1dd4('0x10')]('/:id/users',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x12')]);router[_0x1dd4('0x10')](_0x1dd4('0xe'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x13')]);router[_0x1dd4('0x14')]('/:id',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x15')]);router[_0x1dd4('0x16')](_0x1dd4('0x17'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x18')]);router[_0x1dd4('0x16')](_0x1dd4('0xc'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x19')]);router['delete']('/:id/teams',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x1a')]);module[_0x1dd4('0x1b')]=router; \ No newline at end of file +var _0xccd7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','describe','get','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeAgents','removeTeams'];(function(_0x2f9226,_0x51ec7c){var _0x244843=function(_0x5070a0){while(--_0x5070a0){_0x2f9226['push'](_0x2f9226['shift']());}};_0x244843(++_0x51ec7c);}(_0xccd7,0x75));var _0x7ccd=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0xccd7[_0x20ebb5];return _0x487182;};'use strict';var multer=require('multer');var util=require(_0x7ccd('0x0'));var path=require(_0x7ccd('0x1'));var timeout=require(_0x7ccd('0x2'));var express=require(_0x7ccd('0x3'));var router=express[_0x7ccd('0x4')]();var fs_extra=require(_0x7ccd('0x5'));var auth=require(_0x7ccd('0x6'));var interaction=require(_0x7ccd('0x7'));var config=require('../../config/environment');var controller=require(_0x7ccd('0x8'));router['get']('/',auth[_0x7ccd('0x9')](),controller[_0x7ccd('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7ccd('0xb')]);router[_0x7ccd('0xc')](_0x7ccd('0xd'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0xe')]);router[_0x7ccd('0xc')](_0x7ccd('0xf'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x10')]);router['get'](_0x7ccd('0x11'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x12')]);router[_0x7ccd('0x13')]('/',auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x14')]);router['post'](_0x7ccd('0xf'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x15')]);router['post'](_0x7ccd('0x11'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x16')]);router[_0x7ccd('0x17')](_0x7ccd('0xd'),auth['isAuthenticated'](),controller[_0x7ccd('0x18')]);router[_0x7ccd('0x19')](_0x7ccd('0xd'),auth[_0x7ccd('0x9')](),controller['destroy']);router[_0x7ccd('0x19')](_0x7ccd('0xf'),auth[_0x7ccd('0x9')](),controller[_0x7ccd('0x1a')]);router[_0x7ccd('0x19')](_0x7ccd('0x11'),auth['isAuthenticated'](),controller[_0x7ccd('0x1b')]);module[_0x7ccd('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index abf4753..ae62fd7 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 _0x2fa2=['name','INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x1597ce,_0x3447d4){var _0x5598d2=function(_0x3cc225){while(--_0x3cc225){_0x1597ce['push'](_0x1597ce['shift']());}};_0x5598d2(++_0x3447d4);}(_0x2fa2,0xda));var _0x22fa=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x2fa2[_0x28b0a4];return _0x105ce6;};'use strict';var Sequelize=require(_0x22fa('0x0'));module[_0x22fa('0x1')]={'name':{'type':Sequelize[_0x22fa('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x22fa('0x3')],'get':function(_0x18d017){return _0x22fa('0x4')+this[_0x22fa('0x5')](_0x22fa('0x6'))+'-';}},'description':{'type':Sequelize[_0x22fa('0x2')]},'callerIdAll':{'type':Sequelize[_0x22fa('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x22fa('0x7')]}}; \ No newline at end of file +var _0x9383=['VIRTUAL','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9383,0xff));var _0x3938=function(_0x364925,_0x28169c){_0x364925=_0x364925-0x0;var _0x45dffe=_0x9383[_0x364925];return _0x45dffe;};'use strict';var Sequelize=require(_0x3938('0x0'));module[_0x3938('0x1')]={'name':{'type':Sequelize[_0x3938('0x2')],'allowNull':![],'unique':_0x3938('0x3')},'prefix':{'type':Sequelize[_0x3938('0x4')],'get':function(_0x1bd7d1){return'system-'+this[_0x3938('0x5')](_0x3938('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x3938('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x3938('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 76f44bc..f22a733 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 _0x4e2e=['from','team_has_voice_prefixes','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','findAll','rows','show','params','include','options','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','getTeams','addTeams','Team','online','interface','Agents','each','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x4625c0,_0x2e6fae){var _0x15037c=function(_0x59a6c2){while(--_0x59a6c2){_0x4625c0['push'](_0x4625c0['shift']());}};_0x15037c(++_0x2e6fae);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x124772,_0x513529){_0x124772=_0x124772-0x0;var _0xffef85=_0x4e2e[_0x124772];return _0xffef85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];config[_0xe4e2('0x1a')]=_[_0xe4e2('0x1b')](config[_0xe4e2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4e2('0x1c'))(new Redis(config[_0xe4e2('0x1a')]));require(_0xe4e2('0x1d'))[_0xe4e2('0x1e')](socket);function respondWithStatusCode(_0x202486,_0x50678d){_0x50678d=_0x50678d||0xcc;return function(_0x58e012){if(_0x58e012){return _0x202486[_0xe4e2('0x1f')](_0x50678d);}return _0x202486[_0xe4e2('0x20')](_0x50678d)[_0xe4e2('0x21')]();};}function respondWithResult(_0x28ee12,_0x217ea5){_0x217ea5=_0x217ea5||0xc8;return function(_0x54107a){if(_0x54107a){return _0x28ee12[_0xe4e2('0x20')](_0x217ea5)[_0xe4e2('0x22')](_0x54107a);}};}function respondWithFilteredResult(_0x340935,_0x4fe2f2){return function(_0x196f16){if(_0x196f16){var _0x54c80b=typeof _0x4fe2f2[_0xe4e2('0x23')]===_0xe4e2('0x24')&&typeof _0x4fe2f2[_0xe4e2('0x25')]===_0xe4e2('0x24');var _0x3dfbdf=_0x196f16[_0xe4e2('0x26')];var _0x339d00=_0x54c80b?0x0:_0x4fe2f2[_0xe4e2('0x23')];var _0x4769dd=_0x54c80b?_0x196f16[_0xe4e2('0x26')]:_0x4fe2f2['offset']+_0x4fe2f2[_0xe4e2('0x25')];var _0x2e7ecd;if(_0x4769dd>=_0x3dfbdf){_0x4769dd=_0x3dfbdf;_0x2e7ecd=0xc8;}else{_0x2e7ecd=0xce;}_0x340935[_0xe4e2('0x20')](_0x2e7ecd);return _0x340935[_0xe4e2('0x27')](_0xe4e2('0x28'),_0x339d00+'-'+_0x4769dd+'/'+_0x3dfbdf)[_0xe4e2('0x22')](_0x196f16);}return null;};}function patchUpdates(_0x16f14b){return function(_0x51c67e){try{jsonpatch[_0xe4e2('0x29')](_0x51c67e,_0x16f14b,!![]);}catch(_0x2ab435){return BPromise[_0xe4e2('0x2a')](_0x2ab435);}return _0x51c67e['save']();};}function saveUpdates(_0x353030,_0x12ad33){return function(_0x598fa3){if(_0x598fa3){return _0x598fa3[_0xe4e2('0x2b')](_0x353030)[_0xe4e2('0x2c')](function(_0x29143c){return _0x29143c;});}return null;};}function removeEntity(_0x3f5265,_0x249b7e){return function(_0x5887c9){if(_0x5887c9){return _0x5887c9[_0xe4e2('0x2d')]()[_0xe4e2('0x2c')](function(){var _0x1f6d1f=_0x5887c9['get']({'plain':!![]});var _0x3a31b8=_0xe4e2('0x2e');return db[_0xe4e2('0x2f')]['destroy']({'where':{'type':_0x3a31b8,'resourceId':_0x1f6d1f['id']}})[_0xe4e2('0x2c')](function(){return _0x5887c9;});})['then'](function(){_0x3f5265[_0xe4e2('0x20')](0xcc)[_0xe4e2('0x21')]();});}};}function handleEntityNotFound(_0x52c849,_0x46926a){return function(_0x18e2e5){if(!_0x18e2e5){_0x52c849[_0xe4e2('0x1f')](0x194);}return _0x18e2e5;};}function handleError(_0x41500b,_0x1f7bcc){_0x1f7bcc=_0x1f7bcc||0x1f4;return function(_0x4d33de){logger['error'](_0x4d33de[_0xe4e2('0x30')]);if(_0x4d33de[_0xe4e2('0x31')]){delete _0x4d33de[_0xe4e2('0x31')];}_0x41500b[_0xe4e2('0x20')](_0x1f7bcc)[_0xe4e2('0x32')](_0x4d33de);};}exports[_0xe4e2('0x33')]=function(_0x1c7f9a,_0x40569e){var _0x37dec8={},_0x59eb={},_0x1c87b0={'count':0x0,'rows':[]};var _0x3fb693=_['map'](db[_0xe4e2('0x34')][_0xe4e2('0x35')],function(_0xe0846a){return{'name':_0xe0846a[_0xe4e2('0x36')],'type':_0xe0846a[_0xe4e2('0x37')][_0xe4e2('0x38')]};});_0x59eb['model']=_[_0xe4e2('0x39')](_0x3fb693,_0xe4e2('0x31'));_0x59eb[_0xe4e2('0x3a')]=_[_0xe4e2('0x3b')](_0x1c7f9a[_0xe4e2('0x3a')]);_0x59eb[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x59eb[_0xe4e2('0x3e')],_0x59eb[_0xe4e2('0x3a')]);_0x37dec8[_0xe4e2('0x3f')]=_[_0xe4e2('0x3d')](_0x59eb['model'],qs[_0xe4e2('0x40')](_0x1c7f9a['query'][_0xe4e2('0x40')]));_0x37dec8[_0xe4e2('0x3f')]=_0x37dec8['attributes'][_0xe4e2('0x41')]?_0x37dec8[_0xe4e2('0x3f')]:_0x59eb[_0xe4e2('0x3e')];if(!_0x1c7f9a[_0xe4e2('0x3a')]['hasOwnProperty'](_0xe4e2('0x42'))){_0x37dec8['limit']=qs[_0xe4e2('0x25')](_0x1c7f9a['query'][_0xe4e2('0x25')]);_0x37dec8[_0xe4e2('0x23')]=qs[_0xe4e2('0x23')](_0x1c7f9a['query'][_0xe4e2('0x23')]);}_0x37dec8[_0xe4e2('0x43')]=qs['sort'](_0x1c7f9a[_0xe4e2('0x3a')][_0xe4e2('0x44')]);_0x37dec8[_0xe4e2('0x45')]=qs[_0xe4e2('0x3c')](_[_0xe4e2('0x46')](_0x1c7f9a[_0xe4e2('0x3a')],_0x59eb[_0xe4e2('0x3c')]),_0x3fb693);if(_0x1c7f9a[_0xe4e2('0x3a')][_0xe4e2('0x47')]){_0x37dec8['where']=_['merge'](_0x37dec8[_0xe4e2('0x45')],{'$or':_[_0xe4e2('0x39')](_0x3fb693,function(_0x5d05a4){if(_0x5d05a4[_0xe4e2('0x37')]!=='VIRTUAL'){var _0x4d8a2d={};_0x4d8a2d[_0x5d05a4[_0xe4e2('0x31')]]={'$like':'%'+_0x1c7f9a[_0xe4e2('0x3a')][_0xe4e2('0x47')]+'%'};return _0x4d8a2d;}})});}_0x37dec8=_[_0xe4e2('0x48')]({},_0x37dec8,_0x1c7f9a['options']);var _0x45e88c={'where':_0x37dec8[_0xe4e2('0x45')]};return db[_0xe4e2('0x34')]['count'](_0x45e88c)[_0xe4e2('0x2c')](function(_0x4789cf){_0x1c87b0[_0xe4e2('0x26')]=_0x4789cf;if(_0x1c7f9a[_0xe4e2('0x3a')]['includeAll']){_0x37dec8['include']=[{'all':!![]}];}return db[_0xe4e2('0x34')][_0xe4e2('0x49')](_0x37dec8);})[_0xe4e2('0x2c')](function(_0x5c29c3){_0x1c87b0[_0xe4e2('0x4a')]=_0x5c29c3;return _0x1c87b0;})[_0xe4e2('0x2c')](respondWithFilteredResult(_0x40569e,_0x37dec8))['catch'](handleError(_0x40569e,null));};exports[_0xe4e2('0x4b')]=function(_0x3d55f9,_0x1538bd){var _0x17f30f={'raw':![],'where':{'id':_0x3d55f9[_0xe4e2('0x4c')]['id']}},_0x4ed88f={};_0x4ed88f[_0xe4e2('0x3e')]=_[_0xe4e2('0x3b')](db['VoicePrefix'][_0xe4e2('0x35')]);_0x4ed88f[_0xe4e2('0x3a')]=_['keys'](_0x3d55f9['query']);_0x4ed88f[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x4ed88f[_0xe4e2('0x3e')],_0x4ed88f['query']);_0x17f30f[_0xe4e2('0x3f')]=_[_0xe4e2('0x3d')](_0x4ed88f[_0xe4e2('0x3e')],qs[_0xe4e2('0x40')](_0x3d55f9['query'][_0xe4e2('0x40')]));_0x17f30f[_0xe4e2('0x3f')]=_0x17f30f[_0xe4e2('0x3f')][_0xe4e2('0x41')]?_0x17f30f['attributes']:_0x4ed88f[_0xe4e2('0x3e')];if(_0x3d55f9[_0xe4e2('0x3a')]['includeAll']){_0x17f30f[_0xe4e2('0x4d')]=[{'all':!![]}];}_0x17f30f=_[_0xe4e2('0x48')]({},_0x17f30f,_0x3d55f9[_0xe4e2('0x4e')]);return db['VoicePrefix'][_0xe4e2('0x4f')](_0x17f30f)[_0xe4e2('0x2c')](handleEntityNotFound(_0x1538bd,null))[_0xe4e2('0x2c')](respondWithResult(_0x1538bd,null))['catch'](handleError(_0x1538bd,null));};exports['destroy']=function(_0xccf95e,_0x4c6253){return db[_0xe4e2('0x34')]['find']({'where':{'id':_0xccf95e[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](handleEntityNotFound(_0x4c6253,null))[_0xe4e2('0x2c')](removeEntity(_0x4c6253,null))['catch'](handleError(_0x4c6253,null));};exports[_0xe4e2('0x50')]=function(_0x504496,_0x11bd63){return db[_0xe4e2('0x34')]['describe']()[_0xe4e2('0x2c')](respondWithResult(_0x11bd63,null))['catch'](handleError(_0x11bd63,null));};exports[_0xe4e2('0x51')]=function(_0xf0885,_0x53d31d){var _0x297186;return db[_0xe4e2('0x52')][_0xe4e2('0x53')](function(_0x3e540d){return db[_0xe4e2('0x34')][_0xe4e2('0x51')](_0xf0885[_0xe4e2('0x54')],{'transaction':_0x3e540d})[_0xe4e2('0x2c')](function(_0x382d1b){_0x297186=_0x382d1b['get']({'plain':!![]});return db[_0xe4e2('0x55')][_0xe4e2('0x4f')]({'where':{'id':_0x297186[_0xe4e2('0x56')]},'raw':!![]})[_0xe4e2('0x2c')](function(_0x2b0885){return createVoicePrefixExtensions(_0x297186,_0x2b0885,_0x3e540d);});});})[_0xe4e2('0x2c')](function(){var _0x1e2012=_0xf0885[_0xe4e2('0x57')][_0xe4e2('0x58')]({'plain':!![]});if(!_0x1e2012)throw new Error(_0xe4e2('0x59'));if(_0x1e2012[_0xe4e2('0x5a')]==='user'){var _0x17a350=_0x297186;return db[_0xe4e2('0x5b')][_0xe4e2('0x4f')]({'where':{'name':_0xe4e2('0x2e'),'userProfileId':_0x1e2012['userProfileId']},'raw':!![]})[_0xe4e2('0x2c')](function(_0x1250a2){if(_0x1250a2&&_0x1250a2['autoAssociation']===0x0){return db[_0xe4e2('0x2f')][_0xe4e2('0x51')]({'name':_0x17a350[_0xe4e2('0x31')],'resourceId':_0x17a350['id'],'type':_0x1250a2[_0xe4e2('0x31')],'sectionId':_0x1250a2['id']},{})['then'](function(){return _0x297186;});}else{return _0x297186;}})[_0xe4e2('0x5c')](function(_0x5c9d88){logger[_0xe4e2('0x5d')](_0xe4e2('0x5e'),_0x5c9d88);throw _0x5c9d88;});}return _0x297186;})[_0xe4e2('0x2c')](respondWithResult(_0x53d31d,null))[_0xe4e2('0x5c')](handleError(_0x53d31d,null));};function Extension(_0x2cc813,_0x26ab38,_0x467cec,_0x33c5f4){this[_0xe4e2('0x5f')]=_0xe4e2('0x60');this[_0xe4e2('0x61')]=_0x2cc813;this[_0xe4e2('0x62')]=_0x467cec;this['type']=_0xe4e2('0x63');this['description']='Voice\x20Prefix\x20Extension';this[_0xe4e2('0x64')]=_0x26ab38;this[_0xe4e2('0x65')]=_0x33c5f4;}function createVoicePrefixExtensions(_0xa27bd1,_0x5e4e16,_0x477acd){return new BPromise(function(_0x4b6dfc,_0xb9e975){var _0x9ba757=new Extension(formatPrefixName(_0xa27bd1['prefix']),0x1,_0xe4e2('0x66'),_0xe4e2('0x67'));_0x9ba757['VoicePrefixId']=_0xa27bd1['id'];return db[_0xe4e2('0x55')][_0xe4e2('0x51')](_0x9ba757,{'transaction':_0x477acd})['then'](function(_0x476533){var _0x2ad558=_0x476533[_0xe4e2('0x58')]({'plain':!![]});var _0x3f7be9=_['map'](addVoicePrefixExtensions(_0xa27bd1,_0x5e4e16),function(_0x22640a){_0x22640a[_0xe4e2('0x56')]=_0x2ad558['id'];_0x22640a[_0xe4e2('0x68')]=_0xa27bd1['id'];return _0x22640a;});return db[_0xe4e2('0x55')][_0xe4e2('0x69')](_0x3f7be9,{'transaction':_0x477acd})[_0xe4e2('0x2c')](function(_0x1ef7f8){if(!_0x1ef7f8){return _0xb9e975(_0xe4e2('0x6a'));}else{return _0x4b6dfc(_0x1ef7f8);}})[_0xe4e2('0x5c')](function(_0x593635){return _0xb9e975(_0x593635);});});;});};function addVoicePrefixExtensions(_0x59b1c0,_0x5cd517){var _0x39f59c=[];var _0x17d904=formatPrefixName(_0x59b1c0[_0xe4e2('0x6b')]);_0x39f59c[_0xe4e2('0x6c')](new Extension(_0x17d904,0x2,_0xe4e2('0x6d'),_0xe4e2('0x6e')+_0x59b1c0[_0xe4e2('0x31')]));if(_0x59b1c0['callerIdAll']){_0x39f59c[_0xe4e2('0x6c')](new Extension(_0x17d904,0x3,_0xe4e2('0x6d'),_0xe4e2('0x6f')+_0x59b1c0[_0xe4e2('0x70')]));}else{_0x39f59c[_0xe4e2('0x6c')](new Extension(_0x17d904,0x3,_0xe4e2('0x66'),_0xe4e2('0x71')));}_0x39f59c[_0xe4e2('0x6c')](new Extension(_0x17d904,0x4,_0xe4e2('0x72'),_0x5cd517[_0xe4e2('0x5f')]+','+_0xe4e2('0x73')+(0x8+_0x59b1c0[_0xe4e2('0x31')][_0xe4e2('0x41')])+'}'+','+0x1));return _0x39f59c;}function formatPrefixName(_0x2ad8d1){var _0x3dde87='_';for(var _0x51d58d=0x0;_0x51d58d<_0x2ad8d1[_0xe4e2('0x41')];_0x51d58d++){if(_0x2ad8d1[_0xe4e2('0x74')](_0x51d58d)=='-'){_0x3dde87+=_0x2ad8d1[_0xe4e2('0x74')](_0x51d58d);}else{_0x3dde87+='['+_0x2ad8d1[_0xe4e2('0x74')](_0x51d58d)+']';}}_0x3dde87+='.';return _0x3dde87;}exports[_0xe4e2('0x2b')]=function(_0x26f90d,_0x26b31a,_0x3f40f8){var _0x134eec=_0x26f90d[_0xe4e2('0x54')];_0x134eec['prefix']=_0xe4e2('0x75')+_0x134eec[_0xe4e2('0x31')]+'-';return db[_0xe4e2('0x52')][_0xe4e2('0x53')](function(_0x24859b){return db[_0xe4e2('0x34')][_0xe4e2('0x2b')](_0x134eec,{'where':{'id':_0x134eec['id']},'transaction':_0x24859b})[_0xe4e2('0x2c')](function(){return db['VoiceExtension'][_0xe4e2('0x2d')]({'where':{'VoicePrefixId':_0x134eec['id']},'transaction':_0x24859b})[_0xe4e2('0x2c')](function(){return db[_0xe4e2('0x55')][_0xe4e2('0x4f')]({'where':{'id':_0x134eec[_0xe4e2('0x56')]},'raw':!![]})[_0xe4e2('0x2c')](function(_0x22f79e){return createVoicePrefixExtensions(_0x134eec,_0x22f79e,_0x24859b);});});});})[_0xe4e2('0x2c')](function(){return db[_0xe4e2('0x34')][_0xe4e2('0x76')](_0x134eec['id']);})['then'](respondWithResult(_0x26b31a,null))[_0xe4e2('0x5c')](handleError(_0x26b31a,null));};exports[_0xe4e2('0x77')]=function(_0x4da351,_0x2017d,_0x2cada0){return db[_0xe4e2('0x34')][_0xe4e2('0x4f')]({'where':{'id':_0x4da351[_0xe4e2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2017d,null))[_0xe4e2('0x2c')](function(_0x1447ee){if(_0x1447ee){return _0x1447ee[_0xe4e2('0x77')](_0x4da351[_0xe4e2('0x54')][_0xe4e2('0x78')],_[_0xe4e2('0x79')](_0x4da351[_0xe4e2('0x54')],[_0xe4e2('0x78'),'id'])||{})['spread'](function(_0xbdd6b4){for(var _0x386253=0x0;_0x386253<_0x4da351[_0xe4e2('0x54')][_0xe4e2('0x78')][_0xe4e2('0x41')];_0x386253+=0x1){socket[_0xe4e2('0x7a')](_0xe4e2('0x7b'),{'UserId':Number(_0x4da351[_0xe4e2('0x54')][_0xe4e2('0x78')][_0x386253]),'VoicePrefixId':Number(_0x4da351['params']['id'])});}return _0xbdd6b4;});}})[_0xe4e2('0x2c')](respondWithResult(_0x2017d,null))[_0xe4e2('0x5c')](handleError(_0x2017d,null));};exports[_0xe4e2('0x7c')]=function(_0x40fa3c,_0x420559,_0x28368a){return db[_0xe4e2('0x34')][_0xe4e2('0x4f')]({'where':{'id':_0x40fa3c[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](handleEntityNotFound(_0x420559,null))[_0xe4e2('0x2c')](function(_0x150c1a){if(_0x150c1a){return _0x150c1a[_0xe4e2('0x7c')](_0x40fa3c['query'][_0xe4e2('0x78')])['then'](function(){if(_[_0xe4e2('0x7d')](_0x40fa3c[_0xe4e2('0x3a')]['ids'])){for(var _0x326762=0x0;_0x326762<_0x40fa3c[_0xe4e2('0x3a')][_0xe4e2('0x78')][_0xe4e2('0x41')];_0x326762+=0x1){socket[_0xe4e2('0x7a')](_0xe4e2('0x7e'),{'UserId':Number(_0x40fa3c[_0xe4e2('0x3a')]['ids'][_0x326762]),'VoicePrefixId':Number(_0x40fa3c[_0xe4e2('0x4c')]['id'])});}}else{socket[_0xe4e2('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x40fa3c['query'][_0xe4e2('0x78')]),'VoicePrefixId':Number(_0x40fa3c[_0xe4e2('0x4c')]['id'])});}});}})[_0xe4e2('0x2c')](respondWithStatusCode(_0x420559,null))['catch'](handleError(_0x420559,null));};exports[_0xe4e2('0x7f')]=function(_0x5b0948,_0x3b45c3,_0x406c7e){var _0x5dfe42={};var _0x2783f7={};var _0x94e5e1;var _0x45ecb8;return db[_0xe4e2('0x34')][_0xe4e2('0x80')]({'where':{'id':_0x5b0948[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](handleEntityNotFound(_0x3b45c3,null))[_0xe4e2('0x2c')](function(_0x3687d5){if(_0x3687d5){_0x94e5e1=_0x3687d5;_0x2783f7[_0xe4e2('0x3e')]=_['keys'](db[_0xe4e2('0x81')][_0xe4e2('0x35')]);_0x2783f7['query']=_[_0xe4e2('0x3b')](_0x5b0948['query']);_0x2783f7[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x2783f7[_0xe4e2('0x3e')],_0x2783f7[_0xe4e2('0x3a')]);_0x5dfe42['attributes']=_[_0xe4e2('0x3d')](_0x2783f7[_0xe4e2('0x3e')],qs[_0xe4e2('0x40')](_0x5b0948[_0xe4e2('0x3a')][_0xe4e2('0x40')]));_0x5dfe42[_0xe4e2('0x3f')]=_0x5dfe42[_0xe4e2('0x3f')]['length']?_0x5dfe42['attributes']:_0x2783f7[_0xe4e2('0x3e')];_0x5dfe42[_0xe4e2('0x43')]=qs[_0xe4e2('0x44')](_0x5b0948[_0xe4e2('0x3a')][_0xe4e2('0x44')]);_0x5dfe42[_0xe4e2('0x45')]=qs[_0xe4e2('0x3c')](_[_0xe4e2('0x46')](_0x5b0948[_0xe4e2('0x3a')],_0x2783f7[_0xe4e2('0x3c')]));if(_0x5b0948[_0xe4e2('0x3a')][_0xe4e2('0x47')]){_0x5dfe42[_0xe4e2('0x45')]=_[_0xe4e2('0x48')](_0x5dfe42[_0xe4e2('0x45')],{'$or':_[_0xe4e2('0x39')](_0x5dfe42[_0xe4e2('0x3f')],function(_0x1b630a){var _0x1930b9={};_0x1930b9[_0x1b630a]={'$like':'%'+_0x5b0948['query'][_0xe4e2('0x47')]+'%'};return _0x1930b9;})});}_0x5dfe42=_[_0xe4e2('0x48')]({},_0x5dfe42,_0x5b0948[_0xe4e2('0x4e')]);return _0x94e5e1['getAgents'](_0x5dfe42);}})['then'](function(_0xf31c76){if(_0xf31c76){_0x45ecb8=_0xf31c76['length'];if(!_0x5b0948[_0xe4e2('0x3a')][_0xe4e2('0x82')](_0xe4e2('0x42'))){_0x5dfe42[_0xe4e2('0x25')]=qs[_0xe4e2('0x25')](_0x5b0948[_0xe4e2('0x3a')][_0xe4e2('0x25')]);_0x5dfe42[_0xe4e2('0x23')]=qs[_0xe4e2('0x23')](_0x5b0948['query'][_0xe4e2('0x23')]);}return _0x94e5e1[_0xe4e2('0x7f')](_0x5dfe42);}})['then'](function(_0x4ab01e){if(_0x4ab01e){return _0x4ab01e?{'count':_0x45ecb8,'rows':_0x4ab01e}:null;}})[_0xe4e2('0x2c')](respondWithResult(_0x3b45c3,null))[_0xe4e2('0x5c')](handleError(_0x3b45c3,null));};exports[_0xe4e2('0x83')]=function(_0x10c166,_0x11707e,_0x11a6f4){var _0x38675b={};var _0x39fcac={};var _0x272ebb;var _0x2558c2;return db['VoicePrefix'][_0xe4e2('0x80')]({'where':{'id':_0x10c166[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](handleEntityNotFound(_0x11707e,null))[_0xe4e2('0x2c')](function(_0x46d566){if(_0x46d566){_0x272ebb=_0x46d566;_0x39fcac[_0xe4e2('0x3e')]=_[_0xe4e2('0x3b')](db['Team'][_0xe4e2('0x35')]);_0x39fcac[_0xe4e2('0x3a')]=_[_0xe4e2('0x3b')](_0x10c166[_0xe4e2('0x3a')]);_0x39fcac[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x39fcac[_0xe4e2('0x3e')],_0x39fcac[_0xe4e2('0x3a')]);_0x38675b[_0xe4e2('0x3f')]=_['intersection'](_0x39fcac[_0xe4e2('0x3e')],qs[_0xe4e2('0x40')](_0x10c166[_0xe4e2('0x3a')]['fields']));_0x38675b[_0xe4e2('0x3f')]=_0x38675b[_0xe4e2('0x3f')][_0xe4e2('0x41')]?_0x38675b[_0xe4e2('0x3f')]:_0x39fcac[_0xe4e2('0x3e')];_0x38675b[_0xe4e2('0x43')]=qs['sort'](_0x10c166[_0xe4e2('0x3a')][_0xe4e2('0x44')]);_0x38675b[_0xe4e2('0x45')]=qs['filters'](_[_0xe4e2('0x46')](_0x10c166[_0xe4e2('0x3a')],_0x39fcac[_0xe4e2('0x3c')]));if(_0x10c166[_0xe4e2('0x3a')][_0xe4e2('0x47')]){_0x38675b[_0xe4e2('0x45')]=_[_0xe4e2('0x48')](_0x38675b[_0xe4e2('0x45')],{'$or':_[_0xe4e2('0x39')](_0x38675b[_0xe4e2('0x3f')],function(_0x3266a4){var _0x282545={};_0x282545[_0x3266a4]={'$like':'%'+_0x10c166[_0xe4e2('0x3a')][_0xe4e2('0x47')]+'%'};return _0x282545;})});}_0x38675b=_[_0xe4e2('0x48')]({},_0x38675b,_0x10c166['options']);return _0x272ebb['getTeams'](_0x38675b);}})[_0xe4e2('0x2c')](function(_0x4d730e){if(_0x4d730e){_0x2558c2=_0x4d730e['length'];if(!_0x10c166[_0xe4e2('0x3a')][_0xe4e2('0x82')](_0xe4e2('0x42'))){_0x38675b[_0xe4e2('0x25')]=qs['limit'](_0x10c166[_0xe4e2('0x3a')]['limit']);_0x38675b['offset']=qs[_0xe4e2('0x23')](_0x10c166['query'][_0xe4e2('0x23')]);}return _0x272ebb[_0xe4e2('0x83')](_0x38675b);}})[_0xe4e2('0x2c')](function(_0x4e6552){if(_0x4e6552){return _0x4e6552?{'count':_0x2558c2,'rows':_0x4e6552}:null;}})[_0xe4e2('0x2c')](respondWithResult(_0x11707e,null))[_0xe4e2('0x5c')](handleError(_0x11707e,null));};exports[_0xe4e2('0x84')]=function(_0x5e9fc3,_0x240089,_0x1b94e9){var _0x126eeb=_0x5e9fc3[_0xe4e2('0x54')]['ids'];var _0x35c2d4;return db[_0xe4e2('0x85')][_0xe4e2('0x49')]({'where':{'id':_0x126eeb},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe4e2('0x31'),_0xe4e2('0x86'),'voicePause',_0xe4e2('0x87')],'raw':!![]}]})['then'](function(_0x47186a){if(_0x47186a){_0x35c2d4=_0x47186a;var _0x3fa1eb=_['flatMap'](_0x47186a,function(_0x3a8a2f){var _0x4e722d=_0x3a8a2f[_0xe4e2('0x58')]({'plain':!![]});return _0x4e722d[_0xe4e2('0x88')];});return db[_0xe4e2('0x34')][_0xe4e2('0x4f')]({'where':{'id':_0x5e9fc3[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](function(_0x50b129){return db[_0xe4e2('0x52')][_0xe4e2('0x53')](function(_0x45431c){return _0x50b129['addTeams'](_0x126eeb,{'transaction':_0x45431c})[_0xe4e2('0x2c')](function(){return BPromise[_0xe4e2('0x89')](_0x35c2d4,function(_0x19f368){return db['TeamVoicePrefix'][_0xe4e2('0x8a')]({'TeamId':_0x19f368['id'],'VoicePrefixId':_0x5e9fc3[_0xe4e2('0x4c')]['id']},{'transaction':_0x45431c});});})[_0xe4e2('0x2c')](function(){return BPromise['each'](_0x3fa1eb,function(_0x151d22){return db[_0xe4e2('0x8b')][_0xe4e2('0x8c')]({'where':{'UserId':_0x151d22['id'],'VoicePrefixId':_0x5e9fc3[_0xe4e2('0x4c')]['id']},'transaction':_0x45431c});});})[_0xe4e2('0x2c')](function(){_0x3fa1eb[_0xe4e2('0x8d')](function(_0x19405d){socket[_0xe4e2('0x7a')](_0xe4e2('0x7b'),{'UserId':_0x19405d['id'],'VoicePrefixId':_0x50b129['id']});});});});});}})[_0xe4e2('0x2c')](respondWithStatusCode(_0x240089,null))[_0xe4e2('0x5c')](handleError(_0x240089,null));};exports[_0xe4e2('0x8e')]=function(_0x515f57,_0x28b119,_0x373c88){return db[_0xe4e2('0x85')][_0xe4e2('0x49')]({'where':{'id':_0x515f57[_0xe4e2('0x3a')][_0xe4e2('0x78')]},'attributes':['id'],'include':[{'model':db[_0xe4e2('0x81')],'as':_0xe4e2('0x88'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x28b119,null))[_0xe4e2('0x2c')](function(_0x21fa74){var _0x273236=_[_0xe4e2('0x39')](_0x21fa74,'id');var _0x278ad0=[];var _0x416ebe=[];var _0xfb32dd=squel[_0xe4e2('0x8f')]();_0xfb32dd[_0xe4e2('0x90')](_0xe4e2('0x91'))[_0xe4e2('0x92')](_0xe4e2('0x93'),'tq')[_0xe4e2('0x94')](_0xe4e2('0x95'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x515f57[_0xe4e2('0x4c')]['id']);for(var _0x1060d9=0x0;_0x1060d9<_0x21fa74['length'];_0x1060d9+=0x1){let _0x3ca7ef=_0x21fa74[_0x1060d9];for(var _0x49dc91=0x0;_0x49dc91<_0x3ca7ef[_0xe4e2('0x88')][_0xe4e2('0x41')];_0x49dc91+=0x1){let _0x3cea27=_0x3ca7ef[_0xe4e2('0x88')][_0x49dc91];var _0x17b696=_0xfb32dd[_0xe4e2('0x96')]();_0x17b696['where'](_0xe4e2('0x97'),_0x3cea27['id']);_0x416ebe['push'](db[_0xe4e2('0x52')][_0xe4e2('0x3a')](_0x17b696[_0xe4e2('0x98')](),{'type':db[_0xe4e2('0x52')][_0xe4e2('0x99')][_0xe4e2('0x9a')]})[_0xe4e2('0x2c')](function(_0x55182e){if(_0x55182e['length']===0x1){return _0x3cea27['id'];}else{var _0x35d3da=_['every'](_['map'](_0x55182e,_0xe4e2('0x9b')),function(_0x2ab2d8){return _[_0xe4e2('0x9c')](_0x273236,_0x2ab2d8);});if(_0x35d3da){return _0x3cea27['id'];}}}));}}return BPromise[_0xe4e2('0x9d')](_0x416ebe)[_0xe4e2('0x2c')](function(_0x10a6c5){_0x278ad0=_(_0x278ad0)[_0xe4e2('0x9e')](_0x10a6c5)[_0xe4e2('0x9f')]()['value']();return db[_0xe4e2('0x34')][_0xe4e2('0x4f')]({'where':{'id':_0x515f57[_0xe4e2('0x4c')]['id']}})[_0xe4e2('0x2c')](function(_0x45ee82){return db[_0xe4e2('0x52')][_0xe4e2('0x53')](function(_0x181f47){return _0x45ee82[_0xe4e2('0x8e')](_0x515f57[_0xe4e2('0x3a')][_0xe4e2('0x78')],{'transaction':_0x181f47})['then'](function(){if(!_[_0xe4e2('0xa0')](_0x278ad0)){return _0x45ee82[_0xe4e2('0x7c')](_0x278ad0,{'transaction':_0x181f47});}})[_0xe4e2('0x2c')](function(){_0x278ad0['forEach'](function(_0x3dabd1){socket[_0xe4e2('0x7a')](_0xe4e2('0x7e'),{'UserId':_0x3dabd1,'VoicePrefixId':_0x45ee82['id']});});});});});});})[_0xe4e2('0x2c')](respondWithStatusCode(_0x28b119,null))[_0xe4e2('0x5c')](handleError(_0x28b119,null));}; \ No newline at end of file +var _0xd4f4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','end','status','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','options','includeAll','include','VoicePrefix','rows','catch','show','keys','find','params','describe','sequelize','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','prefix','NoOp','Voice\x20Prefix','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','length','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','findAll','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','Team','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','union','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x417c6b,_0x31644f){var _0x25b3dd=function(_0x3764e5){while(--_0x3764e5){_0x417c6b['push'](_0x417c6b['shift']());}};_0x25b3dd(++_0x31644f);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3d880e,_0x7bb27d){_0x3d880e=_0x3d880e-0x0;var _0x389adb=_0xd4f4[_0x3d880e];return _0x389adb;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4d4f('0x1d')],{'host':_0x4d4f('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d4f('0x1d')]));require(_0x4d4f('0x1f'))[_0x4d4f('0x20')](socket);function respondWithStatusCode(_0x59252c,_0x145804){_0x145804=_0x145804||0xcc;return function(_0x2e736b){if(_0x2e736b){return _0x59252c[_0x4d4f('0x21')](_0x145804);}return _0x59252c['status'](_0x145804)[_0x4d4f('0x22')]();};}function respondWithResult(_0x5e4ff5,_0x18a528){_0x18a528=_0x18a528||0xc8;return function(_0x16f8e7){if(_0x16f8e7){return _0x5e4ff5[_0x4d4f('0x23')](_0x18a528)['json'](_0x16f8e7);}};}function respondWithFilteredResult(_0x30b6b1,_0x17a437){return function(_0x51dcf1){if(_0x51dcf1){var _0x5dbbeb=typeof _0x17a437['offset']==='undefined'&&typeof _0x17a437['limit']===_0x4d4f('0x24');var _0x15100a=_0x51dcf1[_0x4d4f('0x25')];var _0x3566a5=_0x5dbbeb?0x0:_0x17a437['offset'];var _0x5b2863=_0x5dbbeb?_0x51dcf1[_0x4d4f('0x25')]:_0x17a437['offset']+_0x17a437[_0x4d4f('0x26')];var _0x1e3e9a;if(_0x5b2863>=_0x15100a){_0x5b2863=_0x15100a;_0x1e3e9a=0xc8;}else{_0x1e3e9a=0xce;}_0x30b6b1[_0x4d4f('0x23')](_0x1e3e9a);return _0x30b6b1[_0x4d4f('0x27')](_0x4d4f('0x28'),_0x3566a5+'-'+_0x5b2863+'/'+_0x15100a)['json'](_0x51dcf1);}return null;};}function patchUpdates(_0x570520){return function(_0x4043f2){try{jsonpatch['apply'](_0x4043f2,_0x570520,!![]);}catch(_0x247077){return BPromise[_0x4d4f('0x29')](_0x247077);}return _0x4043f2[_0x4d4f('0x2a')]();};}function saveUpdates(_0x3f4a55,_0xf3f7a4){return function(_0x497cec){if(_0x497cec){return _0x497cec[_0x4d4f('0x2b')](_0x3f4a55)[_0x4d4f('0x2c')](function(_0x1cf365){return _0x1cf365;});}return null;};}function removeEntity(_0x28443b,_0x5cf9e7){return function(_0x51a7c5){if(_0x51a7c5){return _0x51a7c5[_0x4d4f('0x2d')]()[_0x4d4f('0x2c')](function(){var _0xa2492c=_0x51a7c5[_0x4d4f('0x2e')]({'plain':!![]});var _0x58acbe=_0x4d4f('0x2f');return db[_0x4d4f('0x30')][_0x4d4f('0x2d')]({'where':{'type':_0x58acbe,'resourceId':_0xa2492c['id']}})[_0x4d4f('0x2c')](function(){return _0x51a7c5;});})['then'](function(){_0x28443b[_0x4d4f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1688bb,_0x333a40){return function(_0x550040){if(!_0x550040){_0x1688bb[_0x4d4f('0x21')](0x194);}return _0x550040;};}function handleError(_0x123383,_0x287a09){_0x287a09=_0x287a09||0x1f4;return function(_0x3d7f14){logger[_0x4d4f('0x31')](_0x3d7f14[_0x4d4f('0x32')]);if(_0x3d7f14['name']){delete _0x3d7f14[_0x4d4f('0x33')];}_0x123383[_0x4d4f('0x23')](_0x287a09)[_0x4d4f('0x34')](_0x3d7f14);};}exports[_0x4d4f('0x35')]=function(_0x104104,_0x4e47e5){var _0x2d6565={},_0x486e33={},_0x35f9e2={'count':0x0,'rows':[]};var _0x537a47=_['map'](db['VoicePrefix'][_0x4d4f('0x36')],function(_0x57fc2b){return{'name':_0x57fc2b[_0x4d4f('0x37')],'type':_0x57fc2b[_0x4d4f('0x38')][_0x4d4f('0x39')]};});_0x486e33['model']=_[_0x4d4f('0x3a')](_0x537a47,_0x4d4f('0x33'));_0x486e33[_0x4d4f('0x3b')]=_['keys'](_0x104104[_0x4d4f('0x3b')]);_0x486e33['filters']=_[_0x4d4f('0x3c')](_0x486e33[_0x4d4f('0x3d')],_0x486e33[_0x4d4f('0x3b')]);_0x2d6565[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x486e33[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x104104[_0x4d4f('0x3b')]['fields']));_0x2d6565['attributes']=_0x2d6565[_0x4d4f('0x3e')]['length']?_0x2d6565['attributes']:_0x486e33[_0x4d4f('0x3d')];if(!_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x40')](_0x4d4f('0x41'))){_0x2d6565[_0x4d4f('0x26')]=qs['limit'](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x2d6565['offset']=qs[_0x4d4f('0x42')](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x42')]);}_0x2d6565[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x44')]);_0x2d6565[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_['pick'](_0x104104['query'],_0x486e33[_0x4d4f('0x46')]),_0x537a47);if(_0x104104[_0x4d4f('0x3b')][_0x4d4f('0x47')]){_0x2d6565[_0x4d4f('0x45')]=_['merge'](_0x2d6565['where'],{'$or':_[_0x4d4f('0x3a')](_0x537a47,function(_0x3c34bd){if(_0x3c34bd['type']!=='VIRTUAL'){var _0x3591b7={};_0x3591b7[_0x3c34bd[_0x4d4f('0x33')]]={'$like':'%'+_0x104104['query'][_0x4d4f('0x47')]+'%'};return _0x3591b7;}})});}_0x2d6565=_[_0x4d4f('0x48')]({},_0x2d6565,_0x104104[_0x4d4f('0x49')]);var _0x32c6ff={'where':_0x2d6565[_0x4d4f('0x45')]};return db['VoicePrefix'][_0x4d4f('0x25')](_0x32c6ff)['then'](function(_0x45a0c1){_0x35f9e2[_0x4d4f('0x25')]=_0x45a0c1;if(_0x104104['query'][_0x4d4f('0x4a')]){_0x2d6565[_0x4d4f('0x4b')]=[{'all':!![]}];}return db[_0x4d4f('0x4c')]['findAll'](_0x2d6565);})[_0x4d4f('0x2c')](function(_0x48caa2){_0x35f9e2[_0x4d4f('0x4d')]=_0x48caa2;return _0x35f9e2;})['then'](respondWithFilteredResult(_0x4e47e5,_0x2d6565))[_0x4d4f('0x4e')](handleError(_0x4e47e5,null));};exports[_0x4d4f('0x4f')]=function(_0x231134,_0x2939cb){var _0x198c3a={'raw':![],'where':{'id':_0x231134['params']['id']}},_0x4a53e4={};_0x4a53e4[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db[_0x4d4f('0x4c')][_0x4d4f('0x36')]);_0x4a53e4['query']=_['keys'](_0x231134['query']);_0x4a53e4[_0x4d4f('0x46')]=_[_0x4d4f('0x3c')](_0x4a53e4[_0x4d4f('0x3d')],_0x4a53e4[_0x4d4f('0x3b')]);_0x198c3a[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x4a53e4[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x231134[_0x4d4f('0x3b')][_0x4d4f('0x3f')]));_0x198c3a[_0x4d4f('0x3e')]=_0x198c3a[_0x4d4f('0x3e')]['length']?_0x198c3a[_0x4d4f('0x3e')]:_0x4a53e4[_0x4d4f('0x3d')];if(_0x231134['query'][_0x4d4f('0x4a')]){_0x198c3a['include']=[{'all':!![]}];}_0x198c3a=_[_0x4d4f('0x48')]({},_0x198c3a,_0x231134[_0x4d4f('0x49')]);return db['VoicePrefix'][_0x4d4f('0x51')](_0x198c3a)[_0x4d4f('0x2c')](handleEntityNotFound(_0x2939cb,null))[_0x4d4f('0x2c')](respondWithResult(_0x2939cb,null))[_0x4d4f('0x4e')](handleError(_0x2939cb,null));};exports[_0x4d4f('0x2d')]=function(_0x3eae74,_0x11a63e){return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x3eae74[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x11a63e,null))[_0x4d4f('0x2c')](removeEntity(_0x11a63e,null))['catch'](handleError(_0x11a63e,null));};exports[_0x4d4f('0x53')]=function(_0x539088,_0x59d245){return db['VoicePrefix'][_0x4d4f('0x53')]()[_0x4d4f('0x2c')](respondWithResult(_0x59d245,null))['catch'](handleError(_0x59d245,null));};exports['create']=function(_0x2a3bc4,_0x4c80c4){var _0x5adc7b;return db[_0x4d4f('0x54')]['transaction'](function(_0x17b59e){return db[_0x4d4f('0x4c')][_0x4d4f('0x55')](_0x2a3bc4[_0x4d4f('0x56')],{'transaction':_0x17b59e})['then'](function(_0x224b83){_0x5adc7b=_0x224b83[_0x4d4f('0x2e')]({'plain':!![]});return db[_0x4d4f('0x57')][_0x4d4f('0x51')]({'where':{'id':_0x5adc7b[_0x4d4f('0x58')]},'raw':!![]})['then'](function(_0x10f94e){return createVoicePrefixExtensions(_0x5adc7b,_0x10f94e,_0x17b59e);});});})['then'](function(){var _0x32cba6=_0x2a3bc4['user'][_0x4d4f('0x2e')]({'plain':!![]});if(!_0x32cba6)throw new Error(_0x4d4f('0x59'));if(_0x32cba6['role']===_0x4d4f('0x5a')){var _0x1d8ae6=_0x5adc7b;return db['UserProfileSection'][_0x4d4f('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x32cba6[_0x4d4f('0x5b')]},'raw':!![]})['then'](function(_0x48ad06){if(_0x48ad06&&_0x48ad06[_0x4d4f('0x5c')]===0x0){return db[_0x4d4f('0x30')][_0x4d4f('0x55')]({'name':_0x1d8ae6[_0x4d4f('0x33')],'resourceId':_0x1d8ae6['id'],'type':_0x48ad06[_0x4d4f('0x33')],'sectionId':_0x48ad06['id']},{})['then'](function(){return _0x5adc7b;});}else{return _0x5adc7b;}})['catch'](function(_0xeaccdd){logger['error'](_0x4d4f('0x5d'),_0xeaccdd);throw _0xeaccdd;});}return _0x5adc7b;})[_0x4d4f('0x2c')](respondWithResult(_0x4c80c4,null))[_0x4d4f('0x4e')](handleError(_0x4c80c4,null));};function Extension(_0x4585b5,_0x31aba3,_0x39ae15,_0x585764){this[_0x4d4f('0x5e')]=_0x4d4f('0x5f');this[_0x4d4f('0x60')]=_0x4585b5;this['app']=_0x39ae15;this[_0x4d4f('0x38')]=_0x4d4f('0x61');this[_0x4d4f('0x62')]='Voice\x20Prefix\x20Extension';this[_0x4d4f('0x63')]=_0x31aba3;this['appdata']=_0x585764;}function createVoicePrefixExtensions(_0xcdab8b,_0x2145ca,_0x1fe5ca){return new BPromise(function(_0xe8d3e2,_0x1edb3d){var _0x2e55f5=new Extension(formatPrefixName(_0xcdab8b[_0x4d4f('0x64')]),0x1,_0x4d4f('0x65'),_0x4d4f('0x66'));_0x2e55f5['VoicePrefixId']=_0xcdab8b['id'];return db[_0x4d4f('0x57')][_0x4d4f('0x55')](_0x2e55f5,{'transaction':_0x1fe5ca})['then'](function(_0x1bd4b1){var _0x2a3738=_0x1bd4b1[_0x4d4f('0x2e')]({'plain':!![]});var _0xae8fe=_['map'](addVoicePrefixExtensions(_0xcdab8b,_0x2145ca),function(_0x4013a9){_0x4013a9[_0x4d4f('0x58')]=_0x2a3738['id'];_0x4013a9['VoicePrefixId']=_0xcdab8b['id'];return _0x4013a9;});return db['VoiceExtension'][_0x4d4f('0x67')](_0xae8fe,{'transaction':_0x1fe5ca})[_0x4d4f('0x2c')](function(_0x53b2db){if(!_0x53b2db){return _0x1edb3d('Extensions\x20creation\x20failed');}else{return _0xe8d3e2(_0x53b2db);}})['catch'](function(_0x4752bd){return _0x1edb3d(_0x4752bd);});});;});};function addVoicePrefixExtensions(_0x351fb5,_0x5e0ead){var _0x347bb1=[];var _0xc596ea=formatPrefixName(_0x351fb5[_0x4d4f('0x64')]);_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x2,_0x4d4f('0x69'),_0x4d4f('0x6a')+_0x351fb5[_0x4d4f('0x33')]));if(_0x351fb5[_0x4d4f('0x6b')]){_0x347bb1['push'](new Extension(_0xc596ea,0x3,_0x4d4f('0x69'),'PREFIX-CALLERIDALL='+_0x351fb5[_0x4d4f('0x6b')]));}else{_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x3,_0x4d4f('0x65'),'No\x20callerid\x20available'));}_0x347bb1[_0x4d4f('0x68')](new Extension(_0xc596ea,0x4,_0x4d4f('0x6c'),_0x5e0ead[_0x4d4f('0x5e')]+','+_0x4d4f('0x6d')+(0x8+_0x351fb5['name'][_0x4d4f('0x6e')])+'}'+','+0x1));return _0x347bb1;}function formatPrefixName(_0x4bf7bd){var _0x268b34='_';for(var _0x50d0da=0x0;_0x50d0da<_0x4bf7bd['length'];_0x50d0da++){if(_0x4bf7bd[_0x4d4f('0x6f')](_0x50d0da)=='-'){_0x268b34+=_0x4bf7bd[_0x4d4f('0x6f')](_0x50d0da);}else{_0x268b34+='['+_0x4bf7bd['charAt'](_0x50d0da)+']';}}_0x268b34+='.';return _0x268b34;}exports[_0x4d4f('0x2b')]=function(_0x53a18b,_0x41ffe7,_0x4420f0){var _0x111c01=_0x53a18b[_0x4d4f('0x56')];_0x111c01['prefix']=_0x4d4f('0x70')+_0x111c01[_0x4d4f('0x33')]+'-';return db[_0x4d4f('0x54')]['transaction'](function(_0x781877){return db[_0x4d4f('0x4c')][_0x4d4f('0x2b')](_0x111c01,{'where':{'id':_0x111c01['id']},'transaction':_0x781877})[_0x4d4f('0x2c')](function(){return db[_0x4d4f('0x57')][_0x4d4f('0x2d')]({'where':{'VoicePrefixId':_0x111c01['id']},'transaction':_0x781877})['then'](function(){return db['VoiceExtension'][_0x4d4f('0x51')]({'where':{'id':_0x111c01[_0x4d4f('0x58')]},'raw':!![]})['then'](function(_0x26ed6f){return createVoicePrefixExtensions(_0x111c01,_0x26ed6f,_0x781877);});});});})[_0x4d4f('0x2c')](function(){return db[_0x4d4f('0x4c')][_0x4d4f('0x71')](_0x111c01['id']);})[_0x4d4f('0x2c')](respondWithResult(_0x41ffe7,null))[_0x4d4f('0x4e')](handleError(_0x41ffe7,null));};exports[_0x4d4f('0x72')]=function(_0x1c764b,_0x302cde,_0x44f0c2){return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x1c764b[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x302cde,null))[_0x4d4f('0x2c')](function(_0x518252){if(_0x518252){return _0x518252[_0x4d4f('0x72')](_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')],_[_0x4d4f('0x74')](_0x1c764b['body'],['ids','id'])||{})[_0x4d4f('0x75')](function(_0x3c8a64){for(var _0x4736db=0x0;_0x4736db<_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')][_0x4d4f('0x6e')];_0x4736db+=0x1){socket[_0x4d4f('0x76')](_0x4d4f('0x77'),{'UserId':Number(_0x1c764b[_0x4d4f('0x56')][_0x4d4f('0x73')][_0x4736db]),'VoicePrefixId':Number(_0x1c764b['params']['id'])});}return _0x3c8a64;});}})[_0x4d4f('0x2c')](respondWithResult(_0x302cde,null))[_0x4d4f('0x4e')](handleError(_0x302cde,null));};exports[_0x4d4f('0x78')]=function(_0x2c8c79,_0x584c53,_0x5240be){return db['VoicePrefix'][_0x4d4f('0x51')]({'where':{'id':_0x2c8c79['params']['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x584c53,null))[_0x4d4f('0x2c')](function(_0xa63721){if(_0xa63721){return _0xa63721[_0x4d4f('0x78')](_0x2c8c79[_0x4d4f('0x3b')][_0x4d4f('0x73')])[_0x4d4f('0x2c')](function(){if(_[_0x4d4f('0x79')](_0x2c8c79['query']['ids'])){for(var _0x42c66c=0x0;_0x42c66c<_0x2c8c79['query'][_0x4d4f('0x73')][_0x4d4f('0x6e')];_0x42c66c+=0x1){socket[_0x4d4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x2c8c79['query']['ids'][_0x42c66c]),'VoicePrefixId':Number(_0x2c8c79[_0x4d4f('0x52')]['id'])});}}else{socket['emit'](_0x4d4f('0x7a'),{'UserId':Number(_0x2c8c79['query'][_0x4d4f('0x73')]),'VoicePrefixId':Number(_0x2c8c79[_0x4d4f('0x52')]['id'])});}});}})[_0x4d4f('0x2c')](respondWithStatusCode(_0x584c53,null))[_0x4d4f('0x4e')](handleError(_0x584c53,null));};exports[_0x4d4f('0x7b')]=function(_0x1670fd,_0x548709,_0x18274e){var _0x3beacf={};var _0x4691b7={};var _0x1f62e0;var _0x328528;return db['VoicePrefix'][_0x4d4f('0x7c')]({'where':{'id':_0x1670fd['params']['id']}})[_0x4d4f('0x2c')](handleEntityNotFound(_0x548709,null))[_0x4d4f('0x2c')](function(_0x2511c8){if(_0x2511c8){_0x1f62e0=_0x2511c8;_0x4691b7[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db[_0x4d4f('0x7d')][_0x4d4f('0x36')]);_0x4691b7['query']=_[_0x4d4f('0x50')](_0x1670fd[_0x4d4f('0x3b')]);_0x4691b7[_0x4d4f('0x46')]=_['intersection'](_0x4691b7[_0x4d4f('0x3d')],_0x4691b7['query']);_0x3beacf[_0x4d4f('0x3e')]=_['intersection'](_0x4691b7[_0x4d4f('0x3d')],qs[_0x4d4f('0x3f')](_0x1670fd[_0x4d4f('0x3b')]['fields']));_0x3beacf[_0x4d4f('0x3e')]=_0x3beacf[_0x4d4f('0x3e')][_0x4d4f('0x6e')]?_0x3beacf[_0x4d4f('0x3e')]:_0x4691b7['model'];_0x3beacf[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x1670fd['query'][_0x4d4f('0x44')]);_0x3beacf[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_[_0x4d4f('0x7e')](_0x1670fd[_0x4d4f('0x3b')],_0x4691b7[_0x4d4f('0x46')]));if(_0x1670fd['query'][_0x4d4f('0x47')]){_0x3beacf[_0x4d4f('0x45')]=_['merge'](_0x3beacf[_0x4d4f('0x45')],{'$or':_[_0x4d4f('0x3a')](_0x3beacf[_0x4d4f('0x3e')],function(_0x4686b9){var _0x16d1f7={};_0x16d1f7[_0x4686b9]={'$like':'%'+_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x47')]+'%'};return _0x16d1f7;})});}_0x3beacf=_[_0x4d4f('0x48')]({},_0x3beacf,_0x1670fd['options']);return _0x1f62e0[_0x4d4f('0x7b')](_0x3beacf);}})[_0x4d4f('0x2c')](function(_0x4dd3f6){if(_0x4dd3f6){_0x328528=_0x4dd3f6[_0x4d4f('0x6e')];if(!_0x1670fd['query'][_0x4d4f('0x40')]('nolimit')){_0x3beacf[_0x4d4f('0x26')]=qs[_0x4d4f('0x26')](_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x3beacf[_0x4d4f('0x42')]=qs[_0x4d4f('0x42')](_0x1670fd[_0x4d4f('0x3b')][_0x4d4f('0x42')]);}return _0x1f62e0[_0x4d4f('0x7b')](_0x3beacf);}})[_0x4d4f('0x2c')](function(_0x10f882){if(_0x10f882){return _0x10f882?{'count':_0x328528,'rows':_0x10f882}:null;}})[_0x4d4f('0x2c')](respondWithResult(_0x548709,null))['catch'](handleError(_0x548709,null));};exports['getTeams']=function(_0x41c81d,_0x5d6abf,_0x2208d8){var _0x2b096e={};var _0x4e6da6={};var _0x53817f;var _0x10955f;return db[_0x4d4f('0x4c')][_0x4d4f('0x7c')]({'where':{'id':_0x41c81d['params']['id']}})['then'](handleEntityNotFound(_0x5d6abf,null))[_0x4d4f('0x2c')](function(_0x274ff2){if(_0x274ff2){_0x53817f=_0x274ff2;_0x4e6da6[_0x4d4f('0x3d')]=_[_0x4d4f('0x50')](db['Team'][_0x4d4f('0x36')]);_0x4e6da6[_0x4d4f('0x3b')]=_[_0x4d4f('0x50')](_0x41c81d['query']);_0x4e6da6['filters']=_[_0x4d4f('0x3c')](_0x4e6da6[_0x4d4f('0x3d')],_0x4e6da6[_0x4d4f('0x3b')]);_0x2b096e[_0x4d4f('0x3e')]=_[_0x4d4f('0x3c')](_0x4e6da6['model'],qs[_0x4d4f('0x3f')](_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x3f')]));_0x2b096e['attributes']=_0x2b096e[_0x4d4f('0x3e')]['length']?_0x2b096e[_0x4d4f('0x3e')]:_0x4e6da6[_0x4d4f('0x3d')];_0x2b096e[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x41c81d[_0x4d4f('0x3b')]['sort']);_0x2b096e[_0x4d4f('0x45')]=qs[_0x4d4f('0x46')](_[_0x4d4f('0x7e')](_0x41c81d[_0x4d4f('0x3b')],_0x4e6da6['filters']));if(_0x41c81d[_0x4d4f('0x3b')]['filter']){_0x2b096e['where']=_[_0x4d4f('0x48')](_0x2b096e[_0x4d4f('0x45')],{'$or':_['map'](_0x2b096e[_0x4d4f('0x3e')],function(_0x50b0a3){var _0x1177a3={};_0x1177a3[_0x50b0a3]={'$like':'%'+_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x47')]+'%'};return _0x1177a3;})});}_0x2b096e=_[_0x4d4f('0x48')]({},_0x2b096e,_0x41c81d[_0x4d4f('0x49')]);return _0x53817f[_0x4d4f('0x7f')](_0x2b096e);}})[_0x4d4f('0x2c')](function(_0x3fe348){if(_0x3fe348){_0x10955f=_0x3fe348['length'];if(!_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x40')]('nolimit')){_0x2b096e[_0x4d4f('0x26')]=qs['limit'](_0x41c81d[_0x4d4f('0x3b')][_0x4d4f('0x26')]);_0x2b096e[_0x4d4f('0x42')]=qs['offset'](_0x41c81d['query']['offset']);}return _0x53817f[_0x4d4f('0x7f')](_0x2b096e);}})['then'](function(_0xb5d71b){if(_0xb5d71b){return _0xb5d71b?{'count':_0x10955f,'rows':_0xb5d71b}:null;}})[_0x4d4f('0x2c')](respondWithResult(_0x5d6abf,null))[_0x4d4f('0x4e')](handleError(_0x5d6abf,null));};exports['addTeams']=function(_0x5b6061,_0x230ff0,_0x28ae80){var _0x42be25=_0x5b6061[_0x4d4f('0x56')][_0x4d4f('0x73')];var _0x13279e;return db['Team'][_0x4d4f('0x80')]({'where':{'id':_0x42be25},'attributes':['id'],'include':[{'model':db[_0x4d4f('0x7d')],'as':_0x4d4f('0x81'),'attributes':['id',_0x4d4f('0x33'),_0x4d4f('0x82'),_0x4d4f('0x83'),_0x4d4f('0x84')],'raw':!![]}]})[_0x4d4f('0x2c')](function(_0x1a1e6f){if(_0x1a1e6f){_0x13279e=_0x1a1e6f;var _0x152400=_[_0x4d4f('0x85')](_0x1a1e6f,function(_0x3c6f1b){var _0x25e63c=_0x3c6f1b[_0x4d4f('0x2e')]({'plain':!![]});return _0x25e63c['Agents'];});return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x5b6061[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](function(_0xc01ac4){return db[_0x4d4f('0x54')][_0x4d4f('0x86')](function(_0x472938){return _0xc01ac4[_0x4d4f('0x87')](_0x42be25,{'transaction':_0x472938})['then'](function(){return BPromise[_0x4d4f('0x88')](_0x13279e,function(_0x72d583){return db[_0x4d4f('0x89')][_0x4d4f('0x8a')]({'TeamId':_0x72d583['id'],'VoicePrefixId':_0x5b6061[_0x4d4f('0x52')]['id']},{'transaction':_0x472938});});})[_0x4d4f('0x2c')](function(){return BPromise[_0x4d4f('0x88')](_0x152400,function(_0x28fd35){return db[_0x4d4f('0x8b')][_0x4d4f('0x8c')]({'where':{'UserId':_0x28fd35['id'],'VoicePrefixId':_0x5b6061['params']['id']},'transaction':_0x472938});});})['then'](function(){_0x152400[_0x4d4f('0x8d')](function(_0x8850a4){socket['emit'](_0x4d4f('0x77'),{'UserId':_0x8850a4['id'],'VoicePrefixId':_0xc01ac4['id']});});});});});}})[_0x4d4f('0x2c')](respondWithStatusCode(_0x230ff0,null))[_0x4d4f('0x4e')](handleError(_0x230ff0,null));};exports[_0x4d4f('0x8e')]=function(_0x15028c,_0x1659f6,_0x77dac1){return db[_0x4d4f('0x8f')][_0x4d4f('0x80')]({'where':{'id':_0x15028c[_0x4d4f('0x3b')][_0x4d4f('0x73')]},'attributes':['id'],'include':[{'model':db[_0x4d4f('0x7d')],'as':_0x4d4f('0x81'),'attributes':['id'],'raw':!![]}]})[_0x4d4f('0x2c')](handleEntityNotFound(_0x1659f6,null))['then'](function(_0x342b63){var _0x524ed0=_[_0x4d4f('0x3a')](_0x342b63,'id');var _0x3fd499=[];var _0x17a39f=[];var _0x27b4d6=squel['select']();_0x27b4d6[_0x4d4f('0x90')](_0x4d4f('0x91'))[_0x4d4f('0x92')](_0x4d4f('0x93'),'tq')[_0x4d4f('0x94')](_0x4d4f('0x95'),'ut',_0x4d4f('0x96'))['where'](_0x4d4f('0x97'),_0x15028c[_0x4d4f('0x52')]['id']);for(var _0x2f4bad=0x0;_0x2f4bad<_0x342b63[_0x4d4f('0x6e')];_0x2f4bad+=0x1){let _0x4501b5=_0x342b63[_0x2f4bad];for(var _0x12eda1=0x0;_0x12eda1<_0x4501b5['Agents']['length'];_0x12eda1+=0x1){let _0x11ee76=_0x4501b5['Agents'][_0x12eda1];var _0x2ea6b4=_0x27b4d6[_0x4d4f('0x98')]();_0x2ea6b4['where'](_0x4d4f('0x99'),_0x11ee76['id']);_0x17a39f[_0x4d4f('0x68')](db[_0x4d4f('0x54')][_0x4d4f('0x3b')](_0x2ea6b4[_0x4d4f('0x9a')](),{'type':db[_0x4d4f('0x54')][_0x4d4f('0x9b')]['SELECT']})[_0x4d4f('0x2c')](function(_0x5d05cb){if(_0x5d05cb[_0x4d4f('0x6e')]===0x1){return _0x11ee76['id'];}else{var _0x2d1337=_['every'](_['map'](_0x5d05cb,_0x4d4f('0x9c')),function(_0x17894c){return _[_0x4d4f('0x9d')](_0x524ed0,_0x17894c);});if(_0x2d1337){return _0x11ee76['id'];}}}));}}return BPromise['all'](_0x17a39f)[_0x4d4f('0x2c')](function(_0x118642){_0x3fd499=_(_0x3fd499)[_0x4d4f('0x9e')](_0x118642)[_0x4d4f('0x9f')]()[_0x4d4f('0xa0')]();return db[_0x4d4f('0x4c')][_0x4d4f('0x51')]({'where':{'id':_0x15028c[_0x4d4f('0x52')]['id']}})[_0x4d4f('0x2c')](function(_0x51e70f){return db[_0x4d4f('0x54')][_0x4d4f('0x86')](function(_0x23485f){return _0x51e70f[_0x4d4f('0x8e')](_0x15028c['query'][_0x4d4f('0x73')],{'transaction':_0x23485f})['then'](function(){if(!_['isEmpty'](_0x3fd499)){return _0x51e70f[_0x4d4f('0x78')](_0x3fd499,{'transaction':_0x23485f});}})[_0x4d4f('0x2c')](function(){_0x3fd499[_0x4d4f('0x8d')](function(_0x3de9b3){socket[_0x4d4f('0x76')](_0x4d4f('0x7a'),{'UserId':_0x3de9b3,'VoicePrefixId':_0x51e70f['id']});});});});});});})[_0x4d4f('0x2c')](respondWithStatusCode(_0x1659f6,null))[_0x4d4f('0x4e')](handleError(_0x1659f6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7828028..322f449 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 _0xaecf=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x3efeba,_0x156afe){var _0x410943=function(_0x2165be){while(--_0x2165be){_0x3efeba['push'](_0x3efeba['shift']());}};_0x410943(++_0x156afe);}(_0xaecf,0xec));var _0xfaec=function(_0x2bbf56,_0x403efd){_0x2bbf56=_0x2bbf56-0x0;var _0x250388=_0xaecf[_0x2bbf56];return _0x250388;};'use strict';var EventEmitter=require(_0xfaec('0x0'));var VoicePrefix=require(_0xfaec('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfaec('0x2'),'afterUpdate':_0xfaec('0x3'),'afterDestroy':_0xfaec('0x4')};function emitEvent(_0x148ae6){return function(_0x4de3e0,_0x5d6293,_0x30ca5f){VoicePrefixEvents[_0xfaec('0x5')](_0x148ae6+':'+_0x4de3e0['id'],_0x4de3e0);VoicePrefixEvents[_0xfaec('0x5')](_0x148ae6,_0x4de3e0);_0x30ca5f(null);};}for(var e in events){if(events[_0xfaec('0x6')](e)){var event=events[e];VoicePrefix[_0xfaec('0x7')](e,emitEvent(event));}}module[_0xfaec('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x51fe=['../../mysqldb','VoicePrefix','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x2eefd9,_0x476af9){var _0x4edd42=function(_0x579e0d){while(--_0x579e0d){_0x2eefd9['push'](_0x2eefd9['shift']());}};_0x4edd42(++_0x476af9);}(_0x51fe,0x1d0));var _0xe51f=function(_0x43fa6b,_0x4ff948){_0x43fa6b=_0x43fa6b-0x0;var _0x203aaf=_0x51fe[_0x43fa6b];return _0x203aaf;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xe51f('0x0'))['db'][_0xe51f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe51f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe51f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x163bbd){return function(_0x27d8a7,_0x590b8c,_0x318997){VoicePrefixEvents[_0xe51f('0x4')](_0x163bbd+':'+_0x27d8a7['id'],_0x27d8a7);VoicePrefixEvents[_0xe51f('0x4')](_0x163bbd,_0x27d8a7);_0x318997(null);};}for(var e in events){if(events[_0xe51f('0x5')](e)){var event=events[e];VoicePrefix[_0xe51f('0x6')](e,emitEvent(event));}}module[_0xe51f('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6777bbb..92274af 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 _0xb2ec=['exports','VoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xb2ec,0x1f1));var _0xcb2e=function(_0x57e5c5,_0xc7bc4b){_0x57e5c5=_0x57e5c5-0x0;var _0x37ae8e=_0xb2ec[_0x57e5c5];return _0x37ae8e;};'use strict';var _=require(_0xcb2e('0x0'));var util=require(_0xcb2e('0x1'));var logger=require(_0xcb2e('0x2'))('api');var moment=require(_0xcb2e('0x3'));var BPromise=require(_0xcb2e('0x4'));var rp=require(_0xcb2e('0x5'));var fs=require('fs');var path=require(_0xcb2e('0x6'));var rimraf=require(_0xcb2e('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb2e('0x8'));module[_0xcb2e('0x9')]=function(_0x195c0f,_0x6561b0){return _0x195c0f['define'](_0xcb2e('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f79=['request-promise','path','./voicePrefix.attributes','VoicePrefix','lodash','../../config/logger','api','moment','bluebird'];(function(_0x289296,_0x554625){var _0x2cd205=function(_0x54ca87){while(--_0x54ca87){_0x289296['push'](_0x289296['shift']());}};_0x2cd205(++_0x554625);}(_0x2f79,0x12d));var _0x92f7=function(_0x47820f,_0x134475){_0x47820f=_0x47820f-0x0;var _0x515d10=_0x2f79[_0x47820f];return _0x515d10;};'use strict';var _=require(_0x92f7('0x0'));var util=require('util');var logger=require(_0x92f7('0x1'))(_0x92f7('0x2'));var moment=require(_0x92f7('0x3'));var BPromise=require(_0x92f7('0x4'));var rp=require(_0x92f7('0x5'));var fs=require('fs');var path=require(_0x92f7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92f7('0x7'));module['exports']=function(_0x21c8a7,_0x8638f4){return _0x21c8a7['define'](_0x92f7('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 3dde175..949913a 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 _0xce68=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x57d0dc,_0x387f3e){var _0x177765=function(_0x1bbc9e){while(--_0x1bbc9e){_0x57d0dc['push'](_0x57d0dc['shift']());}};_0x177765(++_0x387f3e);}(_0xce68,0x10c));var _0x8ce6=function(_0x3cf47d,_0x5cee4e){_0x3cf47d=_0x3cf47d-0x0;var _0x45a3d5=_0xce68[_0x3cf47d];return _0x45a3d5;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var moment=require(_0x8ce6('0x1'));var BPromise=require(_0x8ce6('0x2'));var rs=require(_0x8ce6('0x3'));var fs=require('fs');var Redis=require(_0x8ce6('0x4'));var db=require(_0x8ce6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ce6('0x6'))(_0x8ce6('0x7'));var config=require(_0x8ce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ce6('0x9')][_0x8ce6('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8ce6('0xb')],{'host':_0x8ce6('0xc'),'port':0x18eb});var socket=require(_0x8ce6('0xd'))(new Redis(config[_0x8ce6('0xb')]));require('./voicePrefix.socket')[_0x8ce6('0xe')](socket);function respondWithRpcPromise(_0x188e3c,_0x41618c,_0x3ef3d6){return new BPromise(function(_0x385973,_0xce7cb8){return client[_0x8ce6('0xf')](_0x188e3c,_0x3ef3d6)[_0x8ce6('0x10')](function(_0x442f4e){logger[_0x8ce6('0x11')](_0x8ce6('0x12'),_0x41618c,_0x8ce6('0x13'));logger[_0x8ce6('0x14')](_0x8ce6('0x15'),_0x41618c,_0x8ce6('0x13'),JSON[_0x8ce6('0x16')](_0x442f4e));if(_0x442f4e[_0x8ce6('0x17')]){if(_0x442f4e[_0x8ce6('0x17')]['code']===0x1f4){logger[_0x8ce6('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x41618c,_0x442f4e[_0x8ce6('0x17')][_0x8ce6('0x18')]);return _0xce7cb8(_0x442f4e[_0x8ce6('0x17')][_0x8ce6('0x18')]);}logger[_0x8ce6('0x17')](_0x8ce6('0x12'),_0x41618c,_0x442f4e[_0x8ce6('0x17')][_0x8ce6('0x18')]);return _0x385973(_0x442f4e[_0x8ce6('0x17')][_0x8ce6('0x18')]);}else{logger['info'](_0x8ce6('0x12'),_0x41618c,'request\x20sent');_0x385973(_0x442f4e[_0x8ce6('0x19')][_0x8ce6('0x18')]);}})[_0x8ce6('0x1a')](function(_0x50e2f7){logger['error'](_0x8ce6('0x12'),_0x41618c,_0x50e2f7);_0xce7cb8(_0x50e2f7);});});} \ No newline at end of file +var _0x5a99=['error','message','result','catch','VoicePrefix,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x51cc0e,_0xbcd39c){var _0x1694a3=function(_0x152c66){while(--_0x152c66){_0x51cc0e['push'](_0x51cc0e['shift']());}};_0x1694a3(++_0xbcd39c);}(_0x5a99,0xc9));var _0x95a9=function(_0x4d203e,_0x5dbf63){_0x4d203e=_0x4d203e-0x0;var _0x49d6b3=_0x5a99[_0x4d203e];return _0x49d6b3;};'use strict';var _=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var moment=require(_0x95a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x95a9('0x3'));var fs=require('fs');var Redis=require(_0x95a9('0x4'));var db=require(_0x95a9('0x5'))['db'];var utils=require(_0x95a9('0x6'));var logger=require('../../config/logger')(_0x95a9('0x7'));var config=require(_0x95a9('0x8'));var jayson=require(_0x95a9('0x9'));var client=jayson[_0x95a9('0xa')]['http']({'port':0x232a});config[_0x95a9('0xb')]=_[_0x95a9('0xc')](config[_0x95a9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x95a9('0xd'))(new Redis(config['redis']));require(_0x95a9('0xe'))[_0x95a9('0xf')](socket);function respondWithRpcPromise(_0x48d5f0,_0x2be9a2,_0xc0e40d){return new BPromise(function(_0x4de148,_0x4aedae){return client[_0x95a9('0x10')](_0x48d5f0,_0xc0e40d)[_0x95a9('0x11')](function(_0x4de6ba){logger[_0x95a9('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2be9a2,_0x95a9('0x13'));logger[_0x95a9('0x14')](_0x95a9('0x15'),_0x2be9a2,_0x95a9('0x13'),JSON[_0x95a9('0x16')](_0x4de6ba));if(_0x4de6ba['error']){if(_0x4de6ba['error']['code']===0x1f4){logger[_0x95a9('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2be9a2,_0x4de6ba[_0x95a9('0x17')][_0x95a9('0x18')]);return _0x4aedae(_0x4de6ba[_0x95a9('0x17')]['message']);}logger[_0x95a9('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2be9a2,_0x4de6ba[_0x95a9('0x17')][_0x95a9('0x18')]);return _0x4de148(_0x4de6ba[_0x95a9('0x17')]['message']);}else{logger[_0x95a9('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2be9a2,'request\x20sent');_0x4de148(_0x4de6ba[_0x95a9('0x19')][_0x95a9('0x18')]);}})[_0x95a9('0x1a')](function(_0x183a64){logger[_0x95a9('0x17')](_0x95a9('0x1b'),_0x2be9a2,_0x183a64);_0x4aedae(_0x183a64);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 52e0dde..49defa0 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 _0xd52a=['removeListener','voicePrefix:','save','update','emit'];(function(_0x2866ab,_0x430d65){var _0xb696b6=function(_0x4cbc75){while(--_0x4cbc75){_0x2866ab['push'](_0x2866ab['shift']());}};_0xb696b6(++_0x430d65);}(_0xd52a,0xca));var _0xad52=function(_0x45cdcd,_0x519b6b){_0x45cdcd=_0x45cdcd-0x0;var _0xa8df81=_0xd52a[_0x45cdcd];return _0xa8df81;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xad52('0x0'),'remove',_0xad52('0x1')];function createListener(_0x7b9789,_0x30b335){return function(_0x572592){_0x30b335[_0xad52('0x2')](_0x7b9789,_0x572592);};}function removeListener(_0x383c44,_0x130d6d){return function(){VoicePrefixEvents[_0xad52('0x3')](_0x383c44,_0x130d6d);};}exports['register']=function(_0x525806){for(var _0x51bdaa=0x0,_0x1ad70b=events['length'];_0x51bdaa<_0x1ad70b;_0x51bdaa++){var _0x23fc23=events[_0x51bdaa];var _0x4bbff0=createListener(_0xad52('0x4')+_0x23fc23,_0x525806);VoicePrefixEvents['on'](_0x23fc23,_0x4bbff0);}}; \ No newline at end of file +var _0x9bc3=['save','remove','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x4fb9fa,_0xc7130b){var _0x3a440d=function(_0x48c187){while(--_0x48c187){_0x4fb9fa['push'](_0x4fb9fa['shift']());}};_0x3a440d(++_0xc7130b);}(_0x9bc3,0x137));var _0x39bc=function(_0xc376e1,_0x1a2b83){_0xc376e1=_0xc376e1-0x0;var _0x63e01c=_0x9bc3[_0xc376e1];return _0x63e01c;};'use strict';var VoicePrefixEvents=require(_0x39bc('0x0'));var events=[_0x39bc('0x1'),_0x39bc('0x2'),'update'];function createListener(_0x45a9bb,_0x168290){return function(_0x2551d6){_0x168290[_0x39bc('0x3')](_0x45a9bb,_0x2551d6);};}function removeListener(_0x4febc0,_0xdce94f){return function(){VoicePrefixEvents[_0x39bc('0x4')](_0x4febc0,_0xdce94f);};}exports[_0x39bc('0x5')]=function(_0x442ec9){for(var _0x5805da=0x0,_0x38d6ce=events[_0x39bc('0x6')];_0x5805da<_0x38d6ce;_0x5805da++){var _0x86cff3=events[_0x5805da];var _0x10be27=createListener(_0x39bc('0x7')+_0x86cff3,_0x442ec9);VoicePrefixEvents['on'](_0x86cff3,_0x10be27);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 910c00d..e530e22 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(_0x4186fa,_0x26a01c){var _0x136990=function(_0x13324f){while(--_0x13324f){_0x4186fa['push'](_0x4186fa['shift']());}};_0x136990(++_0x26a01c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0xb10b,0x12a));var _0xbb10=function(_0x56b913,_0x3ddf4e){_0x56b913=_0x56b913-0x0;var _0x4d2bcf=_0xb10b[_0x56b913];return _0x4d2bcf;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0b76cc4..61a4cf4 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 _0xa4e7=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','ENUM','outbound','inbound','STRING','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','strategy','INTEGER','yes','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','acw','wrapuptime','BOOLEAN','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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\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','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x17a0ad,_0x3d7cd2){var _0x490068=function(_0x58170e){while(--_0x58170e){_0x17a0ad['push'](_0x17a0ad['shift']());}};_0x490068(++_0x3d7cd2);}(_0xa4e7,0xf0));var _0x7a4e=function(_0x36dc24,_0x38dc87){_0x36dc24=_0x36dc24-0x0;var _0x5c5f03=_0xa4e7[_0x36dc24];return _0x5c5f03;};'use strict';var Sequelize=require('sequelize');module[_0x7a4e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7a4e('0x1')]('inbound',_0x7a4e('0x2')),'allowNull':![],'defaultValue':_0x7a4e('0x3')},'musiconhold':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x7a4e('0x5'),'leastrecent',_0x7a4e('0x6'),_0x7a4e('0x7'),_0x7a4e('0x8'),_0x7a4e('0x9'),_0x7a4e('0xa'),_0x7a4e('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4aa904){this[_0x7a4e('0xc')]('strategy',_0x4aa904?_0x4aa904:_0x7a4e('0x8'));},'get':function(){var _0x5ceb28=this[_0x7a4e('0xd')](_0x7a4e('0xe'));var _0x34d920=this[_0x7a4e('0xd')](_0x7a4e('0xf'));var _0x4b400b=this[_0x7a4e('0xd')]('strategy');if(_0x5ceb28===_0x7a4e('0x2')){if(_0x34d920===_0x7a4e('0x10')){return null;}if(_0x34d920===_0x7a4e('0x11')&&![_0x7a4e('0x8'),_0x7a4e('0x12')][_0x7a4e('0x13')](_0x4b400b)){this[_0x7a4e('0xc')](_0x7a4e('0x14'),_0x7a4e('0x8'));}}return _0x4b400b;}},'servicelevel':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7a4e('0x15')](0xb)},'timeout':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7a4e('0x4')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7a4e('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7a4e('0x1')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7a4e('0x1')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7a4e('0x1')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7a4e('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7a4e('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x7a4e('0x16'),'no'),'defaultValue':_0x7a4e('0x16')},'announce_holdtime':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7a4e('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x7a4e('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7a4e('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7a4e('0x4')]},'queue_youarenext':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7a4e('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7a4e('0x4')]},'queue_quantity1':{'type':Sequelize[_0x7a4e('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7a4e('0x4')]},'queue_less_than':{'type':Sequelize[_0x7a4e('0x4')]},'periodic_announce':{'type':Sequelize[_0x7a4e('0x17')],'set':function(_0x77e057){this['setDataValue'](_0x7a4e('0x18'),_0x77e057?_0x77e057['join'](','):[]);},'get':function(){return this[_0x7a4e('0xd')](_0x7a4e('0x18'))?this['getDataValue']('periodic_announce')[_0x7a4e('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':_0x7a4e('0x16'),'set':function(_0x12c8a6){this[_0x7a4e('0xc')](_0x7a4e('0x1a'),_0x12c8a6?_0x12c8a6[_0x7a4e('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x7a4e('0x1a'))?this[_0x7a4e('0xd')](_0x7a4e('0x1a'))[_0x7a4e('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':'no','set':function(_0x5b0250){this[_0x7a4e('0xc')]('leavewhenempty',_0x5b0250?_0x5b0250[_0x7a4e('0x1b')](','):undefined);},'get':function(){return this[_0x7a4e('0xd')](_0x7a4e('0x1c'))?this[_0x7a4e('0xd')](_0x7a4e('0x1c'))[_0x7a4e('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7a4e('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x45f8d3){this[_0x7a4e('0xc')](_0x7a4e('0x1d'),_0x45f8d3);if(_0x45f8d3){if(this['getDataValue'](_0x7a4e('0x1e'))<0x2){this['setDataValue'](_0x7a4e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7a4e('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x10'),'progressive',_0x7a4e('0x20'),_0x7a4e('0x21'),'booked'),'defaultValue':_0x7a4e('0x22'),'comment':_0x7a4e('0x23')},'dialLimitChannel':{'type':Sequelize[_0x7a4e('0x15')](0x4)[_0x7a4e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7a4e('0x25')},'dialLimitQueue':{'type':Sequelize[_0x7a4e('0x15')](0x4)[_0x7a4e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7a4e('0x26')},'dialPowerLevel':{'type':Sequelize[_0x7a4e('0x27')](0x2)[_0x7a4e('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7a4e('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x7a4e('0x1')]('agentBusyFactor',_0x7a4e('0x29')),'defaultValue':_0x7a4e('0x29'),'comment':_0x7a4e('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7a4e('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x7a4e('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7a4e('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7a4e('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x7a4e('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x7a4e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a4e('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a4e('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a4e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7a4e('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':_0x7a4e('0x35')},'dialPrefix':{'type':Sequelize[_0x7a4e('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x7a4e('0x36'),_0x7a4e('0x37'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':0x0,'comment':_0x7a4e('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x7a4e('0x15')](0x9)[_0x7a4e('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7a4e('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x7a4e('0x15')](0x9)[_0x7a4e('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7a4e('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7a4e('0x15')](0x9)[_0x7a4e('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7a4e('0x15')](0x9)[_0x7a4e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7a4e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7a4e('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7a4e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7a4e('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7a4e('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7a4e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x7a4e('0x15')](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7a4e('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7a4e('0x1')](_0x7a4e('0x3f'),_0x7a4e('0x40')),'defaultValue':_0x7a4e('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x7a4e('0x4')],'comment':_0x7a4e('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x7a4e('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7a4e('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7a4e('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7a4e('0x15')](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x7a4e('0x15')](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a4e('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7a4e('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a4e('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a4e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7a4e('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a4e('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a4e('0x15')],'allowNull':!![],'comment':_0x7a4e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':![],'comment':_0x7a4e('0x4a'),'set':function(_0x3556f8){if(!_0x3556f8)this[_0x7a4e('0xc')](_0x7a4e('0x4b'),null);this[_0x7a4e('0xc')](_0x7a4e('0x4c'),_0x3556f8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7a4e('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7a4e('0x15')](0x3)[_0x7a4e('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7a4e('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x875b=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','ringall','leastrecent','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','roundrobin','includes','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','#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\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x875b,0x174));var _0xb875=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x875b[_0xd1b4d7];return _0x3002ec;};'use strict';var Sequelize=require(_0xb875('0x0'));module[_0xb875('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb875('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x4'),_0xb875('0x5')),'allowNull':![],'defaultValue':_0xb875('0x4')},'musiconhold':{'type':Sequelize[_0xb875('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xb875('0x7'),_0xb875('0x8'),'fewestcalls','random',_0xb875('0x9'),_0xb875('0xa'),'wrandom',_0xb875('0xb')),'allowNull':![],'defaultValue':_0xb875('0x7'),'set':function(_0x20ddd4){this[_0xb875('0xc')](_0xb875('0xd'),_0x20ddd4?_0x20ddd4:'rrmemory');},'get':function(){var _0x5e8707=this[_0xb875('0xe')](_0xb875('0xf'));var _0x21447d=this[_0xb875('0xe')]('dialMethod');var _0x3065f1=this[_0xb875('0xe')](_0xb875('0xd'));if(_0x5e8707===_0xb875('0x5')){if(_0x21447d==='preview'){return null;}if(_0x21447d==='booked'&&![_0xb875('0x9'),_0xb875('0x10')][_0xb875('0x11')](_0x3065f1)){this['setDataValue'](_0xb875('0xd'),'rrmemory');}}return _0x3065f1;}},'servicelevel':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xb875('0x12')](0xb)},'timeout':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb875('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':_0xb875('0x13')},'autopause':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no',_0xb875('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xb875('0x12')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xb875('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xb875('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xb875('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xb875('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':_0xb875('0x13')},'announce_holdtime':{'type':Sequelize[_0xb875('0x3')]('yes','no',_0xb875('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb875('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0xb875('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb875('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb875('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xb875('0x6')]},'queue_quantity1':{'type':Sequelize[_0xb875('0x6')]},'queue_quantity2':{'type':Sequelize[_0xb875('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0xb875('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xe0af2c){this[_0xb875('0xc')]('periodic_announce',_0xe0af2c?_0xe0af2c['join'](','):[]);},'get':function(){return this[_0xb875('0xe')](_0xb875('0x16'))?this[_0xb875('0xe')](_0xb875('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xb875('0x6')],'defaultValue':'yes','set':function(_0x5b7f40){this['setDataValue']('joinempty',_0x5b7f40?_0x5b7f40[_0xb875('0x17')](','):undefined);},'get':function(){return this[_0xb875('0xe')](_0xb875('0x18'))?this[_0xb875('0xe')](_0xb875('0x18'))[_0xb875('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb875('0x6')],'defaultValue':'no','set':function(_0xf4e211){this['setDataValue'](_0xb875('0x1a'),_0xf4e211?_0xf4e211[_0xb875('0x17')](','):undefined);},'get':function(){return this[_0xb875('0xe')](_0xb875('0x1a'))?this[_0xb875('0xe')]('leavewhenempty')[_0xb875('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xb875('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb875('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':0x0,'set':function(_0x15b300){this[_0xb875('0xc')]('acw',_0x15b300);if(_0x15b300){if(this[_0xb875('0xe')](_0xb875('0x1c'))<0x2){this[_0xb875('0xc')](_0xb875('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xb875('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb875('0x1d')},'dialMethod':{'type':Sequelize[_0xb875('0x3')]('preview',_0xb875('0x1e'),_0xb875('0x1f'),'predictive',_0xb875('0x20')),'defaultValue':_0xb875('0x1e'),'comment':_0xb875('0x21')},'dialLimitChannel':{'type':Sequelize[_0xb875('0x12')](0x4)[_0xb875('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb875('0x23')},'dialLimitQueue':{'type':Sequelize[_0xb875('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xb875('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xb875('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x26'),'dropRate'),'defaultValue':_0xb875('0x27'),'comment':_0xb875('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xb875('0x24')](0x2)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xb875('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xb875('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb875('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb875('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xb875('0x12')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xb875('0x6')],'defaultValue':_0xb875('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x2c')},'dialQueueProject':{'type':Sequelize[_0xb875('0x6')],'comment':_0xb875('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb875('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)[_0xb875('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb875('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'comment':_0xb875('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)[_0xb875('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb875('0x33')},'dialTimezone':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xb875('0x34')},'dialPrefix':{'type':Sequelize[_0xb875('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb875('0x3')]('always',_0xb875('0x35'),_0xb875('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb875('0x12')](0x9)[_0xb875('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb875('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xb875('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb875('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb875('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb875('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb875('0x12')](0x9)[_0xb875('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb875('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xb875('0x12')](0x9)[_0xb875('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb875('0x12')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb875('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb875('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb875('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xb875('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb875('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb875('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xb875('0x12')](0x5)[_0xb875('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':0x0,'comment':_0xb875('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb875('0x3')](_0xb875('0x3f'),'ASC'),'defaultValue':_0xb875('0x3f')},'dialQueueProject2':{'type':Sequelize[_0xb875('0x6')],'comment':_0xb875('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)[_0xb875('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb875('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb875('0x43')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb875('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb875('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb875('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb875('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xb875('0x47')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2052b0){if(!_0x2052b0)this[_0xb875('0xc')](_0xb875('0x48'),null);this[_0xb875('0xc')](_0xb875('0x49'),_0x2052b0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xb875('0x12')](0x3)[_0xb875('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xb875('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb875('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index dbf9017..674efc0 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 _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x1cb9,0x14e));var _0x91cb=function(_0x42a537,_0x1872bf){_0x42a537=_0x42a537-0x0;var _0x43eeac=_0x1cb9[_0x42a537];return _0x43eeac;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file +var _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x4ab120,_0x3756ed){var _0x18aa1b=function(_0xcd770a){while(--_0xcd770a){_0x4ab120['push'](_0x4ab120['shift']());}};_0x18aa1b(++_0x3756ed);}(_0x55ca,0x126));var _0xa55c=function(_0x80544e,_0x37a3f3){_0x80544e=_0x80544e-0x0;var _0x4f9b90=_0x55ca[_0x80544e];return _0x4f9b90;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 33f1743..748f69e 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 _0x35bf=['remove','emit','exports','events','VoiceQueue','setMaxListeners','save','update'];(function(_0x29a29d,_0x1480ee){var _0x53b8e1=function(_0x2cbeca){while(--_0x2cbeca){_0x29a29d['push'](_0x29a29d['shift']());}};_0x53b8e1(++_0x1480ee);}(_0x35bf,0x103));var _0xf35b=function(_0x2c10ab,_0x3dce73){_0x2c10ab=_0x2c10ab-0x0;var _0x51d80f=_0x35bf[_0x2c10ab];return _0x51d80f;};'use strict';var EventEmitter=require(_0xf35b('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xf35b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf35b('0x2')](0x0);var events={'afterCreate':_0xf35b('0x3'),'afterUpdate':_0xf35b('0x4'),'afterDestroy':_0xf35b('0x5')};function emitEvent(_0x16394f){return function(_0xeea688,_0x1daddb,_0x54e328){VoiceQueueEvents[_0xf35b('0x6')](_0x16394f+':'+_0xeea688['id'],_0xeea688);VoiceQueueEvents['emit'](_0x16394f,_0xeea688);_0x54e328(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf35b('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x79ae=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit'];(function(_0x15ad81,_0x1114f9){var _0x42e08b=function(_0x39d824){while(--_0x39d824){_0x15ad81['push'](_0x15ad81['shift']());}};_0x42e08b(++_0x1114f9);}(_0x79ae,0x16a));var _0xe79a=function(_0x52f71c,_0x37e8c7){_0x52f71c=_0x52f71c-0x0;var _0x12e798=_0x79ae[_0x52f71c];return _0x12e798;};'use strict';var EventEmitter=require(_0xe79a('0x0'));var VoiceQueue=require(_0xe79a('0x1'))['db'][_0xe79a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe79a('0x3')](0x0);var events={'afterCreate':_0xe79a('0x4'),'afterUpdate':'update','afterDestroy':_0xe79a('0x5')};function emitEvent(_0xbd096){return function(_0x1838ae,_0x43d615,_0x1d1a8e){VoiceQueueEvents['emit'](_0xbd096+':'+_0x1838ae['id'],_0x1838ae);VoiceQueueEvents[_0xe79a('0x6')](_0xbd096,_0x1838ae);_0x1d1a8e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe79a('0x7')](e,emitEvent(event));}}module[_0xe79a('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 37ab7c5..a679db1 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x55ca,0x126));var _0xa55c=function(_0x53b398,_0x39bfd8){_0x53b398=_0x53b398-0x0;var _0x32c9ed=_0x55ca[_0x53b398];return _0x32c9ed;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x3189b1,_0x9c1fe1){var _0x5a0266=function(_0x2ed603){while(--_0x2ed603){_0x3189b1['push'](_0x3189b1['shift']());}};_0x5a0266(++_0x9c1fe1);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 5bf9d5a..81eeeaf 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 _0x2495=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','model','attributes','map','ShowVoiceQueue','find','info','lodash','util','moment','bluebird','ioredis'];(function(_0x185888,_0x598920){var _0x537760=function(_0x34574b){while(--_0x34574b){_0x185888['push'](_0x185888['shift']());}};_0x537760(++_0x598920);}(_0x2495,0x1f3));var _0x5249=function(_0x6b823f,_0x414adb){_0x6b823f=_0x6b823f-0x0;var _0x24eff1=_0x2495[_0x6b823f];return _0x24eff1;};'use strict';var _=require(_0x5249('0x0'));var util=require(_0x5249('0x1'));var moment=require(_0x5249('0x2'));var BPromise=require(_0x5249('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5249('0x4'));var db=require(_0x5249('0x5'))['db'];var utils=require(_0x5249('0x6'));var logger=require(_0x5249('0x7'))(_0x5249('0x8'));var config=require(_0x5249('0x9'));var jayson=require(_0x5249('0xa'));var client=jayson[_0x5249('0xb')]['http']({'port':0x232a});config[_0x5249('0xc')]=_[_0x5249('0xd')](config['redis'],{'host':_0x5249('0xe'),'port':0x18eb});var socket=require(_0x5249('0xf'))(new Redis(config[_0x5249('0xc')]));require('./voiceQueue.socket')[_0x5249('0x10')](socket);function respondWithRpcPromise(_0x3ebbeb,_0xc7ebde,_0x286128){return new BPromise(function(_0x512918,_0x415b01){return client[_0x5249('0x11')](_0x3ebbeb,_0x286128)[_0x5249('0x12')](function(_0x45b657){logger['info']('VoiceQueue,\x20%s,\x20%s',_0xc7ebde,_0x5249('0x13'));logger[_0x5249('0x14')](_0x5249('0x15'),_0xc7ebde,'request\x20sent',JSON[_0x5249('0x16')](_0x45b657));if(_0x45b657[_0x5249('0x17')]){if(_0x45b657['error'][_0x5249('0x18')]===0x1f4){logger[_0x5249('0x17')](_0x5249('0x19'),_0xc7ebde,_0x45b657['error'][_0x5249('0x1a')]);return _0x415b01(_0x45b657[_0x5249('0x17')][_0x5249('0x1a')]);}logger[_0x5249('0x17')](_0x5249('0x19'),_0xc7ebde,_0x45b657[_0x5249('0x17')]['message']);return _0x512918(_0x45b657[_0x5249('0x17')]['message']);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0xc7ebde,_0x5249('0x13'));_0x512918(_0x45b657[_0x5249('0x1b')]['message']);}})[_0x5249('0x1c')](function(_0x27bd79){logger['error'](_0x5249('0x19'),_0xc7ebde,_0x27bd79);_0x415b01(_0x27bd79);});});}exports[_0x5249('0x1d')]=function(_0x13582f){var _0x1c0e41=this;return new Promise(function(_0xac635e,_0x5bb4aa){return db[_0x5249('0x1e')][_0x5249('0x1f')]({'raw':_0x13582f[_0x5249('0x20')]?_0x13582f[_0x5249('0x20')][_0x5249('0x21')]===undefined?!![]:![]:!![],'where':_0x13582f[_0x5249('0x20')]?_0x13582f['options']['where']||null:null,'attributes':_0x13582f[_0x5249('0x20')]?_0x13582f[_0x5249('0x20')]['attributes']||null:null,'limit':_0x13582f[_0x5249('0x20')]?_0x13582f[_0x5249('0x20')][_0x5249('0x22')]||null:null,'include':_0x13582f[_0x5249('0x20')]?_0x13582f[_0x5249('0x20')][_0x5249('0x23')]?_['map'](_0x13582f[_0x5249('0x20')][_0x5249('0x23')],function(_0x3a64ae){return{'model':db[_0x3a64ae[_0x5249('0x24')]],'as':_0x3a64ae['as'],'attributes':_0x3a64ae[_0x5249('0x25')],'include':_0x3a64ae[_0x5249('0x23')]?_[_0x5249('0x26')](_0x3a64ae['include'],function(_0x3514a2){return{'model':db[_0x3514a2[_0x5249('0x24')]],'as':_0x3514a2['as'],'attributes':_0x3514a2[_0x5249('0x25')],'include':_0x3514a2[_0x5249('0x23')]?_[_0x5249('0x26')](_0x3514a2[_0x5249('0x23')],function(_0x4dfffa){return{'model':db[_0x4dfffa['model']],'as':_0x4dfffa['as'],'attributes':_0x4dfffa[_0x5249('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e337c){logger['info'](_0x5249('0x1d'),_0x13582f);logger[_0x5249('0x14')]('GetVoiceQueue',_0x13582f,JSON['stringify'](_0x3e337c));_0xac635e(_0x3e337c);})[_0x5249('0x1c')](function(_0x1b096a){logger['error'](_0x5249('0x1d'),_0x1b096a[_0x5249('0x1a')],_0x13582f);_0x5bb4aa(_0x1c0e41[_0x5249('0x17')](0x1f4,_0x1b096a[_0x5249('0x1a')]));});});};exports[_0x5249('0x27')]=function(_0x4bccf1){var _0x24d4b3=this;return new Promise(function(_0x5469a8,_0x3ba13a){return db[_0x5249('0x1e')][_0x5249('0x28')]({'raw':_0x4bccf1['options']?_0x4bccf1[_0x5249('0x20')][_0x5249('0x21')]===undefined?!![]:![]:!![],'where':_0x4bccf1[_0x5249('0x20')]?_0x4bccf1['options']['where']||null:null,'attributes':_0x4bccf1[_0x5249('0x20')]?_0x4bccf1[_0x5249('0x20')][_0x5249('0x25')]||null:null,'include':_0x4bccf1[_0x5249('0x20')]?_0x4bccf1['options'][_0x5249('0x23')]?_[_0x5249('0x26')](_0x4bccf1[_0x5249('0x20')][_0x5249('0x23')],function(_0x4f3518){return{'model':db[_0x4f3518[_0x5249('0x24')]],'as':_0x4f3518['as'],'attributes':_0x4f3518['attributes'],'include':_0x4f3518[_0x5249('0x23')]?_['map'](_0x4f3518['include'],function(_0x4b21be){return{'model':db[_0x4b21be[_0x5249('0x24')]],'as':_0x4b21be['as'],'attributes':_0x4b21be[_0x5249('0x25')],'include':_0x4b21be['include']?_[_0x5249('0x26')](_0x4b21be[_0x5249('0x23')],function(_0x1ca928){return{'model':db[_0x1ca928[_0x5249('0x24')]],'as':_0x1ca928['as'],'attributes':_0x1ca928[_0x5249('0x25')]};}):[]};}):[]};}):[]:[]})[_0x5249('0x12')](function(_0x507d6a){logger[_0x5249('0x29')](_0x5249('0x27'),_0x4bccf1);logger[_0x5249('0x14')]('ShowVoiceQueue',_0x4bccf1,JSON['stringify'](_0x507d6a));_0x5469a8(_0x507d6a);})[_0x5249('0x1c')](function(_0xb9ede2){logger[_0x5249('0x17')]('ShowVoiceQueue',_0xb9ede2[_0x5249('0x1a')],_0x4bccf1);_0x3ba13a(_0x24d4b3[_0x5249('0x17')](0x1f4,_0xb9ede2['message']));});});}; \ No newline at end of file +var _0x83d1=['VoiceQueue','options','raw','attributes','include','model','map','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','redis','socket.io-emitter','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x83d1,0xfe));var _0x183d=function(_0x34755b,_0x48e68b){_0x34755b=_0x34755b-0x0;var _0x107f67=_0x83d1[_0x34755b];return _0x107f67;};'use strict';var _=require(_0x183d('0x0'));var util=require(_0x183d('0x1'));var moment=require(_0x183d('0x2'));var BPromise=require(_0x183d('0x3'));var rs=require(_0x183d('0x4'));var fs=require('fs');var Redis=require(_0x183d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x183d('0x6'));var config=require(_0x183d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x183d('0x8')]['http']({'port':0x232a});config[_0x183d('0x9')]=_['defaults'](config[_0x183d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x183d('0xa'))(new Redis(config[_0x183d('0x9')]));require('./voiceQueue.socket')[_0x183d('0xb')](socket);function respondWithRpcPromise(_0x18d2d8,_0x38cadd,_0x1cba50){return new BPromise(function(_0x338632,_0x48e188){return client[_0x183d('0xc')](_0x18d2d8,_0x1cba50)[_0x183d('0xd')](function(_0x378b72){logger['info'](_0x183d('0xe'),_0x38cadd,_0x183d('0xf'));logger[_0x183d('0x10')](_0x183d('0x11'),_0x38cadd,_0x183d('0xf'),JSON[_0x183d('0x12')](_0x378b72));if(_0x378b72[_0x183d('0x13')]){if(_0x378b72['error'][_0x183d('0x14')]===0x1f4){logger[_0x183d('0x13')](_0x183d('0xe'),_0x38cadd,_0x378b72[_0x183d('0x13')]['message']);return _0x48e188(_0x378b72[_0x183d('0x13')][_0x183d('0x15')]);}logger[_0x183d('0x13')](_0x183d('0xe'),_0x38cadd,_0x378b72[_0x183d('0x13')][_0x183d('0x15')]);return _0x338632(_0x378b72['error'][_0x183d('0x15')]);}else{logger[_0x183d('0x16')](_0x183d('0xe'),_0x38cadd,_0x183d('0xf'));_0x338632(_0x378b72[_0x183d('0x17')][_0x183d('0x15')]);}})[_0x183d('0x18')](function(_0x328124){logger['error'](_0x183d('0xe'),_0x38cadd,_0x328124);_0x48e188(_0x328124);});});}exports[_0x183d('0x19')]=function(_0xdaaa9b){var _0x4e3b84=this;return new Promise(function(_0x931c94,_0x41a6eb){return db[_0x183d('0x1a')]['findAll']({'raw':_0xdaaa9b[_0x183d('0x1b')]?_0xdaaa9b[_0x183d('0x1b')][_0x183d('0x1c')]===undefined?!![]:![]:!![],'where':_0xdaaa9b[_0x183d('0x1b')]?_0xdaaa9b['options']['where']||null:null,'attributes':_0xdaaa9b[_0x183d('0x1b')]?_0xdaaa9b[_0x183d('0x1b')][_0x183d('0x1d')]||null:null,'limit':_0xdaaa9b[_0x183d('0x1b')]?_0xdaaa9b[_0x183d('0x1b')]['limit']||null:null,'include':_0xdaaa9b[_0x183d('0x1b')]?_0xdaaa9b[_0x183d('0x1b')][_0x183d('0x1e')]?_['map'](_0xdaaa9b[_0x183d('0x1b')][_0x183d('0x1e')],function(_0x38a8a8){return{'model':db[_0x38a8a8[_0x183d('0x1f')]],'as':_0x38a8a8['as'],'attributes':_0x38a8a8[_0x183d('0x1d')],'include':_0x38a8a8[_0x183d('0x1e')]?_[_0x183d('0x20')](_0x38a8a8[_0x183d('0x1e')],function(_0xfeb8e1){return{'model':db[_0xfeb8e1[_0x183d('0x1f')]],'as':_0xfeb8e1['as'],'attributes':_0xfeb8e1[_0x183d('0x1d')],'include':_0xfeb8e1[_0x183d('0x1e')]?_[_0x183d('0x20')](_0xfeb8e1[_0x183d('0x1e')],function(_0x48a2ae){return{'model':db[_0x48a2ae[_0x183d('0x1f')]],'as':_0x48a2ae['as'],'attributes':_0x48a2ae[_0x183d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9ee519){logger[_0x183d('0x16')]('GetVoiceQueue',_0xdaaa9b);logger[_0x183d('0x10')](_0x183d('0x19'),_0xdaaa9b,JSON[_0x183d('0x12')](_0x9ee519));_0x931c94(_0x9ee519);})[_0x183d('0x18')](function(_0x14f8b8){logger['error'](_0x183d('0x19'),_0x14f8b8[_0x183d('0x15')],_0xdaaa9b);_0x41a6eb(_0x4e3b84['error'](0x1f4,_0x14f8b8[_0x183d('0x15')]));});});};exports[_0x183d('0x21')]=function(_0x18ac0e){var _0x25cc56=this;return new Promise(function(_0x15f2a9,_0x4cd566){return db[_0x183d('0x1a')][_0x183d('0x22')]({'raw':_0x18ac0e[_0x183d('0x1b')]?_0x18ac0e[_0x183d('0x1b')][_0x183d('0x1c')]===undefined?!![]:![]:!![],'where':_0x18ac0e['options']?_0x18ac0e[_0x183d('0x1b')]['where']||null:null,'attributes':_0x18ac0e[_0x183d('0x1b')]?_0x18ac0e['options'][_0x183d('0x1d')]||null:null,'include':_0x18ac0e['options']?_0x18ac0e['options'][_0x183d('0x1e')]?_[_0x183d('0x20')](_0x18ac0e[_0x183d('0x1b')][_0x183d('0x1e')],function(_0x2b1f10){return{'model':db[_0x2b1f10['model']],'as':_0x2b1f10['as'],'attributes':_0x2b1f10[_0x183d('0x1d')],'include':_0x2b1f10[_0x183d('0x1e')]?_[_0x183d('0x20')](_0x2b1f10[_0x183d('0x1e')],function(_0x6e7b1c){return{'model':db[_0x6e7b1c[_0x183d('0x1f')]],'as':_0x6e7b1c['as'],'attributes':_0x6e7b1c['attributes'],'include':_0x6e7b1c[_0x183d('0x1e')]?_[_0x183d('0x20')](_0x6e7b1c[_0x183d('0x1e')],function(_0x2be0ce){return{'model':db[_0x2be0ce[_0x183d('0x1f')]],'as':_0x2be0ce['as'],'attributes':_0x2be0ce[_0x183d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x183d('0xd')](function(_0xed32e3){logger['info'](_0x183d('0x21'),_0x18ac0e);logger['debug'](_0x183d('0x21'),_0x18ac0e,JSON['stringify'](_0xed32e3));_0x15f2a9(_0xed32e3);})[_0x183d('0x18')](function(_0x37b6a7){logger[_0x183d('0x13')]('ShowVoiceQueue',_0x37b6a7[_0x183d('0x15')],_0x18ac0e);_0x4cd566(_0x25cc56['error'](0x1f4,_0x37b6a7[_0x183d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3fc54c0..c8af244 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 _0x5ecb=['./voiceQueue.events','save','remove','update','removeListener','register','length','voiceQueue:'];(function(_0x2bb0ed,_0x1af73f){var _0x509471=function(_0x4213ff){while(--_0x4213ff){_0x2bb0ed['push'](_0x2bb0ed['shift']());}};_0x509471(++_0x1af73f);}(_0x5ecb,0x1f0));var _0xb5ec=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x5ecb[_0x3da832];return _0xe602f2;};'use strict';var VoiceQueueEvents=require(_0xb5ec('0x0'));var events=[_0xb5ec('0x1'),_0xb5ec('0x2'),_0xb5ec('0x3')];function createListener(_0x5a9065,_0x34baaa){return function(_0x186c26){_0x34baaa['emit'](_0x5a9065,_0x186c26);};}function removeListener(_0x124b55,_0x5c9693){return function(){VoiceQueueEvents[_0xb5ec('0x4')](_0x124b55,_0x5c9693);};}exports[_0xb5ec('0x5')]=function(_0x11c09d){for(var _0x3f9206=0x0,_0x4aab59=events[_0xb5ec('0x6')];_0x3f9206<_0x4aab59;_0x3f9206++){var _0x589738=events[_0x3f9206];var _0x19dbf7=createListener(_0xb5ec('0x7')+_0x589738,_0x11c09d);VoiceQueueEvents['on'](_0x589738,_0x19dbf7);}}; \ No newline at end of file +var _0x3699=['save','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3699,0x12f));var _0x9369=function(_0x442182,_0x271646){_0x442182=_0x442182-0x0;var _0xd3e1dd=_0x3699[_0x442182];return _0xd3e1dd;};'use strict';var VoiceQueueEvents=require(_0x9369('0x0'));var events=[_0x9369('0x1'),'remove',_0x9369('0x2')];function createListener(_0x3dbe4d,_0x542417){return function(_0x500cbc){_0x542417[_0x9369('0x3')](_0x3dbe4d,_0x500cbc);};}function removeListener(_0x2afdab,_0x1d5a5b){return function(){VoiceQueueEvents[_0x9369('0x4')](_0x2afdab,_0x1d5a5b);};}exports[_0x9369('0x5')]=function(_0x9129e6){for(var _0x22cc7c=0x0,_0x3e166e=events[_0x9369('0x6')];_0x22cc7c<_0x3e166e;_0x22cc7c++){var _0x2321f0=events[_0x22cc7c];var _0x51a0b9=createListener(_0x9369('0x7')+_0x2321f0,_0x9129e6);VoiceQueueEvents['on'](_0x2321f0,_0x51a0b9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7639980..749992a 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 _0x9e27=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','/:id','show','post','create','put','update','delete','destroy','util','path','../../components/auth/service'];(function(_0x40356a,_0x2133cc){var _0x46fb34=function(_0x343308){while(--_0x343308){_0x40356a['push'](_0x40356a['shift']());}};_0x46fb34(++_0x2133cc);}(_0x9e27,0x11d));var _0x79e2=function(_0x1a45d2,_0x4e6249){_0x1a45d2=_0x1a45d2-0x0;var _0x348dcd=_0x9e27[_0x1a45d2];return _0x348dcd;};'use strict';var multer=require('multer');var util=require(_0x79e2('0x0'));var path=require(_0x79e2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x79e2('0x2'));var interaction=require(_0x79e2('0x3'));var config=require(_0x79e2('0x4'));var controller=require(_0x79e2('0x5'));router[_0x79e2('0x6')]('/',auth[_0x79e2('0x7')](),controller['index']);router[_0x79e2('0x6')]('/describe',auth[_0x79e2('0x7')](),controller[_0x79e2('0x8')]);router[_0x79e2('0x6')](_0x79e2('0x9'),auth[_0x79e2('0x7')](),controller['getVoiceQueuesReport']);router[_0x79e2('0x6')](_0x79e2('0xa'),auth[_0x79e2('0x7')](),controller[_0x79e2('0xb')]);router[_0x79e2('0xc')]('/',auth[_0x79e2('0x7')](),controller[_0x79e2('0xd')]);router[_0x79e2('0xe')](_0x79e2('0xa'),auth['isAuthenticated'](),controller[_0x79e2('0xf')]);router[_0x79e2('0x10')](_0x79e2('0xa'),auth['isAuthenticated'](),controller[_0x79e2('0x11')]);module['exports']=router; \ No newline at end of file +var _0xda53=['./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda53,0x105));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3da5('0x0'));var path=require(_0x3da5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3da5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3da5('0x3'));var config=require(_0x3da5('0x4'));var controller=require(_0x3da5('0x5'));router['get']('/',auth[_0x3da5('0x6')](),controller[_0x3da5('0x7')]);router[_0x3da5('0x8')](_0x3da5('0x9'),auth['isAuthenticated'](),controller[_0x3da5('0xa')]);router[_0x3da5('0x8')](_0x3da5('0xb'),auth[_0x3da5('0x6')](),controller[_0x3da5('0xc')]);router['get'](_0x3da5('0xd'),auth[_0x3da5('0x6')](),controller[_0x3da5('0xe')]);router[_0x3da5('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3da5('0x10')]('/:id',auth[_0x3da5('0x6')](),controller['update']);router[_0x3da5('0x11')](_0x3da5('0xd'),auth[_0x3da5('0x6')](),controller['destroy']);module[_0x3da5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index efb3d2d..e184deb 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 _0xa023=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa023,0x183));var _0x3a02=function(_0xb9c098,_0x59f88c){_0xb9c098=_0xb9c098-0x0;var _0x1f490e=_0xa023[_0xb9c098];return _0x1f490e;};'use strict';var Sequelize=require(_0x3a02('0x0'));var moment=require(_0x3a02('0x1'));module['exports']={'type':{'type':Sequelize[_0x3a02('0x2')]},'uniqueid':{'type':Sequelize[_0x3a02('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3a02('0x2')]},'queue':{'type':Sequelize[_0x3a02('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x3a02('0x3')],'set':function(_0x1b293b){var _0x12c6b2=moment(_0x1b293b);var _0x25a9d6=moment(this[_0x3a02('0x4')]('queuecallerjoinAt'))[_0x3a02('0x5')](_0x3a02('0x6'));var _0x2efa11=_0x12c6b2['diff'](_0x25a9d6,_0x3a02('0x7'));this[_0x3a02('0x8')]('queuecallerleaveAt',_0x1b293b);this[_0x3a02('0x8')](_0x3a02('0x9'),_0x2efa11||null);}},'position':{'type':Sequelize[_0x3a02('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x3a02('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3a02('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3a02('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3a02('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3a02('0xa')]},'channel':{'type':Sequelize[_0x3a02('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a02('0x2')]},'connectedlinename':{'type':Sequelize[_0x3a02('0x2')]},'accountcode':{'type':Sequelize[_0x3a02('0x2')]},'context':{'type':Sequelize[_0x3a02('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3a02('0x2')]},'holdtime':{'type':Sequelize[_0x3a02('0xa')]},'mohtime':{'type':Sequelize[_0x3a02('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3a02('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x3a02('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3a02('0xc')},'transferexten':{'type':Sequelize[_0x3a02('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3a02('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3a02('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x3a02('0x2')]}}; \ No newline at end of file +var _0x1923=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1923,0x6b));var _0x3192=function(_0x38955d,_0x29b527){_0x38955d=_0x38955d-0x0;var _0x2d25bf=_0x1923[_0x38955d];return _0x2d25bf;};'use strict';var Sequelize=require(_0x3192('0x0'));var moment=require(_0x3192('0x1'));module[_0x3192('0x2')]={'type':{'type':Sequelize[_0x3192('0x3')]},'uniqueid':{'type':Sequelize[_0x3192('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3192('0x3')]},'queue':{'type':Sequelize[_0x3192('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x3192('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x356c4c){var _0x5238e8=moment(_0x356c4c);var _0x9da416=moment(this[_0x3192('0x5')](_0x3192('0x6')))['format'](_0x3192('0x7'));var _0x317972=_0x5238e8[_0x3192('0x8')](_0x9da416,_0x3192('0x9'));this[_0x3192('0xa')](_0x3192('0xb'),_0x356c4c);this['setDataValue'](_0x3192('0xc'),_0x317972||null);}},'position':{'type':Sequelize[_0x3192('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x3192('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3192('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3192('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3192('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3192('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x3192('0xf')},'originalposition':{'type':Sequelize[_0x3192('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3192('0x3')]},'connectedlinename':{'type':Sequelize[_0x3192('0x3')]},'accountcode':{'type':Sequelize[_0x3192('0x3')]},'context':{'type':Sequelize[_0x3192('0x3')]},'exten':{'type':Sequelize[_0x3192('0x3')]},'priority':{'type':Sequelize[_0x3192('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x3192('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3192('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3192('0x3')]},'transfer':{'type':Sequelize[_0x3192('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3192('0x3')],'comment':_0x3192('0x10')},'transferexten':{'type':Sequelize[_0x3192('0x3')]},'transferuniqueid':{'type':Sequelize[_0x3192('0x3')]},'disposition':{'type':Sequelize[_0x3192('0x3')]},'secondDisposition':{'type':Sequelize[_0x3192('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x3192('0xd')],'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 2bbe21c..d938235 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 _0x9085=['VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getVoiceQueuesReport','rows','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x43ea49,_0xebbbf5){var _0x9f0b4a=function(_0x2287e5){while(--_0x2287e5){_0x43ea49['push'](_0x43ea49['shift']());}};_0x9f0b4a(++_0xebbbf5);}(_0x9085,0x1af));var _0x5908=function(_0x4a464e,_0x250abf){_0x4a464e=_0x4a464e-0x0;var _0x54d070=_0x9085[_0x4a464e];return _0x54d070;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5908('0x0'));var zipdir=require(_0x5908('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5908('0x2'));var moment=require(_0x5908('0x3'));var BPromise=require(_0x5908('0x4'));var Mustache=require('mustache');var util=require(_0x5908('0x5'));var path=require('path');var sox=require(_0x5908('0x6'));var csv=require(_0x5908('0x7'));var ejs=require(_0x5908('0x8'));var fs=require('fs');var fs_extra=require(_0x5908('0x9'));var _=require(_0x5908('0xa'));var squel=require(_0x5908('0xb'));var crypto=require('crypto');var jsforce=require(_0x5908('0xc'));var deskjs=require(_0x5908('0xd'));var toCsv=require(_0x5908('0x7'));var querystring=require(_0x5908('0xe'));var Papa=require(_0x5908('0xf'));var Redis=require('ioredis');var authService=require(_0x5908('0x10'));var qs=require(_0x5908('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5908('0x12'));var logger=require(_0x5908('0x13'))(_0x5908('0x14'));var utils=require('../../config/utils');var config=require(_0x5908('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5908('0x16'))['db'];config[_0x5908('0x17')]=_[_0x5908('0x18')](config[_0x5908('0x17')],{'host':_0x5908('0x19'),'port':0x18eb});var socket=require(_0x5908('0x1a'))(new Redis(config[_0x5908('0x17')]));require(_0x5908('0x1b'))[_0x5908('0x1c')](socket);function respondWithStatusCode(_0x30c00a,_0x30e27b){_0x30e27b=_0x30e27b||0xcc;return function(_0x10f4ca){if(_0x10f4ca){return _0x30c00a[_0x5908('0x1d')](_0x30e27b);}return _0x30c00a['status'](_0x30e27b)[_0x5908('0x1e')]();};}function respondWithResult(_0x272fc1,_0x2f500a){_0x2f500a=_0x2f500a||0xc8;return function(_0x5c6d0b){if(_0x5c6d0b){return _0x272fc1[_0x5908('0x1f')](_0x2f500a)['json'](_0x5c6d0b);}};}function respondWithFilteredResult(_0x44f8d2,_0x5b0372){return function(_0x4d56df){if(_0x4d56df){var _0xd5c086=typeof _0x5b0372['offset']==='undefined'&&typeof _0x5b0372['limit']===_0x5908('0x20');var _0x2b241e=_0x4d56df[_0x5908('0x21')];var _0x527e71=_0xd5c086?0x0:_0x5b0372[_0x5908('0x22')];var _0x36c23b=_0xd5c086?_0x4d56df['count']:_0x5b0372[_0x5908('0x22')]+_0x5b0372['limit'];var _0x462868;if(_0x36c23b>=_0x2b241e){_0x36c23b=_0x2b241e;_0x462868=0xc8;}else{_0x462868=0xce;}_0x44f8d2[_0x5908('0x1f')](_0x462868);return _0x44f8d2[_0x5908('0x23')](_0x5908('0x24'),_0x527e71+'-'+_0x36c23b+'/'+_0x2b241e)[_0x5908('0x25')](_0x4d56df);}return null;};}function patchUpdates(_0x4efd5a){return function(_0x9afdfe){try{jsonpatch[_0x5908('0x26')](_0x9afdfe,_0x4efd5a,!![]);}catch(_0x32a60b){return BPromise[_0x5908('0x27')](_0x32a60b);}return _0x9afdfe['save']();};}function saveUpdates(_0x47e72e,_0x3550f4){return function(_0x455836){if(_0x455836){return _0x455836['update'](_0x47e72e)['then'](function(_0x39416e){return _0x39416e;});}return null;};}function removeEntity(_0x57f2ba,_0x496ba2){return function(_0x255f16){if(_0x255f16){return _0x255f16[_0x5908('0x28')]()[_0x5908('0x29')](function(){_0x57f2ba[_0x5908('0x1f')](0xcc)[_0x5908('0x1e')]();});}};}function handleEntityNotFound(_0x49dfe3,_0x4007bb){return function(_0x131d0f){if(!_0x131d0f){_0x49dfe3[_0x5908('0x1d')](0x194);}return _0x131d0f;};}function handleError(_0x1b7ce6,_0x355519){_0x355519=_0x355519||0x1f4;return function(_0x453291){logger[_0x5908('0x2a')](_0x453291['stack']);if(_0x453291['name']){delete _0x453291[_0x5908('0x2b')];}_0x1b7ce6['status'](_0x355519)[_0x5908('0x2c')](_0x453291);};}exports[_0x5908('0x2d')]=function(_0x13aa9a,_0x599f11){var _0x43f398={},_0x1a70b3={},_0x41a617={'count':0x0,'rows':[]};var _0x440232=_[_0x5908('0x2e')](db['VoiceQueueReport'][_0x5908('0x2f')],function(_0x51b12a){return{'name':_0x51b12a[_0x5908('0x30')],'type':_0x51b12a[_0x5908('0x31')][_0x5908('0x32')]};});_0x1a70b3[_0x5908('0x33')]=_[_0x5908('0x2e')](_0x440232,_0x5908('0x2b'));_0x1a70b3['query']=_['keys'](_0x13aa9a[_0x5908('0x34')]);_0x1a70b3[_0x5908('0x35')]=_[_0x5908('0x36')](_0x1a70b3['model'],_0x1a70b3[_0x5908('0x34')]);_0x43f398[_0x5908('0x37')]=_[_0x5908('0x36')](_0x1a70b3['model'],qs['fields'](_0x13aa9a[_0x5908('0x34')][_0x5908('0x38')]));_0x43f398[_0x5908('0x37')]=_0x43f398[_0x5908('0x37')][_0x5908('0x39')]?_0x43f398[_0x5908('0x37')]:_0x1a70b3[_0x5908('0x33')];if(!_0x13aa9a[_0x5908('0x34')][_0x5908('0x3a')](_0x5908('0x3b'))){_0x43f398[_0x5908('0x3c')]=qs[_0x5908('0x3c')](_0x13aa9a['query'][_0x5908('0x3c')]);_0x43f398[_0x5908('0x22')]=qs[_0x5908('0x22')](_0x13aa9a['query'][_0x5908('0x22')]);}_0x43f398[_0x5908('0x3d')]=qs['sort'](_0x13aa9a['query'][_0x5908('0x3e')]);_0x43f398[_0x5908('0x3f')]=qs['filters'](_[_0x5908('0x40')](_0x13aa9a[_0x5908('0x34')],_0x1a70b3[_0x5908('0x35')]),_0x440232);if(_0x13aa9a['query'][_0x5908('0x41')]){_0x43f398[_0x5908('0x3f')]=_[_0x5908('0x42')](_0x43f398[_0x5908('0x3f')],{'$or':_['map'](_0x440232,function(_0x2d8a9c){if(_0x2d8a9c[_0x5908('0x31')]!==_0x5908('0x43')){var _0x383f05={};_0x383f05[_0x2d8a9c[_0x5908('0x2b')]]={'$like':'%'+_0x13aa9a[_0x5908('0x34')][_0x5908('0x41')]+'%'};return _0x383f05;}})});}_0x43f398=_[_0x5908('0x42')]({},_0x43f398,_0x13aa9a[_0x5908('0x44')]);var _0x42e94b={'where':_0x43f398[_0x5908('0x3f')]};return db[_0x5908('0x45')][_0x5908('0x21')](_0x42e94b)[_0x5908('0x29')](function(_0x2a184b){_0x41a617[_0x5908('0x21')]=_0x2a184b;if(_0x13aa9a[_0x5908('0x34')][_0x5908('0x46')]){_0x43f398[_0x5908('0x47')]=[{'all':!![]}];}return db[_0x5908('0x45')][_0x5908('0x48')](_0x43f398);})[_0x5908('0x29')](function(_0x62cc52){_0x41a617['rows']=_0x62cc52;return _0x41a617;})[_0x5908('0x29')](respondWithFilteredResult(_0x599f11,_0x43f398))[_0x5908('0x49')](handleError(_0x599f11,null));};exports[_0x5908('0x4a')]=function(_0x463108,_0x235b9d){var _0x3b443a={'raw':![],'where':{'id':_0x463108[_0x5908('0x4b')]['id']}},_0x3274a7={};_0x3274a7[_0x5908('0x33')]=_[_0x5908('0x4c')](db['VoiceQueueReport'][_0x5908('0x2f')]);_0x3274a7[_0x5908('0x34')]=_['keys'](_0x463108[_0x5908('0x34')]);_0x3274a7[_0x5908('0x35')]=_['intersection'](_0x3274a7[_0x5908('0x33')],_0x3274a7[_0x5908('0x34')]);_0x3b443a[_0x5908('0x37')]=_['intersection'](_0x3274a7[_0x5908('0x33')],qs[_0x5908('0x38')](_0x463108['query'][_0x5908('0x38')]));_0x3b443a[_0x5908('0x37')]=_0x3b443a[_0x5908('0x37')]['length']?_0x3b443a[_0x5908('0x37')]:_0x3274a7[_0x5908('0x33')];if(_0x463108[_0x5908('0x34')]['includeAll']){_0x3b443a['include']=[{'all':!![]}];}_0x3b443a=_[_0x5908('0x42')]({},_0x3b443a,_0x463108[_0x5908('0x44')]);return db[_0x5908('0x45')][_0x5908('0x4d')](_0x3b443a)[_0x5908('0x29')](handleEntityNotFound(_0x235b9d,null))[_0x5908('0x29')](respondWithResult(_0x235b9d,null))['catch'](handleError(_0x235b9d,null));};exports[_0x5908('0x4e')]=function(_0x462618,_0x22507e){return db[_0x5908('0x45')]['create'](_0x462618['body'],{})[_0x5908('0x29')](respondWithResult(_0x22507e,0xc9))[_0x5908('0x49')](handleError(_0x22507e,null));};exports['update']=function(_0x2983ef,_0x5723ef){if(_0x2983ef[_0x5908('0x4f')]['id']){delete _0x2983ef[_0x5908('0x4f')]['id'];}return db['VoiceQueueReport'][_0x5908('0x4d')]({'where':{'id':_0x2983ef[_0x5908('0x4b')]['id']}})[_0x5908('0x29')](handleEntityNotFound(_0x5723ef,null))['then'](saveUpdates(_0x2983ef[_0x5908('0x4f')],null))[_0x5908('0x29')](respondWithResult(_0x5723ef,null))[_0x5908('0x49')](handleError(_0x5723ef,null));};exports[_0x5908('0x28')]=function(_0x28383f,_0x1d672c){return db[_0x5908('0x45')][_0x5908('0x4d')]({'where':{'id':_0x28383f[_0x5908('0x4b')]['id']}})[_0x5908('0x29')](handleEntityNotFound(_0x1d672c,null))[_0x5908('0x29')](removeEntity(_0x1d672c,null))[_0x5908('0x49')](handleError(_0x1d672c,null));};exports['describe']=function(_0x58255c,_0x4476a9){return db[_0x5908('0x45')][_0x5908('0x50')]()[_0x5908('0x29')](respondWithResult(_0x4476a9,null))[_0x5908('0x49')](handleError(_0x4476a9,null));};exports[_0x5908('0x51')]=function(_0x5530ac,_0x553dd5){var _0x40bf5a={},_0x323ea2={},_0x40e5a5={'count':0x0,'rows':[]};_0x323ea2[_0x5908('0x33')]=_[_0x5908('0x4c')](db['VoiceQueueReport'][_0x5908('0x2f')]);_0x323ea2[_0x5908('0x34')]=_['keys'](_0x5530ac['query']);_0x323ea2[_0x5908('0x35')]=_[_0x5908('0x36')](_0x323ea2[_0x5908('0x33')],_0x323ea2[_0x5908('0x34')]);_0x40bf5a[_0x5908('0x37')]=_['intersection'](_0x323ea2[_0x5908('0x33')],qs[_0x5908('0x38')](_0x5530ac[_0x5908('0x34')]['fields']));_0x40bf5a['attributes']=_0x40bf5a[_0x5908('0x37')][_0x5908('0x39')]?_0x40bf5a[_0x5908('0x37')]:_0x323ea2[_0x5908('0x33')];if(!_0x5530ac[_0x5908('0x34')][_0x5908('0x3a')](_0x5908('0x3b'))){_0x40bf5a[_0x5908('0x3c')]=qs[_0x5908('0x3c')](_0x5530ac[_0x5908('0x34')][_0x5908('0x3c')]);_0x40bf5a[_0x5908('0x22')]=qs[_0x5908('0x22')](_0x5530ac[_0x5908('0x34')][_0x5908('0x22')]);}_0x40bf5a[_0x5908('0x3d')]=qs[_0x5908('0x3e')](_0x5530ac[_0x5908('0x34')][_0x5908('0x3e')]);_0x40bf5a[_0x5908('0x3f')]=qs[_0x5908('0x35')](_[_0x5908('0x40')](_0x5530ac[_0x5908('0x34')],_0x323ea2[_0x5908('0x35')]));if(_0x5530ac[_0x5908('0x34')][_0x5908('0x41')]){_0x40bf5a[_0x5908('0x3f')]=_[_0x5908('0x42')](_0x40bf5a[_0x5908('0x3f')],{'$or':_[_0x5908('0x2e')](_0x40bf5a['attributes'],function(_0x5e851){var _0x27d3a8={};_0x27d3a8[_0x5e851]={'$like':'%'+_0x5530ac[_0x5908('0x34')][_0x5908('0x41')]+'%'};return _0x27d3a8;})});}_0x40bf5a=_[_0x5908('0x42')]({},_0x40bf5a,_0x5530ac[_0x5908('0x44')]);var _0x382a1e={'where':_0x40bf5a['where']};return db[_0x5908('0x45')][_0x5908('0x21')](_0x382a1e)[_0x5908('0x29')](function(_0x4629da){_0x40e5a5[_0x5908('0x21')]=_0x4629da;if(_0x5530ac['query'][_0x5908('0x46')]){_0x40bf5a[_0x5908('0x47')]=[{'all':!![]}];}return db[_0x5908('0x45')][_0x5908('0x48')](_0x40bf5a);})[_0x5908('0x29')](function(_0x55379e){_0x40e5a5[_0x5908('0x52')]=_0x55379e;return _0x40e5a5;})[_0x5908('0x29')](respondWithFilteredResult(_0x553dd5,_0x40bf5a,_0x5908('0x51')))[_0x5908('0x49')](handleError(_0x553dd5,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xfb8d=['../../mysqldb','redis','localhost','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','destroy','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','describe','getVoiceQueuesReport','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x3098e1,_0x5a9b32){var _0x55397f=function(_0x1951cd){while(--_0x1951cd){_0x3098e1['push'](_0x3098e1['shift']());}};_0x55397f(++_0x5a9b32);}(_0xfb8d,0xd0));var _0xdfb8=function(_0x279879,_0x16fd9e){_0x279879=_0x279879-0x0;var _0x16ab75=_0xfb8d[_0x279879];return _0x16ab75;};'use strict';var emlformat=require(_0xdfb8('0x0'));var rimraf=require(_0xdfb8('0x1'));var zipdir=require(_0xdfb8('0x2'));var jsonpatch=require(_0xdfb8('0x3'));var rp=require(_0xdfb8('0x4'));var moment=require(_0xdfb8('0x5'));var BPromise=require(_0xdfb8('0x6'));var Mustache=require(_0xdfb8('0x7'));var util=require('util');var path=require(_0xdfb8('0x8'));var sox=require('sox');var csv=require(_0xdfb8('0x9'));var ejs=require(_0xdfb8('0xa'));var fs=require('fs');var fs_extra=require(_0xdfb8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdfb8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdfb8('0xd'));var toCsv=require(_0xdfb8('0x9'));var querystring=require(_0xdfb8('0xe'));var Papa=require('papaparse');var Redis=require(_0xdfb8('0xf'));var authService=require(_0xdfb8('0x10'));var qs=require(_0xdfb8('0x11'));var as=require(_0xdfb8('0x12'));var hardwareService=require(_0xdfb8('0x13'));var logger=require('../../config/logger')(_0xdfb8('0x14'));var utils=require(_0xdfb8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdfb8('0x16'));var db=require(_0xdfb8('0x17'))['db'];config[_0xdfb8('0x18')]=_['defaults'](config[_0xdfb8('0x18')],{'host':_0xdfb8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfb8('0x18')]));require('./voiceQueueReport.socket')[_0xdfb8('0x1a')](socket);function respondWithStatusCode(_0x5584e8,_0x1a9bf8){_0x1a9bf8=_0x1a9bf8||0xcc;return function(_0x145668){if(_0x145668){return _0x5584e8[_0xdfb8('0x1b')](_0x1a9bf8);}return _0x5584e8[_0xdfb8('0x1c')](_0x1a9bf8)[_0xdfb8('0x1d')]();};}function respondWithResult(_0x388dde,_0x27bcf0){_0x27bcf0=_0x27bcf0||0xc8;return function(_0x57eed2){if(_0x57eed2){return _0x388dde[_0xdfb8('0x1c')](_0x27bcf0)[_0xdfb8('0x1e')](_0x57eed2);}};}function respondWithFilteredResult(_0x4bd1a3,_0x102d5d){return function(_0x1f2f2e){if(_0x1f2f2e){var _0x564f70=typeof _0x102d5d['offset']===_0xdfb8('0x1f')&&typeof _0x102d5d[_0xdfb8('0x20')]===_0xdfb8('0x1f');var _0x555b7b=_0x1f2f2e['count'];var _0x3b7487=_0x564f70?0x0:_0x102d5d[_0xdfb8('0x21')];var _0x4e0846=_0x564f70?_0x1f2f2e[_0xdfb8('0x22')]:_0x102d5d[_0xdfb8('0x21')]+_0x102d5d[_0xdfb8('0x20')];var _0x18d991;if(_0x4e0846>=_0x555b7b){_0x4e0846=_0x555b7b;_0x18d991=0xc8;}else{_0x18d991=0xce;}_0x4bd1a3[_0xdfb8('0x1c')](_0x18d991);return _0x4bd1a3['set'](_0xdfb8('0x23'),_0x3b7487+'-'+_0x4e0846+'/'+_0x555b7b)[_0xdfb8('0x1e')](_0x1f2f2e);}return null;};}function patchUpdates(_0x5a6f53){return function(_0x352ef8){try{jsonpatch['apply'](_0x352ef8,_0x5a6f53,!![]);}catch(_0x585eb5){return BPromise[_0xdfb8('0x24')](_0x585eb5);}return _0x352ef8[_0xdfb8('0x25')]();};}function saveUpdates(_0x5c2449,_0x4b97f6){return function(_0x39544a){if(_0x39544a){return _0x39544a['update'](_0x5c2449)['then'](function(_0x3d87d4){return _0x3d87d4;});}return null;};}function removeEntity(_0x57cc09,_0x1277d0){return function(_0x2e0222){if(_0x2e0222){return _0x2e0222[_0xdfb8('0x26')]()[_0xdfb8('0x27')](function(){_0x57cc09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5c9f,_0x2d4c82){return function(_0x1003c6){if(!_0x1003c6){_0x2a5c9f[_0xdfb8('0x1b')](0x194);}return _0x1003c6;};}function handleError(_0x45e43e,_0x4f6680){_0x4f6680=_0x4f6680||0x1f4;return function(_0x148ba7){logger['error'](_0x148ba7[_0xdfb8('0x28')]);if(_0x148ba7[_0xdfb8('0x29')]){delete _0x148ba7[_0xdfb8('0x29')];}_0x45e43e[_0xdfb8('0x1c')](_0x4f6680)[_0xdfb8('0x2a')](_0x148ba7);};}exports[_0xdfb8('0x2b')]=function(_0x2c9f0b,_0x513ad4){var _0x4ebe6a={},_0x98990e={},_0x3ab3d5={'count':0x0,'rows':[]};var _0xd9e4ff=_['map'](db[_0xdfb8('0x2c')][_0xdfb8('0x2d')],function(_0x4cf388){return{'name':_0x4cf388[_0xdfb8('0x2e')],'type':_0x4cf388['type']['key']};});_0x98990e['model']=_[_0xdfb8('0x2f')](_0xd9e4ff,_0xdfb8('0x29'));_0x98990e[_0xdfb8('0x30')]=_['keys'](_0x2c9f0b[_0xdfb8('0x30')]);_0x98990e[_0xdfb8('0x31')]=_[_0xdfb8('0x32')](_0x98990e[_0xdfb8('0x33')],_0x98990e[_0xdfb8('0x30')]);_0x4ebe6a[_0xdfb8('0x34')]=_['intersection'](_0x98990e[_0xdfb8('0x33')],qs['fields'](_0x2c9f0b[_0xdfb8('0x30')][_0xdfb8('0x35')]));_0x4ebe6a[_0xdfb8('0x34')]=_0x4ebe6a['attributes'][_0xdfb8('0x36')]?_0x4ebe6a[_0xdfb8('0x34')]:_0x98990e[_0xdfb8('0x33')];if(!_0x2c9f0b['query'][_0xdfb8('0x37')](_0xdfb8('0x38'))){_0x4ebe6a['limit']=qs[_0xdfb8('0x20')](_0x2c9f0b['query'][_0xdfb8('0x20')]);_0x4ebe6a[_0xdfb8('0x21')]=qs['offset'](_0x2c9f0b[_0xdfb8('0x30')][_0xdfb8('0x21')]);}_0x4ebe6a['order']=qs['sort'](_0x2c9f0b['query']['sort']);_0x4ebe6a[_0xdfb8('0x39')]=qs['filters'](_[_0xdfb8('0x3a')](_0x2c9f0b[_0xdfb8('0x30')],_0x98990e[_0xdfb8('0x31')]),_0xd9e4ff);if(_0x2c9f0b[_0xdfb8('0x30')][_0xdfb8('0x3b')]){_0x4ebe6a['where']=_[_0xdfb8('0x3c')](_0x4ebe6a[_0xdfb8('0x39')],{'$or':_['map'](_0xd9e4ff,function(_0x3d6840){if(_0x3d6840[_0xdfb8('0x3d')]!=='VIRTUAL'){var _0x3e2271={};_0x3e2271[_0x3d6840['name']]={'$like':'%'+_0x2c9f0b[_0xdfb8('0x30')][_0xdfb8('0x3b')]+'%'};return _0x3e2271;}})});}_0x4ebe6a=_[_0xdfb8('0x3c')]({},_0x4ebe6a,_0x2c9f0b[_0xdfb8('0x3e')]);var _0x2457f2={'where':_0x4ebe6a['where']};return db[_0xdfb8('0x2c')]['count'](_0x2457f2)[_0xdfb8('0x27')](function(_0x544d4d){_0x3ab3d5['count']=_0x544d4d;if(_0x2c9f0b[_0xdfb8('0x30')][_0xdfb8('0x3f')]){_0x4ebe6a[_0xdfb8('0x40')]=[{'all':!![]}];}return db[_0xdfb8('0x2c')][_0xdfb8('0x41')](_0x4ebe6a);})[_0xdfb8('0x27')](function(_0x39cc0f){_0x3ab3d5['rows']=_0x39cc0f;return _0x3ab3d5;})['then'](respondWithFilteredResult(_0x513ad4,_0x4ebe6a))[_0xdfb8('0x42')](handleError(_0x513ad4,null));};exports[_0xdfb8('0x43')]=function(_0x15395a,_0x557743){var _0x2fa2e8={'raw':![],'where':{'id':_0x15395a[_0xdfb8('0x44')]['id']}},_0x1ab2cf={};_0x1ab2cf['model']=_[_0xdfb8('0x45')](db[_0xdfb8('0x2c')][_0xdfb8('0x2d')]);_0x1ab2cf[_0xdfb8('0x30')]=_[_0xdfb8('0x45')](_0x15395a[_0xdfb8('0x30')]);_0x1ab2cf[_0xdfb8('0x31')]=_[_0xdfb8('0x32')](_0x1ab2cf[_0xdfb8('0x33')],_0x1ab2cf['query']);_0x2fa2e8[_0xdfb8('0x34')]=_[_0xdfb8('0x32')](_0x1ab2cf['model'],qs[_0xdfb8('0x35')](_0x15395a[_0xdfb8('0x30')][_0xdfb8('0x35')]));_0x2fa2e8[_0xdfb8('0x34')]=_0x2fa2e8[_0xdfb8('0x34')][_0xdfb8('0x36')]?_0x2fa2e8['attributes']:_0x1ab2cf[_0xdfb8('0x33')];if(_0x15395a[_0xdfb8('0x30')][_0xdfb8('0x3f')]){_0x2fa2e8[_0xdfb8('0x40')]=[{'all':!![]}];}_0x2fa2e8=_[_0xdfb8('0x3c')]({},_0x2fa2e8,_0x15395a[_0xdfb8('0x3e')]);return db[_0xdfb8('0x2c')][_0xdfb8('0x46')](_0x2fa2e8)['then'](handleEntityNotFound(_0x557743,null))['then'](respondWithResult(_0x557743,null))[_0xdfb8('0x42')](handleError(_0x557743,null));};exports[_0xdfb8('0x47')]=function(_0x5360f8,_0x15f1f4){return db[_0xdfb8('0x2c')][_0xdfb8('0x47')](_0x5360f8[_0xdfb8('0x48')],{})[_0xdfb8('0x27')](respondWithResult(_0x15f1f4,0xc9))['catch'](handleError(_0x15f1f4,null));};exports[_0xdfb8('0x49')]=function(_0x292011,_0x1f1ef0){if(_0x292011['body']['id']){delete _0x292011['body']['id'];}return db['VoiceQueueReport'][_0xdfb8('0x46')]({'where':{'id':_0x292011[_0xdfb8('0x44')]['id']}})[_0xdfb8('0x27')](handleEntityNotFound(_0x1f1ef0,null))[_0xdfb8('0x27')](saveUpdates(_0x292011['body'],null))[_0xdfb8('0x27')](respondWithResult(_0x1f1ef0,null))[_0xdfb8('0x42')](handleError(_0x1f1ef0,null));};exports['destroy']=function(_0x4eb0a4,_0x1b0d85){return db[_0xdfb8('0x2c')][_0xdfb8('0x46')]({'where':{'id':_0x4eb0a4['params']['id']}})[_0xdfb8('0x27')](handleEntityNotFound(_0x1b0d85,null))[_0xdfb8('0x27')](removeEntity(_0x1b0d85,null))[_0xdfb8('0x42')](handleError(_0x1b0d85,null));};exports[_0xdfb8('0x4a')]=function(_0x81a021,_0xe8d642){return db[_0xdfb8('0x2c')][_0xdfb8('0x4a')]()['then'](respondWithResult(_0xe8d642,null))['catch'](handleError(_0xe8d642,null));};exports[_0xdfb8('0x4b')]=function(_0x2c08c9,_0x2671b4){var _0x290608={},_0x24a052={},_0x1c31be={'count':0x0,'rows':[]};_0x24a052['model']=_[_0xdfb8('0x45')](db[_0xdfb8('0x2c')][_0xdfb8('0x2d')]);_0x24a052['query']=_[_0xdfb8('0x45')](_0x2c08c9[_0xdfb8('0x30')]);_0x24a052[_0xdfb8('0x31')]=_['intersection'](_0x24a052['model'],_0x24a052[_0xdfb8('0x30')]);_0x290608['attributes']=_['intersection'](_0x24a052[_0xdfb8('0x33')],qs[_0xdfb8('0x35')](_0x2c08c9['query']['fields']));_0x290608[_0xdfb8('0x34')]=_0x290608[_0xdfb8('0x34')][_0xdfb8('0x36')]?_0x290608[_0xdfb8('0x34')]:_0x24a052['model'];if(!_0x2c08c9[_0xdfb8('0x30')][_0xdfb8('0x37')]('nolimit')){_0x290608[_0xdfb8('0x20')]=qs[_0xdfb8('0x20')](_0x2c08c9[_0xdfb8('0x30')][_0xdfb8('0x20')]);_0x290608[_0xdfb8('0x21')]=qs[_0xdfb8('0x21')](_0x2c08c9['query']['offset']);}_0x290608['order']=qs[_0xdfb8('0x4c')](_0x2c08c9['query'][_0xdfb8('0x4c')]);_0x290608[_0xdfb8('0x39')]=qs['filters'](_[_0xdfb8('0x3a')](_0x2c08c9[_0xdfb8('0x30')],_0x24a052[_0xdfb8('0x31')]));if(_0x2c08c9['query'][_0xdfb8('0x3b')]){_0x290608[_0xdfb8('0x39')]=_[_0xdfb8('0x3c')](_0x290608['where'],{'$or':_[_0xdfb8('0x2f')](_0x290608['attributes'],function(_0x4e2675){var _0x385bd1={};_0x385bd1[_0x4e2675]={'$like':'%'+_0x2c08c9[_0xdfb8('0x30')][_0xdfb8('0x3b')]+'%'};return _0x385bd1;})});}_0x290608=_[_0xdfb8('0x3c')]({},_0x290608,_0x2c08c9[_0xdfb8('0x3e')]);var _0x3448d2={'where':_0x290608[_0xdfb8('0x39')]};return db['VoiceQueueReport'][_0xdfb8('0x22')](_0x3448d2)['then'](function(_0x3580d8){_0x1c31be[_0xdfb8('0x22')]=_0x3580d8;if(_0x2c08c9[_0xdfb8('0x30')][_0xdfb8('0x3f')]){_0x290608['include']=[{'all':!![]}];}return db[_0xdfb8('0x2c')][_0xdfb8('0x41')](_0x290608);})['then'](function(_0x52945f){_0x1c31be['rows']=_0x52945f;return _0x1c31be;})[_0xdfb8('0x27')](respondWithFilteredResult(_0x2671b4,_0x290608,_0xdfb8('0x4b')))[_0xdfb8('0x42')](handleError(_0x2671b4,null,_0xdfb8('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 1d6ac50..dc55907 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 _0x4cc9=['hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','emit'];(function(_0x5b825e,_0x10f033){var _0x29f4f2=function(_0x533e5f){while(--_0x533e5f){_0x5b825e['push'](_0x5b825e['shift']());}};_0x29f4f2(++_0x10f033);}(_0x4cc9,0x15a));var _0x94cc=function(_0x545266,_0x440488){_0x545266=_0x545266-0x0;var _0x3d454e=_0x4cc9[_0x545266];return _0x3d454e;};'use strict';var EventEmitter=require(_0x94cc('0x0'));var VoiceQueueReport=require(_0x94cc('0x1'))['db'][_0x94cc('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x94cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51d675){return function(_0x5c6739,_0x540439,_0x40bd02){VoiceQueueReportEvents[_0x94cc('0x5')](_0x51d675+':'+_0x5c6739['id'],_0x5c6739);VoiceQueueReportEvents[_0x94cc('0x5')](_0x51d675,_0x5c6739);_0x40bd02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x94cc('0x6')](e,emitEvent(event));}}module[_0x94cc('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xcfe7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x2714a1,_0x19f3b9){var _0x53784b=function(_0x385dc2){while(--_0x385dc2){_0x2714a1['push'](_0x2714a1['shift']());}};_0x53784b(++_0x19f3b9);}(_0xcfe7,0x1e9));var _0x7cfe=function(_0x4069f6,_0x23888f){_0x4069f6=_0x4069f6-0x0;var _0x529cdb=_0xcfe7[_0x4069f6];return _0x529cdb;};'use strict';var EventEmitter=require(_0x7cfe('0x0'));var VoiceQueueReport=require(_0x7cfe('0x1'))['db'][_0x7cfe('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7cfe('0x3')](0x0);var events={'afterCreate':_0x7cfe('0x4'),'afterUpdate':_0x7cfe('0x5'),'afterDestroy':_0x7cfe('0x6')};function emitEvent(_0x1e0de9){return function(_0x422fcd,_0x4cedb6,_0x2cdf46){VoiceQueueReportEvents[_0x7cfe('0x7')](_0x1e0de9+':'+_0x422fcd['id'],_0x422fcd);VoiceQueueReportEvents[_0x7cfe('0x7')](_0x1e0de9,_0x422fcd);_0x2cdf46(null);};}for(var e in events){if(events[_0x7cfe('0x8')](e)){var event=events[e];VoiceQueueReport[_0x7cfe('0x9')](e,emitEvent(event));}}module[_0x7cfe('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 57a3f80..69774b5 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 _0x1b80=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue'];(function(_0x54a11f,_0x19d779){var _0x3fa817=function(_0x218f9c){while(--_0x218f9c){_0x54a11f['push'](_0x54a11f['shift']());}};_0x3fa817(++_0x19d779);}(_0x1b80,0xc3));var _0x01b8=function(_0x362947,_0x18005a){_0x362947=_0x362947-0x0;var _0x1c3d31=_0x1b80[_0x362947];return _0x1c3d31;};'use strict';var _=require(_0x01b8('0x0'));var util=require(_0x01b8('0x1'));var logger=require(_0x01b8('0x2'))(_0x01b8('0x3'));var moment=require(_0x01b8('0x4'));var BPromise=require(_0x01b8('0x5'));var rp=require(_0x01b8('0x6'));var fs=require('fs');var path=require(_0x01b8('0x7'));var rimraf=require(_0x01b8('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x01b8('0x9')]=function(_0x1e0354,_0x26cbe2){return _0x1e0354[_0x01b8('0xa')](_0x01b8('0xb'),attributes,{'tableName':_0x01b8('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95c3=['calleridnum','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0x95c3,0xfb));var _0x395c=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x95c3[_0x14a0a0];return _0x56b651;};'use strict';var _=require(_0x395c('0x0'));var util=require('util');var logger=require(_0x395c('0x1'))(_0x395c('0x2'));var moment=require(_0x395c('0x3'));var BPromise=require(_0x395c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x395c('0x5'));var config=require(_0x395c('0x6'));var attributes=require(_0x395c('0x7'));module['exports']=function(_0xfea162,_0x21602f){return _0xfea162[_0x395c('0x8')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x395c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d57b1cc..d3b7a8a 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 _0x84e7=['update','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport'];(function(_0x5820df,_0x24240a){var _0x7a47f1=function(_0x37410b){while(--_0x37410b){_0x5820df['push'](_0x5820df['shift']());}};_0x7a47f1(++_0x24240a);}(_0x84e7,0x121));var _0x784e=function(_0xafa225,_0xd29c03){_0xafa225=_0xafa225-0x0;var _0x4f546a=_0x84e7[_0xafa225];return _0x4f546a;};'use strict';var _=require(_0x784e('0x0'));var util=require('util');var moment=require(_0x784e('0x1'));var BPromise=require(_0x784e('0x2'));var rs=require(_0x784e('0x3'));var fs=require('fs');var Redis=require(_0x784e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x784e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x784e('0x6'));var client=jayson[_0x784e('0x7')]['http']({'port':0x232a});config['redis']=_[_0x784e('0x8')](config[_0x784e('0x9')],{'host':_0x784e('0xa'),'port':0x18eb});var socket=require(_0x784e('0xb'))(new Redis(config[_0x784e('0x9')]));require('./voiceQueueReport.socket')[_0x784e('0xc')](socket);function respondWithRpcPromise(_0xf1cec1,_0x274c95,_0x599a32){return new BPromise(function(_0xf78408,_0x237610){return client[_0x784e('0xd')](_0xf1cec1,_0x599a32)[_0x784e('0xe')](function(_0x3c07a8){logger['info'](_0x784e('0xf'),_0x274c95,_0x784e('0x10'));logger[_0x784e('0x11')](_0x784e('0x12'),_0x274c95,_0x784e('0x10'),JSON['stringify'](_0x3c07a8));if(_0x3c07a8['error']){if(_0x3c07a8['error'][_0x784e('0x13')]===0x1f4){logger[_0x784e('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x274c95,_0x3c07a8[_0x784e('0x14')][_0x784e('0x15')]);return _0x237610(_0x3c07a8[_0x784e('0x14')]['message']);}logger[_0x784e('0x14')](_0x784e('0xf'),_0x274c95,_0x3c07a8['error'][_0x784e('0x15')]);return _0xf78408(_0x3c07a8[_0x784e('0x14')][_0x784e('0x15')]);}else{logger[_0x784e('0x16')](_0x784e('0xf'),_0x274c95,_0x784e('0x10'));_0xf78408(_0x3c07a8[_0x784e('0x17')]['message']);}})[_0x784e('0x18')](function(_0x6d8a78){logger[_0x784e('0x14')](_0x784e('0xf'),_0x274c95,_0x6d8a78);_0x237610(_0x6d8a78);});});}exports[_0x784e('0x19')]=function(_0xd06fe1){var _0x1bd46b=this;return new Promise(function(_0x13e142,_0x29a3ed){return db[_0x784e('0x1a')]['findAll']({'raw':_0xd06fe1[_0x784e('0x1b')]?_0xd06fe1[_0x784e('0x1b')][_0x784e('0x1c')]===undefined?!![]:![]:!![],'where':_0xd06fe1['options']?_0xd06fe1['options'][_0x784e('0x1d')]||null:null,'attributes':_0xd06fe1[_0x784e('0x1b')]?_0xd06fe1[_0x784e('0x1b')][_0x784e('0x1e')]||null:null,'limit':_0xd06fe1[_0x784e('0x1b')]?_0xd06fe1['options']['limit']||null:null,'include':_0xd06fe1[_0x784e('0x1b')]?_0xd06fe1[_0x784e('0x1b')][_0x784e('0x1f')]?_[_0x784e('0x20')](_0xd06fe1['options']['include'],function(_0x5db4a8){return{'model':db[_0x5db4a8[_0x784e('0x21')]],'as':_0x5db4a8['as'],'attributes':_0x5db4a8[_0x784e('0x1e')],'include':_0x5db4a8[_0x784e('0x1f')]?_[_0x784e('0x20')](_0x5db4a8[_0x784e('0x1f')],function(_0xdcd857){return{'model':db[_0xdcd857['model']],'as':_0xdcd857['as'],'attributes':_0xdcd857[_0x784e('0x1e')],'include':_0xdcd857['include']?_['map'](_0xdcd857[_0x784e('0x1f')],function(_0x2a9bce){return{'model':db[_0x2a9bce[_0x784e('0x21')]],'as':_0x2a9bce['as'],'attributes':_0x2a9bce[_0x784e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x784e('0xe')](function(_0x85b6d1){logger[_0x784e('0x16')](_0x784e('0x19'),_0xd06fe1);logger[_0x784e('0x11')](_0x784e('0x19'),_0xd06fe1,JSON['stringify'](_0x85b6d1));_0x13e142(_0x85b6d1);})[_0x784e('0x18')](function(_0xc41ed7){logger[_0x784e('0x14')](_0x784e('0x19'),_0xc41ed7[_0x784e('0x15')],_0xd06fe1);_0x29a3ed(_0x1bd46b[_0x784e('0x14')](0x1f4,_0xc41ed7[_0x784e('0x15')]));});});};exports[_0x784e('0x22')]=function(_0x31cc99){var _0x118f99=this;return new Promise(function(_0x4b4638,_0x38244c){return db[_0x784e('0x1a')][_0x784e('0x23')](_0x31cc99[_0x784e('0x24')],{'raw':_0x31cc99[_0x784e('0x1b')]?_0x31cc99['options'][_0x784e('0x1c')]===undefined?!![]:![]:!![]})[_0x784e('0xe')](function(_0x4bf5f0){logger[_0x784e('0x16')](_0x784e('0x22'),_0x31cc99);logger['debug'](_0x784e('0x22'),_0x31cc99,JSON[_0x784e('0x25')](_0x4bf5f0));_0x4b4638(_0x4bf5f0);})[_0x784e('0x18')](function(_0x352536){logger[_0x784e('0x14')](_0x784e('0x22'),_0x352536[_0x784e('0x15')],_0x31cc99);_0x38244c(_0x118f99[_0x784e('0x14')](0x1f4,_0x352536[_0x784e('0x15')]));});});};exports[_0x784e('0x26')]=function(_0x49ad92){var _0x3f26ee=this;return new Promise(function(_0x217d32,_0x3acd86){return db[_0x784e('0x1a')][_0x784e('0x27')](_0x49ad92[_0x784e('0x24')],{'raw':_0x49ad92['options']?_0x49ad92[_0x784e('0x1b')][_0x784e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49ad92[_0x784e('0x1b')]?_0x49ad92[_0x784e('0x1b')]['where']||null:null,'attributes':_0x49ad92[_0x784e('0x1b')]?_0x49ad92['options']['attributes']||null:null,'limit':_0x49ad92['options']?_0x49ad92[_0x784e('0x1b')][_0x784e('0x28')]||null:null})[_0x784e('0xe')](function(_0x2037a0){logger[_0x784e('0x16')](_0x784e('0x26'),_0x49ad92);logger[_0x784e('0x11')]('UpdateVoiceQueueReport',_0x49ad92,JSON['stringify'](_0x2037a0));_0x217d32(_0x2037a0);})[_0x784e('0x18')](function(_0x33a446){logger['error'](_0x784e('0x26'),_0x33a446[_0x784e('0x15')],_0x49ad92);_0x3acd86(_0x3f26ee[_0x784e('0x14')](0x1f4,_0x33a446['message']));});});}; \ No newline at end of file +var _0x4ff4=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4ff4,0xab));var _0x44ff=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x4ff4[_0x2d89ce];return _0x3fad10;};'use strict';var _=require('lodash');var util=require(_0x44ff('0x0'));var moment=require(_0x44ff('0x1'));var BPromise=require(_0x44ff('0x2'));var rs=require(_0x44ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44ff('0x4'))['db'];var utils=require(_0x44ff('0x5'));var logger=require('../../config/logger')(_0x44ff('0x6'));var config=require(_0x44ff('0x7'));var jayson=require(_0x44ff('0x8'));var client=jayson['client'][_0x44ff('0x9')]({'port':0x232a});config['redis']=_[_0x44ff('0xa')](config[_0x44ff('0xb')],{'host':_0x44ff('0xc'),'port':0x18eb});var socket=require(_0x44ff('0xd'))(new Redis(config[_0x44ff('0xb')]));require(_0x44ff('0xe'))[_0x44ff('0xf')](socket);function respondWithRpcPromise(_0x17c345,_0x4752a4,_0x20f63e){return new BPromise(function(_0x516342,_0x5e64fb){return client[_0x44ff('0x10')](_0x17c345,_0x20f63e)[_0x44ff('0x11')](function(_0x339be4){logger[_0x44ff('0x12')](_0x44ff('0x13'),_0x4752a4,_0x44ff('0x14'));logger['debug'](_0x44ff('0x15'),_0x4752a4,'request\x20sent',JSON[_0x44ff('0x16')](_0x339be4));if(_0x339be4[_0x44ff('0x17')]){if(_0x339be4[_0x44ff('0x17')][_0x44ff('0x18')]===0x1f4){logger[_0x44ff('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x4752a4,_0x339be4[_0x44ff('0x17')][_0x44ff('0x19')]);return _0x5e64fb(_0x339be4[_0x44ff('0x17')][_0x44ff('0x19')]);}logger['error'](_0x44ff('0x13'),_0x4752a4,_0x339be4[_0x44ff('0x17')]['message']);return _0x516342(_0x339be4[_0x44ff('0x17')]['message']);}else{logger['info'](_0x44ff('0x13'),_0x4752a4,_0x44ff('0x14'));_0x516342(_0x339be4[_0x44ff('0x1a')][_0x44ff('0x19')]);}})[_0x44ff('0x1b')](function(_0x25e61e){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4752a4,_0x25e61e);_0x5e64fb(_0x25e61e);});});}exports[_0x44ff('0x1c')]=function(_0x3a9b8e){var _0x1a0d77=this;return new Promise(function(_0x3e9c80,_0x57ee19){return db[_0x44ff('0x1d')][_0x44ff('0x1e')]({'raw':_0x3a9b8e[_0x44ff('0x1f')]?_0x3a9b8e['options'][_0x44ff('0x20')]===undefined?!![]:![]:!![],'where':_0x3a9b8e[_0x44ff('0x1f')]?_0x3a9b8e[_0x44ff('0x1f')]['where']||null:null,'attributes':_0x3a9b8e['options']?_0x3a9b8e[_0x44ff('0x1f')][_0x44ff('0x21')]||null:null,'limit':_0x3a9b8e[_0x44ff('0x1f')]?_0x3a9b8e[_0x44ff('0x1f')][_0x44ff('0x22')]||null:null,'include':_0x3a9b8e[_0x44ff('0x1f')]?_0x3a9b8e[_0x44ff('0x1f')][_0x44ff('0x23')]?_[_0x44ff('0x24')](_0x3a9b8e['options']['include'],function(_0x49113a){return{'model':db[_0x49113a[_0x44ff('0x25')]],'as':_0x49113a['as'],'attributes':_0x49113a['attributes'],'include':_0x49113a[_0x44ff('0x23')]?_[_0x44ff('0x24')](_0x49113a[_0x44ff('0x23')],function(_0x5cf3bb){return{'model':db[_0x5cf3bb[_0x44ff('0x25')]],'as':_0x5cf3bb['as'],'attributes':_0x5cf3bb[_0x44ff('0x21')],'include':_0x5cf3bb[_0x44ff('0x23')]?_[_0x44ff('0x24')](_0x5cf3bb['include'],function(_0x1e9869){return{'model':db[_0x1e9869[_0x44ff('0x25')]],'as':_0x1e9869['as'],'attributes':_0x1e9869[_0x44ff('0x21')]};}):[]};}):[]};}):[]:[]})[_0x44ff('0x11')](function(_0x5beeb0){logger[_0x44ff('0x12')](_0x44ff('0x1c'),_0x3a9b8e);logger['debug'](_0x44ff('0x1c'),_0x3a9b8e,JSON[_0x44ff('0x16')](_0x5beeb0));_0x3e9c80(_0x5beeb0);})['catch'](function(_0x2b25cc){logger[_0x44ff('0x17')]('GetVoiceQueueReport',_0x2b25cc[_0x44ff('0x19')],_0x3a9b8e);_0x57ee19(_0x1a0d77[_0x44ff('0x17')](0x1f4,_0x2b25cc[_0x44ff('0x19')]));});});};exports[_0x44ff('0x26')]=function(_0xf84779){var _0x2d71b9=this;return new Promise(function(_0x474ad2,_0x538cfb){return db[_0x44ff('0x1d')][_0x44ff('0x27')](_0xf84779[_0x44ff('0x28')],{'raw':_0xf84779[_0x44ff('0x1f')]?_0xf84779[_0x44ff('0x1f')][_0x44ff('0x20')]===undefined?!![]:![]:!![]})[_0x44ff('0x11')](function(_0xda204a){logger[_0x44ff('0x12')](_0x44ff('0x26'),_0xf84779);logger[_0x44ff('0x29')]('CreateVoiceQueueReport',_0xf84779,JSON['stringify'](_0xda204a));_0x474ad2(_0xda204a);})[_0x44ff('0x1b')](function(_0x5ef53b){logger[_0x44ff('0x17')](_0x44ff('0x26'),_0x5ef53b['message'],_0xf84779);_0x538cfb(_0x2d71b9[_0x44ff('0x17')](0x1f4,_0x5ef53b[_0x44ff('0x19')]));});});};exports[_0x44ff('0x2a')]=function(_0x46c4f1){var _0x574262=this;return new Promise(function(_0x443cc2,_0x256427){return db[_0x44ff('0x1d')]['update'](_0x46c4f1['body'],{'raw':_0x46c4f1[_0x44ff('0x1f')]?_0x46c4f1['options'][_0x44ff('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c4f1[_0x44ff('0x1f')]?_0x46c4f1['options']['where']||null:null,'attributes':_0x46c4f1['options']?_0x46c4f1[_0x44ff('0x1f')][_0x44ff('0x21')]||null:null,'limit':_0x46c4f1[_0x44ff('0x1f')]?_0x46c4f1[_0x44ff('0x1f')][_0x44ff('0x22')]||null:null})[_0x44ff('0x11')](function(_0x2dd9f8){logger['info'](_0x44ff('0x2a'),_0x46c4f1);logger['debug']('UpdateVoiceQueueReport',_0x46c4f1,JSON[_0x44ff('0x16')](_0x2dd9f8));_0x443cc2(_0x2dd9f8);})['catch'](function(_0x329a6){logger['error'](_0x44ff('0x2a'),_0x329a6[_0x44ff('0x19')],_0x46c4f1);_0x256427(_0x574262[_0x44ff('0x17')](0x1f4,_0x329a6[_0x44ff('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3d1caed..20ab646 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 _0x57c2=['remove','update','emit','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x22fa8,_0x1068eb){var _0x5c74be=function(_0x37a231){while(--_0x37a231){_0x22fa8['push'](_0x22fa8['shift']());}};_0x5c74be(++_0x1068eb);}(_0x57c2,0x113));var _0x257c=function(_0x7c3520,_0x1e3555){_0x7c3520=_0x7c3520-0x0;var _0x4235cd=_0x57c2[_0x7c3520];return _0x4235cd;};'use strict';var VoiceQueueReportEvents=require(_0x257c('0x0'));var events=['save',_0x257c('0x1'),_0x257c('0x2')];function createListener(_0x268cc9,_0x5a5dfd){return function(_0x2aa60f){_0x5a5dfd[_0x257c('0x3')](_0x268cc9,_0x2aa60f);};}function removeListener(_0x49960b,_0x1a8960){return function(){VoiceQueueReportEvents['removeListener'](_0x49960b,_0x1a8960);};}exports['register']=function(_0x5a5612){for(var _0x473f2a=0x0,_0x5dad00=events[_0x257c('0x4')];_0x473f2a<_0x5dad00;_0x473f2a++){var _0x5cfd3a=events[_0x473f2a];var _0x312f0a=createListener(_0x257c('0x5')+_0x5cfd3a,_0x5a5612);VoiceQueueReportEvents['on'](_0x5cfd3a,_0x312f0a);}}; \ No newline at end of file +var _0x4c3c=['./voiceQueueReport.events','save','update','removeListener','register','length','voiceQueueReport:'];(function(_0x1e266f,_0x26376b){var _0x4f1b6d=function(_0xe0306a){while(--_0xe0306a){_0x1e266f['push'](_0x1e266f['shift']());}};_0x4f1b6d(++_0x26376b);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x2f5ebe,_0x154ebc){_0x2f5ebe=_0x2f5ebe-0x0;var _0x1e5006=_0x4c3c[_0x2f5ebe];return _0x1e5006;};'use strict';var VoiceQueueReportEvents=require(_0xc4c3('0x0'));var events=[_0xc4c3('0x1'),'remove',_0xc4c3('0x2')];function createListener(_0x5354f4,_0x541536){return function(_0xda4182){_0x541536['emit'](_0x5354f4,_0xda4182);};}function removeListener(_0x4da755,_0x4b9976){return function(){VoiceQueueReportEvents[_0xc4c3('0x3')](_0x4da755,_0x4b9976);};}exports[_0xc4c3('0x4')]=function(_0x36cea1){for(var _0x1cb620=0x0,_0x36d3c5=events[_0xc4c3('0x5')];_0x1cb620<_0x36d3c5;_0x1cb620++){var _0x59355d=events[_0x1cb620];var _0x4301a7=createListener(_0xc4c3('0x6')+_0x59355d,_0x36cea1);VoiceQueueReportEvents['on'](_0x59355d,_0x4301a7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e44ba93..1d570e3 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 _0x1417=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x1caaca,_0xfcebe9){var _0x35c1e1=function(_0x1c4f2a){while(--_0x1c4f2a){_0x1caaca['push'](_0x1caaca['shift']());}};_0x35c1e1(++_0xfcebe9);}(_0x1417,0x17b));var _0x7141=function(_0x487fba,_0x300904){_0x487fba=_0x487fba-0x0;var _0x4a4301=_0x1417[_0x487fba];return _0x4a4301;};'use strict';var multer=require(_0x7141('0x0'));var util=require(_0x7141('0x1'));var path=require(_0x7141('0x2'));var timeout=require(_0x7141('0x3'));var express=require(_0x7141('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7141('0x5'));var config=require(_0x7141('0x6'));var controller=require(_0x7141('0x7'));router[_0x7141('0x8')]('/',auth[_0x7141('0x9')](),controller[_0x7141('0xa')]);router[_0x7141('0x8')](_0x7141('0xb'),auth[_0x7141('0x9')](),controller[_0x7141('0xc')]);router[_0x7141('0xd')]('/',auth[_0x7141('0x9')](),controller[_0x7141('0xe')]);router[_0x7141('0xf')](_0x7141('0xb'),auth[_0x7141('0x9')](),controller['update']);router[_0x7141('0x10')](_0x7141('0xb'),auth[_0x7141('0x9')](),controller[_0x7141('0x11')]);module[_0x7141('0x12')]=router; \ No newline at end of file +var _0xb63c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x18abfd,_0x5003f0){var _0xb96056=function(_0x125497){while(--_0x125497){_0x18abfd['push'](_0x18abfd['shift']());}};_0xb96056(++_0x5003f0);}(_0xb63c,0x155));var _0xcb63=function(_0x31b667,_0x5c377f){_0x31b667=_0x31b667-0x0;var _0x1a8ebc=_0xb63c[_0x31b667];return _0x1a8ebc;};'use strict';var multer=require(_0xcb63('0x0'));var util=require(_0xcb63('0x1'));var path=require(_0xcb63('0x2'));var timeout=require(_0xcb63('0x3'));var express=require(_0xcb63('0x4'));var router=express[_0xcb63('0x5')]();var fs_extra=require(_0xcb63('0x6'));var auth=require(_0xcb63('0x7'));var interaction=require(_0xcb63('0x8'));var config=require(_0xcb63('0x9'));var controller=require(_0xcb63('0xa'));router[_0xcb63('0xb')]('/',auth[_0xcb63('0xc')](),controller[_0xcb63('0xd')]);router[_0xcb63('0xb')](_0xcb63('0xe'),auth[_0xcb63('0xc')](),controller[_0xcb63('0xf')]);router[_0xcb63('0x10')]('/',auth[_0xcb63('0xc')](),controller[_0xcb63('0x11')]);router[_0xcb63('0x12')]('/:id',auth[_0xcb63('0xc')](),controller[_0xcb63('0x13')]);router[_0xcb63('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcb63('0x15')]);module[_0xcb63('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f13c5f8..cc3f49c 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 _0xa22b=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE'];(function(_0x54e90c,_0x1937c8){var _0x5dd560=function(_0x45550f){while(--_0x45550f){_0x54e90c['push'](_0x54e90c['shift']());}};_0x5dd560(++_0x1937c8);}(_0xa22b,0xc8));var _0xba22=function(_0x3edb3b,_0x44de0e){_0x3edb3b=_0x3edb3b-0x0;var _0x41e31b=_0xa22b[_0x3edb3b];return _0x41e31b;};'use strict';var Sequelize=require(_0xba22('0x0'));var moment=require('moment');module[_0xba22('0x1')]={'time':{'type':Sequelize[_0xba22('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xba22('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xba22('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xba22('0x4')](_0xba22('0x5'))}}; \ No newline at end of file +var _0x343a=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x1ce0ff,_0x1d224c){var _0x448b56=function(_0x508338){while(--_0x508338){_0x1ce0ff['push'](_0x1ce0ff['shift']());}};_0x448b56(++_0x1d224c);}(_0x343a,0x1e8));var _0xa343=function(_0x131d26,_0xcee64c){_0x131d26=_0x131d26-0x0;var _0x4f7550=_0x343a[_0x131d26];return _0x4f7550;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa343('0x0'));module[_0xa343('0x1')]={'time':{'type':Sequelize[_0xa343('0x2')]},'callid':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa343('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa343('0x3')](_0xa343('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 34c569b..ea96894 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 _0x6095=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name','VoiceQueuesLog','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','intersection','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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(_0x2ddd13,_0x4dd0bd){var _0x8b928b=function(_0x129516){while(--_0x129516){_0x2ddd13['push'](_0x2ddd13['shift']());}};_0x8b928b(++_0x4dd0bd);}(_0x6095,0x194));var _0x5609=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x6095[_0x456fb1];return _0x4083d6;};'use strict';var emlformat=require(_0x5609('0x0'));var rimraf=require(_0x5609('0x1'));var zipdir=require(_0x5609('0x2'));var jsonpatch=require(_0x5609('0x3'));var rp=require('request-promise');var moment=require(_0x5609('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5609('0x5'));var util=require('util');var path=require(_0x5609('0x6'));var sox=require('sox');var csv=require(_0x5609('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5609('0x8'));var squel=require(_0x5609('0x9'));var crypto=require(_0x5609('0xa'));var jsforce=require(_0x5609('0xb'));var deskjs=require(_0x5609('0xc'));var toCsv=require(_0x5609('0x7'));var querystring=require(_0x5609('0xd'));var Papa=require(_0x5609('0xe'));var Redis=require(_0x5609('0xf'));var authService=require(_0x5609('0x10'));var qs=require(_0x5609('0x11'));var as=require(_0x5609('0x12'));var hardwareService=require(_0x5609('0x13'));var logger=require(_0x5609('0x14'))(_0x5609('0x15'));var utils=require(_0x5609('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5609('0x17'));var db=require(_0x5609('0x18'))['db'];function respondWithStatusCode(_0x1d1221,_0x82b4a1){_0x82b4a1=_0x82b4a1||0xcc;return function(_0x254822){if(_0x254822){return _0x1d1221[_0x5609('0x19')](_0x82b4a1);}return _0x1d1221[_0x5609('0x1a')](_0x82b4a1)[_0x5609('0x1b')]();};}function respondWithResult(_0x2c0a74,_0x2f5b5d){_0x2f5b5d=_0x2f5b5d||0xc8;return function(_0xa74069){if(_0xa74069){return _0x2c0a74[_0x5609('0x1a')](_0x2f5b5d)[_0x5609('0x1c')](_0xa74069);}};}function respondWithFilteredResult(_0x14c96b,_0x5b395a){return function(_0x1d0e27){if(_0x1d0e27){var _0x412092=typeof _0x5b395a[_0x5609('0x1d')]===_0x5609('0x1e')&&typeof _0x5b395a[_0x5609('0x1f')]===_0x5609('0x1e');var _0x3c2a4c=_0x1d0e27[_0x5609('0x20')];var _0x55e970=_0x412092?0x0:_0x5b395a[_0x5609('0x1d')];var _0x277bb2=_0x412092?_0x1d0e27[_0x5609('0x20')]:_0x5b395a[_0x5609('0x1d')]+_0x5b395a[_0x5609('0x1f')];var _0x11be44;if(_0x277bb2>=_0x3c2a4c){_0x277bb2=_0x3c2a4c;_0x11be44=0xc8;}else{_0x11be44=0xce;}_0x14c96b[_0x5609('0x1a')](_0x11be44);return _0x14c96b[_0x5609('0x21')](_0x5609('0x22'),_0x55e970+'-'+_0x277bb2+'/'+_0x3c2a4c)['json'](_0x1d0e27);}return null;};}function patchUpdates(_0x2baf40){return function(_0x50b0a7){try{jsonpatch[_0x5609('0x23')](_0x50b0a7,_0x2baf40,!![]);}catch(_0x5bcf9e){return BPromise[_0x5609('0x24')](_0x5bcf9e);}return _0x50b0a7['save']();};}function saveUpdates(_0x1280ab,_0x1f0892){return function(_0x29280c){if(_0x29280c){return _0x29280c['update'](_0x1280ab)['then'](function(_0x4a2f7b){return _0x4a2f7b;});}return null;};}function removeEntity(_0x57e5b2,_0x550ff1){return function(_0x381ac7){if(_0x381ac7){return _0x381ac7[_0x5609('0x25')]()[_0x5609('0x26')](function(){_0x57e5b2[_0x5609('0x1a')](0xcc)[_0x5609('0x1b')]();});}};}function handleEntityNotFound(_0x4d7835,_0x540b43){return function(_0x4795d3){if(!_0x4795d3){_0x4d7835[_0x5609('0x19')](0x194);}return _0x4795d3;};}function handleError(_0x30ca71,_0x2fa761){_0x2fa761=_0x2fa761||0x1f4;return function(_0x3b7faa){logger['error'](_0x3b7faa[_0x5609('0x27')]);if(_0x3b7faa[_0x5609('0x28')]){delete _0x3b7faa[_0x5609('0x28')];}_0x30ca71[_0x5609('0x1a')](_0x2fa761)['send'](_0x3b7faa);};}exports['index']=function(_0x1350ac,_0x3638f4){var _0x4ac631={},_0x2a69c9={},_0x45b6ca={'count':0x0,'rows':[]};var _0x4d10b6=_['map'](db[_0x5609('0x29')]['rawAttributes'],function(_0x30ef30){return{'name':_0x30ef30[_0x5609('0x2a')],'type':_0x30ef30['type'][_0x5609('0x2b')]};});_0x2a69c9['model']=_['map'](_0x4d10b6,'name');_0x2a69c9[_0x5609('0x2c')]=_[_0x5609('0x2d')](_0x1350ac[_0x5609('0x2c')]);_0x2a69c9[_0x5609('0x2e')]=_['intersection'](_0x2a69c9[_0x5609('0x2f')],_0x2a69c9['query']);_0x4ac631[_0x5609('0x30')]=_['intersection'](_0x2a69c9['model'],qs[_0x5609('0x31')](_0x1350ac[_0x5609('0x2c')][_0x5609('0x31')]));_0x4ac631[_0x5609('0x30')]=_0x4ac631[_0x5609('0x30')][_0x5609('0x32')]?_0x4ac631['attributes']:_0x2a69c9[_0x5609('0x2f')];if(!_0x1350ac[_0x5609('0x2c')][_0x5609('0x33')](_0x5609('0x34'))){_0x4ac631[_0x5609('0x1f')]=qs[_0x5609('0x1f')](_0x1350ac[_0x5609('0x2c')][_0x5609('0x1f')]);_0x4ac631[_0x5609('0x1d')]=qs[_0x5609('0x1d')](_0x1350ac[_0x5609('0x2c')][_0x5609('0x1d')]);}_0x4ac631['order']=qs['sort'](_0x1350ac[_0x5609('0x2c')][_0x5609('0x35')]);_0x4ac631[_0x5609('0x36')]=qs[_0x5609('0x2e')](_[_0x5609('0x37')](_0x1350ac[_0x5609('0x2c')],_0x2a69c9[_0x5609('0x2e')]),_0x4d10b6);if(_0x1350ac[_0x5609('0x2c')]['filter']){_0x4ac631[_0x5609('0x36')]=_[_0x5609('0x38')](_0x4ac631[_0x5609('0x36')],{'$or':_[_0x5609('0x39')](_0x4d10b6,function(_0x11cac9){if(_0x11cac9['type']!==_0x5609('0x3a')){var _0x4e6873={};_0x4e6873[_0x11cac9['name']]={'$like':'%'+_0x1350ac['query'][_0x5609('0x3b')]+'%'};return _0x4e6873;}})});}_0x4ac631=_['merge']({},_0x4ac631,_0x1350ac[_0x5609('0x3c')]);var _0x4c9447={'where':_0x4ac631['where']};return db[_0x5609('0x29')][_0x5609('0x20')](_0x4c9447)[_0x5609('0x26')](function(_0x11766b){_0x45b6ca[_0x5609('0x20')]=_0x11766b;if(_0x1350ac[_0x5609('0x2c')][_0x5609('0x3d')]){_0x4ac631[_0x5609('0x3e')]=[{'all':!![]}];}return db[_0x5609('0x29')][_0x5609('0x3f')](_0x4ac631);})[_0x5609('0x26')](function(_0xf0dda6){_0x45b6ca['rows']=_0xf0dda6;return _0x45b6ca;})[_0x5609('0x26')](respondWithFilteredResult(_0x3638f4,_0x4ac631))[_0x5609('0x40')](handleError(_0x3638f4,null));};exports['show']=function(_0x55dbde,_0x2b6c2f){var _0x5e5056={'raw':!![],'where':{'id':_0x55dbde[_0x5609('0x41')]['id']}},_0x2f30cd={};_0x2f30cd[_0x5609('0x2f')]=_['keys'](db[_0x5609('0x29')]['rawAttributes']);_0x2f30cd[_0x5609('0x2c')]=_['keys'](_0x55dbde[_0x5609('0x2c')]);_0x2f30cd[_0x5609('0x2e')]=_[_0x5609('0x42')](_0x2f30cd[_0x5609('0x2f')],_0x2f30cd['query']);_0x5e5056['attributes']=_['intersection'](_0x2f30cd[_0x5609('0x2f')],qs[_0x5609('0x31')](_0x55dbde['query']['fields']));_0x5e5056[_0x5609('0x30')]=_0x5e5056[_0x5609('0x30')][_0x5609('0x32')]?_0x5e5056['attributes']:_0x2f30cd[_0x5609('0x2f')];if(_0x55dbde['query'][_0x5609('0x3d')]){_0x5e5056[_0x5609('0x3e')]=[{'all':!![]}];}_0x5e5056=_[_0x5609('0x38')]({},_0x5e5056,_0x55dbde[_0x5609('0x3c')]);return db[_0x5609('0x29')][_0x5609('0x43')](_0x5e5056)['then'](handleEntityNotFound(_0x2b6c2f,null))['then'](respondWithResult(_0x2b6c2f,null))[_0x5609('0x40')](handleError(_0x2b6c2f,null));};exports[_0x5609('0x44')]=function(_0x1f2cac,_0x571047){return db[_0x5609('0x29')][_0x5609('0x44')](_0x1f2cac['body'],{})[_0x5609('0x26')](respondWithResult(_0x571047,0xc9))[_0x5609('0x40')](handleError(_0x571047,null));};exports[_0x5609('0x45')]=function(_0x528b6a,_0x4d049a){if(_0x528b6a['body']['id']){delete _0x528b6a['body']['id'];}return db[_0x5609('0x29')][_0x5609('0x43')]({'where':{'id':_0x528b6a[_0x5609('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d049a,null))['then'](saveUpdates(_0x528b6a[_0x5609('0x46')],null))[_0x5609('0x26')](respondWithResult(_0x4d049a,null))[_0x5609('0x40')](handleError(_0x4d049a,null));};exports[_0x5609('0x25')]=function(_0x485f4b,_0x599f88){return db[_0x5609('0x29')][_0x5609('0x43')]({'where':{'id':_0x485f4b[_0x5609('0x41')]['id']}})[_0x5609('0x26')](handleEntityNotFound(_0x599f88,null))[_0x5609('0x26')](removeEntity(_0x599f88,null))[_0x5609('0x40')](handleError(_0x599f88,null));}; \ No newline at end of file +var _0x5b8f=['limit','count','json','save','update','then','destroy','error','stack','send','map','VoiceQueuesLog','key','model','name','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','intersection','merge','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x1511d1,_0x93c805){var _0x3f0e3f=function(_0xc1dc38){while(--_0xc1dc38){_0x1511d1['push'](_0x1511d1['shift']());}};_0x3f0e3f(++_0x93c805);}(_0x5b8f,0x140));var _0xf5b8=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0x5b8f[_0x35c97a];return _0x388917;};'use strict';var emlformat=require(_0xf5b8('0x0'));var rimraf=require(_0xf5b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5b8('0x2'));var rp=require(_0xf5b8('0x3'));var moment=require(_0xf5b8('0x4'));var BPromise=require(_0xf5b8('0x5'));var Mustache=require(_0xf5b8('0x6'));var util=require(_0xf5b8('0x7'));var path=require(_0xf5b8('0x8'));var sox=require(_0xf5b8('0x9'));var csv=require(_0xf5b8('0xa'));var ejs=require(_0xf5b8('0xb'));var fs=require('fs');var fs_extra=require(_0xf5b8('0xc'));var _=require(_0xf5b8('0xd'));var squel=require('squel');var crypto=require(_0xf5b8('0xe'));var jsforce=require(_0xf5b8('0xf'));var deskjs=require(_0xf5b8('0x10'));var toCsv=require(_0xf5b8('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf5b8('0x11'));var qs=require(_0xf5b8('0x12'));var as=require(_0xf5b8('0x13'));var hardwareService=require(_0xf5b8('0x14'));var logger=require('../../config/logger')(_0xf5b8('0x15'));var utils=require(_0xf5b8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf5b8('0x17'));var db=require(_0xf5b8('0x18'))['db'];function respondWithStatusCode(_0x3cb650,_0x216562){_0x216562=_0x216562||0xcc;return function(_0x5388a7){if(_0x5388a7){return _0x3cb650[_0xf5b8('0x19')](_0x216562);}return _0x3cb650[_0xf5b8('0x1a')](_0x216562)[_0xf5b8('0x1b')]();};}function respondWithResult(_0x147226,_0x57bd51){_0x57bd51=_0x57bd51||0xc8;return function(_0x3b8f43){if(_0x3b8f43){return _0x147226[_0xf5b8('0x1a')](_0x57bd51)['json'](_0x3b8f43);}};}function respondWithFilteredResult(_0x5e1f5f,_0x4e443d){return function(_0x16dbab){if(_0x16dbab){var _0x5fb23b=typeof _0x4e443d[_0xf5b8('0x1c')]===_0xf5b8('0x1d')&&typeof _0x4e443d[_0xf5b8('0x1e')]===_0xf5b8('0x1d');var _0x19c54b=_0x16dbab[_0xf5b8('0x1f')];var _0x5c798e=_0x5fb23b?0x0:_0x4e443d[_0xf5b8('0x1c')];var _0x45810f=_0x5fb23b?_0x16dbab[_0xf5b8('0x1f')]:_0x4e443d['offset']+_0x4e443d['limit'];var _0x485be4;if(_0x45810f>=_0x19c54b){_0x45810f=_0x19c54b;_0x485be4=0xc8;}else{_0x485be4=0xce;}_0x5e1f5f[_0xf5b8('0x1a')](_0x485be4);return _0x5e1f5f['set']('Content-Range',_0x5c798e+'-'+_0x45810f+'/'+_0x19c54b)[_0xf5b8('0x20')](_0x16dbab);}return null;};}function patchUpdates(_0x188f3c){return function(_0x28fadc){try{jsonpatch['apply'](_0x28fadc,_0x188f3c,!![]);}catch(_0x4777be){return BPromise['reject'](_0x4777be);}return _0x28fadc[_0xf5b8('0x21')]();};}function saveUpdates(_0x28f158,_0x49b024){return function(_0x1ce57d){if(_0x1ce57d){return _0x1ce57d[_0xf5b8('0x22')](_0x28f158)[_0xf5b8('0x23')](function(_0x2b1e7d){return _0x2b1e7d;});}return null;};}function removeEntity(_0x427eb9,_0x5c9165){return function(_0x1870b0){if(_0x1870b0){return _0x1870b0[_0xf5b8('0x24')]()[_0xf5b8('0x23')](function(){_0x427eb9[_0xf5b8('0x1a')](0xcc)[_0xf5b8('0x1b')]();});}};}function handleEntityNotFound(_0x4af22a,_0x351a20){return function(_0x3518cf){if(!_0x3518cf){_0x4af22a[_0xf5b8('0x19')](0x194);}return _0x3518cf;};}function handleError(_0x49bfdd,_0x32f3e6){_0x32f3e6=_0x32f3e6||0x1f4;return function(_0x4aaef0){logger[_0xf5b8('0x25')](_0x4aaef0[_0xf5b8('0x26')]);if(_0x4aaef0['name']){delete _0x4aaef0['name'];}_0x49bfdd['status'](_0x32f3e6)[_0xf5b8('0x27')](_0x4aaef0);};}exports['index']=function(_0x5466d7,_0x1fe3af){var _0x2c24c6={},_0xc20dd1={},_0x4a4179={'count':0x0,'rows':[]};var _0x317176=_[_0xf5b8('0x28')](db[_0xf5b8('0x29')]['rawAttributes'],function(_0x2a6edd){return{'name':_0x2a6edd['fieldName'],'type':_0x2a6edd['type'][_0xf5b8('0x2a')]};});_0xc20dd1[_0xf5b8('0x2b')]=_[_0xf5b8('0x28')](_0x317176,_0xf5b8('0x2c'));_0xc20dd1[_0xf5b8('0x2d')]=_[_0xf5b8('0x2e')](_0x5466d7[_0xf5b8('0x2d')]);_0xc20dd1[_0xf5b8('0x2f')]=_['intersection'](_0xc20dd1['model'],_0xc20dd1[_0xf5b8('0x2d')]);_0x2c24c6[_0xf5b8('0x30')]=_['intersection'](_0xc20dd1[_0xf5b8('0x2b')],qs[_0xf5b8('0x31')](_0x5466d7[_0xf5b8('0x2d')][_0xf5b8('0x31')]));_0x2c24c6['attributes']=_0x2c24c6[_0xf5b8('0x30')][_0xf5b8('0x32')]?_0x2c24c6[_0xf5b8('0x30')]:_0xc20dd1[_0xf5b8('0x2b')];if(!_0x5466d7['query']['hasOwnProperty'](_0xf5b8('0x33'))){_0x2c24c6[_0xf5b8('0x1e')]=qs['limit'](_0x5466d7[_0xf5b8('0x2d')][_0xf5b8('0x1e')]);_0x2c24c6[_0xf5b8('0x1c')]=qs[_0xf5b8('0x1c')](_0x5466d7['query'][_0xf5b8('0x1c')]);}_0x2c24c6[_0xf5b8('0x34')]=qs['sort'](_0x5466d7[_0xf5b8('0x2d')][_0xf5b8('0x35')]);_0x2c24c6[_0xf5b8('0x36')]=qs[_0xf5b8('0x2f')](_[_0xf5b8('0x37')](_0x5466d7[_0xf5b8('0x2d')],_0xc20dd1['filters']),_0x317176);if(_0x5466d7['query'][_0xf5b8('0x38')]){_0x2c24c6[_0xf5b8('0x36')]=_['merge'](_0x2c24c6[_0xf5b8('0x36')],{'$or':_['map'](_0x317176,function(_0x38e30b){if(_0x38e30b[_0xf5b8('0x39')]!==_0xf5b8('0x3a')){var _0x296bf5={};_0x296bf5[_0x38e30b[_0xf5b8('0x2c')]]={'$like':'%'+_0x5466d7[_0xf5b8('0x2d')]['filter']+'%'};return _0x296bf5;}})});}_0x2c24c6=_['merge']({},_0x2c24c6,_0x5466d7[_0xf5b8('0x3b')]);var _0xc69810={'where':_0x2c24c6[_0xf5b8('0x36')]};return db[_0xf5b8('0x29')][_0xf5b8('0x1f')](_0xc69810)[_0xf5b8('0x23')](function(_0x59a989){_0x4a4179[_0xf5b8('0x1f')]=_0x59a989;if(_0x5466d7[_0xf5b8('0x2d')][_0xf5b8('0x3c')]){_0x2c24c6[_0xf5b8('0x3d')]=[{'all':!![]}];}return db[_0xf5b8('0x29')][_0xf5b8('0x3e')](_0x2c24c6);})[_0xf5b8('0x23')](function(_0x145f3f){_0x4a4179[_0xf5b8('0x3f')]=_0x145f3f;return _0x4a4179;})[_0xf5b8('0x23')](respondWithFilteredResult(_0x1fe3af,_0x2c24c6))[_0xf5b8('0x40')](handleError(_0x1fe3af,null));};exports['show']=function(_0x14a5d9,_0x1218a1){var _0x495aac={'raw':!![],'where':{'id':_0x14a5d9['params']['id']}},_0x228f0f={};_0x228f0f[_0xf5b8('0x2b')]=_[_0xf5b8('0x2e')](db[_0xf5b8('0x29')][_0xf5b8('0x41')]);_0x228f0f['query']=_[_0xf5b8('0x2e')](_0x14a5d9[_0xf5b8('0x2d')]);_0x228f0f['filters']=_[_0xf5b8('0x42')](_0x228f0f['model'],_0x228f0f[_0xf5b8('0x2d')]);_0x495aac[_0xf5b8('0x30')]=_['intersection'](_0x228f0f['model'],qs[_0xf5b8('0x31')](_0x14a5d9[_0xf5b8('0x2d')][_0xf5b8('0x31')]));_0x495aac['attributes']=_0x495aac[_0xf5b8('0x30')][_0xf5b8('0x32')]?_0x495aac[_0xf5b8('0x30')]:_0x228f0f[_0xf5b8('0x2b')];if(_0x14a5d9[_0xf5b8('0x2d')][_0xf5b8('0x3c')]){_0x495aac[_0xf5b8('0x3d')]=[{'all':!![]}];}_0x495aac=_[_0xf5b8('0x43')]({},_0x495aac,_0x14a5d9[_0xf5b8('0x3b')]);return db[_0xf5b8('0x29')]['find'](_0x495aac)[_0xf5b8('0x23')](handleEntityNotFound(_0x1218a1,null))['then'](respondWithResult(_0x1218a1,null))[_0xf5b8('0x40')](handleError(_0x1218a1,null));};exports['create']=function(_0x2d7d42,_0x47255e){return db['VoiceQueuesLog']['create'](_0x2d7d42[_0xf5b8('0x44')],{})[_0xf5b8('0x23')](respondWithResult(_0x47255e,0xc9))['catch'](handleError(_0x47255e,null));};exports[_0xf5b8('0x22')]=function(_0x292759,_0x1ecc53){if(_0x292759[_0xf5b8('0x44')]['id']){delete _0x292759['body']['id'];}return db[_0xf5b8('0x29')][_0xf5b8('0x45')]({'where':{'id':_0x292759['params']['id']}})[_0xf5b8('0x23')](handleEntityNotFound(_0x1ecc53,null))[_0xf5b8('0x23')](saveUpdates(_0x292759[_0xf5b8('0x44')],null))[_0xf5b8('0x23')](respondWithResult(_0x1ecc53,null))[_0xf5b8('0x40')](handleError(_0x1ecc53,null));};exports['destroy']=function(_0x15616c,_0x7d9556){return db[_0xf5b8('0x29')][_0xf5b8('0x45')]({'where':{'id':_0x15616c['params']['id']}})[_0xf5b8('0x23')](handleEntityNotFound(_0x7d9556,null))[_0xf5b8('0x23')](removeEntity(_0x7d9556,null))[_0xf5b8('0x40')](handleError(_0x7d9556,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 36375ca..bd0ec37 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 _0x3b8c=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3b8c,0x1b3));var _0xc3b8=function(_0xa748a7,_0x3aedbd){_0xa748a7=_0xa748a7-0x0;var _0x17c291=_0x3b8c[_0xa748a7];return _0x17c291;};'use strict';var _=require(_0xc3b8('0x0'));var util=require(_0xc3b8('0x1'));var logger=require(_0xc3b8('0x2'))(_0xc3b8('0x3'));var moment=require(_0xc3b8('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3b8('0x5'));var fs=require('fs');var path=require(_0xc3b8('0x6'));var rimraf=require('rimraf');var config=require(_0xc3b8('0x7'));var attributes=require(_0xc3b8('0x8'));module[_0xc3b8('0x9')]=function(_0x5ece8f,_0x5848a9){return _0x5ece8f[_0xc3b8('0xa')](_0xc3b8('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc3b8('0xc'),'fields':[_0xc3b8('0xd'),_0xc3b8('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5959=['VoiceQueuesLog','voice_queues_log','event_dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x4bea58,_0x533542){var _0x5d0fa8=function(_0x511bda){while(--_0x511bda){_0x4bea58['push'](_0x4bea58['shift']());}};_0x5d0fa8(++_0x533542);}(_0x5959,0x17c));var _0x9595=function(_0x323708,_0x4bebf2){_0x323708=_0x323708-0x0;var _0x3da3d7=_0x5959[_0x323708];return _0x3da3d7;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[{'name':_0x9595('0xc'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index eb1d415..1ee2ce9 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 _0xbaaa=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xbaaa,0x9c));var _0xabaa=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xbaaa[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xabaa('0x0'));var util=require(_0xabaa('0x1'));var moment=require('moment');var BPromise=require(_0xabaa('0x2'));var rs=require(_0xabaa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabaa('0x4'))['db'];var utils=require(_0xabaa('0x5'));var logger=require(_0xabaa('0x6'))(_0xabaa('0x7'));var config=require('../../config/environment');var jayson=require(_0xabaa('0x8'));var client=jayson[_0xabaa('0x9')][_0xabaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c9263,_0x1f418b,_0x668d6f){return new BPromise(function(_0x11ce12,_0xe70de){return client[_0xabaa('0xb')](_0x1c9263,_0x668d6f)['then'](function(_0x58a047){logger[_0xabaa('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f418b,_0xabaa('0xd'));logger[_0xabaa('0xe')](_0xabaa('0xf'),_0x1f418b,'request\x20sent',JSON[_0xabaa('0x10')](_0x58a047));if(_0x58a047[_0xabaa('0x11')]){if(_0x58a047[_0xabaa('0x11')][_0xabaa('0x12')]===0x1f4){logger[_0xabaa('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f418b,_0x58a047[_0xabaa('0x11')][_0xabaa('0x13')]);return _0xe70de(_0x58a047[_0xabaa('0x11')]['message']);}logger[_0xabaa('0x11')](_0xabaa('0x14'),_0x1f418b,_0x58a047[_0xabaa('0x11')][_0xabaa('0x13')]);return _0x11ce12(_0x58a047[_0xabaa('0x11')]['message']);}else{logger[_0xabaa('0xc')](_0xabaa('0x14'),_0x1f418b,_0xabaa('0xd'));_0x11ce12(_0x58a047[_0xabaa('0x15')][_0xabaa('0x13')]);}})[_0xabaa('0x16')](function(_0x2d488){logger['error'](_0xabaa('0x14'),_0x1f418b,_0x2d488);_0xe70de(_0x2d488);});});} \ No newline at end of file +var _0x0df9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xb2dcc7,_0x305b12){var _0x377373=function(_0x4f05e9){while(--_0x4f05e9){_0xb2dcc7['push'](_0xb2dcc7['shift']());}};_0x377373(++_0x305b12);}(_0x0df9,0x170));var _0x90df=function(_0x45f910,_0x1befd8){_0x45f910=_0x45f910-0x0;var _0x1c56fe=_0x0df9[_0x45f910];return _0x1c56fe;};'use strict';var _=require(_0x90df('0x0'));var util=require('util');var moment=require(_0x90df('0x1'));var BPromise=require(_0x90df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90df('0x3'));var db=require(_0x90df('0x4'))['db'];var utils=require(_0x90df('0x5'));var logger=require(_0x90df('0x6'))(_0x90df('0x7'));var config=require(_0x90df('0x8'));var jayson=require(_0x90df('0x9'));var client=jayson[_0x90df('0xa')][_0x90df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fc700,_0x5d2e61,_0x5ccd23){return new BPromise(function(_0x36c766,_0x102fca){return client['request'](_0x2fc700,_0x5ccd23)[_0x90df('0xc')](function(_0x28474b){logger[_0x90df('0xd')](_0x90df('0xe'),_0x5d2e61,_0x90df('0xf'));logger[_0x90df('0x10')](_0x90df('0x11'),_0x5d2e61,'request\x20sent',JSON['stringify'](_0x28474b));if(_0x28474b[_0x90df('0x12')]){if(_0x28474b[_0x90df('0x12')][_0x90df('0x13')]===0x1f4){logger[_0x90df('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5d2e61,_0x28474b[_0x90df('0x12')][_0x90df('0x14')]);return _0x102fca(_0x28474b[_0x90df('0x12')][_0x90df('0x14')]);}logger[_0x90df('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5d2e61,_0x28474b[_0x90df('0x12')][_0x90df('0x14')]);return _0x36c766(_0x28474b['error']['message']);}else{logger[_0x90df('0xd')](_0x90df('0xe'),_0x5d2e61,_0x90df('0xf'));_0x36c766(_0x28474b[_0x90df('0x15')][_0x90df('0x14')]);}})['catch'](function(_0xdc42f6){logger[_0x90df('0x12')](_0x90df('0xe'),_0x5d2e61,_0xdc42f6);_0x102fca(_0xdc42f6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 92db7ec..30b1aab 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 _0x3ada=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','get','describe','/:id','show','/:id/download','download','/:id/downloads','downloads'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0x3ada,0x1da));var _0xa3ad=function(_0x458897,_0x4aac86){_0x458897=_0x458897-0x0;var _0xbc7b62=_0x3ada[_0x458897];return _0xbc7b62;};'use strict';var multer=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var path=require(_0xa3ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3ad('0x3'));var router=express[_0xa3ad('0x4')]();var fs_extra=require(_0xa3ad('0x5'));var auth=require(_0xa3ad('0x6'));var interaction=require(_0xa3ad('0x7'));var config=require(_0xa3ad('0x8'));var controller=require(_0xa3ad('0x9'));router['get']('/',auth[_0xa3ad('0xa')](),controller['index']);router[_0xa3ad('0xb')]('/describe',auth[_0xa3ad('0xa')](),controller[_0xa3ad('0xc')]);router['get'](_0xa3ad('0xd'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0xe')]);router[_0xa3ad('0xb')](_0xa3ad('0xf'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x10')]);router[_0xa3ad('0xb')](_0xa3ad('0x11'),controller[_0xa3ad('0x12')]);router[_0xa3ad('0xb')](_0xa3ad('0x13'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x14')]);router[_0xa3ad('0x15')]('/',auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x16')]);router[_0xa3ad('0x15')](_0xa3ad('0x13'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x17')]);router[_0xa3ad('0x18')](_0xa3ad('0xd'),auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x19')]);router[_0xa3ad('0x1a')]('/:id',auth[_0xa3ad('0xa')](),controller[_0xa3ad('0x1b')]);module[_0xa3ad('0x1c')]=router; \ No newline at end of file +var _0x347a=['express','Router','../../components/interaction/service','./voiceRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x147978,_0x4c4f5f){var _0x2bf9c0=function(_0x331aea){while(--_0x331aea){_0x147978['push'](_0x147978['shift']());}};_0x2bf9c0(++_0x4c4f5f);}(_0x347a,0x176));var _0xa347=function(_0x30fe8c,_0x272cb9){_0x30fe8c=_0x30fe8c-0x0;var _0x4f1068=_0x347a[_0x30fe8c];return _0x4f1068;};'use strict';var multer=require(_0xa347('0x0'));var util=require(_0xa347('0x1'));var path=require(_0xa347('0x2'));var timeout=require(_0xa347('0x3'));var express=require(_0xa347('0x4'));var router=express[_0xa347('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa347('0x6'));var config=require('../../config/environment');var controller=require(_0xa347('0x7'));router[_0xa347('0x8')]('/',auth['isAuthenticated'](),controller[_0xa347('0x9')]);router[_0xa347('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa347('0x8')](_0xa347('0xa'),auth[_0xa347('0xb')](),controller[_0xa347('0xc')]);router[_0xa347('0x8')](_0xa347('0xd'),auth['isAuthenticated'](),controller[_0xa347('0xe')]);router[_0xa347('0x8')](_0xa347('0xf'),controller[_0xa347('0x10')]);router[_0xa347('0x8')](_0xa347('0x11'),auth[_0xa347('0xb')](),controller[_0xa347('0x12')]);router['post']('/',auth[_0xa347('0xb')](),controller[_0xa347('0x13')]);router[_0xa347('0x14')](_0xa347('0x11'),auth[_0xa347('0xb')](),controller[_0xa347('0x15')]);router[_0xa347('0x16')](_0xa347('0xa'),auth[_0xa347('0xb')](),controller[_0xa347('0x17')]);router[_0xa347('0x18')](_0xa347('0xa'),auth[_0xa347('0xb')](),controller[_0xa347('0x19')]);module[_0xa347('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 362c813..3e66ed1 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 6adc85c..fbcd40c 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 _0x3c2b=['update','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','$and','push','secrets','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','index','rawAttributes','key','model','differenceBy','map','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','include','VoiceRecording','findAll','rows','show','options','find','catch','create','body'];(function(_0x3f5330,_0x179db7){var _0x5ce9c2=function(_0x186aef){while(--_0x186aef){_0x3f5330['push'](_0x3f5330['shift']());}};_0x5ce9c2(++_0x179db7);}(_0x3c2b,0x179));var _0xb3c2=function(_0x1b10f2,_0xee4415){_0x1b10f2=_0x1b10f2-0x0;var _0x256092=_0x3c2b[_0x1b10f2];return _0x256092;};'use strict';var emlformat=require(_0xb3c2('0x0'));var rimraf=require(_0xb3c2('0x1'));var zipdir=require(_0xb3c2('0x2'));var jsonpatch=require(_0xb3c2('0x3'));var rp=require(_0xb3c2('0x4'));var moment=require(_0xb3c2('0x5'));var BPromise=require(_0xb3c2('0x6'));var Mustache=require(_0xb3c2('0x7'));var util=require(_0xb3c2('0x8'));var path=require(_0xb3c2('0x9'));var sox=require('sox');var csv=require(_0xb3c2('0xa'));var ejs=require(_0xb3c2('0xb'));var fs=require('fs');var fs_extra=require(_0xb3c2('0xc'));var _=require(_0xb3c2('0xd'));var squel=require('squel');var crypto=require(_0xb3c2('0xe'));var jsforce=require(_0xb3c2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb3c2('0xa'));var querystring=require(_0xb3c2('0x10'));var Papa=require(_0xb3c2('0x11'));var AWS=require(_0xb3c2('0x12'));var uuidv4=require(_0xb3c2('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb3c2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3c2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb3c2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c2('0x17'))['db'];function respondWithStatusCode(_0x477c01,_0x323f66){_0x323f66=_0x323f66||0xcc;return function(_0x16f70a){if(_0x16f70a){return _0x477c01[_0xb3c2('0x18')](_0x323f66);}return _0x477c01[_0xb3c2('0x19')](_0x323f66)['end']();};}function respondWithResult(_0x43400a,_0x17abc7){_0x17abc7=_0x17abc7||0xc8;return function(_0x18f637){if(_0x18f637){return _0x43400a['status'](_0x17abc7)[_0xb3c2('0x1a')](_0x18f637);}};}function respondWithFilteredResult(_0x4724c9,_0x568f7e){return function(_0x222a7a){if(_0x222a7a){var _0x27d350=typeof _0x568f7e[_0xb3c2('0x1b')]===_0xb3c2('0x1c')&&typeof _0x568f7e[_0xb3c2('0x1d')]===_0xb3c2('0x1c');var _0x1fc2e6=_0x222a7a['count'];var _0x5791fd=_0x27d350?0x0:_0x568f7e[_0xb3c2('0x1b')];var _0x38257a=_0x27d350?_0x222a7a[_0xb3c2('0x1e')]:_0x568f7e[_0xb3c2('0x1b')]+_0x568f7e[_0xb3c2('0x1d')];var _0x5acf45;if(_0x38257a>=_0x1fc2e6){_0x38257a=_0x1fc2e6;_0x5acf45=0xc8;}else{_0x5acf45=0xce;}_0x4724c9[_0xb3c2('0x19')](_0x5acf45);return _0x4724c9['set'](_0xb3c2('0x1f'),_0x5791fd+'-'+_0x38257a+'/'+_0x1fc2e6)['json'](_0x222a7a);}return null;};}function patchUpdates(_0x37ef23){return function(_0x14afd5){try{jsonpatch[_0xb3c2('0x20')](_0x14afd5,_0x37ef23,!![]);}catch(_0x1561b4){return BPromise[_0xb3c2('0x21')](_0x1561b4);}return _0x14afd5[_0xb3c2('0x22')]();};}function saveUpdates(_0x56373b,_0x5f74a3){return function(_0xec9953){if(_0xec9953){return _0xec9953['update'](_0x56373b)[_0xb3c2('0x23')](function(_0x442379){return _0x442379;});}return null;};}function removeEntity(_0x3b17cd,_0x438bf5){return function(_0xb796b6){if(_0xb796b6){return _0xb796b6[_0xb3c2('0x24')]()['then'](function(){_0x3b17cd['status'](0xcc)[_0xb3c2('0x25')]();});}};}function handleEntityNotFound(_0x27b33c,_0x2716f7){return function(_0x36eb13){if(!_0x36eb13){_0x27b33c[_0xb3c2('0x18')](0x194);}return _0x36eb13;};}function handleError(_0x375801,_0x4d64a4){_0x4d64a4=_0x4d64a4||0x1f4;return function(_0x523c0a){logger[_0xb3c2('0x26')](_0x523c0a['stack']);if(_0x523c0a['name']){delete _0x523c0a[_0xb3c2('0x27')];}_0x375801[_0xb3c2('0x19')](_0x4d64a4)['send'](_0x523c0a);};}exports[_0xb3c2('0x28')]=function(_0x5ced9a,_0x39eef8){var _0x1950ae={},_0x2fdd14={},_0x550013={'count':0x0,'rows':[]};var _0x4b7034=_['map'](db['VoiceRecording'][_0xb3c2('0x29')],function(_0x43a728){return{'name':_0x43a728['fieldName'],'type':_0x43a728['type'][_0xb3c2('0x2a')]};});_0x2fdd14[_0xb3c2('0x2b')]=_[_0xb3c2('0x2c')](_[_0xb3c2('0x2d')](_0x4b7034,_0xb3c2('0x27')),[_0xb3c2('0x2e')]);_0x2fdd14['query']=_[_0xb3c2('0x2f')](_0x5ced9a[_0xb3c2('0x30')]);_0x2fdd14['filters']=_[_0xb3c2('0x31')](_0x2fdd14[_0xb3c2('0x2b')],_0x2fdd14[_0xb3c2('0x30')]);_0x1950ae[_0xb3c2('0x32')]=_[_0xb3c2('0x31')](_0x2fdd14[_0xb3c2('0x2b')],qs[_0xb3c2('0x33')](_0x5ced9a[_0xb3c2('0x30')][_0xb3c2('0x33')]));_0x1950ae[_0xb3c2('0x32')]=_0x1950ae[_0xb3c2('0x32')][_0xb3c2('0x34')]?_0x1950ae[_0xb3c2('0x32')]:_0x2fdd14[_0xb3c2('0x2b')];if(!_0x5ced9a[_0xb3c2('0x30')][_0xb3c2('0x35')](_0xb3c2('0x36'))){_0x1950ae[_0xb3c2('0x1d')]=qs[_0xb3c2('0x1d')](_0x5ced9a[_0xb3c2('0x30')][_0xb3c2('0x1d')]);_0x1950ae[_0xb3c2('0x1b')]=qs[_0xb3c2('0x1b')](_0x5ced9a['query'][_0xb3c2('0x1b')]);}_0x1950ae[_0xb3c2('0x37')]=qs[_0xb3c2('0x38')](_0x5ced9a['query'][_0xb3c2('0x38')]);_0x1950ae[_0xb3c2('0x39')]=qs['filters'](_[_0xb3c2('0x3a')](_0x5ced9a['query'],_0x2fdd14[_0xb3c2('0x3b')]),_0x4b7034);if(_0x5ced9a[_0xb3c2('0x30')]['filter']){_0x1950ae[_0xb3c2('0x39')]=_[_0xb3c2('0x3c')](_0x1950ae['where'],{'$or':_[_0xb3c2('0x2d')](_0x4b7034,function(_0x943e62){if(_0x943e62[_0xb3c2('0x3d')]!==_0xb3c2('0x3e')){var _0x5f15b7={};_0x5f15b7[_0x943e62[_0xb3c2('0x27')]]={'$like':'%'+_0x5ced9a[_0xb3c2('0x30')]['filter']+'%'};return _0x5f15b7;}})});}_0x1950ae=_[_0xb3c2('0x3c')]({},_0x1950ae,_0x5ced9a['options']);var _0x94bf83={'where':_0x1950ae[_0xb3c2('0x39')]};return db['VoiceRecording'][_0xb3c2('0x1e')](_0x94bf83)[_0xb3c2('0x23')](function(_0x119bfb){_0x550013[_0xb3c2('0x1e')]=_0x119bfb;if(_0x5ced9a[_0xb3c2('0x30')]['includeAll']){_0x1950ae[_0xb3c2('0x3f')]=[{'all':!![]}];}return db[_0xb3c2('0x40')][_0xb3c2('0x41')](_0x1950ae);})['then'](function(_0x59c164){_0x550013[_0xb3c2('0x42')]=_0x59c164;return _0x550013;})[_0xb3c2('0x23')](respondWithFilteredResult(_0x39eef8,_0x1950ae))['catch'](handleError(_0x39eef8,null));};exports[_0xb3c2('0x43')]=function(_0x1a6b53,_0x4eba8b){var _0xd0f005={'raw':![],'where':{'id':_0x1a6b53['params']['id']}},_0x1c51c0={};_0x1c51c0['model']=_[_0xb3c2('0x2f')](db[_0xb3c2('0x40')][_0xb3c2('0x29')]);_0x1c51c0[_0xb3c2('0x30')]=_[_0xb3c2('0x2f')](_0x1a6b53['query']);_0x1c51c0['filters']=_[_0xb3c2('0x31')](_0x1c51c0[_0xb3c2('0x2b')],_0x1c51c0[_0xb3c2('0x30')]);_0xd0f005[_0xb3c2('0x32')]=_['intersection'](_0x1c51c0['model'],qs[_0xb3c2('0x33')](_0x1a6b53[_0xb3c2('0x30')][_0xb3c2('0x33')]));_0xd0f005['attributes']=_0xd0f005[_0xb3c2('0x32')]['length']?_0xd0f005[_0xb3c2('0x32')]:_0x1c51c0[_0xb3c2('0x2b')];if(_0x1a6b53[_0xb3c2('0x30')]['includeAll']){_0xd0f005[_0xb3c2('0x3f')]=[{'all':!![]}];}_0xd0f005=_['merge']({},_0xd0f005,_0x1a6b53[_0xb3c2('0x44')]);return db[_0xb3c2('0x40')][_0xb3c2('0x45')](_0xd0f005)[_0xb3c2('0x23')](handleEntityNotFound(_0x4eba8b,null))[_0xb3c2('0x23')](respondWithResult(_0x4eba8b,null))[_0xb3c2('0x46')](handleError(_0x4eba8b,null));};exports[_0xb3c2('0x47')]=function(_0x1fa368,_0x937d6b){return db[_0xb3c2('0x40')]['create'](_0x1fa368[_0xb3c2('0x48')],{})[_0xb3c2('0x23')](respondWithResult(_0x937d6b,0xc9))[_0xb3c2('0x46')](handleError(_0x937d6b,null));};exports[_0xb3c2('0x49')]=function(_0x1dd8e4,_0x297e82){if(_0x1dd8e4[_0xb3c2('0x48')]['id']){delete _0x1dd8e4['body']['id'];}return db[_0xb3c2('0x40')][_0xb3c2('0x45')]({'where':{'id':_0x1dd8e4[_0xb3c2('0x4a')]['id']}})[_0xb3c2('0x23')](handleEntityNotFound(_0x297e82,null))[_0xb3c2('0x23')](saveUpdates(_0x1dd8e4[_0xb3c2('0x48')],null))[_0xb3c2('0x23')](respondWithResult(_0x297e82,null))['catch'](handleError(_0x297e82,null));};exports[_0xb3c2('0x4b')]=function(_0x3c9fa8,_0x176795){return db['VoiceRecording'][_0xb3c2('0x4b')]()['then'](respondWithResult(_0x176795,null))[_0xb3c2('0x46')](handleError(_0x176795,null));};exports[_0xb3c2('0x4c')]=function(_0x20cd5e,_0x5bed60,_0x3e18dc){var _0x4834d3=require(_0xb3c2('0x4d'));var _0x112090=![];var _0x340807={};if(_0x20cd5e[_0xb3c2('0x30')][_0xb3c2('0x3d')]&&_0x20cd5e[_0xb3c2('0x30')][_0xb3c2('0x3d')]===_0xb3c2('0x4e')){_0x340807[_0xb3c2('0x4e')]=_0x20cd5e[_0xb3c2('0x4a')]['id'];}else{_0x340807['id']=_0x20cd5e['params']['id'];}return db[_0xb3c2('0x40')][_0xb3c2('0x45')]({'where':_0x340807,'attributes':['id',_0xb3c2('0x4f')],'raw':!![]})[_0xb3c2('0x23')](handleEntityNotFound(_0x5bed60,null))[_0xb3c2('0x23')](function(_0x2a5c6e){if(_0x2a5c6e){var _0x2e8cb6=_0x2a5c6e[_0xb3c2('0x4f')];var _0x55b9c3=util[_0xb3c2('0x2e')](_0xb3c2('0x50'),_0x2e8cb6);if(fs['existsSync'](_0x55b9c3)){_0x112090=!![];return _0x4834d3[_0xb3c2('0x51')](_0x55b9c3,_0x2e8cb6,config['secrets'][_0xb3c2('0x52')])[_0xb3c2('0x23')](function(){return _0x2a5c6e;});}return _0x2a5c6e;}})[_0xb3c2('0x23')](function(_0x339711){if(_0x339711){var _0x4f343a=_0x339711[_0xb3c2('0x4f')];if(!fs[_0xb3c2('0x53')](_0x4f343a)){throw new db[(_0xb3c2('0x54'))][(_0xb3c2('0x55'))](_0xb3c2('0x56'));}if(_0x339711[_0xb3c2('0x57')]){return _0x5bed60[_0xb3c2('0x4c')](_0x4f343a,_0x339711[_0xb3c2('0x57')]+path[_0xb3c2('0x58')](_0x4f343a),function(){if(_0x112090){fs['unlink'](_0x4f343a);}});}else{return _0x5bed60[_0xb3c2('0x4c')](_0x4f343a,function(_0x1ebbb6){if(_0x112090){fs[_0xb3c2('0x59')](_0x4f343a);}});}}})['catch'](function(_0x5690b3){if(_0x5690b3[_0xb3c2('0x5a')]===_0xb3c2('0x56')){_0x5bed60[_0xb3c2('0x19')](0x194)[_0xb3c2('0x5b')](_0xb3c2('0x5c'));}else{return handleError(_0x5bed60,null);}});};exports[_0xb3c2('0x5d')]=function(_0x20c779,_0x51ac2d,_0x122f2e){var _0x4827e6=require(_0xb3c2('0x4d'));var _0x26db0b=![];var _0x74156e={'$and':[db['sequelize'][_0xb3c2('0x39')](db[_0xb3c2('0x5e')]['fn'](_0xb3c2('0x5f'),db['sequelize'][_0xb3c2('0x60')](_0xb3c2('0x4e'))),_0x20c779[_0xb3c2('0x30')]['token'])]};if(_0x20c779[_0xb3c2('0x30')][_0xb3c2('0x3d')]&&_0x20c779[_0xb3c2('0x30')][_0xb3c2('0x3d')]===_0xb3c2('0x4e')){_0x74156e[_0xb3c2('0x61')]['push']({'uniqueid':_0x20c779['params']['id']});}else{_0x74156e[_0xb3c2('0x61')][_0xb3c2('0x62')]({'id':_0x20c779[_0xb3c2('0x4a')]['id']});}return db['VoiceRecording']['find']({'where':_0x74156e,'attributes':['id',_0xb3c2('0x4f')],'raw':!![]})[_0xb3c2('0x23')](handleEntityNotFound(_0x51ac2d,null))['then'](function(_0x4b781c){if(_0x4b781c){var _0x2fcaba=util[_0xb3c2('0x2e')]('%s.cypher',_0x4b781c[_0xb3c2('0x4f')]);if(fs['existsSync'](_0x2fcaba)){_0x26db0b=!![];return _0x4827e6[_0xb3c2('0x51')](_0x2fcaba,_0x4b781c[_0xb3c2('0x4f')],config[_0xb3c2('0x63')][_0xb3c2('0x52')])['then'](function(){return _0x4b781c;});}return _0x4b781c;}})[_0xb3c2('0x23')](function(_0x55e0e5){if(_0x55e0e5){if(!fs[_0xb3c2('0x53')](_0x55e0e5[_0xb3c2('0x4f')])){throw new db[(_0xb3c2('0x54'))]['ValidationError'](_0xb3c2('0x56'));}if(_0x55e0e5['filename']){return _0x51ac2d[_0xb3c2('0x4c')](_0x55e0e5[_0xb3c2('0x4f')],_0x55e0e5['filename']+path[_0xb3c2('0x58')](_0x55e0e5[_0xb3c2('0x4f')]),function(){if(_0x26db0b){fs['unlink'](_0x55e0e5[_0xb3c2('0x4f')]);}});}else{return _0x51ac2d[_0xb3c2('0x4c')](_0x55e0e5['value'],function(_0x536132){if(_0x26db0b){fs[_0xb3c2('0x59')](_0x55e0e5[_0xb3c2('0x4f')]);}});}}})['catch'](handleError(_0x51ac2d,null));};exports['destroy']=function(_0x3ae2b2,_0x5707ca){return db[_0xb3c2('0x40')][_0xb3c2('0x45')]({'where':{'id':_0x3ae2b2[_0xb3c2('0x4a')]['id']}})[_0xb3c2('0x23')](function(_0x48d5ad){if(_[_0xb3c2('0x64')](_0x48d5ad)){throw new ReferenceError('Entity\x20not\x20found');}return _0x48d5ad;})[_0xb3c2('0x23')](function(_0x3b6987){var _0x581fb7=_0x3b6987[_0xb3c2('0x4f')];logger['info'](_0xb3c2('0x65'),_0x581fb7);if(!_['isNil'](_0x3b6987['value'])&&fs[_0xb3c2('0x53')](_0x581fb7)){logger[_0xb3c2('0x66')](_0xb3c2('0x67')+_0x581fb7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb3c2('0x68')](_0x581fb7);}_0x581fb7=_0x581fb7+_0xb3c2('0x69');if(!_[_0xb3c2('0x64')](_0x3b6987[_0xb3c2('0x4f')])&&fs[_0xb3c2('0x53')](_0x581fb7)){logger[_0xb3c2('0x66')](_0xb3c2('0x67')+_0x581fb7+_0xb3c2('0x6a'));fs[_0xb3c2('0x68')](_0x581fb7);}return _0x3b6987;})[_0xb3c2('0x23')](function(_0x2e228c){if(!_0x2e228c)throw new InternalError();return _0x2e228c[_0xb3c2('0x24')]();})[_0xb3c2('0x23')](function(){_0x5707ca[_0xb3c2('0x19')](0xcc)[_0xb3c2('0x25')]();})['catch'](handleError(_0x5707ca,null));};function getBucketslist(_0x3f658d,_0x1a6c9d,_0xe74d60){return new Promise(function(_0x3aed4b,_0x520ad7){var _0x455a25=new AWS['S3']({'accessKeyId':_0x1a6c9d,'secretAccessKey':_0x3f658d,'region':_0xe74d60});_0x455a25['listBuckets']({},function(_0x57378d,_0x2cb0ef){if(_0x57378d){return _0x520ad7(_0x57378d);}else{return _0x3aed4b(_0x2cb0ef);}});});}function createBucket(_0x1e9341,_0x3da464,_0x1d108a,_0xb5949b){return new Promise(function(_0x5b4561,_0x19310b){var _0x51bae7=new AWS['S3']({'accessKeyId':_0x3da464,'secretAccessKey':_0x1e9341,'region':_0x1d108a});_0x51bae7[_0xb3c2('0x6b')]({'Bucket':_0xb5949b},function(_0x5394eb,_0x2c562f){if(_0x5394eb){return _0x19310b(_0x5394eb);}else{return _0x5b4561(_0x2c562f);}});});}function uploadFile(_0x56129,_0x6cd694,_0x3e9c4c,_0x597a3c,_0x1187b8,_0x5a5526){return new Promise(function(_0x321dd0,_0xbc8eba){var _0x26f2d9=new AWS['S3']({'accessKeyId':_0x6cd694,'secretAccessKey':_0x56129,'region':_0x3e9c4c});_0x26f2d9[_0xb3c2('0x6c')]({'Bucket':_0x597a3c,'Key':_0x1187b8,'Body':_0x5a5526},function(_0x1b101b,_0x1f7f73){if(_0x1b101b){return _0xbc8eba(_0x1b101b);}else{return _0x321dd0(_0x1f7f73);}});});}function startTranscribe(_0x344765,_0x1f905c,_0x31d101,_0x57da76,_0x42641d,_0x10d440){return new Promise(function(_0x517562,_0x5ed7ca){var _0x5f1072=new AWS[(_0xb3c2('0x6d'))]({'accessKeyId':_0x1f905c,'secretAccessKey':_0x344765,'region':_0x31d101});_0x5f1072[_0xb3c2('0x6e')]({'TranscriptionJobName':_0x57da76,'LanguageCode':_0x42641d,'Media':{'MediaFileUri':_0x10d440}},function(_0x3d69bd,_0x1c941d){if(_0x3d69bd){return _0x5ed7ca(_0x3d69bd);}else{return _0x517562(_0x1c941d);}});});}function transcribe(_0xfa4c06,_0x5d1128,_0xef458,_0x135f41,_0x1447d8,_0x47a0a7,_0x4a5107){return new Promise(function(_0x566387,_0x44c482){var _0xe6ac31={};logger['info'](util[_0xb3c2('0x2e')](_0xb3c2('0x6f'),_0xfa4c06,_0x1447d8));return uploadFile(_0x5d1128,_0xef458,_0x135f41,_0x1447d8,path['basename'](_0x47a0a7),fs[_0xb3c2('0x70')](_0x47a0a7))[_0xb3c2('0x23')](function(_0x329d79){logger[_0xb3c2('0x66')](util['format'](_0xb3c2('0x71'),_0xfa4c06,_0x1447d8,_0x329d79[_0xb3c2('0x72')]));_0xe6ac31[_0xb3c2('0x73')]=_0x329d79[_0xb3c2('0x74')];_0xe6ac31[_0xb3c2('0x75')]=_0x329d79['Location'];logger[_0xb3c2('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xfa4c06));return startTranscribe(_0x5d1128,_0xef458,_0x135f41,uuidv4(),_0x4a5107,_0x329d79[_0xb3c2('0x72')]);})[_0xb3c2('0x23')](function(_0x48893e){logger['info'](util[_0xb3c2('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xfa4c06,_0x48893e[_0xb3c2('0x76')][_0xb3c2('0x77')]));_0xe6ac31[_0xb3c2('0x78')]=_0x48893e[_0xb3c2('0x76')][_0xb3c2('0x77')];_0xe6ac31[_0xb3c2('0x79')]=_0x48893e['TranscriptionJob'][_0xb3c2('0x7a')];return _0x566387(_0xe6ac31);})[_0xb3c2('0x46')](function(_0xe4e29){return _0x44c482(_0xe4e29);});});}exports['runTranscribe']=function(_0x59e335,_0x56f43d,_0x1f1407){var _0x990a9b;var _0x394e7d;var _0xa957dc;var _0x16ebb5=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x59e335[_0xb3c2('0x4a')]['id']}})[_0xb3c2('0x23')](function(_0x54f455){if(_0x54f455){var _0x5f3ef2=util[_0xb3c2('0x2e')](_0xb3c2('0x50'),_0x54f455[_0xb3c2('0x4f')]);if(fs[_0xb3c2('0x53')](_0x5f3ef2)){cypher=!![];return _0x16ebb5[_0xb3c2('0x51')](_0x5f3ef2,_0x54f455[_0xb3c2('0x4f')],config[_0xb3c2('0x63')][_0xb3c2('0x52')])[_0xb3c2('0x23')](function(){return _0x54f455;});}return _0x54f455;}})[_0xb3c2('0x23')](function(_0x5d9ebd){if(!_0x5d9ebd){throw new db[(_0xb3c2('0x54'))][(_0xb3c2('0x55'))](_0xb3c2('0x7b'));}_0x394e7d=_0x5d9ebd;return db[_0xb3c2('0x7c')][_0xb3c2('0x7d')]({'where':{'id':0x1}});})[_0xb3c2('0x23')](handleEntityNotFound(_0x56f43d,null))[_0xb3c2('0x23')](function(_0x550e62){if(_0x550e62){_0x990a9b=_0x550e62;if(!_0x990a9b['transcribe']||!_0x990a9b[_0xb3c2('0x7e')]||!_0x990a9b['transcribeRegion']||!_0x990a9b[_0xb3c2('0x7f')]||!_0x990a9b[_0xb3c2('0x73')]){throw new db[(_0xb3c2('0x54'))]['ValidationError'](_0xb3c2('0x80'));}if(_0x59e335[_0xb3c2('0x48')][_0xb3c2('0x81')]&&(!_0x990a9b[_0xb3c2('0x82')]||!_0x990a9b[_0xb3c2('0x83')]||!_0x990a9b[_0xb3c2('0x84')]||!_0x990a9b['language']||!_0x990a9b[_0xb3c2('0x73')])){throw new db[(_0xb3c2('0x54'))][(_0xb3c2('0x55'))](_0xb3c2('0x85'));}return db[_0xb3c2('0x86')][_0xb3c2('0x7d')]({'where':{'id':_0x990a9b['transcribeAccountId']}});}})['then'](function(_0x67f133){if(!_0x67f133){throw new db[(_0xb3c2('0x54'))][(_0xb3c2('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x67f133[_0xb3c2('0x87')]||!_0x67f133[_0xb3c2('0x88')]){throw new db[(_0xb3c2('0x54'))][(_0xb3c2('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0xa957dc=_0x67f133;return getBucketslist(_0xa957dc['data1'],_0xa957dc[_0xb3c2('0x88')],_0x990a9b[_0xb3c2('0x89')]);})[_0xb3c2('0x23')](function(_0x20d203){if(_0x20d203&&_0x20d203['Buckets']){var _0xacd41c=_[_0xb3c2('0x45')](_0x20d203[_0xb3c2('0x8a')],function(_0x53f446){return _0x53f446[_0xb3c2('0x8b')]===_0x990a9b[_0xb3c2('0x73')];});if(!_0xacd41c){logger['info'](util['format'](_0xb3c2('0x8c'),_0x59e335[_0xb3c2('0x4a')]['id'],_0x990a9b[_0xb3c2('0x73')]));return createBucket(_0xa957dc['data1'],_0xa957dc['data2'],_0x990a9b[_0xb3c2('0x89')],_0x990a9b[_0xb3c2('0x73')]);}logger[_0xb3c2('0x66')](util[_0xb3c2('0x2e')](_0xb3c2('0x8d'),_0x59e335[_0xb3c2('0x4a')]['id'],_0x990a9b['bucket']));return;}})[_0xb3c2('0x23')](function(_0x5f1d62){if(_0x394e7d[_0xb3c2('0x79')]==='NEW'){return transcribe(_0x59e335[_0xb3c2('0x4a')]['id'],_0xa957dc['data1'],_0xa957dc[_0xb3c2('0x88')],_0x990a9b[_0xb3c2('0x89')],_0x990a9b['bucket'],_0x394e7d[_0xb3c2('0x4f')],_0x990a9b[_0xb3c2('0x7f')]);}else{logger[_0xb3c2('0x66')](util['format'](_0xb3c2('0x8e'),_0x59e335[_0xb3c2('0x4a')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x1f9605){if(_0x1f9605){_0x1f9605[_0xb3c2('0x8f')]=_0x59e335[_0xb3c2('0x48')][_0xb3c2('0x81')];return _0x394e7d[_0xb3c2('0x90')](_0x1f9605);}})['then'](respondWithResult(_0x56f43d,null))[_0xb3c2('0x46')](handleError(_0x56f43d,null));};function writeFile(_0x174d5a,_0x347069){return new Promise(function(_0x163b70,_0x5e99aa){fs['writeFile'](_0x347069,_0x174d5a,function(_0x22e21b,_0x3dfd2c){if(_0x22e21b){return _0x5e99aa(_0x22e21b);}else{return _0x163b70(_0x3dfd2c);}});});}exports[_0xb3c2('0x91')]=function(_0xb87c50,_0x3d9607,_0x32bc06){return db['VoiceRecording']['findOne']({'where':{'id':_0xb87c50[_0xb3c2('0x4a')]['id']}})[_0xb3c2('0x23')](handleEntityNotFound(_0x3d9607))[_0xb3c2('0x23')](function(_0x4f9bfa){if(_0x4f9bfa&&_0x4f9bfa[_0xb3c2('0x92')]){var _0xd21b79=_0x4f9bfa[_0xb3c2('0x92')];var _0x1d8dce=config[_0xb3c2('0x93')]+_0xb3c2('0x94')+_0x4f9bfa['id']+_0xb3c2('0x95');if(fs[_0xb3c2('0x53')](_0x1d8dce)){return _0x1d8dce;}return writeFile(_0xd21b79,_0x1d8dce)[_0xb3c2('0x23')](function(){return _0x1d8dce;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})[_0xb3c2('0x23')](function(_0x5f3bca){return _0x3d9607[_0xb3c2('0x4c')](_0x5f3bca);})[_0xb3c2('0x46')](handleError(_0x3d9607));}; \ No newline at end of file +var _0x4dab=['body','describe','download','uniqueid','params','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','extname','unlink','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','end','error','name','send','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x4dab,0xe8));var _0xb4da=function(_0x28ddc1,_0x512d09){_0x28ddc1=_0x28ddc1-0x0;var _0xadded7=_0x4dab[_0x28ddc1];return _0xadded7;};'use strict';var emlformat=require(_0xb4da('0x0'));var rimraf=require(_0xb4da('0x1'));var zipdir=require(_0xb4da('0x2'));var jsonpatch=require(_0xb4da('0x3'));var rp=require('request-promise');var moment=require(_0xb4da('0x4'));var BPromise=require(_0xb4da('0x5'));var Mustache=require(_0xb4da('0x6'));var util=require(_0xb4da('0x7'));var path=require(_0xb4da('0x8'));var sox=require(_0xb4da('0x9'));var csv=require(_0xb4da('0xa'));var ejs=require(_0xb4da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb4da('0xc'));var deskjs=require(_0xb4da('0xd'));var toCsv=require(_0xb4da('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xb4da('0xe'));var uuidv4=require(_0xb4da('0xf'));var Redis=require(_0xb4da('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4da('0x11'));var as=require(_0xb4da('0x12'));var hardwareService=require(_0xb4da('0x13'));var logger=require(_0xb4da('0x14'))('api');var utils=require(_0xb4da('0x15'));var config=require(_0xb4da('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bf3f2,_0x1e3b55){_0x1e3b55=_0x1e3b55||0xcc;return function(_0xfa9112){if(_0xfa9112){return _0x2bf3f2[_0xb4da('0x17')](_0x1e3b55);}return _0x2bf3f2[_0xb4da('0x18')](_0x1e3b55)['end']();};}function respondWithResult(_0x174b45,_0x113d67){_0x113d67=_0x113d67||0xc8;return function(_0x27fd46){if(_0x27fd46){return _0x174b45[_0xb4da('0x18')](_0x113d67)['json'](_0x27fd46);}};}function respondWithFilteredResult(_0x1e4876,_0x39dab4){return function(_0x5031c8){if(_0x5031c8){var _0x5912ea=typeof _0x39dab4[_0xb4da('0x19')]===_0xb4da('0x1a')&&typeof _0x39dab4['limit']==='undefined';var _0x49aa8f=_0x5031c8[_0xb4da('0x1b')];var _0x231de0=_0x5912ea?0x0:_0x39dab4[_0xb4da('0x19')];var _0x3f3bc9=_0x5912ea?_0x5031c8[_0xb4da('0x1b')]:_0x39dab4[_0xb4da('0x19')]+_0x39dab4[_0xb4da('0x1c')];var _0x1a1e94;if(_0x3f3bc9>=_0x49aa8f){_0x3f3bc9=_0x49aa8f;_0x1a1e94=0xc8;}else{_0x1a1e94=0xce;}_0x1e4876[_0xb4da('0x18')](_0x1a1e94);return _0x1e4876[_0xb4da('0x1d')](_0xb4da('0x1e'),_0x231de0+'-'+_0x3f3bc9+'/'+_0x49aa8f)[_0xb4da('0x1f')](_0x5031c8);}return null;};}function patchUpdates(_0x63bfdc){return function(_0x23b88e){try{jsonpatch[_0xb4da('0x20')](_0x23b88e,_0x63bfdc,!![]);}catch(_0x340f47){return BPromise['reject'](_0x340f47);}return _0x23b88e[_0xb4da('0x21')]();};}function saveUpdates(_0x1fb204,_0x5d71f9){return function(_0x4c45d3){if(_0x4c45d3){return _0x4c45d3[_0xb4da('0x22')](_0x1fb204)[_0xb4da('0x23')](function(_0x3e908e){return _0x3e908e;});}return null;};}function removeEntity(_0x12fc15,_0x135be3){return function(_0xac2e34){if(_0xac2e34){return _0xac2e34['destroy']()['then'](function(){_0x12fc15[_0xb4da('0x18')](0xcc)[_0xb4da('0x24')]();});}};}function handleEntityNotFound(_0x316187,_0x22a38c){return function(_0x436db5){if(!_0x436db5){_0x316187[_0xb4da('0x17')](0x194);}return _0x436db5;};}function handleError(_0x3135f0,_0x224fa6){_0x224fa6=_0x224fa6||0x1f4;return function(_0x2ed886){logger[_0xb4da('0x25')](_0x2ed886['stack']);if(_0x2ed886['name']){delete _0x2ed886[_0xb4da('0x26')];}_0x3135f0['status'](_0x224fa6)[_0xb4da('0x27')](_0x2ed886);};}exports['index']=function(_0x469cde,_0x675a34){var _0x258a69={},_0xc1f6f2={},_0x35ce74={'count':0x0,'rows':[]};var _0x3174d8=_[_0xb4da('0x28')](db[_0xb4da('0x29')][_0xb4da('0x2a')],function(_0x59e281){return{'name':_0x59e281[_0xb4da('0x2b')],'type':_0x59e281['type'][_0xb4da('0x2c')]};});_0xc1f6f2['model']=_[_0xb4da('0x2d')](_['map'](_0x3174d8,'name'),['format']);_0xc1f6f2[_0xb4da('0x2e')]=_[_0xb4da('0x2f')](_0x469cde['query']);_0xc1f6f2[_0xb4da('0x30')]=_[_0xb4da('0x31')](_0xc1f6f2[_0xb4da('0x32')],_0xc1f6f2['query']);_0x258a69[_0xb4da('0x33')]=_['intersection'](_0xc1f6f2[_0xb4da('0x32')],qs[_0xb4da('0x34')](_0x469cde[_0xb4da('0x2e')][_0xb4da('0x34')]));_0x258a69[_0xb4da('0x33')]=_0x258a69[_0xb4da('0x33')][_0xb4da('0x35')]?_0x258a69[_0xb4da('0x33')]:_0xc1f6f2[_0xb4da('0x32')];if(!_0x469cde[_0xb4da('0x2e')][_0xb4da('0x36')]('nolimit')){_0x258a69[_0xb4da('0x1c')]=qs[_0xb4da('0x1c')](_0x469cde['query'][_0xb4da('0x1c')]);_0x258a69[_0xb4da('0x19')]=qs['offset'](_0x469cde[_0xb4da('0x2e')]['offset']);}_0x258a69[_0xb4da('0x37')]=qs[_0xb4da('0x38')](_0x469cde[_0xb4da('0x2e')][_0xb4da('0x38')]);_0x258a69['where']=qs[_0xb4da('0x30')](_['pick'](_0x469cde['query'],_0xc1f6f2[_0xb4da('0x30')]),_0x3174d8);if(_0x469cde[_0xb4da('0x2e')][_0xb4da('0x39')]){_0x258a69[_0xb4da('0x3a')]=_[_0xb4da('0x3b')](_0x258a69[_0xb4da('0x3a')],{'$or':_[_0xb4da('0x28')](_0x3174d8,function(_0x39b036){if(_0x39b036[_0xb4da('0x3c')]!==_0xb4da('0x3d')){var _0x225eb1={};_0x225eb1[_0x39b036['name']]={'$like':'%'+_0x469cde[_0xb4da('0x2e')][_0xb4da('0x39')]+'%'};return _0x225eb1;}})});}_0x258a69=_['merge']({},_0x258a69,_0x469cde[_0xb4da('0x3e')]);var _0x54ecd2={'where':_0x258a69[_0xb4da('0x3a')]};return db[_0xb4da('0x29')]['count'](_0x54ecd2)['then'](function(_0x4e1dcd){_0x35ce74[_0xb4da('0x1b')]=_0x4e1dcd;if(_0x469cde[_0xb4da('0x2e')][_0xb4da('0x3f')]){_0x258a69[_0xb4da('0x40')]=[{'all':!![]}];}return db[_0xb4da('0x29')][_0xb4da('0x41')](_0x258a69);})['then'](function(_0x52f55f){_0x35ce74[_0xb4da('0x42')]=_0x52f55f;return _0x35ce74;})['then'](respondWithFilteredResult(_0x675a34,_0x258a69))[_0xb4da('0x43')](handleError(_0x675a34,null));};exports[_0xb4da('0x44')]=function(_0x1b54ba,_0x43d773){var _0x5dd5a8={'raw':![],'where':{'id':_0x1b54ba['params']['id']}},_0x50a256={};_0x50a256[_0xb4da('0x32')]=_[_0xb4da('0x2f')](db[_0xb4da('0x29')][_0xb4da('0x2a')]);_0x50a256[_0xb4da('0x2e')]=_[_0xb4da('0x2f')](_0x1b54ba[_0xb4da('0x2e')]);_0x50a256[_0xb4da('0x30')]=_[_0xb4da('0x31')](_0x50a256[_0xb4da('0x32')],_0x50a256[_0xb4da('0x2e')]);_0x5dd5a8[_0xb4da('0x33')]=_[_0xb4da('0x31')](_0x50a256[_0xb4da('0x32')],qs[_0xb4da('0x34')](_0x1b54ba['query']['fields']));_0x5dd5a8[_0xb4da('0x33')]=_0x5dd5a8[_0xb4da('0x33')]['length']?_0x5dd5a8[_0xb4da('0x33')]:_0x50a256['model'];if(_0x1b54ba[_0xb4da('0x2e')][_0xb4da('0x3f')]){_0x5dd5a8[_0xb4da('0x40')]=[{'all':!![]}];}_0x5dd5a8=_[_0xb4da('0x3b')]({},_0x5dd5a8,_0x1b54ba[_0xb4da('0x3e')]);return db[_0xb4da('0x29')][_0xb4da('0x45')](_0x5dd5a8)[_0xb4da('0x23')](handleEntityNotFound(_0x43d773,null))[_0xb4da('0x23')](respondWithResult(_0x43d773,null))['catch'](handleError(_0x43d773,null));};exports['create']=function(_0x29f804,_0x31b4a5){return db['VoiceRecording']['create'](_0x29f804[_0xb4da('0x46')],{})[_0xb4da('0x23')](respondWithResult(_0x31b4a5,0xc9))['catch'](handleError(_0x31b4a5,null));};exports[_0xb4da('0x22')]=function(_0x5da3d1,_0x3f974f){if(_0x5da3d1['body']['id']){delete _0x5da3d1[_0xb4da('0x46')]['id'];}return db[_0xb4da('0x29')][_0xb4da('0x45')]({'where':{'id':_0x5da3d1['params']['id']}})[_0xb4da('0x23')](handleEntityNotFound(_0x3f974f,null))[_0xb4da('0x23')](saveUpdates(_0x5da3d1[_0xb4da('0x46')],null))[_0xb4da('0x23')](respondWithResult(_0x3f974f,null))['catch'](handleError(_0x3f974f,null));};exports[_0xb4da('0x47')]=function(_0x3c7ec0,_0x5c3ac2){return db[_0xb4da('0x29')]['describe']()[_0xb4da('0x23')](respondWithResult(_0x5c3ac2,null))[_0xb4da('0x43')](handleError(_0x5c3ac2,null));};exports[_0xb4da('0x48')]=function(_0x4a6d2b,_0x3805b7,_0x31acc6){var _0x4f906e=require('../../components/encryptor');var _0x2b446f=![];var _0x3ebd6e={};if(_0x4a6d2b['query'][_0xb4da('0x3c')]&&_0x4a6d2b[_0xb4da('0x2e')][_0xb4da('0x3c')]===_0xb4da('0x49')){_0x3ebd6e['uniqueid']=_0x4a6d2b['params']['id'];}else{_0x3ebd6e['id']=_0x4a6d2b[_0xb4da('0x4a')]['id'];}return db[_0xb4da('0x29')][_0xb4da('0x45')]({'where':_0x3ebd6e,'attributes':['id',_0xb4da('0x4b')],'raw':!![]})[_0xb4da('0x23')](handleEntityNotFound(_0x3805b7,null))[_0xb4da('0x23')](function(_0xf35de5){if(_0xf35de5){var _0x1b84cb=_0xf35de5['value'];var _0x53f7a9=util[_0xb4da('0x4c')](_0xb4da('0x4d'),_0x1b84cb);if(fs[_0xb4da('0x4e')](_0x53f7a9)){_0x2b446f=!![];return _0x4f906e[_0xb4da('0x4f')](_0x53f7a9,_0x1b84cb,config[_0xb4da('0x50')][_0xb4da('0x51')])[_0xb4da('0x23')](function(){return _0xf35de5;});}return _0xf35de5;}})[_0xb4da('0x23')](function(_0x5a0686){if(_0x5a0686){var _0x42e548=_0x5a0686[_0xb4da('0x4b')];if(!fs[_0xb4da('0x4e')](_0x42e548)){throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x54'));}if(_0x5a0686[_0xb4da('0x55')]){return _0x3805b7[_0xb4da('0x48')](_0x42e548,_0x5a0686['filename']+path['extname'](_0x42e548),function(){if(_0x2b446f){fs['unlink'](_0x42e548);}});}else{return _0x3805b7['download'](_0x42e548,function(_0x17ec8c){if(_0x2b446f){fs['unlink'](_0x42e548);}});}}})[_0xb4da('0x43')](function(_0x1b4acf){if(_0x1b4acf[_0xb4da('0x56')]==='VoiceRecording\x20not\x20found'){_0x3805b7[_0xb4da('0x18')](0x194)[_0xb4da('0x27')](_0xb4da('0x57'));}else{return handleError(_0x3805b7,null);}});};exports[_0xb4da('0x58')]=function(_0xabad8f,_0x53dd51,_0x28e233){var _0x1d2f57=require(_0xb4da('0x59'));var _0xa1952c=![];var _0x179a55={'$and':[db[_0xb4da('0x5a')][_0xb4da('0x3a')](db[_0xb4da('0x5a')]['fn'](_0xb4da('0x5b'),db[_0xb4da('0x5a')]['col']('uniqueid')),_0xabad8f['query'][_0xb4da('0x5c')])]};if(_0xabad8f[_0xb4da('0x2e')][_0xb4da('0x3c')]&&_0xabad8f[_0xb4da('0x2e')][_0xb4da('0x3c')]===_0xb4da('0x49')){_0x179a55[_0xb4da('0x5d')][_0xb4da('0x5e')]({'uniqueid':_0xabad8f['params']['id']});}else{_0x179a55[_0xb4da('0x5d')]['push']({'id':_0xabad8f['params']['id']});}return db[_0xb4da('0x29')][_0xb4da('0x45')]({'where':_0x179a55,'attributes':['id',_0xb4da('0x4b')],'raw':!![]})[_0xb4da('0x23')](handleEntityNotFound(_0x53dd51,null))[_0xb4da('0x23')](function(_0x1d438a){if(_0x1d438a){var _0x162554=util[_0xb4da('0x4c')](_0xb4da('0x4d'),_0x1d438a['value']);if(fs['existsSync'](_0x162554)){_0xa1952c=!![];return _0x1d2f57[_0xb4da('0x4f')](_0x162554,_0x1d438a[_0xb4da('0x4b')],config['secrets'][_0xb4da('0x51')])[_0xb4da('0x23')](function(){return _0x1d438a;});}return _0x1d438a;}})[_0xb4da('0x23')](function(_0x25e35e){if(_0x25e35e){if(!fs[_0xb4da('0x4e')](_0x25e35e[_0xb4da('0x4b')])){throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x54'));}if(_0x25e35e[_0xb4da('0x55')]){return _0x53dd51[_0xb4da('0x48')](_0x25e35e['value'],_0x25e35e['filename']+path[_0xb4da('0x5f')](_0x25e35e[_0xb4da('0x4b')]),function(){if(_0xa1952c){fs[_0xb4da('0x60')](_0x25e35e['value']);}});}else{return _0x53dd51[_0xb4da('0x48')](_0x25e35e[_0xb4da('0x4b')],function(_0x24c619){if(_0xa1952c){fs[_0xb4da('0x60')](_0x25e35e[_0xb4da('0x4b')]);}});}}})[_0xb4da('0x43')](handleError(_0x53dd51,null));};exports[_0xb4da('0x61')]=function(_0x38d409,_0x5bd793){return db[_0xb4da('0x29')][_0xb4da('0x45')]({'where':{'id':_0x38d409['params']['id']}})[_0xb4da('0x23')](function(_0x5c3248){if(_['isNil'](_0x5c3248)){throw new ReferenceError(_0xb4da('0x62'));}return _0x5c3248;})[_0xb4da('0x23')](function(_0xd63b9a){var _0x4665f8=_0xd63b9a[_0xb4da('0x4b')];logger[_0xb4da('0x63')](_0xb4da('0x64'),_0x4665f8);if(!_[_0xb4da('0x65')](_0xd63b9a['value'])&&fs[_0xb4da('0x4e')](_0x4665f8)){logger[_0xb4da('0x63')](_0xb4da('0x66')+_0x4665f8+_0xb4da('0x67'));fs[_0xb4da('0x68')](_0x4665f8);}_0x4665f8=_0x4665f8+_0xb4da('0x69');if(!_[_0xb4da('0x65')](_0xd63b9a[_0xb4da('0x4b')])&&fs[_0xb4da('0x4e')](_0x4665f8)){logger[_0xb4da('0x63')](_0xb4da('0x66')+_0x4665f8+_0xb4da('0x67'));fs[_0xb4da('0x68')](_0x4665f8);}return _0xd63b9a;})[_0xb4da('0x23')](function(_0x22ce39){if(!_0x22ce39)throw new InternalError();return _0x22ce39[_0xb4da('0x61')]();})[_0xb4da('0x23')](function(){_0x5bd793[_0xb4da('0x18')](0xcc)[_0xb4da('0x24')]();})[_0xb4da('0x43')](handleError(_0x5bd793,null));};function getBucketslist(_0x11ce2d,_0x5d4c5c,_0x169668){return new Promise(function(_0x3426cb,_0x182ace){var _0x14848e=new AWS['S3']({'accessKeyId':_0x5d4c5c,'secretAccessKey':_0x11ce2d,'region':_0x169668});_0x14848e[_0xb4da('0x6a')]({},function(_0x5dd694,_0x161df4){if(_0x5dd694){return _0x182ace(_0x5dd694);}else{return _0x3426cb(_0x161df4);}});});}function createBucket(_0x2e68e9,_0x5842bc,_0x26227e,_0xaae0f){return new Promise(function(_0x1d0ee0,_0xcb7d11){var _0x37c9b9=new AWS['S3']({'accessKeyId':_0x5842bc,'secretAccessKey':_0x2e68e9,'region':_0x26227e});_0x37c9b9[_0xb4da('0x6b')]({'Bucket':_0xaae0f},function(_0x2bedb1,_0x3fedc2){if(_0x2bedb1){return _0xcb7d11(_0x2bedb1);}else{return _0x1d0ee0(_0x3fedc2);}});});}function uploadFile(_0x5abbbd,_0x5b8727,_0x407a96,_0x23bce1,_0x35add7,_0x1de692){return new Promise(function(_0x4b8ebc,_0x1b4ba3){var _0x39e919=new AWS['S3']({'accessKeyId':_0x5b8727,'secretAccessKey':_0x5abbbd,'region':_0x407a96});_0x39e919[_0xb4da('0x6c')]({'Bucket':_0x23bce1,'Key':_0x35add7,'Body':_0x1de692},function(_0x3745a0,_0x265520){if(_0x3745a0){return _0x1b4ba3(_0x3745a0);}else{return _0x4b8ebc(_0x265520);}});});}function startTranscribe(_0x56620b,_0x5916f6,_0x3440fa,_0x5aa1a6,_0x530cae,_0x48b44c){return new Promise(function(_0x5a3e24,_0x140937){var _0x578997=new AWS[(_0xb4da('0x6d'))]({'accessKeyId':_0x5916f6,'secretAccessKey':_0x56620b,'region':_0x3440fa});_0x578997[_0xb4da('0x6e')]({'TranscriptionJobName':_0x5aa1a6,'LanguageCode':_0x530cae,'Media':{'MediaFileUri':_0x48b44c}},function(_0xecd230,_0x3f31a6){if(_0xecd230){return _0x140937(_0xecd230);}else{return _0x5a3e24(_0x3f31a6);}});});}function transcribe(_0x167ff9,_0x388875,_0x3dfa3c,_0x4c641f,_0x301d6b,_0x177ecd,_0x1aa913){return new Promise(function(_0xc95dc1,_0x2906ae){var _0x23f16c={};logger['info'](util['format'](_0xb4da('0x6f'),_0x167ff9,_0x301d6b));return uploadFile(_0x388875,_0x3dfa3c,_0x4c641f,_0x301d6b,path['basename'](_0x177ecd),fs['readFileSync'](_0x177ecd))[_0xb4da('0x23')](function(_0x38b6f2){logger[_0xb4da('0x63')](util[_0xb4da('0x4c')](_0xb4da('0x70'),_0x167ff9,_0x301d6b,_0x38b6f2['Location']));_0x23f16c[_0xb4da('0x71')]=_0x38b6f2[_0xb4da('0x72')];_0x23f16c['location']=_0x38b6f2[_0xb4da('0x73')];logger[_0xb4da('0x63')](util[_0xb4da('0x4c')](_0xb4da('0x74'),_0x167ff9));return startTranscribe(_0x388875,_0x3dfa3c,_0x4c641f,uuidv4(),_0x1aa913,_0x38b6f2[_0xb4da('0x73')]);})[_0xb4da('0x23')](function(_0x7b2f39){logger['info'](util[_0xb4da('0x4c')](_0xb4da('0x75'),_0x167ff9,_0x7b2f39['TranscriptionJob'][_0xb4da('0x76')]));_0x23f16c[_0xb4da('0x77')]=_0x7b2f39[_0xb4da('0x78')][_0xb4da('0x76')];_0x23f16c[_0xb4da('0x79')]=_0x7b2f39[_0xb4da('0x78')]['TranscriptionJobStatus'];return _0xc95dc1(_0x23f16c);})[_0xb4da('0x43')](function(_0x1b78ba){return _0x2906ae(_0x1b78ba);});});}exports[_0xb4da('0x7a')]=function(_0x1afa34,_0x1823e1,_0x20009e){var _0x2c8dfe;var _0x3cb2c5;var _0x5d7d66;var _0x38f379=require(_0xb4da('0x59'));return db[_0xb4da('0x29')]['findOne']({'where':{'id':_0x1afa34[_0xb4da('0x4a')]['id']}})[_0xb4da('0x23')](function(_0x157075){if(_0x157075){var _0xe00962=util['format']('%s.cypher',_0x157075['value']);if(fs[_0xb4da('0x4e')](_0xe00962)){cypher=!![];return _0x38f379[_0xb4da('0x4f')](_0xe00962,_0x157075[_0xb4da('0x4b')],config[_0xb4da('0x50')][_0xb4da('0x51')])['then'](function(){return _0x157075;});}return _0x157075;}})[_0xb4da('0x23')](function(_0x7b3e82){if(!_0x7b3e82){throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x7b'));}_0x3cb2c5=_0x7b3e82;return db[_0xb4da('0x7c')][_0xb4da('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1823e1,null))[_0xb4da('0x23')](function(_0x31f13a){if(_0x31f13a){_0x2c8dfe=_0x31f13a;if(!_0x2c8dfe['transcribe']||!_0x2c8dfe['transcribeAccountId']||!_0x2c8dfe[_0xb4da('0x7e')]||!_0x2c8dfe[_0xb4da('0x7f')]||!_0x2c8dfe[_0xb4da('0x71')]){throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x80'));}if(_0x1afa34[_0xb4da('0x46')][_0xb4da('0x81')]&&(!_0x2c8dfe[_0xb4da('0x82')]||!_0x2c8dfe[_0xb4da('0x83')]||!_0x2c8dfe[_0xb4da('0x84')]||!_0x2c8dfe[_0xb4da('0x7f')]||!_0x2c8dfe[_0xb4da('0x71')])){throw new db['Sequelize'][(_0xb4da('0x53'))](_0xb4da('0x85'));}return db[_0xb4da('0x86')][_0xb4da('0x7d')]({'where':{'id':_0x2c8dfe[_0xb4da('0x87')]}});}})['then'](function(_0xc3643f){if(!_0xc3643f){throw new db['Sequelize'][(_0xb4da('0x53'))](_0xb4da('0x88'));}if(!_0xc3643f[_0xb4da('0x89')]||!_0xc3643f[_0xb4da('0x8a')]){throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x8b'));}_0x5d7d66=_0xc3643f;return getBucketslist(_0x5d7d66[_0xb4da('0x89')],_0x5d7d66[_0xb4da('0x8a')],_0x2c8dfe[_0xb4da('0x7e')]);})[_0xb4da('0x23')](function(_0x30fd6b){if(_0x30fd6b&&_0x30fd6b[_0xb4da('0x8c')]){var _0x23722=_[_0xb4da('0x45')](_0x30fd6b[_0xb4da('0x8c')],function(_0x14fd52){return _0x14fd52['Name']===_0x2c8dfe[_0xb4da('0x71')];});if(!_0x23722){logger[_0xb4da('0x63')](util[_0xb4da('0x4c')](_0xb4da('0x8d'),_0x1afa34[_0xb4da('0x4a')]['id'],_0x2c8dfe[_0xb4da('0x71')]));return createBucket(_0x5d7d66[_0xb4da('0x89')],_0x5d7d66[_0xb4da('0x8a')],_0x2c8dfe[_0xb4da('0x7e')],_0x2c8dfe[_0xb4da('0x71')]);}logger[_0xb4da('0x63')](util[_0xb4da('0x4c')](_0xb4da('0x8e'),_0x1afa34[_0xb4da('0x4a')]['id'],_0x2c8dfe['bucket']));return;}})[_0xb4da('0x23')](function(_0x1a58b0){if(_0x3cb2c5['transcribeStatus']===_0xb4da('0x8f')){return transcribe(_0x1afa34[_0xb4da('0x4a')]['id'],_0x5d7d66['data1'],_0x5d7d66[_0xb4da('0x8a')],_0x2c8dfe[_0xb4da('0x7e')],_0x2c8dfe['bucket'],_0x3cb2c5['value'],_0x2c8dfe[_0xb4da('0x7f')]);}else{logger[_0xb4da('0x63')](util['format'](_0xb4da('0x90'),_0x1afa34[_0xb4da('0x4a')]['id']));return{'transcribeStatus':_0xb4da('0x91')};}})['then'](function(_0x2f0d0b){if(_0x2f0d0b){_0x2f0d0b[_0xb4da('0x92')]=_0x1afa34[_0xb4da('0x46')][_0xb4da('0x81')];return _0x3cb2c5['updateAttributes'](_0x2f0d0b);}})[_0xb4da('0x23')](respondWithResult(_0x1823e1,null))[_0xb4da('0x43')](handleError(_0x1823e1,null));};function writeFile(_0x351983,_0x475703){return new Promise(function(_0x3b011b,_0x208dd2){fs[_0xb4da('0x93')](_0x475703,_0x351983,function(_0x471cd7,_0x1a4cc8){if(_0x471cd7){return _0x208dd2(_0x471cd7);}else{return _0x3b011b(_0x1a4cc8);}});});}exports[_0xb4da('0x94')]=function(_0x3fbc93,_0x20dc2a,_0x31a8c5){return db[_0xb4da('0x29')][_0xb4da('0x7d')]({'where':{'id':_0x3fbc93[_0xb4da('0x4a')]['id']}})[_0xb4da('0x23')](handleEntityNotFound(_0x20dc2a))[_0xb4da('0x23')](function(_0x21f4d0){if(_0x21f4d0&&_0x21f4d0[_0xb4da('0x95')]){var _0x3fca2c=_0x21f4d0[_0xb4da('0x95')];var _0x308e81=config['root']+'/server/files/transcribes/transcribe_'+_0x21f4d0['id']+'.txt';if(fs[_0xb4da('0x4e')](_0x308e81)){return _0x308e81;}return writeFile(_0x3fca2c,_0x308e81)['then'](function(){return _0x308e81;});}else{throw new db[(_0xb4da('0x52'))][(_0xb4da('0x53'))](_0xb4da('0x96'));}})['then'](function(_0x3b84b8){return _0x20dc2a['download'](_0x3b84b8);})['catch'](handleError(_0x20dc2a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f0980d8..de4c739 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 _0x238f=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x2bec03,_0x2e917b){var _0x11a1f9=function(_0x2b4a8d){while(--_0x2b4a8d){_0x2bec03['push'](_0x2bec03['shift']());}};_0x11a1f9(++_0x2e917b);}(_0x238f,0xa5));var _0xf238=function(_0x3e96ef,_0x562d1c){_0x3e96ef=_0x3e96ef-0x0;var _0x3f44bb=_0x238f[_0x3e96ef];return _0x3f44bb;};'use strict';var attributes=require(_0xf238('0x0'));module[_0xf238('0x1')]=function(_0x14345d,_0x58ce89){return _0x14345d[_0xf238('0x2')](_0xf238('0x3'),attributes,{'tableName':_0xf238('0x4'),'paranoid':![],'indexes':[{'name':_0xf238('0x5'),'fields':[_0xf238('0x5')]},{'name':_0xf238('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3379=['transcribeStatus','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x3379,0x115));var _0x9337=function(_0x2c4fd8,_0x42531c){_0x2c4fd8=_0x2c4fd8-0x0;var _0x25bdad=_0x3379[_0x2c4fd8];return _0x25bdad;};'use strict';var attributes=require(_0x9337('0x0'));module[_0x9337('0x1')]=function(_0x43fb11,_0x3338dd){return _0x43fb11['define'](_0x9337('0x2'),attributes,{'tableName':_0x9337('0x3'),'paranoid':![],'indexes':[{'name':_0x9337('0x4'),'fields':[_0x9337('0x4')]},{'name':'transcribeStatus','fields':[_0x9337('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 44db459..2226006 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','attributes','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','unlink','info','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38ef4f,_0x501433){var _0x208c39=function(_0xd2d365){while(--_0xd2d365){_0x38ef4f['push'](_0x38ef4f['shift']());}};_0x208c39(++_0x501433);}(_0xc2c7,0x134));var _0x7c2c=function(_0x32529e,_0x37e656){_0x32529e=_0x32529e-0x0;var _0x505cf8=_0xc2c7[_0x32529e];return _0x505cf8;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')](_0x14453f[_0x7c2c('0x18')],{'raw':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')]['where']||null:null,'attributes':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null})[_0x7c2c('0xc')](function(_0xa84620){logger['info'](_0x7c2c('0x15'),_0x14453f);logger['debug'](_0x7c2c('0x15'),_0x14453f,JSON['stringify'](_0xa84620));_0x17df4a(_0xa84620);})[_0x7c2c('0x1d')](function(_0x274c3b){logger[_0x7c2c('0x12')]('UpdateVoiceRecording',_0x274c3b['message'],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0x274c3b[_0x7c2c('0x14')]));});});};exports[_0x7c2c('0x1e')]=function(_0x150690){var _0x31d8f3=this;return new Promise(function(_0xa8e145,_0x3f4618){var _0x4b1dd0=require(_0x7c2c('0x1f'));var _0xf39941;return db[_0x7c2c('0x20')][_0x7c2c('0x21')]({'attributes':['id',_0x7c2c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7c2c('0xc')](function(_0xf2bfd1){_0xf39941=_0xf2bfd1;return db[_0x7c2c('0x16')][_0x7c2c('0x23')](_0x150690['body']);})[_0x7c2c('0xc')](function(_0x3a3730){if(_0xf39941[_0x7c2c('0x22')]&&fs[_0x7c2c('0x24')](_0x3a3730['value'])){var _0xcb98ba=util[_0x7c2c('0x25')](_0x7c2c('0x26'),_0x3a3730[_0x7c2c('0x27')]);return _0x4b1dd0[_0x7c2c('0x28')](_0x3a3730[_0x7c2c('0x27')],_0xcb98ba,config[_0x7c2c('0x29')]['recording'])[_0x7c2c('0xc')](function(){fs[_0x7c2c('0x2a')](_0x3a3730[_0x7c2c('0x27')]);logger[_0x7c2c('0x2b')](_0x7c2c('0x2c'));return _0x3a3730;});}return _0x3a3730;})['then'](function(_0x47ef3c){logger[_0x7c2c('0x2b')]('CreateVoiceRecording',_0x150690);logger['debug'](_0x7c2c('0x1e'),_0x150690,JSON[_0x7c2c('0x11')](_0x47ef3c));_0xa8e145(_0x47ef3c);})[_0x7c2c('0x1d')](function(_0x156c03){logger['error'](_0x7c2c('0x1e'),_0x156c03[_0x7c2c('0x14')],_0x150690);_0x3f4618(_0x31d8f3[_0x7c2c('0x12')](0x1f4,_0x156c03[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1f03e1,_0x268b02){var _0x4fd1ee=function(_0x44cefa){while(--_0x44cefa){_0x1f03e1['push'](_0x1f03e1['shift']());}};_0x4fd1ee(++_0x268b02);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c18a6b0..f49379e 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 _0x7354=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x7354,0x7d));var _0x4735=function(_0x7c13ed,_0x4d9dd5){_0x7c13ed=_0x7c13ed-0x0;var _0x4cad66=_0x7354[_0x7c13ed];return _0x4cad66;};'use strict';var multer=require(_0x4735('0x0'));var util=require('util');var path=require(_0x4735('0x1'));var timeout=require(_0x4735('0x2'));var express=require(_0x4735('0x3'));var router=express[_0x4735('0x4')]();var fs_extra=require(_0x4735('0x5'));var auth=require(_0x4735('0x6'));var interaction=require(_0x4735('0x7'));var config=require(_0x4735('0x8'));var controller=require(_0x4735('0x9'));router[_0x4735('0xa')]('/',auth[_0x4735('0xb')](),controller[_0x4735('0xc')]);router[_0x4735('0xa')](_0x4735('0xd'),auth[_0x4735('0xb')](),controller['describe']);router[_0x4735('0xa')](_0x4735('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4735('0xb')](),controller[_0x4735('0xf')]);router[_0x4735('0x10')](_0x4735('0xe'),auth[_0x4735('0xb')](),controller[_0x4735('0x11')]);router['delete'](_0x4735('0xe'),auth[_0x4735('0xb')](),controller[_0x4735('0x12')]);module[_0x4735('0x13')]=router; \ No newline at end of file +var _0x5c00=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','put'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x5c00,0xd4));var _0x05c0=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0x5c00[_0x1d4923];return _0x14ea9a;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require('path');var timeout=require(_0x05c0('0x2'));var express=require(_0x05c0('0x3'));var router=express[_0x05c0('0x4')]();var fs_extra=require(_0x05c0('0x5'));var auth=require(_0x05c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05c0('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x05c0('0x8')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x9')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0xa')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')](_0x05c0('0xc'),auth[_0x05c0('0xa')](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')]('/',auth[_0x05c0('0xa')](),controller['create']);router[_0x05c0('0xf')]('/:id',auth[_0x05c0('0xa')](),controller[_0x05c0('0x10')]);router['delete'](_0x05c0('0xc'),auth[_0x05c0('0xa')](),controller[_0x05c0('0x11')]);module[_0x05c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 054b8f3..9cd9eb3 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 _0x60f2=['moment','ENUM','blind','STRING','sequelize'];(function(_0x5907c8,_0x44b550){var _0x4c594f=function(_0x131182){while(--_0x131182){_0x5907c8['push'](_0x5907c8['shift']());}};_0x4c594f(++_0x44b550);}(_0x60f2,0x199));var _0x260f=function(_0x5ea46b,_0x123766){_0x5ea46b=_0x5ea46b-0x0;var _0x2f4f1e=_0x60f2[_0x5ea46b];return _0x2f4f1e;};'use strict';var Sequelize=require(_0x260f('0x0'));var moment=require(_0x260f('0x1'));module['exports']={'type':{'type':Sequelize[_0x260f('0x2')](_0x260f('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x260f('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x260f('0x4')]},'transferercalleridname':{'type':Sequelize[_0x260f('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x260f('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x260f('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x260f('0x4')]},'transferercontext':{'type':Sequelize[_0x260f('0x4')]},'transfererexten':{'type':Sequelize[_0x260f('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x260f('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x260f('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x260f('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x260f('0x4')]},'transfereeexten':{'type':Sequelize[_0x260f('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x260f('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x260f('0x4')]}}; \ No newline at end of file +var _0x0a59=['sequelize','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x5663b6,_0x1109bb){var _0x46e231=function(_0x348344){while(--_0x348344){_0x5663b6['push'](_0x5663b6['shift']());}};_0x46e231(++_0x1109bb);}(_0x0a59,0x181));var _0x90a5=function(_0x46bffe,_0xc3ad1f){_0x46bffe=_0x46bffe-0x0;var _0x4a12be=_0x0a59[_0x46bffe];return _0x4a12be;};'use strict';var Sequelize=require(_0x90a5('0x0'));var moment=require('moment');module[_0x90a5('0x1')]={'type':{'type':Sequelize[_0x90a5('0x2')](_0x90a5('0x3'),_0x90a5('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x90a5('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x90a5('0x5')]},'transferercalleridname':{'type':Sequelize[_0x90a5('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x90a5('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x90a5('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x90a5('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x90a5('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x90a5('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x90a5('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x90a5('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x90a5('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x90a5('0x5')]},'isexternal':{'type':Sequelize[_0x90a5('0x2')](_0x90a5('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x90a5('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 05ee429..a08522d 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 _0x5007=['find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','key','map','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','include','findAll','show','params','keys','intersection','includeAll'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x5007,0xe3));var _0x7500=function(_0x397bd9,_0x48a001){_0x397bd9=_0x397bd9-0x0;var _0x44f4d7=_0x5007[_0x397bd9];return _0x44f4d7;};'use strict';var emlformat=require(_0x7500('0x0'));var rimraf=require(_0x7500('0x1'));var zipdir=require(_0x7500('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7500('0x3'));var moment=require('moment');var BPromise=require(_0x7500('0x4'));var Mustache=require(_0x7500('0x5'));var util=require('util');var path=require(_0x7500('0x6'));var sox=require('sox');var csv=require(_0x7500('0x7'));var ejs=require(_0x7500('0x8'));var fs=require('fs');var fs_extra=require(_0x7500('0x9'));var _=require(_0x7500('0xa'));var squel=require(_0x7500('0xb'));var crypto=require(_0x7500('0xc'));var jsforce=require(_0x7500('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7500('0x7'));var querystring=require('querystring');var Papa=require(_0x7500('0xe'));var Redis=require('ioredis');var authService=require(_0x7500('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7500('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7500('0x11'));var utils=require(_0x7500('0x12'));var config=require(_0x7500('0x13'));var licenseUtil=require(_0x7500('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24f4f5,_0x3f85ea){_0x3f85ea=_0x3f85ea||0xcc;return function(_0x1c7efb){if(_0x1c7efb){return _0x24f4f5[_0x7500('0x15')](_0x3f85ea);}return _0x24f4f5[_0x7500('0x16')](_0x3f85ea)[_0x7500('0x17')]();};}function respondWithResult(_0x3f22fd,_0x5144cb){_0x5144cb=_0x5144cb||0xc8;return function(_0x179661){if(_0x179661){return _0x3f22fd[_0x7500('0x16')](_0x5144cb)[_0x7500('0x18')](_0x179661);}};}function respondWithFilteredResult(_0x3dcc42,_0x4cc908){return function(_0x294e49){if(_0x294e49){var _0x537242=typeof _0x4cc908[_0x7500('0x19')]===_0x7500('0x1a')&&typeof _0x4cc908[_0x7500('0x1b')]===_0x7500('0x1a');var _0xef1d9c=_0x294e49['count'];var _0x479292=_0x537242?0x0:_0x4cc908[_0x7500('0x19')];var _0x489096=_0x537242?_0x294e49['count']:_0x4cc908[_0x7500('0x19')]+_0x4cc908[_0x7500('0x1b')];var _0x3d0339;if(_0x489096>=_0xef1d9c){_0x489096=_0xef1d9c;_0x3d0339=0xc8;}else{_0x3d0339=0xce;}_0x3dcc42[_0x7500('0x16')](_0x3d0339);return _0x3dcc42[_0x7500('0x1c')]('Content-Range',_0x479292+'-'+_0x489096+'/'+_0xef1d9c)[_0x7500('0x18')](_0x294e49);}return null;};}function patchUpdates(_0x127354){return function(_0x470deb){try{jsonpatch[_0x7500('0x1d')](_0x470deb,_0x127354,!![]);}catch(_0x590bce){return BPromise[_0x7500('0x1e')](_0x590bce);}return _0x470deb[_0x7500('0x1f')]();};}function saveUpdates(_0x1ed7a1,_0x1c80e3){return function(_0x4c93ce){if(_0x4c93ce){return _0x4c93ce[_0x7500('0x20')](_0x1ed7a1)[_0x7500('0x21')](function(_0x4a1d92){return _0x4a1d92;});}return null;};}function removeEntity(_0x3fabc6,_0x62c00c){return function(_0x5ab5f6){if(_0x5ab5f6){return _0x5ab5f6[_0x7500('0x22')]()[_0x7500('0x21')](function(){_0x3fabc6[_0x7500('0x16')](0xcc)[_0x7500('0x17')]();});}};}function handleEntityNotFound(_0x486c59,_0x250604){return function(_0x51a35c){if(!_0x51a35c){_0x486c59[_0x7500('0x15')](0x194);}return _0x51a35c;};}function handleError(_0x238e40,_0x1fce87){_0x1fce87=_0x1fce87||0x1f4;return function(_0x2b89bf){logger['error'](_0x2b89bf[_0x7500('0x23')]);if(_0x2b89bf[_0x7500('0x24')]){delete _0x2b89bf[_0x7500('0x24')];}_0x238e40[_0x7500('0x16')](_0x1fce87)[_0x7500('0x25')](_0x2b89bf);};}exports[_0x7500('0x26')]=function(_0x4c6a39,_0x375df6){var _0x5b66ef={},_0xd24378={},_0x4c03fc={'count':0x0,'rows':[]};var _0x39435b=_['map'](db[_0x7500('0x27')][_0x7500('0x28')],function(_0x2a9a66){return{'name':_0x2a9a66[_0x7500('0x29')],'type':_0x2a9a66['type'][_0x7500('0x2a')]};});_0xd24378['model']=_[_0x7500('0x2b')](_0x39435b,_0x7500('0x24'));_0xd24378['query']=_['keys'](_0x4c6a39[_0x7500('0x2c')]);_0xd24378[_0x7500('0x2d')]=_['intersection'](_0xd24378[_0x7500('0x2e')],_0xd24378[_0x7500('0x2c')]);_0x5b66ef['attributes']=_['intersection'](_0xd24378[_0x7500('0x2e')],qs[_0x7500('0x2f')](_0x4c6a39[_0x7500('0x2c')][_0x7500('0x2f')]));_0x5b66ef[_0x7500('0x30')]=_0x5b66ef[_0x7500('0x30')][_0x7500('0x31')]?_0x5b66ef[_0x7500('0x30')]:_0xd24378[_0x7500('0x2e')];if(!_0x4c6a39['query'][_0x7500('0x32')](_0x7500('0x33'))){_0x5b66ef[_0x7500('0x1b')]=qs['limit'](_0x4c6a39[_0x7500('0x2c')]['limit']);_0x5b66ef['offset']=qs['offset'](_0x4c6a39[_0x7500('0x2c')][_0x7500('0x19')]);}_0x5b66ef[_0x7500('0x34')]=qs[_0x7500('0x35')](_0x4c6a39[_0x7500('0x2c')]['sort']);_0x5b66ef[_0x7500('0x36')]=qs[_0x7500('0x2d')](_[_0x7500('0x37')](_0x4c6a39[_0x7500('0x2c')],_0xd24378[_0x7500('0x2d')]),_0x39435b);if(_0x4c6a39['query'][_0x7500('0x38')]){_0x5b66ef[_0x7500('0x36')]=_['merge'](_0x5b66ef['where'],{'$or':_[_0x7500('0x2b')](_0x39435b,function(_0x583320){if(_0x583320[_0x7500('0x39')]!==_0x7500('0x3a')){var _0x37bef8={};_0x37bef8[_0x583320[_0x7500('0x24')]]={'$like':'%'+_0x4c6a39['query'][_0x7500('0x38')]+'%'};return _0x37bef8;}})});}_0x5b66ef=_[_0x7500('0x3b')]({},_0x5b66ef,_0x4c6a39[_0x7500('0x3c')]);var _0x54589f={'where':_0x5b66ef['where']};return db['VoiceTransferReport'][_0x7500('0x3d')](_0x54589f)['then'](function(_0x2674c9){_0x4c03fc['count']=_0x2674c9;if(_0x4c6a39[_0x7500('0x2c')]['includeAll']){_0x5b66ef[_0x7500('0x3e')]=[{'all':!![]}];}return db[_0x7500('0x27')][_0x7500('0x3f')](_0x5b66ef);})[_0x7500('0x21')](function(_0x43748a){_0x4c03fc['rows']=_0x43748a;return _0x4c03fc;})['then'](respondWithFilteredResult(_0x375df6,_0x5b66ef))['catch'](handleError(_0x375df6,null));};exports[_0x7500('0x40')]=function(_0x149f46,_0x50d201){var _0x36341f={'raw':!![],'where':{'id':_0x149f46[_0x7500('0x41')]['id']}},_0x153dc8={};_0x153dc8[_0x7500('0x2e')]=_[_0x7500('0x42')](db['VoiceTransferReport']['rawAttributes']);_0x153dc8[_0x7500('0x2c')]=_[_0x7500('0x42')](_0x149f46[_0x7500('0x2c')]);_0x153dc8[_0x7500('0x2d')]=_[_0x7500('0x43')](_0x153dc8[_0x7500('0x2e')],_0x153dc8[_0x7500('0x2c')]);_0x36341f[_0x7500('0x30')]=_['intersection'](_0x153dc8[_0x7500('0x2e')],qs[_0x7500('0x2f')](_0x149f46[_0x7500('0x2c')][_0x7500('0x2f')]));_0x36341f['attributes']=_0x36341f[_0x7500('0x30')]['length']?_0x36341f[_0x7500('0x30')]:_0x153dc8[_0x7500('0x2e')];if(_0x149f46[_0x7500('0x2c')][_0x7500('0x44')]){_0x36341f['include']=[{'all':!![]}];}_0x36341f=_[_0x7500('0x3b')]({},_0x36341f,_0x149f46[_0x7500('0x3c')]);return db[_0x7500('0x27')][_0x7500('0x45')](_0x36341f)[_0x7500('0x21')](handleEntityNotFound(_0x50d201,null))[_0x7500('0x21')](respondWithResult(_0x50d201,null))[_0x7500('0x46')](handleError(_0x50d201,null));};exports[_0x7500('0x47')]=function(_0x506c3a,_0xf13edf){return db[_0x7500('0x27')][_0x7500('0x47')](_0x506c3a[_0x7500('0x48')],{})[_0x7500('0x21')](respondWithResult(_0xf13edf,0xc9))[_0x7500('0x46')](handleError(_0xf13edf,null));};exports[_0x7500('0x20')]=function(_0x4b5821,_0xabf841){if(_0x4b5821[_0x7500('0x48')]['id']){delete _0x4b5821[_0x7500('0x48')]['id'];}return db[_0x7500('0x27')][_0x7500('0x45')]({'where':{'id':_0x4b5821['params']['id']}})['then'](handleEntityNotFound(_0xabf841,null))['then'](saveUpdates(_0x4b5821['body'],null))[_0x7500('0x21')](respondWithResult(_0xabf841,null))[_0x7500('0x46')](handleError(_0xabf841,null));};exports['destroy']=function(_0x86ba53,_0x4e5407){return db[_0x7500('0x27')][_0x7500('0x45')]({'where':{'id':_0x86ba53[_0x7500('0x41')]['id']}})[_0x7500('0x21')](handleEntityNotFound(_0x4e5407,null))[_0x7500('0x21')](removeEntity(_0x4e5407,null))['catch'](handleError(_0x4e5407,null));};exports['describe']=function(_0xfc1961,_0x11a4f9){return db[_0x7500('0x27')][_0x7500('0x49')]()[_0x7500('0x21')](respondWithResult(_0x11a4f9,null))[_0x7500('0x46')](handleError(_0x11a4f9,null));}; \ No newline at end of file +var _0xf6ab=['attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x24b1be,_0x24a8bb){var _0x1d58d6=function(_0x446b77){while(--_0x446b77){_0x24b1be['push'](_0x24b1be['shift']());}};_0x1d58d6(++_0x24a8bb);}(_0xf6ab,0x187));var _0xbf6a=function(_0x3a4a1c,_0x2ef3d2){_0x3a4a1c=_0x3a4a1c-0x0;var _0x3bf84a=_0xf6ab[_0x3a4a1c];return _0x3bf84a;};'use strict';var emlformat=require(_0xbf6a('0x0'));var rimraf=require(_0xbf6a('0x1'));var zipdir=require(_0xbf6a('0x2'));var jsonpatch=require(_0xbf6a('0x3'));var rp=require(_0xbf6a('0x4'));var moment=require(_0xbf6a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf6a('0x6'));var path=require('path');var sox=require(_0xbf6a('0x7'));var csv=require(_0xbf6a('0x8'));var ejs=require(_0xbf6a('0x9'));var fs=require('fs');var fs_extra=require(_0xbf6a('0xa'));var _=require(_0xbf6a('0xb'));var squel=require(_0xbf6a('0xc'));var crypto=require(_0xbf6a('0xd'));var jsforce=require(_0xbf6a('0xe'));var deskjs=require(_0xbf6a('0xf'));var toCsv=require(_0xbf6a('0x8'));var querystring=require('querystring');var Papa=require(_0xbf6a('0x10'));var Redis=require(_0xbf6a('0x11'));var authService=require(_0xbf6a('0x12'));var qs=require(_0xbf6a('0x13'));var as=require(_0xbf6a('0x14'));var hardwareService=require(_0xbf6a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbf6a('0x16'));var licenseUtil=require(_0xbf6a('0x17'));var db=require(_0xbf6a('0x18'))['db'];function respondWithStatusCode(_0x373fdf,_0x1383c2){_0x1383c2=_0x1383c2||0xcc;return function(_0x4effa8){if(_0x4effa8){return _0x373fdf['sendStatus'](_0x1383c2);}return _0x373fdf[_0xbf6a('0x19')](_0x1383c2)['end']();};}function respondWithResult(_0x2672bf,_0x11d1e8){_0x11d1e8=_0x11d1e8||0xc8;return function(_0x579187){if(_0x579187){return _0x2672bf[_0xbf6a('0x19')](_0x11d1e8)[_0xbf6a('0x1a')](_0x579187);}};}function respondWithFilteredResult(_0x52a655,_0x156c84){return function(_0x1a76f7){if(_0x1a76f7){var _0x56ad2=typeof _0x156c84['offset']==='undefined'&&typeof _0x156c84[_0xbf6a('0x1b')]==='undefined';var _0x73c15=_0x1a76f7[_0xbf6a('0x1c')];var _0x37c858=_0x56ad2?0x0:_0x156c84['offset'];var _0x136cac=_0x56ad2?_0x1a76f7[_0xbf6a('0x1c')]:_0x156c84[_0xbf6a('0x1d')]+_0x156c84['limit'];var _0x2fe2ec;if(_0x136cac>=_0x73c15){_0x136cac=_0x73c15;_0x2fe2ec=0xc8;}else{_0x2fe2ec=0xce;}_0x52a655[_0xbf6a('0x19')](_0x2fe2ec);return _0x52a655['set'](_0xbf6a('0x1e'),_0x37c858+'-'+_0x136cac+'/'+_0x73c15)[_0xbf6a('0x1a')](_0x1a76f7);}return null;};}function patchUpdates(_0x4561ab){return function(_0x5af3ba){try{jsonpatch['apply'](_0x5af3ba,_0x4561ab,!![]);}catch(_0x245c82){return BPromise[_0xbf6a('0x1f')](_0x245c82);}return _0x5af3ba[_0xbf6a('0x20')]();};}function saveUpdates(_0x54a14e,_0x5871b6){return function(_0x26b69a){if(_0x26b69a){return _0x26b69a[_0xbf6a('0x21')](_0x54a14e)[_0xbf6a('0x22')](function(_0xf3a8f1){return _0xf3a8f1;});}return null;};}function removeEntity(_0x35a983,_0x595d15){return function(_0x4a47cd){if(_0x4a47cd){return _0x4a47cd[_0xbf6a('0x23')]()[_0xbf6a('0x22')](function(){_0x35a983[_0xbf6a('0x19')](0xcc)[_0xbf6a('0x24')]();});}};}function handleEntityNotFound(_0x4b5f9b,_0x4c6e80){return function(_0x573b33){if(!_0x573b33){_0x4b5f9b[_0xbf6a('0x25')](0x194);}return _0x573b33;};}function handleError(_0x1e0bf2,_0xcaf5d9){_0xcaf5d9=_0xcaf5d9||0x1f4;return function(_0xda4622){logger[_0xbf6a('0x26')](_0xda4622[_0xbf6a('0x27')]);if(_0xda4622[_0xbf6a('0x28')]){delete _0xda4622[_0xbf6a('0x28')];}_0x1e0bf2['status'](_0xcaf5d9)[_0xbf6a('0x29')](_0xda4622);};}exports['index']=function(_0x3132ff,_0x172f7c){var _0x17938f={},_0x108e95={},_0x58595f={'count':0x0,'rows':[]};var _0x51c2f9=_[_0xbf6a('0x2a')](db[_0xbf6a('0x2b')][_0xbf6a('0x2c')],function(_0x57e5aa){return{'name':_0x57e5aa[_0xbf6a('0x2d')],'type':_0x57e5aa[_0xbf6a('0x2e')][_0xbf6a('0x2f')]};});_0x108e95[_0xbf6a('0x30')]=_[_0xbf6a('0x2a')](_0x51c2f9,_0xbf6a('0x28'));_0x108e95[_0xbf6a('0x31')]=_[_0xbf6a('0x32')](_0x3132ff['query']);_0x108e95[_0xbf6a('0x33')]=_[_0xbf6a('0x34')](_0x108e95[_0xbf6a('0x30')],_0x108e95[_0xbf6a('0x31')]);_0x17938f[_0xbf6a('0x35')]=_[_0xbf6a('0x34')](_0x108e95[_0xbf6a('0x30')],qs['fields'](_0x3132ff['query']['fields']));_0x17938f[_0xbf6a('0x35')]=_0x17938f[_0xbf6a('0x35')][_0xbf6a('0x36')]?_0x17938f['attributes']:_0x108e95['model'];if(!_0x3132ff['query'][_0xbf6a('0x37')]('nolimit')){_0x17938f['limit']=qs['limit'](_0x3132ff['query'][_0xbf6a('0x1b')]);_0x17938f[_0xbf6a('0x1d')]=qs[_0xbf6a('0x1d')](_0x3132ff[_0xbf6a('0x31')][_0xbf6a('0x1d')]);}_0x17938f['order']=qs[_0xbf6a('0x38')](_0x3132ff[_0xbf6a('0x31')]['sort']);_0x17938f[_0xbf6a('0x39')]=qs['filters'](_[_0xbf6a('0x3a')](_0x3132ff[_0xbf6a('0x31')],_0x108e95[_0xbf6a('0x33')]),_0x51c2f9);if(_0x3132ff[_0xbf6a('0x31')][_0xbf6a('0x3b')]){_0x17938f[_0xbf6a('0x39')]=_[_0xbf6a('0x3c')](_0x17938f[_0xbf6a('0x39')],{'$or':_[_0xbf6a('0x2a')](_0x51c2f9,function(_0x22c702){if(_0x22c702[_0xbf6a('0x2e')]!=='VIRTUAL'){var _0x1b1ae5={};_0x1b1ae5[_0x22c702[_0xbf6a('0x28')]]={'$like':'%'+_0x3132ff['query'][_0xbf6a('0x3b')]+'%'};return _0x1b1ae5;}})});}_0x17938f=_['merge']({},_0x17938f,_0x3132ff[_0xbf6a('0x3d')]);var _0x21e71f={'where':_0x17938f[_0xbf6a('0x39')]};return db[_0xbf6a('0x2b')]['count'](_0x21e71f)['then'](function(_0x4bbc1b){_0x58595f[_0xbf6a('0x1c')]=_0x4bbc1b;if(_0x3132ff[_0xbf6a('0x31')][_0xbf6a('0x3e')]){_0x17938f[_0xbf6a('0x3f')]=[{'all':!![]}];}return db[_0xbf6a('0x2b')][_0xbf6a('0x40')](_0x17938f);})[_0xbf6a('0x22')](function(_0xa672e9){_0x58595f[_0xbf6a('0x41')]=_0xa672e9;return _0x58595f;})['then'](respondWithFilteredResult(_0x172f7c,_0x17938f))[_0xbf6a('0x42')](handleError(_0x172f7c,null));};exports[_0xbf6a('0x43')]=function(_0x63d359,_0x1d6371){var _0x3b69ff={'raw':!![],'where':{'id':_0x63d359['params']['id']}},_0x4ecfae={};_0x4ecfae[_0xbf6a('0x30')]=_['keys'](db[_0xbf6a('0x2b')]['rawAttributes']);_0x4ecfae['query']=_['keys'](_0x63d359[_0xbf6a('0x31')]);_0x4ecfae['filters']=_[_0xbf6a('0x34')](_0x4ecfae[_0xbf6a('0x30')],_0x4ecfae[_0xbf6a('0x31')]);_0x3b69ff[_0xbf6a('0x35')]=_[_0xbf6a('0x34')](_0x4ecfae[_0xbf6a('0x30')],qs[_0xbf6a('0x44')](_0x63d359['query'][_0xbf6a('0x44')]));_0x3b69ff[_0xbf6a('0x35')]=_0x3b69ff['attributes']['length']?_0x3b69ff[_0xbf6a('0x35')]:_0x4ecfae[_0xbf6a('0x30')];if(_0x63d359[_0xbf6a('0x31')]['includeAll']){_0x3b69ff['include']=[{'all':!![]}];}_0x3b69ff=_[_0xbf6a('0x3c')]({},_0x3b69ff,_0x63d359[_0xbf6a('0x3d')]);return db[_0xbf6a('0x2b')][_0xbf6a('0x45')](_0x3b69ff)[_0xbf6a('0x22')](handleEntityNotFound(_0x1d6371,null))['then'](respondWithResult(_0x1d6371,null))[_0xbf6a('0x42')](handleError(_0x1d6371,null));};exports[_0xbf6a('0x46')]=function(_0x355a47,_0x5eba80){return db['VoiceTransferReport']['create'](_0x355a47['body'],{})['then'](respondWithResult(_0x5eba80,0xc9))[_0xbf6a('0x42')](handleError(_0x5eba80,null));};exports['update']=function(_0x4c2746,_0x2b11e2){if(_0x4c2746[_0xbf6a('0x47')]['id']){delete _0x4c2746[_0xbf6a('0x47')]['id'];}return db[_0xbf6a('0x2b')]['find']({'where':{'id':_0x4c2746[_0xbf6a('0x48')]['id']}})[_0xbf6a('0x22')](handleEntityNotFound(_0x2b11e2,null))[_0xbf6a('0x22')](saveUpdates(_0x4c2746['body'],null))['then'](respondWithResult(_0x2b11e2,null))['catch'](handleError(_0x2b11e2,null));};exports[_0xbf6a('0x23')]=function(_0x5bb7e2,_0x1dfe8b){return db[_0xbf6a('0x2b')]['find']({'where':{'id':_0x5bb7e2['params']['id']}})[_0xbf6a('0x22')](handleEntityNotFound(_0x1dfe8b,null))['then'](removeEntity(_0x1dfe8b,null))[_0xbf6a('0x42')](handleError(_0x1dfe8b,null));};exports[_0xbf6a('0x49')]=function(_0x4ba066,_0x358722){return db[_0xbf6a('0x2b')]['describe']()['then'](respondWithResult(_0x358722,null))['catch'](handleError(_0x358722,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f236cc8..389d72a 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 _0x4582=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_call_transfer','util','../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4582,0xa3));var _0x2458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4582[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2458('0x0'));var logger=require(_0x2458('0x1'))(_0x2458('0x2'));var moment=require('moment');var BPromise=require(_0x2458('0x3'));var rp=require(_0x2458('0x4'));var fs=require('fs');var path=require(_0x2458('0x5'));var rimraf=require(_0x2458('0x6'));var config=require(_0x2458('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x2458('0x8')]=function(_0x244780,_0x26d0dd){return _0x244780[_0x2458('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x2458('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31ea=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0x31ea,0xa2));var _0xa31e=function(_0x378d15,_0xfde478){_0x378d15=_0x378d15-0x0;var _0x4a2ae2=_0x31ea[_0x378d15];return _0x4a2ae2;};'use strict';var _=require('lodash');var util=require(_0xa31e('0x0'));var logger=require(_0xa31e('0x1'))('api');var moment=require(_0xa31e('0x2'));var BPromise=require(_0xa31e('0x3'));var rp=require(_0xa31e('0x4'));var fs=require('fs');var path=require(_0xa31e('0x5'));var rimraf=require('rimraf');var config=require(_0xa31e('0x6'));var attributes=require(_0xa31e('0x7'));module['exports']=function(_0x33394c,_0x5c5176){return _0x33394c['define'](_0xa31e('0x8'),attributes,{'tableName':'report_call_transfer','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 d279ecc..4bca60c 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 _0x9cef=['body','options','raw','stringify','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateVoiceTransferReport','create'];(function(_0x25ed44,_0x53d5c7){var _0x573e59=function(_0x404048){while(--_0x404048){_0x25ed44['push'](_0x25ed44['shift']());}};_0x573e59(++_0x53d5c7);}(_0x9cef,0x1e0));var _0xf9ce=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x9cef[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xf9ce('0x0'));var util=require(_0xf9ce('0x1'));var moment=require('moment');var BPromise=require(_0xf9ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9ce('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9ce('0x4'))(_0xf9ce('0x5'));var config=require(_0xf9ce('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf9ce('0x7')][_0xf9ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32bab2,_0x2cfc85,_0x2d6441){return new BPromise(function(_0x2e6c57,_0x24fcd8){return client['request'](_0x32bab2,_0x2d6441)[_0xf9ce('0x9')](function(_0x5d0895){logger[_0xf9ce('0xa')](_0xf9ce('0xb'),_0x2cfc85,_0xf9ce('0xc'));logger[_0xf9ce('0xd')](_0xf9ce('0xe'),_0x2cfc85,_0xf9ce('0xc'),JSON['stringify'](_0x5d0895));if(_0x5d0895[_0xf9ce('0xf')]){if(_0x5d0895['error'][_0xf9ce('0x10')]===0x1f4){logger['error'](_0xf9ce('0xb'),_0x2cfc85,_0x5d0895[_0xf9ce('0xf')]['message']);return _0x24fcd8(_0x5d0895[_0xf9ce('0xf')][_0xf9ce('0x11')]);}logger[_0xf9ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2cfc85,_0x5d0895['error'][_0xf9ce('0x11')]);return _0x2e6c57(_0x5d0895['error']['message']);}else{logger['info'](_0xf9ce('0xb'),_0x2cfc85,_0xf9ce('0xc'));_0x2e6c57(_0x5d0895['result'][_0xf9ce('0x11')]);}})['catch'](function(_0x365552){logger[_0xf9ce('0xf')](_0xf9ce('0xb'),_0x2cfc85,_0x365552);_0x24fcd8(_0x365552);});});}exports[_0xf9ce('0x12')]=function(_0x46fcda){var _0x148d07=this;return new Promise(function(_0x5e0273,_0xd84ce2){return db['VoiceTransferReport'][_0xf9ce('0x13')](_0x46fcda[_0xf9ce('0x14')],{'raw':_0x46fcda[_0xf9ce('0x15')]?_0x46fcda['options'][_0xf9ce('0x16')]===undefined?!![]:![]:!![]})[_0xf9ce('0x9')](function(_0x464f90){logger[_0xf9ce('0xa')]('CreateVoiceTransferReport',_0x46fcda);logger['debug'](_0xf9ce('0x12'),_0x46fcda,JSON[_0xf9ce('0x17')](_0x464f90));_0x5e0273(_0x464f90);})[_0xf9ce('0x18')](function(_0x1061b6){logger['error']('CreateVoiceTransferReport',_0x1061b6[_0xf9ce('0x11')],_0x46fcda);_0xd84ce2(_0x148d07['error'](0x1f4,_0x1061b6[_0xf9ce('0x11')]));});});}; \ No newline at end of file +var _0x8e47=['then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','create','body','options','raw','CreateVoiceTransferReport','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x305b86,_0x5ad674){var _0xbca7a2=function(_0x17bdcc){while(--_0x17bdcc){_0x305b86['push'](_0x305b86['shift']());}};_0xbca7a2(++_0x5ad674);}(_0x8e47,0x170));var _0x78e4=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x8e47[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0x78e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x78e4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e4('0x2'))['db'];var utils=require(_0x78e4('0x3'));var logger=require(_0x78e4('0x4'))(_0x78e4('0x5'));var config=require(_0x78e4('0x6'));var jayson=require(_0x78e4('0x7'));var client=jayson[_0x78e4('0x8')][_0x78e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c917a,_0x62a281,_0x322714){return new BPromise(function(_0x36f708,_0x1c525f){return client['request'](_0x5c917a,_0x322714)[_0x78e4('0xa')](function(_0x53ac54){logger['info'](_0x78e4('0xb'),_0x62a281,_0x78e4('0xc'));logger[_0x78e4('0xd')](_0x78e4('0xe'),_0x62a281,_0x78e4('0xc'),JSON[_0x78e4('0xf')](_0x53ac54));if(_0x53ac54[_0x78e4('0x10')]){if(_0x53ac54['error'][_0x78e4('0x11')]===0x1f4){logger['error'](_0x78e4('0xb'),_0x62a281,_0x53ac54[_0x78e4('0x10')]['message']);return _0x1c525f(_0x53ac54['error']['message']);}logger[_0x78e4('0x10')](_0x78e4('0xb'),_0x62a281,_0x53ac54[_0x78e4('0x10')][_0x78e4('0x12')]);return _0x36f708(_0x53ac54['error'][_0x78e4('0x12')]);}else{logger[_0x78e4('0x13')](_0x78e4('0xb'),_0x62a281,_0x78e4('0xc'));_0x36f708(_0x53ac54[_0x78e4('0x14')]['message']);}})['catch'](function(_0xe1873f){logger['error'](_0x78e4('0xb'),_0x62a281,_0xe1873f);_0x1c525f(_0xe1873f);});});}exports['CreateVoiceTransferReport']=function(_0x138b5a){var _0x476bbc=this;return new Promise(function(_0x30044c,_0x36ef9c){return db['VoiceTransferReport'][_0x78e4('0x15')](_0x138b5a[_0x78e4('0x16')],{'raw':_0x138b5a[_0x78e4('0x17')]?_0x138b5a[_0x78e4('0x17')][_0x78e4('0x18')]===undefined?!![]:![]:!![]})[_0x78e4('0xa')](function(_0x2f1e73){logger['info'](_0x78e4('0x19'),_0x138b5a);logger[_0x78e4('0xd')](_0x78e4('0x19'),_0x138b5a,JSON[_0x78e4('0xf')](_0x2f1e73));_0x30044c(_0x2f1e73);})[_0x78e4('0x1a')](function(_0x4666a0){logger[_0x78e4('0x10')](_0x78e4('0x19'),_0x4666a0[_0x78e4('0x12')],_0x138b5a);_0x36ef9c(_0x476bbc[_0x78e4('0x10')](0x1f4,_0x4666a0[_0x78e4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 2c35089..5ec3bde 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(_0x3df9ba,_0x47ed64){var _0x1b7e69=function(_0x477282){while(--_0x477282){_0x3df9ba['push'](_0x3df9ba['shift']());}};_0x1b7e69(++_0x47ed64);}(_0xedd9,0xfc));var _0x9edd=function(_0x4126a7,_0x2e844a){_0x4126a7=_0x4126a7-0x0;var _0x58fd57=_0xedd9[_0x4126a7];return _0x58fd57;};'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 _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x5d4eb3,_0x45660d){var _0x4abaa1=function(_0x4e2c5c){while(--_0x4e2c5c){_0x5d4eb3['push'](_0x5d4eb3['shift']());}};_0x4abaa1(++_0x45660d);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a4665,_0x15e8bf){_0x4a4665=_0x4a4665-0x0;var _0x5258ff=_0xedd9[_0x4a4665];return _0x5258ff;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1cbe0c9..9af772a 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 _0x9a19=['defaults','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','status','send','NotFound','then','message','result','catch','agent','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','userId','callNumber','callerId','entityFound:','format','user:%s','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis'];(function(_0x290452,_0x3ace5e){var _0x540db4=function(_0x340164){while(--_0x340164){_0x290452['push'](_0x290452['shift']());}};_0x540db4(++_0x3ace5e);}(_0x9a19,0x114));var _0x99a1=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x9a19[_0x1b5aea];return _0x51cae9;};'use strict';var path=require(_0x99a1('0x0'));var fs=require('fs');var _=require(_0x99a1('0x1'));var db=require(_0x99a1('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var jayson=require(_0x99a1('0x5'));var amiClient=jayson[_0x99a1('0x6')][_0x99a1('0x7')]({'port':0x232a});var logger=require(_0x99a1('0x8'))(_0x99a1('0x9'));var Redis=require(_0x99a1('0xa'));config[_0x99a1('0xb')]=_[_0x99a1('0xc')](config[_0x99a1('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x99a1('0xd'));var originateValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x99a1('0xf')]},'callerId':{'type':_0x99a1('0x10')},'callbackUrl':{'type':_0x99a1('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':[!![],_0x99a1('0x12')]},'transferNumber':{'type':_0x99a1('0x10'),'required':[!![],_0x99a1('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x99a1('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]}});function emit(_0x3d40cc,_0x384f05,_0x33e2c1){logger[_0x99a1('0x14')](_0x3d40cc,_0x384f05,JSON['stringify'](_0x33e2c1));io['to'](_0x3d40cc)['emit'](_0x384f05,_0x33e2c1);}function handleError(_0x6702d8){return function(_0xbf62f1){console[_0x99a1('0x15')](_0x99a1('0x16'),_0xbf62f1,_0xbf62f1 instanceof RangeError);logger[_0x99a1('0x17')](_0xbf62f1[_0x99a1('0x18')]);if(_0xbf62f1 instanceof RangeError){if(_0xbf62f1[_0x99a1('0x19')]){delete _0xbf62f1[_0x99a1('0x19')];}_0x6702d8[_0x99a1('0x1a')](0x194)[_0x99a1('0x1b')](_0xbf62f1);}else{if(_0xbf62f1[_0x99a1('0x19')]){delete _0xbf62f1['name'];}_0x6702d8[_0x99a1('0x1a')](0x1f4)[_0x99a1('0x1b')](_0xbf62f1);}};}function checkError(){return function(_0x5bed38){if(!_0x5bed38){throw new RangeError(_0x99a1('0x1c'));}return _0x5bed38;};}function respondWithRpcPromise(_0x53093d,_0x458ed3){return new BPromise(function(_0x2927b0,_0x2d6f20){var _0x2d3b82=amiClient;return _0x2d3b82['request'](_0x53093d,_0x458ed3)[_0x99a1('0x1d')](function(_0x1268a7){if(_0x1268a7['error']){if(_0x1268a7[_0x99a1('0x17')]['code']===0x1f4){return _0x2d6f20(_0x1268a7[_0x99a1('0x17')][_0x99a1('0x1e')]);}return _0x2927b0(_0x1268a7[_0x99a1('0x17')][_0x99a1('0x1e')]);}else{_0x2927b0(_0x1268a7[_0x99a1('0x1f')]);}})[_0x99a1('0x20')](function(_0x4fe7f7){_0x2d6f20(_0x4fe7f7);});});}function getAgent(_0x114b38){return db['User']['findOne']({'where':{'id':_0x114b38,'role':_0x99a1('0x21')}})[_0x99a1('0x1d')](checkError());}function getAgentCheckSession(_0xa6799b,_0x15a0b6){return new BPromise(function(_0x25d560,_0x309b93){var _0x183037=respondWithRpcPromise('VoiceChannels');var _0xf41b0d=getAgent(_0xa6799b);Promise['all']([_0x183037,_0xf41b0d])[_0x99a1('0x1d')](function(_0x1137f2){var _0x26fbae=_0x1137f2[0x0];var _0x523668=_0x1137f2[0x1];var _0x371edf=_[_0x99a1('0x22')](_0x26fbae['rows'],function(_0x37514e){return _0x37514e[_0x99a1('0x23')]==_0x523668['id']&&_0x37514e[_0x99a1('0x24')]==_0x15a0b6;});if(_0x371edf[_0x99a1('0x25')]==0x1){_0x25d560(_0x523668);}else{_0x309b93(new RangeError(_0x99a1('0x26')+_0x15a0b6+_0x99a1('0x27')));}});});}exports[_0x99a1('0x28')]=function(_0x26c23c,_0x52da8d){logger['info'](_0x99a1('0x29'),_0x26c23c['body']);var _0x38e383=originateValidation[_0x99a1('0xd')](_0x26c23c['body']);if(_0x38e383[_0x99a1('0x25')]>0x0){return _0x52da8d[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x38e383);}var _0x547ed3=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x3081cd=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2d')];var _0x432fbc=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2e')];var _0x215c18=_0x26c23c[_0x99a1('0x2b')]['callbackUrl'];return getAgent(_0x547ed3)['then'](function(_0x46e3f2){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x46e3f2[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')](_0x99a1('0x31'),_0x46e3f2[_0x99a1('0x19')]),'webbar:originate',{'callNumber':_0x3081cd,'callerId':_0x432fbc,'callbackUrl':_0x215c18});return _0x52da8d[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0x99a1('0x20')](handleError(_0x52da8d));};exports[_0x99a1('0x32')]=function(_0x391afa,_0x3cd1a0){logger[_0x99a1('0x14')](_0x99a1('0x33'),_0x391afa[_0x99a1('0x2b')]);var _0x2f8135=hangupValidation[_0x99a1('0xd')](_0x391afa[_0x99a1('0x2b')]);if(_0x2f8135[_0x99a1('0x25')]>0x0){return _0x3cd1a0[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x2f8135);}var _0x5018e9=_0x391afa['body']['userId'];var _0x29e884=_0x391afa[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x5018e9)[_0x99a1('0x1d')](function(_0x40613a){logger['info'](_0x99a1('0x2f'),_0x40613a[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x40613a['name']),_0x99a1('0x34'),{'sessionId':_0x29e884});return _0x3cd1a0[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0x99a1('0x20')](handleError(_0x3cd1a0));};exports[_0x99a1('0x35')]=function(_0x1b5d2d,_0x394762){logger[_0x99a1('0x14')](_0x99a1('0x36'),_0x1b5d2d[_0x99a1('0x2b')]);var _0x29d0a0=answerValidation[_0x99a1('0xd')](_0x1b5d2d[_0x99a1('0x2b')]);if(_0x29d0a0['length']>0x0){return _0x394762[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x29d0a0);}var _0x3d5373=_0x1b5d2d['body'][_0x99a1('0x2c')];var _0x51536d=_0x1b5d2d[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x3d5373)[_0x99a1('0x1d')](function(_0x3d7ec7){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x3d7ec7['name']);emit(util[_0x99a1('0x30')]('user:%s',_0x3d7ec7[_0x99a1('0x19')]),_0x99a1('0x37'),{'sessionId':_0x51536d});return _0x394762[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':_0x99a1('0x38')});})[_0x99a1('0x20')](handleError(_0x394762));};exports[_0x99a1('0x39')]=function(_0x3861b6,_0x61c259){logger[_0x99a1('0x14')](_0x99a1('0x3a'),_0x3861b6['body']);var _0x3c1f55=holdValidation[_0x99a1('0xd')](_0x3861b6['body']);if(_0x3c1f55[_0x99a1('0x25')]>0x0){return _0x61c259[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x3c1f55);}var _0x2e377b=_0x3861b6[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x2e3bef=_0x3861b6['body'][_0x99a1('0x24')];return getAgent(_0x2e377b)['then'](function(_0x1d4d3f){logger[_0x99a1('0x14')]('entityFound:',_0x1d4d3f['name']);emit(util[_0x99a1('0x30')](_0x99a1('0x31'),_0x1d4d3f[_0x99a1('0x19')]),_0x99a1('0x3b'),{'sessionId':_0x2e3bef});return _0x61c259[_0x99a1('0x1a')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x61c259));};exports[_0x99a1('0x3c')]=function(_0x4ae90e,_0x463e49){logger[_0x99a1('0x14')](_0x99a1('0x3d'),_0x4ae90e[_0x99a1('0x2b')]);var _0x1059b1=unholdValidation['validate'](_0x4ae90e[_0x99a1('0x2b')]);if(_0x1059b1[_0x99a1('0x25')]>0x0){return _0x463e49[_0x99a1('0x1a')](0x190)['json'](_0x1059b1);}var _0x81e218=_0x4ae90e['body']['userId'];var _0x1b9598=_0x4ae90e[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x81e218)[_0x99a1('0x1d')](function(_0x11632d){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x11632d[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x11632d[_0x99a1('0x19')]),'webbar:unhold',{'sessionId':_0x1b9598});return _0x463e49[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'unhold\x20executed!'});})[_0x99a1('0x20')](handleError(_0x463e49));};exports[_0x99a1('0x3e')]=function(_0x469e10,_0x2b2d63){logger[_0x99a1('0x14')](_0x99a1('0x3f'),_0x2b2d63[_0x99a1('0x2b')]);var _0x1a5658=callsValidation[_0x99a1('0xd')](_0x469e10[_0x99a1('0x2b')]);if(_0x1a5658[_0x99a1('0x25')]>0x0){return _0x2b2d63[_0x99a1('0x1a')](0x190)['json'](_0x1a5658);}var _0x4f64b7=_0x469e10[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x28caeb=respondWithRpcPromise(_0x99a1('0x40'));var _0x213719=getAgent(_0x4f64b7);return Promise['all']([_0x28caeb,_0x213719])[_0x99a1('0x1d')](function(_0x35f4a8){var _0x529f66=_0x35f4a8[0x0];var _0x6107cd=_0x35f4a8[0x1];var _0x95f20a=_[_0x99a1('0x22')](_0x529f66[_0x99a1('0x41')],function(_0x2b0e5f){return _0x2b0e5f['UserId']==_0x6107cd['id'];});return _0x2b2d63[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'count':_0x95f20a[_0x99a1('0x25')],'rows':_0x95f20a});})[_0x99a1('0x20')](handleError(_0x2b2d63));};exports[_0x99a1('0x42')]=function(_0x10289c,_0x59260e){logger[_0x99a1('0x14')](_0x99a1('0x43'),_0x10289c['body']);var _0x33feb9=conferenceValidation[_0x99a1('0xd')](_0x10289c[_0x99a1('0x2b')]);if(_0x33feb9[_0x99a1('0x25')]>0x0){return _0x59260e[_0x99a1('0x1a')](0x190)['json'](_0x33feb9);}var _0x52f450=_0x10289c['body']['userId'];return getAgent(_0x52f450)['then'](function(_0x38ce3c){logger[_0x99a1('0x14')]('entityFound:',_0x38ce3c['name']);emit(util[_0x99a1('0x30')]('user:%s',_0x38ce3c[_0x99a1('0x19')]),_0x99a1('0x44'));return _0x59260e[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x99a1('0x20')](handleError(_0x59260e));};exports[_0x99a1('0x45')]=function(_0x11b1c1,_0x4fbfb3){logger[_0x99a1('0x14')]('transfer\x20fired:',_0x11b1c1[_0x99a1('0x2b')]);var _0x186615=transferValidation[_0x99a1('0xd')](_0x11b1c1[_0x99a1('0x2b')]);if(_0x186615[_0x99a1('0x25')]>0x0){return _0x4fbfb3['status'](0x190)['json'](_0x186615);}var _0x4fc962=_0x11b1c1[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x4ad713=_0x11b1c1['body'][_0x99a1('0x24')];var _0x2f5587=_0x11b1c1[_0x99a1('0x2b')]['transferNumber'];return getAgent(_0x4fc962)['then'](function(_0x2b8df8){logger['info'](_0x99a1('0x2f'),_0x2b8df8[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x2b8df8[_0x99a1('0x19')]),_0x99a1('0x46'),{'sessionId':_0x4ad713,'transferNumber':_0x2f5587});return _0x4fbfb3['status'](0xc8)['json']({'error':![],'message':_0x99a1('0x47')});})['catch'](handleError(_0x4fbfb3));}; \ No newline at end of file +var _0xf021=['conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','../../config/logger','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','log','handleError:','stack','name','status','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','userId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','VoiceChannels'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xf021,0x18f));var _0x1f02=function(_0x1f0ded,_0x404ba6){_0x1f0ded=_0x1f0ded-0x0;var _0xc14076=_0xf021[_0x1f0ded];return _0xc14076;};'use strict';var path=require(_0x1f02('0x0'));var fs=require('fs');var _=require(_0x1f02('0x1'));var db=require(_0x1f02('0x2'))['db'];var config=require(_0x1f02('0x3'));var util=require(_0x1f02('0x4'));var BPromise=require('bluebird');var jayson=require(_0x1f02('0x5'));var amiClient=jayson['client'][_0x1f02('0x6')]({'port':0x232a});var logger=require(_0x1f02('0x7'))('webbarapi');var Redis=require('ioredis');config[_0x1f02('0x8')]=_['defaults'](config[_0x1f02('0x8')],{'host':_0x1f02('0x9'),'port':0x18eb});var io=require(_0x1f02('0xa'))(new Redis(config[_0x1f02('0x8')]));var Schema=require(_0x1f02('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1f02('0xc')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x1f02('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],_0x1f02('0xc')]},'sessionId':{'type':_0x1f02('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1f02('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],_0x1f02('0xc')]},'sessionId':{'type':'string','required':[!![],_0x1f02('0xf')]},'transferNumber':{'type':_0x1f02('0xd'),'required':[!![],_0x1f02('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],_0x1f02('0xc')]},'sessionId':{'type':_0x1f02('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],_0x1f02('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1f02('0xe'),'required':[!![],_0x1f02('0xc')]}});function emit(_0x3b0a3d,_0x4b76f7,_0x2e602d){logger['info'](_0x3b0a3d,_0x4b76f7,JSON['stringify'](_0x2e602d));io['to'](_0x3b0a3d)['emit'](_0x4b76f7,_0x2e602d);}function handleError(_0x5f4e55){return function(_0x4d1e4f){console[_0x1f02('0x11')](_0x1f02('0x12'),_0x4d1e4f,_0x4d1e4f instanceof RangeError);logger['error'](_0x4d1e4f[_0x1f02('0x13')]);if(_0x4d1e4f instanceof RangeError){if(_0x4d1e4f[_0x1f02('0x14')]){delete _0x4d1e4f[_0x1f02('0x14')];}_0x5f4e55[_0x1f02('0x15')](0x194)['send'](_0x4d1e4f);}else{if(_0x4d1e4f['name']){delete _0x4d1e4f[_0x1f02('0x14')];}_0x5f4e55[_0x1f02('0x15')](0x1f4)['send'](_0x4d1e4f);}};}function checkError(){return function(_0x5b399a){if(!_0x5b399a){throw new RangeError(_0x1f02('0x16'));}return _0x5b399a;};}function respondWithRpcPromise(_0xbdf82a,_0x2f637d){return new BPromise(function(_0xbabbd7,_0x480297){var _0x12c4af=amiClient;return _0x12c4af[_0x1f02('0x17')](_0xbdf82a,_0x2f637d)[_0x1f02('0x18')](function(_0x2f422c){if(_0x2f422c[_0x1f02('0x19')]){if(_0x2f422c[_0x1f02('0x19')][_0x1f02('0x1a')]===0x1f4){return _0x480297(_0x2f422c['error'][_0x1f02('0x1b')]);}return _0xbabbd7(_0x2f422c[_0x1f02('0x19')]['message']);}else{_0xbabbd7(_0x2f422c[_0x1f02('0x1c')]);}})[_0x1f02('0x1d')](function(_0x575a86){_0x480297(_0x575a86);});});}function getAgent(_0x57bb58){return db[_0x1f02('0x1e')][_0x1f02('0x1f')]({'where':{'id':_0x57bb58,'role':_0x1f02('0x20')}})[_0x1f02('0x18')](checkError());}function getAgentCheckSession(_0x3f5c5e,_0x3f5577){return new BPromise(function(_0x297cf4,_0x4c8891){var _0x4d5f7e=respondWithRpcPromise('VoiceChannels');var _0x3ef4bf=getAgent(_0x3f5c5e);Promise[_0x1f02('0x21')]([_0x4d5f7e,_0x3ef4bf])[_0x1f02('0x18')](function(_0x496afd){var _0x5c2c42=_0x496afd[0x0];var _0x227567=_0x496afd[0x1];var _0x6e88d5=_[_0x1f02('0x22')](_0x5c2c42[_0x1f02('0x23')],function(_0x220345){return _0x220345[_0x1f02('0x24')]==_0x227567['id']&&_0x220345[_0x1f02('0x25')]==_0x3f5577;});if(_0x6e88d5[_0x1f02('0x26')]==0x1){_0x297cf4(_0x227567);}else{_0x4c8891(new RangeError(_0x1f02('0x27')+_0x3f5577+_0x1f02('0x28')));}});});}exports['originate']=function(_0x137e06,_0x5ab7a2){logger[_0x1f02('0x29')](_0x1f02('0x2a'),_0x137e06[_0x1f02('0x2b')]);var _0x2bf78e=originateValidation[_0x1f02('0xb')](_0x137e06[_0x1f02('0x2b')]);if(_0x2bf78e['length']>0x0){return _0x5ab7a2['status'](0x190)[_0x1f02('0x2c')](_0x2bf78e);}var _0x15e655=_0x137e06['body'][_0x1f02('0x2d')];var _0x4d1aec=_0x137e06[_0x1f02('0x2b')]['callNumber'];var _0x3c473f=_0x137e06['body']['callerId'];var _0x26f33e=_0x137e06[_0x1f02('0x2b')][_0x1f02('0x2e')];return getAgent(_0x15e655)[_0x1f02('0x18')](function(_0x55c9a3){logger[_0x1f02('0x29')](_0x1f02('0x2f'),_0x55c9a3[_0x1f02('0x14')]);emit(util['format'](_0x1f02('0x30'),_0x55c9a3[_0x1f02('0x14')]),_0x1f02('0x31'),{'callNumber':_0x4d1aec,'callerId':_0x3c473f,'callbackUrl':_0x26f33e});return _0x5ab7a2[_0x1f02('0x15')](0xc8)[_0x1f02('0x2c')]({'error':![],'message':_0x1f02('0x32')});})['catch'](handleError(_0x5ab7a2));};exports[_0x1f02('0x33')]=function(_0x143e18,_0x1ad162){logger['info'](_0x1f02('0x34'),_0x143e18['body']);var _0x1e4fe5=hangupValidation['validate'](_0x143e18['body']);if(_0x1e4fe5[_0x1f02('0x26')]>0x0){return _0x1ad162['status'](0x190)['json'](_0x1e4fe5);}var _0x3ec5bd=_0x143e18[_0x1f02('0x2b')][_0x1f02('0x2d')];var _0x9b0e0=_0x143e18['body'][_0x1f02('0x25')];return getAgent(_0x3ec5bd)['then'](function(_0x2cd179){logger[_0x1f02('0x29')](_0x1f02('0x2f'),_0x2cd179[_0x1f02('0x14')]);emit(util[_0x1f02('0x35')](_0x1f02('0x30'),_0x2cd179[_0x1f02('0x14')]),_0x1f02('0x36'),{'sessionId':_0x9b0e0});return _0x1ad162[_0x1f02('0x15')](0xc8)['json']({'error':![],'message':_0x1f02('0x37')});})['catch'](handleError(_0x1ad162));};exports[_0x1f02('0x38')]=function(_0x544301,_0x3d895a){logger[_0x1f02('0x29')](_0x1f02('0x39'),_0x544301['body']);var _0x5938e1=answerValidation[_0x1f02('0xb')](_0x544301[_0x1f02('0x2b')]);if(_0x5938e1[_0x1f02('0x26')]>0x0){return _0x3d895a[_0x1f02('0x15')](0x190)[_0x1f02('0x2c')](_0x5938e1);}var _0x15fb49=_0x544301[_0x1f02('0x2b')][_0x1f02('0x2d')];var _0x391b57=_0x544301['body'][_0x1f02('0x25')];return getAgent(_0x15fb49)['then'](function(_0x51c8be){logger[_0x1f02('0x29')]('entityFound:',_0x51c8be['name']);emit(util[_0x1f02('0x35')]('user:%s',_0x51c8be['name']),_0x1f02('0x3a'),{'sessionId':_0x391b57});return _0x3d895a[_0x1f02('0x15')](0xc8)['json']({'error':![],'message':_0x1f02('0x3b')});})[_0x1f02('0x1d')](handleError(_0x3d895a));};exports[_0x1f02('0x3c')]=function(_0x3b1f5b,_0x5d45db){logger[_0x1f02('0x29')](_0x1f02('0x3d'),_0x3b1f5b[_0x1f02('0x2b')]);var _0x4d03ad=holdValidation[_0x1f02('0xb')](_0x3b1f5b[_0x1f02('0x2b')]);if(_0x4d03ad[_0x1f02('0x26')]>0x0){return _0x5d45db[_0x1f02('0x15')](0x190)[_0x1f02('0x2c')](_0x4d03ad);}var _0x282e5b=_0x3b1f5b[_0x1f02('0x2b')][_0x1f02('0x2d')];var _0x1abfaa=_0x3b1f5b[_0x1f02('0x2b')]['sessionId'];return getAgent(_0x282e5b)[_0x1f02('0x18')](function(_0x50d5ed){logger[_0x1f02('0x29')]('entityFound:',_0x50d5ed[_0x1f02('0x14')]);emit(util[_0x1f02('0x35')](_0x1f02('0x30'),_0x50d5ed[_0x1f02('0x14')]),_0x1f02('0x3e'),{'sessionId':_0x1abfaa});return _0x5d45db[_0x1f02('0x15')](0xc8)[_0x1f02('0x2c')]({'error':![],'message':_0x1f02('0x3f')});})[_0x1f02('0x1d')](handleError(_0x5d45db));};exports[_0x1f02('0x40')]=function(_0x1241c5,_0x5792d8){logger[_0x1f02('0x29')](_0x1f02('0x41'),_0x1241c5[_0x1f02('0x2b')]);var _0x102551=unholdValidation[_0x1f02('0xb')](_0x1241c5[_0x1f02('0x2b')]);if(_0x102551[_0x1f02('0x26')]>0x0){return _0x5792d8[_0x1f02('0x15')](0x190)[_0x1f02('0x2c')](_0x102551);}var _0x587d60=_0x1241c5[_0x1f02('0x2b')][_0x1f02('0x2d')];var _0x3e46c6=_0x1241c5[_0x1f02('0x2b')][_0x1f02('0x25')];return getAgent(_0x587d60)['then'](function(_0x12c1fb){logger['info'](_0x1f02('0x2f'),_0x12c1fb[_0x1f02('0x14')]);emit(util[_0x1f02('0x35')](_0x1f02('0x30'),_0x12c1fb[_0x1f02('0x14')]),_0x1f02('0x42'),{'sessionId':_0x3e46c6});return _0x5792d8[_0x1f02('0x15')](0xc8)[_0x1f02('0x2c')]({'error':![],'message':_0x1f02('0x43')});})[_0x1f02('0x1d')](handleError(_0x5792d8));};exports['calls']=function(_0x4a43eb,_0x4d084c){logger[_0x1f02('0x29')]('calls\x20fired:',_0x4d084c[_0x1f02('0x2b')]);var _0x449d58=callsValidation['validate'](_0x4a43eb[_0x1f02('0x2b')]);if(_0x449d58['length']>0x0){return _0x4d084c['status'](0x190)['json'](_0x449d58);}var _0x24192d=_0x4a43eb[_0x1f02('0x2b')][_0x1f02('0x2d')];var _0x390df6=respondWithRpcPromise(_0x1f02('0x44'));var _0x3321b3=getAgent(_0x24192d);return Promise['all']([_0x390df6,_0x3321b3])[_0x1f02('0x18')](function(_0xdd2e2b){var _0x496e3c=_0xdd2e2b[0x0];var _0x5c2745=_0xdd2e2b[0x1];var _0x2b0e0d=_[_0x1f02('0x22')](_0x496e3c[_0x1f02('0x23')],function(_0x47efdf){return _0x47efdf[_0x1f02('0x24')]==_0x5c2745['id'];});return _0x4d084c['status'](0xc8)[_0x1f02('0x2c')]({'count':_0x2b0e0d['length'],'rows':_0x2b0e0d});})[_0x1f02('0x1d')](handleError(_0x4d084c));};exports[_0x1f02('0x45')]=function(_0xd7be3b,_0x2b54ac){logger[_0x1f02('0x29')](_0x1f02('0x46'),_0xd7be3b[_0x1f02('0x2b')]);var _0x4ca1d9=conferenceValidation[_0x1f02('0xb')](_0xd7be3b[_0x1f02('0x2b')]);if(_0x4ca1d9[_0x1f02('0x26')]>0x0){return _0x2b54ac[_0x1f02('0x15')](0x190)[_0x1f02('0x2c')](_0x4ca1d9);}var _0x2e9881=_0xd7be3b[_0x1f02('0x2b')][_0x1f02('0x2d')];return getAgent(_0x2e9881)[_0x1f02('0x18')](function(_0x3a465f){logger[_0x1f02('0x29')](_0x1f02('0x2f'),_0x3a465f['name']);emit(util[_0x1f02('0x35')](_0x1f02('0x30'),_0x3a465f['name']),_0x1f02('0x47'));return _0x2b54ac[_0x1f02('0x15')](0xc8)['json']({'error':![],'message':_0x1f02('0x48')});})[_0x1f02('0x1d')](handleError(_0x2b54ac));};exports[_0x1f02('0x49')]=function(_0x4b3b3e,_0x4b8f28){logger[_0x1f02('0x29')](_0x1f02('0x4a'),_0x4b3b3e[_0x1f02('0x2b')]);var _0x3ce624=transferValidation[_0x1f02('0xb')](_0x4b3b3e[_0x1f02('0x2b')]);if(_0x3ce624[_0x1f02('0x26')]>0x0){return _0x4b8f28[_0x1f02('0x15')](0x190)[_0x1f02('0x2c')](_0x3ce624);}var _0x2ed1d7=_0x4b3b3e['body'][_0x1f02('0x2d')];var _0x5f054b=_0x4b3b3e['body'][_0x1f02('0x25')];var _0xe7dde7=_0x4b3b3e[_0x1f02('0x2b')][_0x1f02('0x4b')];return getAgent(_0x2ed1d7)[_0x1f02('0x18')](function(_0x6b73f5){logger[_0x1f02('0x29')](_0x1f02('0x2f'),_0x6b73f5[_0x1f02('0x14')]);emit(util[_0x1f02('0x35')](_0x1f02('0x30'),_0x6b73f5[_0x1f02('0x14')]),_0x1f02('0x4c'),{'sessionId':_0x5f054b,'transferNumber':_0xe7dde7});return _0x4b8f28['status'](0xc8)['json']({'error':![],'message':_0x1f02('0x4d')});})[_0x1f02('0x1d')](handleError(_0x4b8f28));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 57fa697..71b6cc4 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 _0xd820=['./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','show','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xd820,0x15f));var _0x0d82=function(_0x15891c,_0x19013f){_0x15891c=_0x15891c-0x0;var _0x578f6d=_0xd820[_0x15891c];return _0x578f6d;};'use strict';var multer=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var path=require(_0x0d82('0x2'));var timeout=require(_0x0d82('0x3'));var express=require(_0x0d82('0x4'));var router=express['Router']();var fs_extra=require(_0x0d82('0x5'));var auth=require(_0x0d82('0x6'));var interaction=require(_0x0d82('0x7'));var config=require(_0x0d82('0x8'));var controller=require(_0x0d82('0x9'));router['get']('/',auth[_0x0d82('0xa')](),controller[_0x0d82('0xb')]);router[_0x0d82('0xc')](_0x0d82('0xd'),auth[_0x0d82('0xa')](),controller[_0x0d82('0xe')]);router[_0x0d82('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x0d82('0xf')]);router[_0x0d82('0xc')]('/:id/dispositions',auth[_0x0d82('0xa')](),controller[_0x0d82('0x10')]);router['get']('/:id/canned_answers',auth[_0x0d82('0xa')](),controller[_0x0d82('0x11')]);router[_0x0d82('0xc')](_0x0d82('0x12'),auth['isAuthenticated'](),controller[_0x0d82('0x13')]);router[_0x0d82('0xc')](_0x0d82('0x14'),auth[_0x0d82('0xa')](),controller[_0x0d82('0x15')]);router[_0x0d82('0x16')]('/',auth['isAuthenticated'](),controller[_0x0d82('0x17')]);router[_0x0d82('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0d82('0x18')]);router[_0x0d82('0x16')](_0x0d82('0x19'),auth[_0x0d82('0xa')](),controller[_0x0d82('0x1a')]);router['post'](_0x0d82('0x12'),auth[_0x0d82('0xa')](),controller['addAgents']);router[_0x0d82('0x16')](_0x0d82('0x14'),auth[_0x0d82('0xa')](),controller['addApplications']);router[_0x0d82('0x16')]('/:id/notify',controller['notify']);router[_0x0d82('0x16')](_0x0d82('0x1b'),auth['isAuthenticated'](),controller[_0x0d82('0x1c')]);router[_0x0d82('0x1d')](_0x0d82('0x1e'),auth[_0x0d82('0xa')](),controller[_0x0d82('0x1f')]);router['delete'](_0x0d82('0x1e'),auth[_0x0d82('0xa')](),controller['destroy']);router[_0x0d82('0x20')]('/:id/dispositions',auth[_0x0d82('0xa')](),controller[_0x0d82('0x21')]);router[_0x0d82('0x20')]('/:id/canned_answers',auth[_0x0d82('0xa')](),controller[_0x0d82('0x22')]);router[_0x0d82('0x20')](_0x0d82('0x12'),auth[_0x0d82('0xa')](),controller[_0x0d82('0x23')]);module['exports']=router; \ No newline at end of file +var _0xcc51=['create','/:id/dispositions','addDisposition','addAnswer','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','update','delete','destroy','removeAnswers','/:id/users','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/canned_answers','getAgents','getApplications','post'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xcc51,0x14b));var _0x1cc5=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xcc51[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x1cc5('0x0'));var util=require('util');var path=require(_0x1cc5('0x1'));var timeout=require(_0x1cc5('0x2'));var express=require(_0x1cc5('0x3'));var router=express[_0x1cc5('0x4')]();var fs_extra=require(_0x1cc5('0x5'));var auth=require(_0x1cc5('0x6'));var interaction=require(_0x1cc5('0x7'));var config=require(_0x1cc5('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x1cc5('0x9')](),controller['index']);router[_0x1cc5('0xa')](_0x1cc5('0xb'),auth[_0x1cc5('0x9')](),controller[_0x1cc5('0xc')]);router[_0x1cc5('0xa')](_0x1cc5('0xd'),auth[_0x1cc5('0x9')](),controller[_0x1cc5('0xe')]);router[_0x1cc5('0xa')]('/:id/dispositions',auth[_0x1cc5('0x9')](),controller['getDispositions']);router[_0x1cc5('0xa')](_0x1cc5('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1cc5('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x1cc5('0x10')]);router[_0x1cc5('0xa')]('/:id/applications',auth[_0x1cc5('0x9')](),controller[_0x1cc5('0x11')]);router[_0x1cc5('0x12')]('/',auth[_0x1cc5('0x9')](),controller[_0x1cc5('0x13')]);router[_0x1cc5('0x12')](_0x1cc5('0x14'),auth[_0x1cc5('0x9')](),controller[_0x1cc5('0x15')]);router[_0x1cc5('0x12')](_0x1cc5('0xf'),auth['isAuthenticated'](),controller[_0x1cc5('0x16')]);router[_0x1cc5('0x12')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x1cc5('0x12')](_0x1cc5('0x17'),auth['isAuthenticated'](),controller[_0x1cc5('0x18')]);router[_0x1cc5('0x12')](_0x1cc5('0x19'),controller[_0x1cc5('0x1a')]);router['post'](_0x1cc5('0x1b'),auth[_0x1cc5('0x9')](),controller[_0x1cc5('0x1c')]);router['put'](_0x1cc5('0xd'),auth['isAuthenticated'](),controller[_0x1cc5('0x1d')]);router[_0x1cc5('0x1e')](_0x1cc5('0xd'),auth['isAuthenticated'](),controller[_0x1cc5('0x1f')]);router['delete'](_0x1cc5('0x14'),auth[_0x1cc5('0x9')](),controller['removeDispositions']);router[_0x1cc5('0x1e')](_0x1cc5('0xf'),auth[_0x1cc5('0x9')](),controller[_0x1cc5('0x20')]);router[_0x1cc5('0x1e')](_0x1cc5('0x21'),auth[_0x1cc5('0x9')](),controller['removeAgents']);module[_0x1cc5('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index be2adff..0685084 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 _0xac8d=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x38370c,_0x376aa5){var _0x5c3dca=function(_0x49c8f6){while(--_0x49c8f6){_0x38370c['push'](_0x38370c['shift']());}};_0x5c3dca(++_0x376aa5);}(_0xac8d,0x1d8));var _0xdac8=function(_0x713a11,_0xaf9fa5){_0x713a11=_0x713a11-0x0;var _0x1b3879=_0xac8d[_0x713a11];return _0x1b3879;};'use strict';var Sequelize=require(_0xdac8('0x0'));var rs=require(_0xdac8('0x1'));module[_0xdac8('0x2')]={'name':{'type':Sequelize[_0xdac8('0x3')],'unique':_0xdac8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xdac8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdac8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdac8('0x3')],'defaultValue':function(){return rs[_0xdac8('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdac8('0x6')](_0xdac8('0x7'),_0xdac8('0x8'))},'accountSid':{'type':Sequelize[_0xdac8('0x3')]},'baseUrl':{'type':Sequelize[_0xdac8('0x3')]},'authToken':{'type':Sequelize[_0xdac8('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdac8('0x9')],'defaultValue':function(){return _0xdac8('0xa');}},'notificationSound':{'type':Sequelize[_0xdac8('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdac8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdac8('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdac8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdac8('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdac8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdac8('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdac8('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bd152){if(!_0x3bd152){this[_0xdac8('0xd')](_0xdac8('0xe'),null);}this['setDataValue'](_0xdac8('0xf'),_0x3bd152);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfe45=['mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','sinch','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'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xfe45,0xe1));var _0x5fe4=function(_0x359936,_0x1fc5a9){_0x359936=_0x359936-0x0;var _0x38a0cb=_0xfe45[_0x359936];return _0x38a0cb;};'use strict';var Sequelize=require(_0x5fe4('0x0'));var rs=require('randomstring');module[_0x5fe4('0x1')]={'name':{'type':Sequelize[_0x5fe4('0x2')],'unique':_0x5fe4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5fe4('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5fe4('0x2')],'defaultValue':function(){return rs[_0x5fe4('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5fe4('0x5')]('twilio',_0x5fe4('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x5fe4('0x2')]},'authToken':{'type':Sequelize[_0x5fe4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5fe4('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5fe4('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5fe4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5fe4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5fe4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5fe4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5fe4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5fe4('0x9')],'comment':_0x5fe4('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5fe4('0x8')],'defaultValue':![],'comment':_0x5fe4('0xb'),'set':function(_0x50f530){if(!_0x50f530){this[_0x5fe4('0xc')]('mandatoryDispositionPauseId',null);}this[_0x5fe4('0xc')](_0x5fe4('0xd'),_0x50f530);}},'description':{'type':Sequelize[_0x5fe4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 52903c8..5db4cad 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 _0x22d7=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','find','params','describe','getDispositions','findOne','Disposition','rawAttributes','WhatsappAccountId','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','timestamp','message_id','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','replace','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','list','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','agent','*,*,*,*','queueId','WhatsappQueue','unshift','queue','waitForTheAssignedQueue','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','CmList','List','out','WhatsappMessage','dataValues','Messages','eml-format','zip-dir','fast-json-patch','moment','path','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','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x39c65b,_0x4b5a02){var _0x487fee=function(_0x5d3a6b){while(--_0x5d3a6b){_0x39c65b['push'](_0x39c65b['shift']());}};_0x487fee(++_0x4b5a02);}(_0x22d7,0x158));var _0x722d=function(_0xe83ac5,_0x279b67){_0xe83ac5=_0xe83ac5-0x0;var _0x3df16e=_0x22d7[_0xe83ac5];return _0x3df16e;};'use strict';var emlformat=require(_0x722d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x722d('0x1'));var jsonpatch=require(_0x722d('0x2'));var rp=require('request-promise');var moment=require(_0x722d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x722d('0x4'));var sox=require(_0x722d('0x5'));var csv=require(_0x722d('0x6'));var ejs=require(_0x722d('0x7'));var fs=require('fs');var fs_extra=require(_0x722d('0x8'));var _=require(_0x722d('0x9'));var squel=require(_0x722d('0xa'));var crypto=require(_0x722d('0xb'));var jsforce=require(_0x722d('0xc'));var deskjs=require(_0x722d('0xd'));var toCsv=require(_0x722d('0x6'));var querystring=require('querystring');var Papa=require(_0x722d('0xe'));var Redis=require(_0x722d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x722d('0x10'));var as=require(_0x722d('0x11'));var hardwareService=require(_0x722d('0x12'));var logger=require(_0x722d('0x13'))(_0x722d('0x14'));var utils=require(_0x722d('0x15'));var config=require(_0x722d('0x16'));var licenseUtil=require(_0x722d('0x17'));var db=require(_0x722d('0x18'))['db'];config[_0x722d('0x19')]=_[_0x722d('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x722d('0x1b'))(new Redis(config[_0x722d('0x19')]));require(_0x722d('0x1c'))['register'](socket);var jayson=require(_0x722d('0x1d'));var client=jayson[_0x722d('0x1e')][_0x722d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x370565,_0x24dae6,_0x284913,_0x584d7a){return new BPromise(function(_0x1cf494,_0x1ee2af){var _0x529765=_0x584d7a||client;return _0x529765[_0x722d('0x20')](_0x370565,_0x284913)[_0x722d('0x21')](function(_0x3479a5){logger['info'](_0x722d('0x22'),_0x24dae6,_0x722d('0x23'));logger[_0x722d('0x24')](_0x722d('0x25'),_0x24dae6,_0x722d('0x23'),JSON[_0x722d('0x26')](_0x3479a5));if(_0x3479a5[_0x722d('0x27')]){if(_0x3479a5[_0x722d('0x27')][_0x722d('0x28')]===0x1f4){logger[_0x722d('0x27')](_0x722d('0x22'),_0x24dae6,_0x3479a5[_0x722d('0x27')][_0x722d('0x29')]);return _0x1ee2af(_0x3479a5[_0x722d('0x27')][_0x722d('0x29')]);}logger[_0x722d('0x27')](_0x722d('0x22'),_0x24dae6,_0x3479a5[_0x722d('0x27')]['message']);return _0x1cf494(_0x3479a5[_0x722d('0x27')][_0x722d('0x29')]);}else{logger['info'](_0x722d('0x22'),_0x24dae6,_0x722d('0x23'));_0x1cf494(_0x3479a5[_0x722d('0x2a')]['message']);}})[_0x722d('0x2b')](function(_0x42c240){logger[_0x722d('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x24dae6,_0x42c240);_0x1ee2af(_0x42c240);});});}function respondWithStatusCode(_0x24e7d7,_0x1ca560){_0x1ca560=_0x1ca560||0xcc;return function(_0x5e0e97){if(_0x5e0e97){return _0x24e7d7[_0x722d('0x2c')](_0x1ca560);}return _0x24e7d7[_0x722d('0x2d')](_0x1ca560)['end']();};}function respondWithResult(_0xb26889,_0x47b007){_0x47b007=_0x47b007||0xc8;return function(_0x133e4b){if(_0x133e4b){return _0xb26889['status'](_0x47b007)[_0x722d('0x2e')](_0x133e4b);}};}function respondWithFilteredResult(_0x20cd53,_0x4244cd){return function(_0x2eacbd){if(_0x2eacbd){var _0x538e36=typeof _0x4244cd[_0x722d('0x2f')]===_0x722d('0x30')&&typeof _0x4244cd[_0x722d('0x31')]===_0x722d('0x30');var _0x24eb27=_0x2eacbd['count'];var _0x42d69f=_0x538e36?0x0:_0x4244cd[_0x722d('0x2f')];var _0x264464=_0x538e36?_0x2eacbd[_0x722d('0x32')]:_0x4244cd[_0x722d('0x2f')]+_0x4244cd['limit'];var _0x515cd1;if(_0x264464>=_0x24eb27){_0x264464=_0x24eb27;_0x515cd1=0xc8;}else{_0x515cd1=0xce;}_0x20cd53[_0x722d('0x2d')](_0x515cd1);return _0x20cd53[_0x722d('0x33')](_0x722d('0x34'),_0x42d69f+'-'+_0x264464+'/'+_0x24eb27)[_0x722d('0x2e')](_0x2eacbd);}return null;};}function patchUpdates(_0x562678){return function(_0x51faa3){try{jsonpatch[_0x722d('0x35')](_0x51faa3,_0x562678,!![]);}catch(_0x51d332){return BPromise['reject'](_0x51d332);}return _0x51faa3[_0x722d('0x36')]();};}function saveUpdates(_0x24c4c6,_0x2fb835){return function(_0x45f484){if(_0x45f484){return _0x45f484[_0x722d('0x37')](_0x24c4c6)[_0x722d('0x21')](function(_0x4a9829){return _0x4a9829;});}return null;};}function removeEntity(_0x3bffa3,_0x248074){return function(_0x4d8b68){if(_0x4d8b68){return _0x4d8b68[_0x722d('0x38')]()[_0x722d('0x21')](function(){var _0x38d1a0=_0x4d8b68[_0x722d('0x39')]({'plain':!![]});var _0x54bd44=_0x722d('0x3a');return db[_0x722d('0x3b')][_0x722d('0x38')]({'where':{'type':_0x54bd44,'resourceId':_0x38d1a0['id']}})[_0x722d('0x21')](function(){return _0x4d8b68;});})['then'](function(){_0x3bffa3[_0x722d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d10b1,_0x5831ab){return function(_0x5710da){if(!_0x5710da){_0x5d10b1[_0x722d('0x2c')](0x194);}return _0x5710da;};}function handleError(_0x3a40ec,_0x551b97){_0x551b97=_0x551b97||0x1f4;return function(_0x230556){logger[_0x722d('0x27')](_0x230556['stack']);if(_0x230556[_0x722d('0x3c')]){delete _0x230556[_0x722d('0x3c')];}_0x3a40ec[_0x722d('0x2d')](_0x551b97)[_0x722d('0x3d')](_0x230556);};}exports['index']=function(_0x3a1ed1,_0x5b2a28){var _0xee606d={'include':[{'model':db[_0x722d('0x3e')],'as':_0x722d('0x3f')}]},_0x5c086a={},_0x32758f={'count':0x0,'rows':[]};var _0xf4fb2b=_[_0x722d('0x40')](db[_0x722d('0x41')]['rawAttributes'],function(_0x81151e){return{'name':_0x81151e[_0x722d('0x42')],'type':_0x81151e[_0x722d('0x43')][_0x722d('0x44')]};});_0x5c086a[_0x722d('0x45')]=_[_0x722d('0x40')](_0xf4fb2b,_0x722d('0x3c'));_0x5c086a[_0x722d('0x46')]=_['keys'](_0x3a1ed1[_0x722d('0x46')]);_0x5c086a[_0x722d('0x47')]=_[_0x722d('0x48')](_0x5c086a[_0x722d('0x45')],_0x5c086a[_0x722d('0x46')]);_0xee606d[_0x722d('0x49')]=_[_0x722d('0x48')](_0x5c086a[_0x722d('0x45')],qs['fields'](_0x3a1ed1[_0x722d('0x46')][_0x722d('0x4a')]));_0xee606d[_0x722d('0x49')]=_0xee606d[_0x722d('0x49')][_0x722d('0x4b')]?_0xee606d[_0x722d('0x49')]:_0x5c086a[_0x722d('0x45')];if(!_0x3a1ed1[_0x722d('0x46')]['hasOwnProperty'](_0x722d('0x4c'))){_0xee606d[_0x722d('0x31')]=qs[_0x722d('0x31')](_0x3a1ed1[_0x722d('0x46')][_0x722d('0x31')]);_0xee606d['offset']=qs[_0x722d('0x2f')](_0x3a1ed1[_0x722d('0x46')][_0x722d('0x2f')]);}_0xee606d[_0x722d('0x4d')]=qs[_0x722d('0x4e')](_0x3a1ed1['query'][_0x722d('0x4e')]);_0xee606d['where']=qs[_0x722d('0x47')](_[_0x722d('0x4f')](_0x3a1ed1['query'],_0x5c086a[_0x722d('0x47')]),_0xf4fb2b);if(_0x3a1ed1[_0x722d('0x46')]['filter']){_0xee606d['where']=_['merge'](_0xee606d[_0x722d('0x50')],{'$or':_[_0x722d('0x40')](_0xf4fb2b,function(_0xf68f4d){if(_0xf68f4d[_0x722d('0x43')]!==_0x722d('0x51')){var _0x186ef1={};_0x186ef1[_0xf68f4d[_0x722d('0x3c')]]={'$like':'%'+_0x3a1ed1[_0x722d('0x46')][_0x722d('0x52')]+'%'};return _0x186ef1;}})});}_0xee606d=_['merge']({},_0xee606d,_0x3a1ed1[_0x722d('0x53')]);var _0x466daf={'where':_0xee606d[_0x722d('0x50')]};return db['WhatsappAccount']['count'](_0x466daf)[_0x722d('0x21')](function(_0x544617){_0x32758f[_0x722d('0x32')]=_0x544617;if(_0x3a1ed1[_0x722d('0x46')][_0x722d('0x54')]){_0xee606d[_0x722d('0x55')]=[{'all':!![]}];}return db[_0x722d('0x41')][_0x722d('0x56')](_0xee606d);})[_0x722d('0x21')](function(_0x132312){_0x32758f[_0x722d('0x57')]=_0x132312;return _0x32758f;})['then'](respondWithFilteredResult(_0x5b2a28,_0xee606d))[_0x722d('0x2b')](handleError(_0x5b2a28,null));};exports[_0x722d('0x58')]=function(_0xe3f124,_0x2573f8){var _0x122b72={'raw':![],'where':{'id':_0xe3f124['params']['id']},'include':[{'model':db['Pause'],'as':_0x722d('0x3f')}]},_0x2bf60e={};_0x2bf60e[_0x722d('0x45')]=_[_0x722d('0x59')](db[_0x722d('0x41')]['rawAttributes']);_0x2bf60e[_0x722d('0x46')]=_[_0x722d('0x59')](_0xe3f124[_0x722d('0x46')]);_0x2bf60e[_0x722d('0x47')]=_[_0x722d('0x48')](_0x2bf60e[_0x722d('0x45')],_0x2bf60e[_0x722d('0x46')]);_0x122b72['attributes']=_['intersection'](_0x2bf60e[_0x722d('0x45')],qs[_0x722d('0x4a')](_0xe3f124['query'][_0x722d('0x4a')]));_0x122b72[_0x722d('0x49')]=_0x122b72[_0x722d('0x49')][_0x722d('0x4b')]?_0x122b72[_0x722d('0x49')]:_0x2bf60e[_0x722d('0x45')];if(_0xe3f124[_0x722d('0x46')]['includeAll']){_0x122b72[_0x722d('0x55')]=[{'all':!![]}];}_0x122b72=_[_0x722d('0x5a')]({},_0x122b72,_0xe3f124[_0x722d('0x53')]);return db[_0x722d('0x41')]['find'](_0x122b72)[_0x722d('0x21')](handleEntityNotFound(_0x2573f8,null))['then'](respondWithResult(_0x2573f8,null))[_0x722d('0x2b')](handleError(_0x2573f8,null));};exports[_0x722d('0x5b')]=function(_0x36f8dd,_0x544d62){return db[_0x722d('0x41')][_0x722d('0x5b')](_0x36f8dd['body'],{})[_0x722d('0x21')](function(_0x1bc9fc){var _0x4453af=_0x36f8dd[_0x722d('0x5c')][_0x722d('0x39')]({'plain':!![]});if(!_0x4453af)throw new Error(_0x722d('0x5d'));if(_0x4453af[_0x722d('0x5e')]==='user'){var _0x37d15a=_0x1bc9fc['get']({'plain':!![]});var _0x5a9032='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x5a9032,'userProfileId':_0x4453af['userProfileId']},'raw':!![]})[_0x722d('0x21')](function(_0xf0547f){if(_0xf0547f&&_0xf0547f[_0x722d('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x37d15a[_0x722d('0x3c')],'resourceId':_0x37d15a['id'],'type':_0xf0547f[_0x722d('0x3c')],'sectionId':_0xf0547f['id']},{})[_0x722d('0x21')](function(){return _0x1bc9fc;});}else{return _0x1bc9fc;}})[_0x722d('0x2b')](function(_0x42f1d5){logger[_0x722d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f1d5);throw _0x42f1d5;});}return _0x1bc9fc;})[_0x722d('0x21')](respondWithResult(_0x544d62,0xc9))[_0x722d('0x2b')](handleError(_0x544d62,null));};exports[_0x722d('0x37')]=function(_0x4d2649,_0x2fa032){if(_0x4d2649[_0x722d('0x60')]['id']){delete _0x4d2649[_0x722d('0x60')]['id'];}return db['WhatsappAccount'][_0x722d('0x61')]({'where':{'id':_0x4d2649[_0x722d('0x62')]['id']},'include':[{'model':db[_0x722d('0x3e')],'as':_0x722d('0x3f')}]})[_0x722d('0x21')](handleEntityNotFound(_0x2fa032,null))[_0x722d('0x21')](saveUpdates(_0x4d2649[_0x722d('0x60')],null))['then'](respondWithResult(_0x2fa032,null))['catch'](handleError(_0x2fa032,null));};exports[_0x722d('0x38')]=function(_0x2d3343,_0x38dd51){return db['WhatsappAccount'][_0x722d('0x61')]({'where':{'id':_0x2d3343[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x38dd51,null))[_0x722d('0x21')](removeEntity(_0x38dd51,null))['catch'](handleError(_0x38dd51,null));};exports['describe']=function(_0x53ec13,_0x5eb2f1){return db[_0x722d('0x41')][_0x722d('0x63')]()[_0x722d('0x21')](respondWithResult(_0x5eb2f1,null))[_0x722d('0x2b')](handleError(_0x5eb2f1,null));};exports['addDisposition']=function(_0xfa1e8b,_0xfe2af5,_0x3d2e37){if(_0xfa1e8b[_0x722d('0x60')]['id']){delete _0xfa1e8b[_0x722d('0x60')]['id'];}return db[_0x722d('0x41')]['find']({'where':{'id':_0xfa1e8b[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0xfe2af5,null))[_0x722d('0x21')](function(_0x203127){if(_0x203127){_0xfa1e8b['body']['WhatsappAccountId']=_0x203127['id'];return db['Disposition'][_0x722d('0x5b')](_0xfa1e8b[_0x722d('0x60')]);}})[_0x722d('0x21')](respondWithResult(_0xfe2af5,null))['catch'](handleError(_0xfe2af5,null));};exports[_0x722d('0x64')]=function(_0x4ad112,_0x3cc590,_0x13db94){var _0x1dcb37={'raw':![],'where':{}};var _0x5893bb={};var _0x2d5280={'count':0x0,'rows':[]};return db[_0x722d('0x41')][_0x722d('0x65')]({'where':{'id':_0x4ad112[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x3cc590,null))[_0x722d('0x21')](function(_0x518a40){if(_0x518a40){_0x5893bb[_0x722d('0x45')]=_['keys'](db[_0x722d('0x66')][_0x722d('0x67')]);_0x5893bb[_0x722d('0x46')]=_[_0x722d('0x59')](_0x4ad112[_0x722d('0x46')]);_0x5893bb[_0x722d('0x47')]=_[_0x722d('0x48')](_0x5893bb[_0x722d('0x45')],_0x5893bb['query']);_0x1dcb37[_0x722d('0x49')]=_[_0x722d('0x48')](_0x5893bb[_0x722d('0x45')],qs['fields'](_0x4ad112[_0x722d('0x46')][_0x722d('0x4a')]));_0x1dcb37['attributes']=_0x1dcb37[_0x722d('0x49')][_0x722d('0x4b')]?_0x1dcb37[_0x722d('0x49')]:_0x5893bb[_0x722d('0x45')];if(!_0x4ad112[_0x722d('0x46')]['hasOwnProperty'](_0x722d('0x4c'))){_0x1dcb37[_0x722d('0x31')]=qs[_0x722d('0x31')](_0x4ad112[_0x722d('0x46')][_0x722d('0x31')]);_0x1dcb37[_0x722d('0x2f')]=qs[_0x722d('0x2f')](_0x4ad112[_0x722d('0x46')][_0x722d('0x2f')]);}_0x1dcb37[_0x722d('0x4d')]=qs['sort'](_0x4ad112['query'][_0x722d('0x4e')]);_0x1dcb37[_0x722d('0x50')]=qs[_0x722d('0x47')](_[_0x722d('0x4f')](_0x4ad112[_0x722d('0x46')],_0x5893bb[_0x722d('0x47')]));_0x1dcb37['where'][_0x722d('0x68')]=_0x518a40['id'];if(_0x4ad112[_0x722d('0x46')][_0x722d('0x52')]){_0x1dcb37[_0x722d('0x50')]=_[_0x722d('0x5a')](_0x1dcb37['where'],{'$or':_[_0x722d('0x40')](_0x1dcb37['attributes'],function(_0x1ed392){var _0x252b17={};_0x252b17[_0x1ed392]={'$like':'%'+_0x4ad112['query'][_0x722d('0x52')]+'%'};return _0x252b17;})});}_0x1dcb37=_[_0x722d('0x5a')]({},_0x1dcb37,_0x4ad112[_0x722d('0x53')]);return db[_0x722d('0x66')]['count']({'where':_0x1dcb37[_0x722d('0x50')]})[_0x722d('0x21')](function(_0x3d8d22){_0x2d5280[_0x722d('0x32')]=_0x3d8d22;if(_0x4ad112[_0x722d('0x46')]['includeAll']){_0x1dcb37[_0x722d('0x55')]=[{'all':!![]}];}return db[_0x722d('0x66')]['findAll'](_0x1dcb37);})['then'](function(_0xc015a4){_0x2d5280['rows']=_0xc015a4;return _0x2d5280;});}})['then'](respondWithFilteredResult(_0x3cc590,_0x1dcb37))[_0x722d('0x2b')](handleError(_0x3cc590,null));};exports[_0x722d('0x69')]=function(_0x1a25dd,_0x510b74,_0xf5d84b){return db[_0x722d('0x41')][_0x722d('0x61')]({'where':{'id':_0x1a25dd[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x510b74,null))[_0x722d('0x21')](function(_0x28156c){if(_0x28156c){return _0x28156c[_0x722d('0x69')](_0x1a25dd['query'][_0x722d('0x6a')]);}})['then'](respondWithStatusCode(_0x510b74,null))[_0x722d('0x2b')](handleError(_0x510b74,null));};exports['addAnswer']=function(_0x4763c5,_0x482ee3,_0x360bcc){if(_0x4763c5[_0x722d('0x60')]['id']){delete _0x4763c5['body']['id'];}return db[_0x722d('0x41')][_0x722d('0x61')]({'where':{'id':_0x4763c5[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x482ee3,null))['then'](function(_0x57f146){if(_0x57f146){_0x4763c5[_0x722d('0x60')][_0x722d('0x68')]=_0x57f146['id'];return db[_0x722d('0x6b')][_0x722d('0x5b')](_0x4763c5[_0x722d('0x60')]);}})['then'](respondWithResult(_0x482ee3,null))[_0x722d('0x2b')](handleError(_0x482ee3,null));};exports[_0x722d('0x6c')]=function(_0x3ab9cf,_0xeefd22,_0x453ccd){var _0x11cf7d={'raw':![],'where':{}};var _0x51990d={};var _0x5ea67d={'count':0x0,'rows':[]};return db[_0x722d('0x41')][_0x722d('0x65')]({'where':{'id':_0x3ab9cf[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0xeefd22,null))[_0x722d('0x21')](function(_0x4d8557){if(_0x4d8557){_0x51990d[_0x722d('0x45')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x51990d[_0x722d('0x46')]=_[_0x722d('0x59')](_0x3ab9cf[_0x722d('0x46')]);_0x51990d['filters']=_[_0x722d('0x48')](_0x51990d['model'],_0x51990d[_0x722d('0x46')]);_0x11cf7d[_0x722d('0x49')]=_[_0x722d('0x48')](_0x51990d['model'],qs[_0x722d('0x4a')](_0x3ab9cf['query'][_0x722d('0x4a')]));_0x11cf7d[_0x722d('0x49')]=_0x11cf7d[_0x722d('0x49')][_0x722d('0x4b')]?_0x11cf7d[_0x722d('0x49')]:_0x51990d[_0x722d('0x45')];if(!_0x3ab9cf[_0x722d('0x46')][_0x722d('0x6d')](_0x722d('0x4c'))){_0x11cf7d[_0x722d('0x31')]=qs[_0x722d('0x31')](_0x3ab9cf[_0x722d('0x46')][_0x722d('0x31')]);_0x11cf7d[_0x722d('0x2f')]=qs[_0x722d('0x2f')](_0x3ab9cf[_0x722d('0x46')][_0x722d('0x2f')]);}_0x11cf7d[_0x722d('0x4d')]=qs[_0x722d('0x4e')](_0x3ab9cf[_0x722d('0x46')][_0x722d('0x4e')]);_0x11cf7d[_0x722d('0x50')]=qs[_0x722d('0x47')](_[_0x722d('0x4f')](_0x3ab9cf[_0x722d('0x46')],_0x51990d[_0x722d('0x47')]));_0x11cf7d[_0x722d('0x50')]['WhatsappAccountId']=_0x4d8557['id'];if(_0x3ab9cf[_0x722d('0x46')][_0x722d('0x52')]){_0x11cf7d['where']=_['merge'](_0x11cf7d[_0x722d('0x50')],{'$or':_[_0x722d('0x40')](_0x11cf7d[_0x722d('0x49')],function(_0x13a49f){var _0x410458={};_0x410458[_0x13a49f]={'$like':'%'+_0x3ab9cf[_0x722d('0x46')][_0x722d('0x52')]+'%'};return _0x410458;})});}_0x11cf7d=_[_0x722d('0x5a')]({},_0x11cf7d,_0x3ab9cf[_0x722d('0x53')]);return db[_0x722d('0x6b')][_0x722d('0x32')]({'where':_0x11cf7d[_0x722d('0x50')]})[_0x722d('0x21')](function(_0x47ce06){_0x5ea67d['count']=_0x47ce06;if(_0x3ab9cf[_0x722d('0x46')]['includeAll']){_0x11cf7d[_0x722d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x722d('0x56')](_0x11cf7d);})[_0x722d('0x21')](function(_0x5cb7d0){_0x5ea67d[_0x722d('0x57')]=_0x5cb7d0;return _0x5ea67d;});}})[_0x722d('0x21')](respondWithFilteredResult(_0xeefd22,_0x11cf7d))[_0x722d('0x2b')](handleError(_0xeefd22,null));};exports[_0x722d('0x6e')]=function(_0x564e07,_0x40ba5c,_0x1c5a25){return db[_0x722d('0x41')]['find']({'where':{'id':_0x564e07['params']['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x40ba5c,null))['then'](function(_0x140282){if(_0x140282){return _0x140282[_0x722d('0x6e')](_0x564e07[_0x722d('0x46')][_0x722d('0x6a')]);}})[_0x722d('0x21')](respondWithStatusCode(_0x40ba5c,null))[_0x722d('0x2b')](handleError(_0x40ba5c,null));};exports['addAgents']=function(_0x53e30f,_0x48bffb,_0xd6876d){return db[_0x722d('0x41')]['find']({'where':{'id':_0x53e30f[_0x722d('0x62')]['id']}})['then'](handleEntityNotFound(_0x48bffb,null))[_0x722d('0x21')](function(_0xded67a){if(_0xded67a){return _0xded67a[_0x722d('0x6f')](_0x53e30f[_0x722d('0x60')]['ids'],_[_0x722d('0x70')](_0x53e30f[_0x722d('0x60')],[_0x722d('0x6a'),'id'])||{})[_0x722d('0x71')](function(_0x1f71e7){for(var _0x2c3396=0x0;_0x2c3396<_0x53e30f['body'][_0x722d('0x6a')]['length'];_0x2c3396+=0x1){socket[_0x722d('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x53e30f[_0x722d('0x60')][_0x722d('0x6a')][_0x2c3396]),'WhatsappAccountId':Number(_0x53e30f['params']['id'])});}return _0x1f71e7;});}})['then'](respondWithResult(_0x48bffb,null))[_0x722d('0x2b')](handleError(_0x48bffb,null));};exports[_0x722d('0x73')]=function(_0x3e950e,_0x485361,_0x21dd3d){return db[_0x722d('0x41')][_0x722d('0x61')]({'where':{'id':_0x3e950e[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x485361,null))[_0x722d('0x21')](function(_0x262f28){if(_0x262f28){return _0x262f28['removeAgents'](_0x3e950e['query'][_0x722d('0x6a')])[_0x722d('0x21')](function(){if(_[_0x722d('0x74')](_0x3e950e['query']['ids'])){for(var _0x47dd24=0x0;_0x47dd24<_0x3e950e[_0x722d('0x46')][_0x722d('0x6a')][_0x722d('0x4b')];_0x47dd24+=0x1){socket[_0x722d('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e950e[_0x722d('0x46')][_0x722d('0x6a')][_0x47dd24]),'WhatsappAccountId':Number(_0x3e950e[_0x722d('0x62')]['id'])});}}else{socket['emit'](_0x722d('0x75'),{'UserId':Number(_0x3e950e[_0x722d('0x46')]['ids']),'WhatsappAccountId':Number(_0x3e950e['params']['id'])});}});}})[_0x722d('0x21')](respondWithStatusCode(_0x485361,null))[_0x722d('0x2b')](handleError(_0x485361,null));};exports[_0x722d('0x76')]=function(_0x2d84dc,_0x219d22,_0x150b3){var _0x3cbfa3={};var _0x10ee3b={};var _0x1365b1;var _0x1762ac;return db[_0x722d('0x41')][_0x722d('0x65')]({'where':{'id':_0x2d84dc[_0x722d('0x62')]['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x219d22,null))['then'](function(_0x5d471e){if(_0x5d471e){_0x1365b1=_0x5d471e;_0x10ee3b[_0x722d('0x45')]=_['keys'](db[_0x722d('0x77')][_0x722d('0x67')]);_0x10ee3b[_0x722d('0x46')]=_[_0x722d('0x59')](_0x2d84dc[_0x722d('0x46')]);_0x10ee3b['filters']=_[_0x722d('0x48')](_0x10ee3b['model'],_0x10ee3b[_0x722d('0x46')]);_0x3cbfa3['attributes']=_['intersection'](_0x10ee3b[_0x722d('0x45')],qs['fields'](_0x2d84dc[_0x722d('0x46')]['fields']));_0x3cbfa3[_0x722d('0x49')]=_0x3cbfa3[_0x722d('0x49')][_0x722d('0x4b')]?_0x3cbfa3[_0x722d('0x49')]:_0x10ee3b[_0x722d('0x45')];_0x3cbfa3[_0x722d('0x4d')]=qs[_0x722d('0x4e')](_0x2d84dc[_0x722d('0x46')][_0x722d('0x4e')]);_0x3cbfa3[_0x722d('0x50')]=qs[_0x722d('0x47')](_['pick'](_0x2d84dc[_0x722d('0x46')],_0x10ee3b['filters']));if(_0x2d84dc[_0x722d('0x46')]['filter']){_0x3cbfa3[_0x722d('0x50')]=_['merge'](_0x3cbfa3[_0x722d('0x50')],{'$or':_['map'](_0x3cbfa3[_0x722d('0x49')],function(_0x4b0fcc){var _0x56b8d4={};_0x56b8d4[_0x4b0fcc]={'$like':'%'+_0x2d84dc['query'][_0x722d('0x52')]+'%'};return _0x56b8d4;})});}_0x3cbfa3=_[_0x722d('0x5a')]({},_0x3cbfa3,_0x2d84dc[_0x722d('0x53')]);return _0x1365b1['getAgents'](_0x3cbfa3);}})[_0x722d('0x21')](function(_0x167ff3){if(_0x167ff3){_0x1762ac=_0x167ff3[_0x722d('0x4b')];if(!_0x2d84dc[_0x722d('0x46')][_0x722d('0x6d')](_0x722d('0x4c'))){_0x3cbfa3[_0x722d('0x31')]=qs[_0x722d('0x31')](_0x2d84dc['query'][_0x722d('0x31')]);_0x3cbfa3[_0x722d('0x2f')]=qs[_0x722d('0x2f')](_0x2d84dc[_0x722d('0x46')]['offset']);}return _0x1365b1[_0x722d('0x76')](_0x3cbfa3);}})[_0x722d('0x21')](function(_0x2ead53){if(_0x2ead53){return _0x2ead53?{'count':_0x1762ac,'rows':_0x2ead53}:null;}})[_0x722d('0x21')](respondWithResult(_0x219d22,null))[_0x722d('0x2b')](handleError(_0x219d22,null));};exports['addApplications']=function(_0x286356,_0x36d691){var _0x550ff1=_0x286356[_0x722d('0x62')]['id'];var _0x389729=_0x286356[_0x722d('0x60')];var _0x5b9963=0xc8;var _0x5ca4af=null;return db[_0x722d('0x78')]['transaction']({'isolationLevel':db[_0x722d('0x78')]['Transaction'][_0x722d('0x79')]['READ_COMMITTED']},function(_0x5bc869){return db[_0x722d('0x41')][_0x722d('0x65')]({'where':{'id':_0x550ff1},'transaction':_0x5bc869})[_0x722d('0x21')](function(_0x22ee85){if(_0x22ee85){return db['WhatsappApplication'][_0x722d('0x38')]({'where':{'WhatsappAccountId':_0x550ff1},'transaction':_0x5bc869})[_0x722d('0x21')](function(){var _0x4642b5=_[_0x722d('0x40')](_0x389729,function(_0x31b0e7){_0x31b0e7[_0x722d('0x68')]=_0x550ff1;return _0x31b0e7;});return db[_0x722d('0x7a')][_0x722d('0x7b')](_0x4642b5,{'transaction':_0x5bc869});});}else{_0x5b9963=0x194;_0x5ca4af=[];}});})[_0x722d('0x21')](function(){if(_0x5b9963!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x550ff1},'order':_0x722d('0x7c')})[_0x722d('0x21')](function(_0x4768f3){_0x5ca4af=_0x4768f3;});}})[_0x722d('0x2b')](function(_0x421526){_0x5b9963=0x1f4;logger[_0x722d('0x27')](_0x421526[_0x722d('0x7d')]);if(_0x421526[_0x722d('0x3c')]){delete _0x421526['name'];}_0x5ca4af=_0x421526;})[_0x722d('0x7e')](function(){if(_0x5ca4af===null){_0x36d691[_0x722d('0x2c')](_0x5b9963);}else{if(_0x5b9963===0x1f4){_0x36d691[_0x722d('0x2d')](_0x5b9963)['send'](_0x5ca4af);}else{_0x36d691['status'](_0x5b9963)[_0x722d('0x2e')](_0x5ca4af);}}});};exports[_0x722d('0x7f')]=function(_0xce1dbf,_0x48e258,_0xce4397){var _0x4ad7ed={};var _0x495ece={};var _0x2ebc2b;var _0x43cd77;return db['WhatsappAccount'][_0x722d('0x65')]({'where':{'id':_0xce1dbf['params']['id']}})[_0x722d('0x21')](handleEntityNotFound(_0x48e258,null))[_0x722d('0x21')](function(_0x2d444a){if(_0x2d444a){_0x2ebc2b=_0x2d444a;_0x495ece['model']=_[_0x722d('0x59')](db[_0x722d('0x7a')]['rawAttributes']);_0x495ece[_0x722d('0x46')]=_['keys'](_0xce1dbf[_0x722d('0x46')]);_0x495ece[_0x722d('0x47')]=_[_0x722d('0x48')](_0x495ece['model'],_0x495ece[_0x722d('0x46')]);_0x4ad7ed[_0x722d('0x49')]=_[_0x722d('0x48')](_0x495ece[_0x722d('0x45')],qs[_0x722d('0x4a')](_0xce1dbf[_0x722d('0x46')][_0x722d('0x4a')]));_0x4ad7ed[_0x722d('0x49')]=_0x4ad7ed[_0x722d('0x49')][_0x722d('0x4b')]?_0x4ad7ed['attributes']:_0x495ece[_0x722d('0x45')];_0x4ad7ed[_0x722d('0x4d')]=qs[_0x722d('0x4e')](_0xce1dbf[_0x722d('0x46')][_0x722d('0x4e')]);_0x4ad7ed[_0x722d('0x50')]=qs[_0x722d('0x47')](_[_0x722d('0x4f')](_0xce1dbf[_0x722d('0x46')],_0x495ece[_0x722d('0x47')]));if(_0xce1dbf[_0x722d('0x46')][_0x722d('0x52')]){_0x4ad7ed[_0x722d('0x50')]=_[_0x722d('0x5a')](_0x4ad7ed[_0x722d('0x50')],{'$or':_[_0x722d('0x40')](_0x4ad7ed['attributes'],function(_0x2fe503){var _0x3a8502={};_0x3a8502[_0x2fe503]={'$like':'%'+_0xce1dbf['query'][_0x722d('0x52')]+'%'};return _0x3a8502;})});}_0x4ad7ed=_['merge']({},_0x4ad7ed,_0xce1dbf['options']);return _0x2ebc2b['getApplications'](_0x4ad7ed);}})[_0x722d('0x21')](function(_0x241466){if(_0x241466){_0x43cd77=_0x241466['length'];if(!_0xce1dbf[_0x722d('0x46')][_0x722d('0x6d')](_0x722d('0x4c'))){_0x4ad7ed['limit']=qs[_0x722d('0x31')](_0xce1dbf[_0x722d('0x46')][_0x722d('0x31')]);_0x4ad7ed[_0x722d('0x2f')]=qs[_0x722d('0x2f')](_0xce1dbf[_0x722d('0x46')]['offset']);}return _0x2ebc2b[_0x722d('0x7f')](_0x4ad7ed);}})[_0x722d('0x21')](function(_0x5cb2d6){if(_0x5cb2d6){return _0x5cb2d6?{'count':_0x43cd77,'rows':_0x5cb2d6}:null;}})['then'](respondWithResult(_0x48e258,null))[_0x722d('0x2b')](handleError(_0x48e258,null));};exports[_0x722d('0x80')]=function(_0xfb4154,_0x17f04c,_0x4600dc){var _0x2cfe15={'channel':'whatsapp'};var _0xe347dc=[];var _0x2132bd=[];var _0x124d27={};return db['WhatsappAccount'][_0x722d('0x61')]({'where':{'id':_0xfb4154['params']['id']},'include':[{'model':db[_0x722d('0x7a')],'as':_0x722d('0x81')}]})[_0x722d('0x21')](handleEntityNotFound(_0x17f04c,null))[_0x722d('0x21')](function(_0x149599){_0x2cfe15[_0x722d('0x82')]=_0x149599;if(_0x2cfe15[_0x722d('0x82')]&&_0x2cfe15[_0x722d('0x82')][_0x722d('0x43')]===_0x722d('0x83')&&_0xfb4154[_0x722d('0x60')][_0x722d('0x84')]){if(_0xfb4154['body'][_0x722d('0x84')][_0x722d('0x4b')]===0x0)return;if(_0xfb4154[_0x722d('0x60')]['statuses'][0x0][_0x722d('0x85')]!==_0x722d('0x86'))return;return db['WhatsappMessage'][_0x722d('0x37')]({'read':!![],'readAt':_0xfb4154[_0x722d('0x60')][_0x722d('0x84')][0x0][_0x722d('0x87')]},{'where':{'messageId':_0xfb4154[_0x722d('0x60')]['statuses'][0x0][_0x722d('0x88')]},'individualHooks':!![]})[_0x722d('0x21')](function(_0x45e9be){return _0x17f04c[_0x722d('0x2d')](0xc8)[_0x722d('0x2e')](_0x45e9be);});}_0x2cfe15[_0x722d('0x89')]=_[_0x722d('0x8a')](_0x149599['Applications'],['priority'],['asc']);if(_0x2cfe15[_0x722d('0x82')]['Applications']){delete _0x2cfe15['account'][_0x722d('0x81')];}return db['CmContact'][_0x722d('0x63')]()[_0x722d('0x21')](function(_0x29ba44){if(!_0x29ba44){throw new db[(_0x722d('0x8b'))]['ValidationError'](_0x722d('0x8c'));}_0xe347dc=_[_0x722d('0x8d')](_[_0x722d('0x59')](_0x29ba44),[_0x722d('0x8e'),_0x722d('0x8f')]);_0x2132bd=_[_0x722d('0x8d')](_[_0x722d('0x59')](_0x29ba44),[_0x722d('0x8e'),'updatedAt','CompanyId',_0x722d('0x90')]);_0x2cfe15['body']={'mapKey':_0x722d('0x91')};if(_0x2cfe15[_0x722d('0x82')]&&_0x2cfe15[_0x722d('0x82')][_0x722d('0x43')]==='twilio'){_0x2cfe15[_0x722d('0x60')][_0x722d('0x92')]=_0xfb4154['body'][_0x722d('0x93')][_0x722d('0x94')]('whatsapp:','');_0x2cfe15['body']['body']=_0xfb4154[_0x722d('0x60')]['Body'];_0x2cfe15[_0x722d('0x60')][_0x722d('0x95')]=_0xfb4154[_0x722d('0x60')][_0x722d('0x96')];}if(_0x2cfe15[_0x722d('0x82')]&&_0x2cfe15['account']['type']===_0x722d('0x83')){_0x2cfe15['body'][_0x722d('0x92')]=_0xfb4154[_0x722d('0x60')][_0x722d('0x97')][0x0][_0x722d('0x92')];_0x2cfe15[_0x722d('0x60')][_0x722d('0x60')]=_0xfb4154['body'][_0x722d('0x97')][0x0][_0x722d('0x29')][_0x722d('0x60')];_0x2cfe15[_0x722d('0x60')]['messageId']=_0xfb4154['body'][_0x722d('0x97')][0x0]['message_id'];}if(_0x2cfe15[_0x722d('0x60')]['id']){delete _0x2cfe15[_0x722d('0x60')]['id'];}if(_[_0x722d('0x98')](_0x2cfe15['body'][_0x722d('0x92')])){throw new db[(_0x722d('0x8b'))][(_0x722d('0x99'))](_0x722d('0x9a'));}if(_[_0x722d('0x98')](_0x2cfe15[_0x722d('0x60')][_0x722d('0x60')])||_0x2cfe15[_0x722d('0x60')]['body']===''){throw new db[(_0x722d('0x8b'))][(_0x722d('0x99'))](_0x722d('0x9b'));}if(_[_0x722d('0x98')](_0x2cfe15[_0x722d('0x60')]['mapKey'])){throw new db[(_0x722d('0x8b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2132bd);}if(!_[_0x722d('0x9c')](_0x2132bd,_0x2cfe15['body'][_0x722d('0x9d')])){throw new db['Sequelize'][(_0x722d('0x99'))](_0x722d('0x9e')+_0x2132bd);}_0x124d27[_0x2cfe15[_0x722d('0x60')][_0x722d('0x9d')]]=_0x2cfe15[_0x722d('0x60')]['from'];return db['CmList']['find']({'where':{'id':_0x2cfe15[_0x722d('0x82')][_0x722d('0x90')]},'include':[{'model':db[_0x722d('0x9f')],'as':_0x722d('0xa0'),'where':_0x124d27,'limit':0x1,'order':[[_0x722d('0x8f'),'DESC']]}]});})[_0x722d('0x21')](handleEntityNotFound(_0x17f04c,null))['then'](function(_0xfa5d32){if(_0xfa5d32){_0x2cfe15[_0x722d('0xa1')]=_['omit'](_0xfa5d32,[_0x722d('0xa0')]);if(_0xfa5d32[_0x722d('0xa0')][_0x722d('0x4b')]){return _0xfa5d32[_0x722d('0xa0')][0x0];}var _0x168792=_[_0x722d('0x1a')](_0x2cfe15['body'],{'firstName':_0x2cfe15[_0x722d('0x60')]['from'],'ListId':_0xfa5d32['id']});_0x168792[_0x2cfe15[_0x722d('0x60')][_0x722d('0x9d')]]=_0x2cfe15[_0x722d('0x60')]['from'];return db[_0x722d('0x9f')][_0x722d('0x5b')](_0x168792,{'fields':_0xe347dc,'raw':!![]});}})[_0x722d('0x21')](handleEntityNotFound(_0x17f04c,null))[_0x722d('0x21')](function(_0x5d9563){if(_0x5d9563){_0x2cfe15['contact']=_0x5d9563;var _0x2a14f3={'ContactId':_0x5d9563['id'],'phone':_0x2cfe15[_0x722d('0x60')]['from'],'WhatsappAccountId':_0xfb4154[_0x722d('0x62')]['id']};var _0x7d59a8={'ContactId':_0x5d9563['id'],'WhatsappAccountId':_0xfb4154[_0x722d('0x62')]['id'],'closed':![]};return db[_0x722d('0xa2')][_0x722d('0x61')]({'where':_0x7d59a8})[_0x722d('0x21')](function(_0x3e7bab){if(_0x3e7bab){return[_0x3e7bab,![]];}return db[_0x722d('0xa2')][_0x722d('0x5b')](_0x2a14f3)[_0x722d('0x21')](function(_0x3aaf47){return[_0x3aaf47,!![]];});});}})[_0x722d('0x71')](function(_0xac8b46,_0x130b89){_0x2cfe15[_0x722d('0xa3')]=_0xac8b46[_0x722d('0x39')]({'plain':!![]});_0x2cfe15[_0x722d('0xa3')][_0x722d('0xa4')]=![];if(_0x130b89){if(_0x2cfe15[_0x722d('0x82')][_0x722d('0xa5')]){_0x2cfe15[_0x722d('0x89')]['push']({'id':0x0,'priority':_0x2cfe15[_0x722d('0x89')]['length']+0x1,'app':_0x722d('0xa6'),'appdata':_0x722d('0xa7'),'interval':'*,*,*,*'});}_0x2cfe15[_0x722d('0xa3')][_0x722d('0xa4')]=!![];}return db['WhatsappMessage'][_0x722d('0x5b')]({'phone':_0x2cfe15[_0x722d('0x60')][_0x722d('0x92')],'messageId':_0x2cfe15[_0x722d('0x60')][_0x722d('0x95')],'body':_0x2cfe15[_0x722d('0x60')]['body'],'WhatsappAccountId':_0xfb4154[_0x722d('0x62')]['id'],'WhatsappInteractionId':_0xac8b46['id'],'direction':'in','ContactId':_0xac8b46['ContactId'],'AttachmentId':_0x2cfe15[_0x722d('0x60')][_0x722d('0xa8')]});})['then'](function(_0x5800fb){_0x2cfe15[_0x722d('0x29')]=_0x5800fb;if(!_0x2cfe15[_0x722d('0xa3')][_0x722d('0xa9')])return;return db[_0x722d('0x77')]['find']({'attributes':['id',_0x722d('0x3c')],'where':{'id':_0x2cfe15[_0x722d('0xa3')][_0x722d('0xa9')]}});})[_0x722d('0x21')](function(_0x236da0){if(_0x236da0){_0x2cfe15[_0x722d('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x722d('0xaa'),'appdata':_0x236da0['name']+','+(_0x2cfe15[_0x722d('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x722d('0xab')});}if(!_0x2cfe15[_0x722d('0xa3')][_0x722d('0xac')])return;return db[_0x722d('0xad')]['find']({'attributes':['id','name'],'where':{'id':_0x2cfe15['interaction'][_0x722d('0xac')]}});})[_0x722d('0x21')](function(_0xeb2ef5){if(_0xeb2ef5){_0x2cfe15[_0x722d('0x89')][_0x722d('0xae')]({'id':0x0,'priority':0x1,'app':_0x722d('0xaf'),'appdata':_0xeb2ef5[_0x722d('0x3c')]+','+(_0x2cfe15['account'][_0x722d('0xb0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x2cfe15);})['then'](function(_0x3388c){if(_0x3388c){var _0x53dba8=0xc8;var _0xfb3928=_0x722d('0xb1');logger[_0x722d('0xb2')](_0x722d('0x25'),_0xfb3928,_0x53dba8,_0x722d('0xb3'));logger[_0x722d('0x24')](_0x722d('0xb4'),_0xfb3928,_0x53dba8,_0x722d('0xb3'),JSON[_0x722d('0x26')](_0x3388c));if(_0x2cfe15[_0x722d('0x82')]['type']==='twilio'){return _0x17f04c[_0x722d('0x2d')](_0x53dba8)['set'](_0x722d('0xb5'),_0x722d('0xb6'))[_0x722d('0x3d')](_0x722d('0xb7'));}else{return _0x17f04c['status'](_0x53dba8)[_0x722d('0x2e')](_0x3388c);}}});})[_0x722d('0x2b')](handleError(_0x17f04c,null));};exports[_0x722d('0x3d')]=function(_0x4e63f8,_0x2c4cb2,_0x3548ce){var _0x503d52,_0x3e0a7f,_0x408917;if(_[_0x722d('0x98')](_0x4e63f8['body'][_0x722d('0x60')])||_0x4e63f8[_0x722d('0x60')][_0x722d('0x60')]===''){throw new db[(_0x722d('0x8b'))][(_0x722d('0x99'))](_0x722d('0x9b'));}if(_[_0x722d('0x98')](_0x4e63f8[_0x722d('0x60')]['to'])){throw new db[(_0x722d('0x8b'))]['ValidationError']('to\x20is\x20mandatory');}_0x503d52=_0x4e63f8['body']['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x4e63f8[_0x722d('0x62')]['id']},'include':[{'model':db[_0x722d('0xb8')],'as':_0x722d('0xb9'),'include':[{'model':db[_0x722d('0x9f')],'as':'Contacts','where':{'mobile':_0x503d52},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x2c4cb2,null))[_0x722d('0x21')](function(_0x493726){if(_0x493726&&_0x493726[_0x722d('0xb9')]){_0x3e0a7f=_0x493726[_0x722d('0x39')]({'plain':!![]});if(_0x3e0a7f['List']&&_0x3e0a7f['List'][_0x722d('0xa0')][_0x722d('0x4b')]){return _0x3e0a7f[_0x722d('0xb9')][_0x722d('0xa0')][0x0];}return db[_0x722d('0x9f')][_0x722d('0x5b')](_[_0x722d('0x1a')](_0x4e63f8[_0x722d('0x60')],{'firstName':_0x503d52,'mobile':_0x503d52,'phone':_0x503d52,'ListId':_0x3e0a7f[_0x722d('0x90')]}));}})[_0x722d('0x21')](handleEntityNotFound(_0x2c4cb2,null))[_0x722d('0x21')](function(_0x2c6438){if(_0x2c6438){_0x408917=_0x2c6438;return db[_0x722d('0xa2')][_0x722d('0x61')]({'where':{'ContactId':_0x408917['id'],'closed':![],'WhatsappAccountId':_0x3e0a7f['id']}})[_0x722d('0x21')](function(_0x17512a){if(_0x17512a){return[_0x17512a,![]];}return db['WhatsappInteraction'][_0x722d('0x5b')]({'UserId':_0x4e63f8['user']['id'],'ContactId':_0x408917['id'],'WhatsappAccountId':_0x3e0a7f['id'],'phone':_0x503d52,'firstMsgDirection':_0x722d('0xba'),'Messages':[_[_0x722d('0x5a')](_0x4e63f8[_0x722d('0x60')],{'read':![],'body':_0x4e63f8['body'][_0x722d('0x60')],'phone':_0x503d52,'WhatsappAccountId':_0x3e0a7f['id'],'UserId':_0x4e63f8[_0x722d('0x5c')]['id'],'ContactId':_0x408917['id']})]},{'include':[{'model':db[_0x722d('0xbb')],'as':'Messages'}]})[_0x722d('0x21')](function(_0xe97dd5){return[_0xe97dd5,!![]];});});}})[_0x722d('0x71')](function(_0x36230b,_0x1aa60c){if(_0x1aa60c){return _0x36230b;}return db[_0x722d('0xbb')][_0x722d('0x5b')](_[_0x722d('0x5a')](_0x4e63f8[_0x722d('0x60')],{'read':![],'body':_0x4e63f8[_0x722d('0x60')][_0x722d('0x60')],'phone':_0x503d52,'WhatsappAccountId':_0x3e0a7f['id'],'WhatsappInteractionId':_0x36230b['id'],'UserId':_0x4e63f8['user']['id'],'ContactId':_0x408917['id']}))['then'](function(_0x502de5){_0x36230b[_0x722d('0xbc')][_0x722d('0xbd')]=[];_0x36230b[_0x722d('0xbc')][_0x722d('0xbd')]['push'](_0x502de5[_0x722d('0xbc')]);return _0x36230b;});})[_0x722d('0x21')](respondWithResult(_0x2c4cb2,null))[_0x722d('0x2b')](handleError(_0x2c4cb2,null));}; \ No newline at end of file +var _0x6f87=['path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','WhatsappAccounts','status','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','body','WhatsappAccountId','Disposition','getDispositions','findOne','order','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','whatsapp','Applications','account','state','read','WhatsappMessage','statuses','timestamp','applications','orderBy','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','message_id','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','Contacts','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','CmList','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x6f87,0x194));var _0x76f8=function(_0x412b89,_0x54ae94){_0x412b89=_0x412b89-0x0;var _0x2af155=_0x6f87[_0x412b89];return _0x2af155;};'use strict';var emlformat=require(_0x76f8('0x0'));var rimraf=require(_0x76f8('0x1'));var zipdir=require(_0x76f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f8('0x3'));var moment=require(_0x76f8('0x4'));var BPromise=require(_0x76f8('0x5'));var Mustache=require(_0x76f8('0x6'));var util=require(_0x76f8('0x7'));var path=require(_0x76f8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76f8('0x9'));var fs=require('fs');var fs_extra=require(_0x76f8('0xa'));var _=require(_0x76f8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x76f8('0xc'));var deskjs=require(_0x76f8('0xd'));var toCsv=require(_0x76f8('0xe'));var querystring=require(_0x76f8('0xf'));var Papa=require(_0x76f8('0x10'));var Redis=require('ioredis');var authService=require(_0x76f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x76f8('0x12'));var hardwareService=require(_0x76f8('0x13'));var logger=require(_0x76f8('0x14'))(_0x76f8('0x15'));var utils=require('../../config/utils');var config=require(_0x76f8('0x16'));var licenseUtil=require(_0x76f8('0x17'));var db=require(_0x76f8('0x18'))['db'];config['redis']=_[_0x76f8('0x19')](config[_0x76f8('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x76f8('0x1b'))(new Redis(config[_0x76f8('0x1a')]));require(_0x76f8('0x1c'))[_0x76f8('0x1d')](socket);var jayson=require(_0x76f8('0x1e'));var client=jayson[_0x76f8('0x1f')][_0x76f8('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x25c3c7,_0x3fc088,_0x110098,_0x584063){return new BPromise(function(_0x3c1f8d,_0x26bf72){var _0x2b61d3=_0x584063||client;return _0x2b61d3[_0x76f8('0x21')](_0x25c3c7,_0x110098)[_0x76f8('0x22')](function(_0x13b061){logger[_0x76f8('0x23')](_0x76f8('0x24'),_0x3fc088,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3fc088,_0x76f8('0x25'),JSON[_0x76f8('0x26')](_0x13b061));if(_0x13b061[_0x76f8('0x27')]){if(_0x13b061[_0x76f8('0x27')][_0x76f8('0x28')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3fc088,_0x13b061[_0x76f8('0x27')][_0x76f8('0x29')]);return _0x26bf72(_0x13b061['error'][_0x76f8('0x29')]);}logger[_0x76f8('0x27')](_0x76f8('0x24'),_0x3fc088,_0x13b061[_0x76f8('0x27')]['message']);return _0x3c1f8d(_0x13b061[_0x76f8('0x27')][_0x76f8('0x29')]);}else{logger['info'](_0x76f8('0x24'),_0x3fc088,_0x76f8('0x25'));_0x3c1f8d(_0x13b061[_0x76f8('0x2a')][_0x76f8('0x29')]);}})['catch'](function(_0x271f90){logger['error'](_0x76f8('0x24'),_0x3fc088,_0x271f90);_0x26bf72(_0x271f90);});});}function respondWithStatusCode(_0x3d5df4,_0x501853){_0x501853=_0x501853||0xcc;return function(_0x4a343a){if(_0x4a343a){return _0x3d5df4['sendStatus'](_0x501853);}return _0x3d5df4['status'](_0x501853)[_0x76f8('0x2b')]();};}function respondWithResult(_0x22b0f4,_0x4c74cd){_0x4c74cd=_0x4c74cd||0xc8;return function(_0x5ef47a){if(_0x5ef47a){return _0x22b0f4['status'](_0x4c74cd)[_0x76f8('0x2c')](_0x5ef47a);}};}function respondWithFilteredResult(_0x2f02b5,_0x5cee58){return function(_0x24e175){if(_0x24e175){var _0x175b34=typeof _0x5cee58[_0x76f8('0x2d')]===_0x76f8('0x2e')&&typeof _0x5cee58[_0x76f8('0x2f')]===_0x76f8('0x2e');var _0x3a575f=_0x24e175[_0x76f8('0x30')];var _0x1fa294=_0x175b34?0x0:_0x5cee58['offset'];var _0x154a0e=_0x175b34?_0x24e175[_0x76f8('0x30')]:_0x5cee58[_0x76f8('0x2d')]+_0x5cee58[_0x76f8('0x2f')];var _0x417721;if(_0x154a0e>=_0x3a575f){_0x154a0e=_0x3a575f;_0x417721=0xc8;}else{_0x417721=0xce;}_0x2f02b5['status'](_0x417721);return _0x2f02b5[_0x76f8('0x31')]('Content-Range',_0x1fa294+'-'+_0x154a0e+'/'+_0x3a575f)['json'](_0x24e175);}return null;};}function patchUpdates(_0x13c0f1){return function(_0x184cc7){try{jsonpatch[_0x76f8('0x32')](_0x184cc7,_0x13c0f1,!![]);}catch(_0x597f37){return BPromise[_0x76f8('0x33')](_0x597f37);}return _0x184cc7['save']();};}function saveUpdates(_0xd538ea,_0x36fc1e){return function(_0x269d68){if(_0x269d68){return _0x269d68[_0x76f8('0x34')](_0xd538ea)[_0x76f8('0x22')](function(_0x2298f3){return _0x2298f3;});}return null;};}function removeEntity(_0x433665,_0x237192){return function(_0x48c773){if(_0x48c773){return _0x48c773[_0x76f8('0x35')]()[_0x76f8('0x22')](function(){var _0x5a8623=_0x48c773[_0x76f8('0x36')]({'plain':!![]});var _0x3c715b=_0x76f8('0x37');return db['UserProfileResource'][_0x76f8('0x35')]({'where':{'type':_0x3c715b,'resourceId':_0x5a8623['id']}})['then'](function(){return _0x48c773;});})[_0x76f8('0x22')](function(){_0x433665[_0x76f8('0x38')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b198,_0x536f2a){return function(_0xe3c7aa){if(!_0xe3c7aa){_0x45b198[_0x76f8('0x39')](0x194);}return _0xe3c7aa;};}function handleError(_0x1ecc53,_0x7ca726){_0x7ca726=_0x7ca726||0x1f4;return function(_0x6314c6){logger['error'](_0x6314c6[_0x76f8('0x3a')]);if(_0x6314c6['name']){delete _0x6314c6[_0x76f8('0x3b')];}_0x1ecc53['status'](_0x7ca726)[_0x76f8('0x3c')](_0x6314c6);};}exports[_0x76f8('0x3d')]=function(_0x30d90e,_0x1c1267){var _0x4f2a99={'include':[{'model':db[_0x76f8('0x3e')],'as':_0x76f8('0x3f')}]},_0x513111={},_0x509b3d={'count':0x0,'rows':[]};var _0x54cce4=_[_0x76f8('0x40')](db[_0x76f8('0x41')][_0x76f8('0x42')],function(_0x38c0b9){return{'name':_0x38c0b9[_0x76f8('0x43')],'type':_0x38c0b9[_0x76f8('0x44')][_0x76f8('0x45')]};});_0x513111['model']=_['map'](_0x54cce4,_0x76f8('0x3b'));_0x513111[_0x76f8('0x46')]=_[_0x76f8('0x47')](_0x30d90e['query']);_0x513111[_0x76f8('0x48')]=_[_0x76f8('0x49')](_0x513111['model'],_0x513111[_0x76f8('0x46')]);_0x4f2a99['attributes']=_['intersection'](_0x513111[_0x76f8('0x4a')],qs[_0x76f8('0x4b')](_0x30d90e['query'][_0x76f8('0x4b')]));_0x4f2a99['attributes']=_0x4f2a99[_0x76f8('0x4c')][_0x76f8('0x4d')]?_0x4f2a99[_0x76f8('0x4c')]:_0x513111[_0x76f8('0x4a')];if(!_0x30d90e[_0x76f8('0x46')][_0x76f8('0x4e')](_0x76f8('0x4f'))){_0x4f2a99[_0x76f8('0x2f')]=qs[_0x76f8('0x2f')](_0x30d90e[_0x76f8('0x46')][_0x76f8('0x2f')]);_0x4f2a99[_0x76f8('0x2d')]=qs[_0x76f8('0x2d')](_0x30d90e[_0x76f8('0x46')]['offset']);}_0x4f2a99['order']=qs[_0x76f8('0x50')](_0x30d90e[_0x76f8('0x46')][_0x76f8('0x50')]);_0x4f2a99[_0x76f8('0x51')]=qs[_0x76f8('0x48')](_[_0x76f8('0x52')](_0x30d90e[_0x76f8('0x46')],_0x513111[_0x76f8('0x48')]),_0x54cce4);if(_0x30d90e['query'][_0x76f8('0x53')]){_0x4f2a99[_0x76f8('0x51')]=_[_0x76f8('0x54')](_0x4f2a99[_0x76f8('0x51')],{'$or':_[_0x76f8('0x40')](_0x54cce4,function(_0x1fbeef){if(_0x1fbeef[_0x76f8('0x44')]!==_0x76f8('0x55')){var _0x125aa4={};_0x125aa4[_0x1fbeef[_0x76f8('0x3b')]]={'$like':'%'+_0x30d90e[_0x76f8('0x46')]['filter']+'%'};return _0x125aa4;}})});}_0x4f2a99=_[_0x76f8('0x54')]({},_0x4f2a99,_0x30d90e[_0x76f8('0x56')]);var _0x140bb6={'where':_0x4f2a99[_0x76f8('0x51')]};return db[_0x76f8('0x41')][_0x76f8('0x30')](_0x140bb6)[_0x76f8('0x22')](function(_0x457e4f){_0x509b3d[_0x76f8('0x30')]=_0x457e4f;if(_0x30d90e[_0x76f8('0x46')]['includeAll']){_0x4f2a99[_0x76f8('0x57')]=[{'all':!![]}];}return db[_0x76f8('0x41')]['findAll'](_0x4f2a99);})[_0x76f8('0x22')](function(_0x5762bc){_0x509b3d['rows']=_0x5762bc;return _0x509b3d;})[_0x76f8('0x22')](respondWithFilteredResult(_0x1c1267,_0x4f2a99))[_0x76f8('0x58')](handleError(_0x1c1267,null));};exports[_0x76f8('0x59')]=function(_0xd832c3,_0x23776f){var _0x2da86c={'raw':![],'where':{'id':_0xd832c3['params']['id']},'include':[{'model':db[_0x76f8('0x3e')],'as':_0x76f8('0x3f')}]},_0x4fd5b7={};_0x4fd5b7[_0x76f8('0x4a')]=_[_0x76f8('0x47')](db[_0x76f8('0x41')][_0x76f8('0x42')]);_0x4fd5b7['query']=_['keys'](_0xd832c3[_0x76f8('0x46')]);_0x4fd5b7['filters']=_[_0x76f8('0x49')](_0x4fd5b7['model'],_0x4fd5b7[_0x76f8('0x46')]);_0x2da86c[_0x76f8('0x4c')]=_[_0x76f8('0x49')](_0x4fd5b7[_0x76f8('0x4a')],qs['fields'](_0xd832c3['query'][_0x76f8('0x4b')]));_0x2da86c[_0x76f8('0x4c')]=_0x2da86c['attributes']['length']?_0x2da86c[_0x76f8('0x4c')]:_0x4fd5b7[_0x76f8('0x4a')];if(_0xd832c3['query'][_0x76f8('0x5a')]){_0x2da86c[_0x76f8('0x57')]=[{'all':!![]}];}_0x2da86c=_['merge']({},_0x2da86c,_0xd832c3['options']);return db[_0x76f8('0x41')]['find'](_0x2da86c)[_0x76f8('0x22')](handleEntityNotFound(_0x23776f,null))[_0x76f8('0x22')](respondWithResult(_0x23776f,null))[_0x76f8('0x58')](handleError(_0x23776f,null));};exports[_0x76f8('0x5b')]=function(_0xb0b8d6,_0x49967a){return db[_0x76f8('0x41')]['create'](_0xb0b8d6['body'],{})[_0x76f8('0x22')](function(_0x58cd95){var _0x2164f3=_0xb0b8d6[_0x76f8('0x5c')][_0x76f8('0x36')]({'plain':!![]});if(!_0x2164f3)throw new Error(_0x76f8('0x5d'));if(_0x2164f3[_0x76f8('0x5e')]===_0x76f8('0x5c')){var _0x577ee1=_0x58cd95[_0x76f8('0x36')]({'plain':!![]});var _0x3d067d=_0x76f8('0x37');return db['UserProfileSection'][_0x76f8('0x5f')]({'where':{'name':_0x3d067d,'userProfileId':_0x2164f3[_0x76f8('0x60')]},'raw':!![]})[_0x76f8('0x22')](function(_0x3f30d5){if(_0x3f30d5&&_0x3f30d5['autoAssociation']===0x0){return db[_0x76f8('0x61')][_0x76f8('0x5b')]({'name':_0x577ee1[_0x76f8('0x3b')],'resourceId':_0x577ee1['id'],'type':_0x3f30d5['name'],'sectionId':_0x3f30d5['id']},{})[_0x76f8('0x22')](function(){return _0x58cd95;});}else{return _0x58cd95;}})[_0x76f8('0x58')](function(_0x132017){logger[_0x76f8('0x27')](_0x76f8('0x62'),_0x132017);throw _0x132017;});}return _0x58cd95;})[_0x76f8('0x22')](respondWithResult(_0x49967a,0xc9))['catch'](handleError(_0x49967a,null));};exports['update']=function(_0x4dc923,_0x152940){if(_0x4dc923['body']['id']){delete _0x4dc923['body']['id'];}return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0x4dc923[_0x76f8('0x63')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x76f8('0x22')](handleEntityNotFound(_0x152940,null))[_0x76f8('0x22')](saveUpdates(_0x4dc923['body'],null))[_0x76f8('0x22')](respondWithResult(_0x152940,null))[_0x76f8('0x58')](handleError(_0x152940,null));};exports[_0x76f8('0x35')]=function(_0x1f25bf,_0x243f67){return db[_0x76f8('0x41')]['find']({'where':{'id':_0x1f25bf[_0x76f8('0x63')]['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x243f67,null))['then'](removeEntity(_0x243f67,null))[_0x76f8('0x58')](handleError(_0x243f67,null));};exports[_0x76f8('0x64')]=function(_0x4e5abd,_0x50cd4a){return db[_0x76f8('0x41')]['describe']()[_0x76f8('0x22')](respondWithResult(_0x50cd4a,null))['catch'](handleError(_0x50cd4a,null));};exports[_0x76f8('0x65')]=function(_0xf82763,_0x1b0ec7,_0x258e6c){if(_0xf82763['body']['id']){delete _0xf82763[_0x76f8('0x66')]['id'];}return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0xf82763['params']['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x1b0ec7,null))[_0x76f8('0x22')](function(_0x360592){if(_0x360592){_0xf82763[_0x76f8('0x66')][_0x76f8('0x67')]=_0x360592['id'];return db[_0x76f8('0x68')][_0x76f8('0x5b')](_0xf82763[_0x76f8('0x66')]);}})[_0x76f8('0x22')](respondWithResult(_0x1b0ec7,null))['catch'](handleError(_0x1b0ec7,null));};exports[_0x76f8('0x69')]=function(_0x2250de,_0x4fcc32,_0x51be49){var _0x288e9a={'raw':![],'where':{}};var _0x34b6ec={};var _0x5601e8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x76f8('0x6a')]({'where':{'id':_0x2250de[_0x76f8('0x63')]['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x4fcc32,null))[_0x76f8('0x22')](function(_0x5be52d){if(_0x5be52d){_0x34b6ec[_0x76f8('0x4a')]=_[_0x76f8('0x47')](db[_0x76f8('0x68')][_0x76f8('0x42')]);_0x34b6ec['query']=_[_0x76f8('0x47')](_0x2250de[_0x76f8('0x46')]);_0x34b6ec[_0x76f8('0x48')]=_[_0x76f8('0x49')](_0x34b6ec[_0x76f8('0x4a')],_0x34b6ec[_0x76f8('0x46')]);_0x288e9a[_0x76f8('0x4c')]=_[_0x76f8('0x49')](_0x34b6ec[_0x76f8('0x4a')],qs[_0x76f8('0x4b')](_0x2250de[_0x76f8('0x46')][_0x76f8('0x4b')]));_0x288e9a[_0x76f8('0x4c')]=_0x288e9a['attributes'][_0x76f8('0x4d')]?_0x288e9a[_0x76f8('0x4c')]:_0x34b6ec[_0x76f8('0x4a')];if(!_0x2250de[_0x76f8('0x46')][_0x76f8('0x4e')]('nolimit')){_0x288e9a['limit']=qs[_0x76f8('0x2f')](_0x2250de['query']['limit']);_0x288e9a['offset']=qs[_0x76f8('0x2d')](_0x2250de[_0x76f8('0x46')][_0x76f8('0x2d')]);}_0x288e9a[_0x76f8('0x6b')]=qs[_0x76f8('0x50')](_0x2250de[_0x76f8('0x46')][_0x76f8('0x50')]);_0x288e9a[_0x76f8('0x51')]=qs['filters'](_[_0x76f8('0x52')](_0x2250de[_0x76f8('0x46')],_0x34b6ec['filters']));_0x288e9a['where'][_0x76f8('0x67')]=_0x5be52d['id'];if(_0x2250de[_0x76f8('0x46')]['filter']){_0x288e9a['where']=_[_0x76f8('0x54')](_0x288e9a[_0x76f8('0x51')],{'$or':_[_0x76f8('0x40')](_0x288e9a[_0x76f8('0x4c')],function(_0x5042e9){var _0x21cfe4={};_0x21cfe4[_0x5042e9]={'$like':'%'+_0x2250de[_0x76f8('0x46')]['filter']+'%'};return _0x21cfe4;})});}_0x288e9a=_[_0x76f8('0x54')]({},_0x288e9a,_0x2250de[_0x76f8('0x56')]);return db[_0x76f8('0x68')][_0x76f8('0x30')]({'where':_0x288e9a[_0x76f8('0x51')]})[_0x76f8('0x22')](function(_0x2aca45){_0x5601e8['count']=_0x2aca45;if(_0x2250de[_0x76f8('0x46')][_0x76f8('0x5a')]){_0x288e9a[_0x76f8('0x57')]=[{'all':!![]}];}return db[_0x76f8('0x68')][_0x76f8('0x6c')](_0x288e9a);})[_0x76f8('0x22')](function(_0x59e4e0){_0x5601e8[_0x76f8('0x6d')]=_0x59e4e0;return _0x5601e8;});}})[_0x76f8('0x22')](respondWithFilteredResult(_0x4fcc32,_0x288e9a))['catch'](handleError(_0x4fcc32,null));};exports[_0x76f8('0x6e')]=function(_0x3e2976,_0x400a7c,_0x16b4a8){return db['WhatsappAccount'][_0x76f8('0x5f')]({'where':{'id':_0x3e2976['params']['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x400a7c,null))[_0x76f8('0x22')](function(_0x3605af){if(_0x3605af){return _0x3605af[_0x76f8('0x6e')](_0x3e2976[_0x76f8('0x46')][_0x76f8('0x6f')]);}})['then'](respondWithStatusCode(_0x400a7c,null))[_0x76f8('0x58')](handleError(_0x400a7c,null));};exports[_0x76f8('0x70')]=function(_0x5690e6,_0x29517d,_0x35a22e){if(_0x5690e6[_0x76f8('0x66')]['id']){delete _0x5690e6[_0x76f8('0x66')]['id'];}return db[_0x76f8('0x41')]['find']({'where':{'id':_0x5690e6[_0x76f8('0x63')]['id']}})['then'](handleEntityNotFound(_0x29517d,null))[_0x76f8('0x22')](function(_0x24bdd8){if(_0x24bdd8){_0x5690e6['body']['WhatsappAccountId']=_0x24bdd8['id'];return db['CannedAnswer']['create'](_0x5690e6[_0x76f8('0x66')]);}})[_0x76f8('0x22')](respondWithResult(_0x29517d,null))[_0x76f8('0x58')](handleError(_0x29517d,null));};exports[_0x76f8('0x71')]=function(_0x1517d9,_0x26b1d5,_0x2aefb7){var _0x4d4600={'raw':![],'where':{}};var _0x339e8c={};var _0x1dea2b={'count':0x0,'rows':[]};return db[_0x76f8('0x41')]['findOne']({'where':{'id':_0x1517d9[_0x76f8('0x63')]['id']}})['then'](handleEntityNotFound(_0x26b1d5,null))[_0x76f8('0x22')](function(_0x432072){if(_0x432072){_0x339e8c[_0x76f8('0x4a')]=_[_0x76f8('0x47')](db['CannedAnswer'][_0x76f8('0x42')]);_0x339e8c[_0x76f8('0x46')]=_[_0x76f8('0x47')](_0x1517d9[_0x76f8('0x46')]);_0x339e8c[_0x76f8('0x48')]=_['intersection'](_0x339e8c[_0x76f8('0x4a')],_0x339e8c[_0x76f8('0x46')]);_0x4d4600[_0x76f8('0x4c')]=_[_0x76f8('0x49')](_0x339e8c['model'],qs['fields'](_0x1517d9[_0x76f8('0x46')][_0x76f8('0x4b')]));_0x4d4600[_0x76f8('0x4c')]=_0x4d4600[_0x76f8('0x4c')][_0x76f8('0x4d')]?_0x4d4600[_0x76f8('0x4c')]:_0x339e8c['model'];if(!_0x1517d9['query'][_0x76f8('0x4e')]('nolimit')){_0x4d4600[_0x76f8('0x2f')]=qs['limit'](_0x1517d9[_0x76f8('0x46')][_0x76f8('0x2f')]);_0x4d4600[_0x76f8('0x2d')]=qs[_0x76f8('0x2d')](_0x1517d9[_0x76f8('0x46')][_0x76f8('0x2d')]);}_0x4d4600[_0x76f8('0x6b')]=qs[_0x76f8('0x50')](_0x1517d9[_0x76f8('0x46')][_0x76f8('0x50')]);_0x4d4600['where']=qs[_0x76f8('0x48')](_[_0x76f8('0x52')](_0x1517d9[_0x76f8('0x46')],_0x339e8c['filters']));_0x4d4600[_0x76f8('0x51')][_0x76f8('0x67')]=_0x432072['id'];if(_0x1517d9[_0x76f8('0x46')][_0x76f8('0x53')]){_0x4d4600[_0x76f8('0x51')]=_[_0x76f8('0x54')](_0x4d4600[_0x76f8('0x51')],{'$or':_[_0x76f8('0x40')](_0x4d4600[_0x76f8('0x4c')],function(_0x263f7c){var _0x17c394={};_0x17c394[_0x263f7c]={'$like':'%'+_0x1517d9[_0x76f8('0x46')][_0x76f8('0x53')]+'%'};return _0x17c394;})});}_0x4d4600=_[_0x76f8('0x54')]({},_0x4d4600,_0x1517d9['options']);return db[_0x76f8('0x72')][_0x76f8('0x30')]({'where':_0x4d4600[_0x76f8('0x51')]})[_0x76f8('0x22')](function(_0x151152){_0x1dea2b[_0x76f8('0x30')]=_0x151152;if(_0x1517d9['query'][_0x76f8('0x5a')]){_0x4d4600['include']=[{'all':!![]}];}return db[_0x76f8('0x72')][_0x76f8('0x6c')](_0x4d4600);})[_0x76f8('0x22')](function(_0x3c55fc){_0x1dea2b[_0x76f8('0x6d')]=_0x3c55fc;return _0x1dea2b;});}})[_0x76f8('0x22')](respondWithFilteredResult(_0x26b1d5,_0x4d4600))['catch'](handleError(_0x26b1d5,null));};exports[_0x76f8('0x73')]=function(_0x391cbe,_0x201585,_0x1681d3){return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0x391cbe[_0x76f8('0x63')]['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x201585,null))[_0x76f8('0x22')](function(_0x28ce48){if(_0x28ce48){return _0x28ce48[_0x76f8('0x73')](_0x391cbe[_0x76f8('0x46')][_0x76f8('0x6f')]);}})[_0x76f8('0x22')](respondWithStatusCode(_0x201585,null))[_0x76f8('0x58')](handleError(_0x201585,null));};exports[_0x76f8('0x74')]=function(_0x950f6f,_0x4e7761,_0x35a778){return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0x950f6f[_0x76f8('0x63')]['id']}})['then'](handleEntityNotFound(_0x4e7761,null))['then'](function(_0x2fd445){if(_0x2fd445){return _0x2fd445['addAgents'](_0x950f6f[_0x76f8('0x66')][_0x76f8('0x6f')],_[_0x76f8('0x75')](_0x950f6f[_0x76f8('0x66')],[_0x76f8('0x6f'),'id'])||{})[_0x76f8('0x76')](function(_0x254f4c){for(var _0x52acfc=0x0;_0x52acfc<_0x950f6f[_0x76f8('0x66')][_0x76f8('0x6f')][_0x76f8('0x4d')];_0x52acfc+=0x1){socket[_0x76f8('0x77')](_0x76f8('0x78'),{'UserId':Number(_0x950f6f[_0x76f8('0x66')][_0x76f8('0x6f')][_0x52acfc]),'WhatsappAccountId':Number(_0x950f6f[_0x76f8('0x63')]['id'])});}return _0x254f4c;});}})[_0x76f8('0x22')](respondWithResult(_0x4e7761,null))[_0x76f8('0x58')](handleError(_0x4e7761,null));};exports['removeAgents']=function(_0x19ac6b,_0x1a0ed4,_0x413f4b){return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0x19ac6b['params']['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x1a0ed4,null))[_0x76f8('0x22')](function(_0xf8060d){if(_0xf8060d){return _0xf8060d[_0x76f8('0x79')](_0x19ac6b['query']['ids'])['then'](function(){if(_[_0x76f8('0x7a')](_0x19ac6b[_0x76f8('0x46')][_0x76f8('0x6f')])){for(var _0x117608=0x0;_0x117608<_0x19ac6b[_0x76f8('0x46')][_0x76f8('0x6f')]['length'];_0x117608+=0x1){socket['emit'](_0x76f8('0x7b'),{'UserId':Number(_0x19ac6b['query']['ids'][_0x117608]),'WhatsappAccountId':Number(_0x19ac6b[_0x76f8('0x63')]['id'])});}}else{socket[_0x76f8('0x77')](_0x76f8('0x7b'),{'UserId':Number(_0x19ac6b[_0x76f8('0x46')][_0x76f8('0x6f')]),'WhatsappAccountId':Number(_0x19ac6b[_0x76f8('0x63')]['id'])});}});}})[_0x76f8('0x22')](respondWithStatusCode(_0x1a0ed4,null))['catch'](handleError(_0x1a0ed4,null));};exports['getAgents']=function(_0x36d488,_0x5d86f9,_0x10f9ce){var _0x468827={};var _0x3de853={};var _0x152fc8;var _0xb7ce75;return db[_0x76f8('0x41')][_0x76f8('0x6a')]({'where':{'id':_0x36d488[_0x76f8('0x63')]['id']}})['then'](handleEntityNotFound(_0x5d86f9,null))['then'](function(_0x44fcaa){if(_0x44fcaa){_0x152fc8=_0x44fcaa;_0x3de853[_0x76f8('0x4a')]=_[_0x76f8('0x47')](db[_0x76f8('0x7c')]['rawAttributes']);_0x3de853[_0x76f8('0x46')]=_[_0x76f8('0x47')](_0x36d488[_0x76f8('0x46')]);_0x3de853['filters']=_[_0x76f8('0x49')](_0x3de853[_0x76f8('0x4a')],_0x3de853['query']);_0x468827['attributes']=_[_0x76f8('0x49')](_0x3de853['model'],qs[_0x76f8('0x4b')](_0x36d488[_0x76f8('0x46')]['fields']));_0x468827[_0x76f8('0x4c')]=_0x468827['attributes'][_0x76f8('0x4d')]?_0x468827['attributes']:_0x3de853[_0x76f8('0x4a')];_0x468827['order']=qs[_0x76f8('0x50')](_0x36d488[_0x76f8('0x46')][_0x76f8('0x50')]);_0x468827[_0x76f8('0x51')]=qs['filters'](_['pick'](_0x36d488[_0x76f8('0x46')],_0x3de853[_0x76f8('0x48')]));if(_0x36d488['query'][_0x76f8('0x53')]){_0x468827[_0x76f8('0x51')]=_['merge'](_0x468827[_0x76f8('0x51')],{'$or':_[_0x76f8('0x40')](_0x468827['attributes'],function(_0x2e0f0e){var _0x57d5c3={};_0x57d5c3[_0x2e0f0e]={'$like':'%'+_0x36d488[_0x76f8('0x46')][_0x76f8('0x53')]+'%'};return _0x57d5c3;})});}_0x468827=_[_0x76f8('0x54')]({},_0x468827,_0x36d488[_0x76f8('0x56')]);return _0x152fc8[_0x76f8('0x7d')](_0x468827);}})[_0x76f8('0x22')](function(_0x5c4a25){if(_0x5c4a25){_0xb7ce75=_0x5c4a25[_0x76f8('0x4d')];if(!_0x36d488[_0x76f8('0x46')]['hasOwnProperty']('nolimit')){_0x468827[_0x76f8('0x2f')]=qs['limit'](_0x36d488[_0x76f8('0x46')][_0x76f8('0x2f')]);_0x468827['offset']=qs[_0x76f8('0x2d')](_0x36d488['query'][_0x76f8('0x2d')]);}return _0x152fc8['getAgents'](_0x468827);}})[_0x76f8('0x22')](function(_0x5e635d){if(_0x5e635d){return _0x5e635d?{'count':_0xb7ce75,'rows':_0x5e635d}:null;}})[_0x76f8('0x22')](respondWithResult(_0x5d86f9,null))[_0x76f8('0x58')](handleError(_0x5d86f9,null));};exports[_0x76f8('0x7e')]=function(_0x3519ab,_0x4187d1){var _0x237099=_0x3519ab[_0x76f8('0x63')]['id'];var _0xe50c6e=_0x3519ab[_0x76f8('0x66')];var _0x5b05eb=0xc8;var _0x36f5d4=null;return db[_0x76f8('0x7f')][_0x76f8('0x80')]({'isolationLevel':db['sequelize'][_0x76f8('0x81')][_0x76f8('0x82')][_0x76f8('0x83')]},function(_0x2d9dac){return db[_0x76f8('0x41')]['findOne']({'where':{'id':_0x237099},'transaction':_0x2d9dac})[_0x76f8('0x22')](function(_0x129005){if(_0x129005){return db[_0x76f8('0x84')][_0x76f8('0x35')]({'where':{'WhatsappAccountId':_0x237099},'transaction':_0x2d9dac})[_0x76f8('0x22')](function(){var _0x2b9c4b=_[_0x76f8('0x40')](_0xe50c6e,function(_0x49c848){_0x49c848['WhatsappAccountId']=_0x237099;return _0x49c848;});return db[_0x76f8('0x84')][_0x76f8('0x85')](_0x2b9c4b,{'transaction':_0x2d9dac});});}else{_0x5b05eb=0x194;_0x36f5d4=[];}});})[_0x76f8('0x22')](function(){if(_0x5b05eb!==0x194){return db[_0x76f8('0x84')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x237099},'order':_0x76f8('0x86')})[_0x76f8('0x22')](function(_0x1f2f9b){_0x36f5d4=_0x1f2f9b;});}})['catch'](function(_0x4503ed){_0x5b05eb=0x1f4;logger[_0x76f8('0x27')](_0x4503ed[_0x76f8('0x3a')]);if(_0x4503ed[_0x76f8('0x3b')]){delete _0x4503ed[_0x76f8('0x3b')];}_0x36f5d4=_0x4503ed;})[_0x76f8('0x87')](function(){if(_0x36f5d4===null){_0x4187d1['sendStatus'](_0x5b05eb);}else{if(_0x5b05eb===0x1f4){_0x4187d1[_0x76f8('0x38')](_0x5b05eb)[_0x76f8('0x3c')](_0x36f5d4);}else{_0x4187d1[_0x76f8('0x38')](_0x5b05eb)[_0x76f8('0x2c')](_0x36f5d4);}}});};exports[_0x76f8('0x88')]=function(_0xcb29a9,_0x8b9a8c,_0x28da8e){var _0xe40f4f={};var _0x1665e9={};var _0xb89092;var _0x5d5fba;return db[_0x76f8('0x41')][_0x76f8('0x6a')]({'where':{'id':_0xcb29a9[_0x76f8('0x63')]['id']}})[_0x76f8('0x22')](handleEntityNotFound(_0x8b9a8c,null))[_0x76f8('0x22')](function(_0x564c4f){if(_0x564c4f){_0xb89092=_0x564c4f;_0x1665e9[_0x76f8('0x4a')]=_[_0x76f8('0x47')](db[_0x76f8('0x84')][_0x76f8('0x42')]);_0x1665e9[_0x76f8('0x46')]=_['keys'](_0xcb29a9[_0x76f8('0x46')]);_0x1665e9[_0x76f8('0x48')]=_[_0x76f8('0x49')](_0x1665e9[_0x76f8('0x4a')],_0x1665e9[_0x76f8('0x46')]);_0xe40f4f['attributes']=_[_0x76f8('0x49')](_0x1665e9[_0x76f8('0x4a')],qs[_0x76f8('0x4b')](_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x4b')]));_0xe40f4f[_0x76f8('0x4c')]=_0xe40f4f[_0x76f8('0x4c')][_0x76f8('0x4d')]?_0xe40f4f[_0x76f8('0x4c')]:_0x1665e9[_0x76f8('0x4a')];_0xe40f4f[_0x76f8('0x6b')]=qs[_0x76f8('0x50')](_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x50')]);_0xe40f4f[_0x76f8('0x51')]=qs['filters'](_[_0x76f8('0x52')](_0xcb29a9[_0x76f8('0x46')],_0x1665e9[_0x76f8('0x48')]));if(_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x53')]){_0xe40f4f[_0x76f8('0x51')]=_[_0x76f8('0x54')](_0xe40f4f[_0x76f8('0x51')],{'$or':_[_0x76f8('0x40')](_0xe40f4f['attributes'],function(_0x194afb){var _0x811ccf={};_0x811ccf[_0x194afb]={'$like':'%'+_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x53')]+'%'};return _0x811ccf;})});}_0xe40f4f=_[_0x76f8('0x54')]({},_0xe40f4f,_0xcb29a9[_0x76f8('0x56')]);return _0xb89092[_0x76f8('0x88')](_0xe40f4f);}})[_0x76f8('0x22')](function(_0x13d949){if(_0x13d949){_0x5d5fba=_0x13d949[_0x76f8('0x4d')];if(!_0xcb29a9[_0x76f8('0x46')]['hasOwnProperty'](_0x76f8('0x4f'))){_0xe40f4f[_0x76f8('0x2f')]=qs[_0x76f8('0x2f')](_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x2f')]);_0xe40f4f[_0x76f8('0x2d')]=qs[_0x76f8('0x2d')](_0xcb29a9[_0x76f8('0x46')][_0x76f8('0x2d')]);}return _0xb89092[_0x76f8('0x88')](_0xe40f4f);}})[_0x76f8('0x22')](function(_0xcf9895){if(_0xcf9895){return _0xcf9895?{'count':_0x5d5fba,'rows':_0xcf9895}:null;}})[_0x76f8('0x22')](respondWithResult(_0x8b9a8c,null))['catch'](handleError(_0x8b9a8c,null));};exports['notify']=function(_0x287368,_0x33e06c,_0x35b50c){var _0x119974={'channel':_0x76f8('0x89')};var _0x2ed474=[];var _0x268a42=[];var _0x38779f={};return db['WhatsappAccount'][_0x76f8('0x5f')]({'where':{'id':_0x287368[_0x76f8('0x63')]['id']},'include':[{'model':db[_0x76f8('0x84')],'as':_0x76f8('0x8a')}]})[_0x76f8('0x22')](handleEntityNotFound(_0x33e06c,null))[_0x76f8('0x22')](function(_0x6aee87){_0x119974[_0x76f8('0x8b')]=_0x6aee87;if(_0x119974[_0x76f8('0x8b')]&&_0x119974[_0x76f8('0x8b')][_0x76f8('0x44')]==='sinch'&&_0x287368[_0x76f8('0x66')]['statuses']){if(_0x287368[_0x76f8('0x66')]['statuses'][_0x76f8('0x4d')]===0x0)return;if(_0x287368[_0x76f8('0x66')]['statuses'][0x0][_0x76f8('0x8c')]!==_0x76f8('0x8d'))return;return db[_0x76f8('0x8e')][_0x76f8('0x34')]({'read':!![],'readAt':_0x287368['body'][_0x76f8('0x8f')][0x0][_0x76f8('0x90')]},{'where':{'messageId':_0x287368[_0x76f8('0x66')][_0x76f8('0x8f')][0x0]['message_id']},'individualHooks':!![]})[_0x76f8('0x22')](function(_0x2a7f52){return _0x33e06c['status'](0xc8)[_0x76f8('0x2c')](_0x2a7f52);});}_0x119974[_0x76f8('0x91')]=_[_0x76f8('0x92')](_0x6aee87[_0x76f8('0x8a')],[_0x76f8('0x86')],['asc']);if(_0x119974[_0x76f8('0x8b')]['Applications']){delete _0x119974[_0x76f8('0x8b')][_0x76f8('0x8a')];}return db['CmContact'][_0x76f8('0x64')]()[_0x76f8('0x22')](function(_0x44a810){if(!_0x44a810){throw new db['Sequelize']['ValidationError'](_0x76f8('0x93'));}_0x2ed474=_[_0x76f8('0x94')](_['keys'](_0x44a810),[_0x76f8('0x95'),_0x76f8('0x96')]);_0x268a42=_[_0x76f8('0x94')](_[_0x76f8('0x47')](_0x44a810),[_0x76f8('0x95'),_0x76f8('0x96'),'CompanyId',_0x76f8('0x97')]);_0x119974[_0x76f8('0x66')]={'mapKey':_0x76f8('0x98')};if(_0x119974['account']&&_0x119974['account'][_0x76f8('0x44')]==='twilio'){_0x119974[_0x76f8('0x66')][_0x76f8('0x99')]=_0x287368[_0x76f8('0x66')][_0x76f8('0x9a')][_0x76f8('0x9b')](_0x76f8('0x9c'),'');_0x119974[_0x76f8('0x66')][_0x76f8('0x66')]=_0x287368['body'][_0x76f8('0x9d')];_0x119974[_0x76f8('0x66')]['messageId']=_0x287368[_0x76f8('0x66')][_0x76f8('0x9e')];}if(_0x119974[_0x76f8('0x8b')]&&_0x119974[_0x76f8('0x8b')][_0x76f8('0x44')]===_0x76f8('0x9f')){_0x119974[_0x76f8('0x66')][_0x76f8('0x99')]=_0x287368[_0x76f8('0x66')][_0x76f8('0xa0')][0x0]['from'];_0x119974[_0x76f8('0x66')][_0x76f8('0x66')]=_0x287368[_0x76f8('0x66')]['notifications'][0x0]['message'][_0x76f8('0x66')];_0x119974[_0x76f8('0x66')]['messageId']=_0x287368[_0x76f8('0x66')][_0x76f8('0xa0')][0x0][_0x76f8('0xa1')];}if(_0x119974[_0x76f8('0x66')]['id']){delete _0x119974[_0x76f8('0x66')]['id'];}if(_[_0x76f8('0xa2')](_0x119974['body'][_0x76f8('0x99')])){throw new db[(_0x76f8('0xa3'))][(_0x76f8('0xa4'))](_0x76f8('0xa5'));}if(_[_0x76f8('0xa2')](_0x119974[_0x76f8('0x66')]['body'])||_0x119974[_0x76f8('0x66')][_0x76f8('0x66')]===''){throw new db[(_0x76f8('0xa3'))][(_0x76f8('0xa4'))](_0x76f8('0xa6'));}if(_[_0x76f8('0xa2')](_0x119974[_0x76f8('0x66')][_0x76f8('0xa7')])){throw new db['Sequelize'][(_0x76f8('0xa4'))](_0x76f8('0xa8')+_0x268a42);}if(!_[_0x76f8('0xa9')](_0x268a42,_0x119974['body']['mapKey'])){throw new db[(_0x76f8('0xa3'))][(_0x76f8('0xa4'))](_0x76f8('0xaa')+_0x268a42);}_0x38779f[_0x119974[_0x76f8('0x66')][_0x76f8('0xa7')]]=_0x119974[_0x76f8('0x66')][_0x76f8('0x99')];return db['CmList']['find']({'where':{'id':_0x119974[_0x76f8('0x8b')][_0x76f8('0x97')]},'include':[{'model':db[_0x76f8('0xab')],'as':'Contacts','where':_0x38779f,'limit':0x1,'order':[[_0x76f8('0x96'),_0x76f8('0xac')]]}]});})['then'](handleEntityNotFound(_0x33e06c,null))[_0x76f8('0x22')](function(_0x420bc0){if(_0x420bc0){_0x119974['list']=_[_0x76f8('0x75')](_0x420bc0,[_0x76f8('0xad')]);if(_0x420bc0[_0x76f8('0xad')][_0x76f8('0x4d')]){return _0x420bc0[_0x76f8('0xad')][0x0];}var _0xfbb598=_[_0x76f8('0x19')](_0x119974[_0x76f8('0x66')],{'firstName':_0x119974[_0x76f8('0x66')][_0x76f8('0x99')],'ListId':_0x420bc0['id']});_0xfbb598[_0x119974[_0x76f8('0x66')][_0x76f8('0xa7')]]=_0x119974[_0x76f8('0x66')][_0x76f8('0x99')];return db[_0x76f8('0xab')][_0x76f8('0x5b')](_0xfbb598,{'fields':_0x2ed474,'raw':!![]});}})[_0x76f8('0x22')](handleEntityNotFound(_0x33e06c,null))[_0x76f8('0x22')](function(_0x55f83a){if(_0x55f83a){_0x119974['contact']=_0x55f83a;var _0x8201f6={'ContactId':_0x55f83a['id'],'phone':_0x119974[_0x76f8('0x66')][_0x76f8('0x99')],'WhatsappAccountId':_0x287368[_0x76f8('0x63')]['id']};var _0x3a7c86={'ContactId':_0x55f83a['id'],'WhatsappAccountId':_0x287368[_0x76f8('0x63')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x76f8('0x5f')]({'where':_0x3a7c86})['then'](function(_0x10b3da){if(_0x10b3da){return[_0x10b3da,![]];}return db['WhatsappInteraction'][_0x76f8('0x5b')](_0x8201f6)[_0x76f8('0x22')](function(_0x196d86){return[_0x196d86,!![]];});});}})[_0x76f8('0x76')](function(_0x52d028,_0x6c40d2){_0x119974[_0x76f8('0xae')]=_0x52d028[_0x76f8('0x36')]({'plain':!![]});_0x119974[_0x76f8('0xae')][_0x76f8('0xaf')]=![];if(_0x6c40d2){if(_0x119974[_0x76f8('0x8b')][_0x76f8('0xb0')]){_0x119974['applications'][_0x76f8('0xb1')]({'id':0x0,'priority':_0x119974['applications'][_0x76f8('0x4d')]+0x1,'app':_0x76f8('0xb2'),'appdata':_0x76f8('0xb3'),'interval':_0x76f8('0xb4')});}_0x119974['interaction'][_0x76f8('0xaf')]=!![];}return db['WhatsappMessage'][_0x76f8('0x5b')]({'phone':_0x119974[_0x76f8('0x66')]['from'],'messageId':_0x119974[_0x76f8('0x66')][_0x76f8('0xb5')],'body':_0x119974[_0x76f8('0x66')][_0x76f8('0x66')],'WhatsappAccountId':_0x287368[_0x76f8('0x63')]['id'],'WhatsappInteractionId':_0x52d028['id'],'direction':'in','ContactId':_0x52d028[_0x76f8('0xb6')],'AttachmentId':_0x119974['body'][_0x76f8('0xb7')]});})[_0x76f8('0x22')](function(_0x2c4236){_0x119974['message']=_0x2c4236;if(!_0x119974[_0x76f8('0xae')]['UserId'])return;return db[_0x76f8('0x7c')][_0x76f8('0x5f')]({'attributes':['id',_0x76f8('0x3b')],'where':{'id':_0x119974[_0x76f8('0xae')][_0x76f8('0xb8')]}});})[_0x76f8('0x22')](function(_0x5a2cbe){if(_0x5a2cbe){_0x119974[_0x76f8('0x91')][_0x76f8('0xb9')]({'id':0x0,'priority':0x0,'app':_0x76f8('0xba'),'appdata':_0x5a2cbe[_0x76f8('0x3b')]+','+(_0x119974['account'][_0x76f8('0xbb')]||0xa),'interval':'*,*,*,*'});}if(!_0x119974[_0x76f8('0xae')][_0x76f8('0xbc')])return;return db[_0x76f8('0xbd')]['find']({'attributes':['id',_0x76f8('0x3b')],'where':{'id':_0x119974[_0x76f8('0xae')]['queueId']}});})[_0x76f8('0x22')](function(_0x5a8b44){if(_0x5a8b44){_0x119974[_0x76f8('0x91')][_0x76f8('0xb9')]({'id':0x0,'priority':0x1,'app':_0x76f8('0xbe'),'appdata':_0x5a8b44[_0x76f8('0x3b')]+','+(_0x119974[_0x76f8('0x8b')][_0x76f8('0xbf')]||0x12c),'interval':_0x76f8('0xb4')});}return respondWithRpcPromise('Start','startRouting',_0x119974);})['then'](function(_0x54247a){if(_0x54247a){var _0x178880=0xc8;var _0xdd0e56=_0x76f8('0xc0');logger[_0x76f8('0x23')](_0x76f8('0xc1'),_0xdd0e56,_0x178880,_0x76f8('0xc2'));logger['debug'](_0x76f8('0xc3'),_0xdd0e56,_0x178880,'entity\x20found',JSON['stringify'](_0x54247a));if(_0x119974['account'][_0x76f8('0x44')]===_0x76f8('0xc4')){return _0x33e06c['status'](_0x178880)[_0x76f8('0x31')](_0x76f8('0xc5'),_0x76f8('0xc6'))[_0x76f8('0x3c')](_0x76f8('0xc7'));}else{return _0x33e06c[_0x76f8('0x38')](_0x178880)[_0x76f8('0x2c')](_0x54247a);}}});})[_0x76f8('0x58')](handleError(_0x33e06c,null));};exports[_0x76f8('0x3c')]=function(_0x13d6ad,_0x1460db,_0x54390e){var _0xd80828,_0x479464,_0xf326f;if(_[_0x76f8('0xa2')](_0x13d6ad[_0x76f8('0x66')]['body'])||_0x13d6ad[_0x76f8('0x66')]['body']===''){throw new db[(_0x76f8('0xa3'))][(_0x76f8('0xa4'))](_0x76f8('0xa6'));}if(_[_0x76f8('0xa2')](_0x13d6ad['body']['to'])){throw new db[(_0x76f8('0xa3'))][(_0x76f8('0xa4'))]('to\x20is\x20mandatory');}_0xd80828=_0x13d6ad[_0x76f8('0x66')]['to'];return db[_0x76f8('0x41')][_0x76f8('0x5f')]({'where':{'id':_0x13d6ad[_0x76f8('0x63')]['id']},'include':[{'model':db[_0x76f8('0xc8')],'as':_0x76f8('0xc9'),'include':[{'model':db[_0x76f8('0xab')],'as':_0x76f8('0xad'),'where':{'mobile':_0xd80828},'limit':0x1,'order':[[_0x76f8('0x96'),_0x76f8('0xac')]]}]}]})[_0x76f8('0x22')](handleEntityNotFound(_0x1460db,null))['then'](function(_0x4aa7e6){if(_0x4aa7e6&&_0x4aa7e6['List']){_0x479464=_0x4aa7e6['get']({'plain':!![]});if(_0x479464['List']&&_0x479464[_0x76f8('0xc9')][_0x76f8('0xad')][_0x76f8('0x4d')]){return _0x479464[_0x76f8('0xc9')]['Contacts'][0x0];}return db['CmContact'][_0x76f8('0x5b')](_[_0x76f8('0x19')](_0x13d6ad[_0x76f8('0x66')],{'firstName':_0xd80828,'mobile':_0xd80828,'phone':_0xd80828,'ListId':_0x479464[_0x76f8('0x97')]}));}})[_0x76f8('0x22')](handleEntityNotFound(_0x1460db,null))[_0x76f8('0x22')](function(_0x12aedb){if(_0x12aedb){_0xf326f=_0x12aedb;return db['WhatsappInteraction'][_0x76f8('0x5f')]({'where':{'ContactId':_0xf326f['id'],'closed':![],'WhatsappAccountId':_0x479464['id']}})['then'](function(_0xde8d91){if(_0xde8d91){return[_0xde8d91,![]];}return db[_0x76f8('0xca')][_0x76f8('0x5b')]({'UserId':_0x13d6ad['user']['id'],'ContactId':_0xf326f['id'],'WhatsappAccountId':_0x479464['id'],'phone':_0xd80828,'firstMsgDirection':_0x76f8('0xcb'),'Messages':[_[_0x76f8('0x54')](_0x13d6ad['body'],{'read':![],'body':_0x13d6ad[_0x76f8('0x66')]['body'],'phone':_0xd80828,'WhatsappAccountId':_0x479464['id'],'UserId':_0x13d6ad[_0x76f8('0x5c')]['id'],'ContactId':_0xf326f['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x76f8('0xcc')}]})[_0x76f8('0x22')](function(_0x14d6c4){return[_0x14d6c4,!![]];});});}})[_0x76f8('0x76')](function(_0x3837ee,_0x293ac2){if(_0x293ac2){return _0x3837ee;}return db[_0x76f8('0x8e')][_0x76f8('0x5b')](_['merge'](_0x13d6ad[_0x76f8('0x66')],{'read':![],'body':_0x13d6ad[_0x76f8('0x66')]['body'],'phone':_0xd80828,'WhatsappAccountId':_0x479464['id'],'WhatsappInteractionId':_0x3837ee['id'],'UserId':_0x13d6ad['user']['id'],'ContactId':_0xf326f['id']}))[_0x76f8('0x22')](function(_0x41870f){_0x3837ee[_0x76f8('0xcd')][_0x76f8('0xcc')]=[];_0x3837ee[_0x76f8('0xcd')][_0x76f8('0xcc')][_0x76f8('0xb1')](_0x41870f[_0x76f8('0xcd')]);return _0x3837ee;});})[_0x76f8('0x22')](respondWithResult(_0x1460db,null))[_0x76f8('0x58')](handleError(_0x1460db,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d63be9c..b065f33 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 _0xd60d=['remove','emit','hook','exports','events','WhatsappAccount','setMaxListeners','save','update'];(function(_0x20acd6,_0x108b47){var _0x156b25=function(_0x33f234){while(--_0x33f234){_0x20acd6['push'](_0x20acd6['shift']());}};_0x156b25(++_0x108b47);}(_0xd60d,0xf7));var _0xdd60=function(_0x5189da,_0xe2c45b){_0x5189da=_0x5189da-0x0;var _0xf7c031=_0xd60d[_0x5189da];return _0xf7c031;};'use strict';var EventEmitter=require(_0xdd60('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xdd60('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdd60('0x2')](0x0);var events={'afterCreate':_0xdd60('0x3'),'afterUpdate':_0xdd60('0x4'),'afterDestroy':_0xdd60('0x5')};function emitEvent(_0x39b3fc){return function(_0x1dbaa7,_0x2be0a7,_0x2beef1){WhatsappAccountEvents[_0xdd60('0x6')](_0x39b3fc+':'+_0x1dbaa7['id'],_0x1dbaa7);WhatsappAccountEvents[_0xdd60('0x6')](_0x39b3fc,_0x1dbaa7);_0x2beef1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdd60('0x7')](e,emitEvent(event));}}module[_0xdd60('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4c7e=['../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c7e,0x87));var _0xe4c7=function(_0x2a74f5,_0x542b0b){_0x2a74f5=_0x2a74f5-0x0;var _0x358258=_0x4c7e[_0x2a74f5];return _0x358258;};'use strict';var EventEmitter=require(_0xe4c7('0x0'));var WhatsappAccount=require(_0xe4c7('0x1'))['db'][_0xe4c7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe4c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe4c7('0x4')};function emitEvent(_0x3bdade){return function(_0x32c19a,_0x4ca5ee,_0x519d0f){WhatsappAccountEvents['emit'](_0x3bdade+':'+_0x32c19a['id'],_0x32c19a);WhatsappAccountEvents[_0xe4c7('0x5')](_0x3bdade,_0x32c19a);_0x519d0f(null);};}for(var e in events){if(events[_0xe4c7('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xe4c7('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0afe9fc..0418494 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 _0x1c73=['api','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x1d80b6,_0x54acc9){var _0xbc7bc=function(_0x5dd837){while(--_0x5dd837){_0x1d80b6['push'](_0x1d80b6['shift']());}};_0xbc7bc(++_0x54acc9);}(_0x1c73,0xc3));var _0x31c7=function(_0x127622,_0x222275){_0x127622=_0x127622-0x0;var _0x10213e=_0x1c73[_0x127622];return _0x10213e;};'use strict';var _=require(_0x31c7('0x0'));var util=require(_0x31c7('0x1'));var logger=require(_0x31c7('0x2'))(_0x31c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x31c7('0x4'));var rimraf=require(_0x31c7('0x5'));var config=require(_0x31c7('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x31c7('0x7')]=function(_0x4346d6,_0x2892ad){return _0x4346d6[_0x31c7('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6559=['api','moment','bluebird','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x312d76,_0x1bc862){var _0xdc8d9d=function(_0x5b9e04){while(--_0x5b9e04){_0x312d76['push'](_0x312d76['shift']());}};_0xdc8d9d(++_0x1bc862);}(_0x6559,0xa3));var _0x9655=function(_0x46cfcf,_0x23dfed){_0x46cfcf=_0x46cfcf-0x0;var _0x31cabd=_0x6559[_0x46cfcf];return _0x31cabd;};'use strict';var _=require('lodash');var util=require(_0x9655('0x0'));var logger=require(_0x9655('0x1'))(_0x9655('0x2'));var moment=require(_0x9655('0x3'));var BPromise=require(_0x9655('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9655('0x5'));var config=require('../../config/environment');var attributes=require(_0x9655('0x6'));module[_0x9655('0x7')]=function(_0x557679,_0x3df0a8){return _0x557679[_0x9655('0x8')](_0x9655('0x9'),attributes,{'tableName':_0x9655('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index dd78edc..f599264 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 _0x536e=['stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','WhatsappAccount','find','options','raw','attributes','include','map','model','ShowWhatsappAccount','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','socket.io-emitter','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x413a01,_0x569c94){var _0x25dc92=function(_0x210a96){while(--_0x210a96){_0x413a01['push'](_0x413a01['shift']());}};_0x25dc92(++_0x569c94);}(_0x536e,0x111));var _0xe536=function(_0x54597a,_0x4ea42f){_0x54597a=_0x54597a-0x0;var _0x5a764f=_0x536e[_0x54597a];return _0x5a764f;};'use strict';var _=require('lodash');var util=require(_0xe536('0x0'));var moment=require(_0xe536('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe536('0x2'));var db=require(_0xe536('0x3'))['db'];var utils=require(_0xe536('0x4'));var logger=require(_0xe536('0x5'))(_0xe536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe536('0x7')]['http']({'port':0x232a});config[_0xe536('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe536('0x9'))(new Redis(config[_0xe536('0x8')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x274a2e,_0x34569d,_0x1b63a4){return new BPromise(function(_0x33be9e,_0x25505e){return client[_0xe536('0xa')](_0x274a2e,_0x1b63a4)[_0xe536('0xb')](function(_0x10e2ac){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x34569d,_0xe536('0xc'));logger[_0xe536('0xd')](_0xe536('0xe'),_0x34569d,_0xe536('0xc'),JSON[_0xe536('0xf')](_0x10e2ac));if(_0x10e2ac[_0xe536('0x10')]){if(_0x10e2ac[_0xe536('0x10')][_0xe536('0x11')]===0x1f4){logger['error'](_0xe536('0x12'),_0x34569d,_0x10e2ac[_0xe536('0x10')][_0xe536('0x13')]);return _0x25505e(_0x10e2ac['error'][_0xe536('0x13')]);}logger[_0xe536('0x10')](_0xe536('0x12'),_0x34569d,_0x10e2ac[_0xe536('0x10')]['message']);return _0x33be9e(_0x10e2ac[_0xe536('0x10')][_0xe536('0x13')]);}else{logger[_0xe536('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x34569d,_0xe536('0xc'));_0x33be9e(_0x10e2ac[_0xe536('0x15')]['message']);}})[_0xe536('0x16')](function(_0x1ff2b3){logger[_0xe536('0x10')](_0xe536('0x12'),_0x34569d,_0x1ff2b3);_0x25505e(_0x1ff2b3);});});}exports['ShowWhatsappAccount']=function(_0x44e554){var _0x2b1dc6=this;return new Promise(function(_0x529140,_0x2940ff){return db[_0xe536('0x17')][_0xe536('0x18')]({'raw':_0x44e554[_0xe536('0x19')]?_0x44e554[_0xe536('0x19')][_0xe536('0x1a')]===undefined?!![]:![]:!![],'where':_0x44e554['options']?_0x44e554[_0xe536('0x19')]['where']||null:null,'attributes':_0x44e554['options']?_0x44e554['options'][_0xe536('0x1b')]||null:null,'include':_0x44e554['options']?_0x44e554[_0xe536('0x19')][_0xe536('0x1c')]?_[_0xe536('0x1d')](_0x44e554[_0xe536('0x19')][_0xe536('0x1c')],function(_0x43bffb){return{'model':db[_0x43bffb['model']],'as':_0x43bffb['as'],'attributes':_0x43bffb[_0xe536('0x1b')],'include':_0x43bffb[_0xe536('0x1c')]?_[_0xe536('0x1d')](_0x43bffb[_0xe536('0x1c')],function(_0x43f25e){return{'model':db[_0x43f25e[_0xe536('0x1e')]],'as':_0x43f25e['as'],'attributes':_0x43f25e['attributes'],'include':_0x43f25e[_0xe536('0x1c')]?_[_0xe536('0x1d')](_0x43f25e[_0xe536('0x1c')],function(_0x513cbf){return{'model':db[_0x513cbf[_0xe536('0x1e')]],'as':_0x513cbf['as'],'attributes':_0x513cbf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x497bba){logger[_0xe536('0x14')](_0xe536('0x1f'),_0x44e554);logger[_0xe536('0xd')](_0xe536('0x1f'),_0x44e554,JSON[_0xe536('0xf')](_0x497bba));_0x529140(_0x497bba);})[_0xe536('0x16')](function(_0x23d275){logger[_0xe536('0x10')](_0xe536('0x1f'),_0x23d275['message'],_0x44e554);_0x2940ff(_0x2b1dc6[_0xe536('0x10')](0x1f4,_0x23d275[_0xe536('0x13')]));});});}; \ No newline at end of file +var _0x05d4=['../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x05d4,0x146));var _0x405d=function(_0x31ee98,_0x1e1a4a){_0x31ee98=_0x31ee98-0x0;var _0x246d93=_0x05d4[_0x31ee98];return _0x246d93;};'use strict';var _=require('lodash');var util=require(_0x405d('0x0'));var moment=require(_0x405d('0x1'));var BPromise=require(_0x405d('0x2'));var rs=require(_0x405d('0x3'));var fs=require('fs');var Redis=require(_0x405d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x405d('0x5'));var logger=require(_0x405d('0x6'))('rpc');var config=require(_0x405d('0x7'));var jayson=require(_0x405d('0x8'));var client=jayson[_0x405d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x405d('0xa')](config[_0x405d('0xb')],{'host':_0x405d('0xc'),'port':0x18eb});var socket=require(_0x405d('0xd'))(new Redis(config[_0x405d('0xb')]));require(_0x405d('0xe'))['register'](socket);function respondWithRpcPromise(_0x11f503,_0x24a895,_0x81c886){return new BPromise(function(_0x28fae0,_0x4e5f7c){return client[_0x405d('0xf')](_0x11f503,_0x81c886)[_0x405d('0x10')](function(_0x17d766){logger[_0x405d('0x11')](_0x405d('0x12'),_0x24a895,_0x405d('0x13'));logger['debug'](_0x405d('0x14'),_0x24a895,_0x405d('0x13'),JSON['stringify'](_0x17d766));if(_0x17d766[_0x405d('0x15')]){if(_0x17d766[_0x405d('0x15')]['code']===0x1f4){logger[_0x405d('0x15')](_0x405d('0x12'),_0x24a895,_0x17d766[_0x405d('0x15')][_0x405d('0x16')]);return _0x4e5f7c(_0x17d766[_0x405d('0x15')][_0x405d('0x16')]);}logger[_0x405d('0x15')](_0x405d('0x12'),_0x24a895,_0x17d766[_0x405d('0x15')][_0x405d('0x16')]);return _0x28fae0(_0x17d766[_0x405d('0x15')][_0x405d('0x16')]);}else{logger['info'](_0x405d('0x12'),_0x24a895,_0x405d('0x13'));_0x28fae0(_0x17d766[_0x405d('0x17')]['message']);}})['catch'](function(_0xd799ea){logger[_0x405d('0x15')](_0x405d('0x12'),_0x24a895,_0xd799ea);_0x4e5f7c(_0xd799ea);});});}exports[_0x405d('0x18')]=function(_0x48ad5f){var _0x24fe33=this;return new Promise(function(_0x528cd9,_0x5096cf){return db[_0x405d('0x19')][_0x405d('0x1a')]({'raw':_0x48ad5f[_0x405d('0x1b')]?_0x48ad5f[_0x405d('0x1b')][_0x405d('0x1c')]===undefined?!![]:![]:!![],'where':_0x48ad5f['options']?_0x48ad5f[_0x405d('0x1b')][_0x405d('0x1d')]||null:null,'attributes':_0x48ad5f[_0x405d('0x1b')]?_0x48ad5f[_0x405d('0x1b')][_0x405d('0x1e')]||null:null,'include':_0x48ad5f[_0x405d('0x1b')]?_0x48ad5f['options'][_0x405d('0x1f')]?_[_0x405d('0x20')](_0x48ad5f['options'][_0x405d('0x1f')],function(_0x1a277b){return{'model':db[_0x1a277b[_0x405d('0x21')]],'as':_0x1a277b['as'],'attributes':_0x1a277b[_0x405d('0x1e')],'include':_0x1a277b['include']?_[_0x405d('0x20')](_0x1a277b[_0x405d('0x1f')],function(_0x19f7cb){return{'model':db[_0x19f7cb['model']],'as':_0x19f7cb['as'],'attributes':_0x19f7cb[_0x405d('0x1e')],'include':_0x19f7cb[_0x405d('0x1f')]?_[_0x405d('0x20')](_0x19f7cb['include'],function(_0x1e99fd){return{'model':db[_0x1e99fd[_0x405d('0x21')]],'as':_0x1e99fd['as'],'attributes':_0x1e99fd[_0x405d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x405d('0x10')](function(_0x31b6f6){logger[_0x405d('0x11')]('ShowWhatsappAccount',_0x48ad5f);logger[_0x405d('0x22')](_0x405d('0x18'),_0x48ad5f,JSON[_0x405d('0x23')](_0x31b6f6));_0x528cd9(_0x31b6f6);})[_0x405d('0x24')](function(_0x42ba50){logger['error'](_0x405d('0x18'),_0x42ba50[_0x405d('0x16')],_0x48ad5f);_0x5096cf(_0x24fe33[_0x405d('0x15')](0x1f4,_0x42ba50['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 50e1fea..bd6f951 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 _0x68b9=['whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener','register','length'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x68b9,0xd1));var _0x968b=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x68b9[_0x1f44e4];return _0x591989;};'use strict';var WhatsappAccountEvents=require(_0x968b('0x0'));var events=[_0x968b('0x1'),'remove',_0x968b('0x2')];function createListener(_0x3ff519,_0x43a73c){return function(_0x403f72){_0x43a73c[_0x968b('0x3')](_0x3ff519,_0x403f72);};}function removeListener(_0x287707,_0x5f06f3){return function(){WhatsappAccountEvents[_0x968b('0x4')](_0x287707,_0x5f06f3);};}exports[_0x968b('0x5')]=function(_0x2a5c5b){for(var _0x4d9470=0x0,_0x9fb62d=events[_0x968b('0x6')];_0x4d9470<_0x9fb62d;_0x4d9470++){var _0x4768b7=events[_0x4d9470];var _0x200235=createListener(_0x968b('0x7')+_0x4768b7,_0x2a5c5b);WhatsappAccountEvents['on'](_0x4768b7,_0x200235);}}; \ No newline at end of file +var _0x6789=['update','removeListener','length','whatsappAccount:','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6789,0x13a));var _0x9678=function(_0x34b89b,_0x1c9c62){_0x34b89b=_0x34b89b-0x0;var _0x12053f=_0x6789[_0x34b89b];return _0x12053f;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x9678('0x0'),_0x9678('0x1')];function createListener(_0x58d31c,_0x5dad90){return function(_0x4d0b74){_0x5dad90['emit'](_0x58d31c,_0x4d0b74);};}function removeListener(_0x281c4e,_0x581cc5){return function(){WhatsappAccountEvents[_0x9678('0x2')](_0x281c4e,_0x581cc5);};}exports['register']=function(_0x43dddc){for(var _0x2e6080=0x0,_0x58474c=events[_0x9678('0x3')];_0x2e6080<_0x58474c;_0x2e6080++){var _0x70c3b=events[_0x2e6080];var _0x37467=createListener(_0x9678('0x4')+_0x70c3b,_0x43dddc);WhatsappAccountEvents['on'](_0x70c3b,_0x37467);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ed37064..562244f 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 _0xbe40=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0xbe40,0x7a));var _0x0be4=function(_0x153033,_0x4beb8a){_0x153033=_0x153033-0x0;var _0x47f724=_0xbe40[_0x153033];return _0x47f724;};'use strict';var multer=require(_0x0be4('0x0'));var util=require(_0x0be4('0x1'));var path=require(_0x0be4('0x2'));var timeout=require(_0x0be4('0x3'));var express=require(_0x0be4('0x4'));var router=express[_0x0be4('0x5')]();var fs_extra=require(_0x0be4('0x6'));var auth=require(_0x0be4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0be4('0x8'));var controller=require('./whatsappApplication.controller');router[_0x0be4('0x9')]('/',auth[_0x0be4('0xa')](),controller[_0x0be4('0xb')]);router[_0x0be4('0x9')](_0x0be4('0xc'),auth[_0x0be4('0xa')](),controller[_0x0be4('0xd')]);router[_0x0be4('0xe')]('/',auth[_0x0be4('0xa')](),controller['create']);router[_0x0be4('0xf')](_0x0be4('0xc'),auth[_0x0be4('0xa')](),controller[_0x0be4('0x10')]);router[_0x0be4('0x11')](_0x0be4('0xc'),auth[_0x0be4('0xa')](),controller[_0x0be4('0x12')]);module[_0x0be4('0x13')]=router; \ No newline at end of file +var _0x2b28=['../../components/auth/service','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','path','connect-timeout','express'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x2b28,0x1d1));var _0x82b2=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x2b28[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x82b2('0x0'));var timeout=require(_0x82b2('0x1'));var express=require(_0x82b2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82b2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x82b2('0x4')]('/',auth['isAuthenticated'](),controller[_0x82b2('0x5')]);router[_0x82b2('0x4')]('/:id',auth[_0x82b2('0x6')](),controller[_0x82b2('0x7')]);router['post']('/',auth[_0x82b2('0x6')](),controller[_0x82b2('0x8')]);router[_0x82b2('0x9')](_0x82b2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x82b2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x82b2('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d09f50d..4b5162f 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 _0x0f0d=['noop','TEXT','STRING','*,*,*,*','INTEGER'];(function(_0x3dcf85,_0x480bfd){var _0x180562=function(_0x5c7b72){while(--_0x5c7b72){_0x3dcf85['push'](_0x3dcf85['shift']());}};_0x180562(++_0x480bfd);}(_0x0f0d,0x95));var _0xd0f0=function(_0x472378,_0x327f94){_0x472378=_0x472378-0x0;var _0x4c1e48=_0x0f0d[_0x472378];return _0x4c1e48;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xd0f0('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd0f0('0x1')},'appdata':{'type':Sequelize[_0xd0f0('0x2')]()},'description':{'type':Sequelize[_0xd0f0('0x3')]},'interval':{'type':Sequelize[_0xd0f0('0x3')],'defaultValue':_0xd0f0('0x4')}}; \ No newline at end of file +var _0xc302=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1f5f0d,_0x1d5da6){var _0x407342=function(_0x46f487){while(--_0x46f487){_0x1f5f0d['push'](_0x1f5f0d['shift']());}};_0x407342(++_0x1d5da6);}(_0xc302,0x18d));var _0x2c30=function(_0x5e0061,_0x3b59d9){_0x5e0061=_0x5e0061-0x0;var _0x525e53=_0xc302[_0x5e0061];return _0x525e53;};'use strict';var Sequelize=require(_0x2c30('0x0'));module[_0x2c30('0x1')]={'priority':{'type':Sequelize[_0x2c30('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2c30('0x3')],'allowNull':![],'defaultValue':_0x2c30('0x4')},'appdata':{'type':Sequelize[_0x2c30('0x5')]()},'description':{'type':Sequelize[_0x2c30('0x3')]},'interval':{'type':Sequelize[_0x2c30('0x3')],'defaultValue':_0x2c30('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 6ec5ff0..98bb5ea 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 _0x02ca=['includeAll','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','options','include','WhatsappApplication','findAll','rows','catch','params'];(function(_0x5b30de,_0x5470ee){var _0x3b45d8=function(_0x56aa3a){while(--_0x56aa3a){_0x5b30de['push'](_0x5b30de['shift']());}};_0x3b45d8(++_0x5470ee);}(_0x02ca,0x97));var _0xa02c=function(_0x57ae98,_0x417688){_0x57ae98=_0x57ae98-0x0;var _0x5f56f4=_0x02ca[_0x57ae98];return _0x5f56f4;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x437308,_0x58496c){return function(_0x4de358){if(!_0x4de358){_0x437308[_0xa02c('0x18')](0x194);}return _0x4de358;};}function handleError(_0x2277d2,_0x320a8d){_0x320a8d=_0x320a8d||0x1f4;return function(_0x39124e){logger[_0xa02c('0x27')](_0x39124e[_0xa02c('0x28')]);if(_0x39124e[_0xa02c('0x29')]){delete _0x39124e[_0xa02c('0x29')];}_0x2277d2['status'](_0x320a8d)[_0xa02c('0x2a')](_0x39124e);};}exports[_0xa02c('0x2b')]=function(_0x31b520,_0x67d524){var _0x267ab4={},_0x402f72={},_0x19f1c9={'count':0x0,'rows':[]};var _0x1dfc2c=_[_0xa02c('0x2c')](db['WhatsappApplication'][_0xa02c('0x2d')],function(_0xb9f91){return{'name':_0xb9f91[_0xa02c('0x2e')],'type':_0xb9f91['type']['key']};});_0x402f72[_0xa02c('0x2f')]=_[_0xa02c('0x2c')](_0x1dfc2c,_0xa02c('0x29'));_0x402f72[_0xa02c('0x30')]=_[_0xa02c('0x31')](_0x31b520[_0xa02c('0x30')]);_0x402f72[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x402f72[_0xa02c('0x2f')],_0x402f72[_0xa02c('0x30')]);_0x267ab4['attributes']=_['intersection'](_0x402f72[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x34')]));_0x267ab4[_0xa02c('0x35')]=_0x267ab4[_0xa02c('0x35')][_0xa02c('0x36')]?_0x267ab4[_0xa02c('0x35')]:_0x402f72[_0xa02c('0x2f')];if(!_0x31b520[_0xa02c('0x30')][_0xa02c('0x37')]('nolimit')){_0x267ab4[_0xa02c('0x1e')]=qs[_0xa02c('0x1e')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1e')]);_0x267ab4['offset']=qs['offset'](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1c')]);}_0x267ab4['order']=qs['sort'](_0x31b520['query']['sort']);_0x267ab4[_0xa02c('0x38')]=qs[_0xa02c('0x32')](_[_0xa02c('0x39')](_0x31b520[_0xa02c('0x30')],_0x402f72['filters']),_0x1dfc2c);if(_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]){_0x267ab4[_0xa02c('0x38')]=_[_0xa02c('0x3b')](_0x267ab4[_0xa02c('0x38')],{'$or':_[_0xa02c('0x2c')](_0x1dfc2c,function(_0x2ab794){if(_0x2ab794[_0xa02c('0x3c')]!=='VIRTUAL'){var _0x5b957b={};_0x5b957b[_0x2ab794[_0xa02c('0x29')]]={'$like':'%'+_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]+'%'};return _0x5b957b;}})});}_0x267ab4=_[_0xa02c('0x3b')]({},_0x267ab4,_0x31b520[_0xa02c('0x3d')]);var _0x2a491b={'where':_0x267ab4[_0xa02c('0x38')]};return db['WhatsappApplication'][_0xa02c('0x1f')](_0x2a491b)[_0xa02c('0x25')](function(_0x33a9a3){_0x19f1c9[_0xa02c('0x1f')]=_0x33a9a3;if(_0x31b520['query']['includeAll']){_0x267ab4[_0xa02c('0x3e')]=[{'all':!![]}];}return db[_0xa02c('0x3f')][_0xa02c('0x40')](_0x267ab4);})['then'](function(_0x5d2ca0){_0x19f1c9[_0xa02c('0x41')]=_0x5d2ca0;return _0x19f1c9;})['then'](respondWithFilteredResult(_0x67d524,_0x267ab4))[_0xa02c('0x42')](handleError(_0x67d524,null));};exports['show']=function(_0x43b52a,_0x48996d){var _0x5ab62c={'raw':!![],'where':{'id':_0x43b52a[_0xa02c('0x43')]['id']}},_0x4a84c4={};_0x4a84c4['model']=_['keys'](db['WhatsappApplication'][_0xa02c('0x2d')]);_0x4a84c4['query']=_['keys'](_0x43b52a[_0xa02c('0x30')]);_0x4a84c4[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],_0x4a84c4[_0xa02c('0x30')]);_0x5ab62c['attributes']=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x43b52a[_0xa02c('0x30')]['fields']));_0x5ab62c[_0xa02c('0x35')]=_0x5ab62c[_0xa02c('0x35')][_0xa02c('0x36')]?_0x5ab62c[_0xa02c('0x35')]:_0x4a84c4['model'];if(_0x43b52a[_0xa02c('0x30')][_0xa02c('0x44')]){_0x5ab62c['include']=[{'all':!![]}];}_0x5ab62c=_[_0xa02c('0x3b')]({},_0x5ab62c,_0x43b52a[_0xa02c('0x3d')]);return db[_0xa02c('0x3f')]['find'](_0x5ab62c)[_0xa02c('0x25')](handleEntityNotFound(_0x48996d,null))[_0xa02c('0x25')](respondWithResult(_0x48996d,null))[_0xa02c('0x42')](handleError(_0x48996d,null));};exports[_0xa02c('0x45')]=function(_0x282f1e,_0x4f11b2){return db['WhatsappApplication'][_0xa02c('0x45')](_0x282f1e[_0xa02c('0x46')],{})[_0xa02c('0x25')](respondWithResult(_0x4f11b2,0xc9))[_0xa02c('0x42')](handleError(_0x4f11b2,null));};exports[_0xa02c('0x47')]=function(_0x128a87,_0x538df7){if(_0x128a87[_0xa02c('0x46')]['id']){delete _0x128a87[_0xa02c('0x46')]['id'];}return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x128a87[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x538df7,null))['then'](saveUpdates(_0x128a87['body'],null))['then'](respondWithResult(_0x538df7,null))[_0xa02c('0x42')](handleError(_0x538df7,null));};exports['destroy']=function(_0x115c9f,_0x1cae2a){return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x115c9f[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x1cae2a,null))[_0xa02c('0x25')](removeEntity(_0x1cae2a,null))['catch'](handleError(_0x1cae2a,null));}; \ No newline at end of file +var _0xa24d=['rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../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','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','WhatsappApplication','include','findAll','rows','catch','show','params'];(function(_0xb49449,_0x1aa117){var _0x583d6e=function(_0x9ce035){while(--_0x9ce035){_0xb49449['push'](_0xb49449['shift']());}};_0x583d6e(++_0x1aa117);}(_0xa24d,0x1c1));var _0xda24=function(_0x2bcdf4,_0x1a2f20){_0x2bcdf4=_0x2bcdf4-0x0;var _0x4a0f7a=_0xa24d[_0x2bcdf4];return _0x4a0f7a;};'use strict';var emlformat=require(_0xda24('0x0'));var rimraf=require(_0xda24('0x1'));var zipdir=require(_0xda24('0x2'));var jsonpatch=require(_0xda24('0x3'));var rp=require(_0xda24('0x4'));var moment=require(_0xda24('0x5'));var BPromise=require(_0xda24('0x6'));var Mustache=require('mustache');var util=require(_0xda24('0x7'));var path=require(_0xda24('0x8'));var sox=require(_0xda24('0x9'));var csv=require(_0xda24('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda24('0xb'));var _=require(_0xda24('0xc'));var squel=require('squel');var crypto=require(_0xda24('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda24('0xe'));var toCsv=require(_0xda24('0xa'));var querystring=require(_0xda24('0xf'));var Papa=require(_0xda24('0x10'));var Redis=require('ioredis');var authService=require(_0xda24('0x11'));var qs=require(_0xda24('0x12'));var as=require(_0xda24('0x13'));var hardwareService=require(_0xda24('0x14'));var logger=require(_0xda24('0x15'))('api');var utils=require(_0xda24('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda24('0x17'));var db=require(_0xda24('0x18'))['db'];function respondWithStatusCode(_0x519fb9,_0x54b23d){_0x54b23d=_0x54b23d||0xcc;return function(_0x2e3505){if(_0x2e3505){return _0x519fb9[_0xda24('0x19')](_0x54b23d);}return _0x519fb9[_0xda24('0x1a')](_0x54b23d)[_0xda24('0x1b')]();};}function respondWithResult(_0x4f34a4,_0xef067b){_0xef067b=_0xef067b||0xc8;return function(_0x53dadc){if(_0x53dadc){return _0x4f34a4[_0xda24('0x1a')](_0xef067b)[_0xda24('0x1c')](_0x53dadc);}};}function respondWithFilteredResult(_0x57f4d6,_0x547e1c){return function(_0x53749f){if(_0x53749f){var _0x26764=typeof _0x547e1c[_0xda24('0x1d')]===_0xda24('0x1e')&&typeof _0x547e1c[_0xda24('0x1f')]===_0xda24('0x1e');var _0x8f6c65=_0x53749f[_0xda24('0x20')];var _0x847878=_0x26764?0x0:_0x547e1c['offset'];var _0x22b57d=_0x26764?_0x53749f[_0xda24('0x20')]:_0x547e1c['offset']+_0x547e1c[_0xda24('0x1f')];var _0x510b07;if(_0x22b57d>=_0x8f6c65){_0x22b57d=_0x8f6c65;_0x510b07=0xc8;}else{_0x510b07=0xce;}_0x57f4d6['status'](_0x510b07);return _0x57f4d6[_0xda24('0x21')](_0xda24('0x22'),_0x847878+'-'+_0x22b57d+'/'+_0x8f6c65)[_0xda24('0x1c')](_0x53749f);}return null;};}function patchUpdates(_0x46cb50){return function(_0x3cdeb5){try{jsonpatch[_0xda24('0x23')](_0x3cdeb5,_0x46cb50,!![]);}catch(_0xc7fab5){return BPromise['reject'](_0xc7fab5);}return _0x3cdeb5[_0xda24('0x24')]();};}function saveUpdates(_0x5f53a3,_0x232df2){return function(_0x2fdf18){if(_0x2fdf18){return _0x2fdf18[_0xda24('0x25')](_0x5f53a3)[_0xda24('0x26')](function(_0x17c573){return _0x17c573;});}return null;};}function removeEntity(_0x2f9ae2,_0x454d04){return function(_0xd74f8d){if(_0xd74f8d){return _0xd74f8d[_0xda24('0x27')]()[_0xda24('0x26')](function(){_0x2f9ae2[_0xda24('0x1a')](0xcc)[_0xda24('0x1b')]();});}};}function handleEntityNotFound(_0x5edfc0,_0x468647){return function(_0x30e886){if(!_0x30e886){_0x5edfc0[_0xda24('0x19')](0x194);}return _0x30e886;};}function handleError(_0x35ff0f,_0x196304){_0x196304=_0x196304||0x1f4;return function(_0x3f666b){logger['error'](_0x3f666b[_0xda24('0x28')]);if(_0x3f666b['name']){delete _0x3f666b[_0xda24('0x29')];}_0x35ff0f[_0xda24('0x1a')](_0x196304)['send'](_0x3f666b);};}exports[_0xda24('0x2a')]=function(_0xd6d60f,_0x49a311){var _0x40487d={},_0xc98aa2={},_0x9a6911={'count':0x0,'rows':[]};var _0x11ffb5=_[_0xda24('0x2b')](db['WhatsappApplication']['rawAttributes'],function(_0x20f60d){return{'name':_0x20f60d['fieldName'],'type':_0x20f60d['type'][_0xda24('0x2c')]};});_0xc98aa2[_0xda24('0x2d')]=_['map'](_0x11ffb5,'name');_0xc98aa2[_0xda24('0x2e')]=_[_0xda24('0x2f')](_0xd6d60f['query']);_0xc98aa2['filters']=_[_0xda24('0x30')](_0xc98aa2[_0xda24('0x2d')],_0xc98aa2[_0xda24('0x2e')]);_0x40487d[_0xda24('0x31')]=_[_0xda24('0x30')](_0xc98aa2['model'],qs[_0xda24('0x32')](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x32')]));_0x40487d[_0xda24('0x31')]=_0x40487d['attributes'][_0xda24('0x33')]?_0x40487d['attributes']:_0xc98aa2[_0xda24('0x2d')];if(!_0xd6d60f[_0xda24('0x2e')][_0xda24('0x34')](_0xda24('0x35'))){_0x40487d[_0xda24('0x1f')]=qs['limit'](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x1f')]);_0x40487d[_0xda24('0x1d')]=qs[_0xda24('0x1d')](_0xd6d60f[_0xda24('0x2e')]['offset']);}_0x40487d[_0xda24('0x36')]=qs[_0xda24('0x37')](_0xd6d60f['query']['sort']);_0x40487d['where']=qs[_0xda24('0x38')](_[_0xda24('0x39')](_0xd6d60f[_0xda24('0x2e')],_0xc98aa2[_0xda24('0x38')]),_0x11ffb5);if(_0xd6d60f[_0xda24('0x2e')][_0xda24('0x3a')]){_0x40487d['where']=_[_0xda24('0x3b')](_0x40487d[_0xda24('0x3c')],{'$or':_[_0xda24('0x2b')](_0x11ffb5,function(_0x5aa0aa){if(_0x5aa0aa[_0xda24('0x3d')]!=='VIRTUAL'){var _0x25d0cd={};_0x25d0cd[_0x5aa0aa['name']]={'$like':'%'+_0xd6d60f[_0xda24('0x2e')]['filter']+'%'};return _0x25d0cd;}})});}_0x40487d=_[_0xda24('0x3b')]({},_0x40487d,_0xd6d60f['options']);var _0x5e81e8={'where':_0x40487d[_0xda24('0x3c')]};return db[_0xda24('0x3e')][_0xda24('0x20')](_0x5e81e8)[_0xda24('0x26')](function(_0x46c18b){_0x9a6911[_0xda24('0x20')]=_0x46c18b;if(_0xd6d60f[_0xda24('0x2e')]['includeAll']){_0x40487d[_0xda24('0x3f')]=[{'all':!![]}];}return db[_0xda24('0x3e')][_0xda24('0x40')](_0x40487d);})[_0xda24('0x26')](function(_0xe42050){_0x9a6911[_0xda24('0x41')]=_0xe42050;return _0x9a6911;})[_0xda24('0x26')](respondWithFilteredResult(_0x49a311,_0x40487d))[_0xda24('0x42')](handleError(_0x49a311,null));};exports[_0xda24('0x43')]=function(_0x1aa0eb,_0x4aea76){var _0x3e6597={'raw':!![],'where':{'id':_0x1aa0eb[_0xda24('0x44')]['id']}},_0x61f885={};_0x61f885[_0xda24('0x2d')]=_['keys'](db[_0xda24('0x3e')][_0xda24('0x45')]);_0x61f885['query']=_['keys'](_0x1aa0eb['query']);_0x61f885['filters']=_['intersection'](_0x61f885['model'],_0x61f885[_0xda24('0x2e')]);_0x3e6597[_0xda24('0x31')]=_[_0xda24('0x30')](_0x61f885[_0xda24('0x2d')],qs[_0xda24('0x32')](_0x1aa0eb['query'][_0xda24('0x32')]));_0x3e6597[_0xda24('0x31')]=_0x3e6597[_0xda24('0x31')][_0xda24('0x33')]?_0x3e6597['attributes']:_0x61f885[_0xda24('0x2d')];if(_0x1aa0eb[_0xda24('0x2e')][_0xda24('0x46')]){_0x3e6597[_0xda24('0x3f')]=[{'all':!![]}];}_0x3e6597=_[_0xda24('0x3b')]({},_0x3e6597,_0x1aa0eb['options']);return db['WhatsappApplication'][_0xda24('0x47')](_0x3e6597)[_0xda24('0x26')](handleEntityNotFound(_0x4aea76,null))[_0xda24('0x26')](respondWithResult(_0x4aea76,null))[_0xda24('0x42')](handleError(_0x4aea76,null));};exports[_0xda24('0x48')]=function(_0x37a834,_0xcfcbd5){return db['WhatsappApplication'][_0xda24('0x48')](_0x37a834[_0xda24('0x49')],{})['then'](respondWithResult(_0xcfcbd5,0xc9))['catch'](handleError(_0xcfcbd5,null));};exports[_0xda24('0x25')]=function(_0x2eb12b,_0x302e2b){if(_0x2eb12b['body']['id']){delete _0x2eb12b[_0xda24('0x49')]['id'];}return db[_0xda24('0x3e')][_0xda24('0x47')]({'where':{'id':_0x2eb12b['params']['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x302e2b,null))[_0xda24('0x26')](saveUpdates(_0x2eb12b['body'],null))[_0xda24('0x26')](respondWithResult(_0x302e2b,null))[_0xda24('0x42')](handleError(_0x302e2b,null));};exports[_0xda24('0x27')]=function(_0x264eb0,_0x2f87b7){return db['WhatsappApplication'][_0xda24('0x47')]({'where':{'id':_0x264eb0[_0xda24('0x44')]['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x2f87b7,null))[_0xda24('0x26')](removeEntity(_0x2f87b7,null))['catch'](handleError(_0x2f87b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index fb6266a..6f76842 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 _0xf8b2=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x1cd04a,_0x42da5b){_0x1cd04a=_0x1cd04a-0x0;var _0x4ef486=_0xf8b2[_0x1cd04a];return _0x4ef486;};'use strict';var _=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var logger=require(_0x2f8b('0x2'))(_0x2f8b('0x3'));var moment=require(_0x2f8b('0x4'));var BPromise=require(_0x2f8b('0x5'));var rp=require(_0x2f8b('0x6'));var fs=require('fs');var path=require(_0x2f8b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f8b('0x8'));module[_0x2f8b('0x9')]=function(_0x3c6838,_0x1d133a){return _0x3c6838[_0x2f8b('0xa')](_0x2f8b('0xb'),attributes,{'tableName':_0x2f8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f8b('0xd'),'collate':_0x2f8b('0xe')});}; \ No newline at end of file +var _0xb18e=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x540a89,_0x1c5692){var _0x112298=function(_0xe42610){while(--_0xe42610){_0x540a89['push'](_0x540a89['shift']());}};_0x112298(++_0x1c5692);}(_0xb18e,0x181));var _0xeb18=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xb18e[_0x3c7d53];return _0x2c8387;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('WhatsappApplication',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb18('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index aef0fd2..460c9ce 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x104049,_0x2ef746){var _0x3375e1=function(_0x2d93ce){while(--_0x2d93ce){_0x104049['push'](_0x104049['shift']());}};_0x3375e1(++_0x2ef746);}(_0x81bd,0x7c));var _0xd81b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x81bd[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1fb0d5,_0x163ebe){var _0x1debdb=function(_0x48546a){while(--_0x48546a){_0x1fb0d5['push'](_0x1fb0d5['shift']());}};_0x1debdb(++_0x163ebe);}(_0xe14d,0x1ee));var _0xde14=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe14d[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 14da0b2..89cc1aa 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 _0xa6b0=['/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x500d15,_0x29d099){var _0x584bb7=function(_0xcaa16a){while(--_0xcaa16a){_0x500d15['push'](_0x500d15['shift']());}};_0x584bb7(++_0x29d099);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x442dab,_0xf166db){_0x442dab=_0x442dab-0x0;var _0x3e2662=_0xa6b0[_0x442dab];return _0x3e2662;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0x8')](_0x0a6b('0xe'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x8')](_0x0a6b('0x10'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);router[_0x0a6b('0x12')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x13')]);router[_0x0a6b('0x12')](_0x0a6b('0xe'),auth[_0x0a6b('0x9')](),controller['addMessage']);router['post'](_0x0a6b('0x14'),auth[_0x0a6b('0x9')](),interaction[_0x0a6b('0x15')](_0x0a6b('0x16'),_0x0a6b('0x17')),controller[_0x0a6b('0x18')]);router[_0x0a6b('0x19')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),interaction[_0x0a6b('0x15')]('whatsapp',_0x0a6b('0x1a')),controller[_0x0a6b('0x1b')]);router['delete'](_0x0a6b('0xd'),auth['isAuthenticated'](),interaction[_0x0a6b('0x15')](_0x0a6b('0x16'),_0x0a6b('0x1c')),controller[_0x0a6b('0x1d')]);router['delete'](_0x0a6b('0x14'),auth[_0x0a6b('0x9')](),controller['removeTags']);module[_0x0a6b('0x1e')]=router; \ No newline at end of file +var _0xdf98=['create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','/:id','tracked','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download'];(function(_0xb546c6,_0x3f59bd){var _0x1e5197=function(_0x24fe5b){while(--_0x24fe5b){_0xb546c6['push'](_0xb546c6['shift']());}};_0x1e5197(++_0x3f59bd);}(_0xdf98,0xcf));var _0x8df9=function(_0x3abe2f,_0x1bdf2b){_0x3abe2f=_0x3abe2f-0x0;var _0x3f81e6=_0xdf98[_0x3abe2f];return _0x3f81e6;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0x8')](_0x8df9('0xd'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0x8')](_0x8df9('0xf'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);router['post']('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id/messages',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);router[_0x8df9('0x12')](_0x8df9('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x8df9('0x15'),_0x8df9('0x16')),controller[_0x8df9('0x17')]);router['put'](_0x8df9('0x18'),auth['isAuthenticated'](),interaction[_0x8df9('0x19')]('whatsapp',_0x8df9('0x1a')),controller[_0x8df9('0x1b')]);router[_0x8df9('0x1c')](_0x8df9('0x18'),auth[_0x8df9('0x9')](),interaction[_0x8df9('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8df9('0x1d')]);router['delete']('/:id/tags',auth[_0x8df9('0x9')](),controller[_0x8df9('0x1e')]);module[_0x8df9('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 38c6010..71a8aa6 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 _0x8a9a=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','moment'];(function(_0x4de7e3,_0x193b7a){var _0x334320=function(_0x583d43){while(--_0x583d43){_0x4de7e3['push'](_0x4de7e3['shift']());}};_0x334320(++_0x193b7a);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x8a9a[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa8a9('0x0'));module[_0xa8a9('0x1')]={'closed':{'type':Sequelize[_0xa8a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8a9('0x3')]},'disposition':{'type':Sequelize[_0xa8a9('0x4')]},'secondDisposition':{'type':Sequelize[_0xa8a9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa8a9('0x4')]},'note':{'type':Sequelize[_0xa8a9('0x4')]},'phone':{'type':Sequelize[_0xa8a9('0x4')]},'read1stAt':{'type':Sequelize[_0xa8a9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa8a9('0x5')]('in',_0xa8a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa8a9('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8a9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa8a9('0x7')]}}; \ No newline at end of file +var _0x3f48=['ENUM','INTEGER','exports','BOOLEAN','DATE','STRING','out'];(function(_0x4640c1,_0x3f7e47){var _0x5639cf=function(_0xc6e563){while(--_0xc6e563){_0x4640c1['push'](_0x4640c1['shift']());}};_0x5639cf(++_0x3f7e47);}(_0x3f48,0x17c));var _0x83f4=function(_0x3bd041,_0x4befac){_0x3bd041=_0x3bd041-0x0;var _0x59f5cc=_0x3f48[_0x3bd041];return _0x59f5cc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x83f4('0x0')]={'closed':{'type':Sequelize[_0x83f4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x83f4('0x2')]},'disposition':{'type':Sequelize[_0x83f4('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x83f4('0x3')]},'note':{'type':Sequelize[_0x83f4('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x83f4('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x83f4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x83f4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x83f4('0x5')]('in',_0x83f4('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x83f4('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x83f4('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4cc2053..0055cce 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 _0xe0e0=['fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','Contact','renderFile','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','send','index','map','WhatsappInteraction','rawAttributes','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filters','nolimit','order','sort','WhatsappInteractionId','where','filter','$gte','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','attachments','join','format','push','User'];(function(_0x2ad2a4,_0x2af6ed){var _0x554d3a=function(_0x388ce9){while(--_0x388ce9){_0x2ad2a4['push'](_0x2ad2a4['shift']());}};_0x554d3a(++_0x2af6ed);}(_0xe0e0,0x11d));var _0x0e0e=function(_0x543635,_0x26a2a2){_0x543635=_0x543635-0x0;var _0x2df8db=_0xe0e0[_0x543635];return _0x2df8db;};'use strict';var rimraf=require(_0x0e0e('0x0'));var zipdir=require(_0x0e0e('0x1'));var moment=require(_0x0e0e('0x2'));var BPromise=require(_0x0e0e('0x3'));var util=require('util');var path=require(_0x0e0e('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e0e('0x5'));var Redis=require(_0x0e0e('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x0e0e('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x0e0e('0x8'))(_0x0e0e('0x9'));var config=require(_0x0e0e('0xa'));var db=require(_0x0e0e('0xb'))['db'];config[_0x0e0e('0xc')]=_[_0x0e0e('0xd')](config['redis'],{'host':_0x0e0e('0xe'),'port':0x18eb});var socket=require(_0x0e0e('0xf'))(new Redis(config[_0x0e0e('0xc')]));require(_0x0e0e('0x10'))[_0x0e0e('0x11')](socket);function respondWithStatusCode(_0x11801f,_0x3b4e51){_0x3b4e51=_0x3b4e51||0xcc;return function(_0x3ec434){if(_0x3ec434){return _0x11801f[_0x0e0e('0x12')](_0x3b4e51);}return _0x11801f[_0x0e0e('0x13')](_0x3b4e51)[_0x0e0e('0x14')]();};}function respondWithResult(_0x1829f2,_0x1d74d8){_0x1d74d8=_0x1d74d8||0xc8;return function(_0x1b7851){if(_0x1b7851){return _0x1829f2[_0x0e0e('0x13')](_0x1d74d8)['json'](_0x1b7851);}};}function respondWithFilteredResult(_0x2c3ae4,_0x5391be){return function(_0xd91286){if(_0xd91286){var _0x5a03c7=typeof _0x5391be[_0x0e0e('0x15')]===_0x0e0e('0x16')&&typeof _0x5391be[_0x0e0e('0x17')]===_0x0e0e('0x16');var _0x1cacc9=_0xd91286[_0x0e0e('0x18')];var _0x2bc12a=_0x5a03c7?0x0:_0x5391be[_0x0e0e('0x15')];var _0x14930f=_0x5a03c7?_0xd91286[_0x0e0e('0x18')]:_0x5391be['offset']+_0x5391be[_0x0e0e('0x17')];var _0x14abdd;if(_0x14930f>=_0x1cacc9){_0x14930f=_0x1cacc9;_0x14abdd=0xc8;}else{_0x14abdd=0xce;}_0x2c3ae4['status'](_0x14abdd);return _0x2c3ae4[_0x0e0e('0x19')](_0x0e0e('0x1a'),_0x2bc12a+'-'+_0x14930f+'/'+_0x1cacc9)[_0x0e0e('0x1b')](_0xd91286);}return null;};}function saveUpdates(_0x5ed48d){return function(_0x396b22){if(_0x396b22){return _0x396b22[_0x0e0e('0x1c')](_0x5ed48d)[_0x0e0e('0x1d')](function(_0x16e103){return _0x16e103;});}return null;};}function removeEntity(_0x19ec4a){return function(_0x366e1c){if(_0x366e1c){return _0x366e1c[_0x0e0e('0x1e')]()[_0x0e0e('0x1d')](function(){_0x19ec4a[_0x0e0e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23c7cf){return function(_0x4b8a46){if(!_0x4b8a46){_0x23c7cf[_0x0e0e('0x12')](0x194);}return _0x4b8a46;};}function handleError(_0x12dd9a,_0x41fa08){_0x41fa08=_0x41fa08||0x1f4;return function(_0x5df621){logger[_0x0e0e('0x1f')](_0x5df621['stack']);if(_0x5df621[_0x0e0e('0x20')]){delete _0x5df621['name'];}_0x12dd9a[_0x0e0e('0x13')](_0x41fa08)[_0x0e0e('0x21')](_0x5df621);};}exports[_0x0e0e('0x22')]=function(_0x5a2093,_0x9ab086){var _0x26a3eb={};var _0x6d2c91=_[_0x0e0e('0x23')](db[_0x0e0e('0x24')][_0x0e0e('0x25')],function(_0x393987){return{'name':_0x393987['fieldName'],'type':_0x393987[_0x0e0e('0x26')]['key']};});_0x26a3eb=qs[_0x0e0e('0x27')](_0x6d2c91,_0x5a2093);return interaction[_0x0e0e('0x28')](_0x0e0e('0x29'),_0x5a2093[_0x0e0e('0x2a')],_0x5a2093[_0x0e0e('0x2b')],_0x26a3eb,_0x6d2c91)['then'](respondWithFilteredResult(_0x9ab086,_0x26a3eb))[_0x0e0e('0x2c')](handleError(_0x9ab086,null));};exports[_0x0e0e('0x2d')]=function(_0x240d7,_0x44ab5f){var _0x2cfa9b={'raw':![],'where':{'id':_0x240d7[_0x0e0e('0x2e')]['id']}},_0x3de9e8={};_0x3de9e8[_0x0e0e('0x2f')]=_[_0x0e0e('0x30')](db[_0x0e0e('0x24')][_0x0e0e('0x25')]);_0x3de9e8['query']=_['keys'](_0x240d7['query']);_0x3de9e8['filters']=_[_0x0e0e('0x31')](_0x3de9e8[_0x0e0e('0x2f')],_0x3de9e8[_0x0e0e('0x2a')]);_0x2cfa9b[_0x0e0e('0x32')]=_['intersection'](_0x3de9e8['model'],qs['fields'](_0x240d7[_0x0e0e('0x2a')][_0x0e0e('0x33')]));_0x2cfa9b[_0x0e0e('0x32')]=_0x2cfa9b[_0x0e0e('0x32')][_0x0e0e('0x34')]?_0x2cfa9b['attributes']:_0x3de9e8[_0x0e0e('0x2f')];if(_0x240d7[_0x0e0e('0x2a')][_0x0e0e('0x35')]){_0x2cfa9b[_0x0e0e('0x36')]=[{'all':!![]}];}_0x2cfa9b=_[_0x0e0e('0x37')]({},_0x2cfa9b,_0x240d7[_0x0e0e('0x38')]);return db[_0x0e0e('0x24')]['find'](_0x2cfa9b)[_0x0e0e('0x1d')](handleEntityNotFound(_0x44ab5f,null))['then'](respondWithResult(_0x44ab5f,null))['catch'](handleError(_0x44ab5f,null));};exports[_0x0e0e('0x39')]=function(_0x4c5e4d,_0x38a4ff){return db[_0x0e0e('0x24')][_0x0e0e('0x39')](_0x4c5e4d[_0x0e0e('0x3a')],{})[_0x0e0e('0x1d')](respondWithResult(_0x38a4ff,0xc9))[_0x0e0e('0x2c')](handleError(_0x38a4ff,null));};exports['update']=function(_0x582da5,_0x5f09f6){if(_0x582da5[_0x0e0e('0x3a')]['id']){delete _0x582da5['body']['id'];}return db[_0x0e0e('0x24')][_0x0e0e('0x3b')]({'where':{'id':_0x582da5[_0x0e0e('0x2e')]['id']}})[_0x0e0e('0x1d')](handleEntityNotFound(_0x5f09f6,null))[_0x0e0e('0x1d')](saveUpdates(_0x582da5[_0x0e0e('0x3a')],null))['then'](respondWithResult(_0x5f09f6,null))[_0x0e0e('0x2c')](handleError(_0x5f09f6,null));};exports[_0x0e0e('0x1e')]=function(_0x1b1f55,_0x13eb2c){return db[_0x0e0e('0x24')]['find']({'where':{'id':_0x1b1f55['params']['id']}})['then'](handleEntityNotFound(_0x13eb2c,null))[_0x0e0e('0x1d')](removeEntity(_0x13eb2c,null))[_0x0e0e('0x2c')](handleError(_0x13eb2c,null));};exports[_0x0e0e('0x3c')]=function(_0x43b8d3,_0x4d8f24){return db[_0x0e0e('0x24')][_0x0e0e('0x3c')]()[_0x0e0e('0x1d')](respondWithResult(_0x4d8f24,null))['catch'](handleError(_0x4d8f24,null));};exports[_0x0e0e('0x3d')]=function(_0x1d9f7f,_0x16db4f){return db[_0x0e0e('0x3e')]['find']({'where':{'id':_0x1d9f7f[_0x0e0e('0x2e')]['id']}})[_0x0e0e('0x1d')](handleEntityNotFound(_0x16db4f,null))[_0x0e0e('0x1d')](function(_0x2f2b81){if(_0x2f2b81){return _0x2f2b81[_0x0e0e('0x3d')](_0x1d9f7f['body'][_0x0e0e('0x3f')],_[_0x0e0e('0x40')](_0x1d9f7f[_0x0e0e('0x3a')],[_0x0e0e('0x3f'),'id'])||{});}})[_0x0e0e('0x1d')](respondWithResult(_0x16db4f,null))[_0x0e0e('0x2c')](handleError(_0x16db4f,null));};exports[_0x0e0e('0x41')]=function(_0x552050,_0x3844f1){var _0x4cf0d9={'raw':![],'where':{}};var _0x2adf20={};var _0x6304a8={'count':0x0,'rows':[]};return db[_0x0e0e('0x24')][_0x0e0e('0x42')]({'where':{'id':_0x552050[_0x0e0e('0x2e')]['id']}})[_0x0e0e('0x1d')](handleEntityNotFound(_0x3844f1,null))[_0x0e0e('0x1d')](function(_0x12fe6b){if(_0x12fe6b){_0x2adf20[_0x0e0e('0x2f')]=_['keys'](db[_0x0e0e('0x3e')][_0x0e0e('0x25')]);_0x2adf20[_0x0e0e('0x2a')]=_[_0x0e0e('0x30')](_0x552050['query']);_0x2adf20[_0x0e0e('0x43')]=_[_0x0e0e('0x31')](_0x2adf20[_0x0e0e('0x2f')],_0x2adf20[_0x0e0e('0x2a')]);_0x4cf0d9['attributes']=_[_0x0e0e('0x31')](_0x2adf20[_0x0e0e('0x2f')],qs[_0x0e0e('0x33')](_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x33')]));_0x4cf0d9[_0x0e0e('0x32')]=_0x4cf0d9[_0x0e0e('0x32')]['length']?_0x4cf0d9['attributes']:_0x2adf20[_0x0e0e('0x2f')];if(!_0x552050[_0x0e0e('0x2a')]['hasOwnProperty'](_0x0e0e('0x44'))){_0x4cf0d9[_0x0e0e('0x17')]=qs[_0x0e0e('0x17')](_0x552050['query'][_0x0e0e('0x17')]);_0x4cf0d9[_0x0e0e('0x15')]=qs[_0x0e0e('0x15')](_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x15')]);}_0x4cf0d9[_0x0e0e('0x45')]=qs['sort'](_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x46')]);_0x4cf0d9['where']=qs[_0x0e0e('0x43')](_['pick'](_0x552050[_0x0e0e('0x2a')],_0x2adf20[_0x0e0e('0x43')]));_0x4cf0d9['where'][_0x0e0e('0x47')]=_0x12fe6b['id'];if(_0x552050[_0x0e0e('0x2a')]['filter']){_0x4cf0d9[_0x0e0e('0x48')]=_[_0x0e0e('0x37')](_0x4cf0d9[_0x0e0e('0x48')],{'$or':_[_0x0e0e('0x23')](_0x4cf0d9[_0x0e0e('0x32')],function(_0x2e95a4){var _0x1c5ac4={};_0x1c5ac4[_0x2e95a4]={'$like':'%'+_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x49')]+'%'};return _0x1c5ac4;})});}if(_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x4a')]){var _0x5061f5=_0x552050[_0x0e0e('0x2a')][_0x0e0e('0x4a')]['split'](',');var _0x1fc98d={};_0x1fc98d[_0x5061f5[0x0]]={'$gte':moment(_0x5061f5[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4cf0d9[_0x0e0e('0x48')]=_['merge'](_0x4cf0d9[_0x0e0e('0x48')],_0x1fc98d);}_0x4cf0d9=_['merge']({},_0x4cf0d9,_0x552050[_0x0e0e('0x38')]);return db['WhatsappMessage'][_0x0e0e('0x18')]({'where':_0x4cf0d9[_0x0e0e('0x48')]})[_0x0e0e('0x1d')](function(_0x4b6bf3){_0x6304a8[_0x0e0e('0x18')]=_0x4b6bf3;if(_0x552050['query'][_0x0e0e('0x35')]){_0x4cf0d9['include']=[{'all':!![]}];}return db[_0x0e0e('0x3e')][_0x0e0e('0x28')](_0x4cf0d9);})[_0x0e0e('0x1d')](function(_0x3fa146){_0x6304a8['rows']=_0x3fa146;return _0x6304a8;});}})['then'](respondWithFilteredResult(_0x3844f1,_0x4cf0d9))[_0x0e0e('0x2c')](handleError(_0x3844f1,null));};exports['addTags']=function(_0x2e7922,_0x118bee){return db[_0x0e0e('0x24')][_0x0e0e('0x3b')]({'where':{'id':_0x2e7922[_0x0e0e('0x2e')]['id']}})[_0x0e0e('0x1d')](handleEntityNotFound(_0x118bee,null))[_0x0e0e('0x1d')](function(_0x27df4d){if(_0x27df4d){return _0x27df4d[_0x0e0e('0x4b')](_0x2e7922[_0x0e0e('0x3a')][_0x0e0e('0x3f')],_[_0x0e0e('0x40')](_0x2e7922[_0x0e0e('0x3a')],['ids','id'])||{})[_0x0e0e('0x4c')](function(){return db[_0x0e0e('0x4d')][_0x0e0e('0x28')]({'attributes':['id','name',_0x0e0e('0x4e')],'where':{'id':_0x2e7922[_0x0e0e('0x3a')][_0x0e0e('0x3f')]}});})[_0x0e0e('0x1d')](function(_0x246c6f){socket[_0x0e0e('0x4f')](_0x0e0e('0x50'),{'id':Number(_0x2e7922[_0x0e0e('0x2e')]['id']),'tags':_0x246c6f||[]});return{'id':Number(_0x2e7922['params']['id']),'tags':_0x246c6f||[]};});}})['then'](respondWithResult(_0x118bee,null))[_0x0e0e('0x2c')](handleError(_0x118bee,null));};exports['removeTags']=function(_0x443f10,_0x400497){return db[_0x0e0e('0x24')]['find']({'where':{'id':_0x443f10['params']['id']}})[_0x0e0e('0x1d')](handleEntityNotFound(_0x400497,null))[_0x0e0e('0x1d')](function(_0x24b90c){if(_0x24b90c){return _0x24b90c[_0x0e0e('0x51')](_0x443f10[_0x0e0e('0x2a')][_0x0e0e('0x3f')]);}})['then'](respondWithStatusCode(_0x400497,null))[_0x0e0e('0x2c')](handleError(_0x400497,null));};exports[_0x0e0e('0x52')]=function(_0x13dab2,_0x36c6d8){var _0x1a7cb4=moment()[_0x0e0e('0x53')]()[_0x0e0e('0x54')]();var _0x3f3704=path['join'](config[_0x0e0e('0x55')],_0x0e0e('0x56'),_0x0e0e('0x57'),'tmp');var _0x23574c=path['join'](config[_0x0e0e('0x55')],'server',_0x0e0e('0x57'),_0x0e0e('0x58'));var _0x3e5500=path[_0x0e0e('0x59')](_0x3f3704,_0x1a7cb4);var _0x28a563=util[_0x0e0e('0x5a')]('transcript-%d-%s.zip',_0x13dab2[_0x0e0e('0x2e')]['id'],_0x1a7cb4);var _0x3ec7d5=path['join'](_0x3f3704,_0x28a563);var _0x167a78=[];_0x167a78[_0x0e0e('0x5b')]({'model':db[_0x0e0e('0x5c')],'as':_0x0e0e('0x5c'),'attributes':['id',_0x0e0e('0x5d')],'raw':!![]});_0x167a78[_0x0e0e('0x5b')]({'model':db[_0x0e0e('0x5e')],'as':'Contact','attributes':['id',_0x0e0e('0x5f'),_0x0e0e('0x60')],'raw':!![]});if(_0x13dab2['query']['attachments']){_0x167a78[_0x0e0e('0x5b')]({'model':db[_0x0e0e('0x61')],'as':_0x0e0e('0x61'),'raw':!![]});}var _0x2d32e0=[{'model':db[_0x0e0e('0x3e')],'as':_0x0e0e('0x62'),'attributes':['id',_0x0e0e('0x3a'),_0x0e0e('0x63'),_0x0e0e('0x64'),'secret',_0x0e0e('0x65')],'include':_0x167a78}];_0x2d32e0[_0x0e0e('0x5b')]({'model':db[_0x0e0e('0x66')],'as':_0x0e0e('0x67'),'attributes':['id',_0x0e0e('0x20')]});_0x2d32e0[_0x0e0e('0x5b')]({'model':db['User'],'as':_0x0e0e('0x68'),'attributes':['id','fullname']});return db[_0x0e0e('0x24')][_0x0e0e('0x3b')]({'where':{'id':_0x13dab2[_0x0e0e('0x2e')]['id']},'include':_0x2d32e0})[_0x0e0e('0x1d')](handleEntityNotFound(_0x36c6d8,null))[_0x0e0e('0x1d')](function(_0x436f74){if(_0x436f74){var _0x1aa5c4=_0x436f74[_0x0e0e('0x69')]({'plain':!![]});fs[_0x0e0e('0x6a')](_0x3e5500);var _0x364776={'channel':_0x0e0e('0x6b'),'account':_0x1aa5c4[_0x0e0e('0x67')][_0x0e0e('0x20')],'agent':_0x1aa5c4[_0x0e0e('0x68')]?_0x1aa5c4['Owner'][_0x0e0e('0x5d')]:_0x0e0e('0x6c'),'createdAt':moment(_0x1aa5c4[_0x0e0e('0x63')])[_0x0e0e('0x5a')](_0x0e0e('0x6d'))[_0x0e0e('0x54')](),'closedAt':_0x1aa5c4[_0x0e0e('0x6e')]?moment(_0x1aa5c4[_0x0e0e('0x6f')])[_0x0e0e('0x5a')](_0x0e0e('0x6d'))[_0x0e0e('0x54')]():'','disposition':_0x1aa5c4[_0x0e0e('0x70')],'messages':_(_0x1aa5c4[_0x0e0e('0x62')])[_0x0e0e('0x49')]({'secret':![]})['map'](function(_0x57d6f7){if(_0x57d6f7[_0x0e0e('0x61')]){var _0x1c1c30=path[_0x0e0e('0x59')](_0x23574c,_0x57d6f7[_0x0e0e('0x61')]['basename']);if(fs[_0x0e0e('0x71')](_0x1c1c30)){fs[_0x0e0e('0x72')](_0x1c1c30)[_0x0e0e('0x73')](fs[_0x0e0e('0x74')](path['join'](_0x3e5500,_0x57d6f7[_0x0e0e('0x61')][_0x0e0e('0x75')])));}}return{'date':moment(_0x57d6f7['createdAt'])[_0x0e0e('0x5a')](_0x0e0e('0x6d'))['toString'](),'sender':_0x57d6f7[_0x0e0e('0x64')]===_0x0e0e('0x76')?_0x57d6f7[_0x0e0e('0x5c')]?_0x57d6f7[_0x0e0e('0x5c')][_0x0e0e('0x5d')]:'System':_0x57d6f7[_0x0e0e('0x77')][_0x0e0e('0x5f')]+(_0x57d6f7[_0x0e0e('0x77')][_0x0e0e('0x60')]?'\x20'+_0x57d6f7[_0x0e0e('0x77')][_0x0e0e('0x60')]:''),'body':_0x57d6f7[_0x0e0e('0x61')]?_0x57d6f7[_0x0e0e('0x61')]['basename']:_0x57d6f7[_0x0e0e('0x3a')],'direction':_0x57d6f7[_0x0e0e('0x64')]==='out'?'A':'C','secret':_0x57d6f7['secret'],'read':_0x57d6f7['read'],'attachment':_0x57d6f7[_0x0e0e('0x61')]};})['value']()};return ejs[_0x0e0e('0x78')](path[_0x0e0e('0x59')](config[_0x0e0e('0x55')],_0x0e0e('0x56'),'views',_0x0e0e('0x79')),{'interaction':_0x364776})[_0x0e0e('0x1d')](function(_0x2e389d){var _0x2bebeb=path[_0x0e0e('0x59')](_0x3e5500,_0x0e0e('0x7a')+_0x1aa5c4['id']+'-'+_0x1a7cb4+_0x0e0e('0x7b'));var _0x31e7f8={'path':_0x2bebeb,'channel':'Whatsapp','interactionId':_0x1aa5c4['id']};return pdf['createPdfFromHTML'](_0x2e389d,_0x31e7f8);})[_0x0e0e('0x1d')](function(){return new BPromise(function(_0x556e85,_0x47adbb){zipdir(_0x3e5500,{'saveTo':_0x3ec7d5},function(_0x5abd39,_0x20b5f2){if(_0x5abd39)return _0x47adbb(_0x5abd39);return _0x556e85(_0x20b5f2);});})[_0x0e0e('0x1d')](function(){return new BPromise(function(_0x1a46eb,_0x28ccfb){rimraf(_0x3e5500,function(_0x294892){if(_0x294892)_0x28ccfb(_0x294892);return _0x1a46eb();});});})[_0x0e0e('0x1d')](function(){return _0x36c6d8[_0x0e0e('0x52')](_0x3ec7d5,_0x28a563,function(_0x370988){if(_0x370988){console['log'](_0x0e0e('0x7c'),_0x370988);}else{fs[_0x0e0e('0x7d')](_0x3ec7d5);}});});});}else{return _0x36c6d8[_0x0e0e('0x12')](0xc8);}})[_0x0e0e('0x2c')](handleError(_0x36c6d8,null));}; \ No newline at end of file +var _0xaf69=['nolimit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction','System','out','secret','read','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','zip-dir','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','whatsapp','query','user','catch','show','params','model','attributes','intersection','fields','length','include','merge','options','find','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','filters','hasOwnProperty'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xaf69,0x13c));var _0x9af6=function(_0x154676,_0x339d44){_0x154676=_0x154676-0x0;var _0x4ecc12=_0xaf69[_0x154676];return _0x4ecc12;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9af6('0x0'));var moment=require('moment');var BPromise=require(_0x9af6('0x1'));var util=require(_0x9af6('0x2'));var path=require('path');var ejs=require(_0x9af6('0x3'));var fs=require('fs');var _=require(_0x9af6('0x4'));var Redis=require(_0x9af6('0x5'));var interaction=require(_0x9af6('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9af6('0x7'));var logger=require('../../config/logger')(_0x9af6('0x8'));var config=require(_0x9af6('0x9'));var db=require(_0x9af6('0xa'))['db'];config[_0x9af6('0xb')]=_['defaults'](config[_0x9af6('0xb')],{'host':_0x9af6('0xc'),'port':0x18eb});var socket=require(_0x9af6('0xd'))(new Redis(config[_0x9af6('0xb')]));require(_0x9af6('0xe'))[_0x9af6('0xf')](socket);function respondWithStatusCode(_0x19aac7,_0x4bcfec){_0x4bcfec=_0x4bcfec||0xcc;return function(_0x5f0b70){if(_0x5f0b70){return _0x19aac7[_0x9af6('0x10')](_0x4bcfec);}return _0x19aac7[_0x9af6('0x11')](_0x4bcfec)['end']();};}function respondWithResult(_0x5e5b59,_0x5e8e22){_0x5e8e22=_0x5e8e22||0xc8;return function(_0x5d5ed9){if(_0x5d5ed9){return _0x5e5b59['status'](_0x5e8e22)['json'](_0x5d5ed9);}};}function respondWithFilteredResult(_0x11edcb,_0x34ac09){return function(_0x4aea8b){if(_0x4aea8b){var _0x3d83e6=typeof _0x34ac09[_0x9af6('0x12')]===_0x9af6('0x13')&&typeof _0x34ac09[_0x9af6('0x14')]===_0x9af6('0x13');var _0x3b81cf=_0x4aea8b[_0x9af6('0x15')];var _0x4bfbc0=_0x3d83e6?0x0:_0x34ac09[_0x9af6('0x12')];var _0x3fd1ed=_0x3d83e6?_0x4aea8b[_0x9af6('0x15')]:_0x34ac09['offset']+_0x34ac09[_0x9af6('0x14')];var _0x21782f;if(_0x3fd1ed>=_0x3b81cf){_0x3fd1ed=_0x3b81cf;_0x21782f=0xc8;}else{_0x21782f=0xce;}_0x11edcb[_0x9af6('0x11')](_0x21782f);return _0x11edcb[_0x9af6('0x16')](_0x9af6('0x17'),_0x4bfbc0+'-'+_0x3fd1ed+'/'+_0x3b81cf)[_0x9af6('0x18')](_0x4aea8b);}return null;};}function saveUpdates(_0x43cc01){return function(_0x1e3163){if(_0x1e3163){return _0x1e3163['update'](_0x43cc01)[_0x9af6('0x19')](function(_0x45e24e){return _0x45e24e;});}return null;};}function removeEntity(_0x8b0a7c){return function(_0x227304){if(_0x227304){return _0x227304[_0x9af6('0x1a')]()[_0x9af6('0x19')](function(){_0x8b0a7c[_0x9af6('0x11')](0xcc)[_0x9af6('0x1b')]();});}};}function handleEntityNotFound(_0x3aaf87){return function(_0x2dadb5){if(!_0x2dadb5){_0x3aaf87[_0x9af6('0x10')](0x194);}return _0x2dadb5;};}function handleError(_0x457a5a,_0x583572){_0x583572=_0x583572||0x1f4;return function(_0x1e2000){logger[_0x9af6('0x1c')](_0x1e2000[_0x9af6('0x1d')]);if(_0x1e2000[_0x9af6('0x1e')]){delete _0x1e2000[_0x9af6('0x1e')];}_0x457a5a[_0x9af6('0x11')](_0x583572)[_0x9af6('0x1f')](_0x1e2000);};}exports['index']=function(_0x4b1eae,_0x18c223){var _0x37a551={};var _0x201e24=_[_0x9af6('0x20')](db[_0x9af6('0x21')][_0x9af6('0x22')],function(_0x5fa270){return{'name':_0x5fa270[_0x9af6('0x23')],'type':_0x5fa270[_0x9af6('0x24')][_0x9af6('0x25')]};});_0x37a551=qs['getOptions'](_0x201e24,_0x4b1eae);return interaction['findAll'](_0x9af6('0x26'),_0x4b1eae[_0x9af6('0x27')],_0x4b1eae[_0x9af6('0x28')],_0x37a551,_0x201e24)[_0x9af6('0x19')](respondWithFilteredResult(_0x18c223,_0x37a551))[_0x9af6('0x29')](handleError(_0x18c223,null));};exports[_0x9af6('0x2a')]=function(_0x3313b7,_0x47869c){var _0x119eb6={'raw':![],'where':{'id':_0x3313b7[_0x9af6('0x2b')]['id']}},_0xe0452f={};_0xe0452f[_0x9af6('0x2c')]=_['keys'](db[_0x9af6('0x21')][_0x9af6('0x22')]);_0xe0452f[_0x9af6('0x27')]=_['keys'](_0x3313b7[_0x9af6('0x27')]);_0xe0452f['filters']=_['intersection'](_0xe0452f[_0x9af6('0x2c')],_0xe0452f[_0x9af6('0x27')]);_0x119eb6[_0x9af6('0x2d')]=_[_0x9af6('0x2e')](_0xe0452f['model'],qs[_0x9af6('0x2f')](_0x3313b7['query'][_0x9af6('0x2f')]));_0x119eb6[_0x9af6('0x2d')]=_0x119eb6[_0x9af6('0x2d')][_0x9af6('0x30')]?_0x119eb6['attributes']:_0xe0452f[_0x9af6('0x2c')];if(_0x3313b7[_0x9af6('0x27')]['includeAll']){_0x119eb6[_0x9af6('0x31')]=[{'all':!![]}];}_0x119eb6=_[_0x9af6('0x32')]({},_0x119eb6,_0x3313b7[_0x9af6('0x33')]);return db[_0x9af6('0x21')][_0x9af6('0x34')](_0x119eb6)['then'](handleEntityNotFound(_0x47869c,null))[_0x9af6('0x19')](respondWithResult(_0x47869c,null))[_0x9af6('0x29')](handleError(_0x47869c,null));};exports[_0x9af6('0x35')]=function(_0x44ed28,_0x355209){return db[_0x9af6('0x21')][_0x9af6('0x35')](_0x44ed28['body'],{})[_0x9af6('0x19')](respondWithResult(_0x355209,0xc9))[_0x9af6('0x29')](handleError(_0x355209,null));};exports['update']=function(_0x34fe35,_0x5e01de){if(_0x34fe35[_0x9af6('0x36')]['id']){delete _0x34fe35[_0x9af6('0x36')]['id'];}return db[_0x9af6('0x21')][_0x9af6('0x34')]({'where':{'id':_0x34fe35[_0x9af6('0x2b')]['id']}})[_0x9af6('0x19')](handleEntityNotFound(_0x5e01de,null))[_0x9af6('0x19')](saveUpdates(_0x34fe35[_0x9af6('0x36')],null))[_0x9af6('0x19')](respondWithResult(_0x5e01de,null))[_0x9af6('0x29')](handleError(_0x5e01de,null));};exports[_0x9af6('0x1a')]=function(_0x4d335c,_0x5bb84f){return db['WhatsappInteraction'][_0x9af6('0x34')]({'where':{'id':_0x4d335c['params']['id']}})['then'](handleEntityNotFound(_0x5bb84f,null))['then'](removeEntity(_0x5bb84f,null))['catch'](handleError(_0x5bb84f,null));};exports[_0x9af6('0x37')]=function(_0xf8483d,_0x2b05a9){return db[_0x9af6('0x21')][_0x9af6('0x37')]()[_0x9af6('0x19')](respondWithResult(_0x2b05a9,null))[_0x9af6('0x29')](handleError(_0x2b05a9,null));};exports[_0x9af6('0x38')]=function(_0xca1d0c,_0x5855ae){return db[_0x9af6('0x39')][_0x9af6('0x34')]({'where':{'id':_0xca1d0c['params']['id']}})[_0x9af6('0x19')](handleEntityNotFound(_0x5855ae,null))[_0x9af6('0x19')](function(_0x32cb4a){if(_0x32cb4a){return _0x32cb4a['addMessage'](_0xca1d0c['body'][_0x9af6('0x3a')],_[_0x9af6('0x3b')](_0xca1d0c[_0x9af6('0x36')],['ids','id'])||{});}})[_0x9af6('0x19')](respondWithResult(_0x5855ae,null))[_0x9af6('0x29')](handleError(_0x5855ae,null));};exports[_0x9af6('0x3c')]=function(_0x121e27,_0x4291c1){var _0x31e218={'raw':![],'where':{}};var _0x7b6a2e={};var _0x9d0a8a={'count':0x0,'rows':[]};return db[_0x9af6('0x21')][_0x9af6('0x3d')]({'where':{'id':_0x121e27[_0x9af6('0x2b')]['id']}})[_0x9af6('0x19')](handleEntityNotFound(_0x4291c1,null))[_0x9af6('0x19')](function(_0x275511){if(_0x275511){_0x7b6a2e[_0x9af6('0x2c')]=_['keys'](db['WhatsappMessage'][_0x9af6('0x22')]);_0x7b6a2e[_0x9af6('0x27')]=_[_0x9af6('0x3e')](_0x121e27['query']);_0x7b6a2e[_0x9af6('0x3f')]=_['intersection'](_0x7b6a2e[_0x9af6('0x2c')],_0x7b6a2e[_0x9af6('0x27')]);_0x31e218[_0x9af6('0x2d')]=_[_0x9af6('0x2e')](_0x7b6a2e[_0x9af6('0x2c')],qs[_0x9af6('0x2f')](_0x121e27[_0x9af6('0x27')][_0x9af6('0x2f')]));_0x31e218[_0x9af6('0x2d')]=_0x31e218[_0x9af6('0x2d')][_0x9af6('0x30')]?_0x31e218[_0x9af6('0x2d')]:_0x7b6a2e[_0x9af6('0x2c')];if(!_0x121e27[_0x9af6('0x27')][_0x9af6('0x40')](_0x9af6('0x41'))){_0x31e218['limit']=qs[_0x9af6('0x14')](_0x121e27[_0x9af6('0x27')][_0x9af6('0x14')]);_0x31e218['offset']=qs[_0x9af6('0x12')](_0x121e27[_0x9af6('0x27')][_0x9af6('0x12')]);}_0x31e218[_0x9af6('0x42')]=qs[_0x9af6('0x43')](_0x121e27[_0x9af6('0x27')][_0x9af6('0x43')]);_0x31e218['where']=qs[_0x9af6('0x3f')](_[_0x9af6('0x44')](_0x121e27[_0x9af6('0x27')],_0x7b6a2e[_0x9af6('0x3f')]));_0x31e218[_0x9af6('0x45')]['WhatsappInteractionId']=_0x275511['id'];if(_0x121e27['query'][_0x9af6('0x46')]){_0x31e218[_0x9af6('0x45')]=_[_0x9af6('0x32')](_0x31e218['where'],{'$or':_[_0x9af6('0x20')](_0x31e218[_0x9af6('0x2d')],function(_0x29e63d){var _0x250c44={};_0x250c44[_0x29e63d]={'$like':'%'+_0x121e27['query'][_0x9af6('0x46')]+'%'};return _0x250c44;})});}if(_0x121e27[_0x9af6('0x27')][_0x9af6('0x47')]){var _0x5c5bbb=_0x121e27[_0x9af6('0x27')]['$gte'][_0x9af6('0x48')](',');var _0x45e3ae={};_0x45e3ae[_0x5c5bbb[0x0]]={'$gte':moment(_0x5c5bbb[0x1])[_0x9af6('0x49')](_0x9af6('0x4a'))};_0x31e218[_0x9af6('0x45')]=_[_0x9af6('0x32')](_0x31e218['where'],_0x45e3ae);}_0x31e218=_[_0x9af6('0x32')]({},_0x31e218,_0x121e27[_0x9af6('0x33')]);return db[_0x9af6('0x39')][_0x9af6('0x15')]({'where':_0x31e218[_0x9af6('0x45')]})['then'](function(_0x22876c){_0x9d0a8a[_0x9af6('0x15')]=_0x22876c;if(_0x121e27['query'][_0x9af6('0x4b')]){_0x31e218['include']=[{'all':!![]}];}return db[_0x9af6('0x39')][_0x9af6('0x4c')](_0x31e218);})[_0x9af6('0x19')](function(_0x189c70){_0x9d0a8a[_0x9af6('0x4d')]=_0x189c70;return _0x9d0a8a;});}})['then'](respondWithFilteredResult(_0x4291c1,_0x31e218))[_0x9af6('0x29')](handleError(_0x4291c1,null));};exports['addTags']=function(_0x1d090f,_0x189232){return db[_0x9af6('0x21')][_0x9af6('0x34')]({'where':{'id':_0x1d090f[_0x9af6('0x2b')]['id']}})[_0x9af6('0x19')](handleEntityNotFound(_0x189232,null))[_0x9af6('0x19')](function(_0x2d16a6){if(_0x2d16a6){return _0x2d16a6['setTags'](_0x1d090f[_0x9af6('0x36')][_0x9af6('0x3a')],_['omit'](_0x1d090f[_0x9af6('0x36')],[_0x9af6('0x3a'),'id'])||{})[_0x9af6('0x4e')](function(){return db[_0x9af6('0x4f')][_0x9af6('0x4c')]({'attributes':['id','name',_0x9af6('0x50')],'where':{'id':_0x1d090f[_0x9af6('0x36')][_0x9af6('0x3a')]}});})['then'](function(_0x29cb4d){socket[_0x9af6('0x51')](_0x9af6('0x52'),{'id':Number(_0x1d090f[_0x9af6('0x2b')]['id']),'tags':_0x29cb4d||[]});return{'id':Number(_0x1d090f[_0x9af6('0x2b')]['id']),'tags':_0x29cb4d||[]};});}})['then'](respondWithResult(_0x189232,null))[_0x9af6('0x29')](handleError(_0x189232,null));};exports[_0x9af6('0x53')]=function(_0x59e8ef,_0xc2dcbf){return db[_0x9af6('0x21')][_0x9af6('0x34')]({'where':{'id':_0x59e8ef['params']['id']}})['then'](handleEntityNotFound(_0xc2dcbf,null))['then'](function(_0x29cd25){if(_0x29cd25){return _0x29cd25[_0x9af6('0x53')](_0x59e8ef['query'][_0x9af6('0x3a')]);}})['then'](respondWithStatusCode(_0xc2dcbf,null))[_0x9af6('0x29')](handleError(_0xc2dcbf,null));};exports[_0x9af6('0x54')]=function(_0x652ecd,_0x28ba7c){var _0x5d654f=moment()[_0x9af6('0x55')]()[_0x9af6('0x56')]();var _0xc54594=path['join'](config[_0x9af6('0x57')],_0x9af6('0x58'),_0x9af6('0x59'),'tmp');var _0x544512=path['join'](config[_0x9af6('0x57')],_0x9af6('0x58'),_0x9af6('0x59'),'attachments');var _0x32e491=path[_0x9af6('0x5a')](_0xc54594,_0x5d654f);var _0x1bfe9b=util[_0x9af6('0x49')](_0x9af6('0x5b'),_0x652ecd[_0x9af6('0x2b')]['id'],_0x5d654f);var _0x258b03=path[_0x9af6('0x5a')](_0xc54594,_0x1bfe9b);var _0x4fec29=[];_0x4fec29[_0x9af6('0x5c')]({'model':db['User'],'as':_0x9af6('0x5d'),'attributes':['id',_0x9af6('0x5e')],'raw':!![]});_0x4fec29[_0x9af6('0x5c')]({'model':db[_0x9af6('0x5f')],'as':_0x9af6('0x60'),'attributes':['id',_0x9af6('0x61'),_0x9af6('0x62')],'raw':!![]});if(_0x652ecd['query']['attachments']){_0x4fec29['push']({'model':db[_0x9af6('0x63')],'as':_0x9af6('0x63'),'raw':!![]});}var _0x4f107c=[{'model':db[_0x9af6('0x39')],'as':_0x9af6('0x64'),'attributes':['id',_0x9af6('0x36'),_0x9af6('0x65'),'direction','secret','read'],'include':_0x4fec29}];_0x4f107c[_0x9af6('0x5c')]({'model':db[_0x9af6('0x66')],'as':_0x9af6('0x67'),'attributes':['id',_0x9af6('0x1e')]});_0x4f107c[_0x9af6('0x5c')]({'model':db[_0x9af6('0x5d')],'as':_0x9af6('0x68'),'attributes':['id',_0x9af6('0x5e')]});return db['WhatsappInteraction'][_0x9af6('0x34')]({'where':{'id':_0x652ecd[_0x9af6('0x2b')]['id']},'include':_0x4f107c})[_0x9af6('0x19')](handleEntityNotFound(_0x28ba7c,null))[_0x9af6('0x19')](function(_0x48e671){if(_0x48e671){var _0x48c539=_0x48e671[_0x9af6('0x69')]({'plain':!![]});fs[_0x9af6('0x6a')](_0x32e491);var _0x46ae52={'channel':_0x9af6('0x6b'),'account':_0x48c539['Account'][_0x9af6('0x1e')],'agent':_0x48c539[_0x9af6('0x68')]?_0x48c539[_0x9af6('0x68')][_0x9af6('0x5e')]:_0x9af6('0x6c'),'createdAt':moment(_0x48c539['createdAt'])[_0x9af6('0x49')](_0x9af6('0x4a'))[_0x9af6('0x56')](),'closedAt':_0x48c539['closed']?moment(_0x48c539[_0x9af6('0x6d')])[_0x9af6('0x49')](_0x9af6('0x4a'))['toString']():'','disposition':_0x48c539[_0x9af6('0x6e')],'messages':_(_0x48c539[_0x9af6('0x64')])[_0x9af6('0x46')]({'secret':![]})[_0x9af6('0x20')](function(_0x419d4d){if(_0x419d4d['Attachment']){var _0x2834ae=path['join'](_0x544512,_0x419d4d[_0x9af6('0x63')][_0x9af6('0x6f')]);if(fs[_0x9af6('0x70')](_0x2834ae)){fs['createReadStream'](_0x2834ae)[_0x9af6('0x71')](fs[_0x9af6('0x72')](path[_0x9af6('0x5a')](_0x32e491,_0x419d4d[_0x9af6('0x63')]['basename'])));}}return{'date':moment(_0x419d4d[_0x9af6('0x65')])[_0x9af6('0x49')](_0x9af6('0x4a'))[_0x9af6('0x56')](),'sender':_0x419d4d[_0x9af6('0x73')]==='out'?_0x419d4d[_0x9af6('0x5d')]?_0x419d4d[_0x9af6('0x5d')][_0x9af6('0x5e')]:_0x9af6('0x74'):_0x419d4d[_0x9af6('0x60')]['firstName']+(_0x419d4d['Contact'][_0x9af6('0x62')]?'\x20'+_0x419d4d[_0x9af6('0x60')]['lastName']:''),'body':_0x419d4d[_0x9af6('0x63')]?_0x419d4d[_0x9af6('0x63')][_0x9af6('0x6f')]:_0x419d4d['body'],'direction':_0x419d4d[_0x9af6('0x73')]===_0x9af6('0x75')?'A':'C','secret':_0x419d4d[_0x9af6('0x76')],'read':_0x419d4d[_0x9af6('0x77')],'attachment':_0x419d4d[_0x9af6('0x63')]};})[_0x9af6('0x78')]()};return ejs['renderFile'](path['join'](config[_0x9af6('0x57')],_0x9af6('0x58'),_0x9af6('0x79'),_0x9af6('0x7a')),{'interaction':_0x46ae52})['then'](function(_0x401924){var _0xd472b4=path[_0x9af6('0x5a')](_0x32e491,'transcript-'+_0x48c539['id']+'-'+_0x5d654f+_0x9af6('0x7b'));var _0x378670={'path':_0xd472b4,'channel':_0x9af6('0x6b'),'interactionId':_0x48c539['id']};return pdf[_0x9af6('0x7c')](_0x401924,_0x378670);})[_0x9af6('0x19')](function(){return new BPromise(function(_0x5cd011,_0x472235){zipdir(_0x32e491,{'saveTo':_0x258b03},function(_0x4e9e44,_0x2e0fa2){if(_0x4e9e44)return _0x472235(_0x4e9e44);return _0x5cd011(_0x2e0fa2);});})[_0x9af6('0x19')](function(){return new BPromise(function(_0x430722,_0x311933){rimraf(_0x32e491,function(_0x3e928c){if(_0x3e928c)_0x311933(_0x3e928c);return _0x430722();});});})[_0x9af6('0x19')](function(){return _0x28ba7c['download'](_0x258b03,_0x1bfe9b,function(_0x15971b){if(_0x15971b){console[_0x9af6('0x7d')]('err',_0x15971b);}else{fs[_0x9af6('0x7e')](_0x258b03);}});});});}else{return _0x28ba7c['sendStatus'](0xc8);}})[_0x9af6('0x29')](handleError(_0x28ba7c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c689d75..dd4fbd0 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 _0x1da6=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x104b35,_0x13f218){var _0x55584d=function(_0x2bbb71){while(--_0x2bbb71){_0x104b35['push'](_0x104b35['shift']());}};_0x55584d(++_0x13f218);}(_0x1da6,0x7c));var _0x61da=function(_0x4f096e,_0x30d3c3){_0x4f096e=_0x4f096e-0x0;var _0x4a33ce=_0x1da6[_0x4f096e];return _0x4a33ce;};'use strict';var EventEmitter=require(_0x61da('0x0'));var WhatsappInteraction=require(_0x61da('0x1'))['db'][_0x61da('0x2')];var WhatsappMessage=require(_0x61da('0x1'))['db'][_0x61da('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x61da('0x4')](0x0);var events={'afterCreate':_0x61da('0x5'),'afterUpdate':_0x61da('0x6'),'afterDestroy':_0x61da('0x7')};function emitEvent(_0xe55a12){return function(_0x2be3c9,_0x42f09d,_0x16cd66){_0x2be3c9[_0x61da('0x8')]({'attributes':['id'],'raw':!![]})[_0x61da('0x9')](function(_0x2c43c2){_0x2be3c9[_0x61da('0xa')](_0x61da('0xb'),_0x2c43c2[_0x61da('0xc')](function(_0xf027a6){return{'id':_0xf027a6['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2be3c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x61da('0x9')](function(_0x284ed6){_0x2be3c9[_0x61da('0xa')](_0x61da('0xd'),_0x284ed6[_0x61da('0xe')]);WhatsappInteractionEvents[_0x61da('0xf')](_0xe55a12+':'+_0x2be3c9['id'],_0x2be3c9);WhatsappInteractionEvents[_0x61da('0xf')](_0xe55a12,_0x2be3c9);_0x16cd66(null);})[_0x61da('0x10')](_0x16cd66(null));};}for(var e in events){if(events[_0x61da('0x11')](e)){var event=events[e];WhatsappInteraction[_0x61da('0x12')](e,emitEvent(event));}}module[_0x61da('0x13')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc125=['getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc125,0x150));var _0x5c12=function(_0x47bf18,_0x4d4ecd){_0x47bf18=_0x47bf18-0x0;var _0xb37f06=_0xc125[_0x47bf18];return _0xb37f06;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x5c12('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5c12('0x0'))['db'][_0x5c12('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5c12('0x2')](0x0);var events={'afterCreate':_0x5c12('0x3'),'afterUpdate':_0x5c12('0x4'),'afterDestroy':_0x5c12('0x5')};function emitEvent(_0x31bd53){return function(_0x275ea3,_0x3aa4b7,_0x3f1c8b){_0x275ea3[_0x5c12('0x6')]({'attributes':['id'],'raw':!![]})[_0x5c12('0x7')](function(_0x4cab65){_0x275ea3[_0x5c12('0x8')](_0x5c12('0x9'),_0x4cab65['map'](function(_0x29342a){return{'id':_0x29342a['id']};}));return WhatsappMessage[_0x5c12('0xa')]({'where':{'WhatsappInteractionId':_0x275ea3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c12('0x7')](function(_0x33f493){_0x275ea3[_0x5c12('0x8')](_0x5c12('0xb'),_0x33f493[_0x5c12('0xc')]);WhatsappInteractionEvents[_0x5c12('0xd')](_0x31bd53+':'+_0x275ea3['id'],_0x275ea3);WhatsappInteractionEvents['emit'](_0x31bd53,_0x275ea3);_0x3f1c8b(null);})[_0x5c12('0xe')](_0x3f1c8b(null));};}for(var e in events){if(events[_0x5c12('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5c12('0x10')](e,emitEvent(event));}}module[_0x5c12('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index fe2569d..e1dc022 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 _0x9551=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9551,0x11e));var _0x1955=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x9551[_0x2980de];return _0x81a4ca;};'use strict';var _=require(_0x1955('0x0'));var util=require('util');var logger=require(_0x1955('0x1'))(_0x1955('0x2'));var moment=require(_0x1955('0x3'));var BPromise=require(_0x1955('0x4'));var rp=require(_0x1955('0x5'));var fs=require('fs');var path=require(_0x1955('0x6'));var rimraf=require(_0x1955('0x7'));var config=require(_0x1955('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0x1955('0x9')]=function(_0x20bb95,_0x5e3f9e){return _0x20bb95[_0x1955('0xa')](_0x1955('0xb'),attributes,{'tableName':_0x1955('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x193f3e,_0xc8c8b9,_0x5cc13f){if(_0x193f3e[_0x1955('0xd')]('closed')){_0x193f3e['closedAt']=moment()['format'](_0x1955('0xe'));}_0x5cc13f(null,_0x193f3e);}}});}; \ No newline at end of file +var _0xbd6d=['WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbd6d,0xc5));var _0xdbd6=function(_0x3c1105,_0x5c45c1){_0x3c1105=_0x3c1105-0x0;var _0x35e7ab=_0xbd6d[_0x3c1105];return _0x35e7ab;};'use strict';var _=require(_0xdbd6('0x0'));var util=require(_0xdbd6('0x1'));var logger=require(_0xdbd6('0x2'))(_0xdbd6('0x3'));var moment=require(_0xdbd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xdbd6('0x5'));var fs=require('fs');var path=require(_0xdbd6('0x6'));var rimraf=require(_0xdbd6('0x7'));var config=require(_0xdbd6('0x8'));var attributes=require(_0xdbd6('0x9'));module['exports']=function(_0x5a3fb8,_0x28a1f4){return _0x5a3fb8[_0xdbd6('0xa')](_0xdbd6('0xb'),attributes,{'tableName':_0xdbd6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13d6ed,_0x2c515c,_0x12c109){if(_0x13d6ed[_0xdbd6('0xd')]('closed')){_0x13d6ed['closedAt']=moment()[_0xdbd6('0xe')](_0xdbd6('0xf'));}_0x12c109(null,_0x13d6ed);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5a70fb0..a8932a2 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 _0x4e41=['WhatsappInteraction','update','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','omit','body','spread','AddTags','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','UpdateWhatsappInteraction'];(function(_0x1000fc,_0x108811){var _0x4f58cb=function(_0x3c4198){while(--_0x3c4198){_0x1000fc['push'](_0x1000fc['shift']());}};_0x4f58cb(++_0x108811);}(_0x4e41,0x104));var _0x14e4=function(_0x3c6678,_0xf7d827){_0x3c6678=_0x3c6678-0x0;var _0x2c6493=_0x4e41[_0x3c6678];return _0x2c6493;};'use strict';var _=require(_0x14e4('0x0'));var util=require('util');var moment=require(_0x14e4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x14e4('0x3'));var logger=require(_0x14e4('0x4'))('rpc');var config=require(_0x14e4('0x5'));var jayson=require(_0x14e4('0x6'));var client=jayson[_0x14e4('0x7')][_0x14e4('0x8')]({'port':0x232a});config[_0x14e4('0x9')]=_[_0x14e4('0xa')](config['redis'],{'host':_0x14e4('0xb'),'port':0x18eb});var socket=require(_0x14e4('0xc'))(new Redis(config['redis']));require(_0x14e4('0xd'))[_0x14e4('0xe')](socket);function respondWithRpcPromise(_0xa52586,_0x5a9839,_0x5002f7){return new BPromise(function(_0x1b1638,_0x483b28){return client[_0x14e4('0xf')](_0xa52586,_0x5002f7)[_0x14e4('0x10')](function(_0x395979){logger['info'](_0x14e4('0x11'),_0x5a9839,_0x14e4('0x12'));logger[_0x14e4('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5a9839,_0x14e4('0x12'),JSON['stringify'](_0x395979));if(_0x395979[_0x14e4('0x14')]){if(_0x395979[_0x14e4('0x14')][_0x14e4('0x15')]===0x1f4){logger[_0x14e4('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x5a9839,_0x395979[_0x14e4('0x14')][_0x14e4('0x16')]);return _0x483b28(_0x395979[_0x14e4('0x14')]['message']);}logger[_0x14e4('0x14')](_0x14e4('0x11'),_0x5a9839,_0x395979[_0x14e4('0x14')][_0x14e4('0x16')]);return _0x1b1638(_0x395979[_0x14e4('0x14')]['message']);}else{logger[_0x14e4('0x17')](_0x14e4('0x11'),_0x5a9839,_0x14e4('0x12'));_0x1b1638(_0x395979[_0x14e4('0x18')][_0x14e4('0x16')]);}})[_0x14e4('0x19')](function(_0x30c898){logger[_0x14e4('0x14')](_0x14e4('0x11'),_0x5a9839,_0x30c898);_0x483b28(_0x30c898);});});}exports[_0x14e4('0x1a')]=function(_0x5b0eb6){var _0x180d1c=this;return new Promise(function(_0x3613fe,_0x2675f2){return db[_0x14e4('0x1b')][_0x14e4('0x1c')](_0x5b0eb6['body'],{'raw':_0x5b0eb6[_0x14e4('0x1d')]?_0x5b0eb6[_0x14e4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0eb6[_0x14e4('0x1d')]?_0x5b0eb6[_0x14e4('0x1d')][_0x14e4('0x1e')]||null:null,'attributes':_0x5b0eb6[_0x14e4('0x1d')]?_0x5b0eb6[_0x14e4('0x1d')][_0x14e4('0x1f')]||null:null,'limit':_0x5b0eb6['options']?_0x5b0eb6[_0x14e4('0x1d')][_0x14e4('0x20')]||null:null})[_0x14e4('0x10')](function(_0x10bff3){logger[_0x14e4('0x17')]('UpdateWhatsappInteraction',_0x5b0eb6);logger['debug'](_0x14e4('0x1a'),_0x5b0eb6,JSON[_0x14e4('0x21')](_0x10bff3));_0x3613fe(_0x10bff3);})[_0x14e4('0x19')](function(_0x1213b6){logger[_0x14e4('0x14')](_0x14e4('0x1a'),_0x1213b6[_0x14e4('0x16')],_0x5b0eb6);_0x2675f2(_0x180d1c[_0x14e4('0x14')](0x1f4,_0x1213b6[_0x14e4('0x16')]));});});};exports[_0x14e4('0x22')]=function(_0x2a7df4){return new Promise(function(_0x2ff238,_0x46f662){return db[_0x14e4('0x1b')][_0x14e4('0x23')]({'where':_0x2a7df4[_0x14e4('0x1d')]?_0x2a7df4[_0x14e4('0x1d')][_0x14e4('0x1e')]||null:null})[_0x14e4('0x10')](function(_0x239b15){if(_0x239b15){return _0x239b15[_0x14e4('0x24')](_0x2a7df4['body']['ids'],_[_0x14e4('0x25')](_0x2a7df4[_0x14e4('0x26')],['ids','id'])||{});}})[_0x14e4('0x27')](function(_0x234c89){logger[_0x14e4('0x17')]('AddTags',_0x2a7df4);logger[_0x14e4('0x13')](_0x14e4('0x28'),_0x2a7df4,JSON[_0x14e4('0x21')](_0x234c89));_0x2ff238(_0x234c89);})['catch'](function(_0x128c70){logger[_0x14e4('0x14')](_0x14e4('0x28'),_0x128c70[_0x14e4('0x16')],_0x2a7df4);_0x46f662(_this[_0x14e4('0x14')](0x1f4,_0x128c70[_0x14e4('0x16')]));});});}; \ No newline at end of file +var _0x2af0=['request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x5b0b2b,_0xf88824){var _0x50fb8c=function(_0x275b09){while(--_0x275b09){_0x5b0b2b['push'](_0x5b0b2b['shift']());}};_0x50fb8c(++_0xf88824);}(_0x2af0,0x109));var _0x02af=function(_0x512705,_0x8050ff){_0x512705=_0x512705-0x0;var _0x176086=_0x2af0[_0x512705];return _0x176086;};'use strict';var _=require(_0x02af('0x0'));var util=require(_0x02af('0x1'));var moment=require(_0x02af('0x2'));var BPromise=require(_0x02af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x02af('0x5'));var logger=require('../../config/logger')(_0x02af('0x6'));var config=require(_0x02af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x02af('0x8')][_0x02af('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x02af('0xa')],{'host':_0x02af('0xb'),'port':0x18eb});var socket=require(_0x02af('0xc'))(new Redis(config['redis']));require(_0x02af('0xd'))[_0x02af('0xe')](socket);function respondWithRpcPromise(_0x4a429b,_0x402450,_0xa0f62b){return new BPromise(function(_0x320e72,_0x5ef564){return client[_0x02af('0xf')](_0x4a429b,_0xa0f62b)[_0x02af('0x10')](function(_0x755e93){logger['info'](_0x02af('0x11'),_0x402450,_0x02af('0x12'));logger[_0x02af('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x402450,'request\x20sent',JSON[_0x02af('0x14')](_0x755e93));if(_0x755e93['error']){if(_0x755e93[_0x02af('0x15')][_0x02af('0x16')]===0x1f4){logger[_0x02af('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x402450,_0x755e93[_0x02af('0x15')][_0x02af('0x17')]);return _0x5ef564(_0x755e93[_0x02af('0x15')][_0x02af('0x17')]);}logger[_0x02af('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x402450,_0x755e93[_0x02af('0x15')][_0x02af('0x17')]);return _0x320e72(_0x755e93['error'][_0x02af('0x17')]);}else{logger[_0x02af('0x18')](_0x02af('0x11'),_0x402450,_0x02af('0x12'));_0x320e72(_0x755e93[_0x02af('0x19')][_0x02af('0x17')]);}})[_0x02af('0x1a')](function(_0x2c6396){logger[_0x02af('0x15')](_0x02af('0x11'),_0x402450,_0x2c6396);_0x5ef564(_0x2c6396);});});}exports[_0x02af('0x1b')]=function(_0x5137ab){var _0x2d7d2=this;return new Promise(function(_0xaf2eee,_0x667d61){return db[_0x02af('0x1c')][_0x02af('0x1d')](_0x5137ab[_0x02af('0x1e')],{'raw':_0x5137ab['options']?_0x5137ab[_0x02af('0x1f')][_0x02af('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5137ab[_0x02af('0x1f')]?_0x5137ab[_0x02af('0x1f')][_0x02af('0x21')]||null:null,'attributes':_0x5137ab[_0x02af('0x1f')]?_0x5137ab[_0x02af('0x1f')]['attributes']||null:null,'limit':_0x5137ab[_0x02af('0x1f')]?_0x5137ab[_0x02af('0x1f')][_0x02af('0x22')]||null:null})[_0x02af('0x10')](function(_0x5df8a7){logger[_0x02af('0x18')]('UpdateWhatsappInteraction',_0x5137ab);logger[_0x02af('0x13')](_0x02af('0x1b'),_0x5137ab,JSON[_0x02af('0x14')](_0x5df8a7));_0xaf2eee(_0x5df8a7);})[_0x02af('0x1a')](function(_0x5c6d62){logger[_0x02af('0x15')](_0x02af('0x1b'),_0x5c6d62[_0x02af('0x17')],_0x5137ab);_0x667d61(_0x2d7d2['error'](0x1f4,_0x5c6d62['message']));});});};exports[_0x02af('0x23')]=function(_0x183731){return new Promise(function(_0x22fde7,_0x3e76e0){return db[_0x02af('0x1c')][_0x02af('0x24')]({'where':_0x183731[_0x02af('0x1f')]?_0x183731[_0x02af('0x1f')]['where']||null:null})[_0x02af('0x10')](function(_0x5ba5f4){if(_0x5ba5f4){return _0x5ba5f4[_0x02af('0x25')](_0x183731[_0x02af('0x1e')][_0x02af('0x26')],_['omit'](_0x183731[_0x02af('0x1e')],[_0x02af('0x26'),'id'])||{});}})['spread'](function(_0x37e441){logger['info'](_0x02af('0x27'),_0x183731);logger['debug'](_0x02af('0x27'),_0x183731,JSON['stringify'](_0x37e441));_0x22fde7(_0x37e441);})['catch'](function(_0x4371e3){logger['error']('AddTags',_0x4371e3[_0x02af('0x17')],_0x183731);_0x3e76e0(_this[_0x02af('0x15')](0x1f4,_0x4371e3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 9e8a60b..d1b6550 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 _0xfa6b=['emit','removeListener','register','length','./whatsappInteraction.events','save','remove'];(function(_0x2e2fda,_0x455065){var _0xf52075=function(_0x1524a1){while(--_0x1524a1){_0x2e2fda['push'](_0x2e2fda['shift']());}};_0xf52075(++_0x455065);}(_0xfa6b,0x107));var _0xbfa6=function(_0x33553e,_0x45251f){_0x33553e=_0x33553e-0x0;var _0x1b87e0=_0xfa6b[_0x33553e];return _0x1b87e0;};'use strict';var WhatsappInteractionEvents=require(_0xbfa6('0x0'));var events=[_0xbfa6('0x1'),_0xbfa6('0x2'),'update'];function createListener(_0x171731,_0x49229b){return function(_0x2f3c74){_0x49229b[_0xbfa6('0x3')](_0x171731,_0x2f3c74);};}function removeListener(_0x2b417b,_0x1a2637){return function(){WhatsappInteractionEvents[_0xbfa6('0x4')](_0x2b417b,_0x1a2637);};}exports[_0xbfa6('0x5')]=function(_0x36950b){for(var _0x22cda0=0x0,_0x3d7761=events[_0xbfa6('0x6')];_0x22cda0<_0x3d7761;_0x22cda0++){var _0x273da5=events[_0x22cda0];var _0x234247=createListener('whatsappInteraction:'+_0x273da5,_0x36950b);WhatsappInteractionEvents['on'](_0x273da5,_0x234247);}}; \ No newline at end of file +var _0xa744=['update','register','length','./whatsappInteraction.events','save','remove'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0xa744,0x87));var _0x4a74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa744[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappInteractionEvents=require(_0x4a74('0x0'));var events=[_0x4a74('0x1'),_0x4a74('0x2'),_0x4a74('0x3')];function createListener(_0x2da341,_0x27e71f){return function(_0x39bbd6){_0x27e71f['emit'](_0x2da341,_0x39bbd6);};}function removeListener(_0x160254,_0x3b0a6c){return function(){WhatsappInteractionEvents['removeListener'](_0x160254,_0x3b0a6c);};}exports[_0x4a74('0x4')]=function(_0x40e425){for(var _0x212aff=0x0,_0x1a27d7=events[_0x4a74('0x5')];_0x212aff<_0x1a27d7;_0x212aff++){var _0xb73876=events[_0x212aff];var _0x393136=createListener('whatsappInteraction:'+_0xb73876,_0x40e425);WhatsappInteractionEvents['on'](_0xb73876,_0x393136);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0d214a2..be4cfa9 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 _0x86ca=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x86ca,0x82));var _0xa86c=function(_0x4fc741,_0xa2e17b){_0x4fc741=_0x4fc741-0x0;var _0x44859=_0x86ca[_0x4fc741];return _0x44859;};'use strict';var multer=require(_0xa86c('0x0'));var util=require(_0xa86c('0x1'));var path=require(_0xa86c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa86c('0x3'));var router=express[_0xa86c('0x4')]();var fs_extra=require(_0xa86c('0x5'));var auth=require(_0xa86c('0x6'));var interaction=require(_0xa86c('0x7'));var config=require(_0xa86c('0x8'));var controller=require('./whatsappMessage.controller');router[_0xa86c('0x9')]('/',auth[_0xa86c('0xa')](),controller[_0xa86c('0xb')]);router['get']('/describe',auth[_0xa86c('0xa')](),controller[_0xa86c('0xc')]);router['get'](_0xa86c('0xd'),auth['isAuthenticated'](),controller[_0xa86c('0xe')]);router[_0xa86c('0xf')]('/',auth[_0xa86c('0xa')](),interaction[_0xa86c('0x10')](_0xa86c('0x11'),_0xa86c('0x12')),controller['create']);router['post'](_0xa86c('0x13'),controller[_0xa86c('0x14')]);router[_0xa86c('0x15')]('/:id',auth[_0xa86c('0xa')](),controller['update']);router[_0xa86c('0x15')](_0xa86c('0x16'),auth[_0xa86c('0xa')](),controller['accept']);router[_0xa86c('0x15')](_0xa86c('0x17'),auth[_0xa86c('0xa')](),controller['reject']);router[_0xa86c('0x18')](_0xa86c('0xd'),auth[_0xa86c('0xa')](),controller[_0xa86c('0x19')]);module[_0xa86c('0x1a')]=router; \ No newline at end of file +var _0x5f44=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path'];(function(_0x1dc4d4,_0x3f596d){var _0x58d5ea=function(_0x378e91){while(--_0x378e91){_0x1dc4d4['push'](_0x1dc4d4['shift']());}};_0x58d5ea(++_0x3f596d);}(_0x5f44,0xf9));var _0x45f4=function(_0x2af018,_0xcf5cc0){_0x2af018=_0x2af018-0x0;var _0xe1364d=_0x5f44[_0x2af018];return _0xe1364d;};'use strict';var multer=require(_0x45f4('0x0'));var util=require(_0x45f4('0x1'));var path=require(_0x45f4('0x2'));var timeout=require(_0x45f4('0x3'));var express=require(_0x45f4('0x4'));var router=express[_0x45f4('0x5')]();var fs_extra=require(_0x45f4('0x6'));var auth=require(_0x45f4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x45f4('0x8'));var controller=require(_0x45f4('0x9'));router['get']('/',auth[_0x45f4('0xa')](),controller[_0x45f4('0xb')]);router[_0x45f4('0xc')](_0x45f4('0xd'),auth['isAuthenticated'](),controller[_0x45f4('0xe')]);router[_0x45f4('0xc')](_0x45f4('0xf'),auth[_0x45f4('0xa')](),controller[_0x45f4('0x10')]);router[_0x45f4('0x11')]('/',auth[_0x45f4('0xa')](),interaction['tracked']('whatsapp',_0x45f4('0x12')),controller['create']);router[_0x45f4('0x11')](_0x45f4('0x13'),controller[_0x45f4('0x14')]);router[_0x45f4('0x15')](_0x45f4('0xf'),auth[_0x45f4('0xa')](),controller[_0x45f4('0x16')]);router['put'](_0x45f4('0x17'),auth[_0x45f4('0xa')](),controller['accept']);router['put'](_0x45f4('0x18'),auth[_0x45f4('0xa')](),controller['reject']);router[_0x45f4('0x19')](_0x45f4('0xf'),auth['isAuthenticated'](),controller[_0x45f4('0x1a')]);module[_0x45f4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 99687ee..527b1ac 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 _0xc94e=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x540fca,_0x54263f){var _0x15e0cc=function(_0x4ab3b5){while(--_0x4ab3b5){_0x540fca['push'](_0x540fca['shift']());}};_0x15e0cc(++_0x54263f);}(_0xc94e,0x85));var _0xec94=function(_0x12f82f,_0x4280c5){_0x12f82f=_0x12f82f-0x0;var _0x41bf49=_0xc94e[_0x12f82f];return _0x41bf49;};'use strict';var Sequelize=require(_0xec94('0x0'));module[_0xec94('0x1')]={'body':{'type':Sequelize[_0xec94('0x2')](_0xec94('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xec94('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec94('0x5')]('in',_0xec94('0x6')),'defaultValue':_0xec94('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xec94('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xec94('0x2')]}}; \ No newline at end of file +var _0x229a=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x312d40,_0x5d6979){var _0x1fd607=function(_0x58a93b){while(--_0x58a93b){_0x312d40['push'](_0x312d40['shift']());}};_0x1fd607(++_0x5d6979);}(_0x229a,0x1ea));var _0xa229=function(_0x93ef32,_0xeeec1){_0x93ef32=_0x93ef32-0x0;var _0x528b6c=_0x229a[_0x93ef32];return _0x528b6c;};'use strict';var Sequelize=require(_0xa229('0x0'));module[_0xa229('0x1')]={'body':{'type':Sequelize[_0xa229('0x2')](_0xa229('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa229('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa229('0x5')]('in',_0xa229('0x6')),'defaultValue':_0xa229('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa229('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa229('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa229('0x7')]},'providerResponse':{'type':Sequelize[_0xa229('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index cf6f3e0..335da28 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 _0xff43=['get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','internal','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','interface','format','reject','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','read','inspect','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','save','update','destroy','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','WhatsappMessage','includeAll','findAll','rows','show','params','fields','length','include','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent'];(function(_0x252805,_0x1d1e8e){var _0x3e74b9=function(_0x16d7a0){while(--_0x16d7a0){_0x252805['push'](_0x252805['shift']());}};_0x3e74b9(++_0x1d1e8e);}(_0xff43,0x137));var _0x3ff4=function(_0x290b9f,_0x3141ad){_0x290b9f=_0x290b9f-0x0;var _0x32605f=_0xff43[_0x290b9f];return _0x32605f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ff4('0x0'));var zipdir=require(_0x3ff4('0x1'));var jsonpatch=require(_0x3ff4('0x2'));var rp=require(_0x3ff4('0x3'));var moment=require(_0x3ff4('0x4'));var BPromise=require(_0x3ff4('0x5'));var Mustache=require(_0x3ff4('0x6'));var util=require(_0x3ff4('0x7'));var path=require(_0x3ff4('0x8'));var sox=require(_0x3ff4('0x9'));var csv=require(_0x3ff4('0xa'));var ejs=require(_0x3ff4('0xb'));var fs=require('fs');var fs_extra=require(_0x3ff4('0xc'));var _=require(_0x3ff4('0xd'));var squel=require(_0x3ff4('0xe'));var crypto=require(_0x3ff4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3ff4('0x10'));var toCsv=require(_0x3ff4('0xa'));var querystring=require(_0x3ff4('0x11'));var Papa=require(_0x3ff4('0x12'));var Redis=require(_0x3ff4('0x13'));var authService=require(_0x3ff4('0x14'));var qs=require(_0x3ff4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ff4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3ff4('0x17'));var config=require(_0x3ff4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ff4('0x19'))['db'];config['redis']=_['defaults'](config[_0x3ff4('0x1a')],{'host':_0x3ff4('0x1b'),'port':0x18eb});var socket=require(_0x3ff4('0x1c'))(new Redis(config['redis']));require(_0x3ff4('0x1d'))['register'](socket);var jayson=require(_0x3ff4('0x1e'));var client=jayson[_0x3ff4('0x1f')][_0x3ff4('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x3ff4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4027f8,_0x34074e,_0x3e28f5,_0x568219){return new BPromise(function(_0x7046b9,_0x6cc8e8){var _0x27fb67=_0x568219||client;return _0x27fb67[_0x3ff4('0x21')](_0x4027f8,_0x3e28f5)[_0x3ff4('0x22')](function(_0x688940){logger[_0x3ff4('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x34074e,_0x3ff4('0x24'));logger[_0x3ff4('0x25')](_0x3ff4('0x26'),_0x34074e,_0x3ff4('0x24'),JSON[_0x3ff4('0x27')](_0x688940));if(_0x688940[_0x3ff4('0x28')]){if(_0x688940[_0x3ff4('0x28')][_0x3ff4('0x29')]===0x1f4){logger[_0x3ff4('0x28')](_0x3ff4('0x2a'),_0x34074e,_0x688940['error'][_0x3ff4('0x2b')]);return _0x6cc8e8(_0x688940['error'][_0x3ff4('0x2b')]);}logger[_0x3ff4('0x28')](_0x3ff4('0x2a'),_0x34074e,_0x688940[_0x3ff4('0x28')][_0x3ff4('0x2b')]);return _0x7046b9(_0x688940[_0x3ff4('0x28')][_0x3ff4('0x2b')]);}else{logger[_0x3ff4('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x34074e,'request\x20sent');_0x7046b9(_0x688940['result'][_0x3ff4('0x2b')]);}})[_0x3ff4('0x2c')](function(_0x17ed4a){logger['error'](_0x3ff4('0x2a'),_0x34074e,_0x17ed4a);_0x6cc8e8(_0x17ed4a);});});}function respondWithStatusCode(_0x45e40e,_0x1bc1da){_0x1bc1da=_0x1bc1da||0xcc;return function(_0x25b1c5){if(_0x25b1c5){return _0x45e40e[_0x3ff4('0x2d')](_0x1bc1da);}return _0x45e40e[_0x3ff4('0x2e')](_0x1bc1da)[_0x3ff4('0x2f')]();};}function respondWithResult(_0x1208ab,_0x471a1e){_0x471a1e=_0x471a1e||0xc8;return function(_0xc8fb37){if(_0xc8fb37){return _0x1208ab['status'](_0x471a1e)['json'](_0xc8fb37);}};}function respondWithFilteredResult(_0xbd782d,_0x3183b3){return function(_0xba29e7){if(_0xba29e7){var _0x20ad89=typeof _0x3183b3[_0x3ff4('0x30')]==='undefined'&&typeof _0x3183b3['limit']===_0x3ff4('0x31');var _0x19fdb7=_0xba29e7[_0x3ff4('0x32')];var _0x4fc936=_0x20ad89?0x0:_0x3183b3[_0x3ff4('0x30')];var _0x4a1848=_0x20ad89?_0xba29e7[_0x3ff4('0x32')]:_0x3183b3['offset']+_0x3183b3['limit'];var _0x2ab7e5;if(_0x4a1848>=_0x19fdb7){_0x4a1848=_0x19fdb7;_0x2ab7e5=0xc8;}else{_0x2ab7e5=0xce;}_0xbd782d[_0x3ff4('0x2e')](_0x2ab7e5);return _0xbd782d['set'](_0x3ff4('0x33'),_0x4fc936+'-'+_0x4a1848+'/'+_0x19fdb7)[_0x3ff4('0x34')](_0xba29e7);}return null;};}function patchUpdates(_0x23c525){return function(_0x40ad8f){try{jsonpatch[_0x3ff4('0x35')](_0x40ad8f,_0x23c525,!![]);}catch(_0x100a9c){return BPromise['reject'](_0x100a9c);}return _0x40ad8f[_0x3ff4('0x36')]();};}function saveUpdates(_0x2d9677,_0x5dc2d6){return function(_0x5530e3){if(_0x5530e3){return _0x5530e3[_0x3ff4('0x37')](_0x2d9677)[_0x3ff4('0x22')](function(_0xa09051){return _0xa09051;});}return null;};}function removeEntity(_0x5a1778,_0x1fd53e){return function(_0x4634ac){if(_0x4634ac){return _0x4634ac[_0x3ff4('0x38')]()[_0x3ff4('0x22')](function(){_0x5a1778['status'](0xcc)[_0x3ff4('0x2f')]();});}};}function handleEntityNotFound(_0x3ce440,_0x319833){return function(_0x18d78b){if(!_0x18d78b){_0x3ce440[_0x3ff4('0x2d')](0x194);}return _0x18d78b;};}function handleError(_0x2f4649,_0x5b3715){_0x5b3715=_0x5b3715||0x1f4;return function(_0x2e5cc0){logger['error'](_0x2e5cc0['stack']);if(_0x2e5cc0['name']){delete _0x2e5cc0[_0x3ff4('0x39')];}_0x2f4649['status'](_0x5b3715)[_0x3ff4('0x3a')](_0x2e5cc0);};}exports[_0x3ff4('0x3b')]=function(_0x5e7c6b,_0x28eb9e){var _0x470b7a={},_0x41a0a8={},_0x152719={'count':0x0,'rows':[]};var _0x6ab56b=_['map'](db['WhatsappMessage'][_0x3ff4('0x3c')],function(_0x50d946){return{'name':_0x50d946[_0x3ff4('0x3d')],'type':_0x50d946[_0x3ff4('0x3e')]['key']};});_0x41a0a8[_0x3ff4('0x3f')]=_['map'](_0x6ab56b,_0x3ff4('0x39'));_0x41a0a8[_0x3ff4('0x40')]=_[_0x3ff4('0x41')](_0x5e7c6b[_0x3ff4('0x40')]);_0x41a0a8[_0x3ff4('0x42')]=_['intersection'](_0x41a0a8['model'],_0x41a0a8[_0x3ff4('0x40')]);_0x470b7a['attributes']=_[_0x3ff4('0x43')](_0x41a0a8[_0x3ff4('0x3f')],qs['fields'](_0x5e7c6b[_0x3ff4('0x40')]['fields']));_0x470b7a[_0x3ff4('0x44')]=_0x470b7a[_0x3ff4('0x44')]['length']?_0x470b7a[_0x3ff4('0x44')]:_0x41a0a8['model'];if(!_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x45')](_0x3ff4('0x46'))){_0x470b7a[_0x3ff4('0x47')]=qs[_0x3ff4('0x47')](_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x47')]);_0x470b7a[_0x3ff4('0x30')]=qs[_0x3ff4('0x30')](_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x30')]);}_0x470b7a[_0x3ff4('0x48')]=qs[_0x3ff4('0x49')](_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x49')]);_0x470b7a[_0x3ff4('0x4a')]=qs['filters'](_[_0x3ff4('0x4b')](_0x5e7c6b[_0x3ff4('0x40')],_0x41a0a8[_0x3ff4('0x42')]),_0x6ab56b);if(_0x5e7c6b['query'][_0x3ff4('0x4c')]){_0x470b7a[_0x3ff4('0x4a')]=_[_0x3ff4('0x4d')](_0x470b7a['where'],{'$or':_['map'](_0x6ab56b,function(_0x56e864){if(_0x56e864[_0x3ff4('0x3e')]!=='VIRTUAL'){var _0x599d72={};_0x599d72[_0x56e864[_0x3ff4('0x39')]]={'$like':'%'+_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x4c')]+'%'};return _0x599d72;}})});}_0x470b7a=_['merge']({},_0x470b7a,_0x5e7c6b['options']);var _0x43b878={'where':_0x470b7a['where']};return db[_0x3ff4('0x4e')][_0x3ff4('0x32')](_0x43b878)[_0x3ff4('0x22')](function(_0x48361b){_0x152719[_0x3ff4('0x32')]=_0x48361b;if(_0x5e7c6b[_0x3ff4('0x40')][_0x3ff4('0x4f')]){_0x470b7a['include']=[{'all':!![]}];}return db[_0x3ff4('0x4e')][_0x3ff4('0x50')](_0x470b7a);})[_0x3ff4('0x22')](function(_0x4d7a36){_0x152719[_0x3ff4('0x51')]=_0x4d7a36;return _0x152719;})['then'](respondWithFilteredResult(_0x28eb9e,_0x470b7a))[_0x3ff4('0x2c')](handleError(_0x28eb9e,null));};exports[_0x3ff4('0x52')]=function(_0x36a3e7,_0x5f1e23){var _0x534f09={'raw':!![],'where':{'id':_0x36a3e7[_0x3ff4('0x53')]['id']}},_0x44cdae={};_0x44cdae[_0x3ff4('0x3f')]=_['keys'](db[_0x3ff4('0x4e')][_0x3ff4('0x3c')]);_0x44cdae[_0x3ff4('0x40')]=_[_0x3ff4('0x41')](_0x36a3e7[_0x3ff4('0x40')]);_0x44cdae[_0x3ff4('0x42')]=_[_0x3ff4('0x43')](_0x44cdae[_0x3ff4('0x3f')],_0x44cdae[_0x3ff4('0x40')]);_0x534f09[_0x3ff4('0x44')]=_[_0x3ff4('0x43')](_0x44cdae['model'],qs[_0x3ff4('0x54')](_0x36a3e7[_0x3ff4('0x40')][_0x3ff4('0x54')]));_0x534f09['attributes']=_0x534f09['attributes'][_0x3ff4('0x55')]?_0x534f09[_0x3ff4('0x44')]:_0x44cdae[_0x3ff4('0x3f')];if(_0x36a3e7[_0x3ff4('0x40')]['includeAll']){_0x534f09[_0x3ff4('0x56')]=[{'all':!![]}];}_0x534f09=_[_0x3ff4('0x4d')]({},_0x534f09,_0x36a3e7[_0x3ff4('0x57')]);return db[_0x3ff4('0x4e')][_0x3ff4('0x58')](_0x534f09)[_0x3ff4('0x22')](handleEntityNotFound(_0x5f1e23,null))[_0x3ff4('0x22')](respondWithResult(_0x5f1e23,null))[_0x3ff4('0x2c')](handleError(_0x5f1e23,null));};exports[_0x3ff4('0x59')]=function(_0x3b231c,_0x323742){return db[_0x3ff4('0x4e')][_0x3ff4('0x59')](_0x3b231c[_0x3ff4('0x5a')],{})[_0x3ff4('0x22')](respondWithResult(_0x323742,0xc9))[_0x3ff4('0x2c')](handleError(_0x323742,null));};exports[_0x3ff4('0x37')]=function(_0x53e6a4,_0xe7ba95){if(_0x53e6a4[_0x3ff4('0x5a')]['id']){delete _0x53e6a4[_0x3ff4('0x5a')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x53e6a4[_0x3ff4('0x53')]['id']}})['then'](handleEntityNotFound(_0xe7ba95,null))[_0x3ff4('0x22')](saveUpdates(_0x53e6a4[_0x3ff4('0x5a')],null))[_0x3ff4('0x22')](respondWithResult(_0xe7ba95,null))['catch'](handleError(_0xe7ba95,null));};exports[_0x3ff4('0x38')]=function(_0x57f31c,_0x32c561){return db['WhatsappMessage']['find']({'where':{'id':_0x57f31c['params']['id']}})['then'](handleEntityNotFound(_0x32c561,null))[_0x3ff4('0x22')](removeEntity(_0x32c561,null))['catch'](handleError(_0x32c561,null));};exports[_0x3ff4('0x5b')]=function(_0x40497d,_0x33ce8e){return db[_0x3ff4('0x4e')][_0x3ff4('0x5b')]()[_0x3ff4('0x22')](respondWithResult(_0x33ce8e,null))[_0x3ff4('0x2c')](handleError(_0x33ce8e,null));};var interaction_log=require('../../config/logger')(_0x3ff4('0x5c'));exports[_0x3ff4('0x5d')]=function(_0x4d6c12,_0x2f6745,_0x26754f){var _0x2ccfb6={'agent':{},'channel':_0x3ff4('0x5e')};if(_0x4d6c12[_0x3ff4('0x5a')]['id']){delete _0x4d6c12[_0x3ff4('0x5a')]['id'];}_0x4d6c12[_0x3ff4('0x5a')]['read']=!![];_0x4d6c12['body'][_0x3ff4('0x5f')]=moment()['format'](_0x3ff4('0x60'));_0x4d6c12[_0x3ff4('0x5a')]['UserId']=_0x4d6c12[_0x3ff4('0x5a')][_0x3ff4('0x61')]||_0x4d6c12[_0x3ff4('0x62')]['id'];_0x2ccfb6[_0x3ff4('0x63')]['id']=_0x4d6c12[_0x3ff4('0x5a')][_0x3ff4('0x61')];return db[_0x3ff4('0x4e')][_0x3ff4('0x58')]({'where':{'id':_0x4d6c12[_0x3ff4('0x53')]['id'],'UserId':null}})[_0x3ff4('0x22')](handleEntityNotFound(_0x2f6745,null))[_0x3ff4('0x22')](saveUpdates(_0x4d6c12[_0x3ff4('0x5a')],null))[_0x3ff4('0x22')](function(_0x2e800a){if(_0x2e800a){_0x2ccfb6['message']=_0x2e800a[_0x3ff4('0x64')]({'plain':!![]});return db[_0x3ff4('0x65')][_0x3ff4('0x58')]({'where':{'id':_0x2e800a[_0x3ff4('0x66')]}});}return null;})[_0x3ff4('0x22')](handleEntityNotFound(_0x2f6745,null))[_0x3ff4('0x22')](function(_0x56b5c8){if(_0x56b5c8){return _0x56b5c8[_0x3ff4('0x37')]({'UserId':_0x4d6c12[_0x3ff4('0x5a')][_0x3ff4('0x61')],'read1stAt':_['isNil'](_0x56b5c8[_0x3ff4('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3ff4('0x22')](function(_0x2990ed){if(_0x2990ed){_0x2ccfb6[_0x3ff4('0x68')]=_0x2990ed['get']({'plain':!![]});interaction_log[_0x3ff4('0x23')](_0x3ff4('0x69'),_0x4d6c12[_0x3ff4('0x62')]['id'],_0x4d6c12[_0x3ff4('0x62')][_0x3ff4('0x39')],_0x4d6c12[_0x3ff4('0x62')][_0x3ff4('0x6a')],_0x2ccfb6[_0x3ff4('0x68')]['id'],_0x4d6c12[_0x3ff4('0x5a')]?JSON['stringify'](_0x4d6c12['body']):_0x3ff4('0x6b'));return respondWithRpcPromise(_0x3ff4('0x6c'),'acceptMessage',_0x2ccfb6);}return null;})[_0x3ff4('0x22')](function(_0x603d3e){var _0x395611=_0x3ff4('0x6d')+_0x603d3e[_0x3ff4('0x2b')][_0x3ff4('0x6e')];return db[_0x3ff4('0x6f')][_0x3ff4('0x40')](_0x395611,{'type':db[_0x3ff4('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3ff4('0x22')](function(_0xebba1c){return _0xebba1c;});})[_0x3ff4('0x22')](function(_0x18a7f0){if(_0x18a7f0){_0x2ccfb6[_0x3ff4('0x2b')][_0x3ff4('0x71')]=_0x18a7f0[0x0];if(!_0x4d6c12[_0x3ff4('0x5a')]['UserId'])return;return db[_0x3ff4('0x72')]['find']({'where':{'id':_0x4d6c12[_0x3ff4('0x5a')]['UserId'],'role':_0x3ff4('0x63')},'attributes':['id',_0x3ff4('0x39'),_0x3ff4('0x73'),'email',_0x3ff4('0x74')],'raw':!![]});}return null;})[_0x3ff4('0x22')](function(_0x1742e8){if(!_0x1742e8)return null;_0x2ccfb6[_0x3ff4('0x2b')][_0x3ff4('0x63')]=_0x1742e8;return _0x2ccfb6;})[_0x3ff4('0x22')](function(_0x7dc63b){if(_0x7dc63b){if(_0x4d6c12['body']['manual']){_0x2ccfb6[_0x3ff4('0x2b')]['interface']=util['format']('SIP/%s',_0x4d6c12[_0x3ff4('0x62')]['name']);_0x2ccfb6['message']['channel']=_0x2ccfb6[_0x3ff4('0x75')];_0x2ccfb6[_0x3ff4('0x2b')][_0x3ff4('0x76')]=_0x2ccfb6[_0x3ff4('0x75')];_0x2ccfb6[_0x3ff4('0x2b')][_0x3ff4('0x77')]=_0x3ff4('0x5d');return respondWithRpcPromise(_0x3ff4('0x78'),_0x3ff4('0x78'),{'event':_0x3ff4('0x79'),'message':_0x2ccfb6[_0x3ff4('0x2b')]},client9002)[_0x3ff4('0x22')](function(){return _0x2ccfb6;});}return _0x2ccfb6;}return null;})[_0x3ff4('0x22')](respondWithResult(_0x2f6745,null))[_0x3ff4('0x2c')](handleError(_0x2f6745,null));};var interaction_log=require('../../config/logger')(_0x3ff4('0x5c'));exports['reject']=function(_0x1a1271,_0x448f07,_0x2550ee){var _0x46ff35={'agent':{},'channel':_0x3ff4('0x5e')};if(_0x1a1271[_0x3ff4('0x5a')]['id']){delete _0x1a1271[_0x3ff4('0x5a')]['id'];}_0x1a1271[_0x3ff4('0x5a')][_0x3ff4('0x61')]=_0x1a1271[_0x3ff4('0x5a')][_0x3ff4('0x61')]||_0x1a1271[_0x3ff4('0x62')]['id'];_0x46ff35[_0x3ff4('0x63')]['id']=_0x1a1271[_0x3ff4('0x5a')][_0x3ff4('0x61')];return db['WhatsappMessage'][_0x3ff4('0x58')]({'where':{'id':_0x1a1271[_0x3ff4('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x448f07,null))[_0x3ff4('0x22')](function(_0x487d6b){if(_0x487d6b){_0x46ff35['message']=_0x487d6b[_0x3ff4('0x64')]({'plain':!![]});return db[_0x3ff4('0x65')][_0x3ff4('0x58')]({'where':{'id':_0x487d6b['WhatsappInteractionId']}});}return null;})[_0x3ff4('0x22')](handleEntityNotFound(_0x448f07,null))['then'](function(_0xda957f){if(_0xda957f){_0x46ff35['interaction']=_0xda957f[_0x3ff4('0x64')]({'plain':!![]});interaction_log[_0x3ff4('0x23')](_0x3ff4('0x7a'),_0x1a1271[_0x3ff4('0x62')]['id'],_0x1a1271['user'][_0x3ff4('0x39')],_0x1a1271[_0x3ff4('0x62')][_0x3ff4('0x6a')],_0x46ff35[_0x3ff4('0x68')]['id'],_0x1a1271[_0x3ff4('0x5a')]?JSON[_0x3ff4('0x27')](_0x1a1271[_0x3ff4('0x5a')]):_0x3ff4('0x6b'));return respondWithRpcPromise(_0x3ff4('0x7b'),_0x3ff4('0x7c'),_0x46ff35);}return null;})[_0x3ff4('0x22')](function(_0x28cf88){var _0x3da318=_0x3ff4('0x6d')+_0x28cf88[_0x3ff4('0x2b')][_0x3ff4('0x6e')];return db['sequelize'][_0x3ff4('0x40')](_0x3da318,{'type':db[_0x3ff4('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3ff4('0x22')](function(_0x438069){return _0x438069;});})[_0x3ff4('0x22')](function(_0x332bda){if(_0x332bda){_0x46ff35[_0x3ff4('0x2b')][_0x3ff4('0x71')]=_0x332bda[0x0];if(!_0x1a1271[_0x3ff4('0x5a')]['UserId'])return;return db['User'][_0x3ff4('0x58')]({'where':{'id':_0x1a1271[_0x3ff4('0x5a')][_0x3ff4('0x61')],'role':'agent'},'attributes':['id',_0x3ff4('0x39'),'fullname',_0x3ff4('0x7d'),_0x3ff4('0x74')],'raw':!![]});}return null;})[_0x3ff4('0x22')](function(_0x73d9be){if(!_0x73d9be)return null;_0x46ff35[_0x3ff4('0x2b')][_0x3ff4('0x63')]=_0x73d9be;return _0x46ff35;})[_0x3ff4('0x22')](function(_0x2677ee){if(_0x2677ee){_0x2677ee[_0x3ff4('0x2b')][_0x3ff4('0x7e')]=util[_0x3ff4('0x7f')]('SIP/%s',_0x1a1271[_0x3ff4('0x62')][_0x3ff4('0x39')]);_0x2677ee[_0x3ff4('0x2b')][_0x3ff4('0x75')]=_0x46ff35['channel'];_0x2677ee[_0x3ff4('0x2b')][_0x3ff4('0x76')]=_0x46ff35[_0x3ff4('0x75')];_0x2677ee[_0x3ff4('0x2b')][_0x3ff4('0x77')]=_0x3ff4('0x80');respondWithRpcPromise(_0x3ff4('0x78'),_0x3ff4('0x78'),{'event':_0x3ff4('0x81'),'message':_0x2677ee[_0x3ff4('0x2b')]},client9002);return _0x46ff35;}return null;})[_0x3ff4('0x22')](respondWithResult(_0x448f07,null))[_0x3ff4('0x2c')](handleError(_0x448f07,null));};exports['status']=function(_0x52d6a4,_0x46053f,_0x5ab63e){if(_0x52d6a4[_0x3ff4('0x5a')]['id']){delete _0x52d6a4[_0x3ff4('0x5a')]['id'];}var _0x3ce730;return db['WhatsappMessage'][_0x3ff4('0x58')]({'where':{'id':_0x52d6a4[_0x3ff4('0x53')]['id']}})[_0x3ff4('0x22')](handleEntityNotFound(_0x46053f,null))['then'](function(_0x56494c){if(_0x56494c){_0x3ce730=_0x56494c;return db['WhatsappAccount']['find']({'where':{'id':_0x56494c[_0x3ff4('0x82')]}});}})[_0x3ff4('0x22')](handleEntityNotFound(_0x46053f,null))[_0x3ff4('0x22')](function(_0x1abf0e){if(_0x1abf0e){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x3ff4('0x2e'),_0x3ff4('0x83'),_0x1abf0e[_0x3ff4('0x3e')],util['inspect'](_0x52d6a4[_0x3ff4('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1abf0e[_0x3ff4('0x3e')]){case _0x3ff4('0x84'):if(_0x52d6a4['body']['MessageSid']&&_0x52d6a4[_0x3ff4('0x5a')][_0x3ff4('0x85')]===_0x3ce730['messageId']&&_0x52d6a4[_0x3ff4('0x5a')][_0x3ff4('0x86')]&&_0x52d6a4[_0x3ff4('0x5a')]['MessageStatus']===_0x3ff4('0x87')){return _0x3ce730[_0x3ff4('0x37')]({'read':!![]});}else{logger[_0x3ff4('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3ff4('0x2e'),_0x3ff4('0x84'),util[_0x3ff4('0x88')](_0x52d6a4[_0x3ff4('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3ce730;}})['then'](respondWithResult(_0x46053f,null))['catch'](handleError(_0x46053f,null));}; \ No newline at end of file +var _0x5362=['read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','motionChannel','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','end','status','limit','undefined','offset','count','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction'];(function(_0x553bf0,_0xb07bc5){var _0x443764=function(_0x46c525){while(--_0x46c525){_0x553bf0['push'](_0x553bf0['shift']());}};_0x443764(++_0xb07bc5);}(_0x5362,0x143));var _0x2536=function(_0x19b3bb,_0x53bd54){_0x19b3bb=_0x19b3bb-0x0;var _0x199f53=_0x5362[_0x19b3bb];return _0x199f53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2536('0x0'));var zipdir=require(_0x2536('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2536('0x2'));var moment=require(_0x2536('0x3'));var BPromise=require(_0x2536('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2536('0x5'));var sox=require(_0x2536('0x6'));var csv=require('to-csv');var ejs=require(_0x2536('0x7'));var fs=require('fs');var fs_extra=require(_0x2536('0x8'));var _=require('lodash');var squel=require(_0x2536('0x9'));var crypto=require(_0x2536('0xa'));var jsforce=require(_0x2536('0xb'));var deskjs=require(_0x2536('0xc'));var toCsv=require(_0x2536('0xd'));var querystring=require('querystring');var Papa=require(_0x2536('0xe'));var Redis=require(_0x2536('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2536('0x10'));var hardwareService=require(_0x2536('0x11'));var logger=require(_0x2536('0x12'))(_0x2536('0x13'));var utils=require(_0x2536('0x14'));var config=require(_0x2536('0x15'));var licenseUtil=require(_0x2536('0x16'));var db=require(_0x2536('0x17'))['db'];config[_0x2536('0x18')]=_[_0x2536('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2536('0x1a'))(new Redis(config[_0x2536('0x18')]));require(_0x2536('0x1b'))['register'](socket);var jayson=require(_0x2536('0x1c'));var client=jayson[_0x2536('0x1d')][_0x2536('0x1e')]({'port':0x232c});var client9002=jayson[_0x2536('0x1d')][_0x2536('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x54208d,_0x9989fe,_0x4b2694,_0x1ce5d7){return new BPromise(function(_0x365c35,_0x36501e){var _0x2f7067=_0x1ce5d7||client;return _0x2f7067[_0x2536('0x1f')](_0x54208d,_0x4b2694)[_0x2536('0x20')](function(_0x5d3c88){logger['info'](_0x2536('0x21'),_0x9989fe,_0x2536('0x22'));logger[_0x2536('0x23')](_0x2536('0x24'),_0x9989fe,_0x2536('0x22'),JSON[_0x2536('0x25')](_0x5d3c88));if(_0x5d3c88[_0x2536('0x26')]){if(_0x5d3c88[_0x2536('0x26')]['code']===0x1f4){logger['error'](_0x2536('0x21'),_0x9989fe,_0x5d3c88[_0x2536('0x26')][_0x2536('0x27')]);return _0x36501e(_0x5d3c88[_0x2536('0x26')][_0x2536('0x27')]);}logger[_0x2536('0x26')](_0x2536('0x21'),_0x9989fe,_0x5d3c88[_0x2536('0x26')][_0x2536('0x27')]);return _0x365c35(_0x5d3c88[_0x2536('0x26')][_0x2536('0x27')]);}else{logger[_0x2536('0x28')](_0x2536('0x21'),_0x9989fe,_0x2536('0x22'));_0x365c35(_0x5d3c88['result']['message']);}})[_0x2536('0x29')](function(_0x3cab8f){logger[_0x2536('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x9989fe,_0x3cab8f);_0x36501e(_0x3cab8f);});});}function respondWithStatusCode(_0x2a866c,_0x42bd98){_0x42bd98=_0x42bd98||0xcc;return function(_0x28470d){if(_0x28470d){return _0x2a866c[_0x2536('0x2a')](_0x42bd98);}return _0x2a866c['status'](_0x42bd98)[_0x2536('0x2b')]();};}function respondWithResult(_0x5a7a64,_0x2873e6){_0x2873e6=_0x2873e6||0xc8;return function(_0x1d1be7){if(_0x1d1be7){return _0x5a7a64[_0x2536('0x2c')](_0x2873e6)['json'](_0x1d1be7);}};}function respondWithFilteredResult(_0x19fc76,_0x35af74){return function(_0x29c127){if(_0x29c127){var _0x18e896=typeof _0x35af74['offset']==='undefined'&&typeof _0x35af74[_0x2536('0x2d')]===_0x2536('0x2e');var _0x3e9184=_0x29c127['count'];var _0x286739=_0x18e896?0x0:_0x35af74[_0x2536('0x2f')];var _0x55ce19=_0x18e896?_0x29c127[_0x2536('0x30')]:_0x35af74[_0x2536('0x2f')]+_0x35af74[_0x2536('0x2d')];var _0x3d0a7b;if(_0x55ce19>=_0x3e9184){_0x55ce19=_0x3e9184;_0x3d0a7b=0xc8;}else{_0x3d0a7b=0xce;}_0x19fc76[_0x2536('0x2c')](_0x3d0a7b);return _0x19fc76['set'](_0x2536('0x31'),_0x286739+'-'+_0x55ce19+'/'+_0x3e9184)[_0x2536('0x32')](_0x29c127);}return null;};}function patchUpdates(_0xbeac08){return function(_0xab3280){try{jsonpatch[_0x2536('0x33')](_0xab3280,_0xbeac08,!![]);}catch(_0x59e59e){return BPromise[_0x2536('0x34')](_0x59e59e);}return _0xab3280[_0x2536('0x35')]();};}function saveUpdates(_0x1dec9f,_0x9fc96a){return function(_0x5248de){if(_0x5248de){return _0x5248de[_0x2536('0x36')](_0x1dec9f)[_0x2536('0x20')](function(_0x32c3d9){return _0x32c3d9;});}return null;};}function removeEntity(_0x5174ec,_0x315228){return function(_0x109fd5){if(_0x109fd5){return _0x109fd5[_0x2536('0x37')]()[_0x2536('0x20')](function(){_0x5174ec['status'](0xcc)[_0x2536('0x2b')]();});}};}function handleEntityNotFound(_0x9fa2ac,_0x4e6802){return function(_0x4f2f3b){if(!_0x4f2f3b){_0x9fa2ac['sendStatus'](0x194);}return _0x4f2f3b;};}function handleError(_0x467670,_0x3db6c9){_0x3db6c9=_0x3db6c9||0x1f4;return function(_0x1cd269){logger['error'](_0x1cd269[_0x2536('0x38')]);if(_0x1cd269[_0x2536('0x39')]){delete _0x1cd269[_0x2536('0x39')];}_0x467670[_0x2536('0x2c')](_0x3db6c9)[_0x2536('0x3a')](_0x1cd269);};}exports[_0x2536('0x3b')]=function(_0x36e798,_0x131858){var _0x30e73a={},_0x3a7f7d={},_0x4142d6={'count':0x0,'rows':[]};var _0x20521b=_[_0x2536('0x3c')](db[_0x2536('0x3d')]['rawAttributes'],function(_0xb5ec02){return{'name':_0xb5ec02[_0x2536('0x3e')],'type':_0xb5ec02[_0x2536('0x3f')][_0x2536('0x40')]};});_0x3a7f7d[_0x2536('0x41')]=_[_0x2536('0x3c')](_0x20521b,_0x2536('0x39'));_0x3a7f7d[_0x2536('0x42')]=_['keys'](_0x36e798['query']);_0x3a7f7d['filters']=_[_0x2536('0x43')](_0x3a7f7d[_0x2536('0x41')],_0x3a7f7d[_0x2536('0x42')]);_0x30e73a[_0x2536('0x44')]=_[_0x2536('0x43')](_0x3a7f7d['model'],qs[_0x2536('0x45')](_0x36e798[_0x2536('0x42')][_0x2536('0x45')]));_0x30e73a[_0x2536('0x44')]=_0x30e73a[_0x2536('0x44')][_0x2536('0x46')]?_0x30e73a[_0x2536('0x44')]:_0x3a7f7d[_0x2536('0x41')];if(!_0x36e798['query'][_0x2536('0x47')](_0x2536('0x48'))){_0x30e73a['limit']=qs[_0x2536('0x2d')](_0x36e798['query']['limit']);_0x30e73a[_0x2536('0x2f')]=qs[_0x2536('0x2f')](_0x36e798[_0x2536('0x42')][_0x2536('0x2f')]);}_0x30e73a[_0x2536('0x49')]=qs[_0x2536('0x4a')](_0x36e798[_0x2536('0x42')][_0x2536('0x4a')]);_0x30e73a[_0x2536('0x4b')]=qs[_0x2536('0x4c')](_[_0x2536('0x4d')](_0x36e798['query'],_0x3a7f7d[_0x2536('0x4c')]),_0x20521b);if(_0x36e798[_0x2536('0x42')][_0x2536('0x4e')]){_0x30e73a[_0x2536('0x4b')]=_[_0x2536('0x4f')](_0x30e73a[_0x2536('0x4b')],{'$or':_[_0x2536('0x3c')](_0x20521b,function(_0x26f3f3){if(_0x26f3f3[_0x2536('0x3f')]!==_0x2536('0x50')){var _0x51d828={};_0x51d828[_0x26f3f3[_0x2536('0x39')]]={'$like':'%'+_0x36e798[_0x2536('0x42')][_0x2536('0x4e')]+'%'};return _0x51d828;}})});}_0x30e73a=_[_0x2536('0x4f')]({},_0x30e73a,_0x36e798[_0x2536('0x51')]);var _0x5c8928={'where':_0x30e73a['where']};return db['WhatsappMessage'][_0x2536('0x30')](_0x5c8928)[_0x2536('0x20')](function(_0x56c9ce){_0x4142d6[_0x2536('0x30')]=_0x56c9ce;if(_0x36e798[_0x2536('0x42')][_0x2536('0x52')]){_0x30e73a[_0x2536('0x53')]=[{'all':!![]}];}return db[_0x2536('0x3d')][_0x2536('0x54')](_0x30e73a);})[_0x2536('0x20')](function(_0x3a40ee){_0x4142d6[_0x2536('0x55')]=_0x3a40ee;return _0x4142d6;})[_0x2536('0x20')](respondWithFilteredResult(_0x131858,_0x30e73a))[_0x2536('0x29')](handleError(_0x131858,null));};exports[_0x2536('0x56')]=function(_0x19b4e6,_0x4d6ba9){var _0xd170e2={'raw':!![],'where':{'id':_0x19b4e6[_0x2536('0x57')]['id']}},_0x5a8297={};_0x5a8297[_0x2536('0x41')]=_[_0x2536('0x58')](db['WhatsappMessage'][_0x2536('0x59')]);_0x5a8297[_0x2536('0x42')]=_[_0x2536('0x58')](_0x19b4e6[_0x2536('0x42')]);_0x5a8297[_0x2536('0x4c')]=_[_0x2536('0x43')](_0x5a8297['model'],_0x5a8297[_0x2536('0x42')]);_0xd170e2[_0x2536('0x44')]=_[_0x2536('0x43')](_0x5a8297['model'],qs[_0x2536('0x45')](_0x19b4e6[_0x2536('0x42')][_0x2536('0x45')]));_0xd170e2[_0x2536('0x44')]=_0xd170e2['attributes'][_0x2536('0x46')]?_0xd170e2[_0x2536('0x44')]:_0x5a8297['model'];if(_0x19b4e6[_0x2536('0x42')][_0x2536('0x52')]){_0xd170e2[_0x2536('0x53')]=[{'all':!![]}];}_0xd170e2=_[_0x2536('0x4f')]({},_0xd170e2,_0x19b4e6[_0x2536('0x51')]);return db[_0x2536('0x3d')][_0x2536('0x5a')](_0xd170e2)[_0x2536('0x20')](handleEntityNotFound(_0x4d6ba9,null))[_0x2536('0x20')](respondWithResult(_0x4d6ba9,null))[_0x2536('0x29')](handleError(_0x4d6ba9,null));};exports[_0x2536('0x5b')]=function(_0xca4425,_0x14df20){return db[_0x2536('0x3d')]['create'](_0xca4425[_0x2536('0x5c')],{})['then'](respondWithResult(_0x14df20,0xc9))[_0x2536('0x29')](handleError(_0x14df20,null));};exports[_0x2536('0x36')]=function(_0x315bd6,_0x5a4a41){if(_0x315bd6['body']['id']){delete _0x315bd6[_0x2536('0x5c')]['id'];}return db[_0x2536('0x3d')][_0x2536('0x5a')]({'where':{'id':_0x315bd6['params']['id']}})[_0x2536('0x20')](handleEntityNotFound(_0x5a4a41,null))['then'](saveUpdates(_0x315bd6['body'],null))['then'](respondWithResult(_0x5a4a41,null))[_0x2536('0x29')](handleError(_0x5a4a41,null));};exports[_0x2536('0x37')]=function(_0x1574e0,_0x33db51){return db[_0x2536('0x3d')][_0x2536('0x5a')]({'where':{'id':_0x1574e0['params']['id']}})[_0x2536('0x20')](handleEntityNotFound(_0x33db51,null))['then'](removeEntity(_0x33db51,null))[_0x2536('0x29')](handleError(_0x33db51,null));};exports[_0x2536('0x5d')]=function(_0x3ae1bf,_0x11323d){return db[_0x2536('0x3d')][_0x2536('0x5d')]()[_0x2536('0x20')](respondWithResult(_0x11323d,null))[_0x2536('0x29')](handleError(_0x11323d,null));};var interaction_log=require(_0x2536('0x12'))(_0x2536('0x5e'));exports[_0x2536('0x5f')]=function(_0x585e41,_0x54c904,_0x299c83){var _0x5c3de0={'agent':{},'channel':_0x2536('0x60')};if(_0x585e41[_0x2536('0x5c')]['id']){delete _0x585e41[_0x2536('0x5c')]['id'];}_0x585e41['body']['read']=!![];_0x585e41[_0x2536('0x5c')][_0x2536('0x61')]=moment()['format'](_0x2536('0x62'));_0x585e41[_0x2536('0x5c')][_0x2536('0x63')]=_0x585e41[_0x2536('0x5c')][_0x2536('0x63')]||_0x585e41[_0x2536('0x64')]['id'];_0x5c3de0['agent']['id']=_0x585e41[_0x2536('0x5c')]['UserId'];return db[_0x2536('0x3d')][_0x2536('0x5a')]({'where':{'id':_0x585e41[_0x2536('0x57')]['id'],'UserId':null}})[_0x2536('0x20')](handleEntityNotFound(_0x54c904,null))[_0x2536('0x20')](saveUpdates(_0x585e41[_0x2536('0x5c')],null))[_0x2536('0x20')](function(_0x122c9b){if(_0x122c9b){_0x5c3de0[_0x2536('0x27')]=_0x122c9b[_0x2536('0x65')]({'plain':!![]});return db[_0x2536('0x66')][_0x2536('0x5a')]({'where':{'id':_0x122c9b['WhatsappInteractionId']}});}return null;})[_0x2536('0x20')](handleEntityNotFound(_0x54c904,null))[_0x2536('0x20')](function(_0x424226){if(_0x424226){return _0x424226[_0x2536('0x36')]({'UserId':_0x585e41[_0x2536('0x5c')][_0x2536('0x63')],'read1stAt':_['isNil'](_0x424226[_0x2536('0x67')])?moment()[_0x2536('0x68')](_0x2536('0x62')):undefined});}return null;})['then'](function(_0x5d6d47){if(_0x5d6d47){_0x5c3de0[_0x2536('0x69')]=_0x5d6d47[_0x2536('0x65')]({'plain':!![]});interaction_log[_0x2536('0x28')](_0x2536('0x6a'),_0x585e41[_0x2536('0x64')]['id'],_0x585e41[_0x2536('0x64')][_0x2536('0x39')],_0x585e41[_0x2536('0x64')]['role'],_0x5c3de0[_0x2536('0x69')]['id'],_0x585e41[_0x2536('0x5c')]?JSON[_0x2536('0x25')](_0x585e41[_0x2536('0x5c')]):_0x2536('0x6b'));return respondWithRpcPromise(_0x2536('0x6c'),_0x2536('0x6d'),_0x5c3de0);}return null;})[_0x2536('0x20')](function(_0x3515e4){var _0x1eb020=_0x2536('0x6e')+_0x3515e4['message'][_0x2536('0x6f')];return db['sequelize'][_0x2536('0x42')](_0x1eb020,{'type':db[_0x2536('0x70')][_0x2536('0x71')][_0x2536('0x72')],'raw':!![]})['then'](function(_0x27e4f7){return _0x27e4f7;});})['then'](function(_0x5996cd){if(_0x5996cd){_0x5c3de0['message'][_0x2536('0x73')]=_0x5996cd[0x0];if(!_0x585e41['body'][_0x2536('0x63')])return;return db[_0x2536('0x74')][_0x2536('0x5a')]({'where':{'id':_0x585e41['body'][_0x2536('0x63')],'role':_0x2536('0x75')},'attributes':['id',_0x2536('0x39'),_0x2536('0x76'),'email',_0x2536('0x77')],'raw':!![]});}return null;})[_0x2536('0x20')](function(_0x2f80a3){if(!_0x2f80a3)return null;_0x5c3de0[_0x2536('0x27')][_0x2536('0x75')]=_0x2f80a3;return _0x5c3de0;})[_0x2536('0x20')](function(_0x1ac604){if(_0x1ac604){if(_0x585e41[_0x2536('0x5c')][_0x2536('0x78')]){_0x5c3de0[_0x2536('0x27')][_0x2536('0x79')]=util[_0x2536('0x68')](_0x2536('0x7a'),_0x585e41[_0x2536('0x64')]['name']);_0x5c3de0[_0x2536('0x27')]['channel']=_0x5c3de0[_0x2536('0x7b')];_0x5c3de0['message']['motionChannel']=_0x5c3de0[_0x2536('0x7b')];_0x5c3de0[_0x2536('0x27')][_0x2536('0x7c')]=_0x2536('0x5f');return respondWithRpcPromise(_0x2536('0x7d'),'EventManager',{'event':_0x2536('0x7e'),'message':_0x5c3de0[_0x2536('0x27')]},client9002)[_0x2536('0x20')](function(){return _0x5c3de0;});}return _0x5c3de0;}return null;})[_0x2536('0x20')](respondWithResult(_0x54c904,null))[_0x2536('0x29')](handleError(_0x54c904,null));};var interaction_log=require(_0x2536('0x12'))('whatsapp-interactions');exports[_0x2536('0x34')]=function(_0xd65b4e,_0x56dee8,_0x3a1c43){var _0xe1a96a={'agent':{},'channel':_0x2536('0x60')};if(_0xd65b4e['body']['id']){delete _0xd65b4e[_0x2536('0x5c')]['id'];}_0xd65b4e[_0x2536('0x5c')][_0x2536('0x63')]=_0xd65b4e[_0x2536('0x5c')][_0x2536('0x63')]||_0xd65b4e['user']['id'];_0xe1a96a[_0x2536('0x75')]['id']=_0xd65b4e['body'][_0x2536('0x63')];return db['WhatsappMessage'][_0x2536('0x5a')]({'where':{'id':_0xd65b4e['params']['id'],'UserId':null}})[_0x2536('0x20')](handleEntityNotFound(_0x56dee8,null))[_0x2536('0x20')](function(_0x4e39aa){if(_0x4e39aa){_0xe1a96a[_0x2536('0x27')]=_0x4e39aa['get']({'plain':!![]});return db[_0x2536('0x66')][_0x2536('0x5a')]({'where':{'id':_0x4e39aa[_0x2536('0x7f')]}});}return null;})[_0x2536('0x20')](handleEntityNotFound(_0x56dee8,null))[_0x2536('0x20')](function(_0x254566){if(_0x254566){_0xe1a96a['interaction']=_0x254566[_0x2536('0x65')]({'plain':!![]});interaction_log[_0x2536('0x28')](_0x2536('0x80'),_0xd65b4e[_0x2536('0x64')]['id'],_0xd65b4e[_0x2536('0x64')][_0x2536('0x39')],_0xd65b4e[_0x2536('0x64')]['role'],_0xe1a96a[_0x2536('0x69')]['id'],_0xd65b4e[_0x2536('0x5c')]?JSON[_0x2536('0x25')](_0xd65b4e[_0x2536('0x5c')]):_0x2536('0x6b'));return respondWithRpcPromise(_0x2536('0x81'),_0x2536('0x82'),_0xe1a96a);}return null;})[_0x2536('0x20')](function(_0x50d7e1){var _0x10cfe3=_0x2536('0x6e')+_0x50d7e1[_0x2536('0x27')][_0x2536('0x6f')];return db[_0x2536('0x83')][_0x2536('0x42')](_0x10cfe3,{'type':db[_0x2536('0x70')][_0x2536('0x71')][_0x2536('0x72')],'raw':!![]})['then'](function(_0xe668cd){return _0xe668cd;});})['then'](function(_0x215f6f){if(_0x215f6f){_0xe1a96a[_0x2536('0x27')][_0x2536('0x73')]=_0x215f6f[0x0];if(!_0xd65b4e[_0x2536('0x5c')][_0x2536('0x63')])return;return db['User']['find']({'where':{'id':_0xd65b4e[_0x2536('0x5c')]['UserId'],'role':'agent'},'attributes':['id',_0x2536('0x39'),'fullname',_0x2536('0x84'),_0x2536('0x77')],'raw':!![]});}return null;})[_0x2536('0x20')](function(_0x59bd43){if(!_0x59bd43)return null;_0xe1a96a[_0x2536('0x27')][_0x2536('0x75')]=_0x59bd43;return _0xe1a96a;})[_0x2536('0x20')](function(_0x5f3c67){if(_0x5f3c67){_0x5f3c67['message'][_0x2536('0x79')]=util[_0x2536('0x68')]('SIP/%s',_0xd65b4e[_0x2536('0x64')][_0x2536('0x39')]);_0x5f3c67[_0x2536('0x27')]['channel']=_0xe1a96a[_0x2536('0x7b')];_0x5f3c67['message'][_0x2536('0x85')]=_0xe1a96a[_0x2536('0x7b')];_0x5f3c67[_0x2536('0x27')][_0x2536('0x7c')]=_0x2536('0x34');respondWithRpcPromise('EventManager',_0x2536('0x7d'),{'event':_0x2536('0x86'),'message':_0x5f3c67[_0x2536('0x27')]},client9002);return _0xe1a96a;}return null;})[_0x2536('0x20')](respondWithResult(_0x56dee8,null))['catch'](handleError(_0x56dee8,null));};exports[_0x2536('0x2c')]=function(_0x5856eb,_0x198f9b,_0x237ebf){if(_0x5856eb[_0x2536('0x5c')]['id']){delete _0x5856eb[_0x2536('0x5c')]['id'];}var _0x56706a;return db[_0x2536('0x3d')][_0x2536('0x5a')]({'where':{'id':_0x5856eb['params']['id']}})[_0x2536('0x20')](handleEntityNotFound(_0x198f9b,null))[_0x2536('0x20')](function(_0xc1f600){if(_0xc1f600){_0x56706a=_0xc1f600;return db[_0x2536('0x87')][_0x2536('0x5a')]({'where':{'id':_0xc1f600['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x198f9b,null))[_0x2536('0x20')](function(_0x489ea8){if(_0x489ea8){logger[_0x2536('0x23')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x2536('0x2c'),_0x2536('0x88'),_0x489ea8['type'],util[_0x2536('0x89')](_0x5856eb[_0x2536('0x5c')],{'showHidden':![],'depth':null}));switch(_0x489ea8['type']){case'twilio':if(_0x5856eb['body']['MessageSid']&&_0x5856eb[_0x2536('0x5c')][_0x2536('0x8a')]===_0x56706a['messageId']&&_0x5856eb[_0x2536('0x5c')][_0x2536('0x8b')]&&_0x5856eb['body'][_0x2536('0x8b')]==='read'){return _0x56706a['update']({'read':!![]});}else{logger[_0x2536('0x26')](_0x2536('0x8c'),_0x2536('0x2c'),_0x2536('0x8d'),util[_0x2536('0x89')](_0x5856eb['body'],{'showHidden':![],'depth':null}));}break;}return _0x56706a;}})[_0x2536('0x20')](respondWithResult(_0x198f9b,null))[_0x2536('0x29')](handleError(_0x198f9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f3f9756..741d2ec 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 _0x9c2c=['events','../../mysqldb','update','emit','hasOwnProperty','hook','exports'];(function(_0x4d0292,_0x5763b7){var _0x1ee6ff=function(_0x222de2){while(--_0x222de2){_0x4d0292['push'](_0x4d0292['shift']());}};_0x1ee6ff(++_0x5763b7);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc9c2('0x0'));var WhatsappMessage=require(_0xc9c2('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9c2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3d0e43){return function(_0x14e513,_0x5bf334,_0x4db342){WhatsappMessageEvents[_0xc9c2('0x3')](_0x3d0e43+':'+_0x14e513['id'],_0x14e513);WhatsappMessageEvents['emit'](_0x3d0e43,_0x14e513);_0x4db342(null);};}for(var e in events){if(events[_0xc9c2('0x4')](e)){var event=events[e];WhatsappMessage[_0xc9c2('0x5')](e,emitEvent(event));}}module[_0xc9c2('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5eb8=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x443cb5,_0x566cbb){var _0x255725=function(_0x1ed641){while(--_0x1ed641){_0x443cb5['push'](_0x443cb5['shift']());}};_0x255725(++_0x566cbb);}(_0x5eb8,0xb0));var _0x85eb=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0x5eb8[_0x292f35];return _0x288e75;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x85eb('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x85eb('0x1')](0x0);var events={'afterCreate':_0x85eb('0x2'),'afterUpdate':_0x85eb('0x3'),'afterDestroy':_0x85eb('0x4')};function emitEvent(_0x13d8a9){return function(_0x13b1df,_0x44e313,_0x3c5798){WhatsappMessageEvents[_0x85eb('0x5')](_0x13d8a9+':'+_0x13b1df['id'],_0x13b1df);WhatsappMessageEvents[_0x85eb('0x5')](_0x13d8a9,_0x13b1df);_0x3c5798(null);};}for(var e in events){if(events[_0x85eb('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x85eb('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 9a1aaae..aa2d5c4 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 _0x37fd=['afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x37fd,0x89));var _0xd37f=function(_0x51c846,_0x8d8df9){_0x51c846=_0x51c846-0x0;var _0x409189=_0x37fd[_0x51c846];return _0x409189;};'use strict';var _=require(_0xd37f('0x0'));var util=require(_0xd37f('0x1'));var logger=require(_0xd37f('0x2'))('api');var moment=require(_0xd37f('0x3'));var BPromise=require(_0xd37f('0x4'));var rp=require(_0xd37f('0x5'));var fetch=require(_0xd37f('0x6'));var fs=require('fs');var path=require(_0xd37f('0x7'));var rimraf=require(_0xd37f('0x8'));var config=require('../../config/environment');var attributes=require(_0xd37f('0x9'));module[_0xd37f('0xa')]=function(_0x58f76f,_0x40e566){return _0x58f76f[_0xd37f('0xb')](_0xd37f('0xc'),attributes,{'tableName':_0xd37f('0xd'),'paranoid':![],'indexes':[{'name':_0xd37f('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xd37f('0xf')],'type':_0xd37f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fdbff,_0x2e6a3a,_0xd8de9c){var _0x619c77=_0x58f76f[_0xd37f('0x11')];var _0x2267bf=_0x2fdbff[_0xd37f('0x12')]({'plain':!![]});if(_0x2267bf['direction'][_0xd37f('0x13')]()==='in'||_0x2267bf[_0xd37f('0x14')]['toLowerCase']()===_0xd37f('0x15')&&!_0x2267bf[_0xd37f('0x16')]&&!_[_0xd37f('0x17')](_0x2267bf[_0xd37f('0x18')])){_0x619c77['WhatsappInteraction'][_0xd37f('0x19')]({'where':{'id':_0x2267bf[_0xd37f('0x1a')]}})[_0xd37f('0x1b')](function(_0x484270){if(_0x484270){_0x484270[_0xd37f('0x1c')]({'lastMsgAt':_0x2267bf[_0xd37f('0x1d')],'lastMsgDirection':_0x2267bf[_0xd37f('0x14')][_0xd37f('0x13')]()});}})[_0xd37f('0x1e')](function(_0x1a02d7){console[_0xd37f('0x1f')](_0x1a02d7);});}if(_0x2267bf[_0xd37f('0x14')]===_0xd37f('0x15')&&!_0x2267bf[_0xd37f('0x16')]){var _0x51a73f;_0x619c77[_0xd37f('0x20')][_0xd37f('0x21')]({'where':{'id':_0x2267bf[_0xd37f('0x22')]},'raw':!![]})[_0xd37f('0x1b')](function(_0x5dbb58){_0x51a73f=_0x5dbb58;if(_0x51a73f&&_0x51a73f[_0xd37f('0x23')]){switch(_0x51a73f['type']){case _0xd37f('0x24'):var _0x51f3ad=require(_0xd37f('0x24'));if(_0x51a73f[_0xd37f('0x25')]&&_0x51a73f[_0xd37f('0x26')]&&_0x51a73f['phone']){var _0x13d35a=new _0x51f3ad(_0x51a73f[_0xd37f('0x25')],_0x51a73f[_0xd37f('0x26')]);_0x13d35a[_0xd37f('0x27')]['create']({'body':_0x2267bf[_0xd37f('0xf')],'to':'whatsapp:'+_0x2267bf['phone'],'from':_0xd37f('0x28')+_0x51a73f[_0xd37f('0x29')],'statusCallback':_0x51a73f['remote']+_0xd37f('0x2a')+_0x2267bf['id']+_0xd37f('0x2b')+_0x51a73f[_0xd37f('0x2c')]})[_0xd37f('0x1b')](function(_0x284c66){if(_0x284c66[_0xd37f('0x2d')]){return _0x2fdbff[_0xd37f('0x1c')]({'messageId':_0x284c66[_0xd37f('0x2d')]});}})['catch'](function(_0x525c08){logger[_0xd37f('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util['inspect'](_0x525c08,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd37f('0x2e'),_0xd37f('0x24'),_0xd37f('0x2f'));}break;case _0xd37f('0x30'):var _0x4cc983=_0x51a73f[_0xd37f('0x25')];var _0x4b8678=_0x51a73f[_0xd37f('0x26')];var _0x179976=_0x51a73f[_0xd37f('0x31')]+_0xd37f('0x32')+_0x4cc983+'/messages/';var _0x35608a={'to':[_0x2267bf[_0xd37f('0x29')]],'message':{'type':_0xd37f('0x33'),'text':_0x2267bf[_0xd37f('0xf')]}};var _0x27c376={'method':_0xd37f('0x34'),'uri':_0x179976,'headers':{'Authorization':_0xd37f('0x35')+_0x4b8678,'Content-Type':_0xd37f('0x36')},'body':_0x35608a,'json':!![]};rp(_0x27c376)[_0xd37f('0x1b')](function(_0x3d4faf){if(_0x3d4faf[_0xd37f('0x37')][0x0][_0xd37f('0x38')]){return _0x2fdbff[_0xd37f('0x1c')]({'messageId':_0x3d4faf['statuses'][0x0][_0xd37f('0x38')]});}})[_0xd37f('0x1e')](function(_0x3d84a4){logger['err'](_0xd37f('0x39'),_0x3d84a4);});break;}}})[_0xd37f('0x3a')](function(){_0xd8de9c();});}else{_0xd8de9c();}}},'charset':_0xd37f('0x3b'),'collate':_0xd37f('0x3c')});}; \ No newline at end of file +var _0x63db=['token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x185e5d,_0x4ae680){var _0x2f4737=function(_0x57d37c){while(--_0x57d37c){_0x185e5d['push'](_0x185e5d['shift']());}};_0x2f4737(++_0x4ae680);}(_0x63db,0x87));var _0xb63d=function(_0x282028,_0x151f9a){_0x282028=_0x282028-0x0;var _0x229ff2=_0x63db[_0x282028];return _0x229ff2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb63d('0x0'));var fetch=require(_0xb63d('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb63d('0x2'));var attributes=require(_0xb63d('0x3'));module[_0xb63d('0x4')]=function(_0xca83bf,_0x4b76f9){return _0xca83bf['define'](_0xb63d('0x5'),attributes,{'tableName':_0xb63d('0x6'),'paranoid':![],'indexes':[{'name':_0xb63d('0x7'),'fields':[_0xb63d('0x7')]},{'name':_0xb63d('0x8'),'fields':['body'],'type':_0xb63d('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e877b,_0xb489c6,_0x204ec3){var _0x18725d=_0xca83bf[_0xb63d('0xa')];var _0x493d56=_0x4e877b[_0xb63d('0xb')]({'plain':!![]});if(_0x493d56[_0xb63d('0xc')]['toLowerCase']()==='in'||_0x493d56['direction'][_0xb63d('0xd')]()===_0xb63d('0xe')&&!_0x493d56[_0xb63d('0xf')]&&!_['isNil'](_0x493d56[_0xb63d('0x10')])){_0x18725d[_0xb63d('0x11')][_0xb63d('0x12')]({'where':{'id':_0x493d56['WhatsappInteractionId']}})[_0xb63d('0x13')](function(_0x6ff402){if(_0x6ff402){_0x6ff402[_0xb63d('0x14')]({'lastMsgAt':_0x493d56[_0xb63d('0x15')],'lastMsgDirection':_0x493d56[_0xb63d('0xc')][_0xb63d('0xd')]()});}})[_0xb63d('0x16')](function(_0x1aa3f7){console[_0xb63d('0x17')](_0x1aa3f7);});}if(_0x493d56['direction']===_0xb63d('0xe')&&!_0x493d56['secret']){var _0x386d5a;_0x18725d[_0xb63d('0x18')][_0xb63d('0x19')]({'where':{'id':_0x493d56[_0xb63d('0x1a')]},'raw':!![]})[_0xb63d('0x13')](function(_0x13a1d7){_0x386d5a=_0x13a1d7;if(_0x386d5a&&_0x386d5a['type']){switch(_0x386d5a[_0xb63d('0x1b')]){case _0xb63d('0x1c'):var _0xa9cf59=require(_0xb63d('0x1c'));if(_0x386d5a['accountSid']&&_0x386d5a[_0xb63d('0x1d')]&&_0x386d5a[_0xb63d('0x1e')]){var _0x493959=new _0xa9cf59(_0x386d5a[_0xb63d('0x1f')],_0x386d5a[_0xb63d('0x1d')]);_0x493959[_0xb63d('0x20')][_0xb63d('0x21')]({'body':_0x493d56[_0xb63d('0x22')],'to':_0xb63d('0x23')+_0x493d56[_0xb63d('0x1e')],'from':_0xb63d('0x23')+_0x386d5a[_0xb63d('0x1e')],'statusCallback':_0x386d5a[_0xb63d('0x24')]+_0xb63d('0x25')+_0x493d56['id']+_0xb63d('0x26')+_0x386d5a[_0xb63d('0x27')]})['then'](function(_0x47429a){if(_0x47429a[_0xb63d('0x28')]){return _0x4e877b[_0xb63d('0x14')]({'messageId':_0x47429a[_0xb63d('0x28')]});}})[_0xb63d('0x16')](function(_0x400ab6){logger['error'](_0xb63d('0x29'),'afterCreate',_0xb63d('0x1c'),util[_0xb63d('0x2a')](_0x400ab6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb63d('0x29'),_0xb63d('0x2b'),_0xb63d('0x1c'),_0xb63d('0x2c'));}break;case _0xb63d('0x2d'):var _0xe6fb5f=_0x386d5a['accountSid'];var _0x4b76ec=_0x386d5a['authToken'];var _0x271985=_0x386d5a['baseUrl']+_0xb63d('0x2e')+_0xe6fb5f+_0xb63d('0x2f');var _0x5e1c8a={'to':[_0x493d56['phone']],'message':{'type':_0xb63d('0x30'),'text':_0x493d56[_0xb63d('0x22')]}};var _0x3440d2={'method':_0xb63d('0x31'),'uri':_0x271985,'headers':{'Authorization':'Bearer\x20'+_0x4b76ec,'Content-Type':_0xb63d('0x32')},'body':_0x5e1c8a,'json':!![]};rp(_0x3440d2)['then'](function(_0x2f2718){if(_0x2f2718[_0xb63d('0x33')][0x0][_0xb63d('0x34')]){return _0x4e877b[_0xb63d('0x14')]({'messageId':_0x2f2718['statuses'][0x0][_0xb63d('0x34')]});}})[_0xb63d('0x16')](function(_0x346584){logger[_0xb63d('0x35')](_0xb63d('0x36'),_0x346584);});break;}}})[_0xb63d('0x37')](function(){_0x204ec3();});}else{_0x204ec3();}}},'charset':_0xb63d('0x38'),'collate':_0xb63d('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 80a1b6d..c6393dc 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 _0x9dba=['CreateWhatsappMessage','WhatsappMessage','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9dba,0x1a9));var _0xa9db=function(_0xd447f9,_0x481d81){_0xd447f9=_0xd447f9-0x0;var _0xdb4609=_0x9dba[_0xd447f9];return _0xdb4609;};'use strict';var _=require(_0xa9db('0x0'));var util=require(_0xa9db('0x1'));var moment=require(_0xa9db('0x2'));var BPromise=require(_0xa9db('0x3'));var rs=require(_0xa9db('0x4'));var fs=require('fs');var Redis=require(_0xa9db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9db('0x6'));var logger=require(_0xa9db('0x7'))(_0xa9db('0x8'));var config=require(_0xa9db('0x9'));var jayson=require(_0xa9db('0xa'));var client=jayson['client'][_0xa9db('0xb')]({'port':0x232a});config[_0xa9db('0xc')]=_[_0xa9db('0xd')](config[_0xa9db('0xc')],{'host':_0xa9db('0xe'),'port':0x18eb});var socket=require(_0xa9db('0xf'))(new Redis(config[_0xa9db('0xc')]));require(_0xa9db('0x10'))[_0xa9db('0x11')](socket);function respondWithRpcPromise(_0x189ca3,_0x419be3,_0x3a818f){return new BPromise(function(_0x53c517,_0xa14fa9){return client[_0xa9db('0x12')](_0x189ca3,_0x3a818f)['then'](function(_0x4f9f47){logger[_0xa9db('0x13')](_0xa9db('0x14'),_0x419be3,'request\x20sent');logger[_0xa9db('0x15')](_0xa9db('0x16'),_0x419be3,'request\x20sent',JSON[_0xa9db('0x17')](_0x4f9f47));if(_0x4f9f47[_0xa9db('0x18')]){if(_0x4f9f47[_0xa9db('0x18')][_0xa9db('0x19')]===0x1f4){logger[_0xa9db('0x18')](_0xa9db('0x14'),_0x419be3,_0x4f9f47[_0xa9db('0x18')][_0xa9db('0x1a')]);return _0xa14fa9(_0x4f9f47[_0xa9db('0x18')][_0xa9db('0x1a')]);}logger['error'](_0xa9db('0x14'),_0x419be3,_0x4f9f47[_0xa9db('0x18')][_0xa9db('0x1a')]);return _0x53c517(_0x4f9f47[_0xa9db('0x18')][_0xa9db('0x1a')]);}else{logger['info'](_0xa9db('0x14'),_0x419be3,_0xa9db('0x1b'));_0x53c517(_0x4f9f47[_0xa9db('0x1c')][_0xa9db('0x1a')]);}})[_0xa9db('0x1d')](function(_0x3de2a3){logger[_0xa9db('0x18')](_0xa9db('0x14'),_0x419be3,_0x3de2a3);_0xa14fa9(_0x3de2a3);});});}exports[_0xa9db('0x1e')]=function(_0x4de18f){var _0x5a5e46=this;return new Promise(function(_0x19808c,_0x4928f0){return db[_0xa9db('0x1f')][_0xa9db('0x20')](_0x4de18f[_0xa9db('0x21')],{'raw':_0x4de18f['options']?_0x4de18f['options'][_0xa9db('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x5abed9){logger['info'](_0xa9db('0x1e'),_0x4de18f);logger[_0xa9db('0x15')](_0xa9db('0x1e'),_0x4de18f,JSON[_0xa9db('0x17')](_0x5abed9));_0x19808c(_0x5abed9);})[_0xa9db('0x1d')](function(_0x1e4ef7){logger['error'](_0xa9db('0x1e'),_0x1e4ef7['message'],_0x4de18f);_0x4928f0(_0x5a5e46['error'](0x1f4,_0x1e4ef7[_0xa9db('0x1a')]));});});}; \ No newline at end of file +var _0x481d=['body','options','raw','then','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateWhatsappMessage','create'];(function(_0x3659e0,_0x364f9a){var _0x21d0ab=function(_0x2efd4f){while(--_0x2efd4f){_0x3659e0['push'](_0x3659e0['shift']());}};_0x21d0ab(++_0x364f9a);}(_0x481d,0x84));var _0xd481=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x481d[_0x5e3701];return _0x345dcf;};'use strict';var _=require('lodash');var util=require(_0xd481('0x0'));var moment=require(_0xd481('0x1'));var BPromise=require('bluebird');var rs=require(_0xd481('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd481('0x3'))['db'];var utils=require(_0xd481('0x4'));var logger=require(_0xd481('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd481('0x6'));var client=jayson[_0xd481('0x7')][_0xd481('0x8')]({'port':0x232a});config[_0xd481('0x9')]=_[_0xd481('0xa')](config[_0xd481('0x9')],{'host':_0xd481('0xb'),'port':0x18eb});var socket=require(_0xd481('0xc'))(new Redis(config[_0xd481('0x9')]));require(_0xd481('0xd'))[_0xd481('0xe')](socket);function respondWithRpcPromise(_0x2effa4,_0x13ead3,_0x11aa5f){return new BPromise(function(_0x246cc5,_0xa093f4){return client[_0xd481('0xf')](_0x2effa4,_0x11aa5f)['then'](function(_0x5a65de){logger['info'](_0xd481('0x10'),_0x13ead3,_0xd481('0x11'));logger[_0xd481('0x12')](_0xd481('0x13'),_0x13ead3,'request\x20sent',JSON[_0xd481('0x14')](_0x5a65de));if(_0x5a65de[_0xd481('0x15')]){if(_0x5a65de[_0xd481('0x15')][_0xd481('0x16')]===0x1f4){logger[_0xd481('0x15')](_0xd481('0x10'),_0x13ead3,_0x5a65de[_0xd481('0x15')][_0xd481('0x17')]);return _0xa093f4(_0x5a65de[_0xd481('0x15')]['message']);}logger[_0xd481('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x13ead3,_0x5a65de[_0xd481('0x15')][_0xd481('0x17')]);return _0x246cc5(_0x5a65de[_0xd481('0x15')][_0xd481('0x17')]);}else{logger[_0xd481('0x18')](_0xd481('0x10'),_0x13ead3,_0xd481('0x11'));_0x246cc5(_0x5a65de['result'][_0xd481('0x17')]);}})[_0xd481('0x19')](function(_0x1a3414){logger[_0xd481('0x15')](_0xd481('0x10'),_0x13ead3,_0x1a3414);_0xa093f4(_0x1a3414);});});}exports[_0xd481('0x1a')]=function(_0x3f9aa7){var _0x5ab2e0=this;return new Promise(function(_0x513f75,_0x1875cb){return db['WhatsappMessage'][_0xd481('0x1b')](_0x3f9aa7[_0xd481('0x1c')],{'raw':_0x3f9aa7['options']?_0x3f9aa7[_0xd481('0x1d')][_0xd481('0x1e')]===undefined?!![]:![]:!![]})[_0xd481('0x1f')](function(_0x58271d){logger['info'](_0xd481('0x1a'),_0x3f9aa7);logger[_0xd481('0x12')](_0xd481('0x1a'),_0x3f9aa7,JSON['stringify'](_0x58271d));_0x513f75(_0x58271d);})[_0xd481('0x19')](function(_0x52ebe1){logger['error'](_0xd481('0x1a'),_0x52ebe1[_0xd481('0x17')],_0x3f9aa7);_0x1875cb(_0x5ab2e0[_0xd481('0x15')](0x1f4,_0x52ebe1[_0xd481('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ea9e9f9..0fcf1a4 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 _0x2715=['emit','removeListener','register','length','whatsappMessage:','remove'];(function(_0x221ff4,_0x4c0cca){var _0x387386=function(_0x51baf7){while(--_0x51baf7){_0x221ff4['push'](_0x221ff4['shift']());}};_0x387386(++_0x4c0cca);}(_0x2715,0x14f));var _0x5271=function(_0x500861,_0x488886){_0x500861=_0x500861-0x0;var _0x3919fd=_0x2715[_0x500861];return _0x3919fd;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x5271('0x0'),'update'];function createListener(_0x181353,_0x1cc276){return function(_0x2f3be8){_0x1cc276[_0x5271('0x1')](_0x181353,_0x2f3be8);};}function removeListener(_0x43310d,_0x38806a){return function(){WhatsappMessageEvents[_0x5271('0x2')](_0x43310d,_0x38806a);};}exports[_0x5271('0x3')]=function(_0x305827){for(var _0x2640eb=0x0,_0xbeceeb=events[_0x5271('0x4')];_0x2640eb<_0xbeceeb;_0x2640eb++){var _0x5d79ca=events[_0x2640eb];var _0x307a97=createListener(_0x5271('0x5')+_0x5d79ca,_0x305827);WhatsappMessageEvents['on'](_0x5d79ca,_0x307a97);}}; \ No newline at end of file +var _0x2951=['whatsappMessage:','save','remove','update','emit','register','length'];(function(_0x46d4f6,_0x1247b2){var _0x1900b5=function(_0x1c7808){while(--_0x1c7808){_0x46d4f6['push'](_0x46d4f6['shift']());}};_0x1900b5(++_0x1247b2);}(_0x2951,0x1e4));var _0x1295=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0x2951[_0xb68772];return _0x4189bb;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x1295('0x0'),_0x1295('0x1'),_0x1295('0x2')];function createListener(_0x3d26a0,_0x556c01){return function(_0x109018){_0x556c01[_0x1295('0x3')](_0x3d26a0,_0x109018);};}function removeListener(_0x2cc277,_0xf1fb46){return function(){WhatsappMessageEvents['removeListener'](_0x2cc277,_0xf1fb46);};}exports[_0x1295('0x4')]=function(_0x522eb6){for(var _0xdfb2df=0x0,_0x1ef6a1=events[_0x1295('0x5')];_0xdfb2df<_0x1ef6a1;_0xdfb2df++){var _0x33303c=events[_0xdfb2df];var _0x137fb8=createListener(_0x1295('0x6')+_0x33303c,_0x522eb6);WhatsappMessageEvents['on'](_0x33303c,_0x137fb8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6300ae0..ec0b564 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 _0xcf65=['put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents'];(function(_0xb1ebd8,_0x4a7e13){var _0xf64ff9=function(_0x5f317e){while(--_0x5f317e){_0xb1ebd8['push'](_0xb1ebd8['shift']());}};_0xf64ff9(++_0x4a7e13);}(_0xcf65,0x113));var _0x5cf6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf65[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x5cf6('0x0'));var util=require(_0x5cf6('0x1'));var path=require(_0x5cf6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5cf6('0x3'));var auth=require(_0x5cf6('0x4'));var interaction=require(_0x5cf6('0x5'));var config=require(_0x5cf6('0x6'));var controller=require(_0x5cf6('0x7'));router[_0x5cf6('0x8')]('/',auth[_0x5cf6('0x9')](),controller[_0x5cf6('0xa')]);router['get'](_0x5cf6('0xb'),auth[_0x5cf6('0x9')](),controller[_0x5cf6('0xc')]);router['get'](_0x5cf6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5cf6('0x8')](_0x5cf6('0xe'),auth[_0x5cf6('0x9')](),controller[_0x5cf6('0xf')]);router['get']('/:id/teams',auth[_0x5cf6('0x9')](),controller['getTeams']);router[_0x5cf6('0x8')](_0x5cf6('0x10'),auth['isAuthenticated'](),controller[_0x5cf6('0x11')]);router[_0x5cf6('0x12')]('/',auth[_0x5cf6('0x9')](),controller['create']);router[_0x5cf6('0x12')](_0x5cf6('0x13'),auth['isAuthenticated'](),controller[_0x5cf6('0x14')]);router[_0x5cf6('0x12')](_0x5cf6('0x10'),auth[_0x5cf6('0x9')](),controller[_0x5cf6('0x15')]);router[_0x5cf6('0x16')](_0x5cf6('0xd'),auth[_0x5cf6('0x9')](),controller[_0x5cf6('0x17')]);router[_0x5cf6('0x18')](_0x5cf6('0xd'),auth['isAuthenticated'](),controller[_0x5cf6('0x19')]);router[_0x5cf6('0x18')](_0x5cf6('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x5cf6('0x18')]('/:id/users',auth[_0x5cf6('0x9')](),controller['removeAgents']);module[_0x5cf6('0x1a')]=router; \ No newline at end of file +var _0x0a5f=['/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','/describe','describe','get','/:id','show','getMembers','/:id/teams','getTeams'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x0a5f,0x1a1));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf0a5('0x0'));var util=require('util');var path=require(_0xf0a5('0x1'));var timeout=require(_0xf0a5('0x2'));var express=require(_0xf0a5('0x3'));var router=express[_0xf0a5('0x4')]();var fs_extra=require(_0xf0a5('0x5'));var auth=require(_0xf0a5('0x6'));var interaction=require(_0xf0a5('0x7'));var config=require('../../config/environment');var controller=require(_0xf0a5('0x8'));router['get']('/',auth[_0xf0a5('0x9')](),controller['index']);router['get'](_0xf0a5('0xa'),auth[_0xf0a5('0x9')](),controller[_0xf0a5('0xb')]);router[_0xf0a5('0xc')](_0xf0a5('0xd'),auth[_0xf0a5('0x9')](),controller[_0xf0a5('0xe')]);router[_0xf0a5('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0xf0a5('0xf')]);router[_0xf0a5('0xc')](_0xf0a5('0x10'),auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x11')]);router[_0xf0a5('0xc')](_0xf0a5('0x12'),auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x13')]);router[_0xf0a5('0x14')]('/',auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x15')]);router['post']('/:id/teams',auth[_0xf0a5('0x9')](),controller['addTeams']);router['post'](_0xf0a5('0x12'),auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x16')]);router[_0xf0a5('0x17')]('/:id',auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x18')]);router[_0xf0a5('0x19')](_0xf0a5('0xd'),auth['isAuthenticated'](),controller[_0xf0a5('0x1a')]);router['delete']('/:id/teams',auth[_0xf0a5('0x9')](),controller[_0xf0a5('0x1b')]);router[_0xf0a5('0x19')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf0a5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 26b699b..9801a6d 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 _0x0b25=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x417aac,_0x1be30e){var _0x5ae174=function(_0x398288){while(--_0x398288){_0x417aac['push'](_0x417aac['shift']());}};_0x5ae174(++_0x1be30e);}(_0x0b25,0x155));var _0x50b2=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x0b25[_0x33a694];return _0x41ff01;};'use strict';var Sequelize=require(_0x50b2('0x0'));module[_0x50b2('0x1')]={'name':{'type':Sequelize[_0x50b2('0x2')],'unique':_0x50b2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x50b2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x50b2('0x5')](_0x50b2('0x6'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x50b2('0x2')]}}; \ No newline at end of file +var _0xc368=['ENUM','rrmemory','beepall','STRING','exports','name','INTEGER'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xc368,0x7b));var _0x8c36=function(_0x1bfef4,_0x59c553){_0x1bfef4=_0x1bfef4-0x0;var _0x722a1d=_0xc368[_0x1bfef4];return _0x722a1d;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8c36('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8c36('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c36('0x3')](_0x8c36('0x4'),_0x8c36('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x8c36('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f54bd54..dfc9718 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 _0x31be=['compact','removeAgents','emit','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','agent','%s/%s','createdAt','updatedAt','getTeams','hasOwnProperty','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','UserWhatsappQueue','findOrCreate','forEach','removeTeams','Team','select','field','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union'];(function(_0x5884b2,_0x4b6b19){var _0x454732=function(_0x5dde3e){while(--_0x5dde3e){_0x5884b2['push'](_0x5884b2['shift']());}};_0x454732(++_0x4b6b19);}(_0x31be,0x1ea));var _0xe31b=function(_0x341376,_0x2c39a7){_0x341376=_0x341376-0x0;var _0x398fee=_0x31be[_0x341376];return _0x398fee;};'use strict';var BPromise=require(_0xe31b('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xe31b('0x1'));var Redis=require('ioredis');var qs=require(_0xe31b('0x2'));var logger=require(_0xe31b('0x3'))(_0xe31b('0x4'));var config=require(_0xe31b('0x5'));var db=require(_0xe31b('0x6'))['db'];config[_0xe31b('0x7')]=_[_0xe31b('0x8')](config[_0xe31b('0x7')],{'host':_0xe31b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe31b('0xa'))['register'](socket);function respondWithStatusCode(_0x462a74,_0x3fca60){_0x3fca60=_0x3fca60||0xcc;return function(_0x13e395){if(_0x13e395){return _0x462a74[_0xe31b('0xb')](_0x3fca60);}return _0x462a74[_0xe31b('0xc')](_0x3fca60)[_0xe31b('0xd')]();};}function respondWithResult(_0x374efd,_0x495a6c){_0x495a6c=_0x495a6c||0xc8;return function(_0x457285){if(_0x457285){return _0x374efd['status'](_0x495a6c)[_0xe31b('0xe')](_0x457285);}};}function respondWithFilteredResult(_0x52860d,_0x459b70){return function(_0x5037c1){if(_0x5037c1){var _0x1ac319=typeof _0x459b70[_0xe31b('0xf')]===_0xe31b('0x10')&&typeof _0x459b70[_0xe31b('0x11')]===_0xe31b('0x10');var _0x17ba58=_0x5037c1[_0xe31b('0x12')];var _0x4bc133=_0x1ac319?0x0:_0x459b70[_0xe31b('0xf')];var _0x4c6ebb=_0x1ac319?_0x5037c1[_0xe31b('0x12')]:_0x459b70['offset']+_0x459b70[_0xe31b('0x11')];var _0x43830d;if(_0x4c6ebb>=_0x17ba58){_0x4c6ebb=_0x17ba58;_0x43830d=0xc8;}else{_0x43830d=0xce;}_0x52860d[_0xe31b('0xc')](_0x43830d);return _0x52860d[_0xe31b('0x13')](_0xe31b('0x14'),_0x4bc133+'-'+_0x4c6ebb+'/'+_0x17ba58)[_0xe31b('0xe')](_0x5037c1);}return null;};}function saveUpdates(_0x36ee28){return function(_0x3b227f){if(_0x3b227f){return _0x3b227f[_0xe31b('0x15')](_0x36ee28)['then'](function(_0x5bee4f){return _0x5bee4f;});}return null;};}function removeEntity(_0x5b3a0b){return function(_0x4bb199){if(_0x4bb199){return _0x4bb199[_0xe31b('0x16')]()[_0xe31b('0x17')](function(){var _0x2ed194=_0x4bb199[_0xe31b('0x18')]({'plain':!![]});var _0x27f68c=_0xe31b('0x19');return db[_0xe31b('0x1a')]['destroy']({'where':{'type':_0x27f68c,'resourceId':_0x2ed194['id']}})[_0xe31b('0x17')](function(){return _0x4bb199;});})[_0xe31b('0x17')](function(){_0x5b3a0b[_0xe31b('0xc')](0xcc)[_0xe31b('0xd')]();});}};}function handleEntityNotFound(_0x123ff6){return function(_0x2b06d9){if(!_0x2b06d9){_0x123ff6[_0xe31b('0xb')](0x194);}return _0x2b06d9;};}function handleError(_0x3be973,_0x507d75){_0x507d75=_0x507d75||0x1f4;return function(_0x3eec41){logger[_0xe31b('0x1b')](_0x3eec41[_0xe31b('0x1c')]);if(_0x3eec41[_0xe31b('0x1d')]){delete _0x3eec41[_0xe31b('0x1d')];}_0x3be973[_0xe31b('0xc')](_0x507d75)[_0xe31b('0x1e')](_0x3eec41);};}exports[_0xe31b('0x1f')]=function(_0x12ff80,_0x369c80){var _0x195bea={};var _0x5e47f2={'count':0x0,'rows':[]};var _0x4a156a=_[_0xe31b('0x20')](db[_0xe31b('0x21')]['rawAttributes'],function(_0xc0b585){return{'name':_0xc0b585[_0xe31b('0x22')],'type':_0xc0b585[_0xe31b('0x23')][_0xe31b('0x24')]};});_0x195bea=qs['getOptions'](_0x4a156a,_0x12ff80);var _0x4cd5cf={'where':_0x195bea[_0xe31b('0x25')]};return db[_0xe31b('0x21')][_0xe31b('0x12')](_0x4cd5cf)[_0xe31b('0x17')](function(_0x5a0d5e){_0x5e47f2[_0xe31b('0x12')]=_0x5a0d5e;_0x195bea[_0xe31b('0x26')]=qs[_0xe31b('0x26')](_0x12ff80[_0xe31b('0x27')]);return db[_0xe31b('0x21')][_0xe31b('0x28')](_0x195bea);})[_0xe31b('0x17')](function(_0x276fac){_0x5e47f2[_0xe31b('0x29')]=_0x276fac;return _0x5e47f2;})[_0xe31b('0x17')](respondWithFilteredResult(_0x369c80,_0x195bea))[_0xe31b('0x2a')](handleError(_0x369c80,null));};exports[_0xe31b('0x2b')]=function(_0x50fd6a,_0x20af9a){var _0x1d88a2={'raw':!![],'where':{'id':_0x50fd6a[_0xe31b('0x2c')]['id']}},_0x1ad0f6={};_0x1ad0f6[_0xe31b('0x2d')]=_['keys'](db['WhatsappQueue'][_0xe31b('0x2e')]);_0x1ad0f6[_0xe31b('0x27')]=_[_0xe31b('0x2f')](_0x50fd6a[_0xe31b('0x27')]);_0x1ad0f6[_0xe31b('0x30')]=_[_0xe31b('0x31')](_0x1ad0f6[_0xe31b('0x2d')],_0x1ad0f6[_0xe31b('0x27')]);_0x1d88a2['attributes']=_[_0xe31b('0x31')](_0x1ad0f6[_0xe31b('0x2d')],qs[_0xe31b('0x32')](_0x50fd6a[_0xe31b('0x27')][_0xe31b('0x32')]));_0x1d88a2[_0xe31b('0x33')]=_0x1d88a2[_0xe31b('0x33')][_0xe31b('0x34')]?_0x1d88a2[_0xe31b('0x33')]:_0x1ad0f6['model'];if(_0x50fd6a['query'][_0xe31b('0x35')]){_0x1d88a2[_0xe31b('0x26')]=[{'all':!![]}];}_0x1d88a2=_[_0xe31b('0x36')]({},_0x1d88a2,_0x50fd6a[_0xe31b('0x37')]);return db[_0xe31b('0x21')]['find'](_0x1d88a2)[_0xe31b('0x17')](handleEntityNotFound(_0x20af9a,null))[_0xe31b('0x17')](respondWithResult(_0x20af9a,null))[_0xe31b('0x2a')](handleError(_0x20af9a,null));};exports[_0xe31b('0x38')]=function(_0xc5e5d7,_0x50937c){return db[_0xe31b('0x21')][_0xe31b('0x38')](_0xc5e5d7[_0xe31b('0x39')],{})[_0xe31b('0x17')](function(_0x3e9468){var _0x3330fe=_0xc5e5d7[_0xe31b('0x3a')][_0xe31b('0x18')]({'plain':!![]});if(!_0x3330fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3330fe[_0xe31b('0x3b')]===_0xe31b('0x3a')){var _0x534bd2=_0x3e9468[_0xe31b('0x18')]({'plain':!![]});var _0x28da15=_0xe31b('0x19');return db[_0xe31b('0x3c')][_0xe31b('0x3d')]({'where':{'name':_0x28da15,'userProfileId':_0x3330fe[_0xe31b('0x3e')]},'raw':!![]})[_0xe31b('0x17')](function(_0x31cd57){if(_0x31cd57&&_0x31cd57[_0xe31b('0x3f')]===0x0){return db[_0xe31b('0x1a')]['create']({'name':_0x534bd2['name'],'resourceId':_0x534bd2['id'],'type':_0x31cd57[_0xe31b('0x1d')],'sectionId':_0x31cd57['id']},{})['then'](function(){return _0x3e9468;});}else{return _0x3e9468;}})[_0xe31b('0x2a')](function(_0x193c35){logger[_0xe31b('0x1b')](_0xe31b('0x40'),_0x193c35);throw _0x193c35;});}return _0x3e9468;})[_0xe31b('0x17')](respondWithResult(_0x50937c,0xc9))[_0xe31b('0x2a')](handleError(_0x50937c,null));};exports['update']=function(_0xe05795,_0x4639fd){if(_0xe05795[_0xe31b('0x39')]['id']){delete _0xe05795[_0xe31b('0x39')]['id'];}return db[_0xe31b('0x21')][_0xe31b('0x3d')]({'where':{'id':_0xe05795['params']['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x4639fd,null))[_0xe31b('0x17')](saveUpdates(_0xe05795['body'],null))['then'](respondWithResult(_0x4639fd,null))[_0xe31b('0x2a')](handleError(_0x4639fd,null));};exports[_0xe31b('0x16')]=function(_0x59e2c3,_0x47303f){return db[_0xe31b('0x21')][_0xe31b('0x3d')]({'where':{'id':_0x59e2c3['params']['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x47303f,null))[_0xe31b('0x17')](removeEntity(_0x47303f,null))[_0xe31b('0x2a')](handleError(_0x47303f,null));};exports[_0xe31b('0x41')]=function(_0x5128f7,_0x5a6e6b){return db[_0xe31b('0x21')][_0xe31b('0x41')]()[_0xe31b('0x17')](respondWithResult(_0x5a6e6b,null))['catch'](handleError(_0x5a6e6b,null));};exports[_0xe31b('0x42')]=function(_0x35f4be,_0x14cfa4){var _0x47fb0a={'raw':!![],'where':{}},_0x282c39={},_0x3acca9;return db['WhatsappQueue'][_0xe31b('0x43')]({'where':{'id':_0x35f4be[_0xe31b('0x2c')]['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x14cfa4,null))[_0xe31b('0x17')](function(_0x9cfe7){if(_0x9cfe7){_0x3acca9=_0x9cfe7[_0xe31b('0x18')]({'plain':!![]});_0x282c39['model']=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x282c39[_0xe31b('0x27')]=_[_0xe31b('0x2f')](_0x35f4be[_0xe31b('0x27')]);_0x282c39[_0xe31b('0x30')]=_[_0xe31b('0x31')](_0x282c39[_0xe31b('0x2d')],_0x282c39['query']);_0x47fb0a[_0xe31b('0x33')]=_[_0xe31b('0x31')](_0x282c39[_0xe31b('0x2d')],qs[_0xe31b('0x32')](_0x35f4be[_0xe31b('0x27')][_0xe31b('0x32')]));_0x47fb0a['attributes']=_0x47fb0a[_0xe31b('0x33')]['length']?_0x47fb0a['attributes']:_0x282c39['model'];if(!_0x35f4be[_0xe31b('0x27')]['hasOwnProperty']('nolimit')){_0x47fb0a[_0xe31b('0x11')]=qs[_0xe31b('0x11')](_0x35f4be['query'][_0xe31b('0x11')]);_0x47fb0a[_0xe31b('0xf')]=qs[_0xe31b('0xf')](_0x35f4be[_0xe31b('0x27')][_0xe31b('0xf')]);}_0x47fb0a[_0xe31b('0x44')]=qs[_0xe31b('0x45')](_0x35f4be[_0xe31b('0x27')][_0xe31b('0x45')]);_0x47fb0a[_0xe31b('0x25')]=qs['filters'](_[_0xe31b('0x46')](_0x35f4be[_0xe31b('0x27')],_0x282c39[_0xe31b('0x30')]));_0x47fb0a[_0xe31b('0x25')][_0xe31b('0x47')]=_0x9cfe7['id'];if(_0x35f4be[_0xe31b('0x27')][_0xe31b('0x48')]){_0x47fb0a['where']=_[_0xe31b('0x36')](_0x47fb0a['where'],{'$or':_[_0xe31b('0x20')](_0x47fb0a['attributes'],function(_0xe13d54){var _0x11d488={};_0x11d488[_0xe13d54]={'$like':'%'+_0x35f4be['query'][_0xe31b('0x48')]+'%'};return _0x11d488;})});}_0x47fb0a=_[_0xe31b('0x36')]({},_0x47fb0a,_0x35f4be[_0xe31b('0x37')]);return db['UserWhatsappQueue'][_0xe31b('0x28')](_0x47fb0a);}})[_0xe31b('0x17')](function(_0x4ad0b5){if(_0x4ad0b5){return db[_0xe31b('0x49')][_0xe31b('0x4a')]({'where':{'id':_[_0xe31b('0x20')](_0x4ad0b5,'UserId'),'role':_0xe31b('0x4b')},'attributes':['id',_0xe31b('0x1d'),'whatsappPause','updatedAt','createdAt']});}})[_0xe31b('0x17')](function(_0x15180a){if(_0x15180a){return{'count':_0x15180a[_0xe31b('0x12')],'rows':_[_0xe31b('0x20')](_0x15180a[_0xe31b('0x29')],function(_0x565332){return{'membername':_0x565332[_0xe31b('0x1d')],'UserId':_0x565332['id'],'queue_name':_0x3acca9[_0xe31b('0x1d')],'WhatsappQueueId':_0x3acca9['id'],'interface':util['format'](_0xe31b('0x4c'),'SIP',_0x565332[_0xe31b('0x1d')]),'penalty':0x0,'paused':_0x565332['whatsappPause'],'createdAt':_0x565332[_0xe31b('0x4d')],'updatedAt':_0x565332[_0xe31b('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14cfa4,_0x47fb0a))[_0xe31b('0x2a')](handleError(_0x14cfa4,null));};exports[_0xe31b('0x4f')]=function(_0x1105e6,_0x1ebe21){var _0x46c773={};var _0x4be21c={};var _0x28387d;var _0x3923b7;return db[_0xe31b('0x21')][_0xe31b('0x43')]({'where':{'id':_0x1105e6[_0xe31b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1ebe21,null))[_0xe31b('0x17')](function(_0xfaffac){if(_0xfaffac){_0x28387d=_0xfaffac;_0x4be21c[_0xe31b('0x2d')]=_[_0xe31b('0x2f')](db['Team'][_0xe31b('0x2e')]);_0x4be21c[_0xe31b('0x27')]=_[_0xe31b('0x2f')](_0x1105e6[_0xe31b('0x27')]);_0x4be21c[_0xe31b('0x30')]=_['intersection'](_0x4be21c[_0xe31b('0x2d')],_0x4be21c[_0xe31b('0x27')]);_0x46c773['attributes']=_[_0xe31b('0x31')](_0x4be21c['model'],qs['fields'](_0x1105e6[_0xe31b('0x27')]['fields']));_0x46c773[_0xe31b('0x33')]=_0x46c773[_0xe31b('0x33')][_0xe31b('0x34')]?_0x46c773[_0xe31b('0x33')]:_0x4be21c[_0xe31b('0x2d')];_0x46c773[_0xe31b('0x44')]=qs[_0xe31b('0x45')](_0x1105e6[_0xe31b('0x27')][_0xe31b('0x45')]);_0x46c773['where']=qs[_0xe31b('0x30')](_[_0xe31b('0x46')](_0x1105e6[_0xe31b('0x27')],_0x4be21c[_0xe31b('0x30')]));if(_0x1105e6[_0xe31b('0x27')][_0xe31b('0x48')]){_0x46c773['where']=_[_0xe31b('0x36')](_0x46c773['where'],{'$or':_[_0xe31b('0x20')](_0x46c773[_0xe31b('0x33')],function(_0x6829aa){var _0xf30210={};_0xf30210[_0x6829aa]={'$like':'%'+_0x1105e6[_0xe31b('0x27')][_0xe31b('0x48')]+'%'};return _0xf30210;})});}_0x46c773=_[_0xe31b('0x36')]({},_0x46c773,_0x1105e6['options']);return _0x28387d[_0xe31b('0x4f')](_0x46c773);}})[_0xe31b('0x17')](function(_0x4f760b){if(_0x4f760b){_0x3923b7=_0x4f760b['length'];if(!_0x1105e6[_0xe31b('0x27')][_0xe31b('0x50')](_0xe31b('0x51'))){_0x46c773['limit']=qs[_0xe31b('0x11')](_0x1105e6['query']['limit']);_0x46c773[_0xe31b('0xf')]=qs[_0xe31b('0xf')](_0x1105e6[_0xe31b('0x27')][_0xe31b('0xf')]);}return _0x28387d[_0xe31b('0x4f')](_0x46c773);}})['then'](function(_0x100c5b){if(_0x100c5b){return _0x100c5b?{'count':_0x3923b7,'rows':_0x100c5b}:null;}})[_0xe31b('0x17')](respondWithResult(_0x1ebe21,null))[_0xe31b('0x2a')](handleError(_0x1ebe21,null));};exports[_0xe31b('0x52')]=function(_0x3e3ebb,_0xf6fe0e){var _0x4ad1db=_0x3e3ebb[_0xe31b('0x39')][_0xe31b('0x53')];return db['Team'][_0xe31b('0x28')]({'where':{'id':_0x4ad1db},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe31b('0x54'),'attributes':['id',_0xe31b('0x1d'),'online',_0xe31b('0x55'),_0xe31b('0x56')],'raw':!![]}]})[_0xe31b('0x17')](function(_0x53cd0d){if(_0x53cd0d){var _0x42bd8c=_[_0xe31b('0x57')](_0x53cd0d,function(_0x3607a9){var _0x4f8a52=_0x3607a9[_0xe31b('0x18')]({'plain':!![]});return _0x4f8a52[_0xe31b('0x54')];});return db['WhatsappQueue']['find']({'where':{'id':_0x3e3ebb[_0xe31b('0x2c')]['id']}})['then'](function(_0xdb41f2){return db[_0xe31b('0x58')][_0xe31b('0x59')](function(_0x28329f){return _0xdb41f2[_0xe31b('0x52')](_0x4ad1db,{'transaction':_0x28329f})[_0xe31b('0x17')](function(){return BPromise['each'](_0x42bd8c,function(_0x9f4a2f){return db[_0xe31b('0x5a')][_0xe31b('0x5b')]({'where':{'UserId':_0x9f4a2f['id'],'WhatsappQueueId':_0x3e3ebb[_0xe31b('0x2c')]['id']},'transaction':_0x28329f});});})[_0xe31b('0x17')](function(){_0x42bd8c[_0xe31b('0x5c')](function(_0x2b30d7){socket['emit']('userWhatsappQueue:save',{'UserId':_0x2b30d7['id'],'WhatsappQueueId':_0xdb41f2['id']});});});});});}})[_0xe31b('0x17')](respondWithStatusCode(_0xf6fe0e,null))[_0xe31b('0x2a')](handleError(_0xf6fe0e,null));};exports[_0xe31b('0x5d')]=function(_0x127f18,_0x2eb726){return db[_0xe31b('0x5e')][_0xe31b('0x28')]({'where':{'id':_0x127f18[_0xe31b('0x27')][_0xe31b('0x53')]},'attributes':['id'],'include':[{'model':db[_0xe31b('0x49')],'as':_0xe31b('0x54'),'attributes':['id'],'raw':!![]}]})[_0xe31b('0x17')](handleEntityNotFound(_0x2eb726,null))['then'](function(_0x4167d3){var _0x1d095d=_[_0xe31b('0x20')](_0x4167d3,'id');var _0x530ed3=[];var _0x135fb8=[];var _0x622028=squel[_0xe31b('0x5f')]();_0x622028[_0xe31b('0x60')]('tq.TeamId')[_0xe31b('0x61')](_0xe31b('0x62'),'tq')[_0xe31b('0x63')](_0xe31b('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x127f18[_0xe31b('0x2c')]['id']);for(var _0x22eeb0=0x0;_0x22eeb0<_0x4167d3[_0xe31b('0x34')];_0x22eeb0+=0x1){let _0x26f894=_0x4167d3[_0x22eeb0];for(var _0x5d64a1=0x0;_0x5d64a1<_0x26f894[_0xe31b('0x54')][_0xe31b('0x34')];_0x5d64a1+=0x1){let _0x7eabc8=_0x26f894[_0xe31b('0x54')][_0x5d64a1];var _0x20f9a4=_0x622028[_0xe31b('0x65')]();_0x20f9a4['where'](_0xe31b('0x66'),_0x7eabc8['id']);_0x135fb8[_0xe31b('0x67')](db[_0xe31b('0x58')]['query'](_0x20f9a4[_0xe31b('0x68')](),{'type':db[_0xe31b('0x58')][_0xe31b('0x69')][_0xe31b('0x6a')]})[_0xe31b('0x17')](function(_0x3395ae){if(_0x3395ae[_0xe31b('0x34')]===0x1){return _0x7eabc8['id'];}else{var _0x23ee45=_[_0xe31b('0x6b')](_[_0xe31b('0x20')](_0x3395ae,'TeamId'),function(_0x4ae6d5){return _[_0xe31b('0x6c')](_0x1d095d,_0x4ae6d5);});if(_0x23ee45){return _0x7eabc8['id'];}}}));}}return BPromise['all'](_0x135fb8)['then'](function(_0x53b049){_0x530ed3=_(_0x530ed3)[_0xe31b('0x6d')](_0x53b049)[_0xe31b('0x6e')]()['value']();return db[_0xe31b('0x21')]['find']({'where':{'id':_0x127f18[_0xe31b('0x2c')]['id']}})['then'](function(_0x44c2ae){return db[_0xe31b('0x58')][_0xe31b('0x59')](function(_0x356655){return _0x44c2ae[_0xe31b('0x5d')](_0x127f18['query']['ids'],{'transaction':_0x356655})[_0xe31b('0x17')](function(){if(!_['isEmpty'](_0x530ed3)){return _0x44c2ae[_0xe31b('0x6f')](_0x530ed3,{'transaction':_0x356655});}})['then'](function(){_0x530ed3[_0xe31b('0x5c')](function(_0x434cb6){socket[_0xe31b('0x70')]('userWhatsappQueue:remove',{'UserId':_0x434cb6,'WhatsappQueueId':_0x44c2ae['id']});});});});});});})['then'](respondWithStatusCode(_0x2eb726,null))['catch'](handleError(_0x2eb726,null));};exports[_0xe31b('0x71')]=function(_0x1d3ba4,_0x3568bf){return db[_0xe31b('0x21')][_0xe31b('0x3d')]({'where':{'id':_0x1d3ba4[_0xe31b('0x2c')]['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x3568bf,null))[_0xe31b('0x17')](function(_0x271712){if(_0x271712){return _0x271712[_0xe31b('0x71')](_0x1d3ba4[_0xe31b('0x39')][_0xe31b('0x53')],_[_0xe31b('0x72')](_0x1d3ba4[_0xe31b('0x39')],['ids','id'])||{})[_0xe31b('0x73')](function(_0x4f2001){for(var _0x2075ab=0x0;_0x2075ab<_0x1d3ba4[_0xe31b('0x39')][_0xe31b('0x53')][_0xe31b('0x34')];_0x2075ab+=0x1){socket[_0xe31b('0x70')](_0xe31b('0x74'),{'UserId':Number(_0x1d3ba4[_0xe31b('0x39')]['ids'][_0x2075ab]),'WhatsappQueueId':Number(_0x1d3ba4[_0xe31b('0x2c')]['id'])});}return _0x4f2001;});}})[_0xe31b('0x17')](respondWithResult(_0x3568bf,null))[_0xe31b('0x2a')](handleError(_0x3568bf,null));};exports[_0xe31b('0x6f')]=function(_0x5877b0,_0x5105aa){return db[_0xe31b('0x21')][_0xe31b('0x3d')]({'where':{'id':_0x5877b0[_0xe31b('0x2c')]['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x5105aa,null))['then'](function(_0x444d50){if(_0x444d50){return _0x444d50[_0xe31b('0x6f')](_0x5877b0['query']['ids'])[_0xe31b('0x17')](function(){if(_[_0xe31b('0x75')](_0x5877b0[_0xe31b('0x27')][_0xe31b('0x53')])){for(var _0x2a92f8=0x0;_0x2a92f8<_0x5877b0['query'][_0xe31b('0x53')][_0xe31b('0x34')];_0x2a92f8+=0x1){socket[_0xe31b('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x5877b0['query']['ids'][_0x2a92f8]),'WhatsappQueueId':Number(_0x5877b0['params']['id'])});}}else{socket['emit'](_0xe31b('0x76'),{'UserId':Number(_0x5877b0[_0xe31b('0x27')]['ids']),'WhatsappQueueId':Number(_0x5877b0[_0xe31b('0x2c')]['id'])});}});}})[_0xe31b('0x17')](respondWithStatusCode(_0x5105aa,null))['catch'](handleError(_0x5105aa,null));};exports[_0xe31b('0x77')]=function(_0x1da088,_0x52e109){var _0x4576c9={};var _0x1ce85c={};var _0x3116bc;var _0x595958;return db[_0xe31b('0x21')][_0xe31b('0x43')]({'where':{'id':_0x1da088['params']['id']}})[_0xe31b('0x17')](handleEntityNotFound(_0x52e109,null))[_0xe31b('0x17')](function(_0x558155){if(_0x558155){_0x3116bc=_0x558155;_0x1ce85c[_0xe31b('0x2d')]=_[_0xe31b('0x2f')](db[_0xe31b('0x49')][_0xe31b('0x2e')]);_0x1ce85c[_0xe31b('0x27')]=_[_0xe31b('0x2f')](_0x1da088[_0xe31b('0x27')]);_0x1ce85c[_0xe31b('0x30')]=_[_0xe31b('0x31')](_0x1ce85c[_0xe31b('0x2d')],_0x1ce85c[_0xe31b('0x27')]);_0x4576c9['attributes']=_['intersection'](_0x1ce85c[_0xe31b('0x2d')],qs[_0xe31b('0x32')](_0x1da088[_0xe31b('0x27')][_0xe31b('0x32')]));_0x4576c9[_0xe31b('0x33')]=_0x4576c9[_0xe31b('0x33')][_0xe31b('0x34')]?_0x4576c9[_0xe31b('0x33')]:_0x1ce85c['model'];_0x4576c9['order']=qs[_0xe31b('0x45')](_0x1da088[_0xe31b('0x27')][_0xe31b('0x45')]);_0x4576c9['where']=qs[_0xe31b('0x30')](_[_0xe31b('0x46')](_0x1da088[_0xe31b('0x27')],_0x1ce85c[_0xe31b('0x30')]));if(_0x1da088[_0xe31b('0x27')][_0xe31b('0x48')]){_0x4576c9[_0xe31b('0x25')]=_[_0xe31b('0x36')](_0x4576c9[_0xe31b('0x25')],{'$or':_['map'](_0x4576c9['attributes'],function(_0x572e63){var _0x2e481b={};_0x2e481b[_0x572e63]={'$like':'%'+_0x1da088[_0xe31b('0x27')][_0xe31b('0x48')]+'%'};return _0x2e481b;})});}_0x4576c9=_['merge']({},_0x4576c9,_0x1da088['options']);return _0x3116bc[_0xe31b('0x77')](_0x4576c9);}})[_0xe31b('0x17')](function(_0x862c5f){if(_0x862c5f){_0x595958=_0x862c5f[_0xe31b('0x34')];if(!_0x1da088[_0xe31b('0x27')]['hasOwnProperty']('nolimit')){_0x4576c9[_0xe31b('0x11')]=qs[_0xe31b('0x11')](_0x1da088[_0xe31b('0x27')][_0xe31b('0x11')]);_0x4576c9[_0xe31b('0xf')]=qs['offset'](_0x1da088[_0xe31b('0x27')][_0xe31b('0xf')]);}return _0x3116bc[_0xe31b('0x77')](_0x4576c9);}})[_0xe31b('0x17')](function(_0x2c0bdf){if(_0x2c0bdf){return _0x2c0bdf?{'count':_0x595958,'rows':_0x2c0bdf}:null;}})['then'](respondWithResult(_0x52e109,null))[_0xe31b('0x2a')](handleError(_0x52e109,null));}; \ No newline at end of file +var _0xff7e=['UserProfileResource','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','model','keys','WhatsappQueue','filters','intersection','fields','attributes','length','merge','options','find','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','Team','Agents','online','interface','flatMap','sequelize','addTeams','each','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','WhatsappQueues'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xff7e,0x68));var _0xeff7=function(_0x4fcc0c,_0x308364){_0x4fcc0c=_0x4fcc0c-0x0;var _0x553280=_0xff7e[_0x4fcc0c];return _0x553280;};'use strict';var BPromise=require(_0xeff7('0x0'));var util=require('util');var _=require(_0xeff7('0x1'));var squel=require(_0xeff7('0x2'));var Redis=require(_0xeff7('0x3'));var qs=require(_0xeff7('0x4'));var logger=require(_0xeff7('0x5'))(_0xeff7('0x6'));var config=require(_0xeff7('0x7'));var db=require(_0xeff7('0x8'))['db'];config['redis']=_[_0xeff7('0x9')](config[_0xeff7('0xa')],{'host':_0xeff7('0xb'),'port':0x18eb});var socket=require(_0xeff7('0xc'))(new Redis(config['redis']));require(_0xeff7('0xd'))['register'](socket);function respondWithStatusCode(_0x270fdd,_0xd3ac85){_0xd3ac85=_0xd3ac85||0xcc;return function(_0x2f81cc){if(_0x2f81cc){return _0x270fdd[_0xeff7('0xe')](_0xd3ac85);}return _0x270fdd[_0xeff7('0xf')](_0xd3ac85)[_0xeff7('0x10')]();};}function respondWithResult(_0x57ad93,_0x5889c3){_0x5889c3=_0x5889c3||0xc8;return function(_0x29d147){if(_0x29d147){return _0x57ad93[_0xeff7('0xf')](_0x5889c3)['json'](_0x29d147);}};}function respondWithFilteredResult(_0x23541c,_0x34404d){return function(_0x4abccf){if(_0x4abccf){var _0x39a531=typeof _0x34404d[_0xeff7('0x11')]===_0xeff7('0x12')&&typeof _0x34404d[_0xeff7('0x13')]===_0xeff7('0x12');var _0x317042=_0x4abccf[_0xeff7('0x14')];var _0x43eb66=_0x39a531?0x0:_0x34404d[_0xeff7('0x11')];var _0x8aac3=_0x39a531?_0x4abccf[_0xeff7('0x14')]:_0x34404d['offset']+_0x34404d[_0xeff7('0x13')];var _0x4370b0;if(_0x8aac3>=_0x317042){_0x8aac3=_0x317042;_0x4370b0=0xc8;}else{_0x4370b0=0xce;}_0x23541c['status'](_0x4370b0);return _0x23541c[_0xeff7('0x15')](_0xeff7('0x16'),_0x43eb66+'-'+_0x8aac3+'/'+_0x317042)['json'](_0x4abccf);}return null;};}function saveUpdates(_0x391df1){return function(_0x261051){if(_0x261051){return _0x261051[_0xeff7('0x17')](_0x391df1)['then'](function(_0x310a53){return _0x310a53;});}return null;};}function removeEntity(_0x3af01d){return function(_0x3d5ccd){if(_0x3d5ccd){return _0x3d5ccd[_0xeff7('0x18')]()['then'](function(){var _0x23a50b=_0x3d5ccd['get']({'plain':!![]});var _0x3d6b03=_0xeff7('0x19');return db[_0xeff7('0x1a')][_0xeff7('0x18')]({'where':{'type':_0x3d6b03,'resourceId':_0x23a50b['id']}})['then'](function(){return _0x3d5ccd;});})[_0xeff7('0x1b')](function(){_0x3af01d[_0xeff7('0xf')](0xcc)[_0xeff7('0x10')]();});}};}function handleEntityNotFound(_0x59249e){return function(_0x45defe){if(!_0x45defe){_0x59249e['sendStatus'](0x194);}return _0x45defe;};}function handleError(_0x34111f,_0x2913fa){_0x2913fa=_0x2913fa||0x1f4;return function(_0x1eb6b2){logger[_0xeff7('0x1c')](_0x1eb6b2[_0xeff7('0x1d')]);if(_0x1eb6b2['name']){delete _0x1eb6b2[_0xeff7('0x1e')];}_0x34111f[_0xeff7('0xf')](_0x2913fa)['send'](_0x1eb6b2);};}exports[_0xeff7('0x1f')]=function(_0x152881,_0x5148f9){var _0x20819f={};var _0x433081={'count':0x0,'rows':[]};var _0x35b3b1=_[_0xeff7('0x20')](db['WhatsappQueue'][_0xeff7('0x21')],function(_0x1961e0){return{'name':_0x1961e0[_0xeff7('0x22')],'type':_0x1961e0[_0xeff7('0x23')][_0xeff7('0x24')]};});_0x20819f=qs[_0xeff7('0x25')](_0x35b3b1,_0x152881);var _0x12d3ef={'where':_0x20819f[_0xeff7('0x26')]};return db['WhatsappQueue']['count'](_0x12d3ef)[_0xeff7('0x1b')](function(_0x136273){_0x433081[_0xeff7('0x14')]=_0x136273;_0x20819f[_0xeff7('0x27')]=qs[_0xeff7('0x27')](_0x152881[_0xeff7('0x28')]);return db['WhatsappQueue'][_0xeff7('0x29')](_0x20819f);})[_0xeff7('0x1b')](function(_0x3f2845){_0x433081[_0xeff7('0x2a')]=_0x3f2845;return _0x433081;})[_0xeff7('0x1b')](respondWithFilteredResult(_0x5148f9,_0x20819f))[_0xeff7('0x2b')](handleError(_0x5148f9,null));};exports[_0xeff7('0x2c')]=function(_0x48c056,_0x4f1f35){var _0x4509f3={'raw':!![],'where':{'id':_0x48c056['params']['id']}},_0x487df1={};_0x487df1[_0xeff7('0x2d')]=_[_0xeff7('0x2e')](db[_0xeff7('0x2f')][_0xeff7('0x21')]);_0x487df1['query']=_[_0xeff7('0x2e')](_0x48c056[_0xeff7('0x28')]);_0x487df1[_0xeff7('0x30')]=_[_0xeff7('0x31')](_0x487df1['model'],_0x487df1['query']);_0x4509f3['attributes']=_[_0xeff7('0x31')](_0x487df1['model'],qs['fields'](_0x48c056[_0xeff7('0x28')][_0xeff7('0x32')]));_0x4509f3[_0xeff7('0x33')]=_0x4509f3[_0xeff7('0x33')][_0xeff7('0x34')]?_0x4509f3[_0xeff7('0x33')]:_0x487df1[_0xeff7('0x2d')];if(_0x48c056['query']['includeAll']){_0x4509f3[_0xeff7('0x27')]=[{'all':!![]}];}_0x4509f3=_[_0xeff7('0x35')]({},_0x4509f3,_0x48c056[_0xeff7('0x36')]);return db[_0xeff7('0x2f')][_0xeff7('0x37')](_0x4509f3)['then'](handleEntityNotFound(_0x4f1f35,null))[_0xeff7('0x1b')](respondWithResult(_0x4f1f35,null))['catch'](handleError(_0x4f1f35,null));};exports['create']=function(_0x3a8a7a,_0x309179){return db[_0xeff7('0x2f')]['create'](_0x3a8a7a[_0xeff7('0x38')],{})[_0xeff7('0x1b')](function(_0x182988){var _0xa200a4=_0x3a8a7a['user'][_0xeff7('0x39')]({'plain':!![]});if(!_0xa200a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa200a4[_0xeff7('0x3a')]===_0xeff7('0x3b')){var _0x2c5649=_0x182988[_0xeff7('0x39')]({'plain':!![]});var _0x477e06=_0xeff7('0x19');return db[_0xeff7('0x3c')][_0xeff7('0x37')]({'where':{'name':_0x477e06,'userProfileId':_0xa200a4[_0xeff7('0x3d')]},'raw':!![]})[_0xeff7('0x1b')](function(_0x5be5e1){if(_0x5be5e1&&_0x5be5e1[_0xeff7('0x3e')]===0x0){return db[_0xeff7('0x1a')][_0xeff7('0x3f')]({'name':_0x2c5649[_0xeff7('0x1e')],'resourceId':_0x2c5649['id'],'type':_0x5be5e1[_0xeff7('0x1e')],'sectionId':_0x5be5e1['id']},{})[_0xeff7('0x1b')](function(){return _0x182988;});}else{return _0x182988;}})[_0xeff7('0x2b')](function(_0x3db49f){logger[_0xeff7('0x1c')](_0xeff7('0x40'),_0x3db49f);throw _0x3db49f;});}return _0x182988;})[_0xeff7('0x1b')](respondWithResult(_0x309179,0xc9))[_0xeff7('0x2b')](handleError(_0x309179,null));};exports['update']=function(_0xc56cbd,_0x2fa23e){if(_0xc56cbd[_0xeff7('0x38')]['id']){delete _0xc56cbd['body']['id'];}return db['WhatsappQueue'][_0xeff7('0x37')]({'where':{'id':_0xc56cbd[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](handleEntityNotFound(_0x2fa23e,null))[_0xeff7('0x1b')](saveUpdates(_0xc56cbd[_0xeff7('0x38')],null))['then'](respondWithResult(_0x2fa23e,null))['catch'](handleError(_0x2fa23e,null));};exports[_0xeff7('0x18')]=function(_0x55a32f,_0x2ccb5c){return db[_0xeff7('0x2f')][_0xeff7('0x37')]({'where':{'id':_0x55a32f[_0xeff7('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ccb5c,null))['then'](removeEntity(_0x2ccb5c,null))[_0xeff7('0x2b')](handleError(_0x2ccb5c,null));};exports[_0xeff7('0x42')]=function(_0x557c5c,_0x1d3d07){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x1d3d07,null))[_0xeff7('0x2b')](handleError(_0x1d3d07,null));};exports[_0xeff7('0x43')]=function(_0x1a543e,_0x57164a){var _0x1e5f5f={'raw':!![],'where':{}},_0x505b08={},_0x2ec793;return db['WhatsappQueue'][_0xeff7('0x44')]({'where':{'id':_0x1a543e[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](handleEntityNotFound(_0x57164a,null))[_0xeff7('0x1b')](function(_0x381f33){if(_0x381f33){_0x2ec793=_0x381f33[_0xeff7('0x39')]({'plain':!![]});_0x505b08[_0xeff7('0x2d')]=_[_0xeff7('0x2e')](db[_0xeff7('0x45')][_0xeff7('0x21')]);_0x505b08[_0xeff7('0x28')]=_[_0xeff7('0x2e')](_0x1a543e['query']);_0x505b08[_0xeff7('0x30')]=_[_0xeff7('0x31')](_0x505b08[_0xeff7('0x2d')],_0x505b08[_0xeff7('0x28')]);_0x1e5f5f[_0xeff7('0x33')]=_['intersection'](_0x505b08[_0xeff7('0x2d')],qs[_0xeff7('0x32')](_0x1a543e['query'][_0xeff7('0x32')]));_0x1e5f5f[_0xeff7('0x33')]=_0x1e5f5f[_0xeff7('0x33')][_0xeff7('0x34')]?_0x1e5f5f[_0xeff7('0x33')]:_0x505b08[_0xeff7('0x2d')];if(!_0x1a543e['query'][_0xeff7('0x46')](_0xeff7('0x47'))){_0x1e5f5f['limit']=qs['limit'](_0x1a543e['query'][_0xeff7('0x13')]);_0x1e5f5f[_0xeff7('0x11')]=qs[_0xeff7('0x11')](_0x1a543e[_0xeff7('0x28')][_0xeff7('0x11')]);}_0x1e5f5f['order']=qs[_0xeff7('0x48')](_0x1a543e['query']['sort']);_0x1e5f5f[_0xeff7('0x26')]=qs['filters'](_[_0xeff7('0x49')](_0x1a543e[_0xeff7('0x28')],_0x505b08[_0xeff7('0x30')]));_0x1e5f5f[_0xeff7('0x26')][_0xeff7('0x4a')]=_0x381f33['id'];if(_0x1a543e[_0xeff7('0x28')]['filter']){_0x1e5f5f['where']=_[_0xeff7('0x35')](_0x1e5f5f['where'],{'$or':_['map'](_0x1e5f5f[_0xeff7('0x33')],function(_0x116359){var _0x4c287c={};_0x4c287c[_0x116359]={'$like':'%'+_0x1a543e[_0xeff7('0x28')][_0xeff7('0x4b')]+'%'};return _0x4c287c;})});}_0x1e5f5f=_[_0xeff7('0x35')]({},_0x1e5f5f,_0x1a543e[_0xeff7('0x36')]);return db[_0xeff7('0x45')][_0xeff7('0x29')](_0x1e5f5f);}})[_0xeff7('0x1b')](function(_0x2015cd){if(_0x2015cd){return db[_0xeff7('0x4c')][_0xeff7('0x4d')]({'where':{'id':_['map'](_0x2015cd,_0xeff7('0x4e')),'role':_0xeff7('0x4f')},'attributes':['id',_0xeff7('0x1e'),_0xeff7('0x50'),_0xeff7('0x51'),_0xeff7('0x52')]});}})['then'](function(_0x5d7590){if(_0x5d7590){return{'count':_0x5d7590[_0xeff7('0x14')],'rows':_['map'](_0x5d7590[_0xeff7('0x2a')],function(_0x22680e){return{'membername':_0x22680e[_0xeff7('0x1e')],'UserId':_0x22680e['id'],'queue_name':_0x2ec793[_0xeff7('0x1e')],'WhatsappQueueId':_0x2ec793['id'],'interface':util[_0xeff7('0x53')](_0xeff7('0x54'),_0xeff7('0x55'),_0x22680e[_0xeff7('0x1e')]),'penalty':0x0,'paused':_0x22680e[_0xeff7('0x50')],'createdAt':_0x22680e[_0xeff7('0x52')],'updatedAt':_0x22680e[_0xeff7('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x57164a,_0x1e5f5f))[_0xeff7('0x2b')](handleError(_0x57164a,null));};exports[_0xeff7('0x56')]=function(_0x103224,_0x2a6c1f){var _0x4f7238={};var _0x16ab9c={};var _0xc638ba;var _0x2b4670;return db['WhatsappQueue'][_0xeff7('0x44')]({'where':{'id':_0x103224[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](handleEntityNotFound(_0x2a6c1f,null))[_0xeff7('0x1b')](function(_0x4bfc9d){if(_0x4bfc9d){_0xc638ba=_0x4bfc9d;_0x16ab9c[_0xeff7('0x2d')]=_[_0xeff7('0x2e')](db['Team'][_0xeff7('0x21')]);_0x16ab9c['query']=_[_0xeff7('0x2e')](_0x103224[_0xeff7('0x28')]);_0x16ab9c[_0xeff7('0x30')]=_['intersection'](_0x16ab9c[_0xeff7('0x2d')],_0x16ab9c[_0xeff7('0x28')]);_0x4f7238[_0xeff7('0x33')]=_[_0xeff7('0x31')](_0x16ab9c['model'],qs['fields'](_0x103224['query'][_0xeff7('0x32')]));_0x4f7238[_0xeff7('0x33')]=_0x4f7238[_0xeff7('0x33')]['length']?_0x4f7238[_0xeff7('0x33')]:_0x16ab9c[_0xeff7('0x2d')];_0x4f7238[_0xeff7('0x57')]=qs['sort'](_0x103224[_0xeff7('0x28')][_0xeff7('0x48')]);_0x4f7238[_0xeff7('0x26')]=qs[_0xeff7('0x30')](_[_0xeff7('0x49')](_0x103224[_0xeff7('0x28')],_0x16ab9c[_0xeff7('0x30')]));if(_0x103224[_0xeff7('0x28')][_0xeff7('0x4b')]){_0x4f7238[_0xeff7('0x26')]=_[_0xeff7('0x35')](_0x4f7238[_0xeff7('0x26')],{'$or':_['map'](_0x4f7238[_0xeff7('0x33')],function(_0x29c0ac){var _0x4c8f82={};_0x4c8f82[_0x29c0ac]={'$like':'%'+_0x103224['query']['filter']+'%'};return _0x4c8f82;})});}_0x4f7238=_[_0xeff7('0x35')]({},_0x4f7238,_0x103224['options']);return _0xc638ba[_0xeff7('0x56')](_0x4f7238);}})[_0xeff7('0x1b')](function(_0x45ab7d){if(_0x45ab7d){_0x2b4670=_0x45ab7d['length'];if(!_0x103224['query'][_0xeff7('0x46')]('nolimit')){_0x4f7238['limit']=qs[_0xeff7('0x13')](_0x103224[_0xeff7('0x28')][_0xeff7('0x13')]);_0x4f7238['offset']=qs['offset'](_0x103224['query'][_0xeff7('0x11')]);}return _0xc638ba[_0xeff7('0x56')](_0x4f7238);}})[_0xeff7('0x1b')](function(_0x23646d){if(_0x23646d){return _0x23646d?{'count':_0x2b4670,'rows':_0x23646d}:null;}})['then'](respondWithResult(_0x2a6c1f,null))[_0xeff7('0x2b')](handleError(_0x2a6c1f,null));};exports['addTeams']=function(_0x3eac39,_0x98d99b){var _0x5792ce=_0x3eac39[_0xeff7('0x38')]['ids'];return db[_0xeff7('0x58')][_0xeff7('0x29')]({'where':{'id':_0x5792ce},'attributes':['id'],'include':[{'model':db[_0xeff7('0x4c')],'as':_0xeff7('0x59'),'attributes':['id',_0xeff7('0x1e'),_0xeff7('0x5a'),'voicePause',_0xeff7('0x5b')],'raw':!![]}]})[_0xeff7('0x1b')](function(_0x29033e){if(_0x29033e){var _0x2b8eaf=_[_0xeff7('0x5c')](_0x29033e,function(_0x22def9){var _0x36e746=_0x22def9['get']({'plain':!![]});return _0x36e746[_0xeff7('0x59')];});return db[_0xeff7('0x2f')]['find']({'where':{'id':_0x3eac39['params']['id']}})[_0xeff7('0x1b')](function(_0x3fa94a){return db[_0xeff7('0x5d')]['transaction'](function(_0x5157e1){return _0x3fa94a[_0xeff7('0x5e')](_0x5792ce,{'transaction':_0x5157e1})[_0xeff7('0x1b')](function(){return BPromise[_0xeff7('0x5f')](_0x2b8eaf,function(_0x49466d){return db[_0xeff7('0x45')]['findOrCreate']({'where':{'UserId':_0x49466d['id'],'WhatsappQueueId':_0x3eac39['params']['id']},'transaction':_0x5157e1});});})['then'](function(){_0x2b8eaf[_0xeff7('0x60')](function(_0x76de27){socket['emit'](_0xeff7('0x61'),{'UserId':_0x76de27['id'],'WhatsappQueueId':_0x3fa94a['id']});});});});});}})[_0xeff7('0x1b')](respondWithStatusCode(_0x98d99b,null))[_0xeff7('0x2b')](handleError(_0x98d99b,null));};exports[_0xeff7('0x62')]=function(_0x5307cc,_0x4f398c){return db[_0xeff7('0x58')][_0xeff7('0x29')]({'where':{'id':_0x5307cc['query'][_0xeff7('0x63')]},'attributes':['id'],'include':[{'model':db[_0xeff7('0x4c')],'as':_0xeff7('0x59'),'attributes':['id'],'raw':!![]}]})[_0xeff7('0x1b')](handleEntityNotFound(_0x4f398c,null))[_0xeff7('0x1b')](function(_0x39c383){var _0xcb7745=_[_0xeff7('0x20')](_0x39c383,'id');var _0x94ad64=[];var _0x215761=[];var _0x9f05d5=squel[_0xeff7('0x64')]();_0x9f05d5[_0xeff7('0x65')](_0xeff7('0x66'))['from'](_0xeff7('0x67'),'tq')[_0xeff7('0x68')](_0xeff7('0x69'),'ut',_0xeff7('0x6a'))[_0xeff7('0x26')](_0xeff7('0x6b'),_0x5307cc[_0xeff7('0x41')]['id']);for(var _0x2037cb=0x0;_0x2037cb<_0x39c383[_0xeff7('0x34')];_0x2037cb+=0x1){let _0x50fba5=_0x39c383[_0x2037cb];for(var _0x1d1f6c=0x0;_0x1d1f6c<_0x50fba5[_0xeff7('0x59')][_0xeff7('0x34')];_0x1d1f6c+=0x1){let _0x2ef8ae=_0x50fba5[_0xeff7('0x59')][_0x1d1f6c];var _0x55f7d9=_0x9f05d5[_0xeff7('0x6c')]();_0x55f7d9['where'](_0xeff7('0x6d'),_0x2ef8ae['id']);_0x215761[_0xeff7('0x6e')](db[_0xeff7('0x5d')][_0xeff7('0x28')](_0x55f7d9[_0xeff7('0x6f')](),{'type':db[_0xeff7('0x5d')][_0xeff7('0x70')][_0xeff7('0x71')]})[_0xeff7('0x1b')](function(_0x3a980c){if(_0x3a980c[_0xeff7('0x34')]===0x1){return _0x2ef8ae['id'];}else{var _0x244282=_[_0xeff7('0x72')](_[_0xeff7('0x20')](_0x3a980c,_0xeff7('0x73')),function(_0x210a48){return _[_0xeff7('0x74')](_0xcb7745,_0x210a48);});if(_0x244282){return _0x2ef8ae['id'];}}}));}}return BPromise['all'](_0x215761)[_0xeff7('0x1b')](function(_0x15cd9e){_0x94ad64=_(_0x94ad64)[_0xeff7('0x75')](_0x15cd9e)[_0xeff7('0x76')]()[_0xeff7('0x77')]();return db[_0xeff7('0x2f')]['find']({'where':{'id':_0x5307cc[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](function(_0x567258){return db['sequelize'][_0xeff7('0x78')](function(_0x3b3887){return _0x567258['removeTeams'](_0x5307cc['query'][_0xeff7('0x63')],{'transaction':_0x3b3887})['then'](function(){if(!_[_0xeff7('0x79')](_0x94ad64)){return _0x567258[_0xeff7('0x7a')](_0x94ad64,{'transaction':_0x3b3887});}})[_0xeff7('0x1b')](function(){_0x94ad64[_0xeff7('0x60')](function(_0x18521f){socket[_0xeff7('0x7b')]('userWhatsappQueue:remove',{'UserId':_0x18521f,'WhatsappQueueId':_0x567258['id']});});});});});});})[_0xeff7('0x1b')](respondWithStatusCode(_0x4f398c,null))[_0xeff7('0x2b')](handleError(_0x4f398c,null));};exports[_0xeff7('0x7c')]=function(_0x176b0a,_0x4315cc){return db[_0xeff7('0x2f')][_0xeff7('0x37')]({'where':{'id':_0x176b0a[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](handleEntityNotFound(_0x4315cc,null))['then'](function(_0x150e79){if(_0x150e79){return _0x150e79['addAgents'](_0x176b0a[_0xeff7('0x38')][_0xeff7('0x63')],_[_0xeff7('0x7d')](_0x176b0a[_0xeff7('0x38')],[_0xeff7('0x63'),'id'])||{})[_0xeff7('0x7e')](function(_0x40ad40){for(var _0x2d772a=0x0;_0x2d772a<_0x176b0a[_0xeff7('0x38')][_0xeff7('0x63')][_0xeff7('0x34')];_0x2d772a+=0x1){socket['emit'](_0xeff7('0x61'),{'UserId':Number(_0x176b0a[_0xeff7('0x38')][_0xeff7('0x63')][_0x2d772a]),'WhatsappQueueId':Number(_0x176b0a[_0xeff7('0x41')]['id'])});}return _0x40ad40;});}})[_0xeff7('0x1b')](respondWithResult(_0x4315cc,null))[_0xeff7('0x2b')](handleError(_0x4315cc,null));};exports[_0xeff7('0x7a')]=function(_0x16d266,_0x1c7520){return db['WhatsappQueue'][_0xeff7('0x37')]({'where':{'id':_0x16d266[_0xeff7('0x41')]['id']}})[_0xeff7('0x1b')](handleEntityNotFound(_0x1c7520,null))[_0xeff7('0x1b')](function(_0x3c4ca1){if(_0x3c4ca1){return _0x3c4ca1[_0xeff7('0x7a')](_0x16d266[_0xeff7('0x28')][_0xeff7('0x63')])[_0xeff7('0x1b')](function(){if(_[_0xeff7('0x7f')](_0x16d266[_0xeff7('0x28')][_0xeff7('0x63')])){for(var _0x467d0a=0x0;_0x467d0a<_0x16d266[_0xeff7('0x28')][_0xeff7('0x63')][_0xeff7('0x34')];_0x467d0a+=0x1){socket[_0xeff7('0x7b')]('userWhatsappQueue:remove',{'UserId':Number(_0x16d266[_0xeff7('0x28')][_0xeff7('0x63')][_0x467d0a]),'WhatsappQueueId':Number(_0x16d266[_0xeff7('0x41')]['id'])});}}else{socket[_0xeff7('0x7b')](_0xeff7('0x80'),{'UserId':Number(_0x16d266[_0xeff7('0x28')]['ids']),'WhatsappQueueId':Number(_0x16d266[_0xeff7('0x41')]['id'])});}});}})[_0xeff7('0x1b')](respondWithStatusCode(_0x1c7520,null))[_0xeff7('0x2b')](handleError(_0x1c7520,null));};exports[_0xeff7('0x81')]=function(_0xc6bfa9,_0x23736c){var _0x2689da={};var _0x3f0cd4={};var _0x5f33e5;var _0x598b7e;return db[_0xeff7('0x2f')][_0xeff7('0x44')]({'where':{'id':_0xc6bfa9[_0xeff7('0x41')]['id']}})['then'](handleEntityNotFound(_0x23736c,null))[_0xeff7('0x1b')](function(_0x332871){if(_0x332871){_0x5f33e5=_0x332871;_0x3f0cd4[_0xeff7('0x2d')]=_[_0xeff7('0x2e')](db[_0xeff7('0x4c')][_0xeff7('0x21')]);_0x3f0cd4[_0xeff7('0x28')]=_[_0xeff7('0x2e')](_0xc6bfa9[_0xeff7('0x28')]);_0x3f0cd4[_0xeff7('0x30')]=_[_0xeff7('0x31')](_0x3f0cd4[_0xeff7('0x2d')],_0x3f0cd4[_0xeff7('0x28')]);_0x2689da['attributes']=_[_0xeff7('0x31')](_0x3f0cd4[_0xeff7('0x2d')],qs[_0xeff7('0x32')](_0xc6bfa9[_0xeff7('0x28')][_0xeff7('0x32')]));_0x2689da[_0xeff7('0x33')]=_0x2689da[_0xeff7('0x33')][_0xeff7('0x34')]?_0x2689da['attributes']:_0x3f0cd4[_0xeff7('0x2d')];_0x2689da['order']=qs[_0xeff7('0x48')](_0xc6bfa9['query']['sort']);_0x2689da['where']=qs[_0xeff7('0x30')](_['pick'](_0xc6bfa9[_0xeff7('0x28')],_0x3f0cd4[_0xeff7('0x30')]));if(_0xc6bfa9['query'][_0xeff7('0x4b')]){_0x2689da[_0xeff7('0x26')]=_[_0xeff7('0x35')](_0x2689da[_0xeff7('0x26')],{'$or':_[_0xeff7('0x20')](_0x2689da[_0xeff7('0x33')],function(_0x969928){var _0x119450={};_0x119450[_0x969928]={'$like':'%'+_0xc6bfa9['query']['filter']+'%'};return _0x119450;})});}_0x2689da=_[_0xeff7('0x35')]({},_0x2689da,_0xc6bfa9[_0xeff7('0x36')]);return _0x5f33e5[_0xeff7('0x81')](_0x2689da);}})[_0xeff7('0x1b')](function(_0x528170){if(_0x528170){_0x598b7e=_0x528170['length'];if(!_0xc6bfa9[_0xeff7('0x28')][_0xeff7('0x46')]('nolimit')){_0x2689da['limit']=qs[_0xeff7('0x13')](_0xc6bfa9[_0xeff7('0x28')][_0xeff7('0x13')]);_0x2689da[_0xeff7('0x11')]=qs[_0xeff7('0x11')](_0xc6bfa9['query'][_0xeff7('0x11')]);}return _0x5f33e5[_0xeff7('0x81')](_0x2689da);}})[_0xeff7('0x1b')](function(_0x514b01){if(_0x514b01){return _0x514b01?{'count':_0x598b7e,'rows':_0x514b01}:null;}})[_0xeff7('0x1b')](respondWithResult(_0x23736c,null))['catch'](handleError(_0x23736c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f696895..3a6c300 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 _0x5758=['update','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x3786dd,_0x5777fc){var _0x4c7a8e=function(_0x119047){while(--_0x119047){_0x3786dd['push'](_0x3786dd['shift']());}};_0x4c7a8e(++_0x5777fc);}(_0x5758,0x124));var _0x8575=function(_0x919b78,_0x92de37){_0x919b78=_0x919b78-0x0;var _0x50b387=_0x5758[_0x919b78];return _0x50b387;};'use strict';var EventEmitter=require(_0x8575('0x0'));var WhatsappQueue=require(_0x8575('0x1'))['db'][_0x8575('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8575('0x3')](0x0);var events={'afterCreate':_0x8575('0x4'),'afterUpdate':_0x8575('0x5'),'afterDestroy':'remove'};function emitEvent(_0x6736c8){return function(_0x4c320e,_0x57904b,_0x14a101){WhatsappQueueEvents['emit'](_0x6736c8+':'+_0x4c320e['id'],_0x4c320e);WhatsappQueueEvents['emit'](_0x6736c8,_0x4c320e);_0x14a101(null);};}for(var e in events){if(events[_0x8575('0x6')](e)){var event=events[e];WhatsappQueue[_0x8575('0x7')](e,emitEvent(event));}}module[_0x8575('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4eb9=['../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb9,0x185));var _0x94eb=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4eb9[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require(_0x94eb('0x0'));var WhatsappQueue=require(_0x94eb('0x1'))['db'][_0x94eb('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x94eb('0x3')](0x0);var events={'afterCreate':_0x94eb('0x4'),'afterUpdate':'update','afterDestroy':_0x94eb('0x5')};function emitEvent(_0x3db077){return function(_0x384eba,_0x4cfca7,_0x2af656){WhatsappQueueEvents[_0x94eb('0x6')](_0x3db077+':'+_0x384eba['id'],_0x384eba);WhatsappQueueEvents[_0x94eb('0x6')](_0x3db077,_0x384eba);_0x2af656(null);};}for(var e in events){if(events[_0x94eb('0x7')](e)){var event=events[e];WhatsappQueue[_0x94eb('0x8')](e,emitEvent(event));}}module[_0x94eb('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 12bf200..668ace3 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 _0xe88f=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues'];(function(_0x1d3d31,_0x31e6d5){var _0x4de2e0=function(_0x5c12ea){while(--_0x5c12ea){_0x1d3d31['push'](_0x1d3d31['shift']());}};_0x4de2e0(++_0x31e6d5);}(_0xe88f,0x96));var _0xfe88=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xe88f[_0x1e2080];return _0x260111;};'use strict';var _=require(_0xfe88('0x0'));var util=require(_0xfe88('0x1'));var logger=require(_0xfe88('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfe88('0x3'));var fs=require('fs');var path=require(_0xfe88('0x4'));var rimraf=require(_0xfe88('0x5'));var config=require(_0xfe88('0x6'));var attributes=require(_0xfe88('0x7'));module[_0xfe88('0x8')]=function(_0x244a72,_0x4c02ce){return _0x244a72['define']('WhatsappQueue',attributes,{'tableName':_0xfe88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd9=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','define','WhatsappQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fd9,0x6e));var _0x99fd=function(_0x4cb97c,_0x26e306){_0x4cb97c=_0x4cb97c-0x0;var _0x5628a9=_0x9fd9[_0x4cb97c];return _0x5628a9;};'use strict';var _=require(_0x99fd('0x0'));var util=require(_0x99fd('0x1'));var logger=require(_0x99fd('0x2'))('api');var moment=require(_0x99fd('0x3'));var BPromise=require(_0x99fd('0x4'));var rp=require(_0x99fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99fd('0x6'));var config=require('../../config/environment');var attributes=require(_0x99fd('0x7'));module['exports']=function(_0x4d0496,_0x3c797a){return _0x4d0496[_0x99fd('0x8')](_0x99fd('0x9'),attributes,{'tableName':'whatsapp_queues','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 aacbc0e..c3bd7ea 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 _0x999e=['include','map','model','info','WhatsappQueue','find','raw','ShowWhatsappQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','where','attributes','limit'];(function(_0xff5df6,_0x514e73){var _0x2634bb=function(_0x1bb600){while(--_0x1bb600){_0xff5df6['push'](_0xff5df6['shift']());}};_0x2634bb(++_0x514e73);}(_0x999e,0xb4));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe999('0x0'));var util=require(_0xe999('0x1'));var moment=require(_0xe999('0x2'));var BPromise=require('bluebird');var rs=require(_0xe999('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe999('0x4'))['db'];var utils=require(_0xe999('0x5'));var logger=require(_0xe999('0x6'))(_0xe999('0x7'));var config=require(_0xe999('0x8'));var jayson=require(_0xe999('0x9'));var client=jayson[_0xe999('0xa')][_0xe999('0xb')]({'port':0x232a});config['redis']=_[_0xe999('0xc')](config[_0xe999('0xd')],{'host':_0xe999('0xe'),'port':0x18eb});var socket=require(_0xe999('0xf'))(new Redis(config[_0xe999('0xd')]));require('./whatsappQueue.socket')[_0xe999('0x10')](socket);function respondWithRpcPromise(_0x3b4eaf,_0x4e9ab4,_0x53ba15){return new BPromise(function(_0xe3933,_0xcbe4e){return client[_0xe999('0x11')](_0x3b4eaf,_0x53ba15)[_0xe999('0x12')](function(_0x59785f){logger['info'](_0xe999('0x13'),_0x4e9ab4,_0xe999('0x14'));logger[_0xe999('0x15')](_0xe999('0x16'),_0x4e9ab4,_0xe999('0x14'),JSON[_0xe999('0x17')](_0x59785f));if(_0x59785f[_0xe999('0x18')]){if(_0x59785f[_0xe999('0x18')][_0xe999('0x19')]===0x1f4){logger[_0xe999('0x18')](_0xe999('0x13'),_0x4e9ab4,_0x59785f[_0xe999('0x18')][_0xe999('0x1a')]);return _0xcbe4e(_0x59785f[_0xe999('0x18')]['message']);}logger[_0xe999('0x18')](_0xe999('0x13'),_0x4e9ab4,_0x59785f['error'][_0xe999('0x1a')]);return _0xe3933(_0x59785f[_0xe999('0x18')][_0xe999('0x1a')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4e9ab4,_0xe999('0x14'));_0xe3933(_0x59785f[_0xe999('0x1b')][_0xe999('0x1a')]);}})[_0xe999('0x1c')](function(_0xcfa72){logger[_0xe999('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x4e9ab4,_0xcfa72);_0xcbe4e(_0xcfa72);});});}exports[_0xe999('0x1d')]=function(_0x1fa969){var _0x112596=this;return new Promise(function(_0x339080,_0xc91bed){return db['WhatsappQueue'][_0xe999('0x1e')]({'raw':_0x1fa969[_0xe999('0x1f')]?_0x1fa969[_0xe999('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1fa969[_0xe999('0x1f')]?_0x1fa969[_0xe999('0x1f')][_0xe999('0x20')]||null:null,'attributes':_0x1fa969[_0xe999('0x1f')]?_0x1fa969[_0xe999('0x1f')][_0xe999('0x21')]||null:null,'limit':_0x1fa969[_0xe999('0x1f')]?_0x1fa969[_0xe999('0x1f')][_0xe999('0x22')]||null:null,'include':_0x1fa969[_0xe999('0x1f')]?_0x1fa969['options'][_0xe999('0x23')]?_[_0xe999('0x24')](_0x1fa969['options']['include'],function(_0x314b34){return{'model':db[_0x314b34[_0xe999('0x25')]],'as':_0x314b34['as'],'attributes':_0x314b34[_0xe999('0x21')],'include':_0x314b34[_0xe999('0x23')]?_[_0xe999('0x24')](_0x314b34['include'],function(_0xb0e0c1){return{'model':db[_0xb0e0c1[_0xe999('0x25')]],'as':_0xb0e0c1['as'],'attributes':_0xb0e0c1[_0xe999('0x21')],'include':_0xb0e0c1[_0xe999('0x23')]?_[_0xe999('0x24')](_0xb0e0c1[_0xe999('0x23')],function(_0xfa5339){return{'model':db[_0xfa5339['model']],'as':_0xfa5339['as'],'attributes':_0xfa5339[_0xe999('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe999('0x12')](function(_0x2f77f1){logger[_0xe999('0x26')]('GetWhatsappQueue',_0x1fa969);logger[_0xe999('0x15')](_0xe999('0x1d'),_0x1fa969,JSON[_0xe999('0x17')](_0x2f77f1));_0x339080(_0x2f77f1);})[_0xe999('0x1c')](function(_0x140c42){logger[_0xe999('0x18')](_0xe999('0x1d'),_0x140c42['message'],_0x1fa969);_0xc91bed(_0x112596[_0xe999('0x18')](0x1f4,_0x140c42[_0xe999('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x38a86d){var _0x19d2be=this;return new Promise(function(_0x2dd614,_0x3c3f15){return db[_0xe999('0x27')][_0xe999('0x28')]({'raw':_0x38a86d[_0xe999('0x1f')]?_0x38a86d[_0xe999('0x1f')][_0xe999('0x29')]===undefined?!![]:![]:!![],'where':_0x38a86d['options']?_0x38a86d['options'][_0xe999('0x20')]||null:null,'attributes':_0x38a86d[_0xe999('0x1f')]?_0x38a86d['options'][_0xe999('0x21')]||null:null,'include':_0x38a86d['options']?_0x38a86d[_0xe999('0x1f')][_0xe999('0x23')]?_[_0xe999('0x24')](_0x38a86d[_0xe999('0x1f')][_0xe999('0x23')],function(_0x1ccc41){return{'model':db[_0x1ccc41[_0xe999('0x25')]],'as':_0x1ccc41['as'],'attributes':_0x1ccc41['attributes'],'include':_0x1ccc41[_0xe999('0x23')]?_[_0xe999('0x24')](_0x1ccc41[_0xe999('0x23')],function(_0x252064){return{'model':db[_0x252064['model']],'as':_0x252064['as'],'attributes':_0x252064[_0xe999('0x21')],'include':_0x252064[_0xe999('0x23')]?_[_0xe999('0x24')](_0x252064[_0xe999('0x23')],function(_0x2d3c75){return{'model':db[_0x2d3c75[_0xe999('0x25')]],'as':_0x2d3c75['as'],'attributes':_0x2d3c75[_0xe999('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b474d){logger['info'](_0xe999('0x2a'),_0x38a86d);logger[_0xe999('0x15')](_0xe999('0x2a'),_0x38a86d,JSON[_0xe999('0x17')](_0x2b474d));_0x2dd614(_0x2b474d);})[_0xe999('0x1c')](function(_0xfaa658){logger[_0xe999('0x18')](_0xe999('0x2a'),_0xfaa658[_0xe999('0x1a')],_0x38a86d);_0x3c3f15(_0x19d2be[_0xe999('0x18')](0x1f4,_0xfaa658[_0xe999('0x1a')]));});});}; \ No newline at end of file +var _0xff1c=['map','model','attributes','GetWhatsappQueue','debug','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','findAll','options','raw','where','limit','include'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xff1c,0x1e0));var _0xcff1=function(_0x4e8c7d,_0x5ef1ed){_0x4e8c7d=_0x4e8c7d-0x0;var _0x37afc4=_0xff1c[_0x4e8c7d];return _0x37afc4;};'use strict';var _=require(_0xcff1('0x0'));var util=require(_0xcff1('0x1'));var moment=require(_0xcff1('0x2'));var BPromise=require(_0xcff1('0x3'));var rs=require(_0xcff1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcff1('0x5'))['db'];var utils=require(_0xcff1('0x6'));var logger=require(_0xcff1('0x7'))(_0xcff1('0x8'));var config=require(_0xcff1('0x9'));var jayson=require(_0xcff1('0xa'));var client=jayson[_0xcff1('0xb')][_0xcff1('0xc')]({'port':0x232a});config[_0xcff1('0xd')]=_[_0xcff1('0xe')](config[_0xcff1('0xd')],{'host':_0xcff1('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcff1('0x10'))[_0xcff1('0x11')](socket);function respondWithRpcPromise(_0x56ee92,_0x5e449c,_0x17d225){return new BPromise(function(_0x22ed91,_0x467410){return client[_0xcff1('0x12')](_0x56ee92,_0x17d225)[_0xcff1('0x13')](function(_0x144ddc){logger[_0xcff1('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x5e449c,'request\x20sent');logger['debug'](_0xcff1('0x15'),_0x5e449c,_0xcff1('0x16'),JSON[_0xcff1('0x17')](_0x144ddc));if(_0x144ddc['error']){if(_0x144ddc[_0xcff1('0x18')][_0xcff1('0x19')]===0x1f4){logger['error'](_0xcff1('0x1a'),_0x5e449c,_0x144ddc[_0xcff1('0x18')][_0xcff1('0x1b')]);return _0x467410(_0x144ddc['error'][_0xcff1('0x1b')]);}logger[_0xcff1('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x5e449c,_0x144ddc[_0xcff1('0x18')][_0xcff1('0x1b')]);return _0x22ed91(_0x144ddc['error'][_0xcff1('0x1b')]);}else{logger[_0xcff1('0x14')](_0xcff1('0x1a'),_0x5e449c,_0xcff1('0x16'));_0x22ed91(_0x144ddc['result']['message']);}})[_0xcff1('0x1c')](function(_0x465956){logger['error'](_0xcff1('0x1a'),_0x5e449c,_0x465956);_0x467410(_0x465956);});});}exports['GetWhatsappQueue']=function(_0x37012b){var _0x1538a6=this;return new Promise(function(_0x5abb5e,_0x49cd64){return db[_0xcff1('0x1d')][_0xcff1('0x1e')]({'raw':_0x37012b['options']?_0x37012b[_0xcff1('0x1f')][_0xcff1('0x20')]===undefined?!![]:![]:!![],'where':_0x37012b[_0xcff1('0x1f')]?_0x37012b['options'][_0xcff1('0x21')]||null:null,'attributes':_0x37012b[_0xcff1('0x1f')]?_0x37012b[_0xcff1('0x1f')]['attributes']||null:null,'limit':_0x37012b[_0xcff1('0x1f')]?_0x37012b[_0xcff1('0x1f')][_0xcff1('0x22')]||null:null,'include':_0x37012b[_0xcff1('0x1f')]?_0x37012b[_0xcff1('0x1f')][_0xcff1('0x23')]?_[_0xcff1('0x24')](_0x37012b[_0xcff1('0x1f')][_0xcff1('0x23')],function(_0x3cded7){return{'model':db[_0x3cded7[_0xcff1('0x25')]],'as':_0x3cded7['as'],'attributes':_0x3cded7[_0xcff1('0x26')],'include':_0x3cded7[_0xcff1('0x23')]?_[_0xcff1('0x24')](_0x3cded7[_0xcff1('0x23')],function(_0x5aeea4){return{'model':db[_0x5aeea4['model']],'as':_0x5aeea4['as'],'attributes':_0x5aeea4[_0xcff1('0x26')],'include':_0x5aeea4[_0xcff1('0x23')]?_[_0xcff1('0x24')](_0x5aeea4[_0xcff1('0x23')],function(_0x20c296){return{'model':db[_0x20c296[_0xcff1('0x25')]],'as':_0x20c296['as'],'attributes':_0x20c296[_0xcff1('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189b12){logger[_0xcff1('0x14')](_0xcff1('0x27'),_0x37012b);logger[_0xcff1('0x28')](_0xcff1('0x27'),_0x37012b,JSON[_0xcff1('0x17')](_0x189b12));_0x5abb5e(_0x189b12);})[_0xcff1('0x1c')](function(_0x3026a3){logger[_0xcff1('0x18')](_0xcff1('0x27'),_0x3026a3['message'],_0x37012b);_0x49cd64(_0x1538a6[_0xcff1('0x18')](0x1f4,_0x3026a3[_0xcff1('0x1b')]));});});};exports[_0xcff1('0x29')]=function(_0x3b8abc){var _0x4168cf=this;return new Promise(function(_0x2dc144,_0x579cba){return db[_0xcff1('0x1d')][_0xcff1('0x2a')]({'raw':_0x3b8abc[_0xcff1('0x1f')]?_0x3b8abc[_0xcff1('0x1f')][_0xcff1('0x20')]===undefined?!![]:![]:!![],'where':_0x3b8abc[_0xcff1('0x1f')]?_0x3b8abc[_0xcff1('0x1f')][_0xcff1('0x21')]||null:null,'attributes':_0x3b8abc['options']?_0x3b8abc['options']['attributes']||null:null,'include':_0x3b8abc['options']?_0x3b8abc[_0xcff1('0x1f')][_0xcff1('0x23')]?_[_0xcff1('0x24')](_0x3b8abc['options'][_0xcff1('0x23')],function(_0x596181){return{'model':db[_0x596181[_0xcff1('0x25')]],'as':_0x596181['as'],'attributes':_0x596181[_0xcff1('0x26')],'include':_0x596181['include']?_[_0xcff1('0x24')](_0x596181[_0xcff1('0x23')],function(_0x3c9a47){return{'model':db[_0x3c9a47['model']],'as':_0x3c9a47['as'],'attributes':_0x3c9a47[_0xcff1('0x26')],'include':_0x3c9a47[_0xcff1('0x23')]?_['map'](_0x3c9a47[_0xcff1('0x23')],function(_0x3fa7cb){return{'model':db[_0x3fa7cb[_0xcff1('0x25')]],'as':_0x3fa7cb['as'],'attributes':_0x3fa7cb[_0xcff1('0x26')]};}):[]};}):[]};}):[]:[]})[_0xcff1('0x13')](function(_0x8b71a8){logger[_0xcff1('0x14')]('ShowWhatsappQueue',_0x3b8abc);logger[_0xcff1('0x28')]('ShowWhatsappQueue',_0x3b8abc,JSON[_0xcff1('0x17')](_0x8b71a8));_0x2dc144(_0x8b71a8);})[_0xcff1('0x1c')](function(_0x28d88){logger['error'](_0xcff1('0x29'),_0x28d88[_0xcff1('0x1b')],_0x3b8abc);_0x579cba(_0x4168cf[_0xcff1('0x18')](0x1f4,_0x28d88[_0xcff1('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cb7823d..956277c 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 _0x96a2=['removeListener','register','whatsappQueue:','update','emit'];(function(_0x32b67f,_0x315539){var _0x3205ff=function(_0x536032){while(--_0x536032){_0x32b67f['push'](_0x32b67f['shift']());}};_0x3205ff(++_0x315539);}(_0x96a2,0x1de));var _0x296a=function(_0x33e915,_0xdbad7a){_0x33e915=_0x33e915-0x0;var _0x3729a9=_0x96a2[_0x33e915];return _0x3729a9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove',_0x296a('0x0')];function createListener(_0x53d028,_0x5bacd6){return function(_0x528a26){_0x5bacd6[_0x296a('0x1')](_0x53d028,_0x528a26);};}function removeListener(_0x1e4523,_0x304f50){return function(){WhatsappQueueEvents[_0x296a('0x2')](_0x1e4523,_0x304f50);};}exports[_0x296a('0x3')]=function(_0x2a5145){for(var _0x3026c7=0x0,_0x1f042c=events['length'];_0x3026c7<_0x1f042c;_0x3026c7++){var _0x331a9b=events[_0x3026c7];var _0x207f41=createListener(_0x296a('0x4')+_0x331a9b,_0x2a5145);WhatsappQueueEvents['on'](_0x331a9b,_0x207f41);}}; \ No newline at end of file +var _0x5e7b=['save','remove','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x3c3e72,_0x3e1858){var _0x48a7e5=function(_0x3d1c72){while(--_0x3d1c72){_0x3c3e72['push'](_0x3c3e72['shift']());}};_0x48a7e5(++_0x3e1858);}(_0x5e7b,0x157));var _0xb5e7=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x5e7b[_0x593564];return _0x211a89;};'use strict';var WhatsappQueueEvents=require(_0xb5e7('0x0'));var events=[_0xb5e7('0x1'),_0xb5e7('0x2'),'update'];function createListener(_0x166ed9,_0x2645a2){return function(_0x4bb032){_0x2645a2[_0xb5e7('0x3')](_0x166ed9,_0x4bb032);};}function removeListener(_0x2211dd,_0x5017b8){return function(){WhatsappQueueEvents[_0xb5e7('0x4')](_0x2211dd,_0x5017b8);};}exports[_0xb5e7('0x5')]=function(_0x2bc64c){for(var _0xa84f48=0x0,_0x2073ff=events[_0xb5e7('0x6')];_0xa84f48<_0x2073ff;_0xa84f48++){var _0x42abfc=events[_0xa84f48];var _0x3daae2=createListener(_0xb5e7('0x7')+_0x42abfc,_0x2bc64c);WhatsappQueueEvents['on'](_0x42abfc,_0x3daae2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8012ab5..f32fc61 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 _0xe295=['isAuthenticated','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','describe','/:id','show','post','create','put'];(function(_0x57e92c,_0x22fcda){var _0x567c0d=function(_0x31bdd3){while(--_0x31bdd3){_0x57e92c['push'](_0x57e92c['shift']());}};_0x567c0d(++_0x22fcda);}(_0xe295,0xcb));var _0x5e29=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0xe295[_0x5dc927];return _0x416440;};'use strict';var multer=require(_0x5e29('0x0'));var util=require(_0x5e29('0x1'));var path=require('path');var timeout=require(_0x5e29('0x2'));var express=require(_0x5e29('0x3'));var router=express['Router']();var fs_extra=require(_0x5e29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e29('0x5'));var config=require(_0x5e29('0x6'));var controller=require(_0x5e29('0x7'));router[_0x5e29('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e29('0x9')]);router[_0x5e29('0x8')](_0x5e29('0xa'),auth['isAuthenticated'](),controller[_0x5e29('0xb')]);router[_0x5e29('0x8')](_0x5e29('0xc'),auth['isAuthenticated'](),controller[_0x5e29('0xd')]);router[_0x5e29('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e29('0xf')]);router[_0x5e29('0x10')](_0x5e29('0xc'),auth[_0x5e29('0x11')](),controller[_0x5e29('0x12')]);router['delete'](_0x5e29('0xc'),auth[_0x5e29('0x11')](),controller['destroy']);module[_0x5e29('0x13')]=router; \ No newline at end of file +var _0x0332=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index'];(function(_0x44d892,_0x28a1c0){var _0x19097d=function(_0x1a1d3a){while(--_0x1a1d3a){_0x44d892['push'](_0x44d892['shift']());}};_0x19097d(++_0x28a1c0);}(_0x0332,0x73));var _0x2033=function(_0x23d35d,_0x39c88e){_0x23d35d=_0x23d35d-0x0;var _0x15e742=_0x0332[_0x23d35d];return _0x15e742;};'use strict';var multer=require(_0x2033('0x0'));var util=require(_0x2033('0x1'));var path=require(_0x2033('0x2'));var timeout=require('connect-timeout');var express=require(_0x2033('0x3'));var router=express['Router']();var fs_extra=require(_0x2033('0x4'));var auth=require(_0x2033('0x5'));var interaction=require(_0x2033('0x6'));var config=require(_0x2033('0x7'));var controller=require(_0x2033('0x8'));router[_0x2033('0x9')]('/',auth['isAuthenticated'](),controller[_0x2033('0xa')]);router['get']('/describe',auth[_0x2033('0xb')](),controller[_0x2033('0xc')]);router[_0x2033('0x9')](_0x2033('0xd'),auth[_0x2033('0xb')](),controller[_0x2033('0xe')]);router[_0x2033('0xf')]('/',auth[_0x2033('0xb')](),controller[_0x2033('0x10')]);router[_0x2033('0x11')](_0x2033('0xd'),auth[_0x2033('0xb')](),controller['update']);router[_0x2033('0x12')](_0x2033('0xd'),auth['isAuthenticated'](),controller[_0x2033('0x13')]);module[_0x2033('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 112f141..0d9eab3 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3d9c38,_0x399fbc){var _0x3ec070=function(_0x279228){while(--_0x279228){_0x3d9c38['push'](_0x3d9c38['shift']());}};_0x3ec070(++_0x399fbc);}(_0x7a54,0x106));var _0x47a5=function(_0x159234,_0xd9b49){_0x159234=_0x159234-0x0;var _0x4f4ca6=_0x7a54[_0x159234];return _0x4f4ca6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3c02b6,_0x491c6b){var _0x3c68be=function(_0x5ed4e8){while(--_0x5ed4e8){_0x3c02b6['push'](_0x3c02b6['shift']());}};_0x3c68be(++_0x491c6b);}(_0x7a54,0x106));var _0x47a5=function(_0x1af4a7,_0xc02815){_0x1af4a7=_0x1af4a7-0x0;var _0xc36ac8=_0x7a54[_0x1af4a7];return _0xc36ac8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 7f11a2b..dbc31bf 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 _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file +var _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x52a601,_0x3bd08e){var _0x54f8b6=function(_0x37b450){while(--_0x37b450){_0x52a601['push'](_0x52a601['shift']());}};_0x54f8b6(++_0x3bd08e);}(_0x0bb5,0x148));var _0x50bb=function(_0x107f15,_0x3fd092){_0x107f15=_0x107f15-0x0;var _0x47760f=_0x0bb5[_0x107f15];return _0x47760f;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['WhatsappQueueReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9ea94cc..1824f28 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 _0x9b19=['moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','api'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0x9b19,0xca));var _0x99b1=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0x9b19[_0x515283];return _0x38f836;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x99b1('0x0'))(_0x99b1('0x1'));var moment=require(_0x99b1('0x2'));var BPromise=require(_0x99b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b1('0x4'));var rimraf=require(_0x99b1('0x5'));var config=require(_0x99b1('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x99b1('0x7')]=function(_0x20a02e,_0x584b82){return _0x20a02e[_0x99b1('0x8')](_0x99b1('0x9'),attributes,{'tableName':_0x99b1('0xa'),'paranoid':![],'indexes':[{'name':_0x99b1('0xb'),'fields':[_0x99b1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe04=['request-promise','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','api','moment','bluebird'];(function(_0x2c48b2,_0x3e0a28){var _0x4c12c2=function(_0x5d1bbc){while(--_0x5d1bbc){_0x2c48b2['push'](_0x2c48b2['shift']());}};_0x4c12c2(++_0x3e0a28);}(_0xbe04,0x164));var _0x4be0=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0xbe04[_0x562362];return _0x3a18ce;};'use strict';var _=require(_0x4be0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4be0('0x1'));var moment=require(_0x4be0('0x2'));var BPromise=require(_0x4be0('0x3'));var rp=require(_0x4be0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4be0('0x5'));var config=require('../../config/environment');var attributes=require(_0x4be0('0x6'));module['exports']=function(_0x3d253e,_0x55059a){return _0x3d253e[_0x4be0('0x7')](_0x4be0('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x4be0('0x9'),'fields':[_0x4be0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 78f7fdd..2b82955 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 _0xbde4=['create','body','options','raw','update','where','attributes','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x4e0006,_0x304b22){var _0x2883e1=function(_0x5062cd){while(--_0x5062cd){_0x4e0006['push'](_0x4e0006['shift']());}};_0x2883e1(++_0x304b22);}(_0xbde4,0xa8));var _0x4bde=function(_0x51a0ac,_0x225b12){_0x51a0ac=_0x51a0ac-0x0;var _0x1459a8=_0xbde4[_0x51a0ac];return _0x1459a8;};'use strict';var _=require(_0x4bde('0x0'));var util=require('util');var moment=require(_0x4bde('0x1'));var BPromise=require(_0x4bde('0x2'));var rs=require(_0x4bde('0x3'));var fs=require('fs');var Redis=require(_0x4bde('0x4'));var db=require(_0x4bde('0x5'))['db'];var utils=require(_0x4bde('0x6'));var logger=require(_0x4bde('0x7'))(_0x4bde('0x8'));var config=require('../../config/environment');var jayson=require(_0x4bde('0x9'));var client=jayson[_0x4bde('0xa')][_0x4bde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d036,_0x3e8bf4,_0x8cbf36){return new BPromise(function(_0x35f477,_0x1bab98){return client['request'](_0x16d036,_0x8cbf36)[_0x4bde('0xc')](function(_0x223b55){logger[_0x4bde('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3e8bf4,_0x4bde('0xe'));logger[_0x4bde('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3e8bf4,_0x4bde('0xe'),JSON[_0x4bde('0x10')](_0x223b55));if(_0x223b55[_0x4bde('0x11')]){if(_0x223b55[_0x4bde('0x11')][_0x4bde('0x12')]===0x1f4){logger[_0x4bde('0x11')](_0x4bde('0x13'),_0x3e8bf4,_0x223b55[_0x4bde('0x11')][_0x4bde('0x14')]);return _0x1bab98(_0x223b55[_0x4bde('0x11')]['message']);}logger[_0x4bde('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3e8bf4,_0x223b55[_0x4bde('0x11')][_0x4bde('0x14')]);return _0x35f477(_0x223b55[_0x4bde('0x11')][_0x4bde('0x14')]);}else{logger[_0x4bde('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3e8bf4,_0x4bde('0xe'));_0x35f477(_0x223b55['result'][_0x4bde('0x14')]);}})[_0x4bde('0x15')](function(_0x48258d){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3e8bf4,_0x48258d);_0x1bab98(_0x48258d);});});}exports[_0x4bde('0x16')]=function(_0x238474){var _0x486957=this;return new Promise(function(_0x3a5acc,_0x3c5efe){return db[_0x4bde('0x17')][_0x4bde('0x18')](_0x238474[_0x4bde('0x19')],{'raw':_0x238474['options']?_0x238474[_0x4bde('0x1a')][_0x4bde('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x519bec){logger[_0x4bde('0xd')](_0x4bde('0x16'),_0x238474);logger[_0x4bde('0xf')](_0x4bde('0x16'),_0x238474,JSON['stringify'](_0x519bec));_0x3a5acc(_0x519bec);})[_0x4bde('0x15')](function(_0x16e00e){logger['error'](_0x4bde('0x16'),_0x16e00e[_0x4bde('0x14')],_0x238474);_0x3c5efe(_0x486957[_0x4bde('0x11')](0x1f4,_0x16e00e['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x168f45){var _0x9e4eb3=this;return new Promise(function(_0x49179e,_0x48579b){return db['WhatsappQueueReport'][_0x4bde('0x1c')](_0x168f45['body'],{'raw':_0x168f45[_0x4bde('0x1a')]?_0x168f45['options'][_0x4bde('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168f45[_0x4bde('0x1a')]?_0x168f45[_0x4bde('0x1a')][_0x4bde('0x1d')]||null:null,'attributes':_0x168f45['options']?_0x168f45[_0x4bde('0x1a')][_0x4bde('0x1e')]||null:null,'limit':_0x168f45[_0x4bde('0x1a')]?_0x168f45['options']['limit']||null:null})['then'](function(_0x45bb62){logger[_0x4bde('0xd')](_0x4bde('0x1f'),_0x168f45);logger[_0x4bde('0xf')](_0x4bde('0x1f'),_0x168f45,JSON[_0x4bde('0x10')](_0x45bb62));_0x49179e(_0x45bb62);})['catch'](function(_0x3740ac){logger[_0x4bde('0x11')](_0x4bde('0x1f'),_0x3740ac[_0x4bde('0x14')],_0x168f45);_0x48579b(_0x9e4eb3['error'](0x1f4,_0x3740ac[_0x4bde('0x14')]));});});}; \ No newline at end of file +var _0x5bf2=['code','message','info','result','catch','CreateWhatsappQueueReport','create','body','options','raw','then','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x42cf8a,_0x40aab4){var _0x149430=function(_0x1c8b7a){while(--_0x1c8b7a){_0x42cf8a['push'](_0x42cf8a['shift']());}};_0x149430(++_0x40aab4);}(_0x5bf2,0x1f1));var _0x25bf=function(_0x2660fa,_0xb16376){_0x2660fa=_0x2660fa-0x0;var _0x5e8bb0=_0x5bf2[_0x2660fa];return _0x5e8bb0;};'use strict';var _=require(_0x25bf('0x0'));var util=require(_0x25bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25bf('0x2'));var fs=require('fs');var Redis=require(_0x25bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x25bf('0x4'));var logger=require(_0x25bf('0x5'))(_0x25bf('0x6'));var config=require(_0x25bf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x25bf('0x8')][_0x25bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x414a44,_0x4532ff,_0x1b4564){return new BPromise(function(_0x47ceec,_0x90bc62){return client[_0x25bf('0xa')](_0x414a44,_0x1b4564)['then'](function(_0x12c7d6){logger['info'](_0x25bf('0xb'),_0x4532ff,_0x25bf('0xc'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4532ff,'request\x20sent',JSON[_0x25bf('0xd')](_0x12c7d6));if(_0x12c7d6['error']){if(_0x12c7d6[_0x25bf('0xe')][_0x25bf('0xf')]===0x1f4){logger['error'](_0x25bf('0xb'),_0x4532ff,_0x12c7d6[_0x25bf('0xe')][_0x25bf('0x10')]);return _0x90bc62(_0x12c7d6[_0x25bf('0xe')][_0x25bf('0x10')]);}logger[_0x25bf('0xe')](_0x25bf('0xb'),_0x4532ff,_0x12c7d6[_0x25bf('0xe')][_0x25bf('0x10')]);return _0x47ceec(_0x12c7d6[_0x25bf('0xe')][_0x25bf('0x10')]);}else{logger[_0x25bf('0x11')](_0x25bf('0xb'),_0x4532ff,_0x25bf('0xc'));_0x47ceec(_0x12c7d6[_0x25bf('0x12')][_0x25bf('0x10')]);}})[_0x25bf('0x13')](function(_0x5ba2be){logger['error'](_0x25bf('0xb'),_0x4532ff,_0x5ba2be);_0x90bc62(_0x5ba2be);});});}exports[_0x25bf('0x14')]=function(_0x5ccba2){var _0xdb5cbb=this;return new Promise(function(_0x5174a4,_0x2a6189){return db['WhatsappQueueReport'][_0x25bf('0x15')](_0x5ccba2[_0x25bf('0x16')],{'raw':_0x5ccba2['options']?_0x5ccba2[_0x25bf('0x17')][_0x25bf('0x18')]===undefined?!![]:![]:!![]})[_0x25bf('0x19')](function(_0x4b704d){logger['info']('CreateWhatsappQueueReport',_0x5ccba2);logger[_0x25bf('0x1a')](_0x25bf('0x14'),_0x5ccba2,JSON[_0x25bf('0xd')](_0x4b704d));_0x5174a4(_0x4b704d);})[_0x25bf('0x13')](function(_0x34b694){logger[_0x25bf('0xe')](_0x25bf('0x14'),_0x34b694[_0x25bf('0x10')],_0x5ccba2);_0x2a6189(_0xdb5cbb[_0x25bf('0xe')](0x1f4,_0x34b694[_0x25bf('0x10')]));});});};exports[_0x25bf('0x1b')]=function(_0x4bb2c0){var _0x1e5d43=this;return new Promise(function(_0x385c12,_0x5a3e64){return db['WhatsappQueueReport'][_0x25bf('0x1c')](_0x4bb2c0[_0x25bf('0x16')],{'raw':_0x4bb2c0['options']?_0x4bb2c0['options'][_0x25bf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb2c0[_0x25bf('0x17')]?_0x4bb2c0[_0x25bf('0x17')][_0x25bf('0x1d')]||null:null,'attributes':_0x4bb2c0[_0x25bf('0x17')]?_0x4bb2c0[_0x25bf('0x17')][_0x25bf('0x1e')]||null:null,'limit':_0x4bb2c0[_0x25bf('0x17')]?_0x4bb2c0['options'][_0x25bf('0x1f')]||null:null})[_0x25bf('0x19')](function(_0x116195){logger[_0x25bf('0x11')]('UpdateWhatsappQueueReport',_0x4bb2c0);logger['debug'](_0x25bf('0x1b'),_0x4bb2c0,JSON[_0x25bf('0xd')](_0x116195));_0x385c12(_0x116195);})[_0x25bf('0x13')](function(_0x1b5e9b){logger[_0x25bf('0xe')](_0x25bf('0x1b'),_0x1b5e9b[_0x25bf('0x10')],_0x4bb2c0);_0x5a3e64(_0x1e5d43['error'](0x1f4,_0x1b5e9b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6c69a83..99c4a42 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 _0xce48=['isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x321635,_0x558f65){var _0x2fe292=function(_0x5a9c72){while(--_0x5a9c72){_0x321635['push'](_0x321635['shift']());}};_0x2fe292(++_0x558f65);}(_0xce48,0x1c3));var _0x8ce4=function(_0x5d8e8a,_0x19b690){_0x5d8e8a=_0x5d8e8a-0x0;var _0x13c1bb=_0xce48[_0x5d8e8a];return _0x13c1bb;};'use strict';var multer=require(_0x8ce4('0x0'));var util=require(_0x8ce4('0x1'));var path=require(_0x8ce4('0x2'));var timeout=require(_0x8ce4('0x3'));var express=require(_0x8ce4('0x4'));var router=express[_0x8ce4('0x5')]();var fs_extra=require(_0x8ce4('0x6'));var auth=require(_0x8ce4('0x7'));var interaction=require(_0x8ce4('0x8'));var config=require('../../config/environment');var controller=require(_0x8ce4('0x9'));router[_0x8ce4('0xa')]('/',auth[_0x8ce4('0xb')](),controller[_0x8ce4('0xc')]);router['get'](_0x8ce4('0xd'),auth[_0x8ce4('0xb')](),controller[_0x8ce4('0xe')]);router[_0x8ce4('0xa')](_0x8ce4('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8ce4('0x10')]('/',auth[_0x8ce4('0xb')](),controller[_0x8ce4('0x11')]);router['put']('/:id',auth[_0x8ce4('0xb')](),controller[_0x8ce4('0x12')]);router[_0x8ce4('0x13')](_0x8ce4('0xf'),auth[_0x8ce4('0xb')](),controller[_0x8ce4('0x14')]);module[_0x8ce4('0x15')]=router; \ No newline at end of file +var _0x34b1=['index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x4a9f22,_0x439a61){var _0x2511ff=function(_0x16745f){while(--_0x16745f){_0x4a9f22['push'](_0x4a9f22['shift']());}};_0x2511ff(++_0x439a61);}(_0x34b1,0x7d));var _0x134b=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0x34b1[_0x2595a6];return _0x460197;};'use strict';var multer=require('multer');var util=require(_0x134b('0x0'));var path=require('path');var timeout=require(_0x134b('0x1'));var express=require(_0x134b('0x2'));var router=express[_0x134b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x134b('0x4'));var interaction=require(_0x134b('0x5'));var config=require('../../config/environment');var controller=require(_0x134b('0x6'));router[_0x134b('0x7')]('/',auth['isAuthenticated'](),controller[_0x134b('0x8')]);router[_0x134b('0x7')](_0x134b('0x9'),auth[_0x134b('0xa')](),controller[_0x134b('0xb')]);router[_0x134b('0x7')](_0x134b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x134b('0xd')]('/',auth[_0x134b('0xa')](),controller[_0x134b('0xe')]);router[_0x134b('0xf')](_0x134b('0xc'),auth[_0x134b('0xa')](),controller[_0x134b('0x10')]);router[_0x134b('0x11')](_0x134b('0xc'),auth[_0x134b('0xa')](),controller['destroy']);module[_0x134b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6b4d1cd..58ebf4e 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 _0x0936=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x5600b8,_0x6e0064){var _0x5be2c2=function(_0x304d1f){while(--_0x304d1f){_0x5600b8['push'](_0x5600b8['shift']());}};_0x5be2c2(++_0x6e0064);}(_0x0936,0xde));var _0x6093=function(_0x1d7705,_0x14cb78){_0x1d7705=_0x1d7705-0x0;var _0x3d675e=_0x0936[_0x1d7705];return _0x3d675e;};'use strict';var Sequelize=require(_0x6093('0x0'));module[_0x6093('0x1')]={'uniqueid':{'type':Sequelize[_0x6093('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6093('0x3')](_0x6093('0x4'),_0x6093('0x5'),_0x6093('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2977=['account','agent','queue','DATE','sequelize','STRING','ENUM'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2977,0xa5));var _0x7297=function(_0x5b11ea,_0x3f855b){_0x5b11ea=_0x5b11ea-0x0;var _0x3c7c35=_0x2977[_0x5b11ea];return _0x3c7c35;};'use strict';var Sequelize=require(_0x7297('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7297('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7297('0x2')](_0x7297('0x3'),_0x7297('0x4'),_0x7297('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7297('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index adb3bbc..44ecc02 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 _0x2e3a=['describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappTransferReport','includeAll','include','rows','catch','show','keys','rawAttributes','options','create','body','find','params'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2e3a,0x145));var _0xa2e3=function(_0x3d7bae,_0x568509){_0x3d7bae=_0x3d7bae-0x0;var _0x1d565e=_0x2e3a[_0x3d7bae];return _0x1d565e;};'use strict';var emlformat=require(_0xa2e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2e3('0x2'));var moment=require(_0xa2e3('0x3'));var BPromise=require(_0xa2e3('0x4'));var Mustache=require(_0xa2e3('0x5'));var util=require(_0xa2e3('0x6'));var path=require(_0xa2e3('0x7'));var sox=require(_0xa2e3('0x8'));var csv=require(_0xa2e3('0x9'));var ejs=require(_0xa2e3('0xa'));var fs=require('fs');var fs_extra=require(_0xa2e3('0xb'));var _=require(_0xa2e3('0xc'));var squel=require(_0xa2e3('0xd'));var crypto=require(_0xa2e3('0xe'));var jsforce=require(_0xa2e3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa2e3('0x9'));var querystring=require(_0xa2e3('0x10'));var Papa=require(_0xa2e3('0x11'));var Redis=require('ioredis');var authService=require(_0xa2e3('0x12'));var qs=require(_0xa2e3('0x13'));var as=require(_0xa2e3('0x14'));var hardwareService=require(_0xa2e3('0x15'));var logger=require(_0xa2e3('0x16'))('api');var utils=require(_0xa2e3('0x17'));var config=require(_0xa2e3('0x18'));var licenseUtil=require(_0xa2e3('0x19'));var db=require(_0xa2e3('0x1a'))['db'];function respondWithStatusCode(_0x39c76d,_0x410218){_0x410218=_0x410218||0xcc;return function(_0x2de886){if(_0x2de886){return _0x39c76d['sendStatus'](_0x410218);}return _0x39c76d[_0xa2e3('0x1b')](_0x410218)['end']();};}function respondWithResult(_0x261d8f,_0x339a18){_0x339a18=_0x339a18||0xc8;return function(_0x4fe109){if(_0x4fe109){return _0x261d8f['status'](_0x339a18)[_0xa2e3('0x1c')](_0x4fe109);}};}function respondWithFilteredResult(_0x10eb8b,_0x2e29cb){return function(_0x41e554){if(_0x41e554){var _0x25c1a0=typeof _0x2e29cb[_0xa2e3('0x1d')]==='undefined'&&typeof _0x2e29cb[_0xa2e3('0x1e')]===_0xa2e3('0x1f');var _0x1f449e=_0x41e554[_0xa2e3('0x20')];var _0x3f7370=_0x25c1a0?0x0:_0x2e29cb[_0xa2e3('0x1d')];var _0x3af347=_0x25c1a0?_0x41e554[_0xa2e3('0x20')]:_0x2e29cb[_0xa2e3('0x1d')]+_0x2e29cb['limit'];var _0x2da073;if(_0x3af347>=_0x1f449e){_0x3af347=_0x1f449e;_0x2da073=0xc8;}else{_0x2da073=0xce;}_0x10eb8b[_0xa2e3('0x1b')](_0x2da073);return _0x10eb8b[_0xa2e3('0x21')](_0xa2e3('0x22'),_0x3f7370+'-'+_0x3af347+'/'+_0x1f449e)[_0xa2e3('0x1c')](_0x41e554);}return null;};}function patchUpdates(_0x21b991){return function(_0x42cea5){try{jsonpatch[_0xa2e3('0x23')](_0x42cea5,_0x21b991,!![]);}catch(_0x27137a){return BPromise[_0xa2e3('0x24')](_0x27137a);}return _0x42cea5[_0xa2e3('0x25')]();};}function saveUpdates(_0x1bcb92,_0x4ec75b){return function(_0x5dec4b){if(_0x5dec4b){return _0x5dec4b[_0xa2e3('0x26')](_0x1bcb92)[_0xa2e3('0x27')](function(_0xf32150){return _0xf32150;});}return null;};}function removeEntity(_0x529ef5,_0x382c7d){return function(_0x41ab30){if(_0x41ab30){return _0x41ab30[_0xa2e3('0x28')]()[_0xa2e3('0x27')](function(){_0x529ef5[_0xa2e3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13afa8,_0x490426){return function(_0x519ed7){if(!_0x519ed7){_0x13afa8[_0xa2e3('0x29')](0x194);}return _0x519ed7;};}function handleError(_0x31e036,_0x474f0b){_0x474f0b=_0x474f0b||0x1f4;return function(_0x22eb45){logger[_0xa2e3('0x2a')](_0x22eb45[_0xa2e3('0x2b')]);if(_0x22eb45[_0xa2e3('0x2c')]){delete _0x22eb45[_0xa2e3('0x2c')];}_0x31e036[_0xa2e3('0x1b')](_0x474f0b)[_0xa2e3('0x2d')](_0x22eb45);};}exports[_0xa2e3('0x2e')]=function(_0xcb3d09,_0x10bcb6){var _0x350cd4={},_0x2a86a4={},_0x476cbf={'count':0x0,'rows':[]};var _0x1e46ac=_[_0xa2e3('0x2f')](db['WhatsappTransferReport']['rawAttributes'],function(_0x529cc2){return{'name':_0x529cc2[_0xa2e3('0x30')],'type':_0x529cc2['type'][_0xa2e3('0x31')]};});_0x2a86a4[_0xa2e3('0x32')]=_[_0xa2e3('0x2f')](_0x1e46ac,_0xa2e3('0x2c'));_0x2a86a4[_0xa2e3('0x33')]=_['keys'](_0xcb3d09[_0xa2e3('0x33')]);_0x2a86a4[_0xa2e3('0x34')]=_[_0xa2e3('0x35')](_0x2a86a4['model'],_0x2a86a4['query']);_0x350cd4[_0xa2e3('0x36')]=_[_0xa2e3('0x35')](_0x2a86a4['model'],qs[_0xa2e3('0x37')](_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x37')]));_0x350cd4[_0xa2e3('0x36')]=_0x350cd4[_0xa2e3('0x36')][_0xa2e3('0x38')]?_0x350cd4['attributes']:_0x2a86a4[_0xa2e3('0x32')];if(!_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x39')](_0xa2e3('0x3a'))){_0x350cd4['limit']=qs[_0xa2e3('0x1e')](_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x1e')]);_0x350cd4[_0xa2e3('0x1d')]=qs['offset'](_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x1d')]);}_0x350cd4[_0xa2e3('0x3b')]=qs[_0xa2e3('0x3c')](_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x3c')]);_0x350cd4[_0xa2e3('0x3d')]=qs[_0xa2e3('0x34')](_[_0xa2e3('0x3e')](_0xcb3d09['query'],_0x2a86a4[_0xa2e3('0x34')]),_0x1e46ac);if(_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x3f')]){_0x350cd4[_0xa2e3('0x3d')]=_[_0xa2e3('0x40')](_0x350cd4[_0xa2e3('0x3d')],{'$or':_['map'](_0x1e46ac,function(_0x56b644){if(_0x56b644[_0xa2e3('0x41')]!==_0xa2e3('0x42')){var _0x3434fc={};_0x3434fc[_0x56b644[_0xa2e3('0x2c')]]={'$like':'%'+_0xcb3d09[_0xa2e3('0x33')]['filter']+'%'};return _0x3434fc;}})});}_0x350cd4=_[_0xa2e3('0x40')]({},_0x350cd4,_0xcb3d09['options']);var _0x3a3f14={'where':_0x350cd4[_0xa2e3('0x3d')]};return db[_0xa2e3('0x43')][_0xa2e3('0x20')](_0x3a3f14)[_0xa2e3('0x27')](function(_0x1d6fc3){_0x476cbf[_0xa2e3('0x20')]=_0x1d6fc3;if(_0xcb3d09[_0xa2e3('0x33')][_0xa2e3('0x44')]){_0x350cd4[_0xa2e3('0x45')]=[{'all':!![]}];}return db[_0xa2e3('0x43')]['findAll'](_0x350cd4);})[_0xa2e3('0x27')](function(_0x499102){_0x476cbf[_0xa2e3('0x46')]=_0x499102;return _0x476cbf;})[_0xa2e3('0x27')](respondWithFilteredResult(_0x10bcb6,_0x350cd4))[_0xa2e3('0x47')](handleError(_0x10bcb6,null));};exports[_0xa2e3('0x48')]=function(_0x19474d,_0x27f71a){var _0x4b22d8={'raw':!![],'where':{'id':_0x19474d['params']['id']}},_0x177b35={};_0x177b35[_0xa2e3('0x32')]=_[_0xa2e3('0x49')](db['WhatsappTransferReport'][_0xa2e3('0x4a')]);_0x177b35[_0xa2e3('0x33')]=_[_0xa2e3('0x49')](_0x19474d[_0xa2e3('0x33')]);_0x177b35[_0xa2e3('0x34')]=_[_0xa2e3('0x35')](_0x177b35['model'],_0x177b35['query']);_0x4b22d8['attributes']=_[_0xa2e3('0x35')](_0x177b35[_0xa2e3('0x32')],qs['fields'](_0x19474d['query'][_0xa2e3('0x37')]));_0x4b22d8[_0xa2e3('0x36')]=_0x4b22d8[_0xa2e3('0x36')]['length']?_0x4b22d8[_0xa2e3('0x36')]:_0x177b35[_0xa2e3('0x32')];if(_0x19474d['query'][_0xa2e3('0x44')]){_0x4b22d8[_0xa2e3('0x45')]=[{'all':!![]}];}_0x4b22d8=_['merge']({},_0x4b22d8,_0x19474d[_0xa2e3('0x4b')]);return db['WhatsappTransferReport']['find'](_0x4b22d8)[_0xa2e3('0x27')](handleEntityNotFound(_0x27f71a,null))[_0xa2e3('0x27')](respondWithResult(_0x27f71a,null))[_0xa2e3('0x47')](handleError(_0x27f71a,null));};exports['create']=function(_0xfe61fd,_0x345952){return db[_0xa2e3('0x43')][_0xa2e3('0x4c')](_0xfe61fd[_0xa2e3('0x4d')],{})[_0xa2e3('0x27')](respondWithResult(_0x345952,0xc9))[_0xa2e3('0x47')](handleError(_0x345952,null));};exports['update']=function(_0x11601d,_0x422122){if(_0x11601d[_0xa2e3('0x4d')]['id']){delete _0x11601d[_0xa2e3('0x4d')]['id'];}return db['WhatsappTransferReport'][_0xa2e3('0x4e')]({'where':{'id':_0x11601d[_0xa2e3('0x4f')]['id']}})[_0xa2e3('0x27')](handleEntityNotFound(_0x422122,null))['then'](saveUpdates(_0x11601d['body'],null))[_0xa2e3('0x27')](respondWithResult(_0x422122,null))[_0xa2e3('0x47')](handleError(_0x422122,null));};exports['destroy']=function(_0x29acec,_0x271772){return db['WhatsappTransferReport'][_0xa2e3('0x4e')]({'where':{'id':_0x29acec['params']['id']}})[_0xa2e3('0x27')](handleEntityNotFound(_0x271772,null))[_0xa2e3('0x27')](removeEntity(_0x271772,null))[_0xa2e3('0x47')](handleError(_0x271772,null));};exports[_0xa2e3('0x50')]=function(_0x29017d,_0x10d747){return db[_0xa2e3('0x43')][_0xa2e3('0x50')]()['then'](respondWithResult(_0x10d747,null))[_0xa2e3('0x47')](handleError(_0x10d747,null));}; \ No newline at end of file +var _0x2dd8=['intersection','find','create','body','update','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key','map','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x2dd8,0x143));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require(_0x82dd('0x4'));var Mustache=require(_0x82dd('0x5'));var util=require(_0x82dd('0x6'));var path=require(_0x82dd('0x7'));var sox=require(_0x82dd('0x8'));var csv=require('to-csv');var ejs=require(_0x82dd('0x9'));var fs=require('fs');var fs_extra=require(_0x82dd('0xa'));var _=require(_0x82dd('0xb'));var squel=require(_0x82dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x82dd('0xd'));var deskjs=require(_0x82dd('0xe'));var toCsv=require(_0x82dd('0xf'));var querystring=require(_0x82dd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82dd('0x12'));var hardwareService=require(_0x82dd('0x13'));var logger=require(_0x82dd('0x14'))(_0x82dd('0x15'));var utils=require(_0x82dd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x82dd('0x17'));var db=require(_0x82dd('0x18'))['db'];function respondWithStatusCode(_0x348f79,_0x18b9f6){_0x18b9f6=_0x18b9f6||0xcc;return function(_0x24d045){if(_0x24d045){return _0x348f79['sendStatus'](_0x18b9f6);}return _0x348f79['status'](_0x18b9f6)[_0x82dd('0x19')]();};}function respondWithResult(_0x255abd,_0x6fcc1b){_0x6fcc1b=_0x6fcc1b||0xc8;return function(_0x46beb0){if(_0x46beb0){return _0x255abd[_0x82dd('0x1a')](_0x6fcc1b)[_0x82dd('0x1b')](_0x46beb0);}};}function respondWithFilteredResult(_0x31b9c1,_0x275802){return function(_0x101eb7){if(_0x101eb7){var _0x1b90e0=typeof _0x275802[_0x82dd('0x1c')]===_0x82dd('0x1d')&&typeof _0x275802[_0x82dd('0x1e')]==='undefined';var _0x352400=_0x101eb7[_0x82dd('0x1f')];var _0x34d991=_0x1b90e0?0x0:_0x275802[_0x82dd('0x1c')];var _0x445fa0=_0x1b90e0?_0x101eb7[_0x82dd('0x1f')]:_0x275802[_0x82dd('0x1c')]+_0x275802[_0x82dd('0x1e')];var _0x26373a;if(_0x445fa0>=_0x352400){_0x445fa0=_0x352400;_0x26373a=0xc8;}else{_0x26373a=0xce;}_0x31b9c1[_0x82dd('0x1a')](_0x26373a);return _0x31b9c1[_0x82dd('0x20')](_0x82dd('0x21'),_0x34d991+'-'+_0x445fa0+'/'+_0x352400)[_0x82dd('0x1b')](_0x101eb7);}return null;};}function patchUpdates(_0x5ebea8){return function(_0x45205d){try{jsonpatch[_0x82dd('0x22')](_0x45205d,_0x5ebea8,!![]);}catch(_0x28352e){return BPromise[_0x82dd('0x23')](_0x28352e);}return _0x45205d[_0x82dd('0x24')]();};}function saveUpdates(_0x251b5b,_0x15f5b8){return function(_0x45e92c){if(_0x45e92c){return _0x45e92c['update'](_0x251b5b)['then'](function(_0x1c095e){return _0x1c095e;});}return null;};}function removeEntity(_0x96dbc0,_0x4e1463){return function(_0x59a173){if(_0x59a173){return _0x59a173[_0x82dd('0x25')]()[_0x82dd('0x26')](function(){_0x96dbc0[_0x82dd('0x1a')](0xcc)[_0x82dd('0x19')]();});}};}function handleEntityNotFound(_0x4609c1,_0x1233e4){return function(_0x17eb32){if(!_0x17eb32){_0x4609c1[_0x82dd('0x27')](0x194);}return _0x17eb32;};}function handleError(_0x1ae382,_0x1d27f1){_0x1d27f1=_0x1d27f1||0x1f4;return function(_0xe6aacd){logger[_0x82dd('0x28')](_0xe6aacd[_0x82dd('0x29')]);if(_0xe6aacd[_0x82dd('0x2a')]){delete _0xe6aacd['name'];}_0x1ae382[_0x82dd('0x1a')](_0x1d27f1)[_0x82dd('0x2b')](_0xe6aacd);};}exports[_0x82dd('0x2c')]=function(_0x53965f,_0x15da13){var _0x5238a2={},_0x15f31f={},_0x93fd00={'count':0x0,'rows':[]};var _0x2b4a63=_['map'](db[_0x82dd('0x2d')][_0x82dd('0x2e')],function(_0x47c0ff){return{'name':_0x47c0ff['fieldName'],'type':_0x47c0ff[_0x82dd('0x2f')][_0x82dd('0x30')]};});_0x15f31f['model']=_[_0x82dd('0x31')](_0x2b4a63,_0x82dd('0x2a'));_0x15f31f[_0x82dd('0x32')]=_['keys'](_0x53965f[_0x82dd('0x32')]);_0x15f31f[_0x82dd('0x33')]=_['intersection'](_0x15f31f['model'],_0x15f31f[_0x82dd('0x32')]);_0x5238a2[_0x82dd('0x34')]=_['intersection'](_0x15f31f[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x36')]));_0x5238a2[_0x82dd('0x34')]=_0x5238a2['attributes'][_0x82dd('0x37')]?_0x5238a2[_0x82dd('0x34')]:_0x15f31f['model'];if(!_0x53965f[_0x82dd('0x32')][_0x82dd('0x38')](_0x82dd('0x39'))){_0x5238a2[_0x82dd('0x1e')]=qs['limit'](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1e')]);_0x5238a2[_0x82dd('0x1c')]=qs[_0x82dd('0x1c')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1c')]);}_0x5238a2[_0x82dd('0x3a')]=qs[_0x82dd('0x3b')](_0x53965f['query'][_0x82dd('0x3b')]);_0x5238a2['where']=qs[_0x82dd('0x33')](_[_0x82dd('0x3c')](_0x53965f[_0x82dd('0x32')],_0x15f31f['filters']),_0x2b4a63);if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x3d')]){_0x5238a2[_0x82dd('0x3e')]=_[_0x82dd('0x3f')](_0x5238a2['where'],{'$or':_['map'](_0x2b4a63,function(_0xc3d6d9){if(_0xc3d6d9[_0x82dd('0x2f')]!==_0x82dd('0x40')){var _0x19c736={};_0x19c736[_0xc3d6d9['name']]={'$like':'%'+_0x53965f['query'][_0x82dd('0x3d')]+'%'};return _0x19c736;}})});}_0x5238a2=_[_0x82dd('0x3f')]({},_0x5238a2,_0x53965f['options']);var _0x3a905d={'where':_0x5238a2[_0x82dd('0x3e')]};return db[_0x82dd('0x2d')][_0x82dd('0x1f')](_0x3a905d)[_0x82dd('0x26')](function(_0x104568){_0x93fd00[_0x82dd('0x1f')]=_0x104568;if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x41')]){_0x5238a2[_0x82dd('0x42')]=[{'all':!![]}];}return db[_0x82dd('0x2d')][_0x82dd('0x43')](_0x5238a2);})[_0x82dd('0x26')](function(_0x27cfd6){_0x93fd00[_0x82dd('0x44')]=_0x27cfd6;return _0x93fd00;})[_0x82dd('0x26')](respondWithFilteredResult(_0x15da13,_0x5238a2))[_0x82dd('0x45')](handleError(_0x15da13,null));};exports[_0x82dd('0x46')]=function(_0x41d36,_0x5bcc32){var _0x644d3a={'raw':!![],'where':{'id':_0x41d36['params']['id']}},_0x4cd127={};_0x4cd127[_0x82dd('0x35')]=_[_0x82dd('0x47')](db[_0x82dd('0x2d')]['rawAttributes']);_0x4cd127[_0x82dd('0x32')]=_[_0x82dd('0x47')](_0x41d36[_0x82dd('0x32')]);_0x4cd127[_0x82dd('0x33')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],_0x4cd127['query']);_0x644d3a[_0x82dd('0x34')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x41d36[_0x82dd('0x32')]['fields']));_0x644d3a[_0x82dd('0x34')]=_0x644d3a[_0x82dd('0x34')]['length']?_0x644d3a[_0x82dd('0x34')]:_0x4cd127[_0x82dd('0x35')];if(_0x41d36[_0x82dd('0x32')][_0x82dd('0x41')]){_0x644d3a[_0x82dd('0x42')]=[{'all':!![]}];}_0x644d3a=_[_0x82dd('0x3f')]({},_0x644d3a,_0x41d36['options']);return db[_0x82dd('0x2d')][_0x82dd('0x49')](_0x644d3a)[_0x82dd('0x26')](handleEntityNotFound(_0x5bcc32,null))[_0x82dd('0x26')](respondWithResult(_0x5bcc32,null))['catch'](handleError(_0x5bcc32,null));};exports[_0x82dd('0x4a')]=function(_0x418fd3,_0x3035b8){return db['WhatsappTransferReport']['create'](_0x418fd3[_0x82dd('0x4b')],{})[_0x82dd('0x26')](respondWithResult(_0x3035b8,0xc9))[_0x82dd('0x45')](handleError(_0x3035b8,null));};exports[_0x82dd('0x4c')]=function(_0x208e4f,_0x4ff539){if(_0x208e4f['body']['id']){delete _0x208e4f[_0x82dd('0x4b')]['id'];}return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x208e4f['params']['id']}})['then'](handleEntityNotFound(_0x4ff539,null))[_0x82dd('0x26')](saveUpdates(_0x208e4f['body'],null))[_0x82dd('0x26')](respondWithResult(_0x4ff539,null))[_0x82dd('0x45')](handleError(_0x4ff539,null));};exports[_0x82dd('0x25')]=function(_0x96e9f1,_0x24fa02){return db[_0x82dd('0x2d')][_0x82dd('0x49')]({'where':{'id':_0x96e9f1[_0x82dd('0x4d')]['id']}})[_0x82dd('0x26')](handleEntityNotFound(_0x24fa02,null))['then'](removeEntity(_0x24fa02,null))[_0x82dd('0x45')](handleError(_0x24fa02,null));};exports[_0x82dd('0x4e')]=function(_0x247447,_0x277793){return db[_0x82dd('0x2d')][_0x82dd('0x4e')]()[_0x82dd('0x26')](respondWithResult(_0x277793,null))[_0x82dd('0x45')](handleError(_0x277793,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a32c756..750620e 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 _0xd484=['request-promise','path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','api','bluebird'];(function(_0x24c4cf,_0x4715ed){var _0x1bcc78=function(_0x27326f){while(--_0x27326f){_0x24c4cf['push'](_0x24c4cf['shift']());}};_0x1bcc78(++_0x4715ed);}(_0xd484,0x1de));var _0x4d48=function(_0x5afc9,_0xb14478){_0x5afc9=_0x5afc9-0x0;var _0x42383c=_0xd484[_0x5afc9];return _0x42383c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4d48('0x0'));var moment=require('moment');var BPromise=require(_0x4d48('0x1'));var rp=require(_0x4d48('0x2'));var fs=require('fs');var path=require(_0x4d48('0x3'));var rimraf=require(_0x4d48('0x4'));var config=require('../../config/environment');var attributes=require(_0x4d48('0x5'));module['exports']=function(_0x3d48ed,_0x23b83b){return _0x3d48ed[_0x4d48('0x6')](_0x4d48('0x7'),attributes,{'tableName':_0x4d48('0x8'),'paranoid':![],'indexes':[{'name':_0x4d48('0x9'),'fields':[_0x4d48('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9499=['rimraf','../../config/environment','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9499,0x10a));var _0x9949=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9499[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x9949('0x0'));var util=require(_0x9949('0x1'));var logger=require(_0x9949('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9949('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9949('0x4'));var config=require(_0x9949('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0x9949('0x6')]=function(_0x3c9c90,_0x1103af){return _0x3c9c90[_0x9949('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x9949('0x8'),'paranoid':![],'indexes':[{'name':_0x9949('0x9'),'fields':[_0x9949('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 79fe55b..85514ee 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 _0xab26=['http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x52f4d6,_0x2f4818){var _0xaa4059=function(_0x1ecfb3){while(--_0x1ecfb3){_0x52f4d6['push'](_0x52f4d6['shift']());}};_0xaa4059(++_0x2f4818);}(_0xab26,0x172));var _0x6ab2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xab26[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6ab2('0x0'));var moment=require(_0x6ab2('0x1'));var BPromise=require(_0x6ab2('0x2'));var rs=require(_0x6ab2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ab2('0x4'))['db'];var utils=require(_0x6ab2('0x5'));var logger=require(_0x6ab2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ab2('0x7'));var client=jayson['client'][_0x6ab2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x506fe5,_0x186db1,_0x5b61b3){return new BPromise(function(_0x5a379e,_0x7fdcd4){return client[_0x6ab2('0x9')](_0x506fe5,_0x5b61b3)[_0x6ab2('0xa')](function(_0x2ec959){logger[_0x6ab2('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x186db1,'request\x20sent');logger[_0x6ab2('0xc')](_0x6ab2('0xd'),_0x186db1,_0x6ab2('0xe'),JSON['stringify'](_0x2ec959));if(_0x2ec959[_0x6ab2('0xf')]){if(_0x2ec959['error'][_0x6ab2('0x10')]===0x1f4){logger['error'](_0x6ab2('0x11'),_0x186db1,_0x2ec959[_0x6ab2('0xf')][_0x6ab2('0x12')]);return _0x7fdcd4(_0x2ec959[_0x6ab2('0xf')][_0x6ab2('0x12')]);}logger[_0x6ab2('0xf')](_0x6ab2('0x11'),_0x186db1,_0x2ec959[_0x6ab2('0xf')]['message']);return _0x5a379e(_0x2ec959[_0x6ab2('0xf')][_0x6ab2('0x12')]);}else{logger['info'](_0x6ab2('0x11'),_0x186db1,_0x6ab2('0xe'));_0x5a379e(_0x2ec959[_0x6ab2('0x13')][_0x6ab2('0x12')]);}})[_0x6ab2('0x14')](function(_0x4551aa){logger[_0x6ab2('0xf')](_0x6ab2('0x11'),_0x186db1,_0x4551aa);_0x7fdcd4(_0x4551aa);});});} \ No newline at end of file +var _0xb74c=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4a6462,_0x61b1b5){var _0x122407=function(_0x42618b){while(--_0x42618b){_0x4a6462['push'](_0x4a6462['shift']());}};_0x122407(++_0x61b1b5);}(_0xb74c,0x111));var _0xcb74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb74c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcb74('0x0'));var util=require(_0xcb74('0x1'));var moment=require(_0xcb74('0x2'));var BPromise=require(_0xcb74('0x3'));var rs=require(_0xcb74('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb74('0x6'))(_0xcb74('0x7'));var config=require(_0xcb74('0x8'));var jayson=require(_0xcb74('0x9'));var client=jayson[_0xcb74('0xa')][_0xcb74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd09694,_0x386d01,_0x3ca1bb){return new BPromise(function(_0x411c4d,_0x14cae2){return client[_0xcb74('0xc')](_0xd09694,_0x3ca1bb)[_0xcb74('0xd')](function(_0x287538){logger[_0xcb74('0xe')](_0xcb74('0xf'),_0x386d01,'request\x20sent');logger[_0xcb74('0x10')](_0xcb74('0x11'),_0x386d01,_0xcb74('0x12'),JSON[_0xcb74('0x13')](_0x287538));if(_0x287538[_0xcb74('0x14')]){if(_0x287538[_0xcb74('0x14')][_0xcb74('0x15')]===0x1f4){logger['error'](_0xcb74('0xf'),_0x386d01,_0x287538[_0xcb74('0x14')][_0xcb74('0x16')]);return _0x14cae2(_0x287538[_0xcb74('0x14')]['message']);}logger[_0xcb74('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x386d01,_0x287538[_0xcb74('0x14')][_0xcb74('0x16')]);return _0x411c4d(_0x287538[_0xcb74('0x14')][_0xcb74('0x16')]);}else{logger[_0xcb74('0xe')](_0xcb74('0xf'),_0x386d01,_0xcb74('0x12'));_0x411c4d(_0x287538[_0xcb74('0x17')][_0xcb74('0x16')]);}})[_0xcb74('0x18')](function(_0x31b342){logger[_0xcb74('0x14')](_0xcb74('0xf'),_0x386d01,_0x31b342);_0x14cae2(_0x31b342);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ad33a1c..92de7cd 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63b6=['join','status','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0x492e33,_0x111910){var _0x51be0d=function(_0x4a2ac8){while(--_0x4a2ac8){_0x492e33['push'](_0x492e33['shift']());}};_0x51be0d(++_0x111910);}(_0x63b6,0x127));var _0x663b=function(_0x1fd88b,_0x520877){_0x1fd88b=_0x1fd88b-0x0;var _0x1f996d=_0x63b6[_0x1fd88b];return _0x1f996d;};'use strict';var _=require(_0x663b('0x0'));var db=require(_0x663b('0x1'))['db'];var seedDb=require(_0x663b('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x663b('0x3'));var config=require('./config/environment');var logger=require(_0x663b('0x4'))('app');var pm2=require(_0x663b('0x5'));var pm2Config=require(_0x663b('0x6'));var schedule=require(_0x663b('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x663b('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x663b('0x9'));function main(){return db['sequelize'][_0x663b('0xa')]()[_0x663b('0xb')](function(){if(config[_0x663b('0xc')]){return seedDb[_0x663b('0xd')]();}})[_0x663b('0xb')](function(){return checkLicense[_0x663b('0xd')]();})['then'](function(){return rpc[_0x663b('0xe')]();})[_0x663b('0xb')](function(_0x1d0dba){logger[_0x663b('0xf')](_0x1d0dba);return chat[_0x663b('0x10')]();})[_0x663b('0xb')](function(){return whatsapp[_0x663b('0x10')]();})[_0x663b('0xb')](function(){return schedule[_0x663b('0x10')]();})[_0x663b('0xb')](function(){return transcribe['start']();})['then'](function(){return provider[_0x663b('0x10')]();})[_0x663b('0xb')](function(_0x3baf10){logger[_0x663b('0xf')](_0x3baf10);return pm2[_0x663b('0x10')](pm2Config);})[_0x663b('0xb')](function(_0x4e263a){var _0x18a6da=_0x4e263a[_0x663b('0x11')](function(_0x4738e2){return typeof _0x4738e2[_0x663b('0x12')]===_0x663b('0x13')&&_0x4738e2[_0x663b('0x12')]>=0x0;});if(_0x18a6da[_0x663b('0x14')]>0x0){throw new Error(_0x18a6da[_0x663b('0x14')]+_0x663b('0x15')+_[_0x663b('0x16')](_0x18a6da,function(_0x26a596){return'\x22'+_0x26a596[_0x663b('0x17')][_0x663b('0x18')]+'\x22';}));}logger[_0x663b('0xf')]('Online\x20apps:',_[_0x663b('0x16')](_[_0x663b('0x11')](_0x4e263a,{'status':'online'}),_0x663b('0x18'))[_0x663b('0x19')]());logger['info']('Offline\x20apps:',_[_0x663b('0x16')](_[_0x663b('0x11')](_0x4e263a,function(_0x33a6b9){return _0x33a6b9[_0x663b('0x1a')]!=='online';}),_0x663b('0x18'))[_0x663b('0x19')]()||'None');console['log']('App\x20Ready!');})['catch'](function(_0x37d41d){console[_0x663b('0x1b')](_0x663b('0x1c'),_0x37d41d);logger[_0x663b('0x1d')](_0x663b('0x1e'),_0x37d41d);process[_0x663b('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x9973=['./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','default','then','listen','info','start','filter','exitCode','number','length','pm2_env','Online\x20apps:','map','online','join','Offline\x20apps:','name','App\x20Ready!','catch','log','error','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x59452e,_0x4aed7a){var _0x302b1f=function(_0x47a420){while(--_0x47a420){_0x59452e['push'](_0x59452e['shift']());}};_0x302b1f(++_0x4aed7a);}(_0x9973,0x157));var _0x3997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9973[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var db=require(_0x3997('0x0'))['db'];var seedDb=require(_0x3997('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x3997('0x2'));var config=require(_0x3997('0x3'));var logger=require(_0x3997('0x4'))(_0x3997('0x5'));var pm2=require(_0x3997('0x6'));var pm2Config=require(_0x3997('0x7'));var schedule=require(_0x3997('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3997('0x9'));var provider=require(_0x3997('0xa'));function main(){return db[_0x3997('0xb')]['sync']()['then'](function(){if(config['seedDB']){return seedDb[_0x3997('0xc')]();}})[_0x3997('0xd')](function(){return checkLicense[_0x3997('0xc')]();})[_0x3997('0xd')](function(){return rpc[_0x3997('0xe')]();})[_0x3997('0xd')](function(_0x6ec837){logger[_0x3997('0xf')](_0x6ec837);return chat[_0x3997('0x10')]();})[_0x3997('0xd')](function(){return whatsapp[_0x3997('0x10')]();})[_0x3997('0xd')](function(){return schedule[_0x3997('0x10')]();})[_0x3997('0xd')](function(){return transcribe[_0x3997('0x10')]();})[_0x3997('0xd')](function(){return provider[_0x3997('0x10')]();})[_0x3997('0xd')](function(_0x33fa6b){logger[_0x3997('0xf')](_0x33fa6b);return pm2[_0x3997('0x10')](pm2Config);})[_0x3997('0xd')](function(_0x5fd33b){var _0x58a008=_0x5fd33b[_0x3997('0x11')](function(_0xa39649){return typeof _0xa39649[_0x3997('0x12')]===_0x3997('0x13')&&_0xa39649['exitCode']>=0x0;});if(_0x58a008[_0x3997('0x14')]>0x0){throw new Error(_0x58a008[_0x3997('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x58a008,function(_0x29280d){return'\x22'+_0x29280d[_0x3997('0x15')]['name']+'\x22';}));}logger[_0x3997('0xf')](_0x3997('0x16'),_[_0x3997('0x17')](_[_0x3997('0x11')](_0x5fd33b,{'status':_0x3997('0x18')}),'name')[_0x3997('0x19')]());logger[_0x3997('0xf')](_0x3997('0x1a'),_['map'](_[_0x3997('0x11')](_0x5fd33b,function(_0x1ed237){return _0x1ed237['status']!==_0x3997('0x18');}),_0x3997('0x1b'))[_0x3997('0x19')]()||'None');console['log'](_0x3997('0x1c'));})[_0x3997('0x1d')](function(_0x3f94e5){console[_0x3997('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3f94e5);logger[_0x3997('0x1f')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3f94e5);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 01151af..1a79768 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 _0x7916=['cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','decryptString','split','length','splice','join','promisify','sign','secret','secrets','options','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','session','fullname','email','userpic','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','disposition','status','unmanaged','Forbidden.','headers','authorization','startsWith','find','name','then','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','apikey','getUuid','User','sub','findOne','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','role'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7916,0x128));var _0x6791=function(_0x2c24b8,_0x168e0b){_0x2c24b8=_0x2c24b8-0x0;var _0x563ed6=_0x7916[_0x2c24b8];return _0x563ed6;};'use strict';var db=require(_0x6791('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x6791('0x1'));var licenseUtil=require(_0x6791('0x2'));var encryptor=require('../encryptor');var _=require(_0x6791('0x3'));var jwt=require(_0x6791('0x4'));var expressJwt=require(_0x6791('0x5'));var compose=require(_0x6791('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x6791('0x7'));var BPromise=require('bluebird');var util=require(_0x6791('0x8'));var moment=require(_0x6791('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x6791('0xa')]});var userAttributes=['id','role',_0x6791('0xb'),'name','internal',_0x6791('0xc'),_0x6791('0xd'),'permissions',_0x6791('0xe'),_0x6791('0xf'),_0x6791('0x10'),'mailPause',_0x6791('0x11'),_0x6791('0x12'),_0x6791('0x13'),_0x6791('0x14'),_0x6791('0x15'),_0x6791('0x16'),_0x6791('0x17'),_0x6791('0x18'),_0x6791('0x19'),_0x6791('0x1a'),_0x6791('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x6791('0x1c'),'phoneBarEnableRecording',_0x6791('0x1d'),'phoneBarEnableSettings',_0x6791('0x1e'),_0x6791('0x1f'),'phoneBarRemoteControl',_0x6791('0x20'),'hotdesk',_0x6791('0x21'),_0x6791('0x22'),'privacyEnabled',_0x6791('0x23'),_0x6791('0x24'),'downloadVoiceRecordings',_0x6791('0x25'),'downloadAttachments',_0x6791('0x26'),_0x6791('0x27'),_0x6791('0x28'),_0x6791('0x29'),_0x6791('0x2a'),_0x6791('0x2b'),_0x6791('0x2c'),'smsAutoanswerDelay',_0x6791('0x2d'),_0x6791('0x2e'),'faxAutoanswer',_0x6791('0x2f'),_0x6791('0x30'),'whatsappAutoanswerDelay',_0x6791('0x31')];exports[_0x6791('0x32')]=function(){return this[_0x6791('0x33')](!![])[_0x6791('0x34')](function(_0x56ad28,_0x3e17b3,_0x1b516d){if(_0x56ad28['user']){_0x1b516d();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x56ad28[_0x6791('0x35')]['id']},'attributes':['id','closed',_0x6791('0x36')],'raw':!![]})['then'](function(_0x54a092){if(_0x54a092&&_0x54a092['closed']){return _0x3e17b3[_0x6791('0x37')](_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?0x195:0x193)['json']({'message':_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?'Unmanaged.':_0x6791('0x39')});}else{_0x1b516d();}})['catch'](function(_0x424b0e){_0x1b516d(_0x424b0e);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4fc5d5){return compose()[_0x6791('0x34')](function(_0x551718,_0x2f56a2,_0x34b006){var _0x483d6c;if(_0x551718[_0x6791('0x3a')][_0x6791('0x3b')]){if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')]['authorization'],'Basic')){var _0x348b9c=basicAuth(_0x551718);db['User'][_0x6791('0x3d')]({'where':{'name':_0x348b9c[_0x6791('0x3e')]}})[_0x6791('0x3f')](function(_0x2b98b8){if(!_0x2b98b8||!_0x2b98b8[_0x6791('0x40')](_0x348b9c[_0x6791('0x41')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x43')});}_0x551718[_0x6791('0x44')]={'id':_0x2b98b8['id']};_0x34b006();})['catch'](function(_0x28b3d4){_0x34b006(_0x28b3d4);});}else if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')][_0x6791('0x3b')],_0x6791('0x45'))){validateJwt(_0x551718,_0x2f56a2,_0x34b006);}else{if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x551718['query'][_0x6791('0x46')]){try{var _0x21a9cf={'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x551718['query'][_0x6791('0x46')],_0x21a9cf)[_0x6791('0x3f')](function(_0x31a525){return db[_0x6791('0x48')]['find']({'where':{'id':_0x31a525[_0x6791('0x49')]}})[_0x6791('0x3f')](function(_0x2068a5){_0x483d6c=_0x2068a5;return db['Setting'][_0x6791('0x4a')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6791('0x3f')](function(_0x1803ab){if(!_0x483d6c||!_['isEqual'](_0x483d6c[_0x6791('0x4b')],_0x31a525[_0x6791('0x4c')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4d')});}if(_0x483d6c['disabled']){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}if(_0x483d6c['blocked']){if(_0x1803ab[_0x6791('0x4f')]>0x0){if(moment(_0x483d6c[_0x6791('0x50')])[_0x6791('0x51')](_0x1803ab['blockDuration'],_0x6791('0x52'))>moment()){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}else{return _0x2f56a2['status'](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}_0x551718[_0x6791('0x44')]={'id':_0x483d6c['id']};_0x34b006();});})[_0x6791('0x53')](function(){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});});}catch(_0xae0e07){_0x34b006(_0xae0e07);}}else if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x6791('0x34')](function(_0xe11675,_0x5900b6,_0x39dcb7){if(_0xe11675[_0x6791('0x44')]){db[_0x6791('0x48')][_0x6791('0x3d')]({'where':{'id':_0xe11675[_0x6791('0x44')]['id']},'attributes':userAttributes})[_0x6791('0x3f')](function(_0x44e0ba){if(!_0x44e0ba){return _0x5900b6['status'](0x194)[_0x6791('0x42')]({'message':'User\x20not\x20found.'});}_0xe11675[_0x6791('0x44')]=_0x44e0ba;_0x39dcb7();})[_0x6791('0x53')](function(_0x16f26c){_0x39dcb7(_0x16f26c);});}else if(_0x4fc5d5){_0x39dcb7();}else{return _0x5900b6[_0x6791('0x37')](0x194)['json']({'message':_0x6791('0x54')});}});};exports[_0x6791('0x55')]=function canUpdate(){return compose()[_0x6791('0x34')](function(_0x3251e9,_0x5a7fb6,_0x1763d8){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x57e39f){if(_0x57e39f[_0x6791('0x57')]){_0x1763d8();}else{return _0x5a7fb6[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})['catch'](function(_0x3e5e29){_0x1763d8(_0x3e5e29);});});};exports[_0x6791('0x59')]=function isWebrtcLicence(){return compose()['use'](function(_0x1ac964,_0x54ef7b,_0x38b6b5){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x3ddccc){if(_0x3ddccc[_0x6791('0x5a')]){_0x38b6b5();}else{return _0x54ef7b[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})[_0x6791('0x53')](function(_0x5cfa40){_0x38b6b5(_0x5cfa40);});});};exports[_0x6791('0x5b')]=function(_0x599f23,_0x10e806,_0x2bb86a){_0x599f23[_0x6791('0x5b')]=!![];return _0x2bb86a();};exports[_0x6791('0x5c')]=function signToken(_0x6ab7f6){return signJwt(_0x6ab7f6);};exports['setTokenCookie']=function(_0x2bc08d,_0x35e087){if(!_0x2bc08d[_0x6791('0x44')]){return _0x35e087[_0x6791('0x37')](0x194)[_0x6791('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1a902c={'payload':{'id':_0x2bc08d[_0x6791('0x44')]['id'],'role':_0x2bc08d['user'][_0x6791('0x5d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1a902c)['then'](function(_0x3d4b7e){_0x35e087[_0x6791('0x5e')](_0x6791('0x5f'),_0x3d4b7e);_0x35e087[_0x6791('0x60')]('/dashboards/general');})[_0x6791('0x53')](function(_0x243faf){return _0x35e087['status'](0x1f4)[_0x6791('0x61')](_0x243faf);});};exports[_0x6791('0x62')]=function(_0x3a895b){if(_['isNil'](_0x3a895b[_0x6791('0x4b')])||_[_0x6791('0x63')](_0x3a895b['apiKeyIat'])){return null;}else{return createJwt(_0x3a895b);}};exports[_0x6791('0x64')]=function(_0x2cec8d){_0x2cec8d['apiKeyNonce']=generateNonce();_0x2cec8d[_0x6791('0x65')]=generateIssuedAt();return createJwt(_0x2cec8d);};exports[_0x6791('0x66')]=function(_0x1b0bb1,_0x285bfd){var _0x582d50=_0x1b0bb1[_0x6791('0x67')][_0x6791('0x46')];if(_0x582d50){var _0x32f36b={'nonce':_0x285bfd['apiKeyNonce'],'iat':_0x285bfd['apiKeyIat'],'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf[_0x6791('0x47')]()};return verifyJwt(_0x582d50,_0x32f36b)[_0x6791('0x3f')](function(){return generateApiKey(_0x285bfd);});}else{throw{'message':_0x6791('0x68')};}};exports[_0x6791('0x69')]=function(_0x53b651){var _0x54da93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x54da93[_0x6791('0x6a')](_0x53b651))throw new db['Sequelize']['ValidationError'](_0x6791('0x6b'));return;};exports[_0x6791('0x6c')]=function(_0x2cb48e,_0x10b41b,_0x13089d){var _0x220cb1=encryptor['decryptString'](_0x10b41b)['split'](',');for(var _0x40649c=0x0;_0x40649c<_0x13089d;_0x40649c++){if(!_0x220cb1[_0x40649c])break;if(_0x2cb48e[_0x6791('0x6d')]()===_0x220cb1[_0x40649c]['toLowerCase']()){var _0x44b1df=util['format'](_0x6791('0x6e'),_0x13089d);if(_0x13089d===0x1){_0x44b1df=_0x6791('0x6f');}throw new db['Sequelize'][(_0x6791('0x70'))](_0x44b1df);}}return;};exports[_0x6791('0x71')]=function(_0x3fd984,_0x49ed65){var _0x3ba679=_0x49ed65?encryptor[_0x6791('0x72')](_0x49ed65)[_0x6791('0x73')](','):[];if(_0x3ba679[_0x6791('0x74')]===0x5){_0x3ba679[_0x6791('0x75')](-0x1,0x1);}_0x3ba679['unshift'](_0x3fd984);return encryptor['encryptString'](_0x3ba679[_0x6791('0x76')](','));};function signJwt(_0x13430e){var _0x5d2668=BPromise[_0x6791('0x77')](jwt[_0x6791('0x78')],{'context':jwt});var _0x66f6b4=_0x13430e[_0x6791('0x79')]||config[_0x6791('0x7a')][_0x6791('0xa')];return new BPromise(function(_0x33ac65,_0xb79679){_0x5d2668(_0x13430e['payload'],_0x66f6b4,_0x13430e[_0x6791('0x7b')])[_0x6791('0x3f')](function(_0x36b81e){_0x33ac65(_0x36b81e);})[_0x6791('0x53')](function(_0x548084){_0xb79679(_0x548084);});});}function verifyJwt(_0x16dff7,_0x10c7f3,_0xa8a8dd){var _0x5ca809=BPromise[_0x6791('0x77')](jwt[_0x6791('0x7c')],{'context':jwt});var _0x99d4ee=_0xa8a8dd||config[_0x6791('0x7a')]['session'];return new BPromise(function(_0x2c834f,_0x2843fb){_0x5ca809(_0x16dff7,_0x99d4ee,_0x10c7f3)['then'](function(_0x1114d4){_0x2c834f(_0x1114d4);})[_0x6791('0x53')](function(_0x215a63){_0x2843fb(_0x215a63);});});}function generateNonce(){return crypto[_0x6791('0x7d')](0x10)[_0x6791('0x7e')](_0x6791('0x7f'));}function generateIssuedAt(){return Math['floor'](Date[_0x6791('0x80')]()/0x3e8)[_0x6791('0x7e')]();}function createJwt(_0xf76291){var _0x547287={'payload':{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291['apiKeyNonce']},'options':{'algorithm':_0x6791('0x81'),'subject':_0xf76291['id'][_0x6791('0x7e')](),'issuer':hardwareConf[_0x6791('0x47')](),'audience':hardwareConf[_0x6791('0x47')]()}};return signJwt(_0x547287)[_0x6791('0x3f')](function(_0x4a6bb8){return{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291[_0x6791('0x4b')],'token':_0x4a6bb8};});} \ No newline at end of file +var _0x1775=['isEqual','apiKeyNonce','nonce','status','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','use','User\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','then','Setting','allowedLoginAttempts','blockDuration'];(function(_0x37a919,_0x442ab9){var _0x511515=function(_0x5f15ec){while(--_0x5f15ec){_0x37a919['push'](_0x37a919['shift']());}};_0x511515(++_0x442ab9);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5177('0x0'));var hardwareConf=require(_0x5177('0x1'));var licenseUtil=require(_0x5177('0x2'));var encryptor=require(_0x5177('0x3'));var _=require(_0x5177('0x4'));var jwt=require(_0x5177('0x5'));var expressJwt=require(_0x5177('0x6'));var compose=require(_0x5177('0x7'));var basicAuth=require(_0x5177('0x8'));var crypto=require(_0x5177('0x9'));var BPromise=require(_0x5177('0xa'));var util=require(_0x5177('0xb'));var moment=require(_0x5177('0xc'));var validateJwt=expressJwt({'secret':config[_0x5177('0xd')][_0x5177('0xe')]});var userAttributes=['id',_0x5177('0xf'),_0x5177('0x10'),_0x5177('0x11'),_0x5177('0x12'),_0x5177('0x13'),_0x5177('0x14'),_0x5177('0x15'),'md5secret','voicePause',_0x5177('0x16'),_0x5177('0x17'),_0x5177('0x18'),_0x5177('0x19'),_0x5177('0x1a'),'pauseType',_0x5177('0x1b'),_0x5177('0x1c'),_0x5177('0x1d'),_0x5177('0x1e'),_0x5177('0x1f'),_0x5177('0x20'),_0x5177('0x21'),_0x5177('0x22'),_0x5177('0x23'),_0x5177('0x24'),_0x5177('0x25'),_0x5177('0x26'),_0x5177('0x27'),_0x5177('0x28'),_0x5177('0x29'),_0x5177('0x2a'),_0x5177('0x2b'),_0x5177('0x2c'),_0x5177('0x2d'),'userProfileId',_0x5177('0x2e'),_0x5177('0x2f'),_0x5177('0x30'),_0x5177('0x31'),'downloadOmnichannelInteractions',_0x5177('0x32'),_0x5177('0x33'),_0x5177('0x34'),'chatAutoanswer',_0x5177('0x35'),'emailAutoanswer',_0x5177('0x36'),_0x5177('0x37'),_0x5177('0x38'),_0x5177('0x39'),_0x5177('0x3a'),_0x5177('0x3b'),_0x5177('0x3c'),_0x5177('0x3d'),_0x5177('0x3e'),_0x5177('0x3f')];exports[_0x5177('0x40')]=function(){return this[_0x5177('0x41')](!![])['use'](function(_0x3dcea1,_0x556f96,_0x30b60f){if(_0x3dcea1[_0x5177('0x42')]){_0x30b60f();}else{return db[_0x5177('0x43')][_0x5177('0x44')]({'where':{'id':_0x3dcea1['params']['id']},'attributes':['id',_0x5177('0x45'),'disposition'],'raw':!![]})['then'](function(_0x19a0c2){if(_0x19a0c2&&_0x19a0c2[_0x5177('0x45')]){return _0x556f96['status'](_0x19a0c2[_0x5177('0x46')]==='unmanaged'?0x195:0x193)[_0x5177('0x47')]({'message':_0x19a0c2[_0x5177('0x46')]==='unmanaged'?_0x5177('0x48'):_0x5177('0x49')});}else{_0x30b60f();}})[_0x5177('0x4a')](function(_0x7f86e){_0x30b60f(_0x7f86e);});}});};exports[_0x5177('0x41')]=function isAuthenticated(_0x1cef5d){return compose()['use'](function(_0x498fcd,_0x45cf20,_0x1c660e){var _0x7dae59;if(_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')]){if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],'Basic')){var _0x42e1db=basicAuth(_0x498fcd);db[_0x5177('0x4e')]['find']({'where':{'name':_0x42e1db[_0x5177('0x11')]}})['then'](function(_0x172b36){if(!_0x172b36||!_0x172b36[_0x5177('0x4f')](_0x42e1db[_0x5177('0x50')])){return _0x45cf20['status'](0x191)['json']({'message':_0x5177('0x51')});}_0x498fcd[_0x5177('0x42')]={'id':_0x172b36['id']};_0x1c660e();})[_0x5177('0x4a')](function(_0x3735e9){_0x1c660e(_0x3735e9);});}else if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],_0x5177('0x52'))){validateJwt(_0x498fcd,_0x45cf20,_0x1c660e);}else{if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}}}else if(_0x498fcd['query'][_0x5177('0x54')]){try{var _0x2a26fc={'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf[_0x5177('0x55')]()};verifyJwt(_0x498fcd[_0x5177('0x56')][_0x5177('0x54')],_0x2a26fc)['then'](function(_0x40c607){return db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x40c607[_0x5177('0x58')]}})[_0x5177('0x59')](function(_0xacaa96){_0x7dae59=_0xacaa96;return db[_0x5177('0x5a')]['findOne']({'where':{'id':0x1},'attributes':[_0x5177('0x5b'),_0x5177('0x5c')],'raw':!![]});})['then'](function(_0x486dd5){if(!_0x7dae59||!_[_0x5177('0x5d')](_0x7dae59[_0x5177('0x5e')],_0x40c607[_0x5177('0x5f')])){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x61')});}if(_0x7dae59[_0x5177('0x62')]){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}if(_0x7dae59[_0x5177('0x64')]){if(_0x486dd5[_0x5177('0x5c')]>0x0){if(moment(_0x7dae59[_0x5177('0x65')])['add'](_0x486dd5[_0x5177('0x5c')],_0x5177('0x66'))>moment()){return _0x45cf20['status'](0x191)[_0x5177('0x47')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}}_0x498fcd['user']={'id':_0x7dae59['id']};_0x1c660e();});})['catch'](function(){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});});}catch(_0x177c4b){_0x1c660e(_0x177c4b);}}else if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}})[_0x5177('0x67')](function(_0x4e287e,_0xe1c75c,_0x51ecc0){if(_0x4e287e['user']){db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x4e287e['user']['id']},'attributes':userAttributes})[_0x5177('0x59')](function(_0x508178){if(!_0x508178){return _0xe1c75c['status'](0x194)[_0x5177('0x47')]({'message':_0x5177('0x68')});}_0x4e287e[_0x5177('0x42')]=_0x508178;_0x51ecc0();})[_0x5177('0x4a')](function(_0x191973){_0x51ecc0(_0x191973);});}else if(_0x1cef5d){_0x51ecc0();}else{return _0xe1c75c[_0x5177('0x60')](0x194)[_0x5177('0x47')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x5177('0x67')](function(_0x511dc0,_0x23be2a,_0x3476d3){return licenseUtil[_0x5177('0x69')]()[_0x5177('0x59')](function(_0x570812){if(_0x570812[_0x5177('0x6a')]){_0x3476d3();}else{return _0x23be2a[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})[_0x5177('0x4a')](function(_0x10b370){_0x3476d3(_0x10b370);});});};exports[_0x5177('0x6c')]=function isWebrtcLicence(){return compose()[_0x5177('0x67')](function(_0x1ada68,_0x296a98,_0x3fec49){return licenseUtil['getLicense']()[_0x5177('0x59')](function(_0x481bda){if(_0x481bda['webrtc']){_0x3fec49();}else{return _0x296a98['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})['catch'](function(_0x326405){_0x3fec49(_0x326405);});});};exports[_0x5177('0x6d')]=function(_0x208483,_0x4891fe,_0x1d4ae4){_0x208483['isMiddleware']=!![];return _0x1d4ae4();};exports['signToken']=function signToken(_0x5bd97b){return signJwt(_0x5bd97b);};exports[_0x5177('0x6e')]=function(_0x37d5dd,_0x1300d7){if(!_0x37d5dd['user']){return _0x1300d7['status'](0x194)[_0x5177('0x47')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x262ac4={'payload':{'id':_0x37d5dd[_0x5177('0x42')]['id'],'role':_0x37d5dd[_0x5177('0x42')][_0x5177('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x262ac4)[_0x5177('0x59')](function(_0xa0edd7){_0x1300d7[_0x5177('0x6f')](_0x5177('0x70'),_0xa0edd7);_0x1300d7[_0x5177('0x71')](_0x5177('0x72'));})[_0x5177('0x4a')](function(_0xb08267){return _0x1300d7[_0x5177('0x60')](0x1f4)['send'](_0xb08267);});};exports['retrieveApiKey']=function(_0x29ff0f){if(_['isNil'](_0x29ff0f[_0x5177('0x5e')])||_['isNil'](_0x29ff0f[_0x5177('0x73')])){return null;}else{return createJwt(_0x29ff0f);}};exports[_0x5177('0x74')]=function(_0x1e838a){_0x1e838a['apiKeyNonce']=generateNonce();_0x1e838a['apiKeyIat']=generateIssuedAt();return createJwt(_0x1e838a);};exports[_0x5177('0x75')]=function(_0x43b5b9,_0x2eb560){var _0xcc37fb=_0x43b5b9['query']['apikey'];if(_0xcc37fb){var _0x3f0e89={'nonce':_0x2eb560[_0x5177('0x5e')],'iat':_0x2eb560[_0x5177('0x73')],'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xcc37fb,_0x3f0e89)[_0x5177('0x59')](function(){return generateApiKey(_0x2eb560);});}else{throw{'message':_0x5177('0x76')};}};exports[_0x5177('0x77')]=function(_0x589da8){var _0x2b39ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2b39ba[_0x5177('0x78')](_0x589da8))throw new db[(_0x5177('0x79'))]['ValidationError'](_0x5177('0x7a'));return;};exports['validatePasswordHistory']=function(_0x40dfd6,_0x39fb92,_0x3268bd){var _0x5101fc=encryptor[_0x5177('0x7b')](_0x39fb92)[_0x5177('0x7c')](',');for(var _0xea44e=0x0;_0xea44e<_0x3268bd;_0xea44e++){if(!_0x5101fc[_0xea44e])break;if(_0x40dfd6[_0x5177('0x7d')]()===_0x5101fc[_0xea44e][_0x5177('0x7d')]()){var _0x74589e=util[_0x5177('0x7e')](_0x5177('0x7f'),_0x3268bd);if(_0x3268bd===0x1){_0x74589e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x74589e);}}return;};exports[_0x5177('0x80')]=function(_0x18222f,_0x35aa22){var _0x75cc0e=_0x35aa22?encryptor[_0x5177('0x7b')](_0x35aa22)[_0x5177('0x7c')](','):[];if(_0x75cc0e['length']===0x5){_0x75cc0e['splice'](-0x1,0x1);}_0x75cc0e[_0x5177('0x81')](_0x18222f);return encryptor[_0x5177('0x82')](_0x75cc0e[_0x5177('0x83')](','));};function signJwt(_0x336017){var _0x123d40=BPromise[_0x5177('0x84')](jwt[_0x5177('0x85')],{'context':jwt});var _0xd9c1db=_0x336017[_0x5177('0x86')]||config['secrets'][_0x5177('0xe')];return new BPromise(function(_0x25a0be,_0x57e199){_0x123d40(_0x336017[_0x5177('0x87')],_0xd9c1db,_0x336017[_0x5177('0x88')])['then'](function(_0x69c264){_0x25a0be(_0x69c264);})[_0x5177('0x4a')](function(_0x11a63c){_0x57e199(_0x11a63c);});});}function verifyJwt(_0x4be4b2,_0x23b246,_0x400e27){var _0x5f5bd5=BPromise['promisify'](jwt[_0x5177('0x89')],{'context':jwt});var _0x4f76d7=_0x400e27||config[_0x5177('0xd')]['session'];return new BPromise(function(_0x2771fa,_0x16f17c){_0x5f5bd5(_0x4be4b2,_0x4f76d7,_0x23b246)['then'](function(_0x2af938){_0x2771fa(_0x2af938);})[_0x5177('0x4a')](function(_0x1975a3){_0x16f17c(_0x1975a3);});});}function generateNonce(){return crypto[_0x5177('0x8a')](0x10)[_0x5177('0x8b')](_0x5177('0x8c'));}function generateIssuedAt(){return Math[_0x5177('0x8d')](Date['now']()/0x3e8)[_0x5177('0x8b')]();}function createJwt(_0x54aabd){var _0x54c301={'payload':{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')]},'options':{'algorithm':'HS512','subject':_0x54aabd['id'][_0x5177('0x8b')](),'issuer':hardwareConf[_0x5177('0x55')](),'audience':hardwareConf[_0x5177('0x55')]()}};return signJwt(_0x54c301)[_0x5177('0x59')](function(_0x19b587){return{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')],'token':_0x19b587};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ffdb3fe..8dd7074 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 _0x3a8f=['CmContact','describe','CmCustomField','slice','all','cf_','fieldType','type','map','keys','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','default','where','filter','clause','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch'];(function(_0x149417,_0x5cd2a2){var _0x4fe57f=function(_0x2b66d4){while(--_0x2b66d4){_0x149417['push'](_0x149417['shift']());}};_0x4fe57f(++_0x5cd2a2);}(_0x3a8f,0x12a));var _0xf3a8=function(_0x2a4757,_0x711832){_0x2a4757=_0x2a4757-0x0;var _0x359d84=_0x3a8f[_0x2a4757];return _0x359d84;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf3a8('0x0'));var db=require(_0xf3a8('0x1'))['db'];exports['findAll']=function(_0x14dd3d,_0x23dc50,_0x1fa4b4,_0x53226b){var _0x3eb5e7={'count':0x0,'rows':[]};var _0x18ed55=sqlUtils[_0xf3a8('0x2')](_0x23dc50,_0x14dd3d);if(_0x18ed55){return Promise[_0xf3a8('0x3')](_0x3eb5e7);}var _0x10262f=sqlUtils[_0xf3a8('0x4')]();var _0x32b055={};var _0x3d1ea1=![];var _0x3bb114=![];return Promise[_0xf3a8('0x3')]()[_0xf3a8('0x5')](function(){if(_0x14dd3d['search']){return sqlUtils[_0xf3a8('0x6')](_0x14dd3d[_0xf3a8('0x7')],_0x53226b);}else{return sqlUtils[_0xf3a8('0x8')](_0x14dd3d,_0x53226b);}})[_0xf3a8('0x5')](function(_0x1e1155){_0x10262f['where'](_0x1e1155[_0xf3a8('0x9')]);_0x10262f[_0xf3a8('0xa')](_0x1e1155['fields']);_0x10262f[_0xf3a8('0xa')](_0x1e1155[_0xf3a8('0xb')]);_0x10262f[_0xf3a8('0xa')](_0x1e1155['user'][_0xf3a8('0xc')]);_0x32b055=_0x1e1155['tags'];_0x3bb114=_0x1e1155['user']['skip'];return sqlUtils[_0xf3a8('0xd')](_0x23dc50,_0x14dd3d,_0x3bb114);})[_0xf3a8('0x5')](function(_0x2c7461){_0x10262f[_0xf3a8('0xa')](_0x2c7461);var _0x1bba93=_0x14dd3d[_0xf3a8('0x7')]?_0x32b055[_0xf3a8('0xe')]:_0x14dd3d[_0xf3a8('0xf')];_0x3d1ea1=_0x1bba93?!![]:![];return sqlUtils[_0xf3a8('0x10')](_0x10262f,_0x1bba93);})[_0xf3a8('0x5')](function(_0xd4f4ba){_0x3eb5e7['count']=_0xd4f4ba;if(_0x3eb5e7[_0xf3a8('0x11')]===0x0){return;}if(_0x14dd3d['User']){_0x3bb114=!![];}return sqlUtils[_0xf3a8('0x12')](_0x10262f,_0x14dd3d['fields'],_0x1fa4b4,_0x3d1ea1,_0x32b055[_0xf3a8('0xc')],_0x3bb114);})[_0xf3a8('0x5')](function(_0x5771ab){if(!_0x5771ab){return[];}return sqlUtils[_0xf3a8('0x13')](_0x5771ab,_0x14dd3d,_0x1fa4b4);})['then'](function(_0x4d99e2){_0x3eb5e7[_0xf3a8('0x14')]=_0x4d99e2;return _0x3eb5e7;})[_0xf3a8('0x15')](function(_0x4d714){throw _0x4d714;});};exports['describe']=function(){var _0xf13b4e={};var _0x1f9796=[];return db[_0xf3a8('0x16')][_0xf3a8('0x17')]()['then'](function(_0x420dd3){_0xf13b4e=_0x420dd3;var _0x35d15c=Object['keys'](_0xf13b4e)[_0xf3a8('0xb')](function(_0x3ba602){return _['startsWith'](_0x3ba602,'cf_')?_0x3ba602:undefined;});var _0x18ae36=_0x35d15c['map'](function(_0x3e332a){return db[_0xf3a8('0x18')]['findOne']({'where':{'id':_0x3e332a[_0xf3a8('0x19')](0x3)},'raw':!![]});});return Promise[_0xf3a8('0x1a')](_0x18ae36);})[_0xf3a8('0x5')](function(_0x114ee3){for(var _0x257afe=0x0;_0x257afe<_0x114ee3['length'];_0x257afe++){if(_0x114ee3[_0x257afe]){var _0xe4cdaa=_0xf3a8('0x1b')+_0x114ee3[_0x257afe]['id'];_0xf13b4e[_0xe4cdaa][_0xf3a8('0x1c')]=_0x114ee3[_0x257afe][_0xf3a8('0x1d')];}}_0x1f9796=_[_0xf3a8('0x1e')](Object[_0xf3a8('0x1f')](_0xf13b4e),function(_0x253f3f){return{'name':_0x253f3f,'type':_0xf13b4e[_0x253f3f][_0xf3a8('0x1d')]};});return _0x1f9796;})[_0xf3a8('0x15')](function(_0x4b1203){throw _0x4b1203;});}; \ No newline at end of file +var _0x3e58=['user','clause','tags','skip','then','ids','countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','search','parseQueryParameters','where','default','filter'];(function(_0x8db734,_0x2c68fd){var _0x4f884e=function(_0x51ce8c){while(--_0x51ce8c){_0x8db734['push'](_0x8db734['shift']());}};_0x4f884e(++_0x2c68fd);}(_0x3e58,0xea));var _0x83e5=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0x3e58[_0x169e53];return _0x252bb3;};'use strict';var _=require(_0x83e5('0x0'));var sqlUtils=require(_0x83e5('0x1'));var db=require(_0x83e5('0x2'))['db'];exports[_0x83e5('0x3')]=function(_0x44ba3b,_0x523470,_0x4eae8e,_0x50db2a){var _0x24b9d3={'count':0x0,'rows':[]};var _0x2fdbac=sqlUtils[_0x83e5('0x4')](_0x523470,_0x44ba3b);if(_0x2fdbac){return Promise['resolve'](_0x24b9d3);}var _0x3ffc53=sqlUtils[_0x83e5('0x5')]();var _0x54cc91={};var _0x3d7a29=![];var _0x2d9639=![];return Promise['resolve']()['then'](function(){if(_0x44ba3b[_0x83e5('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x44ba3b[_0x83e5('0x6')],_0x50db2a);}else{return sqlUtils[_0x83e5('0x7')](_0x44ba3b,_0x50db2a);}})['then'](function(_0x3bca7b){_0x3ffc53[_0x83e5('0x8')](_0x3bca7b[_0x83e5('0x9')]);_0x3ffc53[_0x83e5('0x8')](_0x3bca7b['fields']);_0x3ffc53[_0x83e5('0x8')](_0x3bca7b[_0x83e5('0xa')]);_0x3ffc53[_0x83e5('0x8')](_0x3bca7b[_0x83e5('0xb')][_0x83e5('0xc')]);_0x54cc91=_0x3bca7b[_0x83e5('0xd')];_0x2d9639=_0x3bca7b['user'][_0x83e5('0xe')];return sqlUtils['checkListsRestrictions'](_0x523470,_0x44ba3b,_0x2d9639);})[_0x83e5('0xf')](function(_0x2f6b9d){_0x3ffc53[_0x83e5('0x8')](_0x2f6b9d);var _0x161d5a=_0x44ba3b[_0x83e5('0x6')]?_0x54cc91[_0x83e5('0x10')]:_0x44ba3b['tag'];_0x3d7a29=_0x161d5a?!![]:![];return sqlUtils[_0x83e5('0x11')](_0x3ffc53,_0x161d5a);})['then'](function(_0x53710b){_0x24b9d3['count']=_0x53710b;if(_0x24b9d3[_0x83e5('0x12')]===0x0){return;}if(_0x44ba3b['User']){_0x2d9639=!![];}return sqlUtils[_0x83e5('0x13')](_0x3ffc53,_0x44ba3b[_0x83e5('0x14')],_0x4eae8e,_0x3d7a29,_0x54cc91[_0x83e5('0xc')],_0x2d9639);})[_0x83e5('0xf')](function(_0xc238aa){if(!_0xc238aa){return[];}return sqlUtils[_0x83e5('0x15')](_0xc238aa,_0x44ba3b,_0x4eae8e);})[_0x83e5('0xf')](function(_0x5a6cbe){_0x24b9d3[_0x83e5('0x16')]=_0x5a6cbe;return _0x24b9d3;})[_0x83e5('0x17')](function(_0x52de5a){throw _0x52de5a;});};exports[_0x83e5('0x18')]=function(){var _0x32da30={};var _0xec9dfa=[];return db[_0x83e5('0x19')][_0x83e5('0x18')]()[_0x83e5('0xf')](function(_0x4c84f6){_0x32da30=_0x4c84f6;var _0x2cc6a3=Object[_0x83e5('0x1a')](_0x32da30)['filter'](function(_0x2a268f){return _['startsWith'](_0x2a268f,_0x83e5('0x1b'))?_0x2a268f:undefined;});var _0x2f5f26=_0x2cc6a3[_0x83e5('0x1c')](function(_0xb8cb47){return db[_0x83e5('0x1d')]['findOne']({'where':{'id':_0xb8cb47[_0x83e5('0x1e')](0x3)},'raw':!![]});});return Promise[_0x83e5('0x1f')](_0x2f5f26);})['then'](function(_0x245f4a){for(var _0x30fcc6=0x0;_0x30fcc6<_0x245f4a[_0x83e5('0x20')];_0x30fcc6++){if(_0x245f4a[_0x30fcc6]){var _0x23a468='cf_'+_0x245f4a[_0x30fcc6]['id'];_0x32da30[_0x23a468][_0x83e5('0x21')]=_0x245f4a[_0x30fcc6][_0x83e5('0x22')];}}_0xec9dfa=_['map'](Object[_0x83e5('0x1a')](_0x32da30),function(_0x2c7203){return{'name':_0x2c7203,'type':_0x32da30[_0x2c7203][_0x83e5('0x22')]};});return _0xec9dfa;})[_0x83e5('0x17')](function(_0x5a1b69){throw _0x5a1b69;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index e9c9d94..0d4fbee 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 _0x0b00=['resolve','then','tag','filter','agent','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','select','c.id','limit','offset','order','DESC','subqry.','findAll','color','keyBy','Sequelize','CmContact','sequelize','toString','clone','COUNT(*)','group','t.id\x20IN\x20?','QueryTypes','SELECT','query','exports','../parsers/advancedSearch','../parsers/qs','role','autocomplete','true','from','where','c.deletedAt\x20IS\x20NULL','subqry','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','firstName','lastName','phone','email','ListId','CompanyId','createdAt','updatedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','dateOfBirth','fieldType','datetime','DATE','buildExpression','default','text','start','value','end','Tag','map','tags','clause','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','push','length','concat','\x20=\x20?'];(function(_0x448a2f,_0x1d1958){var _0x46b961=function(_0x1609ca){while(--_0x1609ca){_0x448a2f['push'](_0x448a2f['shift']());}};_0x46b961(++_0x1d1958);}(_0x0b00,0x1c2));var _0x00b0=function(_0x1eaa6f,_0x556e77){_0x1eaa6f=_0x1eaa6f-0x0;var _0x370839=_0x0b00[_0x1eaa6f];return _0x370839;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x00b0('0x0'));var qs=require(_0x00b0('0x1'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x44bc52,_0x1671aa){var _0x5a2f4c=![];if(_0x44bc52[_0x00b0('0x2')]==='agent'&&!_0x1671aa['search']&&!_0x1671aa['ListId']&&_0x1671aa[_0x00b0('0x3')]!==_0x00b0('0x4')){_0x5a2f4c=!![];}return _0x5a2f4c;}function getContactsSubquery(){return squel['select']()[_0x00b0('0x5')]('cm_contacts','c')[_0x00b0('0x6')](_0x00b0('0x7'));}function applyJoinClauses(_0x48582b,_0x2f24f5){var _0x1c3733=_0x2f24f5?'c':_0x00b0('0x8');_0x48582b[_0x00b0('0x9')](_0x00b0('0xa'),'uc',_0x00b0('0xb')+_0x1c3733+_0x00b0('0xc'))[_0x00b0('0x9')](_0x00b0('0xd'),'ct',_0x00b0('0xe')+_0x1c3733+_0x00b0('0xc'))[_0x00b0('0x9')](_0x00b0('0xf'),'t',_0x00b0('0x10'));return _0x48582b;}function addFieldsToQuery(_0x3cc3a3,_0x3daad3,_0x3b84bd,_0x5e759b,_0x19e48b){var _0x5166e0=_0x19e48b?'c':_0x00b0('0x8');if(!_0x3daad3){_0x3daad3=['id',_0x00b0('0x11'),_0x00b0('0x12'),_0x00b0('0x13'),'mobile','fax',_0x00b0('0x14'),_0x00b0('0x15'),_0x00b0('0x16'),_0x00b0('0x17'),_0x00b0('0x18'),'deletedAt',_0x00b0('0x19')];}else if(!_0x3daad3[_0x00b0('0x1a')]('id')){_0x3daad3['push']('id');}var _0x58d04a=_0x3b84bd&&_0x19e48b||!_0x3b84bd&&!_0x19e48b;if(_0x5e759b){_0x58d04a=_0x5e759b&&_0x19e48b||!_0x5e759b&&!_0x19e48b;}_0x3daad3[_0x00b0('0x1b')](function(_0x54aec1){if(_0x54aec1===_0x00b0('0x19')){if(_0x58d04a){_0x3cc3a3[_0x00b0('0x1c')](_0x00b0('0x1d'),_0x54aec1);}else if(_0x3b84bd||_0x5e759b){_0x3cc3a3[_0x00b0('0x1c')](_0x5166e0+'.'+_0x54aec1);}}else{_0x3cc3a3[_0x00b0('0x1c')](_0x5166e0+'.'+_0x54aec1);}});return _0x3cc3a3;}function getSqlClauses(){var _0x5b1aab={'default':squel['expr'](),'fields':squel[_0x00b0('0x1e')](),'filter':squel[_0x00b0('0x1e')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x00b0('0x1e')](),'skip':![]}};return _0x5b1aab;}function parseTagParameter(_0x4eaa7c){var _0x363810=squel['expr']();if(_0x4eaa7c){var _0x24845a=utils[_0x00b0('0x1f')](_0x4eaa7c);_0x24845a['forEach'](function(_0x5c8164){_0x363810['or'](_0x00b0('0x20'),'%,'+_0x5c8164+',%');});}return _0x363810;}function parseSearchFilter(_0x499482){var _0x5b8501=squel[_0x00b0('0x1e')]();if(_0x499482){var _0x37b49c=_0x499482[_0x00b0('0x21')]('\x5c','\x5c\x5c')[_0x00b0('0x21')](/'/g,'\x27\x27');if(_0x37b49c[_0x00b0('0x22')]('\x20')['length']>0x1){_0x5b8501['or'](_0x00b0('0x23'),qs['getFullTextValue'](_0x37b49c,!![]),null);}else{if(qs[_0x00b0('0x24')](_0x37b49c)){_0x5b8501['or'](_0x00b0('0x25'),_0x37b49c+'%');_0x5b8501['or'](_0x00b0('0x26'),_0x37b49c+'%');_0x5b8501['or'](_0x00b0('0x27'),_0x37b49c+'%');_0x5b8501['or'](_0x00b0('0x28'),_0x37b49c+'%');}else if(qs[_0x00b0('0x29')](_0x37b49c)){_0x5b8501['or'](_0x00b0('0x2a'),_0x37b49c+'%');}else{_0x5b8501['or']('c.firstName\x20LIKE\x20?','%'+_0x37b49c+'%');_0x5b8501['or'](_0x00b0('0x2b'),'%'+_0x37b49c+'%');_0x5b8501['or'](_0x00b0('0x2a'),'%'+_0x37b49c+'%');}}}return _0x5b8501;}function parseAdvancedSearchFilter(_0x359c75,_0x3372bc){var _0x2c640a=getSqlClauses();var _0x389ee0=as[_0x00b0('0x2c')](_0x359c75);var _0x3bec09=_0x389ee0[_0x00b0('0x2d')];for(var _0x48620e=0x0;_0x48620e<_0x389ee0[_0x00b0('0x2e')]['length'];_0x48620e++){var _0x2e7f48=_0x389ee0[_0x00b0('0x2e')][_0x48620e];var _0x2c9b71='c';var _0x130848=_['find'](_0x3372bc,['name',_0x2e7f48[_0x00b0('0x1c')]]);if(_0x130848){if(_0x2e7f48['field']===_0x00b0('0x2f')||_0x130848[_0x00b0('0x30')]===_0x00b0('0x31')){_0x2e7f48['castTo']=_0x00b0('0x32');}var _0x188cdc=as[_0x00b0('0x33')](_0x2c9b71,_0x130848['type'],_0x2e7f48);_0x2c640a[_0x00b0('0x34')][_0x3bec09](_0x188cdc[_0x00b0('0x35')],_0x188cdc['value'][_0x00b0('0x36')],_0x188cdc[_0x00b0('0x37')][_0x00b0('0x38')]);}else{if(_0x2e7f48[_0x00b0('0x1c')]===_0x00b0('0x39')){var _0x204152=_0x2e7f48[_0x00b0('0x37')][_0x00b0('0x22')](',')[_0x00b0('0x3a')](function(_0x2e77ef){return Number(_0x2e77ef);});var _0x47d11e=parseTagParameter(_0x204152);_0x2c640a[_0x00b0('0x3b')][_0x00b0('0x3c')]['and'](_0x47d11e);_0x2c640a[_0x00b0('0x3b')]['ids']=_0x204152;}else if(_0x2e7f48[_0x00b0('0x1c')]===_0x00b0('0x3d')){_0x2c640a[_0x00b0('0x3e')][_0x00b0('0x3c')][_0x00b0('0x3f')](_0x00b0('0x40'),_0x2e7f48['value']);_0x2c640a[_0x00b0('0x3e')][_0x00b0('0x41')]=!![];}}}return _0x2c640a;}function parseModelFields(_0x75e29,_0x29c610){var _0x14148c=squel[_0x00b0('0x1e')]();var _0x3aba41=_(_0x75e29)[_0x00b0('0x42')]()[_0x00b0('0x3a')](function(_0x3a9d93){return _[_0x00b0('0x43')](_0x29c610,[_0x00b0('0x44'),_0x3a9d93])?_0x3a9d93:undefined;})[_0x00b0('0x45')]()[_0x00b0('0x37')]();if(_0x75e29[_0x00b0('0x46')]){_0x3aba41['push']('Contact');}if(_0x75e29['User']){_0x3aba41[_0x00b0('0x47')](_0x00b0('0x3d'));}if(_0x3aba41[_0x00b0('0x48')]>0x0){_0x3aba41[_0x00b0('0x1b')](function(_0x4ea8fa){if(_0x4ea8fa===_0x00b0('0x15')){_0x14148c['and']('c.ListId\x20IN\x20?',[][_0x00b0('0x49')](_0x75e29[_0x4ea8fa]));}else if(_0x4ea8fa===_0x00b0('0x46')){var _0x301bf5='%'+_0x75e29[_0x4ea8fa]+'%';_0x14148c[_0x00b0('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x301bf5);}else if(_0x4ea8fa===_0x00b0('0x3d')){_0x14148c[_0x00b0('0x3f')](_0x00b0('0x40'),_0x75e29[_0x4ea8fa]);}else{_0x14148c[_0x00b0('0x3f')]('c.'+_0x4ea8fa+_0x00b0('0x4a'),_0x75e29[_0x4ea8fa]);}});}return _0x14148c;}function parseQueryParameters(_0x1f63db,_0x327589){var _0x1a8de7=getSqlClauses();return Promise[_0x00b0('0x4b')]()[_0x00b0('0x4c')](function(){return parseModelFields(_0x1f63db,_0x327589);})[_0x00b0('0x4c')](function(_0x47e16e){_0x1a8de7['fields'][_0x00b0('0x3f')](_0x47e16e);return parseTagParameter(_0x1f63db[_0x00b0('0x4d')]);})[_0x00b0('0x4c')](function(_0x2d8415){_0x1a8de7['tags'][_0x00b0('0x3c')][_0x00b0('0x3f')](_0x2d8415);return parseSearchFilter(_0x1f63db['filter']);})[_0x00b0('0x4c')](function(_0x8a0e54){_0x1a8de7[_0x00b0('0x4e')]=_0x8a0e54;return _0x1a8de7;});}function checkListsRestrictions(_0x5c5aa7,_0x9d62ba,_0x2661d3){var _0x48012c=squel[_0x00b0('0x1e')]();return Promise[_0x00b0('0x4b')]()[_0x00b0('0x4c')](function(){if(_0x9d62ba['search']&&_0x5c5aa7[_0x00b0('0x2')]===_0x00b0('0x4f')&&!_0x2661d3){return _0x5c5aa7['getLists']({'attributes':['id'],'raw':!![]});}})[_0x00b0('0x4c')](function(_0x528927){if(_0x528927){if(_0x528927['length']===0x0){_0x48012c['and'](_0x00b0('0x50'));}else{_0x48012c[_0x00b0('0x3f')](_0x00b0('0x51'),_[_0x00b0('0x3a')](_0x528927,'id'));}}})[_0x00b0('0x4c')](function(){return _0x48012c;});}function buildContactsQuery(_0x4c9d18,_0x463626,_0x2e028a,_0x28d173,_0x1d1c0a,_0x315e78){if(_0x463626){_0x463626=_0x2e028a[_0x00b0('0x52')];}_0x4c9d18=addFieldsToQuery(_0x4c9d18,_0x463626,_0x28d173,_0x315e78,!![]);var _0x289014=squel[_0x00b0('0x53')]();_0x289014=addFieldsToQuery(_0x289014,_0x463626,_0x28d173,_0x315e78,![]);if(_0x28d173||_0x315e78){_0x4c9d18=applyJoinClauses(_0x4c9d18,!![]);_0x4c9d18['group'](_0x00b0('0x54'));if(_0x2e028a[_0x00b0('0x55')]){_0x289014[_0x00b0('0x55')](_0x2e028a[_0x00b0('0x55')]);}if(_0x2e028a[_0x00b0('0x56')]){_0x289014[_0x00b0('0x56')](_0x2e028a[_0x00b0('0x56')]);}}else{_0x289014=applyJoinClauses(_0x289014,![]);_0x289014['group']('subqry.id');if(_0x2e028a[_0x00b0('0x55')]){_0x4c9d18['limit'](_0x2e028a[_0x00b0('0x55')]);}if(_0x2e028a[_0x00b0('0x56')]){_0x4c9d18[_0x00b0('0x56')](_0x2e028a[_0x00b0('0x56')]);}}_0x289014['having'](_0x1d1c0a);if(_0x2e028a[_0x00b0('0x57')]){_0x2e028a['order'][_0x00b0('0x1b')](function(_0x2b1882){_0x4c9d18[_0x00b0('0x57')]('c.'+_0x2b1882[0x0],_0x2b1882[0x1]===_0x00b0('0x58')?![]:!![]);_0x289014['order'](_0x00b0('0x59')+_0x2b1882[0x0],_0x2b1882[0x1]==='DESC'?![]:!![]);});}_0x289014[_0x00b0('0x5')](_0x4c9d18,_0x00b0('0x8'));return _0x289014;}function getFilteredContacts(_0x4c0b8c){var _0x168d15=[];return db[_0x00b0('0x39')][_0x00b0('0x5a')]({'attributes':['id',_0x00b0('0x44'),_0x00b0('0x5b')],'raw':!![]})[_0x00b0('0x4c')](function(_0x410297){_0x168d15=_[_0x00b0('0x5c')](_0x410297,'id');var _0x14276b={'type':db[_0x00b0('0x5d')]['QueryTypes']['SELECT'],'model':db[_0x00b0('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x00b0('0x5f')]['query'](_0x4c0b8c[_0x00b0('0x60')](),_0x14276b);})[_0x00b0('0x4c')](function(_0x2827ab){_0x2827ab['forEach'](function(_0x27f396){if(_0x27f396[_0x00b0('0x19')]){_0x27f396['Tags']=[];_0x27f396[_0x00b0('0x19')]['split'](',')['forEach'](function(_0x493715){_0x27f396['Tags'][_0x00b0('0x47')](_0x168d15[_0x493715]);});}delete _0x27f396['TagIds'];});return _0x2827ab;});}function countFilteredContacts(_0x560167,_0x47cfa1){var _0xfb5afa=_0x560167[_0x00b0('0x61')]();_0xfb5afa[_0x00b0('0x1c')](_0x00b0('0x62'));_0xfb5afa=applyJoinClauses(_0xfb5afa,!![]);_0x560167[_0x00b0('0x63')](_0x00b0('0x54'));var _0x4ab67a=utils['getSelectedTags'](_0x47cfa1);if(!_['isEmpty'](_0x4ab67a)){_0xfb5afa[_0x00b0('0x6')](_0x00b0('0x64'),_0x4ab67a);}var _0x57aa5e={'type':db[_0x00b0('0x5d')][_0x00b0('0x65')][_0x00b0('0x66')],'raw':!![]};return db[_0x00b0('0x5f')][_0x00b0('0x67')](_0xfb5afa[_0x00b0('0x60')](),_0x57aa5e)[_0x00b0('0x4c')](function(_0x2bf97c){return _0x2bf97c[0x0][_0x00b0('0x62')];});}module[_0x00b0('0x68')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x358c=['castTo','DATE','type','default','value','start','end','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','push','Contact','c.ListId\x20IN\x20?','concat','resolve','then','fields','tag','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','keyBy','Sequelize','QueryTypes','CmContact','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','autocomplete','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','email','ListId','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','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?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime'];(function(_0x93f962,_0x68a7ff){var _0x1a9596=function(_0x226063){while(--_0x226063){_0x93f962['push'](_0x93f962['shift']());}};_0x1a9596(++_0x68a7ff);}(_0x358c,0x111));var _0xc358=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x358c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc358('0x0'));var squel=require(_0xc358('0x1'));var as=require(_0xc358('0x2'));var qs=require(_0xc358('0x3'));var utils=require(_0xc358('0x4'));var db=require(_0xc358('0x5'))['db'];function skipContactsQuery(_0x4a8b46,_0x2c6b26){var _0x42bcb8=![];if(_0x4a8b46[_0xc358('0x6')]===_0xc358('0x7')&&!_0x2c6b26[_0xc358('0x8')]&&!_0x2c6b26['ListId']&&_0x2c6b26[_0xc358('0x9')]!==_0xc358('0xa')){_0x42bcb8=!![];}return _0x42bcb8;}function getContactsSubquery(){return squel[_0xc358('0xb')]()[_0xc358('0xc')](_0xc358('0xd'),'c')[_0xc358('0xe')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4e08d1,_0xb485da){var _0x4bfdd5=_0xb485da?'c':_0xc358('0xf');_0x4e08d1[_0xc358('0x10')](_0xc358('0x11'),'uc',_0xc358('0x12')+_0x4bfdd5+'.id')[_0xc358('0x10')](_0xc358('0x13'),'ct',_0xc358('0x14')+_0x4bfdd5+_0xc358('0x15'))['left_join'](_0xc358('0x16'),'t',_0xc358('0x17'));return _0x4e08d1;}function addFieldsToQuery(_0x2cae06,_0x3667fd,_0x197850,_0x2757c9,_0x4236b4){var _0x4208a5=_0x4236b4?'c':'subqry';if(!_0x3667fd){_0x3667fd=['id','firstName','lastName',_0xc358('0x18'),_0xc358('0x19'),_0xc358('0x1a'),_0xc358('0x1b'),_0xc358('0x1c'),_0xc358('0x1d'),_0xc358('0x1e'),_0xc358('0x1f'),_0xc358('0x20'),_0xc358('0x21')];}else if(!_0x3667fd['includes']('id')){_0x3667fd['push']('id');}var _0x5c21d4=_0x197850&&_0x4236b4||!_0x197850&&!_0x4236b4;if(_0x2757c9){_0x5c21d4=_0x2757c9&&_0x4236b4||!_0x2757c9&&!_0x4236b4;}_0x3667fd[_0xc358('0x22')](function(_0x36f7a4){if(_0x36f7a4===_0xc358('0x21')){if(_0x5c21d4){_0x2cae06['field'](_0xc358('0x23'),_0x36f7a4);}else if(_0x197850||_0x2757c9){_0x2cae06[_0xc358('0x24')](_0x4208a5+'.'+_0x36f7a4);}}else{_0x2cae06[_0xc358('0x24')](_0x4208a5+'.'+_0x36f7a4);}});return _0x2cae06;}function getSqlClauses(){var _0x4c54b1={'default':squel[_0xc358('0x25')](),'fields':squel[_0xc358('0x25')](),'filter':squel[_0xc358('0x25')](),'tags':{'clause':squel[_0xc358('0x25')](),'ids':null},'user':{'clause':squel[_0xc358('0x25')](),'skip':![]}};return _0x4c54b1;}function parseTagParameter(_0x24421c){var _0x29e214=squel[_0xc358('0x25')]();if(_0x24421c){var _0x2cb05b=utils[_0xc358('0x26')](_0x24421c);_0x2cb05b[_0xc358('0x22')](function(_0x534b60){_0x29e214['or'](_0xc358('0x27'),'%,'+_0x534b60+',%');});}return _0x29e214;}function parseSearchFilter(_0x3f4297){var _0x4cb3c9=squel['expr']();if(_0x3f4297){var _0x475171=_0x3f4297['replace']('\x5c','\x5c\x5c')[_0xc358('0x28')](/'/g,'\x27\x27');if(_0x475171[_0xc358('0x29')]('\x20')[_0xc358('0x2a')]>0x1){_0x4cb3c9['or'](_0xc358('0x2b'),qs[_0xc358('0x2c')](_0x475171,!![]),null);}else{if(qs['isNumeric'](_0x475171)){_0x4cb3c9['or'](_0xc358('0x2d'),_0x475171+'%');_0x4cb3c9['or'](_0xc358('0x2e'),_0x475171+'%');_0x4cb3c9['or'](_0xc358('0x2f'),_0x475171+'%');_0x4cb3c9['or'](_0xc358('0x30'),_0x475171+'%');}else if(qs[_0xc358('0x31')](_0x475171)){_0x4cb3c9['or'](_0xc358('0x32'),_0x475171+'%');}else{_0x4cb3c9['or'](_0xc358('0x33'),'%'+_0x475171+'%');_0x4cb3c9['or'](_0xc358('0x34'),'%'+_0x475171+'%');_0x4cb3c9['or'](_0xc358('0x32'),'%'+_0x475171+'%');}}}return _0x4cb3c9;}function parseAdvancedSearchFilter(_0x56adfd,_0x4bb906){var _0x3079bf=getSqlClauses();var _0x415078=as[_0xc358('0x35')](_0x56adfd);var _0x2089e3=_0x415078['sqlOperator'];for(var _0x543fdd=0x0;_0x543fdd<_0x415078[_0xc358('0x36')][_0xc358('0x2a')];_0x543fdd++){var _0x112472=_0x415078['conditions'][_0x543fdd];var _0x189f65='c';var _0x31b811=_[_0xc358('0x37')](_0x4bb906,[_0xc358('0x38'),_0x112472[_0xc358('0x24')]]);if(_0x31b811){if(_0x112472[_0xc358('0x24')]===_0xc358('0x39')||_0x31b811[_0xc358('0x3a')]===_0xc358('0x3b')){_0x112472[_0xc358('0x3c')]=_0xc358('0x3d');}var _0x50383e=as['buildExpression'](_0x189f65,_0x31b811[_0xc358('0x3e')],_0x112472);_0x3079bf[_0xc358('0x3f')][_0x2089e3](_0x50383e['text'],_0x50383e[_0xc358('0x40')][_0xc358('0x41')],_0x50383e['value'][_0xc358('0x42')]);}else{if(_0x112472[_0xc358('0x24')]==='Tag'){var _0x1c3ba3=_0x112472[_0xc358('0x40')][_0xc358('0x29')](',')[_0xc358('0x43')](function(_0x19aabb){return Number(_0x19aabb);});var _0x3eab1d=parseTagParameter(_0x1c3ba3);_0x3079bf[_0xc358('0x44')][_0xc358('0x45')][_0xc358('0x46')](_0x3eab1d);_0x3079bf[_0xc358('0x44')][_0xc358('0x47')]=_0x1c3ba3;}else if(_0x112472['field']===_0xc358('0x48')){_0x3079bf[_0xc358('0x49')][_0xc358('0x45')][_0xc358('0x46')](_0xc358('0x4a'),_0x112472[_0xc358('0x40')]);_0x3079bf[_0xc358('0x49')][_0xc358('0x4b')]=!![];}}}return _0x3079bf;}function parseModelFields(_0x152f52,_0x236305){var _0x364eba=squel[_0xc358('0x25')]();var _0x472614=_(_0x152f52)[_0xc358('0x4c')]()[_0xc358('0x43')](function(_0x27b3d1){return _['some'](_0x236305,['name',_0x27b3d1])?_0x27b3d1:undefined;})['compact']()['value']();if(_0x152f52['Contact']){_0x472614[_0xc358('0x4d')](_0xc358('0x4e'));}if(_0x152f52['User']){_0x472614[_0xc358('0x4d')]('User');}if(_0x472614['length']>0x0){_0x472614[_0xc358('0x22')](function(_0x4721f2){if(_0x4721f2===_0xc358('0x1c')){_0x364eba[_0xc358('0x46')](_0xc358('0x4f'),[][_0xc358('0x50')](_0x152f52[_0x4721f2]));}else if(_0x4721f2==='Contact'){var _0x27e1ee='%'+_0x152f52[_0x4721f2]+'%';_0x364eba['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x27e1ee);}else if(_0x4721f2==='User'){_0x364eba['and'](_0xc358('0x4a'),_0x152f52[_0x4721f2]);}else{_0x364eba[_0xc358('0x46')]('c.'+_0x4721f2+'\x20=\x20?',_0x152f52[_0x4721f2]);}});}return _0x364eba;}function parseQueryParameters(_0x523b74,_0x6f785b){var _0x341c43=getSqlClauses();return Promise[_0xc358('0x51')]()[_0xc358('0x52')](function(){return parseModelFields(_0x523b74,_0x6f785b);})[_0xc358('0x52')](function(_0xc3cf59){_0x341c43[_0xc358('0x53')][_0xc358('0x46')](_0xc3cf59);return parseTagParameter(_0x523b74[_0xc358('0x54')]);})[_0xc358('0x52')](function(_0x181de3){_0x341c43[_0xc358('0x44')]['clause'][_0xc358('0x46')](_0x181de3);return parseSearchFilter(_0x523b74[_0xc358('0x55')]);})[_0xc358('0x52')](function(_0x478f88){_0x341c43[_0xc358('0x55')]=_0x478f88;return _0x341c43;});}function checkListsRestrictions(_0x29b85a,_0x4aaf59,_0x535b62){var _0x404ade=squel['expr']();return Promise[_0xc358('0x51')]()[_0xc358('0x52')](function(){if(_0x4aaf59[_0xc358('0x8')]&&_0x29b85a['role']===_0xc358('0x7')&&!_0x535b62){return _0x29b85a['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2ec2b7){if(_0x2ec2b7){if(_0x2ec2b7[_0xc358('0x2a')]===0x0){_0x404ade[_0xc358('0x46')](_0xc358('0x56'));}else{_0x404ade['and'](_0xc358('0x4f'),_[_0xc358('0x43')](_0x2ec2b7,'id'));}}})[_0xc358('0x52')](function(){return _0x404ade;});}function buildContactsQuery(_0x5937ac,_0x51f380,_0x53d148,_0x37ab0c,_0xe5ad3c,_0x2efd31){if(_0x51f380){_0x51f380=_0x53d148[_0xc358('0x57')];}_0x5937ac=addFieldsToQuery(_0x5937ac,_0x51f380,_0x37ab0c,_0x2efd31,!![]);var _0x121367=squel[_0xc358('0xb')]();_0x121367=addFieldsToQuery(_0x121367,_0x51f380,_0x37ab0c,_0x2efd31,![]);if(_0x37ab0c||_0x2efd31){_0x5937ac=applyJoinClauses(_0x5937ac,!![]);_0x5937ac[_0xc358('0x58')](_0xc358('0x59'));if(_0x53d148[_0xc358('0x5a')]){_0x121367[_0xc358('0x5a')](_0x53d148[_0xc358('0x5a')]);}if(_0x53d148[_0xc358('0x5b')]){_0x121367[_0xc358('0x5b')](_0x53d148[_0xc358('0x5b')]);}}else{_0x121367=applyJoinClauses(_0x121367,![]);_0x121367[_0xc358('0x58')](_0xc358('0x5c'));if(_0x53d148['limit']){_0x5937ac[_0xc358('0x5a')](_0x53d148[_0xc358('0x5a')]);}if(_0x53d148[_0xc358('0x5b')]){_0x5937ac[_0xc358('0x5b')](_0x53d148['offset']);}}_0x121367[_0xc358('0x5d')](_0xe5ad3c);if(_0x53d148[_0xc358('0x5e')]){_0x53d148[_0xc358('0x5e')]['forEach'](function(_0x1b0bed){_0x5937ac[_0xc358('0x5e')]('c.'+_0x1b0bed[0x0],_0x1b0bed[0x1]==='DESC'?![]:!![]);_0x121367[_0xc358('0x5e')](_0xc358('0x5f')+_0x1b0bed[0x0],_0x1b0bed[0x1]===_0xc358('0x60')?![]:!![]);});}_0x121367[_0xc358('0xc')](_0x5937ac,_0xc358('0xf'));return _0x121367;}function getFilteredContacts(_0x133276){var _0x2a04db=[];return db['Tag'][_0xc358('0x61')]({'attributes':['id',_0xc358('0x38'),'color'],'raw':!![]})['then'](function(_0x706c85){_0x2a04db=_[_0xc358('0x62')](_0x706c85,'id');var _0x4af8a5={'type':db[_0xc358('0x63')][_0xc358('0x64')]['SELECT'],'model':db[_0xc358('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xc358('0x66')](_0x133276[_0xc358('0x67')](),_0x4af8a5);})[_0xc358('0x52')](function(_0x13c83c){_0x13c83c[_0xc358('0x22')](function(_0x2f9406){if(_0x2f9406['TagIds']){_0x2f9406[_0xc358('0x68')]=[];_0x2f9406[_0xc358('0x21')][_0xc358('0x29')](',')[_0xc358('0x22')](function(_0x917167){_0x2f9406[_0xc358('0x68')][_0xc358('0x4d')](_0x2a04db[_0x917167]);});}delete _0x2f9406['TagIds'];});return _0x13c83c;});}function countFilteredContacts(_0x3ed3bb,_0x1b3caf){var _0x3239e8=_0x3ed3bb['clone']();_0x3239e8['field'](_0xc358('0x69'));_0x3239e8=applyJoinClauses(_0x3239e8,!![]);_0x3ed3bb[_0xc358('0x58')](_0xc358('0x59'));var _0xf29825=utils[_0xc358('0x26')](_0x1b3caf);if(!_[_0xc358('0x6a')](_0xf29825)){_0x3239e8[_0xc358('0xe')](_0xc358('0x6b'),_0xf29825);}var _0x5e8b26={'type':db['Sequelize']['QueryTypes'][_0xc358('0x6c')],'raw':!![]};return db[_0xc358('0x6d')]['query'](_0x3239e8[_0xc358('0x67')](),_0x5e8b26)[_0xc358('0x52')](function(_0x3030ae){return _0x3030ae[0x0][_0xc358('0x69')];});}module[_0xc358('0x6e')]={'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 91f79f9..59983a1 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 _0x4c0b=['encrypt','algorithm','join','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write','final','binary','end','close','unlink','secret','utf8','base64','decryptString','createDecipher','lodash','../../config/logger','app','secrets','session','aes192'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c0b,0xcc));var _0xb4c0=function(_0x311abf,_0x41161d){_0x311abf=_0x311abf-0x0;var _0x4ca2ad=_0x4c0b[_0x311abf];return _0x4ca2ad;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xb4c0('0x0'));var config=require('../../config/environment');var logger=require(_0xb4c0('0x1'))(_0xb4c0('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb4c0('0x3')][_0xb4c0('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xb4c0('0x5')};if(config[_0xb4c0('0x6')]&&config['encrypt'][_0xb4c0('0x7')]){var isSupported=isAlgorithmSupported(config[_0xb4c0('0x6')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xb4c0('0x6')][_0xb4c0('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb4c0('0x8')](',\x20');logger['error'](config[_0xb4c0('0x6')][_0xb4c0('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x41d865){return AES_SUPPORTED_RX[_0xb4c0('0x9')](_0x41d865);}function getSupportedCiphers(){return crypto[_0xb4c0('0xa')]()[_0xb4c0('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x4ef41d){return getSupportedCiphers()['indexOf'](_0x4ef41d)>-0x1;}function combineOptions(_0x18f18c){var _0x240538={};for(var _0x362f38 in fileOptions){if(fileOptions[_0xb4c0('0xc')](_0x362f38)){_0x240538[_0x362f38]=fileOptions[_0x362f38];}}if(_0x18f18c){for(var _0x2641c9 in _0x18f18c){if(_0x18f18c[_0xb4c0('0xc')](_0x2641c9)){_0x240538[_0x2641c9]=_0x18f18c[_0x2641c9];}}}return _0x240538;}exports[_0xb4c0('0xd')]=function(_0x56f679,_0x45e0c0,_0x12493b,_0x312c0c){return new BPromise(function(_0x101b21,_0x5a68a9){_0x312c0c=combineOptions(_0x312c0c);var _0x325d73=new Buffer(_0x12493b);var _0x396776=fs[_0xb4c0('0xe')](_0x56f679);var _0x19b960=fs[_0xb4c0('0xf')](_0x45e0c0);var _0x4774d5=crypto[_0xb4c0('0x10')](_0x312c0c[_0xb4c0('0x7')],_0x325d73);_0x396776['on'](_0xb4c0('0x11'),function(_0x236707){var _0xdd2e4c=new Buffer(_0x4774d5[_0xb4c0('0x12')](_0x236707),'binary');_0x19b960[_0xb4c0('0x13')](_0xdd2e4c);});_0x396776['on']('end',function(){try{var _0x12c924=new Buffer(_0x4774d5[_0xb4c0('0x14')]('binary'),_0xb4c0('0x15'));_0x19b960[_0xb4c0('0x13')](_0x12c924);_0x19b960[_0xb4c0('0x16')]();_0x19b960['on'](_0xb4c0('0x17'),function(){return _0x101b21(_0x45e0c0);});}catch(_0x27c5a8){fs[_0xb4c0('0x18')](_0x45e0c0);return _0x5a68a9(_0x27c5a8);}});});};exports['decryptFile']=function(_0x145ebb,_0x6171ee,_0x5a142c,_0x3dbd2d){return new BPromise(function(_0x3d365c,_0x4894fd){_0x3dbd2d=combineOptions(_0x3dbd2d);var _0x4ff2d0=new Buffer(_0x5a142c);var _0x22293f=fs[_0xb4c0('0xe')](_0x145ebb);var _0x50e25e=fs['createWriteStream'](_0x6171ee);var _0x87da57=crypto['createDecipher'](_0x3dbd2d[_0xb4c0('0x7')],_0x4ff2d0);_0x22293f['on'](_0xb4c0('0x11'),function(_0x1572e7){var _0x52c883=new Buffer(_0x87da57[_0xb4c0('0x12')](_0x1572e7),_0xb4c0('0x15'));_0x50e25e['write'](_0x52c883);});_0x22293f['on'](_0xb4c0('0x16'),function(){try{var _0x5391a9=new Buffer(_0x87da57['final'](_0xb4c0('0x15')),_0xb4c0('0x15'));_0x50e25e['write'](_0x5391a9);_0x50e25e[_0xb4c0('0x16')]();_0x50e25e['on'](_0xb4c0('0x17'),function(){return _0x3d365c(_0x6171ee);});}catch(_0x540063){fs[_0xb4c0('0x18')](_0x6171ee);return _0x4894fd(_0x540063);}});});};exports['encryptString']=function(_0x127601,_0x3ad980,_0x252845){var _0x285e44=_0x252845||stringOptions[_0xb4c0('0x7')];var _0x5ba76c=_0x3ad980||stringOptions[_0xb4c0('0x19')];var _0x55a07d=crypto['createCipher'](_0x285e44,_0x5ba76c);var _0xa813e3=_0x55a07d['update'](_0x127601,_0xb4c0('0x1a'),_0xb4c0('0x1b'));_0xa813e3+=_0x55a07d[_0xb4c0('0x14')](_0xb4c0('0x1b'));return _0xa813e3;};exports[_0xb4c0('0x1c')]=function(_0xb979d3,_0x3a1b1c,_0x3111a2){var _0x9b9bd0=_0x3111a2||stringOptions[_0xb4c0('0x7')];var _0x3d5c20=_0x3a1b1c||stringOptions[_0xb4c0('0x19')];var _0x4b7c40=crypto[_0xb4c0('0x1d')](_0x9b9bd0,_0x3d5c20);var _0x1930c9=_0x4b7c40[_0xb4c0('0x12')](_0xb979d3,_0xb4c0('0x1b'),'utf8');_0x1930c9+=_0x4b7c40[_0xb4c0('0x14')](_0xb4c0('0x1a'));return _0x1930c9;}; \ No newline at end of file +var _0x49fb=['algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','createCipher','data','update','binary','write','end','close','createReadStream','createDecipher','unlink','encryptString','secret','utf8','base64','final','decryptString','lodash','../../config/environment','../../config/logger','app','secrets','session','encrypt'];(function(_0x3a4777,_0x173c1a){var _0x15dd7d=function(_0x24c4f3){while(--_0x24c4f3){_0x3a4777['push'](_0x3a4777['shift']());}};_0x15dd7d(++_0x173c1a);}(_0x49fb,0x164));var _0xb49f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x49fb[_0x3ab51d];return _0x29a04e;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xb49f('0x0'));var config=require(_0xb49f('0x1'));var logger=require(_0xb49f('0x2'))(_0xb49f('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb49f('0x4')][_0xb49f('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0xb49f('0x6')]&&config[_0xb49f('0x6')][_0xb49f('0x7')]){var isSupported=isAlgorithmSupported(config[_0xb49f('0x6')][_0xb49f('0x7')]);if(isSupported){fileOptions[_0xb49f('0x7')]=config[_0xb49f('0x6')][_0xb49f('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb49f('0x8')](',\x20');logger[_0xb49f('0x9')](config['encrypt'][_0xb49f('0x7')],_0xb49f('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x12b5ff){return AES_SUPPORTED_RX[_0xb49f('0xb')](_0x12b5ff);}function getSupportedCiphers(){return crypto[_0xb49f('0xc')]()[_0xb49f('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1bf58f){return getSupportedCiphers()[_0xb49f('0xe')](_0x1bf58f)>-0x1;}function combineOptions(_0x5cb615){var _0x142cfe={};for(var _0x503899 in fileOptions){if(fileOptions[_0xb49f('0xf')](_0x503899)){_0x142cfe[_0x503899]=fileOptions[_0x503899];}}if(_0x5cb615){for(var _0xa166a2 in _0x5cb615){if(_0x5cb615['hasOwnProperty'](_0xa166a2)){_0x142cfe[_0xa166a2]=_0x5cb615[_0xa166a2];}}}return _0x142cfe;}exports['encryptFile']=function(_0x5856aa,_0x478d1c,_0x2186bd,_0x536281){return new BPromise(function(_0x466cad,_0x50f325){_0x536281=combineOptions(_0x536281);var _0x4751cc=new Buffer(_0x2186bd);var _0x29cce9=fs['createReadStream'](_0x5856aa);var _0x20f97d=fs[_0xb49f('0x10')](_0x478d1c);var _0x2d0019=crypto[_0xb49f('0x11')](_0x536281[_0xb49f('0x7')],_0x4751cc);_0x29cce9['on'](_0xb49f('0x12'),function(_0x5b78a9){var _0x4624cb=new Buffer(_0x2d0019[_0xb49f('0x13')](_0x5b78a9),_0xb49f('0x14'));_0x20f97d[_0xb49f('0x15')](_0x4624cb);});_0x29cce9['on'](_0xb49f('0x16'),function(){try{var _0xc278f6=new Buffer(_0x2d0019['final'](_0xb49f('0x14')),_0xb49f('0x14'));_0x20f97d[_0xb49f('0x15')](_0xc278f6);_0x20f97d['end']();_0x20f97d['on'](_0xb49f('0x17'),function(){return _0x466cad(_0x478d1c);});}catch(_0x176b5a){fs['unlink'](_0x478d1c);return _0x50f325(_0x176b5a);}});});};exports['decryptFile']=function(_0x403aa6,_0x452c7b,_0xa78322,_0x3d56a8){return new BPromise(function(_0xffda68,_0x3fbb36){_0x3d56a8=combineOptions(_0x3d56a8);var _0x37acaf=new Buffer(_0xa78322);var _0x175c19=fs[_0xb49f('0x18')](_0x403aa6);var _0x490d8d=fs[_0xb49f('0x10')](_0x452c7b);var _0xa66bd=crypto[_0xb49f('0x19')](_0x3d56a8[_0xb49f('0x7')],_0x37acaf);_0x175c19['on'](_0xb49f('0x12'),function(_0x1646ad){var _0x30c2b1=new Buffer(_0xa66bd[_0xb49f('0x13')](_0x1646ad),_0xb49f('0x14'));_0x490d8d[_0xb49f('0x15')](_0x30c2b1);});_0x175c19['on'](_0xb49f('0x16'),function(){try{var _0x2d8b26=new Buffer(_0xa66bd['final'](_0xb49f('0x14')),_0xb49f('0x14'));_0x490d8d[_0xb49f('0x15')](_0x2d8b26);_0x490d8d[_0xb49f('0x16')]();_0x490d8d['on'](_0xb49f('0x17'),function(){return _0xffda68(_0x452c7b);});}catch(_0x43cfe9){fs[_0xb49f('0x1a')](_0x452c7b);return _0x3fbb36(_0x43cfe9);}});});};exports[_0xb49f('0x1b')]=function(_0x302b32,_0x33e1cb,_0x523a85){var _0x212d39=_0x523a85||stringOptions[_0xb49f('0x7')];var _0x116597=_0x33e1cb||stringOptions[_0xb49f('0x1c')];var _0x4a7a99=crypto['createCipher'](_0x212d39,_0x116597);var _0x2baae6=_0x4a7a99[_0xb49f('0x13')](_0x302b32,_0xb49f('0x1d'),_0xb49f('0x1e'));_0x2baae6+=_0x4a7a99[_0xb49f('0x1f')](_0xb49f('0x1e'));return _0x2baae6;};exports[_0xb49f('0x20')]=function(_0x330b4f,_0x145c00,_0xa8d424){var _0xe28725=_0xa8d424||stringOptions['algorithm'];var _0x340545=_0x145c00||stringOptions['secret'];var _0x23749e=crypto[_0xb49f('0x19')](_0xe28725,_0x340545);var _0x5489da=_0x23749e['update'](_0x330b4f,_0xb49f('0x1e'),_0xb49f('0x1d'));_0x5489da+=_0x23749e[_0xb49f('0x1f')](_0xb49f('0x1d'));return _0x5489da;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 25c2288..b79246c 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 _0x805d=['writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x805d,0x1a8));var _0xd805=function(_0x2a7217,_0x432f82){_0x2a7217=_0x2a7217-0x0;var _0x3e08b4=_0x805d[_0x2a7217];return _0x3e08b4;};'use strict';var util=require(_0xd805('0x0'));var path=require(_0xd805('0x1'));var _=require(_0xd805('0x2'));var csv=require(_0xd805('0x3'));var fs=require('fs');var BPromise=require(_0xd805('0x4'));var zipdir=require(_0xd805('0x5'));var rimraf=require(_0xd805('0x6'));var db=require(_0xd805('0x7'))['db'];var dbH=require(_0xd805('0x7'))[_0xd805('0x8')];var logger=require(_0xd805('0x9'))(_0xd805('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xd805('0xb')][0x2]);var QUERY=process[_0xd805('0xb')][0x3];var PATH=process[_0xd805('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6c2f1a,_0x12e3d0){var _0x49d465={'status':_0x6c2f1a};var _0x2f9ab4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12e3d0){_0x49d465[_0xd805('0xc')]=_0x12e3d0;}return db['AnalyticExtractedReport']['update'](_0x49d465,_0x2f9ab4);}function main(){var _0x159425=0x1388;var _0x4313c3;logger[_0xd805('0xd')](util[_0xd805('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd805('0xf')));return db[_0xd805('0x10')][_0xd805('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd805('0x12'),_0xd805('0x13')]})[_0xd805('0x14')](function(_0x42bd6c){if(_0x42bd6c){_0x4313c3=_0x42bd6c;_0x159425=_0x4313c3['splitSizeCsv']||0x1388;}})[_0xd805('0x14')](function(){return dbH[_0xd805('0x15')]['query'](util[_0xd805('0xe')](_0xd805('0x16'),QUERY),{'type':dbH['sequelize'][_0xd805('0x17')][_0xd805('0x18')]});})[_0xd805('0x14')](function(_0x3bb659){if(!_0x3bb659[0x0]['num']){return analyticExtractedReport(_0xd805('0x19'));}var _0x215bbf=[];var _0x203856=0x0;if(_0x4313c3[_0xd805('0x12')]){if(_0x3bb659&&_0x3bb659[_0xd805('0x1a')]){var _0x3e71a3=_[_0xd805('0x1b')](_0x3bb659[0x0][_0xd805('0x1c')]/_0x159425);var _0x17a8c6=Number[_0xd805('0x1d')](_0x3bb659[0x0][_0xd805('0x1c')]/_0x159425)?_0x3bb659[0x0][_0xd805('0x1c')]%_0x159425:0x0;_0x3e71a3[_0xd805('0x1e')](function(_0x1ea6cb){if(_0x1ea6cb>0x0){_0x203856+=_0x159425;}_0x215bbf[_0xd805('0x1f')](dbH[_0xd805('0x15')][_0xd805('0x20')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x159425,_0x203856),{'type':dbH[_0xd805('0x15')][_0xd805('0x17')]['SELECT']}));});if(_0x17a8c6>0x0){_0x203856+=_0x159425;_0x215bbf[_0xd805('0x1f')](dbH[_0xd805('0x15')][_0xd805('0x20')](util[_0xd805('0xe')](_0xd805('0x21'),QUERY,_0x17a8c6,_0x203856),{'type':dbH[_0xd805('0x15')][_0xd805('0x17')]['SELECT']}));}}}else{_0x215bbf[_0xd805('0x1f')](dbH[_0xd805('0x15')]['query'](QUERY,{'type':dbH[_0xd805('0x15')]['QueryTypes'][_0xd805('0x18')]}));}var _0x5c1f06=path[_0xd805('0x22')](PATH);var _0x2bbc06=path[_0xd805('0x23')](PATH,_0xd805('0x24'));var _0x39b614=_0x4313c3[_0xd805('0x12')]&&_0x215bbf[_0xd805('0x1a')]>0x1;var _0x5e124d=[];if(!fs[_0xd805('0x25')](path[_0xd805('0x26')](_0x5c1f06,_0x2bbc06))&&_0x39b614){fs[_0xd805('0x27')](path[_0xd805('0x26')](_0x5c1f06,_0x2bbc06));}return BPromise[_0xd805('0x28')](_0x215bbf,function(_0x1d803e){_0x5e124d[_0xd805('0x1f')](_0x1d803e);})[_0xd805('0x14')](function(){for(var _0x442d9c=0x0;_0x442d9c<_0x5e124d[_0xd805('0x1a')];_0x442d9c+=0x1){var _0x3f14d4;var _0x4164e3=_0x5e124d[_0x442d9c];if(_0x39b614){_0x3f14d4=path[_0xd805('0x26')](_0x5c1f06,_0x2bbc06,util['format'](_0xd805('0x29'),_0x2bbc06,_0x442d9c,_0xd805('0x2a')));}else{_0x3f14d4=path[_0xd805('0x26')](_0x5c1f06,util[_0xd805('0xe')](_0xd805('0x2b'),_0x2bbc06,'csv'));}fs[_0xd805('0x2c')](_0x3f14d4,csv(_0x4164e3));}})[_0xd805('0x14')](function(){if(_0x39b614){return new Promise(function(_0x6c996f){zipdir(path[_0xd805('0x26')](_0x5c1f06,_0x2bbc06),{'saveTo':path['join'](_0x5c1f06,util['format'](_0xd805('0x2b'),_0x2bbc06,_0xd805('0x2d')))},function(_0xb13b74,_0x3f4c83){rimraf(path['join'](_0x5c1f06,_0x2bbc06),function(){});_0x6c996f(_0xd805('0x2e'));});});}})[_0xd805('0x14')](function(){logger[_0xd805('0xd')](util[_0xd805('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xd805('0x2f'),_0x39b614?util['format'](_0xd805('0x2b'),_0x2bbc06,_0x39b614?_0xd805('0x2d'):'csv'):null);});})['catch'](function(_0x10f8de){logger['info'](util[_0xd805('0xe')](_0xd805('0x30'),EXTRACTED_REPORT_ID,_0xd805('0xf')),util[_0xd805('0x31')](_0x10f8de,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd805('0x32'));})[_0xd805('0x33')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xecfa=['.csv','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','range','isInteger','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename'];(function(_0x260ce2,_0x2e22b8){var _0x16b105=function(_0x260a06){while(--_0x260a06){_0x260ce2['push'](_0x260ce2['shift']());}};_0x16b105(++_0x2e22b8);}(_0xecfa,0xd6));var _0xaecf=function(_0x4eb426,_0x3a2a4b){_0x4eb426=_0x4eb426-0x0;var _0xc23994=_0xecfa[_0x4eb426];return _0xc23994;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var csv=require(_0xaecf('0x0'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xaecf('0x1'));var rimraf=require(_0xaecf('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0xaecf('0x3'))[_0xaecf('0x4')];var logger=require(_0xaecf('0x5'))(_0xaecf('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xaecf('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f693b,_0x320615){var _0x18eb5e={'status':_0x4f693b};var _0x2ea3b9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x320615){_0x18eb5e[_0xaecf('0x8')]=_0x320615;}return db[_0xaecf('0x9')][_0xaecf('0xa')](_0x18eb5e,_0x2ea3b9);}function main(){var _0x5cea53=0x1388;var _0x23a779;logger['info'](util[_0xaecf('0xb')](_0xaecf('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xaecf('0xd')][_0xaecf('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaecf('0xf'),_0xaecf('0x10')]})[_0xaecf('0x11')](function(_0x583341){if(_0x583341){_0x23a779=_0x583341;_0x5cea53=_0x23a779[_0xaecf('0x10')]||0x1388;}})[_0xaecf('0x11')](function(){return dbH[_0xaecf('0x12')]['query'](util['format'](_0xaecf('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xaecf('0x14')]});})[_0xaecf('0x11')](function(_0x5dd06f){if(!_0x5dd06f[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2c1b9b=[];var _0x29c8dd=0x0;if(_0x23a779[_0xaecf('0xf')]){if(_0x5dd06f&&_0x5dd06f[_0xaecf('0x15')]){var _0x369c35=_[_0xaecf('0x16')](_0x5dd06f[0x0]['num']/_0x5cea53);var _0x788496=Number[_0xaecf('0x17')](_0x5dd06f[0x0]['num']/_0x5cea53)?_0x5dd06f[0x0][_0xaecf('0x18')]%_0x5cea53:0x0;_0x369c35[_0xaecf('0x19')](function(_0x5185f5){if(_0x5185f5>0x0){_0x29c8dd+=_0x5cea53;}_0x2c1b9b[_0xaecf('0x1a')](dbH[_0xaecf('0x12')][_0xaecf('0x1b')](util[_0xaecf('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5cea53,_0x29c8dd),{'type':dbH[_0xaecf('0x12')]['QueryTypes']['SELECT']}));});if(_0x788496>0x0){_0x29c8dd+=_0x5cea53;_0x2c1b9b['push'](dbH[_0xaecf('0x12')]['query'](util[_0xaecf('0xb')](_0xaecf('0x1c'),QUERY,_0x788496,_0x29c8dd),{'type':dbH[_0xaecf('0x12')]['QueryTypes'][_0xaecf('0x14')]}));}}}else{_0x2c1b9b[_0xaecf('0x1a')](dbH[_0xaecf('0x12')][_0xaecf('0x1b')](QUERY,{'type':dbH['sequelize'][_0xaecf('0x1d')][_0xaecf('0x14')]}));}var _0x81b585=path['dirname'](PATH);var _0x48dee4=path[_0xaecf('0x1e')](PATH,_0xaecf('0x1f'));var _0x499754=_0x23a779['split']&&_0x2c1b9b[_0xaecf('0x15')]>0x1;var _0x25a8ae=[];if(!fs['existsSync'](path[_0xaecf('0x20')](_0x81b585,_0x48dee4))&&_0x499754){fs[_0xaecf('0x21')](path[_0xaecf('0x20')](_0x81b585,_0x48dee4));}return BPromise[_0xaecf('0x22')](_0x2c1b9b,function(_0xa82b8b){_0x25a8ae[_0xaecf('0x1a')](_0xa82b8b);})['then'](function(){for(var _0x19514c=0x0;_0x19514c<_0x25a8ae[_0xaecf('0x15')];_0x19514c+=0x1){var _0x84bc;var _0x148426=_0x25a8ae[_0x19514c];if(_0x499754){_0x84bc=path['join'](_0x81b585,_0x48dee4,util[_0xaecf('0xb')]('%s%d.%s',_0x48dee4,_0x19514c,_0xaecf('0x23')));}else{_0x84bc=path[_0xaecf('0x20')](_0x81b585,util['format'](_0xaecf('0x24'),_0x48dee4,_0xaecf('0x23')));}fs[_0xaecf('0x25')](_0x84bc,csv(_0x148426));}})[_0xaecf('0x11')](function(){if(_0x499754){return new Promise(function(_0xda394e){zipdir(path[_0xaecf('0x20')](_0x81b585,_0x48dee4),{'saveTo':path[_0xaecf('0x20')](_0x81b585,util['format']('%s.%s',_0x48dee4,_0xaecf('0x26')))},function(_0x3f12bf,_0x1fa5dd){rimraf(path[_0xaecf('0x20')](_0x81b585,_0x48dee4),function(){});_0xda394e(_0xaecf('0x27'));});});}})['then'](function(){logger['info'](util[_0xaecf('0xb')](_0xaecf('0x28'),EXTRACTED_REPORT_ID,_0xaecf('0x29')));return analyticExtractedReport(_0xaecf('0x2a'),_0x499754?util[_0xaecf('0xb')]('%s.%s',_0x48dee4,_0x499754?_0xaecf('0x26'):_0xaecf('0x23')):null);});})[_0xaecf('0x2b')](function(_0x592414){logger[_0xaecf('0x2c')](util[_0xaecf('0xb')](_0xaecf('0x2d'),EXTRACTED_REPORT_ID,_0xaecf('0x29')),util[_0xaecf('0x2e')](_0x592414,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaecf('0x2f'));})[_0xaecf('0x30')](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 4107c07..0329dcc 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 _0xa1d4=['footer','num','Empty','Setting','split','then','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','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','pipe','finish','error','end','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','margin','\x20/\x20'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa1d4,0xe5));var _0x4a1d=function(_0x556ec6,_0x1e54c5){_0x556ec6=_0x556ec6-0x0;var _0x427a29=_0xa1d4[_0x556ec6];return _0x427a29;};'use strict';var _=require(_0x4a1d('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x4a1d('0x1'));var moment=require(_0x4a1d('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4a1d('0x3'));var zipdir=require(_0x4a1d('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x4a1d('0x5'))[_0x4a1d('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x4a1d('0x7'))['db'];var dbH=require(_0x4a1d('0x7'))[_0x4a1d('0x8')];var logger=require(_0x4a1d('0x9'))(_0x4a1d('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4a1d('0xb')][0x3];var PATH=process[_0x4a1d('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x4a1d('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x238626,_0x548501){var _0x42394b={'status':_0x238626};var _0x1044e7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x548501){_0x42394b[_0x4a1d('0xd')]=_0x548501;}return db['AnalyticExtractedReport'][_0x4a1d('0xe')](_0x42394b,_0x1044e7);}function getHeaders(_0x1e13ca){return _[_0x4a1d('0xf')](_0x1e13ca,function(_0x58b44){return{'text':_0x58b44,'style':_0x4a1d('0x10')};});}function getRows(_0x21e69c,_0x49f27c){return _[_0x4a1d('0xf')](_0x49f27c,function(_0x4e0fb7){return _(_0x4e0fb7)[_0x4a1d('0x11')](_0x21e69c)[_0x4a1d('0xf')](function(_0x558caf){return _0x558caf?_[_0x4a1d('0x12')](_0x558caf):'';})[_0x4a1d('0x13')]();});}function createTable(_0x37de0d,_0x4d4d96){var _0x5879af={'widths':_[_0x4a1d('0x14')](Array(_0x37de0d[_0x4a1d('0x15')]),0x91),'heights':function(_0x5519fc){return _0x5519fc===0x0?_0x4a1d('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3bb3fc=getHeaders(_0x37de0d);_0x5879af['body']['push'](_0x3bb3fc);var _0x4b9963=getRows(_0x37de0d,_0x4d4d96);_0x5879af[_0x4a1d('0x17')]=_0x5879af['body']['concat'](_0x4b9963);return _0x5879af;}function createTables(_0xc1b606){var _0x86d6ac=[];var _0x4516b1=_['chunk'](Object[_0x4a1d('0x18')](_0xc1b606[0x0]),0x5);_0x4516b1[_0x4a1d('0x19')](function(_0x317323){_0x86d6ac[_0x4a1d('0x1a')](createTable(_0x317323,_0xc1b606));});return _0x86d6ac;}function getPDFDocDefinition(_0x40e4d0){var _0x1523bb=util[_0x4a1d('0x1b')](_0x4a1d('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x4a1d('0x1d')])[_0x4a1d('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x4a1d('0x1b')](FORMAT));var _0x2d0f40=[];for(var _0x561a4d=0x0;_0x561a4d<_0x40e4d0[_0x4a1d('0x15')];_0x561a4d++){var _0x26745e=[];if(_0x561a4d===0x0){_0x26745e[_0x4a1d('0x1a')]({'text':_0x1523bb,'style':_0x4a1d('0x1e')});}var _0x1f1879={'table':_0x40e4d0[_0x561a4d]};if(_0x561a4d>0x0){_0x1f1879[_0x4a1d('0x1f')]=_0x4a1d('0x20');_0x1f1879[_0x4a1d('0x21')]=[0x0,0x46,0x0,0x0];}_0x26745e[_0x4a1d('0x1a')](_0x1f1879);_0x2d0f40[_0x4a1d('0x1a')](_0x26745e);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2d0f40,'footer':function(_0x4d20ed,_0x21acc4){return{'text':_0x4d20ed[_0x4a1d('0x12')]()+_0x4a1d('0x22')+_0x21acc4,'style':_0x4a1d('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4b08f2){var _0x147262=0x1388;var _0x4aaf6f;if(!_0x4b08f2[0x0][_0x4a1d('0x24')]){return analyticExtractedReport(_0x4a1d('0x25'));}return db[_0x4a1d('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4a1d('0x27'),'splitSizePdf']})[_0x4a1d('0x28')](function(_0x29de13){if(_0x29de13){_0x4aaf6f=_0x29de13;_0x147262=_0x4aaf6f[_0x4a1d('0x29')]||0x3e8;}})['then'](function(){var _0x1fa3df=[];var _0x52a3fb=0x0;if(_0x4aaf6f[_0x4a1d('0x27')]){if(_0x4b08f2&&_0x4b08f2[_0x4a1d('0x15')]){var _0x46d9df=_[_0x4a1d('0x2a')](_0x4b08f2[0x0][_0x4a1d('0x24')]/_0x147262);var _0x407b54=Number[_0x4a1d('0x2b')](_0x4b08f2[0x0][_0x4a1d('0x24')]/_0x147262)?_0x4b08f2[0x0]['num']%_0x147262:0x0;_0x46d9df[_0x4a1d('0x19')](function(_0x34923d){if(_0x34923d>0x0){_0x52a3fb+=_0x147262;}_0x1fa3df[_0x4a1d('0x1a')](dbH[_0x4a1d('0x2c')][_0x4a1d('0x2d')](util[_0x4a1d('0x1b')](_0x4a1d('0x2e'),QUERY,_0x147262,_0x52a3fb),{'type':dbH['sequelize'][_0x4a1d('0x2f')][_0x4a1d('0x30')]}));});if(_0x407b54>0x0){_0x52a3fb+=_0x147262;_0x1fa3df[_0x4a1d('0x1a')](dbH['sequelize']['query'](util[_0x4a1d('0x1b')](_0x4a1d('0x2e'),QUERY,_0x407b54,_0x52a3fb),{'type':dbH[_0x4a1d('0x2c')][_0x4a1d('0x2f')]['SELECT']}));}}}else{_0x1fa3df[_0x4a1d('0x1a')](dbH[_0x4a1d('0x2c')][_0x4a1d('0x2d')](QUERY,{'type':dbH[_0x4a1d('0x2c')][_0x4a1d('0x2f')][_0x4a1d('0x30')]}));}var _0x103bb1=path[_0x4a1d('0x31')](PATH);var _0x50f270=path[_0x4a1d('0x32')](PATH,_0x4a1d('0x33'));var _0x5a1aa2=_0x4aaf6f['split']&&_0x1fa3df['length']>0x1;var _0x4aea82=[];if(!fs[_0x4a1d('0x34')](path['join'](_0x103bb1,_0x50f270))&&_0x5a1aa2){fs[_0x4a1d('0x35')](path[_0x4a1d('0x36')](_0x103bb1,_0x50f270));}return BPromise['each'](_0x1fa3df,function(_0xdc2ac0){_0x4aea82[_0x4a1d('0x1a')](_0xdc2ac0);})[_0x4a1d('0x28')](function(){var _0x3c3140=[];for(var _0x3b6c90=0x0;_0x3b6c90<_0x4aea82[_0x4a1d('0x15')];_0x3b6c90+=0x1){var _0x365d6b=_0x4aea82[_0x3b6c90];var _0x3aee00=createTables(_[_0x4a1d('0x37')](_0x365d6b));var _0x5ea379;var _0x219bfa=getPDFDocDefinition(_0x3aee00);var _0x26529d=getPDFPrinter();var _0x2fade9=_0x26529d[_0x4a1d('0x38')](_0x219bfa);if(_0x5a1aa2){_0x5ea379=path[_0x4a1d('0x36')](_0x103bb1,_0x50f270,util[_0x4a1d('0x1b')](_0x4a1d('0x39'),_0x50f270,_0x3b6c90,_0x4a1d('0x3a')));}else{_0x5ea379=path[_0x4a1d('0x36')](_0x103bb1,util[_0x4a1d('0x1b')](_0x4a1d('0x3b'),_0x50f270,_0x4a1d('0x3a')));}_0x3c3140['push'](writePDFDocument(_0x2fade9,_0x5ea379));}return Promise[_0x4a1d('0x3c')](_0x3c3140);})['then'](function(){if(_0x5a1aa2){return new Promise(function(_0x290b08){zipdir(path[_0x4a1d('0x36')](_0x103bb1,_0x50f270),{'saveTo':path[_0x4a1d('0x36')](_0x103bb1,util['format'](_0x4a1d('0x3b'),_0x50f270,_0x4a1d('0x3d')))},function(){rimraf(path[_0x4a1d('0x36')](_0x103bb1,_0x50f270),function(){});_0x290b08(_0x4a1d('0x3e'));});});}})[_0x4a1d('0x28')](function(){if(!_0x5a1aa2)return;rimraf(path[_0x4a1d('0x36')](_0x103bb1,_0x50f270),function(){});})[_0x4a1d('0x28')](function(){logger[_0x4a1d('0x3f')](util[_0x4a1d('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x5a1aa2?util[_0x4a1d('0x1b')](_0x4a1d('0x3b'),_0x50f270,_0x5a1aa2?_0x4a1d('0x3d'):_0x4a1d('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4a1d('0x3f')](util['format'](_0x4a1d('0x40'),EXTRACTED_REPORT_ID,_0x4a1d('0x41')));return db['AnalyticExtractedReport'][_0x4a1d('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4a1d('0x28')](function(_0x431027){EXTRACTED_REPORT=_0x431027;return dbH[_0x4a1d('0x2c')][_0x4a1d('0x2d')](util[_0x4a1d('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4a1d('0x2c')]['QueryTypes'][_0x4a1d('0x30')]});})['then'](extractReport)[_0x4a1d('0x43')](function(_0x7028a3){logger['info'](util['format'](_0x4a1d('0x44'),EXTRACTED_REPORT_ID,_0x4a1d('0x41')),util[_0x4a1d('0x45')](_0x7028a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4a1d('0x46'));})['finally'](function(){process[_0x4a1d('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb8cf0e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x4a1d('0x48'),'italics':__dirname+_0x4a1d('0x49'),'bolditalics':__dirname+_0x4a1d('0x4a')}});return _0xb8cf0e;}function getPDFDocDefinitionFromHTML(_0x493a10,_0x1b03fb){var _0x85d9ff=util[_0x4a1d('0x1b')](_0x4a1d('0x4b'),_0x1b03fb[_0x4a1d('0x4c')],_0x1b03fb[_0x4a1d('0x4d')]);var _0x264a65=moment()[_0x4a1d('0x1b')](_0x4a1d('0x4e'))[_0x4a1d('0x12')]();var _0xf83ed6=htmlToPdfmake(_0x493a10,{'window':window,'tableAutoSize':!![]});return{'content':[_0xf83ed6],'defaultStyle':{'font':_0x4a1d('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4a1d('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4a1d('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4a1d('0x50')}},'header':function(){return[{'text':_0x4a1d('0x51'),'style':_0x4a1d('0x1e')}];},'footer':function(_0x3aaa47,_0x23c73b){return[{'text':util[_0x4a1d('0x1b')](_0x4a1d('0x52'),_0x85d9ff,_0x3aaa47,_0x23c73b,_0x264a65),'style':_0x4a1d('0x23')}];}};}function writePDFDocument(_0xd4af4f,_0x28afd4){return new Promise(function(_0x5a309b,_0x35664b){var _0x501160=_0xd4af4f[_0x4a1d('0x53')](fs['createWriteStream'](_0x28afd4));_0x501160['on'](_0x4a1d('0x54'),function(){_0x5a309b(_0x4a1d('0x54'));});_0x501160['on'](_0x4a1d('0x55'),function(_0x5f1f6f){_0x35664b(_0x5f1f6f);});_0xd4af4f[_0x4a1d('0x56')]();});}exports[_0x4a1d('0x57')]=function(_0x57d23e,_0x14b887){var _0xa877a1=getPDFPrinter();var _0x1df51c=getPDFDocDefinitionFromHTML(_0x57d23e,_0x14b887);var _0x10c38a=_0xa877a1['createPdfKitDocument'](_0x1df51c);return writePDFDocument(_0x10c38a,_0x14b887[_0x4a1d('0x1')])[_0x4a1d('0x43')](function(_0x4afa6f){throw _0x4afa6f;});}; \ No newline at end of file +var _0x4928=['pick','value','fill','length','auto','push','body','concat','chunk','forEach','startDate','endDate','format','header','pageBreak','before','margin','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','PDF','Completed','info','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','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','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','pipe','finish','error','end','path','util','moment','pdfmake/src/printer','rimraf','jsdom','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader'];(function(_0x509591,_0x44e00c){var _0x11057a=function(_0x44feb8){while(--_0x44feb8){_0x509591['push'](_0x509591['shift']());}};_0x11057a(++_0x44e00c);}(_0x4928,0x150));var _0x8492=function(_0x166295,_0x53dd58){_0x166295=_0x166295-0x0;var _0x4fa42a=_0x4928[_0x166295];return _0x4fa42a;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x8492('0x0'));var path=require('path');var moment=require(_0x8492('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x8492('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x8492('0x3'));var JSDOM=require(_0x8492('0x4'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x8492('0x5'))['db'];var dbH=require('../../mysqldb')[_0x8492('0x6')];var logger=require(_0x8492('0x7'))(_0x8492('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8492('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x8492('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b9556,_0x265f3a){var _0xbc80dd={'status':_0x3b9556};var _0x566ae3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x265f3a){_0xbc80dd[_0x8492('0xb')]=_0x265f3a;}return db[_0x8492('0xc')][_0x8492('0xd')](_0xbc80dd,_0x566ae3);}function getHeaders(_0x3eab71){return _[_0x8492('0xe')](_0x3eab71,function(_0x146d2d){return{'text':_0x146d2d,'style':_0x8492('0xf')};});}function getRows(_0x249cbc,_0xe2d28){return _[_0x8492('0xe')](_0xe2d28,function(_0x14bbd0){return _(_0x14bbd0)[_0x8492('0x10')](_0x249cbc)[_0x8492('0xe')](function(_0x1877a1){return _0x1877a1?_['toString'](_0x1877a1):'';})[_0x8492('0x11')]();});}function createTable(_0x5a3ab1,_0x2bb932){var _0x3cf8d9={'widths':_[_0x8492('0x12')](Array(_0x5a3ab1[_0x8492('0x13')]),0x91),'heights':function(_0x43ad58){return _0x43ad58===0x0?_0x8492('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x41fe6d=getHeaders(_0x5a3ab1);_0x3cf8d9['body'][_0x8492('0x15')](_0x41fe6d);var _0x1f4cfa=getRows(_0x5a3ab1,_0x2bb932);_0x3cf8d9[_0x8492('0x16')]=_0x3cf8d9[_0x8492('0x16')][_0x8492('0x17')](_0x1f4cfa);return _0x3cf8d9;}function createTables(_0x185be3){var _0x1d3d70=[];var _0x2e6f6f=_[_0x8492('0x18')](Object['keys'](_0x185be3[0x0]),0x5);_0x2e6f6f[_0x8492('0x19')](function(_0xf7068c){_0x1d3d70[_0x8492('0x15')](createTable(_0xf7068c,_0x185be3));});return _0x1d3d70;}function getPDFDocDefinition(_0x2055c9){var _0x5df185=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x8492('0x1a')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x8492('0x1b')])[_0x8492('0x1c')](FORMAT));var _0xaa540e=[];for(var _0x3cccb4=0x0;_0x3cccb4<_0x2055c9[_0x8492('0x13')];_0x3cccb4++){var _0x286d3e=[];if(_0x3cccb4===0x0){_0x286d3e['push']({'text':_0x5df185,'style':_0x8492('0x1d')});}var _0x470eae={'table':_0x2055c9[_0x3cccb4]};if(_0x3cccb4>0x0){_0x470eae[_0x8492('0x1e')]=_0x8492('0x1f');_0x470eae[_0x8492('0x20')]=[0x0,0x46,0x0,0x0];}_0x286d3e['push'](_0x470eae);_0xaa540e['push'](_0x286d3e);}return{'pageSize':'A4','pageOrientation':_0x8492('0x21'),'content':_0xaa540e,'footer':function(_0xd29f70,_0x25dd9e){return{'text':_0xd29f70[_0x8492('0x22')]()+_0x8492('0x23')+_0x25dd9e,'style':_0x8492('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8492('0x25')},'footer':{'alignment':_0x8492('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3ecac4){var _0xc127a=0x1388;var _0x437acd;if(!_0x3ecac4[0x0][_0x8492('0x27')]){return analyticExtractedReport(_0x8492('0x28'));}return db[_0x8492('0x29')][_0x8492('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8492('0x2b')]})[_0x8492('0x2c')](function(_0xe953c9){if(_0xe953c9){_0x437acd=_0xe953c9;_0xc127a=_0x437acd[_0x8492('0x2b')]||0x3e8;}})[_0x8492('0x2c')](function(){var _0x1289bf=[];var _0x20aafa=0x0;if(_0x437acd[_0x8492('0x2d')]){if(_0x3ecac4&&_0x3ecac4[_0x8492('0x13')]){var _0x6096c4=_[_0x8492('0x2e')](_0x3ecac4[0x0][_0x8492('0x27')]/_0xc127a);var _0x5100de=Number['isInteger'](_0x3ecac4[0x0][_0x8492('0x27')]/_0xc127a)?_0x3ecac4[0x0]['num']%_0xc127a:0x0;_0x6096c4[_0x8492('0x19')](function(_0x163962){if(_0x163962>0x0){_0x20aafa+=_0xc127a;}_0x1289bf[_0x8492('0x15')](dbH[_0x8492('0x2f')]['query'](util[_0x8492('0x1c')](_0x8492('0x30'),QUERY,_0xc127a,_0x20aafa),{'type':dbH[_0x8492('0x2f')][_0x8492('0x31')][_0x8492('0x32')]}));});if(_0x5100de>0x0){_0x20aafa+=_0xc127a;_0x1289bf[_0x8492('0x15')](dbH[_0x8492('0x2f')][_0x8492('0x33')](util[_0x8492('0x1c')](_0x8492('0x30'),QUERY,_0x5100de,_0x20aafa),{'type':dbH[_0x8492('0x2f')][_0x8492('0x31')][_0x8492('0x32')]}));}}}else{_0x1289bf[_0x8492('0x15')](dbH[_0x8492('0x2f')][_0x8492('0x33')](QUERY,{'type':dbH[_0x8492('0x2f')]['QueryTypes'][_0x8492('0x32')]}));}var _0x262645=path[_0x8492('0x34')](PATH);var _0x383f09=path[_0x8492('0x35')](PATH,'.pdf');var _0x440211=_0x437acd[_0x8492('0x2d')]&&_0x1289bf[_0x8492('0x13')]>0x1;var _0x13d36a=[];if(!fs[_0x8492('0x36')](path['join'](_0x262645,_0x383f09))&&_0x440211){fs['mkdirSync'](path[_0x8492('0x37')](_0x262645,_0x383f09));}return BPromise[_0x8492('0x38')](_0x1289bf,function(_0x44f46f){_0x13d36a['push'](_0x44f46f);})[_0x8492('0x2c')](function(){var _0x9492b9=[];for(var _0x5ee61b=0x0;_0x5ee61b<_0x13d36a[_0x8492('0x13')];_0x5ee61b+=0x1){var _0x366cae=_0x13d36a[_0x5ee61b];var _0x37447c=createTables(_[_0x8492('0x39')](_0x366cae));var _0x1ce4f5;var _0x53e4b9=getPDFDocDefinition(_0x37447c);var _0x553c24=getPDFPrinter();var _0x4ec604=_0x553c24[_0x8492('0x3a')](_0x53e4b9);if(_0x440211){_0x1ce4f5=path[_0x8492('0x37')](_0x262645,_0x383f09,util[_0x8492('0x1c')]('%s%d.%s',_0x383f09,_0x5ee61b,_0x8492('0x3b')));}else{_0x1ce4f5=path[_0x8492('0x37')](_0x262645,util[_0x8492('0x1c')](_0x8492('0x3c'),_0x383f09,_0x8492('0x3b')));}_0x9492b9['push'](writePDFDocument(_0x4ec604,_0x1ce4f5));}return Promise['all'](_0x9492b9);})['then'](function(){if(_0x440211){return new Promise(function(_0x2c3619){zipdir(path[_0x8492('0x37')](_0x262645,_0x383f09),{'saveTo':path[_0x8492('0x37')](_0x262645,util[_0x8492('0x1c')](_0x8492('0x3c'),_0x383f09,_0x8492('0x3d')))},function(){rimraf(path[_0x8492('0x37')](_0x262645,_0x383f09),function(){});_0x2c3619('zip\x20finished');});});}})[_0x8492('0x2c')](function(){if(!_0x440211)return;rimraf(path[_0x8492('0x37')](_0x262645,_0x383f09),function(){});})[_0x8492('0x2c')](function(){logger['info'](util[_0x8492('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8492('0x3e')));return analyticExtractedReport(_0x8492('0x3f'),_0x440211?util[_0x8492('0x1c')](_0x8492('0x3c'),_0x383f09,_0x440211?_0x8492('0x3d'):_0x8492('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8492('0x40')](util[_0x8492('0x1c')](_0x8492('0x41'),EXTRACTED_REPORT_ID,_0x8492('0x3e')));return db[_0x8492('0xc')][_0x8492('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8492('0x2c')](function(_0x3c8c06){EXTRACTED_REPORT=_0x3c8c06;return dbH[_0x8492('0x2f')][_0x8492('0x33')](util['format'](_0x8492('0x43'),QUERY),{'type':dbH['sequelize'][_0x8492('0x31')]['SELECT']});})[_0x8492('0x2c')](extractReport)[_0x8492('0x44')](function(_0x5857a8){logger[_0x8492('0x40')](util[_0x8492('0x1c')](_0x8492('0x45'),EXTRACTED_REPORT_ID,_0x8492('0x3e')),util[_0x8492('0x46')](_0x5857a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8492('0x47'));})[_0x8492('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x468990=new PdfPrinter({'Arial':{'normal':__dirname+_0x8492('0x49'),'bold':__dirname+_0x8492('0x4a'),'italics':__dirname+_0x8492('0x4b'),'bolditalics':__dirname+_0x8492('0x4c')}});return _0x468990;}function getPDFDocDefinitionFromHTML(_0xfddb9c,_0x421930){var _0x844fda=util['format']('%s\x20#%d',_0x421930['channel'],_0x421930[_0x8492('0x4d')]);var _0x57b242=moment()[_0x8492('0x1c')](_0x8492('0x4e'))[_0x8492('0x22')]();var _0x56280=htmlToPdfmake(_0xfddb9c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x56280],'defaultStyle':{'font':_0x8492('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8492('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8492('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8492('0x50')}},'header':function(){return[{'text':_0x8492('0x51'),'style':_0x8492('0x1d')}];},'footer':function(_0x814bd4,_0x533daf){return[{'text':util[_0x8492('0x1c')](_0x8492('0x52'),_0x844fda,_0x814bd4,_0x533daf,_0x57b242),'style':'footer'}];}};}function writePDFDocument(_0x11f9f6,_0x5c0433){return new Promise(function(_0x3c8e5d,_0x35881e){var _0x301ae7=_0x11f9f6[_0x8492('0x53')](fs['createWriteStream'](_0x5c0433));_0x301ae7['on'](_0x8492('0x54'),function(){_0x3c8e5d(_0x8492('0x54'));});_0x301ae7['on'](_0x8492('0x55'),function(_0x393314){_0x35881e(_0x393314);});_0x11f9f6[_0x8492('0x56')]();});}exports['createPdfFromHTML']=function(_0x2006e8,_0x476907){var _0x4298dc=getPDFPrinter();var _0x1101f3=getPDFDocDefinitionFromHTML(_0x2006e8,_0x476907);var _0x55af38=_0x4298dc[_0x8492('0x3a')](_0x1101f3);return writePDFDocument(_0x55af38,_0x476907[_0x8492('0x57')])[_0x8492('0x44')](function(_0x5a610c){throw _0x5a610c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1bdb4e6..04c3ad7 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 _0x9c3b=['QueryTypes','dirname','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','lodash','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x192877,_0x24e072){var _0x372899=function(_0xf621cc){while(--_0xf621cc){_0x192877['push'](_0x192877['shift']());}};_0x372899(++_0x24e072);}(_0x9c3b,0x12f));var _0xb9c3=function(_0x5bfee6,_0x3e9443){_0x5bfee6=_0x5bfee6-0x0;var _0x4aad05=_0x9c3b[_0x5bfee6];return _0x4aad05;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb9c3('0x0'));var fs=require('fs');var json2xls=require(_0xb9c3('0x1'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xb9c3('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb9c3('0x3'))[_0xb9c3('0x4')];var logger=require(_0xb9c3('0x5'))(_0xb9c3('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb9c3('0x7')][0x2]);var QUERY=process[_0xb9c3('0x7')][0x3];var PATH=process[_0xb9c3('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2329f8,_0x399dd7){var _0x5ad6a9={'status':_0x2329f8};var _0x513635={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x399dd7){_0x5ad6a9[_0xb9c3('0x8')]=_0x399dd7;}return db['AnalyticExtractedReport']['update'](_0x5ad6a9,_0x513635);}function main(){var _0x22df24=0x1388;var _0x310fab;logger[_0xb9c3('0x9')](util['format'](_0xb9c3('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xb9c3('0xb')][_0xb9c3('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb9c3('0xd'),_0xb9c3('0xe')]})[_0xb9c3('0xf')](function(_0x2e8561){if(_0x2e8561){_0x310fab=_0x2e8561;_0x22df24=_0x310fab[_0xb9c3('0xe')]||0x1388;}})[_0xb9c3('0xf')](function(){return dbH[_0xb9c3('0x10')][_0xb9c3('0x11')](util[_0xb9c3('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb9c3('0x10')]['QueryTypes'][_0xb9c3('0x13')]});})[_0xb9c3('0xf')](function(_0x2d8c4a){if(!_0x2d8c4a[0x0][_0xb9c3('0x14')]){return analyticExtractedReport('Empty');}var _0x9ccfe=[];var _0x1ecf02=0x0;if(_0x310fab[_0xb9c3('0xd')]){if(_0x2d8c4a&&_0x2d8c4a[_0xb9c3('0x15')]){var _0x3903aa=_[_0xb9c3('0x16')](_0x2d8c4a[0x0][_0xb9c3('0x14')]/_0x22df24);var _0x5f4c2e=Number[_0xb9c3('0x17')](_0x2d8c4a[0x0][_0xb9c3('0x14')]/_0x22df24)?_0x2d8c4a[0x0][_0xb9c3('0x14')]%_0x22df24:0x0;_0x3903aa['forEach'](function(_0x2343bc){if(_0x2343bc>0x0){_0x1ecf02+=_0x22df24;}_0x9ccfe[_0xb9c3('0x18')](dbH[_0xb9c3('0x10')][_0xb9c3('0x11')](util[_0xb9c3('0x12')](_0xb9c3('0x19'),QUERY,_0x22df24,_0x1ecf02),{'type':dbH[_0xb9c3('0x10')]['QueryTypes'][_0xb9c3('0x13')]}));});if(_0x5f4c2e>0x0){_0x1ecf02+=_0x22df24;_0x9ccfe['push'](dbH['sequelize'][_0xb9c3('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5f4c2e,_0x1ecf02),{'type':dbH['sequelize'][_0xb9c3('0x1a')][_0xb9c3('0x13')]}));}}}else{_0x9ccfe[_0xb9c3('0x18')](dbH[_0xb9c3('0x10')]['query'](QUERY,{'type':dbH['sequelize'][_0xb9c3('0x1a')][_0xb9c3('0x13')]}));}var _0x14933c=path[_0xb9c3('0x1b')](PATH);var _0x58a561=path['basename'](PATH,'.xlsx');var _0x67c226=_0x310fab[_0xb9c3('0xd')]&&_0x9ccfe['length']>0x1;var _0x916644=[];if(!fs[_0xb9c3('0x1c')](path['join'](_0x14933c,_0x58a561))&&_0x67c226){fs['mkdirSync'](path[_0xb9c3('0x1d')](_0x14933c,_0x58a561));}return BPromise[_0xb9c3('0x1e')](_0x9ccfe,function(_0x580ae8){_0x916644[_0xb9c3('0x18')](_0x580ae8);})[_0xb9c3('0xf')](function(){for(var _0x290918=0x0;_0x290918<_0x916644[_0xb9c3('0x15')];_0x290918+=0x1){var _0x42b024;var _0x286de4=_0x916644[_0x290918];if(_0x67c226){_0x42b024=path[_0xb9c3('0x1d')](_0x14933c,_0x58a561,util[_0xb9c3('0x12')](_0xb9c3('0x1f'),_0x58a561,_0x290918,_0xb9c3('0x20')));}else{_0x42b024=path['join'](_0x14933c,util[_0xb9c3('0x12')](_0xb9c3('0x21'),_0x58a561,_0xb9c3('0x20')));}fs[_0xb9c3('0x22')](_0x42b024,json2xls(_0x286de4),_0xb9c3('0x23'));}})[_0xb9c3('0xf')](function(){if(_0x67c226){return new Promise(function(_0x27953b){zipdir(path[_0xb9c3('0x1d')](_0x14933c,_0x58a561),{'saveTo':path['join'](_0x14933c,util[_0xb9c3('0x12')]('%s.%s',_0x58a561,_0xb9c3('0x24')))},function(_0x124a8b,_0x163ba7){rimraf(path[_0xb9c3('0x1d')](_0x14933c,_0x58a561),function(){});_0x27953b(_0xb9c3('0x25'));});});}})['then'](function(){logger['info'](util['format'](_0xb9c3('0x26'),EXTRACTED_REPORT_ID,_0xb9c3('0x27')));return analyticExtractedReport(_0xb9c3('0x28'),_0x67c226?util[_0xb9c3('0x12')](_0xb9c3('0x21'),_0x58a561,_0x67c226?_0xb9c3('0x24'):_0xb9c3('0x20')):null);});})[_0xb9c3('0x29')](function(_0x4c3487){logger[_0xb9c3('0x9')](util[_0xb9c3('0x12')](_0xb9c3('0x2a'),EXTRACTED_REPORT_ID,_0xb9c3('0x27')),util[_0xb9c3('0x2b')](_0x4c3487,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb9c3('0x2c'));})[_0xb9c3('0x2d')](function(){process[_0xb9c3('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8c2e=['savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv'];(function(_0xf27a6d,_0x46bff2){var _0x25961f=function(_0x54d9d4){while(--_0x54d9d4){_0xf27a6d['push'](_0xf27a6d['shift']());}};_0x25961f(++_0x46bff2);}(_0x8c2e,0xec));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe8c2('0x0'));var path=require('path');var _=require(_0xe8c2('0x1'));var fs=require('fs');var json2xls=require(_0xe8c2('0x2'));var BPromise=require(_0xe8c2('0x3'));var zipdir=require(_0xe8c2('0x4'));var rimraf=require(_0xe8c2('0x5'));var db=require(_0xe8c2('0x6'))['db'];var dbH=require(_0xe8c2('0x6'))[_0xe8c2('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe8c2('0x8')][0x2]);var QUERY=process[_0xe8c2('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1600c6,_0x4b3318){var _0x3f191a={'status':_0x1600c6};var _0x18543c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b3318){_0x3f191a[_0xe8c2('0x9')]=_0x4b3318;}return db['AnalyticExtractedReport'][_0xe8c2('0xa')](_0x3f191a,_0x18543c);}function main(){var _0x952219=0x1388;var _0x4e0299;logger[_0xe8c2('0xb')](util[_0xe8c2('0xc')](_0xe8c2('0xd'),EXTRACTED_REPORT_ID,_0xe8c2('0xe')));return db[_0xe8c2('0xf')][_0xe8c2('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x2088a1){if(_0x2088a1){_0x4e0299=_0x2088a1;_0x952219=_0x4e0299['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xe8c2('0x11')][_0xe8c2('0x12')](util[_0xe8c2('0xc')](_0xe8c2('0x13'),QUERY),{'type':dbH['sequelize'][_0xe8c2('0x14')][_0xe8c2('0x15')]});})[_0xe8c2('0x16')](function(_0x177f23){if(!_0x177f23[0x0][_0xe8c2('0x17')]){return analyticExtractedReport(_0xe8c2('0x18'));}var _0x3e797b=[];var _0x334767=0x0;if(_0x4e0299['split']){if(_0x177f23&&_0x177f23['length']){var _0x3b4c16=_['range'](_0x177f23[0x0]['num']/_0x952219);var _0x2cb7ec=Number[_0xe8c2('0x19')](_0x177f23[0x0]['num']/_0x952219)?_0x177f23[0x0][_0xe8c2('0x17')]%_0x952219:0x0;_0x3b4c16[_0xe8c2('0x1a')](function(_0x4fed86){if(_0x4fed86>0x0){_0x334767+=_0x952219;}_0x3e797b[_0xe8c2('0x1b')](dbH[_0xe8c2('0x11')][_0xe8c2('0x12')](util[_0xe8c2('0xc')](_0xe8c2('0x1c'),QUERY,_0x952219,_0x334767),{'type':dbH[_0xe8c2('0x11')][_0xe8c2('0x14')][_0xe8c2('0x15')]}));});if(_0x2cb7ec>0x0){_0x334767+=_0x952219;_0x3e797b['push'](dbH[_0xe8c2('0x11')][_0xe8c2('0x12')](util[_0xe8c2('0xc')](_0xe8c2('0x1c'),QUERY,_0x2cb7ec,_0x334767),{'type':dbH[_0xe8c2('0x11')][_0xe8c2('0x14')][_0xe8c2('0x15')]}));}}}else{_0x3e797b['push'](dbH[_0xe8c2('0x11')][_0xe8c2('0x12')](QUERY,{'type':dbH[_0xe8c2('0x11')]['QueryTypes'][_0xe8c2('0x15')]}));}var _0x4f767a=path[_0xe8c2('0x1d')](PATH);var _0x3f74c6=path[_0xe8c2('0x1e')](PATH,_0xe8c2('0x1f'));var _0x1ad307=_0x4e0299['split']&&_0x3e797b[_0xe8c2('0x20')]>0x1;var _0x142d36=[];if(!fs[_0xe8c2('0x21')](path[_0xe8c2('0x22')](_0x4f767a,_0x3f74c6))&&_0x1ad307){fs[_0xe8c2('0x23')](path[_0xe8c2('0x22')](_0x4f767a,_0x3f74c6));}return BPromise[_0xe8c2('0x24')](_0x3e797b,function(_0x55298e){_0x142d36[_0xe8c2('0x1b')](_0x55298e);})[_0xe8c2('0x16')](function(){for(var _0xf9fde9=0x0;_0xf9fde9<_0x142d36[_0xe8c2('0x20')];_0xf9fde9+=0x1){var _0x535c12;var _0x4f62e6=_0x142d36[_0xf9fde9];if(_0x1ad307){_0x535c12=path['join'](_0x4f767a,_0x3f74c6,util[_0xe8c2('0xc')](_0xe8c2('0x25'),_0x3f74c6,_0xf9fde9,_0xe8c2('0x26')));}else{_0x535c12=path[_0xe8c2('0x22')](_0x4f767a,util['format']('%s.%s',_0x3f74c6,_0xe8c2('0x26')));}fs[_0xe8c2('0x27')](_0x535c12,json2xls(_0x4f62e6),_0xe8c2('0x28'));}})[_0xe8c2('0x16')](function(){if(_0x1ad307){return new Promise(function(_0x2f8185){zipdir(path[_0xe8c2('0x22')](_0x4f767a,_0x3f74c6),{'saveTo':path['join'](_0x4f767a,util[_0xe8c2('0xc')](_0xe8c2('0x29'),_0x3f74c6,_0xe8c2('0x2a')))},function(_0x287ca6,_0x128d43){rimraf(path[_0xe8c2('0x22')](_0x4f767a,_0x3f74c6),function(){});_0x2f8185(_0xe8c2('0x2b'));});});}})[_0xe8c2('0x16')](function(){logger['info'](util[_0xe8c2('0xc')](_0xe8c2('0x2c'),EXTRACTED_REPORT_ID,_0xe8c2('0xe')));return analyticExtractedReport('Completed',_0x1ad307?util[_0xe8c2('0xc')](_0xe8c2('0x29'),_0x3f74c6,_0x1ad307?'zip':_0xe8c2('0x26')):null);});})['catch'](function(_0x44df0a){logger['info'](util[_0xe8c2('0xc')](_0xe8c2('0x2d'),EXTRACTED_REPORT_ID,_0xe8c2('0xe')),util[_0xe8c2('0x2e')](_0x44df0a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe8c2('0x2f'));})[_0xe8c2('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ad5fec6..6408608 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 _0xd066=['XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','models','Interval','intervals','VoiceExtension','findAll','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','context','inbound','Set','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x399244,_0x19f481){var _0x5d39b2=function(_0x40b4bf){while(--_0x40b4bf){_0x399244['push'](_0x399244['shift']());}};_0x5d39b2(++_0x19f481);}(_0xd066,0x179));var _0x6d06=function(_0x5b52fb,_0x11b2e7){_0x5b52fb=_0x5b52fb-0x0;var _0xa941be=_0xd066[_0x5b52fb];return _0xa941be;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x87f393,_0x2626ca){var _0x253b11=this;return _0x87f393[_0x6d06('0x0')][_0x6d06('0x1')]['findAll']({'raw':!![]})['then'](function(_0x5c0314){_0x253b11[_0x6d06('0x2')]=_0x5c0314;return _0x87f393[_0x6d06('0x0')][_0x6d06('0x3')][_0x6d06('0x4')]({'where':{'IntervalId':_0x2626ca[_0x6d06('0x5')]},'raw':!![]});})[_0x6d06('0x6')](function(_0x2de675){return _0x87f393['models'][_0x6d06('0x3')][_0x6d06('0x4')]({'where':{'exten':{'$in':_[_0x6d06('0x7')](_[_0x6d06('0x8')](_0x2de675,_0x6d06('0x9')))}},'order':[{'raw':_0x6d06('0xa')}],'raw':!![]});})[_0x6d06('0x6')](function(_0x5aa8ff){var _0xefcca7=_[_0x6d06('0xb')](_0x5aa8ff,{'priority':'1'});var _0x35e6b4=_[_0x6d06('0xb')](_0x5aa8ff,{'isApp':0x1});var _0x2bc654=_[_0x6d06('0xc')](_0x35e6b4,_0x6d06('0x9'));var _0x55a44d=[_0x6d06('0xd'),_0x6d06('0xe')];var _0x4b4132=[];var _0xda71ff=[];for(var _0x3171fe in _0x2bc654){if(_0x2bc654[_0x6d06('0xf')](_0x3171fe)){_0x253b11[_0x6d06('0x10')]=0x2;_0x253b11[_0x6d06('0x11')]=[];_0x253b11[_0x6d06('0x12')]=_['find'](_0xefcca7,{'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')]});_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0]['type'],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')]),'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11['priority']++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0]['VoiceExtensionId']});if(_0x2bc654[_0x3171fe][0x0]['type']===_0x6d06('0x16')){_0x253b11['extensions'][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':'CDR(routeid)='+_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')],'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0]['VoiceExtensionId']});}else if(_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')]===_0x6d06('0x19')){if(_0x253b11[_0x6d06('0x12')]){_0x253b11[_0x6d06('0x11')]['push']({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x1a')+(_0x253b11['extension'][_0x6d06('0x1b')]?'${EXTEN:'+_0x253b11[_0x6d06('0x12')][_0x6d06('0x1b')]+'}':_0x6d06('0x1c')),'context':_0x2bc654[_0x3171fe][0x0]['context'],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0]['VoiceExtensionId']});}_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x1d')+_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')],'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});var _0x52bd18=_0x253b11[_0x6d06('0x10')]++;_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x52bd18+0x2)+_0x6d06('0x1e')+(_0x52bd18+0x1)+')','context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0]['exten'],'priority':_0x52bd18,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});if(_0x253b11['extension']){_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':'Set','appdata':_0x253b11[_0x6d06('0x12')][_0x6d06('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x253b11[_0x6d06('0x12')][_0x6d06('0x1b')]+'}':_0x6d06('0x1f'),'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});}_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0]['type'],'app':_0x6d06('0x17'),'appdata':'outboundrouteid='+_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')],'context':_0x2bc654[_0x3171fe][0x0]['context'],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11['priority']++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0]['VoiceExtensionId']});if(_0x253b11[_0x6d06('0x12')]&&_0x253b11['extension'][_0x6d06('0xf')](_0x6d06('0x20'))&&_0x253b11['extension'][_0x6d06('0x20')]!==_0x6d06('0x21')){_0x253b11['extensions'][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':'Set','appdata':_0x6d06('0x22'),'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});_0x253b11[_0x6d06('0x11')]['push']({'type':_0x2bc654[_0x3171fe][0x0]['type'],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x23')+_0x253b11['extension'][_0x6d06('0x20')]||_0x6d06('0x24'),'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11['priority']++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});}}_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11['priority']++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});_0x253b11[_0x6d06('0x11')][_0x6d06('0x13')]({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x25'),'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'priority':_0x253b11[_0x6d06('0x10')]++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});_0x253b11[_0x6d06('0x11')]['push']({'type':_0x2bc654[_0x3171fe][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'exten':_0x2bc654[_0x3171fe][0x0]['exten'],'priority':_0x253b11['priority']++,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});for(var _0x32284d=0x0,_0x11a806=0x0;_0x32284d<_0x2bc654[_0x3171fe][_0x6d06('0x26')];_0x32284d+=0x1,_0x11a806=0x0){var _0x55d61c=_0x2bc654[_0x3171fe][_0x32284d];if(_0x55d61c[_0x6d06('0x14')]){_0x55d61c[_0x6d06('0x14')]=_0x55d61c[_0x6d06('0x14')]['toLowerCase']();}var _0x53709b=[];var _0x3177c7=[];delete _0x55d61c['id'];delete _0x55d61c[_0x6d06('0x27')];delete _0x55d61c[_0x6d06('0x28')];var _0x57dd69=_0x55d61c['interval']!==_0x6d06('0x29')?[_0x55d61c['interval']]:_0x55d61c['IntervalId']?_[_0x6d06('0x8')](_[_0x6d06('0xb')](_0x253b11['intervals'],{'IntervalId':_0x55d61c[_0x6d06('0x5')]}),_0x6d06('0x2a')):[];if(_0x55d61c[_0x6d06('0xf')](_0x6d06('0x2b'))){if(_0x55d61c['tag']&&_0x55d61c[_0x6d06('0x2b')]!=='--'){_0x53709b['push']({'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x2c')+_0x55d61c[_0x6d06('0x2b')],'context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c[_0x6d06('0x9')],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});}}if(_0x55d61c[_0x6d06('0x14')]==='outbound'&&_0x55d61c[_0x6d06('0xf')]('callerID')){if(_0x55d61c[_0x6d06('0x2d')]){_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x2e'),'appdata':_0x6d06('0x2f')+_0x55d61c[_0x6d06('0x2d')]+')','context':_0x55d61c['context'],'exten':_0x55d61c['exten'],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});}else{_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c['type'],'app':_0x6d06('0x2e'),'appdata':_0x6d06('0x30'),'context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c[_0x6d06('0x9')],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11['priority']+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});}}if(_0x55d61c[_0x6d06('0xf')](_0x6d06('0x31'))){if(_0x55a44d[_0x6d06('0x32')](_0x55d61c[_0x6d06('0x33')][_0x6d06('0x34')]())>=0x0&&_0x55d61c[_0x6d06('0x35')]!==_0x6d06('0x36')){if(_0x55d61c[_0x6d06('0x31')]){_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x2e'),'appdata':_0x6d06('0x37'),'context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c[_0x6d06('0x9')],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c['VoiceExtensionId']});_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':_0x6d06('0x38'),'context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c[_0x6d06('0x9')],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});}else{_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c['type'],'app':_0x6d06('0x2e'),'appdata':_0x6d06('0x39'),'context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c['exten'],'priority':_0x57dd69[_0x6d06('0x26')]+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});_0x53709b[_0x6d06('0x13')]({'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x55d61c[_0x6d06('0x15')],'exten':_0x55d61c[_0x6d06('0x9')],'priority':_0x57dd69['length']+_0x253b11[_0x6d06('0x10')]+_0x11a806++,'VoiceExtensionId':_0x55d61c[_0x6d06('0x18')]});}}}for(var _0x579ac6=0x0;_0x579ac6<_0x57dd69[_0x6d06('0x26')];_0x579ac6+=0x1){var _0x19719e=_0x253b11['priority']+_0x57dd69[_0x6d06('0x26')];var _0x5b2bfa=_0x579ac6===_0x57dd69['length']-0x1?_0x253b11[_0x6d06('0x10')]+_0x53709b[_0x6d06('0x26')]+_0x3177c7[_0x6d06('0x26')]+0x2:_0x253b11['priority']+_0x579ac6+0x1;_0x53709b[_0x6d06('0x3a')](_0x579ac6,0x0,{'type':_0x55d61c[_0x6d06('0x14')],'app':_0x6d06('0x3b'),'appdata':_0x57dd69[_0x579ac6]+'?'+_0x55d61c[_0x6d06('0x15')]+',${EXTEN},'+_0x19719e+':'+_0x55d61c[_0x6d06('0x15')]+_0x6d06('0x3c')+_0x5b2bfa,'exten':_0x55d61c[_0x6d06('0x9')],'context':_0x55d61c[_0x6d06('0x15')],'priority':_0x253b11[_0x6d06('0x10')]+_0x579ac6,'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});}_0x55d61c[_0x6d06('0x10')]=_0x53709b[_0x6d06('0x26')]?_[_0x6d06('0x3d')](_0x53709b)['priority']+0x1:_0x253b11[_0x6d06('0x10')];_0x253b11[_0x6d06('0x10')]=(_0x3177c7['length']?_[_0x6d06('0x3d')](_0x3177c7)[_0x6d06('0x10')]:_0x55d61c['priority'])+0x1;_0x253b11[_0x6d06('0x11')]=_[_0x6d06('0x3e')](_0x253b11[_0x6d06('0x11')],_0x53709b,[_0x55d61c],_0x3177c7);}_0x253b11[_0x6d06('0x11')]['push']({'type':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x14')],'app':'Hangup','exten':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x9')],'context':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x15')],'priority':_0x253b11[_0x6d06('0x10')],'VoiceExtensionId':_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]});_0x4b4132['push'](_0x2bc654[_0x3171fe][0x0][_0x6d06('0x18')]);_0xda71ff=_[_0x6d06('0x3e')](_0xda71ff,_0x253b11['extensions']);}}return _0x87f393['transaction'](function(_0x34951c){return _0x87f393[_0x6d06('0x0')][_0x6d06('0x3')][_0x6d06('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4b4132}},'transaction':_0x34951c})[_0x6d06('0x6')](function(_0x4a6f9e){return _0x87f393[_0x6d06('0x0')][_0x6d06('0x3')][_0x6d06('0x40')](_[_0x6d06('0x41')](_0xda71ff,_0x6d06('0x10')),{'transaction':_0x34951c});});});})[_0x6d06('0x42')](function(_0x46a154){console[_0x6d06('0x43')](_0x46a154);});}exports[_0x6d06('0x44')]=rewrite; \ No newline at end of file +var _0xe9e6=['playback','hasOwnProperty','priority','extensions','find','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','extension','Set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','IntervalId','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','last','concat','destroy','bulkCreate','sortBy','catch','error','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','filter','queue'];(function(_0x313e0e,_0x3cb8f3){var _0x2c74e0=function(_0x316a33){while(--_0x316a33){_0x313e0e['push'](_0x313e0e['shift']());}};_0x2c74e0(++_0x3cb8f3);}(_0xe9e6,0x7e));var _0x6e9e=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0xe9e6[_0x5e8282];return _0x5cd37d;};'use strict';var _=require(_0x6e9e('0x0'));var util=require('util');function rewrite(_0x56feb7,_0xec1b02){var _0x37a5b4=this;return _0x56feb7[_0x6e9e('0x1')][_0x6e9e('0x2')][_0x6e9e('0x3')]({'raw':!![]})[_0x6e9e('0x4')](function(_0x3dd7ec){_0x37a5b4[_0x6e9e('0x5')]=_0x3dd7ec;return _0x56feb7[_0x6e9e('0x1')][_0x6e9e('0x6')][_0x6e9e('0x3')]({'where':{'IntervalId':_0xec1b02['IntervalId']},'raw':!![]});})['then'](function(_0x32b516){return _0x56feb7[_0x6e9e('0x1')][_0x6e9e('0x6')][_0x6e9e('0x3')]({'where':{'exten':{'$in':_[_0x6e9e('0x7')](_[_0x6e9e('0x8')](_0x32b516,_0x6e9e('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x6e9e('0x4')](function(_0x26a6d3){var _0x20726b=_[_0x6e9e('0xa')](_0x26a6d3,{'priority':'1'});var _0x4186eb=_[_0x6e9e('0xa')](_0x26a6d3,{'isApp':0x1});var _0xbc7f5e=_['groupBy'](_0x4186eb,'exten');var _0x5f3131=[_0x6e9e('0xb'),_0x6e9e('0xc')];var _0x4eb9ef=[];var _0x133c77=[];for(var _0x47f209 in _0xbc7f5e){if(_0xbc7f5e[_0x6e9e('0xd')](_0x47f209)){_0x37a5b4[_0x6e9e('0xe')]=0x2;_0x37a5b4[_0x6e9e('0xf')]=[];_0x37a5b4['extension']=_[_0x6e9e('0x10')](_0x20726b,{'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')]});_0x37a5b4[_0x6e9e('0xf')]['push']({'type':_0xbc7f5e[_0x47f209][0x0]['type'],'app':'Set','appdata':util[_0x6e9e('0x11')](_0x6e9e('0x12'),_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')]),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});if(_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')]===_0x6e9e('0x16')){_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':'Set','appdata':_0x6e9e('0x18')+_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')],'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});}else if(_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')]===_0x6e9e('0x19')){if(_0x37a5b4[_0x6e9e('0x1a')]){_0x37a5b4['extensions'][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x1c')+(_0x37a5b4[_0x6e9e('0x1a')]['cutdigits']?_0x6e9e('0x1d')+_0x37a5b4[_0x6e9e('0x1a')][_0x6e9e('0x1e')]+'}':_0x6e9e('0x1f')),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});}_0x37a5b4[_0x6e9e('0xf')]['push']({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x18')+_0xbc7f5e[_0x47f209][0x0]['VoiceExtensionId'],'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0]['exten'],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});var _0x586f9f=_0x37a5b4[_0x6e9e('0xe')]++;_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x20'),'appdata':_0x6e9e('0x21')+(_0x586f9f+0x2)+_0x6e9e('0x22')+(_0x586f9f+0x1)+')','context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x586f9f,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});if(_0x37a5b4[_0x6e9e('0x1a')]){_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':'Set','appdata':_0x37a5b4['extension']['cutdigits']?_0x6e9e('0x23')+_0x37a5b4[_0x6e9e('0x1a')][_0x6e9e('0x1e')]+'}':_0x6e9e('0x24'),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});}_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0]['type'],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x25')+_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')],'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});if(_0x37a5b4[_0x6e9e('0x1a')]&&_0x37a5b4[_0x6e9e('0x1a')][_0x6e9e('0xd')](_0x6e9e('0x26'))&&_0x37a5b4[_0x6e9e('0x1a')][_0x6e9e('0x26')]!==_0x6e9e('0x27')){_0x37a5b4['extensions'][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x28'),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});_0x37a5b4[_0x6e9e('0xf')]['push']({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':'Set','appdata':_0x6e9e('0x29')+_0x37a5b4[_0x6e9e('0x1a')][_0x6e9e('0x26')]||_0x6e9e('0x2a'),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4['priority']++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});}}_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x2b'),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4['priority']++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0]['VoiceExtensionId']});_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4[_0x6e9e('0xe')]++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0]['VoiceExtensionId']});_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0]['type'],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x2c'),'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'priority':_0x37a5b4['priority']++,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});for(var _0x52adc3=0x0,_0x325e7a=0x0;_0x52adc3<_0xbc7f5e[_0x47f209]['length'];_0x52adc3+=0x1,_0x325e7a=0x0){var _0x2c33b2=_0xbc7f5e[_0x47f209][_0x52adc3];if(_0x2c33b2['type']){_0x2c33b2['type']=_0x2c33b2[_0x6e9e('0x13')]['toLowerCase']();}var _0xcf2c90=[];var _0x3be2f7=[];delete _0x2c33b2['id'];delete _0x2c33b2[_0x6e9e('0x2d')];delete _0x2c33b2[_0x6e9e('0x2e')];var _0x14214b=_0x2c33b2['interval']!=='*,*,*,*'?[_0x2c33b2[_0x6e9e('0x2f')]]:_0x2c33b2[_0x6e9e('0x30')]?_[_0x6e9e('0x8')](_['filter'](_0x37a5b4[_0x6e9e('0x5')],{'IntervalId':_0x2c33b2[_0x6e9e('0x30')]}),_0x6e9e('0x2f')):[];if(_0x2c33b2[_0x6e9e('0xd')](_0x6e9e('0x31'))){if(_0x2c33b2[_0x6e9e('0x31')]&&_0x2c33b2['tag']!=='--'){_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':'CDR(tag)='+_0x2c33b2['tag'],'context':_0x2c33b2[_0x6e9e('0x14')],'exten':_0x2c33b2['exten'],'priority':_0x14214b[_0x6e9e('0x32')]+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2[_0x6e9e('0x15')]});}}if(_0x2c33b2['type']===_0x6e9e('0x19')&&_0x2c33b2[_0x6e9e('0xd')](_0x6e9e('0x33'))){if(_0x2c33b2[_0x6e9e('0x33')]){_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x20'),'appdata':_0x6e9e('0x34')+_0x2c33b2[_0x6e9e('0x33')]+')','context':_0x2c33b2[_0x6e9e('0x14')],'exten':_0x2c33b2[_0x6e9e('0x9')],'priority':_0x14214b['length']+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2['VoiceExtensionId']});}else{_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2c33b2[_0x6e9e('0x14')],'exten':_0x2c33b2['exten'],'priority':_0x14214b['length']+_0x37a5b4['priority']+_0x325e7a++,'VoiceExtensionId':_0x2c33b2[_0x6e9e('0x15')]});}}if(_0x2c33b2[_0x6e9e('0xd')](_0x6e9e('0x35'))){if(_0x5f3131[_0x6e9e('0x36')](_0x2c33b2['app']['toLowerCase']())>=0x0&&_0x2c33b2[_0x6e9e('0x37')]!==_0x6e9e('0x38')){if(_0x2c33b2['answer']){_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x20'),'appdata':_0x6e9e('0x39'),'context':_0x2c33b2[_0x6e9e('0x14')],'exten':_0x2c33b2[_0x6e9e('0x9')],'priority':_0x14214b[_0x6e9e('0x32')]+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2[_0x6e9e('0x15')]});_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x3a'),'context':_0x2c33b2['context'],'exten':_0x2c33b2[_0x6e9e('0x9')],'priority':_0x14214b[_0x6e9e('0x32')]+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2['VoiceExtensionId']});}else{_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':'ExecIf','appdata':_0x6e9e('0x3b'),'context':_0x2c33b2[_0x6e9e('0x14')],'exten':_0x2c33b2[_0x6e9e('0x9')],'priority':_0x14214b['length']+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2[_0x6e9e('0x15')]});_0xcf2c90[_0x6e9e('0x17')]({'type':_0x2c33b2[_0x6e9e('0x13')],'app':_0x6e9e('0x1b'),'appdata':_0x6e9e('0x3c'),'context':_0x2c33b2['context'],'exten':_0x2c33b2['exten'],'priority':_0x14214b[_0x6e9e('0x32')]+_0x37a5b4[_0x6e9e('0xe')]+_0x325e7a++,'VoiceExtensionId':_0x2c33b2['VoiceExtensionId']});}}}for(var _0x59cfa7=0x0;_0x59cfa7<_0x14214b['length'];_0x59cfa7+=0x1){var _0x105f65=_0x37a5b4[_0x6e9e('0xe')]+_0x14214b[_0x6e9e('0x32')];var _0x274101=_0x59cfa7===_0x14214b[_0x6e9e('0x32')]-0x1?_0x37a5b4[_0x6e9e('0xe')]+_0xcf2c90[_0x6e9e('0x32')]+_0x3be2f7[_0x6e9e('0x32')]+0x2:_0x37a5b4[_0x6e9e('0xe')]+_0x59cfa7+0x1;_0xcf2c90[_0x6e9e('0x3d')](_0x59cfa7,0x0,{'type':_0x2c33b2['type'],'app':'GotoIfTime','appdata':_0x14214b[_0x59cfa7]+'?'+_0x2c33b2[_0x6e9e('0x14')]+',${EXTEN},'+_0x105f65+':'+_0x2c33b2['context']+',${EXTEN},'+_0x274101,'exten':_0x2c33b2[_0x6e9e('0x9')],'context':_0x2c33b2[_0x6e9e('0x14')],'priority':_0x37a5b4['priority']+_0x59cfa7,'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});}_0x2c33b2[_0x6e9e('0xe')]=_0xcf2c90[_0x6e9e('0x32')]?_[_0x6e9e('0x3e')](_0xcf2c90)['priority']+0x1:_0x37a5b4[_0x6e9e('0xe')];_0x37a5b4[_0x6e9e('0xe')]=(_0x3be2f7[_0x6e9e('0x32')]?_['last'](_0x3be2f7)[_0x6e9e('0xe')]:_0x2c33b2['priority'])+0x1;_0x37a5b4['extensions']=_[_0x6e9e('0x3f')](_0x37a5b4['extensions'],_0xcf2c90,[_0x2c33b2],_0x3be2f7);}_0x37a5b4[_0x6e9e('0xf')][_0x6e9e('0x17')]({'type':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x13')],'app':'Hangup','exten':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x9')],'context':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x14')],'priority':_0x37a5b4[_0x6e9e('0xe')],'VoiceExtensionId':_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]});_0x4eb9ef[_0x6e9e('0x17')](_0xbc7f5e[_0x47f209][0x0][_0x6e9e('0x15')]);_0x133c77=_[_0x6e9e('0x3f')](_0x133c77,_0x37a5b4[_0x6e9e('0xf')]);}}return _0x56feb7['transaction'](function(_0x467e53){return _0x56feb7[_0x6e9e('0x1')]['VoiceExtension'][_0x6e9e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4eb9ef}},'transaction':_0x467e53})[_0x6e9e('0x4')](function(_0x2c2d1c){return _0x56feb7['models'][_0x6e9e('0x6')][_0x6e9e('0x41')](_[_0x6e9e('0x42')](_0x133c77,'priority'),{'transaction':_0x467e53});});});})[_0x6e9e('0x43')](function(_0x33850f){console[_0x6e9e('0x44')](_0x33850f);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ca67539..a62b356 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 _0x861e=['resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parse\x20error','bluebird','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','phone','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','get','dialCheckDuplicateType','always','push','query','VoiceQueueId','onlyIfOpen','sequelize','all','outbound','CmList','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_'];(function(_0x2fd3d7,_0x52ca3d){var _0x790c8f=function(_0x23f264){while(--_0x23f264){_0x2fd3d7['push'](_0x2fd3d7['shift']());}};_0x790c8f(++_0x52ca3d);}(_0x861e,0xdf));var _0xe861=function(_0x4e726e,_0x311483){_0x4e726e=_0x4e726e-0x0;var _0x4d614a=_0x861e[_0x4e726e];return _0x4d614a;};'use strict';var BPromise=require(_0xe861('0x0'));var util=require(_0xe861('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xe861('0x2'));var Papa=require(_0xe861('0x3'));var Redis=require(_0xe861('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xe861('0x5'));var logger=require(_0xe861('0x6'))(_0xe861('0x7'));config[_0xe861('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe861('0x9'))(new Redis(config['redis']));require(_0xe861('0xa'))['register'](socket);try{if(!process[_0xe861('0xb')][0x2]||process[_0xe861('0xb')][0x2]==='undefined'||process[_0xe861('0xb')][0x2]===_0xe861('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xe861('0xb')][0x3]||process[_0xe861('0xb')][0x3]===_0xe861('0xd')||process['argv'][0x3]===_0xe861('0xc')||!process[_0xe861('0xb')][0x4]||process[_0xe861('0xb')][0x4]==='undefined'||process['argv'][0x4]===_0xe861('0xc')){throw new Error(_0xe861('0xe'));}var FIELDS=_[_0xe861('0xf')](process[_0xe861('0xb')][0x3]['split'](','),process[_0xe861('0xb')][0x4][_0xe861('0x10')](','));if(!process['argv'][0x5]||process[_0xe861('0xb')][0x5]===_0xe861('0xd')||process[_0xe861('0xb')][0x5]===_0xe861('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xe861('0xb')][0x5];var COMPANYID=process[_0xe861('0xb')][0x6]&&process[_0xe861('0xb')][0x6]!==_0xe861('0xd')&&process['argv'][0x6]!==_0xe861('0xc')?process[_0xe861('0xb')][0x6]:null;var DUPLICATES=process[_0xe861('0xb')][0x7]&&process[_0xe861('0xb')][0x7]!==_0xe861('0xd')&&process[_0xe861('0xb')][0x7]!==_0xe861('0xc')?process[_0xe861('0xb')][0x7]:null;if(!process[_0xe861('0xb')][0x8]||process[_0xe861('0xb')][0x8]===_0xe861('0xd')||process[_0xe861('0xb')][0x8]==='null'){throw new Error(_0xe861('0x11'));}var SOCKET_TIMESTAMP=process[_0xe861('0xb')][0x8];}catch(_0x41c1d2){logger['error'](_0x41c1d2);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(_0x6af4f0,_0x12418e,_0xa3d73,_0x21cf22){var _0x4b3c6e={'message':_0x12418e};_0x4b3c6e[_0x6af4f0]=!![];if(_0xa3d73){_0x4b3c6e['contact']=_0xa3d73;}if(_0x21cf22){_0x4b3c6e[_0xe861('0x12')]=_0x21cf22;}return _0x4b3c6e;}function isEmail(_0xf854c){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))*$/[_0xe861('0x13')](_0xf854c);}function checkRow(_0x260827,_0x58069a,_0x33b150){return new BPromise(function(_0x4f7d13,_0xc4b912){if(_[_0xe861('0x14')](_0x260827)){return _0xc4b912(handleCheckRowError(_0xe861('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x33b150));}if(_0x260827[_0xe861('0x16')]&&_0x260827['errors'][_0xe861('0x17')]){var _0x2bccab=_[_0xe861('0x18')](_0x260827[_0xe861('0x16')],_0xe861('0x19'))['join'](';');return _0xc4b912(handleCheckRowError(_0xe861('0x15'),_0x2bccab,null,_0x33b150));}var _0x238989={};for(var _0x490613 in FIELDS){if(FIELDS[_0xe861('0x1a')](_0x490613)&&FIELDS[_0x490613]){_0x238989[_0x490613]=_0x260827[_0xe861('0x1b')][0x0][FIELDS[_0x490613]]||_0x260827[_0xe861('0x1b')][0x0]['\ufeff'+FIELDS[_0x490613]];}}if(!_0x238989[_0xe861('0x1c')]){return _0xc4b912(handleCheckRowError(_0xe861('0x15'),_0xe861('0x1d'),null,_0x33b150));}if(!_0x238989['phone']){return _0xc4b912(handleCheckRowError(_0xe861('0x15'),_0xe861('0x1e'),null,_0x33b150));}if(_0x238989[_0xe861('0x1f')]){var _0x42df44=moment(_0x238989[_0xe861('0x1f')],'YYYY-MM-DD');if(!_0x42df44[_0xe861('0x20')]()){return _0xc4b912(handleCheckRowError(_0xe861('0x15'),_0xe861('0x21'),null,_0x33b150));}}if(_0x238989[_0xe861('0x22')]){if(!isEmail(_0x238989['email'])){return _0xc4b912(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x33b150));}}_0x238989[_0xe861('0x23')]=LISTID;_0x238989[_0xe861('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x58069a){var _0x4fef86={};for(var _0x1ec037=0x0,_0x4d5783=DUPLICATES[_0xe861('0x17')];_0x1ec037<_0x4d5783;_0x1ec037+=0x1){_0x4fef86[DUPLICATES[_0x1ec037]]=_0x238989[DUPLICATES[_0x1ec037]];}var _0xa07bb9=_[_0xe861('0x25')](_0x58069a,_0x4fef86);if(_0xa07bb9){return _0xc4b912(handleCheckRowError(_0xe861('0x26'),_0xe861('0x27'),_0xa07bb9,_0x33b150));}}return db[_0xe861('0x28')][_0xe861('0x29')](_0x238989,{'raw':!![],'hooks':![],'fields':_[_0xe861('0x2a')](_0x238989)})[_0xe861('0x2b')](function(_0x83d7b6){if(DUPLICATES&&DUPLICATES['length']&&_0x58069a){_0x58069a['push'](_[_0xe861('0x2c')](_0x238989,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x83d7b6['id'];return _0x4f7d13();})[_0xe861('0x2d')](function(_0x16b6bd){return _0xc4b912(handleCheckRowError(_0xe861('0x15'),_0xe861('0x2e')+(_0x16b6bd[_0xe861('0x19')]||JSON[_0xe861('0x2f')](_0x16b6bd)),null,_0x33b150));});});}function checkHopper(){function _0x547bb9(){return function(_0x512893){logger[_0xe861('0x15')]('cmContact','checkHopper',util[_0xe861('0x30')](_0x512893,{'showHidden':![],'depth':null}));};}var _0x39f5ae=function(_0x3f92ed,_0x5279f5){var _0x34f8ba=squel[_0xe861('0x31')]()[_0xe861('0x32')](_0xe861('0x33'))[_0xe861('0x34')](['phone',_0xe861('0x35'),_0xe861('0x36'),_0xe861('0x23'),_0x5279f5,_0xe861('0x37'),_0xe861('0x38')],squel[_0xe861('0x39')]()[_0xe861('0x3a')](_0xe861('0x3b'),_0xe861('0x3b'))['field'](_0xe861('0x3c'),_0xe861('0x35'))[_0xe861('0x3a')]('id',_0xe861('0x36'))[_0xe861('0x3a')](LISTID[_0xe861('0x3d')](),_0xe861('0x23'))[_0xe861('0x3a')](_0x3f92ed['id'][_0xe861('0x3d')](),_0x5279f5)[_0xe861('0x3a')](_0xe861('0x3c'),_0xe861('0x37'))[_0xe861('0x3a')](_0xe861('0x3c'),'updatedAt')[_0xe861('0x3e')](_0xe861('0x3f'))[_0xe861('0x40')](_0xe861('0x41'))['where'](_0xe861('0x42'),LISTID[_0xe861('0x3d')]())[_0xe861('0x40')](_0xe861('0x43'))[_0xe861('0x40')](_0xe861('0x44'),squel[_0xe861('0x39')]()['field']('phone')['from'](_0xe861('0x33'))[_0xe861('0x40')](_0x5279f5+_0xe861('0x45'),_0x3f92ed['id']['toString']())))['toString']();return _0x34f8ba;};var _0x5cc80b=function(_0x347599,_0x19d385){var _0x2f8f58=squel[_0xe861('0x31')]()[_0xe861('0x32')]('cm_hopper')[_0xe861('0x34')]([_0xe861('0x3b'),_0xe861('0x35'),_0xe861('0x36'),_0xe861('0x23'),_0x19d385,_0xe861('0x37'),_0xe861('0x38')],squel[_0xe861('0x39')]()[_0xe861('0x3a')](_0xe861('0x3b'),_0xe861('0x3b'))['field'](_0xe861('0x3c'),_0xe861('0x35'))[_0xe861('0x3a')]('id','ContactId')['field'](LISTID[_0xe861('0x3d')](),_0xe861('0x23'))['field'](_0x347599['id']['toString'](),_0x19d385)[_0xe861('0x3a')](_0xe861('0x3c'),_0xe861('0x37'))['field'](_0xe861('0x3c'),_0xe861('0x38'))['from'](_0xe861('0x3f'))['where'](_0xe861('0x41'))['where'](_0xe861('0x42'),LISTID[_0xe861('0x3d')]())[_0xe861('0x40')]('id\x20IN\x20?',squel[_0xe861('0x46')](hopperContacts))[_0xe861('0x40')](_0xe861('0x43'))[_0xe861('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe861('0x39')]()[_0xe861('0x3a')]('calleridnum')[_0xe861('0x3e')]('cm_hopper_final')[_0xe861('0x40')](_0x19d385+'\x20=\x20?',_0x347599['id'][_0xe861('0x3d')]()))[_0xe861('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe861('0x39')]()[_0xe861('0x3a')]('phone')[_0xe861('0x3e')](_0xe861('0x33'))['where'](_0x19d385+_0xe861('0x45'),_0x347599['id'][_0xe861('0x3d')]())))[_0xe861('0x3d')]();return _0x2f8f58;};function _0xa71de0(_0x32da0f,_0x4ef817){var _0x3aa4b6=squel['insert']()['into'](_0xe861('0x33'))[_0xe861('0x34')]([_0xe861('0x3b'),_0xe861('0x35'),'ContactId',_0xe861('0x23'),_0x4ef817,_0xe861('0x37'),_0xe861('0x38')],squel[_0xe861('0x39')]()[_0xe861('0x3a')](_0xe861('0x3b'),_0xe861('0x3b'))['field'](_0xe861('0x3c'),_0xe861('0x35'))['field']('id',_0xe861('0x36'))['field'](LISTID[_0xe861('0x3d')](),_0xe861('0x23'))['field'](_0x32da0f['id'][_0xe861('0x3d')](),_0x4ef817)['field'](_0xe861('0x3c'),_0xe861('0x37'))['field'](_0xe861('0x3c'),'updatedAt')[_0xe861('0x3e')]('cm_contacts')['where'](_0xe861('0x41'))[_0xe861('0x40')](_0xe861('0x42'),LISTID['toString']())[_0xe861('0x40')](_0xe861('0x47'),squel['str'](hopperContacts))[_0xe861('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xe861('0x3d')]();return _0x3aa4b6;}function _0x223d57(_0x2d864a,_0x2bd88e){var _0x3e251a=squel[_0xe861('0x31')]()[_0xe861('0x32')](_0xe861('0x48'))[_0xe861('0x34')]([_0xe861('0x3b'),_0xe861('0x36'),'ListId',_0x2bd88e,'createdAt','updatedAt'],squel['select']()[_0xe861('0x3a')](_0xe861('0x3b'),_0xe861('0x3b'))[_0xe861('0x3a')]('id',_0xe861('0x36'))[_0xe861('0x3a')](LISTID['toString'](),_0xe861('0x23'))[_0xe861('0x3a')](_0x2d864a['id'][_0xe861('0x3d')](),_0x2bd88e)[_0xe861('0x3a')](_0xe861('0x3c'),_0xe861('0x37'))[_0xe861('0x3a')](_0xe861('0x3c'),'updatedAt')['from'](_0xe861('0x3f'))[_0xe861('0x40')](_0xe861('0x41'))[_0xe861('0x40')](_0xe861('0x42'),LISTID[_0xe861('0x3d')]())[_0xe861('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xe861('0x40')](_0xe861('0x43')))[_0xe861('0x3d')]();return _0x3e251a;}return db[_0xe861('0x49')][_0xe861('0x4a')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xe861('0x2b')](function(_0x83bc1e){var _0x1a40ad=[];if(_0x83bc1e){var _0x35c10a;for(var _0x480fa9=0x0,_0x2f339d;_0x480fa9<_0x83bc1e[_0xe861('0x17')];_0x480fa9+=0x1){_0x2f339d=_0x83bc1e[_0x480fa9][_0xe861('0x4b')]({'plain':!![]});switch(_0x2f339d[_0xe861('0x4c')]){case _0xe861('0x4d'):_0x1a40ad[_0xe861('0x4e')](db['sequelize'][_0xe861('0x4f')](_0x5cc80b(_0x2f339d,_0xe861('0x50')))[_0xe861('0x2b')](function(){})[_0xe861('0x2d')](_0x547bb9()));break;case _0xe861('0x51'):_0x1a40ad[_0xe861('0x4e')](db[_0xe861('0x52')]['query'](_0x39f5ae(_0x2f339d,_0xe861('0x50')))[_0xe861('0x2b')](function(){})[_0xe861('0x2d')](_0x547bb9()));break;default:_0x1a40ad[_0xe861('0x4e')](db[_0xe861('0x52')][_0xe861('0x4f')](_0xa71de0(_0x2f339d,'VoiceQueueId'))[_0xe861('0x2b')](function(){})[_0xe861('0x2d')](_0x547bb9()));}}}return _0x1a40ad;})[_0xe861('0x53')]()[_0xe861('0x2b')](function(){return db[_0xe861('0x49')][_0xe861('0x4a')]({'where':{'type':_0xe861('0x54')},'attributes':['id'],'include':[{'model':db[_0xe861('0x55')],'as':_0xe861('0x56'),'where':{'id':LISTID}}]})[_0xe861('0x2b')](function(_0x56372){var _0x949427=[];if(_0x56372){var _0x427f00;for(var _0x188399=0x0,_0x1409cb;_0x188399<_0x56372[_0xe861('0x17')];_0x188399+=0x1){_0x1409cb=_0x56372[_0x188399][_0xe861('0x4b')]({'plain':!![]});_0x949427[_0xe861('0x4e')](db['sequelize'][_0xe861('0x4f')](_0x223d57(_0x1409cb,_0xe861('0x50')))['then'](function(){})[_0xe861('0x2d')](_0x547bb9()));}}return _0x949427;})['all']();})[_0xe861('0x2b')](function(){return db[_0xe861('0x57')][_0xe861('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe861('0x55')],'as':_0xe861('0x58'),'where':{'id':LISTID}}]})[_0xe861('0x2b')](function(_0x4e6c2e){var _0x204bf6=[];if(_0x4e6c2e){for(var _0x281ee4=0x0,_0x353e6b;_0x281ee4<_0x4e6c2e[_0xe861('0x17')];_0x281ee4+=0x1){_0x353e6b=_0x4e6c2e[_0x281ee4][_0xe861('0x4b')]({'plain':!![]});switch(_0x353e6b[_0xe861('0x4c')]){case'always':_0x204bf6[_0xe861('0x4e')](db[_0xe861('0x52')][_0xe861('0x4f')](_0x5cc80b(_0x353e6b,_0xe861('0x59')))['then'](function(){})['catch'](_0x547bb9()));break;case _0xe861('0x51'):_0x204bf6['push'](db[_0xe861('0x52')][_0xe861('0x4f')](_0x39f5ae(_0x353e6b,_0xe861('0x59')))[_0xe861('0x2b')](function(){})[_0xe861('0x2d')](_0x547bb9()));break;default:_0x204bf6[_0xe861('0x4e')](db['sequelize'][_0xe861('0x4f')](_0xa71de0(_0x353e6b,_0xe861('0x59')))[_0xe861('0x2b')](function(){})['catch'](_0x547bb9()));}}}return _0x204bf6;})[_0xe861('0x53')]();})[_0xe861('0x2b')](function(){return db[_0xe861('0x57')][_0xe861('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xe861('0x55')],'as':_0xe861('0x56'),'where':{'id':LISTID}}]})[_0xe861('0x2b')](function(_0x2c0e2f){var _0x2012c6=[];if(_0x2c0e2f){for(var _0x4bcf31=0x0,_0x3855b9;_0x4bcf31<_0x2c0e2f[_0xe861('0x17')];_0x4bcf31+=0x1){_0x3855b9=_0x2c0e2f[_0x4bcf31][_0xe861('0x4b')]({'plain':!![]});_0x2012c6[_0xe861('0x4e')](db[_0xe861('0x52')][_0xe861('0x4f')](_0x223d57(_0x3855b9,'CampaignId'))[_0xe861('0x2b')](function(){})[_0xe861('0x2d')](_0x547bb9()));}}return _0x2012c6;})[_0xe861('0x53')]();})[_0xe861('0x2d')](function(_0x15def7){logger[_0xe861('0x15')](_0xe861('0x5a'),_0xe861('0x5b'),_0x15def7[_0xe861('0x19')]);});}var processPromises=function(_0x433702){return BPromise[_0xe861('0x53')](promises)['then'](function(_0x4df0d8){})[_0xe861('0x2d')](function(_0x4a288a){logger[_0xe861('0x15')](_0xe861('0x5c'),JSON[_0xe861('0x2f')](_0x4a288a));})[_0xe861('0x5d')](function(){socket['emit'](_0xe861('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x433702){return _0x433702[_0xe861('0x5f')]();}});};var endCsv=function(){return BPromise[_0xe861('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe861('0x2b')](function(){socket['emit'](_0xe861('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe861('0x61')](FILEPATH);}catch(_0x53a649){logger[_0xe861('0x15')](_0xe861('0x62'),JSON[_0xe861('0x2f')](_0x53a649));}finally{process[_0xe861('0x63')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xe861('0x64'));endCsv();});function main(){return BPromise[_0xe861('0x60')]()[_0xe861('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xe861('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe861('0x2b')](function(_0x11d8f0){var _0x30053f=fs[_0xe861('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe861('0x66')](_0x30053f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x53a804,_0x10a93a){total+=0x1;var _0x1caa8b=total;promises[_0xe861('0x4e')](checkRow(_0x53a804,_0x11d8f0,_0x1caa8b)[_0xe861('0x2b')](function(){success+=0x1;})['catch'](function(_0x355dc8){if(_0x355dc8[_0xe861('0x15')]){errors+=0x1;delete _0x355dc8[_0xe861('0x15')];}else if(_0x355dc8['duplicate']){duplicates+=0x1;delete _0x355dc8[_0xe861('0x26')];}rows[_0xe861('0x4e')](_0x355dc8);}));if(total%0xc8===0x0){_0x10a93a[_0xe861('0x67')]();return processPromises(_0x10a93a);}},'complete':function(){return processPromises()['then'](function(){logger[_0xe861('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3c17fc,_0x462017){logger[_0xe861('0x68')](_0xe861('0x69'),JSON[_0xe861('0x2f')](_0x3c17fc));endCsv();}});})['catch'](function(_0x4db5ed){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x4db5ed));});}main(); \ No newline at end of file +var _0x4c95=['CSV\x20import\x20process\x20stopped!','resolve','createReadStream','pause','CSV\x20parsed\x20correctly!','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','Duplicate\x20Contact','CmContact','create','keys','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','updatedAt','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','then','get','query','catch','onlyIfOpen','sequelize','VoiceQueueId','all','Campaign','findAll','Lists','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','contact:csv_','resume','emit','exit','SIGINT','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4c95,0xd7));var _0x54c9=function(_0x2f8a8b,_0x11015f){_0x2f8a8b=_0x2f8a8b-0x0;var _0x26e188=_0x4c95[_0x2f8a8b];return _0x26e188;};'use strict';var BPromise=require('bluebird');var util=require(_0x54c9('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x54c9('0x1'));var Papa=require(_0x54c9('0x2'));var Redis=require(_0x54c9('0x3'));var db=require(_0x54c9('0x4'))['db'];var config=require(_0x54c9('0x5'));var logger=require(_0x54c9('0x6'))(_0x54c9('0x7'));config[_0x54c9('0x8')]=_['defaults'](config[_0x54c9('0x8')],{'host':_0x54c9('0x9'),'port':0x18eb});var socket=require(_0x54c9('0xa'))(new Redis(config[_0x54c9('0x8')]));require(_0x54c9('0xb'))[_0x54c9('0xc')](socket);try{if(!process[_0x54c9('0xd')][0x2]||process['argv'][0x2]===_0x54c9('0xe')||process['argv'][0x2]===_0x54c9('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x54c9('0xd')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x54c9('0xe')||process[_0x54c9('0xd')][0x3]===_0x54c9('0xf')||!process['argv'][0x4]||process[_0x54c9('0xd')][0x4]==='undefined'||process[_0x54c9('0xd')][0x4]===_0x54c9('0xf')){throw new Error(_0x54c9('0x10'));}var FIELDS=_[_0x54c9('0x11')](process[_0x54c9('0xd')][0x3]['split'](','),process[_0x54c9('0xd')][0x4][_0x54c9('0x12')](','));if(!process[_0x54c9('0xd')][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x54c9('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x54c9('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x54c9('0xe')&&process[_0x54c9('0xd')][0x6]!==_0x54c9('0xf')?process[_0x54c9('0xd')][0x6]:null;var DUPLICATES=process[_0x54c9('0xd')][0x7]&&process[_0x54c9('0xd')][0x7]!==_0x54c9('0xe')&&process[_0x54c9('0xd')][0x7]!==_0x54c9('0xf')?process['argv'][0x7]:null;if(!process[_0x54c9('0xd')][0x8]||process[_0x54c9('0xd')][0x8]==='undefined'||process[_0x54c9('0xd')][0x8]===_0x54c9('0xf')){throw new Error(_0x54c9('0x13'));}var SOCKET_TIMESTAMP=process[_0x54c9('0xd')][0x8];}catch(_0x477cad){logger[_0x54c9('0x14')](_0x477cad);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(_0x292594,_0x197dbd,_0x25cf43,_0x5b8859){var _0x43894b={'message':_0x197dbd};_0x43894b[_0x292594]=!![];if(_0x25cf43){_0x43894b[_0x54c9('0x15')]=_0x25cf43;}if(_0x5b8859){_0x43894b[_0x54c9('0x16')]=_0x5b8859;}return _0x43894b;}function isEmail(_0x34d26d){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x34d26d);}function checkRow(_0xad9c4a,_0x5c2262,_0x2c1de3){return new BPromise(function(_0x44ae9e,_0x15166c){if(_[_0x54c9('0x17')](_0xad9c4a)){return _0x15166c(handleCheckRowError(_0x54c9('0x14'),_0x54c9('0x18'),null,_0x2c1de3));}if(_0xad9c4a[_0x54c9('0x19')]&&_0xad9c4a[_0x54c9('0x19')][_0x54c9('0x1a')]){var _0x7fd894=_[_0x54c9('0x1b')](_0xad9c4a[_0x54c9('0x19')],_0x54c9('0x1c'))[_0x54c9('0x1d')](';');return _0x15166c(handleCheckRowError(_0x54c9('0x14'),_0x7fd894,null,_0x2c1de3));}var _0x429b16={};for(var _0x30e4ac in FIELDS){if(FIELDS['hasOwnProperty'](_0x30e4ac)&&FIELDS[_0x30e4ac]){_0x429b16[_0x30e4ac]=_0xad9c4a[_0x54c9('0x1e')][0x0][FIELDS[_0x30e4ac]]||_0xad9c4a['data'][0x0]['\ufeff'+FIELDS[_0x30e4ac]];}}if(!_0x429b16[_0x54c9('0x1f')]){return _0x15166c(handleCheckRowError('error',_0x54c9('0x20'),null,_0x2c1de3));}if(!_0x429b16[_0x54c9('0x21')]){return _0x15166c(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x2c1de3));}if(_0x429b16[_0x54c9('0x22')]){var _0x36b44b=moment(_0x429b16['birthDate'],_0x54c9('0x23'));if(!_0x36b44b['isValid']()){return _0x15166c(handleCheckRowError(_0x54c9('0x14'),_0x54c9('0x24'),null,_0x2c1de3));}}if(_0x429b16[_0x54c9('0x25')]){if(!isEmail(_0x429b16[_0x54c9('0x25')])){return _0x15166c(handleCheckRowError(_0x54c9('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x2c1de3));}}_0x429b16[_0x54c9('0x26')]=LISTID;_0x429b16[_0x54c9('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x54c9('0x1a')]&&_0x5c2262){var _0x354166={};for(var _0x32be73=0x0,_0x2ed056=DUPLICATES[_0x54c9('0x1a')];_0x32be73<_0x2ed056;_0x32be73+=0x1){_0x354166[DUPLICATES[_0x32be73]]=_0x429b16[DUPLICATES[_0x32be73]];}var _0x4a2421=_['find'](_0x5c2262,_0x354166);if(_0x4a2421){return _0x15166c(handleCheckRowError('duplicate',_0x54c9('0x28'),_0x4a2421,_0x2c1de3));}}return db[_0x54c9('0x29')][_0x54c9('0x2a')](_0x429b16,{'raw':!![],'hooks':![],'fields':_[_0x54c9('0x2b')](_0x429b16)})['then'](function(_0x468e73){if(DUPLICATES&&DUPLICATES[_0x54c9('0x1a')]&&_0x5c2262){_0x5c2262[_0x54c9('0x2c')](_[_0x54c9('0x2d')](_0x429b16,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x468e73['id'];return _0x44ae9e();})['catch'](function(_0xd6d6b1){return _0x15166c(handleCheckRowError(_0x54c9('0x14'),_0x54c9('0x2e')+(_0xd6d6b1[_0x54c9('0x1c')]||JSON[_0x54c9('0x2f')](_0xd6d6b1)),null,_0x2c1de3));});});}function checkHopper(){function _0x29adfc(){return function(_0x213c53){logger['error']('cmContact',_0x54c9('0x30'),util[_0x54c9('0x31')](_0x213c53,{'showHidden':![],'depth':null}));};}var _0x1b4b3f=function(_0xd0ad39,_0xef0bc9){var _0xe4986f=squel[_0x54c9('0x32')]()[_0x54c9('0x33')]('cm_hopper')[_0x54c9('0x34')](['phone',_0x54c9('0x35'),_0x54c9('0x36'),_0x54c9('0x26'),_0xef0bc9,_0x54c9('0x37'),'updatedAt'],squel['select']()[_0x54c9('0x38')](_0x54c9('0x21'),_0x54c9('0x21'))[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x35'))[_0x54c9('0x38')]('id',_0x54c9('0x36'))[_0x54c9('0x38')](LISTID[_0x54c9('0x3a')](),_0x54c9('0x26'))['field'](_0xd0ad39['id']['toString'](),_0xef0bc9)['field']('NOW()',_0x54c9('0x37'))[_0x54c9('0x38')](_0x54c9('0x39'),'updatedAt')[_0x54c9('0x3b')](_0x54c9('0x3c'))[_0x54c9('0x3d')](_0x54c9('0x3e'))[_0x54c9('0x3d')]('ListId\x20=\x20?',LISTID['toString']())[_0x54c9('0x3d')](_0x54c9('0x3f'))[_0x54c9('0x3d')](_0x54c9('0x40'),squel[_0x54c9('0x41')]()[_0x54c9('0x38')](_0x54c9('0x21'))[_0x54c9('0x3b')](_0x54c9('0x42'))['where'](_0xef0bc9+_0x54c9('0x43'),_0xd0ad39['id'][_0x54c9('0x3a')]())))[_0x54c9('0x3a')]();return _0xe4986f;};var _0x336473=function(_0x4a3fdd,_0x5b3593){var _0x4df608=squel[_0x54c9('0x32')]()[_0x54c9('0x33')](_0x54c9('0x42'))['fromQuery']([_0x54c9('0x21'),_0x54c9('0x35'),_0x54c9('0x36'),_0x54c9('0x26'),_0x5b3593,_0x54c9('0x37'),_0x54c9('0x44')],squel[_0x54c9('0x41')]()['field'](_0x54c9('0x21'),'phone')[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x35'))[_0x54c9('0x38')]('id',_0x54c9('0x36'))['field'](LISTID[_0x54c9('0x3a')](),_0x54c9('0x26'))[_0x54c9('0x38')](_0x4a3fdd['id'][_0x54c9('0x3a')](),_0x5b3593)[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x37'))[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x44'))[_0x54c9('0x3b')](_0x54c9('0x3c'))[_0x54c9('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x54c9('0x45'),LISTID[_0x54c9('0x3a')]())[_0x54c9('0x3d')](_0x54c9('0x46'),squel[_0x54c9('0x47')](hopperContacts))[_0x54c9('0x3d')](_0x54c9('0x3f'))[_0x54c9('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x54c9('0x38')]('calleridnum')[_0x54c9('0x3b')](_0x54c9('0x48'))['where'](_0x5b3593+'\x20=\x20?',_0x4a3fdd['id']['toString']()))['where'](_0x54c9('0x40'),squel[_0x54c9('0x41')]()[_0x54c9('0x38')]('phone')['from'](_0x54c9('0x42'))['where'](_0x5b3593+_0x54c9('0x43'),_0x4a3fdd['id'][_0x54c9('0x3a')]())))[_0x54c9('0x3a')]();return _0x4df608;};function _0x2a35e0(_0x336533,_0x570cf2){var _0x1c835f=squel[_0x54c9('0x32')]()[_0x54c9('0x33')](_0x54c9('0x42'))['fromQuery']([_0x54c9('0x21'),_0x54c9('0x35'),_0x54c9('0x36'),_0x54c9('0x26'),_0x570cf2,_0x54c9('0x37'),_0x54c9('0x44')],squel['select']()[_0x54c9('0x38')](_0x54c9('0x21'),_0x54c9('0x21'))[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x35'))['field']('id','ContactId')[_0x54c9('0x38')](LISTID[_0x54c9('0x3a')](),_0x54c9('0x26'))[_0x54c9('0x38')](_0x336533['id'][_0x54c9('0x3a')](),_0x570cf2)[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x37'))[_0x54c9('0x38')](_0x54c9('0x39'),'updatedAt')['from'](_0x54c9('0x3c'))[_0x54c9('0x3d')](_0x54c9('0x3e'))[_0x54c9('0x3d')](_0x54c9('0x45'),LISTID[_0x54c9('0x3a')]())['where'](_0x54c9('0x46'),squel[_0x54c9('0x47')](hopperContacts))[_0x54c9('0x3d')](_0x54c9('0x3f')))[_0x54c9('0x3a')]();return _0x1c835f;}function _0x242eff(_0x4190ea,_0x35717e){var _0xf32a5=squel[_0x54c9('0x32')]()[_0x54c9('0x33')](_0x54c9('0x49'))[_0x54c9('0x34')]([_0x54c9('0x21'),_0x54c9('0x36'),_0x54c9('0x26'),_0x35717e,_0x54c9('0x37'),_0x54c9('0x44')],squel[_0x54c9('0x41')]()[_0x54c9('0x38')](_0x54c9('0x21'),'phone')[_0x54c9('0x38')]('id',_0x54c9('0x36'))['field'](LISTID[_0x54c9('0x3a')](),_0x54c9('0x26'))['field'](_0x4190ea['id'][_0x54c9('0x3a')](),_0x35717e)[_0x54c9('0x38')](_0x54c9('0x39'),_0x54c9('0x37'))['field'](_0x54c9('0x39'),'updatedAt')[_0x54c9('0x3b')](_0x54c9('0x3c'))[_0x54c9('0x3d')]('deletedAt\x20IS\x20NULL')[_0x54c9('0x3d')]('ListId\x20=\x20?',LISTID[_0x54c9('0x3a')]())[_0x54c9('0x3d')](_0x54c9('0x46'),squel[_0x54c9('0x47')](hopperContacts))[_0x54c9('0x3d')](_0x54c9('0x3f')))[_0x54c9('0x3a')]();return _0xf32a5;}return db['VoiceQueue']['findAll']({'where':{'type':_0x54c9('0x4a')},'attributes':['id',_0x54c9('0x4b')],'include':[{'model':db[_0x54c9('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x54c9('0x4d')](function(_0xf874d1){var _0x3eedf6=[];if(_0xf874d1){var _0x1ef2af;for(var _0x214f82=0x0,_0x13f807;_0x214f82<_0xf874d1['length'];_0x214f82+=0x1){_0x13f807=_0xf874d1[_0x214f82][_0x54c9('0x4e')]({'plain':!![]});switch(_0x13f807[_0x54c9('0x4b')]){case'always':_0x3eedf6['push'](db['sequelize'][_0x54c9('0x4f')](_0x336473(_0x13f807,'VoiceQueueId'))['then'](function(){})[_0x54c9('0x50')](_0x29adfc()));break;case _0x54c9('0x51'):_0x3eedf6[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x1b4b3f(_0x13f807,_0x54c9('0x53')))[_0x54c9('0x4d')](function(){})['catch'](_0x29adfc()));break;default:_0x3eedf6[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x2a35e0(_0x13f807,_0x54c9('0x53')))[_0x54c9('0x4d')](function(){})['catch'](_0x29adfc()));}}}return _0x3eedf6;})['all']()[_0x54c9('0x4d')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x54c9('0x4a')},'attributes':['id'],'include':[{'model':db[_0x54c9('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x54c9('0x4d')](function(_0x58c6bd){var _0x3ddff7=[];if(_0x58c6bd){var _0x1f1e5e;for(var _0x24c61f=0x0,_0x28a598;_0x24c61f<_0x58c6bd[_0x54c9('0x1a')];_0x24c61f+=0x1){_0x28a598=_0x58c6bd[_0x24c61f]['get']({'plain':!![]});_0x3ddff7[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x242eff(_0x28a598,_0x54c9('0x53')))[_0x54c9('0x4d')](function(){})[_0x54c9('0x50')](_0x29adfc()));}}return _0x3ddff7;})[_0x54c9('0x54')]();})[_0x54c9('0x4d')](function(){return db[_0x54c9('0x55')][_0x54c9('0x56')]({'attributes':['id',_0x54c9('0x4b')],'include':[{'model':db['CmList'],'as':_0x54c9('0x57'),'where':{'id':LISTID}}]})[_0x54c9('0x4d')](function(_0x5b84f1){var _0x42cac8=[];if(_0x5b84f1){for(var _0x5ce527=0x0,_0x2631d7;_0x5ce527<_0x5b84f1[_0x54c9('0x1a')];_0x5ce527+=0x1){_0x2631d7=_0x5b84f1[_0x5ce527][_0x54c9('0x4e')]({'plain':!![]});switch(_0x2631d7[_0x54c9('0x4b')]){case _0x54c9('0x58'):_0x42cac8[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x336473(_0x2631d7,_0x54c9('0x59')))[_0x54c9('0x4d')](function(){})[_0x54c9('0x50')](_0x29adfc()));break;case _0x54c9('0x51'):_0x42cac8[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x1b4b3f(_0x2631d7,_0x54c9('0x59')))[_0x54c9('0x4d')](function(){})[_0x54c9('0x50')](_0x29adfc()));break;default:_0x42cac8[_0x54c9('0x2c')](db[_0x54c9('0x52')][_0x54c9('0x4f')](_0x2a35e0(_0x2631d7,_0x54c9('0x59')))[_0x54c9('0x4d')](function(){})[_0x54c9('0x50')](_0x29adfc()));}}}return _0x42cac8;})[_0x54c9('0x54')]();})[_0x54c9('0x4d')](function(){return db[_0x54c9('0x55')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x54c9('0x4c')],'as':_0x54c9('0x5a'),'where':{'id':LISTID}}]})[_0x54c9('0x4d')](function(_0x42421e){var _0x1f66aa=[];if(_0x42421e){for(var _0x553ac3=0x0,_0x2b2f37;_0x553ac3<_0x42421e[_0x54c9('0x1a')];_0x553ac3+=0x1){_0x2b2f37=_0x42421e[_0x553ac3][_0x54c9('0x4e')]({'plain':!![]});_0x1f66aa[_0x54c9('0x2c')](db['sequelize'][_0x54c9('0x4f')](_0x242eff(_0x2b2f37,_0x54c9('0x59')))[_0x54c9('0x4d')](function(){})[_0x54c9('0x50')](_0x29adfc()));}}return _0x1f66aa;})[_0x54c9('0x54')]();})[_0x54c9('0x50')](function(_0x55280e){logger['error'](_0x54c9('0x5b'),_0x54c9('0x5c'),_0x55280e[_0x54c9('0x1c')]);});}var processPromises=function(_0x3253d8){return BPromise[_0x54c9('0x54')](promises)[_0x54c9('0x4d')](function(_0x46a0d2){})[_0x54c9('0x50')](function(_0x6aa9ee){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x54c9('0x2f')](_0x6aa9ee));})[_0x54c9('0x5d')](function(){socket['emit'](_0x54c9('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3253d8){return _0x3253d8[_0x54c9('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x54c9('0x4d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x54c9('0x60')](_0x54c9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4a8393){logger[_0x54c9('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x54c9('0x2f')](_0x4a8393));}finally{process[_0x54c9('0x61')](0x0);}});};process['on'](_0x54c9('0x62'),function(){logger[_0x54c9('0x63')](_0x54c9('0x64'));endCsv();});function main(){return BPromise[_0x54c9('0x65')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x54c9('0x12')](',');return db['CmContact'][_0x54c9('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x54c9('0x4d')](function(_0x1920e2){var _0x146e58=fs[_0x54c9('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x146e58,{'header':!![],'skipEmptyLines':!![],'step':function(_0x291595,_0x43fcaa){total+=0x1;var _0x38be5f=total;promises[_0x54c9('0x2c')](checkRow(_0x291595,_0x1920e2,_0x38be5f)[_0x54c9('0x4d')](function(){success+=0x1;})[_0x54c9('0x50')](function(_0x547f13){if(_0x547f13[_0x54c9('0x14')]){errors+=0x1;delete _0x547f13[_0x54c9('0x14')];}else if(_0x547f13['duplicate']){duplicates+=0x1;delete _0x547f13['duplicate'];}rows['push'](_0x547f13);}));if(total%0xc8===0x0){_0x43fcaa[_0x54c9('0x67')]();return processPromises(_0x43fcaa);}},'complete':function(){return processPromises()['then'](function(){logger[_0x54c9('0x63')](_0x54c9('0x68'));endCsv();});},'error':function(_0x2354dc,_0x441758){logger[_0x54c9('0x63')]('CSV\x20parse\x20error',JSON[_0x54c9('0x2f')](_0x2354dc));endCsv();}});})[_0x54c9('0x50')](function(_0xaa261c){logger[_0x54c9('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x54c9('0x2f')](_0xaa261c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c34bdcf..756930a 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 _0xa630=['cm_contacts.ListId','priority','cm_contacts.createdAt\x20=\x20?','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','message','exit','code','sequelize','query','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','clone','root','server/files/tmp','.csv','includes','info','ContactItemType','name','header','writeFileSync','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','isNumber','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','complete','argv','arguments\x20\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','binding','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','AdditionalPhones','split','all','isNil','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','createdAt','fields','from','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa630,0x12a));var _0x0a63=function(_0x4ac32f,_0x99d209){_0x4ac32f=_0x4ac32f-0x0;var _0x2ba3d0=_0xa630[_0x4ac32f];return _0x2ba3d0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x0a63('0x0'));var Papa=require('papaparse');var util=require(_0x0a63('0x1'));var BPromise=require(_0x0a63('0x2'));var moment=require(_0x0a63('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x0a63('0x4'))['db'];var config=require(_0x0a63('0x5'));var shared=require(_0x0a63('0x6'));var logger=require(_0x0a63('0x7'))(_0x0a63('0x8'));config['redis']=_[_0x0a63('0x9')](config[_0x0a63('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a63('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x0a63('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0a63('0xd')](_0x0a63('0xc'));function isEmail(_0x2547da){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))*$/[_0x0a63('0xe')](_0x2547da);}function selectNotIn(_0x4ee276,_0x5ea855,_0x246e04,_0x2ea4a9,_0x403f68){return squel[_0x0a63('0xf')]()[_0x0a63('0x10')](_0x0a63('0x11'))['from'](_0x2ea4a9)[_0x0a63('0x12')](_0x5ea855,null,_0x5ea855+'.id\x20=\x20'+_0x2ea4a9+'.'+_0x246e04)[_0x0a63('0x13')](_0x2ea4a9+'.'+_0x246e04+_0x0a63('0x14')+_0x4ee276+'.'+_0x246e04)['where'](_0x5ea855+_0x0a63('0x15')+_0x403f68[_0x0a63('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e6d5a,_0x63d592){promisesAdditionalPhones=[];return db[_0x0a63('0x16')][_0x0a63('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x0a63('0x18')](function(_0x5806a4){if(_0x5806a4!==null){var _0x2030c1=[];for(var _0x733b82=0x0;_0x733b82<_0x5806a4[_0x0a63('0x19')];_0x733b82++){var _0x2399b2=_0x5806a4[_0x733b82];_0x2030c1[_0x0a63('0x1a')](insertAdditionalPhones(_0x2399b2));}}Promise['all'](_0x2030c1)[_0x0a63('0x18')](function(){_0x4e6d5a({'val':0x1});});});});}function insertAdditionalPhones(_0x5c5b2e){return new Promise(function(_0xc9ea1c,_0x445b42){var _0x36a04a=_0x5c5b2e[_0x0a63('0x1b')];var _0x20a897=_0x36a04a[_0x0a63('0x1c')](';');var _0x5f1709=[];orderBy=0x0;for(var _0x205887=0x0;_0x205887<_0x20a897[_0x0a63('0x19')];_0x205887++){_0x5f1709[_0x0a63('0x1a')](splitAdditionalPhone(_0x5c5b2e['id'],_0x20a897[_0x205887]));}Promise[_0x0a63('0x1d')](_0x5f1709)[_0x0a63('0x18')](function(){_0xc9ea1c({'val':_0x20a897['length']});});});}function splitAdditionalPhone(_0x568090,_0x2bb1af){return new Promise(function(_0x4c4698,_0x1f2130){var _0x167d5e=_0x2bb1af[_0x0a63('0x1c')](':');var _0xb3d0de=_0x167d5e[0x0];var _0x6d82c7=_0x167d5e[0x1];if(!_[_0x0a63('0x1e')](_0x6d82c7)){var _0x35adaf=_0x6d82c7[_0x0a63('0x1c')]('|');var _0x5a47f4=[];for(var _0x3c4f07=0x0;_0x3c4f07<_0x35adaf['length'];_0x3c4f07++){if(_0x35adaf[_0x3c4f07]!==''){var _0x7955f6=_[_0x0a63('0x1f')](promisesAdditionalPhones,{'contactId':_0x568090,'phone':_0x35adaf[_0x3c4f07]});if(_0x7955f6[_0x0a63('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x0a63('0x1a')]({'contactId':_0x568090,'contactTypeId':_0xb3d0de,'phone':_0x35adaf[_0x3c4f07],'orderBy':orderBy});}}}_0x4c4698({'ok':0x1});}else _0x4c4698({'res':0x0});});}function createAdditionalPhone(_0x3f4e32,_0xed051,_0x1dac0d,_0x416913){var _0x7fb872='';var _0xf47e53='';var _0x5fa7ff=_0x1dac0d[_0x0a63('0x1c')]('§');_0x7fb872=_0x5fa7ff[0x0];if(_0x5fa7ff[_0x0a63('0x19')]==0x2)_0xf47e53=_0x5fa7ff[0x1];return new Promise(function(_0x508271,_0x7c6f84){return db['CmContactHasItem'][_0x0a63('0x20')]({'where':{'CmContactId':_0x3f4e32,'item':_0x7fb872}})[_0x0a63('0x18')](function(_0x1b358a){if(_0x1b358a){return db[_0x0a63('0x21')][_0x0a63('0x22')]({'ItemTypeId':_0xed051,'description':_0xf47e53,'OrderBy':_0x416913},{'where':{'CmContactId':_0x3f4e32,'item':_0x7fb872}})[_0x0a63('0x18')](function(_0x97625b){_0x508271({'res':_0x0a63('0x23')});});}else{return db['CmContactHasItem'][_0x0a63('0x24')]({'CmContactId':_0x3f4e32,'item':_0x7fb872,'description':_0xf47e53,'ItemTypeId':_0xed051,'OrderBy':_0x416913,'ItemClass':_0x0a63('0x25')})[_0x0a63('0x18')](function(_0x5e07c9){_0x508271({'res':_0x0a63('0x26')});});}});});}function insertCmHopper(_0x34c538,_0x283133,_0xc359cb,_0x403564,_0x1e2a3b){var _0x35176a=[_0x0a63('0x27'),_0x0a63('0x28'),'cm_contacts.id','cm_contacts.ListId',_0x283133+'.'+_0x403564,_0x0a63('0x29'),_0x0a63('0x2a'),_0x0a63('0x2b'),_0x0a63('0x2c'),'\x22'+_0x1e2a3b+'\x22'];return squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x2f'))[_0x0a63('0x30')]([_0x0a63('0x11'),_0x0a63('0x31'),_0x0a63('0x32'),_0x0a63('0x33'),_0x403564,'createdAt',_0x0a63('0x34'),'priority',_0x0a63('0x35'),_0x0a63('0x36')],squel[_0x0a63('0xf')]()['fields'](_0x35176a)['from'](_0x283133)[_0x0a63('0x12')](_0x0a63('0x37'),null,_0x0a63('0x38')+_0x283133+'.CmListId')[_0x0a63('0x12')](_0xc359cb,null,_0xc359cb+'.id\x20=\x20'+_0x283133+'.'+_0x403564)[_0x0a63('0x13')](_0x283133+'.CmListId\x20=\x20?',_0x34c538)[_0x0a63('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0a63('0x13')](_0x0a63('0x39'),selectNotIn(_0x283133,_0xc359cb,_0x403564,_0x0a63('0x2f'),[_0x0a63('0x3a'),_0x0a63('0x3b')]))[_0x0a63('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x283133,_0xc359cb,_0x403564,_0x0a63('0x2f'),[_0x0a63('0x3a')])))[_0x0a63('0x3c')]();}function insertCmHopperBlack(_0x3d02da,_0x1351ba,_0x10b784,_0x2b1934){var _0x3dd6c9=[_0x0a63('0x27'),_0x0a63('0x3d'),'cm_contacts.ListId',_0x1351ba+'.'+_0x2b1934,_0x0a63('0x29'),_0x0a63('0x2a')];return squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x3e'))['fromQuery']([_0x0a63('0x11'),_0x0a63('0x32'),_0x0a63('0x33'),_0x2b1934,_0x0a63('0x3f'),'updatedAt'],squel[_0x0a63('0xf')]()[_0x0a63('0x40')](_0x3dd6c9)[_0x0a63('0x41')](_0x1351ba)[_0x0a63('0x12')](_0x0a63('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x1351ba+_0x0a63('0x42'))[_0x0a63('0x12')](_0x10b784,null,_0x10b784+_0x0a63('0x43')+_0x1351ba+'.'+_0x2b1934)[_0x0a63('0x13')](_0x1351ba+_0x0a63('0x44'),_0x3d02da)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0a63('0x13')](_0x0a63('0x39'),squel[_0x0a63('0xf')]()[_0x0a63('0x10')](_0x0a63('0x11'))[_0x0a63('0x41')](_0x0a63('0x3e'))[_0x0a63('0x13')](_0x0a63('0x45'),_0x3d02da)[_0x0a63('0x13')](_0x2b1934+_0x0a63('0x14')+_0x1351ba+'.'+_0x2b1934)))[_0x0a63('0x3c')]();}function insertTzCmHopper(_0x3c7b60,_0x4d413c,_0x9a80c6,_0x21fa58,_0x4ddd4c,_0x222fb3){var _0x38feba=[_0x0a63('0x27'),_0x0a63('0x46')+_0x222fb3+_0x0a63('0x47'),'cm_contacts.id',_0x0a63('0x48'),_0x4d413c+'.'+_0x21fa58,'cm_contacts.createdAt',_0x0a63('0x2a'),'cm_contacts.priority',_0x0a63('0x2c'),'\x22'+_0x4ddd4c+'\x22'];var _0x190992=squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x2f'))['fromQuery'](['phone','scheduledat','ContactId',_0x0a63('0x33'),_0x21fa58,'createdAt',_0x0a63('0x34'),_0x0a63('0x49'),_0x0a63('0x35'),_0x0a63('0x36')],squel['select']()[_0x0a63('0x40')](_0x38feba)['from'](_0x4d413c)[_0x0a63('0x12')](_0x0a63('0x37'),null,_0x0a63('0x38')+_0x4d413c+_0x0a63('0x42'))[_0x0a63('0x12')](_0x9a80c6,null,_0x9a80c6+_0x0a63('0x43')+_0x4d413c+'.'+_0x21fa58)[_0x0a63('0x12')](_0x222fb3,null,_0x222fb3+_0x0a63('0x43')+_0x4d413c+'.'+_0x21fa58)[_0x0a63('0x13')](_0x4d413c+_0x0a63('0x44'),_0x3c7b60)['where'](_0x0a63('0x4a'),NOW)[_0x0a63('0x13')](_0x0a63('0x39'),selectNotIn(_0x4d413c,_0x9a80c6,_0x21fa58,_0x0a63('0x2f'),[_0x0a63('0x3a'),'\x22onlyIfOpen\x22']))[_0x0a63('0x13')](_0x0a63('0x39'),selectNotIn(_0x4d413c,_0x9a80c6,_0x21fa58,_0x0a63('0x2f'),['\x22always\x22'])))[_0x0a63('0x3c')]();return _0x190992;}function insertTzCmHopperBlack(_0x5124ee,_0x525d05,_0x2cb1f0,_0x589954){var _0x1dfc2e=['cm_contacts.phone',_0x0a63('0x3d'),_0x0a63('0x48'),_0x525d05+'.'+_0x589954,_0x0a63('0x29'),_0x0a63('0x2a')];return squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x3e'))[_0x0a63('0x30')]([_0x0a63('0x11'),_0x0a63('0x32'),_0x0a63('0x33'),_0x589954,'createdAt',_0x0a63('0x34')],squel[_0x0a63('0xf')]()[_0x0a63('0x40')](_0x1dfc2e)[_0x0a63('0x41')](_0x525d05)['join'](_0x0a63('0x37'),null,_0x0a63('0x38')+_0x525d05+'.CmListId')[_0x0a63('0x12')](_0x2cb1f0,null,_0x2cb1f0+'.id\x20=\x20'+_0x525d05+'.'+_0x589954)[_0x0a63('0x13')](_0x525d05+_0x0a63('0x44'),_0x5124ee)[_0x0a63('0x13')](_0x0a63('0x4a'),NOW)[_0x0a63('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0a63('0xf')]()['field']('phone')[_0x0a63('0x41')](_0x0a63('0x3e'))[_0x0a63('0x13')](_0x0a63('0x45'),_0x5124ee)['where'](_0x589954+_0x0a63('0x14')+_0x525d05+'.'+_0x589954)))[_0x0a63('0x3c')]();}function insertCmHopperAdditionalPhones(_0x553eca){var _0x89508b=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x0a63('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x4c'))[_0x0a63('0x30')]([_0x0a63('0x4d'),_0x0a63('0x11'),'OrderBy',_0x0a63('0x3f'),_0x0a63('0x34')],squel[_0x0a63('0xf')]()['fields'](_0x89508b)[_0x0a63('0x41')](_0x0a63('0x2f'))[_0x0a63('0x12')](_0x0a63('0x37'),null,_0x0a63('0x4e'))[_0x0a63('0x12')](_0x0a63('0x4f'),null,_0x0a63('0x50'))[_0x0a63('0x13')](_0x0a63('0x51'),_0x553eca)[_0x0a63('0x13')](_0x0a63('0x4a'),NOW))['toString']();}function insertCmContact(_0x3eef49,_0xf49ae7,_0x14cc75,_0x508f84){var _0x2f3cc2=_[_0x0a63('0x52')](_[_0x0a63('0x53')](_0x508f84),[_0x0a63('0x33'),_0x0a63('0x54'),_0x0a63('0x3f'),_0x0a63('0x34'),'scheduledAt']);return squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x0a63('0x37'))[_0x0a63('0x30')](_0x2f3cc2,squel['select']()[_0x0a63('0x40')](_0x2f3cc2)[_0x0a63('0x41')](_0xf49ae7)[_0x0a63('0x13')]('('+_0x14cc75[_0x0a63('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x0a63('0xf')]()[_0x0a63('0x40')](_0x14cc75)[_0x0a63('0x41')]('cm_contacts')['where'](_0x0a63('0x45'),_0x3eef49)['where'](_0x0a63('0x55')))['where'](_0x0a63('0x56'),squel[_0x0a63('0xf')]()[_0x0a63('0x10')](_0x0a63('0x57'),'min_id')[_0x0a63('0x41')](_0xf49ae7)[_0x0a63('0x58')](_0x14cc75['join'](','))))[_0x0a63('0x3c')]();}function handleStop(){logger['info'](_0x0a63('0x59'));stopped=!![];}function handleUncaughtException(_0x39e307){logger['error'](_0x39e307[_0x0a63('0x5a')]);process[_0x0a63('0x5b')](0x1);}function handleError(_0x76f63,_0x271893){stats['errors'][_0x0a63('0x1a')]({'name':_0x271893[_0x0a63('0x5c')],'message':_0x271893[_0x0a63('0x5a')],'row':_0x76f63});}function handleQuery(_0xeec7fe){logger['info'](_0xeec7fe);return db[_0x0a63('0x5d')][_0x0a63('0x5e')](_0xeec7fe)[_0x0a63('0x5f')](function(_0x1afe47){results['push'](_0x1afe47);})['catch'](function(_0x37c2a1){logger[_0x0a63('0x60')](_0x37c2a1[_0x0a63('0x5a')]);});}function updateTzCampaigns(_0x431133){return new Promise(function(_0x53ff00,_0x2676cf){var _0xf662fd=squel[_0x0a63('0xf')]()['fields']([_0x0a63('0x61'),_0x0a63('0x62')])['from'](_0x0a63('0x63'))['join'](_0x0a63('0x64'),null,_0x0a63('0x65'))[_0x0a63('0x13')]('campaigns_has_cm_lists.CmListId='+_0x431133);db[_0x0a63('0x5d')][_0x0a63('0x5e')](_0xf662fd[_0x0a63('0x3c')]())[_0x0a63('0x5f')](function(_0x1b8ed5){var _0x2260ea=[];for(var _0x53de46=0x0;_0x53de46<_0x1b8ed5[_0x0a63('0x19')];_0x53de46++){_0x2260ea[_0x0a63('0x1a')](getTimezoneData(_0x1b8ed5[_0x53de46],tmp_campaigns));}BPromise[_0x0a63('0x1d')](_0x2260ea)[_0x0a63('0x18')](function(){_0x53ff00({'val':0x1});});})[_0x0a63('0x66')](function(_0x333f1d){logger[_0x0a63('0x60')](_0x333f1d[_0x0a63('0x5a')]);_0x53ff00({'val':0x0});});});}function updateTzVoiceQueues(_0x59aaf1){return new Promise(function(_0x9caf1,_0x152ca9){var _0x180888=squel[_0x0a63('0xf')]()[_0x0a63('0x40')](['voice_queues.id',_0x0a63('0x67')])['from'](_0x0a63('0x68'))[_0x0a63('0x12')](_0x0a63('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x0a63('0x13')](_0x0a63('0x6a')+_0x59aaf1);db[_0x0a63('0x5d')][_0x0a63('0x5e')](_0x180888[_0x0a63('0x3c')]())[_0x0a63('0x5f')](function(_0x432767){var _0x4c12a4=[];for(var _0x16a818=0x0;_0x16a818<_0x432767[_0x0a63('0x19')];_0x16a818++){_0x4c12a4[_0x0a63('0x1a')](getTimezoneData(_0x432767[_0x16a818],tmp_voice_queues));}BPromise[_0x0a63('0x1d')](_0x4c12a4)[_0x0a63('0x18')](function(){_0x9caf1({'val':0x1});});})[_0x0a63('0x66')](function(_0x458779){logger['error'](_0x458779[_0x0a63('0x5a')]);_0x9caf1({'val':0x0});});});}function getTimezoneData(_0x3af091,_0x9afd56){return new Promise(function(_0x485723,_0x2a8427){var _0x3b4310=shared[_0x0a63('0x6b')];var _0x286cd4=_0x3b4310[_0x3af091[_0x0a63('0x6c')]];if(_[_0x0a63('0x1e')](_0x286cd4)){_0x485723({'ret':0x1});}else{var _0x5f098a=_0x286cd4[_0x0a63('0x6d')];var _0x2cf628=squel[_0x0a63('0x2d')]()[_0x0a63('0x2e')](_0x9afd56)[_0x0a63('0x6e')]('id',_0x3af091['id'])['set'](_0x0a63('0x6f'),_0x5f098a)[_0x0a63('0x6e')]('dialTimezone',_0x3af091[_0x0a63('0x6c')])[_0x0a63('0x3c')]();return db[_0x0a63('0x5d')][_0x0a63('0x5e')](_0x2cf628)[_0x0a63('0x5f')](function(_0x4b9c67){_0x485723({'ret':0x1});})['catch'](function(_0x44cf76){logger[_0x0a63('0x60')](_0x44cf76[_0x0a63('0x5a')]);_0x2a8427({'ret':0x1});});}});}function handleTZQuery(_0x1bb0e0){logger['info'](_0x1bb0e0);return db[_0x0a63('0x5d')][_0x0a63('0x5e')](_0x1bb0e0)[_0x0a63('0x5f')](function(_0xc2b612){})[_0x0a63('0x66')](function(_0x29dfc0){logger[_0x0a63('0x60')](_0x29dfc0[_0x0a63('0x5a')]);});}function main(_0x2555f2,_0x5db3d4,_0xcf3153,_0x4ec62a){logger['info']('main',_0x2555f2,JSON[_0x0a63('0x70')](_0x5db3d4));process[_0x0a63('0x71')](_0x0a63('0x72'));var _0x2c7ae8=_0x5db3d4['binding'];var _0x27b5ca=_[_0x0a63('0x73')](_0x2c7ae8);var _0x1648fe=_0x5db3d4['socket_timestamp'];var _0x58e575=path[_0x0a63('0x12')](config[_0x0a63('0x74')],_0x0a63('0x75'),_0x1648fe+_0x0a63('0x76'));hasTZ=_['keys'](_0x2c7ae8)[_0x0a63('0x77')]('dialTimezone');var _0x228ff0=_[_0x0a63('0x53')](_0x2c7ae8)[_0x0a63('0x12')]();logger[_0x0a63('0x78')]('header',_0x228ff0);db[_0x0a63('0x79')][_0x0a63('0x17')]({'raw':!![],'attributes':['id',_0x0a63('0x7a')]})[_0x0a63('0x18')](function(_0x125f5f){for(var _0x395aee=0x0;_0x395aee<_0x125f5f[_0x0a63('0x19')];_0x395aee++){if(_0x125f5f[_0x395aee]['name']in _0x2c7ae8){contactItemTypes[_0x0a63('0x1a')](_0x125f5f[_0x395aee]);delete _0x27b5ca[_0x125f5f[_0x395aee][_0x0a63('0x7a')]];hasAdditionalPhones=!![];}for(var _0x4b00e3 in _0x2c7ae8){if(_0x125f5f[_0x395aee][_0x0a63('0x7a')]+'_description'===_0x4b00e3){phoneDescriptions[_0x0a63('0x1a')]({'itemTypeId':_0x125f5f[_0x395aee]['id'],'description':_0x4b00e3});delete _0x27b5ca[_0x4b00e3];}}}if(hasAdditionalPhones)_0x27b5ca[_0x0a63('0x1b')]='';var _0x1324d7=_[_0x0a63('0x53')](_0x27b5ca)[_0x0a63('0x12')]();logger[_0x0a63('0x78')](_0x0a63('0x7b'),_0x1324d7);fs[_0x0a63('0x7c')](_0x58e575,_0x1324d7+'\x0a');Papa['parse'](fs[_0x0a63('0x7d')](_0x2555f2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1fcbe7,_0x5c7e2a){try{for(var _0x31c7a9=0x0,_0x1ef98f=[];_0x31c7a9<_0x1fcbe7[_0x0a63('0x7e')]['length'];_0x31c7a9++){stats[_0x0a63('0x7f')]+=0x1;if(_0x1fcbe7[_0x0a63('0x80')][_0x31c7a9]){handleError(_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9],_0x1fcbe7[_0x0a63('0x80')][_0x31c7a9]);}else{var _0x4680ba=[];var _0x21b717=[];var _0x5e2e75={};for(var _0x43b639 in _0x2c7ae8){let _0x336ff6=contactItemTypes['find'](_0x399e7d=>_0x399e7d[_0x0a63('0x7a')]===_0x43b639);let _0xd2b0a5=contactItemTypes[_0x0a63('0x81')](_0x38e5f8=>_0x38e5f8[_0x0a63('0x7a')]+'_description'===_0x43b639);if(_[_0x0a63('0x1e')](_0x336ff6)&&_[_0x0a63('0x1e')](_0xd2b0a5)){if(_0x2c7ae8[_0x0a63('0x82')](_0x43b639)){if(_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9][_0x2c7ae8[_0x43b639]]){var _0x576c9f=_[_0x0a63('0x83')](_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9][_0x2c7ae8[_0x43b639]][_0x0a63('0x84')](/"/g,'\x27'));switch(_0x43b639){case _0x0a63('0x31'):var _0x9476a3=moment(_0x576c9f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x9476a3[_0x0a63('0x85')]()){_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');}else{_0x4680ba['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3658c3=parseInt(_0x576c9f);_0x576c9f=_['isNaN'](_0x3658c3)||_0x3658c3<0x0||_0x3658c3>0x4?_0x4ec62a?0x3:0x2:_0x3658c3;_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');break;case _0x0a63('0x35'):var _0x244032=parseInt(_0x576c9f);if(_[_0x0a63('0x86')](_0x244032)&&_[_0x0a63('0x77')](_0xcf3153,_0x244032)){_0x1ef98f['push']('\x22'+_0x244032+'\x22');}else{_0x4680ba[_0x0a63('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x576c9f)){_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');}else{_0x4680ba[_0x0a63('0x1a')](_0x0a63('0x87'));}break;case _0x0a63('0x88'):var _0xa4568c=moment(_0x576c9f,_0x0a63('0x89'),!![]);if(_0xa4568c[_0x0a63('0x85')]()){_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');}else{_0x4680ba['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x0a63('0x6c'):var _0x5623df=shared[_0x0a63('0x6b')];var _0x456d25=_0x5623df[_0x576c9f];if(!_[_0x0a63('0x1e')](_0x456d25)){var _0x360281=_0x456d25[_0x0a63('0x6d')];_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x360281+'\x22');}break;default:_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x576c9f+'\x22');}}else{switch(_0x43b639){case'firstName':case _0x0a63('0x11'):_0x4680ba[_0x0a63('0x1a')](_0x43b639+_0x0a63('0x8a'));break;default:_0x1ef98f[_0x0a63('0x1a')]('\x22\x22');}}}}else{var _0x2c2707='';if(!_[_0x0a63('0x1e')](_0x336ff6)){if(!_0x5e2e75[_0x0a63('0x82')](_0x336ff6['id'])){if(!_[_0x0a63('0x1e')](_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9][_0x2c7ae8[_0x43b639]])){var _0x576c9f=_[_0x0a63('0x83')](_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9][_0x2c7ae8[_0x43b639]][_0x0a63('0x84')](/"/g,'\x27'));var _0x199f07=phoneDescriptions[_0x0a63('0x81')](_0x32d9d6=>_0x32d9d6[_0x0a63('0x8b')]===_0x336ff6['id']);if(!_[_0x0a63('0x1e')](_0x199f07)){var _0x42df0c=_[_0x0a63('0x83')](_0x1fcbe7['data'][_0x31c7a9][_0x2c7ae8[_0x199f07[_0x0a63('0x8c')]]][_0x0a63('0x84')](/"/g,'\x27'));if(!_[_0x0a63('0x1e')](_0x42df0c))_0x576c9f=_0x576c9f+'§'+_0x42df0c;}if(_0x2c2707=='')_0x2c2707=_0x576c9f;else _0x2c2707+='|'+_0x576c9f;}_0x21b717[_0x0a63('0x1a')](_0x336ff6['id']+':'+_0x2c2707);_0x5e2e75[_0x336ff6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1ef98f[_0x0a63('0x1a')]('\x22'+_0x21b717[_0x0a63('0x12')](';')+'\x22');}if(_0x4680ba['length']){handleError(_0x1fcbe7['data'][_0x31c7a9],{'code':_0x0a63('0x8d'),'message':_0x4680ba[_0x0a63('0x12')]()});}else{fs[_0x0a63('0x8e')](_0x58e575,_0x1ef98f[_0x0a63('0x12')]()+'\x0a');}_0x1ef98f=[];}if(!(stats[_0x0a63('0x7f')]%0xc8)){socket[_0x0a63('0x8f')]('contact:import:'+_0x1648fe,stats);stats[_0x0a63('0x80')]=[];}}if(stopped){logger['info'](_0x0a63('0x90'));_0x5c7e2a[_0x0a63('0x91')]();}}catch(_0x132377){handleError(_0x1fcbe7[_0x0a63('0x7e')][_0x31c7a9],{'code':_0x0a63('0x92'),'message':_0x132377['message']});logger['error'](_0x0a63('0x93'),_0x132377[_0x0a63('0x5a')]);}},'complete':function(){try{var _0x44a08a=[];var _0x653689=[];var _0x2d9fbc=_0x0a63('0x37');if(_0x5db3d4[_0x0a63('0x94')]&&_0x5db3d4[_0x0a63('0x94')]['length']){_0x2d9fbc=_0x0a63('0x95')+_0x1648fe;_0x44a08a[_0x0a63('0x1a')]('CREATE\x20TABLE\x20'+_0x2d9fbc+_0x0a63('0x96'));}tmp_campaigns=_0x0a63('0x97')+_0x1648fe;tmp_voice_queues=_0x0a63('0x98')+_0x1648fe;_0x653689[_0x0a63('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x0a63('0x99'));_0x653689['push'](_0x0a63('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x0a63('0x9b')](_0x653689,handleTZQuery)[_0x0a63('0x18')](function(_0x3e9528){updateTzCampaigns(_0x5db3d4['ListId'])[_0x0a63('0x18')](function(_0x2eef1c){updateTzVoiceQueues(_0x5db3d4[_0x0a63('0x33')])['then'](function(_0x509bab){if(hasTZ)_0x1324d7=_0x1324d7[_0x0a63('0x84')](_0x0a63('0x6c'),_0x0a63('0x9c'));var _0x23ed64=util[_0x0a63('0xd')](_0x0a63('0x9d'),_0x58e575,_0x2d9fbc,_0x1324d7,_0x5db3d4[_0x0a63('0x33')],_0x5db3d4[_0x0a63('0x54')]||null,NOW,NOW);if(_[_0x0a63('0x1e')](_0x2c7ae8[_0x0a63('0x31')])){_0x23ed64+=_0x0a63('0x9e');}_0x44a08a[_0x0a63('0x1a')](_0x23ed64);if(_0x5db3d4[_0x0a63('0x94')]&&_0x5db3d4[_0x0a63('0x94')]['length']){_0x44a08a['push'](insertCmContact(_0x5db3d4[_0x0a63('0x33')],_0x2d9fbc,_0x5db3d4['duplicates'],_0x2c7ae8));_0x44a08a[_0x0a63('0x1a')]('DROP\x20TABLE\x20'+_0x2d9fbc+';');}BPromise['each'](_0x44a08a,handleQuery)[_0x0a63('0x18')](function(_0x52db65){BPromise['all']([handleAdditionalPhones()])[_0x0a63('0x18')](function(){_0x44a08a=[];for(var _0x31210f=0x0;_0x31210f_0x35fcd3['name']===_0x1b5790);let _0x2503e1=contactItemTypes[_0x378f('0x85')](_0x1b22b4=>_0x1b22b4['name']+_0x378f('0x80')===_0x1b5790);if(_[_0x378f('0x1f')](_0x384ad1)&&_[_0x378f('0x1f')](_0x2503e1)){if(_0x63ec3[_0x378f('0x86')](_0x1b5790)){if(_0x2c668a[_0x378f('0x84')][_0x5465fc][_0x63ec3[_0x1b5790]]){var _0x36817b=_['trim'](_0x2c668a[_0x378f('0x84')][_0x5465fc][_0x63ec3[_0x1b5790]][_0x378f('0x87')](/"/g,'\x27'));switch(_0x1b5790){case'scheduledat':var _0x4b6e62=moment(_0x36817b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4b6e62[_0x378f('0x88')]()){_0x5ee9b1['push']('\x22'+_0x36817b+'\x22');}else{_0xcfb146[_0x378f('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5ee234=parseInt(_0x36817b);_0x36817b=_['isNaN'](_0x5ee234)||_0x5ee234<0x0||_0x5ee234>0x4?_0x48155c?0x3:0x2:_0x5ee234;_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x36817b+'\x22');break;case _0x378f('0x39'):var _0x318a67=parseInt(_0x36817b);if(_[_0x378f('0x89')](_0x318a67)&&_[_0x378f('0x7b')](_0x3ac702,_0x318a67)){_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x318a67+'\x22');}else{_0xcfb146['push'](_0x378f('0x8a'));}break;case _0x378f('0x8b'):if(isEmail(_0x36817b)){_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x36817b+'\x22');}else{_0xcfb146['push']('email\x20wrong\x20format');}break;case _0x378f('0x8c'):var _0x484572=moment(_0x36817b,_0x378f('0x8d'),!![]);if(_0x484572[_0x378f('0x88')]()){_0x5ee9b1['push']('\x22'+_0x36817b+'\x22');}else{_0xcfb146[_0x378f('0x1c')](_0x378f('0x8e'));}break;case'dialTimezone':var _0x5f5b21=shared[_0x378f('0x71')];var _0x208d26=_0x5f5b21[_0x36817b];if(!_[_0x378f('0x1f')](_0x208d26)){var _0x54d3c7=_0x208d26['utcOffset'];_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x36817b+'\x22');_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x54d3c7+'\x22');}break;default:_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x36817b+'\x22');}}else{switch(_0x1b5790){case'firstName':case _0x378f('0x13'):_0xcfb146['push'](_0x1b5790+_0x378f('0x8f'));break;default:_0x5ee9b1[_0x378f('0x1c')]('\x22\x22');}}}}else{var _0x282b09='';if(!_[_0x378f('0x1f')](_0x384ad1)){if(!_0x384d1f['hasOwnProperty'](_0x384ad1['id'])){if(!_['isNil'](_0x2c668a[_0x378f('0x84')][_0x5465fc][_0x63ec3[_0x1b5790]])){var _0x36817b=_[_0x378f('0x90')](_0x2c668a[_0x378f('0x84')][_0x5465fc][_0x63ec3[_0x1b5790]][_0x378f('0x87')](/"/g,'\x27'));var _0x52f127=phoneDescriptions[_0x378f('0x85')](_0x4ff06f=>_0x4ff06f[_0x378f('0x91')]===_0x384ad1['id']);if(!_[_0x378f('0x1f')](_0x52f127)){var _0x1c1227=_[_0x378f('0x90')](_0x2c668a[_0x378f('0x84')][_0x5465fc][_0x63ec3[_0x52f127[_0x378f('0x92')]]][_0x378f('0x87')](/"/g,'\x27'));if(!_[_0x378f('0x1f')](_0x1c1227))_0x36817b=_0x36817b+'§'+_0x1c1227;}if(_0x282b09=='')_0x282b09=_0x36817b;else _0x282b09+='|'+_0x36817b;}_0x2a55e7[_0x378f('0x1c')](_0x384ad1['id']+':'+_0x282b09);_0x384d1f[_0x384ad1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5ee9b1[_0x378f('0x1c')]('\x22'+_0x2a55e7['join'](';')+'\x22');}if(_0xcfb146[_0x378f('0x1b')]){handleError(_0x2c668a[_0x378f('0x84')][_0x5465fc],{'code':_0x378f('0x93'),'message':_0xcfb146['join']()});}else{fs[_0x378f('0x94')](_0x19e8ff,_0x5ee9b1['join']()+'\x0a');}_0x5ee9b1=[];}if(!(stats[_0x378f('0x83')]%0xc8)){socket[_0x378f('0x95')](_0x378f('0x96')+_0x30952f,stats);stats[_0x378f('0x5f')]=[];}}if(stopped){logger[_0x378f('0x5c')](_0x378f('0x97'));_0x3a2dc5[_0x378f('0x98')]();}}catch(_0xf2b502){handleError(_0x2c668a['data'][_0x5465fc],{'code':_0x378f('0x99'),'message':_0xf2b502['message']});logger[_0x378f('0x64')](_0x378f('0x9a'),_0xf2b502[_0x378f('0x61')]);}},'complete':function(){try{var _0x56af4e=[];var _0x56c858=[];var _0x7fca28='cm_contacts';if(_0x43605d[_0x378f('0x9b')]&&_0x43605d[_0x378f('0x9b')]['length']){_0x7fca28='cm_contacts_'+_0x30952f;_0x56af4e[_0x378f('0x1c')](_0x378f('0x9c')+_0x7fca28+_0x378f('0x9d'));}tmp_campaigns=_0x378f('0x9e')+_0x30952f;tmp_voice_queues=_0x378f('0x9f')+_0x30952f;_0x56c858['push'](_0x378f('0x9c')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x56c858[_0x378f('0x1c')](_0x378f('0x9c')+tmp_voice_queues+_0x378f('0xa0'));BPromise[_0x378f('0xa1')](_0x56c858,handleTZQuery)[_0x378f('0x1e')](function(_0x9d67f6){updateTzCampaigns(_0x43605d['ListId'])[_0x378f('0x1e')](function(_0x16519c){updateTzVoiceQueues(_0x43605d[_0x378f('0x36')])[_0x378f('0x1e')](function(_0x4129af){if(hasTZ)_0x49e855=_0x49e855[_0x378f('0x87')](_0x378f('0x74'),_0x378f('0xa2'));var _0x5a94f2=util[_0x378f('0xf')](_0x378f('0xa3'),_0x19e8ff,_0x7fca28,_0x49e855,_0x43605d[_0x378f('0x36')],_0x43605d[_0x378f('0x55')]||null,NOW,NOW);if(_['isNil'](_0x63ec3[_0x378f('0x34')])){_0x5a94f2+=_0x378f('0xa4');}_0x56af4e['push'](_0x5a94f2);if(_0x43605d[_0x378f('0x9b')]&&_0x43605d[_0x378f('0x9b')][_0x378f('0x1b')]){_0x56af4e[_0x378f('0x1c')](insertCmContact(_0x43605d[_0x378f('0x36')],_0x7fca28,_0x43605d[_0x378f('0x9b')],_0x63ec3));_0x56af4e[_0x378f('0x1c')](_0x378f('0xa5')+_0x7fca28+';');}BPromise[_0x378f('0xa1')](_0x56af4e,handleQuery)[_0x378f('0x1e')](function(_0x5bdb0d){BPromise[_0x378f('0x1d')]([handleAdditionalPhones()])[_0x378f('0x1e')](function(){_0x56af4e=[];for(var _0x879011=0x0;_0x879011\x20\x20');}var _0x1a00a3=path[_0x378f('0x15')](config[_0x378f('0x78')],_0x378f('0xb2'),process[_0x378f('0xb1')][0x2]);if(!fs[_0x378f('0xb3')](_0x1a00a3)){throw new Error(_0x378f('0xb4'));}var _0x1d7f40={};try{_0x1d7f40=JSON[_0x378f('0x81')](process[_0x378f('0xb1')][0x3]);if(!_0x1d7f40[_0x378f('0xb5')]){throw new Error(_0x378f('0xb6'));}if(!_0x1d7f40[_0x378f('0xb5')][_0x378f('0x13')]){throw new Error(_0x378f('0xb7'));}if(!_0x1d7f40[_0x378f('0xb5')][_0x378f('0xb8')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5da537=0x0;if(_0x1d7f40[_0x378f('0xb5')][_0x378f('0x39')]){_0x5da537=0x1;}if(!_0x1d7f40['ListId']){throw new Error(_0x378f('0xb9'));}}catch(_0x41dad0){throw new Error(_0x378f('0xba'));}var _0x3631b6=[];try{_0x3631b6=_[_0x378f('0xbb')](JSON[_0x378f('0x81')](process[_0x378f('0xb1')][0x4]),'id');}catch(_0x20add0){logger[_0x378f('0x5c')]('No\x20agent\x20available');}main(_0x1a00a3,_0x1d7f40,_0x3631b6,_0x5da537);}validate();process['on'](_0x378f('0xbc'),handleStop);process['on'](_0x378f('0xbd'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 3c9ed10..7420699 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdad=['isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','each','unlink','catch','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','isNil','push','all','then','error','message','split','length','filter','findOne','CmContactHasItem','updated','create','PHONE','CmHopper','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','info','exit','code','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','_description','AdditionalPhones','writeFileSync','parse','createReadStream','data','errors','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0x24fc94,_0xc09783){var _0x436603=function(_0x41c394){while(--_0x41c394){_0x24fc94['push'](_0x24fc94['shift']());}};_0x436603(++_0xc09783);}(_0xfdad,0x164));var _0xdfda=function(_0x54365c,_0x2f52a5){_0x54365c=_0x54365c-0x0;var _0x41160c=_0xfdad[_0x54365c];return _0x41160c;};'use strict';var fs=require('fs');var path=require(_0xdfda('0x0'));var _=require(_0xdfda('0x1'));var Papa=require('papaparse');var util=require(_0xdfda('0x2'));var BPromise=require(_0xdfda('0x3'));var moment=require('moment');var squel=require(_0xdfda('0x4'));var Redis=require(_0xdfda('0x5'));var db=require(_0xdfda('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xdfda('0x7'))(_0xdfda('0x8'));config['redis']=_[_0xdfda('0x9')](config[_0xdfda('0xa')],{'host':_0xdfda('0xb'),'port':0x18eb});var socket=require(_0xdfda('0xc'))(new Redis(config[_0xdfda('0xa')]));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()[_0xdfda('0xd')](_0xdfda('0xe'));var tempTableName=_0xdfda('0xf')+moment()[_0xdfda('0xd')](_0xdfda('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5fbc46){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))*$/[_0xdfda('0x11')](_0x5fbc46);}function selectNotIn(_0x2bb59c,_0xc3c9d9,_0xb5b1d0,_0x272ae6,_0x55867f){return squel[_0xdfda('0x12')]()[_0xdfda('0x13')](_0xdfda('0x14'))[_0xdfda('0x15')](_0x272ae6)[_0xdfda('0x16')](_0xc3c9d9,null,_0xc3c9d9+'.id\x20=\x20'+_0x272ae6+'.'+_0xb5b1d0)[_0xdfda('0x17')](_0x272ae6+'.'+_0xb5b1d0+'\x20=\x20'+_0x2bb59c+'.'+_0xb5b1d0)['where'](_0xc3c9d9+_0xdfda('0x18')+_0x55867f[_0xdfda('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x372ad4,_0x50f106){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdfda('0x19')]['query'](_0xdfda('0x1a')+tempTableName)[_0xdfda('0x1b')](function(_0x19d124){if(_0x19d124!==null){var _0x3fe8ff=[];for(var _0x55b626=0x0;_0x55b626<_0x19d124['length'];_0x55b626++){var _0x1a791e=_0x19d124[_0x55b626];if(!_[_0xdfda('0x1c')](_0x1a791e[_0xdfda('0x14')])){if(!_[_0xdfda('0x1c')](_0x1a791e['AdditionalPhones']))_0x3fe8ff[_0xdfda('0x1d')](insertAdditionalPhones(_0x1a791e));promisesContact[_0xdfda('0x1d')]({'contact':_0x1a791e});}}}Promise[_0xdfda('0x1e')](_0x3fe8ff)[_0xdfda('0x1f')](function(){_0x372ad4({'val':0x1});});})['catch'](function(_0x55248){logger[_0xdfda('0x20')](_0x55248[_0xdfda('0x21')]);});});}function insertAdditionalPhones(_0x59720c){return new Promise(function(_0x4b6bb8,_0x536f08){var _0x13b40d=_0x59720c['AdditionalPhones'];if(_[_0xdfda('0x1c')](_0x13b40d))_0x536f08({'val':0x0});else{var _0x3ae6a0=_0x13b40d[_0xdfda('0x22')](';');var _0x1db726=[];orderBy=0x0;for(var _0x405228=0x0;_0x405228<_0x3ae6a0['length'];_0x405228++){_0x1db726[_0xdfda('0x1d')](splitAdditionalPhone(_0x59720c['id'],_0x3ae6a0[_0x405228]));}Promise[_0xdfda('0x1e')](_0x1db726)['then'](function(){_0x4b6bb8({'val':_0x3ae6a0[_0xdfda('0x23')]});});}});}function splitAdditionalPhone(_0x545df1,_0x4d9f35){return new Promise(function(_0x50496c,_0xb2628c){var _0x564224=_0x4d9f35[_0xdfda('0x22')](':');var _0x483ce6=_0x564224[0x0];var _0x23be54=_0x564224[0x1];if(_0x23be54!==''){var _0x55b0e6=_0x23be54[_0xdfda('0x22')]('|');var _0x2e70c0=[];for(var _0x18ee77=0x0;_0x18ee77<_0x55b0e6[_0xdfda('0x23')];_0x18ee77++){if(_0x55b0e6[_0x18ee77]!==''){var _0x3f8534=_[_0xdfda('0x24')](promisesAdditionalPhones,{'contactId':_0x545df1,'phone':_0x55b0e6[_0x18ee77]});if(_0x3f8534[_0xdfda('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0xdfda('0x1d')]({'contactId':_0x545df1,'contactTypeId':_0x483ce6,'phone':_0x55b0e6[_0x18ee77],'orderBy':orderBy});}}}_0x50496c({'ok':0x1});}else _0x50496c({'res':0x0});});}function createAdditionalPhone(_0x499438,_0x244799,_0x57331a,_0x1e0f8f){var _0x594822='';var _0x12a057='';var _0x3c1b52=_0x57331a['split']('§');_0x594822=_0x3c1b52[0x0];if(_0x3c1b52[_0xdfda('0x23')]==0x2)_0x12a057=_0x3c1b52[0x1];return new Promise(function(_0x1c88b6,_0x4351f6){return db['CmContactHasItem'][_0xdfda('0x25')]({'where':{'CmContactId':_0x499438,'item':_0x594822}})[_0xdfda('0x1f')](function(_0x5d3673){if(_0x5d3673){return db[_0xdfda('0x26')]['update']({'ItemTypeId':_0x244799,'description':_0x12a057,'OrderBy':_0x1e0f8f},{'where':{'CmContactId':_0x499438,'item':_0x594822}})[_0xdfda('0x1f')](function(_0x20d136){_0x1c88b6({'res':_0xdfda('0x27')});});}else{return db[_0xdfda('0x26')][_0xdfda('0x28')]({'CmContactId':_0x499438,'item':_0x594822,'ItemTypeId':_0x244799,'description':_0x12a057,'OrderBy':_0x1e0f8f,'ItemClass':_0xdfda('0x29')})['then'](function(_0x1addf5){_0x1c88b6({'res':'inserted'});});}});});}function updateContact(_0x4b9383){return new Promise(function(_0x140aaa,_0x44a521){var _0x137031=_0x4b9383['id'];delete _0x4b9383['id'];return db['CmContact']['update'](_0x4b9383,{'where':{'id':_0x137031}})[_0xdfda('0x1f')](function(_0x5386ec){updatedRows+=0x1;return db[_0xdfda('0x2a')][_0xdfda('0x2b')]({'phone':_0x4b9383[_0xdfda('0x14')]},{'where':{'ContactId':_0x137031}})[_0xdfda('0x1f')](function(_0x437618){_0x140aaa({'ret':'OK'});});});});}function insertCmHopper(_0x5c0b8,_0x8b3916,_0x2b63f3,_0x1c30da,_0x5e02a5){var _0x593d76=[_0xdfda('0x2c'),_0xdfda('0x2d'),_0xdfda('0x2e'),_0xdfda('0x2f'),_0x8b3916+'.'+_0x1c30da,_0xdfda('0x30'),_0xdfda('0x31'),_0xdfda('0x32'),_0xdfda('0x33'),'\x22'+_0x5e02a5+'\x22'];return squel['insert']()['into'](_0xdfda('0x34'))[_0xdfda('0x35')]([_0xdfda('0x14'),_0xdfda('0x36'),_0xdfda('0x37'),_0xdfda('0x38'),_0x1c30da,_0xdfda('0x39'),_0xdfda('0x3a'),_0xdfda('0x3b'),_0xdfda('0x3c'),'recallme'],squel[_0xdfda('0x12')]()[_0xdfda('0x3d')](_0x593d76)[_0xdfda('0x15')](_0x8b3916)[_0xdfda('0x16')](_0xdfda('0x3e'),null,_0xdfda('0x3f')+_0x8b3916+_0xdfda('0x40'))[_0xdfda('0x16')](_0x2b63f3,null,_0x2b63f3+_0xdfda('0x41')+_0x8b3916+'.'+_0x1c30da)[_0xdfda('0x17')](_0x8b3916+_0xdfda('0x42'),_0x5c0b8)[_0xdfda('0x17')](_0xdfda('0x43'),NOW)['where'](_0xdfda('0x44'),selectNotIn(_0x8b3916,_0x2b63f3,_0x1c30da,_0xdfda('0x34'),[_0xdfda('0x45'),_0xdfda('0x46')]))[_0xdfda('0x17')](_0xdfda('0x44'),selectNotIn(_0x8b3916,_0x2b63f3,_0x1c30da,'cm_hopper',[_0xdfda('0x45')])))[_0xdfda('0x47')]();}function insertCmHopperBlack(_0x405567,_0x3519a3,_0x455500,_0xf6e8e2){var _0x2e5a6e=[_0xdfda('0x2c'),_0xdfda('0x2e'),_0xdfda('0x2f'),_0x3519a3+'.'+_0xf6e8e2,_0xdfda('0x30'),_0xdfda('0x31')];return squel['insert']()[_0xdfda('0x48')](_0xdfda('0x49'))[_0xdfda('0x35')]([_0xdfda('0x14'),_0xdfda('0x37'),'ListId',_0xf6e8e2,'createdAt',_0xdfda('0x3a')],squel[_0xdfda('0x12')]()['fields'](_0x2e5a6e)['from'](_0x3519a3)[_0xdfda('0x16')](_0xdfda('0x3e'),null,_0xdfda('0x3f')+_0x3519a3+'.CmListId')[_0xdfda('0x16')](_0x455500,null,_0x455500+_0xdfda('0x41')+_0x3519a3+'.'+_0xf6e8e2)[_0xdfda('0x17')](_0x3519a3+_0xdfda('0x42'),_0x405567)[_0xdfda('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xdfda('0x44'),squel[_0xdfda('0x12')]()[_0xdfda('0x13')](_0xdfda('0x14'))[_0xdfda('0x15')](_0xdfda('0x49'))[_0xdfda('0x17')]('ListId\x20=\x20?',_0x405567)[_0xdfda('0x17')](_0xf6e8e2+'\x20=\x20?',_0x3519a3+'.'+_0xf6e8e2)))[_0xdfda('0x47')]();}function insertCmHopperAdditionalPhones(_0x356df1){var _0x1d1b39=[_0xdfda('0x4a'),_0xdfda('0x4b'),'cm_contact_has_items.OrderBy',_0xdfda('0x4c'),_0xdfda('0x4d')];return squel[_0xdfda('0x4e')]()[_0xdfda('0x48')]('cm_hopper_additional_phones')[_0xdfda('0x35')]([_0xdfda('0x4f'),_0xdfda('0x14'),'OrderBy',_0xdfda('0x39'),_0xdfda('0x3a')],squel['select']()[_0xdfda('0x3d')](_0x1d1b39)[_0xdfda('0x15')](_0xdfda('0x34'))[_0xdfda('0x16')]('cm_contacts',null,_0xdfda('0x50'))['join']('cm_contact_has_items',null,_0xdfda('0x51'))[_0xdfda('0x17')](_0xdfda('0x52'),_0x356df1)[_0xdfda('0x17')](_0xdfda('0x43'),NOW))[_0xdfda('0x47')]();}function insertCmContact(_0x5d3326,_0x52a8b4,_0x443ad0,_0x5cb803){var _0x1f93b2=_['concat'](_[_0xdfda('0x53')](_0x5cb803),[_0xdfda('0x38'),_0xdfda('0x54'),_0xdfda('0x39'),'updatedAt']);return squel[_0xdfda('0x4e')]()[_0xdfda('0x48')](_0xdfda('0x3e'))[_0xdfda('0x35')](_0x1f93b2,squel[_0xdfda('0x12')]()['fields'](_0x1f93b2)[_0xdfda('0x15')](_0x52a8b4)[_0xdfda('0x17')]('('+_0x443ad0['join'](',')+_0xdfda('0x55'),squel['select']()[_0xdfda('0x3d')](_0x443ad0)['from'](_0xdfda('0x3e'))[_0xdfda('0x17')](_0xdfda('0x56'),_0x5d3326))[_0xdfda('0x17')](_0xdfda('0x57'),squel[_0xdfda('0x12')]()['field'](_0xdfda('0x58'),_0xdfda('0x59'))[_0xdfda('0x15')](_0x52a8b4)['group'](_0x443ad0[_0xdfda('0x16')](','))))[_0xdfda('0x47')]();}function handleStop(){logger[_0xdfda('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x180d2f){logger[_0xdfda('0x20')](_0x180d2f[_0xdfda('0x21')]);process[_0xdfda('0x5b')](0x1);}function handleError(_0x1be12b,_0x2da80f){stats['errors']['push']({'name':_0x2da80f[_0xdfda('0x5c')],'message':_0x2da80f['message'],'row':_0x1be12b});}function handleQuery(_0x3b0413){logger['info'](_0x3b0413);return db['sequelize']['query'](_0x3b0413)['spread'](function(_0x5f729b){results[_0xdfda('0x1d')](_0x5f729b);})['catch'](function(_0x3a7562){logger['error'](_0x3a7562['message']);});}function main(_0x41a357,_0x1abf33,_0x2a064d,_0x2b9463){logger[_0xdfda('0x5a')](_0xdfda('0x5d'),_0x41a357,JSON[_0xdfda('0x5e')](_0x1abf33));process[_0xdfda('0x5f')]('start');var _0x159a1b=_0x1abf33[_0xdfda('0x60')];var _0x5b7356=_['clone'](_0x159a1b);var _0x45ecb4=_0x1abf33[_0xdfda('0x61')];var _0x2112f1=path['join'](config[_0xdfda('0x62')],_0xdfda('0x63'),_0x45ecb4+_0xdfda('0x64'));logger[_0xdfda('0x5a')](_0xdfda('0x65'),_0x1abf33);db['ContactItemType'][_0xdfda('0x66')]({'raw':!![],'attributes':['id','name']})[_0xdfda('0x1f')](function(_0x299bb9){for(var _0x3a13ee=0x0;_0x3a13ee<_0x299bb9['length'];_0x3a13ee++){if(_0x299bb9[_0x3a13ee][_0xdfda('0x67')]in _0x159a1b){contactItemTypes[_0xdfda('0x1d')](_0x299bb9[_0x3a13ee]);delete _0x5b7356[_0x299bb9[_0x3a13ee][_0xdfda('0x67')]];hasAdditionalPhones=!![];}for(var _0x3fb84d in _0x159a1b){if(_0x299bb9[_0x3a13ee]['name']+_0xdfda('0x68')===_0x3fb84d){phoneDescriptions[_0xdfda('0x1d')]({'itemTypeId':_0x299bb9[_0x3a13ee]['id'],'description':_0x3fb84d});delete _0x5b7356[_0x3fb84d];}}}if(hasAdditionalPhones)_0x5b7356[_0xdfda('0x69')]='';var _0x2c7d3a=_['keys'](_0x5b7356)[_0xdfda('0x16')]();logger[_0xdfda('0x5a')]('header',_0x2c7d3a);fs[_0xdfda('0x6a')](_0x2112f1,_0x2c7d3a+'\x0a');Papa[_0xdfda('0x6b')](fs[_0xdfda('0x6c')](_0x41a357),{'header':!![],'skipEmptyLines':!![],'step':function(_0x471fe3,_0x285053){try{for(var _0x21ba3c=0x0,_0x342829=[];_0x21ba3c<_0x471fe3[_0xdfda('0x6d')][_0xdfda('0x23')];_0x21ba3c++){stats['rows']+=0x1;if(_0x471fe3[_0xdfda('0x6e')][_0x21ba3c]){handleError(_0x471fe3['data'][_0x21ba3c],_0x471fe3[_0xdfda('0x6e')][_0x21ba3c]);}else{var _0x25dafe=[];var _0x5a63f5=[];var _0x90c372={};for(var _0x8b2c3c in _0x159a1b){let _0x2b842d=contactItemTypes[_0xdfda('0x6f')](_0x191139=>_0x191139['name']===_0x8b2c3c);let _0x5d4981=contactItemTypes[_0xdfda('0x6f')](_0x128f23=>_0x128f23[_0xdfda('0x67')]+'_description'===_0x8b2c3c);if(_[_0xdfda('0x1c')](_0x2b842d)&&_['isNil'](_0x5d4981)){if(_0x159a1b[_0xdfda('0x70')](_0x8b2c3c)){if(_0x471fe3[_0xdfda('0x6d')][_0x21ba3c][_0x159a1b[_0x8b2c3c]]){var _0x2c2eac=_[_0xdfda('0x71')](_0x471fe3['data'][_0x21ba3c][_0x159a1b[_0x8b2c3c]]['replace'](/"/g,'\x27'));switch(_0x8b2c3c){case'scheduledat':var _0x3109db=moment(_0x2c2eac,_0xdfda('0xe'),!![]);if(_0x3109db['isValid']()){_0x342829[_0xdfda('0x1d')]('\x22'+_0x2c2eac+'\x22');}else{_0x25dafe['push'](_0xdfda('0x72'));}break;case'priority':var _0x228a22=parseInt(_0x2c2eac);_0x2c2eac=_[_0xdfda('0x73')](_0x228a22)||_0x228a22<0x0||_0x228a22>0x4?_0x2b9463?0x3:0x2:_0x228a22;_0x342829['push']('\x22'+_0x2c2eac+'\x22');break;case _0xdfda('0x3c'):var _0x34df26=parseInt(_0x2c2eac);if(_[_0xdfda('0x74')](_0x34df26)&&_['includes'](_0x2a064d,_0x34df26)){_0x342829[_0xdfda('0x1d')]('\x22'+_0x34df26+'\x22');}else{_0x25dafe[_0xdfda('0x1d')](_0xdfda('0x75'));}break;case _0xdfda('0x76'):if(isEmail(_0x2c2eac)){_0x342829[_0xdfda('0x1d')]('\x22'+_0x2c2eac+'\x22');}else{_0x25dafe[_0xdfda('0x1d')](_0xdfda('0x77'));}break;case _0xdfda('0x78'):var _0x563ef9=moment(_0x2c2eac,_0xdfda('0x79'),!![]);if(_0x563ef9[_0xdfda('0x7a')]()){_0x342829[_0xdfda('0x1d')]('\x22'+_0x2c2eac+'\x22');}else{_0x25dafe[_0xdfda('0x1d')](_0xdfda('0x7b'));}break;default:_0x342829[_0xdfda('0x1d')]('\x22'+_0x2c2eac+'\x22');}}else{switch(_0x8b2c3c){case _0xdfda('0x7c'):case _0xdfda('0x14'):_0x25dafe[_0xdfda('0x1d')](_0x8b2c3c+_0xdfda('0x7d'));break;default:_0x342829['push']('\x22\x22');}}}}else{var _0x35187d='';if(!_[_0xdfda('0x1c')](_0x2b842d)){if(!_0x90c372[_0xdfda('0x70')](_0x2b842d['id'])){for(var _0x3f52cb=0x0;_0x3f52cb<_0x159a1b[_0x8b2c3c][_0xdfda('0x23')];_0x3f52cb++){var _0x2c2eac=_[_0xdfda('0x71')](_0x471fe3[_0xdfda('0x6d')][_0x21ba3c][_0x159a1b[_0x8b2c3c][_0x3f52cb]][_0xdfda('0x7e')](/"/g,'\x27'));var _0x4894e1=phoneDescriptions[_0xdfda('0x6f')](_0x393a70=>_0x393a70[_0xdfda('0x7f')]===_0x2b842d['id']);if(!_[_0xdfda('0x1c')](_0x4894e1)){var _0x2b7139=_['trim'](_0x471fe3[_0xdfda('0x6d')][_0x21ba3c][_0x159a1b[_0x4894e1[_0xdfda('0x80')]][0x0]][_0xdfda('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x2b7139))_0x2c2eac=_0x2c2eac+'§'+_0x2b7139;}if(_0x35187d=='')_0x35187d=_0x2c2eac;else _0x35187d+='|'+_0x2c2eac;}_0x5a63f5[_0xdfda('0x1d')](_0x2b842d['id']+':'+_0x35187d);_0x90c372[_0x2b842d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x342829[_0xdfda('0x1d')]('\x22'+_0x5a63f5[_0xdfda('0x16')](';')+'\x22');}if(_0x25dafe[_0xdfda('0x23')]){handleError(_0x471fe3['data'][_0x21ba3c],{'code':_0xdfda('0x81'),'message':_0x25dafe[_0xdfda('0x16')]()});}else{fs[_0xdfda('0x82')](_0x2112f1,_0x342829[_0xdfda('0x16')]()+'\x0a');}_0x342829=[];}if(!(stats[_0xdfda('0x83')]%0xc8)){socket[_0xdfda('0x84')](_0xdfda('0x85')+_0x45ecb4,stats);stats[_0xdfda('0x6e')]=[];}}if(stopped){logger[_0xdfda('0x5a')](_0xdfda('0x86'));_0x285053[_0xdfda('0x87')]();}}catch(_0x2618bc){handleError(_0x471fe3[_0xdfda('0x6d')][_0x21ba3c],{'code':'SystemError','message':_0x2618bc[_0xdfda('0x21')]});logger['error']('step',_0x2618bc[_0xdfda('0x21')]);}},'complete':function(){try{var _0x57c572=[];var _0x5a9c32=tempTableName;_0x57c572['push'](_0xdfda('0x88')+_0x5a9c32+_0xdfda('0x89'));logger['info'](_0xdfda('0x8a'),contactItemTypes[_0xdfda('0x23')]);var _0x17feb6=util[_0xdfda('0xd')](_0xdfda('0x8b'),_0x2112f1,_0x5a9c32,_0x2c7d3a,_0x1abf33[_0xdfda('0x38')],_0x1abf33['CompanyId']||null,NOW,NOW);if(_[_0xdfda('0x1c')](_0x159a1b['scheduledat'])){_0x17feb6+=',\x20scheduledAt\x20=\x20NOW()';}_0x57c572[_0xdfda('0x1d')](_0x17feb6);BPromise['each'](_0x57c572,handleQuery)[_0xdfda('0x1f')](function(_0x48e2cd){BPromise[_0xdfda('0x1e')]([handleAdditionalPhones()])[_0xdfda('0x1f')](function(){_0x57c572=[];for(var _0xbc7a6d=0x0;_0xbc7a6d_0x4ad765[_0x4055('0x62')]===_0x153911);let _0x428429=contactItemTypes[_0x4055('0x69')](_0x18ca56=>_0x18ca56[_0x4055('0x62')]+'_description'===_0x153911);if(_[_0x4055('0x17')](_0x43e9d4)&&_[_0x4055('0x17')](_0x428429)){if(_0x36b6d4[_0x4055('0x6a')](_0x153911)){if(_0x15123e['data'][_0x4b206f][_0x36b6d4[_0x153911]]){var _0x2f358c=_['trim'](_0x15123e[_0x4055('0x66')][_0x4b206f][_0x36b6d4[_0x153911]][_0x4055('0x6b')](/"/g,'\x27'));switch(_0x153911){case _0x4055('0x2c'):var _0x1fcc54=moment(_0x2f358c,_0x4055('0xc'),!![]);if(_0x1fcc54[_0x4055('0x6c')]()){_0x4b25d4['push']('\x22'+_0x2f358c+'\x22');}else{_0x407b5f[_0x4055('0x1a')](_0x4055('0x6d'));}break;case _0x4055('0x31'):var _0x4f5331=parseInt(_0x2f358c);_0x2f358c=_[_0x4055('0x6e')](_0x4f5331)||_0x4f5331<0x0||_0x4f5331>0x4?_0x47dc24?0x3:0x2:_0x4f5331;_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x2f358c+'\x22');break;case'UserId':var _0x435be8=parseInt(_0x2f358c);if(_[_0x4055('0x6f')](_0x435be8)&&_['includes'](_0xcb9d46,_0x435be8)){_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x435be8+'\x22');}else{_0x407b5f[_0x4055('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2f358c)){_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x2f358c+'\x22');}else{_0x407b5f[_0x4055('0x1a')](_0x4055('0x70'));}break;case'dateOfBirth':var _0x1cd272=moment(_0x2f358c,_0x4055('0x71'),!![]);if(_0x1cd272['isValid']()){_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x2f358c+'\x22');}else{_0x407b5f[_0x4055('0x1a')](_0x4055('0x72'));}break;default:_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x2f358c+'\x22');}}else{switch(_0x153911){case'firstName':case _0x4055('0x18'):_0x407b5f[_0x4055('0x1a')](_0x153911+_0x4055('0x73'));break;default:_0x4b25d4['push']('\x22\x22');}}}}else{var _0x41596d='';if(!_[_0x4055('0x17')](_0x43e9d4)){if(!_0x42317c[_0x4055('0x6a')](_0x43e9d4['id'])){for(var _0x4271b7=0x0;_0x4271b7<_0x36b6d4[_0x153911]['length'];_0x4271b7++){var _0x2f358c=_[_0x4055('0x74')](_0x15123e['data'][_0x4b206f][_0x36b6d4[_0x153911][_0x4271b7]][_0x4055('0x6b')](/"/g,'\x27'));var _0x596a68=phoneDescriptions[_0x4055('0x69')](_0x526138=>_0x526138['itemTypeId']===_0x43e9d4['id']);if(!_['isNil'](_0x596a68)){var _0x89490c=_['trim'](_0x15123e['data'][_0x4b206f][_0x36b6d4[_0x596a68[_0x4055('0x75')]][0x0]][_0x4055('0x6b')](/"/g,'\x27'));if(!_[_0x4055('0x17')](_0x89490c))_0x2f358c=_0x2f358c+'§'+_0x89490c;}if(_0x41596d=='')_0x41596d=_0x2f358c;else _0x41596d+='|'+_0x2f358c;}_0x21c989[_0x4055('0x1a')](_0x43e9d4['id']+':'+_0x41596d);_0x42317c[_0x43e9d4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4b25d4[_0x4055('0x1a')]('\x22'+_0x21c989[_0x4055('0x12')](';')+'\x22');}if(_0x407b5f[_0x4055('0x16')]){handleError(_0x15123e[_0x4055('0x66')][_0x4b206f],{'code':'SystemRow','message':_0x407b5f[_0x4055('0x12')]()});}else{fs[_0x4055('0x76')](_0x4a96a9,_0x4b25d4['join']()+'\x0a');}_0x4b25d4=[];}if(!(stats[_0x4055('0x67')]%0xc8)){socket[_0x4055('0x77')](_0x4055('0x78')+_0x120193,stats);stats[_0x4055('0x68')]=[];}}if(stopped){logger[_0x4055('0x53')](_0x4055('0x79'));_0x36d091[_0x4055('0x7a')]();}}catch(_0x2725bd){handleError(_0x15123e[_0x4055('0x66')][_0x4b206f],{'code':_0x4055('0x7b'),'message':_0x2725bd[_0x4055('0x1e')]});logger[_0x4055('0x55')](_0x4055('0x7c'),_0x2725bd[_0x4055('0x1e')]);}},'complete':function(){try{var _0x5d4159=[];var _0x3dfed1=tempTableName;_0x5d4159[_0x4055('0x1a')](_0x4055('0x7d')+_0x3dfed1+_0x4055('0x7e'));logger[_0x4055('0x53')](_0x4055('0x7f'),contactItemTypes[_0x4055('0x16')]);var _0x13c100=util[_0x4055('0xb')](_0x4055('0x80'),_0x4a96a9,_0x3dfed1,_0x5bcec5,_0x6ea57f[_0x4055('0x2e')],_0x6ea57f[_0x4055('0x4f')]||null,NOW,NOW);if(_['isNil'](_0x36b6d4['scheduledat'])){_0x13c100+=_0x4055('0x81');}_0x5d4159[_0x4055('0x1a')](_0x13c100);BPromise['each'](_0x5d4159,handleQuery)[_0x4055('0x1c')](function(_0x4d6ce4){BPromise[_0x4055('0x1b')]([handleAdditionalPhones()])['then'](function(){_0x5d4159=[];for(var _0x5f04bf=0x0;_0x5f04bf\x20\x20');}var _0x86638e=path['join'](config['root'],_0x4055('0x5e'),process[_0x4055('0x88')][0x2]);if(!fs[_0x4055('0x89')](_0x86638e)){throw new Error(_0x4055('0x8a'));}var _0x2fd42d={};try{_0x2fd42d=JSON[_0x4055('0x8b')](process[_0x4055('0x88')][0x3]);if(!_0x2fd42d[_0x4055('0x5b')]){throw new Error(_0x4055('0x8c'));}var _0x12c376=0x0;if(_0x2fd42d[_0x4055('0x5b')][_0x4055('0x8d')]){_0x12c376=0x1;}if(!_0x2fd42d[_0x4055('0x2e')]){throw new Error(_0x4055('0x8e'));}}catch(_0x1f9b10){throw new Error(_0x4055('0x8f'));}var _0x39678b=[];try{_0x39678b=_[_0x4055('0x90')](JSON[_0x4055('0x8b')](process[_0x4055('0x88')][0x4]),'id');}catch(_0x3a4440){logger['info'](_0x4055('0x91'));}main(_0x86638e,_0x2fd42d,_0x39678b,_0x12c376);}validate();process['on']('SIGINT',handleStop);process['on'](_0x4055('0x92'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 4a4d59c..99262fb 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 _0xb1ea=['inbound','push','variable','queue','calleridnum','string','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','talktime','outbound','Called\x20Number','UniqueId','Date','starttime','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice'];(function(_0x5e8c33,_0xa860fc){var _0x90aa31=function(_0x37d17e){while(--_0x37d17e){_0x5e8c33['push'](_0x5e8c33['shift']());}};_0x90aa31(++_0xa860fc);}(_0xb1ea,0xcf));var _0xab1e=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xb1ea[_0x515afd];return _0x536d53;};'use strict';exports['getSubjects']=function(_0xf7dd73,_0x57924c){var _0x29e458=[{'type':'string','content':_0xab1e('0x0'),'variableName':null}];switch(_0xf7dd73[_0xab1e('0x1')]()){case _0xab1e('0x2'):switch(_0x57924c[_0xab1e('0x1')]()){case _0xab1e('0x3'):_0x29e458[_0xab1e('0x4')]({'type':_0xab1e('0x5'),'content':'','variableName':_0xab1e('0x6')});_0x29e458[_0xab1e('0x4')]({'type':_0xab1e('0x5'),'content':'','variableName':_0xab1e('0x7')});break;case'outbound':_0x29e458[_0xab1e('0x4')]({'type':_0xab1e('0x8'),'content':_0xab1e('0x9'),'variableName':null});_0x29e458[_0xab1e('0x4')]({'type':_0xab1e('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x29e458;};exports[_0xab1e('0xa')]=function(_0x4fc1c8,_0x4dffd4){var _0xfe7176=[];switch(_0x4fc1c8[_0xab1e('0x1')]()){case _0xab1e('0x2'):switch(_0x4dffd4[_0xab1e('0x1')]()){case _0xab1e('0x3'):_0xfe7176=[{'type':_0xab1e('0x8'),'content':_0xab1e('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0xd'),'keyType':_0xab1e('0x5'),'variableName':'calleridnum'},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0xe'),'keyType':_0xab1e('0x5'),'variableName':_0xab1e('0xf')},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x10'),'keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x11')},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x12'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0xab1e('0x13')},{'type':_0xab1e('0xc'),'content':'','key':'Date','keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x14')},{'type':_0xab1e('0x8'),'content':_0xab1e('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xab1e('0x16'),'keyType':_0xab1e('0x5'),'variableName':'destcalleridname'},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x17'),'keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x18')},{'type':'string','content':_0xab1e('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xab1e('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0xab1e('0x5'),'variableName':'agentcalledAt'},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x1a'),'keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x1b')},{'type':'keyValue','content':'','key':_0xab1e('0x1c'),'keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x1d')},{'type':_0xab1e('0xc'),'content':'','key':'Hold\x20Time','keyType':_0xab1e('0x5'),'variableName':'holdtime'},{'type':_0xab1e('0xc'),'content':'','key':'Talk\x20Time','keyType':_0xab1e('0x5'),'variableName':_0xab1e('0x1e')}];break;case _0xab1e('0x1f'):_0xfe7176=[{'type':_0xab1e('0x8'),'content':_0xab1e('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0xab1e('0x20'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x21'),'keyType':_0xab1e('0x5'),'keyContent':'','variableName':_0xab1e('0x13')},{'type':'keyValue','content':'','key':_0xab1e('0x22'),'keyType':'variable','keyContent':'','variableName':_0xab1e('0x23')},{'type':_0xab1e('0x8'),'content':_0xab1e('0x19')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xab1e('0x5'),'keyContent':'','variableName':_0xab1e('0x24')},{'type':_0xab1e('0xc'),'content':'','key':_0xab1e('0x25'),'keyType':_0xab1e('0x5'),'keyContent':'','variableName':_0xab1e('0x26')},{'type':'keyValue','content':'','key':_0xab1e('0x27'),'keyType':_0xab1e('0x5'),'keyContent':'','variableName':_0xab1e('0x28')},{'type':_0xab1e('0xc'),'content':'','key':'Billable\x20Time','keyType':_0xab1e('0x5'),'keyContent':'','variableName':_0xab1e('0x29')}];break;}}return _0xfe7176;}; \ No newline at end of file +var _0x2f71=['Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***'];(function(_0x255840,_0x411b6e){var _0x40dad5=function(_0x258d8d){while(--_0x258d8d){_0x255840['push'](_0x255840['shift']());}};_0x40dad5(++_0x411b6e);}(_0x2f71,0x98));var _0x12f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2f71[_0x2dafbe];return _0x58a45a;};'use strict';exports[_0x12f7('0x0')]=function(_0x515e99,_0x5a5c3e){var _0x1cdc78=[{'type':_0x12f7('0x1'),'content':_0x12f7('0x2'),'variableName':null}];switch(_0x515e99[_0x12f7('0x3')]()){case _0x12f7('0x4'):switch(_0x5a5c3e[_0x12f7('0x3')]()){case _0x12f7('0x5'):_0x1cdc78[_0x12f7('0x6')]({'type':_0x12f7('0x7'),'content':'','variableName':_0x12f7('0x8')});_0x1cdc78['push']({'type':_0x12f7('0x7'),'content':'','variableName':_0x12f7('0x9')});break;case _0x12f7('0xa'):_0x1cdc78[_0x12f7('0x6')]({'type':_0x12f7('0x1'),'content':_0x12f7('0xb'),'variableName':null});_0x1cdc78[_0x12f7('0x6')]({'type':_0x12f7('0x7'),'content':'','variableName':_0x12f7('0xc')});break;}}return _0x1cdc78;};exports[_0x12f7('0xd')]=function(_0x28f151,_0x16590f){var _0x119893=[];switch(_0x28f151['toLowerCase']()){case _0x12f7('0x4'):switch(_0x16590f['toLowerCase']()){case _0x12f7('0x5'):_0x119893=[{'type':_0x12f7('0x1'),'content':_0x12f7('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x10'),'keyType':'variable','variableName':_0x12f7('0x9')},{'type':'keyValue','content':'','key':_0x12f7('0x11'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x12')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x13')},{'type':_0x12f7('0xf'),'content':'','key':'Queue','keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x8')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x14'),'keyType':'variable','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x12f7('0x15'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x16')},{'type':'string','content':_0x12f7('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x18'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x19')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x1a'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0xc')},{'type':'string','content':_0x12f7('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x1c'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x16')},{'type':'keyValue','content':'','key':_0x12f7('0x1d'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x1e')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x1f'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x20')},{'type':'keyValue','content':'','key':_0x12f7('0x21'),'keyType':_0x12f7('0x7'),'variableName':_0x12f7('0x22')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x23'),'keyType':_0x12f7('0x7'),'variableName':'talktime'}];break;case _0x12f7('0xa'):_0x119893=[{'type':'string','content':_0x12f7('0xe'),'variableName':null},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x24'),'keyType':_0x12f7('0x7'),'keyContent':'','variableName':_0x12f7('0xc')},{'type':'keyValue','content':'','key':_0x12f7('0x25'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x14'),'keyType':_0x12f7('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x12f7('0xf'),'content':'','key':'Date','keyType':_0x12f7('0x7'),'keyContent':'','variableName':_0x12f7('0x26')},{'type':_0x12f7('0x1'),'content':_0x12f7('0x1b')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x27'),'keyType':_0x12f7('0x7'),'keyContent':'','variableName':_0x12f7('0x28')},{'type':_0x12f7('0xf'),'content':'','key':_0x12f7('0x29'),'keyType':_0x12f7('0x7'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x12f7('0x2a'),'keyType':_0x12f7('0x7'),'keyContent':'','variableName':'duration'},{'type':_0x12f7('0xf'),'content':'','key':'Billable\x20Time','keyType':_0x12f7('0x7'),'keyContent':'','variableName':_0x12f7('0x2b')}];break;}}return _0x119893;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 04f496f..4cc9505 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 _0xd2ca=['read','tags','group','i.id','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','closed','getClosedOrderClause','DESC','getFilteredInteractions','rows','catch','tracked','user','query','clone','omit','html','phone','mobile','./sql-utils','./utils','getInteractionsQuery','resolve','then','search','parseQueryParameters','body','where','contact','default','fields','filter','having'];(function(_0x43600e,_0x37ec91){var _0x31f1a3=function(_0x4375b3){while(--_0x4375b3){_0x43600e['push'](_0x43600e['shift']());}};_0x31f1a3(++_0x37ec91);}(_0xd2ca,0xe2));var _0xad2c=function(_0x526ba7,_0x33a7d1){_0x526ba7=_0x526ba7-0x0;var _0x93675b=_0xd2ca[_0x526ba7];return _0x93675b;};'use strict';var _=require('lodash');var sqlUtils=require(_0xad2c('0x0'));var utils=require(_0xad2c('0x1'));exports['findAll']=function(_0xb5b9d2,_0x1cebda,_0x3cd509,_0x2d4252,_0x39122a){var _0x44be67={'count':0x0,'rows':[]};var _0x584bb9=sqlUtils['skipInteractionsQuery'](_0xb5b9d2,_0x3cd509,_0x1cebda);if(_0x584bb9){return Promise['resolve'](_0x44be67);}var _0x4ae2ca=sqlUtils[_0xad2c('0x2')](_0xb5b9d2);var _0x4a7f20={};return Promise[_0xad2c('0x3')]()[_0xad2c('0x4')](function(){if(_0x1cebda[_0xad2c('0x5')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1cebda['search'],_0x39122a);}else{return sqlUtils[_0xad2c('0x6')](_0xb5b9d2,_0x1cebda,_0x39122a);}})['then'](function(_0x326305){_0x4ae2ca['where'](_0x326305[_0xad2c('0x7')]);_0x4ae2ca[_0xad2c('0x8')](_0x326305[_0xad2c('0x9')]);_0x4ae2ca[_0xad2c('0x8')](_0x326305[_0xad2c('0xa')]);_0x4ae2ca['where'](_0x326305[_0xad2c('0xb')]);_0x4ae2ca['where'](_0x326305[_0xad2c('0xc')]);_0x4ae2ca[_0xad2c('0x8')](_0x326305['user']);_0x4ae2ca[_0xad2c('0xd')](_0x326305[_0xad2c('0xe')]);_0x4a7f20=_0x326305[_0xad2c('0xf')];return sqlUtils['checkAccountsRestrictions'](_0xb5b9d2,_0x3cd509,_0x1cebda);})['then'](function(_0x1173be){_0x4ae2ca[_0xad2c('0x8')](_0x1173be);_0x4ae2ca[_0xad2c('0x10')](_0xad2c('0x11'));var _0x49fc5a=_0x1cebda[_0xad2c('0x5')]?_0x4a7f20['ids']:_0x1cebda[_0xad2c('0x12')];return sqlUtils[_0xad2c('0x13')](_0x4ae2ca,_0x49fc5a);})[_0xad2c('0x4')](function(_0xeb1927){_0x44be67[_0xad2c('0x14')]=_0xeb1927[_0xad2c('0x15')];if(_0x44be67['count']===0x0){return[];}_0x4ae2ca[_0xad2c('0xd')](_0x4a7f20[_0xad2c('0x16')]);if(_0x2d4252[_0xad2c('0x17')]){_0x2d4252['order'][_0xad2c('0x18')](function(_0x1349b0){var _0x6ab6e4=_0x1349b0[0x0]===_0xad2c('0x19')?_0x1349b0[0x0]:'i.'+_0x1349b0[0x0];_0x4ae2ca['order'](_0x6ab6e4,_0x1349b0[0x1]==='DESC'?![]:!![]);if(_0x1349b0[0x0]===_0xad2c('0x1a')){var _0x58232d=sqlUtils[_0xad2c('0x1b')](_0xb5b9d2,_0x1cebda);_0x4ae2ca[_0xad2c('0x17')](_0x58232d,_0x1349b0[0x1]===_0xad2c('0x1c')?![]:!![]);}});}return sqlUtils[_0xad2c('0x1d')](_0xb5b9d2,_0x4ae2ca,_0x1cebda,_0x2d4252);})[_0xad2c('0x4')](function(_0x11e6d9){_0x44be67[_0xad2c('0x1e')]=_0x11e6d9;return _0x44be67;})[_0xad2c('0x1f')](function(_0x5674a3){throw _0x5674a3;});};exports[_0xad2c('0x20')]=function(_0x3e825c,_0x59e617){return function(_0x170fda,_0xc475a1,_0x491837){var _0x2cce84=_0x170fda[_0xad2c('0x21')];var _0x2c73d3={};var _0x587287=_0x170fda[_0xad2c('0x22')];if(_0x2c73d3){_0x2c73d3=_[_0xad2c('0x23')](_0x170fda[_0xad2c('0x7')]);_0x2c73d3=_[_0xad2c('0x24')](_0x2c73d3,[_0xad2c('0x7'),_0xad2c('0x25'),_0xad2c('0x26'),'fax',_0xad2c('0x27')]);}utils['updateUser'](_0x2cce84,_0x2c73d3,_0x587287,_0x3e825c,_0x59e617);_0x491837(null);};}; \ No newline at end of file +var _0x6b3f=['resolve','getInteractionsQuery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','getClosedOrderClause','getFilteredInteractions','rows','tracked','query','body','omit','html','phone','fax','updateUser','lodash','./utils','findAll','skipInteractionsQuery'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x6b3f,0x1b4));var _0xf6b3=function(_0x1c92da,_0x1f813c){_0x1c92da=_0x1c92da-0x0;var _0x3e0fa3=_0x6b3f[_0x1c92da];return _0x3e0fa3;};'use strict';var _=require(_0xf6b3('0x0'));var sqlUtils=require('./sql-utils');var utils=require(_0xf6b3('0x1'));exports[_0xf6b3('0x2')]=function(_0x118211,_0x141f93,_0x23ae22,_0x50d74d,_0x132115){var _0x504670={'count':0x0,'rows':[]};var _0x558395=sqlUtils[_0xf6b3('0x3')](_0x118211,_0x23ae22,_0x141f93);if(_0x558395){return Promise[_0xf6b3('0x4')](_0x504670);}var _0x4947df=sqlUtils[_0xf6b3('0x5')](_0x118211);var _0x4553be={};return Promise['resolve']()[_0xf6b3('0x6')](function(){if(_0x141f93['search']){return sqlUtils[_0xf6b3('0x7')](_0x141f93[_0xf6b3('0x8')],_0x132115);}else{return sqlUtils[_0xf6b3('0x9')](_0x118211,_0x141f93,_0x132115);}})[_0xf6b3('0x6')](function(_0xc1b597){_0x4947df[_0xf6b3('0xa')](_0xc1b597['body']);_0x4947df[_0xf6b3('0xa')](_0xc1b597['contact']);_0x4947df[_0xf6b3('0xa')](_0xc1b597[_0xf6b3('0xb')]);_0x4947df[_0xf6b3('0xa')](_0xc1b597['fields']);_0x4947df[_0xf6b3('0xa')](_0xc1b597['filter']);_0x4947df[_0xf6b3('0xa')](_0xc1b597[_0xf6b3('0xc')]);_0x4947df[_0xf6b3('0xd')](_0xc1b597[_0xf6b3('0xe')]);_0x4553be=_0xc1b597[_0xf6b3('0xf')];return sqlUtils[_0xf6b3('0x10')](_0x118211,_0x23ae22,_0x141f93);})['then'](function(_0x16647d){_0x4947df[_0xf6b3('0xa')](_0x16647d);_0x4947df[_0xf6b3('0x11')](_0xf6b3('0x12'));var _0x4a984c=_0x141f93['search']?_0x4553be[_0xf6b3('0x13')]:_0x141f93[_0xf6b3('0x14')];return sqlUtils[_0xf6b3('0x15')](_0x4947df,_0x4a984c);})[_0xf6b3('0x6')](function(_0x4272d7){_0x504670[_0xf6b3('0x16')]=_0x4272d7[_0xf6b3('0x17')];if(_0x504670['count']===0x0){return[];}_0x4947df[_0xf6b3('0xd')](_0x4553be[_0xf6b3('0x18')]);if(_0x50d74d[_0xf6b3('0x19')]){_0x50d74d[_0xf6b3('0x19')][_0xf6b3('0x1a')](function(_0x2ee96c){var _0x3732c4=_0x2ee96c[0x0]===_0xf6b3('0x1b')?_0x2ee96c[0x0]:'i.'+_0x2ee96c[0x0];_0x4947df[_0xf6b3('0x19')](_0x3732c4,_0x2ee96c[0x1]===_0xf6b3('0x1c')?![]:!![]);if(_0x2ee96c[0x0]==='closed'){var _0x367b58=sqlUtils[_0xf6b3('0x1d')](_0x118211,_0x141f93);_0x4947df[_0xf6b3('0x19')](_0x367b58,_0x2ee96c[0x1]===_0xf6b3('0x1c')?![]:!![]);}});}return sqlUtils[_0xf6b3('0x1e')](_0x118211,_0x4947df,_0x141f93,_0x50d74d);})[_0xf6b3('0x6')](function(_0x56c10f){_0x504670[_0xf6b3('0x1f')]=_0x56c10f;return _0x504670;})['catch'](function(_0x37bb91){throw _0x37bb91;});};exports[_0xf6b3('0x20')]=function(_0x2ff8e4,_0x4df2ee){return function(_0x5edbb9,_0x51757f,_0x3b5fc0){var _0x75a4b1=_0x5edbb9[_0xf6b3('0xc')];var _0x237aad={};var _0x2e6910=_0x5edbb9[_0xf6b3('0x21')];if(_0x237aad){_0x237aad=_['clone'](_0x5edbb9[_0xf6b3('0x22')]);_0x237aad=_[_0xf6b3('0x23')](_0x237aad,[_0xf6b3('0x22'),_0xf6b3('0x24'),_0xf6b3('0x25'),_0xf6b3('0x26'),'mobile']);}utils[_0xf6b3('0x27')](_0x75a4b1,_0x237aad,_0x2e6910,_0x2ff8e4,_0x4df2ee);_0x3b5fc0(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index aa54635..483ff91 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 _0xedfc=['merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','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','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','getAccountFK','agent','select','field','name','color','getInteractionFK','user_has_','u.id','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','fax','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','start','value','end','unreadMessages','read','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','split','clause','and','tags','ids','User','user','UserId','plainBody','body','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Accounts','role','\x20IS\x20NULL','\x20IN\x20?','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Sequelize','QueryTypes','sequelize','query','toString','keyBy'];(function(_0x1d042d,_0x2456a7){var _0x541006=function(_0xb681fe){while(--_0xb681fe){_0x1d042d['push'](_0x1d042d['shift']());}};_0x541006(++_0x2456a7);}(_0xedfc,0xcc));var _0xcedf=function(_0x102b55,_0xe63340){_0x102b55=_0x102b55-0x0;var _0x1423d1=_0xedfc[_0x102b55];return _0x1423d1;};'use strict';var _=require(_0xcedf('0x0'));var squel=require(_0xcedf('0x1'));var as=require(_0xcedf('0x2'));var qs=require(_0xcedf('0x3'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x58d4b6,_0x2bc47c,_0x20ef38){var _0x441e4e=![];var _0x170608=utils[_0xcedf('0x4')](_0x58d4b6);if(_0x2bc47c['role']===_0xcedf('0x5')&&!_0x20ef38['search']&&!_0x20ef38[_0x170608]){_0x441e4e=!![];}return _0x441e4e;}function getTagsQuery(){return squel[_0xcedf('0x6')]()[_0xcedf('0x7')]('id')['field'](_0xcedf('0x8'))[_0xcedf('0x7')](_0xcedf('0x9'))['from']('tools_tags');}function getUsersQuery(_0x362f98,_0x2b8978){var _0x164021=utils[_0xcedf('0xa')](_0x362f98);var _0x32d6cf=_0xcedf('0xb')+_0x362f98+'_interactions';var _0x2547c2=squel['select']()['field'](_0xcedf('0xc'))['field'](_0xcedf('0xd'))['field']('ui.'+_0x164021)[_0xcedf('0xe')](_0x32d6cf,'ui')[_0xcedf('0xf')](_0xcedf('0x10'),'u',_0xcedf('0x11'));if(_0x2b8978[_0xcedf('0x12')]>0x0){_0x2547c2[_0xcedf('0x13')]('ui.'+_0x164021+'\x20IN\x20?',_[_0xcedf('0x14')](_0x2b8978,'id'));}return _0x2547c2;}function getInteractionsQuery(_0x947fbb){var _0x441d17=utils[_0xcedf('0x15')](_0x947fbb);var _0x12261a=utils[_0xcedf('0x4')](_0x947fbb);var _0x41ee37=utils['getInteractionFK'](_0x947fbb);return squel[_0xcedf('0x6')]()[_0xcedf('0xe')](_0x441d17[_0xcedf('0x16')],'i')[_0xcedf('0xf')](_0xcedf('0x17'),'c',_0xcedf('0x18'))['left_join'](_0xcedf('0x10'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x441d17['accounts'],'a',_0xcedf('0x19')+_0x12261a)[_0xcedf('0xf')](_0x441d17[_0xcedf('0x1a')],'me',_0xcedf('0x1b')+_0x41ee37+_0xcedf('0x1c'))[_0xcedf('0xf')](_0x441d17[_0xcedf('0x1d')],'it',_0xcedf('0x1e')+_0x41ee37+_0xcedf('0x1c'))[_0xcedf('0xf')]('tools_tags','t',_0xcedf('0x1f'));}function getSqlClauses(){var _0x19998a={'body':squel[_0xcedf('0x20')](),'contact':squel[_0xcedf('0x20')](),'default':squel[_0xcedf('0x20')](),'fields':squel[_0xcedf('0x20')](),'filter':squel['expr'](),'read':squel[_0xcedf('0x20')](),'tags':{'clause':squel[_0xcedf('0x20')](),'ids':null},'user':squel['expr']()};return _0x19998a;}function parseTagParameter(_0x3451e8){var _0x2172c7=squel['expr']();if(_0x3451e8){var _0x9757e8=utils[_0xcedf('0x21')](_0x3451e8);_0x9757e8[_0xcedf('0x22')](function(_0xe3bb9){_0x2172c7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe3bb9+',%');});}return _0x2172c7;}function parseReadParameter(_0x3efe84){var _0x79a809='';if(_0x3efe84){_0x79a809='unreadMessages\x20{OPERATOR}\x200';if(_0x3efe84==='1'){_0x79a809=_0x79a809[_0xcedf('0x23')](_0xcedf('0x24'),'=');}else{_0x79a809=_0x79a809[_0xcedf('0x23')]('{OPERATOR}','>');}}return _0x79a809;}function parseSearchFilter(_0xcc93d0,_0xf31377){var _0x3c832b=squel[_0xcedf('0x20')]();if(_0xf31377){var _0x4ccb3a=_0xf31377['replace']('\x5c','\x5c\x5c')[_0xcedf('0x23')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4ccb3a)){_0x3c832b['or'](_0xcedf('0x25'),_0x4ccb3a+'%');if([_0xcedf('0x26'),_0xcedf('0x27')][_0xcedf('0x28')](_0xcc93d0)){_0x3c832b['or'](_0xcedf('0x29'),_0x4ccb3a+'%');}else if(_0xcc93d0==='fax'){_0x3c832b['or'](_0xcedf('0x2a'),_0x4ccb3a+'%');}else if(_0xcc93d0==='openchannel'){_0x3c832b['or'](_0xcedf('0x2b'),_0x4ccb3a+'%');}}else if(_0xcc93d0===_0xcedf('0x2c')&&qs[_0xcedf('0x2d')](_0x4ccb3a)){_0x3c832b['or'](_0xcedf('0x2e'),_0x4ccb3a+'%');}else{if(_0xcc93d0===_0xcedf('0x2c')){_0x3c832b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4ccb3a,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcedf('0x2f')](_0x4ccb3a));}else if(_0xcc93d0!==_0xcedf('0x30')){_0x3c832b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4ccb3a));}_0x3c832b['or'](_0xcedf('0x31'),qs['getFullTextValue'](_0x4ccb3a,!![]),null);}}return _0x3c832b;}function parseAdvancedSearchFilter(_0x15bcaf,_0x2766e0){var _0x2ef05b=getSqlClauses();var _0x2e1a89=as[_0xcedf('0x32')](_0x15bcaf);var _0x3071cd=_0x2e1a89[_0xcedf('0x33')];for(var _0x2d08d7=0x0;_0x2d08d7<_0x2e1a89[_0xcedf('0x34')][_0xcedf('0x12')];_0x2d08d7++){var _0x5bbfb9=_0x2e1a89[_0xcedf('0x34')][_0x2d08d7];var _0x26b274='i';var _0x212aec=_[_0xcedf('0x35')](_0x2766e0,[_0xcedf('0x8'),_0x5bbfb9[_0xcedf('0x7')]]);if(_0x212aec){var _0x28c403=as[_0xcedf('0x36')](_0x26b274,_0x212aec[_0xcedf('0x37')],_0x5bbfb9);_0x2ef05b[_0xcedf('0x38')][_0x3071cd](_0x28c403[_0xcedf('0x39')],_0x28c403['value'][_0xcedf('0x3a')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3c')]);}else{switch(_0x5bbfb9['field']){case _0xcedf('0x3d'):var _0x5d90ea=parseReadParameter(_0x5bbfb9[_0xcedf('0x3b')]);_0x2ef05b[_0xcedf('0x3e')]['and'](_0x5d90ea);break;case _0xcedf('0x3f'):if(_0x5bbfb9[_0xcedf('0x40')]===_0xcedf('0x41')){if(_0x5bbfb9[_0xcedf('0x3b')]['split']('\x20')[_0xcedf('0x12')]>0x1){_0x2ef05b[_0xcedf('0x42')][_0x3071cd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcedf('0x2f')](_0x5bbfb9['value'],!![]),null);}else{var _0x320b29='%'+_0x5bbfb9[_0xcedf('0x3b')]+'%';_0x2ef05b['contact'][_0x3071cd](_0xcedf('0x43'),_0x320b29,_0x320b29,_0x320b29);}}else{_0x212aec=_[_0xcedf('0x35')](_0x2766e0,[_0xcedf('0x8'),_0xcedf('0x44')]);_0x5bbfb9[_0xcedf('0x7')]=_0xcedf('0x44');_0x28c403=as[_0xcedf('0x36')](_0x26b274,_0x212aec[_0xcedf('0x37')],_0x5bbfb9);_0x2ef05b[_0xcedf('0x42')][_0x3071cd](_0x28c403[_0xcedf('0x39')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3a')],_0x28c403[_0xcedf('0x3b')]['end']);}break;case'Tag':var _0x2aa897=_0x5bbfb9['value'][_0xcedf('0x45')](',')[_0xcedf('0x14')](function(_0x4b1b52){return Number(_0x4b1b52);});var _0x11a68a=parseTagParameter(_0x2aa897);_0x2ef05b['tags'][_0xcedf('0x46')][_0xcedf('0x47')](_0x11a68a);_0x2ef05b[_0xcedf('0x48')][_0xcedf('0x49')]=_0x2aa897;break;case _0xcedf('0x4a'):if(_0x5bbfb9[_0xcedf('0x40')]===_0xcedf('0x41')){_0x2ef05b[_0xcedf('0x4b')][_0x3071cd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5bbfb9[_0xcedf('0x3b')]+'%',null);}else{_0x212aec=_['find'](_0x2766e0,[_0xcedf('0x8'),_0xcedf('0x4c')]);_0x5bbfb9[_0xcedf('0x7')]=_0xcedf('0x4c');_0x28c403=as[_0xcedf('0x36')](_0x26b274,_0x212aec['type'],_0x5bbfb9);_0x2ef05b[_0xcedf('0x4b')][_0x3071cd](_0x28c403[_0xcedf('0x39')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3a')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3c')]);}break;case'body':case _0xcedf('0x4d'):_0x28c403=as['buildExpression']('me',null,_0x5bbfb9);_0x2ef05b[_0xcedf('0x4e')][_0x3071cd](_0x28c403[_0xcedf('0x39')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3a')],_0x28c403[_0xcedf('0x3b')][_0xcedf('0x3c')]);break;}}}return _0x2ef05b;}function parseModelFields(_0x407eb6,_0x56c5d1,_0x219416){var _0x47597f=utils[_0xcedf('0x4')](_0x407eb6);var _0x10d298=squel[_0xcedf('0x20')]();var _0x5e3fc0=_(_0x56c5d1)[_0xcedf('0x4f')]()[_0xcedf('0x14')](function(_0x308b38){return _['some'](_0x219416,[_0xcedf('0x8'),_0x308b38])?_0x308b38:undefined;})[_0xcedf('0x50')]()[_0xcedf('0x3b')]();if(_0x5e3fc0[_0xcedf('0x12')]>0x0){_0x5e3fc0['forEach'](function(_0x2423ca){if(_0x2423ca===_0x47597f){_0x10d298['and']('i.'+_0x47597f+'\x20IN\x20?',[][_0xcedf('0x51')](_0x56c5d1[_0x2423ca]));}else if(_0x2423ca===_0xcedf('0x52')){var _0xea01c8=JSON[_0xcedf('0x53')](_0x56c5d1[_0x2423ca])[_0xcedf('0x54')];var _0x4fb5ff=JSON[_0xcedf('0x53')](_0x56c5d1[_0x2423ca])[_0xcedf('0x55')];_0x10d298[_0xcedf('0x47')](_0xcedf('0x56'),_0xea01c8,_0x4fb5ff);}else{if(_0x56c5d1[_0x2423ca]===_0xcedf('0x57')){_0x10d298[_0xcedf('0x47')]('i.'+_0x2423ca+'\x20IS\x20NULL');}else{_0x10d298[_0xcedf('0x47')]('i.'+_0x2423ca+_0xcedf('0x58'),_0x56c5d1[_0x2423ca]);}}});}return _0x10d298;}function parseQueryParameters(_0x1f121e,_0x474ba6,_0x34816a){var _0x37cb51=getSqlClauses();return Promise[_0xcedf('0x59')]()[_0xcedf('0x5a')](function(){return parseModelFields(_0x1f121e,_0x474ba6,_0x34816a);})[_0xcedf('0x5a')](function(_0x5b809b){_0x37cb51[_0xcedf('0x5b')][_0xcedf('0x47')](_0x5b809b);return parseReadParameter(_0x474ba6[_0xcedf('0x3e')]);})[_0xcedf('0x5a')](function(_0x2a232c){_0x37cb51[_0xcedf('0x3e')][_0xcedf('0x47')](_0x2a232c);return parseTagParameter(_0x474ba6[_0xcedf('0x5c')]);})[_0xcedf('0x5a')](function(_0x238f60){_0x37cb51[_0xcedf('0x48')][_0xcedf('0x46')][_0xcedf('0x47')](_0x238f60);return parseSearchFilter(_0x1f121e,_0x474ba6[_0xcedf('0x5d')]);})[_0xcedf('0x5a')](function(_0x26f601){_0x37cb51[_0xcedf('0x5d')]=_0x26f601;return _0x37cb51;});}function checkAccountsRestrictions(_0x48b9d4,_0x4c0f64,_0xe5c3dc){var _0x1398d7=utils[_0xcedf('0x4')](_0x48b9d4);var _0x4aeca9=_0xcedf('0x5e')+_[_0xcedf('0x5f')](_0x48b9d4)+(_0x48b9d4===_0xcedf('0x60')?'Websites':_0xcedf('0x61'));var _0x227487=squel[_0xcedf('0x20')]();return Promise[_0xcedf('0x59')]()[_0xcedf('0x5a')](function(){if(_0xe5c3dc['search']&&_0x4c0f64[_0xcedf('0x62')]==='agent'){return _0x4c0f64[_0x4aeca9]({'attributes':['id'],'raw':!![]});}})[_0xcedf('0x5a')](function(_0x146ead){if(_0x146ead){if(_0x146ead['length']===0x0){_0x227487[_0xcedf('0x47')]('i.'+_0x1398d7+_0xcedf('0x63'));}else{_0x227487[_0xcedf('0x47')]('i.'+_0x1398d7+_0xcedf('0x64'),_[_0xcedf('0x14')](_0x146ead,'id'));}}else if(!_0xe5c3dc[_0x1398d7]){_0x227487[_0xcedf('0x47')]('i.'+_0x1398d7+_0xcedf('0x65'));}})[_0xcedf('0x5a')](function(){return _0x227487;});}function getClosedOrderClause(_0x1ae5d4,_0x37f163){var _0x2a1af3='';var _0x437b62=[_0xcedf('0x66'),_0xcedf('0x67'),_0xcedf('0x68')];if(_0x1ae5d4===_0xcedf('0x2c')){_0x437b62[_0xcedf('0x69')](_0xcedf('0x6a'));}if(_0x37f163[_0xcedf('0x6b')]==='0'&&_0x1ae5d4==='mail'){_0x2a1af3=_0xcedf('0x6a');}else{if(_0x37f163['closed']==='1'){_0x437b62[_0xcedf('0x6c')]();}_0x2a1af3='CONCAT_WS(\x27\x27,\x20'+_0x437b62[_0xcedf('0x6d')](',\x20')+')';}return _0x2a1af3;}function getFilteredInteractions(_0x5bfa74,_0x13c99d,_0x5c9020,_0x22717d){var _0x3530d0=utils[_0xcedf('0xa')](_0x5bfa74);var _0x5223b0=_['capitalize'](_0x5bfa74)+'Interaction';var _0x588b92=[];var _0xdd2f9=getTagsQuery();var _0x320c97={'type':db[_0xcedf('0x6e')][_0xcedf('0x6f')]['SELECT'],'raw':!![]};var _0x5332c3=[];var _0xe98bc7=[];return db[_0xcedf('0x70')][_0xcedf('0x71')](_0xdd2f9[_0xcedf('0x72')](),_0x320c97)[_0xcedf('0x5a')](function(_0x9c9e54){_0x588b92=_[_0xcedf('0x73')](_0x9c9e54,'id');_0x320c97=_[_0xcedf('0x74')](_0x320c97,{'model':db[_0x5223b0],'mapToModel':!![],'nest':!![]});if(_0x5c9020['fields']){_0x22717d[_0xcedf('0x75')][_0xcedf('0x22')](function(_0x6e125e){_0x13c99d['field']('i.'+_0x6e125e);});}else{_0x13c99d['field'](_0xcedf('0x76'),_0xcedf('0x3d'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x77'),_0xcedf('0x78'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x79'),'Account.mandatoryDisposition');if(_0x5bfa74==='mail'){_0x13c99d[_0xcedf('0x7')]('a.email',_0xcedf('0x7a'));_0x13c99d['field'](_0xcedf('0x7b'),_0xcedf('0x7c'));_0x13c99d['field'](_0xcedf('0x7d'));_0x13c99d[_0xcedf('0x7')]('i.createdAt');_0x13c99d[_0xcedf('0x7')](_0xcedf('0x7e'));_0x13c99d['field'](_0xcedf('0x7f'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x80'));_0x13c99d[_0xcedf('0x7')]('i.attach');_0x13c99d[_0xcedf('0x7')](_0xcedf('0x81'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x82'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x83'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x68'));_0x13c99d[_0xcedf('0x7')]('i.secondDisposition');_0x13c99d[_0xcedf('0x7')](_0xcedf('0x66'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x6a'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x84'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x85'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x86'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x87'));}else if(_0x5bfa74===_0xcedf('0x88')){_0x13c99d[_0xcedf('0x7')](_0xcedf('0x89'),_0xcedf('0x7c'));}else{_0x13c99d[_0xcedf('0x7')](_0xcedf('0x8a'),_0xcedf('0x7c'));}if(_0x5bfa74!==_0xcedf('0x2c')){_0x13c99d[_0xcedf('0x7')]('i.*');}_0x13c99d[_0xcedf('0x7')]('c.firstName',_0xcedf('0x8b'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x8c'),_0xcedf('0x8d'));_0x13c99d['field']('c.email','Contact.email');_0x13c99d['field']('c.phone',_0xcedf('0x8e'));_0x13c99d['field'](_0xcedf('0x8f'),'Contact.mobile');_0x13c99d['field']('c.fax',_0xcedf('0x90'));_0x13c99d[_0xcedf('0x7')](_0xcedf('0x91'),_0xcedf('0x92'));_0x13c99d['field'](_0xcedf('0x93'),_0xcedf('0x94'));_0x13c99d[_0xcedf('0x7')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcedf('0x95'));}if(_0x22717d['limit']){_0x13c99d[_0xcedf('0x96')](_0x22717d[_0xcedf('0x96')]);}if(_0x22717d['offset']){_0x13c99d[_0xcedf('0x97')](_0x22717d[_0xcedf('0x97')]);}return db[_0xcedf('0x70')][_0xcedf('0x71')](_0x13c99d[_0xcedf('0x72')](),_0x320c97);})[_0xcedf('0x5a')](function(_0x14e63c){_0x5332c3=_0x14e63c;var _0x4eeac7=getUsersQuery(_0x5bfa74,_0x5332c3);return db['sequelize'][_0xcedf('0x71')](_0x4eeac7[_0xcedf('0x72')](),_0x320c97);})['then'](function(_0x4d38ab){_0xe98bc7=_[_0xcedf('0x98')](_0x4d38ab,_0x3530d0);if(_0x5bfa74===_0xcedf('0x2c')){return db[_0xcedf('0x99')]['findOne']({'attributes':[_0xcedf('0x9a')],'raw':!![]});}})[_0xcedf('0x5a')](function(_0x734b80){var _0x3f4409=_0x734b80?_0x734b80[_0xcedf('0x9a')]:undefined;var _0x4134f0=_0x5332c3[_0xcedf('0x14')](function(_0x49dd87){return updateInteraction(_0x49dd87,_0x588b92,_0xe98bc7,_0x3f4409);});return Promise[_0xcedf('0x9b')](_0x4134f0);});}function countFilteredInteractions(_0x3e35fb,_0x337a4f){var _0x4ef10e=_0x3e35fb[_0xcedf('0x9c')]();_0x4ef10e[_0xcedf('0x7')](_0xcedf('0x9d'));_0x4ef10e[_0xcedf('0x7')](_0xcedf('0x76'),_0xcedf('0x3d'));var _0x10b12f=utils[_0xcedf('0x21')](_0x337a4f);if(!_[_0xcedf('0x9e')](_0x10b12f)){_0x4ef10e['where']('t.id\x20IN\x20?',_0x10b12f);}var _0x43ceb3={'type':db['Sequelize'][_0xcedf('0x6f')]['SELECT'],'raw':!![]};return db[_0xcedf('0x70')][_0xcedf('0x71')](_0x4ef10e['toString'](),_0x43ceb3);}module[_0xcedf('0x9f')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x51e9=['type','default','text','value','start','end','unreadMessages','and','Contact','operator','contact','ContactId','split','tags','clause','ids','User','$substring','user','UserId','body','compact','forEach','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','filter','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','CONCAT_WS(\x27\x27,\x20','join','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.email','contactName','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.substatus','i.to','i.ContactId','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','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression'];(function(_0x1ac542,_0xd599d7){var _0x4a865b=function(_0x445b16){while(--_0x445b16){_0x1ac542['push'](_0x1ac542['shift']());}};_0x4a865b(++_0xd599d7);}(_0x51e9,0x101));var _0x951e=function(_0x33813f,_0x24aa83){_0x33813f=_0x33813f-0x0;var _0x33118e=_0x51e9[_0x33813f];return _0x33118e;};'use strict';var _=require(_0x951e('0x0'));var squel=require('squel');var as=require(_0x951e('0x1'));var qs=require(_0x951e('0x2'));var updateInteraction=require(_0x951e('0x3'))[_0x951e('0x4')];var utils=require(_0x951e('0x5'));var db=require(_0x951e('0x6'))['db'];function skipInteractionsQuery(_0x30962e,_0x392662,_0xf4146f){var _0x442a7b=![];var _0x4e8a16=utils[_0x951e('0x7')](_0x30962e);if(_0x392662['role']===_0x951e('0x8')&&!_0xf4146f['search']&&!_0xf4146f[_0x4e8a16]){_0x442a7b=!![];}return _0x442a7b;}function getTagsQuery(){return squel[_0x951e('0x9')]()['field']('id')[_0x951e('0xa')](_0x951e('0xb'))[_0x951e('0xa')](_0x951e('0xc'))[_0x951e('0xd')](_0x951e('0xe'));}function getUsersQuery(_0x22318f,_0x5effe5){var _0x5c380a=utils[_0x951e('0xf')](_0x22318f);var _0x3ef5e7='user_has_'+_0x22318f+_0x951e('0x10');var _0x17338c=squel[_0x951e('0x9')]()[_0x951e('0xa')](_0x951e('0x11'))[_0x951e('0xa')](_0x951e('0x12'))[_0x951e('0xa')]('ui.'+_0x5c380a)['from'](_0x3ef5e7,'ui')[_0x951e('0x13')](_0x951e('0x14'),'u',_0x951e('0x15'));if(_0x5effe5[_0x951e('0x16')]>0x0){_0x17338c[_0x951e('0x17')](_0x951e('0x18')+_0x5c380a+'\x20IN\x20?',_[_0x951e('0x19')](_0x5effe5,'id'));}return _0x17338c;}function getInteractionsQuery(_0xa2c65b){var _0x42f213=utils[_0x951e('0x1a')](_0xa2c65b);var _0x22e1f6=utils[_0x951e('0x7')](_0xa2c65b);var _0x4e51da=utils[_0x951e('0xf')](_0xa2c65b);return squel[_0x951e('0x9')]()['from'](_0x42f213[_0x951e('0x1b')],'i')[_0x951e('0x13')]('cm_contacts','c',_0x951e('0x1c'))[_0x951e('0x13')](_0x951e('0x14'),'o','o.id\x20=\x20i.UserId')[_0x951e('0x13')](_0x42f213['accounts'],'a','a.id\x20=\x20i.'+_0x22e1f6)[_0x951e('0x13')](_0x42f213['messages'],'me',_0x951e('0x1d')+_0x4e51da+_0x951e('0x1e'))[_0x951e('0x13')](_0x42f213[_0x951e('0x1f')],'it','it.'+_0x4e51da+_0x951e('0x1e'))[_0x951e('0x13')](_0x951e('0xe'),'t',_0x951e('0x20'));}function getSqlClauses(){var _0x143e63={'body':squel[_0x951e('0x21')](),'contact':squel['expr'](),'default':squel[_0x951e('0x21')](),'fields':squel[_0x951e('0x21')](),'filter':squel[_0x951e('0x21')](),'read':squel[_0x951e('0x21')](),'tags':{'clause':squel[_0x951e('0x21')](),'ids':null},'user':squel[_0x951e('0x21')]()};return _0x143e63;}function parseTagParameter(_0x33d554){var _0x10e223=squel[_0x951e('0x21')]();if(_0x33d554){var _0x1c7522=utils[_0x951e('0x22')](_0x33d554);_0x1c7522['forEach'](function(_0x2a8663){_0x10e223['or'](_0x951e('0x23'),'%,'+_0x2a8663+',%');});}return _0x10e223;}function parseReadParameter(_0x4c746c){var _0x5107e6='';if(_0x4c746c){_0x5107e6=_0x951e('0x24');if(_0x4c746c==='1'){_0x5107e6=_0x5107e6[_0x951e('0x25')]('{OPERATOR}','=');}else{_0x5107e6=_0x5107e6[_0x951e('0x25')](_0x951e('0x26'),'>');}}return _0x5107e6;}function parseSearchFilter(_0x1c23f3,_0x42cdb6){var _0x3ff757=squel[_0x951e('0x21')]();if(_0x42cdb6){var _0x2df996=_0x42cdb6[_0x951e('0x25')]('\x5c','\x5c\x5c')[_0x951e('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2df996)){_0x3ff757['or'](_0x951e('0x27'),_0x2df996+'%');if(['sms',_0x951e('0x28')][_0x951e('0x29')](_0x1c23f3)){_0x3ff757['or']('i.phone\x20LIKE\x20?',_0x2df996+'%');}else if(_0x1c23f3===_0x951e('0x2a')){_0x3ff757['or'](_0x951e('0x2b'),_0x2df996+'%');}else if(_0x1c23f3===_0x951e('0x2c')){_0x3ff757['or'](_0x951e('0x2d'),_0x2df996+'%');}}else if(_0x1c23f3==='mail'&&qs[_0x951e('0x2e')](_0x2df996)){_0x3ff757['or'](_0x951e('0x2f'),_0x2df996+'%');}else{if(_0x1c23f3===_0x951e('0x30')){_0x3ff757['or'](_0x951e('0x31'),qs['getFullTextValue'](_0x2df996,!![]))['or'](_0x951e('0x32'),qs[_0x951e('0x33')](_0x2df996));}else if(_0x1c23f3!==_0x951e('0x2a')){_0x3ff757['or'](_0x951e('0x34'),qs[_0x951e('0x33')](_0x2df996));}_0x3ff757['or'](_0x951e('0x35'),qs[_0x951e('0x33')](_0x2df996,!![]),null);}}return _0x3ff757;}function parseAdvancedSearchFilter(_0x184591,_0x133b50){var _0x111fea=getSqlClauses();var _0xd0a673=as[_0x951e('0x36')](_0x184591);var _0x4679fb=_0xd0a673[_0x951e('0x37')];for(var _0xee23fc=0x0;_0xee23fc<_0xd0a673[_0x951e('0x38')][_0x951e('0x16')];_0xee23fc++){var _0x414744=_0xd0a673['conditions'][_0xee23fc];var _0x47c9b5='i';var _0xc22eae=_[_0x951e('0x39')](_0x133b50,[_0x951e('0xb'),_0x414744[_0x951e('0xa')]]);if(_0xc22eae){var _0x4b01b3=as[_0x951e('0x3a')](_0x47c9b5,_0xc22eae[_0x951e('0x3b')],_0x414744);_0x111fea[_0x951e('0x3c')][_0x4679fb](_0x4b01b3[_0x951e('0x3d')],_0x4b01b3[_0x951e('0x3e')][_0x951e('0x3f')],_0x4b01b3['value'][_0x951e('0x40')]);}else{switch(_0x414744[_0x951e('0xa')]){case _0x951e('0x41'):var _0x4967d4=parseReadParameter(_0x414744['value']);_0x111fea['read'][_0x951e('0x42')](_0x4967d4);break;case _0x951e('0x43'):if(_0x414744[_0x951e('0x44')]==='$substring'){if(_0x414744[_0x951e('0x3e')]['split']('\x20')[_0x951e('0x16')]>0x1){_0x111fea[_0x951e('0x45')][_0x4679fb](_0x951e('0x35'),qs[_0x951e('0x33')](_0x414744[_0x951e('0x3e')],!![]),null);}else{var _0x24b185='%'+_0x414744[_0x951e('0x3e')]+'%';_0x111fea[_0x951e('0x45')][_0x4679fb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x24b185,_0x24b185,_0x24b185);}}else{_0xc22eae=_[_0x951e('0x39')](_0x133b50,[_0x951e('0xb'),_0x951e('0x46')]);_0x414744[_0x951e('0xa')]=_0x951e('0x46');_0x4b01b3=as[_0x951e('0x3a')](_0x47c9b5,_0xc22eae[_0x951e('0x3b')],_0x414744);_0x111fea['contact'][_0x4679fb](_0x4b01b3['text'],_0x4b01b3[_0x951e('0x3e')]['start'],_0x4b01b3['value'][_0x951e('0x40')]);}break;case'Tag':var _0x1357e9=_0x414744[_0x951e('0x3e')][_0x951e('0x47')](',')[_0x951e('0x19')](function(_0x5e7cb2){return Number(_0x5e7cb2);});var _0xce9ecd=parseTagParameter(_0x1357e9);_0x111fea[_0x951e('0x48')][_0x951e('0x49')][_0x951e('0x42')](_0xce9ecd);_0x111fea[_0x951e('0x48')][_0x951e('0x4a')]=_0x1357e9;break;case _0x951e('0x4b'):if(_0x414744[_0x951e('0x44')]===_0x951e('0x4c')){_0x111fea[_0x951e('0x4d')][_0x4679fb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x414744[_0x951e('0x3e')]+'%',null);}else{_0xc22eae=_[_0x951e('0x39')](_0x133b50,[_0x951e('0xb'),_0x951e('0x4e')]);_0x414744[_0x951e('0xa')]=_0x951e('0x4e');_0x4b01b3=as[_0x951e('0x3a')](_0x47c9b5,_0xc22eae[_0x951e('0x3b')],_0x414744);_0x111fea[_0x951e('0x4d')][_0x4679fb](_0x4b01b3[_0x951e('0x3d')],_0x4b01b3[_0x951e('0x3e')][_0x951e('0x3f')],_0x4b01b3['value']['end']);}break;case'body':case'plainBody':_0x4b01b3=as[_0x951e('0x3a')]('me',null,_0x414744);_0x111fea[_0x951e('0x4f')][_0x4679fb](_0x4b01b3['text'],_0x4b01b3['value']['start'],_0x4b01b3[_0x951e('0x3e')][_0x951e('0x40')]);break;}}}return _0x111fea;}function parseModelFields(_0x52495c,_0x16e6b0,_0x3469e0){var _0x3da0db=utils[_0x951e('0x7')](_0x52495c);var _0x11e86e=squel['expr']();var _0x139669=_(_0x16e6b0)['keys']()[_0x951e('0x19')](function(_0xafb5c6){return _['some'](_0x3469e0,['name',_0xafb5c6])?_0xafb5c6:undefined;})[_0x951e('0x50')]()[_0x951e('0x3e')]();if(_0x139669[_0x951e('0x16')]>0x0){_0x139669[_0x951e('0x51')](function(_0x3bece1){if(_0x3bece1===_0x3da0db){_0x11e86e[_0x951e('0x42')]('i.'+_0x3da0db+_0x951e('0x52'),[][_0x951e('0x53')](_0x16e6b0[_0x3bece1]));}else if(_0x3bece1===_0x951e('0x54')){var _0x591519=JSON[_0x951e('0x55')](_0x16e6b0[_0x3bece1])[_0x951e('0x56')];var _0x4edd01=JSON[_0x951e('0x55')](_0x16e6b0[_0x3bece1])[_0x951e('0x57')];_0x11e86e[_0x951e('0x42')](_0x951e('0x58'),_0x591519,_0x4edd01);}else{if(_0x16e6b0[_0x3bece1]===_0x951e('0x59')){_0x11e86e[_0x951e('0x42')]('i.'+_0x3bece1+_0x951e('0x5a'));}else{_0x11e86e[_0x951e('0x42')]('i.'+_0x3bece1+_0x951e('0x5b'),_0x16e6b0[_0x3bece1]);}}});}return _0x11e86e;}function parseQueryParameters(_0x19ec5b,_0x2e23c2,_0x49a3ae){var _0x31c102=getSqlClauses();return Promise[_0x951e('0x5c')]()[_0x951e('0x5d')](function(){return parseModelFields(_0x19ec5b,_0x2e23c2,_0x49a3ae);})[_0x951e('0x5d')](function(_0x4bbf31){_0x31c102[_0x951e('0x5e')][_0x951e('0x42')](_0x4bbf31);return parseReadParameter(_0x2e23c2[_0x951e('0x5f')]);})['then'](function(_0x18361d){_0x31c102['read'][_0x951e('0x42')](_0x18361d);return parseTagParameter(_0x2e23c2[_0x951e('0x60')]);})[_0x951e('0x5d')](function(_0x38ac89){_0x31c102['tags'][_0x951e('0x49')][_0x951e('0x42')](_0x38ac89);return parseSearchFilter(_0x19ec5b,_0x2e23c2[_0x951e('0x61')]);})[_0x951e('0x5d')](function(_0x3d0658){_0x31c102[_0x951e('0x61')]=_0x3d0658;return _0x31c102;});}function checkAccountsRestrictions(_0x130167,_0x9f1daf,_0x3e2523){var _0x41d590=utils['getAccountFK'](_0x130167);var _0x2bbf64='get'+_['capitalize'](_0x130167)+(_0x130167===_0x951e('0x62')?_0x951e('0x63'):_0x951e('0x64'));var _0x3b49ea=squel['expr']();return Promise['resolve']()[_0x951e('0x5d')](function(){if(_0x3e2523['search']&&_0x9f1daf[_0x951e('0x65')]===_0x951e('0x8')){return _0x9f1daf[_0x2bbf64]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4c08e4){if(_0x4c08e4){if(_0x4c08e4['length']===0x0){_0x3b49ea[_0x951e('0x42')]('i.'+_0x41d590+_0x951e('0x5a'));}else{_0x3b49ea[_0x951e('0x42')]('i.'+_0x41d590+'\x20IN\x20?',_['map'](_0x4c08e4,'id'));}}else if(!_0x3e2523[_0x41d590]){_0x3b49ea[_0x951e('0x42')]('i.'+_0x41d590+_0x951e('0x66'));}})['then'](function(){return _0x3b49ea;});}function getClosedOrderClause(_0x528beb,_0x4e1b35){var _0x5c41f0='';var _0x2b5ef3=[_0x951e('0x67'),_0x951e('0x68'),_0x951e('0x69')];if(_0x528beb===_0x951e('0x30')){_0x2b5ef3[_0x951e('0x6a')]('i.substatus');}if(_0x4e1b35[_0x951e('0x6b')]==='0'&&_0x528beb===_0x951e('0x30')){_0x5c41f0='i.substatus';}else{if(_0x4e1b35[_0x951e('0x6b')]==='1'){_0x2b5ef3['shift']();}_0x5c41f0=_0x951e('0x6c')+_0x2b5ef3[_0x951e('0x6d')](',\x20')+')';}return _0x5c41f0;}function getFilteredInteractions(_0x38c3e4,_0x3563f1,_0x570984,_0x3ac6d0){var _0xd3711c=utils['getInteractionFK'](_0x38c3e4);var _0x1c744c=_['capitalize'](_0x38c3e4)+'Interaction';var _0x4731b1=[];var _0x3f1d56=getTagsQuery();var _0x19de69={'type':db['Sequelize'][_0x951e('0x6e')][_0x951e('0x6f')],'raw':!![]};var _0x276d68=[];var _0x34535e=[];return db[_0x951e('0x70')][_0x951e('0x71')](_0x3f1d56[_0x951e('0x72')](),_0x19de69)[_0x951e('0x5d')](function(_0x3d850d){_0x4731b1=_[_0x951e('0x73')](_0x3d850d,'id');_0x19de69=_['merge'](_0x19de69,{'model':db[_0x1c744c],'mapToModel':!![],'nest':!![]});if(_0x570984['fields']){_0x3ac6d0[_0x951e('0x74')][_0x951e('0x51')](function(_0x3810d8){_0x3563f1[_0x951e('0xa')]('i.'+_0x3810d8);});}else{_0x3563f1[_0x951e('0xa')](_0x951e('0x75'),_0x951e('0x41'));_0x3563f1[_0x951e('0xa')]('a.key','Account.key');_0x3563f1[_0x951e('0xa')](_0x951e('0x76'),'Account.mandatoryDisposition');if(_0x38c3e4===_0x951e('0x30')){_0x3563f1[_0x951e('0xa')]('a.email',_0x951e('0x77'));_0x3563f1[_0x951e('0xa')]('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',_0x951e('0x78'));_0x3563f1[_0x951e('0xa')]('i.id');_0x3563f1[_0x951e('0xa')](_0x951e('0x79'));_0x3563f1[_0x951e('0xa')]('i.updatedAt');_0x3563f1[_0x951e('0xa')](_0x951e('0x7a'));_0x3563f1['field'](_0x951e('0x7b'));_0x3563f1['field'](_0x951e('0x7c'));_0x3563f1[_0x951e('0xa')](_0x951e('0x7d'));_0x3563f1['field']('i.lastMsgDirection');_0x3563f1['field'](_0x951e('0x7e'));_0x3563f1[_0x951e('0xa')](_0x951e('0x69'));_0x3563f1[_0x951e('0xa')](_0x951e('0x68'));_0x3563f1['field']('i.thirdDisposition');_0x3563f1[_0x951e('0xa')](_0x951e('0x7f'));_0x3563f1['field'](_0x951e('0x80'));_0x3563f1[_0x951e('0xa')](_0x951e('0x81'));_0x3563f1[_0x951e('0xa')](_0x951e('0x82'));_0x3563f1[_0x951e('0xa')]('i.UserId');}else if(_0x38c3e4===_0x951e('0x2c')){_0x3563f1[_0x951e('0xa')](_0x951e('0x83'),_0x951e('0x78'));}else{_0x3563f1[_0x951e('0xa')]('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');}if(_0x38c3e4!==_0x951e('0x30')){_0x3563f1['field'](_0x951e('0x84'));}_0x3563f1[_0x951e('0xa')](_0x951e('0x85'),_0x951e('0x86'));_0x3563f1[_0x951e('0xa')](_0x951e('0x87'),'Contact.lastName');_0x3563f1['field'](_0x951e('0x88'),'Contact.email');_0x3563f1[_0x951e('0xa')](_0x951e('0x89'),_0x951e('0x8a'));_0x3563f1['field'](_0x951e('0x8b'),_0x951e('0x8c'));_0x3563f1[_0x951e('0xa')]('c.fax',_0x951e('0x8d'));_0x3563f1[_0x951e('0xa')](_0x951e('0x8e'),_0x951e('0x8f'));_0x3563f1[_0x951e('0xa')]('o.internal',_0x951e('0x90'));_0x3563f1['field'](_0x951e('0x91'),_0x951e('0x92'));}if(_0x3ac6d0[_0x951e('0x93')]){_0x3563f1[_0x951e('0x93')](_0x3ac6d0[_0x951e('0x93')]);}if(_0x3ac6d0['offset']){_0x3563f1['offset'](_0x3ac6d0[_0x951e('0x94')]);}return db[_0x951e('0x70')][_0x951e('0x71')](_0x3563f1[_0x951e('0x72')](),_0x19de69);})['then'](function(_0x1cbf15){_0x276d68=_0x1cbf15;var _0x463f68=getUsersQuery(_0x38c3e4,_0x276d68);return db[_0x951e('0x70')]['query'](_0x463f68[_0x951e('0x72')](),_0x19de69);})[_0x951e('0x5d')](function(_0x3e9623){_0x34535e=_['groupBy'](_0x3e9623,_0xd3711c);if(_0x38c3e4==='mail'){return db[_0x951e('0x95')][_0x951e('0x96')]({'attributes':[_0x951e('0x97')],'raw':!![]});}})[_0x951e('0x5d')](function(_0x4cdb3d){var _0x30d29d=_0x4cdb3d?_0x4cdb3d[_0x951e('0x97')]:undefined;var _0x42f2ba=_0x276d68[_0x951e('0x19')](function(_0xcd603){return updateInteraction(_0xcd603,_0x4731b1,_0x34535e,_0x30d29d);});return Promise[_0x951e('0x98')](_0x42f2ba);});}function countFilteredInteractions(_0x3ba479,_0x4c5ad6){var _0xb709cc=_0x3ba479[_0x951e('0x99')]();_0xb709cc[_0x951e('0xa')]('COUNT(*)');_0xb709cc[_0x951e('0xa')](_0x951e('0x75'),_0x951e('0x41'));var _0x2482f4=utils[_0x951e('0x22')](_0x4c5ad6);if(!_[_0x951e('0x9a')](_0x2482f4)){_0xb709cc[_0x951e('0x17')](_0x951e('0x9b'),_0x2482f4);}var _0x474df7={'type':db[_0x951e('0x9c')][_0x951e('0x6e')]['SELECT'],'raw':!![]};return db[_0x951e('0x70')][_0x951e('0x71')](_0xb709cc['toString'](),_0x474df7);}module[_0x951e('0x9d')]={'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 8b0eb36..a8107b7 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 _0xdb74=['../../mysqldb','split','forEach','waiting','talking','answered','unmanaged','total','closed','abandoned','UserId','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart','Users','TagIds','catch','lodash'];(function(_0x370a0e,_0x3757c4){var _0x35d74a=function(_0xafcd50){while(--_0xafcd50){_0x370a0e['push'](_0x370a0e['shift']());}};_0x35d74a(++_0x3757c4);}(_0xdb74,0x6d));var _0x4db7=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xdb74[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x4db7('0x0'));var db=require(_0x4db7('0x1'))['db'];function getInteractionUsers(_0xeb2ef2,_0x35982c){return new Promise(function(_0x266b19,_0x3b2b8d){try{var _0x3d3a7d=[];if(_0x35982c[_0xeb2ef2]){_0x3d3a7d=_0x35982c[_0xeb2ef2]['map'](function(_0x589aac){return{'id':_0x589aac['id'],'fullname':_0x589aac['fullname']};});}return _0x266b19(_0x3d3a7d);}catch(_0x41a8be){_0x3b2b8d(_0x41a8be);}});}function getInteractionTags(_0x39e966,_0xab708e){var _0x348de3=[];if(_0x39e966){_0x39e966[_0x4db7('0x2')](',')[_0x4db7('0x3')](function(_0x2bc0e2){_0x348de3['push'](_0xab708e[_0x2bc0e2]);});}return _0x348de3;}function updateWaitingCounter(_0x3ac74d){if(_0x3ac74d[_0x4db7('0x4')]){_0x3ac74d[_0x4db7('0x4')]-=0x1;}}function updateInteractionCounters(_0x2bfba2){_0x2bfba2[_0x4db7('0x4')]=0x0;_0x2bfba2[_0x4db7('0x5')]=0x0;_0x2bfba2[_0x4db7('0x6')]=0x0;_0x2bfba2[_0x4db7('0x7')]=0x0;_0x2bfba2['abandoned']=0x0;_0x2bfba2[_0x4db7('0x8')]=0x0;if(_0x2bfba2[_0x4db7('0x9')]){if(_0x2bfba2['disposition']==='abandoned'){_0x2bfba2[_0x4db7('0xa')]+=0x1;updateWaitingCounter(_0x2bfba2);}if(_0x2bfba2['UserId']){_0x2bfba2['answered']+=0x1;if(_0x2bfba2[_0x4db7('0x5')]){_0x2bfba2['talking']-=0x1;}}else{if(_0x2bfba2['disposition']){_0x2bfba2[_0x4db7('0x7')]+=0x1;updateWaitingCounter(_0x2bfba2);}}}else{if(!_0x2bfba2[_0x4db7('0xb')]){_0x2bfba2['waiting']+=0x1;}if(_0x2bfba2['UserId']){_0x2bfba2[_0x4db7('0x5')]+=0x1;updateWaitingCounter(_0x2bfba2);}}_0x2bfba2[_0x4db7('0x8')]+=0x1;return _0x2bfba2;}function getLastMessageText(_0x2166c2){return db[_0x4db7('0xc')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2166c2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4db7('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4db7('0xe')],'order':_0x4db7('0xf'),'raw':!![]})[_0x4db7('0x10')](function(_0x25eaa0){if(_0x25eaa0&&_0x25eaa0[_0x4db7('0xe')]){_0x2166c2[_0x4db7('0x11')]=_[_0x4db7('0x12')](_0x25eaa0[_0x4db7('0xe')]);}return _0x2166c2;})['catch'](function(_0x11c06b){throw _0x11c06b;});}exports['updateInteraction']=function(_0x20f97b,_0x339b5e,_0x549572,_0x9c898f){return new Promise(function(_0x2aefbb,_0x29387c){return getInteractionUsers(_0x20f97b['id'],_0x549572)['then'](function(_0x321c4b){_0x20f97b[_0x4db7('0x13')]=_0x321c4b;return getInteractionTags(_0x20f97b[_0x4db7('0x14')],_0x339b5e);})[_0x4db7('0x10')](function(_0x1a7da8){_0x20f97b['Tags']=_0x1a7da8;delete _0x20f97b[_0x4db7('0x14')];return updateInteractionCounters(_0x20f97b);})[_0x4db7('0x10')](function(_0x434dac){if(_0x9c898f){return getLastMessageText(_0x434dac);}else{return _0x434dac;}})[_0x4db7('0x10')](function(_0x9f5460){_0x2aefbb(_0x9f5460);})[_0x4db7('0x15')](function(_0x599207){_0x29387c(_0x599207);});});}; \ No newline at end of file +var _0x25db=['abandoned','total','closed','disposition','unmanaged','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart','catch','Users','Tags','lodash','map','fullname','push','waiting','talking','answered'];(function(_0x2ad5bf,_0x43b235){var _0x4e9bfc=function(_0x25645d){while(--_0x25645d){_0x2ad5bf['push'](_0x2ad5bf['shift']());}};_0x4e9bfc(++_0x43b235);}(_0x25db,0x159));var _0xb25d=function(_0x36aade,_0x7ba745){_0x36aade=_0x36aade-0x0;var _0x2b6842=_0x25db[_0x36aade];return _0x2b6842;};'use strict';var _=require(_0xb25d('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x10c292,_0x4de63a){return new Promise(function(_0x5bb508,_0x21fd6c){try{var _0x254483=[];if(_0x4de63a[_0x10c292]){_0x254483=_0x4de63a[_0x10c292][_0xb25d('0x1')](function(_0x7ce32d){return{'id':_0x7ce32d['id'],'fullname':_0x7ce32d[_0xb25d('0x2')]};});}return _0x5bb508(_0x254483);}catch(_0x50879c){_0x21fd6c(_0x50879c);}});}function getInteractionTags(_0x120bee,_0x381078){var _0x5a3442=[];if(_0x120bee){_0x120bee['split'](',')['forEach'](function(_0x26c8f0){_0x5a3442[_0xb25d('0x3')](_0x381078[_0x26c8f0]);});}return _0x5a3442;}function updateWaitingCounter(_0x1b8237){if(_0x1b8237[_0xb25d('0x4')]){_0x1b8237['waiting']-=0x1;}}function updateInteractionCounters(_0x33fabd){_0x33fabd[_0xb25d('0x4')]=0x0;_0x33fabd[_0xb25d('0x5')]=0x0;_0x33fabd[_0xb25d('0x6')]=0x0;_0x33fabd['unmanaged']=0x0;_0x33fabd[_0xb25d('0x7')]=0x0;_0x33fabd[_0xb25d('0x8')]=0x0;if(_0x33fabd[_0xb25d('0x9')]){if(_0x33fabd[_0xb25d('0xa')]==='abandoned'){_0x33fabd[_0xb25d('0x7')]+=0x1;updateWaitingCounter(_0x33fabd);}if(_0x33fabd['UserId']){_0x33fabd[_0xb25d('0x6')]+=0x1;if(_0x33fabd['talking']){_0x33fabd['talking']-=0x1;}}else{if(_0x33fabd[_0xb25d('0xa')]){_0x33fabd[_0xb25d('0xb')]+=0x1;updateWaitingCounter(_0x33fabd);}}}else{if(!_0x33fabd['UserId']){_0x33fabd[_0xb25d('0x4')]+=0x1;}if(_0x33fabd['UserId']){_0x33fabd[_0xb25d('0x5')]+=0x1;updateWaitingCounter(_0x33fabd);}}_0x33fabd[_0xb25d('0x8')]+=0x1;return _0x33fabd;}function getLastMessageText(_0x5d3caf){return db[_0xb25d('0xc')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5d3caf['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb25d('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb25d('0xe')],'order':_0xb25d('0xf'),'raw':!![]})[_0xb25d('0x10')](function(_0xefc2fc){if(_0xefc2fc&&_0xefc2fc[_0xb25d('0xe')]){_0x5d3caf[_0xb25d('0x11')]=_[_0xb25d('0x12')](_0xefc2fc[_0xb25d('0xe')]);}return _0x5d3caf;})[_0xb25d('0x13')](function(_0x364e92){throw _0x364e92;});}exports['updateInteraction']=function(_0x5db1a3,_0x3b62f4,_0x71dbba,_0x2a0743){return new Promise(function(_0x330b89,_0x33e865){return getInteractionUsers(_0x5db1a3['id'],_0x71dbba)['then'](function(_0x977c66){_0x5db1a3[_0xb25d('0x14')]=_0x977c66;return getInteractionTags(_0x5db1a3['TagIds'],_0x3b62f4);})[_0xb25d('0x10')](function(_0x588e3d){_0x5db1a3[_0xb25d('0x15')]=_0x588e3d;delete _0x5db1a3['TagIds'];return updateInteractionCounters(_0x5db1a3);})[_0xb25d('0x10')](function(_0x3047e2){if(_0x2a0743){return getLastMessageText(_0x3047e2);}else{return _0x3047e2;}})[_0xb25d('0x10')](function(_0x5892d3){_0x330b89(_0x5892d3);})[_0xb25d('0x13')](function(_0x578e0f){_0x33e865(_0x578e0f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7f273c5..68a228f 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 _0x5af9=['toLowerCase','toUpperCase','name','role','null','Interaction','then','update','info','catch','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','chat','websites','_interactions','_messages'];(function(_0x255444,_0x214810){var _0x326ffd=function(_0x20f360){while(--_0x20f360){_0x255444['push'](_0x255444['shift']());}};_0x326ffd(++_0x214810);}(_0x5af9,0x1af));var _0x95af=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x5af9[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x95af('0x0'));var db=require(_0x95af('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x95af('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x95af('0x3'))(_0x95af('0x4')),'sms':require(_0x95af('0x3'))(_0x95af('0x5')),'chat':require('../../config/logger')(_0x95af('0x6')),'whatsapp':require(_0x95af('0x3'))(_0x95af('0x7'))};function getAccountFK(_0x433ddb){return _[_0x95af('0x8')](_0x433ddb)+(_0x433ddb==='chat'?_0x95af('0x9'):_0x95af('0xa'))+'Id';}function getInteractionFK(_0x337cca){return _[_0x95af('0x8')](_0x337cca)+_0x95af('0xb');}function getInteractionId(_0xbfbd2,_0x49b072,_0x36a387){if(_0xbfbd2&&_0xbfbd2[_['upperFirst'](_0x36a387)+_0x95af('0xb')]){return _0xbfbd2[_[_0x95af('0xc')](_0x36a387)+_0x95af('0xb')];}else if(_0xbfbd2&&_0xbfbd2['id']){return _0xbfbd2['id'];}else if(_0x49b072&&_0x49b072['id']){return _0x49b072['id'];}else{return'unknown';}}function getInteractionsTables(_0x41c27f){return{'accounts':_0x41c27f+'_'+(_0x41c27f===_0x95af('0xd')?_0x95af('0xe'):'accounts'),'interactions':_0x41c27f+_0x95af('0xf'),'interactionsTags':_0x41c27f+'_interaction_has_tags','messages':_0x41c27f+_0x95af('0x10'),'userInteractions':'user_has_'+_0x41c27f+_0x95af('0xf')};}function getSelectedTags(_0x32f70b){var _0x250d6b=[];if(_0x32f70b){_0x250d6b=Array['isArray'](_0x32f70b)?_0x32f70b:[_0x32f70b];}return _0x250d6b;}function log(_0xf32961,_0x1fefbf,_0x250bf6,_0x4ccfd7,_0x334221,_0x3d4b49){loggers[_0x334221[_0x95af('0x11')]()][_0xf32961]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d4b49[_0x95af('0x12')](),_0x1fefbf?_0x1fefbf['id']:null,_0x1fefbf?_0x1fefbf[_0x95af('0x13')]:null,_0x1fefbf?_0x1fefbf[_0x95af('0x14')]:null,getInteractionId(_0x250bf6,_0x4ccfd7,_0x334221),_0x250bf6?JSON['stringify'](_0x250bf6):_0x95af('0x15'));}function updateUser(_0x57e1a6,_0x5c1ebc,_0x5d1976,_0x46b816,_0x224f1e){db[_[_0x95af('0xc')](_0x46b816)+_0x95af('0x16')]['findOne']({'where':{'id':getInteractionId(_0x5c1ebc,_0x5d1976,_0x46b816)}})[_0x95af('0x17')](function(_0x2563cb){if(_0x2563cb){return _0x2563cb[_0x95af('0x18')]({'UserId':_0x57e1a6?_0x57e1a6['id']:null});}})['then'](function(_0x3faa5b){if(_0x3faa5b){log(_0x95af('0x19'),_0x57e1a6,_0x5c1ebc,_0x5d1976,_0x46b816,_0x224f1e);}})[_0x95af('0x1a')](function(){log('error',_0x57e1a6,_0x5c1ebc,_0x5d1976,_0x46b816,_0x224f1e);});}module[_0x95af('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xba16=['findOne','info','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','chat','websites','_interactions','_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction'];(function(_0x3de5b1,_0x4cbc4d){var _0x1a1e0c=function(_0x1de7ff){while(--_0x1de7ff){_0x3de5b1['push'](_0x3de5b1['shift']());}};_0x1a1e0c(++_0x4cbc4d);}(_0xba16,0x143));var _0x6ba1=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xba16[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0x6ba1('0x0'));var db=require(_0x6ba1('0x1'))['db'];var loggers={'openchannel':require(_0x6ba1('0x2'))(_0x6ba1('0x3')),'mail':require(_0x6ba1('0x2'))(_0x6ba1('0x4')),'fax':require(_0x6ba1('0x2'))('fax-interactions'),'sms':require(_0x6ba1('0x2'))('sms-interactions'),'chat':require(_0x6ba1('0x2'))(_0x6ba1('0x5')),'whatsapp':require(_0x6ba1('0x2'))(_0x6ba1('0x6'))};function getAccountFK(_0x1fdd5c){return _[_0x6ba1('0x7')](_0x1fdd5c)+(_0x1fdd5c==='chat'?_0x6ba1('0x8'):_0x6ba1('0x9'))+'Id';}function getInteractionFK(_0x481b83){return _[_0x6ba1('0x7')](_0x481b83)+_0x6ba1('0xa');}function getInteractionId(_0x4ebbe7,_0x13b95e,_0x592c25){if(_0x4ebbe7&&_0x4ebbe7[_[_0x6ba1('0xb')](_0x592c25)+_0x6ba1('0xa')]){return _0x4ebbe7[_[_0x6ba1('0xb')](_0x592c25)+_0x6ba1('0xa')];}else if(_0x4ebbe7&&_0x4ebbe7['id']){return _0x4ebbe7['id'];}else if(_0x13b95e&&_0x13b95e['id']){return _0x13b95e['id'];}else{return'unknown';}}function getInteractionsTables(_0x57a739){return{'accounts':_0x57a739+'_'+(_0x57a739===_0x6ba1('0xc')?_0x6ba1('0xd'):'accounts'),'interactions':_0x57a739+_0x6ba1('0xe'),'interactionsTags':_0x57a739+_0x6ba1('0xf'),'messages':_0x57a739+_0x6ba1('0x10'),'userInteractions':_0x6ba1('0x11')+_0x57a739+'_interactions'};}function getSelectedTags(_0xcad3a9){var _0x34d997=[];if(_0xcad3a9){_0x34d997=Array['isArray'](_0xcad3a9)?_0xcad3a9:[_0xcad3a9];}return _0x34d997;}function log(_0x463474,_0x3256ec,_0x464eed,_0x59ed25,_0x5269a5,_0x5a06ff){loggers[_0x5269a5['toLowerCase']()][_0x463474](_0x6ba1('0x12'),_0x5a06ff[_0x6ba1('0x13')](),_0x3256ec?_0x3256ec['id']:null,_0x3256ec?_0x3256ec[_0x6ba1('0x14')]:null,_0x3256ec?_0x3256ec[_0x6ba1('0x15')]:null,getInteractionId(_0x464eed,_0x59ed25,_0x5269a5),_0x464eed?JSON[_0x6ba1('0x16')](_0x464eed):_0x6ba1('0x17'));}function updateUser(_0x27deab,_0x5cb3f4,_0x236071,_0x469353,_0x5720e2){db[_[_0x6ba1('0xb')](_0x469353)+_0x6ba1('0x18')][_0x6ba1('0x19')]({'where':{'id':getInteractionId(_0x5cb3f4,_0x236071,_0x469353)}})['then'](function(_0x16da81){if(_0x16da81){return _0x16da81['update']({'UserId':_0x27deab?_0x27deab['id']:null});}})['then'](function(_0x18d2ee){if(_0x18d2ee){log(_0x6ba1('0x1a'),_0x27deab,_0x5cb3f4,_0x236071,_0x469353,_0x5720e2);}})[_0x6ba1('0x1b')](function(){log(_0x6ba1('0x1c'),_0x27deab,_0x5cb3f4,_0x236071,_0x469353,_0x5720e2);});}module['exports']={'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 2fcbcd7..b2b6680 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 _0x1631=['use','License','findOne','then','count','status','json','format','catch','users','User','admin','user','crypto','util','../../config/environment','data1','license','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x1631,0x19d));var _0x1163=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x1631[_0xaa1b3e];return _0x454d7d;};'use strict';var crypto=require(_0x1163('0x0'));var util=require(_0x1163('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x1163('0x2'));function getValueFromLicense(_0x1eceb7,_0x1a074c){if(_0x1eceb7&&_0x1a074c){if(_0x1a074c[_0x1163('0x3')]&&_0x1a074c[_0x1163('0x4')]){var _0xa47945=_0x1a074c[_0x1163('0x3')];var _0x29dbf8=_0x1a074c[_0x1163('0x4')];var _0x4febf6=_0xa47945['split']('-')[0x4];var _0x4777d7=_0xa47945['split']('-')[0x0];var _0xc522cc=crypto[_0x1163('0x5')](_0x1163('0x6'),util['format'](_0x1163('0x7'),_0x4febf6,_0xa47945,_0x4777d7));var _0x581077=_0xc522cc[_0x1163('0x8')](_0x29dbf8,_0x1163('0x9'),'utf8');_0x581077+=_0xc522cc['final'](_0x1163('0xa'));var _0x3eabf9=JSON[_0x1163('0xb')](_0x581077);return _0x3eabf9['hasOwnProperty'](_0x1eceb7)?_0x3eabf9[_0x1eceb7]:null;}}return null;}function isLimit(_0x2f71b8,_0x58ed3c,_0x67294,_0x41198e){var _0x547806=_0x58ed3c;return compose()[_0x1163('0xc')](function(_0x450b6e,_0x23a0ae,_0x13c8b1){return db[_0x1163('0xd')][_0x1163('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x1163('0xf')](function(_0x5d4426){var _0x36f6e9=getValueFromLicense(_0x2f71b8,_0x5d4426);return _0x36f6e9?_0x36f6e9:_0x547806;})[_0x1163('0xf')](function(_0xb7438){_0x547806=_0xb7438;return _0x67294[_0x1163('0x10')](_0x41198e);})[_0x1163('0xf')](function(_0x335c2b){if(_0x335c2b>=_0x547806){return _0x23a0ae[_0x1163('0x11')](0x193)[_0x1163('0x12')]({'message':util[_0x1163('0x13')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2f71b8)});}_0x13c8b1();})[_0x1163('0x14')](function(_0x162209){_0x13c8b1(_0x162209);});});}function isUserLimit(){return isLimit(_0x1163('0x15'),0x1,db[_0x1163('0x16')],{'where':{'$or':[{'role':_0x1163('0x17')},{'role':_0x1163('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x6f64=['license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1'];(function(_0x7c02fa,_0x2c737e){var _0x385fee=function(_0x74e32d){while(--_0x74e32d){_0x7c02fa['push'](_0x7c02fa['shift']());}};_0x385fee(++_0x2c737e);}(_0x6f64,0x19c));var _0x46f6=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x6f64[_0x5459b0];return _0x675a35;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x46f6('0x0'));var db=require(_0x46f6('0x1'))['db'];var config=require(_0x46f6('0x2'));function getValueFromLicense(_0x4cfd70,_0x8b7434){if(_0x4cfd70&&_0x8b7434){if(_0x8b7434[_0x46f6('0x3')]&&_0x8b7434[_0x46f6('0x4')]){var _0x5d9f02=_0x8b7434[_0x46f6('0x3')];var _0x4323e1=_0x8b7434[_0x46f6('0x4')];var _0x4b6d23=_0x5d9f02[_0x46f6('0x5')]('-')[0x4];var _0x145947=_0x5d9f02[_0x46f6('0x5')]('-')[0x0];var _0x12764b=crypto['createDecipher'](_0x46f6('0x6'),util[_0x46f6('0x7')](_0x46f6('0x8'),_0x4b6d23,_0x5d9f02,_0x145947));var _0x5ad38e=_0x12764b[_0x46f6('0x9')](_0x4323e1,_0x46f6('0xa'),_0x46f6('0xb'));_0x5ad38e+=_0x12764b[_0x46f6('0xc')](_0x46f6('0xb'));var _0x31c894=JSON[_0x46f6('0xd')](_0x5ad38e);return _0x31c894[_0x46f6('0xe')](_0x4cfd70)?_0x31c894[_0x4cfd70]:null;}}return null;}function isLimit(_0x2c0b90,_0x8e9dbd,_0x526115,_0x342bf5){var _0x197f51=_0x8e9dbd;return compose()['use'](function(_0x5d89fb,_0x2f27c8,_0x543f55){return db['License'][_0x46f6('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x46f6('0x10')](function(_0x4b4441){var _0x19402d=getValueFromLicense(_0x2c0b90,_0x4b4441);return _0x19402d?_0x19402d:_0x197f51;})[_0x46f6('0x10')](function(_0x102c4b){_0x197f51=_0x102c4b;return _0x526115[_0x46f6('0x11')](_0x342bf5);})[_0x46f6('0x10')](function(_0x4bef5e){if(_0x4bef5e>=_0x197f51){return _0x2f27c8[_0x46f6('0x12')](0x193)[_0x46f6('0x13')]({'message':util[_0x46f6('0x7')](_0x46f6('0x14'),_0x2c0b90)});}_0x543f55();})[_0x46f6('0x15')](function(_0x41819d){_0x543f55(_0x41819d);});});}function isUserLimit(){return isLimit(_0x46f6('0x16'),0x1,db[_0x46f6('0x17')],{'where':{'$or':[{'role':_0x46f6('0x18')},{'role':'user'}]}});}exports[_0x46f6('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 153d4f4..7bce12a 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 _0x8079=['$eq','$between','includes','$gt','$lte','value','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','match','filter','indexOf','map','conditions','push','DATE','operator'];(function(_0x4d3aff,_0x7c594e){var _0xb1fcd7=function(_0x500d9e){while(--_0x500d9e){_0x4d3aff['push'](_0x4d3aff['shift']());}};_0xb1fcd7(++_0x7c594e);}(_0x8079,0x9f));var _0x9807=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x8079[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0x9807('0x0'));var moment=require(_0x9807('0x1'));exports['parseSearch']=function(_0x1ae9f4){var _0x3b3155={'conditions':[]};_0x3b3155[_0x9807('0x2')]=_[_0x9807('0x3')](_0x1ae9f4,_0x9807('0x4'))?'or':_0x9807('0x5');var _0x58350a=_0x1ae9f4[_0x9807('0x6')]('[$and]','')['replace']('[$or]','')[_0x9807('0x7')]('||');for(var _0x39ac5b=0x0;_0x39ac5b<_0x58350a[_0x9807('0x8')];_0x39ac5b++){var _0xe1e6b3=_0x58350a[_0x39ac5b]['split'](':=');var _0x45668a=_0xe1e6b3[0x0];var _0x43d742=_0xe1e6b3['slice'](0x1);_0x43d742[_0x9807('0x9')](function(_0xbb0161){var _0xde2cba=_0xbb0161['split']('[')['shift']();var _0x13efb1=_0xbb0161[_0x9807('0xa')](/\[(.*?)\]/g);_0x13efb1[_0x9807('0x9')](function(_0x3b2be0){var _0x9282de=_0x3b2be0[_0x9807('0x7')]('[')[_0x9807('0xb')](function(_0x599671){return _0x599671[_0x9807('0xc')](']')>-0x1;})[_0x9807('0xd')](function(_0x51408b){return _0x51408b[_0x9807('0x7')](']')[0x0];})[0x0];_0x3b3155[_0x9807('0xe')][_0x9807('0xf')]({'field':_0x45668a,'operator':_0xde2cba,'value':_0x9282de});});});}return _0x3b3155;};exports['buildExpression']=function(_0x4f873e,_0x4529ca,_0x3955d0){var _0x519dc1={};if(_0x4529ca===_0x9807('0x10')){if(_0x3955d0[_0x9807('0x11')]===_0x9807('0x12')){_0x3955d0[_0x9807('0x11')]=_0x9807('0x13');_0x3955d0['value']+=','+_0x3955d0['value'];}else if(_[_0x9807('0x14')]([_0x9807('0x15'),_0x9807('0x16')],_0x3955d0[_0x9807('0x11')])){_0x3955d0[_0x9807('0x17')]=moment(_0x3955d0[_0x9807('0x17')])[_0x9807('0x18')](0x1,'days')[_0x9807('0x19')](_0x9807('0x1a'));}}if(_0x3955d0['castTo']){_0x4529ca=_0x3955d0[_0x9807('0x1b')];_0x519dc1[_0x9807('0x1c')]=_0x9807('0x1d')+_0x4f873e+'.'+_0x3955d0[_0x9807('0x1e')]+_0x9807('0x1f')+_0x3955d0[_0x9807('0x1b')]+')\x20'+parseOperator(_0x3955d0[_0x9807('0x11')]);}else{_0x519dc1[_0x9807('0x1c')]=_0x4f873e+'.'+_0x3955d0['field']+'\x20'+parseOperator(_0x3955d0['operator']);}if(_[_0x9807('0x14')](['$ne',_0x9807('0x20')],_0x3955d0[_0x9807('0x11')]))_0x519dc1[_0x9807('0x1c')]='('+_0x519dc1[_0x9807('0x1c')]+_0x9807('0x21')+_0x4f873e+'.'+_0x3955d0[_0x9807('0x1e')]+_0x9807('0x22');_0x519dc1[_0x9807('0x17')]=parseValue(_0x4529ca,_0x3955d0[_0x9807('0x11')],_0x3955d0['value']);return _0x519dc1;};function parseOperator(_0xbc3cab){var _0x1b2742;switch(_0xbc3cab){case'$in':_0x1b2742=_0x9807('0x23');break;case'$notIn':_0x1b2742=_0x9807('0x24');break;case _0x9807('0x12'):_0x1b2742=_0x9807('0x25');break;case _0x9807('0x26'):_0x1b2742=_0x9807('0x27');break;case _0x9807('0x28'):case _0x9807('0x29'):case _0x9807('0x2a'):_0x1b2742=_0x9807('0x2b');break;case _0x9807('0x2c'):_0x1b2742=_0x9807('0x2d');break;case _0x9807('0x15'):_0x1b2742=_0x9807('0x2e');break;case _0x9807('0x16'):_0x1b2742=_0x9807('0x2f');break;case _0x9807('0x30'):_0x1b2742=_0x9807('0x31');break;case _0x9807('0x13'):_0x1b2742=_0x9807('0x32');break;}return _0x1b2742;}function parseValue(_0x15c6b0,_0x7c1aa,_0x7f2f03){var _0x42f0fb={'start':undefined,'end':undefined};switch(_0x7c1aa){case _0x9807('0x33'):case _0x9807('0x20'):_0x42f0fb[_0x9807('0x34')]=_0x7f2f03[_0x9807('0x7')](',');break;case _0x9807('0x28'):_0x42f0fb['start']='%'+_0x7f2f03+'%';break;case _0x9807('0x29'):_0x42f0fb[_0x9807('0x34')]=_0x7f2f03+'%';break;case _0x9807('0x2a'):_0x42f0fb['start']='%'+_0x7f2f03;break;case _0x9807('0x13'):var _0x12220b=_0x7f2f03[_0x9807('0x7')](',');var _0x7f2f03=_0x12220b[_0x9807('0x35')]();var _0x313cab=_0x12220b[_0x9807('0x36')]();if(_0x15c6b0===_0x9807('0x10')){_0x7f2f03=moment(_0x7f2f03)[_0x9807('0x37')](0x0,!![])[_0x9807('0x19')]();_0x313cab=moment(_0x313cab)[_0x9807('0x37')](0x0,!![])['add'](0x17,_0x9807('0x38'))[_0x9807('0x18')](0x3b,_0x9807('0x39'))[_0x9807('0x18')](0x3b,_0x9807('0x3a'))['format']();}_0x42f0fb={'start':_0x7f2f03,'end':_0x313cab};break;default:_0x42f0fb[_0x9807('0x34')]=_0x7f2f03;break;}return _0x42f0fb;} \ No newline at end of file +var _0x0de8=['<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','format','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','slice','shift','match','forEach','filter','indexOf','map','conditions','push','$eq','operator','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?'];(function(_0x44612c,_0x13c820){var _0x4f5b9b=function(_0x59780c){while(--_0x59780c){_0x44612c['push'](_0x44612c['shift']());}};_0x4f5b9b(++_0x13c820);}(_0x0de8,0x7f));var _0x80de=function(_0x507357,_0x2c9a2f){_0x507357=_0x507357-0x0;var _0x164653=_0x0de8[_0x507357];return _0x164653;};'use strict';var _=require(_0x80de('0x0'));var moment=require(_0x80de('0x1'));exports[_0x80de('0x2')]=function(_0x46cc73){var _0xe5657b={'conditions':[]};_0xe5657b[_0x80de('0x3')]=_[_0x80de('0x4')](_0x46cc73,_0x80de('0x5'))?'or':_0x80de('0x6');var _0x476490=_0x46cc73[_0x80de('0x7')]('[$and]','')[_0x80de('0x7')](_0x80de('0x5'),'')[_0x80de('0x8')]('||');for(var _0x23d32b=0x0;_0x23d32b<_0x476490['length'];_0x23d32b++){var _0x444757=_0x476490[_0x23d32b][_0x80de('0x8')](':=');var _0x49130d=_0x444757[0x0];var _0x5eaf1c=_0x444757[_0x80de('0x9')](0x1);_0x5eaf1c['forEach'](function(_0x301f26){var _0xa0a6af=_0x301f26[_0x80de('0x8')]('[')[_0x80de('0xa')]();var _0x55631d=_0x301f26[_0x80de('0xb')](/\[(.*?)\]/g);_0x55631d[_0x80de('0xc')](function(_0x32c9e2){var _0x596e0f=_0x32c9e2[_0x80de('0x8')]('[')[_0x80de('0xd')](function(_0x41eab2){return _0x41eab2[_0x80de('0xe')](']')>-0x1;})[_0x80de('0xf')](function(_0xdfe744){return _0xdfe744[_0x80de('0x8')](']')[0x0];})[0x0];_0xe5657b[_0x80de('0x10')][_0x80de('0x11')]({'field':_0x49130d,'operator':_0xa0a6af,'value':_0x596e0f});});});}return _0xe5657b;};exports['buildExpression']=function(_0x217f5b,_0x83df91,_0x5153cb){var _0x181c19={};if(_0x83df91==='DATE'){if(_0x5153cb['operator']===_0x80de('0x12')){_0x5153cb[_0x80de('0x13')]=_0x80de('0x14');_0x5153cb[_0x80de('0x15')]+=','+_0x5153cb['value'];}else if(_[_0x80de('0x16')]([_0x80de('0x17'),_0x80de('0x18')],_0x5153cb[_0x80de('0x13')])){_0x5153cb[_0x80de('0x15')]=moment(_0x5153cb[_0x80de('0x15')])[_0x80de('0x19')](0x1,_0x80de('0x1a'))['format'](_0x80de('0x1b'));}}if(_0x5153cb['castTo']){_0x83df91=_0x5153cb[_0x80de('0x1c')];_0x181c19['text']=_0x80de('0x1d')+_0x217f5b+'.'+_0x5153cb[_0x80de('0x1e')]+_0x80de('0x1f')+_0x5153cb[_0x80de('0x1c')]+')\x20'+parseOperator(_0x5153cb[_0x80de('0x13')]);}else{_0x181c19[_0x80de('0x20')]=_0x217f5b+'.'+_0x5153cb[_0x80de('0x1e')]+'\x20'+parseOperator(_0x5153cb[_0x80de('0x13')]);}if(_[_0x80de('0x16')]([_0x80de('0x21'),_0x80de('0x22')],_0x5153cb['operator']))_0x181c19['text']='('+_0x181c19[_0x80de('0x20')]+_0x80de('0x23')+_0x217f5b+'.'+_0x5153cb[_0x80de('0x1e')]+_0x80de('0x24');_0x181c19[_0x80de('0x15')]=parseValue(_0x83df91,_0x5153cb[_0x80de('0x13')],_0x5153cb[_0x80de('0x15')]);return _0x181c19;};function parseOperator(_0x45ed00){var _0x2b053d;switch(_0x45ed00){case _0x80de('0x25'):_0x2b053d=_0x80de('0x26');break;case _0x80de('0x22'):_0x2b053d='NOT\x20IN\x20?';break;case'$eq':_0x2b053d=_0x80de('0x27');break;case'$ne':_0x2b053d=_0x80de('0x28');break;case _0x80de('0x29'):case _0x80de('0x2a'):case'$endsWith':_0x2b053d=_0x80de('0x2b');break;case _0x80de('0x2c'):_0x2b053d=_0x80de('0x2d');break;case'$gt':_0x2b053d=_0x80de('0x2e');break;case'$lte':_0x2b053d=_0x80de('0x2f');break;case _0x80de('0x30'):_0x2b053d=_0x80de('0x31');break;case _0x80de('0x14'):_0x2b053d=_0x80de('0x32');break;}return _0x2b053d;}function parseValue(_0x3c74ff,_0x1ad2e7,_0x4a4438){var _0x574eb9={'start':undefined,'end':undefined};switch(_0x1ad2e7){case _0x80de('0x25'):case'$notIn':_0x574eb9[_0x80de('0x33')]=_0x4a4438[_0x80de('0x8')](',');break;case _0x80de('0x29'):_0x574eb9['start']='%'+_0x4a4438+'%';break;case'$startsWith':_0x574eb9['start']=_0x4a4438+'%';break;case'$endsWith':_0x574eb9[_0x80de('0x33')]='%'+_0x4a4438;break;case _0x80de('0x14'):var _0x388c12=_0x4a4438['split'](',');var _0x4a4438=_0x388c12[_0x80de('0xa')]();var _0x57c416=_0x388c12[_0x80de('0x34')]();if(_0x3c74ff===_0x80de('0x35')){_0x4a4438=moment(_0x4a4438)['utcOffset'](0x0,!![])[_0x80de('0x36')]();_0x57c416=moment(_0x57c416)[_0x80de('0x37')](0x0,!![])[_0x80de('0x19')](0x17,_0x80de('0x38'))[_0x80de('0x19')](0x3b,_0x80de('0x39'))['add'](0x3b,'seconds')[_0x80de('0x36')]();}_0x574eb9={'start':_0x4a4438,'end':_0x57c416};break;default:_0x574eb9[_0x80de('0x33')]=_0x4a4438;break;}return _0x574eb9;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 85dbf10..aa9d76c 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 _0x07cf=['priority','cast','col','unsigned','DESC','length','omit','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','query','$id','name','attributes','intersection','hasOwnProperty','nolimit','offset','order','where','pick','filter','object','columns','value','merge','type','VIRTUAL','lower','options','include','lodash','sequelize','../../mysqldb','keys','includes','parse','model','alias','raw','fields','filters','isEmpty','forOwn','DATE','isPlainObject','YYYY-MM-DD','format','$lte','utc','subtract','isArray','split','limit','sort','map','indexOf'];(function(_0x525320,_0x1f764f){var _0x556073=function(_0x31b088){while(--_0x31b088){_0x525320['push'](_0x525320['shift']());}};_0x556073(++_0x1f764f);}(_0x07cf,0xea));var _0xf07c=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x07cf[_0x1d6a82];return _0x5834ac;};'use strict';var _=require(_0xf07c('0x0'));var sequelize=require(_0xf07c('0x1'));var moment=require('moment');var db=require(_0xf07c('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x406600){var _0x4536a2=['ne'];try{var _0x49539b=JSON['parse'](_0x406600);var _0x2802d7=Object[_0xf07c('0x3')](_0x49539b)[0x0];return _0x4536a2[_0xf07c('0x4')](_0x2802d7);}catch(_0x3fa800){return![];}}function getOperatorValue(_0x156ee8){var _0x5594fd=JSON['parse'](_0x156ee8);var _0x26b27d=Object[_0xf07c('0x3')](_0x5594fd)[0x0];var _0x52002b=_0x5594fd[_0x26b27d];return{['$'+_0x26b27d]:_0x52002b};}function parseIncludeModel(_0x363034){var _0x2666f4=JSON[_0xf07c('0x5')](_0x363034);return{'model':db[_0x2666f4[_0xf07c('0x6')]],'as':_0x2666f4[_0xf07c('0x7')],'attributes':_0x2666f4['fields'],'raw':_0x2666f4[_0xf07c('0x8')]};}exports[_0xf07c('0x9')]=function(_0x1cb43e){var _0x5c826a=null;if(_0x1cb43e){_0x5c826a=_0x1cb43e['split'](',');}return _0x5c826a;};exports[_0xf07c('0xa')]=function(_0x5defbe,_0x151cbc){var _0x1670e9={};if(!_[_0xf07c('0xb')](_0x5defbe)){_[_0xf07c('0xc')](_0x5defbe,function(_0x510ec6,_0x4ee054){try{if(_0x151cbc){var _0x33a22b=_['find'](_0x151cbc,{'name':_0x4ee054})||{};if(hasSequelizeOperator(_0x510ec6)){_0x1670e9[_0x4ee054]=getOperatorValue(_0x510ec6);}else if(_0x33a22b['type']===_0xf07c('0xd')&&_[_0xf07c('0xe')](_0x510ec6)){var _0x4ef363=JSON[_0xf07c('0x5')](_0x510ec6);var _0x41c4d9={'$gte':moment(moment(_0x4ef363['$gte'])['format'](_0xf07c('0xf')))['utc']()[_0xf07c('0x10')](),'$lte':moment(moment(_0x4ef363[_0xf07c('0x11')])['format']('YYYY-MM-DD'))[_0xf07c('0x12')]()[_0xf07c('0x13')](0x1,'s')['format']()};_0x1670e9[_0x4ee054]=_0x41c4d9;}else if(_0x33a22b['name']==='uniqueid'){_0x1670e9[_0x4ee054]=_0x510ec6;}else{_0x1670e9[_0x4ee054]=_[_0xf07c('0x14')](_0x510ec6)?_0x510ec6:JSON[_0xf07c('0x5')](_0x510ec6);}}else{_0x1670e9[_0x4ee054]=_['isArray'](_0x510ec6)?_0x510ec6:JSON['parse'](_0x510ec6);}}catch(_0x435ddb){_0x1670e9[_0x4ee054]=_0x510ec6[_0xf07c('0x15')](',');}});}return _0x1670e9;};exports[_0xf07c('0x16')]=function(_0x18b7aa){_0x18b7aa=parseInt(_0x18b7aa,0xa);if(!_0x18b7aa||_0x18b7aa<0x0){_0x18b7aa=LIMIT_VALUE;}return _0x18b7aa;};exports['offset']=function(_0x413c4f){_0x413c4f=parseInt(_0x413c4f,0xa);if(!_0x413c4f||_0x413c4f<0x0){_0x413c4f=0x0;}return _0x413c4f;};exports[_0xf07c('0x17')]=function(_0x58dae3){var _0x4a8ae9,_0x11bd0a=null;if(_0x58dae3){_0x4a8ae9=_0x58dae3['split'](',');_0x11bd0a=_[_0xf07c('0x18')](_0x4a8ae9,function(_0x66a4d9){if(_0x66a4d9[_0xf07c('0x19')]('-')===0x0){return[_0x66a4d9===_0xf07c('0x1a')?sequelize[_0xf07c('0x1b')](sequelize[_0xf07c('0x1c')]('priority'),_0xf07c('0x1d')):_0x66a4d9['substr'](0x1),_0xf07c('0x1e')];}else{return[_0x66a4d9===_0xf07c('0x1a')?sequelize['cast'](sequelize['col']('priority'),_0xf07c('0x1d')):_0x66a4d9,'ASC'];}});}return _0x11bd0a;};exports['omit']=function(_0x3d86f7,_0x2dd3d7){if(_[_0xf07c('0xb')](_0x3d86f7)){return _0x3d86f7;}if(_[_0xf07c('0x14')](_0x3d86f7)){for(var _0x290fc7=0x0;_0x290fc7<_0x3d86f7[_0xf07c('0x1f')];_0x290fc7+=0x1){_0x3d86f7[_0x290fc7]=this[_0xf07c('0x20')](_0x3d86f7[_0x290fc7],_0x2dd3d7);}return _0x3d86f7;}if(!_['isObject'](_0x3d86f7)){return _0x3d86f7;}if(_['isString'](_0x2dd3d7)){_0x2dd3d7=[_0x2dd3d7];}if(!_[_0xf07c('0x14')](_0x2dd3d7)){return _0x3d86f7;}for(var _0x2c5283=0x0;_0x2c5283<_0x2dd3d7['length'];_0x2c5283+=0x1){_[_0xf07c('0x21')](_0x3d86f7,_0x2dd3d7[_0x2c5283]);}for(var _0x48c35b in _0x3d86f7){if(_0x3d86f7['hasOwnProperty'](_0x48c35b)){_0x3d86f7[_0x48c35b]=this['omit'](_0x3d86f7[_0x48c35b],_0x2dd3d7);}}return _0x3d86f7;};exports[_0xf07c('0x22')]=function(_0x577162){return _0x577162[_0xf07c('0x23')](RegExp(_0xf07c('0x24')))?!![]:![];};exports['isEmail']=function(_0x54a5c2){return _0x54a5c2[_0xf07c('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xf07c('0x25')]=function(_0xa31a37,_0x2b2e5a){var _0x11be04=[];var _0x33b630=/[ `!@#$%^&*()_\-?~]/;var _0x1de7cd=_0x2b2e5a?_0xf07c('0x26'):_0xf07c('0x27');_0xa31a37[_0xf07c('0x15')](/[ ,]+/)[_0xf07c('0x28')](function(_0x40c448){_0x40c448=_0x40c448[_0xf07c('0x29')](/([^:]")"+/g,'$1');_0x40c448='+'+_0x40c448+'*';var _0x55f45d=_0x40c448[_0xf07c('0x23')](_0x33b630);if(_0x55f45d){_0x40c448='\x22'+_0x40c448+'\x22';}_0x11be04[_0xf07c('0x2a')](_0x40c448);});_0x1de7cd=_0x1de7cd[_0xf07c('0x29')]('{EXPR}',_0x11be04[_0xf07c('0x2b')]('\x20'));return _0x1de7cd;};exports['getOptions']=function(_0x12ec3c,_0x55bc9c,_0x540327){var _0x584195={},_0x49ce1a={};if(_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x2d')]){_0x55bc9c[_0xf07c('0x2c')]['id']=_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x2d')];delete _0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x2d')];}_0x584195[_0xf07c('0x6')]=_[_0xf07c('0x18')](_0x12ec3c,_0xf07c('0x2e'));_0x584195[_0xf07c('0x2c')]=_['keys'](_0x55bc9c['query']);_0x584195[_0xf07c('0xa')]=_['intersection'](_0x584195[_0xf07c('0x6')],_0x584195[_0xf07c('0x2c')]);_0x49ce1a[_0xf07c('0x2f')]=_[_0xf07c('0x30')](_0x584195[_0xf07c('0x6')],this[_0xf07c('0x9')](_0x55bc9c['query'][_0xf07c('0x9')]));_0x49ce1a[_0xf07c('0x2f')]=_0x49ce1a[_0xf07c('0x2f')]['length']?_0x49ce1a[_0xf07c('0x2f')]:_0x584195[_0xf07c('0x6')];if(!_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x31')](_0xf07c('0x32'))){_0x49ce1a[_0xf07c('0x16')]=this[_0xf07c('0x16')](_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x16')]);_0x49ce1a[_0xf07c('0x33')]=this[_0xf07c('0x33')](_0x55bc9c[_0xf07c('0x2c')]['offset']);}_0x49ce1a[_0xf07c('0x34')]=this[_0xf07c('0x17')](_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x17')]);_0x49ce1a[_0xf07c('0x35')]=this[_0xf07c('0xa')](_[_0xf07c('0x36')](_0x55bc9c[_0xf07c('0x2c')],_0x584195[_0xf07c('0xa')]),_0x12ec3c);if(_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x37')]){var _0x20b71c=_0x12ec3c;var _0x3f1d13=_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x37')];if(typeof _0x3f1d13===_0xf07c('0x38')){_0x20b71c=_['filter'](_0x12ec3c,function(_0x17cdaa){return _[_0xf07c('0x4')](_0x3f1d13[_0xf07c('0x39')],_0x17cdaa[_0xf07c('0x2e')]);});_0x3f1d13=_0x3f1d13[_0xf07c('0x3a')];}_0x49ce1a['where']=_[_0xf07c('0x3b')](_0x49ce1a[_0xf07c('0x35')],{'$or':_[_0xf07c('0x18')](_0x20b71c,function(_0x2d4ac5){if(_0x2d4ac5[_0xf07c('0x3c')]!==_0xf07c('0x3d')){if(_0x540327){return sequelize[_0xf07c('0x35')](sequelize['fn'](_0xf07c('0x3e'),sequelize['col'](_0x2d4ac5[_0xf07c('0x2e')])),{'$like':sequelize['fn'](_0xf07c('0x3e'),'%'+_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x37')]+'%')});}else{var _0x5c9571={};_0x5c9571[_0x2d4ac5[_0xf07c('0x2e')]]={'$like':'%'+_0x55bc9c[_0xf07c('0x2c')][_0xf07c('0x37')]+'%'};return _0x5c9571;}}})});}_0x49ce1a=_['merge']({},_0x49ce1a,_0x55bc9c[_0xf07c('0x3f')]);return _0x49ce1a;};exports['include']=function(_0x478b46){var _0x4c8ddf=[];if(_0x478b46['includeAll']){_0x4c8ddf[_0xf07c('0x2a')]({'all':!![]});}else if(_0x478b46[_0xf07c('0x40')]){if(Array['isArray'](_0x478b46[_0xf07c('0x40')])){_0x4c8ddf=Object[_0xf07c('0x3')](_0x478b46[_0xf07c('0x40')])[_0xf07c('0x18')](function(_0x2530bd){return parseIncludeModel(_0x478b46[_0xf07c('0x40')][_0x2530bd]);});}else{var _0x2455e2=parseIncludeModel(_0x478b46['include']);_0x4c8ddf['push'](_0x2455e2);}}return _0x4c8ddf;}; \ No newline at end of file +var _0x04e7=['order','sort','pick','object','filter','columns','value','where','merge','VIRTUAL','lower','options','include','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','find','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','isArray','limit','offset','map','indexOf','priority','cast','col','DESC','unsigned','ASC','omit','isEmpty','length','isObject','isString','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','$id','query','attributes','intersection','nolimit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x04e7,0x121));var _0x704e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x04e7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x704e('0x0'));var sequelize=require(_0x704e('0x1'));var moment=require(_0x704e('0x2'));var db=require(_0x704e('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x13c834){var _0x1e3a42=['ne'];try{var _0x3fd60b=JSON[_0x704e('0x4')](_0x13c834);var _0x27d66f=Object[_0x704e('0x5')](_0x3fd60b)[0x0];return _0x1e3a42[_0x704e('0x6')](_0x27d66f);}catch(_0x389e2f){return![];}}function getOperatorValue(_0x4a6a70){var _0x175eb8=JSON[_0x704e('0x4')](_0x4a6a70);var _0x85728=Object[_0x704e('0x5')](_0x175eb8)[0x0];var _0x5b7c61=_0x175eb8[_0x85728];return{['$'+_0x85728]:_0x5b7c61};}function parseIncludeModel(_0x869a63){var _0x181398=JSON[_0x704e('0x4')](_0x869a63);return{'model':db[_0x181398[_0x704e('0x7')]],'as':_0x181398[_0x704e('0x8')],'attributes':_0x181398[_0x704e('0x9')],'raw':_0x181398[_0x704e('0xa')]};}exports['fields']=function(_0x3c80dd){var _0x3e29df=null;if(_0x3c80dd){_0x3e29df=_0x3c80dd[_0x704e('0xb')](',');}return _0x3e29df;};exports[_0x704e('0xc')]=function(_0x371641,_0x13b40b){var _0x113e1e={};if(!_['isEmpty'](_0x371641)){_['forOwn'](_0x371641,function(_0x45f43a,_0xe7c8fc){try{if(_0x13b40b){var _0x12a46c=_[_0x704e('0xd')](_0x13b40b,{'name':_0xe7c8fc})||{};if(hasSequelizeOperator(_0x45f43a)){_0x113e1e[_0xe7c8fc]=getOperatorValue(_0x45f43a);}else if(_0x12a46c[_0x704e('0xe')]===_0x704e('0xf')&&_[_0x704e('0x10')](_0x45f43a)){var _0x33a743=JSON['parse'](_0x45f43a);var _0xed4c87={'$gte':moment(moment(_0x33a743[_0x704e('0x11')])[_0x704e('0x12')]('YYYY-MM-DD'))[_0x704e('0x13')]()[_0x704e('0x12')](),'$lte':moment(moment(_0x33a743[_0x704e('0x14')])['format'](_0x704e('0x15')))[_0x704e('0x13')]()[_0x704e('0x16')](0x1,'s')[_0x704e('0x12')]()};_0x113e1e[_0xe7c8fc]=_0xed4c87;}else if(_0x12a46c[_0x704e('0x17')]==='uniqueid'){_0x113e1e[_0xe7c8fc]=_0x45f43a;}else{_0x113e1e[_0xe7c8fc]=_[_0x704e('0x18')](_0x45f43a)?_0x45f43a:JSON['parse'](_0x45f43a);}}else{_0x113e1e[_0xe7c8fc]=_[_0x704e('0x18')](_0x45f43a)?_0x45f43a:JSON['parse'](_0x45f43a);}}catch(_0x5e0542){_0x113e1e[_0xe7c8fc]=_0x45f43a['split'](',');}});}return _0x113e1e;};exports[_0x704e('0x19')]=function(_0x361cb7){_0x361cb7=parseInt(_0x361cb7,0xa);if(!_0x361cb7||_0x361cb7<0x0){_0x361cb7=LIMIT_VALUE;}return _0x361cb7;};exports[_0x704e('0x1a')]=function(_0x5f1a62){_0x5f1a62=parseInt(_0x5f1a62,0xa);if(!_0x5f1a62||_0x5f1a62<0x0){_0x5f1a62=0x0;}return _0x5f1a62;};exports['sort']=function(_0x2f56b5){var _0x152ad8,_0x2bab9e=null;if(_0x2f56b5){_0x152ad8=_0x2f56b5[_0x704e('0xb')](',');_0x2bab9e=_[_0x704e('0x1b')](_0x152ad8,function(_0x3cafe7){if(_0x3cafe7[_0x704e('0x1c')]('-')===0x0){return[_0x3cafe7===_0x704e('0x1d')?sequelize[_0x704e('0x1e')](sequelize[_0x704e('0x1f')](_0x704e('0x1d')),'unsigned'):_0x3cafe7['substr'](0x1),_0x704e('0x20')];}else{return[_0x3cafe7===_0x704e('0x1d')?sequelize[_0x704e('0x1e')](sequelize[_0x704e('0x1f')](_0x704e('0x1d')),_0x704e('0x21')):_0x3cafe7,_0x704e('0x22')];}});}return _0x2bab9e;};exports[_0x704e('0x23')]=function(_0x562816,_0x2d81ee){if(_[_0x704e('0x24')](_0x562816)){return _0x562816;}if(_[_0x704e('0x18')](_0x562816)){for(var _0x50d3ab=0x0;_0x50d3ab<_0x562816[_0x704e('0x25')];_0x50d3ab+=0x1){_0x562816[_0x50d3ab]=this['omit'](_0x562816[_0x50d3ab],_0x2d81ee);}return _0x562816;}if(!_[_0x704e('0x26')](_0x562816)){return _0x562816;}if(_[_0x704e('0x27')](_0x2d81ee)){_0x2d81ee=[_0x2d81ee];}if(!_[_0x704e('0x18')](_0x2d81ee)){return _0x562816;}for(var _0x395e7=0x0;_0x395e7<_0x2d81ee['length'];_0x395e7+=0x1){_['unset'](_0x562816,_0x2d81ee[_0x395e7]);}for(var _0x433839 in _0x562816){if(_0x562816['hasOwnProperty'](_0x433839)){_0x562816[_0x433839]=this['omit'](_0x562816[_0x433839],_0x2d81ee);}}return _0x562816;};exports[_0x704e('0x28')]=function(_0x247dee){return _0x247dee[_0x704e('0x29')](RegExp(_0x704e('0x2a')))?!![]:![];};exports[_0x704e('0x2b')]=function(_0x5cc6f5){return _0x5cc6f5['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x704e('0x2c')]=function(_0x5b4c97,_0x4b3a42){var _0x2fffcc=[];var _0xe57be=/[ `!@#$%^&*()_\-?~]/;var _0x2e6de1=_0x4b3a42?_0x704e('0x2d'):_0x704e('0x2e');_0x5b4c97[_0x704e('0xb')](/[ ,]+/)[_0x704e('0x2f')](function(_0x56e455){_0x56e455=_0x56e455[_0x704e('0x30')](/([^:]")"+/g,'$1');_0x56e455='+'+_0x56e455+'*';var _0x599979=_0x56e455[_0x704e('0x29')](_0xe57be);if(_0x599979){_0x56e455='\x22'+_0x56e455+'\x22';}_0x2fffcc['push'](_0x56e455);});_0x2e6de1=_0x2e6de1[_0x704e('0x30')](_0x704e('0x2e'),_0x2fffcc[_0x704e('0x31')]('\x20'));return _0x2e6de1;};exports[_0x704e('0x32')]=function(_0xe2ec61,_0x81ad4e,_0x307275){var _0x1da7be={},_0x2c8090={};if(_0x81ad4e['query'][_0x704e('0x33')]){_0x81ad4e['query']['id']=_0x81ad4e[_0x704e('0x34')]['$id'];delete _0x81ad4e['query'][_0x704e('0x33')];}_0x1da7be[_0x704e('0x7')]=_['map'](_0xe2ec61,_0x704e('0x17'));_0x1da7be['query']=_[_0x704e('0x5')](_0x81ad4e[_0x704e('0x34')]);_0x1da7be[_0x704e('0xc')]=_['intersection'](_0x1da7be[_0x704e('0x7')],_0x1da7be[_0x704e('0x34')]);_0x2c8090[_0x704e('0x35')]=_[_0x704e('0x36')](_0x1da7be[_0x704e('0x7')],this[_0x704e('0x9')](_0x81ad4e[_0x704e('0x34')][_0x704e('0x9')]));_0x2c8090[_0x704e('0x35')]=_0x2c8090['attributes']['length']?_0x2c8090[_0x704e('0x35')]:_0x1da7be[_0x704e('0x7')];if(!_0x81ad4e[_0x704e('0x34')]['hasOwnProperty'](_0x704e('0x37'))){_0x2c8090[_0x704e('0x19')]=this[_0x704e('0x19')](_0x81ad4e[_0x704e('0x34')][_0x704e('0x19')]);_0x2c8090[_0x704e('0x1a')]=this[_0x704e('0x1a')](_0x81ad4e[_0x704e('0x34')]['offset']);}_0x2c8090[_0x704e('0x38')]=this[_0x704e('0x39')](_0x81ad4e[_0x704e('0x34')]['sort']);_0x2c8090['where']=this[_0x704e('0xc')](_[_0x704e('0x3a')](_0x81ad4e[_0x704e('0x34')],_0x1da7be[_0x704e('0xc')]),_0xe2ec61);if(_0x81ad4e[_0x704e('0x34')]['filter']){var _0x8c9232=_0xe2ec61;var _0x578731=_0x81ad4e['query']['filter'];if(typeof _0x578731===_0x704e('0x3b')){_0x8c9232=_[_0x704e('0x3c')](_0xe2ec61,function(_0x58820e){return _[_0x704e('0x6')](_0x578731[_0x704e('0x3d')],_0x58820e[_0x704e('0x17')]);});_0x578731=_0x578731[_0x704e('0x3e')];}_0x2c8090[_0x704e('0x3f')]=_[_0x704e('0x40')](_0x2c8090['where'],{'$or':_[_0x704e('0x1b')](_0x8c9232,function(_0x45dba1){if(_0x45dba1[_0x704e('0xe')]!==_0x704e('0x41')){if(_0x307275){return sequelize[_0x704e('0x3f')](sequelize['fn'](_0x704e('0x42'),sequelize[_0x704e('0x1f')](_0x45dba1[_0x704e('0x17')])),{'$like':sequelize['fn']('lower','%'+_0x81ad4e[_0x704e('0x34')][_0x704e('0x3c')]+'%')});}else{var _0x4d9145={};_0x4d9145[_0x45dba1[_0x704e('0x17')]]={'$like':'%'+_0x81ad4e[_0x704e('0x34')][_0x704e('0x3c')]+'%'};return _0x4d9145;}}})});}_0x2c8090=_[_0x704e('0x40')]({},_0x2c8090,_0x81ad4e[_0x704e('0x43')]);return _0x2c8090;};exports[_0x704e('0x44')]=function(_0x1de73f){var _0xde22e3=[];if(_0x1de73f['includeAll']){_0xde22e3['push']({'all':!![]});}else if(_0x1de73f[_0x704e('0x44')]){if(Array[_0x704e('0x18')](_0x1de73f['include'])){_0xde22e3=Object['keys'](_0x1de73f[_0x704e('0x44')])[_0x704e('0x1b')](function(_0x2fed87){return parseIncludeModel(_0x1de73f[_0x704e('0x44')][_0x2fed87]);});}else{var _0x167d1b=parseIncludeModel(_0x1de73f[_0x704e('0x44')]);_0xde22e3['push'](_0x167d1b);}}return _0xde22e3;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 44c4581..f072338 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 _0x8ef6=['startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','validateSortParameter','toLowerCase','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','online','omit','pick','filterAgentAttributes','name','role','lastLoginAt','faxStatusTime','smsStatusTime','voiceStatusTime','faxCapacity','destconnectedlinenum','onhold','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','then','getAgents','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','fullname','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split'];(function(_0x5d4c14,_0x181486){var _0x1048a8=function(_0x4adb0b){while(--_0x4adb0b){_0x5d4c14['push'](_0x5d4c14['shift']());}};_0x1048a8(++_0x181486);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1c0c35,_0xa09ee5){_0x1c0c35=_0x1c0c35-0x0;var _0x48dadc=_0x8ef6[_0x1c0c35];return _0x48dadc;};'use strict';var _=require(_0x68ef('0x0'));var jayson=require(_0x68ef('0x1'));var db=require(_0x68ef('0x2'))['db'];var amiClient=jayson[_0x68ef('0x3')][_0x68ef('0x4')]({'port':0x232a});var routingClient=jayson[_0x68ef('0x3')][_0x68ef('0x4')]({'port':0x232c});function isAgentPaused(_0x4a72b8,_0x27d0af){var _0x129ce=[_0x4a72b8[_0x68ef('0x5')],_0x4a72b8[_0x68ef('0x6')],_0x4a72b8['mailPause'],_0x4a72b8['openchannelPause'],_0x4a72b8[_0x68ef('0x7')],_0x4a72b8[_0x68ef('0x8')],_0x4a72b8[_0x68ef('0x9')]];if(!_0x27d0af)return _['every'](_0x129ce);var _0x228967=_[_0x68ef('0xa')](_0x129ce);return _0x228967[_0x68ef('0xb')]>0x0&&_0x228967[_0x68ef('0xb')]<_0x129ce[_0x68ef('0xb')]?!![]:![];}function isIdle(_0x51554d){return _0x51554d===_0x68ef('0xc')||_0x51554d===_0x68ef('0xd')||_0x51554d===_0x68ef('0xe')||_0x51554d===_0x68ef('0xf')||_[_0x68ef('0x10')](_0x51554d);}function isAgentIdle(_0xfa6763){if(_0xfa6763['voiceStatus']!==_0x68ef('0xc')&&_0xfa6763[_0x68ef('0x8')]){_0xfa6763[_0x68ef('0x11')]=_0x68ef('0x12');return![];}return _[_0x68ef('0x13')]([_0xfa6763[_0x68ef('0x14')],_0xfa6763['faxStatus'],_0xfa6763[_0x68ef('0x15')],_0xfa6763[_0x68ef('0x16')],_0xfa6763[_0x68ef('0x17')],_0xfa6763['voiceStatus'],_0xfa6763[_0x68ef('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x68ef('0x19')](_0x68ef('0x1a'),{})['then'](function(_0x35493d){if(_0x35493d[_0x68ef('0x1b')]){throw new Error(_0x68ef('0x1c'));}var _0x3780a4=_0x35493d['result'];return routingClient[_0x68ef('0x19')]('Agents',{})['then'](function(_0x2633c1){if(_0x2633c1[_0x68ef('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x527870=_0x2633c1[_0x68ef('0x1d')];return _[_0x68ef('0x1e')]({},_0x3780a4,_0x527870);});})[_0x68ef('0x1f')](function(_0x4fad1c){throw _0x4fad1c;});}exports[_0x68ef('0x20')]=getRealtimeAgents;function getAgentStatus(_0x36a4cb){var _0x183f5f='unknown';if(isAgentPaused(_0x36a4cb))_0x183f5f=_0x68ef('0x12');else if(isAgentPaused(_0x36a4cb,!![]))_0x183f5f=_0x68ef('0x21');else if(isAgentIdle(_0x36a4cb))_0x183f5f='idle';else _0x183f5f=_0x68ef('0x22');return _0x183f5f;}exports[_0x68ef('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x19aa3d,_0x5ddec7){var _0x59723c=_['isArray'](_0x19aa3d)?_0x19aa3d:[_0x19aa3d];var _0x26018d=_[_0x68ef('0x24')](_0x5ddec7)+_0x68ef('0x25');var _0x2e6e39=_[_0x68ef('0x26')](_0x59723c,function(_0xfe2595){return db[_0x26018d][_0x68ef('0x27')]({'where':{'id':_0xfe2595}})[_0x68ef('0x28')](function(_0x65fd09){if(!_0x65fd09)return[];return _0x65fd09[_0x68ef('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x2e6e39)[_0x68ef('0x28')](function(_0x57f9ee){var _0x599243=_(_0x57f9ee)['flatten']()[_0x68ef('0x26')]('id')[_0x68ef('0x2a')]()[_0x68ef('0x2b')]();return _0x599243;});}exports[_0x68ef('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52e67e,_0x4a0550,_0x1cbe4f){try{if(_0x4a0550[_0x68ef('0xb')]>0x0){_0x52e67e=_0x52e67e[_0x68ef('0xa')](function(_0x263b30){return _0x4a0550[_0x68ef('0x2d')](_0x263b30['id']);});}var _0x201884=_0x52e67e[_0x68ef('0xa')](function(_0x4579cb){var _0x5a6dfd=_0x68ef('0x22');if(isAgentIdle(_0x4579cb)){_0x5a6dfd=_0x68ef('0xc');}return _0x5a6dfd===_0x1cbe4f;});return _[_0x68ef('0x26')](_0x201884,'id');}catch(_0x4c25aa){throw _0x4c25aa;}}exports[_0x68ef('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x523120,_0x133788,_0x17588a){return Promise['resolve']()['then'](function(){if(_0x133788[_0x68ef('0xb')]>0x0){_0x523120=_0x523120[_0x68ef('0xa')](function(_0x4b8fc8){return _0x133788[_0x68ef('0x2d')](_0x4b8fc8['id']);});}return _0x523120;})[_0x68ef('0x28')](function(){return db[_0x68ef('0x2f')][_0x68ef('0x30')]({'attributes':['id','name',_0x68ef('0x31'),_0x68ef('0x5'),'faxPause',_0x68ef('0x32'),'openchannelPause',_0x68ef('0x7'),_0x68ef('0x8'),'whatsappPause',_0x68ef('0x33')],'where':{'id':{'$in':_['map'](_0x523120,'id')}},'raw':!![]});})[_0x68ef('0x28')](function(_0x575f43){return _0x575f43[_0x68ef('0x26')](function(_0x1444e0){var _0x798276=_['find'](_0x523120,['id',_0x1444e0['id']]);var _0x1f91c7=filterAgentAttributes(_0x798276);_['merge'](_0x1444e0,_0x1f91c7);_0x1444e0[_0x68ef('0x34')]=getAgentStatus(_0x1444e0);return _0x1444e0;});})['then'](function(_0x474ffa){var _0x362ef1=sortAgentsByStatus(_0x474ffa,_0x17588a);return _[_0x68ef('0x26')](_0x362ef1,'id');})[_0x68ef('0x1f')](function(_0x2181d9){throw _0x2181d9;});}exports[_0x68ef('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x51ba3d){var _0x294fba={'fields':[],'order':null};var _0x15a6ab=_0x51ba3d[_0x68ef('0x36')](',');_0x294fba['fields']=_[_0x68ef('0xa')](_0x15a6ab,function(_0x3c5de6){if(!_0x3c5de6[_0x68ef('0x2d')]('globalStatus')){return!![];}_0x294fba['order']=_[_0x68ef('0x37')](_0x3c5de6,'-')?_0x68ef('0x38'):_0x68ef('0x39');return![];});return _0x294fba;}exports[_0x68ef('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x401459){if(!_0x401459){_0x401459=_0x68ef('0x3b');}if(_0x401459[_0x68ef('0x2d')]('fullname')&&!_0x401459[_0x68ef('0x2d')](_0x68ef('0x3c'))){var _0x2f6ee0=_0x401459[_0x68ef('0x3d')](0x0,_0x401459['indexOf'](_0x68ef('0x31')));_0x401459+=','+_0x2f6ee0+_0x68ef('0x3c');}return _0x401459;}exports[_0x68ef('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x410c10,_0x19169a){var _0x3b00ea=_0x410c10['sort'](function(_0x3f000f,_0x3f7699){if(_0x3f000f[_0x68ef('0x34')]===_0x3f7699[_0x68ef('0x34')]){if(_0x3f000f[_0x68ef('0x34')]===_0x68ef('0x12')){if(_0x19169a===_0x68ef('0x38')){return(_0x3f000f[_0x68ef('0x33')]||'')<(_0x3f7699[_0x68ef('0x33')]||'')||_0x3f000f['fullname'][_0x68ef('0x3f')]()>_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3f')]()?0x1:-0x1;}else{return(_0x3f000f[_0x68ef('0x33')]||'')<(_0x3f7699[_0x68ef('0x33')]||'')||_0x3f000f[_0x68ef('0x31')][_0x68ef('0x3f')]()>_0x3f7699['fullname'][_0x68ef('0x3f')]()?-0x1:0x1;}}else{if(_0x19169a==='DESC'){return _0x3f000f[_0x68ef('0x31')][_0x68ef('0x3f')]()<_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3f')]()?0x1:-0x1;}else{return _0x3f000f['fullname'][_0x68ef('0x3f')]()<_0x3f7699['fullname'][_0x68ef('0x3f')]()?-0x1:0x1;}}}else{if(_0x19169a==='DESC'){return _0x3f000f[_0x68ef('0x34')]<_0x3f7699[_0x68ef('0x34')]?0x1:-0x1;}else{return _0x3f000f[_0x68ef('0x34')]<_0x3f7699['globalStatus']?-0x1:0x1;}}});return _0x3b00ea;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4044d5){var _0x399055=['userpic','online','lastLoginAt',_0x68ef('0x40'),_0x68ef('0x33'),_0x68ef('0x40'),_0x68ef('0x3c'),_0x68ef('0x41'),'chatPause','openchannelPause',_0x68ef('0x32'),_0x68ef('0x7'),_0x68ef('0x9'),_0x68ef('0x6'),'voicePause',_0x68ef('0x42'),_0x68ef('0x43'),_0x68ef('0x44'),_0x68ef('0x45'),'whatsappCapacity','faxCapacity',_0x68ef('0x46'),_0x68ef('0x47'),'mailCurrentCapacity',_0x68ef('0x48'),_0x68ef('0x49'),_0x68ef('0x4a'),_0x68ef('0x14'),_0x68ef('0x16'),'mailStatus',_0x68ef('0x17'),_0x68ef('0x18'),_0x68ef('0x4b'),'voiceStatus',_0x68ef('0x4c'),_0x68ef('0x4d'),_0x68ef('0x4e'),'smsStatusTime',_0x68ef('0x4f'),'faxStatusTime','voiceStatusTime',_0x68ef('0x50'),'destconnectedlinenum',_0x68ef('0x51'),_0x68ef('0x52'),_0x68ef('0x53'),_0x68ef('0x54')];var _0x2a0be0=[_0x68ef('0x5'),_0x68ef('0x55'),_0x68ef('0x32'),_0x68ef('0x7'),_0x68ef('0x9'),'faxPause','voicePause',_0x68ef('0x56')];var _0x27a449=_(_0x4044d5)[_0x68ef('0x57')](_0x2a0be0)[_0x68ef('0x58')](_0x399055)[_0x68ef('0x2b')]();return _0x27a449;}exports[_0x68ef('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x68ef('0x5a'),_0x68ef('0x31'),_0x68ef('0x5b'),'internal','online',_0x68ef('0x34'),'userpic',_0x68ef('0x5c'),'pauseType',_0x68ef('0x40'),_0x68ef('0x6'),'chatPause',_0x68ef('0x32'),'openchannelPause',_0x68ef('0x7'),_0x68ef('0x8'),_0x68ef('0x9'),_0x68ef('0x14'),_0x68ef('0x4b'),_0x68ef('0x15'),'openchannelStatus',_0x68ef('0x17'),_0x68ef('0x11'),_0x68ef('0x18'),_0x68ef('0x4c'),_0x68ef('0x5d'),_0x68ef('0x4e'),'openchannelStatusTime',_0x68ef('0x5e'),_0x68ef('0x5f'),'whatsappStatusTime',_0x68ef('0x42'),_0x68ef('0x60'),_0x68ef('0x44'),'openchannelCapacity',_0x68ef('0x45'),'whatsappCapacity','chatCurrentCapacity',_0x68ef('0x4a'),'mailCurrentCapacity',_0x68ef('0x47'),'smsCurrentCapacity',_0x68ef('0x49'),_0x68ef('0x52'),_0x68ef('0x53'),_0x68ef('0x61'),_0x68ef('0x62'),_0x68ef('0x50'),'routealias',_0x68ef('0x51')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xe14b=['fullname','internal','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','whatsappStatus','whatsappStatusTime','mailCapacity','openchannelCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','length','unavailable','ringing','voiceStatus','idle','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','unknown','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','name','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal'];(function(_0x1097fa,_0x1f103d){var _0x4f039a=function(_0x268156){while(--_0x268156){_0x1097fa['push'](_0x1097fa['shift']());}};_0x4f039a(++_0x1f103d);}(_0xe14b,0x93));var _0xbe14=function(_0x133a7a,_0x2f9ffd){_0x133a7a=_0x133a7a-0x0;var _0x42ca6b=_0xe14b[_0x133a7a];return _0x42ca6b;};'use strict';var _=require(_0xbe14('0x0'));var jayson=require(_0xbe14('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xbe14('0x2')]({'port':0x232a});var routingClient=jayson[_0xbe14('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x7d3665,_0x5ce8fb){var _0x496c04=[_0x7d3665[_0xbe14('0x4')],_0x7d3665[_0xbe14('0x5')],_0x7d3665[_0xbe14('0x6')],_0x7d3665[_0xbe14('0x7')],_0x7d3665[_0xbe14('0x8')],_0x7d3665[_0xbe14('0x9')],_0x7d3665[_0xbe14('0xa')]];if(!_0x5ce8fb)return _['every'](_0x496c04);var _0x50f909=_['filter'](_0x496c04);return _0x50f909[_0xbe14('0xb')]>0x0&&_0x50f909[_0xbe14('0xb')]<_0x496c04[_0xbe14('0xb')]?!![]:![];}function isIdle(_0x90b4f){return _0x90b4f==='idle'||_0x90b4f==='unknown'||_0x90b4f===_0xbe14('0xc')||_0x90b4f===_0xbe14('0xd')||_['isNil'](_0x90b4f);}function isAgentIdle(_0x254c3b){if(_0x254c3b[_0xbe14('0xe')]!==_0xbe14('0xf')&&_0x254c3b[_0xbe14('0x9')]){_0x254c3b[_0xbe14('0xe')]=_0xbe14('0x10');return![];}return _[_0xbe14('0x11')]([_0x254c3b[_0xbe14('0x12')],_0x254c3b[_0xbe14('0x13')],_0x254c3b[_0xbe14('0x14')],_0x254c3b[_0xbe14('0x15')],_0x254c3b[_0xbe14('0x16')],_0x254c3b[_0xbe14('0xe')],_0x254c3b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0xf4ac9){if(_0xf4ac9[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x21c789=_0xf4ac9[_0xbe14('0x1a')];return routingClient[_0xbe14('0x1b')](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0x29ab73){if(_0x29ab73[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x137ee5=_0x29ab73[_0xbe14('0x1a')];return _[_0xbe14('0x1c')]({},_0x21c789,_0x137ee5);});})[_0xbe14('0x1d')](function(_0x3249da){throw _0x3249da;});}exports[_0xbe14('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x59a9e3){var _0x24f820=_0xbe14('0x1f');if(isAgentPaused(_0x59a9e3))_0x24f820=_0xbe14('0x10');else if(isAgentPaused(_0x59a9e3,!![]))_0x24f820=_0xbe14('0x20');else if(isAgentIdle(_0x59a9e3))_0x24f820=_0xbe14('0xf');else _0x24f820='busy';return _0x24f820;}exports[_0xbe14('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x56d845,_0x3c1c85){var _0x56e80c=_[_0xbe14('0x22')](_0x56d845)?_0x56d845:[_0x56d845];var _0x4a25fa=_[_0xbe14('0x23')](_0x3c1c85)+_0xbe14('0x24');var _0x505dbd=_[_0xbe14('0x25')](_0x56e80c,function(_0x4d4190){return db[_0x4a25fa][_0xbe14('0x26')]({'where':{'id':_0x4d4190}})['then'](function(_0x36a21e){if(!_0x36a21e)return[];return _0x36a21e[_0xbe14('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xbe14('0x28')](_0x505dbd)[_0xbe14('0x18')](function(_0x15ef02){var _0x2703f5=_(_0x15ef02)['flatten']()[_0xbe14('0x25')]('id')[_0xbe14('0x29')]()[_0xbe14('0x2a')]();return _0x2703f5;});}exports[_0xbe14('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5dd475,_0x16f884,_0x29fc64){try{if(_0x16f884['length']>0x0){_0x5dd475=_0x5dd475[_0xbe14('0x2c')](function(_0x3b3e84){return _0x16f884[_0xbe14('0x2d')](_0x3b3e84['id']);});}var _0x19252f=_0x5dd475[_0xbe14('0x2c')](function(_0x36d4b2){var _0x31a664=_0xbe14('0x2e');if(isAgentIdle(_0x36d4b2)){_0x31a664=_0xbe14('0xf');}return _0x31a664===_0x29fc64;});return _[_0xbe14('0x25')](_0x19252f,'id');}catch(_0x40538f){throw _0x40538f;}}exports[_0xbe14('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x39dc0a,_0x10ae36,_0x223f7a){return Promise[_0xbe14('0x30')]()[_0xbe14('0x18')](function(){if(_0x10ae36[_0xbe14('0xb')]>0x0){_0x39dc0a=_0x39dc0a[_0xbe14('0x2c')](function(_0x14e7c4){return _0x10ae36['includes'](_0x14e7c4['id']);});}return _0x39dc0a;})[_0xbe14('0x18')](function(){return db['User']['findAll']({'attributes':['id',_0xbe14('0x31'),'fullname',_0xbe14('0x4'),_0xbe14('0x5'),'mailPause','openchannelPause','smsPause',_0xbe14('0x9'),_0xbe14('0xa'),'pauseType'],'where':{'id':{'$in':_[_0xbe14('0x25')](_0x39dc0a,'id')}},'raw':!![]});})[_0xbe14('0x18')](function(_0x452635){return _0x452635[_0xbe14('0x25')](function(_0x29c23e){var _0x5ef1e5=_['find'](_0x39dc0a,['id',_0x29c23e['id']]);var _0x15a997=filterAgentAttributes(_0x5ef1e5);_['merge'](_0x29c23e,_0x15a997);_0x29c23e['globalStatus']=getAgentStatus(_0x29c23e);return _0x29c23e;});})['then'](function(_0x163ef7){var _0x393f6b=sortAgentsByStatus(_0x163ef7,_0x223f7a);return _[_0xbe14('0x25')](_0x393f6b,'id');})[_0xbe14('0x1d')](function(_0x172e79){throw _0x172e79;});}exports[_0xbe14('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xcdc50){var _0x10ec3c={'fields':[],'order':null};var _0x2d9c12=_0xcdc50[_0xbe14('0x33')](',');_0x10ec3c[_0xbe14('0x34')]=_[_0xbe14('0x2c')](_0x2d9c12,function(_0x539c41){if(!_0x539c41['includes'](_0xbe14('0x35'))){return!![];}_0x10ec3c[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x539c41,'-')?'DESC':_0xbe14('0x38');return![];});return _0x10ec3c;}exports[_0xbe14('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0xeda70e){if(!_0xeda70e){_0xeda70e=_0xbe14('0x3a');}if(_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3b'))&&!_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3c'))){var _0x1b2608=_0xeda70e['substring'](0x0,_0xeda70e[_0xbe14('0x3d')](_0xbe14('0x3b')));_0xeda70e+=','+_0x1b2608+_0xbe14('0x3c');}return _0xeda70e;}exports[_0xbe14('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x3287b9,_0x2dd3e3){var _0x548d17=_0x3287b9[_0xbe14('0x3f')](function(_0x1974a4,_0x1220c9){if(_0x1974a4[_0xbe14('0x35')]===_0x1220c9['globalStatus']){if(_0x1974a4['globalStatus']===_0xbe14('0x10')){if(_0x2dd3e3===_0xbe14('0x40')){return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9['pauseType']||'')||_0x1974a4['fullname'][_0xbe14('0x42')]()>_0x1220c9['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9[_0xbe14('0x41')]||'')||_0x1974a4[_0xbe14('0x3b')]['toLowerCase']()>_0x1220c9['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2dd3e3===_0xbe14('0x40')){return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9['fullname'][_0xbe14('0x42')]()?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9[_0xbe14('0x3b')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2dd3e3==='DESC'){return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?-0x1:0x1;}}});return _0x548d17;}exports[_0xbe14('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x4f2d95){var _0x51023a=[_0xbe14('0x44'),_0xbe14('0x45'),_0xbe14('0x46'),_0xbe14('0x47'),'pauseType',_0xbe14('0x47'),_0xbe14('0x3c'),'address',_0xbe14('0x4'),_0xbe14('0x7'),_0xbe14('0x6'),_0xbe14('0x8'),'whatsappPause','faxPause',_0xbe14('0x9'),_0xbe14('0x48'),'openchannelCapacity','mailCapacity',_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4b'),_0xbe14('0x4c'),_0xbe14('0x4d'),_0xbe14('0x4e'),_0xbe14('0x4f'),'whatsappCurrentCapacity',_0xbe14('0x50'),_0xbe14('0x12'),_0xbe14('0x15'),_0xbe14('0x14'),_0xbe14('0x16'),'whatsappStatus',_0xbe14('0x13'),_0xbe14('0xe'),_0xbe14('0x51'),_0xbe14('0x52'),_0xbe14('0x53'),_0xbe14('0x54'),'whatsappStatusTime','faxStatusTime',_0xbe14('0x55'),_0xbe14('0x56'),_0xbe14('0x57'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xbe14('0x58'),_0xbe14('0x59')];var _0x50d78f=[_0xbe14('0x4'),_0xbe14('0x7'),'mailPause',_0xbe14('0x8'),'whatsappPause',_0xbe14('0x5'),_0xbe14('0x9'),_0xbe14('0x45')];var _0x550291=_(_0x4f2d95)[_0xbe14('0x5a')](_0x50d78f)[_0xbe14('0x5b')](_0x51023a)['value']();return _0x550291;}exports[_0xbe14('0x5c')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xbe14('0x31'),_0xbe14('0x3b'),_0xbe14('0x5d'),_0xbe14('0x3c'),'online',_0xbe14('0x35'),_0xbe14('0x44'),_0xbe14('0x46'),_0xbe14('0x41'),_0xbe14('0x47'),_0xbe14('0x5'),_0xbe14('0x4'),'mailPause',_0xbe14('0x7'),_0xbe14('0x8'),_0xbe14('0x9'),_0xbe14('0xa'),_0xbe14('0x12'),_0xbe14('0x13'),_0xbe14('0x14'),_0xbe14('0x15'),_0xbe14('0x16'),_0xbe14('0xe'),_0xbe14('0x5e'),'chatStatusTime','faxStatusTime','mailStatusTime',_0xbe14('0x52'),_0xbe14('0x54'),_0xbe14('0x55'),_0xbe14('0x5f'),_0xbe14('0x48'),_0xbe14('0x4b'),_0xbe14('0x60'),_0xbe14('0x61'),_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4c'),_0xbe14('0x50'),_0xbe14('0x4e'),_0xbe14('0x4d'),_0xbe14('0x4f'),_0xbe14('0x62'),_0xbe14('0x63'),_0xbe14('0x58'),_0xbe14('0x57'),_0xbe14('0x64'),'queue',_0xbe14('0x59'),_0xbe14('0x65')];}exports[_0xbe14('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 74a97df..c85a0d6 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 _0x2a22=['loggedIn','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','format','result','catch','getRealtimeQueues','inbound','concat','outbound','paused','find','merge','pick','initializeQueues','util','client','available'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2a22,0x14d));var _0x22a2=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x2a22[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require(_0x22a2('0x0'));var amiClient=jayson[_0x22a2('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0x22a2('0x1')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x22a2('0x2'),_0x22a2('0x3'),'paused',_0x22a2('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0x22a2('0x5'),_0x22a2('0x6'),_0x22a2('0x7'),_0x22a2('0x8'),_0x22a2('0x9'),_0x22a2('0xa'),_0x22a2('0xb'),_0x22a2('0xc'),_0x22a2('0xd'),_0x22a2('0xe'),_0x22a2('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x22a2('0x10'),_0x22a2('0x11'),'message',_0x22a2('0x12'),_0x22a2('0x13'),_0x22a2('0x14'),_0x22a2('0x15'),'startPredictive','startProgressive',_0x22a2('0x16'),'erlangCallToSecond',_0x22a2('0x17'),_0x22a2('0x18'),_0x22a2('0x19'),_0x22a2('0x1a'),'dialPredictiveIntervalMinThreshold',_0x22a2('0x1b'),_0x22a2('0x1c'),_0x22a2('0x1d'),_0x22a2('0x1e'),'predictiveIntervalDroppedCallsCallersExit',_0x22a2('0x1f'),_0x22a2('0x20')];function getRealtimeQueues(_0x5f1bc2,_0x382b49){var _0x1d3a2d=_0x382b49===_0x22a2('0x21')?amiClient:routingClient;return _0x1d3a2d['request'](_[_0x22a2('0x22')](_0x382b49)+'Queues',_0x5f1bc2)[_0x22a2('0x23')](function(_0x2e2dd6){if(_0x2e2dd6['error'])throw new Error(util[_0x22a2('0x24')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x382b49));return _0x2e2dd6[_0x22a2('0x25')];})[_0x22a2('0x26')](function(_0xaef275){throw _0xaef275;});}exports[_0x22a2('0x27')]=getRealtimeQueues;function initializeQueues(_0x58cbf5,_0x23044d,_0x2e6d16,_0x2c251d){var _0x5eb103=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2e6d16===_0x22a2('0x21')){if(_0x2c251d===_0x22a2('0x28')){_0x5eb103=_0x5eb103[_0x22a2('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2c251d===_0x22a2('0x2a')){_0x5eb103=_0x5eb103[_0x22a2('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x58cbf5['map'](function(_0x36efcf){var _0x759478=_0x36efcf['get']({'plain':!![]});_0x759478[_0x22a2('0x2b')]=0x0;_0x759478['loggedInDb']=0x0;_0x759478[_0x22a2('0x3')]=0x0;_0x759478[_0x22a2('0x2')]=0x0;_0x759478[_0x22a2('0x4')]=0x0;if(_0x2e6d16==='voice'){_0x759478[_0x22a2('0xd')]=0x0;_0x759478[_0x22a2('0x5')]=0x0;if(_0x2c251d==='outbound'){_0x759478[_0x22a2('0x10')]=0x0;_0x759478[_0x22a2('0x11')]=0x0;}}var _0x337d16=_[_0x22a2('0x2c')](_0x23044d,['id',_0x759478['id']]);if(_0x337d16){_[_0x22a2('0x2d')](_0x759478,_[_0x22a2('0x2e')](_0x337d16,_0x5eb103));}return _0x759478;});}exports[_0x22a2('0x2f')]=initializeQueues; \ No newline at end of file +var _0x0bd2=['available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','voice','request','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','loggedIn','originated','find','merge','pick','initializeQueues','lodash','jayson/promise','client','http'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0x0bd2,0x1be));var _0x20bd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x0bd2[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x20bd('0x0'));var jayson=require(_0x20bd('0x1'));var util=require('util');var amiClient=jayson[_0x20bd('0x2')][_0x20bd('0x3')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x20bd('0x4'),'loggedIn',_0x20bd('0x5'),_0x20bd('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x20bd('0x7'),_0x20bd('0x8'),_0x20bd('0x9'),_0x20bd('0xa'),_0x20bd('0xb'),_0x20bd('0xc'),_0x20bd('0xd'),_0x20bd('0xe'),_0x20bd('0xf'),_0x20bd('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x20bd('0x11'),'originated',_0x20bd('0x12'),_0x20bd('0x13'),_0x20bd('0x14'),'dialMethod',_0x20bd('0x15'),_0x20bd('0x16'),_0x20bd('0x17'),_0x20bd('0x18'),_0x20bd('0x19'),_0x20bd('0x1a'),_0x20bd('0x1b'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x20bd('0x1c'),_0x20bd('0x1d'),'predictiveIntervalTotalCalls',_0x20bd('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x20bd('0x1f'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0xa4befa,_0x5f2b31){var _0x1ea89b=_0x5f2b31===_0x20bd('0x20')?amiClient:routingClient;return _0x1ea89b[_0x20bd('0x21')](_['startCase'](_0x5f2b31)+_0x20bd('0x22'),_0xa4befa)['then'](function(_0x27ac5f){if(_0x27ac5f[_0x20bd('0x23')])throw new Error(util[_0x20bd('0x24')](_0x20bd('0x25'),_0x5f2b31));return _0x27ac5f[_0x20bd('0x26')];})['catch'](function(_0x2a0e03){throw _0x2a0e03;});}exports[_0x20bd('0x27')]=getRealtimeQueues;function initializeQueues(_0x20a994,_0x39a4fe,_0x95efa1,_0x89eaf9){var _0x64dac3=DEFAULT_QUEUE_ATTRIBUTES;if(_0x95efa1===_0x20bd('0x20')){if(_0x89eaf9===_0x20bd('0x28')){_0x64dac3=_0x64dac3[_0x20bd('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x89eaf9===_0x20bd('0x2a')){_0x64dac3=_0x64dac3[_0x20bd('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x20a994[_0x20bd('0x2b')](function(_0x21e891){var _0x57e7f2=_0x21e891['get']({'plain':!![]});_0x57e7f2[_0x20bd('0x5')]=0x0;_0x57e7f2[_0x20bd('0xa')]=0x0;_0x57e7f2[_0x20bd('0x2c')]=0x0;_0x57e7f2[_0x20bd('0x4')]=0x0;_0x57e7f2['waiting']=0x0;if(_0x95efa1===_0x20bd('0x20')){_0x57e7f2[_0x20bd('0xf')]=0x0;_0x57e7f2[_0x20bd('0x7')]=0x0;if(_0x89eaf9===_0x20bd('0x2a')){_0x57e7f2[_0x20bd('0x11')]=0x0;_0x57e7f2[_0x20bd('0x2d')]=0x0;}}var _0x14421b=_[_0x20bd('0x2e')](_0x39a4fe,['id',_0x57e7f2['id']]);if(_0x14421b){_[_0x20bd('0x2f')](_0x57e7f2,_[_0x20bd('0x30')](_0x14421b,_0x64dac3));}return _0x57e7f2;});}exports[_0x20bd('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index dfc6a22..c78a48b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x138293,_0x197e7f){var _0x34c4a2=function(_0x20192b){while(--_0x20192b){_0x138293['push'](_0x138293['shift']());}};_0x34c4a2(++_0x197e7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +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(_0x4e728b,_0x5c4c41){var _0x58ac99=function(_0x375fb0){while(--_0x375fb0){_0x4e728b['push'](_0x4e728b['shift']());}};_0x58ac99(++_0x5c4c41);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 588c8eb..e6f05e9 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 _0x29c1=['bimedia-machine-uuid','child_process','../environment','orderBy','keys','length','filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','update','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5','digest','hex','substring','lodash','crypto'];(function(_0x2305d6,_0x2ff6ab){var _0x51e41d=function(_0x50ea57){while(--_0x50ea57){_0x2305d6['push'](_0x2305d6['shift']());}};_0x51e41d(++_0x2ff6ab);}(_0x29c1,0x18a));var _0x129c=function(_0x34afd9,_0x4b379d){_0x34afd9=_0x34afd9-0x0;var _0x5394c8=_0x29c1[_0x34afd9];return _0x5394c8;};'use strict';var _=require(_0x129c('0x0'));var os=require('os');var crypto=require(_0x129c('0x1'));var machine=require(_0x129c('0x2'));var exec=require(_0x129c('0x3'))['execSync'];var config=require(_0x129c('0x4'));function getInterfaces(){var _0x5e995a=[];var _0x5b178d=os['networkInterfaces']();var _0x41cf8f=_[_0x129c('0x5')](_[_0x129c('0x6')](_0x5b178d));for(var _0x1cbe25=0x0;_0x1cbe25<_0x41cf8f[_0x129c('0x7')];_0x1cbe25++){var _0x5071c6=_0x5b178d[_0x41cf8f[_0x1cbe25]][_0x129c('0x8')](function(_0x5355b1){return _0x5355b1['family']===_0x129c('0x9')&&_0x5355b1[_0x129c('0xa')]===![];});_0x5e995a=_0x5e995a[_0x129c('0xb')](_0x5071c6);}return _0x5e995a;}function getFirstInterface(){var _0x2e84df=_['head'](getInterfaces());return{'macAddress':_0x2e84df&&_0x2e84df[_0x129c('0xc')]?_0x2e84df[_0x129c('0xc')]:_0x129c('0xd'),'ipAddress':_0x2e84df&&_0x2e84df[_0x129c('0xe')]?_0x2e84df[_0x129c('0xe')]:_0x129c('0xf')};}exports[_0x129c('0x10')]=getFirstInterface;function getCPUhash(){var _0xe4b94a=_[_0x129c('0x5')](os[_0x129c('0x11')]()[_0x129c('0x12')](function(_0xba37bb){return _0xba37bb[_0x129c('0x13')];}))[_0x129c('0x14')](':');return crypto['createHash']('md5')[_0x129c('0x15')](_0xe4b94a)['digest']('hex');}exports['getUuid']=function(){var _0x3ec546=os[_0x129c('0x16')]();var _0x29ec94=/[0-9a-f-]{36}/;if(config[_0x129c('0x17')]&&_0x29ec94[_0x129c('0x18')](config['licenseToken'])){return config['licenseToken'];}else if(_0x3ec546==='win32'){return exec(_0x129c('0x19'),{'encoding':_0x129c('0x1a')})[_0x129c('0x1b')]('\x0d\x0a','');}else{var _0x401f7b=getFirstInterface();var _0x46656a=getCPUhash();var _0x2c62a6=_0x46656a+'|'+os[_0x129c('0x1c')]()+'|'+_0x401f7b[_0x129c('0x1d')]+'|'+_0x401f7b[_0x129c('0x1e')];var _0x5f5168=crypto[_0x129c('0x1f')](_0x129c('0x20'))[_0x129c('0x15')](_0x2c62a6)[_0x129c('0x21')](_0x129c('0x22'));return _0x5f5168['substring'](0x0,0x8)+'-'+_0x5f5168['substring'](0x8,0xc)+'-'+_0x5f5168[_0x129c('0x23')](0xc,0x10)+'-'+_0x5f5168[_0x129c('0x23')](0x10,0x14)+'-'+_0x5f5168[_0x129c('0x23')](0x14);}}; \ No newline at end of file +var _0x25bf=['lodash','crypto','bimedia-machine-uuid','networkInterfaces','orderBy','keys','length','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','md5','update','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','createHash','digest','hex','substring'];(function(_0x2264a1,_0x1a38b7){var _0x14de54=function(_0x1f5036){while(--_0x1f5036){_0x2264a1['push'](_0x2264a1['shift']());}};_0x14de54(++_0x1a38b7);}(_0x25bf,0x96));var _0xf25b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x25bf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf25b('0x0'));var os=require('os');var crypto=require(_0xf25b('0x1'));var machine=require(_0xf25b('0x2'));var exec=require('child_process')['execSync'];var config=require('../environment');function getInterfaces(){var _0x35d653=[];var _0x325d10=os[_0xf25b('0x3')]();var _0x94a6ee=_[_0xf25b('0x4')](_[_0xf25b('0x5')](_0x325d10));for(var _0x547fd5=0x0;_0x547fd5<_0x94a6ee[_0xf25b('0x6')];_0x547fd5++){var _0x254177=_0x325d10[_0x94a6ee[_0x547fd5]]['filter'](function(_0x18f8c0){return _0x18f8c0['family']===_0xf25b('0x7')&&_0x18f8c0[_0xf25b('0x8')]===![];});_0x35d653=_0x35d653[_0xf25b('0x9')](_0x254177);}return _0x35d653;}function getFirstInterface(){var _0x41862d=_[_0xf25b('0xa')](getInterfaces());return{'macAddress':_0x41862d&&_0x41862d['mac']?_0x41862d['mac']:_0xf25b('0xb'),'ipAddress':_0x41862d&&_0x41862d[_0xf25b('0xc')]?_0x41862d['address']:_0xf25b('0xd')};}exports[_0xf25b('0xe')]=getFirstInterface;function getCPUhash(){var _0x27091c=_[_0xf25b('0x4')](os['cpus']()['map'](function(_0x283508){return _0x283508[_0xf25b('0xf')];}))['join'](':');return crypto['createHash'](_0xf25b('0x10'))[_0xf25b('0x11')](_0x27091c)['digest']('hex');}exports['getUuid']=function(){var _0x28e975=os[_0xf25b('0x12')]();var _0xfe8cf9=/[0-9a-f-]{36}/;if(config[_0xf25b('0x13')]&&_0xfe8cf9[_0xf25b('0x14')](config['licenseToken'])){return config[_0xf25b('0x13')];}else if(_0x28e975===_0xf25b('0x15')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf25b('0x16')})[_0xf25b('0x17')]('\x0d\x0a','');}else{var _0x5d392c=getFirstInterface();var _0xc22e11=getCPUhash();var _0x1954f0=_0xc22e11+'|'+os[_0xf25b('0x18')]()+'|'+_0x5d392c['macAddress']+'|'+_0x5d392c[_0xf25b('0x19')];var _0x65e167=crypto[_0xf25b('0x1a')](_0xf25b('0x10'))['update'](_0x1954f0)[_0xf25b('0x1b')](_0xf25b('0x1c'));return _0x65e167['substring'](0x0,0x8)+'-'+_0x65e167[_0xf25b('0x1d')](0x8,0xc)+'-'+_0x65e167[_0xf25b('0x1d')](0xc,0x10)+'-'+_0x65e167['substring'](0x10,0x14)+'-'+_0x65e167[_0xf25b('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index eddfa56..943c17a 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 _0x4005=['message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','pkginfo','version','../../mysqldb','../../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','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s'];(function(_0x30b4b2,_0x55b8cb){var _0x460f9a=function(_0x24b32){while(--_0x24b32){_0x30b4b2['push'](_0x30b4b2['shift']());}};_0x460f9a(++_0x55b8cb);}(_0x4005,0x13d));var _0x5400=function(_0x27d988,_0xa3aea4){_0x27d988=_0x27d988-0x0;var _0x53e24e=_0x4005[_0x27d988];return _0x53e24e;};'use strict';var util=require(_0x5400('0x0'));var moment=require('moment');var rp=require(_0x5400('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x5400('0x2'))(module,_0x5400('0x3'));var db=require(_0x5400('0x4'))['db'];var encryptor=require(_0x5400('0x5'));var hardware=require(_0x5400('0x6'));var logger=require(_0x5400('0x7'))(_0x5400('0x8'));var HOST=_0x5400('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x31870a){return new BPromise(function(_0x439ffe,_0x3b0441){var _0xa623f3=util[_0x5400('0xa')](_0x5400('0xb'),HOST,_0x31870a,module[_0x5400('0xc')][_0x5400('0x3')]);if(oldToken){_0xa623f3=util[_0x5400('0xa')](_0x5400('0xd'),HOST,_0x31870a,module['exports'][_0x5400('0x3')],oldToken);}var _0xede83c={'uri':_0xa623f3,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xede83c)[_0x5400('0xe')](function(_0x292416){_0x439ffe(_0x292416);})[_0x5400('0xf')](function(_0x5de324){_0x3b0441(_0x5de324);});});}function manageLicense(_0x5d6d05,_0x4aaeaf){var _0x532235=_0x4aaeaf[_0x5400('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x532235[_0x5400('0x11')]!==_0x5d6d05&&!_0x532235[_0x5400('0x12')]){oldToken=_0x532235[_0x5400('0x11')];}httpRequest(_0x5d6d05)[_0x5400('0xe')](function(_0x421beb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x421beb[_0x5400('0x13')]){isOldTokenSent=![];if(!_0x532235[_0x5400('0x8')]&&_0x532235[_0x5400('0x8')]!=_0x421beb[_0x5400('0x8')]||_0x532235[_0x5400('0x8')]&&_0x532235['data2']){logger[_0x5400('0x14')](_0x5400('0x15'));}if(_0x532235['license']&&!_0x532235['data2']&&_0x532235['license']!=_0x421beb[_0x5400('0x8')]){logger[_0x5400('0x14')](_0x5400('0x16'));}if(_0x532235[_0x5400('0x8')]&&!_0x532235[_0x5400('0x12')]&&_0x532235['license']==_0x421beb[_0x5400('0x8')]){return _0x4aaeaf;}return _0x4aaeaf[_0x5400('0x17')]({'data1':_0x5d6d05,'data2':null,'license':_0x421beb[_0x5400('0x8')]});}else{if(_0x421beb[_0x5400('0x8')]||_0x532235['license']){if(!_0x532235[_0x5400('0x12')]){if(_0x532235['data1']==_0x5d6d05){GRAY_PERIOD_REASON=_0x5400('0x18');logger[_0x5400('0x14')](_0x5400('0x19'));}else{GRAY_PERIOD_REASON=_0x5400('0x1a');logger['info'](_0x5400('0x1b'),_0x532235[_0x5400('0x11')],_0x5d6d05);}logger[_0x5400('0x14')](_0x5400('0x1c'),GRAY_PERIOD_REASON[_0x5400('0x1d')](),moment()[_0x5400('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x4aaeaf[_0x5400('0x17')]({'data2':encryptor[_0x5400('0x1e')](moment()[_0x5400('0xa')](_0x5400('0x1f')))});}else{if(moment()[_0x5400('0x20')](encryptor[_0x5400('0x21')](_0x532235[_0x5400('0x12')]),'days')>DAYS){logger[_0x5400('0x14')](_0x5400('0x22'),moment()['format'](_0x5400('0x1f')));isOldTokenSent=![];return _0x4aaeaf[_0x5400('0x17')]({'data1':_0x5d6d05,'data2':null,'license':null});}}}else{if(_0x532235['data1']!=_0x5d6d05){logger[_0x5400('0x14')](_0x5400('0x1b'),_0x532235[_0x5400('0x11')],_0x5d6d05);return _0x4aaeaf[_0x5400('0x17')]({'data1':_0x5d6d05,'data2':null,'license':null});}}}return _0x4aaeaf;})[_0x5400('0xe')](function(_0x55ae6e){_0x4aaeaf=_0x55ae6e;})[_0x5400('0xf')](function(_0x2ee5dc){logger['error'](_0x2ee5dc[_0x5400('0x23')]);})[_0x5400('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x5400('0x25')](),_0x4aaeaf);},TIME);});}function defaultLicense(){var _0x319c34=hardware[_0x5400('0x25')]();if(_0x319c34){return db[_0x5400('0x26')][_0x5400('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x319c34}})[_0x5400('0x28')](function(_0x460886,_0x4330d3){logger[_0x5400('0x14')](_0x5400('0x29'),_0x319c34);manageLicense(_0x319c34,_0x460886);})[_0x5400('0xf')](function(_0x4cbd37){logger[_0x5400('0x2a')](_0x4cbd37[_0x5400('0x23')]);});}}exports[_0x5400('0x2b')]=defaultLicense; \ No newline at end of file +var _0xa1d7=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x1a5ab5,_0x112fa1){var _0x26010e=function(_0x39a886){while(--_0x39a886){_0x1a5ab5['push'](_0x1a5ab5['shift']());}};_0x26010e(++_0x112fa1);}(_0xa1d7,0x175));var _0x7a1d=function(_0x4af3b7,_0x30c116){_0x4af3b7=_0x4af3b7-0x0;var _0x24727c=_0xa1d7[_0x4af3b7];return _0x24727c;};'use strict';var util=require(_0x7a1d('0x0'));var moment=require(_0x7a1d('0x1'));var rp=require(_0x7a1d('0x2'));var BPromise=require(_0x7a1d('0x3'));var pkginfo=require(_0x7a1d('0x4'))(module,_0x7a1d('0x5'));var db=require(_0x7a1d('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x7a1d('0x7'));var logger=require(_0x7a1d('0x8'))('license');var HOST=_0x7a1d('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x49a382){return new BPromise(function(_0x44f36f,_0x33b1a6){var _0x15ae2b=util['format'](_0x7a1d('0xa'),HOST,_0x49a382,module[_0x7a1d('0xb')]['version']);if(oldToken){_0x15ae2b=util[_0x7a1d('0xc')](_0x7a1d('0xd'),HOST,_0x49a382,module[_0x7a1d('0xb')][_0x7a1d('0x5')],oldToken);}var _0x50f1f6={'uri':_0x15ae2b,'method':_0x7a1d('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x50f1f6)[_0x7a1d('0xf')](function(_0x19f6a8){_0x44f36f(_0x19f6a8);})[_0x7a1d('0x10')](function(_0x587e43){_0x33b1a6(_0x587e43);});});}function manageLicense(_0x312eb7,_0x1eb81d){var _0x1fed66=_0x1eb81d['get']({'plain':!![]});if(!isOldTokenSent&&_0x1fed66[_0x7a1d('0x11')]!==_0x312eb7&&!_0x1fed66[_0x7a1d('0x12')]){oldToken=_0x1fed66[_0x7a1d('0x11')];}httpRequest(_0x312eb7)[_0x7a1d('0xf')](function(_0x557fea){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x557fea[_0x7a1d('0x13')]){isOldTokenSent=![];if(!_0x1fed66['license']&&_0x1fed66[_0x7a1d('0x14')]!=_0x557fea[_0x7a1d('0x14')]||_0x1fed66[_0x7a1d('0x14')]&&_0x1fed66['data2']){logger['info'](_0x7a1d('0x15'));}if(_0x1fed66[_0x7a1d('0x14')]&&!_0x1fed66[_0x7a1d('0x12')]&&_0x1fed66['license']!=_0x557fea[_0x7a1d('0x14')]){logger[_0x7a1d('0x16')](_0x7a1d('0x17'));}if(_0x1fed66[_0x7a1d('0x14')]&&!_0x1fed66['data2']&&_0x1fed66['license']==_0x557fea[_0x7a1d('0x14')]){return _0x1eb81d;}return _0x1eb81d[_0x7a1d('0x18')]({'data1':_0x312eb7,'data2':null,'license':_0x557fea[_0x7a1d('0x14')]});}else{if(_0x557fea[_0x7a1d('0x14')]||_0x1fed66['license']){if(!_0x1fed66[_0x7a1d('0x12')]){if(_0x1fed66[_0x7a1d('0x11')]==_0x312eb7){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x7a1d('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x7a1d('0x16')](_0x7a1d('0x1a'),_0x1fed66[_0x7a1d('0x11')],_0x312eb7);}logger[_0x7a1d('0x16')](_0x7a1d('0x1b'),GRAY_PERIOD_REASON[_0x7a1d('0x1c')](),moment()['format'](_0x7a1d('0x1d')));return _0x1eb81d['update']({'data2':encryptor['encryptString'](moment()['format'](_0x7a1d('0x1d')))});}else{if(moment()[_0x7a1d('0x1e')](encryptor['decryptString'](_0x1fed66[_0x7a1d('0x12')]),_0x7a1d('0x1f'))>DAYS){logger['info'](_0x7a1d('0x20'),moment()['format'](_0x7a1d('0x1d')));isOldTokenSent=![];return _0x1eb81d[_0x7a1d('0x18')]({'data1':_0x312eb7,'data2':null,'license':null});}}}else{if(_0x1fed66[_0x7a1d('0x11')]!=_0x312eb7){logger[_0x7a1d('0x16')](_0x7a1d('0x1a'),_0x1fed66['data1'],_0x312eb7);return _0x1eb81d[_0x7a1d('0x18')]({'data1':_0x312eb7,'data2':null,'license':null});}}}return _0x1eb81d;})[_0x7a1d('0xf')](function(_0x3bfda7){_0x1eb81d=_0x3bfda7;})[_0x7a1d('0x10')](function(_0x10a4f8){logger[_0x7a1d('0x21')](_0x10a4f8[_0x7a1d('0x22')]);})[_0x7a1d('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x7a1d('0x24')](),_0x1eb81d);},TIME);});}function defaultLicense(){var _0x2d25d5=hardware[_0x7a1d('0x24')]();if(_0x2d25d5){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2d25d5}})[_0x7a1d('0x25')](function(_0x29034e,_0x4d7efb){logger[_0x7a1d('0x16')](_0x7a1d('0x26'),_0x2d25d5);manageLicense(_0x2d25d5,_0x29034e);})[_0x7a1d('0x10')](function(_0x22f75e){logger[_0x7a1d('0x21')](_0x22f75e['message']);});}}exports[_0x7a1d('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7f04095..dab1699 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 _0x931b=['admin','user','telephone','telephones','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','format','parse','demo','machineUuid','decryptString','deadline','add','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count'];(function(_0x323c08,_0x44244c){var _0x4cdf67=function(_0x4cf833){while(--_0x4cf833){_0x323c08['push'](_0x323c08['shift']());}};_0x4cdf67(++_0x44244c);}(_0x931b,0x91));var _0xb931=function(_0x4588d1,_0xff4115){_0x4588d1=_0x4588d1-0x0;var _0x261093=_0x931b[_0x4588d1];return _0x261093;};'use strict';var util=require(_0xb931('0x0'));var _=require(_0xb931('0x1'));var moment=require(_0xb931('0x2'));var BPromise=require(_0xb931('0x3'));var hardware=require(_0xb931('0x4'));var encryptor=require(_0xb931('0x5'));var db=require(_0xb931('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb931('0x7'),'machineUuid':hardware[_0xb931('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb931('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb931('0xa'),'machineUuid':hardware[_0xb931('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1bc934){return new BPromise(function(_0x189e82,_0x326a57){return db[_0xb931('0xb')]['find'](_[_0xb931('0xc')](_0x1bc934,{'raw':!![],'where':{'id':0x1}}))[_0xb931('0xd')](function(_0x1a2fd4){return checkLicense(_0x1a2fd4,null);})['then'](function(_0x4a0c59){_0x189e82(_0x4a0c59);return;})[_0xb931('0xe')](function(_0x249564){_0x326a57(_0x249564);});});}function checkLicense(_0x191d86,_0xa3a9ce){if(!_0x191d86){demoLicense[_0xb931('0xf')]=_0x191d86[_0xb931('0x10')];return demoLicense;}try{var _0x557176=_0xa3a9ce||_0x191d86[_0xb931('0x11')];if(_[_0xb931('0x12')](_0x557176)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x130e7b=_0x191d86[_0xb931('0x10')];var _0x1e533b=_0x191d86[_0xb931('0x13')];var _0x16285a=_0x130e7b['split']('-')[0x4];var _0x2eaf45=_0x130e7b[_0xb931('0x14')]('-')[0x0];var _0x1307fa=encryptor['decryptString'](_0x557176,util[_0xb931('0x15')]('%s:%s:%s',_0x16285a,_0x130e7b,_0x2eaf45));var _0x124961=JSON[_0xb931('0x16')](_0x1307fa);_0x124961[_0xb931('0x17')]=![];_0x124961['uuid']=_0x130e7b;_0x124961[_0xb931('0x18')]=hardware[_0xb931('0x8')]();if(_0x1e533b){var _0x1c3646=encryptor[_0xb931('0x19')](_0x1e533b);_0x124961['gray']=_0x1c3646;_0x124961[_0xb931('0x1a')]=moment(_0x1c3646)[_0xb931('0x1b')](0x7,'days')[_0xb931('0x15')]();_0x124961[_0xb931('0x1c')]=_0x124961[_0xb931('0xf')]!=_0x124961[_0xb931('0x18')]?_0xb931('0x1d'):_0xb931('0x1e');}return _0x124961;}catch(_0x339ae8){breakingLicense[_0xb931('0xf')]=_0x191d86['data1'];breakingLicense[_0xb931('0x1f')]=_0x339ae8[_0xb931('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x205330,_0x5cdb40){getLicense()[_0xb931('0xd')](function(_0xd9ee54){return db[_0xb931('0x20')][_0xb931('0x21')]({'attributes':[_0xb931('0x22'),[db[_0xb931('0x23')]['fn'](_0xb931('0x24'),db[_0xb931('0x23')][_0xb931('0x25')](_0xb931('0x22'))),_0xb931('0x26')]],'group':_0xb931('0x22'),'where':{'role':{'$or':[_0xb931('0x27'),_0xb931('0x28'),_0xb931('0x29')]}},'raw':!![]})[_0xb931('0xd')](function(_0x195d5e){var _0x1f3e09={'user':_0xd9ee54['users']||0x0,'telephone':_0xd9ee54[_0xb931('0x2a')]||0x0};_0x195d5e['forEach'](function(_0x524a34){var _0xa6cf94=_0x524a34['role']===_0xb931('0x27')?'user':_0x524a34['role'];_0x1f3e09[_0xa6cf94]-=_0x524a34[_0xb931('0x26')];if(_0x1f3e09[_0xa6cf94]<0x0)_0x1f3e09[_0xa6cf94]=0x0;});_0x205330(_0x1f3e09);return;});})[_0xb931('0xe')](function(_0x25fd3e){_0x5cdb40(_0x25fd3e);});});}function checkUserLimits(_0x3f9846){return new BPromise(function(_0x2ddb90,_0x1f0ca9){getLimits()[_0xb931('0xd')](function(_0x161395){var _0x319d37=_['pick'](_[_0xb931('0x2b')](_0x3f9846,_0xb931('0x22')),[_0xb931('0x27'),_0xb931('0x28'),_0xb931('0x29')]);var _0x2f42b2=(_0x319d37[_0xb931('0x27')]||0x0)+(_0x319d37[_0xb931('0x28')]||0x0);var _0x5a8aa4=_0x319d37['telephone']||0x0;if(_0x2f42b2>_0x161395[_0xb931('0x28')])return _0x1f0ca9(_0xb931('0x2c'));if(_0x5a8aa4>_0x161395[_0xb931('0x29')])return _0x1f0ca9('License\x20limit\x20reached\x20for\x20telephones');return _0x2ddb90();})[_0xb931('0xe')](function(_0x504c9a){_0x1f0ca9(_0x504c9a);});});}module[_0xb931('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4546=['deadline','add','days','grayReason','disabled','message','User','role','sequelize','COUNT','user','telephone','users','telephones','forEach','admin','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','defaults','then','catch','uuid','license','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray'];(function(_0x430d00,_0x46485c){var _0x37774b=function(_0x3cce86){while(--_0x3cce86){_0x430d00['push'](_0x430d00['shift']());}};_0x37774b(++_0x46485c);}(_0x4546,0xed));var _0x6454=function(_0x4d175a,_0x2dddab){_0x4d175a=_0x4d175a-0x0;var _0x170cbd=_0x4546[_0x4d175a];return _0x170cbd;};'use strict';var util=require(_0x6454('0x0'));var _=require('lodash');var moment=require(_0x6454('0x1'));var BPromise=require('bluebird');var hardware=require(_0x6454('0x2'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6454('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x6454('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6454('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6454('0x5'),'machineUuid':hardware[_0x6454('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x177bb8){return new BPromise(function(_0x49de66,_0x970176){return db['License']['find'](_[_0x6454('0x6')](_0x177bb8,{'raw':!![],'where':{'id':0x1}}))[_0x6454('0x7')](function(_0x3c3c58){return checkLicense(_0x3c3c58,null);})[_0x6454('0x7')](function(_0x3d01d8){_0x49de66(_0x3d01d8);return;})[_0x6454('0x8')](function(_0x487d53){_0x970176(_0x487d53);});});}function checkLicense(_0x163d84,_0x33a844){if(!_0x163d84){demoLicense[_0x6454('0x9')]=_0x163d84['data1'];return demoLicense;}try{var _0x2ead5c=_0x33a844||_0x163d84[_0x6454('0xa')];if(_['isEmpty'](_0x2ead5c)){throw new Error(_0x6454('0xb'));}var _0x57c30f=_0x163d84[_0x6454('0xc')];var _0x597ad1=_0x163d84[_0x6454('0xd')];var _0x229db1=_0x57c30f[_0x6454('0xe')]('-')[0x4];var _0x37734e=_0x57c30f[_0x6454('0xe')]('-')[0x0];var _0x43dc63=encryptor[_0x6454('0xf')](_0x2ead5c,util[_0x6454('0x10')](_0x6454('0x11'),_0x229db1,_0x57c30f,_0x37734e));var _0x661b48=JSON['parse'](_0x43dc63);_0x661b48[_0x6454('0x12')]=![];_0x661b48[_0x6454('0x9')]=_0x57c30f;_0x661b48[_0x6454('0x13')]=hardware[_0x6454('0x4')]();if(_0x597ad1){var _0x2c1bd0=encryptor[_0x6454('0xf')](_0x597ad1);_0x661b48[_0x6454('0x14')]=_0x2c1bd0;_0x661b48[_0x6454('0x15')]=moment(_0x2c1bd0)[_0x6454('0x16')](0x7,_0x6454('0x17'))['format']();_0x661b48[_0x6454('0x18')]=_0x661b48[_0x6454('0x9')]!=_0x661b48['machineUuid']?'changed':_0x6454('0x19');}return _0x661b48;}catch(_0x902d0a){breakingLicense[_0x6454('0x9')]=_0x163d84[_0x6454('0xc')];breakingLicense[_0x6454('0x1a')]=_0x902d0a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4b4f14,_0x39fe35){getLicense()['then'](function(_0x2fadbe){return db[_0x6454('0x1b')]['findAll']({'attributes':[_0x6454('0x1c'),[db[_0x6454('0x1d')]['fn'](_0x6454('0x1e'),db['sequelize']['col'](_0x6454('0x1c'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0x6454('0x1f'),_0x6454('0x20')]}},'raw':!![]})[_0x6454('0x7')](function(_0x4b8fc6){var _0x178f79={'user':_0x2fadbe[_0x6454('0x21')]||0x0,'telephone':_0x2fadbe[_0x6454('0x22')]||0x0};_0x4b8fc6[_0x6454('0x23')](function(_0x571c28){var _0x93bb71=_0x571c28[_0x6454('0x1c')]===_0x6454('0x24')?_0x6454('0x1f'):_0x571c28[_0x6454('0x1c')];_0x178f79[_0x93bb71]-=_0x571c28[_0x6454('0x25')];if(_0x178f79[_0x93bb71]<0x0)_0x178f79[_0x93bb71]=0x0;});_0x4b4f14(_0x178f79);return;});})[_0x6454('0x8')](function(_0x4f4cf2){_0x39fe35(_0x4f4cf2);});});}function checkUserLimits(_0x502acd){return new BPromise(function(_0x533e99,_0x477a0f){getLimits()[_0x6454('0x7')](function(_0x615f83){var _0x1ff729=_[_0x6454('0x26')](_[_0x6454('0x27')](_0x502acd,_0x6454('0x1c')),['admin','user',_0x6454('0x20')]);var _0x1dd6d1=(_0x1ff729[_0x6454('0x24')]||0x0)+(_0x1ff729[_0x6454('0x1f')]||0x0);var _0x21186b=_0x1ff729[_0x6454('0x20')]||0x0;if(_0x1dd6d1>_0x615f83[_0x6454('0x1f')])return _0x477a0f(_0x6454('0x28'));if(_0x21186b>_0x615f83['telephone'])return _0x477a0f(_0x6454('0x29'));return _0x533e99();})['catch'](function(_0x414f7b){_0x477a0f(_0x414f7b);});});}module[_0x6454('0x2a')]={'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 5251e55..21c271d 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 _0x4888=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x4888,0x198));var _0x8488=function(_0x343e5a,_0x438aa6){_0x343e5a=_0x343e5a-0x0;var _0x37e87f=_0x4888[_0x343e5a];return _0x37e87f;};'use strict';module['exports']={'DOMAIN':_0x8488('0x0'),'SESSION_SECRET':_0x8488('0x1'),'GOOGLE_ID':_0x8488('0x2'),'GOOGLE_SECRET':_0x8488('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xc2c7=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x1561ce,_0x2c9420){var _0x3cb06e=function(_0x3bb475){while(--_0x3bb475){_0x1561ce['push'](_0x1561ce['shift']());}};_0x3cb06e(++_0x2c9420);}(_0xc2c7,0x134));var _0x7c2c=function(_0xbe7422,_0x3e069f){_0xbe7422=_0xbe7422-0x0;var _0x207f1d=_0xc2c7[_0xbe7422];return _0x207f1d;};'use strict';module['exports']={'DOMAIN':_0x7c2c('0x0'),'SESSION_SECRET':_0x7c2c('0x1'),'GOOGLE_ID':_0x7c2c('0x2'),'GOOGLE_SECRET':_0x7c2c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1189220..c8467a4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21df=['../utils/loggers'];(function(_0x45b3d4,_0x3a6a52){var _0x3637a1=function(_0x4f2022){while(--_0x4f2022){_0x45b3d4['push'](_0x45b3d4['shift']());}};_0x3637a1(++_0x3a6a52);}(_0x21df,0x1b7));var _0xf21d=function(_0x29ddb7,_0x15b9b4){_0x29ddb7=_0x29ddb7-0x0;var _0x2a3314=_0x21df[_0x29ddb7];return _0x2a3314;};'use strict';var fileLogger=require(_0xf21d('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0x55d7=['fileLogger'];(function(_0xfa260b,_0xd2d0d){var _0x48fb84=function(_0x111f00){while(--_0x111f00){_0xfa260b['push'](_0xfa260b['shift']());}};_0x48fb84(++_0xd2d0d);}(_0x55d7,0x79));var _0x755d=function(_0x55cf9d,_0x2795b3){_0x55cf9d=_0x55cf9d-0x0;var _0x2fd425=_0x55d7[_0x55cf9d];return _0x2fd425;};'use strict';var fileLogger=require('../utils/loggers')[_0x755d('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8e3fe4e..1b7f20a 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 _0xbcd3=['exports','../../config/environment','resolve','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x202c72,_0x7ed79){var _0x5e485a=function(_0xdf1466){while(--_0xdf1466){_0x202c72['push'](_0x202c72['shift']());}};_0x5e485a(++_0x7ed79);}(_0xbcd3,0x91));var _0x3bcd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbcd3[_0xa464c9];return _0x3d73c4;};'use strict';var path=require('path');var cfg=require(_0x3bcd('0x0'));var env={'NODE_PATH':path[_0x3bcd('0x1')](path['join'](cfg[_0x3bcd('0x2')],_0x3bcd('0x3')))};var pm2config={'apps':[{'name':_0x3bcd('0x4'),'script':path[_0x3bcd('0x5')](__dirname,_0x3bcd('0x6')),'env':env},{'name':_0x3bcd('0x7'),'script':path[_0x3bcd('0x5')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x3bcd('0x5')](__dirname,_0x3bcd('0x8')),'env':env},{'name':_0x3bcd('0x9'),'script':path['join'](__dirname,_0x3bcd('0xa')),'env':env},{'name':_0x3bcd('0xb'),'script':path['join'](__dirname,_0x3bcd('0xc')),'env':env},{'name':_0x3bcd('0xd'),'script':path[_0x3bcd('0x5')](__dirname,_0x3bcd('0xe')),'env':env}]};module[_0x3bcd('0xf')]=pm2config; \ No newline at end of file +var _0xcc22=['../../services/xdr/index.js','../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x490014,_0x519ad6){var _0x289bee=function(_0x44fcc8){while(--_0x44fcc8){_0x490014['push'](_0x490014['shift']());}};_0x289bee(++_0x519ad6);}(_0xcc22,0x13c));var _0x2cc2=function(_0x53dc95,_0x53af0a){_0x53dc95=_0x53dc95-0x0;var _0x4557d8=_0xcc22[_0x53dc95];return _0x4557d8;};'use strict';var path=require('path');var cfg=require(_0x2cc2('0x0'));var env={'NODE_PATH':path[_0x2cc2('0x1')](path[_0x2cc2('0x2')](cfg[_0x2cc2('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x2cc2('0x4'),'script':path['join'](__dirname,_0x2cc2('0x5')),'env':env},{'name':_0x2cc2('0x6'),'script':path[_0x2cc2('0x2')](__dirname,_0x2cc2('0x7')),'env':env},{'name':'agi','script':path[_0x2cc2('0x2')](__dirname,_0x2cc2('0x8')),'env':env},{'name':_0x2cc2('0x9'),'script':path[_0x2cc2('0x2')](__dirname,_0x2cc2('0xa')),'env':env},{'name':_0x2cc2('0xb'),'script':path['join'](__dirname,_0x2cc2('0xc')),'env':env},{'name':_0x2cc2('0xd'),'script':path['join'](__dirname,_0x2cc2('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3ce7392..06db29a 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 _0xc95f=['connect','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','./config'];(function(_0x28c8d3,_0x17735d){var _0x43be35=function(_0x387fa0){while(--_0x387fa0){_0x28c8d3['push'](_0x28c8d3['shift']());}};_0x43be35(++_0x17735d);}(_0xc95f,0x1ea));var _0xfc95=function(_0x3931d7,_0x34c702){_0x3931d7=_0x3931d7-0x0;var _0x2ec3f3=_0xc95f[_0x3931d7];return _0x2ec3f3;};'use strict';var pm2=require(_0xfc95('0x0'));var BPromise=require('bluebird');var config=require(_0xfc95('0x1'));function connect(){return new BPromise(function(_0x3b2b16,_0x33c1c9){return pm2[_0xfc95('0x2')](function(_0x28ade1){if(_0x28ade1){return _0x33c1c9(_0x28ade1);}return _0x3b2b16('connected');});});};exports[_0xfc95('0x3')]=function(_0x4a4b41){return connect()['then'](function(){return new BPromise(function(_0x1e1ff0,_0x59ddba){return pm2['start'](_0x4a4b41,function(_0x10e384,_0x52022e){if(_0x10e384){return _0x59ddba(_0x10e384);}pm2[_0xfc95('0x4')]();return _0x1e1ff0(_0x52022e);});});});};exports[_0xfc95('0x5')]=function(_0x3f4913){return connect()[_0xfc95('0x6')](function(){return new BPromise(function(_0xe2a8d4,_0x4e25c2){return pm2[_0xfc95('0x5')](_0x3f4913,function(_0x1ccc03,_0x43430f){if(_0x1ccc03){return _0x4e25c2(_0x1ccc03);}pm2[_0xfc95('0x4')]();return _0xe2a8d4(_0x43430f);});});});};exports[_0xfc95('0x7')]=function(_0x1d1c42){return connect()[_0xfc95('0x6')](function(){return new BPromise(function(_0x9a5363,_0x223826){return pm2['restart'](_0x1d1c42,function(_0xc3493f,_0x3085f8){if(_0xc3493f){return _0x223826(_0xc3493f);}pm2['disconnect']();return _0x9a5363(_0x3085f8);});});});};exports[_0xfc95('0x8')]=function(){return connect()[_0xfc95('0x6')](function(){return new BPromise(function(_0xbc285e,_0xa573bf){return pm2[_0xfc95('0x8')](function(_0x5eb721,_0x6dc4f3){if(_0x5eb721){return _0xa573bf(_0x5eb721);}pm2[_0xfc95('0x4')]();return _0xbc285e(_0x6dc4f3);});});});};exports[_0xfc95('0x9')]=function(_0x2aba28){return connect()[_0xfc95('0x6')](function(){return new BPromise(function(_0x2508db,_0x2cac2c){return pm2[_0xfc95('0x9')](_0x2aba28,function(_0x442edf,_0x46f995){if(_0x442edf){return _0x2cac2c(_0x442edf);}pm2[_0xfc95('0x4')]();return _0x2508db(_0x46f995);});});});};exports[_0xfc95('0xa')]=function(_0x3306ae){return connect()[_0xfc95('0x6')](function(){return new BPromise(function(_0x223538,_0x2d10d7){return pm2['delete'](_0x3306ae,function(_0x18bd97,_0x829d27){if(_0x18bd97){return _0x2d10d7(_0x18bd97);}pm2[_0xfc95('0x4')]();return _0x223538(_0x829d27);});});});};exports[_0xfc95('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x51ea55,_0xce766f){return pm2[_0xfc95('0xb')](function(_0x2cd287){if(_0x2cd287){return _0xce766f(_0x2cd287);}return _0x51ea55('saved');});});});}; \ No newline at end of file +var _0x29aa=['connect','connected','start','then','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x43379f,_0x1c1ab0){var _0x349957=function(_0x140845){while(--_0x140845){_0x43379f['push'](_0x43379f['shift']());}};_0x349957(++_0x1c1ab0);}(_0x29aa,0xeb));var _0xa29a=function(_0x231c78,_0x1f230a){_0x231c78=_0x231c78-0x0;var _0x1fef38=_0x29aa[_0x231c78];return _0x1fef38;};'use strict';var pm2=require(_0xa29a('0x0'));var BPromise=require(_0xa29a('0x1'));var config=require(_0xa29a('0x2'));function connect(){return new BPromise(function(_0x5c1228,_0x1a2980){return pm2[_0xa29a('0x3')](function(_0x102b4c){if(_0x102b4c){return _0x1a2980(_0x102b4c);}return _0x5c1228(_0xa29a('0x4'));});});};exports[_0xa29a('0x5')]=function(_0x2de2c6){return connect()[_0xa29a('0x6')](function(){return new BPromise(function(_0x4ddcc2,_0x268d61){return pm2[_0xa29a('0x5')](_0x2de2c6,function(_0x2b29b0,_0x309a6c){if(_0x2b29b0){return _0x268d61(_0x2b29b0);}pm2[_0xa29a('0x7')]();return _0x4ddcc2(_0x309a6c);});});});};exports['stop']=function(_0x59f143){return connect()[_0xa29a('0x6')](function(){return new BPromise(function(_0x1ffa46,_0x38a992){return pm2['stop'](_0x59f143,function(_0x3adb28,_0x4bc08f){if(_0x3adb28){return _0x38a992(_0x3adb28);}pm2[_0xa29a('0x7')]();return _0x1ffa46(_0x4bc08f);});});});};exports[_0xa29a('0x8')]=function(_0x4226fd){return connect()['then'](function(){return new BPromise(function(_0x42e7f2,_0x199415){return pm2[_0xa29a('0x8')](_0x4226fd,function(_0x98f0ff,_0x43066b){if(_0x98f0ff){return _0x199415(_0x98f0ff);}pm2['disconnect']();return _0x42e7f2(_0x43066b);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x489cd3,_0x5777b1){return pm2[_0xa29a('0x9')](function(_0x216c55,_0x4bf5d0){if(_0x216c55){return _0x5777b1(_0x216c55);}pm2[_0xa29a('0x7')]();return _0x489cd3(_0x4bf5d0);});});});};exports[_0xa29a('0xa')]=function(_0xdc0704){return connect()[_0xa29a('0x6')](function(){return new BPromise(function(_0x44ae6a,_0x3eb83b){return pm2[_0xa29a('0xa')](_0xdc0704,function(_0x2955af,_0x5af17f){if(_0x2955af){return _0x3eb83b(_0x2955af);}pm2[_0xa29a('0x7')]();return _0x44ae6a(_0x5af17f);});});});};exports[_0xa29a('0xb')]=function(_0x19730e){return connect()[_0xa29a('0x6')](function(){return new BPromise(function(_0x1808fd,_0x22a5dd){return pm2[_0xa29a('0xb')](_0x19730e,function(_0x4f33a0,_0x2fc855){if(_0x4f33a0){return _0x22a5dd(_0x4f33a0);}pm2[_0xa29a('0x7')]();return _0x1808fd(_0x2fc855);});});});};exports[_0xa29a('0xc')]=function(){return connect()[_0xa29a('0x6')](function(){return new BPromise(function(_0x350864,_0x1588da){return pm2[_0xa29a('0xc')](function(_0x540a6a){if(_0x540a6a){return _0x1588da(_0x540a6a);}return _0x350864(_0xa29a('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a4e1ee2..68cca08 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 _0xb142=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0xb142,0x13f));var _0x2b14=function(_0x4094c1,_0x22e3ee){_0x4094c1=_0x4094c1-0x0;var _0x317314=_0xb142[_0x4094c1];return _0x317314;};'use strict';var _=require(_0x2b14('0x0'));var moment=require(_0x2b14('0x1'));var Redis=require('ioredis');var util=require(_0x2b14('0x2'));var config=require(_0x2b14('0x3'));var db=require(_0x2b14('0x4'))['db'];var logger=require(_0x2b14('0x5'))(_0x2b14('0x6'));config[_0x2b14('0x7')]=_['defaults'](config[_0x2b14('0x7')],{'host':_0x2b14('0x8'),'port':0x18eb});var io=require(_0x2b14('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x20d919=0x0;var _0x2334de=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x2b14('0xa')],'where':{'id':0x1}})[_0x2b14('0xb')](function(_0x22a501){_0x20d919=_0x22a501['chatTimeout'];if(_0x20d919){return db[_0x2b14('0xc')][_0x2b14('0xd')]({'raw':!![],'attributes':['id',_0x2b14('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2b14('0xf')](_0x22a501[_0x2b14('0xa')],_0x2b14('0x10'))}}});}else{return[];}})['then'](function(_0x8cd640){if(_0x8cd640&&_0x8cd640['length']){_0x2334de=_[_0x2b14('0x11')](_0x8cd640||[],'id');logger[_0x2b14('0x12')](_0x2b14('0x13'),_0x2334de[_0x2b14('0x14')]());return db['ChatInteraction'][_0x2b14('0x15')]({'closeReason':_0x2b14('0x16'),'disposition':_0x2b14('0x17'),'closed':!![],'closedAt':moment()[_0x2b14('0x18')](_0x2b14('0x19'))},{'where':{'id':_0x2334de}});}})[_0x2b14('0xb')](function(){if(_0x2334de&&_0x2334de[_0x2b14('0x1a')]){logger['info'](_0x2b14('0x1b'),_0x2334de['join']());for(var _0x30ff63=0x0;_0x30ff63<_0x2334de[_0x2b14('0x1a')];_0x30ff63++){io['emit'](_0x2b14('0x1c'),{'id':_0x2334de[_0x30ff63],'closed':!![]});}}})[_0x2b14('0x1d')](function(_0x7b6e59){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x7b6e59?util[_0x2b14('0x1e')](_0x7b6e59,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcab3=['minutes','map','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','start','lodash','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x4ccb04,_0x4da60e){var _0x462e9e=function(_0x3201b5){while(--_0x3201b5){_0x4ccb04['push'](_0x4ccb04['shift']());}};_0x462e9e(++_0x4da60e);}(_0xcab3,0x86));var _0x3cab=function(_0x5bb934,_0xbb612b){_0x5bb934=_0x5bb934-0x0;var _0x2f3cf4=_0xcab3[_0x5bb934];return _0x2f3cf4;};'use strict';var _=require(_0x3cab('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x3cab('0x1'));var db=require(_0x3cab('0x2'))['db'];var logger=require(_0x3cab('0x3'))(_0x3cab('0x4'));config['redis']=_[_0x3cab('0x5')](config[_0x3cab('0x6')],{'host':_0x3cab('0x7'),'port':0x18eb});var io=require(_0x3cab('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x9b36ba=0x0;var _0x46f997=[];return db[_0x3cab('0x9')][_0x3cab('0xa')]({'raw':!![],'attributes':['id',_0x3cab('0xb')],'where':{'id':0x1}})[_0x3cab('0xc')](function(_0x5e459e){_0x9b36ba=_0x5e459e[_0x3cab('0xb')];if(_0x9b36ba){return db[_0x3cab('0xd')][_0x3cab('0xe')]({'raw':!![],'attributes':['id',_0x3cab('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5e459e[_0x3cab('0xb')],_0x3cab('0x10'))}}});}else{return[];}})[_0x3cab('0xc')](function(_0xa6724a){if(_0xa6724a&&_0xa6724a['length']){_0x46f997=_[_0x3cab('0x11')](_0xa6724a||[],'id');logger[_0x3cab('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x46f997[_0x3cab('0x13')]());return db['ChatInteraction'][_0x3cab('0x14')]({'closeReason':_0x3cab('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x3cab('0x16')](_0x3cab('0x17'))},{'where':{'id':_0x46f997}});}})['then'](function(){if(_0x46f997&&_0x46f997[_0x3cab('0x18')]){logger[_0x3cab('0x12')](_0x3cab('0x19'),_0x46f997[_0x3cab('0x13')]());for(var _0x3703d0=0x0;_0x3703d0<_0x46f997['length'];_0x3703d0++){io[_0x3cab('0x1a')]('chatInteraction:update',{'id':_0x46f997[_0x3703d0],'closed':!![]});}}})['catch'](function(_0x2a460e){logger[_0x3cab('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2a460e?util[_0x3cab('0x1c')](_0x2a460e,{'showHidden':![],'depth':null}):'');});}exports[_0x3cab('0x1d')]=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 9daa0e7..a99c8ef 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 _0xe3a9=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x179ba0,_0xac7d43){var _0x1e2584=function(_0x56b35c){while(--_0x56b35c){_0x179ba0['push'](_0x179ba0['shift']());}};_0x1e2584(++_0xac7d43);}(_0xe3a9,0xfc));var _0x9e3a=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xe3a9[_0x318410];return _0x2898a3;};'use strict';function start(){var _0x5f3c3e=require(_0x9e3a('0x0'));return _0x5f3c3e['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x9069=['startAllRefreshIntervals'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9069,0x18a));var _0x9906=function(_0x3bb96e,_0xdc7992){_0x3bb96e=_0x3bb96e-0x0;var _0x1a6739=_0x9069[_0x3bb96e];return _0x1a6739;};'use strict';function start(){var _0x111428=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x111428[_0x9906('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 f2e7272..18caf39 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 _0xcd6d=['subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','difference','intersection','exists','stop','deleteJob','toRun','length','index','resolve','run\x20job','cron','active','isBetween','add','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','format','basename','extname','zip','existsSync','status','Sent','attachments','stringify','message','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil'];(function(_0x10f61b,_0x423488){var _0xb85d72=function(_0x264bdf){while(--_0x264bdf){_0x10f61b['push'](_0x10f61b['shift']());}};_0xb85d72(++_0x423488);}(_0xcd6d,0xda));var _0xdcd6=function(_0x565ccf,_0x5c79d9){_0x565ccf=_0x565ccf-0x0;var _0x8cba37=_0xcd6d[_0x565ccf];return _0x8cba37;};'use strict';var fs=require('fs');var util=require(_0xdcd6('0x0'));var path=require(_0xdcd6('0x1'));var _=require(_0xdcd6('0x2'));var moment=require(_0xdcd6('0x3'));var CronJobManager=require(_0xdcd6('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xdcd6('0x5'))(_0xdcd6('0x6'));var db=require(_0xdcd6('0x7'))['db'];var analyticCustomReportController=require(_0xdcd6('0x8'));var analyticDefaultReportController=require(_0xdcd6('0x9'));var client=jayson['client'][_0xdcd6('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x30326e,_0x5a2d02){return function(){logger[_0xdcd6('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x30326e[_0xdcd6('0xc')]);var _0x4f1841=!![];var _0x5b69ff=_0x30326e[_0xdcd6('0xd')][_0xdcd6('0xe')]();var _0x1f6c87={'account':_0x5b69ff,'message':{'from':util['format'](_0xdcd6('0xf'),_0x30326e[_0xdcd6('0xd')][_0xdcd6('0x10')],_0x30326e[_0xdcd6('0xd')][_0xdcd6('0xc')]||_0x30326e['MailAccount'][_0xdcd6('0x11')][_0xdcd6('0x12')]),'to':_0x30326e['email'],'cc':_0x30326e['cc'],'bcc':_0x30326e['bcc'],'subject':util['format'](_0xdcd6('0x13'),_0x5a2d02['name'],_0x30326e['subtractNumber'],_0x30326e[_0xdcd6('0x14')])}};var _0x528f9a=path[_0xdcd6('0x15')](__dirname,_0xdcd6('0x16'));var _0x557b27=_0x5a2d02[_0xdcd6('0x17')];var _0x2e5a70=util[_0xdcd6('0x18')]('%s.%s',path[_0xdcd6('0x19')](_0x5a2d02[_0xdcd6('0x17')],path[_0xdcd6('0x1a')](_0x5a2d02[_0xdcd6('0x17')])),_0xdcd6('0x1b'));var _0xb9dfe1=path[_0xdcd6('0x15')](_0x528f9a,_0x557b27);var _0x354f56=path['join'](_0x528f9a,_0x2e5a70);if(fs[_0xdcd6('0x1c')](_0xb9dfe1)){_0x5a2d02[_0xdcd6('0x1d')]=_0xdcd6('0x1e');_0x1f6c87['message'][_0xdcd6('0x1f')]=[{'filename':_0x557b27,'path':_0xb9dfe1}];_0x1f6c87['message']['text']=util[_0xdcd6('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xdcd6('0x20')](_0x5a2d02,null,0x2));}else if(fs[_0xdcd6('0x1c')](_0x354f56)){_0x5a2d02['status']=_0xdcd6('0x1e');_0x1f6c87[_0xdcd6('0x21')]['attachments']=[{'filename':_0x2e5a70,'path':_0x354f56}];}else{_0x1f6c87[_0xdcd6('0x21')][_0xdcd6('0x22')]=_0xdcd6('0x23');if(!_0x30326e[_0xdcd6('0x24')]){_0x4f1841=![];logger[_0xdcd6('0xb')](_0xdcd6('0x25'));}}if(_0x4f1841){return client[_0xdcd6('0x26')]('SendMail',_0x1f6c87)[_0xdcd6('0x27')](function(_0x4982ee){if(_0x4982ee['error']){return logger[_0xdcd6('0x28')](_0xdcd6('0x29'),JSON[_0xdcd6('0x20')](_0x4982ee));}return logger[_0xdcd6('0xb')](_0xdcd6('0x2a'));})[_0xdcd6('0x2b')](function(_0x2637ff){return logger['error'](_0xdcd6('0x29'),JSON[_0xdcd6('0x20')](_0x2637ff));});}};}function handleError(){return function(_0x156090){return logger[_0xdcd6('0x28')](JSON[_0xdcd6('0x20')](_0x156090));};}function handleResult(_0x3cd99e){return function(_0x1a5f5b){logger['info'](_0xdcd6('0x2c'),JSON[_0xdcd6('0x20')](_0x1a5f5b));if(_0x3cd99e['MailAccount']&&_0x3cd99e[_0xdcd6('0xd')][_0xdcd6('0x11')]&&!_[_0xdcd6('0x2d')](_0x3cd99e['email'])){setTimeout(handleSendEmail(_0x3cd99e,_0x1a5f5b),0x3c*0x3e8);}};}function handleJob(_0x268457){return function(){try{if(_[_0xdcd6('0x2d')](_0x268457[_0xdcd6('0x2e')])){return logger[_0xdcd6('0xb')](_0xdcd6('0x2f'));}if(_['isNil'](_0x268457[_0xdcd6('0x14')])){return logger[_0xdcd6('0xb')](_0xdcd6('0x30'));}var _0x48483d={'startDate':moment()[_0xdcd6('0x31')](_0x268457[_0xdcd6('0x2e')],_0x268457[_0xdcd6('0x14')])['format'](_0xdcd6('0x32')),'endDate':moment()[_0xdcd6('0x18')](_0xdcd6('0x32')),'type':_0xdcd6('0x33'),'output':_0x268457[_0xdcd6('0x34')],'name':_0x268457['name']};if(!_[_0xdcd6('0x2d')](_0x268457['DefaultReportId'])){logger[_0xdcd6('0xb')](_0xdcd6('0x35'),_0x268457[_0xdcd6('0x36')]);return analyticDefaultReportController[_0xdcd6('0x37')]({'id':_0x268457['DefaultReportId']},_0x48483d)[_0xdcd6('0x27')](handleResult(_0x268457))[_0xdcd6('0x2b')](handleError());}if(!_[_0xdcd6('0x2d')](_0x268457[_0xdcd6('0x38')])){logger['info'](_0xdcd6('0x39'),_0x268457[_0xdcd6('0x38')]);return analyticCustomReportController[_0xdcd6('0x37')]({'id':_0x268457[_0xdcd6('0x38')]},_0x48483d)[_0xdcd6('0x27')](handleResult(_0x268457))[_0xdcd6('0x2b')](handleError());}}catch(_0x4bf0f6){logger[_0xdcd6('0x28')](JSON[_0xdcd6('0x20')](_0x4bf0f6));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x29d209){var _0x1bf0d9={};if(_0x29d209){_0x1bf0d9['id']=_0x29d209;}return db[_0xdcd6('0x3a')][_0xdcd6('0x3b')]({'where':_0x1bf0d9,'include':[{'model':db[_0xdcd6('0xd')],'attributes':['id',_0xdcd6('0x10'),_0xdcd6('0xc')],'include':[{'model':db[_0xdcd6('0x3c')],'as':_0xdcd6('0x11'),'include':[{'model':db['CloudProvider'],'as':_0xdcd6('0x3d')}]}]}]})['then'](function(_0x1bdad6){var _0x1713fa=_[_0xdcd6('0x3e')](manager[_0xdcd6('0x3f')]);var _0x197a9a=_[_0xdcd6('0x40')](_0x1bdad6,function(_0x376626){return _0x376626['id'][_0xdcd6('0x41')]();});var _0x8481a4=_['keyBy'](_0x1bdad6,function(_0x57a50a){return _0x57a50a['id'][_0xdcd6('0x41')]();});var _0x38bcc5=_0x29d209?_0x197a9a:_[_0xdcd6('0x42')](_0x197a9a,_0x1713fa);var _0x506d41=_[_0xdcd6('0x43')](_0x197a9a,_0x1713fa);var _0x57fdc0=_[_0xdcd6('0x42')](_0x1713fa,_0x197a9a);var _0xa8f19b;var _0x317705;for(_0xa8f19b=0x0;_0xa8f19b<_0x57fdc0['length']&&!_0x29d209;_0xa8f19b+=0x1){_0x317705=_0x57fdc0[_0xa8f19b][_0xdcd6('0x41')]();if(manager[_0xdcd6('0x44')](_0x317705)){manager[_0xdcd6('0x45')](_0x317705);manager[_0xdcd6('0x46')](_0x317705);logger['info']('delete\x20cron',_0x317705);}}logger[_0xdcd6('0xb')](_0xdcd6('0x47'),JSON['stringify'](_0x38bcc5));for(_0xa8f19b=0x0;_0xa8f19b<_0x38bcc5[_0xdcd6('0x48')];_0xa8f19b+=0x1){_0x317705=_0x38bcc5[_0xa8f19b][_0xdcd6('0x41')]();logger[_0xdcd6('0xb')](_0xdcd6('0x49'),_0x317705);if(_0x29d209){logger[_0xdcd6('0xb')]('my\x20id',_0x29d209);logger[_0xdcd6('0xb')](JSON[_0xdcd6('0x20')](_0x8481a4[_0x317705]));BPromise[_0xdcd6('0x4a')]()[_0xdcd6('0x27')](handleJob(_0x8481a4[_0x317705]));logger[_0xdcd6('0xb')](_0xdcd6('0x4b'),_0x8481a4[_0x317705]['name'],_0x8481a4[_0x317705][_0xdcd6('0x4c')]);}else if(_0x8481a4[_0x317705][_0xdcd6('0x4c')]&&_0x8481a4[_0x317705][_0xdcd6('0x4d')]&&moment()[_0xdcd6('0x4e')](_0x8481a4[_0x317705]['startAt'],_0x8481a4[_0x317705]['endAt'])){manager[_0xdcd6('0x4f')](_0x317705,_0x8481a4[_0x317705][_0xdcd6('0x4c')],handleJob(_0x8481a4[_0x317705]));manager['start'](_0x317705);logger[_0xdcd6('0xb')](_0xdcd6('0x50'),_0x8481a4[_0x317705][_0xdcd6('0x10')],_0x8481a4[_0x317705][_0xdcd6('0x4c')]);}else if(manager[_0xdcd6('0x44')](_0x317705)){manager['stop'](_0x317705);manager[_0xdcd6('0x46')](_0x317705);logger[_0xdcd6('0xb')](_0xdcd6('0x51'),_0x8481a4[_0x317705]['name'],_0x8481a4[_0x317705][_0xdcd6('0x4c')]);}}for(_0xa8f19b=0x0,_0x317705;_0xa8f19b<_0x506d41[_0xdcd6('0x48')]&&!_0x29d209;_0xa8f19b+=0x1){_0x317705=_0x506d41[_0xa8f19b][_0xdcd6('0x41')]();if(manager['exists'](_0x317705)){if(_0x8481a4[_0x317705]['cron']&&_0x8481a4[_0x317705]['active']&&moment()[_0xdcd6('0x4e')](_0x8481a4[_0x317705][_0xdcd6('0x52')],_0x8481a4[_0x317705][_0xdcd6('0x53')])){manager[_0xdcd6('0x54')](_0x317705,_0x8481a4[_0x317705][_0xdcd6('0x4c')],handleJob(_0x8481a4[_0x317705]));logger[_0xdcd6('0xb')](_0xdcd6('0x55'),_0x8481a4[_0x317705]['name'],_0x8481a4[_0x317705][_0xdcd6('0x4c')]);}else{manager[_0xdcd6('0x45')](_0x317705);manager['deleteJob'](_0x317705);logger[_0xdcd6('0xb')]('stop\x20cron',_0x8481a4[_0x317705][_0xdcd6('0x10')],_0x8481a4[_0x317705][_0xdcd6('0x4c')]);}}}})['catch'](function(_0x596089){logger['error'](JSON[_0xdcd6('0x20')](_0x596089));});}exports[_0xdcd6('0x56')]=function(_0xa38608){return getJobs(_0xa38608);};exports[_0xdcd6('0x57')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x406e=['startAt','endAt','add','add\x20cron','stop','deleteJob','stop\x20cron','isBetween','update','run','start','util','lodash','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','basename','extname','savename','zip','existsSync','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','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','stringify','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active'];(function(_0x5807f6,_0x2549a2){var _0xef1c3c=function(_0x3846f5){while(--_0x3846f5){_0x5807f6['push'](_0x5807f6['shift']());}};_0xef1c3c(++_0x2549a2);}(_0x406e,0x16b));var _0xe406=function(_0x3fa9a2,_0x425f9a){_0x3fa9a2=_0x3fa9a2-0x0;var _0x4c54da=_0x406e[_0x3fa9a2];return _0x4c54da;};'use strict';var fs=require('fs');var util=require(_0xe406('0x0'));var path=require('path');var _=require(_0xe406('0x1'));var moment=require('moment');var CronJobManager=require(_0xe406('0x2'));var jayson=require(_0xe406('0x3'));var BPromise=require('bluebird');var logger=require(_0xe406('0x4'))('schedule');var db=require(_0xe406('0x5'))['db'];var analyticCustomReportController=require(_0xe406('0x6'));var analyticDefaultReportController=require(_0xe406('0x7'));var client=jayson[_0xe406('0x8')][_0xe406('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x528f1f,_0x3c7f52){return function(){logger[_0xe406('0xa')](_0xe406('0xb'),_0x528f1f[_0xe406('0xc')]);var _0x20a2f3=!![];var _0x514c60=_0x528f1f[_0xe406('0xd')][_0xe406('0xe')]();var _0x140be2={'account':_0x514c60,'message':{'from':util[_0xe406('0xf')]('\x22%s\x22\x20<%s>',_0x528f1f[_0xe406('0xd')][_0xe406('0x10')],_0x528f1f[_0xe406('0xd')][_0xe406('0xc')]||_0x528f1f[_0xe406('0xd')][_0xe406('0x11')][_0xe406('0x12')]),'to':_0x528f1f[_0xe406('0xc')],'cc':_0x528f1f['cc'],'bcc':_0x528f1f[_0xe406('0x13')],'subject':util['format'](_0xe406('0x14'),_0x3c7f52[_0xe406('0x10')],_0x528f1f[_0xe406('0x15')],_0x528f1f[_0xe406('0x16')])}};var _0x240fa3=path[_0xe406('0x17')](__dirname,_0xe406('0x18'));var _0x538da2=_0x3c7f52['savename'];var _0x2f2c5a=util['format']('%s.%s',path[_0xe406('0x19')](_0x3c7f52['savename'],path[_0xe406('0x1a')](_0x3c7f52[_0xe406('0x1b')])),_0xe406('0x1c'));var _0x2eac42=path['join'](_0x240fa3,_0x538da2);var _0x1d316a=path[_0xe406('0x17')](_0x240fa3,_0x2f2c5a);if(fs[_0xe406('0x1d')](_0x2eac42)){_0x3c7f52['status']=_0xe406('0x1e');_0x140be2[_0xe406('0x1f')]['attachments']=[{'filename':_0x538da2,'path':_0x2eac42}];_0x140be2['message'][_0xe406('0x20')]=util[_0xe406('0xf')](_0xe406('0x21'),JSON['stringify'](_0x3c7f52,null,0x2));}else if(fs[_0xe406('0x1d')](_0x1d316a)){_0x3c7f52[_0xe406('0x22')]=_0xe406('0x1e');_0x140be2[_0xe406('0x1f')][_0xe406('0x23')]=[{'filename':_0x2f2c5a,'path':_0x1d316a}];}else{_0x140be2['message'][_0xe406('0x20')]=_0xe406('0x24');if(!_0x528f1f[_0xe406('0x25')]){_0x20a2f3=![];logger[_0xe406('0xa')](_0xe406('0x26'));}}if(_0x20a2f3){return client[_0xe406('0x27')]('SendMail',_0x140be2)['then'](function(_0x430214){if(_0x430214[_0xe406('0x28')]){return logger['error'](_0xe406('0x29'),JSON[_0xe406('0x2a')](_0x430214));}return logger['info'](_0xe406('0x2b'));})['catch'](function(_0x2377d9){return logger[_0xe406('0x28')](_0xe406('0x29'),JSON[_0xe406('0x2a')](_0x2377d9));});}};}function handleError(){return function(_0x569534){return logger[_0xe406('0x28')](JSON['stringify'](_0x569534));};}function handleResult(_0x47f525){return function(_0x52f2c5){logger[_0xe406('0xa')](_0xe406('0x2c'),JSON['stringify'](_0x52f2c5));if(_0x47f525[_0xe406('0xd')]&&_0x47f525[_0xe406('0xd')][_0xe406('0x11')]&&!_[_0xe406('0x2d')](_0x47f525[_0xe406('0xc')])){setTimeout(handleSendEmail(_0x47f525,_0x52f2c5),0x3c*0x3e8);}};}function handleJob(_0x2cb2db){return function(){try{if(_[_0xe406('0x2d')](_0x2cb2db[_0xe406('0x15')])){return logger[_0xe406('0xa')](_0xe406('0x2e'));}if(_[_0xe406('0x2d')](_0x2cb2db[_0xe406('0x16')])){return logger[_0xe406('0xa')](_0xe406('0x2f'));}var _0xda9573={'startDate':moment()[_0xe406('0x30')](_0x2cb2db[_0xe406('0x15')],_0x2cb2db[_0xe406('0x16')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xe406('0x31'),'output':_0x2cb2db[_0xe406('0x32')],'name':_0x2cb2db[_0xe406('0x10')]};if(!_[_0xe406('0x2d')](_0x2cb2db[_0xe406('0x33')])){logger[_0xe406('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x2cb2db[_0xe406('0x33')]);return analyticDefaultReportController[_0xe406('0x34')]({'id':_0x2cb2db[_0xe406('0x33')]},_0xda9573)[_0xe406('0x35')](handleResult(_0x2cb2db))[_0xe406('0x36')](handleError());}if(!_[_0xe406('0x2d')](_0x2cb2db[_0xe406('0x37')])){logger[_0xe406('0xa')](_0xe406('0x38'),_0x2cb2db[_0xe406('0x37')]);return analyticCustomReportController[_0xe406('0x34')]({'id':_0x2cb2db[_0xe406('0x37')]},_0xda9573)[_0xe406('0x35')](handleResult(_0x2cb2db))['catch'](handleError());}}catch(_0x2fd6c0){logger[_0xe406('0x28')](JSON['stringify'](_0x2fd6c0));}return logger['info'](_0xe406('0x39'));};}function getJobs(_0x2e5f70){var _0x383c24={};if(_0x2e5f70){_0x383c24['id']=_0x2e5f70;}return db['Schedule'][_0xe406('0x3a')]({'where':_0x383c24,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe406('0x10'),_0xe406('0xc')],'include':[{'model':db[_0xe406('0x3b')],'as':_0xe406('0x11'),'include':[{'model':db[_0xe406('0x3c')],'as':_0xe406('0x3c')}]}]}]})[_0xe406('0x35')](function(_0x53d6b1){var _0x3833eb=_[_0xe406('0x3d')](manager[_0xe406('0x3e')]);var _0xb1bc6a=_[_0xe406('0x3f')](_0x53d6b1,function(_0x41740e){return _0x41740e['id'][_0xe406('0x40')]();});var _0x35b3c0=_[_0xe406('0x41')](_0x53d6b1,function(_0x1f9a26){return _0x1f9a26['id'][_0xe406('0x40')]();});var _0x5f4d60=_0x2e5f70?_0xb1bc6a:_[_0xe406('0x42')](_0xb1bc6a,_0x3833eb);var _0x6406f5=_[_0xe406('0x43')](_0xb1bc6a,_0x3833eb);var _0x190fd6=_[_0xe406('0x42')](_0x3833eb,_0xb1bc6a);var _0xe306e6;var _0x258329;for(_0xe306e6=0x0;_0xe306e6<_0x190fd6[_0xe406('0x44')]&&!_0x2e5f70;_0xe306e6+=0x1){_0x258329=_0x190fd6[_0xe306e6][_0xe406('0x40')]();if(manager[_0xe406('0x45')](_0x258329)){manager['stop'](_0x258329);manager['deleteJob'](_0x258329);logger[_0xe406('0xa')](_0xe406('0x46'),_0x258329);}}logger['info']('toRun',JSON[_0xe406('0x2a')](_0x5f4d60));for(_0xe306e6=0x0;_0xe306e6<_0x5f4d60[_0xe406('0x44')];_0xe306e6+=0x1){_0x258329=_0x5f4d60[_0xe306e6]['toString']();logger['info'](_0xe406('0x47'),_0x258329);if(_0x2e5f70){logger[_0xe406('0xa')](_0xe406('0x48'),_0x2e5f70);logger['info'](JSON[_0xe406('0x2a')](_0x35b3c0[_0x258329]));BPromise[_0xe406('0x49')]()[_0xe406('0x35')](handleJob(_0x35b3c0[_0x258329]));logger['info'](_0xe406('0x4a'),_0x35b3c0[_0x258329][_0xe406('0x10')],_0x35b3c0[_0x258329][_0xe406('0x4b')]);}else if(_0x35b3c0[_0x258329]['cron']&&_0x35b3c0[_0x258329][_0xe406('0x4c')]&&moment()['isBetween'](_0x35b3c0[_0x258329][_0xe406('0x4d')],_0x35b3c0[_0x258329][_0xe406('0x4e')])){manager[_0xe406('0x4f')](_0x258329,_0x35b3c0[_0x258329][_0xe406('0x4b')],handleJob(_0x35b3c0[_0x258329]));manager['start'](_0x258329);logger['info'](_0xe406('0x50'),_0x35b3c0[_0x258329][_0xe406('0x10')],_0x35b3c0[_0x258329]['cron']);}else if(manager['exists'](_0x258329)){manager[_0xe406('0x51')](_0x258329);manager[_0xe406('0x52')](_0x258329);logger[_0xe406('0xa')](_0xe406('0x53'),_0x35b3c0[_0x258329][_0xe406('0x10')],_0x35b3c0[_0x258329][_0xe406('0x4b')]);}}for(_0xe306e6=0x0,_0x258329;_0xe306e6<_0x6406f5[_0xe406('0x44')]&&!_0x2e5f70;_0xe306e6+=0x1){_0x258329=_0x6406f5[_0xe306e6][_0xe406('0x40')]();if(manager[_0xe406('0x45')](_0x258329)){if(_0x35b3c0[_0x258329][_0xe406('0x4b')]&&_0x35b3c0[_0x258329][_0xe406('0x4c')]&&moment()[_0xe406('0x54')](_0x35b3c0[_0x258329]['startAt'],_0x35b3c0[_0x258329]['endAt'])){manager[_0xe406('0x55')](_0x258329,_0x35b3c0[_0x258329][_0xe406('0x4b')],handleJob(_0x35b3c0[_0x258329]));logger[_0xe406('0xa')]('update\x20cron',_0x35b3c0[_0x258329]['name'],_0x35b3c0[_0x258329][_0xe406('0x4b')]);}else{manager['stop'](_0x258329);manager['deleteJob'](_0x258329);logger[_0xe406('0xa')](_0xe406('0x53'),_0x35b3c0[_0x258329][_0xe406('0x10')],_0x35b3c0[_0x258329]['cron']);}}}})[_0xe406('0x36')](function(_0x4fc90f){logger[_0xe406('0x28')](JSON[_0xe406('0x2a')](_0x4fc90f));});}exports[_0xe406('0x56')]=function(_0x42ec7d){return getJobs(_0x42ec7d);};exports[_0xe406('0x57')]=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 710128d..93a22cc 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 _0xe605=['Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','CloudProvider','Negative','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe605,0x92));var _0x5e60=function(_0x23368d,_0x447a0e){_0x23368d=_0x23368d-0x0;var _0x29d0b8=_0xe605[_0x23368d];return _0x29d0b8;};var _=require(_0x5e60('0x0'));var AWS=require(_0x5e60('0x1'));var rp=require('request-promise');var util=require(_0x5e60('0x2'));var BPromise=require(_0x5e60('0x3'));var db=require(_0x5e60('0x4'))['db'];var logger=require(_0x5e60('0x5'))(_0x5e60('0x6'));function getTranscriptionJob(_0xfe1f64,_0x3a6c7c,_0x30d8fb,_0x297ab2){return new Promise(function(_0xc41535,_0x1d4a08){var _0x168a14=new AWS['TranscribeService']({'accessKeyId':_0x3a6c7c,'secretAccessKey':_0xfe1f64,'region':_0x30d8fb});_0x168a14[_0x5e60('0x7')]({'TranscriptionJobName':_0x297ab2},function(_0x55ff5c,_0x593118){if(_0x55ff5c){return _0x1d4a08(_0x55ff5c);}else{return _0xc41535(_0x593118);}});});}function sentiment(_0x53dccb,_0x43f7eb,_0xe93f9c,_0x150a51,_0x2c5425){return new Promise(function(_0x331b3e,_0x2cbe4e){var _0x56f05a=new AWS[(_0x5e60('0x8'))]({'accessKeyId':_0x43f7eb,'secretAccessKey':_0x53dccb,'region':_0xe93f9c});_0x56f05a['detectSentiment']({'Text':_0x150a51,'LanguageCode':_0x2c5425[_0x5e60('0x9')](0x0,0x2)},function(_0x15035f,_0xcf1188){if(_0x15035f){return _0x2cbe4e(_0x15035f);}else{return _0x331b3e(_0xcf1188);}});});}function checkTranscribeJob(_0x51e7f6,_0x371df7,_0x178782){var _0x1f4e14;return new BPromise(function(_0xe039de,_0x2874c4){logger[_0x5e60('0xa')](util['format'](_0x5e60('0xb'),_0x51e7f6['id'],_0x51e7f6[_0x5e60('0xc')]));return getTranscriptionJob(_0x178782[_0x5e60('0xd')],_0x178782[_0x5e60('0xe')],_0x371df7['transcribeRegion'],_0x51e7f6[_0x5e60('0xc')])['then'](function(_0x1ffd77){logger[_0x5e60('0xa')](util['format'](_0x5e60('0xf'),_0x51e7f6['id'],_0x51e7f6[_0x5e60('0xc')],_0x1ffd77[_0x5e60('0x10')][_0x5e60('0x11')]));if(!_0x51e7f6['fileText']){switch(_0x1ffd77[_0x5e60('0x10')][_0x5e60('0x11')]){case'COMPLETED':var _0x1fa0f8={'transcribeStatus':_0x1ffd77[_0x5e60('0x10')][_0x5e60('0x11')],'fileUri':_0x1ffd77[_0x5e60('0x10')][_0x5e60('0x12')][_0x5e60('0x13')]};logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x15'),_0x51e7f6['id']));return rp({'uri':_0x1ffd77[_0x5e60('0x10')][_0x5e60('0x12')]['TranscriptFileUri'],'json':!![]})[_0x5e60('0x16')](function(_0x5d77dd){logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x17'),_0x51e7f6['id']));if(_0x5d77dd&&_0x5d77dd[_0x5e60('0x18')]&&_0x5d77dd[_0x5e60('0x18')][_0x5e60('0x19')]&&_0x5d77dd[_0x5e60('0x18')]['transcripts'][_0x5e60('0x1a')]){_0x1fa0f8[_0x5e60('0x1b')]='';for(var _0x19f37b=0x0;_0x19f37b<_0x5d77dd['results'][_0x5e60('0x19')][_0x5e60('0x1a')];_0x19f37b++){_0x1fa0f8[_0x5e60('0x1b')]+=_0x5d77dd[_0x5e60('0x18')]['transcripts'][_0x19f37b][_0x5e60('0x1c')]+'';}}return _0x51e7f6['update'](_0x1fa0f8);})[_0x5e60('0x16')](function(){logger[_0x5e60('0xa')](util['format'](_0x5e60('0x1d'),_0x51e7f6['id']));if(!_0x51e7f6[_0x5e60('0x1e')]){throw new db['Sequelize'][(_0x5e60('0x1f'))](_0x5e60('0x20'));}if(!_0x371df7['sentiment']||!_0x371df7['sentimentAccountId']||!_0x371df7['sentimentRegion']||!_0x371df7[_0x5e60('0x21')]||!_0x371df7[_0x5e60('0x22')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x24'));}if(!_0x1fa0f8['fileText']){throw new Error(_0x5e60('0x25'));}if(_0x371df7[_0x5e60('0x26')]===_0x178782['id']){return _0x178782;}else{return db['CloudProvider'][_0x5e60('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x1035b0){if(!_0x1035b0){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x28'));}if(!_0x1035b0[_0x5e60('0xd')]||!_0x1035b0[_0x5e60('0xe')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x29'));}_0x1f4e14=_0x1035b0;logger[_0x5e60('0xa')](util['format'](_0x5e60('0x2a'),_0x51e7f6['id']));return sentiment(_0x1f4e14['data1'],_0x1f4e14['data2'],_0x371df7[_0x5e60('0x2b')],_0x1fa0f8[_0x5e60('0x1b')],_0x371df7['language']);})[_0x5e60('0x16')](function(_0x576c70){logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x2c'),_0x51e7f6['id']));return _0x51e7f6[_0x5e60('0x2d')]({'sentiment':_0x576c70[_0x5e60('0x2e')],'sPositive':_0x576c70[_0x5e60('0x2f')][_0x5e60('0x30')],'sNegative':_0x576c70[_0x5e60('0x2f')]['Negative'],'sMixed':_0x576c70[_0x5e60('0x2f')][_0x5e60('0x31')],'sNeutral':_0x576c70[_0x5e60('0x2f')][_0x5e60('0x32')]});})[_0x5e60('0x16')](function(){logger[_0x5e60('0xa')](util[_0x5e60('0x14')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x51e7f6['id']));_0xe039de();});case _0x5e60('0x33'):return _0x51e7f6[_0x5e60('0x2d')]({'transcribeStatus':'FAILED','failureReason':_0x1ffd77['TranscriptionJob'][_0x5e60('0x34')]})[_0x5e60('0x16')](function(){logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x1d'),_0x51e7f6['id']));_0xe039de();});default:logger['info'](util[_0x5e60('0x14')](_0x5e60('0x35'),_0x51e7f6['id']));break;}}else{return BPromise[_0x5e60('0x36')]()[_0x5e60('0x16')](function(){if(!_0x51e7f6[_0x5e60('0x1e')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x371df7[_0x5e60('0x37')]||!_0x371df7[_0x5e60('0x26')]||!_0x371df7['sentimentRegion']||!_0x371df7['language']||!_0x371df7['bucket']){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x24'));}if(!_0x51e7f6[_0x5e60('0x1b')]){throw new Error('Transcript\x20not\x20available');}if(_0x371df7[_0x5e60('0x26')]===_0x178782['id']){return _0x178782;}else{return db[_0x5e60('0x38')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x5e60('0x16')](function(_0x42b9b0){if(!_0x42b9b0){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x28'));}if(!_0x42b9b0[_0x5e60('0xd')]||!_0x42b9b0[_0x5e60('0xe')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1f4e14=_0x42b9b0;logger[_0x5e60('0xa')](util[_0x5e60('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x51e7f6['id']));return sentiment(_0x1f4e14[_0x5e60('0xd')],_0x1f4e14[_0x5e60('0xe')],_0x371df7[_0x5e60('0x2b')],_0x51e7f6[_0x5e60('0x1b')],_0x371df7[_0x5e60('0x21')]);})['then'](function(_0x3f1a53){logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x2c'),_0x51e7f6['id']));return _0x51e7f6['update']({'sentiment':_0x3f1a53['Sentiment'],'sPositive':_0x3f1a53['SentimentScore'][_0x5e60('0x30')],'sNegative':_0x3f1a53[_0x5e60('0x2f')][_0x5e60('0x39')],'sMixed':_0x3f1a53[_0x5e60('0x2f')][_0x5e60('0x31')],'sNeutral':_0x3f1a53[_0x5e60('0x2f')]['Neutral'],'transcribeStatus':_0x5e60('0x3a')});})[_0x5e60('0x16')](function(){logger[_0x5e60('0xa')](util[_0x5e60('0x14')](_0x5e60('0x1d'),_0x51e7f6['id']));_0xe039de();});}})[_0x5e60('0x3b')](function(_0x214f27){if(_0x214f27){if(!_0x214f27['name']||_0x214f27[_0x5e60('0x3c')]!==_0x5e60('0x3d')){logger[_0x5e60('0x3e')](util[_0x5e60('0x14')](_0x5e60('0x3f'),_0x51e7f6['id']),util[_0x5e60('0x40')](_0x214f27,{'showHidden':![],'depth':null}));}}_0xe039de();});});}function checkTranscribe(){var _0x2a9353;var _0x4470bd;var _0x1518bd;return db[_0x5e60('0x41')][_0x5e60('0x42')]({'where':{'transcribeStatus':_0x5e60('0x43')}})[_0x5e60('0x16')](function(_0x969287){if(!_0x969287||!_0x969287[_0x5e60('0x1a')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x44'));}_0x2a9353=_0x969287;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x5e60('0x16')](function(_0x4d3588){if(!_0x4d3588){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x45'));}_0x4470bd=_0x4d3588;if(!_0x4470bd[_0x5e60('0x6')]||!_0x4470bd[_0x5e60('0x46')]||!_0x4470bd[_0x5e60('0x47')]||!_0x4470bd['language']||!_0x4470bd['bucket']){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))](_0x5e60('0x48'));}return db['CloudProvider']['findOne']({'where':{'id':_0x4470bd[_0x5e60('0x46')]}});})[_0x5e60('0x16')](function(_0x179cc6){if(!_0x179cc6){throw new db['Sequelize'][(_0x5e60('0x1f'))](_0x5e60('0x28'));}if(!_0x179cc6[_0x5e60('0xd')]||!_0x179cc6[_0x5e60('0xe')]){throw new db[(_0x5e60('0x23'))][(_0x5e60('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1518bd=_0x179cc6;var _0x412be1=[];_0x2a9353[_0x5e60('0x49')](function(_0x4acbe8){_0x412be1[_0x5e60('0x4a')](checkTranscribeJob(_0x4acbe8,_0x4470bd,_0x1518bd));});return BPromise[_0x5e60('0x4b')](_0x412be1);})[_0x5e60('0x3b')](function(_0x5b3b99){if(_0x5b3b99){if(!_0x5b3b99[_0x5e60('0x3c')]||_0x5b3b99[_0x5e60('0x3c')]!=='SequelizeValidationError'){logger[_0x5e60('0x3e')](util[_0x5e60('0x40')](_0x5b3b99,{'showHidden':![],'depth':null}));}}});}exports[_0x5e60('0x4c')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x01d3=['error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','bucket','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','catch','name','SequelizeValidationError'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x01d3,0xa2));var _0x301d=function(_0x55c536,_0x422419){_0x55c536=_0x55c536-0x0;var _0x8183a4=_0x01d3[_0x55c536];return _0x8183a4;};var _=require(_0x301d('0x0'));var AWS=require(_0x301d('0x1'));var rp=require(_0x301d('0x2'));var util=require(_0x301d('0x3'));var BPromise=require('bluebird');var db=require(_0x301d('0x4'))['db'];var logger=require(_0x301d('0x5'))('transcribe');function getTranscriptionJob(_0x1b5c75,_0x20d62c,_0x45562b,_0x337347){return new Promise(function(_0x5d1462,_0x318074){var _0x2d8fc2=new AWS[(_0x301d('0x6'))]({'accessKeyId':_0x20d62c,'secretAccessKey':_0x1b5c75,'region':_0x45562b});_0x2d8fc2[_0x301d('0x7')]({'TranscriptionJobName':_0x337347},function(_0x35e760,_0x3ba019){if(_0x35e760){return _0x318074(_0x35e760);}else{return _0x5d1462(_0x3ba019);}});});}function sentiment(_0x130666,_0x26ce06,_0x35ae14,_0x18b853,_0x4c2760){return new Promise(function(_0x1f33fa,_0x2d1d2b){var _0x3cff9d=new AWS['Comprehend']({'accessKeyId':_0x26ce06,'secretAccessKey':_0x130666,'region':_0x35ae14});_0x3cff9d[_0x301d('0x8')]({'Text':_0x18b853,'LanguageCode':_0x4c2760[_0x301d('0x9')](0x0,0x2)},function(_0x5c5d69,_0x5050d3){if(_0x5c5d69){return _0x2d1d2b(_0x5c5d69);}else{return _0x1f33fa(_0x5050d3);}});});}function checkTranscribeJob(_0x4a666b,_0x36a891,_0x2d1684){var _0x467b08;return new BPromise(function(_0x47cc84,_0xe192e6){logger[_0x301d('0xa')](util[_0x301d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4a666b['id'],_0x4a666b['transcribeName']));return getTranscriptionJob(_0x2d1684[_0x301d('0xc')],_0x2d1684[_0x301d('0xd')],_0x36a891[_0x301d('0xe')],_0x4a666b['transcribeName'])['then'](function(_0x4f0f10){logger['info'](util[_0x301d('0xb')](_0x301d('0xf'),_0x4a666b['id'],_0x4a666b[_0x301d('0x10')],_0x4f0f10[_0x301d('0x11')][_0x301d('0x12')]));if(!_0x4a666b[_0x301d('0x13')]){switch(_0x4f0f10['TranscriptionJob'][_0x301d('0x12')]){case'COMPLETED':var _0x4eb5eb={'transcribeStatus':_0x4f0f10[_0x301d('0x11')][_0x301d('0x12')],'fileUri':_0x4f0f10['TranscriptionJob'][_0x301d('0x14')]['TranscriptFileUri']};logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x15'),_0x4a666b['id']));return rp({'uri':_0x4f0f10['TranscriptionJob'][_0x301d('0x14')]['TranscriptFileUri'],'json':!![]})[_0x301d('0x16')](function(_0x420cf7){logger[_0x301d('0xa')](util['format'](_0x301d('0x17'),_0x4a666b['id']));if(_0x420cf7&&_0x420cf7[_0x301d('0x18')]&&_0x420cf7[_0x301d('0x18')][_0x301d('0x19')]&&_0x420cf7[_0x301d('0x18')][_0x301d('0x19')][_0x301d('0x1a')]){_0x4eb5eb['fileText']='';for(var _0x2f3b71=0x0;_0x2f3b71<_0x420cf7[_0x301d('0x18')][_0x301d('0x19')]['length'];_0x2f3b71++){_0x4eb5eb[_0x301d('0x13')]+=_0x420cf7[_0x301d('0x18')]['transcripts'][_0x2f3b71][_0x301d('0x1b')]+'';}}return _0x4a666b['update'](_0x4eb5eb);})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util['format'](_0x301d('0x1c'),_0x4a666b['id']));if(!_0x4a666b['tempSentiment']){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x1e'));}if(!_0x36a891[_0x301d('0x1f')]||!_0x36a891['sentimentAccountId']||!_0x36a891[_0x301d('0x20')]||!_0x36a891['language']||!_0x36a891['bucket']){throw new db['Sequelize'][(_0x301d('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4eb5eb[_0x301d('0x13')]){throw new Error(_0x301d('0x21'));}if(_0x36a891[_0x301d('0x22')]===_0x2d1684['id']){return _0x2d1684;}else{return db[_0x301d('0x23')][_0x301d('0x24')]({'where':{'id':_settings[_0x301d('0x22')]}});}})[_0x301d('0x16')](function(_0x1b1d83){if(!_0x1b1d83){throw new db['Sequelize'][(_0x301d('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1b1d83[_0x301d('0xc')]||!_0x1b1d83[_0x301d('0xd')]){throw new db['Sequelize']['ValidationError'](_0x301d('0x25'));}_0x467b08=_0x1b1d83;logger['info'](util[_0x301d('0xb')](_0x301d('0x26'),_0x4a666b['id']));return sentiment(_0x467b08[_0x301d('0xc')],_0x467b08[_0x301d('0xd')],_0x36a891[_0x301d('0x20')],_0x4eb5eb[_0x301d('0x13')],_0x36a891[_0x301d('0x27')]);})[_0x301d('0x16')](function(_0x6d751){logger[_0x301d('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4a666b['id']));return _0x4a666b['update']({'sentiment':_0x6d751[_0x301d('0x28')],'sPositive':_0x6d751[_0x301d('0x29')][_0x301d('0x2a')],'sNegative':_0x6d751['SentimentScore'][_0x301d('0x2b')],'sMixed':_0x6d751[_0x301d('0x29')][_0x301d('0x2c')],'sNeutral':_0x6d751['SentimentScore'][_0x301d('0x2d')]});})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util['format'](_0x301d('0x1c'),_0x4a666b['id']));_0x47cc84();});case _0x301d('0x2e'):return _0x4a666b[_0x301d('0x2f')]({'transcribeStatus':_0x301d('0x2e'),'failureReason':_0x4f0f10[_0x301d('0x11')][_0x301d('0x30')]})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util[_0x301d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4a666b['id']));_0x47cc84();});default:logger['info'](util[_0x301d('0xb')](_0x301d('0x31'),_0x4a666b['id']));break;}}else{return BPromise[_0x301d('0x32')]()[_0x301d('0x16')](function(){if(!_0x4a666b[_0x301d('0x33')]){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36a891[_0x301d('0x1f')]||!_0x36a891['sentimentAccountId']||!_0x36a891['sentimentRegion']||!_0x36a891[_0x301d('0x27')]||!_0x36a891['bucket']){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x35'));}if(!_0x4a666b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x36a891[_0x301d('0x22')]===_0x2d1684['id']){return _0x2d1684;}else{return db[_0x301d('0x23')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x301d('0x16')](function(_0x4c56a6){if(!_0x4c56a6){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x36'));}if(!_0x4c56a6[_0x301d('0xc')]||!_0x4c56a6[_0x301d('0xd')]){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x467b08=_0x4c56a6;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a666b['id']));return sentiment(_0x467b08[_0x301d('0xc')],_0x467b08[_0x301d('0xd')],_0x36a891[_0x301d('0x20')],_0x4a666b[_0x301d('0x13')],_0x36a891[_0x301d('0x27')]);})[_0x301d('0x16')](function(_0x57c90f){logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x37'),_0x4a666b['id']));return _0x4a666b[_0x301d('0x2f')]({'sentiment':_0x57c90f[_0x301d('0x28')],'sPositive':_0x57c90f[_0x301d('0x29')][_0x301d('0x2a')],'sNegative':_0x57c90f['SentimentScore'][_0x301d('0x2b')],'sMixed':_0x57c90f[_0x301d('0x29')][_0x301d('0x2c')],'sNeutral':_0x57c90f['SentimentScore'][_0x301d('0x2d')],'transcribeStatus':_0x301d('0x38')});})[_0x301d('0x16')](function(){logger[_0x301d('0xa')](util[_0x301d('0xb')](_0x301d('0x1c'),_0x4a666b['id']));_0x47cc84();});}})[_0x301d('0x39')](function(_0x415d54){if(_0x415d54){if(!_0x415d54['name']||_0x415d54[_0x301d('0x3a')]!==_0x301d('0x3b')){logger[_0x301d('0x3c')](util['format'](_0x301d('0x3d'),_0x4a666b['id']),util['inspect'](_0x415d54,{'showHidden':![],'depth':null}));}}_0x47cc84();});});}function checkTranscribe(){var _0x2b6fde;var _0x130e2a;var _0x58d3a9;return db['VoiceRecording'][_0x301d('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x301d('0x16')](function(_0x3bd320){if(!_0x3bd320||!_0x3bd320['length']){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x3f'));}_0x2b6fde=_0x3bd320;return db[_0x301d('0x40')][_0x301d('0x24')]({'where':{'id':0x1}});})[_0x301d('0x16')](function(_0x267630){if(!_0x267630){throw new db[(_0x301d('0x34'))][(_0x301d('0x1d'))](_0x301d('0x41'));}_0x130e2a=_0x267630;if(!_0x130e2a[_0x301d('0x42')]||!_0x130e2a[_0x301d('0x43')]||!_0x130e2a['transcribeRegion']||!_0x130e2a[_0x301d('0x27')]||!_0x130e2a[_0x301d('0x44')]){throw new db[(_0x301d('0x34'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x301d('0x23')][_0x301d('0x24')]({'where':{'id':_0x130e2a[_0x301d('0x43')]}});})[_0x301d('0x16')](function(_0x12d114){if(!_0x12d114){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x36'));}if(!_0x12d114[_0x301d('0xc')]||!_0x12d114[_0x301d('0xd')]){throw new db['Sequelize'][(_0x301d('0x1d'))](_0x301d('0x25'));}_0x58d3a9=_0x12d114;var _0x548c1e=[];_0x2b6fde[_0x301d('0x45')](function(_0x201718){_0x548c1e[_0x301d('0x46')](checkTranscribeJob(_0x201718,_0x130e2a,_0x58d3a9));});return BPromise[_0x301d('0x47')](_0x548c1e);})[_0x301d('0x39')](function(_0x32665c){if(_0x32665c){if(!_0x32665c[_0x301d('0x3a')]||_0x32665c['name']!==_0x301d('0x3b')){logger[_0x301d('0x3c')](util[_0x301d('0x48')](_0x32665c,{'showHidden':![],'depth':null}));}}});}exports[_0x301d('0x49')]=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 b91374d..01bb25d 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 _0x0fe0=['then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x35d134,_0x16d7b3){var _0x170083=function(_0x1285b4){while(--_0x1285b4){_0x35d134['push'](_0x35d134['shift']());}};_0x170083(++_0x16d7b3);}(_0x0fe0,0x6f));var _0x00fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fe0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x00fe('0x0'));var moment=require(_0x00fe('0x1'));var Redis=require(_0x00fe('0x2'));var util=require(_0x00fe('0x3'));var config=require(_0x00fe('0x4'));var db=require(_0x00fe('0x5'))['db'];var logger=require(_0x00fe('0x6'))(_0x00fe('0x7'));config[_0x00fe('0x8')]=_[_0x00fe('0x9')](config[_0x00fe('0x8')],{'host':_0x00fe('0xa'),'port':0x18eb});var io=require(_0x00fe('0xb'))(new Redis(config[_0x00fe('0x8')]));function closeInteractions(){var _0x36c393=[];return db[_0x00fe('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0x00fe('0xd')](function(_0x24e14d){if(_0x24e14d&&_0x24e14d[_0x00fe('0xe')]){_0x36c393=_[_0x00fe('0xf')](_0x24e14d||[],'id');logger['info'](_0x00fe('0x10'),_0x36c393['join']());return db[_0x00fe('0xc')][_0x00fe('0x11')]({'closeReason':_0x00fe('0x12'),'disposition':_0x00fe('0x13'),'closed':!![],'closedAt':moment()[_0x00fe('0x14')](_0x00fe('0x15'))},{'where':{'id':_0x36c393}});}})[_0x00fe('0xd')](function(){if(_0x36c393&&_0x36c393[_0x00fe('0xe')]){logger[_0x00fe('0x16')](_0x00fe('0x17'),_0x36c393[_0x00fe('0x18')]());for(var _0x5cd6f4=0x0;_0x5cd6f4<_0x36c393[_0x00fe('0xe')];_0x5cd6f4++){io[_0x00fe('0x19')](_0x00fe('0x1a'),{'id':_0x36c393[_0x5cd6f4],'closed':!![]});}}})[_0x00fe('0x1b')](function(_0x3db149){logger[_0x00fe('0x1c')](_0x00fe('0x1d'),_0x3db149?util['inspect'](_0x3db149,{'showHidden':![],'depth':null}):'');});}exports[_0x00fe('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6439=['localhost','socket.io-emitter','findAll','lastMsgAt','subtract','info','join','WhatsappInteraction','update','system','timeout','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x3afc9c,_0x2e8f9d){var _0x15821a=function(_0x5a14cc){while(--_0x5a14cc){_0x3afc9c['push'](_0x3afc9c['shift']());}};_0x15821a(++_0x2e8f9d);}(_0x6439,0x83));var _0x9643=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x6439[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var moment=require(_0x9643('0x0'));var Redis=require(_0x9643('0x1'));var util=require(_0x9643('0x2'));var config=require(_0x9643('0x3'));var db=require(_0x9643('0x4'))['db'];var logger=require(_0x9643('0x5'))(_0x9643('0x6'));config[_0x9643('0x7')]=_[_0x9643('0x8')](config[_0x9643('0x7')],{'host':_0x9643('0x9'),'port':0x18eb});var io=require(_0x9643('0xa'))(new Redis(config[_0x9643('0x7')]));function closeInteractions(){var _0x9e0a61=[];return db['WhatsappInteraction'][_0x9643('0xb')]({'raw':!![],'attributes':['id',_0x9643('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9643('0xd')](0x18,'hours')}}})['then'](function(_0x5a2870){if(_0x5a2870&&_0x5a2870['length']){_0x9e0a61=_['map'](_0x5a2870||[],'id');logger[_0x9643('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x9e0a61[_0x9643('0xf')]());return db[_0x9643('0x10')][_0x9643('0x11')]({'closeReason':_0x9643('0x12'),'disposition':_0x9643('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x9e0a61}});}})[_0x9643('0x14')](function(){if(_0x9e0a61&&_0x9e0a61['length']){logger['info'](_0x9643('0x15'),_0x9e0a61['join']());for(var _0x1d139e=0x0;_0x1d139e<_0x9e0a61['length'];_0x1d139e++){io[_0x9643('0x16')](_0x9643('0x17'),{'id':_0x9e0a61[_0x1d139e],'closed':!![]});}}})[_0x9643('0x18')](function(_0x8b7865){logger['error'](_0x9643('0x19'),_0x8b7865?util[_0x9643('0x1a')](_0x8b7865,{'showHidden':![],'depth':null}):'');});}exports[_0x9643('0x1b')]=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 8a64933..fe65a10 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3612=['CmHopper','hopper1','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','destroy'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x3612,0x8c));var _0x2361=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0x3612[_0x380b8f];return _0x646c69;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2361('0x0')]({'id':i,'firstName':_0x2361('0x1')+i,'lastName':_0x2361('0x2')+i,'phone':0xf879fb460+i,'email':_0x2361('0x3')+i+_0x2361('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2361('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2361('0x5')](),'updatedAt':Date[_0x2361('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x2361('0x1')+i,'lastName':_0x2361('0x2')+i,'phone':0xf879fb460+i,'email':_0x2361('0x3')+i+_0x2361('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2361('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2361('0x5')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0x2361('0x6')][_0x2361('0x7')](contacts);})[_0x2361('0x8')](function(){console[_0x2361('0x9')](_0x2361('0xa'),_0x2361('0xb'));return db['CmHopper'][_0x2361('0xc')]({'where':{}});})['then'](function(){return db[_0x2361('0xd')][_0x2361('0x7')](hopper);})[_0x2361('0x8')](function(){console[_0x2361('0x9')](_0x2361('0xa'),_0x2361('0xe'));return db[_0x2361('0x6')]['bulkCreate'](contacts2);})[_0x2361('0x8')](function(){console[_0x2361('0x9')]('finished\x20populating','contacts2');return db[_0x2361('0xd')][_0x2361('0x7')](hopper2);})[_0x2361('0x8')](function(){console[_0x2361('0x9')](_0x2361('0xa'),_0x2361('0xf'));})[_0x2361('0x10')](function(_0x573dfc){console[_0x2361('0x9')](_0x573dfc);}); \ No newline at end of file +var _0x4d78=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','then','bulkCreate','log'];(function(_0x2b88ab,_0x159bc0){var _0x317cce=function(_0xc3185b){while(--_0xc3185b){_0x2b88ab['push'](_0x2b88ab['shift']());}};_0x317cce(++_0x159bc0);}(_0x4d78,0x73));var _0x84d7=function(_0x21786f,_0x12ee47){_0x21786f=_0x21786f-0x0;var _0x335cee=_0x4d78[_0x21786f];return _0x335cee;};'use strict';var util=require('util');var db=require(_0x84d7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x84d7('0x1')+i,'phone':0xf879fb460+i,'email':_0x84d7('0x2')+i+_0x84d7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x84d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x84d7('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x84d7('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x84d7('0x1')+i,'phone':0xf879fb460+i,'email':_0x84d7('0x2')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x84d7('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x84d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x84d7('0x4')](),'updatedAt':Date[_0x84d7('0x4')]()});}db[_0x84d7('0x6')][_0x84d7('0x7')]({'where':{}})[_0x84d7('0x8')](function(){return db[_0x84d7('0x6')][_0x84d7('0x9')](contacts);})[_0x84d7('0x8')](function(){console[_0x84d7('0xa')](_0x84d7('0xb'),_0x84d7('0xc'));return db[_0x84d7('0xd')][_0x84d7('0x7')]({'where':{}});})[_0x84d7('0x8')](function(){return db['CmHopper'][_0x84d7('0x9')](hopper);})[_0x84d7('0x8')](function(){console[_0x84d7('0xa')](_0x84d7('0xb'),_0x84d7('0xe'));return db[_0x84d7('0x6')][_0x84d7('0x9')](contacts2);})['then'](function(){console['log'](_0x84d7('0xb'),_0x84d7('0xf'));return db[_0x84d7('0xd')][_0x84d7('0x9')](hopper2);})['then'](function(){console[_0x84d7('0xa')](_0x84d7('0xb'),_0x84d7('0x10'));})[_0x84d7('0x11')](function(_0x44845e){console['log'](_0x44845e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 40c4789..cfcc419 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bc8=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass'];(function(_0x326f66,_0x4e0965){var _0x25fd6a=function(_0x5b3233){while(--_0x5b3233){_0x326f66['push'](_0x326f66['shift']());}};_0x25fd6a(++_0x4e0965);}(_0x9bc8,0x1f4));var _0x89bc=function(_0x3365e8,_0x32cb9c){_0x3365e8=_0x3365e8-0x0;var _0x163494=_0x9bc8[_0x3365e8];return _0x163494;};'use strict';var util=require(_0x89bc('0x0'));var db=require(_0x89bc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x89bc('0x2')](_0x89bc('0x3'),_0x89bc('0x4'),i),'fullname':util['format']('%s%s',_0x89bc('0x4'),i),'email':util[_0x89bc('0x2')](_0x89bc('0x5'),_0x89bc('0x4'),i),'role':_0x89bc('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x89bc('0x6'),'ws',_0x89bc('0x7')],'disallow':[_0x89bc('0x8')],'allow':[_0x89bc('0x9')],'defaultuser':util[_0x89bc('0x2')]('%s%s','agent',i),'encryption':_0x89bc('0xa'),'avpf':_0x89bc('0xa'),'force_avp':_0x89bc('0xa'),'icesupport':_0x89bc('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x89bc('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x89bc('0xc'),'callerid':util[_0x89bc('0x2')](_0x89bc('0xd'),util['format']('%s%s',_0x89bc('0x4'),i),0xfa0+i)});}db[_0x89bc('0xe')][_0x89bc('0xf')](users)[_0x89bc('0x10')](function(){console[_0x89bc('0x11')](_0x89bc('0x12'));})['catch'](function(_0x20a56a){console['log'](_0x20a56a);}); \ No newline at end of file +var _0xebd1=['udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','friend'];(function(_0x3a8675,_0x1c70aa){var _0x532c07=function(_0x51d727){while(--_0x51d727){_0x3a8675['push'](_0x3a8675['shift']());}};_0x532c07(++_0x1c70aa);}(_0xebd1,0xb8));var _0x1ebd=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xebd1[_0xabfec4];return _0x7bafa2;};'use strict';var util=require('util');var db=require(_0x1ebd('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1ebd('0x1')]({'name':util[_0x1ebd('0x2')](_0x1ebd('0x3'),'agent',i),'fullname':util[_0x1ebd('0x2')](_0x1ebd('0x3'),_0x1ebd('0x4'),i),'email':util[_0x1ebd('0x2')]('%s%s@xcally.com','agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x1ebd('0x5'),'transport':[_0x1ebd('0x6'),'ws',_0x1ebd('0x7')],'disallow':['all'],'allow':[_0x1ebd('0x8')],'defaultuser':util['format'](_0x1ebd('0x3'),'agent',i),'encryption':_0x1ebd('0x9'),'avpf':_0x1ebd('0x9'),'force_avp':_0x1ebd('0x9'),'icesupport':'yes','dtlsenable':_0x1ebd('0x9'),'dtlsverify':'no','dtlscertfile':_0x1ebd('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1ebd('0xb'),'callerid':util['format'](_0x1ebd('0xc'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0x1ebd('0xd')][_0x1ebd('0xe')](users)[_0x1ebd('0xf')](function(){console[_0x1ebd('0x10')](_0x1ebd('0x11'));})[_0x1ebd('0x12')](function(_0x329118){console[_0x1ebd('0x10')](_0x329118);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c856ec7..43153c9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ebb=['OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','sms','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','request','remoteAddress','remotePort','nsp','address','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','User','Campaign','where','ivr','then','format','%s:queue:%s','length','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x3ce118,_0x3553ac){var _0x1901dd=function(_0x3f428d){while(--_0x3f428d){_0x3ce118['push'](_0x3ce118['shift']());}};_0x1901dd(++_0x3553ac);}(_0x7ebb,0x161));var _0xb7eb=function(_0x144914,_0x32ccc8){_0x144914=_0x144914-0x0;var _0x2f7da8=_0x7ebb[_0x144914];return _0x2f7da8;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var BPromise=require(_0xb7eb('0x2'));var db=require(_0xb7eb('0x3'))['db'];var config=require(_0xb7eb('0x4'));var queryQueues={'attributes':['id',_0xb7eb('0x5')],'include':[{'as':_0xb7eb('0x6'),'model':db['User'],'attributes':['id',_0xb7eb('0x5'),_0xb7eb('0x7')],'raw':!![],'where':{'role':_0xb7eb('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb7eb('0x5')],'where':{'role':_0xb7eb('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb7eb('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xb7eb('0x5')],'where':{'role':_0xb7eb('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb7eb('0x5'),_0xb7eb('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x50957f,_0x2591f5,_0xb669b9){return db[_0xb7eb('0xb')][_0xb7eb('0xc')]({'where':{'name':_0x50957f,'userProfileId':_0x2591f5},'raw':!![]})['then'](function(_0x2b0e89){if(_0x2b0e89){if(_0x2b0e89[_0xb7eb('0xd')]){switch(_0x50957f){case'VoiceQueues':case _0xb7eb('0xe'):case _0xb7eb('0xf'):case _0xb7eb('0x10'):case _0xb7eb('0x11'):case _0xb7eb('0x12'):case _0xb7eb('0x13'):return db[_0xb669b9][_0xb7eb('0x14')](queryQueues);case'Telephones':return db[_0xb669b9][_0xb7eb('0x14')](queryTelephones);case _0xb7eb('0x15'):return db[_0xb669b9][_0xb7eb('0x14')](queryTrunks);case'IvrCampaigns':return db[_0xb669b9][_0xb7eb('0x14')](queryCampaigns);}}else{return db[_0xb7eb('0x16')][_0xb7eb('0x14')]({'attributes':[_0xb7eb('0x17')],'where':{'sectionId':_0x2b0e89['id']},'raw':!![]})['then'](function(_0x348cc5){if(_0x348cc5){var _0x55c850={'where':{'id':_[_0xb7eb('0x18')](_0x348cc5,_0xb7eb('0x17'))},'raw':!![]};switch(_0xb669b9){case _0xb7eb('0x19'):_0x55c850['where'][_0xb7eb('0x7')]=_0xb7eb('0x9');break;case _0xb7eb('0x1a'):_0x55c850[_0xb7eb('0x1b')]['type']=_0xb7eb('0x1c');break;}return db[_0xb669b9]['findAll'](_0x55c850);}else{return[];}});}}else{return[];}})[_0xb7eb('0x1d')](function(_0xb50692){return _0xb50692;});}function joinOrLeaveQueues(_0x4b74f3,_0xd0ca41,_0x5ae156,_0x2d785a){_0x4b74f3[_0xd0ca41](util[_0xb7eb('0x1e')](_0xb7eb('0x1f'),_0x5ae156,_0x2d785a[_0xb7eb('0x5')]));if(_0x2d785a[_0xb7eb('0x6')]){for(var _0x36beb6=0x0;_0x36beb6<_0x2d785a[_0xb7eb('0x6')][_0xb7eb('0x20')];_0x36beb6+=0x1){_0x4b74f3[_0xd0ca41](util[_0xb7eb('0x1e')]('user:%s',_0x2d785a['Agents'][_0x36beb6][_0xb7eb('0x5')]));}}}function joinOrLeave(_0x2a3aad,_0x3ad448,_0x29e197){var _0x68c3d0;if(_0x2a3aad['handshake'][_0xb7eb('0x21')]['id']){db[_0xb7eb('0x19')][_0xb7eb('0x22')]({'attributes':['id',_0xb7eb('0x5'),'role',_0xb7eb('0x23')],'where':{'id':_0x2a3aad['handshake'][_0xb7eb('0x21')]['id']},'include':[{'model':db[_0xb7eb('0x24')],'as':_0xb7eb('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb7eb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb7eb('0x27')],'as':_0xb7eb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb7eb('0x29')],'as':_0xb7eb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xb7eb('0x2b')],'as':_0xb7eb('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xb7eb('0x2d')],'as':_0xb7eb('0x2e'),'attributes':['id'],'raw':!![]}]})[_0xb7eb('0x1d')](function(_0xc68143){if(_0xc68143){_0x68c3d0=_0xc68143;_0x2a3aad[_0x3ad448](util[_0xb7eb('0x1e')](_0xb7eb('0x2f'),_0xc68143['name']));var _0x1684c4=[];switch(_0xc68143['role']){case _0xb7eb('0x30'):_0x2a3aad[_0x3ad448]('voice:inbound');_0x2a3aad[_0x3ad448](_0xb7eb('0x31'));if(queryQueues[_0xb7eb('0x32')]('include')){delete queryQueues[_0xb7eb('0x33')];}_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x35')]['findAll'](queryQueues));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x36')][_0xb7eb('0x14')](queryQueues));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x37')][_0xb7eb('0x14')](queryQueues));_0x1684c4['push'](db[_0xb7eb('0x38')][_0xb7eb('0x14')](queryQueues));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x39')]['findAll'](queryQueues));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x3a')]['findAll'](queryQueues));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x3b')][_0xb7eb('0x14')](queryQueues));_0x1684c4['push'](db[_0xb7eb('0x19')]['findAll'](queryTelephones));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x3c')][_0xb7eb('0x14')](queryTrunks));_0x1684c4[_0xb7eb('0x34')](db['Campaign']['findAll'](queryCampaigns));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x19')]['findAll'](queryAgents));break;case _0xb7eb('0x3d'):_0x2a3aad[_0x3ad448](_0xb7eb('0x3e'));_0x2a3aad[_0x3ad448](_0xb7eb('0x31'));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources(_0xb7eb('0x3f'),_0xc68143[_0xb7eb('0x23')],_0xb7eb('0x35')));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources('ChatQueues',_0xc68143[_0xb7eb('0x23')],'ChatQueue'));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources(_0xb7eb('0xf'),_0xc68143[_0xb7eb('0x23')],_0xb7eb('0x37')));_0x1684c4['push'](getAssociatedResources(_0xb7eb('0x10'),_0xc68143[_0xb7eb('0x23')],_0xb7eb('0x38')));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources(_0xb7eb('0x11'),_0xc68143['userProfileId'],_0xb7eb('0x39')));_0x1684c4['push'](getAssociatedResources(_0xb7eb('0x12'),_0xc68143[_0xb7eb('0x23')],'OpenchannelQueue'));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources(_0xb7eb('0x13'),_0xc68143[_0xb7eb('0x23')],_0xb7eb('0x3b')));_0x1684c4['push'](getAssociatedResources('Telephones',_0xc68143['userProfileId'],_0xb7eb('0x19')));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources(_0xb7eb('0x15'),_0xc68143[_0xb7eb('0x23')],_0xb7eb('0x3c')));_0x1684c4[_0xb7eb('0x34')](getAssociatedResources('IvrCampaigns',_0xc68143[_0xb7eb('0x23')],'Campaign'));_0x1684c4[_0xb7eb('0x34')](db[_0xb7eb('0x19')][_0xb7eb('0x14')](queryAgents));break;case'agent':_0x2a3aad[_0x3ad448](_0xb7eb('0x3e'));_0x2a3aad[_0x3ad448](_0xb7eb('0x31'));_0x1684c4[_0xb7eb('0x34')](_0xc68143['getVoiceQueues']({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x40')]({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x41')]({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x42')]({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x43')]({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x44')]({'attributes':['id',_0xb7eb('0x5')]}));_0x1684c4[_0xb7eb('0x34')](_0xc68143[_0xb7eb('0x45')]({'attributes':['id',_0xb7eb('0x5')]}));break;}return BPromise['all'](_0x1684c4);}})[_0xb7eb('0x1d')](function(_0x1e9d33){if(_0x1e9d33&&_0x1e9d33[_0xb7eb('0x20')]){for(var _0x359bd7=0x0;_0x359bd7<_0x1e9d33[_0xb7eb('0x20')];_0x359bd7+=0x1){for(var _0x50799a=0x0;_0x50799a<_0x1e9d33[_0x359bd7][_0xb7eb('0x20')];_0x50799a+=0x1){switch(_0x359bd7){case 0x0:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,_0xb7eb('0x46'),_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x1:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,'chat',_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x2:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,_0xb7eb('0x47'),_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x3:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,_0xb7eb('0x48'),_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x4:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,'mail',_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x5:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,'openchannel',_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x6:joinOrLeaveQueues(_0x2a3aad,_0x3ad448,_0xb7eb('0x49'),_0x1e9d33[_0x359bd7][_0x50799a]);break;case 0x7:if(_0x68c3d0[_0xb7eb('0x7')]!==_0xb7eb('0x8'))_0x2a3aad[_0x3ad448](util[_0xb7eb('0x1e')](_0xb7eb('0x4a'),_0x1e9d33[_0x359bd7][_0x50799a][_0xb7eb('0x5')]));break;case 0x8:if(_0x68c3d0[_0xb7eb('0x7')]!=='agent')_0x2a3aad[_0x3ad448](util[_0xb7eb('0x1e')](_0xb7eb('0x4b'),_0x1e9d33[_0x359bd7][_0x50799a]['name']));break;case 0x9:if(_0x68c3d0[_0xb7eb('0x7')]!=='agent')_0x2a3aad[_0x3ad448](util['format']('campaign:%s:%s',_0x1e9d33[_0x359bd7][_0x50799a][_0xb7eb('0xa')],_0x1e9d33[_0x359bd7][_0x50799a][_0xb7eb('0x5')]));break;case 0xa:_0x2a3aad[_0x3ad448](util['format']('user:%s',_0x1e9d33[_0x359bd7][_0x50799a][_0xb7eb('0x5')]));break;}}}}})[_0xb7eb('0x1d')](function(){if(_0x3ad448===_0xb7eb('0x4c')){var _0x1c43dd=_[_0xb7eb('0x18')](_0x68c3d0[_0xb7eb('0x25')],'id');return _0x68c3d0[_0xb7eb('0x4d')](_0x1c43dd)[_0xb7eb('0x1d')](function(){for(var _0xc47bc9=0x0;_0xc47bc9<_0x1c43dd[_0xb7eb('0x20')];_0xc47bc9+=0x1){_0x29e197['emit'](_0xb7eb('0x4e'),{'ChatInteractionId':Number(_0x1c43dd[_0xc47bc9]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x1d')](function(){if(_0x3ad448==='leave'){var _0x15f78b=_[_0xb7eb('0x18')](_0x68c3d0[_0xb7eb('0x26')],'id');return _0x68c3d0[_0xb7eb('0x4f')](_0x15f78b)['then'](function(){for(var _0x19ab62=0x0;_0x19ab62<_0x15f78b[_0xb7eb('0x20')];_0x19ab62+=0x1){_0x29e197[_0xb7eb('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x15f78b[_0x19ab62]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x1d')](function(){if(_0x3ad448===_0xb7eb('0x4c')){var _0x4fd83f=_[_0xb7eb('0x18')](_0x68c3d0[_0xb7eb('0x28')],'id');return _0x68c3d0[_0xb7eb('0x51')](_0x4fd83f)['then'](function(){for(var _0x4a4f25=0x0;_0x4a4f25<_0x4fd83f['length'];_0x4a4f25+=0x1){_0x29e197[_0xb7eb('0x50')](_0xb7eb('0x52'),{'FaxInteractionId':Number(_0x4fd83f[_0x4a4f25]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x1d')](function(){if(_0x3ad448===_0xb7eb('0x4c')){var _0x5ef4c0=_['map'](_0x68c3d0[_0xb7eb('0x2a')],'id');return _0x68c3d0[_0xb7eb('0x53')](_0x5ef4c0)[_0xb7eb('0x1d')](function(){for(var _0x97dbf5=0x0;_0x97dbf5<_0x5ef4c0['length'];_0x97dbf5+=0x1){_0x29e197[_0xb7eb('0x50')](_0xb7eb('0x54'),{'SmsInteractionId':Number(_0x5ef4c0[_0x97dbf5]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x1d')](function(){if(_0x3ad448===_0xb7eb('0x4c')){var _0x24d251=_[_0xb7eb('0x18')](_0x68c3d0[_0xb7eb('0x2c')],'id');return _0x68c3d0[_0xb7eb('0x55')](_0x24d251)[_0xb7eb('0x1d')](function(){for(var _0x7a4adb=0x0;_0x7a4adb<_0x24d251['length'];_0x7a4adb+=0x1){_0x29e197[_0xb7eb('0x50')](_0xb7eb('0x56'),{'OpenchannelInteractionId':Number(_0x24d251[_0x7a4adb]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x1d')](function(){if(_0x3ad448===_0xb7eb('0x4c')){var _0x30ef5c=_['map'](_0x68c3d0[_0xb7eb('0x2e')],'id');return _0x68c3d0['removeWhatsappInteractions'](_0x30ef5c)[_0xb7eb('0x1d')](function(){for(var _0x38dc1c=0x0;_0x38dc1c<_0x30ef5c[_0xb7eb('0x20')];_0x38dc1c+=0x1){_0x29e197[_0xb7eb('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x30ef5c[_0x38dc1c]),'UserId':Number(_0x68c3d0['id'])});}});}})[_0xb7eb('0x57')](function(_0x1ac588){_0x2a3aad[_0xb7eb('0x58')](_0x1ac588);});}}function onDisconnect(_0x383735,_0x19589e){joinOrLeave(_0x383735,_0xb7eb('0x4c'),_0x19589e);}function onConnect(_0x3e72aa){joinOrLeave(_0x3e72aa,'join');}exports[_0xb7eb('0x59')]=function(_0x4a209c){_0x4a209c['on'](_0xb7eb('0x5a'),function(_0x290923){_0x290923[_0xb7eb('0x5b')](0x0);_0x290923['address']=_0x290923[_0xb7eb('0x5c')][_0xb7eb('0x5a')][_0xb7eb('0x5d')]+':'+_0x290923[_0xb7eb('0x5c')]['connection'][_0xb7eb('0x5e')];_0x290923['connectedAt']=new Date();_0x290923['log']=function(_0x2a8db2){console['log']('SocketIO\x20'+_0x290923[_0xb7eb('0x5f')]['name']+'['+_0x290923[_0xb7eb('0x60')]+']',_0x2a8db2);};_0x290923['on'](_0xb7eb('0x61'),function(){onDisconnect(_0x290923,_0x4a209c);_0x290923[_0xb7eb('0x58')](_0xb7eb('0x62'));});onConnect(_0x290923);_0x290923['log']('CONNECTED');});}; \ No newline at end of file +var _0x3174=['getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','removeChatInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueue','ChatQueues','FaxQueues','FaxQueue','voice:inbound','getVoiceQueues','getChatQueues'];(function(_0x5cd550,_0x595319){var _0x27af75=function(_0x359328){while(--_0x359328){_0x5cd550['push'](_0x5cd550['shift']());}};_0x27af75(++_0x595319);}(_0x3174,0x154));var _0x4317=function(_0x6b8ce4,_0x26fda5){_0x6b8ce4=_0x6b8ce4-0x0;var _0xef1dcb=_0x3174[_0x6b8ce4];return _0xef1dcb;};'use strict';var _=require(_0x4317('0x0'));var util=require('util');var BPromise=require(_0x4317('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4317('0x2')],'include':[{'as':_0x4317('0x3'),'model':db[_0x4317('0x4')],'attributes':['id',_0x4317('0x2'),_0x4317('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4317('0x2')],'where':{'role':_0x4317('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4317('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x4317('0x2')],'where':{'role':_0x4317('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4317('0x2'),'type'],'where':{'type':_0x4317('0x8')}};function getAssociatedResources(_0x276584,_0x215b55,_0x5d921f){return db[_0x4317('0x9')][_0x4317('0xa')]({'where':{'name':_0x276584,'userProfileId':_0x215b55},'raw':!![]})[_0x4317('0xb')](function(_0x2ec85e){if(_0x2ec85e){if(_0x2ec85e[_0x4317('0xc')]){switch(_0x276584){case _0x4317('0xd'):case'ChatQueues':case'FaxQueues':case _0x4317('0xe'):case _0x4317('0xf'):case _0x4317('0x10'):case _0x4317('0x11'):return db[_0x5d921f][_0x4317('0x12')](queryQueues);case _0x4317('0x13'):return db[_0x5d921f][_0x4317('0x12')](queryTelephones);case _0x4317('0x14'):return db[_0x5d921f][_0x4317('0x12')](queryTrunks);case _0x4317('0x15'):return db[_0x5d921f][_0x4317('0x12')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x4317('0x16')],'where':{'sectionId':_0x2ec85e['id']},'raw':!![]})[_0x4317('0xb')](function(_0x129e54){if(_0x129e54){var _0x1c77a7={'where':{'id':_[_0x4317('0x17')](_0x129e54,_0x4317('0x16'))},'raw':!![]};switch(_0x5d921f){case _0x4317('0x4'):_0x1c77a7[_0x4317('0x18')][_0x4317('0x5')]=_0x4317('0x6');break;case _0x4317('0x19'):_0x1c77a7['where']['type']=_0x4317('0x8');break;}return db[_0x5d921f][_0x4317('0x12')](_0x1c77a7);}else{return[];}});}}else{return[];}})[_0x4317('0xb')](function(_0xb69eaa){return _0xb69eaa;});}function joinOrLeaveQueues(_0x48bb1c,_0x2584b9,_0x33ee25,_0x1ff241){_0x48bb1c[_0x2584b9](util[_0x4317('0x1a')](_0x4317('0x1b'),_0x33ee25,_0x1ff241[_0x4317('0x2')]));if(_0x1ff241[_0x4317('0x3')]){for(var _0x2fb358=0x0;_0x2fb358<_0x1ff241[_0x4317('0x3')]['length'];_0x2fb358+=0x1){_0x48bb1c[_0x2584b9](util[_0x4317('0x1a')](_0x4317('0x1c'),_0x1ff241[_0x4317('0x3')][_0x2fb358]['name']));}}}function joinOrLeave(_0x1b229f,_0x5eaae0,_0x14a5ce){var _0x54da2c;if(_0x1b229f['handshake'][_0x4317('0x1d')]['id']){db[_0x4317('0x4')][_0x4317('0x1e')]({'attributes':['id',_0x4317('0x2'),_0x4317('0x5'),_0x4317('0x1f')],'where':{'id':_0x1b229f[_0x4317('0x20')][_0x4317('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x4317('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4317('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4317('0x23')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4317('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x4317('0x25')],'as':_0x4317('0x26'),'attributes':['id'],'raw':!![]}]})[_0x4317('0xb')](function(_0x21b3fb){if(_0x21b3fb){_0x54da2c=_0x21b3fb;_0x1b229f[_0x5eaae0](util['format'](_0x4317('0x1c'),_0x21b3fb['name']));var _0x2799bd=[];switch(_0x21b3fb[_0x4317('0x5')]){case _0x4317('0x27'):_0x1b229f[_0x5eaae0]('voice:inbound');_0x1b229f[_0x5eaae0](_0x4317('0x28'));if(queryQueues['hasOwnProperty'](_0x4317('0x29'))){delete queryQueues[_0x4317('0x29')];}_0x2799bd[_0x4317('0x2a')](db['VoiceQueue'][_0x4317('0x12')](queryQueues));_0x2799bd['push'](db[_0x4317('0x2b')]['findAll'](queryQueues));_0x2799bd[_0x4317('0x2a')](db['FaxQueue'][_0x4317('0x12')](queryQueues));_0x2799bd['push'](db[_0x4317('0x2c')]['findAll'](queryQueues));_0x2799bd['push'](db[_0x4317('0x2d')]['findAll'](queryQueues));_0x2799bd[_0x4317('0x2a')](db[_0x4317('0x2e')][_0x4317('0x12')](queryQueues));_0x2799bd['push'](db[_0x4317('0x2f')][_0x4317('0x12')](queryQueues));_0x2799bd['push'](db['User']['findAll'](queryTelephones));_0x2799bd[_0x4317('0x2a')](db[_0x4317('0x30')]['findAll'](queryTrunks));_0x2799bd[_0x4317('0x2a')](db[_0x4317('0x19')][_0x4317('0x12')](queryCampaigns));_0x2799bd[_0x4317('0x2a')](db[_0x4317('0x4')][_0x4317('0x12')](queryAgents));break;case'user':_0x1b229f[_0x5eaae0]('voice:inbound');_0x1b229f[_0x5eaae0](_0x4317('0x28'));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0xd'),_0x21b3fb['userProfileId'],_0x4317('0x31')));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x32'),_0x21b3fb[_0x4317('0x1f')],'ChatQueue'));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x33'),_0x21b3fb[_0x4317('0x1f')],_0x4317('0x34')));_0x2799bd['push'](getAssociatedResources('SmsQueues',_0x21b3fb[_0x4317('0x1f')],'SmsQueue'));_0x2799bd['push'](getAssociatedResources(_0x4317('0xf'),_0x21b3fb[_0x4317('0x1f')],_0x4317('0x2d')));_0x2799bd['push'](getAssociatedResources(_0x4317('0x10'),_0x21b3fb['userProfileId'],_0x4317('0x2e')));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x11'),_0x21b3fb[_0x4317('0x1f')],_0x4317('0x2f')));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x13'),_0x21b3fb[_0x4317('0x1f')],_0x4317('0x4')));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x14'),_0x21b3fb[_0x4317('0x1f')],'Trunk'));_0x2799bd[_0x4317('0x2a')](getAssociatedResources(_0x4317('0x15'),_0x21b3fb[_0x4317('0x1f')],_0x4317('0x19')));_0x2799bd[_0x4317('0x2a')](db[_0x4317('0x4')][_0x4317('0x12')](queryAgents));break;case _0x4317('0x7'):_0x1b229f[_0x5eaae0](_0x4317('0x35'));_0x1b229f[_0x5eaae0]('voice:outbound');_0x2799bd['push'](_0x21b3fb[_0x4317('0x36')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd['push'](_0x21b3fb[_0x4317('0x37')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd[_0x4317('0x2a')](_0x21b3fb[_0x4317('0x38')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd[_0x4317('0x2a')](_0x21b3fb[_0x4317('0x39')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd['push'](_0x21b3fb[_0x4317('0x3a')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd[_0x4317('0x2a')](_0x21b3fb[_0x4317('0x3b')]({'attributes':['id',_0x4317('0x2')]}));_0x2799bd[_0x4317('0x2a')](_0x21b3fb[_0x4317('0x3c')]({'attributes':['id',_0x4317('0x2')]}));break;}return BPromise['all'](_0x2799bd);}})[_0x4317('0xb')](function(_0x56aaba){if(_0x56aaba&&_0x56aaba[_0x4317('0x3d')]){for(var _0x45985f=0x0;_0x45985f<_0x56aaba[_0x4317('0x3d')];_0x45985f+=0x1){for(var _0x404bab=0x0;_0x404bab<_0x56aaba[_0x45985f][_0x4317('0x3d')];_0x404bab+=0x1){switch(_0x45985f){case 0x0:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x3e'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x1:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,'chat',_0x56aaba[_0x45985f][_0x404bab]);break;case 0x2:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x3f'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x3:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x40'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x4:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x41'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x5:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x42'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x6:joinOrLeaveQueues(_0x1b229f,_0x5eaae0,_0x4317('0x43'),_0x56aaba[_0x45985f][_0x404bab]);break;case 0x7:if(_0x54da2c[_0x4317('0x5')]!==_0x4317('0x7'))_0x1b229f[_0x5eaae0](util['format'](_0x4317('0x44'),_0x56aaba[_0x45985f][_0x404bab][_0x4317('0x2')]));break;case 0x8:if(_0x54da2c[_0x4317('0x5')]!=='agent')_0x1b229f[_0x5eaae0](util[_0x4317('0x1a')](_0x4317('0x45'),_0x56aaba[_0x45985f][_0x404bab][_0x4317('0x2')]));break;case 0x9:if(_0x54da2c['role']!==_0x4317('0x7'))_0x1b229f[_0x5eaae0](util[_0x4317('0x1a')](_0x4317('0x46'),_0x56aaba[_0x45985f][_0x404bab][_0x4317('0x47')],_0x56aaba[_0x45985f][_0x404bab][_0x4317('0x2')]));break;case 0xa:_0x1b229f[_0x5eaae0](util[_0x4317('0x1a')]('user:%s',_0x56aaba[_0x45985f][_0x404bab][_0x4317('0x2')]));break;}}}}})[_0x4317('0xb')](function(){if(_0x5eaae0===_0x4317('0x48')){var _0x2aacc2=_[_0x4317('0x17')](_0x54da2c[_0x4317('0x21')],'id');return _0x54da2c[_0x4317('0x49')](_0x2aacc2)[_0x4317('0xb')](function(){for(var _0x3aa6f1=0x0;_0x3aa6f1<_0x2aacc2[_0x4317('0x3d')];_0x3aa6f1+=0x1){_0x14a5ce['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2aacc2[_0x3aa6f1]),'UserId':Number(_0x54da2c['id'])});}});}})[_0x4317('0xb')](function(){if(_0x5eaae0===_0x4317('0x48')){var _0x12097f=_['map'](_0x54da2c[_0x4317('0x22')],'id');return _0x54da2c[_0x4317('0x4a')](_0x12097f)[_0x4317('0xb')](function(){for(var _0x21df55=0x0;_0x21df55<_0x12097f['length'];_0x21df55+=0x1){_0x14a5ce[_0x4317('0x4b')](_0x4317('0x4c'),{'MailInteractionId':Number(_0x12097f[_0x21df55]),'UserId':Number(_0x54da2c['id'])});}});}})[_0x4317('0xb')](function(){if(_0x5eaae0===_0x4317('0x48')){var _0x213920=_[_0x4317('0x17')](_0x54da2c[_0x4317('0x4d')],'id');return _0x54da2c[_0x4317('0x4e')](_0x213920)[_0x4317('0xb')](function(){for(var _0x1b8da8=0x0;_0x1b8da8<_0x213920[_0x4317('0x3d')];_0x1b8da8+=0x1){_0x14a5ce[_0x4317('0x4b')](_0x4317('0x4f'),{'FaxInteractionId':Number(_0x213920[_0x1b8da8]),'UserId':Number(_0x54da2c['id'])});}});}})[_0x4317('0xb')](function(){if(_0x5eaae0===_0x4317('0x48')){var _0x2f9a1c=_[_0x4317('0x17')](_0x54da2c[_0x4317('0x50')],'id');return _0x54da2c['removeSmsInteractions'](_0x2f9a1c)[_0x4317('0xb')](function(){for(var _0x63b338=0x0;_0x63b338<_0x2f9a1c['length'];_0x63b338+=0x1){_0x14a5ce[_0x4317('0x4b')](_0x4317('0x51'),{'SmsInteractionId':Number(_0x2f9a1c[_0x63b338]),'UserId':Number(_0x54da2c['id'])});}});}})['then'](function(){if(_0x5eaae0==='leave'){var _0x1eb7a9=_[_0x4317('0x17')](_0x54da2c[_0x4317('0x24')],'id');return _0x54da2c[_0x4317('0x52')](_0x1eb7a9)[_0x4317('0xb')](function(){for(var _0x85b71a=0x0;_0x85b71a<_0x1eb7a9[_0x4317('0x3d')];_0x85b71a+=0x1){_0x14a5ce[_0x4317('0x4b')](_0x4317('0x53'),{'OpenchannelInteractionId':Number(_0x1eb7a9[_0x85b71a]),'UserId':Number(_0x54da2c['id'])});}});}})[_0x4317('0xb')](function(){if(_0x5eaae0===_0x4317('0x48')){var _0x2039dc=_[_0x4317('0x17')](_0x54da2c[_0x4317('0x26')],'id');return _0x54da2c[_0x4317('0x54')](_0x2039dc)[_0x4317('0xb')](function(){for(var _0x414cb8=0x0;_0x414cb8<_0x2039dc[_0x4317('0x3d')];_0x414cb8+=0x1){_0x14a5ce[_0x4317('0x4b')](_0x4317('0x55'),{'WhatsappInteractionId':Number(_0x2039dc[_0x414cb8]),'UserId':Number(_0x54da2c['id'])});}});}})['catch'](function(_0x3ea911){_0x1b229f[_0x4317('0x56')](_0x3ea911);});}}function onDisconnect(_0x471142,_0x109b3c){joinOrLeave(_0x471142,_0x4317('0x48'),_0x109b3c);}function onConnect(_0x1cd10d){joinOrLeave(_0x1cd10d,_0x4317('0x57'));}exports[_0x4317('0x58')]=function(_0x22ae30){_0x22ae30['on'](_0x4317('0x59'),function(_0x25a892){_0x25a892['setMaxListeners'](0x0);_0x25a892[_0x4317('0x5a')]=_0x25a892[_0x4317('0x5b')]['connection'][_0x4317('0x5c')]+':'+_0x25a892[_0x4317('0x5b')][_0x4317('0x59')][_0x4317('0x5d')];_0x25a892[_0x4317('0x5e')]=new Date();_0x25a892[_0x4317('0x56')]=function(_0x309987){console[_0x4317('0x56')](_0x4317('0x5f')+_0x25a892['nsp'][_0x4317('0x2')]+'['+_0x25a892[_0x4317('0x5a')]+']',_0x309987);};_0x25a892['on'](_0x4317('0x60'),function(){onDisconnect(_0x25a892,_0x22ae30);_0x25a892[_0x4317('0x56')](_0x4317('0x61'));});onConnect(_0x25a892);_0x25a892[_0x4317('0x56')](_0x4317('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f830f32..880bbf2 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 _0xd649=['SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','resolve','sequelize','format','AfterCreate','closed','substatus','User','find','fullname','email','internal','hasOwnProperty','model','callback','toLowerCase','util','jayson/promise','../logger','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface'];(function(_0x501f11,_0xccc33b){var _0x44299a=function(_0x461335){while(--_0x461335){_0x501f11['push'](_0x501f11['shift']());}};_0x44299a(++_0xccc33b);}(_0xd649,0x17a));var _0x9d64=function(_0x82f528,_0x3d241c){_0x82f528=_0x82f528-0x0;var _0x1a0292=_0xd649[_0x82f528];return _0x1a0292;};'use strict';var util=require(_0x9d64('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9d64('0x1'));var logger=require(_0x9d64('0x2'))('triggers');var client=jayson['client'][_0x9d64('0x3')]({'port':0x232a});var triggers=[{'channel':_0x9d64('0x4'),'model':_0x9d64('0x5'),'event':_0x9d64('0x6'),'condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':_0x9d64('0x4'),'model':_0x9d64('0x5'),'event':_0x9d64('0x8'),'condition':_0x9d64('0x9'),'callback':afterUpdate},{'channel':_0x9d64('0x4'),'model':_0x9d64('0xa'),'event':'afterCreate','condition':_0x9d64('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x9d64('0xc'),'event':_0x9d64('0x6'),'condition':_0x9d64('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x9d64('0xd'),'model':_0x9d64('0xe'),'event':'afterCreate','condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x9d64('0xe'),'event':_0x9d64('0x8'),'condition':_0x9d64('0x9'),'callback':afterUpdate},{'channel':_0x9d64('0xd'),'model':_0x9d64('0xf'),'event':'afterCreate','condition':_0x9d64('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x9d64('0x10'),'event':_0x9d64('0x6'),'condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':_0x9d64('0x11'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x9d64('0x9'),'callback':afterUpdate},{'channel':_0x9d64('0x11'),'model':_0x9d64('0x12'),'event':_0x9d64('0x6'),'condition':_0x9d64('0xb'),'callback':afterCreateMessage},{'channel':_0x9d64('0x13'),'model':_0x9d64('0x14'),'event':'afterCreate','condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':_0x9d64('0x13'),'model':_0x9d64('0x14'),'event':_0x9d64('0x8'),'condition':_0x9d64('0x9'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x9d64('0x6'),'condition':_0x9d64('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x9d64('0x15'),'event':_0x9d64('0x6'),'condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':_0x9d64('0x16'),'model':'MailInteraction','event':_0x9d64('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9d64('0x16'),'model':_0x9d64('0x17'),'event':_0x9d64('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9d64('0x18'),'model':_0x9d64('0x19'),'event':_0x9d64('0x6'),'condition':_0x9d64('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0x9d64('0x19'),'event':_0x9d64('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9d64('0x18'),'model':'OpenchannelMessage','event':_0x9d64('0x6'),'condition':_0x9d64('0xb'),'callback':afterCreateMessage}];function request(_0x127926){return client['request'](_0x9d64('0x1a'),_0x127926)[_0x9d64('0x1b')](function(_0x1849d0){logger[_0x9d64('0x1c')](_0x9d64('0x1d'),_0x9d64('0x1a'),_0x1849d0);if(_0x1849d0[_0x9d64('0x1e')]){if(_0x1849d0[_0x9d64('0x1e')][_0x9d64('0x1f')]===0x1f4){logger['error']('Trigger,\x20%s',_0x9d64('0x1a'),_0x1849d0[_0x9d64('0x1e')]);}}})[_0x9d64('0x20')](function(_0x3b153c){logger[_0x9d64('0x1e')]('Trigger,\x20%s','EventManager',_0x3b153c);});}function afterCreateMessage(_0x3e4803){return function(_0x20668c){_0x20668c=_0x20668c[_0x9d64('0x21')]({'plain':!![]});_0x20668c[_0x9d64('0x22')]=_0x3e4803;_0x20668c[_0x9d64('0x23')]=_0x3e4803;_0x20668c[_0x9d64('0x24')]=_0x20668c[_0x9d64('0x25')];Promise['resolve']()[_0x9d64('0x1b')](function(){if(typeof _0x20668c[_0x9d64('0x26')]===_0x9d64('0x27'))return null;var _0x2d045b=_0x9d64('0x28')+_0x20668c[_0x9d64('0x26')];return db['sequelize'][_0x9d64('0x29')](_0x2d045b,{'type':db[_0x9d64('0x2a')][_0x9d64('0x2b')][_0x9d64('0x2c')],'raw':!![]});})['then'](function(_0x1f6490){if(_0x1f6490){_0x20668c[_0x9d64('0x2d')]=_0x1f6490[0x0];}if(typeof _0x20668c[_0x9d64('0x2e')]===_0x9d64('0x27'))return;return getAgent(_0x20668c[_0x9d64('0x2e')]);})[_0x9d64('0x1b')](function(_0x52300a){if(_0x52300a){_0x20668c[_0x9d64('0x2f')]=util['format'](_0x9d64('0x30'),_0x52300a[_0x9d64('0x31')]);_0x20668c[_0x9d64('0x32')]=_0x52300a;_0x20668c[_0x9d64('0x22')]=_0x3e4803;return request({'event':_0x9d64('0x33'),'message':_0x20668c});}else{return request({'event':_0x9d64('0x34'),'message':_0x20668c});}})[_0x9d64('0x20')](function(_0x4a53e9){logger[_0x9d64('0x1e')](_0x9d64('0x1d'),_0x9d64('0x35'),_0x4a53e9);});};}function afterCreateOfflineMessage(_0x18a369){return function(_0x593dba){_0x593dba=_0x593dba[_0x9d64('0x21')]({'plain':!![]});_0x593dba['channel']=_0x18a369;_0x593dba['motionChannel']=_0x18a369;_0x593dba[_0x9d64('0x24')]=_0x9d64('0x36');return request({'event':_0x593dba[_0x9d64('0x24')],'message':_0x593dba});};}function afterCreate(_0x105a97,_0x527522){return function(_0x1d79a0){_0x1d79a0=_0x1d79a0['get']({'plain':!![]});_0x1d79a0[_0x9d64('0x22')]=_0x105a97;_0x1d79a0[_0x9d64('0x23')]=_0x105a97;_0x1d79a0[_0x9d64('0x24')]=_0x9d64('0x37');Promise[_0x9d64('0x38')]()[_0x9d64('0x1b')](function(){var _0x3b4ea6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d79a0[_0x9d64('0x26')];return db[_0x9d64('0x39')][_0x9d64('0x29')](_0x3b4ea6,{'type':db[_0x9d64('0x2a')]['QueryTypes'][_0x9d64('0x2c')],'raw':!![]});})[_0x9d64('0x1b')](function(_0x404788){if(_0x404788){_0x1d79a0[_0x9d64('0x2d')]=_0x404788[0x0];}if(typeof _0x1d79a0[_0x9d64('0x2e')]===_0x9d64('0x27'))return;return getAgent(_0x1d79a0[_0x9d64('0x2e')]);})['then'](function(_0x5baa82){if(_0x5baa82){_0x1d79a0[_0x9d64('0x2f')]=util[_0x9d64('0x3a')]('SIP/%s',_0x5baa82['name']);_0x1d79a0[_0x9d64('0x32')]=_0x5baa82;}return request({'event':_0x527522,'message':_0x1d79a0});})[_0x9d64('0x20')](function(_0x1bb037){logger['error']('Trigger,\x20%s',_0x9d64('0x3b'),_0x1bb037);});};}function afterUpdate(_0x53abd3){return function(_0x25bc39){var _0x3352bd=_0x25bc39['changed'](_0x9d64('0x3c'))&&_0x25bc39['closed'];var _0x545529=_0x25bc39['changed'](_0x9d64('0x3d'));if(_0x3352bd||_0x545529){var _0x524d92=_0x3352bd?_0x9d64('0x9'):_0x9d64('0x3d');var _0x2aca12=_0x25bc39['get']({'plain':!![]});_0x2aca12[_0x9d64('0x22')]=_0x53abd3;_0x2aca12[_0x9d64('0x23')]=_0x53abd3;_0x2aca12[_0x9d64('0x24')]=_0x3352bd?'closed':_0x9d64('0x3d');var _0x101fdf=_0x9d64('0x28')+_0x2aca12['ContactId'];return db['sequelize'][_0x9d64('0x29')](_0x101fdf,{'type':db['Sequelize'][_0x9d64('0x2b')][_0x9d64('0x2c')],'raw':!![]})[_0x9d64('0x1b')](function(_0x3eb7a4){if(_0x3eb7a4){_0x2aca12[_0x9d64('0x2d')]=_0x3eb7a4[0x0];}if(typeof _0x2aca12[_0x9d64('0x2e')]===_0x9d64('0x27'))return;return getAgent(_0x2aca12[_0x9d64('0x2e')]);})[_0x9d64('0x1b')](function(_0x52e8a8){if(_0x52e8a8){_0x2aca12['interface']=util[_0x9d64('0x3a')](_0x9d64('0x30'),_0x52e8a8[_0x9d64('0x31')]);_0x2aca12[_0x9d64('0x32')]=_0x52e8a8;}return request({'event':_0x524d92,'message':_0x2aca12});})[_0x9d64('0x20')](function(_0xe6e565){logger[_0x9d64('0x1e')](_0x9d64('0x1d'),'AfterUpdate',_0xe6e565);});}};}function getAgent(_0x1641be){return db[_0x9d64('0x3e')][_0x9d64('0x3f')]({'where':{'id':_0x1641be},'attributes':['id','name',_0x9d64('0x40'),_0x9d64('0x41'),_0x9d64('0x42')],'raw':!![]})[_0x9d64('0x1b')](function(_0x422348){return _0x422348;});}exports['default']=function(){for(var _0x54db10=0x0;_0x54db10=_0x2ec1b8['agents']){throw Error(_0xb86f('0x14'));}_0x49eb7c(_0x76f3f1);})[_0xb86f('0x15')](function(_0x1ddb34){_0x2f4d12(_0x1ddb34);});});}; \ No newline at end of file +var _0xa452=['catch','lodash','bluebird','../mysqldb','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x209d6e,_0x52901f){var _0x2ec84b=function(_0x4666bb){while(--_0x4666bb){_0x209d6e['push'](_0x209d6e['shift']());}};_0x2ec84b(++_0x52901f);}(_0xa452,0x171));var _0x2a45=function(_0x1c30b7,_0x2f6702){_0x1c30b7=_0x1c30b7-0x0;var _0x1ee725=_0xa452[_0x1c30b7];return _0x1ee725;};'use strict';var _=require(_0x2a45('0x0'));var BPromise=require(_0x2a45('0x1'));var db=require(_0x2a45('0x2'))['db'];var util=require('./license/util');var channels=['voice','mail',_0x2a45('0x3'),_0x2a45('0x4'),_0x2a45('0x5'),_0x2a45('0x6'),_0x2a45('0x7')];exports[_0x2a45('0x8')]=function(){return channels;};exports[_0x2a45('0x9')]=function(_0x4fd1b0){_0x4fd1b0=_0x4fd1b0[_0x2a45('0xa')]();return _['includes'](channels,_0x4fd1b0);};exports[_0x2a45('0xb')]=function(_0x264658,_0x1afeaf,_0x475a97,_0x3df10f){var _0x1271ce={'loginAttempts':_0x1afeaf,'blocked':_0x475a97};if(!_[_0x2a45('0xc')](_0x3df10f)){_0x1271ce['blockedAt']=_0x3df10f;}return _0x264658[_0x2a45('0xd')](_0x1271ce);};exports[_0x2a45('0xe')]=function(_0xadce48){return new BPromise(function(_0x2dc13f,_0x38dc61){var _0x73d374=0x0;if(_0xadce48[_0x2a45('0xf')]!==_0x2a45('0x10')){_0x2dc13f(_0xadce48);}db[_0x2a45('0x11')][_0x2a45('0x12')]({'where':{'role':_0x2a45('0x10'),'online':!![],'id':{'$ne':_0xadce48['id']}}})[_0x2a45('0x13')](function(_0x1f5a31){_0x73d374=_0x1f5a31;return util[_0x2a45('0xe')]();})[_0x2a45('0x13')](function(_0x39ab3c){if(_0x39ab3c&&_0x39ab3c[_0x2a45('0x14')]&&_0x73d374>=_0x39ab3c[_0x2a45('0x14')]){throw Error(_0x2a45('0x15'));}_0x2dc13f(_0xadce48);})[_0x2a45('0x16')](function(_0x37fea1){_0x38dc61(_0x37fea1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 0d03059..9d05d3f 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x25d80b,_0x502467){var _0x323048=function(_0x3ff52d){while(--_0x3ff52d){_0x25d80b['push'](_0x25d80b['shift']());}};_0x323048(++_0x502467);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x593c65,_0x186cef){var _0x307f0e=function(_0x36b73a){while(--_0x36b73a){_0x593c65['push'](_0x593c65['shift']());}};_0x307f0e(++_0x186cef);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7206ac0..b761009 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f2e=['status','render','json','send','exports','404'];(function(_0x15d019,_0x2b0dbe){var _0x23c051=function(_0x4a896b){while(--_0x4a896b){_0x15d019['push'](_0x15d019['shift']());}};_0x23c051(++_0x2b0dbe);}(_0x3f2e,0x166));var _0xe3f2=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x3f2e[_0xf244e0];return _0xe94095;};'use strict';module[_0xe3f2('0x0')][0x194]=function pageNotFound(_0xffb8b8,_0x3b2704){var _0x2a1425=_0xe3f2('0x1');var _0x834381=0x194;var _0x34701f={'status':_0x834381};_0x3b2704[_0xe3f2('0x2')](_0x34701f[_0xe3f2('0x2')]);_0x3b2704[_0xe3f2('0x3')](_0x2a1425,{},function(_0x439105,_0x33172a){if(_0x439105){return _0x3b2704[_0xe3f2('0x2')](_0x34701f[_0xe3f2('0x2')])[_0xe3f2('0x4')](_0x34701f);}_0x3b2704[_0xe3f2('0x5')](_0x33172a);});}; \ No newline at end of file +var _0xff30=['json','send','exports','404','status','render'];(function(_0x3998fd,_0x7dcccd){var _0x57fde5=function(_0x11b35c){while(--_0x11b35c){_0x3998fd['push'](_0x3998fd['shift']());}};_0x57fde5(++_0x7dcccd);}(_0xff30,0x104));var _0x0ff3=function(_0x3fdc3e,_0x2c9f17){_0x3fdc3e=_0x3fdc3e-0x0;var _0x485fad=_0xff30[_0x3fdc3e];return _0x485fad;};'use strict';module[_0x0ff3('0x0')][0x194]=function pageNotFound(_0x85b5d4,_0x10d3fc){var _0x3f30a1=_0x0ff3('0x1');var _0x199320=0x194;var _0xbd9ab6={'status':_0x199320};_0x10d3fc[_0x0ff3('0x2')](_0xbd9ab6[_0x0ff3('0x2')]);_0x10d3fc[_0x0ff3('0x3')](_0x3f30a1,{},function(_0x3ff921,_0x45e07c){if(_0x3ff921){return _0x10d3fc[_0x0ff3('0x2')](_0xbd9ab6[_0x0ff3('0x2')])[_0x0ff3('0x4')](_0xbd9ab6);}_0x10d3fc[_0x0ff3('0x5')](_0x45e07c);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index aebc985..e8a0f0b 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(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 5eb32c2..9fbed8f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8482=['./api/squareProject','/api/square/recordings','/api/square/messages','./api/team','/api/license','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.5.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/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/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./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/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./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/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8482,0x14e));var _0x2848=function(_0x580ba,_0xc940d0){_0x580ba=_0x580ba-0x0;var _0xb2320b=_0x8482[_0x580ba];return _0xb2320b;};'use strict';var path=require('path');var express=require(_0x2848('0x0'));var errors=require(_0x2848('0x1'));var config=require(_0x2848('0x2'));var setupLoggers=require(_0x2848('0x3'))[_0x2848('0x4')];var clientSideLogs=require(_0x2848('0x5'));exports[_0x2848('0x6')]=function(_0x4309c1){return setupLoggers(_0x4309c1)[_0x2848('0x7')](function(){_0x4309c1[_0x2848('0x8')]('/api/users',require(_0x2848('0x9')));_0x4309c1[_0x2848('0x8')]('/api/voice/chanspy',require(_0x2848('0xa')));_0x4309c1['use']('/api/voice/contexts',require(_0x2848('0xb')));_0x4309c1['use'](_0x2848('0xc'),require('./api/voiceExtension'));_0x4309c1['use']('/api/voice/mohs',require(_0x2848('0xd')));_0x4309c1[_0x2848('0x8')](_0x2848('0xe'),require(_0x2848('0xf')));_0x4309c1[_0x2848('0x8')](_0x2848('0x10'),require('./api/voiceRecording'));_0x4309c1['use'](_0x2848('0x11'),require(_0x2848('0x12')));_0x4309c1[_0x2848('0x8')]('/api/voice/mails',require(_0x2848('0x13')));_0x4309c1[_0x2848('0x8')](_0x2848('0x14'),require('./api/voiceMailMessage'));_0x4309c1[_0x2848('0x8')]('/api/voice/calls/reports',require(_0x2848('0x15')));_0x4309c1['use'](_0x2848('0x16'),require(_0x2848('0x17')));_0x4309c1[_0x2848('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x4309c1['use']('/api/voice/queues/reports',require(_0x2848('0x18')));_0x4309c1[_0x2848('0x8')](_0x2848('0x19'),require(_0x2848('0x1a')));_0x4309c1[_0x2848('0x8')](_0x2848('0x1b'),require(_0x2848('0x1c')));_0x4309c1[_0x2848('0x8')](_0x2848('0x1d'),require(_0x2848('0x1e')));_0x4309c1[_0x2848('0x8')]('/api/mail/out_servers',require(_0x2848('0x1f')));_0x4309c1[_0x2848('0x8')](_0x2848('0x20'),require('./api/mailAccount'));_0x4309c1[_0x2848('0x8')](_0x2848('0x21'),require(_0x2848('0x22')));_0x4309c1[_0x2848('0x8')](_0x2848('0x23'),require('./api/mailSubstatus'));_0x4309c1[_0x2848('0x8')](_0x2848('0x24'),require(_0x2848('0x25')));_0x4309c1[_0x2848('0x8')](_0x2848('0x26'),require(_0x2848('0x27')));_0x4309c1['use'](_0x2848('0x28'),require('./api/mailApplication'));_0x4309c1[_0x2848('0x8')](_0x2848('0x29'),require(_0x2848('0x2a')));_0x4309c1[_0x2848('0x8')]('/api/dashboards',require(_0x2848('0x2b')));_0x4309c1[_0x2848('0x8')](_0x2848('0x2c'),require(_0x2848('0x2d')));_0x4309c1[_0x2848('0x8')](_0x2848('0x2e'),require(_0x2848('0x2f')));_0x4309c1['use']('/api/fax/applications',require('./api/faxApplication'));_0x4309c1[_0x2848('0x8')](_0x2848('0x30'),require(_0x2848('0x31')));_0x4309c1[_0x2848('0x8')](_0x2848('0x32'),require(_0x2848('0x33')));_0x4309c1['use']('/api/fax/queues',require(_0x2848('0x34')));_0x4309c1[_0x2848('0x8')](_0x2848('0x35'),require(_0x2848('0x36')));_0x4309c1[_0x2848('0x8')](_0x2848('0x37'),require(_0x2848('0x38')));_0x4309c1[_0x2848('0x8')](_0x2848('0x39'),require(_0x2848('0x3a')));_0x4309c1[_0x2848('0x8')]('/api/sms/interactions',require(_0x2848('0x3b')));_0x4309c1[_0x2848('0x8')](_0x2848('0x3c'),require(_0x2848('0x3d')));_0x4309c1['use'](_0x2848('0x3e'),require(_0x2848('0x3f')));_0x4309c1[_0x2848('0x8')](_0x2848('0x40'),require('./api/openchannelAccount'));_0x4309c1['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x4309c1[_0x2848('0x8')](_0x2848('0x41'),require('./api/openchannelInteraction'));_0x4309c1['use'](_0x2848('0x42'),require(_0x2848('0x43')));_0x4309c1[_0x2848('0x8')](_0x2848('0x44'),require(_0x2848('0x45')));_0x4309c1['use'](_0x2848('0x46'),require(_0x2848('0x47')));_0x4309c1[_0x2848('0x8')]('/api/openchannel/reports/queue',require(_0x2848('0x48')));_0x4309c1[_0x2848('0x8')](_0x2848('0x49'),require(_0x2848('0x4a')));_0x4309c1[_0x2848('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x4309c1[_0x2848('0x8')](_0x2848('0x4b'),require(_0x2848('0x4c')));_0x4309c1[_0x2848('0x8')](_0x2848('0x4d'),require(_0x2848('0x4e')));_0x4309c1['use']('/api/chat/queues',require('./api/chatQueue'));_0x4309c1['use']('/api/chat/groups',require(_0x2848('0x4f')));_0x4309c1['use'](_0x2848('0x50'),require('./api/chatProactiveAction'));_0x4309c1[_0x2848('0x8')](_0x2848('0x51'),require(_0x2848('0x52')));_0x4309c1['use'](_0x2848('0x53'),require(_0x2848('0x54')));_0x4309c1[_0x2848('0x8')](_0x2848('0x55'),require(_0x2848('0x56')));_0x4309c1['use']('/api/cm/hopper_black',require(_0x2848('0x57')));_0x4309c1[_0x2848('0x8')](_0x2848('0x58'),require(_0x2848('0x59')));_0x4309c1[_0x2848('0x8')](_0x2848('0x5a'),require('./api/cmHopperHistory'));_0x4309c1[_0x2848('0x8')]('/api/cm/custom_fields',require(_0x2848('0x5b')));_0x4309c1['use'](_0x2848('0x5c'),require('./api/action'));_0x4309c1['use']('/api/automations',require('./api/automation'));_0x4309c1[_0x2848('0x8')](_0x2848('0x5d'),require(_0x2848('0x5e')));_0x4309c1[_0x2848('0x8')](_0x2848('0x5f'),require(_0x2848('0x60')));_0x4309c1[_0x2848('0x8')](_0x2848('0x61'),require(_0x2848('0x62')));_0x4309c1['use'](_0x2848('0x63'),require(_0x2848('0x64')));_0x4309c1[_0x2848('0x8')]('/api/pauses',require(_0x2848('0x65')));_0x4309c1[_0x2848('0x8')](_0x2848('0x66'),require(_0x2848('0x67')));_0x4309c1[_0x2848('0x8')]('/api/voiceQueuesLog',require(_0x2848('0x68')));_0x4309c1[_0x2848('0x8')](_0x2848('0x69'),require(_0x2848('0x6a')));_0x4309c1['use'](_0x2848('0x6b'),require(_0x2848('0x6c')));_0x4309c1[_0x2848('0x8')]('/api/tags',require(_0x2848('0x6d')));_0x4309c1[_0x2848('0x8')]('/api/contact_item_types',require('./api/contactItemType'));_0x4309c1[_0x2848('0x8')](_0x2848('0x6e'),require(_0x2848('0x6f')));_0x4309c1[_0x2848('0x8')](_0x2848('0x70'),require('./api/cmHopperAdditionalPhone'));_0x4309c1[_0x2848('0x8')](_0x2848('0x71'),require(_0x2848('0x72')));_0x4309c1[_0x2848('0x8')](_0x2848('0x73'),require(_0x2848('0x74')));_0x4309c1[_0x2848('0x8')](_0x2848('0x75'),require(_0x2848('0x76')));_0x4309c1[_0x2848('0x8')](_0x2848('0x77'),require(_0x2848('0x78')));_0x4309c1[_0x2848('0x8')](_0x2848('0x79'),require(_0x2848('0x7a')));_0x4309c1[_0x2848('0x8')](_0x2848('0x7b'),require(_0x2848('0x7c')));_0x4309c1[_0x2848('0x8')](_0x2848('0x7d'),require('./api/analyticDefaultReport'));_0x4309c1[_0x2848('0x8')](_0x2848('0x7e'),require('./api/analyticExtractedReport'));_0x4309c1[_0x2848('0x8')](_0x2848('0x7f'),require('./api/analyticMetric'));_0x4309c1[_0x2848('0x8')]('/api/analytics/field_reports',require(_0x2848('0x80')));_0x4309c1[_0x2848('0x8')]('/api/analytics/tree_reports',require(_0x2848('0x81')));_0x4309c1[_0x2848('0x8')](_0x2848('0x82'),require(_0x2848('0x83')));_0x4309c1[_0x2848('0x8')](_0x2848('0x84'),require(_0x2848('0x85')));_0x4309c1[_0x2848('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x4309c1['use']('/api/integrations/sugarcrm/accounts',require(_0x2848('0x86')));_0x4309c1[_0x2848('0x8')](_0x2848('0x87'),require(_0x2848('0x88')));_0x4309c1[_0x2848('0x8')]('/api/integrations/sugarcrm/fields',require(_0x2848('0x89')));_0x4309c1[_0x2848('0x8')](_0x2848('0x8a'),require(_0x2848('0x8b')));_0x4309c1[_0x2848('0x8')](_0x2848('0x8c'),require('./api/intDeskConfiguration'));_0x4309c1['use'](_0x2848('0x8d'),require('./api/intDeskField'));_0x4309c1[_0x2848('0x8')](_0x2848('0x8e'),require(_0x2848('0x8f')));_0x4309c1[_0x2848('0x8')](_0x2848('0x90'),require(_0x2848('0x91')));_0x4309c1[_0x2848('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4309c1['use'](_0x2848('0x92'),require('./api/intZendeskAccount'));_0x4309c1[_0x2848('0x8')](_0x2848('0x93'),require(_0x2848('0x94')));_0x4309c1[_0x2848('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4309c1[_0x2848('0x8')](_0x2848('0x95'),require(_0x2848('0x96')));_0x4309c1[_0x2848('0x8')](_0x2848('0x97'),require('./api/intFreshdeskConfiguration'));_0x4309c1[_0x2848('0x8')](_0x2848('0x98'),require(_0x2848('0x99')));_0x4309c1[_0x2848('0x8')](_0x2848('0x9a'),require('./api/intVtigerAccount'));_0x4309c1[_0x2848('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x4309c1[_0x2848('0x8')]('/api/integrations/vtiger/fields',require(_0x2848('0x9b')));_0x4309c1[_0x2848('0x8')](_0x2848('0x9c'),require(_0x2848('0x9d')));_0x4309c1[_0x2848('0x8')](_0x2848('0x9e'),require(_0x2848('0x9f')));_0x4309c1[_0x2848('0x8')](_0x2848('0xa0'),require(_0x2848('0xa1')));_0x4309c1[_0x2848('0x8')](_0x2848('0xa2'),require('./api/intDynamics365Account'));_0x4309c1[_0x2848('0x8')](_0x2848('0xa3'),require(_0x2848('0xa4')));_0x4309c1[_0x2848('0x8')]('/api/integrations/dynamics365/fields',require(_0x2848('0xa5')));_0x4309c1[_0x2848('0x8')]('/api/integrations/freshsales/accounts',require(_0x2848('0xa6')));_0x4309c1[_0x2848('0x8')](_0x2848('0xa7'),require(_0x2848('0xa8')));_0x4309c1[_0x2848('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x4309c1[_0x2848('0x8')](_0x2848('0xa9'),require('./api/network'));_0x4309c1[_0x2848('0x8')](_0x2848('0xaa'),require('./api/chatQueueReport'));_0x4309c1[_0x2848('0x8')]('/api/chat/internal/messages',require(_0x2848('0xab')));_0x4309c1[_0x2848('0x8')](_0x2848('0xac'),require(_0x2848('0xad')));_0x4309c1[_0x2848('0x8')](_0x2848('0xae'),require(_0x2848('0xaf')));_0x4309c1[_0x2848('0x8')](_0x2848('0xb0'),require(_0x2848('0xb1')));_0x4309c1[_0x2848('0x8')](_0x2848('0xb2'),require(_0x2848('0xb3')));_0x4309c1['use'](_0x2848('0xb4'),require(_0x2848('0xb5')));_0x4309c1['use']('/api/square/details/reports',require(_0x2848('0xb6')));_0x4309c1[_0x2848('0x8')]('/api/jscripty/projects',require(_0x2848('0xb7')));_0x4309c1[_0x2848('0x8')](_0x2848('0xb8'),require(_0x2848('0xb9')));_0x4309c1['use'](_0x2848('0xba'),require('./api/squareOdbc'));_0x4309c1[_0x2848('0x8')](_0x2848('0xbb'),require(_0x2848('0xbc')));_0x4309c1[_0x2848('0x8')](_0x2848('0xbd'),require('./api/squareRecording'));_0x4309c1[_0x2848('0x8')](_0x2848('0xbe'),require('./api/squareMessage'));_0x4309c1[_0x2848('0x8')]('/api/teams',require(_0x2848('0xbf')));_0x4309c1[_0x2848('0x8')](_0x2848('0xc0'),require(_0x2848('0xc1')));_0x4309c1[_0x2848('0x8')]('/api/campaigns',require('./api/campaign'));_0x4309c1[_0x2848('0x8')](_0x2848('0xc2'),require(_0x2848('0xc3')));_0x4309c1[_0x2848('0x8')](_0x2848('0xc4'),require(_0x2848('0xc5')));_0x4309c1[_0x2848('0x8')](_0x2848('0xc6'),require(_0x2848('0xc7')));_0x4309c1[_0x2848('0x8')]('/api/mail/reports/transfer',require(_0x2848('0xc8')));_0x4309c1[_0x2848('0x8')]('/api/chat/reports/transfer',require(_0x2848('0xc9')));_0x4309c1[_0x2848('0x8')](_0x2848('0xca'),require('./api/faxTransferReport'));_0x4309c1[_0x2848('0x8')](_0x2848('0xcb'),require('./api/openchannelTransferReport'));_0x4309c1[_0x2848('0x8')](_0x2848('0xcc'),require(_0x2848('0xcd')));_0x4309c1[_0x2848('0x8')](_0x2848('0xce'),require(_0x2848('0xcf')));_0x4309c1[_0x2848('0x8')](_0x2848('0xd0'),require(_0x2848('0xd1')));_0x4309c1[_0x2848('0x8')](_0x2848('0xd2'),require('./api/userProfile'));_0x4309c1[_0x2848('0x8')](_0x2848('0xd3'),require(_0x2848('0xd4')));_0x4309c1['use'](_0x2848('0xd5'),require('./api/userProfileResource'));_0x4309c1[_0x2848('0x8')](_0x2848('0xd6'),require(_0x2848('0xd7')));_0x4309c1['use'](_0x2848('0xd8'),require(_0x2848('0xd9')));_0x4309c1[_0x2848('0x8')](_0x2848('0xda'),require(_0x2848('0xdb')));_0x4309c1[_0x2848('0x8')](_0x2848('0xdc'),require(_0x2848('0xdd')));_0x4309c1[_0x2848('0x8')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x4309c1[_0x2848('0x8')](_0x2848('0xde'),require(_0x2848('0xdf')));_0x4309c1[_0x2848('0x8')](_0x2848('0xe0'),require(_0x2848('0xe1')));_0x4309c1['use'](_0x2848('0xe2'),require(_0x2848('0xe3')));_0x4309c1[_0x2848('0x8')]('/api/cloudProviders',require(_0x2848('0xe4')));_0x4309c1[_0x2848('0x8')](_0x2848('0xe5'),require(_0x2848('0xe6')));_0x4309c1['use']('/api/user-settings',require('./api/user-setting'));_0x4309c1['use'](_0x2848('0xe7'),require(_0x2848('0xe8')));_0x4309c1[_0x2848('0x8')](_0x2848('0xe9'),require(_0x2848('0xea')));_0x4309c1[_0x2848('0x8')](_0x2848('0xeb'),require(_0x2848('0xec')));_0x4309c1['use'](_0x2848('0xed'),require(_0x2848('0xee')));_0x4309c1[_0x2848('0x8')]('/api/rpc',require(_0x2848('0xef')));_0x4309c1[_0x2848('0x8')](_0x2848('0xf0'),require('./api/version'));_0x4309c1['use']('/api/system',require(_0x2848('0xf1')));_0x4309c1['use'](_0x2848('0xf2'),require(_0x2848('0xf3')));_0x4309c1[_0x2848('0x8')](_0x2848('0xf4'),require(_0x2848('0xf5')));_0x4309c1[_0x2848('0x8')]('/api/logs',clientSideLogs);_0x4309c1['use'](_0x2848('0xf6'),express[_0x2848('0xf7')](path[_0x2848('0xf8')](config[_0x2848('0xf9')],_0x2848('0xf6'))));_0x4309c1['use'](_0x2848('0xfa'),express[_0x2848('0xf7')](path[_0x2848('0xf8')](config[_0x2848('0xf9')],_0x2848('0xfa'))));_0x4309c1[_0x2848('0x8')](_0x2848('0xfb'),express[_0x2848('0xf7')](path[_0x2848('0xf8')](config[_0x2848('0xf9')],_0x2848('0xfb'))));_0x4309c1[_0x2848('0x8')](_0x2848('0xfc'),express[_0x2848('0xf7')](path[_0x2848('0xf8')](config[_0x2848('0xf9')],_0x2848('0xfd'),_0x2848('0xfe'))));_0x4309c1['use']('/plugins',express[_0x2848('0xf7')](path['join'](config['root'],_0x2848('0xff'))));_0x4309c1[_0x2848('0x100')](_0x2848('0x101'))['get'](errors[0x194]);_0x4309c1[_0x2848('0x100')]('/*')['get'](function(_0x458401,_0x53b2a8){_0x53b2a8[_0x2848('0x102')](path[_0x2848('0x103')](_0x4309c1['get']('appPath')+_0x2848('0x104')));});return _0x4309c1;});}; \ No newline at end of file +var _0x834d=['/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./config/environment','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/condition','./api/interval','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./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/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer'];(function(_0x58ee96,_0x5affd5){var _0xb346aa=function(_0x245b1a){while(--_0x245b1a){_0x58ee96['push'](_0x58ee96['shift']());}};_0xb346aa(++_0x5affd5);}(_0x834d,0x140));var _0xd834=function(_0x77cf7e,_0x90579a){_0x77cf7e=_0x77cf7e-0x0;var _0x27439f=_0x834d[_0x77cf7e];return _0x27439f;};'use strict';var path=require(_0xd834('0x0'));var express=require(_0xd834('0x1'));var errors=require('./errors');var config=require(_0xd834('0x2'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0xd834('0x3'));exports[_0xd834('0x4')]=function(_0x2d838f){return setupLoggers(_0x2d838f)[_0xd834('0x5')](function(){_0x2d838f['use'](_0xd834('0x6'),require(_0xd834('0x7')));_0x2d838f[_0xd834('0x8')](_0xd834('0x9'),require(_0xd834('0xa')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb'),require(_0xd834('0xc')));_0x2d838f[_0xd834('0x8')](_0xd834('0xd'),require('./api/voiceExtension'));_0x2d838f[_0xd834('0x8')](_0xd834('0xe'),require('./api/voiceMusicOnHold'));_0x2d838f[_0xd834('0x8')](_0xd834('0xf'),require('./api/voiceQueue'));_0x2d838f[_0xd834('0x8')](_0xd834('0x10'),require(_0xd834('0x11')));_0x2d838f[_0xd834('0x8')](_0xd834('0x12'),require(_0xd834('0x13')));_0x2d838f[_0xd834('0x8')](_0xd834('0x14'),require(_0xd834('0x15')));_0x2d838f[_0xd834('0x8')](_0xd834('0x16'),require('./api/voiceMailMessage'));_0x2d838f[_0xd834('0x8')](_0xd834('0x17'),require(_0xd834('0x18')));_0x2d838f['use'](_0xd834('0x19'),require(_0xd834('0x1a')));_0x2d838f[_0xd834('0x8')](_0xd834('0x1b'),require('./api/voiceAgentReport'));_0x2d838f[_0xd834('0x8')](_0xd834('0x1c'),require(_0xd834('0x1d')));_0x2d838f[_0xd834('0x8')]('/api/members/reports',require(_0xd834('0x1e')));_0x2d838f[_0xd834('0x8')]('/api/trunks',require(_0xd834('0x1f')));_0x2d838f[_0xd834('0x8')](_0xd834('0x20'),require('./api/voiceTransferReport'));_0x2d838f[_0xd834('0x8')]('/api/mail/out_servers',require(_0xd834('0x21')));_0x2d838f[_0xd834('0x8')]('/api/mail/accounts',require(_0xd834('0x22')));_0x2d838f[_0xd834('0x8')](_0xd834('0x23'),require(_0xd834('0x24')));_0x2d838f[_0xd834('0x8')](_0xd834('0x25'),require('./api/mailSubstatus'));_0x2d838f[_0xd834('0x8')]('/api/mail/interactions',require(_0xd834('0x26')));_0x2d838f['use'](_0xd834('0x27'),require(_0xd834('0x28')));_0x2d838f[_0xd834('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x2d838f['use'](_0xd834('0x29'),require('./api/mailQueueReport'));_0x2d838f[_0xd834('0x8')]('/api/dashboards',require(_0xd834('0x2a')));_0x2d838f['use'](_0xd834('0x2b'),require(_0xd834('0x2c')));_0x2d838f[_0xd834('0x8')](_0xd834('0x2d'),require(_0xd834('0x2e')));_0x2d838f['use'](_0xd834('0x2f'),require('./api/faxApplication'));_0x2d838f[_0xd834('0x8')](_0xd834('0x30'),require(_0xd834('0x31')));_0x2d838f[_0xd834('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x2d838f[_0xd834('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x2d838f['use'](_0xd834('0x32'),require(_0xd834('0x33')));_0x2d838f[_0xd834('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x2d838f[_0xd834('0x8')](_0xd834('0x34'),require(_0xd834('0x35')));_0x2d838f[_0xd834('0x8')](_0xd834('0x36'),require(_0xd834('0x37')));_0x2d838f[_0xd834('0x8')](_0xd834('0x38'),require('./api/smsMessage'));_0x2d838f[_0xd834('0x8')]('/api/sms/queues',require(_0xd834('0x39')));_0x2d838f[_0xd834('0x8')]('/api/openchannel/accounts',require(_0xd834('0x3a')));_0x2d838f[_0xd834('0x8')]('/api/openchannel/applications',require(_0xd834('0x3b')));_0x2d838f['use'](_0xd834('0x3c'),require(_0xd834('0x3d')));_0x2d838f[_0xd834('0x8')]('/api/openchannel/messages',require(_0xd834('0x3e')));_0x2d838f['use'](_0xd834('0x3f'),require(_0xd834('0x40')));_0x2d838f['use'](_0xd834('0x41'),require(_0xd834('0x42')));_0x2d838f['use'](_0xd834('0x43'),require(_0xd834('0x44')));_0x2d838f[_0xd834('0x8')]('/api/chat/applications',require(_0xd834('0x45')));_0x2d838f['use'](_0xd834('0x46'),require('./api/chatInteraction'));_0x2d838f[_0xd834('0x8')](_0xd834('0x47'),require(_0xd834('0x48')));_0x2d838f['use'](_0xd834('0x49'),require(_0xd834('0x4a')));_0x2d838f[_0xd834('0x8')](_0xd834('0x4b'),require(_0xd834('0x4c')));_0x2d838f[_0xd834('0x8')](_0xd834('0x4d'),require('./api/chatGroup'));_0x2d838f[_0xd834('0x8')](_0xd834('0x4e'),require(_0xd834('0x4f')));_0x2d838f[_0xd834('0x8')](_0xd834('0x50'),require('./api/cmCompany'));_0x2d838f[_0xd834('0x8')](_0xd834('0x51'),require(_0xd834('0x52')));_0x2d838f['use']('/api/cm/hopper',require('./api/cmHopper'));_0x2d838f[_0xd834('0x8')](_0xd834('0x53'),require(_0xd834('0x54')));_0x2d838f['use'](_0xd834('0x55'),require(_0xd834('0x56')));_0x2d838f[_0xd834('0x8')](_0xd834('0x57'),require(_0xd834('0x58')));_0x2d838f['use'](_0xd834('0x59'),require(_0xd834('0x5a')));_0x2d838f[_0xd834('0x8')](_0xd834('0x5b'),require(_0xd834('0x5c')));_0x2d838f['use']('/api/automations',require(_0xd834('0x5d')));_0x2d838f[_0xd834('0x8')](_0xd834('0x5e'),require(_0xd834('0x5f')));_0x2d838f['use']('/api/dispositions',require('./api/disposition'));_0x2d838f[_0xd834('0x8')]('/api/conditions',require(_0xd834('0x60')));_0x2d838f['use']('/api/intervals',require(_0xd834('0x61')));_0x2d838f[_0xd834('0x8')]('/api/pauses',require('./api/pause'));_0x2d838f[_0xd834('0x8')]('/api/cdr',require(_0xd834('0x62')));_0x2d838f['use'](_0xd834('0x63'),require('./api/voiceQueuesLog'));_0x2d838f['use'](_0xd834('0x64'),require(_0xd834('0x65')));_0x2d838f[_0xd834('0x8')](_0xd834('0x66'),require('./api/sound'));_0x2d838f[_0xd834('0x8')](_0xd834('0x67'),require(_0xd834('0x68')));_0x2d838f[_0xd834('0x8')](_0xd834('0x69'),require(_0xd834('0x6a')));_0x2d838f['use'](_0xd834('0x6b'),require(_0xd834('0x6c')));_0x2d838f['use'](_0xd834('0x6d'),require('./api/cmHopperAdditionalPhone'));_0x2d838f[_0xd834('0x8')]('/api/templates',require(_0xd834('0x6e')));_0x2d838f['use'](_0xd834('0x6f'),require(_0xd834('0x70')));_0x2d838f['use'](_0xd834('0x71'),require(_0xd834('0x72')));_0x2d838f['use']('/api/integrations',require(_0xd834('0x73')));_0x2d838f[_0xd834('0x8')](_0xd834('0x74'),require('./api/integrationReport'));_0x2d838f[_0xd834('0x8')](_0xd834('0x75'),require(_0xd834('0x76')));_0x2d838f[_0xd834('0x8')](_0xd834('0x77'),require(_0xd834('0x78')));_0x2d838f[_0xd834('0x8')](_0xd834('0x79'),require(_0xd834('0x7a')));_0x2d838f[_0xd834('0x8')]('/api/analytics/metrics',require(_0xd834('0x7b')));_0x2d838f[_0xd834('0x8')]('/api/analytics/field_reports',require(_0xd834('0x7c')));_0x2d838f[_0xd834('0x8')](_0xd834('0x7d'),require(_0xd834('0x7e')));_0x2d838f[_0xd834('0x8')]('/api/integrations/salesforce/accounts',require(_0xd834('0x7f')));_0x2d838f[_0xd834('0x8')](_0xd834('0x80'),require(_0xd834('0x81')));_0x2d838f['use']('/api/integrations/salesforce/fields',require(_0xd834('0x82')));_0x2d838f[_0xd834('0x8')](_0xd834('0x83'),require(_0xd834('0x84')));_0x2d838f[_0xd834('0x8')](_0xd834('0x85'),require(_0xd834('0x86')));_0x2d838f['use'](_0xd834('0x87'),require(_0xd834('0x88')));_0x2d838f[_0xd834('0x8')](_0xd834('0x89'),require(_0xd834('0x8a')));_0x2d838f[_0xd834('0x8')](_0xd834('0x8b'),require(_0xd834('0x8c')));_0x2d838f[_0xd834('0x8')](_0xd834('0x8d'),require(_0xd834('0x8e')));_0x2d838f[_0xd834('0x8')](_0xd834('0x8f'),require(_0xd834('0x90')));_0x2d838f[_0xd834('0x8')](_0xd834('0x91'),require(_0xd834('0x92')));_0x2d838f['use'](_0xd834('0x93'),require('./api/intZohoField'));_0x2d838f[_0xd834('0x8')](_0xd834('0x94'),require(_0xd834('0x95')));_0x2d838f[_0xd834('0x8')](_0xd834('0x96'),require(_0xd834('0x97')));_0x2d838f[_0xd834('0x8')](_0xd834('0x98'),require(_0xd834('0x99')));_0x2d838f[_0xd834('0x8')]('/api/integrations/freshdesk/accounts',require(_0xd834('0x9a')));_0x2d838f[_0xd834('0x8')](_0xd834('0x9b'),require(_0xd834('0x9c')));_0x2d838f[_0xd834('0x8')](_0xd834('0x9d'),require(_0xd834('0x9e')));_0x2d838f['use'](_0xd834('0x9f'),require(_0xd834('0xa0')));_0x2d838f[_0xd834('0x8')](_0xd834('0xa1'),require('./api/intVtigerConfiguration'));_0x2d838f['use'](_0xd834('0xa2'),require(_0xd834('0xa3')));_0x2d838f[_0xd834('0x8')]('/api/integrations/servicenow/accounts',require(_0xd834('0xa4')));_0x2d838f[_0xd834('0x8')](_0xd834('0xa5'),require(_0xd834('0xa6')));_0x2d838f[_0xd834('0x8')](_0xd834('0xa7'),require('./api/intServicenowField'));_0x2d838f[_0xd834('0x8')]('/api/integrations/dynamics365/accounts',require(_0xd834('0xa8')));_0x2d838f[_0xd834('0x8')](_0xd834('0xa9'),require(_0xd834('0xaa')));_0x2d838f['use'](_0xd834('0xab'),require('./api/intDynamics365Field'));_0x2d838f[_0xd834('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x2d838f[_0xd834('0x8')]('/api/integrations/freshsales/configurations',require(_0xd834('0xac')));_0x2d838f[_0xd834('0x8')]('/api/integrations/freshsales/fields',require(_0xd834('0xad')));_0x2d838f['use'](_0xd834('0xae'),require(_0xd834('0xaf')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb0'),require(_0xd834('0xb1')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb2'),require(_0xd834('0xb3')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb4'),require(_0xd834('0xb5')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb6'),require(_0xd834('0xb7')));_0x2d838f[_0xd834('0x8')](_0xd834('0xb8'),require('./api/jscriptySessionReport'));_0x2d838f['use']('/api/sms/reports/queue',require(_0xd834('0xb9')));_0x2d838f[_0xd834('0x8')]('/api/square/reports',require(_0xd834('0xba')));_0x2d838f[_0xd834('0x8')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x2d838f[_0xd834('0x8')](_0xd834('0xbb'),require(_0xd834('0xbc')));_0x2d838f[_0xd834('0x8')](_0xd834('0xbd'),require(_0xd834('0xbe')));_0x2d838f[_0xd834('0x8')](_0xd834('0xbf'),require('./api/squareOdbc'));_0x2d838f[_0xd834('0x8')](_0xd834('0xc0'),require(_0xd834('0xc1')));_0x2d838f[_0xd834('0x8')]('/api/square/recordings',require(_0xd834('0xc2')));_0x2d838f[_0xd834('0x8')](_0xd834('0xc3'),require(_0xd834('0xc4')));_0x2d838f[_0xd834('0x8')](_0xd834('0xc5'),require(_0xd834('0xc6')));_0x2d838f[_0xd834('0x8')](_0xd834('0xc7'),require(_0xd834('0xc8')));_0x2d838f['use']('/api/campaigns',require(_0xd834('0xc9')));_0x2d838f[_0xd834('0x8')](_0xd834('0xca'),require(_0xd834('0xcb')));_0x2d838f[_0xd834('0x8')]('/api/attachments',require('./api/attachment'));_0x2d838f[_0xd834('0x8')]('/api/plugins',require(_0xd834('0xcc')));_0x2d838f[_0xd834('0x8')]('/api/mail/reports/transfer',require(_0xd834('0xcd')));_0x2d838f[_0xd834('0x8')](_0xd834('0xce'),require('./api/chatTransferReport'));_0x2d838f[_0xd834('0x8')](_0xd834('0xcf'),require('./api/faxTransferReport'));_0x2d838f[_0xd834('0x8')](_0xd834('0xd0'),require(_0xd834('0xd1')));_0x2d838f[_0xd834('0x8')](_0xd834('0xd2'),require(_0xd834('0xd3')));_0x2d838f['use'](_0xd834('0xd4'),require(_0xd834('0xd5')));_0x2d838f[_0xd834('0x8')](_0xd834('0xd6'),require('./api/voicePrefix'));_0x2d838f['use']('/api/userProfiles',require(_0xd834('0xd7')));_0x2d838f['use']('/api/userProfile/sections',require(_0xd834('0xd8')));_0x2d838f[_0xd834('0x8')](_0xd834('0xd9'),require(_0xd834('0xda')));_0x2d838f[_0xd834('0x8')](_0xd834('0xdb'),require('./api/userNotification'));_0x2d838f['use'](_0xd834('0xdc'),require(_0xd834('0xdd')));_0x2d838f[_0xd834('0x8')](_0xd834('0xde'),require('./api/whatsappApplication'));_0x2d838f[_0xd834('0x8')](_0xd834('0xdf'),require(_0xd834('0xe0')));_0x2d838f[_0xd834('0x8')]('/api/whatsapp/messages',require(_0xd834('0xe1')));_0x2d838f[_0xd834('0x8')](_0xd834('0xe2'),require(_0xd834('0xe3')));_0x2d838f[_0xd834('0x8')](_0xd834('0xe4'),require(_0xd834('0xe5')));_0x2d838f['use'](_0xd834('0xe6'),require('./api/whatsappQueue'));_0x2d838f[_0xd834('0x8')](_0xd834('0xe7'),require(_0xd834('0xe8')));_0x2d838f['use'](_0xd834('0xe9'),require('./api/realtime'));_0x2d838f[_0xd834('0x8')](_0xd834('0xea'),require(_0xd834('0xeb')));_0x2d838f['use'](_0xd834('0xec'),require(_0xd834('0xed')));_0x2d838f[_0xd834('0x8')](_0xd834('0xee'),require(_0xd834('0xef')));_0x2d838f[_0xd834('0x8')](_0xd834('0xf0'),require('./api/authActiveDirectory'));_0x2d838f[_0xd834('0x8')](_0xd834('0xf1'),require('./api/jira'));_0x2d838f[_0xd834('0x8')](_0xd834('0xf2'),require('./api/rpc'));_0x2d838f['use'](_0xd834('0xf3'),require('./api/version'));_0x2d838f[_0xd834('0x8')]('/api/system',require(_0xd834('0xf4')));_0x2d838f['use'](_0xd834('0xf5'),require(_0xd834('0xf6')));_0x2d838f[_0xd834('0x8')](_0xd834('0xf7'),require(_0xd834('0xf8')));_0x2d838f[_0xd834('0x8')](_0xd834('0xf9'),clientSideLogs);_0x2d838f[_0xd834('0x8')](_0xd834('0xfa'),express[_0xd834('0xfb')](path[_0xd834('0xfc')](config[_0xd834('0xfd')],_0xd834('0xfa'))));_0x2d838f['use'](_0xd834('0xfe'),express[_0xd834('0xfb')](path['join'](config[_0xd834('0xfd')],'/www')));_0x2d838f[_0xd834('0x8')](_0xd834('0xff'),express[_0xd834('0xfb')](path['join'](config['root'],_0xd834('0xff'))));_0x2d838f[_0xd834('0x8')]('/snippet',express[_0xd834('0xfb')](path[_0xd834('0xfc')](config[_0xd834('0xfd')],_0xd834('0x100'),'3.5.0')));_0x2d838f[_0xd834('0x8')](_0xd834('0x101'),express['static'](path[_0xd834('0xfc')](config[_0xd834('0xfd')],_0xd834('0x102'))));_0x2d838f[_0xd834('0x103')](_0xd834('0x104'))[_0xd834('0x105')](errors[0x194]);_0x2d838f[_0xd834('0x103')]('/*')[_0xd834('0x105')](function(_0x28adcb,_0x352550){_0x352550[_0xd834('0x106')](path['resolve'](_0x2d838f[_0xd834('0x105')](_0xd834('0x107'))+'/index.html'));});return _0x2d838f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 602204d..587484a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f5f=['../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc'];(function(_0xc70ff5,_0x1f8a90){var _0x3f84b4=function(_0x5d55d5){while(--_0x5d55d5){_0xc70ff5['push'](_0xc70ff5['shift']());}};_0x3f84b4(++_0x1f8a90);}(_0x7f5f,0xa0));var _0xf7f5=function(_0x3dbbdb,_0x235a75){_0x3dbbdb=_0x3dbbdb-0x0;var _0x4c3695=_0x7f5f[_0x3dbbdb];return _0x4c3695;};'use strict';var jayson=require(_0xf7f5('0x0'));var _=require(_0xf7f5('0x1'));var config=require(_0xf7f5('0x2'));exports[_0xf7f5('0x3')]=function(){return new Promise(function(_0x2e29ee,_0x13f7e0){var _0x8200e5={};_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x4')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x6')));_0x8200e5=_['merge'](_0x8200e5,require('../api/voiceQueue/voiceQueue.rpc'));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x7')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x8')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x9')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0xa')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/trunk/trunk.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0xb')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0xc')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/mailServerIn/mailServerIn.rpc'));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0xd')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0xe')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/mailInteraction/mailInteraction.rpc'));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0xf')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x10')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x11')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x12')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x13')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/faxMessage/faxMessage.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x14')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x15')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/smsAccount/smsAccount.rpc'));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x16')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x17')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x18')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x19')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x1a')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x1b')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x1c')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x1d')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/chatQueue/chatQueue.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x1e')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/cmHopper/cmHopper.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x1f')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x20')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x21')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x22')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x23')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/sound/sound.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x24')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x25')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x26')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x27')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x28')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x29')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2a')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2b')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2c')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2d')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2e')));_0x8200e5=_['merge'](_0x8200e5,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x2f')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x30')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x31')));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x32')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x33')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/squareOdbc/squareOdbc.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x34')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/squareRecording/squareRecording.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x35')));_0x8200e5=_['merge'](_0x8200e5,require('../api/campaign/campaign.rpc'));_0x8200e5=_['merge'](_0x8200e5,require(_0xf7f5('0x36')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/plugin/plugin.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x37')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x38')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x39')));_0x8200e5=_[_0xf7f5('0x5')](_0x8200e5,require(_0xf7f5('0x3a')));var _0x3e8d60=jayson[_0xf7f5('0x3b')](_0x8200e5)[_0xf7f5('0x3c')]();var _0x2ae433=config['rpc']['port']||config['port']+0x1;var _0x2877a1=config[_0xf7f5('0x3d')]['ip']||_0xf7f5('0x3e');_0x3e8d60['on'](_0xf7f5('0x3f'),function(_0x21746d){return _0x13f7e0(_0x21746d);});_0x3e8d60[_0xf7f5('0x3')](_0x2ae433,_0x2877a1,function(){console['log'](_0xf7f5('0x40'),_0x2877a1,_0x2ae433);require(_0xf7f5('0x41'))['default']();return _0x2e29ee(_0xf7f5('0x42')+_0x2877a1+':'+_0x2ae433);});});}; \ No newline at end of file +var _0xe6c0=['../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc'];(function(_0x596e2a,_0x519023){var _0x5766b9=function(_0x52992e){while(--_0x52992e){_0x596e2a['push'](_0x596e2a['shift']());}};_0x5766b9(++_0x519023);}(_0xe6c0,0x181));var _0x0e6c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe6c0[_0x4243a3];return _0x1b2a33;};'use strict';var jayson=require(_0x0e6c('0x0'));var _=require(_0x0e6c('0x1'));var config=require(_0x0e6c('0x2'));exports[_0x0e6c('0x3')]=function(){return new Promise(function(_0x3ffa37,_0x469416){var _0x40b03b={};_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x5')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x6')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x7')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x8')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x9')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xa')));_0x40b03b=_['merge'](_0x40b03b,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xb')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/memberReport/memberReport.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xc')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xd')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xe')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0xf')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x10')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x11')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x12')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x13')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x14')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x15')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x16')));_0x40b03b=_['merge'](_0x40b03b,require('../api/faxInteraction/faxInteraction.rpc'));_0x40b03b=_['merge'](_0x40b03b,require('../api/faxMessage/faxMessage.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x17')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x18')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/smsAccount/smsAccount.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/smsInteraction/smsInteraction.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/smsMessage/smsMessage.rpc'));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x19')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x1a')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x1b')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x1c')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x1d')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x1e')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x1f')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/chatMessage/chatMessage.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x20')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/cmContact/cmContact.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/cmHopper/cmHopper.rpc'));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x21')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x22')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/interval/interval.rpc'));_0x40b03b=_['merge'](_0x40b03b,require('../api/pause/pause.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/sound/sound.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x23')));_0x40b03b=_['merge'](_0x40b03b,require('../api/template/template.rpc'));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x24')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x25')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x26')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x27')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x28')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x29')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x2a')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x2b')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x2c')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x2d')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x2e')));_0x40b03b=_['merge'](_0x40b03b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x2f')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x30')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x31')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x32')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x33')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x34')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x35')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x36')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x37')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require('../api/plugin/plugin.rpc'));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x38')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x39')));_0x40b03b=_[_0x0e6c('0x4')](_0x40b03b,require(_0x0e6c('0x3a')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x3b')));_0x40b03b=_['merge'](_0x40b03b,require(_0x0e6c('0x3c')));var _0x1f9947=jayson['server'](_0x40b03b)[_0x0e6c('0x3d')]();var _0x9887ac=config['rpc'][_0x0e6c('0x3e')]||config[_0x0e6c('0x3e')]+0x1;var _0x21a728=config[_0x0e6c('0x3f')]['ip']||_0x0e6c('0x40');_0x1f9947['on']('error',function(_0xce58c9){return _0x469416(_0xce58c9);});_0x1f9947[_0x0e6c('0x3')](_0x9887ac,_0x21a728,function(){console[_0x0e6c('0x41')](_0x0e6c('0x42'),_0x21a728,_0x9887ac);require(_0x0e6c('0x43'))[_0x0e6c('0x44')]();return _0x3ffa37(_0x0e6c('0x45')+_0x21a728+':'+_0x9887ac);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 10577d1..5c65b5c 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 _0xefe9=['function','write','inherits','prototype','sync','answer','ANSWER','getData','beep','sendRequest','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','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','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','no\x20code','result=','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command'];(function(_0x552804,_0x3c3d1e){var _0x32be66=function(_0x14c213){while(--_0x14c213){_0x552804['push'](_0x552804['shift']());}};_0x32be66(++_0x3c3d1e);}(_0xefe9,0x83));var _0x9efe=function(_0x3909ae,_0x3183c7){_0x3909ae=_0x3909ae-0x0;var _0x15000b=_0xefe9[_0x3909ae];return _0x15000b;};'use strict';var util=require(_0x9efe('0x0'));var _=require('lodash');var EventEmitter=require(_0x9efe('0x1'))['EventEmitter'];var AGIReply=require(_0x9efe('0x2'));var AGIError=require(_0x9efe('0x3'));function AGIChannel(_0x55d82e){var _0x1056f3=this,_0x51b705=new AGIReply(),_0x13af43=![],_0x215663={};EventEmitter[_0x9efe('0x4')](_0x1056f3);_0x55d82e[_0x9efe('0x5')](_0x9efe('0x6'));_0x55d82e[_0x9efe('0x7')](0x8*0x3c*0x3c*0x3e8);_0x51b705[_0x9efe('0x5')]('utf8');_0x51b705['on'](_0x9efe('0x8'),function(_0x6c374b){for(var _0x25e36e in _0x6c374b){_0x1056f3[_0x25e36e]=_0x6c374b[_0x25e36e];}_0x1056f3[_0x9efe('0x9')](_0x9efe('0xa'));});_0x51b705['on'](_0x9efe('0xb'),function(_0x1d3a65){if(_0x1d3a65[_0x9efe('0xc')]()==_0x9efe('0xd')){_0x1056f3[_0x9efe('0x9')]('hangup');return;}if(_0x1d3a65[_0x9efe('0xe')](0x0,0xb)==_0x9efe('0xf')){_0x13af43=!![];}if(_0x13af43){_0x215663['rx']+=_0x1d3a65+'\x0a';if(_0x1d3a65['search']('520\x20End\x20of\x20proper')!=-0x1){_0x13af43=![];}}else{_0x215663['rx']=_0x1d3a65;}if(_0x13af43){return;}if(typeof _0x215663['cb']=='function'){var _0x2a7dad=_0x215663['rx'][_0x9efe('0xe')](0x0,0x3),_0x412582=null,_0x249453=null;_0x2a7dad=parseInt(_0x2a7dad);if(isNaN(_0x2a7dad)){_0x215663['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9efe('0x10')});return;}if(_0x2a7dad!=0xc8){_0x215663['cb'](null,{'code':_0x2a7dad,'result':-0x1,'extra':'KO'});return;}_0x412582=_0x215663['rx'][_0x9efe('0xe')](0x4)['replace'](_0x9efe('0x11'),'');if(_0x412582['indexOf']('\x20')!=-0x1){_0x412582=_0x412582[_0x9efe('0x12')](0x0,_0x412582[_0x9efe('0x13')]('\x20'));}if(_[_0x9efe('0x14')](_0x412582,'-1')){_0x412582=parseInt(_0x412582);}_0x249453=_0x215663['rx']['split']('\x20');if(_0x249453[_0x9efe('0x15')]==0x3){_0x249453=_0x249453[0x2][_0x9efe('0xe')](0x1,_0x249453[0x2][_0x9efe('0x15')]-0x1);}else if(_0x249453[_0x9efe('0x15')]>0x3){var _0x529357=/\((.+)\)/;var _0x4da903=_0x215663['rx'][_0x9efe('0x16')](_0x529357);if(_0x4da903){_0x249453=_0x4da903[0x1];}else{_0x249453=null;}}else{_0x249453=null;}_0x215663['cb'](null,{'code':_0x2a7dad,'result':_0x412582,'extra':_0x249453});}});_0x55d82e['on'](_0x9efe('0x17'),function(_0x5ad3fa){_0x1056f3['emit'](_0x9efe('0x17'),new AGIError(_0x9efe('0x18'),_0x5ad3fa['code']));});_0x55d82e['on']('close',function(){_0x1056f3[_0x9efe('0x9')](_0x9efe('0x19'),new AGIError(_0x9efe('0x1a')));});_0x55d82e['on'](_0x9efe('0x1b'),function(){_0x1056f3[_0x9efe('0x9')](_0x9efe('0x1b'),new AGIError(_0x9efe('0x1c')));_0x55d82e[_0x9efe('0x1d')]();});_0x55d82e['pipe'](_0x51b705);this[_0x9efe('0x1e')]=function(_0x3454df,_0x262570){var _0x3454df=_0x3454df||'',_0x262570=typeof _0x262570==_0x9efe('0x1f')?_0x262570:new Function();_0x215663={'tx':_0x3454df,'rx':'','cb':_0x262570};_0x55d82e[_0x9efe('0x20')](_0x3454df+'\x0a');},this['close']=function(){_0x55d82e[_0x9efe('0x1d')]();};}util[_0x9efe('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9efe('0x22')]['sendRequest']=function(_0x2490f8){return this['command'][_0x9efe('0x23')](this,_0x2490f8);};AGIChannel['prototype'][_0x9efe('0x24')]=function(){return this['sendRequest'](_0x9efe('0x25'));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x26')]=function(_0x3311ad,_0x527da1,_0x126353){_0x3311ad=_0x3311ad===undefined?_0x9efe('0x27'):_0x3311ad;_0x527da1=_0x527da1===undefined?'5':_0x527da1;_0x126353=_0x126353===undefined?'1':_0x126353;return this[_0x9efe('0x28')](util['format'](_0x9efe('0x29'),_0x3311ad,_0x527da1*0x3e8,_0x126353));};AGIChannel['prototype'][_0x9efe('0x2a')]=function(_0x537419){_0x537419=_0x537419||'NO\x20MESSAGE';return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x2c'),_0x537419));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x2d')]=function(_0x252f3a,_0x387fb4){if(_[_0x9efe('0x2e')](_0x387fb4)){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x2f'),_0x252f3a,_0x387fb4[_0x9efe('0x30')](',')));}return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x2f'),_0x252f3a,_0x387fb4));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x31')]=function(_0x2f4869){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')]('SET\x20CONTEXT\x20%s',_0x2f4869));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x32')]=function(_0x23e721){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x33'),_0x23e721));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x34')]=function(_0x3b7cb1){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x35'),_0x3b7cb1));};AGIChannel[_0x9efe('0x22')][_0x9efe('0xd')]=function(){return this[_0x9efe('0x28')](_0x9efe('0x36'));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x37')]=function(_0x544fba,_0x50139b){var _0x12924f=_[_0x9efe('0x38')](_0x50139b)||_['isNumber'](_0x50139b)?_0x50139b[_0x9efe('0x39')]():_0x50139b;return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x3a'),_0x544fba,_0x12924f?_0x12924f[_0x9efe('0x39')]()[_0x9efe('0x3b')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x9efe('0x3c')]=function(_0x283b65,_0x470437){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x3d'),_0x283b65,_0x470437));};AGIChannel[_0x9efe('0x22')]['sayDigits']=function(_0x50c56f,_0x546b88){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x3e'),_0x50c56f,_0x546b88));};AGIChannel['prototype'][_0x9efe('0x3f')]=function(_0x18afe9,_0x4a5594){return this['sendRequest'](util[_0x9efe('0x2b')](_0x9efe('0x40'),_0x18afe9,_0x4a5594));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x41')]=function(_0x4beea0,_0x403206,_0xc0ff18){_0x403206=_0x403206||this[_0x9efe('0x42')];_0xc0ff18=_0xc0ff18||0x1;this[_0x9efe('0x31')](_0x4beea0);this[_0x9efe('0x32')](_0x403206);this[_0x9efe('0x34')](_0xc0ff18);return this['noop'](util[_0x9efe('0x2b')](_0x9efe('0x43'),_0x4beea0,_0x403206,_0xc0ff18));};AGIChannel[_0x9efe('0x22')]['getVariable']=function(_0x2a9f8a){return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x44'),_0x2a9f8a));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x45')]=function(_0x5d6da9,_0x2e2520,_0xfcea6e,_0x18f56e,_0x1c2505,_0x4003d8){_0x2e2520=_0x2e2520||'wav';_0xfcea6e=_0xfcea6e||'';_0x18f56e=_0x18f56e===undefined?-0x1:_0x18f56e==='-1'?-0x1:_0x18f56e*0x3e8;_0x1c2505=_0x1c2505===undefined?'':'s='+_0x1c2505;_0x4003d8=_0x4003d8?_0x9efe('0x46'):'';return this[_0x9efe('0x28')](util[_0x9efe('0x2b')](_0x9efe('0x47'),_0x5d6da9,_0x2e2520,_0xfcea6e,_0x18f56e,_0x4003d8,_0x1c2505));};AGIChannel['prototype'][_0x9efe('0x48')]=function(_0x473360,_0x49cd4c){_0x49cd4c=_0x49cd4c||'';return this[_0x9efe('0x28')](util['format'](_0x9efe('0x49'),_0x473360,_0x49cd4c));};AGIChannel[_0x9efe('0x22')][_0x9efe('0x4a')]=function(_0x3e62e7){return this[_0x9efe('0x2d')](_0x9efe('0x4b'),_0x3e62e7);};AGIChannel[_0x9efe('0x22')][_0x9efe('0x4c')]=function(_0x94cee3){return this[_0x9efe('0x2d')](_0x9efe('0x4d'),_0x94cee3);};AGIChannel[_0x9efe('0x22')][_0x9efe('0x17')]=function(_0x1539ec,_0x18790e){this['noop'](util[_0x9efe('0x2b')](_0x9efe('0x4e'),_0x1539ec['id'],_0x1539ec[_0x9efe('0x4f')],_0x18790e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9efe('0x50')]=AGIChannel; \ No newline at end of file +var _0xbd36=['isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','call','utf8','setTimeout','setEncoding','headers','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','substr','indexOf','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd36,0x65));var _0x6bd3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbd36[_0x550d12];return _0x12103d;};'use strict';var util=require(_0x6bd3('0x0'));var _=require(_0x6bd3('0x1'));var EventEmitter=require(_0x6bd3('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x6bd3('0x3'));function AGIChannel(_0x64cdcc){var _0x513e89=this,_0x3b2956=new AGIReply(),_0xa0380=![],_0x31143d={};EventEmitter[_0x6bd3('0x4')](_0x513e89);_0x64cdcc['setEncoding'](_0x6bd3('0x5'));_0x64cdcc[_0x6bd3('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3b2956[_0x6bd3('0x7')](_0x6bd3('0x5'));_0x3b2956['on'](_0x6bd3('0x8'),function(_0x3db900){for(var _0x400ef5 in _0x3db900){_0x513e89[_0x400ef5]=_0x3db900[_0x400ef5];}_0x513e89['emit']('ready');});_0x3b2956['on'](_0x6bd3('0x9'),function(_0x50f7f4){if(_0x50f7f4[_0x6bd3('0xa')]()==_0x6bd3('0xb')){_0x513e89[_0x6bd3('0xc')](_0x6bd3('0xb'));return;}if(_0x50f7f4[_0x6bd3('0xd')](0x0,0xb)=='520-Invalid'){_0xa0380=!![];}if(_0xa0380){_0x31143d['rx']+=_0x50f7f4+'\x0a';if(_0x50f7f4[_0x6bd3('0xe')](_0x6bd3('0xf'))!=-0x1){_0xa0380=![];}}else{_0x31143d['rx']=_0x50f7f4;}if(_0xa0380){return;}if(typeof _0x31143d['cb']=='function'){var _0x29c44d=_0x31143d['rx'][_0x6bd3('0xd')](0x0,0x3),_0x43bf5f=null,_0x2a047c=null;_0x29c44d=parseInt(_0x29c44d);if(isNaN(_0x29c44d)){_0x31143d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6bd3('0x10')});return;}if(_0x29c44d!=0xc8){_0x31143d['cb'](null,{'code':_0x29c44d,'result':-0x1,'extra':'KO'});return;}_0x43bf5f=_0x31143d['rx'][_0x6bd3('0xd')](0x4)[_0x6bd3('0x11')](_0x6bd3('0x12'),'');if(_0x43bf5f['indexOf']('\x20')!=-0x1){_0x43bf5f=_0x43bf5f[_0x6bd3('0x13')](0x0,_0x43bf5f[_0x6bd3('0x14')]('\x20'));}if(_['startsWith'](_0x43bf5f,'-1')){_0x43bf5f=parseInt(_0x43bf5f);}_0x2a047c=_0x31143d['rx']['split']('\x20');if(_0x2a047c['length']==0x3){_0x2a047c=_0x2a047c[0x2][_0x6bd3('0xd')](0x1,_0x2a047c[0x2]['length']-0x1);}else if(_0x2a047c[_0x6bd3('0x15')]>0x3){var _0x3aa000=/\((.+)\)/;var _0x425391=_0x31143d['rx'][_0x6bd3('0x16')](_0x3aa000);if(_0x425391){_0x2a047c=_0x425391[0x1];}else{_0x2a047c=null;}}else{_0x2a047c=null;}_0x31143d['cb'](null,{'code':_0x29c44d,'result':_0x43bf5f,'extra':_0x2a047c});}});_0x64cdcc['on']('error',function(_0x573656){_0x513e89[_0x6bd3('0xc')](_0x6bd3('0x17'),new AGIError(_0x6bd3('0x18'),_0x573656[_0x6bd3('0x19')]));});_0x64cdcc['on'](_0x6bd3('0x1a'),function(){_0x513e89[_0x6bd3('0xc')](_0x6bd3('0x1a'),new AGIError(_0x6bd3('0x1b')));});_0x64cdcc['on'](_0x6bd3('0x1c'),function(){_0x513e89[_0x6bd3('0xc')](_0x6bd3('0x1c'),new AGIError(_0x6bd3('0x1d')));_0x64cdcc[_0x6bd3('0x1e')]();});_0x64cdcc[_0x6bd3('0x1f')](_0x3b2956);this[_0x6bd3('0x20')]=function(_0xb989fd,_0x473b10){var _0xb989fd=_0xb989fd||'',_0x473b10=typeof _0x473b10==_0x6bd3('0x21')?_0x473b10:new Function();_0x31143d={'tx':_0xb989fd,'rx':'','cb':_0x473b10};_0x64cdcc['write'](_0xb989fd+'\x0a');},this[_0x6bd3('0x1a')]=function(){_0x64cdcc[_0x6bd3('0x1e')]();};}util[_0x6bd3('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x6bd3('0x23')]=function(_0x3b4056){return this[_0x6bd3('0x20')][_0x6bd3('0x24')](this,_0x3b4056);};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x26')]=function(){return this[_0x6bd3('0x23')](_0x6bd3('0x27'));};AGIChannel['prototype'][_0x6bd3('0x28')]=function(_0x585f4e,_0x112ad3,_0x2d0de8){_0x585f4e=_0x585f4e===undefined?'beep':_0x585f4e;_0x112ad3=_0x112ad3===undefined?'5':_0x112ad3;_0x2d0de8=_0x2d0de8===undefined?'1':_0x2d0de8;return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')](_0x6bd3('0x2a'),_0x585f4e,_0x112ad3*0x3e8,_0x2d0de8));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x2b')]=function(_0x1f45af){_0x1f45af=_0x1f45af||_0x6bd3('0x2c');return this['sendRequest'](util[_0x6bd3('0x29')](_0x6bd3('0x2d'),_0x1f45af));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x2e')]=function(_0x512d39,_0x5e1281){if(_['isArray'](_0x5e1281)){return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')](_0x6bd3('0x2f'),_0x512d39,_0x5e1281[_0x6bd3('0x30')](',')));}return this[_0x6bd3('0x23')](util['format'](_0x6bd3('0x2f'),_0x512d39,_0x5e1281));};AGIChannel[_0x6bd3('0x25')]['setContext']=function(_0x42f454){return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')]('SET\x20CONTEXT\x20%s',_0x42f454));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x31')]=function(_0x5b4b1d){return this[_0x6bd3('0x23')](util['format'](_0x6bd3('0x32'),_0x5b4b1d));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x33')]=function(_0x2f30ea){return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')](_0x6bd3('0x34'),_0x2f30ea));};AGIChannel['prototype'][_0x6bd3('0xb')]=function(){return this[_0x6bd3('0x23')](_0x6bd3('0x35'));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x36')]=function(_0x502520,_0x1c0ccb){var _0xc35367=_[_0x6bd3('0x37')](_0x1c0ccb)||_[_0x6bd3('0x38')](_0x1c0ccb)?_0x1c0ccb[_0x6bd3('0x39')]():_0x1c0ccb;return this['sendRequest'](util['format'](_0x6bd3('0x3a'),_0x502520,_0xc35367?_0xc35367[_0x6bd3('0x39')]()[_0x6bd3('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6bd3('0x25')]['sayNumber']=function(_0x30c3bb,_0x5d5593){return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x30c3bb,_0x5d5593));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x3b')]=function(_0x30d29a,_0x18274d){return this[_0x6bd3('0x23')](util['format'](_0x6bd3('0x3c'),_0x30d29a,_0x18274d));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x3d')]=function(_0x581a22,_0x313ffc){return this['sendRequest'](util[_0x6bd3('0x29')](_0x6bd3('0x3e'),_0x581a22,_0x313ffc));};AGIChannel[_0x6bd3('0x25')]['continueAt']=function(_0x143005,_0x3b7ef4,_0x1ea9f1){_0x3b7ef4=_0x3b7ef4||this[_0x6bd3('0x3f')];_0x1ea9f1=_0x1ea9f1||0x1;this['setContext'](_0x143005);this[_0x6bd3('0x31')](_0x3b7ef4);this[_0x6bd3('0x33')](_0x1ea9f1);return this['noop'](util[_0x6bd3('0x29')](_0x6bd3('0x40'),_0x143005,_0x3b7ef4,_0x1ea9f1));};AGIChannel['prototype'][_0x6bd3('0x41')]=function(_0x397dc8){return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')](_0x6bd3('0x42'),_0x397dc8));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x43')]=function(_0x1ed968,_0x2c0e0e,_0x4b69a2,_0x4563fa,_0x4b8900,_0x30a952){_0x2c0e0e=_0x2c0e0e||_0x6bd3('0x44');_0x4b69a2=_0x4b69a2||'';_0x4563fa=_0x4563fa===undefined?-0x1:_0x4563fa==='-1'?-0x1:_0x4563fa*0x3e8;_0x4b8900=_0x4b8900===undefined?'':'s='+_0x4b8900;_0x30a952=_0x30a952?_0x6bd3('0x45'):'';return this[_0x6bd3('0x23')](util[_0x6bd3('0x29')](_0x6bd3('0x46'),_0x1ed968,_0x2c0e0e,_0x4b69a2,_0x4563fa,_0x30a952,_0x4b8900));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x47')]=function(_0xbea6dd,_0x1c640c){_0x1c640c=_0x1c640c||'';return this['sendRequest'](util[_0x6bd3('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xbea6dd,_0x1c640c));};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x48')]=function(_0x577049){return this[_0x6bd3('0x2e')]('AGI',_0x577049);};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x49')]=function(_0x33f91e){return this['exec'](_0x6bd3('0x4a'),_0x33f91e);};AGIChannel[_0x6bd3('0x25')][_0x6bd3('0x17')]=function(_0x8e86b1,_0xfd7b2){this[_0x6bd3('0x2b')](util['format'](_0x6bd3('0x4b'),_0x8e86b1['id'],_0x8e86b1[_0x6bd3('0x4c')],_0xfd7b2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6bd3('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4e3f069..c1b56a3 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 _0xe62a=['E_AGI_UNDEFINED','push','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x591a49,_0x311d7f){var _0x3b6980=function(_0x297dec){while(--_0x297dec){_0x591a49['push'](_0x591a49['shift']());}};_0x3b6980(++_0x311d7f);}(_0xe62a,0x130));var _0xae62=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe62a[_0x46e363];return _0x3fb059;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xae62('0x0'),'E_AGI_ARGUMENT_PORT':_0xae62('0x1'),'E_AGI_SERVER_ERROR':_0xae62('0x2'),'E_AGI_SERVER_CLOSE':_0xae62('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xae62('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xae62('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xae62('0x6'),'E_AGI_COMMAND_EMPTY':_0xae62('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x522d78){var _0x522d78=_0x522d78||null,_0x2b7e0a=_0x2b7e0a||[],_0x5c4fd3=0x1,_0x31ace9='';if(!error[_0x522d78]){_0x522d78=_0xae62('0x8');}_0x2b7e0a[_0xae62('0x9')](error[_0x522d78]);while(arguments[_0x5c4fd3]){_0x2b7e0a['push'](arguments[_0x5c4fd3]);_0x5c4fd3++;}_0x31ace9=util['format']['apply'](util,_0x2b7e0a);this[_0xae62('0xa')]=_0x31ace9;this[_0xae62('0xb')]=_0x522d78;}module[_0xae62('0xc')]=AGIError; \ No newline at end of file +var _0x9cb6=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','push','apply','name','exports'];(function(_0xc66cf9,_0x7b90e7){var _0x451989=function(_0x1c5887){while(--_0x1c5887){_0xc66cf9['push'](_0xc66cf9['shift']());}};_0x451989(++_0x7b90e7);}(_0x9cb6,0x186));var _0x69cb=function(_0x3cb191,_0x9841f8){_0x3cb191=_0x3cb191-0x0;var _0x3403c2=_0x9cb6[_0x3cb191];return _0x3403c2;};'use strict';var util=require(_0x69cb('0x0'));var error={'E_AGI_UNDEFINED':_0x69cb('0x1'),'E_AGI_ARGUMENT_PORT':_0x69cb('0x2'),'E_AGI_SERVER_ERROR':_0x69cb('0x3'),'E_AGI_SERVER_CLOSE':_0x69cb('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x69cb('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x69cb('0x6'),'E_AGI_SOCKET_CLOSE':_0x69cb('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x69cb('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x35e376){var _0x35e376=_0x35e376||null,_0xfef621=_0xfef621||[],_0x12b6dd=0x1,_0x3f540f='';if(!error[_0x35e376]){_0x35e376='E_AGI_UNDEFINED';}_0xfef621[_0x69cb('0x9')](error[_0x35e376]);while(arguments[_0x12b6dd]){_0xfef621[_0x69cb('0x9')](arguments[_0x12b6dd]);_0x12b6dd++;}_0x3f540f=util['format'][_0x69cb('0xa')](util,_0xfef621);this['message']=_0x3f540f;this[_0x69cb('0xb')]=_0x35e376;}module[_0x69cb('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c78b8f9..92436ea 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 _0xd574=['subscribe','emit','error','message','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x10d271,_0x100e56){var _0x1f942a=function(_0x43757f){while(--_0x43757f){_0x10d271['push'](_0x10d271['shift']());}};_0x1f942a(++_0x100e56);}(_0xd574,0x103));var _0x4d57=function(_0x33fca3,_0x43b72a){_0x33fca3=_0x33fca3-0x0;var _0x65c630=_0xd574[_0x33fca3];return _0x65c630;};'use strict';var _=require(_0x4d57('0x0'));var EventEmitter=require(_0x4d57('0x1'))[_0x4d57('0x2')];var Redis=require(_0x4d57('0x3'));var AGIError=require(_0x4d57('0x4'));var config=require(_0x4d57('0x5'));config[_0x4d57('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4d57('0x6')]);sub[_0x4d57('0x7')]('agi',function(_0x19cff3){if(_0x19cff3)return eventEmitter[_0x4d57('0x8')](_0x4d57('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x19cff3));});sub['on'](_0x4d57('0xa'),function(_0x421719,_0x3f9bb9){if(_0x421719!=='agi')return;try{var _0x2f7b26=JSON['parse'](_0x3f9bb9);eventEmitter[_0x4d57('0x8')](_0x4d57('0xb'),_0x2f7b26);}catch(_0x21b827){eventEmitter[_0x4d57('0x8')](_0x4d57('0x9'),new AGIError(_0x4d57('0xc'),_0x21b827));}});module[_0x4d57('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xad3f=['events','EventEmitter','ioredis','redis','defaults','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','exports'];(function(_0x5c3732,_0x44e0be){var _0x5a80ff=function(_0x75ad6){while(--_0x75ad6){_0x5c3732['push'](_0x5c3732['shift']());}};_0x5a80ff(++_0x44e0be);}(_0xad3f,0xc3));var _0xfad3=function(_0xeb6bb1,_0xc83c4c){_0xeb6bb1=_0xeb6bb1-0x0;var _0x387e00=_0xad3f[_0xeb6bb1];return _0x387e00;};'use strict';var _=require('lodash');var EventEmitter=require(_0xfad3('0x0'))[_0xfad3('0x1')];var Redis=require(_0xfad3('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0xfad3('0x3')]=_[_0xfad3('0x4')](config[_0xfad3('0x3')],{'host':_0xfad3('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfad3('0x3')]);sub[_0xfad3('0x6')](_0xfad3('0x7'),function(_0x31c2d4){if(_0x31c2d4)return eventEmitter['emit'](_0xfad3('0x8'),new AGIError(_0xfad3('0x9'),_0x31c2d4));});sub['on'](_0xfad3('0xa'),function(_0x5358e9,_0x4c17de){if(_0x5358e9!=='agi')return;try{var _0x24e670=JSON[_0xfad3('0xb')](_0x4c17de);eventEmitter[_0xfad3('0xc')](_0xfad3('0xd'),_0x24e670);}catch(_0x24b7b5){eventEmitter['emit']('error',new AGIError(_0xfad3('0x9'),_0x24b7b5));}});module[_0xfad3('0xe')]={'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 1f81872..d3c5b17 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 _0x3812=['size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','lodash','../../../config/logger','menu','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3812,0x1c0));var _0x2381=function(_0x14de25,_0x20c661){_0x14de25=_0x14de25-0x0;var _0x4740fd=_0x3812[_0x14de25];return _0x4740fd;};'use strict';var _=require(_0x2381('0x0'));var logger=require(_0x2381('0x1'))('agi');var verticesWithRetry=[_0x2381('0x2'),'getdigits',_0x2381('0x3')];var Graph=function(){this[_0x2381('0x4')]={};this['edges']={};this[_0x2381('0x5')]=0x0;};Graph[_0x2381('0x6')][_0x2381('0x7')]=function(_0x5b82c3){this[_0x2381('0x4')][_0x5b82c3['id']]=_0x5b82c3;this[_0x2381('0x8')][_0x5b82c3['id']]=[];};Graph[_0x2381('0x6')][_0x2381('0x9')]=function(_0x1f26b4,_0x16b503,_0xe62ff7){this['edges'][_0x1f26b4][_0x2381('0xa')]({'target':_0x16b503,'condition':_0xe62ff7});this['numberOfEdges']+=0x1;};Graph[_0x2381('0x6')][_0x2381('0xb')]=function(){return _[_0x2381('0xb')](this['vertices']);};Graph[_0x2381('0x6')][_0x2381('0xc')]=function(){return this[_0x2381('0x5')];};Graph[_0x2381('0x6')][_0x2381('0xd')]=function(_0x553667){return this['vertices'][_0x553667];};Graph[_0x2381('0x6')][_0x2381('0xe')]=function(_0x4d6e00,_0x134ac3){if(!this[_0x2381('0x4')][_0x4d6e00]){return logger[_0x2381('0xf')]('no\x20vertex\x20found');}var _0x18deb2=_0x134ac3(this[_0x2381('0x4')][_0x4d6e00]);if(!_0x18deb2){return logger[_0x2381('0xf')](_0x2381('0x10'));}if(this['edges'][_0x4d6e00][_0x2381('0x11')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x561c01=0x0,_0x18e855=[],_0x171acd=![];_0x561c01\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','then','catch','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','close','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info'];(function(_0x1fe539,_0x5bb50c){var _0x2257e1=function(_0x4ff213){while(--_0x4ff213){_0x1fe539['push'](_0x1fe539['shift']());}};_0x2257e1(++_0x5bb50c);}(_0x7634,0x117));var _0x4763=function(_0x2039d2,_0x1fd748){_0x2039d2=_0x2039d2-0x0;var _0x4214b4=_0x7634[_0x2039d2];return _0x4214b4;};'use strict';var _=require(_0x4763('0x0'));var syncho=require(_0x4763('0x1'));var util=require(_0x4763('0x2'));var config=require('../../config/environment');var logger=require(_0x4763('0x3'))(_0x4763('0x4'));var utilLicense=require(_0x4763('0x5'));var rpc=require(_0x4763('0x6'));var Project=require(_0x4763('0x7'));var AGIEmitter=require(_0x4763('0x8'))[_0x4763('0x9')];var projects=[];config[_0x4763('0x4')]=_[_0x4763('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x4763('0xb'),projectUpdateHandler);function connectionHandler(_0x2773da){process[_0x4763('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2773da);agiHandler(_0x2773da);}catch(_0xc9ff79){logger[_0x4763('0xd')](_0xc9ff79[_0x4763('0xe')]);}});});}function projectUpdateHandler(_0x2080f2){try{var _0x4f2fa2=_[_0x4763('0xf')](projects,['id',_0x2080f2['id']]);if(_0x4f2fa2>-0x1){if(_0x2080f2[_0x4763('0x10')]===!![]){projects[_0x4763('0x11')](_0x4f2fa2,0x1);}else{projects[_0x4f2fa2]=_0x2080f2;}}else{projects[_0x4763('0x12')](_0x2080f2);}}catch(_0x38ba2f){logger[_0x4763('0xd')](_0x38ba2f['stack']);}}function listeningHandler(){console['log'](_0x4763('0x13'),config[_0x4763('0x4')]['port']);logger[_0x4763('0x14')](util[_0x4763('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4763('0x4')]['ip'],config[_0x4763('0x4')][_0x4763('0x16')]));}function errorHandler(_0x1894ac){if(_0x1894ac&&_0x1894ac['name']&&_0x1894ac[_0x4763('0x17')]){logger[_0x4763('0xd')](util['format']('[%s]\x20%s',_0x1894ac[_0x4763('0x18')],_0x1894ac[_0x4763('0x17')]));}else{logger[_0x4763('0xd')](util[_0x4763('0x15')]('[ERROR]\x20%s',_0x1894ac[_0x4763('0xe')]));}}function closeHandler(){logger[_0x4763('0x14')](util[_0x4763('0x15')](_0x4763('0x19'),this[_0x4763('0x1a')],this[_0x4763('0x1b')],this['callerid'],this[_0x4763('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x216106){logger[_0x4763('0xd')](_0x216106[_0x4763('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x4763('0x15')](_0x4763('0x1d'),this[_0x4763('0x1a')],this[_0x4763('0x1b')],this[_0x4763('0x1e')],this[_0x4763('0x1c')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4763('0x1b')],this[_0x4763('0x1e')],this[_0x4763('0x1c')],this[_0x4763('0x1f')]));this['evtHangup']=!![];}function createSquareReport(_0x2bab4d,_0x164379){rpc['createSquareReport'](_0x2bab4d)[_0x4763('0x20')](function(_0x498b71){if(_0x164379){_0x164379(null,_0x498b71);}})[_0x4763('0x21')](function(_0xa44c3d){if(_0x164379){_0x164379(null,_0xa44c3d);}});}function setChannelVariables(_0x59f1b3){for(var _0x31ced5 in _0x59f1b3){if(_0x59f1b3['hasOwnProperty'](_0x31ced5)){if(_0x31ced5[_0x4763('0x22')](_0x4763('0x23'))===0x0){_0x59f1b3[_0x31ced5[_0x4763('0x24')](0x4)]=_0x59f1b3[_0x31ced5];delete _0x59f1b3[_0x31ced5];}}}}function agiHandler(_0x365465){logger[_0x4763('0x25')](_0x4763('0x26'),JSON[_0x4763('0x27')](_0x365465,null,0x2));logger['info'](util[_0x4763('0x15')](_0x4763('0x28'),_0x365465[_0x4763('0x1a')],_0x365465['calleridname'],_0x365465[_0x4763('0x1e')],_0x365465[_0x4763('0x1c')],_0x365465[_0x4763('0x1f')]));_0x365465['on'](_0x4763('0xd'),errorHandler);_0x365465['on']('close',closeHandler);_0x365465['on'](_0x4763('0x29'),timeoutHandler);_0x365465[_0x4763('0x2a')]=![];_0x365465['on'](_0x4763('0x2b'),hangupHandler);var _0x18c989=_[_0x4763('0x2c')](projects,[_0x4763('0x18'),_0x365465['arg_1']]);if(!_0x18c989)return Project[_0x4763('0x2d')](_0x365465);if(!_0x18c989[_0x4763('0x2e')])return Project[_0x4763('0x2f')](_0x365465);return Project[_0x4763('0x30')](_0x18c989,_0x365465);}function main(){var _0x5b901a;return utilLicense[_0x4763('0x31')]()['then'](function(_0x3c9c32){if(!_0x3c9c32)return;if(_0x3c9c32[_0x4763('0x32')]){if(_0x3c9c32[_0x4763('0x33')]&&_0x3c9c32[_0x4763('0x33')]>0x0){logger['info'](util[_0x4763('0x15')](_0x4763('0x34'),_0x3c9c32['callysquare']));_0x5b901a=_0x3c9c32[_0x4763('0x33')];}else{logger[_0x4763('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x4763('0x14')](_0x4763('0x35'));_0x5b901a=-0x1;}})[_0x4763('0x20')](function(){return Project[_0x4763('0x36')]();})[_0x4763('0x20')](function(_0xe54796){projects=_0xe54796;return;})[_0x4763('0x21')](function(_0x5a18a8){logger[_0x4763('0xd')]('[LICENSE]',_0x5a18a8[_0x4763('0xe')]);})[_0x4763('0x37')](function(){var _0x488e80=require(_0x4763('0x38'))(config[_0x4763('0x4')][_0x4763('0x16')],config['agi']['ip'],_0x5b901a);_0x488e80['on']('error',errorHandler);_0x488e80['on'](_0x4763('0x39'),listeningHandler);_0x488e80['on'](_0x4763('0x3a'),connectionHandler);_0x488e80['on'](_0x4763('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0x2b9b=['callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[ERROR]\x20%s','arg_1','calleridname'];(function(_0x586995,_0x444ece){var _0x1b74f2=function(_0x5c0913){while(--_0x5c0913){_0x586995['push'](_0x586995['shift']());}};_0x1b74f2(++_0x444ece);}(_0x2b9b,0x156));var _0xb2b9=function(_0x44c595,_0x518ca2){_0x44c595=_0x44c595-0x0;var _0x5404d2=_0x2b9b[_0x44c595];return _0x5404d2;};'use strict';var _=require(_0xb2b9('0x0'));var syncho=require(_0xb2b9('0x1'));var util=require(_0xb2b9('0x2'));var config=require(_0xb2b9('0x3'));var logger=require(_0xb2b9('0x4'))(_0xb2b9('0x5'));var utilLicense=require(_0xb2b9('0x6'));var rpc=require(_0xb2b9('0x7'));var Project=require(_0xb2b9('0x8'));var AGIEmitter=require(_0xb2b9('0x9'))[_0xb2b9('0xa')];var projects=[];config['agi']=_[_0xb2b9('0xb')](config[_0xb2b9('0x5')],{'ip':_0xb2b9('0xc'),'port':0x11dd});AGIEmitter['on'](_0xb2b9('0xd'),projectUpdateHandler);function connectionHandler(_0x3c6b47){process[_0xb2b9('0xe')](function(){syncho(function(){try{setChannelVariables(_0x3c6b47);agiHandler(_0x3c6b47);}catch(_0x13c1d1){logger[_0xb2b9('0xf')](_0x13c1d1[_0xb2b9('0x10')]);}});});}function projectUpdateHandler(_0x2ef48a){try{var _0x197c53=_['findIndex'](projects,['id',_0x2ef48a['id']]);if(_0x197c53>-0x1){if(_0x2ef48a[_0xb2b9('0x11')]===!![]){projects[_0xb2b9('0x12')](_0x197c53,0x1);}else{projects[_0x197c53]=_0x2ef48a;}}else{projects[_0xb2b9('0x13')](_0x2ef48a);}}catch(_0x15ad6b){logger['error'](_0x15ad6b[_0xb2b9('0x10')]);}}function listeningHandler(){console[_0xb2b9('0x14')](_0xb2b9('0x15'),config[_0xb2b9('0x5')][_0xb2b9('0x16')]);logger[_0xb2b9('0x17')](util[_0xb2b9('0x18')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi'][_0xb2b9('0x16')]));}function errorHandler(_0x4d07f3){if(_0x4d07f3&&_0x4d07f3[_0xb2b9('0x19')]&&_0x4d07f3[_0xb2b9('0x1a')]){logger[_0xb2b9('0xf')](util['format']('[%s]\x20%s',_0x4d07f3['name'],_0x4d07f3['message']));}else{logger[_0xb2b9('0xf')](util['format'](_0xb2b9('0x1b'),_0x4d07f3[_0xb2b9('0x10')]));}}function closeHandler(){logger['info'](util[_0xb2b9('0x18')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb2b9('0x1c')],this[_0xb2b9('0x1d')],this[_0xb2b9('0x1e')],this[_0xb2b9('0x1f')],this[_0xb2b9('0x20')]));try{createSquareReport(this);}catch(_0x474288){logger['error'](_0x474288[_0xb2b9('0x10')]);}}function timeoutHandler(){logger[_0xb2b9('0x17')](util[_0xb2b9('0x18')](_0xb2b9('0x21'),this['arg_1'],this[_0xb2b9('0x1d')],this[_0xb2b9('0x1e')],this['dnid'],this[_0xb2b9('0x20')]));}function hangupHandler(){logger[_0xb2b9('0x17')](util[_0xb2b9('0x18')](_0xb2b9('0x22'),this[_0xb2b9('0x1c')],this['calleridname'],this['callerid'],this[_0xb2b9('0x1f')],this[_0xb2b9('0x20')]));this[_0xb2b9('0x23')]=!![];}function createSquareReport(_0x520945,_0xf727d6){rpc[_0xb2b9('0x24')](_0x520945)[_0xb2b9('0x25')](function(_0x4a98cb){if(_0xf727d6){_0xf727d6(null,_0x4a98cb);}})[_0xb2b9('0x26')](function(_0x250bf0){if(_0xf727d6){_0xf727d6(null,_0x250bf0);}});}function setChannelVariables(_0x496174){for(var _0x399459 in _0x496174){if(_0x496174[_0xb2b9('0x27')](_0x399459)){if(_0x399459[_0xb2b9('0x28')](_0xb2b9('0x29'))===0x0){_0x496174[_0x399459[_0xb2b9('0x2a')](0x4)]=_0x496174[_0x399459];delete _0x496174[_0x399459];}}}}function agiHandler(_0x271d88){logger['debug'](_0xb2b9('0x2b'),JSON[_0xb2b9('0x2c')](_0x271d88,null,0x2));logger[_0xb2b9('0x17')](util[_0xb2b9('0x18')](_0xb2b9('0x2d'),_0x271d88['arg_1'],_0x271d88[_0xb2b9('0x1d')],_0x271d88[_0xb2b9('0x1e')],_0x271d88[_0xb2b9('0x1f')],_0x271d88['uniqueid']));_0x271d88['on'](_0xb2b9('0xf'),errorHandler);_0x271d88['on'](_0xb2b9('0x2e'),closeHandler);_0x271d88['on'](_0xb2b9('0x2f'),timeoutHandler);_0x271d88[_0xb2b9('0x23')]=![];_0x271d88['on'](_0xb2b9('0x30'),hangupHandler);var _0x2ad925=_['find'](projects,[_0xb2b9('0x19'),_0x271d88[_0xb2b9('0x1c')]]);if(!_0x2ad925)return Project[_0xb2b9('0x31')](_0x271d88);if(!_0x2ad925[_0xb2b9('0x32')])return Project['handleUnpublished'](_0x271d88);return Project[_0xb2b9('0x33')](_0x2ad925,_0x271d88);}function main(){var _0x2a28ff;return utilLicense[_0xb2b9('0x34')]()['then'](function(_0x52357c){if(!_0x52357c)return;if(_0x52357c[_0xb2b9('0x35')]){if(_0x52357c[_0xb2b9('0x36')]&&_0x52357c[_0xb2b9('0x36')]>0x0){logger[_0xb2b9('0x17')](util[_0xb2b9('0x18')](_0xb2b9('0x37'),_0x52357c['callysquare']));_0x2a28ff=_0x52357c[_0xb2b9('0x36')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xb2b9('0x17')](_0xb2b9('0x38'));_0x2a28ff=-0x1;}})['then'](function(){return Project[_0xb2b9('0x39')]();})[_0xb2b9('0x25')](function(_0x21768a){projects=_0x21768a;return;})[_0xb2b9('0x26')](function(_0x35e23f){logger['error'](_0xb2b9('0x3a'),_0x35e23f[_0xb2b9('0x10')]);})[_0xb2b9('0x3b')](function(){var _0x192f89=require(_0xb2b9('0x3c'))(config[_0xb2b9('0x5')][_0xb2b9('0x16')],config[_0xb2b9('0x5')]['ip'],_0x2a28ff);_0x192f89['on'](_0xb2b9('0xf'),errorHandler);_0x192f89['on']('listening',listeningHandler);_0x192f89['on'](_0xb2b9('0x3d'),connectionHandler);_0x192f89['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index b03a7b2..231d5b2 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 _0x419c=['jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x1b1451,_0x49f903){var _0x187391=function(_0x57968a){while(--_0x57968a){_0x1b1451['push'](_0x1b1451['shift']());}};_0x187391(++_0x49f903);}(_0x419c,0x196));var _0xc419=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x419c[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require(_0xc419('0x0'));var jayson=require(_0xc419('0x1'));var client=jayson['client'][_0xc419('0x2')]({'port':0x232b});function request(_0x5a4c58,_0x228d1d){return new BPromise(function(_0x732098,_0xb57db9){return client[_0xc419('0x3')](_0x5a4c58,_0x228d1d)[_0xc419('0x4')](function(_0x553d42){if(_0x553d42[_0xc419('0x5')]){return _0xb57db9(_0x553d42[_0xc419('0x5')][_0xc419('0x6')]);}else{return _0x732098(_0x553d42[_0xc419('0x7')]);}})[_0xc419('0x8')](function(_0x33c3ff){return _0xb57db9(_0x33c3ff);});});}exports[_0xc419('0x9')]=function(_0x1eb88a,_0x377f3d){return request(_0xc419('0xa'),{'account':_0x1eb88a,'message':_0x377f3d});}; \ No newline at end of file +var _0xe659=['bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x181fba,_0x3e23f4){var _0x509d8d=function(_0x1357d1){while(--_0x1357d1){_0x181fba['push'](_0x181fba['shift']());}};_0x509d8d(++_0x3e23f4);}(_0xe659,0x1ef));var _0x9e65=function(_0x511e82,_0x5c8e7b){_0x511e82=_0x511e82-0x0;var _0x32bc8e=_0xe659[_0x511e82];return _0x32bc8e;};'use strict';var BPromise=require(_0x9e65('0x0'));var jayson=require(_0x9e65('0x1'));var client=jayson[_0x9e65('0x2')][_0x9e65('0x3')]({'port':0x232b});function request(_0x4a9b48,_0x1a4b1c){return new BPromise(function(_0x3954ce,_0x4a71a7){return client[_0x9e65('0x4')](_0x4a9b48,_0x1a4b1c)[_0x9e65('0x5')](function(_0x4699b4){if(_0x4699b4[_0x9e65('0x6')]){return _0x4a71a7(_0x4699b4['error'][_0x9e65('0x7')]);}else{return _0x3954ce(_0x4699b4[_0x9e65('0x8')]);}})[_0x9e65('0x9')](function(_0x11bee8){return _0x4a71a7(_0x11bee8);});});}exports[_0x9e65('0xa')]=function(_0x24d850,_0x13689d){return request('SendMail',{'account':_0x24d850,'message':_0x13689d});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 179187f..671ed4a 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 _0xbc8c=['close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./mailRpc','./graph','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','source','target','value','mxGraphModel','root','start','debug','stringify','YYYY-MM-DD\x20HH:mm:ss','omit','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','clear','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','toString','error','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','vertex','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt'];(function(_0x4e1ac0,_0x17ce8d){var _0x2432a8=function(_0x4a3b20){while(--_0x4a3b20){_0x4e1ac0['push'](_0x4e1ac0['shift']());}};_0x2432a8(++_0x17ce8d);}(_0xbc8c,0x11c));var _0xcbc8=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xbc8c[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0xcbc8('0x0'));var moment=require('moment');var parser=require(_0xcbc8('0x1'));var util=require(_0xcbc8('0x2'));var logger=require(_0xcbc8('0x3'))(_0xcbc8('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xcbc8('0x5'));var Graph=require(_0xcbc8('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x3c47f2){logger['error'](_0xcbc8('0x7'),_0x3c47f2[_0xcbc8('0x8')]);return[];});}function addVertex(_0x555801,_0x1e6e30,_0x998501){_0x1e6e30[_0xcbc8('0x9')]=_0x998501;if(_0x1e6e30['hasOwnProperty']('retry')){_0x1e6e30['maxRetry']=parseInt(_0x1e6e30[_0xcbc8('0xa')],0xa);}_0x555801[_0xcbc8('0xb')](_['omit'](_0x1e6e30,'mxCell'));}function initGraph(_0x34a97a,_0x4f0ea3){var _0x3d9411=new Graph();for(var _0x597736 in _0x34a97a){if(_0x34a97a[_0xcbc8('0xc')](_0x597736)){if(_[_0xcbc8('0xd')](_0x34a97a[_0x597736])){for(var _0x3c9557=0x0;_0x3c9557<_0x34a97a[_0x597736][_0xcbc8('0xe')];_0x3c9557+=0x1){addVertex(_0x3d9411,_0x34a97a[_0x597736][_0x3c9557],_0x597736);}}else{addVertex(_0x3d9411,_0x34a97a[_0x597736],_0x597736);}}}for(var _0x5e0b86=0x0;_0x5e0b86<_0x4f0ea3[_0xcbc8('0xe')];_0x5e0b86+=0x1){if(_0x4f0ea3[_0x5e0b86][_0xcbc8('0xf')]&&_0x4f0ea3[_0x5e0b86]['target']){_0x3d9411['addEdge'](_0x4f0ea3[_0x5e0b86][_0xcbc8('0xf')],_0x4f0ea3[_0x5e0b86][_0xcbc8('0x10')],_0x4f0ea3[_0x5e0b86][_0xcbc8('0x11')]);}}return _0x3d9411;}function getRoot(_0x3249b7){return parser['toJson'](_0x3249b7,{'object':!![]})[_0xcbc8('0x12')][_0xcbc8('0x13')];}function inspect(_0x3f029d){return util['inspect'](_0x3f029d,{'showHidden':![],'depth':null});}function initialize(_0x20294f,_0x1584da){var _0x27f0e0=getRoot(_0x20294f['production']);if(!_0x27f0e0||!_0x27f0e0[_0xcbc8('0x14')])return;var _0x21b802,_0x15a4a2,_0x32ef9d;logger[_0xcbc8('0x15')](_0xcbc8('0x13'),JSON[_0xcbc8('0x16')](_0x27f0e0,null,0x2));_0x1584da['joinAt']=moment()['format'](_0xcbc8('0x17'));_0x21b802=initGraph(_[_0xcbc8('0x18')](_0x27f0e0,'mxCell'),_0x27f0e0['mxCell']);_0x15a4a2=new Vertices(_0x1584da,rpc,mailRpc);logger['info'](util[_0xcbc8('0x19')](_0xcbc8('0x1a'),_0x1584da[_0xcbc8('0x1b')],_0x1584da[_0xcbc8('0x1c')],_0x1584da[_0xcbc8('0x1d')],_0x1584da[_0xcbc8('0x1e')],_0x1584da['uniqueid']));_0x21b802[_0xcbc8('0x1f')](_0x27f0e0['start']['id'],function(_0x2e8045){try{_0x2e8045=_0x15a4a2[_0xcbc8('0x20')](_0x2e8045);logger[_0xcbc8('0x15')]('vertex',JSON[_0xcbc8('0x16')](_0x2e8045,null,0x2));if(_0x2e8045[_0xcbc8('0x9')]===_0xcbc8('0x21')){logger[_0xcbc8('0x22')](_0xcbc8('0x23'));_0x1584da[_0xcbc8('0x24')]=_0x2e8045['context']||_0x1584da[_0xcbc8('0x24')];_0x1584da[_0xcbc8('0x25')]=_0x2e8045['extension'];_0x1584da[_0xcbc8('0x26')]=_0x2e8045[_0xcbc8('0x26')]?_0x2e8045['priority']-0x1:0x1;return null;}else if(_0x2e8045&&_0x15a4a2[_0x2e8045[_0xcbc8('0x9')]]){_0x32ef9d=_0x15a4a2[_0x2e8045[_0xcbc8('0x9')]](_0x2e8045);logger['info']('response',JSON[_0xcbc8('0x16')](_0x32ef9d,null,0x2));if(_0x32ef9d&&_0x32ef9d[_0xcbc8('0x27')]===AGI_CODE_SUCCESS&&_0x32ef9d[_0xcbc8('0x28')]!==AGI_RESULT_ERROR&&!_0x1584da['evtHangup']){logger[_0xcbc8('0x15')]('response',inspect(_0x32ef9d));return _['isUndefined'](_0x32ef9d['result'])?null:_0x32ef9d[_0xcbc8('0x28')][_0xcbc8('0x29')]();}else{logger[_0xcbc8('0x2a')](_0xcbc8('0x2b'),inspect(_0x32ef9d));return null;}}else{logger[_0xcbc8('0x2a')](_0xcbc8('0x2c'));return null;}}catch(_0x1358ee){logger[_0xcbc8('0x2a')](_0x1358ee[_0xcbc8('0x8')]);return null;}});if(_0x27f0e0[_0xcbc8('0x2d')]){logger[_0xcbc8('0x22')](util['format'](_0xcbc8('0x2e'),_0x1584da[_0xcbc8('0x1b')],_0x1584da['calleridname'],_0x1584da[_0xcbc8('0x1d')],_0x1584da[_0xcbc8('0x1e')],_0x1584da[_0xcbc8('0x2f')]));_0x21b802['traverseBFS'](_0x27f0e0[_0xcbc8('0x2d')]['id'],function(_0x344c75){try{_0x344c75=_0x15a4a2[_0xcbc8('0x20')](_0x344c75);logger[_0xcbc8('0x15')](_0xcbc8('0x30'),JSON['stringify'](_0x344c75,null,0x2));if(_0x344c75&&_0x15a4a2[_0x344c75[_0xcbc8('0x9')]]){_0x32ef9d=_0x15a4a2[_0x344c75[_0xcbc8('0x9')]](_0x344c75);if(_0x32ef9d){logger[_0xcbc8('0x15')](_0xcbc8('0x2b'),inspect(_0x32ef9d));return _[_0xcbc8('0x31')](_0x32ef9d[_0xcbc8('0x28')])?null:_0x32ef9d[_0xcbc8('0x28')][_0xcbc8('0x29')]();}else{logger[_0xcbc8('0x2a')](_0xcbc8('0x2b'),inspect(_0x32ef9d));return null;}}else{logger[_0xcbc8('0x2a')]('agicommand\x20not\x20found');return null;}}catch(_0x35bc73){logger[_0xcbc8('0x2a')](_0x35bc73[_0xcbc8('0x8')]);return null;}});}logger[_0xcbc8('0x22')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1584da['arg_1'],_0x1584da[_0xcbc8('0x1c')],_0x1584da[_0xcbc8('0x1d')],_0x1584da[_0xcbc8('0x1e')],_0x1584da['uniqueid']));logger[_0xcbc8('0x22')](util['format'](_0xcbc8('0x32'),_0x1584da[_0xcbc8('0x24')],_0x1584da[_0xcbc8('0x25')],parseInt(_0x1584da[_0xcbc8('0x26')],0xa)+0x1));_0x1584da[_0xcbc8('0x33')](_0x1584da['context'],_0x1584da[_0xcbc8('0x25')],parseInt(_0x1584da[_0xcbc8('0x26')],0xa)+0x1);_0x1584da[_0xcbc8('0x34')]();}function handleNotFound(_0x25a580){logger['error'](util[_0xcbc8('0x19')](_0xcbc8('0x35'),_0x25a580[_0xcbc8('0x1b')]));_0x25a580['continueAt'](_0x25a580[_0xcbc8('0x24')],_0x25a580[_0xcbc8('0x25')],parseInt(_0x25a580[_0xcbc8('0x26')],0xa)+0x1);_0x25a580[_0xcbc8('0x34')]();}function handleUnpublished(_0x1518c6){logger[_0xcbc8('0x2a')](util['format'](_0xcbc8('0x36'),_0x1518c6[_0xcbc8('0x1b')]));_0x1518c6[_0xcbc8('0x33')](_0x1518c6[_0xcbc8('0x24')],_0x1518c6[_0xcbc8('0x25')],parseInt(_0x1518c6['priority'],0xa)+0x1);_0x1518c6[_0xcbc8('0x34')]();}module[_0xcbc8('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xab54=['source','target','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','calleridname','callerid','dnid','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','./rpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','mxCell','isArray'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xab54,0x112));var _0x4ab5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var parser=require('xml2json');var util=require(_0x4ab5('0x2'));var logger=require(_0x4ab5('0x3'))('agi');var rpc=require(_0x4ab5('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x4ab5('0x5'));var Vertices=require(_0x4ab5('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4ab5('0x7')]()[_0x4ab5('0x8')](function(_0x5411bf){logger['error'](_0x4ab5('0x9'),_0x5411bf[_0x4ab5('0xa')]);return[];});}function addVertex(_0x50f345,_0x1d999c,_0x43289f){_0x1d999c['agicommand']=_0x43289f;if(_0x1d999c[_0x4ab5('0xb')](_0x4ab5('0xc'))){_0x1d999c[_0x4ab5('0xd')]=parseInt(_0x1d999c[_0x4ab5('0xc')],0xa);}_0x50f345['addVertex'](_['omit'](_0x1d999c,_0x4ab5('0xe')));}function initGraph(_0x2724de,_0x48d4ff){var _0x49bee9=new Graph();for(var _0x198cab in _0x2724de){if(_0x2724de[_0x4ab5('0xb')](_0x198cab)){if(_[_0x4ab5('0xf')](_0x2724de[_0x198cab])){for(var _0x2dbd4a=0x0;_0x2dbd4a<_0x2724de[_0x198cab]['length'];_0x2dbd4a+=0x1){addVertex(_0x49bee9,_0x2724de[_0x198cab][_0x2dbd4a],_0x198cab);}}else{addVertex(_0x49bee9,_0x2724de[_0x198cab],_0x198cab);}}}for(var _0x223f74=0x0;_0x223f74<_0x48d4ff['length'];_0x223f74+=0x1){if(_0x48d4ff[_0x223f74][_0x4ab5('0x10')]&&_0x48d4ff[_0x223f74][_0x4ab5('0x11')]){_0x49bee9['addEdge'](_0x48d4ff[_0x223f74][_0x4ab5('0x10')],_0x48d4ff[_0x223f74][_0x4ab5('0x11')],_0x48d4ff[_0x223f74]['value']);}}return _0x49bee9;}function getRoot(_0x22a84f){return parser[_0x4ab5('0x12')](_0x22a84f,{'object':!![]})[_0x4ab5('0x13')][_0x4ab5('0x14')];}function inspect(_0x50ae6f){return util[_0x4ab5('0x15')](_0x50ae6f,{'showHidden':![],'depth':null});}function initialize(_0x52bcde,_0x16ed2e){var _0xb9375=getRoot(_0x52bcde[_0x4ab5('0x16')]);if(!_0xb9375||!_0xb9375[_0x4ab5('0x17')])return;var _0x201e33,_0x2c4053,_0x5cfa47;logger[_0x4ab5('0x18')](_0x4ab5('0x14'),JSON[_0x4ab5('0x19')](_0xb9375,null,0x2));_0x16ed2e[_0x4ab5('0x1a')]=moment()[_0x4ab5('0x1b')](_0x4ab5('0x1c'));_0x201e33=initGraph(_['omit'](_0xb9375,_0x4ab5('0xe')),_0xb9375[_0x4ab5('0xe')]);_0x2c4053=new Vertices(_0x16ed2e,rpc,mailRpc);logger[_0x4ab5('0x1d')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x16ed2e['arg_1'],_0x16ed2e[_0x4ab5('0x1e')],_0x16ed2e[_0x4ab5('0x1f')],_0x16ed2e[_0x4ab5('0x20')],_0x16ed2e['uniqueid']));_0x201e33['traverseBFS'](_0xb9375[_0x4ab5('0x17')]['id'],function(_0x402281){try{_0x402281=_0x2c4053[_0x4ab5('0x21')](_0x402281);logger[_0x4ab5('0x18')](_0x4ab5('0x22'),JSON[_0x4ab5('0x19')](_0x402281,null,0x2));if(_0x402281[_0x4ab5('0x23')]===_0x4ab5('0x24')){logger[_0x4ab5('0x1d')](_0x4ab5('0x25'));_0x16ed2e[_0x4ab5('0x26')]=_0x402281[_0x4ab5('0x26')]||_0x16ed2e['context'];_0x16ed2e['extension']=_0x402281[_0x4ab5('0x27')];_0x16ed2e[_0x4ab5('0x28')]=_0x402281[_0x4ab5('0x28')]?_0x402281[_0x4ab5('0x28')]-0x1:0x1;return null;}else if(_0x402281&&_0x2c4053[_0x402281[_0x4ab5('0x23')]]){_0x5cfa47=_0x2c4053[_0x402281[_0x4ab5('0x23')]](_0x402281);logger[_0x4ab5('0x1d')](_0x4ab5('0x29'),JSON['stringify'](_0x5cfa47,null,0x2));if(_0x5cfa47&&_0x5cfa47[_0x4ab5('0x2a')]===AGI_CODE_SUCCESS&&_0x5cfa47[_0x4ab5('0x2b')]!==AGI_RESULT_ERROR&&!_0x16ed2e[_0x4ab5('0x2c')]){logger['debug'](_0x4ab5('0x29'),inspect(_0x5cfa47));return _[_0x4ab5('0x2d')](_0x5cfa47['result'])?null:_0x5cfa47[_0x4ab5('0x2b')]['toString']();}else{logger[_0x4ab5('0x2e')](_0x4ab5('0x29'),inspect(_0x5cfa47));return null;}}else{logger[_0x4ab5('0x2e')](_0x4ab5('0x2f'));return null;}}catch(_0x23b0a1){logger[_0x4ab5('0x2e')](_0x23b0a1[_0x4ab5('0xa')]);return null;}});if(_0xb9375[_0x4ab5('0x30')]){logger[_0x4ab5('0x1d')](util[_0x4ab5('0x1b')](_0x4ab5('0x31'),_0x16ed2e[_0x4ab5('0x32')],_0x16ed2e['calleridname'],_0x16ed2e[_0x4ab5('0x1f')],_0x16ed2e[_0x4ab5('0x20')],_0x16ed2e[_0x4ab5('0x33')]));_0x201e33['traverseBFS'](_0xb9375[_0x4ab5('0x30')]['id'],function(_0x2b6c4c){try{_0x2b6c4c=_0x2c4053[_0x4ab5('0x21')](_0x2b6c4c);logger[_0x4ab5('0x18')](_0x4ab5('0x22'),JSON[_0x4ab5('0x19')](_0x2b6c4c,null,0x2));if(_0x2b6c4c&&_0x2c4053[_0x2b6c4c['agicommand']]){_0x5cfa47=_0x2c4053[_0x2b6c4c[_0x4ab5('0x23')]](_0x2b6c4c);if(_0x5cfa47){logger[_0x4ab5('0x18')](_0x4ab5('0x29'),inspect(_0x5cfa47));return _[_0x4ab5('0x2d')](_0x5cfa47[_0x4ab5('0x2b')])?null:_0x5cfa47[_0x4ab5('0x2b')][_0x4ab5('0x34')]();}else{logger[_0x4ab5('0x2e')](_0x4ab5('0x29'),inspect(_0x5cfa47));return null;}}else{logger[_0x4ab5('0x2e')](_0x4ab5('0x2f'));return null;}}catch(_0x1b8a36){logger[_0x4ab5('0x2e')](_0x1b8a36[_0x4ab5('0xa')]);return null;}});}logger[_0x4ab5('0x1d')](util[_0x4ab5('0x1b')](_0x4ab5('0x35'),_0x16ed2e[_0x4ab5('0x32')],_0x16ed2e[_0x4ab5('0x1e')],_0x16ed2e[_0x4ab5('0x1f')],_0x16ed2e[_0x4ab5('0x20')],_0x16ed2e['uniqueid']));logger[_0x4ab5('0x1d')](util[_0x4ab5('0x1b')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x16ed2e[_0x4ab5('0x26')],_0x16ed2e[_0x4ab5('0x27')],parseInt(_0x16ed2e[_0x4ab5('0x28')],0xa)+0x1));_0x16ed2e[_0x4ab5('0x36')](_0x16ed2e[_0x4ab5('0x26')],_0x16ed2e[_0x4ab5('0x27')],parseInt(_0x16ed2e['priority'],0xa)+0x1);_0x16ed2e[_0x4ab5('0x37')]();}function handleNotFound(_0x359ee3){logger[_0x4ab5('0x2e')](util[_0x4ab5('0x1b')]('Project\x20%s\x20not\x20found',_0x359ee3['arg_1']));_0x359ee3['continueAt'](_0x359ee3[_0x4ab5('0x26')],_0x359ee3[_0x4ab5('0x27')],parseInt(_0x359ee3['priority'],0xa)+0x1);_0x359ee3['close']();}function handleUnpublished(_0x13b513){logger['error'](util[_0x4ab5('0x1b')](_0x4ab5('0x38'),_0x13b513[_0x4ab5('0x32')]));_0x13b513[_0x4ab5('0x36')](_0x13b513[_0x4ab5('0x26')],_0x13b513[_0x4ab5('0x27')],parseInt(_0x13b513[_0x4ab5('0x28')],0xa)+0x1);_0x13b513[_0x4ab5('0x37')]();}module[_0x4ab5('0x39')]={'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 9dd45bf..3398f17 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 _0x54af=['slice','trim','emit','headers','line','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split'];(function(_0x181bb6,_0x43fbc4){var _0x55888f=function(_0x129405){while(--_0x129405){_0x181bb6['push'](_0x181bb6['shift']());}};_0x55888f(++_0x43fbc4);}(_0x54af,0xb9));var _0xf54a=function(_0x12ceb7,_0x111bda){_0x12ceb7=_0x12ceb7-0x0;var _0x5e766e=_0x54af[_0x12ceb7];return _0x5e766e;};'use strict';var util=require('util');var Transform=require('stream')[_0xf54a('0x0')];function AGIReply(_0x2c63e4){Transform[_0xf54a('0x1')](this,_0x2c63e4);this[_0xf54a('0x2')]='';this[_0xf54a('0x3')]=![];}util[_0xf54a('0x4')](AGIReply,Transform);AGIReply[_0xf54a('0x5')][_0xf54a('0x6')]=function(_0x50e8ff,_0x4c4de6,_0x16ca4b){var _0x452730='\x0a',_0x1df090=['\x0a\x0a',_0xf54a('0x7')],_0x460868=-0x1,_0x3a1ba2=-0x1,_0x3e6255='',_0x32c78b=0x0,_0x5a1ae2='',_0x23adbf='';this[_0xf54a('0x2')]+=_0x50e8ff[_0xf54a('0x8')]();_0x5a1ae2=this[_0xf54a('0x2')];if(!this[_0xf54a('0x3')]){_0x32c78b=0x0;while(_0x1df090[_0x32c78b]){while((_0x3a1ba2=_0x5a1ae2[_0xf54a('0x9')](_0x1df090[_0x32c78b]))!=-0x1){_0x3e6255=_0x1df090[_0x32c78b];_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x3a1ba2);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x3a1ba2+_0x3e6255[_0xf54a('0xb')]);var _0x170173=_0x23adbf[_0xf54a('0xc')](_0x452730),_0xcf4e9f=0x0,_0x3cac45={},_0x1378f8='',_0x1d0469='',_0x56bbc9=-0x1;while(_0x170173[_0xcf4e9f]){_0x56bbc9=_0x170173[_0xcf4e9f]['indexOf'](':');if(_0x56bbc9!=-0x1){_0x1378f8=_0x170173[_0xcf4e9f][_0xf54a('0xd')](0x0,_0x56bbc9)[_0xf54a('0xe')]();_0x1d0469=_0x170173[_0xcf4e9f][_0xf54a('0xd')](_0x56bbc9+0x1)[_0xf54a('0xe')]();if(_0x1378f8[_0xf54a('0xb')]>0x0){_0x3cac45[_0x1378f8]=_0x1d0469;}}else{}_0xcf4e9f++;}this[_0xf54a('0xf')](_0xf54a('0x10'),_0x3cac45);this[_0xf54a('0x3')]=!![];}_0x32c78b++;}this[_0xf54a('0x2')]=_0x5a1ae2;}else{while((_0x460868=_0x5a1ae2[_0xf54a('0x9')](_0x452730))!=-0x1){_0x23adbf=_0x5a1ae2[_0xf54a('0xa')](0x0,_0x460868);this['emit'](_0xf54a('0x11'),_0x23adbf);_0x5a1ae2=_0x5a1ae2[_0xf54a('0xa')](_0x460868+_0x452730[_0xf54a('0xb')]);}this['_localBuffer']=_0x5a1ae2;}_0x16ca4b();};module['exports']=AGIReply; \ No newline at end of file +var _0xdadf=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split','indexOf','slice','headers','exports','util','stream','Transform','call','_localBuffer','_inBody'];(function(_0x1c518c,_0x383352){var _0x2650cb=function(_0x45fe77){while(--_0x45fe77){_0x1c518c['push'](_0x1c518c['shift']());}};_0x2650cb(++_0x383352);}(_0xdadf,0x1e7));var _0xfdad=function(_0x43a8c7,_0x32de81){_0x43a8c7=_0x43a8c7-0x0;var _0x160d2e=_0xdadf[_0x43a8c7];return _0x160d2e;};'use strict';var util=require(_0xfdad('0x0'));var Transform=require(_0xfdad('0x1'))[_0xfdad('0x2')];function AGIReply(_0x51a5b2){Transform[_0xfdad('0x3')](this,_0x51a5b2);this[_0xfdad('0x4')]='';this[_0xfdad('0x5')]=![];}util[_0xfdad('0x6')](AGIReply,Transform);AGIReply[_0xfdad('0x7')][_0xfdad('0x8')]=function(_0x85a51,_0x31ff3b,_0xca49f0){var _0x4998ad='\x0a',_0x3b48ba=['\x0a\x0a',_0xfdad('0x9')],_0x155de2=-0x1,_0x12b6fd=-0x1,_0x48befc='',_0x2dabf3=0x0,_0x1f1fd3='',_0xa252ec='';this[_0xfdad('0x4')]+=_0x85a51['toString']();_0x1f1fd3=this['_localBuffer'];if(!this[_0xfdad('0x5')]){_0x2dabf3=0x0;while(_0x3b48ba[_0x2dabf3]){while((_0x12b6fd=_0x1f1fd3['indexOf'](_0x3b48ba[_0x2dabf3]))!=-0x1){_0x48befc=_0x3b48ba[_0x2dabf3];_0xa252ec=_0x1f1fd3['substring'](0x0,_0x12b6fd);_0x1f1fd3=_0x1f1fd3[_0xfdad('0xa')](_0x12b6fd+_0x48befc[_0xfdad('0xb')]);var _0x1e9f90=_0xa252ec[_0xfdad('0xc')](_0x4998ad),_0x22223d=0x0,_0x5224c3={},_0x3add88='',_0x43cb7a='',_0x40959d=-0x1;while(_0x1e9f90[_0x22223d]){_0x40959d=_0x1e9f90[_0x22223d][_0xfdad('0xd')](':');if(_0x40959d!=-0x1){_0x3add88=_0x1e9f90[_0x22223d][_0xfdad('0xe')](0x0,_0x40959d)['trim']();_0x43cb7a=_0x1e9f90[_0x22223d][_0xfdad('0xe')](_0x40959d+0x1)['trim']();if(_0x3add88['length']>0x0){_0x5224c3[_0x3add88]=_0x43cb7a;}}else{}_0x22223d++;}this['emit'](_0xfdad('0xf'),_0x5224c3);this[_0xfdad('0x5')]=!![];}_0x2dabf3++;}this[_0xfdad('0x4')]=_0x1f1fd3;}else{while((_0x155de2=_0x1f1fd3[_0xfdad('0xd')](_0x4998ad))!=-0x1){_0xa252ec=_0x1f1fd3['substring'](0x0,_0x155de2);this['emit']('line',_0xa252ec);_0x1f1fd3=_0x1f1fd3[_0xfdad('0xa')](_0x155de2+_0x4998ad[_0xfdad('0xb')]);}this[_0xfdad('0x4')]=_0x1f1fd3;}_0xca49f0();};module[_0xfdad('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 487c40c..0701fa2 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 _0xbc17=['GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xbc17,0x1ab));var _0x7bc1=function(_0xc23380,_0x18e158){_0xc23380=_0xc23380-0x0;var _0x4b1b26=_0xbc17[_0xc23380];return _0x4b1b26;};'use strict';var _=require(_0x7bc1('0x0'));var moment=require(_0x7bc1('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x7bc1('0x2')][_0x7bc1('0x3')]({'port':0x2329});function request(_0x5185e7,_0x4b1479){return new Promise(function(_0x3ff36d,_0x7aa41e){return client['request'](_0x5185e7,_0x4b1479)[_0x7bc1('0x4')](function(_0x5e7c2c){if(_0x5e7c2c[_0x7bc1('0x5')]){return _0x7aa41e(_0x5e7c2c[_0x7bc1('0x5')][_0x7bc1('0x6')]);}else{return _0x3ff36d(_0x5e7c2c[_0x7bc1('0x7')]);}})[_0x7bc1('0x8')](function(_0x351340){return _0x7aa41e(_0x351340);});});}exports[_0x7bc1('0x9')]=function(){return request(_0x7bc1('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x7bc1('0xb')]=function(_0xe37457){return request(_0x7bc1('0xc'),{'options':{'raw':![],'where':{'name':_0xe37457},'attributes':['production']}});};exports[_0x7bc1('0xd')]=function(_0x6e924){return request(_0x7bc1('0xe'),{'options':{'raw':![],'where':{'id':_0x6e924},'include':[{'model':_0x7bc1('0xf'),'as':_0x7bc1('0x10'),'include':[{'model':_0x7bc1('0x11'),'as':_0x7bc1('0x11')}]}],'attributes':['id',_0x7bc1('0x12'),_0x7bc1('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1297a6){return request(_0x7bc1('0xc'),{'options':{'where':{'id':_0x1297a6},'attributes':['name']}});};exports[_0x7bc1('0x14')]=function(_0x370c8b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x370c8b},'attributes':[_0x7bc1('0x12')]}});};exports[_0x7bc1('0x15')]=function(_0x48d35a){return request(_0x7bc1('0x16'),{'options':{'where':{'id':_0x48d35a},'attributes':[_0x7bc1('0x12')]}});};exports[_0x7bc1('0x17')]=function(_0x3aadaf){return request(_0x7bc1('0x18'),{'options':{'where':{'id':_0x3aadaf},'attributes':['dsn']}});};exports[_0x7bc1('0x19')]=function(_0x47ab39){return request(_0x7bc1('0x1a'),{'options':{'where':{'id':_0x47ab39},'attributes':[_0x7bc1('0x12')]}});};exports[_0x7bc1('0x1b')]=function(_0x22e6fd){return request(_0x7bc1('0x1c'),{'options':{'where':{'phone':_0x22e6fd[_0x7bc1('0x1d')]},'attributes':['id']}});};exports[_0x7bc1('0x1e')]=function(_0x135025){return request('ShowTrunk',{'options':{'where':{'id':_0x135025},'attributes':[_0x7bc1('0x12')]}});};exports[_0x7bc1('0x1f')]=function(_0xd76572){return request(_0x7bc1('0x20'),{'options':{'where':{'id':_0xd76572},'attributes':[_0x7bc1('0x21')]}});};exports['getIntervalById']=function(_0x29276f){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x29276f},'include':[{'model':_0x7bc1('0x22'),'as':_0x7bc1('0x23')}]}});};exports[_0x7bc1('0x24')]=function(_0x162efe){return request(_0x7bc1('0x25'),{'options':{'where':{'id':_0x162efe},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0xb8a427){return request(_0x7bc1('0x26'),{'body':_0xb8a427});};exports['createSquareDetailsReport']=function(_0x4ef200){return request(_0x7bc1('0x27'),{'body':_0x4ef200});};exports[_0x7bc1('0x28')]=function(_0x570f76){return request(_0x7bc1('0x29'),{'body':_[_0x7bc1('0x2a')](_0x570f76,{'project_name':_0x570f76[_0x7bc1('0x2b')],'prev_project_name':_0x570f76[_0x7bc1('0x2c')]||'','is_subproject':_0x570f76[_0x7bc1('0x2c')]?!![]:![],'leaveAt':moment()[_0x7bc1('0x2d')](_0x7bc1('0x2e'))})});};exports[_0x7bc1('0x2f')]=function(_0x19802e){return request(_0x7bc1('0x30'),{'body':_0x19802e});};exports[_0x7bc1('0x31')]=function(_0x40c6cb){return request(_0x7bc1('0x32'),{'body':_0x40c6cb});};exports[_0x7bc1('0x33')]=function(_0x58d79c){return request(_0x7bc1('0x34'),{'options':{'raw':![],'where':{'phone':_0x58d79c[_0x7bc1('0x1d')],'ListId':_0x58d79c[_0x7bc1('0x35')]}}})[_0x7bc1('0x4')](function(_0x6614c){if(_0x6614c){return _0x6614c;}return request(_0x7bc1('0x36'),{'body':_0x58d79c});});};exports[_0x7bc1('0x37')]=function(_0x3c247b){return request(_0x7bc1('0x38'),{'options':{'where':{'id':_0x3c247b},'attributes':[_0x7bc1('0x12')]}});};exports[_0x7bc1('0x39')]=function(_0x89d7cb,_0x4a86a2){return request(_0x7bc1('0x3a'),{'body':{'interface':_0x4a86a2},'options':{'where':_0x89d7cb}});};exports[_0x7bc1('0x3b')]=function(_0x96758e,_0x2c2196,_0x212733){return request(_0x7bc1('0x3c'),{'body':{'type':_0x2c2196,'uniqueid':_0x212733},'options':{'where':_0x96758e}});};exports[_0x7bc1('0x3d')]=function(_0x5e3d03){return request(_0x7bc1('0x3e'),{'body':{},'options':{'where':_0x5e3d03}});};exports[_0x7bc1('0x3f')]=function(_0x171b7b){return request(_0x7bc1('0x40'),{'body':{},'options':{'where':_0x171b7b}});}; \ No newline at end of file +var _0x95f4=['agentLogout','lodash','moment','jayson/promise','request','then','error','message','result','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x95f4,0xf1));var _0x495f=function(_0x207e07,_0x1744a7){_0x207e07=_0x207e07-0x0;var _0x9826cd=_0x95f4[_0x207e07];return _0x9826cd;};'use strict';var _=require(_0x495f('0x0'));var moment=require(_0x495f('0x1'));var jayson=require(_0x495f('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x13cd43,_0x3dbbc5){return new Promise(function(_0x5edb36,_0x501377){return client[_0x495f('0x3')](_0x13cd43,_0x3dbbc5)[_0x495f('0x4')](function(_0x1bc28e){if(_0x1bc28e['error']){return _0x501377(_0x1bc28e[_0x495f('0x5')][_0x495f('0x6')]);}else{return _0x5edb36(_0x1bc28e[_0x495f('0x7')]);}})['catch'](function(_0x2103a4){return _0x501377(_0x2103a4);});});}exports[_0x495f('0x8')]=function(){return request(_0x495f('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x495f('0xa')]=function(_0x48c225){return request(_0x495f('0xb'),{'options':{'raw':![],'where':{'name':_0x48c225},'attributes':['production']}});};exports[_0x495f('0xc')]=function(_0x41aa07){return request(_0x495f('0xd'),{'options':{'raw':![],'where':{'id':_0x41aa07},'include':[{'model':_0x495f('0xe'),'as':'Smtp','include':[{'model':_0x495f('0xf'),'as':_0x495f('0xf')}]}],'attributes':['id',_0x495f('0x10'),_0x495f('0x11')],'smtp':!![]}});};exports[_0x495f('0x12')]=function(_0x4d71bb){return request(_0x495f('0xb'),{'options':{'where':{'id':_0x4d71bb},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x13')]=function(_0x3ce068){return request(_0x495f('0x14'),{'options':{'where':{'id':_0x3ce068},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x15')]=function(_0x5ad821){return request(_0x495f('0x16'),{'options':{'where':{'id':_0x5ad821},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x17')]=function(_0x135ebd){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x135ebd},'attributes':[_0x495f('0x18')]}});};exports[_0x495f('0x19')]=function(_0x4a0f0f){return request(_0x495f('0x1a'),{'options':{'where':{'id':_0x4a0f0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x1b')]=function(_0x58bcc9){return request(_0x495f('0x1c'),{'options':{'where':{'phone':_0x58bcc9[_0x495f('0x1d')]},'attributes':['id']}});};exports[_0x495f('0x1e')]=function(_0x427c0f){return request('ShowTrunk',{'options':{'where':{'id':_0x427c0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x1f')]=function(_0x5f2530){return request(_0x495f('0x20'),{'options':{'where':{'id':_0x5f2530},'attributes':['save_name']}});};exports[_0x495f('0x21')]=function(_0x3883be){return request(_0x495f('0x22'),{'options':{'raw':![],'where':{'id':_0x3883be},'include':[{'model':_0x495f('0x23'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x75d4de){return request('ShowSmsAccount',{'options':{'where':{'id':_0x75d4de},'attributes':['id',_0x495f('0x10')]}});};exports[_0x495f('0x24')]=function(_0x59ffb2){return request(_0x495f('0x25'),{'body':_0x59ffb2});};exports[_0x495f('0x26')]=function(_0x1fd91e){return request(_0x495f('0x27'),{'body':_0x1fd91e});};exports[_0x495f('0x28')]=function(_0xdd67c4){return request('CreateSquareReport',{'body':_['merge'](_0xdd67c4,{'project_name':_0xdd67c4[_0x495f('0x29')],'prev_project_name':_0xdd67c4[_0x495f('0x2a')]||'','is_subproject':_0xdd67c4[_0x495f('0x2a')]?!![]:![],'leaveAt':moment()[_0x495f('0x2b')](_0x495f('0x2c'))})});};exports[_0x495f('0x2d')]=function(_0x5bb254){return request(_0x495f('0x2e'),{'body':_0x5bb254});};exports[_0x495f('0x2f')]=function(_0x5ee2f7){return request(_0x495f('0x30'),{'body':_0x5ee2f7});};exports[_0x495f('0x31')]=function(_0x34322c){return request(_0x495f('0x32'),{'options':{'raw':![],'where':{'phone':_0x34322c['phone'],'ListId':_0x34322c[_0x495f('0x33')]}}})[_0x495f('0x4')](function(_0x28a1fb){if(_0x28a1fb){return _0x28a1fb;}return request(_0x495f('0x34'),{'body':_0x34322c});});};exports[_0x495f('0x35')]=function(_0x3b8f0f){return request(_0x495f('0x36'),{'options':{'where':{'id':_0x3b8f0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x37')]=function(_0x1933cf,_0x1e88ea){return request('LoginUser',{'body':{'interface':_0x1e88ea},'options':{'where':_0x1933cf}});};exports[_0x495f('0x38')]=function(_0x3f67ce,_0x2be0ab,_0x2e9e8c){return request(_0x495f('0x39'),{'body':{'type':_0x2be0ab,'uniqueid':_0x2e9e8c},'options':{'where':_0x3f67ce}});};exports['agentUnpause']=function(_0x2ce9ba){return request(_0x495f('0x3a'),{'body':{},'options':{'where':_0x2ce9ba}});};exports[_0x495f('0x3b')]=function(_0x3593b1){return request('LogoutUser',{'body':{},'options':{'where':_0x3593b1}});}; \ 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 c77f8a9..2f27382 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 _0x870d=['./lex','exports'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x870d,0xde));var _0xd870=function(_0x3ebc5a,_0x3ed979){_0x3ebc5a=_0x3ebc5a-0x0;var _0x44cd59=_0x870d[_0x3ebc5a];return _0x44cd59;};var polly=require('./polly');var lex=require(_0xd870('0x0'));module[_0xd870('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x87d8=['exports','./lex'];(function(_0x59713f,_0x52a440){var _0x5b1b1c=function(_0x2db11f){while(--_0x2db11f){_0x59713f['push'](_0x59713f['shift']());}};_0x5b1b1c(++_0x52a440);}(_0x87d8,0x1a9));var _0x887d=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0x87d8[_0x4c8232];return _0x3cc8e5;};var polly=require('./polly');var lex=require(_0x887d('0x0'));module[_0x887d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 19f90e4..221c05e 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 _0xe605=['./lib/api','exports'];(function(_0x545777,_0x4e3c3d){var _0x59b771=function(_0x25f98e){while(--_0x25f98e){_0x545777['push'](_0x545777['shift']());}};_0x59b771(++_0x4e3c3d);}(_0xe605,0x92));var _0x5e60=function(_0x2fde27,_0xeebffc){_0x2fde27=_0x2fde27-0x0;var _0x987bc=_0xe605[_0x2fde27];return _0x987bc;};'use strict';var lex=require(_0x5e60('0x0'));module[_0x5e60('0x1')]=function(_0x5deab2,_0x36add0,_0x455efd,_0x342132,_0x1133f0,_0x4007b3){return lex(_0x5deab2,_0x36add0,_0x455efd,_0x342132,_0x1133f0,_0x4007b3);}; \ No newline at end of file +var _0xf4eb=['./lib/api'];(function(_0x229a03,_0x36fefc){var _0x2d6e11=function(_0x592d00){while(--_0x592d00){_0x229a03['push'](_0x229a03['shift']());}};_0x2d6e11(++_0x36fefc);}(_0xf4eb,0xec));var _0xbf4e=function(_0x22f31f,_0x2aeea1){_0x22f31f=_0x22f31f-0x0;var _0x5af49c=_0xf4eb[_0x22f31f];return _0x5af49c;};'use strict';var lex=require(_0xbf4e('0x0'));module['exports']=function(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7){return lex(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7);}; \ 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 0686326..c28bde4 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(_0x2329ff,_0x22100b){var _0x173559=function(_0x46c2bc){while(--_0x46c2bc){_0x2329ff['push'](_0x2329ff['shift']());}};_0x173559(++_0x22100b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x4b8ec3,_0x3c76ff){var _0x13728f=function(_0x2b0737){while(--_0x2b0737){_0x4b8ec3['push'](_0x4b8ec3['shift']());}};_0x13728f(++_0x3c76ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 3cc5c48..574a45c 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 _0x0790=['./lib/api','exports'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x0790,0x7e));var _0x0079=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x0790[_0x1abb09];return _0xea1c07;};'use strict';var polly=require(_0x0079('0x0'));module[_0x0079('0x1')]=function(_0x4db090,_0x4776a6,_0x3f3880,_0x32dbd3,_0x1f5768,_0x3794fa,_0x3e6105){return polly(_0x4db090,_0x4776a6,_0x3f3880,_0x32dbd3,_0x1f5768,_0x3794fa,_0x3e6105);}; \ No newline at end of file +var _0x6da2=['./lib/api','exports'];(function(_0x9a5e2b,_0x1309ff){var _0x11d45b=function(_0x23de30){while(--_0x23de30){_0x9a5e2b['push'](_0x9a5e2b['shift']());}};_0x11d45b(++_0x1309ff);}(_0x6da2,0x186));var _0x26da=function(_0x1cd037,_0x4d368f){_0x1cd037=_0x1cd037-0x0;var _0x51f3b8=_0x6da2[_0x1cd037];return _0x51f3b8;};'use strict';var polly=require(_0x26da('0x0'));module[_0x26da('0x1')]=function(_0xaa66e7,_0x54fa8d,_0x2c861c,_0x51528e,_0x1619d3,_0x29ea6d,_0x5b2317){return polly(_0xaa66e7,_0x54fa8d,_0x2c861c,_0x51528e,_0x1619d3,_0x29ea6d,_0x5b2317);}; \ 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 165c827..9a99f8b 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 _0x6bc6=['text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x233caf,_0xd93cdf){var _0x3db3cf=function(_0x300bf7){while(--_0x300bf7){_0x233caf['push'](_0x233caf['shift']());}};_0x3db3cf(++_0xd93cdf);}(_0x6bc6,0x1e2));var _0x66bc=function(_0x12a020,_0x85b476){_0x12a020=_0x12a020-0x0;var _0x63cddd=_0x6bc6[_0x12a020];return _0x63cddd;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x66bc('0x0'));var rs=require(_0x66bc('0x1'));var AWS=require(_0x66bc('0x2'));function pollyResult(_0xc9673,_0x11c1c4,_0x341ab0){return new BPromise(function(_0xd6f081,_0x429568){_0xc9673[_0x66bc('0x3')](_0x11c1c4,function(_0x2e80e7,_0x10cc41){if(_0x2e80e7){_0x429568(_0x2e80e7);}else if(_0x10cc41){if(_0x10cc41[_0x66bc('0x4')]instanceof Buffer){fs[_0x66bc('0x5')](_0x341ab0,_0x10cc41[_0x66bc('0x4')],function(_0x475df3){if(_0x475df3){_0x429568(_0x475df3);}else{_0xd6f081();}});}else{_0x429568(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x429568(new Error(_0x66bc('0x6')));}});});}module[_0x66bc('0x7')]=function(_0x17ce40,_0x176ea2,_0x3a2b77,_0xa3543,_0x8d4698,_0x5ba170,_0x5d72c3){var _0x5a84fd=new AWS['Polly']({'accessKeyId':_0x17ce40,'secretAccessKey':_0x176ea2,'region':_0x3a2b77});var _0x14dda6={'Text':_0x8d4698,'TextType':_0x5ba170||_0x66bc('0x8'),'OutputFormat':_0x66bc('0x9'),'VoiceId':_0xa3543};return pollyResult(_0x5a84fd,_0x14dda6,_0x5d72c3);}; \ No newline at end of file +var _0x0cad=['text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x58715b,_0x181f05){var _0x5af34f=function(_0x3a0df7){while(--_0x3a0df7){_0x58715b['push'](_0x58715b['shift']());}};_0x5af34f(++_0x181f05);}(_0x0cad,0x14e));var _0xd0ca=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0x0cad[_0x17e0ff];return _0x357979;};'use strict';var fs=require('fs');var path=require(_0xd0ca('0x0'));var BPromise=require(_0xd0ca('0x1'));var rs=require(_0xd0ca('0x2'));var AWS=require(_0xd0ca('0x3'));function pollyResult(_0x4e4fff,_0x3b1651,_0x14e265){return new BPromise(function(_0x363008,_0x13651b){_0x4e4fff[_0xd0ca('0x4')](_0x3b1651,function(_0x2fcfca,_0x183904){if(_0x2fcfca){_0x13651b(_0x2fcfca);}else if(_0x183904){if(_0x183904[_0xd0ca('0x5')]instanceof Buffer){fs[_0xd0ca('0x6')](_0x14e265,_0x183904[_0xd0ca('0x5')],function(_0x4f1f77){if(_0x4f1f77){_0x13651b(_0x4f1f77);}else{_0x363008();}});}else{_0x13651b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x13651b(new Error(_0xd0ca('0x7')));}});});}module['exports']=function(_0x15c4e4,_0x32f69b,_0x2551ee,_0xad00e8,_0x2cf8d8,_0x14a843,_0x48330e){var _0x4e544f=new AWS['Polly']({'accessKeyId':_0x15c4e4,'secretAccessKey':_0x32f69b,'region':_0x2551ee});var _0x428f91={'Text':_0x2cf8d8,'TextType':_0x14a843||_0xd0ca('0x8'),'OutputFormat':'mp3','VoiceId':_0xad00e8};return pollyResult(_0x4e544f,_0x428f91,_0x48330e);}; \ 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 58116ea..8d48f77 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 _0x41fa=['exports','./lib/api'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x41fa,0x69));var _0xa41f=function(_0x284240,_0x555b56){_0x284240=_0x284240-0x0;var _0x390667=_0x41fa[_0x284240];return _0x390667;};'use strict';var asr=require(_0xa41f('0x0'));module[_0xa41f('0x1')]=function(_0x1149f4,_0x59fb0b,_0x4a3153,_0x48fa96){return asr(_0x1149f4,_0x59fb0b,_0x4a3153);}; \ No newline at end of file +var _0xf92f=['exports','./lib/api'];(function(_0x3422bf,_0x21b1da){var _0x4de668=function(_0x271cce){while(--_0x271cce){_0x3422bf['push'](_0x3422bf['shift']());}};_0x4de668(++_0x21b1da);}(_0xf92f,0x14b));var _0xff92=function(_0x9a448a,_0x20d242){_0x9a448a=_0x9a448a-0x0;var _0x1cb465=_0xf92f[_0x9a448a];return _0x1cb465;};'use strict';var asr=require(_0xff92('0x0'));module[_0xff92('0x1')]=function(_0x9e20b1,_0x277ff9,_0x35a9f4,_0x3d3f8d){return asr(_0x9e20b1,_0x277ff9,_0x35a9f4);}; \ 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 c9727a9..c51290f 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 _0xf257=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','LINEAR16','https://speech.googleapis.com','exports'];(function(_0x2b0bf7,_0x360353){var _0x39630a=function(_0x1175db){while(--_0x1175db){_0x2b0bf7['push'](_0x2b0bf7['shift']());}};_0x39630a(++_0x360353);}(_0xf257,0x82));var _0x7f25=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0xf257[_0x484cac];return _0x1d6e77;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x7f25('0x0');module[_0x7f25('0x1')]=function(_0x3f7a94,_0x22d4a9,_0x5c712c){return new BPromise(function(_0x159dd1,_0x2aca61){var _0xd94d7a;if(typeof _0x3f7a94!==_0x7f25('0x2')||_0x3f7a94[_0x7f25('0x3')]===0x0){return _0x2aca61(_0x7f25('0x4'));}if(typeof _0x22d4a9!==_0x7f25('0x2')||_0x22d4a9[_0x7f25('0x3')]===0x0){return _0x2aca61(_0x7f25('0x5'));}if(typeof _0x5c712c!==_0x7f25('0x6')&&(typeof _0x5c712c!==_0x7f25('0x2')||_0x5c712c[_0x7f25('0x3')]===0x0)){return _0x2aca61(_0x7f25('0x7'));}try{_0xd94d7a=fs[_0x7f25('0x8')](_0x3f7a94)['toString'](_0x7f25('0x9'));}catch(_0x362a80){return _0x2aca61(_0x362a80);}return _0x159dd1({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x22d4a9,'body':{'config':{'encoding':_0x7f25('0xa'),'sampleRateHertz':'8000','languageCode':_0x5c712c},'audio':{'content':_0xd94d7a}},'json':!![]});});}; \ No newline at end of file +var _0xaf80=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','LINEAR16'];(function(_0x2948c5,_0x14192b){var _0x4310f8=function(_0x13fd28){while(--_0x13fd28){_0x2948c5['push'](_0x2948c5['shift']());}};_0x4310f8(++_0x14192b);}(_0xaf80,0x1ef));var _0x0af8=function(_0x221aa6,_0x426192){_0x221aa6=_0x221aa6-0x0;var _0x319607=_0xaf80[_0x221aa6];return _0x319607;};'use strict';var url=require(_0x0af8('0x0'));var BPromise=require(_0x0af8('0x1'));var fs=require('fs');var host=_0x0af8('0x2');module[_0x0af8('0x3')]=function(_0x571e95,_0x5bfb4e,_0x5bcd97){return new BPromise(function(_0x431bc8,_0x3fba3b){var _0x182d3c;if(typeof _0x571e95!==_0x0af8('0x4')||_0x571e95[_0x0af8('0x5')]===0x0){return _0x3fba3b(_0x0af8('0x6'));}if(typeof _0x5bfb4e!=='string'||_0x5bfb4e['length']===0x0){return _0x3fba3b(_0x0af8('0x7'));}if(typeof _0x5bcd97!=='undefined'&&(typeof _0x5bcd97!==_0x0af8('0x4')||_0x5bcd97[_0x0af8('0x5')]===0x0)){return _0x3fba3b(_0x0af8('0x8'));}try{_0x182d3c=fs['readFileSync'](_0x571e95)[_0x0af8('0x9')](_0x0af8('0xa'));}catch(_0x2f4267){return _0x3fba3b(_0x2f4267);}return _0x431bc8({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x5bfb4e,'body':{'config':{'encoding':_0x0af8('0xb'),'sampleRateHertz':_0x0af8('0xc'),'languageCode':_0x5bcd97},'audio':{'content':_0x182d3c}},'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 aaa47fd..e8249f6 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 _0x9849=['./asr'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0x9849,0xfb));var _0x9984=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9849[_0xf0bcac];return _0x4e4c65;};var asr=require(_0x9984('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0b2a=['./asr'];(function(_0x3c7e68,_0x76614){var _0x1b3717=function(_0x2773f8){while(--_0x2773f8){_0x3c7e68['push'](_0x3c7e68['shift']());}};_0x1b3717(++_0x76614);}(_0x0b2a,0x19f));var _0xa0b2=function(_0x242152,_0x59a91c){_0x242152=_0x242152-0x0;var _0x292ba6=_0x0b2a[_0x242152];return _0x292ba6;};var asr=require(_0xa0b2('0x0'));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 1d96672..bc436ef 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 _0xd945=['audioContent','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','AudioFromTts','Data','audiofile','bluebird','http','https','md5','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','pipe','end','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','info','finish\x20to\x20convert','start','resolve','generate','.wav','base64','777','split','readFileSync','googleCloudTTS','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','then','tmp','.mp3','from'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xd945,0xc6));var _0x5d94=function(_0x26ef19,_0x1a3994){_0x26ef19=_0x26ef19-0x0;var _0xcb6c22=_0xd945[_0x26ef19];return _0xcb6c22;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x5d94('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x5d94('0x1'));var https=require(_0x5d94('0x2'));var md5=require(_0x5d94('0x3'));var path=require('path');var querystring=require('querystring');var rp=require(_0x5d94('0x4'));var rs=require(_0x5d94('0x5'));var sox=require(_0x5d94('0x6'));var tts=require(_0x5d94('0x7'));var urlParse=require(_0x5d94('0x8'))[_0x5d94('0x9')];var util=require(_0x5d94('0xa'));var aws=require(_0x5d94('0xb'));var google=require('./google');var sestek=require(_0x5d94('0xc'));var tilde=require(_0x5d94('0xd'));var logger=require(_0x5d94('0xe'))(_0x5d94('0xf'));var ISPEECH_API=_0x5d94('0x10');function downloadFile(_0x9bdb1f,_0x3770c9){return new BPromise(function(_0x4424bc,_0x103118){var _0x2d627a=urlParse(_0x9bdb1f);var _0x35fa96=_0x2d627a[_0x5d94('0x11')]===_0x5d94('0x12')?https:http;var _0x3b4495={'host':_0x2d627a[_0x5d94('0x13')],'path':_0x2d627a[_0x5d94('0x14')],'headers':{'user-agent':_0x5d94('0x15')}};_0x35fa96[_0x5d94('0x16')](_0x3b4495,function(_0x40738a){if(_0x40738a[_0x5d94('0x17')]!==0xc8){logger[_0x5d94('0x18')]('request\x20to\x20'+_0x9bdb1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x40738a[_0x5d94('0x17')]+'\x20('+_0x40738a['statusMessage']+')');_0x103118(new Error(_0x5d94('0x19')+_0x9bdb1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x40738a['statusCode']+'\x20('+_0x40738a[_0x5d94('0x1a')]+')'));return;}var _0x44b484=fs[_0x5d94('0x1b')](_0x3770c9);_0x44b484['on'](_0x5d94('0x1c'),function(){logger['info'](_0x5d94('0x1d'));_0x44b484[_0x5d94('0x1e')](_0x4424bc);});_0x44b484['on']('error',function(_0x5de790){fs[_0x5d94('0x1f')](_0x3770c9);logger[_0x5d94('0x18')]('download\x20error',_0x5de790);_0x103118(_0x5de790);});_0x40738a[_0x5d94('0x20')](_0x44b484);})['on']('error',function(_0x41cadf){logger[_0x5d94('0x18')](_0x41cadf);_0x103118(_0x41cadf);})[_0x5d94('0x21')]();});}function uploadFile(_0x135447){return new BPromise(function(_0xe7095d,_0x54df7e){var _0x4aa24e=urlParse(_0x135447);var _0x5d1d7c=_0x4aa24e[_0x5d94('0x11')]===_0x5d94('0x12')?https:http;var _0x5de8be={'host':_0x4aa24e['host'],'path':_0x4aa24e[_0x5d94('0x14')],'headers':{'user-agent':_0x5d94('0x15')}};_0x5d1d7c[_0x5d94('0x16')](_0x5de8be,function(_0x2b659e){if(_0x2b659e[_0x5d94('0x17')]!==0xc8){_0x54df7e(new Error(_0x5d94('0x19')+_0x135447+_0x5d94('0x22')+_0x2b659e[_0x5d94('0x17')]+'\x20('+_0x2b659e['statusMessage']+')'));return;}var _0x1a4dbf='';_0x2b659e['on'](_0x5d94('0x23'),function(_0x2476ce){_0x1a4dbf+=_0x2476ce;});_0x2b659e['on'](_0x5d94('0x21'),function(){_0xe7095d(_0x1a4dbf);});})['on'](_0x5d94('0x18'),function(_0x1385b8){_0x54df7e(_0x1385b8);})['end']();});}function convertFile(_0x328c26,_0xb17cb6){return new BPromise(function(_0x29e16a,_0x381c9e){var _0x90ed20=sox[_0x5d94('0x24')](_0x328c26,_0xb17cb6,{'sampleRate':0x1f40,'format':_0x5d94('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x90ed20['on']('error',function(_0x317ead){logger[_0x5d94('0x18')]('error\x20convert',_0x317ead);_0x381c9e(_0x317ead);});_0x90ed20['on'](_0x5d94('0x21'),function(){logger[_0x5d94('0x26')](_0x5d94('0x27'));_0x29e16a();});_0x90ed20[_0x5d94('0x28')]();});}function base64Decode(_0x424ec2,_0x210733){var _0x3a91e3=path[_0x5d94('0x29')](__dirname,'tmp',rs[_0x5d94('0x2a')](0x4)+_0x5d94('0x2b'));fs['writeFileSync'](_0x3a91e3,_0x424ec2,_0x5d94('0x2c'));return convertFile(_0x3a91e3,_0x210733)['then'](function(){try{fs['unlink'](_0x3a91e3);fs['chmodSync'](_0x210733,_0x5d94('0x2d'));}catch(_0x4759ad){logger['error'](_0x4759ad);}return _0x210733[_0x5d94('0x2e')]('.')[0x0];});}function base64Encode(_0x2f2c36){var _0x25fcbb=fs[_0x5d94('0x2f')](_0x2f2c36);return new Buffer(_0x25fcbb)['toString'](_0x5d94('0x2c'));}exports[_0x5d94('0x30')]=function(_0x5afbd3,_0x1dfa82,_0x1a8d5e,_0x12b1ee,_0x53921b,_0x229824){var _0x50f0f6,_0x20c373;var _0x2d652d='https://texttospeech.googleapis.com/v1/';var _0x21dd1f=_0x5d94('0x31')+_0x5afbd3;var _0x5940ab={};if(_0x1dfa82===_0x5d94('0x32')){_0x5940ab['input']={'ssml':_0x1a8d5e};}else{_0x5940ab[_0x5d94('0x33')]={'text':_0x1a8d5e};};_0x5940ab[_0x5d94('0x34')]={'languageCode':_0x12b1ee,'ssmlGender':_0x53921b};_0x5940ab[_0x5d94('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x286704={'url':_0x2d652d+_0x5d94('0x36')+_0x21dd1f,'method':_0x5d94('0x37'),'json':!![],'body':_0x5940ab};return rp(_0x286704)[_0x5d94('0x38')](function(_0x55fa4a){return new BPromise(function(_0xd748cf,_0x21054c){_0x50f0f6=path['resolve'](__dirname,_0x5d94('0x39'),rs[_0x5d94('0x2a')](0x4)+_0x5d94('0x3a'));var _0x1f9749=Buffer[_0x5d94('0x3b')](_0x55fa4a[_0x5d94('0x3c')],_0x5d94('0x2c'));return fs['writeFile'](_0x50f0f6,_0x1f9749,function(_0x89131f){_0x21054c(_0x89131f);},function(_0x21fe21){fs[_0x5d94('0x3d')](_0x50f0f6,_0x5d94('0x2d'));_0xd748cf(_0x21fe21);});});})['then'](function(_0x269d0f){_0x20c373=path[_0x5d94('0x29')](__dirname,'tmp',rs[_0x5d94('0x2a')](0x4)+_0x5d94('0x2b'));return convertFile(_0x50f0f6,_0x20c373);})[_0x5d94('0x38')](function(){try{fs[_0x5d94('0x1f')](_0x50f0f6);fs[_0x5d94('0x3d')](_0x20c373,_0x5d94('0x2d'));}catch(_0x5b84e1){logger[_0x5d94('0x18')](_0x5b84e1);}logger[_0x5d94('0x26')]('googleCloudTTS\x20path',_0x20c373[_0x5d94('0x2e')]('.')[0x0]);return _0x20c373[_0x5d94('0x2e')]('.')[0x0];});};exports[_0x5d94('0x3e')]=function(_0x2bda7e,_0x437155){var _0x5aa852=_0x5d94('0x3f');var _0x37bf41,_0x4539f4;var _0x5547c7;var _0x207504={'encoding':_0x5d94('0x40'),'method':_0x5d94('0x37'),'timeout':0x2710,'url':_0x5aa852,'headers':{'Content-Type':_0x5d94('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x5d94('0x42')]([[['jQ1olc',JSON['stringify']([_0x2bda7e,_0x437155||'en',![],_0x5d94('0x43')]),null,'generic']]]))};return rp(_0x207504)[_0x5d94('0x38')](function(_0x31eb19){try{_0x5547c7=eval(_0x31eb19['slice'](0x5))[0x0][0x2];}catch(_0xd46c16){throw new Error(_0x5d94('0x44')+_0x31eb19['data']);}if(!_0x5547c7){if(_0x2bda7e[_0x5d94('0x45')]>0xc8){throw new Error(_0x5d94('0x46'));}else{throw new Error(_0x5d94('0x47')+_0x437155+'\x22\x20might\x20not\x20exist');}}try{_0x5547c7=eval(_0x5547c7)[0x0];}catch(_0x4f02ea){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x5d94('0x23')]);}const _0xf23cf2=_0x5547c7;_0x37bf41=path['resolve'](__dirname,_0x5d94('0x39'),rs[_0x5d94('0x2a')](0x4)+_0x5d94('0x3a'));fs['writeFileSync'](_0x37bf41,_0x5547c7,{'encoding':_0x5d94('0x2c')});_0x4539f4=path[_0x5d94('0x29')](__dirname,_0x5d94('0x39'),rs['generate'](0x4)+_0x5d94('0x2b'));return convertFile(_0x37bf41,_0x4539f4);})['then'](function(){try{fs[_0x5d94('0x1f')](_0x37bf41);fs[_0x5d94('0x3d')](_0x4539f4,_0x5d94('0x2d'));}catch(_0x4d5db5){logger['error'](_0x4d5db5);}logger[_0x5d94('0x26')](_0x5d94('0x48'),_0x4539f4[_0x5d94('0x2e')]('.')[0x0]);return _0x4539f4[_0x5d94('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x1dda62,_0x333241,_0x52c914){return google[_0x5d94('0x49')](_0x1dda62,_0x333241,_0x52c914)['then'](function(_0x1cb912){logger[_0x5d94('0x26')](_0x1cb912[_0x5d94('0x4a')]);return rp(_0x1cb912);})[_0x5d94('0x38')](function(_0x1e9524){var _0x5b8c31='';var _0x5ad4de=0x0;try{fs[_0x5d94('0x1f')](_0x1dda62);}catch(_0x538144){logger[_0x5d94('0x18')](_0x538144);}if(_0x1e9524&&_0x1e9524['results']){_0x5b8c31=_0x1e9524[_0x5d94('0x4b')][_0x5d94('0x4c')](function(_0x12375f){return _0x12375f&&_0x12375f[_0x5d94('0x4d')][0x0]&&_0x12375f[_0x5d94('0x4d')][0x0][_0x5d94('0x4e')]?_0x12375f[_0x5d94('0x4d')][0x0]['transcript']:'';})['join']('\x0a');_0x5ad4de=_0x1e9524[_0x5d94('0x4b')][_0x5d94('0x4c')](function(_0x4f7179){return _0x4f7179&&_0x4f7179[_0x5d94('0x4d')][0x0]&&_0x4f7179[_0x5d94('0x4d')][0x0]['confidence']?_0x4f7179[_0x5d94('0x4d')][0x0][_0x5d94('0x4f')]:0x0;})[_0x5d94('0x50')]('\x0a');}logger[_0x5d94('0x26')](_0x5d94('0x51'),_0x5b8c31);logger['info'](_0x5d94('0x52'),_0x5ad4de);return{'transcript':_0x5b8c31,'confidence':_0x5ad4de};})[_0x5d94('0x53')](function(_0x324b24){logger[_0x5d94('0x18')]('[%s]\x20%s:%s',_0x324b24[_0x5d94('0x17')],_0x324b24[_0x5d94('0x54')],_0x324b24[_0x5d94('0x55')]);});};exports['googleDialogflow']=function(_0x1aac8f,_0x122f85,_0x545043,_0xe511cf){var _0x1bb149=apiai(_0x122f85,{'language':_0xe511cf||'en'});return _0x1bb149['textRequest'](_0x545043,{'sessionId':md5(_0x1aac8f)})[_0x5d94('0x38')](function(_0x4d8973){logger['info'](JSON['stringify'](_0x4d8973));return{'source':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x57')],'resolvedQuery':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x58')],'action':_0x4d8973['result'][_0x5d94('0x59')],'actionIncomplete':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x5a')],'speech':_0x4d8973[_0x5d94('0x56')]['fulfillment'][_0x5d94('0x5b')],'score':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x5c')],'statusCode':_0x4d8973[_0x5d94('0x5d')][_0x5d94('0x5e')],'endConversation':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x5f')][_0x5d94('0x60')]||![],'isFallbackIntent':_0x4d8973[_0x5d94('0x56')][_0x5d94('0x5f')]['isFallbackIntent']};});};exports[_0x5d94('0x61')]=function(_0x49626c,_0x53b8fe,_0x26ece6,_0x3d4891,_0x58b8bc,_0x53a527){var _0xb1a5b2=_0x3d4891[_0x5d94('0x62')](/\\n/g,'\x0a');var _0x59dbbf={'credentials':{'private_key':_0xb1a5b2,'client_email':_0x26ece6}};var _0xc7ffd3=new dialogflow[(_0x5d94('0x63'))](_0x59dbbf);var _0x487082=_0xc7ffd3[_0x5d94('0x64')](_0x53b8fe,md5(_0x49626c));var _0x377b51={'session':_0x487082,'queryInput':{'text':{'text':_0x58b8bc,'languageCode':_0x53a527}}};return _0xc7ffd3['detectIntent'](_0x377b51)[_0x5d94('0x38')](function(_0x857356){if(_0x857356&&_0x857356[_0x5d94('0x45')]){logger['info'](_0x5d94('0x65'),JSON[_0x5d94('0x42')](_0x857356));var _0x16a19f=_0x857356[0x0];if(_0x16a19f){var _0x23d1ac={'action':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x59')],'allRequiredParamsPresent':_0x16a19f[_0x5d94('0x66')]['allRequiredParamsPresent'],'endConversation':_0x16a19f['queryResult'][_0x5d94('0x67')]&&_0x16a19f[_0x5d94('0x66')][_0x5d94('0x67')][_0x5d94('0x68')]?_0x16a19f['queryResult']['diagnosticInfo'][_0x5d94('0x68')][_0x5d94('0x69')]['boolValue']:![],'fulfillmentText':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x6a')],'intentName':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x6b')][_0x5d94('0x54')],'intentDisplayName':_0x16a19f['queryResult'][_0x5d94('0x6b')][_0x5d94('0x6c')],'isFallbackIntent':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x6b')][_0x5d94('0x6d')],'languageCode':_0x16a19f[_0x5d94('0x66')]['languageCode'],'queryText':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x6e')],'responseId':_0x16a19f['responseId'],'score':_0x16a19f['queryResult'][_0x5d94('0x6f')],'speech':_0x16a19f[_0x5d94('0x66')][_0x5d94('0x6a')],'providerResponse':JSON['stringify'](_0x857356)};return _0x23d1ac;}}});};exports[_0x5d94('0x70')]=function(_0x371324,_0x259d48,_0x3d413d,_0x36e091){return tilde[_0x5d94('0x49')](_0x371324,_0x259d48,_0x3d413d,_0x36e091)[_0x5d94('0x38')](function(_0x7a60c3){try{fs[_0x5d94('0x1f')](_0x371324);}catch(_0x2fc53a){logger[_0x5d94('0x18')](_0x2fc53a);}logger[_0x5d94('0x26')](_0x5d94('0x71'),_0x7a60c3['transcript']);logger[_0x5d94('0x26')]('Tilde\x20ASR\x20confidence',_0x7a60c3[_0x5d94('0x4f')]);return _0x7a60c3;});};exports[_0x5d94('0x72')]=function(_0x38a1cd,_0x40af0d,_0x4a8b2a,_0x222993,_0x1326e5,_0x249d67){var _0x327737=path[_0x5d94('0x29')](__dirname,_0x5d94('0x39'),rs[_0x5d94('0x2a')](0x4)+'.mp3');var _0x3e7b0f;return aws[_0x5d94('0x73')](_0x38a1cd,_0x40af0d,_0x4a8b2a,_0x222993,_0x1326e5,_0x249d67,_0x327737)[_0x5d94('0x38')](function(){_0x3e7b0f=path[_0x5d94('0x29')](__dirname,_0x5d94('0x39'),rs[_0x5d94('0x2a')](0x4)+'.wav');return convertFile(_0x327737,_0x3e7b0f);})['then'](function(){try{fs[_0x5d94('0x1f')](_0x327737);fs[_0x5d94('0x3d')](_0x3e7b0f,'777');}catch(_0x12736a){logger[_0x5d94('0x18')](_0x12736a);}return _0x3e7b0f[_0x5d94('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x13f15d,_0x588826,_0x574383,_0x246bdd,_0x28def6,_0x2c3193){return aws['lex'](_0x13f15d,_0x588826,_0x574383,_0x246bdd,_0x28def6,_0x2c3193)[_0x5d94('0x38')](function(_0x58a627){logger[_0x5d94('0x26')](JSON[_0x5d94('0x42')](_0x58a627));return _0x58a627;});};exports[_0x5d94('0x74')]=function(_0x51eed7,_0x3c16bc,_0x25362f,_0x372e47){var _0x288929=util[_0x5d94('0x75')](_0x5d94('0x76'),ISPEECH_API,_0x51eed7,encodeURIComponent(_0x3c16bc),_0x25362f,_0x372e47);var _0x19cf78=path[_0x5d94('0x29')](__dirname,_0x5d94('0x39'),rs['generate'](0x4)+_0x5d94('0x3a'));var _0x7d98d;return downloadFile(_0x288929,_0x19cf78)[_0x5d94('0x38')](function(){_0x7d98d=path[_0x5d94('0x29')](__dirname,'tmp',rs[_0x5d94('0x2a')](0x4)+'.wav');return convertFile(_0x19cf78,_0x7d98d);})[_0x5d94('0x38')](function(){try{fs[_0x5d94('0x1f')](_0x19cf78);fs[_0x5d94('0x3d')](_0x7d98d,_0x5d94('0x2d'));}catch(_0xbb60c){logger['error'](_0xbb60c);}return _0x7d98d['split']('.')[0x0];});};exports[_0x5d94('0x77')]=function(_0x5e6b3d,_0x4724a0,_0x1d9a8b,_0x19fb89){var _0x53799b=util[_0x5d94('0x75')](_0x5d94('0x78'),ISPEECH_API,_0x4724a0,_0x1d9a8b,base64Encode(_0x5e6b3d),_0x19fb89?util[_0x5d94('0x75')](_0x5d94('0x79'),encodeURIComponent(_0x19fb89)):_0x5d94('0x7a'));return uploadFile(_0x53799b)[_0x5d94('0x38')](function(_0x29aac9){return querystring[_0x5d94('0x9')](_0x29aac9);});};exports['sestekNDA']=function(_0x58d76d,_0x132173){return sestek['nda'](_0x58d76d,_0x132173)[_0x5d94('0x38')](function(_0x53d904){logger['info'](JSON[_0x5d94('0x42')](_0x53d904));var _0x43ac53={'speech':_0x53d904[_0x5d94('0x7b')],'action':_0x53d904[_0x5d94('0x7c')]?_0x53d904[_0x5d94('0x7c')][_0x5d94('0x7d')]:undefined,'actiondata':_0x53d904[_0x5d94('0x7c')]?_0x53d904[_0x5d94('0x7c')]['CustomActionData']:undefined};if(_0x53d904[_0x5d94('0x7c')]&&_0x53d904['channelData'][_0x5d94('0x7e')]){return base64Decode(_0x53d904['channelData']['AudioFromTts'][_0x5d94('0x7f')],path['resolve'](__dirname,'tmp',rs[_0x5d94('0x2a')](0x4)+_0x5d94('0x2b')))[_0x5d94('0x38')](function(_0x50c8a4){_0x43ac53[_0x5d94('0x80')]=_0x50c8a4;return _0x43ac53;});}return _0x43ac53;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf28b=['googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','result','source','action','actionIncomplete','fulfillment','speech','code','metadata','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','boolValue','fulfillmentText','intent','isFallback','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','nda','channelData','CustomAction','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','http','https','sox','google-tts-api','url','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','end','request\x20to\x20','data','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','stringify','jQ1olc','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path'];(function(_0x5d4345,_0x545967){var _0x5dec3c=function(_0x2d8b6b){while(--_0x2d8b6b){_0x5d4345['push'](_0x5d4345['shift']());}};_0x5dec3c(++_0x545967);}(_0xf28b,0x130));var _0xbf28=function(_0x3f69fe,_0x75b260){_0x3f69fe=_0x3f69fe-0x0;var _0x420267=_0xf28b[_0x3f69fe];return _0x420267;};'use strict';var apiai=require(_0xbf28('0x0'));var BPromise=require(_0xbf28('0x1'));var dialogflow=require(_0xbf28('0x2'));var fs=require('fs');var http=require(_0xbf28('0x3'));var https=require(_0xbf28('0x4'));var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xbf28('0x5'));var tts=require(_0xbf28('0x6'));var urlParse=require(_0xbf28('0x7'))['parse'];var util=require(_0xbf28('0x8'));var aws=require(_0xbf28('0x9'));var google=require(_0xbf28('0xa'));var sestek=require('./sestek');var tilde=require(_0xbf28('0xb'));var logger=require(_0xbf28('0xc'))(_0xbf28('0xd'));var ISPEECH_API=_0xbf28('0xe');function downloadFile(_0x4a653e,_0xd07f74){return new BPromise(function(_0x144c1f,_0x5c6166){var _0x5887b2=urlParse(_0x4a653e);var _0x2e3f6e=_0x5887b2[_0xbf28('0xf')]==='https:'?https:http;var _0x573b59={'host':_0x5887b2[_0xbf28('0x10')],'path':_0x5887b2[_0xbf28('0x11')],'headers':{'user-agent':_0xbf28('0x12')}};_0x2e3f6e[_0xbf28('0x13')](_0x573b59,function(_0x337296){if(_0x337296[_0xbf28('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x4a653e+_0xbf28('0x15')+_0x337296[_0xbf28('0x14')]+'\x20('+_0x337296[_0xbf28('0x16')]+')');_0x5c6166(new Error('request\x20to\x20'+_0x4a653e+_0xbf28('0x15')+_0x337296['statusCode']+'\x20('+_0x337296[_0xbf28('0x16')]+')'));return;}var _0x10b8bb=fs[_0xbf28('0x17')](_0xd07f74);_0x10b8bb['on'](_0xbf28('0x18'),function(){logger[_0xbf28('0x19')](_0xbf28('0x1a'));_0x10b8bb[_0xbf28('0x1b')](_0x144c1f);});_0x10b8bb['on'](_0xbf28('0x1c'),function(_0x4753db){fs[_0xbf28('0x1d')](_0xd07f74);logger['error']('download\x20error',_0x4753db);_0x5c6166(_0x4753db);});_0x337296['pipe'](_0x10b8bb);})['on'](_0xbf28('0x1c'),function(_0x33dac7){logger[_0xbf28('0x1c')](_0x33dac7);_0x5c6166(_0x33dac7);})[_0xbf28('0x1e')]();});}function uploadFile(_0x354e88){return new BPromise(function(_0x5a5776,_0x2640d4){var _0x385265=urlParse(_0x354e88);var _0x44fff3=_0x385265['protocol']==='https:'?https:http;var _0x4226ca={'host':_0x385265['host'],'path':_0x385265[_0xbf28('0x11')],'headers':{'user-agent':_0xbf28('0x12')}};_0x44fff3[_0xbf28('0x13')](_0x4226ca,function(_0x22041c){if(_0x22041c[_0xbf28('0x14')]!==0xc8){_0x2640d4(new Error(_0xbf28('0x1f')+_0x354e88+_0xbf28('0x15')+_0x22041c[_0xbf28('0x14')]+'\x20('+_0x22041c[_0xbf28('0x16')]+')'));return;}var _0x70aada='';_0x22041c['on'](_0xbf28('0x20'),function(_0x1abc31){_0x70aada+=_0x1abc31;});_0x22041c['on']('end',function(){_0x5a5776(_0x70aada);});})['on'](_0xbf28('0x1c'),function(_0x51e632){_0x2640d4(_0x51e632);})[_0xbf28('0x1e')]();});}function convertFile(_0x155533,_0x21bde7){return new BPromise(function(_0x3ed9fd,_0x4957c7){var _0x198930=sox['transcode'](_0x155533,_0x21bde7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x198930['on'](_0xbf28('0x1c'),function(_0x3df6b9){logger['error'](_0xbf28('0x21'),_0x3df6b9);_0x4957c7(_0x3df6b9);});_0x198930['on'](_0xbf28('0x1e'),function(){logger[_0xbf28('0x19')](_0xbf28('0x22'));_0x3ed9fd();});_0x198930[_0xbf28('0x23')]();});}function base64Decode(_0x5279f5,_0x1d8b96){var _0x4090bc=path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+_0xbf28('0x27'));fs[_0xbf28('0x28')](_0x4090bc,_0x5279f5,_0xbf28('0x29'));return convertFile(_0x4090bc,_0x1d8b96)[_0xbf28('0x2a')](function(){try{fs[_0xbf28('0x1d')](_0x4090bc);fs[_0xbf28('0x2b')](_0x1d8b96,_0xbf28('0x2c'));}catch(_0x23efd3){logger['error'](_0x23efd3);}return _0x1d8b96[_0xbf28('0x2d')]('.')[0x0];});}function base64Encode(_0x34c157){var _0x318035=fs[_0xbf28('0x2e')](_0x34c157);return new Buffer(_0x318035)[_0xbf28('0x2f')](_0xbf28('0x29'));}exports[_0xbf28('0x30')]=function(_0x3919d4,_0x64a370,_0x50d0f1,_0x5ae302,_0x254341,_0x193f3c){var _0x3d2bbd,_0x352477;var _0x32dd41=_0xbf28('0x31');var _0x55a2db=_0xbf28('0x32')+_0x3919d4;var _0x54f8dd={};if(_0x64a370==='ssml'){_0x54f8dd[_0xbf28('0x33')]={'ssml':_0x50d0f1};}else{_0x54f8dd[_0xbf28('0x33')]={'text':_0x50d0f1};};_0x54f8dd[_0xbf28('0x34')]={'languageCode':_0x5ae302,'ssmlGender':_0x254341};_0x54f8dd[_0xbf28('0x35')]={'audioEncoding':_0xbf28('0x36'),'sampleRateHertz':0x1f40};var _0xe60a40={'url':_0x32dd41+_0xbf28('0x37')+_0x55a2db,'method':'POST','json':!![],'body':_0x54f8dd};return rp(_0xe60a40)['then'](function(_0x195a4c){return new BPromise(function(_0x51ebe0,_0x5e7c75){_0x3d2bbd=path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs['generate'](0x4)+'.mp3');var _0x4e42fa=Buffer[_0xbf28('0x38')](_0x195a4c[_0xbf28('0x39')],_0xbf28('0x29'));return fs[_0xbf28('0x3a')](_0x3d2bbd,_0x4e42fa,function(_0xdc2dfd){_0x5e7c75(_0xdc2dfd);},function(_0x37d836){fs[_0xbf28('0x2b')](_0x3d2bbd,_0xbf28('0x2c'));_0x51ebe0(_0x37d836);});});})['then'](function(_0x488c45){_0x352477=path['resolve'](__dirname,_0xbf28('0x25'),rs['generate'](0x4)+_0xbf28('0x27'));return convertFile(_0x3d2bbd,_0x352477);})['then'](function(){try{fs[_0xbf28('0x1d')](_0x3d2bbd);fs[_0xbf28('0x2b')](_0x352477,'777');}catch(_0x2c009c){logger[_0xbf28('0x1c')](_0x2c009c);}logger[_0xbf28('0x19')](_0xbf28('0x3b'),_0x352477[_0xbf28('0x2d')]('.')[0x0]);return _0x352477[_0xbf28('0x2d')]('.')[0x0];});};exports[_0xbf28('0x3c')]=function(_0x114eb9,_0x512a40){var _0x43a104=_0xbf28('0x3d');var _0x114222,_0x1e6aab;var _0x16732c;var _0x4f495c={'encoding':_0xbf28('0x3e'),'method':_0xbf28('0x3f'),'timeout':0x2710,'url':_0x43a104,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xbf28('0x40')]([[[_0xbf28('0x41'),JSON[_0xbf28('0x40')]([_0x114eb9,_0x512a40||'en',![],'null']),null,_0xbf28('0x42')]]]))};return rp(_0x4f495c)['then'](function(_0x319e8a){try{_0x16732c=eval(_0x319e8a['slice'](0x5))[0x0][0x2];}catch(_0x581eb3){throw new Error('parse\x20response\x20failed:\x0a'+_0x319e8a[_0xbf28('0x20')]);}if(!_0x16732c){if(_0x114eb9[_0xbf28('0x43')]>0xc8){throw new Error(_0xbf28('0x44'));}else{throw new Error(_0xbf28('0x45')+_0x512a40+_0xbf28('0x46'));}}try{_0x16732c=eval(_0x16732c)[0x0];}catch(_0x248716){throw new Error(_0xbf28('0x47')+res['data']);}const _0x326cb2=_0x16732c;_0x114222=path['resolve'](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+_0xbf28('0x48'));fs[_0xbf28('0x28')](_0x114222,_0x16732c,{'encoding':_0xbf28('0x29')});_0x1e6aab=path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+'.wav');return convertFile(_0x114222,_0x1e6aab);})[_0xbf28('0x2a')](function(){try{fs[_0xbf28('0x1d')](_0x114222);fs['chmodSync'](_0x1e6aab,_0xbf28('0x2c'));}catch(_0x607ef3){logger[_0xbf28('0x1c')](_0x607ef3);}logger[_0xbf28('0x19')](_0xbf28('0x49'),_0x1e6aab[_0xbf28('0x2d')]('.')[0x0]);return _0x1e6aab[_0xbf28('0x2d')]('.')[0x0];});};exports[_0xbf28('0x4a')]=function(_0x35fe0d,_0x5338c6,_0x708b87){return google['asr'](_0x35fe0d,_0x5338c6,_0x708b87)[_0xbf28('0x2a')](function(_0x366da5){logger[_0xbf28('0x19')](_0x366da5[_0xbf28('0x4b')]);return rp(_0x366da5);})['then'](function(_0x2cf024){var _0x2e467c='';var _0x45b958=0x0;try{fs['unlink'](_0x35fe0d);}catch(_0x2dfb04){logger[_0xbf28('0x1c')](_0x2dfb04);}if(_0x2cf024&&_0x2cf024['results']){_0x2e467c=_0x2cf024[_0xbf28('0x4c')][_0xbf28('0x4d')](function(_0x3a7229){return _0x3a7229&&_0x3a7229[_0xbf28('0x4e')][0x0]&&_0x3a7229[_0xbf28('0x4e')][0x0][_0xbf28('0x4f')]?_0x3a7229[_0xbf28('0x4e')][0x0][_0xbf28('0x4f')]:'';})[_0xbf28('0x50')]('\x0a');_0x45b958=_0x2cf024['results']['map'](function(_0x197c69){return _0x197c69&&_0x197c69[_0xbf28('0x4e')][0x0]&&_0x197c69[_0xbf28('0x4e')][0x0]['confidence']?_0x197c69[_0xbf28('0x4e')][0x0][_0xbf28('0x51')]:0x0;})[_0xbf28('0x50')]('\x0a');}logger[_0xbf28('0x19')]('googleASR\x20transcription',_0x2e467c);logger['info'](_0xbf28('0x52'),_0x45b958);return{'transcript':_0x2e467c,'confidence':_0x45b958};})['catch'](function(_0x1d55b9){logger[_0xbf28('0x1c')](_0xbf28('0x53'),_0x1d55b9['statusCode'],_0x1d55b9['name'],_0x1d55b9[_0xbf28('0x54')]);});};exports[_0xbf28('0x55')]=function(_0x4c18b7,_0x9ae2c,_0x32ea21,_0x4a3253){var _0x151fc9=apiai(_0x9ae2c,{'language':_0x4a3253||'en'});return _0x151fc9['textRequest'](_0x32ea21,{'sessionId':md5(_0x4c18b7)})[_0xbf28('0x2a')](function(_0x586662){logger[_0xbf28('0x19')](JSON[_0xbf28('0x40')](_0x586662));return{'source':_0x586662[_0xbf28('0x56')][_0xbf28('0x57')],'resolvedQuery':_0x586662[_0xbf28('0x56')]['resolvedQuery'],'action':_0x586662[_0xbf28('0x56')][_0xbf28('0x58')],'actionIncomplete':_0x586662['result'][_0xbf28('0x59')],'speech':_0x586662[_0xbf28('0x56')][_0xbf28('0x5a')][_0xbf28('0x5b')],'score':_0x586662[_0xbf28('0x56')]['score'],'statusCode':_0x586662['status'][_0xbf28('0x5c')],'endConversation':_0x586662['result'][_0xbf28('0x5d')]['endConversation']||![],'isFallbackIntent':_0x586662['result']['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x37685f,_0x8e42e1,_0x582fff,_0x54e3f1,_0x597af8,_0x5839a2){var _0x4c5901=_0x54e3f1[_0xbf28('0x5e')](/\\n/g,'\x0a');var _0x484583={'credentials':{'private_key':_0x4c5901,'client_email':_0x582fff}};var _0x1b043d=new dialogflow[(_0xbf28('0x5f'))](_0x484583);var _0x20c65d=_0x1b043d[_0xbf28('0x60')](_0x8e42e1,md5(_0x37685f));var _0xfd63e1={'session':_0x20c65d,'queryInput':{'text':{'text':_0x597af8,'languageCode':_0x5839a2}}};return _0x1b043d['detectIntent'](_0xfd63e1)[_0xbf28('0x2a')](function(_0x24977a){if(_0x24977a&&_0x24977a['length']){logger['info'](_0xbf28('0x61'),JSON[_0xbf28('0x40')](_0x24977a));var _0x5ab423=_0x24977a[0x0];if(_0x5ab423){var _0x1758bd={'action':_0x5ab423[_0xbf28('0x62')][_0xbf28('0x58')],'allRequiredParamsPresent':_0x5ab423['queryResult'][_0xbf28('0x63')],'endConversation':_0x5ab423['queryResult']['diagnosticInfo']&&_0x5ab423[_0xbf28('0x62')]['diagnosticInfo']['fields']?_0x5ab423[_0xbf28('0x62')]['diagnosticInfo'][_0xbf28('0x64')]['end_conversation'][_0xbf28('0x65')]:![],'fulfillmentText':_0x5ab423[_0xbf28('0x62')][_0xbf28('0x66')],'intentName':_0x5ab423[_0xbf28('0x62')][_0xbf28('0x67')]['name'],'intentDisplayName':_0x5ab423[_0xbf28('0x62')][_0xbf28('0x67')]['displayName'],'isFallbackIntent':_0x5ab423[_0xbf28('0x62')]['intent'][_0xbf28('0x68')],'languageCode':_0x5ab423[_0xbf28('0x62')]['languageCode'],'queryText':_0x5ab423['queryResult']['queryText'],'responseId':_0x5ab423[_0xbf28('0x69')],'score':_0x5ab423['queryResult'][_0xbf28('0x6a')],'speech':_0x5ab423[_0xbf28('0x62')][_0xbf28('0x66')],'providerResponse':JSON['stringify'](_0x24977a)};return _0x1758bd;}}});};exports[_0xbf28('0x6b')]=function(_0x12504a,_0x5839d4,_0x1dd900,_0x450db0){return tilde[_0xbf28('0x6c')](_0x12504a,_0x5839d4,_0x1dd900,_0x450db0)[_0xbf28('0x2a')](function(_0x3cb2ab){try{fs[_0xbf28('0x1d')](_0x12504a);}catch(_0x354470){logger[_0xbf28('0x1c')](_0x354470);}logger[_0xbf28('0x19')]('Tilde\x20ASR\x20transcription',_0x3cb2ab[_0xbf28('0x4f')]);logger[_0xbf28('0x19')](_0xbf28('0x6d'),_0x3cb2ab[_0xbf28('0x51')]);return _0x3cb2ab;});};exports[_0xbf28('0x6e')]=function(_0x1405c1,_0x5a7a04,_0x3bbea3,_0x5340ae,_0x590336,_0x1fa3f8){var _0x214f3e=path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+_0xbf28('0x48'));var _0x3bbfb7;return aws[_0xbf28('0x6f')](_0x1405c1,_0x5a7a04,_0x3bbea3,_0x5340ae,_0x590336,_0x1fa3f8,_0x214f3e)[_0xbf28('0x2a')](function(){_0x3bbfb7=path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+_0xbf28('0x27'));return convertFile(_0x214f3e,_0x3bbfb7);})[_0xbf28('0x2a')](function(){try{fs[_0xbf28('0x1d')](_0x214f3e);fs['chmodSync'](_0x3bbfb7,_0xbf28('0x2c'));}catch(_0x51a2d9){logger[_0xbf28('0x1c')](_0x51a2d9);}return _0x3bbfb7[_0xbf28('0x2d')]('.')[0x0];});};exports[_0xbf28('0x70')]=function(_0x246c6d,_0x186797,_0x1cb16e,_0x484965,_0xe20bf7,_0xc67b79){return aws[_0xbf28('0x71')](_0x246c6d,_0x186797,_0x1cb16e,_0x484965,_0xe20bf7,_0xc67b79)[_0xbf28('0x2a')](function(_0x5b2214){logger[_0xbf28('0x19')](JSON[_0xbf28('0x40')](_0x5b2214));return _0x5b2214;});};exports[_0xbf28('0x72')]=function(_0x42a361,_0x175aaf,_0x437a60,_0x3f829a){var _0x506658=util[_0xbf28('0x73')](_0xbf28('0x74'),ISPEECH_API,_0x42a361,encodeURIComponent(_0x175aaf),_0x437a60,_0x3f829a);var _0x49f42c=path[_0xbf28('0x24')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x2d8d6e;return downloadFile(_0x506658,_0x49f42c)[_0xbf28('0x2a')](function(){_0x2d8d6e=path[_0xbf28('0x24')](__dirname,'tmp',rs[_0xbf28('0x26')](0x4)+_0xbf28('0x27'));return convertFile(_0x49f42c,_0x2d8d6e);})[_0xbf28('0x2a')](function(){try{fs[_0xbf28('0x1d')](_0x49f42c);fs[_0xbf28('0x2b')](_0x2d8d6e,_0xbf28('0x2c'));}catch(_0x12a97a){logger[_0xbf28('0x1c')](_0x12a97a);}return _0x2d8d6e[_0xbf28('0x2d')]('.')[0x0];});};exports[_0xbf28('0x75')]=function(_0xe6df50,_0x14f7e2,_0x57d34b,_0x24f719){var _0x28efec=util[_0xbf28('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x14f7e2,_0x57d34b,base64Encode(_0xe6df50),_0x24f719?util['format'](_0xbf28('0x76'),encodeURIComponent(_0x24f719)):_0xbf28('0x77'));return uploadFile(_0x28efec)['then'](function(_0x5d1505){return querystring[_0xbf28('0x78')](_0x5d1505);});};exports['sestekNDA']=function(_0x5c7a65,_0x42273a){return sestek[_0xbf28('0x79')](_0x5c7a65,_0x42273a)['then'](function(_0x36df38){logger['info'](JSON[_0xbf28('0x40')](_0x36df38));var _0x70bca0={'speech':_0x36df38['text'],'action':_0x36df38[_0xbf28('0x7a')]?_0x36df38['channelData'][_0xbf28('0x7b')]:undefined,'actiondata':_0x36df38[_0xbf28('0x7a')]?_0x36df38[_0xbf28('0x7a')]['CustomActionData']:undefined};if(_0x36df38[_0xbf28('0x7a')]&&_0x36df38[_0xbf28('0x7a')][_0xbf28('0x7c')]){return base64Decode(_0x36df38[_0xbf28('0x7a')]['AudioFromTts']['Data'],path[_0xbf28('0x24')](__dirname,_0xbf28('0x25'),rs[_0xbf28('0x26')](0x4)+_0xbf28('0x27')))[_0xbf28('0x2a')](function(_0xd51850){_0x70bca0['audiofile']=_0xd51850;return _0x70bca0;});}return _0x70bca0;});};exports[_0xbf28('0x7d')]=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 557e3fa..d046d86 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 _0xf88c=['./nda','exports'];(function(_0x3e7e07,_0x608f89){var _0x30f6f3=function(_0x1817b2){while(--_0x1817b2){_0x3e7e07['push'](_0x3e7e07['shift']());}};_0x30f6f3(++_0x608f89);}(_0xf88c,0x1ea));var _0xcf88=function(_0x442010,_0x2f30a5){_0x442010=_0x442010-0x0;var _0xa27255=_0xf88c[_0x442010];return _0xa27255;};var nda=require(_0xcf88('0x0'));module[_0xcf88('0x1')]={'nda':nda}; \ No newline at end of file +var _0x898b=['exports','./nda'];(function(_0x4713bb,_0x28b1bb){var _0x135f84=function(_0x1ea998){while(--_0x1ea998){_0x4713bb['push'](_0x4713bb['shift']());}};_0x135f84(++_0x28b1bb);}(_0x898b,0x7b));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};var nda=require(_0xb898('0x0'));module[_0xb898('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 4edeaf0..61d9d11 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 _0x0834=['AudioOutputSettings','custom_action','body','CustomAction','CustomActionData','custom_action_data','../../../../../config/logger','agi','POST','ndauth_url','/token','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','access_token','project','channelData','ProjectName'];(function(_0x4d11bc,_0xeb6e48){var _0x5693ac=function(_0x226e52){while(--_0x226e52){_0x4d11bc['push'](_0x4d11bc['shift']());}};_0x5693ac(++_0xeb6e48);}(_0x0834,0x18e));var _0x4083=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x0834[_0x575057];return _0x49dbc8;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x4083('0x0'))(_0x4083('0x1'));module['exports']=function(_0x491147,_0x5e1812){var _0x14d004={'method':_0x4083('0x2'),'uri':url['resolve'](_0x5e1812[_0x4083('0x3')],_0x4083('0x4')),'form':{'grant_type':'password','username':_0x5e1812[_0x4083('0x5')],'password':_0x5e1812['password']},'json':!![]};return rp(_0x14d004)[_0x4083('0x6')](function(_0x26ed53){var _0x2c42bb={'method':_0x4083('0x2'),'uri':url[_0x4083('0x7')](_0x5e1812[_0x4083('0x8')],_0x4083('0x9')),'body':{'type':_0x5e1812[_0x4083('0xa')]||_0x4083('0xb'),'channelId':_0x4083('0xc'),'conversation':{'id':_0x491147[_0x4083('0xd')]},'from':{'id':_0x491147[_0x4083('0xe')],'name':_0x491147[_0x4083('0xf')]},'recipient':{'id':_0x491147[_0x4083('0x10')],'name':_0x491147[_0x4083('0x11')]},'text':_0x5e1812['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x26ed53[_0x4083('0x12')]},'json':!![]};if(_0x5e1812[_0x4083('0x13')]){_0x2c42bb['body'][_0x4083('0x14')][_0x4083('0x15')]=_0x5e1812[_0x4083('0x13')];}if(_0x5e1812['ndagenerate_audio']=='1'){_0x2c42bb['body'][_0x4083('0x14')][_0x4083('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5e1812[_0x4083('0x17')]){_0x2c42bb[_0x4083('0x18')][_0x4083('0x14')][_0x4083('0x19')]=_0x5e1812[_0x4083('0x17')];if(_0x5e1812['custom_action_data']){_0x2c42bb[_0x4083('0x18')][_0x4083('0x14')][_0x4083('0x1a')]=_0x5e1812[_0x4083('0x1b')];}}logger['info'](JSON['stringify'](_0x2c42bb));return rp(_0x2c42bb);});}; \ No newline at end of file +var _0x0aaf=['body','CustomAction','custom_action','custom_action_data','CustomActionData','info','../../../../../config/logger','agi','exports','POST','resolve','/token','username','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','channelData','audio/wav'];(function(_0x4d34c3,_0x27676b){var _0x18f5b3=function(_0x3d6bad){while(--_0x3d6bad){_0x4d34c3['push'](_0x4d34c3['shift']());}};_0x18f5b3(++_0x27676b);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0x0aaf[_0x431cf2];return _0x10c9a7;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xf0aa('0x0'))(_0xf0aa('0x1'));module[_0xf0aa('0x2')]=function(_0x3402de,_0x5e7bdc){var _0x507aaa={'method':_0xf0aa('0x3'),'uri':url[_0xf0aa('0x4')](_0x5e7bdc['ndauth_url'],_0xf0aa('0x5')),'form':{'grant_type':'password','username':_0x5e7bdc[_0xf0aa('0x6')],'password':_0x5e7bdc['password']},'json':!![]};return rp(_0x507aaa)[_0xf0aa('0x7')](function(_0x244745){var _0x38bf88={'method':'POST','uri':url[_0xf0aa('0x4')](_0x5e7bdc[_0xf0aa('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5e7bdc[_0xf0aa('0x9')]||_0xf0aa('0xa'),'channelId':_0xf0aa('0xb'),'conversation':{'id':_0x3402de[_0xf0aa('0xc')]},'from':{'id':_0x3402de[_0xf0aa('0xd')],'name':_0x3402de[_0xf0aa('0xe')]},'recipient':{'id':_0x3402de[_0xf0aa('0xf')],'name':_0x3402de[_0xf0aa('0x10')]},'text':_0x5e7bdc[_0xf0aa('0x11')],'channelData':{}},'headers':{'Authorization':_0xf0aa('0x12')+_0x244745[_0xf0aa('0x13')]},'json':!![]};if(_0x5e7bdc[_0xf0aa('0x14')]){_0x38bf88['body']['channelData'][_0xf0aa('0x15')]=_0x5e7bdc[_0xf0aa('0x14')];}if(_0x5e7bdc['ndagenerate_audio']=='1'){_0x38bf88['body'][_0xf0aa('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf0aa('0x17')};}if(_0x5e7bdc['custom_action']){_0x38bf88[_0xf0aa('0x18')]['channelData'][_0xf0aa('0x19')]=_0x5e7bdc[_0xf0aa('0x1a')];if(_0x5e7bdc[_0xf0aa('0x1b')]){_0x38bf88[_0xf0aa('0x18')][_0xf0aa('0x16')][_0xf0aa('0x1c')]=_0x5e7bdc[_0xf0aa('0x1b')];}}logger[_0xf0aa('0x1d')](JSON['stringify'](_0x38bf88));return rp(_0x38bf88);});}; \ 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 11a42c6..fd5fc6c 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 _0x24bf=['exports','./lib/api'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x24bf,0x105));var _0xf24b=function(_0x3cd944,_0x2f134b){_0x3cd944=_0x3cd944-0x0;var _0xad852c=_0x24bf[_0x3cd944];return _0xad852c;};'use strict';var asr=require(_0xf24b('0x0'));module[_0xf24b('0x1')]=function(_0x116916,_0x5e3414,_0x2d05f4,_0x2647cf){return asr(_0x116916,_0x5e3414,_0x2d05f4,_0x2647cf);}; \ No newline at end of file +var _0x2c34=['exports'];(function(_0x50f045,_0x4bc615){var _0x81cb20=function(_0x269039){while(--_0x269039){_0x50f045['push'](_0x50f045['shift']());}};_0x81cb20(++_0x4bc615);}(_0x2c34,0x124));var _0x42c3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2c34[_0x42cae2];return _0x5f256f;};'use strict';var asr=require('./lib/api');module[_0x42c3('0x0')]=function(_0x2c5832,_0x5ac700,_0x285af7,_0x2b163e){return asr(_0x2c5832,_0x5ac700,_0x285af7,_0x2b163e);}; \ 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 e7afdeb..9a3b8fa 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 _0x0c40=['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.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','stringify','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','Tilde\x20ASR\x20hypoteses'];(function(_0x36fbb0,_0xa36b4b){var _0x488d1b=function(_0x204ce9){while(--_0x204ce9){_0x36fbb0['push'](_0x36fbb0['shift']());}};_0x488d1b(++_0xa36b4b);}(_0x0c40,0x180));var _0x00c4=function(_0x44da0a,_0x37814d){_0x44da0a=_0x44da0a-0x0;var _0x10f937=_0x0c40[_0x44da0a];return _0x10f937;};'use strict';var BPromise=require(_0x00c4('0x0'));var _=require(_0x00c4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x00c4('0x2'));var crypto=require(_0x00c4('0x3'));var logger=require(_0x00c4('0x4'))(_0x00c4('0x5'));module[_0x00c4('0x6')]=function(_0x330c90,_0x28f8ca,_0x3952fc,_0x51010b){return new BPromise(function(_0x4a5f8c,_0x8b5660){logger[_0x00c4('0x7')]('Tilde\x20URI',_0x51010b||_0x00c4('0x8'));var _0x3eeacb=new WebSocket(_0x51010b||_0x00c4('0x8'),{'perMessageDeflate':![]});var _0x1b73b0='';var _0x1f5ad9='0';var _0x2fde66='1';var _0x5d7251=_0x00c4('0x9');function _0x1b4a52(_0x520567){var _0x46722b=crypto[_0x00c4('0xa')](_0x00c4('0xb'));_0x46722b[_0x00c4('0xc')](_0x520567);return _0x46722b[_0x00c4('0xd')](_0x00c4('0xe'));}function _0xc3085a(){try{logger[_0x00c4('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x343e2a=moment()[_0x00c4('0xf')]();var _0x3e0cfb=_0x1b4a52(_0x343e2a+_0x28f8ca+_0x3952fc);_0x3eeacb['send'](JSON[_0x00c4('0x10')]({'appID':_0x28f8ca,'timestamp':_0x343e2a,'appKey':_0x3e0cfb}));var _0x2d6a1c=fs['createReadStream'](_0x330c90);_0x2d6a1c['on'](_0x00c4('0x11'),function(_0x1e3a2c){_0x3eeacb[_0x00c4('0x12')](_0x1e3a2c);});_0x2d6a1c['on'](_0x00c4('0x13'),function(){_0x3eeacb[_0x00c4('0x12')](_0x00c4('0x14'));});}catch(_0x3c6daf){logger[_0x00c4('0x15')](_0x00c4('0x16'),JSON[_0x00c4('0x10')](_0x3c6daf));_0x3eeacb['terminate']();}}function _0xe5e110(_0x1107c8){try{if(_0x1107c8){var _0x514361=JSON['parse'](_0x1107c8);switch(_0x514361['status']){case 0x0:if(_0x514361[_0x00c4('0x17')]){if(_0x514361['result'][_0x00c4('0x18')]){logger[_0x00c4('0x7')](_0x00c4('0x19'),JSON[_0x00c4('0x10')](_0x514361[_0x00c4('0x17')][_0x00c4('0x1a')]));_0x1b73b0=_0x514361[_0x00c4('0x17')][_0x00c4('0x1a')][0x0][_0x00c4('0x1b')];_0x1f5ad9=_0x514361[_0x00c4('0x17')][_0x00c4('0x1a')][0x0][_0x00c4('0x1c')];_0x2fde66='0';_0x5d7251=_0x00c4('0x1d');_0x3eeacb[_0x00c4('0x1e')]();}}break;case 0x1:logger[_0x00c4('0x7')](_0x00c4('0x9'));_0x2fde66='1';_0x5d7251=_0x00c4('0x9');break;case 0x2:logger[_0x00c4('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2fde66='2';_0x5d7251=_0x00c4('0x1f');break;case 0x9:logger[_0x00c4('0x7')](_0x00c4('0x20'));_0x2fde66='9';_0x5d7251=_0x00c4('0x20');break;case 0xa:logger['info'](_0x00c4('0x21'));_0x2fde66='10';_0x5d7251=_0x00c4('0x21');break;case 0xb:logger[_0x00c4('0x7')](_0x00c4('0x22'));_0x2fde66='11';_0x5d7251=_0x00c4('0x22');}}}catch(_0x85e09){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x85e09));_0x3eeacb[_0x00c4('0x1e')]();}}function _0x5a9371(){logger[_0x00c4('0x7')](_0x00c4('0x23'));_0x4a5f8c({'transcript':_0x1b73b0,'confidence':_0x1f5ad9,'status':_0x2fde66,'status_message':_0x5d7251});}function _0xd73afd(_0x30c2c0){logger[_0x00c4('0x15')](_0x00c4('0x24'));if(!_[_0x00c4('0x25')](_0x30c2c0)){logger['error'](_[_0x00c4('0x26')](_0x30c2c0)?JSON[_0x00c4('0x10')](_0x30c2c0):_0x30c2c0);}}_0x3eeacb['on'](_0x00c4('0x27'),_0xc3085a);_0x3eeacb['on'](_0x00c4('0x28'),_0xe5e110);_0x3eeacb['on'](_0x00c4('0x13'),_0x5a9371);_0x3eeacb['on']('error',_0xd73afd);});}; \ No newline at end of file +var _0x84b9=['stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','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','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS'];(function(_0x589788,_0x2a34e5){var _0x1069f2=function(_0x4ee5cf){while(--_0x4ee5cf){_0x589788['push'](_0x589788['shift']());}};_0x1069f2(++_0x2a34e5);}(_0x84b9,0xd7));var _0x984b=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x84b9[_0x70fd53];return _0x4b71c5;};'use strict';var BPromise=require(_0x984b('0x0'));var _=require(_0x984b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x984b('0x2'));var crypto=require(_0x984b('0x3'));var logger=require('../../../../../../config/logger')(_0x984b('0x4'));module[_0x984b('0x5')]=function(_0x36234b,_0x4b22a5,_0x5052c1,_0x27cb5d){return new BPromise(function(_0x402ba9,_0x58838f){logger[_0x984b('0x6')](_0x984b('0x7'),_0x27cb5d||_0x984b('0x8'));var _0x5ac151=new WebSocket(_0x27cb5d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1692fc='';var _0x2761c9='0';var _0x54973d='1';var _0x2168c4='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x38e6e0(_0x24ec60){var _0x1f0e6a=crypto[_0x984b('0x9')](_0x984b('0xa'));_0x1f0e6a[_0x984b('0xb')](_0x24ec60);return _0x1f0e6a['digest'](_0x984b('0xc'));}function _0x2c05b7(){try{logger[_0x984b('0x6')](_0x984b('0xd'));var _0x399fb5=moment()[_0x984b('0xe')]();var _0x5caa9e=_0x38e6e0(_0x399fb5+_0x4b22a5+_0x5052c1);_0x5ac151[_0x984b('0xf')](JSON['stringify']({'appID':_0x4b22a5,'timestamp':_0x399fb5,'appKey':_0x5caa9e}));var _0x43d1cd=fs[_0x984b('0x10')](_0x36234b);_0x43d1cd['on']('data',function(_0x54b483){_0x5ac151[_0x984b('0xf')](_0x54b483);});_0x43d1cd['on'](_0x984b('0x11'),function(){_0x5ac151[_0x984b('0xf')](_0x984b('0x12'));});}catch(_0x2d57b5){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x984b('0x13')](_0x2d57b5));_0x5ac151[_0x984b('0x14')]();}}function _0x50a3e7(_0x2a5436){try{if(_0x2a5436){var _0x558518=JSON[_0x984b('0x15')](_0x2a5436);switch(_0x558518[_0x984b('0x16')]){case 0x0:if(_0x558518[_0x984b('0x17')]){if(_0x558518['result']['final']){logger[_0x984b('0x6')](_0x984b('0x18'),JSON['stringify'](_0x558518[_0x984b('0x17')]['hypotheses']));_0x1692fc=_0x558518[_0x984b('0x17')][_0x984b('0x19')][0x0]['transcript'];_0x2761c9=_0x558518[_0x984b('0x17')][_0x984b('0x19')][0x0][_0x984b('0x1a')];_0x54973d='0';_0x2168c4=_0x984b('0x1b');_0x5ac151['terminate']();}}break;case 0x1:logger[_0x984b('0x6')](_0x984b('0x1c'));_0x54973d='1';_0x2168c4='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x984b('0x6')](_0x984b('0x1d'));_0x54973d='2';_0x2168c4=_0x984b('0x1d');break;case 0x9:logger[_0x984b('0x6')](_0x984b('0x1e'));_0x54973d='9';_0x2168c4=_0x984b('0x1e');break;case 0xa:logger[_0x984b('0x6')](_0x984b('0x1f'));_0x54973d='10';_0x2168c4=_0x984b('0x1f');break;case 0xb:logger[_0x984b('0x6')](_0x984b('0x20'));_0x54973d='11';_0x2168c4='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x22726d){logger['error'](_0x984b('0x21'),JSON[_0x984b('0x13')](_0x22726d));_0x5ac151[_0x984b('0x14')]();}}function _0x22e303(){logger['info'](_0x984b('0x22'));_0x402ba9({'transcript':_0x1692fc,'confidence':_0x2761c9,'status':_0x54973d,'status_message':_0x2168c4});}function _0x41a562(_0x5e2fae){logger[_0x984b('0x23')](_0x984b('0x24'));if(!_['isNil'](_0x5e2fae)){logger['error'](_['isObject'](_0x5e2fae)?JSON[_0x984b('0x13')](_0x5e2fae):_0x5e2fae);}}_0x5ac151['on'](_0x984b('0x25'),_0x2c05b7);_0x5ac151['on'](_0x984b('0x26'),_0x50a3e7);_0x5ac151['on'](_0x984b('0x11'),_0x22e303);_0x5ac151['on']('error',_0x41a562);});}; \ 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 71c673b..0d304b3 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 _0xd840=['exports','./asr'];(function(_0x2f1299,_0xd3621f){var _0x3f4808=function(_0x55509d){while(--_0x55509d){_0x2f1299['push'](_0x2f1299['shift']());}};_0x3f4808(++_0xd3621f);}(_0xd840,0xf9));var _0x0d84=function(_0x3a20f3,_0x5744a6){_0x3a20f3=_0x3a20f3-0x0;var _0x1cde81=_0xd840[_0x3a20f3];return _0x1cde81;};var asr=require(_0x0d84('0x0'));module[_0x0d84('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb219=['./asr','exports'];(function(_0x177e8b,_0x461d9f){var _0x43cff0=function(_0x59ffe0){while(--_0x59ffe0){_0x177e8b['push'](_0x177e8b['shift']());}};_0x43cff0(++_0x461d9f);}(_0xb219,0xb0));var _0x9b21=function(_0xac6f9b,_0x5f5138){_0xac6f9b=_0xac6f9b-0x0;var _0x288e1a=_0xb219[_0xac6f9b];return _0x288e1a;};var asr=require(_0x9b21('0x0'));module[_0x9b21('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 54ee94d..1387840 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0xe706,0xa3));var _0x6e70=function(_0xcad01d,_0xef9abc){_0xcad01d=_0xcad01d-0x0;var _0x76a4a6=_0xe706[_0xcad01d];return _0x76a4a6;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ 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(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 354c729..00e27f9 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 _0xe5b3=['format','%s.%s','length','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_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','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','agentPause','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agent','agentUnpause','error','agentLogout','agentLogin','internal','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult'];(function(_0x307c17,_0x3dc276){var _0x10e1c7=function(_0x13c3bf){while(--_0x13c3bf){_0x307c17['push'](_0x307c17['shift']());}};_0x10e1c7(++_0x3dc276);}(_0xe5b3,0x133));var _0x3e5b=function(_0x256457,_0x4003dd){_0x256457=_0x256457-0x0;var _0x2fd2f2=_0xe5b3[_0x256457];return _0x2fd2f2;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x3e5b('0x0'));var sh=require(_0x3e5b('0x1'));var odbc=require(_0x3e5b('0x2'))();var rs=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var Mustache=require(_0x3e5b('0x5'));var rp=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var scripts=require(_0x3e5b('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x3e5b('0xb'),_0x3e5b('0xc')];var verticesWithRetry=['menu',_0x3e5b('0xd'),_0x3e5b('0xe')];var AGIVertices=function(_0x3c7c2e,_0x113d38,_0x5282fd){this['channel']=_0x3c7c2e;this[_0x3e5b('0xf')]=_0x113d38;this[_0x3e5b('0x10')]=_0x5282fd;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x12')]=function(_0xeeaabc,_0x522e9e){this[_0x3e5b('0xf')]['getVariableById'](_0xeeaabc)[_0x3e5b('0x13')](function(_0x382273){_0x522e9e(null,_0x382273?_0x382273[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x20b97b){_0x522e9e(_0x20b97b);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x16')]=function(_0x560010,_0x39a2a1){this['rpc']['getVoiceQueueById'](_0x560010)['then'](function(_0x3754e3){_0x39a2a1(null,_0x3754e3?_0x3754e3[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x4fb471){_0x39a2a1(_0x4fb471);});};AGIVertices[_0x3e5b('0x11')]['getSquareProject']=function(_0x56a453,_0x258d6a){this[_0x3e5b('0xf')]['getSquareProjectById'](_0x56a453)[_0x3e5b('0x13')](function(_0x143040){_0x258d6a(null,_0x143040?_0x143040['name']:![]);})[_0x3e5b('0x15')](function(_0x3365dd){_0x258d6a(_0x3365dd);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x144fa7,_0x20806a){this[_0x3e5b('0xf')][_0x3e5b('0x17')](_0x144fa7)[_0x3e5b('0x13')](function(_0x1564b5){_0x20806a(null,_0x1564b5?_0x1564b5[_0x3e5b('0x18')]:![]);})[_0x3e5b('0x15')](function(_0x36c988){_0x20806a(_0x36c988);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x19')]=function(_0x11e5cf,_0x2d77cc){this[_0x3e5b('0xf')]['getUserById'](_0x11e5cf)[_0x3e5b('0x13')](function(_0x86f19c){_0x2d77cc(null,_0x86f19c?_0x86f19c[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x50039b){_0x2d77cc(_0x50039b);});};AGIVertices[_0x3e5b('0x11')]['getTrunk']=function(_0x2f9e42,_0x36d960){this['rpc'][_0x3e5b('0x1a')](_0x2f9e42)[_0x3e5b('0x13')](function(_0x42d7e9){_0x36d960(null,_0x42d7e9?_0x42d7e9[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x26c7f2){_0x36d960(_0x26c7f2);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b')]=function(_0x4c4b89,_0x1c7278){var _0x505f40=this;this[_0x3e5b('0xf')]['getSoundById'](_0x4c4b89)[_0x3e5b('0x13')](function(_0x1f6473){_0x1c7278(null,_0x1f6473?_0x505f40[_0x3e5b('0x1c')](_0x1f6473[_0x3e5b('0x1d')]):![]);})[_0x3e5b('0x15')](function(_0x3cfaf6){_0x1c7278(_0x3cfaf6);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1e')]=function(_0x221718,_0x112dc0){this[_0x3e5b('0xf')]['getMailAccountById'](_0x221718)[_0x3e5b('0x13')](function(_0x1882aa){_0x112dc0(null,_0x1882aa?_0x1882aa:![]);})[_0x3e5b('0x15')](function(_0x2a14eb){_0x112dc0(_0x2a14eb);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1f')]=function(_0x345927,_0x4c4e01,_0x33f089){this['mailRpc']['sendMailMessage'](_0x345927,_0x4c4e01)[_0x3e5b('0x13')](function(){_0x33f089(null);})[_0x3e5b('0x15')](function(_0x51ea0d){_0x33f089(_0x51ea0d);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x20')]=function(_0x9d01c4,_0x33e356){this[_0x3e5b('0xf')][_0x3e5b('0x21')](_0x9d01c4)[_0x3e5b('0x13')](function(_0x26c9ab){if(_0x26c9ab){if(_0x26c9ab[_0x3e5b('0x22')]){_0x33e356(null,[_0x26c9ab[_0x3e5b('0x23')]]);}else{_0x33e356(null,_[_0x3e5b('0x24')](_0x26c9ab[_0x3e5b('0x25')],'interval'));}}else{_0x33e356(null,![]);}})[_0x3e5b('0x15')](function(_0xec45c5){_0x33e356(_0xec45c5);});};AGIVertices['prototype']['getSoundPath']=function(_0x471196){return util['format'](_0x3e5b('0x26'),FILES_PATH,_0x471196);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x27')]=function(_0x32594a,_0x5389e3,_0x18b07f){odbc['open'](_0x32594a,function(_0x42b970){if(_0x42b970){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x42b970);_0x18b07f(_0x42b970);}else{logger['info'](_0x3e5b('0x28'));odbc[_0x3e5b('0x29')](_0x5389e3,function(_0x2eaa30,_0x35cfcd){if(_0x2eaa30){logger[_0x3e5b('0x2a')](_0x3e5b('0x2b'),_0x5389e3);_0x18b07f(_0x2eaa30);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5389e3);odbc['close'](function(_0x565319){if(_0x565319){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x565319);}_0x18b07f(null,_0x35cfcd);});}});}});};AGIVertices['prototype'][_0x3e5b('0x2c')]=function(_0x349de0,_0x13a48d){this[_0x3e5b('0xf')][_0x3e5b('0x2d')](_0x349de0)[_0x3e5b('0x13')](function(_0x2c56bc){_0x13a48d(null,_0x2c56bc?_0x2c56bc:![]);})[_0x3e5b('0x15')](function(_0x222d0f){_0x13a48d(_0x222d0f);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x2e')]=function(_0x4ee160,_0x28362c){this[_0x3e5b('0xf')][_0x3e5b('0x2e')](_0x4ee160)[_0x3e5b('0x13')](function(_0xa262e0){_0x28362c(null,_0xa262e0);})[_0x3e5b('0x15')](function(_0x2253f2){_0x28362c(_0x2253f2);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x2f')]=function(_0x39da3f,_0x13c8d5,_0x559056){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0x3e5b('0x30')],'node':_0x39da3f[_0x3e5b('0x31')],'application':_0x39da3f[_0x3e5b('0x32')],'data':_0x13c8d5||null,'project_name':this[_0x3e5b('0x33')][_0x3e5b('0x34')],'callerid':this[_0x3e5b('0x33')][_0x3e5b('0x35')]})[_0x3e5b('0x13')](function(_0x40ae05){if(_0x559056){_0x559056(null,_0x40ae05);}})[_0x3e5b('0x15')](function(_0x5d318a){if(_0x559056){_0x559056(_0x5d318a);}});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x36')]=function(_0x28f92a,_0x22d495,_0xd5d8b8,_0x4f0c2c){this['rpc']['createSquareRecording']({'uniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'callerid':this[_0x3e5b('0x33')]['callerid'],'calleridname':this['channel'][_0x3e5b('0x37')],'context':this[_0x3e5b('0x33')][_0x3e5b('0x38')],'extension':this['channel']['extension'],'priority':this[_0x3e5b('0x33')]['priority'],'accountcode':this[_0x3e5b('0x33')][_0x3e5b('0x39')],'dnid':this[_0x3e5b('0x33')][_0x3e5b('0x3a')],'projectName':this[_0x3e5b('0x33')][_0x3e5b('0x34')],'saveName':_0x22d495,'filename':_0x28f92a[_0x3e5b('0x3b')]||_0x22d495,'savePath':_0xd5d8b8})[_0x3e5b('0x13')](function(_0x339852){_0x4f0c2c(null,_0x339852);})['catch'](function(_0x223185){_0x4f0c2c(_0x223185);});};AGIVertices['prototype'][_0x3e5b('0x3c')]=function(_0x2e7047,_0x26e11e,_0x3d51fa,_0x291e4d,_0x3a4f26){this[_0x3e5b('0xf')][_0x3e5b('0x3c')]({'uniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'body':_0x2e7047,'direction':_0x26e11e,'providerName':_0x3d51fa,'providerResponse':_0x291e4d})[_0x3e5b('0x13')](function(_0x18ba31){if(_0x3a4f26){_0x3a4f26(null,_0x18ba31);}})[_0x3e5b('0x15')](function(_0x59d311){if(_0x3a4f26){_0x3a4f26(_0x59d311);}});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x3d')]=function(_0x2ca33b,_0xfd37fb){this[_0x3e5b('0xf')][_0x3e5b('0x3d')]({'firstName':_['isEmpty'](_0x2ca33b[_0x3e5b('0x14')])||_[_0x3e5b('0x3e')](_0x2ca33b[_0x3e5b('0x14')])?_0x3e5b('0x3f')+Math[_0x3e5b('0x40')]():_0x2ca33b[_0x3e5b('0x14')],'lastName':_[_0x3e5b('0x41')](_0x2ca33b[_0x3e5b('0x42')])||_['isNil'](_0x2ca33b[_0x3e5b('0x42')])?null:_0x2ca33b['lastName'],'phone':_0x2ca33b['phone'],'ListId':_0x2ca33b[_0x3e5b('0x43')],'scheduledat':_0x2ca33b['scheduledAt'],'callbackUniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'tags':_0x3e5b('0x44'),'description':_0x3e5b('0x45')+_0x2ca33b['scheduledAt']['toString'](),'priority':_0x2ca33b['callback_priority']})['then'](function(_0x2ab5f3){_0xfd37fb(null,_0x2ab5f3);})[_0x3e5b('0x15')](function(_0x1ea02a){_0xfd37fb(_0x1ea02a);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x46')]=function(_0x5b4c6c,_0x5ac379){this[_0x3e5b('0xf')][_0x3e5b('0x47')](_0x5b4c6c)[_0x3e5b('0x13')](function(_0x325f7b){_0x5ac379(null,_0x325f7b?_0x325f7b[_0x3e5b('0x14')]:![]);})['catch'](function(_0x4f7337){_0x5ac379(_0x4f7337);});};AGIVertices['prototype']['agentPause']=function(_0x3563b0,_0x3e3115,_0x3088d4){var _0x80b4={'role':_0x3e5b('0x48')};_0x80b4[_0x3563b0]=this[_0x3e5b('0x33')][_0x3e5b('0x35')];this[_0x3e5b('0xf')]['agentPause'](_0x80b4,_0x3e3115,this[_0x3e5b('0x33')][_0x3e5b('0x30')])[_0x3e5b('0x13')](function(_0x3e784a){_0x3088d4(null,_[_0x3e5b('0x3e')](_0x3e784a)?![]:!![]);})['catch'](function(_0xd45159){logger['error'](_0xd45159);_0x3088d4(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x49')]=function(_0x58c41e,_0x4a7d8e){var _0x570303={'role':_0x3e5b('0x48')};_0x570303[_0x58c41e]=this['channel'][_0x3e5b('0x35')];this[_0x3e5b('0xf')][_0x3e5b('0x49')](_0x570303)[_0x3e5b('0x13')](function(_0x14f187){_0x4a7d8e(null,_['isNil'](_0x14f187)?![]:!![]);})['catch'](function(_0x226f61){logger[_0x3e5b('0x4a')](_0x226f61);_0x4a7d8e(null,![]);});};AGIVertices[_0x3e5b('0x11')]['agentLogout']=function(_0x8fb7a1,_0x3c5293){var _0x32a42f={'role':_0x3e5b('0x48')};_0x32a42f[_0x8fb7a1]=this[_0x3e5b('0x33')][_0x3e5b('0x35')];this[_0x3e5b('0xf')][_0x3e5b('0x4b')](_0x32a42f)[_0x3e5b('0x13')](function(_0x52e98f){_0x3c5293(null,_[_0x3e5b('0x3e')](_0x52e98f)?![]:!![]);})[_0x3e5b('0x15')](function(_0x33bbb8){logger[_0x3e5b('0x4a')](_0x33bbb8);_0x3c5293(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x4c')]=function(_0x39f1f2,_0x32d3df){var _0x4d2234={'role':_0x3e5b('0x48')};_0x4d2234[_0x39f1f2]=this[_0x3e5b('0x33')]['callerid'];var _0x177144=_0x39f1f2!=_0x3e5b('0x4d')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x3e5b('0x33')][_0x3e5b('0x35')]):undefined;this['rpc'][_0x3e5b('0x4c')](_0x4d2234,_0x177144)[_0x3e5b('0x13')](function(_0x47b810){_0x32d3df(null,_[_0x3e5b('0x3e')](_0x47b810)?![]:!![]);})[_0x3e5b('0x15')](function(_0x43f28f){logger[_0x3e5b('0x4a')](_0x43f28f);_0x32d3df(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x4e')]=function(_0x5891fe,_0x410c7a){sh[_0x3e5b('0x4f')](_['trim'](_0x5891fe),function(_0x310238,_0x3aad97){var _0x2d5685=_0x3aad97[_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'');_0x410c7a(null,_0x2d5685);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x51')]=function(_0x12c93d,_0x4efdbe){scripts['googleCloudTTS'](_0x12c93d[_0x3e5b('0x52')],_0x12c93d[_0x3e5b('0x53')]||'text',_0x12c93d[_0x3e5b('0x54')],_0x12c93d[_0x3e5b('0x55')]||_0x3e5b('0x56'),_0x12c93d[_0x3e5b('0x57')]||_0x3e5b('0x58'),_0x12c93d[_0x3e5b('0x59')]||_0x3e5b('0x5a'))['then'](function(_0x27dd0f){_0x4efdbe(null,_0x27dd0f);})[_0x3e5b('0x15')](function(_0x4a179f){_0x4efdbe(_0x4a179f);});};AGIVertices['prototype']['googleTTS']=function(_0x8d164e,_0x141393){scripts[_0x3e5b('0x5b')](_0x8d164e[_0x3e5b('0x54')],_0x8d164e[_0x3e5b('0x5c')]||'en',0x1)[_0x3e5b('0x13')](function(_0x53e05d){_0x141393(null,_0x53e05d);})[_0x3e5b('0x15')](function(_0x48e1c){_0x141393(_0x48e1c);});};AGIVertices['prototype'][_0x3e5b('0x5d')]=function(_0x4da39d,_0x4f62fb){var _0x211e73={'uri':_0x4da39d[_0x3e5b('0x5e')],'method':_0x4da39d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4da39d[_0x3e5b('0x5f')])===_0x3e5b('0x60')&&parseInt(_0x4da39d['timeout'])>=0x1?parseInt(_0x4da39d[_0x3e5b('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x3e5b('0x61')]([_0x3e5b('0x62'),_0x3e5b('0x63')],_0x211e73[_0x3e5b('0x64')][_0x3e5b('0x65')]())){try{_0x211e73['body']=_0x4da39d['rawBody']?JSON[_0x3e5b('0x66')](_0x4da39d['rawBody']):{};}catch(_0x568890){logger[_0x3e5b('0x4a')](_0x3e5b('0x67'),_0x568890);}}try{_0x211e73[_0x3e5b('0x68')]=_0x4da39d['rawHeaders']?JSON[_0x3e5b('0x66')](_0x4da39d['rawHeaders']):{};}catch(_0x13c806){logger['error'](_0x3e5b('0x69'),_0x13c806);}if(_0x4da39d[_0x3e5b('0x6a')]){try{var _0x14941b=require(_0x4da39d[_0x3e5b('0x6a')])['sync'](this,_0x211e73);_0x211e73[_0x3e5b('0x6b')]=Mustache['render'](_0x4da39d[_0x3e5b('0x5e')],_0x14941b,{},['$$','$$']);if(_0x211e73[_0x3e5b('0x68')]){_0x211e73['headers']=JSON[_0x3e5b('0x66')](Mustache[_0x3e5b('0x6c')](JSON[_0x3e5b('0x6d')](_0x211e73['headers']),_0x14941b,{},['$$','$$']));}if(_0x211e73[_0x3e5b('0x6e')]){_0x211e73[_0x3e5b('0x6e')]=JSON[_0x3e5b('0x66')](Mustache['render'](JSON[_0x3e5b('0x6d')](_0x211e73[_0x3e5b('0x6e')]),_0x14941b,{},['$$','$$']));}}catch(_0x4b9774){logger[_0x3e5b('0x4a')](_0x3e5b('0x6f'),_0x4b9774);}}rp(_0x211e73)[_0x3e5b('0x13')](function(_0x5b2014){var _0x3b3306={'statusCode':_0x5b2014[_0x3e5b('0x70')]||0xc8,'statusMessage':_0x5b2014[_0x3e5b('0x71')]||'OK','headers':_0x5b2014[_0x3e5b('0x68')]||{},'body':_0x5b2014['body']||{}};_0x4f62fb(null,_0x3b3306);})[_0x3e5b('0x15')](function(_0x5683de){var _0xbe6415={'statusCode':_0x5683de['statusCode']||0x1f4,'statusMessage':_0x5683de[_0x3e5b('0x72')]||_0x3e5b('0x73'),'headers':_0x5683de['options'][_0x3e5b('0x68')]||{},'body':_0x5683de[_0x3e5b('0x74')]['body']||{}};_0x4f62fb(null,_0xbe6415);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x75')]=function(_0x2907dd,_0x46ce2b){scripts['googleDialogflow'](this['channel'][_0x3e5b('0x30')],_0x2907dd[_0x3e5b('0x76')],_0x2907dd[_0x3e5b('0x54')],_0x2907dd[_0x3e5b('0x77')]||'en')[_0x3e5b('0x13')](function(_0x3d1193){_0x46ce2b(null,_0x3d1193);})['catch'](function(_0x5d6aae){_0x46ce2b(_0x5d6aae);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x78')]=function(_0x902bb8,_0x25dec7){scripts[_0x3e5b('0x78')](this[_0x3e5b('0x33')][_0x3e5b('0x30')],_0x902bb8[_0x3e5b('0x79')],_0x902bb8['client_email'],_0x902bb8['private_key'],_0x902bb8[_0x3e5b('0x54')],_0x902bb8['dialogflowV2_language']||'en')[_0x3e5b('0x13')](function(_0x44300d){_0x25dec7(null,_0x44300d);})[_0x3e5b('0x15')](function(_0x27fa74){_0x25dec7(_0x27fa74);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x7a')]=function(_0x150bdf,_0x350bd7){scripts[_0x3e5b('0x7a')](this[_0x3e5b('0x33')],_0x150bdf)[_0x3e5b('0x13')](function(_0x199fa4){_0x350bd7(null,_0x199fa4);})[_0x3e5b('0x15')](function(_0x4b025f){_0x350bd7(_0x4b025f);});};AGIVertices['prototype'][_0x3e5b('0x7b')]=function(_0x3602da,_0x3ceb03){scripts[_0x3e5b('0x7b')](_0x3602da['key'],_0x3602da[_0x3e5b('0x54')],_0x3602da['ispeech_tts_language']||_0x3e5b('0x56'),_0x3602da['speed'])[_0x3e5b('0x13')](function(_0x3f28cc){_0x3ceb03(null,_0x3f28cc);})[_0x3e5b('0x15')](function(_0x5bc994){_0x3ceb03(_0x5bc994);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x7c')]=function(_0xd93aed,_0x17242b,_0x94e765){scripts['ispeechASR'](_0x17242b,_0xd93aed[_0x3e5b('0x76')],_0xd93aed[_0x3e5b('0x7d')]||'en-US',this[_0x3e5b('0x7e')](_0xd93aed[_0x3e5b('0x7f')])?_0xd93aed[_0x3e5b('0x7f')]:undefined)[_0x3e5b('0x13')](function(_0x41de83){_0x94e765(null,_0x41de83);})[_0x3e5b('0x15')](function(_0x441890){_0x94e765(_0x441890);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x80')]=function(_0x40306d,_0x107e07){scripts[_0x3e5b('0x80')](_0x40306d['aws_access_key_id'],_0x40306d[_0x3e5b('0x81')],_0x40306d[_0x3e5b('0x82')],_0x40306d['aws_polly_voice']||'Amy',_0x40306d[_0x3e5b('0x54')],_0x40306d[_0x3e5b('0x83')]||_0x3e5b('0x54'))[_0x3e5b('0x13')](function(_0x280e43){_0x107e07(null,_0x280e43);})['catch'](function(_0xc78d12){_0x107e07(_0xc78d12);});};AGIVertices[_0x3e5b('0x11')]['awsLex']=function(_0x53913d,_0x310429){scripts[_0x3e5b('0x84')](this['channel']['uniqueid'],_0x53913d[_0x3e5b('0x85')],_0x53913d[_0x3e5b('0x81')],_0x53913d['aws_lex_region'],_0x53913d[_0x3e5b('0x54')],_0x53913d[_0x3e5b('0x86')])[_0x3e5b('0x13')](function(_0x19cbd7){_0x310429(null,_0x19cbd7);})[_0x3e5b('0x15')](function(_0x580c82){_0x310429(_0x580c82);});};AGIVertices['prototype'][_0x3e5b('0x87')]=function(_0x39dc3c,_0x253dfa,_0x34ea6b){scripts[_0x3e5b('0x87')](_0x253dfa,_0x39dc3c[_0x3e5b('0x76')],_0x39dc3c[_0x3e5b('0x88')]||_0x3e5b('0x56'))[_0x3e5b('0x13')](function(_0x1cdc38){_0x34ea6b(null,_0x1cdc38);})[_0x3e5b('0x15')](function(_0x8efc1b){_0x34ea6b(_0x8efc1b);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x89')]=function(_0x1aab9a,_0x3ca1fb,_0x34edb6){scripts[_0x3e5b('0x89')](_0x3ca1fb,_0x1aab9a[_0x3e5b('0x8a')],_0x1aab9a[_0x3e5b('0x8b')],_0x1aab9a[_0x3e5b('0x6b')])[_0x3e5b('0x13')](function(_0x2464f3){_0x34edb6(null,_0x2464f3);})[_0x3e5b('0x15')](function(_0x408070){_0x34edb6(_0x408070);});};AGIVertices['prototype']['clear']=function(_0x2c1efd){var _0x15577d=_[_0x3e5b('0x61')](verticesWithRetry,_0x2c1efd[_0x3e5b('0x32')])?_0x2c1efd:_['clone'](_0x2c1efd);for(var _0x17a736 in _0x15577d){if(_0x15577d['hasOwnProperty'](_0x17a736)){if(_0x15577d[_0x17a736]&&_[_0x3e5b('0x8c')](_0x15577d[_0x17a736])){if(_[_0x3e5b('0x61')](recursiveMapAttributes,_0x17a736)){_0x15577d[_0x17a736]=this[_0x3e5b('0x8d')](_0x15577d[_0x17a736]);}else{_0x15577d[_0x17a736]=this[_0x3e5b('0x8e')](_0x15577d[_0x17a736]);}}}}return _0x15577d;};AGIVertices[_0x3e5b('0x11')]['recursiveNodeIndex']=function(_0x1795a0){for(var _0x64fbf9 in _0x1795a0){if(_0x1795a0[_0x3e5b('0x8f')](_0x64fbf9)){if(_[_0x3e5b('0x90')](_0x1795a0[_0x64fbf9])){this[_0x3e5b('0x91')](_0x1795a0[_0x64fbf9]);}else if(_[_0x3e5b('0x92')](_0x1795a0[_0x64fbf9])){for(var _0x5db7b6=0x0;_0x5db7b6<_0x1795a0[_0x64fbf9]['length'];_0x5db7b6++){this[_0x3e5b('0x91')](_0x1795a0[_0x64fbf9][_0x5db7b6]);}}else if(_['isString'](_0x1795a0[_0x64fbf9])){_0x1795a0[_0x64fbf9]=this[_0x3e5b('0x8e')](_0x1795a0[_0x64fbf9]);}}}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x93')]=function(_0x28d461,_0x574fb3){for(var _0x5e789a in _0x28d461){if(_0x28d461[_0x3e5b('0x8f')](_0x5e789a)){if(_[_0x3e5b('0x90')](_0x28d461[_0x5e789a])){if(!_[_0x3e5b('0x41')](_0x28d461[_0x5e789a])){this[_0x3e5b('0x93')](_0x28d461[_0x5e789a],util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a));}}else if(_['isArray'](_0x28d461[_0x5e789a])){for(var _0x4c6d02=0x0;_0x4c6d02<_0x28d461[_0x5e789a][_0x3e5b('0x96')];_0x4c6d02++){this[_0x3e5b('0x93')](_0x28d461[_0x5e789a][_0x4c6d02],util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a+'['+_0x4c6d02+']'));}}else{if(!_[_0x3e5b('0x3e')](_0x28d461[_0x5e789a])){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a),_0x28d461[_0x5e789a]);}}}}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8d')]=function(_0x3e0f6f){try{var _0x283452=JSON[_0x3e5b('0x66')](_0x3e0f6f);this[_0x3e5b('0x91')](_0x283452);return JSON['stringify'](_0x283452);}catch(_0x3d381b){return this[_0x3e5b('0x8e')](_0x3e0f6f);}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8e')]=function(_0x19e016){var _0x3c509d=_0x19e016[_0x3e5b('0x98')]('{');for(var _0x5456f6=0x1;_0x5456f6<_0x3c509d[_0x3e5b('0x96')];_0x5456f6+=0x1){var _0x3be9d4=_0x3c509d[_0x5456f6][_0x3e5b('0x98')]('}');if(_0x3be9d4[_0x3e5b('0x96')]>0x1){_0x19e016=_0x19e016['replaceAll']('{'+_0x3be9d4[0x0]+'}',this[_0x3e5b('0x33')][_0x3e5b('0x12')](_0x3be9d4[0x0])[_0x3e5b('0x99')]||_0x3be9d4[0x0]);}}if(_0x3c509d[_0x3e5b('0x96')]===0x1){return _0x19e016[_0x3e5b('0x9a')]();}return this[_0x3e5b('0x8e')](_0x19e016);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x9b')]=function(_0x276caa,_0x5a988d){var _0x163c14=this[_0x3e5b('0x33')]['getVariable'](_0x276caa);if(_0x163c14[_0x3e5b('0x9c')]===-0x1){return _0x163c14;}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x9d'),_0x5a988d,_0x163c14[_0x3e5b('0x99')]));return this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0x5a988d,_0x163c14[_0x3e5b('0x99')]);};AGIVertices[_0x3e5b('0x11')]['isConfigured']=function(_0x5df21b){return _0x5df21b&&_0x5df21b!=='0'&&_0x5df21b!=='-1'&&_0x5df21b!=='';};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x9e')]=function(_0x229221){this['createSquareDetailsReport'][_0x3e5b('0x9f')](this,_0x229221,'-');_0x229221[_0x3e5b('0xa0')]=_0x229221['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xa1')]=function(_0x3e6f62){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xa2'),_0x3e6f62[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3e6f62[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0xa3'));}var _0x482dd1='\x22'+_0x3e6f62[_0x3e5b('0x54')]+'\x22';if(this[_0x3e5b('0x7e')](_0x3e6f62[_0x3e5b('0x74')])){_0x482dd1+=','+_0x3e6f62[_0x3e5b('0x74')];}var _0x272aab=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0xa4'),_0x482dd1);if(_0x272aab[_0x3e5b('0x9c')]===-0x1){return _0x272aab;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x482dd1));};AGIVertices['prototype'][_0x3e5b('0xa7')]=function(_0x36e032){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0xa8'),_0x36e032['label']));if(!this['isConfigured'](_0x36e032['grammar'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x54bf44=_0x36e032['grammar'];if(this[_0x3e5b('0x7e')](_0x36e032[_0x3e5b('0x74')])){_0x54bf44+=','+_0x36e032['options'];}var _0x513be2=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x54bf44);if(_0x513be2[_0x3e5b('0x9c')]===-0x1){return _0x513be2;}var _0x21a068=this['getAndSetVariable'](_0x3e5b('0xab'),_0x3e5b('0xac'));if(_0x21a068[_0x3e5b('0x9c')]===-0x1){return _0x21a068;}var _0x5c7523=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),_0x3e5b('0xae'));if(_0x5c7523['result']===-0x1){return _0x5c7523;}var _0x4ecbeb=this[_0x3e5b('0x9b')](_0x3e5b('0xaf'),_0x3e5b('0xb0'));if(_0x4ecbeb[_0x3e5b('0x9c')]===-0x1){return _0x4ecbeb;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x54bf44));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8')]=function(_0x31d5c2){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xb2'),_0x31d5c2[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['agi']([_0x31d5c2[_0x3e5b('0xb3')],_0x31d5c2[_0x3e5b('0xb4')]]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xb5')]=function(_0x44b54b){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x44b54b['label']));if(this['isConfigured'](_0x44b54b[_0x3e5b('0x5f')])){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x44b54b[_0x3e5b('0x5f')]));var _0x5548d3=this['channel'][_0x3e5b('0xb6')](_0x44b54b[_0x3e5b('0x5f')]);if(_0x5548d3['result']===-0x1){return _0x5548d3;}}return this[_0x3e5b('0x33')]['answer']();};AGIVertices[_0x3e5b('0x11')]['callback']=function(_0x3c41fa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xb7'),_0x3c41fa['label']));if(!this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0x43')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3c41fa,_0x3e5b('0xb8'));}_0x3c41fa['scheduledAt']=moment();if(this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0xb9')])){_0x3c41fa['scheduledAt']=moment()[_0x3e5b('0xba')](_0x3c41fa['delay'],_0x3e5b('0xbb'));}if(!this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0xbc')])){_0x3c41fa['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x3c41fa);return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xbd'),_0x3c41fa[_0x3e5b('0xbe')],_0x3c41fa['list_id'],_0x3c41fa['scheduledAt']));};AGIVertices['prototype'][_0x3e5b('0xbf')]=function(_0x1575f3){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xc0'),_0x1575f3[_0x3e5b('0x31')]));var _0x25a910=this['channel'][_0x3e5b('0x4f')](_0x1575f3['application'],_0x1575f3[_0x3e5b('0x74')]);if(_0x25a910['result']===-0x1){return _0x25a910;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x1575f3[_0x3e5b('0xc2')],_0x1575f3[_0x3e5b('0x74')]));};AGIVertices[_0x3e5b('0x11')]['lumenvoxtts']=function(_0x400e7e){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x400e7e[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x400e7e[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}var _0x7e7710='\x22'+_0x400e7e[_0x3e5b('0x54')]+'\x22';if(this[_0x3e5b('0x7e')](_0x400e7e['options'])){_0x7e7710+=','+_0x400e7e['options'];}var _0x196090=this[_0x3e5b('0x33')][_0x3e5b('0x4f')]('MRCPSynth',_0x7e7710);if(_0x196090['result']===-0x1){return _0x196090;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x7e7710));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xc3')]=function(_0x1f5247){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xc4'),_0x1f5247[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x1f5247[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0xa3'));}var _0x1d273f='\x22'+_0x1f5247['text']+'\x22';if(this[_0x3e5b('0x7e')](_0x1f5247[_0x3e5b('0x74')])){_0x1d273f+=','+_0x1f5247['options'];}var _0x29d3aa=this['channel'][_0x3e5b('0x4f')]('MRCPSynth',_0x1d273f);if(_0x29d3aa[_0x3e5b('0x9c')]===-0x1){return _0x29d3aa;}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x1d273f));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xc5')]=function(_0x244eb2){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xc6'),_0x244eb2[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x244eb2[_0x3e5b('0xc7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x2cd43a=_0x244eb2[_0x3e5b('0xc7')];if(this[_0x3e5b('0x7e')](_0x244eb2[_0x3e5b('0x74')])){_0x2cd43a+=','+_0x244eb2[_0x3e5b('0x74')];}var _0x34d587=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x2cd43a);if(_0x34d587[_0x3e5b('0x9c')]===-0x1){return _0x34d587;}var _0x3cb9a2=this[_0x3e5b('0x9b')](_0x3e5b('0xab'),_0x3e5b('0xc8'));if(_0x3cb9a2[_0x3e5b('0x9c')]===-0x1){return _0x3cb9a2;}var _0x37f16b=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x37f16b['result']===-0x1){return _0x37f16b;}var _0x55a6eb=this[_0x3e5b('0x9b')](_0x3e5b('0xaf'),_0x3e5b('0xc9'));if(_0x55a6eb[_0x3e5b('0x9c')]===-0x1){return _0x55a6eb;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x2cd43a));};AGIVertices['prototype'][_0x3e5b('0xca')]=function(_0x2d0419){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xcb'),_0x2d0419[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2d0419[_0x3e5b('0xc7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x38130d=_0x2d0419[_0x3e5b('0xc7')];if(this[_0x3e5b('0x7e')](_0x2d0419['options'])){_0x38130d+=','+_0x2d0419[_0x3e5b('0x74')];}var _0x42b8dc=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x38130d);if(_0x42b8dc[_0x3e5b('0x9c')]===-0x1){return _0x42b8dc;}var _0x3130cc=this['getAndSetVariable'](_0x3e5b('0xab'),_0x3e5b('0xcc'));if(_0x3130cc['result']===-0x1){return _0x3130cc;}var _0x479e5f=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),_0x3e5b('0xcd'));if(_0x479e5f[_0x3e5b('0x9c')]===-0x1){return _0x479e5f;}var _0x44786f=this['getAndSetVariable'](_0x3e5b('0xaf'),_0x3e5b('0xce'));if(_0x44786f[_0x3e5b('0x9c')]===-0x1){return _0x44786f;}return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x38130d));};AGIVertices[_0x3e5b('0x11')]['database']=function(_0x3d5e39){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xcf'),_0x3d5e39[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3d5e39[_0x3e5b('0xd0')])){return this[_0x3e5b('0x33')]['error'](_0x3d5e39,_0x3e5b('0xd1'));}var _0x2ea32e=this[_0x3e5b('0xd2')]['sync'](this,_0x3d5e39[_0x3e5b('0xd0')]);if(!_0x2ea32e){return this[_0x3e5b('0x33')]['error'](_0x3d5e39,'no\x20odbc\x20database\x20found');}if(!this[_0x3e5b('0x7e')](_0x3d5e39[_0x3e5b('0x29')])){return this['channel'][_0x3e5b('0x4a')](_0x3d5e39,'no\x20query\x20configured');}var _0x5b07ce=_0x3d5e39['query'][_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('query:\x20%s',_0x5b07ce));var _0x596968=this[_0x3e5b('0x27')][_0x3e5b('0x9f')](this,_0x2ea32e,_0x5b07ce);this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x3d5e39,_0x5b07ce);if(!this['isConfigured'](_0x3d5e39[_0x3e5b('0xd3')])){return this['channel'][_0x3e5b('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x54d961=this[_0x3e5b('0x12')]['sync'](this,_0x3d5e39[_0x3e5b('0xd3')]);if(!_0x54d961){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3d5e39,'no\x20variable\x20found');}var _0x5dd4c5=this;_0x596968['forEach'](function(_0x539c2b,_0x5d655f){Object[_0x3e5b('0xd4')](_0x539c2b)[_0x3e5b('0xd5')](function(_0x31463e){_0x5dd4c5[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')](_0x3e5b('0xd6'),_0x54d961,_0x5d655f,_0x31463e),_0x539c2b[_0x31463e]);});});this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0xd7'),_0x54d961),_0x596968['length']);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xd8'),_0x54d961));};AGIVertices[_0x3e5b('0x11')]['dial']=function(_0x106f92){logger[_0x3e5b('0xd9')](util['format'](_0x3e5b('0xda'),_0x106f92[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x106f92[_0x3e5b('0xdb')])){return this['channel']['error'](_0x106f92,_0x3e5b('0xdc'));}var _0x255a6b=this[_0x3e5b('0x19')]['sync'](this,_0x106f92['sip_id']);if(!_0x255a6b){return this['channel'][_0x3e5b('0x4a')](_0x106f92,_0x3e5b('0xdd'));}var _0x4904f4=this[_0x3e5b('0x33')]['exec'](_0x3e5b('0xde'),[util[_0x3e5b('0x94')](_0x3e5b('0xdf'),_0x255a6b),_0x106f92[_0x3e5b('0x5f')],_0x106f92[_0x3e5b('0xe0')],_0x106f92['url']]);if(_0x4904f4['result']===-0x1){return _0x4904f4;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xe1'),_0x3e5b('0xde')));};AGIVertices['prototype'][_0x3e5b('0xe2')]=function(_0x1d50f7){logger['info'](util['format'](_0x3e5b('0xe3'),_0x1d50f7['label']));if(!this['isConfigured'](_0x1d50f7[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}if(!this[_0x3e5b('0x7e')](_0x1d50f7[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this['channel'][_0x3e5b('0xe5')]=!![];this['createSquareDetailsReport'](_0x1d50f7);this['createSquareMessage'](_0x1d50f7[_0x3e5b('0x54')],'in','','');this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xe6'),_0x1d50f7[_0x3e5b('0x54')]));var _0x17445f=this[_0x3e5b('0x75')][_0x3e5b('0x9f')](this,_0x1d50f7);if(_0x17445f){for(var _0x6e795d in _0x17445f){if(_0x17445f[_0x3e5b('0x8f')](_0x6e795d)){this[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')]('DIALOGFLOW_%s',_0x6e795d['toUpperCase']()),_0x17445f[_0x6e795d]);}}this[_0x3e5b('0x3c')](_0x17445f[_0x3e5b('0xe7')],'out',_0x3e5b('0xe2'),'');return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Dialogflow\x20Result\x20%s',_0x17445f[_0x3e5b('0xe7')]));}return this['channel'][_0x3e5b('0x4a')](_0x1d50f7,_0x3e5b('0xe8'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xe9')]=function(_0x5f1053){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xea'),_0x5f1053[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x5f1053['dialogflowV2_project_id'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xeb'));}if(!this[_0x3e5b('0x7e')](_0x5f1053['client_email'])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xec'));}if(!this[_0x3e5b('0x7e')](_0x5f1053[_0x3e5b('0xed')])){return this['channel'][_0x3e5b('0xa5')]('no\x20private_key\x20configured');}if(!this[_0x3e5b('0x7e')](_0x5f1053['dialogflowV2_language'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xee'));}if(!this[_0x3e5b('0x7e')](_0x5f1053[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xe5')]=!![];this[_0x3e5b('0x2f')](_0x5f1053);this[_0x3e5b('0x3c')](_0x5f1053[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20DialogflowV2:\x20%s',_0x5f1053['text']));var _0x5d0ad1=this[_0x3e5b('0x78')][_0x3e5b('0x9f')](this,_0x5f1053);if(_0x5d0ad1){for(var _0x4383d7 in _0x5d0ad1){if(_0x5d0ad1['hasOwnProperty'](_0x4383d7)){if(_0x4383d7!==_0x3e5b('0xef')){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0xf0'),_0x4383d7[_0x3e5b('0x65')]()),_0x5d0ad1[_0x4383d7]);}}}this[_0x3e5b('0x3c')](_0x5d0ad1[_0x3e5b('0xe7')],_0x3e5b('0xf1'),_0x3e5b('0xe9'),_0x5d0ad1['providerResponse']);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xf2'),_0x5d0ad1[_0x3e5b('0xe7')]));}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x5f1053,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3e5b('0x11')]['sesteknda']=function(_0x3e907b){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xf3'),_0x3e907b[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x3e907b['ndauth_url'])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xf4'));}if(!this[_0x3e5b('0x7e')](_0x3e907b[_0x3e5b('0xf5')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xf6'));}if(!this[_0x3e5b('0x7e')](_0x3e907b[_0x3e5b('0xf7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xf8'));}if(!this[_0x3e5b('0x7e')](_0x3e907b['ndassistant_url'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x3e5b('0x2f')](_0x3e907b);this['createSquareMessage'](_0x3e907b[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20SestekNDA:\x20%s',_0x3e907b['text']));var _0x7b5fd5=this[_0x3e5b('0x7a')][_0x3e5b('0x9f')](this,_0x3e907b);if(_0x7b5fd5){for(var _0x464c92 in _0x7b5fd5){if(_0x7b5fd5[_0x3e5b('0x8f')](_0x464c92)){this[_0x3e5b('0x33')]['setVariable'](util['format'](_0x3e5b('0xf9'),_0x464c92[_0x3e5b('0x65')]()),_0x7b5fd5[_0x464c92]);}}this['createSquareMessage'](_0x7b5fd5['speech'],_0x3e5b('0xf1'),_0x3e5b('0xfa'),'');if(_0x7b5fd5[_0x3e5b('0xfb')]){this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xfc'),_0x7b5fd5[_0x3e5b('0xfb')]));var _0x153d8f=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x7b5fd5[_0x3e5b('0xfb')]);try{fs[_0x3e5b('0xfe')](_0x7b5fd5[_0x3e5b('0xfb')]+'.wav');}catch(_0x5756f9){logger['error'](_0x5756f9);}return _0x153d8f;}else{return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xff'),_0x7b5fd5[_0x3e5b('0xe7')]));}}return this[_0x3e5b('0x33')]['error'](_0x3e907b,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x100')]=function(_0x180906){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x101'),_0x180906[_0x3e5b('0x31')]));return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0x100'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x102')]=function(_0x13f8c5){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x103'),_0x13f8c5[_0x3e5b('0x31')]));var _0x440970='';if(_0x13f8c5[_0x3e5b('0x104')]){if(!this['isConfigured'](_0x13f8c5[_0x3e5b('0x104')])){return this['channel']['error'](_0x13f8c5,_0x3e5b('0x105'));}else{var _0xe62d5=parseInt(_0x13f8c5[_0x3e5b('0x104')],0xa);if(isNaN(_0xe62d5)){_0x440970=_0x13f8c5[_0x3e5b('0x104')];}else{_0x440970=this[_0x3e5b('0x106')]['sync'](this,_0x13f8c5['trunk_id']);if(!_0x440970){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x13f8c5,_0x3e5b('0x107'));}}}}else if(_0x13f8c5['trunk_name']){_0x440970=_0x13f8c5[_0x3e5b('0x108')];}else{return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x13f8c5,'no\x20trunk\x20selected');}var _0x8cf63f=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xde'),[util[_0x3e5b('0x94')](_0x3e5b('0x109'),_0x440970,_0x13f8c5[_0x3e5b('0xbe')]),_0x13f8c5[_0x3e5b('0x5f')],_0x13f8c5[_0x3e5b('0xe0')],_0x13f8c5[_0x3e5b('0x5e')]]);if(_0x8cf63f[_0x3e5b('0x9c')]===-0x1){return _0x8cf63f;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xe1'),'DIAL'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x10a')]=function(_0x36187a){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x10b'),_0x36187a[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x10a'));};AGIVertices[_0x3e5b('0x11')]['getdigits']=function(_0x323af8){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x10c'),_0x323af8[_0x3e5b('0x31')]));if(_0x323af8[_0x3e5b('0xa0')]===0x0){return this[_0x3e5b('0x9e')](_0x323af8);}_0x323af8[_0x3e5b('0xa0')]-=0x1;if(!this[_0x3e5b('0x7e')](_0x323af8[_0x3e5b('0x10d')])){return this[_0x3e5b('0x33')]['error'](_0x323af8,'no\x20file\x20audio\x20selected');}var _0x49d18c=this[_0x3e5b('0x1b')]['sync'](this,_0x323af8[_0x3e5b('0x10d')]);if(!_0x49d18c){return this['channel'][_0x3e5b('0x4a')](_0x323af8,_0x3e5b('0x10e'));}if(!this[_0x3e5b('0x7e')](_0x323af8[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')]['error'](_0x3e5b('0x10f'));}var _0x522cca=this['channel'][_0x3e5b('0x110')](_0x49d18c,_0x323af8['response'],_0x323af8[_0x3e5b('0x111')]);var _0x55aa26=_0x522cca[_0x3e5b('0x9c')]?_0x522cca[_0x3e5b('0x9c')]['toString']():'';logger[_0x3e5b('0x2a')](_0x3e5b('0x112'),JSON[_0x3e5b('0x6d')](_0x522cca));if(_0x522cca[_0x3e5b('0x9c')]===-0x1){this[_0x3e5b('0x2f')]['sync'](this,_0x323af8,_0x55aa26);return _0x522cca;}else if(_0x522cca['extra']===_0x3e5b('0x5f')){_0x522cca[_0x3e5b('0x9c')]=_0x55aa26[_0x3e5b('0x96')]>=parseInt(_0x323af8[_0x3e5b('0x113')])?'x':'i';}else{_0x522cca['result']=_0x55aa26['length']>=parseInt(_0x323af8['mindigit'])&&_0x55aa26[_0x3e5b('0x96')]<=parseInt(_0x323af8[_0x3e5b('0x111')])?'x':'i';}var _0xab4390=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x323af8[_0x3e5b('0xd3')]);if(!_0xab4390){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x323af8,_0x3e5b('0x114'));}this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0xab4390,_0x55aa26);if(this[_0x3e5b('0x7e')](_0x323af8['hiddendigitsnum'])){var _0x46e9bf=parseInt(_0x323af8[_0x3e5b('0x115')],0xa);var _0x4d54e9=rs[_0x3e5b('0x116')]({'charset':'*','length':_0x46e9bf});var _0x34eb0c=_0x55aa26['length'];if(_0x34eb0c>0x0){if(_0x34eb0c>_0x46e9bf){this[_0x3e5b('0x2f')]['sync'](this,_0x323af8,_0x323af8[_0x3e5b('0x117')]==='first'?_0x4d54e9+_0x55aa26[_0x3e5b('0x118')](_0x46e9bf):_0x55aa26[_0x3e5b('0x118')](0x0,_0x34eb0c-_0x46e9bf)+_0x4d54e9);}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,rs[_0x3e5b('0x116')]({'charset':'*','length':_0x34eb0c}));}}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,'');}}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,_0x55aa26);}return _0x522cca;};AGIVertices['prototype'][_0x3e5b('0xe')]=function(_0x20defc){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x119'),_0x20defc[_0x3e5b('0x31')]));return this['getdigits'](_0x20defc);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x11a')]=function(_0x279e4d){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x11b'),_0x279e4d[_0x3e5b('0x31')]));this['createSquareDetailsReport'][_0x3e5b('0x9f')](this,_0x279e4d,_0x279e4d[_0x3e5b('0x11c')]);return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x11d'),_0x279e4d[_0x3e5b('0x11c')]));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x11e')]=function(_0x3fb849){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3fb849[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3fb849['aws_access_key_id'])||!this[_0x3e5b('0x7e')](_0x3fb849[_0x3e5b('0x81')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x11f'));}if(!this['isConfigured'](_0x3fb849[_0x3e5b('0x54')])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20aws\x20Polly\x20%s',_0x3fb849[_0x3e5b('0x54')]));var _0x145d81=this[_0x3e5b('0x80')]['sync'](this,_0x3fb849);if(_0x145d81){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x120'),_0x145d81));var _0x101f78=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x145d81);try{fs[_0x3e5b('0xfe')](_0x145d81+_0x3e5b('0x121'));}catch(_0x173a18){logger[_0x3e5b('0x4a')](_0x173a18);}return _0x101f78;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3fb849,_0x3e5b('0x122'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x123')]=function(_0x22ceca){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x22ceca[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x85')])||!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x81')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x11f'));}if(!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x86')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x124'));}if(!this[_0x3e5b('0x7e')](_0x22ceca['text'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')][_0x3e5b('0xe5')]=!![];this[_0x3e5b('0x2f')](_0x22ceca);this['createSquareMessage'](_0x22ceca[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x125'),_0x22ceca['text']));var _0x3b21f1=this[_0x3e5b('0x84')][_0x3e5b('0x9f')](this,_0x22ceca);if(_0x3b21f1){for(var _0x279916 in _0x3b21f1){if(_0x3b21f1[_0x3e5b('0x8f')](_0x279916)&&_[_0x3e5b('0x8c')](_0x3b21f1[_0x279916])){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x126'),_0x279916[_0x3e5b('0x65')]()),_0x3b21f1[_0x279916]);}}if(_[_0x3e5b('0x3e')](_0x3b21f1['message'])){return this[_0x3e5b('0x33')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x3e5b('0x3c')](_0x3b21f1['message'],_0x3e5b('0xf1'),_0x3e5b('0x127'),'');return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x128'),_0x3b21f1[_0x3e5b('0x72')]));}}return this['channel'][_0x3e5b('0x4a')](_0x22ceca,_0x3e5b('0x129'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x12a')]=function(_0x3e2fda){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x12b'),_0x3e2fda[_0x3e5b('0x31')],_0x3e2fda[_0x3e5b('0x5f')]));if(!this['isConfigured'](_0x3e2fda[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}var _0x53e2d0=_0x3e5b('0x12c');var _0x33c246=util[_0x3e5b('0x94')](_0x3e5b('0x12d'),FILES_PATH,rs[_0x3e5b('0x116')](0x4));var _0xa7ffe0=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x33c246,_0x53e2d0);var _0x17f2a7=!![];if(_0x3e2fda['beep']===_0x3e5b('0x12e')){_0x17f2a7=![];}var _0x3f7373=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x33c246,_0x53e2d0,_0x3e2fda[_0x3e5b('0x130')],_0x3e2fda[_0x3e5b('0x5f')],undefined,_0x17f2a7);if(_0x3f7373[_0x3e5b('0x9c')]!==-0x1){this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x131'),_0xa7ffe0));var _0x10bd68=this['googleASR'][_0x3e5b('0x9f')](this,_0x3e2fda,_0xa7ffe0);if(_0x10bd68){for(var _0x4e7ab8 in _0x10bd68){if(_0x10bd68[_0x3e5b('0x8f')](_0x4e7ab8)){this['channel'][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x132'),_0x4e7ab8['toUpperCase']()),_0x10bd68[_0x4e7ab8]);}}return this['channel'][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x133'),JSON[_0x3e5b('0x6d')](_0x10bd68)));}}return _0x3f7373;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x134')]=function(_0x455ec0){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x135'),_0x455ec0['label']));if(!this[_0x3e5b('0x7e')](_0x455ec0[_0x3e5b('0x8a')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x136'));}if(!this[_0x3e5b('0x7e')](_0x455ec0[_0x3e5b('0x8b')])){return this['channel'][_0x3e5b('0xa5')]('no\x20appsecret\x20configured');}var _0x4321c4=_0x3e5b('0x12c');var _0x4b2ed7=util[_0x3e5b('0x94')](_0x3e5b('0x12d'),FILES_PATH,rs[_0x3e5b('0x116')](0x4));var _0x4a67eb=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x4b2ed7,_0x4321c4);var _0x4d7ae7=!![];if(_0x455ec0[_0x3e5b('0x137')]==='NOBEEP'){_0x4d7ae7=![];}var _0x3d1172=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x4b2ed7,_0x4321c4,_0x455ec0[_0x3e5b('0x130')],_0x455ec0[_0x3e5b('0x5f')],undefined,_0x4d7ae7);if(_0x3d1172[_0x3e5b('0x9c')]!==-0x1){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('tilde\x20%s\x20file\x20created',_0x4a67eb));var _0x29579f=this[_0x3e5b('0x89')][_0x3e5b('0x9f')](this,_0x455ec0,_0x4a67eb);if(_0x29579f){for(var _0x1a3dca in _0x29579f){if(_0x29579f[_0x3e5b('0x8f')](_0x1a3dca)){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x138'),_0x1a3dca[_0x3e5b('0x65')]()),_0x29579f[_0x1a3dca]);}}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x139'),JSON[_0x3e5b('0x6d')](_0x29579f)));}}return _0x3d1172;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x13a')]=function(_0x4c94ea){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4c94ea[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['continueAt'](_0x4c94ea[_0x3e5b('0x38')],_0x4c94ea[_0x3e5b('0x13b')],_0x4c94ea[_0x3e5b('0x13c')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x13d')]=function(_0x39a0ec){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x13e'),_0x39a0ec[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x39a0ec[_0x3e5b('0x13f')])){return this['channel'][_0x3e5b('0x4a')](_0x39a0ec,_0x3e5b('0x140'));}try{var _0xfd374f=eval(_0x39a0ec[_0x3e5b('0x13f')])?_0x3e5b('0x141'):_0x3e5b('0x142');this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x143'),_0x39a0ec['condition'],_0xfd374f));return{'code':0xc8,'result':_0xfd374f};}catch(_0x221103){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x144')]=function(_0x524a38){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x145'),_0x524a38[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x524a38[_0x3e5b('0x146')])){return this[_0x3e5b('0x33')]['error'](_0x524a38,'no\x20interval\x20configured');}var _0x2d5599=this['getIntervals'][_0x3e5b('0x9f')](this,_0x524a38['interval_id']);if(!_0x2d5599){return this['channel'][_0x3e5b('0x4a')](_0x524a38,'no\x20intervals\x20found');}for(var _0x568836=0x0;_0x568836<_0x2d5599[_0x3e5b('0x96')];_0x568836+=0x1){var _0x200092=this[_0x3e5b('0x33')][_0x3e5b('0x12')](util[_0x3e5b('0x94')](_0x3e5b('0x147'),_0x2d5599[_0x568836]));if(_0x200092[_0x3e5b('0x9c')]===-0x1){return _0x200092;}logger[_0x3e5b('0x2a')](util['format']('IFTIME\x20%s\x20%s',_0x2d5599[_0x568836],_0x200092[_0x3e5b('0x99')]));if(_0x200092[_0x3e5b('0x99')]==='true'){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],'true'));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],_0x3e5b('0x141')));return{'code':0xc8,'result':_0x3e5b('0x141')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],_0x3e5b('0x142')));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('IFTIME\x20%s\x20%s',_0x2d5599[_0x568836],'false'));}}return{'code':0xc8,'result':_0x3e5b('0x142')};};AGIVertices['prototype'][_0x3e5b('0x149')]=function(_0x55a9c3){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x55a9c3['label']));return this['channel'][_0x3e5b('0x149')]();};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x14a')]=function(_0x534f4c){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x14b'),_0x534f4c[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x534f4c['key'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}var _0x10941c=_0x3e5b('0x12c');var _0x12641a=util['format'](_0x3e5b('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x5119e4=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x12641a,_0x10941c);var _0x2798bd=!![];if(_0x534f4c[_0x3e5b('0x137')]===_0x3e5b('0x12e')){_0x2798bd=![];}var _0x279207=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x12641a,_0x10941c,_0x534f4c['intKey'],_0x534f4c['timeout'],undefined,_0x2798bd);if(_0x279207[_0x3e5b('0x9c')]!==-0x1){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x14c'),_0x5119e4));var _0x340f37=this[_0x3e5b('0x7c')][_0x3e5b('0x9f')](this,_0x534f4c,_0x5119e4);if(_0x340f37){for(var _0xf45a3a in _0x340f37){if(_0x340f37[_0x3e5b('0x8f')](_0xf45a3a)){this[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')](_0x3e5b('0x14d'),_0xf45a3a['toUpperCase']()),_0x340f37[_0xf45a3a]);}}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x14e'),JSON['stringify'](_0x340f37)));}}return _0x279207;};AGIVertices[_0x3e5b('0x11')]['ispeechtts']=function(_0x1fe8da){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x14f'),_0x1fe8da['label']));if(!this['isConfigured'](_0x1fe8da[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}if(!this[_0x3e5b('0x7e')](_0x1fe8da[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20ispeech\x20TTS\x20%s',_0x1fe8da[_0x3e5b('0x54')]));var _0x4e586b=this[_0x3e5b('0x7b')][_0x3e5b('0x9f')](this,_0x1fe8da);if(_0x4e586b){this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x14c'),_0x4e586b));var _0x415dad=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x4e586b,_0x1fe8da[_0x3e5b('0x130')]);try{fs['unlink'](_0x4e586b+'.wav');}catch(_0x31efa7){logger['error'](_0x31efa7);}return _0x415dad;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x1fe8da,_0x3e5b('0x150'));};AGIVertices[_0x3e5b('0x11')]['login']=function(_0xdf9061){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x151'),_0xdf9061[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0xdf9061[_0x3e5b('0x152')])){return this['channel'][_0x3e5b('0x4a')](_0xdf9061,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this['channel'][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));var _0x203a85=this[_0x3e5b('0x4c')][_0x3e5b('0x9f')](this,_0xdf9061[_0x3e5b('0x152')]);if(_0x203a85){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061['findBy']));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x158')]=function(_0x1e909b){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x159'),_0x1e909b[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x1e909b[_0x3e5b('0x152')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x1e909b,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));var _0x4a2afa=this[_0x3e5b('0x4b')][_0x3e5b('0x9f')](this,_0x1e909b[_0x3e5b('0x152')]);if(_0x4a2afa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x3e5b('0x157'),this['channel'][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x15a')};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x15b')]=function(_0xa29ce4){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xa29ce4[_0x3e5b('0x31')]));if(!this['isConfigured'](_0xa29ce4[_0x3e5b('0x15c')])){return this[_0x3e5b('0x33')]['error'](_0xa29ce4,_0x3e5b('0x15d'));}this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x15e'),_0xa29ce4['operation']));var _0x5a52a3=eval(_0xa29ce4[_0x3e5b('0x15c')]);if(!this[_0x3e5b('0x7e')](_0xa29ce4[_0x3e5b('0xd3')])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0x10f'));}var _0x1c3872=this['getVariable'][_0x3e5b('0x9f')](this,_0xa29ce4[_0x3e5b('0xd3')]);if(!_0x1c3872){return this[_0x3e5b('0x33')]['error'](_0xa29ce4,_0x3e5b('0x114'));}if(_[_0x3e5b('0x92')](_0x5a52a3)){var _0x190d8e=this;_0x5a52a3[_0x3e5b('0xd5')](function(_0x2b3ed4,_0x7849f7){_0x190d8e[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x15f'),_0x1c3872,_0x7849f7),_0x2b3ed4);});return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('variable\x20%s[key]\x20set',_0x1c3872));}else{return this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0x1c3872,_0x5a52a3);}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x160')]=function(_0x3eae7e){logger['info'](util['format'](_0x3e5b('0x161'),_0x3eae7e[_0x3e5b('0x31')]));if(_0x3eae7e[_0x3e5b('0xa0')]===0x0){return this[_0x3e5b('0x9e')](_0x3eae7e);}_0x3eae7e['retry']-=0x1;if(!this['isConfigured'](_0x3eae7e[_0x3e5b('0x10d')])){return this[_0x3e5b('0x33')]['error'](_0x3eae7e,_0x3e5b('0x162'));}var _0x2ff312=this[_0x3e5b('0x1b')][_0x3e5b('0x9f')](this,_0x3eae7e['file_id']);if(!_0x2ff312){return this[_0x3e5b('0x33')]['error'](_0x3eae7e,'no\x20file\x20audio\x20found');}var _0x29fb7e=this[_0x3e5b('0x33')]['getData'](_0x2ff312,_0x3eae7e[_0x3e5b('0x163')],_0x3eae7e['digit']);var _0x43e02b=_0x29fb7e[_0x3e5b('0x9c')];if(_0x29fb7e['result']===-0x1){this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x3eae7e,'-1');return _0x29fb7e;}else if(_0x29fb7e[_0x3e5b('0x99')]===_0x3e5b('0x5f')){_0x29fb7e[_0x3e5b('0x9c')]=_0x29fb7e[_0x3e5b('0x9c')][_0x3e5b('0x96')]>0x0?_0x29fb7e[_0x3e5b('0x9c')]:'t';}else if(_['isEmpty'](_0x29fb7e[_0x3e5b('0x9c')])){_0x29fb7e['result']='#';_0x43e02b='#';}if(!this[_0x3e5b('0x7e')](_0x3eae7e[_0x3e5b('0xd3')])){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x10f'));}else{var _0x2fcbd8=this['getVariable'][_0x3e5b('0x9f')](this,_0x3eae7e[_0x3e5b('0xd3')]);if(!_0x2fcbd8){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3eae7e,_0x3e5b('0x114'));}this['channel'][_0x3e5b('0x97')](_0x2fcbd8,_0x43e02b);}this['createSquareDetailsReport']['sync'](this,_0x3eae7e,_0x43e02b);return _0x29fb7e;};AGIVertices[_0x3e5b('0x11')]['noop']=function(_0x9b4e60){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x164'),_0x9b4e60['label']));return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x9b4e60[_0x3e5b('0x165')]||_0x9b4e60[_0x3e5b('0x31')]);};AGIVertices[_0x3e5b('0x11')]['pause']=function(_0x2284d7){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2284d7['label']));if(!this[_0x3e5b('0x7e')](_0x2284d7[_0x3e5b('0x152')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2284d7,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x2284d7[_0x3e5b('0x152')]));var _0x42c87b=this[_0x3e5b('0x46')][_0x3e5b('0x9f')](this,_0x2284d7[_0x3e5b('0x166')]);var _0x1d556a=this[_0x3e5b('0x167')][_0x3e5b('0x9f')](this,_0x2284d7[_0x3e5b('0x152')],_0x42c87b);if(_0x1d556a){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this['channel']['callerid'],_0x2284d7[_0x3e5b('0x152')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x155'),this[_0x3e5b('0x33')]['callerid'],_0x2284d7['findBy']));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')]['callerid'],_0x2284d7['findBy']));this['channel'][_0x3e5b('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x2284d7[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x15a')};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x168')]=function(_0x16a569){logger[_0x3e5b('0x2a')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x16a569['label']));if(!this[_0x3e5b('0x7e')](_0x16a569['file_id'])){return this['channel'][_0x3e5b('0x4a')](_0x16a569,_0x3e5b('0x162'));}var _0x1d3249=this[_0x3e5b('0x1b')][_0x3e5b('0x9f')](this,_0x16a569[_0x3e5b('0x10d')]);if(!_0x1d3249){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x16a569,_0x3e5b('0x10e'));}var _0x36a41b=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0x169'),[_0x1d3249,_0x16a569[_0x3e5b('0xe0')]]);if(_0x36a41b['result']===-0x1){return _0x36a41b;}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x169'),_0x1d3249));};AGIVertices['prototype'][_0x3e5b('0x16a')]=function(_0x2b221e){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2b221e[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2b221e[_0x3e5b('0x16b')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2b221e,_0x3e5b('0x16c'));}var _0x5845f1='';var _0x5df44d=parseInt(_0x2b221e[_0x3e5b('0x16b')],0xa);if(isNaN(_0x5df44d)){_0x5845f1=_0x2b221e[_0x3e5b('0x16b')];}else{_0x5845f1=this[_0x3e5b('0x16')]['sync'](this,_0x2b221e['queue_id']);if(!_0x5845f1){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2b221e,_0x3e5b('0x16d'));}}var _0x2e8920='';if(this[_0x3e5b('0x7e')](_0x2b221e['file_id'])){var _0x5e8a36=this['getSound'][_0x3e5b('0x9f')](this,_0x2b221e['file_id']);if(_0x5e8a36){_0x2e8920=_0x5e8a36;}}this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x2b221e,_0x5845f1);if(_0x2b221e[_0x3e5b('0xe0')][_0x3e5b('0x16e')]('x')<0x0){_0x2b221e['opts']+='x';}if(_0x2b221e['opts'][_0x3e5b('0x16e')]('X')<0x0){_0x2b221e[_0x3e5b('0xe0')]+='X';}this['channel'][_0x3e5b('0x97')](_0x3e5b('0x16f'),_0x5845f1?_0x5845f1[_0x3e5b('0x170')]():'');var _0x1ffff6=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0x171'),[_0x5845f1,_0x2b221e[_0x3e5b('0xe0')],_0x2b221e[_0x3e5b('0x5e')],_0x2e8920,_0x2b221e[_0x3e5b('0x5f')],_0x2b221e[_0x3e5b('0x8')],_0x2b221e['macro'],_0x2b221e[_0x3e5b('0x172')],'',_0x2b221e[_0x3e5b('0x173')]]);if(_0x1ffff6[_0x3e5b('0x9c')]===-0x1){return _0x1ffff6;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x171'),_0x5845f1));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x174')]=function(_0x1565e3){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x175'),_0x1565e3['label']));var _0x1a01f2=_0x1565e3[_0x3e5b('0x176')]||_0x3e5b('0x12c');var _0xb8565a=util[_0x3e5b('0x94')](_0x3e5b('0x177'),this[_0x3e5b('0x33')][_0x3e5b('0x30')],rs[_0x3e5b('0x116')](0x5));var _0xbaa631=util['format'](_0x3e5b('0x178'),FILES_PATH,_0xb8565a,_0x1a01f2);var _0x22cf28=util['format']('%s/recordings/%s',FILES_PATH,_0xb8565a);this[_0x3e5b('0x36')][_0x3e5b('0x9f')](this,_0x1565e3,_0xb8565a,_0xbaa631);this[_0x3e5b('0x33')][_0x3e5b('0x97')]('RECORDING_SAVENAME',_0xb8565a);logger[_0x3e5b('0x2a')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x22cf28,_0x1a01f2,_0x1565e3[_0x3e5b('0x179')],_0x1565e3[_0x3e5b('0x5f')]);return this['channel']['recordFile'](_0x22cf28,_0x1a01f2,_0x1565e3[_0x3e5b('0x179')],_0x1565e3['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3e5b('0x17a')]=function(_0x42f144){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x17b'),_0x42f144[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x42f144['url'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x17c'));}var _0x749ca9=this[_0x3e5b('0x5d')]['sync'](this,_0x42f144);logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x17d'),util[_0x3e5b('0x17e')](_0x749ca9,{'showHidden':![],'depth':null})));if(!this[_0x3e5b('0x7e')](_0x42f144[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x17f'));}var _0x2eb9c2=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x42f144[_0x3e5b('0xd3')]);if(!_0x2eb9c2){return this['channel'][_0x3e5b('0x4a')](_0x42f144,_0x3e5b('0x114'));}this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')]('%s_STATUS_CODE',_0x2eb9c2),_0x749ca9[_0x3e5b('0x70')]?_0x749ca9[_0x3e5b('0x70')]:_0x3e5b('0x180'));this['channel'][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x181'),_0x2eb9c2),_0x749ca9[_0x3e5b('0x71')]?_0x749ca9[_0x3e5b('0x71')]:'OK');if(_0x749ca9[_0x3e5b('0x6e')]){try{this[_0x3e5b('0x93')](_0x749ca9[_0x3e5b('0x6e')],_0x2eb9c2);}catch(_0x44ebf8){logger['error'](util[_0x3e5b('0x94')](_0x3e5b('0x182'),_0x2eb9c2));}}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xd8'),_0x2eb9c2));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x183')]=function(_0x53601a){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x184'),_0x53601a['label']));return this[_0x3e5b('0x33')]['sayDigits'](_0x53601a['digits'][_0x3e5b('0x50')](/\s+/g,''),_0x53601a['escape_digits']);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x185')]=function(_0x7cc87c){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x186'),_0x7cc87c[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')][_0x3e5b('0x187')](_0x7cc87c[_0x3e5b('0x60')]['replace'](/\s+/g,''),_0x7cc87c['escape_digits']);};AGIVertices['prototype'][_0x3e5b('0x188')]=function(_0x5011d4){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x189'),_0x5011d4['label']));return this[_0x3e5b('0x33')][_0x3e5b('0x18a')](_0x5011d4[_0x3e5b('0x54')],_0x5011d4[_0x3e5b('0x179')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x18b')]=function(_0x71ac75){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x18c'),_0x71ac75['label']));if(!this[_0x3e5b('0x7e')](_0x71ac75[_0x3e5b('0x18d')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x18e'));}var _0x1f7d3d=this['getMailAccount'][_0x3e5b('0x9f')](this,_0x71ac75[_0x3e5b('0x18d')]);if(!_0x1f7d3d||!_0x1f7d3d['Smtp']){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x71ac75,_0x3e5b('0x18f'));}var _0x46cb69={'from':util['format'](_0x3e5b('0x190'),_0x1f7d3d['name'],_0x1f7d3d[_0x3e5b('0x191')]||_0x1f7d3d[_0x3e5b('0x192')]['user']),'to':_0x71ac75['to']||'','cc':_0x71ac75['cc']||'','bcc':_0x71ac75[_0x3e5b('0x193')]||'','subject':_0x71ac75[_0x3e5b('0x194')],'html':_0x71ac75['text'],'text':_0x71ac75[_0x3e5b('0x54')]};if(this['isConfigured'](_0x71ac75[_0x3e5b('0x195')])){}logger['debug'](_0x3e5b('0x196'),JSON['stringify'](_0x46cb69));this[_0x3e5b('0x2f')]['sync'](this,_0x71ac75,_0x71ac75['account_id']);this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x197'),_0x1f7d3d[_0x3e5b('0x14')]));this[_0x3e5b('0x1f')][_0x3e5b('0x9f')](this,_0x1f7d3d[_0x3e5b('0x198')],_0x46cb69);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x199'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x19a')]=function(_0x28c797){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x19b'),_0x28c797[_0x3e5b('0x31')]));return this['channel']['noop'](_0x3e5b('0x19c'));};AGIVertices['prototype'][_0x3e5b('0x19d')]=function(_0x2f09ff){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2f09ff[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2f09ff[_0x3e5b('0x19e')])){return this['channel']['noop'](_0x3e5b('0x19f'));}var _0x17ad80=this['getSmsAccount'][_0x3e5b('0x9f')](this,_0x2f09ff[_0x3e5b('0x19e')]);if(!_0x17ad80){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2f09ff,_0x3e5b('0x1a0'));}var _0x380fa7={'body':_0x2f09ff[_0x3e5b('0x1a1')],'phone':_0x2f09ff['to']||'','SmsAccountId':_0x17ad80['id']};logger['debug'](_0x3e5b('0x1a2'),JSON['stringify'](_0x380fa7));this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x2f09ff,_0x2f09ff[_0x3e5b('0x19e')]);this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x1a3'),_0x17ad80['name']));this[_0x3e5b('0x2e')][_0x3e5b('0x9f')](this,_0x380fa7);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x3e5b('0x1a4')]=function(_0x2d57c8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2d57c8['label']));if(!this[_0x3e5b('0x7e')](_0x2d57c8['variable_id'])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2d57c8,_0x3e5b('0x1a5'));}var _0x5c7b05=this[_0x3e5b('0x12')]['sync'](this,_0x2d57c8[_0x3e5b('0xd3')]);if(!_0x5c7b05){return this[_0x3e5b('0x33')]['error'](_0x2d57c8,_0x3e5b('0x114'));}return this['channel'][_0x3e5b('0x97')](_0x5c7b05,_0x2d57c8[_0x3e5b('0x1a6')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1a7')]=function(_0x2045aa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1a8'),_0x2045aa[_0x3e5b('0x31')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('START\x20CALLY\x20SQUARE');var _0x4b4b4c=this[_0x3e5b('0x33')][_0x3e5b('0x12')](_0x3e5b('0x1a9'));if(!_[_0x3e5b('0x41')](_0x4b4b4c['extra'])){this[_0x3e5b('0x33')]['uniqueid']=_0x4b4b4c[_0x3e5b('0x99')];}if(_0x2045aa['answer']==='yes'){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x1aa'));return this[_0x3e5b('0x33')][_0x3e5b('0xb5')]();}return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x1ab'));};AGIVertices[_0x3e5b('0x11')]['subproject']=function(_0x221175){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1ac'),_0x221175[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x221175[_0x3e5b('0x1ad')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x221175,'no\x20subproject\x20selected');}var _0x14c3b4=this[_0x3e5b('0x1ae')][_0x3e5b('0x9f')](this,_0x221175[_0x3e5b('0x1ad')]);if(!this[_0x3e5b('0x7e')](_0x14c3b4)){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x221175,util[_0x3e5b('0x94')](_0x3e5b('0x1af'),_0x221175[_0x3e5b('0x1ad')]));}if(_0x14c3b4===this[_0x3e5b('0x33')][_0x3e5b('0x34')]){return this[_0x3e5b('0x33')]['error'](_0x221175,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x221175,_0x14c3b4);var _0x3b55ef=this[_0x3e5b('0x33')][_0x3e5b('0x4f')]('AGI',util[_0x3e5b('0x94')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3e5b('0x8')][_0x3e5b('0x1b0')]||_0x3e5b('0x1b1'),_0x14c3b4,this[_0x3e5b('0x33')][_0x3e5b('0x34')]));if(_0x3b55ef[_0x3e5b('0x9c')]===-0x1){return _0x3b55ef;}return this['channel'][_0x3e5b('0xa5')](util['format']('Executed\x20command\x20%s\x20%s',_0x3e5b('0x1b2'),_0x14c3b4));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b3')]=function(_0x2ef84e){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1b4'),_0x2ef84e[_0x3e5b('0x31')]));var _0x236550=this[_0x3e5b('0x4e')][_0x3e5b('0x9f')](this,_0x2ef84e[_0x3e5b('0xb3')]);this[_0x3e5b('0x2f')]['sync'](this,_0x2ef84e,_0x2ef84e[_0x3e5b('0xb3')]);if(this[_0x3e5b('0x7e')](_0x2ef84e['variable_id'])){var _0x448a36=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x2ef84e[_0x3e5b('0xd3')]);if(_0x448a36){this['channel'][_0x3e5b('0x97')](_0x448a36,_0x236550);return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x1b5'),_0x2ef84e['command'],_0x448a36));}}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2ef84e['command']));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b6')]=function(_0x13a7f8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1b7'),_0x13a7f8[_0x3e5b('0x31')]));_0x13a7f8['text']=_0x13a7f8[_0x3e5b('0x54')][_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3e5b('0x7e')](_0x13a7f8[_0x3e5b('0x52')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x1b8'));}if(!this[_0x3e5b('0x7e')](_0x13a7f8['text'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x1b9'),_0x13a7f8[_0x3e5b('0x54')]));var _0x5dd58f=this[_0x3e5b('0x51')]['sync'](this,_0x13a7f8);if(_0x5dd58f){this[_0x3e5b('0x33')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5dd58f));var _0x58a574=this[_0x3e5b('0x33')]['streamFile'](_0x5dd58f);try{fs[_0x3e5b('0xfe')](_0x5dd58f+'.wav');}catch(_0x210072){logger[_0x3e5b('0x4a')](_0x210072);}return _0x58a574;}return this['channel'][_0x3e5b('0x4a')](_0x13a7f8,_0x3e5b('0x1ba'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1bb')]=function(_0x37c357){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1bc'),_0x37c357[_0x3e5b('0x31')]));_0x37c357['text']=_0x37c357[_0x3e5b('0x54')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3e5b('0x7e')](_0x37c357[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x1bd'),_0x37c357[_0x3e5b('0x54')]));var _0x6b5af5=this['googleTTS'][_0x3e5b('0x9f')](this,_0x37c357);if(_0x6b5af5){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x1be'),_0x6b5af5));var _0x2ac021=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x6b5af5);try{fs[_0x3e5b('0xfe')](_0x6b5af5+_0x3e5b('0x121'));}catch(_0x346812){logger[_0x3e5b('0x4a')](_0x346812);}return _0x2ac021;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x37c357,_0x3e5b('0x1bf'));};AGIVertices[_0x3e5b('0x11')]['unpause']=function(_0x21f3f8){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x1c0'),_0x21f3f8[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x21f3f8['findBy'])){return this[_0x3e5b('0x33')]['error'](_0x21f3f8,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));var _0x422555=this[_0x3e5b('0x49')][_0x3e5b('0x9f')](this,_0x21f3f8[_0x3e5b('0x152')]);if(_0x422555){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8['findBy']));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util['format'](_0x3e5b('0x157'),this['channel'][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3e5b('0x11')]['voicemail']=function(_0x1b1dc8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1c1'),_0x1b1dc8['label']));var _0x297ebc=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0x1c2'),[_0x1b1dc8[_0x3e5b('0x1c3')],_0x1b1dc8[_0x3e5b('0x74')]]);if(_0x297ebc[_0x3e5b('0x9c')]===-0x1){return _0x297ebc;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x1c2'),_0x1b1dc8[_0x3e5b('0x1c3')]));};AGIVertices[_0x3e5b('0x11')]['vswitch']=function(_0x5656f7){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1c4'),_0x5656f7[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x5656f7[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x5656f7,'no\x20variable\x20selected');}var _0x558fa7=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x5656f7[_0x3e5b('0xd3')]);if(!_0x558fa7){return this['channel'][_0x3e5b('0x4a')](_0x5656f7,_0x3e5b('0x114'));}var _0x22e457=this[_0x3e5b('0x33')]['getVariable'](_0x558fa7);return{'code':0xc8,'result':_0x22e457['extra']?_0x22e457[_0x3e5b('0x99')]:'-'};};String[_0x3e5b('0x11')]['replaceAll']=function(_0x514438,_0x49b50c){return this[_0x3e5b('0x98')](_0x514438)[_0x3e5b('0x1c5')](_0x49b50c);};module[_0x3e5b('0x1c6')]=AGIVertices; \ No newline at end of file +var _0x032e=['mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','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','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','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','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','number','timeout','POST','PUT','toUpperCase','body','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','includes','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry'];(function(_0x44e1fb,_0x16c0a){var _0x58ba46=function(_0x5a2c69){while(--_0x5a2c69){_0x44e1fb['push'](_0x44e1fb['shift']());}};_0x58ba46(++_0x16c0a);}(_0x032e,0x124));var _0xe032=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x032e[_0x433a86];return _0x23000c;};'use strict';var fs=require('fs');var util=require(_0xe032('0x0'));var _=require('lodash');var sh=require(_0xe032('0x1'));var odbc=require(_0xe032('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xe032('0x3'));var rp=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var scripts=require(_0xe032('0x8'));var FILES_PATH=_0xe032('0x9');var recursiveMapAttributes=[_0xe032('0xa'),_0xe032('0xb')];var verticesWithRetry=[_0xe032('0xc'),_0xe032('0xd'),_0xe032('0xe')];var AGIVertices=function(_0xaf3907,_0x3b0ef8,_0x3d62fa){this[_0xe032('0xf')]=_0xaf3907;this[_0xe032('0x10')]=_0x3b0ef8;this[_0xe032('0x11')]=_0x3d62fa;};AGIVertices['prototype'][_0xe032('0x12')]=function(_0x1ce2ae,_0x13c126){this[_0xe032('0x10')][_0xe032('0x13')](_0x1ce2ae)[_0xe032('0x14')](function(_0x2194fc){_0x13c126(null,_0x2194fc?_0x2194fc['name']:![]);})[_0xe032('0x15')](function(_0x266d71){_0x13c126(_0x266d71);});};AGIVertices[_0xe032('0x16')][_0xe032('0x17')]=function(_0x4aee44,_0x311592){this[_0xe032('0x10')][_0xe032('0x18')](_0x4aee44)[_0xe032('0x14')](function(_0x17b3aa){_0x311592(null,_0x17b3aa?_0x17b3aa[_0xe032('0x19')]:![]);})[_0xe032('0x15')](function(_0x4da5b7){_0x311592(_0x4da5b7);});};AGIVertices[_0xe032('0x16')][_0xe032('0x1a')]=function(_0x36fb7c,_0x3b57d3){this[_0xe032('0x10')][_0xe032('0x1b')](_0x36fb7c)['then'](function(_0x155f72){_0x3b57d3(null,_0x155f72?_0x155f72[_0xe032('0x19')]:![]);})[_0xe032('0x15')](function(_0x41d2a5){_0x3b57d3(_0x41d2a5);});};AGIVertices[_0xe032('0x16')]['getSquareOdbc']=function(_0x4b644b,_0x484e6c){this[_0xe032('0x10')]['getSquareOdbcById'](_0x4b644b)[_0xe032('0x14')](function(_0x4608e4){_0x484e6c(null,_0x4608e4?_0x4608e4[_0xe032('0x1c')]:![]);})[_0xe032('0x15')](function(_0x288d91){_0x484e6c(_0x288d91);});};AGIVertices[_0xe032('0x16')][_0xe032('0x1d')]=function(_0x5a7b53,_0x32f8b6){this[_0xe032('0x10')][_0xe032('0x1e')](_0x5a7b53)[_0xe032('0x14')](function(_0x2ca592){_0x32f8b6(null,_0x2ca592?_0x2ca592[_0xe032('0x19')]:![]);})[_0xe032('0x15')](function(_0xe89aa7){_0x32f8b6(_0xe89aa7);});};AGIVertices['prototype']['getTrunk']=function(_0x4d8ded,_0x4ef536){this[_0xe032('0x10')][_0xe032('0x1f')](_0x4d8ded)[_0xe032('0x14')](function(_0x2bfe8f){_0x4ef536(null,_0x2bfe8f?_0x2bfe8f[_0xe032('0x19')]:![]);})[_0xe032('0x15')](function(_0x2b6ffa){_0x4ef536(_0x2b6ffa);});};AGIVertices[_0xe032('0x16')][_0xe032('0x20')]=function(_0x5bb36a,_0x189ed4){var _0x1af097=this;this[_0xe032('0x10')][_0xe032('0x21')](_0x5bb36a)['then'](function(_0x5573e4){_0x189ed4(null,_0x5573e4?_0x1af097[_0xe032('0x22')](_0x5573e4[_0xe032('0x23')]):![]);})[_0xe032('0x15')](function(_0xae116e){_0x189ed4(_0xae116e);});};AGIVertices['prototype']['getMailAccount']=function(_0x4fe00e,_0x42ec95){this[_0xe032('0x10')][_0xe032('0x24')](_0x4fe00e)[_0xe032('0x14')](function(_0x50db2d){_0x42ec95(null,_0x50db2d?_0x50db2d:![]);})[_0xe032('0x15')](function(_0x236da9){_0x42ec95(_0x236da9);});};AGIVertices[_0xe032('0x16')][_0xe032('0x25')]=function(_0x25810a,_0x4a0198,_0xd90bd5){this[_0xe032('0x11')][_0xe032('0x25')](_0x25810a,_0x4a0198)[_0xe032('0x14')](function(){_0xd90bd5(null);})['catch'](function(_0x44b78b){_0xd90bd5(_0x44b78b);});};AGIVertices['prototype'][_0xe032('0x26')]=function(_0x53df28,_0x9d3199){this['rpc'][_0xe032('0x27')](_0x53df28)['then'](function(_0x3970e1){if(_0x3970e1){if(_0x3970e1[_0xe032('0x28')]){_0x9d3199(null,[_0x3970e1['interval']]);}else{_0x9d3199(null,_[_0xe032('0x29')](_0x3970e1[_0xe032('0x2a')],_0xe032('0x2b')));}}else{_0x9d3199(null,![]);}})[_0xe032('0x15')](function(_0x4e222c){_0x9d3199(_0x4e222c);});};AGIVertices[_0xe032('0x16')]['getSoundPath']=function(_0x38dcf2){return util[_0xe032('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x38dcf2);};AGIVertices[_0xe032('0x16')][_0xe032('0x2d')]=function(_0x4a4447,_0x3efdef,_0x2cfc49){odbc[_0xe032('0x2e')](_0x4a4447,function(_0x3192ec){if(_0x3192ec){logger[_0xe032('0x2f')](_0xe032('0x30'),_0x3192ec);_0x2cfc49(_0x3192ec);}else{logger[_0xe032('0x31')](_0xe032('0x32'));odbc[_0xe032('0x33')](_0x3efdef,function(_0x179bb2,_0x450322){if(_0x179bb2){logger[_0xe032('0x31')](_0xe032('0x34'),_0x3efdef);_0x2cfc49(_0x179bb2);}else{logger[_0xe032('0x31')](_0xe032('0x35'),_0x3efdef);odbc[_0xe032('0x36')](function(_0x2d3d0b){if(_0x2d3d0b){logger['error'](_0xe032('0x37'),_0x2d3d0b);}_0x2cfc49(null,_0x450322);});}});}});};AGIVertices['prototype'][_0xe032('0x38')]=function(_0x2bcfb4,_0x2f2afc){this[_0xe032('0x10')][_0xe032('0x39')](_0x2bcfb4)['then'](function(_0x132d25){_0x2f2afc(null,_0x132d25?_0x132d25:![]);})['catch'](function(_0x46ea84){_0x2f2afc(_0x46ea84);});};AGIVertices['prototype'][_0xe032('0x3a')]=function(_0x475355,_0x2644a1){this[_0xe032('0x10')]['createSmsMessage'](_0x475355)[_0xe032('0x14')](function(_0x5a6450){_0x2644a1(null,_0x5a6450);})[_0xe032('0x15')](function(_0x21f586){_0x2644a1(_0x21f586);});};AGIVertices[_0xe032('0x16')][_0xe032('0x3b')]=function(_0x4b58eb,_0x513b0c,_0x45345d){this[_0xe032('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xe032('0xf')][_0xe032('0x3c')],'node':_0x4b58eb[_0xe032('0x3d')],'application':_0x4b58eb[_0xe032('0x3e')],'data':_0x513b0c||null,'project_name':this[_0xe032('0xf')]['arg_1'],'callerid':this[_0xe032('0xf')][_0xe032('0x3f')]})[_0xe032('0x14')](function(_0x753009){if(_0x45345d){_0x45345d(null,_0x753009);}})[_0xe032('0x15')](function(_0x16d6aa){if(_0x45345d){_0x45345d(_0x16d6aa);}});};AGIVertices[_0xe032('0x16')][_0xe032('0x40')]=function(_0x5d21e6,_0x535f34,_0x1b0e28,_0x5be7e3){this[_0xe032('0x10')][_0xe032('0x40')]({'uniqueid':this[_0xe032('0xf')][_0xe032('0x3c')],'callerid':this[_0xe032('0xf')][_0xe032('0x3f')],'calleridname':this[_0xe032('0xf')][_0xe032('0x41')],'context':this[_0xe032('0xf')]['context'],'extension':this[_0xe032('0xf')]['extension'],'priority':this['channel'][_0xe032('0x42')],'accountcode':this[_0xe032('0xf')][_0xe032('0x43')],'dnid':this[_0xe032('0xf')]['dnid'],'projectName':this[_0xe032('0xf')][_0xe032('0x44')],'saveName':_0x535f34,'filename':_0x5d21e6[_0xe032('0x45')]||_0x535f34,'savePath':_0x1b0e28})[_0xe032('0x14')](function(_0x1b3172){_0x5be7e3(null,_0x1b3172);})[_0xe032('0x15')](function(_0x3774bc){_0x5be7e3(_0x3774bc);});};AGIVertices['prototype'][_0xe032('0x46')]=function(_0x3463ee,_0x538150,_0x39c554,_0x421d04,_0x15b27f){this[_0xe032('0x10')][_0xe032('0x46')]({'uniqueid':this[_0xe032('0xf')][_0xe032('0x3c')],'body':_0x3463ee,'direction':_0x538150,'providerName':_0x39c554,'providerResponse':_0x421d04})[_0xe032('0x14')](function(_0x325c49){if(_0x15b27f){_0x15b27f(null,_0x325c49);}})[_0xe032('0x15')](function(_0x3a0253){if(_0x15b27f){_0x15b27f(_0x3a0253);}});};AGIVertices[_0xe032('0x16')][_0xe032('0x47')]=function(_0x2f8114,_0x4eabfc){this[_0xe032('0x10')]['createCmContact']({'firstName':_[_0xe032('0x48')](_0x2f8114[_0xe032('0x19')])||_[_0xe032('0x49')](_0x2f8114[_0xe032('0x19')])?_0xe032('0x4a')+Math[_0xe032('0x4b')]():_0x2f8114[_0xe032('0x19')],'lastName':_[_0xe032('0x48')](_0x2f8114[_0xe032('0x4c')])||_[_0xe032('0x49')](_0x2f8114[_0xe032('0x4c')])?null:_0x2f8114['lastName'],'phone':_0x2f8114[_0xe032('0x4d')],'ListId':_0x2f8114[_0xe032('0x4e')],'scheduledat':_0x2f8114['scheduledAt'],'callbackUniqueid':this[_0xe032('0xf')]['uniqueid'],'tags':_0xe032('0x4f'),'description':_0xe032('0x50')+_0x2f8114[_0xe032('0x51')][_0xe032('0x52')](),'priority':_0x2f8114[_0xe032('0x53')]})['then'](function(_0x352829){_0x4eabfc(null,_0x352829);})[_0xe032('0x15')](function(_0x1e1277){_0x4eabfc(_0x1e1277);});};AGIVertices[_0xe032('0x16')][_0xe032('0x54')]=function(_0x2f83a5,_0x443708){this['rpc'][_0xe032('0x55')](_0x2f83a5)[_0xe032('0x14')](function(_0x454b29){_0x443708(null,_0x454b29?_0x454b29[_0xe032('0x19')]:![]);})[_0xe032('0x15')](function(_0x42c0d7){_0x443708(_0x42c0d7);});};AGIVertices[_0xe032('0x16')][_0xe032('0x56')]=function(_0x80d181,_0x54c0b0,_0x795a58){var _0xc27d9d={'role':_0xe032('0x57')};_0xc27d9d[_0x80d181]=this['channel'][_0xe032('0x3f')];this[_0xe032('0x10')]['agentPause'](_0xc27d9d,_0x54c0b0,this[_0xe032('0xf')][_0xe032('0x3c')])[_0xe032('0x14')](function(_0x128eeb){_0x795a58(null,_[_0xe032('0x49')](_0x128eeb)?![]:!![]);})[_0xe032('0x15')](function(_0x17f999){logger[_0xe032('0x2f')](_0x17f999);_0x795a58(null,![]);});};AGIVertices[_0xe032('0x16')][_0xe032('0x58')]=function(_0x102b90,_0x505986){var _0x2fcccc={'role':_0xe032('0x57')};_0x2fcccc[_0x102b90]=this[_0xe032('0xf')][_0xe032('0x3f')];this[_0xe032('0x10')]['agentUnpause'](_0x2fcccc)[_0xe032('0x14')](function(_0x55e6b0){_0x505986(null,_[_0xe032('0x49')](_0x55e6b0)?![]:!![]);})[_0xe032('0x15')](function(_0x26d358){logger[_0xe032('0x2f')](_0x26d358);_0x505986(null,![]);});};AGIVertices[_0xe032('0x16')][_0xe032('0x59')]=function(_0x3faae4,_0x2382bb){var _0x22fd01={'role':'agent'};_0x22fd01[_0x3faae4]=this['channel']['callerid'];this[_0xe032('0x10')][_0xe032('0x59')](_0x22fd01)[_0xe032('0x14')](function(_0x3ed512){_0x2382bb(null,_[_0xe032('0x49')](_0x3ed512)?![]:!![]);})[_0xe032('0x15')](function(_0x523d73){logger[_0xe032('0x2f')](_0x523d73);_0x2382bb(null,![]);});};AGIVertices[_0xe032('0x16')][_0xe032('0x5a')]=function(_0x5a1074,_0x108dd4){var _0x522713={'role':_0xe032('0x57')};_0x522713[_0x5a1074]=this[_0xe032('0xf')]['callerid'];var _0x590905=_0x5a1074!='internal'?util[_0xe032('0x2c')]('%s/%s@from-sip/n','LOCAL',this[_0xe032('0xf')][_0xe032('0x3f')]):undefined;this[_0xe032('0x10')]['agentLogin'](_0x522713,_0x590905)[_0xe032('0x14')](function(_0x4b5f92){_0x108dd4(null,_[_0xe032('0x49')](_0x4b5f92)?![]:!![]);})[_0xe032('0x15')](function(_0x3b9dee){logger[_0xe032('0x2f')](_0x3b9dee);_0x108dd4(null,![]);});};AGIVertices[_0xe032('0x16')][_0xe032('0x5b')]=function(_0x260fdb,_0x2bd7f9){sh[_0xe032('0x5c')](_[_0xe032('0x5d')](_0x260fdb),function(_0x3c57d4,_0x50ae1f){var _0x8b4464=_0x50ae1f[_0xe032('0x5e')](/(\r\n|\n|\r)/gm,'');_0x2bd7f9(null,_0x8b4464);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x228df8,_0xffd314){scripts[_0xe032('0x5f')](_0x228df8[_0xe032('0x60')],_0x228df8[_0xe032('0x61')]||_0xe032('0x62'),_0x228df8['text'],_0x228df8[_0xe032('0x63')]||_0xe032('0x64'),_0x228df8['ssmlGender']||_0xe032('0x65'),_0x228df8[_0xe032('0x66')]||_0xe032('0x67'))['then'](function(_0x3e893b){_0xffd314(null,_0x3e893b);})[_0xe032('0x15')](function(_0x325b69){_0xffd314(_0x325b69);});};AGIVertices['prototype']['googleTTS']=function(_0xdd691c,_0x529c5f){scripts[_0xe032('0x68')](_0xdd691c[_0xe032('0x62')],_0xdd691c[_0xe032('0x69')]||'en',0x1)[_0xe032('0x14')](function(_0x37af62){_0x529c5f(null,_0x37af62);})[_0xe032('0x15')](function(_0x5a893f){_0x529c5f(_0x5a893f);});};AGIVertices[_0xe032('0x16')][_0xe032('0x6a')]=function(_0x33e7c3,_0x5b5ab9){var _0x2467ea={'uri':_0x33e7c3['url'],'method':_0x33e7c3[_0xe032('0x6b')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x33e7c3['timeout'])===_0xe032('0x6c')&&parseInt(_0x33e7c3[_0xe032('0x6d')])>=0x1?parseInt(_0x33e7c3[_0xe032('0x6d')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe032('0x6e'),_0xe032('0x6f')],_0x2467ea[_0xe032('0x6b')][_0xe032('0x70')]())){try{_0x2467ea[_0xe032('0x71')]=_0x33e7c3[_0xe032('0xb')]?JSON['parse'](_0x33e7c3[_0xe032('0xb')]):{};}catch(_0x24902d){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x24902d);}}try{_0x2467ea[_0xe032('0x72')]=_0x33e7c3[_0xe032('0xa')]?JSON[_0xe032('0x73')](_0x33e7c3[_0xe032('0xa')]):{};}catch(_0x33dd57){logger['error'](_0xe032('0x74'),_0x33dd57);}if(_0x33e7c3['computedVariables']){try{var _0xbd3ae2=require(_0x33e7c3['computedVariables'])[_0xe032('0x75')](this,_0x2467ea);_0x2467ea[_0xe032('0x76')]=Mustache[_0xe032('0x77')](_0x33e7c3[_0xe032('0x78')],_0xbd3ae2,{},['$$','$$']);if(_0x2467ea[_0xe032('0x72')]){_0x2467ea[_0xe032('0x72')]=JSON['parse'](Mustache[_0xe032('0x77')](JSON['stringify'](_0x2467ea['headers']),_0xbd3ae2,{},['$$','$$']));}if(_0x2467ea['body']){_0x2467ea[_0xe032('0x71')]=JSON[_0xe032('0x73')](Mustache['render'](JSON[_0xe032('0x79')](_0x2467ea['body']),_0xbd3ae2,{},['$$','$$']));}}catch(_0x5f42b1){logger[_0xe032('0x2f')](_0xe032('0x7a'),_0x5f42b1);}}rp(_0x2467ea)['then'](function(_0x4ab179){var _0x45e28d={'statusCode':_0x4ab179[_0xe032('0x7b')]||0xc8,'statusMessage':_0x4ab179['statusMessage']||'OK','headers':_0x4ab179[_0xe032('0x72')]||{},'body':_0x4ab179[_0xe032('0x71')]||{}};_0x5b5ab9(null,_0x45e28d);})[_0xe032('0x15')](function(_0x2ac506){var _0x485c57={'statusCode':_0x2ac506[_0xe032('0x7b')]||0x1f4,'statusMessage':_0x2ac506['message']||_0xe032('0x7c'),'headers':_0x2ac506[_0xe032('0x7d')][_0xe032('0x72')]||{},'body':_0x2ac506['options'][_0xe032('0x71')]||{}};_0x5b5ab9(null,_0x485c57);});};AGIVertices[_0xe032('0x16')]['googleDialogflow']=function(_0x24ce29,_0x1c5653){scripts[_0xe032('0x7e')](this[_0xe032('0xf')][_0xe032('0x3c')],_0x24ce29[_0xe032('0x7f')],_0x24ce29['text'],_0x24ce29[_0xe032('0x80')]||'en')[_0xe032('0x14')](function(_0x27eb0c){_0x1c5653(null,_0x27eb0c);})[_0xe032('0x15')](function(_0x8b8998){_0x1c5653(_0x8b8998);});};AGIVertices[_0xe032('0x16')][_0xe032('0x81')]=function(_0x426f06,_0x2d2db7){scripts[_0xe032('0x81')](this[_0xe032('0xf')]['uniqueid'],_0x426f06[_0xe032('0x82')],_0x426f06['client_email'],_0x426f06[_0xe032('0x83')],_0x426f06['text'],_0x426f06[_0xe032('0x84')]||'en')[_0xe032('0x14')](function(_0x5a87ee){_0x2d2db7(null,_0x5a87ee);})[_0xe032('0x15')](function(_0x47fc9d){_0x2d2db7(_0x47fc9d);});};AGIVertices['prototype']['sestekNDA']=function(_0x192299,_0x1d8be1){scripts[_0xe032('0x85')](this['channel'],_0x192299)[_0xe032('0x14')](function(_0x2e6dad){_0x1d8be1(null,_0x2e6dad);})[_0xe032('0x15')](function(_0x540563){_0x1d8be1(_0x540563);});};AGIVertices[_0xe032('0x16')]['ispeechTTS']=function(_0x2c24c5,_0x868fad){scripts[_0xe032('0x86')](_0x2c24c5[_0xe032('0x7f')],_0x2c24c5[_0xe032('0x62')],_0x2c24c5[_0xe032('0x87')]||_0xe032('0x64'),_0x2c24c5[_0xe032('0x88')])[_0xe032('0x14')](function(_0xe63d0){_0x868fad(null,_0xe63d0);})['catch'](function(_0x5821d7){_0x868fad(_0x5821d7);});};AGIVertices[_0xe032('0x16')][_0xe032('0x89')]=function(_0x131d99,_0x1d9498,_0x56e2a0){scripts[_0xe032('0x89')](_0x1d9498,_0x131d99[_0xe032('0x7f')],_0x131d99[_0xe032('0x8a')]||_0xe032('0x64'),this['isConfigured'](_0x131d99[_0xe032('0x8b')])?_0x131d99[_0xe032('0x8b')]:undefined)[_0xe032('0x14')](function(_0xf78ca3){_0x56e2a0(null,_0xf78ca3);})[_0xe032('0x15')](function(_0x102bdd){_0x56e2a0(_0x102bdd);});};AGIVertices[_0xe032('0x16')]['awsPolly']=function(_0x59c18e,_0x56523f){scripts['awsPolly'](_0x59c18e['aws_access_key_id'],_0x59c18e[_0xe032('0x8c')],_0x59c18e[_0xe032('0x8d')],_0x59c18e[_0xe032('0x8e')]||_0xe032('0x8f'),_0x59c18e[_0xe032('0x62')],_0x59c18e['aws_text_type']||_0xe032('0x62'))[_0xe032('0x14')](function(_0x183c21){_0x56523f(null,_0x183c21);})[_0xe032('0x15')](function(_0x430f38){_0x56523f(_0x430f38);});};AGIVertices[_0xe032('0x16')][_0xe032('0x90')]=function(_0x177937,_0x22ee99){scripts['awsLex'](this['channel']['uniqueid'],_0x177937[_0xe032('0x91')],_0x177937['aws_secret_access_key'],_0x177937[_0xe032('0x92')],_0x177937[_0xe032('0x62')],_0x177937[_0xe032('0x93')])['then'](function(_0x287bb0){_0x22ee99(null,_0x287bb0);})[_0xe032('0x15')](function(_0x39b87a){_0x22ee99(_0x39b87a);});};AGIVertices['prototype']['googleASR']=function(_0x40ce2b,_0x4ca631,_0x371a58){scripts[_0xe032('0x94')](_0x4ca631,_0x40ce2b[_0xe032('0x7f')],_0x40ce2b[_0xe032('0x95')]||_0xe032('0x64'))[_0xe032('0x14')](function(_0x2f6fa0){_0x371a58(null,_0x2f6fa0);})[_0xe032('0x15')](function(_0x355de3){_0x371a58(_0x355de3);});};AGIVertices[_0xe032('0x16')][_0xe032('0x96')]=function(_0x460363,_0x43d385,_0x1a61a1){scripts['tildeASR'](_0x43d385,_0x460363[_0xe032('0x97')],_0x460363['appsecret'],_0x460363[_0xe032('0x76')])[_0xe032('0x14')](function(_0x1ec07c){_0x1a61a1(null,_0x1ec07c);})['catch'](function(_0x34d505){_0x1a61a1(_0x34d505);});};AGIVertices['prototype']['clear']=function(_0x3c0f70){var _0x3e81e9=_[_0xe032('0x98')](verticesWithRetry,_0x3c0f70['agicommand'])?_0x3c0f70:_['clone'](_0x3c0f70);for(var _0x1a19de in _0x3e81e9){if(_0x3e81e9['hasOwnProperty'](_0x1a19de)){if(_0x3e81e9[_0x1a19de]&&_[_0xe032('0x99')](_0x3e81e9[_0x1a19de])){if(_[_0xe032('0x98')](recursiveMapAttributes,_0x1a19de)){_0x3e81e9[_0x1a19de]=this[_0xe032('0x9a')](_0x3e81e9[_0x1a19de]);}else{_0x3e81e9[_0x1a19de]=this['replaceAllVariables'](_0x3e81e9[_0x1a19de]);}}}}return _0x3e81e9;};AGIVertices[_0xe032('0x16')][_0xe032('0x9b')]=function(_0x1dae38){for(var _0x1eae6e in _0x1dae38){if(_0x1dae38[_0xe032('0x9c')](_0x1eae6e)){if(_[_0xe032('0x9d')](_0x1dae38[_0x1eae6e])){this[_0xe032('0x9b')](_0x1dae38[_0x1eae6e]);}else if(_[_0xe032('0x9e')](_0x1dae38[_0x1eae6e])){for(var _0x2d8cce=0x0;_0x2d8cce<_0x1dae38[_0x1eae6e][_0xe032('0x9f')];_0x2d8cce++){this[_0xe032('0x9b')](_0x1dae38[_0x1eae6e][_0x2d8cce]);}}else if(_[_0xe032('0x99')](_0x1dae38[_0x1eae6e])){_0x1dae38[_0x1eae6e]=this['replaceAllVariables'](_0x1dae38[_0x1eae6e]);}}}};AGIVertices[_0xe032('0x16')][_0xe032('0xa0')]=function(_0x3051eb,_0xc54a7f){for(var _0x56968a in _0x3051eb){if(_0x3051eb[_0xe032('0x9c')](_0x56968a)){if(_[_0xe032('0x9d')](_0x3051eb[_0x56968a])){if(!_[_0xe032('0x48')](_0x3051eb[_0x56968a])){this['saveRestApiResult'](_0x3051eb[_0x56968a],util[_0xe032('0x2c')](_0xe032('0xa1'),_0xc54a7f,_0x56968a));}}else if(_[_0xe032('0x9e')](_0x3051eb[_0x56968a])){for(var _0x16a745=0x0;_0x16a745<_0x3051eb[_0x56968a][_0xe032('0x9f')];_0x16a745++){this[_0xe032('0xa0')](_0x3051eb[_0x56968a][_0x16a745],util['format']('%s.%s',_0xc54a7f,_0x56968a+'['+_0x16a745+']'));}}else{if(!_[_0xe032('0x49')](_0x3051eb[_0x56968a])){this[_0xe032('0xf')][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0xa1'),_0xc54a7f,_0x56968a),_0x3051eb[_0x56968a]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x2c2e69){try{var _0x32a028=JSON[_0xe032('0x73')](_0x2c2e69);this[_0xe032('0x9b')](_0x32a028);return JSON[_0xe032('0x79')](_0x32a028);}catch(_0x10af0c){return this[_0xe032('0xa3')](_0x2c2e69);}};AGIVertices['prototype'][_0xe032('0xa3')]=function(_0x39ee71){var _0x3776c7=_0x39ee71[_0xe032('0xa4')]('{');for(var _0x917a37=0x1;_0x917a37<_0x3776c7[_0xe032('0x9f')];_0x917a37+=0x1){var _0x398b91=_0x3776c7[_0x917a37]['split']('}');if(_0x398b91[_0xe032('0x9f')]>0x1){_0x39ee71=_0x39ee71[_0xe032('0xa5')]('{'+_0x398b91[0x0]+'}',this['channel'][_0xe032('0x12')](_0x398b91[0x0])[_0xe032('0xa6')]||_0x398b91[0x0]);}}if(_0x3776c7[_0xe032('0x9f')]===0x1){return _0x39ee71[_0xe032('0x52')]();}return this['replaceAllVariables'](_0x39ee71);};AGIVertices[_0xe032('0x16')][_0xe032('0xa7')]=function(_0x342f68,_0x529b47){var _0x3efb0a=this[_0xe032('0xf')][_0xe032('0x12')](_0x342f68);if(_0x3efb0a[_0xe032('0xa8')]===-0x1){return _0x3efb0a;}logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xa9'),_0x529b47,_0x3efb0a[_0xe032('0xa6')]));return this[_0xe032('0xf')]['setVariable'](_0x529b47,_0x3efb0a[_0xe032('0xa6')]);};AGIVertices[_0xe032('0x16')]['isConfigured']=function(_0x429801){return _0x429801&&_0x429801!=='0'&&_0x429801!=='-1'&&_0x429801!=='';};AGIVertices[_0xe032('0x16')][_0xe032('0xaa')]=function(_0x451702){this[_0xe032('0x3b')]['sync'](this,_0x451702,'-');_0x451702[_0xe032('0xab')]=_0x451702['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe032('0x16')][_0xe032('0xac')]=function(_0x2c00b1){logger['info'](util[_0xe032('0x2c')](_0xe032('0xad'),_0x2c00b1[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x2c00b1[_0xe032('0x62')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}var _0x1714b3='\x22'+_0x2c00b1['text']+'\x22';if(this[_0xe032('0xae')](_0x2c00b1[_0xe032('0x7d')])){_0x1714b3+=','+_0x2c00b1[_0xe032('0x7d')];}var _0xc7f313=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xb1'),_0x1714b3);if(_0xc7f313[_0xe032('0xa8')]===-0x1){return _0xc7f313;}return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0xb2'),_0x1714b3));};AGIVertices[_0xe032('0x16')]['mrcprecog']=function(_0x51cb5e){logger['info'](util[_0xe032('0x2c')](_0xe032('0xb3'),_0x51cb5e[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x51cb5e[_0xe032('0xb4')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xb5'));}var _0x534c2f=_0x51cb5e['grammar'];if(this[_0xe032('0xae')](_0x51cb5e[_0xe032('0x7d')])){_0x534c2f+=','+_0x51cb5e[_0xe032('0x7d')];}var _0xa8a51e=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xb6'),_0x534c2f);if(_0xa8a51e[_0xe032('0xa8')]===-0x1){return _0xa8a51e;}var _0x5462eb=this['getAndSetVariable'](_0xe032('0xb7'),_0xe032('0xb8'));if(_0x5462eb[_0xe032('0xa8')]===-0x1){return _0x5462eb;}var _0x590572=this[_0xe032('0xa7')](_0xe032('0xb9'),_0xe032('0xba'));if(_0x590572[_0xe032('0xa8')]===-0x1){return _0x590572;}var _0xfc85e6=this[_0xe032('0xa7')](_0xe032('0xbb'),_0xe032('0xbc'));if(_0xfc85e6[_0xe032('0xa8')]===-0x1){return _0xfc85e6;}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0xbd'),_0x534c2f));};AGIVertices['prototype'][_0xe032('0x6')]=function(_0x5c38f0){logger['info'](util[_0xe032('0x2c')](_0xe032('0xbe'),_0x5c38f0[_0xe032('0x3d')]));return this[_0xe032('0xf')][_0xe032('0x6')]([_0x5c38f0[_0xe032('0xbf')],_0x5c38f0['args']]);};AGIVertices['prototype'][_0xe032('0xc0')]=function(_0x464fc8){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x464fc8[_0xe032('0x3d')]));if(this[_0xe032('0xae')](_0x464fc8[_0xe032('0x6d')])){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x464fc8[_0xe032('0x6d')]));var _0x5c6971=this[_0xe032('0xf')][_0xe032('0xc1')](_0x464fc8[_0xe032('0x6d')]);if(_0x5c6971[_0xe032('0xa8')]===-0x1){return _0x5c6971;}}return this[_0xe032('0xf')][_0xe032('0xc0')]();};AGIVertices['prototype']['callback']=function(_0x38741e){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xc2'),_0x38741e[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x38741e[_0xe032('0x4e')])){return this['channel']['error'](_0x38741e,_0xe032('0xc3'));}_0x38741e[_0xe032('0x51')]=moment();if(this[_0xe032('0xae')](_0x38741e[_0xe032('0xc4')])){_0x38741e[_0xe032('0x51')]=moment()[_0xe032('0xc5')](_0x38741e[_0xe032('0xc4')],_0xe032('0xc6'));}if(!this[_0xe032('0xae')](_0x38741e[_0xe032('0x53')])){_0x38741e['callback_priority']=0x2;}this['createCmContact'][_0xe032('0x75')](this,_0x38741e);return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x38741e[_0xe032('0x4d')],_0x38741e[_0xe032('0x4e')],_0x38741e[_0xe032('0x51')]));};AGIVertices['prototype'][_0xe032('0xc7')]=function(_0x4f1950){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xc8'),_0x4f1950[_0xe032('0x3d')]));var _0x3fa032=this[_0xe032('0xf')][_0xe032('0x5c')](_0x4f1950[_0xe032('0xc9')],_0x4f1950[_0xe032('0x7d')]);if(_0x3fa032[_0xe032('0xa8')]===-0x1){return _0x3fa032;}return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0xca'),_0x4f1950['application'],_0x4f1950['options']));};AGIVertices[_0xe032('0x16')][_0xe032('0xcb')]=function(_0x4a7654){logger['info'](util[_0xe032('0x2c')](_0xe032('0xcc'),_0x4a7654['label']));if(!this[_0xe032('0xae')](_0x4a7654[_0xe032('0x62')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}var _0x2c0d67='\x22'+_0x4a7654[_0xe032('0x62')]+'\x22';if(this[_0xe032('0xae')](_0x4a7654[_0xe032('0x7d')])){_0x2c0d67+=','+_0x4a7654[_0xe032('0x7d')];}var _0x1f4477=this[_0xe032('0xf')][_0xe032('0x5c')]('MRCPSynth',_0x2c0d67);if(_0x1f4477[_0xe032('0xa8')]===-0x1){return _0x1f4477;}return this['channel']['noop'](util['format'](_0xe032('0xb2'),_0x2c0d67));};AGIVertices[_0xe032('0x16')][_0xe032('0xcd')]=function(_0x1eb12c){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xce'),_0x1eb12c[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x1eb12c[_0xe032('0x62')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}var _0x25e71a='\x22'+_0x1eb12c[_0xe032('0x62')]+'\x22';if(this['isConfigured'](_0x1eb12c[_0xe032('0x7d')])){_0x25e71a+=','+_0x1eb12c['options'];}var _0x67a8de=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xb1'),_0x25e71a);if(_0x67a8de[_0xe032('0xa8')]===-0x1){return _0x67a8de;}return this['channel']['noop'](util[_0xe032('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x25e71a));};AGIVertices[_0xe032('0x16')][_0xe032('0xcf')]=function(_0x3d3cb7){logger[_0xe032('0x31')](util['format'](_0xe032('0xd0'),_0x3d3cb7[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x3d3cb7['grammar'])){return this[_0xe032('0xf')]['noop'](_0xe032('0xb5'));}var _0x1a4ba7=_0x3d3cb7[_0xe032('0xb4')];if(this[_0xe032('0xae')](_0x3d3cb7[_0xe032('0x7d')])){_0x1a4ba7+=','+_0x3d3cb7[_0xe032('0x7d')];}var _0xde0e37=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xb6'),_0x1a4ba7);if(_0xde0e37['result']===-0x1){return _0xde0e37;}var _0x16a3e8=this[_0xe032('0xa7')]('RECOG_CONFIDENCE()',_0xe032('0xd1'));if(_0x16a3e8['result']===-0x1){return _0x16a3e8;}var _0x3b5777=this[_0xe032('0xa7')]('RECOG_INPUT()',_0xe032('0xd2'));if(_0x3b5777[_0xe032('0xa8')]===-0x1){return _0x3b5777;}var _0x4bc600=this[_0xe032('0xa7')](_0xe032('0xbb'),_0xe032('0xd3'));if(_0x4bc600[_0xe032('0xa8')]===-0x1){return _0x4bc600;}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0xbd'),_0x1a4ba7));};AGIVertices[_0xe032('0x16')][_0xe032('0xd4')]=function(_0x189642){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x189642[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x189642[_0xe032('0xb4')])){return this['channel'][_0xe032('0xaf')](_0xe032('0xb5'));}var _0x3b061e=_0x189642['grammar'];if(this[_0xe032('0xae')](_0x189642[_0xe032('0x7d')])){_0x3b061e+=','+_0x189642[_0xe032('0x7d')];}var _0x7141c5=this['channel'][_0xe032('0x5c')](_0xe032('0xb6'),_0x3b061e);if(_0x7141c5[_0xe032('0xa8')]===-0x1){return _0x7141c5;}var _0x16f923=this[_0xe032('0xa7')]('RECOG_CONFIDENCE()',_0xe032('0xd5'));if(_0x16f923['result']===-0x1){return _0x16f923;}var _0x19ad95=this[_0xe032('0xa7')](_0xe032('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0x19ad95[_0xe032('0xa8')]===-0x1){return _0x19ad95;}var _0x177c17=this[_0xe032('0xa7')](_0xe032('0xbb'),_0xe032('0xd6'));if(_0x177c17[_0xe032('0xa8')]===-0x1){return _0x177c17;}return this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0xbd'),_0x3b061e));};AGIVertices[_0xe032('0x16')][_0xe032('0xd7')]=function(_0x2e68a7){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xd8'),_0x2e68a7[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x2e68a7[_0xe032('0xd9')])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x2e68a7,_0xe032('0xda'));}var _0x11e38c=this[_0xe032('0xdb')][_0xe032('0x75')](this,_0x2e68a7['odbc_id']);if(!_0x11e38c){return this[_0xe032('0xf')]['error'](_0x2e68a7,_0xe032('0xdc'));}if(!this[_0xe032('0xae')](_0x2e68a7[_0xe032('0x33')])){return this[_0xe032('0xf')]['error'](_0x2e68a7,_0xe032('0xdd'));}var _0x37c8cf=_0x2e68a7[_0xe032('0x33')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0xde'),_0x37c8cf));var _0x374b01=this[_0xe032('0x2d')][_0xe032('0x75')](this,_0x11e38c,_0x37c8cf);this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x2e68a7,_0x37c8cf);if(!this['isConfigured'](_0x2e68a7['variable_id'])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xdf'));}var _0x232acf=this[_0xe032('0x12')][_0xe032('0x75')](this,_0x2e68a7[_0xe032('0xe0')]);if(!_0x232acf){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x2e68a7,_0xe032('0xe1'));}var _0x2dac74=this;_0x374b01[_0xe032('0xe2')](function(_0xe0ec0c,_0x45e5dd){Object[_0xe032('0xe3')](_0xe0ec0c)[_0xe032('0xe2')](function(_0x28ae83){_0x2dac74[_0xe032('0xf')]['setVariable'](util['format']('%s[%s][%s]',_0x232acf,_0x45e5dd,_0x28ae83),_0xe0ec0c[_0x28ae83]);});});this[_0xe032('0xf')][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0xe4'),_0x232acf),_0x374b01[_0xe032('0x9f')]);return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('variable\x20%s\x20set',_0x232acf));};AGIVertices['prototype'][_0xe032('0xe5')]=function(_0x43994f){logger[_0xe032('0xe6')](util['format'](_0xe032('0xe7'),_0x43994f[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x43994f[_0xe032('0xe8')])){return this[_0xe032('0xf')]['error'](_0x43994f,'no\x20user\x20selected');}var _0x42b287=this['getUser'][_0xe032('0x75')](this,_0x43994f[_0xe032('0xe8')]);if(!_0x42b287){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x43994f,_0xe032('0xe9'));}var _0x114138=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xea'),[util[_0xe032('0x2c')]('SIP/%s',_0x42b287),_0x43994f['timeout'],_0x43994f[_0xe032('0xeb')],_0x43994f[_0xe032('0x78')]]);if(_0x114138['result']===-0x1){return _0x114138;}return this['channel']['noop'](util[_0xe032('0x2c')](_0xe032('0xec'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x55f5c0){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xed'),_0x55f5c0[_0xe032('0x3d')]));if(!this['isConfigured'](_0x55f5c0[_0xe032('0x7f')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xee'));}if(!this[_0xe032('0xae')](_0x55f5c0[_0xe032('0x62')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}this[_0xe032('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x55f5c0);this[_0xe032('0x46')](_0x55f5c0['text'],'in','','');this['channel']['noop'](util[_0xe032('0x2c')](_0xe032('0xef'),_0x55f5c0[_0xe032('0x62')]));var _0x2c69ad=this[_0xe032('0x7e')][_0xe032('0x75')](this,_0x55f5c0);if(_0x2c69ad){for(var _0x4ef45b in _0x2c69ad){if(_0x2c69ad[_0xe032('0x9c')](_0x4ef45b)){this['channel'][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0xf0'),_0x4ef45b[_0xe032('0x70')]()),_0x2c69ad[_0x4ef45b]);}}this['createSquareMessage'](_0x2c69ad[_0xe032('0xf1')],'out',_0xe032('0xf2'),'');return this['channel']['noop'](util[_0xe032('0x2c')](_0xe032('0xf3'),_0x2c69ad[_0xe032('0xf1')]));}return this[_0xe032('0xf')][_0xe032('0x2f')](_0x55f5c0,_0xe032('0xf4'));};AGIVertices[_0xe032('0x16')][_0xe032('0xf5')]=function(_0x460f76){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xf6'),_0x460f76['label']));if(!this['isConfigured'](_0x460f76[_0xe032('0x82')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xf7'));}if(!this['isConfigured'](_0x460f76[_0xe032('0xf8')])){return this[_0xe032('0xf')][_0xe032('0xaf')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x460f76[_0xe032('0x83')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xf9'));}if(!this[_0xe032('0xae')](_0x460f76[_0xe032('0x84')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xfa'));}if(!this[_0xe032('0xae')](_0x460f76[_0xe032('0x62')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xb0'));}this[_0xe032('0xf')]['bot']=!![];this[_0xe032('0x3b')](_0x460f76);this[_0xe032('0x46')](_0x460f76['text'],'in','','');this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0xfb'),_0x460f76[_0xe032('0x62')]));var _0xcaada0=this[_0xe032('0x81')][_0xe032('0x75')](this,_0x460f76);if(_0xcaada0){for(var _0x5d703f in _0xcaada0){if(_0xcaada0[_0xe032('0x9c')](_0x5d703f)){if(_0x5d703f!==_0xe032('0xfc')){this[_0xe032('0xf')][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0xf0'),_0x5d703f[_0xe032('0x70')]()),_0xcaada0[_0x5d703f]);}}}this[_0xe032('0x46')](_0xcaada0[_0xe032('0xf1')],_0xe032('0xfd'),_0xe032('0xf5'),_0xcaada0['providerResponse']);return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')]('DialogflowV2\x20Result\x20%s',_0xcaada0[_0xe032('0xf1')]));}return this[_0xe032('0xf')][_0xe032('0x2f')](_0x460f76,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xe032('0x16')]['sesteknda']=function(_0x4e108b){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0xfe'),_0x4e108b[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x4e108b[_0xe032('0xff')])){return this['channel'][_0xe032('0xaf')](_0xe032('0x100'));}if(!this[_0xe032('0xae')](_0x4e108b[_0xe032('0x101')])){return this[_0xe032('0xf')][_0xe032('0xaf')]('no\x20username\x20configured');}if(!this[_0xe032('0xae')](_0x4e108b['password'])){return this[_0xe032('0xf')][_0xe032('0xaf')]('no\x20password\x20configured');}if(!this[_0xe032('0xae')](_0x4e108b['ndassistant_url'])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}this[_0xe032('0xf')][_0xe032('0x102')]=!![];this[_0xe032('0x3b')](_0x4e108b);this['createSquareMessage'](_0x4e108b[_0xe032('0x62')],'in','','');this[_0xe032('0xf')]['noop'](util['format'](_0xe032('0x103'),_0x4e108b[_0xe032('0x62')]));var _0x5071b6=this['sestekNDA']['sync'](this,_0x4e108b);if(_0x5071b6){for(var _0x543b07 in _0x5071b6){if(_0x5071b6[_0xe032('0x9c')](_0x543b07)){this[_0xe032('0xf')][_0xe032('0xa2')](util['format'](_0xe032('0x104'),_0x543b07[_0xe032('0x70')]()),_0x5071b6[_0x543b07]);}}this['createSquareMessage'](_0x5071b6[_0xe032('0xf1')],_0xe032('0xfd'),_0xe032('0x105'),'');if(_0x5071b6[_0xe032('0x106')]){this['channel']['noop'](util[_0xe032('0x2c')](_0xe032('0x107'),_0x5071b6[_0xe032('0x106')]));var _0x28aaf7=this['channel'][_0xe032('0x108')](_0x5071b6['audiofile']);try{fs[_0xe032('0x109')](_0x5071b6[_0xe032('0x106')]+_0xe032('0x10a'));}catch(_0x49c07d){logger['error'](_0x49c07d);}return _0x28aaf7;}else{return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x10b'),_0x5071b6['speech']));}}return this['channel'][_0xe032('0x2f')](_0x4e108b,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xe032('0x16')][_0xe032('0x10c')]=function(_0x349e29){logger['info'](util[_0xe032('0x2c')]('Enter\x20in\x20END\x20(%s)\x20block',_0x349e29['label']));return this['channel'][_0xe032('0xaf')](_0xe032('0x10c'));};AGIVertices[_0xe032('0x16')][_0xe032('0x10d')]=function(_0x332acd){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x10e'),_0x332acd['label']));var _0x1ce28b='';if(_0x332acd[_0xe032('0x10f')]){if(!this[_0xe032('0xae')](_0x332acd['trunk_id'])){return this['channel'][_0xe032('0x2f')](_0x332acd,_0xe032('0x110'));}else{var _0x3c902e=parseInt(_0x332acd[_0xe032('0x10f')],0xa);if(isNaN(_0x3c902e)){_0x1ce28b=_0x332acd[_0xe032('0x10f')];}else{_0x1ce28b=this[_0xe032('0x111')]['sync'](this,_0x332acd[_0xe032('0x10f')]);if(!_0x1ce28b){return this[_0xe032('0xf')]['error'](_0x332acd,'no\x20trunk\x20found');}}}}else if(_0x332acd[_0xe032('0x112')]){_0x1ce28b=_0x332acd[_0xe032('0x112')];}else{return this['channel'][_0xe032('0x2f')](_0x332acd,_0xe032('0x110'));}var _0x34c678=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0xea'),[util[_0xe032('0x2c')](_0xe032('0x113'),_0x1ce28b,_0x332acd[_0xe032('0x4d')]),_0x332acd[_0xe032('0x6d')],_0x332acd[_0xe032('0xeb')],_0x332acd[_0xe032('0x78')]]);if(_0x34c678['result']===-0x1){return _0x34c678;}return this[_0xe032('0xf')]['noop'](util['format'](_0xe032('0xec'),_0xe032('0xea')));};AGIVertices['prototype'][_0xe032('0x114')]=function(_0x1a974d){logger['info'](util[_0xe032('0x2c')](_0xe032('0x115'),_0x1a974d[_0xe032('0x3d')]));return this[_0xe032('0xf')]['noop'](_0xe032('0x114'));};AGIVertices['prototype'][_0xe032('0xd')]=function(_0x4ce094){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x116'),_0x4ce094['label']));if(_0x4ce094[_0xe032('0xab')]===0x0){return this['maxRetry'](_0x4ce094);}_0x4ce094[_0xe032('0xab')]-=0x1;if(!this[_0xe032('0xae')](_0x4ce094[_0xe032('0x117')])){return this['channel'][_0xe032('0x2f')](_0x4ce094,_0xe032('0x118'));}var _0x2e1ffc=this[_0xe032('0x20')]['sync'](this,_0x4ce094[_0xe032('0x117')]);if(!_0x2e1ffc){return this['channel']['error'](_0x4ce094,_0xe032('0x119'));}if(!this[_0xe032('0xae')](_0x4ce094[_0xe032('0xe0')])){return this['channel'][_0xe032('0x2f')](_0xe032('0xdf'));}var _0x222a22=this['channel'][_0xe032('0x11a')](_0x2e1ffc,_0x4ce094[_0xe032('0x11b')],_0x4ce094['maxdigit']);var _0x1db928=_0x222a22[_0xe032('0xa8')]?_0x222a22[_0xe032('0xa8')]['toString']():'';logger[_0xe032('0x31')](_0xe032('0x11c'),JSON['stringify'](_0x222a22));if(_0x222a22[_0xe032('0xa8')]===-0x1){this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x4ce094,_0x1db928);return _0x222a22;}else if(_0x222a22[_0xe032('0xa6')]===_0xe032('0x6d')){_0x222a22[_0xe032('0xa8')]=_0x1db928[_0xe032('0x9f')]>=parseInt(_0x4ce094[_0xe032('0x11d')])?'x':'i';}else{_0x222a22[_0xe032('0xa8')]=_0x1db928[_0xe032('0x9f')]>=parseInt(_0x4ce094[_0xe032('0x11d')])&&_0x1db928[_0xe032('0x9f')]<=parseInt(_0x4ce094[_0xe032('0x11e')])?'x':'i';}var _0x53c71d=this[_0xe032('0x12')]['sync'](this,_0x4ce094[_0xe032('0xe0')]);if(!_0x53c71d){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x4ce094,'no\x20variable\x20found');}this[_0xe032('0xf')][_0xe032('0xa2')](_0x53c71d,_0x1db928);if(this[_0xe032('0xae')](_0x4ce094[_0xe032('0x11f')])){var _0x49fd62=parseInt(_0x4ce094[_0xe032('0x11f')],0xa);var _0x3205f5=rs[_0xe032('0x120')]({'charset':'*','length':_0x49fd62});var _0x1fd3e3=_0x1db928[_0xe032('0x9f')];if(_0x1fd3e3>0x0){if(_0x1fd3e3>_0x49fd62){this[_0xe032('0x3b')]['sync'](this,_0x4ce094,_0x4ce094['hiddendigitspos']===_0xe032('0x121')?_0x3205f5+_0x1db928[_0xe032('0x122')](_0x49fd62):_0x1db928[_0xe032('0x122')](0x0,_0x1fd3e3-_0x49fd62)+_0x3205f5);}else{this['createSquareDetailsReport'][_0xe032('0x75')](this,_0x4ce094,rs[_0xe032('0x120')]({'charset':'*','length':_0x1fd3e3}));}}else{this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x4ce094,'');}}else{this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x4ce094,_0x1db928);}return _0x222a22;};AGIVertices['prototype'][_0xe032('0xe')]=function(_0x219bb4){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x123'),_0x219bb4[_0xe032('0x3d')]));return this['getdigits'](_0x219bb4);};AGIVertices[_0xe032('0x16')][_0xe032('0x124')]=function(_0x51cb7d){logger[_0xe032('0x31')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x51cb7d[_0xe032('0x3d')]));this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x51cb7d,_0x51cb7d['goalname']);return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('GOAL\x20%s',_0x51cb7d[_0xe032('0x125')]));};AGIVertices['prototype'][_0xe032('0x126')]=function(_0xc40563){logger['info'](util[_0xe032('0x2c')](_0xe032('0x127'),_0xc40563[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0xc40563[_0xe032('0x91')])||!this[_0xe032('0xae')](_0xc40563['aws_secret_access_key'])){return this[_0xe032('0xf')][_0xe032('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe032('0xae')](_0xc40563[_0xe032('0x62')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xb0'));}this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0x128'),_0xc40563[_0xe032('0x62')]));var _0x5ee65d=this[_0xe032('0x129')][_0xe032('0x75')](this,_0xc40563);if(_0x5ee65d){this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0x12a'),_0x5ee65d));var _0x3be3d5=this[_0xe032('0xf')][_0xe032('0x108')](_0x5ee65d);try{fs['unlink'](_0x5ee65d+'.wav');}catch(_0x3e2dbe){logger[_0xe032('0x2f')](_0x3e2dbe);}return _0x3be3d5;}return this[_0xe032('0xf')]['error'](_0xc40563,_0xe032('0x12b'));};AGIVertices[_0xe032('0x16')][_0xe032('0x12c')]=function(_0x1c3e9e){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x12d'),_0x1c3e9e[_0xe032('0x3d')]));if(!this['isConfigured'](_0x1c3e9e['aws_access_key_id'])||!this[_0xe032('0xae')](_0x1c3e9e[_0xe032('0x8c')])){return this[_0xe032('0xf')]['noop'](_0xe032('0x12e'));}if(!this[_0xe032('0xae')](_0x1c3e9e[_0xe032('0x93')])){return this['channel'][_0xe032('0xaf')](_0xe032('0x12f'));}if(!this[_0xe032('0xae')](_0x1c3e9e['text'])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}this[_0xe032('0xf')][_0xe032('0x102')]=!![];this[_0xe032('0x3b')](_0x1c3e9e);this['createSquareMessage'](_0x1c3e9e[_0xe032('0x62')],'in','','');this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1c3e9e[_0xe032('0x62')]));var _0x5fa30c=this[_0xe032('0x90')][_0xe032('0x75')](this,_0x1c3e9e);if(_0x5fa30c){for(var _0x1e910a in _0x5fa30c){if(_0x5fa30c['hasOwnProperty'](_0x1e910a)&&_['isString'](_0x5fa30c[_0x1e910a])){this['channel'][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0x130'),_0x1e910a[_0xe032('0x70')]()),_0x5fa30c[_0x1e910a]);}}if(_['isNil'](_0x5fa30c[_0xe032('0x131')])){return this[_0xe032('0xf')]['noop'](_0xe032('0x132'));}else{this['createSquareMessage'](_0x5fa30c[_0xe032('0x131')],_0xe032('0xfd'),_0xe032('0x133'),'');return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x134'),_0x5fa30c['message']));}}return this['channel'][_0xe032('0x2f')](_0x1c3e9e,_0xe032('0x135'));};AGIVertices['prototype'][_0xe032('0x136')]=function(_0x1573b7){logger['info'](util[_0xe032('0x2c')](_0xe032('0x137'),_0x1573b7[_0xe032('0x3d')],_0x1573b7[_0xe032('0x6d')]));if(!this[_0xe032('0xae')](_0x1573b7[_0xe032('0x7f')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xee'));}var _0x2c6046=_0xe032('0x138');var _0x24c66b=util['format'](_0xe032('0x139'),FILES_PATH,rs[_0xe032('0x120')](0x4));var _0x5857d5=util[_0xe032('0x2c')](_0xe032('0xa1'),_0x24c66b,_0x2c6046);var _0x51da75=!![];if(_0x1573b7[_0xe032('0x13a')]==='NOBEEP'){_0x51da75=![];}var _0x27bf56=this[_0xe032('0xf')][_0xe032('0x13b')](_0x24c66b,_0x2c6046,_0x1573b7[_0xe032('0x13c')],_0x1573b7[_0xe032('0x6d')],undefined,_0x51da75);if(_0x27bf56[_0xe032('0xa8')]!==-0x1){this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0x13d'),_0x5857d5));var _0x514b7b=this[_0xe032('0x94')][_0xe032('0x75')](this,_0x1573b7,_0x5857d5);if(_0x514b7b){for(var _0x3d591a in _0x514b7b){if(_0x514b7b[_0xe032('0x9c')](_0x3d591a)){this['channel'][_0xe032('0xa2')](util['format'](_0xe032('0x13e'),_0x3d591a[_0xe032('0x70')]()),_0x514b7b[_0x3d591a]);}}return this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0x13f'),JSON[_0xe032('0x79')](_0x514b7b)));}}return _0x27bf56;};AGIVertices[_0xe032('0x16')][_0xe032('0x140')]=function(_0x4d4d94){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x141'),_0x4d4d94[_0xe032('0x3d')]));if(!this['isConfigured'](_0x4d4d94[_0xe032('0x97')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0x142'));}if(!this[_0xe032('0xae')](_0x4d4d94[_0xe032('0x143')])){return this['channel'][_0xe032('0xaf')](_0xe032('0x144'));}var _0x45e3c4=_0xe032('0x138');var _0x49bdd0=util['format'](_0xe032('0x139'),FILES_PATH,rs[_0xe032('0x120')](0x4));var _0x431164=util[_0xe032('0x2c')](_0xe032('0xa1'),_0x49bdd0,_0x45e3c4);var _0x4d4994=!![];if(_0x4d4d94[_0xe032('0x13a')]===_0xe032('0x145')){_0x4d4994=![];}var _0x32a6d7=this[_0xe032('0xf')]['recordFile'](_0x49bdd0,_0x45e3c4,_0x4d4d94[_0xe032('0x13c')],_0x4d4d94[_0xe032('0x6d')],undefined,_0x4d4994);if(_0x32a6d7['result']!==-0x1){this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0x146'),_0x431164));var _0x18ef9f=this[_0xe032('0x96')][_0xe032('0x75')](this,_0x4d4d94,_0x431164);if(_0x18ef9f){for(var _0x4e8776 in _0x18ef9f){if(_0x18ef9f['hasOwnProperty'](_0x4e8776)){this['channel'][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0x147'),_0x4e8776[_0xe032('0x70')]()),_0x18ef9f[_0x4e8776]);}}return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x148'),JSON['stringify'](_0x18ef9f)));}}return _0x32a6d7;};AGIVertices[_0xe032('0x16')]['gotoc']=function(_0x2ef95a){logger[_0xe032('0x31')](util['format'](_0xe032('0x149'),_0x2ef95a[_0xe032('0x3d')]));return this['channel']['continueAt'](_0x2ef95a[_0xe032('0x14a')],_0x2ef95a[_0xe032('0x14b')],_0x2ef95a[_0xe032('0x42')]);};AGIVertices['prototype']['gotoif']=function(_0x4bf563){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x14c'),_0x4bf563[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x4bf563[_0xe032('0x14d')])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x4bf563,_0xe032('0x14e'));}try{var _0x1fa7d7=eval(_0x4bf563[_0xe032('0x14d')])?_0xe032('0x14f'):_0xe032('0x150');this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0x151'),_0x4bf563['condition'],_0x1fa7d7));return{'code':0xc8,'result':_0x1fa7d7};}catch(_0x156b12){return{'code':0xc8,'result':_0xe032('0x150')};}};AGIVertices[_0xe032('0x16')][_0xe032('0x152')]=function(_0xf7d22b){logger['info'](util[_0xe032('0x2c')](_0xe032('0x153'),_0xf7d22b[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0xf7d22b[_0xe032('0x154')])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0xf7d22b,_0xe032('0x155'));}var _0x210867=this[_0xe032('0x26')]['sync'](this,_0xf7d22b[_0xe032('0x154')]);if(!_0x210867){return this[_0xe032('0xf')][_0xe032('0x2f')](_0xf7d22b,_0xe032('0x156'));}for(var _0x231b7f=0x0;_0x231b7f<_0x210867[_0xe032('0x9f')];_0x231b7f+=0x1){var _0xbda40e=this[_0xe032('0xf')]['getVariable'](util[_0xe032('0x2c')]('IFTIME(%s?true:false)',_0x210867[_0x231b7f]));if(_0xbda40e[_0xe032('0xa8')]===-0x1){return _0xbda40e;}logger[_0xe032('0x31')](util[_0xe032('0x2c')]('IFTIME\x20%s\x20%s',_0x210867[_0x231b7f],_0xbda40e[_0xe032('0xa6')]));if(_0xbda40e[_0xe032('0xa6')]==='true'){logger['info'](util[_0xe032('0x2c')](_0xe032('0x157'),_0x210867[_0x231b7f],_0xe032('0x14f')));this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('IFTIME\x20%s\x20%s',_0x210867[_0x231b7f],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x157'),_0x210867[_0x231b7f],'false'));this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0x157'),_0x210867[_0x231b7f],_0xe032('0x150')));}}return{'code':0xc8,'result':_0xe032('0x150')};};AGIVertices[_0xe032('0x16')]['hangup']=function(_0x25f999){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x25f999[_0xe032('0x3d')]));return this[_0xe032('0xf')][_0xe032('0x158')]();};AGIVertices[_0xe032('0x16')][_0xe032('0x159')]=function(_0x4f2fb0){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4f2fb0['label']));if(!this['isConfigured'](_0x4f2fb0['key'])){return this[_0xe032('0xf')]['noop'](_0xe032('0xee'));}var _0x33369=_0xe032('0x138');var _0x37bcde=util['format'](_0xe032('0x139'),FILES_PATH,rs[_0xe032('0x120')](0x4));var _0x51ba35=util[_0xe032('0x2c')]('%s.%s',_0x37bcde,_0x33369);var _0x5cf4ef=!![];if(_0x4f2fb0['beep']===_0xe032('0x145')){_0x5cf4ef=![];}var _0x7a380c=this[_0xe032('0xf')][_0xe032('0x13b')](_0x37bcde,_0x33369,_0x4f2fb0[_0xe032('0x13c')],_0x4f2fb0[_0xe032('0x6d')],undefined,_0x5cf4ef);if(_0x7a380c['result']!==-0x1){this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x15a'),_0x51ba35));var _0x5261bc=this[_0xe032('0x89')][_0xe032('0x75')](this,_0x4f2fb0,_0x51ba35);if(_0x5261bc){for(var _0x5e9cdf in _0x5261bc){if(_0x5261bc[_0xe032('0x9c')](_0x5e9cdf)){this[_0xe032('0xf')][_0xe032('0xa2')](util['format'](_0xe032('0x15b'),_0x5e9cdf[_0xe032('0x70')]()),_0x5261bc[_0x5e9cdf]);}}return this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x15c'),JSON[_0xe032('0x79')](_0x5261bc)));}}return _0x7a380c;};AGIVertices[_0xe032('0x16')][_0xe032('0x15d')]=function(_0x199cf1){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x199cf1[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x199cf1[_0xe032('0x7f')])){return this['channel'][_0xe032('0xaf')](_0xe032('0xee'));}if(!this['isConfigured'](_0x199cf1[_0xe032('0x62')])){return this[_0xe032('0xf')]['noop'](_0xe032('0xb0'));}this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x15e'),_0x199cf1[_0xe032('0x62')]));var _0x1dbb2d=this['ispeechTTS'][_0xe032('0x75')](this,_0x199cf1);if(_0x1dbb2d){this['channel'][_0xe032('0xaf')](util['format'](_0xe032('0x15a'),_0x1dbb2d));var _0x26877a=this[_0xe032('0xf')][_0xe032('0x108')](_0x1dbb2d,_0x199cf1[_0xe032('0x13c')]);try{fs[_0xe032('0x109')](_0x1dbb2d+'.wav');}catch(_0x432fd5){logger[_0xe032('0x2f')](_0x432fd5);}return _0x26877a;}return this[_0xe032('0xf')]['error'](_0x199cf1,_0xe032('0x15f'));};AGIVertices[_0xe032('0x16')][_0xe032('0x160')]=function(_0x165cdf){logger['info'](util[_0xe032('0x2c')](_0xe032('0x161'),_0x165cdf[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x165cdf[_0xe032('0x162')])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x165cdf,_0xe032('0x163'));}logger['info'](util[_0xe032('0x2c')](_0xe032('0x164'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x165cdf['findBy']));var _0x2f5cdd=this[_0xe032('0x5a')][_0xe032('0x75')](this,_0x165cdf[_0xe032('0x162')]);if(_0x2f5cdd){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x165'),this['channel'][_0xe032('0x3f')],_0x165cdf[_0xe032('0x162')]));this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe032('0xf')][_0xe032('0x3f')],_0x165cdf[_0xe032('0x162')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x166'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x165cdf[_0xe032('0x162')]));this['channel'][_0xe032('0xaf')](util['format'](_0xe032('0x166'),this[_0xe032('0xf')]['callerid'],_0x165cdf[_0xe032('0x162')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xe032('0x167')]=function(_0x5ae310){logger[_0xe032('0x31')](util['format'](_0xe032('0x168'),_0x5ae310[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x5ae310[_0xe032('0x162')])){return this[_0xe032('0xf')]['error'](_0x5ae310,_0xe032('0x163'));}logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x164'),this['channel'][_0xe032('0x3f')],_0x5ae310[_0xe032('0x162')]));var _0x2d0116=this[_0xe032('0x59')][_0xe032('0x75')](this,_0x5ae310[_0xe032('0x162')]);if(_0x2d0116){logger['info'](util[_0xe032('0x2c')](_0xe032('0x165'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x5ae310[_0xe032('0x162')]));this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x165'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x5ae310['findBy']));return{'code':0xc8,'result':_0xe032('0x169')};}else{logger[_0xe032('0x31')](util['format'](_0xe032('0x166'),this[_0xe032('0xf')]['callerid'],_0x5ae310[_0xe032('0x162')]));this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0x166'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x5ae310[_0xe032('0x162')]));return{'code':0xc8,'result':_0xe032('0x16a')};}};AGIVertices['prototype'][_0xe032('0x16b')]=function(_0x72583f){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x72583f[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x72583f['operation'])){return this['channel'][_0xe032('0x2f')](_0x72583f,'no\x20operation\x20configured');}this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x16c'),_0x72583f['operation']));var _0x2558bc=eval(_0x72583f[_0xe032('0x16d')]);if(!this[_0xe032('0xae')](_0x72583f['variable_id'])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xdf'));}var _0x63d112=this['getVariable'][_0xe032('0x75')](this,_0x72583f['variable_id']);if(!_0x63d112){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x72583f,_0xe032('0xe1'));}if(_[_0xe032('0x9e')](_0x2558bc)){var _0x334d68=this;_0x2558bc['forEach'](function(_0x109303,_0x2749d8){_0x334d68[_0xe032('0xf')][_0xe032('0xa2')](util[_0xe032('0x2c')](_0xe032('0x16e'),_0x63d112,_0x2749d8),_0x109303);});return this[_0xe032('0xf')][_0xe032('0xaf')](util['format'](_0xe032('0x16f'),_0x63d112));}else{return this[_0xe032('0xf')]['setVariable'](_0x63d112,_0x2558bc);}};AGIVertices[_0xe032('0x16')][_0xe032('0xc')]=function(_0x5a72eb){logger['info'](util[_0xe032('0x2c')](_0xe032('0x170'),_0x5a72eb[_0xe032('0x3d')]));if(_0x5a72eb[_0xe032('0xab')]===0x0){return this[_0xe032('0xaa')](_0x5a72eb);}_0x5a72eb[_0xe032('0xab')]-=0x1;if(!this[_0xe032('0xae')](_0x5a72eb['file_id'])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x5a72eb,_0xe032('0x118'));}var _0x21ebac=this[_0xe032('0x20')]['sync'](this,_0x5a72eb[_0xe032('0x117')]);if(!_0x21ebac){return this[_0xe032('0xf')]['error'](_0x5a72eb,_0xe032('0x119'));}var _0x1211e9=this['channel'][_0xe032('0x11a')](_0x21ebac,_0x5a72eb[_0xe032('0x11b')],_0x5a72eb[_0xe032('0x171')]);var _0x54a758=_0x1211e9[_0xe032('0xa8')];if(_0x1211e9[_0xe032('0xa8')]===-0x1){this['createSquareDetailsReport'][_0xe032('0x75')](this,_0x5a72eb,'-1');return _0x1211e9;}else if(_0x1211e9[_0xe032('0xa6')]===_0xe032('0x6d')){_0x1211e9[_0xe032('0xa8')]=_0x1211e9[_0xe032('0xa8')][_0xe032('0x9f')]>0x0?_0x1211e9['result']:'t';}else if(_[_0xe032('0x48')](_0x1211e9[_0xe032('0xa8')])){_0x1211e9[_0xe032('0xa8')]='#';_0x54a758='#';}if(!this['isConfigured'](_0x5a72eb[_0xe032('0xe0')])){this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xdf'));}else{var _0x4312e6=this[_0xe032('0x12')][_0xe032('0x75')](this,_0x5a72eb[_0xe032('0xe0')]);if(!_0x4312e6){return this['channel'][_0xe032('0x2f')](_0x5a72eb,_0xe032('0xe1'));}this[_0xe032('0xf')][_0xe032('0xa2')](_0x4312e6,_0x54a758);}this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x5a72eb,_0x54a758);return _0x1211e9;};AGIVertices['prototype'][_0xe032('0xaf')]=function(_0xbd9acc){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x172'),_0xbd9acc[_0xe032('0x3d')]));return this[_0xe032('0xf')][_0xe032('0xaf')](_0xbd9acc['output']||_0xbd9acc[_0xe032('0x3d')]);};AGIVertices[_0xe032('0x16')][_0xe032('0x173')]=function(_0x2f3830){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x174'),_0x2f3830[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x2f3830[_0xe032('0x162')])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x2f3830,_0xe032('0x163'));}logger[_0xe032('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe032('0xf')][_0xe032('0x3f')],_0x2f3830[_0xe032('0x162')]));var _0x34a9dd=this[_0xe032('0x54')][_0xe032('0x75')](this,_0x2f3830[_0xe032('0x175')]);var _0x4406d2=this[_0xe032('0x56')]['sync'](this,_0x2f3830[_0xe032('0x162')],_0x34a9dd);if(_0x4406d2){logger['info'](util['format'](_0xe032('0x165'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x2f3830[_0xe032('0x162')]));this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x165'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x2f3830[_0xe032('0x162')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x166'),this['channel'][_0xe032('0x3f')],_0x2f3830[_0xe032('0x162')]));this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0x165'),this['channel']['callerid'],_0x2f3830[_0xe032('0x162')]));return{'code':0xc8,'result':_0xe032('0x16a')};}};AGIVertices['prototype']['playback']=function(_0x4b1a57){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x176'),_0x4b1a57[_0xe032('0x3d')]));if(!this['isConfigured'](_0x4b1a57[_0xe032('0x117')])){return this[_0xe032('0xf')]['error'](_0x4b1a57,'no\x20file\x20audio\x20selected');}var _0x560f46=this[_0xe032('0x20')]['sync'](this,_0x4b1a57[_0xe032('0x117')]);if(!_0x560f46){return this['channel'][_0xe032('0x2f')](_0x4b1a57,'no\x20file\x20audio\x20found');}var _0x4cc730=this[_0xe032('0xf')][_0xe032('0x5c')]('PLAYBACK',[_0x560f46,_0x4b1a57[_0xe032('0xeb')]]);if(_0x4cc730['result']===-0x1){return _0x4cc730;}return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0xca'),'PLAYBACK',_0x560f46));};AGIVertices['prototype'][_0xe032('0x177')]=function(_0x28d956){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x178'),_0x28d956[_0xe032('0x3d')]));if(!this['isConfigured'](_0x28d956['queue_id'])){return this['channel'][_0xe032('0x2f')](_0x28d956,_0xe032('0x179'));}var _0x5b2944='';var _0xc04b44=parseInt(_0x28d956['queue_id'],0xa);if(isNaN(_0xc04b44)){_0x5b2944=_0x28d956[_0xe032('0x17a')];}else{_0x5b2944=this[_0xe032('0x17')]['sync'](this,_0x28d956['queue_id']);if(!_0x5b2944){return this[_0xe032('0xf')]['error'](_0x28d956,'no\x20queue\x20found');}}var _0x4889bd='';if(this[_0xe032('0xae')](_0x28d956[_0xe032('0x117')])){var _0x3cf958=this[_0xe032('0x20')]['sync'](this,_0x28d956[_0xe032('0x117')]);if(_0x3cf958){_0x4889bd=_0x3cf958;}}this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x28d956,_0x5b2944);if(_0x28d956[_0xe032('0xeb')][_0xe032('0x17b')]('x')<0x0){_0x28d956[_0xe032('0xeb')]+='x';}if(_0x28d956[_0xe032('0xeb')][_0xe032('0x17b')]('X')<0x0){_0x28d956[_0xe032('0xeb')]+='X';}this[_0xe032('0xf')]['setVariable'](_0xe032('0x17c'),_0x5b2944?_0x5b2944[_0xe032('0x17d')]():'');var _0x14550f=this[_0xe032('0xf')]['exec'](_0xe032('0x17e'),[_0x5b2944,_0x28d956[_0xe032('0xeb')],_0x28d956[_0xe032('0x78')],_0x4889bd,_0x28d956[_0xe032('0x6d')],_0x28d956['agi'],_0x28d956['macro'],_0x28d956[_0xe032('0x17f')],'',_0x28d956['position']]);if(_0x14550f[_0xe032('0xa8')]===-0x1){return _0x14550f;}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')]('Executed\x20command\x20%s\x20%s',_0xe032('0x17e'),_0x5b2944));};AGIVertices[_0xe032('0x16')][_0xe032('0x180')]=function(_0x52b085){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x181'),_0x52b085['label']));var _0x4dc925=_0x52b085[_0xe032('0x182')]||_0xe032('0x138');var _0x3d014b=util[_0xe032('0x2c')](_0xe032('0x183'),this[_0xe032('0xf')][_0xe032('0x3c')],rs[_0xe032('0x120')](0x5));var _0x5b493e=util[_0xe032('0x2c')](_0xe032('0x184'),FILES_PATH,_0x3d014b,_0x4dc925);var _0x4cb2cd=util['format']('%s/recordings/%s',FILES_PATH,_0x3d014b);this[_0xe032('0x40')][_0xe032('0x75')](this,_0x52b085,_0x3d014b,_0x5b493e);this[_0xe032('0xf')][_0xe032('0xa2')]('RECORDING_SAVENAME',_0x3d014b);logger['info'](_0xe032('0x185'),_0x4cb2cd,_0x4dc925,_0x52b085[_0xe032('0x186')],_0x52b085[_0xe032('0x6d')]);return this[_0xe032('0xf')][_0xe032('0x13b')](_0x4cb2cd,_0x4dc925,_0x52b085[_0xe032('0x186')],_0x52b085[_0xe032('0x6d')],undefined,!![]);};AGIVertices['prototype'][_0xe032('0x187')]=function(_0xe9bc8f){logger['info'](util[_0xe032('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xe9bc8f['label']));if(!this[_0xe032('0xae')](_0xe9bc8f['url'])){return this['channel']['noop'](_0xe032('0x188'));}var _0xbb2e12=this['restAPI'][_0xe032('0x75')](this,_0xe9bc8f);logger['info'](util[_0xe032('0x2c')](_0xe032('0x189'),util[_0xe032('0x18a')](_0xbb2e12,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xe9bc8f[_0xe032('0xe0')])){return this[_0xe032('0xf')]['noop'](_0xe032('0x18b'));}var _0x30c461=this[_0xe032('0x12')][_0xe032('0x75')](this,_0xe9bc8f['variable_id']);if(!_0x30c461){return this['channel'][_0xe032('0x2f')](_0xe9bc8f,_0xe032('0xe1'));}this[_0xe032('0xf')]['setVariable'](util['format'](_0xe032('0x18c'),_0x30c461),_0xbb2e12[_0xe032('0x7b')]?_0xbb2e12[_0xe032('0x7b')]:_0xe032('0x18d'));this[_0xe032('0xf')][_0xe032('0xa2')](util['format']('%s_STATUS_MESSAGE',_0x30c461),_0xbb2e12['statusMessage']?_0xbb2e12[_0xe032('0x18e')]:'OK');if(_0xbb2e12[_0xe032('0x71')]){try{this[_0xe032('0xa0')](_0xbb2e12['body'],_0x30c461);}catch(_0x5208c0){logger[_0xe032('0x2f')](util[_0xe032('0x2c')](_0xe032('0x18f'),_0x30c461));}}return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x190'),_0x30c461));};AGIVertices['prototype']['saydigits']=function(_0x979625){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x979625[_0xe032('0x3d')]));return this[_0xe032('0xf')][_0xe032('0x191')](_0x979625['digits'][_0xe032('0x5e')](/\s+/g,''),_0x979625[_0xe032('0x186')]);};AGIVertices[_0xe032('0x16')][_0xe032('0x192')]=function(_0x638b41){logger[_0xe032('0x31')](util['format'](_0xe032('0x193'),_0x638b41['label']));return this[_0xe032('0xf')][_0xe032('0x194')](_0x638b41[_0xe032('0x6c')][_0xe032('0x5e')](/\s+/g,''),_0x638b41['escape_digits']);};AGIVertices[_0xe032('0x16')][_0xe032('0x195')]=function(_0x2a671c){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x196'),_0x2a671c['label']));return this['channel'][_0xe032('0x197')](_0x2a671c[_0xe032('0x62')],_0x2a671c['escape_digits']);};AGIVertices[_0xe032('0x16')][_0xe032('0x198')]=function(_0x58c7f6){logger['info'](util[_0xe032('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x58c7f6[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x58c7f6[_0xe032('0x199')])){return this[_0xe032('0xf')]['noop'](_0xe032('0x19a'));}var _0x5909cc=this[_0xe032('0x19b')]['sync'](this,_0x58c7f6[_0xe032('0x199')]);if(!_0x5909cc||!_0x5909cc[_0xe032('0x19c')]){return this['channel'][_0xe032('0x2f')](_0x58c7f6,'no\x20mail\x20account\x20found');}var _0x234c43={'from':util[_0xe032('0x2c')](_0xe032('0x19d'),_0x5909cc[_0xe032('0x19')],_0x5909cc['email']||_0x5909cc[_0xe032('0x19c')][_0xe032('0x19e')]),'to':_0x58c7f6['to']||'','cc':_0x58c7f6['cc']||'','bcc':_0x58c7f6[_0xe032('0x19f')]||'','subject':_0x58c7f6[_0xe032('0x1a0')],'html':_0x58c7f6['text'],'text':_0x58c7f6[_0xe032('0x62')]};if(this['isConfigured'](_0x58c7f6[_0xe032('0x1a1')])){}logger[_0xe032('0xe6')](_0xe032('0x1a2'),JSON[_0xe032('0x79')](_0x234c43));this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x58c7f6,_0x58c7f6['account_id']);this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1a3'),_0x5909cc[_0xe032('0x19')]));this[_0xe032('0x25')][_0xe032('0x75')](this,_0x5909cc[_0xe032('0x1a4')],_0x234c43);return this['channel'][_0xe032('0xaf')](_0xe032('0x1a5'));};AGIVertices['prototype'][_0xe032('0x1a6')]=function(_0x4de22){logger['info'](util[_0xe032('0x2c')](_0xe032('0x1a7'),_0x4de22['label']));return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0x1a8'));};AGIVertices['prototype'][_0xe032('0x1a9')]=function(_0x501f4c){logger['info'](util[_0xe032('0x2c')](_0xe032('0x1aa'),_0x501f4c[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x501f4c['sms_account_id'])){return this['channel'][_0xe032('0xaf')]('no\x20sms\x20account\x20configured');}var _0x2fa33f=this[_0xe032('0x38')][_0xe032('0x75')](this,_0x501f4c[_0xe032('0x1ab')]);if(!_0x2fa33f){return this['channel'][_0xe032('0x2f')](_0x501f4c,_0xe032('0x1ac'));}var _0x5dbdd9={'body':_0x501f4c['sms_text'],'phone':_0x501f4c['to']||'','SmsAccountId':_0x2fa33f['id']};logger[_0xe032('0xe6')](_0xe032('0x1ad'),JSON[_0xe032('0x79')](_0x5dbdd9));this[_0xe032('0x3b')]['sync'](this,_0x501f4c,_0x501f4c[_0xe032('0x1ab')]);this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1ae'),_0x2fa33f[_0xe032('0x19')]));this[_0xe032('0x3a')]['sync'](this,_0x5dbdd9);return this[_0xe032('0xf')][_0xe032('0xaf')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x3a7cad){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3a7cad[_0xe032('0x3d')]));if(!this['isConfigured'](_0x3a7cad['variable_id'])){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x3a7cad,_0xe032('0x1af'));}var _0xe8230=this[_0xe032('0x12')]['sync'](this,_0x3a7cad[_0xe032('0xe0')]);if(!_0xe8230){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x3a7cad,_0xe032('0xe1'));}return this[_0xe032('0xf')][_0xe032('0xa2')](_0xe8230,_0x3a7cad[_0xe032('0x1b0')]);};AGIVertices[_0xe032('0x16')][_0xe032('0x1b1')]=function(_0x44a290){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x44a290[_0xe032('0x3d')]));this[_0xe032('0xf')]['noop'](_0xe032('0x1b2'));var _0x593956=this[_0xe032('0xf')][_0xe032('0x12')](_0xe032('0x1b3'));if(!_[_0xe032('0x48')](_0x593956[_0xe032('0xa6')])){this[_0xe032('0xf')][_0xe032('0x3c')]=_0x593956[_0xe032('0xa6')];}if(_0x44a290[_0xe032('0xc0')]==='yes'){this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0x1b4'));return this[_0xe032('0xf')]['answer']();}return this['channel'][_0xe032('0xaf')](_0xe032('0x1b5'));};AGIVertices[_0xe032('0x16')][_0xe032('0x1b6')]=function(_0x251d91){logger[_0xe032('0x31')](util['format'](_0xe032('0x1b7'),_0x251d91[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x251d91[_0xe032('0x1b8')])){return this['channel'][_0xe032('0x2f')](_0x251d91,_0xe032('0x1b9'));}var _0x20995b=this[_0xe032('0x1a')]['sync'](this,_0x251d91[_0xe032('0x1b8')]);if(!this[_0xe032('0xae')](_0x20995b)){return this[_0xe032('0xf')]['error'](_0x251d91,util[_0xe032('0x2c')](_0xe032('0x1ba'),_0x251d91[_0xe032('0x1b8')]));}if(_0x20995b===this['channel'][_0xe032('0x44')]){return this[_0xe032('0xf')][_0xe032('0x2f')](_0x251d91,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x251d91,_0x20995b);var _0x3e6bf4=this[_0xe032('0xf')]['exec'](_0xe032('0x1bb'),util[_0xe032('0x2c')](_0xe032('0x1bc'),config[_0xe032('0x6')][_0xe032('0x1bd')]||_0xe032('0x1be'),_0x20995b,this[_0xe032('0xf')][_0xe032('0x44')]));if(_0x3e6bf4[_0xe032('0xa8')]===-0x1){return _0x3e6bf4;}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0xca'),_0xe032('0x1bb'),_0x20995b));};AGIVertices[_0xe032('0x16')][_0xe032('0x1bf')]=function(_0x404038){logger['info'](util[_0xe032('0x2c')](_0xe032('0x1c0'),_0x404038[_0xe032('0x3d')]));var _0x8dd1bd=this['shellCommand']['sync'](this,_0x404038[_0xe032('0xbf')]);this[_0xe032('0x3b')][_0xe032('0x75')](this,_0x404038,_0x404038[_0xe032('0xbf')]);if(this[_0xe032('0xae')](_0x404038['variable_id'])){var _0x5903d1=this['getVariable'][_0xe032('0x75')](this,_0x404038[_0xe032('0xe0')]);if(_0x5903d1){this[_0xe032('0xf')][_0xe032('0xa2')](_0x5903d1,_0x8dd1bd);return this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1c1'),_0x404038['command'],_0x5903d1));}}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x404038[_0xe032('0xbf')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x1b61ef){logger[_0xe032('0x31')](util['format'](_0xe032('0x1c2'),_0x1b61ef[_0xe032('0x3d')]));_0x1b61ef[_0xe032('0x62')]=_0x1b61ef['text'][_0xe032('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe032('0xae')](_0x1b61ef[_0xe032('0x60')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0x1c3'));}if(!this[_0xe032('0xae')](_0x1b61ef['text'])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}this[_0xe032('0xf')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1b61ef['text']));var _0x362eb3=this[_0xe032('0x5f')]['sync'](this,_0x1b61ef);if(_0x362eb3){this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1c4'),_0x362eb3));var _0xfda633=this[_0xe032('0xf')][_0xe032('0x108')](_0x362eb3);try{fs['unlink'](_0x362eb3+'.wav');}catch(_0x5d60ce){logger[_0xe032('0x2f')](_0x5d60ce);}return _0xfda633;}return this['channel'][_0xe032('0x2f')](_0x1b61ef,_0xe032('0x1c5'));};AGIVertices[_0xe032('0x16')][_0xe032('0x1c6')]=function(_0x4d13c3){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4d13c3[_0xe032('0x3d')]));_0x4d13c3[_0xe032('0x62')]=_0x4d13c3[_0xe032('0x62')][_0xe032('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe032('0xae')](_0x4d13c3[_0xe032('0x62')])){return this[_0xe032('0xf')][_0xe032('0xaf')](_0xe032('0xb0'));}this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1c7'),_0x4d13c3[_0xe032('0x62')]));var _0x4508c4=this['googleTTS'][_0xe032('0x75')](this,_0x4d13c3);if(_0x4508c4){this['channel'][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x1c8'),_0x4508c4));var _0x7c91ee=this[_0xe032('0xf')]['streamFile'](_0x4508c4);try{fs[_0xe032('0x109')](_0x4508c4+_0xe032('0x10a'));}catch(_0x5e392a){logger[_0xe032('0x2f')](_0x5e392a);}return _0x7c91ee;}return this[_0xe032('0xf')]['error'](_0x4d13c3,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xe032('0x16')][_0xe032('0x1c9')]=function(_0x1597a9){logger[_0xe032('0x31')](util[_0xe032('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1597a9[_0xe032('0x3d')]));if(!this[_0xe032('0xae')](_0x1597a9[_0xe032('0x162')])){return this['channel']['error'](_0x1597a9,_0xe032('0x163'));}logger['info'](util[_0xe032('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe032('0xf')][_0xe032('0x3f')],_0x1597a9[_0xe032('0x162')]));var _0x2f0ba6=this[_0xe032('0x58')]['sync'](this,_0x1597a9[_0xe032('0x162')]);if(_0x2f0ba6){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x165'),this[_0xe032('0xf')][_0xe032('0x3f')],_0x1597a9[_0xe032('0x162')]));this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x165'),this[_0xe032('0xf')]['callerid'],_0x1597a9[_0xe032('0x162')]));return{'code':0xc8,'result':_0xe032('0x169')};}else{logger[_0xe032('0x31')](util[_0xe032('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe032('0xf')][_0xe032('0x3f')],_0x1597a9['findBy']));this[_0xe032('0xf')][_0xe032('0xaf')](util[_0xe032('0x2c')](_0xe032('0x166'),this[_0xe032('0xf')]['callerid'],_0x1597a9[_0xe032('0x162')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x2882f0){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2882f0[_0xe032('0x3d')]));var _0x46a493=this[_0xe032('0xf')][_0xe032('0x5c')](_0xe032('0x1ca'),[_0x2882f0[_0xe032('0x1cb')],_0x2882f0[_0xe032('0x7d')]]);if(_0x46a493[_0xe032('0xa8')]===-0x1){return _0x46a493;}return this[_0xe032('0xf')]['noop'](util[_0xe032('0x2c')](_0xe032('0xca'),_0xe032('0x1ca'),_0x2882f0[_0xe032('0x1cb')]));};AGIVertices['prototype'][_0xe032('0x1cc')]=function(_0x17e9a4){logger[_0xe032('0x31')](util[_0xe032('0x2c')](_0xe032('0x1cd'),_0x17e9a4['label']));if(!this[_0xe032('0xae')](_0x17e9a4[_0xe032('0xe0')])){return this['channel']['error'](_0x17e9a4,_0xe032('0x1af'));}var _0x4ee571=this['getVariable']['sync'](this,_0x17e9a4['variable_id']);if(!_0x4ee571){return this['channel']['error'](_0x17e9a4,_0xe032('0xe1'));}var _0x6f2e0d=this[_0xe032('0xf')][_0xe032('0x12')](_0x4ee571);return{'code':0xc8,'result':_0x6f2e0d['extra']?_0x6f2e0d[_0xe032('0xa6')]:'-'};};String[_0xe032('0x16')][_0xe032('0xa5')]=function(_0x4fd974,_0x2312b1){return this['split'](_0x4fd974)[_0xe032('0x1ce')](_0x2312b1);};module[_0xe032('0x1cf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2bb6fef..7206aaa 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 _0x6282=['[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','timer','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause'];(function(_0x45a858,_0x58de5f){var _0x168f2e=function(_0x39a108){while(--_0x39a108){_0x45a858['push'](_0x45a858['shift']());}};_0x168f2e(++_0x58de5f);}(_0x6282,0x76));var _0x2628=function(_0x1de098,_0x281154){_0x1de098=_0x1de098-0x0;var _0x45d886=_0x6282[_0x1de098];return _0x45d886;};'use strict';var _=require(_0x2628('0x0'));var moment=require(_0x2628('0x1'));var ami=require(_0x2628('0x2'));var logger=require(_0x2628('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x2628('0x4'));function Acw(_0xc5c0c7){this['voiceQueues']=_0xc5c0c7[_0x2628('0x5')];this[_0x2628('0x6')]=_0xc5c0c7[_0x2628('0x6')];this[_0x2628('0x7')]=_0xc5c0c7[_0x2628('0x7')];this['channels']={};ami['on'](_0x2628('0x8'),this[_0x2628('0x9')][_0x2628('0xa')](this));ami['on'](_0x2628('0xb'),this[_0x2628('0xc')][_0x2628('0xa')](this));ami['on'](_0x2628('0xd'),this[_0x2628('0xe')][_0x2628('0xa')](this));ami['on'](_0x2628('0xf'),this[_0x2628('0x10')][_0x2628('0xa')](this));ami['on'](_0x2628('0x11'),this[_0x2628('0x12')][_0x2628('0xa')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2628('0xa')](this));ami['on'](_0x2628('0x13'),this[_0x2628('0x14')][_0x2628('0xa')](this));}function getDiff(_0x5d0a32){var _0x49dc1b=moment()[_0x2628('0x15')](0x0);var _0x465a6f=moment(_0x5d0a32)[_0x2628('0x15')](0x0);return _0x49dc1b[_0x2628('0x16')](_0x465a6f,_0x2628('0x17'));}Acw['prototype'][_0x2628('0x18')]=function(_0x16e67a,_0x457163){var _0x4f418d=this;var _0x13a728=getDiff(_0x4f418d[_0x2628('0x7')][_0x16e67a]['lastPauseAt']);clearTimeout(_0x4f418d[_0x2628('0x7')][_0x16e67a]['timer']);_0x4f418d[_0x2628('0x7')][_0x16e67a][_0x2628('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x13a728},_0x4f418d[_0x2628('0x7')][_0x16e67a][_0x2628('0x1a')],_0x16e67a)['then'](function(_0x165824){logger['info'](_0x2628('0x1b'),_0x457163,_0x13a728,_0x165824);})['catch'](function(_0x54637f){logger[_0x2628('0x1c')](_0x2628('0x1d'),_0x457163,_0x54637f);})[_0x2628('0x1e')](function(){delete _0x4f418d[_0x2628('0x7')][_0x16e67a];});};Acw[_0x2628('0x1f')][_0x2628('0x20')]=function(_0x374887){try{var _0x41c2ba=this;var _0x1746fe=this['channels'][_0x374887][_0x2628('0x21')];var _0x267647=this[_0x2628('0x22')][_0x374887][_0x2628('0x23')];var _0x1abc7e=this['voiceQueues'][_0x267647];var _0xf65ef8=![];var _0x357717=_0x2628('0x24');if(_0x1abc7e[_0x2628('0x25')]&&_0x1abc7e[_0x2628('0x26')]['name']){_0xf65ef8=!![];_0x357717=_0x1abc7e['mandatoryDispositionPause'][_0x2628('0x27')];}if(!_0x41c2ba[_0x2628('0x6')][_0x1746fe]){return Promise[_0x2628('0x28')]();}return RpcUser[_0x2628('0x29')](_0x41c2ba[_0x2628('0x6')][_0x1746fe]['id'])['then'](function(_0x433265){if(!_0x433265||_0x433265[_0x2628('0x2a')]){logger[_0x2628('0x2b')](_0x2628('0x2c'),_0x374887,_0x1746fe,_0x267647);return;}logger[_0x2628('0x2b')](_0x2628('0x2d'),_0x374887,_0x1746fe,_0x267647);var _0x49480f=_0x41c2ba['channels'][_0x374887][_0x2628('0x2e')]&&_0x41c2ba[_0x2628('0x22')][_0x374887][_0x2628('0x2f')]?_0x41c2ba[_0x2628('0x22')][_0x374887]['destlinkedid']:_0x374887;return RpcUser[_0x2628('0x30')](_0x41c2ba[_0x2628('0x6')][_0x1746fe],_0x357717,_0x49480f);})[_0x2628('0x31')](function(_0x32e089){if(_0xf65ef8||!_0x32e089){return;}_0x41c2ba['timers'][_0x1746fe]={};logger[_0x2628('0x2b')](_0x2628('0x32'),_0x374887,_0x41c2ba[_0x2628('0x5')][_0x267647][_0x2628('0x33')],_0x1746fe,_0x267647);_0x41c2ba['timers'][_0x1746fe][_0x2628('0x19')]=setTimeout(_0x41c2ba[_0x2628('0x34')][_0x2628('0xa')](_0x41c2ba,_0x1746fe),_0x41c2ba[_0x2628('0x5')][_0x267647][_0x2628('0x33')]*0x3e8);_0x41c2ba[_0x2628('0x7')][_0x1746fe][_0x2628('0x35')]=moment()[_0x2628('0x36')](_0x2628('0x37'));_0x41c2ba['timers'][_0x1746fe][_0x2628('0x1a')]=_0x374887;_0x41c2ba[_0x2628('0x7')][_0x1746fe][_0x2628('0x23')]=_0x267647;_0x41c2ba[_0x2628('0x7')][_0x1746fe][_0x2628('0x18')]=_0x41c2ba['updateAcw']['bind'](_0x41c2ba,_0x1746fe,_0x374887);})[_0x2628('0x38')](function(){logger[_0x2628('0x1c')](_0x2628('0x32'),_0x374887,_0x41c2ba['voiceQueues'][_0x267647][_0x2628('0x33')],_0x1746fe,_0x267647);})[_0x2628('0x1e')](function(){delete _0x41c2ba[_0x2628('0x22')][_0x374887];});}catch(_0x495469){logger[_0x2628('0x1c')](_0x2628('0x39'),_0x495469[_0x2628('0x3a')]);}};Acw['prototype']['stopAcw']=function(_0x5c7af8){try{var _0x5e10f2=this;if(_0x5e10f2[_0x2628('0x7')][_0x5c7af8]){_0x5e10f2[_0x2628('0x7')][_0x5c7af8][_0x2628('0x19')]=![];var _0x48acb8=_0x5e10f2[_0x2628('0x7')][_0x5c7af8][_0x2628('0x1a')];var _0x2bc716=_0x5e10f2['timers'][_0x5c7af8][_0x2628('0x23')];var _0x3daa48=_0x5e10f2[_0x2628('0x5')][_0x2bc716][_0x2628('0x33')];logger[_0x2628('0x2b')](_0x2628('0x3b'),_0x48acb8,_0x5c7af8);RpcUser[_0x2628('0x29')](this['agents'][_0x5c7af8]['id'])[_0x2628('0x31')](function(_0x3adf06){if(_0x3adf06[_0x2628('0x3c')]===_0x2628('0x24')){return RpcUser[_0x2628('0x3d')](_0x5e10f2[_0x2628('0x6')][_0x5c7af8]);}});RpcVoiceAgentReport['update']({'acwtime':_0x3daa48,'agentacw':!![]},_0x48acb8,_0x5c7af8)[_0x2628('0x31')](function(_0x55ffda){logger[_0x2628('0x2b')](_0x2628('0x1b'),_0x48acb8,_0x3daa48,_0x55ffda);})[_0x2628('0x38')](function(_0x2781f3){logger[_0x2628('0x1c')]('[%s][UPDATE][ERRORS:%s]',_0x48acb8,_0x2781f3);});}else{logger[_0x2628('0x1c')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5c7af8);if(_0x5e10f2['timers']){logger[_0x2628('0x2b')](_0x2628('0x3e'),JSON[_0x2628('0x3f')](_0x5e10f2[_0x2628('0x7')]));}}}catch(_0x3328c6){logger['error'](_0x2628('0x40'),_0x3328c6[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')][_0x2628('0x9')]=function(_0x437c98){try{if(this['voiceQueues'][_0x437c98[_0x2628('0x23')]]&&(this['voiceQueues'][_0x437c98[_0x2628('0x23')]][_0x2628('0x41')]||this[_0x2628('0x5')][_0x437c98[_0x2628('0x23')]]['mandatoryDisposition'])){if(this['agents'][_0x437c98[_0x2628('0x21')]]){this[_0x2628('0x22')][_0x437c98['uniqueid']]={'queue':_0x437c98[_0x2628('0x23')],'interface':_0x437c98[_0x2628('0x21')],'destlinkedid':_0x437c98[_0x2628('0x2f')]};}}}catch(_0x135361){logger['error'](_0x2628('0x42'),_0x135361[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')][_0x2628('0x14')]=function(_0x166b92){try{if(this[_0x2628('0x5')][_0x166b92[_0x2628('0x23')]]&&(this[_0x2628('0x5')][_0x166b92['queue']][_0x2628('0x41')]||this['voiceQueues'][_0x166b92[_0x2628('0x23')]]['mandatoryDisposition'])){if(this[_0x2628('0x6')][_0x166b92[_0x2628('0x21')]]){this[_0x2628('0x22')][_0x166b92[_0x2628('0x1a')]]={'queue':_0x166b92[_0x2628('0x23')],'interface':_0x166b92['interface']};}}}catch(_0x264a79){logger['error'](_0x2628('0x43'),_0x264a79[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')]['syncHangupRequest']=function(_0x3cc5db){try{if(this[_0x2628('0x22')][_0x3cc5db['uniqueid']]&&_[_0x2628('0x44')](this[_0x2628('0x22')][_0x3cc5db[_0x2628('0x1a')]][_0x2628('0x2e')])){logger[_0x2628('0x2b')]('[%s][HANGUP:UNIQUEID]',_0x3cc5db[_0x2628('0x1a')]);this['startAcw'](_0x3cc5db[_0x2628('0x1a')]);}else if(this[_0x2628('0x22')][_0x3cc5db[_0x2628('0x45')]]&&_[_0x2628('0x44')](this[_0x2628('0x22')][_0x3cc5db[_0x2628('0x45')]][_0x2628('0x2e')])){logger['info'](_0x2628('0x46'),_0x3cc5db[_0x2628('0x45')]);this[_0x2628('0x20')](_0x3cc5db[_0x2628('0x45')]);}}catch(_0x1838c7){logger[_0x2628('0x1c')](_0x2628('0x47'),_0x1838c7[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')]['syncHangup']=function(_0x528623){try{if(this[_0x2628('0x22')][_0x528623[_0x2628('0x1a')]]&&this[_0x2628('0x22')][_0x528623[_0x2628('0x1a')]][_0x2628('0x2e')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x528623[_0x2628('0x1a')]);this['startAcw'](_0x528623[_0x2628('0x1a')]);}else if(this[_0x2628('0x22')][_0x528623[_0x2628('0x45')]]&&this[_0x2628('0x22')][_0x528623[_0x2628('0x45')]][_0x2628('0x2e')]){logger[_0x2628('0x2b')](_0x2628('0x48'),_0x528623[_0x2628('0x45')]);this[_0x2628('0x20')](_0x528623[_0x2628('0x45')]);}}catch(_0x24ef5a){logger[_0x2628('0x1c')](_0x2628('0x49'),_0x24ef5a[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')][_0x2628('0x12')]=function(_0x43a4cd){try{if(!_[_0x2628('0x4a')](this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4b')]])){this[_0x2628('0x20')](_0x43a4cd['transfereeuniqueid']);if(this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4c')]]){this['channels'][_0x43a4cd[_0x2628('0x4c')]][_0x2628('0x2e')]=!![];this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4d')]]=this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4c')]];delete this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4c')]];}}else if(!_['isNil'](this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4d')]])){this[_0x2628('0x20')](_0x43a4cd['transfertargetuniqueid']);if(this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4e')]]){this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4e')]][_0x2628('0x2e')]=!![];this[_0x2628('0x22')][_0x43a4cd[_0x2628('0x4b')]]=this['channels'][_0x43a4cd['origtransfereruniqueid']];delete this['channels'][_0x43a4cd[_0x2628('0x4e')]];}}}catch(_0x4be311){logger['error'](_0x2628('0x4f'),_0x4be311[_0x2628('0x3a')]);}};Acw[_0x2628('0x1f')]['syncBlindTransfer']=function(_0x53342a){try{if(this['channels'][_0x53342a['transfereruniqueid']]){logger[_0x2628('0x2b')](_0x2628('0x50'),JSON[_0x2628('0x3f')](_0x53342a[_0x2628('0x51')]));this[_0x2628('0x20')](_0x53342a['transfereruniqueid']);}else if(this['channels'][_0x53342a['transfererlinkedid']]){logger[_0x2628('0x2b')](_0x2628('0x52'),JSON['stringify'](_0x53342a['transfererlinkedid']));this[_0x2628('0x20')](_0x53342a[_0x2628('0x53')]);}}catch(_0x54869e){logger[_0x2628('0x1c')](_0x2628('0x54'),_0x54869e[_0x2628('0x3a')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0xdbd0ef){try{if(this[_0x2628('0x5')][_0xdbd0ef['queue']]&&this[_0x2628('0x5')][_0xdbd0ef[_0x2628('0x23')]][_0x2628('0x55')]==='all'){if(this[_0x2628('0x6')][_0xdbd0ef[_0x2628('0x21')]]){logger['info'](_0x2628('0x56'),_0xdbd0ef[_0x2628('0x1a')],_0xdbd0ef[_0x2628('0x21')],_0xdbd0ef[_0x2628('0x23')]);return RpcUser['savePause'](this[_0x2628('0x6')][_0xdbd0ef[_0x2628('0x21')]],_0x2628('0x57'),_0xdbd0ef['uniqueid']);}}}catch(_0x5aae96){logger['error'](_0x2628('0x58'),_0x5aae96[_0x2628('0x3a')]);}};module[_0x2628('0x59')]=Acw; \ No newline at end of file +var _0x11b5=['catch','error','finally','startAcw','interface','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','uniqueid','queue','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then'];(function(_0x283a81,_0x42f033){var _0x57533f=function(_0x1bfe9e){while(--_0x1bfe9e){_0x283a81['push'](_0x283a81['shift']());}};_0x57533f(++_0x42f033);}(_0x11b5,0x126));var _0x511b=function(_0x5d21a9,_0x3cf41c){_0x5d21a9=_0x5d21a9-0x0;var _0x5b6563=_0x11b5[_0x5d21a9];return _0x5b6563;};'use strict';var _=require(_0x511b('0x0'));var moment=require(_0x511b('0x1'));var ami=require('../ami');var logger=require(_0x511b('0x2'))(_0x511b('0x3'));var RpcUser=require(_0x511b('0x4'));var RpcVoiceAgentReport=require(_0x511b('0x5'));function Acw(_0x2f9040){this[_0x511b('0x6')]=_0x2f9040[_0x511b('0x6')];this[_0x511b('0x7')]=_0x2f9040[_0x511b('0x7')];this[_0x511b('0x8')]=_0x2f9040['timers'];this[_0x511b('0x9')]={};ami['on'](_0x511b('0xa'),this['syncAgentConnect'][_0x511b('0xb')](this));ami['on']('hanguprequest',this[_0x511b('0xc')]['bind'](this));ami['on'](_0x511b('0xd'),this[_0x511b('0xe')][_0x511b('0xb')](this));ami['on']('agentringnoanswer',this[_0x511b('0xf')][_0x511b('0xb')](this));ami['on'](_0x511b('0x10'),this['syncAttendedTransfer'][_0x511b('0xb')](this));ami['on'](_0x511b('0x11'),this[_0x511b('0x12')][_0x511b('0xb')](this));ami['on'](_0x511b('0x13'),this[_0x511b('0x14')][_0x511b('0xb')](this));}function getDiff(_0x28e208){var _0x544067=moment()[_0x511b('0x15')](0x0);var _0x30c0f8=moment(_0x28e208)[_0x511b('0x15')](0x0);return _0x544067[_0x511b('0x16')](_0x30c0f8,_0x511b('0x17'));}Acw[_0x511b('0x18')][_0x511b('0x19')]=function(_0x49a42a,_0x51a678){var _0x1f727f=this;var _0x44a773=getDiff(_0x1f727f['timers'][_0x49a42a][_0x511b('0x1a')]);clearTimeout(_0x1f727f[_0x511b('0x8')][_0x49a42a]['timer']);_0x1f727f['timers'][_0x49a42a][_0x511b('0x1b')]=![];return RpcVoiceAgentReport[_0x511b('0x1c')]({'acwtime':_0x44a773},_0x1f727f[_0x511b('0x8')][_0x49a42a]['uniqueid'],_0x49a42a)[_0x511b('0x1d')](function(_0x1b6267){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x51a678,_0x44a773,_0x1b6267);})[_0x511b('0x1e')](function(_0x291662){logger[_0x511b('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x51a678,_0x291662);})[_0x511b('0x20')](function(){delete _0x1f727f[_0x511b('0x8')][_0x49a42a];});};Acw[_0x511b('0x18')][_0x511b('0x21')]=function(_0x138d74){try{var _0x7e3cca=this;var _0x558af7=this[_0x511b('0x9')][_0x138d74][_0x511b('0x22')];var _0x5cbd0c=this['channels'][_0x138d74]['queue'];var _0x4703c6=this['voiceQueues'][_0x5cbd0c];var _0x15c5c6=![];var _0x5c4710='ACW';if(_0x4703c6[_0x511b('0x23')]&&_0x4703c6[_0x511b('0x24')][_0x511b('0x25')]){_0x15c5c6=!![];_0x5c4710=_0x4703c6[_0x511b('0x24')][_0x511b('0x25')];}if(!_0x7e3cca[_0x511b('0x7')][_0x558af7]){return Promise['resolve']();}return RpcUser[_0x511b('0x26')](_0x7e3cca[_0x511b('0x7')][_0x558af7]['id'])[_0x511b('0x1d')](function(_0x363b0c){if(!_0x363b0c||_0x363b0c[_0x511b('0x27')]){logger[_0x511b('0x28')](_0x511b('0x29'),_0x138d74,_0x558af7,_0x5cbd0c);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x138d74,_0x558af7,_0x5cbd0c);var _0x205144=_0x7e3cca['channels'][_0x138d74][_0x511b('0x2a')]&&_0x7e3cca['channels'][_0x138d74][_0x511b('0x2b')]?_0x7e3cca[_0x511b('0x9')][_0x138d74][_0x511b('0x2b')]:_0x138d74;return RpcUser[_0x511b('0x2c')](_0x7e3cca[_0x511b('0x7')][_0x558af7],_0x5c4710,_0x205144)[_0x511b('0x1d')](function(_0x544b03){_0x7e3cca[_0x511b('0x6')][_0x5cbd0c][_0x511b('0x2d')]-=0x1;_0x7e3cca[_0x511b('0x6')][_0x5cbd0c][_0x511b('0x2e')]+=0x1;return _0x544b03;});})[_0x511b('0x1d')](function(_0x4e8911){if(_0x15c5c6||!_0x4e8911){return;}_0x7e3cca[_0x511b('0x8')][_0x558af7]={};logger['info'](_0x511b('0x2f'),_0x138d74,_0x7e3cca['voiceQueues'][_0x5cbd0c][_0x511b('0x30')],_0x558af7,_0x5cbd0c);_0x7e3cca['timers'][_0x558af7][_0x511b('0x1b')]=setTimeout(_0x7e3cca[_0x511b('0x31')][_0x511b('0xb')](_0x7e3cca,_0x558af7),_0x7e3cca['voiceQueues'][_0x5cbd0c][_0x511b('0x30')]*0x3e8);_0x7e3cca[_0x511b('0x8')][_0x558af7][_0x511b('0x1a')]=moment()[_0x511b('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x7e3cca[_0x511b('0x8')][_0x558af7][_0x511b('0x33')]=_0x138d74;_0x7e3cca[_0x511b('0x8')][_0x558af7][_0x511b('0x34')]=_0x5cbd0c;_0x7e3cca[_0x511b('0x8')][_0x558af7][_0x511b('0x19')]=_0x7e3cca[_0x511b('0x19')][_0x511b('0xb')](_0x7e3cca,_0x558af7,_0x138d74);})[_0x511b('0x1e')](function(){logger[_0x511b('0x1f')](_0x511b('0x2f'),_0x138d74,_0x7e3cca[_0x511b('0x6')][_0x5cbd0c][_0x511b('0x30')],_0x558af7,_0x5cbd0c);})[_0x511b('0x20')](function(){delete _0x7e3cca[_0x511b('0x9')][_0x138d74];});}catch(_0x41bc4b){logger['error']('[ACW][START]\x20%s',_0x41bc4b[_0x511b('0x35')]);}};Acw[_0x511b('0x18')][_0x511b('0x31')]=function(_0x3db3ec){try{var _0x558ba6=this;if(_0x558ba6[_0x511b('0x8')][_0x3db3ec]){_0x558ba6[_0x511b('0x8')][_0x3db3ec][_0x511b('0x1b')]=![];var _0x49e056=_0x558ba6[_0x511b('0x8')][_0x3db3ec]['uniqueid'];var _0x1f4913=_0x558ba6[_0x511b('0x8')][_0x3db3ec]['queue'];var _0x1db324=_0x558ba6['voiceQueues'][_0x1f4913][_0x511b('0x30')];logger['info'](_0x511b('0x36'),_0x49e056,_0x3db3ec);RpcUser[_0x511b('0x26')](this['agents'][_0x3db3ec]['id'])['then'](function(_0x1ee44b){if(_0x1ee44b[_0x511b('0x37')]==='ACW'){return RpcUser['saveUnpause'](_0x558ba6['agents'][_0x3db3ec]);}});RpcVoiceAgentReport[_0x511b('0x1c')]({'acwtime':_0x1db324,'agentacw':!![]},_0x49e056,_0x3db3ec)[_0x511b('0x1d')](function(_0x4c902e){logger[_0x511b('0x28')]('[%s][UPDATE][ACWTIME:%s]',_0x49e056,_0x1db324,_0x4c902e);})[_0x511b('0x1e')](function(_0x4b9744){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x49e056,_0x4b9744);});}else{logger[_0x511b('0x1f')](_0x511b('0x38'),_0x3db3ec);if(_0x558ba6[_0x511b('0x8')]){logger[_0x511b('0x28')]('[ACW][TIMERS]',JSON[_0x511b('0x39')](_0x558ba6['timers']));}}}catch(_0x57936d){logger['error'](_0x511b('0x3a'),_0x57936d[_0x511b('0x35')]);}};Acw[_0x511b('0x18')][_0x511b('0x3b')]=function(_0x53a56e){try{if(this['voiceQueues'][_0x53a56e[_0x511b('0x34')]]&&(this[_0x511b('0x6')][_0x53a56e[_0x511b('0x34')]]['acw']||this[_0x511b('0x6')][_0x53a56e['queue']][_0x511b('0x23')])){if(this['agents'][_0x53a56e[_0x511b('0x22')]]){this[_0x511b('0x9')][_0x53a56e[_0x511b('0x33')]]={'queue':_0x53a56e[_0x511b('0x34')],'interface':_0x53a56e[_0x511b('0x22')],'destlinkedid':_0x53a56e[_0x511b('0x2b')]};}}}catch(_0x43356b){logger['error'](_0x511b('0x3c'),_0x43356b[_0x511b('0x35')]);}};Acw[_0x511b('0x18')][_0x511b('0x14')]=function(_0x3ddca1){try{if(this[_0x511b('0x6')][_0x3ddca1[_0x511b('0x34')]]&&(this[_0x511b('0x6')][_0x3ddca1[_0x511b('0x34')]][_0x511b('0x3')]||this[_0x511b('0x6')][_0x3ddca1[_0x511b('0x34')]][_0x511b('0x23')])){if(this[_0x511b('0x7')][_0x3ddca1[_0x511b('0x22')]]){this[_0x511b('0x9')][_0x3ddca1[_0x511b('0x33')]]={'queue':_0x3ddca1[_0x511b('0x34')],'interface':_0x3ddca1[_0x511b('0x22')]};}}}catch(_0x14e247){logger[_0x511b('0x1f')](_0x511b('0x3d'),_0x14e247[_0x511b('0x35')]);}};Acw[_0x511b('0x18')][_0x511b('0xc')]=function(_0x2c3e02){try{if(this[_0x511b('0x9')][_0x2c3e02['uniqueid']]&&_[_0x511b('0x3e')](this[_0x511b('0x9')][_0x2c3e02[_0x511b('0x33')]]['attended'])){logger[_0x511b('0x28')]('[%s][HANGUP:UNIQUEID]',_0x2c3e02[_0x511b('0x33')]);this['startAcw'](_0x2c3e02['uniqueid']);}else if(this['channels'][_0x2c3e02[_0x511b('0x3f')]]&&_[_0x511b('0x3e')](this[_0x511b('0x9')][_0x2c3e02[_0x511b('0x3f')]]['attended'])){logger[_0x511b('0x28')](_0x511b('0x40'),_0x2c3e02[_0x511b('0x3f')]);this[_0x511b('0x21')](_0x2c3e02[_0x511b('0x3f')]);}}catch(_0x5e4560){logger[_0x511b('0x1f')](_0x511b('0x41'),_0x5e4560[_0x511b('0x35')]);}};Acw[_0x511b('0x18')]['syncHangup']=function(_0x2eccad){try{if(this[_0x511b('0x9')][_0x2eccad['uniqueid']]&&this[_0x511b('0x9')][_0x2eccad['uniqueid']][_0x511b('0x2a')]){logger[_0x511b('0x28')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2eccad[_0x511b('0x33')]);this[_0x511b('0x21')](_0x2eccad[_0x511b('0x33')]);}else if(this[_0x511b('0x9')][_0x2eccad[_0x511b('0x3f')]]&&this[_0x511b('0x9')][_0x2eccad[_0x511b('0x3f')]][_0x511b('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2eccad[_0x511b('0x3f')]);this[_0x511b('0x21')](_0x2eccad['linkedid']);}}catch(_0x59071a){logger[_0x511b('0x1f')](_0x511b('0x42'),_0x59071a[_0x511b('0x35')]);}};Acw[_0x511b('0x18')]['syncAttendedTransfer']=function(_0x261692){try{if(!_[_0x511b('0x43')](this[_0x511b('0x9')][_0x261692[_0x511b('0x44')]])){this[_0x511b('0x21')](_0x261692['transfereeuniqueid']);if(this[_0x511b('0x9')][_0x261692[_0x511b('0x45')]]){this[_0x511b('0x9')][_0x261692['secondtransfereruniqueid']][_0x511b('0x2a')]=!![];this[_0x511b('0x9')][_0x261692['transfertargetuniqueid']]=this[_0x511b('0x9')][_0x261692['secondtransfereruniqueid']];delete this[_0x511b('0x9')][_0x261692[_0x511b('0x45')]];}}else if(!_[_0x511b('0x43')](this['channels'][_0x261692[_0x511b('0x46')]])){this['startAcw'](_0x261692[_0x511b('0x46')]);if(this[_0x511b('0x9')][_0x261692['origtransfereruniqueid']]){this['channels'][_0x261692['origtransfereruniqueid']][_0x511b('0x2a')]=!![];this[_0x511b('0x9')][_0x261692[_0x511b('0x44')]]=this[_0x511b('0x9')][_0x261692[_0x511b('0x47')]];delete this[_0x511b('0x9')][_0x261692[_0x511b('0x47')]];}}}catch(_0x3d83fc){logger['error'](_0x511b('0x48'),_0x3d83fc[_0x511b('0x35')]);}};Acw[_0x511b('0x18')]['syncBlindTransfer']=function(_0x3c0f9f){try{if(this[_0x511b('0x9')][_0x3c0f9f[_0x511b('0x49')]]){logger[_0x511b('0x28')](_0x511b('0x4a'),JSON[_0x511b('0x39')](_0x3c0f9f[_0x511b('0x49')]));this[_0x511b('0x21')](_0x3c0f9f[_0x511b('0x49')]);}else if(this['channels'][_0x3c0f9f[_0x511b('0x4b')]]){logger[_0x511b('0x28')](_0x511b('0x4c'),JSON[_0x511b('0x39')](_0x3c0f9f['transfererlinkedid']));this[_0x511b('0x21')](_0x3c0f9f[_0x511b('0x4b')]);}}catch(_0x342493){logger[_0x511b('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x342493[_0x511b('0x35')]);}};Acw['prototype'][_0x511b('0xf')]=function(_0x26c891){try{if(this[_0x511b('0x6')][_0x26c891[_0x511b('0x34')]]&&this[_0x511b('0x6')][_0x26c891[_0x511b('0x34')]][_0x511b('0x4d')]==='all'){if(this[_0x511b('0x7')][_0x26c891[_0x511b('0x22')]]){logger[_0x511b('0x28')](_0x511b('0x4e'),_0x26c891[_0x511b('0x33')],_0x26c891[_0x511b('0x22')],_0x26c891[_0x511b('0x34')]);return RpcUser[_0x511b('0x2c')](this['agents'][_0x26c891[_0x511b('0x22')]],'Auto-Pause',_0x26c891['uniqueid']);}}}catch(_0x1436a5){logger[_0x511b('0x1f')](_0x511b('0x4f'),_0x1436a5[_0x511b('0x35')]);}};module[_0x511b('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d8a9a7a..3074f1f 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 _0x4a0d=['once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','catch','inspect','close','exports','asterisk-manager','../../config/environment','asterisk','port','username','Action','promisify','error','format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x4a0d,0x9b));var _0xd4a0=function(_0x11c30d,_0x566175){_0x11c30d=_0x11c30d-0x0;var _0x43c1b3=_0x4a0d[_0x11c30d];return _0x43c1b3;};'use strict';var Manager=require(_0xd4a0('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require('../../config/logger')('ami');var config=require(_0xd4a0('0x1'));var ami=new Manager(config[_0xd4a0('0x2')][_0xd4a0('0x3')],config[_0xd4a0('0x2')]['ip'],config[_0xd4a0('0x2')][_0xd4a0('0x4')],config[_0xd4a0('0x2')]['password'],!![]);ami['keepConnected']();ami[_0xd4a0('0x5')]=BPromise[_0xd4a0('0x6')](ami['action']);function error(_0x1563ab){logger[_0xd4a0('0x7')](util[_0xd4a0('0x8')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xd4a0('0x2')][_0xd4a0('0x4')],config['asterisk']['ip'],config[_0xd4a0('0x2')]['port'],util['inspect'](_0x1563ab,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xd4a0('0x4')],config[_0xd4a0('0x2')]['ip'],config[_0xd4a0('0x2')]['port']));}ami[_0xd4a0('0x9')]=function(){return function(){return ami[_0xd4a0('0x5')]({'action':_0xd4a0('0xa')});};};ami[_0xd4a0('0xb')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xd4a0('0xc')});};};ami[_0xd4a0('0xd')]=function(){return function(){return ami['Action']({'action':_0xd4a0('0xe')});};};ami[_0xd4a0('0xf')]=function(){return function(){return ami['Action']({'action':_0xd4a0('0x10')});};};function connect(){logger[_0xd4a0('0x11')](util[_0xd4a0('0x8')](_0xd4a0('0x12'),config['asterisk']['username'],config[_0xd4a0('0x2')]['ip'],config[_0xd4a0('0x2')][_0xd4a0('0x3')]));ami[_0xd4a0('0x13')]('error',error);ami[_0xd4a0('0x13')]('close',close);}ami['on'](_0xd4a0('0x14'),connect);ami['on'](_0xd4a0('0x15'),function(_0x1b0757){logger[_0xd4a0('0x11')](util['format'](_0xd4a0('0x16'),config[_0xd4a0('0x2')][_0xd4a0('0x4')],config[_0xd4a0('0x2')]['ip'],config[_0xd4a0('0x2')][_0xd4a0('0x3')],util['inspect'](_0x1b0757,![],null)));});ami['on']('fullybooted',function(){logger[_0xd4a0('0x11')](util[_0xd4a0('0x8')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xd4a0('0x2')]['username'],config[_0xd4a0('0x2')]['ip'],config['asterisk']['port']));return Promise[_0xd4a0('0x17')]()[_0xd4a0('0x18')](ami['actionSipShowRegistry']())[_0xd4a0('0x18')](ami[_0xd4a0('0xb')]())[_0xd4a0('0x18')](ami['actionSipPeerStatus']())[_0xd4a0('0x18')](ami[_0xd4a0('0xd')]())['then'](ami[_0xd4a0('0xf')]())[_0xd4a0('0x19')](function(_0x2fdcf3){logger[_0xd4a0('0x7')]('[ami.js][fullybooted]',util[_0xd4a0('0x1a')](_0x2fdcf3,{'showHidden':![],'depth':null}));});});ami['once'](_0xd4a0('0x7'),error);ami[_0xd4a0('0x13')](_0xd4a0('0x1b'),close);module[_0xd4a0('0x1c')]=ami; \ No newline at end of file +var _0xa269=['keepConnected','Action','promisify','action','error','inspect','format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','resolve','then','actionSipPeerStatus','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password'];(function(_0x556f5d,_0x4f920e){var _0x20e7c8=function(_0x124f67){while(--_0x124f67){_0x556f5d['push'](_0x556f5d['shift']());}};_0x20e7c8(++_0x4f920e);}(_0xa269,0xb7));var _0x9a26=function(_0x1b5da8,_0x444cc1){_0x1b5da8=_0x1b5da8-0x0;var _0x98289c=_0xa269[_0x1b5da8];return _0x98289c;};'use strict';var Manager=require(_0x9a26('0x0'));var BPromise=require(_0x9a26('0x1'));var util=require(_0x9a26('0x2'));var logger=require(_0x9a26('0x3'))('ami');var config=require(_0x9a26('0x4'));var ami=new Manager(config[_0x9a26('0x5')][_0x9a26('0x6')],config[_0x9a26('0x5')]['ip'],config[_0x9a26('0x5')][_0x9a26('0x7')],config['asterisk'][_0x9a26('0x8')],!![]);ami[_0x9a26('0x9')]();ami[_0x9a26('0xa')]=BPromise[_0x9a26('0xb')](ami[_0x9a26('0xc')]);function error(_0x226acc){logger[_0x9a26('0xd')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x9a26('0x5')]['username'],config[_0x9a26('0x5')]['ip'],config[_0x9a26('0x5')]['port'],util[_0x9a26('0xe')](_0x226acc,![],null)));}function close(){logger[_0x9a26('0xd')](util[_0x9a26('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x9a26('0x5')]['username'],config[_0x9a26('0x5')]['ip'],config[_0x9a26('0x5')][_0x9a26('0x6')]));}ami[_0x9a26('0x10')]=function(){return function(){return ami['Action']({'action':_0x9a26('0x11')});};};ami[_0x9a26('0x12')]=function(){return function(){return ami[_0x9a26('0xa')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x9a26('0xa')]({'action':_0x9a26('0x13')});};};ami[_0x9a26('0x14')]=function(){return function(){return ami[_0x9a26('0xa')]({'action':'queuesummary'});};};ami[_0x9a26('0x15')]=function(){return function(){return ami['Action']({'action':_0x9a26('0x16')});};};function connect(){logger[_0x9a26('0x17')](util[_0x9a26('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9a26('0x5')]['username'],config[_0x9a26('0x5')]['ip'],config['asterisk'][_0x9a26('0x6')]));ami[_0x9a26('0x18')](_0x9a26('0xd'),error);ami[_0x9a26('0x18')](_0x9a26('0x19'),close);}ami['on'](_0x9a26('0x1a'),connect);ami['on']('shutdown',function(_0xffa22f){logger[_0x9a26('0x17')](util[_0x9a26('0xf')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x9a26('0x5')][_0x9a26('0x7')],config[_0x9a26('0x5')]['ip'],config[_0x9a26('0x5')][_0x9a26('0x6')],util[_0x9a26('0xe')](_0xffa22f,![],null)));});ami['on']('fullybooted',function(){logger[_0x9a26('0x17')](util[_0x9a26('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x9a26('0x5')][_0x9a26('0x7')],config[_0x9a26('0x5')]['ip'],config[_0x9a26('0x5')][_0x9a26('0x6')]));return Promise[_0x9a26('0x1b')]()[_0x9a26('0x1c')](ami[_0x9a26('0x10')]())[_0x9a26('0x1c')](ami[_0x9a26('0x12')]())[_0x9a26('0x1c')](ami[_0x9a26('0x1d')]())[_0x9a26('0x1c')](ami[_0x9a26('0x14')]())[_0x9a26('0x1c')](ami[_0x9a26('0x15')]())['catch'](function(_0x27b85d){logger[_0x9a26('0xd')](_0x9a26('0x1e'),util[_0x9a26('0xe')](_0x27b85d,{'showHidden':![],'depth':null}));});});ami[_0x9a26('0x18')](_0x9a26('0xd'),error);ami['once'](_0x9a26('0x19'),close);module[_0x9a26('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 027a341..944d8db 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x38ff2b,_0x3a0316){var _0x341f5e=function(_0x346368){while(--_0x346368){_0x38ff2b['push'](_0x38ff2b['shift']());}};_0x341f5e(++_0x3a0316);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x26ed77,_0x5d3145){var _0x33ef92=function(_0x1c5ec0){while(--_0x1c5ec0){_0x26ed77['push'](_0x26ed77['shift']());}};_0x33ef92(++_0x5d3145);}(_0xb43b,0x1b2));var _0xbb43=function(_0x38ede6,_0x4d1a80){_0x38ede6=_0x38ede6-0x0;var _0x40d090=_0xb43b[_0x38ede6];return _0x40d090;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('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 c60bc5f..dcd5f00 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 _0xf823=['OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','stringify','loopCampaigns','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','state','Drop','dropreason','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','locked','paused','agents','stateinterface','rrmemory','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','buildObj','amd','[syncHangupInAMD]','membername','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','Machine','countcongestionretry','dialMachineMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','actionOriginate','object','originate','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/agentComplete','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','then','isUndefined','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','---------------------------','merge','getSeconds','debug','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','content','indexOf','true','catch','all'];(function(_0x4a5d60,_0x32b144){var _0x272147=function(_0x29c638){while(--_0x29c638){_0x4a5d60['push'](_0x4a5d60['shift']());}};_0x272147(++_0x32b144);}(_0xf823,0x17d));var _0x3f82=function(_0x64e1f6,_0x540987){_0x64e1f6=_0x64e1f6-0x0;var _0x65b31a=_0xf823[_0x64e1f6];return _0x65b31a;};'use strict';var util=require(_0x3f82('0x0'));var _=require(_0x3f82('0x1'));var uuid=require(_0x3f82('0x2'));var moment=require(_0x3f82('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x3f82('0x4'));var hopperUtils=require(_0x3f82('0x5'));var ut=require(_0x3f82('0x6'));var config=require(_0x3f82('0x7'));var logger=require(_0x3f82('0x8'))(_0x3f82('0x9'));var loggerBooked=require('../../../config/logger')(_0x3f82('0xa'));var loggerPredictive=require('../../../config/logger')(_0x3f82('0xb'));var loggerPredictiveCalls=require(_0x3f82('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3f82('0x8'))(_0x3f82('0xc'));var ami=require(_0x3f82('0xd'));config[_0x3f82('0xe')]=_[_0x3f82('0xf')](config[_0x3f82('0xe')],{'host':_0x3f82('0x10'),'port':0x18eb});var io=require(_0x3f82('0x11'))(new Redis(config['redis']));var cmHopper=require(_0x3f82('0x12'));var voiceQueueRt=require(_0x3f82('0x13'));var RpcSetting=require(_0x3f82('0x14'));var Interval=require('../rpc/interval');var Action=require(_0x3f82('0x15'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x3f82('0x16'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x3f82('0x17'));var ipAgi=process[_0x3f82('0x18')]['XCALLY_IP_AGI']||_0x3f82('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3f82('0x1a')][_0x3f82('0x1b')]=function(_0x479ce1){this[_0x3f82('0x1c')]=this['tail']?this[_0x3f82('0x1c')][_0x3f82('0x1d')](_0x479ce1):_0x479ce1();};function Dialer(_0x117469,_0x4ba6e6){this['sequence']=new Sequence();this[_0x3f82('0x1e')]=_0x4ba6e6;this[_0x3f82('0x1f')]=_0x117469[_0x3f82('0x1f')];this[_0x3f82('0x20')]=_0x117469['campaigns'];this['agents']=_0x117469['agents'];this[_0x3f82('0x21')]=_0x117469[_0x3f82('0x21')];this['maxNumberOriginate']=config[_0x3f82('0x22')]||0x2;this[_0x3f82('0x23')]={};this[_0x3f82('0x24')]={};this[_0x3f82('0x25')]={};this[_0x3f82('0x26')]={};this['optionPredictive']={};this[_0x3f82('0x27')]={};this[_0x3f82('0x28')]={};this[_0x3f82('0x29')]={};this[_0x3f82('0x2a')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x3f82('0x2b'),this[_0x3f82('0x2c')]['bind'](this));ami['on'](_0x3f82('0x2d'),this['syncQueueCallerAbandon'][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x2f'),this[_0x3f82('0x30')][_0x3f82('0x2e')](this));ami['on']('agentcomplete',this[_0x3f82('0x31')][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x32'),this[_0x3f82('0xc')][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x33'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x3f82('0x34'),this[_0x3f82('0x35')][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x36'),this[_0x3f82('0x37')]['bind'](this));ami['on'](_0x3f82('0x38'),this[_0x3f82('0x39')][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x3a'),this['syncQueueMember'][_0x3f82('0x2e')](this));ami['on'](_0x3f82('0x3b'),this[_0x3f82('0x3c')][_0x3f82('0x2e')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x3f82('0x3d')](function(_0x1de2ee){previewRecallmeReminderInterval=_0x1de2ee['previewRecallmeReminderInterval'];});}function isNotNull(_0xaf3bf6){return _0xaf3bf6!==null&&!_[_0x3f82('0x3e')](_0xaf3bf6);}function msgResponse(_0x5bf185,_0x5a81e5,_0x38e4f7){return{'action':_0x5bf185,'response':_0x5a81e5,'message':_0x38e4f7,'stack':_0x38e4f7};}function emit(_0x2d1908,_0x23c31c,_0xf4ae62){io['to'](_0x2d1908)['emit'](_0x23c31c,_0xf4ae62);}function emitOutboundVoiceQueueSummary(_0xd071bd){if(_0xd071bd[_0x3f82('0x3f')]===_0x3f82('0x40')){logger['debug'](_0x3f82('0x41'),util[_0x3f82('0x42')](_0xd071bd,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0xd071bd['name']),'voice_queue:save',_0xd071bd);}}function checkGetDataPredictive(_0x5de05f){if(isNotNull(_0x5de05f)&&!_[_0x3f82('0x43')](_0x5de05f)){loggerPredictive['info'](_0x3f82('0x44'));loggerPredictive['info'](_0x3f82('0x45'),_0x5de05f[_0x3f82('0x46')]);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x48'),_0x5de05f[_0x3f82('0x49')]);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x4a'),_0x5de05f[_0x3f82('0x4b')]);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x4c'),_0x5de05f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x4d'),_0x5de05f[_0x3f82('0x4e')]);loggerPredictive[_0x3f82('0x47')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5de05f[_0x3f82('0x4f')]);loggerPredictive[_0x3f82('0x47')]('---------------------------');if(_0x5de05f['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3f82('0x3e')](_0x5de05f[_0x3f82('0x4f')])&&_0x5de05f[_0x3f82('0x4f')]>0x0){return!![];}loggerPredictive[_0x3f82('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x5de05f['predictiveIntervalAvgHoldtime'])&&_0x5de05f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x3f82('0x50'));}else{loggerPredictive[_0x3f82('0x47')](_0x3f82('0x51'));}}else{loggerPredictive[_0x3f82('0x47')](_0x3f82('0x52'));}return![];}function mergeDataErlangB(_0x2363b4){return function(_0x117453){loggerPredictive[_0x3f82('0x47')](_0x3f82('0x53'));loggerPredictive['info'](_0x3f82('0x54'),_0x117453[_0x3f82('0x55')]);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x56'),_0x117453['erlangCallToSecond']);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x57'),_0x117453[_0x3f82('0x58')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x117453[_0x3f82('0x59')]);loggerPredictive['info'](_0x3f82('0x57'),_0x117453[_0x3f82('0x58')]);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x5a'));_[_0x3f82('0x5b')](_0x2363b4,_0x117453);};}function ifInterval(_0x33ef36,_0x486e8f){if(_[_0x3f82('0x3e')](_0x486e8f)){return![];}return utils[_0x3f82('0x5c')](undefined,_0x486e8f)<_0x33ef36*0x3c;}function clearPredictiveAttributes(_0x49898d){if(_0x49898d[_0x3f82('0x28')]){_0x49898d[_0x3f82('0x28')]=undefined;loggerPredictive[_0x3f82('0x5d')](_0x49898d[_0x3f82('0x5e')],_0x3f82('0x5f'));}if(_0x49898d['startPredictive']){_0x49898d[_0x3f82('0x27')]=undefined;loggerPredictive['debug'](_0x49898d[_0x3f82('0x5e')],_0x3f82('0x60'));}if(_0x49898d[_0x3f82('0x61')]){clearInterval(_0x49898d['handlePredictive']);_0x49898d[_0x3f82('0x61')]=undefined;loggerPredictive[_0x3f82('0x5d')](_0x49898d[_0x3f82('0x5e')],_0x3f82('0x62'));}}function loggerCatchPredictive(_0x381a41,_0x3cb448){return function(_0x35b852){loggerPredictive[_0x3f82('0x63')](_0x3cb448['name'],_0x381a41);loggerPredictive['error'](_0x35b852[_0x3f82('0x64')]);clearPredictiveAttributes(_0x3cb448);};}function loggerCatch(_0x2f5eab){return function(_0x2a9516){logger[_0x3f82('0x63')](_0x2f5eab,util[_0x3f82('0x42')](_0x2a9516,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1ceece,_0x4fce37,_0x24518b){return function(_0x11ccea){utils[_0x3f82('0x65')](_0x4fce37,_0x24518b,0x0);_0x4fce37[_0x3f82('0x66')]=0x0;logger[_0x3f82('0x63')](_0x1ceece,util[_0x3f82('0x42')](_0x11ccea,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37d04c){return function(_0x4e8f05){if(isNotNull(_0x4e8f05)&&isNotNull(_0x4e8f05[0x0])){if(_0x4e8f05[0x0][_0x3f82('0x67')]>0x0){_0x37d04c[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x6a')];logger[_0x3f82('0x47')](_0x3f82('0x6b')+_0x37d04c[_0x3f82('0x5e')],_0x4e8f05[0x0][_0x3f82('0x67')],_0x3f82('0x6c'));}else{_0x37d04c[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x6d')];logger[_0x3f82('0x47')]('[getContactDialer2][Empty]'+_0x37d04c['name']);}}};}function createObjHistory(_0x2a6a2e,_0x215889,_0x32a03a,_0x42376,_0x4d2bbd){_0x2a6a2e[_0x3f82('0x68')]=_0x32a03a;var _0x30c0a9=new Action(_0x2a6a2e,_0x215889);var _0x16aaf0=new History(_0x30c0a9);_0x16aaf0['state']=_0x42376;_0x16aaf0[_0x3f82('0x6e')]=_0x4d2bbd;_0x16aaf0[_0x3f82('0x6f')]=_0x30c0a9[_0x3f82('0x70')];return _0x16aaf0;}function unlockQueueStatus(_0x43219e,_0x34d08b){setTimeout(function(){if(_[_0x3f82('0x3e')](_0x43219e[_0x3f82('0x71')])){loggerBooked[_0x3f82('0x63')](_0x3f82('0x72'),_0x34d08b);}_0x43219e['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x34d08b,JSON['stringify'](_[_0x3f82('0x73')](_0x43219e,[_0x3f82('0x5e'),_0x3f82('0x71')])));},0x1f3);}function checkInterval(_0x16cfdf){return function(){if(!isNotNull(_0x16cfdf[_0x3f82('0x74')])){_0x16cfdf[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x75')];throw _0x16cfdf[_0x3f82('0x5e')]+_0x3f82('0x76');}if(!isNotNull(_0x16cfdf[_0x3f82('0x74')]['Intervals'])){_0x16cfdf[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x75')];throw _0x16cfdf[_0x3f82('0x5e')]+_0x3f82('0x76');}if(!isNotNull(_[_0x3f82('0x43')](_0x16cfdf[_0x3f82('0x74')][_0x3f82('0x77')]))){_0x16cfdf[_0x3f82('0x68')]=utils['CAMPAIGN_STATUS'][_0x3f82('0x75')];throw _0x16cfdf[_0x3f82('0x5e')]+_0x3f82('0x76');}};}function checkIsIVRCampaignActive(_0x27a09e){return function(){if(!utils['isIVRCampaignActive'](_0x27a09e)){_0x27a09e[_0x3f82('0x68')]=utils['CAMPAIGN_STATUS'][_0x3f82('0x78')];throw _0x27a09e[_0x3f82('0x5e')]+_0x3f82('0x79');}};}function emitCampaignSummary(_0xf5b055){if(utils[_0x3f82('0x7a')](_0xf5b055)){emit(util[_0x3f82('0x7b')](_0x3f82('0x7c'),_0xf5b055[_0x3f82('0x5e')]),_0x3f82('0x7d'),_0xf5b055);}}function loggerCatchQueueSummary(_0x4e2d0d,_0x24ee03){return function(_0x1e33bd){clearPredictiveAttributes(_0x24ee03);emitCampaignSummary(_0x24ee03);loggerSyncQueueSummary['debug'](_0x4e2d0d,util[_0x3f82('0x42')](_0x1e33bd,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x468142){if(_0x468142[_0x3f82('0x7e')]){if(_0x468142[_0x3f82('0x7f')]===0x0){_0x468142[_0x3f82('0x7e')]=![];_0x468142[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x78')];loggerSyncQueueSummary[_0x3f82('0x5d')](_0x3f82('0x80'),_0x468142[_0x3f82('0x5e')],'is\x20not\x20active');}else{_0x468142[_0x3f82('0x68')]=utils['CAMPAIGN_STATUS'][_0x3f82('0x81')];loggerSyncQueueSummary[_0x3f82('0x5d')](_0x3f82('0x80'),_0x468142[_0x3f82('0x5e')],'is\x20disactive');}emitCampaignSummary(_0x468142);}}function myreject(_0x10ed68){return function(_0x3e3aec){return _0x10ed68(msgResponse('[ifTime][Action]',_0x3f82('0x82'),JSON['stringify'](_0x3e3aec)));};}Dialer[_0x3f82('0x1a')][_0x3f82('0x83')]=function(_0x482175){return!_[_0x3f82('0x3e')](_0x482175)&&_0x482175&&!_[_0x3f82('0x3e')](_0x482175['name'])&&!_[_0x3f82('0x3e')](_0x482175[_0x3f82('0x84')])&&_0x482175[_0x3f82('0x84')]&&(this[_0x3f82('0x21')][util[_0x3f82('0x7b')](_0x3f82('0x85'),_0x482175[_0x3f82('0x5e')])][_0x3f82('0x86')]===_0x3f82('0x87')||this['trunks'][util[_0x3f82('0x7b')]('SIP/%s',_0x482175['name'])][_0x3f82('0x86')]===_0x3f82('0x88'));};Dialer[_0x3f82('0x1a')][_0x3f82('0x89')]=function(_0x25cf6d){var _0x4b535b=this;return function(){if(!_0x4b535b['isTrunkReachable'](_0x25cf6d['Trunk'])){if(!_0x4b535b[_0x3f82('0x83')](_0x25cf6d[_0x3f82('0x8a')])){_0x25cf6d[_0x3f82('0x68')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x25cf6d[_0x3f82('0x5e')]+_0x3f82('0x8b');}}};};Dialer['prototype'][_0x3f82('0x8c')]=function(_0x30ad0a,_0x49ef4d,_0x13a550,_0xb7f22c){var _0x13038f=this;return function(){var _0xbb64c1=!![];return _0x13038f[_0x3f82('0x8d')](_0x30ad0a,_0x49ef4d,_0x13a550,_0xb7f22c,_0xbb64c1);};};Dialer[_0x3f82('0x1a')][_0x3f82('0x8e')]=function(_0x8ffa4c,_0x3d1bc3,_0x54a010,_0x5c7b07){var _0x34a32f=this;return function(){var _0x570d08=![];return _0x34a32f[_0x3f82('0x8d')](_0x8ffa4c['Intervals'],_0x3d1bc3,_0x54a010,_0x5c7b07,_0x570d08);};};Dialer[_0x3f82('0x1a')][_0x3f82('0x8d')]=function(_0x497bfc,_0x1157a9,_0x4ba4d0,_0x603c45,_0x3767af){var _0x3b4493=[];return new Promise(function(_0x3e84f6,_0x176d56){if(!isNotNull(_0x497bfc)){_0x603c45[_0x3f82('0x68')]=utils[_0x3f82('0x69')][_0x3f82('0x75')];return _0x176d56(msgResponse('ifTime','Failure',_0x4ba4d0+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x3f82('0x43')](_0x497bfc)){_0x603c45[_0x3f82('0x68')]=utils[_0x3f82('0x69')]['EMPTY_INTERVAL'];return _0x176d56(msgResponse('ifTime',_0x3f82('0x8f'),_0x4ba4d0+_0x3f82('0x90')));}if(_0x1157a9&&_[_0x3f82('0x3e')](config['timezones'][_0x1157a9])){_0x603c45['message']=utils[_0x3f82('0x69')][_0x3f82('0x91')];return _0x176d56(msgResponse(_0x3f82('0x92'),_0x3f82('0x8f'),_0x4ba4d0+_0x3f82('0x93')+_0x1157a9));}if(_[_0x3f82('0x94')](_0x497bfc)){for(var _0x146b36=0x0;_0x146b36<_0x497bfc[_0x3f82('0x95')];_0x146b36+=0x1){_0x3b4493[_0x3f82('0x96')](ami[_0x3f82('0x97')]({'action':_0x3f82('0x98'),'command':util['format']('iftime\x20%s,%s',_0x497bfc[_0x146b36][_0x3f82('0x99')],!_[_0x3f82('0x3e')](config[_0x3f82('0x9a')][_0x1157a9])?_0x1157a9:'')})[_0x3f82('0x3d')](function(_0x189d6c){return _0x189d6c[_0x3f82('0x9b')][_0x3f82('0x9c')](_0x3f82('0x9d'))>=0x0;})[_0x3f82('0x9e')](myreject(_0x176d56)));}}else{_0x3b4493[_0x3f82('0x96')](ami['Action']({'action':_0x3f82('0x98'),'command':util[_0x3f82('0x7b')]('iftime\x20%s,%s',_0x497bfc,!_[_0x3f82('0x3e')](config[_0x3f82('0x9a')][_0x1157a9])?_0x1157a9:'')})['then'](function(_0x3c0105){return _0x3c0105[_0x3f82('0x9b')]['indexOf'](_0x3f82('0x9d'))>=0x0;})[_0x3f82('0x9e')](myreject(_0x176d56)));}Promise[_0x3f82('0x9f')](_0x3b4493)['then'](function(_0x2c5c95){var _0x4542ce=_['some'](_0x2c5c95);if(_0x4542ce){return _0x3e84f6(_0x4542ce);}else{_0x603c45['message']=_0x3767af?utils[_0x3f82('0x69')][_0x3f82('0xa0')]:utils[_0x3f82('0x69')]['OVERTIME_INTERVAL'];return _0x176d56(msgResponse(_0x3f82('0xa1'),_0x3f82('0x8f'),_0x3f82('0xa2')+_0x3767af+'\x20'+_0x4ba4d0+_0x3f82('0xa3')+util[_0x3f82('0x42')](_0x497bfc,{'showHidden':![],'depth':null})+_0x3f82('0xa4')+_0x1157a9));}})[_0x3f82('0x9e')](function(_0x13054f){return _0x176d56(msgResponse(_0x3f82('0x92'),_0x3f82('0x8f'),JSON[_0x3f82('0xa5')](_0x13054f)));});});};Dialer[_0x3f82('0x1a')][_0x3f82('0xa6')]=function(){var _0x2ef2ba=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x3f82('0x3d')](function(){setInterval(function(){_0x2ef2ba[_0x3f82('0xa7')]();},0x3e8);});};Dialer['prototype'][_0x3f82('0xa7')]=function(){var _0x73f649=this;var _0x5deaa7;for(var _0x69a5d2 in this[_0x3f82('0x20')]){if(typeof this[_0x3f82('0x20')][_0x69a5d2]!==_0x3f82('0xa8')){_0x5deaa7=this[_0x3f82('0x20')][_0x69a5d2];if(utils[_0x3f82('0x7a')](_0x5deaa7)&&utils[_0x3f82('0xa9')](_0x5deaa7)){_0x5deaa7[_0x3f82('0x7e')]=!![];Promise[_0x3f82('0xaa')]()[_0x3f82('0x3d')](checkIsIVRCampaignActive(_0x5deaa7))[_0x3f82('0x3d')](checkInterval(_0x5deaa7))[_0x3f82('0x3d')](_0x73f649[_0x3f82('0x89')](_0x5deaa7))[_0x3f82('0x3d')](_0x73f649[_0x3f82('0x8c')](_0x5deaa7['dialGlobalInterval'],_0x5deaa7[_0x3f82('0xab')],_0x5deaa7[_0x3f82('0x5e')],_0x5deaa7))[_0x3f82('0x3d')](_0x73f649[_0x3f82('0x8e')](_0x5deaa7[_0x3f82('0x74')],_0x5deaa7[_0x3f82('0xab')],_0x5deaa7['name'],_0x5deaa7))[_0x3f82('0x3d')](_0x73f649[_0x3f82('0xac')](_0x5deaa7))[_0x3f82('0x9e')](loggerCatchQueueSummary(_0x3f82('0xad'),_0x5deaa7));}else{notSendMessagesCampaign(_0x5deaa7);}}}};Dialer[_0x3f82('0x1a')][_0x3f82('0xae')]=function(_0x41cc21){if(_0x41cc21[_0x3f82('0xaf')]!==_0x3f82('0xb')){clearPredictiveAttributes(_0x41cc21);}switch(_0x41cc21[_0x3f82('0xaf')]){case'progressive':this['handlePower'](_0x41cc21,0x1);break;case _0x3f82('0xb0'):this['handlePower'](_0x41cc21,_0x41cc21[_0x3f82('0xb1')]);break;case _0x3f82('0xb'):this[_0x3f82('0xb')](_0x41cc21);break;case _0x3f82('0xa'):this[_0x3f82('0xb2')](_0x41cc21,0x1);break;default:logger[_0x3f82('0x63')](_0x3f82('0xb3'),_0x41cc21[_0x3f82('0x5e')],_0x3f82('0xb4'));}};Dialer['prototype'][_0x3f82('0x92')]=function(_0x40dee8,_0x3c4cd6){var _0x15a639=_0x40dee8[_0x3f82('0xab')];var _0x31a20d=_0x3c4cd6?_0x40dee8[_0x3f82('0xb5')]:_0x40dee8['Interval'][_0x3f82('0x77')];logger[_0x3f82('0xb6')](_0x3f82('0xb7'),_0x31a20d,_0x15a639,_0x40dee8[_0x3f82('0x5e')],util['format'](_0x3f82('0xb8'),_0x40dee8['name'],_0x40dee8['id']));var _0x54bc3c=null;return Interval[_0x3f82('0xb9')](_0x31a20d,_0x15a639)['then'](function(_0x5b8566){if(_0x5b8566===!![]){return _0x5b8566;}else{_0x40dee8['message']=_0x3c4cd6?utils[_0x3f82('0x69')][_0x3f82('0xa0')]:utils[_0x3f82('0x69')][_0x3f82('0xba')];_0x54bc3c=msgResponse(_0x3f82('0xa1'),_0x3f82('0x8f'),_0x3f82('0xa2')+_0x3c4cd6+'\x20'+_0x40dee8['name']+_0x3f82('0xa3')+util['inspect'](_0x31a20d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x15a639);}if(_0x54bc3c!==null){logger[_0x3f82('0xb6')](_0x3f82('0xbb'),_0x54bc3c);_0x54bc3c[_0x3f82('0xbc')]=_0x3c4cd6;throw _0x54bc3c;}})[_0x3f82('0x9e')](function(_0x15b776){logger[_0x3f82('0x63')]('AMI\x20IfTime',_0x15b776);throw msgResponse(_0x3f82('0xbd'),_0x3f82('0x82'),util[_0x3f82('0x42')](_0x15b776,{'showHidden':![],'depth':null}));});};Dialer[_0x3f82('0x1a')][_0x3f82('0x2c')]=function(_0x31e4da){if(this[_0x3f82('0x1f')][_0x31e4da[_0x3f82('0xbe')]]){if(this[_0x3f82('0x26')][_0x31e4da[_0x3f82('0xbf')]]&&this['uniqueId'][_0x31e4da[_0x3f82('0xbf')]]['type']!==_0x3f82('0xc0')){this[_0x3f82('0xc1')](this['voiceQueues'][_0x31e4da['queue']]);this[_0x3f82('0x26')][_0x31e4da['uniqueid']][_0x3f82('0xc2')]=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));}}};Dialer['prototype'][_0x3f82('0x31')]=function(_0x237086){var _0x466d84=this['uniqueId'][_0x237086[_0x3f82('0xbf')]];if(this[_0x3f82('0x1f')][_0x237086[_0x3f82('0xbe')]]){if(_0x466d84&&_0x466d84['type']!==_0x3f82('0xc0')){delete this[_0x3f82('0x26')][_0x237086[_0x3f82('0xbf')]];this[_0x3f82('0x1f')][_0x237086[_0x3f82('0xbe')]][_0x3f82('0xc4')]+=0x1;var _0x591578=new AgentComplete(_0x466d84,_0x237086);if(_0x237086[_0x3f82('0xc5')]===_0x3f82('0xc6')){_0x591578[_0x3f82('0xc7')]=this[_0x3f82('0x1f')][_0x237086[_0x3f82('0xbe')]][_0x3f82('0xc8')]&&this[_0x3f82('0x1f')][_0x237086[_0x3f82('0xbe')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x3f82('0xc3')):undefined;}hopperUtils['createHistory'](_0x591578)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0xc9')));hopperUtils[_0x3f82('0xca')](_0x591578)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0xcb')));}}};Dialer[_0x3f82('0x1a')]['syncQueueCallerAbandon']=function(_0x3a369b){var _0x472a0b=this[_0x3f82('0x26')][_0x3a369b['uniqueid']];var _0x4daf60=this;var _0x43de11=![];var _0x5445fb;var _0x5c1f29;if(this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]){if(_0x472a0b&&_0x472a0b[_0x3f82('0x3f')]!==_0x3f82('0xc0')){delete this[_0x3f82('0x26')][_0x3a369b[_0x3f82('0xbf')]];this[_0x3f82('0xc1')](this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]);_0x472a0b[_0x3f82('0xcc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1ce7c0=new QueueCallerAbandon(_0x472a0b,_0x3a369b);if(utils[_0x3f82('0x5c')](_0x472a0b[_0x3f82('0xcc')],_0x472a0b[_0x3f82('0xcd')])>=_0x472a0b[_0x3f82('0xce')]){this['voiceQueues'][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0x4b')]+=0x1;this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x3f82('0x1f')][_0x3a369b['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1ce7c0[_0x3f82('0xcf')]=0xa;_0x1ce7c0[_0x3f82('0x6e')]=_0x3f82('0xd0');_0x1ce7c0[_0x3f82('0xd1')]='TIMEOUT';_0x1ce7c0[_0x3f82('0xc7')]=this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]['dialQueueProject2']?moment()[_0x3f82('0x7b')](_0x3f82('0xc3')):undefined;_0x1ce7c0['countdropretry']+=0x1;_0x1ce7c0[_0x3f82('0xd2')]+=0x1;_0x5445fb=this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0xd3')];_0x5c1f29=this[_0x3f82('0x1f')][_0x3a369b['queue']][_0x3f82('0xd4')];hopperUtils[_0x3f82('0xd5')](_0x1ce7c0,_0x1ce7c0[_0x3f82('0xcf')],_0x472a0b[_0x3f82('0xd6')])['then'](function(_0x1853a8){_0x43de11=_0x1853a8[_0x3f82('0xd7')]==0x1;if(_0x1ce7c0['countdropretry']>=_0x4daf60[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0xd8')]){_0x4daf60[_0x3f82('0xd9')](_0x1ce7c0,_0x1853a8[_0x3f82('0xd7')]);}else{hopperUtils[_0x3f82('0xda')]({'active':![],'countdropretry':_0x1ce7c0[_0x3f82('0xdb')],'scheduledat':moment()[_0x3f82('0xdc')](_0x4daf60[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0xd3')],_0x3f82('0xdd'))[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x472a0b[_0x3f82('0xde')],'ListId':_0x472a0b[_0x3f82('0xdf')],'VoiceQueueId':_0x472a0b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x472a0b[_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch('[rescheduleContact][Drop]'));var _0x23c734=new History(_0x1ce7c0);_0x23c734['state']=0xa;_0x23c734['statedesc']='Drop';_0x23c734[_0x3f82('0x70')]=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));_0x23c734[_0x3f82('0x6f')]=_0x23c734['starttime'];_0x23c734['calleridname']=_0x1ce7c0[_0x3f82('0xe2')];_0x23c734[_0x3f82('0xe3')]=_0x1ce7c0['calleridnum'];hopperUtils[_0x3f82('0xe4')](_0x23c734)['catch'](loggerCatch(_0x3f82('0xe5')));}})[_0x3f82('0x3d')](function(){if(_0x43de11)hopperUtils[_0x3f82('0xe6')](_0x1ce7c0,_0x5445fb,_0x5c1f29)[_0x3f82('0x3d')](function(){return 0x1;});});}else{this[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x3a369b[_0x3f82('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1ce7c0[_0x3f82('0xcf')]=0xb;_0x1ce7c0[_0x3f82('0x6e')]='Abandoned';_0x1ce7c0[_0x3f82('0xd1')]=_0x3f82('0xe7');_0x1ce7c0['countabandonedretry']+=0x1;_0x1ce7c0[_0x3f82('0xd2')]+=0x1;_0x5445fb=this['voiceQueues'][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0xe8')];_0x5c1f29=this['voiceQueues'][_0x3a369b[_0x3f82('0xbe')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3f82('0xd5')](_0x1ce7c0,_0x1ce7c0[_0x3f82('0xcf')],_0x472a0b[_0x3f82('0xd6')])['then'](function(_0x1850fe){if(_0x1ce7c0[_0x3f82('0xe9')]>=_0x4daf60[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]]['dialAbandonedMaxRetry']){_0x4daf60[_0x3f82('0xd9')](_0x1ce7c0,_0x1850fe['additional']);}else{hopperUtils[_0x3f82('0xda')]({'active':![],'countabandonedretry':_0x1ce7c0[_0x3f82('0xe9')],'scheduledat':moment()[_0x3f82('0xdc')](_0x4daf60[_0x3f82('0x1f')][_0x3a369b[_0x3f82('0xbe')]][_0x3f82('0xe8')],'minutes')[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x472a0b[_0x3f82('0xde')],'ListId':_0x472a0b[_0x3f82('0xdf')],'VoiceQueueId':_0x472a0b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x472a0b[_0x3f82('0xe1')]||undefined})['catch'](loggerCatch(_0x3f82('0xea')));var _0x289baf=new History(_0x1ce7c0);_0x289baf[_0x3f82('0xcf')]=0xb;_0x289baf[_0x3f82('0x6e')]=_0x3f82('0xeb');_0x289baf['starttime']=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));_0x289baf[_0x3f82('0x6f')]=_0x289baf['starttime'];_0x289baf[_0x3f82('0xe2')]=_0x1ce7c0[_0x3f82('0xe2')];_0x289baf[_0x3f82('0xe3')]=_0x1ce7c0['calleridnum'];hopperUtils[_0x3f82('0xe4')](_0x289baf)['catch'](loggerCatch(_0x3f82('0xec')));}})[_0x3f82('0x3d')](function(){if(_0x43de11)hopperUtils[_0x3f82('0xe6')](_0x1ce7c0,_0x5445fb,_0x5c1f29)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x3f82('0x37')]=function(_0x2679e7){if(this[_0x3f82('0x24')][_0x2679e7['uniqueid']]){this[_0x3f82('0x24')][_0x2679e7['uniqueid']]['channel']=_0x2679e7[_0x3f82('0xed')];}if(this['uniqueId'][_0x2679e7['uniqueid']]){this[_0x3f82('0x26')][_0x2679e7[_0x3f82('0xbf')]]['channel']=_0x2679e7[_0x3f82('0xed')];}};Dialer[_0x3f82('0x1a')][_0x3f82('0xee')]=function(_0x14053c){if(!this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]]){return;}var _0x2f4c23=this[_0x3f82('0x1f')][this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]][_0x3f82('0xbe')]][_0x3f82('0xf0')]||'rrmemory';if(_0x2f4c23===_0x3f82('0xf1')){if(this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]]&&_[_0x3f82('0xf2')](this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]][_0x3f82('0xf3')])&&_0x14053c[_0x3f82('0x86')]==='1'&&_0x14053c[_0x3f82('0xf4')]==='0'){if(this[_0x3f82('0xf5')][_0x14053c[_0x3f82('0xf6')]]){if(!this[_0x3f82('0xf5')][_0x14053c[_0x3f82('0xf6')]][_0x3f82('0xf3')]){this[_0x3f82('0xf5')][_0x14053c[_0x3f82('0xf6')]]['locked']=!![];this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]]['locked']=!![];this['actions'][_0x14053c[_0x3f82('0xef')]][_0x3f82('0xf6')]=_0x14053c[_0x3f82('0xf6')];}}}}else if(_0x2f4c23===_0x3f82('0xf7')){if(this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]]){if(this['agents'][_0x14053c[_0x3f82('0xf6')]]){this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]][_0x3f82('0xf6')]=_0x14053c[_0x3f82('0xf6')];if(_[_0x3f82('0xf2')](this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x14053c['actionid']][_0x3f82('0xbe')]])){this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x14053c['actionid']][_0x3f82('0xbe')]]=[];}this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x14053c['actionid']][_0x3f82('0xbe')]][_0x3f82('0x96')](_[_0x3f82('0x5b')](_[_0x3f82('0x73')](this[_0x3f82('0x24')][_0x14053c[_0x3f82('0xef')]],[_0x3f82('0xf8'),_0x3f82('0xf6')]),{'status':_0x14053c[_0x3f82('0x86')],'paused':_0x14053c[_0x3f82('0xf4')]}));}}}};Dialer[_0x3f82('0x1a')][_0x3f82('0x3c')]=function(_0x2b4f73){if(!this['actions'][_0x2b4f73[_0x3f82('0xef')]]){return;}var _0x30d529=this;var _0x11eb69=this[_0x3f82('0x1f')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]]['queue']];var _0x2b8efa=_0x11eb69[_0x3f82('0xf0')]||_0x3f82('0xf7');if(_0x2b8efa===_0x3f82('0xf1')){if(this[_0x3f82('0x24')][_0x2b4f73['actionid']]&&this['actions'][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xf6')]){this[_0x3f82('0x1e')][_0x3f82('0xf9')](this['actions'][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xf8')],this[_0x3f82('0x24')][_0x2b4f73['actionid']][_0x3f82('0xf6')])[_0x3f82('0x9e')](function(_0x2473d4){logger[_0x3f82('0x63')](_0x3f82('0xfa'),util['inspect'](_0x2473d4,{'showHidden':![],'depth':null}));})[_0x3f82('0x1d')](function(){_0x30d529[_0x3f82('0xc1')](_0x30d529['voiceQueues'][_0x30d529[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]);_0x30d529['agents'][_0x30d529[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xf6')]]['locked']=![];delete _0x30d529[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]];unlockQueueStatus(_0x11eb69);});}else{this['updateOriginated'](this[_0x3f82('0x1f')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]);hopperUtils[_0x3f82('0xda')]({'active':![],'ContactId':this[_0x3f82('0x24')][_0x2b4f73['actionid']]['ContactId'],'ListId':this[_0x3f82('0x24')][_0x2b4f73['actionid']]['ListId'],'VoiceQueueId':this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch(_0x3f82('0xfb')));delete this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]];unlockQueueStatus(_0x11eb69);}}else if(_0x2b8efa===_0x3f82('0xf7')){var _0x215419;if(this['actions'][_0x2b4f73[_0x3f82('0xef')]]&&!_['isEmpty'](this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]])){if(this['queueBookedRR'][_0x30d529[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]){this['queueBookedRR'][_0x30d529[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]=this[_0x3f82('0xfc')][this['actions'][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]?this['queueBookedRR'][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]:this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]?this['queueBooked'][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]][_0x3f82('0xfd')]||0x0:0x0;}this[_0x3f82('0x2a')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]]['_rr']=this[_0x3f82('0xfc')][this[_0x3f82('0x24')][_0x2b4f73[_0x3f82('0xef')]][_0x3f82('0xbe')]];for(var _0x63462e=0x0;_0x63462e=_0x18f4d7[_0x3f82('0x121')]){_0x284f48[_0x3f82('0x122')](_0x5888c7,_0x1cd0b3,_0x3e7bec,_0x3f82('0x123'));}else{if(_0x5888c7[_0x3f82('0x11a')]>=_0x18f4d7['dialMachineMaxRetry']){_0x284f48[_0x3f82('0x124')](_0x5888c7,_0x1cd0b3,_0x3e7bec,_0x3f82('0x125'));}else{hopperUtils[_0x3f82('0xda')]({'active':![],'countmachineretry':_0x5888c7[_0x3f82('0x11a')],'scheduledat':moment()[_0x3f82('0xdc')](_0x18f4d7['dialMachineRetryFrequency'],_0x3f82('0xdd'))[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x5888c7[_0x3f82('0xde')],'ListId':_0x5888c7[_0x3f82('0xdf')],'VoiceQueueId':_0x5888c7[_0x3f82('0xe0')]||undefined,'CampaignId':_0x5888c7[_0x3f82('0xe1')]||undefined})['catch'](loggerCatch(_0x3f82('0x126')));_0x1cd0b3({'reschedule':0x1});}}});}if(_0x2b01e3[_0x3f82('0x3f')]==='ivr'&&this[_0x3f82('0x20')][_0x2b01e3['queue']]['dialAMDActive']&&_0x4e8589[_0x3f82('0x110')]===_0x3f82('0x111')){delete this[_0x3f82('0x26')][_0x4e8589[_0x3f82('0xbf')]];this['updateOriginated'](this[_0x3f82('0x20')][_0x2b01e3[_0x3f82('0xbe')]]);_0x48fcf7=new Hangup(_0x2b01e3,_0x4e8589);_0x48fcf7[_0x3f82('0xcf')]=0x12;_0x48fcf7[_0x3f82('0x6e')]=_0x3f82('0x113');_0x48fcf7['membername']='AMD';ami[_0x3f82('0x115')](_0x3f82('0x11b'),ut[_0x3f82('0x116')](_0x48fcf7,_0x3f82('0x117')));this[_0x3f82('0x127')](_0x48fcf7,_0x3f82('0x128'),'[syncHangupInAMDIvr]');}if(_0x2b01e3[_0x3f82('0x3f')]==='ivr'&&this[_0x3f82('0x20')][_0x2b01e3[_0x3f82('0xbe')]]['dialAMDActive']&&_0x4e8589['value']==='MACHINE'){return new Promise(function(_0x26cd86,_0x5ba615){delete _0x284f48[_0x3f82('0x26')][_0x4e8589['uniqueid']];_0x284f48[_0x3f82('0xc1')](_0x284f48[_0x3f82('0x20')][_0x2b01e3[_0x3f82('0xbe')]]);_0x284f48[_0x3f82('0x20')][_0x2b01e3[_0x3f82('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x284f48[_0x3f82('0x20')][_0x2b01e3['queue']][_0x3f82('0x112')]+=0x1;var _0x22b339=_0x284f48[_0x3f82('0x20')][_0x2b01e3[_0x3f82('0xbe')]];var _0x59cd7f=new Hangup(_0x2b01e3,_0x4e8589);_0x59cd7f[_0x3f82('0xcf')]=0x13;_0x59cd7f['statedesc']=_0x3f82('0x129');_0x59cd7f[_0x3f82('0x119')]=_0x3f82('0x114');_0x59cd7f[_0x3f82('0x11a')]+=0x1;_0x59cd7f['countglobal']+=0x1;_0x59cd7f[_0x3f82('0x117')]=!![];ami[_0x3f82('0x115')](_0x3f82('0x11b'),ut[_0x3f82('0x116')](_0x59cd7f,_0x3f82('0x117')));hopperUtils[_0x3f82('0xe4')](_0x59cd7f)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x11c')));if(_0x59cd7f[_0x3f82('0x11d')]+_0x59cd7f[_0x3f82('0x12a')]+_0x59cd7f[_0x3f82('0x11e')]+_0x59cd7f[_0x3f82('0x11f')]+_0x59cd7f[_0x3f82('0xdb')]+_0x59cd7f['countabandonedretry']+_0x59cd7f[_0x3f82('0x11a')]+_0x59cd7f[_0x3f82('0x120')]>=_0x22b339[_0x3f82('0x121')]){_0x284f48[_0x3f82('0x122')](_0x59cd7f,_0x26cd86,_0x5ba615,_0x3f82('0x123'));}else{if(_0x59cd7f[_0x3f82('0x11a')]>=_0x22b339[_0x3f82('0x12b')]){_0x284f48[_0x3f82('0x124')](_0x59cd7f,_0x26cd86,_0x5ba615,_0x3f82('0x125'));}else{hopperUtils[_0x3f82('0xda')]({'active':![],'countmachineretry':_0x59cd7f[_0x3f82('0x11a')],'scheduledat':moment()[_0x3f82('0xdc')](_0x22b339[_0x3f82('0x12c')],_0x3f82('0xdd'))['format'](_0x3f82('0xc3')),'ContactId':_0x59cd7f['ContactId'],'ListId':_0x59cd7f[_0x3f82('0xdf')],'VoiceQueueId':_0x59cd7f['VoiceQueueId']||undefined,'CampaignId':_0x59cd7f[_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0x26cd86({'reschedule':0x1});}}});}}};Dialer[_0x3f82('0x1a')]['syncHangup']=function(_0x3a385a){var _0x1a0aa1=this[_0x3f82('0x26')][_0x3a385a['uniqueid']];var _0x1ae23d;if(_0x1a0aa1&&_0x1a0aa1[_0x3f82('0x3f')]===_0x3f82('0xc0')){delete this[_0x3f82('0x26')][_0x3a385a[_0x3f82('0xbf')]];this[_0x3f82('0xc1')](this[_0x3f82('0x20')][_0x1a0aa1[_0x3f82('0xbe')]]);this['campaigns'][_0x1a0aa1[_0x3f82('0xbe')]][_0x3f82('0x12d')]+=0x1;_0x1ae23d=new Hangup(_0x1a0aa1,_0x3a385a);hopperUtils[_0x3f82('0xe4')](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x12e')));hopperUtils[_0x3f82('0xca')](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x12f')));}if(_0x1a0aa1&&_0x1a0aa1[_0x3f82('0x3f')]!=='ivr'&&isNotNull(this[_0x3f82('0x1f')][_0x1a0aa1['queue']]['dialQueueProject'])){delete this[_0x3f82('0x26')][_0x3a385a[_0x3f82('0xbf')]];this[_0x3f82('0xc1')](this[_0x3f82('0x1f')][_0x1a0aa1[_0x3f82('0xbe')]]);this[_0x3f82('0x1f')][_0x1a0aa1[_0x3f82('0xbe')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x1a0aa1[_0x3f82('0xbe')]][_0x3f82('0x112')]+=0x1;_0x1ae23d=new Hangup(_0x1a0aa1,_0x3a385a);_0x1ae23d[_0x3f82('0xcf')]=0x10;_0x1ae23d['statedesc']=_0x3f82('0x130');_0x1ae23d[_0x3f82('0x119')]=_0x3f82('0x131');hopperUtils['createHistory'](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x12e')));hopperUtils[_0x3f82('0xca')](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch('[syncHangupIvr]'));}if(_0x1a0aa1&&_0x1a0aa1[_0x3f82('0x3f')]!==_0x3f82('0xc0')&&!isNotNull(this[_0x3f82('0x1f')][_0x1a0aa1[_0x3f82('0xbe')]][_0x3f82('0x132')])){delete this['uniqueId'][_0x3a385a[_0x3f82('0xbf')]];this['updateOriginated'](this[_0x3f82('0x1f')][_0x1a0aa1[_0x3f82('0xbe')]]);this['voiceQueues'][_0x1a0aa1[_0x3f82('0xbe')]][_0x3f82('0x133')]+=0x1;_0x1ae23d=new Hangup(_0x1a0aa1,_0x3a385a);_0x1ae23d[_0x3f82('0xcf')]=0xc;_0x1ae23d[_0x3f82('0x6e')]=_0x3a385a['cause-txt'];_0x1ae23d[_0x3f82('0x119')]=_0x3f82('0x134');hopperUtils[_0x3f82('0xe4')](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x12e')));hopperUtils[_0x3f82('0xca')](_0x1ae23d)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x12f')));}};Dialer[_0x3f82('0x1a')][_0x3f82('0xc')]=function(_0x41f3c4){var _0x20cc54=this;if(!_0x20cc54[_0x3f82('0x135')][_0x41f3c4[_0x3f82('0x5e')]]){_0x20cc54[_0x3f82('0x135')][_0x41f3c4[_0x3f82('0x5e')]]={'running':![]};}else if(_0x20cc54[_0x3f82('0x135')][_0x41f3c4[_0x3f82('0x5e')]][_0x3f82('0x136')]===!![]){return;}else if(_0x20cc54['queuesSummary'][_0x41f3c4[_0x3f82('0x5e')]][_0x3f82('0x136')]===![]){_0x20cc54[_0x3f82('0x135')][_0x41f3c4[_0x3f82('0x5e')]][_0x3f82('0x136')]=!![];}var _0x1d87d1=_0x20cc54[_0x3f82('0x1f')][_0x41f3c4[_0x3f82('0x5e')]];var _0x3591db=_0x1d87d1[_0x3f82('0x68')]!==utils[_0x3f82('0x69')]['INACTIVE'];var _0x40fa61=utils[_0x3f82('0x137')](_0x1d87d1);_0x1d87d1[_0x3f82('0x138')]=utils[_0x3f82('0x139')](_0x1d87d1,_0x20cc54['trunks']);Promise[_0x3f82('0xaa')]()[_0x3f82('0x3d')](function(){if(_0x1d87d1[_0x3f82('0x138')]===utils['CAMPAIGN_STATUS'][_0x3f82('0x78')]){if(_0x3591db){clearPredictiveAttributes(_0x1d87d1);_0x41f3c4[_0x3f82('0x27')]=undefined;_0x41f3c4[_0x3f82('0x28')]=undefined;}if(_0x1d87d1[_0x3f82('0x138')]===utils[_0x3f82('0x69')][_0x3f82('0x78')]){_0x41f3c4[_0x3f82('0x13a')]=0x0;_0x41f3c4[_0x3f82('0xf4')]=0x0;_0x41f3c4[_0x3f82('0x13b')]=0x0;_0x41f3c4[_0x3f82('0x13c')]=0x0;_0x41f3c4[_0x3f82('0x13d')]=0x0;}}else if(_0x1d87d1['statusMessage']===utils[_0x3f82('0x69')][_0x3f82('0x13e')]&&!_0x40fa61){return _0x20cc54[_0x3f82('0x92')](_0x1d87d1,!![])['then'](function(){return _0x20cc54[_0x3f82('0x92')](_0x1d87d1,![]);})[_0x3f82('0x3d')](function(){return _0x20cc54[_0x3f82('0xae')](_0x1d87d1);})[_0x3f82('0x9e')](function(_0x188859){loggerSyncQueueSummary[_0x3f82('0x5d')](_0x3f82('0x13f'),util[_0x3f82('0x42')](_0x188859,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1d87d1);});}else{clearPredictiveAttributes(_0x1d87d1);}})[_0x3f82('0x3d')](function(){var _0x391f72=_0x41f3c4[_0x3f82('0x140')](_0x1d87d1);if(_0x391f72||_0x1d87d1[_0x3f82('0x141')]){_0x1d87d1[_0x3f82('0x141')]=![];_0x41f3c4['updateReportFromOutboundQueue'](_0x1d87d1);Object[_0x3f82('0x142')](_0x1d87d1,_0x41f3c4);emitOutboundVoiceQueueSummary(_0x41f3c4);}_0x20cc54[_0x3f82('0x135')][_0x1d87d1[_0x3f82('0x5e')]][_0x3f82('0x136')]=![];})[_0x3f82('0x9e')](function(_0x1e3b7e){logger['error'](_0x3f82('0x13f'),util['inspect'](_0x1e3b7e,{'showHidden':![],'depth':null}));_0x20cc54[_0x3f82('0x135')][_0x1d87d1[_0x3f82('0x5e')]][_0x3f82('0x136')]=![];});};Dialer[_0x3f82('0x1a')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x2de481=_[_0x3f82('0x143')](this[_0x3f82('0x1f')],function(_0xe98a4){return _0xe98a4[_0x3f82('0x144')];});var _0x22dd03=_[_0x3f82('0x143')](this[_0x3f82('0xf5')],function(_0x5ab6f2){return _0x5ab6f2[_0x3f82('0x145')]&&_0x5ab6f2[_0x3f82('0x86')]===_0x3f82('0x87');});if(_0x2de481[_0x3f82('0x95')]>0x0&&_0x22dd03['length']>0x0){return Promise[_0x3f82('0xaa')]()[_0x3f82('0x3d')](cmHopper[_0x3f82('0x146')](_[_0x3f82('0x147')](_0x2de481,'id'),previewRecallmeReminderInterval,_['map'](_0x22dd03,'id')))[_0x3f82('0x3d')](function(_0x11acc5){for(var _0x259601=0x0;_0x259601<_0x11acc5[_0x3f82('0x95')];_0x259601++){var _0x2f6fa7=_0x11acc5[_0x259601]['Agent'][_0x3f82('0x5e')];if(_0x2f6fa7)io['to'](util[_0x3f82('0x7b')]('user:%s',_0x2f6fa7))[_0x3f82('0x115')](_0x3f82('0x148'),{'hopper':_0x11acc5[_0x259601]});}})[_0x3f82('0x9e')](function(_0x101797){logger[_0x3f82('0x63')](_0x3f82('0x149'),_0x101797);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x3f82('0x14a')]=function(){var _0x4d4108=this;setInterval(function(){_0x4d4108[_0x3f82('0x14b')](_0x4d4108['uniqueId'],_0x3f82('0x14c'));_0x4d4108[_0x3f82('0x14b')](_0x4d4108['actions'],_0x3f82('0x14d'));},0x32c8);};Dialer[_0x3f82('0x1a')]['clearZombieChannels']=function(_0x598ca7,_0x101d92){var _0x3dedb4=this;for(var _0x23f70c in _0x598ca7){if(typeof _0x598ca7[_0x23f70c]!==_0x3f82('0xa8')){this[_0x3f82('0x14e')][_0x3f82('0x1b')](function(){if(!_[_0x3f82('0xf2')](_0x598ca7[_0x23f70c])){return ami['Action']({'action':_0x3f82('0x86'),'channel':_0x598ca7[_0x23f70c]['channel']})[_0x3f82('0x9e')](function(_0x344c62){if(_0x344c62['message']===_0x3f82('0x14f')){setTimeout(function(){if(_0x598ca7[_0x23f70c]&&_0x598ca7[_0x23f70c]['type']!==_0x3f82('0xc0')){_0x3dedb4['updateOriginated'](_0x3dedb4[_0x3f82('0x1f')][_0x598ca7[_0x23f70c][_0x3f82('0xbe')]]);logger[_0x3f82('0x63')]('[Dialer][checkChannel]',_0x101d92,_0x23f70c,_0x598ca7[_0x23f70c][_0x3f82('0xbe')]);delete _0x598ca7[_0x23f70c];}if(_0x598ca7[_0x23f70c]&&_0x598ca7[_0x23f70c]['type']===_0x3f82('0xc0')){_0x3dedb4['updateOriginated'](_0x3dedb4[_0x3f82('0x20')][_0x598ca7[_0x23f70c][_0x3f82('0xbe')]]);logger[_0x3f82('0x63')](_0x3f82('0x150'),_0x101d92,_0x23f70c,_0x598ca7[_0x23f70c][_0x3f82('0xbe')]);delete _0x598ca7[_0x23f70c];}},0x2328);}});}});}}};Dialer[_0x3f82('0x1a')]['getVoiceQueueRtPauses']=function(_0x5d41f0){return Promise[_0x3f82('0xaa')]()[_0x3f82('0x3d')](voiceQueueRt[_0x3f82('0x151')](_0x5d41f0))[_0x3f82('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x3f82('0x1a')][_0x3f82('0xc1')]=function(_0x11f906){if(!_[_0x3f82('0x3e')](_0x11f906)&&_0x11f906!==null){if(typeof _0x11f906[_0x3f82('0x7f')]!==_0x3f82('0xa8')){if(_0x11f906[_0x3f82('0x7f')]>0x0){_0x11f906['originated']-=0x1;}else{logger[_0x3f82('0x63')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3f82('0x63')](_0x3f82('0x152'));}};Dialer['prototype'][_0x3f82('0x153')]=function(_0x5c072b,_0x40e083){var _0x21ce6d=this;return function(_0x4eb372){_0x21ce6d[_0x3f82('0xc1')](_0x40e083);logger[_0x3f82('0x63')](_0x5c072b,util[_0x3f82('0x42')](_0x4eb372,{'showHidden':![],'depth':null}));};};Dialer[_0x3f82('0x1a')][_0x3f82('0x154')]=function(_0x26caba,_0xfa6a9e,_0xd5ee16){var _0x39b88b={'state':0x19,'statedesc':_0x3f82('0x155')};this[_0x3f82('0xc1')](_0xfa6a9e);this['saveInDb'](_[_0x3f82('0x5b')](_0x39b88b,_['pick'](_0xd5ee16,['ContactId',_0x3f82('0xdf'),_0x3f82('0x156'),'VoiceQueueId',_0x3f82('0xe1')])),_0x3f82('0x157'),_0x3f82('0x158'));logger[_0x3f82('0x63')](_0x26caba);};Dialer['prototype']['saveInDb']=function(_0x14227c,_0x1c3f9c,_0x4d576d){hopperUtils[_0x3f82('0xe4')](_0x14227c)['catch'](loggerCatch(_0x1c3f9c));hopperUtils[_0x3f82('0xca')](_0x14227c)[_0x3f82('0x9e')](loggerCatch(_0x4d576d));};Dialer[_0x3f82('0x1a')][_0x3f82('0xd9')]=function(_0x30bbf5,_0xd853b6){hopperUtils['createHistory'](_0x30bbf5)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0xc9')));if(_0xd853b6==0x0){hopperUtils[_0x3f82('0xca')](_0x30bbf5)['catch'](loggerCatch(_0x3f82('0x159')));}};Dialer[_0x3f82('0x1a')]['checkPreviewRecallReminder']=function(_0x45dcca){return Promise['resolve']()['then'](cmHopper[_0x3f82('0x146')](_0x45dcca['id'],previewRecallmeReminderInterval))[_0x3f82('0x3d')](function(_0x489d34){for(var _0x1ec82a=0x0;_0x1ec82a<_0x489d34[_0x3f82('0x95')];_0x1ec82a++){var _0x7c0248=_0x489d34[_0x1ec82a][_0x3f82('0x15a')][_0x3f82('0x5e')];if(_0x7c0248)io['to'](util[_0x3f82('0x7b')]('user:%s',_0x7c0248))[_0x3f82('0x115')]('user:dialPreviewRecallReminder',{'hopper':_0x489d34[_0x1ec82a]});}})['catch'](function(){});};Dialer[_0x3f82('0x1a')][_0x3f82('0xac')]=function(_0x1fb195){var _0x5d7190=this;return function(){_0x5d7190['handleIvr'](_0x1fb195);};};Dialer['prototype'][_0x3f82('0x15b')]=function(_0x44c30b,_0x32b0ac){var _0x4996c0=this;var _0x314ff7=uuid['v4']();this[_0x3f82('0x24')][_0x314ff7]=new Action(_0x44c30b,_0x32b0ac,_0x314ff7);return new Promise(function(_0x16c9d1,_0x2ee615){if(_[_0x3f82('0x3e')](_0x44c30b)&&typeof _0x44c30b!==_0x3f82('0x15c')){return _0x2ee615(msgResponse(_0x3f82('0x15d'),_0x3f82('0x8f'),'voiceQueue\x20is\x20undefine'));}if(_[_0x3f82('0x3e')](_0x32b0ac[_0x3f82('0x15e')])||_0x32b0ac[_0x3f82('0x15e')]===null){return _0x2ee615(msgResponse(_0x3f82('0x15d'),_0x3f82('0x8f'),'contact\x20is\x20undefine'));}var _0x504fb8={'XMD-CALLERID':_0x4996c0[_0x3f82('0x24')][_0x314ff7][_0x3f82('0x15f')](),'XMD-AGI':_0x44c30b[_0x3f82('0x132')]?util[_0x3f82('0x7b')](_0x3f82('0x160'),ipAgi,_0x44c30b[_0x3f82('0x132')]):_0x3f82('0x161'),'XMD-AGIAFTER':_0x44c30b['dialQueueProject2']?util['format'](_0x3f82('0x160'),ipAgi,_0x44c30b[_0x3f82('0xc8')]):'NONE','XMD-QUEUE':utils[_0x3f82('0x162')](_0x44c30b)?util[_0x3f82('0x7b')](_0x3f82('0x163'),_0x44c30b[_0x3f82('0x5e')],_0x44c30b[_0x3f82('0x164')]||'',_0x44c30b['dialAgiAfterHangupAgent']?'c':'',_0x44c30b[_0x3f82('0xce')]||0x3):'NONE','XMD-CONTACTID':_0x32b0ac[_0x3f82('0xde')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4996c0[_0x3f82('0x24')][_0x314ff7][_0x3f82('0x15f')](),'XMD-AMD':_0x44c30b[_0x3f82('0x10f')]?_0x3f82('0x13e'):_0x3f82('0x161'),'XMD-DESTINATION':_0x3f82('0x10e')};if(_0x44c30b[_0x3f82('0x10f')]){_0x504fb8[_0x3f82('0x165')]=_0x44c30b[_0x3f82('0x166')]||0x9c4;_0x504fb8[_0x3f82('0x167')]=_0x44c30b[_0x3f82('0x168')]||0x5dc;_0x504fb8['XMD-AMDAFTERGREETINGSILENCE']=_0x44c30b[_0x3f82('0x169')]||0x320;_0x504fb8['XMD-AMDTOTALANALYSISTIME']=_0x44c30b[_0x3f82('0x16a')]||0x1388;_0x504fb8[_0x3f82('0x16b')]=_0x44c30b[_0x3f82('0x16c')]||0x64;_0x504fb8[_0x3f82('0x16d')]=_0x44c30b[_0x3f82('0x16e')]||0x32;_0x504fb8[_0x3f82('0x16f')]=_0x44c30b[_0x3f82('0x170')]||0x3;_0x504fb8[_0x3f82('0x171')]=_0x44c30b[_0x3f82('0x172')]||0x100;_0x504fb8[_0x3f82('0x173')]=_0x44c30b[_0x3f82('0x174')]||0x1388;}if(utils[_0x3f82('0x162')](_0x44c30b)){_0x504fb8[_0x3f82('0x175')]=_0x32b0ac[_0x3f82('0xe0')];}else{_0x504fb8[_0x3f82('0x176')]=_0x32b0ac[_0x3f82('0xe1')];}var _0x404404=utils['setXMDContactVariables'](_0x32b0ac['Contact']);Object[_0x3f82('0x142')](_0x504fb8,_0x404404);var _0x5d1a83=_0x4996c0[_0x3f82('0x83')](_0x44c30b[_0x3f82('0x177')])?utils[_0x3f82('0x178')](_0x44c30b['Trunk'][_0x3f82('0x179')],_0x44c30b[_0x3f82('0x17a')],_0x44c30b[_0x3f82('0x17b')]>0x0?utils[_0x3f82('0x17c')](_0x44c30b[_0x3f82('0x17d')],_0x44c30b[_0x3f82('0x17b')]):_0x44c30b[_0x3f82('0x17d')]):utils[_0x3f82('0x178')](_[_0x3f82('0xf2')](_0x44c30b[_0x3f82('0x8a')])?_0x44c30b[_0x3f82('0x177')]['callerid']:_0x44c30b['TrunkBackup']['callerid'],_0x44c30b[_0x3f82('0x17a')],_0x44c30b[_0x3f82('0x17b')]>0x0?utils[_0x3f82('0x17c')](_0x44c30b[_0x3f82('0x17d')],_0x44c30b['dialRandomLastDigitCallerIdNumber']):_0x44c30b['dialOriginateCallerIdNumber']);if(_0x5d1a83){_0x504fb8[_0x3f82('0x17e')]=_0x4996c0[_0x3f82('0x24')][_0x314ff7][_0x3f82('0x17f')]=utils[_0x3f82('0x180')](_0x5d1a83);_0x504fb8[_0x3f82('0x181')]=_0x32b0ac[_0x3f82('0x15e')];}_0x44c30b['variables']=_0x504fb8;return ami[_0x3f82('0x97')]({'actionid':_0x314ff7,'action':_0x3f82('0x15d'),'channel':_0x4996c0['isTrunkReachable'](_0x44c30b[_0x3f82('0x177')])?util[_0x3f82('0x7b')]('SIP/%s/%s%s',_0x44c30b['Trunk']['name'],isNotNull(_0x44c30b[_0x3f82('0x182')])?_0x44c30b['dialPrefix'][_0x3f82('0x183')]()||'':'',_0x44c30b[_0x3f82('0x184')]>0x0?_0x32b0ac[_0x3f82('0x15e')][_0x3f82('0x185')](_0x44c30b[_0x3f82('0x184')]):_0x32b0ac[_0x3f82('0x15e')]):util[_0x3f82('0x7b')]('SIP/%s/%s%s',_['isNil'](_0x44c30b['TrunkBackup'])?_0x44c30b['Trunk'][_0x3f82('0x5e')]:_0x44c30b[_0x3f82('0x8a')][_0x3f82('0x5e')],isNotNull(_0x44c30b[_0x3f82('0x182')])?_0x44c30b[_0x3f82('0x182')][_0x3f82('0x183')]()||'':'',_0x44c30b[_0x3f82('0x184')]>0x0?_0x32b0ac[_0x3f82('0x15e')]['substring'](_0x44c30b[_0x3f82('0x184')]):_0x32b0ac[_0x3f82('0x15e')]),'callerid':_0x5d1a83,'Exten':_0x3f82('0x10e'),'Context':_0x3f82('0x186'),'Priority':'1','variable':_0x504fb8,'timeout':(_0x44c30b[_0x3f82('0x187')]||0x1e)*0x3e8,'async':!![],'channelid':_0x314ff7})['then'](function(_0x1480a0){return _0x16c9d1(_0x1480a0);})[_0x3f82('0x9e')](function(_0x4f0957){_0x44c30b[_0x3f82('0x188')]+=0x1;var _0x52093c=new History(_0x4996c0[_0x3f82('0x24')][_0x314ff7]);logger[_0x3f82('0x63')](util[_0x3f82('0x7b')](_0x3f82('0x189'),JSON[_0x3f82('0xa5')](_0x4f0957)));_0x52093c[_0x3f82('0xcf')]=0xe;_0x52093c['statedesc']=_0x3f82('0x18a');_0x52093c['starttime']=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));_0x52093c[_0x3f82('0x6f')]=_0x52093c['starttime'];hopperUtils['createHistory'](_0x52093c)[_0x3f82('0x9e')](loggerCatch('[originate][error]'));_0x4996c0[_0x3f82('0xca')](_0x52093c)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x18b')))['finally'](function(){delete _0x4996c0[_0x3f82('0x24')][_0x314ff7];return _0x2ee615(msgResponse(_0x3f82('0x15d'),'Error','originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x418a6c,_0xa5f12c,_0x5784f7){var _0x314b6b=new History(_0xa5f12c);if(_0x314b6b[_0x3f82('0x11d')]+_0x314b6b[_0x3f82('0x12a')]+_0x314b6b[_0x3f82('0x11e')]+_0x314b6b[_0x3f82('0x11f')]+_0x314b6b[_0x3f82('0xdb')]+_0x314b6b[_0x3f82('0xe9')]+_0x314b6b['countmachineretry']+_0x314b6b[_0x3f82('0x120')]>=_0x5784f7[_0x3f82('0x121')]-0x1){return!![];}switch(_0x418a6c){case 0x3:if(_0x314b6b[_0x3f82('0x11e')]>=_0x5784f7['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x3f82('0xda')]({'active':![],'countnoanswerretry':_0x314b6b[_0x3f82('0x11e')]+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0x18c')],'minutes')['format'](_0x3f82('0xc3')),'ContactId':_0x314b6b['ContactId'],'ListId':_0x314b6b[_0x3f82('0xdf')],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b['CampaignId']||undefined})['catch'](loggerCatch(_0x3f82('0x18d')));break;case 0x5:if(_0x314b6b['countbusyretry']>=_0x5784f7[_0x3f82('0x18e')]-0x1){return!![];}hopperUtils[_0x3f82('0xda')]({'active':![],'countbusyretry':_0x314b6b['countbusyretry']+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0x18f')],_0x3f82('0xdd'))[_0x3f82('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x314b6b[_0x3f82('0xde')],'ListId':_0x314b6b[_0x3f82('0xdf')],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b[_0x3f82('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x314b6b['countcongestionretry']>=_0x5784f7['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x3f82('0xda')]({'active':![],'countcongestionretry':_0x314b6b['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0x190')],_0x3f82('0xdd'))[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x314b6b['ContactId'],'ListId':_0x314b6b['ListId'],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b['CampaignId']||undefined})['catch'](loggerCatch(_0x3f82('0x191')));break;case 0x0:if(_0x314b6b['countnosuchnumberretry']>=_0x5784f7[_0x3f82('0x192')]-0x1){return!![];}else{hopperUtils[_0x3f82('0xda')]({'active':![],'countnosuchnumberretry':_0x314b6b[_0x3f82('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x5784f7['dialNoSuchNumberRetryFrequency'],_0x3f82('0xdd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x314b6b[_0x3f82('0xde')],'ListId':_0x314b6b[_0x3f82('0xdf')],'VoiceQueueId':_0x314b6b['VoiceQueueId']||undefined,'CampaignId':_0x314b6b[_0x3f82('0xe1')]||undefined})['catch'](loggerCatch(_0x3f82('0x193')));}break;case 0xa:if(_0x314b6b[_0x3f82('0xdb')]>=_0x5784f7[_0x3f82('0xd8')]-0x1){return!![];}hopperUtils[_0x3f82('0xda')]({'active':![],'countdropretry':_0x314b6b[_0x3f82('0xdb')]+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0xd3')],'minutes')[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x314b6b[_0x3f82('0xde')],'ListId':_0x314b6b['ListId'],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b[_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x314b6b['countabandonedretry']>=_0x5784f7[_0x3f82('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x314b6b[_0x3f82('0xe9')]+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0xe8')],_0x3f82('0xdd'))[_0x3f82('0x7b')](_0x3f82('0xc3')),'ContactId':_0x314b6b['ContactId'],'ListId':_0x314b6b['ListId'],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b[_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch(_0x3f82('0xea')));break;case 0x13:if(_0x314b6b[_0x3f82('0x11a')]>=_0x5784f7[_0x3f82('0x12b')]-0x1){return!![];}hopperUtils[_0x3f82('0xda')]({'active':![],'countmachineretry':_0x314b6b[_0x3f82('0x11a')]+=0x1,'scheduledat':moment()[_0x3f82('0xdc')](_0x5784f7[_0x3f82('0x12c')],_0x3f82('0xdd'))[_0x3f82('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x314b6b['ContactId'],'ListId':_0x314b6b['ListId'],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b['CampaignId']||undefined})['catch'](loggerCatch(_0x3f82('0x126')));break;case 0x14:if(_0x314b6b['countagentrejectretry']>=_0x5784f7['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x314b6b[_0x3f82('0x120')]+=0x1,'scheduledat':moment()['add'](_0x5784f7[_0x3f82('0x195')],'minutes')['format'](_0x3f82('0xc3')),'ContactId':_0x314b6b[_0x3f82('0xde')],'ListId':_0x314b6b[_0x3f82('0xdf')],'VoiceQueueId':_0x314b6b[_0x3f82('0xe0')]||undefined,'CampaignId':_0x314b6b[_0x3f82('0xe1')]||undefined})[_0x3f82('0x9e')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3f82('0x1a')][_0x3f82('0x109')]=function(_0x38e6e1,_0xf40ea9,_0x1bfe2b){var _0x4332e9=this;var _0x96e7e6=new History(_0x38e6e1);var _0x35bcd2=![];var _0x18ad22;var _0xb57683;return new Promise(function(_0x502980,_0x359a4b){if(_[_0x3f82('0x3e')](_0xf40ea9)&&typeof _0xf40ea9!==_0x3f82('0x15c')){return _0x359a4b(msgResponse(_0x3f82('0x196'),_0x3f82('0x8f'),_0x3f82('0x197')));}if(_[_0x3f82('0x3e')](_0x1bfe2b)&&typeof _0x1bfe2b!==_0x3f82('0x15c')){return _0x359a4b(msgResponse(_0x3f82('0x196'),_0x3f82('0x8f'),_0x3f82('0x198')));}hopperUtils[_0x3f82('0xd5')](_0x96e7e6,_0x1bfe2b[_0x3f82('0xc5')],_0xf40ea9)[_0x3f82('0x3d')](function(_0x4c7b52){if(_0x4c7b52[_0x3f82('0xd7')]==0x1)_0x35bcd2=!![];switch(_0x1bfe2b[_0x3f82('0xc5')]){case'0':_0xf40ea9[_0x3f82('0x199')]+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0x0;_0x96e7e6[_0x3f82('0x6e')]=_0x3f82('0x19a');_0x96e7e6['countnosuchnumberretry']+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x3f82('0x116')](_0x38e6e1,_0x3f82('0x19b')));_0x18ad22=_0xf40ea9[_0x3f82('0x19c')];_0xb57683=_0xf40ea9[_0x3f82('0xd4')];hopperUtils[_0x3f82('0xe4')](_0x96e7e6)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x11c')));if(_0x4332e9[_0x3f82('0x19d')](0x0,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0x11f')]>=_0xf40ea9[_0x3f82('0x192')]){_0x4332e9[_0x3f82('0x124')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x19e'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x19e'));}}break;case'3':_0xf40ea9[_0x3f82('0x19f')]+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0x3;_0x96e7e6['statedesc']=_0x3f82('0x1a0');_0x96e7e6['countnoanswerretry']+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;var _0x423850=ut[_0x3f82('0x1a1')](_0x38e6e1,_0xf40ea9);ami[_0x3f82('0x115')]('custom:agentnoanswer',_0x423850);_0x18ad22=_0xf40ea9[_0x3f82('0x18c')];_0xb57683=_0xf40ea9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x96e7e6)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x1a2')));if(_0x4332e9[_0x3f82('0x19d')](0x3,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6['countnoanswerretry']>=_0xf40ea9[_0x3f82('0x1a3')]){_0x4332e9[_0x3f82('0x124')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1a4'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1a4'));}}break;case'5':_0xf40ea9[_0x3f82('0x1a5')]+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0x5;_0x96e7e6[_0x3f82('0x6e')]=_0x3f82('0x1a6');_0x96e7e6[_0x3f82('0x11d')]+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;ami[_0x3f82('0x115')](_0x3f82('0x1a7'),ut[_0x3f82('0x116')](_0x38e6e1,_0x3f82('0x1a8')));_0x18ad22=_0xf40ea9['dialBusyRetryFrequency'];_0xb57683=_0xf40ea9[_0x3f82('0xd4')];hopperUtils[_0x3f82('0xe4')](_0x96e7e6)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x1a9')));if(_0x4332e9[_0x3f82('0x19d')](0x5,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0x11d')]>=_0xf40ea9['dialBusyMaxRetry']){_0x4332e9[_0x3f82('0x124')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1aa'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1aa'));}}break;case'8':_0xf40ea9['outboundCongestionCallsDay']+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0x8;_0x96e7e6['statedesc']=_0x3f82('0x1ab');_0x96e7e6[_0x3f82('0x12a')]+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;_0x18ad22=_0xf40ea9[_0x3f82('0x190')];_0xb57683=_0xf40ea9[_0x3f82('0xd4')];ami[_0x3f82('0x115')]('custom:agentcongestion',ut[_0x3f82('0x116')](_0x38e6e1,_0x3f82('0x1ac')));hopperUtils['createHistory'](_0x96e7e6)['catch'](loggerCatch(_0x3f82('0x1ad')));if(_0x4332e9[_0x3f82('0x19d')](0x8,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0x12a')]>=_0xf40ea9[_0x3f82('0x1ae')]){_0x4332e9[_0x3f82('0x124')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1af'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1af'));}}break;case'11':_0xf40ea9['outboundAbandonedCallsDay']+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0xb;_0x96e7e6['statedesc']='Abandoned';_0x96e7e6['countabandonedretry']+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;_0x18ad22=_0xf40ea9[_0x3f82('0xe8')];_0xb57683=_0xf40ea9[_0x3f82('0xd4')];hopperUtils[_0x3f82('0xe4')](_0x96e7e6)['catch'](loggerCatch(_0x3f82('0xec')));if(_0x4332e9[_0x3f82('0x19d')](0xb,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0xe9')]>=_0xf40ea9[_0x3f82('0x194')]){_0x4332e9['createStateFinal'](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1b0'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1b0'));}}break;case'20':_0xf40ea9[_0x3f82('0x1b1')]+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0x14;_0x96e7e6['statedesc']=_0x3f82('0x1b2');_0x96e7e6[_0x3f82('0x120')]+=0x1;_0x96e7e6[_0x3f82('0xd2')]+=0x1;_0x18ad22=_0xf40ea9['dialAgentRejectRetryFrequency'];_0xb57683=_0xf40ea9['callAdditionalPhoneAfterMin'];ami['emit'](_0x3f82('0x1b3'),ut[_0x3f82('0x116')](_0x38e6e1,'agentreject'));hopperUtils[_0x3f82('0xe4')](_0x96e7e6)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x1b4')));if(_0x4332e9[_0x3f82('0x19d')](0x14,_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0x120')]>=_0xf40ea9[_0x3f82('0x1b5')]){_0x4332e9[_0x3f82('0x124')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1b6'));}else{_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x3f82('0x1b6'));}}break;default:_0xf40ea9[_0x3f82('0x133')]+=0x1;_0x96e7e6[_0x3f82('0xcf')]=0xc;_0x96e7e6['statedesc']=_0x1bfe2b[_0x3f82('0xc5')];_0x18ad22=_0xf40ea9['dialAgentRejectRetryFrequency'];_0xb57683=_0xf40ea9[_0x3f82('0xd4')];hopperUtils[_0x3f82('0xe4')](_0x96e7e6)[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x1b7')));if(_0x4332e9[_0x3f82('0x19d')](_0x1bfe2b[_0x3f82('0xc5')],_0x38e6e1,_0xf40ea9)&&!_0x35bcd2){if(_0x96e7e6[_0x3f82('0x11d')]+_0x96e7e6[_0x3f82('0x12a')]+_0x96e7e6[_0x3f82('0x11e')]+_0x96e7e6[_0x3f82('0x11f')]+_0x96e7e6[_0x3f82('0xdb')]+_0x96e7e6[_0x3f82('0xe9')]+_0x96e7e6['countmachineretry']+_0x96e7e6[_0x3f82('0x120')]>=_0xf40ea9['dialGlobalMaxRetry']){_0x4332e9[_0x3f82('0x122')](_0x96e7e6,_0x502980,_0x359a4b,_0x1bfe2b[_0x3f82('0xc5')]);}else{_0x4332e9['createStateFinal'](_0x96e7e6,_0x502980,_0x359a4b,_0x1bfe2b[_0x3f82('0xc5')]);}}}})['then'](function(){if(_0x35bcd2){hopperUtils[_0x3f82('0xe6')](_0x96e7e6,_0x18ad22,_0xb57683)[_0x3f82('0x3d')](function(){return _0x502980(0x1);});}});});};Dialer[_0x3f82('0x1a')][_0x3f82('0x122')]=function(_0x55d8d0,_0x57efc8,_0x31b804,_0x2f785e){var _0x875789=new Final(_0x55d8d0);_0x875789[_0x3f82('0xcf')]=0xf;_0x875789['statedesc']=_0x3f82('0x1b8');this[_0x3f82('0x124')](_0x875789,_0x57efc8,_0x31b804,_0x2f785e);};Dialer['prototype']['createStateFinal']=function(_0x47826f,_0xd6b181,_0x1ba087,_0x15f415){hopperUtils[_0x3f82('0xca')](_0x47826f)[_0x3f82('0x3d')](function(){return _0xd6b181(msgResponse('[callProgressDetecting]',_0x3f82('0x108'),_0x15f415));})[_0x3f82('0x9e')](function(){return _0x1ba087(msgResponse(_0x3f82('0x1b9'),'Failure',_0x3f82('0x1ba')));});};Dialer[_0x3f82('0x1a')][_0x3f82('0xb')]=function(_0x5be180){var _0xef852e=_0x5be180['dialPredictiveOptimizationPercentage']/0x64;var _0x41c47e=_0x5be180[_0x3f82('0x1bb')]/(_0x5be180[_0x3f82('0x1bb')]+_0x5be180[_0x3f82('0xc4')]);var _0x13fb81=Math[_0x3f82('0x1bc')](_0x5be180[_0x3f82('0x1bd')]*(_0x5be180['predictiveIntervalMaxThreshold']/0x64));var _0x3bb439=Math[_0x3f82('0x1bc')](_0x5be180[_0x3f82('0x1bd')]*(_0x5be180[_0x3f82('0x1be')]/0x64));var _0x36d53c=_0x5be180[_0x3f82('0x13a')]+_0x5be180[_0x3f82('0x13c')];var _0x4855a9=Math['floor'](_0x5be180[_0x3f82('0x55')]*_0x5be180['erlangAbandonmentRate']*_0x5be180[_0x3f82('0x1bf')]*_0x5be180[_0x3f82('0x1c0')]);if(_[_0x3f82('0x3e')](_0x5be180[_0x3f82('0x28')])){if(!_[_0x3f82('0x3e')](_0x5be180[_0x3f82('0x27')])){_0x5be180[_0x3f82('0x27')]=undefined;loggerPredictive[_0x3f82('0x63')](_0x3f82('0x1c1'),_0x3f82('0x1c2'));}if(!_[_0x3f82('0x3e')](_0x5be180[_0x3f82('0x61')])){loggerPredictive[_0x3f82('0x63')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5be180['handlePredictive']);_0x5be180[_0x3f82('0x61')]=undefined;}_0x5be180['startProgressive']=moment()[_0x3f82('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5be180[_0x3f82('0x5e')],'collection\x20data\x20in\x20progressive\x20at',_0x5be180['startProgressive']);this[_0x3f82('0xb2')](_0x5be180,0x1);}else if(ifInterval(_0x5be180['dialPredictiveInterval'],_0x5be180[_0x3f82('0x28')])){this[_0x3f82('0xb2')](_0x5be180,0x1);loggerPredictiveCalls[_0x3f82('0x47')](_0x3f82('0x1c3'),_0x5be180[_0x3f82('0x28')],_0x5be180[_0x3f82('0x5e')]);_0x5be180[_0x3f82('0x55')]=0x0;_0x5be180[_0x3f82('0x1c4')]=0x0;}else if(_0xef852e<_0x41c47e&&_0x5be180[_0x3f82('0x1c5')]===_0x3f82('0x1c6')){clearPredictiveAttributes(_0x5be180);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x1c7'),'Dropped\x20calls\x20day',_0x41c47e,_0x3f82('0x28'),_0x5be180[_0x3f82('0x5e')]);}else if(_0x4855a9<_0x5be180[_0x3f82('0x1c4')]&&_0x5be180[_0x3f82('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x5be180);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x1c8'),_0x3f82('0x1c9'),_0x4855a9,_0x3f82('0x1ca'),_0x5be180['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5be180[_0x3f82('0x5e')]);}else if(!ifInterval(_0x5be180[_0x3f82('0x1cb')],_0x5be180[_0x3f82('0x28')])&&_['isUndefined'](_0x5be180['startPredictive'])&&!_[_0x3f82('0x3e')](_0x5be180[_0x3f82('0x28')])){_0x5be180['startPredictive']=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));loggerPredictive[_0x3f82('0x47')](_0x5be180['name'],_0x3f82('0x1cc'),_0x5be180[_0x3f82('0x27')]);hopperUtils[_0x3f82('0x1cd')](_0x5be180[_0x3f82('0x1cb')])['then'](this[_0x3f82('0x1ce')](_0x5be180))[_0x3f82('0x3d')](mergeDataErlangB(_0x5be180))[_0x3f82('0x3d')](this[_0x3f82('0x1cf')](_0x5be180))['catch'](loggerCatchPredictive(_0x3f82('0x1d0'),_0x5be180));}else if(!ifInterval(_0x5be180['dialPredictiveInterval'],_0x5be180['startPredictive'])){_0x5be180['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5be180[_0x3f82('0x27')]=moment()[_0x3f82('0x7b')](_0x3f82('0xc3'));loggerPredictive[_0x3f82('0x47')](_0x5be180['name'],_0x3f82('0x1d1'),_0x5be180[_0x3f82('0x27')]);clearInterval(_0x5be180[_0x3f82('0x61')]);_0x5be180[_0x3f82('0x61')]=undefined;hopperUtils[_0x3f82('0x1cd')](_0x5be180[_0x3f82('0x1cb')])['then'](this[_0x3f82('0x1ce')](_0x5be180))['then'](mergeDataErlangB(_0x5be180))[_0x3f82('0x3d')](this['startMethodPredictive'](_0x5be180))[_0x3f82('0x9e')](loggerCatchPredictive(_0x3f82('0x1d2'),_0x5be180));}else if(_0x5be180[_0x3f82('0x1bd')]&&_0x36d53c<_0x5be180['predictiveIntervalAvailable']-_0x3bb439){clearPredictiveAttributes(_0x5be180);loggerPredictive[_0x3f82('0x47')](_0x5be180['name'],_0x3f82('0x1d3'),_0x36d53c,_0x3f82('0x1d4'),_0x5be180[_0x3f82('0x1bd')],'-',_0x3bb439,'=',_0x5be180[_0x3f82('0x1bd')]-_0x3bb439,')');}else if(_0x5be180[_0x3f82('0x1bd')]&&_0x36d53c>_0x5be180[_0x3f82('0x1bd')]+_0x13fb81){clearPredictiveAttributes(_0x5be180);loggerPredictive[_0x3f82('0x47')](_0x5be180[_0x3f82('0x5e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x36d53c,_0x3f82('0x1d5'),_0x5be180[_0x3f82('0x1bd')],'+',_0x13fb81,'=',_0x5be180['predictiveIntervalAvailable']+_0x13fb81,')');}};Dialer[_0x3f82('0x1a')][_0x3f82('0x1ce')]=function(_0x3285a0){var _0x375d9a=this;return function(_0x289530){return new Promise(function(_0x1554d1,_0x41c2a3){_[_0x3f82('0x5b')](_0x3285a0,_0x289530[0x0]);if(checkGetDataPredictive(_0x289530[0x0])){var _0x98d839=_0x3285a0[_0x3f82('0x1bd')]=_0x3285a0[_0x3f82('0x13c')]+_0x3285a0[_0x3f82('0x13a')];var _0xc0c55c=_0x3285a0['dialPredictiveInterval']*0x3c;var _0x456b63=_0x289530[0x0][_0x3f82('0x4f')]+_0x289530[0x0][_0x3f82('0x4e')];var _0x453046=(_0x289530[0x0]['predictiveIntervalAnsweredCalls']+_0x289530[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x289530[0x0][_0x3f82('0x1d6')])/_0x289530[0x0][_0x3f82('0x46')];_0x3285a0[_0x3f82('0x1bf')]=_0x453046>0x0?_0x453046:0x1;switch(_0x3285a0[_0x3f82('0x1c5')]){case'dropRate':var _0x77ed3e=_0x3285a0[_0x3f82('0x1d7')]/0x64;return _0x375d9a[_0x3f82('0x1d8')](_0x98d839,_0xc0c55c,_0x456b63,_0x453046,_0x77ed3e)['then'](function(_0x487c30){return _0x1554d1(_0x487c30);});case _0x3f82('0x1d9'):var _0x6a571e=_0x3285a0['dialPredictiveOptimizationPercentage']/0x64;return _0x375d9a[_0x3f82('0x1da')](_0x98d839,_0xc0c55c,_0x456b63,_0x453046,_0x6a571e)[_0x3f82('0x3d')](function(_0x4eee28){return _0x1554d1(_0x4eee28);});default:return _0x41c2a3(msgResponse(_0x3f82('0x1db'),'Failure','Unknown\x20Predictive'));}}else{return _0x41c2a3(msgResponse(_0x3f82('0x1db'),'Failure','check\x20failure'));}});};};Dialer[_0x3f82('0x1a')]['getDataPredictiveOld']=function(_0x4567c0){var _0x558745=this;return function(_0x492a32){return new Promise(function(_0x5e4528,_0x2cfb36){_[_0x3f82('0x5b')](_0x4567c0,_0x492a32[0x0]);if(checkGetDataPredictive(_0x492a32[0x0])){loggerPredictive[_0x3f82('0x47')](JSON['stringify'](_0x492a32[0x0]));if(_0x4567c0[_0x3f82('0x1c5')]===_0x3f82('0x1c6')){return _0x558745[_0x3f82('0x151')](_0x4567c0['id'])[_0x3f82('0x3d')](function(_0x4d6c1b){var _0x22ffb7=_0x4567c0[_0x3f82('0x1dc')]-_0x4d6c1b[0x0]['outboundQueuePauses'];var _0x167e03=_0x4567c0[_0x3f82('0x1cb')]*0x3c;var _0x375f81=_0x492a32[0x0][_0x3f82('0x4f')]+_0x492a32[0x0][_0x3f82('0x4e')];var _0x5c17a0=(_0x492a32[0x0]['predictiveIntervalAnsweredCalls']+_0x492a32[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x492a32[0x0][_0x3f82('0x1d6')])/_0x492a32[0x0][_0x3f82('0x46')];var _0x99e7c1=_0x4567c0['dialPredictiveOptimizationPercentage']/0x64;_0x4567c0['predictiveIntervalPauses']=_0x4d6c1b[0x0][_0x3f82('0x1dd')]||0x0;_0x4567c0[_0x3f82('0x1bf')]=_0x5c17a0>0x0?_0x5c17a0:0x1;return _0x558745[_0x3f82('0x1d8')](_0x22ffb7,_0x167e03,_0x375f81,_0x5c17a0,_0x99e7c1);})[_0x3f82('0x3d')](function(_0x3c8257){return _0x5e4528(_0x3c8257);})[_0x3f82('0x9e')](function(_0x368341){return _0x2cfb36(msgResponse('[CatchErlangB]',_0x3f82('0x8f'),JSON['stringify'](_0x368341)));});}if(_0x4567c0[_0x3f82('0x1c5')]===_0x3f82('0x1d9')){return _0x558745['getVoiceQueueRtPauses'](_0x4567c0['id'])[_0x3f82('0x3d')](function(_0xb41210){var _0xf89de7=_0x4567c0[_0x3f82('0x1dc')]-_0xb41210[0x0][_0x3f82('0x1dd')];var _0x2af08b=_0x4567c0[_0x3f82('0x1cb')]*0x3c;var _0x5335ad=_0x492a32[0x0][_0x3f82('0x4f')]+_0x492a32[0x0][_0x3f82('0x4e')];var _0x7cc0c6=(_0x492a32[0x0][_0x3f82('0x49')]+_0x492a32[0x0][_0x3f82('0x4b')]+_0x492a32[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x492a32[0x0]['predictiveIntervalTotalCalls'];var _0x12fbc1=_0x4567c0[_0x3f82('0x1d7')]/0x64;_0x4567c0[_0x3f82('0x1de')]=_0xb41210[0x0][_0x3f82('0x1dd')]||0x0;_0x4567c0[_0x3f82('0x1bf')]=_0x7cc0c6>0x0?_0x7cc0c6:0x1;return _0x558745['busyFactor'](_0xf89de7,_0x2af08b,_0x5335ad,_0x7cc0c6,_0x12fbc1);})[_0x3f82('0x3d')](function(_0x551717){return _0x5e4528(_0x551717);})[_0x3f82('0x9e')](function(_0xc15e54){return _0x2cfb36(msgResponse(_0x3f82('0x1df'),'Failure',JSON[_0x3f82('0xa5')](_0xc15e54)));});}}else{return _0x2cfb36(msgResponse(_0x3f82('0x1db'),_0x3f82('0x8f'),_0x3f82('0x1e0')));}});};};Dialer['prototype'][_0x3f82('0x1cf')]=function(_0x45e969){var _0x439fbe=this;return function(){var _0x56e8ca=0x0;var _0x41cecf=Math['floor'](_0x45e969[_0x3f82('0x1e1')]*0x3e8);if(_0x41cecf>0x0){_0x41cecf=_0x41cecf<0x64?0x64:_0x41cecf;loggerPredictive['info'](_0x45e969[_0x3f82('0x5e')],'one\x20call\x20every:',_0x41cecf,_0x3f82('0x1e2'));_0x45e969[_0x3f82('0x61')]=setInterval(function(){_0x439fbe[_0x3f82('0x61')](_0x45e969);loggerPredictiveCalls['info']('[handlePredictive]',_0x56e8ca+=0x1);},_0x41cecf);}else{loggerPredictive[_0x3f82('0x47')](_0x45e969[_0x3f82('0x5e')],_0x3f82('0x1e3'));}};};Dialer[_0x3f82('0x1a')][_0x3f82('0x1e4')]=function(_0x4a36e4,_0x4e6074){var _0x322f6a=this;return function(_0x13b055){if(_[_0x3f82('0x43')](_0x13b055)){if(_[_0x3f82('0xf2')](_0x4e6074[_0x3f82('0x156')])||!_0x4e6074[_0x3f82('0x1e5')]){if(_0x4a36e4[_0x3f82('0xaf')]===_0x3f82('0xa')){_0x4a36e4[_0x3f82('0x71')]=_[_0x3f82('0x3e')](_0x4a36e4[_0x3f82('0x71')])?!![]:_0x4a36e4[_0x3f82('0x71')];var _0x594796=uuid['v4']();_0x322f6a[_0x3f82('0x24')][_0x594796]=new Action(_0x4a36e4,_0x4e6074,_0x594796);loggerBooked[_0x3f82('0x47')](_0x3f82('0x1e6'),_0x594796,_0x3f82('0x1e7'),JSON[_0x3f82('0xa5')](_0x4a36e4[_0x3f82('0x71')]),_0x3f82('0x1e8'),_0x4a36e4[_0x3f82('0x5e')]);if(_0x4a36e4[_0x3f82('0x71')]){_0x4a36e4[_0x3f82('0x71')]=![];_0x322f6a['queueBooked'][_0x322f6a[_0x3f82('0x24')][_0x594796]['queue']]=[];ami[_0x3f82('0x97')]({'actionid':_0x594796,'action':_0x3f82('0x1e9'),'queue':_0x4a36e4[_0x3f82('0x5e')]})['catch'](function(){_0x322f6a['updateOriginated'](_0x4a36e4);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x322f6a[_0x3f82('0x24')][_0x594796][_0x3f82('0xde')],'ListId':_0x322f6a[_0x3f82('0x24')][_0x594796][_0x3f82('0xdf')],'VoiceQueueId':_0x322f6a[_0x3f82('0x24')][_0x594796][_0x3f82('0xe0')]||undefined,'CampaignId':_0x322f6a[_0x3f82('0x24')][_0x594796]['CampaignId']||undefined})[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x1ea')));delete _0x322f6a['actions'][_0x594796];});}else{loggerBooked['info'](_0x3f82('0x1eb'),JSON[_0x3f82('0xa5')](_0x4a36e4[_0x3f82('0x71')]),_0x3f82('0x1e8'),_0x4a36e4[_0x3f82('0x5e')]);_0x322f6a[_0x3f82('0xc1')](_0x4a36e4);hopperUtils[_0x3f82('0xda')]({'active':![],'ContactId':_0x322f6a[_0x3f82('0x24')][_0x594796][_0x3f82('0xde')],'ListId':_0x322f6a[_0x3f82('0x24')][_0x594796][_0x3f82('0xdf')],'VoiceQueueId':_0x322f6a['actions'][_0x594796][_0x3f82('0xe0')]||undefined,'CampaignId':_0x322f6a['actions'][_0x594796][_0x3f82('0xe1')]||undefined})['catch'](loggerCatch(_0x3f82('0x1ea')));delete _0x322f6a['actions'][_0x594796];}}else{return _0x322f6a['actionOriginate'](_0x4a36e4,_0x4e6074);}}else{if(utils[_0x3f82('0x5c')](undefined,_0x4e6074[_0x3f82('0x1ec')])<_0x4a36e4['dialRecallMeTimeout']*0x3c){if(_0x4e6074[_0x3f82('0x15a')]&&!_0x4e6074[_0x3f82('0x15a')][_0x3f82('0x1ed')]){_0x322f6a[_0x3f82('0x1e')][_0x3f82('0xf9')](_0x4e6074['id'])[_0x3f82('0x1d')](function(){_0x322f6a[_0x3f82('0xc1')](_0x4a36e4);});}else{hopperUtils[_0x3f82('0x1ee')]({'active':![]},_0x4e6074['id'],0x1)[_0x3f82('0x1d')](function(){_0x322f6a[_0x3f82('0xc1')](_0x4a36e4);});}}else{_0x4a36e4[_0x3f82('0x1ef')]+=0x1;_0x322f6a['updateOriginated'](_0x4a36e4);if(_0x4a36e4['dialRecallInQueue']){hopperUtils[_0x3f82('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e6074[_0x3f82('0xde')],'ListId':_0x4e6074[_0x3f82('0xdf')],'VoiceQueueId':_0x4e6074[_0x3f82('0xe0')]||undefined,'CampaignId':_0x4e6074[_0x3f82('0xe1')]||undefined})['catch'](loggerCatch(_0x3f82('0x1f0')));hopperUtils[_0x3f82('0xe4')](createObjHistory(_0x4a36e4,_0x4e6074,utils[_0x3f82('0x69')][_0x3f82('0x1f1')],0x17,_0x3f82('0x1f2')))['catch'](loggerCatch(_0x3f82('0x1f3')));}else{_0x322f6a[_0x3f82('0x127')](createObjHistory(_0x4a36e4,_0x4e6074,utils['CAMPAIGN_STATUS'][_0x3f82('0x1f4')],0x16,'RecallFailedTimeout'),_0x3f82('0x1f5'),_0x3f82('0x1f6'));}}}}else{_0x4a36e4['outboundBlacklistCallsDay']+=0x1;_0x322f6a[_0x3f82('0x127')](createObjHistory(_0x4a36e4,_0x4e6074,utils[_0x3f82('0x69')][_0x3f82('0x1f7')],0xd,'Blacklist'),_0x3f82('0x1f8'),_0x3f82('0x1f9'));throw _0x3f82('0x1fa');}};};Dialer['prototype'][_0x3f82('0x1fb')]=function(_0x52663c){var _0x21691c=this;var _0x5db35e=_0x52663c['limitCalls']-_0x52663c[_0x3f82('0x7f')];emitCampaignSummary(_0x52663c);if(_0x5db35e>0x0&&_0x52663c[_0x3f82('0x66')]==0x0){if(_0x5db35e>this[_0x3f82('0x22')]){_0x5db35e=this['maxNumberOriginate'];}_0x52663c[_0x3f82('0x66')]=0x1;hopperUtils[_0x3f82('0x1fc')](_0x52663c,_0x5db35e)[_0x3f82('0x3d')](function(_0x2f2d85){_0x52663c[_0x3f82('0x66')]=0x0;if(_0x2f2d85){if(!utils[_0x3f82('0x1fd')](_0x2f2d85)){_0x52663c['message']=utils[_0x3f82('0x69')][_0x3f82('0x6d')];logger[_0x3f82('0x47')]('[getContactCampaign2][Empty]'+_0x52663c[_0x3f82('0x5e')]);}else{_0x52663c[_0x3f82('0x7f')]+=_0x2f2d85['length'];_0x52663c['message']=utils[_0x3f82('0x69')]['RUNNING'];for(var _0x2d51ad=0x0;_0x2d51ad<_0x2f2d85['length'];_0x2d51ad+=0x1){_0x52663c[_0x3f82('0x1fe')]+=0x1;if(_['isNil'](_0x2f2d85[_0x2d51ad])||_[_0x3f82('0xf2')](_0x2f2d85[_0x2d51ad][_0x3f82('0x1ff')])||_[_0x3f82('0xf2')](_0x2f2d85[_0x2d51ad][_0x3f82('0x15e')])){_0x21691c[_0x3f82('0x154')](_0x3f82('0x200'),_0x52663c,_0x2f2d85[_0x2d51ad]);}else{hopperUtils[_0x3f82('0x201')](_[_0x3f82('0x73')](_0x2f2d85[_0x2d51ad],[_0x3f82('0xe1'),_0x3f82('0x15e')]))[_0x3f82('0x3d')](_0x21691c[_0x3f82('0x1e4')](_0x52663c,_0x2f2d85[_0x2d51ad]))[_0x3f82('0x9e')](_0x21691c['loggerHandler'](_0x3f82('0x202'),_0x52663c));}}}}})[_0x3f82('0x9e')](loggerGetContactDialer(_0x3f82('0x203'),_0x52663c,_0x5db35e));}};Dialer['prototype'][_0x3f82('0xb2')]=function(_0x5283eb,_0x453a39){var _0x1d6c79=this;var _0x31f483=[];if(_0x453a39<0x1||_0x5283eb[_0x3f82('0xaf')]===_0x3f82('0xa')){_0x453a39=0x1;}var _0x314e76=Math['floor'](_0x5283eb[_0x3f82('0x13a')]*_0x453a39)-_0x5283eb[_0x3f82('0x7f')];if(_0x5283eb[_0x3f82('0x204')]>0x0){var _0x13289e=_0x5283eb[_0x3f82('0x204')]-_0x5283eb[_0x3f82('0x7f')]-_0x5283eb['talking']-_0x5283eb['pTalking'];if(_0x314e76>_0x13289e){_0x314e76=_0x13289e;}}if(_0x314e76>0x0&&_0x5283eb[_0x3f82('0x66')]==0x0){if(_0x5283eb['dialMethod']==='booked'){_0x314e76=0x1;}if(_0x314e76>this['maxNumberOriginate']){_0x314e76=this['maxNumberOriginate'];}for(var _0x5bae9b in this['agents']){if(typeof this[_0x3f82('0xf5')][_0x5bae9b]!==_0x3f82('0xa8')){if(this[_0x3f82('0xf5')][_0x5bae9b][_0x3f82('0xcf')]===_0x3f82('0x205')&&this[_0x3f82('0xf5')][_0x5bae9b][_0x3f82('0x86')]===_0x3f82('0x87')){_0x31f483[_0x3f82('0x96')](this[_0x3f82('0xf5')][_0x5bae9b]['id']);}}}_0x5283eb['temp']=0x1;hopperUtils['getContactDialer'](_0x5283eb,_0x31f483,_0x314e76)[_0x3f82('0x3d')](function(_0x11af8e){_0x5283eb[_0x3f82('0x66')]=0x0;if(_0x11af8e){if(!utils['checkContactEmpty'](_0x11af8e)){hopperUtils[_0x3f82('0x206')](_0x5283eb)['then'](sendMessageReschedule(_0x5283eb))[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x207')));}else{_0x5283eb[_0x3f82('0x7f')]+=_0x11af8e['length'];_0x5283eb[_0x3f82('0x68')]=_0x5283eb[_0x3f82('0xaf')]==='booked'?utils['CAMPAIGN_STATUS'][_0x3f82('0x13e')]:utils['CAMPAIGN_STATUS'][_0x3f82('0x208')];for(var _0x3cafaf=0x0;_0x3cafaf<_0x11af8e[_0x3f82('0x95')];_0x3cafaf+=0x1){if(_[_0x3f82('0xf2')](_0x11af8e[_0x3cafaf])||_[_0x3f82('0xf2')](_0x11af8e[_0x3cafaf][_0x3f82('0x1ff')])||_['isNil'](_0x11af8e[_0x3cafaf][_0x3f82('0x15e')])){_0x1d6c79[_0x3f82('0x154')](_0x3f82('0x200'),_0x5283eb,_0x11af8e[_0x3cafaf]);}else{hopperUtils[_0x3f82('0x209')](_[_0x3f82('0x73')](_0x11af8e[_0x3cafaf],[_0x3f82('0xe0'),'phone']))['then'](_0x1d6c79['checkContactBlack'](_0x5283eb,_0x11af8e[_0x3cafaf]))[_0x3f82('0x9e')](_0x1d6c79[_0x3f82('0x153')](_0x3f82('0x200'),_0x5283eb));}}}}})[_0x3f82('0x9e')](loggerGetContactDialer('[getContactDialer2]',_0x5283eb,_0x314e76));}};Dialer['prototype'][_0x3f82('0x61')]=function(_0x38b586){if(_0x38b586[_0x3f82('0x204')]>0x0){var _0x2dbaf6=_0x38b586[_0x3f82('0x204')]-_0x38b586[_0x3f82('0x7f')]-_0x38b586[_0x3f82('0x13c')];if(_0x2dbaf6>0x0&&_0x38b586[_0x3f82('0x66')]==0x0){this[_0x3f82('0x20a')](_0x38b586);}else{loggerPredictiveCalls[_0x3f82('0x47')](_0x3f82('0x20b'));}}else{this[_0x3f82('0x20a')](_0x38b586);}};Dialer[_0x3f82('0x1a')][_0x3f82('0x20a')]=function(_0x35a3ea){var _0x3e45ca=this;var _0x53c3a6=[];_0x35a3ea[_0x3f82('0x7f')]+=0x1;for(var _0x440d99 in this[_0x3f82('0xf5')]){if(typeof this[_0x3f82('0xf5')][_0x440d99]!=='undefined'){if(this[_0x3f82('0xf5')][_0x440d99][_0x3f82('0xcf')]===_0x3f82('0x205')&&this['agents'][_0x440d99]['status']===_0x3f82('0x87')){_0x53c3a6['push'](this['agents'][_0x440d99]['id']);}}}_0x35a3ea[_0x3f82('0x66')]=0x1;return this[_0x3f82('0x20c')](_0x35a3ea['id'],_0x53c3a6,0x1,_0x35a3ea['dialOrderByScheduledAt'],_0x35a3ea)[_0x3f82('0x3d')](function(_0x19b6be){_0x35a3ea[_0x3f82('0x66')]=0x1;if(_0x19b6be){if(!utils['checkContactEmpty'](_0x19b6be)){utils[_0x3f82('0x65')](_0x35a3ea,0x1,0x0);return hopperUtils[_0x3f82('0x206')](_0x35a3ea)[_0x3f82('0x3d')](sendMessageReschedule(_0x35a3ea))[_0x3f82('0x9e')](loggerCatch(_0x3f82('0x207')));}else{_0x35a3ea[_0x3f82('0x68')]=utils[_0x3f82('0x69')]['RUNNING'];if(_[_0x3f82('0xf2')](_0x19b6be[0x0])||_[_0x3f82('0xf2')](_0x19b6be[0x0][_0x3f82('0x1ff')])||_[_0x3f82('0xf2')](_0x19b6be[0x0]['phone'])){_0x3e45ca['emptyContact']('[actionOriginate]\x20',_0x35a3ea,_0x19b6be[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x3f82('0x73')](_0x19b6be[0x0],[_0x3f82('0xe0'),'phone']))[_0x3f82('0x3d')](_0x3e45ca[_0x3f82('0x1e4')](_0x35a3ea,_0x19b6be[0x0]))[_0x3f82('0x9e')](_0x3e45ca[_0x3f82('0x153')]('[actionOriginatePredictive]\x20',_0x35a3ea));}}}})['catch'](loggerGetContactDialer(_0x3f82('0x20d'),_0x35a3ea,0x1));};Dialer[_0x3f82('0x1a')]['abandonmentRate']=function(_0x2652dc,_0x546279,_0x2d6e78,_0x30611f,_0x26134c,_0x27f5c3){loggerPredictive[_0x3f82('0x47')](_0x3f82('0x20e'));loggerPredictive[_0x3f82('0x47')](_0x3f82('0x20f'),_0x2652dc);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x210'),_0x546279);loggerPredictive[_0x3f82('0x47')]('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',_0x2d6e78);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x211'),_0x30611f);loggerPredictive[_0x3f82('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26134c);loggerPredictive['info'](_0x3f82('0x5a'));return new Promise(function(_0x18f52e,_0x59f0d7){if(_0x2652dc<=0x0||isNaN(_0x2652dc)){return _0x59f0d7(msgResponse('[abandonmentRate]',_0x3f82('0x82'),_0x3f82('0x212')+_0x2652dc));}if(_0x2d6e78<=0x0||isNaN(_0x2d6e78)){return _0x59f0d7(msgResponse('[abandonmentRate]',_0x3f82('0x82'),_0x3f82('0x213')+_0x2d6e78));}if(_0x30611f<=0x0||isNaN(_0x30611f)){return _0x59f0d7(msgResponse(_0x3f82('0x214'),_0x3f82('0x82'),_0x3f82('0x215')+_0x30611f));}if(_0x546279<=0x0||isNaN(_0x546279)){return _0x59f0d7(msgResponse(_0x3f82('0x214'),_0x3f82('0x82'),_0x3f82('0x216')+_0x546279));}if(_0x26134c<=0x0||isNaN(_0x26134c)){return _0x59f0d7(msgResponse('[abandonmentRate]','Error',_0x3f82('0x217')+_0x26134c));}_0x27f5c3=_0x27f5c3||0x0;var _0x27f21f=0x1/_0x2d6e78;var _0x25b561=0x0;var _0x384acb=0x0;var _0xc00568=0x0;var _0x1e63c2=0x0;for(var _0x984110=0x0;_0xc00568<_0x26134c;_0x984110+=0x1){_0x384acb=_0x984110/_0x546279;_0x25b561=(_0x30611f*_0x384acb+_0x27f5c3)/_0x27f21f;_0xc00568=utils[_0x3f82('0x218')](_0x25b561,_0x2652dc);_0x1e63c2=_0x25b561/_0x2652dc*(0x1-utils[_0x3f82('0x218')](_0x25b561,_0x2652dc));}return _0x18f52e({'erlangCalls':_0x984110,'erlangCallToSecond':_0x546279/_0x984110,'erlangAbandonmentRate':_0xc00568,'erlangBusyFactor':_0x1e63c2});});};Dialer['prototype'][_0x3f82('0x1da')]=function(_0x3aa21f,_0x2829c5,_0x7f1224,_0x242566,_0x11f469,_0x98c0c1){loggerPredictive[_0x3f82('0x47')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x3f82('0x47')](_0x3f82('0x20f'),_0x3aa21f);loggerPredictive[_0x3f82('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2829c5);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x219'),_0x7f1224);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x211'),_0x242566);loggerPredictive[_0x3f82('0x47')](_0x3f82('0x21a'),_0x11f469);loggerPredictive['info'](_0x3f82('0x5a'));return new Promise(function(_0x579c88,_0x20e019){if(_0x3aa21f<=0x0||isNaN(_0x3aa21f)){return _0x20e019(msgResponse(_0x3f82('0x21b'),'Error',_0x3f82('0x212')+_0x3aa21f));}if(_0x7f1224<=0x0||isNaN(_0x7f1224)){return _0x20e019(msgResponse(_0x3f82('0x21b'),_0x3f82('0x82'),'Ts\x20=\x20'+_0x7f1224));}if(_0x242566<=0x0||isNaN(_0x242566)){return _0x20e019(msgResponse('[busyFactor]',_0x3f82('0x82'),_0x3f82('0x215')+_0x242566));}if(_0x2829c5<=0x0||isNaN(_0x2829c5)){return _0x20e019(msgResponse(_0x3f82('0x21b'),_0x3f82('0x82'),_0x3f82('0x216')+_0x2829c5));}if(_0x11f469<=0x0||isNaN(_0x11f469)){return _0x20e019(msgResponse('[busyFactor]',_0x3f82('0x82'),_0x3f82('0x21c')+_0x11f469));}_0x98c0c1=_0x98c0c1||0x0;var _0x49d3eb=0x1/_0x7f1224;var _0xc1993a=0x0;var _0x4ad14b=0x0;var _0x46a40b=0x0;var _0x2d8607=0x0;for(var _0x1ddd7c=0x0;_0x2d8607<_0x11f469;_0x1ddd7c+=0x1){_0x4ad14b=_0x1ddd7c/_0x2829c5;_0xc1993a=(_0x242566*_0x4ad14b+_0x98c0c1)/_0x49d3eb;_0x46a40b=utils[_0x3f82('0x218')](_0xc1993a,_0x3aa21f);_0x2d8607=_0xc1993a/_0x3aa21f*(0x1-utils[_0x3f82('0x218')](_0xc1993a,_0x3aa21f));}return _0x579c88({'erlangCalls':_0x1ddd7c,'erlangCallToSecond':_0x2829c5/_0x1ddd7c,'erlangAbandonmentRate':_0x46a40b,'erlangBusyFactor':_0x2d8607});});};module['exports']=Dialer; \ No newline at end of file +var _0x544e=['Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive','debug','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','is\x20not\x20active','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','NULL_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','Action','command','format','iftime\x20%s,%s','interval','content','indexOf','catch','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','predictive','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_GLOBAL_INTERVAL','isGlobal','AMI\x20IfTime','[ifTime][Action]','syncAgentConnect','queue','uniqueid','updateOriginated','answertime','syncAgentComplete','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','countdropretry','dialDropMaxRetry','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','add','[rescheduleContact][Abandoned]','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','push','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','stringify','contactAgent-idHopper:\x20','idHopper','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','[syncHangupIvr][createHistory]','moveContactManagedDialer','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------'];(function(_0x288f8e,_0x25f044){var _0x4e54a1=function(_0x48ab88){while(--_0x48ab88){_0x288f8e['push'](_0x288f8e['shift']());}};_0x4e54a1(++_0x25f044);}(_0x544e,0x1ca));var _0xe544=function(_0x5b9ace,_0x1749d5){_0x5b9ace=_0x5b9ace-0x0;var _0x422c92=_0x544e[_0x5b9ace];return _0x422c92;};'use strict';var util=require(_0xe544('0x0'));var _=require('lodash');var uuid=require(_0xe544('0x1'));var moment=require(_0xe544('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xe544('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0xe544('0x4'));var config=require(_0xe544('0x5'));var logger=require(_0xe544('0x6'))('dialer');var loggerBooked=require(_0xe544('0x6'))('booked');var loggerPredictive=require(_0xe544('0x6'))('predictive');var loggerPredictiveCalls=require(_0xe544('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe544('0x6'))('syncQueueSummary');var ami=require(_0xe544('0x7'));config[_0xe544('0x8')]=_['defaults'](config[_0xe544('0x8')],{'host':_0xe544('0x9'),'port':0x18eb});var io=require(_0xe544('0xa'))(new Redis(config[_0xe544('0x8')]));var cmHopper=require(_0xe544('0xb'));var voiceQueueRt=require(_0xe544('0xc'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0xe544('0xd'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xe544('0xe'));var Hangup=require(_0xe544('0xf'));var ipAgi=process[_0xe544('0x10')][_0xe544('0x11')]||_0xe544('0x12');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe544('0x13')][_0xe544('0x14')]=function(_0x5e71b6){this['tail']=this[_0xe544('0x15')]?this[_0xe544('0x15')][_0xe544('0x16')](_0x5e71b6):_0x5e71b6();};function Dialer(_0x3e3035,_0x4e90f0){this[_0xe544('0x17')]=new Sequence();this[_0xe544('0x18')]=_0x4e90f0;this['voiceQueues']=_0x3e3035[_0xe544('0x19')];this[_0xe544('0x1a')]=_0x3e3035[_0xe544('0x1a')];this[_0xe544('0x1b')]=_0x3e3035[_0xe544('0x1b')];this[_0xe544('0x1c')]=_0x3e3035[_0xe544('0x1c')];this[_0xe544('0x1d')]=config[_0xe544('0x1d')]||0x2;this[_0xe544('0x1e')]={};this[_0xe544('0x1f')]={};this[_0xe544('0x20')]={};this[_0xe544('0x21')]={};this[_0xe544('0x22')]={};this[_0xe544('0x23')]={};this['startProgressive']={};this[_0xe544('0x24')]={};this[_0xe544('0x25')]={};this[_0xe544('0x26')]={};this[_0xe544('0x27')]={};ami['on'](_0xe544('0x28'),this['syncAgentConnect'][_0xe544('0x29')](this));ami['on'](_0xe544('0x2a'),this[_0xe544('0x2b')][_0xe544('0x29')](this));ami['on'](_0xe544('0x2c'),this[_0xe544('0x2d')]['bind'](this));ami['on'](_0xe544('0x2e'),this['syncAgentComplete'][_0xe544('0x29')](this));ami['on'](_0xe544('0x2f'),this[_0xe544('0x30')][_0xe544('0x29')](this));ami['on'](_0xe544('0x31'),this[_0xe544('0x32')][_0xe544('0x29')](this));ami['on'](_0xe544('0x33'),this[_0xe544('0x34')][_0xe544('0x29')](this));ami['on']('newexten',this[_0xe544('0x35')][_0xe544('0x29')](this));ami['on']('varset',this[_0xe544('0x36')][_0xe544('0x29')](this));ami['on'](_0xe544('0x37'),this[_0xe544('0x38')][_0xe544('0x29')](this));ami['on'](_0xe544('0x39'),this[_0xe544('0x3a')][_0xe544('0x29')](this));this['loopCampaigns']();this[_0xe544('0x3b')]();RpcSetting[_0xe544('0x3c')]()[_0xe544('0x3d')](function(_0x191b3f){previewRecallmeReminderInterval=_0x191b3f[_0xe544('0x3e')];});}function isNotNull(_0x12ca93){return _0x12ca93!==null&&!_[_0xe544('0x3f')](_0x12ca93);}function msgResponse(_0x243a0b,_0x362720,_0x579c8a){return{'action':_0x243a0b,'response':_0x362720,'message':_0x579c8a,'stack':_0x579c8a};}function emit(_0x5832da,_0x257596,_0x1a4044){io['to'](_0x5832da)[_0xe544('0x40')](_0x257596,_0x1a4044);}function emitOutboundVoiceQueueSummary(_0x2de085){if(_0x2de085[_0xe544('0x41')]===_0xe544('0x42')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xe544('0x43')](_0x2de085,{'showHidden':![],'depth':null}));emit(util['format'](_0xe544('0x44'),_0x2de085[_0xe544('0x45')]),_0xe544('0x46'),_0x2de085);}}function checkGetDataPredictive(_0x4aa7e7){if(isNotNull(_0x4aa7e7)&&!_[_0xe544('0x47')](_0x4aa7e7)){loggerPredictive[_0xe544('0x48')](_0xe544('0x49'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4aa7e7['predictiveIntervalTotalCalls']);loggerPredictive[_0xe544('0x48')](_0xe544('0x4a'),_0x4aa7e7[_0xe544('0x4b')]);loggerPredictive[_0xe544('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4aa7e7['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe544('0x48')](_0xe544('0x4c'),_0x4aa7e7[_0xe544('0x4d')]);loggerPredictive['info'](_0xe544('0x4e'),_0x4aa7e7[_0xe544('0x4f')]);loggerPredictive[_0xe544('0x48')](_0xe544('0x50'),_0x4aa7e7[_0xe544('0x51')]);loggerPredictive['info'](_0xe544('0x52'));if(_0x4aa7e7[_0xe544('0x53')]>0x0){if(!_['isUndefined'](_0x4aa7e7['predictiveIntervalAvgTalktime'])&&_0x4aa7e7[_0xe544('0x51')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xe544('0x3f')](_0x4aa7e7[_0xe544('0x4f')])&&_0x4aa7e7['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xe544('0x48')](_0xe544('0x54'));}else{loggerPredictive[_0xe544('0x48')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xe544('0x48')](_0xe544('0x55'));}return![];}function mergeDataErlangB(_0x2392e1){return function(_0x33616c){loggerPredictive[_0xe544('0x48')](_0xe544('0x56'));loggerPredictive[_0xe544('0x48')](_0xe544('0x57'),_0x33616c['erlangCalls']);loggerPredictive[_0xe544('0x48')](_0xe544('0x58'),_0x33616c[_0xe544('0x59')]);loggerPredictive['info'](_0xe544('0x5a'),_0x33616c['erlangAbandonmentRate']);loggerPredictive[_0xe544('0x48')](_0xe544('0x5b'),_0x33616c['erlangBusyFactor']);loggerPredictive['info'](_0xe544('0x5a'),_0x33616c[_0xe544('0x5c')]);loggerPredictive[_0xe544('0x48')](_0xe544('0x52'));_[_0xe544('0x5d')](_0x2392e1,_0x33616c);};}function ifInterval(_0xf30abc,_0x35994c){if(_[_0xe544('0x3f')](_0x35994c)){return![];}return utils[_0xe544('0x5e')](undefined,_0x35994c)<_0xf30abc*0x3c;}function clearPredictiveAttributes(_0x53add5){if(_0x53add5[_0xe544('0x5f')]){_0x53add5[_0xe544('0x5f')]=undefined;loggerPredictive[_0xe544('0x60')](_0x53add5[_0xe544('0x45')],_0xe544('0x61'));}if(_0x53add5[_0xe544('0x23')]){_0x53add5[_0xe544('0x23')]=undefined;loggerPredictive[_0xe544('0x60')](_0x53add5[_0xe544('0x45')],'startPredictive\x20value\x20cleared');}if(_0x53add5[_0xe544('0x62')]){clearInterval(_0x53add5[_0xe544('0x62')]);_0x53add5[_0xe544('0x62')]=undefined;loggerPredictive[_0xe544('0x60')](_0x53add5[_0xe544('0x45')],_0xe544('0x63'));}}function loggerCatchPredictive(_0x5f2ead,_0x545815){return function(_0x301c1f){loggerPredictive['error'](_0x545815['name'],_0x5f2ead);loggerPredictive[_0xe544('0x64')](_0x301c1f[_0xe544('0x65')]);clearPredictiveAttributes(_0x545815);};}function loggerCatch(_0x17ba15){return function(_0x5247f1){logger[_0xe544('0x64')](_0x17ba15,util[_0xe544('0x43')](_0x5247f1,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5bfe97,_0x3c4478,_0x167f75){return function(_0x197f71){utils[_0xe544('0x66')](_0x3c4478,_0x167f75,0x0);_0x3c4478[_0xe544('0x67')]=0x0;logger['error'](_0x5bfe97,util[_0xe544('0x43')](_0x197f71,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4bea93){return function(_0x577bb9){if(isNotNull(_0x577bb9)&&isNotNull(_0x577bb9[0x0])){if(_0x577bb9[0x0][_0xe544('0x68')]>0x0){_0x4bea93[_0xe544('0x69')]=utils[_0xe544('0x6a')][_0xe544('0x6b')];logger[_0xe544('0x48')](_0xe544('0x6c')+_0x4bea93[_0xe544('0x45')],_0x577bb9[0x0][_0xe544('0x68')],_0xe544('0x6d'));}else{_0x4bea93[_0xe544('0x69')]=utils[_0xe544('0x6a')][_0xe544('0x6e')];logger[_0xe544('0x48')](_0xe544('0x6f')+_0x4bea93[_0xe544('0x45')]);}}};}function createObjHistory(_0x3de2d9,_0x3fa04b,_0x24c8f1,_0x543486,_0xe9328a){_0x3de2d9[_0xe544('0x69')]=_0x24c8f1;var _0x13a2c6=new Action(_0x3de2d9,_0x3fa04b);var _0x269eff=new History(_0x13a2c6);_0x269eff[_0xe544('0x70')]=_0x543486;_0x269eff[_0xe544('0x71')]=_0xe9328a;_0x269eff[_0xe544('0x72')]=_0x13a2c6[_0xe544('0x73')];return _0x269eff;}function unlockQueueStatus(_0x5760c8,_0x2a24b5){setTimeout(function(){if(_[_0xe544('0x3f')](_0x5760c8[_0xe544('0x74')])){loggerBooked['error'](_0xe544('0x75'),_0x2a24b5);}_0x5760c8[_0xe544('0x74')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x2a24b5,JSON['stringify'](_[_0xe544('0x76')](_0x5760c8,['name',_0xe544('0x74')])));},0x1f3);}function checkInterval(_0x5b9b10){return function(){if(!isNotNull(_0x5b9b10[_0xe544('0x77')])){_0x5b9b10[_0xe544('0x69')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x5b9b10['name']+_0xe544('0x78');}if(!isNotNull(_0x5b9b10[_0xe544('0x77')][_0xe544('0x79')])){_0x5b9b10[_0xe544('0x69')]=utils[_0xe544('0x6a')]['NULL_INTERVAL'];throw _0x5b9b10['name']+_0xe544('0x78');}if(!isNotNull(_[_0xe544('0x47')](_0x5b9b10[_0xe544('0x77')]['Intervals']))){_0x5b9b10[_0xe544('0x69')]=utils[_0xe544('0x6a')]['NULL_INTERVAL'];throw _0x5b9b10['name']+_0xe544('0x78');}};}function checkIsIVRCampaignActive(_0xe0964f){return function(){if(!utils[_0xe544('0x7a')](_0xe0964f)){_0xe0964f[_0xe544('0x69')]=utils['CAMPAIGN_STATUS'][_0xe544('0x7b')];throw _0xe0964f['name']+_0xe544('0x7c');}};}function emitCampaignSummary(_0x5aa29e){if(utils[_0xe544('0x7d')](_0x5aa29e)){emit(util['format']('campaign:ivr:%s',_0x5aa29e[_0xe544('0x45')]),'campaign:save',_0x5aa29e);}}function loggerCatchQueueSummary(_0x540e54,_0x1775ab){return function(_0x4ddbe2){clearPredictiveAttributes(_0x1775ab);emitCampaignSummary(_0x1775ab);loggerSyncQueueSummary[_0xe544('0x60')](_0x540e54,util[_0xe544('0x43')](_0x4ddbe2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5a45aa){if(_0x5a45aa[_0xe544('0x7e')]){if(_0x5a45aa[_0xe544('0x7f')]===0x0){_0x5a45aa[_0xe544('0x7e')]=![];_0x5a45aa[_0xe544('0x69')]=utils['CAMPAIGN_STATUS'][_0xe544('0x7b')];loggerSyncQueueSummary[_0xe544('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5a45aa[_0xe544('0x45')],_0xe544('0x80'));}else{_0x5a45aa[_0xe544('0x69')]=utils[_0xe544('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0xe544('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5a45aa[_0xe544('0x45')],_0xe544('0x81'));}emitCampaignSummary(_0x5a45aa);}}function myreject(_0x35c281){return function(_0x174ac5){return _0x35c281(msgResponse('[ifTime][Action]',_0xe544('0x82'),JSON['stringify'](_0x174ac5)));};}Dialer['prototype'][_0xe544('0x83')]=function(_0x14a40c){return!_[_0xe544('0x3f')](_0x14a40c)&&_0x14a40c&&!_[_0xe544('0x3f')](_0x14a40c[_0xe544('0x45')])&&!_[_0xe544('0x3f')](_0x14a40c['active'])&&_0x14a40c[_0xe544('0x84')]&&(this[_0xe544('0x1c')][util['format'](_0xe544('0x85'),_0x14a40c[_0xe544('0x45')])][_0xe544('0x86')]===_0xe544('0x87')||this[_0xe544('0x1c')][util['format'](_0xe544('0x85'),_0x14a40c[_0xe544('0x45')])]['status']===_0xe544('0x88'));};Dialer[_0xe544('0x13')][_0xe544('0x89')]=function(_0x6938b2){var _0x40b9a2=this;return function(){if(!_0x40b9a2[_0xe544('0x83')](_0x6938b2['Trunk'])){if(!_0x40b9a2[_0xe544('0x83')](_0x6938b2[_0xe544('0x8a')])){_0x6938b2['message']=utils[_0xe544('0x6a')]['TRUNK_NOT_REACHABLE'];throw _0x6938b2[_0xe544('0x45')]+_0xe544('0x8b');}}};};Dialer[_0xe544('0x13')][_0xe544('0x8c')]=function(_0x5b6a80,_0x15e9cd,_0x2b42ff,_0x2533cd){var _0x26fa5b=this;return function(){var _0x4dccf7=!![];return _0x26fa5b[_0xe544('0x8d')](_0x5b6a80,_0x15e9cd,_0x2b42ff,_0x2533cd,_0x4dccf7);};};Dialer['prototype'][_0xe544('0x8e')]=function(_0x2e6efb,_0x3340e1,_0x2b7434,_0x1d4968){var _0x51c118=this;return function(){var _0x21b5f5=![];return _0x51c118[_0xe544('0x8d')](_0x2e6efb[_0xe544('0x79')],_0x3340e1,_0x2b7434,_0x1d4968,_0x21b5f5);};};Dialer[_0xe544('0x13')][_0xe544('0x8d')]=function(_0x2276f2,_0x27a53f,_0x198a1a,_0x56d5fc,_0x50d81d){var _0x58a78e=[];return new Promise(function(_0x325d89,_0x370cdc){if(!isNotNull(_0x2276f2)){_0x56d5fc[_0xe544('0x69')]=utils['CAMPAIGN_STATUS'][_0xe544('0x8f')];return _0x370cdc(msgResponse(_0xe544('0x90'),_0xe544('0x91'),_0x198a1a+_0xe544('0x92')));}if(_['isEmpty'](_0x2276f2)){_0x56d5fc['message']=utils[_0xe544('0x6a')][_0xe544('0x93')];return _0x370cdc(msgResponse(_0xe544('0x90'),_0xe544('0x91'),_0x198a1a+_0xe544('0x94')));}if(_0x27a53f&&_[_0xe544('0x3f')](config[_0xe544('0x95')][_0x27a53f])){_0x56d5fc[_0xe544('0x69')]=utils[_0xe544('0x6a')][_0xe544('0x96')];return _0x370cdc(msgResponse(_0xe544('0x90'),'Failure',_0x198a1a+'\x20Timezone\x20unknow\x20'+_0x27a53f));}if(_[_0xe544('0x97')](_0x2276f2)){for(var _0x57ef6f=0x0;_0x57ef6f<_0x2276f2[_0xe544('0x98')];_0x57ef6f+=0x1){_0x58a78e['push'](ami[_0xe544('0x99')]({'action':_0xe544('0x9a'),'command':util[_0xe544('0x9b')](_0xe544('0x9c'),_0x2276f2[_0x57ef6f][_0xe544('0x9d')],!_[_0xe544('0x3f')](config['timezones'][_0x27a53f])?_0x27a53f:'')})[_0xe544('0x3d')](function(_0x3343dc){return _0x3343dc['content']['indexOf']('true')>=0x0;})['catch'](myreject(_0x370cdc)));}}else{_0x58a78e['push'](ami['Action']({'action':'command','command':util['format'](_0xe544('0x9c'),_0x2276f2,!_[_0xe544('0x3f')](config[_0xe544('0x95')][_0x27a53f])?_0x27a53f:'')})[_0xe544('0x3d')](function(_0x29eac0){return _0x29eac0[_0xe544('0x9e')][_0xe544('0x9f')]('true')>=0x0;})[_0xe544('0xa0')](myreject(_0x370cdc)));}Promise[_0xe544('0xa1')](_0x58a78e)[_0xe544('0x3d')](function(_0xad179f){var _0x2bd59a=_['some'](_0xad179f);if(_0x2bd59a){return _0x325d89(_0x2bd59a);}else{_0x56d5fc[_0xe544('0x69')]=_0x50d81d?utils[_0xe544('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xe544('0x6a')][_0xe544('0xa2')];return _0x370cdc(msgResponse(_0xe544('0xa3'),'Failure',_0xe544('0xa4')+_0x50d81d+'\x20'+_0x198a1a+_0xe544('0xa5')+util[_0xe544('0x43')](_0x2276f2,{'showHidden':![],'depth':null})+_0xe544('0xa6')+_0x27a53f));}})[_0xe544('0xa0')](function(_0x5de550){return _0x370cdc(msgResponse(_0xe544('0x90'),_0xe544('0x91'),JSON['stringify'](_0x5de550)));});});};Dialer[_0xe544('0x13')][_0xe544('0xa7')]=function(){var _0x4326e5=this;return cmHopper[_0xe544('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0xe544('0x3d')](function(){setInterval(function(){_0x4326e5[_0xe544('0xa9')]();},0x3e8);});};Dialer[_0xe544('0x13')][_0xe544('0xa9')]=function(){var _0x39e908=this;var _0x38f4e1;for(var _0x3f3fde in this['campaigns']){if(typeof this['campaigns'][_0x3f3fde]!==_0xe544('0xaa')){_0x38f4e1=this[_0xe544('0x1a')][_0x3f3fde];if(utils[_0xe544('0x7d')](_0x38f4e1)&&utils[_0xe544('0x7a')](_0x38f4e1)){_0x38f4e1['sendMessageOneNotActive']=!![];Promise[_0xe544('0xab')]()['then'](checkIsIVRCampaignActive(_0x38f4e1))['then'](checkInterval(_0x38f4e1))[_0xe544('0x3d')](_0x39e908[_0xe544('0x89')](_0x38f4e1))['then'](_0x39e908['checkIfTime'](_0x38f4e1[_0xe544('0xac')],_0x38f4e1[_0xe544('0xad')],_0x38f4e1[_0xe544('0x45')],_0x38f4e1))[_0xe544('0x3d')](_0x39e908[_0xe544('0x8e')](_0x38f4e1['Interval'],_0x38f4e1[_0xe544('0xad')],_0x38f4e1[_0xe544('0x45')],_0x38f4e1))[_0xe544('0x3d')](_0x39e908[_0xe544('0xae')](_0x38f4e1))[_0xe544('0xa0')](loggerCatchQueueSummary(_0xe544('0xaf'),_0x38f4e1));}else{notSendMessagesCampaign(_0x38f4e1);}}}};Dialer[_0xe544('0x13')][_0xe544('0xb0')]=function(_0x57056d){if(_0x57056d['dialMethod']!==_0xe544('0xb1')){clearPredictiveAttributes(_0x57056d);}switch(_0x57056d[_0xe544('0xb2')]){case _0xe544('0xb3'):this[_0xe544('0xb4')](_0x57056d,0x1);break;case _0xe544('0xb5'):this[_0xe544('0xb4')](_0x57056d,_0x57056d[_0xe544('0xb6')]);break;case _0xe544('0xb1'):this[_0xe544('0xb1')](_0x57056d);break;case _0xe544('0xb7'):this[_0xe544('0xb4')](_0x57056d,0x1);break;default:logger[_0xe544('0x64')](_0xe544('0xb8'),_0x57056d['name'],_0xe544('0xb9'));}};Dialer[_0xe544('0x13')][_0xe544('0x90')]=function(_0x4d8595,_0x547a92){var _0x3763fc=_0x4d8595['dialTimezone'];var _0x2e52fd=_0x547a92?_0x4d8595[_0xe544('0xac')]:_0x4d8595[_0xe544('0x77')][_0xe544('0x79')];logger[_0xe544('0xba')](_0xe544('0xbb'),_0x2e52fd,_0x3763fc,_0x4d8595['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x4d8595[_0xe544('0x45')],_0x4d8595['id']));var _0x55e998=null;return Interval[_0xe544('0xbc')](_0x2e52fd,_0x3763fc)[_0xe544('0x3d')](function(_0xb227d3){if(_0xb227d3===!![]){return _0xb227d3;}else{_0x4d8595[_0xe544('0x69')]=_0x547a92?utils[_0xe544('0x6a')][_0xe544('0xbd')]:utils[_0xe544('0x6a')][_0xe544('0xa2')];_0x55e998=msgResponse(_0xe544('0xa3'),'Failure',_0xe544('0xa4')+_0x547a92+'\x20'+_0x4d8595[_0xe544('0x45')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe544('0x43')](_0x2e52fd,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3763fc);}if(_0x55e998!==null){logger[_0xe544('0xba')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x55e998);_0x55e998[_0xe544('0xbe')]=_0x547a92;throw _0x55e998;}})['catch'](function(_0x59fc78){logger[_0xe544('0x64')](_0xe544('0xbf'),_0x59fc78);throw msgResponse(_0xe544('0xc0'),'Error',util[_0xe544('0x43')](_0x59fc78,{'showHidden':![],'depth':null}));});};Dialer[_0xe544('0x13')][_0xe544('0xc1')]=function(_0x347e60){if(this['voiceQueues'][_0x347e60[_0xe544('0xc2')]]){if(this['uniqueId'][_0x347e60[_0xe544('0xc3')]]&&this[_0xe544('0x21')][_0x347e60[_0xe544('0xc3')]][_0xe544('0x41')]!=='ivr'){this[_0xe544('0xc4')](this[_0xe544('0x19')][_0x347e60[_0xe544('0xc2')]]);this[_0xe544('0x21')][_0x347e60[_0xe544('0xc3')]][_0xe544('0xc5')]=moment()[_0xe544('0x9b')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xe544('0xc6')]=function(_0x15638d){var _0x33be73=this[_0xe544('0x21')][_0x15638d['uniqueid']];if(this['voiceQueues'][_0x15638d[_0xe544('0xc2')]]){if(_0x33be73&&_0x33be73[_0xe544('0x41')]!==_0xe544('0xc7')){delete this[_0xe544('0x21')][_0x15638d['uniqueid']];this[_0xe544('0x19')][_0x15638d[_0xe544('0xc2')]][_0xe544('0xc8')]+=0x1;var _0x1995d1=new AgentComplete(_0x33be73,_0x15638d);if(_0x15638d[_0xe544('0xc9')]===_0xe544('0xca')){_0x1995d1[_0xe544('0xcb')]=this[_0xe544('0x19')][_0x15638d['queue']][_0xe544('0xcc')]&&this[_0xe544('0x19')][_0x15638d['queue']][_0xe544('0xcd')]?moment()[_0xe544('0x9b')](_0xe544('0xce')):undefined;}hopperUtils[_0xe544('0xcf')](_0x1995d1)[_0xe544('0xa0')](loggerCatch(_0xe544('0xd0')));hopperUtils['moveContactManagedDialer'](_0x1995d1)['catch'](loggerCatch(_0xe544('0xd1')));}}};Dialer[_0xe544('0x13')][_0xe544('0x2b')]=function(_0x34d30d){var _0x4a86aa=this[_0xe544('0x21')][_0x34d30d['uniqueid']];var _0x5d5cd8=this;var _0x1cd595=![];var _0x545caa;var _0x1f097a;if(this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]]){if(_0x4a86aa&&_0x4a86aa[_0xe544('0x41')]!==_0xe544('0xc7')){delete this[_0xe544('0x21')][_0x34d30d[_0xe544('0xc3')]];this[_0xe544('0xc4')](this['voiceQueues'][_0x34d30d['queue']]);_0x4a86aa[_0xe544('0xd2')]=moment()[_0xe544('0x9b')](_0xe544('0xce'));var _0x50003b=new QueueCallerAbandon(_0x4a86aa,_0x34d30d);if(utils[_0xe544('0x5e')](_0x4a86aa[_0xe544('0xd2')],_0x4a86aa['responsetime'])>=_0x4a86aa['dialQueueTimeout']){this['voiceQueues'][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xd3')]+=0x1;this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xd4')]+=0x1;this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x50003b[_0xe544('0x70')]=0xa;_0x50003b[_0xe544('0x71')]='Drop';_0x50003b[_0xe544('0xd5')]=_0xe544('0xd6');_0x50003b['agiafterat']=this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xcc')]?moment()['format'](_0xe544('0xce')):undefined;_0x50003b['countdropretry']+=0x1;_0x50003b[_0xe544('0xd7')]+=0x1;_0x545caa=this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xd8')];_0x1f097a=this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xd9')];hopperUtils[_0xe544('0xda')](_0x50003b,_0x50003b['state'],_0x4a86aa['voiceQueue'])['then'](function(_0x49113f){_0x1cd595=_0x49113f[_0xe544('0xdb')]==0x1;if(_0x50003b[_0xe544('0xdc')]>=_0x5d5cd8[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xdd')]){_0x5d5cd8['queueCallerAbandonCreateState'](_0x50003b,_0x49113f[_0xe544('0xdb')]);}else{hopperUtils[_0xe544('0xde')]({'active':![],'countdropretry':_0x50003b['countdropretry'],'scheduledat':moment()['add'](_0x5d5cd8['voiceQueues'][_0x34d30d['queue']][_0xe544('0xd8')],_0xe544('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a86aa[_0xe544('0xe0')],'ListId':_0x4a86aa[_0xe544('0xe1')],'VoiceQueueId':_0x4a86aa[_0xe544('0xe2')]||undefined,'CampaignId':_0x4a86aa[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch('[rescheduleContact][Drop]'));var _0x589173=new History(_0x50003b);_0x589173[_0xe544('0x70')]=0xa;_0x589173['statedesc']=_0xe544('0xe4');_0x589173['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x589173['endtime']=_0x589173[_0xe544('0x73')];_0x589173[_0xe544('0xe5')]=_0x50003b['calleridname'];_0x589173['calleridnum']=_0x50003b[_0xe544('0xe6')];hopperUtils['createHistory'](_0x589173)[_0xe544('0xa0')](loggerCatch(_0xe544('0xe7')));}})[_0xe544('0x3d')](function(){if(_0x1cd595)hopperUtils[_0xe544('0xe8')](_0x50003b,_0x545caa,_0x1f097a)[_0xe544('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x34d30d[_0xe544('0xc2')]][_0xe544('0x4d')]+=0x1;this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xe9')]+=0x1;_0x50003b[_0xe544('0x70')]=0xb;_0x50003b[_0xe544('0x71')]=_0xe544('0xea');_0x50003b[_0xe544('0xd5')]=_0xe544('0xeb');_0x50003b['countabandonedretry']+=0x1;_0x50003b['countglobal']+=0x1;_0x545caa=this['voiceQueues'][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xec')];_0x1f097a=this[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xe544('0xda')](_0x50003b,_0x50003b[_0xe544('0x70')],_0x4a86aa[_0xe544('0xed')])[_0xe544('0x3d')](function(_0x45bf9a){if(_0x50003b[_0xe544('0xee')]>=_0x5d5cd8[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xef')]){_0x5d5cd8[_0xe544('0xf0')](_0x50003b,_0x45bf9a[_0xe544('0xdb')]);}else{hopperUtils[_0xe544('0xde')]({'active':![],'countabandonedretry':_0x50003b['countabandonedretry'],'scheduledat':moment()[_0xe544('0xf1')](_0x5d5cd8[_0xe544('0x19')][_0x34d30d[_0xe544('0xc2')]][_0xe544('0xec')],_0xe544('0xdf'))['format'](_0xe544('0xce')),'ContactId':_0x4a86aa[_0xe544('0xe0')],'ListId':_0x4a86aa[_0xe544('0xe1')],'VoiceQueueId':_0x4a86aa['VoiceQueueId']||undefined,'CampaignId':_0x4a86aa[_0xe544('0xe3')]||undefined})['catch'](loggerCatch(_0xe544('0xf2')));var _0x383df3=new History(_0x50003b);_0x383df3[_0xe544('0x70')]=0xb;_0x383df3['statedesc']=_0xe544('0xea');_0x383df3[_0xe544('0x73')]=moment()[_0xe544('0x9b')]('YYYY-MM-DD\x20HH:mm:ss');_0x383df3[_0xe544('0x72')]=_0x383df3[_0xe544('0x73')];_0x383df3[_0xe544('0xe5')]=_0x50003b['calleridname'];_0x383df3[_0xe544('0xe6')]=_0x50003b[_0xe544('0xe6')];hopperUtils['createHistory'](_0x383df3)[_0xe544('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xe544('0x3d')](function(){if(_0x1cd595)hopperUtils[_0xe544('0xe8')](_0x50003b,_0x545caa,_0x1f097a)[_0xe544('0x3d')](function(){return 0x1;});});}}}};Dialer[_0xe544('0x13')][_0xe544('0x35')]=function(_0x1cf486){if(this[_0xe544('0x1f')][_0x1cf486[_0xe544('0xc3')]]){this['actions'][_0x1cf486[_0xe544('0xc3')]][_0xe544('0xf3')]=_0x1cf486[_0xe544('0xf3')];}if(this[_0xe544('0x21')][_0x1cf486['uniqueid']]){this['uniqueId'][_0x1cf486['uniqueid']]['channel']=_0x1cf486[_0xe544('0xf3')];}};Dialer['prototype']['syncQueueMember']=function(_0x3fe86f){if(!this[_0xe544('0x1f')][_0x3fe86f['actionid']]){return;}var _0x147d24=this[_0xe544('0x19')][this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xc2')]]['strategy']||_0xe544('0xf5');if(_0x147d24===_0xe544('0xf6')){if(this['actions'][_0x3fe86f[_0xe544('0xf4')]]&&_[_0xe544('0xf7')](this['actions'][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xf8')])&&_0x3fe86f[_0xe544('0x86')]==='1'&&_0x3fe86f[_0xe544('0xf9')]==='0'){if(this['agents'][_0x3fe86f[_0xe544('0xfa')]]){if(!this[_0xe544('0x1b')][_0x3fe86f[_0xe544('0xfa')]][_0xe544('0xf8')]){this[_0xe544('0x1b')][_0x3fe86f[_0xe544('0xfa')]]['locked']=!![];this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xf8')]=!![];this[_0xe544('0x1f')][_0x3fe86f['actionid']][_0xe544('0xfa')]=_0x3fe86f[_0xe544('0xfa')];}}}}else if(_0x147d24===_0xe544('0xf5')){if(this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]]){if(this['agents'][_0x3fe86f[_0xe544('0xfa')]]){this['actions'][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xfa')]=_0x3fe86f[_0xe544('0xfa')];if(_[_0xe544('0xf7')](this[_0xe544('0x25')][this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xc2')]])){this[_0xe544('0x25')][this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]][_0xe544('0xc2')]]=[];}this[_0xe544('0x25')][this['actions'][_0x3fe86f['actionid']][_0xe544('0xc2')]][_0xe544('0xfb')](_[_0xe544('0x5d')](_[_0xe544('0x76')](this[_0xe544('0x1f')][_0x3fe86f[_0xe544('0xf4')]],['idHopper','stateinterface']),{'status':_0x3fe86f[_0xe544('0x86')],'paused':_0x3fe86f['paused']}));}}}};Dialer[_0xe544('0x13')][_0xe544('0x3a')]=function(_0x50b16a){if(!this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]]){return;}var _0x2686aa=this;var _0x56717e=this['voiceQueues'][this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]];var _0x19b359=_0x56717e['strategy']||'rrmemory';if(_0x19b359===_0xe544('0xf6')){if(this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]]&&this['actions'][_0x50b16a[_0xe544('0xf4')]]['stateinterface']){this[_0xe544('0x18')][_0xe544('0xfc')](this[_0xe544('0x1f')][_0x50b16a['actionid']]['idHopper'],this[_0xe544('0x1f')][_0x50b16a['actionid']][_0xe544('0xfa')])['catch'](function(_0x17f9f5){logger[_0xe544('0x64')](_0xe544('0xfd'),util['inspect'](_0x17f9f5,{'showHidden':![],'depth':null}));})[_0xe544('0x16')](function(){_0x2686aa[_0xe544('0xc4')](_0x2686aa[_0xe544('0x19')][_0x2686aa[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]]);_0x2686aa[_0xe544('0x1b')][_0x2686aa[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]]['stateinterface']]['locked']=![];delete _0x2686aa[_0xe544('0x1f')][_0x50b16a['actionid']];unlockQueueStatus(_0x56717e);});}else{this[_0xe544('0xc4')](this[_0xe544('0x19')][this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]]);hopperUtils[_0xe544('0xde')]({'active':![],'ContactId':this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xe0')],'ListId':this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]]['ListId'],'VoiceQueueId':this['actions'][_0x50b16a['actionid']][_0xe544('0xe2')]||undefined,'CampaignId':this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0xfe')));delete this[_0xe544('0x1f')][_0x50b16a['actionid']];unlockQueueStatus(_0x56717e);}}else if(_0x19b359===_0xe544('0xf5')){var _0x1eab35;if(this[_0xe544('0x1f')][_0x50b16a['actionid']]&&!_[_0xe544('0x47')](this['queueBooked'][this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]]['queue']])){if(this['queueBookedRR'][_0x2686aa[_0xe544('0x1f')][_0x50b16a['actionid']][_0xe544('0xc2')]]){this['queueBookedRR'][_0x2686aa[_0xe544('0x1f')][_0x50b16a['actionid']][_0xe544('0xc2')]]=this[_0xe544('0x26')][this['actions'][_0x50b16a['actionid']]['queue']]?this[_0xe544('0x26')][this[_0xe544('0x1f')][_0x50b16a['actionid']]['queue']]:this[_0xe544('0x25')][this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]]?this[_0xe544('0x25')][this['actions'][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]][_0xe544('0xff')]||0x0:0x0;}this[_0xe544('0x25')][this[_0xe544('0x1f')][_0x50b16a['actionid']]['queue']]['_rr']=this[_0xe544('0x26')][this[_0xe544('0x1f')][_0x50b16a[_0xe544('0xf4')]][_0xe544('0xc2')]];for(var _0x3d219b=0x0;_0x3d219b=_0x4a9062[_0xe544('0x127')]){_0x54e866['stateGlobal'](_0x13daa1,_0x172718,_0x79a3f5,'reason19\x20machine....');}else{if(_0x13daa1[_0xe544('0x121')]>=_0x4a9062['dialMachineMaxRetry']){_0x54e866[_0xe544('0x128')](_0x13daa1,_0x172718,_0x79a3f5,'reason\x2019\x20machine....');}else{hopperUtils[_0xe544('0xde')]({'active':![],'countmachineretry':_0x13daa1[_0xe544('0x121')],'scheduledat':moment()[_0xe544('0xf1')](_0x4a9062[_0xe544('0x129')],_0xe544('0xdf'))['format'](_0xe544('0xce')),'ContactId':_0x13daa1[_0xe544('0xe0')],'ListId':_0x13daa1[_0xe544('0xe1')],'VoiceQueueId':_0x13daa1[_0xe544('0xe2')]||undefined,'CampaignId':_0x13daa1[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x12a')));_0x172718({'reschedule':0x1});}}});}if(_0x3e0fef['type']===_0xe544('0xc7')&&this['campaigns'][_0x3e0fef['queue']][_0xe544('0x114')]&&_0x2b76c2[_0xe544('0x115')]===_0xe544('0x116')){delete this[_0xe544('0x21')][_0x2b76c2['uniqueid']];this['updateOriginated'](this[_0xe544('0x1a')][_0x3e0fef[_0xe544('0xc2')]]);_0x2a3b42=new Hangup(_0x3e0fef,_0x2b76c2);_0x2a3b42['state']=0x12;_0x2a3b42[_0xe544('0x71')]=_0xe544('0x12b');_0x2a3b42[_0xe544('0x118')]=_0xe544('0x119');ami[_0xe544('0x40')](_0xe544('0x11a'),ut[_0xe544('0x11b')](_0x2a3b42,_0xe544('0x11c')));this[_0xe544('0x11d')](_0x2a3b42,_0xe544('0x12c'),_0xe544('0x12d'));}if(_0x3e0fef[_0xe544('0x41')]===_0xe544('0xc7')&&this[_0xe544('0x1a')][_0x3e0fef[_0xe544('0xc2')]][_0xe544('0x114')]&&_0x2b76c2[_0xe544('0x115')]===_0xe544('0x120')){return new Promise(function(_0x403068,_0x2f02f2){delete _0x54e866[_0xe544('0x21')][_0x2b76c2[_0xe544('0xc3')]];_0x54e866['updateOriginated'](_0x54e866[_0xe544('0x1a')][_0x3e0fef[_0xe544('0xc2')]]);_0x54e866['campaigns'][_0x3e0fef[_0xe544('0xc2')]][_0xe544('0xc8')]+=0x1;_0x54e866['campaigns'][_0x3e0fef['queue']][_0xe544('0x117')]+=0x1;var _0x4f0bda=_0x54e866[_0xe544('0x1a')][_0x3e0fef[_0xe544('0xc2')]];var _0x396b42=new Hangup(_0x3e0fef,_0x2b76c2);_0x396b42[_0xe544('0x70')]=0x13;_0x396b42[_0xe544('0x71')]=_0xe544('0x12e');_0x396b42[_0xe544('0x118')]='AMD';_0x396b42['countmachineretry']+=0x1;_0x396b42['countglobal']+=0x1;_0x396b42['amd']=!![];ami[_0xe544('0x40')](_0xe544('0x11a'),ut[_0xe544('0x11b')](_0x396b42,_0xe544('0x11c')));hopperUtils['createHistory'](_0x396b42)[_0xe544('0xa0')](loggerCatch(_0xe544('0x122')));if(_0x396b42['countbusyretry']+_0x396b42[_0xe544('0x123')]+_0x396b42[_0xe544('0x124')]+_0x396b42[_0xe544('0x125')]+_0x396b42[_0xe544('0xdc')]+_0x396b42[_0xe544('0xee')]+_0x396b42[_0xe544('0x121')]+_0x396b42[_0xe544('0x126')]>=_0x4f0bda[_0xe544('0x127')]){_0x54e866[_0xe544('0x12f')](_0x396b42,_0x403068,_0x2f02f2,_0xe544('0x130'));}else{if(_0x396b42['countmachineretry']>=_0x4f0bda['dialMachineMaxRetry']){_0x54e866[_0xe544('0x128')](_0x396b42,_0x403068,_0x2f02f2,_0xe544('0x131'));}else{hopperUtils[_0xe544('0xde')]({'active':![],'countmachineretry':_0x396b42['countmachineretry'],'scheduledat':moment()[_0xe544('0xf1')](_0x4f0bda[_0xe544('0x129')],_0xe544('0xdf'))[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x396b42['ContactId'],'ListId':_0x396b42['ListId'],'VoiceQueueId':_0x396b42[_0xe544('0xe2')]||undefined,'CampaignId':_0x396b42[_0xe544('0xe3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x403068({'reschedule':0x1});}}});}}};Dialer[_0xe544('0x13')][_0xe544('0x34')]=function(_0x2bd324){var _0x10610b=this[_0xe544('0x21')][_0x2bd324[_0xe544('0xc3')]];var _0x231e20;if(_0x10610b&&_0x10610b[_0xe544('0x41')]===_0xe544('0xc7')){delete this['uniqueId'][_0x2bd324['uniqueid']];this[_0xe544('0xc4')](this[_0xe544('0x1a')][_0x10610b[_0xe544('0xc2')]]);this[_0xe544('0x1a')][_0x10610b[_0xe544('0xc2')]]['ivrAnswerCallsDay']+=0x1;_0x231e20=new Hangup(_0x10610b,_0x2bd324);hopperUtils[_0xe544('0xcf')](_0x231e20)[_0xe544('0xa0')](loggerCatch(_0xe544('0x132')));hopperUtils[_0xe544('0x133')](_0x231e20)[_0xe544('0xa0')](loggerCatch('[syncHangupIvr]'));}if(_0x10610b&&_0x10610b[_0xe544('0x41')]!==_0xe544('0xc7')&&isNotNull(this[_0xe544('0x19')][_0x10610b['queue']]['dialQueueProject'])){delete this[_0xe544('0x21')][_0x2bd324['uniqueid']];this[_0xe544('0xc4')](this[_0xe544('0x19')][_0x10610b[_0xe544('0xc2')]]);this[_0xe544('0x19')][_0x10610b['queue']][_0xe544('0xc8')]+=0x1;this['voiceQueues'][_0x10610b['queue']][_0xe544('0x117')]+=0x1;_0x231e20=new Hangup(_0x10610b,_0x2bd324);_0x231e20[_0xe544('0x70')]=0x10;_0x231e20[_0xe544('0x71')]=_0xe544('0x134');_0x231e20[_0xe544('0x118')]=_0xe544('0x135');hopperUtils[_0xe544('0xcf')](_0x231e20)[_0xe544('0xa0')](loggerCatch(_0xe544('0x132')));hopperUtils[_0xe544('0x133')](_0x231e20)[_0xe544('0xa0')](loggerCatch(_0xe544('0x136')));}if(_0x10610b&&_0x10610b[_0xe544('0x41')]!==_0xe544('0xc7')&&!isNotNull(this[_0xe544('0x19')][_0x10610b['queue']]['dialQueueProject'])){delete this[_0xe544('0x21')][_0x2bd324['uniqueid']];this['updateOriginated'](this[_0xe544('0x19')][_0x10610b[_0xe544('0xc2')]]);this[_0xe544('0x19')][_0x10610b['queue']][_0xe544('0x137')]+=0x1;_0x231e20=new Hangup(_0x10610b,_0x2bd324);_0x231e20['state']=0xc;_0x231e20[_0xe544('0x71')]=_0x2bd324[_0xe544('0x138')];_0x231e20[_0xe544('0x118')]=_0xe544('0x139');hopperUtils[_0xe544('0xcf')](_0x231e20)[_0xe544('0xa0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe544('0x133')](_0x231e20)[_0xe544('0xa0')](loggerCatch(_0xe544('0x136')));}};Dialer[_0xe544('0x13')]['syncQueueSummary']=function(_0x313017){var _0x2a0747=this;if(!_0x2a0747[_0xe544('0x27')][_0x313017[_0xe544('0x45')]]){_0x2a0747[_0xe544('0x27')][_0x313017[_0xe544('0x45')]]={'running':![]};}else if(_0x2a0747[_0xe544('0x27')][_0x313017[_0xe544('0x45')]][_0xe544('0x13a')]===!![]){return;}else if(_0x2a0747[_0xe544('0x27')][_0x313017[_0xe544('0x45')]][_0xe544('0x13a')]===![]){_0x2a0747[_0xe544('0x27')][_0x313017[_0xe544('0x45')]][_0xe544('0x13a')]=!![];}var _0x525b88=_0x2a0747[_0xe544('0x19')][_0x313017[_0xe544('0x45')]];var _0x47e2e3=_0x525b88[_0xe544('0x69')]!==utils[_0xe544('0x6a')][_0xe544('0x7b')];var _0x5f0b8d=utils['isPreviewCampaign'](_0x525b88);_0x525b88[_0xe544('0x13b')]=utils[_0xe544('0x13c')](_0x525b88,_0x2a0747[_0xe544('0x1c')]);Promise[_0xe544('0xab')]()[_0xe544('0x3d')](function(){if(_0x525b88[_0xe544('0x13b')]===utils[_0xe544('0x6a')][_0xe544('0x7b')]){if(_0x47e2e3){clearPredictiveAttributes(_0x525b88);_0x313017['startPredictive']=undefined;_0x313017[_0xe544('0x5f')]=undefined;}if(_0x525b88[_0xe544('0x13b')]===utils[_0xe544('0x6a')][_0xe544('0x7b')]){_0x313017[_0xe544('0x13d')]=0x0;_0x313017[_0xe544('0xf9')]=0x0;_0x313017[_0xe544('0x13e')]=0x0;_0x313017[_0xe544('0x13f')]=0x0;_0x313017[_0xe544('0x140')]=0x0;}}else if(_0x525b88[_0xe544('0x13b')]===utils['CAMPAIGN_STATUS'][_0xe544('0x141')]&&!_0x5f0b8d){return _0x2a0747['ifTime'](_0x525b88,!![])[_0xe544('0x3d')](function(){return _0x2a0747['ifTime'](_0x525b88,![]);})[_0xe544('0x3d')](function(){return _0x2a0747[_0xe544('0xb0')](_0x525b88);})['catch'](function(_0xa056e2){loggerSyncQueueSummary['debug'](_0xe544('0x142'),util[_0xe544('0x43')](_0xa056e2,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x525b88);});}else{clearPredictiveAttributes(_0x525b88);}})[_0xe544('0x3d')](function(){var _0x136825=_0x313017['compareToOutboundQueue'](_0x525b88);if(_0x136825||_0x525b88[_0xe544('0x143')]){_0x525b88[_0xe544('0x143')]=![];_0x313017[_0xe544('0x144')](_0x525b88);Object[_0xe544('0x145')](_0x525b88,_0x313017);emitOutboundVoiceQueueSummary(_0x313017);}_0x2a0747[_0xe544('0x27')][_0x525b88[_0xe544('0x45')]][_0xe544('0x13a')]=![];})[_0xe544('0xa0')](function(_0x46a7ea){logger[_0xe544('0x64')]('[syncQueueSummary]',util[_0xe544('0x43')](_0x46a7ea,{'showHidden':![],'depth':null}));_0x2a0747[_0xe544('0x27')][_0x525b88['name']][_0xe544('0x13a')]=![];});};Dialer['prototype'][_0xe544('0x32')]=_[_0xe544('0x146')](function(){var _0x5656cd=_[_0xe544('0x147')](this['voiceQueues'],function(_0x6e54e3){return _0x6e54e3['dialPreviewRecallmeReminder'];});var _0x356bfa=_[_0xe544('0x147')](this[_0xe544('0x1b')],function(_0x4b9cb1){return _0x4b9cb1['online']&&_0x4b9cb1['status']==='reachable';});if(_0x5656cd[_0xe544('0x98')]>0x0&&_0x356bfa[_0xe544('0x98')]>0x0){return Promise['resolve']()[_0xe544('0x3d')](cmHopper[_0xe544('0x148')](_[_0xe544('0x149')](_0x5656cd,'id'),previewRecallmeReminderInterval,_['map'](_0x356bfa,'id')))[_0xe544('0x3d')](function(_0x337ef7){for(var _0x5b3786=0x0;_0x5b3786<_0x337ef7[_0xe544('0x98')];_0x5b3786++){var _0x471b37=_0x337ef7[_0x5b3786][_0xe544('0x14a')][_0xe544('0x45')];if(_0x471b37)io['to'](util[_0xe544('0x9b')](_0xe544('0x14b'),_0x471b37))['emit'](_0xe544('0x14c'),{'hopper':_0x337ef7[_0x5b3786]});}})[_0xe544('0xa0')](function(_0x70002c){logger[_0xe544('0x64')](_0xe544('0x14d'),_0x70002c);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe544('0x13')][_0xe544('0x3b')]=function(){var _0x23be93=this;setInterval(function(){_0x23be93['clearZombieChannels'](_0x23be93[_0xe544('0x21')],_0xe544('0x14e'));_0x23be93[_0xe544('0x14f')](_0x23be93[_0xe544('0x1f')],_0xe544('0x150'));},0x32c8);};Dialer[_0xe544('0x13')][_0xe544('0x14f')]=function(_0x3f8bf1,_0xc01175){var _0xa71ae3=this;for(var _0x475050 in _0x3f8bf1){if(typeof _0x3f8bf1[_0x475050]!=='undefined'){this[_0xe544('0x17')][_0xe544('0x14')](function(){if(!_[_0xe544('0xf7')](_0x3f8bf1[_0x475050])){return ami[_0xe544('0x99')]({'action':_0xe544('0x86'),'channel':_0x3f8bf1[_0x475050][_0xe544('0xf3')]})[_0xe544('0xa0')](function(_0x1fa0ba){if(_0x1fa0ba[_0xe544('0x69')]===_0xe544('0x151')){setTimeout(function(){if(_0x3f8bf1[_0x475050]&&_0x3f8bf1[_0x475050]['type']!==_0xe544('0xc7')){_0xa71ae3[_0xe544('0xc4')](_0xa71ae3[_0xe544('0x19')][_0x3f8bf1[_0x475050][_0xe544('0xc2')]]);logger['error']('[Dialer][checkChannel]',_0xc01175,_0x475050,_0x3f8bf1[_0x475050]['queue']);delete _0x3f8bf1[_0x475050];}if(_0x3f8bf1[_0x475050]&&_0x3f8bf1[_0x475050][_0xe544('0x41')]===_0xe544('0xc7')){_0xa71ae3['updateOriginated'](_0xa71ae3['campaigns'][_0x3f8bf1[_0x475050]['queue']]);logger[_0xe544('0x64')](_0xe544('0x152'),_0xc01175,_0x475050,_0x3f8bf1[_0x475050][_0xe544('0xc2')]);delete _0x3f8bf1[_0x475050];}},0x2328);}});}});}}};Dialer[_0xe544('0x13')][_0xe544('0x153')]=function(_0x576e83){return Promise[_0xe544('0xab')]()[_0xe544('0x3d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x576e83))[_0xe544('0xa0')](loggerCatch(_0xe544('0x154')));};Dialer[_0xe544('0x13')][_0xe544('0xc4')]=function(_0x4e5421){if(!_[_0xe544('0x3f')](_0x4e5421)&&_0x4e5421!==null){if(typeof _0x4e5421['originated']!==_0xe544('0xaa')){if(_0x4e5421[_0xe544('0x7f')]>0x0){_0x4e5421['originated']-=0x1;}else{logger[_0xe544('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe544('0x64')](_0xe544('0x155'));}};Dialer['prototype']['loggerHandler']=function(_0x26e9cf,_0x1a761b){var _0x4fb7ae=this;return function(_0x53ebc3){_0x4fb7ae['updateOriginated'](_0x1a761b);logger['error'](_0x26e9cf,util[_0xe544('0x43')](_0x53ebc3,{'showHidden':![],'depth':null}));};};Dialer[_0xe544('0x13')][_0xe544('0x156')]=function(_0x133726,_0x2addb5,_0x5cd786){var _0x3a1e21={'state':0x19,'statedesc':'notFound'};this[_0xe544('0xc4')](_0x2addb5);this[_0xe544('0x11d')](_[_0xe544('0x5d')](_0x3a1e21,_[_0xe544('0x76')](_0x5cd786,[_0xe544('0xe0'),'ListId','UserId',_0xe544('0xe2'),_0xe544('0xe3')])),_0xe544('0x157'),_0xe544('0x158'));logger[_0xe544('0x64')](_0x133726);};Dialer[_0xe544('0x13')][_0xe544('0x11d')]=function(_0x55185d,_0x1acbfd,_0x31d3ec){hopperUtils[_0xe544('0xcf')](_0x55185d)['catch'](loggerCatch(_0x1acbfd));hopperUtils[_0xe544('0x133')](_0x55185d)[_0xe544('0xa0')](loggerCatch(_0x31d3ec));};Dialer[_0xe544('0x13')][_0xe544('0xf0')]=function(_0x4ba1e0,_0x652984){hopperUtils['createHistory'](_0x4ba1e0)['catch'](loggerCatch(_0xe544('0xd0')));if(_0x652984==0x0){hopperUtils['moveContactManagedDialer'](_0x4ba1e0)[_0xe544('0xa0')](loggerCatch(_0xe544('0x159')));}};Dialer[_0xe544('0x13')]['checkPreviewRecallReminder']=function(_0x59b21e){return Promise[_0xe544('0xab')]()[_0xe544('0x3d')](cmHopper[_0xe544('0x148')](_0x59b21e['id'],previewRecallmeReminderInterval))['then'](function(_0x5f27d4){for(var _0x1d2407=0x0;_0x1d2407<_0x5f27d4[_0xe544('0x98')];_0x1d2407++){var _0x25b3c0=_0x5f27d4[_0x1d2407]['Agent'][_0xe544('0x45')];if(_0x25b3c0)io['to'](util[_0xe544('0x9b')](_0xe544('0x14b'),_0x25b3c0))[_0xe544('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x5f27d4[_0x1d2407]});}})[_0xe544('0xa0')](function(){});};Dialer[_0xe544('0x13')][_0xe544('0xae')]=function(_0x43d192){var _0x51a93e=this;return function(){_0x51a93e[_0xe544('0x15a')](_0x43d192);};};Dialer[_0xe544('0x13')]['actionOriginate']=function(_0x46fc41,_0xdfef79){var _0x19dc47=this;var _0x387863=uuid['v4']();this[_0xe544('0x1f')][_0x387863]=new Action(_0x46fc41,_0xdfef79,_0x387863);return new Promise(function(_0x418835,_0x32daf2){if(_[_0xe544('0x3f')](_0x46fc41)&&typeof _0x46fc41!==_0xe544('0x15b')){return _0x32daf2(msgResponse(_0xe544('0x15c'),_0xe544('0x91'),_0xe544('0x15d')));}if(_[_0xe544('0x3f')](_0xdfef79['phone'])||_0xdfef79[_0xe544('0x15e')]===null){return _0x32daf2(msgResponse(_0xe544('0x15c'),_0xe544('0x91'),'contact\x20is\x20undefine'));}var _0xe44312={'XMD-CALLERID':_0x19dc47[_0xe544('0x1f')][_0x387863][_0xe544('0x15f')](),'XMD-AGI':_0x46fc41[_0xe544('0x160')]?util[_0xe544('0x9b')](_0xe544('0x161'),ipAgi,_0x46fc41[_0xe544('0x160')]):_0xe544('0x162'),'XMD-AGIAFTER':_0x46fc41[_0xe544('0xcc')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x46fc41[_0xe544('0xcc')]):_0xe544('0x162'),'XMD-QUEUE':utils['isOutboundQueue'](_0x46fc41)?util['format']('\x22%s,%s%s,,,%s\x22',_0x46fc41[_0xe544('0x45')],_0x46fc41['dialQueueOptions']||'',_0x46fc41[_0xe544('0xcd')]?'c':'',_0x46fc41[_0xe544('0x163')]||0x3):_0xe544('0x162'),'XMD-CONTACTID':_0xdfef79[_0xe544('0xe0')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x19dc47['actions'][_0x387863][_0xe544('0x15f')](),'XMD-AMD':_0x46fc41[_0xe544('0x114')]?_0xe544('0x141'):_0xe544('0x162'),'XMD-DESTINATION':_0xe544('0x113')};if(_0x46fc41[_0xe544('0x114')]){_0xe44312[_0xe544('0x164')]=_0x46fc41[_0xe544('0x165')]||0x9c4;_0xe44312['XMD-AMDGREETING']=_0x46fc41['dialAMDGreeting']||0x5dc;_0xe44312[_0xe544('0x166')]=_0x46fc41[_0xe544('0x167')]||0x320;_0xe44312[_0xe544('0x168')]=_0x46fc41[_0xe544('0x169')]||0x1388;_0xe44312[_0xe544('0x16a')]=_0x46fc41[_0xe544('0x16b')]||0x64;_0xe44312[_0xe544('0x16c')]=_0x46fc41[_0xe544('0x16d')]||0x32;_0xe44312[_0xe544('0x16e')]=_0x46fc41['dialAMDMaximumNumberOfWords']||0x3;_0xe44312['XMD-AMDSILENCETHRESHOLD']=_0x46fc41['dialAMDSilenceThreshold']||0x100;_0xe44312[_0xe544('0x16f')]=_0x46fc41[_0xe544('0x170')]||0x1388;}if(utils[_0xe544('0x171')](_0x46fc41)){_0xe44312[_0xe544('0x172')]=_0xdfef79[_0xe544('0xe2')];}else{_0xe44312[_0xe544('0x173')]=_0xdfef79[_0xe544('0xe3')];}var _0x5335e2=utils[_0xe544('0x174')](_0xdfef79[_0xe544('0x175')]);Object[_0xe544('0x145')](_0xe44312,_0x5335e2);var _0x1bd9a7=_0x19dc47[_0xe544('0x83')](_0x46fc41[_0xe544('0x176')])?utils[_0xe544('0x177')](_0x46fc41[_0xe544('0x176')]['callerid'],_0x46fc41[_0xe544('0x178')],_0x46fc41[_0xe544('0x179')]>0x0?utils['getCallerIdRandom'](_0x46fc41[_0xe544('0x17a')],_0x46fc41[_0xe544('0x179')]):_0x46fc41[_0xe544('0x17a')]):utils[_0xe544('0x177')](_['isNil'](_0x46fc41[_0xe544('0x8a')])?_0x46fc41[_0xe544('0x176')][_0xe544('0x17b')]:_0x46fc41[_0xe544('0x8a')][_0xe544('0x17b')],_0x46fc41['dialOriginateCallerIdName'],_0x46fc41[_0xe544('0x179')]>0x0?utils[_0xe544('0x17c')](_0x46fc41[_0xe544('0x17a')],_0x46fc41[_0xe544('0x179')]):_0x46fc41[_0xe544('0x17a')]);if(_0x1bd9a7){_0xe44312['XMD-ORIGINATECALLERIDNAME']=_0x19dc47['actions'][_0x387863][_0xe544('0x17d')]=utils[_0xe544('0x17e')](_0x1bd9a7);_0xe44312[_0xe544('0x17f')]=_0xdfef79[_0xe544('0x15e')];}_0x46fc41[_0xe544('0x180')]=_0xe44312;return ami[_0xe544('0x99')]({'actionid':_0x387863,'action':_0xe544('0x15c'),'channel':_0x19dc47[_0xe544('0x83')](_0x46fc41['Trunk'])?util['format'](_0xe544('0x181'),_0x46fc41[_0xe544('0x176')]['name'],isNotNull(_0x46fc41[_0xe544('0x182')])?_0x46fc41['dialPrefix'][_0xe544('0x183')]()||'':'',_0x46fc41[_0xe544('0x184')]>0x0?_0xdfef79[_0xe544('0x15e')]['substring'](_0x46fc41[_0xe544('0x184')]):_0xdfef79[_0xe544('0x15e')]):util[_0xe544('0x9b')]('SIP/%s/%s%s',_[_0xe544('0xf7')](_0x46fc41[_0xe544('0x8a')])?_0x46fc41[_0xe544('0x176')][_0xe544('0x45')]:_0x46fc41[_0xe544('0x8a')][_0xe544('0x45')],isNotNull(_0x46fc41['dialPrefix'])?_0x46fc41['dialPrefix']['trim']()||'':'',_0x46fc41[_0xe544('0x184')]>0x0?_0xdfef79[_0xe544('0x15e')]['substring'](_0x46fc41[_0xe544('0x184')]):_0xdfef79[_0xe544('0x15e')]),'callerid':_0x1bd9a7,'Exten':_0xe544('0x113'),'Context':_0xe544('0x185'),'Priority':'1','variable':_0xe44312,'timeout':(_0x46fc41[_0xe544('0x186')]||0x1e)*0x3e8,'async':!![],'channelid':_0x387863})[_0xe544('0x3d')](function(_0xf3a49){return _0x418835(_0xf3a49);})['catch'](function(_0x46285a){_0x46fc41['outboundOriginateFailureCallsDay']+=0x1;var _0x46b295=new History(_0x19dc47[_0xe544('0x1f')][_0x387863]);logger['error'](util[_0xe544('0x9b')](_0xe544('0x187'),JSON[_0xe544('0x101')](_0x46285a)));_0x46b295[_0xe544('0x70')]=0xe;_0x46b295[_0xe544('0x71')]=_0xe544('0x188');_0x46b295['starttime']=moment()['format'](_0xe544('0xce'));_0x46b295[_0xe544('0x72')]=_0x46b295['starttime'];hopperUtils['createHistory'](_0x46b295)[_0xe544('0xa0')](loggerCatch(_0xe544('0x189')));_0x19dc47[_0xe544('0x133')](_0x46b295)['catch'](loggerCatch(_0xe544('0x189')))['finally'](function(){delete _0x19dc47[_0xe544('0x1f')][_0x387863];return _0x32daf2(msgResponse(_0xe544('0x15c'),'Error',_0xe544('0x18a')));});});});};Dialer['prototype'][_0xe544('0x18b')]=function(_0xf244c,_0x1cfaac,_0x179d71){var _0x517dae=new History(_0x1cfaac);if(_0x517dae['countbusyretry']+_0x517dae[_0xe544('0x123')]+_0x517dae[_0xe544('0x124')]+_0x517dae[_0xe544('0x125')]+_0x517dae[_0xe544('0xdc')]+_0x517dae[_0xe544('0xee')]+_0x517dae['countmachineretry']+_0x517dae[_0xe544('0x126')]>=_0x179d71[_0xe544('0x127')]-0x1){return!![];}switch(_0xf244c){case 0x3:if(_0x517dae[_0xe544('0x124')]>=_0x179d71[_0xe544('0x18c')]-0x1){return!![];}hopperUtils[_0xe544('0xde')]({'active':![],'countnoanswerretry':_0x517dae[_0xe544('0x124')]+=0x1,'scheduledat':moment()['add'](_0x179d71[_0xe544('0x18d')],'minutes')[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x18e')));break;case 0x5:if(_0x517dae[_0xe544('0x18f')]>=_0x179d71['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xe544('0xde')]({'active':![],'countbusyretry':_0x517dae['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x179d71['dialBusyRetryFrequency'],'minutes')[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae['ListId'],'VoiceQueueId':_0x517dae['VoiceQueueId']||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x190')));break;case 0x8:if(_0x517dae[_0xe544('0x123')]>=_0x179d71[_0xe544('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x517dae[_0xe544('0x123')]+=0x1,'scheduledat':moment()[_0xe544('0xf1')](_0x179d71[_0xe544('0x192')],_0xe544('0xdf'))[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x517dae[_0xe544('0x125')]>=_0x179d71[_0xe544('0x193')]-0x1){return!![];}else{hopperUtils[_0xe544('0xde')]({'active':![],'countnosuchnumberretry':_0x517dae[_0xe544('0x125')]+=0x1,'scheduledat':moment()[_0xe544('0xf1')](_0x179d71[_0xe544('0x194')],_0xe544('0xdf'))[_0xe544('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})['catch'](loggerCatch(_0xe544('0x195')));}break;case 0xa:if(_0x517dae[_0xe544('0xdc')]>=_0x179d71['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xe544('0xde')]({'active':![],'countdropretry':_0x517dae[_0xe544('0xdc')]+=0x1,'scheduledat':moment()['add'](_0x179d71[_0xe544('0xd8')],'minutes')['format'](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x196')));break;case 0xb:if(_0x517dae[_0xe544('0xee')]>=_0x179d71['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xe544('0xde')]({'active':![],'countabandonedretry':_0x517dae[_0xe544('0xee')]+=0x1,'scheduledat':moment()['add'](_0x179d71[_0xe544('0xec')],_0xe544('0xdf'))['format'](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae['ListId'],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0xf2')));break;case 0x13:if(_0x517dae[_0xe544('0x121')]>=_0x179d71[_0xe544('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x517dae[_0xe544('0x121')]+=0x1,'scheduledat':moment()[_0xe544('0xf1')](_0x179d71[_0xe544('0x129')],_0xe544('0xdf'))[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x12a')));break;case 0x14:if(_0x517dae[_0xe544('0x126')]>=_0x179d71[_0xe544('0x198')]-0x1){return!![];}hopperUtils[_0xe544('0xde')]({'active':![],'countagentrejectretry':_0x517dae[_0xe544('0x126')]+=0x1,'scheduledat':moment()[_0xe544('0xf1')](_0x179d71[_0xe544('0x199')],'minutes')[_0xe544('0x9b')](_0xe544('0xce')),'ContactId':_0x517dae[_0xe544('0xe0')],'ListId':_0x517dae[_0xe544('0xe1')],'VoiceQueueId':_0x517dae[_0xe544('0xe2')]||undefined,'CampaignId':_0x517dae[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xe544('0x13')][_0xe544('0x10e')]=function(_0x15cc3f,_0x34997a,_0x5f07bd){var _0x38c67a=this;var _0x1ae3e8=new History(_0x15cc3f);var _0x4240c4=![];var _0xbc8603;var _0x10d06d;return new Promise(function(_0x4fb716,_0x11dd96){if(_[_0xe544('0x3f')](_0x34997a)&&typeof _0x34997a!==_0xe544('0x15b')){return _0x11dd96(msgResponse(_0xe544('0x19a'),'Failure','entity\x20is\x20undefine'));}if(_[_0xe544('0x3f')](_0x5f07bd)&&typeof _0x5f07bd!==_0xe544('0x15b')){return _0x11dd96(msgResponse(_0xe544('0x19a'),_0xe544('0x91'),'evt\x20is\x20undefine'));}hopperUtils[_0xe544('0xda')](_0x1ae3e8,_0x5f07bd['reason'],_0x34997a)['then'](function(_0x58b178){if(_0x58b178[_0xe544('0xdb')]==0x1)_0x4240c4=!![];switch(_0x5f07bd[_0xe544('0xc9')]){case'0':_0x34997a['outboundNoSuchCallsDay']+=0x1;_0x1ae3e8['state']=0x0;_0x1ae3e8[_0xe544('0x71')]=_0xe544('0x19b');_0x1ae3e8[_0xe544('0x125')]+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;ami[_0xe544('0x40')](_0xe544('0x19c'),ut[_0xe544('0x11b')](_0x15cc3f,'nosuchnumber'));_0xbc8603=_0x34997a[_0xe544('0x194')];_0x10d06d=_0x34997a[_0xe544('0xd9')];hopperUtils['createHistory'](_0x1ae3e8)[_0xe544('0xa0')](loggerCatch(_0xe544('0x122')));if(_0x38c67a['checkRetriveMax'](0x0,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x125')]>=_0x34997a['dialNoSuchNumberMaxRetry']){_0x38c67a['createStateFinal'](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x19d'));}else{_0x38c67a[_0xe544('0x12f')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x19d'));}}break;case'3':_0x34997a[_0xe544('0x19e')]+=0x1;_0x1ae3e8[_0xe544('0x70')]=0x3;_0x1ae3e8[_0xe544('0x71')]=_0xe544('0x19f');_0x1ae3e8['countnoanswerretry']+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;var _0x99a766=ut[_0xe544('0x1a0')](_0x15cc3f,_0x34997a);ami[_0xe544('0x40')]('custom:agentnoanswer',_0x99a766);_0xbc8603=_0x34997a[_0xe544('0x18d')];_0x10d06d=_0x34997a['callAdditionalPhoneAfterMin'];hopperUtils[_0xe544('0xcf')](_0x1ae3e8)[_0xe544('0xa0')](loggerCatch(_0xe544('0x1a1')));if(_0x38c67a['checkRetriveMax'](0x3,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x124')]>=_0x34997a[_0xe544('0x18c')]){_0x38c67a[_0xe544('0x128')](_0x1ae3e8,_0x4fb716,_0x11dd96,'reason\x203\x20ringing\x20no\x20answer');}else{_0x38c67a['stateGlobal'](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1a2'));}}break;case'5':_0x34997a[_0xe544('0x1a3')]+=0x1;_0x1ae3e8['state']=0x5;_0x1ae3e8['statedesc']=_0xe544('0x1a4');_0x1ae3e8[_0xe544('0x18f')]+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;ami['emit'](_0xe544('0x1a5'),ut[_0xe544('0x11b')](_0x15cc3f,_0xe544('0x1a6')));_0xbc8603=_0x34997a['dialBusyRetryFrequency'];_0x10d06d=_0x34997a[_0xe544('0xd9')];hopperUtils[_0xe544('0xcf')](_0x1ae3e8)[_0xe544('0xa0')](loggerCatch(_0xe544('0x1a7')));if(_0x38c67a['checkRetriveMax'](0x5,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x18f')]>=_0x34997a['dialBusyMaxRetry']){_0x38c67a[_0xe544('0x128')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1a8'));}else{_0x38c67a['stateGlobal'](_0x1ae3e8,_0x4fb716,_0x11dd96,'reason\x205\x20busy');}}break;case'8':_0x34997a[_0xe544('0x1a9')]+=0x1;_0x1ae3e8[_0xe544('0x70')]=0x8;_0x1ae3e8['statedesc']='Congestion';_0x1ae3e8[_0xe544('0x123')]+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;_0xbc8603=_0x34997a[_0xe544('0x192')];_0x10d06d=_0x34997a[_0xe544('0xd9')];ami[_0xe544('0x40')]('custom:agentcongestion',ut[_0xe544('0x11b')](_0x15cc3f,_0xe544('0x1aa')));hopperUtils[_0xe544('0xcf')](_0x1ae3e8)[_0xe544('0xa0')](loggerCatch(_0xe544('0x1ab')));if(_0x38c67a[_0xe544('0x18b')](0x8,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x123')]>=_0x34997a[_0xe544('0x191')]){_0x38c67a[_0xe544('0x128')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1ac'));}else{_0x38c67a[_0xe544('0x12f')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1ac'));}}break;case'11':_0x34997a[_0xe544('0x1ad')]+=0x1;_0x1ae3e8['state']=0xb;_0x1ae3e8[_0xe544('0x71')]=_0xe544('0xea');_0x1ae3e8[_0xe544('0xee')]+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;_0xbc8603=_0x34997a[_0xe544('0xec')];_0x10d06d=_0x34997a['callAdditionalPhoneAfterMin'];hopperUtils[_0xe544('0xcf')](_0x1ae3e8)['catch'](loggerCatch(_0xe544('0x1ae')));if(_0x38c67a[_0xe544('0x18b')](0xb,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0xee')]>=_0x34997a[_0xe544('0xef')]){_0x38c67a['createStateFinal'](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1af'));}else{_0x38c67a[_0xe544('0x12f')](_0x1ae3e8,_0x4fb716,_0x11dd96,'reason\x2011\x20abandoned');}}break;case'20':_0x34997a[_0xe544('0x1b0')]+=0x1;_0x1ae3e8[_0xe544('0x70')]=0x14;_0x1ae3e8[_0xe544('0x71')]='AgentReject';_0x1ae3e8[_0xe544('0x126')]+=0x1;_0x1ae3e8[_0xe544('0xd7')]+=0x1;_0xbc8603=_0x34997a[_0xe544('0x199')];_0x10d06d=_0x34997a[_0xe544('0xd9')];ami[_0xe544('0x40')](_0xe544('0x1b1'),ut[_0xe544('0x11b')](_0x15cc3f,_0xe544('0x1b2')));hopperUtils[_0xe544('0xcf')](_0x1ae3e8)['catch'](loggerCatch(_0xe544('0x1b3')));if(_0x38c67a[_0xe544('0x18b')](0x14,_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x126')]>=_0x34997a['dialAgentRejectMaxRetry']){_0x38c67a[_0xe544('0x128')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0xe544('0x1b4'));}else{_0x38c67a[_0xe544('0x12f')](_0x1ae3e8,_0x4fb716,_0x11dd96,'reason\x2020\x20agentreject');}}break;default:_0x34997a[_0xe544('0x137')]+=0x1;_0x1ae3e8['state']=0xc;_0x1ae3e8[_0xe544('0x71')]=_0x5f07bd[_0xe544('0xc9')];_0xbc8603=_0x34997a[_0xe544('0x199')];_0x10d06d=_0x34997a[_0xe544('0xd9')];hopperUtils[_0xe544('0xcf')](_0x1ae3e8)[_0xe544('0xa0')](loggerCatch(_0xe544('0x1b5')));if(_0x38c67a[_0xe544('0x18b')](_0x5f07bd['reason'],_0x15cc3f,_0x34997a)&&!_0x4240c4){if(_0x1ae3e8[_0xe544('0x18f')]+_0x1ae3e8[_0xe544('0x123')]+_0x1ae3e8[_0xe544('0x124')]+_0x1ae3e8[_0xe544('0x125')]+_0x1ae3e8[_0xe544('0xdc')]+_0x1ae3e8['countabandonedretry']+_0x1ae3e8[_0xe544('0x121')]+_0x1ae3e8[_0xe544('0x126')]>=_0x34997a[_0xe544('0x127')]){_0x38c67a[_0xe544('0x12f')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0x5f07bd['reason']);}else{_0x38c67a[_0xe544('0x128')](_0x1ae3e8,_0x4fb716,_0x11dd96,_0x5f07bd[_0xe544('0xc9')]);}}}})['then'](function(){if(_0x4240c4){hopperUtils[_0xe544('0xe8')](_0x1ae3e8,_0xbc8603,_0x10d06d)['then'](function(){return _0x4fb716(0x1);});}});});};Dialer['prototype'][_0xe544('0x12f')]=function(_0x515fa9,_0x5a5d44,_0xdfe60f,_0x2d76f3){var _0x47a7b4=new Final(_0x515fa9);_0x47a7b4[_0xe544('0x70')]=0xf;_0x47a7b4[_0xe544('0x71')]=_0xe544('0x1b6');this[_0xe544('0x128')](_0x47a7b4,_0x5a5d44,_0xdfe60f,_0x2d76f3);};Dialer[_0xe544('0x13')][_0xe544('0x128')]=function(_0x1402a9,_0x4aea74,_0x1d793f,_0x363941){hopperUtils[_0xe544('0x133')](_0x1402a9)[_0xe544('0x3d')](function(){return _0x4aea74(msgResponse(_0xe544('0x19a'),_0xe544('0x10d'),_0x363941));})['catch'](function(){return _0x1d793f(msgResponse(_0xe544('0x1b7'),'Failure','contact\x20not\x20moved'));});};Dialer[_0xe544('0x13')][_0xe544('0xb1')]=function(_0x3f42c){var _0x134618=_0x3f42c[_0xe544('0x1b8')]/0x64;var _0x2350c2=_0x3f42c[_0xe544('0xd4')]/(_0x3f42c[_0xe544('0xd4')]+_0x3f42c[_0xe544('0xc8')]);var _0x2938b3=Math[_0xe544('0x1b9')](_0x3f42c[_0xe544('0x1ba')]*(_0x3f42c[_0xe544('0x1bb')]/0x64));var _0x26d1da=Math[_0xe544('0x1b9')](_0x3f42c[_0xe544('0x1ba')]*(_0x3f42c[_0xe544('0x1bc')]/0x64));var _0xcb5795=_0x3f42c[_0xe544('0x13d')]+_0x3f42c[_0xe544('0x13f')];var _0xa043ac=Math[_0xe544('0x1bd')](_0x3f42c[_0xe544('0x1be')]*_0x3f42c[_0xe544('0x5c')]*_0x3f42c[_0xe544('0x1bf')]*_0x3f42c['predictiveIntervalMultiplicativeFactor']);if(_[_0xe544('0x3f')](_0x3f42c[_0xe544('0x5f')])){if(!_[_0xe544('0x3f')](_0x3f42c[_0xe544('0x23')])){_0x3f42c[_0xe544('0x23')]=undefined;loggerPredictive[_0xe544('0x64')](_0xe544('0x1c0'),_0xe544('0x1c1'));}if(!_['isUndefined'](_0x3f42c[_0xe544('0x62')])){loggerPredictive[_0xe544('0x64')]('[startMethodPredictive][StartProgressive]',_0xe544('0x1c2'));clearInterval(_0x3f42c[_0xe544('0x62')]);_0x3f42c[_0xe544('0x62')]=undefined;}_0x3f42c[_0xe544('0x5f')]=moment()[_0xe544('0x9b')](_0xe544('0xce'));loggerPredictive['info'](_0x3f42c[_0xe544('0x45')],_0xe544('0x1c3'),_0x3f42c['startProgressive']);this[_0xe544('0xb4')](_0x3f42c,0x1);}else if(ifInterval(_0x3f42c[_0xe544('0x1c4')],_0x3f42c[_0xe544('0x5f')])){this[_0xe544('0xb4')](_0x3f42c,0x1);loggerPredictiveCalls[_0xe544('0x48')]('[startMethodPredictive][StartProgressive][Loop]',_0x3f42c['startProgressive'],_0x3f42c[_0xe544('0x45')]);_0x3f42c['erlangCalls']=0x0;_0x3f42c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x134618<_0x2350c2&&_0x3f42c['dialPredictiveOptimization']===_0xe544('0x1c5')){clearPredictiveAttributes(_0x3f42c);loggerPredictive[_0xe544('0x48')](_0xe544('0x1c6'),_0xe544('0x1c7'),_0x2350c2,_0xe544('0x5f'),_0x3f42c['name']);}else if(_0xa043ac<_0x3f42c[_0xe544('0x1c8')]&&_0x3f42c[_0xe544('0x1c9')]===_0xe544('0x1c5')){clearPredictiveAttributes(_0x3f42c);loggerPredictive['info'](_0xe544('0x1ca'),_0xe544('0x1cb'),_0xa043ac,_0xe544('0x1cc'),_0x3f42c[_0xe544('0x1c8')],_0xe544('0x5f'),_0x3f42c[_0xe544('0x45')]);}else if(!ifInterval(_0x3f42c['dialPredictiveInterval'],_0x3f42c[_0xe544('0x5f')])&&_[_0xe544('0x3f')](_0x3f42c[_0xe544('0x23')])&&!_[_0xe544('0x3f')](_0x3f42c[_0xe544('0x5f')])){_0x3f42c[_0xe544('0x23')]=moment()[_0xe544('0x9b')](_0xe544('0xce'));loggerPredictive[_0xe544('0x48')](_0x3f42c[_0xe544('0x45')],'started\x20in\x20predictive\x20at',_0x3f42c[_0xe544('0x23')]);hopperUtils[_0xe544('0x1cd')](_0x3f42c[_0xe544('0x1c4')])[_0xe544('0x3d')](this[_0xe544('0x1ce')](_0x3f42c))['then'](mergeDataErlangB(_0x3f42c))['then'](this[_0xe544('0x1cf')](_0x3f42c))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3f42c));}else if(!ifInterval(_0x3f42c[_0xe544('0x1c4')],_0x3f42c[_0xe544('0x23')])){_0x3f42c[_0xe544('0x1c8')]=0x0;_0x3f42c[_0xe544('0x23')]=moment()['format'](_0xe544('0xce'));loggerPredictive['info'](_0x3f42c['name'],_0xe544('0x1d0'),_0x3f42c['startPredictive']);clearInterval(_0x3f42c[_0xe544('0x62')]);_0x3f42c[_0xe544('0x62')]=undefined;hopperUtils[_0xe544('0x1cd')](_0x3f42c[_0xe544('0x1c4')])['then'](this[_0xe544('0x1ce')](_0x3f42c))[_0xe544('0x3d')](mergeDataErlangB(_0x3f42c))['then'](this['startMethodPredictive'](_0x3f42c))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3f42c));}else if(_0x3f42c['predictiveIntervalAvailable']&&_0xcb5795<_0x3f42c[_0xe544('0x1ba')]-_0x26d1da){clearPredictiveAttributes(_0x3f42c);loggerPredictive['info'](_0x3f42c[_0xe544('0x45')],_0xe544('0x1d1'),_0xcb5795,_0xe544('0x1d2'),_0x3f42c[_0xe544('0x1ba')],'-',_0x26d1da,'=',_0x3f42c['predictiveIntervalAvailable']-_0x26d1da,')');}else if(_0x3f42c[_0xe544('0x1ba')]&&_0xcb5795>_0x3f42c[_0xe544('0x1ba')]+_0x2938b3){clearPredictiveAttributes(_0x3f42c);loggerPredictive['info'](_0x3f42c[_0xe544('0x45')],_0xe544('0x1d1'),_0xcb5795,_0xe544('0x1d3'),_0x3f42c[_0xe544('0x1ba')],'+',_0x2938b3,'=',_0x3f42c['predictiveIntervalAvailable']+_0x2938b3,')');}};Dialer['prototype'][_0xe544('0x1ce')]=function(_0x333f3a){var _0x1bfc87=this;return function(_0x2fcbf4){return new Promise(function(_0x5a9cce,_0x339d7c){_[_0xe544('0x5d')](_0x333f3a,_0x2fcbf4[0x0]);if(checkGetDataPredictive(_0x2fcbf4[0x0])){var _0x2a1423=_0x333f3a[_0xe544('0x1ba')]=_0x333f3a[_0xe544('0x13f')]+_0x333f3a[_0xe544('0x13d')];var _0x16545a=_0x333f3a['dialPredictiveInterval']*0x3c;var _0xab647b=_0x2fcbf4[0x0]['predictiveIntervalAvgTalktime']+_0x2fcbf4[0x0][_0xe544('0x4f')];var _0x246579=(_0x2fcbf4[0x0][_0xe544('0x4b')]+_0x2fcbf4[0x0][_0xe544('0xd3')]+_0x2fcbf4[0x0][_0xe544('0x4d')])/_0x2fcbf4[0x0][_0xe544('0x53')];_0x333f3a[_0xe544('0x1bf')]=_0x246579>0x0?_0x246579:0x1;switch(_0x333f3a[_0xe544('0x1c9')]){case _0xe544('0x1c5'):var _0x38800c=_0x333f3a[_0xe544('0x1b8')]/0x64;return _0x1bfc87[_0xe544('0x1d4')](_0x2a1423,_0x16545a,_0xab647b,_0x246579,_0x38800c)[_0xe544('0x3d')](function(_0x1fe7c8){return _0x5a9cce(_0x1fe7c8);});case _0xe544('0x1d5'):var _0x443371=_0x333f3a['dialPredictiveOptimizationPercentage']/0x64;return _0x1bfc87[_0xe544('0x1d6')](_0x2a1423,_0x16545a,_0xab647b,_0x246579,_0x443371)[_0xe544('0x3d')](function(_0x55a7d7){return _0x5a9cce(_0x55a7d7);});default:return _0x339d7c(msgResponse(_0xe544('0x1d7'),_0xe544('0x91'),_0xe544('0x1d8')));}}else{return _0x339d7c(msgResponse(_0xe544('0x1d7'),'Failure',_0xe544('0x1d9')));}});};};Dialer['prototype'][_0xe544('0x1da')]=function(_0x1d11da){var _0x150078=this;return function(_0x422372){return new Promise(function(_0x493e2d,_0x322946){_[_0xe544('0x5d')](_0x1d11da,_0x422372[0x0]);if(checkGetDataPredictive(_0x422372[0x0])){loggerPredictive['info'](JSON['stringify'](_0x422372[0x0]));if(_0x1d11da['dialPredictiveOptimization']===_0xe544('0x1c5')){return _0x150078[_0xe544('0x153')](_0x1d11da['id'])[_0xe544('0x3d')](function(_0x2bd9e2){var _0xbd2c81=_0x1d11da[_0xe544('0x1db')]-_0x2bd9e2[0x0][_0xe544('0x1dc')];var _0x5d3eb8=_0x1d11da[_0xe544('0x1c4')]*0x3c;var _0x42294a=_0x422372[0x0]['predictiveIntervalAvgTalktime']+_0x422372[0x0]['predictiveIntervalAvgHoldtime'];var _0x5171cf=(_0x422372[0x0]['predictiveIntervalAnsweredCalls']+_0x422372[0x0][_0xe544('0xd3')]+_0x422372[0x0][_0xe544('0x4d')])/_0x422372[0x0][_0xe544('0x53')];var _0x132632=_0x1d11da[_0xe544('0x1b8')]/0x64;_0x1d11da['predictiveIntervalPauses']=_0x2bd9e2[0x0]['outboundQueuePauses']||0x0;_0x1d11da[_0xe544('0x1bf')]=_0x5171cf>0x0?_0x5171cf:0x1;return _0x150078[_0xe544('0x1d4')](_0xbd2c81,_0x5d3eb8,_0x42294a,_0x5171cf,_0x132632);})['then'](function(_0x350437){return _0x493e2d(_0x350437);})[_0xe544('0xa0')](function(_0xf355ac){return _0x322946(msgResponse('[CatchErlangB]',_0xe544('0x91'),JSON[_0xe544('0x101')](_0xf355ac)));});}if(_0x1d11da['dialPredictiveOptimization']==='agentBusyFactor'){return _0x150078[_0xe544('0x153')](_0x1d11da['id'])[_0xe544('0x3d')](function(_0x338261){var _0x9fe3f5=_0x1d11da['loggedIn']-_0x338261[0x0]['outboundQueuePauses'];var _0x12869f=_0x1d11da['dialPredictiveInterval']*0x3c;var _0x4263b8=_0x422372[0x0][_0xe544('0x51')]+_0x422372[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a7ffc=(_0x422372[0x0][_0xe544('0x4b')]+_0x422372[0x0][_0xe544('0xd3')]+_0x422372[0x0][_0xe544('0x4d')])/_0x422372[0x0]['predictiveIntervalTotalCalls'];var _0x3427fc=_0x1d11da['dialPredictiveOptimizationPercentage']/0x64;_0x1d11da[_0xe544('0x1dd')]=_0x338261[0x0][_0xe544('0x1dc')]||0x0;_0x1d11da[_0xe544('0x1bf')]=_0x4a7ffc>0x0?_0x4a7ffc:0x1;return _0x150078[_0xe544('0x1d6')](_0x9fe3f5,_0x12869f,_0x4263b8,_0x4a7ffc,_0x3427fc);})['then'](function(_0x28d4e7){return _0x493e2d(_0x28d4e7);})[_0xe544('0xa0')](function(_0x4795e8){return _0x322946(msgResponse(_0xe544('0x1de'),_0xe544('0x91'),JSON['stringify'](_0x4795e8)));});}}else{return _0x322946(msgResponse(_0xe544('0x1d7'),_0xe544('0x91'),_0xe544('0x1d9')));}});};};Dialer[_0xe544('0x13')][_0xe544('0x1cf')]=function(_0x568bb8){var _0x28ffbf=this;return function(){var _0x4f058e=0x0;var _0x5e4abe=Math[_0xe544('0x1bd')](_0x568bb8[_0xe544('0x59')]*0x3e8);if(_0x5e4abe>0x0){_0x5e4abe=_0x5e4abe<0x64?0x64:_0x5e4abe;loggerPredictive['info'](_0x568bb8[_0xe544('0x45')],'one\x20call\x20every:',_0x5e4abe,_0xe544('0x1df'));_0x568bb8['handlePredictive']=setInterval(function(){_0x28ffbf['handlePredictive'](_0x568bb8);loggerPredictiveCalls[_0xe544('0x48')](_0xe544('0x1e0'),_0x4f058e+=0x1);},_0x5e4abe);}else{loggerPredictive[_0xe544('0x48')](_0x568bb8[_0xe544('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe544('0x13')][_0xe544('0x1e1')]=function(_0x16c8de,_0x9d7df5){var _0x271ebd=this;return function(_0x3ba26d){if(_[_0xe544('0x47')](_0x3ba26d)){if(_['isNil'](_0x9d7df5[_0xe544('0x1e2')])||!_0x9d7df5[_0xe544('0x1e3')]){if(_0x16c8de[_0xe544('0xb2')]===_0xe544('0xb7')){_0x16c8de[_0xe544('0x74')]=_[_0xe544('0x3f')](_0x16c8de[_0xe544('0x74')])?!![]:_0x16c8de['queueStatusComplete'];var _0x263ac1=uuid['v4']();_0x271ebd[_0xe544('0x1f')][_0x263ac1]=new Action(_0x16c8de,_0x9d7df5,_0x263ac1);loggerBooked[_0xe544('0x48')](_0xe544('0x1e4'),_0x263ac1,_0xe544('0x1e5'),JSON[_0xe544('0x101')](_0x16c8de[_0xe544('0x74')]),_0xe544('0x1e6'),_0x16c8de[_0xe544('0x45')]);if(_0x16c8de['queueStatusComplete']){_0x16c8de[_0xe544('0x74')]=![];_0x271ebd['queueBooked'][_0x271ebd['actions'][_0x263ac1][_0xe544('0xc2')]]=[];ami[_0xe544('0x99')]({'actionid':_0x263ac1,'action':_0xe544('0x1e7'),'queue':_0x16c8de['name']})[_0xe544('0xa0')](function(){_0x271ebd[_0xe544('0xc4')](_0x16c8de);hopperUtils[_0xe544('0xde')]({'active':![],'ContactId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe0')],'ListId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe1')],'VoiceQueueId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe2')]||undefined,'CampaignId':_0x271ebd[_0xe544('0x1f')][_0x263ac1]['CampaignId']||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x1e8')));delete _0x271ebd[_0xe544('0x1f')][_0x263ac1];});}else{loggerBooked[_0xe544('0x48')]('[booked][checkContactBlack][else]',JSON[_0xe544('0x101')](_0x16c8de['queueStatusComplete']),'Queue:\x20',_0x16c8de[_0xe544('0x45')]);_0x271ebd['updateOriginated'](_0x16c8de);hopperUtils[_0xe544('0xde')]({'active':![],'ContactId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe0')],'ListId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe1')],'VoiceQueueId':_0x271ebd[_0xe544('0x1f')][_0x263ac1][_0xe544('0xe2')]||undefined,'CampaignId':_0x271ebd[_0xe544('0x1f')][_0x263ac1]['CampaignId']||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x1e8')));delete _0x271ebd[_0xe544('0x1f')][_0x263ac1];}}else{return _0x271ebd[_0xe544('0x1e9')](_0x16c8de,_0x9d7df5);}}else{if(utils['getSeconds'](undefined,_0x9d7df5[_0xe544('0x1ea')])<_0x16c8de[_0xe544('0x1eb')]*0x3c){if(_0x9d7df5['Agent']&&!_0x9d7df5[_0xe544('0x14a')][_0xe544('0x1ec')]){_0x271ebd[_0xe544('0x18')][_0xe544('0xfc')](_0x9d7df5['id'])[_0xe544('0x16')](function(){_0x271ebd[_0xe544('0xc4')](_0x16c8de);});}else{hopperUtils[_0xe544('0x1ed')]({'active':![]},_0x9d7df5['id'],0x1)[_0xe544('0x16')](function(){_0x271ebd[_0xe544('0xc4')](_0x16c8de);});}}else{_0x16c8de[_0xe544('0x1ee')]+=0x1;_0x271ebd[_0xe544('0xc4')](_0x16c8de);if(_0x16c8de[_0xe544('0x1ef')]){hopperUtils[_0xe544('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x9d7df5['ContactId'],'ListId':_0x9d7df5['ListId'],'VoiceQueueId':_0x9d7df5[_0xe544('0xe2')]||undefined,'CampaignId':_0x9d7df5[_0xe544('0xe3')]||undefined})[_0xe544('0xa0')](loggerCatch(_0xe544('0x1f0')));hopperUtils[_0xe544('0xcf')](createObjHistory(_0x16c8de,_0x9d7df5,utils['CAMPAIGN_STATUS'][_0xe544('0x1f1')],0x17,_0xe544('0x1f2')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x271ebd[_0xe544('0x11d')](createObjHistory(_0x16c8de,_0x9d7df5,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0xe544('0x1f3')),_0xe544('0x1f4'),_0xe544('0x1f5'));}}}}else{_0x16c8de[_0xe544('0x1f6')]+=0x1;_0x271ebd[_0xe544('0x11d')](createObjHistory(_0x16c8de,_0x9d7df5,utils['CAMPAIGN_STATUS'][_0xe544('0x1f7')],0xd,'Blacklist'),_0xe544('0x1f8'),_0xe544('0x1f9'));throw _0xe544('0x1fa');}};};Dialer[_0xe544('0x13')]['handleIvr']=function(_0xdb0f4d){var _0x4d8b3a=this;var _0x5d668c=_0xdb0f4d[_0xe544('0x1fb')]-_0xdb0f4d[_0xe544('0x7f')];emitCampaignSummary(_0xdb0f4d);if(_0x5d668c>0x0&&_0xdb0f4d[_0xe544('0x67')]==0x0){if(_0x5d668c>this['maxNumberOriginate']){_0x5d668c=this['maxNumberOriginate'];}_0xdb0f4d[_0xe544('0x67')]=0x1;hopperUtils[_0xe544('0x1fc')](_0xdb0f4d,_0x5d668c)[_0xe544('0x3d')](function(_0x5894d5){_0xdb0f4d[_0xe544('0x67')]=0x0;if(_0x5894d5){if(!utils[_0xe544('0x1fd')](_0x5894d5)){_0xdb0f4d[_0xe544('0x69')]=utils['CAMPAIGN_STATUS'][_0xe544('0x6e')];logger[_0xe544('0x48')]('[getContactCampaign2][Empty]'+_0xdb0f4d[_0xe544('0x45')]);}else{_0xdb0f4d[_0xe544('0x7f')]+=_0x5894d5[_0xe544('0x98')];_0xdb0f4d[_0xe544('0x69')]=utils[_0xe544('0x6a')][_0xe544('0x1fe')];for(var _0x20eae7=0x0;_0x20eae7<_0x5894d5[_0xe544('0x98')];_0x20eae7+=0x1){_0xdb0f4d[_0xe544('0x1ff')]+=0x1;if(_[_0xe544('0xf7')](_0x5894d5[_0x20eae7])||_['isNil'](_0x5894d5[_0x20eae7][_0xe544('0x175')])||_[_0xe544('0xf7')](_0x5894d5[_0x20eae7][_0xe544('0x15e')])){_0x4d8b3a[_0xe544('0x156')](_0xe544('0x200'),_0xdb0f4d,_0x5894d5[_0x20eae7]);}else{hopperUtils[_0xe544('0x201')](_[_0xe544('0x76')](_0x5894d5[_0x20eae7],['CampaignId',_0xe544('0x15e')]))[_0xe544('0x3d')](_0x4d8b3a[_0xe544('0x1e1')](_0xdb0f4d,_0x5894d5[_0x20eae7]))[_0xe544('0xa0')](_0x4d8b3a[_0xe544('0x202')](_0xe544('0x203'),_0xdb0f4d));}}}}})[_0xe544('0xa0')](loggerGetContactDialer(_0xe544('0x204'),_0xdb0f4d,_0x5d668c));}};Dialer[_0xe544('0x13')][_0xe544('0xb4')]=function(_0x1ad68a,_0x78e659){var _0x2b1f2c=this;var _0x522dbb=[];if(_0x78e659<0x1||_0x1ad68a[_0xe544('0xb2')]===_0xe544('0xb7')){_0x78e659=0x1;}var _0x3258e8=Math[_0xe544('0x1bd')](_0x1ad68a[_0xe544('0x13d')]*_0x78e659)-_0x1ad68a[_0xe544('0x7f')];if(_0x1ad68a['dialLimitQueue']>0x0){var _0x2b7e4c=_0x1ad68a[_0xe544('0x205')]-_0x1ad68a[_0xe544('0x7f')]-_0x1ad68a[_0xe544('0x13f')]-_0x1ad68a[_0xe544('0x140')];if(_0x3258e8>_0x2b7e4c){_0x3258e8=_0x2b7e4c;}}if(_0x3258e8>0x0&&_0x1ad68a['temp']==0x0){if(_0x1ad68a[_0xe544('0xb2')]===_0xe544('0xb7')){_0x3258e8=0x1;}if(_0x3258e8>this['maxNumberOriginate']){_0x3258e8=this['maxNumberOriginate'];}for(var _0x1b3e78 in this[_0xe544('0x1b')]){if(typeof this[_0xe544('0x1b')][_0x1b3e78]!==_0xe544('0xaa')){if(this[_0xe544('0x1b')][_0x1b3e78][_0xe544('0x70')]===_0xe544('0x206')&&this[_0xe544('0x1b')][_0x1b3e78][_0xe544('0x86')]===_0xe544('0x87')){_0x522dbb[_0xe544('0xfb')](this[_0xe544('0x1b')][_0x1b3e78]['id']);}}}_0x1ad68a[_0xe544('0x67')]=0x1;hopperUtils[_0xe544('0x207')](_0x1ad68a,_0x522dbb,_0x3258e8)[_0xe544('0x3d')](function(_0x2905e1){_0x1ad68a[_0xe544('0x67')]=0x0;if(_0x2905e1){if(!utils[_0xe544('0x1fd')](_0x2905e1)){hopperUtils[_0xe544('0x208')](_0x1ad68a)[_0xe544('0x3d')](sendMessageReschedule(_0x1ad68a))[_0xe544('0xa0')](loggerCatch(_0xe544('0x209')));}else{_0x1ad68a['originated']+=_0x2905e1[_0xe544('0x98')];_0x1ad68a[_0xe544('0x69')]=_0x1ad68a[_0xe544('0xb2')]===_0xe544('0xb7')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0xe544('0x6a')][_0xe544('0x1fe')];for(var _0x3ddf71=0x0;_0x3ddf71<_0x2905e1[_0xe544('0x98')];_0x3ddf71+=0x1){if(_[_0xe544('0xf7')](_0x2905e1[_0x3ddf71])||_[_0xe544('0xf7')](_0x2905e1[_0x3ddf71][_0xe544('0x175')])||_[_0xe544('0xf7')](_0x2905e1[_0x3ddf71][_0xe544('0x15e')])){_0x2b1f2c[_0xe544('0x156')]('[actionOriginate]\x20',_0x1ad68a,_0x2905e1[_0x3ddf71]);}else{hopperUtils[_0xe544('0x20a')](_[_0xe544('0x76')](_0x2905e1[_0x3ddf71],['VoiceQueueId',_0xe544('0x15e')]))[_0xe544('0x3d')](_0x2b1f2c['checkContactBlack'](_0x1ad68a,_0x2905e1[_0x3ddf71]))[_0xe544('0xa0')](_0x2b1f2c[_0xe544('0x202')](_0xe544('0x200'),_0x1ad68a));}}}}})[_0xe544('0xa0')](loggerGetContactDialer(_0xe544('0x20b'),_0x1ad68a,_0x3258e8));}};Dialer[_0xe544('0x13')]['handlePredictive']=function(_0xa155ff){if(_0xa155ff[_0xe544('0x205')]>0x0){var _0x4e0343=_0xa155ff[_0xe544('0x205')]-_0xa155ff[_0xe544('0x7f')]-_0xa155ff['talking'];if(_0x4e0343>0x0&&_0xa155ff[_0xe544('0x67')]==0x0){this[_0xe544('0x20c')](_0xa155ff);}else{loggerPredictiveCalls[_0xe544('0x48')](_0xe544('0x20d'));}}else{this[_0xe544('0x20c')](_0xa155ff);}};Dialer['prototype'][_0xe544('0x20c')]=function(_0x31467a){var _0x2246be=this;var _0x5dba13=[];_0x31467a[_0xe544('0x7f')]+=0x1;for(var _0x140d81 in this[_0xe544('0x1b')]){if(typeof this[_0xe544('0x1b')][_0x140d81]!=='undefined'){if(this[_0xe544('0x1b')][_0x140d81]['state']===_0xe544('0x206')&&this[_0xe544('0x1b')][_0x140d81][_0xe544('0x86')]===_0xe544('0x87')){_0x5dba13[_0xe544('0xfb')](this[_0xe544('0x1b')][_0x140d81]['id']);}}}_0x31467a[_0xe544('0x67')]=0x1;return this['getContactDialer'](_0x31467a['id'],_0x5dba13,0x1,_0x31467a[_0xe544('0x20e')],_0x31467a)['then'](function(_0x29f513){_0x31467a[_0xe544('0x67')]=0x1;if(_0x29f513){if(!utils[_0xe544('0x1fd')](_0x29f513)){utils['checkContactLowerLimitOriginate'](_0x31467a,0x1,0x0);return hopperUtils[_0xe544('0x208')](_0x31467a)[_0xe544('0x3d')](sendMessageReschedule(_0x31467a))[_0xe544('0xa0')](loggerCatch('[countReScheduled]\x20'));}else{_0x31467a[_0xe544('0x69')]=utils[_0xe544('0x6a')][_0xe544('0x1fe')];if(_['isNil'](_0x29f513[0x0])||_[_0xe544('0xf7')](_0x29f513[0x0][_0xe544('0x175')])||_[_0xe544('0xf7')](_0x29f513[0x0][_0xe544('0x15e')])){_0x2246be[_0xe544('0x156')](_0xe544('0x200'),_0x31467a,_0x29f513[0x0]);}else{return hopperUtils[_0xe544('0x20a')](_[_0xe544('0x76')](_0x29f513[0x0],['VoiceQueueId',_0xe544('0x15e')]))['then'](_0x2246be[_0xe544('0x1e1')](_0x31467a,_0x29f513[0x0]))[_0xe544('0xa0')](_0x2246be[_0xe544('0x202')]('[actionOriginatePredictive]\x20',_0x31467a));}}}})[_0xe544('0xa0')](loggerGetContactDialer(_0xe544('0x20f'),_0x31467a,0x1));};Dialer[_0xe544('0x13')]['abandonmentRate']=function(_0x3b04b1,_0x4e14a4,_0x8707c1,_0x4dd3eb,_0x148973,_0x501166){loggerPredictive[_0xe544('0x48')](_0xe544('0x210'));loggerPredictive['info'](_0xe544('0x211'),_0x3b04b1);loggerPredictive[_0xe544('0x48')](_0xe544('0x212'),_0x4e14a4);loggerPredictive[_0xe544('0x48')](_0xe544('0x213'),_0x8707c1);loggerPredictive['info'](_0xe544('0x214'),_0x4dd3eb);loggerPredictive[_0xe544('0x48')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x148973);loggerPredictive[_0xe544('0x48')](_0xe544('0x52'));return new Promise(function(_0xd6e806,_0x1e0523){if(_0x3b04b1<=0x0||isNaN(_0x3b04b1)){return _0x1e0523(msgResponse('[abandonmentRate]',_0xe544('0x82'),'m\x20=\x20'+_0x3b04b1));}if(_0x8707c1<=0x0||isNaN(_0x8707c1)){return _0x1e0523(msgResponse(_0xe544('0x215'),'Error',_0xe544('0x216')+_0x8707c1));}if(_0x4dd3eb<=0x0||isNaN(_0x4dd3eb)){return _0x1e0523(msgResponse(_0xe544('0x215'),_0xe544('0x82'),_0xe544('0x217')+_0x4dd3eb));}if(_0x4e14a4<=0x0||isNaN(_0x4e14a4)){return _0x1e0523(msgResponse(_0xe544('0x215'),_0xe544('0x82'),_0xe544('0x218')+_0x4e14a4));}if(_0x148973<=0x0||isNaN(_0x148973)){return _0x1e0523(msgResponse('[abandonmentRate]',_0xe544('0x82'),_0xe544('0x219')+_0x148973));}_0x501166=_0x501166||0x0;var _0x239ecf=0x1/_0x8707c1;var _0x3ae4d5=0x0;var _0xaf71d9=0x0;var _0x32cb58=0x0;var _0x4f9f85=0x0;for(var _0x2fddf1=0x0;_0x32cb58<_0x148973;_0x2fddf1+=0x1){_0xaf71d9=_0x2fddf1/_0x4e14a4;_0x3ae4d5=(_0x4dd3eb*_0xaf71d9+_0x501166)/_0x239ecf;_0x32cb58=utils['erlangb'](_0x3ae4d5,_0x3b04b1);_0x4f9f85=_0x3ae4d5/_0x3b04b1*(0x1-utils[_0xe544('0x21a')](_0x3ae4d5,_0x3b04b1));}return _0xd6e806({'erlangCalls':_0x2fddf1,'erlangCallToSecond':_0x4e14a4/_0x2fddf1,'erlangAbandonmentRate':_0x32cb58,'erlangBusyFactor':_0x4f9f85});});};Dialer['prototype']['busyFactor']=function(_0x4c91da,_0x1158f2,_0x2360b5,_0x43c508,_0x3f6e8c,_0x55f170){loggerPredictive['info'](_0xe544('0x21b'));loggerPredictive[_0xe544('0x48')](_0xe544('0x211'),_0x4c91da);loggerPredictive[_0xe544('0x48')](_0xe544('0x212'),_0x1158f2);loggerPredictive[_0xe544('0x48')](_0xe544('0x213'),_0x2360b5);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',_0x43c508);loggerPredictive[_0xe544('0x48')](_0xe544('0x21c'),_0x3f6e8c);loggerPredictive[_0xe544('0x48')](_0xe544('0x52'));return new Promise(function(_0x1047d1,_0x55ce31){if(_0x4c91da<=0x0||isNaN(_0x4c91da)){return _0x55ce31(msgResponse('[busyFactor]',_0xe544('0x82'),_0xe544('0x21d')+_0x4c91da));}if(_0x2360b5<=0x0||isNaN(_0x2360b5)){return _0x55ce31(msgResponse(_0xe544('0x21e'),'Error',_0xe544('0x216')+_0x2360b5));}if(_0x43c508<=0x0||isNaN(_0x43c508)){return _0x55ce31(msgResponse(_0xe544('0x21e'),_0xe544('0x82'),_0xe544('0x217')+_0x43c508));}if(_0x1158f2<=0x0||isNaN(_0x1158f2)){return _0x55ce31(msgResponse(_0xe544('0x21e'),_0xe544('0x82'),_0xe544('0x218')+_0x1158f2));}if(_0x3f6e8c<=0x0||isNaN(_0x3f6e8c)){return _0x55ce31(msgResponse(_0xe544('0x21e'),_0xe544('0x82'),_0xe544('0x21f')+_0x3f6e8c));}_0x55f170=_0x55f170||0x0;var _0x3bf4be=0x1/_0x2360b5;var _0xd77439=0x0;var _0x1e1d18=0x0;var _0x49aab8=0x0;var _0x394724=0x0;for(var _0x28f876=0x0;_0x394724<_0x3f6e8c;_0x28f876+=0x1){_0x1e1d18=_0x28f876/_0x1158f2;_0xd77439=(_0x43c508*_0x1e1d18+_0x55f170)/_0x3bf4be;_0x49aab8=utils['erlangb'](_0xd77439,_0x4c91da);_0x394724=_0xd77439/_0x4c91da*(0x1-utils['erlangb'](_0xd77439,_0x4c91da));}return _0x1047d1({'erlangCalls':_0x28f876,'erlangCallToSecond':_0x1158f2/_0x28f876,'erlangAbandonmentRate':_0x49aab8,'erlangBusyFactor':_0x394724});});};module[_0xe544('0x220')]=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 629b49a..ef58172 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 _0xccf4=['callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid'];(function(_0x433071,_0x3f4af7){var _0x588b42=function(_0x42d8ca){while(--_0x42d8ca){_0x433071['push'](_0x433071['shift']());}};_0x588b42(++_0x3f4af7);}(_0xccf4,0x151));var _0x4ccf=function(_0x3af2b9,_0x2db846){_0x3af2b9=_0x3af2b9-0x0;var _0x26a11e=_0xccf4[_0x3af2b9];return _0x26a11e;};'use strict';var util=require(_0x4ccf('0x0'));var _=require(_0x4ccf('0x1'));var moment=require(_0x4ccf('0x2'));function checkNameSurname(_0x5d51f8,_0x43e4dc,_0x48ba52){var _0x485992='';if(!_[_0x4ccf('0x3')](_0x43e4dc)&&_0x4ccf('0x4')===typeof _0x43e4dc){_0x485992+=_0x43e4dc;}if(!_[_0x4ccf('0x3')](_0x48ba52)&&_0x4ccf('0x4')===typeof _0x48ba52){_0x485992+='\x20'+_0x48ba52;}if(_0x485992!==''){return _0x485992;}return _0x5d51f8;}function Action(_0x5bfede,_0x3d689f,_0x3a61af){this[_0x4ccf('0x5')]=_0x5bfede;this['uniqueid']=_0x3a61af||undefined;this[_0x4ccf('0x6')]=checkNameSurname(_0x3d689f[_0x4ccf('0x7')][_0x4ccf('0x8')],_0x3d689f[_0x4ccf('0x7')]['firstName'],_0x3d689f['Contact']['lastName']);this[_0x4ccf('0x9')]=_0x3d689f[_0x4ccf('0x8')];this[_0x4ccf('0xa')]=_0x5bfede[_0x4ccf('0x6')];this[_0x4ccf('0xb')]=_0x3d689f[_0x4ccf('0xb')]||![];this['type']=_0x5bfede[_0x4ccf('0xc')];this['dialQueueTimeout']=_0x5bfede[_0x4ccf('0xd')]||0x3;this[_0x4ccf('0xe')]=_0x3d689f[_0x4ccf('0xe')];this[_0x4ccf('0xf')]=_0x3d689f[_0x4ccf('0xf')];this[_0x4ccf('0x10')]=_0x3d689f[_0x4ccf('0x10')];this['countnoanswerretry']=_0x3d689f['countnoanswerretry'];this[_0x4ccf('0x11')]=_0x3d689f[_0x4ccf('0x11')];this['countdropretry']=_0x3d689f['countdropretry'];this[_0x4ccf('0x12')]=_0x3d689f[_0x4ccf('0x12')];this['countmachineretry']=_0x3d689f['countmachineretry'];this[_0x4ccf('0x13')]=_0x3d689f[_0x4ccf('0x13')];this[_0x4ccf('0x14')]=_0x3d689f[_0x4ccf('0x14')];this[_0x4ccf('0x15')]=_0x3d689f[_0x4ccf('0x15')];this['UserId']=_0x3d689f[_0x4ccf('0x16')];this[_0x4ccf('0x17')]=_0x3d689f[_0x4ccf('0x17')];this[_0x4ccf('0x18')]=_0x3d689f[_0x4ccf('0x18')];this[_0x4ccf('0x19')]=_0x3d689f['id'];this[_0x4ccf('0x1a')]=_0x3d689f['Contact'][_0x4ccf('0x1b')]||'';this[_0x4ccf('0x1c')]=moment()[_0x4ccf('0x1d')](_0x4ccf('0x1e'));this['callback']=_0x3d689f['callback'];this[_0x4ccf('0x1f')]=_0x3d689f[_0x4ccf('0x1f')];this[_0x4ccf('0x20')]=_0x3d689f[_0x4ccf('0x20')];this['recallme']=_0x3d689f[_0x4ccf('0x21')];this[_0x4ccf('0x22')]='';this[_0x4ccf('0x23')]='';}Action[_0x4ccf('0x24')][_0x4ccf('0x25')]=function(){return util[_0x4ccf('0x1d')](_0x4ccf('0x26'),this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x4ccf('0x9')]['substring'](this[_0x4ccf('0x5')][_0x4ccf('0x27')]):this[_0x4ccf('0x9')]);};Action[_0x4ccf('0x24')]['getQueue']=function(){return this['queue'];};module[_0x4ccf('0x28')]=Action; \ No newline at end of file +var _0x05be=['starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','name','dialCutDigit','substring','prototype','exports','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName','number','queue','active','type','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x33ceeb,_0x58b863){var _0x5b6556=function(_0x23a6b1){while(--_0x23a6b1){_0x33ceeb['push'](_0x33ceeb['shift']());}};_0x5b6556(++_0x58b863);}(_0x05be,0x66));var _0xe05b=function(_0x14602d,_0x1f1d6a){_0x14602d=_0x14602d-0x0;var _0x3ae043=_0x05be[_0x14602d];return _0x3ae043;};'use strict';var util=require(_0xe05b('0x0'));var _=require(_0xe05b('0x1'));var moment=require(_0xe05b('0x2'));function checkNameSurname(_0x3b43d1,_0x504db7,_0x12694b){var _0x8f2f8d='';if(!_[_0xe05b('0x3')](_0x504db7)&&_0xe05b('0x4')===typeof _0x504db7){_0x8f2f8d+=_0x504db7;}if(!_[_0xe05b('0x3')](_0x12694b)&&_0xe05b('0x4')===typeof _0x12694b){_0x8f2f8d+='\x20'+_0x12694b;}if(_0x8f2f8d!==''){return _0x8f2f8d;}return _0x3b43d1;}function Action(_0x22f1eb,_0x2e8025,_0x534060){this[_0xe05b('0x5')]=_0x22f1eb;this['uniqueid']=_0x534060||undefined;this['name']=checkNameSurname(_0x2e8025[_0xe05b('0x6')][_0xe05b('0x7')],_0x2e8025[_0xe05b('0x6')][_0xe05b('0x8')],_0x2e8025['Contact']['lastName']);this[_0xe05b('0x9')]=_0x2e8025[_0xe05b('0x7')];this[_0xe05b('0xa')]=_0x22f1eb['name'];this[_0xe05b('0xb')]=_0x2e8025['active']||![];this['type']=_0x22f1eb[_0xe05b('0xc')];this['dialQueueTimeout']=_0x22f1eb['dialQueueTimeout']||0x3;this[_0xe05b('0xd')]=_0x2e8025['scheduledat'];this['countbusyretry']=_0x2e8025['countbusyretry'];this[_0xe05b('0xe')]=_0x2e8025['countcongestionretry'];this[_0xe05b('0xf')]=_0x2e8025[_0xe05b('0xf')];this[_0xe05b('0x10')]=_0x2e8025[_0xe05b('0x10')];this['countdropretry']=_0x2e8025[_0xe05b('0x11')];this[_0xe05b('0x12')]=_0x2e8025['countabandonedretry'];this[_0xe05b('0x13')]=_0x2e8025[_0xe05b('0x13')];this[_0xe05b('0x14')]=_0x2e8025[_0xe05b('0x14')];this[_0xe05b('0x15')]=_0x2e8025['ContactId'];this[_0xe05b('0x16')]=_0x2e8025[_0xe05b('0x16')];this[_0xe05b('0x17')]=_0x2e8025['UserId'];this[_0xe05b('0x18')]=_0x2e8025[_0xe05b('0x18')];this[_0xe05b('0x19')]=_0x2e8025[_0xe05b('0x19')];this[_0xe05b('0x1a')]=_0x2e8025['id'];this['ContactFirstName']=_0x2e8025[_0xe05b('0x6')]['firstName']||'';this[_0xe05b('0x1b')]=moment()['format'](_0xe05b('0x1c'));this[_0xe05b('0x1d')]=_0x2e8025[_0xe05b('0x1d')];this[_0xe05b('0x1e')]=_0x2e8025[_0xe05b('0x1e')];this['callbackat']=_0x2e8025[_0xe05b('0x1f')];this[_0xe05b('0x20')]=_0x2e8025['recallme'];this[_0xe05b('0x21')]='';this[_0xe05b('0x22')]='';}Action['prototype'][_0xe05b('0x23')]=function(){return util[_0xe05b('0x24')](_0xe05b('0x25'),this[_0xe05b('0x26')],this[_0xe05b('0x5')][_0xe05b('0x27')]>0x0?this['number'][_0xe05b('0x28')](this[_0xe05b('0x5')][_0xe05b('0x27')]):this['number']);};Action[_0xe05b('0x29')]['getQueue']=function(){return this[_0xe05b('0xa')];};module[_0xe05b('0x2a')]=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 fe32cf2..a577e08 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 _0x3584=['uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','endtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3c62ef,_0x4bb6ab){var _0x4d44f1=function(_0x12b12c){while(--_0x12b12c){_0x3c62ef['push'](_0x3c62ef['shift']());}};_0x4d44f1(++_0x4bb6ab);}(_0x3584,0x1bd));var _0x4358=function(_0x3ac792,_0x5407e3){_0x3ac792=_0x3ac792-0x0;var _0x16c78f=_0x3584[_0x3ac792];return _0x16c78f;};'use strict';var moment=require(_0x4358('0x0'));var utils=require('../utils');function AgentComplete(_0x28ab54,_0x541595){this[_0x4358('0x1')]=0x4;this[_0x4358('0x2')]=_0x4358('0x3');this[_0x4358('0x4')]=_0x28ab54[_0x4358('0x4')];this['type']=_0x28ab54[_0x4358('0x5')];this['campaigntype']=_0x28ab54[_0x4358('0x5')]===_0x4358('0x6')?_0x4358('0x7'):_0x28ab54[_0x4358('0x5')];this[_0x4358('0x8')]=_0x28ab54[_0x4358('0x8')];this[_0x4358('0x9')]=_0x28ab54[_0x4358('0x9')];this['countnoanswerretry']=_0x28ab54[_0x4358('0xa')];this[_0x4358('0xb')]=_0x28ab54[_0x4358('0x8')]+_0x28ab54[_0x4358('0x9')]+_0x28ab54[_0x4358('0xa')]+_0x28ab54[_0x4358('0xc')]+_0x28ab54[_0x4358('0xd')]+_0x28ab54[_0x4358('0xe')]+_0x28ab54[_0x4358('0xf')]+_0x28ab54['countagentrejectretry'];this['countnosuchnumberretry']=_0x28ab54[_0x4358('0xc')];this[_0x4358('0xd')]=_0x28ab54[_0x4358('0xd')];this['countabandonedretry']=_0x28ab54[_0x4358('0xe')];this[_0x4358('0xf')]=_0x28ab54[_0x4358('0xf')];this[_0x4358('0x10')]=_0x28ab54[_0x4358('0x10')];this[_0x4358('0x11')]=_0x541595[_0x4358('0x11')];this[_0x4358('0x12')]=_0x28ab54['name'];this[_0x4358('0x13')]=_0x28ab54[_0x4358('0x14')];this[_0x4358('0x15')]=_0x28ab54['starttime'];this[_0x4358('0x16')]=_0x28ab54['responsetime'];this[_0x4358('0x17')]=_0x28ab54['answertime'];this['endtime']=moment()[_0x4358('0x18')](_0x4358('0x19'));this['ringtime']=utils[_0x4358('0x1a')](_0x28ab54[_0x4358('0x16')],_0x28ab54[_0x4358('0x15')]);this[_0x4358('0x1b')]=utils[_0x4358('0x1a')](_0x28ab54[_0x4358('0x17')],_0x28ab54['responsetime']);this['talktime']=utils[_0x4358('0x1a')](this[_0x4358('0x1c')],_0x28ab54['answertime']);this[_0x4358('0x7')]=_0x541595[_0x4358('0x7')];this[_0x4358('0x1d')]=_0x541595['membername'];this[_0x4358('0x1e')]=_0x541595[_0x4358('0x1e')];this['callback']=_0x28ab54['callback'];this['callbackuniqueid']=_0x28ab54[_0x4358('0x1f')];this[_0x4358('0x20')]=_0x28ab54[_0x4358('0x20')];this[_0x4358('0x21')]=_0x28ab54['recallme'];this[_0x4358('0x22')]=_0x28ab54[_0x4358('0x22')];this['ListId']=_0x28ab54['ListId'];this[_0x4358('0x23')]=_0x28ab54[_0x4358('0x23')];this[_0x4358('0x24')]=_0x28ab54[_0x4358('0x24')];this[_0x4358('0x25')]=_0x28ab54[_0x4358('0x25')];this[_0x4358('0x26')]=_0x28ab54['originatecalleridnum']||'';this['originatecalleridname']=_0x28ab54[_0x4358('0x27')]||'';this[_0x4358('0x28')]=_0x28ab54['agiafterat'];}module[_0x4358('0x29')]=AgentComplete; \ No newline at end of file +var _0xd9d3=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','queue','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','Answer','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x49e515,_0x4dcac1){var _0x2bf22c=function(_0x5c6a79){while(--_0x5c6a79){_0x49e515['push'](_0x49e515['shift']());}};_0x2bf22c(++_0x4dcac1);}(_0xd9d3,0xc7));var _0x3d9d=function(_0x24d3ab,_0x12d3f2){_0x24d3ab=_0x24d3ab-0x0;var _0x4cc800=_0xd9d3[_0x24d3ab];return _0x4cc800;};'use strict';var moment=require('moment');var utils=require(_0x3d9d('0x0'));function AgentComplete(_0x472055,_0x5f462b){this['state']=0x4;this['statedesc']=_0x3d9d('0x1');this[_0x3d9d('0x2')]=_0x472055[_0x3d9d('0x2')];this[_0x3d9d('0x3')]=_0x472055['type'];this[_0x3d9d('0x4')]=_0x472055[_0x3d9d('0x3')]===_0x3d9d('0x5')?'queue':_0x472055[_0x3d9d('0x3')];this['countbusyretry']=_0x472055['countbusyretry'];this[_0x3d9d('0x6')]=_0x472055[_0x3d9d('0x6')];this[_0x3d9d('0x7')]=_0x472055[_0x3d9d('0x7')];this[_0x3d9d('0x8')]=_0x472055[_0x3d9d('0x9')]+_0x472055[_0x3d9d('0x6')]+_0x472055[_0x3d9d('0x7')]+_0x472055['countnosuchnumberretry']+_0x472055[_0x3d9d('0xa')]+_0x472055[_0x3d9d('0xb')]+_0x472055[_0x3d9d('0xc')]+_0x472055[_0x3d9d('0xd')];this[_0x3d9d('0xe')]=_0x472055[_0x3d9d('0xe')];this[_0x3d9d('0xa')]=_0x472055[_0x3d9d('0xa')];this[_0x3d9d('0xb')]=_0x472055[_0x3d9d('0xb')];this[_0x3d9d('0xc')]=_0x472055[_0x3d9d('0xc')];this[_0x3d9d('0xd')]=_0x472055[_0x3d9d('0xd')];this[_0x3d9d('0xf')]=_0x5f462b['uniqueid'];this[_0x3d9d('0x10')]=_0x472055[_0x3d9d('0x11')];this[_0x3d9d('0x12')]=_0x472055[_0x3d9d('0x13')];this[_0x3d9d('0x14')]=_0x472055[_0x3d9d('0x14')];this['responsetime']=_0x472055[_0x3d9d('0x15')];this[_0x3d9d('0x16')]=_0x472055[_0x3d9d('0x16')];this[_0x3d9d('0x17')]=moment()[_0x3d9d('0x18')](_0x3d9d('0x19'));this['ringtime']=utils[_0x3d9d('0x1a')](_0x472055['responsetime'],_0x472055[_0x3d9d('0x14')]);this[_0x3d9d('0x1b')]=utils[_0x3d9d('0x1a')](_0x472055[_0x3d9d('0x16')],_0x472055[_0x3d9d('0x15')]);this[_0x3d9d('0x1c')]=utils[_0x3d9d('0x1a')](this[_0x3d9d('0x17')],_0x472055['answertime']);this['queue']=_0x5f462b[_0x3d9d('0x1d')];this['membername']=_0x5f462b[_0x3d9d('0x1e')];this[_0x3d9d('0x1f')]=_0x5f462b[_0x3d9d('0x1f')];this['callback']=_0x472055['callback'];this[_0x3d9d('0x20')]=_0x472055['callbackuniqueid'];this[_0x3d9d('0x21')]=_0x472055[_0x3d9d('0x21')];this[_0x3d9d('0x22')]=_0x472055['recallme'];this[_0x3d9d('0x23')]=_0x472055[_0x3d9d('0x23')];this[_0x3d9d('0x24')]=_0x472055[_0x3d9d('0x24')];this['UserId']=_0x472055[_0x3d9d('0x25')];this[_0x3d9d('0x26')]=_0x472055[_0x3d9d('0x26')];this[_0x3d9d('0x27')]=_0x472055[_0x3d9d('0x27')];this['originatecalleridnum']=_0x472055[_0x3d9d('0x28')]||'';this[_0x3d9d('0x29')]=_0x472055[_0x3d9d('0x29')]||'';this[_0x3d9d('0x2a')]=_0x472055[_0x3d9d('0x2a')];}module[_0x3d9d('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 249c226..38a9e98 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 _0x8933=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x15e7d5,_0x31a8b3){var _0x2ec968=function(_0x616c25){while(--_0x616c25){_0x15e7d5['push'](_0x15e7d5['shift']());}};_0x2ec968(++_0x31a8b3);}(_0x8933,0x7c));var _0x3893=function(_0x1ccefa,_0x44562c){_0x1ccefa=_0x1ccefa-0x0;var _0x2890f1=_0x8933[_0x1ccefa];return _0x2890f1;};'use strict';function Final(_0x2e16fc){this[_0x3893('0x0')]=_0x2e16fc[_0x3893('0x0')];this[_0x3893('0x1')]=_0x2e16fc['scheduledat'];this[_0x3893('0x2')]=_0x2e16fc[_0x3893('0x2')];this[_0x3893('0x3')]=_0x2e16fc['type']===_0x3893('0x4')?'queue':_0x2e16fc[_0x3893('0x2')];this['countbusyretry']=_0x2e16fc[_0x3893('0x5')];this[_0x3893('0x6')]=_0x2e16fc[_0x3893('0x6')];this[_0x3893('0x7')]=_0x2e16fc[_0x3893('0x7')];this[_0x3893('0x8')]=_0x2e16fc[_0x3893('0x5')]+_0x2e16fc['countcongestionretry']+_0x2e16fc[_0x3893('0x7')]+_0x2e16fc[_0x3893('0x9')]+_0x2e16fc[_0x3893('0xa')]+_0x2e16fc[_0x3893('0xb')]+_0x2e16fc[_0x3893('0xc')]+_0x2e16fc['countagentrejectretry'];this[_0x3893('0x9')]=_0x2e16fc[_0x3893('0x9')];this['countdropretry']=_0x2e16fc['countdropretry'];this[_0x3893('0xb')]=_0x2e16fc['countabandonedretry'];this['countmachineretry']=_0x2e16fc[_0x3893('0xc')];this[_0x3893('0xd')]=_0x2e16fc['countagentrejectretry'];this[_0x3893('0xe')]=_0x2e16fc[_0x3893('0xe')];this['calleridname']=_0x2e16fc[_0x3893('0xf')];this['calleridnum']=_0x2e16fc[_0x3893('0x10')];this[_0x3893('0x11')]=_0x2e16fc[_0x3893('0x11')];this[_0x3893('0x12')]=_0x2e16fc[_0x3893('0x12')];this[_0x3893('0x13')]=_0x2e16fc[_0x3893('0x12')];this[_0x3893('0x14')]=_0x2e16fc[_0x3893('0x14')]||0x0;this[_0x3893('0x15')]=_0x2e16fc[_0x3893('0x15')]||0x0;this['talktime']=_0x2e16fc[_0x3893('0x16')]||0x0;this[_0x3893('0x17')]=_0x2e16fc[_0x3893('0x17')];this[_0x3893('0x18')]=_0x2e16fc[_0x3893('0x18')];this['callbackat']=_0x2e16fc[_0x3893('0x19')];this[_0x3893('0x1a')]=_0x2e16fc[_0x3893('0x1a')];this[_0x3893('0x1b')]=_0x2e16fc['ContactId'];this[_0x3893('0x1c')]=_0x2e16fc[_0x3893('0x1c')];this[_0x3893('0x1d')]=_0x2e16fc[_0x3893('0x1d')];this[_0x3893('0x1e')]=_0x2e16fc[_0x3893('0x1e')];this['CampaignId']=_0x2e16fc[_0x3893('0x1f')];this['originatecalleridnum']=_0x2e16fc[_0x3893('0x20')]||'';this['originatecalleridname']=_0x2e16fc[_0x3893('0x21')]||'';this[_0x3893('0x22')]=_0x2e16fc[_0x3893('0x22')];this[_0x3893('0x23')]=_0x2e16fc[_0x3893('0x23')];}module[_0x3893('0x24')]=Final; \ No newline at end of file +var _0x089c=['state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x7d8e66,_0x599dbd){var _0x190e52=function(_0x13b646){while(--_0x13b646){_0x7d8e66['push'](_0x7d8e66['shift']());}};_0x190e52(++_0x599dbd);}(_0x089c,0x113));var _0xc089=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x089c[_0x2b9b7f];return _0x4ed19a;};'use strict';function Final(_0x9021f8){this[_0xc089('0x0')]=_0x9021f8[_0xc089('0x0')];this[_0xc089('0x1')]=_0x9021f8[_0xc089('0x1')];this['type']=_0x9021f8[_0xc089('0x2')];this[_0xc089('0x3')]=_0x9021f8['type']===_0xc089('0x4')?'queue':_0x9021f8[_0xc089('0x2')];this[_0xc089('0x5')]=_0x9021f8[_0xc089('0x5')];this[_0xc089('0x6')]=_0x9021f8[_0xc089('0x6')];this[_0xc089('0x7')]=_0x9021f8[_0xc089('0x7')];this[_0xc089('0x8')]=_0x9021f8[_0xc089('0x5')]+_0x9021f8[_0xc089('0x6')]+_0x9021f8[_0xc089('0x7')]+_0x9021f8[_0xc089('0x9')]+_0x9021f8['countdropretry']+_0x9021f8[_0xc089('0xa')]+_0x9021f8[_0xc089('0xb')]+_0x9021f8['countagentrejectretry'];this[_0xc089('0x9')]=_0x9021f8[_0xc089('0x9')];this[_0xc089('0xc')]=_0x9021f8[_0xc089('0xc')];this[_0xc089('0xa')]=_0x9021f8['countabandonedretry'];this[_0xc089('0xb')]=_0x9021f8[_0xc089('0xb')];this['countagentrejectretry']=_0x9021f8[_0xc089('0xd')];this[_0xc089('0xe')]=_0x9021f8[_0xc089('0xe')];this[_0xc089('0xf')]=_0x9021f8[_0xc089('0xf')];this[_0xc089('0x10')]=_0x9021f8[_0xc089('0x10')];this['starttime']=_0x9021f8['starttime'];this[_0xc089('0x11')]=_0x9021f8[_0xc089('0x11')];this[_0xc089('0x12')]=_0x9021f8['responsetime'];this['ringtime']=_0x9021f8[_0xc089('0x13')]||0x0;this[_0xc089('0x14')]=_0x9021f8[_0xc089('0x14')]||0x0;this[_0xc089('0x15')]=_0x9021f8[_0xc089('0x15')]||0x0;this[_0xc089('0x16')]=_0x9021f8[_0xc089('0x16')];this[_0xc089('0x17')]=_0x9021f8[_0xc089('0x17')];this['callbackat']=_0x9021f8['callbackat'];this['recallme']=_0x9021f8[_0xc089('0x18')];this[_0xc089('0x19')]=_0x9021f8['ContactId'];this['ListId']=_0x9021f8['ListId'];this['UserId']=_0x9021f8[_0xc089('0x1a')];this['VoiceQueueId']=_0x9021f8[_0xc089('0x1b')];this[_0xc089('0x1c')]=_0x9021f8[_0xc089('0x1c')];this['originatecalleridnum']=_0x9021f8[_0xc089('0x1d')]||'';this[_0xc089('0x1e')]=_0x9021f8[_0xc089('0x1e')]||'';this['state']=_0x9021f8[_0xc089('0x1f')];this[_0xc089('0x20')]=_0x9021f8[_0xc089('0x20')];}module[_0xc089('0x21')]=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 d65a0e6..790334d 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 _0xda62=['name','calleridnum','number','starttime','responsetime','format','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x14ff41,_0x30e1a1){var _0x4cd343=function(_0x444fc2){while(--_0x444fc2){_0x14ff41['push'](_0x14ff41['shift']());}};_0x4cd343(++_0x30e1a1);}(_0xda62,0x1ba));var _0x2da6=function(_0x3992e7,_0xd96d3f){_0x3992e7=_0x3992e7-0x0;var _0x3027e2=_0xda62[_0x3992e7];return _0x3027e2;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x88a0ee,_0x54eb4a){this[_0x2da6('0x0')]=0x4;this[_0x2da6('0x1')]=_0x2da6('0x2');this[_0x2da6('0x3')]=_0x88a0ee[_0x2da6('0x3')];this[_0x2da6('0x4')]=_0x88a0ee[_0x2da6('0x4')];this[_0x2da6('0x5')]=_0x88a0ee[_0x2da6('0x4')]===_0x2da6('0x6')?_0x2da6('0x7'):_0x88a0ee[_0x2da6('0x4')];this[_0x2da6('0x8')]=_0x88a0ee['amd']||![];this[_0x2da6('0x9')]=_0x88a0ee[_0x2da6('0x9')];this[_0x2da6('0xa')]=_0x88a0ee[_0x2da6('0xa')];this[_0x2da6('0xb')]=_0x88a0ee[_0x2da6('0xb')];this[_0x2da6('0xc')]=_0x88a0ee['countbusyretry']+_0x88a0ee[_0x2da6('0xa')]+_0x88a0ee[_0x2da6('0xb')]+_0x88a0ee['countnosuchnumberretry']+_0x88a0ee['countdropretry']+_0x88a0ee[_0x2da6('0xd')]+_0x88a0ee[_0x2da6('0xe')]+_0x88a0ee['countagentrejectretry'];this[_0x2da6('0xf')]=_0x88a0ee[_0x2da6('0xf')];this[_0x2da6('0x10')]=_0x88a0ee[_0x2da6('0x10')];this[_0x2da6('0xd')]=_0x88a0ee[_0x2da6('0xd')];this[_0x2da6('0xe')]=_0x88a0ee[_0x2da6('0xe')];this[_0x2da6('0x11')]=_0x88a0ee[_0x2da6('0x11')];this[_0x2da6('0x12')]=_0x54eb4a[_0x2da6('0x12')];this[_0x2da6('0x13')]=_0x88a0ee[_0x2da6('0x14')];this[_0x2da6('0x15')]=_0x88a0ee[_0x2da6('0x16')];this[_0x2da6('0x17')]=_0x88a0ee['starttime'];this[_0x2da6('0x18')]=_0x88a0ee[_0x2da6('0x18')];this['endtime']=moment()[_0x2da6('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2da6('0x1a')]=utils[_0x2da6('0x1b')](_0x88a0ee[_0x2da6('0x18')],_0x88a0ee['starttime']);this['holdtime']=0x0;this[_0x2da6('0x1c')]=utils[_0x2da6('0x1b')](this['endtime'],_0x88a0ee[_0x2da6('0x18')]);this[_0x2da6('0x7')]=_0x88a0ee[_0x2da6('0x7')];this[_0x2da6('0x1d')]=_0x2da6('0x1e');this[_0x2da6('0x1f')]=_0x54eb4a[_0x2da6('0x20')];this['callback']=_0x88a0ee[_0x2da6('0x21')];this[_0x2da6('0x22')]=_0x88a0ee[_0x2da6('0x22')];this[_0x2da6('0x23')]=_0x88a0ee[_0x2da6('0x23')];this['recallme']=_0x88a0ee['recallme'];this[_0x2da6('0x24')]=_0x88a0ee['ContactId'];this[_0x2da6('0x25')]=_0x88a0ee[_0x2da6('0x25')];this[_0x2da6('0x26')]=_0x88a0ee[_0x2da6('0x26')];this[_0x2da6('0x27')]=_0x88a0ee[_0x2da6('0x27')];this[_0x2da6('0x28')]=_0x88a0ee[_0x2da6('0x28')];}module[_0x2da6('0x29')]=Hangup; \ No newline at end of file +var _0x7217=['calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name'];(function(_0x405cd7,_0x360378){var _0x103764=function(_0x5e125f){while(--_0x5e125f){_0x405cd7['push'](_0x405cd7['shift']());}};_0x103764(++_0x360378);}(_0x7217,0x1ce));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x3f7eab,_0x326e4a){this[_0x7721('0x0')]=0x4;this['statedesc']=_0x7721('0x1');this['scheduledat']=_0x3f7eab[_0x7721('0x2')];this[_0x7721('0x3')]=_0x3f7eab[_0x7721('0x3')];this['campaigntype']=_0x3f7eab[_0x7721('0x3')]===_0x7721('0x4')?_0x7721('0x5'):_0x3f7eab[_0x7721('0x3')];this[_0x7721('0x6')]=_0x3f7eab[_0x7721('0x6')]||![];this['countbusyretry']=_0x3f7eab[_0x7721('0x7')];this['countcongestionretry']=_0x3f7eab[_0x7721('0x8')];this[_0x7721('0x9')]=_0x3f7eab[_0x7721('0x9')];this[_0x7721('0xa')]=_0x3f7eab[_0x7721('0x7')]+_0x3f7eab[_0x7721('0x8')]+_0x3f7eab['countnoanswerretry']+_0x3f7eab[_0x7721('0xb')]+_0x3f7eab[_0x7721('0xc')]+_0x3f7eab[_0x7721('0xd')]+_0x3f7eab[_0x7721('0xe')]+_0x3f7eab[_0x7721('0xf')];this[_0x7721('0xb')]=_0x3f7eab[_0x7721('0xb')];this[_0x7721('0xc')]=_0x3f7eab[_0x7721('0xc')];this[_0x7721('0xd')]=_0x3f7eab['countabandonedretry'];this[_0x7721('0xe')]=_0x3f7eab[_0x7721('0xe')];this['countagentrejectretry']=_0x3f7eab[_0x7721('0xf')];this['uniqueid']=_0x326e4a['uniqueid'];this[_0x7721('0x10')]=_0x3f7eab[_0x7721('0x11')];this[_0x7721('0x12')]=_0x3f7eab[_0x7721('0x13')];this['starttime']=_0x3f7eab[_0x7721('0x14')];this['responsetime']=_0x3f7eab[_0x7721('0x15')];this[_0x7721('0x16')]=moment()[_0x7721('0x17')](_0x7721('0x18'));this[_0x7721('0x19')]=utils[_0x7721('0x1a')](_0x3f7eab[_0x7721('0x15')],_0x3f7eab[_0x7721('0x14')]);this[_0x7721('0x1b')]=0x0;this[_0x7721('0x1c')]=utils[_0x7721('0x1a')](this[_0x7721('0x16')],_0x3f7eab[_0x7721('0x15')]);this[_0x7721('0x5')]=_0x3f7eab[_0x7721('0x5')];this['membername']=_0x7721('0x1d');this[_0x7721('0x1e')]=_0x326e4a['cause-txt'];this['callback']=_0x3f7eab['callback'];this[_0x7721('0x1f')]=_0x3f7eab[_0x7721('0x1f')];this['callbackat']=_0x3f7eab[_0x7721('0x20')];this[_0x7721('0x21')]=_0x3f7eab[_0x7721('0x21')];this[_0x7721('0x22')]=_0x3f7eab[_0x7721('0x22')];this[_0x7721('0x23')]=_0x3f7eab[_0x7721('0x23')];this[_0x7721('0x24')]=_0x3f7eab[_0x7721('0x24')];this[_0x7721('0x25')]=_0x3f7eab[_0x7721('0x25')];this[_0x7721('0x26')]=_0x3f7eab['CampaignId'];}module[_0x7721('0x27')]=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 e2f8251..253366b 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 _0x8596=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds'];(function(_0x4a4d6e,_0x38ab14){var _0x377fa8=function(_0x46e3cd){while(--_0x46e3cd){_0x4a4d6e['push'](_0x4a4d6e['shift']());}};_0x377fa8(++_0x38ab14);}(_0x8596,0x17f));var _0x6859=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8596[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x6859('0x0'));function History(_0x3e264a){this['uniqueid']=_0x3e264a[_0x6859('0x1')];this[_0x6859('0x2')]=_0x3e264a[_0x6859('0x2')]||undefined;this[_0x6859('0x3')]=_0x3e264a[_0x6859('0x3')];this[_0x6859('0x4')]=_0x3e264a['type']===_0x6859('0x5')?_0x6859('0x6'):_0x3e264a[_0x6859('0x3')];this[_0x6859('0x7')]=_0x3e264a[_0x6859('0x7')];this['countcongestionretry']=_0x3e264a[_0x6859('0x8')];this[_0x6859('0x9')]=_0x3e264a[_0x6859('0x9')];this[_0x6859('0xa')]=_0x3e264a[_0x6859('0x7')]+_0x3e264a[_0x6859('0x8')]+_0x3e264a['countnoanswerretry']+_0x3e264a[_0x6859('0xb')]+_0x3e264a['countdropretry']+_0x3e264a[_0x6859('0xc')]+_0x3e264a['countmachineretry']+_0x3e264a[_0x6859('0xd')];this[_0x6859('0xb')]=_0x3e264a[_0x6859('0xb')];this[_0x6859('0xe')]=_0x3e264a[_0x6859('0xe')];this[_0x6859('0xc')]=_0x3e264a[_0x6859('0xc')];this[_0x6859('0xf')]=_0x3e264a[_0x6859('0xf')];this[_0x6859('0xd')]=_0x3e264a[_0x6859('0xd')];this['queue']=_0x3e264a[_0x6859('0x6')];this[_0x6859('0x10')]=_0x3e264a['name'];this[_0x6859('0x11')]=_0x3e264a[_0x6859('0x12')];this[_0x6859('0x13')]=_0x3e264a[_0x6859('0x13')];this[_0x6859('0x14')]=_0x3e264a[_0x6859('0x14')];this[_0x6859('0x15')]=_0x3e264a[_0x6859('0x14')];this[_0x6859('0x16')]=utils[_0x6859('0x17')](_0x3e264a[_0x6859('0x14')],_0x3e264a[_0x6859('0x13')]);this['holdtime']=0x0;this[_0x6859('0x18')]=0x0;this['callback']=_0x3e264a[_0x6859('0x19')];this['callbackuniqueid']=_0x3e264a[_0x6859('0x1a')];this[_0x6859('0x1b')]=_0x3e264a[_0x6859('0x1b')];this['recallme']=_0x3e264a[_0x6859('0x1c')];this['ContactId']=_0x3e264a[_0x6859('0x1d')];this['ListId']=_0x3e264a[_0x6859('0x1e')];this['UserId']=_0x3e264a[_0x6859('0x1f')];this[_0x6859('0x20')]=_0x3e264a[_0x6859('0x20')];this[_0x6859('0x21')]=_0x3e264a[_0x6859('0x21')];this[_0x6859('0x22')]=_0x3e264a[_0x6859('0x22')]||'';this[_0x6859('0x23')]=_0x3e264a['originatecalleridname']||'';this[_0x6859('0x24')]=_0x3e264a[_0x6859('0x24')];this['statedesc']=_0x3e264a['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x373c=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','name','number'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x373c,0x143));var _0xc373=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x373c[_0x5db313];return _0x36d503;};'use strict';var utils=require(_0xc373('0x0'));function History(_0x22a006){this['uniqueid']=_0x22a006[_0xc373('0x1')];this[_0xc373('0x2')]=_0x22a006[_0xc373('0x2')]||undefined;this['type']=_0x22a006[_0xc373('0x3')];this[_0xc373('0x4')]=_0x22a006[_0xc373('0x3')]===_0xc373('0x5')?_0xc373('0x6'):_0x22a006[_0xc373('0x3')];this[_0xc373('0x7')]=_0x22a006[_0xc373('0x7')];this['countcongestionretry']=_0x22a006[_0xc373('0x8')];this[_0xc373('0x9')]=_0x22a006['countnoanswerretry'];this[_0xc373('0xa')]=_0x22a006[_0xc373('0x7')]+_0x22a006[_0xc373('0x8')]+_0x22a006[_0xc373('0x9')]+_0x22a006['countnosuchnumberretry']+_0x22a006['countdropretry']+_0x22a006[_0xc373('0xb')]+_0x22a006['countmachineretry']+_0x22a006[_0xc373('0xc')];this[_0xc373('0xd')]=_0x22a006[_0xc373('0xd')];this[_0xc373('0xe')]=_0x22a006[_0xc373('0xe')];this[_0xc373('0xb')]=_0x22a006[_0xc373('0xb')];this['countmachineretry']=_0x22a006[_0xc373('0xf')];this[_0xc373('0xc')]=_0x22a006[_0xc373('0xc')];this[_0xc373('0x6')]=_0x22a006[_0xc373('0x6')];this[_0xc373('0x10')]=_0x22a006[_0xc373('0x11')];this['calleridnum']=_0x22a006[_0xc373('0x12')];this[_0xc373('0x13')]=_0x22a006[_0xc373('0x13')];this['responsetime']=_0x22a006[_0xc373('0x14')];this[_0xc373('0x15')]=_0x22a006[_0xc373('0x14')];this[_0xc373('0x16')]=utils['getSeconds'](_0x22a006['responsetime'],_0x22a006[_0xc373('0x13')]);this[_0xc373('0x17')]=0x0;this[_0xc373('0x18')]=0x0;this[_0xc373('0x19')]=_0x22a006[_0xc373('0x19')];this[_0xc373('0x1a')]=_0x22a006[_0xc373('0x1a')];this['callbackat']=_0x22a006['callbackat'];this[_0xc373('0x1b')]=_0x22a006['recallme'];this[_0xc373('0x1c')]=_0x22a006['ContactId'];this[_0xc373('0x1d')]=_0x22a006[_0xc373('0x1d')];this[_0xc373('0x1e')]=_0x22a006[_0xc373('0x1e')];this[_0xc373('0x1f')]=_0x22a006[_0xc373('0x1f')];this['CampaignId']=_0x22a006[_0xc373('0x20')];this['originatecalleridnum']=_0x22a006[_0xc373('0x21')]||'';this[_0xc373('0x22')]=_0x22a006['originatecalleridname']||'';this[_0xc373('0x23')]=_0x22a006[_0xc373('0x23')];this[_0xc373('0x24')]=_0x22a006[_0xc373('0x24')];}module[_0xc373('0x25')]=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 b230f62..8da0472 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 _0x4c10=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1d3e3f,_0x495ec1){var _0x3879fa=function(_0x12e542){while(--_0x12e542){_0x1d3e3f['push'](_0x1d3e3f['shift']());}};_0x3879fa(++_0x495ec1);}(_0x4c10,0xe3));var _0x04c1=function(_0x5a024f,_0x1c5d40){_0x5a024f=_0x5a024f-0x0;var _0x4941e8=_0x4c10[_0x5a024f];return _0x4941e8;};'use strict';var utils=require(_0x04c1('0x0'));function QueueCallerAbandon(_0x30dd35,_0x9edf27){this['scheduledat']=_0x30dd35['scheduledat'];this[_0x04c1('0x1')]=_0x30dd35['type'];this[_0x04c1('0x2')]=_0x30dd35[_0x04c1('0x1')]===_0x04c1('0x3')?_0x04c1('0x4'):_0x30dd35[_0x04c1('0x1')];this[_0x04c1('0x5')]=_0x30dd35[_0x04c1('0x5')];this[_0x04c1('0x6')]=_0x30dd35[_0x04c1('0x6')];this[_0x04c1('0x7')]=_0x30dd35[_0x04c1('0x7')];this[_0x04c1('0x8')]=_0x30dd35[_0x04c1('0x5')]+_0x30dd35[_0x04c1('0x6')]+_0x30dd35[_0x04c1('0x7')]+_0x30dd35['countnosuchnumberretry']+_0x30dd35[_0x04c1('0x9')]+_0x30dd35[_0x04c1('0xa')]+_0x30dd35[_0x04c1('0xb')]+_0x30dd35['countagentrejectretry'];this[_0x04c1('0xc')]=_0x30dd35['countnosuchnumberretry'];this[_0x04c1('0x9')]=_0x30dd35[_0x04c1('0x9')];this[_0x04c1('0xa')]=_0x30dd35[_0x04c1('0xa')];this[_0x04c1('0xb')]=_0x30dd35['countmachineretry'];this[_0x04c1('0xd')]=_0x30dd35['countagentrejectretry'];this['uniqueid']=_0x9edf27['uniqueid'];this[_0x04c1('0xe')]=_0x30dd35[_0x04c1('0xf')];this[_0x04c1('0x10')]=_0x30dd35[_0x04c1('0x11')];this[_0x04c1('0x12')]=_0x30dd35[_0x04c1('0x12')];this[_0x04c1('0x13')]=_0x30dd35[_0x04c1('0x13')];this['droptime']=_0x30dd35[_0x04c1('0x14')];this[_0x04c1('0x15')]=_0x30dd35[_0x04c1('0x15')];this[_0x04c1('0x16')]=this[_0x04c1('0x14')];this['ringtime']=utils['getSeconds'](_0x30dd35[_0x04c1('0x13')],_0x30dd35[_0x04c1('0x12')]);this[_0x04c1('0x17')]=utils[_0x04c1('0x18')](this[_0x04c1('0x14')],_0x30dd35[_0x04c1('0x13')]);this[_0x04c1('0x19')]=0x0;this[_0x04c1('0x4')]=_0x9edf27[_0x04c1('0x4')];this[_0x04c1('0x1a')]=_0x9edf27[_0x04c1('0x1b')];this[_0x04c1('0x1c')]=_0x9edf27[_0x04c1('0x1c')];this[_0x04c1('0x1d')]=_0x30dd35[_0x04c1('0x1d')];this[_0x04c1('0x1e')]=_0x30dd35[_0x04c1('0x1e')];this['callbackat']=_0x30dd35[_0x04c1('0x1f')];this[_0x04c1('0x20')]=_0x30dd35[_0x04c1('0x20')];this[_0x04c1('0x21')]=_0x30dd35[_0x04c1('0x21')];this['ListId']=_0x30dd35[_0x04c1('0x22')];this[_0x04c1('0x23')]=_0x30dd35[_0x04c1('0x23')];this[_0x04c1('0x24')]=_0x30dd35[_0x04c1('0x24')];this[_0x04c1('0x25')]=_0x30dd35['CampaignId'];this[_0x04c1('0x26')]=_0x30dd35[_0x04c1('0x26')]||'';this[_0x04c1('0x27')]=_0x30dd35[_0x04c1('0x27')]||'';this[_0x04c1('0x28')]=_0x30dd35[_0x04c1('0x28')];this[_0x04c1('0x29')]=_0x30dd35[_0x04c1('0x29')];this[_0x04c1('0x2a')]=_0x30dd35[_0x04c1('0x2a')];}module[_0x04c1('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xf917=['originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x4222b5,_0x37422c){var _0x425d4c=function(_0x53e442){while(--_0x53e442){_0x4222b5['push'](_0x4222b5['shift']());}};_0x425d4c(++_0x37422c);}(_0xf917,0x176));var _0x7f91=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xf917[_0x58c20f];return _0x3b0318;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1bf7c0,_0x4bf252){this[_0x7f91('0x0')]=_0x1bf7c0[_0x7f91('0x0')];this[_0x7f91('0x1')]=_0x1bf7c0[_0x7f91('0x1')];this[_0x7f91('0x2')]=_0x1bf7c0[_0x7f91('0x1')]===_0x7f91('0x3')?_0x7f91('0x4'):_0x1bf7c0[_0x7f91('0x1')];this[_0x7f91('0x5')]=_0x1bf7c0['countbusyretry'];this[_0x7f91('0x6')]=_0x1bf7c0[_0x7f91('0x6')];this[_0x7f91('0x7')]=_0x1bf7c0['countnoanswerretry'];this['countglobal']=_0x1bf7c0[_0x7f91('0x5')]+_0x1bf7c0[_0x7f91('0x6')]+_0x1bf7c0['countnoanswerretry']+_0x1bf7c0['countnosuchnumberretry']+_0x1bf7c0[_0x7f91('0x8')]+_0x1bf7c0[_0x7f91('0x9')]+_0x1bf7c0[_0x7f91('0xa')]+_0x1bf7c0[_0x7f91('0xb')];this[_0x7f91('0xc')]=_0x1bf7c0['countnosuchnumberretry'];this[_0x7f91('0x8')]=_0x1bf7c0[_0x7f91('0x8')];this[_0x7f91('0x9')]=_0x1bf7c0['countabandonedretry'];this['countmachineretry']=_0x1bf7c0[_0x7f91('0xa')];this[_0x7f91('0xb')]=_0x1bf7c0[_0x7f91('0xb')];this[_0x7f91('0xd')]=_0x4bf252[_0x7f91('0xd')];this[_0x7f91('0xe')]=_0x1bf7c0[_0x7f91('0xf')];this[_0x7f91('0x10')]=_0x1bf7c0['number'];this[_0x7f91('0x11')]=_0x1bf7c0[_0x7f91('0x11')];this[_0x7f91('0x12')]=_0x1bf7c0['responsetime'];this[_0x7f91('0x13')]=_0x1bf7c0[_0x7f91('0x13')];this[_0x7f91('0x14')]=_0x1bf7c0[_0x7f91('0x14')];this[_0x7f91('0x15')]=this['droptime'];this[_0x7f91('0x16')]=utils[_0x7f91('0x17')](_0x1bf7c0[_0x7f91('0x12')],_0x1bf7c0['starttime']);this['holdtime']=utils[_0x7f91('0x17')](this['droptime'],_0x1bf7c0[_0x7f91('0x12')]);this[_0x7f91('0x18')]=0x0;this[_0x7f91('0x4')]=_0x4bf252[_0x7f91('0x4')];this['membername']=_0x4bf252['connectedlinename'];this[_0x7f91('0x19')]=_0x4bf252[_0x7f91('0x19')];this[_0x7f91('0x1a')]=_0x1bf7c0['callback'];this['callbackuniqueid']=_0x1bf7c0[_0x7f91('0x1b')];this[_0x7f91('0x1c')]=_0x1bf7c0['callbackat'];this[_0x7f91('0x1d')]=_0x1bf7c0[_0x7f91('0x1d')];this['ContactId']=_0x1bf7c0[_0x7f91('0x1e')];this['ListId']=_0x1bf7c0[_0x7f91('0x1f')];this[_0x7f91('0x20')]=_0x1bf7c0[_0x7f91('0x20')];this['VoiceQueueId']=_0x1bf7c0[_0x7f91('0x21')];this[_0x7f91('0x22')]=_0x1bf7c0[_0x7f91('0x22')];this[_0x7f91('0x23')]=_0x1bf7c0[_0x7f91('0x23')]||'';this[_0x7f91('0x24')]=_0x1bf7c0[_0x7f91('0x24')]||'';this[_0x7f91('0x25')]=_0x1bf7c0[_0x7f91('0x25')];this[_0x7f91('0x26')]=_0x1bf7c0[_0x7f91('0x26')];this[_0x7f91('0x27')]=_0x1bf7c0[_0x7f91('0x27')];}module[_0x7f91('0x28')]=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 767b0cf..3dd7aa9 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 _0x6d11=['checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d11,0xbf));var _0x16d1=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x6d11[_0xf80b3];return _0x10c489;};'use strict';var util=require(_0x16d1('0x0'));var logger=require(_0x16d1('0x1'))(_0x16d1('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x16d1('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x16d1('0x4'));function inspectError(_0x2e1a35){return util['inspect'](_0x2e1a35,{'showHidden':![],'depth':null});}function getContactDialer(_0x48754e,_0x3e0e86,_0x46f7d7){return cmHopper[_0x16d1('0x5')](_0x48754e['id'],_0x3e0e86,_0x46f7d7,_0x48754e[_0x16d1('0x6')])[_0x16d1('0x7')](function(_0x150217){_0x48754e[_0x16d1('0x8')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x150217));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x3275c8,_0xcfbb15){return cmHopper[_0x16d1('0x9')](_0x3275c8['id'],_0xcfbb15,_0x3275c8[_0x16d1('0x6')])['catch'](function(_0x265a84){_0x3275c8[_0x16d1('0x8')]=0x0;logger[_0x16d1('0xa')](_0x16d1('0xb'),inspectError(_0x265a84));});}exports[_0x16d1('0x9')]=getContactDialerIvr;function countReScheduled(_0x20edf8){return cmHopper[_0x16d1('0xc')](_0x20edf8)[_0x16d1('0x7')](function(_0x4de260){logger[_0x16d1('0xa')](_0x16d1('0xd'),inspectError(_0x4de260));});}exports[_0x16d1('0xc')]=countReScheduled;function rescheduleContact(_0x32351b){return cmHopper[_0x16d1('0xe')](_0x32351b)['catch'](function(_0xc034b7){logger[_0x16d1('0xa')](_0x16d1('0xf'),inspectError(_0xc034b7));});}exports[_0x16d1('0xe')]=rescheduleContact;function unlockContact(_0x29ebba,_0x173e16,_0x2d7e8a){return cmHopper['unlockContact'](_0x29ebba,_0x173e16,_0x2d7e8a)[_0x16d1('0x7')](function(_0x2b399c){logger['error']('[unlockContact]',inspectError(_0x2b399c));});}exports[_0x16d1('0x10')]=unlockContact;function moveContactManagedDialer(_0x47c245){return cmHopper[_0x16d1('0x11')](_0x47c245)['catch'](function(_0x1da1b8){logger['error'](_0x16d1('0x12'),inspectError(_0x1da1b8));});}exports[_0x16d1('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x48cd70){return cmHopperBlack['checkIsBlackList'](_0x48cd70)['catch'](function(_0x5b9599){logger[_0x16d1('0xa')]('[checkIsBlackList]',inspectError(_0x5b9599));});}exports[_0x16d1('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x7887d5){return cmHopperBlack[_0x16d1('0x14')](_0x7887d5)[_0x16d1('0x7')](function(_0x54b3a6){logger[_0x16d1('0xa')](_0x16d1('0x15'),inspectError(_0x54b3a6));});}exports[_0x16d1('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x585ce5,_0x3fc99e,_0x8c7266){return cmHopperAdditionalPhone[_0x16d1('0x16')](_0x585ce5,_0x3fc99e,_0x8c7266)[_0x16d1('0x7')](function(_0x215c23){logger[_0x16d1('0xa')](_0x16d1('0x17'),inspectError(_0x215c23));});}exports[_0x16d1('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3f8436,_0x335c24,_0x4b2b5c){return cmHopperAdditionalPhone[_0x16d1('0x18')](_0x3f8436,_0x335c24,_0x4b2b5c)[_0x16d1('0x7')](function(_0x262f89){logger[_0x16d1('0xa')](_0x16d1('0x19'),inspectError(_0x262f89));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x25ae4e){return cmHopperHistory[_0x16d1('0x1a')](_0x25ae4e)[_0x16d1('0x7')](function(_0x49fc1b){logger[_0x16d1('0xa')](_0x16d1('0x1b'),inspectError(_0x49fc1b));});}exports[_0x16d1('0x1a')]=avgHandleTime;function createHistory(_0x22e5b3){return cmHopperHistory[_0x16d1('0x1c')](_0x22e5b3)[_0x16d1('0x7')](function(_0x1dd574){logger['error'](_0x16d1('0x1d'),inspectError(_0x1dd574));});}exports[_0x16d1('0x1c')]=createHistory; \ No newline at end of file +var _0xa46e=['getContactDialerIvr','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]'];(function(_0x4c9915,_0x406b1a){var _0x473218=function(_0x2536ba){while(--_0x2536ba){_0x4c9915['push'](_0x4c9915['shift']());}};_0x473218(++_0x406b1a);}(_0xa46e,0x8a));var _0xea46=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xa46e[_0x5ee3d3];return _0x4b272f;};'use strict';var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))('dialer');var cmHopper=require(_0xea46('0x2'));var cmHopperAdditionalPhone=require(_0xea46('0x3'));var cmHopperBlack=require(_0xea46('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x19f135){return util['inspect'](_0x19f135,{'showHidden':![],'depth':null});}function getContactDialer(_0x3a2209,_0x47d633,_0x3599fc){return cmHopper['getContactDialer'](_0x3a2209['id'],_0x47d633,_0x3599fc,_0x3a2209[_0xea46('0x5')])[_0xea46('0x6')](function(_0x5f1cd1){_0x3a2209[_0xea46('0x7')]=0x0;logger[_0xea46('0x8')](_0xea46('0x9'),inspectError(_0x5f1cd1));});}exports[_0xea46('0xa')]=getContactDialer;function getContactDialerIvr(_0x468322,_0x4cf206){return cmHopper['getContactDialerIvr'](_0x468322['id'],_0x4cf206,_0x468322['dialOrderByScheduledAt'])[_0xea46('0x6')](function(_0x45550a){_0x468322['temp']=0x0;logger[_0xea46('0x8')](_0xea46('0xb'),inspectError(_0x45550a));});}exports[_0xea46('0xc')]=getContactDialerIvr;function countReScheduled(_0x594694){return cmHopper[_0xea46('0xd')](_0x594694)[_0xea46('0x6')](function(_0x4e10f3){logger[_0xea46('0x8')](_0xea46('0xe'),inspectError(_0x4e10f3));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x20955e){return cmHopper['rescheduleContact'](_0x20955e)[_0xea46('0x6')](function(_0x42c328){logger[_0xea46('0x8')](_0xea46('0xf'),inspectError(_0x42c328));});}exports[_0xea46('0x10')]=rescheduleContact;function unlockContact(_0x2ef436,_0x81ee45,_0x20a79c){return cmHopper[_0xea46('0x11')](_0x2ef436,_0x81ee45,_0x20a79c)['catch'](function(_0x2fa2f9){logger[_0xea46('0x8')](_0xea46('0x12'),inspectError(_0x2fa2f9));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x58b4da){return cmHopper[_0xea46('0x13')](_0x58b4da)[_0xea46('0x6')](function(_0x5cf5dd){logger['error'](_0xea46('0x14'),inspectError(_0x5cf5dd));});}exports[_0xea46('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ff93d){return cmHopperBlack[_0xea46('0x15')](_0x4ff93d)[_0xea46('0x6')](function(_0x1adba1){logger[_0xea46('0x8')]('[checkIsBlackList]',inspectError(_0x1adba1));});}exports[_0xea46('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4e220f){return cmHopperBlack['checkIsBlackListIvr'](_0x4e220f)[_0xea46('0x6')](function(_0x59e431){logger['error']('[checkIsBlackListIvr]',inspectError(_0x59e431));});}exports[_0xea46('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x36f982,_0x3d1850,_0x5beb44){return cmHopperAdditionalPhone[_0xea46('0x17')](_0x36f982,_0x3d1850,_0x5beb44)['catch'](function(_0x12e688){logger[_0xea46('0x8')]('[verifyAdditionalPhone]',inspectError(_0x12e688));});}exports[_0xea46('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5480eb,_0x2b3a8f,_0x114bf9){return cmHopperAdditionalPhone[_0xea46('0x18')](_0x5480eb,_0x2b3a8f,_0x114bf9)['catch'](function(_0x5d2de1){logger[_0xea46('0x8')](_0xea46('0x19'),inspectError(_0x5d2de1));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x3b3928){return cmHopperHistory['avgHandleTime'](_0x3b3928)[_0xea46('0x6')](function(_0x51ca27){logger[_0xea46('0x8')](_0xea46('0x1a'),inspectError(_0x51ca27));});}exports[_0xea46('0x1b')]=avgHandleTime;function createHistory(_0x44517d){return cmHopperHistory[_0xea46('0x1c')](_0x44517d)[_0xea46('0x6')](function(_0x4a5149){logger[_0xea46('0x8')](_0xea46('0x1d'),inspectError(_0x4a5149));});}exports[_0xea46('0x1c')]=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 da1fbb1..251765b 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 _0x319d=['AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','ivr','isIVRCampaign','outbound','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','toUpperCase','setXMDContactVariables','lodash','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x319d,0xeb));var _0xd319=function(_0x37a1e6,_0x536b85){_0x37a1e6=_0x37a1e6-0x0;var _0x115a59=_0x319d[_0x37a1e6];return _0x115a59;};'use strict';var _=require(_0xd319('0x0'));var moment=require('moment');var util=require('util');var logger=require('../../../../config/logger')(_0xd319('0x1'));var timezones=require(_0xd319('0x2'))[_0xd319('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0xd319('0x4'),'BLACKLIST':_0xd319('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xd319('0x6'),'DISACTIVED':_0xd319('0x7'),'EMPTY_INTERVAL':_0xd319('0x8'),'INACTIVE':_0xd319('0x9'),'NO_AGENTS_LOGGED':_0xd319('0xa'),'NO_AVAILABLE_CONTACTS':_0xd319('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xd319('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xd319('0xd'),'RECALL_TIMEOUT':_0xd319('0xe'),'RUNNING':_0xd319('0xf'),'UNKNOWN_TIMEZONE':_0xd319('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xd319('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x56d9c0){return _0x56d9c0[_0xd319('0x12')]===_0xd319('0x13');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x5e36a7){return _0x5e36a7['type']===_0xd319('0x14');}exports[_0xd319('0x15')]=isIVRCampaign;function isOutboundQueue(_0x207a42){return _0x207a42['type']===_0xd319('0x16');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x219291){return _0x219291['dialActive'];}exports[_0xd319('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1a743d){return _0x1a743d[_0xd319('0x18')];}exports[_0xd319('0x19')]=isIVRCampaignActive;function getSeconds(_0xa9cf8a,_0x45ff10){var _0x119b5d=moment(_0xa9cf8a)[_0xd319('0x1a')](0x0);var _0x270e79=moment(_0x45ff10)[_0xd319('0x1a')](0x0);return _0x119b5d[_0xd319('0x1b')](_0x270e79,'seconds');}exports[_0xd319('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0xcfe227,_0x4a75a1){var _0x43efaf=![];var _0x42e605=_0xcfe227['dialMethod']!==_0x4a75a1['dialMethod']||_0xcfe227['dialActive']!==_0x4a75a1['dialActive']||_0xcfe227['message']!==_0x4a75a1[_0xd319('0x1d')];var _0x3406c5=_0xcfe227[_0xd319('0x1e')]!==_0x4a75a1['available']||_0xcfe227[_0xd319('0x1f')]!==_0x4a75a1['loggedIn']||_0xcfe227[_0xd319('0x20')]!==_0x4a75a1[_0xd319('0x20')]||_0xcfe227['paused']!==_0x4a75a1['paused']||_0xcfe227[_0xd319('0x21')]!==_0x4a75a1[_0xd319('0x21')]||_0xcfe227[_0xd319('0x22')]!==_0x4a75a1[_0xd319('0x22')]||_0xcfe227[_0xd319('0x23')]!==_0x4a75a1[_0xd319('0x23')]||_0xcfe227[_0xd319('0x24')]!==_0x4a75a1[_0xd319('0x24')]||_0xcfe227['originated']!==_0x4a75a1[_0xd319('0x25')];if(_0xcfe227['Trunk']&&_0x4a75a1[_0xd319('0x26')]){_0x43efaf=_0xcfe227[_0xd319('0x26')][_0xd319('0x27')]!==_0x4a75a1['Trunk'][_0xd319('0x27')]||_0xcfe227[_0xd319('0x26')][_0xd319('0x18')]!==_0x4a75a1[_0xd319('0x26')][_0xd319('0x18')];}return _0x42e605||_0x3406c5||_0x43efaf;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x466b2b){var _0x497200=null;var _0x58d7a4=_0x466b2b[_0xd319('0x28')];if(_[_0xd319('0x29')](_0x466b2b[_0xd319('0x2a')])||_[_0xd319('0x29')](_0x466b2b[_0xd319('0x2b')])||_[_0xd319('0x29')](_0x466b2b['Interval'][_0xd319('0x2c')])){_0x497200=CAMPAIGN_STATUS[_0xd319('0x2d')];}else if(_[_0xd319('0x2e')](_0x466b2b['dialGlobalInterval'])||_['isEmpty'](_0x466b2b[_0xd319('0x2b')][_0xd319('0x2c')])){_0x497200=CAMPAIGN_STATUS[_0xd319('0x2f')];}else if(_0x58d7a4&&!timezones[_0x58d7a4]){_0x497200=CAMPAIGN_STATUS[_0xd319('0x30')];}return _0x497200;}function checkAnyValidTrunk(_0x1abe05,_0x11a539){var _0x3ce31e=null;var _0x2e573d='SIP/';var _0x34c5e9=['reachable',_0xd319('0x31')];var _0x5a70de=!![];if(_0x1abe05['Trunk']&&_0x1abe05[_0xd319('0x26')][_0xd319('0x18')]){_0x2e573d+=_0x1abe05[_0xd319('0x26')][_0xd319('0x27')];_0x3ce31e=_0x11a539[_0x2e573d];_0x5a70de=_0x34c5e9[_0xd319('0x32')](_0x3ce31e[_0xd319('0x33')]);}else if(_0x1abe05[_0xd319('0x34')]&&_0x1abe05[_0xd319('0x34')][_0xd319('0x18')]){_0x2e573d+=_0x1abe05['TrunkBackup'][_0xd319('0x27')];_0x3ce31e=_0x11a539[_0x2e573d];_0x5a70de=_0x34c5e9[_0xd319('0x32')](_0x3ce31e['status']);}return _0x5a70de;}function getQueueCampaignStatusMessage(_0x3a236b,_0x3d94c7){var _0x351aa8=CAMPAIGN_STATUS['ACTIVE'];var _0x490faa=isPreviewCampaign(_0x3a236b);if(!isQueueCampaignActive(_0x3a236b)){if(_0x490faa){_0x351aa8=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3a236b[_0xd319('0x25')]===0x0&&_0x3a236b['talking']===0x0&&_0x3a236b[_0xd319('0x23')]===0x0&&(_0x3a236b[_0xd319('0x22')]||0x0)===0x0){_0x351aa8=CAMPAIGN_STATUS[_0xd319('0x35')];}else{_0x351aa8=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x3a236b[_0xd319('0x1f')]===0x0){_0x351aa8=CAMPAIGN_STATUS[_0xd319('0x36')];}else if(!checkAnyValidTrunk(_0x3a236b,_0x3d94c7)){_0x351aa8=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x3a236b)){var _0x52692d=checkAnyValidQueueCampaignInterval(_0x3a236b);if(_0x52692d){_0x351aa8=_0x52692d;}}return _0x351aa8;}exports[_0xd319('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x509b6e){var _0x469ef2=CAMPAIGN_STATUS[_0xd319('0x38')];if(_0x509b6e[_0xd319('0x25')]===0x0&&_0x509b6e[_0xd319('0x21')]===0x0&&_0x509b6e[_0xd319('0x23')]===0x0&&(_0x509b6e['pTalking']||0x0)===0x0){_0x469ef2=CAMPAIGN_STATUS[_0xd319('0x35')];}return _0x469ef2;}exports[_0xd319('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xe88dab){var _0x1d3d77=_0xe88dab[_0xd319('0x3a')](/"(.*?)"/);return _0x1d3d77?_0x1d3d77[0x1]:_0xe88dab;}exports[_0xd319('0x3b')]=extractCalleridName;function getCallerId(_0xd24027,_0x48e967,_0x29d634){if(!_['isUndefined'](_0x29d634)&&typeof _0x29d634===_0xd319('0x3c')&&!_[_0xd319('0x2e')](_0x29d634)){if(!_[_0xd319('0x3d')](_0x48e967)&&typeof _0x48e967===_0xd319('0x3c')&&!_['isEmpty'](_0x48e967)){return util[_0xd319('0x3e')](_0xd319('0x3f'),_0x48e967,_0x29d634);}return util[_0xd319('0x3e')](_0xd319('0x3f'),_0x29d634,_0x29d634);}if(!_[_0xd319('0x3d')](_0xd24027)&&typeof _0xd24027===_0xd319('0x3c')&&!_[_0xd319('0x2e')](_0xd24027)){return _0xd24027;}return _0xd319('0x40');}exports[_0xd319('0x41')]=getCallerId;function getCallerIdRandom(_0x1ae643,_0x19ebc7){var _0x3efbcf;var _0x730ac6;var _0x401025;if(_0x19ebc7<=0x0){_0x19ebc7=0x1;}_0x3efbcf=new RegExp('\x5cw{0,'+_0x19ebc7+'}$');_0x730ac6=Math['pow'](0xa,_0x19ebc7-0x1);_0x401025=Math[_0xd319('0x42')](0xa,_0x19ebc7)-0x1;return util[_0xd319('0x3e')]('%s',_[_0xd319('0x43')](_0x1ae643,_0x3efbcf,_[_0xd319('0x44')](_0x730ac6,_0x401025)[_0xd319('0x45')]()));}exports[_0xd319('0x46')]=getCallerIdRandom;function decrementOriginate(_0x4bc342){if(_0x4bc342[_0xd319('0x25')]&&_0x4bc342[_0xd319('0x25')]>0x0){_0x4bc342['originated']-=0x1;}else{logger[_0xd319('0x47')](_0xd319('0x48'));}}exports[_0xd319('0x49')]=decrementOriginate;function checkContactEmpty(_0x171d02){return _0x171d02&&_0x171d02[_0xd319('0x4a')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x55b1aa,_0x443545){if(_0x443545===0x0){return 0x0;}var _0x237d04=0x1;for(var _0x1aca8a=0x1;_0x1aca8a<=_0x443545;_0x1aca8a+=0x1){_0x237d04=0x1+_0x237d04*_0x1aca8a/_0x55b1aa;}return 0x1/_0x237d04;}exports[_0xd319('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x52beeb,_0x4d491a,_0x12eaf9){if(_0x4d491a>_0x12eaf9){for(var _0x323415=0x0;_0x323415<_0x4d491a-_0x12eaf9;_0x323415+=0x1){decrementOriginate(_0x52beeb);}}}exports[_0xd319('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5c2d73){var _0x4c1fb2={};var _0x52dc1=['id','createdAt','description',_0xd319('0x4d'),_0xd319('0x4e')];if(_0x5c2d73){for(var _0x349d97 in _0x5c2d73){if(typeof _0x5c2d73[_0x349d97]!==_0xd319('0x4f')){if(!_[_0xd319('0x29')](_0x5c2d73[_0x349d97])&&!_0x52dc1[_0xd319('0x32')](_0x349d97)){_0x4c1fb2[util[_0xd319('0x3e')]('%s%s','XMD-',_0x349d97[_0xd319('0x50')]())]=_0x5c2d73[_0x349d97];}}}}return _0x4c1fb2;}exports[_0xd319('0x51')]=setXMDContactVariables; \ No newline at end of file +var _0xfa1e=['getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','undefined','%s%s','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','includes','status','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xfa1e,0xf5));var _0xefa1=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0xfa1e[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0xefa1('0x0'));var moment=require(_0xefa1('0x1'));var util=require(_0xefa1('0x2'));var logger=require(_0xefa1('0x3'))(_0xefa1('0x4'));var timezones=require('../../../../config/environment/shared')[_0xefa1('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xefa1('0x6'),'BLACKLIST':_0xefa1('0x7'),'CONTACTS_RESCHEDULED':_0xefa1('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xefa1('0x9'),'EMPTY_INTERVAL':_0xefa1('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xefa1('0xb'),'OVERTIME_INTERVAL':_0xefa1('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xefa1('0xd'),'RUNNING':_0xefa1('0xe'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xefa1('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x40383d){return _0x40383d[_0xefa1('0x10')]===_0xefa1('0x11');}exports[_0xefa1('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x4eec41){return _0x4eec41['type']===_0xefa1('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x291ba5){return _0x291ba5['type']===_0xefa1('0x14');}exports[_0xefa1('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x1d4cec){return _0x1d4cec[_0xefa1('0x16')];}exports[_0xefa1('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1685bb){return _0x1685bb[_0xefa1('0x18')];}exports[_0xefa1('0x19')]=isIVRCampaignActive;function getSeconds(_0x4a975c,_0x249703){var _0x36bd27=moment(_0x4a975c)[_0xefa1('0x1a')](0x0);var _0x3418b6=moment(_0x249703)[_0xefa1('0x1a')](0x0);return _0x36bd27[_0xefa1('0x1b')](_0x3418b6,_0xefa1('0x1c'));}exports[_0xefa1('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x162161,_0x3c4f5a){var _0xac4941=![];var _0x4f464a=_0x162161['dialMethod']!==_0x3c4f5a[_0xefa1('0x10')]||_0x162161[_0xefa1('0x16')]!==_0x3c4f5a['dialActive']||_0x162161[_0xefa1('0x1e')]!==_0x3c4f5a[_0xefa1('0x1e')];var _0x315fd2=_0x162161[_0xefa1('0x1f')]!==_0x3c4f5a[_0xefa1('0x1f')]||_0x162161[_0xefa1('0x20')]!==_0x3c4f5a[_0xefa1('0x20')]||_0x162161['loggedInDb']!==_0x3c4f5a['loggedInDb']||_0x162161[_0xefa1('0x21')]!==_0x3c4f5a[_0xefa1('0x21')]||_0x162161[_0xefa1('0x22')]!==_0x3c4f5a[_0xefa1('0x22')]||_0x162161[_0xefa1('0x23')]!==_0x3c4f5a[_0xefa1('0x23')]||_0x162161[_0xefa1('0x24')]!==_0x3c4f5a['waiting']||_0x162161[_0xefa1('0x25')]!==_0x3c4f5a[_0xefa1('0x25')]||_0x162161[_0xefa1('0x26')]!==_0x3c4f5a['originated'];if(_0x162161[_0xefa1('0x27')]&&_0x3c4f5a[_0xefa1('0x27')]){_0xac4941=_0x162161[_0xefa1('0x27')][_0xefa1('0x28')]!==_0x3c4f5a[_0xefa1('0x27')][_0xefa1('0x28')]||_0x162161[_0xefa1('0x27')][_0xefa1('0x18')]!==_0x3c4f5a[_0xefa1('0x27')]['active'];}return _0x4f464a||_0x315fd2||_0xac4941;}exports[_0xefa1('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4c0e56){var _0x5aedb5=null;var _0x4d9cd9=_0x4c0e56[_0xefa1('0x2a')];if(_['isNil'](_0x4c0e56[_0xefa1('0x2b')])||_[_0xefa1('0x2c')](_0x4c0e56[_0xefa1('0x2d')])||_[_0xefa1('0x2c')](_0x4c0e56[_0xefa1('0x2d')][_0xefa1('0x2e')])){_0x5aedb5=CAMPAIGN_STATUS[_0xefa1('0x2f')];}else if(_[_0xefa1('0x30')](_0x4c0e56[_0xefa1('0x2b')])||_[_0xefa1('0x30')](_0x4c0e56['Interval'][_0xefa1('0x2e')])){_0x5aedb5=CAMPAIGN_STATUS[_0xefa1('0x31')];}else if(_0x4d9cd9&&!timezones[_0x4d9cd9]){_0x5aedb5=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x5aedb5;}function checkAnyValidTrunk(_0x5362af,_0x4c34b7){var _0x55651a=null;var _0x3ac226=_0xefa1('0x32');var _0x13d0de=['reachable','unmonitored'];var _0x4f6ad2=!![];if(_0x5362af[_0xefa1('0x27')]&&_0x5362af[_0xefa1('0x27')][_0xefa1('0x18')]){_0x3ac226+=_0x5362af[_0xefa1('0x27')][_0xefa1('0x28')];_0x55651a=_0x4c34b7[_0x3ac226];_0x4f6ad2=_0x13d0de[_0xefa1('0x33')](_0x55651a[_0xefa1('0x34')]);}else if(_0x5362af[_0xefa1('0x35')]&&_0x5362af[_0xefa1('0x35')]['active']){_0x3ac226+=_0x5362af['TrunkBackup'][_0xefa1('0x28')];_0x55651a=_0x4c34b7[_0x3ac226];_0x4f6ad2=_0x13d0de[_0xefa1('0x33')](_0x55651a['status']);}return _0x4f6ad2;}function getQueueCampaignStatusMessage(_0x250496,_0x2fd8b0){var _0x1380c1=CAMPAIGN_STATUS[_0xefa1('0x6')];var _0x24d924=isPreviewCampaign(_0x250496);if(!isQueueCampaignActive(_0x250496)){if(_0x24d924){_0x1380c1=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x250496['originated']===0x0&&_0x250496[_0xefa1('0x22')]===0x0&&_0x250496['waiting']===0x0&&(_0x250496['pTalking']||0x0)===0x0){_0x1380c1=CAMPAIGN_STATUS[_0xefa1('0x36')];}else{_0x1380c1=CAMPAIGN_STATUS[_0xefa1('0x37')];}}}else if(_0x250496[_0xefa1('0x20')]===0x0){_0x1380c1=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x250496,_0x2fd8b0)){_0x1380c1=CAMPAIGN_STATUS[_0xefa1('0x38')];}else if(!isPreviewCampaign(_0x250496)){var _0x89d036=checkAnyValidQueueCampaignInterval(_0x250496);if(_0x89d036){_0x1380c1=_0x89d036;}}return _0x1380c1;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x328415){var _0x3084e1=CAMPAIGN_STATUS['DISACTIVED'];if(_0x328415[_0xefa1('0x26')]===0x0&&_0x328415[_0xefa1('0x22')]===0x0&&_0x328415['waiting']===0x0&&(_0x328415[_0xefa1('0x23')]||0x0)===0x0){_0x3084e1=CAMPAIGN_STATUS[_0xefa1('0x36')];}return _0x3084e1;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5c65d9){var _0x5801bf=_0x5c65d9[_0xefa1('0x39')](/"(.*?)"/);return _0x5801bf?_0x5801bf[0x1]:_0x5c65d9;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x56fdbd,_0x406280,_0x1eb43a){if(!_[_0xefa1('0x3a')](_0x1eb43a)&&typeof _0x1eb43a==='string'&&!_['isEmpty'](_0x1eb43a)){if(!_[_0xefa1('0x3a')](_0x406280)&&typeof _0x406280===_0xefa1('0x3b')&&!_['isEmpty'](_0x406280)){return util['format']('\x22%s\x22\x20<%s>',_0x406280,_0x1eb43a);}return util[_0xefa1('0x3c')](_0xefa1('0x3d'),_0x1eb43a,_0x1eb43a);}if(!_[_0xefa1('0x3a')](_0x56fdbd)&&typeof _0x56fdbd===_0xefa1('0x3b')&&!_[_0xefa1('0x30')](_0x56fdbd)){return _0x56fdbd;}return _0xefa1('0x3e');}exports[_0xefa1('0x3f')]=getCallerId;function getCallerIdRandom(_0x108cd5,_0x423d3a){var _0x28cde9;var _0x30d0b1;var _0x5b5e20;if(_0x423d3a<=0x0){_0x423d3a=0x1;}_0x28cde9=new RegExp(_0xefa1('0x40')+_0x423d3a+'}$');_0x30d0b1=Math[_0xefa1('0x41')](0xa,_0x423d3a-0x1);_0x5b5e20=Math['pow'](0xa,_0x423d3a)-0x1;return util[_0xefa1('0x3c')]('%s',_[_0xefa1('0x42')](_0x108cd5,_0x28cde9,_['random'](_0x30d0b1,_0x5b5e20)[_0xefa1('0x43')]()));}exports[_0xefa1('0x44')]=getCallerIdRandom;function decrementOriginate(_0x476460){if(_0x476460[_0xefa1('0x26')]&&_0x476460[_0xefa1('0x26')]>0x0){_0x476460['originated']-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xefa1('0x45')]=decrementOriginate;function checkContactEmpty(_0x247b3c){return _0x247b3c&&_0x247b3c[_0xefa1('0x46')]>0x0;}exports[_0xefa1('0x47')]=checkContactEmpty;function erlangb(_0x3042fe,_0x2a739a){if(_0x2a739a===0x0){return 0x0;}var _0x4c51e8=0x1;for(var _0x42e51e=0x1;_0x42e51e<=_0x2a739a;_0x42e51e+=0x1){_0x4c51e8=0x1+_0x4c51e8*_0x42e51e/_0x3042fe;}return 0x1/_0x4c51e8;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x3561d6,_0xe7f76c,_0x221591){if(_0xe7f76c>_0x221591){for(var _0x357b91=0x0;_0x357b91<_0xe7f76c-_0x221591;_0x357b91+=0x1){decrementOriginate(_0x3561d6);}}}exports[_0xefa1('0x48')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2f88af){var _0x17afe4={};var _0x5dae32=['id',_0xefa1('0x49'),'description',_0xefa1('0x4a'),'updatedAt'];if(_0x2f88af){for(var _0x4bbaf2 in _0x2f88af){if(typeof _0x2f88af[_0x4bbaf2]!==_0xefa1('0x4b')){if(!_['isNil'](_0x2f88af[_0x4bbaf2])&&!_0x5dae32[_0xefa1('0x33')](_0x4bbaf2)){_0x17afe4[util[_0xefa1('0x3c')](_0xefa1('0x4c'),'XMD-',_0x4bbaf2['toUpperCase']())]=_0x2f88af[_0x4bbaf2];}}}}return _0x17afe4;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e3371ef..4b0cb3f 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(_0x503a52,_0x5ac57e){var _0x3a8601=function(_0x17858a){while(--_0x17858a){_0x503a52['push'](_0x503a52['shift']());}};_0x3a8601(++_0x5ac57e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x5736b5,_0x49c801){var _0x384a50=function(_0x103266){while(--_0x103266){_0x5736b5['push'](_0x5736b5['shift']());}};_0x384a50(++_0x49c801);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 1d3feaf..5ca2d7f 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 _0xfc32=['Trunk\x20Reachable','format','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','stringify','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','bind','varset','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid'];(function(_0x48494d,_0x45dff8){var _0x4ee89=function(_0x414e1e){while(--_0x414e1e){_0x48494d['push'](_0x48494d['shift']());}};_0x4ee89(++_0x45dff8);}(_0xfc32,0x17a));var _0x2fc3=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xfc32[_0x88cd7b];return _0x56fcc8;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x2fc3('0x0'));var moment=require(_0x2fc3('0x1'));var path=require('path');var tiff2pdf=require(_0x2fc3('0x2'));var gs=require(_0x2fc3('0x3'));var logger=require(_0x2fc3('0x4'))(_0x2fc3('0x5'));var ami=require(_0x2fc3('0x6'));var rpcDb=require(_0x2fc3('0x7'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x2fc3('0x8'));var faxAccount=require(_0x2fc3('0x9'));var attachment=require(_0x2fc3('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5d8464){this[_0x2fc3('0xb')]={};this[_0x2fc3('0xc')]=_0x5d8464[_0x2fc3('0xc')];this['trunks']=_0x5d8464[_0x2fc3('0xd')];this[_0x2fc3('0xe')]={};ami['on']('newchannel',this['syncNewchannel'][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x10'),this['syncVarSet'][_0x2fc3('0xf')](this));ami['on']('newstate',this[_0x2fc3('0x11')][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x12'),this[_0x2fc3('0x13')][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x14'),this['syncFaxStatus'][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x15'),this[_0x2fc3('0x16')][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x17'),this[_0x2fc3('0x18')][_0x2fc3('0xf')](this));ami['on'](_0x2fc3('0x19'),this[_0x2fc3('0x1a')]['bind'](this));}Fax[_0x2fc3('0x1b')][_0x2fc3('0x1c')]=function(_0x347720){if(_0x347720[_0x2fc3('0x1d')]===_0x2fc3('0x1e')){for(var _0x237f96 in this[_0x2fc3('0xc')]){if(this[_0x2fc3('0xc')]['hasOwnProperty'](_0x237f96)){if(_0x347720['exten']===this[_0x2fc3('0xc')][_0x237f96][_0x2fc3('0x1f')]){this[_0x2fc3('0xb')][_0x347720[_0x2fc3('0x20')]]={};this[_0x2fc3('0xb')][_0x347720['uniqueid']]['channel']=_0x347720[_0x2fc3('0x21')];this['channels'][_0x347720[_0x2fc3('0x20')]]['id']=this[_0x2fc3('0xc')][_0x237f96]['id'];this['channels'][_0x347720['uniqueid']]['name']=this[_0x2fc3('0xc')][_0x237f96]['name'];logger[_0x2fc3('0x22')](_0x347720['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x347720[_0x2fc3('0x20')]]){this[_0x2fc3('0xb')][_0x347720[_0x2fc3('0x20')]]={};this[_0x2fc3('0xb')][_0x347720[_0x2fc3('0x20')]]['channel']=_0x347720[_0x2fc3('0x21')];logger['info'](_0x347720[_0x2fc3('0x20')],_0x2fc3('0x23'));}};Fax['prototype']['syncVarSet']=function(_0x1fc3be){if(this['channels'][_0x1fc3be['uniqueid']]){for(var _0x180ef4 in _0x1fc3be[_0x2fc3('0x24')]){if(_0x1fc3be['variable'][_0x2fc3('0x25')](_0x180ef4)){this[_0x2fc3('0xb')][_0x1fc3be[_0x2fc3('0x20')]][_0x180ef4]=_0x1fc3be[_0x2fc3('0x26')];}}}};Fax[_0x2fc3('0x1b')][_0x2fc3('0x11')]=function(_0x23505f){if(this['channels'][_0x23505f['uniqueid']]){this['channels'][_0x23505f[_0x2fc3('0x20')]]['channelstate']=_0x23505f[_0x2fc3('0x27')];this['channels'][_0x23505f[_0x2fc3('0x20')]]['channelstatedesc']=_0x23505f['channelstatedesc'];}};Fax[_0x2fc3('0x1b')][_0x2fc3('0x13')]=function(_0x337604){if(this['channels'][_0x337604[_0x2fc3('0x20')]]){for(var _0x5d7491 in _0x337604[_0x2fc3('0x24')]){if(_0x337604[_0x2fc3('0x24')][_0x2fc3('0x25')](_0x5d7491)){this[_0x2fc3('0xb')][_0x337604[_0x2fc3('0x20')]][_0x5d7491]=_0x337604[_0x2fc3('0x26')];}}}};Fax['prototype'][_0x2fc3('0x28')]=function(_0x464828){if(this[_0x2fc3('0xb')][_0x464828[_0x2fc3('0x20')]]){this[_0x2fc3('0xb')][_0x464828[_0x2fc3('0x20')]][_0x2fc3('0x29')]=_0x464828[_0x2fc3('0x29')];this[_0x2fc3('0xb')][_0x464828[_0x2fc3('0x20')]][_0x2fc3('0x2a')]=_0x464828['status'];this['channels'][_0x464828[_0x2fc3('0x20')]][_0x2fc3('0x1f')]=_0x464828['localstationid'];this[_0x2fc3('0xb')][_0x464828[_0x2fc3('0x20')]][_0x2fc3('0x2b')]=_0x464828[_0x2fc3('0x2b')];logger[_0x2fc3('0x22')](_0x464828[_0x2fc3('0x20')],'\x20syncFaxStatus\x20');}};Fax[_0x2fc3('0x1b')][_0x2fc3('0x16')]=function(_0x294069){var _0x4823be=this;if(this[_0x2fc3('0xb')][_0x294069[_0x2fc3('0x20')]]){var _0x3bb369=this[_0x2fc3('0xb')][_0x294069['uniqueid']]['id'];this[_0x2fc3('0xb')][_0x294069[_0x2fc3('0x20')]][_0x2fc3('0x2c')]=_0x294069[_0x2fc3('0x2c')];this[_0x2fc3('0xb')][_0x294069['uniqueid']]['pagestransferred']=_0x294069[_0x2fc3('0x2d')];this[_0x2fc3('0xb')][_0x294069['uniqueid']]['localstationid']=_0x294069['localstationid'];this[_0x2fc3('0xb')][_0x294069[_0x2fc3('0x20')]][_0x2fc3('0x2e')]=_0x294069[_0x2fc3('0x2e')];this[_0x2fc3('0xb')][_0x294069[_0x2fc3('0x20')]][_0x2fc3('0x2f')]=_0x294069['transferrate'];this[_0x2fc3('0xb')][_0x294069[_0x2fc3('0x20')]][_0x2fc3('0x2b')]=_0x294069[_0x2fc3('0x2b')];this['channels'][_0x294069[_0x2fc3('0x20')]][_0x2fc3('0x30')]=_0x294069['calleridnum'];if(this['channels'][_0x294069['uniqueid']][_0x2fc3('0x2d')]>0x0){tiff2pdf(_0x294069[_0x2fc3('0x2b')],_0x2fc3('0x31'),function(_0x3272e0){logger[_0x2fc3('0x22')](_0x294069[_0x2fc3('0x20')],_0x2fc3('0x32'),_0x3272e0[_0x2fc3('0x33')]);attachment[_0x2fc3('0x34')]({'name':path[_0x2fc3('0x35')](_0x294069[_0x2fc3('0x2b')])[_0x2fc3('0x36')],'basename':path['parse'](_0x294069[_0x2fc3('0x2b')])['name']+_0x2fc3('0x37'),'type':_0x2fc3('0x38')})[_0x2fc3('0x39')](function(_0x5180d2){faxAccount[_0x2fc3('0x3a')](_0x3bb369,{'from':_0x294069[_0x2fc3('0x30')],'mapKey':_0x2fc3('0x5'),'body':path['parse'](_0x294069[_0x2fc3('0x2b')])['name']+_0x2fc3('0x37'),'AttachmentId':_0x5180d2['id']})[_0x2fc3('0x3b')](function(_0x19a501){logger[_0x2fc3('0x3c')](_0x294069[_0x2fc3('0x20')],_0x2fc3('0x3d'),JSON['stringify'](_0x19a501));});})['catch'](function(_0x355857){logger[_0x2fc3('0x3c')](_0x294069[_0x2fc3('0x20')],_0x2fc3('0x3e'),JSON['stringify'](_0x355857));});});}logger[_0x2fc3('0x22')](_0x294069[_0x2fc3('0x20')],_0x2fc3('0x3e'));}};Fax[_0x2fc3('0x1b')][_0x2fc3('0x1a')]=function(_0x455620){if(this[_0x2fc3('0xe')][_0x455620['uniqueid']]){_[_0x2fc3('0x3f')](this[_0x2fc3('0xb')][_0x455620[_0x2fc3('0x20')]],_[_0x2fc3('0x40')](_0x455620,[_0x2fc3('0x41'),_0x2fc3('0x42')]));}};function updateStatus(_0xa31aa8){if(_0xa31aa8['AttachmentId']){faxMessage[_0x2fc3('0x43')](_0xa31aa8[_0x2fc3('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2fc3('0x39')](function(_0x1d41a2){ut[_0x2fc3('0x45')](_0x2fc3('0x46'),_0x1d41a2);})[_0x2fc3('0x3b')](function(_0x140aba){ut[_0x2fc3('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x140aba);});}else{ut[_0x2fc3('0x45')](_0x2fc3('0x47'));}}Fax[_0x2fc3('0x1b')]['updateStatus']=function(_0x28cacd,_0x3038a4,_0x43adb1){var _0x4660e2=this;var _0x1b9cbc={};if(_0x3038a4){_0x1b9cbc={'read':_0x3038a4};}else{_0x1b9cbc={'failMessage':_0x43adb1};}if(this['actions'][_0x28cacd][_0x2fc3('0x44')]){faxMessage['update'](this[_0x2fc3('0xe')][_0x28cacd][_0x2fc3('0x44')],_0x1b9cbc)['then'](function(_0x287c5c){ut[_0x2fc3('0x45')](_0x2fc3('0x48'),_0x287c5c);})['catch'](function(_0x4df723){ut[_0x2fc3('0x45')]('[Fax][Message][NoUpdate1]',_0x4df723);})[_0x2fc3('0x49')](function(){delete _0x4660e2[_0x2fc3('0xb')][_0x28cacd];delete _0x4660e2[_0x2fc3('0xe')][_0x28cacd];});}else{ut[_0x2fc3('0x45')](_0x2fc3('0x4a'));delete this['channels'][_0x28cacd];delete this[_0x2fc3('0xe')][_0x28cacd];}};Fax['prototype'][_0x2fc3('0x18')]=function(_0x5205f9){var _0x57ff04=this;if(this['channels'][_0x5205f9[_0x2fc3('0x20')]]){if(this['actions'][_0x5205f9[_0x2fc3('0x20')]]){this[_0x2fc3('0xb')][_0x5205f9[_0x2fc3('0x20')]]['id']=this['actions'][_0x5205f9[_0x2fc3('0x20')]]['id'];this['channels'][_0x5205f9[_0x2fc3('0x20')]]['name']=this[_0x2fc3('0xe')][_0x5205f9[_0x2fc3('0x20')]]['name'];}logger[_0x2fc3('0x22')](_0x5205f9[_0x2fc3('0x20')],this['actions'][_0x5205f9['uniqueid']]?_0x2fc3('0x4b'):_0x2fc3('0x4c'),JSON['stringify'](this[_0x2fc3('0xb')][_0x5205f9['uniqueid']]));if(this[_0x2fc3('0xe')][_0x5205f9[_0x2fc3('0x20')]]){if(this[_0x2fc3('0xb')][_0x5205f9['uniqueid']][_0x2fc3('0x4d')]>0x0&&this[_0x2fc3('0xb')][_0x5205f9[_0x2fc3('0x20')]][_0x2fc3('0x14')]===_0x2fc3('0x4e')){this['updateStatus'](_0x5205f9[_0x2fc3('0x20')],!![]);}else{this[_0x2fc3('0x4f')](_0x5205f9['uniqueid'],![],this[_0x2fc3('0xb')][_0x5205f9[_0x2fc3('0x20')]][_0x2fc3('0x50')]?_0x2fc3('0x51')+this['channels'][_0x5205f9[_0x2fc3('0x20')]]['faxstatusstring']:_0x2fc3('0x52'));}}}};Fax[_0x2fc3('0x1b')][_0x2fc3('0x53')]=function(_0x582b15){var _0x507c78=this;return new BPromise(function(_0x1fbcae,_0x3d332f){_0x507c78[_0x2fc3('0x54')](_0x582b15,_0x507c78[_0x2fc3('0xc')][_0x582b15[_0x2fc3('0x55')]])[_0x2fc3('0x39')](function(_0x6701f3){ut[_0x2fc3('0x45')](_0x2fc3('0x56'),_0x6701f3);_0x1fbcae(ut['message'](_0x2fc3('0x57')));})[_0x2fc3('0x3b')](function(_0x67e19a){ut[_0x2fc3('0x45')](_0x2fc3('0x58'),_0x67e19a);updateStatus(_0x582b15);_0x3d332f(ut[_0x2fc3('0x33')](_0x2fc3('0x59')));});});};Fax[_0x2fc3('0x1b')][_0x2fc3('0x5a')]=function(_0x57f8a4){var _0x121f2a=this;return new BPromise(function(_0xef03f9,_0x8401c){var _0x40286d=_0x121f2a[_0x2fc3('0x5b')](_0x121f2a['faxAccounts'][_0x57f8a4[_0x2fc3('0x55')]][_0x2fc3('0x5c')],_0x57f8a4);if(_0x40286d[_0x2fc3('0x5d')]){_0xef03f9(ut['message'](_0x2fc3('0x5e')));}else{_0x8401c(ut[_0x2fc3('0x33')](_0x40286d[_0x2fc3('0x33')]));}});};function originate(_0x45fa14,_0x244b72,_0x503db6){return new BPromise(function(_0xce8ef1,_0x30b4cb){if(_0x503db6){var _0x1dee05=util[_0x2fc3('0x5f')]('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['parse'](_0x45fa14[_0x2fc3('0x60')])['name'],_0x45fa14['path']);gs[_0x2fc3('0x61')](_0x1dee05)[_0x2fc3('0x39')](function(){_0x45fa14[_0x2fc3('0x60')]=util['format'](_0x2fc3('0x62'),path[_0x2fc3('0x35')](_0x45fa14[_0x2fc3('0x60')])[_0x2fc3('0x63')],path[_0x2fc3('0x35')](_0x45fa14['path'])[_0x2fc3('0x36')]);_0x244b72['XMF-PATH']=_0x45fa14['path'];ut[_0x2fc3('0x45')](_0x2fc3('0x64'),'');ami[_0x2fc3('0x65')](ut[_0x2fc3('0x66')](_0x45fa14,_0x244b72))['then'](function(_0x209d09){_0xce8ef1(_0x209d09);})[_0x2fc3('0x3b')](function(_0x139c70){_0x30b4cb(_0x139c70);});})[_0x2fc3('0x3b')](function(_0x5dd5f4){_0x30b4cb(_0x5dd5f4);});}else{ami['Action'](ut['variablesAction'](_0x45fa14,_0x244b72))[_0x2fc3('0x39')](function(_0x147487){_0xce8ef1(_0x147487);})['catch'](function(_0x2f75f7){_0x30b4cb(_0x2f75f7);});}});}Fax[_0x2fc3('0x1b')][_0x2fc3('0x54')]=function(_0x18a122,_0x18197d){var _0x5e8f08=this;return new BPromise(function(_0x4e5177,_0x4861ca){var _0x1ebf9e=uuid['v4']();var _0xb7e999=ut[_0x2fc3('0x67')](_0x18a122,_0x18197d);_0x5e8f08[_0x2fc3('0xe')][_0x1ebf9e]=new Action(_0x1ebf9e,_0x18197d,_0x18a122);var _0x1f6a2d=_0x5e8f08['actions'][_0x1ebf9e];if(path[_0x2fc3('0x35')](_0x18a122[_0x2fc3('0x60')])[_0x2fc3('0x68')]===_0x2fc3('0x37')){originate(_0x1f6a2d,_0xb7e999,!![])[_0x2fc3('0x39')](function(_0x3f6eea){_0x4e5177(_0x3f6eea);})[_0x2fc3('0x3b')](function(_0x4a3bb0){_0x4861ca(_0x4a3bb0);});}else{originate(_0x1f6a2d,_0xb7e999,![])[_0x2fc3('0x39')](function(_0x4cd3cc){_0x4e5177(_0x4cd3cc);})[_0x2fc3('0x3b')](function(_0x94fae1){_0x4861ca(_0x94fae1);});}});};Fax[_0x2fc3('0x1b')][_0x2fc3('0x69')]=function(_0x30c4c5){return!_['isNil'](_0x30c4c5)&&!_[_0x2fc3('0x6a')](_0x30c4c5[_0x2fc3('0x36')])&&!_['isNil'](_0x30c4c5[_0x2fc3('0x6b')])&&_0x30c4c5['active']&&!_[_0x2fc3('0x6a')](this[_0x2fc3('0xd')][util[_0x2fc3('0x5f')](_0x2fc3('0x6c'),_0x30c4c5[_0x2fc3('0x36')])])&&!_['isNil'](this[_0x2fc3('0xd')][util['format']('SIP/%s',_0x30c4c5[_0x2fc3('0x36')])][_0x2fc3('0x2a')])&&(this[_0x2fc3('0xd')][util['format']('SIP/%s',_0x30c4c5[_0x2fc3('0x36')])]['status']===_0x2fc3('0x6d')||this['trunks'][util[_0x2fc3('0x5f')](_0x2fc3('0x6c'),_0x30c4c5[_0x2fc3('0x36')])][_0x2fc3('0x2a')]===_0x2fc3('0x6e'));};Fax[_0x2fc3('0x1b')][_0x2fc3('0x5b')]=function(_0x19adcd,_0x4108af){if(!this[_0x2fc3('0x69')](_0x19adcd)){ut[_0x2fc3('0x45')](_0x2fc3('0x6f'),_['isNil'](_0x19adcd)?'':_0x19adcd[_0x2fc3('0x36')]+_0x2fc3('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x4108af[_0x2fc3('0x5')])){ut[_0x2fc3('0x45')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x2fc3('0x71')](_0x4108af));return{'isValid':![],'message':_0x2fc3('0x72')};}if(_[_0x2fc3('0x6a')](_0x4108af[_0x2fc3('0x60')])){ut[_0x2fc3('0x45')](_0x2fc3('0x73'),JSON[_0x2fc3('0x71')](_0x4108af));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x2fc3('0x74')};};module[_0x2fc3('0x75')]=Fax; \ No newline at end of file +var _0x06cf=['./util/gs','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','\x20result\x20conversion\x20file\x20','create','parse','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','message','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','util','lodash','bluebird','moment','path','tiff2pdf'];(function(_0x59ec7a,_0x1eb345){var _0x8535ed=function(_0x5bca0b){while(--_0x5bca0b){_0x59ec7a['push'](_0x59ec7a['shift']());}};_0x8535ed(++_0x1eb345);}(_0x06cf,0xda));var _0xf06c=function(_0x399884,_0x3f3433){_0x399884=_0x399884-0x0;var _0x29c025=_0x06cf[_0x399884];return _0x29c025;};'use strict';var util=require(_0xf06c('0x0'));var _=require(_0xf06c('0x1'));var BPromise=require(_0xf06c('0x2'));var uuid=require('uuid');var moment=require(_0xf06c('0x3'));var path=require(_0xf06c('0x4'));var tiff2pdf=require(_0xf06c('0x5'));var gs=require(_0xf06c('0x6'));var logger=require(_0xf06c('0x7'))(_0xf06c('0x8'));var ami=require('../ami');var rpcDb=require(_0xf06c('0x9'));var Channel=require(_0xf06c('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xf06c('0xb'));var attachment=require(_0xf06c('0xc'));var faxMessage=require(_0xf06c('0xd'));function Fax(_0x27905e){this['channels']={};this[_0xf06c('0xe')]=_0x27905e['faxAccounts'];this[_0xf06c('0xf')]=_0x27905e[_0xf06c('0xf')];this[_0xf06c('0x10')]={};ami['on']('newchannel',this[_0xf06c('0x11')]['bind'](this));ami['on']('varset',this[_0xf06c('0x12')][_0xf06c('0x13')](this));ami['on'](_0xf06c('0x14'),this[_0xf06c('0x15')]['bind'](this));ami['on'](_0xf06c('0x16'),this['syncNewExten'][_0xf06c('0x13')](this));ami['on'](_0xf06c('0x17'),this[_0xf06c('0x18')][_0xf06c('0x13')](this));ami['on']('receivefax',this[_0xf06c('0x19')]['bind'](this));ami['on'](_0xf06c('0x1a'),this[_0xf06c('0x1b')][_0xf06c('0x13')](this));ami['on'](_0xf06c('0x1c'),this[_0xf06c('0x1d')][_0xf06c('0x13')](this));}Fax[_0xf06c('0x1e')]['syncNewchannel']=function(_0x58c99c){if(_0x58c99c[_0xf06c('0x1f')]==='from-voip-provider'){for(var _0x3220bf in this[_0xf06c('0xe')]){if(this['faxAccounts'][_0xf06c('0x20')](_0x3220bf)){if(_0x58c99c[_0xf06c('0x21')]===this['faxAccounts'][_0x3220bf]['localstationid']){this[_0xf06c('0x22')][_0x58c99c[_0xf06c('0x23')]]={};this[_0xf06c('0x22')][_0x58c99c[_0xf06c('0x23')]][_0xf06c('0x24')]=_0x58c99c['channel'];this[_0xf06c('0x22')][_0x58c99c[_0xf06c('0x23')]]['id']=this[_0xf06c('0xe')][_0x3220bf]['id'];this[_0xf06c('0x22')][_0x58c99c['uniqueid']][_0xf06c('0x25')]=this[_0xf06c('0xe')][_0x3220bf]['name'];logger[_0xf06c('0x26')](_0x58c99c[_0xf06c('0x23')],_0xf06c('0x27'));}}}}if(this[_0xf06c('0x10')][_0x58c99c['uniqueid']]){this[_0xf06c('0x22')][_0x58c99c[_0xf06c('0x23')]]={};this[_0xf06c('0x22')][_0x58c99c[_0xf06c('0x23')]][_0xf06c('0x24')]=_0x58c99c['channel'];logger['info'](_0x58c99c['uniqueid'],_0xf06c('0x27'));}};Fax['prototype']['syncVarSet']=function(_0x5813fe){if(this[_0xf06c('0x22')][_0x5813fe[_0xf06c('0x23')]]){for(var _0x419707 in _0x5813fe[_0xf06c('0x28')]){if(_0x5813fe[_0xf06c('0x28')][_0xf06c('0x20')](_0x419707)){this[_0xf06c('0x22')][_0x5813fe[_0xf06c('0x23')]][_0x419707]=_0x5813fe[_0xf06c('0x29')];}}}};Fax[_0xf06c('0x1e')][_0xf06c('0x15')]=function(_0x4ec089){if(this[_0xf06c('0x22')][_0x4ec089[_0xf06c('0x23')]]){this[_0xf06c('0x22')][_0x4ec089[_0xf06c('0x23')]][_0xf06c('0x2a')]=_0x4ec089[_0xf06c('0x2a')];this[_0xf06c('0x22')][_0x4ec089[_0xf06c('0x23')]][_0xf06c('0x2b')]=_0x4ec089['channelstatedesc'];}};Fax[_0xf06c('0x1e')]['syncNewExten']=function(_0x12c440){if(this[_0xf06c('0x22')][_0x12c440['uniqueid']]){for(var _0x4c15c8 in _0x12c440[_0xf06c('0x28')]){if(_0x12c440[_0xf06c('0x28')][_0xf06c('0x20')](_0x4c15c8)){this['channels'][_0x12c440[_0xf06c('0x23')]][_0x4c15c8]=_0x12c440[_0xf06c('0x29')];}}}};Fax[_0xf06c('0x1e')][_0xf06c('0x18')]=function(_0xbde4c){if(this[_0xf06c('0x22')][_0xbde4c[_0xf06c('0x23')]]){this['channels'][_0xbde4c[_0xf06c('0x23')]][_0xf06c('0x2c')]=_0xbde4c[_0xf06c('0x2c')];this[_0xf06c('0x22')][_0xbde4c[_0xf06c('0x23')]][_0xf06c('0x2d')]=_0xbde4c[_0xf06c('0x2d')];this['channels'][_0xbde4c[_0xf06c('0x23')]][_0xf06c('0x2e')]=_0xbde4c[_0xf06c('0x2e')];this[_0xf06c('0x22')][_0xbde4c[_0xf06c('0x23')]]['filename']=_0xbde4c[_0xf06c('0x2f')];logger[_0xf06c('0x26')](_0xbde4c['uniqueid'],_0xf06c('0x30'));}};Fax[_0xf06c('0x1e')][_0xf06c('0x19')]=function(_0x2c6014){var _0x56467d=this;if(this['channels'][_0x2c6014[_0xf06c('0x23')]]){var _0x3fecd3=this[_0xf06c('0x22')][_0x2c6014[_0xf06c('0x23')]]['id'];this[_0xf06c('0x22')][_0x2c6014['uniqueid']][_0xf06c('0x31')]=_0x2c6014['remotestationid'];this[_0xf06c('0x22')][_0x2c6014[_0xf06c('0x23')]]['pagestransferred']=_0x2c6014['pagestransferred'];this[_0xf06c('0x22')][_0x2c6014[_0xf06c('0x23')]][_0xf06c('0x2e')]=_0x2c6014[_0xf06c('0x2e')];this[_0xf06c('0x22')][_0x2c6014['uniqueid']][_0xf06c('0x32')]=_0x2c6014['resolution'];this['channels'][_0x2c6014['uniqueid']][_0xf06c('0x33')]=_0x2c6014[_0xf06c('0x33')];this[_0xf06c('0x22')][_0x2c6014['uniqueid']][_0xf06c('0x2f')]=_0x2c6014[_0xf06c('0x2f')];this[_0xf06c('0x22')][_0x2c6014['uniqueid']][_0xf06c('0x34')]=_0x2c6014[_0xf06c('0x34')];if(this[_0xf06c('0x22')][_0x2c6014['uniqueid']][_0xf06c('0x35')]>0x0){tiff2pdf(_0x2c6014[_0xf06c('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x5c417e){logger['info'](_0x2c6014[_0xf06c('0x23')],_0xf06c('0x36'),_0x5c417e['message']);attachment[_0xf06c('0x37')]({'name':path[_0xf06c('0x38')](_0x2c6014[_0xf06c('0x2f')])[_0xf06c('0x25')],'basename':path['parse'](_0x2c6014[_0xf06c('0x2f')])[_0xf06c('0x25')]+'.pdf','type':'application/pdf'})[_0xf06c('0x39')](function(_0xd956e5){faxAccount[_0xf06c('0x3a')](_0x3fecd3,{'from':_0x2c6014[_0xf06c('0x34')],'mapKey':'fax','body':path[_0xf06c('0x38')](_0x2c6014['filename'])[_0xf06c('0x25')]+_0xf06c('0x3b'),'AttachmentId':_0xd956e5['id']})[_0xf06c('0x3c')](function(_0x352857){logger[_0xf06c('0x3d')](_0x2c6014['uniqueid'],_0xf06c('0x3e'),JSON[_0xf06c('0x3f')](_0x352857));});})['catch'](function(_0x5e75fc){logger[_0xf06c('0x3d')](_0x2c6014['uniqueid'],_0xf06c('0x40'),JSON['stringify'](_0x5e75fc));});});}logger[_0xf06c('0x26')](_0x2c6014[_0xf06c('0x23')],_0xf06c('0x40'));}};Fax[_0xf06c('0x1e')][_0xf06c('0x1d')]=function(_0x191e88){if(this['actions'][_0x191e88['uniqueid']]){_[_0xf06c('0x41')](this['channels'][_0x191e88[_0xf06c('0x23')]],_[_0xf06c('0x42')](_0x191e88,['response',_0xf06c('0x43')]));}};function updateStatus(_0x48001c){if(_0x48001c[_0xf06c('0x44')]){faxMessage[_0xf06c('0x45')](_0x48001c[_0xf06c('0x44')],{'failMessage':_0xf06c('0x46')})[_0xf06c('0x39')](function(_0x11f57b){ut[_0xf06c('0x47')](_0xf06c('0x48'),_0x11f57b);})[_0xf06c('0x3c')](function(_0x30a492){ut[_0xf06c('0x47')](_0xf06c('0x49'),_0x30a492);});}else{ut['logger'](_0xf06c('0x4a'));}}Fax[_0xf06c('0x1e')]['updateStatus']=function(_0x3148a1,_0x875aac,_0x3b157f){var _0x1049c8=this;var _0x2da1b0={};if(_0x875aac){_0x2da1b0={'read':_0x875aac};}else{_0x2da1b0={'failMessage':_0x3b157f};}if(this[_0xf06c('0x10')][_0x3148a1]['AttachmentId']){faxMessage[_0xf06c('0x45')](this['actions'][_0x3148a1][_0xf06c('0x44')],_0x2da1b0)['then'](function(_0x762af1){ut[_0xf06c('0x47')](_0xf06c('0x4b'),_0x762af1);})[_0xf06c('0x3c')](function(_0x2e4b8b){ut[_0xf06c('0x47')]('[Fax][Message][NoUpdate1]',_0x2e4b8b);})['finally'](function(){delete _0x1049c8[_0xf06c('0x22')][_0x3148a1];delete _0x1049c8[_0xf06c('0x10')][_0x3148a1];});}else{ut[_0xf06c('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0xf06c('0x22')][_0x3148a1];delete this[_0xf06c('0x10')][_0x3148a1];}};Fax[_0xf06c('0x1e')][_0xf06c('0x1b')]=function(_0x165d78){var _0x5a7a38=this;if(this[_0xf06c('0x22')][_0x165d78[_0xf06c('0x23')]]){if(this[_0xf06c('0x10')][_0x165d78['uniqueid']]){this[_0xf06c('0x22')][_0x165d78[_0xf06c('0x23')]]['id']=this[_0xf06c('0x10')][_0x165d78[_0xf06c('0x23')]]['id'];this[_0xf06c('0x22')][_0x165d78['uniqueid']][_0xf06c('0x25')]=this[_0xf06c('0x10')][_0x165d78[_0xf06c('0x23')]][_0xf06c('0x25')];}logger[_0xf06c('0x26')](_0x165d78[_0xf06c('0x23')],this[_0xf06c('0x10')][_0x165d78[_0xf06c('0x23')]]?_0xf06c('0x4c'):_0xf06c('0x4d'),JSON['stringify'](this[_0xf06c('0x22')][_0x165d78[_0xf06c('0x23')]]));if(this[_0xf06c('0x10')][_0x165d78[_0xf06c('0x23')]]){if(this[_0xf06c('0x22')][_0x165d78[_0xf06c('0x23')]][_0xf06c('0x4e')]>0x0&&this[_0xf06c('0x22')][_0x165d78['uniqueid']][_0xf06c('0x17')]===_0xf06c('0x4f')){this[_0xf06c('0x50')](_0x165d78['uniqueid'],!![]);}else{this[_0xf06c('0x50')](_0x165d78[_0xf06c('0x23')],![],this[_0xf06c('0x22')][_0x165d78[_0xf06c('0x23')]][_0xf06c('0x51')]?_0xf06c('0x52')+this[_0xf06c('0x22')][_0x165d78['uniqueid']][_0xf06c('0x51')]:_0xf06c('0x53'));}}}};Fax[_0xf06c('0x1e')][_0xf06c('0x54')]=function(_0x4e905a){var _0x41cad3=this;return new BPromise(function(_0x43dd70,_0x2e63f5){_0x41cad3[_0xf06c('0x55')](_0x4e905a,_0x41cad3[_0xf06c('0xe')][_0x4e905a['FaxAccountId']])[_0xf06c('0x39')](function(_0x4839d4){ut['logger']('[Fax][execOriginate][success]',_0x4839d4);_0x43dd70(ut[_0xf06c('0x56')]('Fax\x20received'));})[_0xf06c('0x3c')](function(_0x36ce6f){ut[_0xf06c('0x47')]('[Fax][execOriginate][failure]',_0x36ce6f);updateStatus(_0x4e905a);_0x2e63f5(ut['message'](_0xf06c('0x57')));});});};Fax['prototype'][_0xf06c('0x58')]=function(_0x567252){var _0x4279de=this;return new BPromise(function(_0x1d8a7b,_0x1b5174){var _0x3a03ef=_0x4279de[_0xf06c('0x59')](_0x4279de[_0xf06c('0xe')][_0x567252['FaxAccountId']][_0xf06c('0x5a')],_0x567252);if(_0x3a03ef['isValid']){_0x1d8a7b(ut[_0xf06c('0x56')]('Trunk\x20Reachable'));}else{_0x1b5174(ut['message'](_0x3a03ef[_0xf06c('0x56')]));}});};function originate(_0x4a86fb,_0x219ef7,_0x3538a1){return new BPromise(function(_0x42ffce,_0x95b3fb){if(_0x3538a1){var _0x3bb548=util[_0xf06c('0x5b')]('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['parse'](_0x4a86fb[_0xf06c('0x4')])[_0xf06c('0x25')],_0x4a86fb['path']);gs[_0xf06c('0x5c')](_0x3bb548)[_0xf06c('0x39')](function(){_0x4a86fb['path']=util[_0xf06c('0x5b')](_0xf06c('0x5d'),path['parse'](_0x4a86fb['path'])[_0xf06c('0x5e')],path[_0xf06c('0x38')](_0x4a86fb[_0xf06c('0x4')])[_0xf06c('0x25')]);_0x219ef7[_0xf06c('0x5f')]=_0x4a86fb[_0xf06c('0x4')];ut[_0xf06c('0x47')](_0xf06c('0x60'),'');ami[_0xf06c('0x61')](ut[_0xf06c('0x62')](_0x4a86fb,_0x219ef7))['then'](function(_0x562afc){_0x42ffce(_0x562afc);})[_0xf06c('0x3c')](function(_0x244486){_0x95b3fb(_0x244486);});})['catch'](function(_0x308fdf){_0x95b3fb(_0x308fdf);});}else{ami[_0xf06c('0x61')](ut[_0xf06c('0x62')](_0x4a86fb,_0x219ef7))['then'](function(_0x530117){_0x42ffce(_0x530117);})[_0xf06c('0x3c')](function(_0x572031){_0x95b3fb(_0x572031);});}});}Fax['prototype']['execOriginate']=function(_0x2fab6a,_0x388675){var _0x3befa9=this;return new BPromise(function(_0x1d751d,_0x29408f){var _0x170129=uuid['v4']();var _0x1b62e2=ut[_0xf06c('0x63')](_0x2fab6a,_0x388675);_0x3befa9[_0xf06c('0x10')][_0x170129]=new Action(_0x170129,_0x388675,_0x2fab6a);var _0x3a0e70=_0x3befa9[_0xf06c('0x10')][_0x170129];if(path[_0xf06c('0x38')](_0x2fab6a[_0xf06c('0x4')])['ext']==='.pdf'){originate(_0x3a0e70,_0x1b62e2,!![])['then'](function(_0x58de64){_0x1d751d(_0x58de64);})[_0xf06c('0x3c')](function(_0x4a9457){_0x29408f(_0x4a9457);});}else{originate(_0x3a0e70,_0x1b62e2,![])['then'](function(_0x5ed126){_0x1d751d(_0x5ed126);})[_0xf06c('0x3c')](function(_0x559356){_0x29408f(_0x559356);});}});};Fax[_0xf06c('0x1e')][_0xf06c('0x64')]=function(_0x188666){return!_[_0xf06c('0x65')](_0x188666)&&!_['isNil'](_0x188666[_0xf06c('0x25')])&&!_[_0xf06c('0x65')](_0x188666[_0xf06c('0x66')])&&_0x188666[_0xf06c('0x66')]&&!_[_0xf06c('0x65')](this['trunks'][util['format'](_0xf06c('0x67'),_0x188666[_0xf06c('0x25')])])&&!_[_0xf06c('0x65')](this[_0xf06c('0xf')][util[_0xf06c('0x5b')](_0xf06c('0x67'),_0x188666[_0xf06c('0x25')])][_0xf06c('0x2d')])&&(this[_0xf06c('0xf')][util[_0xf06c('0x5b')]('SIP/%s',_0x188666['name'])][_0xf06c('0x2d')]===_0xf06c('0x68')||this[_0xf06c('0xf')][util[_0xf06c('0x5b')]('SIP/%s',_0x188666[_0xf06c('0x25')])]['status']===_0xf06c('0x69'));};Fax['prototype'][_0xf06c('0x59')]=function(_0x4bdb54,_0x34ae2f){if(!this[_0xf06c('0x64')](_0x4bdb54)){ut['logger'](_0xf06c('0x6a'),_['isNil'](_0x4bdb54)?'':_0x4bdb54[_0xf06c('0x25')]+_0xf06c('0x6b'));return{'isValid':![],'message':_0xf06c('0x6c')};}if(_[_0xf06c('0x65')](_0x34ae2f[_0xf06c('0x8')])){ut[_0xf06c('0x47')](_0xf06c('0x6d'),JSON[_0xf06c('0x3f')](_0x34ae2f));return{'isValid':![],'message':_0xf06c('0x6e')};}if(_['isNil'](_0x34ae2f[_0xf06c('0x4')])){ut[_0xf06c('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xf06c('0x3f')](_0x34ae2f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xf06c('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 438bcf5..853c029 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 _0xc1b1=['then','catch','[Notify]\x20','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xc1b1,0xed));var _0x1c1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1b1[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0x1c1b('0x0'));var faxAccount=require(_0x1c1b('0x1'));function loggerCatch(_0x2d9203){return function(_0x23330e){logger[_0x1c1b('0x2')](_0x2d9203,util[_0x1c1b('0x3')](_0x23330e,{'showHidden':![],'depth':null}));};}exports[_0x1c1b('0x4')]=function(_0x51a83b,_0x43ab50){return BPromise[_0x1c1b('0x5')]()[_0x1c1b('0x6')](faxAccount[_0x1c1b('0x4')](_0x51a83b,_0x43ab50))[_0x1c1b('0x7')](loggerCatch(_0x1c1b('0x8')));}; \ No newline at end of file +var _0x0c27=['error','inspect','notify','resolve','then','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x491fd8,_0x3fd5fa){var _0x4e27d2=function(_0x2e438e){while(--_0x2e438e){_0x491fd8['push'](_0x491fd8['shift']());}};_0x4e27d2(++_0x3fd5fa);}(_0x0c27,0xe1));var _0x70c2=function(_0x372333,_0x4abfdb){_0x372333=_0x372333-0x0;var _0x3e64c2=_0x0c27[_0x372333];return _0x3e64c2;};'use strict';var util=require(_0x70c2('0x0'));var BPromise=require(_0x70c2('0x1'));var logger=require(_0x70c2('0x2'))(_0x70c2('0x3'));var _=require(_0x70c2('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x393d66){return function(_0x4d8964){logger[_0x70c2('0x5')](_0x393d66,util[_0x70c2('0x6')](_0x4d8964,{'showHidden':![],'depth':null}));};}exports[_0x70c2('0x7')]=function(_0x254bad,_0xc23075){return BPromise[_0x70c2('0x8')]()[_0x70c2('0x9')](faxAccount['notify'](_0x254bad,_0xc23075))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 8753981..d2b5493 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 _0x1fac=['../../../../config/logger','fax','bluebird','child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util'];(function(_0x2161e,_0x30f769){var _0x377e75=function(_0x46b708){while(--_0x46b708){_0x2161e['push'](_0x2161e['shift']());}};_0x377e75(++_0x30f769);}(_0x1fac,0xc7));var _0xc1fa=function(_0x23f9d6,_0x487c25){_0x23f9d6=_0x23f9d6-0x0;var _0x41a279=_0x1fac[_0x23f9d6];return _0x41a279;};'use strict';var util=require(_0xc1fa('0x0'));var logger=require(_0xc1fa('0x1'))(_0xc1fa('0x2'));var BPromise=require(_0xc1fa('0x3'));var exec=require(_0xc1fa('0x4'))[_0xc1fa('0x5')];exports['execute']=function(_0x151cc1){return new BPromise(function(_0x4b46f1,_0x4f14b8){exec(_0x151cc1,function(_0x1040e0,_0x4412d8,_0x43d09f){logger['info'](_0xc1fa('0x6'),_0x4412d8);if(_0x1040e0){logger[_0xc1fa('0x7')](_0xc1fa('0x6'),_0xc1fa('0x8'),util[_0xc1fa('0x9')](_0x1040e0,{'showHidden':![],'depth':null}),_0x4412d8,_0x43d09f);_0x4f14b8(_0x1040e0);}_0x4b46f1(_0x4412d8);});});}; \ No newline at end of file +var _0x06fa=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','execute','info'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x06fa,0x1aa));var _0xa06f=function(_0x5a3483,_0x2712b6){_0x5a3483=_0x5a3483-0x0;var _0x325874=_0x06fa[_0x5a3483];return _0x325874;};'use strict';var util=require(_0xa06f('0x0'));var logger=require(_0xa06f('0x1'))(_0xa06f('0x2'));var BPromise=require('bluebird');var exec=require(_0xa06f('0x3'))['exec'];exports[_0xa06f('0x4')]=function(_0x3c05d3){return new BPromise(function(_0x20618b,_0x2e9d8e){exec(_0x3c05d3,function(_0x119127,_0x5f3a74,_0x159d4f){logger[_0xa06f('0x5')]('Exec\x20gs',_0x5f3a74);if(_0x119127){logger[_0xa06f('0x5')]('Exec\x20gs',_0xa06f('0x6'),util[_0xa06f('0x7')](_0x119127,{'showHidden':![],'depth':null}),_0x5f3a74,_0x159d4f);_0x2e9d8e(_0x119127);}_0x20618b(_0x5f3a74);});});}; \ 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 5e36b63..d3dd2d8 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 _0xfff8=['channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','fax','message','logger','info','inspect','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','localstationid','path','variablesAction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfff8,0x175));var _0x8fff=function(_0x1c5009,_0x1d65cb){_0x1c5009=_0x1c5009-0x0;var _0xe1ad0b=_0xfff8[_0x1c5009];return _0xe1ad0b;};'use strict';var util=require(_0x8fff('0x0'));var _=require(_0x8fff('0x1'));var moment=require(_0x8fff('0x2'));var logger=require('../../../../config/logger')(_0x8fff('0x3'));exports[_0x8fff('0x4')]=function(_0x3ae0f9){return{'message':_0x3ae0f9};};exports[_0x8fff('0x5')]=function(_0x48740e,_0x11f150){logger[_0x8fff('0x6')](_0x48740e,util[_0x8fff('0x7')](_0x11f150,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x549828,_0x396018){var _0x318884={'XMF-ECM':_0x396018['ecm'],'XMF-HEADERINFO':_0x396018[_0x8fff('0x8')],'XMF-MINRATE':_0x396018[_0x8fff('0x9')],'XMF-MAXRATE':_0x396018[_0x8fff('0xa')],'XMF-MODEM':util[_0x8fff('0xb')]('\x22%s\x22',_0x396018[_0x8fff('0xc')]),'XMF-GATEWAY':_0x396018['gateway'],'XMF-FAXDETECT':_0x396018[_0x8fff('0xd')],'XMF-T38TIMEOUT':_0x396018[_0x8fff('0xe')],'XMF-LOCALSTATIONID':_0x396018[_0x8fff('0xf')],'XMF-PATH':_0x549828[_0x8fff('0x10')]};return _0x318884;};exports[_0x8fff('0x11')]=function(_0x1eba42,_0x1aed6e){return{'actionid':_0x1eba42['uniqueid'],'action':'originate','channel':_0x1eba42[_0x8fff('0x12')],'Exten':_0x8fff('0x13'),'Context':_0x8fff('0x14'),'Priority':'1','callerid':util[_0x8fff('0xb')](_0x8fff('0x15'),_0x1eba42[_0x8fff('0x8')]?_0x1eba42[_0x8fff('0x8')]:'',_0x1eba42[_0x8fff('0xf')]),'variable':_0x1aed6e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1eba42[_0x8fff('0x16')]};}; \ No newline at end of file +var _0xba1c=['util','lodash','moment','fax','message','logger','addVariables','headerinfo','minrate','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','uniqueid'];(function(_0x2b7442,_0x561591){var _0x56e035=function(_0x42e09d){while(--_0x42e09d){_0x2b7442['push'](_0x2b7442['shift']());}};_0x56e035(++_0x561591);}(_0xba1c,0xab));var _0xcba1=function(_0x4b0faf,_0x160e5d){_0x4b0faf=_0x4b0faf-0x0;var _0x5e4b74=_0xba1c[_0x4b0faf];return _0x5e4b74;};'use strict';var util=require(_0xcba1('0x0'));var _=require(_0xcba1('0x1'));var moment=require(_0xcba1('0x2'));var logger=require('../../../../config/logger')(_0xcba1('0x3'));exports[_0xcba1('0x4')]=function(_0x30e4c8){return{'message':_0x30e4c8};};exports[_0xcba1('0x5')]=function(_0x517011,_0x438727){logger['info'](_0x517011,util['inspect'](_0x438727,{'showHidden':![],'depth':null}));};exports[_0xcba1('0x6')]=function(_0x1b202c,_0x30ed49){var _0x503cf4={'XMF-ECM':_0x30ed49['ecm'],'XMF-HEADERINFO':_0x30ed49[_0xcba1('0x7')],'XMF-MINRATE':_0x30ed49[_0xcba1('0x8')],'XMF-MAXRATE':_0x30ed49['maxrate'],'XMF-MODEM':util['format'](_0xcba1('0x9'),_0x30ed49[_0xcba1('0xa')]),'XMF-GATEWAY':_0x30ed49['gateway'],'XMF-FAXDETECT':_0x30ed49['faxdetect'],'XMF-T38TIMEOUT':_0x30ed49[_0xcba1('0xb')],'XMF-LOCALSTATIONID':_0x30ed49[_0xcba1('0xc')],'XMF-PATH':_0x1b202c[_0xcba1('0xd')]};return _0x503cf4;};exports[_0xcba1('0xe')]=function(_0x406db1,_0x42208a){return{'actionid':_0x406db1['uniqueid'],'action':_0xcba1('0xf'),'channel':_0x406db1[_0xcba1('0x10')],'Exten':'xcally-motion-fax','Context':_0xcba1('0x11'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x406db1[_0xcba1('0x7')]?_0x406db1['headerinfo']:'',_0x406db1['localstationid']),'variable':_0x42208a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x406db1[_0xcba1('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 641a086..e6387b1 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 _0xcb98=['./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','sync','[index.js][main]','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xcb98,0x7f));var _0x8cb9=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xcb98[_0x34bc30];return _0x5706de;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0x8cb9('0x0'));var Realtime=require(_0x8cb9('0x1'));var Report=require(_0x8cb9('0x2'));var Acw=require(_0x8cb9('0x3'));var Trigger=require(_0x8cb9('0x4'));var Dialer=require(_0x8cb9('0x5'));var Preview=require(_0x8cb9('0x6'));var Fax=require(_0x8cb9('0x7'));var user=require(_0x8cb9('0x8'));var voiceQueue=require(_0x8cb9('0x9'));var voiceQueueReport=require(_0x8cb9('0xa'));var voiceCallReport=require(_0x8cb9('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x8cb9('0xc'));var template=require(_0x8cb9('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x8cb9('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x8cb9('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8cb9('0x10'));var sugarcrm=require(_0x8cb9('0x11'));var freshdesk=require(_0x8cb9('0x12'));var desk=require(_0x8cb9('0x13'));var zoho=require(_0x8cb9('0x14'));var vtiger=require(_0x8cb9('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x8cb9('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x8cb9('0x17'))(_0x8cb9('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8cb9('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8cb9('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x8cb9('0x1b')]()[_0x8cb9('0x1c')](user[_0x8cb9('0x1d')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x1e')]())[_0x8cb9('0x1c')](user[_0x8cb9('0x1f')]())['then'](realtime[_0x8cb9('0x20')]())[_0x8cb9('0x1c')](trunk[_0x8cb9('0x21')]())['then'](realtime['initTrunks']())[_0x8cb9('0x1c')](voiceQueue[_0x8cb9('0x22')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x23')]())[_0x8cb9('0x1c')](trigger[_0x8cb9('0x24')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x25')]())[_0x8cb9('0x1c')](template[_0x8cb9('0x26')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x27')]())[_0x8cb9('0x1c')](zendesk[_0x8cb9('0x28')]())[_0x8cb9('0x1c')](realtime['initZendeskAccounts']())[_0x8cb9('0x1c')](salesforce[_0x8cb9('0x29')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x2a')]())[_0x8cb9('0x1c')](sugarcrm[_0x8cb9('0x2b')]())['then'](realtime[_0x8cb9('0x2c')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x8cb9('0x2d')]())[_0x8cb9('0x1c')](desk[_0x8cb9('0x2e')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x2f')]())[_0x8cb9('0x1c')](zoho[_0x8cb9('0x30')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x31')]())['then'](vtiger[_0x8cb9('0x32')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x33')]())[_0x8cb9('0x1c')](freshsales[_0x8cb9('0x34')]())[_0x8cb9('0x1c')](realtime['initFreshsalesAccounts']())[_0x8cb9('0x1c')](servicenow[_0x8cb9('0x35')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x36')]())[_0x8cb9('0x1c')](dynamics365[_0x8cb9('0x37')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x38')]())[_0x8cb9('0x1c')](campaign[_0x8cb9('0x39')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x3a')]())[_0x8cb9('0x1c')](voiceExtension[_0x8cb9('0x3b')]())[_0x8cb9('0x1c')](realtime['initVoiceExtensions']())[_0x8cb9('0x1c')](faxAccount[_0x8cb9('0x3c')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x3d')]())[_0x8cb9('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x8cb9('0x1b')]()[_0x8cb9('0x1c')](voiceQueueReport[_0x8cb9('0x3e')]())[_0x8cb9('0x1c')](realtime[_0x8cb9('0x3f')]())[_0x8cb9('0x1c')](cmHopperHistory[_0x8cb9('0x40')]())[_0x8cb9('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x8cb9('0x1c')](cmHopperHistory[_0x8cb9('0x41')]())['then'](realtime[_0x8cb9('0x42')]())['then'](voiceCallReport[_0x8cb9('0x43')]())['then'](realtime[_0x8cb9('0x44')]())[_0x8cb9('0x45')](function(_0x15b210){logger[_0x8cb9('0x46')]('[index.js][initParams]',util[_0x8cb9('0x47')](_0x15b210,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x8cb9('0x1c')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x8cb9('0x1c')](function(){report[_0x8cb9('0x48')]();setInterval(initRealtime,0x1388);})[_0x8cb9('0x45')](function(_0x541ad7){logger[_0x8cb9('0x46')](_0x8cb9('0x49'),util['inspect'](_0x541ad7,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8143=['./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw'];(function(_0x327383,_0x546979){var _0x22aed8=function(_0x44d464){while(--_0x44d464){_0x327383['push'](_0x327383['shift']());}};_0x22aed8(++_0x546979);}(_0x8143,0x86));var _0x3814=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8143[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x3814('0x0'));var moment=require(_0x3814('0x1'));var server=require(_0x3814('0x2'));var Realtime=require(_0x3814('0x3'));var Report=require(_0x3814('0x4'));var Acw=require(_0x3814('0x5'));var Trigger=require(_0x3814('0x6'));var Dialer=require('./dialer');var Preview=require(_0x3814('0x7'));var Fax=require(_0x3814('0x8'));var user=require(_0x3814('0x9'));var voiceQueue=require(_0x3814('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x3814('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x3814('0xc'));var template=require(_0x3814('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x3814('0xe'));var voiceExtension=require(_0x3814('0xf'));var faxAccount=require(_0x3814('0x10'));var zendesk=require(_0x3814('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x3814('0x12'));var zoho=require(_0x3814('0x13'));var vtiger=require(_0x3814('0x14'));var freshsales=require(_0x3814('0x15'));var servicenow=require(_0x3814('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(_0x3814('0x17'))(_0x3814('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x3814('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3814('0x1a')](_0x3814('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3814('0x1b')]()[_0x3814('0x1c')](user[_0x3814('0x1d')]())[_0x3814('0x1c')](realtime['initAgents']())[_0x3814('0x1c')](user[_0x3814('0x1e')]())[_0x3814('0x1c')](realtime[_0x3814('0x1f')]())[_0x3814('0x1c')](trunk[_0x3814('0x20')]())[_0x3814('0x1c')](realtime[_0x3814('0x21')]())['then'](voiceQueue['getVoiceQueues']())[_0x3814('0x1c')](realtime[_0x3814('0x22')]())[_0x3814('0x1c')](trigger[_0x3814('0x23')]())[_0x3814('0x1c')](realtime[_0x3814('0x24')]())['then'](template[_0x3814('0x25')]())[_0x3814('0x1c')](realtime['initTemplates']())[_0x3814('0x1c')](zendesk['getZendeskAccounts']())[_0x3814('0x1c')](realtime[_0x3814('0x26')]())[_0x3814('0x1c')](salesforce[_0x3814('0x27')]())['then'](realtime[_0x3814('0x28')]())['then'](sugarcrm[_0x3814('0x29')]())['then'](realtime[_0x3814('0x2a')]())[_0x3814('0x1c')](freshdesk[_0x3814('0x2b')]())[_0x3814('0x1c')](realtime[_0x3814('0x2c')]())['then'](desk[_0x3814('0x2d')]())['then'](realtime['initDeskAccounts']())[_0x3814('0x1c')](zoho[_0x3814('0x2e')]())[_0x3814('0x1c')](realtime[_0x3814('0x2f')]())[_0x3814('0x1c')](vtiger['getVtigerAccounts']())[_0x3814('0x1c')](realtime[_0x3814('0x30')]())[_0x3814('0x1c')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x3814('0x31')]())[_0x3814('0x1c')](servicenow[_0x3814('0x32')]())[_0x3814('0x1c')](realtime[_0x3814('0x33')]())[_0x3814('0x1c')](dynamics365[_0x3814('0x34')]())[_0x3814('0x1c')](realtime[_0x3814('0x35')]())[_0x3814('0x1c')](campaign['getCampaigns']())[_0x3814('0x1c')](realtime['initCampaigns']())[_0x3814('0x1c')](voiceExtension[_0x3814('0x36')]())[_0x3814('0x1c')](realtime[_0x3814('0x37')]())[_0x3814('0x1c')](faxAccount[_0x3814('0x38')]())[_0x3814('0x1c')](realtime['initFaxAccounts']())[_0x3814('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x3814('0x1b')]()[_0x3814('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x3814('0x1c')](realtime[_0x3814('0x39')]())[_0x3814('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x3814('0x1c')](realtime[_0x3814('0x3a')]())[_0x3814('0x1c')](cmHopperHistory[_0x3814('0x3b')]())[_0x3814('0x1c')](realtime[_0x3814('0x3c')]())[_0x3814('0x1c')](voiceCallReport[_0x3814('0x3d')]())[_0x3814('0x1c')](realtime[_0x3814('0x3e')]())[_0x3814('0x3f')](function(_0x5107f0){logger[_0x3814('0x40')](_0x3814('0x41'),util['inspect'](_0x5107f0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3814('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x3814('0x43')]();setInterval(initRealtime,0x1388);})[_0x3814('0x3f')](function(_0x2af479){logger[_0x3814('0x40')](_0x3814('0x44'),util[_0x3814('0x45')](_0x2af479,{'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 468e7ba..09c82f6 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 _0xacae=['stateTime','status','address','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','state','toLowerCase','not_inuse','idle','talking','statePause','toNumber','voiceStatus','stringify','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown'];(function(_0xf6dc14,_0x113164){var _0x2643c0=function(_0x48afdc){while(--_0x48afdc){_0xf6dc14['push'](_0xf6dc14['shift']());}};_0x2643c0(++_0x113164);}(_0xacae,0x134));var _0xeaca=function(_0x43d64e,_0x493592){_0x43d64e=_0x43d64e-0x0;var _0x2ec5b7=_0xacae[_0x43d64e];return _0x2ec5b7;};'use strict';var _=require(_0xeaca('0x0'));var util=require(_0xeaca('0x1'));var moment=require(_0xeaca('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xeaca('0x3'));config[_0xeaca('0x4')]=_['defaults'](config[_0xeaca('0x4')],{'host':_0xeaca('0x5'),'port':0x18eb});var io=require(_0xeaca('0x6'))(new Redis(config[_0xeaca('0x4')]));function Agent(_0x1775a6){this['id']=_0x1775a6['id']||0x0;this[_0xeaca('0x7')]=_0x1775a6['name']||'';this[_0xeaca('0x8')]=_0x1775a6[_0xeaca('0x8')]||'';this[_0xeaca('0x9')]=_0x1775a6[_0xeaca('0x9')]||'';this[_0xeaca('0xa')]=_0x1775a6[_0xeaca('0xa')]||'';this['state']=_0xeaca('0xb');this[_0xeaca('0xc')]=0x0;this[_0xeaca('0xd')]=_0xeaca('0xb');this[_0xeaca('0xe')]='';this['phone']='';this['mobile']='';this[_0xeaca('0xf')]='';this[_0xeaca('0x10')]=_0x1775a6[_0xeaca('0x10')]||![];this['voiceStatus']=_0xeaca('0xb');this[_0xeaca('0x11')]=0x0;this[_0xeaca('0x12')]='';this[_0xeaca('0x13')]='';this[_0xeaca('0x14')]=![];this[_0xeaca('0x15')]=![];this[_0xeaca('0x16')]='';}Agent[_0xeaca('0x17')]['updateStatusRealtime']=function(_0x57561b){var _0x40f6b0;if(_0x57561b&&_0x57561b[_0xeaca('0x18')]){_0x40f6b0=_0x57561b[_0xeaca('0x18')][_0xeaca('0x19')]();switch(_0x40f6b0){case _0xeaca('0x1a'):_0x40f6b0=_0xeaca('0x1b');break;case'inuse':_0x40f6b0=_0xeaca('0x1c');break;}}if(_0x40f6b0&&this['voiceStatus']!==_0x40f6b0||_0x57561b[_0xeaca('0x1d')]){this[_0xeaca('0x11')]=_[_0xeaca('0x1e')](moment()['format']('x'));}if(_0x40f6b0){this[_0xeaca('0x1f')]=_0x40f6b0;}var _0x269058={'id':this['id'],'name':this['name'],'email':this[_0xeaca('0x8')],'accountcode':this['accountcode'],'fullname':this[_0xeaca('0xa')],'state':this[_0xeaca('0x18')],'stateTime':this[_0xeaca('0xc')],'status':this[_0xeaca('0xd')],'address':this[_0xeaca('0xe')],'online':this['online'],'voiceStatus':this[_0xeaca('0x1f')],'voiceStatusTime':this[_0xeaca('0x11')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xeaca('0x13')],'interface':this['interface'],'onhold':this[_0xeaca('0x14')]};var _0x31e254=md5(JSON[_0xeaca('0x20')](_0x269058));if(this[_0xeaca('0x16')]!==_0x31e254){this[_0xeaca('0x16')]=_0x31e254;io['to'](util[_0xeaca('0x21')](_0xeaca('0x22'),_0x269058[_0xeaca('0x7')]))[_0xeaca('0x23')](_0xeaca('0x24'),_[_0xeaca('0x25')](_0x269058,[_0xeaca('0x10')]));io[_0xeaca('0x23')](_0xeaca('0x26'),_0x269058);}};module[_0xeaca('0x27')]=Agent; \ No newline at end of file +var _0x7352=['stringify','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','md5','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','toNumber','format','interface','onhold'];(function(_0x2e5a95,_0x261203){var _0x2536dd=function(_0x24c94e){while(--_0x24c94e){_0x2e5a95['push'](_0x2e5a95['shift']());}};_0x2536dd(++_0x261203);}(_0x7352,0x18d));var _0x2735=function(_0x487cb0,_0x339d3e){_0x487cb0=_0x487cb0-0x0;var _0x5a8047=_0x7352[_0x487cb0];return _0x5a8047;};'use strict';var _=require(_0x2735('0x0'));var util=require(_0x2735('0x1'));var moment=require('moment');var md5=require(_0x2735('0x2'));var Redis=require(_0x2735('0x3'));var config=require('../../../config/environment');config[_0x2735('0x4')]=_[_0x2735('0x5')](config[_0x2735('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2735('0x6'))(new Redis(config[_0x2735('0x4')]));function Agent(_0x59a4f9){this['id']=_0x59a4f9['id']||0x0;this[_0x2735('0x7')]=_0x59a4f9['name']||'';this[_0x2735('0x8')]=_0x59a4f9['email']||'';this[_0x2735('0x9')]=_0x59a4f9[_0x2735('0x9')]||'';this['fullname']=_0x59a4f9[_0x2735('0xa')]||'';this[_0x2735('0xb')]=_0x2735('0xc');this[_0x2735('0xd')]=0x0;this[_0x2735('0xe')]=_0x2735('0xc');this[_0x2735('0xf')]='';this[_0x2735('0x10')]='';this['mobile']='';this['interface']='';this[_0x2735('0x11')]=_0x59a4f9[_0x2735('0x11')]||![];this[_0x2735('0x12')]=_0x2735('0xc');this[_0x2735('0x13')]=0x0;this[_0x2735('0x14')]='';this[_0x2735('0x15')]='';this['onhold']=![];this[_0x2735('0x16')]=![];this[_0x2735('0x2')]='';}Agent[_0x2735('0x17')][_0x2735('0x18')]=function(_0xa6196f){var _0xb0bf1a;if(_0xa6196f&&_0xa6196f[_0x2735('0xb')]){_0xb0bf1a=_0xa6196f['state'][_0x2735('0x19')]();switch(_0xb0bf1a){case _0x2735('0x1a'):_0xb0bf1a=_0x2735('0x1b');break;case'inuse':_0xb0bf1a='talking';break;}}if(_0xb0bf1a&&this[_0x2735('0x12')]!==_0xb0bf1a||_0xa6196f['statePause']){this['voiceStatusTime']=_[_0x2735('0x1c')](moment()[_0x2735('0x1d')]('x'));}if(_0xb0bf1a){this[_0x2735('0x12')]=_0xb0bf1a;}var _0x1a3d64={'id':this['id'],'name':this[_0x2735('0x7')],'email':this[_0x2735('0x8')],'accountcode':this[_0x2735('0x9')],'fullname':this[_0x2735('0xa')],'state':this[_0x2735('0xb')],'stateTime':this[_0x2735('0xd')],'status':this[_0x2735('0xe')],'address':this[_0x2735('0xf')],'online':this[_0x2735('0x11')],'voiceStatus':this[_0x2735('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x2735('0x15')],'interface':this[_0x2735('0x1e')],'onhold':this[_0x2735('0x1f')]};var _0x56295e=md5(JSON[_0x2735('0x20')](_0x1a3d64));if(this[_0x2735('0x2')]!==_0x56295e){this[_0x2735('0x2')]=_0x56295e;io['to'](util[_0x2735('0x1d')](_0x2735('0x21'),_0x1a3d64[_0x2735('0x7')]))[_0x2735('0x22')](_0x2735('0x23'),_[_0x2735('0x24')](_0x1a3d64,[_0x2735('0x11')]));io[_0x2735('0x22')](_0x2735('0x25'),_0x1a3d64);}};module[_0x2735('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 af58a13..2ffc8c2 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 _0x9e92=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x3eb367,_0x2f39a6){var _0x428148=function(_0x28efc4){while(--_0x28efc4){_0x3eb367['push'](_0x3eb367['shift']());}};_0x428148(++_0x2f39a6);}(_0x9e92,0xac));var _0x29e9=function(_0x198712,_0x4554dc){_0x198712=_0x198712-0x0;var _0x2cf33a=_0x9e92[_0x198712];return _0x2cf33a;};'use strict';function Campaign(_0x547fea){this['id']=_0x547fea['id']||0x0;this[_0x29e9('0x0')]=_0x547fea[_0x29e9('0x0')]||'';this['type']=_0x547fea[_0x29e9('0x1')]||_0x29e9('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x29e9('0x3')]=0x0;this[_0x29e9('0x4')]=0x0;this[_0x29e9('0x5')]='';this[_0x29e9('0x6')]=!![];this[_0x29e9('0x7')]=_0x547fea[_0x29e9('0x7')];this[_0x29e9('0x8')]=_0x547fea[_0x29e9('0x8')];this['dialTimezone']=_0x547fea['dialTimezone']||null;this[_0x29e9('0x9')]=_0x547fea[_0x29e9('0x9')]?_0x547fea[_0x29e9('0x9')]:null;this[_0x29e9('0xa')]=_0x547fea[_0x29e9('0xa')];this[_0x29e9('0xb')]=_0x547fea[_0x29e9('0xb')];this[_0x29e9('0xc')]=_0x547fea[_0x29e9('0xc')]||0x1e;this[_0x29e9('0xd')]=_0x547fea[_0x29e9('0xd')];this[_0x29e9('0xe')]=_0x547fea[_0x29e9('0xe')];this['dialBusyMaxRetry']=_0x547fea[_0x29e9('0xf')];this[_0x29e9('0x10')]=_0x547fea['dialBusyRetryFrequency'];this[_0x29e9('0x11')]=_0x547fea['dialNoAnswerMaxRetry'];this[_0x29e9('0x12')]=_0x547fea[_0x29e9('0x12')];this[_0x29e9('0x13')]=_0x547fea[_0x29e9('0x13')];this[_0x29e9('0x14')]=_0x547fea['dialNoSuchNumberMaxRetry']||0x3;this[_0x29e9('0x15')]=_0x547fea['dialNoSuchNumberRetryFrequency']||0x96;this[_0x29e9('0x16')]=_0x547fea[_0x29e9('0x16')]||0x3;this[_0x29e9('0x17')]=_0x547fea[_0x29e9('0x17')]||0x96;this[_0x29e9('0x18')]=_0x547fea['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x547fea[_0x29e9('0x19')]||0x96;this['dialMachineMaxRetry']=_0x547fea[_0x29e9('0x1a')]||0x3;this[_0x29e9('0x1b')]=_0x547fea['dialMachineRetryFrequency']||0x96;this[_0x29e9('0x1c')]=_0x547fea[_0x29e9('0x1c')]||0x3;this[_0x29e9('0x1d')]=_0x547fea[_0x29e9('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x547fea[_0x29e9('0x1e')]||'DESC';this[_0x29e9('0x1f')]=_0x547fea[_0x29e9('0x1f')]||undefined;this[_0x29e9('0x20')]=_0x547fea[_0x29e9('0x20')]||undefined;this['dialCutDigit']=_0x547fea[_0x29e9('0x21')]||undefined;this[_0x29e9('0x22')]=_0x547fea[_0x29e9('0x22')]?_0x547fea[_0x29e9('0x22')]:undefined;this[_0x29e9('0x23')]=_0x547fea['Trunk']?_0x547fea[_0x29e9('0x23')]:undefined;this['Interval']=_0x547fea['Interval']?_0x547fea[_0x29e9('0x24')]:undefined;this[_0x29e9('0x25')]=_0x547fea[_0x29e9('0x25')]?_0x547fea['SquareProject']:undefined;this['dialQueueProject']=_0x547fea['SquareProject']?_0x547fea[_0x29e9('0x25')][_0x29e9('0x0')]:undefined;this['dialAMDActive']=_0x547fea[_0x29e9('0x26')]||![];this[_0x29e9('0x27')]=_0x547fea[_0x29e9('0x27')];this[_0x29e9('0x28')]=_0x547fea[_0x29e9('0x28')];this[_0x29e9('0x29')]=_0x547fea[_0x29e9('0x29')];this[_0x29e9('0x2a')]=_0x547fea['dialAMDTotalAnalysisTime'];this[_0x29e9('0x2b')]=_0x547fea[_0x29e9('0x2b')];this[_0x29e9('0x2c')]=_0x547fea[_0x29e9('0x2c')];this[_0x29e9('0x2d')]=_0x547fea[_0x29e9('0x2d')];this[_0x29e9('0x2e')]=_0x547fea[_0x29e9('0x2e')];this['dialAMDMaximumWordLength']=_0x547fea[_0x29e9('0x2f')];}module[_0x29e9('0x30')]=Campaign; \ No newline at end of file +var _0x0981=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk'];(function(_0x5a67bf,_0x5c3aa7){var _0x4b23eb=function(_0x3cf3d1){while(--_0x3cf3d1){_0x5a67bf['push'](_0x5a67bf['shift']());}};_0x4b23eb(++_0x5c3aa7);}(_0x0981,0xc9));var _0x1098=function(_0x2734cd,_0x442320){_0x2734cd=_0x2734cd-0x0;var _0x2e90ea=_0x0981[_0x2734cd];return _0x2e90ea;};'use strict';function Campaign(_0x555efa){this['id']=_0x555efa['id']||0x0;this[_0x1098('0x0')]=_0x555efa[_0x1098('0x0')]||'';this['type']=_0x555efa['type']||_0x1098('0x1');this['originated']=0x0;this[_0x1098('0x2')]=0x0;this[_0x1098('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1098('0x4')]='';this[_0x1098('0x5')]=!![];this[_0x1098('0x6')]=_0x555efa[_0x1098('0x6')];this['limitCalls']=_0x555efa[_0x1098('0x7')];this[_0x1098('0x8')]=_0x555efa[_0x1098('0x8')]||null;this['dialGlobalInterval']=_0x555efa[_0x1098('0x9')]?_0x555efa[_0x1098('0x9')]:null;this[_0x1098('0xa')]=_0x555efa[_0x1098('0xa')];this[_0x1098('0xb')]=_0x555efa[_0x1098('0xb')];this['dialOriginateTimeout']=_0x555efa['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x555efa[_0x1098('0xc')];this[_0x1098('0xd')]=_0x555efa['dialCongestionRetryFrequency'];this[_0x1098('0xe')]=_0x555efa[_0x1098('0xe')];this['dialBusyRetryFrequency']=_0x555efa[_0x1098('0xf')];this['dialNoAnswerMaxRetry']=_0x555efa['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x555efa[_0x1098('0x10')];this[_0x1098('0x11')]=_0x555efa['dialGlobalMaxRetry'];this[_0x1098('0x12')]=_0x555efa[_0x1098('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x555efa[_0x1098('0x13')]||0x96;this[_0x1098('0x14')]=_0x555efa['dialDropMaxRetry']||0x3;this[_0x1098('0x15')]=_0x555efa[_0x1098('0x15')]||0x96;this[_0x1098('0x16')]=_0x555efa[_0x1098('0x16')]||0x3;this[_0x1098('0x17')]=_0x555efa[_0x1098('0x17')]||0x96;this['dialMachineMaxRetry']=_0x555efa[_0x1098('0x18')]||0x3;this[_0x1098('0x19')]=_0x555efa[_0x1098('0x19')]||0x96;this[_0x1098('0x1a')]=_0x555efa[_0x1098('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x555efa[_0x1098('0x1b')]||0x96;this[_0x1098('0x1c')]=_0x555efa['dialOrderByScheduledAt']||_0x1098('0x1d');this[_0x1098('0x1e')]=_0x555efa[_0x1098('0x1e')]||undefined;this[_0x1098('0x1f')]=_0x555efa['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x555efa['dialCutDigit']||undefined;this[_0x1098('0x20')]=_0x555efa['TrunkBackup']?_0x555efa[_0x1098('0x20')]:undefined;this[_0x1098('0x21')]=_0x555efa[_0x1098('0x21')]?_0x555efa[_0x1098('0x21')]:undefined;this[_0x1098('0x22')]=_0x555efa[_0x1098('0x22')]?_0x555efa['Interval']:undefined;this[_0x1098('0x23')]=_0x555efa[_0x1098('0x23')]?_0x555efa['SquareProject']:undefined;this[_0x1098('0x24')]=_0x555efa[_0x1098('0x23')]?_0x555efa['SquareProject']['name']:undefined;this['dialAMDActive']=_0x555efa[_0x1098('0x25')]||![];this['dialAMDInitialSilence']=_0x555efa[_0x1098('0x26')];this[_0x1098('0x27')]=_0x555efa[_0x1098('0x27')];this[_0x1098('0x28')]=_0x555efa[_0x1098('0x28')];this['dialAMDTotalAnalysisTime']=_0x555efa[_0x1098('0x29')];this[_0x1098('0x2a')]=_0x555efa[_0x1098('0x2a')];this[_0x1098('0x2b')]=_0x555efa[_0x1098('0x2b')];this[_0x1098('0x2c')]=_0x555efa[_0x1098('0x2c')];this[_0x1098('0x2d')]=_0x555efa[_0x1098('0x2d')];this['dialAMDMaximumWordLength']=_0x555efa['dialAMDMaximumWordLength'];}module[_0x1098('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6c2e593..3816429 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 _0xd943=['transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','abandoned','lastapplication','billableseconds','holdtime','type','disposition','monitorFilename','queue','transfercalleridnum'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xd943,0x15d));var _0x3d94=function(_0x269fab,_0xd76e80){_0x269fab=_0x269fab-0x0;var _0x21982b=_0xd943[_0x269fab];return _0x21982b;};'use strict';function Channel(){this[_0x3d94('0x0')]=null;this[_0x3d94('0x1')]='';this[_0x3d94('0x2')]='';this[_0x3d94('0x3')]=0x0;this['calleridname']='';this[_0x3d94('0x4')]=undefined;this[_0x3d94('0x5')]=undefined;this[_0x3d94('0x6')]=0x0;this[_0x3d94('0x7')]='';this[_0x3d94('0x8')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x3d94('0x9')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0x3d94('0xa')]=![];this[_0x3d94('0xb')]='';this['lastdata']='';this['duration']=0x0;this[_0x3d94('0xc')]=0x0;this[_0x3d94('0xd')]=0x0;this[_0x3d94('0xe')]=null;this['tag']=null;this[_0x3d94('0xf')]=null;this['monitor']=![];this[_0x3d94('0x10')]=null;this[_0x3d94('0x11')]=null;this['monitors']=[];this[_0x3d94('0x12')]=undefined;this[_0x3d94('0x13')]=undefined;this[_0x3d94('0x14')]=undefined;this[_0x3d94('0x15')]=0x0;}module[_0x3d94('0x16')]=Channel; \ No newline at end of file +var _0xb7e2=['type','tag','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime'];(function(_0x2fdc16,_0x5435c7){var _0x445a7f=function(_0x19b993){while(--_0x19b993){_0x2fdc16['push'](_0x2fdc16['shift']());}};_0x445a7f(++_0x5435c7);}(_0xb7e2,0x103));var _0x2b7e=function(_0x5749bc,_0x346189){_0x5749bc=_0x5749bc-0x0;var _0x180f5b=_0xb7e2[_0x5749bc];return _0x180f5b;};'use strict';function Channel(){this[_0x2b7e('0x0')]=null;this['channel']='';this[_0x2b7e('0x1')]='';this['calleridnum']=0x0;this[_0x2b7e('0x2')]='';this['connectedlinenum']=undefined;this[_0x2b7e('0x3')]=undefined;this['accountcode']=0x0;this[_0x2b7e('0x4')]='';this[_0x2b7e('0x5')]=0x0;this[_0x2b7e('0x6')]=0x0;this[_0x2b7e('0x7')]=0x0;this[_0x2b7e('0x8')]=![];this[_0x2b7e('0x9')]=null;this['endtime']=null;this[_0x2b7e('0xa')]=![];this[_0x2b7e('0xb')]=![];this[_0x2b7e('0xc')]='';this['lastdata']='';this[_0x2b7e('0xd')]=0x0;this[_0x2b7e('0xe')]=0x0;this[_0x2b7e('0xf')]=0x0;this[_0x2b7e('0x10')]=null;this[_0x2b7e('0x11')]=null;this['disposition']=null;this['monitor']=![];this[_0x2b7e('0x12')]=null;this[_0x2b7e('0x13')]=null;this[_0x2b7e('0x14')]=[];this[_0x2b7e('0x15')]=undefined;this[_0x2b7e('0x16')]=undefined;this[_0x2b7e('0x17')]=undefined;this[_0x2b7e('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0520917..a2719a5 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 _0x8c67=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','type'];(function(_0x3a475a,_0x40bf1d){var _0x3acf74=function(_0x59fbd1){while(--_0x59fbd1){_0x3a475a['push'](_0x3a475a['shift']());}};_0x3acf74(++_0x40bf1d);}(_0x8c67,0x6f));var _0x78c6=function(_0xc599b5,_0x110bdf){_0xc599b5=_0xc599b5-0x0;var _0x2b4ce1=_0x8c67[_0xc599b5];return _0x2b4ce1;};'use strict';function DeskAccount(_0x2efdc6){this['id']=_0x2efdc6['id']||0x0;this[_0x78c6('0x0')]=_0x2efdc6['name']||'';this[_0x78c6('0x1')]=_0x2efdc6['username']||'';this[_0x78c6('0x2')]=_0x2efdc6[_0x78c6('0x2')]||'';this[_0x78c6('0x3')]=_0x2efdc6['authType']||'';this[_0x78c6('0x4')]=_0x2efdc6[_0x78c6('0x4')]||'';this[_0x78c6('0x5')]=_0x2efdc6[_0x78c6('0x5')]||'';this[_0x78c6('0x6')]=_0x2efdc6[_0x78c6('0x6')]||'';this[_0x78c6('0x7')]=_0x2efdc6[_0x78c6('0x7')]||'';this['tokenSecret']=_0x2efdc6['tokenSecret']||'';this[_0x78c6('0x8')]=_0x2efdc6[_0x78c6('0x8')]||'';this[_0x78c6('0x9')]=_0x2efdc6[_0x78c6('0x9')]||'';this[_0x78c6('0xa')]=_0x2efdc6['Configurations']||{};}module[_0x78c6('0xb')]=DeskAccount; \ No newline at end of file +var _0xee8b=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0xb8809d,_0x48fd5f){var _0x428c99=function(_0x5c2783){while(--_0x5c2783){_0xb8809d['push'](_0xb8809d['shift']());}};_0x428c99(++_0x48fd5f);}(_0xee8b,0xbe));var _0xbee8=function(_0x396b75,_0x9207b4){_0x396b75=_0x396b75-0x0;var _0xd192b9=_0xee8b[_0x396b75];return _0xd192b9;};'use strict';function DeskAccount(_0x1f7507){this['id']=_0x1f7507['id']||0x0;this[_0xbee8('0x0')]=_0x1f7507[_0xbee8('0x0')]||'';this[_0xbee8('0x1')]=_0x1f7507[_0xbee8('0x1')]||'';this[_0xbee8('0x2')]=_0x1f7507[_0xbee8('0x2')]||'';this['authType']=_0x1f7507[_0xbee8('0x3')]||'';this['password']=_0x1f7507[_0xbee8('0x4')]||'';this[_0xbee8('0x5')]=_0x1f7507[_0xbee8('0x5')]||'';this['consumerSecret']=_0x1f7507[_0xbee8('0x6')]||'';this['token']=_0x1f7507[_0xbee8('0x7')]||'';this[_0xbee8('0x8')]=_0x1f7507[_0xbee8('0x8')]||'';this[_0xbee8('0x9')]=_0x1f7507[_0xbee8('0x9')]||'';this[_0xbee8('0xa')]=_0x1f7507[_0xbee8('0xa')]||'';this[_0xbee8('0xb')]=_0x1f7507['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index bdf2e63..b1f32f8 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 _0xe071=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x552e4f,_0x49e149){var _0x41a603=function(_0x20145a){while(--_0x20145a){_0x552e4f['push'](_0x552e4f['shift']());}};_0x41a603(++_0x49e149);}(_0xe071,0x98));var _0x1e07=function(_0x55c937,_0x4136f7){_0x55c937=_0x55c937-0x0;var _0xc45fad=_0xe071[_0x55c937];return _0xc45fad;};'use strict';function Dynamics365Account(_0x3ba436){this['id']=_0x3ba436['id']||0x0;this['name']=_0x3ba436[_0x1e07('0x0')]||'';this['username']=_0x3ba436[_0x1e07('0x1')]||'';this['password']=_0x3ba436[_0x1e07('0x2')]||'';this[_0x1e07('0x3')]=_0x3ba436[_0x1e07('0x3')]||'';this[_0x1e07('0x4')]=_0x3ba436[_0x1e07('0x4')]||'';this['clientId']=_0x3ba436[_0x1e07('0x5')]||'';this[_0x1e07('0x6')]=_0x3ba436['clientSecret']||{};this[_0x1e07('0x7')]=_0x3ba436[_0x1e07('0x7')]||'';this[_0x1e07('0x8')]=_0x3ba436[_0x1e07('0x8')]||![];this['Configurations']=_0x3ba436[_0x1e07('0x9')]||{};this[_0x1e07('0xa')]=_0x3ba436['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x58b8=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x505a3d,_0x2f2b77){var _0xa845bc=function(_0x516558){while(--_0x516558){_0x505a3d['push'](_0x505a3d['shift']());}};_0xa845bc(++_0x2f2b77);}(_0x58b8,0xda));var _0x858b=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x58b8[_0x5c6299];return _0x23b564;};'use strict';function Dynamics365Account(_0x273fcb){this['id']=_0x273fcb['id']||0x0;this[_0x858b('0x0')]=_0x273fcb['name']||'';this[_0x858b('0x1')]=_0x273fcb[_0x858b('0x1')]||'';this[_0x858b('0x2')]=_0x273fcb['password']||'';this[_0x858b('0x3')]=_0x273fcb[_0x858b('0x3')]||'';this[_0x858b('0x4')]=_0x273fcb[_0x858b('0x4')]||'';this[_0x858b('0x5')]=_0x273fcb[_0x858b('0x5')]||'';this[_0x858b('0x6')]=_0x273fcb[_0x858b('0x6')]||{};this[_0x858b('0x7')]=_0x273fcb[_0x858b('0x7')]||'';this[_0x858b('0x8')]=_0x273fcb[_0x858b('0x8')]||![];this[_0x858b('0x9')]=_0x273fcb['Configurations']||{};this[_0x858b('0xa')]=_0x273fcb['CloudProvider']||{};}module[_0x858b('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c4292ba..78caa2c 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 _0x0005=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x10631b,_0x4cee10){var _0x331b53=function(_0xde855b){while(--_0xde855b){_0x10631b['push'](_0x10631b['shift']());}};_0x331b53(++_0x4cee10);}(_0x0005,0x199));var _0x5000=function(_0x155271,_0x3ae586){_0x155271=_0x155271-0x0;var _0x1e5268=_0x0005[_0x155271];return _0x1e5268;};'use strict';function FaxAccount(_0xe58b54){this['id']=_0xe58b54['id']||0x0;this[_0x5000('0x0')]=_0xe58b54[_0x5000('0x0')]||'';this['description']=_0xe58b54[_0x5000('0x1')];this[_0x5000('0x2')]=_0xe58b54['ecm'];this['headerinfo']=_0xe58b54[_0x5000('0x3')];this[_0x5000('0x4')]=_0xe58b54[_0x5000('0x4')];this[_0x5000('0x5')]=_0xe58b54[_0x5000('0x5')]||0x960;this[_0x5000('0x6')]=_0xe58b54[_0x5000('0x6')]||0x3840;this[_0x5000('0x7')]=_0xe58b54[_0x5000('0x7')]||'v17,v27,v29';this[_0x5000('0x8')]=_0xe58b54[_0x5000('0x8')]||'no';this[_0x5000('0x9')]=_0xe58b54['faxdetect']||'no';this[_0x5000('0xa')]=_0xe58b54[_0x5000('0xa')]||0x1388;this[_0x5000('0xb')]=_0xe58b54[_0x5000('0xb')]||_0x5000('0xc');this['Trunk']=_0xe58b54['Trunk']?_0xe58b54[_0x5000('0xd')]:undefined;this['ListId']=_0xe58b54[_0x5000('0xe')];this[_0x5000('0xf')]=_0xe58b54[_0x5000('0xf')];}module[_0x5000('0x10')]=FaxAccount; \ No newline at end of file +var _0xc604=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xc604,0x1a9));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x249f08){this['id']=_0x249f08['id']||0x0;this[_0x4c60('0x0')]=_0x249f08[_0x4c60('0x0')]||'';this[_0x4c60('0x1')]=_0x249f08[_0x4c60('0x1')];this[_0x4c60('0x2')]=_0x249f08[_0x4c60('0x2')];this[_0x4c60('0x3')]=_0x249f08['headerinfo'];this[_0x4c60('0x4')]=_0x249f08['localstationid'];this['minrate']=_0x249f08[_0x4c60('0x5')]||0x960;this['maxrate']=_0x249f08['maxrate']||0x3840;this['modem']=_0x249f08['modem']||_0x4c60('0x6');this[_0x4c60('0x7')]=_0x249f08[_0x4c60('0x7')]||'no';this[_0x4c60('0x8')]=_0x249f08[_0x4c60('0x8')]||'no';this[_0x4c60('0x9')]=_0x249f08[_0x4c60('0x9')]||0x1388;this[_0x4c60('0xa')]=_0x249f08['tech']||_0x4c60('0xb');this[_0x4c60('0xc')]=_0x249f08[_0x4c60('0xc')]?_0x249f08[_0x4c60('0xc')]:undefined;this['ListId']=_0x249f08[_0x4c60('0xd')];this['key']=_0x249f08[_0x4c60('0xe')];}module[_0x4c60('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 69a6e9f..98086a4 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 _0x4214=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4cdebe,_0x60c1be){var _0x827148=function(_0x44348c){while(--_0x44348c){_0x4cdebe['push'](_0x4cdebe['shift']());}};_0x827148(++_0x60c1be);}(_0x4214,0x161));var _0x4421=function(_0x3284cd,_0x2e10a2){_0x3284cd=_0x3284cd-0x0;var _0xe92280=_0x4214[_0x3284cd];return _0xe92280;};'use strict';function FreshdeskAccount(_0x32cbcc){this['id']=_0x32cbcc['id']||0x0;this[_0x4421('0x0')]=_0x32cbcc['name']||'';this[_0x4421('0x1')]=_0x32cbcc[_0x4421('0x1')]||'';this['apiKey']=_0x32cbcc['token']||'';this[_0x4421('0x2')]=_0x32cbcc[_0x4421('0x2')]||'';this['serverUrl']=_0x32cbcc[_0x4421('0x3')]||'';this[_0x4421('0x4')]=_0x32cbcc[_0x4421('0x4')]||{};}module[_0x4421('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x9a2a=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x28bc89,_0x1edcd4){var _0x31aaa2=function(_0x3182a8){while(--_0x3182a8){_0x28bc89['push'](_0x28bc89['shift']());}};_0x31aaa2(++_0x1edcd4);}(_0x9a2a,0x71));var _0xa9a2=function(_0x2401e6,_0x2248d7){_0x2401e6=_0x2401e6-0x0;var _0xf06a43=_0x9a2a[_0x2401e6];return _0xf06a43;};'use strict';function FreshdeskAccount(_0x55c069){this['id']=_0x55c069['id']||0x0;this['name']=_0x55c069[_0xa9a2('0x0')]||'';this[_0xa9a2('0x1')]=_0x55c069[_0xa9a2('0x1')]||'';this[_0xa9a2('0x2')]=_0x55c069[_0xa9a2('0x3')]||'';this[_0xa9a2('0x4')]=_0x55c069[_0xa9a2('0x4')]||'';this[_0xa9a2('0x5')]=_0x55c069[_0xa9a2('0x5')]||'';this['Configurations']=_0x55c069[_0xa9a2('0x6')]||{};}module[_0xa9a2('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6d06dab..edd69ce 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 _0x539d=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x5a9461,_0x30e8dc){var _0x39a3be=function(_0x5b05ee){while(--_0x5b05ee){_0x5a9461['push'](_0x5a9461['shift']());}};_0x39a3be(++_0x30e8dc);}(_0x539d,0x17b));var _0xd539=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x539d[_0x54b283];return _0x2462b3;};'use strict';function FreshsalesAccount(_0x2df0ff){this['id']=_0x2df0ff['id']||0x0;this['name']=_0x2df0ff[_0xd539('0x0')]||'';this[_0xd539('0x1')]=_0x2df0ff['username']||'';this['apiKey']=_0x2df0ff[_0xd539('0x2')]||'';this[_0xd539('0x3')]=_0x2df0ff[_0xd539('0x3')]||'';this[_0xd539('0x4')]=_0x2df0ff[_0xd539('0x4')]||'';this['Configurations']=_0x2df0ff[_0xd539('0x5')]||{};}module[_0xd539('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5fd1=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xe45b6d,_0x443cac){var _0x4d6f47=function(_0x1c57a6){while(--_0x1c57a6){_0xe45b6d['push'](_0xe45b6d['shift']());}};_0x4d6f47(++_0x443cac);}(_0x5fd1,0x155));var _0x15fd=function(_0x5d6984,_0x2ffc13){_0x5d6984=_0x5d6984-0x0;var _0x377d58=_0x5fd1[_0x5d6984];return _0x377d58;};'use strict';function FreshsalesAccount(_0x46f785){this['id']=_0x46f785['id']||0x0;this['name']=_0x46f785[_0x15fd('0x0')]||'';this[_0x15fd('0x1')]=_0x46f785[_0x15fd('0x1')]||'';this['apiKey']=_0x46f785['token']||'';this[_0x15fd('0x2')]=_0x46f785[_0x15fd('0x2')]||'';this[_0x15fd('0x3')]=_0x46f785['serverUrl']||'';this[_0x15fd('0x4')]=_0x46f785[_0x15fd('0x4')]||{};}module[_0x15fd('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b6cd4e6..8a190f9 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 _0x06e7=['queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','context','holdtime','lastAssignedTo','voice','mohtime','exports','type','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x341ac6,_0x4595c0){var _0x541642=function(_0x25830d){while(--_0x25830d){_0x341ac6['push'](_0x341ac6['shift']());}};_0x541642(++_0x4595c0);}(_0x06e7,0x14b));var _0x706e=function(_0x43a608,_0x5c5948){_0x43a608=_0x43a608-0x0;var _0x2be0a5=_0x06e7[_0x43a608];return _0x2be0a5;};'use strict';function QueueReport(){this[_0x706e('0x0')]='inbound';this[_0x706e('0x1')]='';this['calleridnum']='';this[_0x706e('0x2')]='';this['queue']='';this[_0x706e('0x3')]=null;this[_0x706e('0x4')]=null;this['position']=0x1;this[_0x706e('0x5')]=0x1;this[_0x706e('0x6')]=![];this[_0x706e('0x7')]=null;this[_0x706e('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x706e('0x9')]=![];this['queuecallerexitAt']=null;this[_0x706e('0xa')]=0x1;this[_0x706e('0xb')]='';this[_0x706e('0xc')]='';this[_0x706e('0xd')]='';this['accountcode']='';this[_0x706e('0xe')]='';this['exten']='';this['priority']='';this[_0x706e('0xf')]=0x0;this['assigned']=![];this[_0x706e('0x10')]='';this['motionChannel']=_0x706e('0x11');this['routealias']=null;this[_0x706e('0x12')]=0x0;this['variables']={};}module[_0x706e('0x13')]=QueueReport; \ No newline at end of file +var _0x4576=['accountcode','context','holdtime','assigned','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x4576,0x159));var _0x6457=function(_0x1fb849,_0x30f797){_0x1fb849=_0x1fb849-0x0;var _0x1db22b=_0x4576[_0x1fb849];return _0x1db22b;};'use strict';function QueueReport(){this[_0x6457('0x0')]=_0x6457('0x1');this[_0x6457('0x2')]='';this[_0x6457('0x3')]='';this[_0x6457('0x4')]='';this[_0x6457('0x5')]='';this[_0x6457('0x6')]=null;this[_0x6457('0x7')]=null;this[_0x6457('0x8')]=0x1;this[_0x6457('0x9')]=0x1;this[_0x6457('0xa')]=![];this[_0x6457('0xb')]=null;this[_0x6457('0xc')]=![];this[_0x6457('0xd')]=null;this[_0x6457('0xe')]=![];this[_0x6457('0xf')]=null;this[_0x6457('0x10')]=0x1;this['channel']='';this[_0x6457('0x11')]='';this[_0x6457('0x12')]='';this[_0x6457('0x13')]='';this[_0x6457('0x14')]='';this['exten']='';this['priority']='';this[_0x6457('0x15')]=0x0;this[_0x6457('0x16')]=![];this['lastAssignedTo']='';this[_0x6457('0x17')]=_0x6457('0x18');this['routealias']=null;this[_0x6457('0x19')]=0x0;this[_0x6457('0x1a')]={};}module[_0x6457('0x1b')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b13904f..4138900 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 _0xb261=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3afb47,_0x54bee0){var _0xe566d2=function(_0x214891){while(--_0x214891){_0x3afb47['push'](_0x3afb47['shift']());}};_0xe566d2(++_0x54bee0);}(_0xb261,0x1b1));var _0x1b26=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xb261[_0x1e6659];return _0x4d16e4;};'use strict';function SalesforceAccount(_0x3ebd92){this['id']=_0x3ebd92['id']||0x0;this[_0x1b26('0x0')]=_0x3ebd92[_0x1b26('0x0')]||'';this[_0x1b26('0x1')]=_0x3ebd92[_0x1b26('0x1')]||'';this[_0x1b26('0x2')]=_0x3ebd92[_0x1b26('0x2')]||'';this[_0x1b26('0x3')]=_0x3ebd92[_0x1b26('0x3')]||'';this['clientId']=_0x3ebd92[_0x1b26('0x4')]||'';this[_0x1b26('0x5')]=_0x3ebd92['clientSecret']||'';this[_0x1b26('0x6')]=_0x3ebd92[_0x1b26('0x6')]||'';this[_0x1b26('0x7')]=_0x3ebd92[_0x1b26('0x7')]||'integrationTab';this['serverUrl']=_0x3ebd92[_0x1b26('0x8')]||'';this[_0x1b26('0x9')]=_0x3ebd92[_0x1b26('0x9')]||{};}module[_0x1b26('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x46c1=['securityToken','type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x46c1,0x7c));var _0x146c=function(_0x38ca2c,_0x2a2fab){_0x38ca2c=_0x38ca2c-0x0;var _0x265847=_0x46c1[_0x38ca2c];return _0x265847;};'use strict';function SalesforceAccount(_0x477bf2){this['id']=_0x477bf2['id']||0x0;this[_0x146c('0x0')]=_0x477bf2[_0x146c('0x0')]||'';this[_0x146c('0x1')]=_0x477bf2[_0x146c('0x1')]||'';this[_0x146c('0x2')]=_0x477bf2['remoteUri']||'';this[_0x146c('0x3')]=_0x477bf2[_0x146c('0x3')]||'';this[_0x146c('0x4')]=_0x477bf2[_0x146c('0x4')]||'';this[_0x146c('0x5')]=_0x477bf2['clientSecret']||'';this['securityToken']=_0x477bf2[_0x146c('0x6')]||'';this[_0x146c('0x7')]=_0x477bf2[_0x146c('0x7')]||'integrationTab';this[_0x146c('0x8')]=_0x477bf2['serverUrl']||'';this[_0x146c('0x9')]=_0x477bf2[_0x146c('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 455a29d..7b1d63d 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 _0x2f13=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x2f13,0x150));var _0x32f1=function(_0x2f42e4,_0x3a7862){_0x2f42e4=_0x2f42e4-0x0;var _0x4d059c=_0x2f13[_0x2f42e4];return _0x4d059c;};'use strict';function ServicenowAccount(_0x562b7){this['id']=_0x562b7['id']||0x0;this[_0x32f1('0x0')]=_0x562b7[_0x32f1('0x0')]||'';this[_0x32f1('0x1')]=_0x562b7[_0x32f1('0x1')]||'';this['password']=_0x562b7[_0x32f1('0x2')]||'';this['remoteUri']=_0x562b7[_0x32f1('0x3')]||'';this[_0x32f1('0x4')]=_0x562b7[_0x32f1('0x4')]||'';this[_0x32f1('0x5')]=_0x562b7[_0x32f1('0x5')]||{};}module[_0x32f1('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xeb48=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x49b0ea,_0x35200c){var _0x1aa8c6=function(_0xf397e0){while(--_0xf397e0){_0x49b0ea['push'](_0x49b0ea['shift']());}};_0x1aa8c6(++_0x35200c);}(_0xeb48,0x67));var _0x8eb4=function(_0x44a482,_0x11f318){_0x44a482=_0x44a482-0x0;var _0x2c8ee8=_0xeb48[_0x44a482];return _0x2c8ee8;};'use strict';function ServicenowAccount(_0x105f2c){this['id']=_0x105f2c['id']||0x0;this['name']=_0x105f2c[_0x8eb4('0x0')]||'';this[_0x8eb4('0x1')]=_0x105f2c[_0x8eb4('0x1')]||'';this['password']=_0x105f2c[_0x8eb4('0x2')]||'';this[_0x8eb4('0x3')]=_0x105f2c['remoteUri']||'';this[_0x8eb4('0x4')]=_0x105f2c['serverUrl']||'';this[_0x8eb4('0x5')]=_0x105f2c['Configurations']||{};}module[_0x8eb4('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 6a8b99d..df73a47 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 _0xcbb0=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x46c60a,_0x400b62){var _0x2f2f27=function(_0x4bb326){while(--_0x4bb326){_0x46c60a['push'](_0x46c60a['shift']());}};_0x2f2f27(++_0x400b62);}(_0xcbb0,0xdb));var _0x0cbb=function(_0x28596d,_0x455ab3){_0x28596d=_0x28596d-0x0;var _0x1703f7=_0xcbb0[_0x28596d];return _0x1703f7;};'use strict';function SugarcrmAccount(_0x4379a0){this['id']=_0x4379a0['id']||0x0;this[_0x0cbb('0x0')]=_0x4379a0['name']||'';this[_0x0cbb('0x1')]=_0x4379a0['username']||'';this[_0x0cbb('0x2')]=_0x4379a0['password']||'';this[_0x0cbb('0x3')]=_0x4379a0[_0x0cbb('0x3')]||'';this['serverUrl']=_0x4379a0[_0x0cbb('0x4')]||'';this[_0x0cbb('0x5')]=_0x4379a0[_0x0cbb('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7475=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x7475,0xca));var _0x5747=function(_0x54f270,_0x5116ba){_0x54f270=_0x54f270-0x0;var _0x2fee7d=_0x7475[_0x54f270];return _0x2fee7d;};'use strict';function SugarcrmAccount(_0x5be71b){this['id']=_0x5be71b['id']||0x0;this[_0x5747('0x0')]=_0x5be71b[_0x5747('0x0')]||'';this['username']=_0x5be71b[_0x5747('0x1')]||'';this[_0x5747('0x2')]=_0x5be71b[_0x5747('0x2')]||'';this['remoteUri']=_0x5be71b[_0x5747('0x3')]||'';this[_0x5747('0x4')]=_0x5be71b[_0x5747('0x4')]||'';this[_0x5747('0x5')]=_0x5be71b[_0x5747('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 cbe81c5..908633e 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 _0x0a78=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x29e412,_0x3619eb){var _0x26e380=function(_0x27e8a5){while(--_0x27e8a5){_0x29e412['push'](_0x29e412['shift']());}};_0x26e380(++_0x3619eb);}(_0x0a78,0x1ab));var _0x80a7=function(_0x5f2867,_0x38d8b8){_0x5f2867=_0x5f2867-0x0;var _0x258785=_0x0a78[_0x5f2867];return _0x258785;};'use strict';function Telephone(_0x3dabc8){this['id']=_0x3dabc8['id']||0x0;this[_0x80a7('0x0')]=_0x3dabc8['name']||'';this[_0x80a7('0x1')]=_0x3dabc8['accountcode']||'';this[_0x80a7('0x2')]=_0x80a7('0x3');this[_0x80a7('0x4')]=0x0;this['status']=_0x80a7('0x3');this['address']='';}module[_0x80a7('0x5')]=Telephone; \ No newline at end of file +var _0xbc50=['stateTime','status','unknown','address','exports','name','accountcode','state'];(function(_0x1d8430,_0x11b43f){var _0x1f3eeb=function(_0x35d011){while(--_0x35d011){_0x1d8430['push'](_0x1d8430['shift']());}};_0x1f3eeb(++_0x11b43f);}(_0xbc50,0x85));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x399e11){this['id']=_0x399e11['id']||0x0;this['name']=_0x399e11[_0x0bc5('0x0')]||'';this['accountcode']=_0x399e11[_0x0bc5('0x1')]||'';this[_0x0bc5('0x2')]='unknown';this[_0x0bc5('0x3')]=0x0;this[_0x0bc5('0x4')]=_0x0bc5('0x5');this[_0x0bc5('0x6')]='';}module[_0x0bc5('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 50885ed..9e2331b 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x58945e,_0x4d50ac){var _0x4d291f=function(_0x2504aa){while(--_0x2504aa){_0x58945e['push'](_0x58945e['shift']());}};_0x4d291f(++_0x4d50ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x118146,_0x2910b8){var _0x188b0c=function(_0x33a88d){while(--_0x33a88d){_0x118146['push'](_0x118146['shift']());}};_0x188b0c(++_0x2910b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 87f53e2..4d924ec 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4fb37a,_0x368286){var _0x136de4=function(_0x209569){while(--_0x209569){_0x4fb37a['push'](_0x4fb37a['shift']());}};_0x136de4(++_0x368286);}(_0xda2d,0x102));var _0xdda2=function(_0x514700,_0x2ac502){_0x514700=_0x514700-0x0;var _0x54abd2=_0xda2d[_0x514700];return _0x54abd2;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x404f55,_0x5d2cf0){var _0x28c518=function(_0x3baeda){while(--_0x3baeda){_0x404f55['push'](_0x404f55['shift']());}};_0x28c518(++_0x5d2cf0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x34bda7,_0x166385){_0x34bda7=_0x34bda7-0x0;var _0x17620=_0x9ffd[_0x34bda7];return _0x17620;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f11bf7a..63875ec 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 _0xf870=['defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xf870,0x145));var _0x0f87=function(_0x10e64b,_0x1031c0){_0x10e64b=_0x10e64b-0x0;var _0x34e712=_0xf870[_0x10e64b];return _0x34e712;};'use strict';function Trunk(_0x4ad393){this['id']=_0x4ad393['id']||0x0;this['active']=_0x4ad393[_0x0f87('0x0')]||![];this[_0x0f87('0x1')]=_0x4ad393[_0x0f87('0x1')]||'';this[_0x0f87('0x2')]=_0x0f87('0x3');this[_0x0f87('0x4')]=0x0;this[_0x0f87('0x5')]=_0x0f87('0x3');this[_0x0f87('0x6')]=_0x4ad393['registry']&&_0x4ad393[_0x0f87('0x6')][_0x0f87('0x7')](':')?_0x4ad393[_0x0f87('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x0f87('0x8')]='';this[_0x0f87('0x9')]='';this[_0x0f87('0xa')]='';this[_0x0f87('0xb')]='';this[_0x0f87('0xc')]=_0x0f87('0x3');this[_0x0f87('0xd')]='';this[_0x0f87('0xe')]='';this[_0x0f87('0xf')]=_0x4ad393[_0x0f87('0xf')]||'';}module[_0x0f87('0x10')]=Trunk; \ No newline at end of file +var _0x6ff1=['split','host','port','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','status','unknown','registry','indexOf'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x6ff1,0x1ca));var _0x16ff=function(_0x2d99c0,_0x394bfb){_0x2d99c0=_0x2d99c0-0x0;var _0x1e1f58=_0x6ff1[_0x2d99c0];return _0x1e1f58;};'use strict';function Trunk(_0x3c1173){this['id']=_0x3c1173['id']||0x0;this[_0x16ff('0x0')]=_0x3c1173[_0x16ff('0x0')]||![];this[_0x16ff('0x1')]=_0x3c1173[_0x16ff('0x1')]||'';this[_0x16ff('0x2')]='unknown';this['stateTime']=0x0;this[_0x16ff('0x3')]=_0x16ff('0x4');this[_0x16ff('0x5')]=_0x3c1173[_0x16ff('0x5')]&&_0x3c1173[_0x16ff('0x5')][_0x16ff('0x6')](':')?_0x3c1173[_0x16ff('0x5')][_0x16ff('0x7')](':')[0x0]:'';this[_0x16ff('0x8')]='';this[_0x16ff('0x9')]='';this['domain']='';this['domainport']='';this[_0x16ff('0xa')]='';this[_0x16ff('0xb')]=_0x16ff('0x4');this[_0x16ff('0xc')]='';this[_0x16ff('0xd')]='';this[_0x16ff('0xe')]=_0x3c1173[_0x16ff('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 31deb32..4cddcdd 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 _0x0b41=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4e183b,_0x2e7366){var _0x63f76e=function(_0x17fae7){while(--_0x17fae7){_0x4e183b['push'](_0x4e183b['shift']());}};_0x63f76e(++_0x2e7366);}(_0x0b41,0xbb));var _0x10b4=function(_0x40b092,_0x377b1f){_0x40b092=_0x40b092-0x0;var _0x33c908=_0x0b41[_0x40b092];return _0x33c908;};'use strict';function voiceExtension(_0x43084f){this['id']=_0x43084f['id']||0x0;this[_0x10b4('0x0')]=_0x43084f[_0x10b4('0x0')]||'';this[_0x10b4('0x1')]=_0x43084f[_0x10b4('0x1')]||_0x10b4('0x2');this[_0x10b4('0x3')]=_0x43084f[_0x10b4('0x3')]||![];}module[_0x10b4('0x4')]=voiceExtension; \ No newline at end of file +var _0xaa61=['none','mandatoryDisposition','exports','recordingFormat'];(function(_0x152989,_0x4c8a41){var _0x599549=function(_0x152a33){while(--_0x152a33){_0x152989['push'](_0x152989['shift']());}};_0x599549(++_0x4c8a41);}(_0xaa61,0x16f));var _0x1aa6=function(_0x1db0d9,_0x5965a2){_0x1db0d9=_0x1db0d9-0x0;var _0x27cea6=_0xaa61[_0x1db0d9];return _0x27cea6;};'use strict';function voiceExtension(_0x3267de){this['id']=_0x3267de['id']||0x0;this['exten']=_0x3267de['exten']||'';this[_0x1aa6('0x0')]=_0x3267de[_0x1aa6('0x0')]||_0x1aa6('0x1');this['mandatoryDisposition']=_0x3267de[_0x1aa6('0x2')]||![];}module[_0x1aa6('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5427012..005eea8 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 _0x37cc=['queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x37cc,0x185));var _0xc37c=function(_0x4a177c,_0x2bd612){_0x4a177c=_0x4a177c-0x0;var _0x54dd37=_0x37cc[_0x4a177c];return _0x54dd37;};'use strict';var monitorFormat={'wav':_0xc37c('0x0'),'wav49':_0xc37c('0x1'),'gsm':_0xc37c('0x2')};var strategy={'fewestcalls':_0xc37c('0x3'),'leastrecent':_0xc37c('0x4'),'linear':_0xc37c('0x5'),'random':'random','ringall':'ringall','rr':_0xc37c('0x6'),'rrmemory':_0xc37c('0x7'),'rrordered':_0xc37c('0x8'),'wrandom':_0xc37c('0x9')};function VoiceQueue(_0x4c9dcd){this['id']=_0x4c9dcd['id']||0x0;this[_0xc37c('0xa')]=_0x4c9dcd[_0xc37c('0xa')]||'';this[_0xc37c('0xb')]=_0x4c9dcd[_0xc37c('0xb')]||'';this['type']=_0x4c9dcd[_0xc37c('0xc')]||_0xc37c('0xd');this[_0xc37c('0xe')]=0x0;this[_0xc37c('0xf')]=0x0;this[_0xc37c('0x10')]=0x0;this['sumDuration']=0x0;this[_0xc37c('0x11')]=0x0;this[_0xc37c('0x12')]=0x0;this[_0xc37c('0x13')]=0x0;this[_0xc37c('0x14')]=0x0;this[_0xc37c('0x15')]=0x0;this[_0xc37c('0x16')]=0x0;this[_0xc37c('0x17')]=0x0;this[_0xc37c('0x18')]=0x0;this[_0xc37c('0x19')]=0x0;this[_0xc37c('0x1a')]=0x0;this[_0xc37c('0x1b')]=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0xc37c('0x1c')]=0x0;this[_0xc37c('0x1d')]=0x0;this[_0xc37c('0x1e')]=0x0;this[_0xc37c('0x1f')]=0x0;this[_0xc37c('0x20')]=_0x4c9dcd[_0xc37c('0x20')]||![];this['acwTimeout']=_0x4c9dcd[_0xc37c('0x21')]||0xa;this['autopause']=_0x4c9dcd[_0xc37c('0x22')]||'no';this[_0xc37c('0x23')]=!![];this[_0xc37c('0x24')]='';this[_0xc37c('0x25')]='';this[_0xc37c('0x26')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x4c9dcd['dialTimezone']||null;this[_0xc37c('0x27')]=_0x4c9dcd['dialGlobalInterval']?_0x4c9dcd[_0xc37c('0x27')]:null;this[_0xc37c('0x28')]=_0x4c9dcd['dialActive'];this[_0xc37c('0x29')]=_0x4c9dcd[_0xc37c('0x29')]||_0xc37c('0x2a');this[_0xc37c('0x2b')]=_0x4c9dcd['dialLimitChannel']||0x0;this[_0xc37c('0x2c')]=_0x4c9dcd['dialLimitQueue']||0x0;this[_0xc37c('0x2d')]=_0x4c9dcd[_0xc37c('0x2d')]||0x1;this[_0xc37c('0x2e')]=_0x4c9dcd[_0xc37c('0x2e')]||_0xc37c('0x2f');this['dialPredictiveOptimizationPercentage']=_0x4c9dcd[_0xc37c('0x30')]||0.03;this[_0xc37c('0x31')]=_0x4c9dcd[_0xc37c('0x31')]||0x258;this[_0xc37c('0x32')]=_0x4c9dcd[_0xc37c('0x32')]||_0xc37c('0x33');this[_0xc37c('0x34')]=_0x4c9dcd[_0xc37c('0x34')]||_0xc37c('0x33');this[_0xc37c('0x35')]=_0x4c9dcd[_0xc37c('0x35')]||0x1e;this[_0xc37c('0x36')]=_0x4c9dcd[_0xc37c('0x36')]||'tTxX';this[_0xc37c('0x37')]=_0x4c9dcd[_0xc37c('0x37')]||0x3;this[_0xc37c('0x38')]=_0x4c9dcd[_0xc37c('0x38')]||undefined;this['dialCongestionMaxRetry']=_0x4c9dcd[_0xc37c('0x39')]||0x3;this[_0xc37c('0x3a')]=_0x4c9dcd[_0xc37c('0x3a')]||0x96;this[_0xc37c('0x3b')]=_0x4c9dcd[_0xc37c('0x3b')]||0x3;this[_0xc37c('0x3c')]=_0x4c9dcd[_0xc37c('0x3c')]||0x96;this[_0xc37c('0x3d')]=_0x4c9dcd['dialNoAnswerMaxRetry']||0x3;this[_0xc37c('0x3e')]=_0x4c9dcd[_0xc37c('0x3e')]||0x96;this[_0xc37c('0x3f')]=_0x4c9dcd[_0xc37c('0x3f')]||0x3;this[_0xc37c('0x40')]=_0x4c9dcd[_0xc37c('0x40')]||0x96;this[_0xc37c('0x41')]=_0x4c9dcd[_0xc37c('0x41')]||0x3;this[_0xc37c('0x42')]=_0x4c9dcd[_0xc37c('0x42')]||0x96;this[_0xc37c('0x43')]=_0x4c9dcd[_0xc37c('0x43')]||0x3;this[_0xc37c('0x44')]=_0x4c9dcd['dialAbandonedRetryFrequency']||0x96;this[_0xc37c('0x45')]=_0x4c9dcd[_0xc37c('0x45')]||0x3;this['dialMachineRetryFrequency']=_0x4c9dcd['dialMachineRetryFrequency']||0x96;this[_0xc37c('0x46')]=_0x4c9dcd[_0xc37c('0x46')]||0x3;this[_0xc37c('0x47')]=_0x4c9dcd['dialAgentRejectRetryFrequency']||0x96;this[_0xc37c('0x48')]=_0x4c9dcd['callAdditionalPhoneAfterMin']||0x3;this[_0xc37c('0x49')]=_0x4c9dcd[_0xc37c('0x49')]||0x4;this['Trunk']=_0x4c9dcd[_0xc37c('0x4a')]?_0x4c9dcd[_0xc37c('0x4a')]:undefined;this[_0xc37c('0x4b')]=_0x4c9dcd[_0xc37c('0x4b')]?_0x4c9dcd[_0xc37c('0x4b')]:undefined;this[_0xc37c('0x4c')]=_0x4c9dcd[_0xc37c('0x4c')]||undefined;this['Interval']=_0x4c9dcd['Interval']?_0x4c9dcd[_0xc37c('0x4d')]:undefined;this[_0xc37c('0x4e')]=_0x4c9dcd[_0xc37c('0x4e')]||_0xc37c('0x4f');this['dialRandomLastDigitCallerIdNumber']=_0x4c9dcd[_0xc37c('0x50')]||undefined;this[_0xc37c('0x51')]=_0x4c9dcd[_0xc37c('0x51')]||undefined;this['strategy']=strategy[_0x4c9dcd[_0xc37c('0x52')]];this[_0xc37c('0x53')]=!![];this['dialAMDActive']=_0x4c9dcd[_0xc37c('0x54')]||![];this[_0xc37c('0x55')]=_0x4c9dcd['dialAMDInitialSilence'];this[_0xc37c('0x56')]=_0x4c9dcd[_0xc37c('0x56')];this[_0xc37c('0x57')]=_0x4c9dcd[_0xc37c('0x57')];this[_0xc37c('0x58')]=_0x4c9dcd[_0xc37c('0x58')];this[_0xc37c('0x59')]=_0x4c9dcd[_0xc37c('0x59')];this[_0xc37c('0x5a')]=_0x4c9dcd[_0xc37c('0x5a')];this[_0xc37c('0x5b')]=_0x4c9dcd[_0xc37c('0x5b')];this[_0xc37c('0x5c')]=_0x4c9dcd[_0xc37c('0x5c')];this[_0xc37c('0x5d')]=_0x4c9dcd[_0xc37c('0x5d')];this[_0xc37c('0x5e')]=0x0;this['pTalking']=0x0;this[_0xc37c('0x5f')]=_0x4c9dcd[_0xc37c('0x5f')];this[_0xc37c('0x60')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xc37c('0x61')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc37c('0x62')]=0x0;this[_0xc37c('0x63')]=0x0;this[_0xc37c('0x64')]=0x0;this[_0xc37c('0x65')]=0x0;this['outboundReCallsDay']=0x0;this[_0xc37c('0x66')]=0x0;this[_0xc37c('0x67')]=undefined;this['startPredictive']=undefined;this[_0xc37c('0x68')]=undefined;this[_0xc37c('0x69')]=1.05;this[_0xc37c('0x6a')]=0x0;this[_0xc37c('0x6b')]=0x0;this[_0xc37c('0x6c')]=0x0;this[_0xc37c('0x6d')]=0x0;this[_0xc37c('0x6e')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xc37c('0x6f')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x4c9dcd['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xc37c('0x70')]=_0x4c9dcd['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc37c('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xc37c('0x72')]=0x1;this[_0xc37c('0x73')]=0x0;this[_0xc37c('0x74')]=0x0;this[_0xc37c('0x75')]=0x0;this[_0xc37c('0x76')]=0x0;this[_0xc37c('0x77')]=_0x4c9dcd['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x4c9dcd['dialRecallInQueue']||![];this[_0xc37c('0x78')]=!!_0x4c9dcd[_0xc37c('0x78')]||![];this[_0xc37c('0x79')]=!!_0x4c9dcd[_0xc37c('0x79')]||![];this[_0xc37c('0x7a')]=_0x4c9dcd[_0xc37c('0x7a')]||undefined;this[_0xc37c('0x7b')]=_0x4c9dcd['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x4c9dcd[_0xc37c('0x7c')]||![];this[_0xc37c('0xb')]=monitorFormat[_0x4c9dcd[_0xc37c('0xb')]]?monitorFormat[_0x4c9dcd[_0xc37c('0xb')]]:undefined;this[_0xc37c('0x7d')]=_0x4c9dcd[_0xc37c('0x7d')]||![];this[_0xc37c('0x7e')]=_0x4c9dcd[_0xc37c('0x7e')]?_0x4c9dcd[_0xc37c('0x7e')]:undefined;this[_0xc37c('0x7f')]=![];}module[_0xc37c('0x80')]=VoiceQueue; \ No newline at end of file +var _0x8910=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x8910,0x1ef));var _0x0891=function(_0x73b80e,_0x4daa4a){_0x73b80e=_0x73b80e-0x0;var _0x4c31cd=_0x8910[_0x73b80e];return _0x4c31cd;};'use strict';var monitorFormat={'wav':_0x0891('0x0'),'wav49':_0x0891('0x1'),'gsm':_0x0891('0x2')};var strategy={'fewestcalls':_0x0891('0x3'),'leastrecent':'leastrecent','linear':_0x0891('0x4'),'random':_0x0891('0x5'),'ringall':_0x0891('0x6'),'rr':_0x0891('0x7'),'rrmemory':_0x0891('0x8'),'rrordered':_0x0891('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x2499ed){this['id']=_0x2499ed['id']||0x0;this['name']=_0x2499ed['name']||'';this[_0x0891('0xa')]=_0x2499ed['monitor_format']||'';this[_0x0891('0xb')]=_0x2499ed[_0x0891('0xb')]||_0x0891('0xc');this[_0x0891('0xd')]=0x0;this[_0x0891('0xe')]=0x0;this[_0x0891('0xf')]=0x0;this[_0x0891('0x10')]=0x0;this[_0x0891('0x11')]=0x0;this[_0x0891('0x12')]=0x0;this[_0x0891('0x13')]=0x0;this[_0x0891('0x14')]=0x0;this[_0x0891('0x15')]=0x0;this[_0x0891('0x16')]=0x0;this[_0x0891('0x17')]=0x0;this['invalid']=0x0;this[_0x0891('0x18')]=0x0;this[_0x0891('0x19')]=0x0;this[_0x0891('0x1a')]=0x0;this[_0x0891('0x1b')]=0x0;this[_0x0891('0x1c')]=0x0;this[_0x0891('0x1d')]=0x0;this[_0x0891('0x1e')]=0x0;this[_0x0891('0x1f')]=0x0;this[_0x0891('0x20')]=0x0;this[_0x0891('0x21')]=_0x2499ed[_0x0891('0x21')]||![];this[_0x0891('0x22')]=_0x2499ed[_0x0891('0x22')]||0xa;this[_0x0891('0x23')]=_0x2499ed[_0x0891('0x23')]||'no';this[_0x0891('0x24')]=!![];this[_0x0891('0x25')]='';this[_0x0891('0x26')]='';this[_0x0891('0x27')]=0x0;this[_0x0891('0x28')]=0x0;this[_0x0891('0x29')]=_0x2499ed[_0x0891('0x29')]||null;this[_0x0891('0x2a')]=_0x2499ed[_0x0891('0x2a')]?_0x2499ed[_0x0891('0x2a')]:null;this[_0x0891('0x2b')]=_0x2499ed[_0x0891('0x2b')];this[_0x0891('0x2c')]=_0x2499ed['dialMethod']||_0x0891('0x2d');this['dialLimitChannel']=_0x2499ed['dialLimitChannel']||0x0;this[_0x0891('0x2e')]=_0x2499ed[_0x0891('0x2e')]||0x0;this[_0x0891('0x2f')]=_0x2499ed[_0x0891('0x2f')]||0x1;this[_0x0891('0x30')]=_0x2499ed[_0x0891('0x30')]||_0x0891('0x31');this[_0x0891('0x32')]=_0x2499ed[_0x0891('0x32')]||0.03;this[_0x0891('0x33')]=_0x2499ed['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x2499ed[_0x0891('0x34')]||'anonymous';this[_0x0891('0x35')]=_0x2499ed[_0x0891('0x35')]||_0x0891('0x36');this['dialOriginateTimeout']=_0x2499ed[_0x0891('0x37')]||0x1e;this[_0x0891('0x38')]=_0x2499ed[_0x0891('0x38')]||_0x0891('0x39');this[_0x0891('0x3a')]=_0x2499ed[_0x0891('0x3a')]||0x3;this[_0x0891('0x3b')]=_0x2499ed[_0x0891('0x3b')]||undefined;this[_0x0891('0x3c')]=_0x2499ed[_0x0891('0x3c')]||0x3;this[_0x0891('0x3d')]=_0x2499ed[_0x0891('0x3d')]||0x96;this['dialBusyMaxRetry']=_0x2499ed['dialBusyMaxRetry']||0x3;this[_0x0891('0x3e')]=_0x2499ed[_0x0891('0x3e')]||0x96;this[_0x0891('0x3f')]=_0x2499ed[_0x0891('0x3f')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2499ed[_0x0891('0x40')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2499ed[_0x0891('0x41')]||0x3;this[_0x0891('0x42')]=_0x2499ed[_0x0891('0x42')]||0x96;this[_0x0891('0x43')]=_0x2499ed[_0x0891('0x43')]||0x3;this[_0x0891('0x44')]=_0x2499ed[_0x0891('0x44')]||0x96;this[_0x0891('0x45')]=_0x2499ed[_0x0891('0x45')]||0x3;this[_0x0891('0x46')]=_0x2499ed[_0x0891('0x46')]||0x96;this[_0x0891('0x47')]=_0x2499ed[_0x0891('0x47')]||0x3;this[_0x0891('0x48')]=_0x2499ed[_0x0891('0x48')]||0x96;this['dialAgentRejectMaxRetry']=_0x2499ed[_0x0891('0x49')]||0x3;this[_0x0891('0x4a')]=_0x2499ed[_0x0891('0x4a')]||0x96;this[_0x0891('0x4b')]=_0x2499ed['callAdditionalPhoneAfterMin']||0x3;this[_0x0891('0x4c')]=_0x2499ed[_0x0891('0x4c')]||0x4;this[_0x0891('0x4d')]=_0x2499ed[_0x0891('0x4d')]?_0x2499ed[_0x0891('0x4d')]:undefined;this[_0x0891('0x4e')]=_0x2499ed['TrunkBackup']?_0x2499ed[_0x0891('0x4e')]:undefined;this[_0x0891('0x4f')]=_0x2499ed[_0x0891('0x4f')]||undefined;this['Interval']=_0x2499ed['Interval']?_0x2499ed[_0x0891('0x50')]:undefined;this[_0x0891('0x51')]=_0x2499ed['dialOrderByScheduledAt']||_0x0891('0x52');this[_0x0891('0x53')]=_0x2499ed['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0891('0x54')]=_0x2499ed[_0x0891('0x54')]||undefined;this[_0x0891('0x55')]=strategy[_0x2499ed[_0x0891('0x55')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x2499ed['dialAMDActive']||![];this[_0x0891('0x56')]=_0x2499ed[_0x0891('0x56')];this[_0x0891('0x57')]=_0x2499ed[_0x0891('0x57')];this[_0x0891('0x58')]=_0x2499ed[_0x0891('0x58')];this[_0x0891('0x59')]=_0x2499ed[_0x0891('0x59')];this[_0x0891('0x5a')]=_0x2499ed['dialAMDMinWordLength'];this[_0x0891('0x5b')]=_0x2499ed['dialAMDBetweenWordsSilence'];this[_0x0891('0x5c')]=_0x2499ed[_0x0891('0x5c')];this[_0x0891('0x5d')]=_0x2499ed[_0x0891('0x5d')];this[_0x0891('0x5e')]=_0x2499ed[_0x0891('0x5e')];this[_0x0891('0x5f')]=0x0;this[_0x0891('0x60')]=0x0;this['timeout']=_0x2499ed[_0x0891('0x61')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x0891('0x62')]=0x0;this[_0x0891('0x63')]=0x0;this[_0x0891('0x64')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x0891('0x65')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x0891('0x66')]=0x0;this[_0x0891('0x67')]=0x0;this[_0x0891('0x68')]=0x0;this[_0x0891('0x69')]=0x0;this[_0x0891('0x6a')]=undefined;this[_0x0891('0x6b')]=undefined;this['handlePredictive']=undefined;this[_0x0891('0x6c')]=1.05;this[_0x0891('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x0891('0x6e')]=0x0;this[_0x0891('0x6f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x0891('0x70')]=0x0;this[_0x0891('0x71')]=0x0;this[_0x0891('0x72')]=0x0;this[_0x0891('0x73')]=_0x2499ed[_0x0891('0x74')]||0x14;this[_0x0891('0x75')]=_0x2499ed[_0x0891('0x74')]||0xa;this[_0x0891('0x76')]=0x0;this[_0x0891('0x77')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x0891('0x78')]=0x0;this[_0x0891('0x79')]=0x0;this[_0x0891('0x7a')]=0x0;this[_0x0891('0x7b')]=_0x2499ed[_0x0891('0x7b')]||0x1e;this[_0x0891('0x7c')]=_0x2499ed['dialRecallInQueue']||![];this[_0x0891('0x7d')]=!!_0x2499ed[_0x0891('0x7d')]||![];this[_0x0891('0x7e')]=!!_0x2499ed[_0x0891('0x7e')]||![];this[_0x0891('0x7f')]=_0x2499ed[_0x0891('0x7f')]||undefined;this[_0x0891('0x80')]=_0x2499ed[_0x0891('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x2499ed[_0x0891('0x81')]||![];this['monitor_format']=monitorFormat[_0x2499ed[_0x0891('0xa')]]?monitorFormat[_0x2499ed['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2499ed[_0x0891('0x82')]||![];this[_0x0891('0x83')]=_0x2499ed['mandatoryDispositionPause']?_0x2499ed[_0x0891('0x83')]:undefined;this[_0x0891('0x84')]=![];}module[_0x0891('0x85')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index f3480ab..4939502 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 _0x61b8=['createReport','unknown','loggedin','callers','SIP/','online','incall','status','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','sumBillable','preview','exports','available','loggedIn','loggedInDb','ringing','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','talking','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','unavailable','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype'];(function(_0x35730c,_0x3811ba){var _0x3ce717=function(_0x178097){while(--_0x178097){_0x35730c['push'](_0x35730c['shift']());}};_0x3ce717(++_0x3811ba);}(_0x61b8,0x169));var _0x861b=function(_0x3c1782,_0x344dec){_0x3c1782=_0x3c1782-0x0;var _0x1b9bfc=_0x61b8[_0x3c1782];return _0x1b9bfc;};'use strict';var INBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x1'),_0x861b('0x2'),'paused',_0x861b('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x4'),_0x861b('0x5'),'loggedIn',_0x861b('0x2'),_0x861b('0x6'),_0x861b('0x7'),_0x861b('0x8'),_0x861b('0x9'),_0x861b('0xa'),_0x861b('0xb'),_0x861b('0xc'),_0x861b('0xd'),_0x861b('0xe'),_0x861b('0xf'),'outboundUnknownCallsDay',_0x861b('0x10'),_0x861b('0x11'),_0x861b('0x12'),'sumBillable',_0x861b('0x13'),'total',_0x861b('0x14')];function VoiceQueueSummary(_0xd7656){this['id']=_0xd7656['id'];this['name']=_0xd7656[_0x861b('0x15')];this[_0x861b('0x16')]=_0xd7656[_0x861b('0x16')];this[_0x861b('0x17')]=_0xd7656[_0x861b('0x17')]||0x0;this[_0x861b('0x4')]=_0xd7656[_0x861b('0x4')]||0x0;this[_0x861b('0x0')]=_0xd7656[_0x861b('0x0')]||0x0;this[_0x861b('0x18')]=_0xd7656[_0x861b('0x18')]||0x0;this[_0x861b('0x5')]=_0xd7656[_0x861b('0x5')]||0x0;this[_0x861b('0x19')]=_0xd7656[_0x861b('0x19')]||0x0;this[_0x861b('0x1')]=_0xd7656['loggedIn']||0x0;this[_0x861b('0x2')]=_0xd7656['loggedInDb']||0x0;this['onHold']=_0xd7656[_0x861b('0x1a')]||0x0;this['notInUse']=_0xd7656[_0x861b('0x1b')]||0x0;this[_0x861b('0x10')]=_0xd7656['paused']||0x0;this[_0x861b('0x3')]=_0xd7656[_0x861b('0x3')]||0x0;this[_0x861b('0x1c')]=_0xd7656[_0x861b('0x1c')];this['sumBillable']=_0xd7656['sumBillable'];this[_0x861b('0x13')]=_0xd7656[_0x861b('0x13')];this[_0x861b('0x1d')]=_0xd7656['sumHoldTime']||0x0;this[_0x861b('0x12')]=_0xd7656['talking']||0x0;this[_0x861b('0x1e')]=_0xd7656[_0x861b('0x1e')]||0x0;this['type']=_0xd7656['type'];this[_0x861b('0x1f')]=_0xd7656[_0x861b('0x1f')]||0x0;this['unknown']=_0xd7656['unknown']||0x0;this[_0x861b('0x20')]=_0xd7656['unmanaged']||0x0;this['waiting']=_0xd7656[_0x861b('0x14')]||0x0;if(_0xd7656['type']==='outbound'){this[_0x861b('0x11')]=_0xd7656[_0x861b('0x11')]||0x0;this[_0x861b('0x21')]=_0xd7656[_0x861b('0x21')];this[_0x861b('0x22')]=_0xd7656[_0x861b('0x22')];this['dialOriginateCallerIdName']=_0xd7656[_0x861b('0x23')];this[_0x861b('0x24')]=_0xd7656[_0x861b('0x24')];this[_0x861b('0x25')]=_0xd7656[_0x861b('0x25')];this[_0x861b('0x26')]=_0xd7656['dialPrefix'];this['temp']=_0xd7656[_0x861b('0x27')];this[_0x861b('0x28')]=_0xd7656[_0x861b('0x28')];this[_0x861b('0x8')]=_0xd7656[_0x861b('0x8')];this[_0x861b('0x9')]=_0xd7656['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0xd7656[_0x861b('0xa')];this['outboundCongestionCallsDay']=_0xd7656[_0x861b('0xb')];this[_0x861b('0x29')]=_0xd7656[_0x861b('0x29')];this[_0x861b('0x2a')]=_0xd7656[_0x861b('0x2a')];this[_0x861b('0x2b')]=_0xd7656[_0x861b('0x2b')];this[_0x861b('0xc')]=_0xd7656['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0xd7656[_0x861b('0xd')];this['outboundOriginateFailureCallsDay']=_0xd7656[_0x861b('0x2c')];this[_0x861b('0xe')]=_0xd7656['outboundReCallsDay'];this[_0x861b('0xf')]=_0xd7656['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0xd7656[_0x861b('0x2d')];this[_0x861b('0x2e')]=_0xd7656['predictiveIntervalAnsweredCalls'];this[_0x861b('0x2f')]=_0xd7656[_0x861b('0x2f')];this['predictiveIntervalAvgTalktime']=_0xd7656[_0x861b('0x30')];this[_0x861b('0x31')]=_0xd7656['predictiveIntervalDroppedCallsCallersExit'];this[_0x861b('0x32')]=_0xd7656[_0x861b('0x32')];this[_0x861b('0x33')]=_0xd7656[_0x861b('0x33')];this[_0x861b('0x34')]=_0xd7656[_0x861b('0x34')];this['predictiveIntervalHitRate']=_0xd7656[_0x861b('0x35')];this[_0x861b('0x36')]=_0xd7656[_0x861b('0x36')];this[_0x861b('0x37')]=_0xd7656[_0x861b('0x37')];this['predictiveIntervalAvailable']=_0xd7656['predictiveIntervalAvailable'];this[_0x861b('0x38')]=_0xd7656[_0x861b('0x38')];this['originated']=_0xd7656['originated'];this[_0x861b('0x39')]=_0xd7656[_0x861b('0x39')];this[_0x861b('0x3a')]=_0xd7656[_0x861b('0x3a')];this[_0x861b('0x3b')]=_0xd7656[_0x861b('0x3b')];this['erlangBusyFactor']=_0xd7656[_0x861b('0x3c')];this[_0x861b('0x3d')]=_0xd7656[_0x861b('0x3d')];this[_0x861b('0x3e')]=_0xd7656[_0x861b('0x3e')];this[_0x861b('0x3f')]=_0xd7656['message'];this[_0x861b('0x40')]=_0xd7656['statusMessage'];}if(_0xd7656[_0x861b('0x41')]){this['Trunk']={'id':_0xd7656[_0x861b('0x41')]['id'],'name':_0xd7656[_0x861b('0x41')][_0x861b('0x15')],'active':_0xd7656[_0x861b('0x41')][_0x861b('0x42')],'callerid':_0xd7656['Trunk'][_0x861b('0x43')]};}}VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x45')]=function(_0xadca6f,_0x5c9bfa,_0x23ae99,_0x281ddb){this['loggedInDb']=0x0;this[_0x861b('0x12')]=0x0;this[_0x861b('0x10')]=0x0;this[_0x861b('0x46')]=0x0;this['notInUse']=0x0;this[_0x861b('0x5')]=0x0;this[_0x861b('0x18')]=0x0;this['invalid']=0x0;this[_0x861b('0x1f')]=0x0;this[_0x861b('0x3')]=0x0;this['ringInUse']=0x0;this[_0x861b('0x1a')]=0x0;if(_0x23ae99){if(_0x23ae99[_0x861b('0x0')]){this['available']=Number(_0x23ae99[_0x861b('0x0')]);}if(_0x23ae99[_0x861b('0x47')]){this[_0x861b('0x1')]=Number(_0x23ae99[_0x861b('0x47')]);}if(_0x23ae99[_0x861b('0x48')]){this[_0x861b('0x14')]=Number(_0x23ae99['callers']);}}for(var _0x8f3581=0x0;_0x8f3581<_0xadca6f['length'];_0x8f3581++){var _0x2b4bdc=_0x5c9bfa[_0x861b('0x49')+_0xadca6f[_0x8f3581]['name']];if(_0x2b4bdc&&_0x2b4bdc[_0x861b('0x4a')]){this[_0x861b('0x2')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x4b')]==='1'){this[_0x861b('0x12')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x10')]==='1'&&!['2','7','8']['includes'](_0xadca6f[_0x8f3581][_0x861b('0x4c')])){this[_0x861b('0x10')]+=0x1;}switch(_0xadca6f[_0x8f3581]['status']){case'0':this[_0x861b('0x46')]+=0x1;break;case'1':this[_0x861b('0x1b')]+=0x1;break;case'2':this[_0x861b('0x5')]+=0x1;break;case'3':this[_0x861b('0x18')]+=0x1;break;case'4':this[_0x861b('0x19')]+=0x1;break;case'5':this[_0x861b('0x1f')]+=0x1;break;case'6':this[_0x861b('0x3')]+=0x1;break;case'7':this[_0x861b('0x1c')]+=0x1;break;case'8':this[_0x861b('0x1a')]+=0x1;break;}}if(this[_0x861b('0x22')]==='booked'){var _0x3415d4=Object['keys'](_0x281ddb);for(var _0x1074f1=0x0;_0x1074f1<_0x3415d4['length'];_0x1074f1++){var _0x3865a7=_0x3415d4[_0x1074f1];var _0x166eee=_0x281ddb[_0x3865a7];if(_0x166eee['queue']===this[_0x861b('0x15')]&&_0x166eee['type']===_0x861b('0x4d')&&_0x166eee[_0x861b('0x4e')]===_0x861b('0x4f')){this['talking']+=0x1;}}if(this[_0x861b('0x12')]>this[_0x861b('0x5')]){this[_0x861b('0x12')]=this[_0x861b('0x5')];}this[_0x861b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x50')]=function(_0xedf4c5){var _0x4e5147=![];if(_0xedf4c5){_0x4e5147=INBOUND_COUNTERS[_0x861b('0x51')](function(_0x4380db){return this[_0x4380db]!==_0xedf4c5[_0x4380db];},this);}return _0x4e5147;};VoiceQueueSummary[_0x861b('0x44')]['compareToOutboundQueue']=function(_0x2fdb54){var _0x9d4fef=![];var _0x4b0e1e=![];var _0x2aac41=![];if(_0x2fdb54){_0x9d4fef=this['dialMethod']!==_0x2fdb54[_0x861b('0x22')]||this[_0x861b('0x21')]!==_0x2fdb54[_0x861b('0x21')]||this[_0x861b('0x3f')]!==_0x2fdb54['message']||this[_0x861b('0x40')]!==_0x2fdb54[_0x861b('0x40')];_0x4b0e1e=OUTBOUND_COUNTERS['some'](function(_0x3fc0a7){return this[_0x3fc0a7]!==_0x2fdb54[_0x3fc0a7];},this);if(this[_0x861b('0x41')]&&_0x2fdb54['Trunk']){_0x2aac41=this[_0x861b('0x41')][_0x861b('0x15')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x15')]||this[_0x861b('0x41')][_0x861b('0x42')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x42')];}}return _0x9d4fef||_0x4b0e1e||_0x2aac41;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x52')]=function(_0x4e0e32){this[_0x861b('0x4')]=_0x4e0e32[_0x861b('0x4')];this[_0x861b('0x3f')]=_0x4e0e32[_0x861b('0x3f')];this[_0x861b('0x40')]=_0x4e0e32['statusMessage'];this[_0x861b('0x6')]=_0x4e0e32[_0x861b('0x6')];this[_0x861b('0x7')]=_0x4e0e32['outboundAbandonedCallsDay'];this[_0x861b('0x8')]=_0x4e0e32['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x4e0e32[_0x861b('0x9')];this[_0x861b('0xa')]=_0x4e0e32['outboundBusyCallsDay'];this[_0x861b('0xb')]=_0x4e0e32[_0x861b('0xb')];this[_0x861b('0xc')]=_0x4e0e32[_0x861b('0xc')];this[_0x861b('0xd')]=_0x4e0e32[_0x861b('0xd')];this[_0x861b('0xe')]=_0x4e0e32[_0x861b('0xe')];this[_0x861b('0xf')]=_0x4e0e32[_0x861b('0xf')];this[_0x861b('0x2d')]=_0x4e0e32[_0x861b('0x2d')];this[_0x861b('0x53')]=_0x4e0e32['sumBillable'];this['sumDuration']=_0x4e0e32[_0x861b('0x13')];this[_0x861b('0x1e')]=_0x4e0e32[_0x861b('0x1e')];if(this[_0x861b('0x22')]===_0x861b('0x54')){this[_0x861b('0x11')]=_0x4e0e32[_0x861b('0x11')];}};module[_0x861b('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x04f9=['preview','loggedIn','loggedInDb','paused','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','onHold','notInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','invalid','ringInUse','loggedin','callers','length','SIP/','incall','includes','status','ringing','booked','keys','queue','dialer','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundCongestionCallsDay'];(function(_0x2d92d0,_0x512de7){var _0x5752e4=function(_0x47b6c2){while(--_0x47b6c2){_0x2d92d0['push'](_0x2d92d0['shift']());}};_0x5752e4(++_0x512de7);}(_0x04f9,0xb3));var _0x904f=function(_0x59c32a,_0x1cc509){_0x59c32a=_0x59c32a-0x0;var _0x1a4907=_0x04f9[_0x59c32a];return _0x1a4907;};'use strict';var INBOUND_COUNTERS=['available',_0x904f('0x0'),_0x904f('0x1'),_0x904f('0x2'),'ringing',_0x904f('0x3'),_0x904f('0x4')];var OUTBOUND_COUNTERS=[_0x904f('0x5'),_0x904f('0x6'),_0x904f('0x7'),_0x904f('0x0'),'loggedInDb',_0x904f('0x8'),_0x904f('0x9'),_0x904f('0xa'),_0x904f('0xb'),_0x904f('0xc'),'outboundCongestionCallsDay',_0x904f('0xd'),_0x904f('0xe'),_0x904f('0xf'),'outboundRejectCallsDay',_0x904f('0x10'),_0x904f('0x2'),_0x904f('0x11'),_0x904f('0x3'),_0x904f('0x12'),_0x904f('0x13'),_0x904f('0x14'),_0x904f('0x4')];function VoiceQueueSummary(_0x245577){this['id']=_0x245577['id'];this[_0x904f('0x15')]=_0x245577[_0x904f('0x15')];this[_0x904f('0x16')]=_0x245577[_0x904f('0x16')];this[_0x904f('0x17')]=_0x245577[_0x904f('0x17')]||0x0;this[_0x904f('0x6')]=_0x245577[_0x904f('0x6')]||0x0;this[_0x904f('0x5')]=_0x245577[_0x904f('0x5')]||0x0;this[_0x904f('0x18')]=_0x245577[_0x904f('0x18')]||0x0;this[_0x904f('0x7')]=_0x245577[_0x904f('0x7')]||0x0;this['invalid']=_0x245577['invalid']||0x0;this[_0x904f('0x0')]=_0x245577[_0x904f('0x0')]||0x0;this['loggedInDb']=_0x245577['loggedInDb']||0x0;this['onHold']=_0x245577[_0x904f('0x19')]||0x0;this[_0x904f('0x1a')]=_0x245577['notInUse']||0x0;this[_0x904f('0x2')]=_0x245577['paused']||0x0;this['ringing']=_0x245577['ringing']||0x0;this['ringInUse']=_0x245577['ringInUse'];this['sumBillable']=_0x245577[_0x904f('0x12')];this[_0x904f('0x13')]=_0x245577['sumDuration'];this[_0x904f('0x1b')]=_0x245577[_0x904f('0x1b')]||0x0;this[_0x904f('0x3')]=_0x245577['talking']||0x0;this[_0x904f('0x14')]=_0x245577[_0x904f('0x14')]||0x0;this[_0x904f('0x1c')]=_0x245577[_0x904f('0x1c')];this[_0x904f('0x1d')]=_0x245577[_0x904f('0x1d')]||0x0;this[_0x904f('0x1e')]=_0x245577[_0x904f('0x1e')]||0x0;this[_0x904f('0x1f')]=_0x245577[_0x904f('0x1f')]||0x0;this[_0x904f('0x4')]=_0x245577[_0x904f('0x4')]||0x0;if(_0x245577[_0x904f('0x1c')]===_0x904f('0x20')){this[_0x904f('0x11')]=_0x245577['pTalking']||0x0;this['dialActive']=_0x245577[_0x904f('0x21')];this[_0x904f('0x22')]=_0x245577['dialMethod'];this[_0x904f('0x23')]=_0x245577[_0x904f('0x23')];this['dialOriginateCallerIdNumber']=_0x245577[_0x904f('0x24')];this[_0x904f('0x25')]=_0x245577[_0x904f('0x25')];this[_0x904f('0x26')]=_0x245577[_0x904f('0x26')];this[_0x904f('0x27')]=_0x245577[_0x904f('0x27')];this[_0x904f('0x28')]=_0x245577[_0x904f('0x28')];this[_0x904f('0xa')]=_0x245577['outboundAnswerCallsDay'];this[_0x904f('0xb')]=_0x245577['outboundBlacklistCallsDay'];this[_0x904f('0xc')]=_0x245577[_0x904f('0xc')];this['outboundCongestionCallsDay']=_0x245577['outboundCongestionCallsDay'];this[_0x904f('0x29')]=_0x245577['outboundDropCallsDayACS'];this[_0x904f('0x2a')]=_0x245577[_0x904f('0x2a')];this['outboundDropCallsDayTimeout']=_0x245577[_0x904f('0x2b')];this['outboundNoAnswerCallsDay']=_0x245577[_0x904f('0xd')];this[_0x904f('0xe')]=_0x245577[_0x904f('0xe')];this[_0x904f('0x2c')]=_0x245577[_0x904f('0x2c')];this[_0x904f('0xf')]=_0x245577['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x245577[_0x904f('0x2d')];this[_0x904f('0x10')]=_0x245577['outboundUnknownCallsDay'];this[_0x904f('0x2e')]=_0x245577[_0x904f('0x2e')];this[_0x904f('0x2f')]=_0x245577[_0x904f('0x2f')];this[_0x904f('0x30')]=_0x245577[_0x904f('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x245577[_0x904f('0x31')];this[_0x904f('0x32')]=_0x245577[_0x904f('0x32')];this[_0x904f('0x33')]=_0x245577['predictiveIntervalErlangCalls'];this[_0x904f('0x34')]=_0x245577[_0x904f('0x34')];this[_0x904f('0x35')]=_0x245577['predictiveIntervalHitRate'];this[_0x904f('0x36')]=_0x245577[_0x904f('0x36')];this[_0x904f('0x37')]=_0x245577[_0x904f('0x37')];this[_0x904f('0x38')]=_0x245577[_0x904f('0x38')];this[_0x904f('0x39')]=_0x245577[_0x904f('0x39')];this[_0x904f('0x8')]=_0x245577['originated'];this[_0x904f('0x3a')]=_0x245577[_0x904f('0x3a')];this[_0x904f('0x3b')]=_0x245577[_0x904f('0x3b')];this['erlangAbandonmentRate']=_0x245577['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x245577[_0x904f('0x3c')];this[_0x904f('0x3d')]=_0x245577[_0x904f('0x3d')];this[_0x904f('0x3e')]=_0x245577[_0x904f('0x3e')];this[_0x904f('0x3f')]=_0x245577['message'];this[_0x904f('0x40')]=_0x245577[_0x904f('0x40')];}if(_0x245577[_0x904f('0x41')]){this[_0x904f('0x41')]={'id':_0x245577[_0x904f('0x41')]['id'],'name':_0x245577['Trunk']['name'],'active':_0x245577[_0x904f('0x41')]['active'],'callerid':_0x245577[_0x904f('0x41')][_0x904f('0x42')]};}}VoiceQueueSummary[_0x904f('0x43')][_0x904f('0x44')]=function(_0x4445be,_0x392a64,_0x277182,_0x242c48){this[_0x904f('0x1')]=0x0;this[_0x904f('0x3')]=0x0;this[_0x904f('0x2')]=0x0;this[_0x904f('0x1e')]=0x0;this[_0x904f('0x1a')]=0x0;this['inUse']=0x0;this[_0x904f('0x18')]=0x0;this[_0x904f('0x45')]=0x0;this[_0x904f('0x1d')]=0x0;this['ringing']=0x0;this[_0x904f('0x46')]=0x0;this[_0x904f('0x19')]=0x0;if(_0x277182){if(_0x277182[_0x904f('0x5')]){this[_0x904f('0x5')]=Number(_0x277182['available']);}if(_0x277182[_0x904f('0x47')]){this[_0x904f('0x0')]=Number(_0x277182['loggedin']);}if(_0x277182[_0x904f('0x48')]){this[_0x904f('0x4')]=Number(_0x277182['callers']);}}for(var _0x2b9565=0x0;_0x2b9565<_0x4445be[_0x904f('0x49')];_0x2b9565++){var _0x1ec9dd=_0x392a64[_0x904f('0x4a')+_0x4445be[_0x2b9565][_0x904f('0x15')]];if(_0x1ec9dd&&_0x1ec9dd['online']){this['loggedInDb']+=0x1;}if(_0x4445be[_0x2b9565][_0x904f('0x4b')]==='1'){this['talking']+=0x1;}if(_0x4445be[_0x2b9565][_0x904f('0x2')]==='1'&&!['2','7','8'][_0x904f('0x4c')](_0x4445be[_0x2b9565][_0x904f('0x4d')])){this[_0x904f('0x2')]+=0x1;}switch(_0x4445be[_0x2b9565]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x904f('0x1a')]+=0x1;break;case'2':this[_0x904f('0x7')]+=0x1;break;case'3':this[_0x904f('0x18')]+=0x1;break;case'4':this[_0x904f('0x45')]+=0x1;break;case'5':this[_0x904f('0x1d')]+=0x1;break;case'6':this[_0x904f('0x4e')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x904f('0x19')]+=0x1;break;}}if(this['dialMethod']===_0x904f('0x4f')){var _0x167e69=Object[_0x904f('0x50')](_0x242c48);for(var _0x1ec277=0x0;_0x1ec277<_0x167e69[_0x904f('0x49')];_0x1ec277++){var _0x434271=_0x167e69[_0x1ec277];var _0x24ee22=_0x242c48[_0x434271];if(_0x24ee22[_0x904f('0x51')]===this[_0x904f('0x15')]&&_0x24ee22[_0x904f('0x1c')]===_0x904f('0x52')&&_0x24ee22['exten']==='xcally-motion-preview'){this[_0x904f('0x3')]+=0x1;}}if(this[_0x904f('0x3')]>this[_0x904f('0x7')]){this[_0x904f('0x3')]=this['inUse'];}this[_0x904f('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x904f('0x43')]['compareToInboundQueue']=function(_0x282fd6){var _0xa647ea=![];if(_0x282fd6){_0xa647ea=INBOUND_COUNTERS[_0x904f('0x53')](function(_0x32eaea){return this[_0x32eaea]!==_0x282fd6[_0x32eaea];},this);}return _0xa647ea;};VoiceQueueSummary[_0x904f('0x43')][_0x904f('0x54')]=function(_0xcda3f2){var _0x443501=![];var _0x31d10f=![];var _0x30e906=![];if(_0xcda3f2){_0x443501=this[_0x904f('0x22')]!==_0xcda3f2[_0x904f('0x22')]||this[_0x904f('0x21')]!==_0xcda3f2['dialActive']||this[_0x904f('0x3f')]!==_0xcda3f2['message']||this[_0x904f('0x40')]!==_0xcda3f2[_0x904f('0x40')];_0x31d10f=OUTBOUND_COUNTERS[_0x904f('0x53')](function(_0x502c11){return this[_0x502c11]!==_0xcda3f2[_0x502c11];},this);if(this[_0x904f('0x41')]&&_0xcda3f2[_0x904f('0x41')]){_0x30e906=this[_0x904f('0x41')][_0x904f('0x15')]!==_0xcda3f2[_0x904f('0x41')]['name']||this[_0x904f('0x41')][_0x904f('0x55')]!==_0xcda3f2[_0x904f('0x41')][_0x904f('0x55')];}}return _0x443501||_0x31d10f||_0x30e906;};VoiceQueueSummary[_0x904f('0x43')][_0x904f('0x56')]=function(_0xa6f2fe){this[_0x904f('0x6')]=_0xa6f2fe[_0x904f('0x6')];this[_0x904f('0x3f')]=_0xa6f2fe[_0x904f('0x3f')];this['statusMessage']=_0xa6f2fe[_0x904f('0x40')];this['originated']=_0xa6f2fe[_0x904f('0x8')];this[_0x904f('0x9')]=_0xa6f2fe[_0x904f('0x9')];this[_0x904f('0xa')]=_0xa6f2fe[_0x904f('0xa')];this['outboundBlacklistCallsDay']=_0xa6f2fe[_0x904f('0xb')];this[_0x904f('0xc')]=_0xa6f2fe[_0x904f('0xc')];this[_0x904f('0x57')]=_0xa6f2fe['outboundCongestionCallsDay'];this[_0x904f('0xd')]=_0xa6f2fe[_0x904f('0xd')];this['outboundNoSuchCallsDay']=_0xa6f2fe[_0x904f('0xe')];this[_0x904f('0xf')]=_0xa6f2fe[_0x904f('0xf')];this[_0x904f('0x2d')]=_0xa6f2fe[_0x904f('0x2d')];this[_0x904f('0x10')]=_0xa6f2fe[_0x904f('0x10')];this['sumBillable']=_0xa6f2fe[_0x904f('0x12')];this[_0x904f('0x13')]=_0xa6f2fe['sumDuration'];this['total']=_0xa6f2fe[_0x904f('0x14')];if(this[_0x904f('0x22')]===_0x904f('0x58')){this[_0x904f('0x11')]=_0xa6f2fe[_0x904f('0x11')];}};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 e087e7a..d8c523b 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 _0x66e8=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5f3806,_0x31d156){var _0x542069=function(_0x4fc6d6){while(--_0x4fc6d6){_0x5f3806['push'](_0x5f3806['shift']());}};_0x542069(++_0x31d156);}(_0x66e8,0x1f0));var _0x866e=function(_0x6e52d9,_0x38c3ff){_0x6e52d9=_0x6e52d9-0x0;var _0x114f83=_0x66e8[_0x6e52d9];return _0x114f83;};'use strict';function VtigerAccount(_0x30d4d9){this['id']=_0x30d4d9['id']||0x0;this['name']=_0x30d4d9[_0x866e('0x0')]||'';this[_0x866e('0x1')]=_0x30d4d9[_0x866e('0x1')]||'';this[_0x866e('0x2')]=_0x30d4d9['accessKey']||'';this[_0x866e('0x3')]=_0x30d4d9['remoteUri']||'';this['serverUrl']=_0x30d4d9[_0x866e('0x4')]||'';this[_0x866e('0x5')]=_0x30d4d9['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0a56=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a56,0x132));var _0x60a5=function(_0xdbdc0a,_0x1c72d1){_0xdbdc0a=_0xdbdc0a-0x0;var _0x70afc=_0x0a56[_0xdbdc0a];return _0x70afc;};'use strict';function VtigerAccount(_0xea7b92){this['id']=_0xea7b92['id']||0x0;this['name']=_0xea7b92[_0x60a5('0x0')]||'';this[_0x60a5('0x1')]=_0xea7b92[_0x60a5('0x1')]||'';this[_0x60a5('0x2')]=_0xea7b92[_0x60a5('0x2')]||'';this[_0x60a5('0x3')]=_0xea7b92['remoteUri']||'';this[_0x60a5('0x4')]=_0xea7b92[_0x60a5('0x4')]||'';this[_0x60a5('0x5')]=_0xea7b92['Configurations']||{};}module[_0x60a5('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 4865f71..ce1cede 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 _0xe784=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x5ce729,_0x51bbb6){var _0x13a578=function(_0x554502){while(--_0x554502){_0x5ce729['push'](_0x5ce729['shift']());}};_0x13a578(++_0x51bbb6);}(_0xe784,0xa7));var _0x4e78=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe784[_0x1928c9];return _0x51b5fb;};'use strict';function ZendeskAccount(_0x247b7f){this['id']=_0x247b7f['id']||0x0;this[_0x4e78('0x0')]=_0x247b7f[_0x4e78('0x0')]||'';this['username']=_0x247b7f[_0x4e78('0x1')]||'';this['password']=_0x247b7f[_0x4e78('0x2')]||'';this[_0x4e78('0x3')]=_0x247b7f[_0x4e78('0x3')]||'';this['remoteUri']=_0x247b7f[_0x4e78('0x4')]||'';this['authType']=_0x247b7f[_0x4e78('0x5')]||'';this['type']=_0x247b7f[_0x4e78('0x6')]||_0x4e78('0x7');this[_0x4e78('0x8')]=_0x247b7f[_0x4e78('0x8')]||'';this['Configurations']=_0x247b7f[_0x4e78('0x9')]||{};}module[_0x4e78('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x4255=['remoteUri','authType','type','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x506cbf,_0xb7e1d8){var _0x5513f1=function(_0x25a9c4){while(--_0x25a9c4){_0x506cbf['push'](_0x506cbf['shift']());}};_0x5513f1(++_0xb7e1d8);}(_0x4255,0x1dc));var _0x5425=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x4255[_0x12a554];return _0x244ba0;};'use strict';function ZendeskAccount(_0x4b6219){this['id']=_0x4b6219['id']||0x0;this[_0x5425('0x0')]=_0x4b6219[_0x5425('0x0')]||'';this[_0x5425('0x1')]=_0x4b6219[_0x5425('0x1')]||'';this[_0x5425('0x2')]=_0x4b6219[_0x5425('0x2')]||'';this[_0x5425('0x3')]=_0x4b6219[_0x5425('0x3')]||'';this[_0x5425('0x4')]=_0x4b6219[_0x5425('0x4')]||'';this['authType']=_0x4b6219[_0x5425('0x5')]||'';this[_0x5425('0x6')]=_0x4b6219[_0x5425('0x6')]||'integrationTab';this[_0x5425('0x7')]=_0x4b6219[_0x5425('0x7')]||'';this[_0x5425('0x8')]=_0x4b6219[_0x5425('0x8')]||{};}module[_0x5425('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index cb26427..8a85ac9 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 _0x07e5=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x26f650,_0x168c5a){var _0x311307=function(_0x53af15){while(--_0x53af15){_0x26f650['push'](_0x26f650['shift']());}};_0x311307(++_0x168c5a);}(_0x07e5,0x113));var _0x507e=function(_0x363294,_0x3e86d2){_0x363294=_0x363294-0x0;var _0x496446=_0x07e5[_0x363294];return _0x496446;};'use strict';function ZohoAccount(_0x16d45b){this['id']=_0x16d45b['id']||0x0;this[_0x507e('0x0')]=_0x16d45b[_0x507e('0x0')]||'';this[_0x507e('0x1')]=_0x16d45b[_0x507e('0x1')]||'';this['host']=_0x16d45b[_0x507e('0x2')]||'';this[_0x507e('0x3')]=_0x16d45b[_0x507e('0x3')]||'';this[_0x507e('0x4')]=_0x16d45b[_0x507e('0x4')]||'';this[_0x507e('0x5')]=_0x16d45b['clientSecret']||'';this[_0x507e('0x6')]=_0x16d45b[_0x507e('0x6')]||'';this[_0x507e('0x7')]=_0x16d45b[_0x507e('0x7')]||'';this[_0x507e('0x8')]=_0x16d45b[_0x507e('0x8')]||'';this[_0x507e('0x9')]=_0x16d45b[_0x507e('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x5446=['name','description','host','zone','clientId','clientSecret','serverUrl','refreshToken','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5446,0xe1));var _0x6544=function(_0x33a3ab,_0x33810f){_0x33a3ab=_0x33a3ab-0x0;var _0x46e0ff=_0x5446[_0x33a3ab];return _0x46e0ff;};'use strict';function ZohoAccount(_0x38bcdf){this['id']=_0x38bcdf['id']||0x0;this[_0x6544('0x0')]=_0x38bcdf[_0x6544('0x0')]||'';this['description']=_0x38bcdf[_0x6544('0x1')]||'';this[_0x6544('0x2')]=_0x38bcdf[_0x6544('0x2')]||'';this[_0x6544('0x3')]=_0x38bcdf[_0x6544('0x3')]||'';this['clientId']=_0x38bcdf[_0x6544('0x4')]||'';this[_0x6544('0x5')]=_0x38bcdf['clientSecret']||'';this['serverUrl']=_0x38bcdf[_0x6544('0x6')]||'';this['code']=_0x38bcdf['code']||'';this[_0x6544('0x7')]=_0x38bcdf[_0x6544('0x7')]||'';this['Configurations']=_0x38bcdf['Configurations']||{};}module[_0x6544('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f3f7c13..32f987b 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 _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x10cd98,_0x306aa2){var _0x577a59=function(_0x5b0c9e){while(--_0x5b0c9e){_0x10cd98['push'](_0x10cd98['shift']());}};_0x577a59(++_0x306aa2);}(_0xe820,0xd2));var _0x0e82=function(_0x46cd1f,_0xe14fdf){_0x46cd1f=_0x46cd1f-0x0;var _0x3b4f49=_0xe820[_0x46cd1f];return _0x3b4f49;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file +var _0x1c9a=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x34d51e,_0xa3fa9b){var _0x595271=function(_0xf584c){while(--_0xf584c){_0x34d51e['push'](_0x34d51e['shift']());}};_0x595271(++_0xa3fa9b);}(_0x1c9a,0x98));var _0xa1c9=function(_0x5e37dd,_0x2779e0){_0x5e37dd=_0x5e37dd-0x0;var _0x503b5a=_0x1c9a[_0x5e37dd];return _0x503b5a;};'use strict';var util=require(_0xa1c9('0x0'));var _=require('lodash');var moment=require(_0xa1c9('0x1'));function checkNameSurname(_0x5c45c5,_0x1a771d,_0x1d631b){var _0x1a05a3='';if(!_['isNil'](_0x1a771d)&&_0xa1c9('0x2')===typeof _0x1a771d){_0x1a05a3+=_0x1a771d;}if(!_[_0xa1c9('0x3')](_0x1d631b)&&_0xa1c9('0x2')===typeof _0x1d631b){_0x1a05a3+='\x20'+_0x1d631b;}if(_0x1a05a3!==''){return _0x1a05a3;}return _0x5c45c5;}function Action(_0x3a4387,_0x572229,_0x144e91,_0x5448f2,_0x222624){this[_0xa1c9('0x4')]=_0x144e91||undefined;this[_0xa1c9('0x5')]=_0x3a4387['id'];this['queue']=_0x572229[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x572229[_0xa1c9('0x7')];this[_0xa1c9('0x8')]='queue';this[_0xa1c9('0x9')]=![];this[_0xa1c9('0xa')]=_[_0xa1c9('0x3')](_0x3a4387[_0xa1c9('0xb')])?undefined:_0x3a4387[_0xa1c9('0xb')][_0xa1c9('0x6')];this[_0xa1c9('0xc')]=this[_0xa1c9('0xa')]?util[_0xa1c9('0xd')](_0xa1c9('0xe'),this['membername']):_0x5448f2||undefined;this[_0xa1c9('0xf')]=checkNameSurname(_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x11')],_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x12')],_0x3a4387['Contact'][_0xa1c9('0x13')]);this[_0xa1c9('0x14')]=_0x3a4387[_0xa1c9('0x14')]||![];this[_0xa1c9('0x15')]=_0x3a4387[_0xa1c9('0x11')];this[_0xa1c9('0x16')]=_0x3a4387[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3a4387[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3a4387['countcongestionretry']||0x0;this[_0xa1c9('0x19')]=_0x3a4387[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=(_0x3a4387['countbusyretry']||0x0)+(_0x3a4387[_0xa1c9('0x18')]||0x0)+(_0x3a4387['countnoanswerretry']||0x0)+(_0x3a4387[_0xa1c9('0x1b')]||0x0)+(_0x3a4387[_0xa1c9('0x1c')]||0x0)+(_0x3a4387[_0xa1c9('0x1d')]||0x0)+(_0x3a4387['countmachineretry']||0x0)+(_0x3a4387[_0xa1c9('0x1e')]||0x0);this[_0xa1c9('0x1b')]=_0x3a4387[_0xa1c9('0x1b')]||0x0;this['countdropretry']=_0x3a4387[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x1d')]=_0x3a4387['countabandonedretry']||0x0;this[_0xa1c9('0x1f')]=_0x3a4387[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x1e')]=_0x3a4387['countagentrejectretry']||0x0;this[_0xa1c9('0x20')]=_0x3a4387[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3a4387[_0xa1c9('0x21')];this[_0xa1c9('0x22')]=_0x3a4387['callbackat'];this['recallme']=_0x3a4387[_0xa1c9('0x23')];this['ContactId']=_0x3a4387[_0xa1c9('0x24')];this[_0xa1c9('0x25')]=_0x3a4387[_0xa1c9('0x25')];this[_0xa1c9('0x26')]=_[_0xa1c9('0x3')](_0x3a4387['Agent'])?_0x3a4387[_0xa1c9('0x26')]:_0x3a4387[_0xa1c9('0xb')]['id'];this[_0xa1c9('0x27')]=_0x3a4387['VoiceQueueId'];this[_0xa1c9('0x28')]='';this[_0xa1c9('0x29')]='';}Action[_0xa1c9('0x2a')]['getCaller']=function(){return util[_0xa1c9('0xd')](_0xa1c9('0x2b'),this['calleridname'],this[_0xa1c9('0x2c')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 57842fe..c4b5656 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x27b4fe,_0x284597){var _0x398961=function(_0x3d448e){while(--_0x3d448e){_0x27b4fe['push'](_0x27b4fe['shift']());}};_0x398961(++_0x284597);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0xe2a17,_0x10a7e5){var _0x3eab07=function(_0x3a58a0){while(--_0x3a58a0){_0xe2a17['push'](_0xe2a17['shift']());}};_0x3eab07(++_0x10a7e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9077b10..6d56bfd 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 _0xdc6e=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x33dd0c,_0x5be086){var _0x31d7f4=function(_0x4965d7){while(--_0x4965d7){_0x33dd0c['push'](_0x33dd0c['shift']());}};_0x31d7f4(++_0x5be086);}(_0xdc6e,0x1b9));var _0xedc6=function(_0x190dbd,_0x24a507){_0x190dbd=_0x190dbd-0x0;var _0x868d27=_0xdc6e[_0x190dbd];return _0x868d27;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var cmHopper=require(_0xedc6('0x0'));var cmHopperHistory=require(_0xedc6('0x1'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xedc6('0x2'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x42e309){return function(_0x35503b){logger[_0xedc6('0x3')](_0x42e309,util[_0xedc6('0x4')](_0x35503b,{'showHidden':![],'depth':null}));};}function create(_0x2b665e){return cmHopperHistory[_0xedc6('0x5')](_0x2b665e)[_0xedc6('0x6')](loggerCatch(_0xedc6('0x7')));}function createAgent(_0x17b370){return BPromise[_0xedc6('0x8')]()[_0xedc6('0x9')](agentReportPreview[_0xedc6('0x5')](_0x17b370))[_0xedc6('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x57ba09){return cmHopper[_0xedc6('0xa')](_0x57ba09,!![])['catch'](loggerCatch(_0xedc6('0xb')));}exports[_0xedc6('0xc')]=function(_0x10c8e5){return cmHopperBlack[_0xedc6('0xc')](_0x10c8e5)[_0xedc6('0x6')](loggerCatch(_0xedc6('0xd')));};exports[_0xedc6('0xe')]=function(_0x1dcde1){return BPromise[_0xedc6('0x8')]()[_0xedc6('0x9')](cmHopper[_0xedc6('0xe')](_0x1dcde1))[_0xedc6('0x6')](loggerCatch(_0xedc6('0xf')));};exports[_0xedc6('0x5')]=function(_0x29e2c0,_0x3e1962){create(_0x29e2c0)[_0xedc6('0x6')](loggerCatch(_0x3e1962));moveContact(_0x29e2c0)[_0xedc6('0x6')](loggerCatch(_0x3e1962));};exports['createAgentHistory']=function(_0x4c6e62,_0x42243c){createAgent(_0x4c6e62)[_0xedc6('0x6')](loggerCatch(_0x42243c));};exports[_0xedc6('0x10')]=function(_0x2d00f5,_0x13e09d){create(_0x2d00f5)[_0xedc6('0x6')](loggerCatch(_0x13e09d));};exports[_0xedc6('0x11')]=function(_0x44f1f5,_0x214bee){moveContact(_0x44f1f5)[_0xedc6('0x6')](loggerCatch(_0x214bee));};exports[_0xedc6('0x12')]=function(_0xe57659,_0x475460,_0x155916){if(_0x475460){_0xe57659[_0xedc6('0x13')]=null;}if(_0x155916){_0xe57659['active']=![];}return cmHopper[_0xedc6('0x12')](_0xe57659)[_0xedc6('0x6')](loggerCatch(_0xedc6('0x14')));};exports[_0xedc6('0x15')]=function(_0x27deae){return cmHopper[_0xedc6('0x15')](_0x27deae)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xedc6('0x16')]=function(_0x1baa5e){return cmHopper[_0xedc6('0x16')]({'UserId':null},_0x1baa5e,0x1)[_0xedc6('0x6')](loggerCatch(_0xedc6('0x17')));};exports[_0xedc6('0x18')]=function(_0x470c35){return cmHopper[_0xedc6('0x16')]({'active':![]},_0x470c35,0x1)[_0xedc6('0x6')](loggerCatch(_0xedc6('0x19')));};exports[_0xedc6('0x1a')]=function(_0x2e4ec){var _0x3a2b39={};_0x3a2b39['type']=_0x2e4ec['type'];_0x3a2b39['uniqueid']=_0x2e4ec[_0xedc6('0x1b')];_0x3a2b39['calleridnum']=_0x2e4ec[_0xedc6('0x1c')];_0x3a2b39['calleridname']=_0x2e4ec[_0xedc6('0x1d')];_0x3a2b39[_0xedc6('0x1e')]=_0x2e4ec['queue'];_0x3a2b39[_0xedc6('0x1f')]=_0x2e4ec['answertime'];_0x3a2b39[_0xedc6('0x20')]=_0x2e4ec['answertime'];_0x3a2b39[_0xedc6('0x21')]=0x1;_0x3a2b39[_0xedc6('0x22')]=_0x2e4ec['endtime'];_0x3a2b39['connectedlinename']=_0x2e4ec[_0xedc6('0x23')];_0x3a2b39['context']=_0xedc6('0x24');_0x3a2b39[_0xedc6('0x25')]=_0xedc6('0x26');_0x3a2b39[_0xedc6('0x27')]=0x0;_0x3a2b39['assigned']=0x1;_0x3a2b39[_0xedc6('0x28')]=_0x2e4ec[_0xedc6('0x23')];_0x3a2b39[_0xedc6('0x29')]=_0xedc6('0x2a');return BPromise[_0xedc6('0x8')]()[_0xedc6('0x9')](voiceQueueReport[_0xedc6('0x2b')](_0x3a2b39))[_0xedc6('0x6')](loggerCatch(_0xedc6('0x2c')));};exports[_0xedc6('0x2d')]=function(_0x353eab,_0x531aaf){return BPromise['resolve']()[_0xedc6('0x9')](cmHopper['getContactRecallMe'](_0x353eab,_0x531aaf))['catch'](loggerCatch(_0xedc6('0x2e')));};exports[_0xedc6('0x2f')]=function(_0x5d73a0){return cmHopper[_0xedc6('0x12')](_0x5d73a0,!![],!![])[_0xedc6('0x6')](loggerCatch(_0xedc6('0x30')));}; \ No newline at end of file +var _0x2fc1=['inspect','[createHistory]\x20','resolve','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','then','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','context','from-sip','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0x36e059,_0x19ee27){var _0x52ee13=function(_0x3dbfb1){while(--_0x3dbfb1){_0x36e059['push'](_0x36e059['shift']());}};_0x52ee13(++_0x19ee27);}(_0x2fc1,0xcc));var _0x12fc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2fc1[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0x12fc('0x0'));var BPromise=require(_0x12fc('0x1'));var logger=require(_0x12fc('0x2'))(_0x12fc('0x3'));var cmHopper=require(_0x12fc('0x4'));var cmHopperHistory=require(_0x12fc('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x12fc('0x6'));var voiceQueueReport=require(_0x12fc('0x7'));function loggerCatch(_0x31036f){return function(_0x24adbc){logger['error'](_0x31036f,util[_0x12fc('0x8')](_0x24adbc,{'showHidden':![],'depth':null}));};}function create(_0x26702b){return cmHopperHistory['createHistory'](_0x26702b)['catch'](loggerCatch(_0x12fc('0x9')));}function createAgent(_0x206415){return BPromise[_0x12fc('0xa')]()['then'](agentReportPreview['createHistory'](_0x206415))[_0x12fc('0xb')](loggerCatch(_0x12fc('0x9')));}function moveContact(_0x535e41){return cmHopper[_0x12fc('0xc')](_0x535e41,!![])['catch'](loggerCatch(_0x12fc('0xd')));}exports[_0x12fc('0xe')]=function(_0x112512){return cmHopperBlack['checkIsBlackList'](_0x112512)[_0x12fc('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x12fc('0xf')]=function(_0x2611b9){return BPromise[_0x12fc('0xa')]()[_0x12fc('0x10')](cmHopper['getContactPreview'](_0x2611b9))['catch'](loggerCatch(_0x12fc('0x11')));};exports[_0x12fc('0x12')]=function(_0x2d7cbf,_0x1a7002){create(_0x2d7cbf)[_0x12fc('0xb')](loggerCatch(_0x1a7002));moveContact(_0x2d7cbf)[_0x12fc('0xb')](loggerCatch(_0x1a7002));};exports[_0x12fc('0x13')]=function(_0x55113a,_0xda471){createAgent(_0x55113a)[_0x12fc('0xb')](loggerCatch(_0xda471));};exports['createCustomerHistory']=function(_0x59a262,_0x3a07f9){create(_0x59a262)['catch'](loggerCatch(_0x3a07f9));};exports[_0x12fc('0x14')]=function(_0x4da973,_0x3a8df8){moveContact(_0x4da973)[_0x12fc('0xb')](loggerCatch(_0x3a8df8));};exports[_0x12fc('0x15')]=function(_0x579285,_0x3105e1,_0x2d72bc){if(_0x3105e1){_0x579285[_0x12fc('0x16')]=null;}if(_0x2d72bc){_0x579285[_0x12fc('0x17')]=![];}return cmHopper['rescheduleContact'](_0x579285)[_0x12fc('0xb')](loggerCatch(_0x12fc('0x18')));};exports[_0x12fc('0x19')]=function(_0x742142){return cmHopper[_0x12fc('0x19')](_0x742142)['catch'](loggerCatch(_0x12fc('0x1a')));};exports[_0x12fc('0x1b')]=function(_0x4be238){return cmHopper[_0x12fc('0x1b')]({'UserId':null},_0x4be238,0x1)[_0x12fc('0xb')](loggerCatch(_0x12fc('0x1c')));};exports[_0x12fc('0x1d')]=function(_0x2b8e91){return cmHopper['unlockContact']({'active':![]},_0x2b8e91,0x1)[_0x12fc('0xb')](loggerCatch(_0x12fc('0x1e')));};exports[_0x12fc('0x1f')]=function(_0x93c6ef){var _0x4fd12a={};_0x4fd12a[_0x12fc('0x20')]=_0x93c6ef[_0x12fc('0x20')];_0x4fd12a[_0x12fc('0x21')]=_0x93c6ef[_0x12fc('0x21')];_0x4fd12a['calleridnum']=_0x93c6ef[_0x12fc('0x22')];_0x4fd12a[_0x12fc('0x23')]=_0x93c6ef[_0x12fc('0x23')];_0x4fd12a[_0x12fc('0x24')]=_0x93c6ef[_0x12fc('0x24')];_0x4fd12a[_0x12fc('0x25')]=_0x93c6ef[_0x12fc('0x26')];_0x4fd12a[_0x12fc('0x27')]=_0x93c6ef[_0x12fc('0x26')];_0x4fd12a['queuecallercomplete']=0x1;_0x4fd12a[_0x12fc('0x28')]=_0x93c6ef['endtime'];_0x4fd12a[_0x12fc('0x29')]=_0x93c6ef['membername'];_0x4fd12a[_0x12fc('0x2a')]=_0x12fc('0x2b');_0x4fd12a['exten']=_0x12fc('0x2c');_0x4fd12a['holdtime']=0x0;_0x4fd12a[_0x12fc('0x2d')]=0x1;_0x4fd12a['lastAssignedTo']=_0x93c6ef['membername'];_0x4fd12a[_0x12fc('0x2e')]=_0x12fc('0x2f');return BPromise[_0x12fc('0xa')]()['then'](voiceQueueReport[_0x12fc('0x30')](_0x4fd12a))[_0x12fc('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x310de5,_0x418c67){return BPromise[_0x12fc('0xa')]()[_0x12fc('0x10')](cmHopper[_0x12fc('0x31')](_0x310de5,_0x418c67))[_0x12fc('0xb')](loggerCatch(_0x12fc('0x32')));};exports[_0x12fc('0x33')]=function(_0x5ebf90){return cmHopper['rescheduleContact'](_0x5ebf90,!![],!![])[_0x12fc('0xb')](loggerCatch(_0x12fc('0x34')));}; \ 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 ae4424c..eb96371 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 _0xead8=['dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','membername','UserId','getSeconds','answertime','isFailure','Failure','variablesAction','calleridname','uniqueid','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','add','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','queue','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId'];(function(_0x12c0ea,_0x2ed696){var _0x276352=function(_0x18e053){while(--_0x18e053){_0x12c0ea['push'](_0x12c0ea['shift']());}};_0x276352(++_0x2ed696);}(_0xead8,0xf8));var _0x8ead=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0xead8[_0x405778];return _0x341735;};'use strict';var util=require(_0x8ead('0x0'));var _=require('lodash');var moment=require(_0x8ead('0x1'));var logger=require('../../../../config/logger')(_0x8ead('0x2'));var ipAgi=process['env'][_0x8ead('0x3')]||_0x8ead('0x4');var utils=require(_0x8ead('0x5'));exports[_0x8ead('0x6')]=function(_0x4e9d7d){return function(_0x392b70){logger[_0x8ead('0x7')](_0x4e9d7d,util[_0x8ead('0x8')](_0x392b70,{'showHidden':![],'depth':null}));};};exports[_0x8ead('0x9')]=function(_0x4d6fa5,_0x2baced){logger[_0x8ead('0xa')](_0x4d6fa5,util['inspect'](_0x2baced,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x443c5a,_0x33bc5b){logger[_0x8ead('0x7')](_0x443c5a,util[_0x8ead('0x8')](_0x33bc5b,{'showHidden':![],'depth':null}));};exports[_0x8ead('0xb')]=function(_0x17bab3){return function(_0x45a3a2){logger[_0x8ead('0xa')](_0x17bab3,util[_0x8ead('0x8')](_0x45a3a2,{'showHidden':![],'depth':null}));};};exports[_0x8ead('0xc')]=function(_0x222f2a,_0x990d25,_0x3c7e2e){return{'message':_0x222f2a,'unlock':_0x990d25,'active':_0x3c7e2e};};exports[_0x8ead('0xd')]=function(_0x98d6c0,_0x4a64d2,_0x1d9392){if(!_[_0x8ead('0xe')](_0x1d9392)&&_0x8ead('0xf')===typeof _0x1d9392&&!_[_0x8ead('0x10')](_0x1d9392)){if(!_[_0x8ead('0xe')](_0x4a64d2)&&_0x8ead('0xf')===typeof _0x4a64d2&&!_['isEmpty'](_0x4a64d2)){return util[_0x8ead('0x11')]('\x22%s\x22\x20<%s>',_0x4a64d2,_0x1d9392);}return util['format'](_0x8ead('0x12'),_0x1d9392,_0x1d9392);}if(!_[_0x8ead('0xe')](_0x98d6c0)&&_0x8ead('0xf')===typeof _0x98d6c0&&!_['isEmpty'](_0x98d6c0)){return _0x98d6c0;}return _0x8ead('0x13');};exports['isActive']=function(_0x255524){if(_[_0x8ead('0x14')](_0x255524)){return![];}return _0x255524;};exports[_0x8ead('0x15')]=function(_0x254539,_0x5ae084,_0x3be5da,_0x36c41c,_0x55f442,_0x33f594){var _0x8a7ed0={'XMD-QUEUE':_0x5ae084[_0x8ead('0x16')]?_0x5ae084[_0x8ead('0x16')][_0x8ead('0x17')]:'','XMD-CALLERID':_0x36c41c,'XMD-CALLERID-PREVIEW':_0x33f594?util['format'](_0x8ead('0x12'),_0x33f594['calleridname'],_0x33f594[_0x8ead('0x18')]):_0x36c41c,'XMD-DIALID':_0x55f442,'XMD-CONTACTID':_0x5ae084[_0x8ead('0x19')],'XMD-CDRTYPE':_0x8ead('0x1a'),'CALLERID(all)':_0x36c41c,'XMD-VOICEQUEUEID':_0x5ae084[_0x8ead('0x1b')],'XMD-DIALCHANNEL':_0x3be5da,'XMD-DIALTIMEOUT':_0x254539[_0x8ead('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x8ead('0x11')](_0x8ead('0x1d'),_0x254539[_0x8ead('0x1e')]?'g':'',_[_0x8ead('0x10')](_0x254539[_0x8ead('0x1f')])?'':_0x8ead('0x20')),'XMD-DIALURL':_0x254539['dialPreviewUrl']||'','XMD-AGI':_0x254539[_0x8ead('0x21')]?util[_0x8ead('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x254539[_0x8ead('0x21')]):'NONE','XMD-AGIAFTER':_0x254539[_0x8ead('0x1e')]?util[_0x8ead('0x11')](_0x8ead('0x22'),ipAgi,_0x254539[_0x8ead('0x1e')]):_0x8ead('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x33f594?_0x33f594[_0x8ead('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x33f594?_0x33f594[_0x8ead('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x8ead('0x10')](_0x254539[_0x8ead('0x1f')])){_0x8a7ed0[util[_0x8ead('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x254539[_0x8ead('0x1f')];_0x8a7ed0[util['format']('%s',_0x8ead('0x26'))]=_0x55f442;}return _0x8a7ed0;};exports[_0x8ead('0x27')]=function(_0x2a1587){var _0x256fc7={};for(var _0x2f6469 in _0x2a1587){if(_0x2a1587[_0x8ead('0x28')](_0x2f6469)){_0x256fc7[util[_0x8ead('0x11')]('%s',_[_0x8ead('0x29')](_0x2f6469))]=_0x2a1587[_0x2f6469];}}return{'variables':_0x256fc7};};exports[_0x8ead('0x2a')]=function(_0x57081d,_0x151b90){if(!_[_0x8ead('0x14')](_0x57081d)){if(_0x57081d['hasOwnProperty'](_0x8ead('0x2b'))){if(_0x57081d[_0x8ead('0x2b')]>0x0){_0x57081d[_0x8ead('0x2b')]-=0x1;}else{logger[_0x8ead('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x151b90);}}}else{logger[_0x8ead('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x151b90);}};exports[_0x8ead('0x2c')]=function(_0x4e7b31){var _0x3b456a=moment()[_0x8ead('0x11')](_0x8ead('0x2d'));_0x4e7b31[_0x8ead('0x2e')]=0xd;_0x4e7b31[_0x8ead('0x2f')]=_0x8ead('0x30');_0x4e7b31[_0x8ead('0x31')]=_0x3b456a;_0x4e7b31['responsetime']=_0x3b456a;_0x4e7b31[_0x8ead('0x32')]=_0x3b456a;};exports[_0x8ead('0x33')]=function(_0x5cada2,_0x2241a8,_0x582af3){var _0x1d6ea1=moment()[_0x8ead('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cada2[_0x8ead('0x2e')]=_0x2241a8;_0x5cada2[_0x8ead('0x2f')]=_0x582af3;_0x5cada2[_0x8ead('0x34')]=_0x1d6ea1;_0x5cada2[_0x8ead('0x35')]=utils['getSeconds'](_0x5cada2['responsetime'],_0x5cada2[_0x8ead('0x31')]);};exports[_0x8ead('0x36')]=function(_0x102cde,_0x5e1220,_0x35e9b1){_0x102cde[_0x8ead('0x37')]=_0x5e1220;_0x102cde[_0x8ead('0x38')]=_0x35e9b1;};exports['logCustomer']=function(_0xff883b,_0x50ac49,_0x1c8a24){var _0x1c68ea=moment()[_0x8ead('0x11')](_0x8ead('0x2d'));_0xff883b['state']=_0x50ac49;_0xff883b['statedesc']=_0x1c8a24;_0xff883b[_0x8ead('0x34')]=_0xff883b[_0x8ead('0x34')]?_0xff883b[_0x8ead('0x34')]:_0x1c68ea;_0xff883b[_0x8ead('0x32')]=_0xff883b[_0x8ead('0x32')]?_0xff883b['endtime']:_0x1c68ea;_0xff883b[_0x8ead('0x35')]=utils[_0x8ead('0x39')](_0xff883b[_0x8ead('0x34')]||0x0,_0xff883b[_0x8ead('0x31')]||0x0);_0xff883b['talktime']=_0xff883b[_0x8ead('0x3a')]?utils['getSeconds'](_0xff883b[_0x8ead('0x32')],_0xff883b['answertime']):0x0;};exports[_0x8ead('0x3b')]=function(_0x2629ea){return _0x2629ea===_0x8ead('0x3c');};exports[_0x8ead('0x3d')]=function(_0x55909a,_0x50bdaa,_0x280366,_0x181f36,_0x514a20){var _0xf7beab=_0x181f36?'RECALL':_0x55909a[_0x8ead('0x3e')];_0xf7beab=_0x514a20?'BOOKED':_0xf7beab;return{'actionid':_0x55909a[_0x8ead('0x3f')],'action':'originate','channel':_0x55909a[_0x8ead('0x40')],'callerid':util['format'](_0x8ead('0x12'),_0xf7beab,_0x55909a[_0x8ead('0x18')]),'Exten':_0x8ead('0x41'),'Context':_0x8ead('0x42'),'Priority':'1','variable':_0x280366,'timeout':(_0x50bdaa[_0x8ead('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55909a[_0x8ead('0x3f')]};};exports[_0x8ead('0x44')]=function(_0x17ff83){return _0x17ff83['countbusyretry']+_0x17ff83[_0x8ead('0x45')]+_0x17ff83[_0x8ead('0x46')]+_0x17ff83[_0x8ead('0x47')]+_0x17ff83['countnosuchnumberretry'];};exports[_0x8ead('0x48')]=function(_0x1db46a){var _0x26be49=_[_0x8ead('0x49')](_0x1db46a);_0x26be49[_0x8ead('0x2e')]=0xf;_0x26be49[_0x8ead('0x2f')]=_0x8ead('0x4a');return _0x26be49;};exports[_0x8ead('0x4b')]=function(_0x2ed61f,_0x362c8f,_0x5b8879){var _0x3b80e5={};_0x3b80e5[_0x362c8f]=_0x2ed61f[_0x362c8f];_0x3b80e5['active']=![];_0x3b80e5['scheduledat']=moment()[_0x8ead('0x4c')](_0x5b8879,'minutes')['format'](_0x8ead('0x2d'));_0x3b80e5[_0x8ead('0x19')]=_0x2ed61f[_0x8ead('0x19')];_0x3b80e5[_0x8ead('0x4d')]=_0x2ed61f[_0x8ead('0x4d')];_0x3b80e5[_0x8ead('0x1b')]=_0x2ed61f[_0x8ead('0x1b')]||undefined;return _0x3b80e5;};exports[_0x8ead('0x4e')]=function(_0x407cbc,_0xb7316f){if(!_[_0x8ead('0x14')](_0x407cbc)){if(_0x407cbc['pTalking']>0x0){_0x407cbc[_0x8ead('0x4f')]-=0x1;}else{logger['error'](_0xb7316f,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x8ead('0x7')](_0xb7316f,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x8ead('0x50')]=function(_0x555936){if(_0x555936<=0x0){return!![];}return![];};function buildObj(_0x4d2093,_0x51497d,_0x1eb16f){_0x4d2093[_0x8ead('0x51')]=_0x51497d;_0x4d2093[_0x8ead('0x17')]=_0x4d2093['queue'];_0x4d2093['interface']=_0x4d2093[_0x8ead('0x40')];_0x4d2093[_0x8ead('0x52')]=_0x8ead('0x53');if(_0x1eb16f){_0x4d2093[_0x8ead('0x54')]=_0x1eb16f[_0x8ead('0x54')];}return _0x4d2093;}exports[_0x8ead('0x55')]=buildObj;exports[_0x8ead('0x56')]=function(_0x4aac4d){var _0x52e19b=[];for(var _0x204b41 in _0x4aac4d){if(_0x4aac4d[_0x8ead('0x28')](_0x204b41)){if(!_[_0x8ead('0x14')](_0x4aac4d[_0x204b41])&&_0x4aac4d[_0x204b41]['state']==='not_inuse'&&_0x4aac4d[_0x204b41][_0x8ead('0x57')]===_0x8ead('0x58')){_0x52e19b[_0x8ead('0x59')](_0x4aac4d[_0x204b41]['id']);}}}return _0x52e19b;};exports['getDiff']=function(_0x17e771){var _0x33769d=moment()[_0x8ead('0x5a')](0x0);var _0x516999=moment(_0x17e771)['milliseconds'](0x0);return _0x33769d[_0x8ead('0x5b')](_0x516999,_0x8ead('0x5c'));};exports[_0x8ead('0x5d')]=function(_0x4bccd7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bccd7[_0x8ead('0x19')],'ListId':_0x4bccd7[_0x8ead('0x4d')],'VoiceQueueId':_0x4bccd7['VoiceQueueId']||undefined,'CampaignId':_0x4bccd7[_0x8ead('0x5e')]||undefined};};exports[_0x8ead('0x5f')]=function(_0x22a761){if(_0x22a761===_0x8ead('0x3f')||_0x22a761===_0x8ead('0x60')||_0x22a761===_0x8ead('0x61')||_0x22a761===_0x8ead('0x62')||_0x22a761===_0x8ead('0x63')||_0x22a761===_0x8ead('0x64')||_0x22a761===_0x8ead('0x37')||_0x22a761===_0x8ead('0x40')||_0x22a761===_0x8ead('0x3e')||_0x22a761==='active'||_0x22a761===_0x8ead('0x18')||_0x22a761===_0x8ead('0x65')||_0x22a761===_0x8ead('0x66')||_0x22a761===_0x8ead('0x45')||_0x22a761==='countnoanswerretry'||_0x22a761===_0x8ead('0x67')||_0x22a761===_0x8ead('0x68')||_0x22a761===_0x8ead('0x69')||_0x22a761===_0x8ead('0x6a')||_0x22a761===_0x8ead('0x6b')||_0x22a761==='ContactId'||_0x22a761==='ListId'||_0x22a761===_0x8ead('0x38')||_0x22a761===_0x8ead('0x1b')||_0x22a761===_0x8ead('0x6c')||_0x22a761===_0x8ead('0x6d')||_0x22a761===_0x8ead('0x6e')||_0x22a761==='xmd-phone'||_0x22a761==='xmd-listid'||_0x22a761===_0x8ead('0x6f')||_0x22a761===_0x8ead('0x70')||_0x22a761===_0x8ead('0x71')||_0x22a761==='xmd-dialid'||_0x22a761===_0x8ead('0x72')||_0x22a761===_0x8ead('0x73')||_0x22a761===_0x8ead('0x74')||_0x22a761==='xmd-callerid'||_0x22a761==='xmd-agiafter'||_0x22a761===_0x8ead('0x75')||_0x22a761===_0x8ead('0x76')||_0x22a761===_0x8ead('0x77')||_0x22a761===_0x8ead('0x78')||_0x22a761===_0x8ead('0x79')||_0x22a761===_0x8ead('0x7a')||_0x22a761===_0x8ead('0x7b')||_0x22a761===_0x8ead('0x7c')||_0x22a761===_0x8ead('0x7d')||_0x22a761==='rtpaudioqos'||_0x22a761===_0x8ead('0x77')||_0x22a761===_0x8ead('0x78')||_0x22a761===_0x8ead('0x79')||_0x22a761===_0x8ead('0x7a')||_0x22a761===_0x8ead('0x7b')||_0x22a761===_0x8ead('0x7c')||_0x22a761===_0x8ead('0x7d')||_0x22a761===_0x8ead('0x7e')||_0x22a761==='bridgepvtcallid'||_0x22a761===_0x8ead('0x2e')||_0x22a761===_0x8ead('0x2f')){return![];}return!![];};exports[_0x8ead('0x7f')]=function(_0x4d52b7,_0x2c1c4a){var _0x3d843a,_0x30709c,_0x1875be;if(_0x2c1c4a<=0x0){_0x2c1c4a=0x1;}_0x3d843a=new RegExp('\x5cw{0,'+_0x2c1c4a+'}$');_0x30709c=Math[_0x8ead('0x80')](0xa,_0x2c1c4a-0x1);_0x1875be=Math[_0x8ead('0x80')](0xa,_0x2c1c4a)-0x1;return util[_0x8ead('0x11')]('%s',_[_0x8ead('0x81')](_0x4d52b7,_0x3d843a,_[_0x8ead('0x82')](_0x30709c,_0x1875be)));};exports['extractCalleridName']=function(_0x396dc9){var _0x229038=_0x396dc9['match'](/"(.*?)"/);return _0x229038?_0x229038[0x1]:_0x396dc9;};exports[_0x8ead('0x83')]=function(_0x322411){var _0x218f14=_0x322411[_0x8ead('0x84')](/<(.*?)>/);return _0x218f14?_0x218f14[0x1]:_0x322411;};function buildNoAnswerEventPayload(_0x1c297f,_0x15b897){var _0x36da00=buildObj(_0x1c297f,_0x8ead('0x85'));if(!_[_0x8ead('0x10')](_0x15b897[_0x8ead('0x86')])){Object['keys'](_0x15b897[_0x8ead('0x86')])[_0x8ead('0x87')](function(_0x297231){_0x36da00[_0x297231[_0x8ead('0x88')]()]=_0x15b897[_0x8ead('0x86')][_0x297231];});}return _0x36da00;}exports[_0x8ead('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x626d=['xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','loggerError','info','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','endtime','state','responsetime','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countnoanswerretry','cloneAction','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','seconds','createBody','CampaignId','queue','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialchannel'];(function(_0x5e12e6,_0x390ea4){var _0x4bb4a5=function(_0x246926){while(--_0x246926){_0x5e12e6['push'](_0x5e12e6['shift']());}};_0x4bb4a5(++_0x390ea4);}(_0x626d,0xa0));var _0xd626=function(_0x4da317,_0x3ccdb6){_0x4da317=_0x4da317-0x0;var _0x4d0241=_0x626d[_0x4da317];return _0x4d0241;};'use strict';var util=require(_0xd626('0x0'));var _=require('lodash');var moment=require(_0xd626('0x1'));var logger=require(_0xd626('0x2'))(_0xd626('0x3'));var ipAgi=process['env'][_0xd626('0x4')]||_0xd626('0x5');var utils=require(_0xd626('0x6'));exports[_0xd626('0x7')]=function(_0xada387){return function(_0x48c737){logger[_0xd626('0x8')](_0xada387,util['inspect'](_0x48c737,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x43a28e,_0x57edb5){logger['info'](_0x43a28e,util[_0xd626('0x9')](_0x57edb5,{'showHidden':![],'depth':null}));};exports[_0xd626('0xa')]=function(_0x546d4c,_0x13be72){logger['error'](_0x546d4c,util[_0xd626('0x9')](_0x13be72,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xa3618e){return function(_0x287204){logger[_0xd626('0xb')](_0xa3618e,util['inspect'](_0x287204,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x529753,_0x4d0a2d,_0x42d987){return{'message':_0x529753,'unlock':_0x4d0a2d,'active':_0x42d987};};exports[_0xd626('0xc')]=function(_0x3d4e03,_0x3e9f7c,_0x406abb){if(!_[_0xd626('0xd')](_0x406abb)&&'string'===typeof _0x406abb&&!_[_0xd626('0xe')](_0x406abb)){if(!_[_0xd626('0xd')](_0x3e9f7c)&&_0xd626('0xf')===typeof _0x3e9f7c&&!_[_0xd626('0xe')](_0x3e9f7c)){return util[_0xd626('0x10')](_0xd626('0x11'),_0x3e9f7c,_0x406abb);}return util[_0xd626('0x10')](_0xd626('0x11'),_0x406abb,_0x406abb);}if(!_['isUndefined'](_0x3d4e03)&&'string'===typeof _0x3d4e03&&!_[_0xd626('0xe')](_0x3d4e03)){return _0x3d4e03;}return _0xd626('0x12');};exports['isActive']=function(_0xac463e){if(_[_0xd626('0x13')](_0xac463e)){return![];}return _0xac463e;};exports['addVariables']=function(_0x1213b4,_0x3c73d1,_0x43a015,_0x4c98f0,_0x348b42,_0x177fd9){var _0x20edf7={'XMD-QUEUE':_0x3c73d1[_0xd626('0x14')]?_0x3c73d1[_0xd626('0x14')][_0xd626('0x15')]:'','XMD-CALLERID':_0x4c98f0,'XMD-CALLERID-PREVIEW':_0x177fd9?util[_0xd626('0x10')](_0xd626('0x11'),_0x177fd9['calleridname'],_0x177fd9[_0xd626('0x16')]):_0x4c98f0,'XMD-DIALID':_0x348b42,'XMD-CONTACTID':_0x3c73d1[_0xd626('0x17')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4c98f0,'XMD-VOICEQUEUEID':_0x3c73d1[_0xd626('0x18')],'XMD-DIALCHANNEL':_0x43a015,'XMD-DIALTIMEOUT':_0x1213b4[_0xd626('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xd626('0x10')](_0xd626('0x1a'),_0x1213b4[_0xd626('0x1b')]?'g':'',_['isEmpty'](_0x1213b4['monitor_format'])?'':_0xd626('0x1c')),'XMD-DIALURL':_0x1213b4[_0xd626('0x1d')]||'','XMD-AGI':_0x1213b4[_0xd626('0x1e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x1213b4['dialQueueProject']):_0xd626('0x1f'),'XMD-AGIAFTER':_0x1213b4[_0xd626('0x1b')]?util[_0xd626('0x10')](_0xd626('0x20'),ipAgi,_0x1213b4[_0xd626('0x1b')]):_0xd626('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x177fd9?_0x177fd9[_0xd626('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x177fd9?_0x177fd9['originatecalleridname']:'','XMD-DESTINATION':_0xd626('0x22'),'SIPADDHEADER':_0xd626('0x23')};if(!_[_0xd626('0xe')](_0x1213b4[_0xd626('0x24')])){_0x20edf7[util[_0xd626('0x10')]('%s',_0xd626('0x25'))]=_0x1213b4[_0xd626('0x24')];_0x20edf7[util[_0xd626('0x10')]('%s',_0xd626('0x26'))]=_0x348b42;}return _0x20edf7;};exports[_0xd626('0x27')]=function(_0x4fe4fb){var _0x249dba={};for(var _0x1face7 in _0x4fe4fb){if(_0x4fe4fb[_0xd626('0x28')](_0x1face7)){_0x249dba[util[_0xd626('0x10')]('%s',_['toLower'](_0x1face7))]=_0x4fe4fb[_0x1face7];}}return{'variables':_0x249dba};};exports[_0xd626('0x29')]=function(_0x5c0355,_0x366157){if(!_[_0xd626('0x13')](_0x5c0355)){if(_0x5c0355[_0xd626('0x28')](_0xd626('0x2a'))){if(_0x5c0355[_0xd626('0x2a')]>0x0){_0x5c0355['originated']-=0x1;}else{logger[_0xd626('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x366157);}}}else{logger['error'](_0xd626('0x2b'),_0x366157);}};exports[_0xd626('0x2c')]=function(_0x10302d){var _0x220e0c=moment()['format'](_0xd626('0x2d'));_0x10302d['state']=0xd;_0x10302d[_0xd626('0x2e')]=_0xd626('0x2f');_0x10302d['starttime']=_0x220e0c;_0x10302d['responsetime']=_0x220e0c;_0x10302d[_0xd626('0x30')]=_0x220e0c;};exports['logAgent']=function(_0x4a67b3,_0x44a18a,_0x56158e){var _0x12b333=moment()[_0xd626('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a67b3[_0xd626('0x31')]=_0x44a18a;_0x4a67b3[_0xd626('0x2e')]=_0x56158e;_0x4a67b3[_0xd626('0x32')]=_0x12b333;_0x4a67b3[_0xd626('0x33')]=utils[_0xd626('0x34')](_0x4a67b3[_0xd626('0x32')],_0x4a67b3[_0xd626('0x35')]);};exports[_0xd626('0x36')]=function(_0x188e83,_0x52a272,_0x117d11){_0x188e83[_0xd626('0x37')]=_0x52a272;_0x188e83[_0xd626('0x38')]=_0x117d11;};exports[_0xd626('0x39')]=function(_0x322f24,_0x29c0c9,_0x158dc9){var _0x2231ab=moment()[_0xd626('0x10')](_0xd626('0x2d'));_0x322f24[_0xd626('0x31')]=_0x29c0c9;_0x322f24[_0xd626('0x2e')]=_0x158dc9;_0x322f24[_0xd626('0x32')]=_0x322f24[_0xd626('0x32')]?_0x322f24[_0xd626('0x32')]:_0x2231ab;_0x322f24[_0xd626('0x30')]=_0x322f24[_0xd626('0x30')]?_0x322f24['endtime']:_0x2231ab;_0x322f24['ringtime']=utils[_0xd626('0x34')](_0x322f24[_0xd626('0x32')]||0x0,_0x322f24[_0xd626('0x35')]||0x0);_0x322f24[_0xd626('0x3a')]=_0x322f24[_0xd626('0x3b')]?utils[_0xd626('0x34')](_0x322f24['endtime'],_0x322f24[_0xd626('0x3b')]):0x0;};exports[_0xd626('0x3c')]=function(_0x19b200){return _0x19b200==='Failure';};exports[_0xd626('0x3d')]=function(_0x2f8c0f,_0x515e40,_0x4c9f0c,_0x45a393,_0x479262){var _0x1284b7=_0x45a393?_0xd626('0x3e'):_0x2f8c0f[_0xd626('0x3f')];_0x1284b7=_0x479262?_0xd626('0x40'):_0x1284b7;return{'actionid':_0x2f8c0f[_0xd626('0x41')],'action':_0xd626('0x42'),'channel':_0x2f8c0f['channelAgent'],'callerid':util[_0xd626('0x10')](_0xd626('0x11'),_0x1284b7,_0x2f8c0f[_0xd626('0x16')]),'Exten':_0xd626('0x22'),'Context':_0xd626('0x43'),'Priority':'1','variable':_0x4c9f0c,'timeout':(_0x515e40[_0xd626('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2f8c0f[_0xd626('0x41')]};};exports[_0xd626('0x45')]=function(_0x3f4a7f){return _0x3f4a7f['countbusyretry']+_0x3f4a7f['countcongestionretry']+_0x3f4a7f[_0xd626('0x46')]+_0x3f4a7f['countagentrejectretry']+_0x3f4a7f['countnosuchnumberretry'];};exports[_0xd626('0x47')]=function(_0x3e0ab8){var _0x2a2ea0=_['clone'](_0x3e0ab8);_0x2a2ea0['state']=0xf;_0x2a2ea0[_0xd626('0x2e')]='Global';return _0x2a2ea0;};exports[_0xd626('0x48')]=function(_0x2b5c83,_0x460c04,_0x34db0b){var _0x47bf34={};_0x47bf34[_0x460c04]=_0x2b5c83[_0x460c04];_0x47bf34[_0xd626('0x49')]=![];_0x47bf34[_0xd626('0x4a')]=moment()['add'](_0x34db0b,_0xd626('0x4b'))[_0xd626('0x10')](_0xd626('0x2d'));_0x47bf34[_0xd626('0x17')]=_0x2b5c83[_0xd626('0x17')];_0x47bf34[_0xd626('0x4c')]=_0x2b5c83[_0xd626('0x4c')];_0x47bf34[_0xd626('0x18')]=_0x2b5c83[_0xd626('0x18')]||undefined;return _0x47bf34;};exports[_0xd626('0x4d')]=function(_0x4396bb,_0x288fe9){if(!_[_0xd626('0x13')](_0x4396bb)){if(_0x4396bb[_0xd626('0x4e')]>0x0){_0x4396bb[_0xd626('0x4e')]-=0x1;}else{logger[_0xd626('0x8')](_0x288fe9,_0xd626('0x4f'));}}else{logger[_0xd626('0x8')](_0x288fe9,_0xd626('0x50'));}};exports[_0xd626('0x51')]=function(_0x2b83d7){if(_0x2b83d7<=0x0){return!![];}return![];};function buildObj(_0x3182be,_0x111b78,_0x24ffd9){_0x3182be['lastevent']=_0x111b78;_0x3182be[_0xd626('0x15')]=_0x3182be['queue'];_0x3182be[_0xd626('0x52')]=_0x3182be['channelAgent'];_0x3182be[_0xd626('0x53')]=_0xd626('0x54');if(_0x24ffd9){_0x3182be[_0xd626('0x55')]=_0x24ffd9[_0xd626('0x55')];}return _0x3182be;}exports[_0xd626('0x56')]=buildObj;exports[_0xd626('0x57')]=function(_0x2dc320){var _0x5db1b8=[];for(var _0x503e5f in _0x2dc320){if(_0x2dc320['hasOwnProperty'](_0x503e5f)){if(!_['isNil'](_0x2dc320[_0x503e5f])&&_0x2dc320[_0x503e5f]['state']===_0xd626('0x58')&&_0x2dc320[_0x503e5f][_0xd626('0x59')]===_0xd626('0x5a')){_0x5db1b8[_0xd626('0x5b')](_0x2dc320[_0x503e5f]['id']);}}}return _0x5db1b8;};exports['getDiff']=function(_0x194b75){var _0x345e00=moment()['milliseconds'](0x0);var _0x5281ce=moment(_0x194b75)[_0xd626('0x5c')](0x0);return _0x345e00['diff'](_0x5281ce,_0xd626('0x5d'));};exports[_0xd626('0x5e')]=function(_0x4676af){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4676af[_0xd626('0x17')],'ListId':_0x4676af[_0xd626('0x4c')],'VoiceQueueId':_0x4676af[_0xd626('0x18')]||undefined,'CampaignId':_0x4676af[_0xd626('0x5f')]||undefined};};exports['filterKey']=function(_0x276832){if(_0x276832===_0xd626('0x41')||_0x276832==='idContact'||_0x276832===_0xd626('0x60')||_0x276832===_0xd626('0x61')||_0x276832===_0xd626('0x62')||_0x276832===_0xd626('0x63')||_0x276832===_0xd626('0x37')||_0x276832==='channelAgent'||_0x276832===_0xd626('0x3f')||_0x276832==='active'||_0x276832==='calleridnum'||_0x276832===_0xd626('0x4a')||_0x276832==='countbusyretry'||_0x276832===_0xd626('0x64')||_0x276832==='countnoanswerretry'||_0x276832===_0xd626('0x65')||_0x276832===_0xd626('0x66')||_0x276832==='callbackuniqueid'||_0x276832==='callbackat'||_0x276832===_0xd626('0x67')||_0x276832===_0xd626('0x17')||_0x276832===_0xd626('0x4c')||_0x276832===_0xd626('0x38')||_0x276832===_0xd626('0x18')||_0x276832===_0xd626('0x68')||_0x276832===_0xd626('0x69')||_0x276832===_0xd626('0x6a')||_0x276832===_0xd626('0x6b')||_0x276832==='xmd-listid'||_0x276832===_0xd626('0x6c')||_0x276832==='xmd-dialtimeout'||_0x276832==='xmd-dialoptions'||_0x276832==='xmd-dialid'||_0x276832===_0xd626('0x6d')||_0x276832===_0xd626('0x6e')||_0x276832===_0xd626('0x6f')||_0x276832===_0xd626('0x70')||_0x276832===_0xd626('0x71')||_0x276832===_0xd626('0x72')||_0x276832===_0xd626('0x73')||_0x276832===_0xd626('0x74')||_0x276832===_0xd626('0x75')||_0x276832===_0xd626('0x76')||_0x276832===_0xd626('0x77')||_0x276832===_0xd626('0x78')||_0x276832===_0xd626('0x79')||_0x276832==='rtpaudioqosrttbridged'||_0x276832==='rtpaudioqos'||_0x276832===_0xd626('0x74')||_0x276832===_0xd626('0x75')||_0x276832===_0xd626('0x76')||_0x276832===_0xd626('0x77')||_0x276832===_0xd626('0x78')||_0x276832===_0xd626('0x79')||_0x276832==='rtpaudioqosrttbridged'||_0x276832==='bridgepeer'||_0x276832===_0xd626('0x7a')||_0x276832===_0xd626('0x31')||_0x276832===_0xd626('0x2e')){return![];}return!![];};exports[_0xd626('0x7b')]=function(_0x189280,_0x33aa27){var _0x3a124c,_0x1c8fac,_0x340e08;if(_0x33aa27<=0x0){_0x33aa27=0x1;}_0x3a124c=new RegExp('\x5cw{0,'+_0x33aa27+'}$');_0x1c8fac=Math[_0xd626('0x7c')](0xa,_0x33aa27-0x1);_0x340e08=Math[_0xd626('0x7c')](0xa,_0x33aa27)-0x1;return util[_0xd626('0x10')]('%s',_[_0xd626('0x7d')](_0x189280,_0x3a124c,_[_0xd626('0x7e')](_0x1c8fac,_0x340e08)));};exports[_0xd626('0x7f')]=function(_0xfc6c32){var _0x55c5cd=_0xfc6c32[_0xd626('0x80')](/"(.*?)"/);return _0x55c5cd?_0x55c5cd[0x1]:_0xfc6c32;};exports[_0xd626('0x81')]=function(_0x294167){var _0x57db4b=_0x294167[_0xd626('0x80')](/<(.*?)>/);return _0x57db4b?_0x57db4b[0x1]:_0x294167;};function buildNoAnswerEventPayload(_0x6dacf0,_0x460be3){var _0x27d2ae=buildObj(_0x6dacf0,_0xd626('0x82'));if(!_[_0xd626('0xe')](_0x460be3[_0xd626('0x83')])){Object[_0xd626('0x84')](_0x460be3[_0xd626('0x83')])[_0xd626('0x85')](function(_0x5edd34){_0x27d2ae[_0x5edd34['toLowerCase']()]=_0x460be3[_0xd626('0x83')][_0x5edd34];});}return _0x27d2ae;}exports[_0xd626('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8ebac99..c36469e 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 _0x41a3=['number','boolean','queueremove','queuepause','reload','queueadd','string'];(function(_0x46d1f0,_0x6bb3bc){var _0x1dfb50=function(_0x25c0a6){while(--_0x25c0a6){_0x46d1f0['push'](_0x46d1f0['shift']());}};_0x1dfb50(++_0x6bb3bc);}(_0x41a3,0x1a2));var _0x341a=function(_0x2531e7,_0xa5007a){_0x2531e7=_0x2531e7-0x0;var _0x27beec=_0x41a3[_0x2531e7];return _0x27beec;};'use strict';exports[_0x341a('0x0')]={'queue':{'type':_0x341a('0x1'),'required':!![]},'interface':{'type':_0x341a('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x341a('0x2'),'required':![]},'paused':{'type':_0x341a('0x3'),'required':![]}};exports[_0x341a('0x4')]={'queue':{'type':_0x341a('0x1'),'required':!![]},'interface':{'type':_0x341a('0x1'),'required':!![]}};exports[_0x341a('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x341a('0x3')},'reason':{'type':_0x341a('0x1'),'required':![]}};exports[_0x341a('0x6')]={'module':{'type':_0x341a('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x341a('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x341a('0x1'),'required':!![]},'filename':{'type':_0x341a('0x1')},'format':{'type':_0x341a('0x1')},'mixmonitorid':{'type':_0x341a('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x341a('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x341a('0x1'),'required':!![]},'exten':{'type':_0x341a('0x1'),'required':!![]},'context':{'type':_0x341a('0x1')}}; \ No newline at end of file +var _0x2618=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause'];(function(_0x26cce8,_0x56ca69){var _0x176f4c=function(_0x56631d){while(--_0x56631d){_0x26cce8['push'](_0x26cce8['shift']());}};_0x176f4c(++_0x56ca69);}(_0x2618,0x124));var _0x8261=function(_0x30ccf7,_0x372388){_0x30ccf7=_0x30ccf7-0x0;var _0x5e9344=_0x2618[_0x30ccf7];return _0x5e9344;};'use strict';exports['queueadd']={'queue':{'type':_0x8261('0x0'),'required':!![]},'interface':{'type':_0x8261('0x0'),'required':!![]},'membername':{'type':_0x8261('0x0'),'required':!![]},'penalty':{'type':_0x8261('0x1'),'required':![]},'paused':{'type':_0x8261('0x2'),'required':![]}};exports[_0x8261('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8261('0x0'),'required':!![]}};exports[_0x8261('0x4')]={'interface':{'type':_0x8261('0x0'),'required':!![]},'paused':{'type':_0x8261('0x2')},'reason':{'type':_0x8261('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x8261('0x0'),'required':![]}};exports[_0x8261('0x5')]={'uniqueid':{'type':_0x8261('0x0'),'required':!![]}};exports[_0x8261('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8261('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x8261('0x0')}};exports[_0x8261('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8261('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8261('0x0'),'required':!![]},'context':{'type':_0x8261('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6ad927d..2991908 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0xc0a4ed,_0x38de4e){var _0x3fddc9=function(_0x247e57){while(--_0x247e57){_0xc0a4ed['push'](_0xc0a4ed['shift']());}};_0x3fddc9(++_0x38de4e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x313c4e,_0x553488){_0x313c4e=_0x313c4e-0x0;var _0x2aab8e=_0x5f2f[_0x313c4e];return _0x2aab8e;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0e,0x187));var _0xe0b0=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x0b0e[_0x50b1c5];return _0x344f99;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 839ccfe..14bcd09 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 _0x3ce0=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x4f51b4,_0x21e931){var _0x9e3c22=function(_0x28193c){while(--_0x28193c){_0x4f51b4['push'](_0x4f51b4['shift']());}};_0x9e3c22(++_0x21e931);}(_0x3ce0,0x8a));var _0x03ce=function(_0x1b0ddd,_0x38964c){_0x1b0ddd=_0x1b0ddd-0x0;var _0xea784d=_0x3ce0[_0x1b0ddd];return _0xea784d;};'use strict';function mergeDBDataToRealtime(_0x1016cd,_0x17946a){var _0x5607cf=Object['assign']({},_0x1016cd);for(var _0x592537 in _0x17946a){if(_0x5607cf[_0x03ce('0x0')](_0x592537)){_0x5607cf[_0x592537]=_0x17946a[_0x592537];}}return _0x5607cf;}exports[_0x03ce('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xe612=['assign','mergeDBDataToRealtime'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0xe612,0x15e));var _0x2e61=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe612[_0x397e5f];return _0x5302b8;};'use strict';function mergeDBDataToRealtime(_0x437651,_0x1e37f8){var _0x4efa74=Object[_0x2e61('0x0')]({},_0x437651);for(var _0x2b6e23 in _0x1e37f8){if(_0x4efa74['hasOwnProperty'](_0x2b6e23)){_0x4efa74[_0x2b6e23]=_0x1e37f8[_0x2b6e23];}}return _0x4efa74;}exports[_0x2e61('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 bd47e16..30cd8e5 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 _0x1482=['telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','SIP/%s','length','lastAssignedTo','isNil','format','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','create','match','getAgentByInternal','keys','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors','monitorFilename','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents'];(function(_0x35b31d,_0x241cb8){var _0x4817e5=function(_0x18b45d){while(--_0x18b45d){_0x35b31d['push'](_0x35b31d['shift']());}};_0x4817e5(++_0x241cb8);}(_0x1482,0xa6));var _0x2148=function(_0x22b7d4,_0x1704c0){_0x22b7d4=_0x22b7d4-0x0;var _0x24be08=_0x1482[_0x22b7d4];return _0x24be08;};'use strict';var _=require(_0x2148('0x0'));var moment=require('moment');var util=require(_0x2148('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2148('0x2'));var RpcVoiceCallReport=require(_0x2148('0x3'));var RpcVoiceDialReport=require(_0x2148('0x4'));var RpcMemberReport=require(_0x2148('0x5'));var RpcVoiceQueueReport=require(_0x2148('0x6'));var RpcVoiceRecording=require(_0x2148('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2148('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2148('0x9'));var VoiceDialReport=require(_0x2148('0xa'));var UserReport=require(_0x2148('0xb'));function Report(_0x268f57){this[_0x2148('0xc')]=_0x268f57;this[_0x2148('0xd')]=_0x268f57[_0x2148('0xd')];this[_0x2148('0xe')]=_0x268f57['telephones'];}Report[_0x2148('0xf')][_0x2148('0x10')]=function(_0x232cd1){var _0x44d051=new VoiceQueueReport(this['realtime']);var _0x5a5d00=new VoiceAgentReport(this[_0x2148('0xc')]);var _0x5a4e3d=new VoiceDialReport(this[_0x2148('0xc')]);var _0x21a9f2=new VoiceCallReport(this['realtime']);var _0x124887=new UserReport(this[_0x2148('0xc')]);if(config[_0x2148('0x11')]&&config['xdr']['disabled']){ami['on'](_0x2148('0x12'),this['voiceQueueReport'][_0x2148('0x13')](this));ami['on'](_0x2148('0x14'),this[_0x2148('0x15')][_0x2148('0x13')](this));ami['on'](_0x2148('0x16'),this[_0x2148('0x17')][_0x2148('0x13')](this));ami['on'](_0x2148('0x18'),this[_0x2148('0x19')][_0x2148('0x13')](this));ami['on']('blindtransfer',this[_0x2148('0x1a')]['bind'](this));ami['on'](_0x2148('0x1b'),this[_0x2148('0x1c')][_0x2148('0x13')](this));}};Report[_0x2148('0xf')][_0x2148('0x1d')]=function(_0x1d8485){var _0x57d69d;_0x57d69d=_[_0x2148('0x1e')](this[_0x2148('0xd')],function(_0x557303){return _0x557303[_0x2148('0x1f')]==_0x1d8485||_0x557303[_0x2148('0x20')]==_0x1d8485;});if(_['isNil'](_0x57d69d)){var _0x413ce4=_[_0x2148('0x1e')](this[_0x2148('0xe')],function(_0x5d77cc){return _0x5d77cc[_0x2148('0x1f')]==_0x1d8485||_0x5d77cc[_0x2148('0x20')]==_0x1d8485;});if(_0x413ce4){_0x57d69d=_['find'](this[_0x2148('0xd')],function(_0x4e3de1){return _0x4e3de1[_0x2148('0x21')]==util['format'](_0x2148('0x22'),_0x413ce4[_0x2148('0x20')]);});}}return _0x57d69d;};Report[_0x2148('0xf')]['voiceQueueReport']=function(_0x20e01d){for(var _0x28a3ba=0x0;_0x28a3ba<_0x20e01d[_0x2148('0x23')];_0x28a3ba+=0x1){var _0x5874f3=this[_0x2148('0x1d')](_0x20e01d[_0x28a3ba]['connectedlinenum']);if(_0x5874f3){_0x20e01d[_0x28a3ba]['accountcode']=_0x5874f3['accountcode'];_0x20e01d[_0x28a3ba]['assigned']=!![];_0x20e01d[_0x28a3ba][_0x2148('0x24')]=_0x5874f3['name'];_0x20e01d[_0x28a3ba][_0x2148('0x21')]=_[_0x2148('0x25')](_0x5874f3['interface'])?util[_0x2148('0x26')](_0x2148('0x22'),_0x5874f3[_0x2148('0x20')]):_0x5874f3[_0x2148('0x21')];if(_0x20e01d[_0x28a3ba][_0x2148('0x27')]){_0x20e01d[_0x28a3ba][_0x2148('0x28')]=moment()[_0x2148('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x20e01d[_0x28a3ba]['queuecallerexit']){_0x20e01d[_0x28a3ba][_0x2148('0x29')]=moment()[_0x2148('0x26')](_0x2148('0x2a'));}RpcMemberReport[_0x2148('0x2b')](_0x20e01d[_0x28a3ba]);}RpcVoiceQueueReport[_0x2148('0x2c')](_0x20e01d[_0x28a3ba]);}};function extractCalleridNumber(_0x4f0d14){var _0xd0f5c6=_0x4f0d14[_0x2148('0x2d')](/<(.*?)>/);return _0xd0f5c6?_0xd0f5c6[0x1]:_0x4f0d14;}Report[_0x2148('0xf')][_0x2148('0x2e')]=function(_0x2d25ca){for(var _0x346431=0x0;_0x346431','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','UserId','membername','monitor','monitors','monitorFilename','filename'];(function(_0x3a9d77,_0xdc466){var _0x130f80=function(_0x740c4a){while(--_0x740c4a){_0x3a9d77['push'](_0x3a9d77['shift']());}};_0x130f80(++_0xdc466);}(_0xf9e8,0x71));var _0x8f9e=function(_0x44b5d9,_0xe28bb1){_0x44b5d9=_0x44b5d9-0x0;var _0x25d599=_0xf9e8[_0x44b5d9];return _0x25d599;};'use strict';var _=require(_0x8f9e('0x0'));var moment=require(_0x8f9e('0x1'));var util=require(_0x8f9e('0x2'));var config=require('../../../config/environment');var ami=require(_0x8f9e('0x3'));var RpcVoiceAgentReport=require(_0x8f9e('0x4'));var RpcVoiceCallReport=require(_0x8f9e('0x5'));var RpcVoiceDialReport=require(_0x8f9e('0x6'));var RpcMemberReport=require(_0x8f9e('0x7'));var RpcVoiceQueueReport=require(_0x8f9e('0x8'));var RpcVoiceRecording=require(_0x8f9e('0x9'));var RpcVoiceTransferReport=require(_0x8f9e('0xa'));var VoiceQueueReport=require(_0x8f9e('0xb'));var VoiceCallReport=require(_0x8f9e('0xc'));var VoiceAgentReport=require(_0x8f9e('0xd'));var VoiceDialReport=require(_0x8f9e('0xe'));var UserReport=require(_0x8f9e('0xf'));function Report(_0x4549e8){this[_0x8f9e('0x10')]=_0x4549e8;this['agents']=_0x4549e8[_0x8f9e('0x11')];this[_0x8f9e('0x12')]=_0x4549e8[_0x8f9e('0x12')];}Report['prototype'][_0x8f9e('0x13')]=function(_0x2b6242){var _0x49e2c2=new VoiceQueueReport(this['realtime']);var _0x35a872=new VoiceAgentReport(this[_0x8f9e('0x10')]);var _0x193fa0=new VoiceDialReport(this[_0x8f9e('0x10')]);var _0x56425e=new VoiceCallReport(this[_0x8f9e('0x10')]);var _0xf0ed52=new UserReport(this[_0x8f9e('0x10')]);if(config[_0x8f9e('0x14')]&&config['xdr'][_0x8f9e('0x15')]){ami['on'](_0x8f9e('0x16'),this[_0x8f9e('0x17')][_0x8f9e('0x18')](this));ami['on'](_0x8f9e('0x19'),this[_0x8f9e('0x1a')][_0x8f9e('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0x8f9e('0x1b')][_0x8f9e('0x18')](this));ami['on'](_0x8f9e('0x1c'),this[_0x8f9e('0x1d')]['bind'](this));ami['on']('blindtransfer',this['blindTransfer'][_0x8f9e('0x18')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x8f9e('0x18')](this));}};Report[_0x8f9e('0x1e')]['findAgent']=function(_0x1f9437){var _0x5ffe8;_0x5ffe8=_[_0x8f9e('0x1f')](this[_0x8f9e('0x11')],function(_0x523cf6){return _0x523cf6[_0x8f9e('0x20')]==_0x1f9437||_0x523cf6[_0x8f9e('0x21')]==_0x1f9437;});if(_['isNil'](_0x5ffe8)){var _0x24966c=_[_0x8f9e('0x1f')](this['telephones'],function(_0x3b7448){return _0x3b7448[_0x8f9e('0x20')]==_0x1f9437||_0x3b7448[_0x8f9e('0x21')]==_0x1f9437;});if(_0x24966c){_0x5ffe8=_[_0x8f9e('0x1f')](this[_0x8f9e('0x11')],function(_0x3577c3){return _0x3577c3[_0x8f9e('0x22')]==util[_0x8f9e('0x23')](_0x8f9e('0x24'),_0x24966c[_0x8f9e('0x21')]);});}}return _0x5ffe8;};Report['prototype'][_0x8f9e('0x17')]=function(_0x471352){for(var _0x1ae6cb=0x0;_0x1ae6cb<_0x471352[_0x8f9e('0x25')];_0x1ae6cb+=0x1){var _0x1cfc11=this[_0x8f9e('0x26')](_0x471352[_0x1ae6cb][_0x8f9e('0x27')]);if(_0x1cfc11){_0x471352[_0x1ae6cb][_0x8f9e('0x20')]=_0x1cfc11[_0x8f9e('0x20')];_0x471352[_0x1ae6cb]['assigned']=!![];_0x471352[_0x1ae6cb]['lastAssignedTo']=_0x1cfc11[_0x8f9e('0x21')];_0x471352[_0x1ae6cb][_0x8f9e('0x22')]=_['isNil'](_0x1cfc11[_0x8f9e('0x22')])?util['format']('SIP/%s',_0x1cfc11[_0x8f9e('0x21')]):_0x1cfc11['interface'];if(_0x471352[_0x1ae6cb][_0x8f9e('0x28')]){_0x471352[_0x1ae6cb][_0x8f9e('0x29')]=moment()[_0x8f9e('0x23')](_0x8f9e('0x2a'));}if(_0x471352[_0x1ae6cb][_0x8f9e('0x2b')]){_0x471352[_0x1ae6cb]['queuecallerexitAt']=moment()[_0x8f9e('0x23')](_0x8f9e('0x2a'));}RpcMemberReport[_0x8f9e('0x17')](_0x471352[_0x1ae6cb]);}RpcVoiceQueueReport[_0x8f9e('0x2c')](_0x471352[_0x1ae6cb]);}};function extractCalleridNumber(_0x5c1847){var _0x2d2f81=_0x5c1847[_0x8f9e('0x2d')](/<(.*?)>/);return _0x2d2f81?_0x2d2f81[0x1]:_0x5c1847;}Report[_0x8f9e('0x1e')][_0x8f9e('0x2e')]=function(_0x42506b){for(var _0x3ee8f5=0x0;_0x3ee8f50x0?!![]:![];if(!_0x461b3f){return this['syncQueueSummaryComplete'](this['summary']['completeEvent']);}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x1f')]=function(_0x1de5ac){var _0x46c9c7=this['summary']['id'];if(this[_0x48cb('0x17')][_0x48cb('0x68')][_0x46c9c7]&&this[_0x48cb('0x17')]['queuestatus'][_0x46c9c7][_0x1de5ac[_0x48cb('0x67')]]){this[_0x48cb('0x17')][_0x48cb('0x68')][_0x46c9c7][_0x1de5ac[_0x48cb('0x67')]][_0x48cb('0x12')][_0x48cb('0x73')](_0x1de5ac);}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x1a')]=function(_0x518b70){var _0x29ecb7=this;try{if(this[_0x48cb('0x5f')](_0x518b70)&&this[_0x48cb('0x5f')](_0x518b70['queue'])){logger['debug'](_0x48cb('0x74'),util['inspect'](_0x518b70,{'showHidden':![],'depth':null}));var _0x57fcbf=this['voiceQueues'][_0x518b70[_0x48cb('0x54')]];if(_0x57fcbf){logger[_0x48cb('0x4f')](_0x48cb('0x75'),_0x57fcbf['name']);this[_0x48cb('0x17')]['queues'][_0x57fcbf[_0x48cb('0x5d')]]={'summaryEvent':_0x518b70};this[_0x48cb('0x17')][_0x48cb('0x72')]+=0x1;return ami[_0x48cb('0x43')]({'action':_0x48cb('0x68'),'queue':_0x57fcbf[_0x48cb('0x5d')]})[_0x48cb('0x66')](function(_0xce39bd){if(!_0x29ecb7[_0x48cb('0x17')][_0x48cb('0x68')][_0x518b70[_0x48cb('0x67')]]){_0x29ecb7[_0x48cb('0x17')][_0x48cb('0x68')][_0x518b70[_0x48cb('0x67')]]={};}_0x29ecb7['summary']['queuestatus'][_0x518b70[_0x48cb('0x67')]][_0xce39bd[_0x48cb('0x67')]]={'queue':_0x57fcbf[_0x48cb('0x5d')],'agents':[]};})[_0x48cb('0x63')](function(_0xfbfcf2){throw _0xfbfcf2;});}}}catch(_0x3aee8f){logger[_0x48cb('0x47')](_0x48cb('0x69'),util['inspect'](_0x3aee8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x1d')]=function(_0x584629){if(this[_0x48cb('0x17')][_0x48cb('0x72')]>0x0){this['summary']['completeEvent']=_0x584629;return;}logger['debug'](_0x48cb('0x76'),util['inspect'](_0x584629,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x48cb('0x4d')](_0x48cb('0x77'),{});};VoiceQueueReport[_0x48cb('0xd')]['syncQueueCallerJoin']=function(_0x2fda5b){try{if(this[_0x48cb('0x5f')](_0x2fda5b)){logger['debug'](_0x48cb('0x78'),_0x2fda5b[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x2fda5b,{'showHidden':![],'depth':null}));if(_[_0x48cb('0x60')](this[_0x48cb('0x10')][_0x2fda5b[_0x48cb('0x51')]])){this['queueReports'][_0x2fda5b[_0x48cb('0x51')]]=[];}if(_[_0x48cb('0x60')](this['channels'][_0x2fda5b[_0x48cb('0x51')]])){this[_0x48cb('0x13')][_0x2fda5b['uniqueid']]={};}var _0x188ca9=new QueueReport();_0x188ca9[_0x48cb('0x54')]=_0x2fda5b[_0x48cb('0x54')];_0x188ca9[_0x48cb('0x5a')]=this[_0x48cb('0x15')][_0x188ca9[_0x48cb('0x54')]]&&this[_0x48cb('0x15')][_0x188ca9[_0x48cb('0x54')]][_0x48cb('0x5a')]?this[_0x48cb('0x15')][_0x188ca9[_0x48cb('0x54')]][_0x48cb('0x5a')]||_0x48cb('0x5b'):_0x48cb('0x5b');_0x188ca9[_0x48cb('0x79')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));_0x188ca9['position']=_0x2fda5b[_0x48cb('0x7b')];_0x188ca9[_0x48cb('0x7c')]=_0x2fda5b[_0x48cb('0x7c')];_0x188ca9[_0x48cb('0x51')]=_0x2fda5b[_0x48cb('0x51')];_0x188ca9[_0x48cb('0x7d')]=this[_0x48cb('0x13')][_0x2fda5b[_0x48cb('0x51')]][_0x48cb('0x7d')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x188ca9[_0x48cb('0x54')],_0x188ca9[_0x48cb('0x5a')]);Object[_0x48cb('0x6f')](_0x188ca9,_[_0x48cb('0x7e')](_0x2fda5b,_['keys'](_0x188ca9)));this['queueReports'][_0x2fda5b[_0x48cb('0x51')]][_0x48cb('0x73')](_0x188ca9);this[_0x48cb('0x13')][_0x2fda5b[_0x48cb('0x51')]]=_0x188ca9;this['emitVoiceQueueChannelSave'](_0x188ca9,_0x48cb('0x22'));}}catch(_0xe6f93a){logger[_0x48cb('0x47')](_0x48cb('0x78'),_0x2fda5b[_0x48cb('0x51')],util[_0x48cb('0x48')](_0xe6f93a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x25')]=function(_0x2e6ec9){try{if(this[_0x48cb('0x5f')](_0x2e6ec9)){logger[_0x48cb('0x4f')](_0x48cb('0x7f'),_0x2e6ec9[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x2e6ec9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2e6ec9[_0x48cb('0x51')]]){var _0x385bff=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x2e6ec9[_0x48cb('0x51')]]);_0x385bff['queuecallercomplete']=![];_0x385bff['queuecallercompleteAt']=null;_0x385bff[_0x48cb('0x81')]=_0x2e6ec9[_0x48cb('0x81')];_0x385bff[_0x48cb('0x82')]=_0x2e6ec9[_0x48cb('0x82')];_0x385bff[_0x48cb('0x24')]=!![];_0x385bff[_0x48cb('0x83')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));_0x385bff[_0x48cb('0x57')]='ABANDONED';_0x385bff[_0x48cb('0x84')]=null;logger[_0x48cb('0x85')](_0x48cb('0x86'),_0x385bff[_0x48cb('0x54')],_0x385bff[_0x48cb('0x5a')]);this[_0x48cb('0x13')][_0x2e6ec9[_0x48cb('0x51')]]=_0x385bff;this[_0x48cb('0x4b')](_0x385bff,_0x48cb('0x24'));}}}catch(_0x133217){logger[_0x48cb('0x47')](_0x48cb('0x7f'),_0x2e6ec9['uniqueid'],util['inspect'](_0x133217,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x27')]=function(_0x4dda4b){try{if(this[_0x48cb('0x5f')](_0x4dda4b)){logger[_0x48cb('0x4f')](_0x48cb('0x87'),_0x4dda4b[_0x48cb('0x51')],util['inspect'](_0x4dda4b,{'showHidden':![],'depth':null}));if(this[_0x48cb('0x10')][_0x4dda4b['uniqueid']]){var _0x2a6e4b=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x4dda4b[_0x48cb('0x51')]]);_0x2a6e4b[_0x48cb('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2a6e4b[_0x48cb('0x89')]=_0x4dda4b[_0x48cb('0x89')];_0x2a6e4b[_0x48cb('0x8a')]=_0x4dda4b[_0x48cb('0x8a')];logger[_0x48cb('0x85')](_0x48cb('0x8b'),_0x2a6e4b[_0x48cb('0x54')],_0x2a6e4b[_0x48cb('0x5a')],_0x4dda4b[_0x48cb('0x89')],_0x4dda4b['connectedlinename']);this[_0x48cb('0x13')][_0x4dda4b[_0x48cb('0x51')]]=_0x2a6e4b;this[_0x48cb('0x4e')](_0x2a6e4b,_0x48cb('0x26'));}}}catch(_0x204ab0){logger[_0x48cb('0x47')]('[%s][voiceQueueReport][queuecallerleave]',_0x4dda4b[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x204ab0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x48cb('0x8c')]=function(_0x19e639){try{if(this[_0x48cb('0x5f')](_0x19e639)){logger[_0x48cb('0x4f')](_0x48cb('0x8d'),_0x19e639['uniqueid'],util[_0x48cb('0x48')](_0x19e639,{'showHidden':![],'depth':null}));if(this[_0x48cb('0x10')][_0x19e639[_0x48cb('0x51')]]){var _0x57eec0=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x19e639[_0x48cb('0x51')]]);_0x57eec0['queuecallercomplete']=!![];_0x57eec0[_0x48cb('0x57')]=_0x48cb('0x8e');logger[_0x48cb('0x85')](_0x48cb('0x8f'),_0x57eec0[_0x48cb('0x54')],_0x57eec0[_0x48cb('0x5a')]);}}}catch(_0x2bd305){logger[_0x48cb('0x47')](_0x48cb('0x8d'),_0x19e639[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x2bd305,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x29')]=function(_0x2a17c3){try{if(this[_0x48cb('0x5f')](_0x2a17c3)){logger[_0x48cb('0x4f')](_0x48cb('0x90'),_0x2a17c3[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x2a17c3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2a17c3[_0x48cb('0x51')]]){var _0x102eb1=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x2a17c3[_0x48cb('0x51')]]);_0x102eb1['queuecallerabandon']=![];_0x102eb1[_0x48cb('0x83')]=null;_0x102eb1[_0x48cb('0x91')]=!![];_0x102eb1[_0x48cb('0x84')]=_0x2a17c3[_0x48cb('0x92')];_0x102eb1[_0x48cb('0x81')]=_0x2a17c3['holdtime'];_0x102eb1[_0x48cb('0x3d')]=!![];_0x102eb1[_0x48cb('0x93')]=![];_0x102eb1[_0x48cb('0x94')]=null;if(!_0x102eb1[_0x48cb('0x95')]){if(_0x2a17c3[_0x48cb('0x96')]=='transfer'){_0x102eb1[_0x48cb('0x57')]='COMPLETED';logger[_0x48cb('0x85')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x102eb1[_0x48cb('0x54')],_0x102eb1[_0x48cb('0x5a')]);}else{if(_[_0x48cb('0x97')](_0x2a17c3[_0x48cb('0x45')][_0x48cb('0x98')](),_0x48cb('0x99'))){if(this[_0x48cb('0x10')][_0x2a17c3[_0x48cb('0x9a')]]){var _0x53eef8=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x2a17c3[_0x48cb('0x9a')]]);_0x53eef8[_0x48cb('0x3d')]=![];_0x53eef8[_0x48cb('0x93')]=!![];_0x53eef8[_0x48cb('0x94')]=moment(_0x102eb1[_0x48cb('0x79')])[_0x48cb('0x9b')](_0x2a17c3['holdtime'],'seconds')[_0x48cb('0x52')](_0x48cb('0x7a'));_0x53eef8['queuecallerexitreason']='FORWARDTRANSFER';_0x53eef8[_0x48cb('0x95')]=!![];_0x53eef8['transfertype']=_0x48cb('0x9c');_0x53eef8['transferexten']=_0x2a17c3[_0x48cb('0x9d')];_0x53eef8['transferuniqueid']=_0x2a17c3[_0x48cb('0x51')];logger['info'](_0x48cb('0x9e'),_0x53eef8[_0x48cb('0x54')],_0x53eef8[_0x48cb('0x5a')]);var _0x1b47c6=this[_0x48cb('0x10')][_0x2a17c3[_0x48cb('0x9a')]];this[_0x48cb('0x10')][_0x2a17c3['linkedid']]=this[_0x48cb('0x10')][_0x2a17c3[_0x48cb('0x51')]];this['queueReports'][_0x2a17c3[_0x48cb('0x51')]]=_0x1b47c6;}}else{_0x102eb1[_0x48cb('0x57')]=_0x48cb('0x9f')+_0x2a17c3[_0x48cb('0x96')][_0x48cb('0xa0')]();logger[_0x48cb('0x85')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x102eb1[_0x48cb('0x54')],_0x102eb1[_0x48cb('0x5a')],_0x102eb1['queuecallerexitreason']);}}}this[_0x48cb('0x13')][_0x2a17c3[_0x48cb('0x51')]]=_0x102eb1;}}}catch(_0x548baf){logger[_0x48cb('0x47')](_0x48cb('0x90'),_0x2a17c3[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x548baf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0x2b')]=function(_0x2e5f28){try{if(this[_0x48cb('0x5f')](_0x2e5f28)){logger[_0x48cb('0x4f')]('[%s][voiceQueueReport][varset]',_0x2e5f28[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x2e5f28,{'showHidden':![],'depth':null}));this[_0x48cb('0xa1')](_0x2e5f28[_0x48cb('0x51')],_[_0x48cb('0xa2')](_0x2e5f28[_0x48cb('0xa3')])[0x0],_0x2e5f28['value']);if(this['queueReports'][_0x2e5f28[_0x48cb('0x51')]]){var _0x425512=_[_0x48cb('0x80')](this[_0x48cb('0x10')][_0x2e5f28[_0x48cb('0x51')]]);if(_0x425512){if(this[_0x48cb('0x5f')](_0x2e5f28[_0x48cb('0xa3')])&&this[_0x48cb('0x5f')](_0x2e5f28[_0x48cb('0xa3')][_0x48cb('0x68')])){switch(_0x2e5f28[_0x48cb('0xa4')]){case _0x48cb('0xa5'):_0x425512[_0x48cb('0x93')]=![];_0x425512['queuecallerexitAt']=null;break;case _0x48cb('0xa6'):_0x425512[_0x48cb('0xa7')]=_0x48cb('0xa8');_0x425512[_0x48cb('0x93')]=!![];_0x425512[_0x48cb('0x94')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));_0x425512[_0x48cb('0x88')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));logger[_0x48cb('0x4f')](_0x48cb('0xa9'),_0x2e5f28['uniqueid'],util['inspect'](_0x425512,{'showHidden':![],'depth':null}));ami[_0x48cb('0x4d')]('custom:timeout',_0x425512);break;default:_0x425512[_0x48cb('0x93')]=!![];_0x425512[_0x48cb('0x94')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));_0x425512['queuecallerleaveAt']=moment()[_0x48cb('0x52')]('YYYY-MM-DD\x20HH:mm:ss');}_0x425512['queuecallerabandon']=![];_0x425512[_0x48cb('0x83')]=null;_0x425512[_0x48cb('0x57')]=_0x2e5f28[_0x48cb('0xa4')];this[_0x48cb('0x13')][_0x2e5f28[_0x48cb('0x51')]]=_0x425512;this[_0x48cb('0x4b')](_0x425512,_0x48cb('0xaa'));}else if(this['isNotNull'](_0x2e5f28[_0x48cb('0xa3')])&&this[_0x48cb('0x5f')](_0x2e5f28[_0x48cb('0xa3')][_0x48cb('0xab')])){if(!_0x425512[_0x48cb('0x24')]){_0x425512[_0x48cb('0x93')]=!![];_0x425512[_0x48cb('0x94')]=moment()[_0x48cb('0x52')](_0x48cb('0x7a'));_0x425512['queuecallerexitreason']=_0x48cb('0xac');_0x425512['queuecallerleaveAt']=moment()[_0x48cb('0x52')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x48cb('0x13')][_0x2e5f28[_0x48cb('0x51')]]=_0x425512;}}logger['info'](_0x48cb('0xad'),_0x2e5f28[_0x48cb('0x51')],_0x425512['queue'],_0x425512['type'],_[_0x48cb('0xa2')](_0x2e5f28[_0x48cb('0xa3')])[0x0],_0x2e5f28['value']);_0x425512[_0x48cb('0x18')]=this[_0x48cb('0x18')][_0x2e5f28[_0x48cb('0x51')]];}}}}catch(_0x1d548c){logger[_0x48cb('0x47')]('[%s][voiceQueueReport][varset]',_0x2e5f28[_0x48cb('0x51')],util[_0x48cb('0x48')](_0x1d548c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48cb('0xd')]['addVariable']=function(_0x59a84f,_0xfba74,_0x396e6b){var _0x48921d=[_0x48cb('0xae'),_0x48cb('0xaf'),'rtpaudioqosjitter',_0x48cb('0xb0'),_0x48cb('0xb1'),_0x48cb('0xb2'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer',_0x48cb('0xb3'),_0x48cb('0xb4'),'memberdynamic','memberinterface','memberlastcall',_0x48cb('0x92'),_0x48cb('0xb5'),_0x48cb('0xb6')];if(!_[_0x48cb('0x42')](_0xfba74)&&!_[_0x48cb('0xb7')](_0x48921d,_0xfba74)){if(_['isUndefined'](this[_0x48cb('0x18')][_0x59a84f])){this['variables'][_0x59a84f]={};}this[_0x48cb('0x18')][_0x59a84f][_0xfba74]=_0x396e6b;}};VoiceQueueReport[_0x48cb('0xd')][_0x48cb('0xb8')]=function(_0x4d48d9,_0x4da806,_0x2a657a){try{var _0x210f38={};if(this[_0x48cb('0x10')][_0x4d48d9]){for(var _0x4fdeb6=0x0;_0x4fdeb60x0?!![]:![];if(!_0x868143){return this[_0x07a0('0x70')](this['summary'][_0x07a0('0x71')]);}};VoiceQueueReport[_0x07a0('0x3c')]['syncQueueMember']=function(_0x29eafe){var _0x486c13=this[_0x07a0('0x16')]['id'];if(this[_0x07a0('0x16')][_0x07a0('0x6c')][_0x486c13]&&this[_0x07a0('0x16')][_0x07a0('0x6c')][_0x486c13][_0x29eafe[_0x07a0('0x65')]]){this[_0x07a0('0x16')][_0x07a0('0x6c')][_0x486c13][_0x29eafe[_0x07a0('0x65')]]['agents']['push'](_0x29eafe);}};VoiceQueueReport[_0x07a0('0x3c')][_0x07a0('0x18')]=function(_0x2a5164){var _0x265d4e=this;try{if(this[_0x07a0('0x5d')](_0x2a5164)&&this['isNotNull'](_0x2a5164[_0x07a0('0x52')])){logger['debug'](_0x07a0('0x72'),util['inspect'](_0x2a5164,{'showHidden':![],'depth':null}));var _0x52f89c=this[_0x07a0('0x48')][_0x2a5164[_0x07a0('0x52')]];if(_0x52f89c){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x52f89c[_0x07a0('0x5b')]);this['summary']['queues'][_0x52f89c[_0x07a0('0x5b')]]={'summaryEvent':_0x2a5164};this[_0x07a0('0x16')][_0x07a0('0x6f')]+=0x1;return ami['Action']({'action':_0x07a0('0x6c'),'queue':_0x52f89c[_0x07a0('0x5b')]})[_0x07a0('0x73')](function(_0x1c4673){if(!_0x265d4e[_0x07a0('0x16')][_0x07a0('0x6c')][_0x2a5164[_0x07a0('0x65')]]){_0x265d4e[_0x07a0('0x16')][_0x07a0('0x6c')][_0x2a5164['actionid']]={};}_0x265d4e['summary']['queuestatus'][_0x2a5164[_0x07a0('0x65')]][_0x1c4673[_0x07a0('0x65')]]={'queue':_0x52f89c[_0x07a0('0x5b')],'agents':[]};})[_0x07a0('0x41')](function(_0xaf1f26){throw _0xaf1f26;});}}}catch(_0x43d24c){logger[_0x07a0('0x42')](_0x07a0('0x66'),util[_0x07a0('0x45')](_0x43d24c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')][_0x07a0('0x70')]=function(_0x25d3e2){if(this[_0x07a0('0x16')][_0x07a0('0x6f')]>0x0){this[_0x07a0('0x16')][_0x07a0('0x71')]=_0x25d3e2;return;}logger[_0x07a0('0x54')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x07a0('0x45')](_0x25d3e2,{'showHidden':![],'depth':null}));this[_0x07a0('0x16')]=initializeSummary();ami[_0x07a0('0x4b')](_0x07a0('0x74'),{});};VoiceQueueReport['prototype'][_0x07a0('0x75')]=function(_0x3e657c){try{if(this[_0x07a0('0x5d')](_0x3e657c)){logger[_0x07a0('0x54')](_0x07a0('0x76'),_0x3e657c[_0x07a0('0x4f')],util['inspect'](_0x3e657c,{'showHidden':![],'depth':null}));if(_[_0x07a0('0x5e')](this[_0x07a0('0x10')][_0x3e657c['uniqueid']])){this[_0x07a0('0x10')][_0x3e657c['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x3e657c['uniqueid']])){this['channels'][_0x3e657c['uniqueid']]={};}var _0x532298=new QueueReport();_0x532298[_0x07a0('0x52')]=_0x3e657c[_0x07a0('0x52')];_0x532298[_0x07a0('0x59')]=this['voiceQueues'][_0x532298[_0x07a0('0x52')]]&&this[_0x07a0('0x48')][_0x532298[_0x07a0('0x52')]][_0x07a0('0x59')]?this[_0x07a0('0x48')][_0x532298[_0x07a0('0x52')]][_0x07a0('0x59')]||'inbound':_0x07a0('0x6d');_0x532298[_0x07a0('0x77')]=moment()[_0x07a0('0x50')](_0x07a0('0x78'));_0x532298[_0x07a0('0x79')]=_0x3e657c[_0x07a0('0x79')];_0x532298['count']=_0x3e657c[_0x07a0('0x7a')];_0x532298[_0x07a0('0x4f')]=_0x3e657c['uniqueid'];_0x532298[_0x07a0('0x7b')]=this['channels'][_0x3e657c[_0x07a0('0x4f')]][_0x07a0('0x7b')];logger['info'](_0x07a0('0x7c'),_0x532298[_0x07a0('0x52')],_0x532298[_0x07a0('0x59')]);Object[_0x07a0('0x6a')](_0x532298,_[_0x07a0('0x7d')](_0x3e657c,_[_0x07a0('0x7e')](_0x532298)));this['queueReports'][_0x3e657c['uniqueid']][_0x07a0('0x7f')](_0x532298);this[_0x07a0('0x13')][_0x3e657c[_0x07a0('0x4f')]]=_0x532298;this['emitVoiceQueueChannelSave'](_0x532298,_0x07a0('0x1e'));}}catch(_0x1f2aae){logger['error'](_0x07a0('0x76'),_0x3e657c[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x1f2aae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')][_0x07a0('0x20')]=function(_0x468150){try{if(this[_0x07a0('0x5d')](_0x468150)){logger[_0x07a0('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x468150[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x468150,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x468150[_0x07a0('0x4f')]]){var _0x113b52=_[_0x07a0('0x80')](this[_0x07a0('0x10')][_0x468150[_0x07a0('0x4f')]]);_0x113b52[_0x07a0('0x3b')]=![];_0x113b52[_0x07a0('0x81')]=null;_0x113b52[_0x07a0('0x82')]=_0x468150[_0x07a0('0x82')];_0x113b52[_0x07a0('0x83')]=_0x468150['originalposition'];_0x113b52[_0x07a0('0x1f')]=!![];_0x113b52[_0x07a0('0x84')]=moment()[_0x07a0('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x113b52[_0x07a0('0x56')]=_0x07a0('0x85');_0x113b52['lastAssignedTo']=null;logger[_0x07a0('0x86')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x113b52['queue'],_0x113b52[_0x07a0('0x59')]);this[_0x07a0('0x13')][_0x468150[_0x07a0('0x4f')]]=_0x113b52;this[_0x07a0('0x49')](_0x113b52,_0x07a0('0x1f'));}}}catch(_0x1b0901){logger[_0x07a0('0x42')](_0x07a0('0x87'),_0x468150['uniqueid'],util[_0x07a0('0x45')](_0x1b0901,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')][_0x07a0('0x88')]=function(_0x161115){try{if(this['isNotNull'](_0x161115)){logger[_0x07a0('0x54')](_0x07a0('0x89'),_0x161115[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x161115,{'showHidden':![],'depth':null}));if(this[_0x07a0('0x10')][_0x161115[_0x07a0('0x4f')]]){var _0x1a8689=_['last'](this['queueReports'][_0x161115[_0x07a0('0x4f')]]);_0x1a8689['queuecallerleaveAt']=moment()[_0x07a0('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a8689['connectedlinenum']=_0x161115[_0x07a0('0x8a')];_0x1a8689[_0x07a0('0x8b')]=_0x161115[_0x07a0('0x8b')];logger[_0x07a0('0x86')](_0x07a0('0x8c'),_0x1a8689[_0x07a0('0x52')],_0x1a8689[_0x07a0('0x59')],_0x161115[_0x07a0('0x8a')],_0x161115[_0x07a0('0x8b')]);this[_0x07a0('0x13')][_0x161115[_0x07a0('0x4f')]]=_0x1a8689;this[_0x07a0('0x4c')](_0x1a8689,_0x07a0('0x21'));}}}catch(_0x433675){logger['error'](_0x07a0('0x89'),_0x161115['uniqueid'],util['inspect'](_0x433675,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')][_0x07a0('0x25')]=function(_0x3603d6){try{if(this['isNotNull'](_0x3603d6)){logger[_0x07a0('0x54')](_0x07a0('0x8d'),_0x3603d6[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x3603d6,{'showHidden':![],'depth':null}));if(this[_0x07a0('0x10')][_0x3603d6[_0x07a0('0x4f')]]){var _0x9f534e=_['last'](this[_0x07a0('0x10')][_0x3603d6['uniqueid']]);_0x9f534e[_0x07a0('0x3b')]=!![];_0x9f534e[_0x07a0('0x56')]='COMPLETEDBYAGENT';logger[_0x07a0('0x86')](_0x07a0('0x8e'),_0x9f534e['queue'],_0x9f534e[_0x07a0('0x59')]);}}}catch(_0x304434){logger[_0x07a0('0x42')](_0x07a0('0x8d'),_0x3603d6['uniqueid'],util['inspect'](_0x304434,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')]['syncAgentComplete']=function(_0x485690){try{if(this[_0x07a0('0x5d')](_0x485690)){logger[_0x07a0('0x54')](_0x07a0('0x8f'),_0x485690[_0x07a0('0x4f')],util['inspect'](_0x485690,{'showHidden':![],'depth':null}));if(this[_0x07a0('0x10')][_0x485690[_0x07a0('0x4f')]]){var _0x540b27=_[_0x07a0('0x80')](this[_0x07a0('0x10')][_0x485690['uniqueid']]);_0x540b27[_0x07a0('0x1f')]=![];_0x540b27[_0x07a0('0x84')]=null;_0x540b27[_0x07a0('0x90')]=!![];_0x540b27[_0x07a0('0x91')]=_0x485690[_0x07a0('0x92')];_0x540b27[_0x07a0('0x82')]=_0x485690[_0x07a0('0x82')];_0x540b27[_0x07a0('0x3b')]=!![];_0x540b27['queuecallerexit']=![];_0x540b27[_0x07a0('0x93')]=null;if(!_0x540b27[_0x07a0('0x94')]){if(_0x485690['reason']==_0x07a0('0x94')){_0x540b27['queuecallerexitreason']='COMPLETED';logger[_0x07a0('0x86')](_0x07a0('0x95'),_0x540b27[_0x07a0('0x52')],_0x540b27['type']);}else{if(_[_0x07a0('0x96')](_0x485690[_0x07a0('0x40')][_0x07a0('0x97')](),_0x07a0('0x98'))){if(this[_0x07a0('0x10')][_0x485690['linkedid']]){var _0x216129=_[_0x07a0('0x80')](this['queueReports'][_0x485690[_0x07a0('0x99')]]);_0x216129['queuecallercomplete']=![];_0x216129[_0x07a0('0x3a')]=!![];_0x216129[_0x07a0('0x93')]=moment(_0x540b27[_0x07a0('0x77')])['add'](_0x485690[_0x07a0('0x82')],'seconds')[_0x07a0('0x50')](_0x07a0('0x78'));_0x216129['queuecallerexitreason']=_0x07a0('0x9a');_0x216129[_0x07a0('0x94')]=!![];_0x216129[_0x07a0('0x9b')]=_0x07a0('0x9c');_0x216129['transferexten']=_0x485690[_0x07a0('0x9d')];_0x216129[_0x07a0('0x9e')]=_0x485690[_0x07a0('0x4f')];logger['info'](_0x07a0('0x9f'),_0x216129[_0x07a0('0x52')],_0x216129['type']);var _0x440cf0=this[_0x07a0('0x10')][_0x485690['linkedid']];this[_0x07a0('0x10')][_0x485690[_0x07a0('0x99')]]=this[_0x07a0('0x10')][_0x485690['uniqueid']];this['queueReports'][_0x485690[_0x07a0('0x4f')]]=_0x440cf0;}}else{_0x540b27[_0x07a0('0x56')]=_0x07a0('0xa0')+_0x485690[_0x07a0('0xa1')][_0x07a0('0xa2')]();logger[_0x07a0('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x540b27[_0x07a0('0x52')],_0x540b27[_0x07a0('0x59')],_0x540b27[_0x07a0('0x56')]);}}}this[_0x07a0('0x13')][_0x485690['uniqueid']]=_0x540b27;}}}catch(_0x1acdbe){logger[_0x07a0('0x42')](_0x07a0('0x8f'),_0x485690[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x1acdbe,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x43debe){try{if(this[_0x07a0('0x5d')](_0x43debe)){logger[_0x07a0('0x54')](_0x07a0('0xa3'),_0x43debe[_0x07a0('0x4f')],util['inspect'](_0x43debe,{'showHidden':![],'depth':null}));this['addVariable'](_0x43debe[_0x07a0('0x4f')],_[_0x07a0('0x7e')](_0x43debe[_0x07a0('0xa4')])[0x0],_0x43debe[_0x07a0('0xa5')]);if(this['queueReports'][_0x43debe[_0x07a0('0x4f')]]){var _0x35a76d=_[_0x07a0('0x80')](this[_0x07a0('0x10')][_0x43debe['uniqueid']]);if(_0x35a76d){if(this['isNotNull'](_0x43debe[_0x07a0('0xa4')])&&this[_0x07a0('0x5d')](_0x43debe[_0x07a0('0xa4')][_0x07a0('0x6c')])){switch(_0x43debe[_0x07a0('0xa5')]){case _0x07a0('0xa6'):_0x35a76d['queuecallerexit']=![];_0x35a76d[_0x07a0('0x93')]=null;break;case _0x07a0('0xa7'):_0x35a76d[_0x07a0('0xa8')]=_0x07a0('0xa9');_0x35a76d[_0x07a0('0x3a')]=!![];_0x35a76d[_0x07a0('0x93')]=moment()[_0x07a0('0x50')](_0x07a0('0x78'));_0x35a76d[_0x07a0('0xaa')]=moment()[_0x07a0('0x50')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x07a0('0x54')](_0x07a0('0xab'),_0x43debe[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0x35a76d,{'showHidden':![],'depth':null}));ami[_0x07a0('0x4b')](_0x07a0('0xac'),_0x35a76d);break;default:_0x35a76d[_0x07a0('0x3a')]=!![];_0x35a76d[_0x07a0('0x93')]=moment()[_0x07a0('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x35a76d['queuecallerleaveAt']=moment()['format'](_0x07a0('0x78'));}_0x35a76d[_0x07a0('0x1f')]=![];_0x35a76d[_0x07a0('0x84')]=null;_0x35a76d['queuecallerexitreason']=_0x43debe[_0x07a0('0xa5')];this['channels'][_0x43debe[_0x07a0('0x4f')]]=_0x35a76d;this['emitVoiceQueueChannelRemove'](_0x35a76d,_0x07a0('0xad'));}else if(this[_0x07a0('0x5d')](_0x43debe[_0x07a0('0xa4')])&&this[_0x07a0('0x5d')](_0x43debe[_0x07a0('0xa4')][_0x07a0('0xae')])){if(!_0x35a76d['queuecallerabandon']){_0x35a76d[_0x07a0('0x3a')]=!![];_0x35a76d[_0x07a0('0x93')]=moment()[_0x07a0('0x50')](_0x07a0('0x78'));_0x35a76d[_0x07a0('0x56')]='EXITWITHKEY';_0x35a76d['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x07a0('0x13')][_0x43debe[_0x07a0('0x4f')]]=_0x35a76d;}}logger[_0x07a0('0x86')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x43debe['uniqueid'],_0x35a76d[_0x07a0('0x52')],_0x35a76d[_0x07a0('0x59')],_[_0x07a0('0x7e')](_0x43debe['variable'])[0x0],_0x43debe['value']);_0x35a76d[_0x07a0('0x17')]=this['variables'][_0x43debe[_0x07a0('0x4f')]];}}}}catch(_0xa90d65){logger[_0x07a0('0x42')](_0x07a0('0xa3'),_0x43debe[_0x07a0('0x4f')],util[_0x07a0('0x45')](_0xa90d65,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x07a0('0x3c')]['addVariable']=function(_0x1ff8b0,_0x121539,_0x4ab433){var _0x515c96=[_0x07a0('0xaf'),_0x07a0('0xb0'),_0x07a0('0xb1'),_0x07a0('0xb2'),_0x07a0('0xb3'),_0x07a0('0xb4'),_0x07a0('0xb5'),_0x07a0('0xb6'),'sipcallid','sipuri',_0x07a0('0xb7'),_0x07a0('0xb8'),'membercalls',_0x07a0('0xb9'),'memberinterface',_0x07a0('0xba'),'membername',_0x07a0('0xbb'),_0x07a0('0xbc')];if(!_['isNil'](_0x121539)&&!_[_0x07a0('0xbd')](_0x515c96,_0x121539)){if(_[_0x07a0('0x5e')](this[_0x07a0('0x17')][_0x1ff8b0])){this[_0x07a0('0x17')][_0x1ff8b0]={};}this[_0x07a0('0x17')][_0x1ff8b0][_0x121539]=_0x4ab433;}};VoiceQueueReport[_0x07a0('0x3c')]['handleHangup']=function(_0x1e6ff3,_0xf570f2,_0x86b754){try{var _0x576165={};if(this[_0x07a0('0x10')][_0x1e6ff3]){for(var _0x1e9a9d=0x0;_0x1e9a9d=0x0?moment(_0x2f7032[_0x5a5a('0x1b')])['diff'](_0x2f7032['starttime'],_0x5a5a('0xe')):null,'data1':_0x5a5a('0x1c'),'data2':_0x2f7032[_0x5a5a('0x1d')],'data3':_0x2f7032['exten'],'data4':_0x2f7032[_0x5a5a('0x1e')]||null,'role':_0x5a5a('0x13'),'internal':_0x2f7032['accountcode']?_[_0x5a5a('0x14')](_0x2f7032['accountcode']):undefined,'uniqueid':_0x2f7032['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x5858=['voiceDialReport','Request','starttime','endtime','outbound','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid'];(function(_0x6e7850,_0xc4379e){var _0x477237=function(_0x117edf){while(--_0x117edf){_0x6e7850['push'](_0x6e7850['shift']());}};_0x477237(++_0xc4379e);}(_0x5858,0x13a));var _0x8585=function(_0x32aef3,_0xd45833){_0x32aef3=_0x32aef3-0x0;var _0x8a95bf=_0x5858[_0x32aef3];return _0x8a95bf;};'use strict';var moment=require(_0x8585('0x0'));var _=require(_0x8585('0x1'));var util=require(_0x8585('0x2'));var client=require('../client');exports[_0x8585('0x3')]=function(_0x6ed0cd){var _0x41bee8=_0x6ed0cd[_0x8585('0x4')]||_0x6ed0cd[_0x8585('0x5')];return client['Request'](_0x8585('0x6'),{'body':{'channel':'voice','membername':_0x6ed0cd[_0x8585('0x7')],'interface':_[_0x8585('0x8')](_0x6ed0cd[_0x8585('0x9')])?util['format'](_0x8585('0xa'),_0x6ed0cd[_0x8585('0x7')]):_0x6ed0cd[_0x8585('0x9')],'type':_0x8585('0xb'),'enterAt':_0x6ed0cd['queuecallerleaveAt'],'exitAt':_0x41bee8,'duration':moment(_0x41bee8)[_0x8585('0xc')](_0x6ed0cd[_0x8585('0xd')],_0x8585('0xe')),'data1':_0x8585('0xf'),'data2':_0x6ed0cd[_0x8585('0x10')],'data3':_0x6ed0cd[_0x8585('0x11')],'data4':null,'data5':_0x6ed0cd['queue'],'role':_0x8585('0x12'),'internal':_0x6ed0cd[_0x8585('0x13')]?_[_0x8585('0x14')](_0x6ed0cd[_0x8585('0x13')]):undefined,'uniqueid':_0x6ed0cd[_0x8585('0x15')]},'log':'CreateMemberReport'});};exports[_0x8585('0x16')]=function(_0x2257c1){return client[_0x8585('0x17')](_0x8585('0x6'),{'body':{'channel':'voice','membername':_0x2257c1['membername'],'interface':_0x2257c1[_0x8585('0x9')],'type':_0x8585('0xb'),'enterAt':_0x2257c1[_0x8585('0x18')],'exitAt':_0x2257c1[_0x8585('0x19')],'duration':moment(_0x2257c1[_0x8585('0x19')])[_0x8585('0xc')](_0x2257c1['starttime'],_0x8585('0xe'))>=0x0?moment(_0x2257c1[_0x8585('0x19')])[_0x8585('0xc')](_0x2257c1[_0x8585('0x18')],'seconds'):null,'data1':_0x8585('0x1a'),'data2':_0x2257c1['accountcode'],'data3':_0x2257c1[_0x8585('0x11')],'data4':_0x2257c1[_0x8585('0x1b')]||null,'role':_0x8585('0x12'),'internal':_0x2257c1[_0x8585('0x13')]?_[_0x8585('0x14')](_0x2257c1[_0x8585('0x13')]):undefined,'uniqueid':_0x2257c1[_0x8585('0x15')]},'log':_0x8585('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index af4a27a..6ca8fbb 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 _0x7980=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting'];(function(_0x96c15f,_0x538403){var _0x202a78=function(_0x311a4a){while(--_0x311a4a){_0x96c15f['push'](_0x96c15f['shift']());}};_0x202a78(++_0x538403);}(_0x7980,0x123));var _0x0798=function(_0x1f838a,_0x82b73f){_0x1f838a=_0x1f838a-0x0;var _0x285599=_0x7980[_0x1f838a];return _0x285599;};'use strict';var client=require(_0x0798('0x0'));exports[_0x0798('0x1')]=function(){return client['Request'](_0x0798('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0798('0x3'),_0x0798('0x4')]},'log':_0x0798('0x5')});}; \ No newline at end of file +var _0xa282=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x5a86fb,_0x5bc66f){var _0x31b1d2=function(_0x541267){while(--_0x541267){_0x5a86fb['push'](_0x5a86fb['shift']());}};_0x31b1d2(++_0x5bc66f);}(_0xa282,0x189));var _0x2a28=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xa282[_0x342baa];return _0x1208f3;};'use strict';var client=require(_0x2a28('0x0'));exports[_0x2a28('0x1')]=function(){return client[_0x2a28('0x2')](_0x2a28('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2a28('0x4'),_0x2a28('0x5')]},'log':_0x2a28('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 603b26c..6567a9b 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 _0xec5b=['html','../client','Request','GetTemplate'];(function(_0x2fd8b8,_0x108fcf){var _0x578ceb=function(_0x2ed514){while(--_0x2ed514){_0x2fd8b8['push'](_0x2fd8b8['shift']());}};_0x578ceb(++_0x108fcf);}(_0xec5b,0x175));var _0xbec5=function(_0x233586,_0xca6abd){_0x233586=_0x233586-0x0;var _0x4dd7c2=_0xec5b[_0x233586];return _0x4dd7c2;};'use strict';var client=require(_0xbec5('0x0'));exports['getTemplates']=function(_0xb3a866){return function(_0x4bf879){return client[_0xbec5('0x1')](_0xbec5('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xbec5('0x3')]},'log':_0xbec5('0x2')});};}; \ No newline at end of file +var _0xa4c0=['Request','GetTemplate','html','getTemplates'];(function(_0x1bc0b5,_0x2f6ce9){var _0x59351b=function(_0x2e0366){while(--_0x2e0366){_0x1bc0b5['push'](_0x1bc0b5['shift']());}};_0x59351b(++_0x2f6ce9);}(_0xa4c0,0x197));var _0x0a4c=function(_0x428093,_0x2e767f){_0x428093=_0x428093-0x0;var _0x19301b=_0xa4c0[_0x428093];return _0x19301b;};'use strict';var client=require('../client');exports[_0x0a4c('0x0')]=function(_0x5f2ca4){return function(_0x4b9abe){return client[_0x0a4c('0x1')](_0x0a4c('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x0a4c('0x3')]},'log':_0x0a4c('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 94a5ea1..caa7c57 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 _0x6936=['data5','data7','GetTrigger','../client','getTriggers','Request','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4'];(function(_0x5efab9,_0x399db4){var _0x1dd1fb=function(_0x473584){while(--_0x473584){_0x5efab9['push'](_0x5efab9['shift']());}};_0x1dd1fb(++_0x399db4);}(_0x6936,0xab));var _0x6693=function(_0x5e5657,_0xee03cd){_0x5e5657=_0x5e5657-0x0;var _0x20698d=_0x6936[_0x5e5657];return _0x20698d;};'use strict';var client=require(_0x6693('0x0'));exports[_0x6693('0x1')]=function(_0x538468){return function(_0x287a5d){return client[_0x6693('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x6693('0x3'),'channel',_0x6693('0x4')],'include':[{'model':_0x6693('0x5'),'as':_0x6693('0x6'),'attributes':['id',_0x6693('0x7'),_0x6693('0x8'),'value']},{'model':_0x6693('0x5'),'as':_0x6693('0x9'),'attributes':['id',_0x6693('0x7'),'operator',_0x6693('0xa')]},{'model':_0x6693('0xb'),'as':_0x6693('0xc'),'attributes':['id',_0x6693('0xd'),_0x6693('0xe'),_0x6693('0xf'),_0x6693('0x10'),_0x6693('0x11'),_0x6693('0x12'),'data6',_0x6693('0x13')]}]},'log':_0x6693('0x14')});};}; \ No newline at end of file +var _0xf691=['action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','field','operator','value','AnyConditions','Actions'];(function(_0x5a1910,_0x5c57f8){var _0x1207ba=function(_0x16c111){while(--_0x16c111){_0x5a1910['push'](_0x5a1910['shift']());}};_0x1207ba(++_0x5c57f8);}(_0xf691,0x111));var _0x1f69=function(_0x10ce27,_0x2174ac){_0x10ce27=_0x10ce27-0x0;var _0x5605b3=_0xf691[_0x10ce27];return _0x5605b3;};'use strict';var client=require(_0x1f69('0x0'));exports[_0x1f69('0x1')]=function(_0x1bd372){return function(_0x3f1dd0){return client[_0x1f69('0x2')](_0x1f69('0x3'),{'options':{'raw':![],'attributes':['id',_0x1f69('0x4'),_0x1f69('0x5'),'status'],'include':[{'model':_0x1f69('0x6'),'as':'AllConditions','attributes':['id',_0x1f69('0x7'),_0x1f69('0x8'),_0x1f69('0x9')]},{'model':_0x1f69('0x6'),'as':_0x1f69('0xa'),'attributes':['id',_0x1f69('0x7'),_0x1f69('0x8'),_0x1f69('0x9')]},{'model':'Action','as':_0x1f69('0xb'),'attributes':['id',_0x1f69('0xc'),_0x1f69('0xd'),'data2',_0x1f69('0xe'),_0x1f69('0xf'),_0x1f69('0x10'),_0x1f69('0x11'),_0x1f69('0x12')]}]},'log':_0x1f69('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5a37c67..6b4f9bb 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 _0x5341=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5341,0xbb));var _0x1534=function(_0x54f986,_0x12b95e){_0x54f986=_0x54f986-0x0;var _0x2ae913=_0x5341[_0x54f986];return _0x2ae913;};'use strict';var client=require(_0x1534('0x0'));exports[_0x1534('0x1')]=function(_0xe6a2f){return function(_0x21eddf){return client[_0x1534('0x2')](_0x1534('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1534('0x4'),_0x1534('0x5'),'defaultuser']},'log':_0x1534('0x3')});};}; \ No newline at end of file +var _0x3937=['GetTrunk','registry','../client'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x3937,0xbf));var _0x7393=function(_0xd07207,_0x42afe6){_0xd07207=_0xd07207-0x0;var _0x16265b=_0x3937[_0xd07207];return _0x16265b;};'use strict';var client=require(_0x7393('0x0'));exports['getTrunks']=function(_0x26bf9f){return function(_0x182983){return client['Request'](_0x7393('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7393('0x2'),'defaultuser']},'log':_0x7393('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f787b35..2352c90 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe706,0xa3));var _0x6e70=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xe706[_0x49d19d];return _0x4ebef1;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x50dfa4,_0x1e9bb2){var _0x9c4062=function(_0x9b0b2b){while(--_0x9b0b2b){_0x50dfa4['push'](_0x50dfa4['shift']());}};_0x9c4062(++_0x1e9bb2);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index aaa5f2b..488e949 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 _0xfbb7=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xfbb7,0xf3));var _0x7fbb=function(_0x74d12,_0x406ec4){_0x74d12=_0x74d12-0x0;var _0x2eb756=_0xfbb7[_0x74d12];return _0x2eb756;};'use strict';var client=require(_0x7fbb('0x0'));exports['create']=function(_0x696140){return client[_0x7fbb('0x1')](_0x7fbb('0x2'),{'body':_0x696140,'log':_0x7fbb('0x2')});};exports['update']=function(_0x1b8b46,_0x4c60d3,_0x1c52ef){return client[_0x7fbb('0x1')](_0x7fbb('0x3'),{'body':_0x1b8b46,'options':{'where':{'uniqueid':_0x4c60d3,'interface':_0x1c52ef,'agentcomplete':!![]}},'log':_0x7fbb('0x3')});}; \ No newline at end of file +var _0x2b85=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x305dd7,_0x37e636){var _0x4dc28e=function(_0x24e0aa){while(--_0x24e0aa){_0x305dd7['push'](_0x305dd7['shift']());}};_0x4dc28e(++_0x37e636);}(_0x2b85,0xfb));var _0x52b8=function(_0xfb3d53,_0x36a167){_0xfb3d53=_0xfb3d53-0x0;var _0x510a57=_0x2b85[_0xfb3d53];return _0x510a57;};'use strict';var client=require(_0x52b8('0x0'));exports['create']=function(_0x5000be){return client[_0x52b8('0x1')](_0x52b8('0x2'),{'body':_0x5000be,'log':_0x52b8('0x2')});};exports['update']=function(_0x259105,_0xe2be1f,_0x2908c5){return client[_0x52b8('0x1')](_0x52b8('0x3'),{'body':_0x259105,'options':{'where':{'uniqueid':_0xe2be1f,'interface':_0x2908c5,'agentcomplete':!![]}},'log':_0x52b8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9202968..d837323 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 _0xee27=['merge','calleridnum','callerid','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','billableseconds','moment','util','lodash','../client','Request','CreateVoiceCallReport'];(function(_0x3f4294,_0x36e626){var _0x41338b=function(_0x4fd454){while(--_0x4fd454){_0x3f4294['push'](_0x3f4294['shift']());}};_0x41338b(++_0x36e626);}(_0xee27,0x1bc));var _0x7ee2=function(_0x2cd6c5,_0x29e4e8){_0x2cd6c5=_0x2cd6c5-0x0;var _0x8a2a07=_0xee27[_0x2cd6c5];return _0x8a2a07;};'use strict';var moment=require(_0x7ee2('0x0'));var util=require(_0x7ee2('0x1'));var _=require(_0x7ee2('0x2'));var client=require(_0x7ee2('0x3'));exports['create']=function(_0x15c3c9){return client[_0x7ee2('0x4')](_0x7ee2('0x5'),{'body':_[_0x7ee2('0x6')](_0x15c3c9,{'source':_0x15c3c9[_0x7ee2('0x7')],'destinationcontext':_0x15c3c9['context'],'callerid':_0x15c3c9[_0x7ee2('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x7ee2('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x7ee2('0x9')],'createdAt':{'$between':[moment()[_0x7ee2('0xa')](_0x7ee2('0xb'))['format'](_0x7ee2('0xc')),moment()[_0x7ee2('0xd')]('day')[_0x7ee2('0xe')](_0x7ee2('0xc'))]}},'attributes':['type',_0x7ee2('0xf'),_0x7ee2('0x10'),_0x7ee2('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x8fda=['Request','context','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','create'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x8fda,0x1eb));var _0xa8fd=function(_0x3c6fb8,_0x2dbd5a){_0x3c6fb8=_0x3c6fb8-0x0;var _0x5adcbd=_0x8fda[_0x3c6fb8];return _0x5adcbd;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xa8fd('0x0'));var client=require('../client');exports[_0xa8fd('0x1')]=function(_0x9196d8){return client[_0xa8fd('0x2')]('CreateVoiceCallReport',{'body':_['merge'](_0x9196d8,{'source':_0x9196d8['calleridnum'],'destinationcontext':_0x9196d8[_0xa8fd('0x3')],'callerid':_0x9196d8['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xa8fd('0x4')});};exports[_0xa8fd('0x5')]=function(){return function(){return client[_0xa8fd('0x2')](_0xa8fd('0x6'),{'options':{'where':{'type':[_0xa8fd('0x7')],'createdAt':{'$between':[moment()[_0xa8fd('0x8')]('day')['format'](_0xa8fd('0x9')),moment()[_0xa8fd('0xa')](_0xa8fd('0xb'))['format'](_0xa8fd('0x9'))]}},'attributes':[_0xa8fd('0xc'),_0xa8fd('0xd'),_0xa8fd('0xe'),_0xa8fd('0xf')]},'log':_0xa8fd('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1addffa..1737762 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 _0x5447=['create','Request','CreateVoiceDialReport','../client'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0x5447,0xf3));var _0x7544=function(_0x36030b,_0x5bc667){_0x36030b=_0x36030b-0x0;var _0x3252ce=_0x5447[_0x36030b];return _0x3252ce;};'use strict';var client=require(_0x7544('0x0'));exports[_0x7544('0x1')]=function(_0x505700){return client[_0x7544('0x2')](_0x7544('0x3'),{'body':_0x505700,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x96ed=['CreateVoiceDialReport','../client','Request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x96ed,0x12a));var _0xd96e=function(_0x111b1c,_0x663721){_0x111b1c=_0x111b1c-0x0;var _0xf29fa8=_0x96ed[_0x111b1c];return _0xf29fa8;};'use strict';var client=require(_0xd96e('0x0'));exports['create']=function(_0x1ef30b){return client[_0xd96e('0x1')](_0xd96e('0x2'),{'body':_0x1ef30b,'log':_0xd96e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c69573d..c6e49be 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 _0x6e77=['exten','recordingFormat','getVoiceExtensions'];(function(_0x89ea0e,_0x5c4aa1){var _0x135145=function(_0x22b675){while(--_0x22b675){_0x89ea0e['push'](_0x89ea0e['shift']());}};_0x135145(++_0x5c4aa1);}(_0x6e77,0xef));var _0x76e7=function(_0x1ff7f9,_0x7f4e5d){_0x1ff7f9=_0x1ff7f9-0x0;var _0x42f261=_0x6e77[_0x1ff7f9];return _0x42f261;};'use strict';var client=require('../client');exports[_0x76e7('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x76e7('0x1'),_0x76e7('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x0db9=['recordingFormat','../client','exten'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0db9,0xa3));var _0x90db=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x0db9[_0x313c96];return _0x522f53;};'use strict';var client=require(_0x90db('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x90db('0x1'),_0x90db('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ecd3cf7..2851e7c 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 _0x7b19=['active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','acw','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','name','callerid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7b19,0x1df));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x97b1('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x97b1('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x97b1('0x2'),'acwTimeout','autopause',_0x97b1('0x3'),_0x97b1('0x4'),'dialActive','dialMethod',_0x97b1('0x5'),_0x97b1('0x6'),_0x97b1('0x7'),_0x97b1('0x8'),_0x97b1('0x9'),_0x97b1('0xa'),'dialOriginateCallerIdName',_0x97b1('0xb'),'dialOriginateTimeout',_0x97b1('0xc'),_0x97b1('0xd'),_0x97b1('0xe'),'dialCongestionMaxRetry',_0x97b1('0xf'),_0x97b1('0x10'),_0x97b1('0x11'),_0x97b1('0x12'),_0x97b1('0x13'),_0x97b1('0x14'),_0x97b1('0x15'),_0x97b1('0x16'),_0x97b1('0x17'),'dialCheckDuplicateType',_0x97b1('0x18'),_0x97b1('0x19'),_0x97b1('0x1a'),_0x97b1('0x1b'),_0x97b1('0x1c'),_0x97b1('0x1d'),_0x97b1('0x1e'),_0x97b1('0x1f'),_0x97b1('0x20'),_0x97b1('0x21'),'timeout',_0x97b1('0x22'),'dialRecallInQueue','dialOrderByScheduledAt',_0x97b1('0x23'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x97b1('0x24'),_0x97b1('0x25'),'dialCutDigit',_0x97b1('0x26'),_0x97b1('0x27'),_0x97b1('0x28'),'dialDropRetryFrequency',_0x97b1('0x29'),_0x97b1('0x2a'),_0x97b1('0x2b'),_0x97b1('0x2c'),_0x97b1('0x2d'),_0x97b1('0x2e'),'mandatoryDisposition',_0x97b1('0x2f'),'dialPredictiveIntervalMinThreshold',_0x97b1('0x30'),_0x97b1('0x31')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x97b1('0x32'),_0x97b1('0x33'),_0x97b1('0x34')]},{'model':_0x97b1('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x97b1('0x32')]},{'model':'Trunk','as':_0x97b1('0x36'),'attributes':['id','name','callerid',_0x97b1('0x34')]},{'model':_0x97b1('0x37'),'as':_0x97b1('0x37'),'attributes':['id',_0x97b1('0x32')],'include':[{'model':_0x97b1('0x37'),'as':_0x97b1('0x38'),'attributes':['id',_0x97b1('0x32'),_0x97b1('0x39')]}]}]},'log':_0x97b1('0x3a')});};}; \ No newline at end of file +var _0x23bd=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber'];(function(_0x5b7c5a,_0x3d8285){var _0x4eaa1c=function(_0x17bf86){while(--_0x17bf86){_0x5b7c5a['push'](_0x5b7c5a['shift']());}};_0x4eaa1c(++_0x3d8285);}(_0x23bd,0x1a0));var _0xd23b=function(_0xa7c391,_0x25067f){_0xa7c391=_0xa7c391-0x0;var _0x266e5e=_0x23bd[_0xa7c391];return _0x266e5e;};'use strict';var client=require(_0xd23b('0x0'));exports[_0xd23b('0x1')]=function(){return function(){return client[_0xd23b('0x2')](_0xd23b('0x3'),{'options':{'raw':![],'attributes':['id',_0xd23b('0x4'),_0xd23b('0x5'),_0xd23b('0x6'),_0xd23b('0x7'),_0xd23b('0x8'),'type',_0xd23b('0x9'),_0xd23b('0xa'),_0xd23b('0xb'),_0xd23b('0xc'),_0xd23b('0xd'),_0xd23b('0xe'),'dialPredictiveOptimizationPercentage',_0xd23b('0xf'),_0xd23b('0x10'),_0xd23b('0x11'),_0xd23b('0x12'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0xd23b('0x13'),_0xd23b('0x14'),'dialBusyMaxRetry',_0xd23b('0x15'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xd23b('0x16'),_0xd23b('0x17'),'dialPrefix',_0xd23b('0x18'),'dialAMDActive',_0xd23b('0x19'),_0xd23b('0x1a'),_0xd23b('0x1b'),_0xd23b('0x1c'),_0xd23b('0x1d'),'dialAMDBetweenWordsSilence',_0xd23b('0x1e'),_0xd23b('0x1f'),_0xd23b('0x20'),_0xd23b('0x21'),_0xd23b('0x22'),'dialRecallInQueue','dialOrderByScheduledAt',_0xd23b('0x23'),_0xd23b('0x24'),_0xd23b('0x25'),_0xd23b('0x8'),_0xd23b('0x26'),_0xd23b('0x27'),'dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0xd23b('0x28'),_0xd23b('0x29'),_0xd23b('0x2a'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xd23b('0x2b'),_0xd23b('0x2c'),_0xd23b('0x2d'),_0xd23b('0x2e'),_0xd23b('0x2f'),_0xd23b('0x30')],'include':[{'model':_0xd23b('0x31'),'as':_0xd23b('0x31'),'attributes':['id','name',_0xd23b('0x32'),_0xd23b('0x33')]},{'model':_0xd23b('0x34'),'as':_0xd23b('0x35'),'attributes':['id','name']},{'model':_0xd23b('0x31'),'as':_0xd23b('0x36'),'attributes':['id',_0xd23b('0x4'),_0xd23b('0x32'),_0xd23b('0x33')]},{'model':_0xd23b('0x37'),'as':_0xd23b('0x37'),'attributes':['id','name'],'include':[{'model':_0xd23b('0x37'),'as':'Intervals','attributes':['id',_0xd23b('0x4'),_0xd23b('0x38')]}]}]},'log':_0xd23b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1befb89..6349f08 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(_0x5c2d45,_0x875073){var _0x849dac=function(_0x1a906d){while(--_0x1a906d){_0x5c2d45['push'](_0x5c2d45['shift']());}};_0x849dac(++_0x875073);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x4d86c4,_0x56ba7e){var _0x2d2222=function(_0x573562){while(--_0x573562){_0x4d86c4['push'](_0x4d86c4['shift']());}};_0x2d2222(++_0x56ba7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 7bc3659..e5b9353 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 _0xb301=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1f2027,_0x3ee5d2){var _0x1b3b87=function(_0x8d1540){while(--_0x8d1540){_0x1f2027['push'](_0x1f2027['shift']());}};_0x1b3b87(++_0x3ee5d2);}(_0xb301,0x153));var _0x1b30=function(_0x4cc61d,_0x3fd027){_0x4cc61d=_0x4cc61d-0x0;var _0x916589=_0xb301[_0x4cc61d];return _0x916589;};'use strict';var client=require(_0x1b30('0x0'));exports[_0x1b30('0x1')]=function(_0x579af5){return function(){return client[_0x1b30('0x2')](_0x1b30('0x3'),{'options':{'where':{'VoiceQueueId':_0x579af5,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x4cca=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3c27ee,_0x363a06){var _0x1e6117=function(_0x5ce558){while(--_0x5ce558){_0x3c27ee['push'](_0x3c27ee['shift']());}};_0x1e6117(++_0x363a06);}(_0x4cca,0x78));var _0xa4cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cca[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xa4cc('0x0')]=function(_0x3e41c1){return function(){return client[_0xa4cc('0x1')](_0xa4cc('0x2'),{'options':{'where':{'VoiceQueueId':_0x3e41c1,'paused':!![]},'raw':!![]},'log':_0xa4cc('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 067cde6..95d9218 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(_0x3d9084,_0x4f87e8){var _0x3dc36a=function(_0x29682f){while(--_0x29682f){_0x3d9084['push'](_0x3d9084['shift']());}};_0x3dc36a(++_0x4f87e8);}(_0x7a54,0x106));var _0x47a5=function(_0x18244d,_0x4891f3){_0x18244d=_0x18244d-0x0;var _0x5e48a7=_0x7a54[_0x18244d];return _0x5e48a7;};'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(_0x26a184,_0x3ae3c2){var _0x2f67ee=function(_0xce701c){while(--_0xce701c){_0x26a184['push'](_0x26a184['shift']());}};_0x2f67ee(++_0x3ae3c2);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 00bea26..0370a97 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 _0x7b51=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten'];(function(_0x554b36,_0x529234){var _0x34ed3d=function(_0x505658){while(--_0x505658){_0x554b36['push'](_0x554b36['shift']());}};_0x34ed3d(++_0x529234);}(_0x7b51,0x112));var _0x17b5=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x7b51[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x17b5('0x0'));exports['transfers']={};exports[_0x17b5('0x1')]=function(_0x444bb0){return client[_0x17b5('0x2')](_0x17b5('0x3'),{'body':{'result':_0x444bb0[_0x17b5('0x4')],'transfererchannel':_0x444bb0[_0x17b5('0x5')],'transferercalleridnum':_0x444bb0['transferercalleridnum'],'transferercalleridname':_0x444bb0[_0x17b5('0x6')],'transfererconnectedlinenum':_0x444bb0[_0x17b5('0x7')],'transfererconnectedlinename':_0x444bb0[_0x17b5('0x8')],'transfereraccountcode':_0x444bb0[_0x17b5('0x9')],'transferercontext':_0x444bb0[_0x17b5('0xa')],'transfererexten':_0x444bb0['transfererexten'],'transfererlinkedid':_0x444bb0[_0x17b5('0xb')],'transfereechannel':_0x444bb0[_0x17b5('0xc')],'transfereecalleridnum':_0x444bb0[_0x17b5('0xd')],'transfereecalleridname':_0x444bb0[_0x17b5('0xe')],'transfereeconnectedlinenum':_0x444bb0[_0x17b5('0xf')],'transfereeconnectedlinename':_0x444bb0[_0x17b5('0x10')],'transfereeaccountcode':_0x444bb0['transfereeaccountcode'],'transfereecontext':_0x444bb0['transfereecontext'],'transfereeexten':_0x444bb0[_0x17b5('0x11')],'transfereelinkedid':_0x444bb0[_0x17b5('0x12')],'isexternal':_0x444bb0[_0x17b5('0x13')],'context':_0x444bb0[_0x17b5('0x14')],'extension':_0x444bb0['extension'],'type':_0x17b5('0x15')},'log':_0x17b5('0x3')});};exports[_0x17b5('0x16')]=function(_0x31e695){return client[_0x17b5('0x2')](_0x17b5('0x3'),{'body':{'result':_0x31e695[_0x17b5('0x4')],'transfererchannel':_0x31e695[_0x17b5('0x17')],'transferercalleridnum':_0x31e695['origtransferercalleridnum'],'transferercalleridname':_0x31e695['origtransferercalleridname'],'transfererconnectedlinenum':_0x31e695[_0x17b5('0x18')],'transfererconnectedlinename':_0x31e695[_0x17b5('0x19')],'transfereraccountcode':_0x31e695[_0x17b5('0x1a')],'transferercontext':_0x31e695[_0x17b5('0x1b')],'transfererexten':_0x31e695[_0x17b5('0x1c')],'transfererlinkedid':_0x31e695[_0x17b5('0x1d')],'transfereechannel':_0x31e695[_0x17b5('0x1e')],'transfereecalleridnum':_0x31e695[_0x17b5('0x1f')],'transfereecalleridname':_0x31e695['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x31e695[_0x17b5('0x20')],'transfereeconnectedlinename':_0x31e695[_0x17b5('0x21')],'transfereeaccountcode':_0x31e695['transfertargetaccountcode'],'transfereecontext':_0x31e695[_0x17b5('0x22')],'transfereeexten':_0x31e695[_0x17b5('0x23')],'transfereelinkedid':_0x31e695[_0x17b5('0x24')],'isexternal':_0x31e695[_0x17b5('0x13')],'context':_0x31e695['origtransferercontext'],'extension':_0x31e695[_0x17b5('0x25')],'type':_0x17b5('0x26')},'log':_0x17b5('0x3')});}; \ No newline at end of file +var _0xf200=['transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x3f0a92,_0x4bc38d){var _0x273bd7=function(_0x5f5cb4){while(--_0x5f5cb4){_0x3f0a92['push'](_0x3f0a92['shift']());}};_0x273bd7(++_0x4bc38d);}(_0xf200,0x6c));var _0x0f20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf200[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0f20('0x0'));exports[_0x0f20('0x1')]={};exports[_0x0f20('0x2')]=function(_0x20c3f9){return client[_0x0f20('0x3')](_0x0f20('0x4'),{'body':{'result':_0x20c3f9['result'],'transfererchannel':_0x20c3f9[_0x0f20('0x5')],'transferercalleridnum':_0x20c3f9[_0x0f20('0x6')],'transferercalleridname':_0x20c3f9[_0x0f20('0x7')],'transfererconnectedlinenum':_0x20c3f9[_0x0f20('0x8')],'transfererconnectedlinename':_0x20c3f9[_0x0f20('0x9')],'transfereraccountcode':_0x20c3f9[_0x0f20('0xa')],'transferercontext':_0x20c3f9[_0x0f20('0xb')],'transfererexten':_0x20c3f9['transfererexten'],'transfererlinkedid':_0x20c3f9[_0x0f20('0xc')],'transfereechannel':_0x20c3f9[_0x0f20('0xd')],'transfereecalleridnum':_0x20c3f9[_0x0f20('0xe')],'transfereecalleridname':_0x20c3f9[_0x0f20('0xf')],'transfereeconnectedlinenum':_0x20c3f9['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x20c3f9[_0x0f20('0x10')],'transfereeaccountcode':_0x20c3f9['transfereeaccountcode'],'transfereecontext':_0x20c3f9[_0x0f20('0x11')],'transfereeexten':_0x20c3f9[_0x0f20('0x12')],'transfereelinkedid':_0x20c3f9['transfereelinkedid'],'isexternal':_0x20c3f9[_0x0f20('0x13')],'context':_0x20c3f9[_0x0f20('0x14')],'extension':_0x20c3f9[_0x0f20('0x15')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x0f20('0x16')]=function(_0x5d8ed1){return client[_0x0f20('0x3')](_0x0f20('0x4'),{'body':{'result':_0x5d8ed1[_0x0f20('0x17')],'transfererchannel':_0x5d8ed1[_0x0f20('0x18')],'transferercalleridnum':_0x5d8ed1[_0x0f20('0x19')],'transferercalleridname':_0x5d8ed1[_0x0f20('0x1a')],'transfererconnectedlinenum':_0x5d8ed1[_0x0f20('0x1b')],'transfererconnectedlinename':_0x5d8ed1[_0x0f20('0x1c')],'transfereraccountcode':_0x5d8ed1[_0x0f20('0x1d')],'transferercontext':_0x5d8ed1[_0x0f20('0x1e')],'transfererexten':_0x5d8ed1[_0x0f20('0x1f')],'transfererlinkedid':_0x5d8ed1[_0x0f20('0x20')],'transfereechannel':_0x5d8ed1[_0x0f20('0x21')],'transfereecalleridnum':_0x5d8ed1['transfertargetcalleridnum'],'transfereecalleridname':_0x5d8ed1[_0x0f20('0x22')],'transfereeconnectedlinenum':_0x5d8ed1[_0x0f20('0x23')],'transfereeconnectedlinename':_0x5d8ed1[_0x0f20('0x24')],'transfereeaccountcode':_0x5d8ed1[_0x0f20('0x25')],'transfereecontext':_0x5d8ed1[_0x0f20('0x26')],'transfereeexten':_0x5d8ed1['transfertargetexten'],'transfereelinkedid':_0x5d8ed1[_0x0f20('0x27')],'isexternal':_0x5d8ed1[_0x0f20('0x13')],'context':_0x5d8ed1[_0x0f20('0x28')],'extension':_0x5d8ed1['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c4ad126..694a448 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x54db84,_0x1ff895){var _0x338913=function(_0x4eaebd){while(--_0x4eaebd){_0x54db84['push'](_0x54db84['shift']());}};_0x338913(++_0x1ff895);}(_0x7a54,0x106));var _0x47a5=function(_0x14c99c,_0x39c465){_0x14c99c=_0x14c99c-0x0;var _0xe57d1a=_0x7a54[_0x14c99c];return _0xe57d1a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x286f14,_0x296a4b){var _0x452dd1=function(_0x45c959){while(--_0x45c959){_0x286f14['push'](_0x286f14['shift']());}};_0x452dd1(++_0x296a4b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5da0e9,_0x43c898){_0x5da0e9=_0x5da0e9-0x0;var _0x4b022d=_0xb10b[_0x5da0e9];return _0x4b022d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 450f64e..599a378 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 _0xe3b7=['isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','phone','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','action','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xe3b7,0x17e));var _0x7e3b=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xe3b7[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x7e3b('0x0'));var BPromise=require(_0x7e3b('0x1'));var Redis=require(_0x7e3b('0x2'));var util=require(_0x7e3b('0x3'));var config=require(_0x7e3b('0x4'));var logger=require('../../../../config/logger')(_0x7e3b('0x5'));var cmContactRpc=require(_0x7e3b('0x6'));config[_0x7e3b('0x7')]=_[_0x7e3b('0x8')](config[_0x7e3b('0x7')],{'host':_0x7e3b('0x9'),'port':0x18eb});var io=require(_0x7e3b('0xa'))(new Redis(config[_0x7e3b('0x7')]));function emit(_0xacfb06,_0x3dcedf,_0x332206,_0x324ebc,_0xe729bd){logger[_0x7e3b('0xb')]('[CM][%s][%s]',_0xacfb06,_0x3dcedf['id'],_0x332206,_0x324ebc,JSON[_0x7e3b('0xc')](_0xe729bd));io['to'](_0x332206)[_0x7e3b('0xd')](_0x324ebc,_0xe729bd);}exports[_0x7e3b('0xe')]=function(_0x571ea2,_0x156baf,_0x19c3e2,_0x4f43c8){var _0x301a8a,_0x595037;var _0x2361f4={};var _0x616635;var _0x18dbdf=Number(_0x19c3e2[_0x7e3b('0xf')]);var _0x493c13=_0x19c3e2['data2']?Boolean(Number(_0x19c3e2[_0x7e3b('0x10')])):![];var _0x49513b;var _0x218bb4=![];if(!_[_0x7e3b('0x11')](_0x19c3e2[_0x7e3b('0x12')])){if(_0x19c3e2[_0x7e3b('0x12')]=='1')_0x218bb4=!![];}if(!_0x218bb4){if(_0x4f43c8[_0x7e3b('0x13')]){_0x2361f4['id']=_0x4f43c8[_0x7e3b('0x13')];}}if(!_0x2361f4['id']){_0x2361f4[_0x7e3b('0x14')]=_0x18dbdf;_0x49513b=_0x19c3e2[_0x7e3b('0x15')]&&_0x19c3e2[_0x7e3b('0x15')]!=='0'?_0x19c3e2['data3'][_0x7e3b('0x16')](','):['phone'];_0x2361f4[_0x7e3b('0x17')]=_[_0x7e3b('0x18')](_0x49513b,function(_0x4861f9){var _0x24a525={};_0x24a525[_0x4861f9]=_0x4f43c8['routeId']?_0x4f43c8[_0x7e3b('0x19')]:_0x4f43c8[_0x7e3b('0x1a')];return _0x24a525;});_0x616635=_0x4f43c8[_0x7e3b('0x1b')]?_0x4f43c8[_0x7e3b('0x19')]:_0x4f43c8['calleridnum'];}var _0x427781=['id',_0x7e3b('0x1c'),_0x7e3b('0x1d'),_0x7e3b('0x1e'),_0x7e3b('0x1f'),_0x7e3b('0x20'),_0x7e3b('0x14'),'createdAt',_0x7e3b('0x21'),_0x7e3b('0x22')];var _0x1fb422=_[_0x7e3b('0x23')](_0x427781,_0x49513b);BPromise[_0x7e3b('0x24')]()[_0x7e3b('0x25')](cmContactRpc[_0x7e3b('0x26')]({'attributes':_0x1fb422,'where':_0x2361f4,'phone':_0x616635}))[_0x7e3b('0x25')](function(_0x9ecb90){_0x595037=_0x9ecb90;if(!_[_0x7e3b('0x27')](_0x595037)){if(_0x595037['length']===0x1){_0x301a8a=_0x595037[0x0];logger[_0x7e3b('0xb')](_0x7e3b('0x28'),_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id'],_0x301a8a['id']);}else{logger[_0x7e3b('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id'],_[_0x7e3b('0x18')](_0x595037,'id')[_0x7e3b('0x2a')](','));}return;}else{logger[_0x7e3b('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id']);var _0xee32c4={'ListId':_0x18dbdf};var _0x2b8a75=_0x19c3e2['data4']&&_0x19c3e2[_0x7e3b('0x2b')]!=='0'?_0x19c3e2[_0x7e3b('0x2b')]:'phone';if(_0x493c13){logger[_0x7e3b('0xb')](_0x7e3b('0x2c'),_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id']);_0xee32c4[_0x2b8a75]=_[_0x7e3b('0x11')](_0x4f43c8[_0x7e3b('0x1b')])?_0x4f43c8[_0x7e3b('0x1a')]:_0x4f43c8[_0x7e3b('0x19')];if(_[_0x7e3b('0x11')](_0x4f43c8[_0x7e3b('0x1b')])){_0xee32c4[_0x7e3b('0x1c')]=_0x4f43c8[_0x7e3b('0x2d')]&&_0x4f43c8[_0x7e3b('0x2d')]!==_0x7e3b('0x2e')?_0x4f43c8['calleridname']:_0x7e3b('0x2f');}else{_0xee32c4[_0x7e3b('0x1c')]=_0x4f43c8[_0x7e3b('0x30')]&&_0x4f43c8[_0x7e3b('0x30')]!==_0x7e3b('0x2e')?_0x4f43c8[_0x7e3b('0x30')]:_0x7e3b('0x2f');}return BPromise[_0x7e3b('0x24')]()[_0x7e3b('0x25')](cmContactRpc[_0x7e3b('0x31')](_0xee32c4))[_0x7e3b('0x25')](function(_0x381b28){_0x301a8a=_0x381b28;_0x595037[_0x7e3b('0x32')](_0x381b28);if(_0x301a8a){logger['info'](_0x7e3b('0x33'),_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id'],_0x301a8a['id']);}return;});}else{logger[_0x7e3b('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4f43c8[_0x7e3b('0x29')],_0x156baf['id']);_0xee32c4[_0x2b8a75]=_[_0x7e3b('0x11')](_0x4f43c8[_0x7e3b('0x1b')])?_0x4f43c8[_0x7e3b('0x1a')]:_0x4f43c8[_0x7e3b('0x19')];if(_['isNil'](_0x4f43c8['routeId'])){_0xee32c4[_0x7e3b('0x1c')]=_0x4f43c8[_0x7e3b('0x2d')]&&_0x4f43c8[_0x7e3b('0x2d')]!==''?_0x4f43c8[_0x7e3b('0x2d')]:_0x7e3b('0x2f');}else{_0xee32c4[_0x7e3b('0x1c')]=_0x4f43c8[_0x7e3b('0x30')]&&_0x4f43c8[_0x7e3b('0x30')]!==_0x7e3b('0x2e')?_0x4f43c8[_0x7e3b('0x30')]:_0x7e3b('0x2f');}_0x301a8a=_0xee32c4;_0x595037[_0x7e3b('0x32')](_0xee32c4);return;}}})[_0x7e3b('0x25')](function(){if(_0x571ea2){emit(_0x4f43c8['uniqueid'],_0x156baf,util[_0x7e3b('0x34')](_0x7e3b('0x35'),_0x571ea2['name']),util[_0x7e3b('0x34')]('trigger:%s',_0x19c3e2[_0x7e3b('0x36')][_0x7e3b('0x37')]()),{'evt':_['merge'](_0x4f43c8,{'autoCreate':_0x493c13}),'contact':_0x301a8a===undefined?{}:_0x301a8a,'contacts':_0x595037[_0x7e3b('0x38')]===0x0?undefined:_0x595037});}});}; \ No newline at end of file +var _0x1777=['[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1777,0x168));var _0x7177=function(_0x51687c,_0x14ce1f){_0x51687c=_0x51687c-0x0;var _0x15422b=_0x1777[_0x51687c];return _0x15422b;};'use strict';var _=require('lodash');var BPromise=require(_0x7177('0x0'));var Redis=require(_0x7177('0x1'));var util=require(_0x7177('0x2'));var config=require(_0x7177('0x3'));var logger=require('../../../../config/logger')(_0x7177('0x4'));var cmContactRpc=require(_0x7177('0x5'));config[_0x7177('0x6')]=_[_0x7177('0x7')](config[_0x7177('0x6')],{'host':_0x7177('0x8'),'port':0x18eb});var io=require(_0x7177('0x9'))(new Redis(config[_0x7177('0x6')]));function emit(_0x44a188,_0x1ffa47,_0x38cfd0,_0x1a9b1d,_0x234f9d){logger['info']('[CM][%s][%s]',_0x44a188,_0x1ffa47['id'],_0x38cfd0,_0x1a9b1d,JSON[_0x7177('0xa')](_0x234f9d));io['to'](_0x38cfd0)[_0x7177('0xb')](_0x1a9b1d,_0x234f9d);}exports[_0x7177('0xc')]=function(_0x48a7b4,_0x2166b4,_0x4de9e9,_0x3b214a){var _0x3d33ae,_0xb93b7d;var _0x256fc4={};var _0x568965;var _0x303b5e=Number(_0x4de9e9[_0x7177('0xd')]);var _0x157dd3=_0x4de9e9[_0x7177('0xe')]?Boolean(Number(_0x4de9e9[_0x7177('0xe')])):![];var _0x5a8214;var _0x205023=![];if(!_[_0x7177('0xf')](_0x4de9e9[_0x7177('0x10')])){if(_0x4de9e9[_0x7177('0x10')]=='1')_0x205023=!![];}if(!_0x205023){if(_0x3b214a[_0x7177('0x11')]){_0x256fc4['id']=_0x3b214a['xmd-contactid'];}}if(!_0x256fc4['id']){_0x256fc4[_0x7177('0x12')]=_0x303b5e;_0x5a8214=_0x4de9e9['data3']&&_0x4de9e9[_0x7177('0x13')]!=='0'?_0x4de9e9[_0x7177('0x13')][_0x7177('0x14')](','):[_0x7177('0x15')];_0x256fc4[_0x7177('0x16')]=_[_0x7177('0x17')](_0x5a8214,function(_0x52848f){var _0x23eca4={};_0x23eca4[_0x52848f]=_0x3b214a[_0x7177('0x18')]?_0x3b214a[_0x7177('0x19')]:_0x3b214a[_0x7177('0x1a')];return _0x23eca4;});_0x568965=_0x3b214a['routeId']?_0x3b214a[_0x7177('0x19')]:_0x3b214a[_0x7177('0x1a')];}var _0x52a73f=['id','firstName','lastName',_0x7177('0x15'),_0x7177('0x1b'),_0x7177('0x1c'),'ListId',_0x7177('0x1d'),_0x7177('0x1e'),_0x7177('0x1f')];var _0x59a341=_[_0x7177('0x20')](_0x52a73f,_0x5a8214);BPromise[_0x7177('0x21')]()[_0x7177('0x22')](cmContactRpc[_0x7177('0x23')]({'attributes':_0x59a341,'where':_0x256fc4,'phone':_0x568965}))[_0x7177('0x22')](function(_0x2af79e){_0xb93b7d=_0x2af79e;if(!_[_0x7177('0x24')](_0xb93b7d)){if(_0xb93b7d[_0x7177('0x25')]===0x1){_0x3d33ae=_0xb93b7d[0x0];logger[_0x7177('0x26')](_0x7177('0x27'),_0x3b214a['uniqueid'],_0x2166b4['id'],_0x3d33ae['id']);}else{logger[_0x7177('0x26')](_0x7177('0x28'),_0x3b214a['uniqueid'],_0x2166b4['id'],_[_0x7177('0x17')](_0xb93b7d,'id')[_0x7177('0x29')](','));}return;}else{logger[_0x7177('0x26')](_0x7177('0x2a'),_0x3b214a[_0x7177('0x2b')],_0x2166b4['id']);var _0x188c36={'ListId':_0x303b5e};var _0x2878f4=_0x4de9e9[_0x7177('0x2c')]&&_0x4de9e9['data4']!=='0'?_0x4de9e9[_0x7177('0x2c')]:_0x7177('0x15');if(_0x157dd3){logger['info'](_0x7177('0x2d'),_0x3b214a[_0x7177('0x2b')],_0x2166b4['id']);_0x188c36[_0x2878f4]=_[_0x7177('0xf')](_0x3b214a[_0x7177('0x18')])?_0x3b214a[_0x7177('0x1a')]:_0x3b214a[_0x7177('0x19')];if(_['isNil'](_0x3b214a[_0x7177('0x18')])){_0x188c36[_0x7177('0x2e')]=_0x3b214a[_0x7177('0x2f')]&&_0x3b214a[_0x7177('0x2f')]!==''?_0x3b214a['calleridname']:_0x7177('0x30');}else{_0x188c36[_0x7177('0x2e')]=_0x3b214a[_0x7177('0x31')]&&_0x3b214a[_0x7177('0x31')]!==_0x7177('0x32')?_0x3b214a[_0x7177('0x31')]:_0x7177('0x30');}return BPromise[_0x7177('0x21')]()[_0x7177('0x22')](cmContactRpc[_0x7177('0x33')](_0x188c36))[_0x7177('0x22')](function(_0x51ba84){_0x3d33ae=_0x51ba84;_0xb93b7d['push'](_0x51ba84);if(_0x3d33ae){logger[_0x7177('0x26')](_0x7177('0x34'),_0x3b214a['uniqueid'],_0x2166b4['id'],_0x3d33ae['id']);}return;});}else{logger[_0x7177('0x26')](_0x7177('0x35'),_0x3b214a[_0x7177('0x2b')],_0x2166b4['id']);_0x188c36[_0x2878f4]=_['isNil'](_0x3b214a['routeId'])?_0x3b214a['calleridnum']:_0x3b214a['destcalleridnum'];if(_[_0x7177('0xf')](_0x3b214a[_0x7177('0x18')])){_0x188c36[_0x7177('0x2e')]=_0x3b214a[_0x7177('0x2f')]&&_0x3b214a[_0x7177('0x2f')]!==_0x7177('0x32')?_0x3b214a[_0x7177('0x2f')]:'Unknown';}else{_0x188c36[_0x7177('0x2e')]=_0x3b214a['destcalleridname']&&_0x3b214a[_0x7177('0x31')]!==''?_0x3b214a[_0x7177('0x31')]:_0x7177('0x30');}_0x3d33ae=_0x188c36;_0xb93b7d[_0x7177('0x36')](_0x188c36);return;}}})[_0x7177('0x22')](function(){if(_0x48a7b4){emit(_0x3b214a['uniqueid'],_0x2166b4,util[_0x7177('0x37')]('user:%s',_0x48a7b4[_0x7177('0x38')]),util['format']('trigger:%s',_0x4de9e9['action'][_0x7177('0x39')]()),{'evt':_[_0x7177('0x3a')](_0x3b214a,{'autoCreate':_0x157dd3}),'contact':_0x3d33ae===undefined?{}:_0x3d33ae,'contacts':_0xb93b7d[_0x7177('0x25')]===0x0?undefined:_0xb93b7d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2148de0..0710432 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 _0x7b81=['format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','parse','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','length','checkTrigger:\x20trigger','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','event','agent','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','localhost','socket.io-emitter','redis','popup','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','buildUri','isNil','data3','data4','location','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments'];(function(_0x47d7c7,_0x54d418){var _0xcf0d03=function(_0x154a64){while(--_0x154a64){_0x47d7c7['push'](_0x47d7c7['shift']());}};_0xcf0d03(++_0x54d418);}(_0x7b81,0xab));var _0x17b8=function(_0x5d0c2a,_0xb830e8){_0x5d0c2a=_0x5d0c2a-0x0;var _0x286a3e=_0x7b81[_0x5d0c2a];return _0x286a3e;};'use strict';var util=require('util');var _=require(_0x17b8('0x0'));var url=require(_0x17b8('0x1'));var Mustache=require(_0x17b8('0x2'));var Redis=require(_0x17b8('0x3'));var urlforward=require(_0x17b8('0x4'));var integration=require(_0x17b8('0x5'));var cmContact=require('./cmContact');var script=require(_0x17b8('0x6'));var config=require(_0x17b8('0x7'));var logger=require(_0x17b8('0x8'))(_0x17b8('0x9'));var ami=require(_0x17b8('0xa'));config['redis']=_[_0x17b8('0xb')](config['redis'],{'host':_0x17b8('0xc'),'port':0x18eb});var io=require(_0x17b8('0xd'))(new Redis(config[_0x17b8('0xe')]));var operators={'equals':function(_0x30009e,_0x1e60f7){return _0x30009e==_0x1e60f7;},'not_equals':function(_0x2ef15e,_0x3aaac4){return _0x2ef15e!=_0x3aaac4;}};var barAndWebActions=[_0x17b8('0xf'),_0x17b8('0x1'),'winapp'];function Trigger(_0x4d4689){this[_0x17b8('0x10')]=_0x4d4689[_0x17b8('0x10')];this['agents']=_0x4d4689[_0x17b8('0x11')];this['voiceQueues']=_0x4d4689['voiceQueues'];this['templates']=_0x4d4689[_0x17b8('0x12')];this['voiceExtensions']=_0x4d4689[_0x17b8('0x13')];this[_0x17b8('0x14')]=_0x4d4689[_0x17b8('0x14')];this[_0x17b8('0x15')]=_0x4d4689[_0x17b8('0x15')];this['salesforceAccounts']=_0x4d4689[_0x17b8('0x16')];this['sugarcrmAccounts']=_0x4d4689[_0x17b8('0x17')];this[_0x17b8('0x18')]=_0x4d4689[_0x17b8('0x18')];this[_0x17b8('0x19')]=_0x4d4689['deskAccounts'];this['vtigerAccounts']=_0x4d4689[_0x17b8('0x1a')];this['servicenowAccounts']=_0x4d4689['servicenowAccounts'];this[_0x17b8('0x1b')]=_0x4d4689[_0x17b8('0x1b')];this[_0x17b8('0x1c')]=_0x4d4689[_0x17b8('0x1c')];this[_0x17b8('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x17b8('0x15')],'sugarcrm':this[_0x17b8('0x17')],'zoho':this[_0x17b8('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x17b8('0x1a')],'dynamics365':this[_0x17b8('0x1b')],'freshsales':this[_0x17b8('0x1c')],'servicenow':this[_0x17b8('0x1e')]};ami['on'](_0x17b8('0x1f'),this[_0x17b8('0x20')]['bind'](this));ami['on']('custom:agentconnect',this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x17b8('0x23'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x24'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x25'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x26'),this[_0x17b8('0x20')]['bind'](this));ami['on']('custom:agentcongestion',this[_0x17b8('0x20')]['bind'](this));ami['on']('custom:agentreject',this[_0x17b8('0x20')]['bind'](this));ami['on'](_0x17b8('0x27'),this['syncCustomEvent']['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x17b8('0x21')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x28'),this[_0x17b8('0x29')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x2a'),this[_0x17b8('0x29')][_0x17b8('0x21')](this));ami['on']('custom:dialend',this[_0x17b8('0x29')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x2b'),this[_0x17b8('0x20')]['bind'](this));ami['on'](_0x17b8('0x2c'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x2d'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x2e'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on']('custom:outgoingmessage',this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x2f'),this[_0x17b8('0x20')]['bind'](this));ami['on'](_0x17b8('0x30'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));ami['on'](_0x17b8('0x31'),this[_0x17b8('0x20')][_0x17b8('0x21')](this));}Trigger[_0x17b8('0x32')][_0x17b8('0x33')]=function(_0x192676,_0x4efcf1,_0x7d2c5){logger['info'](_0x192676,_0x4efcf1,JSON[_0x17b8('0x34')](_0x7d2c5));io['to'](_0x192676)[_0x17b8('0x33')](_0x4efcf1,_0x7d2c5);};Trigger['prototype'][_0x17b8('0x20')]=function(_0x51f308){var _0x558dfe=_[_0x17b8('0x35')](_0x51f308);if(typeof _0x558dfe[_0x17b8('0x36')]===_0x17b8('0x37')){_0x558dfe[_0x17b8('0x36')]=_0x17b8('0x38');}logger[_0x17b8('0x39')](_0x17b8('0x20'),util[_0x17b8('0x3a')](_0x558dfe,{'showHidden':!![],'depth':null}));this[_0x17b8('0x3b')](_0x558dfe);};Trigger[_0x17b8('0x32')][_0x17b8('0x29')]=function(_0x28c326){if(this['agents'][_0x28c326[_0x17b8('0x3c')]]){this[_0x17b8('0x20')](_0x28c326);}};Trigger['prototype'][_0x17b8('0x3b')]=function(_0x2f0d19){var _0x22a146;for(var _0x4fa58c in this['triggers']){if(this[_0x17b8('0x10')][_0x17b8('0x3d')](_0x4fa58c)){if(this['triggers'][_0x4fa58c][_0x17b8('0x3e')]){_0x22a146=this[_0x17b8('0x3f')](this[_0x17b8('0x10')][_0x4fa58c],_0x2f0d19);if(_0x22a146){_['merge'](_0x2f0d19,_0x2f0d19[_0x17b8('0x40')]);for(var _0xd36c2a=0x0,_0x54ff09,_0x483276,_0x3f6da6;_0xd36c2a0x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x4949f6,_0x20e8e8){var _0x589521=function(_0x46421f){while(--_0x46421f){_0x4949f6['push'](_0x4949f6['shift']());}};_0x589521(++_0x20e8e8);}(_0x55ca,0x126));var _0xa55c=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x55ca[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 14ace6d..cd53880 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 _0x299a=['isdisabled',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','catch','toLowerCase','outbound','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','&$filter=','replace','%2b','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','tenantId','CloudProvider','data2','resolve','POST','clientId','username','password','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length'];(function(_0x560438,_0x430f68){var _0xdf800d=function(_0x23884e){while(--_0x23884e){_0x560438['push'](_0x560438['shift']());}};_0xdf800d(++_0x430f68);}(_0x299a,0x17b));var _0xa299=function(_0x1567cd,_0x27f207){_0x1567cd=_0x1567cd-0x0;var _0x4b3b8a=_0x299a[_0x1567cd];return _0x4b3b8a;};'use strict';var _=require(_0xa299('0x0'));var rp=require(_0xa299('0x1'));var util=require(_0xa299('0x2'));var intUtil=require(_0xa299('0x3'));var md5=require(_0xa299('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0xa299('0x5'));var config=require(_0xa299('0x6'));config[_0xa299('0x7')]=_['defaults'](config[_0xa299('0x7')],{'host':_0xa299('0x8'),'port':0x18eb});var io=require(_0xa299('0x9'))(new Redis(config[_0xa299('0x7')]));function getAuthToken(_0x44d47b,_0x20c5f4,_0x80d8dc){if(_0x44d47b[_0xa299('0xa')]){_0x44d47b[_0xa299('0xb')]=_0x44d47b['CloudProvider']['data7'];_0x44d47b[_0xa299('0xc')]=_0x44d47b[_0xa299('0xd')][_0xa299('0xe')];return Promise[_0xa299('0xf')](_0x44d47b[_0xa299('0xd')]['data5']);}var _0xea9588={'method':_0xa299('0x10'),'uri':_0x20c5f4,'form':{'client_id':_0x44d47b[_0xa299('0x11')],'resource':_0x44d47b[_0xa299('0xb')],'username':_0x44d47b[_0xa299('0x12')],'password':_0x44d47b[_0xa299('0x13')],'grant_type':'password','client_secret':_0x44d47b['clientSecret']},'json':!![]};return rp(_0xea9588)['then'](function(_0x3ca194){return _0x3ca194['access_token'];})['catch'](function(_0x42c433){logger[_0xa299('0x14')]('['+[_0x80d8dc[_0xa299('0x15')]()]+']\x20Wrong\x20credentials!');return _0x42c433[_0xa299('0x16')];});}function getUser(_0x46d9d6,_0xfa988d,_0x910c70,_0x6e993d,_0x5aea55,_0x4a4d34){return new Promise(function(_0x3f70fb,_0x1de5d4){return getAuthToken(_0xfa988d,_0x6e993d,_0x4a4d34)[_0xa299('0x17')](function(_0x176fa9){var _0x44213c={'method':_0xa299('0x18'),'uri':_0x5aea55+_0xa299('0x19'),'headers':{'Authorization':_0xa299('0x1a')+_0x176fa9,'OData-Version':_0xa299('0x1b')},'json':!![]};return rp(_0x44213c);})['then'](function(_0x399397){var _0x23c687=_0x399397[_0xa299('0x1c')];var _0x1d0b69=![];var _0x119fb3=null;if(!_['isNil'](_0x910c70)){if(intUtil[_0xa299('0x1d')](_0x910c70[_0xa299('0x1e')])){_0x46d9d6[_0xa299('0x1f')]=_0x910c70[_0xa299('0x1e')];for(_0x119fb3=0x0;_0x119fb3<_0x23c687[_0xa299('0x20')];_0x119fb3++){if(_0x23c687[_0x119fb3]['internalemailaddress']===_0x910c70[_0xa299('0x1e')]&&!_0x23c687[_0x119fb3][_0xa299('0x21')]){_0x1d0b69=!![];logger['info']('['+[_0x4a4d34['toUpperCase']()]+_0xa299('0x22')+_0x23c687[_0x119fb3]['systemuserid']+'!');_0x46d9d6[_0xa299('0x23')]=_0x23c687[_0x119fb3][_0xa299('0x24')];}}}}if(!_0x1d0b69){logger['info']('['+[_0x4a4d34[_0xa299('0x15')]()]+_0xa299('0x25'));_0x46d9d6['userEmail']=_0xfa988d['username'];for(_0x119fb3=0x0;_0x119fb3<_0x23c687[_0xa299('0x20')];_0x119fb3++){if(_0x23c687[_0x119fb3][_0xa299('0x26')]===_0xfa988d[_0xa299('0x12')]){_0x46d9d6[_0xa299('0x23')]=_0x23c687[_0x119fb3][_0xa299('0x24')];}}}_0x3f70fb(_0x46d9d6);})[_0xa299('0x27')](function(_0x144329){_0x1de5d4(_0x144329[_0xa299('0x16')]);});});}function createEndUser(_0x2d8236,_0x490432,_0x52cfa1,_0x108ce2,_0x507613,_0x42dc06,_0x4d9891){return new Promise(function(_0x5543c6,_0x80273a){return getAuthToken(_0x490432,_0x52cfa1,_0x42dc06)['then'](function(_0x559da2){var _0x3fab20=_0x42dc06[_0xa299('0x28')]()===_0xa299('0x29')?_0x507613['destcalleridnum']:_0x507613[_0xa299('0x2a')];var _0xdde40={'method':_0xa299('0x10'),'uri':_0x108ce2+_0xa299('0x2b'),'body':{'fullname':_0x3fab20,'firstname':_0x3fab20,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2d8236[_0xa299('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x559da2,'OData-Version':_0xa299('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0xdde40[_0xa299('0x2c')][_0x4d9891]=_0x3fab20;return rp(_0xdde40);})[_0xa299('0x17')](function(_0x1526ed){var _0x3af45f=_0x1526ed[_0xa299('0x2d')][_0xa299('0x2e')];var _0x35ab9b=_0x3af45f[_0xa299('0x2f')](_0x3af45f[_0xa299('0x30')]('(')+0x1,_0x3af45f[_0xa299('0x30')](')'));_0x2d8236[_0xa299('0x31')]=_0x35ab9b;_0x5543c6(_0x2d8236);})['catch'](function(_0x13e8a6){_0x80273a(_0x13e8a6['message']);});});}function getEndUser(_0x54ed9e,_0xca5511,_0x495087,_0x3ac31a,_0x4becb0,_0x463ec0,_0x294f4e,_0x121837){var _0x37972c=_0x463ec0[_0xa299('0x28')]()==='outbound'?_0x4becb0[_0xa299('0x32')]:_0x4becb0['calleridnum'];return getAuthToken(_0xca5511,_0x495087,_0x463ec0)[_0xa299('0x17')](function(_0x2d6837){_0x121837=_0x121837?_0x121837:_0xa299('0x33');var _0x1e6727={'method':_0xa299('0x18'),'uri':_0x3ac31a+'contacts?$select='+_0x121837+_0xa299('0x34')+_0x121837+'\x20eq\x20\x27'+_0x37972c[_0xa299('0x35')]('+',_0xa299('0x36'))+'\x27','headers':{'Authorization':_0xa299('0x1a')+_0x2d6837,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e6727);})[_0xa299('0x17')](function(_0xc07c8f){var _0x12e246=![];if(!_0xc07c8f)return _0x12e246;var _0x21be46=_0xc07c8f[_0xa299('0x1c')];for(var _0x3e9163=0x0;_0x3e9163<_0x21be46[_0xa299('0x20')];_0x3e9163++){if(_0x21be46[_0x3e9163][_0x121837]===_0x37972c){_0x12e246=!![];_0x54ed9e[_0xa299('0x31')]=_0x21be46[_0x3e9163]['contactid'];}}return _0x12e246;})['then'](function(_0x52ee91){if(_0x52ee91)return _0x54ed9e;if(_0x294f4e==='nothing'){logger[_0xa299('0x37')]('['+[_0x463ec0[_0xa299('0x15')]()]+_0xa299('0x38'));return _0x54ed9e;}return createEndUser(_0x54ed9e,_0xca5511,_0x495087,_0x3ac31a,_0x4becb0,_0x463ec0,_0x121837)[_0xa299('0x17')](function(_0x262eee){logger['info']('['+[_0x463ec0[_0xa299('0x15')]()]+']\x20Enduser\x20created!',_0x262eee['enduserId']);return _0x262eee;});});}function getCustomFields(_0x5870dc,_0x3c8c09,_0x3dffae){var _0x47941a={};if(_0x5870dc[_0xa299('0x20')]>0x0){_[_0xa299('0x39')](_0x5870dc,function(_0x2c49a5){if(_[_0xa299('0x3a')]([_0xa299('0x3b'),_0xa299('0x3c')],_0x2c49a5['type'])&&_0x2c49a5[_0xa299('0x3d')]&&!_0x2c49a5[_0xa299('0x3e')]){var _0xe584e8=_0x2c49a5[_0xa299('0x3f')]['toLowerCase']();var _0x15973b=_0xe584e8[_0xa299('0x2f')](0x0,_0xe584e8['indexOf']('_'));var _0x51f5d1=_0xe584e8[_0xa299('0x2f')](_0xe584e8[_0xa299('0x40')]('_')+0x1);if(_0x15973b===_0x3dffae){_0x47941a[_0x51f5d1]=_0x2c49a5[_0xa299('0x41')];}}});}return _0x47941a;}function getTicket(_0x431b69,_0x282f9f,_0x12e1ec,_0x8c3b20,_0x4805bb,_0x2af155,_0x29c3b3){return new Promise(function(_0x1b375b,_0x2383ed){var _0x5c6806;return getAuthToken(_0x282f9f,_0x12e1ec,_0x29c3b3)['then'](function(_0x37bfaf){if(_0x2af155[_0xa299('0x42')]===_0xa299('0x43')){_0x5c6806={'method':_0xa299('0x10'),'uri':_0x8c3b20+_0xa299('0x44'),'body':Object[_0xa299('0x45')]({},{'title':intUtil[_0xa299('0x46')](_0x2af155[_0xa299('0x47')],_0x4805bb,'\x20'),'description':intUtil[_0xa299('0x46')](_0x2af155[_0xa299('0x48')],_0x4805bb,'\x0a'),'customerid_contact@odata.bind':_0x431b69[_0xa299('0x31')]?_0xa299('0x49')+_0x431b69[_0xa299('0x31')]+')':undefined,'ownerid@odata.bind':_0xa299('0x4a')+_0x431b69['userId']+')','caseorigincode':'1'},getCustomFields(_0x2af155['Fields'],_0x4805bb,_0x2af155[_0xa299('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x37bfaf,'OData-Version':_0xa299('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2af155[_0xa299('0x42')]===_0xa299('0x4b')){var _0xfe979e=_0x431b69[_0xa299('0x31')]?[{'partyid_systemuser@odata.bind':_0xa299('0x4a')+_0x431b69['userId']+')','participationtypemask':_0x431b69[_0xa299('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xa299('0x49')+_0x431b69[_0xa299('0x31')]+')','participationtypemask':_0x431b69[_0xa299('0x4c')]===_0xa299('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa299('0x4a')+_0x431b69['userId']+')','participationtypemask':_0x431b69[_0xa299('0x4c')]===_0xa299('0x4d')?0x2:0x1}];_0x5c6806={'method':_0xa299('0x10'),'uri':_0x8c3b20+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x2af155[_0xa299('0x47')],_0x4805bb,'\x20'),'phonenumber':String(_0x4805bb['calleridnum']),'description':intUtil['getString'](_0x2af155[_0xa299('0x48')],_0x4805bb,'\x0a'),'regardingobjectid_contact@odata.bind':_0x431b69['enduserId']?_0xa299('0x49')+_0x431b69[_0xa299('0x31')]+')':undefined,'ownerid@odata.bind':_0xa299('0x4a')+_0x431b69[_0xa299('0x23')]+')','directioncode':_0x431b69['callDirection']===_0xa299('0x4d')?![]:!![],'phonecall_activity_parties':_0xfe979e},getCustomFields(_0x2af155['Fields'],_0x4805bb,_0x2af155['ticketType'])),'headers':{'Authorization':_0xa299('0x1a')+_0x37bfaf,'OData-Version':_0xa299('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c6806);})[_0xa299('0x17')](function(_0x565e3c){var _0x87b752=_0x565e3c[_0xa299('0x2d')][_0xa299('0x2e')];var _0x457d22=_0x87b752[_0xa299('0x2f')](_0x87b752[_0xa299('0x30')]('(')+0x1,_0x87b752[_0xa299('0x30')](')'));_0x431b69['ticketId']=_0x457d22;_0x1b375b(_0x431b69);})['catch'](function(_0xd380f0){_0x2383ed(_0xd380f0[_0xa299('0x16')]);});});}function emit(_0x30d23b,_0x37e896,_0x231496,_0x180eae){var _0x104abb={'uri':util[_0xa299('0x4e')](_0xa299('0x4f'),_0x30d23b,_0x231496,_0x180eae)};io['to'](util[_0xa299('0x4e')](_0xa299('0x50'),_0x37e896))[_0xa299('0x51')](_0xa299('0x52'),_0x104abb);}exports['cs']=function(_0x2af947,_0x280ff5,_0x27a9fa,_0x246042,_0x8310a,_0x3d3f9b,_0x575f3c,_0x332be1){var _0xade2e5={};_0x3d3f9b[_0xa299('0xb')]=_0x3d3f9b['modernAuthentication']?intUtil[_0xa299('0x53')](_0x3d3f9b[_0xa299('0xd')][_0xa299('0x54')]):intUtil[_0xa299('0x53')](_0x3d3f9b['remoteUri']);_0x3d3f9b[_0xa299('0x55')]=intUtil['stripTrailingSlash'](_0x3d3f9b[_0xa299('0x55')]);_0xade2e5[_0xa299('0x4c')]=_0x332be1===_0xa299('0x4d')||_0x332be1==='unmanaged'?'queue':'outbound';var _0x1b2e94=_0x3d3f9b[_0xa299('0xa')]?util['format'](_0xa299('0x56'),_0x3d3f9b[_0xa299('0xd')][_0xa299('0x54')]):util[_0xa299('0x4e')]('%s/api/data/v9.0/',_0x3d3f9b[_0xa299('0xb')]);var _0x2efc6e=util[_0xa299('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3d3f9b['tenantId']);var _0x2fba1b=util[_0xa299('0x4e')](_0xa299('0x57'),_0x3d3f9b[_0xa299('0x55')],_0x280ff5[_0xa299('0x58')],md5(_0x280ff5[_0xa299('0x58')]));if(_0x8310a&&_0x8310a[_0xa299('0x59')]){logger[_0xa299('0x37')](_0xa299('0x5a'),'Recording\x20is\x20enabled!');_0x280ff5[_0xa299('0x5b')]=_0x2fba1b;}else if(_0x575f3c&&_0x575f3c[_0xa299('0x5c')]&&_0x575f3c[_0xa299('0x5c')]!==_0xa299('0x5d')){logger[_0xa299('0x37')]('[OUTBOUND]',_0xa299('0x5e'));_0x280ff5[_0xa299('0x5b')]=_0x2fba1b;}else{_0x280ff5[_0xa299('0x5b')]='';}return getUser(_0xade2e5,_0x3d3f9b,_0x246042,_0x2efc6e,_0x1b2e94,_0x332be1)[_0xa299('0x17')](function(_0x4fb699){logger['info']('['+_0x332be1[_0xa299('0x15')]()+_0xa299('0x5f'),_0x4fb699[_0xa299('0x23')]);logger[_0xa299('0x37')]('['+_0x332be1['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4fb699[_0xa299('0x1f')]);return getEndUser(_0x4fb699,_0x3d3f9b,_0x2efc6e,_0x1b2e94,_0x280ff5,_0x332be1,_0x27a9fa['moduleCreate'],_0x27a9fa[_0xa299('0x60')]);})[_0xa299('0x17')](function(_0xbaf75c){logger[_0xa299('0x37')]('['+_0x332be1[_0xa299('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xbaf75c[_0xa299('0x31')]);logger[_0xa299('0x37')]('['+_0x332be1[_0xa299('0x15')]()+_0xa299('0x61'),_0x280ff5[_0xa299('0x2a')]);return getTicket(_0xbaf75c,_0x3d3f9b,_0x2efc6e,_0x1b2e94,_0x280ff5,_0x27a9fa,_0x332be1);})['then'](function(_0x418b17){logger[_0xa299('0x37')](util[_0xa299('0x4e')]('['+_0x332be1['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x27a9fa[_0xa299('0x42')],_0x418b17[_0xa299('0x62')]));logger[_0xa299('0x37')](util[_0xa299('0x4e')]('['+_0x332be1[_0xa299('0x15')]()+_0xa299('0x63'),_0x332be1));if(_0x332be1!==_0xa299('0x64')&&_0x27a9fa[_0xa299('0x65')]){logger['info']('['+_0x332be1['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3d3f9b[_0xa299('0xb')],_0x246042['name'],_0x27a9fa['ticketType'],_0x418b17[_0xa299('0x62')]);}})[_0xa299('0x27')](function(_0x4d9747){logger[_0xa299('0x14')]('['+_0x332be1['toUpperCase']()+_0xa299('0x66'),_0x4d9747[_0xa299('0x16')]);console[_0xa299('0x14')]('Error\x20running\x20Dynamics365\x20integration',_0x4d9747);});}; \ No newline at end of file +var _0x1404=['request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','username','password','then','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','catch','message','toLowerCase','outbound','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20created!','includes','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','format','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!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1404,0xe1));var _0x4140=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x1404[_0x279d37];return _0x530173;};'use strict';var _=require(_0x4140('0x0'));var rp=require(_0x4140('0x1'));var util=require('util');var intUtil=require(_0x4140('0x2'));var md5=require('md5');var Redis=require(_0x4140('0x3'));var logger=require(_0x4140('0x4'))(_0x4140('0x5'));var config=require(_0x4140('0x6'));config[_0x4140('0x7')]=_[_0x4140('0x8')](config[_0x4140('0x7')],{'host':_0x4140('0x9'),'port':0x18eb});var io=require(_0x4140('0xa'))(new Redis(config[_0x4140('0x7')]));function getAuthToken(_0x4bed86,_0x4634cf,_0x7b3f15){if(_0x4bed86[_0x4140('0xb')]){_0x4bed86[_0x4140('0xc')]=_0x4bed86[_0x4140('0xd')][_0x4140('0xe')];_0x4bed86[_0x4140('0xf')]=_0x4bed86[_0x4140('0xd')][_0x4140('0x10')];return Promise[_0x4140('0x11')](_0x4bed86[_0x4140('0xd')]['data5']);}var _0x17dfac={'method':_0x4140('0x12'),'uri':_0x4634cf,'form':{'client_id':_0x4bed86[_0x4140('0x13')],'resource':_0x4bed86[_0x4140('0xc')],'username':_0x4bed86[_0x4140('0x14')],'password':_0x4bed86[_0x4140('0x15')],'grant_type':_0x4140('0x15'),'client_secret':_0x4bed86['clientSecret']},'json':!![]};return rp(_0x17dfac)[_0x4140('0x16')](function(_0x3867b4){return _0x3867b4['access_token'];})['catch'](function(_0x208d3a){logger['error']('['+[_0x7b3f15[_0x4140('0x17')]()]+_0x4140('0x18'));return _0x208d3a['message'];});}function getUser(_0x5528a8,_0xf148e3,_0x33fbd1,_0x43fe7e,_0x277e58,_0x2a5370){return new Promise(function(_0x555d4a,_0x3c0d33){return getAuthToken(_0xf148e3,_0x43fe7e,_0x2a5370)['then'](function(_0x205240){var _0x3cb4df={'method':_0x4140('0x19'),'uri':_0x277e58+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x4140('0x1a')+_0x205240,'OData-Version':_0x4140('0x1b')},'json':!![]};return rp(_0x3cb4df);})['then'](function(_0x1c6feb){var _0x398ec6=_0x1c6feb[_0x4140('0x1c')];var _0x2858da=![];var _0x44277b=null;if(!_[_0x4140('0x1d')](_0x33fbd1)){if(intUtil[_0x4140('0x1e')](_0x33fbd1[_0x4140('0x1f')])){_0x5528a8[_0x4140('0x20')]=_0x33fbd1[_0x4140('0x1f')];for(_0x44277b=0x0;_0x44277b<_0x398ec6['length'];_0x44277b++){if(_0x398ec6[_0x44277b][_0x4140('0x21')]===_0x33fbd1['email']&&!_0x398ec6[_0x44277b][_0x4140('0x22')]){_0x2858da=!![];logger[_0x4140('0x23')]('['+[_0x2a5370['toUpperCase']()]+_0x4140('0x24')+_0x398ec6[_0x44277b][_0x4140('0x25')]+'!');_0x5528a8[_0x4140('0x26')]=_0x398ec6[_0x44277b][_0x4140('0x25')];}}}}if(!_0x2858da){logger[_0x4140('0x23')]('['+[_0x2a5370['toUpperCase']()]+_0x4140('0x27'));_0x5528a8[_0x4140('0x20')]=_0xf148e3[_0x4140('0x14')];for(_0x44277b=0x0;_0x44277b<_0x398ec6[_0x4140('0x28')];_0x44277b++){if(_0x398ec6[_0x44277b][_0x4140('0x21')]===_0xf148e3[_0x4140('0x14')]){_0x5528a8['userId']=_0x398ec6[_0x44277b][_0x4140('0x25')];}}}_0x555d4a(_0x5528a8);})[_0x4140('0x29')](function(_0x4f4af6){_0x3c0d33(_0x4f4af6[_0x4140('0x2a')]);});});}function createEndUser(_0x38da99,_0x3468e8,_0xad2ad1,_0x47e9c7,_0x128b9c,_0x468a8c,_0x2af041){return new Promise(function(_0x5b80bf,_0xc456cc){return getAuthToken(_0x3468e8,_0xad2ad1,_0x468a8c)[_0x4140('0x16')](function(_0x29cf6c){var _0xe68852=_0x468a8c[_0x4140('0x2b')]()===_0x4140('0x2c')?_0x128b9c['destcalleridnum']:_0x128b9c[_0x4140('0x2d')];var _0x58e02c={'method':_0x4140('0x12'),'uri':_0x47e9c7+_0x4140('0x2e'),'body':{'fullname':_0xe68852,'firstname':_0xe68852,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4140('0x2f')+_0x38da99[_0x4140('0x26')]+')'},'headers':{'Authorization':_0x4140('0x1a')+_0x29cf6c,'OData-Version':_0x4140('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x58e02c[_0x4140('0x30')][_0x2af041]=_0xe68852;return rp(_0x58e02c);})[_0x4140('0x16')](function(_0x4c797f){var _0x864a=_0x4c797f[_0x4140('0x31')]['odata-entityid'];var _0xbed4e2=_0x864a[_0x4140('0x32')](_0x864a[_0x4140('0x33')]('(')+0x1,_0x864a[_0x4140('0x33')](')'));_0x38da99[_0x4140('0x34')]=_0xbed4e2;_0x5b80bf(_0x38da99);})[_0x4140('0x29')](function(_0xd8b88c){_0xc456cc(_0xd8b88c[_0x4140('0x2a')]);});});}function getEndUser(_0x23fba9,_0xe59700,_0x530dec,_0x2c822c,_0x8c8c45,_0x283955,_0x503429,_0x1f1f9d){var _0x3de867=_0x283955[_0x4140('0x2b')]()===_0x4140('0x2c')?_0x8c8c45[_0x4140('0x35')]:_0x8c8c45['calleridnum'];return getAuthToken(_0xe59700,_0x530dec,_0x283955)[_0x4140('0x16')](function(_0x160ea0){_0x1f1f9d=_0x1f1f9d?_0x1f1f9d:_0x4140('0x36');var _0x3b9e15={'method':'GET','uri':_0x2c822c+_0x4140('0x37')+_0x1f1f9d+_0x4140('0x38')+_0x1f1f9d+_0x4140('0x39')+_0x3de867[_0x4140('0x3a')]('+',_0x4140('0x3b'))+'\x27','headers':{'Authorization':_0x4140('0x1a')+_0x160ea0,'If-None-Match':null,'OData-Version':_0x4140('0x1b')},'json':!![]};return rp(_0x3b9e15);})[_0x4140('0x16')](function(_0x17cc1a){var _0x615498=![];if(!_0x17cc1a)return _0x615498;var _0x39c9d4=_0x17cc1a[_0x4140('0x1c')];for(var _0x566f89=0x0;_0x566f89<_0x39c9d4['length'];_0x566f89++){if(_0x39c9d4[_0x566f89][_0x1f1f9d]===_0x3de867){_0x615498=!![];_0x23fba9[_0x4140('0x34')]=_0x39c9d4[_0x566f89]['contactid'];}}return _0x615498;})['then'](function(_0x281817){if(_0x281817)return _0x23fba9;if(_0x503429===_0x4140('0x3c')){logger['info']('['+[_0x283955[_0x4140('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x23fba9;}return createEndUser(_0x23fba9,_0xe59700,_0x530dec,_0x2c822c,_0x8c8c45,_0x283955,_0x1f1f9d)[_0x4140('0x16')](function(_0x4ff350){logger[_0x4140('0x23')]('['+[_0x283955['toUpperCase']()]+_0x4140('0x3d'),_0x4ff350[_0x4140('0x34')]);return _0x4ff350;});});}function getCustomFields(_0x3831f7,_0x1b8abc,_0x3d8b84){var _0x58eacd={};if(_0x3831f7['length']>0x0){_['forEach'](_0x3831f7,function(_0x18edf8){if(_[_0x4140('0x3e')]([_0x4140('0x3f'),'picklist'],_0x18edf8['type'])&&_0x18edf8[_0x4140('0x40')]&&!_0x18edf8[_0x4140('0x41')]){var _0x5003fb=_0x18edf8[_0x4140('0x42')][_0x4140('0x2b')]();var _0x46746a=_0x5003fb[_0x4140('0x32')](0x0,_0x5003fb[_0x4140('0x43')]('_'));var _0x369d45=_0x5003fb[_0x4140('0x32')](_0x5003fb['indexOf']('_')+0x1);if(_0x46746a===_0x3d8b84){_0x58eacd[_0x369d45]=_0x18edf8[_0x4140('0x44')];}}});}return _0x58eacd;}function getTicket(_0x2aa257,_0x5f3ac9,_0x58c265,_0x5394ab,_0x2e55ab,_0x80cd05,_0x4dea29){return new Promise(function(_0x5bff25,_0xb8970c){var _0x214dec;return getAuthToken(_0x5f3ac9,_0x58c265,_0x4dea29)['then'](function(_0x2fea71){if(_0x80cd05[_0x4140('0x45')]===_0x4140('0x46')){_0x214dec={'method':_0x4140('0x12'),'uri':_0x5394ab+_0x4140('0x47'),'body':Object[_0x4140('0x48')]({},{'title':intUtil[_0x4140('0x49')](_0x80cd05[_0x4140('0x4a')],_0x2e55ab,'\x20'),'description':intUtil[_0x4140('0x49')](_0x80cd05[_0x4140('0x4b')],_0x2e55ab,'\x0a'),'customerid_contact@odata.bind':_0x2aa257[_0x4140('0x34')]?_0x4140('0x4c')+_0x2aa257[_0x4140('0x34')]+')':undefined,'ownerid@odata.bind':_0x4140('0x2f')+_0x2aa257[_0x4140('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x80cd05[_0x4140('0x4d')],_0x2e55ab,_0x80cd05['ticketType'])),'headers':{'Authorization':_0x4140('0x1a')+_0x2fea71,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x80cd05[_0x4140('0x45')]===_0x4140('0x4e')){var _0x3ba32b=_0x2aa257[_0x4140('0x34')]?[{'partyid_systemuser@odata.bind':_0x4140('0x2f')+_0x2aa257['userId']+')','participationtypemask':_0x2aa257[_0x4140('0x4f')]===_0x4140('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x4140('0x4c')+_0x2aa257[_0x4140('0x34')]+')','participationtypemask':_0x2aa257[_0x4140('0x4f')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4140('0x2f')+_0x2aa257[_0x4140('0x26')]+')','participationtypemask':_0x2aa257[_0x4140('0x4f')]===_0x4140('0x50')?0x2:0x1}];_0x214dec={'method':'POST','uri':_0x5394ab+_0x4140('0x51'),'body':Object[_0x4140('0x48')]({},{'subject':intUtil[_0x4140('0x49')](_0x80cd05[_0x4140('0x4a')],_0x2e55ab,'\x20'),'phonenumber':String(_0x2e55ab[_0x4140('0x2d')]),'description':intUtil[_0x4140('0x49')](_0x80cd05[_0x4140('0x4b')],_0x2e55ab,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2aa257['enduserId']?_0x4140('0x4c')+_0x2aa257[_0x4140('0x34')]+')':undefined,'ownerid@odata.bind':_0x4140('0x2f')+_0x2aa257[_0x4140('0x26')]+')','directioncode':_0x2aa257[_0x4140('0x4f')]===_0x4140('0x50')?![]:!![],'phonecall_activity_parties':_0x3ba32b},getCustomFields(_0x80cd05[_0x4140('0x4d')],_0x2e55ab,_0x80cd05[_0x4140('0x45')])),'headers':{'Authorization':_0x4140('0x1a')+_0x2fea71,'OData-Version':_0x4140('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x214dec);})[_0x4140('0x16')](function(_0x132362){var _0x2f1217=_0x132362['headers']['odata-entityid'];var _0x434e06=_0x2f1217[_0x4140('0x32')](_0x2f1217[_0x4140('0x33')]('(')+0x1,_0x2f1217[_0x4140('0x33')](')'));_0x2aa257['ticketId']=_0x434e06;_0x5bff25(_0x2aa257);})[_0x4140('0x29')](function(_0x36debc){_0xb8970c(_0x36debc[_0x4140('0x2a')]);});});}function emit(_0x5edb2c,_0x456f8a,_0x2332c0,_0x55b390){var _0x5130e6={'uri':util[_0x4140('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5edb2c,_0x2332c0,_0x55b390)};io['to'](util[_0x4140('0x52')](_0x4140('0x53'),_0x456f8a))[_0x4140('0x54')](_0x4140('0x55'),_0x5130e6);}exports['cs']=function(_0x141f74,_0x25bc2d,_0x55d171,_0x1d36fe,_0x371ea8,_0x25ec21,_0x3a7ecf,_0x3ceb15){var _0x584cb8={};_0x25ec21[_0x4140('0xc')]=_0x25ec21[_0x4140('0xb')]?intUtil[_0x4140('0x56')](_0x25ec21[_0x4140('0xd')][_0x4140('0xe')]):intUtil[_0x4140('0x56')](_0x25ec21[_0x4140('0xc')]);_0x25ec21['serverUrl']=intUtil['stripTrailingSlash'](_0x25ec21[_0x4140('0x57')]);_0x584cb8[_0x4140('0x4f')]=_0x3ceb15===_0x4140('0x50')||_0x3ceb15===_0x4140('0x58')?_0x4140('0x50'):_0x4140('0x2c');var _0xb6d6b5=_0x25ec21[_0x4140('0xb')]?util[_0x4140('0x52')](_0x4140('0x59'),_0x25ec21[_0x4140('0xd')][_0x4140('0xe')]):util[_0x4140('0x52')](_0x4140('0x59'),_0x25ec21[_0x4140('0xc')]);var _0x5861ff=util['format'](_0x4140('0x5a'),_0x25ec21['tenantId']);var _0x254dd6=util[_0x4140('0x52')](_0x4140('0x5b'),_0x25ec21[_0x4140('0x57')],_0x25bc2d[_0x4140('0x5c')],md5(_0x25bc2d[_0x4140('0x5c')]));if(_0x371ea8&&_0x371ea8[_0x4140('0x5d')]){logger[_0x4140('0x23')](_0x4140('0x5e'),_0x4140('0x5f'));_0x25bc2d['recordingURL']=_0x254dd6;}else if(_0x3a7ecf&&_0x3a7ecf[_0x4140('0x60')]&&_0x3a7ecf['recordingFormat']!==_0x4140('0x61')){logger['info'](_0x4140('0x62'),_0x4140('0x5f'));_0x25bc2d[_0x4140('0x63')]=_0x254dd6;}else{_0x25bc2d[_0x4140('0x63')]='';}return getUser(_0x584cb8,_0x25ec21,_0x1d36fe,_0x5861ff,_0xb6d6b5,_0x3ceb15)[_0x4140('0x16')](function(_0x293cbb){logger[_0x4140('0x23')]('['+_0x3ceb15[_0x4140('0x17')]()+_0x4140('0x64'),_0x293cbb['userId']);logger[_0x4140('0x23')]('['+_0x3ceb15[_0x4140('0x17')]()+_0x4140('0x65'),_0x293cbb[_0x4140('0x20')]);return getEndUser(_0x293cbb,_0x25ec21,_0x5861ff,_0xb6d6b5,_0x25bc2d,_0x3ceb15,_0x55d171[_0x4140('0x66')],_0x55d171[_0x4140('0x67')]);})[_0x4140('0x16')](function(_0xb15935){logger[_0x4140('0x23')]('['+_0x3ceb15[_0x4140('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xb15935[_0x4140('0x34')]);logger['info']('['+_0x3ceb15[_0x4140('0x17')]()+_0x4140('0x68'),_0x25bc2d['calleridnum']);return getTicket(_0xb15935,_0x25ec21,_0x5861ff,_0xb6d6b5,_0x25bc2d,_0x55d171,_0x3ceb15);})[_0x4140('0x16')](function(_0x42880e){logger['info'](util[_0x4140('0x52')]('['+_0x3ceb15[_0x4140('0x17')]()+_0x4140('0x69'),_0x55d171['ticketType'],_0x42880e['ticketId']));logger[_0x4140('0x23')](util[_0x4140('0x52')]('['+_0x3ceb15['toUpperCase']()+_0x4140('0x6a'),_0x3ceb15));if(_0x3ceb15!==_0x4140('0x58')&&_0x55d171[_0x4140('0x6b')]){logger[_0x4140('0x23')]('['+_0x3ceb15[_0x4140('0x17')]()+']',_0x4140('0x6c'));emit(_0x25ec21['remoteUri'],_0x1d36fe['name'],_0x55d171[_0x4140('0x45')],_0x42880e[_0x4140('0x6d')]);}})[_0x4140('0x29')](function(_0x5bb504){logger[_0x4140('0x6e')]('['+_0x3ceb15[_0x4140('0x17')]()+_0x4140('0x6f'),_0x5bb504['message']);console[_0x4140('0x6e')](_0x4140('0x70'),_0x5bb504);});}; \ 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 b6c1740..1fe51aa 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 _0x09be=['../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','length','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','toString','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x09be,0xb5));var _0xe09b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe09b('0x0'));var rp=require(_0xe09b('0x1'));var md5=require(_0xe09b('0x2'));var util=require(_0xe09b('0x3'));var Redis=require('ioredis');var intUtil=require(_0xe09b('0x4'));var config=require('../../../../config/environment');var logger=require(_0xe09b('0x5'))(_0xe09b('0x6'));config['redis']=_[_0xe09b('0x7')](config[_0xe09b('0x8')],{'host':_0xe09b('0x9'),'port':0x18eb});var io=require(_0xe09b('0xa'))(new Redis(config[_0xe09b('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xe09b('0xb')};function emit(_0x32602f,_0x4bb96c,_0x2419e6){io['to'](_0x32602f)[_0xe09b('0xc')](_0x4bb96c,_0x2419e6);}function getTicket(_0x19a329,_0x2fca3a,_0x36d8a2,_0xd596c0,_0x3f6b89){logger[_0xe09b('0xd')](_0xe09b('0xe'));var _0x3146ca=_[_0xe09b('0xf')]({'responder_id':_0x2fca3a['id'],'requester_id':_0x36d8a2['id'],'name':util[_0xe09b('0x10')]('Caller\x20-\x20%s',_0x3f6b89[_0xe09b('0x11')]),'phone':_0x3f6b89[_0xe09b('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xd596c0['Subjects'],_0x3f6b89,'\x20'),'description':intUtil[_0xe09b('0x13')](_0xd596c0[_0xe09b('0x14')],_0x3f6b89,_0xe09b('0x15')),'tags':getTags(_0xd596c0[_0xe09b('0x16')],_0xe09b('0x17'))},getCustomFields(_0xd596c0[_0xe09b('0x18')],_0x3f6b89));_0x3146ca[_0xe09b('0x19')]=_[_0xe09b('0x1a')](_[_0xe09b('0x1b')](_0x3146ca[_0xe09b('0x19')],'id'),_0xe09b('0x1c'));return request({'uri':util['format'](_0xe09b('0x1d'),_0x19a329[_0xe09b('0x1e')]),'method':_0xe09b('0x1f'),'body':_0x3146ca})[_0xe09b('0x20')](function(_0x5284b9){logger[_0xe09b('0xd')](_0xe09b('0x21'));return _0x5284b9;});}function getUser(_0x2fdff0,_0x2706f5){if(intUtil['validateEmail'](_0x2706f5)){return request({'uri':util[_0xe09b('0x10')]('%s/api/v2/agents',_0x2fdff0[_0xe09b('0x1e')]),'qs':{'email':_0x2706f5}})[_0xe09b('0x20')](function(_0x1dfc3e){if(_0x1dfc3e[_0xe09b('0x22')]){logger['info']('Agent\x20found!');return _['find'](_0x1dfc3e,function(_0x441baf){return _0x441baf[_0xe09b('0x23')]['email']===_0x2706f5;});}else{logger[_0xe09b('0xd')](_0xe09b('0x24'));return request({'uri':util[_0xe09b('0x10')]('%s/api/v2/agents/me',_0x2fdff0[_0xe09b('0x1e')])})['then'](function(_0x3eabc5){logger[_0xe09b('0xd')](_0xe09b('0x25'));return _0x3eabc5;});}});}else{logger[_0xe09b('0xd')](_0xe09b('0x26'));return request({'uri':util[_0xe09b('0x10')]('%s/api/v2/agents/me',_0x2fdff0[_0xe09b('0x1e')])})['then'](function(_0x46b474){logger['info'](_0xe09b('0x25'));return _0x46b474;});}}function getEndUser(_0x35a0f4,_0x229527,_0x4a25eb){logger[_0xe09b('0xd')]('Searching\x20enduser\x20with\x20phone',_0x4a25eb);return request({'uri':util[_0xe09b('0x10')](_0xe09b('0x27'),_0x35a0f4[_0xe09b('0x1e')]),'qs':{'phone':_0x4a25eb}})[_0xe09b('0x20')](function(_0x1d59a0){if(_0x1d59a0[_0xe09b('0x22')]){logger[_0xe09b('0xd')](_0xe09b('0x28'));return _[_0xe09b('0x29')](_0x1d59a0,{'phone':_0x4a25eb});}else{logger['info'](_0xe09b('0x2a'));return request({'uri':util['format']('%s/api/v2/contacts',_0x35a0f4['remoteUri']),'method':_0xe09b('0x1f'),'body':{'name':_0x229527,'phone':_0x4a25eb}})[_0xe09b('0x20')](function(_0x54b2c4){logger[_0xe09b('0xd')](_0xe09b('0x2b'));return _0x54b2c4;});}});}function getAuth(_0x3f1938){return util[_0xe09b('0x10')]('Basic\x20%s',new Buffer(_0x3f1938[_0xe09b('0x2c')]+':X')['toString'](_0xe09b('0x2d')));}function request(_0x46c5e2){logger[_0xe09b('0x2e')](_0xe09b('0x2f'),JSON[_0xe09b('0x30')](_0x46c5e2));return rp(_[_0xe09b('0x7')](_0x46c5e2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5a3754,_0x617f4d){var _0x5ece89=[];if(_0x5a3754&&_0x5a3754['length']>0x0){_0x5ece89=_[_0xe09b('0x31')](_0x5a3754,_0x617f4d);}return _0x5ece89;}function getCustomFields(_0x1200eb,_0x1ca4a7){var _0x8ccf35=[];var _0x4d9237={'custom_fields':[]};if(_0x1200eb[_0xe09b('0x22')]>0x0){_[_0xe09b('0x32')](_0x1200eb,function(_0x449068){if(_[_0xe09b('0x33')]([_0xe09b('0x34'),_0xe09b('0x35')],_0x449068[_0xe09b('0x36')])&&_0x449068[_0xe09b('0x37')]&&!_0x449068[_0xe09b('0x38')]){_0x4d9237[_0x449068['nameField'][_0xe09b('0x39')]()]=_0x449068[_0xe09b('0x3a')]['toString']();}else if(_[_0xe09b('0x33')]([_0xe09b('0x34'),_0xe09b('0x35')],_0x449068['type'])&&_0x449068[_0xe09b('0x3b')]&&_0x449068[_0xe09b('0x38')]){_0x4d9237[_0xe09b('0x19')][_0xe09b('0x3c')]({'id':_0x449068[_0xe09b('0x3b')],'value':_0x449068['content'][_0xe09b('0x3d')]()});}else if(_0x449068['type']==='variable'&&_0x449068['variableName']&&_0x449068[_0xe09b('0x3b')]&&_0x449068['customField']){_0x1ca4a7[_0x449068[_0xe09b('0x3e')]]&&_0x4d9237[_0xe09b('0x19')]['push']({'id':_0x449068[_0xe09b('0x3b')],'value':_0x1ca4a7[_0x449068[_0xe09b('0x3e')]][_0xe09b('0x3d')]()});}else if(_0x449068[_0xe09b('0x36')]===_0xe09b('0x3f')&&_0x449068['Variable']&&_0x449068[_0xe09b('0x40')][_0xe09b('0x17')]&&_0x449068[_0xe09b('0x3b')]&&_0x449068[_0xe09b('0x38')]){_0x1ca4a7[_0x449068[_0xe09b('0x40')][_0xe09b('0x17')]['toLowerCase']()]&&_0x4d9237[_0xe09b('0x19')][_0xe09b('0x3c')]({'id':_0x449068['idField'],'value':_0x1ca4a7[_0x449068[_0xe09b('0x40')][_0xe09b('0x17')][_0xe09b('0x39')]()][_0xe09b('0x3d')]()});}});}return _0x4d9237;}exports[_0xe09b('0x41')]=function(_0x10198c,_0x3d865d,_0x92b398,_0x17fa23,_0x37bb58,_0x4e674f){var _0x241d73,_0x1b923c;_0x4e674f['remoteUri']=intUtil['stripTrailingSlash'](_0x4e674f['remoteUri']);_0x4e674f[_0xe09b('0x42')]=intUtil['stripTrailingSlash'](_0x4e674f[_0xe09b('0x42')]);if(_0x37bb58&&_0x37bb58[_0xe09b('0x43')]){logger[_0xe09b('0xd')](_0xe09b('0x44'),_0xe09b('0x45'));_0x3d865d[_0xe09b('0x46')]=util[_0xe09b('0x10')](_0xe09b('0x47'),_0x4e674f[_0xe09b('0x42')],_0x3d865d[_0xe09b('0x48')],md5(_0x3d865d[_0xe09b('0x48')]));}else{_0x3d865d[_0xe09b('0x46')]='';}headers[_0xe09b('0x49')]=getAuth(_0x4e674f);return getUser(_0x4e674f,_0x17fa23[_0xe09b('0x4a')])[_0xe09b('0x20')](function(_0x2ead6f){_0x241d73=_0x2ead6f;logger[_0xe09b('0xd')](_0xe09b('0x4b'),_0x241d73['id']);return getEndUser(_0x4e674f,_0x3d865d[_0xe09b('0x11')],_0x3d865d['calleridnum']);})[_0xe09b('0x20')](function(_0xc3b784){_0x1b923c=_0xc3b784;logger[_0xe09b('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1b923c['id']);return getTicket(_0x4e674f,_0x241d73,_0x1b923c,_0x92b398,_0x3d865d);})[_0xe09b('0x20')](function(_0x4e11b8){if(_0x4e11b8&&_0x4e11b8['id']){logger[_0xe09b('0xd')](_0xe09b('0x21'));logger[_0xe09b('0xd')](_0xe09b('0x4c'),_0x4e11b8['id']);logger['info'](_0xe09b('0x44'),_0xe09b('0x4d'));emit(util[_0xe09b('0x10')]('user:%s',_0x17fa23[_0xe09b('0x17')]),'trigger:browser:url',{'uri':util[_0xe09b('0x10')](_0xe09b('0x4e'),_0x4e674f[_0xe09b('0x1e')],_0x4e11b8['id'])});}})[_0xe09b('0x4f')](function(_0x9a622f){logger[_0xe09b('0x50')]('[QUEUE]',JSON['stringify'](_0x9a622f));});};exports[_0xe09b('0x51')]=function(_0x2daa10,_0x3a8298,_0x513c78,_0x231b23,_0xeea7db,_0x472a1c,_0x36217e){var _0x2a1c43,_0x4b0381;_0x472a1c[_0xe09b('0x1e')]=intUtil[_0xe09b('0x52')](_0x472a1c[_0xe09b('0x1e')]);_0x472a1c['serverUrl']=intUtil[_0xe09b('0x52')](_0x472a1c[_0xe09b('0x42')]);if(_0x36217e&&_0x36217e[_0xe09b('0x53')]&&_0x36217e[_0xe09b('0x53')]!=='none'){logger[_0xe09b('0xd')]('[OUTBOUND]',_0xe09b('0x45'));_0x3a8298[_0xe09b('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x472a1c[_0xe09b('0x42')],_0x3a8298[_0xe09b('0x48')],md5(_0x3a8298[_0xe09b('0x48')]));}headers[_0xe09b('0x49')]=getAuth(_0x472a1c);return getUser(_0x472a1c,_0x231b23[_0xe09b('0x4a')])[_0xe09b('0x20')](function(_0x22a710){_0x2a1c43=_0x22a710;logger[_0xe09b('0xd')]('The\x20User\x20ID\x20is:',_0x2a1c43['id']);return getEndUser(_0x472a1c,_0x3a8298[_0xe09b('0x54')],_0x3a8298[_0xe09b('0x55')]);})[_0xe09b('0x20')](function(_0x273dc6){_0x4b0381=_0x273dc6;logger[_0xe09b('0xd')](_0xe09b('0x56'),_0x4b0381['id']);return getTicket(_0x472a1c,_0x2a1c43,_0x4b0381,_0x513c78,_0x3a8298);})[_0xe09b('0x20')](function(_0xd6d686){if(_0xd6d686&&_0xd6d686['id']){logger[_0xe09b('0xd')](_0xe09b('0x21'));logger[_0xe09b('0xd')]('The\x20Ticket\x20ID\x20is:',_0xd6d686['id']);logger['info'](_0xe09b('0x57'),_0xe09b('0x4d'));emit(util['format'](_0xe09b('0x58'),_0x231b23['name']),_0xe09b('0x59'),{'uri':util[_0xe09b('0x10')]('%s/helpdesk/tickets/%d',_0x472a1c[_0xe09b('0x1e')],_0xd6d686['id'])});}})[_0xe09b('0x4f')](function(_0x4d7ae6){logger['error'](_0xe09b('0x57'),JSON[_0xe09b('0x30')](_0x4d7ae6));});};exports[_0xe09b('0x5a')]=function(_0x870c49,_0x185335,_0x11d63a,_0x3643c8,_0x575d2b,_0x547ccf){var _0x36e350,_0x37a0b5;_0x547ccf[_0xe09b('0x1e')]=intUtil[_0xe09b('0x52')](_0x547ccf[_0xe09b('0x1e')]);_0x547ccf[_0xe09b('0x42')]=intUtil[_0xe09b('0x52')](_0x547ccf[_0xe09b('0x42')]);if(_0x575d2b&&_0x575d2b['monitor_format']){logger[_0xe09b('0xd')]('['+_0x185335[_0xe09b('0x5b')][_0xe09b('0x5c')]()+']','Recording\x20is\x20enabled!');_0x185335[_0xe09b('0x46')]=util[_0xe09b('0x10')](_0xe09b('0x47'),_0x547ccf[_0xe09b('0x42')],_0x185335['uniqueid'],md5(_0x185335['uniqueid']));}else{_0x185335[_0xe09b('0x46')]='';}headers[_0xe09b('0x49')]=getAuth(_0x547ccf);return getUser(_0x547ccf,'')[_0xe09b('0x20')](function(_0x1f4ea4){_0x36e350=_0x1f4ea4;logger[_0xe09b('0xd')]('The\x20User\x20ID\x20is:',_0x36e350['id']);return getEndUser(_0x547ccf,_0x185335['calleridname'],_0x185335['calleridnum']);})[_0xe09b('0x20')](function(_0x33a957){_0x37a0b5=_0x33a957;logger['info'](_0xe09b('0x56'),_0x37a0b5['id']);return getTicket(_0x547ccf,_0x36e350,_0x37a0b5,_0x11d63a,_0x185335);})[_0xe09b('0x20')](function(_0x417045){if(_0x417045){logger[_0xe09b('0xd')](_0xe09b('0x21'));logger['info'](_0xe09b('0x4c'),_0x417045['id']);}})[_0xe09b('0x4f')](function(_0x29bf69){logger[_0xe09b('0x50')]('['+_0x185335[_0xe09b('0x5b')][_0xe09b('0x5c')]()+']',JSON['stringify'](_0x29bf69));});}; \ No newline at end of file +var _0x5d77=['Agent\x20found!','find','contact','info','format','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','map','includes','picklist','type','nameField','customField','content','idField','push','toString','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length'];(function(_0x3f41e5,_0x2ecef9){var _0xdbad9=function(_0x21f742){while(--_0x21f742){_0x3f41e5['push'](_0x3f41e5['shift']());}};_0xdbad9(++_0x2ecef9);}(_0x5d77,0x92));var _0x75d7=function(_0x718856,_0x25fd69){_0x718856=_0x718856-0x0;var _0x5be56c=_0x5d77[_0x718856];return _0x5be56c;};'use strict';var _=require('lodash');var rp=require(_0x75d7('0x0'));var md5=require(_0x75d7('0x1'));var util=require(_0x75d7('0x2'));var Redis=require('ioredis');var intUtil=require(_0x75d7('0x3'));var config=require('../../../../config/environment');var logger=require(_0x75d7('0x4'))(_0x75d7('0x5'));config[_0x75d7('0x6')]=_[_0x75d7('0x7')](config[_0x75d7('0x6')],{'host':_0x75d7('0x8'),'port':0x18eb});var io=require(_0x75d7('0x9'))(new Redis(config[_0x75d7('0x6')]));var headers={'Content-Type':_0x75d7('0xa'),'Accept':_0x75d7('0xa')};function emit(_0x4c8ad6,_0x2d0f5f,_0x1fc18e){io['to'](_0x4c8ad6)[_0x75d7('0xb')](_0x2d0f5f,_0x1fc18e);}function getTicket(_0x42349d,_0x49f869,_0xc71ab0,_0x55a8dd,_0x387172){logger['info']('Creating\x20new\x20ticket...');var _0x9339a1=_[_0x75d7('0xc')]({'responder_id':_0x49f869['id'],'requester_id':_0xc71ab0['id'],'name':util['format'](_0x75d7('0xd'),_0x387172[_0x75d7('0xe')]),'phone':_0x387172[_0x75d7('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x75d7('0x10')](_0x55a8dd[_0x75d7('0x11')],_0x387172,'\x20'),'description':intUtil['getString'](_0x55a8dd[_0x75d7('0x12')],_0x387172,'
'),'tags':getTags(_0x55a8dd[_0x75d7('0x13')],'name')},getCustomFields(_0x55a8dd[_0x75d7('0x14')],_0x387172));_0x9339a1[_0x75d7('0x15')]=_[_0x75d7('0x16')](_[_0x75d7('0x17')](_0x9339a1[_0x75d7('0x15')],'id'),'value');return request({'uri':util['format'](_0x75d7('0x18'),_0x42349d[_0x75d7('0x19')]),'method':_0x75d7('0x1a'),'body':_0x9339a1})[_0x75d7('0x1b')](function(_0x3c872e){logger['info'](_0x75d7('0x1c'));return _0x3c872e;});}function getUser(_0x1f5c3f,_0x39e45f){if(intUtil[_0x75d7('0x1d')](_0x39e45f)){return request({'uri':util['format'](_0x75d7('0x1e'),_0x1f5c3f[_0x75d7('0x19')]),'qs':{'email':_0x39e45f}})[_0x75d7('0x1b')](function(_0x54a5a9){if(_0x54a5a9[_0x75d7('0x1f')]){logger['info'](_0x75d7('0x20'));return _[_0x75d7('0x21')](_0x54a5a9,function(_0x5241d5){return _0x5241d5[_0x75d7('0x22')]['email']===_0x39e45f;});}else{logger[_0x75d7('0x23')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x75d7('0x24')]('%s/api/v2/agents/me',_0x1f5c3f['remoteUri'])})[_0x75d7('0x1b')](function(_0x3e4821){logger[_0x75d7('0x23')]('Admin\x20account\x20selected.');return _0x3e4821;});}});}else{logger[_0x75d7('0x23')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x75d7('0x24')](_0x75d7('0x25'),_0x1f5c3f[_0x75d7('0x19')])})['then'](function(_0x2b4eed){logger[_0x75d7('0x23')](_0x75d7('0x26'));return _0x2b4eed;});}}function getEndUser(_0x532faa,_0x124e2a,_0x1bf496){logger['info']('Searching\x20enduser\x20with\x20phone',_0x1bf496);return request({'uri':util[_0x75d7('0x24')](_0x75d7('0x27'),_0x532faa[_0x75d7('0x19')]),'qs':{'phone':_0x1bf496}})[_0x75d7('0x1b')](function(_0x18fd1e){if(_0x18fd1e[_0x75d7('0x1f')]){logger['info'](_0x75d7('0x28'));return _[_0x75d7('0x21')](_0x18fd1e,{'phone':_0x1bf496});}else{logger[_0x75d7('0x23')](_0x75d7('0x29'));return request({'uri':util['format'](_0x75d7('0x27'),_0x532faa['remoteUri']),'method':_0x75d7('0x1a'),'body':{'name':_0x124e2a,'phone':_0x1bf496}})[_0x75d7('0x1b')](function(_0x271f14){logger[_0x75d7('0x23')](_0x75d7('0x2a'));return _0x271f14;});}});}function getAuth(_0x1d5cd3){return util[_0x75d7('0x24')]('Basic\x20%s',new Buffer(_0x1d5cd3[_0x75d7('0x2b')]+':X')['toString'](_0x75d7('0x2c')));}function request(_0x287e6a){logger[_0x75d7('0x2d')](_0x75d7('0x2e'),JSON[_0x75d7('0x2f')](_0x287e6a));return rp(_[_0x75d7('0x7')](_0x287e6a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1fa5d0,_0x5b5e4e){var _0x587ce8=[];if(_0x1fa5d0&&_0x1fa5d0[_0x75d7('0x1f')]>0x0){_0x587ce8=_[_0x75d7('0x30')](_0x1fa5d0,_0x5b5e4e);}return _0x587ce8;}function getCustomFields(_0x4b7433,_0x59e2ec){var _0x3d2dc6=[];var _0x4a5637={'custom_fields':[]};if(_0x4b7433['length']>0x0){_['forEach'](_0x4b7433,function(_0x4c6569){if(_[_0x75d7('0x31')](['string',_0x75d7('0x32')],_0x4c6569[_0x75d7('0x33')])&&_0x4c6569[_0x75d7('0x34')]&&!_0x4c6569[_0x75d7('0x35')]){_0x4a5637[_0x4c6569[_0x75d7('0x34')]['toLowerCase']()]=_0x4c6569[_0x75d7('0x36')]['toString']();}else if(_[_0x75d7('0x31')](['string',_0x75d7('0x32')],_0x4c6569['type'])&&_0x4c6569[_0x75d7('0x37')]&&_0x4c6569[_0x75d7('0x35')]){_0x4a5637[_0x75d7('0x15')][_0x75d7('0x38')]({'id':_0x4c6569[_0x75d7('0x37')],'value':_0x4c6569[_0x75d7('0x36')][_0x75d7('0x39')]()});}else if(_0x4c6569[_0x75d7('0x33')]==='variable'&&_0x4c6569['variableName']&&_0x4c6569[_0x75d7('0x37')]&&_0x4c6569[_0x75d7('0x35')]){_0x59e2ec[_0x4c6569[_0x75d7('0x3a')]]&&_0x4a5637['custom_fields'][_0x75d7('0x38')]({'id':_0x4c6569['idField'],'value':_0x59e2ec[_0x4c6569[_0x75d7('0x3a')]][_0x75d7('0x39')]()});}else if(_0x4c6569[_0x75d7('0x33')]===_0x75d7('0x3b')&&_0x4c6569[_0x75d7('0x3c')]&&_0x4c6569[_0x75d7('0x3c')]['name']&&_0x4c6569[_0x75d7('0x37')]&&_0x4c6569['customField']){_0x59e2ec[_0x4c6569[_0x75d7('0x3c')][_0x75d7('0x3d')][_0x75d7('0x3e')]()]&&_0x4a5637[_0x75d7('0x15')][_0x75d7('0x38')]({'id':_0x4c6569[_0x75d7('0x37')],'value':_0x59e2ec[_0x4c6569[_0x75d7('0x3c')]['name']['toLowerCase']()][_0x75d7('0x39')]()});}});}return _0x4a5637;}exports[_0x75d7('0x3f')]=function(_0x75cdf5,_0x5d5de3,_0x818e8b,_0x5cfa07,_0x40e34b,_0x3e8a27){var _0x25f6bf,_0x1bc0d9;_0x3e8a27[_0x75d7('0x19')]=intUtil[_0x75d7('0x40')](_0x3e8a27['remoteUri']);_0x3e8a27[_0x75d7('0x41')]=intUtil['stripTrailingSlash'](_0x3e8a27[_0x75d7('0x41')]);if(_0x40e34b&&_0x40e34b[_0x75d7('0x42')]){logger[_0x75d7('0x23')](_0x75d7('0x43'),'Recording\x20is\x20enabled!');_0x5d5de3[_0x75d7('0x44')]=util[_0x75d7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e8a27[_0x75d7('0x41')],_0x5d5de3[_0x75d7('0x45')],md5(_0x5d5de3[_0x75d7('0x45')]));}else{_0x5d5de3['recordingURL']='';}headers[_0x75d7('0x46')]=getAuth(_0x3e8a27);return getUser(_0x3e8a27,_0x5cfa07[_0x75d7('0x47')])[_0x75d7('0x1b')](function(_0x4c65f4){_0x25f6bf=_0x4c65f4;logger['info']('The\x20User\x20ID\x20is:',_0x25f6bf['id']);return getEndUser(_0x3e8a27,_0x5d5de3[_0x75d7('0xe')],_0x5d5de3[_0x75d7('0xf')]);})[_0x75d7('0x1b')](function(_0x3f21d5){_0x1bc0d9=_0x3f21d5;logger[_0x75d7('0x23')](_0x75d7('0x48'),_0x1bc0d9['id']);return getTicket(_0x3e8a27,_0x25f6bf,_0x1bc0d9,_0x818e8b,_0x5d5de3);})['then'](function(_0x1634bb){if(_0x1634bb&&_0x1634bb['id']){logger[_0x75d7('0x23')]('Ticket\x20created!');logger[_0x75d7('0x23')](_0x75d7('0x49'),_0x1634bb['id']);logger[_0x75d7('0x23')](_0x75d7('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x75d7('0x4a'),_0x5cfa07[_0x75d7('0x3d')]),_0x75d7('0x4b'),{'uri':util[_0x75d7('0x24')]('%s/helpdesk/tickets/%d',_0x3e8a27[_0x75d7('0x19')],_0x1634bb['id'])});}})[_0x75d7('0x4c')](function(_0x252d0d){logger[_0x75d7('0x4d')](_0x75d7('0x43'),JSON[_0x75d7('0x2f')](_0x252d0d));});};exports[_0x75d7('0x4e')]=function(_0x2729e1,_0xfb4726,_0x5efe77,_0x29c3de,_0x2a611,_0x506ecc,_0xf63476){var _0x49a032,_0x20a04b;_0x506ecc[_0x75d7('0x19')]=intUtil[_0x75d7('0x40')](_0x506ecc[_0x75d7('0x19')]);_0x506ecc[_0x75d7('0x41')]=intUtil[_0x75d7('0x40')](_0x506ecc['serverUrl']);if(_0xf63476&&_0xf63476[_0x75d7('0x4f')]&&_0xf63476[_0x75d7('0x4f')]!=='none'){logger[_0x75d7('0x23')](_0x75d7('0x50'),_0x75d7('0x51'));_0xfb4726[_0x75d7('0x44')]=util[_0x75d7('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x506ecc[_0x75d7('0x41')],_0xfb4726['uniqueid'],md5(_0xfb4726['uniqueid']));}headers[_0x75d7('0x46')]=getAuth(_0x506ecc);return getUser(_0x506ecc,_0x29c3de[_0x75d7('0x47')])['then'](function(_0x45791a){_0x49a032=_0x45791a;logger[_0x75d7('0x23')](_0x75d7('0x52'),_0x49a032['id']);return getEndUser(_0x506ecc,_0xfb4726[_0x75d7('0x53')],_0xfb4726['destcalleridnum']);})[_0x75d7('0x1b')](function(_0x49916d){_0x20a04b=_0x49916d;logger[_0x75d7('0x23')]('The\x20Enduser\x20ID\x20is:',_0x20a04b['id']);return getTicket(_0x506ecc,_0x49a032,_0x20a04b,_0x5efe77,_0xfb4726);})[_0x75d7('0x1b')](function(_0x5d9ce6){if(_0x5d9ce6&&_0x5d9ce6['id']){logger[_0x75d7('0x23')](_0x75d7('0x1c'));logger['info'](_0x75d7('0x49'),_0x5d9ce6['id']);logger[_0x75d7('0x23')]('[OUTBOUND]',_0x75d7('0x54'));emit(util[_0x75d7('0x24')](_0x75d7('0x4a'),_0x29c3de[_0x75d7('0x3d')]),_0x75d7('0x4b'),{'uri':util[_0x75d7('0x24')]('%s/helpdesk/tickets/%d',_0x506ecc[_0x75d7('0x19')],_0x5d9ce6['id'])});}})[_0x75d7('0x4c')](function(_0x1c8553){logger[_0x75d7('0x4d')](_0x75d7('0x50'),JSON['stringify'](_0x1c8553));});};exports[_0x75d7('0x55')]=function(_0x371cab,_0x47d07f,_0x556dbb,_0x1e22d8,_0x88de88,_0x45ec1c){var _0x163944,_0x15daa3;_0x45ec1c[_0x75d7('0x19')]=intUtil[_0x75d7('0x40')](_0x45ec1c[_0x75d7('0x19')]);_0x45ec1c[_0x75d7('0x41')]=intUtil['stripTrailingSlash'](_0x45ec1c[_0x75d7('0x41')]);if(_0x88de88&&_0x88de88[_0x75d7('0x42')]){logger[_0x75d7('0x23')]('['+_0x47d07f[_0x75d7('0x56')][_0x75d7('0x57')]()+']',_0x75d7('0x51'));_0x47d07f[_0x75d7('0x44')]=util[_0x75d7('0x24')](_0x75d7('0x58'),_0x45ec1c[_0x75d7('0x41')],_0x47d07f[_0x75d7('0x45')],md5(_0x47d07f[_0x75d7('0x45')]));}else{_0x47d07f[_0x75d7('0x44')]='';}headers['Authorization']=getAuth(_0x45ec1c);return getUser(_0x45ec1c,'')[_0x75d7('0x1b')](function(_0x25cf1b){_0x163944=_0x25cf1b;logger['info'](_0x75d7('0x52'),_0x163944['id']);return getEndUser(_0x45ec1c,_0x47d07f['calleridname'],_0x47d07f['calleridnum']);})[_0x75d7('0x1b')](function(_0x218fa7){_0x15daa3=_0x218fa7;logger[_0x75d7('0x23')](_0x75d7('0x48'),_0x15daa3['id']);return getTicket(_0x45ec1c,_0x163944,_0x15daa3,_0x556dbb,_0x47d07f);})[_0x75d7('0x1b')](function(_0x3f8e7f){if(_0x3f8e7f){logger[_0x75d7('0x23')]('Ticket\x20created!');logger[_0x75d7('0x23')](_0x75d7('0x49'),_0x3f8e7f['id']);}})['catch'](function(_0x18065a){logger[_0x75d7('0x4d')]('['+_0x47d07f[_0x75d7('0x56')][_0x75d7('0x57')]()+']',JSON[_0x75d7('0x2f')](_0x18065a));});}; \ 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 d65f7a7..ac83f50 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 _0xcbde=['Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','ioredis','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','adminEmail','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','Token\x20token=','remoteUri','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none'];(function(_0x3a917e,_0x5cca78){var _0x2b5e2d=function(_0x245ebc){while(--_0x245ebc){_0x3a917e['push'](_0x3a917e['shift']());}};_0x2b5e2d(++_0x5cca78);}(_0xcbde,0xf6));var _0xecbd=function(_0x525c58,_0x54e74b){_0x525c58=_0x525c58-0x0;var _0x4ec121=_0xcbde[_0x525c58];return _0x4ec121;};'use strict';var _=require(_0xecbd('0x0'));var rp=require('request-promise');var md5=require(_0xecbd('0x1'));var util=require(_0xecbd('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xecbd('0x3'));var intUtil=require(_0xecbd('0x4'));var config=require('../../../../config/environment');var logger=require(_0xecbd('0x5'))(_0xecbd('0x6'));config[_0xecbd('0x7')]=_['defaults'](config[_0xecbd('0x7')],{'host':_0xecbd('0x8'),'port':0x18eb});var io=require(_0xecbd('0x9'))(new Redis(config[_0xecbd('0x7')]));function getAdminId(_0x252f2d,_0x5940ca,_0x23cd6a,_0x4355b7){return new Promise(function(_0x78d28e,_0x3fee35){var _0xad877b=![];var _0x5f1b84={'method':_0xecbd('0xa'),'uri':_0x4355b7+_0xecbd('0xb'),'json':!![]};_0x5f1b84[_0xecbd('0xc')]=_0x23cd6a;logger[_0xecbd('0xd')](_0xecbd('0xe'));return rp(_0x5f1b84)[_0xecbd('0xf')](function(_0x300a72){if(_0x300a72){var _0x77102d=_0x300a72['users'];var _0x51ffae=null;for(_0x51ffae=0x0;_0x51ffae<_0x77102d['length'];_0x51ffae++){if(_0x77102d[_0x51ffae][_0xecbd('0x10')]===_0x252f2d['adminEmail']){_0x252f2d['adminId']=_0x77102d[_0x51ffae]['id'];_0xad877b=!![];}}if(_0xad877b){logger['info'](_0xecbd('0x11'),_0x252f2d[_0xecbd('0x12')]);_0x78d28e(_0x252f2d);}else{_0x3fee35({'statusCode':0x194,'message':_0xecbd('0x13')});}}else{_0x3fee35({'statusCode':0x194,'message':_0xecbd('0x13')});}})[_0xecbd('0x14')](function(_0x1f014e){logger['error']('['+[_0x5940ca[_0xecbd('0x15')]()]+']',_0x1f014e[_0xecbd('0x16')]);_0x3fee35(_0x1f014e);});});}function getUser(_0x2d4b0f,_0x222029,_0x4b3e64){return function(_0xecf2d9){return new Promise(function(_0x4232da,_0x18d353){var _0x3001b8={'method':_0xecbd('0xa'),'uri':_0x4b3e64+_0xecbd('0xb'),'json':!![]};_0x3001b8[_0xecbd('0xc')]=_0x222029;logger[_0xecbd('0xd')]('Getting\x20user\x20list');return rp(_0x3001b8)['then'](function(_0x5010dc){if(_0x5010dc){var _0x6b3a37=_0x5010dc[_0xecbd('0x17')];var _0x90679d=![];var _0x14329a=null;if(_0xecf2d9[_0xecbd('0x18')]!==null){logger[_0xecbd('0xd')](_0xecbd('0x19'),_0xecf2d9[_0xecbd('0x18')]);_0xecf2d9[_0xecbd('0x1a')]=_0xecf2d9[_0xecbd('0x18')];for(_0x14329a=0x0;_0x14329a<_0x6b3a37[_0xecbd('0x1b')];_0x14329a++){if(_0x6b3a37[_0x14329a][_0xecbd('0x10')]===_0xecf2d9[_0xecbd('0x18')]){_0x90679d=!![];_0xecf2d9['userId']=_0x6b3a37[_0x14329a]['id'];logger[_0xecbd('0xd')]('User\x20found:',_0xecf2d9[_0xecbd('0x1c')]);}}}if(!_0x90679d){logger[_0xecbd('0xd')]('Admin\x20selected');_0xecf2d9['userEmail']=_0xecf2d9[_0xecbd('0x1d')];_0xecf2d9[_0xecbd('0x1c')]=_0xecf2d9[_0xecbd('0x12')];_0x90679d=!![];}if(_0x90679d){_0x4232da(_0xecf2d9);}else{_0x18d353({'statusCode':0x194,'message':_0xecbd('0x13')});}}else{_0x18d353({'statusCode':0x194,'message':_0xecbd('0x13')});}})[_0xecbd('0x14')](function(_0x49a427){logger[_0xecbd('0x1e')]('['+[_0x2d4b0f[_0xecbd('0x15')]()]+']',_0x49a427['message']);_0x18d353(_0x49a427);});});};}function searchContact(_0x1b0b9d,_0x3c01bb,_0x30e67c,_0x447854){return new Promise(function(_0x2b522d,_0x474c7d){var _0x5195c7={'method':_0xecbd('0xa'),'headers':_0x3c01bb,'uri':_0x1b0b9d+_0xecbd('0x1f')+_0x447854+_0xecbd('0x20')+_0x30e67c+_0xecbd('0x21'),'json':!![]};rp(_0x5195c7)[_0xecbd('0xf')](function(_0x14323d){var _0xf60d14=_[_0xecbd('0x22')](_0x14323d[_0xecbd('0x23')]['contacts'],[_0x30e67c,_0x447854]);_0x2b522d(_0xf60d14);})['catch'](function(_0x58f6d4){_0x474c7d(_0x58f6d4);});});}function getEndUser(_0x2b1252,_0x28086e,_0x55e97c){return function(_0x2ce070){return new Promise(function(_0x2031c6,_0x31a9aa){logger[_0xecbd('0xd')](util[_0xecbd('0x24')](_0xecbd('0x25'),_0x2ce070[_0xecbd('0x26')]));searchContact(_0x55e97c,_0x28086e,_0xecbd('0x27'),_0x2ce070[_0xecbd('0x26')])[_0xecbd('0xf')](function(_0x4504f2){if(_0x4504f2){_0x2ce070['endUserId']=_0x4504f2['id'];logger[_0xecbd('0xd')]('Contact\x20found\x20mobile_number:',_0x2ce070[_0xecbd('0x28')]);return _0x2031c6(_0x2ce070);}searchContact(_0x55e97c,_0x28086e,_0xecbd('0x29'),_0x2ce070['contactNumber'])['then'](function(_0x1fb366){if(_0x1fb366){_0x2ce070['endUserId']=_0x1fb366['id'];logger[_0xecbd('0xd')](_0xecbd('0x2a'),_0x2ce070[_0xecbd('0x28')]);return _0x2031c6(_0x2ce070);}createEndUser(_0x2ce070,_0x2b1252,_0x28086e,_0x55e97c)[_0xecbd('0xf')](function(_0x1275f1){logger[_0xecbd('0xd')](_0xecbd('0x2b'),_0x1275f1[_0xecbd('0x28')]);return _0x2031c6(_0x1275f1);});});})['catch'](function(_0x38c544){_0x31a9aa(_0x38c544);});});};}function createEndUser(_0x186f9a,_0x312110,_0x2613da,_0x20424b){return new Promise(function(_0x59c38d,_0x1c34f3){var _0x44d16f=moment();var _0x5da304={'method':_0xecbd('0x2c'),'uri':_0x20424b+_0xecbd('0x2d'),'body':{'contact':{'last_name':_0x186f9a[_0xecbd('0x26')],'work_number':_0x186f9a['contactNumber'],'mobile_number':_0x186f9a[_0xecbd('0x26')],'owner_id':_0x186f9a[_0xecbd('0x1c')],'created_at':_0x44d16f[_0xecbd('0x24')](_0xecbd('0x2e'))}},'json':!![]};_0x5da304['headers']=_0x2613da;logger[_0xecbd('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5da304)[_0xecbd('0xf')](function(_0x1e747b){_0x186f9a['endUserId']=_0x1e747b[_0xecbd('0x2f')]['id'];_0x59c38d(_0x186f9a);})[_0xecbd('0x14')](function(_0x3c7807){logger[_0xecbd('0x1e')]('['+[_0x312110['toUpperCase']()]+']',_0x3c7807['message']);_0x1c34f3(_0x3c7807[_0xecbd('0x16')]);});});}function getTicket(_0x216948,_0x2ad167,_0x1178e8,_0x2a6106,_0x324562){return function(_0x3ee65a){logger[_0xecbd('0xd')](_0xecbd('0x30'));return new Promise(function(_0x4f5f46,_0x35a0bc){var _0x1bbb5d=moment();var _0x55377c={'method':'POST','uri':_0x1178e8+_0xecbd('0x31'),'body':{'title':intUtil[_0xecbd('0x32')](_0x2a6106['Subjects'],_0x324562,'\x20'),'description':intUtil[_0xecbd('0x32')](_0x2a6106[_0xecbd('0x33')],_0x324562,'\x0a'),'owner_id':_0x3ee65a[_0xecbd('0x1c')],'creater_id':_0x3ee65a[_0xecbd('0x12')],'targetable_id':_0x3ee65a[_0xecbd('0x28')],'targetable_type':_0xecbd('0x34'),'created_at':_0x1bbb5d[_0xecbd('0x24')](_0xecbd('0x2e')),'due_date':_0x1bbb5d[_0xecbd('0x35')](0x1e,'m')[_0xecbd('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x55377c[_0xecbd('0xc')]=_0x2ad167;return rp(_0x55377c)[_0xecbd('0xf')](function(_0x37df9a){_0x3ee65a[_0xecbd('0x36')]=_0x37df9a[_0xecbd('0x37')]['id'];logger['info']('Task\x20created:',_0x3ee65a[_0xecbd('0x36')]);_0x4f5f46(_0x3ee65a);})[_0xecbd('0x14')](function(_0xa00b9f){logger[_0xecbd('0x1e')]('['+[_0x216948[_0xecbd('0x15')]()]+']',_0xa00b9f[_0xecbd('0x16')]);_0x35a0bc(_0xa00b9f[_0xecbd('0x16')]);});});};}function emit(_0x16c82f,_0xd5ace7,_0x1c5a83){var _0x2b6a12={'uri':_0x16c82f+_0xecbd('0x38')+_0x1c5a83};io['to'](util[_0xecbd('0x24')](_0xecbd('0x39'),_0xd5ace7))[_0xecbd('0x3a')]('trigger:browser:url',_0x2b6a12);}exports['cs']=function(_0x27fde2,_0x5dc5cb,_0x1a1543,_0x39e5c0,_0x5e2c76,_0xcb47b5,_0x299ca3,_0x5ecc50){var _0x3268f1={};var _0x47fa80={'Authorization':_0xecbd('0x3b')+_0xcb47b5['apiKey']};_0xcb47b5['remoteUri']=intUtil['stripTrailingSlash'](_0xcb47b5[_0xecbd('0x3c')]);_0xcb47b5[_0xecbd('0x3d')]=intUtil['stripTrailingSlash'](_0xcb47b5[_0xecbd('0x3d')]);var _0x922c04=_0xcb47b5[_0xecbd('0x3c')];_0x3268f1['adminEmail']=_0xcb47b5['username'];_0x3268f1[_0xecbd('0x26')]=_0x5ecc50['toLowerCase']()===_0xecbd('0x3e')?_0x5dc5cb[_0xecbd('0x3f')]:_0x5dc5cb[_0xecbd('0x40')];_0x3268f1[_0xecbd('0x41')]=_0x5ecc50===_0xecbd('0x42')||_0x5ecc50===_0xecbd('0x43')?_0xecbd('0x42'):'outbound';if(_0x39e5c0){_0x3268f1[_0xecbd('0x18')]=_0x39e5c0[_0xecbd('0x10')];}var _0x24f6e4=util['format'](_0xecbd('0x44'),_0xcb47b5[_0xecbd('0x3d')],_0x5dc5cb[_0xecbd('0x45')],md5(_0x5dc5cb[_0xecbd('0x45')]));if(_0x5e2c76&&_0x5e2c76['monitor_format']){logger[_0xecbd('0xd')](_0xecbd('0x46'),'Recording\x20is\x20enabled!');_0x5dc5cb[_0xecbd('0x47')]=_0x24f6e4;}else if(_0x299ca3&&_0x299ca3[_0xecbd('0x48')]&&_0x299ca3[_0xecbd('0x48')]!==_0xecbd('0x49')){logger['info']('[OUTBOUND]',_0xecbd('0x4a'));_0x5dc5cb[_0xecbd('0x47')]=_0x24f6e4;}else{_0x5dc5cb['recordingURL']='';}return getAdminId(_0x3268f1,_0x5ecc50,_0x47fa80,_0x922c04)['then'](getUser(_0x5ecc50,_0x47fa80,_0x922c04))[_0xecbd('0xf')](getEndUser(_0x5ecc50,_0x47fa80,_0x922c04))[_0xecbd('0xf')](getTicket(_0x5ecc50,_0x47fa80,_0x922c04,_0x1a1543,_0x5dc5cb))[_0xecbd('0xf')](function(_0x30b4ef){logger[_0xecbd('0xd')](util[_0xecbd('0x24')](_0xecbd('0x4b'),_0x30b4ef[_0xecbd('0x36')]));if(_0x5ecc50!==_0xecbd('0x43')){logger[_0xecbd('0xd')]('['+[_0x5ecc50['toUpperCase']()]+']',_0xecbd('0x4c'));emit(_0x922c04,_0x39e5c0[_0xecbd('0x4d')],_0x30b4ef[_0xecbd('0x28')]);}})[_0xecbd('0x14')](function(_0xf40c05){logger[_0xecbd('0x1e')]('['+[_0x5ecc50[_0xecbd('0x15')]()]+_0xecbd('0x4e'),util[_0xecbd('0x4f')](_0xf40c05,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x706e=['calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','redis','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','/api/tasks','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','/contacts/','user:%s','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum'];(function(_0x1c08f3,_0x12beb3){var _0x5edb1c=function(_0x37238a){while(--_0x37238a){_0x1c08f3['push'](_0x1c08f3['shift']());}};_0x5edb1c(++_0x12beb3);}(_0x706e,0x10b));var _0xe706=function(_0xa24e4d,_0x1cd4d1){_0xa24e4d=_0xa24e4d-0x0;var _0x37b626=_0x706e[_0xa24e4d];return _0x37b626;};'use strict';var _=require(_0xe706('0x0'));var rp=require(_0xe706('0x1'));var md5=require(_0xe706('0x2'));var util=require(_0xe706('0x3'));var moment=require(_0xe706('0x4'));var Promise=require('bluebird');var Redis=require(_0xe706('0x5'));var intUtil=require(_0xe706('0x6'));var config=require(_0xe706('0x7'));var logger=require(_0xe706('0x8'))('freshsales');config['redis']=_[_0xe706('0x9')](config['redis'],{'host':_0xe706('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe706('0xb')]));function getAdminId(_0x5bd7e5,_0x4ba418,_0x420ef5,_0x1c54f2){return new Promise(function(_0x5db72a,_0x4c0983){var _0x263750=![];var _0x22b539={'method':'GET','uri':_0x1c54f2+_0xe706('0xc'),'json':!![]};_0x22b539[_0xe706('0xd')]=_0x420ef5;logger[_0xe706('0xe')]('Getting\x20admin\x20information');return rp(_0x22b539)[_0xe706('0xf')](function(_0x25b421){if(_0x25b421){var _0x4c135b=_0x25b421[_0xe706('0x10')];var _0x48f1a2=null;for(_0x48f1a2=0x0;_0x48f1a2<_0x4c135b[_0xe706('0x11')];_0x48f1a2++){if(_0x4c135b[_0x48f1a2][_0xe706('0x12')]===_0x5bd7e5[_0xe706('0x13')]){_0x5bd7e5[_0xe706('0x14')]=_0x4c135b[_0x48f1a2]['id'];_0x263750=!![];}}if(_0x263750){logger['info'](_0xe706('0x15'),_0x5bd7e5[_0xe706('0x14')]);_0x5db72a(_0x5bd7e5);}else{_0x4c0983({'statusCode':0x194,'message':_0xe706('0x16')});}}else{_0x4c0983({'statusCode':0x194,'message':_0xe706('0x16')});}})[_0xe706('0x17')](function(_0x6b0ae1){logger[_0xe706('0x18')]('['+[_0x4ba418[_0xe706('0x19')]()]+']',_0x6b0ae1[_0xe706('0x1a')]);_0x4c0983(_0x6b0ae1);});});}function getUser(_0x2fbbfb,_0x2188f9,_0x160035){return function(_0x2c03d9){return new Promise(function(_0xa1a601,_0x1b8307){var _0x3b966c={'method':_0xe706('0x1b'),'uri':_0x160035+_0xe706('0xc'),'json':!![]};_0x3b966c['headers']=_0x2188f9;logger[_0xe706('0xe')](_0xe706('0x1c'));return rp(_0x3b966c)[_0xe706('0xf')](function(_0x400f20){if(_0x400f20){var _0x46d2af=_0x400f20['users'];var _0x42b941=![];var _0x4bbf3b=null;if(_0x2c03d9['agentEmail']!==null){logger[_0xe706('0xe')](_0xe706('0x1d'),_0x2c03d9[_0xe706('0x1e')]);_0x2c03d9['userEmail']=_0x2c03d9[_0xe706('0x1e')];for(_0x4bbf3b=0x0;_0x4bbf3b<_0x46d2af[_0xe706('0x11')];_0x4bbf3b++){if(_0x46d2af[_0x4bbf3b]['email']===_0x2c03d9[_0xe706('0x1e')]){_0x42b941=!![];_0x2c03d9[_0xe706('0x1f')]=_0x46d2af[_0x4bbf3b]['id'];logger[_0xe706('0xe')](_0xe706('0x20'),_0x2c03d9[_0xe706('0x1f')]);}}}if(!_0x42b941){logger[_0xe706('0xe')]('Admin\x20selected');_0x2c03d9['userEmail']=_0x2c03d9[_0xe706('0x13')];_0x2c03d9[_0xe706('0x1f')]=_0x2c03d9[_0xe706('0x14')];_0x42b941=!![];}if(_0x42b941){_0xa1a601(_0x2c03d9);}else{_0x1b8307({'statusCode':0x194,'message':_0xe706('0x16')});}}else{_0x1b8307({'statusCode':0x194,'message':_0xe706('0x16')});}})[_0xe706('0x17')](function(_0x1e243f){logger[_0xe706('0x18')]('['+[_0x2fbbfb['toUpperCase']()]+']',_0x1e243f['message']);_0x1b8307(_0x1e243f);});});};}function searchContact(_0x5ec78e,_0x41e47e,_0x251dba,_0x190fde){return new Promise(function(_0xee1f39,_0x8b60b){var _0xc3df41={'method':'GET','headers':_0x41e47e,'uri':_0x5ec78e+'/api/lookup?q='+_0x190fde+_0xe706('0x21')+_0x251dba+_0xe706('0x22'),'json':!![]};rp(_0xc3df41)['then'](function(_0x2791ca){var _0x44fc54=_[_0xe706('0x23')](_0x2791ca['contacts'][_0xe706('0x24')],[_0x251dba,_0x190fde]);_0xee1f39(_0x44fc54);})['catch'](function(_0x2f73da){_0x8b60b(_0x2f73da);});});}function getEndUser(_0xcbf930,_0x47470a,_0xc3ca5){return function(_0x6d3930){return new Promise(function(_0x25998b,_0x3a71eb){logger[_0xe706('0xe')](util['format'](_0xe706('0x25'),_0x6d3930[_0xe706('0x26')]));searchContact(_0xc3ca5,_0x47470a,_0xe706('0x27'),_0x6d3930[_0xe706('0x26')])[_0xe706('0xf')](function(_0x69bada){if(_0x69bada){_0x6d3930[_0xe706('0x28')]=_0x69bada['id'];logger['info'](_0xe706('0x29'),_0x6d3930[_0xe706('0x28')]);return _0x25998b(_0x6d3930);}searchContact(_0xc3ca5,_0x47470a,_0xe706('0x2a'),_0x6d3930[_0xe706('0x26')])['then'](function(_0x29d5f6){if(_0x29d5f6){_0x6d3930['endUserId']=_0x29d5f6['id'];logger[_0xe706('0xe')](_0xe706('0x2b'),_0x6d3930[_0xe706('0x28')]);return _0x25998b(_0x6d3930);}createEndUser(_0x6d3930,_0xcbf930,_0x47470a,_0xc3ca5)['then'](function(_0x2b8582){logger['info'](_0xe706('0x2c'),_0x2b8582[_0xe706('0x28')]);return _0x25998b(_0x2b8582);});});})[_0xe706('0x17')](function(_0x21715b){_0x3a71eb(_0x21715b);});});};}function createEndUser(_0xd7ad03,_0x3d000d,_0x3a4a4a,_0x42970a){return new Promise(function(_0x382957,_0x4c53a7){var _0x470153=moment();var _0x4866f7={'method':_0xe706('0x2d'),'uri':_0x42970a+'/api/contacts','body':{'contact':{'last_name':_0xd7ad03[_0xe706('0x26')],'work_number':_0xd7ad03[_0xe706('0x26')],'mobile_number':_0xd7ad03[_0xe706('0x26')],'owner_id':_0xd7ad03[_0xe706('0x1f')],'created_at':_0x470153[_0xe706('0x2e')](_0xe706('0x2f'))}},'json':!![]};_0x4866f7[_0xe706('0xd')]=_0x3a4a4a;logger[_0xe706('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4866f7)['then'](function(_0x1afd27){_0xd7ad03['endUserId']=_0x1afd27['contact']['id'];_0x382957(_0xd7ad03);})['catch'](function(_0x339ea6){logger[_0xe706('0x18')]('['+[_0x3d000d[_0xe706('0x19')]()]+']',_0x339ea6[_0xe706('0x1a')]);_0x4c53a7(_0x339ea6[_0xe706('0x1a')]);});});}function getTicket(_0x575537,_0x7aa19a,_0x2dab9e,_0x535304,_0x5e4a2a){return function(_0x4025c2){logger[_0xe706('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x5e3adb,_0x356387){var _0x2a1dba=moment();var _0x372895={'method':_0xe706('0x2d'),'uri':_0x2dab9e+_0xe706('0x30'),'body':{'title':intUtil[_0xe706('0x31')](_0x535304[_0xe706('0x32')],_0x5e4a2a,'\x20'),'description':intUtil[_0xe706('0x31')](_0x535304[_0xe706('0x33')],_0x5e4a2a,'\x0a'),'owner_id':_0x4025c2['userId'],'creater_id':_0x4025c2[_0xe706('0x14')],'targetable_id':_0x4025c2[_0xe706('0x28')],'targetable_type':'Contact','created_at':_0x2a1dba['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2a1dba[_0xe706('0x34')](0x1e,'m')[_0xe706('0x2e')](_0xe706('0x2f'))},'json':!![]};_0x372895[_0xe706('0xd')]=_0x7aa19a;return rp(_0x372895)[_0xe706('0xf')](function(_0x54791e){_0x4025c2['ticketId']=_0x54791e[_0xe706('0x35')]['id'];logger['info'](_0xe706('0x36'),_0x4025c2[_0xe706('0x37')]);_0x5e3adb(_0x4025c2);})[_0xe706('0x17')](function(_0x4ea5bb){logger['error']('['+[_0x575537[_0xe706('0x19')]()]+']',_0x4ea5bb[_0xe706('0x1a')]);_0x356387(_0x4ea5bb[_0xe706('0x1a')]);});});};}function emit(_0x375e8f,_0x442ce5,_0x4440f6){var _0x4e5bd3={'uri':_0x375e8f+_0xe706('0x38')+_0x4440f6};io['to'](util[_0xe706('0x2e')](_0xe706('0x39'),_0x442ce5))['emit']('trigger:browser:url',_0x4e5bd3);}exports['cs']=function(_0x338452,_0x238063,_0x3197e2,_0x3dc99a,_0x530631,_0x5248ef,_0x5eec87,_0x43a6d9){var _0x5daab4={};var _0x56c1d3={'Authorization':'Token\x20token='+_0x5248ef[_0xe706('0x3a')]};_0x5248ef['remoteUri']=intUtil[_0xe706('0x3b')](_0x5248ef[_0xe706('0x3c')]);_0x5248ef[_0xe706('0x3d')]=intUtil[_0xe706('0x3b')](_0x5248ef[_0xe706('0x3d')]);var _0x422df4=_0x5248ef[_0xe706('0x3c')];_0x5daab4['adminEmail']=_0x5248ef[_0xe706('0x3e')];_0x5daab4[_0xe706('0x26')]=_0x43a6d9[_0xe706('0x3f')]()==='outbound'?_0x238063[_0xe706('0x40')]:_0x238063[_0xe706('0x41')];_0x5daab4[_0xe706('0x42')]=_0x43a6d9===_0xe706('0x43')||_0x43a6d9===_0xe706('0x44')?_0xe706('0x43'):_0xe706('0x45');if(_0x3dc99a){_0x5daab4[_0xe706('0x1e')]=_0x3dc99a[_0xe706('0x12')];}var _0x2bacd2=util[_0xe706('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5248ef[_0xe706('0x3d')],_0x238063[_0xe706('0x46')],md5(_0x238063['uniqueid']));if(_0x530631&&_0x530631[_0xe706('0x47')]){logger['info'](_0xe706('0x48'),'Recording\x20is\x20enabled!');_0x238063[_0xe706('0x49')]=_0x2bacd2;}else if(_0x5eec87&&_0x5eec87[_0xe706('0x4a')]&&_0x5eec87[_0xe706('0x4a')]!==_0xe706('0x4b')){logger['info'](_0xe706('0x4c'),_0xe706('0x4d'));_0x238063['recordingURL']=_0x2bacd2;}else{_0x238063['recordingURL']='';}return getAdminId(_0x5daab4,_0x43a6d9,_0x56c1d3,_0x422df4)[_0xe706('0xf')](getUser(_0x43a6d9,_0x56c1d3,_0x422df4))[_0xe706('0xf')](getEndUser(_0x43a6d9,_0x56c1d3,_0x422df4))[_0xe706('0xf')](getTicket(_0x43a6d9,_0x56c1d3,_0x422df4,_0x3197e2,_0x238063))['then'](function(_0x32b0a8){logger[_0xe706('0xe')](util[_0xe706('0x2e')](_0xe706('0x4e'),_0x32b0a8[_0xe706('0x37')]));if(_0x43a6d9!=='unmanaged'){logger['info']('['+[_0x43a6d9['toUpperCase']()]+']',_0xe706('0x4f'));emit(_0x422df4,_0x3dc99a[_0xe706('0x50')],_0x32b0a8[_0xe706('0x28')]);}})[_0xe706('0x17')](function(_0xbb7039){logger['error']('['+[_0x43a6d9['toUpperCase']()]+_0xe706('0x51'),util[_0xe706('0x52')](_0xbb7039,{'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 528dad4..0766d97 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 _0x3bd1=['./freshsales','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365'];(function(_0x5463dc,_0xaf0ea9){var _0x9b3032=function(_0x2641c5){while(--_0x2641c5){_0x5463dc['push'](_0x5463dc['shift']());}};_0x9b3032(++_0xaf0ea9);}(_0x3bd1,0x1a5));var _0x13bd=function(_0x580c1c,_0x38aff3){_0x580c1c=_0x580c1c-0x0;var _0x137377=_0x3bd1[_0x580c1c];return _0x137377;};'use strict';var _=require(_0x13bd('0x0'));var util=require(_0x13bd('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x13bd('0x2'));var sugarcrm=require(_0x13bd('0x3'));var freshdesk=require(_0x13bd('0x4'));var zoho=require('./zoho');var desk=require(_0x13bd('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x13bd('0x6'));var dynamics365=require(_0x13bd('0x7'));var freshsales=require(_0x13bd('0x8'));var integrations=['zendesk',_0x13bd('0x9'),_0x13bd('0xa'),_0x13bd('0xb'),_0x13bd('0xc'),'desk','vtiger',_0x13bd('0xd'),_0x13bd('0xe'),_0x13bd('0xf')];exports[_0x13bd('0x10')]=function(_0x1e0a3e,_0x50af23,_0x437347,_0x13566c,_0x58b77f,_0x4d57a7){if(_0x437347){if(_[_0x13bd('0x11')](integrations,_0x1e0a3e[_0x13bd('0x12')][_0x13bd('0x13')]())){try{var _0xa52a96=null;var _0x39ce7b='';var _0x117c36=_0x437347[_0x1e0a3e['data1']['toLowerCase']()];if(_0x117c36){var _0xd935d3=_0x117c36[_0x1e0a3e[_0x13bd('0x14')]];if(_0xd935d3){var _0x730945=_[_0x13bd('0x15')](_0xd935d3[_0x13bd('0x16')],{'id':parseInt(_0x1e0a3e[_0x13bd('0x17')],0xa)});if(_0x730945){if(_0x13566c){if(_0x58b77f&&_0x50af23[_0x13bd('0x18')]){_0x39ce7b=_0x13bd('0x18');}else if(_0x50af23[_0x13bd('0x19')]){_0x39ce7b=_0x13bd('0x1a');}else{console[_0x13bd('0x1b')](_0x13bd('0x1c'),_0x50af23);}}else{_0x39ce7b=_0x13bd('0x1d');}switch(_0x1e0a3e[_0x13bd('0x12')][_0x13bd('0x13')]()){case'zendesk':zendesk[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0x9'):salesforce[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0xa'):sugarcrm[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case'freshdesk':freshdesk[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0xc'):zoho[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0x1e'):desk[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0x1f'):vtiger[_0x39ce7b](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7);break;case _0x13bd('0xe'):freshsales['cs'](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7,_0x39ce7b);break;case'servicenow':servicenow['cs'](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7,_0x39ce7b);break;case'dynamics365':dynamics365['cs'](_0x1e0a3e,_0x50af23,_0x730945,_0x13566c,_0x58b77f,_0xd935d3,_0x4d57a7,_0x39ce7b);break;default:console[_0x13bd('0x1b')](_0x13bd('0x20'));}}else{_0xa52a96=require(_0x13bd('0x21'))(_0x1e0a3e[_0x13bd('0x12')][_0x13bd('0x13')]());_0xa52a96[_0x13bd('0x22')](_0x13bd('0x23'),util[_0x13bd('0x24')](_0x13bd('0x25'),_0x1e0a3e[_0x13bd('0x12')][_0x13bd('0x13')](),_0x1e0a3e[_0x13bd('0x17')]));}}else{_0xa52a96=require('../../../../config/logger')(_0x1e0a3e[_0x13bd('0x12')][_0x13bd('0x13')]());_0xa52a96[_0x13bd('0x22')](_0x13bd('0x23'),util[_0x13bd('0x24')](_0x13bd('0x26'),_0x1e0a3e[_0x13bd('0x12')]['toLowerCase'](),_0x1e0a3e['data2']));}}else{}}catch(_0x7e5aed){console[_0x13bd('0x22')](_0x7e5aed);}}}}; \ No newline at end of file +var _0x4f73=['includes','data1','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','toLowerCase','zendesk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk','zoho','desk','servicenow','exec'];(function(_0xcba3dc,_0x59a1d1){var _0x532a4b=function(_0x3141d5){while(--_0x3141d5){_0xcba3dc['push'](_0xcba3dc['shift']());}};_0x532a4b(++_0x59a1d1);}(_0x4f73,0x134));var _0x34f7=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x4f73[_0x54eab6];return _0x1e7435;};'use strict';var _=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x34f7('0x2'));var sugarcrm=require(_0x34f7('0x3'));var freshdesk=require(_0x34f7('0x4'));var zoho=require('./zoho');var desk=require(_0x34f7('0x5'));var vtiger=require(_0x34f7('0x6'));var servicenow=require(_0x34f7('0x7'));var dynamics365=require(_0x34f7('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x34f7('0x9'),_0x34f7('0xa'),_0x34f7('0xb'),_0x34f7('0xc'),_0x34f7('0xd'),'vtiger','dynamics365','freshsales',_0x34f7('0xe')];exports[_0x34f7('0xf')]=function(_0xf910f5,_0x51ebb6,_0x569520,_0x184619,_0x43ae70,_0x3ed956){if(_0x569520){if(_[_0x34f7('0x10')](integrations,_0xf910f5[_0x34f7('0x11')]['toLowerCase']())){try{var _0x47ae95=null;var _0xff3a64='';var _0x21c0b2=_0x569520[_0xf910f5[_0x34f7('0x11')]['toLowerCase']()];if(_0x21c0b2){var _0x1da01b=_0x21c0b2[_0xf910f5[_0x34f7('0x12')]];if(_0x1da01b){var _0x331a40=_[_0x34f7('0x13')](_0x1da01b[_0x34f7('0x14')],{'id':parseInt(_0xf910f5[_0x34f7('0x15')],0xa)});if(_0x331a40){if(_0x184619){if(_0x43ae70&&_0x51ebb6['queue']){_0xff3a64=_0x34f7('0x16');}else if(_0x51ebb6['routeId']){_0xff3a64=_0x34f7('0x17');}else{console[_0x34f7('0x18')](_0x34f7('0x19'),_0x51ebb6);}}else{_0xff3a64='unmanaged';}switch(_0xf910f5[_0x34f7('0x11')][_0x34f7('0x1a')]()){case _0x34f7('0x1b'):zendesk[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case _0x34f7('0x9'):salesforce[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case _0x34f7('0xa'):sugarcrm[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case _0x34f7('0xb'):freshdesk[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case'zoho':zoho[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case _0x34f7('0xd'):desk[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case _0x34f7('0x1c'):vtiger[_0xff3a64](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956);break;case'freshsales':freshsales['cs'](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956,_0xff3a64);break;case _0x34f7('0xe'):servicenow['cs'](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956,_0xff3a64);break;case'dynamics365':dynamics365['cs'](_0xf910f5,_0x51ebb6,_0x331a40,_0x184619,_0x43ae70,_0x1da01b,_0x3ed956,_0xff3a64);break;default:console[_0x34f7('0x18')](_0x34f7('0x1d'));}}else{_0x47ae95=require(_0x34f7('0x1e'))(_0xf910f5[_0x34f7('0x11')][_0x34f7('0x1a')]());_0x47ae95[_0x34f7('0x1f')](_0x34f7('0x20'),util[_0x34f7('0x21')](_0x34f7('0x22'),_0xf910f5[_0x34f7('0x11')]['toLowerCase'](),_0xf910f5['data3']));}}else{_0x47ae95=require(_0x34f7('0x1e'))(_0xf910f5[_0x34f7('0x11')][_0x34f7('0x1a')]());_0x47ae95[_0x34f7('0x1f')]('[EXEC]',util[_0x34f7('0x21')](_0x34f7('0x23'),_0xf910f5['data1'][_0x34f7('0x1a')](),_0xf910f5['data2']));}}else{}}catch(_0x44fe34){console[_0x34f7('0x1f')](_0x44fe34);}}}}; \ 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 a7e6c03..5afa972 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 _0x629f=['info','sobject','create','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','password','Connection','remoteUri','clientId','Connection\x20established.','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','[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','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','leadId'];(function(_0x42e7c1,_0x134c50){var _0x1ef92c=function(_0x2b0854){while(--_0x2b0854){_0x42e7c1['push'](_0x42e7c1['shift']());}};_0x1ef92c(++_0x134c50);}(_0x629f,0x1d9));var _0xf629=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x629f[_0x1acc2d];return _0xabfa6d;};'use strict';var _=require(_0xf629('0x0'));var rp=require(_0xf629('0x1'));var moment=require(_0xf629('0x2'));var BPromise=require(_0xf629('0x3'));var md5=require(_0xf629('0x4'));var jsforce=require(_0xf629('0x5'));var util=require(_0xf629('0x6'));var Redis=require(_0xf629('0x7'));var intUtil=require(_0xf629('0x8'));var config=require('../../../../config/environment');var logger=require(_0xf629('0x9'))(_0xf629('0xa'));config['redis']=_[_0xf629('0xb')](config[_0xf629('0xc')],{'host':_0xf629('0xd'),'port':0x18eb});var io=require(_0xf629('0xe'))(new Redis(config[_0xf629('0xc')]));function emit(_0xe9df2f,_0x2768dc,_0x59e510){io['to'](_0xe9df2f)[_0xf629('0xf')](_0x2768dc,_0x59e510);}function getTicket(_0xd9c21c,_0x45bf50,_0x17817a,_0x1a40d9,_0x30fc76,_0x573085,_0x16fe94,_0x381d9a){var _0x594fe0=Object[_0xf629('0x10')]({},{'OwnerId':_0x45bf50['id'],'Subject':intUtil['getString'](_0x1a40d9['Subjects'],_0x30fc76,'\x20'),'Description':intUtil['getString'](_0x1a40d9[_0xf629('0x11')],_0x30fc76,'\x0a')},getCustomFields(_0x573085,_0x30fc76));if(_0x17817a){if(_0x1a40d9[_0xf629('0x12')]===_0xf629('0x13')){_0x594fe0[_0xf629('0x14')]=moment['utc']();_0x594fe0[_0xf629('0x15')]=![];_0x594fe0[_0xf629('0x16')]=![];if(_0x17817a[_0xf629('0x17')]===_0xf629('0x18')||_0x17817a['endUserType']===_0xf629('0x19')){_0x594fe0[_0xf629('0x1a')]=_0x17817a['id'];}else if(_0x17817a[_0xf629('0x17')]===_0xf629('0x1b')){_0x594fe0[_0xf629('0x1c')]=_0x17817a['id'];}}else if(_0x1a40d9[_0xf629('0x12')]==='Case'){if(_0x17817a[_0xf629('0x17')]==='contact'){_0x594fe0[_0xf629('0x1d')]=_0x17817a['id'];}else if(_0x17817a['endUserType']===_0xf629('0x1b')){_0x594fe0['AccountId']=_0x17817a['id'];}else if(_0x17817a[_0xf629('0x17')]==='lead'&&_0x1a40d9[_0xf629('0x1e')]){_0x594fe0[_0x1a40d9[_0xf629('0x1e')]]=_0x17817a['id'];}else{logger[_0xf629('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x16fe94[_0xf629('0x20')](_0x1a40d9['ticketType'])[_0xf629('0x21')](_0x594fe0);}function getUser(_0x38ed32,_0x52b2e1,_0x3aa95b){if(!_['isNil'](_0x52b2e1)&&intUtil[_0xf629('0x22')](_0x52b2e1)){var _0x20b01f={'Email':_0x52b2e1};var _0x400714={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3aa95b[_0xf629('0x20')](_0xf629('0x23'))[_0xf629('0x24')](_0x20b01f,_0x400714)[_0xf629('0x25')]()[_0xf629('0x26')](function(_0x122d33){if(_0x122d33['length']){var _0x35e5a1=_['find'](_0x122d33,function(_0x459611){return _0x459611[_0xf629('0x27')]===_0x52b2e1;});if(_0x35e5a1){logger[_0xf629('0x1f')](_0xf629('0x28'),_0x52b2e1);return BPromise['resolve']({'id':_0x35e5a1['Id'],'name':_0x35e5a1[_0xf629('0x29')]});}}else{logger[_0xf629('0x1f')](_0xf629('0x2a'),_0x52b2e1);return _0x3aa95b[_0xf629('0x2b')]()['then'](function(_0x5c6213){return BPromise[_0xf629('0x2c')]({'id':_0x5c6213[_0xf629('0x2d')],'name':_0x5c6213[_0xf629('0x2e')]});});}});}else{logger[_0xf629('0x1f')](_0xf629('0x2a'),_0x52b2e1);return _0x3aa95b[_0xf629('0x2b')]()['then'](function(_0x8b11a2){return BPromise['resolve']({'id':_0x8b11a2[_0xf629('0x2d')],'name':_0x8b11a2['display_name']});});}}function getEndUser(_0x1b09a2,_0x206111,_0x1b6ae1,_0x192267,_0x16cb67){var _0x121c00={'$or':{'Phone':_0x192267}};var _0x3f1e17={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf629('0x2c')]()[_0xf629('0x26')](function(){logger[_0xf629('0x1f')](_0xf629('0x2f'),_0x192267,_0x206111[_0xf629('0x30')]);switch(_0x206111[_0xf629('0x30')]){case _0xf629('0x31'):var _0x156b83=_[_0xf629('0x32')](_0x121c00);if(_0x206111[_0xf629('0x33')]){var _0x3b4328={};_0x3b4328[_0x206111[_0xf629('0x33')]]=_0x192267;_[_0xf629('0x34')](_0x156b83[_0xf629('0x35')],_0x3b4328);}return _0x16cb67[_0xf629('0x20')](_0xf629('0x36'))['find'](_0x156b83,_0x3f1e17)[_0xf629('0x25')]()[_0xf629('0x26')](function(_0xeae6c2){if(_0xeae6c2&&_0xeae6c2[_0xf629('0x37')]){return _0xeae6c2;}else{var _0x14c6cc=_[_0xf629('0x32')](_0x121c00);if(_0x206111[_0xf629('0x38')]){var _0x537e15={};_0x537e15[_0x206111[_0xf629('0x38')]]=_0x192267;_[_0xf629('0x34')](_0x14c6cc[_0xf629('0x35')],_0x537e15);}return _0x16cb67['sobject']('Lead')[_0xf629('0x24')](_0x14c6cc,_0x3f1e17);}});case _0xf629('0x39'):var _0x466973=_[_0xf629('0x32')](_0x121c00);if(_0x206111[_0xf629('0x3a')]){var _0x3b4328={};_0x3b4328[_0x206111[_0xf629('0x3a')]]=_0x192267;_['merge'](_0x466973[_0xf629('0x35')],_0x3b4328);}return _0x16cb67['sobject'](_0xf629('0x3b'))['find'](_0x466973,_0x3f1e17)['execute']()['then'](function(_0x214f3f){if(_0x214f3f&&_0x214f3f['length']){return _0x214f3f;}else{var _0x57012c=_['cloneDeep'](_0x121c00);if(_0x206111[_0xf629('0x33')]){var _0x12914f={};_0x12914f[_0x206111[_0xf629('0x33')]]=_0x192267;_[_0xf629('0x34')](_0x57012c[_0xf629('0x35')],_0x12914f);}return _0x16cb67['sobject']('Contact')[_0xf629('0x24')](_0x57012c,_0x3f1e17)[_0xf629('0x26')](function(_0x5b292b){if(_0x5b292b&&_0x5b292b['length']){return _0x5b292b;}else{var _0x5349bc=_[_0xf629('0x32')](_0x121c00);if(_0x206111['additionalSearchLead']){var _0x47b596={};_0x47b596[_0x206111[_0xf629('0x38')]]=_0x192267;_[_0xf629('0x34')](_0x5349bc['$or'],_0x47b596);}return _0x16cb67[_0xf629('0x20')](_0xf629('0x3c'))['find'](_0x5349bc,_0x3f1e17);}});}});case _0xf629('0x18'):var _0x156b83=_[_0xf629('0x32')](_0x121c00);if(_0x206111[_0xf629('0x33')]){var _0x3b4328={};_0x3b4328[_0x206111[_0xf629('0x33')]]=_0x192267;_[_0xf629('0x34')](_0x156b83[_0xf629('0x35')],_0x3b4328);}return _0x16cb67['sobject'](_0xf629('0x36'))[_0xf629('0x24')](_0x156b83,_0x3f1e17)[_0xf629('0x25')]();case'lead':var _0x3c81ef=_['cloneDeep'](_0x121c00);if(_0x206111['additionalSearchLead']){var _0x3b4328={};_0x3b4328[_0x206111[_0xf629('0x38')]]=_0x192267;_[_0xf629('0x34')](_0x3c81ef[_0xf629('0x35')],_0x3b4328);}return _0x16cb67[_0xf629('0x20')]('Lead')[_0xf629('0x24')](_0x3c81ef,_0x3f1e17);case _0xf629('0x1b'):var _0x466973=_[_0xf629('0x32')](_0x121c00);if(_0x206111[_0xf629('0x3a')]){var _0x3b4328={};_0x3b4328[_0x206111[_0xf629('0x3a')]]=_0x192267;_[_0xf629('0x34')](_0x466973['$or'],_0x3b4328);}return _0x16cb67[_0xf629('0x20')]('Account')[_0xf629('0x24')](_0x466973,_0x3f1e17);default:return null;}})[_0xf629('0x26')](function(_0x3c5408){if(_0x3c5408&&_0x3c5408[_0xf629('0x37')]){var _0x52352e=_[_0xf629('0x3d')](_0x3c5408);if(_0x52352e){return BPromise['resolve']({'id':_0x52352e['Id'],'name':_0x52352e['Name'],'phone':_0x52352e[_0xf629('0x3e')],'endUserType':_0x52352e[_0xf629('0x3f')]['type'][_0xf629('0x40')]()});}}})[_0xf629('0x26')](function(_0x13ee16){if(_0x13ee16){logger[_0xf629('0x1f')](_0xf629('0x41'),_0x13ee16[_0xf629('0x17')],_0x192267);return BPromise[_0xf629('0x2c')](_0x13ee16);}else{logger[_0xf629('0x1f')](_0xf629('0x42'),_0x192267);var _0xa1c86b={'Phone':_0x192267};if(_0x206111[_0xf629('0x43')]){if(_0x206111[_0xf629('0x43')]===_0xf629('0x18')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x192267,_0x206111[_0xf629('0x43')]);_0xa1c86b[_0xf629('0x44')]=_0x1b6ae1!==''?_0x1b6ae1:util['format']('Caller\x20-\x20%s',_0x192267);}else if(_0x206111[_0xf629('0x43')]===_0xf629('0x19')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x192267,_0x206111[_0xf629('0x43')]);_0xa1c86b['LastName']=_0x1b6ae1!==_0xf629('0x45')?_0x1b6ae1:util['format'](_0xf629('0x46'),_0x192267);_0xa1c86b[_0xf629('0x47')]=_0xf629('0x48');}else if(_0x206111[_0xf629('0x43')]===_0xf629('0x1b')){logger[_0xf629('0x1f')](_0xf629('0x49'),_0x192267,_0x206111[_0xf629('0x43')]);_0xa1c86b[_0xf629('0x29')]=_0x1b6ae1!==_0xf629('0x45')?_0x1b6ae1:util[_0xf629('0x4a')]('Caller\x20-\x20%s',_0x192267);}else{return null;}}return _0x16cb67[_0xf629('0x20')](_['upperFirst'](_0x206111[_0xf629('0x43')]))[_0xf629('0x21')](_0xa1c86b)[_0xf629('0x26')](function(_0x38259c){return BPromise[_0xf629('0x2c')]({'id':_0x38259c['id'],'endUserType':_0x206111[_0xf629('0x43')]});});}});}function getCustomFields(_0x46a77f,_0x5429f4){var _0x36ae51={};if(_0x46a77f[_0xf629('0x37')]>0x0){_['forEach'](_0x46a77f,function(_0x88737c){if(_['includes']([_0xf629('0x4b'),_0xf629('0x4c')],_0x88737c[_0xf629('0x4d')])&&_0x88737c[_0xf629('0x4e')]){_0x36ae51[_0x88737c['idField']]=_0x88737c['content'][_0xf629('0x4f')]();}else if(_0x88737c[_0xf629('0x4d')]===_0xf629('0x50')&&_0x88737c[_0xf629('0x51')]&&_0x88737c[_0xf629('0x4e')]){_0x5429f4[_0x88737c[_0xf629('0x51')]]&&(_0x36ae51[_0x88737c[_0xf629('0x4e')]]=_0x5429f4[_0x88737c['variableName']]['toString']());}else if(_0x88737c[_0xf629('0x4d')]===_0xf629('0x52')&&_0x88737c[_0xf629('0x53')]&&_0x88737c[_0xf629('0x53')]['name']&&_0x88737c[_0xf629('0x4e')]){_0x5429f4[_0x88737c[_0xf629('0x53')][_0xf629('0x54')][_0xf629('0x40')]()]&&(_0x36ae51[_0x88737c['idField']]=_0x5429f4[_0x88737c['Variable'][_0xf629('0x54')]['toLowerCase']()][_0xf629('0x4f')]());}});}return _0x36ae51;}function getConnection(_0x5b5eba){var _0x1d679a=_0x5b5eba[_0xf629('0x55')]['concat'](_0x5b5eba['securityToken']);var _0x3ff706=new jsforce[(_0xf629('0x56'))]({'oauth2':{'loginUrl':_0x5b5eba[_0xf629('0x57')]||'https://login.salesforce.com','clientId':_0x5b5eba[_0xf629('0x58')],'clientSecret':_0x5b5eba['clientSecret']}});return _0x3ff706['login'](_0x5b5eba['username'],_0x1d679a)[_0xf629('0x26')](function(){logger[_0xf629('0x1f')](_0xf629('0x59'));return _0x3ff706;});}exports[_0xf629('0x5a')]=function(_0x5ac17c,_0xb19130,_0x27b5c1,_0x4c5a0b,_0x1b78e3,_0x1430d9){var _0x29ec8f,_0x71e34b,_0x475f16,_0x41b405;_0x1430d9['serverUrl']=intUtil['stripTrailingSlash'](_0x1430d9[_0xf629('0x5b')]);_0x1430d9['remoteUri']=intUtil['stripTrailingSlash'](_0x1430d9[_0xf629('0x57')]);if(_0x1b78e3&&_0x1b78e3[_0xf629('0x5c')]){logger[_0xf629('0x1f')]('[QUEUE]',_0xf629('0x5d'));_0xb19130[_0xf629('0x5e')]=util['format'](_0xf629('0x5f'),_0x1430d9[_0xf629('0x5b')],_0xb19130[_0xf629('0x60')],md5(_0xb19130['uniqueid']));}else{_0xb19130['recordingURL']='';}return getConnection(_0x1430d9)['then'](function(_0x51a5f4){_0x41b405=_0x51a5f4;return getUser(_0x1430d9,_0x4c5a0b[_0xf629('0x61')],_0x41b405);})[_0xf629('0x26')](function(_0x16223a){_0x29ec8f=_0x16223a;return getEndUser(_0x1430d9,_0x27b5c1,_0xb19130[_0xf629('0x62')],_0xb19130[_0xf629('0x63')],_0x41b405);})['then'](function(_0x43ed3c){_0x71e34b=_0x43ed3c;return getTicket(_0x1430d9,_0x29ec8f,_0x71e34b,_0x27b5c1,_0xb19130,_0x27b5c1[_0xf629('0x64')],_0x41b405,_0xf629('0x5a'));})[_0xf629('0x26')](function(_0x4acf30){_0x475f16=_0x4acf30;logger[_0xf629('0x1f')](_0xf629('0x65'),_0x475f16['id']);logger['info'](_0xf629('0x66'),_0x475f16['id'],_0x4c5a0b[_0xf629('0x54')],_0x1430d9['type']);switch(_0x1430d9[_0xf629('0x4d')]){case _0xf629('0x67'):emit(util['format'](_0xf629('0x68'),_0x4c5a0b[_0xf629('0x54')]),_0xf629('0x69'),{'recordId':_0x475f16['id']});break;case'newTab':emit(util[_0xf629('0x4a')](_0xf629('0x68'),_0x4c5a0b[_0xf629('0x54')]),_0xf629('0x6a'),{'uri':util[_0xf629('0x4a')](_0xf629('0x6b'),_0x41b405[_0xf629('0x6c')],_0x475f16['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2db169){logger[_0xf629('0x6d')]('[QUEUE]',_0x2db169);});};exports[_0xf629('0x6e')]=function(_0x4e78da,_0x5044d3,_0x3d09a2,_0xe83136,_0x57f3c3,_0xf24d22,_0x356d24){var _0xc0dfb1,_0x1dc070,_0x361ac5,_0x187e32;_0xf24d22[_0xf629('0x5b')]=intUtil['stripTrailingSlash'](_0xf24d22[_0xf629('0x5b')]);_0xf24d22[_0xf629('0x57')]=intUtil[_0xf629('0x6f')](_0xf24d22[_0xf629('0x57')]);if(_0x356d24&&_0x356d24['recordingFormat']&&_0x356d24[_0xf629('0x70')]!=='none'){logger[_0xf629('0x1f')](_0xf629('0x71'),_0xf629('0x5d'));_0x5044d3['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf24d22[_0xf629('0x5b')],_0x5044d3['uniqueid'],md5(_0x5044d3[_0xf629('0x60')]));}return getConnection(_0xf24d22)[_0xf629('0x26')](function(_0x4fa566){_0x187e32=_0x4fa566;return getUser(_0xf24d22,_0xe83136['email'],_0x187e32);})['then'](function(_0x113a6f){_0xc0dfb1=_0x113a6f;return getEndUser(_0xf24d22,_0x3d09a2,_0x5044d3[_0xf629('0x72')],_0x5044d3['destcalleridnum'],_0x187e32);})[_0xf629('0x26')](function(_0xfe6022){_0x1dc070=_0xfe6022;return getTicket(_0xf24d22,_0xc0dfb1,_0x1dc070,_0x3d09a2,_0x5044d3,_0x3d09a2['Fields'],_0x187e32,_0xf629('0x6e'));})[_0xf629('0x26')](function(_0xdb2c2b){_0x361ac5=_0xdb2c2b;logger[_0xf629('0x1f')](_0xf629('0x73'),_0x361ac5['id']);logger['info'](_0xf629('0x74'),_0x361ac5['id'],_0xe83136[_0xf629('0x54')],_0xf24d22[_0xf629('0x4d')]);switch(_0xf24d22[_0xf629('0x4d')]){case _0xf629('0x67'):emit(util[_0xf629('0x4a')](_0xf629('0x68'),_0xe83136[_0xf629('0x54')]),_0xf629('0x69'),{'recordId':_0x361ac5['id']});break;case _0xf629('0x75'):emit(util[_0xf629('0x4a')](_0xf629('0x68'),_0xe83136[_0xf629('0x54')]),'trigger:browser:url',{'uri':util[_0xf629('0x4a')](_0xf629('0x6b'),_0x187e32[_0xf629('0x6c')],_0x361ac5['id'])});break;default:logger[_0xf629('0x6d')](_0xf629('0x71'),_0xf629('0x76'));}})[_0xf629('0x77')](function(_0x495a5c){logger[_0xf629('0x6d')](_0xf629('0x71'),_0x495a5c);});};exports[_0xf629('0x78')]=function(_0x51e39a,_0x5db949,_0x449110,_0x57af2b,_0x2b8250,_0x52ce89){var _0x3defed,_0x247764,_0x1e1f63,_0x5ec695;_0x52ce89[_0xf629('0x5b')]=intUtil['stripTrailingSlash'](_0x52ce89[_0xf629('0x5b')]);_0x52ce89['remoteUri']=intUtil[_0xf629('0x6f')](_0x52ce89[_0xf629('0x57')]);if(_0x2b8250&&_0x2b8250['monitor_format']){logger[_0xf629('0x1f')]('['+_0x5db949[_0xf629('0x79')][_0xf629('0x7a')]()+']',_0xf629('0x5d'));_0x5db949[_0xf629('0x5e')]=util['format'](_0xf629('0x5f'),_0x52ce89[_0xf629('0x5b')],_0x5db949['uniqueid'],md5(_0x5db949[_0xf629('0x60')]));}else{_0x5db949[_0xf629('0x5e')]='';}return getConnection(_0x52ce89)[_0xf629('0x26')](function(_0x5d83b1){_0x5ec695=_0x5d83b1;if(!_[_0xf629('0x7b')](_0x57af2b)){return getUser(_0x52ce89,_0x57af2b[_0xf629('0x54')],_0x5ec695);}else{return getUser(_0x52ce89,null,_0x5ec695);}})[_0xf629('0x26')](function(_0x39cf07){_0x3defed=_0x39cf07;return getEndUser(_0x52ce89,_0x449110,_0x5db949[_0xf629('0x62')],_0x5db949[_0xf629('0x63')],_0x5ec695);})[_0xf629('0x26')](function(_0xc036cc){_0x247764=_0xc036cc;return getTicket(_0x52ce89,_0x3defed,_0x247764,_0x449110,_0x5db949,_0x449110[_0xf629('0x64')],_0x5ec695);})[_0xf629('0x26')](function(_0x1c5d25){_0x1e1f63=_0x1c5d25;logger['info']('['+_0x5db949['lastevent'][_0xf629('0x7a')]()+_0xf629('0x7c'),_0x1e1f63['id']);logger[_0xf629('0x1f')]('['+_0x5db949[_0xf629('0x79')][_0xf629('0x7a')]()+_0xf629('0x7d'),_0x52ce89[_0xf629('0x4d')]);})[_0xf629('0x77')](function(_0xcd6530){logger[_0xf629('0x6d')]('['+_0x5db949['lastevent'][_0xf629('0x7a')]()+']',_0xcd6530);});}; \ No newline at end of file +var _0xfe5a=['Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','leadId','isNil','sobject','find','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','additionalSearchAccount','Lead','account','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Company','No\x20Company','upperFirst','create','forEach','includes','string','content','toString','variable','idField','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login'];(function(_0x59d0ec,_0x533047){var _0xe9de40=function(_0x43e392){while(--_0x43e392){_0x59d0ec['push'](_0x59d0ec['shift']());}};_0xe9de40(++_0x533047);}(_0xfe5a,0x1a0));var _0xafe5=function(_0x3f1b81,_0x4fb0f7){_0x3f1b81=_0x3f1b81-0x0;var _0x170d5e=_0xfe5a[_0x3f1b81];return _0x170d5e;};'use strict';var _=require(_0xafe5('0x0'));var rp=require(_0xafe5('0x1'));var moment=require(_0xafe5('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xafe5('0x3'));var util=require(_0xafe5('0x4'));var Redis=require(_0xafe5('0x5'));var intUtil=require(_0xafe5('0x6'));var config=require('../../../../config/environment');var logger=require(_0xafe5('0x7'))(_0xafe5('0x8'));config[_0xafe5('0x9')]=_[_0xafe5('0xa')](config[_0xafe5('0x9')],{'host':_0xafe5('0xb'),'port':0x18eb});var io=require(_0xafe5('0xc'))(new Redis(config[_0xafe5('0x9')]));function emit(_0x433df8,_0x6545ea,_0x49b714){io['to'](_0x433df8)[_0xafe5('0xd')](_0x6545ea,_0x49b714);}function getTicket(_0x55abd8,_0xdcfffb,_0x33b425,_0x2da9e2,_0x26d3bb,_0x508225,_0x396960,_0x3473a2){var _0xe1c7c3=Object[_0xafe5('0xe')]({},{'OwnerId':_0xdcfffb['id'],'Subject':intUtil[_0xafe5('0xf')](_0x2da9e2['Subjects'],_0x26d3bb,'\x20'),'Description':intUtil[_0xafe5('0xf')](_0x2da9e2['Descriptions'],_0x26d3bb,'\x0a')},getCustomFields(_0x508225,_0x26d3bb));if(_0x33b425){if(_0x2da9e2[_0xafe5('0x10')]===_0xafe5('0x11')){_0xe1c7c3['ActivityDate']=moment['utc']();_0xe1c7c3[_0xafe5('0x12')]=![];_0xe1c7c3[_0xafe5('0x13')]=![];if(_0x33b425[_0xafe5('0x14')]===_0xafe5('0x15')||_0x33b425[_0xafe5('0x14')]===_0xafe5('0x16')){_0xe1c7c3[_0xafe5('0x17')]=_0x33b425['id'];}else if(_0x33b425['endUserType']==='account'){_0xe1c7c3[_0xafe5('0x18')]=_0x33b425['id'];}}else if(_0x2da9e2['ticketType']===_0xafe5('0x19')){if(_0x33b425['endUserType']===_0xafe5('0x15')){_0xe1c7c3[_0xafe5('0x1a')]=_0x33b425['id'];}else if(_0x33b425[_0xafe5('0x14')]==='account'){_0xe1c7c3['AccountId']=_0x33b425['id'];}else if(_0x33b425[_0xafe5('0x14')]===_0xafe5('0x16')&&_0x2da9e2[_0xafe5('0x1b')]){_0xe1c7c3[_0x2da9e2[_0xafe5('0x1b')]]=_0x33b425['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x396960['sobject'](_0x2da9e2[_0xafe5('0x10')])['create'](_0xe1c7c3);}function getUser(_0xf84f1d,_0x13520c,_0x42ba0a){if(!_[_0xafe5('0x1c')](_0x13520c)&&intUtil['validateEmail'](_0x13520c)){var _0x286b0e={'Email':_0x13520c};var _0x18cddf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x42ba0a[_0xafe5('0x1d')]('User')[_0xafe5('0x1e')](_0x286b0e,_0x18cddf)['execute']()[_0xafe5('0x1f')](function(_0x5c2f6a){if(_0x5c2f6a[_0xafe5('0x20')]){var _0x48cab5=_[_0xafe5('0x1e')](_0x5c2f6a,function(_0x1347c2){return _0x1347c2[_0xafe5('0x21')]===_0x13520c;});if(_0x48cab5){logger[_0xafe5('0x22')](_0xafe5('0x23'),_0x13520c);return BPromise[_0xafe5('0x24')]({'id':_0x48cab5['Id'],'name':_0x48cab5[_0xafe5('0x25')]});}}else{logger[_0xafe5('0x22')](_0xafe5('0x26'),_0x13520c);return _0x42ba0a[_0xafe5('0x27')]()[_0xafe5('0x1f')](function(_0x4ece0c){return BPromise[_0xafe5('0x24')]({'id':_0x4ece0c[_0xafe5('0x28')],'name':_0x4ece0c[_0xafe5('0x29')]});});}});}else{logger[_0xafe5('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x13520c);return _0x42ba0a[_0xafe5('0x27')]()[_0xafe5('0x1f')](function(_0x1e070c){return BPromise[_0xafe5('0x24')]({'id':_0x1e070c['user_id'],'name':_0x1e070c['display_name']});});}}function getEndUser(_0x2af6e4,_0xf8330e,_0x11087a,_0x56f329,_0x5cbf7d){var _0x5b4749={'$or':{'Phone':_0x56f329}};var _0x529c88={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xafe5('0x24')]()[_0xafe5('0x1f')](function(){logger[_0xafe5('0x22')](_0xafe5('0x2a'),_0x56f329,_0xf8330e['moduleSearch']);switch(_0xf8330e[_0xafe5('0x2b')]){case'contact_lead':var _0xfd0b77=_[_0xafe5('0x2c')](_0x5b4749);if(_0xf8330e[_0xafe5('0x2d')]){var _0xe5af08={};_0xe5af08[_0xf8330e[_0xafe5('0x2d')]]=_0x56f329;_[_0xafe5('0x2e')](_0xfd0b77[_0xafe5('0x2f')],_0xe5af08);}return _0x5cbf7d[_0xafe5('0x1d')](_0xafe5('0x30'))[_0xafe5('0x1e')](_0xfd0b77,_0x529c88)[_0xafe5('0x31')]()[_0xafe5('0x1f')](function(_0x1c1c25){if(_0x1c1c25&&_0x1c1c25['length']){return _0x1c1c25;}else{var _0x26a277=_[_0xafe5('0x2c')](_0x5b4749);if(_0xf8330e['additionalSearchLead']){var _0x5a3fbf={};_0x5a3fbf[_0xf8330e[_0xafe5('0x32')]]=_0x56f329;_[_0xafe5('0x2e')](_0x26a277[_0xafe5('0x2f')],_0x5a3fbf);}return _0x5cbf7d[_0xafe5('0x1d')]('Lead')[_0xafe5('0x1e')](_0x26a277,_0x529c88);}});case'account_contact_lead':var _0x497be9=_['cloneDeep'](_0x5b4749);if(_0xf8330e[_0xafe5('0x33')]){var _0xe5af08={};_0xe5af08[_0xf8330e[_0xafe5('0x33')]]=_0x56f329;_[_0xafe5('0x2e')](_0x497be9[_0xafe5('0x2f')],_0xe5af08);}return _0x5cbf7d[_0xafe5('0x1d')]('Account')[_0xafe5('0x1e')](_0x497be9,_0x529c88)[_0xafe5('0x31')]()[_0xafe5('0x1f')](function(_0x4cccfb){if(_0x4cccfb&&_0x4cccfb[_0xafe5('0x20')]){return _0x4cccfb;}else{var _0x2bbc56=_[_0xafe5('0x2c')](_0x5b4749);if(_0xf8330e[_0xafe5('0x2d')]){var _0xf15c9b={};_0xf15c9b[_0xf8330e[_0xafe5('0x2d')]]=_0x56f329;_[_0xafe5('0x2e')](_0x2bbc56[_0xafe5('0x2f')],_0xf15c9b);}return _0x5cbf7d['sobject']('Contact')[_0xafe5('0x1e')](_0x2bbc56,_0x529c88)[_0xafe5('0x1f')](function(_0x2201ad){if(_0x2201ad&&_0x2201ad[_0xafe5('0x20')]){return _0x2201ad;}else{var _0x5c7540=_['cloneDeep'](_0x5b4749);if(_0xf8330e['additionalSearchLead']){var _0x4b326f={};_0x4b326f[_0xf8330e['additionalSearchLead']]=_0x56f329;_[_0xafe5('0x2e')](_0x5c7540[_0xafe5('0x2f')],_0x4b326f);}return _0x5cbf7d['sobject'](_0xafe5('0x34'))[_0xafe5('0x1e')](_0x5c7540,_0x529c88);}});}});case _0xafe5('0x15'):var _0xfd0b77=_[_0xafe5('0x2c')](_0x5b4749);if(_0xf8330e[_0xafe5('0x2d')]){var _0xe5af08={};_0xe5af08[_0xf8330e[_0xafe5('0x2d')]]=_0x56f329;_['merge'](_0xfd0b77[_0xafe5('0x2f')],_0xe5af08);}return _0x5cbf7d[_0xafe5('0x1d')]('Contact')[_0xafe5('0x1e')](_0xfd0b77,_0x529c88)[_0xafe5('0x31')]();case'lead':var _0x376baa=_['cloneDeep'](_0x5b4749);if(_0xf8330e[_0xafe5('0x32')]){var _0xe5af08={};_0xe5af08[_0xf8330e[_0xafe5('0x32')]]=_0x56f329;_[_0xafe5('0x2e')](_0x376baa[_0xafe5('0x2f')],_0xe5af08);}return _0x5cbf7d['sobject']('Lead')[_0xafe5('0x1e')](_0x376baa,_0x529c88);case _0xafe5('0x35'):var _0x497be9=_[_0xafe5('0x2c')](_0x5b4749);if(_0xf8330e['additionalSearchAccount']){var _0xe5af08={};_0xe5af08[_0xf8330e['additionalSearchAccount']]=_0x56f329;_[_0xafe5('0x2e')](_0x497be9[_0xafe5('0x2f')],_0xe5af08);}return _0x5cbf7d[_0xafe5('0x1d')](_0xafe5('0x36'))[_0xafe5('0x1e')](_0x497be9,_0x529c88);default:return null;}})[_0xafe5('0x1f')](function(_0x2ee99d){if(_0x2ee99d&&_0x2ee99d['length']){var _0x5223ec=_[_0xafe5('0x37')](_0x2ee99d);if(_0x5223ec){return BPromise[_0xafe5('0x24')]({'id':_0x5223ec['Id'],'name':_0x5223ec['Name'],'phone':_0x5223ec[_0xafe5('0x38')],'endUserType':_0x5223ec[_0xafe5('0x39')][_0xafe5('0x3a')][_0xafe5('0x3b')]()});}}})['then'](function(_0x456ee1){if(_0x456ee1){logger[_0xafe5('0x22')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x456ee1['endUserType'],_0x56f329);return BPromise['resolve'](_0x456ee1);}else{logger['info'](_0xafe5('0x3c'),_0x56f329);var _0x542c75={'Phone':_0x56f329};if(_0xf8330e[_0xafe5('0x3d')]){if(_0xf8330e[_0xafe5('0x3d')]===_0xafe5('0x15')){logger[_0xafe5('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x56f329,_0xf8330e['moduleCreate']);_0x542c75[_0xafe5('0x3e')]=_0x11087a!==''?_0x11087a:util['format'](_0xafe5('0x3f'),_0x56f329);}else if(_0xf8330e['moduleCreate']===_0xafe5('0x16')){logger[_0xafe5('0x22')](_0xafe5('0x40'),_0x56f329,_0xf8330e[_0xafe5('0x3d')]);_0x542c75[_0xafe5('0x3e')]=_0x11087a!==_0xafe5('0x41')?_0x11087a:util[_0xafe5('0x42')]('Caller\x20-\x20%s',_0x56f329);_0x542c75[_0xafe5('0x43')]=_0xafe5('0x44');}else if(_0xf8330e[_0xafe5('0x3d')]==='account'){logger[_0xafe5('0x22')](_0xafe5('0x40'),_0x56f329,_0xf8330e[_0xafe5('0x3d')]);_0x542c75[_0xafe5('0x25')]=_0x11087a!==''?_0x11087a:util[_0xafe5('0x42')](_0xafe5('0x3f'),_0x56f329);}else{return null;}}return _0x5cbf7d[_0xafe5('0x1d')](_[_0xafe5('0x45')](_0xf8330e[_0xafe5('0x3d')]))[_0xafe5('0x46')](_0x542c75)['then'](function(_0x51d3e7){return BPromise[_0xafe5('0x24')]({'id':_0x51d3e7['id'],'endUserType':_0xf8330e[_0xafe5('0x3d')]});});}});}function getCustomFields(_0x2acc21,_0x2faa4b){var _0x1d3dfb={};if(_0x2acc21[_0xafe5('0x20')]>0x0){_[_0xafe5('0x47')](_0x2acc21,function(_0x3ecce7){if(_[_0xafe5('0x48')]([_0xafe5('0x49'),'picklist'],_0x3ecce7['type'])&&_0x3ecce7['idField']){_0x1d3dfb[_0x3ecce7['idField']]=_0x3ecce7[_0xafe5('0x4a')][_0xafe5('0x4b')]();}else if(_0x3ecce7[_0xafe5('0x3a')]===_0xafe5('0x4c')&&_0x3ecce7['variableName']&&_0x3ecce7[_0xafe5('0x4d')]){_0x2faa4b[_0x3ecce7['variableName']]&&(_0x1d3dfb[_0x3ecce7[_0xafe5('0x4d')]]=_0x2faa4b[_0x3ecce7['variableName']]['toString']());}else if(_0x3ecce7[_0xafe5('0x3a')]===_0xafe5('0x4e')&&_0x3ecce7[_0xafe5('0x4f')]&&_0x3ecce7[_0xafe5('0x4f')][_0xafe5('0x50')]&&_0x3ecce7['idField']){_0x2faa4b[_0x3ecce7[_0xafe5('0x4f')][_0xafe5('0x50')][_0xafe5('0x3b')]()]&&(_0x1d3dfb[_0x3ecce7[_0xafe5('0x4d')]]=_0x2faa4b[_0x3ecce7[_0xafe5('0x4f')][_0xafe5('0x50')][_0xafe5('0x3b')]()]['toString']());}});}return _0x1d3dfb;}function getConnection(_0x3c73f3){var _0x480092=_0x3c73f3['password'][_0xafe5('0x51')](_0x3c73f3[_0xafe5('0x52')]);var _0x431c33=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3c73f3[_0xafe5('0x53')]||_0xafe5('0x54'),'clientId':_0x3c73f3[_0xafe5('0x55')],'clientSecret':_0x3c73f3[_0xafe5('0x56')]}});return _0x431c33[_0xafe5('0x57')](_0x3c73f3['username'],_0x480092)[_0xafe5('0x1f')](function(){logger['info'](_0xafe5('0x58'));return _0x431c33;});}exports['queue']=function(_0x4a3a5b,_0x1ce7a3,_0x56e13d,_0x15c01f,_0x51f390,_0x2c4e01){var _0x351526,_0x1b8b98,_0x11e957,_0x34a2bf;_0x2c4e01[_0xafe5('0x59')]=intUtil['stripTrailingSlash'](_0x2c4e01[_0xafe5('0x59')]);_0x2c4e01['remoteUri']=intUtil[_0xafe5('0x5a')](_0x2c4e01[_0xafe5('0x53')]);if(_0x51f390&&_0x51f390[_0xafe5('0x5b')]){logger[_0xafe5('0x22')](_0xafe5('0x5c'),_0xafe5('0x5d'));_0x1ce7a3[_0xafe5('0x5e')]=util[_0xafe5('0x42')](_0xafe5('0x5f'),_0x2c4e01[_0xafe5('0x59')],_0x1ce7a3[_0xafe5('0x60')],md5(_0x1ce7a3[_0xafe5('0x60')]));}else{_0x1ce7a3[_0xafe5('0x5e')]='';}return getConnection(_0x2c4e01)[_0xafe5('0x1f')](function(_0x4d9042){_0x34a2bf=_0x4d9042;return getUser(_0x2c4e01,_0x15c01f['email'],_0x34a2bf);})['then'](function(_0x241239){_0x351526=_0x241239;return getEndUser(_0x2c4e01,_0x56e13d,_0x1ce7a3['calleridname'],_0x1ce7a3[_0xafe5('0x61')],_0x34a2bf);})['then'](function(_0x35213f){_0x1b8b98=_0x35213f;return getTicket(_0x2c4e01,_0x351526,_0x1b8b98,_0x56e13d,_0x1ce7a3,_0x56e13d[_0xafe5('0x62')],_0x34a2bf,_0xafe5('0x63'));})[_0xafe5('0x1f')](function(_0x57cee0){_0x11e957=_0x57cee0;logger[_0xafe5('0x22')](_0xafe5('0x64'),_0x11e957['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x11e957['id'],_0x15c01f[_0xafe5('0x50')],_0x2c4e01[_0xafe5('0x3a')]);switch(_0x2c4e01[_0xafe5('0x3a')]){case _0xafe5('0x65'):emit(util['format']('user:%s',_0x15c01f[_0xafe5('0x50')]),_0xafe5('0x66'),{'recordId':_0x11e957['id']});break;case _0xafe5('0x67'):emit(util[_0xafe5('0x42')](_0xafe5('0x68'),_0x15c01f['name']),_0xafe5('0x69'),{'uri':util[_0xafe5('0x42')](_0xafe5('0x6a'),_0x34a2bf[_0xafe5('0x6b')],_0x11e957['id'])});break;default:logger[_0xafe5('0x6c')](_0xafe5('0x6d'));}})[_0xafe5('0x6e')](function(_0x2dc2f3){logger[_0xafe5('0x6c')](_0xafe5('0x5c'),_0x2dc2f3);});};exports[_0xafe5('0x6f')]=function(_0x1ae985,_0x492ea8,_0x134363,_0x103b9d,_0x24e386,_0x75553d,_0x5e4ecc){var _0x2a3ef3,_0x1813ed,_0x4679fc,_0x1f7ccc;_0x75553d[_0xafe5('0x59')]=intUtil[_0xafe5('0x5a')](_0x75553d[_0xafe5('0x59')]);_0x75553d['remoteUri']=intUtil[_0xafe5('0x5a')](_0x75553d[_0xafe5('0x53')]);if(_0x5e4ecc&&_0x5e4ecc['recordingFormat']&&_0x5e4ecc['recordingFormat']!==_0xafe5('0x70')){logger[_0xafe5('0x22')](_0xafe5('0x71'),_0xafe5('0x5d'));_0x492ea8[_0xafe5('0x5e')]=util[_0xafe5('0x42')](_0xafe5('0x5f'),_0x75553d[_0xafe5('0x59')],_0x492ea8[_0xafe5('0x60')],md5(_0x492ea8[_0xafe5('0x60')]));}return getConnection(_0x75553d)[_0xafe5('0x1f')](function(_0x56e5ce){_0x1f7ccc=_0x56e5ce;return getUser(_0x75553d,_0x103b9d[_0xafe5('0x72')],_0x1f7ccc);})['then'](function(_0x376c07){_0x2a3ef3=_0x376c07;return getEndUser(_0x75553d,_0x134363,_0x492ea8[_0xafe5('0x73')],_0x492ea8[_0xafe5('0x74')],_0x1f7ccc);})[_0xafe5('0x1f')](function(_0x37d681){_0x1813ed=_0x37d681;return getTicket(_0x75553d,_0x2a3ef3,_0x1813ed,_0x134363,_0x492ea8,_0x134363[_0xafe5('0x62')],_0x1f7ccc,_0xafe5('0x6f'));})[_0xafe5('0x1f')](function(_0x285773){_0x4679fc=_0x285773;logger[_0xafe5('0x22')](_0xafe5('0x75'),_0x4679fc['id']);logger[_0xafe5('0x22')](_0xafe5('0x76'),_0x4679fc['id'],_0x103b9d['name'],_0x75553d[_0xafe5('0x3a')]);switch(_0x75553d[_0xafe5('0x3a')]){case _0xafe5('0x65'):emit(util[_0xafe5('0x42')](_0xafe5('0x68'),_0x103b9d['name']),_0xafe5('0x66'),{'recordId':_0x4679fc['id']});break;case'newTab':emit(util['format']('user:%s',_0x103b9d['name']),'trigger:browser:url',{'uri':util[_0xafe5('0x42')]('%s/%s/e',_0x1f7ccc[_0xafe5('0x6b')],_0x4679fc['id'])});break;default:logger[_0xafe5('0x6c')](_0xafe5('0x71'),_0xafe5('0x77'));}})[_0xafe5('0x6e')](function(_0x4f79fa){logger['error'](_0xafe5('0x71'),_0x4f79fa);});};exports[_0xafe5('0x78')]=function(_0x2dbccd,_0x38775d,_0x3beb21,_0x1b5607,_0x1de4af,_0x344d17){var _0x481ac8,_0x95a0e5,_0x4431c2,_0x102b8b;_0x344d17[_0xafe5('0x59')]=intUtil['stripTrailingSlash'](_0x344d17['serverUrl']);_0x344d17[_0xafe5('0x53')]=intUtil[_0xafe5('0x5a')](_0x344d17['remoteUri']);if(_0x1de4af&&_0x1de4af[_0xafe5('0x5b')]){logger['info']('['+_0x38775d['lastevent'][_0xafe5('0x79')]()+']',_0xafe5('0x5d'));_0x38775d[_0xafe5('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x344d17[_0xafe5('0x59')],_0x38775d[_0xafe5('0x60')],md5(_0x38775d[_0xafe5('0x60')]));}else{_0x38775d[_0xafe5('0x5e')]='';}return getConnection(_0x344d17)['then'](function(_0x22f9fb){_0x102b8b=_0x22f9fb;if(!_['isNil'](_0x1b5607)){return getUser(_0x344d17,_0x1b5607[_0xafe5('0x50')],_0x102b8b);}else{return getUser(_0x344d17,null,_0x102b8b);}})['then'](function(_0x5cd9b3){_0x481ac8=_0x5cd9b3;return getEndUser(_0x344d17,_0x3beb21,_0x38775d[_0xafe5('0x7a')],_0x38775d['calleridnum'],_0x102b8b);})[_0xafe5('0x1f')](function(_0x4df0eb){_0x95a0e5=_0x4df0eb;return getTicket(_0x344d17,_0x481ac8,_0x95a0e5,_0x3beb21,_0x38775d,_0x3beb21[_0xafe5('0x62')],_0x102b8b);})[_0xafe5('0x1f')](function(_0x56a074){_0x4431c2=_0x56a074;logger[_0xafe5('0x22')]('['+_0x38775d['lastevent']['toUpperCase']()+_0xafe5('0x7b'),_0x4431c2['id']);logger[_0xafe5('0x22')]('['+_0x38775d[_0xafe5('0x7c')][_0xafe5('0x79')]()+_0xafe5('0x7d'),_0x344d17[_0xafe5('0x3a')]);})['catch'](function(_0x287dbc){logger[_0xafe5('0x6c')]('['+_0x38775d[_0xafe5('0x7c')][_0xafe5('0x79')]()+']',_0x287dbc);});}; \ 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 6b50637..b85af0f 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 _0x7ed5=['sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','queue','outbound','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','picklist','type','nameField','customField','content','toString','includes','string','variable','idField','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','incident','true','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1'];(function(_0xb00710,_0x4d7d03){var _0x3980c0=function(_0x11addf){while(--_0x11addf){_0xb00710['push'](_0xb00710['shift']());}};_0x3980c0(++_0x4d7d03);}(_0x7ed5,0x87));var _0x57ed=function(_0x101ccc,_0x34c9ce){_0x101ccc=_0x101ccc-0x0;var _0x230ee4=_0x7ed5[_0x101ccc];return _0x230ee4;};'use strict';var _=require(_0x57ed('0x0'));var Promise=require(_0x57ed('0x1'));var rp=require(_0x57ed('0x2'));var util=require(_0x57ed('0x3'));var md5=require(_0x57ed('0x4'));var Redis=require(_0x57ed('0x5'));var intUtil=require(_0x57ed('0x6'));var config=require(_0x57ed('0x7'));var logger=require('../../../../config/logger')(_0x57ed('0x8'));config[_0x57ed('0x9')]=_[_0x57ed('0xa')](config[_0x57ed('0x9')],{'host':_0x57ed('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x230317,_0x4f67c7,_0x3fbdc9,_0x3cf1a7,_0x4d6216,_0x1cbc31){return new Promise(function(_0x959227,_0x44c2e7){var _0x51d0d3={'method':'GET','uri':_0x3cf1a7+_0x57ed('0xc')+'&'+_0x4d6216+'&'+_0x1cbc31,'auth':_0x4f67c7,'json':!![]};return rp(_0x51d0d3)['then'](function(_0x587fc4){if(_0x587fc4[_0x57ed('0xd')][_0x57ed('0xe')]>0x0){_0x3fbdc9[_0x57ed('0xf')]=_0x587fc4[_0x57ed('0xd')][0x0][_0x57ed('0x10')];}logger[_0x57ed('0x11')]('['+[_0x230317[_0x57ed('0x12')]()]+_0x57ed('0x13'),_0x3fbdc9);_0x959227(_0x3fbdc9);})[_0x57ed('0x14')](function(_0x42d5b7){logger[_0x57ed('0x15')]('['+[_0x230317[_0x57ed('0x12')]()]+']',_0x42d5b7['message']);_0x44c2e7(_0x42d5b7[_0x57ed('0x16')]);});});}function getUser(_0x44c86e,_0x1fa553,_0x1f3705,_0x12e763,_0xf4fdc4){return function(_0x2a039d){logger['info']('['+[_0x44c86e[_0x57ed('0x12')]()]+_0x57ed('0x17'),_0x2a039d);return new Promise(function(_0x256d4d,_0xb20117){if(intUtil[_0x57ed('0x18')](_0x2a039d[_0x57ed('0x19')])){var _0x1698ba={'method':_0x57ed('0x1a'),'uri':_0x1f3705+_0x57ed('0x1b')+_0x2a039d[_0x57ed('0x19')]+'&'+_0x12e763+'&'+_0xf4fdc4,'auth':_0x1fa553,'json':!![]};logger[_0x57ed('0x11')]('['+[_0x44c86e[_0x57ed('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x1698ba);return rp(_0x1698ba)[_0x57ed('0x1c')](function(_0x44392f){logger[_0x57ed('0x11')]('['+[_0x44c86e['toUpperCase']()]+_0x57ed('0x1d'),_0x44392f);if(_0x44392f[_0x57ed('0xd')][_0x57ed('0xe')]>0x0&&String(_0x44392f['result'][0x0][_0x57ed('0x1e')])==='true'){_0x2a039d[_0x57ed('0x1f')]=_0x44392f[_0x57ed('0xd')][0x0][_0x57ed('0x10')];}else{_0x2a039d[_0x57ed('0x1f')]=_0x2a039d[_0x57ed('0xf')];_0x2a039d['userEmail']=_0x2a039d['adminEmail'];}logger[_0x57ed('0x11')]('['+[_0x44c86e['toUpperCase']()]+_0x57ed('0x20'),_0x2a039d);_0x256d4d(_0x2a039d);})['catch'](function(_0x583068){logger[_0x57ed('0x15')]('['+[_0x44c86e[_0x57ed('0x12')]()]+']',_0x583068[_0x57ed('0x16')]);_0xb20117(_0x583068[_0x57ed('0x16')]);});}else{logger['info']('['+[_0x44c86e['toUpperCase']()]+_0x57ed('0x21'));_0x2a039d[_0x57ed('0x1f')]=_0x2a039d[_0x57ed('0xf')];_0x2a039d['userEmail']=_0x2a039d['adminEmail'];_0x256d4d(_0x2a039d);}});};}function createEndUser(_0x79d636,_0x3cee2f,_0x137482,_0x24d623,_0x520b9d){logger[_0x57ed('0x11')]('['+[_0x79d636[_0x57ed('0x12')]()]+_0x57ed('0x22'),_0x137482);return new Promise(function(_0x4b4495,_0x3c06fa){var _0x396fbd={'method':_0x57ed('0x23'),'uri':_0x24d623+_0x57ed('0x24')+_0x520b9d,'body':{'user_name':_0x137482[_0x57ed('0x25')],'roles':_0x57ed('0x26'),'first_name':_0x137482[_0x57ed('0x25')],'active':'true','date_format':_0x57ed('0x27'),'phone':_0x137482[_0x57ed('0x25')]},'auth':_0x3cee2f,'json':!![]};return rp(_0x396fbd)['then'](function(_0x10b262){logger[_0x57ed('0x11')]('['+[_0x79d636[_0x57ed('0x12')]()]+'],\x20EndUser\x20schema',_0x10b262[_0x57ed('0xd')]);_0x137482[_0x57ed('0x28')]=_0x10b262[_0x57ed('0xd')][_0x57ed('0x10')];_0x4b4495(_0x137482);})[_0x57ed('0x14')](function(_0x12b61b){logger[_0x57ed('0x15')]('['+[_0x79d636[_0x57ed('0x12')]()]+']',_0x12b61b[_0x57ed('0x16')]);_0x3c06fa(_0x12b61b[_0x57ed('0x16')]);});});}function getEndUser(_0x46eb62,_0x285dd5,_0xf26b1d,_0x4656a7,_0x579666){return function(_0x58f7ab){logger[_0x57ed('0x11')]('['+[_0x46eb62[_0x57ed('0x12')]()]+_0x57ed('0x29'),_0x58f7ab);return new Promise(function(_0x4bebd9,_0x3df7e0){var _0x428b58={'method':'GET','uri':_0xf26b1d+_0x57ed('0x2a')+_0x58f7ab['endUserNumber']+'&'+_0x4656a7+'&'+_0x579666,'auth':_0x285dd5,'json':!![]};return rp(_0x428b58)[_0x57ed('0x1c')](function(_0x3ae207){if(_0x3ae207['result']['length']>0x0){_0x58f7ab['endUserId']=_0x3ae207['result'][0x0][_0x57ed('0x10')];logger[_0x57ed('0x11')]('['+[_0x46eb62[_0x57ed('0x12')]()]+_0x57ed('0x2b'),_0x58f7ab);_0x4bebd9(_0x58f7ab);}else{return createEndUser(_0x46eb62,_0x285dd5,_0x58f7ab,_0xf26b1d,_0x4656a7)[_0x57ed('0x1c')](function(_0x4eaa58){logger[_0x57ed('0x11')]('['+[_0x46eb62[_0x57ed('0x12')]()]+'],\x20createEndUser\x20crm',_0x4eaa58);_0x4bebd9(_0x4eaa58);});}})[_0x57ed('0x14')](function(_0x300f48){logger[_0x57ed('0x15')]('['+[_0x46eb62[_0x57ed('0x12')]()]+']',_0x300f48['message']);_0x3df7e0(_0x300f48['message']);});});};}function getCustomFields(_0x50223e,_0x460d40){var _0x1544f5={};if(_0x50223e[_0x57ed('0xe')]>0x0){_[_0x57ed('0x2c')](_0x50223e,function(_0x1c38a9){if(_['includes'](['string',_0x57ed('0x2d')],_0x1c38a9[_0x57ed('0x2e')])&&_0x1c38a9[_0x57ed('0x2f')]&&!_0x1c38a9[_0x57ed('0x30')]){_0x1544f5[_0x1c38a9[_0x57ed('0x2f')]['toLowerCase']()]=_0x1c38a9[_0x57ed('0x31')][_0x57ed('0x32')]();}else if(_[_0x57ed('0x33')]([_0x57ed('0x34'),_0x57ed('0x2d')],_0x1c38a9[_0x57ed('0x2e')])&&_0x1c38a9['idField']&&_0x1c38a9['customField']){_0x1544f5[_0x1c38a9['idField']['toLowerCase']()]=_0x1c38a9[_0x57ed('0x31')]['toString']();}else if(_0x1c38a9['type']===_0x57ed('0x35')&&_0x1c38a9['variableName']&&_0x1c38a9[_0x57ed('0x36')]&&_0x1c38a9['customField']){_0x1544f5[_0x1c38a9[_0x57ed('0x36')][_0x57ed('0x37')]()]=_0x460d40[_0x1c38a9['variableName']][_0x57ed('0x32')]();}else if(_0x1c38a9['type']==='customVariable'&&_0x1c38a9['Variable']&&_0x1c38a9[_0x57ed('0x38')]['name']&&_0x1c38a9[_0x57ed('0x36')]&&_0x1c38a9['customField']){_0x1544f5[_0x1c38a9[_0x57ed('0x36')][_0x57ed('0x37')]()]=_0x460d40[_0x1c38a9[_0x57ed('0x38')][_0x57ed('0x39')][_0x57ed('0x37')]()][_0x57ed('0x32')]();}});}return _0x1544f5;}function getTicket(_0x2a67fb,_0x1ffab8,_0x4056ad,_0x1f6b45,_0x462329,_0x4d71de){return function(_0xb04b69){logger['info']('['+[_0x2a67fb[_0x57ed('0x12')]()]+_0x57ed('0x3a'),_0xb04b69);return new Promise(function(_0x4ee507,_0x1f01db){var _0x4c3440=_0x2a67fb[_0x57ed('0x37')]()==='outbound'?_0xb04b69[_0x57ed('0x1f')]:_0xb04b69[_0x57ed('0x28')];var _0x385462={'method':'POST','uri':_0x4056ad+_0x57ed('0x3b')+'?'+_0x4d71de,'body':Object['assign']({},{'active':_0x57ed('0x3c'),'caller_id':_0x4c3440,'assigned_to':_0xb04b69[_0x57ed('0x1f')],'short_description':intUtil[_0x57ed('0x3d')](_0x1f6b45['Subjects'],_0x462329,'\x20'),'description':intUtil[_0x57ed('0x3d')](_0x1f6b45[_0x57ed('0x3e')],_0x462329,'\x0a')},getCustomFields(_0x1f6b45[_0x57ed('0x3f')],_0x462329)),'auth':_0x1ffab8,'json':!![]};return rp(_0x385462)[_0x57ed('0x1c')](function(_0x46a219){logger[_0x57ed('0x11')]('['+[_0x2a67fb['toUpperCase']()]+_0x57ed('0x40'),_0x46a219[_0x57ed('0xd')]);_0xb04b69['ticketId']=_0x46a219[_0x57ed('0xd')][_0x57ed('0x10')];_0xb04b69['ticketNumber']=_0x46a219[_0x57ed('0xd')][_0x57ed('0x41')];logger[_0x57ed('0x11')]('['+[_0x2a67fb['toUpperCase']()]+_0x57ed('0x42'),_0xb04b69);_0x4ee507(_0xb04b69);})[_0x57ed('0x14')](function(_0x5d3bd5){logger[_0x57ed('0x15')]('['+[_0x2a67fb['toUpperCase']()]+']',_0x5d3bd5['message']);_0x1f01db(_0x5d3bd5[_0x57ed('0x16')]);});});};}function createRemoteTag(_0x27a742,_0x32dd36,_0x5a486c,_0x1dcdff){return new Promise(function(_0x27d755,_0xa33c68){var _0x3d4e5d={'method':_0x57ed('0x23'),'uri':_0x5a486c+'label'+'?'+_0x1dcdff,'body':{'short_description':_0x27a742,'global':!![],'active':!![],'name':_0x27a742},'auth':_0x32dd36,'json':!![]};return rp(_0x3d4e5d)[_0x57ed('0x1c')](function(_0x2c31a0){var _0x15558f=_0x2c31a0['result']['sys_id'];_0x27d755(_0x15558f);});});}function getRemoteTag(_0x4dacc0,_0x20353c,_0x282196,_0x2c2875,_0x10297f){return new Promise(function(_0x1f96f0,_0x16289e){var _0x4ce409={'method':_0x57ed('0x1a'),'uri':_0x282196+_0x57ed('0x43')+_0x57ed('0x44')+_0x4dacc0+'&'+_0x2c2875,'auth':_0x20353c,'json':!![]};return rp(_0x4ce409)[_0x57ed('0x1c')](function(_0x534d40){if(_0x534d40[_0x57ed('0xd')][_0x57ed('0xe')]>0x0){var _0x3f717b=_0x534d40['result'][0x0]['sys_id'];_0x1f96f0(_0x3f717b);}else{return createRemoteTag(_0x4dacc0,_0x20353c,_0x282196,_0x2c2875)[_0x57ed('0x1c')](function(_0x57bb11){_0x1f96f0(_0x57bb11);});}});});}function assignTagToIncident(_0x5c7278,_0x5414bb,_0x2a3032,_0x4eb0ab,_0x49fb7e){return new Promise(function(_0x45e996,_0x5499a2){var _0x254505={'method':_0x57ed('0x23'),'uri':_0x2a3032+_0x57ed('0x45')+'?'+_0x49fb7e,'body':{'label':_0x5c7278,'table':'incident','id_type':_0x57ed('0x46'),'table_key':_0x4eb0ab[_0x57ed('0x47')],'title':_0x57ed('0x48')+_0x4eb0ab[_0x57ed('0x49')],'id_display':_0x4eb0ab[_0x57ed('0x49')]},'auth':_0x5414bb,'json':!![]};return rp(_0x254505)[_0x57ed('0x1c')](function(_0x1349ce){_0x45e996();})['catch'](function(){_0x45e996();});});}function manageTags(_0x32588e,_0x5ee5e0,_0x791060,_0x3269a2,_0x40a0a0,_0x771776,_0x2b120a){return new Promise(function(_0x1a2ed3,_0x53fc79){var _0x4c9999=[];_0x5ee5e0['forEach'](function(_0x467ecb){_0x4c9999[_0x57ed('0x4a')](getRemoteTag(_0x467ecb,_0x791060,_0x3269a2,_0x771776,_0x2b120a));});return Promise[_0x57ed('0x4b')](_0x4c9999)[_0x57ed('0x1c')](function(_0x27367d){if(_0x27367d[_0x57ed('0xe')]){logger[_0x57ed('0x11')]('['+[_0x32588e[_0x57ed('0x12')]()]+_0x57ed('0x4c'),_0x27367d);var _0xfc5f62=[];_0x27367d['forEach'](function(_0x545589){_0xfc5f62[_0x57ed('0x4a')](assignTagToIncident(_0x545589,_0x791060,_0x3269a2,_0x40a0a0,_0x771776));});return Promise['all'](_0xfc5f62)[_0x57ed('0x1c')](function(){_0x1a2ed3();})['catch'](function(){_0x1a2ed3();});}else{_0x1a2ed3();}});});}function getTags(_0x5bcc1e,_0x324a98,_0x4120ee,_0x2a0df6,_0x5ec587,_0x2fc5ee){return function(_0x44b126){return new Promise(function(_0x5c0ddf,_0x31a7de){var _0x19d32b=[];var _0x6ed249=_0x2a0df6[_0x57ed('0x4d')];if(_0x6ed249&&_0x6ed249['length']>0x0){_0x19d32b=_['map'](_0x6ed249,'name');}if(_0x19d32b[_0x57ed('0xe')]>0x0){return manageTags(_0x5bcc1e,_0x19d32b,_0x324a98,_0x4120ee,_0x44b126,_0x5ec587,_0x2fc5ee)['then'](function(){_0x5c0ddf(_0x44b126);});}else{_0x5c0ddf(_0x44b126);}});};}function emit(_0x2e764c,_0x2d3d61,_0x519a4b){var _0x111163=_0x57ed('0x4e')+_0x57ed('0x4f')+_0x57ed('0x50')+'%255EORDERBYDESCnumber';var _0x526b74={'uri':_0x2e764c+_0x57ed('0x51')+_0x519a4b+_0x111163};io['to'](util[_0x57ed('0x52')](_0x57ed('0x53'),_0x2d3d61))['emit'](_0x57ed('0x54'),_0x526b74);}exports['cs']=function(_0x272411,_0x3bd761,_0x371d0e,_0x46b1f9,_0x3c213c,_0x2e30eb,_0x49187a,_0x116cc9){var _0x5960be={};var _0x3dfa9c={'user':_0x2e30eb[_0x57ed('0x55')],'pass':_0x2e30eb['password']};var _0x2e80c3=_0x57ed('0x56');var _0x18c3cb=_0x57ed('0x57');_0x2e30eb['remoteUri']=intUtil[_0x57ed('0x58')](_0x2e30eb[_0x57ed('0x59')]);_0x2e30eb[_0x57ed('0x5a')]=intUtil[_0x57ed('0x58')](_0x2e30eb[_0x57ed('0x5a')]);var _0x5b24ce=util[_0x57ed('0x52')](_0x57ed('0x5b'),_0x2e30eb[_0x57ed('0x59')]);_0x5960be[_0x57ed('0x19')]=!_[_0x57ed('0x5c')](_0x46b1f9)?_0x46b1f9[_0x57ed('0x5d')]:null;_0x5960be[_0x57ed('0x5e')]=_0x2e30eb[_0x57ed('0x5d')];_0x5960be[_0x57ed('0x25')]=_0x116cc9['toLowerCase']()==='outbound'?_0x3bd761[_0x57ed('0x5f')]:_0x3bd761[_0x57ed('0x60')];_0x5960be[_0x57ed('0x61')]=_0x116cc9===_0x57ed('0x62')||_0x116cc9==='unmanaged'?'queue':_0x57ed('0x63');var _0xcbeab4=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e30eb[_0x57ed('0x5a')],_0x3bd761['uniqueid'],md5(_0x3bd761[_0x57ed('0x64')]));if(_0x3c213c&&_0x3c213c['monitor_format']){logger[_0x57ed('0x11')](_0x57ed('0x65'),_0x57ed('0x66'));_0x3bd761['recordingURL']=_0xcbeab4;}else if(_0x49187a&&_0x49187a['recordingFormat']&&_0x49187a[_0x57ed('0x67')]!==_0x57ed('0x68')){logger[_0x57ed('0x11')](_0x57ed('0x69'),_0x57ed('0x66'));_0x3bd761[_0x57ed('0x6a')]=_0xcbeab4;}else{_0x3bd761[_0x57ed('0x6a')]='';}return getAdminUser(_0x116cc9,_0x3dfa9c,_0x5960be,_0x5b24ce,_0x18c3cb,_0x2e80c3)[_0x57ed('0x1c')](getUser(_0x116cc9,_0x3dfa9c,_0x5b24ce,_0x18c3cb,_0x2e80c3))[_0x57ed('0x1c')](getEndUser(_0x116cc9,_0x3dfa9c,_0x5b24ce,_0x18c3cb,_0x2e80c3))[_0x57ed('0x1c')](getTicket(_0x116cc9,_0x3dfa9c,_0x5b24ce,_0x371d0e,_0x3bd761,_0x18c3cb))[_0x57ed('0x1c')](function(_0x2ce3e4){logger['info'](util[_0x57ed('0x52')](_0x57ed('0x6b'),_0x2ce3e4[_0x57ed('0x47')]));logger[_0x57ed('0x11')](util['format']('call\x20direction:\x20%s',_0x116cc9));if(_0x116cc9!==_0x57ed('0x6c')){logger[_0x57ed('0x11')]('['+[_0x116cc9[_0x57ed('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2e30eb[_0x57ed('0x59')],_0x46b1f9['name'],_0x2ce3e4[_0x57ed('0x47')]);}})[_0x57ed('0x14')](function(_0x349808){logger[_0x57ed('0x15')]('['+[_0x116cc9['toUpperCase']()]+_0x57ed('0x6d'),util[_0x57ed('0x6e')](_0x349808,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa7ac=['sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','type','customField','nameField','toLowerCase','toString','includes','picklist','idField','content','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1'];(function(_0x529022,_0x3b72c6){var _0x2cd2f4=function(_0x2bc57c){while(--_0x2bc57c){_0x529022['push'](_0x529022['shift']());}};_0x2cd2f4(++_0x3b72c6);}(_0xa7ac,0x1dd));var _0xca7a=function(_0x495466,_0x1567f5){_0x495466=_0x495466-0x0;var _0x3948a5=_0xa7ac[_0x495466];return _0x3948a5;};'use strict';var _=require('lodash');var Promise=require(_0xca7a('0x0'));var rp=require(_0xca7a('0x1'));var util=require('util');var md5=require(_0xca7a('0x2'));var Redis=require(_0xca7a('0x3'));var intUtil=require('./util');var config=require(_0xca7a('0x4'));var logger=require(_0xca7a('0x5'))(_0xca7a('0x6'));config[_0xca7a('0x7')]=_[_0xca7a('0x8')](config[_0xca7a('0x7')],{'host':_0xca7a('0x9'),'port':0x18eb});var io=require(_0xca7a('0xa'))(new Redis(config[_0xca7a('0x7')]));function getAdminUser(_0x10041b,_0x2e5c60,_0x45507c,_0x1bc55d,_0x37e3ab,_0x4756d5){return new Promise(function(_0xed914b,_0x2e59eb){var _0x1f0d6a={'method':_0xca7a('0xb'),'uri':_0x1bc55d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x37e3ab+'&'+_0x4756d5,'auth':_0x2e5c60,'json':!![]};return rp(_0x1f0d6a)[_0xca7a('0xc')](function(_0x12878c){if(_0x12878c[_0xca7a('0xd')]['length']>0x0){_0x45507c[_0xca7a('0xe')]=_0x12878c[_0xca7a('0xd')][0x0][_0xca7a('0xf')];}logger[_0xca7a('0x10')]('['+[_0x10041b[_0xca7a('0x11')]()]+_0xca7a('0x12'),_0x45507c);_0xed914b(_0x45507c);})['catch'](function(_0x6d1b31){logger[_0xca7a('0x13')]('['+[_0x10041b[_0xca7a('0x11')]()]+']',_0x6d1b31['message']);_0x2e59eb(_0x6d1b31[_0xca7a('0x14')]);});});}function getUser(_0x2e3037,_0x290308,_0x2027f9,_0x4a6cf6,_0x4708b6){return function(_0xc498f2){logger[_0xca7a('0x10')]('['+[_0x2e3037[_0xca7a('0x11')]()]+_0xca7a('0x15'),_0xc498f2);return new Promise(function(_0x505564,_0xb4453b){if(intUtil['validateEmail'](_0xc498f2[_0xca7a('0x16')])){var _0x127335={'method':'GET','uri':_0x2027f9+_0xca7a('0x17')+_0xc498f2[_0xca7a('0x16')]+'&'+_0x4a6cf6+'&'+_0x4708b6,'auth':_0x290308,'json':!![]};logger['info']('['+[_0x2e3037['toUpperCase']()]+_0xca7a('0x18'),_0x127335);return rp(_0x127335)[_0xca7a('0xc')](function(_0x4ab702){logger[_0xca7a('0x10')]('['+[_0x2e3037['toUpperCase']()]+_0xca7a('0x19'),_0x4ab702);if(_0x4ab702[_0xca7a('0xd')]['length']>0x0&&String(_0x4ab702[_0xca7a('0xd')][0x0][_0xca7a('0x1a')])===_0xca7a('0x1b')){_0xc498f2[_0xca7a('0x1c')]=_0x4ab702[_0xca7a('0xd')][0x0][_0xca7a('0xf')];}else{_0xc498f2['userId']=_0xc498f2[_0xca7a('0xe')];_0xc498f2[_0xca7a('0x16')]=_0xc498f2[_0xca7a('0x1d')];}logger[_0xca7a('0x10')]('['+[_0x2e3037['toUpperCase']()]+'],\x20getUser\x20crm',_0xc498f2);_0x505564(_0xc498f2);})['catch'](function(_0x133022){logger[_0xca7a('0x13')]('['+[_0x2e3037[_0xca7a('0x11')]()]+']',_0x133022[_0xca7a('0x14')]);_0xb4453b(_0x133022['message']);});}else{logger['info']('['+[_0x2e3037['toUpperCase']()]+_0xca7a('0x1e'));_0xc498f2[_0xca7a('0x1c')]=_0xc498f2[_0xca7a('0xe')];_0xc498f2[_0xca7a('0x16')]=_0xc498f2[_0xca7a('0x1d')];_0x505564(_0xc498f2);}});};}function createEndUser(_0x237a7b,_0x36e5e8,_0x364dda,_0xe2899b,_0x3b5076){logger['info']('['+[_0x237a7b[_0xca7a('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x364dda);return new Promise(function(_0x59d2b0,_0x3959ce){var _0x2c345e={'method':'POST','uri':_0xe2899b+_0xca7a('0x1f')+_0x3b5076,'body':{'user_name':_0x364dda[_0xca7a('0x20')],'roles':_0xca7a('0x21'),'first_name':_0x364dda[_0xca7a('0x20')],'active':_0xca7a('0x1b'),'date_format':_0xca7a('0x22'),'phone':_0x364dda[_0xca7a('0x20')]},'auth':_0x36e5e8,'json':!![]};return rp(_0x2c345e)[_0xca7a('0xc')](function(_0x44ed9d){logger[_0xca7a('0x10')]('['+[_0x237a7b[_0xca7a('0x11')]()]+_0xca7a('0x23'),_0x44ed9d[_0xca7a('0xd')]);_0x364dda['endUserId']=_0x44ed9d[_0xca7a('0xd')]['sys_id'];_0x59d2b0(_0x364dda);})[_0xca7a('0x24')](function(_0x581758){logger[_0xca7a('0x13')]('['+[_0x237a7b[_0xca7a('0x11')]()]+']',_0x581758['message']);_0x3959ce(_0x581758[_0xca7a('0x14')]);});});}function getEndUser(_0x258223,_0x2cca3c,_0x3969f8,_0x2e8f5e,_0x5d3062){return function(_0x2242c7){logger['info']('['+[_0x258223['toUpperCase']()]+_0xca7a('0x25'),_0x2242c7);return new Promise(function(_0x2d72f0,_0x5e4b54){var _0x1fbf8a={'method':'GET','uri':_0x3969f8+_0xca7a('0x26')+_0x2242c7[_0xca7a('0x20')]+'&'+_0x2e8f5e+'&'+_0x5d3062,'auth':_0x2cca3c,'json':!![]};return rp(_0x1fbf8a)[_0xca7a('0xc')](function(_0x3705c9){if(_0x3705c9['result'][_0xca7a('0x27')]>0x0){_0x2242c7[_0xca7a('0x28')]=_0x3705c9[_0xca7a('0xd')][0x0][_0xca7a('0xf')];logger[_0xca7a('0x10')]('['+[_0x258223['toUpperCase']()]+_0xca7a('0x29'),_0x2242c7);_0x2d72f0(_0x2242c7);}else{return createEndUser(_0x258223,_0x2cca3c,_0x2242c7,_0x3969f8,_0x2e8f5e)[_0xca7a('0xc')](function(_0x5cff26){logger['info']('['+[_0x258223[_0xca7a('0x11')]()]+_0xca7a('0x2a'),_0x5cff26);_0x2d72f0(_0x5cff26);});}})[_0xca7a('0x24')](function(_0x5b2fc6){logger[_0xca7a('0x13')]('['+[_0x258223['toUpperCase']()]+']',_0x5b2fc6['message']);_0x5e4b54(_0x5b2fc6[_0xca7a('0x14')]);});});};}function getCustomFields(_0x59f891,_0x4070b3){var _0x113851={};if(_0x59f891[_0xca7a('0x27')]>0x0){_['forEach'](_0x59f891,function(_0x5ae2e8){if(_['includes']([_0xca7a('0x2b'),'picklist'],_0x5ae2e8[_0xca7a('0x2c')])&&_0x5ae2e8['nameField']&&!_0x5ae2e8[_0xca7a('0x2d')]){_0x113851[_0x5ae2e8[_0xca7a('0x2e')][_0xca7a('0x2f')]()]=_0x5ae2e8['content'][_0xca7a('0x30')]();}else if(_[_0xca7a('0x31')]([_0xca7a('0x2b'),_0xca7a('0x32')],_0x5ae2e8[_0xca7a('0x2c')])&&_0x5ae2e8[_0xca7a('0x33')]&&_0x5ae2e8[_0xca7a('0x2d')]){_0x113851[_0x5ae2e8['idField']['toLowerCase']()]=_0x5ae2e8[_0xca7a('0x34')][_0xca7a('0x30')]();}else if(_0x5ae2e8[_0xca7a('0x2c')]===_0xca7a('0x35')&&_0x5ae2e8[_0xca7a('0x36')]&&_0x5ae2e8[_0xca7a('0x33')]&&_0x5ae2e8[_0xca7a('0x2d')]){_0x113851[_0x5ae2e8[_0xca7a('0x33')][_0xca7a('0x2f')]()]=_0x4070b3[_0x5ae2e8['variableName']]['toString']();}else if(_0x5ae2e8[_0xca7a('0x2c')]==='customVariable'&&_0x5ae2e8[_0xca7a('0x37')]&&_0x5ae2e8[_0xca7a('0x37')][_0xca7a('0x38')]&&_0x5ae2e8[_0xca7a('0x33')]&&_0x5ae2e8[_0xca7a('0x2d')]){_0x113851[_0x5ae2e8[_0xca7a('0x33')]['toLowerCase']()]=_0x4070b3[_0x5ae2e8[_0xca7a('0x37')][_0xca7a('0x38')]['toLowerCase']()]['toString']();}});}return _0x113851;}function getTicket(_0x2d97ae,_0x90a71,_0x842289,_0x3c2cbe,_0x5264bc,_0x373083){return function(_0x41e633){logger[_0xca7a('0x10')]('['+[_0x2d97ae[_0xca7a('0x11')]()]+_0xca7a('0x39'),_0x41e633);return new Promise(function(_0x20f885,_0x42040a){var _0x3af455=_0x2d97ae['toLowerCase']()===_0xca7a('0x3a')?_0x41e633[_0xca7a('0x1c')]:_0x41e633[_0xca7a('0x28')];var _0x3eb108={'method':_0xca7a('0x3b'),'uri':_0x842289+'incident'+'?'+_0x373083,'body':Object[_0xca7a('0x3c')]({},{'active':'true','caller_id':_0x3af455,'assigned_to':_0x41e633['userId'],'short_description':intUtil[_0xca7a('0x3d')](_0x3c2cbe[_0xca7a('0x3e')],_0x5264bc,'\x20'),'description':intUtil[_0xca7a('0x3d')](_0x3c2cbe[_0xca7a('0x3f')],_0x5264bc,'\x0a')},getCustomFields(_0x3c2cbe['Fields'],_0x5264bc)),'auth':_0x90a71,'json':!![]};return rp(_0x3eb108)[_0xca7a('0xc')](function(_0x25b131){logger['info']('['+[_0x2d97ae['toUpperCase']()]+_0xca7a('0x40'),_0x25b131[_0xca7a('0xd')]);_0x41e633[_0xca7a('0x41')]=_0x25b131[_0xca7a('0xd')]['sys_id'];_0x41e633[_0xca7a('0x42')]=_0x25b131[_0xca7a('0xd')]['number'];logger[_0xca7a('0x10')]('['+[_0x2d97ae[_0xca7a('0x11')]()]+_0xca7a('0x43'),_0x41e633);_0x20f885(_0x41e633);})['catch'](function(_0x290621){logger[_0xca7a('0x13')]('['+[_0x2d97ae['toUpperCase']()]+']',_0x290621[_0xca7a('0x14')]);_0x42040a(_0x290621[_0xca7a('0x14')]);});});};}function createRemoteTag(_0x3d3ed8,_0x27d9ea,_0x57bc71,_0x5e3f3c){return new Promise(function(_0x4d213e,_0x1c96b4){var _0x135d3c={'method':'POST','uri':_0x57bc71+_0xca7a('0x44')+'?'+_0x5e3f3c,'body':{'short_description':_0x3d3ed8,'global':!![],'active':!![],'name':_0x3d3ed8},'auth':_0x27d9ea,'json':!![]};return rp(_0x135d3c)[_0xca7a('0xc')](function(_0x526e16){var _0x56f3ab=_0x526e16['result'][_0xca7a('0xf')];_0x4d213e(_0x56f3ab);});});}function getRemoteTag(_0x32ddbc,_0x202ada,_0x2037d9,_0x32b106,_0x30139f){return new Promise(function(_0x53a65c,_0x423185){var _0x2b2936={'method':_0xca7a('0xb'),'uri':_0x2037d9+_0xca7a('0x44')+_0xca7a('0x45')+_0x32ddbc+'&'+_0x32b106,'auth':_0x202ada,'json':!![]};return rp(_0x2b2936)[_0xca7a('0xc')](function(_0x154ffb){if(_0x154ffb[_0xca7a('0xd')][_0xca7a('0x27')]>0x0){var _0x7c03a3=_0x154ffb[_0xca7a('0xd')][0x0][_0xca7a('0xf')];_0x53a65c(_0x7c03a3);}else{return createRemoteTag(_0x32ddbc,_0x202ada,_0x2037d9,_0x32b106)[_0xca7a('0xc')](function(_0x41eff1){_0x53a65c(_0x41eff1);});}});});}function assignTagToIncident(_0x552597,_0x247c53,_0x3020e8,_0x25a577,_0x1aad22){return new Promise(function(_0x233498,_0x5deb07){var _0x4ff30c={'method':_0xca7a('0x3b'),'uri':_0x3020e8+_0xca7a('0x46')+'?'+_0x1aad22,'body':{'label':_0x552597,'table':_0xca7a('0x47'),'id_type':_0xca7a('0x48'),'table_key':_0x25a577[_0xca7a('0x41')],'title':_0xca7a('0x49')+_0x25a577['ticketNumber'],'id_display':_0x25a577[_0xca7a('0x42')]},'auth':_0x247c53,'json':!![]};return rp(_0x4ff30c)['then'](function(_0x4f7255){_0x233498();})['catch'](function(){_0x233498();});});}function manageTags(_0x2cae98,_0x4ce23c,_0xb1674c,_0x26400f,_0x296440,_0x18bacf,_0x76551){return new Promise(function(_0x42451f,_0x567d83){var _0x44fa3d=[];_0x4ce23c[_0xca7a('0x4a')](function(_0x3a2f68){_0x44fa3d['push'](getRemoteTag(_0x3a2f68,_0xb1674c,_0x26400f,_0x18bacf,_0x76551));});return Promise[_0xca7a('0x4b')](_0x44fa3d)[_0xca7a('0xc')](function(_0x17fe9e){if(_0x17fe9e[_0xca7a('0x27')]){logger['info']('['+[_0x2cae98['toUpperCase']()]+_0xca7a('0x4c'),_0x17fe9e);var _0x4b34aa=[];_0x17fe9e[_0xca7a('0x4a')](function(_0x2e5df0){_0x4b34aa[_0xca7a('0x4d')](assignTagToIncident(_0x2e5df0,_0xb1674c,_0x26400f,_0x296440,_0x18bacf));});return Promise[_0xca7a('0x4b')](_0x4b34aa)[_0xca7a('0xc')](function(){_0x42451f();})[_0xca7a('0x24')](function(){_0x42451f();});}else{_0x42451f();}});});}function getTags(_0x4888c3,_0x3d0b39,_0x47048e,_0xa942dd,_0xf185bb,_0x535c0e){return function(_0x59f04b){return new Promise(function(_0x7ac152,_0x57984c){var _0x2d1433=[];var _0x524210=_0xa942dd[_0xca7a('0x4e')];if(_0x524210&&_0x524210[_0xca7a('0x27')]>0x0){_0x2d1433=_['map'](_0x524210,_0xca7a('0x38'));}if(_0x2d1433[_0xca7a('0x27')]>0x0){return manageTags(_0x4888c3,_0x2d1433,_0x3d0b39,_0x47048e,_0x59f04b,_0xf185bb,_0x535c0e)[_0xca7a('0xc')](function(){_0x7ac152(_0x59f04b);});}else{_0x7ac152(_0x59f04b);}});};}function emit(_0x32d9d9,_0x4e0b56,_0x76d294){var _0x540551='%26sysparm_record_target%3Dincident'+_0xca7a('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xca7a('0x50');var _0x2d893c={'uri':_0x32d9d9+_0xca7a('0x51')+_0x76d294+_0x540551};io['to'](util[_0xca7a('0x52')](_0xca7a('0x53'),_0x4e0b56))[_0xca7a('0x54')](_0xca7a('0x55'),_0x2d893c);}exports['cs']=function(_0xf5dc46,_0x2c4236,_0x1d45df,_0x562649,_0x5b4c09,_0x28afd3,_0x4de2c8,_0x5320ce){var _0x14cc5b={};var _0x4ff432={'user':_0x28afd3[_0xca7a('0x56')],'pass':_0x28afd3['password']};var _0x34fb7b=_0xca7a('0x57');var _0x488989=_0xca7a('0x58');_0x28afd3[_0xca7a('0x59')]=intUtil[_0xca7a('0x5a')](_0x28afd3[_0xca7a('0x59')]);_0x28afd3[_0xca7a('0x5b')]=intUtil[_0xca7a('0x5a')](_0x28afd3[_0xca7a('0x5b')]);var _0x3c57d4=util[_0xca7a('0x52')](_0xca7a('0x5c'),_0x28afd3[_0xca7a('0x59')]);_0x14cc5b[_0xca7a('0x16')]=!_[_0xca7a('0x5d')](_0x562649)?_0x562649['email']:null;_0x14cc5b[_0xca7a('0x1d')]=_0x28afd3[_0xca7a('0x5e')];_0x14cc5b['endUserNumber']=_0x5320ce['toLowerCase']()===_0xca7a('0x3a')?_0x2c4236[_0xca7a('0x5f')]:_0x2c4236[_0xca7a('0x60')];_0x14cc5b[_0xca7a('0x61')]=_0x5320ce===_0xca7a('0x62')||_0x5320ce===_0xca7a('0x63')?_0xca7a('0x62'):_0xca7a('0x3a');var _0x378e2a=util[_0xca7a('0x52')](_0xca7a('0x64'),_0x28afd3[_0xca7a('0x5b')],_0x2c4236[_0xca7a('0x65')],md5(_0x2c4236[_0xca7a('0x65')]));if(_0x5b4c09&&_0x5b4c09[_0xca7a('0x66')]){logger['info'](_0xca7a('0x67'),_0xca7a('0x68'));_0x2c4236[_0xca7a('0x69')]=_0x378e2a;}else if(_0x4de2c8&&_0x4de2c8[_0xca7a('0x6a')]&&_0x4de2c8[_0xca7a('0x6a')]!==_0xca7a('0x6b')){logger[_0xca7a('0x10')](_0xca7a('0x6c'),'Recording\x20is\x20enabled!');_0x2c4236[_0xca7a('0x69')]=_0x378e2a;}else{_0x2c4236[_0xca7a('0x69')]='';}return getAdminUser(_0x5320ce,_0x4ff432,_0x14cc5b,_0x3c57d4,_0x488989,_0x34fb7b)[_0xca7a('0xc')](getUser(_0x5320ce,_0x4ff432,_0x3c57d4,_0x488989,_0x34fb7b))[_0xca7a('0xc')](getEndUser(_0x5320ce,_0x4ff432,_0x3c57d4,_0x488989,_0x34fb7b))[_0xca7a('0xc')](getTicket(_0x5320ce,_0x4ff432,_0x3c57d4,_0x1d45df,_0x2c4236,_0x488989))[_0xca7a('0xc')](function(_0xebbf05){logger[_0xca7a('0x10')](util['format'](_0xca7a('0x6d'),_0xebbf05[_0xca7a('0x41')]));logger[_0xca7a('0x10')](util[_0xca7a('0x52')](_0xca7a('0x6e'),_0x5320ce));if(_0x5320ce!==_0xca7a('0x63')){logger['info']('['+[_0x5320ce[_0xca7a('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x28afd3[_0xca7a('0x59')],_0x562649['name'],_0xebbf05[_0xca7a('0x41')]);}})['catch'](function(_0x2f3af1){logger[_0xca7a('0x13')]('['+[_0x5320ce['toUpperCase']()]+_0xca7a('0x6f'),util[_0xca7a('0x70')](_0x2f3af1,{'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 9196e73..10ea1e4 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 _0x9bf0=['redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','get_entry_list','stringify','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','nameField','customField','content','string','custom_fields','toString','variable','customVariable','Variable','toLowerCase','password','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','Outbound','version','unmanaged','lastevent','isNil','Fields','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x9bf0,0xe3));var _0x09bf=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9bf0[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x09bf('0x0'));var intUtil=require(_0x09bf('0x1'));var config=require(_0x09bf('0x2'));var logger=require(_0x09bf('0x3'))(_0x09bf('0x4'));config[_0x09bf('0x5')]=_['defaults'](config[_0x09bf('0x5')],{'host':_0x09bf('0x6'),'port':0x18eb});var io=require(_0x09bf('0x7'))(new Redis(config[_0x09bf('0x5')]));var def={'method':_0x09bf('0x8'),'json':!![]};function emit(_0x25a621,_0x323cec,_0x4467f4){io['to'](_0x25a621)[_0x09bf('0x9')](_0x323cec,_0x4467f4);}function getTicket(_0x4bf1ef,_0x2acf8f,_0x2a416f,_0x26be6c,_0x357349,_0x111ada,_0x32bc6a,_0x5c91f1){logger[_0x09bf('0xa')](_0x09bf('0xb'));var _0x301869=new Date();var _0x2fef38=[{'name':_0x09bf('0xc'),'value':intUtil['getString'](_0x26be6c[_0x09bf('0xd')],_0x357349,'\x20')},{'name':_0x09bf('0xe'),'value':_0x2acf8f['id']},{'name':_0x09bf('0xf'),'value':_0x2acf8f['id']},{'name':_0x09bf('0x10'),'value':intUtil[_0x09bf('0x11')](_0x26be6c['Descriptions'],_0x357349,'\x0a')},{'name':_0x09bf('0x12'),'value':_0x301869[_0x09bf('0x13')]()['slice'](0x0,0x13)[_0x09bf('0x14')]('T','\x20')},{'name':_0x09bf('0x15'),'value':'0'},{'name':_0x09bf('0x16'),'value':'15'},{'name':_0x09bf('0x17'),'value':_0x2a416f['id']},{'name':_0x09bf('0x18'),'value':_0x09bf('0x19')},{'name':_0x09bf('0x1a'),'value':_0x2a416f[_0x09bf('0xc')]},{'name':_0x09bf('0x1b'),'value':_0x5c91f1}];if(_0x111ada[_0x09bf('0x1c')]){_['forEach'](_0x111ada,function(_0x2401e1){if(_0x357349[_0x2401e1['variableName']]){_0x2fef38[_0x09bf('0x1d')]({'name':_0x2401e1[_0x09bf('0x1e')],'value':_0x357349[_0x2401e1[_0x09bf('0x1f')]]});}});}return request({'form':{'method':_0x09bf('0x20'),'input_type':_0x09bf('0x21'),'response_type':_0x09bf('0x21'),'rest_data':JSON['stringify']({'session':_0x32bc6a['id'],'module_name':_0x09bf('0x22'),'name_value_list':_0x2fef38})}});}function getAuth(_0x47a1b8){return util[_0x09bf('0x23')](_0x09bf('0x24'),new Buffer(_0x47a1b8[_0x09bf('0x25')]+':X')['toString'](_0x09bf('0x26')));}function getServerInfo(_0x5053e2){return request({'form':{'method':_0x09bf('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5053e2['id']})}});}function getUser(_0x4a27c5,_0x17f012,_0x90c2a7){if(!_['isNil'](_0x17f012)){logger['info']('Getting\x20agent\x20with\x20name',_0x17f012);return request({'form':{'method':_0x09bf('0x28'),'input_type':'JSON','response_type':_0x09bf('0x21'),'rest_data':JSON[_0x09bf('0x29')]({'session':_0x90c2a7['id'],'module_name':'Employees','query':util[_0x09bf('0x23')](_0x09bf('0x2a'),_0x17f012),'order_by':'','offset':'0','select_fields':['id',_0x09bf('0xc'),_0x09bf('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x09bf('0x2c')](function(_0x17bebf){if(_0x17bebf[_0x09bf('0x2d')][_0x09bf('0x1c')]){var _0x479196=_[_0x09bf('0x2e')](_0x17bebf[_0x09bf('0x2d')],function(_0x51ca60){return _0x51ca60[_0x09bf('0x2f')][_0x09bf('0x2b')][_0x09bf('0x30')]===_0x17f012;});if(_0x479196){logger[_0x09bf('0xa')]('Agent\x20found!');return BPromise[_0x09bf('0x31')]({'id':_0x479196[_0x09bf('0x2f')]['id'][_0x09bf('0x30')],'name':_0x479196[_0x09bf('0x2f')][_0x09bf('0xc')][_0x09bf('0x30')]});}}logger[_0x09bf('0xa')](_0x09bf('0x32'));return BPromise[_0x09bf('0x31')]({'id':_0x90c2a7[_0x09bf('0x2f')][_0x09bf('0x33')][_0x09bf('0x30')],'name':_0x90c2a7[_0x09bf('0x2f')]['user_name'][_0x09bf('0x30')]});});}else{logger[_0x09bf('0xa')](_0x09bf('0x34'));return BPromise[_0x09bf('0x31')]({'id':_0x90c2a7[_0x09bf('0x2f')][_0x09bf('0x33')][_0x09bf('0x30')],'name':_0x90c2a7[_0x09bf('0x2f')]['user_name'][_0x09bf('0x30')]});}}function getEndUser(_0x57197a,_0x5bce2c,_0x191206,_0x50258b){logger[_0x09bf('0xa')](_0x09bf('0x35'),_0x191206);return request({'form':{'method':'get_entry_list','input_type':_0x09bf('0x21'),'response_type':_0x09bf('0x21'),'rest_data':JSON[_0x09bf('0x29')]({'session':_0x50258b['id'],'module_name':_0x09bf('0x19'),'query':util[_0x09bf('0x23')](_0x09bf('0x36'),_0x191206),'order_by':'','offset':'0','select_fields':['id','name',_0x09bf('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x09bf('0x2c')](function(_0x107ed3){if(_0x107ed3['entry_list']['length']){var _0x55ef49=_[_0x09bf('0x2e')](_0x107ed3[_0x09bf('0x2d')],function(_0x3b778b){return _0x3b778b[_0x09bf('0x2f')][_0x09bf('0x37')]['value']===_0x191206;});if(_0x55ef49){logger[_0x09bf('0xa')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x55ef49[_0x09bf('0x2f')]['id'][_0x09bf('0x30')],'name':_0x55ef49[_0x09bf('0x2f')]['name'][_0x09bf('0x30')],'phone':_0x55ef49[_0x09bf('0x2f')]['phone_home'][_0x09bf('0x30')]});}}else{logger[_0x09bf('0xa')](_0x09bf('0x38'));return request({'form':{'method':_0x09bf('0x20'),'input_type':_0x09bf('0x21'),'response_type':_0x09bf('0x21'),'rest_data':JSON[_0x09bf('0x29')]({'session':_0x50258b['id'],'module_name':_0x09bf('0x19'),'name_value_list':[{'name':_0x09bf('0x39'),'value':_0x5bce2c!==''?_0x5bce2c:util['format'](_0x09bf('0x3a'),_0x191206)},{'name':_0x09bf('0x37'),'value':_0x191206}]})}})['then'](function(_0x872b66){logger['info']('Enduser\x20created.');return BPromise[_0x09bf('0x31')]({'id':_0x872b66['id'],'name':_0x872b66[_0x09bf('0x2d')][_0x09bf('0x39')]['value'],'phone':_0x872b66[_0x09bf('0x2d')]['phone_home'][_0x09bf('0x30')]});});}});}function request(_0x5ac050){logger[_0x09bf('0x3b')](_0x09bf('0x3c'),JSON[_0x09bf('0x29')](_0x5ac050));return rp(_[_0x09bf('0x3d')](def,_0x5ac050));}function getTags(_0x36b113,_0x46b600){var _0x4633de=[];if(_0x36b113&&_0x36b113[_0x09bf('0x1c')]>0x0){_0x4633de=_[_0x09bf('0x3e')](_0x36b113,_0x46b600);}return _0x4633de;}function getCustomFields(_0x56464b,_0x9a0f97){var _0x2ba6ce=[];var _0xb42e4b={'custom_fields':[]};if(_0x56464b['length']>0x0){_['forEach'](_0x56464b,function(_0x28016f){if(_0x28016f[_0x09bf('0x3f')]==='string'&&_0x28016f[_0x09bf('0x40')]&&!_0x28016f[_0x09bf('0x41')]){_0xb42e4b[_0x28016f[_0x09bf('0x40')]['toLowerCase']()]=_0x28016f[_0x09bf('0x42')]['toString']();}else if(_0x28016f['type']===_0x09bf('0x43')&&_0x28016f[_0x09bf('0x1e')]&&_0x28016f['customField']){_0xb42e4b[_0x09bf('0x44')][_0x09bf('0x1d')]({'id':_0x28016f['idField'],'value':_0x28016f['content'][_0x09bf('0x45')]()});}else if(_0x28016f['type']===_0x09bf('0x46')&&_0x28016f[_0x09bf('0x1f')]&&_0x28016f['idField']&&_0x28016f[_0x09bf('0x41')]){_0x9a0f97[_0x28016f[_0x09bf('0x1f')]]&&_0xb42e4b[_0x09bf('0x44')][_0x09bf('0x1d')]({'id':_0x28016f[_0x09bf('0x1e')],'value':_0x9a0f97[_0x28016f[_0x09bf('0x1f')]]['toString']()});}else if(_0x28016f['type']===_0x09bf('0x47')&&_0x28016f[_0x09bf('0x48')]&&_0x28016f[_0x09bf('0x48')][_0x09bf('0xc')]&&_0x28016f['idField']&&_0x28016f['customField']){_0x9a0f97[_0x28016f[_0x09bf('0x48')][_0x09bf('0xc')][_0x09bf('0x49')]()]&&_0xb42e4b[_0x09bf('0x44')][_0x09bf('0x1d')]({'id':_0x28016f[_0x09bf('0x1e')],'value':_0x9a0f97[_0x28016f[_0x09bf('0x48')][_0x09bf('0xc')][_0x09bf('0x49')]()]['toString']()});}});}return _0xb42e4b;}function getConnection(_0xe9adf2){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':_0x09bf('0x21'),'rest_data':JSON[_0x09bf('0x29')]({'user_auth':{'user_name':_0xe9adf2['username'],'password':_0xe9adf2[_0x09bf('0x4a')],'encryption':'PLAIN'},'application':_0x09bf('0x4b')})}})[_0x09bf('0x2c')](function(_0x3fe236){var _0x5471cd=_0x3fe236;if(_0x5471cd['id']){def[_0x09bf('0x4c')]=_0x5471cd['id'];return BPromise[_0x09bf('0x31')](_0x5471cd);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0xe9adf2['id']));}});}function setRelationship(_0x50a7af,_0x30881f,_0x2f7569,_0xb1daa7){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x09bf('0x21'),'rest_data':JSON[_0x09bf('0x29')]({'session':_0x50a7af['id'],'module_name':_0x09bf('0x22'),'module_id':_0x2f7569['id'],'link_field_name':_0xb1daa7,'related_ids':[_0x30881f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x09bf('0x4d')]=function(_0x15d76f,_0x505096,_0x5c2ef2,_0x27290c,_0x47d530,_0x5887c4){var _0xd22532,_0x1a007d,_0x47783a,_0x49d5f3;_0x5887c4[_0x09bf('0x4e')]=intUtil[_0x09bf('0x4f')](_0x5887c4[_0x09bf('0x4e')]);_0x5887c4[_0x09bf('0x50')]=intUtil[_0x09bf('0x4f')](_0x5887c4[_0x09bf('0x50')]);def[_0x09bf('0x51')]=util['format']('%s/service/v4_1/rest.php',_0x5887c4[_0x09bf('0x4e')]);if(_0x47d530&&_0x47d530[_0x09bf('0x52')]){logger[_0x09bf('0xa')](_0x09bf('0x53'),_0x09bf('0x54'));_0x505096[_0x09bf('0x55')]=util[_0x09bf('0x23')](_0x09bf('0x56'),_0x5887c4[_0x09bf('0x50')],_0x505096['uniqueid'],md5(_0x505096['uniqueid']));}else{_0x505096[_0x09bf('0x55')]='';}return getConnection(_0x5887c4)['then'](function(_0x3d44f2){_0x49d5f3=_0x3d44f2;return getUser(_0x5887c4,_0x27290c[_0x09bf('0xc')],_0x49d5f3);})[_0x09bf('0x2c')](function(_0x2dea9e){_0xd22532=_0x2dea9e;logger[_0x09bf('0xa')](_0x09bf('0x57'),_0xd22532['id']);return getEndUser(_0x5887c4,_0x505096[_0x09bf('0x58')],_0x505096[_0x09bf('0x59')],_0x49d5f3);})[_0x09bf('0x2c')](function(_0x1980eb){_0x1a007d=_0x1980eb;logger[_0x09bf('0xa')](_0x09bf('0x5a'),_0x1a007d['id']);return getTicket(_0x5887c4,_0xd22532,_0x1a007d,_0x5c2ef2,_0x505096,_0x5c2ef2['Fields'],_0x49d5f3,_0x09bf('0x5b'));})[_0x09bf('0x2c')](function(_0x1c53ba){_0x47783a=_0x1c53ba;logger[_0x09bf('0xa')](_0x09bf('0x5c'));logger['info'](_0x09bf('0x5d'),_0x47783a['id']);return setRelationship(_0x49d5f3,_0xd22532,_0x47783a,_0x09bf('0x5e'));})[_0x09bf('0x2c')](function(){return setRelationship(_0x49d5f3,_0x1a007d,_0x47783a,_0x09bf('0x5f'));})['then'](function(){return getServerInfo(_0x49d5f3);})['then'](function(_0x19df30){var _0x222b57=parseInt(_0x19df30['version'][_0x09bf('0x60')](0x0));var _0x43c88a=util[_0x09bf('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5887c4[_0x09bf('0x4e')],_0x47783a['id']);if(_0x222b57>0x6){_0x43c88a=util[_0x09bf('0x23')](_0x09bf('0x61'),_0x5887c4['remoteUri'],_0x47783a['id']);}logger['info']('[QUEUE]',_0x09bf('0x62'));emit(util['format'](_0x09bf('0x63'),_0x27290c[_0x09bf('0xc')]),_0x09bf('0x64'),{'uri':_0x43c88a});})[_0x09bf('0x65')](function(_0x5c5a4d){logger[_0x09bf('0x66')](_0x09bf('0x53'),JSON['stringify'](_0x5c5a4d));});};exports[_0x09bf('0x67')]=function(_0x3819ac,_0xf526fa,_0x449707,_0x35617a,_0x249214,_0x5b6abe,_0x52b8ee){var _0x45032e,_0x2b245a,_0x5ea0a4,_0x4aa235;_0x5b6abe[_0x09bf('0x4e')]=intUtil[_0x09bf('0x4f')](_0x5b6abe[_0x09bf('0x4e')]);_0x5b6abe['serverUrl']=intUtil[_0x09bf('0x4f')](_0x5b6abe[_0x09bf('0x50')]);def[_0x09bf('0x51')]=util[_0x09bf('0x23')](_0x09bf('0x68'),_0x5b6abe['remoteUri']);if(_0x52b8ee&&_0x52b8ee['recordingFormat']&&_0x52b8ee[_0x09bf('0x69')]!==_0x09bf('0x6a')){logger['info'](_0x09bf('0x6b'),'Recording\x20is\x20enabled!');_0xf526fa[_0x09bf('0x55')]=util[_0x09bf('0x23')](_0x09bf('0x56'),_0x5b6abe[_0x09bf('0x50')],_0xf526fa[_0x09bf('0x6c')],md5(_0xf526fa[_0x09bf('0x6c')]));}return getConnection(_0x5b6abe)[_0x09bf('0x2c')](function(_0x449715){_0x4aa235=_0x449715;return getUser(_0x5b6abe,_0x35617a[_0x09bf('0xc')],_0x4aa235);})['then'](function(_0x7a807f){_0x45032e=_0x7a807f;logger['info'](_0x09bf('0x57'),_0x45032e['id']);return getEndUser(_0x5b6abe,_0xf526fa[_0x09bf('0x6d')],_0xf526fa['destcalleridnum'],_0x4aa235);})[_0x09bf('0x2c')](function(_0xcc2c3f){_0x2b245a=_0xcc2c3f;logger['info'](_0x09bf('0x5a'),_0x2b245a['id']);return getTicket(_0x5b6abe,_0x45032e,_0x2b245a,_0x449707,_0xf526fa,_0x449707['Fields'],_0x4aa235,_0x09bf('0x6e'));})[_0x09bf('0x2c')](function(_0x1d36b9){_0x5ea0a4=_0x1d36b9;logger['info'](_0x09bf('0x5c'));logger[_0x09bf('0xa')](_0x09bf('0x5d'),_0x5ea0a4['id']);return setRelationship(_0x4aa235,_0x45032e,_0x5ea0a4,_0x09bf('0x5e'));})[_0x09bf('0x2c')](function(){return setRelationship(_0x4aa235,_0x2b245a,_0x5ea0a4,'contacts');})['then'](function(){return getServerInfo(_0x4aa235);})[_0x09bf('0x2c')](function(_0x4b5ad2){var _0x3f9cb2=parseInt(_0x4b5ad2[_0x09bf('0x6f')][_0x09bf('0x60')](0x0));var _0x583a74=util[_0x09bf('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5b6abe[_0x09bf('0x4e')],_0x5ea0a4['id']);if(_0x3f9cb2>0x6){_0x583a74=util['format'](_0x09bf('0x61'),_0x5b6abe[_0x09bf('0x4e')],_0x5ea0a4['id']);}logger['info'](_0x09bf('0x6b'),_0x09bf('0x62'));emit(util[_0x09bf('0x23')](_0x09bf('0x63'),_0x35617a[_0x09bf('0xc')]),_0x09bf('0x64'),{'uri':_0x583a74});})[_0x09bf('0x65')](function(_0x2a862f){logger['error'](_0x09bf('0x6b'),JSON[_0x09bf('0x29')](_0x2a862f));});};exports[_0x09bf('0x70')]=function(_0x49f9cf,_0xadf35b,_0x1ccb86,_0x47220c,_0x1d1218,_0x323da4){var _0x333a3b,_0x3681cc,_0x31df7e,_0x438194;_0x323da4['remoteUri']=intUtil[_0x09bf('0x4f')](_0x323da4[_0x09bf('0x4e')]);_0x323da4['serverUrl']=intUtil[_0x09bf('0x4f')](_0x323da4[_0x09bf('0x50')]);def[_0x09bf('0x51')]=util[_0x09bf('0x23')](_0x09bf('0x68'),_0x323da4['remoteUri']);if(_0x1d1218&&_0x1d1218[_0x09bf('0x52')]){logger[_0x09bf('0xa')]('['+_0xadf35b[_0x09bf('0x71')]['toUpperCase']()+']',_0x09bf('0x54'));_0xadf35b[_0x09bf('0x55')]=util[_0x09bf('0x23')](_0x09bf('0x56'),_0x323da4[_0x09bf('0x50')],_0xadf35b[_0x09bf('0x6c')],md5(_0xadf35b['uniqueid']));}else{_0xadf35b['recordingURL']='';}return getConnection(_0x323da4)[_0x09bf('0x2c')](function(_0xccb536){_0x438194=_0xccb536;if(!_[_0x09bf('0x72')](_0x47220c)){return getUser(_0x323da4,_0x47220c[_0x09bf('0xc')],_0x438194);}else{return getUser(_0x323da4,null,_0x438194);}})['then'](function(_0x5a07e1){_0x333a3b=_0x5a07e1;logger[_0x09bf('0xa')](_0x09bf('0x57'),_0x333a3b['id']);return getEndUser(_0x323da4,_0xadf35b[_0x09bf('0x58')],_0xadf35b[_0x09bf('0x59')],_0x438194);})[_0x09bf('0x2c')](function(_0x3e615e){_0x3681cc=_0x3e615e;logger[_0x09bf('0xa')](_0x09bf('0x5a'),_0x3681cc['id']);return getTicket(_0x323da4,_0x333a3b,_0x3681cc,_0x1ccb86,_0xadf35b,_0x1ccb86[_0x09bf('0x73')],_0x438194,_0x09bf('0x5b'));})[_0x09bf('0x2c')](function(_0xfbf867){_0x31df7e=_0xfbf867;logger[_0x09bf('0xa')](_0x09bf('0x5c'));logger['info'](_0x09bf('0x5d'),_0x31df7e['id']);return setRelationship(_0x438194,_0x333a3b,_0x31df7e,_0x09bf('0x5e'));})[_0x09bf('0x2c')](function(){return setRelationship(_0x438194,_0x3681cc,_0x31df7e,_0x09bf('0x5f'));})[_0x09bf('0x2c')](function(){return getServerInfo(_0x438194);})[_0x09bf('0x65')](function(_0x478a31){logger[_0x09bf('0x66')]('['+_0xadf35b[_0x09bf('0x71')]['toUpperCase']()+']',JSON[_0x09bf('0x29')](_0x478a31));});}; \ No newline at end of file +var _0xad9a=['user_name','then','entry_list','name_value_list','value','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','find','Enduser\x20found!','first_name','','Enduser\x20created.','[HTTP]','merge','map','customField','toLowerCase','content','type','custom_fields','toString','variable','customVariable','Variable','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200'];(function(_0x3886cd,_0x29552c){var _0x2e2af9=function(_0x47b8e3){while(--_0x47b8e3){_0x3886cd['push'](_0x3886cd['shift']());}};_0x2e2af9(++_0x29552c);}(_0xad9a,0x1bb));var _0xaad9=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xad9a[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xaad9('0x0'));var rp=require(_0xaad9('0x1'));var BPromise=require(_0xaad9('0x2'));var md5=require('md5');var util=require(_0xaad9('0x3'));var Redis=require(_0xaad9('0x4'));var intUtil=require(_0xaad9('0x5'));var config=require(_0xaad9('0x6'));var logger=require(_0xaad9('0x7'))('sugarcrm');config['redis']=_[_0xaad9('0x8')](config[_0xaad9('0x9')],{'host':_0xaad9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaad9('0x9')]));var def={'method':_0xaad9('0xb'),'json':!![]};function emit(_0x507782,_0x3cc7d4,_0x594a72){io['to'](_0x507782)[_0xaad9('0xc')](_0x3cc7d4,_0x594a72);}function getTicket(_0x5031b9,_0x720d81,_0x1ad7f2,_0x439b13,_0x394d7c,_0x44be92,_0x109e0b,_0x31bca4){logger[_0xaad9('0xd')](_0xaad9('0xe'));var _0x217009=new Date();var _0x52a83b=[{'name':'name','value':intUtil[_0xaad9('0xf')](_0x439b13[_0xaad9('0x10')],_0x394d7c,'\x20')},{'name':_0xaad9('0x11'),'value':_0x720d81['id']},{'name':_0xaad9('0x12'),'value':_0x720d81['id']},{'name':_0xaad9('0x13'),'value':intUtil[_0xaad9('0xf')](_0x439b13[_0xaad9('0x14')],_0x394d7c,'\x0a')},{'name':_0xaad9('0x15'),'value':_0x217009[_0xaad9('0x16')]()[_0xaad9('0x17')](0x0,0x13)[_0xaad9('0x18')]('T','\x20')},{'name':_0xaad9('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xaad9('0x1a'),'value':_0x1ad7f2['id']},{'name':'parent_type','value':_0xaad9('0x1b')},{'name':_0xaad9('0x1c'),'value':_0x1ad7f2[_0xaad9('0x1d')]},{'name':_0xaad9('0x1e'),'value':_0x31bca4}];if(_0x44be92[_0xaad9('0x1f')]){_[_0xaad9('0x20')](_0x44be92,function(_0x345238){if(_0x394d7c[_0x345238[_0xaad9('0x21')]]){_0x52a83b[_0xaad9('0x22')]({'name':_0x345238[_0xaad9('0x23')],'value':_0x394d7c[_0x345238[_0xaad9('0x21')]]});}});}return request({'form':{'method':_0xaad9('0x24'),'input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON[_0xaad9('0x26')]({'session':_0x109e0b['id'],'module_name':'Calls','name_value_list':_0x52a83b})}});}function getAuth(_0xdcdaeb){return util[_0xaad9('0x27')](_0xaad9('0x28'),new Buffer(_0xdcdaeb[_0xaad9('0x29')]+':X')['toString'](_0xaad9('0x2a')));}function getServerInfo(_0x2702b3){return request({'form':{'method':_0xaad9('0x2b'),'input_type':'JSON','response_type':_0xaad9('0x25'),'rest_data':JSON['stringify']({'session':_0x2702b3['id']})}});}function getUser(_0x504833,_0x13f541,_0x4ad0eb){if(!_[_0xaad9('0x2c')](_0x13f541)){logger[_0xaad9('0xd')](_0xaad9('0x2d'),_0x13f541);return request({'form':{'method':_0xaad9('0x2e'),'input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON['stringify']({'session':_0x4ad0eb['id'],'module_name':_0xaad9('0x2f'),'query':util[_0xaad9('0x27')](_0xaad9('0x30'),_0x13f541),'order_by':'','offset':'0','select_fields':['id','name',_0xaad9('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaad9('0x32')](function(_0x412f98){if(_0x412f98[_0xaad9('0x33')][_0xaad9('0x1f')]){var _0x22428c=_['find'](_0x412f98[_0xaad9('0x33')],function(_0x1e62ab){return _0x1e62ab[_0xaad9('0x34')]['user_name'][_0xaad9('0x35')]===_0x13f541;});if(_0x22428c){logger[_0xaad9('0xd')]('Agent\x20found!');return BPromise[_0xaad9('0x36')]({'id':_0x22428c[_0xaad9('0x34')]['id'][_0xaad9('0x35')],'name':_0x22428c[_0xaad9('0x34')][_0xaad9('0x1d')][_0xaad9('0x35')]});}}logger[_0xaad9('0xd')](_0xaad9('0x37'));return BPromise[_0xaad9('0x36')]({'id':_0x4ad0eb[_0xaad9('0x34')][_0xaad9('0x38')][_0xaad9('0x35')],'name':_0x4ad0eb['name_value_list'][_0xaad9('0x31')]['value']});});}else{logger['info'](_0xaad9('0x39'));return BPromise[_0xaad9('0x36')]({'id':_0x4ad0eb[_0xaad9('0x34')][_0xaad9('0x38')][_0xaad9('0x35')],'name':_0x4ad0eb[_0xaad9('0x34')]['user_name'][_0xaad9('0x35')]});}}function getEndUser(_0x45df3c,_0xc9d6a3,_0x234344,_0x118e24){logger['info'](_0xaad9('0x3a'),_0x234344);return request({'form':{'method':'get_entry_list','input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON[_0xaad9('0x26')]({'session':_0x118e24['id'],'module_name':_0xaad9('0x1b'),'query':util['format'](_0xaad9('0x3b'),_0x234344),'order_by':'','offset':'0','select_fields':['id',_0xaad9('0x1d'),_0xaad9('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaad9('0x32')](function(_0x577bdc){if(_0x577bdc[_0xaad9('0x33')][_0xaad9('0x1f')]){var _0x4b8229=_[_0xaad9('0x3d')](_0x577bdc['entry_list'],function(_0x5ca789){return _0x5ca789['name_value_list']['phone_home'][_0xaad9('0x35')]===_0x234344;});if(_0x4b8229){logger[_0xaad9('0xd')](_0xaad9('0x3e'));return BPromise[_0xaad9('0x36')]({'id':_0x4b8229['name_value_list']['id'][_0xaad9('0x35')],'name':_0x4b8229[_0xaad9('0x34')][_0xaad9('0x1d')][_0xaad9('0x35')],'phone':_0x4b8229['name_value_list']['phone_home'][_0xaad9('0x35')]});}}else{logger[_0xaad9('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xaad9('0x24'),'input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON[_0xaad9('0x26')]({'session':_0x118e24['id'],'module_name':_0xaad9('0x1b'),'name_value_list':[{'name':_0xaad9('0x3f'),'value':_0xc9d6a3!==_0xaad9('0x40')?_0xc9d6a3:util['format']('Caller\x20-\x20%s',_0x234344)},{'name':_0xaad9('0x3c'),'value':_0x234344}]})}})[_0xaad9('0x32')](function(_0x5e1436){logger[_0xaad9('0xd')](_0xaad9('0x41'));return BPromise['resolve']({'id':_0x5e1436['id'],'name':_0x5e1436['entry_list'][_0xaad9('0x3f')][_0xaad9('0x35')],'phone':_0x5e1436[_0xaad9('0x33')][_0xaad9('0x3c')][_0xaad9('0x35')]});});}});}function request(_0x24d63a){logger['debug'](_0xaad9('0x42'),JSON[_0xaad9('0x26')](_0x24d63a));return rp(_[_0xaad9('0x43')](def,_0x24d63a));}function getTags(_0x5d0836,_0x4b8240){var _0x335bd5=[];if(_0x5d0836&&_0x5d0836[_0xaad9('0x1f')]>0x0){_0x335bd5=_[_0xaad9('0x44')](_0x5d0836,_0x4b8240);}return _0x335bd5;}function getCustomFields(_0x20a86b,_0xa19bbb){var _0x3c1454=[];var _0x3ae522={'custom_fields':[]};if(_0x20a86b['length']>0x0){_[_0xaad9('0x20')](_0x20a86b,function(_0x316a62){if(_0x316a62['type']==='string'&&_0x316a62['nameField']&&!_0x316a62[_0xaad9('0x45')]){_0x3ae522[_0x316a62['nameField'][_0xaad9('0x46')]()]=_0x316a62[_0xaad9('0x47')]['toString']();}else if(_0x316a62[_0xaad9('0x48')]==='string'&&_0x316a62[_0xaad9('0x23')]&&_0x316a62[_0xaad9('0x45')]){_0x3ae522[_0xaad9('0x49')][_0xaad9('0x22')]({'id':_0x316a62['idField'],'value':_0x316a62[_0xaad9('0x47')][_0xaad9('0x4a')]()});}else if(_0x316a62[_0xaad9('0x48')]===_0xaad9('0x4b')&&_0x316a62[_0xaad9('0x21')]&&_0x316a62[_0xaad9('0x23')]&&_0x316a62['customField']){_0xa19bbb[_0x316a62[_0xaad9('0x21')]]&&_0x3ae522['custom_fields'][_0xaad9('0x22')]({'id':_0x316a62[_0xaad9('0x23')],'value':_0xa19bbb[_0x316a62[_0xaad9('0x21')]][_0xaad9('0x4a')]()});}else if(_0x316a62[_0xaad9('0x48')]===_0xaad9('0x4c')&&_0x316a62[_0xaad9('0x4d')]&&_0x316a62[_0xaad9('0x4d')][_0xaad9('0x1d')]&&_0x316a62[_0xaad9('0x23')]&&_0x316a62[_0xaad9('0x45')]){_0xa19bbb[_0x316a62['Variable'][_0xaad9('0x1d')][_0xaad9('0x46')]()]&&_0x3ae522[_0xaad9('0x49')][_0xaad9('0x22')]({'id':_0x316a62['idField'],'value':_0xa19bbb[_0x316a62[_0xaad9('0x4d')][_0xaad9('0x1d')]['toLowerCase']()][_0xaad9('0x4a')]()});}});}return _0x3ae522;}function getConnection(_0x68345e){return request({'method':_0xaad9('0xb'),'form':{'method':'login','input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x68345e['username'],'password':_0x68345e[_0xaad9('0x4e')],'encryption':'PLAIN'},'application':_0xaad9('0x4f')})}})['then'](function(_0x557a05){var _0x84bfb1=_0x557a05;if(_0x84bfb1['id']){def[_0xaad9('0x50')]=_0x84bfb1['id'];return BPromise[_0xaad9('0x36')](_0x84bfb1);}else{throw new Error(util[_0xaad9('0x27')](_0xaad9('0x51'),_0x68345e['id']));}});}function setRelationship(_0x4884fc,_0x127bb3,_0x24d145,_0x2f179e){return request({'form':{'method':_0xaad9('0x52'),'input_type':_0xaad9('0x25'),'response_type':_0xaad9('0x25'),'rest_data':JSON[_0xaad9('0x26')]({'session':_0x4884fc['id'],'module_name':_0xaad9('0x53'),'module_id':_0x24d145['id'],'link_field_name':_0x2f179e,'related_ids':[_0x127bb3['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5c4507,_0x2cfa45,_0x4de29d,_0x30f917,_0x19d9a0,_0x1880e4){var _0x3539b8,_0x5d0cfc,_0x57fbf2,_0x1fe25d;_0x1880e4[_0xaad9('0x54')]=intUtil[_0xaad9('0x55')](_0x1880e4[_0xaad9('0x54')]);_0x1880e4[_0xaad9('0x56')]=intUtil['stripTrailingSlash'](_0x1880e4[_0xaad9('0x56')]);def[_0xaad9('0x57')]=util[_0xaad9('0x27')](_0xaad9('0x58'),_0x1880e4[_0xaad9('0x54')]);if(_0x19d9a0&&_0x19d9a0[_0xaad9('0x59')]){logger['info'](_0xaad9('0x5a'),'Recording\x20is\x20enabled!');_0x2cfa45['recordingURL']=util[_0xaad9('0x27')](_0xaad9('0x5b'),_0x1880e4[_0xaad9('0x56')],_0x2cfa45['uniqueid'],md5(_0x2cfa45[_0xaad9('0x5c')]));}else{_0x2cfa45[_0xaad9('0x5d')]='';}return getConnection(_0x1880e4)[_0xaad9('0x32')](function(_0x1ae451){_0x1fe25d=_0x1ae451;return getUser(_0x1880e4,_0x30f917[_0xaad9('0x1d')],_0x1fe25d);})[_0xaad9('0x32')](function(_0x380638){_0x3539b8=_0x380638;logger[_0xaad9('0xd')]('The\x20User\x20ID\x20is:',_0x3539b8['id']);return getEndUser(_0x1880e4,_0x2cfa45[_0xaad9('0x5e')],_0x2cfa45['calleridnum'],_0x1fe25d);})[_0xaad9('0x32')](function(_0x1cbc56){_0x5d0cfc=_0x1cbc56;logger['info'](_0xaad9('0x5f'),_0x5d0cfc['id']);return getTicket(_0x1880e4,_0x3539b8,_0x5d0cfc,_0x4de29d,_0x2cfa45,_0x4de29d[_0xaad9('0x60')],_0x1fe25d,_0xaad9('0x61'));})[_0xaad9('0x32')](function(_0x568f18){_0x57fbf2=_0x568f18;logger[_0xaad9('0xd')](_0xaad9('0x62'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x57fbf2['id']);return setRelationship(_0x1fe25d,_0x3539b8,_0x57fbf2,_0xaad9('0x63'));})[_0xaad9('0x32')](function(){return setRelationship(_0x1fe25d,_0x5d0cfc,_0x57fbf2,_0xaad9('0x64'));})[_0xaad9('0x32')](function(){return getServerInfo(_0x1fe25d);})[_0xaad9('0x32')](function(_0x10958e){var _0x5c560d=parseInt(_0x10958e[_0xaad9('0x65')][_0xaad9('0x66')](0x0));var _0x33e423=util[_0xaad9('0x27')](_0xaad9('0x67'),_0x1880e4[_0xaad9('0x54')],_0x57fbf2['id']);if(_0x5c560d>0x6){_0x33e423=util[_0xaad9('0x27')](_0xaad9('0x68'),_0x1880e4[_0xaad9('0x54')],_0x57fbf2['id']);}logger[_0xaad9('0xd')](_0xaad9('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaad9('0x27')](_0xaad9('0x69'),_0x30f917[_0xaad9('0x1d')]),_0xaad9('0x6a'),{'uri':_0x33e423});})['catch'](function(_0x5d807a){logger[_0xaad9('0x6b')]('[QUEUE]',JSON[_0xaad9('0x26')](_0x5d807a));});};exports['outbound']=function(_0x17106d,_0x49b51a,_0x33d3f8,_0x498c83,_0x134d3d,_0x236133,_0x4df2c9){var _0x1df0a4,_0x46d4ca,_0x1867c2,_0x11b098;_0x236133[_0xaad9('0x54')]=intUtil[_0xaad9('0x55')](_0x236133[_0xaad9('0x54')]);_0x236133['serverUrl']=intUtil['stripTrailingSlash'](_0x236133[_0xaad9('0x56')]);def[_0xaad9('0x57')]=util[_0xaad9('0x27')](_0xaad9('0x58'),_0x236133[_0xaad9('0x54')]);if(_0x4df2c9&&_0x4df2c9[_0xaad9('0x6c')]&&_0x4df2c9['recordingFormat']!==_0xaad9('0x6d')){logger[_0xaad9('0xd')]('[OUTBOUND]',_0xaad9('0x6e'));_0x49b51a[_0xaad9('0x5d')]=util[_0xaad9('0x27')](_0xaad9('0x5b'),_0x236133[_0xaad9('0x56')],_0x49b51a['uniqueid'],md5(_0x49b51a[_0xaad9('0x5c')]));}return getConnection(_0x236133)[_0xaad9('0x32')](function(_0x597d42){_0x11b098=_0x597d42;return getUser(_0x236133,_0x498c83[_0xaad9('0x1d')],_0x11b098);})[_0xaad9('0x32')](function(_0x108f68){_0x1df0a4=_0x108f68;logger['info'](_0xaad9('0x6f'),_0x1df0a4['id']);return getEndUser(_0x236133,_0x49b51a[_0xaad9('0x70')],_0x49b51a[_0xaad9('0x71')],_0x11b098);})[_0xaad9('0x32')](function(_0x1ce3a2){_0x46d4ca=_0x1ce3a2;logger[_0xaad9('0xd')]('The\x20Enduser\x20ID\x20is:',_0x46d4ca['id']);return getTicket(_0x236133,_0x1df0a4,_0x46d4ca,_0x33d3f8,_0x49b51a,_0x33d3f8[_0xaad9('0x60')],_0x11b098,_0xaad9('0x72'));})[_0xaad9('0x32')](function(_0x5660cf){_0x1867c2=_0x5660cf;logger[_0xaad9('0xd')]('Ticket\x20created!');logger[_0xaad9('0xd')](_0xaad9('0x73'),_0x1867c2['id']);return setRelationship(_0x11b098,_0x1df0a4,_0x1867c2,_0xaad9('0x63'));})['then'](function(){return setRelationship(_0x11b098,_0x46d4ca,_0x1867c2,'contacts');})['then'](function(){return getServerInfo(_0x11b098);})['then'](function(_0x515b93){var _0x3f6bd2=parseInt(_0x515b93[_0xaad9('0x65')][_0xaad9('0x66')](0x0));var _0x4d41f0=util[_0xaad9('0x27')](_0xaad9('0x67'),_0x236133[_0xaad9('0x54')],_0x1867c2['id']);if(_0x3f6bd2>0x6){_0x4d41f0=util[_0xaad9('0x27')](_0xaad9('0x68'),_0x236133['remoteUri'],_0x1867c2['id']);}logger[_0xaad9('0xd')]('[OUTBOUND]',_0xaad9('0x74'));emit(util[_0xaad9('0x27')]('user:%s',_0x498c83['name']),_0xaad9('0x6a'),{'uri':_0x4d41f0});})[_0xaad9('0x75')](function(_0xccd2ff){logger[_0xaad9('0x6b')](_0xaad9('0x76'),JSON['stringify'](_0xccd2ff));});};exports[_0xaad9('0x77')]=function(_0x5af137,_0x593e77,_0xeeb75f,_0x1c69f1,_0x31c05c,_0x4f3aa5){var _0x196676,_0x2bda04,_0x22967c,_0x498088;_0x4f3aa5['remoteUri']=intUtil[_0xaad9('0x55')](_0x4f3aa5[_0xaad9('0x54')]);_0x4f3aa5[_0xaad9('0x56')]=intUtil[_0xaad9('0x55')](_0x4f3aa5[_0xaad9('0x56')]);def[_0xaad9('0x57')]=util['format'](_0xaad9('0x58'),_0x4f3aa5[_0xaad9('0x54')]);if(_0x31c05c&&_0x31c05c[_0xaad9('0x59')]){logger[_0xaad9('0xd')]('['+_0x593e77[_0xaad9('0x78')][_0xaad9('0x79')]()+']',_0xaad9('0x6e'));_0x593e77[_0xaad9('0x5d')]=util['format'](_0xaad9('0x5b'),_0x4f3aa5[_0xaad9('0x56')],_0x593e77[_0xaad9('0x5c')],md5(_0x593e77[_0xaad9('0x5c')]));}else{_0x593e77[_0xaad9('0x5d')]='';}return getConnection(_0x4f3aa5)[_0xaad9('0x32')](function(_0x4cb199){_0x498088=_0x4cb199;if(!_[_0xaad9('0x2c')](_0x1c69f1)){return getUser(_0x4f3aa5,_0x1c69f1['name'],_0x498088);}else{return getUser(_0x4f3aa5,null,_0x498088);}})[_0xaad9('0x32')](function(_0xa770e1){_0x196676=_0xa770e1;logger['info'](_0xaad9('0x6f'),_0x196676['id']);return getEndUser(_0x4f3aa5,_0x593e77[_0xaad9('0x5e')],_0x593e77[_0xaad9('0x7a')],_0x498088);})['then'](function(_0x3f3d5e){_0x2bda04=_0x3f3d5e;logger['info'](_0xaad9('0x5f'),_0x2bda04['id']);return getTicket(_0x4f3aa5,_0x196676,_0x2bda04,_0xeeb75f,_0x593e77,_0xeeb75f[_0xaad9('0x60')],_0x498088,_0xaad9('0x61'));})[_0xaad9('0x32')](function(_0x4ad1b3){_0x22967c=_0x4ad1b3;logger['info']('Ticket\x20created!');logger[_0xaad9('0xd')](_0xaad9('0x73'),_0x22967c['id']);return setRelationship(_0x498088,_0x196676,_0x22967c,_0xaad9('0x63'));})[_0xaad9('0x32')](function(){return setRelationship(_0x498088,_0x2bda04,_0x22967c,_0xaad9('0x64'));})['then'](function(){return getServerInfo(_0x498088);})[_0xaad9('0x75')](function(_0x3d4000){logger[_0xaad9('0x6b')]('['+_0x593e77['lastevent'][_0xaad9('0x79')]()+']',JSON[_0xaad9('0x26')](_0x3d4000));});}; \ 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 c56117d..f271897 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 _0x214b=['getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','slice','substring','lastIndexOf','isNil','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x214b,0x136));var _0xb214=function(_0x2d9a15,_0x2eb95d){_0x2d9a15=_0x2d9a15-0x0;var _0x52885c=_0x214b[_0x2d9a15];return _0x52885c;};'use strict';var _=require(_0xb214('0x0'));var util=require(_0xb214('0x1'));exports[_0xb214('0x2')]=function(_0x13082f,_0x5c4cab,_0x2cad15){var _0xc2dcd7=[];if(_0x13082f[_0xb214('0x3')]>0x0){var _0x3512f8=_[_0xb214('0x4')](_0x13082f,['id']);for(var _0x38bfaf=0x0;_0x38bfaf<_0x3512f8[_0xb214('0x3')];_0x38bfaf++){var _0x453aec=_0x3512f8[_0x38bfaf];if(_0x453aec[_0xb214('0x5')]===_0xb214('0x6')){_0xc2dcd7[_0xb214('0x7')](_0x453aec['content']);}else if(_0x453aec[_0xb214('0x5')]===_0xb214('0x8')&&_0x453aec[_0xb214('0x9')]){_0x5c4cab[_0x453aec[_0xb214('0x9')]]&&_0xc2dcd7[_0xb214('0x7')](_0x5c4cab[_0x453aec[_0xb214('0x9')]][_0xb214('0xa')]());}else if(_0x453aec[_0xb214('0x5')]===_0xb214('0xb')&&_0x453aec['Variable']&&_0x453aec['Variable']['name']){_0x5c4cab[_0x453aec[_0xb214('0xc')][_0xb214('0xd')][_0xb214('0xe')]()]&&_0xc2dcd7['push'](_0x5c4cab[_0x453aec[_0xb214('0xc')]['name'][_0xb214('0xe')]()]['toString']());}else if(_0x453aec[_0xb214('0x5')]==='keyValue'){if(_0x453aec[_0xb214('0xf')]===_0xb214('0x6')&&_0x453aec[_0xb214('0x10')]){_0xc2dcd7['push'](util[_0xb214('0x11')](_0xb214('0x12'),_0x453aec['key'],_0x453aec[_0xb214('0x13')]));}else if(_0x453aec['keyType']===_0xb214('0x8')&&_0x453aec[_0xb214('0x9')]&&_0x453aec['key']){_0x5c4cab[_0x453aec[_0xb214('0x9')]]&&_0xc2dcd7[_0xb214('0x7')](util[_0xb214('0x11')]('%s:\x20%s',_0x453aec[_0xb214('0x10')],_0x5c4cab[_0x453aec[_0xb214('0x9')]]));}else if(_0x453aec[_0xb214('0xf')]===_0xb214('0xb')&&_0x453aec[_0xb214('0xc')]&&_0x453aec[_0xb214('0xc')]['name']&&_0x453aec[_0xb214('0x10')]){_0x5c4cab[_0x453aec[_0xb214('0xc')][_0xb214('0xd')][_0xb214('0xe')]()]&&_0xc2dcd7[_0xb214('0x7')](util[_0xb214('0x11')]('%s:\x20%s',_0x453aec[_0xb214('0x10')],_0x5c4cab[_0x453aec[_0xb214('0xc')][_0xb214('0xd')]['toLowerCase']()]));}}}}return _0xc2dcd7['join'](_0x2cad15);};exports['stripTrailingSlash']=function(_0x25c7c3){var _0x2b5455=_0x25c7c3[_0xb214('0x14')](-0x1);if(_0x2b5455==='/'){_0x25c7c3=_0x25c7c3[_0xb214('0x15')](0x0,_0x25c7c3[_0xb214('0x16')](_0x2b5455));}return _0x25c7c3;};exports['validateEmail']=function(_0x245218){if(!_[_0xb214('0x17')](_0x245218)&&_0x245218!==''){var _0xa09a01=/^(([^<>()\[\]\\.,;:\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 _0xa09a01['test'](String(_0x245218)[_0xb214('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x7199=['customVariable','Variable','name','toLowerCase','push','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','substring','validateEmail','isNil','lodash','util','getString','length','type','string','variableName','toString'];(function(_0x3d7ffa,_0xfdebe){var _0xf22db7=function(_0x1c2ec6){while(--_0x1c2ec6){_0x3d7ffa['push'](_0x3d7ffa['shift']());}};_0xf22db7(++_0xfdebe);}(_0x7199,0x10c));var _0x9719=function(_0x2c2732,_0x1d1753){_0x2c2732=_0x2c2732-0x0;var _0x3d98a6=_0x7199[_0x2c2732];return _0x3d98a6;};'use strict';var _=require(_0x9719('0x0'));var util=require(_0x9719('0x1'));exports[_0x9719('0x2')]=function(_0x578e64,_0x23d5ba,_0x509a67){var _0x52f13c=[];if(_0x578e64[_0x9719('0x3')]>0x0){var _0x1bb947=_['sortBy'](_0x578e64,['id']);for(var _0x54b4ec=0x0;_0x54b4ec<_0x1bb947[_0x9719('0x3')];_0x54b4ec++){var _0x534681=_0x1bb947[_0x54b4ec];if(_0x534681[_0x9719('0x4')]===_0x9719('0x5')){_0x52f13c['push'](_0x534681['content']);}else if(_0x534681[_0x9719('0x4')]==='variable'&&_0x534681['variableName']){_0x23d5ba[_0x534681[_0x9719('0x6')]]&&_0x52f13c['push'](_0x23d5ba[_0x534681[_0x9719('0x6')]][_0x9719('0x7')]());}else if(_0x534681[_0x9719('0x4')]===_0x9719('0x8')&&_0x534681[_0x9719('0x9')]&&_0x534681['Variable'][_0x9719('0xa')]){_0x23d5ba[_0x534681['Variable'][_0x9719('0xa')][_0x9719('0xb')]()]&&_0x52f13c[_0x9719('0xc')](_0x23d5ba[_0x534681[_0x9719('0x9')][_0x9719('0xa')][_0x9719('0xb')]()][_0x9719('0x7')]());}else if(_0x534681[_0x9719('0x4')]==='keyValue'){if(_0x534681[_0x9719('0xd')]==='string'&&_0x534681[_0x9719('0xe')]){_0x52f13c[_0x9719('0xc')](util[_0x9719('0xf')]('%s:\x20%s',_0x534681['key'],_0x534681[_0x9719('0x10')]));}else if(_0x534681[_0x9719('0xd')]==='variable'&&_0x534681[_0x9719('0x6')]&&_0x534681[_0x9719('0xe')]){_0x23d5ba[_0x534681[_0x9719('0x6')]]&&_0x52f13c[_0x9719('0xc')](util[_0x9719('0xf')](_0x9719('0x11'),_0x534681[_0x9719('0xe')],_0x23d5ba[_0x534681[_0x9719('0x6')]]));}else if(_0x534681[_0x9719('0xd')]===_0x9719('0x8')&&_0x534681[_0x9719('0x9')]&&_0x534681['Variable']['name']&&_0x534681[_0x9719('0xe')]){_0x23d5ba[_0x534681[_0x9719('0x9')][_0x9719('0xa')][_0x9719('0xb')]()]&&_0x52f13c[_0x9719('0xc')](util['format'](_0x9719('0x11'),_0x534681[_0x9719('0xe')],_0x23d5ba[_0x534681[_0x9719('0x9')][_0x9719('0xa')]['toLowerCase']()]));}}}}return _0x52f13c[_0x9719('0x12')](_0x509a67);};exports[_0x9719('0x13')]=function(_0x39369c){var _0x2fd43d=_0x39369c['slice'](-0x1);if(_0x2fd43d==='/'){_0x39369c=_0x39369c[_0x9719('0x14')](0x0,_0x39369c['lastIndexOf'](_0x2fd43d));}return _0x39369c;};exports[_0x9719('0x15')]=function(_0x19d25a){if(!_[_0x9719('0x16')](_0x19d25a)&&_0x19d25a!==''){var _0x389e4c=/^(([^<>()\[\]\\.,;:\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 _0x389e4c['test'](String(_0x19d25a)[_0x9719('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 47a0cbf..5c70b9f 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 _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(_0x6d42f3,_0x19d2fc){var _0x221bb6=function(_0x41375d){while(--_0x41375d){_0x6d42f3['push'](_0x6d42f3['shift']());}};_0x221bb6(++_0x19d2fc);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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 +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2af710,_0x3590de){var _0x5ad56d=function(_0x50e513){while(--_0x50e513){_0x2af710['push'](_0x2af710['shift']());}};_0x5ad56d(++_0x3590de);}(_0xe706,0xa3));var _0x6e70=function(_0x5c693b,_0x19502d){_0x5c693b=_0x5c693b-0x0;var _0x4fd6f4=_0xe706[_0x5c693b];return _0x4fd6f4;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 7fada48..3c98c92 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 _0x3821=['user','Admin\x20account\x20selected.','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','custom_fields','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x3821,0x133));var _0x1382=function(_0x3a114f,_0x4618c7){_0x3a114f=_0x3a114f-0x0;var _0x415982=_0x3821[_0x3a114f];return _0x415982;};'use strict';var _=require('lodash');var rp=require(_0x1382('0x0'));var md5=require(_0x1382('0x1'));var util=require(_0x1382('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1382('0x3'));var config=require(_0x1382('0x4'));var logger=require(_0x1382('0x5'))(_0x1382('0x6'));config[_0x1382('0x7')]=_[_0x1382('0x8')](config[_0x1382('0x7')],{'host':_0x1382('0x9'),'port':0x18eb});var io=require(_0x1382('0xa'))(new Redis(config[_0x1382('0x7')]));function emit(_0x4aed78,_0x2b7dad,_0x514b97){io['to'](_0x4aed78)['emit'](_0x2b7dad,_0x514b97);}var headers={'Content-Type':'application/json','Accept':_0x1382('0xb')};function getTicket(_0x53011b,_0x631d76,_0x4e8be9,_0x3e322a,_0x333641){logger[_0x1382('0xc')](_0x1382('0xd'));return request({'uri':util[_0x1382('0xe')](_0x1382('0xf'),_0x53011b['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x4e8be9['id'],'submitter_id':_0x631d76?_0x631d76['id']:undefined,'assignee_id':_0x631d76?_0x631d76['id']:undefined,'tags':getTags(_0x3e322a[_0x1382('0x10')],_0x1382('0x11')),'subject':intUtil[_0x1382('0x12')](_0x3e322a[_0x1382('0x13')],_0x333641,'\x20'),'description':intUtil[_0x1382('0x12')](_0x3e322a[_0x1382('0x14')],_0x333641,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1382('0x12')](_0x3e322a[_0x1382('0x14')],_0x333641,'\x0a')}},getCustomFields(_0x3e322a[_0x1382('0x15')],_0x333641))}})[_0x1382('0x16')](function(_0xdb2f2b){logger[_0x1382('0xc')](_0x1382('0x17'));return _0xdb2f2b[_0x1382('0x18')];});}function getUser(_0x311287,_0xfa26d7){if(intUtil[_0x1382('0x19')](_0xfa26d7)){logger[_0x1382('0xc')](_0x1382('0x1a'),_0xfa26d7);return request({'uri':util['format'](_0x1382('0x1b'),_0x311287[_0x1382('0x1c')]),'qs':{'query':util[_0x1382('0xe')]('type:user\x20role:agent\x20email:%s',_0xfa26d7)}})['then'](function(_0x5b6f0a){if(_0x5b6f0a[_0x1382('0x1d')]){logger['info']('Agent\x20found!');return _[_0x1382('0x1e')](_0x5b6f0a[_0x1382('0x1f')],{'email':_0xfa26d7,'role':_0x1382('0x20')});}else{logger[_0x1382('0xc')](_0x1382('0x21'));return request({'uri':util[_0x1382('0xe')](_0x1382('0x22'),_0x311287[_0x1382('0x1c')])})[_0x1382('0x16')](function(_0xe118d8){logger['info']('Admin\x20account\x20selected.');return _0xe118d8[_0x1382('0x23')];});}});}else{logger[_0x1382('0xc')](_0x1382('0x21'));return request({'uri':util[_0x1382('0xe')](_0x1382('0x22'),_0x311287[_0x1382('0x1c')])})['then'](function(_0x3f0f73){logger[_0x1382('0xc')](_0x1382('0x24'));return _0x3f0f73['user'];});}}function getEndUser(_0x33b022,_0x44068,_0x3d91b7){logger[_0x1382('0xc')]('Searching\x20enduser\x20with\x20phone',_0x3d91b7);return request({'uri':util[_0x1382('0xe')]('%s/search.json',_0x33b022[_0x1382('0x1c')]),'qs':{'query':util[_0x1382('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x3d91b7)}})[_0x1382('0x16')](function(_0x1f390b){var _0x40afbe;if(_0x1f390b[_0x1382('0x1f')][_0x1382('0x25')]){_0x1f390b[_0x1382('0x1f')]=_[_0x1382('0x26')](_0x1f390b[_0x1382('0x1f')],{'suspended':![],'role':_0x1382('0x27')});if(_0x1f390b[_0x1382('0x1f')][_0x1382('0x25')]){_0x40afbe=_[_0x1382('0x28')](_0x1f390b[_0x1382('0x1f')]);}}if(_0x40afbe){logger['info'](_0x1382('0x29'));return _0x40afbe;}else{logger[_0x1382('0xc')](_0x1382('0x2a'));return request({'uri':util['format'](_0x1382('0x2b'),_0x33b022['remoteUri']),'method':_0x1382('0x2c'),'body':{'user':{'role':_0x1382('0x27'),'name':util[_0x1382('0xe')](_0x1382('0x2d'),_0x44068||_0x3d91b7),'phone':_0x3d91b7}}})[_0x1382('0x16')](function(_0x3ea7e1){logger[_0x1382('0xc')](_0x1382('0x2e'));return _0x3ea7e1[_0x1382('0x23')];});}});}function getAuth(_0x1f1c0f){var _0x1b3af3;if(_0x1f1c0f[_0x1382('0x2f')]===_0x1382('0x30')){_0x1b3af3=util['format'](_0x1382('0x31'),_0x1f1c0f[_0x1382('0x32')],_0x1f1c0f['password']);}else if(_0x1f1c0f[_0x1382('0x2f')]===_0x1382('0x33')){_0x1b3af3=util[_0x1382('0xe')](_0x1382('0x34'),_0x1f1c0f[_0x1382('0x32')],_0x1f1c0f['token']);}return util[_0x1382('0xe')](_0x1382('0x35'),new Buffer(_0x1b3af3)[_0x1382('0x36')](_0x1382('0x37')));}function request(_0x5d6bfd){logger[_0x1382('0x38')]('[HTTP]',JSON[_0x1382('0x39')](_0x5d6bfd));return rp(_['defaults'](_0x5d6bfd,{'method':_0x1382('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x4120a0,_0x46bd11){var _0x546a83=[];if(_0x4120a0&&_0x4120a0[_0x1382('0x25')]>0x0){_0x546a83=_['map'](_0x4120a0,_0x46bd11);}return _0x546a83;}function getCustomFields(_0xa46fc2,_0x34f07c){var _0x3a7116=[];var _0x4662cf={'custom_fields':[]};if(_0xa46fc2[_0x1382('0x25')]>0x0){_[_0x1382('0x3b')](_0xa46fc2,function(_0x162399){if(_[_0x1382('0x3c')]([_0x1382('0x3d'),_0x1382('0x3e')],_0x162399[_0x1382('0x3f')])&&_0x162399['nameField']&&!_0x162399[_0x1382('0x40')]){_0x4662cf[_0x162399[_0x1382('0x41')][_0x1382('0x42')]()]=_0x162399[_0x1382('0x43')][_0x1382('0x36')]();}else if(_['includes']([_0x1382('0x3d'),_0x1382('0x3e')],_0x162399[_0x1382('0x3f')])&&_0x162399[_0x1382('0x44')]&&_0x162399[_0x1382('0x40')]){_0x4662cf[_0x1382('0x45')]['push']({'id':_0x162399[_0x1382('0x44')],'value':_0x162399[_0x1382('0x43')][_0x1382('0x36')]()});}else if(_0x162399['type']===_0x1382('0x46')&&_0x162399['variableName']&&_0x162399[_0x1382('0x44')]&&_0x162399[_0x1382('0x40')]){_0x34f07c[_0x162399[_0x1382('0x47')]]&&_0x4662cf[_0x1382('0x45')][_0x1382('0x48')]({'id':_0x162399[_0x1382('0x44')],'value':_0x34f07c[_0x162399[_0x1382('0x47')]][_0x1382('0x36')]()});}else if(_0x162399['type']==='customVariable'&&_0x162399['Variable']&&_0x162399[_0x1382('0x49')][_0x1382('0x11')]&&_0x162399[_0x1382('0x44')]&&_0x162399[_0x1382('0x40')]){_0x34f07c[_0x162399['Variable'][_0x1382('0x11')][_0x1382('0x42')]()]&&_0x4662cf['custom_fields'][_0x1382('0x48')]({'id':_0x162399[_0x1382('0x44')],'value':_0x34f07c[_0x162399[_0x1382('0x49')][_0x1382('0x11')]['toLowerCase']()]['toString']()});}});}return _0x4662cf;}exports[_0x1382('0x4a')]=function(_0x2692af,_0x4f0aaa,_0x409183,_0x163f53,_0x3549a4,_0x2b8506){var _0x66b171,_0x2babae;_0x2b8506['remoteUri']=intUtil[_0x1382('0x4b')](_0x2b8506[_0x1382('0x1c')]);_0x2b8506['serverUrl']=intUtil['stripTrailingSlash'](_0x2b8506[_0x1382('0x4c')]);if(_0x3549a4&&_0x3549a4[_0x1382('0x4d')]){logger[_0x1382('0xc')]('[QUEUE]',_0x1382('0x4e'));_0x4f0aaa[_0x1382('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b8506[_0x1382('0x4c')],_0x4f0aaa['uniqueid'],md5(_0x4f0aaa['uniqueid']));}else{_0x4f0aaa[_0x1382('0x4f')]='';}headers[_0x1382('0x50')]=getAuth(_0x2b8506);return getUser(_0x2b8506,_0x163f53[_0x1382('0x51')])[_0x1382('0x16')](function(_0x1e9b9e){_0x66b171=_0x1e9b9e;logger['info'](_0x1382('0x52'),_0x66b171['id']);return getEndUser(_0x2b8506,_0x4f0aaa[_0x1382('0x53')],_0x4f0aaa[_0x1382('0x54')]);})[_0x1382('0x16')](function(_0x373d33){_0x2babae=_0x373d33;logger[_0x1382('0xc')](_0x1382('0x55'),_0x2babae['id']);return getTicket(_0x2b8506,_0x66b171,_0x2babae,_0x409183,_0x4f0aaa);})['then'](function(_0x2d189d){if(_0x2d189d){logger[_0x1382('0xc')](_0x1382('0x56'),_0x2d189d['id']);switch(_0x2b8506[_0x1382('0x3f')]){case _0x1382('0x57'):logger[_0x1382('0xc')]('[QUEUE]',_0x1382('0x58'));return request({'uri':util['format'](_0x1382('0x59'),_0x2b8506[_0x1382('0x1c')],_0x66b171['id'],_0x2d189d['id']),'method':'POST'});case _0x1382('0x5a'):logger['info'](_0x1382('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1382('0xe')](_0x1382('0x5c'),_0x163f53[_0x1382('0x11')]),_0x1382('0x5d'),{'uri':util['format']('%s/agent/tickets/%s',_0x2b8506[_0x1382('0x1c')]['replace']('/api/v2',''),_0x2d189d['id'])});break;default:logger[_0x1382('0x5e')](_0x1382('0x5b'),_0x1382('0x5f'));}}})[_0x1382('0x60')](function(_0xb6ac34){logger[_0x1382('0x5e')](_0x1382('0x61'),util['inspect'](_0xb6ac34,{'showHidden':!![],'depth':null}));});};exports[_0x1382('0x62')]=function(_0x29ad43,_0x5143a3,_0x5dd646,_0x4f6c9a,_0x1d9502,_0x411795,_0x4f923d){var _0x38f8d3,_0x2bf1c0;_0x411795[_0x1382('0x1c')]=intUtil['stripTrailingSlash'](_0x411795['remoteUri']);_0x411795[_0x1382('0x4c')]=intUtil['stripTrailingSlash'](_0x411795[_0x1382('0x4c')]);if(_0x4f923d&&_0x4f923d['recordingFormat']&&_0x4f923d[_0x1382('0x63')]!==_0x1382('0x64')){logger[_0x1382('0xc')](_0x1382('0x65'),_0x1382('0x4e'));_0x5143a3[_0x1382('0x4f')]=util['format'](_0x1382('0x66'),_0x411795[_0x1382('0x4c')],_0x5143a3[_0x1382('0x67')],md5(_0x5143a3[_0x1382('0x67')]));}headers[_0x1382('0x50')]=getAuth(_0x411795);return getUser(_0x411795,_0x4f6c9a[_0x1382('0x51')])[_0x1382('0x16')](function(_0x48f32b){_0x38f8d3=_0x48f32b;logger['info'](_0x1382('0x52'),_0x38f8d3['id']);return getEndUser(_0x411795,_0x5143a3['destcalleridname'],_0x5143a3[_0x1382('0x68')]);})['then'](function(_0x5831be){_0x2bf1c0=_0x5831be;logger[_0x1382('0xc')](_0x1382('0x55'),_0x2bf1c0['id']);return getTicket(_0x411795,_0x38f8d3,_0x2bf1c0,_0x5dd646,_0x5143a3);})[_0x1382('0x16')](function(_0x5edfe6){if(_0x5edfe6){logger[_0x1382('0xc')](_0x1382('0x56'),_0x5edfe6['id']);switch(_0x411795['type']){case'integrationTab':logger[_0x1382('0xc')](_0x1382('0x65'),_0x1382('0x58'));return request({'uri':util[_0x1382('0xe')](_0x1382('0x59'),_0x411795['remoteUri'],_0x38f8d3['id'],_0x5edfe6['id']),'method':_0x1382('0x2c')});case _0x1382('0x5a'):logger[_0x1382('0xc')](_0x1382('0x65'),_0x1382('0x69'));emit(util[_0x1382('0xe')](_0x1382('0x5c'),_0x4f6c9a['name']),_0x1382('0x5d'),{'uri':util['format'](_0x1382('0x6a'),_0x411795[_0x1382('0x1c')][_0x1382('0x6b')]('/api/v2',''),_0x5edfe6['id'])});break;default:logger[_0x1382('0x5e')](_0x1382('0x65'),_0x1382('0x5f'));}}})['catch'](function(_0x1e6205){logger['error'](_0x1382('0x6c'),util[_0x1382('0x6d')](_0x1e6205,{'showHidden':!![],'depth':null}));});};exports[_0x1382('0x6e')]=function(_0x2399d0,_0x2fbbd0,_0x2c92f1,_0x5d6252,_0x536720,_0x41b548){var _0x255736,_0x13be2a;_0x41b548[_0x1382('0x1c')]=intUtil[_0x1382('0x4b')](_0x41b548[_0x1382('0x1c')]);_0x41b548[_0x1382('0x4c')]=intUtil['stripTrailingSlash'](_0x41b548[_0x1382('0x4c')]);if(_0x536720&&_0x536720[_0x1382('0x4d')]){logger['info']('['+_0x2fbbd0[_0x1382('0x6f')][_0x1382('0x70')]()+']','Recording\x20is\x20enabled!');_0x2fbbd0[_0x1382('0x4f')]=util['format'](_0x1382('0x66'),_0x41b548[_0x1382('0x4c')],_0x2fbbd0[_0x1382('0x67')],md5(_0x2fbbd0[_0x1382('0x67')]));}else{_0x2fbbd0[_0x1382('0x4f')]='';}headers[_0x1382('0x50')]=getAuth(_0x41b548);return getUser(_0x41b548)[_0x1382('0x16')](function(_0x2e9c93){_0x255736=_0x2e9c93;logger['info']('The\x20User\x20ID\x20is:',_0x255736['id']);return getEndUser(_0x41b548,_0x2fbbd0[_0x1382('0x53')],_0x2fbbd0[_0x1382('0x54')]);})['then'](function(_0x387499){_0x13be2a=_0x387499;logger[_0x1382('0xc')](_0x1382('0x55'),_0x13be2a['id']);return getTicket(_0x41b548,_0x255736,_0x13be2a,_0x2c92f1,_0x2fbbd0);})['then'](function(_0xe610fc){if(_0xe610fc){logger[_0x1382('0xc')](_0x1382('0x56'),_0xe610fc['id']);}})[_0x1382('0x60')](function(_0x175c22){logger[_0x1382('0x5e')]('['+_0x2fbbd0[_0x1382('0x6f')][_0x1382('0x70')]()+']'+_0x1382('0x71'),util[_0x1382('0x6d')](_0x175c22,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8539=['Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','custom_fields','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','unmanaged','lastevent','toUpperCase','Authorization','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','ioredis','./util','../../../../config/logger','zendesk','defaults','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x8539,0x1a2));var _0x9853=function(_0x3942f9,_0x430841){_0x3942f9=_0x3942f9-0x0;var _0x36794d=_0x8539[_0x3942f9];return _0x36794d;};'use strict';var _=require('lodash');var rp=require(_0x9853('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x9853('0x1'));var intUtil=require(_0x9853('0x2'));var config=require('../../../../config/environment');var logger=require(_0x9853('0x3'))(_0x9853('0x4'));config['redis']=_[_0x9853('0x5')](config[_0x9853('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9853('0x7'))(new Redis(config[_0x9853('0x6')]));function emit(_0x4635dd,_0x5a0595,_0x27575e){io['to'](_0x4635dd)[_0x9853('0x8')](_0x5a0595,_0x27575e);}var headers={'Content-Type':_0x9853('0x9'),'Accept':_0x9853('0x9')};function getTicket(_0x1a592e,_0x41ffdd,_0x4af0c2,_0x5471,_0x104e94){logger[_0x9853('0xa')](_0x9853('0xb'));return request({'uri':util[_0x9853('0xc')](_0x9853('0xd'),_0x1a592e[_0x9853('0xe')]),'method':_0x9853('0xf'),'body':{'ticket':_[_0x9853('0x10')]({'requester_id':_0x4af0c2['id'],'submitter_id':_0x41ffdd?_0x41ffdd['id']:undefined,'assignee_id':_0x41ffdd?_0x41ffdd['id']:undefined,'tags':getTags(_0x5471[_0x9853('0x11')],_0x9853('0x12')),'subject':intUtil[_0x9853('0x13')](_0x5471[_0x9853('0x14')],_0x104e94,'\x20'),'description':intUtil[_0x9853('0x13')](_0x5471[_0x9853('0x15')],_0x104e94,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9853('0x13')](_0x5471['Descriptions'],_0x104e94,'\x0a')}},getCustomFields(_0x5471[_0x9853('0x16')],_0x104e94))}})['then'](function(_0x187f9e){logger[_0x9853('0xa')](_0x9853('0x17'));return _0x187f9e[_0x9853('0x18')];});}function getUser(_0x110e2b,_0x5197d7){if(intUtil[_0x9853('0x19')](_0x5197d7)){logger[_0x9853('0xa')](_0x9853('0x1a'),_0x5197d7);return request({'uri':util[_0x9853('0xc')](_0x9853('0x1b'),_0x110e2b[_0x9853('0xe')]),'qs':{'query':util[_0x9853('0xc')]('type:user\x20role:agent\x20email:%s',_0x5197d7)}})['then'](function(_0x56da04){if(_0x56da04[_0x9853('0x1c')]){logger[_0x9853('0xa')]('Agent\x20found!');return _[_0x9853('0x1d')](_0x56da04[_0x9853('0x1e')],{'email':_0x5197d7,'role':_0x9853('0x1f')});}else{logger['info'](_0x9853('0x20'));return request({'uri':util[_0x9853('0xc')]('%s/users/me.json',_0x110e2b[_0x9853('0xe')])})[_0x9853('0x21')](function(_0x419b76){logger[_0x9853('0xa')](_0x9853('0x22'));return _0x419b76[_0x9853('0x23')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9853('0xc')](_0x9853('0x24'),_0x110e2b[_0x9853('0xe')])})[_0x9853('0x21')](function(_0x56fdfe){logger[_0x9853('0xa')](_0x9853('0x22'));return _0x56fdfe[_0x9853('0x23')];});}}function getEndUser(_0x7f7d24,_0x515b85,_0x3bae97){logger['info'](_0x9853('0x25'),_0x3bae97);return request({'uri':util[_0x9853('0xc')]('%s/search.json',_0x7f7d24['remoteUri']),'qs':{'query':util[_0x9853('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x3bae97)}})['then'](function(_0x532f19){var _0x399d5b;if(_0x532f19[_0x9853('0x1e')][_0x9853('0x26')]){_0x532f19[_0x9853('0x1e')]=_[_0x9853('0x27')](_0x532f19['results'],{'suspended':![],'role':_0x9853('0x28')});if(_0x532f19['results']['length']){_0x399d5b=_[_0x9853('0x29')](_0x532f19['results']);}}if(_0x399d5b){logger[_0x9853('0xa')](_0x9853('0x2a'));return _0x399d5b;}else{logger[_0x9853('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x9853('0x2b'),_0x7f7d24[_0x9853('0xe')]),'method':_0x9853('0xf'),'body':{'user':{'role':_0x9853('0x28'),'name':util['format'](_0x9853('0x2c'),_0x515b85||_0x3bae97),'phone':_0x3bae97}}})[_0x9853('0x21')](function(_0x4aa513){logger['info'](_0x9853('0x2d'));return _0x4aa513['user'];});}});}function getAuth(_0x2af8e1){var _0x25d087;if(_0x2af8e1[_0x9853('0x2e')]===_0x9853('0x2f')){_0x25d087=util['format'](_0x9853('0x30'),_0x2af8e1[_0x9853('0x31')],_0x2af8e1[_0x9853('0x2f')]);}else if(_0x2af8e1[_0x9853('0x2e')]===_0x9853('0x32')){_0x25d087=util[_0x9853('0xc')](_0x9853('0x33'),_0x2af8e1[_0x9853('0x31')],_0x2af8e1['token']);}return util[_0x9853('0xc')](_0x9853('0x34'),new Buffer(_0x25d087)['toString'](_0x9853('0x35')));}function request(_0x369921){logger[_0x9853('0x36')]('[HTTP]',JSON[_0x9853('0x37')](_0x369921));return rp(_[_0x9853('0x5')](_0x369921,{'method':_0x9853('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x573040,_0x54a32d){var _0x521805=[];if(_0x573040&&_0x573040[_0x9853('0x26')]>0x0){_0x521805=_[_0x9853('0x39')](_0x573040,_0x54a32d);}return _0x521805;}function getCustomFields(_0x1cdb01,_0x39b476){var _0x5eb62f=[];var _0x85cb92={'custom_fields':[]};if(_0x1cdb01[_0x9853('0x26')]>0x0){_[_0x9853('0x3a')](_0x1cdb01,function(_0x128be4){if(_[_0x9853('0x3b')]([_0x9853('0x3c'),_0x9853('0x3d')],_0x128be4[_0x9853('0x3e')])&&_0x128be4[_0x9853('0x3f')]&&!_0x128be4[_0x9853('0x40')]){_0x85cb92[_0x128be4[_0x9853('0x3f')][_0x9853('0x41')]()]=_0x128be4['content'][_0x9853('0x42')]();}else if(_[_0x9853('0x3b')]([_0x9853('0x3c'),_0x9853('0x3d')],_0x128be4[_0x9853('0x3e')])&&_0x128be4[_0x9853('0x43')]&&_0x128be4['customField']){_0x85cb92[_0x9853('0x44')][_0x9853('0x45')]({'id':_0x128be4[_0x9853('0x43')],'value':_0x128be4[_0x9853('0x46')][_0x9853('0x42')]()});}else if(_0x128be4['type']===_0x9853('0x47')&&_0x128be4['variableName']&&_0x128be4['idField']&&_0x128be4[_0x9853('0x40')]){_0x39b476[_0x128be4[_0x9853('0x48')]]&&_0x85cb92['custom_fields'][_0x9853('0x45')]({'id':_0x128be4[_0x9853('0x43')],'value':_0x39b476[_0x128be4[_0x9853('0x48')]][_0x9853('0x42')]()});}else if(_0x128be4[_0x9853('0x3e')]==='customVariable'&&_0x128be4['Variable']&&_0x128be4['Variable']['name']&&_0x128be4[_0x9853('0x43')]&&_0x128be4[_0x9853('0x40')]){_0x39b476[_0x128be4[_0x9853('0x49')][_0x9853('0x12')]['toLowerCase']()]&&_0x85cb92[_0x9853('0x44')][_0x9853('0x45')]({'id':_0x128be4['idField'],'value':_0x39b476[_0x128be4[_0x9853('0x49')][_0x9853('0x12')]['toLowerCase']()]['toString']()});}});}return _0x85cb92;}exports[_0x9853('0x4a')]=function(_0xf51145,_0x47ee4e,_0x4f253f,_0x4d42c0,_0x4e71f0,_0x3a0a35){var _0x22eaf5,_0x30ea24;_0x3a0a35[_0x9853('0xe')]=intUtil[_0x9853('0x4b')](_0x3a0a35[_0x9853('0xe')]);_0x3a0a35[_0x9853('0x4c')]=intUtil['stripTrailingSlash'](_0x3a0a35[_0x9853('0x4c')]);if(_0x4e71f0&&_0x4e71f0[_0x9853('0x4d')]){logger['info'](_0x9853('0x4e'),'Recording\x20is\x20enabled!');_0x47ee4e[_0x9853('0x4f')]=util['format'](_0x9853('0x50'),_0x3a0a35[_0x9853('0x4c')],_0x47ee4e['uniqueid'],md5(_0x47ee4e[_0x9853('0x51')]));}else{_0x47ee4e[_0x9853('0x4f')]='';}headers['Authorization']=getAuth(_0x3a0a35);return getUser(_0x3a0a35,_0x4d42c0['email'])['then'](function(_0x2ff085){_0x22eaf5=_0x2ff085;logger[_0x9853('0xa')](_0x9853('0x52'),_0x22eaf5['id']);return getEndUser(_0x3a0a35,_0x47ee4e[_0x9853('0x53')],_0x47ee4e['calleridnum']);})[_0x9853('0x21')](function(_0x4845f9){_0x30ea24=_0x4845f9;logger[_0x9853('0xa')]('The\x20Enduser\x20ID\x20is:',_0x30ea24['id']);return getTicket(_0x3a0a35,_0x22eaf5,_0x30ea24,_0x4f253f,_0x47ee4e);})[_0x9853('0x21')](function(_0x1529e4){if(_0x1529e4){logger[_0x9853('0xa')](_0x9853('0x54'),_0x1529e4['id']);switch(_0x3a0a35[_0x9853('0x3e')]){case _0x9853('0x55'):logger[_0x9853('0xa')](_0x9853('0x4e'),_0x9853('0x56'));return request({'uri':util[_0x9853('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3a0a35['remoteUri'],_0x22eaf5['id'],_0x1529e4['id']),'method':_0x9853('0xf')});case'newTab':logger['info'](_0x9853('0x4e'),_0x9853('0x57'));emit(util[_0x9853('0xc')](_0x9853('0x58'),_0x4d42c0['name']),_0x9853('0x59'),{'uri':util[_0x9853('0xc')](_0x9853('0x5a'),_0x3a0a35[_0x9853('0xe')][_0x9853('0x5b')](_0x9853('0x5c'),''),_0x1529e4['id'])});break;default:logger[_0x9853('0x5d')](_0x9853('0x4e'),_0x9853('0x5e'));}}})[_0x9853('0x5f')](function(_0x1b4f1b){logger[_0x9853('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x9853('0x60')](_0x1b4f1b,{'showHidden':!![],'depth':null}));});};exports[_0x9853('0x61')]=function(_0x3408f3,_0x492e7f,_0x47bf59,_0x3fa458,_0x1eb69d,_0x7a5bf6,_0x8c7685){var _0x11e018,_0x2596b3;_0x7a5bf6[_0x9853('0xe')]=intUtil['stripTrailingSlash'](_0x7a5bf6[_0x9853('0xe')]);_0x7a5bf6[_0x9853('0x4c')]=intUtil[_0x9853('0x4b')](_0x7a5bf6[_0x9853('0x4c')]);if(_0x8c7685&&_0x8c7685[_0x9853('0x62')]&&_0x8c7685[_0x9853('0x62')]!==_0x9853('0x63')){logger[_0x9853('0xa')](_0x9853('0x64'),_0x9853('0x65'));_0x492e7f['recordingURL']=util[_0x9853('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x7a5bf6[_0x9853('0x4c')],_0x492e7f[_0x9853('0x51')],md5(_0x492e7f[_0x9853('0x51')]));}headers['Authorization']=getAuth(_0x7a5bf6);return getUser(_0x7a5bf6,_0x3fa458[_0x9853('0x66')])[_0x9853('0x21')](function(_0x2e2048){_0x11e018=_0x2e2048;logger['info'](_0x9853('0x52'),_0x11e018['id']);return getEndUser(_0x7a5bf6,_0x492e7f[_0x9853('0x67')],_0x492e7f['destcalleridnum']);})[_0x9853('0x21')](function(_0x1bdc19){_0x2596b3=_0x1bdc19;logger['info'](_0x9853('0x68'),_0x2596b3['id']);return getTicket(_0x7a5bf6,_0x11e018,_0x2596b3,_0x47bf59,_0x492e7f);})[_0x9853('0x21')](function(_0x11d31f){if(_0x11d31f){logger[_0x9853('0xa')](_0x9853('0x54'),_0x11d31f['id']);switch(_0x7a5bf6[_0x9853('0x3e')]){case _0x9853('0x55'):logger[_0x9853('0xa')](_0x9853('0x64'),_0x9853('0x56'));return request({'uri':util[_0x9853('0xc')](_0x9853('0x69'),_0x7a5bf6[_0x9853('0xe')],_0x11e018['id'],_0x11d31f['id']),'method':_0x9853('0xf')});case _0x9853('0x6a'):logger[_0x9853('0xa')](_0x9853('0x64'),_0x9853('0x57'));emit(util[_0x9853('0xc')](_0x9853('0x58'),_0x3fa458[_0x9853('0x12')]),_0x9853('0x59'),{'uri':util['format'](_0x9853('0x5a'),_0x7a5bf6[_0x9853('0xe')][_0x9853('0x5b')](_0x9853('0x5c'),''),_0x11d31f['id'])});break;default:logger[_0x9853('0x5d')](_0x9853('0x64'),_0x9853('0x5e'));}}})['catch'](function(_0x4e19bb){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x9853('0x60')](_0x4e19bb,{'showHidden':!![],'depth':null}));});};exports[_0x9853('0x6b')]=function(_0x45eb19,_0xeda20a,_0x1cd1cb,_0x27ea16,_0x47d12a,_0x3a20da){var _0x47b3ab,_0x474f2f;_0x3a20da[_0x9853('0xe')]=intUtil[_0x9853('0x4b')](_0x3a20da['remoteUri']);_0x3a20da[_0x9853('0x4c')]=intUtil[_0x9853('0x4b')](_0x3a20da['serverUrl']);if(_0x47d12a&&_0x47d12a['monitor_format']){logger['info']('['+_0xeda20a[_0x9853('0x6c')][_0x9853('0x6d')]()+']',_0x9853('0x65'));_0xeda20a[_0x9853('0x4f')]=util[_0x9853('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a20da[_0x9853('0x4c')],_0xeda20a[_0x9853('0x51')],md5(_0xeda20a[_0x9853('0x51')]));}else{_0xeda20a[_0x9853('0x4f')]='';}headers[_0x9853('0x6e')]=getAuth(_0x3a20da);return getUser(_0x3a20da)[_0x9853('0x21')](function(_0x269b43){_0x47b3ab=_0x269b43;logger[_0x9853('0xa')](_0x9853('0x52'),_0x47b3ab['id']);return getEndUser(_0x3a20da,_0xeda20a['calleridname'],_0xeda20a[_0x9853('0x6f')]);})[_0x9853('0x21')](function(_0x5440c3){_0x474f2f=_0x5440c3;logger[_0x9853('0xa')](_0x9853('0x68'),_0x474f2f['id']);return getTicket(_0x3a20da,_0x47b3ab,_0x474f2f,_0x1cd1cb,_0xeda20a);})[_0x9853('0x21')](function(_0xd31218){if(_0xd31218){logger['info'](_0x9853('0x54'),_0xd31218['id']);}})[_0x9853('0x5f')](function(_0x48a9ab){logger[_0x9853('0x5d')]('['+_0xeda20a['lastevent'][_0x9853('0x6d')]()+']'+_0x9853('0x70'),util[_0x9853('0x60')](_0x48a9ab,{'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 93d5884..621ca86 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 _0x08ce=['idField','content','variable','variableName','toString','customVariable','name','toLowerCase','Variable','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','data','details','enduserType','Error:\x20','log','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','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','host','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','emit','debug','[HTTP]','length','forEach','includes','string','type'];(function(_0x3c1591,_0x516caa){var _0x2e3603=function(_0x11dc39){while(--_0x11dc39){_0x3c1591['push'](_0x3c1591['shift']());}};_0x2e3603(++_0x516caa);}(_0x08ce,0x86));var _0xe08c=function(_0x86ee9c,_0xb532e8){_0x86ee9c=_0x86ee9c-0x0;var _0x4a66b2=_0x08ce[_0x86ee9c];return _0x4a66b2;};'use strict';var _=require(_0xe08c('0x0'));var rp=require(_0xe08c('0x1'));var md5=require(_0xe08c('0x2'));var util=require(_0xe08c('0x3'));var intUtil=require(_0xe08c('0x4'));var moment=require(_0xe08c('0x5'));var Redis=require(_0xe08c('0x6'));var BPromise=require(_0xe08c('0x7'));var config=require(_0xe08c('0x8'));var logger=require('../../../../config/logger')(_0xe08c('0x9'));config['redis']=_[_0xe08c('0xa')](config[_0xe08c('0xb')],{'host':_0xe08c('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe08c('0xb')]));function emit(_0x59775e,_0xcc812c,_0xd9c10){io['to'](_0x59775e)[_0xe08c('0xd')](_0xcc812c,_0xd9c10);}function request(_0x5679fd){logger[_0xe08c('0xe')](_0xe08c('0xf'),JSON['stringify'](_0x5679fd));return rp(_0x5679fd);}function getCustomFields(_0x5b724d,_0x317dff){var _0x12e500={};if(_0x5b724d[_0xe08c('0x10')]>0x0){_[_0xe08c('0x11')](_0x5b724d,function(_0x48caa8){if(_[_0xe08c('0x12')]([_0xe08c('0x13'),'picklist'],_0x48caa8[_0xe08c('0x14')])&&_0x48caa8[_0xe08c('0x15')]){_0x12e500[_0x48caa8[_0xe08c('0x15')]]=_0x48caa8[_0xe08c('0x16')]['toString']();}else if(_0x48caa8[_0xe08c('0x14')]===_0xe08c('0x17')&&_0x48caa8['variableName']&&_0x48caa8['idField']&&_0x317dff[_0x48caa8[_0xe08c('0x18')]]){_0x12e500[_0x48caa8[_0xe08c('0x15')]]=_0x317dff[_0x48caa8['variableName']][_0xe08c('0x19')]();}else if(_0x48caa8[_0xe08c('0x14')]===_0xe08c('0x1a')&&_0x48caa8['Variable']&&_0x48caa8['Variable'][_0xe08c('0x1b')]&&_0x48caa8[_0xe08c('0x15')]&&_0x317dff[_0x48caa8['Variable'][_0xe08c('0x1b')][_0xe08c('0x1c')]()]){_0x12e500[_0x48caa8[_0xe08c('0x15')]]=_0x317dff[_0x48caa8[_0xe08c('0x1d')]['name']['toLowerCase']()]['toString']();}});}return _0x12e500;}function getName(_0x4548a9){if(_0x4548a9[_0xe08c('0x1e')]('\x20')>0x0){var _0x5c18c1=_0x4548a9[_0xe08c('0x1f')](/ (.+)/);if(_0x5c18c1[0x1]){return _0x5c18c1;}}return[_0x4548a9,_0x4548a9];}var accountsTokens={};function getAccessToken(_0x3dd31d){return new Promise(function(_0xdfba54,_0x59d0e6){if(!_[_0xe08c('0x20')](accountsTokens[_0x3dd31d['id']])&&!_[_0xe08c('0x20')](accountsTokens[_0x3dd31d['id']][_0xe08c('0x21')])){if(moment()['isBefore'](accountsTokens[_0x3dd31d['id']][_0xe08c('0x22')])){_0xdfba54(accountsTokens[_0x3dd31d['id']][_0xe08c('0x21')]);}}var _0x307719;switch(_0x3dd31d['zone']){case'US':_0x307719=_0xe08c('0x23');break;case'AU':_0x307719=_0xe08c('0x24');break;case'EU':_0x307719=_0xe08c('0x25');break;case'IN':_0x307719='https://accounts.zoho.in';break;case'CN':_0x307719=_0xe08c('0x26');break;default:_0x307719=_0xe08c('0x25');break;}var _0x205054={'method':_0xe08c('0x27'),'uri':_0x307719+_0xe08c('0x28'),'qs':{'refresh_token':_0x3dd31d[_0xe08c('0x29')],'client_id':_0x3dd31d[_0xe08c('0x2a')],'client_secret':_0x3dd31d[_0xe08c('0x2b')],'grant_type':_0xe08c('0x2c')},'json':!![]};return rp(_0x205054)[_0xe08c('0x2d')](function(_0x461733){accountsTokens[_0x3dd31d['id']]={'access_token':_0x461733[_0xe08c('0x21')],'expires_in':moment()['add'](_0x461733[_0xe08c('0x22')],_0xe08c('0x2e'))};_0xdfba54(_0x461733[_0xe08c('0x21')]);})[_0xe08c('0x2f')](function(_0x4d6d52){logger[_0xe08c('0x30')]('Failing\x20creating\x20the\x20access_token',_0x4d6d52[_0xe08c('0x31')]);_0x59d0e6(_0x4d6d52);});});}function getUser(_0x5d02c,_0x2e3952,_0x4cb1f3,_0x5ec67a){logger['info'](_0xe08c('0x32'));return request({'method':'GET','uri':util[_0xe08c('0x33')](_0xe08c('0x34'),_0x2e3952),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xe08c('0x35')+_0x5d02c},'json':!![]})['then'](function(_0x212b42){if(_0x212b42[_0xe08c('0x36')]){var _0x4d33d5=-0x1;if(_[_0xe08c('0x37')](_0x212b42[_0xe08c('0x36')])){if(!_[_0xe08c('0x20')](_0x5ec67a)){_0x4d33d5=_[_0xe08c('0x38')](_0x212b42[_0xe08c('0x36')],function(_0x267df3){return _0x267df3[_0xe08c('0x39')]===_0x5ec67a;});}if(_0x4d33d5>=0x0){logger[_0xe08c('0x3a')](_0xe08c('0x3b'));}else{logger[_0xe08c('0x3a')]('Using\x20the\x20admin\x20account!');_0x4d33d5=_[_0xe08c('0x38')](_0x212b42[_0xe08c('0x36')],function(_0x5225f2){return _0x5225f2[_0xe08c('0x3c')][_0xe08c('0x1b')]===_0xe08c('0x3d');});}return _0x212b42[_0xe08c('0x36')][_0x4d33d5];}else{if(_0x212b42[_0xe08c('0x3e')][_0xe08c('0x3c')]['name']===_0xe08c('0x3d')){logger[_0xe08c('0x3a')](_0xe08c('0x3f'));user=_0x212b42[_0xe08c('0x3e')];return user;}else{logger['error'](_0xe08c('0x40'),JSON[_0xe08c('0x41')](_0x212b42));throw new Error(_0xe08c('0x42')+JSON[_0xe08c('0x41')](_0x212b42));}}}else{logger[_0xe08c('0x30')](_0xe08c('0x40'),JSON['stringify'](_0x212b42));throw new Error(_0xe08c('0x42')+JSON[_0xe08c('0x41')](_0x212b42));}})[_0xe08c('0x2f')](function(_0x2f2bdb){console[_0xe08c('0x30')](_0x2f2bdb);});}function getZohoUser(_0x45d6c9,_0x42cfa9){return new BPromise(function(_0x1cdffc,_0xd3704d){request(_0x45d6c9)['then'](function(_0x521c1e){var _0x550e53=null;if(_0x521c1e){_0x550e53=_0x521c1e['data'][0x0];_0x550e53['enduserType']=_0x42cfa9;}_0x1cdffc(_0x550e53);})[_0xe08c('0x2f')](function(_0x398a08){_0xd3704d(_0x398a08);});});}function createEndUser(_0xffaff4,_0x5d2c74,_0x2c657c,_0x55c7fa,_0x450ecd,_0x10a668){var _0x2c657c=getName(_0x2c657c);return request({'method':_0xe08c('0x27'),'uri':'https://www.zohoapis.'+_0x5d2c74+_0xe08c('0x43')+_[_0xe08c('0x44')](_0x10a668[_0xe08c('0x45')])+'s','body':{'data':[{'Last_Name':_0x2c657c[0x1],'First_Name':_0x2c657c[0x0],'Phone':_0x55c7fa,'Owner':{'name':!_['isNil'](_0x450ecd[_0xe08c('0x46')]['name'])?_0x450ecd[_0xe08c('0x46')][_0xe08c('0x1b')]:!_['isNil'](_0x450ecd[_0xe08c('0x47')])?_0x450ecd[_0xe08c('0x47')]+'\x20'+_0x450ecd['last_name']:_0x450ecd[_0xe08c('0x48')],'id':_0x450ecd['id']}}]},'headers':{'Authorization':_0xe08c('0x35')+_0xffaff4},'json':!![]})[_0xe08c('0x2d')](function(_0x37f2fd){if(_0x37f2fd&&_0x37f2fd['data'][0x0][_0xe08c('0x49')]===_0xe08c('0x4a')){var _0x1f7565=_0x37f2fd[_0xe08c('0x4b')][0x0][_0xe08c('0x4c')];_0x1f7565[_0xe08c('0x4d')]=_['startCase'](_0x10a668[_0xe08c('0x45')])+'s';return _0x1f7565;}logger[_0xe08c('0x30')](_0xe08c('0x40'),JSON[_0xe08c('0x41')](data));throw new Error(_0xe08c('0x4e')+JSON[_0xe08c('0x41')](data));})[_0xe08c('0x2f')](function(_0x19d09b){console[_0xe08c('0x4f')]('CREATE\x20ERROR',_0x19d09b);});}function getEndUser(_0x334c71,_0x3dc54b,_0xcdc2da,_0x305fe1,_0x2e6c71,_0x8e68ff,_0xaf2a99){var _0x17eb50={'method':_0xe08c('0x50'),'uri':'','headers':{'Authorization':_0xe08c('0x35')+_0x334c71},'json':!![]};switch(_0xaf2a99[_0xe08c('0x51')]){case _0xe08c('0x52'):_0x17eb50[_0xe08c('0x53')]=_0xe08c('0x54')+_0x3dc54b+_0xe08c('0x55')+_0x2e6c71+'))';return getZohoUser(_0x17eb50,_0xe08c('0x56'))[_0xe08c('0x2d')](function(_0x23c532){if(_0x23c532)return _0x23c532;_0x17eb50['uri']=_0xe08c('0x54')+_0x3dc54b+_0xe08c('0x57')+_0x2e6c71+'))';return getZohoUser(_0x17eb50,_0xe08c('0x58'))[_0xe08c('0x2d')](function(_0x2645bd){if(_0x2645bd)return _0x2645bd;if(_0xaf2a99[_0xe08c('0x45')]!=_0xe08c('0x59')){return createEndUser(_0x334c71,_0x3dc54b,_0x305fe1,_0x2e6c71,_0x8e68ff,_0xaf2a99);}else{return{};}});});break;case'contact':_0x17eb50[_0xe08c('0x53')]=_0xe08c('0x54')+_0x3dc54b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2e6c71+'))';return getZohoUser(_0x17eb50,'Contacts')[_0xe08c('0x2d')](function(_0x17032e){if(_0x17032e)return _0x17032e;if(_0xaf2a99[_0xe08c('0x45')]!='nothing'){return createEndUser(_0x334c71,_0x3dc54b,_0x305fe1,_0x2e6c71,_0x8e68ff,_0xaf2a99);}else{return{};}});break;case'lead':_0x17eb50['uri']=_0xe08c('0x54')+_0x3dc54b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e6c71+'))';return getZohoUser(_0x17eb50,_0xe08c('0x58'))[_0xe08c('0x2d')](function(_0x1b195e){if(_0x1b195e)return _0x1b195e;if(_0xaf2a99[_0xe08c('0x45')]!=_0xe08c('0x59')){return createEndUser(_0x334c71,_0x3dc54b,_0x305fe1,_0x2e6c71,_0x8e68ff,_0xaf2a99);}else{return{};}});break;}}function getCall(_0x60f359,_0x32eb32,_0x347ed8,_0x4f16de,_0x2c109a,_0x16b0ba,_0x1ed8a6,_0x3d06cb){logger[_0xe08c('0x3a')](_0xe08c('0x5a'));var _0x5c893f={};_0x5c893f[_0xe08c('0x5b')]={'name':!_[_0xe08c('0x20')](_0x4f16de[_0xe08c('0x46')][_0xe08c('0x1b')])&&!_['isNil'](_0x4f16de[_0xe08c('0x3c')][_0xe08c('0x1b')])&&_0x4f16de['profile'][_0xe08c('0x1b')]==='administrator'?_0x4f16de[_0xe08c('0x46')][_0xe08c('0x1b')]:!_[_0xe08c('0x20')](_0x4f16de['first_name'])?_0x4f16de['first_name']+'\x20'+_0x4f16de[_0xe08c('0x48')]:_0x4f16de[_0xe08c('0x48')],'id':_0x4f16de['id']};_0x5c893f['Subject']=intUtil[_0xe08c('0x5c')](_0x16b0ba[_0xe08c('0x5d')],_0x1ed8a6,'\x20');_0x5c893f['Description']=intUtil['getString'](_0x16b0ba[_0xe08c('0x5e')],_0x1ed8a6,'\x0a');if(_0x2c109a['enduserType']===_0xe08c('0x56')){_0x5c893f['Who_Id']={'name':!_[_0xe08c('0x20')](_0x2c109a[_0xe08c('0x5f')])?_0x2c109a[_0xe08c('0x5f')]:!_[_0xe08c('0x20')](_0x2c109a['First_Name'])?_0x2c109a[_0xe08c('0x60')]+'\x20'+_0x2c109a[_0xe08c('0x61')]:_0x2c109a[_0xe08c('0x61')],'id':_0x2c109a['id']};}if(_0x2c109a[_0xe08c('0x4d')]===_0xe08c('0x58')){_0x5c893f[_0xe08c('0x62')]={'name':!_[_0xe08c('0x20')](_0x2c109a[_0xe08c('0x5f')])?_0x2c109a['Full_Name']:!_[_0xe08c('0x20')](_0x2c109a[_0xe08c('0x60')])?_0x2c109a['First_Name']+'\x20'+_0x2c109a[_0xe08c('0x61')]:_0x2c109a[_0xe08c('0x61')],'id':_0x2c109a['id']};_0x5c893f['$se_module']=_[_0xe08c('0x44')](_0x2c109a['enduserType']);}if(_0x1ed8a6[_0xe08c('0x63')]){_0x5c893f['Call_Duration']=moment[_0xe08c('0x64')](parseInt(_0x1ed8a6[_0xe08c('0x63')])*0x3e8)[_0xe08c('0x33')](_0xe08c('0x65'));}else if(_0x1ed8a6[_0xe08c('0x66')]&&_0x1ed8a6[_0xe08c('0x67')]){_0x5c893f[_0xe08c('0x68')]=moment[_0xe08c('0x64')](moment(_0x1ed8a6[_0xe08c('0x67')],_0xe08c('0x69'))[_0xe08c('0x6a')](moment(_0x1ed8a6[_0xe08c('0x6b')],_0xe08c('0x69'))))[_0xe08c('0x33')](_0xe08c('0x65'));}switch(_0x1ed8a6[_0xe08c('0x6c')]){case _0xe08c('0x6d'):_0x5c893f[_0xe08c('0x6e')]=_0xe08c('0x6f');break;case _0xe08c('0x70'):case'connect':_0x5c893f[_0xe08c('0x6e')]='Answered';break;case _0xe08c('0x71'):_0x5c893f[_0xe08c('0x6e')]='Rejected';break;case _0xe08c('0x72'):_0x5c893f[_0xe08c('0x6e')]=_0xe08c('0x73');break;case _0xe08c('0x74'):_0x5c893f[_0xe08c('0x6e')]=_0xe08c('0x75');default:}_0x5c893f[_0xe08c('0x76')]=(_0x3d06cb===_0xe08c('0x77')?moment(_0x1ed8a6['starttime'])[_0xe08c('0x33')](_0xe08c('0x69')):moment(_0x1ed8a6[_0xe08c('0x78')])[_0xe08c('0x33')](_0xe08c('0x69')))||moment()[_0xe08c('0x33')](_0xe08c('0x69'));_0x5c893f[_0xe08c('0x79')]=_0x3d06cb||_0xe08c('0x7a');_0x5c893f=_['merge'](_0x5c893f,getCustomFields(_0x16b0ba[_0xe08c('0x7b')],_0x1ed8a6));return request({'method':_0xe08c('0x27'),'uri':_0xe08c('0x54')+_0x32eb32+_0xe08c('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x60f359},'body':{'data':[_0x5c893f]},'json':!![]})[_0xe08c('0x2d')](function(_0x19eeff){if(_0x19eeff&&_0x19eeff[_0xe08c('0x4b')][0x0][_0xe08c('0x49')]==='SUCCESS'){logger['info'](_0xe08c('0x7d'));return{'id':_0x19eeff['data'][0x0]['details']['id']};}})[_0xe08c('0x2f')](function(_0x41f7ea){logger[_0xe08c('0x3a')](_0xe08c('0x7e'),_0x41f7ea[_0xe08c('0x31')]);console[_0xe08c('0x4f')](_0xe08c('0x7e'),_0x41f7ea);});}exports[_0xe08c('0x7f')]=function(_0x41a9ef,_0x5babcd,_0x54ed77,_0x47a21b,_0xa60a6,_0x538284){var _0x553e05,_0x4dc338,_0x3aec4f;_0x538284['host']=intUtil['stripTrailingSlash'](_0x538284['host']);_0x538284['serverUrl']=intUtil[_0xe08c('0x80')](_0x538284[_0xe08c('0x81')]);if(_0xa60a6&&_0xa60a6['monitor_format']){logger[_0xe08c('0x3a')]('[QUEUE]',_0xe08c('0x82'));_0x5babcd[_0xe08c('0x83')]=_0x538284[_0xe08c('0x81')]+_0xe08c('0x84')+_0x5babcd[_0xe08c('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x5babcd[_0xe08c('0x85')]);}else{_0x5babcd[_0xe08c('0x83')]='';}var _0x7a10ec=_0x538284['host']===_0xe08c('0x86')?'eu':_0xe08c('0x87');return getAccessToken(_0x538284)[_0xe08c('0x2d')](function(_0x4754a8){_0x3aec4f=_0x4754a8;return getUser(_0x3aec4f,_0x7a10ec,_0x538284,_0x47a21b[_0xe08c('0x39')]);})[_0xe08c('0x2d')](function(_0x4e0a40){_0x553e05=_0x4e0a40;logger[_0xe08c('0x3a')](_0xe08c('0x88'),_0x553e05['id']);return getEndUser(_0x3aec4f,_0x7a10ec,_0x538284,_0x5babcd[_0xe08c('0x89')],_0x5babcd[_0xe08c('0x8a')],_0x553e05,_0x54ed77);})['then'](function(_0x516570){_0x4dc338=_0x516570;return getCall(_0x3aec4f,_0x7a10ec,_0x538284,_0x553e05,_0x4dc338,_0x54ed77,_0x5babcd,_0xe08c('0x7a'));})[_0xe08c('0x2d')](function(_0x532d01){if(_0x532d01){logger[_0xe08c('0x3a')](_0xe08c('0x8b'),_0x532d01['id']);logger[_0xe08c('0x3a')](_0xe08c('0x8c'),_0xe08c('0x8d'));emit(util[_0xe08c('0x33')](_0xe08c('0x8e'),_0x47a21b[_0xe08c('0x1b')]),_0xe08c('0x8f'),{'uri':'https://crm.'+_0x538284[_0xe08c('0x90')]+_0xe08c('0x91')+_0x532d01['id']});}})[_0xe08c('0x2f')](function(_0x49cade){logger[_0xe08c('0x30')]('[QUEUE]',JSON[_0xe08c('0x41')](_0x49cade));});};exports[_0xe08c('0x77')]=function(_0x1d3c4e,_0x377852,_0x553165,_0x674fc8,_0x3c515d,_0x3bc517,_0xe6870d){var _0x39c922,_0x32f033,_0x461943;_0x3bc517['host']=intUtil[_0xe08c('0x80')](_0x3bc517[_0xe08c('0x90')]);_0x3bc517[_0xe08c('0x81')]=intUtil['stripTrailingSlash'](_0x3bc517[_0xe08c('0x81')]);if(_0xe6870d&&_0xe6870d[_0xe08c('0x92')]&&_0xe6870d[_0xe08c('0x92')]!==_0xe08c('0x93')){logger[_0xe08c('0x3a')](_0xe08c('0x94'),_0xe08c('0x82'));_0x377852[_0xe08c('0x83')]=_0x3bc517[_0xe08c('0x81')]+'/api/voice/recordings/'+_0x377852['uniqueid']+_0xe08c('0x95')+md5(_0x377852[_0xe08c('0x85')]);}var _0xf1d72c=_0x3bc517[_0xe08c('0x90')]===_0xe08c('0x86')?'eu':_0xe08c('0x87');return getAccessToken(_0x3bc517)['then'](function(_0x371932){_0x461943=_0x371932;return getUser(_0x461943,_0xf1d72c,_0x3bc517,_0x674fc8[_0xe08c('0x39')]);})['then'](function(_0x4935c8){_0x39c922=_0x4935c8;logger['info'](_0xe08c('0x88'),_0x39c922['id']);return getEndUser(_0x461943,_0xf1d72c,_0x3bc517,_0x377852[_0xe08c('0x96')],_0x377852[_0xe08c('0x97')],_0x39c922,_0x553165);})['then'](function(_0x1a47cf){_0x32f033=_0x1a47cf;return getCall(_0x461943,_0xf1d72c,_0x3bc517,_0x39c922,_0x32f033,_0x553165,_0x377852,'Outbound');})[_0xe08c('0x2d')](function(_0x261e37){if(_0x261e37){logger[_0xe08c('0x3a')](_0xe08c('0x8b'),_0x261e37['id']);logger[_0xe08c('0x3a')](_0xe08c('0x94'),_0xe08c('0x8d'));emit(util['format']('user:%s',_0x674fc8['name']),_0xe08c('0x8f'),{'uri':_0xe08c('0x98')+_0x3bc517['host']+_0xe08c('0x91')+_0x261e37['id']});}})[_0xe08c('0x2f')](function(_0x395a67){logger[_0xe08c('0x30')](_0xe08c('0x94'),JSON['stringify'](_0x395a67));});};exports[_0xe08c('0x99')]=function(_0x1dd8c4,_0x55ca2d,_0x4e4dcd,_0x58cdca,_0x33955b,_0x36f27b){var _0x4eec19,_0x5d6332,_0x4fcc4d;_0x36f27b[_0xe08c('0x90')]=intUtil[_0xe08c('0x80')](_0x36f27b[_0xe08c('0x90')]);_0x36f27b[_0xe08c('0x81')]=intUtil['stripTrailingSlash'](_0x36f27b['serverUrl']);if(_0x33955b&&_0x33955b['monitor_format']){logger[_0xe08c('0x3a')]('['+_0x55ca2d[_0xe08c('0x6c')][_0xe08c('0x9a')]()+']','Recording\x20is\x20enabled!');_0x55ca2d[_0xe08c('0x83')]=_0x36f27b[_0xe08c('0x81')]+_0xe08c('0x84')+_0x55ca2d['uniqueid']+_0xe08c('0x95')+md5(_0x55ca2d['uniqueid']);}else{_0x55ca2d['recordingURL']='';}var _0x2d65a6=_0x36f27b[_0xe08c('0x90')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x36f27b)[_0xe08c('0x2d')](function(_0x38d520){_0x4fcc4d=_0x38d520;return getUser(_0x4fcc4d,_0x2d65a6,_0x36f27b);})['then'](function(_0x448859){_0x4eec19=_0x448859;logger[_0xe08c('0x3a')]('The\x20User\x20ID\x20is:',_0x4eec19['id']);return getEndUser(_0x4fcc4d,_0x2d65a6,_0x36f27b,_0x55ca2d[_0xe08c('0x89')],_0x55ca2d[_0xe08c('0x8a')],_0x4eec19,_0x4e4dcd);})['then'](function(_0x4a3b65){_0x5d6332=_0x4a3b65;return getCall(_0x4fcc4d,_0x2d65a6,_0x36f27b,_0x4eec19,_0x5d6332,_0x4e4dcd,_0x55ca2d,_0xe08c('0x7a'));})[_0xe08c('0x2d')](function(_0x764cc6){if(_0x764cc6){logger['info'](_0xe08c('0x8b'),_0x764cc6['id']);}})[_0xe08c('0x2f')](function(_0x17b57f){logger[_0xe08c('0x30')]('['+_0x55ca2d[_0xe08c('0x6c')][_0xe08c('0x9a')]()+']',JSON[_0xe08c('0x41')](_0x17b57f));});}; \ No newline at end of file +var _0xb01f=['moduleCreate','The\x20failing\x20result\x20is','log','CREATE\x20ERROR','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','uri','Contacts','lead','Leads','Owner','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','toUpperCase','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','debug','[HTTP]','stringify','includes','string','picklist','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','refreshToken','clientId','clientSecret','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','startCase'];(function(_0x2a528b,_0x2dfd60){var _0x3a2f1d=function(_0x25b6e5){while(--_0x25b6e5){_0x2a528b['push'](_0x2a528b['shift']());}};_0x3a2f1d(++_0x2dfd60);}(_0xb01f,0x184));var _0xfb01=function(_0x2567f1,_0x16d4c1){_0x2567f1=_0x2567f1-0x0;var _0x8a4cda=_0xb01f[_0x2567f1];return _0x8a4cda;};'use strict';var _=require(_0xfb01('0x0'));var rp=require(_0xfb01('0x1'));var md5=require(_0xfb01('0x2'));var util=require(_0xfb01('0x3'));var intUtil=require('./util');var moment=require(_0xfb01('0x4'));var Redis=require('ioredis');var BPromise=require(_0xfb01('0x5'));var config=require(_0xfb01('0x6'));var logger=require(_0xfb01('0x7'))('zoho');config[_0xfb01('0x8')]=_[_0xfb01('0x9')](config[_0xfb01('0x8')],{'host':_0xfb01('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfb01('0x8')]));function emit(_0x38d3be,_0x125316,_0x2c3917){io['to'](_0x38d3be)['emit'](_0x125316,_0x2c3917);}function request(_0x4d456b){logger[_0xfb01('0xb')](_0xfb01('0xc'),JSON[_0xfb01('0xd')](_0x4d456b));return rp(_0x4d456b);}function getCustomFields(_0x33bae4,_0x2183ec){var _0x3be1e7={};if(_0x33bae4['length']>0x0){_['forEach'](_0x33bae4,function(_0x1f98f8){if(_[_0xfb01('0xe')]([_0xfb01('0xf'),_0xfb01('0x10')],_0x1f98f8[_0xfb01('0x11')])&&_0x1f98f8[_0xfb01('0x12')]){_0x3be1e7[_0x1f98f8[_0xfb01('0x12')]]=_0x1f98f8[_0xfb01('0x13')][_0xfb01('0x14')]();}else if(_0x1f98f8['type']===_0xfb01('0x15')&&_0x1f98f8[_0xfb01('0x16')]&&_0x1f98f8[_0xfb01('0x12')]&&_0x2183ec[_0x1f98f8[_0xfb01('0x16')]]){_0x3be1e7[_0x1f98f8[_0xfb01('0x12')]]=_0x2183ec[_0x1f98f8['variableName']][_0xfb01('0x14')]();}else if(_0x1f98f8[_0xfb01('0x11')]===_0xfb01('0x17')&&_0x1f98f8[_0xfb01('0x18')]&&_0x1f98f8[_0xfb01('0x18')][_0xfb01('0x19')]&&_0x1f98f8[_0xfb01('0x12')]&&_0x2183ec[_0x1f98f8['Variable'][_0xfb01('0x19')][_0xfb01('0x1a')]()]){_0x3be1e7[_0x1f98f8['idField']]=_0x2183ec[_0x1f98f8[_0xfb01('0x18')][_0xfb01('0x19')][_0xfb01('0x1a')]()][_0xfb01('0x14')]();}});}return _0x3be1e7;}function getName(_0x8526c8){if(_0x8526c8[_0xfb01('0x1b')]('\x20')>0x0){var _0x5dd0be=_0x8526c8[_0xfb01('0x1c')](/ (.+)/);if(_0x5dd0be[0x1]){return _0x5dd0be;}}return[_0x8526c8,_0x8526c8];}var accountsTokens={};function getAccessToken(_0x3e74dd){return new Promise(function(_0x4ae1c7,_0x1413d2){if(!_[_0xfb01('0x1d')](accountsTokens[_0x3e74dd['id']])&&!_[_0xfb01('0x1d')](accountsTokens[_0x3e74dd['id']][_0xfb01('0x1e')])){if(moment()[_0xfb01('0x1f')](accountsTokens[_0x3e74dd['id']][_0xfb01('0x20')])){_0x4ae1c7(accountsTokens[_0x3e74dd['id']][_0xfb01('0x1e')]);}}var _0x26a0d2;switch(_0x3e74dd[_0xfb01('0x21')]){case'US':_0x26a0d2=_0xfb01('0x22');break;case'AU':_0x26a0d2=_0xfb01('0x23');break;case'EU':_0x26a0d2=_0xfb01('0x24');break;case'IN':_0x26a0d2=_0xfb01('0x25');break;case'CN':_0x26a0d2=_0xfb01('0x26');break;default:_0x26a0d2=_0xfb01('0x24');break;}var _0x1f3eb4={'method':_0xfb01('0x27'),'uri':_0x26a0d2+'/oauth/v2/token','qs':{'refresh_token':_0x3e74dd[_0xfb01('0x28')],'client_id':_0x3e74dd[_0xfb01('0x29')],'client_secret':_0x3e74dd[_0xfb01('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1f3eb4)[_0xfb01('0x2b')](function(_0x365c64){accountsTokens[_0x3e74dd['id']]={'access_token':_0x365c64[_0xfb01('0x1e')],'expires_in':moment()[_0xfb01('0x2c')](_0x365c64[_0xfb01('0x20')],_0xfb01('0x2d'))};_0x4ae1c7(_0x365c64['access_token']);})[_0xfb01('0x2e')](function(_0x93887c){logger['error'](_0xfb01('0x2f'),_0x93887c['stack']);_0x1413d2(_0x93887c);});});}function getUser(_0x363ca9,_0x4b475a,_0x23e8b4,_0x1eebe7){logger[_0xfb01('0x30')](_0xfb01('0x31'));return request({'method':_0xfb01('0x32'),'uri':util['format'](_0xfb01('0x33'),_0x4b475a),'qs':{'type':_0xfb01('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x363ca9},'json':!![]})[_0xfb01('0x2b')](function(_0x488362){if(_0x488362[_0xfb01('0x35')]){var _0x2e4a96=-0x1;if(_[_0xfb01('0x36')](_0x488362[_0xfb01('0x35')])){if(!_['isNil'](_0x1eebe7)){_0x2e4a96=_[_0xfb01('0x37')](_0x488362['users'],function(_0x234df6){return _0x234df6[_0xfb01('0x38')]===_0x1eebe7;});}if(_0x2e4a96>=0x0){logger[_0xfb01('0x30')](_0xfb01('0x39'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x2e4a96=_[_0xfb01('0x37')](_0x488362[_0xfb01('0x35')],function(_0x5df729){return _0x5df729[_0xfb01('0x3a')][_0xfb01('0x19')]===_0xfb01('0x3b');});}return _0x488362[_0xfb01('0x35')][_0x2e4a96];}else{if(_0x488362[_0xfb01('0x3c')][_0xfb01('0x3a')][_0xfb01('0x19')]===_0xfb01('0x3b')){logger['info'](_0xfb01('0x3d'));user=_0x488362[_0xfb01('0x3c')];return user;}else{logger[_0xfb01('0x3e')]('The\x20failing\x20result\x20is',JSON[_0xfb01('0xd')](_0x488362));throw new Error(_0xfb01('0x3f')+JSON[_0xfb01('0xd')](_0x488362));}}}else{logger[_0xfb01('0x3e')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x488362));throw new Error(_0xfb01('0x3f')+JSON[_0xfb01('0xd')](_0x488362));}})[_0xfb01('0x2e')](function(_0x583e51){console[_0xfb01('0x3e')](_0x583e51);});}function getZohoUser(_0x3ff4c5,_0x1fa665){return new BPromise(function(_0x3b1a30,_0x51bb66){request(_0x3ff4c5)[_0xfb01('0x2b')](function(_0x2a571f){var _0x4f419c=null;if(_0x2a571f){_0x4f419c=_0x2a571f[_0xfb01('0x40')][0x0];_0x4f419c[_0xfb01('0x41')]=_0x1fa665;}_0x3b1a30(_0x4f419c);})[_0xfb01('0x2e')](function(_0x402628){_0x51bb66(_0x402628);});});}function createEndUser(_0x3fb9ca,_0x18c8a6,_0x471887,_0x57a6ad,_0x334648,_0x304e08){var _0x471887=getName(_0x471887);return request({'method':_0xfb01('0x27'),'uri':'https://www.zohoapis.'+_0x18c8a6+_0xfb01('0x42')+_['startCase'](_0x304e08['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x471887[0x1],'First_Name':_0x471887[0x0],'Phone':_0x57a6ad,'Owner':{'name':!_['isNil'](_0x334648[_0xfb01('0x43')][_0xfb01('0x19')])?_0x334648[_0xfb01('0x43')]['name']:!_[_0xfb01('0x1d')](_0x334648[_0xfb01('0x44')])?_0x334648[_0xfb01('0x44')]+'\x20'+_0x334648['last_name']:_0x334648[_0xfb01('0x45')],'id':_0x334648['id']}}]},'headers':{'Authorization':_0xfb01('0x46')+_0x3fb9ca},'json':!![]})['then'](function(_0xbadf23){if(_0xbadf23&&_0xbadf23[_0xfb01('0x40')][0x0][_0xfb01('0x47')]==='SUCCESS'){var _0x1c89c2=_0xbadf23['data'][0x0][_0xfb01('0x48')];_0x1c89c2['enduserType']=_[_0xfb01('0x49')](_0x304e08[_0xfb01('0x4a')])+'s';return _0x1c89c2;}logger[_0xfb01('0x3e')](_0xfb01('0x4b'),JSON[_0xfb01('0xd')](data));throw new Error('Error:\x20'+JSON[_0xfb01('0xd')](data));})[_0xfb01('0x2e')](function(_0x35f24a){console[_0xfb01('0x4c')](_0xfb01('0x4d'),_0x35f24a);});}function getEndUser(_0x1953ed,_0x3754a3,_0x2c30b9,_0x491f9f,_0x35fcd5,_0x59661c,_0x42d236){var _0x4afe6f={'method':'GET','uri':'','headers':{'Authorization':_0xfb01('0x46')+_0x1953ed},'json':!![]};switch(_0x42d236[_0xfb01('0x4e')]){case _0xfb01('0x4f'):_0x4afe6f['uri']=_0xfb01('0x50')+_0x3754a3+_0xfb01('0x51')+_0x35fcd5+'))';return getZohoUser(_0x4afe6f,'Contacts')['then'](function(_0xafe69a){if(_0xafe69a)return _0xafe69a;_0x4afe6f['uri']=_0xfb01('0x50')+_0x3754a3+_0xfb01('0x52')+_0x35fcd5+'))';return getZohoUser(_0x4afe6f,'Leads')[_0xfb01('0x2b')](function(_0x4262bc){if(_0x4262bc)return _0x4262bc;if(_0x42d236[_0xfb01('0x4a')]!=_0xfb01('0x53')){return createEndUser(_0x1953ed,_0x3754a3,_0x491f9f,_0x35fcd5,_0x59661c,_0x42d236);}else{return{};}});});break;case _0xfb01('0x54'):_0x4afe6f[_0xfb01('0x55')]=_0xfb01('0x50')+_0x3754a3+_0xfb01('0x51')+_0x35fcd5+'))';return getZohoUser(_0x4afe6f,_0xfb01('0x56'))['then'](function(_0x23ff41){if(_0x23ff41)return _0x23ff41;if(_0x42d236['moduleCreate']!=_0xfb01('0x53')){return createEndUser(_0x1953ed,_0x3754a3,_0x491f9f,_0x35fcd5,_0x59661c,_0x42d236);}else{return{};}});break;case _0xfb01('0x57'):_0x4afe6f[_0xfb01('0x55')]='https://www.zohoapis.'+_0x3754a3+_0xfb01('0x52')+_0x35fcd5+'))';return getZohoUser(_0x4afe6f,_0xfb01('0x58'))[_0xfb01('0x2b')](function(_0x35f488){if(_0x35f488)return _0x35f488;if(_0x42d236['moduleCreate']!='nothing'){return createEndUser(_0x1953ed,_0x3754a3,_0x491f9f,_0x35fcd5,_0x59661c,_0x42d236);}else{return{};}});break;}}function getCall(_0x332ba0,_0x45ceca,_0x582638,_0x12a533,_0x69848b,_0x5b45b3,_0x518bd1,_0x53e4f5){logger['info']('Creating\x20new\x20call...');var _0x448f35={};_0x448f35[_0xfb01('0x59')]={'name':!_['isNil'](_0x12a533[_0xfb01('0x43')][_0xfb01('0x19')])&&!_[_0xfb01('0x1d')](_0x12a533['profile'][_0xfb01('0x19')])&&_0x12a533[_0xfb01('0x3a')][_0xfb01('0x19')]==='administrator'?_0x12a533[_0xfb01('0x43')]['name']:!_['isNil'](_0x12a533[_0xfb01('0x44')])?_0x12a533[_0xfb01('0x44')]+'\x20'+_0x12a533[_0xfb01('0x45')]:_0x12a533[_0xfb01('0x45')],'id':_0x12a533['id']};_0x448f35['Subject']=intUtil[_0xfb01('0x5a')](_0x5b45b3[_0xfb01('0x5b')],_0x518bd1,'\x20');_0x448f35[_0xfb01('0x5c')]=intUtil[_0xfb01('0x5a')](_0x5b45b3['Descriptions'],_0x518bd1,'\x0a');if(_0x69848b[_0xfb01('0x41')]===_0xfb01('0x56')){_0x448f35['Who_Id']={'name':!_[_0xfb01('0x1d')](_0x69848b[_0xfb01('0x5d')])?_0x69848b[_0xfb01('0x5d')]:!_[_0xfb01('0x1d')](_0x69848b[_0xfb01('0x5e')])?_0x69848b['First_Name']+'\x20'+_0x69848b[_0xfb01('0x5f')]:_0x69848b[_0xfb01('0x5f')],'id':_0x69848b['id']};}if(_0x69848b['enduserType']===_0xfb01('0x58')){_0x448f35[_0xfb01('0x60')]={'name':!_['isNil'](_0x69848b[_0xfb01('0x5d')])?_0x69848b[_0xfb01('0x5d')]:!_[_0xfb01('0x1d')](_0x69848b['First_Name'])?_0x69848b['First_Name']+'\x20'+_0x69848b[_0xfb01('0x5f')]:_0x69848b[_0xfb01('0x5f')],'id':_0x69848b['id']};_0x448f35['$se_module']=_[_0xfb01('0x49')](_0x69848b[_0xfb01('0x41')]);}if(_0x518bd1[_0xfb01('0x61')]){_0x448f35[_0xfb01('0x62')]=moment[_0xfb01('0x63')](parseInt(_0x518bd1[_0xfb01('0x61')])*0x3e8)[_0xfb01('0x64')](_0xfb01('0x65'));}else if(_0x518bd1[_0xfb01('0x66')]&&_0x518bd1[_0xfb01('0x67')]){_0x448f35[_0xfb01('0x62')]=moment[_0xfb01('0x63')](moment(_0x518bd1[_0xfb01('0x67')],_0xfb01('0x68'))['diff'](moment(_0x518bd1[_0xfb01('0x69')],_0xfb01('0x68'))))[_0xfb01('0x64')](_0xfb01('0x65'));}switch(_0x518bd1[_0xfb01('0x6a')]){case _0xfb01('0x6b'):_0x448f35[_0xfb01('0x6c')]=_0xfb01('0x6d');break;case'complete':case'connect':_0x448f35[_0xfb01('0x6c')]=_0xfb01('0x6e');break;case _0xfb01('0x6f'):_0x448f35[_0xfb01('0x6c')]=_0xfb01('0x70');break;case'abandoned':_0x448f35[_0xfb01('0x6c')]=_0xfb01('0x71');break;case _0xfb01('0x72'):_0x448f35[_0xfb01('0x6c')]=_0xfb01('0x73');default:}_0x448f35[_0xfb01('0x74')]=(_0x53e4f5===_0xfb01('0x75')?moment(_0x518bd1['starttime'])[_0xfb01('0x64')](_0xfb01('0x68')):moment(_0x518bd1[_0xfb01('0x76')])[_0xfb01('0x64')](_0xfb01('0x68')))||moment()[_0xfb01('0x64')](_0xfb01('0x68'));_0x448f35[_0xfb01('0x77')]=_0x53e4f5||'Inbound';_0x448f35=_[_0xfb01('0x78')](_0x448f35,getCustomFields(_0x5b45b3[_0xfb01('0x79')],_0x518bd1));return request({'method':_0xfb01('0x27'),'uri':_0xfb01('0x50')+_0x45ceca+_0xfb01('0x7a'),'headers':{'Authorization':_0xfb01('0x46')+_0x332ba0},'body':{'data':[_0x448f35]},'json':!![]})[_0xfb01('0x2b')](function(_0x53f437){if(_0x53f437&&_0x53f437[_0xfb01('0x40')][0x0][_0xfb01('0x47')]==='SUCCESS'){logger[_0xfb01('0x30')](_0xfb01('0x7b'));return{'id':_0x53f437[_0xfb01('0x40')][0x0][_0xfb01('0x48')]['id']};}})[_0xfb01('0x2e')](function(_0x2cf144){logger['info'](_0xfb01('0x7c'),_0x2cf144[_0xfb01('0x7d')]);console[_0xfb01('0x4c')]('err',_0x2cf144);});}exports[_0xfb01('0x7e')]=function(_0x1e9b45,_0x1b6e3a,_0x3dd083,_0x291926,_0x2958e8,_0x1d40bd){var _0x50aa91,_0x5b502e,_0x19a1e6;_0x1d40bd[_0xfb01('0x7f')]=intUtil[_0xfb01('0x80')](_0x1d40bd[_0xfb01('0x7f')]);_0x1d40bd[_0xfb01('0x81')]=intUtil[_0xfb01('0x80')](_0x1d40bd[_0xfb01('0x81')]);if(_0x2958e8&&_0x2958e8[_0xfb01('0x82')]){logger['info'](_0xfb01('0x83'),_0xfb01('0x84'));_0x1b6e3a[_0xfb01('0x85')]=_0x1d40bd[_0xfb01('0x81')]+'/api/voice/recordings/'+_0x1b6e3a['uniqueid']+_0xfb01('0x86')+md5(_0x1b6e3a[_0xfb01('0x87')]);}else{_0x1b6e3a[_0xfb01('0x85')]='';}var _0x894c50=_0x1d40bd['host']===_0xfb01('0x88')?'eu':_0xfb01('0x89');return getAccessToken(_0x1d40bd)[_0xfb01('0x2b')](function(_0x5bdb85){_0x19a1e6=_0x5bdb85;return getUser(_0x19a1e6,_0x894c50,_0x1d40bd,_0x291926['email']);})['then'](function(_0x15e00b){_0x50aa91=_0x15e00b;logger[_0xfb01('0x30')]('The\x20User\x20ID\x20is:',_0x50aa91['id']);return getEndUser(_0x19a1e6,_0x894c50,_0x1d40bd,_0x1b6e3a['calleridname'],_0x1b6e3a[_0xfb01('0x8a')],_0x50aa91,_0x3dd083);})['then'](function(_0x164cda){_0x5b502e=_0x164cda;return getCall(_0x19a1e6,_0x894c50,_0x1d40bd,_0x50aa91,_0x5b502e,_0x3dd083,_0x1b6e3a,_0xfb01('0x8b'));})['then'](function(_0x2600d7){if(_0x2600d7){logger['info'](_0xfb01('0x8c'),_0x2600d7['id']);logger[_0xfb01('0x30')](_0xfb01('0x83'),_0xfb01('0x8d'));emit(util[_0xfb01('0x64')](_0xfb01('0x8e'),_0x291926['name']),_0xfb01('0x8f'),{'uri':_0xfb01('0x90')+_0x1d40bd[_0xfb01('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2600d7['id']});}})['catch'](function(_0x557b63){logger[_0xfb01('0x3e')]('[QUEUE]',JSON[_0xfb01('0xd')](_0x557b63));});};exports[_0xfb01('0x75')]=function(_0x18a8b1,_0x243d65,_0xfc7949,_0x158e68,_0x5a48ff,_0x43293a,_0x2dda9d){var _0x5d7a87,_0x4d9eef,_0x36ac68;_0x43293a['host']=intUtil[_0xfb01('0x80')](_0x43293a[_0xfb01('0x7f')]);_0x43293a['serverUrl']=intUtil[_0xfb01('0x80')](_0x43293a[_0xfb01('0x81')]);if(_0x2dda9d&&_0x2dda9d[_0xfb01('0x91')]&&_0x2dda9d['recordingFormat']!==_0xfb01('0x92')){logger['info'](_0xfb01('0x93'),'Recording\x20is\x20enabled!');_0x243d65[_0xfb01('0x85')]=_0x43293a[_0xfb01('0x81')]+_0xfb01('0x94')+_0x243d65[_0xfb01('0x87')]+_0xfb01('0x86')+md5(_0x243d65[_0xfb01('0x87')]);}var _0x266671=_0x43293a['host']===_0xfb01('0x88')?'eu':_0xfb01('0x89');return getAccessToken(_0x43293a)[_0xfb01('0x2b')](function(_0x50bc4d){_0x36ac68=_0x50bc4d;return getUser(_0x36ac68,_0x266671,_0x43293a,_0x158e68[_0xfb01('0x38')]);})['then'](function(_0x45c0c1){_0x5d7a87=_0x45c0c1;logger['info'](_0xfb01('0x95'),_0x5d7a87['id']);return getEndUser(_0x36ac68,_0x266671,_0x43293a,_0x243d65[_0xfb01('0x96')],_0x243d65[_0xfb01('0x97')],_0x5d7a87,_0xfc7949);})['then'](function(_0x12c07c){_0x4d9eef=_0x12c07c;return getCall(_0x36ac68,_0x266671,_0x43293a,_0x5d7a87,_0x4d9eef,_0xfc7949,_0x243d65,_0xfb01('0x98'));})[_0xfb01('0x2b')](function(_0x4035a3){if(_0x4035a3){logger['info'](_0xfb01('0x8c'),_0x4035a3['id']);logger[_0xfb01('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfb01('0x64')](_0xfb01('0x8e'),_0x158e68[_0xfb01('0x19')]),_0xfb01('0x8f'),{'uri':_0xfb01('0x90')+_0x43293a[_0xfb01('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4035a3['id']});}})[_0xfb01('0x2e')](function(_0x14d496){logger[_0xfb01('0x3e')]('[OUTBOUND]',JSON[_0xfb01('0xd')](_0x14d496));});};exports['unmanaged']=function(_0xa2c2e9,_0x2af4dc,_0x31b5d7,_0x2e02d5,_0x43d8d5,_0x12a242){var _0x65431d,_0x25687a,_0x757ec;_0x12a242[_0xfb01('0x7f')]=intUtil[_0xfb01('0x80')](_0x12a242[_0xfb01('0x7f')]);_0x12a242['serverUrl']=intUtil[_0xfb01('0x80')](_0x12a242[_0xfb01('0x81')]);if(_0x43d8d5&&_0x43d8d5['monitor_format']){logger[_0xfb01('0x30')]('['+_0x2af4dc[_0xfb01('0x6a')][_0xfb01('0x99')]()+']',_0xfb01('0x84'));_0x2af4dc[_0xfb01('0x85')]=_0x12a242[_0xfb01('0x81')]+_0xfb01('0x94')+_0x2af4dc[_0xfb01('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2af4dc[_0xfb01('0x87')]);}else{_0x2af4dc[_0xfb01('0x85')]='';}var _0x40712e=_0x12a242[_0xfb01('0x7f')]===_0xfb01('0x88')?'eu':'com';return getAccessToken(_0x12a242)['then'](function(_0x1e0b93){_0x757ec=_0x1e0b93;return getUser(_0x757ec,_0x40712e,_0x12a242);})[_0xfb01('0x2b')](function(_0x21c8fc){_0x65431d=_0x21c8fc;logger[_0xfb01('0x30')](_0xfb01('0x95'),_0x65431d['id']);return getEndUser(_0x757ec,_0x40712e,_0x12a242,_0x2af4dc['calleridname'],_0x2af4dc[_0xfb01('0x8a')],_0x65431d,_0x31b5d7);})[_0xfb01('0x2b')](function(_0xf48197){_0x25687a=_0xf48197;return getCall(_0x757ec,_0x40712e,_0x12a242,_0x65431d,_0x25687a,_0x31b5d7,_0x2af4dc,_0xfb01('0x8b'));})[_0xfb01('0x2b')](function(_0x4f67f5){if(_0x4f67f5){logger[_0xfb01('0x30')](_0xfb01('0x8c'),_0x4f67f5['id']);}})[_0xfb01('0x2e')](function(_0x74df49){logger[_0xfb01('0x3e')]('['+_0x2af4dc[_0xfb01('0x6a')]['toUpperCase']()+']',JSON[_0xfb01('0xd')](_0x74df49));});}; \ 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 de7eefe..b521c18 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 _0x6e5b=['shelljs','../../../../config/logger','trigger','exec','Script','data3','render','error','format','util'];(function(_0x417a23,_0x2b9d20){var _0x1502e9=function(_0x46ed84){while(--_0x46ed84){_0x417a23['push'](_0x417a23['shift']());}};_0x1502e9(++_0x2b9d20);}(_0x6e5b,0xb3));var _0xb6e5=function(_0x418431,_0x5dec18){_0x418431=_0x418431-0x0;var _0x280d9c=_0x6e5b[_0x418431];return _0x280d9c;};'use strict';var util=require(_0xb6e5('0x0'));var sh=require(_0xb6e5('0x1'));var Mustache=require('mustache');var logger=require(_0xb6e5('0x2'))(_0xb6e5('0x3'));exports[_0xb6e5('0x4')]=function(_0x3df086,_0x15eef6){var _0xcd66d4=_0x3df086['data2']?_0x3df086['data2']:_0xb6e5('0x5');var _0x430f60=_0x3df086[_0xb6e5('0x6')]?Mustache[_0xb6e5('0x7')](_0x3df086[_0xb6e5('0x6')],_0x15eef6):_0x15eef6;sh['exec'](_0x430f60,function(_0x36c73f,_0x3464fe,_0x2d5507){if(_0x36c73f!==0x0){logger[_0xb6e5('0x8')](util[_0xb6e5('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xcd66d4,_0x430f60,_0x36c73f,_0x2d5507));}else{logger['info'](util[_0xb6e5('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0xcd66d4,_0x430f60,_0x3464fe));}});}; \ No newline at end of file +var _0x5b4b=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data3','exec','error','format','info'];(function(_0x494451,_0x54b7fe){var _0x3b4f04=function(_0x20c41d){while(--_0x20c41d){_0x494451['push'](_0x494451['shift']());}};_0x3b4f04(++_0x54b7fe);}(_0x5b4b,0x161));var _0xb5b4=function(_0x5f013e,_0x138a7b){_0x5f013e=_0x5f013e-0x0;var _0x247274=_0x5b4b[_0x5f013e];return _0x247274;};'use strict';var util=require(_0xb5b4('0x0'));var sh=require(_0xb5b4('0x1'));var Mustache=require(_0xb5b4('0x2'));var logger=require(_0xb5b4('0x3'))(_0xb5b4('0x4'));exports['exec']=function(_0x1d2bdc,_0x21ead1){var _0xa95372=_0x1d2bdc['data2']?_0x1d2bdc['data2']:'Script';var _0x5aff2d=_0x1d2bdc[_0xb5b4('0x5')]?Mustache['render'](_0x1d2bdc[_0xb5b4('0x5')],_0x21ead1):_0x21ead1;sh[_0xb5b4('0x6')](_0x5aff2d,function(_0x28bebf,_0x7b352e,_0x1fdca0){if(_0x28bebf!==0x0){logger[_0xb5b4('0x7')](util[_0xb5b4('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xa95372,_0x5aff2d,_0x28bebf,_0x1fdca0));}else{logger[_0xb5b4('0x9')](util['format'](_0xb5b4('0xa'),_0xa95372,_0x5aff2d,_0x7b352e));}});}; \ 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 54f2316..2b8b6bf 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 _0x9b0a=['info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','data2','data5','number','data6','parse','render','error','stack','toUpperCase','GET','data7','body'];(function(_0x378c7b,_0x39222a){var _0x150c82=function(_0x317f84){while(--_0x317f84){_0x378c7b['push'](_0x378c7b['shift']());}};_0x150c82(++_0x39222a);}(_0x9b0a,0x1af));var _0xa9b0=function(_0x545dd3,_0x2a4af4){_0x545dd3=_0x545dd3-0x0;var _0x2ba373=_0x9b0a[_0x545dd3];return _0x2ba373;};'use strict';var rp=require(_0xa9b0('0x0'));var util=require('util');var _=require(_0xa9b0('0x1'));var Mustache=require(_0xa9b0('0x2'));var logger=require(_0xa9b0('0x3'))(_0xa9b0('0x4'));exports[_0xa9b0('0x5')]=function(_0x39d1db,_0x3840f7){var _0x30a07e,_0x4071fa;var _0x3bfbc0={'method':_0x39d1db[_0xa9b0('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x39d1db[_0xa9b0('0x7')],_0x3840f7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39d1db[_0xa9b0('0x8')])===_0xa9b0('0x9')&&parseInt(_0x39d1db[_0xa9b0('0x8')])>=0x1&&parseInt(_0x39d1db[_0xa9b0('0x8')])<=0xa?parseInt(_0x39d1db[_0xa9b0('0x8')])*0x3e8:0x5*0x3e8};try{_0x3bfbc0['headers']=_0x39d1db[_0xa9b0('0xa')]?JSON[_0xa9b0('0xb')](Mustache[_0xa9b0('0xc')](_0x39d1db[_0xa9b0('0xa')],_0x3840f7)):{};}catch(_0x392e09){logger[_0xa9b0('0xd')](_0x392e09[_0xa9b0('0xe')]);}switch(_0x39d1db[_0xa9b0('0x6')][_0xa9b0('0xf')]()){case _0xa9b0('0x10'):case'DELETE':_0x30a07e=null;_0x3bfbc0['qs']=_0x3840f7;break;case'POST':case'PUT':if(_0x39d1db[_0xa9b0('0x11')]){try{_0x30a07e=JSON[_0xa9b0('0xb')](Mustache['render'](_0x39d1db['data7'],_0x3840f7));_0x3bfbc0[_0xa9b0('0x12')]=_0x30a07e;}catch(_0x3d876a){logger[_0xa9b0('0xd')](_0x3d876a['stack']);logger[_0xa9b0('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x30a07e=_0x3840f7;_0x3bfbc0[_0xa9b0('0x12')]=_0x30a07e;}break;}logger[_0xa9b0('0x13')](util[_0xa9b0('0x14')](_0xa9b0('0x15'),_0x39d1db[_0xa9b0('0x6')],_0x39d1db[_0xa9b0('0x7')],JSON[_0xa9b0('0x16')](_0x3bfbc0)));rp(_0x3bfbc0)['then'](function(_0x6ae4d5){_0x30a07e=!_[_0xa9b0('0x17')](_0x30a07e)?_0xa9b0('0x18')+_0x30a07e:'';_0x4071fa=typeof _0x6ae4d5[_0xa9b0('0x12')]==='object'?JSON[_0xa9b0('0x16')](_0x6ae4d5['body']):_0x6ae4d5[_0xa9b0('0x12')];logger[_0xa9b0('0x13')](util[_0xa9b0('0x14')](_0xa9b0('0x19'),_0x39d1db[_0xa9b0('0x6')],_0x39d1db['data2'],_0x6ae4d5['statusCode'],_0x4071fa));})[_0xa9b0('0x1a')](function(_0x2e637a){logger['error'](util[_0xa9b0('0x14')](_0xa9b0('0x1b'),_0x39d1db[_0xa9b0('0x6')],_0x39d1db['data2'],_0x2e637a[_0xa9b0('0x1c')],_0x2e637a['name'],_0x2e637a[_0xa9b0('0x1d')]));});}; \ No newline at end of file +var _0x75f2=[',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','trigger','exec','data1','data2','data5','headers','data6','parse','render','error','stack','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','then','isNil'];(function(_0x901852,_0x1d74f6){var _0x18da1d=function(_0x343c3d){while(--_0x343c3d){_0x901852['push'](_0x901852['shift']());}};_0x18da1d(++_0x1d74f6);}(_0x75f2,0x1b9));var _0x275f=function(_0x26be12,_0x338b2c){_0x26be12=_0x26be12-0x0;var _0x110b3c=_0x75f2[_0x26be12];return _0x110b3c;};'use strict';var rp=require(_0x275f('0x0'));var util=require(_0x275f('0x1'));var _=require(_0x275f('0x2'));var Mustache=require(_0x275f('0x3'));var logger=require('../../../../config/logger')(_0x275f('0x4'));exports[_0x275f('0x5')]=function(_0x1d07ef,_0x27ae85){var _0x48486e,_0x452a55;var _0x5156d7={'method':_0x1d07ef[_0x275f('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x1d07ef[_0x275f('0x7')],_0x27ae85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1d07ef[_0x275f('0x8')])==='number'&&parseInt(_0x1d07ef[_0x275f('0x8')])>=0x1&&parseInt(_0x1d07ef[_0x275f('0x8')])<=0xa?parseInt(_0x1d07ef[_0x275f('0x8')])*0x3e8:0x5*0x3e8};try{_0x5156d7[_0x275f('0x9')]=_0x1d07ef[_0x275f('0xa')]?JSON[_0x275f('0xb')](Mustache[_0x275f('0xc')](_0x1d07ef[_0x275f('0xa')],_0x27ae85)):{};}catch(_0x8765d2){logger[_0x275f('0xd')](_0x8765d2[_0x275f('0xe')]);}switch(_0x1d07ef[_0x275f('0x6')]['toUpperCase']()){case'GET':case'DELETE':_0x48486e=null;_0x5156d7['qs']=_0x27ae85;break;case _0x275f('0xf'):case _0x275f('0x10'):if(_0x1d07ef['data7']){try{_0x48486e=JSON[_0x275f('0xb')](Mustache[_0x275f('0xc')](_0x1d07ef[_0x275f('0x11')],_0x27ae85));_0x5156d7[_0x275f('0x12')]=_0x48486e;}catch(_0x1ccd1a){logger[_0x275f('0xd')](_0x1ccd1a[_0x275f('0xe')]);logger[_0x275f('0xd')](_0x275f('0x13'));}}else{_0x48486e=_0x27ae85;_0x5156d7[_0x275f('0x12')]=_0x48486e;}break;}logger[_0x275f('0x14')](util[_0x275f('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x1d07ef[_0x275f('0x6')],_0x1d07ef['data2'],JSON['stringify'](_0x5156d7)));rp(_0x5156d7)[_0x275f('0x16')](function(_0x2b4609){_0x48486e=!_[_0x275f('0x17')](_0x48486e)?_0x275f('0x18')+_0x48486e:'';_0x452a55=typeof _0x2b4609[_0x275f('0x12')]==='object'?JSON[_0x275f('0x19')](_0x2b4609[_0x275f('0x12')]):_0x2b4609[_0x275f('0x12')];logger[_0x275f('0x14')](util[_0x275f('0x15')](_0x275f('0x1a'),_0x1d07ef[_0x275f('0x6')],_0x1d07ef[_0x275f('0x7')],_0x2b4609[_0x275f('0x1b')],_0x452a55));})[_0x275f('0x1c')](function(_0x180a23){logger[_0x275f('0xd')](util['format'](_0x275f('0x1d'),_0x1d07ef[_0x275f('0x6')],_0x1d07ef['data2'],_0x180a23[_0x275f('0x1b')],_0x180a23['name'],_0x180a23[_0x275f('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f1cfdea..e9d0fb6 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 _0x09a9=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','http','Request','request','then','debug'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x09a9,0x172));var _0x909a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x09a9[_0x21549c];return _0x426cbd;};'use strict';var jayson=require(_0x909a('0x0'));var BPromise=require(_0x909a('0x1'));var logger=require('../../config/logger')(_0x909a('0x2'));var client=jayson['client'][_0x909a('0x3')]({'port':0x2329});client[_0x909a('0x4')]=function(_0x2ee4d0,_0x1d30fb){return new BPromise(function(_0x27dcb4,_0x581e87){return client[_0x909a('0x5')](_0x2ee4d0,_0x1d30fb)[_0x909a('0x6')](function(_0x4baf39){logger[_0x909a('0x7')](_0x909a('0x8'),_0x909a('0x2'),_0x2ee4d0,_0x1d30fb,_0x4baf39);if(_0x4baf39[_0x909a('0x9')]){logger[_0x909a('0x9')]('rpc',_0x909a('0x2'),_0x2ee4d0,_0x4baf39[_0x909a('0x9')]['message'],_0x1d30fb);return _0x581e87(_0x4baf39[_0x909a('0x9')][_0x909a('0xa')]);}else{return _0x27dcb4(_0x4baf39[_0x909a('0xb')]);}})[_0x909a('0xc')](function(_0x1ff0e1){logger[_0x909a('0x9')](_0x909a('0x8'),_0x909a('0x2'),_0x2ee4d0,_0x1ff0e1,_0x1d30fb);return _0x581e87(_0x1ff0e1);});});};module[_0x909a('0xd')]=client; \ No newline at end of file +var _0x5d2c=['message','result','catch','exports','jayson/promise','../../config/logger','routing','http','request','then','debug','rpc','error'];(function(_0x4981bc,_0x58516c){var _0x3ae841=function(_0x13bfbd){while(--_0x13bfbd){_0x4981bc['push'](_0x4981bc['shift']());}};_0x3ae841(++_0x58516c);}(_0x5d2c,0x197));var _0xc5d2=function(_0x4e893b,_0x501550){_0x4e893b=_0x4e893b-0x0;var _0x4ddf83=_0x5d2c[_0x4e893b];return _0x4ddf83;};'use strict';var jayson=require(_0xc5d2('0x0'));var BPromise=require('bluebird');var logger=require(_0xc5d2('0x1'))(_0xc5d2('0x2'));var client=jayson['client'][_0xc5d2('0x3')]({'port':0x2329});client['Request']=function(_0x39b654,_0x542570){return new BPromise(function(_0x34ec7b,_0x4e215f){return client[_0xc5d2('0x4')](_0x39b654,_0x542570)[_0xc5d2('0x5')](function(_0x532473){logger[_0xc5d2('0x6')](_0xc5d2('0x7'),_0xc5d2('0x2'),_0x39b654,_0x542570,_0x532473);if(_0x532473[_0xc5d2('0x8')]){logger[_0xc5d2('0x8')]('rpc','routing',_0x39b654,_0x532473[_0xc5d2('0x8')][_0xc5d2('0x9')],_0x542570);return _0x4e215f(_0x532473[_0xc5d2('0x8')][_0xc5d2('0x9')]);}else{return _0x34ec7b(_0x532473[_0xc5d2('0xa')]);}})[_0xc5d2('0xb')](function(_0x3d393b){logger[_0xc5d2('0x8')]('rpc',_0xc5d2('0x2'),_0x39b654,_0x3d393b,_0x542570);return _0x4e215f(_0x3d393b);});});};module[_0xc5d2('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a12a776..ddeb8aa 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 _0x3dd4=['getMailAccounts','initMailAccounts','refresh','listen','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3dd4,0x6e));var _0x43dd=function(_0x10a434,_0x1d147f){_0x10a434=_0x10a434-0x0;var _0xb36713=_0x3dd4[_0x10a434];return _0xb36713;};'use strict';var server=require(_0x43dd('0x0'));var Realtime=require(_0x43dd('0x1'));var EmailChannel=require(_0x43dd('0x2'));var mailAccount=require(_0x43dd('0x3'));var setting=require(_0x43dd('0x4'));var logger=require(_0x43dd('0x5'))(_0x43dd('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x43dd('0x7')]()[_0x43dd('0x8')](mailAccount[_0x43dd('0x9')]())[_0x43dd('0x8')](realtime[_0x43dd('0xa')]())['then'](function(){email[_0x43dd('0xb')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x43dd('0xc')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x43dd('0xd')]();})[_0x43dd('0x8')](function(_0x2a6937){return setInterval(initRealtime,_0x2a6937['loginMailFrequency']*0x3e8);})[_0x43dd('0xe')](function(_0x1c9c3a){logger[_0x43dd('0xf')](_0x43dd('0x10'),_0x1c9c3a);});}main(); \ No newline at end of file +var _0xbcd0=['catch','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','refresh','listen','loginMailFrequency'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbcd0,0x135));var _0x0bcd=function(_0x41e6b5,_0x190074){_0x41e6b5=_0x41e6b5-0x0;var _0x140c32=_0xbcd0[_0x41e6b5];return _0x140c32;};'use strict';var server=require(_0x0bcd('0x0'));var Realtime=require(_0x0bcd('0x1'));var EmailChannel=require(_0x0bcd('0x2'));var mailAccount=require(_0x0bcd('0x3'));var setting=require(_0x0bcd('0x4'));var logger=require(_0x0bcd('0x5'))(_0x0bcd('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0bcd('0x7')]()[_0x0bcd('0x8')](mailAccount[_0x0bcd('0x9')]())[_0x0bcd('0x8')](realtime['initMailAccounts']())['then'](function(){email[_0x0bcd('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0bcd('0xb')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x108fda){return setInterval(initRealtime,_0x108fda[_0x0bcd('0xc')]*0x3e8);})[_0x0bcd('0xd')](function(_0x35a33b){logger['error']('Email\x20service\x20initialization',_0x35a33b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 10f81b2..6637a3f 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 _0x2e51=['handleImapBox','bind','error','handleImapError','messages','handleImapEmail','info','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','smtp','send','verifySmtp','Smtp','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','service','custom','imapAccounts','box'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x2e51,0x170));var _0x12e5=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x2e51[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x12e5('0x0'));var moment=require(_0x12e5('0x1'));var BPromise=require(_0x12e5('0x2'));var md5=require(_0x12e5('0x3'));var Redis=require('ioredis');var config=require(_0x12e5('0x4'));var logger=require(_0x12e5('0x5'))(_0x12e5('0x6'));config['redis']=_[_0x12e5('0x7')](config[_0x12e5('0x8')],{'host':_0x12e5('0x9'),'port':0x18eb});var io=require(_0x12e5('0xa'))(new Redis(config[_0x12e5('0x8')]));var EmailImap=require(_0x12e5('0xb'));var EmailSmtp=require(_0x12e5('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x908823){logger['info'](_0x12e5('0xd'));this[_0x12e5('0xe')]=_0x908823[_0x12e5('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x12e5('0xf')][_0x12e5('0x10')]=function(_0x4b42a4){var _0x4c0fb6=this[_0x12e5('0xe')][_0x4b42a4];var _0x2d9143={'id':_0x4c0fb6['id'],'name':_0x4c0fb6[_0x12e5('0x11')],'key':_0x4c0fb6[_0x12e5('0x12')],'active':_0x4c0fb6[_0x12e5('0x13')],'Imap':{'status':_0x4c0fb6['Imap'][_0x12e5('0x14')],'messageStatus':_0x4c0fb6[_0x12e5('0x15')][_0x12e5('0x16')],'total':_0x4c0fb6[_0x12e5('0x15')][_0x12e5('0x17')]}};if(_[_0x12e5('0x18')](md5Accounts[_0x4b42a4])){md5Accounts[_0x4b42a4]={};}var _0x3aa39c=md5(JSON[_0x12e5('0x19')](_0x2d9143));if(md5Accounts[_0x4b42a4]['md5']!==_0x3aa39c){md5Accounts[_0x4b42a4]['md5']=_0x3aa39c;io[_0x12e5('0x10')]('mailAccount:update',_0x2d9143);}};EmailChannel[_0x12e5('0xf')][_0x12e5('0x1a')]=function(_0x48d877){for(var _0x1ce17d in _0x48d877){if(_0x48d877[_0x12e5('0x1b')](_0x1ce17d)){if(_0x48d877[_0x1ce17d][_0x12e5('0x15')]&&_0x48d877[_0x1ce17d][_0x12e5('0x13')]){var _0x4604cb=_0x48d877[_0x1ce17d][_0x12e5('0x15')];if(!_0x4604cb[_0x12e5('0x1c')]&&_0x48d877[_0x1ce17d]['provider']!==_0x12e5('0x1d'))_0x4604cb[_0x12e5('0x1c')]=_0x48d877[_0x1ce17d]['provider'];if(!this[_0x12e5('0x1e')]['hasOwnProperty'](_0x4604cb['id'])){this['imapAccounts'][_0x4604cb['id']]=new EmailImap(_0x4604cb,_0x48d877[_0x1ce17d][_0x12e5('0x6')]);this[_0x12e5('0x1e')][_0x4604cb['id']]['on'](_0x12e5('0x1f'),this[_0x12e5('0x20')][_0x12e5('0x21')](this,_0x1ce17d));this[_0x12e5('0x1e')][_0x4604cb['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x1ce17d));this[_0x12e5('0x1e')][_0x4604cb['id']]['on']('end',this['handleImapEnd'][_0x12e5('0x21')](this,_0x1ce17d));this['imapAccounts'][_0x4604cb['id']]['on'](_0x12e5('0x22'),this[_0x12e5('0x23')][_0x12e5('0x21')](this,_0x1ce17d));}}else{if(_[_0x12e5('0x18')](this[_0x12e5('0xe')][_0x1ce17d][_0x12e5('0x15')])){this[_0x12e5('0xe')][_0x1ce17d]['Imap']={};}this['mailAccounts'][_0x1ce17d]['Imap'][_0x12e5('0x14')]='disabled';this[_0x12e5('0xe')][_0x1ce17d][_0x12e5('0x15')][_0x12e5('0x16')]='';this[_0x12e5('0x10')](_0x1ce17d);}}}};EmailChannel[_0x12e5('0xf')][_0x12e5('0x20')]=function(_0x3cf805,_0x4db5bc){if(this[_0x12e5('0xe')][_0x3cf805]){this[_0x12e5('0xe')][_0x3cf805][_0x12e5('0x15')][_0x12e5('0x14')]='connected';this[_0x12e5('0xe')][_0x3cf805]['Imap'][_0x12e5('0x16')]=_0x4db5bc['name'];if(_0x4db5bc[_0x12e5('0x24')]){this[_0x12e5('0xe')][_0x3cf805][_0x12e5('0x15')][_0x12e5('0x17')]=_0x4db5bc[_0x12e5('0x24')][_0x12e5('0x17')];}return this['emit'](_0x3cf805);}};EmailChannel['prototype'][_0x12e5('0x25')]=function(_0x2488ec,_0x11daae){logger[_0x12e5('0x26')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x11daae['firstName'],_0x11daae['lastName'],_0x11daae[_0x12e5('0x27')],_0x2488ec);if(this[_0x12e5('0xe')][_0x2488ec]){return mailAccount['notify'](_0x2488ec,_0x11daae)[_0x12e5('0x28')](function(_0x32938c){if(_0x32938c){logger[_0x12e5('0x26')]('Mail\x20accepted\x20from\x20routing');}})[_0x12e5('0x29')](function(_0x344ecf){logger['error'](_0x12e5('0x2a'),JSON['stringify'](_0x344ecf));});}};EmailChannel['prototype'][_0x12e5('0x2b')]=function(_0x490dfa){if(this[_0x12e5('0xe')][_0x490dfa]&&this['mailAccounts'][_0x490dfa][_0x12e5('0x15')]){if(this['imapAccounts'][this[_0x12e5('0xe')][_0x490dfa]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x490dfa][_0x12e5('0x15')]['id']];}this[_0x12e5('0xe')][_0x490dfa][_0x12e5('0x15')][_0x12e5('0x2c')]=moment();this[_0x12e5('0x10')](_0x490dfa);}};EmailChannel[_0x12e5('0xf')][_0x12e5('0x23')]=function(_0x563aa7,_0x50ae1b){if(this[_0x12e5('0xe')][_0x563aa7]){this['mailAccounts'][_0x563aa7][_0x12e5('0x15')][_0x12e5('0x14')]=_0x12e5('0x22');this[_0x12e5('0xe')][_0x563aa7][_0x12e5('0x15')]['messageStatus']=_0x50ae1b;return this[_0x12e5('0x10')](_0x563aa7);}};EmailChannel[_0x12e5('0xf')]['sendMail']=function(_0xee0905,_0x26f543){return this[_0x12e5('0x2d')][_0x12e5('0x2e')](_0xee0905,_0x26f543);};EmailChannel['prototype'][_0x12e5('0x2f')]=function(_0x33f2e4){var _0x2712c2=this;if(this[_0x12e5('0xe')][_0x33f2e4['id']]){if(_[_0x12e5('0x18')](this[_0x12e5('0xe')][_0x33f2e4['id']][_0x12e5('0x30')])){this[_0x12e5('0xe')][_0x33f2e4['id']][_0x12e5('0x30')]={};}this['mailAccounts'][_0x33f2e4['id']][_0x12e5('0x30')][_0x12e5('0x2c')]=moment();return new BPromise(function(_0x4b213d,_0x9c43ad){return _0x2712c2[_0x12e5('0x2d')]['verify'](_0x33f2e4)[_0x12e5('0x28')](function(_0x1015f7){_0x2712c2[_0x12e5('0xe')][_0x33f2e4['id']][_0x12e5('0x30')][_0x12e5('0x14')]='verified';_0x2712c2['mailAccounts'][_0x33f2e4['id']][_0x12e5('0x30')][_0x12e5('0x16')]='';_0x2712c2[_0x12e5('0x10')](_0x33f2e4['id']);_0x4b213d(_0x1015f7);})[_0x12e5('0x29')](function(_0x26edfb){_0x2712c2[_0x12e5('0xe')][_0x33f2e4['id']][_0x12e5('0x30')][_0x12e5('0x14')]=_0x12e5('0x22');_0x2712c2[_0x12e5('0xe')][_0x33f2e4['id']][_0x12e5('0x30')][_0x12e5('0x16')]=_0x26edfb;_0x2712c2[_0x12e5('0x10')](_0x33f2e4['id']);_0x9c43ad(_0x26edfb);});});}return this[_0x12e5('0x2d')]['verify'](_0x33f2e4);};module[_0x12e5('0x31')]=EmailChannel; \ No newline at end of file +var _0x9b7b=['ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','mailAccount:update','refresh','hasOwnProperty','service','provider','box','handleImapEmail','end','handleImapEnd','bind','isNil','disabled','handleImapBox','status','connected','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','then','verified','error','verify','moment','bluebird','md5'];(function(_0x50a903,_0x438317){var _0x1c8c3c=function(_0x4ec991){while(--_0x4ec991){_0x50a903['push'](_0x50a903['shift']());}};_0x1c8c3c(++_0x438317);}(_0x9b7b,0xe1));var _0xb9b7=function(_0x3faad0,_0x1b26a6){_0x3faad0=_0x3faad0-0x0;var _0x5f2fc8=_0x9b7b[_0x3faad0];return _0x5f2fc8;};'use strict';var _=require('lodash');var moment=require(_0xb9b7('0x0'));var BPromise=require(_0xb9b7('0x1'));var md5=require(_0xb9b7('0x2'));var Redis=require(_0xb9b7('0x3'));var config=require(_0xb9b7('0x4'));var logger=require('../../../config/logger')(_0xb9b7('0x5'));config[_0xb9b7('0x6')]=_['defaults'](config[_0xb9b7('0x6')],{'host':_0xb9b7('0x7'),'port':0x18eb});var io=require(_0xb9b7('0x8'))(new Redis(config[_0xb9b7('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xb9b7('0x9'));var md5Accounts={};function EmailChannel(_0x3056eb){logger['info'](_0xb9b7('0xa'));this['mailAccounts']=_0x3056eb[_0xb9b7('0xb')];this[_0xb9b7('0xc')]={};this[_0xb9b7('0xd')]=new EmailSmtp();}EmailChannel[_0xb9b7('0xe')][_0xb9b7('0xf')]=function(_0x50b1f6){var _0x41be7d=this['mailAccounts'][_0x50b1f6];var _0x13902e={'id':_0x41be7d['id'],'name':_0x41be7d[_0xb9b7('0x10')],'key':_0x41be7d[_0xb9b7('0x11')],'active':_0x41be7d[_0xb9b7('0x12')],'Imap':{'status':_0x41be7d['Imap']['status'],'messageStatus':_0x41be7d[_0xb9b7('0x13')][_0xb9b7('0x14')],'total':_0x41be7d[_0xb9b7('0x13')]['total']}};if(_['isNil'](md5Accounts[_0x50b1f6])){md5Accounts[_0x50b1f6]={};}var _0x51e680=md5(JSON['stringify'](_0x13902e));if(md5Accounts[_0x50b1f6][_0xb9b7('0x2')]!==_0x51e680){md5Accounts[_0x50b1f6][_0xb9b7('0x2')]=_0x51e680;io[_0xb9b7('0xf')](_0xb9b7('0x15'),_0x13902e);}};EmailChannel[_0xb9b7('0xe')][_0xb9b7('0x16')]=function(_0xc01b04){for(var _0xb2163 in _0xc01b04){if(_0xc01b04[_0xb9b7('0x17')](_0xb2163)){if(_0xc01b04[_0xb2163][_0xb9b7('0x13')]&&_0xc01b04[_0xb2163][_0xb9b7('0x12')]){var _0x547d73=_0xc01b04[_0xb2163][_0xb9b7('0x13')];if(!_0x547d73[_0xb9b7('0x18')]&&_0xc01b04[_0xb2163][_0xb9b7('0x19')]!=='custom')_0x547d73[_0xb9b7('0x18')]=_0xc01b04[_0xb2163][_0xb9b7('0x19')];if(!this[_0xb9b7('0xc')][_0xb9b7('0x17')](_0x547d73['id'])){this[_0xb9b7('0xc')][_0x547d73['id']]=new EmailImap(_0x547d73,_0xc01b04[_0xb2163][_0xb9b7('0x5')]);this[_0xb9b7('0xc')][_0x547d73['id']]['on'](_0xb9b7('0x1a'),this['handleImapBox']['bind'](this,_0xb2163));this[_0xb9b7('0xc')][_0x547d73['id']]['on'](_0xb9b7('0x5'),this[_0xb9b7('0x1b')]['bind'](this,_0xb2163));this['imapAccounts'][_0x547d73['id']]['on'](_0xb9b7('0x1c'),this[_0xb9b7('0x1d')]['bind'](this,_0xb2163));this[_0xb9b7('0xc')][_0x547d73['id']]['on']('error',this['handleImapError'][_0xb9b7('0x1e')](this,_0xb2163));}}else{if(_[_0xb9b7('0x1f')](this[_0xb9b7('0xb')][_0xb2163]['Imap'])){this[_0xb9b7('0xb')][_0xb2163][_0xb9b7('0x13')]={};}this[_0xb9b7('0xb')][_0xb2163][_0xb9b7('0x13')]['status']=_0xb9b7('0x20');this['mailAccounts'][_0xb2163]['Imap'][_0xb9b7('0x14')]='';this[_0xb9b7('0xf')](_0xb2163);}}}};EmailChannel[_0xb9b7('0xe')][_0xb9b7('0x21')]=function(_0x18e306,_0x356cd0){if(this[_0xb9b7('0xb')][_0x18e306]){this[_0xb9b7('0xb')][_0x18e306][_0xb9b7('0x13')][_0xb9b7('0x22')]=_0xb9b7('0x23');this['mailAccounts'][_0x18e306][_0xb9b7('0x13')][_0xb9b7('0x14')]=_0x356cd0['name'];if(_0x356cd0[_0xb9b7('0x24')]){this[_0xb9b7('0xb')][_0x18e306][_0xb9b7('0x13')][_0xb9b7('0x25')]=_0x356cd0[_0xb9b7('0x24')][_0xb9b7('0x25')];}return this['emit'](_0x18e306);}};EmailChannel['prototype'][_0xb9b7('0x1b')]=function(_0x1186e4,_0x5257d0){logger[_0xb9b7('0x26')](_0xb9b7('0x27'),_0x5257d0[_0xb9b7('0x28')],_0x5257d0[_0xb9b7('0x29')],_0x5257d0[_0xb9b7('0x2a')],_0x1186e4);if(this[_0xb9b7('0xb')][_0x1186e4]){return mailAccount[_0xb9b7('0x2b')](_0x1186e4,_0x5257d0)['then'](function(_0x3a52f9){if(_0x3a52f9){logger[_0xb9b7('0x26')]('Mail\x20accepted\x20from\x20routing');}})[_0xb9b7('0x2c')](function(_0x10ef4b){logger['error'](_0xb9b7('0x2d'),JSON[_0xb9b7('0x2e')](_0x10ef4b));});}};EmailChannel[_0xb9b7('0xe')]['handleImapEnd']=function(_0x5b16de){if(this[_0xb9b7('0xb')][_0x5b16de]&&this['mailAccounts'][_0x5b16de][_0xb9b7('0x13')]){if(this[_0xb9b7('0xc')][this[_0xb9b7('0xb')][_0x5b16de][_0xb9b7('0x13')]['id']]){delete this[_0xb9b7('0xc')][this[_0xb9b7('0xb')][_0x5b16de][_0xb9b7('0x13')]['id']];}this[_0xb9b7('0xb')][_0x5b16de][_0xb9b7('0x13')][_0xb9b7('0x2f')]=moment();this['emit'](_0x5b16de);}};EmailChannel[_0xb9b7('0xe')][_0xb9b7('0x30')]=function(_0x5c044e,_0x141c28){if(this[_0xb9b7('0xb')][_0x5c044e]){this[_0xb9b7('0xb')][_0x5c044e][_0xb9b7('0x13')][_0xb9b7('0x22')]='error';this[_0xb9b7('0xb')][_0x5c044e]['Imap']['messageStatus']=_0x141c28;return this[_0xb9b7('0xf')](_0x5c044e);}};EmailChannel['prototype'][_0xb9b7('0x31')]=function(_0x4efc59,_0x2b7a4f){return this[_0xb9b7('0xd')][_0xb9b7('0x32')](_0x4efc59,_0x2b7a4f);};EmailChannel[_0xb9b7('0xe')][_0xb9b7('0x33')]=function(_0x22531a){var _0x48cae3=this;if(this[_0xb9b7('0xb')][_0x22531a['id']]){if(_[_0xb9b7('0x1f')](this[_0xb9b7('0xb')][_0x22531a['id']][_0xb9b7('0x34')])){this[_0xb9b7('0xb')][_0x22531a['id']][_0xb9b7('0x34')]={};}this['mailAccounts'][_0x22531a['id']][_0xb9b7('0x34')][_0xb9b7('0x2f')]=moment();return new BPromise(function(_0x986106,_0x32c192){return _0x48cae3[_0xb9b7('0xd')]['verify'](_0x22531a)[_0xb9b7('0x35')](function(_0x29b616){_0x48cae3[_0xb9b7('0xb')][_0x22531a['id']][_0xb9b7('0x34')][_0xb9b7('0x22')]=_0xb9b7('0x36');_0x48cae3[_0xb9b7('0xb')][_0x22531a['id']]['Smtp'][_0xb9b7('0x14')]='';_0x48cae3[_0xb9b7('0xf')](_0x22531a['id']);_0x986106(_0x29b616);})[_0xb9b7('0x2c')](function(_0x22ca24){_0x48cae3['mailAccounts'][_0x22531a['id']]['Smtp'][_0xb9b7('0x22')]=_0xb9b7('0x37');_0x48cae3[_0xb9b7('0xb')][_0x22531a['id']][_0xb9b7('0x34')][_0xb9b7('0x14')]=_0x22ca24;_0x48cae3[_0xb9b7('0xf')](_0x22531a['id']);_0x32c192(_0x22ca24);});});}return this[_0xb9b7('0xd')][_0xb9b7('0x38')](_0x22531a);};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 a497a50..92920e9 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 _0x6489=['account','once','handleReady','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','getAccount'];(function(_0x148563,_0x4be2c4){var _0x5cc75b=function(_0x3f1eb2){while(--_0x3f1eb2){_0x148563['push'](_0x148563['shift']());}};_0x5cc75b(++_0x4be2c4);}(_0x6489,0x126));var _0x9648=function(_0x21ed91,_0x482dad){_0x21ed91=_0x21ed91-0x0;var _0x4275a6=_0x6489[_0x21ed91];return _0x4275a6;};'use strict';var _=require(_0x9648('0x0'));var util=require(_0x9648('0x1'));var Imap=require(_0x9648('0x2'));var simpleParser=require('mailparser')[_0x9648('0x3')];var Iconv=require('iconv')[_0x9648('0x4')];var EventEmitter=require(_0x9648('0x5'))[_0x9648('0x6')];var utils=require(_0x9648('0x7'));var logger=require('../../../config/logger')(_0x9648('0x8'));function EmailImap(_0x302930,_0x17e6ec){this[_0x9648('0x9')]=_0x302930['mailbox'];this['account']=this[_0x9648('0xa')](_0x302930,_0x17e6ec);this[_0x9648('0x2')]=new Imap(this[_0x9648('0xb')]);this['imap'][_0x9648('0xc')]('ready',this[_0x9648('0xd')][_0x9648('0xe')](this));this[_0x9648('0x2')]['once']('end',this[_0x9648('0xf')][_0x9648('0xe')](this));this[_0x9648('0x2')]['on'](_0x9648('0x10'),this[_0x9648('0x11')][_0x9648('0xe')](this));this['imap']['connect']();}util[_0x9648('0x12')](EmailImap,EventEmitter);EmailImap[_0x9648('0x13')][_0x9648('0xa')]=function(_0x23c5cc,_0x5a513f){var _0x22a741={'connTimeout':_0x23c5cc['connTimeout']?_0x23c5cc[_0x9648('0x14')]*0x3e8:0x2710,'authTimeout':_0x23c5cc['authTimeout']?_0x23c5cc[_0x9648('0x15')]*0x3e8:0x1388};if(_0x23c5cc[_0x9648('0x16')]){_0x22a741[_0x9648('0x17')]=_0x23c5cc['user'];if(_0x23c5cc[_0x9648('0x18')]){_0x22a741[_0x9648('0x19')]=utils['generateXOAuth2Token'](_0x23c5cc[_0x9648('0x1a')][_0x9648('0x1b')],_0x23c5cc[_0x9648('0x17')]);}else{_0x22a741[_0x9648('0x1c')]=_0x23c5cc['password'];}}else{if(_0x23c5cc[_0x9648('0x1d')]){_0x22a741[_0x9648('0x17')]=_0x23c5cc[_0x9648('0x17')];_0x22a741['password']=_0x23c5cc[_0x9648('0x1c')];}}_0x22a741[_0x9648('0x8')]=_0x5a513f||_0x23c5cc[_0x9648('0x17')]||_0x9648('0x1e');_0x22a741['host']=_0x23c5cc[_0x9648('0x1f')];_0x22a741['port']=_0x23c5cc[_0x9648('0x20')]||0x3e1;if(_0x23c5cc[_0x9648('0x21')]){_0x22a741[_0x9648('0x21')]=!![];}else{_0x22a741[_0x9648('0x21')]=![];_0x22a741[_0x9648('0x22')]=_0x9648('0x23');}return _0x22a741;};EmailImap[_0x9648('0x13')][_0x9648('0xd')]=function(){this[_0x9648('0x2')][_0x9648('0x24')](this[_0x9648('0x9')],![],this[_0x9648('0x25')][_0x9648('0xe')](this));};EmailImap[_0x9648('0x13')][_0x9648('0x25')]=function(_0x470fdd,_0xacde76){if(_0x470fdd){this[_0x9648('0x11')](_0x470fdd,!![]);}else{this[_0x9648('0x26')](_0x9648('0x27'),_0xacde76);this[_0x9648('0x28')]();}};EmailImap['prototype'][_0x9648('0x29')]=function(_0x349306){if(_0x349306){this[_0x9648('0x11')](_0x349306,!![]);}else{this[_0x9648('0x2')][_0x9648('0x2a')]();}};EmailImap['prototype'][_0x9648('0x28')]=function(){this[_0x9648('0x2')][_0x9648('0x2b')]([_0x9648('0x2c')],this[_0x9648('0x2d')]['bind'](this));};EmailImap['prototype'][_0x9648('0x2d')]=function(_0x309627,_0x2b2d1d){if(_0x309627){this[_0x9648('0x11')](_0x309627,!![]);}else{if(_0x2b2d1d['length']){try{var _0x44cb01=this['imap'][_0x9648('0x2e')](_0x2b2d1d,{'bodies':'','markSeen':!![]});_0x44cb01['on']('message',this[_0x9648('0x2f')]['bind'](this));_0x44cb01['once'](_0x9648('0x10'),this[_0x9648('0x30')][_0x9648('0xe')](this));_0x44cb01[_0x9648('0xc')](_0x9648('0x2a'),this[_0x9648('0x31')]['bind'](this));}catch(_0x3bdf9f){logger[_0x9648('0x10')](_0x3bdf9f);}}else{this['imap'][_0x9648('0x32')](!![],this[_0x9648('0x29')][_0x9648('0xe')](this));}}};EmailImap[_0x9648('0x13')][_0x9648('0x2f')]=function(_0x409128){_0x409128['on'](_0x9648('0x33'),this[_0x9648('0x34')][_0x9648('0xe')](this));_0x409128['once'](_0x9648('0x35'),this[_0x9648('0x36')][_0x9648('0xe')](this));_0x409128[_0x9648('0xc')](_0x9648('0x2a'),this[_0x9648('0x37')]['bind'](this));};EmailImap[_0x9648('0x13')][_0x9648('0x34')]=function(_0x4aa757){simpleParser(_0x4aa757,{'Iconv':Iconv},this[_0x9648('0x38')][_0x9648('0xe')](this));};EmailImap[_0x9648('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x9648('0x13')][_0x9648('0x37')]=function(){};EmailImap[_0x9648('0x13')][_0x9648('0x38')]=function(_0xc05487,_0x545119){if(_0xc05487){logger['error'](_0xc05487);}else{var _0xe0ea4e=this;utils[_0x9648('0x39')](this[_0x9648('0xb')],_0x545119,function(_0x3383ec){_0xe0ea4e[_0x9648('0x26')]('email',_0x3383ec);});}};EmailImap[_0x9648('0x13')][_0x9648('0x31')]=function(){this['imap'][_0x9648('0x32')](!![],this[_0x9648('0x29')]['bind'](this));};EmailImap['prototype'][_0x9648('0x30')]=function(_0x2dde3d){this['handleError'](_0x2dde3d);this[_0x9648('0x2')][_0x9648('0x32')](!![],this[_0x9648('0x29')][_0x9648('0xe')](this));};EmailImap['prototype'][_0x9648('0xf')]=function(){this[_0x9648('0x26')](_0x9648('0x2a'));};EmailImap[_0x9648('0x13')][_0x9648('0x11')]=function(_0x5a1c9a,_0x1637fb){logger[_0x9648('0x10')](_0x9648('0x11'),this[_0x9648('0xb')]['email'],JSON[_0x9648('0x3a')](_0x5a1c9a));var _0x38b2f2='';if(_0x5a1c9a){if(_0x5a1c9a[_0x9648('0x3b')]){_0x38b2f2=_0x5a1c9a[_0x9648('0x3b')];}else{for(var _0xc5ba71 in _0x5a1c9a){if(_0x5a1c9a[_0x9648('0x3c')](_0xc5ba71)){_0x38b2f2+=_['upperFirst'](_0xc5ba71)+':\x20'+_0x5a1c9a[_0xc5ba71]+'\x0a';}}}}if(_0x1637fb){this[_0x9648('0x2')][_0x9648('0x2a')]();}else{this['emit'](_0x9648('0x10'),_0x38b2f2);this[_0x9648('0x26')](_0x9648('0x2a'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x17c7=['events','email','mailbox','account','getAccount','once','ready','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','emit','box','handleCloseBox','end','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','parser','handleEnd','stringify','upperFirst','exports','lodash','imap','mailparser','iconv','Iconv'];(function(_0x558422,_0x30fb2b){var _0x417e2f=function(_0x2d6d11){while(--_0x2d6d11){_0x558422['push'](_0x558422['shift']());}};_0x417e2f(++_0x30fb2b);}(_0x17c7,0x19f));var _0x717c=function(_0x4a7189,_0x2f2adf){_0x4a7189=_0x4a7189-0x0;var _0x7229f=_0x17c7[_0x4a7189];return _0x7229f;};'use strict';var _=require(_0x717c('0x0'));var util=require('util');var Imap=require(_0x717c('0x1'));var simpleParser=require(_0x717c('0x2'))['simpleParser'];var Iconv=require(_0x717c('0x3'))[_0x717c('0x4')];var EventEmitter=require(_0x717c('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x717c('0x6'));function EmailImap(_0x4bbe31,_0x26d5d6){this[_0x717c('0x7')]=_0x4bbe31[_0x717c('0x7')];this[_0x717c('0x8')]=this[_0x717c('0x9')](_0x4bbe31,_0x26d5d6);this[_0x717c('0x1')]=new Imap(this[_0x717c('0x8')]);this[_0x717c('0x1')][_0x717c('0xa')](_0x717c('0xb'),this['handleReady'][_0x717c('0xc')](this));this['imap']['once']('end',this['handleEnd'][_0x717c('0xc')](this));this[_0x717c('0x1')]['on'](_0x717c('0xd'),this[_0x717c('0xe')][_0x717c('0xc')](this));this[_0x717c('0x1')][_0x717c('0xf')]();}util[_0x717c('0x10')](EmailImap,EventEmitter);EmailImap[_0x717c('0x11')][_0x717c('0x9')]=function(_0x2fa4ca,_0x99227){var _0x3cec7e={'connTimeout':_0x2fa4ca['connTimeout']?_0x2fa4ca[_0x717c('0x12')]*0x3e8:0x2710,'authTimeout':_0x2fa4ca[_0x717c('0x13')]?_0x2fa4ca[_0x717c('0x13')]*0x3e8:0x1388};if(_0x2fa4ca[_0x717c('0x14')]){_0x3cec7e[_0x717c('0x15')]=_0x2fa4ca[_0x717c('0x15')];if(_0x2fa4ca[_0x717c('0x16')]){_0x3cec7e[_0x717c('0x17')]=utils[_0x717c('0x18')](_0x2fa4ca[_0x717c('0x19')][_0x717c('0x1a')],_0x2fa4ca[_0x717c('0x15')]);}else{_0x3cec7e['password']=_0x2fa4ca[_0x717c('0x1b')];}}else{if(_0x2fa4ca[_0x717c('0x1c')]){_0x3cec7e[_0x717c('0x15')]=_0x2fa4ca[_0x717c('0x15')];_0x3cec7e[_0x717c('0x1b')]=_0x2fa4ca['password'];}}_0x3cec7e[_0x717c('0x6')]=_0x99227||_0x2fa4ca['user']||_0x717c('0x1d');_0x3cec7e['host']=_0x2fa4ca[_0x717c('0x1e')];_0x3cec7e[_0x717c('0x1f')]=_0x2fa4ca[_0x717c('0x1f')]||0x3e1;if(_0x2fa4ca[_0x717c('0x20')]){_0x3cec7e['tls']=!![];}else{_0x3cec7e[_0x717c('0x20')]=![];_0x3cec7e[_0x717c('0x21')]=_0x717c('0x22');}return _0x3cec7e;};EmailImap['prototype'][_0x717c('0x23')]=function(){this[_0x717c('0x1')][_0x717c('0x24')](this['mailbox'],![],this['handleOpenBox'][_0x717c('0xc')](this));};EmailImap[_0x717c('0x11')]['handleOpenBox']=function(_0x44ca7b,_0x5d4929){if(_0x44ca7b){this[_0x717c('0xe')](_0x44ca7b,!![]);}else{this[_0x717c('0x25')](_0x717c('0x26'),_0x5d4929);this['readUnseen']();}};EmailImap[_0x717c('0x11')][_0x717c('0x27')]=function(_0x35f9ee){if(_0x35f9ee){this[_0x717c('0xe')](_0x35f9ee,!![]);}else{this['imap'][_0x717c('0x28')]();}};EmailImap[_0x717c('0x11')][_0x717c('0x29')]=function(){this[_0x717c('0x1')]['search']([_0x717c('0x2a')],this[_0x717c('0x2b')][_0x717c('0xc')](this));};EmailImap['prototype'][_0x717c('0x2b')]=function(_0x2eebab,_0x191a92){if(_0x2eebab){this['handleError'](_0x2eebab,!![]);}else{if(_0x191a92[_0x717c('0x2c')]){try{var _0x138adb=this['imap'][_0x717c('0x2d')](_0x191a92,{'bodies':'','markSeen':!![]});_0x138adb['on'](_0x717c('0x2e'),this[_0x717c('0x2f')]['bind'](this));_0x138adb['once'](_0x717c('0xd'),this[_0x717c('0x30')][_0x717c('0xc')](this));_0x138adb[_0x717c('0xa')]('end',this[_0x717c('0x31')]['bind'](this));}catch(_0x43a3af){logger[_0x717c('0xd')](_0x43a3af);}}else{this[_0x717c('0x1')][_0x717c('0x32')](!![],this[_0x717c('0x27')][_0x717c('0xc')](this));}}};EmailImap['prototype'][_0x717c('0x2f')]=function(_0x3ba658){_0x3ba658['on']('body',this['handleMessageBody']['bind'](this));_0x3ba658[_0x717c('0xa')](_0x717c('0x33'),this[_0x717c('0x34')][_0x717c('0xc')](this));_0x3ba658[_0x717c('0xa')](_0x717c('0x28'),this['handleMessageEnd'][_0x717c('0xc')](this));};EmailImap[_0x717c('0x11')][_0x717c('0x35')]=function(_0x4e1364){simpleParser(_0x4e1364,{'Iconv':Iconv},this[_0x717c('0x36')][_0x717c('0xc')](this));};EmailImap[_0x717c('0x11')][_0x717c('0x34')]=function(){};EmailImap[_0x717c('0x11')]['handleMessageEnd']=function(){};EmailImap[_0x717c('0x11')][_0x717c('0x36')]=function(_0x913e7,_0x92f739){if(_0x913e7){logger[_0x717c('0xd')](_0x913e7);}else{var _0x4ce462=this;utils[_0x717c('0x37')](this[_0x717c('0x8')],_0x92f739,function(_0x20d66a){_0x4ce462[_0x717c('0x25')](_0x717c('0x6'),_0x20d66a);});}};EmailImap['prototype'][_0x717c('0x31')]=function(){this[_0x717c('0x1')][_0x717c('0x32')](!![],this[_0x717c('0x27')][_0x717c('0xc')](this));};EmailImap['prototype'][_0x717c('0x30')]=function(_0xa9fed1){this['handleError'](_0xa9fed1);this[_0x717c('0x1')][_0x717c('0x32')](!![],this[_0x717c('0x27')]['bind'](this));};EmailImap[_0x717c('0x11')][_0x717c('0x38')]=function(){this[_0x717c('0x25')](_0x717c('0x28'));};EmailImap['prototype'][_0x717c('0xe')]=function(_0xa6fa5c,_0x4ceef9){logger['error']('handleError',this[_0x717c('0x8')][_0x717c('0x6')],JSON[_0x717c('0x39')](_0xa6fa5c));var _0x43a8d6='';if(_0xa6fa5c){if(_0xa6fa5c['textCode']){_0x43a8d6=_0xa6fa5c['textCode'];}else{for(var _0x43478f in _0xa6fa5c){if(_0xa6fa5c['hasOwnProperty'](_0x43478f)){_0x43a8d6+=_[_0x717c('0x3a')](_0x43478f)+':\x20'+_0xa6fa5c[_0x43478f]+'\x0a';}}}}if(_0x4ceef9){this[_0x717c('0x1')]['end']();}else{this[_0x717c('0x25')]('error',_0x43a8d6);this[_0x717c('0x25')](_0x717c('0x28'));}};module[_0x717c('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 47f318c..39d5449 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 _0x02c3=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0x02c3,0x1d5));var _0x302c=function(_0x4b878d,_0x17006d){_0x4b878d=_0x4b878d-0x0;var _0x4c3eea=_0x02c3[_0x4b878d];return _0x4c3eea;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x302c('0x0'));function EmailSmtp(){}EmailSmtp[_0x302c('0x1')][_0x302c('0x2')]=function(_0x15343f,_0x9845f4){return new Promise(function(_0x4309c5,_0xd69b70){var _0x27fd03=nodemailer[_0x302c('0x3')](_0x15343f);_0x27fd03['use'](_0x302c('0x4'),inlineBase64());_0x27fd03[_0x302c('0x5')](_0x9845f4,function(_0x5cd6b7,_0x51e987){if(_0x5cd6b7){_0xd69b70(_0x5cd6b7[_0x302c('0x6')]());}else{_0x4309c5(_0x51e987);}});});};EmailSmtp[_0x302c('0x1')][_0x302c('0x7')]=function(_0x3123f2){return new Promise(function(_0x386d97,_0x3293c7){var _0x417684=nodemailer['createTransport'](_0x3123f2);_0x417684[_0x302c('0x7')](function(_0x544b93,_0x56dcac){if(_0x544b93){_0x3293c7(_0x544b93['toString']());}else{if(_0x56dcac){_0x386d97(_0x56dcac);}else{_0x3293c7(_0x302c('0x8'));}}});});};module[_0x302c('0x9')]=EmailSmtp; \ No newline at end of file +var _0x4226=['verify','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','use','toString'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4226,0x8a));var _0x6422=function(_0x233f74,_0x4502bc){_0x233f74=_0x233f74-0x0;var _0x399a05=_0x4226[_0x233f74];return _0x399a05;};'use strict';var nodemailer=require(_0x6422('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6422('0x1')][_0x6422('0x2')]=function(_0x439622,_0x2a5c60){return new Promise(function(_0x588689,_0x17f6d4){var _0x2a3fcd=nodemailer[_0x6422('0x3')](_0x439622);_0x2a3fcd[_0x6422('0x4')]('compile',inlineBase64());_0x2a3fcd['sendMail'](_0x2a5c60,function(_0x22a695,_0x42418e){if(_0x22a695){_0x17f6d4(_0x22a695[_0x6422('0x5')]());}else{_0x588689(_0x42418e);}});});};EmailSmtp[_0x6422('0x1')][_0x6422('0x6')]=function(_0x521d57){return new Promise(function(_0x1a9e46,_0x5c5af0){var _0x55666b=nodemailer[_0x6422('0x3')](_0x521d57);_0x55666b[_0x6422('0x6')](function(_0x2485df,_0x260d71){if(_0x2485df){_0x5c5af0(_0x2485df[_0x6422('0x5')]());}else{if(_0x260d71){_0x1a9e46(_0x260d71);}else{_0x5c5af0(_0x6422('0x7'));}}});});};module[_0x6422('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a74bc15..13aaf40 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 _0x1d7c=['originTo','isEmpty','message','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','messageId','parseBuffer','first','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','node-tnef','email','../../../config/environment','value','address','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','pop','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body'];(function(_0x4ca958,_0x2d9e82){var _0x5a5b9a=function(_0x4ff127){while(--_0x4ff127){_0x4ca958['push'](_0x4ca958['shift']());}};_0x5a5b9a(++_0x2d9e82);}(_0x1d7c,0x1b8));var _0xc1d7=function(_0x20db5c,_0x3e2079){_0x20db5c=_0x20db5c-0x0;var _0x299b65=_0x1d7c[_0x20db5c];return _0x299b65;};'use strict';var _=require(_0xc1d7('0x0'));var moment=require('moment');var random=require(_0xc1d7('0x1'));var fs=require('fs');var path=require(_0xc1d7('0x2'));var util=require('util');var tnef=require(_0xc1d7('0x3'));var logger=require('../../../config/logger')(_0xc1d7('0x4'));var config=require(_0xc1d7('0x5'));function getAddress(_0x45f68d){var _0x5f4bd9=_['head'](_0x45f68d[_0xc1d7('0x6')]);return _0x5f4bd9&&_0x5f4bd9[_0xc1d7('0x7')]?_0x5f4bd9['address']:'anonymous'+random[_0xc1d7('0x8')](0x6)+_0xc1d7('0x9');}function getFirstName(_0x43ad59){var _0x43f234=_[_0xc1d7('0xa')](_0x43ad59[_0xc1d7('0x6')]);if(_0x43f234&&_0x43f234[_0xc1d7('0xb')]){if(_0x43f234[_0xc1d7('0xb')]==_0x43f234[_0xc1d7('0x7')]){return _0x43f234[_0xc1d7('0xb')][_0xc1d7('0xc')](0x0,_0x43f234[_0xc1d7('0xb')][_0xc1d7('0xd')]('@'));}var _0x2ff389=_0x43f234[_0xc1d7('0xb')][_0xc1d7('0xe')](/\s+/);return _0x2ff389[_0xc1d7('0xf')]>0x1?_0x2ff389[_0xc1d7('0x10')](0x0,-0x1)[_0xc1d7('0x11')]('\x20'):_0x43f234[_0xc1d7('0xb')];}return'Anonymous';}function getLastName(_0x4bcee5){var _0x123687=_[_0xc1d7('0xa')](_0x4bcee5[_0xc1d7('0x6')]);if(_0x123687&&_0x123687[_0xc1d7('0xb')]){var _0x2de51b=_0x123687['name'][_0xc1d7('0xe')](/\s+/);return _0x2de51b[_0xc1d7('0xf')]>0x1?_0x2de51b[_0xc1d7('0x12')]():'';}return'';}function getMails(_0x1298d3,_0x3da9a7){var _0x5d50bc='';for(var _0x19ecd1=0x0;_0x19ecd1<_0x3da9a7[_0xc1d7('0x6')]['length'];_0x19ecd1+=0x1){if(_0x3da9a7['value'][_0x19ecd1]['address']!==_0x1298d3){if(!_['isEmpty'](_0x5d50bc)){_0x5d50bc+=',';}_0x5d50bc+=_0x3da9a7[_0xc1d7('0x6')][_0x19ecd1][_0xc1d7('0xb')]||_0x3da9a7['value'][_0x19ecd1]['address']||'';_0x5d50bc+='\x20<';_0x5d50bc+=_0x3da9a7[_0xc1d7('0x6')][_0x19ecd1][_0xc1d7('0x7')]?_0x3da9a7[_0xc1d7('0x6')][_0x19ecd1][_0xc1d7('0x7')]:_0xc1d7('0x13')+random[_0xc1d7('0x8')](0x6)+_0xc1d7('0x9');_0x5d50bc+='>';}}return _0x5d50bc;}function parseEmail(_0x141b84,_0xf5ad39,_0x362a47){if(_0xf5ad39[_0xc1d7('0x14')]){var _0x4083e5=/)<[^<]*)*<\/script>/gi;while(_0x4083e5[_0xc1d7('0x15')](_0xf5ad39[_0xc1d7('0x14')])){_0xf5ad39[_0xc1d7('0x14')]=_0xf5ad39['html'][_0xc1d7('0x16')](_0x4083e5,'');}if(_0xf5ad39[_0xc1d7('0x14')][_0xc1d7('0x17')](_0xc1d7('0x18'))){var _0xd524c8=[];_0xf5ad39[_0xc1d7('0x19')][_0xc1d7('0x1a')](_0xef2a6b=>{_0xd524c8[_0xc1d7('0x1b')](_0xef2a6b[_0xc1d7('0x1c')]);});var _0x534c5e=/]+>/g;var _0x36278d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x463e0d=_0xf5ad39[_0xc1d7('0x14')]['replace'](_0x36278d,_0xc1d7('0x1d'));var _0x29b54e=_0x463e0d[_0xc1d7('0x16')](_0x534c5e,_0xc1d7('0x1e'));for(let _0x5616dc=0x0;_0x5616dc<_0xd524c8[_0xc1d7('0xf')];_0x5616dc++){var _0x148467=_0x29b54e[_0xc1d7('0x16')](_0xc1d7('0x1e'),_0xc1d7('0x1f')+_0xd524c8[_0x5616dc]+_0xc1d7('0x20'));_0x29b54e=_0x148467;}_0xf5ad39[_0xc1d7('0x14')]=_0x29b54e;}_0x362a47['body']=_0xf5ad39[_0xc1d7('0x14')];}else{_0x362a47[_0xc1d7('0x21')]=_0xf5ad39['textAsHtml'];}if(_0x362a47[_0xc1d7('0x21')]){_0x362a47['body']=_0x362a47[_0xc1d7('0x21')][_0xc1d7('0x16')](/0x0){var _0x46c142=[_0xc1d7('0x34'),_0xc1d7('0x35'),_0xc1d7('0x36')];for(var _0x3c56f6=0x0;_0x3c56f6<_0xf5ad39[_0xc1d7('0x33')]['length'];_0x3c56f6++){var _0x1acdcb=_[_0xc1d7('0xd')](_0x46c142,_0xf5ad39['headerLines'][_0x3c56f6][_0xc1d7('0x37')]);if(_0x1acdcb>=0x0){_0x362a47['isAutoreply']=!![];}}}return _0x362a47;}exports[_0xc1d7('0x38')]=function(_0x311124,_0x5e0bd3,_0xab5f2d){var _0x151da5={'from':getAddress(_0x5e0bd3[_0xc1d7('0x39')]),'firstName':getFirstName(_0x5e0bd3[_0xc1d7('0x39')]),'lastName':getLastName(_0x5e0bd3['from']),'mapKey':_0xc1d7('0x4'),'message':{'from':getMails(_0x311124['email'],_0x5e0bd3[_0xc1d7('0x39')]),'to':_0x311124[_0xc1d7('0x4')],'cc':'','subject':_0x5e0bd3[_0xc1d7('0x3a')]||'','messageId':_0x5e0bd3['messageId'],'inReplyTo':_0x5e0bd3[_0xc1d7('0x3b')],'sentAt':moment(_0x5e0bd3[_0xc1d7('0x3c')])[_0xc1d7('0x2b')](_0xc1d7('0x3d')),'attach':![],'attachments':[]}};if(!_0x5e0bd3[_0xc1d7('0x14')]&&!_0x5e0bd3[_0xc1d7('0x3e')]){var _0x15fbe9=_[_0xc1d7('0x3f')](_0x5e0bd3[_0xc1d7('0x19')],{'contentType':_0xc1d7('0x40')});if(_0x15fbe9[_0xc1d7('0xf')]){logger[_0xc1d7('0x41')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5e0bd3[_0xc1d7('0x42')]));tnef[_0xc1d7('0x43')](_[_0xc1d7('0x44')](_0x15fbe9)['content'],function(_0x520807,_0x5b23ba){if(_0x5b23ba){_0x5e0bd3[_0xc1d7('0x14')]=_0x5b23ba['BodyHTML']||'

Empty\x20message

';if(_0x5b23ba[_0xc1d7('0x45')]){for(var _0x466e2f=0x0;_0x466e2f<_0x5b23ba['Attachments'][_0xc1d7('0xf')];_0x466e2f++){var _0x295177=_0x5b23ba[_0xc1d7('0x45')][_0x466e2f];_0x151da5['message']['attachments'][_0xc1d7('0x1b')]({'filename':_0x295177[_0xc1d7('0x46')],'content':Buffer[_0xc1d7('0x39')](_0x295177[_0xc1d7('0x47')])});}}}_0xab5f2d(parseEmail(_0x311124,_0x5e0bd3,_0x151da5));});}else{_0x5e0bd3['html']=_0xc1d7('0x48');_0xab5f2d(parseEmail(_0x311124,_0x5e0bd3,_0x151da5));}}else{_0xab5f2d(parseEmail(_0x311124,_0x5e0bd3,_0x151da5));}};exports[_0xc1d7('0x49')]=function(_0x39d184,_0x5e45bf){var _0x3e731f=[_0xc1d7('0x4a')+(_0x5e45bf||''),_0xc1d7('0x4b')+_0x39d184,'',''];return Buffer[_0xc1d7('0x39')](_0x3e731f['join'](''),_0xc1d7('0x4c'))[_0xc1d7('0x4d')](_0xc1d7('0x4e'));}; \ No newline at end of file +var _0x791f=['BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','includes','','body','0x1?_0x2c614[_0xf791('0xf')](0x0,-0x1)[_0xf791('0x10')]('\x20'):_0x276b4a[_0xf791('0xb')];}return _0xf791('0x11');}function getLastName(_0x48410a){var _0x49baba=_[_0xf791('0x6')](_0x48410a[_0xf791('0x7')]);if(_0x49baba&&_0x49baba[_0xf791('0xb')]){var _0x52ea84=_0x49baba['name'][_0xf791('0xd')](/\s+/);return _0x52ea84['length']>0x1?_0x52ea84[_0xf791('0x12')]():'';}return'';}function getMails(_0x20e87a,_0x59dac6){var _0x401b44='';for(var _0x290fe4=0x0;_0x290fe4<_0x59dac6[_0xf791('0x7')][_0xf791('0xe')];_0x290fe4+=0x1){if(_0x59dac6[_0xf791('0x7')][_0x290fe4][_0xf791('0x8')]!==_0x20e87a){if(!_[_0xf791('0x13')](_0x401b44)){_0x401b44+=',';}_0x401b44+=_0x59dac6['value'][_0x290fe4][_0xf791('0xb')]||_0x59dac6[_0xf791('0x7')][_0x290fe4][_0xf791('0x8')]||'';_0x401b44+='\x20<';_0x401b44+=_0x59dac6[_0xf791('0x7')][_0x290fe4][_0xf791('0x8')]?_0x59dac6['value'][_0x290fe4][_0xf791('0x8')]:'anonymous'+random[_0xf791('0x14')](0x6)+_0xf791('0xa');_0x401b44+='>';}}return _0x401b44;}function parseEmail(_0x5d8ce0,_0x5c4b13,_0xa32a61){if(_0x5c4b13[_0xf791('0x15')]){var _0x53416a=/)<[^<]*)*<\/script>/gi;while(_0x53416a[_0xf791('0x16')](_0x5c4b13['html'])){_0x5c4b13[_0xf791('0x15')]=_0x5c4b13[_0xf791('0x15')]['replace'](_0x53416a,'');}if(_0x5c4b13[_0xf791('0x15')][_0xf791('0x17')](_0xf791('0x18'))){var _0x2713c1=[];_0x5c4b13[_0xf791('0x19')]['forEach'](_0x4a6841=>{_0x2713c1['push'](_0x4a6841[_0xf791('0x1a')]);});var _0x44feef=/]+>/g;var _0x19def4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x33d06c=_0x5c4b13[_0xf791('0x15')][_0xf791('0x1b')](_0x19def4,'_SRC');var _0x1a1df3=_0x33d06c['replace'](_0x44feef,'_IMG');for(let _0x2f23eb=0x0;_0x2f23eb<_0x2713c1[_0xf791('0xe')];_0x2f23eb++){var _0x342fa9=_0x1a1df3['replace'](_0xf791('0x1c'),'\x20[Attachment:\x20'+_0x2713c1[_0x2f23eb]+_0xf791('0x1d'));_0x1a1df3=_0x342fa9;}_0x5c4b13[_0xf791('0x15')]=_0x1a1df3;}_0xa32a61[_0xf791('0x1e')]=_0x5c4b13['html'];}else{_0xa32a61[_0xf791('0x1e')]=_0x5c4b13['textAsHtml'];}if(_0xa32a61[_0xf791('0x1e')]){_0xa32a61[_0xf791('0x1e')]=_0xa32a61[_0xf791('0x1e')][_0xf791('0x1b')](/0x0){var _0x21d9a4=[_0xf791('0x2f'),_0xf791('0x30'),_0xf791('0x31')];for(var _0x5d7442=0x0;_0x5d7442<_0x5c4b13[_0xf791('0x2e')][_0xf791('0xe')];_0x5d7442++){var _0x31879a=_[_0xf791('0x32')](_0x21d9a4,_0x5c4b13[_0xf791('0x2e')][_0x5d7442][_0xf791('0x33')]);if(_0x31879a>=0x0){_0xa32a61[_0xf791('0x34')]=!![];}}}return _0xa32a61;}exports[_0xf791('0x35')]=function(_0x406093,_0x2faa9a,_0x508370){var _0x1d1ced={'from':getAddress(_0x2faa9a[_0xf791('0x36')]),'firstName':getFirstName(_0x2faa9a[_0xf791('0x36')]),'lastName':getLastName(_0x2faa9a[_0xf791('0x36')]),'mapKey':_0xf791('0x23'),'message':{'from':getMails(_0x406093[_0xf791('0x23')],_0x2faa9a['from']),'to':_0x406093[_0xf791('0x23')],'cc':'','subject':_0x2faa9a[_0xf791('0x37')]||'','messageId':_0x2faa9a[_0xf791('0x38')],'inReplyTo':_0x2faa9a[_0xf791('0x39')],'sentAt':moment(_0x2faa9a['date'])[_0xf791('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2faa9a[_0xf791('0x15')]&&!_0x2faa9a[_0xf791('0x3b')]){var _0x58975c=_[_0xf791('0x3c')](_0x2faa9a[_0xf791('0x19')],{'contentType':'application/ms-tnef'});if(_0x58975c['length']){logger['info'](util[_0xf791('0x3a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2faa9a[_0xf791('0x38')]));tnef[_0xf791('0x3d')](_[_0xf791('0x3e')](_0x58975c)['content'],function(_0xe5319b,_0x33d300){if(_0x33d300){_0x2faa9a['html']=_0x33d300[_0xf791('0x3f')]||_0xf791('0x40');if(_0x33d300[_0xf791('0x41')]){for(var _0x81556b=0x0;_0x81556b<_0x33d300['Attachments'][_0xf791('0xe')];_0x81556b++){var _0x38c678=_0x33d300['Attachments'][_0x81556b];_0x1d1ced[_0xf791('0x20')][_0xf791('0x19')]['push']({'filename':_0x38c678[_0xf791('0x42')],'content':Buffer['from'](_0x38c678['Data'])});}}}_0x508370(parseEmail(_0x406093,_0x2faa9a,_0x1d1ced));});}else{_0x2faa9a['html']=_0xf791('0x40');_0x508370(parseEmail(_0x406093,_0x2faa9a,_0x1d1ced));}}else{_0x508370(parseEmail(_0x406093,_0x2faa9a,_0x1d1ced));}};exports[_0xf791('0x43')]=function(_0x1021b3,_0x38a715){var _0x364f63=[_0xf791('0x44')+(_0x38a715||''),_0xf791('0x45')+_0x1021b3,'',''];return Buffer['from'](_0x364f63[_0xf791('0x10')](''),'utf-8')[_0xf791('0x46')](_0xf791('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ef2d925..bd55a43 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 _0x9d00=['name','Service','key','active','Imap','Smtp','lodash'];(function(_0x22043e,_0x60a3d0){var _0x35ff34=function(_0x1c00a9){while(--_0x1c00a9){_0x22043e['push'](_0x22043e['shift']());}};_0x35ff34(++_0x60a3d0);}(_0x9d00,0x102));var _0x09d0=function(_0x56d3cb,_0x1853b7){_0x56d3cb=_0x56d3cb-0x0;var _0xb20a33=_0x9d00[_0x56d3cb];return _0xb20a33;};'use strict';var _=require(_0x09d0('0x0'));function MailAccount(_0x2189a3){this['id']=_0x2189a3['id']||0x0;this['name']=_0x2189a3[_0x09d0('0x1')]||_0x09d0('0x2');this['key']=_0x2189a3[_0x09d0('0x3')]||'SERV';this[_0x09d0('0x4')]=_0x2189a3[_0x09d0('0x4')]||![];this[_0x09d0('0x5')]=_0x2189a3[_0x09d0('0x5')]||[];this[_0x09d0('0x6')]=_0x2189a3[_0x09d0('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x35e7=['SERV','active','Imap','Smtp','name','key'];(function(_0x558e15,_0x557fa7){var _0x4cdfde=function(_0x1b3e37){while(--_0x1b3e37){_0x558e15['push'](_0x558e15['shift']());}};_0x4cdfde(++_0x557fa7);}(_0x35e7,0x9a));var _0x735e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x35e7[_0xaa0309];return _0x5de7ce;};'use strict';var _=require('lodash');function MailAccount(_0x4f169b){this['id']=_0x4f169b['id']||0x0;this[_0x735e('0x0')]=_0x4f169b['name']||'Service';this['key']=_0x4f169b[_0x735e('0x1')]||_0x735e('0x2');this[_0x735e('0x3')]=_0x4f169b[_0x735e('0x3')]||![];this[_0x735e('0x4')]=_0x4f169b[_0x735e('0x4')]||[];this[_0x735e('0x5')]=_0x4f169b[_0x735e('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index bda394e..5a4cbcc 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 _0x0b63=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x2a7842,_0x596466){var _0x18c252=function(_0x567c77){while(--_0x567c77){_0x2a7842['push'](_0x2a7842['shift']());}};_0x18c252(++_0x596466);}(_0x0b63,0x137));var _0x30b6=function(_0x1dfc96,_0xffcc0a){_0x1dfc96=_0x1dfc96-0x0;var _0x5d3f21=_0x0b63[_0x1dfc96];return _0x5d3f21;};'use strict';var _=require(_0x30b6('0x0'));var MailAccount=require(_0x30b6('0x1'));var Realtime=function(){this[_0x30b6('0x2')]={};};function freeIsNotKey(_0x4be6dc,_0x53d773,_0x24bd9e){var _0x558a97=_[_0x30b6('0x3')](_0x4be6dc,function(_0x19e58a,_0x5713bf){return _0x19e58a[_0x24bd9e];});for(var _0x5221e2 in _0x53d773){if(_0x53d773[_0x30b6('0x4')](_0x5221e2)){if(!_0x558a97[_0x5221e2]){delete _0x53d773[_0x5221e2];}}}}Realtime[_0x30b6('0x5')][_0x30b6('0x6')]=function(_0x309c79,_0x16f2be){for(var _0x4035cc in _0x16f2be){if(_0x309c79[_0x30b6('0x4')](_0x4035cc)){_0x309c79[_0x4035cc]=_0x16f2be[_0x4035cc];}}};Realtime[_0x30b6('0x5')][_0x30b6('0x7')]=function(){var _0x1577a0=this;return function(_0x40904f){if(_0x40904f){freeIsNotKey(_0x40904f,_0x1577a0[_0x30b6('0x2')],'id');for(var _0x18f215=0x0,_0x2d3577={},_0x15ca13={};_0x18f215<_0x40904f[_0x30b6('0x8')];_0x18f215+=0x1){_0x2d3577=_0x40904f[_0x18f215];if(_[_0x30b6('0x9')](_0x1577a0['mailAccounts'][_0x2d3577['id']])){_0x1577a0[_0x30b6('0x2')][_0x2d3577['id']]=new MailAccount(_0x2d3577);}else{_[_0x30b6('0xa')](_0x1577a0[_0x30b6('0x2')][_0x2d3577['id']],_0x2d3577);}}}return _0x1577a0[_0x30b6('0x2')];};};module[_0x30b6('0xb')]=Realtime; \ No newline at end of file +var _0x42b3=['mapKeys','hasOwnProperty','mailAccounts','length','isUndefined','lodash','../model/mailAccount'];(function(_0x47734d,_0x196920){var _0x2fce72=function(_0x3e9cbb){while(--_0x3e9cbb){_0x47734d['push'](_0x47734d['shift']());}};_0x2fce72(++_0x196920);}(_0x42b3,0x1e8));var _0x342b=function(_0x33f153,_0x39d65d){_0x33f153=_0x33f153-0x0;var _0x12ac15=_0x42b3[_0x33f153];return _0x12ac15;};'use strict';var _=require(_0x342b('0x0'));var MailAccount=require(_0x342b('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x358c7c,_0x106d90,_0x452529){var _0x2f9957=_[_0x342b('0x2')](_0x358c7c,function(_0x117484,_0x3c10a2){return _0x117484[_0x452529];});for(var _0x55c8bc in _0x106d90){if(_0x106d90['hasOwnProperty'](_0x55c8bc)){if(!_0x2f9957[_0x55c8bc]){delete _0x106d90[_0x55c8bc];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x3b6e6d,_0x23d5ae){for(var _0xcec771 in _0x23d5ae){if(_0x3b6e6d[_0x342b('0x3')](_0xcec771)){_0x3b6e6d[_0xcec771]=_0x23d5ae[_0xcec771];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x2c6670=this;return function(_0x4500cc){if(_0x4500cc){freeIsNotKey(_0x4500cc,_0x2c6670[_0x342b('0x4')],'id');for(var _0x1fd2bb=0x0,_0x436702={},_0x21a62c={};_0x1fd2bb<_0x4500cc[_0x342b('0x5')];_0x1fd2bb+=0x1){_0x436702=_0x4500cc[_0x1fd2bb];if(_[_0x342b('0x6')](_0x2c6670[_0x342b('0x4')][_0x436702['id']])){_0x2c6670[_0x342b('0x4')][_0x436702['id']]=new MailAccount(_0x436702);}else{_['merge'](_0x2c6670['mailAccounts'][_0x436702['id']],_0x436702);}}}return _0x2c6670[_0x342b('0x4')];};};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 a558502..9cf955a 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 _0x1883=['getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','data5','Smtp','type'];(function(_0x1035eb,_0x4023d7){var _0x35a2db=function(_0x3af4cf){while(--_0x3af4cf){_0x1035eb['push'](_0x1035eb['shift']());}};_0x35a2db(++_0x4023d7);}(_0x1883,0xab));var _0x3188=function(_0x3f7ee7,_0x52cd3c){_0x3f7ee7=_0x3f7ee7-0x0;var _0x5bee62=_0x1883[_0x3f7ee7];return _0x5bee62;};'use strict';var client=require(_0x3188('0x0'));exports[_0x3188('0x1')]=function(){return function(){return client[_0x3188('0x2')](_0x3188('0x3'),{'options':{'attributes':['id',_0x3188('0x4'),_0x3188('0x5'),_0x3188('0x6'),_0x3188('0x7'),_0x3188('0x8'),_0x3188('0x9'),_0x3188('0xa'),_0x3188('0xb')],'raw':![],'include':[{'model':_0x3188('0xc'),'as':_0x3188('0xd'),'include':[{'model':_0x3188('0xe'),'attributes':['id',_0x3188('0x4'),_0x3188('0x6'),'type',_0x3188('0xf')],'as':_0x3188('0xe')}]},{'model':'MailServerOut','as':_0x3188('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x3188('0x4'),_0x3188('0x6'),_0x3188('0x11'),_0x3188('0xf')],'as':'CloudProvider'}]}]},'log':_0x3188('0x12')});};};exports[_0x3188('0x13')]=function(_0x4dcadb,_0x5c029f){return client[_0x3188('0x2')](_0x3188('0x14'),{'account':{'id':_0x4dcadb},'body':_0x5c029f,'log':_0x3188('0x14')});}; \ No newline at end of file +var _0x80c3=['CloudProvider','name','data5','Smtp','type','getMailAccount','notify','Request','NotifyMailAccount','../client','GetMailAccount','provider','service','email','TemplateId'];(function(_0x26e536,_0x59260b){var _0x346ba5=function(_0x15021e){while(--_0x15021e){_0x26e536['push'](_0x26e536['shift']());}};_0x346ba5(++_0x59260b);}(_0x80c3,0x18f));var _0x380c=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x80c3[_0x4b174a];return _0x3cd7bf;};'use strict';var client=require(_0x380c('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x380c('0x1'),{'options':{'attributes':['id','name',_0x380c('0x2'),_0x380c('0x3'),_0x380c('0x4'),'active','key','ListId',_0x380c('0x5')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x380c('0x6'),'attributes':['id',_0x380c('0x7'),_0x380c('0x3'),'type',_0x380c('0x8')],'as':_0x380c('0x6')}]},{'model':'MailServerOut','as':_0x380c('0x9'),'include':[{'model':_0x380c('0x6'),'attributes':['id','name',_0x380c('0x3'),_0x380c('0xa'),_0x380c('0x8')],'as':'CloudProvider'}]}]},'log':_0x380c('0xb')});};};exports[_0x380c('0xc')]=function(_0x1bd451,_0x18b13f){return client[_0x380c('0xd')](_0x380c('0xe'),{'account':{'id':_0x1bd451},'body':_0x18b13f,'log':_0x380c('0xe')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5a28976..7b4a925 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 _0xccf7=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xccf7,0x1c9));var _0x7ccf=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xccf7[_0x283127];return _0x43da5d;};'use strict';var client=require(_0x7ccf('0x0'));exports[_0x7ccf('0x1')]=function(){return client[_0x7ccf('0x2')](_0x7ccf('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x7ccf('0x4')});}; \ No newline at end of file +var _0x3510=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x3510,0x16e));var _0x0351=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x3510[_0x5c351c];return _0x26f3b3;};'use strict';var client=require(_0x0351('0x0'));exports[_0x0351('0x1')]=function(){return client[_0x0351('0x2')](_0x0351('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0351('0x4')]},'log':_0x0351('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2ef5622..eea29f6 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(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 40771dc..61b4a73 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 _0x55d9=['defaults','redis','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','createServer','timeout','listen','port','websocket'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55d9,0x1bd));var _0x955d=function(_0x4e3079,_0x2e48ea){_0x4e3079=_0x4e3079-0x0;var _0x4356fb=_0x55d9[_0x4e3079];return _0x4356fb;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x955d('0x0')](app);server[_0x955d('0x1')]=0xdbba0;if(sticky[_0x955d('0x2')](server,config[_0x955d('0x3')])){var socketio=require('socket.io')(server,{'transports':[_0x955d('0x4'),'polling']});config['redis']=_[_0x955d('0x5')](config[_0x955d('0x6')],{'host':'localhost','port':0x18eb});socketio[_0x955d('0x7')](require(_0x955d('0x8'))({'pubClient':new Redis(config[_0x955d('0x6')]),'subClient':new Redis(config[_0x955d('0x6')])}));require('../../config/triggers')[_0x955d('0x9')]();require(_0x955d('0xa'))[_0x955d('0x9')](socketio);require(_0x955d('0xb'))[_0x955d('0x9')](app);require(_0x955d('0xc'))['default'](app);}else{server[_0x955d('0xd')](_0x955d('0xe'),function(){console[_0x955d('0xf')](_0x955d('0x10'),config['port']);});}exports=module[_0x955d('0x11')]=app; \ No newline at end of file +var _0xfaca=['redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','exports','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','polling','defaults'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0xfaca,0x9c));var _0xafac=function(_0x3a1b36,_0x483009){_0x3a1b36=_0x3a1b36-0x0;var _0x25350e=_0xfaca[_0x3a1b36];return _0x25350e;};'use strict';var _=require(_0xafac('0x0'));var http=require(_0xafac('0x1'));var express=require(_0xafac('0x2'));var sticky=require(_0xafac('0x3'));var Redis=require('ioredis');var config=require(_0xafac('0x4'));var app=express();var server=http[_0xafac('0x5')](app);server[_0xafac('0x6')]=0xdbba0;if(sticky[_0xafac('0x7')](server,config[_0xafac('0x8')])){var socketio=require(_0xafac('0x9'))(server,{'transports':['websocket',_0xafac('0xa')]});config['redis']=_[_0xafac('0xb')](config[_0xafac('0xc')],{'host':_0xafac('0xd'),'port':0x18eb});socketio[_0xafac('0xe')](require(_0xafac('0xf'))({'pubClient':new Redis(config[_0xafac('0xc')]),'subClient':new Redis(config['redis'])}));require(_0xafac('0x10'))[_0xafac('0x11')]();require(_0xafac('0x12'))[_0xafac('0x11')](socketio);require(_0xafac('0x13'))[_0xafac('0x11')](app);require('../../routes')[_0xafac('0x11')](app);}else{server[_0xafac('0x14')](_0xafac('0x15'),function(){console[_0xafac('0x16')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xafac('0x8')]);});}exports=module[_0xafac('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b5ea565..fdf01e0 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 _0x06d1=['request','then','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request'];(function(_0x3d9b23,_0x52894d){var _0xf22517=function(_0x1933d0){while(--_0x1933d0){_0x3d9b23['push'](_0x3d9b23['shift']());}};_0xf22517(++_0x52894d);}(_0x06d1,0x190));var _0x106d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x06d1[_0x8c43de];return _0xa6591b;};'use strict';var jayson=require(_0x106d('0x0'));var BPromise=require('bluebird');var logger=require(_0x106d('0x1'))(_0x106d('0x2'));var client=jayson[_0x106d('0x3')][_0x106d('0x4')]({'port':0x2329});client[_0x106d('0x5')]=function(_0x358f0e,_0x5cb4b1){return new BPromise(function(_0x1c71de,_0x601ab2){return client[_0x106d('0x6')](_0x358f0e,_0x5cb4b1)[_0x106d('0x7')](function(_0x2645d2){logger[_0x106d('0x8')](_0x106d('0x9'),'routing',_0x358f0e,_0x5cb4b1,_0x2645d2);if(_0x2645d2[_0x106d('0xa')]){logger[_0x106d('0xa')](_0x106d('0x9'),_0x106d('0x2'),_0x358f0e,_0x2645d2[_0x106d('0xa')][_0x106d('0xb')],_0x5cb4b1);return _0x601ab2(_0x2645d2[_0x106d('0xa')][_0x106d('0xb')]);}else{return _0x1c71de(_0x2645d2['result']);}})[_0x106d('0xc')](function(_0x297d6e){logger['error'](_0x106d('0x9'),_0x106d('0x2'),_0x358f0e,_0x297d6e,_0x5cb4b1);return _0x601ab2(_0x297d6e);});});};module[_0x106d('0xd')]=client; \ No newline at end of file +var _0xd387=['exports','jayson/promise','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x4c42c2,_0x271b89){var _0xc1fce3=function(_0x4b77ac){while(--_0x4b77ac){_0x4c42c2['push'](_0x4c42c2['shift']());}};_0xc1fce3(++_0x271b89);}(_0xd387,0x105));var _0x7d38=function(_0x21fa8b,_0x5b4c07){_0x21fa8b=_0x21fa8b-0x0;var _0x4a6203=_0xd387[_0x21fa8b];return _0x4a6203;};'use strict';var jayson=require(_0x7d38('0x0'));var BPromise=require('bluebird');var logger=require(_0x7d38('0x1'))(_0x7d38('0x2'));var client=jayson['client'][_0x7d38('0x3')]({'port':0x2329});client[_0x7d38('0x4')]=function(_0x30536b,_0x2e5e3c){return new BPromise(function(_0x10021a,_0x457923){return client[_0x7d38('0x5')](_0x30536b,_0x2e5e3c)[_0x7d38('0x6')](function(_0x15d6d7){logger[_0x7d38('0x7')](_0x7d38('0x8'),_0x7d38('0x2'),_0x30536b,_0x2e5e3c,_0x15d6d7);if(_0x15d6d7[_0x7d38('0x9')]){logger['error'](_0x7d38('0x8'),_0x7d38('0x2'),_0x30536b,_0x15d6d7[_0x7d38('0x9')]['message'],_0x2e5e3c);return _0x457923(_0x15d6d7[_0x7d38('0x9')][_0x7d38('0xa')]);}else{return _0x10021a(_0x15d6d7[_0x7d38('0xb')]);}})['catch'](function(_0x487b50){logger[_0x7d38('0x9')](_0x7d38('0x8'),_0x7d38('0x2'),_0x30536b,_0x487b50,_0x2e5e3c);return _0x457923(_0x487b50);});});};module[_0x7d38('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f6ba02d..ef3c070 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 _0xecc6=['log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x264ca3,_0x65b645){var _0x156d1e=function(_0x3c2990){while(--_0x3c2990){_0x264ca3['push'](_0x264ca3['shift']());}};_0x156d1e(++_0x65b645);}(_0xecc6,0x187));var _0x6ecc=function(_0x4d420b,_0x5b8c97){_0x4d420b=_0x4d420b-0x0;var _0x36f1ee=_0xecc6[_0x4d420b];return _0x36f1ee;};'use strict';var BPromise=require(_0x6ecc('0x0'));var server=require(_0x6ecc('0x1'));var Realtime=require(_0x6ecc('0x2'));var user=require(_0x6ecc('0x3'));var interval=require(_0x6ecc('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x6ecc('0x5'));var smsQueue=require(_0x6ecc('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x6ecc('0x7'));var whatsappQueue=require(_0x6ecc('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x6ecc('0x9')]()[_0x6ecc('0xa')](user['getAgents']())[_0x6ecc('0xa')](realtime[_0x6ecc('0xb')]())[_0x6ecc('0xa')](interval[_0x6ecc('0xc')]())[_0x6ecc('0xa')](realtime[_0x6ecc('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x6ecc('0xa')](realtime[_0x6ecc('0xe')]())[_0x6ecc('0xa')](chatQueue[_0x6ecc('0xf')]())[_0x6ecc('0xa')](realtime[_0x6ecc('0x10')]())[_0x6ecc('0xa')](smsQueue['getSmsQueues']())[_0x6ecc('0xa')](realtime[_0x6ecc('0x11')]())['then'](mailQueue[_0x6ecc('0x12')]())[_0x6ecc('0xa')](realtime[_0x6ecc('0x13')]())[_0x6ecc('0xa')](faxQueue[_0x6ecc('0x14')]())['then'](realtime['initFaxQueues']())['then'](whatsappQueue[_0x6ecc('0x15')]())[_0x6ecc('0xa')](realtime[_0x6ecc('0x16')]())[_0x6ecc('0xa')](function(){return realtime;});}function main(){return server[_0x6ecc('0x17')](realtime)[_0x6ecc('0xa')](function(_0x4c083b){return initRealtime();})['then'](function(_0x3060b7){return setInterval(initRealtime,0x1388);})[_0x6ecc('0x18')](function(_0x95d19){console[_0x6ecc('0x19')](_0x95d19);});}main(); \ No newline at end of file +var _0xc9d4=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x202d2d,_0x5212ac){var _0x22f3be=function(_0x599de5){while(--_0x599de5){_0x202d2d['push'](_0x202d2d['shift']());}};_0x22f3be(++_0x5212ac);}(_0xc9d4,0x132));var _0x4c9d=function(_0x857fd,_0x46bcb4){_0x857fd=_0x857fd-0x0;var _0xc6b9be=_0xc9d4[_0x857fd];return _0xc6b9be;};'use strict';var BPromise=require(_0x4c9d('0x0'));var server=require(_0x4c9d('0x1'));var Realtime=require(_0x4c9d('0x2'));var user=require(_0x4c9d('0x3'));var interval=require(_0x4c9d('0x4'));var openchannelQueue=require(_0x4c9d('0x5'));var chatQueue=require(_0x4c9d('0x6'));var smsQueue=require(_0x4c9d('0x7'));var mailQueue=require(_0x4c9d('0x8'));var faxQueue=require(_0x4c9d('0x9'));var whatsappQueue=require(_0x4c9d('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4c9d('0xb')]()['then'](user[_0x4c9d('0xc')]())[_0x4c9d('0xd')](realtime[_0x4c9d('0xe')]())['then'](interval['getIntervals']())['then'](realtime[_0x4c9d('0xf')]())[_0x4c9d('0xd')](openchannelQueue[_0x4c9d('0x10')]())[_0x4c9d('0xd')](realtime[_0x4c9d('0x11')]())[_0x4c9d('0xd')](chatQueue['getChatQueues']())['then'](realtime[_0x4c9d('0x12')]())[_0x4c9d('0xd')](smsQueue['getSmsQueues']())[_0x4c9d('0xd')](realtime[_0x4c9d('0x13')]())[_0x4c9d('0xd')](mailQueue[_0x4c9d('0x14')]())[_0x4c9d('0xd')](realtime[_0x4c9d('0x15')]())[_0x4c9d('0xd')](faxQueue[_0x4c9d('0x16')]())[_0x4c9d('0xd')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x4c9d('0x17')]())[_0x4c9d('0xd')](realtime[_0x4c9d('0x18')]())[_0x4c9d('0xd')](function(){return realtime;});}function main(){return server[_0x4c9d('0x19')](realtime)[_0x4c9d('0xd')](function(_0x3770fe){return initRealtime();})[_0x4c9d('0xd')](function(_0x411c71){return setInterval(initRealtime,0x1388);})[_0x4c9d('0x1a')](function(_0x53d393){console[_0x4c9d('0x1b')](_0x53d393);});}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 750a027..6139113 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0xefef6f,_0x5f9f66){var _0x454173=function(_0x42e3d1){while(--_0x42e3d1){_0xefef6f['push'](_0xefef6f['shift']());}};_0x454173(++_0x5f9f66);}(_0x814b,0x1a2));var _0xb814=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x814b[_0x38e177];return _0x1faf15;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0xbc3bef,_0x2c2d30){var _0xfdafe3=function(_0x20f463){while(--_0x20f463){_0xbc3bef['push'](_0xbc3bef['shift']());}};_0xfdafe3(++_0x2c2d30);}(_0xe14b,0x93));var _0xbe14=function(_0x3888b6,_0x55eca5){_0x3888b6=_0x3888b6-0x0;var _0x3c761c=_0xe14b[_0x3888b6];return _0x3c761c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2e56684..eb5fa68 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 _0xae5b=['http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x5502a1,_0x243550){var _0x103aba=function(_0xa825d9){while(--_0xa825d9){_0x5502a1['push'](_0x5502a1['shift']());}};_0x103aba(++_0x243550);}(_0xae5b,0x170));var _0xbae5=function(_0x46f2d2,_0x2b0f9f){_0x46f2d2=_0x46f2d2-0x0;var _0x50d0e9=_0xae5b[_0x46f2d2];return _0x50d0e9;};'use strict';var BPromise=require(_0xbae5('0x0'));var jayson=require(_0xbae5('0x1'));var client=jayson['client'][_0xbae5('0x2')]({'port':0x232b});function request(_0x3fce50,_0x3e6d42){return new BPromise(function(_0x1ed55b,_0x30d8c4){return client['request'](_0x3fce50,_0x3e6d42)[_0xbae5('0x3')](function(_0x7c3568){if(_0x7c3568['error']){return _0x30d8c4(_0x7c3568[_0xbae5('0x4')][_0xbae5('0x5')]);}else{return _0x1ed55b(_0x7c3568[_0xbae5('0x6')]);}})[_0xbae5('0x7')](function(_0x2621ef){return _0x30d8c4(_0x2621ef);});});}exports[_0xbae5('0x8')]=function(_0x55276d,_0x383882){return request(_0xbae5('0x9'),{'account':_0x55276d,'message':_0x383882});}; \ No newline at end of file +var _0xd44f=['SendMail','bluebird','http','request','error','message','result','catch','sendMailMessage'];(function(_0xc74073,_0xe739ed){var _0x20ce46=function(_0x4c9c4f){while(--_0x4c9c4f){_0xc74073['push'](_0xc74073['shift']());}};_0x20ce46(++_0xe739ed);}(_0xd44f,0xfd));var _0xfd44=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0xd44f[_0x51e5bd];return _0x250aed;};'use strict';var BPromise=require(_0xfd44('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd44('0x1')]({'port':0x232b});function request(_0x5a3598,_0x60a9e7){return new BPromise(function(_0x492c67,_0x254528){return client[_0xfd44('0x2')](_0x5a3598,_0x60a9e7)['then'](function(_0x7b5cbc){if(_0x7b5cbc[_0xfd44('0x3')]){return _0x254528(_0x7b5cbc[_0xfd44('0x3')][_0xfd44('0x4')]);}else{return _0x492c67(_0x7b5cbc[_0xfd44('0x5')]);}})[_0xfd44('0x6')](function(_0x263789){return _0x254528(_0x263789);});});}exports[_0xfd44('0x7')]=function(_0x1fd17d,_0x4c818c){return request(_0xfd44('0x8'),{'account':_0x1fd17d,'message':_0x4c818c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1b3d5d9..99354b5 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 _0x14a0=['toNumber','format','chatPause','faxPause','faxStatusTime','faxCurrentCapacity','smsStatusTime','openchannelCurrentCapacity','emit','user:routing:update','omit','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','mailPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','whatsapp','length','getChannelStatus','Status'];(function(_0x2a9795,_0x2573a9){var _0x1d7567=function(_0x8ece83){while(--_0x8ece83){_0x2a9795['push'](_0x2a9795['shift']());}};_0x1d7567(++_0x2573a9);}(_0x14a0,0x8e));var _0x014a=function(_0x298157,_0xab668e){_0x298157=_0x298157-0x0;var _0x11119b=_0x14a0[_0x298157];return _0x11119b;};'use strict';var _=require('lodash');var md5=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var Redis=require(_0x014a('0x2'));var config=require(_0x014a('0x3'));config[_0x014a('0x4')]=_[_0x014a('0x5')](config[_0x014a('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x014a('0x4')]));function Agent(_0x12e8da){this['id']=_0x12e8da['id']||0x0;this[_0x014a('0x6')]=_0x12e8da['name']||'';this['online']=_0x12e8da[_0x014a('0x7')]||!![];this[_0x014a('0x8')]=_0x12e8da[_0x014a('0x8')]||![];this['chatPause']=_0x12e8da['chatPause']||![];this[_0x014a('0x9')]=_0x12e8da['mailPause']||![];this['faxPause']=_0x12e8da['faxPause']||![];this['smsPause']=_0x12e8da[_0x014a('0xa')]||![];this['openchannelPause']=_0x12e8da[_0x014a('0xb')]||![];this[_0x014a('0xc')]='unknown';this[_0x014a('0xd')]=0x0;this[_0x014a('0xe')]=_0x12e8da[_0x014a('0xe')]||0x0;this[_0x014a('0xf')]=0x0;this[_0x014a('0x10')]=_0x014a('0x11');this[_0x014a('0x12')]=0x0;this[_0x014a('0x13')]=_0x12e8da[_0x014a('0x13')]||0x0;this[_0x014a('0x14')]=0x0;this[_0x014a('0x15')]=_0x014a('0x11');this['faxStatusTime']=0x0;this[_0x014a('0x16')]=_0x12e8da[_0x014a('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x014a('0x17')]=_0x014a('0x11');this['smsStatusTime']=0x0;this[_0x014a('0x18')]=_0x12e8da[_0x014a('0x18')]||0x0;this[_0x014a('0x19')]=0x0;this[_0x014a('0x1a')]=_0x014a('0x11');this[_0x014a('0x1b')]=0x0;this[_0x014a('0x1c')]=_0x12e8da[_0x014a('0x1c')]||0x0;this[_0x014a('0x1d')]=0x0;this[_0x014a('0x1e')]=_0x014a('0x11');this[_0x014a('0x1f')]=0x0;this[_0x014a('0x20')]=_0x12e8da[_0x014a('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x014a('0x21')]=![];this[_0x014a('0x22')]=undefined;this[_0x014a('0x0')]='';this[_0x014a('0x23')]={};this[_0x014a('0x24')]={};this[_0x014a('0x25')]={};this[_0x014a('0x26')]={};this[_0x014a('0x27')]={};this[_0x014a('0x28')]={};this['updateRealtime']();}Agent[_0x014a('0x29')]['getChannelStatus']=function(_0x1a1318){if(this[_0x1a1318+_0x014a('0x2a')]>0x0){if(this[_0x1a1318+_0x014a('0x2b')]>0x0&&this[_0x1a1318+_0x014a('0x2a')]>=this[_0x1a1318+_0x014a('0x2b')]){return _0x014a('0x2c');}else{return _0x014a('0x2d');}}else{return _0x014a('0x2e');}};Agent[_0x014a('0x29')]['updateRealtime']=function(){var _0x3b4b92=['mail',_0x014a('0x2f'),_0x014a('0x30'),'fax','sms',_0x014a('0x31')];for(var _0x3f9719=0x0;_0x3f9719<_0x3b4b92[_0x014a('0x32')];_0x3f9719+=0x1){var _0x5ed71b=this[_0x014a('0x33')](_0x3b4b92[_0x3f9719]);if(this[_0x3b4b92[_0x3f9719]+_0x014a('0x34')]!==_0x5ed71b){this[_0x3b4b92[_0x3f9719]+'StatusTime']=_[_0x014a('0x35')](moment()[_0x014a('0x36')]('x'));}this[_0x3b4b92[_0x3f9719]+'Status']=_0x5ed71b;}var _0x4f9c1c={'id':this['id'],'name':this[_0x014a('0x6')],'online':this[_0x014a('0x7')],'voicePause':this[_0x014a('0x8')],'chatPause':this[_0x014a('0x37')],'mailPause':this['mailPause'],'smsPause':this[_0x014a('0xa')],'faxPause':this[_0x014a('0x38')],'openchannelPause':this[_0x014a('0xb')],'chatStatus':this[_0x014a('0xc')],'chatStatusTime':this[_0x014a('0xd')],'chatCapacity':this[_0x014a('0xe')],'chatCurrentCapacity':this[_0x014a('0xf')],'mailStatus':this[_0x014a('0x10')],'mailStatusTime':this[_0x014a('0x12')],'mailCapacity':this[_0x014a('0x13')],'mailCurrentCapacity':this[_0x014a('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x014a('0x39')],'faxCapacity':this[_0x014a('0x16')],'faxCurrentCapacity':this[_0x014a('0x3a')],'smsStatus':this[_0x014a('0x17')],'smsStatusTime':this[_0x014a('0x3b')],'smsCapacity':this[_0x014a('0x18')],'smsCurrentCapacity':this[_0x014a('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x014a('0x1b')],'whatsappCapacity':this[_0x014a('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x014a('0x1e')],'openchannelStatusTime':this[_0x014a('0x1f')],'openchannelCapacity':this[_0x014a('0x20')],'openchannelCurrentCapacity':this[_0x014a('0x3c')],'busy':this[_0x014a('0x21')],'busyQueue':this[_0x014a('0x22')],'chatWaitingInteractions':this[_0x014a('0x23')],'faxWaitingInteractions':this[_0x014a('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x014a('0x26')],'smsWaitingInteractions':this[_0x014a('0x27')],'whatsappWaitingInteractions':this[_0x014a('0x28')]};var _0x1f31c8=md5(JSON['stringify'](_0x4f9c1c));if(this[_0x014a('0x0')]!==_0x1f31c8){this[_0x014a('0x0')]=_0x1f31c8;io[_0x014a('0x3d')](_0x014a('0x3e'),_[_0x014a('0x3f')](_0x4f9c1c,[_0x014a('0x7')]));}};module[_0x014a('0x40')]=Agent; \ No newline at end of file +var _0xd824=['defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','whatsapp','Status','StatusTime','format','mailPause','chatCapacity','whatsappCurrentCapacity','mailWaitingInteractions','whatsappWaitingInteractions','stringify','emit','omit','exports','lodash','md5','../../../config/environment','redis'];(function(_0x37c13c,_0x2ce87a){var _0x4fce21=function(_0x44410b){while(--_0x44410b){_0x37c13c['push'](_0x37c13c['shift']());}};_0x4fce21(++_0x2ce87a);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var md5=require(_0x4d82('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x4d82('0x2'));config[_0x4d82('0x3')]=_[_0x4d82('0x4')](config[_0x4d82('0x3')],{'host':_0x4d82('0x5'),'port':0x18eb});var io=require(_0x4d82('0x6'))(new Redis(config['redis']));function Agent(_0x57850a){this['id']=_0x57850a['id']||0x0;this[_0x4d82('0x7')]=_0x57850a['name']||'';this['online']=_0x57850a[_0x4d82('0x8')]||!![];this[_0x4d82('0x9')]=_0x57850a[_0x4d82('0x9')]||![];this['chatPause']=_0x57850a[_0x4d82('0xa')]||![];this['mailPause']=_0x57850a['mailPause']||![];this[_0x4d82('0xb')]=_0x57850a[_0x4d82('0xb')]||![];this[_0x4d82('0xc')]=_0x57850a['smsPause']||![];this[_0x4d82('0xd')]=_0x57850a['openchannelPause']||![];this[_0x4d82('0xe')]=_0x4d82('0xf');this[_0x4d82('0x10')]=0x0;this['chatCapacity']=_0x57850a['chatCapacity']||0x0;this[_0x4d82('0x11')]=0x0;this[_0x4d82('0x12')]=_0x4d82('0xf');this[_0x4d82('0x13')]=0x0;this['mailCapacity']=_0x57850a[_0x4d82('0x14')]||0x0;this[_0x4d82('0x15')]=0x0;this[_0x4d82('0x16')]='unknown';this[_0x4d82('0x17')]=0x0;this['faxCapacity']=_0x57850a[_0x4d82('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x4d82('0x19')]='unknown';this[_0x4d82('0x1a')]=0x0;this[_0x4d82('0x1b')]=_0x57850a[_0x4d82('0x1b')]||0x0;this[_0x4d82('0x1c')]=0x0;this[_0x4d82('0x1d')]=_0x4d82('0xf');this[_0x4d82('0x1e')]=0x0;this[_0x4d82('0x1f')]=_0x57850a[_0x4d82('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x4d82('0x20')]=_0x4d82('0xf');this[_0x4d82('0x21')]=0x0;this[_0x4d82('0x22')]=_0x57850a[_0x4d82('0x22')]||0x0;this[_0x4d82('0x23')]=0x0;this[_0x4d82('0x24')]=![];this[_0x4d82('0x25')]=undefined;this[_0x4d82('0x1')]='';this[_0x4d82('0x26')]={};this[_0x4d82('0x27')]={};this['mailWaitingInteractions']={};this[_0x4d82('0x28')]={};this[_0x4d82('0x29')]={};this['whatsappWaitingInteractions']={};this[_0x4d82('0x2a')]();}Agent[_0x4d82('0x2b')][_0x4d82('0x2c')]=function(_0x14a2d4){if(this[_0x14a2d4+_0x4d82('0x2d')]>0x0){if(this[_0x14a2d4+_0x4d82('0x2e')]>0x0&&this[_0x14a2d4+_0x4d82('0x2d')]>=this[_0x14a2d4+_0x4d82('0x2e')]){return _0x4d82('0x2f');}else{return _0x4d82('0x30');}}else{return _0x4d82('0x31');}};Agent[_0x4d82('0x2b')][_0x4d82('0x2a')]=function(){var _0x284c66=[_0x4d82('0x32'),'chat','openchannel',_0x4d82('0x33'),_0x4d82('0x34'),_0x4d82('0x35')];for(var _0x3348d9=0x0;_0x3348d9<_0x284c66['length'];_0x3348d9+=0x1){var _0x19d3a9=this[_0x4d82('0x2c')](_0x284c66[_0x3348d9]);if(this[_0x284c66[_0x3348d9]+_0x4d82('0x36')]!==_0x19d3a9){this[_0x284c66[_0x3348d9]+_0x4d82('0x37')]=_['toNumber'](moment()[_0x4d82('0x38')]('x'));}this[_0x284c66[_0x3348d9]+'Status']=_0x19d3a9;}var _0x4d9ac4={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x4d82('0x9')],'chatPause':this[_0x4d82('0xa')],'mailPause':this[_0x4d82('0x39')],'smsPause':this['smsPause'],'faxPause':this[_0x4d82('0xb')],'openchannelPause':this[_0x4d82('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4d82('0x3a')],'chatCurrentCapacity':this[_0x4d82('0x11')],'mailStatus':this[_0x4d82('0x12')],'mailStatusTime':this[_0x4d82('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x4d82('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4d82('0x17')],'faxCapacity':this[_0x4d82('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x4d82('0x1a')],'smsCapacity':this[_0x4d82('0x1b')],'smsCurrentCapacity':this[_0x4d82('0x1c')],'whatsappStatus':this[_0x4d82('0x1d')],'whatsappStatusTime':this[_0x4d82('0x1e')],'whatsappCapacity':this[_0x4d82('0x1f')],'whatsappCurrentCapacity':this[_0x4d82('0x3b')],'openchannelStatus':this[_0x4d82('0x20')],'openchannelStatusTime':this[_0x4d82('0x21')],'openchannelCapacity':this[_0x4d82('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x4d82('0x24')],'busyQueue':this[_0x4d82('0x25')],'chatWaitingInteractions':this[_0x4d82('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x4d82('0x3c')],'openchannelWaitingInteractions':this[_0x4d82('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x4d82('0x3d')]};var _0x11d8c3=md5(JSON[_0x4d82('0x3e')](_0x4d9ac4));if(this['md5']!==_0x11d8c3){this[_0x4d82('0x1')]=_0x11d8c3;io[_0x4d82('0x3f')]('user:routing:update',_[_0x4d82('0x40')](_0x4d9ac4,['online']));}};module[_0x4d82('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 277fe16..5f0f545 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 _0x855d=['beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','map','_rr','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','lodash','util','redis','defaults','name','timeout','strategy'];(function(_0x23e653,_0x115dfa){var _0x340d9d=function(_0x474a5b){while(--_0x474a5b){_0x23e653['push'](_0x23e653['shift']());}};_0x340d9d(++_0x115dfa);}(_0x855d,0x95));var _0xd855=function(_0x20c8c5,_0x5925d0){_0x20c8c5=_0x20c8c5-0x0;var _0x4fd727=_0x855d[_0x20c8c5];return _0x4fd727;};'use strict';var _=require(_0xd855('0x0'));var md5=require('md5');var util=require(_0xd855('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd855('0x2')]=_[_0xd855('0x3')](config[_0xd855('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd855('0x2')]));function ChatQueue(_0xae9097){this['id']=_0xae9097['id']||0x0;this[_0xd855('0x4')]=_0xae9097[_0xd855('0x4')]||'';this[_0xd855('0x5')]=_0xae9097['timeout']||0xa;this[_0xd855('0x6')]=_0xae9097['strategy']||_0xd855('0x7');this[_0xd855('0x8')]=_0xae9097[_0xd855('0x8')];this[_0xd855('0x9')]={};this[_0xd855('0xa')]=0x0;this[_0xd855('0xb')]='';this['updateRouting']();this[_0xd855('0xc')]();}ChatQueue[_0xd855('0xd')]['updateRouting']=function(){var _0x147913=this[_0xd855('0x9')]['_rr'];this[_0xd855('0x9')]=_[_0xd855('0xe')](this[_0xd855('0x8')],'id');this['mapAgentsId'][_0xd855('0xf')]=_0x147913;};ChatQueue[_0xd855('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xd855('0x10')]=0x0;for(var _0x16bb79=0x0;_0x16bb79=0x0?this['available']:0x0;var _0x2ed813={'id':this['id'],'available':this[_0xd855('0x14')],'loggedIn':this[_0xd855('0x15')],'name':this['name'],'paused':this[_0xd855('0x10')],'waiting':this[_0xd855('0xa')]};var _0x589ee9=md5(JSON[_0xd855('0x16')](_0x2ed813));if(this[_0xd855('0xb')]!==_0x589ee9){this['md5']=_0x589ee9;io['to'](util[_0xd855('0x17')](_0xd855('0x18'),_0x2ed813['name']))[_0xd855('0x19')]('chat_queue:save',_0x2ed813);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x2c7c=['defaults','redis','name','timeout','strategy','Agents','waiting','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','stringify','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x2c7c,0x119));var _0xc2c7=function(_0x456b53,_0x3cf69f){_0x456b53=_0x456b53-0x0;var _0xee36ab=_0x2c7c[_0x456b53];return _0xee36ab;};'use strict';var _=require(_0xc2c7('0x0'));var md5=require(_0xc2c7('0x1'));var util=require(_0xc2c7('0x2'));var Redis=require(_0xc2c7('0x3'));var config=require(_0xc2c7('0x4'));config['redis']=_[_0xc2c7('0x5')](config[_0xc2c7('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc2c7('0x6')]));function ChatQueue(_0x1be4de){this['id']=_0x1be4de['id']||0x0;this['name']=_0x1be4de[_0xc2c7('0x7')]||'';this['timeout']=_0x1be4de[_0xc2c7('0x8')]||0xa;this['strategy']=_0x1be4de[_0xc2c7('0x9')]||'beepall';this[_0xc2c7('0xa')]=_0x1be4de['Agents'];this['mapAgentsId']={};this[_0xc2c7('0xb')]=0x0;this['md5']='';this[_0xc2c7('0xc')]();this['updateRealtime']();}ChatQueue['prototype'][_0xc2c7('0xc')]=function(){var _0x433a0c=this[_0xc2c7('0xd')][_0xc2c7('0xe')];this[_0xc2c7('0xd')]=_[_0xc2c7('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x433a0c;};ChatQueue[_0xc2c7('0x10')]['updateRealtime']=function(){this[_0xc2c7('0x11')]=0x0;this[_0xc2c7('0x12')]=0x0;for(var _0x7d637c=0x0;_0x7d637c=0x0?this['available']:0x0;var _0x2e11f5={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc2c7('0x11')],'name':this[_0xc2c7('0x7')],'paused':this['paused'],'waiting':this[_0xc2c7('0xb')]};var _0x39f088=md5(JSON[_0xc2c7('0x17')](_0x2e11f5));if(this['md5']!==_0x39f088){this[_0xc2c7('0x1')]=_0x39f088;io['to'](util['format']('chat:queue:%s',_0x2e11f5[_0xc2c7('0x7')]))[_0xc2c7('0x18')](_0xc2c7('0x19'),_0x2e11f5);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 25c7077..6c84f6b 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 _0xd9c1=['mapAgentsId','map','loggedIn','length','online','faxPause','paused','available','name','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x34a515,_0x3c9060){var _0x20a4ab=function(_0x51cad9){while(--_0x51cad9){_0x34a515['push'](_0x34a515['shift']());}};_0x20a4ab(++_0x3c9060);}(_0xd9c1,0xe7));var _0x1d9c=function(_0x3d2970,_0x3a7a3b){_0x3d2970=_0x3d2970-0x0;var _0x4c31c0=_0xd9c1[_0x3d2970];return _0x4c31c0;};'use strict';var _=require(_0x1d9c('0x0'));var md5=require(_0x1d9c('0x1'));var util=require('util');var Redis=require(_0x1d9c('0x2'));var config=require(_0x1d9c('0x3'));config['redis']=_[_0x1d9c('0x4')](config[_0x1d9c('0x5')],{'host':_0x1d9c('0x6'),'port':0x18eb});var io=require(_0x1d9c('0x7'))(new Redis(config[_0x1d9c('0x5')]));function FaxQueue(_0x2bdfac){this['id']=_0x2bdfac['id']||0x0;this['name']=_0x2bdfac['name']||'';this['timeout']=_0x2bdfac[_0x1d9c('0x8')]||0xa;this['strategy']=_0x2bdfac[_0x1d9c('0x9')]||_0x1d9c('0xa');this[_0x1d9c('0xb')]=_0x2bdfac['Agents'];this['mapAgentsId']={};this[_0x1d9c('0xc')]=0x0;this[_0x1d9c('0x1')]='';this[_0x1d9c('0xd')]();this[_0x1d9c('0xe')]();}FaxQueue[_0x1d9c('0xf')][_0x1d9c('0xd')]=function(){var _0x390b20=this['mapAgentsId'][_0x1d9c('0x10')];this[_0x1d9c('0x11')]=_[_0x1d9c('0x12')](this[_0x1d9c('0xb')],'id');this['mapAgentsId'][_0x1d9c('0x10')]=_0x390b20;};FaxQueue[_0x1d9c('0xf')][_0x1d9c('0xe')]=function(){this[_0x1d9c('0x13')]=0x0;this['paused']=0x0;for(var _0x14d937=0x0;_0x14d937=0x0?this['available']:0x0;var _0x5728bf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1d9c('0x13')],'name':this[_0x1d9c('0x19')],'paused':this['paused'],'waiting':this[_0x1d9c('0xc')]};var _0x50eb72=md5(JSON[_0x1d9c('0x1a')](_0x5728bf));if(this['md5']!==_0x50eb72){this[_0x1d9c('0x1')]=_0x50eb72;io['to'](util['format'](_0x1d9c('0x1b'),_0x5728bf[_0x1d9c('0x19')]))[_0x1d9c('0x1c')](_0x1d9c('0x1d'),_0x5728bf);}};module[_0x1d9c('0x1e')]=FaxQueue; \ No newline at end of file +var _0x75ae=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','loggedIn','online','paused','available','stringify','md5','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x75ae,0xc9));var _0xe75a=function(_0x5be3f2,_0x4500f6){_0x5be3f2=_0x5be3f2-0x0;var _0x5279e0=_0x75ae[_0x5be3f2];return _0x5279e0;};'use strict';var _=require(_0xe75a('0x0'));var md5=require('md5');var util=require(_0xe75a('0x1'));var Redis=require(_0xe75a('0x2'));var config=require(_0xe75a('0x3'));config[_0xe75a('0x4')]=_[_0xe75a('0x5')](config[_0xe75a('0x4')],{'host':_0xe75a('0x6'),'port':0x18eb});var io=require(_0xe75a('0x7'))(new Redis(config[_0xe75a('0x4')]));function FaxQueue(_0x167539){this['id']=_0x167539['id']||0x0;this[_0xe75a('0x8')]=_0x167539[_0xe75a('0x8')]||'';this[_0xe75a('0x9')]=_0x167539[_0xe75a('0x9')]||0xa;this[_0xe75a('0xa')]=_0x167539['strategy']||'beepall';this[_0xe75a('0xb')]=_0x167539[_0xe75a('0xb')];this[_0xe75a('0xc')]={};this[_0xe75a('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xe75a('0xe')]();}FaxQueue['prototype'][_0xe75a('0xf')]=function(){var _0x156c39=this['mapAgentsId']['_rr'];this[_0xe75a('0xc')]=_['map'](this['Agents'],'id');this[_0xe75a('0xc')][_0xe75a('0x10')]=_0x156c39;};FaxQueue['prototype'][_0xe75a('0xe')]=function(){this[_0xe75a('0x11')]=0x0;this['paused']=0x0;for(var _0x142627=0x0;_0x142627=0x0?this[_0xe75a('0x14')]:0x0;var _0x5726d0={'id':this['id'],'available':this[_0xe75a('0x14')],'loggedIn':this[_0xe75a('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xe75a('0xd')]};var _0x52a612=md5(JSON[_0xe75a('0x15')](_0x5726d0));if(this[_0xe75a('0x16')]!==_0x52a612){this[_0xe75a('0x16')]=_0x52a612;io['to'](util['format']('fax:queue:%s',_0x5726d0[_0xe75a('0x8')]))[_0xe75a('0x17')](_0xe75a('0x18'),_0x5726d0);}};module[_0xe75a('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a059a61..24dad63 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 _0xce5a=['Intervals','exports','name'];(function(_0x2aee5c,_0x14ddfd){var _0x5e2363=function(_0x2b894b){while(--_0x2b894b){_0x2aee5c['push'](_0x2aee5c['shift']());}};_0x5e2363(++_0x14ddfd);}(_0xce5a,0x9e));var _0xace5=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xce5a[_0x231b2e];return _0x3feb2a;};'use strict';function Interval(_0x3b95cf){this['id']=_0x3b95cf['id']||0x0;this['name']=_0x3b95cf[_0xace5('0x0')]||'';this[_0xace5('0x1')]=_0x3b95cf[_0xace5('0x1')]||{};}module[_0xace5('0x2')]=Interval; \ No newline at end of file +var _0x2bde=['name','Intervals','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2bde,0x1d1));var _0xe2bd=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0x2bde[_0x42bfb7];return _0x5c497d;};'use strict';function Interval(_0x4a2e0c){this['id']=_0x4a2e0c['id']||0x0;this[_0xe2bd('0x0')]=_0x4a2e0c['name']||'';this[_0xe2bd('0x1')]=_0x4a2e0c[_0xe2bd('0x1')]||{};}module[_0xe2bd('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 4bef85b..f728437 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 _0x5dc4=['format','mail_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','stringify'];(function(_0x409bd1,_0x58ece9){var _0x4ef2b8=function(_0x27758e){while(--_0x27758e){_0x409bd1['push'](_0x409bd1['shift']());}};_0x4ef2b8(++_0x58ece9);}(_0x5dc4,0x110));var _0x45dc=function(_0x58618c,_0x139245){_0x58618c=_0x58618c-0x0;var _0x164ad9=_0x5dc4[_0x58618c];return _0x164ad9;};'use strict';var _=require(_0x45dc('0x0'));var md5=require(_0x45dc('0x1'));var util=require('util');var Redis=require(_0x45dc('0x2'));var config=require(_0x45dc('0x3'));config[_0x45dc('0x4')]=_[_0x45dc('0x5')](config[_0x45dc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x45dc('0x6'))(new Redis(config['redis']));function MailQueue(_0x33a980){this['id']=_0x33a980['id']||0x0;this['name']=_0x33a980[_0x45dc('0x7')]||'';this[_0x45dc('0x8')]=_0x33a980['timeout']||0xa;this[_0x45dc('0x9')]=_0x33a980[_0x45dc('0x9')]||_0x45dc('0xa');this[_0x45dc('0xb')]=_0x33a980[_0x45dc('0xb')];this['mapAgentsId']={};this[_0x45dc('0xc')]=0x0;this[_0x45dc('0x1')]='';this['updateRouting']();this[_0x45dc('0xd')]();}MailQueue[_0x45dc('0xe')][_0x45dc('0xf')]=function(){var _0x5ba409=this[_0x45dc('0x10')]['_rr'];this[_0x45dc('0x10')]=_[_0x45dc('0x11')](this[_0x45dc('0xb')],'id');this['mapAgentsId'][_0x45dc('0x12')]=_0x5ba409;};MailQueue[_0x45dc('0xe')][_0x45dc('0xd')]=function(){this[_0x45dc('0x13')]=0x0;this[_0x45dc('0x14')]=0x0;for(var _0x29bdc0=0x0;_0x29bdc0=0x0?this[_0x45dc('0x17')]:0x0;var _0xc50586={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x45dc('0x7')],'paused':this[_0x45dc('0x14')],'waiting':this['waiting']};var _0x508274=md5(JSON[_0x45dc('0x18')](_0xc50586));if(this['md5']!==_0x508274){this[_0x45dc('0x1')]=_0x508274;io['to'](util[_0x45dc('0x19')]('mail:queue:%s',_0xc50586[_0x45dc('0x7')]))['emit'](_0x45dc('0x1a'),_0xc50586);}};module['exports']=MailQueue; \ No newline at end of file +var _0x3e3e=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','length','online','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x4f926d,_0x45075c){var _0x21725a=function(_0x42c56d){while(--_0x42c56d){_0x4f926d['push'](_0x4f926d['shift']());}};_0x21725a(++_0x45075c);}(_0x3e3e,0x86));var _0xe3e3=function(_0x5f34e3,_0x3677d8){_0x5f34e3=_0x5f34e3-0x0;var _0x3412e9=_0x3e3e[_0x5f34e3];return _0x3412e9;};'use strict';var _=require('lodash');var md5=require(_0xe3e3('0x0'));var util=require('util');var Redis=require(_0xe3e3('0x1'));var config=require(_0xe3e3('0x2'));config[_0xe3e3('0x3')]=_[_0xe3e3('0x4')](config[_0xe3e3('0x3')],{'host':_0xe3e3('0x5'),'port':0x18eb});var io=require(_0xe3e3('0x6'))(new Redis(config[_0xe3e3('0x3')]));function MailQueue(_0x347cab){this['id']=_0x347cab['id']||0x0;this[_0xe3e3('0x7')]=_0x347cab[_0xe3e3('0x7')]||'';this['timeout']=_0x347cab[_0xe3e3('0x8')]||0xa;this[_0xe3e3('0x9')]=_0x347cab[_0xe3e3('0x9')]||_0xe3e3('0xa');this[_0xe3e3('0xb')]=_0x347cab[_0xe3e3('0xb')];this['mapAgentsId']={};this[_0xe3e3('0xc')]=0x0;this['md5']='';this[_0xe3e3('0xd')]();this[_0xe3e3('0xe')]();}MailQueue[_0xe3e3('0xf')][_0xe3e3('0xd')]=function(){var _0xdd368e=this[_0xe3e3('0x10')][_0xe3e3('0x11')];this['mapAgentsId']=_['map'](this[_0xe3e3('0xb')],'id');this['mapAgentsId'][_0xe3e3('0x11')]=_0xdd368e;};MailQueue[_0xe3e3('0xf')][_0xe3e3('0xe')]=function(){this[_0xe3e3('0x12')]=0x0;this['paused']=0x0;for(var _0x54704b=0x0;_0x54704b=0x0?this['available']:0x0;var _0x33a33d={'id':this['id'],'available':this[_0xe3e3('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xe3e3('0x7')],'paused':this[_0xe3e3('0x15')],'waiting':this[_0xe3e3('0xc')]};var _0x5e6286=md5(JSON['stringify'](_0x33a33d));if(this[_0xe3e3('0x0')]!==_0x5e6286){this[_0xe3e3('0x0')]=_0x5e6286;io['to'](util[_0xe3e3('0x17')](_0xe3e3('0x18'),_0x33a33d[_0xe3e3('0x7')]))[_0xe3e3('0x19')](_0xe3e3('0x1a'),_0x33a33d);}};module[_0xe3e3('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ee46811..43e5c44 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x1261,0x144));var _0x1126=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x1261[_0x4459b8];return _0x4a4b07;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0xadb5,0xad));var _0x5adb=function(_0xc32e18,_0x191d9f){_0xc32e18=_0xc32e18-0x0;var _0x523884=_0xadb5[_0xc32e18];return _0x523884;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8ee6d78..557087d 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 _0xb07f=['online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xb07f,0x109));var _0xfb07=function(_0x4930bc,_0x2373e8){_0x4930bc=_0x4930bc-0x0;var _0x35354b=_0xb07f[_0x4930bc];return _0x35354b;};'use strict';var _=require(_0xfb07('0x0'));var md5=require(_0xfb07('0x1'));var util=require(_0xfb07('0x2'));var Redis=require(_0xfb07('0x3'));var config=require(_0xfb07('0x4'));config[_0xfb07('0x5')]=_[_0xfb07('0x6')](config[_0xfb07('0x5')],{'host':_0xfb07('0x7'),'port':0x18eb});var io=require(_0xfb07('0x8'))(new Redis(config[_0xfb07('0x5')]));function SmsQueue(_0x509079){this['id']=_0x509079['id']||0x0;this[_0xfb07('0x9')]=_0x509079[_0xfb07('0x9')]||'';this[_0xfb07('0xa')]=_0x509079[_0xfb07('0xa')]||0xa;this[_0xfb07('0xb')]=_0x509079[_0xfb07('0xb')]||_0xfb07('0xc');this[_0xfb07('0xd')]=_0x509079[_0xfb07('0xd')];this[_0xfb07('0xe')]={};this[_0xfb07('0xf')]=0x0;this[_0xfb07('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype'][_0xfb07('0x10')]=function(){var _0x200889=this['mapAgentsId'][_0xfb07('0x11')];this[_0xfb07('0xe')]=_[_0xfb07('0x12')](this[_0xfb07('0xd')],'id');this[_0xfb07('0xe')][_0xfb07('0x11')]=_0x200889;};SmsQueue[_0xfb07('0x13')]['updateRealtime']=function(){this[_0xfb07('0x14')]=0x0;this[_0xfb07('0x15')]=0x0;for(var _0x3c69db=0x0;_0x3c69db=0x0?this[_0xfb07('0x19')]:0x0;var _0x44b9c4={'id':this['id'],'available':this[_0xfb07('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xfb07('0x9')],'paused':this[_0xfb07('0x15')],'waiting':this['waiting']};var _0x4fc244=md5(JSON[_0xfb07('0x1a')](_0x44b9c4));if(this[_0xfb07('0x1')]!==_0x4fc244){this[_0xfb07('0x1')]=_0x4fc244;io['to'](util[_0xfb07('0x1b')](_0xfb07('0x1c'),_0x44b9c4[_0xfb07('0x9')]))[_0xfb07('0x1d')](_0xfb07('0x1e'),_0x44b9c4);}};module[_0xfb07('0x1f')]=SmsQueue; \ No newline at end of file +var _0x097c=['map','length','online','paused','loggedIn','available','format','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x097c,0x1d5));var _0xc097=function(_0x46099e,_0x478df8){_0x46099e=_0x46099e-0x0;var _0x4fac83=_0x097c[_0x46099e];return _0x4fac83;};'use strict';var _=require(_0xc097('0x0'));var md5=require(_0xc097('0x1'));var util=require(_0xc097('0x2'));var Redis=require('ioredis');var config=require(_0xc097('0x3'));config[_0xc097('0x4')]=_[_0xc097('0x5')](config[_0xc097('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc097('0x6'))(new Redis(config['redis']));function SmsQueue(_0x22fe81){this['id']=_0x22fe81['id']||0x0;this[_0xc097('0x7')]=_0x22fe81[_0xc097('0x7')]||'';this[_0xc097('0x8')]=_0x22fe81['timeout']||0xa;this[_0xc097('0x9')]=_0x22fe81['strategy']||'beepall';this[_0xc097('0xa')]=_0x22fe81[_0xc097('0xa')];this[_0xc097('0xb')]={};this[_0xc097('0xc')]=0x0;this[_0xc097('0x1')]='';this[_0xc097('0xd')]();this[_0xc097('0xe')]();}SmsQueue[_0xc097('0xf')][_0xc097('0xd')]=function(){var _0x48c376=this[_0xc097('0xb')][_0xc097('0x10')];this['mapAgentsId']=_[_0xc097('0x11')](this[_0xc097('0xa')],'id');this[_0xc097('0xb')][_0xc097('0x10')]=_0x48c376;};SmsQueue[_0xc097('0xf')][_0xc097('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x42fd3a=0x0;_0x42fd3a=0x0?this[_0xc097('0x16')]:0x0;var _0x560cbb={'id':this['id'],'available':this[_0xc097('0x16')],'loggedIn':this[_0xc097('0x15')],'name':this[_0xc097('0x7')],'paused':this[_0xc097('0x14')],'waiting':this['waiting']};var _0x38da65=md5(JSON['stringify'](_0x560cbb));if(this['md5']!==_0x38da65){this['md5']=_0x38da65;io['to'](util[_0xc097('0x17')]('sms:queue:%s',_0x560cbb['name']))[_0xc097('0x18')](_0xc097('0x19'),_0x560cbb);}};module[_0xc097('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 9c3f308..e3156b1 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 _0x4245=['length','online','whatsappPause','available','md5','emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused'];(function(_0x47aaf7,_0x82bff4){var _0x24da8a=function(_0x313691){while(--_0x313691){_0x47aaf7['push'](_0x47aaf7['shift']());}};_0x24da8a(++_0x82bff4);}(_0x4245,0x18e));var _0x5424=function(_0x30b0dc,_0x4e4f9f){_0x30b0dc=_0x30b0dc-0x0;var _0x3f8510=_0x4245[_0x30b0dc];return _0x3f8510;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x5424('0x0'));var Redis=require('ioredis');var config=require(_0x5424('0x1'));config[_0x5424('0x2')]=_['defaults'](config[_0x5424('0x2')],{'host':_0x5424('0x3'),'port':0x18eb});var io=require(_0x5424('0x4'))(new Redis(config[_0x5424('0x2')]));function WhatsappQueue(_0x55af79){this['id']=_0x55af79['id']||0x0;this[_0x5424('0x5')]=_0x55af79[_0x5424('0x5')]||'';this[_0x5424('0x6')]=_0x55af79[_0x5424('0x6')]||0xa;this['strategy']=_0x55af79[_0x5424('0x7')]||'beepall';this[_0x5424('0x8')]=_0x55af79[_0x5424('0x8')];this[_0x5424('0x9')]={};this[_0x5424('0xa')]=0x0;this['md5']='';this[_0x5424('0xb')]();this[_0x5424('0xc')]();}WhatsappQueue[_0x5424('0xd')][_0x5424('0xb')]=function(){var _0x325680=this[_0x5424('0x9')][_0x5424('0xe')];this[_0x5424('0x9')]=_[_0x5424('0xf')](this[_0x5424('0x8')],'id');this[_0x5424('0x9')][_0x5424('0xe')]=_0x325680;};WhatsappQueue['prototype'][_0x5424('0xc')]=function(){this[_0x5424('0x10')]=0x0;this[_0x5424('0x11')]=0x0;for(var _0x1fe9d2=0x0;_0x1fe9d2=0x0?this['available']:0x0;var _0xf392ac={'id':this['id'],'available':this[_0x5424('0x15')],'loggedIn':this[_0x5424('0x10')],'name':this[_0x5424('0x5')],'paused':this['paused'],'waiting':this[_0x5424('0xa')]};var _0x3d2082=md5(JSON['stringify'](_0xf392ac));if(this[_0x5424('0x16')]!==_0x3d2082){this['md5']=_0x3d2082;io['to'](util['format']('whatsapp:queue:%s',_0xf392ac[_0x5424('0x5')]))[_0x5424('0x17')](_0x5424('0x18'),_0xf392ac);}};module[_0x5424('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x4c79=['whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','loggedIn'];(function(_0x265113,_0x46e6cb){var _0x2207ed=function(_0x291412){while(--_0x291412){_0x265113['push'](_0x265113['shift']());}};_0x2207ed(++_0x46e6cb);}(_0x4c79,0x1f4));var _0x94c7=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0x4c79[_0x891c55];return _0x260823;};'use strict';var _=require('lodash');var md5=require(_0x94c7('0x0'));var util=require(_0x94c7('0x1'));var Redis=require(_0x94c7('0x2'));var config=require(_0x94c7('0x3'));config[_0x94c7('0x4')]=_[_0x94c7('0x5')](config['redis'],{'host':_0x94c7('0x6'),'port':0x18eb});var io=require(_0x94c7('0x7'))(new Redis(config[_0x94c7('0x4')]));function WhatsappQueue(_0x5f2736){this['id']=_0x5f2736['id']||0x0;this[_0x94c7('0x8')]=_0x5f2736['name']||'';this[_0x94c7('0x9')]=_0x5f2736[_0x94c7('0x9')]||0xa;this[_0x94c7('0xa')]=_0x5f2736['strategy']||_0x94c7('0xb');this[_0x94c7('0xc')]=_0x5f2736[_0x94c7('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x94c7('0xd')]();this[_0x94c7('0xe')]();}WhatsappQueue[_0x94c7('0xf')]['updateRouting']=function(){var _0x42bdf8=this[_0x94c7('0x10')][_0x94c7('0x11')];this[_0x94c7('0x10')]=_[_0x94c7('0x12')](this[_0x94c7('0xc')],'id');this[_0x94c7('0x10')]['_rr']=_0x42bdf8;};WhatsappQueue[_0x94c7('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x94c7('0x13')]=0x0;for(var _0x578659=0x0;_0x578659=0x0?this[_0x94c7('0x17')]:0x0;var _0x2d417a={'id':this['id'],'available':this[_0x94c7('0x17')],'loggedIn':this[_0x94c7('0x15')],'name':this[_0x94c7('0x8')],'paused':this[_0x94c7('0x13')],'waiting':this['waiting']};var _0x52d6c1=md5(JSON[_0x94c7('0x18')](_0x2d417a));if(this[_0x94c7('0x0')]!==_0x52d6c1){this[_0x94c7('0x0')]=_0x52d6c1;io['to'](util[_0x94c7('0x19')]('whatsapp:queue:%s',_0x2d417a[_0x94c7('0x8')]))[_0x94c7('0x1a')](_0x94c7('0x1b'),_0x2d417a);}};module[_0x94c7('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e8c6aca..2a5bc4a 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(_0x527a07,_0x1791b4){var _0x197a9b=function(_0x2b7b13){while(--_0x2b7b13){_0x527a07['push'](_0x527a07['shift']());}};_0x197a9b(++_0x1791b4);}(_0xb10b,0x12a));var _0xbb10=function(_0xce4604,_0x5e98ad){_0xce4604=_0xce4604-0x0;var _0x474352=_0xb10b[_0xce4604];return _0x474352;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index decdbaa..572114c 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 _0x53d9=['Request','UpdateChatInteraction','updateChatInteraction','addTags','update'];(function(_0x4ce603,_0x303fba){var _0xc152a1=function(_0x27cbdb){while(--_0x27cbdb){_0x4ce603['push'](_0x4ce603['shift']());}};_0xc152a1(++_0x303fba);}(_0x53d9,0x16c));var _0x953d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x953d('0x0')]=function(_0x158ff1,_0x250cba){return client[_0x953d('0x1')](_0x953d('0x2'),{'body':_0x250cba,'options':{'where':{'id':_0x158ff1}},'log':_0x953d('0x3')});};exports[_0x953d('0x4')]=function(_0x2e382e,_0x509eb9){return client[_0x953d('0x1')]('AddTagsToChatInteraction',{'body':_0x509eb9,'options':{'where':{'id':_0x2e382e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa9f2=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x124222,_0x24a4ca){var _0x57848e=function(_0x304256){while(--_0x304256){_0x124222['push'](_0x124222['shift']());}};_0x57848e(++_0x24a4ca);}(_0xa9f2,0x12a));var _0x2a9f=function(_0x3a7f55,_0x1029cf){_0x3a7f55=_0x3a7f55-0x0;var _0x42527c=_0xa9f2[_0x3a7f55];return _0x42527c;};'use strict';var client=require(_0x2a9f('0x0'));exports['update']=function(_0x377685,_0x4a8387){return client[_0x2a9f('0x1')]('UpdateChatInteraction',{'body':_0x4a8387,'options':{'where':{'id':_0x377685}},'log':_0x2a9f('0x2')});};exports[_0x2a9f('0x3')]=function(_0x3c8c05,_0x26452c){return client[_0x2a9f('0x1')](_0x2a9f('0x4'),{'body':_0x26452c,'options':{'where':{'id':_0x3c8c05}},'log':_0x2a9f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 06e0beb..4b2847f 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 _0xe91e=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x5a9fb9,_0xb126c4){var _0x110430=function(_0x5112a1){while(--_0x5112a1){_0x5a9fb9['push'](_0x5a9fb9['shift']());}};_0x110430(++_0xb126c4);}(_0xe91e,0xab));var _0xee91=function(_0x19cb1a,_0x4ce1b2){_0x19cb1a=_0x19cb1a-0x0;var _0x399650=_0xe91e[_0x19cb1a];return _0x399650;};'use strict';var client=require(_0xee91('0x0'));exports[_0xee91('0x1')]=function(_0x2799c9){return client[_0xee91('0x2')](_0xee91('0x3'),{'body':_0x2799c9,'log':_0xee91('0x4')});}; \ No newline at end of file +var _0xcaa7=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x50d8e1,_0x4c233f){var _0x46a311=function(_0x475f20){while(--_0x475f20){_0x50d8e1['push'](_0x50d8e1['shift']());}};_0x46a311(++_0x4c233f);}(_0xcaa7,0x87));var _0x7caa=function(_0x1d99f5,_0x16a0e0){_0x1d99f5=_0x1d99f5-0x0;var _0x5d723d=_0xcaa7[_0x1d99f5];return _0x5d723d;};'use strict';var client=require(_0x7caa('0x0'));exports[_0x7caa('0x1')]=function(_0x5a726f){return client[_0x7caa('0x2')](_0x7caa('0x3'),{'body':_0x5a726f,'log':_0x7caa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b8e98f0..c7edebf 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 _0x029b=['GetChatQueue','name','strategy','User','online','chatPause','../client','getChatQueues'];(function(_0x185b1d,_0x4e7ab3){var _0x42e301=function(_0x4ecc90){while(--_0x4ecc90){_0x185b1d['push'](_0x185b1d['shift']());}};_0x42e301(++_0x4e7ab3);}(_0x029b,0x66));var _0xb029=function(_0x36d64a,_0x151a4c){_0x36d64a=_0x36d64a-0x0;var _0x29c263=_0x029b[_0x36d64a];return _0x29c263;};'use strict';var client=require(_0xb029('0x0'));exports[_0xb029('0x1')]=function(){return function(){return client['Request'](_0xb029('0x2'),{'options':{'raw':![],'attributes':['id',_0xb029('0x3'),'timeout',_0xb029('0x4')],'include':[{'model':_0xb029('0x5'),'as':'Agents','attributes':['id','name',_0xb029('0x6'),_0xb029('0x7')]}]},'log':_0xb029('0x1')});};}; \ No newline at end of file +var _0x28a2=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x228a('0x0'));exports[_0x228a('0x1')]=function(){return function(){return client[_0x228a('0x2')](_0x228a('0x3'),{'options':{'raw':![],'attributes':['id',_0x228a('0x4'),_0x228a('0x5'),_0x228a('0x6')],'include':[{'model':'User','as':_0x228a('0x7'),'attributes':['id','name',_0x228a('0x8'),_0x228a('0x9')]}]},'log':_0x228a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index aeb9d40..56294c3 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 _0x9b83=['../client','create','Request','CreateChatQueueReport','update','DESC'];(function(_0x2db99f,_0x46e272){var _0x5acd2e=function(_0x47ca58){while(--_0x47ca58){_0x2db99f['push'](_0x2db99f['shift']());}};_0x5acd2e(++_0x46e272);}(_0x9b83,0x84));var _0x39b8=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x9b83[_0x1344d6];return _0xf45b24;};'use strict';var client=require(_0x39b8('0x0'));exports[_0x39b8('0x1')]=function(_0x193462){return client[_0x39b8('0x2')](_0x39b8('0x3'),{'body':_0x193462,'log':_0x39b8('0x3')});};exports[_0x39b8('0x4')]=function(_0x317506,_0x2fdfef){return client[_0x39b8('0x2')]('UpdateChatQueueReport',{'body':_0x2fdfef,'options':{'where':{'uniqueid':_0x317506},'order':[['id',_0x39b8('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0a34=['Request','CreateChatQueueReport','DESC','UpdateChatQueueReport','../client','create'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0x0a34,0x12a));var _0x40a3=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x0a34[_0x599e60];return _0x468e19;};'use strict';var client=require(_0x40a3('0x0'));exports[_0x40a3('0x1')]=function(_0x4fa072){return client[_0x40a3('0x2')](_0x40a3('0x3'),{'body':_0x4fa072,'log':_0x40a3('0x3')});};exports['update']=function(_0x13fe1b,_0x3b6860){return client[_0x40a3('0x2')]('UpdateChatQueueReport',{'body':_0x3b6860,'options':{'where':{'uniqueid':_0x13fe1b},'order':[['id',_0x40a3('0x4')]],'limit':0x1},'log':_0x40a3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 811a4f9..30f849a 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1dd6e2,_0x22b32c){var _0x135426=function(_0x540aee){while(--_0x540aee){_0x1dd6e2['push'](_0x1dd6e2['shift']());}};_0x135426(++_0x22b32c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x4f8a13,_0xca8b48){_0x4f8a13=_0x4f8a13-0x0;var _0x2044fd=_0x7a54[_0x4f8a13];return _0x2044fd;};'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 62695cf..f259778 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 _0x95f2=['createFaxMessage','Request'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x95f2,0x1db));var _0x295f=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x95f2[_0x58547b];return _0x1d3fd2;};'use strict';var client=require('../client');exports['create']=function(_0x3aca75){return client[_0x295f('0x0')]('CreateFaxMessage',{'body':_0x3aca75,'log':_0x295f('0x1')});}; \ No newline at end of file +var _0x8422=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x2aefff,_0x26a24b){var _0x4e4534=function(_0x592416){while(--_0x592416){_0x2aefff['push'](_0x2aefff['shift']());}};_0x4e4534(++_0x26a24b);}(_0x8422,0x16b));var _0x2842=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8422[_0xae7c2f];return _0x5d7001;};'use strict';var client=require('../client');exports[_0x2842('0x0')]=function(_0x2a7d44){return client[_0x2842('0x1')](_0x2842('0x2'),{'body':_0x2a7d44,'log':_0x2842('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4dc0985..aaa6f9a 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 _0x70d8=['name','timeout','strategy','Agents','../client','getFaxQueues'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x70d8,0x148));var _0x870d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x70d8[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x870d('0x0'));exports[_0x870d('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x870d('0x2'),_0x870d('0x3'),_0x870d('0x4')],'include':[{'model':'User','as':_0x870d('0x5'),'attributes':['id',_0x870d('0x2'),'online','faxPause']}]},'log':_0x870d('0x1')});};}; \ No newline at end of file +var _0x84c7=['GetFaxQueue','timeout','strategy','online','faxPause','../client','getFaxQueues','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x84c7,0x1b5));var _0x784c=function(_0x1cc11a,_0x1aaf43){_0x1cc11a=_0x1cc11a-0x0;var _0xc7c190=_0x84c7[_0x1cc11a];return _0xc7c190;};'use strict';var client=require(_0x784c('0x0'));exports[_0x784c('0x1')]=function(){return function(){return client[_0x784c('0x2')](_0x784c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x784c('0x4'),_0x784c('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x784c('0x6'),_0x784c('0x7')]}]},'log':_0x784c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d9b376c..204cac2 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 _0x3a01=['DESC','../client','Request','CreateFaxQueueReport'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x3a01,0x105));var _0x13a0=function(_0x427e9d,_0x6a2c98){_0x427e9d=_0x427e9d-0x0;var _0x4fc009=_0x3a01[_0x427e9d];return _0x4fc009;};'use strict';var client=require(_0x13a0('0x0'));exports['create']=function(_0x9a067e){return client[_0x13a0('0x1')]('CreateFaxQueueReport',{'body':_0x9a067e,'log':_0x13a0('0x2')});};exports['update']=function(_0x51f6be,_0x42386a){return client[_0x13a0('0x1')]('UpdateFaxQueueReport',{'body':_0x42386a,'options':{'where':{'uniqueid':_0x51f6be},'order':[['id',_0x13a0('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xfca8=['CreateFaxQueueReport','update','Request','DESC','UpdateFaxQueueReport','../client','create'];(function(_0xcc768c,_0x2384fc){var _0x4c2c13=function(_0x3e523e){while(--_0x3e523e){_0xcc768c['push'](_0xcc768c['shift']());}};_0x4c2c13(++_0x2384fc);}(_0xfca8,0x1c5));var _0x8fca=function(_0x16c47a,_0x328bd7){_0x16c47a=_0x16c47a-0x0;var _0x47ed0d=_0xfca8[_0x16c47a];return _0x47ed0d;};'use strict';var client=require(_0x8fca('0x0'));exports[_0x8fca('0x1')]=function(_0x39970e){return client['Request'](_0x8fca('0x2'),{'body':_0x39970e,'log':_0x8fca('0x2')});};exports[_0x8fca('0x3')]=function(_0x14c4dc,_0x5614eb){return client[_0x8fca('0x4')]('UpdateFaxQueueReport',{'body':_0x5614eb,'options':{'where':{'uniqueid':_0x14c4dc},'order':[['id',_0x8fca('0x5')]],'limit':0x1},'log':_0x8fca('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 09ed0a6..b7beb7f 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 _0x81b6=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x81b6,0x191));var _0x681b=function(_0x45b671,_0xc31f95){_0x45b671=_0x45b671-0x0;var _0x5c840d=_0x81b6[_0x45b671];return _0x5c840d;};'use strict';var client=require('../client');exports[_0x681b('0x0')]=function(){return function(){return client[_0x681b('0x1')](_0x681b('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x681b('0x3')],'include':[{'model':_0x681b('0x4'),'as':_0x681b('0x5'),'attributes':['id',_0x681b('0x3'),_0x681b('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xceff=['getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x4c08f8,_0xc3b462){var _0xf0f4bc=function(_0x4eef69){while(--_0x4eef69){_0x4c08f8['push'](_0x4c08f8['shift']());}};_0xf0f4bc(++_0xc3b462);}(_0xceff,0x14a));var _0xfcef=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xceff[_0x13b02f];return _0x12e9a6;};'use strict';var client=require('../client');exports[_0xfcef('0x0')]=function(){return function(){return client[_0xfcef('0x1')](_0xfcef('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfcef('0x3')],'include':[{'model':_0xfcef('0x4'),'as':_0xfcef('0x5'),'attributes':['id',_0xfcef('0x3'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2ffed00..d20f348 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 _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x531572,_0x420e7c){var _0x981dd4=function(_0x3b493c){while(--_0x3b493c){_0x531572['push'](_0x531572['shift']());}};_0x981dd4(++_0x420e7c);}(_0x02ce,0x1ac));var _0xe02c=function(_0x583a4a,_0x2250f6){_0x583a4a=_0x583a4a-0x0;var _0x4ae99b=_0x02ce[_0x583a4a];return _0x4ae99b;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file +var _0x5f2f=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x14fb73,_0x255ffd){var _0x19b3a4=function(_0x2c0c58){while(--_0x2c0c58){_0x14fb73['push'](_0x14fb73['shift']());}};_0x19b3a4(++_0x255ffd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16c0d6,_0x485e9a){_0x16c0d6=_0x16c0d6-0x0;var _0xb39beb=_0x5f2f[_0x16c0d6];return _0xb39beb;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(_0x2dcf60,_0x1a7be1){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'body':_0x1a7be1,'options':{'where':{'id':_0x2dcf60}},'log':_0xf5f2('0x4')});};exports[_0xf5f2('0x5')]=function(_0x501fbd,_0x4854b6){return client[_0xf5f2('0x2')](_0xf5f2('0x6'),{'body':_0x4854b6,'options':{'where':{'id':_0x501fbd}},'log':_0xf5f2('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 84ea8e3..f3898f8 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 _0x304c=['create','CreateMailMessage','../client'];(function(_0x194dfd,_0x56a31c){var _0x462426=function(_0x467221){while(--_0x467221){_0x194dfd['push'](_0x194dfd['shift']());}};_0x462426(++_0x56a31c);}(_0x304c,0x7d));var _0xc304=function(_0x59bf70,_0x4aff93){_0x59bf70=_0x59bf70-0x0;var _0x293cb5=_0x304c[_0x59bf70];return _0x293cb5;};'use strict';var client=require(_0xc304('0x0'));exports[_0xc304('0x1')]=function(_0x4b8390){return client['Request'](_0xc304('0x2'),{'body':_0x4b8390,'log':'createMailMessage'});}; \ No newline at end of file +var _0xff1a=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xff1a,0x14c));var _0xaff1=function(_0x23e961,_0x128139){_0x23e961=_0x23e961-0x0;var _0x277491=_0xff1a[_0x23e961];return _0x277491;};'use strict';var client=require(_0xaff1('0x0'));exports[_0xaff1('0x1')]=function(_0x570c4e){return client[_0xaff1('0x2')](_0xaff1('0x3'),{'body':_0x570c4e,'log':_0xaff1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3113d34..34aedc0 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 _0x446f=['User','Agents','online','mailPause','getMailQueues','../client','GetMailQueue','name','timeout'];(function(_0x590a37,_0x435e7a){var _0x59ef4e=function(_0x17f786){while(--_0x17f786){_0x590a37['push'](_0x590a37['shift']());}};_0x59ef4e(++_0x435e7a);}(_0x446f,0x1a3));var _0xf446=function(_0x28b545,_0x7198e3){_0x28b545=_0x28b545-0x0;var _0x4138c3=_0x446f[_0x28b545];return _0x4138c3;};'use strict';var client=require(_0xf446('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0xf446('0x1'),{'options':{'raw':![],'attributes':['id',_0xf446('0x2'),_0xf446('0x3'),'strategy'],'include':[{'model':_0xf446('0x4'),'as':_0xf446('0x5'),'attributes':['id',_0xf446('0x2'),_0xf446('0x6'),_0xf446('0x7')]}]},'log':_0xf446('0x8')});};}; \ No newline at end of file +var _0xc87a=['GetMailQueue','name','timeout','strategy','User','online','mailPause','getMailQueues','Request'];(function(_0x74e73e,_0x44685b){var _0x18ff97=function(_0x480040){while(--_0x480040){_0x74e73e['push'](_0x74e73e['shift']());}};_0x18ff97(++_0x44685b);}(_0xc87a,0x6b));var _0xac87=function(_0x14da05,_0x6f2a5c){_0x14da05=_0x14da05-0x0;var _0x57e11b=_0xc87a[_0x14da05];return _0x57e11b;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xac87('0x0')](_0xac87('0x1'),{'options':{'raw':![],'attributes':['id',_0xac87('0x2'),_0xac87('0x3'),_0xac87('0x4')],'include':[{'model':_0xac87('0x5'),'as':'Agents','attributes':['id','name',_0xac87('0x6'),_0xac87('0x7')]}]},'log':_0xac87('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5c4684d..fe23722 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 _0x9d01=['Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x14bdfb,_0x7ebb3c){var _0x433477=function(_0x499bf6){while(--_0x499bf6){_0x14bdfb['push'](_0x14bdfb['shift']());}};_0x433477(++_0x7ebb3c);}(_0x9d01,0x130));var _0x19d0=function(_0x4178e5,_0x4b2694){_0x4178e5=_0x4178e5-0x0;var _0x314f6f=_0x9d01[_0x4178e5];return _0x314f6f;};'use strict';var client=require('../client');exports['create']=function(_0x41b609){return client[_0x19d0('0x0')](_0x19d0('0x1'),{'body':_0x41b609,'log':_0x19d0('0x1')});};exports[_0x19d0('0x2')]=function(_0x1e8e9e,_0xd61519){return client['Request'](_0x19d0('0x3'),{'body':_0xd61519,'options':{'where':{'uniqueid':_0x1e8e9e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x1cc9=['UpdateMailQueueReport','create','Request','CreateMailQueueReport','update','DESC'];(function(_0x1eb585,_0x202476){var _0x497ee2=function(_0x36dffa){while(--_0x36dffa){_0x1eb585['push'](_0x1eb585['shift']());}};_0x497ee2(++_0x202476);}(_0x1cc9,0x115));var _0x91cc=function(_0x20ee16,_0x3d0700){_0x20ee16=_0x20ee16-0x0;var _0x428f43=_0x1cc9[_0x20ee16];return _0x428f43;};'use strict';var client=require('../client');exports[_0x91cc('0x0')]=function(_0x1821a3){return client[_0x91cc('0x1')](_0x91cc('0x2'),{'body':_0x1821a3,'log':_0x91cc('0x2')});};exports[_0x91cc('0x3')]=function(_0x246301,_0x2addbd){return client[_0x91cc('0x1')]('UpdateMailQueueReport',{'body':_0x2addbd,'options':{'where':{'uniqueid':_0x246301},'order':[['id',_0x91cc('0x4')]],'limit':0x1},'log':_0x91cc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index fd1ef1a..f40490a 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 _0xfc22=['addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction'];(function(_0xa50948,_0x40bc7f){var _0x4c6313=function(_0x2cf480){while(--_0x2cf480){_0xa50948['push'](_0xa50948['shift']());}};_0x4c6313(++_0x40bc7f);}(_0xfc22,0x12d));var _0x2fc2=function(_0xd17d89,_0x334c10){_0xd17d89=_0xd17d89-0x0;var _0x21927c=_0xfc22[_0xd17d89];return _0x21927c;};'use strict';var client=require(_0x2fc2('0x0'));exports['update']=function(_0xafd2df,_0x29022c){return client['Request'](_0x2fc2('0x1'),{'body':_0x29022c,'options':{'where':{'id':_0xafd2df}},'log':_0x2fc2('0x2')});};exports['addTags']=function(_0x1bec4a,_0x29ab0a){return client[_0x2fc2('0x3')](_0x2fc2('0x4'),{'body':_0x29ab0a,'options':{'where':{'id':_0x1bec4a}},'log':_0x2fc2('0x5')});}; \ No newline at end of file +var _0xd105=['addTags','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x3cd24f,_0x50ed26){var _0x205e9c=function(_0x1744f0){while(--_0x1744f0){_0x3cd24f['push'](_0x3cd24f['shift']());}};_0x205e9c(++_0x50ed26);}(_0xd105,0x98));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d10('0x0'));exports[_0x5d10('0x1')]=function(_0x49ca9a,_0x2052bd){return client[_0x5d10('0x2')]('UpdateOpenchannelInteraction',{'body':_0x2052bd,'options':{'where':{'id':_0x49ca9a}},'log':_0x5d10('0x3')});};exports[_0x5d10('0x4')]=function(_0x5151a8,_0x490035){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x490035,'options':{'where':{'id':_0x5151a8}},'log':_0x5d10('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d394bf7..562ee61 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 _0xdd0c=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x4aaf24,_0x2a8238){var _0x212022=function(_0x2fcb80){while(--_0x2fcb80){_0x4aaf24['push'](_0x4aaf24['shift']());}};_0x212022(++_0x2a8238);}(_0xdd0c,0x16f));var _0xcdd0=function(_0x5a5319,_0x581eb5){_0x5a5319=_0x5a5319-0x0;var _0x10f26f=_0xdd0c[_0x5a5319];return _0x10f26f;};'use strict';var client=require(_0xcdd0('0x0'));exports[_0xcdd0('0x1')]=function(_0x7c90b2){return client[_0xcdd0('0x2')](_0xcdd0('0x3'),{'body':_0x7c90b2,'log':_0xcdd0('0x4')});}; \ No newline at end of file +var _0x2996=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2996,0x1f2));var _0x6299=function(_0x47ad32,_0x1bdc04){_0x47ad32=_0x47ad32-0x0;var _0x519ce4=_0x2996[_0x47ad32];return _0x519ce4;};'use strict';var client=require(_0x6299('0x0'));exports[_0x6299('0x1')]=function(_0x3c82b2){return client[_0x6299('0x2')](_0x6299('0x3'),{'body':_0x3c82b2,'log':_0x6299('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 22bf7fe..abf1e26 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 _0xd96d=['GetOpenchannelQueue','name','strategy','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xd96d,0x180));var _0xdd96=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xd96d[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require('../client');exports[_0xdd96('0x0')]=function(){return function(){return client['Request'](_0xdd96('0x1'),{'options':{'raw':![],'attributes':['id',_0xdd96('0x2'),'timeout',_0xdd96('0x3')],'include':[{'model':'User','as':_0xdd96('0x4'),'attributes':['id',_0xdd96('0x2'),_0xdd96('0x5'),_0xdd96('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xbeb1=['name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xbeb1,0x104));var _0x1beb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbeb1[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x1beb('0x0'));exports[_0x1beb('0x1')]=function(){return function(){return client[_0x1beb('0x2')](_0x1beb('0x3'),{'options':{'raw':![],'attributes':['id',_0x1beb('0x4'),_0x1beb('0x5'),_0x1beb('0x6')],'include':[{'model':_0x1beb('0x7'),'as':_0x1beb('0x8'),'attributes':['id',_0x1beb('0x4'),_0x1beb('0x9'),_0x1beb('0xa')]}]},'log':_0x1beb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a3cba7a..7572f9d 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 _0xaced=['DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x4e5b3f,_0x2a0495){var _0x289b83=function(_0x492b1b){while(--_0x492b1b){_0x4e5b3f['push'](_0x4e5b3f['shift']());}};_0x289b83(++_0x2a0495);}(_0xaced,0xa4));var _0xdace=function(_0x2ae643,_0x269697){_0x2ae643=_0x2ae643-0x0;var _0x38eca1=_0xaced[_0x2ae643];return _0x38eca1;};'use strict';var client=require(_0xdace('0x0'));exports[_0xdace('0x1')]=function(_0x298327){return client[_0xdace('0x2')](_0xdace('0x3'),{'body':_0x298327,'log':_0xdace('0x3')});};exports['update']=function(_0x3a4aef,_0x45bff0){return client[_0xdace('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x45bff0,'options':{'where':{'uniqueid':_0x3a4aef},'order':[['id',_0xdace('0x4')]],'limit':0x1},'log':_0xdace('0x5')});}; \ No newline at end of file +var _0x7f48=['Request','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x7f48,0xac));var _0x87f4=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x7f48[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require(_0x87f4('0x0'));exports[_0x87f4('0x1')]=function(_0x514279){return client[_0x87f4('0x2')]('CreateOpenchannelQueueReport',{'body':_0x514279,'log':'CreateOpenchannelQueueReport'});};exports[_0x87f4('0x3')]=function(_0x23f975,_0x50608a){return client[_0x87f4('0x2')](_0x87f4('0x4'),{'body':_0x50608a,'options':{'where':{'uniqueid':_0x23f975},'order':[['id',_0x87f4('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0adf0fa..e69901d 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 _0x0d4e=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0d4e[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0xe0d4('0x0'));exports[_0xe0d4('0x1')]=function(_0x10777c,_0x329c53){return client[_0xe0d4('0x2')](_0xe0d4('0x3'),{'body':_0x329c53,'options':{'where':{'id':_0x10777c}},'log':_0xe0d4('0x4')});};exports[_0xe0d4('0x5')]=function(_0x251804,_0x56b43f){return client[_0xe0d4('0x2')](_0xe0d4('0x6'),{'body':_0x56b43f,'options':{'where':{'id':_0x251804}},'log':_0xe0d4('0x7')});}; \ No newline at end of file +var _0xae53=['addTagsToSmsInteraction','../client','Request','updateSmsInteraction','addTags'];(function(_0x26446d,_0x5c38d9){var _0xadd8ce=function(_0x375ede){while(--_0x375ede){_0x26446d['push'](_0x26446d['shift']());}};_0xadd8ce(++_0x5c38d9);}(_0xae53,0x16e));var _0x3ae5=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xae53[_0x29d915];return _0x160f86;};'use strict';var client=require(_0x3ae5('0x0'));exports['update']=function(_0x1afe71,_0x4229f0){return client[_0x3ae5('0x1')]('UpdateSmsInteraction',{'body':_0x4229f0,'options':{'where':{'id':_0x1afe71}},'log':_0x3ae5('0x2')});};exports[_0x3ae5('0x3')]=function(_0x293589,_0x476756){return client[_0x3ae5('0x1')]('AddTagsToSmsInteraction',{'body':_0x476756,'options':{'where':{'id':_0x293589}},'log':_0x3ae5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d6fd0b0..1fb9d06 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 _0x2877=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x346db4,_0x4c4c38){var _0x31f556=function(_0x4bc851){while(--_0x4bc851){_0x346db4['push'](_0x346db4['shift']());}};_0x31f556(++_0x4c4c38);}(_0x2877,0x154));var _0x7287=function(_0x549e7c,_0x649547){_0x549e7c=_0x549e7c-0x0;var _0x2a73a7=_0x2877[_0x549e7c];return _0x2a73a7;};'use strict';var client=require(_0x7287('0x0'));exports[_0x7287('0x1')]=function(_0x23ecd4){return client[_0x7287('0x2')](_0x7287('0x3'),{'body':_0x23ecd4,'log':_0x7287('0x4')});}; \ No newline at end of file +var _0x4fa6=['createSmsMessage','Request'];(function(_0x2d8ae9,_0x2127ae){var _0x29b6ea=function(_0x19d2aa){while(--_0x19d2aa){_0x2d8ae9['push'](_0x2d8ae9['shift']());}};_0x29b6ea(++_0x2127ae);}(_0x4fa6,0x1e1));var _0x64fa=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x4fa6[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require('../client');exports['create']=function(_0x4dbe78){return client[_0x64fa('0x0')]('CreateSmsMessage',{'body':_0x4dbe78,'log':_0x64fa('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c906685..527ee9f 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x5a619f,_0x5b4162){var _0x28133c=function(_0x224656){while(--_0x224656){_0x5a619f['push'](_0x5a619f['shift']());}};_0x28133c(++_0x5b4162);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x21d5fa,_0x381ac0){var _0x47ae87=function(_0x66f50b){while(--_0x66f50b){_0x21d5fa['push'](_0x21d5fa['shift']());}};_0x47ae87(++_0x381ac0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 a0a90ed..ba12b6f 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x550f3c,_0xbd8d94){var _0x20490f=function(_0x4d6777){while(--_0x4d6777){_0x550f3c['push'](_0x550f3c['shift']());}};_0x20490f(++_0xbd8d94);}(_0x34e8,0x12c));var _0x834e=function(_0x36f015,_0x4a9358){_0x36f015=_0x36f015-0x0;var _0x340abe=_0x34e8[_0x36f015];return _0x340abe;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x2d0858,_0x2c74c3){var _0x134481=function(_0x595c89){while(--_0x595c89){_0x2d0858['push'](_0x2d0858['shift']());}};_0x134481(++_0x2c74c3);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0fa1286..6159d77 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(_0x2c4027,_0x51fa47){var _0x535054=function(_0x3a2ceb){while(--_0x3a2ceb){_0x2c4027['push'](_0x2c4027['shift']());}};_0x535054(++_0x51fa47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x448163,_0x54930d){var _0x2dcb26=function(_0x3df20a){while(--_0x3df20a){_0x448163['push'](_0x448163['shift']());}};_0x2dcb26(++_0x54930d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 3296e63..5ca9dea 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 _0x814b=['Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x1d0131,_0x1cd75e){var _0x42bd1b=function(_0x2341c5){while(--_0x2341c5){_0x1d0131['push'](_0x1d0131['shift']());}};_0x42bd1b(++_0x1cd75e);}(_0x814b,0x1a2));var _0xb814=function(_0x261038,_0x2fab28){_0x261038=_0x261038-0x0;var _0x2fd230=_0x814b[_0x261038];return _0x2fd230;};'use strict';var client=require(_0xb814('0x0'));exports[_0xb814('0x1')]=function(_0x434f30,_0x2f4ece){return client[_0xb814('0x2')](_0xb814('0x3'),{'body':_0x2f4ece,'options':{'where':{'id':_0x434f30}},'log':'updateWhatsappInteraction'});};exports[_0xb814('0x4')]=function(_0x3e1e9,_0x258866){return client[_0xb814('0x2')](_0xb814('0x5'),{'body':_0x258866,'options':{'where':{'id':_0x3e1e9}},'log':_0xb814('0x6')});}; \ No newline at end of file +var _0x2525=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0xc2bb98,_0x2cb94d){var _0xbb10aa=function(_0x54bdee){while(--_0x54bdee){_0xc2bb98['push'](_0xc2bb98['shift']());}};_0xbb10aa(++_0x2cb94d);}(_0x2525,0x1f0));var _0x5252=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x2525[_0x5b78e8];return _0xf2c321;};'use strict';var client=require(_0x5252('0x0'));exports[_0x5252('0x1')]=function(_0x5de98b,_0x166a72){return client[_0x5252('0x2')](_0x5252('0x3'),{'body':_0x166a72,'options':{'where':{'id':_0x5de98b}},'log':_0x5252('0x4')});};exports[_0x5252('0x5')]=function(_0x28efdd,_0x4907eb){return client['Request'](_0x5252('0x6'),{'body':_0x4907eb,'options':{'where':{'id':_0x28efdd}},'log':_0x5252('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ddf7ee5..0a6de56 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 _0xe097=['Request','createWhatsappMessage','../client','create'];(function(_0x11ea75,_0x80a9e8){var _0x53e5fe=function(_0x560b49){while(--_0x560b49){_0x11ea75['push'](_0x11ea75['shift']());}};_0x53e5fe(++_0x80a9e8);}(_0xe097,0x176));var _0x7e09=function(_0x48c7ea,_0x463a80){_0x48c7ea=_0x48c7ea-0x0;var _0x4b0969=_0xe097[_0x48c7ea];return _0x4b0969;};'use strict';var client=require(_0x7e09('0x0'));exports[_0x7e09('0x1')]=function(_0xd6c72e){return client[_0x7e09('0x2')]('CreateWhatsappMessage',{'body':_0xd6c72e,'log':_0x7e09('0x3')});}; \ No newline at end of file +var _0x5c93=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x5c93,0x7d));var _0x35c9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5c93[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require('../client');exports[_0x35c9('0x0')]=function(_0x2685f9){return client[_0x35c9('0x1')](_0x35c9('0x2'),{'body':_0x2685f9,'log':_0x35c9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 9c1af23..bbdd299 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 _0x8280=['GetWhatsappQueue','strategy','Agents','name','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8280,0x1a6));var _0x0828=function(_0x36d714,_0xf860ef){_0x36d714=_0x36d714-0x0;var _0xcddb2=_0x8280[_0x36d714];return _0xcddb2;};'use strict';var client=require('../client');exports[_0x0828('0x0')]=function(){return function(){return client[_0x0828('0x1')](_0x0828('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x0828('0x3')],'include':[{'model':'User','as':_0x0828('0x4'),'attributes':['id',_0x0828('0x5'),_0x0828('0x6'),_0x0828('0x7')]}]},'log':_0x0828('0x0')});};}; \ No newline at end of file +var _0xc86e=['strategy','User','Agents','online','whatsappPause','getWhatsappQueues','Request','name','timeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc86e,0x16e));var _0xec86=function(_0x49a249,_0x433e82){_0x49a249=_0x49a249-0x0;var _0x29d386=_0xc86e[_0x49a249];return _0x29d386;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xec86('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xec86('0x1'),_0xec86('0x2'),_0xec86('0x3')],'include':[{'model':_0xec86('0x4'),'as':_0xec86('0x5'),'attributes':['id','name',_0xec86('0x6'),_0xec86('0x7')]}]},'log':_0xec86('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3dd1224..3ec72ee 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 _0xc7c2=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x350034,_0x1ab8d7){var _0x203bfc=function(_0x5455e9){while(--_0x5455e9){_0x350034['push'](_0x350034['shift']());}};_0x203bfc(++_0x1ab8d7);}(_0xc7c2,0x15b));var _0x2c7c=function(_0x271892,_0x8a9556){_0x271892=_0x271892-0x0;var _0x498b10=_0xc7c2[_0x271892];return _0x498b10;};'use strict';var client=require(_0x2c7c('0x0'));exports[_0x2c7c('0x1')]=function(_0xa17e43){return client[_0x2c7c('0x2')](_0x2c7c('0x3'),{'body':_0xa17e43,'log':_0x2c7c('0x3')});};exports[_0x2c7c('0x4')]=function(_0x3a0e6e,_0x220ee4){return client[_0x2c7c('0x2')](_0x2c7c('0x5'),{'body':_0x220ee4,'options':{'where':{'uniqueid':_0x3a0e6e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe0d8=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe0d8,0x14d));var _0x8e0d=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0xe0d8[_0x52c4e9];return _0x252a03;};'use strict';var client=require(_0x8e0d('0x0'));exports[_0x8e0d('0x1')]=function(_0x5372fc){return client[_0x8e0d('0x2')]('CreateWhatsappQueueReport',{'body':_0x5372fc,'log':_0x8e0d('0x3')});};exports[_0x8e0d('0x4')]=function(_0x5a5923,_0x4bf483){return client[_0x8e0d('0x2')](_0x8e0d('0x5'),{'body':_0x4bf483,'options':{'where':{'uniqueid':_0x5a5923},'order':[['id',_0x8e0d('0x6')]],'limit':0x1},'log':_0x8e0d('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 b0c80a7..2ab4342 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 _0x0888=['message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x0888,0xf8));var _0x8088=function(_0x1eca98,_0x20a86e){_0x1eca98=_0x1eca98-0x0;var _0x4f3bcf=_0x0888[_0x1eca98];return _0x4f3bcf;};'use strict';var schema=require('validate');var _=require(_0x8088('0x0'));var util=require(_0x8088('0x1'));var seqqueue=require(_0x8088('0x2'));var logger=require(_0x8088('0x3'))(_0x8088('0x4'));var strategy=require(_0x8088('0x5'));var queue=schema({'name':{'type':_0x8088('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x8088('0x7'),'message':_0x8088('0x8')}});function writeLog(_0x1a46d4,_0x2b8ba3,_0x499227){return logger[_0x8088('0x9')](util[_0x8088('0xa')](_0x8088('0xb'),_0x1a46d4,_0x2b8ba3['name'],_0x499227));}function handleFindAgent(_0x27d686){return function(_0x4fb3b5){return _0x4fb3b5['name'][_0x8088('0xc')]()===_0x27d686['toLowerCase']();};}exports[_0x8088('0xd')]=function(_0x4382cb,_0x1e6738,_0x2cd7f9,_0x2c6459){return function(_0x47e067){try{var _0x5b397b={'name':_0x1e6738[0x0],'timeout':_0x1e6738[0x1]};var _0x2bca52=queue['validate'](_0x5b397b,{'typecast':!![]});if(_0x2bca52[_0x8088('0xe')]){logger[_0x8088('0xf')](_0x8088('0x10'),_0x4382cb,_[_0x8088('0x11')](_0x2bca52,_0x8088('0x12'))[_0x8088('0x13')](',\x20'));_0x47e067[_0x8088('0x14')]();}else{var _0x294d64=_[_0x8088('0x15')](_0x2cd7f9[_0x8088('0x16')],handleFindAgent(_0x5b397b['name']));if(_0x294d64){var _0x3b80b5=(_0x5b397b[_0x8088('0x17')]||0xa)*0x3e8;var _0x447bc2,_0x1bc6bd;var _0x231b1f=seqqueue[_0x8088('0x18')](_0x3b80b5);_0x231b1f['id']=_0x4382cb;_0x231b1f['atimeout']=_0x3b80b5;_0x231b1f[_0x8088('0x19')]=_0x2c6459[_0x8088('0x19')];writeLog(_0x4382cb,_0x294d64,util[_0x8088('0xa')](_0x8088('0x1a'),_0x3b80b5));_0x2cd7f9[_0x8088('0x1b')][_0x4382cb]['on'](_0x8088('0x1c'),function(){logger['info'](_0x8088('0x1d'),_0x4382cb);clearTimeout(_0x1bc6bd);_0x1bc6bd=undefined;_0x231b1f['close']();if(_0x2cd7f9[_0x8088('0x1b')][_0x4382cb]){delete _0x2cd7f9[_0x8088('0x1b')][_0x4382cb];}_0x47e067['stop']();});_0x2cd7f9['rules'][_0x4382cb]['on'](_0x8088('0x1e'),function(){if(_0x2cd7f9['rules'][_0x4382cb]){delete _0x2cd7f9[_0x8088('0x1b')][_0x4382cb];}});_0x1bc6bd=setTimeout(function(){logger[_0x8088('0x9')](_0x8088('0x1f'),_0x4382cb);clearTimeout(_0x1bc6bd);_0x231b1f[_0x8088('0x20')]();_0x47e067[_0x8088('0x21')]();},_0x3b80b5);strategy['agent'](_0x231b1f,_0x294d64,_0x2cd7f9,_0x2c6459);}else{logger['error'](_0x8088('0x22'),_0x4382cb,_0x5b397b['name']);_0x47e067[_0x8088('0x14')]();}}}catch(_0x556027){console[_0x8088('0x23')](_0x556027);logger[_0x8088('0xf')](_0x8088('0x24'),_0x4382cb,_0x556027[_0x8088('0x25')]);_0x47e067[_0x8088('0x14')]();}};}; \ No newline at end of file +var _0x54c7=['timeout','atimeout','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','info','format','name','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents'];(function(_0x274c02,_0x8cdabd){var _0x2bd150=function(_0xf954a4){while(--_0xf954a4){_0x274c02['push'](_0x274c02['shift']());}};_0x2bd150(++_0x8cdabd);}(_0x54c7,0x161));var _0x754c=function(_0x1db5f4,_0x644c29){_0x1db5f4=_0x1db5f4-0x0;var _0xf3d38=_0x54c7[_0x1db5f4];return _0xf3d38;};'use strict';var schema=require(_0x754c('0x0'));var _=require('lodash');var util=require(_0x754c('0x1'));var seqqueue=require(_0x754c('0x2'));var logger=require(_0x754c('0x3'))(_0x754c('0x4'));var strategy=require(_0x754c('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x754c('0x6')}});function writeLog(_0x283fd8,_0x5dc4bc,_0x27af7a){return logger[_0x754c('0x7')](util[_0x754c('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x283fd8,_0x5dc4bc[_0x754c('0x9')],_0x27af7a));}function handleFindAgent(_0x3e45ab){return function(_0x111199){return _0x111199[_0x754c('0x9')]['toLowerCase']()===_0x3e45ab['toLowerCase']();};}exports[_0x754c('0xa')]=function(_0x5d1830,_0x1dbf2c,_0x415a2c,_0x443c6c){return function(_0x42131d){try{var _0x4f284a={'name':_0x1dbf2c[0x0],'timeout':_0x1dbf2c[0x1]};var _0x2f9cb0=queue[_0x754c('0x0')](_0x4f284a,{'typecast':!![]});if(_0x2f9cb0[_0x754c('0xb')]){logger[_0x754c('0xc')](_0x754c('0xd'),_0x5d1830,_[_0x754c('0xe')](_0x2f9cb0,'message')[_0x754c('0xf')](',\x20'));_0x42131d[_0x754c('0x10')]();}else{var _0x42b753=_[_0x754c('0x11')](_0x415a2c[_0x754c('0x12')],handleFindAgent(_0x4f284a[_0x754c('0x9')]));if(_0x42b753){var _0x4340f5=(_0x4f284a[_0x754c('0x13')]||0xa)*0x3e8;var _0x149944,_0x5247c0;var _0xe46e48=seqqueue['createQueue'](_0x4340f5);_0xe46e48['id']=_0x5d1830;_0xe46e48[_0x754c('0x14')]=_0x4340f5;_0xe46e48['channel']=_0x443c6c['channel'];writeLog(_0x5d1830,_0x42b753,util['format']('START:%s',_0x4340f5));_0x415a2c[_0x754c('0x15')][_0x5d1830]['on']('end',function(){logger[_0x754c('0x7')](_0x754c('0x16'),_0x5d1830);clearTimeout(_0x5247c0);_0x5247c0=undefined;_0xe46e48['close']();if(_0x415a2c[_0x754c('0x15')][_0x5d1830]){delete _0x415a2c[_0x754c('0x15')][_0x5d1830];}_0x42131d[_0x754c('0x10')]();});_0x415a2c[_0x754c('0x15')][_0x5d1830]['on'](_0x754c('0x17'),function(){if(_0x415a2c[_0x754c('0x15')][_0x5d1830]){delete _0x415a2c[_0x754c('0x15')][_0x5d1830];}});_0x5247c0=setTimeout(function(){logger['info'](_0x754c('0x18'),_0x5d1830);clearTimeout(_0x5247c0);_0xe46e48[_0x754c('0x19')]();_0x42131d[_0x754c('0x1a')]();},_0x4340f5);strategy[_0x754c('0x1b')](_0xe46e48,_0x42b753,_0x415a2c,_0x443c6c);}else{logger[_0x754c('0xc')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5d1830,_0x4f284a[_0x754c('0x9')]);_0x42131d[_0x754c('0x10')]();}}}catch(_0x37f613){console[_0x754c('0x1c')](_0x37f613);logger[_0x754c('0xc')](_0x754c('0x1d'),_0x5d1830,_0x37f613[_0x754c('0x1e')]);_0x42131d[_0x754c('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index b2720f7..8b2edb9 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 _0x6548=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','account','upperFirst','AccountId','InteractionId','getMustacheRender','Message','then','catch','stringify','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','toString','postText','error','providerName','amazonlex','providerResponse','create','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing'];(function(_0x1cbf48,_0x2cbe4e){var _0x4d55d5=function(_0x2cda1c){while(--_0x2cda1c){_0x1cbf48['push'](_0x1cbf48['shift']());}};_0x4d55d5(++_0x2cbe4e);}(_0x6548,0x103));var _0x8654=function(_0x32a1ee,_0x3373b9){_0x32a1ee=_0x32a1ee-0x0;var _0x2c8083=_0x6548[_0x32a1ee];return _0x2c8083;};'use strict';var _=require(_0x8654('0x0'));var moment=require('moment');var AWS=require(_0x8654('0x1'));var utils=require(_0x8654('0x2'));var logger=require(_0x8654('0x3'))(_0x8654('0x4'));var rpc={'chatMessage':require(_0x8654('0x5')),'openchannelMessage':require(_0x8654('0x6')),'mailMessage':require(_0x8654('0x7')),'smsMessage':require(_0x8654('0x8')),'faxMessage':require(_0x8654('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8654('0xa')]=function(_0x3cbbc8,_0x3fa759){return function(_0x1dfab4){try{if(!_['isNil'](this[_0x8654('0xb')][_0x8654('0xc')])){logger['info'](_0x8654('0xd'),_0x3cbbc8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1dfab4[_0x8654('0xe')]();}var _0x15a4c2={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x8654('0xf')),'direction':_0x8654('0x10')};if(this[_0x8654('0x11')]==='sms'||this['channel']==='whatsapp'){_0x15a4c2[_0x8654('0x12')]=this[_0x8654('0xb')]['phone'];}var _0x4b538f=this[_0x8654('0x11')];if(_0x4b538f===_0x8654('0x13')){_0x15a4c2['ChatWebsiteId']=this[_0x8654('0x14')]['id'];}else{_0x15a4c2[_[_0x8654('0x15')](_0x4b538f)+_0x8654('0x16')]=this[_0x8654('0x14')]['id'];}_0x15a4c2[_['upperFirst'](_0x4b538f)+_0x8654('0x17')]=this['interaction']['id'];if(this[_0x8654('0xb')]['created']){var _0x14e69f=_0x3fa759[0x4];if(!_['isEmpty'](_0x14e69f)){_0x15a4c2['body']=utils[_0x8654('0x18')](_0x14e69f,this);return rpc[_0x4b538f+_0x8654('0x19')]['create'](_0x15a4c2)[_0x8654('0x1a')](function(_0x4a25a0){logger['info'](_0x8654('0xd'),_0x3cbbc8,_0x15a4c2['body']);})[_0x8654('0x1b')](function(_0x323e42){logger['error'](_0x8654('0xd'),_0x3cbbc8,JSON[_0x8654('0x1c')](_0x323e42));})['finally'](function(){logger[_0x8654('0x1d')](_0x8654('0x1e'),_0x3cbbc8);_0x1dfab4[_0x8654('0x1f')]();});}else{logger[_0x8654('0x1d')](_0x8654('0x20'),_0x3cbbc8);_0x1dfab4[_0x8654('0x1f')]();}}else{var _0x2015c7=this;var _0x483d5e=new AWS[(_0x8654('0x21'))]({'accessKeyId':_0x3fa759[0x0],'secretAccessKey':_0x3fa759[0x1],'region':_0x3fa759[0x2]});var _0x1eb2da={'botAlias':'$LATEST','botName':_0x3fa759[0x3],'inputText':this[_0x8654('0x22')][_0x8654('0x23')],'userId':this['channel']+':'+this[_0x8654('0xb')]['id'][_0x8654('0x24')]()};_0x483d5e[_0x8654('0x25')](_0x1eb2da,function(_0x2315b2,_0xfc5d12){if(_0x2315b2){logger[_0x8654('0x26')](_0x8654('0xd'),_0x3cbbc8,_0x2315b2[_0x8654('0x22')]);_0x1dfab4[_0x8654('0xe')]();}else if(_0xfc5d12&&_0xfc5d12[_0x8654('0x22')]){_0x2015c7[_0x8654('0x23')]['amazonlex']=_0xfc5d12;_0x15a4c2['body']=_0xfc5d12[_0x8654('0x22')];_0x15a4c2[_0x8654('0x27')]=_0x8654('0x28');_0x15a4c2[_0x8654('0x29')]=JSON[_0x8654('0x1c')](_0xfc5d12);return rpc[_0x4b538f+_0x8654('0x19')][_0x8654('0x2a')](_0x15a4c2)['then'](function(_0x325ddb){logger[_0x8654('0x1d')](_0x8654('0xd'),_0x3cbbc8,_0x15a4c2[_0x8654('0x23')]);if(_0xfc5d12['dialogState']==_0x8654('0x2b')){_0x1dfab4[_0x8654('0xe')]();}else{_0x1dfab4[_0x8654('0x1f')]();}})['catch'](function(_0x560d9e){logger[_0x8654('0x26')](_0x8654('0xd'),_0x3cbbc8,JSON[_0x8654('0x1c')](_0x560d9e));_0x1dfab4[_0x8654('0xe')]();});}else{_0x1dfab4[_0x8654('0xe')]();}});}}catch(_0x3e97a5){logger[_0x8654('0x26')](_0x8654('0xd'),_0x3cbbc8,JSON[_0x8654('0x1c')](_0x3e97a5));_0x1dfab4[_0x8654('0x1f')]();}};}; \ No newline at end of file +var _0xa818=['created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','[%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','amazonlex','providerResponse','dialogState','Failed','catch','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account'];(function(_0xec167a,_0x2bd0f8){var _0x2de1d4=function(_0x3e80eb){while(--_0x3e80eb){_0xec167a['push'](_0xec167a['shift']());}};_0x2de1d4(++_0x2bd0f8);}(_0xa818,0x141));var _0x8a81=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xa818[_0x295a3d];return _0x23a732;};'use strict';var _=require(_0x8a81('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x8a81('0x1'))(_0x8a81('0x2'));var rpc={'chatMessage':require(_0x8a81('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8a81('0x4')),'faxMessage':require(_0x8a81('0x5')),'whatsappMessage':require(_0x8a81('0x6'))};exports['consequence']=function(_0x1edc67,_0x4fe279){return function(_0x221b0f){try{if(!_['isNil'](this[_0x8a81('0x7')][_0x8a81('0x8')])){logger[_0x8a81('0x9')](_0x8a81('0xa'),_0x1edc67,_0x8a81('0xb'));return _0x221b0f[_0x8a81('0xc')]();}var _0x198d5d={'ContactId':this[_0x8a81('0xd')]['id'],'sentAt':moment()['format'](_0x8a81('0xe')),'direction':_0x8a81('0xf')};if(this[_0x8a81('0x10')]===_0x8a81('0x11')||this[_0x8a81('0x10')]===_0x8a81('0x12')){_0x198d5d[_0x8a81('0x13')]=this[_0x8a81('0x7')][_0x8a81('0x13')];}var _0x3e98db=this['channel'];if(_0x3e98db===_0x8a81('0x14')){_0x198d5d[_0x8a81('0x15')]=this[_0x8a81('0x16')]['id'];}else{_0x198d5d[_['upperFirst'](_0x3e98db)+'AccountId']=this[_0x8a81('0x16')]['id'];}_0x198d5d[_['upperFirst'](_0x3e98db)+'InteractionId']=this[_0x8a81('0x7')]['id'];if(this['interaction'][_0x8a81('0x17')]){var _0x533913=_0x4fe279[0x4];if(!_[_0x8a81('0x18')](_0x533913)){_0x198d5d[_0x8a81('0x19')]=utils[_0x8a81('0x1a')](_0x533913,this);return rpc[_0x3e98db+_0x8a81('0x1b')][_0x8a81('0x1c')](_0x198d5d)[_0x8a81('0x1d')](function(_0x1168de){logger[_0x8a81('0x9')](_0x8a81('0xa'),_0x1edc67,_0x198d5d[_0x8a81('0x19')]);})['catch'](function(_0x486146){logger[_0x8a81('0x1e')](_0x8a81('0xa'),_0x1edc67,JSON[_0x8a81('0x1f')](_0x486146));})['finally'](function(){logger[_0x8a81('0x9')](_0x8a81('0x20'),_0x1edc67);_0x221b0f[_0x8a81('0x21')]();});}else{logger[_0x8a81('0x9')](_0x8a81('0x22'),_0x1edc67);_0x221b0f[_0x8a81('0x21')]();}}else{var _0x260e4c=this;var _0x296f5a=new AWS[(_0x8a81('0x23'))]({'accessKeyId':_0x4fe279[0x0],'secretAccessKey':_0x4fe279[0x1],'region':_0x4fe279[0x2]});var _0x358c88={'botAlias':_0x8a81('0x24'),'botName':_0x4fe279[0x3],'inputText':this[_0x8a81('0x25')][_0x8a81('0x19')],'userId':this['channel']+':'+this[_0x8a81('0x7')]['id']['toString']()};_0x296f5a['postText'](_0x358c88,function(_0x330177,_0x11aff6){if(_0x330177){logger[_0x8a81('0x1e')](_0x8a81('0xa'),_0x1edc67,_0x330177[_0x8a81('0x25')]);_0x221b0f[_0x8a81('0xc')]();}else if(_0x11aff6&&_0x11aff6[_0x8a81('0x25')]){_0x260e4c[_0x8a81('0x19')]['amazonlex']=_0x11aff6;_0x198d5d[_0x8a81('0x19')]=_0x11aff6['message'];_0x198d5d['providerName']=_0x8a81('0x26');_0x198d5d[_0x8a81('0x27')]=JSON['stringify'](_0x11aff6);return rpc[_0x3e98db+_0x8a81('0x1b')][_0x8a81('0x1c')](_0x198d5d)[_0x8a81('0x1d')](function(_0x150d32){logger[_0x8a81('0x9')]('[%s][AMAZONLEX]\x20%s',_0x1edc67,_0x198d5d['body']);if(_0x11aff6[_0x8a81('0x28')]==_0x8a81('0x29')){_0x221b0f[_0x8a81('0xc')]();}else{_0x221b0f[_0x8a81('0x21')]();}})[_0x8a81('0x2a')](function(_0x40531b){logger[_0x8a81('0x1e')](_0x8a81('0xa'),_0x1edc67,JSON[_0x8a81('0x1f')](_0x40531b));_0x221b0f[_0x8a81('0xc')]();});}else{_0x221b0f[_0x8a81('0xc')]();}});}}catch(_0x2d8556){logger[_0x8a81('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x1edc67,JSON[_0x8a81('0x1f')](_0x2d8556));_0x221b0f[_0x8a81('0x21')]();}};}; \ 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 3a459f6..710816d 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 _0xb848=['error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch'];(function(_0x49b54f,_0x3d5d30){var _0x5e7e97=function(_0x1cd274){while(--_0x1cd274){_0x49b54f['push'](_0x49b54f['shift']());}};_0x5e7e97(++_0x3d5d30);}(_0xb848,0x167));var _0x8b84=function(_0x40e192,_0xb9b964){_0x40e192=_0x40e192-0x0;var _0x5df261=_0xb848[_0x40e192];return _0x5df261;};'use strict';var _=require(_0x8b84('0x0'));var moment=require(_0x8b84('0x1'));var utils=require(_0x8b84('0x2'));var logger=require(_0x8b84('0x3'))('routing');var rpc={'chatMessage':require(_0x8b84('0x4')),'openchannelMessage':require(_0x8b84('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8b84('0x6')),'faxMessage':require(_0x8b84('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x8b84('0x8')),'openchannelInteraction':require(_0x8b84('0x9')),'mailInteraction':require(_0x8b84('0xa')),'smsInteraction':require(_0x8b84('0xb')),'faxInteraction':require(_0x8b84('0xc')),'whatsappInteraction':require(_0x8b84('0xd'))};var mailRpc=require(_0x8b84('0xe'));exports[_0x8b84('0xf')]=function(_0x40fb9d,_0x36b76d,_0x4f46fe,_0x44d6c3){return function(_0x1ad4db){try{var _0x257c5e=this[_0x8b84('0x10')];if(_0x257c5e==='mail'&&_0x44d6c3[_0x8b84('0x11')]['isAutoreply']){logger['info'](_0x8b84('0x12'),_0x40fb9d,_0x8b84('0x13'));return _0x1ad4db[_0x8b84('0x14')]();}if(_0x36b76d[0x0]==='1'&&(_[_0x8b84('0x15')](this[_0x8b84('0x16')][_0x8b84('0x17')])||!this[_0x8b84('0x16')][_0x8b84('0x17')])){logger[_0x8b84('0x18')]('[%s][AUTOREPLY]\x20%s',_0x40fb9d,_0x8b84('0x19'));return _0x1ad4db[_0x8b84('0x14')]();}if(_0x36b76d[0x0]==='2'&&this['interaction'][_0x8b84('0x1a')]){logger[_0x8b84('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x40fb9d,_0x8b84('0x1b'));return _0x1ad4db[_0x8b84('0x14')]();}var _0x1f481f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8b84('0x1c')](_0x8b84('0x1d')),'direction':_0x8b84('0x1e')};if(this[_0x8b84('0x10')]===_0x8b84('0x1f')){_0x1f481f[_0x8b84('0x11')]=utils[_0x8b84('0x20')](_0x36b76d[0x2],this);}else{_0x1f481f[_0x8b84('0x11')]=utils['getMustacheRender'](_0x36b76d[0x1],this);}if(this[_0x8b84('0x21')]){_0x1f481f['to']=this[_0x8b84('0x21')][_0x8b84('0x22')]||'';if(this[_0x8b84('0x10')]===_0x8b84('0x1f')&&_0x36b76d[0x1]==='1'){_0x1f481f['cc']=this[_0x8b84('0x21')]['cc']||'';}_0x1f481f['from']=this[_0x8b84('0x21')]['to']||'';_0x1f481f['phone']=this[_0x8b84('0x21')][_0x8b84('0x23')]||'';_0x1f481f['read']=!![];if(this['message'][_0x8b84('0x24')]){_0x1f481f[_0x8b84('0x24')]='';_0x1f481f[_0x8b84('0x24')]+=_[_0x8b84('0x25')](this['message']['subject'],_0x8b84('0x26'))?'':_0x8b84('0x27');_0x1f481f[_0x8b84('0x24')]+=this[_0x8b84('0x21')][_0x8b84('0x24')];}}if(this[_0x8b84('0x10')]==='chat'){_0x1f481f[_0x8b84('0x28')]=this[_0x8b84('0x29')]['id'];}else{_0x1f481f[_[_0x8b84('0x2a')](this[_0x8b84('0x10')])+_0x8b84('0x2b')]=this[_0x8b84('0x29')]['id'];}_0x1f481f[_[_0x8b84('0x2a')](this['channel'])+_0x8b84('0x2c')]=this[_0x8b84('0x16')]['id'];var _0x29fd0c=this[_0x8b84('0x16')];if(rpc[this[_0x8b84('0x10')]+_0x8b84('0x2d')]){if(this[_0x8b84('0x10')]==='mail'){_0x1f481f[_0x8b84('0x2e')]=this[_0x8b84('0x21')][_0x8b84('0x2f')];_0x1f481f[_0x8b84('0x30')]=_0x8b84('0x31')+_[_0x8b84('0x32')](_0x1f481f[_0x8b84('0x11')],_0x8b84('0x33'),_0x8b84('0x34'))+_0x8b84('0x35');_0x1f481f[_0x8b84('0x36')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x8b84('0x37')};return mailRpc['sendMailMessage'](this[_0x8b84('0x29')][_0x8b84('0x38')],_0x1f481f)[_0x8b84('0x39')](function(_0x3541d7){logger[_0x8b84('0x18')](_0x8b84('0x3a'),_0x40fb9d);_0x1f481f[_0x8b84('0x2f')]=_0x3541d7[_0x8b84('0x21')][_0x8b84('0x2f')];return rpc[_0x257c5e+_0x8b84('0x2d')][_0x8b84('0x3b')](_0x1f481f);})[_0x8b84('0x39')](function(_0xde9899){logger[_0x8b84('0x18')]('[%s][AUTOREPLY]\x20%s',_0x40fb9d,JSON[_0x8b84('0x3c')](_0xde9899));})['catch'](function(_0x37825f){logger['error'](_0x8b84('0x3d'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x37825f));})[_0x8b84('0x3e')](function(){Promise[_0x8b84('0x3f')]()[_0x8b84('0x39')](function(){if(_0x36b76d[0x0]!=='2'||_0x29fd0c[_0x8b84('0x1a')])return;return rpc[_0x257c5e+_0x8b84('0x40')]['update'](_0x29fd0c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x140c2a){logger['info'](_0x8b84('0x41'),_0x40fb9d,JSON['stringify'](_0x140c2a));})[_0x8b84('0x42')](function(_0x5b9e88){logger[_0x8b84('0x43')](_0x8b84('0x44'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x5b9e88));});})['then'](function(){_0x1ad4db[_0x8b84('0x14')]();});});}else{return rpc[this['channel']+_0x8b84('0x2d')][_0x8b84('0x3b')](_0x1f481f)['then'](function(){logger[_0x8b84('0x18')](_0x8b84('0x12'),_0x40fb9d,_0x1f481f[_0x8b84('0x11')]);})[_0x8b84('0x42')](function(_0x61548e){logger[_0x8b84('0x43')](_0x8b84('0x12'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x61548e));})[_0x8b84('0x3e')](function(){Promise['resolve']()['then'](function(){if(_0x36b76d[0x0]!=='2'||_0x29fd0c['autoreplyExecuted'])return;return rpc[_0x257c5e+_0x8b84('0x40')][_0x8b84('0x45')](_0x29fd0c['id'],{'autoreplyExecuted':!![]})[_0x8b84('0x39')](function(_0x5d1e65){logger['info'](_0x8b84('0x41'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x5d1e65));})['catch'](function(_0x2627b3){logger['error'](_0x8b84('0x44'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x2627b3));});})[_0x8b84('0x39')](function(){_0x1ad4db[_0x8b84('0x14')]();});});}}}catch(_0x50a87a){logger['error'](_0x8b84('0x12'),_0x40fb9d,JSON[_0x8b84('0x3c')](_0x50a87a));_0x1ad4db[_0x8b84('0x46')]();}};}; \ No newline at end of file +var _0x7908=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','messageId','html','','replace','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x7908,0xba));var _0x8790=function(_0x4b4037,_0x575a70){_0x4b4037=_0x4b4037-0x0;var _0x29c100=_0x7908[_0x4b4037];return _0x29c100;};'use strict';var _=require(_0x8790('0x0'));var moment=require(_0x8790('0x1'));var utils=require(_0x8790('0x2'));var logger=require(_0x8790('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8790('0x4')),'mailMessage':require(_0x8790('0x5')),'smsMessage':require(_0x8790('0x6')),'faxMessage':require(_0x8790('0x7')),'whatsappMessage':require(_0x8790('0x8')),'chatInteraction':require(_0x8790('0x9')),'openchannelInteraction':require(_0x8790('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8790('0xb'))};var mailRpc=require(_0x8790('0xc'));exports['consequence']=function(_0x214f90,_0x405804,_0x3e28b2,_0x1b2601){return function(_0x21984d){try{var _0x389ba9=this[_0x8790('0xd')];if(_0x389ba9===_0x8790('0xe')&&_0x1b2601[_0x8790('0xf')][_0x8790('0x10')]){logger[_0x8790('0x11')](_0x8790('0x12'),_0x214f90,_0x8790('0x13'));return _0x21984d[_0x8790('0x14')]();}if(_0x405804[0x0]==='1'&&(_[_0x8790('0x15')](this['interaction'][_0x8790('0x16')])||!this[_0x8790('0x17')][_0x8790('0x16')])){logger[_0x8790('0x11')](_0x8790('0x12'),_0x214f90,'Autoreply\x20already\x20sent');return _0x21984d[_0x8790('0x14')]();}if(_0x405804[0x0]==='2'&&this[_0x8790('0x17')]['autoreplyExecuted']){logger[_0x8790('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x214f90,'One\x20Time\x20already\x20sent');return _0x21984d[_0x8790('0x14')]();}var _0x546f63={'ContactId':this[_0x8790('0x18')]['id'],'sentAt':moment()[_0x8790('0x19')](_0x8790('0x1a')),'direction':_0x8790('0x1b')};if(this[_0x8790('0xd')]==='mail'){_0x546f63[_0x8790('0xf')]=utils[_0x8790('0x1c')](_0x405804[0x2],this);}else{_0x546f63['body']=utils[_0x8790('0x1c')](_0x405804[0x1],this);}if(this[_0x8790('0x1d')]){_0x546f63['to']=this['message'][_0x8790('0x1e')]||'';if(this[_0x8790('0xd')]===_0x8790('0xe')&&_0x405804[0x1]==='1'){_0x546f63['cc']=this[_0x8790('0x1d')]['cc']||'';}_0x546f63[_0x8790('0x1e')]=this[_0x8790('0x1d')]['to']||'';_0x546f63[_0x8790('0x1f')]=this[_0x8790('0x1d')]['phone']||'';_0x546f63[_0x8790('0x20')]=!![];if(this[_0x8790('0x1d')]['subject']){_0x546f63['subject']='';_0x546f63[_0x8790('0x21')]+=_[_0x8790('0x22')](this[_0x8790('0x1d')][_0x8790('0x21')],'Re:')?'':_0x8790('0x23');_0x546f63['subject']+=this[_0x8790('0x1d')][_0x8790('0x21')];}}if(this[_0x8790('0xd')]===_0x8790('0x24')){_0x546f63[_0x8790('0x25')]=this['account']['id'];}else{_0x546f63[_[_0x8790('0x26')](this[_0x8790('0xd')])+'AccountId']=this[_0x8790('0x27')]['id'];}_0x546f63[_[_0x8790('0x26')](this['channel'])+_0x8790('0x28')]=this[_0x8790('0x17')]['id'];var _0xd332aa=this['interaction'];if(rpc[this[_0x8790('0xd')]+_0x8790('0x29')]){if(this[_0x8790('0xd')]===_0x8790('0xe')){_0x546f63[_0x8790('0x2a')]=this[_0x8790('0x1d')][_0x8790('0x2b')];_0x546f63[_0x8790('0x2c')]=_0x8790('0x2d')+_[_0x8790('0x2e')](_0x546f63[_0x8790('0xf')],'';_0x546f63[_0x8790('0x2f')]={'Auto-Submitted':_0x8790('0x30'),'X-Auto-Response-Suppress':_0x8790('0x31'),'Precedence':_0x8790('0x32')};return mailRpc['sendMailMessage'](this['account']['smtpOptions'],_0x546f63)[_0x8790('0x33')](function(_0x1b6197){logger[_0x8790('0x11')](_0x8790('0x34'),_0x214f90);_0x546f63[_0x8790('0x2b')]=_0x1b6197[_0x8790('0x1d')]['messageId'];return rpc[_0x389ba9+_0x8790('0x29')][_0x8790('0x35')](_0x546f63);})[_0x8790('0x33')](function(_0x31136e){logger[_0x8790('0x11')](_0x8790('0x12'),_0x214f90,JSON[_0x8790('0x36')](_0x31136e));})[_0x8790('0x37')](function(_0x237e3e){logger[_0x8790('0x38')](_0x8790('0x39'),_0x214f90,JSON[_0x8790('0x36')](_0x237e3e));})[_0x8790('0x3a')](function(){Promise[_0x8790('0x3b')]()[_0x8790('0x33')](function(){if(_0x405804[0x0]!=='2'||_0xd332aa[_0x8790('0x3c')])return;return rpc[_0x389ba9+'Interaction']['update'](_0xd332aa['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4aff66){logger[_0x8790('0x11')](_0x8790('0x3d'),_0x214f90,JSON['stringify'](_0x4aff66));})[_0x8790('0x37')](function(_0xf0bb33){logger['error'](_0x8790('0x3e'),_0x214f90,JSON[_0x8790('0x36')](_0xf0bb33));});})[_0x8790('0x33')](function(){_0x21984d[_0x8790('0x14')]();});});}else{return rpc[this[_0x8790('0xd')]+_0x8790('0x29')]['create'](_0x546f63)[_0x8790('0x33')](function(){logger[_0x8790('0x11')](_0x8790('0x12'),_0x214f90,_0x546f63[_0x8790('0xf')]);})[_0x8790('0x37')](function(_0x3053eb){logger[_0x8790('0x38')]('[%s][AUTOREPLY]\x20%s',_0x214f90,JSON[_0x8790('0x36')](_0x3053eb));})[_0x8790('0x3a')](function(){Promise[_0x8790('0x3b')]()[_0x8790('0x33')](function(){if(_0x405804[0x0]!=='2'||_0xd332aa[_0x8790('0x3c')])return;return rpc[_0x389ba9+_0x8790('0x3f')]['update'](_0xd332aa['id'],{'autoreplyExecuted':!![]})[_0x8790('0x33')](function(_0x1bec71){logger[_0x8790('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x214f90,JSON[_0x8790('0x36')](_0x1bec71));})[_0x8790('0x37')](function(_0x5ea65a){logger[_0x8790('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x214f90,JSON[_0x8790('0x36')](_0x5ea65a));});})[_0x8790('0x33')](function(){_0x21984d['next']();});});}}}catch(_0x3082cf){logger[_0x8790('0x38')]('[%s][AUTOREPLY]\x20%s',_0x214f90,JSON['stringify'](_0x3082cf));_0x21984d[_0x8790('0x40')]();}};}; \ 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 53b1f18..8e3ad71 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 _0x0dd1=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger'];(function(_0x485feb,_0x4687f9){var _0x3013fd=function(_0x247283){while(--_0x247283){_0x485feb['push'](_0x485feb['shift']());}};_0x3013fd(++_0x4687f9);}(_0x0dd1,0xee));var _0x10dd=function(_0x5108d0,_0xdc80a2){_0x5108d0=_0x5108d0-0x0;var _0x3d44e7=_0x0dd1[_0x5108d0];return _0x3d44e7;};'use strict';var moment=require(_0x10dd('0x0'));var logger=require(_0x10dd('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x10dd('0x2')),'smsInteraction':require(_0x10dd('0x3')),'mailInteraction':require(_0x10dd('0x4')),'faxInteraction':require(_0x10dd('0x5')),'whatsappInteraction':require(_0x10dd('0x6'))};exports[_0x10dd('0x7')]=function(_0x30d471,_0x186695,_0xbf6c1b,_0x4e9333){return function(_0xddd4a3){try{logger[_0x10dd('0x8')](_0x10dd('0x9'),_0x30d471,_0x186695[0x0]);var _0x1fe9f7={'closed':0x1,'closedAt':moment()[_0x10dd('0xa')](_0x10dd('0xb')),'closeReason':'system','disposition':_0x186695[0x0]};if(rpc[_0x4e9333[_0x10dd('0xc')]+_0x10dd('0xd')]){rpc[_0x4e9333[_0x10dd('0xc')]+_0x10dd('0xd')][_0x10dd('0xe')](_0x4e9333[_0x10dd('0xf')]['id'],_0x1fe9f7)[_0x10dd('0x10')](function(_0x31704a){logger['info'](_0x10dd('0x11'),_0x30d471,_0x4e9333[_0x10dd('0xf')]['id']);})[_0x10dd('0x12')](function(_0x161f00){logger[_0x10dd('0x13')](_0x10dd('0x14'),_0x30d471,JSON['stringify'](_0x161f00));})[_0x10dd('0x15')](function(){_0xddd4a3['stop']();});}}catch(_0x32e9a3){logger[_0x10dd('0x13')]('[%s][CLOSE]\x20%s',_0x30d471,JSON[_0x10dd('0x16')](_0x32e9a3));_0xddd4a3[_0x10dd('0x17')]();}};}; \ No newline at end of file +var _0x82e2=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x3f248c,_0x3260f4){var _0x40eaff=function(_0x1a98d5){while(--_0x1a98d5){_0x3f248c['push'](_0x3f248c['shift']());}};_0x40eaff(++_0x3260f4);}(_0x82e2,0x151));var _0x282e=function(_0x57e9a0,_0x24b43a){_0x57e9a0=_0x57e9a0-0x0;var _0x3c0c39=_0x82e2[_0x57e9a0];return _0x3c0c39;};'use strict';var moment=require(_0x282e('0x0'));var logger=require(_0x282e('0x1'))(_0x282e('0x2'));var rpc={'chatInteraction':require(_0x282e('0x3')),'openchannelInteraction':require(_0x282e('0x4')),'smsInteraction':require(_0x282e('0x5')),'mailInteraction':require(_0x282e('0x6')),'faxInteraction':require(_0x282e('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x282e('0x8')]=function(_0x481c7c,_0x7264c8,_0x423d66,_0x5c3562){return function(_0x48ee81){try{logger['info'](_0x282e('0x9'),_0x481c7c,_0x7264c8[0x0]);var _0x477a53={'closed':0x1,'closedAt':moment()[_0x282e('0xa')](_0x282e('0xb')),'closeReason':_0x282e('0xc'),'disposition':_0x7264c8[0x0]};if(rpc[_0x5c3562[_0x282e('0xd')]+_0x282e('0xe')]){rpc[_0x5c3562['channel']+_0x282e('0xe')][_0x282e('0xf')](_0x5c3562['interaction']['id'],_0x477a53)[_0x282e('0x10')](function(_0x4b53c1){logger[_0x282e('0x11')](_0x282e('0x12'),_0x481c7c,_0x5c3562[_0x282e('0x13')]['id']);})[_0x282e('0x14')](function(_0x35179a){logger[_0x282e('0x15')](_0x282e('0x16'),_0x481c7c,JSON[_0x282e('0x17')](_0x35179a));})[_0x282e('0x18')](function(){_0x48ee81[_0x282e('0x19')]();});}}catch(_0x42d59d){logger[_0x282e('0x15')]('[%s][CLOSE]\x20%s',_0x481c7c,JSON['stringify'](_0x42d59d));_0x48ee81[_0x282e('0x19')]();}};}; \ 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 95c5ca1..9d0fb72 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 _0x8506=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','providerResponse','metadata','endConversation','catch','moment','md5','../../../../config/logger'];(function(_0x1e3332,_0x2f9833){var _0x197179=function(_0xb6229f){while(--_0xb6229f){_0x1e3332['push'](_0x1e3332['shift']());}};_0x197179(++_0x2f9833);}(_0x8506,0xe8));var _0x6850=function(_0x1c4e0b,_0x1948d9){_0x1c4e0b=_0x1c4e0b-0x0;var _0x256e27=_0x8506[_0x1c4e0b];return _0x256e27;};'use strict';var _=require('lodash');var moment=require(_0x6850('0x0'));var apiai=require('apiai-promise');var md5=require(_0x6850('0x1'));var utils=require('./utils');var logger=require(_0x6850('0x2'))('routing');var rpc={'chatMessage':require(_0x6850('0x3')),'openchannelMessage':require(_0x6850('0x4')),'mailMessage':require(_0x6850('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6850('0x6')),'whatsappMessage':require(_0x6850('0x7'))};exports[_0x6850('0x8')]=function(_0x3c301f,_0x5858ca){return function(_0x51c0ad){try{if(!_['isNil'](this[_0x6850('0x9')][_0x6850('0xa')])){logger[_0x6850('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x3c301f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x51c0ad[_0x6850('0xc')]();}var _0x209aa2={'ContactId':this[_0x6850('0xd')]['id'],'sentAt':moment()[_0x6850('0xe')](_0x6850('0xf')),'direction':'out'};if(this[_0x6850('0x10')]===_0x6850('0x11')||this[_0x6850('0x10')]===_0x6850('0x12')){_0x209aa2[_0x6850('0x13')]=this[_0x6850('0x9')]['phone'];}var _0x44d3da=this[_0x6850('0x10')];if(_0x44d3da===_0x6850('0x14')){_0x209aa2[_0x6850('0x15')]=this[_0x6850('0x16')]['id'];}else{_0x209aa2[_[_0x6850('0x17')](_0x44d3da)+'AccountId']=this[_0x6850('0x16')]['id'];}_0x209aa2[_['upperFirst'](_0x44d3da)+_0x6850('0x18')]=this[_0x6850('0x9')]['id'];if(this[_0x6850('0x9')][_0x6850('0x19')]){var _0x145baf=_0x5858ca[0x2];if(!_[_0x6850('0x1a')](_0x145baf)){_0x209aa2[_0x6850('0x1b')]=utils[_0x6850('0x1c')](_0x145baf,this);return rpc[_0x44d3da+_0x6850('0x1d')][_0x6850('0x1e')](_0x209aa2)[_0x6850('0x1f')](function(_0x145dbb){logger[_0x6850('0xb')](_0x6850('0x20'),_0x3c301f,_0x209aa2['body']);})['catch'](function(_0x76764b){logger[_0x6850('0x21')](_0x6850('0x20'),_0x3c301f,JSON[_0x6850('0x22')](_0x76764b));})[_0x6850('0x23')](function(){logger[_0x6850('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3c301f);_0x51c0ad[_0x6850('0x24')]();});}else{logger[_0x6850('0xb')](_0x6850('0x25'),_0x3c301f);_0x51c0ad[_0x6850('0x24')]();}}else{var _0x2978a1=this;var _0x173537=apiai(_0x5858ca[0x0],{'language':_0x5858ca[0x1]||'en'});return _0x173537[_0x6850('0x26')](this[_0x6850('0x27')][_0x6850('0x1b')],{'sessionId':md5(this[_0x6850('0x9')]['id'])})[_0x6850('0x1f')](function(_0x15ab81){_0x2978a1[_0x6850('0x1b')][_0x6850('0x28')]=_0x15ab81;_0x209aa2[_0x6850('0x1b')]=_0x15ab81[_0x6850('0x29')]['fulfillment'][_0x6850('0x2a')];_0x209aa2['providerName']='dialogflow';_0x209aa2[_0x6850('0x2b')]=JSON[_0x6850('0x22')](_0x15ab81);return rpc[_0x44d3da+_0x6850('0x1d')][_0x6850('0x1e')](_0x209aa2)['then'](function(_0x13fc09){logger[_0x6850('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x3c301f,_0x209aa2[_0x6850('0x1b')]);if(_0x15ab81[_0x6850('0x29')][_0x6850('0x2c')][_0x6850('0x2d')]){_0x51c0ad['next']();}else{_0x51c0ad[_0x6850('0x24')]();}})[_0x6850('0x2e')](function(_0x51cd4c){logger['error'](_0x6850('0x20'),_0x3c301f,JSON[_0x6850('0x22')](_0x51cd4c));_0x51c0ad['next']();});})[_0x6850('0x2e')](function(_0x185f64){logger[_0x6850('0x21')](_0x6850('0x20'),_0x3c301f,_0x185f64[_0x6850('0x27')]);_0x51c0ad[_0x6850('0xc')]();});}}catch(_0x33e47b){logger[_0x6850('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x3c301f,JSON['stringify'](_0x33e47b));_0x51c0ad[_0x6850('0x24')]();}};}; \ No newline at end of file +var _0x34f0=['format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','getMustacheRender','create','info','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!','message','then','dialogflow','fulfillment','speech','providerName','Message','result','metadata','endConversation','next','lodash','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][DIALOGFLOW]\x20%s','contact'];(function(_0x336b7f,_0x27761c){var _0x268c0d=function(_0x3b73d1){while(--_0x3b73d1){_0x336b7f['push'](_0x336b7f['shift']());}};_0x268c0d(++_0x27761c);}(_0x34f0,0x13b));var _0x034f=function(_0x45a515,_0x1be9d0){_0x45a515=_0x45a515-0x0;var _0x2d19fb=_0x34f0[_0x45a515];return _0x2d19fb;};'use strict';var _=require(_0x034f('0x0'));var moment=require(_0x034f('0x1'));var apiai=require('apiai-promise');var md5=require(_0x034f('0x2'));var utils=require('./utils');var logger=require(_0x034f('0x3'))(_0x034f('0x4'));var rpc={'chatMessage':require(_0x034f('0x5')),'openchannelMessage':require(_0x034f('0x6')),'mailMessage':require(_0x034f('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x034f('0x8')),'whatsappMessage':require(_0x034f('0x9'))};exports['consequence']=function(_0x18f23b,_0x4d03a0){return function(_0x3994a0){try{if(!_[_0x034f('0xa')](this[_0x034f('0xb')]['UserId'])){logger['info'](_0x034f('0xc'),_0x18f23b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3994a0['next']();}var _0x453bc2={'ContactId':this[_0x034f('0xd')]['id'],'sentAt':moment()[_0x034f('0xe')](_0x034f('0xf')),'direction':_0x034f('0x10')};if(this['channel']===_0x034f('0x11')||this[_0x034f('0x12')]===_0x034f('0x13')){_0x453bc2['phone']=this[_0x034f('0xb')]['phone'];}var _0x1f314c=this[_0x034f('0x12')];if(_0x1f314c===_0x034f('0x14')){_0x453bc2[_0x034f('0x15')]=this[_0x034f('0x16')]['id'];}else{_0x453bc2[_[_0x034f('0x17')](_0x1f314c)+_0x034f('0x18')]=this[_0x034f('0x16')]['id'];}_0x453bc2[_['upperFirst'](_0x1f314c)+'InteractionId']=this[_0x034f('0xb')]['id'];if(this[_0x034f('0xb')][_0x034f('0x19')]){var _0x4dc835=_0x4d03a0[0x2];if(!_['isEmpty'](_0x4dc835)){_0x453bc2[_0x034f('0x1a')]=utils[_0x034f('0x1b')](_0x4dc835,this);return rpc[_0x1f314c+'Message'][_0x034f('0x1c')](_0x453bc2)['then'](function(_0x8500cb){logger[_0x034f('0x1d')](_0x034f('0xc'),_0x18f23b,_0x453bc2['body']);})[_0x034f('0x1e')](function(_0x381727){logger[_0x034f('0x1f')](_0x034f('0xc'),_0x18f23b,JSON[_0x034f('0x20')](_0x381727));})['finally'](function(){logger[_0x034f('0x1d')](_0x034f('0x21'),_0x18f23b);_0x3994a0[_0x034f('0x22')]();});}else{logger['info'](_0x034f('0x23'),_0x18f23b);_0x3994a0[_0x034f('0x22')]();}}else{var _0xaeb946=this;var _0x4f836a=apiai(_0x4d03a0[0x0],{'language':_0x4d03a0[0x1]||'en'});return _0x4f836a['textRequest'](this[_0x034f('0x24')]['body'],{'sessionId':md5(this[_0x034f('0xb')]['id'])})[_0x034f('0x25')](function(_0x33d2cc){_0xaeb946[_0x034f('0x1a')][_0x034f('0x26')]=_0x33d2cc;_0x453bc2[_0x034f('0x1a')]=_0x33d2cc['result'][_0x034f('0x27')][_0x034f('0x28')];_0x453bc2[_0x034f('0x29')]=_0x034f('0x26');_0x453bc2['providerResponse']=JSON[_0x034f('0x20')](_0x33d2cc);return rpc[_0x1f314c+_0x034f('0x2a')][_0x034f('0x1c')](_0x453bc2)['then'](function(_0xa1dd7e){logger[_0x034f('0x1d')](_0x034f('0xc'),_0x18f23b,_0x453bc2[_0x034f('0x1a')]);if(_0x33d2cc[_0x034f('0x2b')][_0x034f('0x2c')][_0x034f('0x2d')]){_0x3994a0[_0x034f('0x2e')]();}else{_0x3994a0[_0x034f('0x22')]();}})[_0x034f('0x1e')](function(_0x17d5f6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x18f23b,JSON[_0x034f('0x20')](_0x17d5f6));_0x3994a0['next']();});})['catch'](function(_0x5ea15a){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x18f23b,_0x5ea15a['message']);_0x3994a0[_0x034f('0x2e')]();});}}catch(_0x502d3e){logger[_0x034f('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x18f23b,JSON[_0x034f('0x20')](_0x502d3e));_0x3994a0['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 51127fa..98ccbef 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 _0x3772=['providerResponse','fulfillmentText','dialogflow','md5','moment','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','getMustacheRender','catch','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x3772,0x84));var _0x2377=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x3772[_0x3374fd];return _0xb10792;};'use strict';var _=require('lodash');var dialogflow=require(_0x2377('0x0'));var md5=require(_0x2377('0x1'));var moment=require(_0x2377('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x2377('0x3'));var utils=require(_0x2377('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2377('0x5')),'mailMessage':require(_0x2377('0x6')),'smsMessage':require(_0x2377('0x7')),'faxMessage':require(_0x2377('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x322d79,_0x207e76,_0x1e2145,_0x5b0a04){return new Promise(function(_0x33d73a,_0x1b32c1){var _0x5c809f=_[_0x2377('0x9')](_0x1e2145);_0x5c809f[_0x2377('0xa')]=_0x5b0a04;return rpc[_0x207e76+_0x2377('0xb')][_0x2377('0xc')](_0x5c809f)[_0x2377('0xd')](function(){logger[_0x2377('0xe')](_0x2377('0xf'),_0x322d79,_0x5c809f['body']);_0x33d73a();})['catch'](function(_0x4fa9e1){logger[_0x2377('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x322d79,JSON[_0x2377('0x11')](_0x4fa9e1));_0x1b32c1(_0x4fa9e1);});});}exports[_0x2377('0x12')]=function(_0x23da2c,_0x4cd8fd){return function(_0x24f22d){try{if(!_['isNil'](this['interaction'][_0x2377('0x13')])){logger['info'](_0x2377('0xf'),_0x23da2c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x24f22d[_0x2377('0x14')]();}var _0x4a0a1c={'ContactId':this[_0x2377('0x15')]['id'],'sentAt':moment()['format'](_0x2377('0x16')),'direction':_0x2377('0x17')};if(this[_0x2377('0x18')]===_0x2377('0x19')||this[_0x2377('0x18')]==='whatsapp'){_0x4a0a1c[_0x2377('0x1a')]=this['interaction']['phone'];}var _0x49f9ff=this[_0x2377('0x18')];if(_0x49f9ff===_0x2377('0x1b')){_0x4a0a1c[_0x2377('0x1c')]=this[_0x2377('0x1d')]['id'];}else{_0x4a0a1c[_[_0x2377('0x1e')](_0x49f9ff)+_0x2377('0x1f')]=this['account']['id'];}_0x4a0a1c[_['upperFirst'](_0x49f9ff)+'InteractionId']=this['interaction']['id'];if(this[_0x2377('0x20')]['created']){var _0x1fd9fd=_0x4cd8fd[0x4];if(!_['isEmpty'](_0x1fd9fd)){_0x4a0a1c[_0x2377('0xa')]=utils[_0x2377('0x21')](_0x1fd9fd,this);return rpc[_0x49f9ff+_0x2377('0xb')]['create'](_0x4a0a1c)[_0x2377('0xd')](function(_0x13d860){logger['info'](_0x2377('0xf'),_0x23da2c,_0x4a0a1c[_0x2377('0xa')]);})[_0x2377('0x22')](function(_0x719b2){logger[_0x2377('0x10')](_0x2377('0xf'),_0x23da2c,JSON[_0x2377('0x11')](_0x719b2));})[_0x2377('0x23')](function(){logger[_0x2377('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x23da2c);_0x24f22d[_0x2377('0x24')]();});}else{logger[_0x2377('0xe')](_0x2377('0x25'),_0x23da2c);_0x24f22d[_0x2377('0x24')]();}}else{var _0x42e046=this;var _0x338134=_0x4cd8fd[0x2][_0x2377('0x26')](/\\n/g,'\x0a');var _0x23fdfb={'credentials':{'private_key':_0x338134,'client_email':_0x4cd8fd[0x1]}};var _0x29e198=new dialogflow[(_0x2377('0x27'))](_0x23fdfb);var _0xcc6c2b=_0x29e198[_0x2377('0x28')](_0x4cd8fd[0x0],md5(_0x42e046['interaction']['id']));var _0x32540d={'session':_0xcc6c2b,'queryInput':{'text':{'text':_0x42e046[_0x2377('0x29')][_0x2377('0xa')],'languageCode':_0x4cd8fd[0x3]||'en'}}};return _0x29e198['detectIntent'](_0x32540d)[_0x2377('0xd')](function(_0x48976d){if(_0x48976d&&_0x48976d[_0x2377('0x2a')]){_0x42e046[_0x2377('0xa')][_0x2377('0x2b')]=_0x48976d;var _0x5311a6=_0x48976d[0x0];var _0x8fd301=_0x5311a6[_0x2377('0x2c')][_0x2377('0x2d')]&&_0x5311a6[_0x2377('0x2c')][_0x2377('0x2d')][_0x2377('0x2e')]?_0x5311a6[_0x2377('0x2c')][_0x2377('0x2d')][_0x2377('0x2e')]['end_conversation'][_0x2377('0x2f')]:![];_0x42e046[_0x2377('0xa')][_0x2377('0x30')]=_0x5311a6[_0x2377('0x2c')][_0x2377('0x31')];_0x42e046[_0x2377('0xa')][_0x2377('0x32')]=_0x5311a6['queryResult'][_0x2377('0x33')];_0x42e046[_0x2377('0xa')][_0x2377('0x34')]=_0x5311a6[_0x2377('0x2c')]['diagnosticInfo']&&_0x5311a6[_0x2377('0x2c')][_0x2377('0x2d')][_0x2377('0x2e')]?_0x5311a6['queryResult']['diagnosticInfo'][_0x2377('0x2e')][_0x2377('0x35')]['boolValue']:![];_0x42e046['body'][_0x2377('0x36')]=_0x5311a6['queryResult'][_0x2377('0x37')][_0x2377('0x38')];_0x42e046[_0x2377('0xa')][_0x2377('0x39')]=_0x5311a6[_0x2377('0x2c')]['intent']['displayName'];_0x42e046[_0x2377('0xa')][_0x2377('0x3a')]=_0x5311a6['queryResult'][_0x2377('0x37')][_0x2377('0x3b')];_0x42e046[_0x2377('0xa')][_0x2377('0x3c')]=_0x5311a6['queryResult']['languageCode'];_0x42e046[_0x2377('0xa')][_0x2377('0x3d')]=_0x5311a6[_0x2377('0x2c')]['queryText'];_0x42e046['body'][_0x2377('0x3e')]=_0x5311a6[_0x2377('0x2c')]['intentDetectionConfidence'];_0x4a0a1c['providerName']=_0x2377('0x2b');_0x4a0a1c[_0x2377('0x3f')]=JSON[_0x2377('0x11')](_0x48976d);var _0x1b9bdc=[];for(var _0x3d792b=0x0;_0x3d792b<_0x48976d['length'];_0x3d792b++){var _0x12e987=_0x48976d[_0x3d792b];if(_0x12e987&&_0x12e987[_0x2377('0x2c')]&&_0x12e987['queryResult'][_0x2377('0x40')]){_0x1b9bdc['push'](createMessage(_0x23da2c,_0x49f9ff,_0x4a0a1c,_0x12e987[_0x2377('0x2c')][_0x2377('0x40')]));}}return Promise['all'](_0x1b9bdc)[_0x2377('0xd')](function(){if(_0x8fd301){_0x24f22d[_0x2377('0x14')]();}else{_0x24f22d[_0x2377('0x24')]();}})[_0x2377('0x22')](function(_0x76422c){logger[_0x2377('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x23da2c,JSON[_0x2377('0x11')](_0x76422c));_0x24f22d['next']();});}})[_0x2377('0x22')](function(_0x64796b){logger[_0x2377('0x10')](_0x2377('0xf'),_0x23da2c,_0x64796b['message'],_0x64796b['stack']);_0x24f22d[_0x2377('0x14')]();});}}catch(_0x3eb8d2){logger[_0x2377('0x10')](_0x2377('0xf'),_0x23da2c,JSON[_0x2377('0x11')](_0x3eb8d2));_0x24f22d[_0x2377('0x24')]();}};}; \ No newline at end of file +var _0x18cf=['DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','next','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback'];(function(_0x520ef8,_0x48bfb6){var _0x39c59e=function(_0x515a2e){while(--_0x515a2e){_0x520ef8['push'](_0x520ef8['shift']());}};_0x39c59e(++_0x48bfb6);}(_0x18cf,0x1ae));var _0xf18c=function(_0x253ea9,_0x2f0711){_0x253ea9=_0x253ea9-0x0;var _0x40850a=_0x18cf[_0x253ea9];return _0x40850a;};'use strict';var _=require(_0xf18c('0x0'));var dialogflow=require(_0xf18c('0x1'));var md5=require(_0xf18c('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xf18c('0x3'))(_0xf18c('0x4'));var utils=require(_0xf18c('0x5'));var rpc={'chatMessage':require(_0xf18c('0x6')),'openchannelMessage':require(_0xf18c('0x7')),'mailMessage':require(_0xf18c('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf18c('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x172f91,_0x34bf18,_0x11b343,_0x45ee13){return new Promise(function(_0x277e6e,_0x2a037a){var _0x5a00d1=_[_0xf18c('0xa')](_0x11b343);_0x5a00d1['body']=_0x45ee13;return rpc[_0x34bf18+_0xf18c('0xb')][_0xf18c('0xc')](_0x5a00d1)[_0xf18c('0xd')](function(){logger[_0xf18c('0xe')](_0xf18c('0xf'),_0x172f91,_0x5a00d1[_0xf18c('0x10')]);_0x277e6e();})[_0xf18c('0x11')](function(_0x56259c){logger[_0xf18c('0x12')](_0xf18c('0xf'),_0x172f91,JSON[_0xf18c('0x13')](_0x56259c));_0x2a037a(_0x56259c);});});}exports[_0xf18c('0x14')]=function(_0x593e81,_0x5e8617){return function(_0x48d070){try{if(!_['isNil'](this['interaction'][_0xf18c('0x15')])){logger[_0xf18c('0xe')](_0xf18c('0xf'),_0x593e81,_0xf18c('0x16'));return _0x48d070['next']();}var _0x4947a7={'ContactId':this[_0xf18c('0x17')]['id'],'sentAt':moment()[_0xf18c('0x18')](_0xf18c('0x19')),'direction':_0xf18c('0x1a')};if(this[_0xf18c('0x1b')]===_0xf18c('0x1c')||this[_0xf18c('0x1b')]===_0xf18c('0x1d')){_0x4947a7[_0xf18c('0x1e')]=this['interaction']['phone'];}var _0x564ab0=this['channel'];if(_0x564ab0===_0xf18c('0x1f')){_0x4947a7[_0xf18c('0x20')]=this[_0xf18c('0x21')]['id'];}else{_0x4947a7[_[_0xf18c('0x22')](_0x564ab0)+_0xf18c('0x23')]=this[_0xf18c('0x21')]['id'];}_0x4947a7[_[_0xf18c('0x22')](_0x564ab0)+_0xf18c('0x24')]=this['interaction']['id'];if(this['interaction']['created']){var _0x1e2d4b=_0x5e8617[0x4];if(!_[_0xf18c('0x25')](_0x1e2d4b)){_0x4947a7[_0xf18c('0x10')]=utils[_0xf18c('0x26')](_0x1e2d4b,this);return rpc[_0x564ab0+_0xf18c('0xb')][_0xf18c('0xc')](_0x4947a7)[_0xf18c('0xd')](function(_0x2dc519){logger['info'](_0xf18c('0xf'),_0x593e81,_0x4947a7[_0xf18c('0x10')]);})[_0xf18c('0x11')](function(_0x387e40){logger[_0xf18c('0x12')](_0xf18c('0xf'),_0x593e81,JSON['stringify'](_0x387e40));})[_0xf18c('0x27')](function(){logger['info'](_0xf18c('0x28'),_0x593e81);_0x48d070[_0xf18c('0x29')]();});}else{logger[_0xf18c('0xe')](_0xf18c('0x2a'),_0x593e81);_0x48d070[_0xf18c('0x29')]();}}else{var _0x48d6be=this;var _0x13857=_0x5e8617[0x2]['replace'](/\\n/g,'\x0a');var _0x5bbf5d={'credentials':{'private_key':_0x13857,'client_email':_0x5e8617[0x1]}};var _0x2787b7=new dialogflow['SessionsClient'](_0x5bbf5d);var _0x1eab62=_0x2787b7[_0xf18c('0x2b')](_0x5e8617[0x0],md5(_0x48d6be['interaction']['id']));var _0x8645f5={'session':_0x1eab62,'queryInput':{'text':{'text':_0x48d6be[_0xf18c('0x2c')]['body'],'languageCode':_0x5e8617[0x3]||'en'}}};return _0x2787b7['detectIntent'](_0x8645f5)[_0xf18c('0xd')](function(_0x175660){if(_0x175660&&_0x175660[_0xf18c('0x2d')]){_0x48d6be[_0xf18c('0x10')][_0xf18c('0x2e')]=_0x175660;var _0x3822c5=_0x175660[0x0];var _0x1a85e8=_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x30')]&&_0x3822c5['queryResult'][_0xf18c('0x30')][_0xf18c('0x31')]?_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x30')][_0xf18c('0x31')][_0xf18c('0x32')][_0xf18c('0x33')]:![];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x34')]=_0x3822c5[_0xf18c('0x2f')]['action'];_0x48d6be[_0xf18c('0x10')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3822c5[_0xf18c('0x2f')]['allRequiredParamsPresent'];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x35')]=_0x3822c5[_0xf18c('0x2f')]['diagnosticInfo']&&_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x30')][_0xf18c('0x31')]?_0x3822c5[_0xf18c('0x2f')]['diagnosticInfo'][_0xf18c('0x31')][_0xf18c('0x32')][_0xf18c('0x33')]:![];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x36')]=_0x3822c5['queryResult'][_0xf18c('0x37')][_0xf18c('0x38')];_0x48d6be['body'][_0xf18c('0x39')]=_0x3822c5['queryResult']['intent']['displayName'];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x3a')]=_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x37')][_0xf18c('0x3b')];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x3c')]=_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x3d')];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x3e')]=_0x3822c5[_0xf18c('0x2f')]['queryText'];_0x48d6be[_0xf18c('0x10')][_0xf18c('0x3f')]=_0x3822c5[_0xf18c('0x2f')][_0xf18c('0x40')];_0x4947a7[_0xf18c('0x41')]='dialogflowV2';_0x4947a7[_0xf18c('0x42')]=JSON[_0xf18c('0x13')](_0x175660);var _0x514ce6=[];for(var _0x14c0d7=0x0;_0x14c0d7<_0x175660[_0xf18c('0x2d')];_0x14c0d7++){var _0x2f8b75=_0x175660[_0x14c0d7];if(_0x2f8b75&&_0x2f8b75['queryResult']&&_0x2f8b75[_0xf18c('0x2f')][_0xf18c('0x43')]){_0x514ce6[_0xf18c('0x44')](createMessage(_0x593e81,_0x564ab0,_0x4947a7,_0x2f8b75['queryResult'][_0xf18c('0x43')]));}}return Promise['all'](_0x514ce6)['then'](function(){if(_0x1a85e8){_0x48d070[_0xf18c('0x45')]();}else{_0x48d070[_0xf18c('0x29')]();}})[_0xf18c('0x11')](function(_0x4f16d1){logger[_0xf18c('0x12')](_0xf18c('0xf'),_0x593e81,JSON[_0xf18c('0x13')](_0x4f16d1));_0x48d070[_0xf18c('0x45')]();});}})[_0xf18c('0x11')](function(_0x23c379){logger[_0xf18c('0x12')](_0xf18c('0xf'),_0x593e81,_0x23c379['message'],_0x23c379['stack']);_0x48d070[_0xf18c('0x45')]();});}}catch(_0xafa038){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x593e81,JSON[_0xf18c('0x13')](_0xafa038));_0x48d070[_0xf18c('0x29')]();}};}; \ 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 1a744f3..66fdccd 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 _0x2601=['[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','error','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length'];(function(_0x1d9283,_0x2f3703){var _0x4b3d9f=function(_0xd839c2){while(--_0xd839c2){_0x1d9283['push'](_0x1d9283['shift']());}};_0x4b3d9f(++_0x2f3703);}(_0x2601,0xb8));var _0x1260=function(_0x33055f,_0x24cf57){_0x33055f=_0x33055f-0x0;var _0x8dae2e=_0x2601[_0x33055f];return _0x8dae2e;};'use strict';var schema=require(_0x1260('0x0'));var _=require(_0x1260('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x1260('0x2'));var logger=require(_0x1260('0x3'))(_0x1260('0x4'));var gotoif=schema({'condition':{'type':_0x1260('0x5'),'required':!![],'message':_0x1260('0x6')},'priorityTrue':{'type':_0x1260('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x1260('0x7'),'message':_0x1260('0x8')}});exports[_0x1260('0x9')]=function(_0x23b3ad,_0x4984a8){return function(_0x2c5f4a){try{var _0x2e0ce9={'condition':htmlToText[_0x1260('0xa')](utils['getMustacheRender'](_0x4984a8[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4984a8[0x1],'priorityFalse':_0x4984a8[0x2]};var _0x2e8d34=gotoif[_0x1260('0x0')](_0x2e0ce9,{'typecast':!![]});if(_0x2e8d34[_0x1260('0xb')]){logger['error'](_0x1260('0xc'),_0x23b3ad,_[_0x1260('0xd')](_0x2e8d34,'message')[_0x1260('0xe')](',\x20'));_0x2c5f4a[_0x1260('0xf')]();}else{try{var _0x364167=eval('('+_0x2e0ce9['condition']+')');var _0x3ff2f2=_0x364167?_0x2e0ce9[_0x1260('0x10')]:_0x2e0ce9[_0x1260('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x23b3ad,_0x2e0ce9['condition'],_0x364167,_0x3ff2f2||_0x1260('0x12'));if(_0x3ff2f2){var _0x4238df=_[_0x1260('0x13')](_0x2c5f4a[_0x1260('0x14')](),{'p':_0x3ff2f2});if(_0x4238df>=0x0){logger[_0x1260('0x15')](_0x1260('0x16'),_0x23b3ad,_0x3ff2f2||'next',_0x4238df);_0x2c5f4a[_0x1260('0x12')](_0x4238df);}else{logger[_0x1260('0x15')](_0x1260('0x17'),_0x23b3ad,_0x3ff2f2||_0x1260('0x12'));_0x2c5f4a[_0x1260('0xf')]();}}else{_0x2c5f4a['next']();}}catch(_0x1fc167){logger['error'](_0x1260('0x18'),_0x23b3ad,_0x1fc167[_0x1260('0x19')]);_0x2c5f4a[_0x1260('0xf')]();}}}catch(_0x18e9ca){logger[_0x1260('0x1a')]('[%s][GOTOIF]\x20%s',_0x23b3ad,JSON[_0x1260('0x1b')](_0x18e9ca));_0x2c5f4a['stop']();}};}; \ No newline at end of file +var _0x9497=['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]\x20eval\x20error:\x20%s','stringify','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse'];(function(_0x1bed81,_0x4b326a){var _0x2ac7ac=function(_0x3ce991){while(--_0x3ce991){_0x1bed81['push'](_0x1bed81['shift']());}};_0x2ac7ac(++_0x4b326a);}(_0x9497,0x1d4));var _0x7949=function(_0x5a2b63,_0x5df7fd){_0x5a2b63=_0x5a2b63-0x0;var _0x155328=_0x9497[_0x5a2b63];return _0x155328;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x7949('0x0'));var utils=require('./utils');var logger=require(_0x7949('0x1'))(_0x7949('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7949('0x3')},'priorityTrue':{'type':_0x7949('0x4'),'message':_0x7949('0x5')},'priorityFalse':{'type':_0x7949('0x4'),'message':_0x7949('0x6')}});exports['consequence']=function(_0x1239d9,_0x3bc13b){return function(_0x36d840){try{var _0x428179={'condition':htmlToText[_0x7949('0x7')](utils[_0x7949('0x8')](_0x3bc13b[0x0],this),{'wordwrap':![]})[_0x7949('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3bc13b[0x1],'priorityFalse':_0x3bc13b[0x2]};var _0x181fba=gotoif[_0x7949('0xa')](_0x428179,{'typecast':!![]});if(_0x181fba[_0x7949('0xb')]){logger['error'](_0x7949('0xc'),_0x1239d9,_[_0x7949('0xd')](_0x181fba,_0x7949('0xe'))[_0x7949('0xf')](',\x20'));_0x36d840[_0x7949('0x10')]();}else{try{var _0x544d95=eval('('+_0x428179['condition']+')');var _0x4a7648=_0x544d95?_0x428179['priorityTrue']:_0x428179[_0x7949('0x11')];logger[_0x7949('0x12')](_0x7949('0x13'),_0x1239d9,_0x428179[_0x7949('0x14')],_0x544d95,_0x4a7648||_0x7949('0x15'));if(_0x4a7648){var _0x33c473=_[_0x7949('0x16')](_0x36d840[_0x7949('0x17')](),{'p':_0x4a7648});if(_0x33c473>=0x0){logger['info'](_0x7949('0x18'),_0x1239d9,_0x4a7648||_0x7949('0x15'),_0x33c473);_0x36d840[_0x7949('0x15')](_0x33c473);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1239d9,_0x4a7648||'next');_0x36d840[_0x7949('0x10')]();}}else{_0x36d840[_0x7949('0x15')]();}}catch(_0x426fe9){logger['error'](_0x7949('0x19'),_0x1239d9,_0x426fe9[_0x7949('0xe')]);_0x36d840[_0x7949('0x10')]();}}}catch(_0x48d2ac){logger['error'](_0x7949('0xc'),_0x1239d9,JSON[_0x7949('0x1a')](_0x48d2ac));_0x36d840[_0x7949('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 a3efc86..e7be137 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 _0x4972=['message','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x4972,0x1a0));var _0x2497=function(_0x395e0a,_0x424096){_0x395e0a=_0x395e0a-0x0;var _0x355428=_0x4972[_0x395e0a];return _0x355428;};'use strict';var schema=require(_0x2497('0x0'));var _=require(_0x2497('0x1'));var logger=require(_0x2497('0x2'))('routing');var gotop=schema({'priority':{'type':_0x2497('0x3'),'required':!![],'message':_0x2497('0x4')}});exports[_0x2497('0x5')]=function(_0x215527,_0x2f8999){return function(_0x548b11){try{var _0x5cb4f8={'priority':_0x2f8999[0x0]};var _0x1392a8=gotop['validate'](_0x5cb4f8,{'typecast':!![]});if(_0x1392a8[_0x2497('0x6')]){logger[_0x2497('0x7')]('[%s][GOTOP]\x20%s',_0x215527,_[_0x2497('0x8')](_0x1392a8,_0x2497('0x9'))['join'](',\x20'));_0x548b11['stop']();}else{logger[_0x2497('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x215527,_0x5cb4f8[_0x2497('0xb')]);if(_0x5cb4f8['priority']){var _0x2b348e=_[_0x2497('0xc')](_0x548b11['rules'](),{'p':_0x5cb4f8[_0x2497('0xb')]});if(_0x2b348e>=0x0){logger['info'](_0x2497('0xd'),_0x215527,_0x5cb4f8[_0x2497('0xb')]||_0x2497('0xe'),_0x2b348e);_0x548b11[_0x2497('0xe')](_0x2b348e);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x215527,_0x5cb4f8[_0x2497('0xb')]||_0x2497('0xe'));_0x548b11[_0x2497('0xf')]();}}else{_0x548b11[_0x2497('0xe')]();}}}catch(_0x21bd20){logger[_0x2497('0x7')]('[%s][GOTOP]\x20%s',_0x215527,JSON[_0x2497('0x10')](_0x21bd20));_0x548b11[_0x2497('0xf')]();}};}; \ No newline at end of file +var _0xf5b2=['info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next'];(function(_0x291a3c,_0x3507bd){var _0x3e903c=function(_0x4224c0){while(--_0x4224c0){_0x291a3c['push'](_0x291a3c['shift']());}};_0x3e903c(++_0x3507bd);}(_0xf5b2,0x1ce));var _0x2f5b=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xf5b2[_0x5d80de];return _0x1c7556;};'use strict';var schema=require(_0x2f5b('0x0'));var _=require('lodash');var logger=require(_0x2f5b('0x1'))(_0x2f5b('0x2'));var gotop=schema({'priority':{'type':_0x2f5b('0x3'),'required':!![],'message':_0x2f5b('0x4')}});exports['consequence']=function(_0x35a6cf,_0x4140d8){return function(_0x1a4c9c){try{var _0x448921={'priority':_0x4140d8[0x0]};var _0x1c8f12=gotop[_0x2f5b('0x0')](_0x448921,{'typecast':!![]});if(_0x1c8f12[_0x2f5b('0x5')]){logger['error'](_0x2f5b('0x6'),_0x35a6cf,_['map'](_0x1c8f12,_0x2f5b('0x7'))['join'](',\x20'));_0x1a4c9c[_0x2f5b('0x8')]();}else{logger['info'](_0x2f5b('0x9'),_0x35a6cf,_0x448921['priority']);if(_0x448921[_0x2f5b('0xa')]){var _0x308430=_[_0x2f5b('0xb')](_0x1a4c9c[_0x2f5b('0xc')](),{'p':_0x448921['priority']});if(_0x308430>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x35a6cf,_0x448921[_0x2f5b('0xa')]||_0x2f5b('0xd'),_0x308430);_0x1a4c9c[_0x2f5b('0xd')](_0x308430);}else{logger[_0x2f5b('0xe')](_0x2f5b('0xf'),_0x35a6cf,_0x448921[_0x2f5b('0xa')]||_0x2f5b('0xd'));_0x1a4c9c[_0x2f5b('0x8')]();}}else{_0x1a4c9c[_0x2f5b('0xd')]();}}}catch(_0x41f871){logger[_0x2f5b('0x10')]('[%s][GOTOP]\x20%s',_0x35a6cf,JSON['stringify'](_0x41f871));_0x1a4c9c[_0x2f5b('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 9f6461b..7f8ada0 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 _0xd547=['create','then','info','body','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message'];(function(_0x502a8b,_0x5e31ce){var _0x4b63c7=function(_0x5e6450){while(--_0x5e6450){_0x502a8b['push'](_0x502a8b['shift']());}};_0x4b63c7(++_0x5e31ce);}(_0xd547,0x1c1));var _0x7d54=function(_0xee1228,_0x2df586){_0xee1228=_0xee1228-0x0;var _0x210f17=_0xd547[_0xee1228];return _0x210f17;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var rpc={'chatMessage':require(_0x7d54('0x2')),'openchannelMessage':require(_0x7d54('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7d54('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7d54('0x5')]=function(_0x5b0a2c,_0x296dd6){return function(_0x37defc){try{var _0x1b7fc1={'body':utils['getMustacheRender'](_0x296dd6[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x7d54('0x6')){_0x1b7fc1[_0x7d54('0x7')]=this['account']['id'];}else{_0x1b7fc1[_[_0x7d54('0x8')](this['channel'])+_0x7d54('0x9')]=this['account']['id'];}_0x1b7fc1[_[_0x7d54('0x8')](this['channel'])+_0x7d54('0xa')]=this[_0x7d54('0xb')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0x7d54('0xc')][_0x7d54('0xd')](_0x1b7fc1)[_0x7d54('0xe')](function(_0x4be6c5){logger[_0x7d54('0xf')]('[%s][MESSAGE]\x20%s',_0x5b0a2c,_0x1b7fc1[_0x7d54('0x10')]);_0x37defc['next']();})[_0x7d54('0x11')](function(_0x43718a){logger['error'](_0x7d54('0x12'),_0x5b0a2c,JSON[_0x7d54('0x13')](_0x43718a));_0x37defc[_0x7d54('0x14')]();});}}catch(_0x5a6bec){logger[_0x7d54('0x15')](_0x7d54('0x12'),_0x5b0a2c,JSON[_0x7d54('0x13')](_0x5a6bec));_0x37defc[_0x7d54('0x14')]();}};}; \ No newline at end of file +var _0x58c8=['next','catch','error','stringify','stop','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x1908c0,_0x58205e){var _0x15d01f=function(_0x4ff73a){while(--_0x4ff73a){_0x1908c0['push'](_0x1908c0['shift']());}};_0x15d01f(++_0x58205e);}(_0x58c8,0x1d9));var _0x858c=function(_0xcf076c,_0x31c677){_0xcf076c=_0xcf076c-0x0;var _0x1f185b=_0x58c8[_0xcf076c];return _0x1f185b;};'use strict';var _=require('lodash');var utils=require(_0x858c('0x0'));var logger=require('../../../../config/logger')(_0x858c('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x858c('0x2')),'mailMessage':require(_0x858c('0x3')),'smsMessage':require(_0x858c('0x4')),'faxMessage':require(_0x858c('0x5')),'whatsappMessage':require(_0x858c('0x6'))};exports[_0x858c('0x7')]=function(_0x274124,_0xe7d1f){return function(_0x159b6d){try{var _0x44ea8e={'body':utils['getMustacheRender'](_0xe7d1f[0x0],this),'ContactId':this['contact']['id']};if(this[_0x858c('0x8')]===_0x858c('0x9')){_0x44ea8e[_0x858c('0xa')]=this[_0x858c('0xb')]['id'];}else{_0x44ea8e[_[_0x858c('0xc')](this['channel'])+_0x858c('0xd')]=this['account']['id'];}_0x44ea8e[_[_0x858c('0xc')](this[_0x858c('0x8')])+'InteractionId']=this[_0x858c('0xe')]['id'];if(rpc[this[_0x858c('0x8')]+_0x858c('0xf')]){return rpc[this['channel']+'Message'][_0x858c('0x10')](_0x44ea8e)[_0x858c('0x11')](function(_0x59a9bc){logger[_0x858c('0x12')](_0x858c('0x13'),_0x274124,_0x44ea8e[_0x858c('0x14')]);_0x159b6d[_0x858c('0x15')]();})[_0x858c('0x16')](function(_0x437a8b){logger[_0x858c('0x17')](_0x858c('0x13'),_0x274124,JSON[_0x858c('0x18')](_0x437a8b));_0x159b6d[_0x858c('0x19')]();});}}catch(_0xc1e8d7){logger['error'](_0x858c('0x13'),_0x274124,JSON[_0x858c('0x18')](_0xc1e8d7));_0x159b6d[_0x858c('0x19')]();}};}; \ 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 1834344..fc164ec 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 _0xee80=['./utils','routing','info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xee80,0x1b0));var _0x0ee8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xee80[_0x25e7cb];return _0x375d92;};'use strict';var utils=require(_0x0ee8('0x0'));var logger=require('../../../../config/logger')(_0x0ee8('0x1'));exports['consequence']=function(_0x2c0995,_0x421691){return function(_0x4ac8c8){try{logger[_0x0ee8('0x2')]('[%s][NOOP]\x20%s',_0x2c0995,utils[_0x0ee8('0x3')](_0x421691[0x0],this));_0x4ac8c8['next']();}catch(_0x365f2f){logger[_0x0ee8('0x4')](_0x0ee8('0x5'),_0x2c0995,JSON[_0x0ee8('0x6')](_0x365f2f));_0x4ac8c8[_0x0ee8('0x7')]();}};}; \ No newline at end of file +var _0x0737=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x5184fd,_0x28dbb4){var _0x28efba=function(_0x21ffe6){while(--_0x21ffe6){_0x5184fd['push'](_0x5184fd['shift']());}};_0x28efba(++_0x28dbb4);}(_0x0737,0x108));var _0x7073=function(_0x52fc48,_0x1a4563){_0x52fc48=_0x52fc48-0x0;var _0x1d45fe=_0x0737[_0x52fc48];return _0x1d45fe;};'use strict';var utils=require(_0x7073('0x0'));var logger=require(_0x7073('0x1'))(_0x7073('0x2'));exports[_0x7073('0x3')]=function(_0x3c4640,_0x2dc931){return function(_0x2777e1){try{logger[_0x7073('0x4')](_0x7073('0x5'),_0x3c4640,utils[_0x7073('0x6')](_0x2dc931[0x0],this));_0x2777e1[_0x7073('0x7')]();}catch(_0x1f6487){logger[_0x7073('0x8')](_0x7073('0x5'),_0x3c4640,JSON[_0x7073('0x9')](_0x1f6487));_0x2777e1[_0x7073('0xa')]();}};}; \ 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 05a0c5e..2141feb 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 _0xf20e=['rules','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','queue_id','account','queue','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x23fcbf,_0x52cbf9){var _0x1032d3=function(_0x4dddb4){while(--_0x4dddb4){_0x23fcbf['push'](_0x23fcbf['shift']());}};_0x1032d3(++_0x52cbf9);}(_0xf20e,0xaf));var _0xef20=function(_0x37f202,_0x178698){_0x37f202=_0x37f202-0x0;var _0x5c1aff=_0xf20e[_0x37f202];return _0x5c1aff;};'use strict';var schema=require(_0xef20('0x0'));var _=require(_0xef20('0x1'));var util=require(_0xef20('0x2'));var seqqueue=require(_0xef20('0x3'));var moment=require('moment');var Redis=require(_0xef20('0x4'));var config=require(_0xef20('0x5'));var logger=require(_0xef20('0x6'))(_0xef20('0x7'));var strategy=require('./strategy');config[_0xef20('0x8')]=_[_0xef20('0x9')](config['redis'],{'host':_0xef20('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xef20('0x8')]));var attributes=['id',_0xef20('0xb'),_0xef20('0xc'),_0xef20('0xd'),'from',_0xef20('0xe')];function emit(_0x5d10bf,_0x2dd8de,_0x1424f8){io['to'](_0x5d10bf)[_0xef20('0xf')](_0x2dd8de,_0x1424f8);}function emitChannelQueueInteraction(_0x5be06e,_0x2bf480,_0x4ddee0,_0x5f2a75,_0x5e1544,_0xd1e72,_0x45f14b,_0x372b72){var _0x26e098=_[_0xef20('0x10')](_0x4ddee0);_0x26e098[_0xef20('0xb')]=_0x372b72;_0x26e098['queue']=_0x2bf480;_0x26e098[_0xef20('0xc')]=_0x5f2a75;_0x26e098['id']=_0x5e1544;if(_0xd1e72){attributes[_0xef20('0x11')](_[_0xef20('0x12')](_0x5be06e)+_0xef20('0x13'));_0x45f14b[util['format'](_0xef20('0x14'),_0x5be06e)][_0x5e1544]=_[_0xef20('0x15')](_0x26e098,attributes);}else{delete _0x45f14b[util[_0xef20('0x16')]('%sQueuesWaitingInteractions',_0x5be06e)][_0x5e1544];}emit(util[_0xef20('0x16')]('%s:queue:%s',_0x5be06e,_0x2bf480),util[_0xef20('0x16')](_0xef20('0x17'),_0x5be06e,_0xd1e72?_0xef20('0x18'):_0xef20('0x19')),_['pick'](_0x26e098,attributes));}var rpc={'openchannelQueueReport':require(_0xef20('0x1a')),'mailQueueReport':require(_0xef20('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xef20('0x1c')),'mailInteraction':require(_0xef20('0x1d')),'openchannelInteraction':require(_0xef20('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xef20('0x1f'))};var queue=schema({'name':{'type':_0xef20('0x20'),'required':!![],'message':_0xef20('0x21')},'timeout':{'type':_0xef20('0x22'),'message':_0xef20('0x23')}});function startRouting(_0x20dcfc,_0x57f89b,_0x563c1c,_0x2c4f6c){if(_0x20dcfc&&_0x57f89b&&_0x563c1c){_0x57f89b[_0xef20('0x24')]+=0x1;var _0x51a1bc={'uniqueid':_0x20dcfc,'from':_0x563c1c[_0xef20('0x25')]?_0x563c1c[_0xef20('0x25')][_0xef20('0x26')]:'','joinAt':moment()[_0xef20('0x16')](_0xef20('0x27')),'ContactId':_0x563c1c[_0xef20('0x28')]?_0x563c1c[_0xef20('0x28')]['id']:null,'ListId':_0x563c1c[_0xef20('0x29')]?_0x563c1c[_0xef20('0x29')]['id']:null};_0x51a1bc[_[_0xef20('0x2a')](_0x563c1c[_0xef20('0x2b')])+_0xef20('0x2c')]=_0x57f89b['id']||null;_0x51a1bc[_['upperFirst'](_0x563c1c[_0xef20('0x2b')])+'InteractionId']=_0x563c1c[_0xef20('0x2d')]?_0x563c1c['interaction']['id']:null;_0x51a1bc[_['upperFirst'](_0x563c1c[_0xef20('0x2b')])+'MessageId']=_0x563c1c[_0xef20('0x2e')]?_0x563c1c[_0xef20('0x2e')]['id']:null;_0x51a1bc[_[_0xef20('0x2a')](_0x563c1c[_0xef20('0x2b')])+(_0x563c1c[_0xef20('0x2b')]!==_0xef20('0x2f')?'AccountId':_0xef20('0x30'))]=_0x563c1c['account']?_0x563c1c[_0xef20('0xc')]['id']:null;logger[_0xef20('0x31')](util[_0xef20('0x16')](_0xef20('0x32'),_0x20dcfc,_0x57f89b['name']));emitChannelQueueInteraction(_0x563c1c[_0xef20('0x2b')],_0x57f89b[_0xef20('0x33')],_0x51a1bc,_0x563c1c[_0xef20('0xc')][_0xef20('0x33')],_0x563c1c['message']['id'],!![],_0x2c4f6c,_0x57f89b['id']);if(rpc[_0x563c1c[_0xef20('0x2b')]+_0xef20('0x34')]){return rpc[_0x563c1c['channel']+_0xef20('0x34')][_0xef20('0x35')](_0x51a1bc)['catch'](function(_0x38a3a1){logger[_0xef20('0x36')](_0xef20('0x37'),_0x38a3a1);});}}}function stopRouting(_0x1af663,_0x486fd7,_0x215fe9,_0x2ad706){if(_0x1af663&&_0x486fd7){_0x486fd7[_0xef20('0x24')]-=0x1;var _0x50e9d9={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xef20('0x16')](_0xef20('0x27')),'reason':_0xef20('0x38')};logger[_0xef20('0x31')](util[_0xef20('0x16')](_0xef20('0x39'),_0x1af663,_0x486fd7['name']));emitChannelQueueInteraction(_0x215fe9[_0xef20('0x2b')],_0x486fd7[_0xef20('0x33')],_0x215fe9[_0xef20('0x25')],_0x215fe9[_0xef20('0xc')]['name'],_0x215fe9[_0xef20('0x2e')]['id'],![],_0x2ad706,_0x486fd7['id']);return rpc[_0x215fe9['channel']+'Interaction'][_0xef20('0x3a')](_0x215fe9[_0xef20('0x2d')]['id'],{'queueId':_0x486fd7['id']})[_0xef20('0x3b')](function(){if(rpc[_0x215fe9[_0xef20('0x2b')]+_0xef20('0x34')]){return rpc[_0x215fe9[_0xef20('0x2b')]+_0xef20('0x34')][_0xef20('0x3a')](_0x1af663,_0x50e9d9)['catch'](function(_0x26baeb){logger[_0xef20('0x36')](_0xef20('0x3c'),_0x26baeb);});}});}}function endRouting(_0x20508f,_0xa0d1db,_0x5d9469,_0x5991fa){if(_0x20508f&&_0xa0d1db){_0xa0d1db[_0xef20('0x24')]-=0x1;var _0x57e209={'leaveAt':moment()['format'](_0xef20('0x27')),'exitAt':moment()[_0xef20('0x16')](_0xef20('0x27')),'reason':_0xef20('0x3d')};logger[_0xef20('0x31')](util[_0xef20('0x16')](_0xef20('0x3e'),_0x20508f,_0xa0d1db[_0xef20('0x33')]));emitChannelQueueInteraction(_0x5d9469[_0xef20('0x2b')],_0xa0d1db['name'],_0x5d9469[_0xef20('0x25')],_0x5d9469[_0xef20('0xc')][_0xef20('0x33')],_0x5d9469[_0xef20('0x2e')]['id'],![],_0x5991fa);if(rpc[_0x5d9469[_0xef20('0x2b')]+'QueueReport']){return rpc[_0x5d9469['channel']+_0xef20('0x34')][_0xef20('0x3a')](_0x20508f,_0x57e209)[_0xef20('0x3f')](function(_0x35239a){logger[_0xef20('0x36')](_0xef20('0x3c'),_0x35239a);});}}}function handleFindQueue(_0x2643d3){return function(_0x2ae742){return _0x2ae742['name']['toLowerCase']()===_0x2643d3[_0xef20('0x40')]();};}exports[_0xef20('0x41')]=function(_0x633a,_0x2679ef,_0x2877fd,_0x4dc3e1){return function(_0x39fa21){try{var _0x20d868={'name':_0x2679ef[0x0],'timeout':_0x2679ef[0x1]};var _0x55d918=queue[_0xef20('0x0')](_0x20d868,{'typecast':!![]});if(_0x55d918[_0xef20('0x42')]){logger[_0xef20('0x36')](_0xef20('0x43'),_0x633a,_[_0xef20('0x44')](_0x55d918,_0xef20('0x2e'))[_0xef20('0x45')](',\x20'));_0x39fa21['stop']();}else{var _0xc0c3ae=_[_0xef20('0x46')](_0x2877fd[_0x4dc3e1['channel']+_0xef20('0x47')],handleFindQueue(_0x20d868['name']));if(_0xc0c3ae){startRouting(_0x633a,_0xc0c3ae,_0x4dc3e1,_0x2877fd);var _0x260709=(_0xc0c3ae[_0xef20('0x3d')]||0xa)*0x3e8;var _0xd81c98=(_0x20d868[_0xef20('0x3d')]||0x14)*0x3e8;var _0x220350;if(_0x260709>_0xd81c98){_0xd81c98=_0x260709;}var _0xaa2600=seqqueue[_0xef20('0x48')](_0x260709);_0xaa2600['id']=_0x633a;_0xaa2600[_0xef20('0x49')]=_0x260709;_0xaa2600[_0xef20('0x4a')]=_0xd81c98;_0xaa2600[_0xef20('0x2b')]=_0x4dc3e1['channel'];_0x2877fd['rules'][_0x633a]['on'](_0xef20('0x4b'),function(){logger[_0xef20('0x31')](_0xef20('0x4c'),_0x633a);stopRouting(_0x633a,_0xc0c3ae,_0x4dc3e1,_0x2877fd);clearTimeout(_0x220350);_0x220350=undefined;_0xaa2600['close'](!![]);if(_0x2877fd[_0xef20('0x4d')][_0x633a]){delete _0x2877fd['rules'][_0x633a];}_0x39fa21[_0xef20('0x4e')]();});_0x2877fd['rules'][_0x633a]['on']('complete',function(){if(_0x2877fd[_0xef20('0x4d')][_0x633a]){delete _0x2877fd[_0xef20('0x4d')][_0x633a];}});_0x220350=setTimeout(function(){logger[_0xef20('0x31')](_0xef20('0x4f'),_0x633a);endRouting(_0x633a,_0xc0c3ae,_0x4dc3e1,_0x2877fd);clearTimeout(_0x220350);_0xaa2600['close'](!![]);_0x39fa21[_0xef20('0x50')]();},_0xd81c98);switch(_0xc0c3ae['strategy']){case'rrmemory':strategy[_0xef20('0x51')](_0xaa2600,_0xc0c3ae,_0x2877fd,_0x4dc3e1);break;default:strategy[_0xef20('0x52')](_0xaa2600,_0xc0c3ae,_0x2877fd,_0x4dc3e1);}}else{logger[_0xef20('0x36')](_0xef20('0x53'),_0x633a,_0x20d868[_0xef20('0x33')]);_0x39fa21['stop']();}}}catch(_0x90aeb1){logger[_0xef20('0x36')](_0xef20('0x43'),_0x633a,_0x90aeb1['stack']);_0x39fa21['stop']();}};}; \ No newline at end of file +var _0x48e9=['queue_id','account','queue','from','joinAt','push','capitalize','InteractionId','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','QueueReport','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x27d98b,_0x4af8dd){var _0x3dc0fd=function(_0x5c2fb6){while(--_0x5c2fb6){_0x27d98b['push'](_0x27d98b['shift']());}};_0x3dc0fd(++_0x4af8dd);}(_0x48e9,0xa9));var _0x948e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x48e9[_0x19950b];return _0x3c6b41;};'use strict';var schema=require('validate');var _=require(_0x948e('0x0'));var util=require(_0x948e('0x1'));var seqqueue=require(_0x948e('0x2'));var moment=require(_0x948e('0x3'));var Redis=require(_0x948e('0x4'));var config=require(_0x948e('0x5'));var logger=require(_0x948e('0x6'))('routing');var strategy=require('./strategy');config[_0x948e('0x7')]=_[_0x948e('0x8')](config['redis'],{'host':_0x948e('0x9'),'port':0x18eb});var io=require(_0x948e('0xa'))(new Redis(config[_0x948e('0x7')]));var attributes=['id',_0x948e('0xb'),_0x948e('0xc'),_0x948e('0xd'),_0x948e('0xe'),_0x948e('0xf')];function emit(_0x4a96bd,_0x2e6cce,_0x86d45a){io['to'](_0x4a96bd)['emit'](_0x2e6cce,_0x86d45a);}function emitChannelQueueInteraction(_0x401181,_0x4b2b6a,_0x142ced,_0x47c7d4,_0x127084,_0x5e9c68,_0x214fac,_0x5e791f){var _0x3f4b53=_['clone'](_0x142ced);_0x3f4b53['queue_id']=_0x5e791f;_0x3f4b53[_0x948e('0xd')]=_0x4b2b6a;_0x3f4b53[_0x948e('0xc')]=_0x47c7d4;_0x3f4b53['id']=_0x127084;if(_0x5e9c68){attributes[_0x948e('0x10')](_[_0x948e('0x11')](_0x401181)+_0x948e('0x12'));_0x214fac[util['format']('%sQueuesWaitingInteractions',_0x401181)][_0x127084]=_[_0x948e('0x13')](_0x3f4b53,attributes);}else{delete _0x214fac[util[_0x948e('0x14')](_0x948e('0x15'),_0x401181)][_0x127084];}emit(util['format'](_0x948e('0x16'),_0x401181,_0x4b2b6a),util[_0x948e('0x14')](_0x948e('0x17'),_0x401181,_0x5e9c68?_0x948e('0x18'):_0x948e('0x19')),_['pick'](_0x3f4b53,attributes));}var rpc={'openchannelQueueReport':require(_0x948e('0x1a')),'mailQueueReport':require(_0x948e('0x1b')),'chatQueueReport':require(_0x948e('0x1c')),'smsQueueReport':require(_0x948e('0x1d')),'faxQueueReport':require(_0x948e('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x948e('0x1f')),'faxInteraction':require(_0x948e('0x20')),'mailInteraction':require(_0x948e('0x21')),'openchannelInteraction':require(_0x948e('0x22')),'smsInteraction':require(_0x948e('0x23')),'whatsappInteraction':require(_0x948e('0x24'))};var queue=schema({'name':{'type':_0x948e('0x25'),'required':!![],'message':_0x948e('0x26')},'timeout':{'type':_0x948e('0x27'),'message':_0x948e('0x28')}});function startRouting(_0x266a03,_0x41177b,_0xc023c3,_0x9797f7){if(_0x266a03&&_0x41177b&&_0xc023c3){_0x41177b['waiting']+=0x1;var _0x17a243={'uniqueid':_0x266a03,'from':_0xc023c3[_0x948e('0x29')]?_0xc023c3[_0x948e('0x29')][_0x948e('0xe')]:'','joinAt':moment()[_0x948e('0x14')](_0x948e('0x2a')),'ContactId':_0xc023c3[_0x948e('0x2b')]?_0xc023c3[_0x948e('0x2b')]['id']:null,'ListId':_0xc023c3[_0x948e('0x2c')]?_0xc023c3[_0x948e('0x2c')]['id']:null};_0x17a243[_[_0x948e('0x2d')](_0xc023c3[_0x948e('0x2e')])+_0x948e('0x2f')]=_0x41177b['id']||null;_0x17a243[_['upperFirst'](_0xc023c3[_0x948e('0x2e')])+_0x948e('0x12')]=_0xc023c3[_0x948e('0x30')]?_0xc023c3[_0x948e('0x30')]['id']:null;_0x17a243[_['upperFirst'](_0xc023c3[_0x948e('0x2e')])+_0x948e('0x31')]=_0xc023c3[_0x948e('0x32')]?_0xc023c3['message']['id']:null;_0x17a243[_[_0x948e('0x2d')](_0xc023c3[_0x948e('0x2e')])+(_0xc023c3[_0x948e('0x2e')]!==_0x948e('0x33')?'AccountId':_0x948e('0x34'))]=_0xc023c3[_0x948e('0xc')]?_0xc023c3[_0x948e('0xc')]['id']:null;logger[_0x948e('0x35')](util[_0x948e('0x14')](_0x948e('0x36'),_0x266a03,_0x41177b[_0x948e('0x37')]));emitChannelQueueInteraction(_0xc023c3[_0x948e('0x2e')],_0x41177b[_0x948e('0x37')],_0x17a243,_0xc023c3['account'][_0x948e('0x37')],_0xc023c3[_0x948e('0x32')]['id'],!![],_0x9797f7,_0x41177b['id']);if(rpc[_0xc023c3['channel']+'QueueReport']){return rpc[_0xc023c3[_0x948e('0x2e')]+'QueueReport']['create'](_0x17a243)[_0x948e('0x38')](function(_0x1fd1cb){logger['error'](_0x948e('0x39'),_0x1fd1cb);});}}}function stopRouting(_0x1156f9,_0xdea82a,_0x1b1718,_0x3634f1){if(_0x1156f9&&_0xdea82a){_0xdea82a['waiting']-=0x1;var _0x41c074={'leaveAt':moment()[_0x948e('0x14')](_0x948e('0x2a')),'acceptAt':moment()[_0x948e('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x948e('0x3a')};logger['info'](util[_0x948e('0x14')](_0x948e('0x3b'),_0x1156f9,_0xdea82a[_0x948e('0x37')]));emitChannelQueueInteraction(_0x1b1718['channel'],_0xdea82a[_0x948e('0x37')],_0x1b1718[_0x948e('0x29')],_0x1b1718[_0x948e('0xc')]['name'],_0x1b1718[_0x948e('0x32')]['id'],![],_0x3634f1,_0xdea82a['id']);return rpc[_0x1b1718[_0x948e('0x2e')]+_0x948e('0x3c')][_0x948e('0x3d')](_0x1b1718[_0x948e('0x30')]['id'],{'queueId':_0xdea82a['id']})[_0x948e('0x3e')](function(){if(rpc[_0x1b1718[_0x948e('0x2e')]+_0x948e('0x3f')]){return rpc[_0x1b1718[_0x948e('0x2e')]+_0x948e('0x3f')][_0x948e('0x3d')](_0x1156f9,_0x41c074)[_0x948e('0x38')](function(_0x23a54c){logger[_0x948e('0x40')](_0x948e('0x41'),_0x23a54c);});}});}}function endRouting(_0x7921c9,_0xe17cf1,_0x431679,_0x266db1){if(_0x7921c9&&_0xe17cf1){_0xe17cf1['waiting']-=0x1;var _0x56f298={'leaveAt':moment()[_0x948e('0x14')](_0x948e('0x2a')),'exitAt':moment()[_0x948e('0x14')](_0x948e('0x2a')),'reason':_0x948e('0x42')};logger[_0x948e('0x35')](util[_0x948e('0x14')](_0x948e('0x43'),_0x7921c9,_0xe17cf1[_0x948e('0x37')]));emitChannelQueueInteraction(_0x431679['channel'],_0xe17cf1[_0x948e('0x37')],_0x431679['body'],_0x431679[_0x948e('0xc')]['name'],_0x431679[_0x948e('0x32')]['id'],![],_0x266db1);if(rpc[_0x431679['channel']+_0x948e('0x3f')]){return rpc[_0x431679[_0x948e('0x2e')]+'QueueReport'][_0x948e('0x3d')](_0x7921c9,_0x56f298)['catch'](function(_0x345bec){logger[_0x948e('0x40')](_0x948e('0x41'),_0x345bec);});}}}function handleFindQueue(_0x133950){return function(_0x50f482){return _0x50f482[_0x948e('0x37')][_0x948e('0x44')]()===_0x133950['toLowerCase']();};}exports['consequence']=function(_0x4eeda0,_0x2971ed,_0x1cf175,_0x5d1aac){return function(_0x207805){try{var _0x4347e0={'name':_0x2971ed[0x0],'timeout':_0x2971ed[0x1]};var _0x4d49d1=queue[_0x948e('0x45')](_0x4347e0,{'typecast':!![]});if(_0x4d49d1[_0x948e('0x46')]){logger[_0x948e('0x40')](_0x948e('0x47'),_0x4eeda0,_[_0x948e('0x48')](_0x4d49d1,'message')[_0x948e('0x49')](',\x20'));_0x207805[_0x948e('0x4a')]();}else{var _0x3394a6=_[_0x948e('0x4b')](_0x1cf175[_0x5d1aac['channel']+'Queues'],handleFindQueue(_0x4347e0[_0x948e('0x37')]));if(_0x3394a6){startRouting(_0x4eeda0,_0x3394a6,_0x5d1aac,_0x1cf175);var _0x2f1dd7=(_0x3394a6['timeout']||0xa)*0x3e8;var _0x5c8747=(_0x4347e0[_0x948e('0x42')]||0x14)*0x3e8;var _0x40b1f8;if(_0x2f1dd7>_0x5c8747){_0x5c8747=_0x2f1dd7;}var _0x5e32e2=seqqueue[_0x948e('0x4c')](_0x2f1dd7);_0x5e32e2['id']=_0x4eeda0;_0x5e32e2[_0x948e('0x4d')]=_0x2f1dd7;_0x5e32e2[_0x948e('0x4e')]=_0x5c8747;_0x5e32e2[_0x948e('0x2e')]=_0x5d1aac[_0x948e('0x2e')];_0x1cf175[_0x948e('0x4f')][_0x4eeda0]['on'](_0x948e('0x50'),function(){logger[_0x948e('0x35')](_0x948e('0x51'),_0x4eeda0);stopRouting(_0x4eeda0,_0x3394a6,_0x5d1aac,_0x1cf175);clearTimeout(_0x40b1f8);_0x40b1f8=undefined;_0x5e32e2[_0x948e('0x52')](!![]);if(_0x1cf175[_0x948e('0x4f')][_0x4eeda0]){delete _0x1cf175['rules'][_0x4eeda0];}_0x207805[_0x948e('0x4a')]();});_0x1cf175[_0x948e('0x4f')][_0x4eeda0]['on']('complete',function(){if(_0x1cf175[_0x948e('0x4f')][_0x4eeda0]){delete _0x1cf175[_0x948e('0x4f')][_0x4eeda0];}});_0x40b1f8=setTimeout(function(){logger['info'](_0x948e('0x53'),_0x4eeda0);endRouting(_0x4eeda0,_0x3394a6,_0x5d1aac,_0x1cf175);clearTimeout(_0x40b1f8);_0x5e32e2[_0x948e('0x52')](!![]);_0x207805[_0x948e('0x54')]();},_0x5c8747);switch(_0x3394a6[_0x948e('0x55')]){case _0x948e('0x56'):strategy[_0x948e('0x56')](_0x5e32e2,_0x3394a6,_0x1cf175,_0x5d1aac);break;default:strategy[_0x948e('0x57')](_0x5e32e2,_0x3394a6,_0x1cf175,_0x5d1aac);}}else{logger[_0x948e('0x40')](_0x948e('0x58'),_0x4eeda0,_0x4347e0[_0x948e('0x37')]);_0x207805[_0x948e('0x4a')]();}}}catch(_0x527c94){logger[_0x948e('0x40')](_0x948e('0x47'),_0x4eeda0,_0x527c94[_0x948e('0x59')]);_0x207805[_0x948e('0x4a')]();}};}; \ 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 8f3fda9..a83fd22 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 _0x4c6d=['routing','squeue','agent','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x115737,_0xaf9f66){_0x115737=_0x115737-0x0;var _0x3ec637=_0x4c6d[_0x115737];return _0x3ec637;};'use strict';var _=require(_0xd4c6('0x0'));var uuid=require(_0xd4c6('0x1'));var util=require(_0xd4c6('0x2'));var logger=require(_0xd4c6('0x3'))(_0xd4c6('0x4'));var Agent=function(_0x5448bc,_0x209f99,_0x60355c,_0x306766){this['notificationId']=uuid['v4']();this[_0xd4c6('0x5')]=_0x5448bc;this[_0xd4c6('0x6')]=_0x209f99;this['realtime']=_0x60355c;this[_0xd4c6('0x4')]=_0x306766;this[_0xd4c6('0x5')][_0xd4c6('0x7')](this['handleRun'][_0xd4c6('0x8')](this),this[_0xd4c6('0x9')][_0xd4c6('0x8')](this));this['squeue']['on'](_0xd4c6('0xa'),this[_0xd4c6('0x9')][_0xd4c6('0x8')](this));this['squeue']['on'](_0xd4c6('0xb'),this[_0xd4c6('0xc')][_0xd4c6('0x8')](this));};Agent[_0xd4c6('0xd')][_0xd4c6('0x7')]=function(){this[_0xd4c6('0x5')]['push'](this['handleRun'][_0xd4c6('0x8')](this),this['handleTimeout'][_0xd4c6('0x8')](this));};Agent[_0xd4c6('0xd')][_0xd4c6('0xc')]=function(){this[_0xd4c6('0x9')](!![]);};Agent[_0xd4c6('0xd')][_0xd4c6('0xe')]=function(){logger[_0xd4c6('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xd4c6('0x6')]['id']);if(_[_0xd4c6('0x10')](this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']])){logger[_0xd4c6('0xf')](_0xd4c6('0x13'),this['squeue']['id'],this[_0xd4c6('0x6')]['id']);setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}else{if(this[_0xd4c6('0x4')][_0xd4c6('0x14')]||util['isAgentAvailable'](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']],this[_0xd4c6('0x5')][_0xd4c6('0x15')],![])){this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']][_0xd4c6('0x16')]=!![];this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x17')]=undefined;util[_0xd4c6('0x18')](this[_0xd4c6('0x11')],this[_0xd4c6('0x4')],this[_0xd4c6('0x6')],this[_0xd4c6('0x5')][_0xd4c6('0x15')]);util[_0xd4c6('0x19')](this[_0xd4c6('0x1a')],this[_0xd4c6('0x5')]['id'],this['realtime']['agents'][this[_0xd4c6('0x6')]['id']],null,this[_0xd4c6('0x4')]);util['writeLog'](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']],_0xd4c6('0x1b')+(this[_0xd4c6('0x4')]['forcedOwnership']?_0xd4c6('0x1c'):''));}else{logger[_0xd4c6('0xf')](_0xd4c6('0x1d'),this['squeue']['id'],this[_0xd4c6('0x6')]['id']);setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}}};Agent[_0xd4c6('0xd')][_0xd4c6('0x9')]=function(_0x160330){if(_[_0xd4c6('0x10')](this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']])){return logger[_0xd4c6('0xf')](_0xd4c6('0x13'),this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x6')]['id']);}else{logger['debug'](_0xd4c6('0x1e'),this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x6')]['id']);util[_0xd4c6('0x1f')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']],null,this[_0xd4c6('0x4')]);this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x16')]=![];this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x17')]=undefined;util['removeWaitingNotification'](this[_0xd4c6('0x11')],this[_0xd4c6('0x4')],this[_0xd4c6('0x6')],this['squeue'][_0xd4c6('0x15')]);util[_0xd4c6('0x20')](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')]['agents'][this[_0xd4c6('0x6')]['id']],_0x160330?_0xd4c6('0x21'):_0xd4c6('0x22'));}if(!_0x160330){setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}};function agent(_0x57594f,_0x211753,_0x1b60e5,_0xdcd5fc){return new Agent(_0x57594f,_0x211753,_0x1b60e5,_0xdcd5fc);}module[_0xd4c6('0x23')]=agent; \ No newline at end of file +var _0xd67b=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push'];(function(_0x1e12ee,_0x2979e5){var _0x3f5c5f=function(_0x37f68b){while(--_0x37f68b){_0x1e12ee['push'](_0x1e12ee['shift']());}};_0x3f5c5f(++_0x2979e5);}(_0xd67b,0x133));var _0xbd67=function(_0x1642fe,_0x10054b){_0x1642fe=_0x1642fe-0x0;var _0x3c77c9=_0xd67b[_0x1642fe];return _0x3c77c9;};'use strict';var _=require('lodash');var uuid=require(_0xbd67('0x0'));var util=require('./util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var Agent=function(_0x317e33,_0x5e967b,_0x40e384,_0x50da5a){this[_0xbd67('0x3')]=uuid['v4']();this['squeue']=_0x317e33;this[_0xbd67('0x4')]=_0x5e967b;this[_0xbd67('0x5')]=_0x40e384;this[_0xbd67('0x2')]=_0x50da5a;this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this[_0xbd67('0x6')]['on'](_0xbd67('0xb'),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this['squeue']['on']('drained',this[_0xbd67('0xc')]['bind'](this));};Agent[_0xbd67('0xd')][_0xbd67('0x7')]=function(){this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));};Agent[_0xbd67('0xd')][_0xbd67('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbd67('0xd')][_0xbd67('0x8')]=function(){logger[_0xbd67('0xe')](_0xbd67('0xf'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this[_0xbd67('0x7')]['bind'](this),0x3e8);}else{if(this[_0xbd67('0x2')][_0xbd67('0x12')]||util[_0xbd67('0x13')](this['squeue']['id'],this[_0xbd67('0x5')]['agents'][this[_0xbd67('0x4')]['id']],this[_0xbd67('0x6')][_0xbd67('0x14')],![])){this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=!![];this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']]['busyQueue']=undefined;util[_0xbd67('0x16')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this[_0xbd67('0x6')][_0xbd67('0x14')]);util[_0xbd67('0x17')](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this[_0xbd67('0x2')]);util['writeLog'](this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],_0xbd67('0x18')+(this[_0xbd67('0x2')]['forcedOwnership']?_0xbd67('0x19'):''));}else{logger[_0xbd67('0xe')](_0xbd67('0x1a'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbd67('0xd')][_0xbd67('0xa')]=function(_0x4675ac){if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){return logger[_0xbd67('0xe')](_0xbd67('0x1b'),this[_0xbd67('0x6')]['id'],this['agent']['id']);}else{logger['debug'](_0xbd67('0x1c'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);util['hideNotification'](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=![];this['realtime']['agents'][this[_0xbd67('0x4')]['id']][_0xbd67('0x1d')]=undefined;util[_0xbd67('0x1e')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this['squeue'][_0xbd67('0x14')]);util[_0xbd67('0x1f')](this[_0xbd67('0x6')]['id'],this['realtime'][_0xbd67('0x11')][this['agent']['id']],_0x4675ac?_0xbd67('0x20'):_0xbd67('0x21'));}if(!_0x4675ac){setTimeout(this['push'][_0xbd67('0x9')](this),0x3e8);}};function agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777){return new Agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777);}module[_0xbd67('0x22')]=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 45f6ed4..24298ab 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 _0xb064=['drained','handleDrained','prototype','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout'];(function(_0x2744b3,_0x4ca3e8){var _0x3f4087=function(_0x2d35e4){while(--_0x2d35e4){_0x2744b3['push'](_0x2744b3['shift']());}};_0x3f4087(++_0x4ca3e8);}(_0xb064,0x9e));var _0x4b06=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xb064[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x4b06('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x4b06('0x1'))(_0x4b06('0x2'));var Beepall=function(_0x5313cd,_0x3355cf,_0x410cdb,_0x1343ad){this[_0x4b06('0x3')]=uuid['v4']();this[_0x4b06('0x4')]=_0x5313cd;this[_0x4b06('0x5')]=_0x3355cf;this[_0x4b06('0x6')]=_0x410cdb;this[_0x4b06('0x2')]=_0x1343ad;this[_0x4b06('0x4')][_0x4b06('0x7')](this[_0x4b06('0x8')][_0x4b06('0x9')](this),this[_0x4b06('0xa')][_0x4b06('0x9')](this));this[_0x4b06('0x4')]['on'](_0x4b06('0xb'),this[_0x4b06('0xa')][_0x4b06('0x9')](this));this[_0x4b06('0x4')]['on'](_0x4b06('0xc'),this[_0x4b06('0xd')][_0x4b06('0x9')](this));};Beepall[_0x4b06('0xe')][_0x4b06('0x7')]=function(){this[_0x4b06('0x4')][_0x4b06('0x7')](this[_0x4b06('0x8')][_0x4b06('0x9')](this),this[_0x4b06('0xa')][_0x4b06('0x9')](this));};Beepall[_0x4b06('0xe')][_0x4b06('0xd')]=function(){this[_0x4b06('0xa')](!![]);};Beepall['prototype'][_0x4b06('0x8')]=function(){var _0x2b2ea1=!![];if(!_[_0x4b06('0xf')](this[_0x4b06('0x5')])&&!_[_0x4b06('0xf')](this[_0x4b06('0x5')][_0x4b06('0x10')])&&this[_0x4b06('0x5')]['Agents'][_0x4b06('0x11')]>0x0){for(var _0x17d55f=0x0,_0x404078;_0x17d55f0x0){for(var _0x3cb295=0x0,_0x50a260;_0x3cb2950x0&&_0x24a7f1[_0x34e740+_0x70f9('0x21')]>=_0x24a7f1[_0x34e740+'Capacity']){writeLog(_0x14de5c,_0x24a7f1,_0x34e740[_0x70f9('0x22')]()+_0x70f9('0x23'));return![];}}return!![];};exports[_0x70f9('0x24')]=function(_0x3c3051,_0x2a9c4b,_0x49337a,_0x3a8209,_0x74b33c){return sendNotification(!![],_0x3c3051,_0x2a9c4b,_0x49337a,_0x3a8209,_0x74b33c);};exports[_0x70f9('0x25')]=function(_0x386ded,_0x345c11,_0xfe324e,_0x54ddcd,_0x470d0c){return sendNotification(![],_0x386ded,_0x345c11,_0xfe324e,_0x54ddcd,_0x470d0c);};exports[_0x70f9('0x26')]=function(_0x1a0da5,_0x2ddf21,_0x35d452){var _0x701ff2=_0x2ddf21[_0x70f9('0x27')][_0x70f9('0x28')];if(!_0x701ff2&&_0x35d452){_0x701ff2=_0x35d452['id'];}var _0x562b72=_['some'](_0x1a0da5[_0x2ddf21[_0x70f9('0x29')]+_0x70f9('0x2a')],function(_0x2f805a){var _0x520ef0=_['capitalize'](_0x2ddf21[_0x70f9('0x29')])+_0x70f9('0x2b');return _0x2f805a[_0x520ef0]===_0x2ddf21['interaction']['id'];});if(!_0x562b72&&_0x701ff2&&_0x1a0da5['agents'][_0x701ff2]){_0x562b72=_[_0x70f9('0x2c')](_0x1a0da5[_0x70f9('0x2d')][_0x701ff2][_0x2ddf21['channel']+_0x70f9('0x2e')],function(_0x227845){return _0x227845['id']===_0x2ddf21['interaction']['id'];});}return _0x562b72;};exports[_0x70f9('0x2f')]=function(_0xb9c6a2,_0x12da69,_0x54b093,_0xa93f4a){if(_0x54b093&&_0x54b093['id']&&_0xb9c6a2[_0x70f9('0x2d')]&&_0xb9c6a2['agents'][_0x54b093['id']]){_0xb9c6a2[_0x70f9('0x2d')][_0x54b093['id']][_0xa93f4a+_0x70f9('0x2e')][_0x12da69['message']['id']]={'id':_0x12da69[_0x70f9('0x27')]['id']};}};exports[_0x70f9('0x30')]=function(_0x375aba,_0x175f3f,_0x191306,_0x36e93d){if(_0x191306&&_0x191306['id']&&_0x375aba[_0x70f9('0x2d')]&&_0x375aba['agents'][_0x191306['id']]){delete _0x375aba[_0x70f9('0x2d')][_0x191306['id']][_0x36e93d+_0x70f9('0x2e')][_0x175f3f[_0x70f9('0x13')]['id']];}};exports[_0x70f9('0x31')]=writeLog; \ No newline at end of file +var _0xe4de=['notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','WaitingInteractions','interaction','saveWaitingNotification','agents','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender'];(function(_0x4bcaf2,_0x1547fd){var _0x587616=function(_0x5e968e){while(--_0x5e968e){_0x4bcaf2['push'](_0x4bcaf2['shift']());}};_0x587616(++_0x1547fd);}(_0xe4de,0x16e));var _0xee4d=function(_0x1a3f33,_0x392cbd){_0x1a3f33=_0x1a3f33-0x0;var _0x2fa523=_0xe4de[_0x1a3f33];return _0x2fa523;};'use strict';var _=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var utils=require(_0xee4d('0x2'));var Redis=require(_0xee4d('0x3'));var config=require('../../../../../config/environment');var logger=require(_0xee4d('0x4'))(_0xee4d('0x5'));config[_0xee4d('0x6')]=_[_0xee4d('0x7')](config[_0xee4d('0x6')],{'host':_0xee4d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xee4d('0x6')]));function sendNotification(_0x4c5261,_0x57bdf,_0x92b37f,_0x36c368,_0xf2b5e5,_0x3dff3a){var _0x51c990=_0x3dff3a||{};var _0x55ccb1=_0x92b37f[_0xee4d('0x9')]('.');var _0x1f6cb9={'uniqueid':_0x57bdf,'channel':_0x55ccb1[0x0],'id':_0x55ccb1[0x1],'title':_0x55ccb1[0x0]+_0xee4d('0xa'),'interactionId':_0x55ccb1[0x2],'queue':_0xf2b5e5?_0xf2b5e5[_0xee4d('0xb')]:null,'sound':_0x51c990[_0xee4d('0xc')][_0xee4d('0xd')],'shake':_0x51c990['account'][_0xee4d('0xe')]};try{if(!_0x51c990['body']){_0x51c990[_0xee4d('0xf')]={};}if(_0xf2b5e5){_0x51c990['body']['queue']=_0xf2b5e5;}else if(_0x51c990[_0xee4d('0xf')][_0xee4d('0x10')]){delete _0x51c990[_0xee4d('0xf')][_0xee4d('0x10')];}_0x1f6cb9[_0xee4d('0x11')]=utils[_0xee4d('0x12')](_0x51c990[_0xee4d('0xc')][_0xee4d('0x13')],_0x51c990);}catch(_0x3b03ff){_0x1f6cb9[_0xee4d('0x11')]=_0xee4d('0x14');logger[_0xee4d('0x15')](util[_0xee4d('0x16')](_0xee4d('0x17'),_0x57bdf,_0x3b03ff['message']));}io['to'](util['format']('user:%s',_0x36c368[_0xee4d('0xb')]))[_0xee4d('0x18')](util['format'](_0xee4d('0x19'),_0x4c5261?_0xee4d('0x1a'):_0xee4d('0x1b')),_0x1f6cb9);}function writeLog(_0x22cbec,_0x260efc,_0xf5d288){return logger['debug'](util[_0xee4d('0x16')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x22cbec,_0x260efc['name'],_0xf5d288));}exports[_0xee4d('0x1c')]=function(_0x13d5b8,_0x30b382,_0x210cad,_0x19b35f){if(_0x30b382[_0xee4d('0x1d')]){writeLog(_0x13d5b8,_0x30b382,_0xee4d('0x1e'));return![];}if(!_0x30b382[_0xee4d('0x1f')]){writeLog(_0x13d5b8,_0x30b382,_0xee4d('0x20'));return![];}if(_0x30b382[_0x210cad+_0xee4d('0x21')]){writeLog(_0x13d5b8,_0x30b382,_0xee4d('0x22'));return![];}if(_0x19b35f&&_0x30b382[_0xee4d('0x23')](_0x210cad+_0xee4d('0x24'))&&_0x30b382[_0xee4d('0x23')](_0x210cad+_0xee4d('0x25'))){if(_0x30b382[_0x210cad+_0xee4d('0x24')]>0x0&&_0x30b382[_0x210cad+_0xee4d('0x25')]>=_0x30b382[_0x210cad+_0xee4d('0x24')]){writeLog(_0x13d5b8,_0x30b382,_0x210cad[_0xee4d('0x26')]()+_0xee4d('0x27'));return![];}}return!![];};exports[_0xee4d('0x28')]=function(_0x1891b8,_0x469f0a,_0x337bf8,_0x3d7964,_0x1e396a){return sendNotification(!![],_0x1891b8,_0x469f0a,_0x337bf8,_0x3d7964,_0x1e396a);};exports[_0xee4d('0x29')]=function(_0xc66113,_0x1b765e,_0x2045c5,_0x213fab,_0x1a1318){return sendNotification(![],_0xc66113,_0x1b765e,_0x2045c5,_0x213fab,_0x1a1318);};exports['checkWaitingNotifications']=function(_0x3fbcfc,_0x3436b7,_0x56b371){var _0x91b9c6=_0x3436b7['interaction'][_0xee4d('0x2a')];if(!_0x91b9c6&&_0x56b371){_0x91b9c6=_0x56b371['id'];}var _0x2ce18b=_[_0xee4d('0x2b')](_0x3fbcfc[_0x3436b7[_0xee4d('0x2c')]+_0xee4d('0x2d')],function(_0x589b5d){var _0xb5f741=_[_0xee4d('0x2e')](_0x3436b7[_0xee4d('0x2c')])+_0xee4d('0x2f');return _0x589b5d[_0xb5f741]===_0x3436b7['interaction']['id'];});if(!_0x2ce18b&&_0x91b9c6&&_0x3fbcfc['agents'][_0x91b9c6]){_0x2ce18b=_[_0xee4d('0x2b')](_0x3fbcfc['agents'][_0x91b9c6][_0x3436b7[_0xee4d('0x2c')]+_0xee4d('0x30')],function(_0x3fa025){return _0x3fa025['id']===_0x3436b7[_0xee4d('0x31')]['id'];});}return _0x2ce18b;};exports[_0xee4d('0x32')]=function(_0x456cd7,_0x4813d0,_0x330156,_0x366c50){if(_0x330156&&_0x330156['id']&&_0x456cd7['agents']&&_0x456cd7[_0xee4d('0x33')][_0x330156['id']]){_0x456cd7[_0xee4d('0x33')][_0x330156['id']][_0x366c50+_0xee4d('0x30')][_0x4813d0[_0xee4d('0x34')]['id']]={'id':_0x4813d0[_0xee4d('0x31')]['id']};}};exports[_0xee4d('0x35')]=function(_0x54e378,_0x5ebbe8,_0x3a69ad,_0x8695a8){if(_0x3a69ad&&_0x3a69ad['id']&&_0x54e378[_0xee4d('0x33')]&&_0x54e378[_0xee4d('0x33')][_0x3a69ad['id']]){delete _0x54e378[_0xee4d('0x33')][_0x3a69ad['id']][_0x8695a8+'WaitingInteractions'][_0x5ebbe8['message']['id']];}};exports[_0xee4d('0x36')]=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 1c24bc3..bb3c5e1 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 _0xcfb6=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil'];(function(_0x4a6c4d,_0x455768){var _0x31800b=function(_0x203513){while(--_0x203513){_0x4a6c4d['push'](_0x4a6c4d['shift']());}};_0x31800b(++_0x455768);}(_0xcfb6,0xd1));var _0x6cfb=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xcfb6[_0x4b7b62];return _0x2280df;};'use strict';var schema=require(_0x6cfb('0x0'));var sh=require(_0x6cfb('0x1'));var _=require(_0x6cfb('0x2'));var utils=require(_0x6cfb('0x3'));var logger=require(_0x6cfb('0x4'))(_0x6cfb('0x5'));var system=schema({'command':{'type':_0x6cfb('0x6'),'required':!![],'message':_0x6cfb('0x7')}});exports[_0x6cfb('0x8')]=function(_0x2a3ff3,_0x9aaa3e){return function(_0x24d96b){try{var _0x5833e9={'command':_0x9aaa3e[0x0]};var _0x244d5e=system[_0x6cfb('0x0')](_0x5833e9,{'typecast':!![]});if(_0x244d5e[_0x6cfb('0x9')]){logger[_0x6cfb('0xa')](_0x6cfb('0xb'),_0x2a3ff3,_[_0x6cfb('0xc')](_0x244d5e,'message')[_0x6cfb('0xd')](',\x20'));logger[_0x6cfb('0xe')](_0x6cfb('0xf'),_0x2a3ff3);_0x24d96b[_0x6cfb('0x10')]();}else{var _0x2f701e=this;var _0x3946f7=utils[_0x6cfb('0x11')](_0x9aaa3e[0x0],this);logger[_0x6cfb('0xe')](_0x6cfb('0x12'),_0x2a3ff3,_0x3946f7);sh[_0x6cfb('0x13')](_[_0x6cfb('0x14')](_0x3946f7),function(_0x4df29e,_0x5c8065){logger[_0x6cfb('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2a3ff3,_0x4df29e);if(_0x4df29e==0x0){var _0x174b09=_0x5c8065[_0x6cfb('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x6cfb('0x16')](_0x9aaa3e[0x1])||_[_0x6cfb('0x17')](_0x9aaa3e[0x1])){logger[_0x6cfb('0xe')](_0x6cfb('0x18'),_0x2a3ff3);_0x2f701e[_0x6cfb('0x19')][_0x9aaa3e[0x1]]=_0x174b09;}else{logger[_0x6cfb('0xe')](_0x6cfb('0x1a'),_0x2a3ff3,_0x9aaa3e[0x1],_0x174b09);_0x2f701e[_0x6cfb('0x19')][_0x9aaa3e[0x1]]=_0x174b09;}}_0x24d96b[_0x6cfb('0x10')]();});}}catch(_0x559381){logger[_0x6cfb('0xa')]('[%s][SYSTEM]\x20%s',_0x2a3ff3,_[_0x6cfb('0x1b')](_0x559381)?JSON[_0x6cfb('0x1c')](_0x559381):_0x559381);logger[_0x6cfb('0xe')](_0x6cfb('0xf'),_0x2a3ff3);_0x24d96b[_0x6cfb('0x10')]();}};}; \ No newline at end of file +var _0x8996=['[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8996,0x1d3));var _0x6899=function(_0x41a432,_0x4a7507){_0x41a432=_0x41a432-0x0;var _0x3825cf=_0x8996[_0x41a432];return _0x3825cf;};'use strict';var schema=require(_0x6899('0x0'));var sh=require(_0x6899('0x1'));var _=require(_0x6899('0x2'));var utils=require(_0x6899('0x3'));var logger=require(_0x6899('0x4'))(_0x6899('0x5'));var system=schema({'command':{'type':_0x6899('0x6'),'required':!![],'message':_0x6899('0x7')}});exports['consequence']=function(_0x484159,_0x28c49f){return function(_0x55750a){try{var _0x2f3056={'command':_0x28c49f[0x0]};var _0x2623fc=system[_0x6899('0x0')](_0x2f3056,{'typecast':!![]});if(_0x2623fc[_0x6899('0x8')]){logger['error'](_0x6899('0x9'),_0x484159,_[_0x6899('0xa')](_0x2623fc,'message')[_0x6899('0xb')](',\x20'));logger['info'](_0x6899('0xc'),_0x484159);_0x55750a['next']();}else{var _0x525559=this;var _0x1e4ac0=utils[_0x6899('0xd')](_0x28c49f[0x0],this);logger[_0x6899('0xe')](_0x6899('0xf'),_0x484159,_0x1e4ac0);sh[_0x6899('0x10')](_[_0x6899('0x11')](_0x1e4ac0),function(_0x54e89c,_0x3b307e){logger['info'](_0x6899('0x12'),_0x484159,_0x54e89c);if(_0x54e89c==0x0){var _0x566cf4=_0x3b307e[_0x6899('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x6899('0x14')](_0x28c49f[0x1])||_[_0x6899('0x15')](_0x28c49f[0x1])){logger[_0x6899('0xe')](_0x6899('0x16'),_0x484159);_0x525559[_0x6899('0x17')][_0x28c49f[0x1]]=_0x566cf4;}else{logger['info'](_0x6899('0x18'),_0x484159,_0x28c49f[0x1],_0x566cf4);_0x525559['body'][_0x28c49f[0x1]]=_0x566cf4;}}_0x55750a['next']();});}}catch(_0x4de4df){logger[_0x6899('0x19')]('[%s][SYSTEM]\x20%s',_0x484159,_[_0x6899('0x1a')](_0x4de4df)?JSON[_0x6899('0x1b')](_0x4de4df):_0x4de4df);logger[_0x6899('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x484159);_0x55750a['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index dffdeea..d39aa80 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 _0x41ae=['Interaction','addTags','interaction','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x41ae,0x176));var _0xe41a=function(_0x1eb2b5,_0x653782){_0x1eb2b5=_0x1eb2b5-0x0;var _0x1ff847=_0x41ae[_0x1eb2b5];return _0x1ff847;};'use strict';var schema=require(_0xe41a('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe41a('0x1')),'openchannelInteraction':require(_0xe41a('0x2')),'smsInteraction':require(_0xe41a('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xe41a('0x4'))};var logger=require(_0xe41a('0x5'))(_0xe41a('0x6'));var tag=schema({'tag':{'type':_0xe41a('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x34c0eb,_0x226e87,_0x2b18b7,_0x45d37c){return function(_0x579076){try{var _0x55fc33={'tag':_0x226e87[0x0]};var _0x21eeb8=tag[_0xe41a('0x0')](_0x55fc33,{'typecast':!![]});if(_0x21eeb8[_0xe41a('0x8')]){logger[_0xe41a('0x9')](_0xe41a('0xa'),_0x34c0eb,_['map'](_0x21eeb8,_0xe41a('0xb'))[_0xe41a('0xc')](',\x20'));logger[_0xe41a('0xd')](_0xe41a('0xe'),_0x34c0eb);_0x579076[_0xe41a('0xf')]();}else{var _0x4290fc={'ids':[_0x226e87[0x0]]};if(rpc[_0x45d37c[_0xe41a('0x10')]+_0xe41a('0x11')]){rpc[_0x45d37c[_0xe41a('0x10')]+_0xe41a('0x11')][_0xe41a('0x12')](_0x45d37c[_0xe41a('0x13')]['id'],_0x4290fc)['then'](function(_0x3b74e6){logger[_0xe41a('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x34c0eb,_0x226e87[0x1],_0x45d37c[_0xe41a('0x10')],_0x45d37c[_0xe41a('0x13')]['id']);})['catch'](function(_0x124133){logger['error'](_0xe41a('0xa'),_0x34c0eb,JSON[_0xe41a('0x14')](_0x124133));logger[_0xe41a('0xd')](_0xe41a('0xe'),_0x34c0eb);})[_0xe41a('0x15')](function(){_0x579076['next']();});}}}catch(_0x2b536c){logger['error'](_0xe41a('0xa'),_0x34c0eb,_[_0xe41a('0x16')](_0x2b536c)?JSON[_0xe41a('0x14')](_0x2b536c):_0x2b536c);logger[_0xe41a('0xd')](_0xe41a('0xe'),_0x34c0eb);_0x579076[_0xe41a('0xf')]();}};}; \ No newline at end of file +var _0xc4a5=['next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x38515e,_0x298874){var _0x88a188=function(_0x44bac7){while(--_0x44bac7){_0x38515e['push'](_0x38515e['shift']());}};_0x88a188(++_0x298874);}(_0xc4a5,0x191));var _0x5c4a=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xc4a5[_0x4599b6];return _0x2e014c;};'use strict';var schema=require(_0x5c4a('0x0'));var _=require(_0x5c4a('0x1'));var rpc={'chatInteraction':require(_0x5c4a('0x2')),'openchannelInteraction':require(_0x5c4a('0x3')),'smsInteraction':require(_0x5c4a('0x4')),'mailInteraction':require(_0x5c4a('0x5')),'faxInteraction':require(_0x5c4a('0x6')),'whatsappInteraction':require(_0x5c4a('0x7'))};var logger=require(_0x5c4a('0x8'))(_0x5c4a('0x9'));var tag=schema({'tag':{'type':_0x5c4a('0xa'),'required':!![],'message':_0x5c4a('0xb')}});exports[_0x5c4a('0xc')]=function(_0x144a78,_0x5b7957,_0x179698,_0x421e00){return function(_0x308d7d){try{var _0x32593a={'tag':_0x5b7957[0x0]};var _0x2cca1b=tag[_0x5c4a('0x0')](_0x32593a,{'typecast':!![]});if(_0x2cca1b[_0x5c4a('0xd')]){logger['error'](_0x5c4a('0xe'),_0x144a78,_['map'](_0x2cca1b,_0x5c4a('0xf'))[_0x5c4a('0x10')](',\x20'));logger[_0x5c4a('0x11')](_0x5c4a('0x12'),_0x144a78);_0x308d7d[_0x5c4a('0x13')]();}else{var _0x220c83={'ids':[_0x5b7957[0x0]]};if(rpc[_0x421e00[_0x5c4a('0x14')]+_0x5c4a('0x15')]){rpc[_0x421e00[_0x5c4a('0x14')]+_0x5c4a('0x15')][_0x5c4a('0x16')](_0x421e00[_0x5c4a('0x17')]['id'],_0x220c83)['then'](function(_0x19378d){logger[_0x5c4a('0x11')](_0x5c4a('0x18'),_0x144a78,_0x5b7957[0x1],_0x421e00[_0x5c4a('0x14')],_0x421e00[_0x5c4a('0x17')]['id']);})[_0x5c4a('0x19')](function(_0x134660){logger[_0x5c4a('0x1a')](_0x5c4a('0xe'),_0x144a78,JSON[_0x5c4a('0x1b')](_0x134660));logger[_0x5c4a('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x144a78);})[_0x5c4a('0x1c')](function(){_0x308d7d['next']();});}}}catch(_0x50e6b5){logger['error'](_0x5c4a('0xe'),_0x144a78,_[_0x5c4a('0x1d')](_0x50e6b5)?JSON[_0x5c4a('0x1b')](_0x50e6b5):_0x50e6b5);logger[_0x5c4a('0x11')](_0x5c4a('0x12'),_0x144a78);_0x308d7d[_0x5c4a('0x13')]();}};}; \ 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 c1704bf..142e10c 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 _0x9be8=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','stop','error','[%s][TVOX]\x20%s','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','method','login','stringify','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x4e748d,_0x1b1bee){var _0x524c6e=function(_0x111fcb){while(--_0x111fcb){_0x4e748d['push'](_0x4e748d['shift']());}};_0x524c6e(++_0x1b1bee);}(_0x9be8,0x9a));var _0x89be=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0x9be8[_0x398d85];return _0x33c2bb;};'use strict';var rp=require('request-promise');var logger=require(_0x89be('0x0'))(_0x89be('0x1'));var _=require(_0x89be('0x2'));var arr=[];exports[_0x89be('0x3')]=function(_0x39cb24,_0x1a9ea8){return function(_0x582a6c){var _0x59b06c=_0x1a9ea8[0xa];var _0xe150e9=_0x1a9ea8[0xb];var _0x1da968=_0x1a9ea8[0xc];var _0x1c4dba=_0x1a9ea8[0xd];var _0x53e352=_0x1a9ea8[0xe];var _0x2b6ac3=_0x1a9ea8[0xf][_0x89be('0x4')](/\n/g,_0x89be('0x5'));var _0x141ab0=_0x1a9ea8[0x10][_0x89be('0x4')](/\n/g,'\x20');if(!arr[_0x89be('0x6')](_0xe150e9)){arr[_0x89be('0x7')](_0xe150e9);var _0x56af89=_0x1a9ea8[0x3];var _0x3c843f=_0x1a9ea8[0x4];var _0x4ef02e=_0x1a9ea8[0x1];var _0xd92a46=_0x1a9ea8[0x0];var _0x40bc1b={};_0x40bc1b[_0x89be('0x8')]=_0x1a9ea8[0x8]+_0x89be('0x9')+_0x1da968+'|'+_0x59b06c+'|'+_0x1c4dba+'|'+_0xe150e9+'|'+_0x53e352;_0x40bc1b[_0x89be('0xa')]=_0x1a9ea8[0x7]+'?params='+_0x1da968+'|'+_0x59b06c+'|'+_0x1c4dba+'|'+_0xe150e9+'|'+_0x53e352+'|'+_0x2b6ac3+'|'+_0x141ab0;_0x40bc1b['title']=_0x1a9ea8[0x9];var _0x4d29da={};_0x4d29da['jsonrpc']='2.0';_0x4d29da[_0x89be('0xb')]=_0x89be('0xc');var _0x3e9c2f=[];_0x3e9c2f[_0x89be('0x7')](_0x1a9ea8[0x2]);_0x3e9c2f['push'](_0x1a9ea8[0x5]);_0x3e9c2f[_0x89be('0x7')](_0x1a9ea8[0x6]);_0x4d29da['params']=_0x3e9c2f;_0x4d29da['id']=0x1;var _0x1215e4=JSON[_0x89be('0xd')](_0x4d29da);var _0x2d3732={'encoding':_0x89be('0xe'),'method':_0x89be('0xf'),'timeout':0x2710,'url':_0x56af89,'headers':{'Content-Type':_0x89be('0x10')},'body':_0x1215e4};return rp(_0x2d3732)[_0x89be('0x11')](function(_0x186cd2){const _0x2e69df=JSON[_0x89be('0x12')](_0x186cd2);if(!_0x2e69df[_0x89be('0x13')][_0x89be('0x14')]){throw new Error(_0x89be('0x15'));}var _0x120797=_0xe150e9;var _0x27dfff='channelId='+_0x4ef02e+_0x89be('0x16')+_0xd92a46+_0x89be('0x17')+_0x120797+'&data='+JSON['stringify'](_0x40bc1b);var _0x37deba=_0x3c843f+'?'+_0x27dfff;return rp(_0x37deba);})['then'](function(_0x29d6e9){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x39cb24,_0x29d6e9);_0x582a6c[_0x89be('0x18')]();})['catch'](function(_0x45455e){logger[_0x89be('0x19')](_0x89be('0x1a'),_0x39cb24,_['isObject'](_0x45455e)?JSON[_0x89be('0xd')](_0x45455e):_0x45455e);_0x582a6c[_0x89be('0x18')]();});}else{logger[_0x89be('0x1b')](_0x89be('0x1c'),_0x39cb24);_0x582a6c['next']();}};}; \ No newline at end of file +var _0x9226=['utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','urlOnRing','title','jsonrpc','method','login','push','params','stringify'];(function(_0xc10d57,_0x100b0c){var _0x406f29=function(_0x2bde67){while(--_0x2bde67){_0xc10d57['push'](_0xc10d57['shift']());}};_0x406f29(++_0x100b0c);}(_0x9226,0x100));var _0x6922=function(_0x3c286a,_0x5a4bca){_0x3c286a=_0x3c286a-0x0;var _0x35cc0f=_0x9226[_0x3c286a];return _0x35cc0f;};'use strict';var rp=require(_0x6922('0x0'));var logger=require(_0x6922('0x1'))(_0x6922('0x2'));var _=require(_0x6922('0x3'));var arr=[];exports['consequence']=function(_0x20a5b3,_0x25ddae){return function(_0x3d329a){var _0x463076=_0x25ddae[0xa];var _0x229794=_0x25ddae[0xb];var _0x4bcffa=_0x25ddae[0xc];var _0x5b6d21=_0x25ddae[0xd];var _0xaf50b=_0x25ddae[0xe];var _0x1c6a63=_0x25ddae[0xf][_0x6922('0x4')](/\n/g,_0x6922('0x5'));var _0x419524=_0x25ddae[0x10][_0x6922('0x4')](/\n/g,'\x20');if(!arr[_0x6922('0x6')](_0x229794)){arr['push'](_0x229794);var _0x5585fd=_0x25ddae[0x3];var _0xf84312=_0x25ddae[0x4];var _0x253fb0=_0x25ddae[0x1];var _0x517240=_0x25ddae[0x0];var _0x1bdbb2={};_0x1bdbb2[_0x6922('0x7')]=_0x25ddae[0x8]+'?params='+_0x4bcffa+'|'+_0x463076+'|'+_0x5b6d21+'|'+_0x229794+'|'+_0xaf50b;_0x1bdbb2[_0x6922('0x8')]=_0x25ddae[0x7]+'?params='+_0x4bcffa+'|'+_0x463076+'|'+_0x5b6d21+'|'+_0x229794+'|'+_0xaf50b+'|'+_0x1c6a63+'|'+_0x419524;_0x1bdbb2[_0x6922('0x9')]=_0x25ddae[0x9];var _0x5591fe={};_0x5591fe[_0x6922('0xa')]='2.0';_0x5591fe[_0x6922('0xb')]=_0x6922('0xc');var _0x508d87=[];_0x508d87[_0x6922('0xd')](_0x25ddae[0x2]);_0x508d87[_0x6922('0xd')](_0x25ddae[0x5]);_0x508d87[_0x6922('0xd')](_0x25ddae[0x6]);_0x5591fe[_0x6922('0xe')]=_0x508d87;_0x5591fe['id']=0x1;var _0x141d0a=JSON[_0x6922('0xf')](_0x5591fe);var _0x15e9f2={'encoding':_0x6922('0x10'),'method':_0x6922('0x11'),'timeout':0x2710,'url':_0x5585fd,'headers':{'Content-Type':'application/json-rpc'},'body':_0x141d0a};return rp(_0x15e9f2)[_0x6922('0x12')](function(_0x3bd6a4){const _0x532533=JSON['parse'](_0x3bd6a4);if(!_0x532533[_0x6922('0x13')][_0x6922('0x14')]){throw new Error(_0x6922('0x15'));}var _0x13efc4=_0x229794;var _0x4deac1=_0x6922('0x16')+_0x253fb0+_0x6922('0x17')+_0x517240+_0x6922('0x18')+_0x13efc4+_0x6922('0x19')+JSON[_0x6922('0xf')](_0x1bdbb2);var _0x1e8def=_0xf84312+'?'+_0x4deac1;return rp(_0x1e8def);})[_0x6922('0x12')](function(_0x29003e){logger[_0x6922('0x1a')](_0x6922('0x1b'),_0x20a5b3,_0x29003e);_0x3d329a[_0x6922('0x1c')]();})[_0x6922('0x1d')](function(_0x259b26){logger['error'](_0x6922('0x1e'),_0x20a5b3,_[_0x6922('0x1f')](_0x259b26)?JSON[_0x6922('0xf')](_0x259b26):_0x259b26);_0x3d329a['stop']();});}else{logger[_0x6922('0x1a')](_0x6922('0x20'),_0x20a5b3);_0x3d329a[_0x6922('0x21')]();}};}; \ 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 6bc54ce..600dcaa 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x5818dc,_0x787b10){var _0x3a94e6=function(_0x39498b){while(--_0x39498b){_0x5818dc['push'](_0x5818dc['shift']());}};_0x3a94e6(++_0x787b10);}(_0xe706,0xa3));var _0x6e70=function(_0x2d2ec8,_0x3f04b1){_0x2d2ec8=_0x2d2ec8-0x0;var _0x30e4e9=_0xe706[_0x2d2ec8];return _0x30e4e9;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x208df5,_0x40e28d){var _0x15bb64=function(_0x47bce7){while(--_0x47bce7){_0x208df5['push'](_0x208df5['shift']());}};_0x15bb64(++_0x40e28d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4af40a9..bcc098b 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 _0xdcd5=['./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','condition','intervals'];(function(_0x2ca2e1,_0x2709bb){var _0x4551e6=function(_0x4f4707){while(--_0x4f4707){_0x2ca2e1['push'](_0x2ca2e1['shift']());}};_0x4551e6(++_0x2709bb);}(_0xdcd5,0x110));var _0x5dcd=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xdcd5[_0x5401ae];return _0x286068;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var path=require(_0x5dcd('0x2'));var fs=require('fs');var jayson=require(_0x5dcd('0x3'));var BPromise=require(_0x5dcd('0x4'));var utils=require(_0x5dcd('0x5'));var sUtils=require(_0x5dcd('0x6'));var logger=require('../../../config/logger')(_0x5dcd('0x7'));var rpc={'openchannelQueueReport':require(_0x5dcd('0x8')),'mailQueueReport':require(_0x5dcd('0x9')),'chatQueueReport':require(_0x5dcd('0xa')),'smsQueueReport':require(_0x5dcd('0xb')),'faxQueueReport':require(_0x5dcd('0xc')),'whatsappQueueReport':require(_0x5dcd('0xd'))};var RuleEngine=require(_0x5dcd('0xe'));function getId(_0x5b70b8,_0x593f16,_0x1680f9){return util[_0x5dcd('0xf')](_0x5dcd('0x10'),_0x5b70b8,_0x593f16||0x0,_0x1680f9||0x0);}function getIntervals(_0x55037e,_0x1e1161){var _0x29c3e1=[];if(!_[_0x5dcd('0x11')](_0x1e1161[_0x5dcd('0x12')])&&!_[_0x5dcd('0x11')](_0x55037e[_0x1e1161[_0x5dcd('0x12')]])&&!_[_0x5dcd('0x11')](_0x55037e[_0x1e1161['IntervalId']]['Intervals'])){_0x29c3e1=_[_0x5dcd('0x13')](_0x55037e[_0x1e1161[_0x5dcd('0x12')]]['Intervals'],_0x5dcd('0x14'));}else if(!_[_0x5dcd('0x11')](_0x1e1161[_0x5dcd('0x14')])){_0x29c3e1=[_0x1e1161[_0x5dcd('0x14')]];}return _0x29c3e1;}exports[_0x5dcd('0x15')]=function(_0x2ff0cb){_0x2ff0cb[_0x5dcd('0x16')]={};return new BPromise(function(_0x40062e,_0x5cc0d7){var _0x9ebce6={'Start':function(_0x2b61bf){var _0x538be9=this;return new Promise(function(_0x43b71f,_0x537aed){if(_0x2b61bf){try{var _0x3a9ab9=[];var _0x67a19e=getId(_0x2b61bf[_0x5dcd('0x17')],_0x2b61bf['message']?_0x2b61bf[_0x5dcd('0x18')]['id']:0x0,_0x2b61bf[_0x5dcd('0x19')]?_0x2b61bf[_0x5dcd('0x19')]['id']:0x0);var _0x5074b2=sUtils[_0x5dcd('0x1a')](_0x2ff0cb,_0x2b61bf);if(_0x2b61bf[_0x5dcd('0x1b')]||!_0x5074b2&&_0x2b61bf[_0x5dcd('0x1c')]&&_['isArray'](_0x2b61bf[_0x5dcd('0x1c')])&&_0x2b61bf[_0x5dcd('0x1c')][_0x5dcd('0x1d')]){for(var _0x3c5045=0x0;_0x3c5045<_0x2b61bf['applications'][_0x5dcd('0x1d')];_0x3c5045+=0x1){var _0x4c392a=_0x2b61bf['applications'][_0x3c5045];if(fs['existsSync'](path[_0x5dcd('0x1e')](__dirname,_0x5dcd('0x1c'),_0x4c392a[_0x5dcd('0x1f')]+_0x5dcd('0x20')))){var _0x305466=[];switch(_0x4c392a[_0x5dcd('0x1f')][_0x5dcd('0x21')]()){case _0x5dcd('0x22'):var _0x40e847=_0x4c392a[_0x5dcd('0x23')]['split'](',');if(_0x2b61bf[_0x5dcd('0x17')]===_0x5dcd('0x24')){_0x305466[_0x5dcd('0x25')](_0x40e847[0x0]);_0x305466['push'](_0x40e847[0x1]);_0x305466[_0x5dcd('0x25')](_0x40e847[_0x5dcd('0x26')](0x2,_0x40e847[_0x5dcd('0x1d')])[_0x5dcd('0x1e')](','));}else{_0x305466[_0x5dcd('0x25')](_0x40e847[0x0]);_0x305466['push'](_0x40e847[_0x5dcd('0x26')](0x1,_0x40e847[_0x5dcd('0x1d')])[_0x5dcd('0x1e')](','));}break;case _0x5dcd('0x27'):var _0x379f3c=_0x4c392a['appdata'][_0x5dcd('0x28')](',');_0x305466[_0x5dcd('0x25')](_0x379f3c[0x0]);_0x305466[_0x5dcd('0x25')](_0x379f3c[0x1]);_0x305466[_0x5dcd('0x25')](_0x379f3c[_0x5dcd('0x26')](0x2,_0x379f3c[_0x5dcd('0x1d')])[_0x5dcd('0x1e')](','));break;case _0x5dcd('0x29'):var _0x18c38f=_0x4c392a[_0x5dcd('0x23')]['split'](',');_0x305466[_0x5dcd('0x25')](_0x18c38f[0x0]);_0x305466['push'](_0x18c38f[0x1]);_0x305466['push'](_0x18c38f[0x2]);_0x305466[_0x5dcd('0x25')](_0x18c38f[0x3]);_0x305466[_0x5dcd('0x25')](_0x18c38f['slice'](0x4,_0x18c38f[_0x5dcd('0x1d')])[_0x5dcd('0x1e')](','));break;case'amazonlex':var _0x1893ba=_0x4c392a[_0x5dcd('0x23')][_0x5dcd('0x28')](',');_0x305466[_0x5dcd('0x25')](_0x1893ba[0x0]);_0x305466['push'](_0x1893ba[0x1]);_0x305466['push'](_0x1893ba[0x2]);_0x305466[_0x5dcd('0x25')](_0x1893ba[0x3]);_0x305466[_0x5dcd('0x25')](_0x1893ba['slice'](0x4,_0x1893ba['length'])[_0x5dcd('0x1e')](','));break;case'message':_0x305466[_0x5dcd('0x25')](_0x4c392a['appdata']);break;case'tag':_0x305466[_0x5dcd('0x25')](_0x4c392a[_0x5dcd('0x2a')]);_0x305466[_0x5dcd('0x25')](_0x4c392a[_0x5dcd('0x23')]);break;case _0x5dcd('0x2b'):var _0x17917e=utils[_0x5dcd('0x2c')](_0x2b61bf[_0x5dcd('0x2d')][_0x5dcd('0x2e')],_0x2b61bf);var _0x46c543=_0x4c392a[_0x5dcd('0x23')][_0x5dcd('0x28')](',');_0x305466[_0x5dcd('0x25')](_0x46c543[0x0]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x1]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x2]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x3]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x4]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x5]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x6]);_0x305466['push'](_0x46c543[0x7]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x8]);_0x305466[_0x5dcd('0x25')](_0x46c543[0x9]);_0x305466['push'](_0x46c543[0xa]);_0x305466[_0x5dcd('0x25')](_0x2b61bf[_0x5dcd('0x19')]['id']);_0x305466[_0x5dcd('0x25')](_0x2b61bf[_0x5dcd('0x18')]['id']);_0x305466[_0x5dcd('0x25')](_0x4c392a[_0x5dcd('0x2f')]);_0x305466[_0x5dcd('0x25')](_0x2b61bf['interaction'][_0x5dcd('0x30')]);_0x305466[_0x5dcd('0x25')](_0x2b61bf[_0x5dcd('0x31')][_0x5dcd('0x31')]);_0x305466[_0x5dcd('0x25')](_0x17917e);break;default:_0x305466=_[_0x5dcd('0x11')](_0x4c392a['appdata'])?[]:_0x4c392a['appdata']['split'](',');}var _0x260b6a={'id':util['format']('%s:%s:%s',_0x67a19e,_0x4c392a['id'],_0x4c392a['app']),'condition':require('./interval')[_0x5dcd('0x32')](_0x67a19e,getIntervals(_0x2ff0cb[_0x5dcd('0x33')],_0x4c392a),_0x2ff0cb),'consequence':require(_0x5dcd('0x34')+_0x4c392a['app'])[_0x5dcd('0x35')](_0x67a19e,_0x305466,_0x2ff0cb,_0x2b61bf),'p':_0x4c392a[_0x5dcd('0x36')]||0x0};logger[_0x5dcd('0x37')](_0x5dcd('0x38'),_0x260b6a['id'],_0x5dcd('0x39'),getIntervals(_0x2ff0cb[_0x5dcd('0x33')],_0x4c392a)[_0x5dcd('0x1e')](_0x5dcd('0x3a')));_0x3a9ab9[_0x5dcd('0x25')](_0x260b6a);}else{logger[_0x5dcd('0x3b')](_0x5dcd('0x3c'),path[_0x5dcd('0x1e')](__dirname,_0x5dcd('0x1c'),_0x4c392a[_0x5dcd('0x1f')]+'.js'));}}_0x2ff0cb['rules'][_0x67a19e]=new RuleEngine(_0x3a9ab9);_0x2ff0cb[_0x5dcd('0x16')][_0x67a19e][_0x5dcd('0x3d')](_0x2b61bf,function(_0x3dc2d8){logger[_0x5dcd('0x37')](_0x5dcd('0x3e'),JSON[_0x5dcd('0x3f')](_0x3dc2d8[_0x5dcd('0x40')]));if(_0x2ff0cb['rules'][_0x67a19e]){_0x2ff0cb[_0x5dcd('0x16')][_0x67a19e][_0x5dcd('0x41')](_0x5dcd('0x42'));}});return _0x43b71f({'code':0xc8,'message':_0x2b61bf});}else{if(_0x5074b2){logger[_0x5dcd('0x37')](util[_0x5dcd('0xf')](_0x5dcd('0x43'),_0x67a19e));}else{logger[_0x5dcd('0x37')](_0x5dcd('0x44'));}return _0x43b71f({'code':0xc8,'message':_0x2b61bf});}}catch(_0xafe56a){logger[_0x5dcd('0x3b')](_0xafe56a[_0x5dcd('0x45')]);return _0x537aed(_0x538be9[_0x5dcd('0x3b')](0x1f4,_0xafe56a));}}return _0x537aed(_0x5dcd('0x46'));});},'AcceptMessage':function(_0x1ab507){var _0x56de07=this;return new Promise(function(_0x345ac6,_0x3fc103){if(_0x1ab507['agent']&&_0x1ab507[_0x5dcd('0x47')]['id']){if(_0x2ff0cb[_0x5dcd('0x48')][_0x1ab507['agent']['id']]){_0x2ff0cb['agents'][_0x1ab507[_0x5dcd('0x47')]['id']][_0x5dcd('0x49')]=![];_0x2ff0cb[_0x5dcd('0x48')][_0x1ab507[_0x5dcd('0x47')]['id']][_0x5dcd('0x4a')]=undefined;}}if(_0x1ab507[_0x5dcd('0x18')]&&_0x1ab507[_0x5dcd('0x18')]['id']){try{var _0x4dd2f0=getId(_0x1ab507[_0x5dcd('0x17')],_0x1ab507[_0x5dcd('0x18')]?_0x1ab507[_0x5dcd('0x18')]['id']:0x0,_0x1ab507[_0x5dcd('0x19')]?_0x1ab507[_0x5dcd('0x19')]['id']:0x0);if(_0x2ff0cb[_0x5dcd('0x16')][_0x4dd2f0]){_0x2ff0cb[_0x5dcd('0x16')][_0x4dd2f0]['emit'](_0x5dcd('0x4b'));if(rpc[_0x1ab507[_0x5dcd('0x17')]+_0x5dcd('0x4c')]){rpc[_0x1ab507[_0x5dcd('0x17')]+'QueueReport'][_0x5dcd('0x4d')](_0x4dd2f0,{'UserId':_0x1ab507[_0x5dcd('0x18')][_0x5dcd('0x4e')]})[_0x5dcd('0x4f')](function(){logger['error'](_0x5dcd('0x50'));});}}return _0x345ac6({'code':0xc8,'message':_0x1ab507});}catch(_0x6c668b){logger[_0x5dcd('0x3b')](_0x6c668b[_0x5dcd('0x45')]);return _0x3fc103(_0x56de07[_0x5dcd('0x3b')](0x1f4,_0x6c668b));}}logger[_0x5dcd('0x3b')](_0x5dcd('0x51'));return _0x3fc103(_0x56de07[_0x5dcd('0x3b')](0x1f4,_0x5dcd('0x51')));});},'RejectMessage':function(_0x4e2b9b){var _0x175188=this;return new Promise(function(_0x1bbe03,_0x345fb7){if(_0x4e2b9b['agent']&&_0x4e2b9b['agent']['id']){try{if(_0x2ff0cb['agents'][_0x4e2b9b['agent']['id']]){_0x2ff0cb['agents'][_0x4e2b9b[_0x5dcd('0x47')]['id']][_0x5dcd('0x49')]=![];_0x2ff0cb['agents'][_0x4e2b9b['agent']['id']][_0x5dcd('0x4a')]=undefined;}return _0x1bbe03({'code':0xc8,'message':_0x4e2b9b});}catch(_0x319112){logger[_0x5dcd('0x3b')](_0x319112[_0x5dcd('0x45')]);return _0x345fb7(_0x175188[_0x5dcd('0x3b')](0x1f4,_0x319112));}}logger[_0x5dcd('0x3b')](_0x5dcd('0x51'));return _0x345fb7(_0x175188['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x70d172){var _0x31304f=this;return new Promise(function(_0x51f494,_0x1bb2e9){if(_0x70d172[_0x5dcd('0x17')]&&_0x70d172[_0x5dcd('0x19')]&&_0x70d172['interaction']['id']){try{var _0x5f58c3=getId(_0x70d172[_0x5dcd('0x17')],_0x70d172[_0x5dcd('0x18')]?_0x70d172[_0x5dcd('0x18')]['id']:0x0,_0x70d172[_0x5dcd('0x19')]?_0x70d172[_0x5dcd('0x19')]['id']:0x0);if(_0x2ff0cb[_0x5dcd('0x16')][_0x5f58c3]){_0x2ff0cb[_0x5dcd('0x16')][_0x5f58c3][_0x5dcd('0x41')](_0x5dcd('0x4b'));}return _0x51f494({'code':0xc8,'message':_0x70d172});}catch(_0x14b81e){logger[_0x5dcd('0x3b')](_0x14b81e[_0x5dcd('0x45')]);return _0x1bb2e9(_0x31304f[_0x5dcd('0x3b')](0x1f4,_0x14b81e));}}logger['error'](_0x5dcd('0x51'));return _0x1bb2e9(_0x31304f['error'](0x1f4,_0x5dcd('0x51')));});},'AgentCapacity':function(_0x574a6c){var _0x4f56a8=this;return new Promise(function(_0x3e72f6,_0x53cd64){if(_0x2ff0cb[_0x5dcd('0x48')][_0x5dcd('0x52')](_0x574a6c['id'])){for(var _0x57fc4f in _0x574a6c[_0x5dcd('0x53')]){if(_0x574a6c[_0x5dcd('0x53')]['hasOwnProperty'](_0x57fc4f)){if(_0x2ff0cb['agents'][_0x574a6c['id']][_0x5dcd('0x52')](_0x57fc4f+_0x5dcd('0x54'))){_0x2ff0cb['agents'][_0x574a6c['id']][_0x57fc4f+_0x5dcd('0x54')]=parseInt(_0x574a6c[_0x5dcd('0x53')][_0x57fc4f],0xa);}}}_0x2ff0cb['agents'][_0x574a6c['id']][_0x5dcd('0x55')]();return _0x3e72f6({'code':0xc8,'message':_0x2ff0cb['agents'][_0x574a6c['id']]});}else{return _0x53cd64(_0x4f56a8[_0x5dcd('0x3b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x562064){return new Promise(function(_0xaff2a9){var _0x48f175=_[_0x5dcd('0x56')](_0x2ff0cb[_0x5dcd('0x48')]);if(_0x562064&&_0x562064['id']){var _0x2697a4=_[_0x5dcd('0x57')](_0x48f175,function(_0x4fa0fa){return _0x4fa0fa['id']===_0x562064['id'];});_0xaff2a9(_0x2697a4);}else{_0xaff2a9({'count':_0x48f175[_0x5dcd('0x1d')],'rows':_0x48f175});}});},'ChatQueues':function(){return new Promise(function(_0x14a292){var _0x5710e6=[];for(var _0x18480c in _0x2ff0cb[_0x5dcd('0x58')]){if(_0x2ff0cb['chatQueues'][_0x5dcd('0x52')](_0x18480c)){var _0x29b0f9=_0x2ff0cb[_0x5dcd('0x58')][_0x18480c];var _0x261b12={'id':_0x29b0f9['id'],'available':_0x29b0f9[_0x5dcd('0x59')],'loggedIn':_0x29b0f9[_0x5dcd('0x5a')],'name':_0x29b0f9[_0x5dcd('0x5b')],'paused':_0x29b0f9[_0x5dcd('0x5c')],'waiting':_0x29b0f9[_0x5dcd('0x5d')]};_0x5710e6['push'](_0x261b12);}}_0x14a292({'count':_0x5710e6[_0x5dcd('0x1d')],'rows':_0x5710e6});});},'MailQueues':function(){return new Promise(function(_0x1a9269){var _0x31cca2=[];for(var _0x528890 in _0x2ff0cb[_0x5dcd('0x5e')]){if(_0x2ff0cb[_0x5dcd('0x5e')]['hasOwnProperty'](_0x528890)){var _0xec28e5=_0x2ff0cb[_0x5dcd('0x5e')][_0x528890];var _0x1db4d1={'id':_0xec28e5['id'],'available':_0xec28e5['available'],'loggedIn':_0xec28e5[_0x5dcd('0x5a')],'name':_0xec28e5[_0x5dcd('0x5b')],'paused':_0xec28e5[_0x5dcd('0x5c')],'waiting':_0xec28e5[_0x5dcd('0x5d')]};_0x31cca2[_0x5dcd('0x25')](_0x1db4d1);}}_0x1a9269({'count':_0x31cca2[_0x5dcd('0x1d')],'rows':_0x31cca2});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a3298){var _0x3b129f=[];for(var _0x1a5d02 in _0x2ff0cb[_0x5dcd('0x5f')]){if(_0x2ff0cb[_0x5dcd('0x5f')][_0x5dcd('0x52')](_0x1a5d02)){var _0x160a7c=_0x2ff0cb[_0x5dcd('0x5f')][_0x1a5d02];var _0x2e2bf4={'id':_0x160a7c['id'],'available':_0x160a7c[_0x5dcd('0x59')],'loggedIn':_0x160a7c[_0x5dcd('0x5a')],'name':_0x160a7c[_0x5dcd('0x5b')],'paused':_0x160a7c[_0x5dcd('0x5c')],'waiting':_0x160a7c[_0x5dcd('0x5d')]};_0x3b129f[_0x5dcd('0x25')](_0x2e2bf4);}}_0x4a3298({'count':_0x3b129f['length'],'rows':_0x3b129f});});},'SmsQueues':function(){return new Promise(function(_0x1c1884){var _0x8bebf9=[];for(var _0x1cebcc in _0x2ff0cb[_0x5dcd('0x60')]){if(_0x2ff0cb[_0x5dcd('0x60')][_0x5dcd('0x52')](_0x1cebcc)){var _0x13a097=_0x2ff0cb[_0x5dcd('0x60')][_0x1cebcc];var _0x1c37ee={'id':_0x13a097['id'],'available':_0x13a097[_0x5dcd('0x59')],'loggedIn':_0x13a097[_0x5dcd('0x5a')],'name':_0x13a097[_0x5dcd('0x5b')],'paused':_0x13a097[_0x5dcd('0x5c')],'waiting':_0x13a097[_0x5dcd('0x5d')]};_0x8bebf9[_0x5dcd('0x25')](_0x1c37ee);}}_0x1c1884({'count':_0x8bebf9[_0x5dcd('0x1d')],'rows':_0x8bebf9});});},'FaxQueues':function(){return new Promise(function(_0x20ada6){var _0x3b3da3=[];for(var _0x2d7ec9 in _0x2ff0cb[_0x5dcd('0x61')]){if(_0x2ff0cb[_0x5dcd('0x61')][_0x5dcd('0x52')](_0x2d7ec9)){var _0x5acaaa=_0x2ff0cb[_0x5dcd('0x61')][_0x2d7ec9];var _0x40e727={'id':_0x5acaaa['id'],'available':_0x5acaaa[_0x5dcd('0x59')],'loggedIn':_0x5acaaa[_0x5dcd('0x5a')],'name':_0x5acaaa[_0x5dcd('0x5b')],'paused':_0x5acaaa[_0x5dcd('0x5c')],'waiting':_0x5acaaa[_0x5dcd('0x5d')]};_0x3b3da3[_0x5dcd('0x25')](_0x40e727);}}_0x20ada6({'count':_0x3b3da3['length'],'rows':_0x3b3da3});});},'WhatsappQueues':function(){return new Promise(function(_0x54c6c6){var _0x4b47f6=[];for(var _0x593059 in _0x2ff0cb[_0x5dcd('0x62')]){if(_0x2ff0cb[_0x5dcd('0x62')][_0x5dcd('0x52')](_0x593059)){var _0x58ae3e=_0x2ff0cb[_0x5dcd('0x62')][_0x593059];var _0x593e65={'id':_0x58ae3e['id'],'available':_0x58ae3e['available'],'loggedIn':_0x58ae3e[_0x5dcd('0x5a')],'name':_0x58ae3e[_0x5dcd('0x5b')],'paused':_0x58ae3e['paused'],'waiting':_0x58ae3e['waiting']};_0x4b47f6[_0x5dcd('0x25')](_0x593e65);}}_0x54c6c6({'count':_0x4b47f6[_0x5dcd('0x1d')],'rows':_0x4b47f6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5d6d6a){var _0x144177=_[_0x5dcd('0x56')](_0x2ff0cb[_0x5dcd('0x63')]);_0x5d6d6a({'count':_0x144177[_0x5dcd('0x1d')],'rows':_0x144177});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x16f14a){var _0x3d9c74=_[_0x5dcd('0x56')](_0x2ff0cb[_0x5dcd('0x64')]);_0x16f14a({'count':_0x3d9c74['length'],'rows':_0x3d9c74});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3e3298){var _0x3a032d=_['values'](_0x2ff0cb['openchannelQueuesWaitingInteractions']);_0x3e3298({'count':_0x3a032d['length'],'rows':_0x3a032d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x31416c){var _0x27693d=_[_0x5dcd('0x56')](_0x2ff0cb['smsQueuesWaitingInteractions']);_0x31416c({'count':_0x27693d[_0x5dcd('0x1d')],'rows':_0x27693d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x46f1cd){var _0x141e04=_[_0x5dcd('0x56')](_0x2ff0cb[_0x5dcd('0x65')]);_0x46f1cd({'count':_0x141e04[_0x5dcd('0x1d')],'rows':_0x141e04});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x27561b){var _0x1e61f3=_[_0x5dcd('0x56')](_0x2ff0cb[_0x5dcd('0x66')]);_0x27561b({'count':_0x1e61f3[_0x5dcd('0x1d')],'rows':_0x1e61f3});});}};var _0xd632b3=jayson[_0x5dcd('0x67')](_0x9ebce6)[_0x5dcd('0x68')]();_0xd632b3['on'](_0x5dcd('0x3b'),function(_0x2a1f2a){logger[_0x5dcd('0x3b')](JSON[_0x5dcd('0x3f')](_0x2a1f2a));return _0x5cc0d7(_0x2a1f2a);});_0xd632b3[_0x5dcd('0x15')](0x232c,'127.0.0.1',function(){console[_0x5dcd('0x69')](_0x5dcd('0x6a'),0x232c);return _0x40062e(_0x5dcd('0x6b')+0x232c);});});}; \ No newline at end of file +var _0xd98a=['%s:%s:%s','./interval','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','execute','Applications\x20executed','stringify','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','waiting','mailQueues','paused','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','message','tag','TagId','getMustacheRender','account','ChatWebsiteId','ContactId','body','format'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd98a,0xfc));var _0xad98=function(_0x1bacf8,_0x14fef4){_0x1bacf8=_0x1bacf8-0x0;var _0x5556d9=_0xd98a[_0x1bacf8];return _0x5556d9;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xad98('0x1'));var BPromise=require(_0xad98('0x2'));var utils=require(_0xad98('0x3'));var sUtils=require(_0xad98('0x4'));var logger=require(_0xad98('0x5'))(_0xad98('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xad98('0x7')),'smsQueueReport':require(_0xad98('0x8')),'faxQueueReport':require(_0xad98('0x9')),'whatsappQueueReport':require(_0xad98('0xa'))};var RuleEngine=require(_0xad98('0xb'));function getId(_0x480c93,_0x20712b,_0x34eb2d){return util['format'](_0xad98('0xc'),_0x480c93,_0x20712b||0x0,_0x34eb2d||0x0);}function getIntervals(_0x5016b4,_0x145cbe){var _0x525e32=[];if(!_['isNil'](_0x145cbe['IntervalId'])&&!_[_0xad98('0xd')](_0x5016b4[_0x145cbe[_0xad98('0xe')]])&&!_[_0xad98('0xd')](_0x5016b4[_0x145cbe[_0xad98('0xe')]]['Intervals'])){_0x525e32=_['map'](_0x5016b4[_0x145cbe[_0xad98('0xe')]][_0xad98('0xf')],_0xad98('0x10'));}else if(!_[_0xad98('0xd')](_0x145cbe[_0xad98('0x10')])){_0x525e32=[_0x145cbe[_0xad98('0x10')]];}return _0x525e32;}exports[_0xad98('0x11')]=function(_0x1f033b){_0x1f033b[_0xad98('0x12')]={};return new BPromise(function(_0x5b2df6,_0x18886f){var _0x3747eb={'Start':function(_0x338589){var _0x354a4c=this;return new Promise(function(_0x408e2a,_0x2b3ee3){if(_0x338589){try{var _0x2ebb87=[];var _0x41647d=getId(_0x338589[_0xad98('0x13')],_0x338589['message']?_0x338589['message']['id']:0x0,_0x338589[_0xad98('0x14')]?_0x338589['interaction']['id']:0x0);var _0x19d355=sUtils[_0xad98('0x15')](_0x1f033b,_0x338589);if(_0x338589[_0xad98('0x16')]||!_0x19d355&&_0x338589[_0xad98('0x17')]&&_[_0xad98('0x18')](_0x338589[_0xad98('0x17')])&&_0x338589[_0xad98('0x17')][_0xad98('0x19')]){for(var _0x532a16=0x0;_0x532a16<_0x338589['applications'][_0xad98('0x19')];_0x532a16+=0x1){var _0x5d76e5=_0x338589[_0xad98('0x17')][_0x532a16];if(fs[_0xad98('0x1a')](path[_0xad98('0x1b')](__dirname,_0xad98('0x17'),_0x5d76e5[_0xad98('0x1c')]+_0xad98('0x1d')))){var _0x28ce36=[];switch(_0x5d76e5[_0xad98('0x1c')][_0xad98('0x1e')]()){case _0xad98('0x1f'):var _0xa04f8f=_0x5d76e5[_0xad98('0x20')][_0xad98('0x21')](',');if(_0x338589['channel']===_0xad98('0x22')){_0x28ce36[_0xad98('0x23')](_0xa04f8f[0x0]);_0x28ce36[_0xad98('0x23')](_0xa04f8f[0x1]);_0x28ce36[_0xad98('0x23')](_0xa04f8f['slice'](0x2,_0xa04f8f[_0xad98('0x19')])[_0xad98('0x1b')](','));}else{_0x28ce36[_0xad98('0x23')](_0xa04f8f[0x0]);_0x28ce36[_0xad98('0x23')](_0xa04f8f[_0xad98('0x24')](0x1,_0xa04f8f[_0xad98('0x19')])[_0xad98('0x1b')](','));}break;case _0xad98('0x25'):var _0x53e5fc=_0x5d76e5[_0xad98('0x20')][_0xad98('0x21')](',');_0x28ce36[_0xad98('0x23')](_0x53e5fc[0x0]);_0x28ce36[_0xad98('0x23')](_0x53e5fc[0x1]);_0x28ce36[_0xad98('0x23')](_0x53e5fc[_0xad98('0x24')](0x2,_0x53e5fc[_0xad98('0x19')])[_0xad98('0x1b')](','));break;case'dialogflowv2':var _0x384709=_0x5d76e5[_0xad98('0x20')][_0xad98('0x21')](',');_0x28ce36['push'](_0x384709[0x0]);_0x28ce36[_0xad98('0x23')](_0x384709[0x1]);_0x28ce36[_0xad98('0x23')](_0x384709[0x2]);_0x28ce36[_0xad98('0x23')](_0x384709[0x3]);_0x28ce36[_0xad98('0x23')](_0x384709['slice'](0x4,_0x384709[_0xad98('0x19')])[_0xad98('0x1b')](','));break;case _0xad98('0x26'):var _0x2ca32f=_0x5d76e5['appdata'][_0xad98('0x21')](',');_0x28ce36[_0xad98('0x23')](_0x2ca32f[0x0]);_0x28ce36[_0xad98('0x23')](_0x2ca32f[0x1]);_0x28ce36[_0xad98('0x23')](_0x2ca32f[0x2]);_0x28ce36['push'](_0x2ca32f[0x3]);_0x28ce36[_0xad98('0x23')](_0x2ca32f[_0xad98('0x24')](0x4,_0x2ca32f[_0xad98('0x19')])['join'](','));break;case _0xad98('0x27'):_0x28ce36[_0xad98('0x23')](_0x5d76e5[_0xad98('0x20')]);break;case _0xad98('0x28'):_0x28ce36['push'](_0x5d76e5[_0xad98('0x29')]);_0x28ce36[_0xad98('0x23')](_0x5d76e5[_0xad98('0x20')]);break;case'tvox':var _0x1b9300=utils[_0xad98('0x2a')](_0x338589[_0xad98('0x2b')]['notificationTemplate'],_0x338589);var _0x4e5f15=_0x5d76e5[_0xad98('0x20')]['split'](',');_0x28ce36['push'](_0x4e5f15[0x0]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x1]);_0x28ce36['push'](_0x4e5f15[0x2]);_0x28ce36['push'](_0x4e5f15[0x3]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x4]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x5]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x6]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x7]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x8]);_0x28ce36[_0xad98('0x23')](_0x4e5f15[0x9]);_0x28ce36['push'](_0x4e5f15[0xa]);_0x28ce36[_0xad98('0x23')](_0x338589[_0xad98('0x14')]['id']);_0x28ce36[_0xad98('0x23')](_0x338589[_0xad98('0x27')]['id']);_0x28ce36['push'](_0x5d76e5[_0xad98('0x2c')]);_0x28ce36[_0xad98('0x23')](_0x338589[_0xad98('0x14')][_0xad98('0x2d')]);_0x28ce36[_0xad98('0x23')](_0x338589[_0xad98('0x2e')][_0xad98('0x2e')]);_0x28ce36[_0xad98('0x23')](_0x1b9300);break;default:_0x28ce36=_[_0xad98('0xd')](_0x5d76e5['appdata'])?[]:_0x5d76e5['appdata']['split'](',');}var _0x45b1ca={'id':util[_0xad98('0x2f')](_0xad98('0x30'),_0x41647d,_0x5d76e5['id'],_0x5d76e5[_0xad98('0x1c')]),'condition':require(_0xad98('0x31'))['condition'](_0x41647d,getIntervals(_0x1f033b['intervals'],_0x5d76e5),_0x1f033b),'consequence':require(_0xad98('0x32')+_0x5d76e5[_0xad98('0x1c')])[_0xad98('0x33')](_0x41647d,_0x28ce36,_0x1f033b,_0x338589),'p':_0x5d76e5[_0xad98('0x34')]||0x0};logger[_0xad98('0x35')](_0xad98('0x36'),_0x45b1ca['id'],'on\x20interval',getIntervals(_0x1f033b['intervals'],_0x5d76e5)[_0xad98('0x1b')](_0xad98('0x37')));_0x2ebb87[_0xad98('0x23')](_0x45b1ca);}else{logger[_0xad98('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xad98('0x1b')](__dirname,'applications',_0x5d76e5['app']+'.js'));}}_0x1f033b[_0xad98('0x12')][_0x41647d]=new RuleEngine(_0x2ebb87);_0x1f033b[_0xad98('0x12')][_0x41647d][_0xad98('0x39')](_0x338589,function(_0x1a59c2){logger[_0xad98('0x35')](_0xad98('0x3a'),JSON[_0xad98('0x3b')](_0x1a59c2['matchPath']));if(_0x1f033b['rules'][_0x41647d]){_0x1f033b[_0xad98('0x12')][_0x41647d]['emit'](_0xad98('0x3c'));}});return _0x408e2a({'code':0xc8,'message':_0x338589});}else{if(_0x19d355){logger[_0xad98('0x35')](util['format']('Skipped\x20routing\x20for\x20%s',_0x41647d));}else{logger['info'](_0xad98('0x3d'));}return _0x408e2a({'code':0xc8,'message':_0x338589});}}catch(_0x11b5eb){logger['error'](_0x11b5eb[_0xad98('0x3e')]);return _0x2b3ee3(_0x354a4c['error'](0x1f4,_0x11b5eb));}}return _0x2b3ee3(_0xad98('0x3f'));});},'AcceptMessage':function(_0x4b34c9){var _0x44013f=this;return new Promise(function(_0x30eda9,_0x1bf478){if(_0x4b34c9[_0xad98('0x40')]&&_0x4b34c9[_0xad98('0x40')]['id']){if(_0x1f033b[_0xad98('0x41')][_0x4b34c9['agent']['id']]){_0x1f033b[_0xad98('0x41')][_0x4b34c9[_0xad98('0x40')]['id']][_0xad98('0x42')]=![];_0x1f033b[_0xad98('0x41')][_0x4b34c9[_0xad98('0x40')]['id']][_0xad98('0x43')]=undefined;}}if(_0x4b34c9[_0xad98('0x27')]&&_0x4b34c9[_0xad98('0x27')]['id']){try{var _0x5b6d63=getId(_0x4b34c9[_0xad98('0x13')],_0x4b34c9[_0xad98('0x27')]?_0x4b34c9[_0xad98('0x27')]['id']:0x0,_0x4b34c9['interaction']?_0x4b34c9['interaction']['id']:0x0);if(_0x1f033b['rules'][_0x5b6d63]){_0x1f033b[_0xad98('0x12')][_0x5b6d63][_0xad98('0x44')](_0xad98('0x45'));if(rpc[_0x4b34c9[_0xad98('0x13')]+_0xad98('0x46')]){rpc[_0x4b34c9[_0xad98('0x13')]+_0xad98('0x46')]['update'](_0x5b6d63,{'UserId':_0x4b34c9[_0xad98('0x27')]['UserId']})[_0xad98('0x47')](function(){logger['error'](_0xad98('0x48'));});}}return _0x30eda9({'code':0xc8,'message':_0x4b34c9});}catch(_0x1d3920){logger['error'](_0x1d3920['stack']);return _0x1bf478(_0x44013f[_0xad98('0x38')](0x1f4,_0x1d3920));}}logger['error'](_0xad98('0x49'));return _0x1bf478(_0x44013f[_0xad98('0x38')](0x1f4,_0xad98('0x49')));});},'RejectMessage':function(_0x4a82e6){var _0xefeeaf=this;return new Promise(function(_0x1e2270,_0xd40b60){if(_0x4a82e6[_0xad98('0x40')]&&_0x4a82e6[_0xad98('0x40')]['id']){try{if(_0x1f033b[_0xad98('0x41')][_0x4a82e6['agent']['id']]){_0x1f033b[_0xad98('0x41')][_0x4a82e6[_0xad98('0x40')]['id']][_0xad98('0x42')]=![];_0x1f033b[_0xad98('0x41')][_0x4a82e6[_0xad98('0x40')]['id']][_0xad98('0x43')]=undefined;}return _0x1e2270({'code':0xc8,'message':_0x4a82e6});}catch(_0x3e8cd8){logger[_0xad98('0x38')](_0x3e8cd8['stack']);return _0xd40b60(_0xefeeaf[_0xad98('0x38')](0x1f4,_0x3e8cd8));}}logger[_0xad98('0x38')](_0xad98('0x49'));return _0xd40b60(_0xefeeaf[_0xad98('0x38')](0x1f4,_0xad98('0x49')));});},'AbandonInteraction':function(_0x3ded4e){var _0xd501d9=this;return new Promise(function(_0x4d19b1,_0x58ff2f){if(_0x3ded4e[_0xad98('0x13')]&&_0x3ded4e[_0xad98('0x14')]&&_0x3ded4e['interaction']['id']){try{var _0x54ad4d=getId(_0x3ded4e['channel'],_0x3ded4e['message']?_0x3ded4e[_0xad98('0x27')]['id']:0x0,_0x3ded4e[_0xad98('0x14')]?_0x3ded4e[_0xad98('0x14')]['id']:0x0);if(_0x1f033b[_0xad98('0x12')][_0x54ad4d]){_0x1f033b[_0xad98('0x12')][_0x54ad4d][_0xad98('0x44')](_0xad98('0x45'));}return _0x4d19b1({'code':0xc8,'message':_0x3ded4e});}catch(_0x5e2ff8){logger[_0xad98('0x38')](_0x5e2ff8[_0xad98('0x3e')]);return _0x58ff2f(_0xd501d9[_0xad98('0x38')](0x1f4,_0x5e2ff8));}}logger[_0xad98('0x38')](_0xad98('0x49'));return _0x58ff2f(_0xd501d9[_0xad98('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xec9415){var _0x5d551f=this;return new Promise(function(_0x456709,_0x4eb0cf){if(_0x1f033b[_0xad98('0x41')]['hasOwnProperty'](_0xec9415['id'])){for(var _0x2df21d in _0xec9415[_0xad98('0x4a')]){if(_0xec9415[_0xad98('0x4a')][_0xad98('0x4b')](_0x2df21d)){if(_0x1f033b['agents'][_0xec9415['id']][_0xad98('0x4b')](_0x2df21d+_0xad98('0x4c'))){_0x1f033b[_0xad98('0x41')][_0xec9415['id']][_0x2df21d+_0xad98('0x4c')]=parseInt(_0xec9415[_0xad98('0x4a')][_0x2df21d],0xa);}}}_0x1f033b['agents'][_0xec9415['id']][_0xad98('0x4d')]();return _0x456709({'code':0xc8,'message':_0x1f033b[_0xad98('0x41')][_0xec9415['id']]});}else{return _0x4eb0cf(_0x5d551f[_0xad98('0x38')](0x1f4,_0xad98('0x4e')));}});},'Agents':function(_0x2abf3f){return new Promise(function(_0x30d23e){var _0x31c14e=_[_0xad98('0x4f')](_0x1f033b['agents']);if(_0x2abf3f&&_0x2abf3f['id']){var _0x254557=_[_0xad98('0x50')](_0x31c14e,function(_0x446b23){return _0x446b23['id']===_0x2abf3f['id'];});_0x30d23e(_0x254557);}else{_0x30d23e({'count':_0x31c14e[_0xad98('0x19')],'rows':_0x31c14e});}});},'ChatQueues':function(){return new Promise(function(_0x441e4e){var _0x1839bf=[];for(var _0x2ee608 in _0x1f033b[_0xad98('0x51')]){if(_0x1f033b[_0xad98('0x51')][_0xad98('0x4b')](_0x2ee608)){var _0x36e801=_0x1f033b[_0xad98('0x51')][_0x2ee608];var _0x4eea98={'id':_0x36e801['id'],'available':_0x36e801[_0xad98('0x52')],'loggedIn':_0x36e801['loggedIn'],'name':_0x36e801[_0xad98('0x53')],'paused':_0x36e801['paused'],'waiting':_0x36e801[_0xad98('0x54')]};_0x1839bf[_0xad98('0x23')](_0x4eea98);}}_0x441e4e({'count':_0x1839bf['length'],'rows':_0x1839bf});});},'MailQueues':function(){return new Promise(function(_0x39b129){var _0x417ae5=[];for(var _0x315cce in _0x1f033b[_0xad98('0x55')]){if(_0x1f033b[_0xad98('0x55')]['hasOwnProperty'](_0x315cce)){var _0x38741d=_0x1f033b['mailQueues'][_0x315cce];var _0x2d5284={'id':_0x38741d['id'],'available':_0x38741d[_0xad98('0x52')],'loggedIn':_0x38741d['loggedIn'],'name':_0x38741d[_0xad98('0x53')],'paused':_0x38741d[_0xad98('0x56')],'waiting':_0x38741d['waiting']};_0x417ae5[_0xad98('0x23')](_0x2d5284);}}_0x39b129({'count':_0x417ae5['length'],'rows':_0x417ae5});});},'OpenchannelQueues':function(){return new Promise(function(_0x3b9438){var _0x38685e=[];for(var _0x1bafd4 in _0x1f033b[_0xad98('0x57')]){if(_0x1f033b['openchannelQueues'][_0xad98('0x4b')](_0x1bafd4)){var _0x51d4c0=_0x1f033b[_0xad98('0x57')][_0x1bafd4];var _0xf258ec={'id':_0x51d4c0['id'],'available':_0x51d4c0[_0xad98('0x52')],'loggedIn':_0x51d4c0[_0xad98('0x58')],'name':_0x51d4c0[_0xad98('0x53')],'paused':_0x51d4c0[_0xad98('0x56')],'waiting':_0x51d4c0[_0xad98('0x54')]};_0x38685e[_0xad98('0x23')](_0xf258ec);}}_0x3b9438({'count':_0x38685e[_0xad98('0x19')],'rows':_0x38685e});});},'SmsQueues':function(){return new Promise(function(_0x2c6526){var _0x49b536=[];for(var _0x595b09 in _0x1f033b[_0xad98('0x59')]){if(_0x1f033b[_0xad98('0x59')][_0xad98('0x4b')](_0x595b09)){var _0x1f1a09=_0x1f033b[_0xad98('0x59')][_0x595b09];var _0x58643e={'id':_0x1f1a09['id'],'available':_0x1f1a09[_0xad98('0x52')],'loggedIn':_0x1f1a09[_0xad98('0x58')],'name':_0x1f1a09['name'],'paused':_0x1f1a09[_0xad98('0x56')],'waiting':_0x1f1a09[_0xad98('0x54')]};_0x49b536[_0xad98('0x23')](_0x58643e);}}_0x2c6526({'count':_0x49b536[_0xad98('0x19')],'rows':_0x49b536});});},'FaxQueues':function(){return new Promise(function(_0x1fd0ca){var _0x1b4495=[];for(var _0x2c4a55 in _0x1f033b[_0xad98('0x5a')]){if(_0x1f033b[_0xad98('0x5a')][_0xad98('0x4b')](_0x2c4a55)){var _0x4f0acd=_0x1f033b[_0xad98('0x5a')][_0x2c4a55];var _0x1f6984={'id':_0x4f0acd['id'],'available':_0x4f0acd['available'],'loggedIn':_0x4f0acd[_0xad98('0x58')],'name':_0x4f0acd[_0xad98('0x53')],'paused':_0x4f0acd[_0xad98('0x56')],'waiting':_0x4f0acd['waiting']};_0x1b4495['push'](_0x1f6984);}}_0x1fd0ca({'count':_0x1b4495[_0xad98('0x19')],'rows':_0x1b4495});});},'WhatsappQueues':function(){return new Promise(function(_0x3a3c5b){var _0x267ffc=[];for(var _0x1b707b in _0x1f033b[_0xad98('0x5b')]){if(_0x1f033b['whatsappQueues']['hasOwnProperty'](_0x1b707b)){var _0xadaf8c=_0x1f033b[_0xad98('0x5b')][_0x1b707b];var _0x2330af={'id':_0xadaf8c['id'],'available':_0xadaf8c['available'],'loggedIn':_0xadaf8c[_0xad98('0x58')],'name':_0xadaf8c['name'],'paused':_0xadaf8c[_0xad98('0x56')],'waiting':_0xadaf8c[_0xad98('0x54')]};_0x267ffc[_0xad98('0x23')](_0x2330af);}}_0x3a3c5b({'count':_0x267ffc[_0xad98('0x19')],'rows':_0x267ffc});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3a80fa){var _0x317446=_[_0xad98('0x4f')](_0x1f033b['chatQueuesWaitingInteractions']);_0x3a80fa({'count':_0x317446[_0xad98('0x19')],'rows':_0x317446});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x942d77){var _0x6e767a=_[_0xad98('0x4f')](_0x1f033b['mailQueuesWaitingInteractions']);_0x942d77({'count':_0x6e767a[_0xad98('0x19')],'rows':_0x6e767a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x29e8df){var _0x50773c=_[_0xad98('0x4f')](_0x1f033b['openchannelQueuesWaitingInteractions']);_0x29e8df({'count':_0x50773c[_0xad98('0x19')],'rows':_0x50773c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2baf5a){var _0x57e72d=_[_0xad98('0x4f')](_0x1f033b[_0xad98('0x5c')]);_0x2baf5a({'count':_0x57e72d[_0xad98('0x19')],'rows':_0x57e72d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5c8ac5){var _0x35315b=_[_0xad98('0x4f')](_0x1f033b[_0xad98('0x5d')]);_0x5c8ac5({'count':_0x35315b['length'],'rows':_0x35315b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5077e6){var _0xa42193=_['values'](_0x1f033b[_0xad98('0x5e')]);_0x5077e6({'count':_0xa42193[_0xad98('0x19')],'rows':_0xa42193});});}};var _0x1b0c78=jayson[_0xad98('0x5f')](_0x3747eb)[_0xad98('0x60')]();_0x1b0c78['on']('error',function(_0x3bd16b){logger[_0xad98('0x38')](JSON[_0xad98('0x3b')](_0x3bd16b));return _0x18886f(_0x3bd16b);});_0x1b0c78[_0xad98('0x11')](0x232c,'127.0.0.1',function(){console[_0xad98('0x61')](_0xad98('0x62'),0x232c);return _0x5b2df6(_0xad98('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index da601d2..90977e0 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 _0x3967=['map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','stop','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x3967,0xd8));var _0x7396=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x3967[_0x538c70];return _0x42ae01;};'use strict';var _=require(_0x7396('0x0'));var iftime=require(_0x7396('0x1'))[_0x7396('0x2')];var logger=require(_0x7396('0x3'))(_0x7396('0x4'));exports[_0x7396('0x5')]=function(_0x20f09b,_0x219683,_0x1df82e){return function(_0xe64482){if(_0x1df82e['rules']&&!_0x1df82e['rules'][_0x20f09b]){logger[_0x7396('0x6')](_0x7396('0x7'),_0x20f09b);return _0xe64482['stop']();}var _0x28e426=_0x219683[_0x7396('0x8')](function(_0x3e31d6){return iftime(_0x3e31d6);});var _0x267080=_[_0x7396('0x9')](_0x28e426);if(_0x267080){logger[_0x7396('0x6')](_0x7396('0xa'),_0x20f09b,_0x219683['join'](_0x7396('0xb')),_0x267080);_0xe64482[_0x7396('0xc')](_0x267080);}else{logger[_0x7396('0x6')](_0x7396('0xd'),_0x20f09b,_0x219683[_0x7396('0xe')](_0x7396('0xb')));_0xe64482[_0x7396('0xf')]();}};}; \ No newline at end of file +var _0x79e1=['stop','map','some','info','join','\x20|\x20','when','lodash','iftime','../../../config/logger','routing','condition','rules'];(function(_0x31eaeb,_0x56c19e){var _0x43862f=function(_0x5ebacb){while(--_0x5ebacb){_0x31eaeb['push'](_0x31eaeb['shift']());}};_0x43862f(++_0x56c19e);}(_0x79e1,0xd7));var _0x179e=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x79e1[_0x54eab6];return _0x1e7435;};'use strict';var _=require(_0x179e('0x0'));var iftime=require('../../../utils/iftime')[_0x179e('0x1')];var logger=require(_0x179e('0x2'))(_0x179e('0x3'));exports[_0x179e('0x4')]=function(_0xc5b9e1,_0x2c0efe,_0x39d363){return function(_0x46550c){if(_0x39d363[_0x179e('0x5')]&&!_0x39d363[_0x179e('0x5')][_0xc5b9e1]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xc5b9e1);return _0x46550c[_0x179e('0x6')]();}var _0x4ec007=_0x2c0efe[_0x179e('0x7')](function(_0x4f3f8a){return iftime(_0x4f3f8a);});var _0x2a7276=_[_0x179e('0x8')](_0x4ec007);if(_0x2a7276){logger[_0x179e('0x9')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0xc5b9e1,_0x2c0efe[_0x179e('0xa')](_0x179e('0xb')),_0x2a7276);_0x46550c[_0x179e('0xc')](_0x2a7276);}else{logger['info']('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0xc5b9e1,_0x2c0efe['join'](_0x179e('0xb')));_0x46550c['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bd76eaa..d4c6df0 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 _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x239bc8,_0x5a4273){var _0x3f0b08=function(_0x189fc8){while(--_0x189fc8){_0x239bc8['push'](_0x239bc8['shift']());}};_0x3f0b08(++_0x5a4273);}(_0x9348,0x10d));var _0x8934=function(_0x519725,_0x5874a9){_0x519725=_0x519725-0x0;var _0x5de0be=_0x9348[_0x519725];return _0x5de0be;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file +var _0x4024=['push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','format','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','then','type','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','timeout','reason','ringtime','talktime'];(function(_0x5254b1,_0x471ede){var _0xfaddd4=function(_0x561207){while(--_0x561207){_0x5254b1['push'](_0x5254b1['shift']());}};_0xfaddd4(++_0x471ede);}(_0x4024,0x89));var _0x4402=function(_0x56389a,_0x2e4e22){_0x56389a=_0x56389a-0x0;var _0x287b5d=_0x4024[_0x56389a];return _0x287b5d;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3074ac,_0x2b36c7){utils['info'](util[_0x4402('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3074ac[_0x4402('0x3')],_0x3074ac[_0x4402('0x4')],_0x3074ac['queue'],_0x3074ac['membername'],_0x3074ac[_0x4402('0x5')],_0x3074ac[_0x4402('0x6')],_0x3074ac[_0x4402('0x7')],_0x3074ac['lastevent']));if(_0x3074ac[_0x4402('0x8')]){utils['getVoiceQueueByName'](_0x3074ac['queue'])[_0x4402('0x9')](function(_0x4c6ca4){if(_0x4c6ca4){_0x3074ac['type']=_0x4c6ca4[_0x4402('0xa')];_0x3074ac['agentacw']=_0x3074ac[_0x4402('0xb')]?_0x4c6ca4['acw']:![];_0x3074ac[_0x4402('0xc')]=_0x3074ac['agentacw']?_0x4c6ca4[_0x4402('0xd')]:0x0;}utils[_0x4402('0xe')]('CreateVoiceAgentReport',_0x3074ac);});}else{utils[_0x4402('0xe')](_0x4402('0xf'),_0x3074ac);}if(_0x2b36c7){delete transfers[_0x3074ac[_0x4402('0x3')]];}else{delete agents[_0x3074ac['destuniqueid']];}}exports[_0x4402('0x10')]=function(_0x34d952){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x12'),_0x34d952[_0x4402('0x3')]),_0x34d952);agents[_0x34d952[_0x4402('0x13')]]=_0x34d952;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x16')]=_0x4402('0x17');agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x7')]=null;agents[_0x34d952[_0x4402('0x13')]][_0x4402('0x18')]=null;utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x1a'),_0x34d952['uniqueid'],agents[_0x34d952['destuniqueid']][_0x4402('0x1b')],_0x34d952[_0x4402('0x13')]));}catch(_0x5681c5){utils[_0x4402('0x1c')](util[_0x4402('0x2')]('[%s][agents][agentcalled]',_0x34d952[_0x4402('0x3')]),_0x5681c5);}};exports['agentringnoanswer']=function(_0x55cc8c){try{if(!_[_0x4402('0x1d')](agents[_0x55cc8c[_0x4402('0x13')]])){utils[_0x4402('0x11')](util['format'](_0x4402('0x1e'),_0x55cc8c['uniqueid']),_0x55cc8c);utils['info'](util[_0x4402('0x2')](_0x4402('0x1f'),_0x55cc8c[_0x4402('0x3')],agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x1b')],_0x55cc8c[_0x4402('0x13')]));agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x20')]=!![];agents[_0x55cc8c[_0x4402('0x13')]]['agentringnoanswerAt']=utils[_0x4402('0x15')]();agents[_0x55cc8c['destuniqueid']][_0x4402('0x16')]=_0x4402('0x21');agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x22')]='timeout';agents[_0x55cc8c[_0x4402('0x13')]]['holdtime']=_0x55cc8c['ringtime']?parseInt(_0x55cc8c[_0x4402('0x23')])/0x3e8:0x0;agents[_0x55cc8c[_0x4402('0x13')]][_0x4402('0x24')]=0x0;unanswered[_0x4402('0x25')](_0x55cc8c[_0x4402('0x13')]);}}catch(_0x514e41){utils[_0x4402('0x1c')](util['format'](_0x4402('0x1e'),_0x55cc8c[_0x4402('0x3')]),_0x514e41);}};exports[_0x4402('0x26')]=function(_0x48d20d){try{_[_0x4402('0x27')](agents,function(_0x6c87f6,_0x316239){if(_0x6c87f6[_0x4402('0x3')]==_0x48d20d[_0x4402('0x3')]&&!_[_0x4402('0x28')](unanswered,_0x6c87f6[_0x4402('0x13')])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x48d20d);utils['info'](util[_0x4402('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x48d20d[_0x4402('0x3')],_0x6c87f6['membername'],_0x6c87f6[_0x4402('0x13')]));_0x6c87f6[_0x4402('0x20')]=!![];_0x6c87f6[_0x4402('0x2a')]=utils[_0x4402('0x15')]();_0x6c87f6[_0x4402('0x16')]='abandoned';_0x6c87f6[_0x4402('0x22')]=_0x4402('0x2b');_0x6c87f6[_0x4402('0x2c')]=_0x48d20d['holdtime'];_0x6c87f6[_0x4402('0x24')]=0x0;writeDB(_0x6c87f6);}});}catch(_0x3383e3){utils['error'](util[_0x4402('0x2')](_0x4402('0x29'),_0x48d20d[_0x4402('0x3')]),_0x3383e3);}};exports[_0x4402('0x2d')]=function(_0x170058){try{if(agents[_0x170058[_0x4402('0x13')]]){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058['uniqueid']),_0x170058);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x2f'),_0x170058['uniqueid'],agents[_0x170058[_0x4402('0x13')]][_0x4402('0x1b')],_0x170058['destuniqueid']));agents[_0x170058['destuniqueid']][_0x4402('0x30')]=utils[_0x4402('0x15')]();agents[_0x170058[_0x4402('0x13')]][_0x4402('0x7')]=_0x170058['connectedlinenum'];agents[_0x170058['destuniqueid']]['connectedlinename']=_0x170058[_0x4402('0x18')];agents[_0x170058[_0x4402('0x13')]][_0x4402('0x2c')]=_0x170058[_0x4402('0x23')];agents[_0x170058['destuniqueid']][_0x4402('0x16')]=_0x4402('0x31');_[_0x4402('0x27')](agents,function(_0x57843d,_0x2b92b7){if(_0x57843d['destuniqueid']!=_0x170058[_0x4402('0x13')]&&_0x57843d[_0x4402('0x3')]==_0x170058['uniqueid']){_0x57843d[_0x4402('0x24')]=0x0;_0x57843d['holdtime']=_0x170058[_0x4402('0x23')];_0x57843d[_0x4402('0x20')]=!![];_0x57843d['agentringnoanswerAt']=utils[_0x4402('0x15')]();_0x57843d[_0x4402('0x16')]=_0x4402('0x32');_0x57843d[_0x4402('0x22')]='answered_elsewhere';_0x57843d['answeredelsewheredestinationuniqueid']=_0x170058[_0x4402('0x13')];_0x57843d['answeredelsewheremembername']=_0x170058[_0x4402('0x1b')];writeDB(_0x57843d);}});}}catch(_0x2a6d78){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x2e'),_0x170058[_0x4402('0x3')]),_0x2a6d78);}};exports[_0x4402('0xb')]=function(_0x390169){try{if(!_[_0x4402('0x1d')](agents[_0x390169[_0x4402('0x13')]])){utils['debug'](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169['uniqueid']),_0x390169);utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x390169[_0x4402('0x3')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x1b')],_0x390169[_0x4402('0x13')]));agents[_0x390169[_0x4402('0x13')]]['agentcomplete']=!![];agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')]=utils[_0x4402('0x15')]();agents[_0x390169[_0x4402('0x13')]][_0x4402('0x24')]=utils[_0x4402('0x35')](agents[_0x390169[_0x4402('0x13')]][_0x4402('0x34')],agents[_0x390169[_0x4402('0x13')]][_0x4402('0x30')]);agents[_0x390169[_0x4402('0x13')]]['reason']=_0x390169[_0x4402('0x22')];agents[_0x390169['destuniqueid']][_0x4402('0x16')]=_0x4402('0x36');writeDB(agents[_0x390169['destuniqueid']]);}}catch(_0x82f63a){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x33'),_0x390169[_0x4402('0x3')]),_0x82f63a);}};exports[_0x4402('0x37')]=function(_0x5b094b){try{if(!_[_0x4402('0x1d')](agents[_0x5b094b[_0x4402('0x38')]])){utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x5b094b);utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x3a'),_0x5b094b['uniqueid'],agents[_0x5b094b['transfereruniqueid']]['membername'],agents[_0x5b094b['transfereruniqueid']][_0x4402('0x3')]));agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3b')]=!![];agents[_0x5b094b[_0x4402('0x38')]]['transfertype']=_0x4402('0x3c');agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3d')]=_0x5b094b[_0x4402('0x3e')];agents[_0x5b094b[_0x4402('0x38')]][_0x4402('0x3f')]=agents[_0x5b094b[_0x4402('0x38')]]['uniqueid'];}}catch(_0x325b20){utils[_0x4402('0x1c')](util[_0x4402('0x2')](_0x4402('0x39'),_0x5b094b[_0x4402('0x3')]),_0x325b20);}};exports[_0x4402('0x40')]=function(_0x5477fd){try{utils[_0x4402('0x11')](util[_0x4402('0x2')](_0x4402('0x41'),_0x5477fd[_0x4402('0x42')]),_0x5477fd);if(_0x5477fd[_0x4402('0x42')]==_0x5477fd[_0x4402('0x43')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['secondtransfereruniqueid']])){utils['info'](util[_0x4402('0x2')](_0x4402('0x44'),_0x5477fd[_0x4402('0x42')],agents[_0x5477fd['secondtransfereruniqueid']]['membername']));agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x46')]=_0x4402('0x47');agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x48')];agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x42')];}if(_0x5477fd[_0x4402('0x49')]&&agents[_0x5477fd[_0x4402('0x49')]]){agents[_0x5477fd['transfereeuniqueid']][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfereeuniqueid']]=_[_0x4402('0x4b')](agents[_0x5477fd['transfereeuniqueid']]);transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x45')]][_0x4402('0x6')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4c')]=agents[_0x5477fd['secondtransfereruniqueid']][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x14')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]]['agentconnectAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x49')]][_0x4402('0x4a')]=0x2;}}else if(_0x5477fd[_0x4402('0x45')]==_0x5477fd[_0x4402('0x4d')]){if(!_[_0x4402('0x1d')](agents[_0x5477fd['origtransfereruniqueid']])){utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5477fd[_0x4402('0x42')],agents[_0x5477fd[_0x4402('0x42')]]['membername']));agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3b')]=!![];agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x46')]='ATTENDED';agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x3d')]=_0x5477fd[_0x4402('0x4e')];agents[_0x5477fd['origtransfereruniqueid']][_0x4402('0x3f')]=_0x5477fd[_0x4402('0x45')];}if(_0x5477fd[_0x4402('0x4f')]&&agents[_0x5477fd['transfertargetuniqueid']]){agents[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x4a')]=0x1;transfers[_0x5477fd['transfertargetuniqueid']]=_['clone'](agents[_0x5477fd[_0x4402('0x4f')]]);transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x6')]=agents[_0x5477fd[_0x4402('0x42')]]['calleridnum'];transfers[_0x5477fd['transfertargetuniqueid']][_0x4402('0x4c')]=agents[_0x5477fd[_0x4402('0x42')]][_0x4402('0x4c')];transfers[_0x5477fd[_0x4402('0x4f')]]['agentcalledAt']=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x30')]=utils[_0x4402('0x15')]();transfers[_0x5477fd[_0x4402('0x4f')]][_0x4402('0x2c')]=0x0;transfers[_0x5477fd[_0x4402('0x4f')]]['agententerreason']=0x2;}}}catch(_0x333a72){utils[_0x4402('0x1c')](util['format']('[%s][agents][attendedtransfer]',_0x5477fd[_0x4402('0x42')]),_0x333a72);}};exports['hangup']=function(_0x30569e){try{utils['debug'](util[_0x4402('0x2')](_0x4402('0x50'),_0x30569e[_0x4402('0x3')]),_0x30569e);if(agents[_0x30569e[_0x4402('0x3')]]&&agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]===_0x4402('0x21')){if(_0x30569e[_0x4402('0x51')]==='21'){agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x52');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x52');}utils[_0x4402('0x19')](util[_0x4402('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e['uniqueid']][_0x4402('0x22')],agents[_0x30569e['uniqueid']][_0x4402('0x16')]));writeDB(agents[_0x30569e[_0x4402('0x3')]]);var _0x466755=unanswered[_0x4402('0x53')](_0x30569e['uniqueid']);if(_0x466755>-0x1){unanswered[_0x4402('0x54')](_0x466755,0x1);}}if(transfers[_0x30569e['uniqueid']]){transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0xb')]=!![];transfers[_0x30569e[_0x4402('0x3')]]['agentcompleteAt']=utils[_0x4402('0x15')]();transfers[_0x30569e['uniqueid']][_0x4402('0x24')]=utils[_0x4402('0x35')](transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')]=_0x4402('0x55');transfers[_0x30569e['uniqueid']][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],transfers[_0x30569e[_0x4402('0x3')]]['reason'],transfers[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]));writeDB(transfers[_0x30569e[_0x4402('0x3')]],!![]);}if(agents[_0x30569e['uniqueid']]&&agents[_0x30569e[_0x4402('0x3')]]['agentconnectAt']){agents[_0x30569e[_0x4402('0x3')]]['agentcomplete']=!![];agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x34')]=utils['now']();agents[_0x30569e[_0x4402('0x3')]]['talktime']=utils[_0x4402('0x35')](agents[_0x30569e[_0x4402('0x3')]]['agentcompleteAt'],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x30')]);agents[_0x30569e['uniqueid']][_0x4402('0x22')]=agents[_0x30569e[_0x4402('0x3')]]['transfer']?_0x4402('0x3b'):_0x4402('0x55');agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x16')]=_0x4402('0x36');utils[_0x4402('0x19')](util[_0x4402('0x2')](_0x4402('0x56'),_0x30569e[_0x4402('0x3')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x1b')],agents[_0x30569e[_0x4402('0x3')]][_0x4402('0x22')],agents[_0x30569e[_0x4402('0x3')]]['lastevent']));writeDB(agents[_0x30569e[_0x4402('0x3')]]);}}catch(_0xc3914e){utils['error'](util[_0x4402('0x2')]('[%s][agents][hangup]',_0x30569e[_0x4402('0x3')]),_0xc3914e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index cdbfd69..e6330f6 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 _0x3433=['secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','error','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','execif','application','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x3433,0x106));var _0x3343=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x3433[_0x180c9b];return _0x3ff116;};'use strict';var _=require('lodash');var util=require(_0x3343('0x0'));var utils=require(_0x3343('0x1'));var dispositions=[_0x3343('0x2'),_0x3343('0x3'),'FAILED',_0x3343('0x2'),_0x3343('0x2'),_0x3343('0x2'),_0x3343('0x4'),'BUSY',_0x3343('0x3'),_0x3343('0x3'),_0x3343('0x3')];var channels={};function writeDB(_0x5e527e){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x7'),_0x5e527e['uniqueid'],_0x5e527e[_0x3343('0x8')],_0x5e527e[_0x3343('0x9')],_0x5e527e[_0x3343('0xa')],_0x5e527e['interface'],_0x5e527e[_0x3343('0xb')],_0x5e527e[_0x3343('0xc')],_0x5e527e[_0x3343('0xd')]));if(_0x5e527e[_0x3343('0xe')]){utils[_0x3343('0xf')](_0x5e527e[_0x3343('0xe')])[_0x3343('0x10')](function(_0x73a04b){if(_0x73a04b){_0x5e527e[_0x3343('0x11')]=_0x73a04b['id'];}utils[_0x3343('0x12')]('CreateVoiceCallReport',_0x5e527e);});}else{utils[_0x3343('0x12')]('CreateVoiceCallReport',_0x5e527e);}if(channels[_0x5e527e[_0x3343('0x13')]]){delete channels[_0x5e527e[_0x3343('0x13')]];}}exports[_0x3343('0x14')]=function(_0x37e317){try{utils['debug'](util[_0x3343('0x6')]('[%s][calls][newchannel]',_0x37e317['uniqueid']),_0x37e317);if(_0x37e317[_0x3343('0x13')]==_0x37e317[_0x3343('0x15')]&&_0x37e317['channel']!=_0x3343('0x16')){utils[_0x3343('0x5')](util[_0x3343('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x37e317[_0x3343('0x13')],_0x37e317[_0x3343('0x17')],_0x37e317[_0x3343('0x18')]));channels[_0x37e317[_0x3343('0x13')]]={'uniqueid':_0x37e317[_0x3343('0x13')],'accountcode':_0x37e317[_0x3343('0xe')],'source':_0x37e317[_0x3343('0xb')],'destination':_0x37e317[_0x3343('0x18')],'destinationcontext':_0x37e317[_0x3343('0x17')],'channel':_0x37e317[_0x3343('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3343('0x19')};}}catch(_0x532842){utils['error'](util[_0x3343('0x6')](_0x3343('0x1a'),_0x37e317[_0x3343('0x13')]),_0x532842);}};exports[_0x3343('0x1b')]=function(_0x17c7b9){try{utils[_0x3343('0x1c')](util[_0x3343('0x6')](_0x3343('0x1d'),_0x17c7b9[_0x3343('0x13')]),_0x17c7b9);if(!_[_0x3343('0x1e')](channels[_0x17c7b9[_0x3343('0x13')]])&&_0x17c7b9[_0x3343('0x1f')]==0x6){utils['info'](util[_0x3343('0x6')](_0x3343('0x20'),_0x17c7b9[_0x3343('0x13')],_0x17c7b9[_0x3343('0x17')],_0x17c7b9[_0x3343('0x8')]));if(_['isNil'](channels[_0x17c7b9[_0x3343('0x13')]]['systemanswertime'])){channels[_0x17c7b9['uniqueid']][_0x3343('0x21')]=utils[_0x3343('0x22')]();}}else if(!_[_0x3343('0x1e')](channels[_0x17c7b9[_0x3343('0x15')]])&&_0x17c7b9['channelstate']==0x6&&_0x17c7b9['context']!=_0x3343('0x23')){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x24'),_0x17c7b9['uniqueid'],_0x17c7b9['linkedid'],_0x17c7b9[_0x3343('0x17')],_0x17c7b9['channel']));channels[_0x17c7b9[_0x3343('0x15')]][_0x3343('0xe')]=_0x17c7b9[_0x3343('0xe')];channels[_0x17c7b9[_0x3343('0x15')]][_0x3343('0x25')]=_0x17c7b9[_0x3343('0x8')];if(_[_0x3343('0x1e')](channels[_0x17c7b9['linkedid']][_0x3343('0x26')])){channels[_0x17c7b9[_0x3343('0x15')]][_0x3343('0x26')]=utils[_0x3343('0x22')]();}channels[_0x17c7b9['linkedid']][_0x3343('0x27')]=dispositions[_[_0x3343('0x28')](_0x17c7b9['channelstate'])]||_0x3343('0x4');}}catch(_0x1ca0e6){utils['error'](util[_0x3343('0x6')](_0x3343('0x1d'),_0x17c7b9[_0x3343('0x13')]),_0x1ca0e6);}};exports[_0x3343('0x29')]=function(_0x30eb40){try{if(!_['isNil'](channels[_0x30eb40[_0x3343('0x13')]])){utils[_0x3343('0x1c')](util['format'](_0x3343('0x2a'),_0x30eb40[_0x3343('0x13')]),_0x30eb40);if(_[_0x3343('0x1e')](channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x2b')])){channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x2b')]=_0x30eb40[_0x3343('0x2c')]+'\x20<'+_0x30eb40[_0x3343('0xb')]+'>';}utils['info'](util[_0x3343('0x6')](_0x3343('0x2d'),_0x30eb40[_0x3343('0x13')],channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x2b')],_0x30eb40[_0x3343('0x2e')]));channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x2f')]=utils['now']();channels[_0x30eb40['uniqueid']][_0x3343('0x30')]=utils[_0x3343('0x31')](channels[_0x30eb40['uniqueid']]['endtime'],channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x32')]);channels[_0x30eb40['uniqueid']]['billableseconds']=channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x26')]?utils[_0x3343('0x31')](channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x2f')],channels[_0x30eb40[_0x3343('0x13')]][_0x3343('0x26')]):0x0;writeDB(channels[_0x30eb40[_0x3343('0x13')]]);}}catch(_0x30afc7){utils['error'](util[_0x3343('0x6')](_0x3343('0x2a'),_0x30eb40['uniqueid']),_0x30afc7);}};exports[_0x3343('0x33')]=function(_0x54b108){try{if(!_[_0x3343('0x1e')](channels[_0x54b108[_0x3343('0x34')]])){utils['debug'](util['format'](_0x3343('0x35'),_0x54b108[_0x3343('0x36')]),_0x54b108);if(channels[_0x54b108[_0x3343('0x34')]]['channel']==_0x54b108['transfereechannel']){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x37'),_0x54b108[_0x3343('0x36')],_0x54b108[_0x3343('0x34')],_0x54b108[_0x3343('0x38')]));channels[_0x54b108[_0x3343('0x34')]][_0x3343('0x25')]=_0x54b108[_0x3343('0x38')];channels[_0x54b108['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x54b108[_0x3343('0x34')]][_0x3343('0x8')]=_0x54b108[_0x3343('0x39')]){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x37'),_0x54b108[_0x3343('0x36')],_0x54b108[_0x3343('0x34')],_0x54b108['origtransfererchannel']));channels[_0x54b108[_0x3343('0x34')]]['destinationchannel']=_0x54b108[_0x3343('0x3a')];channels[_0x54b108[_0x3343('0x34')]][_0x3343('0x3b')]=_0x3343('0x3c');}}}catch(_0x59c055){utils['error'](util['format'](_0x3343('0x35'),_0x54b108[_0x3343('0x36')]),_0x59c055);}};exports['musiconholdstart']=function(_0x2db399){try{if(!_[_0x3343('0x1e')](channels[_0x2db399[_0x3343('0x13')]])){utils['debug'](util['format'](_0x3343('0x3d'),_0x2db399[_0x3343('0x13')]),_0x2db399);channels[_0x2db399[_0x3343('0x13')]][_0x3343('0x3e')]=utils[_0x3343('0x22')]();utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x3f'),_0x2db399[_0x3343('0x13')],channels[_0x2db399[_0x3343('0x13')]]['musiconholdstartAt']));}}catch(_0x1bb00f){utils['error'](util[_0x3343('0x6')](_0x3343('0x3d'),_0x2db399[_0x3343('0x13')]),_0x1bb00f);}};exports['musiconholdstop']=function(_0x310501){try{if(!_[_0x3343('0x1e')](channels[_0x310501['uniqueid']])){utils['debug'](util[_0x3343('0x6')](_0x3343('0x40'),_0x310501[_0x3343('0x13')]),_0x310501);if(!_[_0x3343('0x1e')](channels[_0x310501[_0x3343('0x13')]]['musiconholdstartAt'])){channels[_0x310501[_0x3343('0x13')]][_0x3343('0x41')]+=utils[_0x3343('0x31')](utils['now'](),channels[_0x310501[_0x3343('0x13')]][_0x3343('0x3e')]);utils[_0x3343('0x5')](util['format'](_0x3343('0x42'),_0x310501[_0x3343('0x13')],channels[_0x310501[_0x3343('0x13')]][_0x3343('0x41')]));delete channels[_0x310501[_0x3343('0x13')]][_0x3343('0x3e')];}}}catch(_0x275415){utils[_0x3343('0x43')](util['format'](_0x3343('0x40'),_0x310501[_0x3343('0x13')]),_0x275415);}};exports[_0x3343('0x44')]=function(_0x2a8b3f){try{if(!_[_0x3343('0x1e')](channels[_0x2a8b3f[_0x3343('0x13')]])){utils[_0x3343('0x1c')](util[_0x3343('0x6')](_0x3343('0x45'),_0x2a8b3f['uniqueid']),_0x2a8b3f);if(!_[_0x3343('0x1e')](_0x2a8b3f['variable'][_0x3343('0x46')])){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x47'),_0x2a8b3f[_0x3343('0x13')],_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]]['source']=_0x2a8b3f[_0x3343('0x48')];}if(!_['isNil'](_0x2a8b3f['variable'][_0x3343('0x49')])){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x4a'),_0x2a8b3f[_0x3343('0x13')],_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f['uniqueid']][_0x3343('0x4b')]=_0x2a8b3f[_0x3343('0x48')];channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x2b')]='\x22'+_0x2a8b3f[_0x3343('0x48')]+_0x3343('0x4c')+_0x2a8b3f[_0x3343('0x48')]+'>';}if(!_[_0x3343('0x1e')](_0x2a8b3f[_0x3343('0x4d')][_0x3343('0x4e')])||!_[_0x3343('0x1e')](_0x2a8b3f[_0x3343('0x4d')]['xmd-callerid'])){utils['info'](util[_0x3343('0x6')](_0x3343('0x4f'),_0x2a8b3f['uniqueid'],!_['isNil'](_0x2a8b3f['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0x3343('0x50'),_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x2b')]=_0x2a8b3f[_0x3343('0x48')];}if(!_[_0x3343('0x1e')](_0x2a8b3f[_0x3343('0x4d')]['xmd-queue'])||!_['isNil'](_0x2a8b3f[_0x3343('0x4d')][_0x3343('0x51')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2a8b3f[_0x3343('0x13')],!_[_0x3343('0x1e')](_0x2a8b3f[_0x3343('0x4d')][_0x3343('0x52')])?_0x3343('0x52'):_0x3343('0x51'),_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x53')]=_0x3343('0x54');channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x55')]=_0x2a8b3f[_0x3343('0x48')];channels[_0x2a8b3f[_0x3343('0x13')]]['queue']=!![];}if(!_[_0x3343('0x1e')](_0x2a8b3f['variable']['xmd-contactid'])){utils[_0x3343('0x5')](util[_0x3343('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x2a8b3f['uniqueid'],_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]]['ContactId']=_0x2a8b3f[_0x3343('0x48')];}if(!_[_0x3343('0x1e')](_0x2a8b3f[_0x3343('0x4d')]['xmd-cdrtype'])){utils[_0x3343('0x5')](util['format'](_0x3343('0x56'),_0x2a8b3f[_0x3343('0x13')],_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x57')]=_0x2a8b3f[_0x3343('0x48')];}if(!_['isNil'](_0x2a8b3f[_0x3343('0x4d')][_0x3343('0x58')])){utils[_0x3343('0x5')](util[_0x3343('0x6')](_0x3343('0x59'),_0x2a8b3f[_0x3343('0x13')],_0x2a8b3f['value']));channels[_0x2a8b3f[_0x3343('0x13')]][_0x3343('0x5a')]=_0x2a8b3f['value'];}if(!_[_0x3343('0x1e')](_0x2a8b3f['variable'][_0x3343('0x5b')])){utils['info'](util[_0x3343('0x6')](_0x3343('0x5c'),_0x2a8b3f[_0x3343('0x13')],_0x2a8b3f[_0x3343('0x48')]));channels[_0x2a8b3f[_0x3343('0x13')]]['sipcallid']=_0x2a8b3f[_0x3343('0x48')];}}}catch(_0xa005f2){utils[_0x3343('0x43')](util[_0x3343('0x6')](_0x3343('0x45'),_0x2a8b3f[_0x3343('0x13')]),_0xa005f2);}};exports[_0x3343('0x5d')]=function(_0x344d7b){try{if(!_['isNil'](channels[_0x344d7b[_0x3343('0x13')]])){utils[_0x3343('0x1c')](util[_0x3343('0x6')]('[%s][calls][newexten]',_0x344d7b[_0x3343('0x13')]),_0x344d7b);utils[_0x3343('0x5')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x344d7b[_0x3343('0x13')],_0x344d7b['application'],_0x344d7b[_0x3343('0x5e')]));if(_0x344d7b['application'][_0x3343('0x5f')]()==_0x3343('0x60')&&_[_0x3343('0x61')](_0x344d7b[_0x3343('0x5e')]['toLowerCase'](),_0x3343('0x62'))){var _0x9a6b5a=_0x344d7b[_0x3343('0x5e')][_0x3343('0x63')]('=');var _0x501ae0=_0x9a6b5a[0x0][_0x3343('0x64')](_0x9a6b5a[0x0][_0x3343('0x65')]('(')+0x1,_0x9a6b5a[0x0]['lastIndexOf'](')'));var _0x25664b=_0x9a6b5a[0x1];channels[_0x344d7b[_0x3343('0x13')]][_0x501ae0]=_0x25664b;}if(!_[_0x3343('0x66')]([_0x3343('0x29'),'noop',_0x3343('0x67'),_0x3343('0x60'),'gotoif'],_0x344d7b[_0x3343('0x68')]['toLowerCase']())){channels[_0x344d7b[_0x3343('0x13')]][_0x3343('0x53')]=_0x344d7b[_0x3343('0x68')];channels[_0x344d7b['uniqueid']]['lastdata']=_0x344d7b[_0x3343('0x5e')];}}}catch(_0x580e2f){utils[_0x3343('0x43')](util[_0x3343('0x6')](_0x3343('0x69'),_0x344d7b[_0x3343('0x13')]),_0x580e2f);}}; \ No newline at end of file +var _0x1772=['mohtime','varset','xmd-originatecalleridnum','value','variable','destination','callerid','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','[%s][calls][newexten]','FAILED','NO\x20ANSWER','info','format','uniqueid','channel','queue','membername','calleridnum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','[%s][calls][hangup]','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s'];(function(_0x1d5a4b,_0x36fbf9){var _0x23d5d2=function(_0x1a68d3){while(--_0x1a68d3){_0x1d5a4b['push'](_0x1d5a4b['shift']());}};_0x23d5d2(++_0x36fbf9);}(_0x1772,0x1c0));var _0x2177=function(_0x24b468,_0x4eaaba){_0x24b468=_0x24b468-0x0;var _0x3a7f11=_0x1772[_0x24b468];return _0x3a7f11;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x2177('0x0'),_0x2177('0x0'),_0x2177('0x1'),_0x2177('0x1'),_0x2177('0x1'),'ANSWERED','BUSY',_0x2177('0x0'),'FAILED',_0x2177('0x0')];var channels={};function writeDB(_0x45f3cf){utils[_0x2177('0x2')](util[_0x2177('0x3')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x45f3cf[_0x2177('0x4')],_0x45f3cf[_0x2177('0x5')],_0x45f3cf[_0x2177('0x6')],_0x45f3cf[_0x2177('0x7')],_0x45f3cf['interface'],_0x45f3cf[_0x2177('0x8')],_0x45f3cf['connectedlinenum'],_0x45f3cf[_0x2177('0x9')]));if(_0x45f3cf['accountcode']){utils[_0x2177('0xa')](_0x45f3cf[_0x2177('0xb')])['then'](function(_0x2cfaba){if(_0x2cfaba){_0x45f3cf[_0x2177('0xc')]=_0x2cfaba['id'];}utils[_0x2177('0xd')](_0x2177('0xe'),_0x45f3cf);});}else{utils['request']('CreateVoiceCallReport',_0x45f3cf);}if(channels[_0x45f3cf[_0x2177('0x4')]]){delete channels[_0x45f3cf[_0x2177('0x4')]];}}exports[_0x2177('0xf')]=function(_0x4b684e){try{utils[_0x2177('0x10')](util[_0x2177('0x3')](_0x2177('0x11'),_0x4b684e[_0x2177('0x4')]),_0x4b684e);if(_0x4b684e[_0x2177('0x4')]==_0x4b684e[_0x2177('0x12')]&&_0x4b684e['channel']!=_0x2177('0x13')){utils[_0x2177('0x2')](util['format'](_0x2177('0x14'),_0x4b684e[_0x2177('0x4')],_0x4b684e[_0x2177('0x15')],_0x4b684e[_0x2177('0x16')]));channels[_0x4b684e['uniqueid']]={'uniqueid':_0x4b684e[_0x2177('0x4')],'accountcode':_0x4b684e[_0x2177('0xb')],'source':_0x4b684e['calleridnum'],'destination':_0x4b684e['exten'],'destinationcontext':_0x4b684e[_0x2177('0x15')],'channel':_0x4b684e[_0x2177('0x5')],'starttime':utils[_0x2177('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2177('0x1'),'amaflags':_0x2177('0x18')};}}catch(_0x668d0c){utils[_0x2177('0x19')](util[_0x2177('0x3')](_0x2177('0x11'),_0x4b684e['uniqueid']),_0x668d0c);}};exports[_0x2177('0x1a')]=function(_0x587c53){try{utils[_0x2177('0x10')](util[_0x2177('0x3')]('[%s][calls][newstate]',_0x587c53[_0x2177('0x4')]),_0x587c53);if(!_[_0x2177('0x1b')](channels[_0x587c53['uniqueid']])&&_0x587c53[_0x2177('0x1c')]==0x6){utils[_0x2177('0x2')](util[_0x2177('0x3')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x587c53[_0x2177('0x4')],_0x587c53[_0x2177('0x15')],_0x587c53[_0x2177('0x5')]));if(_[_0x2177('0x1b')](channels[_0x587c53[_0x2177('0x4')]][_0x2177('0x1d')])){channels[_0x587c53[_0x2177('0x4')]][_0x2177('0x1d')]=utils['now']();}}else if(!_[_0x2177('0x1b')](channels[_0x587c53[_0x2177('0x12')]])&&_0x587c53[_0x2177('0x1c')]==0x6&&_0x587c53[_0x2177('0x15')]!=_0x2177('0x1e')){utils['info'](util[_0x2177('0x3')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x587c53[_0x2177('0x4')],_0x587c53[_0x2177('0x12')],_0x587c53[_0x2177('0x15')],_0x587c53[_0x2177('0x5')]));channels[_0x587c53[_0x2177('0x12')]][_0x2177('0xb')]=_0x587c53[_0x2177('0xb')];channels[_0x587c53['linkedid']][_0x2177('0x1f')]=_0x587c53[_0x2177('0x5')];if(_['isNil'](channels[_0x587c53[_0x2177('0x12')]][_0x2177('0x20')])){channels[_0x587c53['linkedid']][_0x2177('0x20')]=utils[_0x2177('0x17')]();}channels[_0x587c53[_0x2177('0x12')]][_0x2177('0x21')]=dispositions[_[_0x2177('0x22')](_0x587c53['channelstate'])]||_0x2177('0x23');}}catch(_0x45f5b7){utils[_0x2177('0x19')](util[_0x2177('0x3')](_0x2177('0x24'),_0x587c53['uniqueid']),_0x45f5b7);}};exports['hangup']=function(_0x536997){try{if(!_[_0x2177('0x1b')](channels[_0x536997[_0x2177('0x4')]])){utils[_0x2177('0x10')](util['format'](_0x2177('0x25'),_0x536997[_0x2177('0x4')]),_0x536997);if(_[_0x2177('0x1b')](channels[_0x536997['uniqueid']]['callerid'])){channels[_0x536997[_0x2177('0x4')]]['callerid']=_0x536997['calleridname']+'\x20<'+_0x536997['calleridnum']+'>';}utils['info'](util[_0x2177('0x3')](_0x2177('0x26'),_0x536997[_0x2177('0x4')],channels[_0x536997[_0x2177('0x4')]]['callerid'],_0x536997[_0x2177('0x27')]));channels[_0x536997[_0x2177('0x4')]][_0x2177('0x28')]=utils['now']();channels[_0x536997[_0x2177('0x4')]][_0x2177('0x29')]=utils[_0x2177('0x2a')](channels[_0x536997['uniqueid']]['endtime'],channels[_0x536997[_0x2177('0x4')]]['starttime']);channels[_0x536997[_0x2177('0x4')]][_0x2177('0x2b')]=channels[_0x536997[_0x2177('0x4')]][_0x2177('0x20')]?utils[_0x2177('0x2a')](channels[_0x536997[_0x2177('0x4')]][_0x2177('0x28')],channels[_0x536997[_0x2177('0x4')]]['answertime']):0x0;writeDB(channels[_0x536997[_0x2177('0x4')]]);}}catch(_0x20f5a3){utils['error'](util[_0x2177('0x3')](_0x2177('0x25'),_0x536997['uniqueid']),_0x20f5a3);}};exports[_0x2177('0x2c')]=function(_0x85622e){try{if(!_['isNil'](channels[_0x85622e[_0x2177('0x2d')]])){utils[_0x2177('0x10')](util[_0x2177('0x3')]('[%s][calls][attendedtransfer]',_0x85622e[_0x2177('0x2e')]),_0x85622e);if(channels[_0x85622e[_0x2177('0x2d')]][_0x2177('0x5')]==_0x85622e[_0x2177('0x2f')]){utils[_0x2177('0x2')](util[_0x2177('0x3')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x85622e[_0x2177('0x2e')],_0x85622e[_0x2177('0x2d')],_0x85622e[_0x2177('0x30')]));channels[_0x85622e[_0x2177('0x2d')]]['destinationchannel']=_0x85622e[_0x2177('0x30')];channels[_0x85622e[_0x2177('0x2d')]][_0x2177('0x31')]='_attended';}else if(channels[_0x85622e[_0x2177('0x2d')]][_0x2177('0x5')]=_0x85622e[_0x2177('0x32')]){utils[_0x2177('0x2')](util['format'](_0x2177('0x33'),_0x85622e['origtransfereruniqueid'],_0x85622e[_0x2177('0x2d')],_0x85622e['origtransfererchannel']));channels[_0x85622e[_0x2177('0x2d')]]['destinationchannel']=_0x85622e[_0x2177('0x34')];channels[_0x85622e[_0x2177('0x2d')]][_0x2177('0x31')]=_0x2177('0x35');}}}catch(_0x357293){utils[_0x2177('0x19')](util[_0x2177('0x3')](_0x2177('0x36'),_0x85622e[_0x2177('0x2e')]),_0x357293);}};exports[_0x2177('0x37')]=function(_0x35acfa){try{if(!_[_0x2177('0x1b')](channels[_0x35acfa[_0x2177('0x4')]])){utils[_0x2177('0x10')](util[_0x2177('0x3')](_0x2177('0x38'),_0x35acfa[_0x2177('0x4')]),_0x35acfa);channels[_0x35acfa[_0x2177('0x4')]][_0x2177('0x39')]=utils[_0x2177('0x17')]();utils[_0x2177('0x2')](util[_0x2177('0x3')](_0x2177('0x3a'),_0x35acfa[_0x2177('0x4')],channels[_0x35acfa[_0x2177('0x4')]][_0x2177('0x39')]));}}catch(_0x56a944){utils[_0x2177('0x19')](util[_0x2177('0x3')](_0x2177('0x38'),_0x35acfa[_0x2177('0x4')]),_0x56a944);}};exports[_0x2177('0x3b')]=function(_0x20bad5){try{if(!_['isNil'](channels[_0x20bad5[_0x2177('0x4')]])){utils[_0x2177('0x10')](util[_0x2177('0x3')](_0x2177('0x3c'),_0x20bad5[_0x2177('0x4')]),_0x20bad5);if(!_[_0x2177('0x1b')](channels[_0x20bad5[_0x2177('0x4')]]['musiconholdstartAt'])){channels[_0x20bad5[_0x2177('0x4')]]['mohtime']+=utils[_0x2177('0x2a')](utils[_0x2177('0x17')](),channels[_0x20bad5[_0x2177('0x4')]][_0x2177('0x39')]);utils[_0x2177('0x2')](util[_0x2177('0x3')](_0x2177('0x3d'),_0x20bad5[_0x2177('0x4')],channels[_0x20bad5[_0x2177('0x4')]][_0x2177('0x3e')]));delete channels[_0x20bad5['uniqueid']][_0x2177('0x39')];}}}catch(_0x5a463a){utils[_0x2177('0x19')](util['format'](_0x2177('0x3c'),_0x20bad5[_0x2177('0x4')]),_0x5a463a);}};exports[_0x2177('0x3f')]=function(_0x42dcea){try{if(!_[_0x2177('0x1b')](channels[_0x42dcea[_0x2177('0x4')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x42dcea[_0x2177('0x4')]),_0x42dcea);if(!_[_0x2177('0x1b')](_0x42dcea['variable'][_0x2177('0x40')])){utils['info'](util[_0x2177('0x3')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x42dcea[_0x2177('0x4')],_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea['uniqueid']]['source']=_0x42dcea[_0x2177('0x41')];}if(!_[_0x2177('0x1b')](_0x42dcea[_0x2177('0x42')]['xmd-phone'])){utils['info'](util[_0x2177('0x3')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x42dcea['uniqueid'],_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea[_0x2177('0x4')]][_0x2177('0x43')]=_0x42dcea['value'];channels[_0x42dcea['uniqueid']][_0x2177('0x44')]='\x22'+_0x42dcea[_0x2177('0x41')]+_0x2177('0x45')+_0x42dcea[_0x2177('0x41')]+'>';}if(!_[_0x2177('0x1b')](_0x42dcea[_0x2177('0x42')][_0x2177('0x46')])||!_[_0x2177('0x1b')](_0x42dcea[_0x2177('0x42')][_0x2177('0x47')])){utils[_0x2177('0x2')](util[_0x2177('0x3')](_0x2177('0x48'),_0x42dcea[_0x2177('0x4')],!_['isNil'](_0x42dcea[_0x2177('0x42')][_0x2177('0x46')])?_0x2177('0x46'):_0x2177('0x47'),_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea['uniqueid']][_0x2177('0x44')]=_0x42dcea[_0x2177('0x41')];}if(!_['isNil'](_0x42dcea[_0x2177('0x42')][_0x2177('0x49')])||!_['isNil'](_0x42dcea[_0x2177('0x42')]['xmcs-queue'])){utils[_0x2177('0x2')](util[_0x2177('0x3')](_0x2177('0x48'),_0x42dcea['uniqueid'],!_[_0x2177('0x1b')](_0x42dcea['variable'][_0x2177('0x49')])?_0x2177('0x49'):_0x2177('0x4a'),_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea[_0x2177('0x4')]][_0x2177('0x4b')]=_0x2177('0x4c');channels[_0x42dcea['uniqueid']][_0x2177('0x4d')]=_0x42dcea['value'];channels[_0x42dcea[_0x2177('0x4')]]['queue']=!![];}if(!_[_0x2177('0x1b')](_0x42dcea[_0x2177('0x42')][_0x2177('0x4e')])){utils['info'](util['format'](_0x2177('0x4f'),_0x42dcea[_0x2177('0x4')],_0x42dcea['value']));channels[_0x42dcea[_0x2177('0x4')]]['ContactId']=_0x42dcea[_0x2177('0x41')];}if(!_[_0x2177('0x1b')](_0x42dcea['variable'][_0x2177('0x50')])){utils[_0x2177('0x2')](util['format'](_0x2177('0x51'),_0x42dcea[_0x2177('0x4')],_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea[_0x2177('0x4')]][_0x2177('0x52')]=_0x42dcea[_0x2177('0x41')];}if(!_[_0x2177('0x1b')](_0x42dcea['variable']['outboundrouteid'])){utils['info'](util[_0x2177('0x3')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x42dcea['uniqueid'],_0x42dcea[_0x2177('0x41')]));channels[_0x42dcea[_0x2177('0x4')]][_0x2177('0x53')]=_0x42dcea[_0x2177('0x41')];}if(!_[_0x2177('0x1b')](_0x42dcea[_0x2177('0x42')]['sipcallid'])){utils[_0x2177('0x2')](util[_0x2177('0x3')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x42dcea['uniqueid'],_0x42dcea['value']));channels[_0x42dcea[_0x2177('0x4')]][_0x2177('0x54')]=_0x42dcea[_0x2177('0x41')];}}}catch(_0x1a347b){utils[_0x2177('0x19')](util['format'](_0x2177('0x55'),_0x42dcea[_0x2177('0x4')]),_0x1a347b);}};exports['newexten']=function(_0x1f140b){try{if(!_[_0x2177('0x1b')](channels[_0x1f140b[_0x2177('0x4')]])){utils[_0x2177('0x10')](util[_0x2177('0x3')]('[%s][calls][newexten]',_0x1f140b[_0x2177('0x4')]),_0x1f140b);utils[_0x2177('0x2')](util[_0x2177('0x3')](_0x2177('0x56'),_0x1f140b['uniqueid'],_0x1f140b[_0x2177('0x57')],_0x1f140b[_0x2177('0x58')]));if(_0x1f140b['application'][_0x2177('0x59')]()==_0x2177('0x5a')&&_[_0x2177('0x5b')](_0x1f140b['appdata'][_0x2177('0x59')](),_0x2177('0x5c'))){var _0x134f7c=_0x1f140b[_0x2177('0x58')][_0x2177('0x5d')]('=');var _0x55f9fd=_0x134f7c[0x0][_0x2177('0x5e')](_0x134f7c[0x0]['lastIndexOf']('(')+0x1,_0x134f7c[0x0][_0x2177('0x5f')](')'));var _0x5b8566=_0x134f7c[0x1];channels[_0x1f140b[_0x2177('0x4')]][_0x55f9fd]=_0x5b8566;}if(!_[_0x2177('0x60')]([_0x2177('0x61'),_0x2177('0x62'),_0x2177('0x63'),_0x2177('0x5a'),_0x2177('0x64')],_0x1f140b[_0x2177('0x57')][_0x2177('0x59')]())){channels[_0x1f140b['uniqueid']]['lastapplication']=_0x1f140b[_0x2177('0x57')];channels[_0x1f140b[_0x2177('0x4')]][_0x2177('0x4d')]=_0x1f140b['appdata'];}}}catch(_0x45fbdf){utils[_0x2177('0x19')](util[_0x2177('0x3')](_0x2177('0x65'),_0x1f140b[_0x2177('0x4')]),_0x45fbdf);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 12352ae..81bcb7a 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 _0x9135=['shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected'];(function(_0x25b533,_0x242e32){var _0x32cc36=function(_0x56bef2){while(--_0x56bef2){_0x25b533['push'](_0x25b533['shift']());}};_0x32cc36(++_0x242e32);}(_0x9135,0xd9));var _0x5913=function(_0x329f4f,_0xd2275c){_0x329f4f=_0x329f4f-0x0;var _0x592399=_0x9135[_0x329f4f];return _0x592399;};'use strict';var utils=require('./utils');exports[_0x5913('0x0')]=function(){utils[_0x5913('0x1')](_0x5913('0x2'));};exports[_0x5913('0x3')]=function(){utils['info'](_0x5913('0x4'));};exports['fullybooted']=function(){utils[_0x5913('0x1')](_0x5913('0x5'));};exports[_0x5913('0x6')]=function(_0xa7a3a){utils[_0x5913('0x6')](_0x5913('0x7'),_0xa7a3a);};exports[_0x5913('0x8')]=function(){utils[_0x5913('0x1')](_0x5913('0x9'));};exports[_0x5913('0xa')]=function(_0x428377){}; \ No newline at end of file +var _0xe290=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0xbc160b,_0x2c32af){var _0x1fe71f=function(_0x58c74b){while(--_0x58c74b){_0xbc160b['push'](_0xbc160b['shift']());}};_0x1fe71f(++_0x2c32af);}(_0xe290,0x10f));var _0x0e29=function(_0x23e4cf,_0x12704d){_0x23e4cf=_0x23e4cf-0x0;var _0x2bd35a=_0xe290[_0x23e4cf];return _0x2bd35a;};'use strict';var utils=require('./utils');exports[_0x0e29('0x0')]=function(){utils['info'](_0x0e29('0x1'));};exports[_0x0e29('0x2')]=function(){utils[_0x0e29('0x3')](_0x0e29('0x4'));};exports[_0x0e29('0x5')]=function(){utils[_0x0e29('0x3')](_0x0e29('0x6'));};exports[_0x0e29('0x7')]=function(_0x332fe0){utils[_0x0e29('0x7')](_0x0e29('0x8'),_0x332fe0);};exports[_0x0e29('0x9')]=function(){utils[_0x0e29('0x3')](_0x0e29('0xa'));};exports[_0x0e29('0xb')]=function(_0x1afec7){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e1e91a9..d77c4c5 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 _0xc439=['assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','calleridname','cause-txt','complete','diffTime','endtime','[%s][dials][hangup]','lodash','./utils','info','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','format','application','appdata','toLowerCase','set','startsWith','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','isNil','[%s][dials][dialbegin]'];(function(_0x8f3062,_0x330b86){var _0x21463a=function(_0x2a0585){while(--_0x2a0585){_0x8f3062['push'](_0x8f3062['shift']());}};_0x21463a(++_0x330b86);}(_0xc439,0x99));var _0x9c43=function(_0x21f101,_0x4c191f){_0x21f101=_0x21f101-0x0;var _0x4638d5=_0xc439[_0x21f101];return _0x4638d5;};'use strict';var _=require(_0x9c43('0x0'));var util=require('util');var utils=require(_0x9c43('0x1'));var dials={};function writeDB(_0x221010){utils[_0x9c43('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x221010[_0x9c43('0x3')],_0x221010['channel'],_0x221010[_0x9c43('0x4')],_0x221010[_0x9c43('0x5')],_0x221010[_0x9c43('0x6')],_0x221010[_0x9c43('0x7')]));utils['request'](_0x9c43('0x8'),_0x221010);delete dials[_0x221010[_0x9c43('0x3')]];}exports[_0x9c43('0x9')]=function(_0xd16976){try{utils[_0x9c43('0xa')](util[_0x9c43('0xb')]('[%s][dials][newexten]',_0xd16976[_0x9c43('0x3')]),_0xd16976);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xd16976[_0x9c43('0x3')],_0xd16976[_0x9c43('0xc')],_0xd16976[_0x9c43('0xd')]));if(_0xd16976[_0x9c43('0xc')][_0x9c43('0xe')]()==_0x9c43('0xf')&&_[_0x9c43('0x10')](_0xd16976[_0x9c43('0xd')]['toLowerCase'](),'cdr(routeid)')){var _0x5e01f6=_0xd16976[_0x9c43('0xd')]['split']('=');dials[_0xd16976[_0x9c43('0x3')]]={'routeId':_0x5e01f6[0x1]};}}catch(_0x1b2c48){utils[_0x9c43('0x11')](util[_0x9c43('0xb')](_0x9c43('0x12'),_0xd16976[_0x9c43('0x3')]),_0x1b2c48);}};exports[_0x9c43('0x13')]=function(_0x3bae63){try{utils[_0x9c43('0xa')](util[_0x9c43('0xb')](_0x9c43('0x14'),_0x3bae63[_0x9c43('0x3')]),_0x3bae63);if(!_['isNil'](_0x3bae63[_0x9c43('0x15')][_0x9c43('0x16')])){utils[_0x9c43('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3bae63[_0x9c43('0x3')],_0x3bae63[_0x9c43('0x17')]));dials[_0x3bae63['uniqueid']]={'routeId':_0x3bae63[_0x9c43('0x17')]};}}catch(_0x1dbf77){utils[_0x9c43('0x11')](util['format'](_0x9c43('0x14'),_0x3bae63[_0x9c43('0x3')]),_0x1dbf77);}};exports[_0x9c43('0x18')]=function(_0x215d8c){try{if(!_[_0x9c43('0x19')](dials[_0x215d8c[_0x9c43('0x3')]])){utils[_0x9c43('0xa')](util['format'](_0x9c43('0x1a'),_0x215d8c[_0x9c43('0x3')]),_0x215d8c);dials[_0x215d8c[_0x9c43('0x3')]]=_[_0x9c43('0x1b')](dials[_0x215d8c[_0x9c43('0x3')]],_0x215d8c);dials[_0x215d8c[_0x9c43('0x3')]][_0x9c43('0x1c')]=utils[_0x9c43('0x1d')]();dials[_0x215d8c['uniqueid']][_0x9c43('0x1e')]=_0x9c43('0x1f');utils['info'](util[_0x9c43('0xb')](_0x9c43('0x20'),_0x215d8c[_0x9c43('0x3')],dials[_0x215d8c[_0x9c43('0x3')]][_0x9c43('0x1c')]));}}catch(_0xb8cb54){utils[_0x9c43('0x11')](util['format']('[%s][dials][dialbegin]',_0x215d8c[_0x9c43('0x3')]),_0xb8cb54);}};exports[_0x9c43('0x21')]=function(_0x1998c8){try{if(!_[_0x9c43('0x19')](dials[_0x1998c8[_0x9c43('0x3')]])){utils[_0x9c43('0xa')](util['format'](_0x9c43('0x22'),_0x1998c8[_0x9c43('0x3')]),_0x1998c8);dials[_0x1998c8[_0x9c43('0x3')]][_0x9c43('0x7')]=_0x1998c8[_0x9c43('0x7')];if(_0x1998c8[_0x9c43('0x7')]==_0x9c43('0x23')){dials[_0x1998c8[_0x9c43('0x3')]]=_[_0x9c43('0x1b')](dials[_0x1998c8['uniqueid']],_0x1998c8);dials[_0x1998c8[_0x9c43('0x3')]][_0x9c43('0x24')]=utils[_0x9c43('0x1d')]();dials[_0x1998c8['uniqueid']][_0x9c43('0x1e')]='connect';utils[_0x9c43('0x2')](util['format'](_0x9c43('0x25'),_0x1998c8[_0x9c43('0x3')],_0x1998c8[_0x9c43('0x7')],dials[_0x1998c8[_0x9c43('0x3')]]['answertime']));}else{utils[_0x9c43('0x2')](util[_0x9c43('0xb')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1998c8[_0x9c43('0x3')],_0x1998c8[_0x9c43('0x7')]));}}}catch(_0x59b515){utils[_0x9c43('0x11')](util[_0x9c43('0xb')](_0x9c43('0x22'),_0x1998c8[_0x9c43('0x3')]),_0x59b515);}};exports[_0x9c43('0x26')]=function(_0xa2f140){try{if(!_[_0x9c43('0x19')](dials[_0xa2f140['uniqueid']])){utils[_0x9c43('0xa')](util[_0x9c43('0xb')]('[%s][dials][hangup]',_0xa2f140[_0x9c43('0x3')]),_0xa2f140);utils['info'](util[_0x9c43('0xb')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xa2f140[_0x9c43('0x3')],_0xa2f140[_0x9c43('0x5')],_0xa2f140[_0x9c43('0x27')],_0xa2f140[_0x9c43('0x28')]));dials[_0xa2f140[_0x9c43('0x3')]]=_[_0x9c43('0x1b')](dials[_0xa2f140[_0x9c43('0x3')]],{'endtime':utils[_0x9c43('0x1d')](),'lastevent':_0x9c43('0x29')});dials[_0xa2f140[_0x9c43('0x3')]]['duration']=utils[_0x9c43('0x2a')](dials[_0xa2f140[_0x9c43('0x3')]][_0x9c43('0x2b')],dials[_0xa2f140[_0x9c43('0x3')]][_0x9c43('0x1c')]);dials[_0xa2f140[_0x9c43('0x3')]]['holdtime']=utils[_0x9c43('0x2a')](dials[_0xa2f140[_0x9c43('0x3')]]['answertime']||dials[_0xa2f140[_0x9c43('0x3')]][_0x9c43('0x2b')],dials[_0xa2f140[_0x9c43('0x3')]][_0x9c43('0x1c')]);dials[_0xa2f140[_0x9c43('0x3')]]['billableseconds']=dials[_0xa2f140['uniqueid']]['answertime']?utils[_0x9c43('0x2a')](dials[_0xa2f140[_0x9c43('0x3')]][_0x9c43('0x2b')],dials[_0xa2f140[_0x9c43('0x3')]]['answertime']):0x0;writeDB(dials[_0xa2f140[_0x9c43('0x3')]]);}}catch(_0x458325){utils['error'](util[_0x9c43('0xb')](_0x9c43('0x2c'),_0xa2f140['uniqueid']),_0x458325);}}; \ No newline at end of file +var _0xe40c=['error','dialbegin','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','assign','duration','diffTime','endtime','holdtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','uniqueid','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','[%s][dials][newexten]','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x5a5145,_0x56ab42){var _0x185784=function(_0xb4221f){while(--_0xb4221f){_0x5a5145['push'](_0x5a5145['shift']());}};_0x185784(++_0x56ab42);}(_0xe40c,0x126));var _0xce40=function(_0x127277,_0x4cacaf){_0x127277=_0x127277-0x0;var _0x23c8ee=_0xe40c[_0x127277];return _0x23c8ee;};'use strict';var _=require(_0xce40('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x4564d8){utils[_0xce40('0x1')](util[_0xce40('0x2')](_0xce40('0x3'),_0x4564d8['uniqueid'],_0x4564d8[_0xce40('0x4')],_0x4564d8['dialstring'],_0x4564d8['calleridnum'],_0x4564d8[_0xce40('0x5')],_0x4564d8[_0xce40('0x6')]));utils[_0xce40('0x7')](_0xce40('0x8'),_0x4564d8);delete dials[_0x4564d8['uniqueid']];}exports['newexten']=function(_0x18af7a){try{utils[_0xce40('0x9')](util[_0xce40('0x2')]('[%s][dials][newexten]',_0x18af7a[_0xce40('0xa')]),_0x18af7a);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x18af7a['uniqueid'],_0x18af7a[_0xce40('0xb')],_0x18af7a[_0xce40('0xc')]));if(_0x18af7a[_0xce40('0xb')][_0xce40('0xd')]()=='set'&&_[_0xce40('0xe')](_0x18af7a[_0xce40('0xc')][_0xce40('0xd')](),_0xce40('0xf'))){var _0x102aed=_0x18af7a['appdata'][_0xce40('0x10')]('=');dials[_0x18af7a['uniqueid']]={'routeId':_0x102aed[0x1]};}}catch(_0x299f12){utils['error'](util['format'](_0xce40('0x11'),_0x18af7a[_0xce40('0xa')]),_0x299f12);}};exports['varset']=function(_0x20d698){try{utils[_0xce40('0x9')](util[_0xce40('0x2')](_0xce40('0x12'),_0x20d698[_0xce40('0xa')]),_0x20d698);if(!_[_0xce40('0x13')](_0x20d698['variable']['outboundrouteid'])){utils[_0xce40('0x1')](util[_0xce40('0x2')](_0xce40('0x14'),_0x20d698[_0xce40('0xa')],_0x20d698['value']));dials[_0x20d698['uniqueid']]={'routeId':_0x20d698['value']};}}catch(_0x28afeb){utils[_0xce40('0x15')](util[_0xce40('0x2')]('[%s][dials][varset]',_0x20d698[_0xce40('0xa')]),_0x28afeb);}};exports[_0xce40('0x16')]=function(_0x415ada){try{if(!_[_0xce40('0x13')](dials[_0x415ada[_0xce40('0xa')]])){utils[_0xce40('0x9')](util[_0xce40('0x2')]('[%s][dials][dialbegin]',_0x415ada['uniqueid']),_0x415ada);dials[_0x415ada['uniqueid']]=_['assign'](dials[_0x415ada[_0xce40('0xa')]],_0x415ada);dials[_0x415ada[_0xce40('0xa')]][_0xce40('0x17')]=utils[_0xce40('0x18')]();dials[_0x415ada[_0xce40('0xa')]][_0xce40('0x19')]=_0xce40('0x1a');utils[_0xce40('0x1')](util[_0xce40('0x2')](_0xce40('0x1b'),_0x415ada['uniqueid'],dials[_0x415ada['uniqueid']][_0xce40('0x17')]));}}catch(_0x1978c6){utils[_0xce40('0x15')](util[_0xce40('0x2')]('[%s][dials][dialbegin]',_0x415ada[_0xce40('0xa')]),_0x1978c6);}};exports[_0xce40('0x1c')]=function(_0x3654ef){try{if(!_[_0xce40('0x13')](dials[_0x3654ef[_0xce40('0xa')]])){utils[_0xce40('0x9')](util[_0xce40('0x2')](_0xce40('0x1d'),_0x3654ef['uniqueid']),_0x3654ef);dials[_0x3654ef[_0xce40('0xa')]]['dialstatus']=_0x3654ef[_0xce40('0x6')];if(_0x3654ef[_0xce40('0x6')]=='ANSWER'){dials[_0x3654ef[_0xce40('0xa')]]=_['assign'](dials[_0x3654ef['uniqueid']],_0x3654ef);dials[_0x3654ef[_0xce40('0xa')]][_0xce40('0x1e')]=utils['now']();dials[_0x3654ef[_0xce40('0xa')]]['lastevent']=_0xce40('0x1f');utils[_0xce40('0x1')](util[_0xce40('0x2')](_0xce40('0x20'),_0x3654ef['uniqueid'],_0x3654ef['dialstatus'],dials[_0x3654ef[_0xce40('0xa')]][_0xce40('0x1e')]));}else{utils[_0xce40('0x1')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x3654ef['uniqueid'],_0x3654ef['dialstatus']));}}}catch(_0x3c5020){utils['error'](util[_0xce40('0x2')]('[%s][dials][dialend]',_0x3654ef[_0xce40('0xa')]),_0x3c5020);}};exports[_0xce40('0x21')]=function(_0x1f4ed6){try{if(!_[_0xce40('0x13')](dials[_0x1f4ed6[_0xce40('0xa')]])){utils[_0xce40('0x9')](util[_0xce40('0x2')](_0xce40('0x22'),_0x1f4ed6[_0xce40('0xa')]),_0x1f4ed6);utils[_0xce40('0x1')](util[_0xce40('0x2')](_0xce40('0x23'),_0x1f4ed6[_0xce40('0xa')],_0x1f4ed6[_0xce40('0x24')],_0x1f4ed6[_0xce40('0x25')],_0x1f4ed6[_0xce40('0x26')]));dials[_0x1f4ed6[_0xce40('0xa')]]=_[_0xce40('0x27')](dials[_0x1f4ed6[_0xce40('0xa')]],{'endtime':utils[_0xce40('0x18')](),'lastevent':'complete'});dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x28')]=utils[_0xce40('0x29')](dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x2a')],dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x17')]);dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x2b')]=utils[_0xce40('0x29')](dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x1e')]||dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x2a')],dials[_0x1f4ed6[_0xce40('0xa')]]['starttime']);dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x2c')]=dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x1e')]?utils['diffTime'](dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x2a')],dials[_0x1f4ed6[_0xce40('0xa')]][_0xce40('0x1e')]):0x0;writeDB(dials[_0x1f4ed6[_0xce40('0xa')]]);}}catch(_0x3a6a20){utils[_0xce40('0x15')](util['format'](_0xce40('0x22'),_0x1f4ed6[_0xce40('0xa')]),_0x3a6a20);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b5c7ec3..1b86217 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 _0xf3dd=['[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf3dd,0xda));var _0xdf3d=function(_0x5ac188,_0x163bcf){_0x5ac188=_0x5ac188-0x0;var _0x32fa2f=_0xf3dd[_0x5ac188];return _0x32fa2f;};var AsteriskManager=require('asterisk-manager');var config=require(_0xdf3d('0x0'));var utils=require(_0xdf3d('0x1'));var util=require(_0xdf3d('0x2'));var isXDREnabled=config[_0xdf3d('0x3')]&&config[_0xdf3d('0x3')]['disabled']?!config[_0xdf3d('0x3')][_0xdf3d('0x4')]:!![];var isProduction=config['env']===_0xdf3d('0x5')||![];var isLocalAsterisk=config[_0xdf3d('0x3')]&&config[_0xdf3d('0x3')][_0xdf3d('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xdf3d('0x7')]['port'],config[_0xdf3d('0x7')]['ip'],config[_0xdf3d('0x7')][_0xdf3d('0x8')],config[_0xdf3d('0x7')][_0xdf3d('0x9')],!![]);ami[_0xdf3d('0xa')]();if(!isXDREnabled){utils[_0xdf3d('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xdf3d('0xb')](_0xdf3d('0xc'));}else{var agents=require(_0xdf3d('0xd'));var calls=require(_0xdf3d('0xe'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xdf3d('0xf'));var dials=require(_0xdf3d('0x10'));var transfers=require(_0xdf3d('0x11'));var core=require(_0xdf3d('0x12'));ami['on']('connect',core['connect']);ami['on'](_0xdf3d('0x13'),core[_0xdf3d('0x13')]);ami['on'](_0xdf3d('0x14'),core[_0xdf3d('0x14')]);ami['on'](_0xdf3d('0x15'),core[_0xdf3d('0x15')]);ami['on'](_0xdf3d('0x16'),core[_0xdf3d('0x16')]);ami['on'](_0xdf3d('0x17'),core[_0xdf3d('0x17')]);ami['on'](_0xdf3d('0x18'),function(_0x3f772c){try{utils['debug'](util[_0xdf3d('0x19')](_0xdf3d('0x1a'),_0x3f772c[_0xdf3d('0x1b')]),_0x3f772c);members[_0xdf3d('0x18')](_0x3f772c);}catch(_0x5ca04b){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x1a'),_0x3f772c['device']),_0x5ca04b);}});ami['on'](_0xdf3d('0x1c'),function(_0x58162c){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x1e'),_0x58162c[_0xdf3d('0x1f')]),_0x58162c);agents[_0xdf3d('0x1c')](_0x58162c);}catch(_0x237340){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x1e'),_0x58162c[_0xdf3d('0x1f')]),_0x237340);}});ami['on'](_0xdf3d('0x20'),function(_0x254d13){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x21'),_0x254d13[_0xdf3d('0x1f')]),_0x254d13);agents[_0xdf3d('0x20')](_0x254d13);}catch(_0x7a55b){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')]('[%s][index][agentringnoanswer]',_0x254d13['uniqueid']),_0x7a55b);}});ami['on'](_0xdf3d('0x22'),function(_0x568e0a){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x23'),_0x568e0a['uniqueid']),_0x568e0a);agents[_0xdf3d('0x22')](_0x568e0a);queues[_0xdf3d('0x22')](_0x568e0a);}catch(_0x3a10ea){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x23'),_0x568e0a[_0xdf3d('0x1f')]),_0x3a10ea);}});ami['on'](_0xdf3d('0x24'),function(_0x4fcf72){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x25'),_0x4fcf72[_0xdf3d('0x1f')]),_0x4fcf72);agents[_0xdf3d('0x24')](_0x4fcf72);queues[_0xdf3d('0x24')](_0x4fcf72);members['agentcomplete'](_0x4fcf72);}catch(_0x2481c9){utils['error'](util['format']('[%s][index][agentcomplete]',_0x4fcf72[_0xdf3d('0x1f')]),_0x2481c9);}});ami['on'](_0xdf3d('0x26'),function(_0x2ee495){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x27'),_0x2ee495[_0xdf3d('0x1f')]),_0x2ee495);agents[_0xdf3d('0x26')](_0x2ee495);queues[_0xdf3d('0x26')](_0x2ee495);}catch(_0x58d0e1){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')]('[%s][index][queuecallerabandon]',_0x2ee495[_0xdf3d('0x1f')]),_0x58d0e1);}});ami['on'](_0xdf3d('0x28'),function(_0x48112d){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')]('[%s][index][queuecallerjoin]',_0x48112d[_0xdf3d('0x1f')]),_0x48112d);queues[_0xdf3d('0x28')](_0x48112d);recordings['queuecallerjoin'](_0x48112d);}catch(_0x1f895a){utils['error'](util[_0xdf3d('0x19')](_0xdf3d('0x29'),_0x48112d[_0xdf3d('0x1f')]),_0x1f895a);}});ami['on']('queuecallerleave',function(_0x472e9e){try{utils['debug'](util[_0xdf3d('0x19')](_0xdf3d('0x2a'),_0x472e9e[_0xdf3d('0x1f')]),_0x472e9e);queues[_0xdf3d('0x2b')](_0x472e9e);}catch(_0x77ed66){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x2a'),_0x472e9e['uniqueid']),_0x77ed66);}});ami['on'](_0xdf3d('0x2c'),function(_0x296d4d){try{utils[_0xdf3d('0x1d')](util['format'](_0xdf3d('0x2d'),_0x296d4d[_0xdf3d('0x1f')]),_0x296d4d);queues[_0xdf3d('0x2c')](_0x296d4d);calls[_0xdf3d('0x2c')](_0x296d4d);}catch(_0x3748dc){utils['error'](util[_0xdf3d('0x19')](_0xdf3d('0x2d'),_0x296d4d[_0xdf3d('0x1f')]),_0x3748dc);}});ami['on'](_0xdf3d('0x2e'),function(_0x382693){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x2f'),_0x382693[_0xdf3d('0x1f')]),_0x382693);queues[_0xdf3d('0x2e')](_0x382693);calls[_0xdf3d('0x2e')](_0x382693);}catch(_0x4b87c6){utils[_0xdf3d('0x15')](util['format'](_0xdf3d('0x2f'),_0x382693[_0xdf3d('0x1f')]),_0x4b87c6);}});ami['on']('newstate',function(_0x1fa067){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x30'),_0x1fa067['uniqueid']),_0x1fa067);calls[_0xdf3d('0x31')](_0x1fa067);recordings[_0xdf3d('0x31')](_0x1fa067);}catch(_0x4eab26){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')]('[%s][index][newstate]',_0x1fa067[_0xdf3d('0x1f')]),_0x4eab26);}});ami['on'](_0xdf3d('0x32'),function(_0x1469cc){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x33'),_0x1469cc[_0xdf3d('0x1f')]),_0x1469cc);calls[_0xdf3d('0x32')](_0x1469cc);recordings[_0xdf3d('0x32')](_0x1469cc);dials[_0xdf3d('0x32')](_0x1469cc);agents[_0xdf3d('0x32')](_0x1469cc);queues[_0xdf3d('0x32')](_0x1469cc);}catch(_0x1fc6c1){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x33'),_0x1469cc['uniqueid']),_0x1fc6c1);}});ami['on'](_0xdf3d('0x34'),function(_0xa86ba8){try{utils[_0xdf3d('0x1d')](util['format'](_0xdf3d('0x35'),_0xa86ba8[_0xdf3d('0x1f')]),_0xa86ba8);members[_0xdf3d('0x34')](_0xa86ba8);}catch(_0x5d5dff){utils['error'](util[_0xdf3d('0x19')](_0xdf3d('0x35'),_0xa86ba8[_0xdf3d('0x1f')]),_0x5d5dff);}});ami['on'](_0xdf3d('0x36'),function(_0x1f902f){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x37'),_0x1f902f['uniqueid']),_0x1f902f);queues[_0xdf3d('0x36')](_0x1f902f);agents[_0xdf3d('0x36')](_0x1f902f);transfers[_0xdf3d('0x36')](_0x1f902f);}catch(_0x9c9faf){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x37'),_0x1f902f[_0xdf3d('0x1f')]),_0x9c9faf);}});ami['on']('attendedtransfer',function(_0x44a387){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')]('[%s][index][attendedtransfer]',_0x44a387['origtransfereruniqueid']),_0x44a387);queues[_0xdf3d('0x38')](_0x44a387);transfers['attendedtransfer'](_0x44a387);agents[_0xdf3d('0x38')](_0x44a387);calls['attendedtransfer'](_0x44a387);}catch(_0x2a7b25){utils['error'](util['format'](_0xdf3d('0x39'),_0x44a387['origtransfereruniqueid']),_0x2a7b25);}});ami['on']('varset',function(_0x2217d1){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x3a'),_0x2217d1[_0xdf3d('0x1f')]),_0x2217d1);queues[_0xdf3d('0x3b')](_0x2217d1);recordings[_0xdf3d('0x3b')](_0x2217d1);calls['varset'](_0x2217d1);dials[_0xdf3d('0x3b')](_0x2217d1);}catch(_0x2b9352){utils[_0xdf3d('0x15')](util['format'](_0xdf3d('0x3a'),_0x2217d1['uniqueid']),_0x2b9352);}});ami['on'](_0xdf3d('0x3c'),function(_0x3c5b78){try{utils['debug'](util[_0xdf3d('0x19')](_0xdf3d('0x3d'),_0x3c5b78[_0xdf3d('0x1f')]),_0x3c5b78);calls[_0xdf3d('0x3c')](_0x3c5b78);recordings[_0xdf3d('0x3c')](_0x3c5b78);dials[_0xdf3d('0x3c')](_0x3c5b78);}catch(_0x47619c){utils['error'](util[_0xdf3d('0x19')](_0xdf3d('0x3d'),_0x3c5b78[_0xdf3d('0x1f')]),_0x47619c);}});ami['on'](_0xdf3d('0x3e'),function(_0x124f7a){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x3f'),_0x124f7a[_0xdf3d('0x1f')]),_0x124f7a);calls[_0xdf3d('0x3e')](_0x124f7a);recordings['newchannel'](_0x124f7a);}catch(_0x33aa38){utils['error'](util['format'](_0xdf3d('0x3f'),_0x124f7a[_0xdf3d('0x1f')]),_0x33aa38);}});ami['on'](_0xdf3d('0x40'),function(_0x2bd078){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x41'),_0x2bd078['uniqueid']),_0x2bd078);dials[_0xdf3d('0x40')](_0x2bd078);}catch(_0x5f5a21){utils[_0xdf3d('0x15')](util['format'](_0xdf3d('0x42'),_0x2bd078[_0xdf3d('0x1f')]),_0x5f5a21);}});ami['on'](_0xdf3d('0x43'),function(_0x2cf1b3){try{utils[_0xdf3d('0x1d')](util[_0xdf3d('0x19')](_0xdf3d('0x44'),_0x2cf1b3['uniqueid']),_0x2cf1b3);dials[_0xdf3d('0x43')](_0x2cf1b3);}catch(_0x347ffc){utils[_0xdf3d('0x15')](util[_0xdf3d('0x19')](_0xdf3d('0x44'),_0x2cf1b3[_0xdf3d('0x1f')]),_0x347ffc);}});} \ No newline at end of file +var _0x4914=['[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','production','port','asterisk','username','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x1fcc94,_0x10a6e2){var _0x4ba780=function(_0x4c7bdd){while(--_0x4c7bdd){_0x1fcc94['push'](_0x1fcc94['shift']());}};_0x4ba780(++_0x10a6e2);}(_0x4914,0x1eb));var _0x4491=function(_0x347525,_0x57eb97){_0x347525=_0x347525-0x0;var _0xd8b892=_0x4914[_0x347525];return _0xd8b892;};var AsteriskManager=require(_0x4491('0x0'));var config=require(_0x4491('0x1'));var utils=require(_0x4491('0x2'));var util=require(_0x4491('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x4491('0x4')]?!config[_0x4491('0x5')][_0x4491('0x4')]:!![];var isProduction=config['env']===_0x4491('0x6')||![];var isLocalAsterisk=config[_0x4491('0x5')]&&config[_0x4491('0x5')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x4491('0x7')],config[_0x4491('0x8')]['ip'],config['asterisk'][_0x4491('0x9')],config[_0x4491('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x4491('0xa')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x4491('0xa')](_0x4491('0xb'));}else{var agents=require(_0x4491('0xc'));var calls=require(_0x4491('0xd'));var queues=require(_0x4491('0xe'));var recordings=require(_0x4491('0xf'));var members=require(_0x4491('0x10'));var dials=require('./dials.controller');var transfers=require(_0x4491('0x11'));var core=require(_0x4491('0x12'));ami['on'](_0x4491('0x13'),core['connect']);ami['on'](_0x4491('0x14'),core[_0x4491('0x14')]);ami['on']('fullybooted',core[_0x4491('0x15')]);ami['on'](_0x4491('0x16'),core[_0x4491('0x16')]);ami['on'](_0x4491('0x17'),core[_0x4491('0x17')]);ami['on'](_0x4491('0x18'),core[_0x4491('0x18')]);ami['on'](_0x4491('0x19'),function(_0x548d9f){try{utils['debug'](util[_0x4491('0x1a')]('[%s][index][devicestatechange]',_0x548d9f[_0x4491('0x1b')]),_0x548d9f);members[_0x4491('0x19')](_0x548d9f);}catch(_0x581d32){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x1c'),_0x548d9f['device']),_0x581d32);}});ami['on']('agentcalled',function(_0x5303c5){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x1e'),_0x5303c5['uniqueid']),_0x5303c5);agents['agentcalled'](_0x5303c5);}catch(_0x14408e){utils[_0x4491('0x16')](util['format'](_0x4491('0x1e'),_0x5303c5[_0x4491('0x1f')]),_0x14408e);}});ami['on'](_0x4491('0x20'),function(_0x292cfe){try{utils[_0x4491('0x1d')](util['format'](_0x4491('0x21'),_0x292cfe['uniqueid']),_0x292cfe);agents[_0x4491('0x20')](_0x292cfe);}catch(_0x113217){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x21'),_0x292cfe['uniqueid']),_0x113217);}});ami['on'](_0x4491('0x22'),function(_0x4f6f32){try{utils['debug'](util[_0x4491('0x1a')](_0x4491('0x23'),_0x4f6f32[_0x4491('0x1f')]),_0x4f6f32);agents['agentconnect'](_0x4f6f32);queues['agentconnect'](_0x4f6f32);}catch(_0x1a4aab){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x23'),_0x4f6f32[_0x4491('0x1f')]),_0x1a4aab);}});ami['on'](_0x4491('0x24'),function(_0x3f4ab5){try{utils['debug'](util['format'](_0x4491('0x25'),_0x3f4ab5[_0x4491('0x1f')]),_0x3f4ab5);agents['agentcomplete'](_0x3f4ab5);queues['agentcomplete'](_0x3f4ab5);members[_0x4491('0x24')](_0x3f4ab5);}catch(_0x484dd0){utils[_0x4491('0x16')](util['format'](_0x4491('0x25'),_0x3f4ab5['uniqueid']),_0x484dd0);}});ami['on'](_0x4491('0x26'),function(_0x119bf6){try{utils['debug'](util['format'](_0x4491('0x27'),_0x119bf6[_0x4491('0x1f')]),_0x119bf6);agents[_0x4491('0x26')](_0x119bf6);queues['queuecallerabandon'](_0x119bf6);}catch(_0x3d54c0){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x27'),_0x119bf6['uniqueid']),_0x3d54c0);}});ami['on'](_0x4491('0x28'),function(_0x47b822){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x29'),_0x47b822[_0x4491('0x1f')]),_0x47b822);queues['queuecallerjoin'](_0x47b822);recordings[_0x4491('0x28')](_0x47b822);}catch(_0x2bd048){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x29'),_0x47b822[_0x4491('0x1f')]),_0x2bd048);}});ami['on'](_0x4491('0x2a'),function(_0x465e92){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x2b'),_0x465e92[_0x4491('0x1f')]),_0x465e92);queues[_0x4491('0x2a')](_0x465e92);}catch(_0x5c8ef6){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x2b'),_0x465e92[_0x4491('0x1f')]),_0x5c8ef6);}});ami['on'](_0x4491('0x2c'),function(_0x208979){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')]('[%s][index][musiconholdstart]',_0x208979['uniqueid']),_0x208979);queues[_0x4491('0x2c')](_0x208979);calls['musiconholdstart'](_0x208979);}catch(_0x164649){utils[_0x4491('0x16')](util['format'](_0x4491('0x2d'),_0x208979[_0x4491('0x1f')]),_0x164649);}});ami['on'](_0x4491('0x2e'),function(_0x3fb129){try{utils[_0x4491('0x1d')](util['format'](_0x4491('0x2f'),_0x3fb129[_0x4491('0x1f')]),_0x3fb129);queues[_0x4491('0x2e')](_0x3fb129);calls[_0x4491('0x2e')](_0x3fb129);}catch(_0x265c02){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x2f'),_0x3fb129['uniqueid']),_0x265c02);}});ami['on'](_0x4491('0x30'),function(_0x178888){try{utils[_0x4491('0x1d')](util['format']('[%s][index][newstate]',_0x178888[_0x4491('0x1f')]),_0x178888);calls[_0x4491('0x30')](_0x178888);recordings[_0x4491('0x30')](_0x178888);}catch(_0x2aa586){utils['error'](util[_0x4491('0x1a')](_0x4491('0x31'),_0x178888[_0x4491('0x1f')]),_0x2aa586);}});ami['on'](_0x4491('0x32'),function(_0x460a18){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x33'),_0x460a18[_0x4491('0x1f')]),_0x460a18);calls['hangup'](_0x460a18);recordings[_0x4491('0x32')](_0x460a18);dials[_0x4491('0x32')](_0x460a18);agents[_0x4491('0x32')](_0x460a18);queues[_0x4491('0x32')](_0x460a18);}catch(_0x12c794){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x33'),_0x460a18[_0x4491('0x1f')]),_0x12c794);}});ami['on'](_0x4491('0x34'),function(_0x5d2328){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')]('[%s][index][cdr]',_0x5d2328[_0x4491('0x1f')]),_0x5d2328);members[_0x4491('0x34')](_0x5d2328);}catch(_0x25ac81){utils[_0x4491('0x16')](util['format'](_0x4491('0x35'),_0x5d2328['uniqueid']),_0x25ac81);}});ami['on']('blindtransfer',function(_0x374dff){try{utils['debug'](util[_0x4491('0x1a')](_0x4491('0x36'),_0x374dff[_0x4491('0x1f')]),_0x374dff);queues[_0x4491('0x37')](_0x374dff);agents[_0x4491('0x37')](_0x374dff);transfers['blindtransfer'](_0x374dff);}catch(_0x45140f){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x36'),_0x374dff[_0x4491('0x1f')]),_0x45140f);}});ami['on']('attendedtransfer',function(_0x5c64c2){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x38'),_0x5c64c2[_0x4491('0x39')]),_0x5c64c2);queues[_0x4491('0x3a')](_0x5c64c2);transfers[_0x4491('0x3a')](_0x5c64c2);agents[_0x4491('0x3a')](_0x5c64c2);calls['attendedtransfer'](_0x5c64c2);}catch(_0x3d2757){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x38'),_0x5c64c2[_0x4491('0x39')]),_0x3d2757);}});ami['on']('varset',function(_0x207cc6){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')]('[%s][index][varset]',_0x207cc6[_0x4491('0x1f')]),_0x207cc6);queues[_0x4491('0x3b')](_0x207cc6);recordings[_0x4491('0x3b')](_0x207cc6);calls[_0x4491('0x3b')](_0x207cc6);dials[_0x4491('0x3b')](_0x207cc6);}catch(_0x4b283b){utils[_0x4491('0x16')](util['format']('[%s][index][varset]',_0x207cc6[_0x4491('0x1f')]),_0x4b283b);}});ami['on'](_0x4491('0x3c'),function(_0x1ebd97){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')](_0x4491('0x3d'),_0x1ebd97[_0x4491('0x1f')]),_0x1ebd97);calls['newexten'](_0x1ebd97);recordings[_0x4491('0x3c')](_0x1ebd97);dials[_0x4491('0x3c')](_0x1ebd97);}catch(_0x5bc851){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x3d'),_0x1ebd97[_0x4491('0x1f')]),_0x5bc851);}});ami['on'](_0x4491('0x3e'),function(_0x418fcd){try{utils[_0x4491('0x1d')](util[_0x4491('0x1a')]('[%s][index][newchannel]',_0x418fcd[_0x4491('0x1f')]),_0x418fcd);calls[_0x4491('0x3e')](_0x418fcd);recordings[_0x4491('0x3e')](_0x418fcd);}catch(_0x496ceb){utils[_0x4491('0x16')](util['format']('[%s][index][newchannel]',_0x418fcd[_0x4491('0x1f')]),_0x496ceb);}});ami['on'](_0x4491('0x3f'),function(_0x2e146e){try{utils['debug'](util[_0x4491('0x1a')](_0x4491('0x40'),_0x2e146e[_0x4491('0x1f')]),_0x2e146e);dials[_0x4491('0x3f')](_0x2e146e);}catch(_0x39f00f){utils[_0x4491('0x16')](util[_0x4491('0x1a')](_0x4491('0x41'),_0x2e146e[_0x4491('0x1f')]),_0x39f00f);}});ami['on']('dialend',function(_0x3e1dd7){try{utils[_0x4491('0x1d')](util['format'](_0x4491('0x42'),_0x3e1dd7[_0x4491('0x1f')]),_0x3e1dd7);dials[_0x4491('0x43')](_0x3e1dd7);}catch(_0x37eddf){utils['error'](util[_0x4491('0x1a')](_0x4491('0x42'),_0x3e1dd7[_0x4491('0x1f')]),_0x37eddf);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 77ede8b..383cac6 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 _0x9965=['catch','error','some','startsWith','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','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','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request'];(function(_0x1e555e,_0x54c9d1){var _0x15ea08=function(_0x5d15c2){while(--_0x5d15c2){_0x1e555e['push'](_0x1e555e['shift']());}};_0x15ea08(++_0x54c9d1);}(_0x9965,0xf4));var _0x5996=function(_0x2a0d11,_0x478227){_0x2a0d11=_0x2a0d11-0x0;var _0x3352d3=_0x9965[_0x2a0d11];return _0x3352d3;};'use strict';var _=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));var utils=require(_0x5996('0x2'));var members={};var exclude=[_0x5996('0x3'),_0x5996('0x4')];function writeDB(_0x4fd74c){utils[_0x5996('0x5')](util[_0x5996('0x6')](_0x5996('0x7'),_0x4fd74c[_0x5996('0x8')],_0x4fd74c[_0x5996('0x9')],_0x4fd74c[_0x5996('0xa')],_0x4fd74c['data2'],_0x4fd74c[_0x5996('0xb')],_0x4fd74c[_0x5996('0xc')]));if(_0x4fd74c[_0x5996('0x9')]){utils[_0x5996('0xd')](_0x4fd74c[_0x5996('0x9')])[_0x5996('0xe')](function(_0x149cbc){if(_0x149cbc){_0x4fd74c[_0x5996('0xb')]=_0x149cbc[_0x5996('0xf')];_0x4fd74c[_0x5996('0x10')]=_0x149cbc[_0x5996('0x10')];utils['request'](_0x5996('0x11'),_0x4fd74c);}else{utils[_0x5996('0x12')](_0x4fd74c[_0x5996('0x9')][_0x5996('0x13')]('/')[0x1])[_0x5996('0xe')](function(_0x1422b0){if(_0x1422b0){_0x4fd74c[_0x5996('0xb')]=_0x1422b0[_0x5996('0xf')];_0x4fd74c[_0x5996('0x10')]=_0x1422b0['internal'];utils[_0x5996('0x14')](_0x5996('0x11'),_0x4fd74c);}});}})[_0x5996('0x15')](function(_0x1af162){utils[_0x5996('0x16')](util['format']('[%s][members][writeDB]',_0x4fd74c['uniqueid']),_0x1af162);});}delete members[_0x4fd74c[_0x5996('0x9')]];}function startsWith(_0x245994,_0x5798f3){return _[_0x5996('0x17')](_0x245994,function(_0x3f6e5b){return _[_0x5996('0x18')](_0x5798f3,_0x3f6e5b);});}exports['devicestatechange']=function(_0xf7e22e){try{utils['debug'](util[_0x5996('0x6')](_0x5996('0x19'),members[_0xf7e22e[_0x5996('0x1a')]]?members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x8')]:_0xf7e22e['device']),_0xf7e22e);utils[_0x5996('0x5')](util[_0x5996('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xf7e22e[_0x5996('0x1a')]]?members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x8')]:_0xf7e22e[_0x5996('0x1a')],_0xf7e22e[_0x5996('0x1b')],_0xf7e22e['device']));switch(_0xf7e22e[_0x5996('0x1b')]){case _0x5996('0x1c'):case'BUSY':if(!startsWith(exclude,_0xf7e22e[_0x5996('0x1a')])){members[_0xf7e22e['device']]={'channel':_0x5996('0x1d'),'interface':_0xf7e22e[_0x5996('0x1a')],'type':_0x5996('0x1e'),'enterAt':utils['now'](),'role':_0x5996('0x1f')};}break;case _0x5996('0x20'):if(!_[_0x5996('0x21')](members[_0xf7e22e[_0x5996('0x1a')]])){members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x22')]=utils['now']();members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x23')]=utils[_0x5996('0x24')](members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x22')],members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x25')]);if(members[_0xf7e22e['device']][_0x5996('0x8')]){writeDB(members[_0xf7e22e['device']]);}}break;default:break;}}catch(_0x3861bd){utils[_0x5996('0x16')](util[_0x5996('0x6')](_0x5996('0x19'),members[_0xf7e22e[_0x5996('0x1a')]]?members[_0xf7e22e[_0x5996('0x1a')]][_0x5996('0x8')]:_0xf7e22e[_0x5996('0x1a')]),_0x3861bd);}};exports[_0x5996('0x26')]=function(_0x273d8b){try{if(!_[_0x5996('0x21')](members[_0x273d8b['interface']])){utils[_0x5996('0x27')](util[_0x5996('0x6')](_0x5996('0x28'),_0x273d8b['uniqueid']),_0x273d8b);utils[_0x5996('0x5')](util[_0x5996('0x6')](_0x5996('0x29'),_0x273d8b[_0x5996('0x8')],_0x273d8b['interface'],_0x273d8b[_0x5996('0x2a')]));members[_0x273d8b[_0x5996('0x9')]]=_[_0x5996('0x2b')](members[_0x273d8b['interface']],{'data4':_0x273d8b['queue'],'uniqueid':_0x273d8b[_0x5996('0x8')]});}}catch(_0x2ca4a2){utils[_0x5996('0x16')](util[_0x5996('0x6')]('[%s][members][agentcomplete]',_0x273d8b[_0x5996('0x8')]),_0x2ca4a2);}};exports[_0x5996('0x2c')]=function(_0x4689ee){try{utils[_0x5996('0x27')](util[_0x5996('0x6')](_0x5996('0x2d'),_0x4689ee[_0x5996('0x8')]),_0x4689ee);if(_0x4689ee[_0x5996('0xa')]){var _0xef3805=_0x4689ee[_0x5996('0xa')]['split']('-')[0x0];if(!_[_0x5996('0x21')](members[_0xef3805])){members[_0xef3805]=_[_0x5996('0x2b')](members[_0xef3805],{'data1':members[_0xef3805][_0x5996('0x2e')]||_0x4689ee[_0x5996('0xc')],'data2':members[_0xef3805][_0x5996('0x2f')]||_0x4689ee['source'],'data3':members[_0xef3805][_0x5996('0x30')]||_0x4689ee[_0x5996('0x31')],'uniqueid':members[_0xef3805][_0x5996('0x8')]||_0x4689ee[_0x5996('0x8')]});utils[_0x5996('0x5')](util['format'](_0x5996('0x32'),_0x4689ee['uniqueid'],members[_0xef3805][_0x5996('0x2e')],members[_0xef3805][_0x5996('0x2f')],members[_0xef3805][_0x5996('0x30')]));if(members[_0xef3805][_0x5996('0x22')]){writeDB(members[_0xef3805]);}}}if(_0x4689ee['destinationchannel']){var _0x1fb7e0=_0x4689ee[_0x5996('0x33')][_0x5996('0x13')]('-')[0x0];if(!_[_0x5996('0x21')](members[_0x1fb7e0])){members[_0x1fb7e0]=_[_0x5996('0x2b')](members[_0x1fb7e0],{'data1':members[_0x1fb7e0][_0x5996('0x2e')]||_0x4689ee['type'],'data2':members[_0x1fb7e0]['data2']||_0x4689ee[_0x5996('0x34')],'data3':members[_0x1fb7e0][_0x5996('0x30')]||_0x4689ee['destination'],'uniqueid':members[_0x1fb7e0][_0x5996('0x8')]||_0x4689ee['uniqueid']});utils['info'](util[_0x5996('0x6')](_0x5996('0x32'),_0x4689ee[_0x5996('0x8')],members[_0x1fb7e0][_0x5996('0x2e')],members[_0x1fb7e0][_0x5996('0x2f')],members[_0x1fb7e0][_0x5996('0x30')]));if(members[_0x1fb7e0][_0x5996('0x22')]){writeDB(members[_0x1fb7e0]);}}}}catch(_0x200b30){utils[_0x5996('0x16')](util['format'](_0x5996('0x2d'),_0x4689ee['uniqueid']),_0x200b30);}}; \ No newline at end of file +var _0x3d10=['agent','NOT_INUSE','isNil','exitAt','duration','agentcomplete','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','assign','data1','data3','destination','data2','destinationchannel','source','lodash','./utils','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now'];(function(_0x292998,_0x5ac782){var _0x5aeb56=function(_0x1dbfe0){while(--_0x1dbfe0){_0x292998['push'](_0x292998['shift']());}};_0x5aeb56(++_0x5ac782);}(_0x3d10,0x7b));var _0x03d1=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3d10[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x03d1('0x0'));var util=require('util');var utils=require(_0x03d1('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x03d1('0x2')];function writeDB(_0x22962c){utils['info'](util['format'](_0x03d1('0x3'),_0x22962c[_0x03d1('0x4')],_0x22962c[_0x03d1('0x5')],_0x22962c[_0x03d1('0x6')],_0x22962c['data2'],_0x22962c[_0x03d1('0x7')],_0x22962c[_0x03d1('0x8')]));if(_0x22962c[_0x03d1('0x5')]){utils['getUserByInterface'](_0x22962c[_0x03d1('0x5')])[_0x03d1('0x9')](function(_0x2fcd8a){if(_0x2fcd8a){_0x22962c[_0x03d1('0x7')]=_0x2fcd8a[_0x03d1('0xa')];_0x22962c[_0x03d1('0xb')]=_0x2fcd8a['internal'];utils[_0x03d1('0xc')](_0x03d1('0xd'),_0x22962c);}else{utils[_0x03d1('0xe')](_0x22962c[_0x03d1('0x5')][_0x03d1('0xf')]('/')[0x1])[_0x03d1('0x9')](function(_0x54b892){if(_0x54b892){_0x22962c[_0x03d1('0x7')]=_0x54b892[_0x03d1('0xa')];_0x22962c[_0x03d1('0xb')]=_0x54b892[_0x03d1('0xb')];utils['request'](_0x03d1('0xd'),_0x22962c);}});}})[_0x03d1('0x10')](function(_0x537fb2){utils[_0x03d1('0x11')](util[_0x03d1('0x12')](_0x03d1('0x13'),_0x22962c[_0x03d1('0x4')]),_0x537fb2);});}delete members[_0x22962c[_0x03d1('0x5')]];}function startsWith(_0x242513,_0x2d6983){return _[_0x03d1('0x14')](_0x242513,function(_0x166707){return _[_0x03d1('0x15')](_0x2d6983,_0x166707);});}exports[_0x03d1('0x16')]=function(_0x4c29ea){try{utils[_0x03d1('0x17')](util['format'](_0x03d1('0x18'),members[_0x4c29ea[_0x03d1('0x19')]]?members[_0x4c29ea['device']][_0x03d1('0x4')]:_0x4c29ea[_0x03d1('0x19')]),_0x4c29ea);utils['info'](util['format'](_0x03d1('0x1a'),members[_0x4c29ea[_0x03d1('0x19')]]?members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x4')]:_0x4c29ea['device'],_0x4c29ea[_0x03d1('0x1b')],_0x4c29ea[_0x03d1('0x19')]));switch(_0x4c29ea[_0x03d1('0x1b')]){case _0x03d1('0x1c'):case _0x03d1('0x1d'):if(!startsWith(exclude,_0x4c29ea[_0x03d1('0x19')])){members[_0x4c29ea['device']]={'channel':_0x03d1('0x1e'),'interface':_0x4c29ea[_0x03d1('0x19')],'type':_0x03d1('0x1f'),'enterAt':utils[_0x03d1('0x20')](),'role':_0x03d1('0x21')};}break;case _0x03d1('0x22'):if(!_[_0x03d1('0x23')](members[_0x4c29ea[_0x03d1('0x19')]])){members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x24')]=utils[_0x03d1('0x20')]();members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x25')]=utils['diffTime'](members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x24')],members[_0x4c29ea[_0x03d1('0x19')]]['enterAt']);if(members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x4')]){writeDB(members[_0x4c29ea[_0x03d1('0x19')]]);}}break;default:break;}}catch(_0x49b22b){utils['error'](util[_0x03d1('0x12')](_0x03d1('0x18'),members[_0x4c29ea['device']]?members[_0x4c29ea[_0x03d1('0x19')]][_0x03d1('0x4')]:_0x4c29ea['device']),_0x49b22b);}};exports[_0x03d1('0x26')]=function(_0x3c19e3){try{if(!_[_0x03d1('0x23')](members[_0x3c19e3[_0x03d1('0x5')]])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x3c19e3[_0x03d1('0x4')]),_0x3c19e3);utils[_0x03d1('0x27')](util['format'](_0x03d1('0x28'),_0x3c19e3[_0x03d1('0x4')],_0x3c19e3[_0x03d1('0x5')],_0x3c19e3[_0x03d1('0x29')]));members[_0x3c19e3[_0x03d1('0x5')]]=_['assign'](members[_0x3c19e3[_0x03d1('0x5')]],{'data4':_0x3c19e3['queue'],'uniqueid':_0x3c19e3[_0x03d1('0x4')]});}}catch(_0x3fc593){utils[_0x03d1('0x11')](util[_0x03d1('0x12')](_0x03d1('0x2a'),_0x3c19e3['uniqueid']),_0x3fc593);}};exports[_0x03d1('0x2b')]=function(_0x5d9b21){try{utils[_0x03d1('0x17')](util[_0x03d1('0x12')](_0x03d1('0x2c'),_0x5d9b21[_0x03d1('0x4')]),_0x5d9b21);if(_0x5d9b21[_0x03d1('0x6')]){var _0x27258a=_0x5d9b21[_0x03d1('0x6')]['split']('-')[0x0];if(!_[_0x03d1('0x23')](members[_0x27258a])){members[_0x27258a]=_[_0x03d1('0x2d')](members[_0x27258a],{'data1':members[_0x27258a][_0x03d1('0x2e')]||_0x5d9b21['type'],'data2':members[_0x27258a]['data2']||_0x5d9b21['source'],'data3':members[_0x27258a][_0x03d1('0x2f')]||_0x5d9b21[_0x03d1('0x30')],'uniqueid':members[_0x27258a][_0x03d1('0x4')]||_0x5d9b21[_0x03d1('0x4')]});utils[_0x03d1('0x27')](util[_0x03d1('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5d9b21[_0x03d1('0x4')],members[_0x27258a]['data1'],members[_0x27258a][_0x03d1('0x31')],members[_0x27258a][_0x03d1('0x2f')]));if(members[_0x27258a][_0x03d1('0x24')]){writeDB(members[_0x27258a]);}}}if(_0x5d9b21[_0x03d1('0x32')]){var _0x3f6dfe=_0x5d9b21[_0x03d1('0x32')]['split']('-')[0x0];if(!_[_0x03d1('0x23')](members[_0x3f6dfe])){members[_0x3f6dfe]=_[_0x03d1('0x2d')](members[_0x3f6dfe],{'data1':members[_0x3f6dfe][_0x03d1('0x2e')]||_0x5d9b21['type'],'data2':members[_0x3f6dfe][_0x03d1('0x31')]||_0x5d9b21[_0x03d1('0x33')],'data3':members[_0x3f6dfe][_0x03d1('0x2f')]||_0x5d9b21[_0x03d1('0x30')],'uniqueid':members[_0x3f6dfe]['uniqueid']||_0x5d9b21[_0x03d1('0x4')]});utils[_0x03d1('0x27')](util[_0x03d1('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5d9b21[_0x03d1('0x4')],members[_0x3f6dfe][_0x03d1('0x2e')],members[_0x3f6dfe][_0x03d1('0x31')],members[_0x3f6dfe]['data3']));if(members[_0x3f6dfe]['exitAt']){writeDB(members[_0x3f6dfe]);}}}}catch(_0x4f465b){utils[_0x03d1('0x11')](util[_0x03d1('0x12')](_0x03d1('0x2c'),_0x5d9b21[_0x03d1('0x4')]),_0x4f465b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6618d37..f587944 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 _0x37f5=['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','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','CreateVoiceQueueReport','request','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt'];(function(_0x1827d0,_0x3ef020){var _0x17e779=function(_0xf62c40){while(--_0xf62c40){_0x1827d0['push'](_0x1827d0['shift']());}};_0x17e779(++_0x3ef020);}(_0x37f5,0xa1));var _0x537f=function(_0x59ac47,_0x243b55){_0x59ac47=_0x59ac47-0x0;var _0x475c0d=_0x37f5[_0x59ac47];return _0x475c0d;};'use strict';var _=require(_0x537f('0x0'));var util=require(_0x537f('0x1'));var utils=require(_0x537f('0x2'));var queues={};function writeDB(_0x32fa9b){utils[_0x537f('0x3')](util[_0x537f('0x4')](_0x537f('0x5'),_0x32fa9b[_0x537f('0x6')],_0x32fa9b[_0x537f('0x7')],_0x32fa9b[_0x537f('0x8')],_0x32fa9b['lastAssignedTo'],_0x32fa9b[_0x537f('0x9')],_0x32fa9b['accountcode'],_0x32fa9b[_0x537f('0xa')]));if(_0x32fa9b[_0x537f('0x8')]){utils[_0x537f('0xb')](_0x32fa9b[_0x537f('0x8')])['then'](function(_0xc2d25a){if(_0xc2d25a){_0x32fa9b['type']=_0xc2d25a['type'];}utils['request'](_0x537f('0xc'),_0x32fa9b);});}else{utils[_0x537f('0xd')]('CreateVoiceQueueReport',_0x32fa9b);}if(_0x32fa9b[_0x537f('0xe')]){delete queues[_0x32fa9b[_0x537f('0xe')]];}else{delete queues[_0x32fa9b[_0x537f('0x6')]];}}exports['queuecallerjoin']=function(_0x325454){try{utils[_0x537f('0xf')](util[_0x537f('0x4')](_0x537f('0x10'),_0x325454[_0x537f('0x6')]),_0x325454);utils[_0x537f('0x3')](util['format'](_0x537f('0x11'),_0x325454[_0x537f('0x6')],_0x325454[_0x537f('0x8')],_0x325454[_0x537f('0x12')]));queues[_0x325454[_0x537f('0x6')]]=_[_0x537f('0x13')](_0x325454,{'originalposition':_0x325454[_0x537f('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x31f5ac){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x10'),_0x325454['uniqueid']),_0x31f5ac);}};exports[_0x537f('0x15')]=function(_0x5864e3){try{if(!_[_0x537f('0x16')](queues[_0x5864e3[_0x537f('0x6')]])){utils[_0x537f('0xf')](util[_0x537f('0x4')]('[%s][queues][hangup]',_0x5864e3[_0x537f('0x6')]),_0x5864e3);if(queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0x17')]){if(!queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0x18')]&&!queues[_0x5864e3['uniqueid']][_0x537f('0x19')]){queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0x1a')]=!![];queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0x1b')]=utils[_0x537f('0x1c')]();queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0xa')]=_0x537f('0x1d');}utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5864e3[_0x537f('0x6')],queues[_0x5864e3['uniqueid']][_0x537f('0x1e')],queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0xa')]));writeDB(queues[_0x5864e3[_0x537f('0x6')]]);}else if(queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0xe')]){utils[_0x537f('0x3')](util[_0x537f('0x4')](_0x537f('0x1f'),_0x5864e3[_0x537f('0x6')],queues[_0x5864e3['uniqueid']]['name'],queues[_0x5864e3[_0x537f('0x6')]]['transfereduniqueid']));queues[queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0xe')]]=queues[_0x5864e3[_0x537f('0x6')]];queues[queues[_0x5864e3[_0x537f('0x6')]][_0x537f('0xe')]][_0x537f('0x20')]=0x2;delete queues[_0x5864e3[_0x537f('0x6')]];}}}catch(_0x232795){utils['error'](util[_0x537f('0x4')](_0x537f('0x21'),_0x5864e3[_0x537f('0x6')]),_0x232795);}};exports[_0x537f('0x22')]=function(_0x21175a){try{utils[_0x537f('0xf')](util['format']('[%s][queues][varset]',_0x21175a[_0x537f('0x6')]),_0x21175a);if(!_[_0x537f('0x16')](_0x21175a[_0x537f('0x23')]['queuestatus'])&&_0x21175a[_0x537f('0x24')][_0x537f('0x25')]()!==_0x537f('0x26')){if(!_['isNil'](queues[_0x21175a[_0x537f('0x6')]])){queues[_0x21175a['uniqueid']][_0x537f('0x18')]=![];queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x27')]=null;queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x19')]=!![];queues[_0x21175a['uniqueid']][_0x537f('0x28')]=utils[_0x537f('0x1c')]();queues[_0x21175a[_0x537f('0x6')]][_0x537f('0xa')]=_0x21175a[_0x537f('0x24')]['toUpperCase']();utils[_0x537f('0x3')](util[_0x537f('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x21175a['uniqueid'],queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x1e')],_0x21175a[_0x537f('0x24')],queues[_0x21175a[_0x537f('0x6')]][_0x537f('0xa')]));writeDB(queues[_0x21175a[_0x537f('0x6')]]);}}else if(!_[_0x537f('0x16')](_0x21175a[_0x537f('0x23')]['queueposition'])){if(!_['isNil'](queues[_0x21175a[_0x537f('0x6')]])&&!queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x18')]){queues[_0x21175a[_0x537f('0x6')]]['queuecallerabandon']=![];queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x27')]=null;queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x19')]=!![];queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x28')]=utils['now']();queues[_0x21175a[_0x537f('0x6')]][_0x537f('0xa')]=_0x537f('0x29');utils[_0x537f('0x3')](util['format'](_0x537f('0x2a'),_0x21175a[_0x537f('0x6')],queues[_0x21175a[_0x537f('0x6')]][_0x537f('0x1e')],_0x21175a[_0x537f('0x24')],queues[_0x21175a['uniqueid']][_0x537f('0xa')]));}}}catch(_0x2fc204){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x2b'),_0x21175a[_0x537f('0x6')]),_0x2fc204);}};exports['queuecallerabandon']=function(_0x11746a){try{if(!_['isNil'](queues[_0x11746a[_0x537f('0x6')]])){utils[_0x537f('0xf')](util[_0x537f('0x4')](_0x537f('0x2c'),_0x11746a[_0x537f('0x6')]),_0x11746a);queues[_0x11746a[_0x537f('0x6')]]['queuecallerexit']=![];queues[_0x11746a[_0x537f('0x6')]][_0x537f('0x28')]=null;queues[_0x11746a[_0x537f('0x6')]][_0x537f('0x18')]=!![];queues[_0x11746a[_0x537f('0x6')]][_0x537f('0x27')]=utils['now']();queues[_0x11746a[_0x537f('0x6')]][_0x537f('0xa')]=_0x537f('0x2d');utils[_0x537f('0x3')](util['format'](_0x537f('0x2e'),_0x11746a[_0x537f('0x6')],queues[_0x11746a[_0x537f('0x6')]]['name'],queues[_0x11746a[_0x537f('0x6')]][_0x537f('0xa')]));}}catch(_0x135187){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x2c'),_0x11746a[_0x537f('0x6')]),_0x135187);}};exports['queuecallerleave']=function(_0x515b58){try{if(!_[_0x537f('0x16')](queues[_0x515b58['uniqueid']])){utils[_0x537f('0xf')](util[_0x537f('0x4')]('[%s][queues][queuecallerleave]',_0x515b58[_0x537f('0x6')]),_0x515b58);utils['info'](util['format'](_0x537f('0x2f'),_0x515b58[_0x537f('0x6')],queues[_0x515b58[_0x537f('0x6')]]['name'],_0x515b58[_0x537f('0x30')],_0x515b58[_0x537f('0x31')]));queues[_0x515b58['uniqueid']][_0x537f('0x32')]=!![];queues[_0x515b58[_0x537f('0x6')]][_0x537f('0x17')]=utils['now']();queues[_0x515b58[_0x537f('0x6')]]['holdtime']=utils[_0x537f('0x33')](queues[_0x515b58[_0x537f('0x6')]]['queuecallerleaveAt'],queues[_0x515b58[_0x537f('0x6')]][_0x537f('0x34')]);queues[_0x515b58[_0x537f('0x6')]][_0x537f('0x12')]=_0x515b58[_0x537f('0x12')];queues[_0x515b58[_0x537f('0x6')]][_0x537f('0x35')]=_0x515b58[_0x537f('0x35')];queues[_0x515b58['uniqueid']]['connectedlinenum']=_0x515b58[_0x537f('0x30')];queues[_0x515b58[_0x537f('0x6')]][_0x537f('0x31')]=_0x515b58[_0x537f('0x31')];}}catch(_0xd67e1f){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x36'),_0x515b58[_0x537f('0x6')]),_0xd67e1f);}};exports[_0x537f('0x37')]=function(_0x79af55){try{if(!_['isNil'](queues[_0x79af55[_0x537f('0x6')]])){utils[_0x537f('0xf')](util[_0x537f('0x4')](_0x537f('0x38'),_0x79af55['uniqueid']),_0x79af55);utils[_0x537f('0x3')](util[_0x537f('0x4')](_0x537f('0x39'),_0x79af55[_0x537f('0x6')],queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x1e')],_0x79af55[_0x537f('0x3a')],_0x79af55[_0x537f('0x3b')]));queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x18')]=![];queues[_0x79af55['uniqueid']][_0x537f('0x18')]=![];queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x27')]=null;queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x19')]=![];queues[_0x79af55[_0x537f('0x6')]]['queuecallerexitreason']=null;queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x28')]=null;queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x3c')]=!![];queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x3d')]=_0x79af55[_0x537f('0x3b')];queues[_0x79af55[_0x537f('0x6')]][_0x537f('0x3e')]=_0x79af55[_0x537f('0x3a')];}}catch(_0x4f2af6){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x38'),_0x79af55[_0x537f('0x6')]),_0x4f2af6);}};exports[_0x537f('0x3f')]=function(_0x160210){try{if(!_[_0x537f('0x16')](queues[_0x160210[_0x537f('0x6')]])){if(queues[_0x160210[_0x537f('0x6')]]['queuecallerleaveAt']){utils['debug'](util[_0x537f('0x4')](_0x537f('0x40'),_0x160210['uniqueid']),_0x160210);queues[_0x160210[_0x537f('0x6')]]['queuecallerabandon']=![];queues[_0x160210[_0x537f('0x6')]][_0x537f('0x18')]=![];queues[_0x160210[_0x537f('0x6')]]['queuecallerabandonAt']=null;queues[_0x160210[_0x537f('0x6')]][_0x537f('0x19')]=![];queues[_0x160210[_0x537f('0x6')]][_0x537f('0x28')]=null;queues[_0x160210[_0x537f('0x6')]]['assigned']=!![];queues[_0x160210['uniqueid']][_0x537f('0x3e')]=_0x160210[_0x537f('0x3a')];queues[_0x160210[_0x537f('0x6')]][_0x537f('0x1a')]=!![];queues[_0x160210[_0x537f('0x6')]][_0x537f('0x1b')]=utils[_0x537f('0x1c')]();if(_0x160210['reason']=='transfer'){if(!queues[_0x160210[_0x537f('0x6')]][_0x537f('0x41')]){queues[_0x160210['uniqueid']][_0x537f('0xa')]=_0x537f('0x42');}}else{queues[_0x160210['uniqueid']][_0x537f('0xa')]=_0x537f('0x43')+_0x160210['reason'][_0x537f('0x25')]();}utils['info'](util[_0x537f('0x4')](_0x537f('0x44'),_0x160210['uniqueid'],queues[_0x160210['uniqueid']][_0x537f('0x1e')],_0x160210[_0x537f('0x3a')],queues[_0x160210['uniqueid']][_0x537f('0xa')]));writeDB(queues[_0x160210['uniqueid']]);}}}catch(_0x45a0b3){utils['error'](util[_0x537f('0x4')](_0x537f('0x40'),_0x160210[_0x537f('0x6')]),_0x45a0b3);}};exports['blindtransfer']=function(_0x5dd57a){try{if(!_[_0x537f('0x16')](queues[_0x5dd57a[_0x537f('0x45')]])){utils[_0x537f('0xf')](util[_0x537f('0x4')](_0x537f('0x46'),_0x5dd57a[_0x537f('0x6')]),_0x5dd57a);queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0x41')]=!![];queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0x47')]='BLIND';queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0x48')]=_0x5dd57a[_0x537f('0x49')];queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0x4a')]=_0x5dd57a['transfereeuniqueid'];queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0xa')]=_0x537f('0x4b');utils[_0x537f('0x3')](util[_0x537f('0x4')](_0x537f('0x4c'),_0x5dd57a[_0x537f('0x6')],queues[_0x5dd57a[_0x537f('0x45')]][_0x537f('0x1e')],_0x5dd57a[_0x537f('0x45')],_0x5dd57a[_0x537f('0x49')]));}}catch(_0x3ac454){utils[_0x537f('0x14')](util[_0x537f('0x4')](_0x537f('0x46'),_0x5dd57a['uniqueid']),_0x3ac454);}};exports['attendedtransfer']=function(_0x11aaa8){try{utils[_0x537f('0xf')](util[_0x537f('0x4')](_0x537f('0x4d'),_0x11aaa8[_0x537f('0x4e')]),_0x11aaa8);if(_0x11aaa8[_0x537f('0x4e')]==_0x11aaa8[_0x537f('0x4f')]){if(!_['isNil'](queues[_0x11aaa8['secondtransfererlinkedid']])){utils[_0x537f('0x3')](util[_0x537f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x11aaa8[_0x537f('0x4e')],queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x1e')],_0x11aaa8[_0x537f('0x51')]));queues[_0x11aaa8[_0x537f('0x50')]]['transfer']=!![];queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x47')]=_0x537f('0x52');queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x48')]=_0x11aaa8[_0x537f('0x51')];queues[_0x11aaa8['secondtransfererlinkedid']][_0x537f('0x4a')]=_0x11aaa8[_0x537f('0x4e')];queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0xa')]=_0x537f('0x53');}if(!_[_0x537f('0x16')](queues[_0x11aaa8[_0x537f('0x4f')]])){if(_0x11aaa8['transfereelinkedid']&&queues[_0x11aaa8[_0x537f('0x54')]]){queues[_0x11aaa8['transfereelinkedid']][_0x537f('0x20')]=0x1;queues[_0x11aaa8[_0x537f('0x45')]]=_[_0x537f('0x55')](queues[_0x11aaa8[_0x537f('0x54')]]);queues[_0x11aaa8[_0x537f('0x45')]][_0x537f('0xe')]=_0x11aaa8[_0x537f('0x56')];queues[_0x11aaa8['transfereeuniqueid']][_0x537f('0x20')]=0x2;queues[_0x11aaa8[_0x537f('0x45')]][_0x537f('0x9')]=queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x9')];queues[_0x11aaa8[_0x537f('0x45')]]['calleridname']=queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x57')];queues[_0x11aaa8['transfereeuniqueid']][_0x537f('0x34')]=utils[_0x537f('0x1c')]();queues[_0x11aaa8[_0x537f('0x45')]][_0x537f('0x17')]=utils[_0x537f('0x1c')]();queues[_0x11aaa8['transfereeuniqueid']][_0x537f('0x58')]=0x0;queues[_0x11aaa8[_0x537f('0x45')]][_0x537f('0x59')]=0x0;utils[_0x537f('0x3')](util['format'](_0x537f('0x5a'),_0x11aaa8[_0x537f('0x4e')],queues[_0x11aaa8['transfereeuniqueid']][_0x537f('0x1e')],queues[_0x11aaa8['transfereeuniqueid']]['calleridnum'],queues[_0x11aaa8['transfereeuniqueid']]['calleridname']));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x11aaa8[_0x537f('0x4e')],queues[_0x11aaa8[_0x537f('0x4f')]]['name'],_0x11aaa8[_0x537f('0x50')]));queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0xe')]=_0x11aaa8[_0x537f('0x50')];}}}else if(_0x11aaa8[_0x537f('0x5b')]==_0x11aaa8[_0x537f('0x50')]){if(!_['isNil'](queues[_0x11aaa8['origtransfererlinkedid']])){utils['info'](util[_0x537f('0x4')](_0x537f('0x5c'),_0x11aaa8[_0x537f('0x4e')],queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x1e')],_0x11aaa8['secondtransfereruniqueid'],_0x11aaa8['secondtransfererexten']));queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x41')]=!![];queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x47')]=_0x537f('0x52');queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x48')]=_0x11aaa8[_0x537f('0x5d')];queues[_0x11aaa8['origtransfererlinkedid']][_0x537f('0x4a')]=_0x11aaa8[_0x537f('0x5b')];queues[_0x11aaa8['origtransfererlinkedid']][_0x537f('0xa')]=_0x537f('0x53');}if(!_[_0x537f('0x16')](queues[_0x11aaa8[_0x537f('0x50')]])){if(_0x11aaa8['transfertargetlinkedid']&&queues[_0x11aaa8[_0x537f('0x5e')]]){queues[_0x11aaa8[_0x537f('0x5e')]][_0x537f('0x20')]=0x1;queues[_0x11aaa8[_0x537f('0x56')]]=_[_0x537f('0x55')](queues[_0x11aaa8['transfertargetlinkedid']]);queues[_0x11aaa8[_0x537f('0x56')]]['transfereduniqueid']=_0x11aaa8['transfertargetuniqueid'];queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x20')]=0x2;queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x9')]=queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x9')];queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x57')]=queues[_0x11aaa8[_0x537f('0x4f')]][_0x537f('0x57')];queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x34')]=utils[_0x537f('0x1c')]();queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x17')]=utils[_0x537f('0x1c')]();queues[_0x11aaa8['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x59')]=0x0;utils[_0x537f('0x3')](util['format'](_0x537f('0x5f'),_0x11aaa8['origtransfereruniqueid'],queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x1e')],queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0xe')],queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x9')],queues[_0x11aaa8[_0x537f('0x56')]][_0x537f('0x57')]));}else{utils[_0x537f('0x3')](util[_0x537f('0x4')](_0x537f('0x60'),_0x11aaa8[_0x537f('0x4e')],queues[_0x11aaa8[_0x537f('0x50')]][_0x537f('0x1e')],_0x11aaa8[_0x537f('0x4f')]));queues[_0x11aaa8['secondtransfererlinkedid']][_0x537f('0xe')]=_0x11aaa8[_0x537f('0x4f')];}}}}catch(_0x3cc0db){utils[_0x537f('0x14')](util[_0x537f('0x4')]('[%s][queues][attendedtransfer]',_0x11aaa8['origtransfereruniqueid']),_0x3cc0db);}};exports['musiconholdstart']=function(_0x4f95e6){try{if(!_[_0x537f('0x16')](queues[_0x4f95e6[_0x537f('0x6')]])){utils['debug'](util['format'](_0x537f('0x61'),_0x4f95e6[_0x537f('0x6')]),_0x4f95e6);queues[_0x4f95e6[_0x537f('0x6')]][_0x537f('0x62')]=utils['now']();utils['info'](util[_0x537f('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4f95e6['uniqueid'],queues[_0x4f95e6[_0x537f('0x6')]][_0x537f('0x1e')],queues[_0x4f95e6['uniqueid']][_0x537f('0x62')]));}}catch(_0x2285c6){utils[_0x537f('0x14')](util[_0x537f('0x4')]('[%s][queues][musiconholdstart]',_0x4f95e6[_0x537f('0x6')]),_0x2285c6);}};exports['musiconholdstop']=function(_0xbb0785){try{if(!_['isNil'](queues[_0xbb0785[_0x537f('0x6')]])){if(!_[_0x537f('0x16')](queues[_0xbb0785[_0x537f('0x6')]]['musiconholdstartAt'])){utils['debug'](util[_0x537f('0x4')]('[%s][queues][musiconholdstop]',_0xbb0785[_0x537f('0x6')]),_0xbb0785);queues[_0xbb0785[_0x537f('0x6')]][_0x537f('0x59')]+=utils[_0x537f('0x33')](utils[_0x537f('0x1c')](),queues[_0xbb0785[_0x537f('0x6')]][_0x537f('0x62')]);utils[_0x537f('0x3')](util['format'](_0x537f('0x63'),_0xbb0785[_0x537f('0x6')],queues[_0xbb0785['uniqueid']][_0x537f('0x1e')],queues[_0xbb0785['uniqueid']][_0x537f('0x59')]));delete queues[_0xbb0785[_0x537f('0x6')]][_0x537f('0x62')];}}}catch(_0x2632bd){utils['error'](util[_0x537f('0x4')](_0x537f('0x64'),_0xbb0785['uniqueid']),_0x2632bd);}}; \ No newline at end of file +var _0x4370=['[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexit','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4370,0x1c1));var _0x0437=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4370[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0437('0x0'));var utils=require(_0x0437('0x1'));var queues={};function writeDB(_0x4b25bb){utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x4'),_0x4b25bb[_0x0437('0x5')],_0x4b25bb[_0x0437('0x6')],_0x4b25bb[_0x0437('0x7')],_0x4b25bb[_0x0437('0x8')],_0x4b25bb[_0x0437('0x9')],_0x4b25bb['accountcode'],_0x4b25bb[_0x0437('0xa')]));if(_0x4b25bb['queue']){utils['getVoiceQueueByName'](_0x4b25bb[_0x0437('0x7')])[_0x0437('0xb')](function(_0x20ba3c){if(_0x20ba3c){_0x4b25bb[_0x0437('0xc')]=_0x20ba3c[_0x0437('0xc')];}utils['request']('CreateVoiceQueueReport',_0x4b25bb);});}else{utils[_0x0437('0xd')](_0x0437('0xe'),_0x4b25bb);}if(_0x4b25bb['transfereduniqueid']){delete queues[_0x4b25bb[_0x0437('0xf')]];}else{delete queues[_0x4b25bb['uniqueid']];}}exports[_0x0437('0x10')]=function(_0x29a699){try{utils[_0x0437('0x11')](util['format'](_0x0437('0x12'),_0x29a699['uniqueid']),_0x29a699);utils['info'](util['format'](_0x0437('0x13'),_0x29a699['uniqueid'],_0x29a699[_0x0437('0x7')],_0x29a699['position']));queues[_0x29a699[_0x0437('0x5')]]=_[_0x0437('0x14')](_0x29a699,{'originalposition':_0x29a699[_0x0437('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x249ec2){utils['error'](util[_0x0437('0x3')](_0x0437('0x12'),_0x29a699[_0x0437('0x5')]),_0x249ec2);}};exports['hangup']=function(_0x19a5fc){try{if(!_[_0x0437('0x16')](queues[_0x19a5fc[_0x0437('0x5')]])){utils[_0x0437('0x11')](util['format'](_0x0437('0x17'),_0x19a5fc[_0x0437('0x5')]),_0x19a5fc);if(queues[_0x19a5fc['uniqueid']][_0x0437('0x18')]){if(!queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0x19')]&&!queues[_0x19a5fc[_0x0437('0x5')]]['queuecallerexit']){queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0x1a')]=!![];queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0x1b')]=utils['now']();queues[_0x19a5fc['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x0437('0x2')](util[_0x0437('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x19a5fc[_0x0437('0x5')],queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0x1c')],queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0xa')]));writeDB(queues[_0x19a5fc['uniqueid']]);}else if(queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0xf')]){utils['info'](util['format'](_0x0437('0x1d'),_0x19a5fc[_0x0437('0x5')],queues[_0x19a5fc[_0x0437('0x5')]]['name'],queues[_0x19a5fc[_0x0437('0x5')]]['transfereduniqueid']));queues[queues[_0x19a5fc[_0x0437('0x5')]][_0x0437('0xf')]]=queues[_0x19a5fc[_0x0437('0x5')]];queues[queues[_0x19a5fc['uniqueid']][_0x0437('0xf')]][_0x0437('0x1e')]=0x2;delete queues[_0x19a5fc[_0x0437('0x5')]];}}}catch(_0x530556){utils[_0x0437('0x1f')](util[_0x0437('0x3')]('[%s][queues][hangup]',_0x19a5fc['uniqueid']),_0x530556);}};exports[_0x0437('0x20')]=function(_0x2d4bf1){try{utils['debug'](util[_0x0437('0x3')](_0x0437('0x21'),_0x2d4bf1['uniqueid']),_0x2d4bf1);if(!_[_0x0437('0x16')](_0x2d4bf1[_0x0437('0x22')][_0x0437('0x23')])&&_0x2d4bf1['value'][_0x0437('0x24')]()!==_0x0437('0x25')){if(!_[_0x0437('0x16')](queues[_0x2d4bf1[_0x0437('0x5')]])){queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x19')]=![];queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x26')]=null;queues[_0x2d4bf1[_0x0437('0x5')]]['queuecallerexit']=!![];queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x27')]=utils[_0x0437('0x28')]();queues[_0x2d4bf1[_0x0437('0x5')]]['queuecallerexitreason']=_0x2d4bf1[_0x0437('0x29')][_0x0437('0x24')]();utils[_0x0437('0x2')](util['format'](_0x0437('0x2a'),_0x2d4bf1[_0x0437('0x5')],queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x1c')],_0x2d4bf1[_0x0437('0x29')],queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0xa')]));writeDB(queues[_0x2d4bf1[_0x0437('0x5')]]);}}else if(!_[_0x0437('0x16')](_0x2d4bf1['variable'][_0x0437('0x2b')])){if(!_['isNil'](queues[_0x2d4bf1[_0x0437('0x5')]])&&!queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x19')]){queues[_0x2d4bf1['uniqueid']]['queuecallerabandon']=![];queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0x26')]=null;queues[_0x2d4bf1['uniqueid']]['queuecallerexit']=!![];queues[_0x2d4bf1[_0x0437('0x5')]]['queuecallerexitAt']=utils[_0x0437('0x28')]();queues[_0x2d4bf1[_0x0437('0x5')]][_0x0437('0xa')]=_0x0437('0x2c');utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x2d'),_0x2d4bf1[_0x0437('0x5')],queues[_0x2d4bf1[_0x0437('0x5')]]['name'],_0x2d4bf1[_0x0437('0x29')],queues[_0x2d4bf1[_0x0437('0x5')]]['queuecallerexitreason']));}}}catch(_0x54a16b){utils[_0x0437('0x1f')](util[_0x0437('0x3')](_0x0437('0x21'),_0x2d4bf1[_0x0437('0x5')]),_0x54a16b);}};exports['queuecallerabandon']=function(_0x3c9464){try{if(!_[_0x0437('0x16')](queues[_0x3c9464[_0x0437('0x5')]])){utils[_0x0437('0x11')](util[_0x0437('0x3')](_0x0437('0x2e'),_0x3c9464[_0x0437('0x5')]),_0x3c9464);queues[_0x3c9464['uniqueid']][_0x0437('0x2f')]=![];queues[_0x3c9464[_0x0437('0x5')]][_0x0437('0x27')]=null;queues[_0x3c9464['uniqueid']]['queuecallerabandon']=!![];queues[_0x3c9464['uniqueid']][_0x0437('0x26')]=utils[_0x0437('0x28')]();queues[_0x3c9464[_0x0437('0x5')]][_0x0437('0xa')]='ABANDONED';utils[_0x0437('0x2')](util[_0x0437('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3c9464['uniqueid'],queues[_0x3c9464[_0x0437('0x5')]]['name'],queues[_0x3c9464[_0x0437('0x5')]][_0x0437('0xa')]));}}catch(_0x48f8e9){utils['error'](util[_0x0437('0x3')](_0x0437('0x2e'),_0x3c9464[_0x0437('0x5')]),_0x48f8e9);}};exports[_0x0437('0x30')]=function(_0x29c342){try{if(!_[_0x0437('0x16')](queues[_0x29c342[_0x0437('0x5')]])){utils['debug'](util['format'](_0x0437('0x31'),_0x29c342[_0x0437('0x5')]),_0x29c342);utils['info'](util[_0x0437('0x3')](_0x0437('0x32'),_0x29c342[_0x0437('0x5')],queues[_0x29c342['uniqueid']][_0x0437('0x1c')],_0x29c342[_0x0437('0x33')],_0x29c342[_0x0437('0x34')]));queues[_0x29c342[_0x0437('0x5')]]['queuecallerleave']=!![];queues[_0x29c342[_0x0437('0x5')]][_0x0437('0x18')]=utils[_0x0437('0x28')]();queues[_0x29c342[_0x0437('0x5')]]['holdtime']=utils['diffTime'](queues[_0x29c342['uniqueid']][_0x0437('0x18')],queues[_0x29c342[_0x0437('0x5')]][_0x0437('0x35')]);queues[_0x29c342[_0x0437('0x5')]][_0x0437('0x15')]=_0x29c342['position'];queues[_0x29c342['uniqueid']][_0x0437('0x36')]=_0x29c342[_0x0437('0x36')];queues[_0x29c342[_0x0437('0x5')]][_0x0437('0x33')]=_0x29c342[_0x0437('0x33')];queues[_0x29c342['uniqueid']][_0x0437('0x34')]=_0x29c342[_0x0437('0x34')];}}catch(_0x54896f){utils[_0x0437('0x1f')](util[_0x0437('0x3')](_0x0437('0x31'),_0x29c342[_0x0437('0x5')]),_0x54896f);}};exports['agentconnect']=function(_0x588753){try{if(!_['isNil'](queues[_0x588753['uniqueid']])){utils[_0x0437('0x11')](util[_0x0437('0x3')]('[%s][queues][agentconnect]',_0x588753[_0x0437('0x5')]),_0x588753);utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x37'),_0x588753[_0x0437('0x5')],queues[_0x588753[_0x0437('0x5')]][_0x0437('0x1c')],_0x588753[_0x0437('0x38')],_0x588753[_0x0437('0x39')]));queues[_0x588753[_0x0437('0x5')]][_0x0437('0x19')]=![];queues[_0x588753[_0x0437('0x5')]]['queuecallerabandon']=![];queues[_0x588753[_0x0437('0x5')]][_0x0437('0x26')]=null;queues[_0x588753[_0x0437('0x5')]]['queuecallerexit']=![];queues[_0x588753[_0x0437('0x5')]][_0x0437('0xa')]=null;queues[_0x588753['uniqueid']]['queuecallerexitAt']=null;queues[_0x588753[_0x0437('0x5')]][_0x0437('0x3a')]=!![];queues[_0x588753[_0x0437('0x5')]][_0x0437('0x3b')]=_0x588753[_0x0437('0x39')];queues[_0x588753['uniqueid']]['lastAssignedTo']=_0x588753[_0x0437('0x38')];}}catch(_0x26f1c4){utils[_0x0437('0x1f')](util[_0x0437('0x3')]('[%s][queues][agentconnect]',_0x588753[_0x0437('0x5')]),_0x26f1c4);}};exports[_0x0437('0x3c')]=function(_0x543039){try{if(!_[_0x0437('0x16')](queues[_0x543039[_0x0437('0x5')]])){if(queues[_0x543039['uniqueid']][_0x0437('0x18')]){utils['debug'](util[_0x0437('0x3')](_0x0437('0x3d'),_0x543039[_0x0437('0x5')]),_0x543039);queues[_0x543039[_0x0437('0x5')]][_0x0437('0x19')]=![];queues[_0x543039[_0x0437('0x5')]]['queuecallerabandon']=![];queues[_0x543039[_0x0437('0x5')]]['queuecallerabandonAt']=null;queues[_0x543039['uniqueid']][_0x0437('0x2f')]=![];queues[_0x543039[_0x0437('0x5')]]['queuecallerexitAt']=null;queues[_0x543039[_0x0437('0x5')]][_0x0437('0x3a')]=!![];queues[_0x543039[_0x0437('0x5')]][_0x0437('0x8')]=_0x543039[_0x0437('0x38')];queues[_0x543039[_0x0437('0x5')]]['queuecallercomplete']=!![];queues[_0x543039[_0x0437('0x5')]]['queuecallercompleteAt']=utils[_0x0437('0x28')]();if(_0x543039['reason']==_0x0437('0x3e')){if(!queues[_0x543039[_0x0437('0x5')]][_0x0437('0x3e')]){queues[_0x543039['uniqueid']][_0x0437('0xa')]=_0x0437('0x3f');}}else{queues[_0x543039[_0x0437('0x5')]]['queuecallerexitreason']=_0x0437('0x40')+_0x543039[_0x0437('0x41')][_0x0437('0x24')]();}utils[_0x0437('0x2')](util['format'](_0x0437('0x42'),_0x543039[_0x0437('0x5')],queues[_0x543039[_0x0437('0x5')]][_0x0437('0x1c')],_0x543039[_0x0437('0x38')],queues[_0x543039[_0x0437('0x5')]][_0x0437('0xa')]));writeDB(queues[_0x543039['uniqueid']]);}}}catch(_0x43dd7a){utils[_0x0437('0x1f')](util[_0x0437('0x3')]('[%s][queues][agentcomplete]',_0x543039[_0x0437('0x5')]),_0x43dd7a);}};exports[_0x0437('0x43')]=function(_0x3231a8){try{if(!_['isNil'](queues[_0x3231a8[_0x0437('0x44')]])){utils[_0x0437('0x11')](util['format']('[%s][queues][blindtransfer]',_0x3231a8[_0x0437('0x5')]),_0x3231a8);queues[_0x3231a8[_0x0437('0x44')]][_0x0437('0x3e')]=!![];queues[_0x3231a8[_0x0437('0x44')]][_0x0437('0x45')]=_0x0437('0x46');queues[_0x3231a8[_0x0437('0x44')]][_0x0437('0x47')]=_0x3231a8[_0x0437('0x48')];queues[_0x3231a8[_0x0437('0x44')]]['transferuniqueid']=_0x3231a8['transfereeuniqueid'];queues[_0x3231a8[_0x0437('0x44')]]['queuecallerexitreason']=_0x0437('0x49');utils[_0x0437('0x2')](util['format'](_0x0437('0x4a'),_0x3231a8[_0x0437('0x5')],queues[_0x3231a8['transfereeuniqueid']][_0x0437('0x1c')],_0x3231a8[_0x0437('0x44')],_0x3231a8[_0x0437('0x48')]));}}catch(_0x4a7d2d){utils[_0x0437('0x1f')](util[_0x0437('0x3')](_0x0437('0x4b'),_0x3231a8['uniqueid']),_0x4a7d2d);}};exports[_0x0437('0x4c')]=function(_0xef0c7b){try{utils[_0x0437('0x11')](util[_0x0437('0x3')]('[%s][queues][attendedtransfer]',_0xef0c7b[_0x0437('0x4d')]),_0xef0c7b);if(_0xef0c7b[_0x0437('0x4d')]==_0xef0c7b[_0x0437('0x4e')]){if(!_[_0x0437('0x16')](queues[_0xef0c7b[_0x0437('0x4f')]])){utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x50'),_0xef0c7b['origtransfereruniqueid'],queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x1c')],_0xef0c7b[_0x0437('0x51')]));queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x3e')]=!![];queues[_0xef0c7b[_0x0437('0x4f')]]['transfertype']=_0x0437('0x52');queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x47')]=_0xef0c7b[_0x0437('0x51')];queues[_0xef0c7b[_0x0437('0x4f')]]['transferuniqueid']=_0xef0c7b['origtransfereruniqueid'];queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0xa')]=_0x0437('0x53');}if(!_[_0x0437('0x16')](queues[_0xef0c7b[_0x0437('0x4e')]])){if(_0xef0c7b[_0x0437('0x54')]&&queues[_0xef0c7b['transfereelinkedid']]){queues[_0xef0c7b[_0x0437('0x54')]][_0x0437('0x1e')]=0x1;queues[_0xef0c7b['transfereeuniqueid']]=_[_0x0437('0x55')](queues[_0xef0c7b[_0x0437('0x54')]]);queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0xf')]=_0xef0c7b['transfertargetuniqueid'];queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x1e')]=0x2;queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x9')]=queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x9')];queues[_0xef0c7b['transfereeuniqueid']][_0x0437('0x56')]=queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x56')];queues[_0xef0c7b[_0x0437('0x44')]]['queuecallerjoinAt']=utils[_0x0437('0x28')]();queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x18')]=utils[_0x0437('0x28')]();queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x57')]=0x0;queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x58')]=0x0;utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x59'),_0xef0c7b[_0x0437('0x4d')],queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x1c')],queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x9')],queues[_0xef0c7b[_0x0437('0x44')]][_0x0437('0x56')]));}else{utils[_0x0437('0x2')](util['format'](_0x0437('0x5a'),_0xef0c7b['origtransfereruniqueid'],queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0x1c')],_0xef0c7b['secondtransfererlinkedid']));queues[_0xef0c7b['origtransfererlinkedid']][_0x0437('0xf')]=_0xef0c7b['secondtransfererlinkedid'];}}}else if(_0xef0c7b[_0x0437('0x5b')]==_0xef0c7b[_0x0437('0x4f')]){if(!_['isNil'](queues[_0xef0c7b['origtransfererlinkedid']])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xef0c7b[_0x0437('0x4d')],queues[_0xef0c7b['origtransfererlinkedid']][_0x0437('0x1c')],_0xef0c7b[_0x0437('0x5b')],_0xef0c7b[_0x0437('0x5c')]));queues[_0xef0c7b[_0x0437('0x4e')]]['transfer']=!![];queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0x45')]=_0x0437('0x52');queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0x47')]=_0xef0c7b[_0x0437('0x5c')];queues[_0xef0c7b['origtransfererlinkedid']][_0x0437('0x5d')]=_0xef0c7b['secondtransfereruniqueid'];queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0xa')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xef0c7b[_0x0437('0x4f')]])){if(_0xef0c7b[_0x0437('0x5e')]&&queues[_0xef0c7b['transfertargetlinkedid']]){queues[_0xef0c7b[_0x0437('0x5e')]][_0x0437('0x1e')]=0x1;queues[_0xef0c7b[_0x0437('0x5f')]]=_[_0x0437('0x55')](queues[_0xef0c7b['transfertargetlinkedid']]);queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0xf')]=_0xef0c7b[_0x0437('0x5f')];queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x1e')]=0x2;queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x9')]=queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0x9')];queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x56')]=queues[_0xef0c7b[_0x0437('0x4e')]][_0x0437('0x56')];queues[_0xef0c7b['transfertargetuniqueid']][_0x0437('0x35')]=utils[_0x0437('0x28')]();queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x18')]=utils[_0x0437('0x28')]();queues[_0xef0c7b['transfertargetuniqueid']]['holdtime']=0x0;queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x58')]=0x0;utils['info'](util[_0x0437('0x3')](_0x0437('0x60'),_0xef0c7b[_0x0437('0x4d')],queues[_0xef0c7b['transfertargetuniqueid']][_0x0437('0x1c')],queues[_0xef0c7b['transfertargetuniqueid']]['transfereduniqueid'],queues[_0xef0c7b['transfertargetuniqueid']][_0x0437('0x9')],queues[_0xef0c7b[_0x0437('0x5f')]][_0x0437('0x56')]));}else{utils[_0x0437('0x2')](util[_0x0437('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xef0c7b['origtransfereruniqueid'],queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0x1c')],_0xef0c7b[_0x0437('0x4e')]));queues[_0xef0c7b[_0x0437('0x4f')]][_0x0437('0xf')]=_0xef0c7b[_0x0437('0x4e')];}}}}catch(_0x37d0d4){utils[_0x0437('0x1f')](util[_0x0437('0x3')](_0x0437('0x61'),_0xef0c7b[_0x0437('0x4d')]),_0x37d0d4);}};exports['musiconholdstart']=function(_0x32a5e6){try{if(!_[_0x0437('0x16')](queues[_0x32a5e6[_0x0437('0x5')]])){utils[_0x0437('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x32a5e6['uniqueid']),_0x32a5e6);queues[_0x32a5e6[_0x0437('0x5')]][_0x0437('0x62')]=utils[_0x0437('0x28')]();utils[_0x0437('0x2')](util[_0x0437('0x3')](_0x0437('0x63'),_0x32a5e6[_0x0437('0x5')],queues[_0x32a5e6['uniqueid']]['name'],queues[_0x32a5e6[_0x0437('0x5')]]['musiconholdstartAt']));}}catch(_0x397f8f){utils[_0x0437('0x1f')](util[_0x0437('0x3')]('[%s][queues][musiconholdstart]',_0x32a5e6[_0x0437('0x5')]),_0x397f8f);}};exports['musiconholdstop']=function(_0x3427e4){try{if(!_[_0x0437('0x16')](queues[_0x3427e4[_0x0437('0x5')]])){if(!_[_0x0437('0x16')](queues[_0x3427e4['uniqueid']][_0x0437('0x62')])){utils[_0x0437('0x11')](util[_0x0437('0x3')](_0x0437('0x64'),_0x3427e4[_0x0437('0x5')]),_0x3427e4);queues[_0x3427e4[_0x0437('0x5')]][_0x0437('0x58')]+=utils[_0x0437('0x65')](utils[_0x0437('0x28')](),queues[_0x3427e4['uniqueid']][_0x0437('0x62')]);utils[_0x0437('0x2')](util['format'](_0x0437('0x66'),_0x3427e4[_0x0437('0x5')],queues[_0x3427e4[_0x0437('0x5')]][_0x0437('0x1c')],queues[_0x3427e4['uniqueid']][_0x0437('0x58')]));delete queues[_0x3427e4[_0x0437('0x5')]][_0x0437('0x62')];}}}catch(_0x4341ed){utils[_0x0437('0x1f')](util[_0x0437('0x3')](_0x0437('0x64'),_0x3427e4[_0x0437('0x5')]),_0x4341ed);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ba950f9..3adddce 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 _0xa1e3=['toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','channel','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','replace','.WAV','monitors','push','error','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','connectedlinename','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa1e3,0x1d9));var _0x3a1e=function(_0x13a32e,_0x4b34ec){_0x13a32e=_0x13a32e-0x0;var _0x20c327=_0xa1e3[_0x13a32e];return _0x20c327;};'use strict';var _=require(_0x3a1e('0x0'));var util=require(_0x3a1e('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4f72eb){utils['info'](util[_0x3a1e('0x2')]('[%s][recordings][writeDB]',_0x4f72eb[_0x3a1e('0x3')]));if(_0x4f72eb[_0x3a1e('0x4')]){utils[_0x3a1e('0x5')](_0x4f72eb[_0x3a1e('0x4')])[_0x3a1e('0x6')](function(_0x3a7fe3){if(_0x3a7fe3){_0x4f72eb[_0x3a1e('0x7')]=_0x3a7fe3[_0x3a1e('0x8')];_0x4f72eb[_0x3a1e('0x9')]=_0x3a7fe3['id'];}utils['request'](_0x3a1e('0xa'),_0x4f72eb);});}else{utils[_0x3a1e('0xb')]('CreateVoiceRecording',_0x4f72eb);}}exports['newchannel']=function(_0x5b611e){try{utils[_0x3a1e('0xc')](util[_0x3a1e('0x2')](_0x3a1e('0xd'),_0x5b611e['uniqueid']),_0x5b611e);if(_0x5b611e[_0x3a1e('0x3')]==_0x5b611e[_0x3a1e('0xe')]){utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')](_0x3a1e('0x10'),_0x5b611e['uniqueid'],_0x5b611e[_0x3a1e('0x11')],_0x5b611e[_0x3a1e('0x12')]));recordings[_0x5b611e['uniqueid']]={'uniqueid':_0x5b611e[_0x3a1e('0x3')],'accountcode':_0x5b611e['accountcode'],'exten':_0x5b611e[_0x3a1e('0x12')],'context':_0x5b611e['context'],'channel':_0x5b611e['channel'],'monitors':[]};}}catch(_0x131241){utils['error'](util[_0x3a1e('0x2')](_0x3a1e('0xd'),_0x5b611e[_0x3a1e('0x3')]),_0x131241);}};exports['newstate']=function(_0x1f812d){try{utils[_0x3a1e('0xc')](util[_0x3a1e('0x2')]('[%s][recordings][newstate]',_0x1f812d[_0x3a1e('0x3')]),_0x1f812d);if(!_[_0x3a1e('0x13')](recordings[_0x1f812d[_0x3a1e('0x3')]])&&_0x1f812d['channelstate']==0x6){utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')](_0x3a1e('0x14'),_0x1f812d['uniqueid'],_0x1f812d['context'],_0x1f812d['channel']));}else if(!_[_0x3a1e('0x13')](recordings[_0x1f812d[_0x3a1e('0xe')]])&&_0x1f812d['channelstate']==0x6&&_0x1f812d['context']!=_0x3a1e('0x15')){utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f812d[_0x3a1e('0x3')],_0x1f812d[_0x3a1e('0xe')],_0x1f812d[_0x3a1e('0x11')],_0x1f812d[_0x3a1e('0x16')]));recordings[_0x1f812d[_0x3a1e('0xe')]][_0x3a1e('0x4')]=_0x1f812d[_0x3a1e('0x4')];}}catch(_0x5af454){utils['error'](util['format'](_0x3a1e('0x17'),_0x1f812d[_0x3a1e('0x3')]),_0x5af454);}};exports[_0x3a1e('0x18')]=function(_0x3d68eb){try{if(!_[_0x3a1e('0x13')](_0x3d68eb['variable'])&&!_[_0x3a1e('0x13')](_0x3d68eb[_0x3a1e('0x19')][_0x3a1e('0x1a')])){utils['debug'](util[_0x3a1e('0x2')](_0x3a1e('0x1b'),_0x3d68eb[_0x3a1e('0x3')]),_0x3d68eb);utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3d68eb[_0x3a1e('0x3')],_0x3d68eb['variable'],_0x3d68eb[_0x3a1e('0x1c')]));if(_['endsWith'](_0x3d68eb['value'],'.wav49')){_0x3d68eb[_0x3a1e('0x1c')]=_0x3d68eb[_0x3a1e('0x1c')][_0x3a1e('0x1d')]('.wav49',_0x3a1e('0x1e'));}if(recordings[_0x3d68eb[_0x3a1e('0xe')]]){var _0x5e5a39=_['find'](recordings[_0x3d68eb[_0x3a1e('0xe')]][_0x3a1e('0x1f')],{'value':_0x3d68eb[_0x3a1e('0x1c')]});if(_['isNil'](_0x5e5a39)){recordings[_0x3d68eb[_0x3a1e('0xe')]]['monitors'][_0x3a1e('0x20')]({'value':_0x3d68eb[_0x3a1e('0x1c')]});}}}}catch(_0x476d57){utils[_0x3a1e('0x21')](util['format']('[%s][recordings][varset]',_0x3d68eb[_0x3a1e('0x3')]),_0x476d57);}};exports[_0x3a1e('0x22')]=function(_0x84a568){try{if(!_[_0x3a1e('0x13')](recordings[_0x84a568[_0x3a1e('0x3')]])){utils[_0x3a1e('0xc')](util[_0x3a1e('0x2')]('[%s][recordings][hangup]',_0x84a568['uniqueid']),_0x84a568);utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')](_0x3a1e('0x23'),_0x84a568['uniqueid'],_0x84a568[_0x3a1e('0x24')],_0x84a568[_0x3a1e('0x25')],_0x84a568[_0x3a1e('0x26')]));recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x24')]=_0x84a568[_0x3a1e('0x24')];recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x25')]=_0x84a568[_0x3a1e('0x25')];recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x27')]=_0x84a568[_0x3a1e('0x27')];recordings[_0x84a568[_0x3a1e('0x3')]]['connectedlinename']=_0x84a568['connectedlinename'];if(recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x28')]=='outbound'&&recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x4')]){recordings[_0x84a568[_0x3a1e('0x3')]]['connectedlinenum']=recordings[_0x84a568[_0x3a1e('0x3')]]['accountcode'];recordings[_0x84a568['uniqueid']][_0x3a1e('0x29')]='';}recordings[_0x84a568[_0x3a1e('0x3')]][_0x3a1e('0x1f')][_0x3a1e('0x2a')](function(_0x35672e){var _0x1f2081=_[_0x3a1e('0x2b')](recordings[_0x84a568[_0x3a1e('0x3')]]);_0x1f2081[_0x3a1e('0x1c')]=_0x35672e['value'];writeDB(_0x1f2081);});delete recordings[_0x84a568[_0x3a1e('0x3')]];}}catch(_0x3a238d){utils['error'](util[_0x3a1e('0x2')](_0x3a1e('0x2c'),_0x84a568[_0x3a1e('0x3')]),_0x3a238d);}};exports[_0x3a1e('0x2d')]=function(_0x406a8e){try{if(!_[_0x3a1e('0x13')](recordings[_0x406a8e[_0x3a1e('0x3')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0x406a8e[_0x3a1e('0x3')]),_0x406a8e);utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')](_0x3a1e('0x2e'),_0x406a8e[_0x3a1e('0x3')],_0x406a8e['application'],_0x406a8e[_0x3a1e('0x2f')]));if(_0x406a8e[_0x3a1e('0x30')][_0x3a1e('0x31')]()==_0x3a1e('0x32')&&_[_0x3a1e('0x33')](_0x406a8e[_0x3a1e('0x2f')]['toLowerCase'](),_0x3a1e('0x34'))){var _0x54a31b=_0x406a8e[_0x3a1e('0x2f')][_0x3a1e('0x35')]('=');var _0x46af0b=_0x54a31b[0x0]['substring'](_0x54a31b[0x0][_0x3a1e('0x36')]('(')+0x1,_0x54a31b[0x0][_0x3a1e('0x36')](')'));var _0x23a3d=_0x54a31b[0x1];recordings[_0x406a8e[_0x3a1e('0x3')]][_0x46af0b]=_0x23a3d;}}}catch(_0x2d0cb4){utils[_0x3a1e('0x21')](util[_0x3a1e('0x2')]('[%s][recordings][newexten]',_0x406a8e[_0x3a1e('0x3')]),_0x2d0cb4);}};exports[_0x3a1e('0x37')]=function(_0x4d255f){try{if(!_[_0x3a1e('0x13')](recordings[_0x4d255f[_0x3a1e('0x3')]])){utils[_0x3a1e('0xc')](util['format']('[%s][recordings][queuecallerjoin]',_0x4d255f[_0x3a1e('0x3')]),_0x4d255f);utils[_0x3a1e('0xf')](util[_0x3a1e('0x2')](_0x3a1e('0x38'),_0x4d255f['uniqueid'],_0x4d255f['queue']));recordings[_0x4d255f[_0x3a1e('0x3')]][_0x3a1e('0x39')]=_0x4d255f['queue'];}}catch(_0x4f51ea){utils[_0x3a1e('0x21')](util[_0x3a1e('0x2')]('[%s][recordings][queuecallerjoin]',_0x4d255f[_0x3a1e('0x3')]),_0x4f51ea);}}; \ No newline at end of file +var _0x6fd8=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','exten','context','channel','newstate','isNil','channelstate','linkedid','transfer','error','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6fd8,0xbc));var _0x86fd=function(_0x4a0f12,_0x3aab8c){_0x4a0f12=_0x4a0f12-0x0;var _0x1d96c7=_0x6fd8[_0x4a0f12];return _0x1d96c7;};'use strict';var _=require('lodash');var util=require(_0x86fd('0x0'));var utils=require(_0x86fd('0x1'));var recordings={};function writeDB(_0x596daf){utils[_0x86fd('0x2')](util[_0x86fd('0x3')](_0x86fd('0x4'),_0x596daf[_0x86fd('0x5')]));if(_0x596daf[_0x86fd('0x6')]){utils[_0x86fd('0x7')](_0x596daf[_0x86fd('0x6')])['then'](function(_0x45d1f3){if(_0x45d1f3){_0x596daf[_0x86fd('0x8')]=_0x45d1f3[_0x86fd('0x9')];_0x596daf[_0x86fd('0xa')]=_0x45d1f3['id'];}utils[_0x86fd('0xb')](_0x86fd('0xc'),_0x596daf);});}else{utils[_0x86fd('0xb')](_0x86fd('0xc'),_0x596daf);}}exports[_0x86fd('0xd')]=function(_0x651891){try{utils[_0x86fd('0xe')](util['format']('[%s][recordings][newchannel]',_0x651891[_0x86fd('0x5')]),_0x651891);if(_0x651891[_0x86fd('0x5')]==_0x651891['linkedid']){utils[_0x86fd('0x2')](util[_0x86fd('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x651891['uniqueid'],_0x651891['context'],_0x651891[_0x86fd('0xf')]));recordings[_0x651891['uniqueid']]={'uniqueid':_0x651891[_0x86fd('0x5')],'accountcode':_0x651891['accountcode'],'exten':_0x651891[_0x86fd('0xf')],'context':_0x651891[_0x86fd('0x10')],'channel':_0x651891[_0x86fd('0x11')],'monitors':[]};}}catch(_0x58391d){utils['error'](util[_0x86fd('0x3')]('[%s][recordings][newchannel]',_0x651891[_0x86fd('0x5')]),_0x58391d);}};exports[_0x86fd('0x12')]=function(_0x2020fe){try{utils[_0x86fd('0xe')](util['format']('[%s][recordings][newstate]',_0x2020fe['uniqueid']),_0x2020fe);if(!_[_0x86fd('0x13')](recordings[_0x2020fe[_0x86fd('0x5')]])&&_0x2020fe[_0x86fd('0x14')]==0x6){utils[_0x86fd('0x2')](util[_0x86fd('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2020fe[_0x86fd('0x5')],_0x2020fe[_0x86fd('0x10')],_0x2020fe['channel']));}else if(!_['isNil'](recordings[_0x2020fe[_0x86fd('0x15')]])&&_0x2020fe['channelstate']==0x6&&_0x2020fe[_0x86fd('0x10')]!=_0x86fd('0x16')){utils[_0x86fd('0x2')](util[_0x86fd('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2020fe[_0x86fd('0x5')],_0x2020fe[_0x86fd('0x15')],_0x2020fe[_0x86fd('0x10')],_0x2020fe[_0x86fd('0x11')]));recordings[_0x2020fe[_0x86fd('0x15')]][_0x86fd('0x6')]=_0x2020fe['accountcode'];}}catch(_0x5d1f83){utils[_0x86fd('0x17')](util[_0x86fd('0x3')](_0x86fd('0x18'),_0x2020fe['uniqueid']),_0x5d1f83);}};exports[_0x86fd('0x19')]=function(_0x4549dd){try{if(!_['isNil'](_0x4549dd[_0x86fd('0x1a')])&&!_[_0x86fd('0x13')](_0x4549dd[_0x86fd('0x1a')]['mixmonitor_filename'])){utils[_0x86fd('0xe')](util[_0x86fd('0x3')]('[%s][recordings][varset]',_0x4549dd[_0x86fd('0x5')]),_0x4549dd);utils['info'](util['format'](_0x86fd('0x1b'),_0x4549dd[_0x86fd('0x5')],_0x4549dd[_0x86fd('0x1a')],_0x4549dd[_0x86fd('0x1c')]));if(_[_0x86fd('0x1d')](_0x4549dd[_0x86fd('0x1c')],_0x86fd('0x1e'))){_0x4549dd[_0x86fd('0x1c')]=_0x4549dd['value'][_0x86fd('0x1f')](_0x86fd('0x1e'),'.WAV');}if(recordings[_0x4549dd[_0x86fd('0x15')]]){var _0x1c0d2a=_[_0x86fd('0x20')](recordings[_0x4549dd['linkedid']][_0x86fd('0x21')],{'value':_0x4549dd[_0x86fd('0x1c')]});if(_[_0x86fd('0x13')](_0x1c0d2a)){recordings[_0x4549dd[_0x86fd('0x15')]]['monitors'][_0x86fd('0x22')]({'value':_0x4549dd['value']});}}}}catch(_0x5e7253){utils[_0x86fd('0x17')](util[_0x86fd('0x3')](_0x86fd('0x23'),_0x4549dd[_0x86fd('0x5')]),_0x5e7253);}};exports[_0x86fd('0x24')]=function(_0xf578ce){try{if(!_['isNil'](recordings[_0xf578ce[_0x86fd('0x5')]])){utils[_0x86fd('0xe')](util[_0x86fd('0x3')](_0x86fd('0x25'),_0xf578ce[_0x86fd('0x5')]),_0xf578ce);utils[_0x86fd('0x2')](util['format'](_0x86fd('0x26'),_0xf578ce[_0x86fd('0x5')],_0xf578ce[_0x86fd('0x27')],_0xf578ce[_0x86fd('0x28')],_0xf578ce[_0x86fd('0x29')]));recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x27')]=_0xf578ce[_0x86fd('0x27')];recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x28')]=_0xf578ce[_0x86fd('0x28')];recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x2a')]=_0xf578ce['connectedlinenum'];recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x2b')]=_0xf578ce[_0x86fd('0x2b')];if(recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x2c')]==_0x86fd('0x2d')&&recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x6')]){recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x2a')]=recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x6')];recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x2b')]='';}recordings[_0xf578ce[_0x86fd('0x5')]][_0x86fd('0x21')][_0x86fd('0x2e')](function(_0x1624af){var _0x1714aa=_[_0x86fd('0x2f')](recordings[_0xf578ce['uniqueid']]);_0x1714aa[_0x86fd('0x1c')]=_0x1624af[_0x86fd('0x1c')];writeDB(_0x1714aa);});delete recordings[_0xf578ce[_0x86fd('0x5')]];}}catch(_0x24ec30){utils[_0x86fd('0x17')](util[_0x86fd('0x3')](_0x86fd('0x25'),_0xf578ce['uniqueid']),_0x24ec30);}};exports[_0x86fd('0x30')]=function(_0x3bac27){try{if(!_['isNil'](recordings[_0x3bac27['uniqueid']])){utils[_0x86fd('0xe')](util[_0x86fd('0x3')](_0x86fd('0x31'),_0x3bac27['uniqueid']),_0x3bac27);utils[_0x86fd('0x2')](util[_0x86fd('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3bac27[_0x86fd('0x5')],_0x3bac27[_0x86fd('0x32')],_0x3bac27[_0x86fd('0x33')]));if(_0x3bac27[_0x86fd('0x32')]['toLowerCase']()==_0x86fd('0x34')&&_[_0x86fd('0x35')](_0x3bac27['appdata'][_0x86fd('0x36')](),'cdr')){var _0x5dc19b=_0x3bac27[_0x86fd('0x33')][_0x86fd('0x37')]('=');var _0x550a15=_0x5dc19b[0x0][_0x86fd('0x38')](_0x5dc19b[0x0][_0x86fd('0x39')]('(')+0x1,_0x5dc19b[0x0][_0x86fd('0x39')](')'));var _0x218019=_0x5dc19b[0x1];recordings[_0x3bac27[_0x86fd('0x5')]][_0x550a15]=_0x218019;}}}catch(_0x5f0708){utils[_0x86fd('0x17')](util[_0x86fd('0x3')](_0x86fd('0x31'),_0x3bac27['uniqueid']),_0x5f0708);}};exports[_0x86fd('0x3a')]=function(_0x1674b2){try{if(!_[_0x86fd('0x13')](recordings[_0x1674b2[_0x86fd('0x5')]])){utils[_0x86fd('0xe')](util[_0x86fd('0x3')](_0x86fd('0x3b'),_0x1674b2[_0x86fd('0x5')]),_0x1674b2);utils[_0x86fd('0x2')](util[_0x86fd('0x3')](_0x86fd('0x3c'),_0x1674b2[_0x86fd('0x5')],_0x1674b2['queue']));recordings[_0x1674b2['uniqueid']]['queue']=_0x1674b2[_0x86fd('0x3d')];}}catch(_0x415f5e){utils[_0x86fd('0x17')](util['format'](_0x86fd('0x3b'),_0x1674b2[_0x86fd('0x5')]),_0x415f5e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ff480fd..27b4b68 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 _0x334b=['blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','assign','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid'];(function(_0x2d6d0f,_0x3cf2a5){var _0xd2bee6=function(_0x2fc9cd){while(--_0x2fc9cd){_0x2d6d0f['push'](_0x2d6d0f['shift']());}};_0xd2bee6(++_0x3cf2a5);}(_0x334b,0x1e1));var _0xb334=function(_0xc8b840,_0x38c821){_0xc8b840=_0xc8b840-0x0;var _0x3ab4a8=_0x334b[_0xc8b840];return _0x3ab4a8;};'use strict';var _=require(_0xb334('0x0'));var util=require('util');var utils=require(_0xb334('0x1'));function writeDB(_0x24bff0){utils[_0xb334('0x2')](util[_0xb334('0x3')](_0xb334('0x4'),_0x24bff0[_0xb334('0x5')]===_0xb334('0x6')?_0x24bff0[_0xb334('0x7')]:_0x24bff0[_0xb334('0x8')],_0x24bff0[_0xb334('0x5')]));utils['request']('CreateVoiceTransferReport',_0x24bff0);}exports[_0xb334('0x9')]=function(_0x32fcd1){try{utils[_0xb334('0xa')](util[_0xb334('0x3')](_0xb334('0xb'),_0x32fcd1[_0xb334('0x8')]),_0x32fcd1);utils['info'](util[_0xb334('0x3')](_0xb334('0xc'),_0x32fcd1[_0xb334('0x8')],_0x32fcd1['transferercalleridnum'],_0x32fcd1['transferercalleridname'],_0x32fcd1[_0xb334('0xd')],_0x32fcd1[_0xb334('0xe')]));_0x32fcd1[_0xb334('0x5')]='blind';writeDB(_0x32fcd1);}catch(_0x41f18b){utils['error'](util[_0xb334('0x3')](_0xb334('0xb'),_0x32fcd1[_0xb334('0x8')]),_0x41f18b);}};exports[_0xb334('0xf')]=function(_0x427a2d){try{utils[_0xb334('0xa')](util[_0xb334('0x3')](_0xb334('0x10'),_0x427a2d[_0xb334('0x7')]),_0x427a2d);utils['info'](util[_0xb334('0x3')](_0xb334('0x11'),_0x427a2d['origtransfereruniqueid'],_0x427a2d[_0xb334('0x12')],_0x427a2d[_0xb334('0x13')],_0x427a2d[_0xb334('0x14')],_0x427a2d['transfertargetcalleridname']));_0x427a2d=_['assign'](_0x427a2d,{'transfererchannel':_0x427a2d[_0xb334('0x15')],'transferercalleridnum':_0x427a2d[_0xb334('0x12')],'transferercalleridname':_0x427a2d[_0xb334('0x13')],'transfererconnectedlinenum':_0x427a2d[_0xb334('0x16')],'transfererconnectedlinename':_0x427a2d[_0xb334('0x17')],'transfereraccountcode':_0x427a2d[_0xb334('0x18')],'transferercontext':_0x427a2d['secondtransferercontext'],'transfererexten':_0x427a2d['secondtransfererexten'],'transfererlinkedid':_0x427a2d[_0xb334('0x19')],'context':_0x427a2d[_0xb334('0x1a')],'extension':_0x427a2d[_0xb334('0x1b')],'type':_0xb334('0x6')});if(_[_0xb334('0x1c')](_0x427a2d['transfereechannel'])){_0x427a2d=_[_0xb334('0x1d')](_0x427a2d,{'transfereechannel':_0x427a2d['transfertargetchannel'],'transfereecalleridnum':_0x427a2d[_0xb334('0x14')],'transfereecalleridname':_0x427a2d[_0xb334('0x1e')],'transfereeconnectedlinenum':_0x427a2d[_0xb334('0x1f')],'transfereeconnectedlinename':_0x427a2d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x427a2d[_0xb334('0x20')],'transfereecontext':_0x427a2d['transfertargetcontext'],'transfereeexten':_0x427a2d[_0xb334('0x21')],'transfereelinkedid':_0x427a2d[_0xb334('0x22')]});}writeDB(_0x427a2d);}catch(_0x37479a){utils['error'](util[_0xb334('0x3')](_0xb334('0x10'),_0x427a2d[_0xb334('0x7')]),_0x37479a);}}; \ No newline at end of file +var _0xc9ed=['./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xc9ed,0x12b));var _0xdc9e=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xc9ed[_0xc0638b];return _0xd57dfa;};'use strict';var _=require(_0xdc9e('0x0'));var util=require(_0xdc9e('0x1'));var utils=require(_0xdc9e('0x2'));function writeDB(_0x544f1f){utils[_0xdc9e('0x3')](util[_0xdc9e('0x4')](_0xdc9e('0x5'),_0x544f1f[_0xdc9e('0x6')]===_0xdc9e('0x7')?_0x544f1f[_0xdc9e('0x8')]:_0x544f1f[_0xdc9e('0x9')],_0x544f1f[_0xdc9e('0x6')]));utils['request'](_0xdc9e('0xa'),_0x544f1f);}exports[_0xdc9e('0xb')]=function(_0x64904){try{utils[_0xdc9e('0xc')](util[_0xdc9e('0x4')](_0xdc9e('0xd'),_0x64904[_0xdc9e('0x9')]),_0x64904);utils[_0xdc9e('0x3')](util[_0xdc9e('0x4')](_0xdc9e('0xe'),_0x64904['uniqueid'],_0x64904[_0xdc9e('0xf')],_0x64904['transferercalleridname'],_0x64904[_0xdc9e('0x10')],_0x64904[_0xdc9e('0x11')]));_0x64904['type']=_0xdc9e('0x12');writeDB(_0x64904);}catch(_0x40787b){utils[_0xdc9e('0x13')](util[_0xdc9e('0x4')](_0xdc9e('0xd'),_0x64904[_0xdc9e('0x9')]),_0x40787b);}};exports[_0xdc9e('0x14')]=function(_0x12f09d){try{utils[_0xdc9e('0xc')](util['format'](_0xdc9e('0x15'),_0x12f09d['origtransfereruniqueid']),_0x12f09d);utils[_0xdc9e('0x3')](util[_0xdc9e('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x12f09d[_0xdc9e('0x8')],_0x12f09d[_0xdc9e('0x16')],_0x12f09d['origtransferercalleridname'],_0x12f09d[_0xdc9e('0x17')],_0x12f09d[_0xdc9e('0x18')]));_0x12f09d=_[_0xdc9e('0x19')](_0x12f09d,{'transfererchannel':_0x12f09d[_0xdc9e('0x1a')],'transferercalleridnum':_0x12f09d[_0xdc9e('0x16')],'transferercalleridname':_0x12f09d[_0xdc9e('0x1b')],'transfererconnectedlinenum':_0x12f09d[_0xdc9e('0x1c')],'transfererconnectedlinename':_0x12f09d[_0xdc9e('0x1d')],'transfereraccountcode':_0x12f09d[_0xdc9e('0x1e')],'transferercontext':_0x12f09d[_0xdc9e('0x1f')],'transfererexten':_0x12f09d[_0xdc9e('0x20')],'transfererlinkedid':_0x12f09d[_0xdc9e('0x21')],'context':_0x12f09d[_0xdc9e('0x22')],'extension':_0x12f09d['origtransfererexten'],'type':_0xdc9e('0x7')});if(_[_0xdc9e('0x23')](_0x12f09d[_0xdc9e('0x24')])){_0x12f09d=_[_0xdc9e('0x19')](_0x12f09d,{'transfereechannel':_0x12f09d[_0xdc9e('0x25')],'transfereecalleridnum':_0x12f09d[_0xdc9e('0x17')],'transfereecalleridname':_0x12f09d[_0xdc9e('0x18')],'transfereeconnectedlinenum':_0x12f09d[_0xdc9e('0x26')],'transfereeconnectedlinename':_0x12f09d[_0xdc9e('0x27')],'transfereeaccountcode':_0x12f09d[_0xdc9e('0x28')],'transfereecontext':_0x12f09d[_0xdc9e('0x29')],'transfereeexten':_0x12f09d['transfertargetexten'],'transfereelinkedid':_0x12f09d[_0xdc9e('0x2a')]});}writeDB(_0x12f09d);}catch(_0x488bf7){utils[_0xdc9e('0x13')](util[_0xdc9e('0x4')](_0xdc9e('0x15'),_0x12f09d['origtransfereruniqueid']),_0x488bf7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 63ed02a..94d51ec 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 _0x147c=['[utils][getUserByInterface]','getUserByName','then','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface'];(function(_0x15b065,_0x3b77a7){var _0x4cb0ae=function(_0x5844e6){while(--_0x5844e6){_0x15b065['push'](_0x15b065['shift']());}};_0x4cb0ae(++_0x3b77a7);}(_0x147c,0x144));var _0xc147=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0x147c[_0x339d45];return _0x5e4a60;};'use strict';var BPromise=require(_0xc147('0x0'));var jayson=require('jayson/promise');var moment=require(_0xc147('0x1'));var util=require(_0xc147('0x2'));var client=jayson[_0xc147('0x3')][_0xc147('0x4')]({'port':0x2329});var logger=require(_0xc147('0x5'))(_0xc147('0x6'));exports[_0xc147('0x7')]=function(_0x203b74,_0x4db5fc){logger[_0xc147('0x7')](_0x203b74,_0x4db5fc?util['inspect'](_0x4db5fc,{'showHidden':![],'depth':null}):'');};exports[_0xc147('0x8')]=function(_0x3c8409,_0x50b3af){logger[_0xc147('0x8')](_0x3c8409,_0x50b3af?util[_0xc147('0x9')](_0x50b3af,{'showHidden':![],'depth':null}):'');};exports[_0xc147('0xa')]=function(_0x484959,_0x441c3a){logger[_0xc147('0xa')](_0x484959,_0x441c3a?util[_0xc147('0x9')](_0x441c3a,{'showHidden':![],'depth':null}):'');};exports[_0xc147('0xb')]=function(_0x44fd92,_0x210786){return client[_0xc147('0xb')](_0x44fd92,{'body':_0x210786})['then'](function(_0x351a31){logger[_0xc147('0x8')](_0xc147('0xc'),_0x44fd92,_0x351a31?util[_0xc147('0x9')](_0x351a31,{'showHidden':![],'depth':null}):'');})[_0xc147('0xd')](function(_0x51f0b1){logger[_0xc147('0xa')]('[utils][request]\x20name:%s',_0x44fd92,_0x51f0b1?util[_0xc147('0x9')](_0x51f0b1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x263bdb){return client[_0xc147('0xb')](_0xc147('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc147('0xf'),_0xc147('0x10'),_0xc147('0x11')],'where':_0x263bdb,'limit':0x1}})['then'](function(_0x42f1d5){logger[_0xc147('0x8')](_0xc147('0x12'),JSON[_0xc147('0x13')](_0x263bdb),_0x42f1d5?util['inspect'](_0x42f1d5,{'showHidden':![],'depth':null}):'');return _0x42f1d5[_0xc147('0x14')]['length']?_0x42f1d5[_0xc147('0x14')][0x0]:null;});}exports[_0xc147('0x15')]=function(_0x4d1688){return new BPromise(function(_0x465485,_0x2103cb){if(_0x4d1688){return getUser({'internal':_0x4d1688})['then'](function(_0x18135a){logger['info'](_0xc147('0x16'),_0x4d1688,_0x18135a?_0xc147('0x17'):_0xc147('0x18'));return _0x465485(_0x18135a);})['catch'](function(_0x5d29d0){logger[_0xc147('0xa')]('[utils][getUserByInternal]',_0x5d29d0?util[_0xc147('0x9')](_0x5d29d0,{'showHidden':![],'depth':null}):'');return _0x465485(null);});}return _0x465485(null);});};exports[_0xc147('0x19')]=function(_0x50f699){return new BPromise(function(_0x2b7c39,_0x12b06f){if(_0x50f699){return getUser({'interface':_0x50f699})['then'](function(_0x59e978){logger[_0xc147('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x50f699,_0x59e978?_0xc147('0x17'):_0xc147('0x18'));return _0x2b7c39(_0x59e978);})[_0xc147('0xd')](function(_0xc13510){logger['error'](_0xc147('0x1a'),_0xc13510?util[_0xc147('0x9')](_0xc13510,{'showHidden':![],'depth':null}):'');return _0x2b7c39(null);});}return _0x2b7c39(null);});};exports[_0xc147('0x1b')]=function(_0x20ff5d){return new BPromise(function(_0x4c53c2,_0x13de4a){if(_0x20ff5d){return getUser({'name':_0x20ff5d})[_0xc147('0x1c')](function(_0x1ff5b6){logger[_0xc147('0x7')](_0xc147('0x1d'),_0x20ff5d,_0x1ff5b6?_0xc147('0x17'):_0xc147('0x18'));return _0x4c53c2(_0x1ff5b6);})[_0xc147('0xd')](function(_0x810aa0){logger['error'](_0xc147('0x1e'),_0x810aa0?util[_0xc147('0x9')](_0x810aa0,{'showHidden':![],'depth':null}):'');return _0x4c53c2(null);});}return _0x4c53c2(null);});};exports[_0xc147('0x1f')]=function(_0x2342b7){return new BPromise(function(_0x526041,_0x13956c){if(_0x2342b7){return client[_0xc147('0xb')](_0xc147('0x20'),{'options':{'raw':!![],'attributes':['id',_0xc147('0x10'),_0xc147('0x21'),_0xc147('0x22'),_0xc147('0x23')],'where':{'name':_0x2342b7},'limit':0x1}})[_0xc147('0x1c')](function(_0x149d4d){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x2342b7,_0x149d4d?util[_0xc147('0x9')](_0x149d4d,{'showHidden':![],'depth':null}):'');logger[_0xc147('0x7')](_0xc147('0x24'),_0x2342b7,_0x149d4d?_0xc147('0x17'):'notfound');return _0x526041(_0x149d4d['result'][_0xc147('0x25')]?_0x149d4d['result'][0x0]:null);})[_0xc147('0xd')](function(_0x12b8ca){logger[_0xc147('0xa')]('[utils][getVoiceQueueByName]',_0x12b8ca?util['inspect'](_0x12b8ca,{'showHidden':![],'depth':null}):'');return _0x526041(null);});}return _0x526041(null);});};exports[_0xc147('0x26')]=function(_0x3c3f35,_0x5e6a13){return moment(_0x3c3f35)[_0xc147('0x27')](_0x5e6a13,_0xc147('0x28'))[_0xc147('0x29')](_0xc147('0x2a'));};exports[_0xc147('0x2b')]=function(_0x17d072,_0xe6315e){return moment(_0x17d072)[_0xc147('0x2c')](_0xe6315e,'seconds')[_0xc147('0x29')](_0xc147('0x2a'));};exports['diffTime']=function(_0x198cdd,_0x362977){return moment(_0x198cdd)[_0xc147('0x2d')](moment(_0x362977),_0xc147('0x28'));};exports[_0xc147('0x2e')]=function(_0x3cd18d,_0x51b075){return parseInt(_0x3cd18d,0xa)+parseInt(_0x51b075,0xa);};exports[_0xc147('0x2f')]=function(){return moment()[_0xc147('0x29')](_0xc147('0x2a'));};exports[_0xc147('0x30')]=function(_0x407d94,_0x6fdd23){if(_0x6fdd23){return moment(_0x407d94)[_0xc147('0x30')](_0x6fdd23);}return!![];};exports[_0xc147('0x31')]=function(_0x48c1fc,_0x528088){if(_0x528088){return moment(_0x48c1fc)[_0xc147('0x31')](_0x528088);}else if(_0x48c1fc){return!![];}return![];}; \ No newline at end of file +var _0x8923=['info','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','interface','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','http','xdr'];(function(_0x37c659,_0x37a58c){var _0x176fe2=function(_0x1f9af0){while(--_0x1f9af0){_0x37c659['push'](_0x37c659['shift']());}};_0x176fe2(++_0x37a58c);}(_0x8923,0x70));var _0x3892=function(_0x4c2e73,_0x10912f){_0x4c2e73=_0x4c2e73-0x0;var _0x5e1600=_0x8923[_0x4c2e73];return _0x5e1600;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3892('0x0'));var moment=require(_0x3892('0x1'));var util=require(_0x3892('0x2'));var client=jayson['client'][_0x3892('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x3892('0x4'));exports[_0x3892('0x5')]=function(_0x33dc18,_0x3e37d9){logger[_0x3892('0x5')](_0x33dc18,_0x3e37d9?util[_0x3892('0x6')](_0x3e37d9,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x9ae1ea,_0x2ba8e1){logger[_0x3892('0x7')](_0x9ae1ea,_0x2ba8e1?util[_0x3892('0x6')](_0x2ba8e1,{'showHidden':![],'depth':null}):'');};exports[_0x3892('0x8')]=function(_0x1f66d0,_0x131864){logger[_0x3892('0x8')](_0x1f66d0,_0x131864?util['inspect'](_0x131864,{'showHidden':![],'depth':null}):'');};exports[_0x3892('0x9')]=function(_0x5535df,_0x1a76db){return client[_0x3892('0x9')](_0x5535df,{'body':_0x1a76db})[_0x3892('0xa')](function(_0x1279f5){logger[_0x3892('0x7')](_0x3892('0xb'),_0x5535df,_0x1279f5?util[_0x3892('0x6')](_0x1279f5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x59835e){logger[_0x3892('0x8')](_0x3892('0xb'),_0x5535df,_0x59835e?util[_0x3892('0x6')](_0x59835e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x19d2f7){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x3892('0xc'),_0x3892('0xd'),_0x3892('0xe')],'where':_0x19d2f7,'limit':0x1}})['then'](function(_0xbc0d29){logger[_0x3892('0x7')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x19d2f7),_0xbc0d29?util[_0x3892('0x6')](_0xbc0d29,{'showHidden':![],'depth':null}):'');return _0xbc0d29[_0x3892('0xf')][_0x3892('0x10')]?_0xbc0d29[_0x3892('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x23021f){return new BPromise(function(_0x470530,_0x31b997){if(_0x23021f){return getUser({'internal':_0x23021f})[_0x3892('0xa')](function(_0x45aed3){logger[_0x3892('0x5')](_0x3892('0x11'),_0x23021f,_0x45aed3?_0x3892('0x12'):_0x3892('0x13'));return _0x470530(_0x45aed3);})[_0x3892('0x14')](function(_0x320e10){logger[_0x3892('0x8')](_0x3892('0x15'),_0x320e10?util['inspect'](_0x320e10,{'showHidden':![],'depth':null}):'');return _0x470530(null);});}return _0x470530(null);});};exports['getUserByInterface']=function(_0x25d4af){return new BPromise(function(_0x25f3a5,_0x5ae33b){if(_0x25d4af){return getUser({'interface':_0x25d4af})['then'](function(_0x4faa17){logger[_0x3892('0x5')](_0x3892('0x16'),_0x25d4af,_0x4faa17?'found':_0x3892('0x13'));return _0x25f3a5(_0x4faa17);})[_0x3892('0x14')](function(_0x54ca10){logger[_0x3892('0x8')](_0x3892('0x17'),_0x54ca10?util[_0x3892('0x6')](_0x54ca10,{'showHidden':![],'depth':null}):'');return _0x25f3a5(null);});}return _0x25f3a5(null);});};exports[_0x3892('0x18')]=function(_0x550688){return new BPromise(function(_0x6e3571,_0x969530){if(_0x550688){return getUser({'name':_0x550688})[_0x3892('0xa')](function(_0x5c434d){logger[_0x3892('0x5')](_0x3892('0x19'),_0x550688,_0x5c434d?_0x3892('0x12'):_0x3892('0x13'));return _0x6e3571(_0x5c434d);})['catch'](function(_0x3b8338){logger[_0x3892('0x8')](_0x3892('0x1a'),_0x3b8338?util[_0x3892('0x6')](_0x3b8338,{'showHidden':![],'depth':null}):'');return _0x6e3571(null);});}return _0x6e3571(null);});};exports[_0x3892('0x1b')]=function(_0x42aa69){return new BPromise(function(_0x35e384,_0xfc9e18){if(_0x42aa69){return client[_0x3892('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x3892('0xd'),'type','acw',_0x3892('0x1c')],'where':{'name':_0x42aa69},'limit':0x1}})[_0x3892('0xa')](function(_0x573512){logger[_0x3892('0x7')](_0x3892('0x1d'),_0x42aa69,_0x573512?util['inspect'](_0x573512,{'showHidden':![],'depth':null}):'');logger[_0x3892('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x42aa69,_0x573512?_0x3892('0x12'):'notfound');return _0x35e384(_0x573512[_0x3892('0xf')]['length']?_0x573512[_0x3892('0xf')][0x0]:null);})['catch'](function(_0x45eeb1){logger[_0x3892('0x8')]('[utils][getVoiceQueueByName]',_0x45eeb1?util[_0x3892('0x6')](_0x45eeb1,{'showHidden':![],'depth':null}):'');return _0x35e384(null);});}return _0x35e384(null);});};exports['addTime']=function(_0x5743f1,_0x5d5350){return moment(_0x5743f1)[_0x3892('0x1e')](_0x5d5350,_0x3892('0x1f'))['format'](_0x3892('0x20'));};exports['subtractTime']=function(_0x368fa4,_0x397d25){return moment(_0x368fa4)['subtract'](_0x397d25,_0x3892('0x1f'))[_0x3892('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x1b51a8,_0x453e3a){return moment(_0x1b51a8)[_0x3892('0x22')](moment(_0x453e3a),_0x3892('0x1f'));};exports[_0x3892('0x23')]=function(_0x1069ed,_0x55f6d4){return parseInt(_0x1069ed,0xa)+parseInt(_0x55f6d4,0xa);};exports[_0x3892('0x24')]=function(){return moment()[_0x3892('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3892('0x25')]=function(_0x5c1dae,_0x2f78f9){if(_0x2f78f9){return moment(_0x5c1dae)[_0x3892('0x25')](_0x2f78f9);}return!![];};exports[_0x3892('0x26')]=function(_0x4e6005,_0x479df7){if(_0x479df7){return moment(_0x4e6005)[_0x3892('0x26')](_0x479df7);}else if(_0x4e6005){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 333e1bc..e88fd28 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 _0xc74d=['catch','then','user','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','isEmpty','body','method','headers','x-forwarded-for','url','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)','format','connection','remoteAddress','statusCode','agent_name','test','setupLoggers','lodash','express-winston','util','./loggers','./safe-template','safeTemplate','log','xcally','join','client','role','name'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xc74d,0x1d8));var _0xdc74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc74d[_0x20a584];return _0x4b41a8;};var fs=require('fs-extra');var _=require(_0xdc74('0x0'));var ewinston=require(_0xdc74('0x1'));var path=require('path');var util=require(_0xdc74('0x2'));var fileLogger=require(_0xdc74('0x3'))['fileLogger'];var safeTemplate=require(_0xdc74('0x4'))[_0xdc74('0x5')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x261fab(_0x497d02){var _0x4fd3f2=path['join']('/var',_0xdc74('0x6'),_0xdc74('0x7'));var _0x55c2ed=path[_0xdc74('0x8')](_0xdc74('0x9'),_0x497d02[_0xdc74('0xa')]+'-'+_0x497d02[_0xdc74('0xb')]);return fs['ensureDir'](path[_0xdc74('0x8')](_0x4fd3f2,_0x55c2ed))['then'](function(){var _0x4904a0=fileLogger(_0xdc74('0x9'),path[_0xdc74('0x8')](_0x4fd3f2,_0x55c2ed));return _0x4904a0;})[_0xdc74('0xc')](function(_0x3279f7){throw _0x3279f7;});}this[_0xdc74('0x6')]=function(_0xef22b2,_0x490b4a,_0x208bfd,_0x4aabca){return _0x261fab(_0xef22b2['user'])['then'](function(_0x20b532){var _0x446a1c=_0x20b532[_0x490b4a];return _0x446a1c;})[_0xdc74('0xd')](function(_0x353df9){var _0x1700cf=_0xef22b2[_0xdc74('0xe')]?_0xef22b2[_0xdc74('0xe')]['id']:_0xdc74('0xf');var _0x22ff7f=_0x4aabca[_0xdc74('0x10')];var _0x42de59=_0x4aabca[_0xdc74('0x11')];var _0x398eff=new Date(Number(_0x42de59));return _0x353df9(_0x1700cf,_0x398eff,_0x208bfd,_0x22ff7f);})[_0xdc74('0xc')](function(_0x56e22e){fileLogger(_0xdc74('0x9'))[_0xdc74('0x12')](_0x56e22e);});};}function setupLoggers(_0x278642){return new Promise(function(_0x2ab336){var _0x4719f3=new ClientSideLogger();var _0x350cb5=fileLogger(_0xdc74('0x13'));var _0xa70c73=fileLogger(_0xdc74('0x14'));_0x278642[_0xdc74('0x15')](_0xdc74('0x16'),_0x4719f3);_0x278642[_0xdc74('0x17')](ewinston[_0xdc74('0x18')]({'winstonInstance':_0x350cb5,'meta':![],'statusLevels':!![],'msg':function(_0x23bb7a,_0x4cca63){var _0x4de34f=_0xdc74('0x19');if(!_[_0xdc74('0x1a')](_0x23bb7a['body'])){_0x4de34f+='\x20body=%s';var _0x57b44d=_0x23bb7a[_0xdc74('0x1b')];maskSensitiveData(_0x57b44d);}return safeTemplate(util['format'](_0x4de34f,_0x23bb7a[_0xdc74('0x1c')],_0x23bb7a[_0xdc74('0x1d')]['x-forwarded-for']?_0x23bb7a[_0xdc74('0x1d')][_0xdc74('0x1e')]:_0x23bb7a['connection']['remoteAddress']||_0x23bb7a['ip'],_0x23bb7a[_0xdc74('0x1f')],_0x4cca63['statusCode'],_0x4cca63[_0xdc74('0x20')],_0x23bb7a['user']?_0x23bb7a['user']['id']:null,_0x23bb7a['user']?_0x23bb7a['user'][_0xdc74('0xb')]:null,_0x23bb7a[_0xdc74('0xe')]?_0x23bb7a[_0xdc74('0xe')][_0xdc74('0xa')]:null,_0x57b44d?util[_0xdc74('0x21')](_0x57b44d,![],null):''));}}));_0x278642[_0xdc74('0x17')](ewinston[_0xdc74('0x18')]({'winstonInstance':_0xa70c73,'meta':![],'statusLevels':!![],'msg':function(_0x36b418,_0x219e6c){var _0xed5ae8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x36b418[_0xdc74('0x1b')]&&_0x36b418[_0xdc74('0x1b')][_0xdc74('0x22')]&&_0x36b418[_0xdc74('0x1b')][_0xdc74('0x23')]){_0xed5ae8=_0xdc74('0x24');}return util[_0xdc74('0x25')](_0xed5ae8,_0x36b418[_0xdc74('0x1c')],_0x36b418['headers'][_0xdc74('0x1e')]?_0x36b418[_0xdc74('0x1d')][_0xdc74('0x1e')]:_0x36b418[_0xdc74('0x26')][_0xdc74('0x27')]||_0x36b418['ip'],_0x36b418[_0xdc74('0x1f')],_0x219e6c[_0xdc74('0x28')],_0x219e6c[_0xdc74('0x20')],_0x36b418[_0xdc74('0xe')]?_0x36b418[_0xdc74('0xe')]['id']:null,_0x36b418[_0xdc74('0xe')]?_0x36b418[_0xdc74('0xe')][_0xdc74('0xb')]:null,_0x36b418[_0xdc74('0xe')]?_0x36b418[_0xdc74('0xe')][_0xdc74('0xa')]:null,_0x36b418['body']&&_0x36b418['body'][_0xdc74('0x22')]?_0x36b418['body'][_0xdc74('0x22')]:'other',_0x36b418[_0xdc74('0x1b')]&&_0x36b418[_0xdc74('0x1b')][_0xdc74('0x23')]?_0x36b418['body']['agent_id']:'',_0x36b418['body']&&_0x36b418['body'][_0xdc74('0x29')]?_0x36b418[_0xdc74('0x1b')][_0xdc74('0x29')]:'');},'ignoreRoute':function(_0x142907){var _0x1465a5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1465a5[_0xdc74('0x2a')](_0x142907['url']);}}));return _0x2ab336();});}exports[_0xdc74('0x2b')]=setupLoggers; \ No newline at end of file +var _0xfd22=['method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','other','agent_id','agent_name','test','setupLoggers','lodash','express-winston','path','./loggers','fileLogger','safeTemplate','maskSensitiveData','join','log','client','role','name','ensureDir','then','catch','user','data','timestamp','error','api','auth','set','client-side-logger','logger','isEmpty','\x20body=%s','body','format'];(function(_0x3c1a4e,_0x36dabf){var _0x155a91=function(_0x367f0d){while(--_0x367f0d){_0x3c1a4e['push'](_0x3c1a4e['shift']());}};_0x155a91(++_0x36dabf);}(_0xfd22,0xec));var _0x2fd2=function(_0x39f59b,_0x2dfc7a){_0x39f59b=_0x39f59b-0x0;var _0x389f31=_0xfd22[_0x39f59b];return _0x389f31;};var fs=require('fs-extra');var _=require(_0x2fd2('0x0'));var ewinston=require(_0x2fd2('0x1'));var path=require(_0x2fd2('0x2'));var util=require('util');var fileLogger=require(_0x2fd2('0x3'))[_0x2fd2('0x4')];var safeTemplate=require('./safe-template')[_0x2fd2('0x5')];var maskSensitiveData=require('./mask-sensitive-data')[_0x2fd2('0x6')];function ClientSideLogger(){function _0x441fea(_0x12231c){var _0x1aa6c9=path[_0x2fd2('0x7')]('/var',_0x2fd2('0x8'),'xcally');var _0x2edfd0=path[_0x2fd2('0x7')](_0x2fd2('0x9'),_0x12231c[_0x2fd2('0xa')]+'-'+_0x12231c[_0x2fd2('0xb')]);return fs[_0x2fd2('0xc')](path[_0x2fd2('0x7')](_0x1aa6c9,_0x2edfd0))[_0x2fd2('0xd')](function(){var _0x9884fe=fileLogger(_0x2fd2('0x9'),path['join'](_0x1aa6c9,_0x2edfd0));return _0x9884fe;})[_0x2fd2('0xe')](function(_0xd61b3c){throw _0xd61b3c;});}this[_0x2fd2('0x8')]=function(_0x277de0,_0x34b301,_0x1e8500,_0x283394){return _0x441fea(_0x277de0[_0x2fd2('0xf')])[_0x2fd2('0xd')](function(_0x532430){var _0xe97486=_0x532430[_0x34b301];return _0xe97486;})[_0x2fd2('0xd')](function(_0x4f9e28){var _0x33ca5a=_0x277de0[_0x2fd2('0xf')]?_0x277de0[_0x2fd2('0xf')]['id']:'no-user';var _0x33c74a=_0x283394[_0x2fd2('0x10')];var _0x40eacf=_0x283394[_0x2fd2('0x11')];var _0x1fac51=new Date(Number(_0x40eacf));return _0x4f9e28(_0x33ca5a,_0x1fac51,_0x1e8500,_0x33c74a);})[_0x2fd2('0xe')](function(_0x7e17c6){fileLogger(_0x2fd2('0x9'))[_0x2fd2('0x12')](_0x7e17c6);});};}function setupLoggers(_0x1c352b){return new Promise(function(_0x1a6e8b){var _0x4e2e27=new ClientSideLogger();var _0x57a21b=fileLogger(_0x2fd2('0x13'));var _0x57bf5a=fileLogger(_0x2fd2('0x14'));_0x1c352b[_0x2fd2('0x15')](_0x2fd2('0x16'),_0x4e2e27);_0x1c352b['use'](ewinston[_0x2fd2('0x17')]({'winstonInstance':_0x57a21b,'meta':![],'statusLevels':!![],'msg':function(_0xdb0948,_0x9b3351){var _0x44cdb4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x2fd2('0x18')](_0xdb0948['body'])){_0x44cdb4+=_0x2fd2('0x19');var _0x2ae2e7=_0xdb0948[_0x2fd2('0x1a')];maskSensitiveData(_0x2ae2e7);}return safeTemplate(util[_0x2fd2('0x1b')](_0x44cdb4,_0xdb0948[_0x2fd2('0x1c')],_0xdb0948[_0x2fd2('0x1d')][_0x2fd2('0x1e')]?_0xdb0948[_0x2fd2('0x1d')]['x-forwarded-for']:_0xdb0948[_0x2fd2('0x1f')][_0x2fd2('0x20')]||_0xdb0948['ip'],_0xdb0948[_0x2fd2('0x21')],_0x9b3351[_0x2fd2('0x22')],_0x9b3351['responseTime'],_0xdb0948['user']?_0xdb0948[_0x2fd2('0xf')]['id']:null,_0xdb0948[_0x2fd2('0xf')]?_0xdb0948[_0x2fd2('0xf')]['name']:null,_0xdb0948[_0x2fd2('0xf')]?_0xdb0948[_0x2fd2('0xf')][_0x2fd2('0xa')]:null,_0x2ae2e7?util[_0x2fd2('0x23')](_0x2ae2e7,![],null):''));}}));_0x1c352b[_0x2fd2('0x24')](ewinston[_0x2fd2('0x17')]({'winstonInstance':_0x57bf5a,'meta':![],'statusLevels':!![],'msg':function(_0x19e3bb,_0x3ee803){var _0x11daf9=_0x2fd2('0x25');if(_0x19e3bb[_0x2fd2('0x1a')]&&_0x19e3bb[_0x2fd2('0x1a')][_0x2fd2('0x26')]&&_0x19e3bb[_0x2fd2('0x1a')]['agent_id']){_0x11daf9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x11daf9,_0x19e3bb['method'],_0x19e3bb[_0x2fd2('0x1d')][_0x2fd2('0x1e')]?_0x19e3bb[_0x2fd2('0x1d')][_0x2fd2('0x1e')]:_0x19e3bb['connection']['remoteAddress']||_0x19e3bb['ip'],_0x19e3bb[_0x2fd2('0x21')],_0x3ee803[_0x2fd2('0x22')],_0x3ee803['responseTime'],_0x19e3bb['user']?_0x19e3bb['user']['id']:null,_0x19e3bb[_0x2fd2('0xf')]?_0x19e3bb['user'][_0x2fd2('0xb')]:null,_0x19e3bb['user']?_0x19e3bb[_0x2fd2('0xf')][_0x2fd2('0xa')]:null,_0x19e3bb[_0x2fd2('0x1a')]&&_0x19e3bb[_0x2fd2('0x1a')]['device']?_0x19e3bb[_0x2fd2('0x1a')]['device']:_0x2fd2('0x27'),_0x19e3bb['body']&&_0x19e3bb[_0x2fd2('0x1a')][_0x2fd2('0x28')]?_0x19e3bb[_0x2fd2('0x1a')][_0x2fd2('0x28')]:'',_0x19e3bb[_0x2fd2('0x1a')]&&_0x19e3bb['body'][_0x2fd2('0x29')]?_0x19e3bb['body'][_0x2fd2('0x29')]:'');},'ignoreRoute':function(_0x3073a9){var _0x2d95ac=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2d95ac[_0x2fd2('0x2a')](_0x3073a9['url']);}}));return _0x1a6e8b();});}exports[_0x2fd2('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 138e328..a4d1bbc 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69f0=['locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','monthsShort','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','max','min','domCompare','MMM','monthCompare','test','isMoment','split','length','padStart','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid'];(function(_0x42764f,_0x37f723){var _0x2cd55e=function(_0x592f02){while(--_0x592f02){_0x42764f['push'](_0x42764f['shift']());}};_0x2cd55e(++_0x37f723);}(_0x69f0,0x132));var _0x069f=function(_0x4f915e,_0x11cfc4){_0x4f915e=_0x4f915e-0x0;var _0xad075=_0x69f0[_0x4f915e];return _0xad075;};var _=require('lodash');var moment=require(_0x069f('0x0'));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][_0x069f('0x1')](function(_0x3eab33){return _0x3eab33[_0x069f('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x069f('0x3');var EINVALID_DATE=_0x069f('0x4');function throwIfDateNotValid(_0x35db78){if(!_0x35db78[_0x069f('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x58cd8d){var _0x5b1dd9=_0x58cd8d['split'](':')['map'](function(_0x3964b7){return parseInt(_0x3964b7,0xa);});var _0x375001=_0x5b1dd9[0x0];var _0xc244fd=_0x5b1dd9[0x1];if(_0x375001<0x0||_0x375001>0x17||_0xc244fd<0x0||_0xc244fd>0x3b){throw new Error(EINVALID_DATE);}return[_0x375001,_0xc244fd];}function circularDoWInterval(_0x360349,_0x33bc74){if(_0x360349===_0x33bc74){return[_0x360349];}else{var _0x41c11d=moment[_0x069f('0x6')]();moment[_0x069f('0x6')]('en');var _0x5bcc96=moment[_0x069f('0x7')]()['map'](function(_0x1df1ca){return _0x1df1ca[_0x069f('0x8')]();});moment[_0x069f('0x6')](_0x41c11d);var _0x2622ac=_0x5bcc96[_0x069f('0x9')](_0x360349);var _0x531eb0=_0x5bcc96[_0x069f('0x9')](_0x33bc74);if(_0x531eb0>_0x2622ac){return _0x5bcc96[_0x069f('0xa')](_0x2622ac,_0x531eb0+0x1);}else{var _0x391fac=_0x5bcc96[_0x069f('0xa')](0x0,_0x531eb0+0x1);var _0x5cb8b1=_0x5bcc96[_0x069f('0xa')](_0x2622ac);return _0x5cb8b1['concat'](_0x391fac);}}}module[_0x069f('0xb')][_0x069f('0xc')]=circularDoWInterval;function circularMonthInterval(_0x2ad534,_0x5895e3){if(_0x2ad534===_0x5895e3){return[_0x2ad534];}else{var _0x2dc8ec=moment[_0x069f('0x6')]();moment[_0x069f('0x6')]('en');var _0x559ea5=moment[_0x069f('0xd')]()[_0x069f('0x1')](function(_0x56abb7){return _0x56abb7['toLowerCase']();});moment[_0x069f('0x6')](_0x2dc8ec);var _0x2a8fee=_0x559ea5['indexOf'](_0x2ad534);var _0x578395=_0x559ea5['indexOf'](_0x5895e3);if(_0x578395>_0x2a8fee){return _0x559ea5['slice'](_0x2a8fee,_0x578395+0x1);}else{var _0x3778f3=_0x559ea5[_0x069f('0xa')](0x0,_0x578395+0x1);var _0x17a272=_0x559ea5[_0x069f('0xa')](_0x2a8fee);return _0x17a272[_0x069f('0xe')](_0x3778f3);}}}module['exports'][_0x069f('0xf')]=circularMonthInterval;function parseDom(_0xe2158b){var _0x31d222=parseInt(_0xe2158b,0xa);if(_0x31d222<0x1||_0x31d222>0x1f){throw new Error(EINVALID_DATE);}return _0x31d222;}function timeCompare(_0x59632d,_0x3f8a4e,_0x75834d){var _0x247a0a=_0x59632d[_0x069f('0x10')]();var _0x5270ee=extractTime(_0x3f8a4e);var _0x4a4bad=_0x5270ee[0x0];var _0x4a920c=_0x5270ee[0x1];var _0x33506f=_0x59632d[_0x069f('0x10')]()[_0x069f('0x11')](_0x4a4bad)[_0x069f('0x12')](_0x4a920c);throwIfDateNotValid(_0x33506f);var _0x98161f=extractTime(_0x75834d);var _0x406ebc=_0x98161f[0x0];var _0x29a8f8=_0x98161f[0x1];var _0x16e8d8=_0x59632d['clone']()[_0x069f('0x11')](_0x406ebc)['minutes'](_0x29a8f8);throwIfDateNotValid(_0x16e8d8);if(_0x16e8d8[_0x069f('0x13')](_0x33506f)){var _0x48ac06=_0x247a0a[_0x069f('0x10')]()[_0x069f('0x14')](_0x069f('0x15'));var _0x102255=_0x247a0a['clone']()['endOf']('day');return _0x247a0a[_0x069f('0x16')](_0x33506f,_0x102255,undefined,'[]')||_0x247a0a[_0x069f('0x16')](_0x48ac06,_0x16e8d8,undefined,'[]');}else{return _0x247a0a[_0x069f('0x16')](_0x33506f,_0x16e8d8,undefined,'[]');}}module[_0x069f('0xb')][_0x069f('0x17')]=timeCompare;function dowCompare(_0x5280dc,_0x36ad0a,_0x45d9c8){var _0x59ac23=_0x5280dc['locale']('en')[_0x069f('0x18')](_0x069f('0x19'))[_0x069f('0x8')]();return circularDoWInterval(_0x36ad0a,_0x45d9c8)[_0x069f('0x1a')](_0x59ac23);}module[_0x069f('0xb')][_0x069f('0x1b')]=dowCompare;function domCompare(_0x46e11f,_0x38e270,_0x1a9a83){var _0x92dc1a=_0x46e11f[_0x069f('0x1c')]();if(_0x38e270===_0x1a9a83){return _0x92dc1a===_0x38e270;}else{var _0x39f06a=_0x46e11f['daysInMonth']();var _0x3538ed=_0x38e270<_0x1a9a83;let _0x165a71=![];var _0x19897c=0x0;var _0x4fac03=0x0;if(_0x3538ed){_0x19897c=Math[_0x069f('0x1d')](0x1,_0x38e270);_0x4fac03=Math[_0x069f('0x1e')](_0x1a9a83,_0x39f06a);_0x165a71=_0x92dc1a>=_0x19897c&&_0x92dc1a<=_0x4fac03;}else{_0x19897c=Math[_0x069f('0x1e')](_0x38e270,_0x39f06a);_0x4fac03=Math[_0x069f('0x1d')](0x1,_0x1a9a83);_0x165a71=_0x92dc1a>=_0x19897c||_0x92dc1a<=_0x4fac03;}return _0x165a71;}}module[_0x069f('0xb')][_0x069f('0x1f')]=domCompare;function monthCompare(_0x386e34,_0x55c180,_0x2c6e00){var _0xb4b91f=_0x386e34[_0x069f('0x6')]('en')[_0x069f('0x18')](_0x069f('0x20'))[_0x069f('0x8')]();return circularMonthInterval(_0x55c180,_0x2c6e00)[_0x069f('0x1a')](_0xb4b91f);}module[_0x069f('0xb')][_0x069f('0x21')]=monthCompare;function iftime(_0x4a7992,_0x40ba0f=moment['tz']['guess'](),_0x310547=moment()){if(!validateRx[_0x069f('0x22')](_0x4a7992)){throw new Error(EINVALID_STRING);}else{var _0x50c98a=(moment[_0x069f('0x23')](_0x310547)?_0x310547[_0x069f('0x10')]():moment(_0x310547))['tz'](_0x40ba0f)[_0x069f('0x6')]('en');throwIfDateNotValid(_0x50c98a);var _0xcf1f97=_0x4a7992['split'](',');var _0x3663ee=_0xcf1f97[0x0];var _0x1a699b=_0xcf1f97[0x1];var _0x5f00c3=_0xcf1f97[0x2];var _0x53dee7=_0xcf1f97[0x3];let _0x3707e8=!![];if(_0x3663ee!=='*'){var _0x106af5=_0x3663ee[_0x069f('0x24')]('-');var _0x2d4e85=_['padStart'](_0x106af5[0x0],0x5,'0');var _0x181436=_0x106af5[_0x069f('0x25')]===0x2?_[_0x069f('0x26')](_0x106af5[0x1],0x5,'0'):_0x2d4e85;_0x3707e8=timeCompare(_0x50c98a,_0x2d4e85,_0x181436);}let _0x48a720=!![];if(_0x1a699b!=='*'){var _0x2bb391=_0x1a699b[_0x069f('0x24')]('-');var _0x159468=_0x2bb391[0x0];var _0x1a4b31=_0x2bb391[_0x069f('0x25')]===0x2?_0x2bb391[0x1]:_0x159468;_0x48a720=dowCompare(_0x50c98a,_0x159468,_0x1a4b31);}let _0x1c8dc8=!![];if(_0x5f00c3!=='*'){var _0x3f5c0f=_0x5f00c3[_0x069f('0x24')]('-');var _0x2ca380=parseDom(_0x3f5c0f[0x0]);var _0x45449f=_0x3f5c0f['length']===0x2?parseDom(_0x3f5c0f[0x1]):_0x2ca380;_0x1c8dc8=domCompare(_0x50c98a,_0x2ca380,_0x45449f);}let _0x4f76f9=!![];if(_0x53dee7!=='*'){var _0x4596b1=_0x53dee7[_0x069f('0x24')]('-');var _0x91df64=_0x4596b1[0x0];var _0x4a950d=_0x4596b1[_0x069f('0x25')]===0x2?_0x4596b1[0x1]:_0x4596b1[0x0];_0x4f76f9=monthCompare(_0x50c98a,_0x91df64,_0x4a950d);}return _0x3707e8&&_0x48a720&&_0x1c8dc8&&_0x4f76f9;}}module[_0x069f('0xb')]['iftime']=iftime; \ No newline at end of file +var _0x99c8=['circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','max','min','MMM','guess','isMoment','length','padStart','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort'];(function(_0xc52c24,_0x3fcd4c){var _0x49b9f2=function(_0x5b069a){while(--_0x5b069a){_0xc52c24['push'](_0xc52c24['shift']());}};_0x49b9f2(++_0x3fcd4c);}(_0x99c8,0x13d));var _0x899c=function(_0x4ddf09,_0x48d926){_0x4ddf09=_0x4ddf09-0x0;var _0x24784f=_0x99c8[_0x4ddf09];return _0x24784f;};var _=require('lodash');var moment=require(_0x899c('0x0'));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(_0x2f69d7){return _0x2f69d7[_0x899c('0x1')];})[_0x899c('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x899c('0x3');var EINVALID_DATE=_0x899c('0x4');function throwIfDateNotValid(_0x1838a6){if(!_0x1838a6[_0x899c('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5818a5){var _0x12f3e7=_0x5818a5[_0x899c('0x6')](':')['map'](function(_0x5483a0){return parseInt(_0x5483a0,0xa);});var _0x5929db=_0x12f3e7[0x0];var _0x3ad07e=_0x12f3e7[0x1];if(_0x5929db<0x0||_0x5929db>0x17||_0x3ad07e<0x0||_0x3ad07e>0x3b){throw new Error(EINVALID_DATE);}return[_0x5929db,_0x3ad07e];}function circularDoWInterval(_0x568ed8,_0x38784a){if(_0x568ed8===_0x38784a){return[_0x568ed8];}else{var _0x52b77a=moment[_0x899c('0x7')]();moment['locale']('en');var _0x5c1016=moment['weekdaysShort']()[_0x899c('0x8')](function(_0x4bcd96){return _0x4bcd96[_0x899c('0x9')]();});moment[_0x899c('0x7')](_0x52b77a);var _0x840664=_0x5c1016['indexOf'](_0x568ed8);var _0x419e45=_0x5c1016[_0x899c('0xa')](_0x38784a);if(_0x419e45>_0x840664){return _0x5c1016[_0x899c('0xb')](_0x840664,_0x419e45+0x1);}else{var _0x6a2fc8=_0x5c1016['slice'](0x0,_0x419e45+0x1);var _0x8c90e7=_0x5c1016[_0x899c('0xb')](_0x840664);return _0x8c90e7[_0x899c('0xc')](_0x6a2fc8);}}}module[_0x899c('0xd')][_0x899c('0xe')]=circularDoWInterval;function circularMonthInterval(_0x91207c,_0x2729ca){if(_0x91207c===_0x2729ca){return[_0x91207c];}else{var _0x1033da=moment[_0x899c('0x7')]();moment[_0x899c('0x7')]('en');var _0x1f9aff=moment[_0x899c('0xf')]()[_0x899c('0x8')](function(_0x2dba20){return _0x2dba20[_0x899c('0x9')]();});moment[_0x899c('0x7')](_0x1033da);var _0x23d9ec=_0x1f9aff['indexOf'](_0x91207c);var _0x483174=_0x1f9aff[_0x899c('0xa')](_0x2729ca);if(_0x483174>_0x23d9ec){return _0x1f9aff[_0x899c('0xb')](_0x23d9ec,_0x483174+0x1);}else{var _0xa427c1=_0x1f9aff[_0x899c('0xb')](0x0,_0x483174+0x1);var _0x1cadec=_0x1f9aff[_0x899c('0xb')](_0x23d9ec);return _0x1cadec[_0x899c('0xc')](_0xa427c1);}}}module['exports'][_0x899c('0x10')]=circularMonthInterval;function parseDom(_0x5e55be){var _0x14083f=parseInt(_0x5e55be,0xa);if(_0x14083f<0x1||_0x14083f>0x1f){throw new Error(EINVALID_DATE);}return _0x14083f;}function timeCompare(_0x5215f1,_0x4d6639,_0x225e65){var _0x276a7a=_0x5215f1[_0x899c('0x11')]();var _0x1e9aee=extractTime(_0x4d6639);var _0x43ad35=_0x1e9aee[0x0];var _0x24c53d=_0x1e9aee[0x1];var _0x11e48b=_0x5215f1[_0x899c('0x11')]()['hours'](_0x43ad35)['minutes'](_0x24c53d);throwIfDateNotValid(_0x11e48b);var _0x3f50be=extractTime(_0x225e65);var _0x119b29=_0x3f50be[0x0];var _0x35594b=_0x3f50be[0x1];var _0x26dd00=_0x5215f1[_0x899c('0x11')]()[_0x899c('0x12')](_0x119b29)[_0x899c('0x13')](_0x35594b);throwIfDateNotValid(_0x26dd00);if(_0x26dd00['isBefore'](_0x11e48b)){var _0x4c1e13=_0x276a7a[_0x899c('0x11')]()[_0x899c('0x14')](_0x899c('0x15'));var _0x59c001=_0x276a7a['clone']()[_0x899c('0x16')](_0x899c('0x15'));return _0x276a7a[_0x899c('0x17')](_0x11e48b,_0x59c001,undefined,'[]')||_0x276a7a[_0x899c('0x17')](_0x4c1e13,_0x26dd00,undefined,'[]');}else{return _0x276a7a['isBetween'](_0x11e48b,_0x26dd00,undefined,'[]');}}module[_0x899c('0xd')][_0x899c('0x18')]=timeCompare;function dowCompare(_0x5379d5,_0x28182c,_0xd08cd5){var _0x2ed1de=_0x5379d5['locale']('en')[_0x899c('0x19')](_0x899c('0x1a'))[_0x899c('0x9')]();return circularDoWInterval(_0x28182c,_0xd08cd5)[_0x899c('0x1b')](_0x2ed1de);}module[_0x899c('0xd')][_0x899c('0x1c')]=dowCompare;function domCompare(_0xf1541,_0x29eea2,_0x1b7486){var _0x41b065=_0xf1541[_0x899c('0x1d')]();if(_0x29eea2===_0x1b7486){return _0x41b065===_0x29eea2;}else{var _0x272792=_0xf1541['daysInMonth']();var _0x180c87=_0x29eea2<_0x1b7486;let _0x1665df=![];var _0x599472=0x0;var _0x8d43bf=0x0;if(_0x180c87){_0x599472=Math[_0x899c('0x1e')](0x1,_0x29eea2);_0x8d43bf=Math[_0x899c('0x1f')](_0x1b7486,_0x272792);_0x1665df=_0x41b065>=_0x599472&&_0x41b065<=_0x8d43bf;}else{_0x599472=Math[_0x899c('0x1f')](_0x29eea2,_0x272792);_0x8d43bf=Math['max'](0x1,_0x1b7486);_0x1665df=_0x41b065>=_0x599472||_0x41b065<=_0x8d43bf;}return _0x1665df;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x556158,_0x29bf5a,_0x5ab505){var _0x8b18e=_0x556158[_0x899c('0x7')]('en')[_0x899c('0x19')](_0x899c('0x20'))[_0x899c('0x9')]();return circularMonthInterval(_0x29bf5a,_0x5ab505)['includes'](_0x8b18e);}module[_0x899c('0xd')]['monthCompare']=monthCompare;function iftime(_0x5c811f,_0x4c4bff=moment['tz'][_0x899c('0x21')](),_0xb9a3e6=moment()){if(!validateRx['test'](_0x5c811f)){throw new Error(EINVALID_STRING);}else{var _0x1b6c0d=(moment[_0x899c('0x22')](_0xb9a3e6)?_0xb9a3e6[_0x899c('0x11')]():moment(_0xb9a3e6))['tz'](_0x4c4bff)['locale']('en');throwIfDateNotValid(_0x1b6c0d);var _0x5700ea=_0x5c811f[_0x899c('0x6')](',');var _0x1773e5=_0x5700ea[0x0];var _0x260e31=_0x5700ea[0x1];var _0x45f0e8=_0x5700ea[0x2];var _0x28f5ce=_0x5700ea[0x3];let _0x497816=!![];if(_0x1773e5!=='*'){var _0x590273=_0x1773e5[_0x899c('0x6')]('-');var _0x1ab1fa=_['padStart'](_0x590273[0x0],0x5,'0');var _0x41df4b=_0x590273[_0x899c('0x23')]===0x2?_[_0x899c('0x24')](_0x590273[0x1],0x5,'0'):_0x1ab1fa;_0x497816=timeCompare(_0x1b6c0d,_0x1ab1fa,_0x41df4b);}let _0x57c728=!![];if(_0x260e31!=='*'){var _0x5a34f1=_0x260e31[_0x899c('0x6')]('-');var _0x22a1c6=_0x5a34f1[0x0];var _0x30f3d3=_0x5a34f1['length']===0x2?_0x5a34f1[0x1]:_0x22a1c6;_0x57c728=dowCompare(_0x1b6c0d,_0x22a1c6,_0x30f3d3);}let _0x2d08e5=!![];if(_0x45f0e8!=='*'){var _0xffad82=_0x45f0e8[_0x899c('0x6')]('-');var _0x390180=parseDom(_0xffad82[0x0]);var _0x101c49=_0xffad82[_0x899c('0x23')]===0x2?parseDom(_0xffad82[0x1]):_0x390180;_0x2d08e5=domCompare(_0x1b6c0d,_0x390180,_0x101c49);}let _0x56a4d2=!![];if(_0x28f5ce!=='*'){var _0x50ee82=_0x28f5ce[_0x899c('0x6')]('-');var _0x3c00d7=_0x50ee82[0x0];var _0x58526f=_0x50ee82[_0x899c('0x23')]===0x2?_0x50ee82[0x1]:_0x50ee82[0x0];_0x56a4d2=monthCompare(_0x1b6c0d,_0x3c00d7,_0x58526f);}return _0x497816&&_0x57c728&&_0x2d08e5&&_0x56a4d2;}}module[_0x899c('0xd')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f425f81..4b3c27a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19ee=['info','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','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','stringify','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','util','winston','../config/environment','toLowerCase'];(function(_0xd573ae,_0x59cd13){var _0xcb9db3=function(_0x5ebd51){while(--_0x5ebd51){_0xd573ae['push'](_0xd573ae['shift']());}};_0xcb9db3(++_0x59cd13);}(_0x19ee,0x188));var _0xe19e=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x19ee[_0x3fcc20];return _0x15d3ce;};'use strict';var path=require('path');var util=require(_0xe19e('0x0'));var moment=require('moment');var winston=require(_0xe19e('0x1'));var config=require(_0xe19e('0x2'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xe19e('0x3')]():_0xe19e('0x4');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':_0xe19e('0x5'),'warn':_0xe19e('0x6'),'info':_0xe19e('0x7'),'print':_0xe19e('0x8'),'success':_0xe19e('0x9'),'http':_0xe19e('0xa'),'verbose':_0xe19e('0xb'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xe19e('0xc')](XC_LOG_COLORS);function getLogFileName(_0x4e5bba,_0x14091b,_0x27e70d){var _0x2eeb36=_0x4e5bba||_0xe19e('0xd');return path[_0xe19e('0xe')](_0x2eeb36,util[_0xe19e('0xf')](_0xe19e('0x10'),_0x14091b,_0x27e70d));}function formatter(_0x1db058,_0x376c0b){_0x376c0b[_0xe19e('0x11')]=_0x376c0b['message']['replace'](/@@{/g,_0xe19e('0x12'))[_0xe19e('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xe19e('0x13')](/}@/g,'}}');return util[_0xe19e('0xf')](_0xe19e('0x14'),moment()[_0xe19e('0xf')](_0xe19e('0x15')),_0x376c0b[_0xe19e('0x16')][_0xe19e('0x17')](),_0x1db058,_0x376c0b['message']);}function fileFormat(_0x5c24c0,_0x26fbe0){_0x26fbe0[_0xe19e('0x11')]=_0x26fbe0['message'][_0xe19e('0x13')](/@@{/g,_0xe19e('0x12'))[_0xe19e('0x13')](/}@@/g,'}}}')[_0xe19e('0x13')](/@{/g,'{{')[_0xe19e('0x13')](/}@/g,'}}');var _0x343694=_0x26fbe0[_0xe19e('0x18')]&&Object[_0xe19e('0x19')](_0x26fbe0[_0xe19e('0x18')])['length']?'\x0a\x09'+JSON[_0xe19e('0x1a')](_0x26fbe0[_0xe19e('0x18')]):'';return util[_0xe19e('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xe19e('0xf')](_0xe19e('0x15')),_0x26fbe0['level']['toUpperCase'](),_0x5c24c0,_0x26fbe0[_0xe19e('0x11')],_0x343694);}function consoleLogger(){var _0x529744=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe19e('0x1b'))][(_0xe19e('0x1c'))]({'level':_0xe19e('0x1d'),'json':![],'formatter':function(_0x3661da){return formatter('',_0x3661da);}})]});return _0x529744;}function fileLogger(_0x492e6a,_0x39233c){var _0x4974dc=new winston[(_0xe19e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe19e('0x1b'))][(_0xe19e('0x1f'))]({'name':util[_0xe19e('0xf')](_0xe19e('0x20'),_0x492e6a,_0xe19e('0x21')),'filename':getLogFileName(_0x39233c,_0x492e6a,_0xe19e('0x21')),'level':_0xe19e('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x462bc7){return fileFormat(_0x492e6a,_0x462bc7);}}),new winston[(_0xe19e('0x1b'))][(_0xe19e('0x1f'))]({'name':util[_0xe19e('0xf')](_0xe19e('0x20'),_0x492e6a,debugLevel),'filename':getLogFileName(_0x39233c,_0x492e6a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x308082){return fileFormat(_0x492e6a,_0x308082);}}),new winston[(_0xe19e('0x1b'))][(_0xe19e('0x1c'))]({'level':_0xe19e('0x1d'),'json':![],'formatter':function(_0x1d3980){return fileFormat(_0x492e6a,_0x1d3980);}})]});return _0x4974dc;}exports[_0xe19e('0x22')]=consoleLogger;exports[_0xe19e('0x23')]=fileLogger; \ No newline at end of file +var _0x0997=['replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','winston','debugLevel','toLowerCase','info','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x0997,0x1ab));var _0x7099=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0997[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x7099('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x7099('0x1'));var config=require('../config/environment');var debugLevel=config[_0x7099('0x2')]?config[_0x7099('0x2')][_0x7099('0x3')]():_0x7099('0x4');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':_0x7099('0x5'),'warn':'bold\x20yellow','info':_0x7099('0x6'),'print':_0x7099('0x7'),'success':'bold\x20green','http':_0x7099('0x8'),'verbose':_0x7099('0x9'),'debug':_0x7099('0xa'),'silly':_0x7099('0xb')};winston[_0x7099('0xc')](XC_LOG_COLORS);function getLogFileName(_0x30d4f4,_0x585b91,_0x22d3b5){var _0x2261c2=_0x30d4f4||_0x7099('0xd');return path[_0x7099('0xe')](_0x2261c2,util[_0x7099('0xf')]('%s-%s.log',_0x585b91,_0x22d3b5));}function formatter(_0x2a93f4,_0x383f73){_0x383f73['message']=_0x383f73[_0x7099('0x10')][_0x7099('0x11')](/@@{/g,_0x7099('0x12'))['replace'](/}@@/g,_0x7099('0x13'))['replace'](/@{/g,'{{')[_0x7099('0x11')](/}@/g,'}}');return util[_0x7099('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x7099('0xf')](_0x7099('0x14')),_0x383f73[_0x7099('0x15')][_0x7099('0x16')](),_0x2a93f4,_0x383f73[_0x7099('0x10')]);}function fileFormat(_0x233acd,_0x365e36){_0x365e36[_0x7099('0x10')]=_0x365e36[_0x7099('0x10')][_0x7099('0x11')](/@@{/g,_0x7099('0x12'))[_0x7099('0x11')](/}@@/g,_0x7099('0x13'))[_0x7099('0x11')](/@{/g,'{{')[_0x7099('0x11')](/}@/g,'}}');var _0x3111b3=_0x365e36[_0x7099('0x17')]&&Object[_0x7099('0x18')](_0x365e36[_0x7099('0x17')])[_0x7099('0x19')]?'\x0a\x09'+JSON[_0x7099('0x1a')](_0x365e36['meta']):'';return util[_0x7099('0xf')](_0x7099('0x1b'),moment()['format'](_0x7099('0x14')),_0x365e36[_0x7099('0x15')][_0x7099('0x16')](),_0x233acd,_0x365e36[_0x7099('0x10')],_0x3111b3);}function consoleLogger(){var _0x293ce2=new winston[(_0x7099('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7099('0x1d'))][(_0x7099('0x1e'))]({'level':_0x7099('0x1f'),'json':![],'formatter':function(_0x218794){return formatter('',_0x218794);}})]});return _0x293ce2;}function fileLogger(_0x47912f,_0x5d71ad){var _0x5caced=new winston[(_0x7099('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7099('0x1d'))][(_0x7099('0x20'))]({'name':util[_0x7099('0xf')](_0x7099('0x21'),_0x47912f,_0x7099('0x22')),'filename':getLogFileName(_0x5d71ad,_0x47912f,_0x7099('0x22')),'level':_0x7099('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x9c8305){return fileFormat(_0x47912f,_0x9c8305);}}),new winston[(_0x7099('0x1d'))][(_0x7099('0x20'))]({'name':util[_0x7099('0xf')](_0x7099('0x21'),_0x47912f,debugLevel),'filename':getLogFileName(_0x5d71ad,_0x47912f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4b3497){return fileFormat(_0x47912f,_0x4b3497);}}),new winston[(_0x7099('0x1d'))][(_0x7099('0x1e'))]({'level':_0x7099('0x1f'),'json':![],'formatter':function(_0x33976d){return fileFormat(_0x47912f,_0x33976d);}})]});return _0x5caced;}exports[_0x7099('0x23')]=consoleLogger;exports[_0x7099('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index bbec4c9..23e7a24 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0xa19ad8,_0x3bfab6){var _0x42d194=function(_0x23cd70){while(--_0x23cd70){_0xa19ad8['push'](_0xa19ad8['shift']());}};_0x42d194(++_0x3bfab6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0x0b0e[_0x68c4d9];return _0x62da93;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x350a92,_0x19b1d3){var _0x40c421=function(_0x1be9a5){while(--_0x1be9a5){_0x350a92['push'](_0x350a92['shift']());}};_0x40c421(++_0x19b1d3);}(_0x1261,0x144));var _0x1126=function(_0x4a055e,_0x59b80a){_0x4a055e=_0x4a055e-0x0;var _0x328a29=_0x1261[_0x4a055e];return _0x328a29;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 59a97ab..4e03449 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 _0xb62e=['map','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x21333e,_0x3187d3){var _0x242841=function(_0x14cbd9){while(--_0x14cbd9){_0x21333e['push'](_0x21333e['shift']());}};_0x242841(++_0x3187d3);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};var _=require(_0xeb62('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x46335b){return _0x46335b==='{{'?_0xeb62('0x1'):_0xeb62('0x2');}function safeTemplate(_0x57a5ba){var _0x3dfdef=_0x57a5ba;if(typeof _0x57a5ba===_0xeb62('0x3')){_0x3dfdef=_0x57a5ba[_0xeb62('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb62('0x5')](_0x57a5ba)){_0x3dfdef=_0x57a5ba[_0xeb62('0x6')](function(_0x1ebdbb){return safeTemplate(_0x1ebdbb);});}else if(_['isPlainObject'](_0x57a5ba)){_0x3dfdef=Object[_0xeb62('0x7')](_0x57a5ba)[_0xeb62('0x8')](function(_0x31f5ea,_0x5e0dc4){_0x31f5ea[_0x5e0dc4]=safeTemplate(_0x57a5ba[_0x5e0dc4]);return _0x31f5ea;},{});}return _0x3dfdef;}module[_0xeb62('0x9')][_0xeb62('0xa')]=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x2cebe3,_0x4d734c){var _0x586706=function(_0x10921f){while(--_0x10921f){_0x2cebe3['push'](_0x2cebe3['shift']());}};_0x586706(++_0x4d734c);}(_0x4fc2,0x111));var _0x24fc=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0x4fc2[_0x3f7830];return _0x392bcf;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a9906c7..d57ff99 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 _0x5801=['root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment'];(function(_0x353e55,_0x384e65){var _0xe1646a=function(_0x4f2877){while(--_0x4f2877){_0x353e55['push'](_0x353e55['shift']());}};_0xe1646a(++_0x384e65);}(_0x5801,0xf9));var _0x1580=function(_0x69b02c,_0xa8d061){_0x69b02c=_0x69b02c-0x0;var _0xf02009=_0x5801[_0x69b02c];return _0xf02009;};var fs=require(_0x1580('0x0'));var path=require(_0x1580('0x1'));var config=require(_0x1580('0x2'));var root=config[_0x1580('0x3')];var APP_JSON_PATH=path[_0x1580('0x4')](root,'server/app.json');var NODEPATH=path[_0x1580('0x4')](root,_0x1580('0x5'));function setLegacyLibsNodeEnvPath(_0x48c3c5){let _0x3010ee=![];if(Array[_0x1580('0x6')](_0x48c3c5[_0x1580('0x7')])){var _0x2fdaf2=_0x48c3c5[_0x1580('0x7')][_0x1580('0x8')](function(_0x332947){return _0x332947[_0x1580('0x9')]===_0x1580('0xa');});if(_0x2fdaf2>-0x1){var _0x22802e=_0x48c3c5['apps'][_0x2fdaf2];if(typeof _0x22802e[_0x1580('0xb')][_0x1580('0xc')]!==_0x1580('0xd')){_0x22802e[_0x1580('0xb')][_0x1580('0xc')]=NODEPATH;_0x3010ee=!![];}}return{'appConfig':_0x48c3c5,'updated':_0x3010ee};}}function updateAppConfig(_0x22b5e5){return fs[_0x1580('0xe')](APP_JSON_PATH)[_0x1580('0xf')](function(_0x3149b6){if(_0x3149b6){return fs[_0x1580('0x10')](APP_JSON_PATH)['then'](function(_0x3731e4){var _0x293f7e=setLegacyLibsNodeEnvPath(_0x3731e4);if(_0x293f7e[_0x1580('0x11')]){_0x22b5e5['info'](_0x1580('0x12'));return fs[_0x1580('0x13')](APP_JSON_PATH,_0x3731e4,{'spaces':0x2});}else{return Promise[_0x1580('0x4')]();}});}else{return Promise[_0x1580('0x4')]();}});}module[_0x1580('0x14')]=updateAppConfig; \ No newline at end of file +var _0xb616=['resolve','server/app.json','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','path','../config/environment','root'];(function(_0x15d966,_0x521d2f){var _0x20b84b=function(_0x5e2f02){while(--_0x5e2f02){_0x15d966['push'](_0x15d966['shift']());}};_0x20b84b(++_0x521d2f);}(_0xb616,0x7b));var _0x6b61=function(_0x1584e7,_0x5162f8){_0x1584e7=_0x1584e7-0x0;var _0x39752f=_0xb616[_0x1584e7];return _0x39752f;};var fs=require('fs-extra');var path=require(_0x6b61('0x0'));var config=require(_0x6b61('0x1'));var root=config[_0x6b61('0x2')];var APP_JSON_PATH=path[_0x6b61('0x3')](root,_0x6b61('0x4'));var NODEPATH=path[_0x6b61('0x3')](root,_0x6b61('0x5'));function setLegacyLibsNodeEnvPath(_0x2ede68){let _0x127e80=![];if(Array[_0x6b61('0x6')](_0x2ede68['apps'])){var _0x1933b8=_0x2ede68[_0x6b61('0x7')][_0x6b61('0x8')](function(_0x2746ee){return _0x2746ee['name']===_0x6b61('0x9');});if(_0x1933b8>-0x1){var _0x3103d0=_0x2ede68['apps'][_0x1933b8];if(typeof _0x3103d0[_0x6b61('0xa')][_0x6b61('0xb')]!==_0x6b61('0xc')){_0x3103d0[_0x6b61('0xa')][_0x6b61('0xb')]=NODEPATH;_0x127e80=!![];}}return{'appConfig':_0x2ede68,'updated':_0x127e80};}}function updateAppConfig(_0x19d8a0){return fs[_0x6b61('0xd')](APP_JSON_PATH)[_0x6b61('0xe')](function(_0x31e984){if(_0x31e984){return fs[_0x6b61('0xf')](APP_JSON_PATH)[_0x6b61('0xe')](function(_0x3a557f){var _0xec666e=setLegacyLibsNodeEnvPath(_0x3a557f);if(_0xec666e[_0x6b61('0x10')]){_0x19d8a0[_0x6b61('0x11')](_0x6b61('0x12'));return fs[_0x6b61('0x13')](APP_JSON_PATH,_0x3a557f,{'spaces':0x2});}else{return Promise[_0x6b61('0x3')]();}});}else{return Promise[_0x6b61('0x3')]();}});}module[_0x6b61('0x14')]=updateAppConfig; \ No newline at end of file